var __create = Object.create;
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
  for (var prop in b ||= {})
    if (__hasOwnProp.call(b, prop))
      __defNormalProp(a, prop, b[prop]);
  if (__getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(b)) {
      if (__propIsEnum.call(b, prop))
        __defNormalProp(a, prop, b[prop]);
    }
  return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
}) : x)(function(x) {
  if (typeof require !== "undefined") return require.apply(this, arguments);
  throw Error('Dynamic require of "' + x + '" is not supported');
});
var __commonJS = (cb, mod) => function __require2() {
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __copyProps = (to, from2, except, desc) => {
  if (from2 && typeof from2 === "object" || typeof from2 === "function") {
    for (let key of __getOwnPropNames(from2))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from2[key], enumerable: !(desc = __getOwnPropDesc(from2, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));

// node_modules/papaparse/papaparse.min.js
var require_papaparse_min = __commonJS({
  "node_modules/papaparse/papaparse.min.js"(exports, module) {
    "use strict";
    ((e, t) => {
      "function" == typeof define && define.amd ? define([], t) : "object" == typeof module && "undefined" != typeof exports ? module.exports = t() : e.Papa = t();
    })(exports, function r() {
      var n = "undefined" != typeof self ? self : "undefined" != typeof window ? window : void 0 !== n ? n : {};
      var d, s = !n.document && !!n.postMessage, a = n.IS_PAPA_WORKER || false, o = {}, h = 0, v = {};
      function u2(e) {
        this._handle = null, this._finished = false, this._completed = false, this._halted = false, this._input = null, this._baseIndex = 0, this._partialLine = "", this._rowCount = 0, this._start = 0, this._nextChunk = null, this.isFirstChunk = true, this._completeResults = { data: [], errors: [], meta: {} }, (function(e2) {
          var t = b(e2);
          t.chunkSize = parseInt(t.chunkSize), e2.step || e2.chunk || (t.chunkSize = null);
          this._handle = new i(t), (this._handle.streamer = this)._config = t;
        }).call(this, e), this.parseChunk = function(t, e2) {
          var i2 = parseInt(this._config.skipFirstNLines) || 0;
          if (this.isFirstChunk && 0 < i2) {
            let e3 = this._config.newline;
            e3 || (r2 = this._config.quoteChar || '"', e3 = this._handle.guessLineEndings(t, r2)), t = [...t.split(e3).slice(i2)].join(e3);
          }
          this.isFirstChunk && U2(this._config.beforeFirstChunk) && void 0 !== (r2 = this._config.beforeFirstChunk(t)) && (t = r2), this.isFirstChunk = false, this._halted = false;
          var i2 = this._partialLine + t, r2 = (this._partialLine = "", this._handle.parse(i2, this._baseIndex, !this._finished));
          if (!this._handle.paused() && !this._handle.aborted()) {
            t = r2.meta.cursor, i2 = (this._finished || (this._partialLine = i2.substring(t - this._baseIndex), this._baseIndex = t), r2 && r2.data && (this._rowCount += r2.data.length), this._finished || this._config.preview && this._rowCount >= this._config.preview);
            if (a) n.postMessage({ results: r2, workerId: v.WORKER_ID, finished: i2 });
            else if (U2(this._config.chunk) && !e2) {
              if (this._config.chunk(r2, this._handle), this._handle.paused() || this._handle.aborted()) return void (this._halted = true);
              this._completeResults = r2 = void 0;
            }
            return this._config.step || this._config.chunk || (this._completeResults.data = this._completeResults.data.concat(r2.data), this._completeResults.errors = this._completeResults.errors.concat(r2.errors), this._completeResults.meta = r2.meta), this._completed || !i2 || !U2(this._config.complete) || r2 && r2.meta.aborted || (this._config.complete(this._completeResults, this._input), this._completed = true), i2 || r2 && r2.meta.paused || this._nextChunk(), r2;
          }
          this._halted = true;
        }, this._sendError = function(e2) {
          U2(this._config.error) ? this._config.error(e2) : a && this._config.error && n.postMessage({ workerId: v.WORKER_ID, error: e2, finished: false });
        };
      }
      function f(e) {
        var r2;
        (e = e || {}).chunkSize || (e.chunkSize = v.RemoteChunkSize), u2.call(this, e), this._nextChunk = s ? function() {
          this._readChunk(), this._chunkLoaded();
        } : function() {
          this._readChunk();
        }, this.stream = function(e2) {
          this._input = e2, this._nextChunk();
        }, this._readChunk = function() {
          if (this._finished) this._chunkLoaded();
          else {
            if (r2 = new XMLHttpRequest(), this._config.withCredentials && (r2.withCredentials = this._config.withCredentials), s || (r2.onload = y(this._chunkLoaded, this), r2.onerror = y(this._chunkError, this)), r2.open(this._config.downloadRequestBody ? "POST" : "GET", this._input, !s), this._config.downloadRequestHeaders) {
              var e2, t = this._config.downloadRequestHeaders;
              for (e2 in t) r2.setRequestHeader(e2, t[e2]);
            }
            var i2;
            this._config.chunkSize && (i2 = this._start + this._config.chunkSize - 1, r2.setRequestHeader("Range", "bytes=" + this._start + "-" + i2));
            try {
              r2.send(this._config.downloadRequestBody);
            } catch (e3) {
              this._chunkError(e3.message);
            }
            s && 0 === r2.status && this._chunkError();
          }
        }, this._chunkLoaded = function() {
          4 === r2.readyState && (r2.status < 200 || 400 <= r2.status ? this._chunkError() : (this._start += this._config.chunkSize || r2.responseText.length, this._finished = !this._config.chunkSize || this._start >= ((e2) => null !== (e2 = e2.getResponseHeader("Content-Range")) ? parseInt(e2.substring(e2.lastIndexOf("/") + 1)) : -1)(r2), this.parseChunk(r2.responseText)));
        }, this._chunkError = function(e2) {
          e2 = r2.statusText || e2;
          this._sendError(new Error(e2));
        };
      }
      function l(e) {
        (e = e || {}).chunkSize || (e.chunkSize = v.LocalChunkSize), u2.call(this, e);
        var i2, r2, n2 = "undefined" != typeof FileReader;
        this.stream = function(e2) {
          this._input = e2, r2 = e2.slice || e2.webkitSlice || e2.mozSlice, n2 ? ((i2 = new FileReader()).onload = y(this._chunkLoaded, this), i2.onerror = y(this._chunkError, this)) : i2 = new FileReaderSync(), this._nextChunk();
        }, this._nextChunk = function() {
          this._finished || this._config.preview && !(this._rowCount < this._config.preview) || this._readChunk();
        }, this._readChunk = function() {
          var e2 = this._input, t = (this._config.chunkSize && (t = Math.min(this._start + this._config.chunkSize, this._input.size), e2 = r2.call(e2, this._start, t)), i2.readAsText(e2, this._config.encoding));
          n2 || this._chunkLoaded({ target: { result: t } });
        }, this._chunkLoaded = function(e2) {
          this._start += this._config.chunkSize, this._finished = !this._config.chunkSize || this._start >= this._input.size, this.parseChunk(e2.target.result);
        }, this._chunkError = function() {
          this._sendError(i2.error);
        };
      }
      function c(e) {
        var i2;
        u2.call(this, e = e || {}), this.stream = function(e2) {
          return i2 = e2, this._nextChunk();
        }, this._nextChunk = function() {
          var e2, t;
          if (!this._finished) return e2 = this._config.chunkSize, i2 = e2 ? (t = i2.substring(0, e2), i2.substring(e2)) : (t = i2, ""), this._finished = !i2, this.parseChunk(t);
        };
      }
      function p(e) {
        u2.call(this, e = e || {});
        var t = [], i2 = true, r2 = false;
        this.pause = function() {
          u2.prototype.pause.apply(this, arguments), this._input.pause();
        }, this.resume = function() {
          u2.prototype.resume.apply(this, arguments), this._input.resume();
        }, this.stream = function(e2) {
          this._input = e2, this._input.on("data", this._streamData), this._input.on("end", this._streamEnd), this._input.on("error", this._streamError);
        }, this._checkIsFinished = function() {
          r2 && 1 === t.length && (this._finished = true);
        }, this._nextChunk = function() {
          this._checkIsFinished(), t.length ? this.parseChunk(t.shift()) : i2 = true;
        }, this._streamData = y(function(e2) {
          try {
            t.push("string" == typeof e2 ? e2 : e2.toString(this._config.encoding)), i2 && (i2 = false, this._checkIsFinished(), this.parseChunk(t.shift()));
          } catch (e3) {
            this._streamError(e3);
          }
        }, this), this._streamError = y(function(e2) {
          this._streamCleanUp(), this._sendError(e2);
        }, this), this._streamEnd = y(function() {
          this._streamCleanUp(), r2 = true, this._streamData("");
        }, this), this._streamCleanUp = y(function() {
          this._input.removeListener("data", this._streamData), this._input.removeListener("end", this._streamEnd), this._input.removeListener("error", this._streamError);
        }, this);
      }
      function i(m2) {
        var n2, s2, a2, t, o2 = Math.pow(2, 53), h2 = -o2, u3 = /^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/, d2 = /^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/, i2 = this, r2 = 0, f2 = 0, l2 = false, e = false, c2 = [], p2 = { data: [], errors: [], meta: {} };
        function y2(e2) {
          return "greedy" === m2.skipEmptyLines ? "" === e2.join("").trim() : 1 === e2.length && 0 === e2[0].length;
        }
        function g2() {
          if (p2 && a2 && (k("Delimiter", "UndetectableDelimiter", "Unable to auto-detect delimiting character; defaulted to '" + v.DefaultDelimiter + "'"), a2 = false), m2.skipEmptyLines && (p2.data = p2.data.filter(function(e3) {
            return !y2(e3);
          })), _5()) {
            let t3 = function(e3, t4) {
              U2(m2.transformHeader) && (e3 = m2.transformHeader(e3, t4)), c2.push(e3);
            };
            var t2 = t3;
            if (p2) if (Array.isArray(p2.data[0])) {
              for (var e2 = 0; _5() && e2 < p2.data.length; e2++) p2.data[e2].forEach(t3);
              p2.data.splice(0, 1);
            } else p2.data.forEach(t3);
          }
          function i3(e3, t3) {
            for (var i4 = m2.header ? {} : [], r5 = 0; r5 < e3.length; r5++) {
              var n3 = r5, s3 = e3[r5], s3 = ((e4, t4) => ((e5) => (m2.dynamicTypingFunction && void 0 === m2.dynamicTyping[e5] && (m2.dynamicTyping[e5] = m2.dynamicTypingFunction(e5)), true === (m2.dynamicTyping[e5] || m2.dynamicTyping)))(e4) ? "true" === t4 || "TRUE" === t4 || "false" !== t4 && "FALSE" !== t4 && (((e5) => {
                if (u3.test(e5)) {
                  e5 = parseFloat(e5);
                  if (h2 < e5 && e5 < o2) return 1;
                }
              })(t4) ? parseFloat(t4) : d2.test(t4) ? new Date(t4) : "" === t4 ? null : t4) : t4)(n3 = m2.header ? r5 >= c2.length ? "__parsed_extra" : c2[r5] : n3, s3 = m2.transform ? m2.transform(s3, n3) : s3);
              "__parsed_extra" === n3 ? (i4[n3] = i4[n3] || [], i4[n3].push(s3)) : i4[n3] = s3;
            }
            return m2.header && (r5 > c2.length ? k("FieldMismatch", "TooManyFields", "Too many fields: expected " + c2.length + " fields but parsed " + r5, f2 + t3) : r5 < c2.length && k("FieldMismatch", "TooFewFields", "Too few fields: expected " + c2.length + " fields but parsed " + r5, f2 + t3)), i4;
          }
          var r4;
          p2 && (m2.header || m2.dynamicTyping || m2.transform) && (r4 = 1, !p2.data.length || Array.isArray(p2.data[0]) ? (p2.data = p2.data.map(i3), r4 = p2.data.length) : p2.data = i3(p2.data, 0), m2.header && p2.meta && (p2.meta.fields = c2), f2 += r4);
        }
        function _5() {
          return m2.header && 0 === c2.length;
        }
        function k(e2, t2, i3, r4) {
          e2 = { type: e2, code: t2, message: i3 };
          void 0 !== r4 && (e2.row = r4), p2.errors.push(e2);
        }
        U2(m2.step) && (t = m2.step, m2.step = function(e2) {
          p2 = e2, _5() ? g2() : (g2(), 0 !== p2.data.length && (r2 += e2.data.length, m2.preview && r2 > m2.preview ? s2.abort() : (p2.data = p2.data[0], t(p2, i2))));
        }), this.parse = function(e2, t2, i3) {
          var r4 = m2.quoteChar || '"', r4 = (m2.newline || (m2.newline = this.guessLineEndings(e2, r4)), a2 = false, m2.delimiter ? U2(m2.delimiter) && (m2.delimiter = m2.delimiter(e2), p2.meta.delimiter = m2.delimiter) : ((r4 = ((e3, t3, i4, r5, n3) => {
            var s3, a3, o3, h3;
            n3 = n3 || [",", "	", "|", ";", v.RECORD_SEP, v.UNIT_SEP];
            for (var u4 = 0; u4 < n3.length; u4++) {
              for (var d3, f3 = n3[u4], l3 = 0, c3 = 0, p3 = 0, g3 = (o3 = void 0, new E2({ comments: r5, delimiter: f3, newline: t3, preview: 10 }).parse(e3)), _6 = 0; _6 < g3.data.length; _6++) i4 && y2(g3.data[_6]) ? p3++ : (d3 = g3.data[_6].length, c3 += d3, void 0 === o3 ? o3 = d3 : 0 < d3 && (l3 += Math.abs(d3 - o3), o3 = d3));
              0 < g3.data.length && (c3 /= g3.data.length - p3), (void 0 === a3 || l3 <= a3) && (void 0 === h3 || h3 < c3) && 1.99 < c3 && (a3 = l3, s3 = f3, h3 = c3);
            }
            return { successful: !!(m2.delimiter = s3), bestDelimiter: s3 };
          })(e2, m2.newline, m2.skipEmptyLines, m2.comments, m2.delimitersToGuess)).successful ? m2.delimiter = r4.bestDelimiter : (a2 = true, m2.delimiter = v.DefaultDelimiter), p2.meta.delimiter = m2.delimiter), b(m2));
          return m2.preview && m2.header && r4.preview++, n2 = e2, s2 = new E2(r4), p2 = s2.parse(n2, t2, i3), g2(), l2 ? { meta: { paused: true } } : p2 || { meta: { paused: false } };
        }, this.paused = function() {
          return l2;
        }, this.pause = function() {
          l2 = true, s2.abort(), n2 = U2(m2.chunk) ? "" : n2.substring(s2.getCharIndex());
        }, this.resume = function() {
          i2.streamer._halted ? (l2 = false, i2.streamer.parseChunk(n2, true)) : setTimeout(i2.resume, 3);
        }, this.aborted = function() {
          return e;
        }, this.abort = function() {
          e = true, s2.abort(), p2.meta.aborted = true, U2(m2.complete) && m2.complete(p2), n2 = "";
        }, this.guessLineEndings = function(e2, t2) {
          e2 = e2.substring(0, 1048576);
          var t2 = new RegExp(P2(t2) + "([^]*?)" + P2(t2), "gm"), i3 = (e2 = e2.replace(t2, "")).split("\r"), t2 = e2.split("\n"), e2 = 1 < t2.length && t2[0].length < i3[0].length;
          if (1 === i3.length || e2) return "\n";
          for (var r4 = 0, n3 = 0; n3 < i3.length; n3++) "\n" === i3[n3][0] && r4++;
          return r4 >= i3.length / 2 ? "\r\n" : "\r";
        };
      }
      function P2(e) {
        return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
      }
      function E2(C2) {
        var S2 = (C2 = C2 || {}).delimiter, O2 = C2.newline, x = C2.comments, I2 = C2.step, A2 = C2.preview, T2 = C2.fastMode, D2 = null, L2 = false, F13 = null == C2.quoteChar ? '"' : C2.quoteChar, j = F13;
        if (void 0 !== C2.escapeChar && (j = C2.escapeChar), ("string" != typeof S2 || -1 < v.BAD_DELIMITERS.indexOf(S2)) && (S2 = ","), x === S2) throw new Error("Comment character same as delimiter");
        true === x ? x = "#" : ("string" != typeof x || -1 < v.BAD_DELIMITERS.indexOf(x)) && (x = false), "\n" !== O2 && "\r" !== O2 && "\r\n" !== O2 && (O2 = "\n");
        var z = 0, M2 = false;
        this.parse = function(i2, t, r2) {
          if ("string" != typeof i2) throw new Error("Input must be a string");
          var n2 = i2.length, e = S2.length, s2 = O2.length, a2 = x.length, o2 = U2(I2), h2 = [], u3 = [], d2 = [], f2 = z = 0;
          if (!i2) return w();
          if (T2 || false !== T2 && -1 === i2.indexOf(F13)) {
            for (var l2 = i2.split(O2), c2 = 0; c2 < l2.length; c2++) {
              if (d2 = l2[c2], z += d2.length, c2 !== l2.length - 1) z += O2.length;
              else if (r2) return w();
              if (!x || d2.substring(0, a2) !== x) {
                if (o2) {
                  if (h2 = [], k(d2.split(S2)), R2(), M2) return w();
                } else k(d2.split(S2));
                if (A2 && A2 <= c2) return h2 = h2.slice(0, A2), w(true);
              }
            }
            return w();
          }
          for (var p2 = i2.indexOf(S2, z), g2 = i2.indexOf(O2, z), _5 = new RegExp(P2(j) + P2(F13), "g"), m2 = i2.indexOf(F13, z); ; ) if (i2[z] === F13) for (m2 = z, z++; ; ) {
            if (-1 === (m2 = i2.indexOf(F13, m2 + 1))) return r2 || u3.push({ type: "Quotes", code: "MissingQuotes", message: "Quoted field unterminated", row: h2.length, index: z }), E3();
            if (m2 === n2 - 1) return E3(i2.substring(z, m2).replace(_5, F13));
            if (F13 === j && i2[m2 + 1] === j) m2++;
            else if (F13 === j || 0 === m2 || i2[m2 - 1] !== j) {
              -1 !== p2 && p2 < m2 + 1 && (p2 = i2.indexOf(S2, m2 + 1));
              var y2 = v2(-1 === (g2 = -1 !== g2 && g2 < m2 + 1 ? i2.indexOf(O2, m2 + 1) : g2) ? p2 : Math.min(p2, g2));
              if (i2.substr(m2 + 1 + y2, e) === S2) {
                d2.push(i2.substring(z, m2).replace(_5, F13)), i2[z = m2 + 1 + y2 + e] !== F13 && (m2 = i2.indexOf(F13, z)), p2 = i2.indexOf(S2, z), g2 = i2.indexOf(O2, z);
                break;
              }
              y2 = v2(g2);
              if (i2.substring(m2 + 1 + y2, m2 + 1 + y2 + s2) === O2) {
                if (d2.push(i2.substring(z, m2).replace(_5, F13)), b2(m2 + 1 + y2 + s2), p2 = i2.indexOf(S2, z), m2 = i2.indexOf(F13, z), o2 && (R2(), M2)) return w();
                if (A2 && h2.length >= A2) return w(true);
                break;
              }
              u3.push({ type: "Quotes", code: "InvalidQuotes", message: "Trailing quote on quoted field is malformed", row: h2.length, index: z }), m2++;
            }
          }
          else if (x && 0 === d2.length && i2.substring(z, z + a2) === x) {
            if (-1 === g2) return w();
            z = g2 + s2, g2 = i2.indexOf(O2, z), p2 = i2.indexOf(S2, z);
          } else if (-1 !== p2 && (p2 < g2 || -1 === g2)) d2.push(i2.substring(z, p2)), z = p2 + e, p2 = i2.indexOf(S2, z);
          else {
            if (-1 === g2) break;
            if (d2.push(i2.substring(z, g2)), b2(g2 + s2), o2 && (R2(), M2)) return w();
            if (A2 && h2.length >= A2) return w(true);
          }
          return E3();
          function k(e2) {
            h2.push(e2), f2 = z;
          }
          function v2(e2) {
            var t2 = 0;
            return t2 = -1 !== e2 && (e2 = i2.substring(m2 + 1, e2)) && "" === e2.trim() ? e2.length : t2;
          }
          function E3(e2) {
            return r2 || (void 0 === e2 && (e2 = i2.substring(z)), d2.push(e2), z = n2, k(d2), o2 && R2()), w();
          }
          function b2(e2) {
            z = e2, k(d2), d2 = [], g2 = i2.indexOf(O2, z);
          }
          function w(e2) {
            if (C2.header && !t && h2.length && !L2) {
              var s3 = h2[0], a3 = /* @__PURE__ */ Object.create(null), o3 = new Set(s3);
              let n3 = false;
              for (let r4 = 0; r4 < s3.length; r4++) {
                let i3 = s3[r4];
                if (a3[i3 = U2(C2.transformHeader) ? C2.transformHeader(i3, r4) : i3]) {
                  let e3, t2 = a3[i3];
                  for (; e3 = i3 + "_" + t2, t2++, o3.has(e3); ) ;
                  o3.add(e3), s3[r4] = e3, a3[i3]++, n3 = true, (D2 = null === D2 ? {} : D2)[e3] = i3;
                } else a3[i3] = 1, s3[r4] = i3;
                o3.add(i3);
              }
              n3 && console.warn("Duplicate headers found and renamed."), L2 = true;
            }
            return { data: h2, errors: u3, meta: { delimiter: S2, linebreak: O2, aborted: M2, truncated: !!e2, cursor: f2 + (t || 0), renamedHeaders: D2 } };
          }
          function R2() {
            I2(w()), h2 = [], u3 = [];
          }
        }, this.abort = function() {
          M2 = true;
        }, this.getCharIndex = function() {
          return z;
        };
      }
      function g(e) {
        var t = e.data, i2 = o[t.workerId], r2 = false;
        if (t.error) i2.userError(t.error, t.file);
        else if (t.results && t.results.data) {
          var n2 = { abort: function() {
            r2 = true, _4(t.workerId, { data: [], errors: [], meta: { aborted: true } });
          }, pause: m, resume: m };
          if (U2(i2.userStep)) {
            for (var s2 = 0; s2 < t.results.data.length && (i2.userStep({ data: t.results.data[s2], errors: t.results.errors, meta: t.results.meta }, n2), !r2); s2++) ;
            delete t.results;
          } else U2(i2.userChunk) && (i2.userChunk(t.results, n2, t.file), delete t.results);
        }
        t.finished && !r2 && _4(t.workerId, t.results);
      }
      function _4(e, t) {
        var i2 = o[e];
        U2(i2.userComplete) && i2.userComplete(t), i2.terminate(), delete o[e];
      }
      function m() {
        throw new Error("Not implemented.");
      }
      function b(e) {
        if ("object" != typeof e || null === e) return e;
        var t, i2 = Array.isArray(e) ? [] : {};
        for (t in e) i2[t] = b(e[t]);
        return i2;
      }
      function y(e, t) {
        return function() {
          e.apply(t, arguments);
        };
      }
      function U2(e) {
        return "function" == typeof e;
      }
      return v.parse = function(e, t) {
        var i2 = (t = t || {}).dynamicTyping || false;
        U2(i2) && (t.dynamicTypingFunction = i2, i2 = {});
        if (t.dynamicTyping = i2, t.transform = !!U2(t.transform) && t.transform, !t.worker || !v.WORKERS_SUPPORTED) return i2 = null, v.NODE_STREAM_INPUT, "string" == typeof e ? (e = ((e2) => 65279 !== e2.charCodeAt(0) ? e2 : e2.slice(1))(e), i2 = new (t.download ? f : c)(t)) : true === e.readable && U2(e.read) && U2(e.on) ? i2 = new p(t) : (n.File && e instanceof File || e instanceof Object) && (i2 = new l(t)), i2.stream(e);
        (i2 = (() => {
          var e2;
          return !!v.WORKERS_SUPPORTED && (e2 = (() => {
            var e3 = n.URL || n.webkitURL || null, t2 = r.toString();
            return v.BLOB_URL || (v.BLOB_URL = e3.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ", "(", t2, ")();"], { type: "text/javascript" })));
          })(), (e2 = new n.Worker(e2)).onmessage = g, e2.id = h++, o[e2.id] = e2);
        })()).userStep = t.step, i2.userChunk = t.chunk, i2.userComplete = t.complete, i2.userError = t.error, t.step = U2(t.step), t.chunk = U2(t.chunk), t.complete = U2(t.complete), t.error = U2(t.error), delete t.worker, i2.postMessage({ input: e, config: t, workerId: i2.id });
      }, v.unparse = function(e, t) {
        var n2 = false, _5 = true, m2 = ",", y2 = "\r\n", s2 = '"', a2 = s2 + s2, i2 = false, r2 = null, o2 = false, h2 = ((() => {
          if ("object" == typeof t) {
            if ("string" != typeof t.delimiter || v.BAD_DELIMITERS.filter(function(e2) {
              return -1 !== t.delimiter.indexOf(e2);
            }).length || (m2 = t.delimiter), "boolean" != typeof t.quotes && "function" != typeof t.quotes && !Array.isArray(t.quotes) || (n2 = t.quotes), "boolean" != typeof t.skipEmptyLines && "string" != typeof t.skipEmptyLines || (i2 = t.skipEmptyLines), "string" == typeof t.newline && (y2 = t.newline), "string" == typeof t.quoteChar && (s2 = t.quoteChar), "boolean" == typeof t.header && (_5 = t.header), Array.isArray(t.columns)) {
              if (0 === t.columns.length) throw new Error("Option columns is empty");
              r2 = t.columns;
            }
            void 0 !== t.escapeChar && (a2 = t.escapeChar + s2), t.escapeFormulae instanceof RegExp ? o2 = t.escapeFormulae : "boolean" == typeof t.escapeFormulae && t.escapeFormulae && (o2 = /^[=+\-@\t\r].*$/);
          }
        })(), new RegExp(P2(s2), "g"));
        "string" == typeof e && (e = JSON.parse(e));
        if (Array.isArray(e)) {
          if (!e.length || Array.isArray(e[0])) return u3(null, e, i2);
          if ("object" == typeof e[0]) return u3(r2 || Object.keys(e[0]), e, i2);
        } else if ("object" == typeof e) return "string" == typeof e.data && (e.data = JSON.parse(e.data)), Array.isArray(e.data) && (e.fields || (e.fields = e.meta && e.meta.fields || r2), e.fields || (e.fields = Array.isArray(e.data[0]) ? e.fields : "object" == typeof e.data[0] ? Object.keys(e.data[0]) : []), Array.isArray(e.data[0]) || "object" == typeof e.data[0] || (e.data = [e.data])), u3(e.fields || [], e.data || [], i2);
        throw new Error("Unable to serialize unrecognized input");
        function u3(e2, t2, i3) {
          var r4 = "", n3 = ("string" == typeof e2 && (e2 = JSON.parse(e2)), "string" == typeof t2 && (t2 = JSON.parse(t2)), Array.isArray(e2) && 0 < e2.length), s3 = !Array.isArray(t2[0]);
          if (n3 && _5) {
            for (var a3 = 0; a3 < e2.length; a3++) 0 < a3 && (r4 += m2), r4 += k(e2[a3], a3);
            0 < t2.length && (r4 += y2);
          }
          for (var o3 = 0; o3 < t2.length; o3++) {
            var h3 = (n3 ? e2 : t2[o3]).length, u4 = false, d2 = n3 ? 0 === Object.keys(t2[o3]).length : 0 === t2[o3].length;
            if (i3 && !n3 && (u4 = "greedy" === i3 ? "" === t2[o3].join("").trim() : 1 === t2[o3].length && 0 === t2[o3][0].length), "greedy" === i3 && n3) {
              for (var f2 = [], l2 = 0; l2 < h3; l2++) {
                var c2 = s3 ? e2[l2] : l2;
                f2.push(t2[o3][c2]);
              }
              u4 = "" === f2.join("").trim();
            }
            if (!u4) {
              for (var p2 = 0; p2 < h3; p2++) {
                0 < p2 && !d2 && (r4 += m2);
                var g2 = n3 && s3 ? e2[p2] : p2;
                r4 += k(t2[o3][g2], p2);
              }
              o3 < t2.length - 1 && (!i3 || 0 < h3 && !d2) && (r4 += y2);
            }
          }
          return r4;
        }
        function k(e2, t2) {
          var i3, r4;
          return null == e2 ? "" : e2.constructor === Date ? JSON.stringify(e2).slice(1, 25) : (r4 = false, o2 && "string" == typeof e2 && o2.test(e2) && (e2 = "'" + e2, r4 = true), i3 = e2.toString().replace(h2, a2), (r4 = r4 || true === n2 || "function" == typeof n2 && n2(e2, t2) || Array.isArray(n2) && n2[t2] || ((e3, t3) => {
            for (var i4 = 0; i4 < t3.length; i4++) if (-1 < e3.indexOf(t3[i4])) return true;
            return false;
          })(i3, v.BAD_DELIMITERS) || -1 < i3.indexOf(m2) || " " === i3.charAt(0) || " " === i3.charAt(i3.length - 1)) ? s2 + i3 + s2 : i3);
        }
      }, v.RECORD_SEP = String.fromCharCode(30), v.UNIT_SEP = String.fromCharCode(31), v.BYTE_ORDER_MARK = "\uFEFF", v.BAD_DELIMITERS = ["\r", "\n", '"', v.BYTE_ORDER_MARK], v.WORKERS_SUPPORTED = !s && !!n.Worker, v.NODE_STREAM_INPUT = 1, v.LocalChunkSize = 10485760, v.RemoteChunkSize = 5242880, v.DefaultDelimiter = ",", v.Parser = E2, v.ParserHandle = i, v.NetworkStreamer = f, v.FileStreamer = l, v.StringStreamer = c, v.ReadableStreamStreamer = p, n.jQuery && ((d = n.jQuery).fn.parse = function(o2) {
        var i2 = o2.config || {}, h2 = [];
        return this.each(function(e2) {
          if (!("INPUT" === d(this).prop("tagName").toUpperCase() && "file" === d(this).attr("type").toLowerCase() && n.FileReader) || !this.files || 0 === this.files.length) return true;
          for (var t = 0; t < this.files.length; t++) h2.push({ file: this.files[t], inputElem: this, instanceConfig: d.extend({}, i2) });
        }), e(), this;
        function e() {
          if (0 === h2.length) U2(o2.complete) && o2.complete();
          else {
            var e2, t, i3, r2, n2 = h2[0];
            if (U2(o2.before)) {
              var s2 = o2.before(n2.file, n2.inputElem);
              if ("object" == typeof s2) {
                if ("abort" === s2.action) return e2 = "AbortError", t = n2.file, i3 = n2.inputElem, r2 = s2.reason, void (U2(o2.error) && o2.error({ name: e2 }, t, i3, r2));
                if ("skip" === s2.action) return void u3();
                "object" == typeof s2.config && (n2.instanceConfig = d.extend(n2.instanceConfig, s2.config));
              } else if ("skip" === s2) return void u3();
            }
            var a2 = n2.instanceConfig.complete;
            n2.instanceConfig.complete = function(e3) {
              U2(a2) && a2(e3, n2.file, n2.inputElem), u3();
            }, v.parse(n2.file, n2.instanceConfig);
          }
        }
        function u3() {
          h2.splice(0, 1), e();
        }
      }), a && (n.onmessage = function(e) {
        e = e.data;
        void 0 === v.WORKER_ID && e && (v.WORKER_ID = e.workerId);
        "string" == typeof e.input ? n.postMessage({ workerId: v.WORKER_ID, results: v.parse(e.input, e.config), finished: true }) : (n.File && e.input instanceof File || e.input instanceof Object) && (e = v.parse(e.input, e.config)) && n.postMessage({ workerId: v.WORKER_ID, results: e, finished: true });
      }), (f.prototype = Object.create(u2.prototype)).constructor = f, (l.prototype = Object.create(u2.prototype)).constructor = l, (c.prototype = Object.create(c.prototype)).constructor = c, (p.prototype = Object.create(u2.prototype)).constructor = p, v;
    });
  }
});

// node_modules/lodash/lodash.js
var require_lodash = __commonJS({
  "node_modules/lodash/lodash.js"(exports, module) {
    "use strict";
    (function() {
      var undefined2;
      var VERSION6 = "4.17.21";
      var LARGE_ARRAY_SIZE = 200;
      var CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", FUNC_ERROR_TEXT = "Expected a function", INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`";
      var HASH_UNDEFINED = "__lodash_hash_undefined__";
      var MAX_MEMOIZE_SIZE = 500;
      var PLACEHOLDER = "__lodash_placeholder__";
      var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4;
      var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2;
      var WRAP_BIND_FLAG = 1, WRAP_BIND_KEY_FLAG = 2, WRAP_CURRY_BOUND_FLAG = 4, WRAP_CURRY_FLAG = 8, WRAP_CURRY_RIGHT_FLAG = 16, WRAP_PARTIAL_FLAG = 32, WRAP_PARTIAL_RIGHT_FLAG = 64, WRAP_ARY_FLAG = 128, WRAP_REARG_FLAG = 256, WRAP_FLIP_FLAG = 512;
      var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = "...";
      var HOT_COUNT = 800, HOT_SPAN = 16;
      var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, LAZY_WHILE_FLAG = 3;
      var INFINITY = 1 / 0, MAX_SAFE_INTEGER = 9007199254740991, MAX_INTEGER = 17976931348623157e292, NAN = 0 / 0;
      var MAX_ARRAY_LENGTH = 4294967295, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
      var wrapFlags = [
        ["ary", WRAP_ARY_FLAG],
        ["bind", WRAP_BIND_FLAG],
        ["bindKey", WRAP_BIND_KEY_FLAG],
        ["curry", WRAP_CURRY_FLAG],
        ["curryRight", WRAP_CURRY_RIGHT_FLAG],
        ["flip", WRAP_FLIP_FLAG],
        ["partial", WRAP_PARTIAL_FLAG],
        ["partialRight", WRAP_PARTIAL_RIGHT_FLAG],
        ["rearg", WRAP_REARG_FLAG]
      ];
      var argsTag = "[object Arguments]", arrayTag = "[object Array]", asyncTag = "[object AsyncFunction]", boolTag2 = "[object Boolean]", dateTag = "[object Date]", domExcTag = "[object DOMException]", errorTag = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag = "[object Map]", numberTag = "[object Number]", nullTag2 = "[object Null]", objectTag = "[object Object]", promiseTag = "[object Promise]", proxyTag = "[object Proxy]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]", undefinedTag = "[object Undefined]", weakMapTag = "[object WeakMap]", weakSetTag = "[object WeakSet]";
      var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
      var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
      var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, reUnescapedHtml = /[&<>"']/g, reHasEscapedHtml = RegExp(reEscapedHtml.source), reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
      var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g;
      var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
      var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar.source);
      var reTrimStart = /^\s+/;
      var reWhitespace = /\s/;
      var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, reSplitDetails = /,? & /;
      var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
      var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
      var reEscapeChar = /\\(\\)?/g;
      var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
      var reFlags = /\w*$/;
      var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
      var reIsBinary = /^0b[01]+$/i;
      var reIsHostCtor = /^\[object .+?Constructor\]$/;
      var reIsOctal = /^0o[0-7]+$/i;
      var reIsUint = /^(?:0|[1-9]\d*)$/;
      var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
      var reNoMatch = /($^)/;
      var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
      var rsAstralRange = "\\ud800-\\udfff", rsComboMarksRange = "\\u0300-\\u036f", reComboHalfMarksRange = "\\ufe20-\\ufe2f", rsComboSymbolsRange = "\\u20d0-\\u20ff", rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, rsDingbatRange = "\\u2700-\\u27bf", rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff", rsMathOpRange = "\\xac\\xb1\\xd7\\xf7", rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", rsPunctuationRange = "\\u2000-\\u206f", rsSpaceRange = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde", rsVarRange = "\\ufe0e\\ufe0f", rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
      var rsApos = "['\u2019]", rsAstral = "[" + rsAstralRange + "]", rsBreak = "[" + rsBreakRange + "]", rsCombo = "[" + rsComboRange + "]", rsDigits = "\\d+", rsDingbat = "[" + rsDingbatRange + "]", rsLower = "[" + rsLowerRange + "]", rsMisc = "[^" + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]", rsFitz = "\\ud83c[\\udffb-\\udfff]", rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")", rsNonAstral = "[^" + rsAstralRange + "]", rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}", rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]", rsUpper = "[" + rsUpperRange + "]", rsZWJ = "\\u200d";
      var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")", rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")", rsOptContrLower = "(?:" + rsApos + "(?:d|ll|m|re|s|t|ve))?", rsOptContrUpper = "(?:" + rsApos + "(?:D|LL|M|RE|S|T|VE))?", reOptMod = rsModifier + "?", rsOptVar = "[" + rsVarRange + "]?", rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*", rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", rsSeq = rsOptVar + reOptMod + rsOptJoin, rsEmoji = "(?:" + [rsDingbat, rsRegional, rsSurrPair].join("|") + ")" + rsSeq, rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")";
      var reApos = RegExp(rsApos, "g");
      var reComboMark = RegExp(rsCombo, "g");
      var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
      var reUnicodeWord = RegExp([
        rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
        rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
        rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
        rsUpper + "+" + rsOptContrUpper,
        rsOrdUpper,
        rsOrdLower,
        rsDigits,
        rsEmoji
      ].join("|"), "g");
      var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]");
      var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
      var contextProps = [
        "Array",
        "Buffer",
        "DataView",
        "Date",
        "Error",
        "Float32Array",
        "Float64Array",
        "Function",
        "Int8Array",
        "Int16Array",
        "Int32Array",
        "Map",
        "Math",
        "Object",
        "Promise",
        "RegExp",
        "Set",
        "String",
        "Symbol",
        "TypeError",
        "Uint8Array",
        "Uint8ClampedArray",
        "Uint16Array",
        "Uint32Array",
        "WeakMap",
        "_",
        "clearTimeout",
        "isFinite",
        "parseInt",
        "setTimeout"
      ];
      var templateCounter = -1;
      var typedArrayTags = {};
      typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
      typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag2] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
      var cloneableTags = {};
      cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag2] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
      cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
      var deburredLetters = {
        // Latin-1 Supplement block.
        "\xC0": "A",
        "\xC1": "A",
        "\xC2": "A",
        "\xC3": "A",
        "\xC4": "A",
        "\xC5": "A",
        "\xE0": "a",
        "\xE1": "a",
        "\xE2": "a",
        "\xE3": "a",
        "\xE4": "a",
        "\xE5": "a",
        "\xC7": "C",
        "\xE7": "c",
        "\xD0": "D",
        "\xF0": "d",
        "\xC8": "E",
        "\xC9": "E",
        "\xCA": "E",
        "\xCB": "E",
        "\xE8": "e",
        "\xE9": "e",
        "\xEA": "e",
        "\xEB": "e",
        "\xCC": "I",
        "\xCD": "I",
        "\xCE": "I",
        "\xCF": "I",
        "\xEC": "i",
        "\xED": "i",
        "\xEE": "i",
        "\xEF": "i",
        "\xD1": "N",
        "\xF1": "n",
        "\xD2": "O",
        "\xD3": "O",
        "\xD4": "O",
        "\xD5": "O",
        "\xD6": "O",
        "\xD8": "O",
        "\xF2": "o",
        "\xF3": "o",
        "\xF4": "o",
        "\xF5": "o",
        "\xF6": "o",
        "\xF8": "o",
        "\xD9": "U",
        "\xDA": "U",
        "\xDB": "U",
        "\xDC": "U",
        "\xF9": "u",
        "\xFA": "u",
        "\xFB": "u",
        "\xFC": "u",
        "\xDD": "Y",
        "\xFD": "y",
        "\xFF": "y",
        "\xC6": "Ae",
        "\xE6": "ae",
        "\xDE": "Th",
        "\xFE": "th",
        "\xDF": "ss",
        // Latin Extended-A block.
        "\u0100": "A",
        "\u0102": "A",
        "\u0104": "A",
        "\u0101": "a",
        "\u0103": "a",
        "\u0105": "a",
        "\u0106": "C",
        "\u0108": "C",
        "\u010A": "C",
        "\u010C": "C",
        "\u0107": "c",
        "\u0109": "c",
        "\u010B": "c",
        "\u010D": "c",
        "\u010E": "D",
        "\u0110": "D",
        "\u010F": "d",
        "\u0111": "d",
        "\u0112": "E",
        "\u0114": "E",
        "\u0116": "E",
        "\u0118": "E",
        "\u011A": "E",
        "\u0113": "e",
        "\u0115": "e",
        "\u0117": "e",
        "\u0119": "e",
        "\u011B": "e",
        "\u011C": "G",
        "\u011E": "G",
        "\u0120": "G",
        "\u0122": "G",
        "\u011D": "g",
        "\u011F": "g",
        "\u0121": "g",
        "\u0123": "g",
        "\u0124": "H",
        "\u0126": "H",
        "\u0125": "h",
        "\u0127": "h",
        "\u0128": "I",
        "\u012A": "I",
        "\u012C": "I",
        "\u012E": "I",
        "\u0130": "I",
        "\u0129": "i",
        "\u012B": "i",
        "\u012D": "i",
        "\u012F": "i",
        "\u0131": "i",
        "\u0134": "J",
        "\u0135": "j",
        "\u0136": "K",
        "\u0137": "k",
        "\u0138": "k",
        "\u0139": "L",
        "\u013B": "L",
        "\u013D": "L",
        "\u013F": "L",
        "\u0141": "L",
        "\u013A": "l",
        "\u013C": "l",
        "\u013E": "l",
        "\u0140": "l",
        "\u0142": "l",
        "\u0143": "N",
        "\u0145": "N",
        "\u0147": "N",
        "\u014A": "N",
        "\u0144": "n",
        "\u0146": "n",
        "\u0148": "n",
        "\u014B": "n",
        "\u014C": "O",
        "\u014E": "O",
        "\u0150": "O",
        "\u014D": "o",
        "\u014F": "o",
        "\u0151": "o",
        "\u0154": "R",
        "\u0156": "R",
        "\u0158": "R",
        "\u0155": "r",
        "\u0157": "r",
        "\u0159": "r",
        "\u015A": "S",
        "\u015C": "S",
        "\u015E": "S",
        "\u0160": "S",
        "\u015B": "s",
        "\u015D": "s",
        "\u015F": "s",
        "\u0161": "s",
        "\u0162": "T",
        "\u0164": "T",
        "\u0166": "T",
        "\u0163": "t",
        "\u0165": "t",
        "\u0167": "t",
        "\u0168": "U",
        "\u016A": "U",
        "\u016C": "U",
        "\u016E": "U",
        "\u0170": "U",
        "\u0172": "U",
        "\u0169": "u",
        "\u016B": "u",
        "\u016D": "u",
        "\u016F": "u",
        "\u0171": "u",
        "\u0173": "u",
        "\u0174": "W",
        "\u0175": "w",
        "\u0176": "Y",
        "\u0177": "y",
        "\u0178": "Y",
        "\u0179": "Z",
        "\u017B": "Z",
        "\u017D": "Z",
        "\u017A": "z",
        "\u017C": "z",
        "\u017E": "z",
        "\u0132": "IJ",
        "\u0133": "ij",
        "\u0152": "Oe",
        "\u0153": "oe",
        "\u0149": "'n",
        "\u017F": "s"
      };
      var htmlEscapes = {
        "&": "&amp;",
        "<": "&lt;",
        ">": "&gt;",
        '"': "&quot;",
        "'": "&#39;"
      };
      var htmlUnescapes = {
        "&amp;": "&",
        "&lt;": "<",
        "&gt;": ">",
        "&quot;": '"',
        "&#39;": "'"
      };
      var stringEscapes = {
        "\\": "\\",
        "'": "'",
        "\n": "n",
        "\r": "r",
        "\u2028": "u2028",
        "\u2029": "u2029"
      };
      var freeParseFloat = parseFloat, freeParseInt = parseInt;
      var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
      var freeSelf = typeof self == "object" && self && self.Object === Object && self;
      var root = freeGlobal || freeSelf || Function("return this")();
      var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
      var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
      var moduleExports = freeModule && freeModule.exports === freeExports;
      var freeProcess = moduleExports && freeGlobal.process;
      var nodeUtil = function() {
        try {
          var types = freeModule && freeModule.require && freeModule.require("util").types;
          if (types) {
            return types;
          }
          return freeProcess && freeProcess.binding && freeProcess.binding("util");
        } catch (e) {
        }
      }();
      var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer, nodeIsDate = nodeUtil && nodeUtil.isDate, nodeIsMap = nodeUtil && nodeUtil.isMap, nodeIsRegExp = nodeUtil && nodeUtil.isRegExp, nodeIsSet = nodeUtil && nodeUtil.isSet, nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
      function apply(func, thisArg, args) {
        switch (args.length) {
          case 0:
            return func.call(thisArg);
          case 1:
            return func.call(thisArg, args[0]);
          case 2:
            return func.call(thisArg, args[0], args[1]);
          case 3:
            return func.call(thisArg, args[0], args[1], args[2]);
        }
        return func.apply(thisArg, args);
      }
      function arrayAggregator(array, setter, iteratee, accumulator) {
        var index = -1, length = array == null ? 0 : array.length;
        while (++index < length) {
          var value = array[index];
          setter(accumulator, value, iteratee(value), array);
        }
        return accumulator;
      }
      function arrayEach(array, iteratee) {
        var index = -1, length = array == null ? 0 : array.length;
        while (++index < length) {
          if (iteratee(array[index], index, array) === false) {
            break;
          }
        }
        return array;
      }
      function arrayEachRight(array, iteratee) {
        var length = array == null ? 0 : array.length;
        while (length--) {
          if (iteratee(array[length], length, array) === false) {
            break;
          }
        }
        return array;
      }
      function arrayEvery(array, predicate) {
        var index = -1, length = array == null ? 0 : array.length;
        while (++index < length) {
          if (!predicate(array[index], index, array)) {
            return false;
          }
        }
        return true;
      }
      function arrayFilter(array, predicate) {
        var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
        while (++index < length) {
          var value = array[index];
          if (predicate(value, index, array)) {
            result[resIndex++] = value;
          }
        }
        return result;
      }
      function arrayIncludes(array, value) {
        var length = array == null ? 0 : array.length;
        return !!length && baseIndexOf(array, value, 0) > -1;
      }
      function arrayIncludesWith(array, value, comparator) {
        var index = -1, length = array == null ? 0 : array.length;
        while (++index < length) {
          if (comparator(value, array[index])) {
            return true;
          }
        }
        return false;
      }
      function arrayMap(array, iteratee) {
        var index = -1, length = array == null ? 0 : array.length, result = Array(length);
        while (++index < length) {
          result[index] = iteratee(array[index], index, array);
        }
        return result;
      }
      function arrayPush(array, values) {
        var index = -1, length = values.length, offset = array.length;
        while (++index < length) {
          array[offset + index] = values[index];
        }
        return array;
      }
      function arrayReduce(array, iteratee, accumulator, initAccum) {
        var index = -1, length = array == null ? 0 : array.length;
        if (initAccum && length) {
          accumulator = array[++index];
        }
        while (++index < length) {
          accumulator = iteratee(accumulator, array[index], index, array);
        }
        return accumulator;
      }
      function arrayReduceRight(array, iteratee, accumulator, initAccum) {
        var length = array == null ? 0 : array.length;
        if (initAccum && length) {
          accumulator = array[--length];
        }
        while (length--) {
          accumulator = iteratee(accumulator, array[length], length, array);
        }
        return accumulator;
      }
      function arraySome(array, predicate) {
        var index = -1, length = array == null ? 0 : array.length;
        while (++index < length) {
          if (predicate(array[index], index, array)) {
            return true;
          }
        }
        return false;
      }
      var asciiSize = baseProperty("length");
      function asciiToArray(string2) {
        return string2.split("");
      }
      function asciiWords(string2) {
        return string2.match(reAsciiWord) || [];
      }
      function baseFindKey(collection, predicate, eachFunc) {
        var result;
        eachFunc(collection, function(value, key, collection2) {
          if (predicate(value, key, collection2)) {
            result = key;
            return false;
          }
        });
        return result;
      }
      function baseFindIndex(array, predicate, fromIndex, fromRight) {
        var length = array.length, index = fromIndex + (fromRight ? 1 : -1);
        while (fromRight ? index-- : ++index < length) {
          if (predicate(array[index], index, array)) {
            return index;
          }
        }
        return -1;
      }
      function baseIndexOf(array, value, fromIndex) {
        return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex);
      }
      function baseIndexOfWith(array, value, fromIndex, comparator) {
        var index = fromIndex - 1, length = array.length;
        while (++index < length) {
          if (comparator(array[index], value)) {
            return index;
          }
        }
        return -1;
      }
      function baseIsNaN(value) {
        return value !== value;
      }
      function baseMean(array, iteratee) {
        var length = array == null ? 0 : array.length;
        return length ? baseSum(array, iteratee) / length : NAN;
      }
      function baseProperty(key) {
        return function(object) {
          return object == null ? undefined2 : object[key];
        };
      }
      function basePropertyOf(object) {
        return function(key) {
          return object == null ? undefined2 : object[key];
        };
      }
      function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
        eachFunc(collection, function(value, index, collection2) {
          accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection2);
        });
        return accumulator;
      }
      function baseSortBy(array, comparer) {
        var length = array.length;
        array.sort(comparer);
        while (length--) {
          array[length] = array[length].value;
        }
        return array;
      }
      function baseSum(array, iteratee) {
        var result, index = -1, length = array.length;
        while (++index < length) {
          var current = iteratee(array[index]);
          if (current !== undefined2) {
            result = result === undefined2 ? current : result + current;
          }
        }
        return result;
      }
      function baseTimes(n, iteratee) {
        var index = -1, result = Array(n);
        while (++index < n) {
          result[index] = iteratee(index);
        }
        return result;
      }
      function baseToPairs(object, props) {
        return arrayMap(props, function(key) {
          return [key, object[key]];
        });
      }
      function baseTrim(string2) {
        return string2 ? string2.slice(0, trimmedEndIndex(string2) + 1).replace(reTrimStart, "") : string2;
      }
      function baseUnary(func) {
        return function(value) {
          return func(value);
        };
      }
      function baseValues(object, props) {
        return arrayMap(props, function(key) {
          return object[key];
        });
      }
      function cacheHas(cache, key) {
        return cache.has(key);
      }
      function charsStartIndex(strSymbols, chrSymbols) {
        var index = -1, length = strSymbols.length;
        while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
        }
        return index;
      }
      function charsEndIndex(strSymbols, chrSymbols) {
        var index = strSymbols.length;
        while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
        }
        return index;
      }
      function countHolders(array, placeholder) {
        var length = array.length, result = 0;
        while (length--) {
          if (array[length] === placeholder) {
            ++result;
          }
        }
        return result;
      }
      var deburrLetter = basePropertyOf(deburredLetters);
      var escapeHtmlChar = basePropertyOf(htmlEscapes);
      function escapeStringChar(chr) {
        return "\\" + stringEscapes[chr];
      }
      function getValue(object, key) {
        return object == null ? undefined2 : object[key];
      }
      function hasUnicode(string2) {
        return reHasUnicode.test(string2);
      }
      function hasUnicodeWord(string2) {
        return reHasUnicodeWord.test(string2);
      }
      function iteratorToArray(iterator2) {
        var data, result = [];
        while (!(data = iterator2.next()).done) {
          result.push(data.value);
        }
        return result;
      }
      function mapToArray(map3) {
        var index = -1, result = Array(map3.size);
        map3.forEach(function(value, key) {
          result[++index] = [key, value];
        });
        return result;
      }
      function overArg(func, transform) {
        return function(arg) {
          return func(transform(arg));
        };
      }
      function replaceHolders(array, placeholder) {
        var index = -1, length = array.length, resIndex = 0, result = [];
        while (++index < length) {
          var value = array[index];
          if (value === placeholder || value === PLACEHOLDER) {
            array[index] = PLACEHOLDER;
            result[resIndex++] = index;
          }
        }
        return result;
      }
      function setToArray(set2) {
        var index = -1, result = Array(set2.size);
        set2.forEach(function(value) {
          result[++index] = value;
        });
        return result;
      }
      function setToPairs(set2) {
        var index = -1, result = Array(set2.size);
        set2.forEach(function(value) {
          result[++index] = [value, value];
        });
        return result;
      }
      function strictIndexOf(array, value, fromIndex) {
        var index = fromIndex - 1, length = array.length;
        while (++index < length) {
          if (array[index] === value) {
            return index;
          }
        }
        return -1;
      }
      function strictLastIndexOf(array, value, fromIndex) {
        var index = fromIndex + 1;
        while (index--) {
          if (array[index] === value) {
            return index;
          }
        }
        return index;
      }
      function stringSize(string2) {
        return hasUnicode(string2) ? unicodeSize(string2) : asciiSize(string2);
      }
      function stringToArray(string2) {
        return hasUnicode(string2) ? unicodeToArray(string2) : asciiToArray(string2);
      }
      function trimmedEndIndex(string2) {
        var index = string2.length;
        while (index-- && reWhitespace.test(string2.charAt(index))) {
        }
        return index;
      }
      var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
      function unicodeSize(string2) {
        var result = reUnicode.lastIndex = 0;
        while (reUnicode.test(string2)) {
          ++result;
        }
        return result;
      }
      function unicodeToArray(string2) {
        return string2.match(reUnicode) || [];
      }
      function unicodeWords(string2) {
        return string2.match(reUnicodeWord) || [];
      }
      var runInContext = function runInContext2(context2) {
        context2 = context2 == null ? root : _4.defaults(root.Object(), context2, _4.pick(root, contextProps));
        var Array2 = context2.Array, Date2 = context2.Date, Error2 = context2.Error, Function2 = context2.Function, Math2 = context2.Math, Object2 = context2.Object, RegExp2 = context2.RegExp, String2 = context2.String, TypeError2 = context2.TypeError;
        var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto2 = Object2.prototype;
        var coreJsData = context2["__core-js_shared__"];
        var funcToString = funcProto.toString;
        var hasOwnProperty2 = objectProto2.hasOwnProperty;
        var idCounter = 0;
        var maskSrcKey = function() {
          var uid2 = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
          return uid2 ? "Symbol(src)_1." + uid2 : "";
        }();
        var nativeObjectToString = objectProto2.toString;
        var objectCtorString = funcToString.call(Object2);
        var oldDash = root._;
        var reIsNative = RegExp2(
          "^" + funcToString.call(hasOwnProperty2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
        );
        var Buffer2 = moduleExports ? context2.Buffer : undefined2, Symbol2 = context2.Symbol, Uint8Array2 = context2.Uint8Array, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : undefined2, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto2.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : undefined2, symIterator = Symbol2 ? Symbol2.iterator : undefined2, symToStringTag = Symbol2 ? Symbol2.toStringTag : undefined2;
        var defineProperty = function() {
          try {
            var func = getNative(Object2, "defineProperty");
            func({}, "", {});
            return func;
          } catch (e) {
          }
        }();
        var ctxClearTimeout = context2.clearTimeout !== root.clearTimeout && context2.clearTimeout, ctxNow = Date2 && Date2.now !== root.Date.now && Date2.now, ctxSetTimeout = context2.setTimeout !== root.setTimeout && context2.setTimeout;
        var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : undefined2, nativeIsFinite = context2.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax = Math2.max, nativeMin = Math2.min, nativeNow = Date2.now, nativeParseInt = context2.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse;
        var DataView2 = getNative(context2, "DataView"), Map2 = getNative(context2, "Map"), Promise2 = getNative(context2, "Promise"), Set2 = getNative(context2, "Set"), WeakMap2 = getNative(context2, "WeakMap"), nativeCreate = getNative(Object2, "create");
        var metaMap = WeakMap2 && new WeakMap2();
        var realNames = {};
        var dataViewCtorString = toSource(DataView2), mapCtorString = toSource(Map2), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set2), weakMapCtorString = toSource(WeakMap2);
        var symbolProto = Symbol2 ? Symbol2.prototype : undefined2, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined2, symbolToString = symbolProto ? symbolProto.toString : undefined2;
        function lodash(value) {
          if (isObjectLike(value) && !isArray3(value) && !(value instanceof LazyWrapper)) {
            if (value instanceof LodashWrapper) {
              return value;
            }
            if (hasOwnProperty2.call(value, "__wrapped__")) {
              return wrapperClone(value);
            }
          }
          return new LodashWrapper(value);
        }
        var baseCreate = /* @__PURE__ */ function() {
          function object() {
          }
          return function(proto) {
            if (!isObject(proto)) {
              return {};
            }
            if (objectCreate) {
              return objectCreate(proto);
            }
            object.prototype = proto;
            var result2 = new object();
            object.prototype = undefined2;
            return result2;
          };
        }();
        function baseLodash() {
        }
        function LodashWrapper(value, chainAll) {
          this.__wrapped__ = value;
          this.__actions__ = [];
          this.__chain__ = !!chainAll;
          this.__index__ = 0;
          this.__values__ = undefined2;
        }
        lodash.templateSettings = {
          /**
           * Used to detect `data` property values to be HTML-escaped.
           *
           * @memberOf _.templateSettings
           * @type {RegExp}
           */
          "escape": reEscape,
          /**
           * Used to detect code to be evaluated.
           *
           * @memberOf _.templateSettings
           * @type {RegExp}
           */
          "evaluate": reEvaluate,
          /**
           * Used to detect `data` property values to inject.
           *
           * @memberOf _.templateSettings
           * @type {RegExp}
           */
          "interpolate": reInterpolate,
          /**
           * Used to reference the data object in the template text.
           *
           * @memberOf _.templateSettings
           * @type {string}
           */
          "variable": "",
          /**
           * Used to import variables into the compiled template.
           *
           * @memberOf _.templateSettings
           * @type {Object}
           */
          "imports": {
            /**
             * A reference to the `lodash` function.
             *
             * @memberOf _.templateSettings.imports
             * @type {Function}
             */
            "_": lodash
          }
        };
        lodash.prototype = baseLodash.prototype;
        lodash.prototype.constructor = lodash;
        LodashWrapper.prototype = baseCreate(baseLodash.prototype);
        LodashWrapper.prototype.constructor = LodashWrapper;
        function LazyWrapper(value) {
          this.__wrapped__ = value;
          this.__actions__ = [];
          this.__dir__ = 1;
          this.__filtered__ = false;
          this.__iteratees__ = [];
          this.__takeCount__ = MAX_ARRAY_LENGTH;
          this.__views__ = [];
        }
        function lazyClone() {
          var result2 = new LazyWrapper(this.__wrapped__);
          result2.__actions__ = copyArray(this.__actions__);
          result2.__dir__ = this.__dir__;
          result2.__filtered__ = this.__filtered__;
          result2.__iteratees__ = copyArray(this.__iteratees__);
          result2.__takeCount__ = this.__takeCount__;
          result2.__views__ = copyArray(this.__views__);
          return result2;
        }
        function lazyReverse() {
          if (this.__filtered__) {
            var result2 = new LazyWrapper(this);
            result2.__dir__ = -1;
            result2.__filtered__ = true;
          } else {
            result2 = this.clone();
            result2.__dir__ *= -1;
          }
          return result2;
        }
        function lazyValue() {
          var array = this.__wrapped__.value(), dir = this.__dir__, isArr = isArray3(array), isRight = dir < 0, arrLength = isArr ? array.length : 0, view = getView(0, arrLength, this.__views__), start = view.start, end = view.end, length = end - start, index = isRight ? end : start - 1, iteratees = this.__iteratees__, iterLength = iteratees.length, resIndex = 0, takeCount = nativeMin(length, this.__takeCount__);
          if (!isArr || !isRight && arrLength == length && takeCount == length) {
            return baseWrapperValue(array, this.__actions__);
          }
          var result2 = [];
          outer:
            while (length-- && resIndex < takeCount) {
              index += dir;
              var iterIndex = -1, value = array[index];
              while (++iterIndex < iterLength) {
                var data = iteratees[iterIndex], iteratee2 = data.iteratee, type = data.type, computed2 = iteratee2(value);
                if (type == LAZY_MAP_FLAG) {
                  value = computed2;
                } else if (!computed2) {
                  if (type == LAZY_FILTER_FLAG) {
                    continue outer;
                  } else {
                    break outer;
                  }
                }
              }
              result2[resIndex++] = value;
            }
          return result2;
        }
        LazyWrapper.prototype = baseCreate(baseLodash.prototype);
        LazyWrapper.prototype.constructor = LazyWrapper;
        function Hash(entries) {
          var index = -1, length = entries == null ? 0 : entries.length;
          this.clear();
          while (++index < length) {
            var entry = entries[index];
            this.set(entry[0], entry[1]);
          }
        }
        function hashClear() {
          this.__data__ = nativeCreate ? nativeCreate(null) : {};
          this.size = 0;
        }
        function hashDelete(key) {
          var result2 = this.has(key) && delete this.__data__[key];
          this.size -= result2 ? 1 : 0;
          return result2;
        }
        function hashGet(key) {
          var data = this.__data__;
          if (nativeCreate) {
            var result2 = data[key];
            return result2 === HASH_UNDEFINED ? undefined2 : result2;
          }
          return hasOwnProperty2.call(data, key) ? data[key] : undefined2;
        }
        function hashHas(key) {
          var data = this.__data__;
          return nativeCreate ? data[key] !== undefined2 : hasOwnProperty2.call(data, key);
        }
        function hashSet(key, value) {
          var data = this.__data__;
          this.size += this.has(key) ? 0 : 1;
          data[key] = nativeCreate && value === undefined2 ? HASH_UNDEFINED : value;
          return this;
        }
        Hash.prototype.clear = hashClear;
        Hash.prototype["delete"] = hashDelete;
        Hash.prototype.get = hashGet;
        Hash.prototype.has = hashHas;
        Hash.prototype.set = hashSet;
        function ListCache(entries) {
          var index = -1, length = entries == null ? 0 : entries.length;
          this.clear();
          while (++index < length) {
            var entry = entries[index];
            this.set(entry[0], entry[1]);
          }
        }
        function listCacheClear() {
          this.__data__ = [];
          this.size = 0;
        }
        function listCacheDelete(key) {
          var data = this.__data__, index = assocIndexOf(data, key);
          if (index < 0) {
            return false;
          }
          var lastIndex = data.length - 1;
          if (index == lastIndex) {
            data.pop();
          } else {
            splice.call(data, index, 1);
          }
          --this.size;
          return true;
        }
        function listCacheGet(key) {
          var data = this.__data__, index = assocIndexOf(data, key);
          return index < 0 ? undefined2 : data[index][1];
        }
        function listCacheHas(key) {
          return assocIndexOf(this.__data__, key) > -1;
        }
        function listCacheSet(key, value) {
          var data = this.__data__, index = assocIndexOf(data, key);
          if (index < 0) {
            ++this.size;
            data.push([key, value]);
          } else {
            data[index][1] = value;
          }
          return this;
        }
        ListCache.prototype.clear = listCacheClear;
        ListCache.prototype["delete"] = listCacheDelete;
        ListCache.prototype.get = listCacheGet;
        ListCache.prototype.has = listCacheHas;
        ListCache.prototype.set = listCacheSet;
        function MapCache(entries) {
          var index = -1, length = entries == null ? 0 : entries.length;
          this.clear();
          while (++index < length) {
            var entry = entries[index];
            this.set(entry[0], entry[1]);
          }
        }
        function mapCacheClear() {
          this.size = 0;
          this.__data__ = {
            "hash": new Hash(),
            "map": new (Map2 || ListCache)(),
            "string": new Hash()
          };
        }
        function mapCacheDelete(key) {
          var result2 = getMapData(this, key)["delete"](key);
          this.size -= result2 ? 1 : 0;
          return result2;
        }
        function mapCacheGet(key) {
          return getMapData(this, key).get(key);
        }
        function mapCacheHas(key) {
          return getMapData(this, key).has(key);
        }
        function mapCacheSet(key, value) {
          var data = getMapData(this, key), size2 = data.size;
          data.set(key, value);
          this.size += data.size == size2 ? 0 : 1;
          return this;
        }
        MapCache.prototype.clear = mapCacheClear;
        MapCache.prototype["delete"] = mapCacheDelete;
        MapCache.prototype.get = mapCacheGet;
        MapCache.prototype.has = mapCacheHas;
        MapCache.prototype.set = mapCacheSet;
        function SetCache(values2) {
          var index = -1, length = values2 == null ? 0 : values2.length;
          this.__data__ = new MapCache();
          while (++index < length) {
            this.add(values2[index]);
          }
        }
        function setCacheAdd(value) {
          this.__data__.set(value, HASH_UNDEFINED);
          return this;
        }
        function setCacheHas(value) {
          return this.__data__.has(value);
        }
        SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
        SetCache.prototype.has = setCacheHas;
        function Stack(entries) {
          var data = this.__data__ = new ListCache(entries);
          this.size = data.size;
        }
        function stackClear() {
          this.__data__ = new ListCache();
          this.size = 0;
        }
        function stackDelete(key) {
          var data = this.__data__, result2 = data["delete"](key);
          this.size = data.size;
          return result2;
        }
        function stackGet(key) {
          return this.__data__.get(key);
        }
        function stackHas(key) {
          return this.__data__.has(key);
        }
        function stackSet(key, value) {
          var data = this.__data__;
          if (data instanceof ListCache) {
            var pairs2 = data.__data__;
            if (!Map2 || pairs2.length < LARGE_ARRAY_SIZE - 1) {
              pairs2.push([key, value]);
              this.size = ++data.size;
              return this;
            }
            data = this.__data__ = new MapCache(pairs2);
          }
          data.set(key, value);
          this.size = data.size;
          return this;
        }
        Stack.prototype.clear = stackClear;
        Stack.prototype["delete"] = stackDelete;
        Stack.prototype.get = stackGet;
        Stack.prototype.has = stackHas;
        Stack.prototype.set = stackSet;
        function arrayLikeKeys(value, inherited) {
          var isArr = isArray3(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType2 = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType2, result2 = skipIndexes ? baseTimes(value.length, String2) : [], length = result2.length;
          for (var key in value) {
            if ((inherited || hasOwnProperty2.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
            (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
            isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
            isType2 && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
            isIndex(key, length)))) {
              result2.push(key);
            }
          }
          return result2;
        }
        function arraySample(array) {
          var length = array.length;
          return length ? array[baseRandom(0, length - 1)] : undefined2;
        }
        function arraySampleSize(array, n) {
          return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
        }
        function arrayShuffle(array) {
          return shuffleSelf(copyArray(array));
        }
        function assignMergeValue(object, key, value) {
          if (value !== undefined2 && !eq(object[key], value) || value === undefined2 && !(key in object)) {
            baseAssignValue(object, key, value);
          }
        }
        function assignValue(object, key, value) {
          var objValue = object[key];
          if (!(hasOwnProperty2.call(object, key) && eq(objValue, value)) || value === undefined2 && !(key in object)) {
            baseAssignValue(object, key, value);
          }
        }
        function assocIndexOf(array, key) {
          var length = array.length;
          while (length--) {
            if (eq(array[length][0], key)) {
              return length;
            }
          }
          return -1;
        }
        function baseAggregator(collection, setter, iteratee2, accumulator) {
          baseEach(collection, function(value, key, collection2) {
            setter(accumulator, value, iteratee2(value), collection2);
          });
          return accumulator;
        }
        function baseAssign(object, source) {
          return object && copyObject(source, keys(source), object);
        }
        function baseAssignIn(object, source) {
          return object && copyObject(source, keysIn(source), object);
        }
        function baseAssignValue(object, key, value) {
          if (key == "__proto__" && defineProperty) {
            defineProperty(object, key, {
              "configurable": true,
              "enumerable": true,
              "value": value,
              "writable": true
            });
          } else {
            object[key] = value;
          }
        }
        function baseAt(object, paths) {
          var index = -1, length = paths.length, result2 = Array2(length), skip2 = object == null;
          while (++index < length) {
            result2[index] = skip2 ? undefined2 : get(object, paths[index]);
          }
          return result2;
        }
        function baseClamp(number, lower, upper) {
          if (number === number) {
            if (upper !== undefined2) {
              number = number <= upper ? number : upper;
            }
            if (lower !== undefined2) {
              number = number >= lower ? number : lower;
            }
          }
          return number;
        }
        function baseClone(value, bitmask, customizer, key, object, stack) {
          var result2, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG;
          if (customizer) {
            result2 = object ? customizer(value, key, object, stack) : customizer(value);
          }
          if (result2 !== undefined2) {
            return result2;
          }
          if (!isObject(value)) {
            return value;
          }
          var isArr = isArray3(value);
          if (isArr) {
            result2 = initCloneArray(value);
            if (!isDeep) {
              return copyArray(value, result2);
            }
          } else {
            var tag = getTag(value), isFunc = tag == funcTag || tag == genTag;
            if (isBuffer(value)) {
              return cloneBuffer(value, isDeep);
            }
            if (tag == objectTag || tag == argsTag || isFunc && !object) {
              result2 = isFlat || isFunc ? {} : initCloneObject(value);
              if (!isDeep) {
                return isFlat ? copySymbolsIn(value, baseAssignIn(result2, value)) : copySymbols(value, baseAssign(result2, value));
              }
            } else {
              if (!cloneableTags[tag]) {
                return object ? value : {};
              }
              result2 = initCloneByTag(value, tag, isDeep);
            }
          }
          stack || (stack = new Stack());
          var stacked = stack.get(value);
          if (stacked) {
            return stacked;
          }
          stack.set(value, result2);
          if (isSet(value)) {
            value.forEach(function(subValue) {
              result2.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
            });
          } else if (isMap2(value)) {
            value.forEach(function(subValue, key2) {
              result2.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
            });
          }
          var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
          var props = isArr ? undefined2 : keysFunc(value);
          arrayEach(props || value, function(subValue, key2) {
            if (props) {
              key2 = subValue;
              subValue = value[key2];
            }
            assignValue(result2, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
          });
          return result2;
        }
        function baseConforms(source) {
          var props = keys(source);
          return function(object) {
            return baseConformsTo(object, source, props);
          };
        }
        function baseConformsTo(object, source, props) {
          var length = props.length;
          if (object == null) {
            return !length;
          }
          object = Object2(object);
          while (length--) {
            var key = props[length], predicate = source[key], value = object[key];
            if (value === undefined2 && !(key in object) || !predicate(value)) {
              return false;
            }
          }
          return true;
        }
        function baseDelay(func, wait, args) {
          if (typeof func != "function") {
            throw new TypeError2(FUNC_ERROR_TEXT);
          }
          return setTimeout2(function() {
            func.apply(undefined2, args);
          }, wait);
        }
        function baseDifference(array, values2, iteratee2, comparator) {
          var index = -1, includes2 = arrayIncludes, isCommon = true, length = array.length, result2 = [], valuesLength = values2.length;
          if (!length) {
            return result2;
          }
          if (iteratee2) {
            values2 = arrayMap(values2, baseUnary(iteratee2));
          }
          if (comparator) {
            includes2 = arrayIncludesWith;
            isCommon = false;
          } else if (values2.length >= LARGE_ARRAY_SIZE) {
            includes2 = cacheHas;
            isCommon = false;
            values2 = new SetCache(values2);
          }
          outer:
            while (++index < length) {
              var value = array[index], computed2 = iteratee2 == null ? value : iteratee2(value);
              value = comparator || value !== 0 ? value : 0;
              if (isCommon && computed2 === computed2) {
                var valuesIndex = valuesLength;
                while (valuesIndex--) {
                  if (values2[valuesIndex] === computed2) {
                    continue outer;
                  }
                }
                result2.push(value);
              } else if (!includes2(values2, computed2, comparator)) {
                result2.push(value);
              }
            }
          return result2;
        }
        var baseEach = createBaseEach(baseForOwn);
        var baseEachRight = createBaseEach(baseForOwnRight, true);
        function baseEvery(collection, predicate) {
          var result2 = true;
          baseEach(collection, function(value, index, collection2) {
            result2 = !!predicate(value, index, collection2);
            return result2;
          });
          return result2;
        }
        function baseExtremum(array, iteratee2, comparator) {
          var index = -1, length = array.length;
          while (++index < length) {
            var value = array[index], current = iteratee2(value);
            if (current != null && (computed2 === undefined2 ? current === current && !isSymbol(current) : comparator(current, computed2))) {
              var computed2 = current, result2 = value;
            }
          }
          return result2;
        }
        function baseFill(array, value, start, end) {
          var length = array.length;
          start = toInteger2(start);
          if (start < 0) {
            start = -start > length ? 0 : length + start;
          }
          end = end === undefined2 || end > length ? length : toInteger2(end);
          if (end < 0) {
            end += length;
          }
          end = start > end ? 0 : toLength(end);
          while (start < end) {
            array[start++] = value;
          }
          return array;
        }
        function baseFilter(collection, predicate) {
          var result2 = [];
          baseEach(collection, function(value, index, collection2) {
            if (predicate(value, index, collection2)) {
              result2.push(value);
            }
          });
          return result2;
        }
        function baseFlatten(array, depth, predicate, isStrict, result2) {
          var index = -1, length = array.length;
          predicate || (predicate = isFlattenable);
          result2 || (result2 = []);
          while (++index < length) {
            var value = array[index];
            if (depth > 0 && predicate(value)) {
              if (depth > 1) {
                baseFlatten(value, depth - 1, predicate, isStrict, result2);
              } else {
                arrayPush(result2, value);
              }
            } else if (!isStrict) {
              result2[result2.length] = value;
            }
          }
          return result2;
        }
        var baseFor = createBaseFor();
        var baseForRight = createBaseFor(true);
        function baseForOwn(object, iteratee2) {
          return object && baseFor(object, iteratee2, keys);
        }
        function baseForOwnRight(object, iteratee2) {
          return object && baseForRight(object, iteratee2, keys);
        }
        function baseFunctions(object, props) {
          return arrayFilter(props, function(key) {
            return isFunction3(object[key]);
          });
        }
        function baseGet(object, path) {
          path = castPath(path, object);
          var index = 0, length = path.length;
          while (object != null && index < length) {
            object = object[toKey(path[index++])];
          }
          return index && index == length ? object : undefined2;
        }
        function baseGetAllKeys(object, keysFunc, symbolsFunc) {
          var result2 = keysFunc(object);
          return isArray3(object) ? result2 : arrayPush(result2, symbolsFunc(object));
        }
        function baseGetTag(value) {
          if (value == null) {
            return value === undefined2 ? undefinedTag : nullTag2;
          }
          return symToStringTag && symToStringTag in Object2(value) ? getRawTag(value) : objectToString(value);
        }
        function baseGt(value, other) {
          return value > other;
        }
        function baseHas(object, key) {
          return object != null && hasOwnProperty2.call(object, key);
        }
        function baseHasIn(object, key) {
          return object != null && key in Object2(object);
        }
        function baseInRange(number, start, end) {
          return number >= nativeMin(start, end) && number < nativeMax(start, end);
        }
        function baseIntersection(arrays, iteratee2, comparator) {
          var includes2 = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array2(othLength), maxLength = Infinity, result2 = [];
          while (othIndex--) {
            var array = arrays[othIndex];
            if (othIndex && iteratee2) {
              array = arrayMap(array, baseUnary(iteratee2));
            }
            maxLength = nativeMin(array.length, maxLength);
            caches[othIndex] = !comparator && (iteratee2 || length >= 120 && array.length >= 120) ? new SetCache(othIndex && array) : undefined2;
          }
          array = arrays[0];
          var index = -1, seen = caches[0];
          outer:
            while (++index < length && result2.length < maxLength) {
              var value = array[index], computed2 = iteratee2 ? iteratee2(value) : value;
              value = comparator || value !== 0 ? value : 0;
              if (!(seen ? cacheHas(seen, computed2) : includes2(result2, computed2, comparator))) {
                othIndex = othLength;
                while (--othIndex) {
                  var cache = caches[othIndex];
                  if (!(cache ? cacheHas(cache, computed2) : includes2(arrays[othIndex], computed2, comparator))) {
                    continue outer;
                  }
                }
                if (seen) {
                  seen.push(computed2);
                }
                result2.push(value);
              }
            }
          return result2;
        }
        function baseInverter(object, setter, iteratee2, accumulator) {
          baseForOwn(object, function(value, key, object2) {
            setter(accumulator, iteratee2(value), key, object2);
          });
          return accumulator;
        }
        function baseInvoke(object, path, args) {
          path = castPath(path, object);
          object = parent(object, path);
          var func = object == null ? object : object[toKey(last4(path))];
          return func == null ? undefined2 : apply(func, object, args);
        }
        function baseIsArguments(value) {
          return isObjectLike(value) && baseGetTag(value) == argsTag;
        }
        function baseIsArrayBuffer(value) {
          return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
        }
        function baseIsDate(value) {
          return isObjectLike(value) && baseGetTag(value) == dateTag;
        }
        function baseIsEqual(value, other, bitmask, customizer, stack) {
          if (value === other) {
            return true;
          }
          if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
            return value !== value && other !== other;
          }
          return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
        }
        function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
          var objIsArr = isArray3(object), othIsArr = isArray3(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other);
          objTag = objTag == argsTag ? objectTag : objTag;
          othTag = othTag == argsTag ? objectTag : othTag;
          var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
          if (isSameTag && isBuffer(object)) {
            if (!isBuffer(other)) {
              return false;
            }
            objIsArr = true;
            objIsObj = false;
          }
          if (isSameTag && !objIsObj) {
            stack || (stack = new Stack());
            return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
          }
          if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
            var objIsWrapped = objIsObj && hasOwnProperty2.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty2.call(other, "__wrapped__");
            if (objIsWrapped || othIsWrapped) {
              var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
              stack || (stack = new Stack());
              return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
            }
          }
          if (!isSameTag) {
            return false;
          }
          stack || (stack = new Stack());
          return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
        }
        function baseIsMap(value) {
          return isObjectLike(value) && getTag(value) == mapTag;
        }
        function baseIsMatch(object, source, matchData, customizer) {
          var index = matchData.length, length = index, noCustomizer = !customizer;
          if (object == null) {
            return !length;
          }
          object = Object2(object);
          while (index--) {
            var data = matchData[index];
            if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
              return false;
            }
          }
          while (++index < length) {
            data = matchData[index];
            var key = data[0], objValue = object[key], srcValue = data[1];
            if (noCustomizer && data[2]) {
              if (objValue === undefined2 && !(key in object)) {
                return false;
              }
            } else {
              var stack = new Stack();
              if (customizer) {
                var result2 = customizer(objValue, srcValue, key, object, source, stack);
              }
              if (!(result2 === undefined2 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) : result2)) {
                return false;
              }
            }
          }
          return true;
        }
        function baseIsNative(value) {
          if (!isObject(value) || isMasked(value)) {
            return false;
          }
          var pattern = isFunction3(value) ? reIsNative : reIsHostCtor;
          return pattern.test(toSource(value));
        }
        function baseIsRegExp(value) {
          return isObjectLike(value) && baseGetTag(value) == regexpTag;
        }
        function baseIsSet(value) {
          return isObjectLike(value) && getTag(value) == setTag;
        }
        function baseIsTypedArray(value) {
          return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
        }
        function baseIteratee(value) {
          if (typeof value == "function") {
            return value;
          }
          if (value == null) {
            return identity2;
          }
          if (typeof value == "object") {
            return isArray3(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
          }
          return property(value);
        }
        function baseKeys(object) {
          if (!isPrototype(object)) {
            return nativeKeys(object);
          }
          var result2 = [];
          for (var key in Object2(object)) {
            if (hasOwnProperty2.call(object, key) && key != "constructor") {
              result2.push(key);
            }
          }
          return result2;
        }
        function baseKeysIn(object) {
          if (!isObject(object)) {
            return nativeKeysIn(object);
          }
          var isProto = isPrototype(object), result2 = [];
          for (var key in object) {
            if (!(key == "constructor" && (isProto || !hasOwnProperty2.call(object, key)))) {
              result2.push(key);
            }
          }
          return result2;
        }
        function baseLt(value, other) {
          return value < other;
        }
        function baseMap(collection, iteratee2) {
          var index = -1, result2 = isArrayLike2(collection) ? Array2(collection.length) : [];
          baseEach(collection, function(value, key, collection2) {
            result2[++index] = iteratee2(value, key, collection2);
          });
          return result2;
        }
        function baseMatches(source) {
          var matchData = getMatchData(source);
          if (matchData.length == 1 && matchData[0][2]) {
            return matchesStrictComparable(matchData[0][0], matchData[0][1]);
          }
          return function(object) {
            return object === source || baseIsMatch(object, source, matchData);
          };
        }
        function baseMatchesProperty(path, srcValue) {
          if (isKey(path) && isStrictComparable(srcValue)) {
            return matchesStrictComparable(toKey(path), srcValue);
          }
          return function(object) {
            var objValue = get(object, path);
            return objValue === undefined2 && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
          };
        }
        function baseMerge(object, source, srcIndex, customizer, stack) {
          if (object === source) {
            return;
          }
          baseFor(source, function(srcValue, key) {
            stack || (stack = new Stack());
            if (isObject(srcValue)) {
              baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
            } else {
              var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : undefined2;
              if (newValue === undefined2) {
                newValue = srcValue;
              }
              assignMergeValue(object, key, newValue);
            }
          }, keysIn);
        }
        function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
          var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
          if (stacked) {
            assignMergeValue(object, key, stacked);
            return;
          }
          var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : undefined2;
          var isCommon = newValue === undefined2;
          if (isCommon) {
            var isArr = isArray3(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue);
            newValue = srcValue;
            if (isArr || isBuff || isTyped) {
              if (isArray3(objValue)) {
                newValue = objValue;
              } else if (isArrayLikeObject(objValue)) {
                newValue = copyArray(objValue);
              } else if (isBuff) {
                isCommon = false;
                newValue = cloneBuffer(srcValue, true);
              } else if (isTyped) {
                isCommon = false;
                newValue = cloneTypedArray(srcValue, true);
              } else {
                newValue = [];
              }
            } else if (isPlainObject(srcValue) || isArguments(srcValue)) {
              newValue = objValue;
              if (isArguments(objValue)) {
                newValue = toPlainObject(objValue);
              } else if (!isObject(objValue) || isFunction3(objValue)) {
                newValue = initCloneObject(srcValue);
              }
            } else {
              isCommon = false;
            }
          }
          if (isCommon) {
            stack.set(srcValue, newValue);
            mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
            stack["delete"](srcValue);
          }
          assignMergeValue(object, key, newValue);
        }
        function baseNth(array, n) {
          var length = array.length;
          if (!length) {
            return;
          }
          n += n < 0 ? length : 0;
          return isIndex(n, length) ? array[n] : undefined2;
        }
        function baseOrderBy(collection, iteratees, orders) {
          if (iteratees.length) {
            iteratees = arrayMap(iteratees, function(iteratee2) {
              if (isArray3(iteratee2)) {
                return function(value) {
                  return baseGet(value, iteratee2.length === 1 ? iteratee2[0] : iteratee2);
                };
              }
              return iteratee2;
            });
          } else {
            iteratees = [identity2];
          }
          var index = -1;
          iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
          var result2 = baseMap(collection, function(value, key, collection2) {
            var criteria = arrayMap(iteratees, function(iteratee2) {
              return iteratee2(value);
            });
            return { "criteria": criteria, "index": ++index, "value": value };
          });
          return baseSortBy(result2, function(object, other) {
            return compareMultiple(object, other, orders);
          });
        }
        function basePick(object, paths) {
          return basePickBy(object, paths, function(value, path) {
            return hasIn(object, path);
          });
        }
        function basePickBy(object, paths, predicate) {
          var index = -1, length = paths.length, result2 = {};
          while (++index < length) {
            var path = paths[index], value = baseGet(object, path);
            if (predicate(value, path)) {
              baseSet(result2, castPath(path, object), value);
            }
          }
          return result2;
        }
        function basePropertyDeep(path) {
          return function(object) {
            return baseGet(object, path);
          };
        }
        function basePullAll(array, values2, iteratee2, comparator) {
          var indexOf3 = comparator ? baseIndexOfWith : baseIndexOf, index = -1, length = values2.length, seen = array;
          if (array === values2) {
            values2 = copyArray(values2);
          }
          if (iteratee2) {
            seen = arrayMap(array, baseUnary(iteratee2));
          }
          while (++index < length) {
            var fromIndex = 0, value = values2[index], computed2 = iteratee2 ? iteratee2(value) : value;
            while ((fromIndex = indexOf3(seen, computed2, fromIndex, comparator)) > -1) {
              if (seen !== array) {
                splice.call(seen, fromIndex, 1);
              }
              splice.call(array, fromIndex, 1);
            }
          }
          return array;
        }
        function basePullAt(array, indexes) {
          var length = array ? indexes.length : 0, lastIndex = length - 1;
          while (length--) {
            var index = indexes[length];
            if (length == lastIndex || index !== previous) {
              var previous = index;
              if (isIndex(index)) {
                splice.call(array, index, 1);
              } else {
                baseUnset(array, index);
              }
            }
          }
          return array;
        }
        function baseRandom(lower, upper) {
          return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
        }
        function baseRange(start, end, step, fromRight) {
          var index = -1, length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result2 = Array2(length);
          while (length--) {
            result2[fromRight ? length : ++index] = start;
            start += step;
          }
          return result2;
        }
        function baseRepeat(string2, n) {
          var result2 = "";
          if (!string2 || n < 1 || n > MAX_SAFE_INTEGER) {
            return result2;
          }
          do {
            if (n % 2) {
              result2 += string2;
            }
            n = nativeFloor(n / 2);
            if (n) {
              string2 += string2;
            }
          } while (n);
          return result2;
        }
        function baseRest(func, start) {
          return setToString(overRest(func, start, identity2), func + "");
        }
        function baseSample(collection) {
          return arraySample(values(collection));
        }
        function baseSampleSize(collection, n) {
          var array = values(collection);
          return shuffleSelf(array, baseClamp(n, 0, array.length));
        }
        function baseSet(object, path, value, customizer) {
          if (!isObject(object)) {
            return object;
          }
          path = castPath(path, object);
          var index = -1, length = path.length, lastIndex = length - 1, nested = object;
          while (nested != null && ++index < length) {
            var key = toKey(path[index]), newValue = value;
            if (key === "__proto__" || key === "constructor" || key === "prototype") {
              return object;
            }
            if (index != lastIndex) {
              var objValue = nested[key];
              newValue = customizer ? customizer(objValue, key, nested) : undefined2;
              if (newValue === undefined2) {
                newValue = isObject(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
              }
            }
            assignValue(nested, key, newValue);
            nested = nested[key];
          }
          return object;
        }
        var baseSetData = !metaMap ? identity2 : function(func, data) {
          metaMap.set(func, data);
          return func;
        };
        var baseSetToString = !defineProperty ? identity2 : function(func, string2) {
          return defineProperty(func, "toString", {
            "configurable": true,
            "enumerable": false,
            "value": constant(string2),
            "writable": true
          });
        };
        function baseShuffle(collection) {
          return shuffleSelf(values(collection));
        }
        function baseSlice(array, start, end) {
          var index = -1, length = array.length;
          if (start < 0) {
            start = -start > length ? 0 : length + start;
          }
          end = end > length ? length : end;
          if (end < 0) {
            end += length;
          }
          length = start > end ? 0 : end - start >>> 0;
          start >>>= 0;
          var result2 = Array2(length);
          while (++index < length) {
            result2[index] = array[index + start];
          }
          return result2;
        }
        function baseSome(collection, predicate) {
          var result2;
          baseEach(collection, function(value, index, collection2) {
            result2 = predicate(value, index, collection2);
            return !result2;
          });
          return !!result2;
        }
        function baseSortedIndex(array, value, retHighest) {
          var low = 0, high = array == null ? low : array.length;
          if (typeof value == "number" && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
            while (low < high) {
              var mid = low + high >>> 1, computed2 = array[mid];
              if (computed2 !== null && !isSymbol(computed2) && (retHighest ? computed2 <= value : computed2 < value)) {
                low = mid + 1;
              } else {
                high = mid;
              }
            }
            return high;
          }
          return baseSortedIndexBy(array, value, identity2, retHighest);
        }
        function baseSortedIndexBy(array, value, iteratee2, retHighest) {
          var low = 0, high = array == null ? 0 : array.length;
          if (high === 0) {
            return 0;
          }
          value = iteratee2(value);
          var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol(value), valIsUndefined = value === undefined2;
          while (low < high) {
            var mid = nativeFloor((low + high) / 2), computed2 = iteratee2(array[mid]), othIsDefined = computed2 !== undefined2, othIsNull = computed2 === null, othIsReflexive = computed2 === computed2, othIsSymbol = isSymbol(computed2);
            if (valIsNaN) {
              var setLow = retHighest || othIsReflexive;
            } else if (valIsUndefined) {
              setLow = othIsReflexive && (retHighest || othIsDefined);
            } else if (valIsNull) {
              setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
            } else if (valIsSymbol) {
              setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
            } else if (othIsNull || othIsSymbol) {
              setLow = false;
            } else {
              setLow = retHighest ? computed2 <= value : computed2 < value;
            }
            if (setLow) {
              low = mid + 1;
            } else {
              high = mid;
            }
          }
          return nativeMin(high, MAX_ARRAY_INDEX);
        }
        function baseSortedUniq(array, iteratee2) {
          var index = -1, length = array.length, resIndex = 0, result2 = [];
          while (++index < length) {
            var value = array[index], computed2 = iteratee2 ? iteratee2(value) : value;
            if (!index || !eq(computed2, seen)) {
              var seen = computed2;
              result2[resIndex++] = value === 0 ? 0 : value;
            }
          }
          return result2;
        }
        function baseToNumber(value) {
          if (typeof value == "number") {
            return value;
          }
          if (isSymbol(value)) {
            return NAN;
          }
          return +value;
        }
        function baseToString(value) {
          if (typeof value == "string") {
            return value;
          }
          if (isArray3(value)) {
            return arrayMap(value, baseToString) + "";
          }
          if (isSymbol(value)) {
            return symbolToString ? symbolToString.call(value) : "";
          }
          var result2 = value + "";
          return result2 == "0" && 1 / value == -INFINITY ? "-0" : result2;
        }
        function baseUniq(array, iteratee2, comparator) {
          var index = -1, includes2 = arrayIncludes, length = array.length, isCommon = true, result2 = [], seen = result2;
          if (comparator) {
            isCommon = false;
            includes2 = arrayIncludesWith;
          } else if (length >= LARGE_ARRAY_SIZE) {
            var set3 = iteratee2 ? null : createSet(array);
            if (set3) {
              return setToArray(set3);
            }
            isCommon = false;
            includes2 = cacheHas;
            seen = new SetCache();
          } else {
            seen = iteratee2 ? [] : result2;
          }
          outer:
            while (++index < length) {
              var value = array[index], computed2 = iteratee2 ? iteratee2(value) : value;
              value = comparator || value !== 0 ? value : 0;
              if (isCommon && computed2 === computed2) {
                var seenIndex = seen.length;
                while (seenIndex--) {
                  if (seen[seenIndex] === computed2) {
                    continue outer;
                  }
                }
                if (iteratee2) {
                  seen.push(computed2);
                }
                result2.push(value);
              } else if (!includes2(seen, computed2, comparator)) {
                if (seen !== result2) {
                  seen.push(computed2);
                }
                result2.push(value);
              }
            }
          return result2;
        }
        function baseUnset(object, path) {
          path = castPath(path, object);
          object = parent(object, path);
          return object == null || delete object[toKey(last4(path))];
        }
        function baseUpdate(object, path, updater, customizer) {
          return baseSet(object, path, updater(baseGet(object, path)), customizer);
        }
        function baseWhile(array, predicate, isDrop, fromRight) {
          var length = array.length, index = fromRight ? length : -1;
          while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) {
          }
          return isDrop ? baseSlice(array, fromRight ? 0 : index, fromRight ? index + 1 : length) : baseSlice(array, fromRight ? index + 1 : 0, fromRight ? length : index);
        }
        function baseWrapperValue(value, actions) {
          var result2 = value;
          if (result2 instanceof LazyWrapper) {
            result2 = result2.value();
          }
          return arrayReduce(actions, function(result3, action) {
            return action.func.apply(action.thisArg, arrayPush([result3], action.args));
          }, result2);
        }
        function baseXor(arrays, iteratee2, comparator) {
          var length = arrays.length;
          if (length < 2) {
            return length ? baseUniq(arrays[0]) : [];
          }
          var index = -1, result2 = Array2(length);
          while (++index < length) {
            var array = arrays[index], othIndex = -1;
            while (++othIndex < length) {
              if (othIndex != index) {
                result2[index] = baseDifference(result2[index] || array, arrays[othIndex], iteratee2, comparator);
              }
            }
          }
          return baseUniq(baseFlatten(result2, 1), iteratee2, comparator);
        }
        function baseZipObject(props, values2, assignFunc) {
          var index = -1, length = props.length, valsLength = values2.length, result2 = {};
          while (++index < length) {
            var value = index < valsLength ? values2[index] : undefined2;
            assignFunc(result2, props[index], value);
          }
          return result2;
        }
        function castArrayLikeObject(value) {
          return isArrayLikeObject(value) ? value : [];
        }
        function castFunction(value) {
          return typeof value == "function" ? value : identity2;
        }
        function castPath(value, object) {
          if (isArray3(value)) {
            return value;
          }
          return isKey(value, object) ? [value] : stringToPath(toString(value));
        }
        var castRest = baseRest;
        function castSlice(array, start, end) {
          var length = array.length;
          end = end === undefined2 ? length : end;
          return !start && end >= length ? array : baseSlice(array, start, end);
        }
        var clearTimeout2 = ctxClearTimeout || function(id) {
          return root.clearTimeout(id);
        };
        function cloneBuffer(buffer, isDeep) {
          if (isDeep) {
            return buffer.slice();
          }
          var length = buffer.length, result2 = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
          buffer.copy(result2);
          return result2;
        }
        function cloneArrayBuffer(arrayBuffer) {
          var result2 = new arrayBuffer.constructor(arrayBuffer.byteLength);
          new Uint8Array2(result2).set(new Uint8Array2(arrayBuffer));
          return result2;
        }
        function cloneDataView(dataView, isDeep) {
          var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
          return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
        }
        function cloneRegExp(regexp) {
          var result2 = new regexp.constructor(regexp.source, reFlags.exec(regexp));
          result2.lastIndex = regexp.lastIndex;
          return result2;
        }
        function cloneSymbol(symbol) {
          return symbolValueOf ? Object2(symbolValueOf.call(symbol)) : {};
        }
        function cloneTypedArray(typedArray, isDeep) {
          var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
          return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
        }
        function compareAscending(value, other) {
          if (value !== other) {
            var valIsDefined = value !== undefined2, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol(value);
            var othIsDefined = other !== undefined2, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol(other);
            if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) {
              return 1;
            }
            if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) {
              return -1;
            }
          }
          return 0;
        }
        function compareMultiple(object, other, orders) {
          var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length;
          while (++index < length) {
            var result2 = compareAscending(objCriteria[index], othCriteria[index]);
            if (result2) {
              if (index >= ordersLength) {
                return result2;
              }
              var order = orders[index];
              return result2 * (order == "desc" ? -1 : 1);
            }
          }
          return object.index - other.index;
        }
        function composeArgs(args, partials, holders, isCurried) {
          var argsIndex = -1, argsLength = args.length, holdersLength = holders.length, leftIndex = -1, leftLength = partials.length, rangeLength = nativeMax(argsLength - holdersLength, 0), result2 = Array2(leftLength + rangeLength), isUncurried = !isCurried;
          while (++leftIndex < leftLength) {
            result2[leftIndex] = partials[leftIndex];
          }
          while (++argsIndex < holdersLength) {
            if (isUncurried || argsIndex < argsLength) {
              result2[holders[argsIndex]] = args[argsIndex];
            }
          }
          while (rangeLength--) {
            result2[leftIndex++] = args[argsIndex++];
          }
          return result2;
        }
        function composeArgsRight(args, partials, holders, isCurried) {
          var argsIndex = -1, argsLength = args.length, holdersIndex = -1, holdersLength = holders.length, rightIndex = -1, rightLength = partials.length, rangeLength = nativeMax(argsLength - holdersLength, 0), result2 = Array2(rangeLength + rightLength), isUncurried = !isCurried;
          while (++argsIndex < rangeLength) {
            result2[argsIndex] = args[argsIndex];
          }
          var offset = argsIndex;
          while (++rightIndex < rightLength) {
            result2[offset + rightIndex] = partials[rightIndex];
          }
          while (++holdersIndex < holdersLength) {
            if (isUncurried || argsIndex < argsLength) {
              result2[offset + holders[holdersIndex]] = args[argsIndex++];
            }
          }
          return result2;
        }
        function copyArray(source, array) {
          var index = -1, length = source.length;
          array || (array = Array2(length));
          while (++index < length) {
            array[index] = source[index];
          }
          return array;
        }
        function copyObject(source, props, object, customizer) {
          var isNew = !object;
          object || (object = {});
          var index = -1, length = props.length;
          while (++index < length) {
            var key = props[index];
            var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined2;
            if (newValue === undefined2) {
              newValue = source[key];
            }
            if (isNew) {
              baseAssignValue(object, key, newValue);
            } else {
              assignValue(object, key, newValue);
            }
          }
          return object;
        }
        function copySymbols(source, object) {
          return copyObject(source, getSymbols(source), object);
        }
        function copySymbolsIn(source, object) {
          return copyObject(source, getSymbolsIn(source), object);
        }
        function createAggregator(setter, initializer) {
          return function(collection, iteratee2) {
            var func = isArray3(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {};
            return func(collection, setter, getIteratee(iteratee2, 2), accumulator);
          };
        }
        function createAssigner(assigner) {
          return baseRest(function(object, sources) {
            var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : undefined2, guard = length > 2 ? sources[2] : undefined2;
            customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : undefined2;
            if (guard && isIterateeCall(sources[0], sources[1], guard)) {
              customizer = length < 3 ? undefined2 : customizer;
              length = 1;
            }
            object = Object2(object);
            while (++index < length) {
              var source = sources[index];
              if (source) {
                assigner(object, source, index, customizer);
              }
            }
            return object;
          });
        }
        function createBaseEach(eachFunc, fromRight) {
          return function(collection, iteratee2) {
            if (collection == null) {
              return collection;
            }
            if (!isArrayLike2(collection)) {
              return eachFunc(collection, iteratee2);
            }
            var length = collection.length, index = fromRight ? length : -1, iterable = Object2(collection);
            while (fromRight ? index-- : ++index < length) {
              if (iteratee2(iterable[index], index, iterable) === false) {
                break;
              }
            }
            return collection;
          };
        }
        function createBaseFor(fromRight) {
          return function(object, iteratee2, keysFunc) {
            var index = -1, iterable = Object2(object), props = keysFunc(object), length = props.length;
            while (length--) {
              var key = props[fromRight ? length : ++index];
              if (iteratee2(iterable[key], key, iterable) === false) {
                break;
              }
            }
            return object;
          };
        }
        function createBind(func, bitmask, thisArg) {
          var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
          function wrapper() {
            var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
            return fn.apply(isBind ? thisArg : this, arguments);
          }
          return wrapper;
        }
        function createCaseFirst(methodName) {
          return function(string2) {
            string2 = toString(string2);
            var strSymbols = hasUnicode(string2) ? stringToArray(string2) : undefined2;
            var chr = strSymbols ? strSymbols[0] : string2.charAt(0);
            var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string2.slice(1);
            return chr[methodName]() + trailing;
          };
        }
        function createCompounder(callback) {
          return function(string2) {
            return arrayReduce(words(deburr(string2).replace(reApos, "")), callback, "");
          };
        }
        function createCtor(Ctor) {
          return function() {
            var args = arguments;
            switch (args.length) {
              case 0:
                return new Ctor();
              case 1:
                return new Ctor(args[0]);
              case 2:
                return new Ctor(args[0], args[1]);
              case 3:
                return new Ctor(args[0], args[1], args[2]);
              case 4:
                return new Ctor(args[0], args[1], args[2], args[3]);
              case 5:
                return new Ctor(args[0], args[1], args[2], args[3], args[4]);
              case 6:
                return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
              case 7:
                return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
            }
            var thisBinding = baseCreate(Ctor.prototype), result2 = Ctor.apply(thisBinding, args);
            return isObject(result2) ? result2 : thisBinding;
          };
        }
        function createCurry(func, bitmask, arity) {
          var Ctor = createCtor(func);
          function wrapper() {
            var length = arguments.length, args = Array2(length), index = length, placeholder = getHolder(wrapper);
            while (index--) {
              args[index] = arguments[index];
            }
            var holders = length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder ? [] : replaceHolders(args, placeholder);
            length -= holders.length;
            if (length < arity) {
              return createRecurry(
                func,
                bitmask,
                createHybrid,
                wrapper.placeholder,
                undefined2,
                args,
                holders,
                undefined2,
                undefined2,
                arity - length
              );
            }
            var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
            return apply(fn, this, args);
          }
          return wrapper;
        }
        function createFind(findIndexFunc) {
          return function(collection, predicate, fromIndex) {
            var iterable = Object2(collection);
            if (!isArrayLike2(collection)) {
              var iteratee2 = getIteratee(predicate, 3);
              collection = keys(collection);
              predicate = function(key) {
                return iteratee2(iterable[key], key, iterable);
              };
            }
            var index = findIndexFunc(collection, predicate, fromIndex);
            return index > -1 ? iterable[iteratee2 ? collection[index] : index] : undefined2;
          };
        }
        function createFlow(fromRight) {
          return flatRest(function(funcs) {
            var length = funcs.length, index = length, prereq = LodashWrapper.prototype.thru;
            if (fromRight) {
              funcs.reverse();
            }
            while (index--) {
              var func = funcs[index];
              if (typeof func != "function") {
                throw new TypeError2(FUNC_ERROR_TEXT);
              }
              if (prereq && !wrapper && getFuncName(func) == "wrapper") {
                var wrapper = new LodashWrapper([], true);
              }
            }
            index = wrapper ? index : length;
            while (++index < length) {
              func = funcs[index];
              var funcName = getFuncName(func), data = funcName == "wrapper" ? getData2(func) : undefined2;
              if (data && isLaziable(data[0]) && data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && !data[4].length && data[9] == 1) {
                wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
              } else {
                wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func);
              }
            }
            return function() {
              var args = arguments, value = args[0];
              if (wrapper && args.length == 1 && isArray3(value)) {
                return wrapper.plant(value).value();
              }
              var index2 = 0, result2 = length ? funcs[index2].apply(this, args) : value;
              while (++index2 < length) {
                result2 = funcs[index2].call(this, result2);
              }
              return result2;
            };
          });
        }
        function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary2, arity) {
          var isAry = bitmask & WRAP_ARY_FLAG, isBind = bitmask & WRAP_BIND_FLAG, isBindKey = bitmask & WRAP_BIND_KEY_FLAG, isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), isFlip = bitmask & WRAP_FLIP_FLAG, Ctor = isBindKey ? undefined2 : createCtor(func);
          function wrapper() {
            var length = arguments.length, args = Array2(length), index = length;
            while (index--) {
              args[index] = arguments[index];
            }
            if (isCurried) {
              var placeholder = getHolder(wrapper), holdersCount = countHolders(args, placeholder);
            }
            if (partials) {
              args = composeArgs(args, partials, holders, isCurried);
            }
            if (partialsRight) {
              args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
            }
            length -= holdersCount;
            if (isCurried && length < arity) {
              var newHolders = replaceHolders(args, placeholder);
              return createRecurry(
                func,
                bitmask,
                createHybrid,
                wrapper.placeholder,
                thisArg,
                args,
                newHolders,
                argPos,
                ary2,
                arity - length
              );
            }
            var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func;
            length = args.length;
            if (argPos) {
              args = reorder(args, argPos);
            } else if (isFlip && length > 1) {
              args.reverse();
            }
            if (isAry && ary2 < length) {
              args.length = ary2;
            }
            if (this && this !== root && this instanceof wrapper) {
              fn = Ctor || createCtor(fn);
            }
            return fn.apply(thisBinding, args);
          }
          return wrapper;
        }
        function createInverter(setter, toIteratee) {
          return function(object, iteratee2) {
            return baseInverter(object, setter, toIteratee(iteratee2), {});
          };
        }
        function createMathOperation(operator, defaultValue) {
          return function(value, other) {
            var result2;
            if (value === undefined2 && other === undefined2) {
              return defaultValue;
            }
            if (value !== undefined2) {
              result2 = value;
            }
            if (other !== undefined2) {
              if (result2 === undefined2) {
                return other;
              }
              if (typeof value == "string" || typeof other == "string") {
                value = baseToString(value);
                other = baseToString(other);
              } else {
                value = baseToNumber(value);
                other = baseToNumber(other);
              }
              result2 = operator(value, other);
            }
            return result2;
          };
        }
        function createOver(arrayFunc) {
          return flatRest(function(iteratees) {
            iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
            return baseRest(function(args) {
              var thisArg = this;
              return arrayFunc(iteratees, function(iteratee2) {
                return apply(iteratee2, thisArg, args);
              });
            });
          });
        }
        function createPadding(length, chars) {
          chars = chars === undefined2 ? " " : baseToString(chars);
          var charsLength = chars.length;
          if (charsLength < 2) {
            return charsLength ? baseRepeat(chars, length) : chars;
          }
          var result2 = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
          return hasUnicode(chars) ? castSlice(stringToArray(result2), 0, length).join("") : result2.slice(0, length);
        }
        function createPartial(func, bitmask, thisArg, partials) {
          var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
          function wrapper() {
            var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array2(leftLength + argsLength), fn = this && this !== root && this instanceof wrapper ? Ctor : func;
            while (++leftIndex < leftLength) {
              args[leftIndex] = partials[leftIndex];
            }
            while (argsLength--) {
              args[leftIndex++] = arguments[++argsIndex];
            }
            return apply(fn, isBind ? thisArg : this, args);
          }
          return wrapper;
        }
        function createRange(fromRight) {
          return function(start, end, step) {
            if (step && typeof step != "number" && isIterateeCall(start, end, step)) {
              end = step = undefined2;
            }
            start = toFinite(start);
            if (end === undefined2) {
              end = start;
              start = 0;
            } else {
              end = toFinite(end);
            }
            step = step === undefined2 ? start < end ? 1 : -1 : toFinite(step);
            return baseRange(start, end, step, fromRight);
          };
        }
        function createRelationalOperation(operator) {
          return function(value, other) {
            if (!(typeof value == "string" && typeof other == "string")) {
              value = toNumber(value);
              other = toNumber(other);
            }
            return operator(value, other);
          };
        }
        function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary2, arity) {
          var isCurry = bitmask & WRAP_CURRY_FLAG, newHolders = isCurry ? holders : undefined2, newHoldersRight = isCurry ? undefined2 : holders, newPartials = isCurry ? partials : undefined2, newPartialsRight = isCurry ? undefined2 : partials;
          bitmask |= isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG;
          bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
          if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
            bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
          }
          var newData = [
            func,
            bitmask,
            thisArg,
            newPartials,
            newHolders,
            newPartialsRight,
            newHoldersRight,
            argPos,
            ary2,
            arity
          ];
          var result2 = wrapFunc.apply(undefined2, newData);
          if (isLaziable(func)) {
            setData(result2, newData);
          }
          result2.placeholder = placeholder;
          return setWrapToString(result2, func, bitmask);
        }
        function createRound(methodName) {
          var func = Math2[methodName];
          return function(number, precision) {
            number = toNumber(number);
            precision = precision == null ? 0 : nativeMin(toInteger2(precision), 292);
            if (precision && nativeIsFinite(number)) {
              var pair = (toString(number) + "e").split("e"), value = func(pair[0] + "e" + (+pair[1] + precision));
              pair = (toString(value) + "e").split("e");
              return +(pair[0] + "e" + (+pair[1] - precision));
            }
            return func(number);
          };
        }
        var createSet = !(Set2 && 1 / setToArray(new Set2([, -0]))[1] == INFINITY) ? noop4 : function(values2) {
          return new Set2(values2);
        };
        function createToPairs(keysFunc) {
          return function(object) {
            var tag = getTag(object);
            if (tag == mapTag) {
              return mapToArray(object);
            }
            if (tag == setTag) {
              return setToPairs(object);
            }
            return baseToPairs(object, keysFunc(object));
          };
        }
        function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary2, arity) {
          var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
          if (!isBindKey && typeof func != "function") {
            throw new TypeError2(FUNC_ERROR_TEXT);
          }
          var length = partials ? partials.length : 0;
          if (!length) {
            bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
            partials = holders = undefined2;
          }
          ary2 = ary2 === undefined2 ? ary2 : nativeMax(toInteger2(ary2), 0);
          arity = arity === undefined2 ? arity : toInteger2(arity);
          length -= holders ? holders.length : 0;
          if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
            var partialsRight = partials, holdersRight = holders;
            partials = holders = undefined2;
          }
          var data = isBindKey ? undefined2 : getData2(func);
          var newData = [
            func,
            bitmask,
            thisArg,
            partials,
            holders,
            partialsRight,
            holdersRight,
            argPos,
            ary2,
            arity
          ];
          if (data) {
            mergeData(newData, data);
          }
          func = newData[0];
          bitmask = newData[1];
          thisArg = newData[2];
          partials = newData[3];
          holders = newData[4];
          arity = newData[9] = newData[9] === undefined2 ? isBindKey ? 0 : func.length : nativeMax(newData[9] - length, 0);
          if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
            bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
          }
          if (!bitmask || bitmask == WRAP_BIND_FLAG) {
            var result2 = createBind(func, bitmask, thisArg);
          } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
            result2 = createCurry(func, bitmask, arity);
          } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
            result2 = createPartial(func, bitmask, thisArg, partials);
          } else {
            result2 = createHybrid.apply(undefined2, newData);
          }
          var setter = data ? baseSetData : setData;
          return setWrapToString(setter(result2, newData), func, bitmask);
        }
        function customDefaultsAssignIn(objValue, srcValue, key, object) {
          if (objValue === undefined2 || eq(objValue, objectProto2[key]) && !hasOwnProperty2.call(object, key)) {
            return srcValue;
          }
          return objValue;
        }
        function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
          if (isObject(objValue) && isObject(srcValue)) {
            stack.set(srcValue, objValue);
            baseMerge(objValue, srcValue, undefined2, customDefaultsMerge, stack);
            stack["delete"](srcValue);
          }
          return objValue;
        }
        function customOmitClone(value) {
          return isPlainObject(value) ? undefined2 : value;
        }
        function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
          var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array.length, othLength = other.length;
          if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
            return false;
          }
          var arrStacked = stack.get(array);
          var othStacked = stack.get(other);
          if (arrStacked && othStacked) {
            return arrStacked == other && othStacked == array;
          }
          var index = -1, result2 = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : undefined2;
          stack.set(array, other);
          stack.set(other, array);
          while (++index < arrLength) {
            var arrValue = array[index], othValue = other[index];
            if (customizer) {
              var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
            }
            if (compared !== undefined2) {
              if (compared) {
                continue;
              }
              result2 = false;
              break;
            }
            if (seen) {
              if (!arraySome(other, function(othValue2, othIndex) {
                if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
                  return seen.push(othIndex);
                }
              })) {
                result2 = false;
                break;
              }
            } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
              result2 = false;
              break;
            }
          }
          stack["delete"](array);
          stack["delete"](other);
          return result2;
        }
        function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
          switch (tag) {
            case dataViewTag:
              if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
                return false;
              }
              object = object.buffer;
              other = other.buffer;
            case arrayBufferTag:
              if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array2(object), new Uint8Array2(other))) {
                return false;
              }
              return true;
            case boolTag2:
            case dateTag:
            case numberTag:
              return eq(+object, +other);
            case errorTag:
              return object.name == other.name && object.message == other.message;
            case regexpTag:
            case stringTag:
              return object == other + "";
            case mapTag:
              var convert = mapToArray;
            case setTag:
              var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
              convert || (convert = setToArray);
              if (object.size != other.size && !isPartial) {
                return false;
              }
              var stacked = stack.get(object);
              if (stacked) {
                return stacked == other;
              }
              bitmask |= COMPARE_UNORDERED_FLAG;
              stack.set(object, other);
              var result2 = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
              stack["delete"](object);
              return result2;
            case symbolTag:
              if (symbolValueOf) {
                return symbolValueOf.call(object) == symbolValueOf.call(other);
              }
          }
          return false;
        }
        function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
          var isPartial = bitmask & COMPARE_PARTIAL_FLAG, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
          if (objLength != othLength && !isPartial) {
            return false;
          }
          var index = objLength;
          while (index--) {
            var key = objProps[index];
            if (!(isPartial ? key in other : hasOwnProperty2.call(other, key))) {
              return false;
            }
          }
          var objStacked = stack.get(object);
          var othStacked = stack.get(other);
          if (objStacked && othStacked) {
            return objStacked == other && othStacked == object;
          }
          var result2 = true;
          stack.set(object, other);
          stack.set(other, object);
          var skipCtor = isPartial;
          while (++index < objLength) {
            key = objProps[index];
            var objValue = object[key], othValue = other[key];
            if (customizer) {
              var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
            }
            if (!(compared === undefined2 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
              result2 = false;
              break;
            }
            skipCtor || (skipCtor = key == "constructor");
          }
          if (result2 && !skipCtor) {
            var objCtor = object.constructor, othCtor = other.constructor;
            if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
              result2 = false;
            }
          }
          stack["delete"](object);
          stack["delete"](other);
          return result2;
        }
        function flatRest(func) {
          return setToString(overRest(func, undefined2, flatten2), func + "");
        }
        function getAllKeys(object) {
          return baseGetAllKeys(object, keys, getSymbols);
        }
        function getAllKeysIn(object) {
          return baseGetAllKeys(object, keysIn, getSymbolsIn);
        }
        var getData2 = !metaMap ? noop4 : function(func) {
          return metaMap.get(func);
        };
        function getFuncName(func) {
          var result2 = func.name + "", array = realNames[result2], length = hasOwnProperty2.call(realNames, result2) ? array.length : 0;
          while (length--) {
            var data = array[length], otherFunc = data.func;
            if (otherFunc == null || otherFunc == func) {
              return data.name;
            }
          }
          return result2;
        }
        function getHolder(func) {
          var object = hasOwnProperty2.call(lodash, "placeholder") ? lodash : func;
          return object.placeholder;
        }
        function getIteratee() {
          var result2 = lodash.iteratee || iteratee;
          result2 = result2 === iteratee ? baseIteratee : result2;
          return arguments.length ? result2(arguments[0], arguments[1]) : result2;
        }
        function getMapData(map4, key) {
          var data = map4.__data__;
          return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
        }
        function getMatchData(object) {
          var result2 = keys(object), length = result2.length;
          while (length--) {
            var key = result2[length], value = object[key];
            result2[length] = [key, value, isStrictComparable(value)];
          }
          return result2;
        }
        function getNative(object, key) {
          var value = getValue(object, key);
          return baseIsNative(value) ? value : undefined2;
        }
        function getRawTag(value) {
          var isOwn = hasOwnProperty2.call(value, symToStringTag), tag = value[symToStringTag];
          try {
            value[symToStringTag] = undefined2;
            var unmasked = true;
          } catch (e) {
          }
          var result2 = nativeObjectToString.call(value);
          if (unmasked) {
            if (isOwn) {
              value[symToStringTag] = tag;
            } else {
              delete value[symToStringTag];
            }
          }
          return result2;
        }
        var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
          if (object == null) {
            return [];
          }
          object = Object2(object);
          return arrayFilter(nativeGetSymbols(object), function(symbol) {
            return propertyIsEnumerable.call(object, symbol);
          });
        };
        var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
          var result2 = [];
          while (object) {
            arrayPush(result2, getSymbols(object));
            object = getPrototype(object);
          }
          return result2;
        };
        var getTag = baseGetTag;
        if (DataView2 && getTag(new DataView2(new ArrayBuffer(1))) != dataViewTag || Map2 && getTag(new Map2()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set2 && getTag(new Set2()) != setTag || WeakMap2 && getTag(new WeakMap2()) != weakMapTag) {
          getTag = function(value) {
            var result2 = baseGetTag(value), Ctor = result2 == objectTag ? value.constructor : undefined2, ctorString = Ctor ? toSource(Ctor) : "";
            if (ctorString) {
              switch (ctorString) {
                case dataViewCtorString:
                  return dataViewTag;
                case mapCtorString:
                  return mapTag;
                case promiseCtorString:
                  return promiseTag;
                case setCtorString:
                  return setTag;
                case weakMapCtorString:
                  return weakMapTag;
              }
            }
            return result2;
          };
        }
        function getView(start, end, transforms) {
          var index = -1, length = transforms.length;
          while (++index < length) {
            var data = transforms[index], size2 = data.size;
            switch (data.type) {
              case "drop":
                start += size2;
                break;
              case "dropRight":
                end -= size2;
                break;
              case "take":
                end = nativeMin(end, start + size2);
                break;
              case "takeRight":
                start = nativeMax(start, end - size2);
                break;
            }
          }
          return { "start": start, "end": end };
        }
        function getWrapDetails(source) {
          var match2 = source.match(reWrapDetails);
          return match2 ? match2[1].split(reSplitDetails) : [];
        }
        function hasPath(object, path, hasFunc) {
          path = castPath(path, object);
          var index = -1, length = path.length, result2 = false;
          while (++index < length) {
            var key = toKey(path[index]);
            if (!(result2 = object != null && hasFunc(object, key))) {
              break;
            }
            object = object[key];
          }
          if (result2 || ++index != length) {
            return result2;
          }
          length = object == null ? 0 : object.length;
          return !!length && isLength(length) && isIndex(key, length) && (isArray3(object) || isArguments(object));
        }
        function initCloneArray(array) {
          var length = array.length, result2 = new array.constructor(length);
          if (length && typeof array[0] == "string" && hasOwnProperty2.call(array, "index")) {
            result2.index = array.index;
            result2.input = array.input;
          }
          return result2;
        }
        function initCloneObject(object) {
          return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
        }
        function initCloneByTag(object, tag, isDeep) {
          var Ctor = object.constructor;
          switch (tag) {
            case arrayBufferTag:
              return cloneArrayBuffer(object);
            case boolTag2:
            case dateTag:
              return new Ctor(+object);
            case dataViewTag:
              return cloneDataView(object, isDeep);
            case float32Tag:
            case float64Tag:
            case int8Tag:
            case int16Tag:
            case int32Tag:
            case uint8Tag:
            case uint8ClampedTag:
            case uint16Tag:
            case uint32Tag:
              return cloneTypedArray(object, isDeep);
            case mapTag:
              return new Ctor();
            case numberTag:
            case stringTag:
              return new Ctor(object);
            case regexpTag:
              return cloneRegExp(object);
            case setTag:
              return new Ctor();
            case symbolTag:
              return cloneSymbol(object);
          }
        }
        function insertWrapDetails(source, details) {
          var length = details.length;
          if (!length) {
            return source;
          }
          var lastIndex = length - 1;
          details[lastIndex] = (length > 1 ? "& " : "") + details[lastIndex];
          details = details.join(length > 2 ? ", " : " ");
          return source.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n");
        }
        function isFlattenable(value) {
          return isArray3(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
        }
        function isIndex(value, length) {
          var type = typeof value;
          length = length == null ? MAX_SAFE_INTEGER : length;
          return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
        }
        function isIterateeCall(value, index, object) {
          if (!isObject(object)) {
            return false;
          }
          var type = typeof index;
          if (type == "number" ? isArrayLike2(object) && isIndex(index, object.length) : type == "string" && index in object) {
            return eq(object[index], value);
          }
          return false;
        }
        function isKey(value, object) {
          if (isArray3(value)) {
            return false;
          }
          var type = typeof value;
          if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) {
            return true;
          }
          return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object2(object);
        }
        function isKeyable(value) {
          var type = typeof value;
          return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
        }
        function isLaziable(func) {
          var funcName = getFuncName(func), other = lodash[funcName];
          if (typeof other != "function" || !(funcName in LazyWrapper.prototype)) {
            return false;
          }
          if (func === other) {
            return true;
          }
          var data = getData2(other);
          return !!data && func === data[0];
        }
        function isMasked(func) {
          return !!maskSrcKey && maskSrcKey in func;
        }
        var isMaskable = coreJsData ? isFunction3 : stubFalse;
        function isPrototype(value) {
          var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto2;
          return value === proto;
        }
        function isStrictComparable(value) {
          return value === value && !isObject(value);
        }
        function matchesStrictComparable(key, srcValue) {
          return function(object) {
            if (object == null) {
              return false;
            }
            return object[key] === srcValue && (srcValue !== undefined2 || key in Object2(object));
          };
        }
        function memoizeCapped(func) {
          var result2 = memoize(func, function(key) {
            if (cache.size === MAX_MEMOIZE_SIZE) {
              cache.clear();
            }
            return key;
          });
          var cache = result2.cache;
          return result2;
        }
        function mergeData(data, source) {
          var bitmask = data[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
          var isCombo = srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_CURRY_FLAG || srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_REARG_FLAG && data[7].length <= source[8] || srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG) && source[7].length <= source[8] && bitmask == WRAP_CURRY_FLAG;
          if (!(isCommon || isCombo)) {
            return data;
          }
          if (srcBitmask & WRAP_BIND_FLAG) {
            data[2] = source[2];
            newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
          }
          var value = source[3];
          if (value) {
            var partials = data[3];
            data[3] = partials ? composeArgs(partials, value, source[4]) : value;
            data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
          }
          value = source[5];
          if (value) {
            partials = data[5];
            data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
            data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
          }
          value = source[7];
          if (value) {
            data[7] = value;
          }
          if (srcBitmask & WRAP_ARY_FLAG) {
            data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
          }
          if (data[9] == null) {
            data[9] = source[9];
          }
          data[0] = source[0];
          data[1] = newBitmask;
          return data;
        }
        function nativeKeysIn(object) {
          var result2 = [];
          if (object != null) {
            for (var key in Object2(object)) {
              result2.push(key);
            }
          }
          return result2;
        }
        function objectToString(value) {
          return nativeObjectToString.call(value);
        }
        function overRest(func, start, transform2) {
          start = nativeMax(start === undefined2 ? func.length - 1 : start, 0);
          return function() {
            var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array2(length);
            while (++index < length) {
              array[index] = args[start + index];
            }
            index = -1;
            var otherArgs = Array2(start + 1);
            while (++index < start) {
              otherArgs[index] = args[index];
            }
            otherArgs[start] = transform2(array);
            return apply(func, this, otherArgs);
          };
        }
        function parent(object, path) {
          return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
        }
        function reorder(array, indexes) {
          var arrLength = array.length, length = nativeMin(indexes.length, arrLength), oldArray = copyArray(array);
          while (length--) {
            var index = indexes[length];
            array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined2;
          }
          return array;
        }
        function safeGet(object, key) {
          if (key === "constructor" && typeof object[key] === "function") {
            return;
          }
          if (key == "__proto__") {
            return;
          }
          return object[key];
        }
        var setData = shortOut(baseSetData);
        var setTimeout2 = ctxSetTimeout || function(func, wait) {
          return root.setTimeout(func, wait);
        };
        var setToString = shortOut(baseSetToString);
        function setWrapToString(wrapper, reference, bitmask) {
          var source = reference + "";
          return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
        }
        function shortOut(func) {
          var count = 0, lastCalled = 0;
          return function() {
            var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
            lastCalled = stamp;
            if (remaining > 0) {
              if (++count >= HOT_COUNT) {
                return arguments[0];
              }
            } else {
              count = 0;
            }
            return func.apply(undefined2, arguments);
          };
        }
        function shuffleSelf(array, size2) {
          var index = -1, length = array.length, lastIndex = length - 1;
          size2 = size2 === undefined2 ? length : size2;
          while (++index < size2) {
            var rand = baseRandom(index, lastIndex), value = array[rand];
            array[rand] = array[index];
            array[index] = value;
          }
          array.length = size2;
          return array;
        }
        var stringToPath = memoizeCapped(function(string2) {
          var result2 = [];
          if (string2.charCodeAt(0) === 46) {
            result2.push("");
          }
          string2.replace(rePropName, function(match2, number, quote, subString) {
            result2.push(quote ? subString.replace(reEscapeChar, "$1") : number || match2);
          });
          return result2;
        });
        function toKey(value) {
          if (typeof value == "string" || isSymbol(value)) {
            return value;
          }
          var result2 = value + "";
          return result2 == "0" && 1 / value == -INFINITY ? "-0" : result2;
        }
        function toSource(func) {
          if (func != null) {
            try {
              return funcToString.call(func);
            } catch (e) {
            }
            try {
              return func + "";
            } catch (e) {
            }
          }
          return "";
        }
        function updateWrapDetails(details, bitmask) {
          arrayEach(wrapFlags, function(pair) {
            var value = "_." + pair[0];
            if (bitmask & pair[1] && !arrayIncludes(details, value)) {
              details.push(value);
            }
          });
          return details.sort();
        }
        function wrapperClone(wrapper) {
          if (wrapper instanceof LazyWrapper) {
            return wrapper.clone();
          }
          var result2 = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
          result2.__actions__ = copyArray(wrapper.__actions__);
          result2.__index__ = wrapper.__index__;
          result2.__values__ = wrapper.__values__;
          return result2;
        }
        function chunk(array, size2, guard) {
          if (guard ? isIterateeCall(array, size2, guard) : size2 === undefined2) {
            size2 = 1;
          } else {
            size2 = nativeMax(toInteger2(size2), 0);
          }
          var length = array == null ? 0 : array.length;
          if (!length || size2 < 1) {
            return [];
          }
          var index = 0, resIndex = 0, result2 = Array2(nativeCeil(length / size2));
          while (index < length) {
            result2[resIndex++] = baseSlice(array, index, index += size2);
          }
          return result2;
        }
        function compact(array) {
          var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result2 = [];
          while (++index < length) {
            var value = array[index];
            if (value) {
              result2[resIndex++] = value;
            }
          }
          return result2;
        }
        function concat2() {
          var length = arguments.length;
          if (!length) {
            return [];
          }
          var args = Array2(length - 1), array = arguments[0], index = length;
          while (index--) {
            args[index - 1] = arguments[index];
          }
          return arrayPush(isArray3(array) ? copyArray(array) : [array], baseFlatten(args, 1));
        }
        var difference = baseRest(function(array, values2) {
          return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values2, 1, isArrayLikeObject, true)) : [];
        });
        var differenceBy = baseRest(function(array, values2) {
          var iteratee2 = last4(values2);
          if (isArrayLikeObject(iteratee2)) {
            iteratee2 = undefined2;
          }
          return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values2, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2)) : [];
        });
        var differenceWith = baseRest(function(array, values2) {
          var comparator = last4(values2);
          if (isArrayLikeObject(comparator)) {
            comparator = undefined2;
          }
          return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values2, 1, isArrayLikeObject, true), undefined2, comparator) : [];
        });
        function drop(array, n, guard) {
          var length = array == null ? 0 : array.length;
          if (!length) {
            return [];
          }
          n = guard || n === undefined2 ? 1 : toInteger2(n);
          return baseSlice(array, n < 0 ? 0 : n, length);
        }
        function dropRight(array, n, guard) {
          var length = array == null ? 0 : array.length;
          if (!length) {
            return [];
          }
          n = guard || n === undefined2 ? 1 : toInteger2(n);
          n = length - n;
          return baseSlice(array, 0, n < 0 ? 0 : n);
        }
        function dropRightWhile(array, predicate) {
          return array && array.length ? baseWhile(array, getIteratee(predicate, 3), true, true) : [];
        }
        function dropWhile(array, predicate) {
          return array && array.length ? baseWhile(array, getIteratee(predicate, 3), true) : [];
        }
        function fill(array, value, start, end) {
          var length = array == null ? 0 : array.length;
          if (!length) {
            return [];
          }
          if (start && typeof start != "number" && isIterateeCall(array, value, start)) {
            start = 0;
            end = length;
          }
          return baseFill(array, value, start, end);
        }
        function findIndex(array, predicate, fromIndex) {
          var length = array == null ? 0 : array.length;
          if (!length) {
            return -1;
          }
          var index = fromIndex == null ? 0 : toInteger2(fromIndex);
          if (index < 0) {
            index = nativeMax(length + index, 0);
          }
          return baseFindIndex(array, getIteratee(predicate, 3), index);
        }
        function findLastIndex(array, predicate, fromIndex) {
          var length = array == null ? 0 : array.length;
          if (!length) {
            return -1;
          }
          var index = length - 1;
          if (fromIndex !== undefined2) {
            index = toInteger2(fromIndex);
            index = fromIndex < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
          }
          return baseFindIndex(array, getIteratee(predicate, 3), index, true);
        }
        function flatten2(array) {
          var length = array == null ? 0 : array.length;
          return length ? baseFlatten(array, 1) : [];
        }
        function flattenDeep(array) {
          var length = array == null ? 0 : array.length;
          return length ? baseFlatten(array, INFINITY) : [];
        }
        function flattenDepth(array, depth) {
          var length = array == null ? 0 : array.length;
          if (!length) {
            return [];
          }
          depth = depth === undefined2 ? 1 : toInteger2(depth);
          return baseFlatten(array, depth);
        }
        function fromPairs(pairs2) {
          var index = -1, length = pairs2 == null ? 0 : pairs2.length, result2 = {};
          while (++index < length) {
            var pair = pairs2[index];
            result2[pair[0]] = pair[1];
          }
          return result2;
        }
        function head(array) {
          return array && array.length ? array[0] : undefined2;
        }
        function indexOf2(array, value, fromIndex) {
          var length = array == null ? 0 : array.length;
          if (!length) {
            return -1;
          }
          var index = fromIndex == null ? 0 : toInteger2(fromIndex);
          if (index < 0) {
            index = nativeMax(length + index, 0);
          }
          return baseIndexOf(array, value, index);
        }
        function initial(array) {
          var length = array == null ? 0 : array.length;
          return length ? baseSlice(array, 0, -1) : [];
        }
        var intersection = baseRest(function(arrays) {
          var mapped = arrayMap(arrays, castArrayLikeObject);
          return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : [];
        });
        var intersectionBy = baseRest(function(arrays) {
          var iteratee2 = last4(arrays), mapped = arrayMap(arrays, castArrayLikeObject);
          if (iteratee2 === last4(mapped)) {
            iteratee2 = undefined2;
          } else {
            mapped.pop();
          }
          return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, getIteratee(iteratee2, 2)) : [];
        });
        var intersectionWith = baseRest(function(arrays) {
          var comparator = last4(arrays), mapped = arrayMap(arrays, castArrayLikeObject);
          comparator = typeof comparator == "function" ? comparator : undefined2;
          if (comparator) {
            mapped.pop();
          }
          return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
        });
        function join(array, separator) {
          return array == null ? "" : nativeJoin.call(array, separator);
        }
        function last4(array) {
          var length = array == null ? 0 : array.length;
          return length ? array[length - 1] : undefined2;
        }
        function lastIndexOf(array, value, fromIndex) {
          var length = array == null ? 0 : array.length;
          if (!length) {
            return -1;
          }
          var index = length;
          if (fromIndex !== undefined2) {
            index = toInteger2(fromIndex);
            index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
          }
          return value === value ? strictLastIndexOf(array, value, index) : baseFindIndex(array, baseIsNaN, index, true);
        }
        function nth(array, n) {
          return array && array.length ? baseNth(array, toInteger2(n)) : undefined2;
        }
        var pull = baseRest(pullAll);
        function pullAll(array, values2) {
          return array && array.length && values2 && values2.length ? basePullAll(array, values2) : array;
        }
        function pullAllBy(array, values2, iteratee2) {
          return array && array.length && values2 && values2.length ? basePullAll(array, values2, getIteratee(iteratee2, 2)) : array;
        }
        function pullAllWith(array, values2, comparator) {
          return array && array.length && values2 && values2.length ? basePullAll(array, values2, undefined2, comparator) : array;
        }
        var pullAt = flatRest(function(array, indexes) {
          var length = array == null ? 0 : array.length, result2 = baseAt(array, indexes);
          basePullAt(array, arrayMap(indexes, function(index) {
            return isIndex(index, length) ? +index : index;
          }).sort(compareAscending));
          return result2;
        });
        function remove2(array, predicate) {
          var result2 = [];
          if (!(array && array.length)) {
            return result2;
          }
          var index = -1, indexes = [], length = array.length;
          predicate = getIteratee(predicate, 3);
          while (++index < length) {
            var value = array[index];
            if (predicate(value, index, array)) {
              result2.push(value);
              indexes.push(index);
            }
          }
          basePullAt(array, indexes);
          return result2;
        }
        function reverse(array) {
          return array == null ? array : nativeReverse.call(array);
        }
        function slice(array, start, end) {
          var length = array == null ? 0 : array.length;
          if (!length) {
            return [];
          }
          if (end && typeof end != "number" && isIterateeCall(array, start, end)) {
            start = 0;
            end = length;
          } else {
            start = start == null ? 0 : toInteger2(start);
            end = end === undefined2 ? length : toInteger2(end);
          }
          return baseSlice(array, start, end);
        }
        function sortedIndex(array, value) {
          return baseSortedIndex(array, value);
        }
        function sortedIndexBy(array, value, iteratee2) {
          return baseSortedIndexBy(array, value, getIteratee(iteratee2, 2));
        }
        function sortedIndexOf(array, value) {
          var length = array == null ? 0 : array.length;
          if (length) {
            var index = baseSortedIndex(array, value);
            if (index < length && eq(array[index], value)) {
              return index;
            }
          }
          return -1;
        }
        function sortedLastIndex(array, value) {
          return baseSortedIndex(array, value, true);
        }
        function sortedLastIndexBy(array, value, iteratee2) {
          return baseSortedIndexBy(array, value, getIteratee(iteratee2, 2), true);
        }
        function sortedLastIndexOf(array, value) {
          var length = array == null ? 0 : array.length;
          if (length) {
            var index = baseSortedIndex(array, value, true) - 1;
            if (eq(array[index], value)) {
              return index;
            }
          }
          return -1;
        }
        function sortedUniq(array) {
          return array && array.length ? baseSortedUniq(array) : [];
        }
        function sortedUniqBy(array, iteratee2) {
          return array && array.length ? baseSortedUniq(array, getIteratee(iteratee2, 2)) : [];
        }
        function tail(array) {
          var length = array == null ? 0 : array.length;
          return length ? baseSlice(array, 1, length) : [];
        }
        function take2(array, n, guard) {
          if (!(array && array.length)) {
            return [];
          }
          n = guard || n === undefined2 ? 1 : toInteger2(n);
          return baseSlice(array, 0, n < 0 ? 0 : n);
        }
        function takeRight(array, n, guard) {
          var length = array == null ? 0 : array.length;
          if (!length) {
            return [];
          }
          n = guard || n === undefined2 ? 1 : toInteger2(n);
          n = length - n;
          return baseSlice(array, n < 0 ? 0 : n, length);
        }
        function takeRightWhile(array, predicate) {
          return array && array.length ? baseWhile(array, getIteratee(predicate, 3), false, true) : [];
        }
        function takeWhile2(array, predicate) {
          return array && array.length ? baseWhile(array, getIteratee(predicate, 3)) : [];
        }
        var union = baseRest(function(arrays) {
          return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
        });
        var unionBy = baseRest(function(arrays) {
          var iteratee2 = last4(arrays);
          if (isArrayLikeObject(iteratee2)) {
            iteratee2 = undefined2;
          }
          return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2));
        });
        var unionWith = baseRest(function(arrays) {
          var comparator = last4(arrays);
          comparator = typeof comparator == "function" ? comparator : undefined2;
          return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined2, comparator);
        });
        function uniq(array) {
          return array && array.length ? baseUniq(array) : [];
        }
        function uniqBy(array, iteratee2) {
          return array && array.length ? baseUniq(array, getIteratee(iteratee2, 2)) : [];
        }
        function uniqWith(array, comparator) {
          comparator = typeof comparator == "function" ? comparator : undefined2;
          return array && array.length ? baseUniq(array, undefined2, comparator) : [];
        }
        function unzip(array) {
          if (!(array && array.length)) {
            return [];
          }
          var length = 0;
          array = arrayFilter(array, function(group) {
            if (isArrayLikeObject(group)) {
              length = nativeMax(group.length, length);
              return true;
            }
          });
          return baseTimes(length, function(index) {
            return arrayMap(array, baseProperty(index));
          });
        }
        function unzipWith(array, iteratee2) {
          if (!(array && array.length)) {
            return [];
          }
          var result2 = unzip(array);
          if (iteratee2 == null) {
            return result2;
          }
          return arrayMap(result2, function(group) {
            return apply(iteratee2, undefined2, group);
          });
        }
        var without = baseRest(function(array, values2) {
          return isArrayLikeObject(array) ? baseDifference(array, values2) : [];
        });
        var xor = baseRest(function(arrays) {
          return baseXor(arrayFilter(arrays, isArrayLikeObject));
        });
        var xorBy = baseRest(function(arrays) {
          var iteratee2 = last4(arrays);
          if (isArrayLikeObject(iteratee2)) {
            iteratee2 = undefined2;
          }
          return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee2, 2));
        });
        var xorWith = baseRest(function(arrays) {
          var comparator = last4(arrays);
          comparator = typeof comparator == "function" ? comparator : undefined2;
          return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined2, comparator);
        });
        var zip = baseRest(unzip);
        function zipObject(props, values2) {
          return baseZipObject(props || [], values2 || [], assignValue);
        }
        function zipObjectDeep(props, values2) {
          return baseZipObject(props || [], values2 || [], baseSet);
        }
        var zipWith = baseRest(function(arrays) {
          var length = arrays.length, iteratee2 = length > 1 ? arrays[length - 1] : undefined2;
          iteratee2 = typeof iteratee2 == "function" ? (arrays.pop(), iteratee2) : undefined2;
          return unzipWith(arrays, iteratee2);
        });
        function chain(value) {
          var result2 = lodash(value);
          result2.__chain__ = true;
          return result2;
        }
        function tap2(value, interceptor) {
          interceptor(value);
          return value;
        }
        function thru(value, interceptor) {
          return interceptor(value);
        }
        var wrapperAt = flatRest(function(paths) {
          var length = paths.length, start = length ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) {
            return baseAt(object, paths);
          };
          if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex(start)) {
            return this.thru(interceptor);
          }
          value = value.slice(start, +start + (length ? 1 : 0));
          value.__actions__.push({
            "func": thru,
            "args": [interceptor],
            "thisArg": undefined2
          });
          return new LodashWrapper(value, this.__chain__).thru(function(array) {
            if (length && !array.length) {
              array.push(undefined2);
            }
            return array;
          });
        });
        function wrapperChain() {
          return chain(this);
        }
        function wrapperCommit() {
          return new LodashWrapper(this.value(), this.__chain__);
        }
        function wrapperNext() {
          if (this.__values__ === undefined2) {
            this.__values__ = toArray(this.value());
          }
          var done = this.__index__ >= this.__values__.length, value = done ? undefined2 : this.__values__[this.__index__++];
          return { "done": done, "value": value };
        }
        function wrapperToIterator() {
          return this;
        }
        function wrapperPlant(value) {
          var result2, parent2 = this;
          while (parent2 instanceof baseLodash) {
            var clone2 = wrapperClone(parent2);
            clone2.__index__ = 0;
            clone2.__values__ = undefined2;
            if (result2) {
              previous.__wrapped__ = clone2;
            } else {
              result2 = clone2;
            }
            var previous = clone2;
            parent2 = parent2.__wrapped__;
          }
          previous.__wrapped__ = value;
          return result2;
        }
        function wrapperReverse() {
          var value = this.__wrapped__;
          if (value instanceof LazyWrapper) {
            var wrapped = value;
            if (this.__actions__.length) {
              wrapped = new LazyWrapper(this);
            }
            wrapped = wrapped.reverse();
            wrapped.__actions__.push({
              "func": thru,
              "args": [reverse],
              "thisArg": undefined2
            });
            return new LodashWrapper(wrapped, this.__chain__);
          }
          return this.thru(reverse);
        }
        function wrapperValue() {
          return baseWrapperValue(this.__wrapped__, this.__actions__);
        }
        var countBy = createAggregator(function(result2, value, key) {
          if (hasOwnProperty2.call(result2, key)) {
            ++result2[key];
          } else {
            baseAssignValue(result2, key, 1);
          }
        });
        function every(collection, predicate, guard) {
          var func = isArray3(collection) ? arrayEvery : baseEvery;
          if (guard && isIterateeCall(collection, predicate, guard)) {
            predicate = undefined2;
          }
          return func(collection, getIteratee(predicate, 3));
        }
        function filter2(collection, predicate) {
          var func = isArray3(collection) ? arrayFilter : baseFilter;
          return func(collection, getIteratee(predicate, 3));
        }
        var find = createFind(findIndex);
        var findLast = createFind(findLastIndex);
        function flatMap(collection, iteratee2) {
          return baseFlatten(map3(collection, iteratee2), 1);
        }
        function flatMapDeep(collection, iteratee2) {
          return baseFlatten(map3(collection, iteratee2), INFINITY);
        }
        function flatMapDepth(collection, iteratee2, depth) {
          depth = depth === undefined2 ? 1 : toInteger2(depth);
          return baseFlatten(map3(collection, iteratee2), depth);
        }
        function forEach(collection, iteratee2) {
          var func = isArray3(collection) ? arrayEach : baseEach;
          return func(collection, getIteratee(iteratee2, 3));
        }
        function forEachRight(collection, iteratee2) {
          var func = isArray3(collection) ? arrayEachRight : baseEachRight;
          return func(collection, getIteratee(iteratee2, 3));
        }
        var groupBy = createAggregator(function(result2, value, key) {
          if (hasOwnProperty2.call(result2, key)) {
            result2[key].push(value);
          } else {
            baseAssignValue(result2, key, [value]);
          }
        });
        function includes(collection, value, fromIndex, guard) {
          collection = isArrayLike2(collection) ? collection : values(collection);
          fromIndex = fromIndex && !guard ? toInteger2(fromIndex) : 0;
          var length = collection.length;
          if (fromIndex < 0) {
            fromIndex = nativeMax(length + fromIndex, 0);
          }
          return isString(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1;
        }
        var invokeMap = baseRest(function(collection, path, args) {
          var index = -1, isFunc = typeof path == "function", result2 = isArrayLike2(collection) ? Array2(collection.length) : [];
          baseEach(collection, function(value) {
            result2[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
          });
          return result2;
        });
        var keyBy = createAggregator(function(result2, value, key) {
          baseAssignValue(result2, key, value);
        });
        function map3(collection, iteratee2) {
          var func = isArray3(collection) ? arrayMap : baseMap;
          return func(collection, getIteratee(iteratee2, 3));
        }
        function orderBy(collection, iteratees, orders, guard) {
          if (collection == null) {
            return [];
          }
          if (!isArray3(iteratees)) {
            iteratees = iteratees == null ? [] : [iteratees];
          }
          orders = guard ? undefined2 : orders;
          if (!isArray3(orders)) {
            orders = orders == null ? [] : [orders];
          }
          return baseOrderBy(collection, iteratees, orders);
        }
        var partition = createAggregator(function(result2, value, key) {
          result2[key ? 0 : 1].push(value);
        }, function() {
          return [[], []];
        });
        function reduce(collection, iteratee2, accumulator) {
          var func = isArray3(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3;
          return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEach);
        }
        function reduceRight(collection, iteratee2, accumulator) {
          var func = isArray3(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3;
          return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEachRight);
        }
        function reject(collection, predicate) {
          var func = isArray3(collection) ? arrayFilter : baseFilter;
          return func(collection, negate(getIteratee(predicate, 3)));
        }
        function sample(collection) {
          var func = isArray3(collection) ? arraySample : baseSample;
          return func(collection);
        }
        function sampleSize(collection, n, guard) {
          if (guard ? isIterateeCall(collection, n, guard) : n === undefined2) {
            n = 1;
          } else {
            n = toInteger2(n);
          }
          var func = isArray3(collection) ? arraySampleSize : baseSampleSize;
          return func(collection, n);
        }
        function shuffle(collection) {
          var func = isArray3(collection) ? arrayShuffle : baseShuffle;
          return func(collection);
        }
        function size(collection) {
          if (collection == null) {
            return 0;
          }
          if (isArrayLike2(collection)) {
            return isString(collection) ? stringSize(collection) : collection.length;
          }
          var tag = getTag(collection);
          if (tag == mapTag || tag == setTag) {
            return collection.size;
          }
          return baseKeys(collection).length;
        }
        function some(collection, predicate, guard) {
          var func = isArray3(collection) ? arraySome : baseSome;
          if (guard && isIterateeCall(collection, predicate, guard)) {
            predicate = undefined2;
          }
          return func(collection, getIteratee(predicate, 3));
        }
        var sortBy = baseRest(function(collection, iteratees) {
          if (collection == null) {
            return [];
          }
          var length = iteratees.length;
          if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
            iteratees = [];
          } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
            iteratees = [iteratees[0]];
          }
          return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
        });
        var now = ctxNow || function() {
          return root.Date.now();
        };
        function after(n, func) {
          if (typeof func != "function") {
            throw new TypeError2(FUNC_ERROR_TEXT);
          }
          n = toInteger2(n);
          return function() {
            if (--n < 1) {
              return func.apply(this, arguments);
            }
          };
        }
        function ary(func, n, guard) {
          n = guard ? undefined2 : n;
          n = func && n == null ? func.length : n;
          return createWrap(func, WRAP_ARY_FLAG, undefined2, undefined2, undefined2, undefined2, n);
        }
        function before(n, func) {
          var result2;
          if (typeof func != "function") {
            throw new TypeError2(FUNC_ERROR_TEXT);
          }
          n = toInteger2(n);
          return function() {
            if (--n > 0) {
              result2 = func.apply(this, arguments);
            }
            if (n <= 1) {
              func = undefined2;
            }
            return result2;
          };
        }
        var bind2 = baseRest(function(func, thisArg, partials) {
          var bitmask = WRAP_BIND_FLAG;
          if (partials.length) {
            var holders = replaceHolders(partials, getHolder(bind2));
            bitmask |= WRAP_PARTIAL_FLAG;
          }
          return createWrap(func, bitmask, thisArg, partials, holders);
        });
        var bindKey = baseRest(function(object, key, partials) {
          var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
          if (partials.length) {
            var holders = replaceHolders(partials, getHolder(bindKey));
            bitmask |= WRAP_PARTIAL_FLAG;
          }
          return createWrap(key, bitmask, object, partials, holders);
        });
        function curry(func, arity, guard) {
          arity = guard ? undefined2 : arity;
          var result2 = createWrap(func, WRAP_CURRY_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity);
          result2.placeholder = curry.placeholder;
          return result2;
        }
        function curryRight(func, arity, guard) {
          arity = guard ? undefined2 : arity;
          var result2 = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity);
          result2.placeholder = curryRight.placeholder;
          return result2;
        }
        function debounce(func, wait, options) {
          var lastArgs, lastThis, maxWait, result2, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
          if (typeof func != "function") {
            throw new TypeError2(FUNC_ERROR_TEXT);
          }
          wait = toNumber(wait) || 0;
          if (isObject(options)) {
            leading = !!options.leading;
            maxing = "maxWait" in options;
            maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
            trailing = "trailing" in options ? !!options.trailing : trailing;
          }
          function invokeFunc(time) {
            var args = lastArgs, thisArg = lastThis;
            lastArgs = lastThis = undefined2;
            lastInvokeTime = time;
            result2 = func.apply(thisArg, args);
            return result2;
          }
          function leadingEdge(time) {
            lastInvokeTime = time;
            timerId = setTimeout2(timerExpired, wait);
            return leading ? invokeFunc(time) : result2;
          }
          function remainingWait(time) {
            var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
            return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
          }
          function shouldInvoke(time) {
            var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
            return lastCallTime === undefined2 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
          }
          function timerExpired() {
            var time = now();
            if (shouldInvoke(time)) {
              return trailingEdge(time);
            }
            timerId = setTimeout2(timerExpired, remainingWait(time));
          }
          function trailingEdge(time) {
            timerId = undefined2;
            if (trailing && lastArgs) {
              return invokeFunc(time);
            }
            lastArgs = lastThis = undefined2;
            return result2;
          }
          function cancel() {
            if (timerId !== undefined2) {
              clearTimeout2(timerId);
            }
            lastInvokeTime = 0;
            lastArgs = lastCallTime = lastThis = timerId = undefined2;
          }
          function flush() {
            return timerId === undefined2 ? result2 : trailingEdge(now());
          }
          function debounced() {
            var time = now(), isInvoking = shouldInvoke(time);
            lastArgs = arguments;
            lastThis = this;
            lastCallTime = time;
            if (isInvoking) {
              if (timerId === undefined2) {
                return leadingEdge(lastCallTime);
              }
              if (maxing) {
                clearTimeout2(timerId);
                timerId = setTimeout2(timerExpired, wait);
                return invokeFunc(lastCallTime);
              }
            }
            if (timerId === undefined2) {
              timerId = setTimeout2(timerExpired, wait);
            }
            return result2;
          }
          debounced.cancel = cancel;
          debounced.flush = flush;
          return debounced;
        }
        var defer2 = baseRest(function(func, args) {
          return baseDelay(func, 1, args);
        });
        var delay = baseRest(function(func, wait, args) {
          return baseDelay(func, toNumber(wait) || 0, args);
        });
        function flip(func) {
          return createWrap(func, WRAP_FLIP_FLAG);
        }
        function memoize(func, resolver) {
          if (typeof func != "function" || resolver != null && typeof resolver != "function") {
            throw new TypeError2(FUNC_ERROR_TEXT);
          }
          var memoized = function() {
            var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
            if (cache.has(key)) {
              return cache.get(key);
            }
            var result2 = func.apply(this, args);
            memoized.cache = cache.set(key, result2) || cache;
            return result2;
          };
          memoized.cache = new (memoize.Cache || MapCache)();
          return memoized;
        }
        memoize.Cache = MapCache;
        function negate(predicate) {
          if (typeof predicate != "function") {
            throw new TypeError2(FUNC_ERROR_TEXT);
          }
          return function() {
            var args = arguments;
            switch (args.length) {
              case 0:
                return !predicate.call(this);
              case 1:
                return !predicate.call(this, args[0]);
              case 2:
                return !predicate.call(this, args[0], args[1]);
              case 3:
                return !predicate.call(this, args[0], args[1], args[2]);
            }
            return !predicate.apply(this, args);
          };
        }
        function once(func) {
          return before(2, func);
        }
        var overArgs = castRest(function(func, transforms) {
          transforms = transforms.length == 1 && isArray3(transforms[0]) ? arrayMap(transforms[0], baseUnary(getIteratee())) : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
          var funcsLength = transforms.length;
          return baseRest(function(args) {
            var index = -1, length = nativeMin(args.length, funcsLength);
            while (++index < length) {
              args[index] = transforms[index].call(this, args[index]);
            }
            return apply(func, this, args);
          });
        });
        var partial = baseRest(function(func, partials) {
          var holders = replaceHolders(partials, getHolder(partial));
          return createWrap(func, WRAP_PARTIAL_FLAG, undefined2, partials, holders);
        });
        var partialRight = baseRest(function(func, partials) {
          var holders = replaceHolders(partials, getHolder(partialRight));
          return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined2, partials, holders);
        });
        var rearg = flatRest(function(func, indexes) {
          return createWrap(func, WRAP_REARG_FLAG, undefined2, undefined2, undefined2, indexes);
        });
        function rest(func, start) {
          if (typeof func != "function") {
            throw new TypeError2(FUNC_ERROR_TEXT);
          }
          start = start === undefined2 ? start : toInteger2(start);
          return baseRest(func, start);
        }
        function spread(func, start) {
          if (typeof func != "function") {
            throw new TypeError2(FUNC_ERROR_TEXT);
          }
          start = start == null ? 0 : nativeMax(toInteger2(start), 0);
          return baseRest(function(args) {
            var array = args[start], otherArgs = castSlice(args, 0, start);
            if (array) {
              arrayPush(otherArgs, array);
            }
            return apply(func, this, otherArgs);
          });
        }
        function throttle2(func, wait, options) {
          var leading = true, trailing = true;
          if (typeof func != "function") {
            throw new TypeError2(FUNC_ERROR_TEXT);
          }
          if (isObject(options)) {
            leading = "leading" in options ? !!options.leading : leading;
            trailing = "trailing" in options ? !!options.trailing : trailing;
          }
          return debounce(func, wait, {
            "leading": leading,
            "maxWait": wait,
            "trailing": trailing
          });
        }
        function unary(func) {
          return ary(func, 1);
        }
        function wrap(value, wrapper) {
          return partial(castFunction(wrapper), value);
        }
        function castArray() {
          if (!arguments.length) {
            return [];
          }
          var value = arguments[0];
          return isArray3(value) ? value : [value];
        }
        function clone(value) {
          return baseClone(value, CLONE_SYMBOLS_FLAG);
        }
        function cloneWith(value, customizer) {
          customizer = typeof customizer == "function" ? customizer : undefined2;
          return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
        }
        function cloneDeep(value) {
          return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
        }
        function cloneDeepWith(value, customizer) {
          customizer = typeof customizer == "function" ? customizer : undefined2;
          return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
        }
        function conformsTo(object, source) {
          return source == null || baseConformsTo(object, source, keys(source));
        }
        function eq(value, other) {
          return value === other || value !== value && other !== other;
        }
        var gt = createRelationalOperation(baseGt);
        var gte = createRelationalOperation(function(value, other) {
          return value >= other;
        });
        var isArguments = baseIsArguments(/* @__PURE__ */ function() {
          return arguments;
        }()) ? baseIsArguments : function(value) {
          return isObjectLike(value) && hasOwnProperty2.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
        };
        var isArray3 = Array2.isArray;
        var isArrayBuffer2 = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
        function isArrayLike2(value) {
          return value != null && isLength(value.length) && !isFunction3(value);
        }
        function isArrayLikeObject(value) {
          return isObjectLike(value) && isArrayLike2(value);
        }
        function isBoolean2(value) {
          return value === true || value === false || isObjectLike(value) && baseGetTag(value) == boolTag2;
        }
        var isBuffer = nativeIsBuffer || stubFalse;
        var isDate2 = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
        function isElement(value) {
          return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
        }
        function isEmpty(value) {
          if (value == null) {
            return true;
          }
          if (isArrayLike2(value) && (isArray3(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer(value) || isTypedArray(value) || isArguments(value))) {
            return !value.length;
          }
          var tag = getTag(value);
          if (tag == mapTag || tag == setTag) {
            return !value.size;
          }
          if (isPrototype(value)) {
            return !baseKeys(value).length;
          }
          for (var key in value) {
            if (hasOwnProperty2.call(value, key)) {
              return false;
            }
          }
          return true;
        }
        function isEqual(value, other) {
          return baseIsEqual(value, other);
        }
        function isEqualWith(value, other, customizer) {
          customizer = typeof customizer == "function" ? customizer : undefined2;
          var result2 = customizer ? customizer(value, other) : undefined2;
          return result2 === undefined2 ? baseIsEqual(value, other, undefined2, customizer) : !!result2;
        }
        function isError(value) {
          if (!isObjectLike(value)) {
            return false;
          }
          var tag = baseGetTag(value);
          return tag == errorTag || tag == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject(value);
        }
        function isFinite2(value) {
          return typeof value == "number" && nativeIsFinite(value);
        }
        function isFunction3(value) {
          if (!isObject(value)) {
            return false;
          }
          var tag = baseGetTag(value);
          return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
        }
        function isInteger(value) {
          return typeof value == "number" && value == toInteger2(value);
        }
        function isLength(value) {
          return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
        }
        function isObject(value) {
          var type = typeof value;
          return value != null && (type == "object" || type == "function");
        }
        function isObjectLike(value) {
          return value != null && typeof value == "object";
        }
        var isMap2 = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
        function isMatch(object, source) {
          return object === source || baseIsMatch(object, source, getMatchData(source));
        }
        function isMatchWith(object, source, customizer) {
          customizer = typeof customizer == "function" ? customizer : undefined2;
          return baseIsMatch(object, source, getMatchData(source), customizer);
        }
        function isNaN2(value) {
          return isNumber(value) && value != +value;
        }
        function isNative(value) {
          if (isMaskable(value)) {
            throw new Error2(CORE_ERROR_TEXT);
          }
          return baseIsNative(value);
        }
        function isNull(value) {
          return value === null;
        }
        function isNil(value) {
          return value == null;
        }
        function isNumber(value) {
          return typeof value == "number" || isObjectLike(value) && baseGetTag(value) == numberTag;
        }
        function isPlainObject(value) {
          if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
            return false;
          }
          var proto = getPrototype(value);
          if (proto === null) {
            return true;
          }
          var Ctor = hasOwnProperty2.call(proto, "constructor") && proto.constructor;
          return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
        }
        var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
        function isSafeInteger(value) {
          return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
        }
        var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
        function isString(value) {
          return typeof value == "string" || !isArray3(value) && isObjectLike(value) && baseGetTag(value) == stringTag;
        }
        function isSymbol(value) {
          return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
        }
        var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
        function isUndefined(value) {
          return value === undefined2;
        }
        function isWeakMap(value) {
          return isObjectLike(value) && getTag(value) == weakMapTag;
        }
        function isWeakSet(value) {
          return isObjectLike(value) && baseGetTag(value) == weakSetTag;
        }
        var lt = createRelationalOperation(baseLt);
        var lte2 = createRelationalOperation(function(value, other) {
          return value <= other;
        });
        function toArray(value) {
          if (!value) {
            return [];
          }
          if (isArrayLike2(value)) {
            return isString(value) ? stringToArray(value) : copyArray(value);
          }
          if (symIterator && value[symIterator]) {
            return iteratorToArray(value[symIterator]());
          }
          var tag = getTag(value), func = tag == mapTag ? mapToArray : tag == setTag ? setToArray : values;
          return func(value);
        }
        function toFinite(value) {
          if (!value) {
            return value === 0 ? value : 0;
          }
          value = toNumber(value);
          if (value === INFINITY || value === -INFINITY) {
            var sign = value < 0 ? -1 : 1;
            return sign * MAX_INTEGER;
          }
          return value === value ? value : 0;
        }
        function toInteger2(value) {
          var result2 = toFinite(value), remainder = result2 % 1;
          return result2 === result2 ? remainder ? result2 - remainder : result2 : 0;
        }
        function toLength(value) {
          return value ? baseClamp(toInteger2(value), 0, MAX_ARRAY_LENGTH) : 0;
        }
        function toNumber(value) {
          if (typeof value == "number") {
            return value;
          }
          if (isSymbol(value)) {
            return NAN;
          }
          if (isObject(value)) {
            var other = typeof value.valueOf == "function" ? value.valueOf() : value;
            value = isObject(other) ? other + "" : other;
          }
          if (typeof value != "string") {
            return value === 0 ? value : +value;
          }
          value = baseTrim(value);
          var isBinary = reIsBinary.test(value);
          return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
        }
        function toPlainObject(value) {
          return copyObject(value, keysIn(value));
        }
        function toSafeInteger(value) {
          return value ? baseClamp(toInteger2(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) : value === 0 ? value : 0;
        }
        function toString(value) {
          return value == null ? "" : baseToString(value);
        }
        var assign = createAssigner(function(object, source) {
          if (isPrototype(source) || isArrayLike2(source)) {
            copyObject(source, keys(source), object);
            return;
          }
          for (var key in source) {
            if (hasOwnProperty2.call(source, key)) {
              assignValue(object, key, source[key]);
            }
          }
        });
        var assignIn = createAssigner(function(object, source) {
          copyObject(source, keysIn(source), object);
        });
        var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
          copyObject(source, keysIn(source), object, customizer);
        });
        var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
          copyObject(source, keys(source), object, customizer);
        });
        var at = flatRest(baseAt);
        function create(prototype, properties) {
          var result2 = baseCreate(prototype);
          return properties == null ? result2 : baseAssign(result2, properties);
        }
        var defaults2 = baseRest(function(object, sources) {
          object = Object2(object);
          var index = -1;
          var length = sources.length;
          var guard = length > 2 ? sources[2] : undefined2;
          if (guard && isIterateeCall(sources[0], sources[1], guard)) {
            length = 1;
          }
          while (++index < length) {
            var source = sources[index];
            var props = keysIn(source);
            var propsIndex = -1;
            var propsLength = props.length;
            while (++propsIndex < propsLength) {
              var key = props[propsIndex];
              var value = object[key];
              if (value === undefined2 || eq(value, objectProto2[key]) && !hasOwnProperty2.call(object, key)) {
                object[key] = source[key];
              }
            }
          }
          return object;
        });
        var defaultsDeep = baseRest(function(args) {
          args.push(undefined2, customDefaultsMerge);
          return apply(mergeWith, undefined2, args);
        });
        function findKey(object, predicate) {
          return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
        }
        function findLastKey(object, predicate) {
          return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
        }
        function forIn(object, iteratee2) {
          return object == null ? object : baseFor(object, getIteratee(iteratee2, 3), keysIn);
        }
        function forInRight(object, iteratee2) {
          return object == null ? object : baseForRight(object, getIteratee(iteratee2, 3), keysIn);
        }
        function forOwn(object, iteratee2) {
          return object && baseForOwn(object, getIteratee(iteratee2, 3));
        }
        function forOwnRight(object, iteratee2) {
          return object && baseForOwnRight(object, getIteratee(iteratee2, 3));
        }
        function functions(object) {
          return object == null ? [] : baseFunctions(object, keys(object));
        }
        function functionsIn(object) {
          return object == null ? [] : baseFunctions(object, keysIn(object));
        }
        function get(object, path, defaultValue) {
          var result2 = object == null ? undefined2 : baseGet(object, path);
          return result2 === undefined2 ? defaultValue : result2;
        }
        function has(object, path) {
          return object != null && hasPath(object, path, baseHas);
        }
        function hasIn(object, path) {
          return object != null && hasPath(object, path, baseHasIn);
        }
        var invert = createInverter(function(result2, value, key) {
          if (value != null && typeof value.toString != "function") {
            value = nativeObjectToString.call(value);
          }
          result2[value] = key;
        }, constant(identity2));
        var invertBy = createInverter(function(result2, value, key) {
          if (value != null && typeof value.toString != "function") {
            value = nativeObjectToString.call(value);
          }
          if (hasOwnProperty2.call(result2, value)) {
            result2[value].push(key);
          } else {
            result2[value] = [key];
          }
        }, getIteratee);
        var invoke = baseRest(baseInvoke);
        function keys(object) {
          return isArrayLike2(object) ? arrayLikeKeys(object) : baseKeys(object);
        }
        function keysIn(object) {
          return isArrayLike2(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
        }
        function mapKeys(object, iteratee2) {
          var result2 = {};
          iteratee2 = getIteratee(iteratee2, 3);
          baseForOwn(object, function(value, key, object2) {
            baseAssignValue(result2, iteratee2(value, key, object2), value);
          });
          return result2;
        }
        function mapValues(object, iteratee2) {
          var result2 = {};
          iteratee2 = getIteratee(iteratee2, 3);
          baseForOwn(object, function(value, key, object2) {
            baseAssignValue(result2, key, iteratee2(value, key, object2));
          });
          return result2;
        }
        var merge4 = createAssigner(function(object, source, srcIndex) {
          baseMerge(object, source, srcIndex);
        });
        var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
          baseMerge(object, source, srcIndex, customizer);
        });
        var omit = flatRest(function(object, paths) {
          var result2 = {};
          if (object == null) {
            return result2;
          }
          var isDeep = false;
          paths = arrayMap(paths, function(path) {
            path = castPath(path, object);
            isDeep || (isDeep = path.length > 1);
            return path;
          });
          copyObject(object, getAllKeysIn(object), result2);
          if (isDeep) {
            result2 = baseClone(result2, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
          }
          var length = paths.length;
          while (length--) {
            baseUnset(result2, paths[length]);
          }
          return result2;
        });
        function omitBy(object, predicate) {
          return pickBy(object, negate(getIteratee(predicate)));
        }
        var pick = flatRest(function(object, paths) {
          return object == null ? {} : basePick(object, paths);
        });
        function pickBy(object, predicate) {
          if (object == null) {
            return {};
          }
          var props = arrayMap(getAllKeysIn(object), function(prop) {
            return [prop];
          });
          predicate = getIteratee(predicate);
          return basePickBy(object, props, function(value, path) {
            return predicate(value, path[0]);
          });
        }
        function result(object, path, defaultValue) {
          path = castPath(path, object);
          var index = -1, length = path.length;
          if (!length) {
            length = 1;
            object = undefined2;
          }
          while (++index < length) {
            var value = object == null ? undefined2 : object[toKey(path[index])];
            if (value === undefined2) {
              index = length;
              value = defaultValue;
            }
            object = isFunction3(value) ? value.call(object) : value;
          }
          return object;
        }
        function set2(object, path, value) {
          return object == null ? object : baseSet(object, path, value);
        }
        function setWith(object, path, value, customizer) {
          customizer = typeof customizer == "function" ? customizer : undefined2;
          return object == null ? object : baseSet(object, path, value, customizer);
        }
        var toPairs = createToPairs(keys);
        var toPairsIn = createToPairs(keysIn);
        function transform(object, iteratee2, accumulator) {
          var isArr = isArray3(object), isArrLike = isArr || isBuffer(object) || isTypedArray(object);
          iteratee2 = getIteratee(iteratee2, 4);
          if (accumulator == null) {
            var Ctor = object && object.constructor;
            if (isArrLike) {
              accumulator = isArr ? new Ctor() : [];
            } else if (isObject(object)) {
              accumulator = isFunction3(Ctor) ? baseCreate(getPrototype(object)) : {};
            } else {
              accumulator = {};
            }
          }
          (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object2) {
            return iteratee2(accumulator, value, index, object2);
          });
          return accumulator;
        }
        function unset(object, path) {
          return object == null ? true : baseUnset(object, path);
        }
        function update(object, path, updater) {
          return object == null ? object : baseUpdate(object, path, castFunction(updater));
        }
        function updateWith(object, path, updater, customizer) {
          customizer = typeof customizer == "function" ? customizer : undefined2;
          return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
        }
        function values(object) {
          return object == null ? [] : baseValues(object, keys(object));
        }
        function valuesIn(object) {
          return object == null ? [] : baseValues(object, keysIn(object));
        }
        function clamp(number, lower, upper) {
          if (upper === undefined2) {
            upper = lower;
            lower = undefined2;
          }
          if (upper !== undefined2) {
            upper = toNumber(upper);
            upper = upper === upper ? upper : 0;
          }
          if (lower !== undefined2) {
            lower = toNumber(lower);
            lower = lower === lower ? lower : 0;
          }
          return baseClamp(toNumber(number), lower, upper);
        }
        function inRange(number, start, end) {
          start = toFinite(start);
          if (end === undefined2) {
            end = start;
            start = 0;
          } else {
            end = toFinite(end);
          }
          number = toNumber(number);
          return baseInRange(number, start, end);
        }
        function random(lower, upper, floating) {
          if (floating && typeof floating != "boolean" && isIterateeCall(lower, upper, floating)) {
            upper = floating = undefined2;
          }
          if (floating === undefined2) {
            if (typeof upper == "boolean") {
              floating = upper;
              upper = undefined2;
            } else if (typeof lower == "boolean") {
              floating = lower;
              lower = undefined2;
            }
          }
          if (lower === undefined2 && upper === undefined2) {
            lower = 0;
            upper = 1;
          } else {
            lower = toFinite(lower);
            if (upper === undefined2) {
              upper = lower;
              lower = 0;
            } else {
              upper = toFinite(upper);
            }
          }
          if (lower > upper) {
            var temp = lower;
            lower = upper;
            upper = temp;
          }
          if (floating || lower % 1 || upper % 1) {
            var rand = nativeRandom();
            return nativeMin(lower + rand * (upper - lower + freeParseFloat("1e-" + ((rand + "").length - 1))), upper);
          }
          return baseRandom(lower, upper);
        }
        var camelCase = createCompounder(function(result2, word, index) {
          word = word.toLowerCase();
          return result2 + (index ? capitalize(word) : word);
        });
        function capitalize(string2) {
          return upperFirst(toString(string2).toLowerCase());
        }
        function deburr(string2) {
          string2 = toString(string2);
          return string2 && string2.replace(reLatin, deburrLetter).replace(reComboMark, "");
        }
        function endsWith(string2, target, position) {
          string2 = toString(string2);
          target = baseToString(target);
          var length = string2.length;
          position = position === undefined2 ? length : baseClamp(toInteger2(position), 0, length);
          var end = position;
          position -= target.length;
          return position >= 0 && string2.slice(position, end) == target;
        }
        function escape2(string2) {
          string2 = toString(string2);
          return string2 && reHasUnescapedHtml.test(string2) ? string2.replace(reUnescapedHtml, escapeHtmlChar) : string2;
        }
        function escapeRegExp(string2) {
          string2 = toString(string2);
          return string2 && reHasRegExpChar.test(string2) ? string2.replace(reRegExpChar, "\\$&") : string2;
        }
        var kebabCase = createCompounder(function(result2, word, index) {
          return result2 + (index ? "-" : "") + word.toLowerCase();
        });
        var lowerCase = createCompounder(function(result2, word, index) {
          return result2 + (index ? " " : "") + word.toLowerCase();
        });
        var lowerFirst = createCaseFirst("toLowerCase");
        function pad(string2, length, chars) {
          string2 = toString(string2);
          length = toInteger2(length);
          var strLength = length ? stringSize(string2) : 0;
          if (!length || strLength >= length) {
            return string2;
          }
          var mid = (length - strLength) / 2;
          return createPadding(nativeFloor(mid), chars) + string2 + createPadding(nativeCeil(mid), chars);
        }
        function padEnd(string2, length, chars) {
          string2 = toString(string2);
          length = toInteger2(length);
          var strLength = length ? stringSize(string2) : 0;
          return length && strLength < length ? string2 + createPadding(length - strLength, chars) : string2;
        }
        function padStart(string2, length, chars) {
          string2 = toString(string2);
          length = toInteger2(length);
          var strLength = length ? stringSize(string2) : 0;
          return length && strLength < length ? createPadding(length - strLength, chars) + string2 : string2;
        }
        function parseInt2(string2, radix, guard) {
          if (guard || radix == null) {
            radix = 0;
          } else if (radix) {
            radix = +radix;
          }
          return nativeParseInt(toString(string2).replace(reTrimStart, ""), radix || 0);
        }
        function repeat(string2, n, guard) {
          if (guard ? isIterateeCall(string2, n, guard) : n === undefined2) {
            n = 1;
          } else {
            n = toInteger2(n);
          }
          return baseRepeat(toString(string2), n);
        }
        function replace() {
          var args = arguments, string2 = toString(args[0]);
          return args.length < 3 ? string2 : string2.replace(args[1], args[2]);
        }
        var snakeCase = createCompounder(function(result2, word, index) {
          return result2 + (index ? "_" : "") + word.toLowerCase();
        });
        function split2(string2, separator, limit) {
          if (limit && typeof limit != "number" && isIterateeCall(string2, separator, limit)) {
            separator = limit = undefined2;
          }
          limit = limit === undefined2 ? MAX_ARRAY_LENGTH : limit >>> 0;
          if (!limit) {
            return [];
          }
          string2 = toString(string2);
          if (string2 && (typeof separator == "string" || separator != null && !isRegExp(separator))) {
            separator = baseToString(separator);
            if (!separator && hasUnicode(string2)) {
              return castSlice(stringToArray(string2), 0, limit);
            }
          }
          return string2.split(separator, limit);
        }
        var startCase = createCompounder(function(result2, word, index) {
          return result2 + (index ? " " : "") + upperFirst(word);
        });
        function startsWith(string2, target, position) {
          string2 = toString(string2);
          position = position == null ? 0 : baseClamp(toInteger2(position), 0, string2.length);
          target = baseToString(target);
          return string2.slice(position, position + target.length) == target;
        }
        function template(string2, options, guard) {
          var settings = lodash.templateSettings;
          if (guard && isIterateeCall(string2, options, guard)) {
            options = undefined2;
          }
          string2 = toString(string2);
          options = assignInWith({}, options, settings, customDefaultsAssignIn);
          var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys);
          var isEscaping, isEvaluating, index = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '";
          var reDelimiters = RegExp2(
            (options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$",
            "g"
          );
          var sourceURL = "//# sourceURL=" + (hasOwnProperty2.call(options, "sourceURL") ? (options.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n";
          string2.replace(reDelimiters, function(match2, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
            interpolateValue || (interpolateValue = esTemplateValue);
            source += string2.slice(index, offset).replace(reUnescapedString, escapeStringChar);
            if (escapeValue) {
              isEscaping = true;
              source += "' +\n__e(" + escapeValue + ") +\n'";
            }
            if (evaluateValue) {
              isEvaluating = true;
              source += "';\n" + evaluateValue + ";\n__p += '";
            }
            if (interpolateValue) {
              source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
            }
            index = offset + match2.length;
            return match2;
          });
          source += "';\n";
          var variable = hasOwnProperty2.call(options, "variable") && options.variable;
          if (!variable) {
            source = "with (obj) {\n" + source + "\n}\n";
          } else if (reForbiddenIdentifierChars.test(variable)) {
            throw new Error2(INVALID_TEMPL_VAR_ERROR_TEXT);
          }
          source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;");
          source = "function(" + (variable || "obj") + ") {\n" + (variable ? "" : "obj || (obj = {});\n") + "var __t, __p = ''" + (isEscaping ? ", __e = _.escape" : "") + (isEvaluating ? ", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n" : ";\n") + source + "return __p\n}";
          var result2 = attempt(function() {
            return Function2(importsKeys, sourceURL + "return " + source).apply(undefined2, importsValues);
          });
          result2.source = source;
          if (isError(result2)) {
            throw result2;
          }
          return result2;
        }
        function toLower(value) {
          return toString(value).toLowerCase();
        }
        function toUpper(value) {
          return toString(value).toUpperCase();
        }
        function trim(string2, chars, guard) {
          string2 = toString(string2);
          if (string2 && (guard || chars === undefined2)) {
            return baseTrim(string2);
          }
          if (!string2 || !(chars = baseToString(chars))) {
            return string2;
          }
          var strSymbols = stringToArray(string2), chrSymbols = stringToArray(chars), start = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1;
          return castSlice(strSymbols, start, end).join("");
        }
        function trimEnd(string2, chars, guard) {
          string2 = toString(string2);
          if (string2 && (guard || chars === undefined2)) {
            return string2.slice(0, trimmedEndIndex(string2) + 1);
          }
          if (!string2 || !(chars = baseToString(chars))) {
            return string2;
          }
          var strSymbols = stringToArray(string2), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
          return castSlice(strSymbols, 0, end).join("");
        }
        function trimStart(string2, chars, guard) {
          string2 = toString(string2);
          if (string2 && (guard || chars === undefined2)) {
            return string2.replace(reTrimStart, "");
          }
          if (!string2 || !(chars = baseToString(chars))) {
            return string2;
          }
          var strSymbols = stringToArray(string2), start = charsStartIndex(strSymbols, stringToArray(chars));
          return castSlice(strSymbols, start).join("");
        }
        function truncate(string2, options) {
          var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION;
          if (isObject(options)) {
            var separator = "separator" in options ? options.separator : separator;
            length = "length" in options ? toInteger2(options.length) : length;
            omission = "omission" in options ? baseToString(options.omission) : omission;
          }
          string2 = toString(string2);
          var strLength = string2.length;
          if (hasUnicode(string2)) {
            var strSymbols = stringToArray(string2);
            strLength = strSymbols.length;
          }
          if (length >= strLength) {
            return string2;
          }
          var end = length - stringSize(omission);
          if (end < 1) {
            return omission;
          }
          var result2 = strSymbols ? castSlice(strSymbols, 0, end).join("") : string2.slice(0, end);
          if (separator === undefined2) {
            return result2 + omission;
          }
          if (strSymbols) {
            end += result2.length - end;
          }
          if (isRegExp(separator)) {
            if (string2.slice(end).search(separator)) {
              var match2, substring = result2;
              if (!separator.global) {
                separator = RegExp2(separator.source, toString(reFlags.exec(separator)) + "g");
              }
              separator.lastIndex = 0;
              while (match2 = separator.exec(substring)) {
                var newEnd = match2.index;
              }
              result2 = result2.slice(0, newEnd === undefined2 ? end : newEnd);
            }
          } else if (string2.indexOf(baseToString(separator), end) != end) {
            var index = result2.lastIndexOf(separator);
            if (index > -1) {
              result2 = result2.slice(0, index);
            }
          }
          return result2 + omission;
        }
        function unescape(string2) {
          string2 = toString(string2);
          return string2 && reHasEscapedHtml.test(string2) ? string2.replace(reEscapedHtml, unescapeHtmlChar) : string2;
        }
        var upperCase = createCompounder(function(result2, word, index) {
          return result2 + (index ? " " : "") + word.toUpperCase();
        });
        var upperFirst = createCaseFirst("toUpperCase");
        function words(string2, pattern, guard) {
          string2 = toString(string2);
          pattern = guard ? undefined2 : pattern;
          if (pattern === undefined2) {
            return hasUnicodeWord(string2) ? unicodeWords(string2) : asciiWords(string2);
          }
          return string2.match(pattern) || [];
        }
        var attempt = baseRest(function(func, args) {
          try {
            return apply(func, undefined2, args);
          } catch (e) {
            return isError(e) ? e : new Error2(e);
          }
        });
        var bindAll = flatRest(function(object, methodNames) {
          arrayEach(methodNames, function(key) {
            key = toKey(key);
            baseAssignValue(object, key, bind2(object[key], object));
          });
          return object;
        });
        function cond(pairs2) {
          var length = pairs2 == null ? 0 : pairs2.length, toIteratee = getIteratee();
          pairs2 = !length ? [] : arrayMap(pairs2, function(pair) {
            if (typeof pair[1] != "function") {
              throw new TypeError2(FUNC_ERROR_TEXT);
            }
            return [toIteratee(pair[0]), pair[1]];
          });
          return baseRest(function(args) {
            var index = -1;
            while (++index < length) {
              var pair = pairs2[index];
              if (apply(pair[0], this, args)) {
                return apply(pair[1], this, args);
              }
            }
          });
        }
        function conforms(source) {
          return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
        }
        function constant(value) {
          return function() {
            return value;
          };
        }
        function defaultTo(value, defaultValue) {
          return value == null || value !== value ? defaultValue : value;
        }
        var flow = createFlow();
        var flowRight = createFlow(true);
        function identity2(value) {
          return value;
        }
        function iteratee(func) {
          return baseIteratee(typeof func == "function" ? func : baseClone(func, CLONE_DEEP_FLAG));
        }
        function matches(source) {
          return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
        }
        function matchesProperty(path, srcValue) {
          return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
        }
        var method = baseRest(function(path, args) {
          return function(object) {
            return baseInvoke(object, path, args);
          };
        });
        var methodOf = baseRest(function(object, args) {
          return function(path) {
            return baseInvoke(object, path, args);
          };
        });
        function mixin(object, source, options) {
          var props = keys(source), methodNames = baseFunctions(source, props);
          if (options == null && !(isObject(source) && (methodNames.length || !props.length))) {
            options = source;
            source = object;
            object = this;
            methodNames = baseFunctions(source, keys(source));
          }
          var chain2 = !(isObject(options) && "chain" in options) || !!options.chain, isFunc = isFunction3(object);
          arrayEach(methodNames, function(methodName) {
            var func = source[methodName];
            object[methodName] = func;
            if (isFunc) {
              object.prototype[methodName] = function() {
                var chainAll = this.__chain__;
                if (chain2 || chainAll) {
                  var result2 = object(this.__wrapped__), actions = result2.__actions__ = copyArray(this.__actions__);
                  actions.push({ "func": func, "args": arguments, "thisArg": object });
                  result2.__chain__ = chainAll;
                  return result2;
                }
                return func.apply(object, arrayPush([this.value()], arguments));
              };
            }
          });
          return object;
        }
        function noConflict() {
          if (root._ === this) {
            root._ = oldDash;
          }
          return this;
        }
        function noop4() {
        }
        function nthArg(n) {
          n = toInteger2(n);
          return baseRest(function(args) {
            return baseNth(args, n);
          });
        }
        var over = createOver(arrayMap);
        var overEvery = createOver(arrayEvery);
        var overSome = createOver(arraySome);
        function property(path) {
          return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
        }
        function propertyOf(object) {
          return function(path) {
            return object == null ? undefined2 : baseGet(object, path);
          };
        }
        var range = createRange();
        var rangeRight = createRange(true);
        function stubArray() {
          return [];
        }
        function stubFalse() {
          return false;
        }
        function stubObject() {
          return {};
        }
        function stubString() {
          return "";
        }
        function stubTrue() {
          return true;
        }
        function times(n, iteratee2) {
          n = toInteger2(n);
          if (n < 1 || n > MAX_SAFE_INTEGER) {
            return [];
          }
          var index = MAX_ARRAY_LENGTH, length = nativeMin(n, MAX_ARRAY_LENGTH);
          iteratee2 = getIteratee(iteratee2);
          n -= MAX_ARRAY_LENGTH;
          var result2 = baseTimes(length, iteratee2);
          while (++index < n) {
            iteratee2(index);
          }
          return result2;
        }
        function toPath(value) {
          if (isArray3(value)) {
            return arrayMap(value, toKey);
          }
          return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
        }
        function uniqueId(prefix) {
          var id = ++idCounter;
          return toString(prefix) + id;
        }
        var add = createMathOperation(function(augend, addend) {
          return augend + addend;
        }, 0);
        var ceil = createRound("ceil");
        var divide = createMathOperation(function(dividend, divisor) {
          return dividend / divisor;
        }, 1);
        var floor = createRound("floor");
        function max(array) {
          return array && array.length ? baseExtremum(array, identity2, baseGt) : undefined2;
        }
        function maxBy(array, iteratee2) {
          return array && array.length ? baseExtremum(array, getIteratee(iteratee2, 2), baseGt) : undefined2;
        }
        function mean(array) {
          return baseMean(array, identity2);
        }
        function meanBy(array, iteratee2) {
          return baseMean(array, getIteratee(iteratee2, 2));
        }
        function min(array) {
          return array && array.length ? baseExtremum(array, identity2, baseLt) : undefined2;
        }
        function minBy(array, iteratee2) {
          return array && array.length ? baseExtremum(array, getIteratee(iteratee2, 2), baseLt) : undefined2;
        }
        var multiply = createMathOperation(function(multiplier, multiplicand) {
          return multiplier * multiplicand;
        }, 1);
        var round2 = createRound("round");
        var subtract = createMathOperation(function(minuend, subtrahend) {
          return minuend - subtrahend;
        }, 0);
        function sum(array) {
          return array && array.length ? baseSum(array, identity2) : 0;
        }
        function sumBy(array, iteratee2) {
          return array && array.length ? baseSum(array, getIteratee(iteratee2, 2)) : 0;
        }
        lodash.after = after;
        lodash.ary = ary;
        lodash.assign = assign;
        lodash.assignIn = assignIn;
        lodash.assignInWith = assignInWith;
        lodash.assignWith = assignWith;
        lodash.at = at;
        lodash.before = before;
        lodash.bind = bind2;
        lodash.bindAll = bindAll;
        lodash.bindKey = bindKey;
        lodash.castArray = castArray;
        lodash.chain = chain;
        lodash.chunk = chunk;
        lodash.compact = compact;
        lodash.concat = concat2;
        lodash.cond = cond;
        lodash.conforms = conforms;
        lodash.constant = constant;
        lodash.countBy = countBy;
        lodash.create = create;
        lodash.curry = curry;
        lodash.curryRight = curryRight;
        lodash.debounce = debounce;
        lodash.defaults = defaults2;
        lodash.defaultsDeep = defaultsDeep;
        lodash.defer = defer2;
        lodash.delay = delay;
        lodash.difference = difference;
        lodash.differenceBy = differenceBy;
        lodash.differenceWith = differenceWith;
        lodash.drop = drop;
        lodash.dropRight = dropRight;
        lodash.dropRightWhile = dropRightWhile;
        lodash.dropWhile = dropWhile;
        lodash.fill = fill;
        lodash.filter = filter2;
        lodash.flatMap = flatMap;
        lodash.flatMapDeep = flatMapDeep;
        lodash.flatMapDepth = flatMapDepth;
        lodash.flatten = flatten2;
        lodash.flattenDeep = flattenDeep;
        lodash.flattenDepth = flattenDepth;
        lodash.flip = flip;
        lodash.flow = flow;
        lodash.flowRight = flowRight;
        lodash.fromPairs = fromPairs;
        lodash.functions = functions;
        lodash.functionsIn = functionsIn;
        lodash.groupBy = groupBy;
        lodash.initial = initial;
        lodash.intersection = intersection;
        lodash.intersectionBy = intersectionBy;
        lodash.intersectionWith = intersectionWith;
        lodash.invert = invert;
        lodash.invertBy = invertBy;
        lodash.invokeMap = invokeMap;
        lodash.iteratee = iteratee;
        lodash.keyBy = keyBy;
        lodash.keys = keys;
        lodash.keysIn = keysIn;
        lodash.map = map3;
        lodash.mapKeys = mapKeys;
        lodash.mapValues = mapValues;
        lodash.matches = matches;
        lodash.matchesProperty = matchesProperty;
        lodash.memoize = memoize;
        lodash.merge = merge4;
        lodash.mergeWith = mergeWith;
        lodash.method = method;
        lodash.methodOf = methodOf;
        lodash.mixin = mixin;
        lodash.negate = negate;
        lodash.nthArg = nthArg;
        lodash.omit = omit;
        lodash.omitBy = omitBy;
        lodash.once = once;
        lodash.orderBy = orderBy;
        lodash.over = over;
        lodash.overArgs = overArgs;
        lodash.overEvery = overEvery;
        lodash.overSome = overSome;
        lodash.partial = partial;
        lodash.partialRight = partialRight;
        lodash.partition = partition;
        lodash.pick = pick;
        lodash.pickBy = pickBy;
        lodash.property = property;
        lodash.propertyOf = propertyOf;
        lodash.pull = pull;
        lodash.pullAll = pullAll;
        lodash.pullAllBy = pullAllBy;
        lodash.pullAllWith = pullAllWith;
        lodash.pullAt = pullAt;
        lodash.range = range;
        lodash.rangeRight = rangeRight;
        lodash.rearg = rearg;
        lodash.reject = reject;
        lodash.remove = remove2;
        lodash.rest = rest;
        lodash.reverse = reverse;
        lodash.sampleSize = sampleSize;
        lodash.set = set2;
        lodash.setWith = setWith;
        lodash.shuffle = shuffle;
        lodash.slice = slice;
        lodash.sortBy = sortBy;
        lodash.sortedUniq = sortedUniq;
        lodash.sortedUniqBy = sortedUniqBy;
        lodash.split = split2;
        lodash.spread = spread;
        lodash.tail = tail;
        lodash.take = take2;
        lodash.takeRight = takeRight;
        lodash.takeRightWhile = takeRightWhile;
        lodash.takeWhile = takeWhile2;
        lodash.tap = tap2;
        lodash.throttle = throttle2;
        lodash.thru = thru;
        lodash.toArray = toArray;
        lodash.toPairs = toPairs;
        lodash.toPairsIn = toPairsIn;
        lodash.toPath = toPath;
        lodash.toPlainObject = toPlainObject;
        lodash.transform = transform;
        lodash.unary = unary;
        lodash.union = union;
        lodash.unionBy = unionBy;
        lodash.unionWith = unionWith;
        lodash.uniq = uniq;
        lodash.uniqBy = uniqBy;
        lodash.uniqWith = uniqWith;
        lodash.unset = unset;
        lodash.unzip = unzip;
        lodash.unzipWith = unzipWith;
        lodash.update = update;
        lodash.updateWith = updateWith;
        lodash.values = values;
        lodash.valuesIn = valuesIn;
        lodash.without = without;
        lodash.words = words;
        lodash.wrap = wrap;
        lodash.xor = xor;
        lodash.xorBy = xorBy;
        lodash.xorWith = xorWith;
        lodash.zip = zip;
        lodash.zipObject = zipObject;
        lodash.zipObjectDeep = zipObjectDeep;
        lodash.zipWith = zipWith;
        lodash.entries = toPairs;
        lodash.entriesIn = toPairsIn;
        lodash.extend = assignIn;
        lodash.extendWith = assignInWith;
        mixin(lodash, lodash);
        lodash.add = add;
        lodash.attempt = attempt;
        lodash.camelCase = camelCase;
        lodash.capitalize = capitalize;
        lodash.ceil = ceil;
        lodash.clamp = clamp;
        lodash.clone = clone;
        lodash.cloneDeep = cloneDeep;
        lodash.cloneDeepWith = cloneDeepWith;
        lodash.cloneWith = cloneWith;
        lodash.conformsTo = conformsTo;
        lodash.deburr = deburr;
        lodash.defaultTo = defaultTo;
        lodash.divide = divide;
        lodash.endsWith = endsWith;
        lodash.eq = eq;
        lodash.escape = escape2;
        lodash.escapeRegExp = escapeRegExp;
        lodash.every = every;
        lodash.find = find;
        lodash.findIndex = findIndex;
        lodash.findKey = findKey;
        lodash.findLast = findLast;
        lodash.findLastIndex = findLastIndex;
        lodash.findLastKey = findLastKey;
        lodash.floor = floor;
        lodash.forEach = forEach;
        lodash.forEachRight = forEachRight;
        lodash.forIn = forIn;
        lodash.forInRight = forInRight;
        lodash.forOwn = forOwn;
        lodash.forOwnRight = forOwnRight;
        lodash.get = get;
        lodash.gt = gt;
        lodash.gte = gte;
        lodash.has = has;
        lodash.hasIn = hasIn;
        lodash.head = head;
        lodash.identity = identity2;
        lodash.includes = includes;
        lodash.indexOf = indexOf2;
        lodash.inRange = inRange;
        lodash.invoke = invoke;
        lodash.isArguments = isArguments;
        lodash.isArray = isArray3;
        lodash.isArrayBuffer = isArrayBuffer2;
        lodash.isArrayLike = isArrayLike2;
        lodash.isArrayLikeObject = isArrayLikeObject;
        lodash.isBoolean = isBoolean2;
        lodash.isBuffer = isBuffer;
        lodash.isDate = isDate2;
        lodash.isElement = isElement;
        lodash.isEmpty = isEmpty;
        lodash.isEqual = isEqual;
        lodash.isEqualWith = isEqualWith;
        lodash.isError = isError;
        lodash.isFinite = isFinite2;
        lodash.isFunction = isFunction3;
        lodash.isInteger = isInteger;
        lodash.isLength = isLength;
        lodash.isMap = isMap2;
        lodash.isMatch = isMatch;
        lodash.isMatchWith = isMatchWith;
        lodash.isNaN = isNaN2;
        lodash.isNative = isNative;
        lodash.isNil = isNil;
        lodash.isNull = isNull;
        lodash.isNumber = isNumber;
        lodash.isObject = isObject;
        lodash.isObjectLike = isObjectLike;
        lodash.isPlainObject = isPlainObject;
        lodash.isRegExp = isRegExp;
        lodash.isSafeInteger = isSafeInteger;
        lodash.isSet = isSet;
        lodash.isString = isString;
        lodash.isSymbol = isSymbol;
        lodash.isTypedArray = isTypedArray;
        lodash.isUndefined = isUndefined;
        lodash.isWeakMap = isWeakMap;
        lodash.isWeakSet = isWeakSet;
        lodash.join = join;
        lodash.kebabCase = kebabCase;
        lodash.last = last4;
        lodash.lastIndexOf = lastIndexOf;
        lodash.lowerCase = lowerCase;
        lodash.lowerFirst = lowerFirst;
        lodash.lt = lt;
        lodash.lte = lte2;
        lodash.max = max;
        lodash.maxBy = maxBy;
        lodash.mean = mean;
        lodash.meanBy = meanBy;
        lodash.min = min;
        lodash.minBy = minBy;
        lodash.stubArray = stubArray;
        lodash.stubFalse = stubFalse;
        lodash.stubObject = stubObject;
        lodash.stubString = stubString;
        lodash.stubTrue = stubTrue;
        lodash.multiply = multiply;
        lodash.nth = nth;
        lodash.noConflict = noConflict;
        lodash.noop = noop4;
        lodash.now = now;
        lodash.pad = pad;
        lodash.padEnd = padEnd;
        lodash.padStart = padStart;
        lodash.parseInt = parseInt2;
        lodash.random = random;
        lodash.reduce = reduce;
        lodash.reduceRight = reduceRight;
        lodash.repeat = repeat;
        lodash.replace = replace;
        lodash.result = result;
        lodash.round = round2;
        lodash.runInContext = runInContext2;
        lodash.sample = sample;
        lodash.size = size;
        lodash.snakeCase = snakeCase;
        lodash.some = some;
        lodash.sortedIndex = sortedIndex;
        lodash.sortedIndexBy = sortedIndexBy;
        lodash.sortedIndexOf = sortedIndexOf;
        lodash.sortedLastIndex = sortedLastIndex;
        lodash.sortedLastIndexBy = sortedLastIndexBy;
        lodash.sortedLastIndexOf = sortedLastIndexOf;
        lodash.startCase = startCase;
        lodash.startsWith = startsWith;
        lodash.subtract = subtract;
        lodash.sum = sum;
        lodash.sumBy = sumBy;
        lodash.template = template;
        lodash.times = times;
        lodash.toFinite = toFinite;
        lodash.toInteger = toInteger2;
        lodash.toLength = toLength;
        lodash.toLower = toLower;
        lodash.toNumber = toNumber;
        lodash.toSafeInteger = toSafeInteger;
        lodash.toString = toString;
        lodash.toUpper = toUpper;
        lodash.trim = trim;
        lodash.trimEnd = trimEnd;
        lodash.trimStart = trimStart;
        lodash.truncate = truncate;
        lodash.unescape = unescape;
        lodash.uniqueId = uniqueId;
        lodash.upperCase = upperCase;
        lodash.upperFirst = upperFirst;
        lodash.each = forEach;
        lodash.eachRight = forEachRight;
        lodash.first = head;
        mixin(lodash, function() {
          var source = {};
          baseForOwn(lodash, function(func, methodName) {
            if (!hasOwnProperty2.call(lodash.prototype, methodName)) {
              source[methodName] = func;
            }
          });
          return source;
        }(), { "chain": false });
        lodash.VERSION = VERSION6;
        arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) {
          lodash[methodName].placeholder = lodash;
        });
        arrayEach(["drop", "take"], function(methodName, index) {
          LazyWrapper.prototype[methodName] = function(n) {
            n = n === undefined2 ? 1 : nativeMax(toInteger2(n), 0);
            var result2 = this.__filtered__ && !index ? new LazyWrapper(this) : this.clone();
            if (result2.__filtered__) {
              result2.__takeCount__ = nativeMin(n, result2.__takeCount__);
            } else {
              result2.__views__.push({
                "size": nativeMin(n, MAX_ARRAY_LENGTH),
                "type": methodName + (result2.__dir__ < 0 ? "Right" : "")
              });
            }
            return result2;
          };
          LazyWrapper.prototype[methodName + "Right"] = function(n) {
            return this.reverse()[methodName](n).reverse();
          };
        });
        arrayEach(["filter", "map", "takeWhile"], function(methodName, index) {
          var type = index + 1, isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
          LazyWrapper.prototype[methodName] = function(iteratee2) {
            var result2 = this.clone();
            result2.__iteratees__.push({
              "iteratee": getIteratee(iteratee2, 3),
              "type": type
            });
            result2.__filtered__ = result2.__filtered__ || isFilter;
            return result2;
          };
        });
        arrayEach(["head", "last"], function(methodName, index) {
          var takeName = "take" + (index ? "Right" : "");
          LazyWrapper.prototype[methodName] = function() {
            return this[takeName](1).value()[0];
          };
        });
        arrayEach(["initial", "tail"], function(methodName, index) {
          var dropName = "drop" + (index ? "" : "Right");
          LazyWrapper.prototype[methodName] = function() {
            return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
          };
        });
        LazyWrapper.prototype.compact = function() {
          return this.filter(identity2);
        };
        LazyWrapper.prototype.find = function(predicate) {
          return this.filter(predicate).head();
        };
        LazyWrapper.prototype.findLast = function(predicate) {
          return this.reverse().find(predicate);
        };
        LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
          if (typeof path == "function") {
            return new LazyWrapper(this);
          }
          return this.map(function(value) {
            return baseInvoke(value, path, args);
          });
        });
        LazyWrapper.prototype.reject = function(predicate) {
          return this.filter(negate(getIteratee(predicate)));
        };
        LazyWrapper.prototype.slice = function(start, end) {
          start = toInteger2(start);
          var result2 = this;
          if (result2.__filtered__ && (start > 0 || end < 0)) {
            return new LazyWrapper(result2);
          }
          if (start < 0) {
            result2 = result2.takeRight(-start);
          } else if (start) {
            result2 = result2.drop(start);
          }
          if (end !== undefined2) {
            end = toInteger2(end);
            result2 = end < 0 ? result2.dropRight(-end) : result2.take(end - start);
          }
          return result2;
        };
        LazyWrapper.prototype.takeRightWhile = function(predicate) {
          return this.reverse().takeWhile(predicate).reverse();
        };
        LazyWrapper.prototype.toArray = function() {
          return this.take(MAX_ARRAY_LENGTH);
        };
        baseForOwn(LazyWrapper.prototype, function(func, methodName) {
          var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), isTaker = /^(?:head|last)$/.test(methodName), lodashFunc = lodash[isTaker ? "take" + (methodName == "last" ? "Right" : "") : methodName], retUnwrapped = isTaker || /^find/.test(methodName);
          if (!lodashFunc) {
            return;
          }
          lodash.prototype[methodName] = function() {
            var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee2 = args[0], useLazy = isLazy || isArray3(value);
            var interceptor = function(value2) {
              var result3 = lodashFunc.apply(lodash, arrayPush([value2], args));
              return isTaker && chainAll ? result3[0] : result3;
            };
            if (useLazy && checkIteratee && typeof iteratee2 == "function" && iteratee2.length != 1) {
              isLazy = useLazy = false;
            }
            var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid;
            if (!retUnwrapped && useLazy) {
              value = onlyLazy ? value : new LazyWrapper(this);
              var result2 = func.apply(value, args);
              result2.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": undefined2 });
              return new LodashWrapper(result2, chainAll);
            }
            if (isUnwrapped && onlyLazy) {
              return func.apply(this, args);
            }
            result2 = this.thru(interceptor);
            return isUnwrapped ? isTaker ? result2.value()[0] : result2.value() : result2;
          };
        });
        arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) {
          var func = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName);
          lodash.prototype[methodName] = function() {
            var args = arguments;
            if (retUnwrapped && !this.__chain__) {
              var value = this.value();
              return func.apply(isArray3(value) ? value : [], args);
            }
            return this[chainName](function(value2) {
              return func.apply(isArray3(value2) ? value2 : [], args);
            });
          };
        });
        baseForOwn(LazyWrapper.prototype, function(func, methodName) {
          var lodashFunc = lodash[methodName];
          if (lodashFunc) {
            var key = lodashFunc.name + "";
            if (!hasOwnProperty2.call(realNames, key)) {
              realNames[key] = [];
            }
            realNames[key].push({ "name": methodName, "func": lodashFunc });
          }
        });
        realNames[createHybrid(undefined2, WRAP_BIND_KEY_FLAG).name] = [{
          "name": "wrapper",
          "func": undefined2
        }];
        LazyWrapper.prototype.clone = lazyClone;
        LazyWrapper.prototype.reverse = lazyReverse;
        LazyWrapper.prototype.value = lazyValue;
        lodash.prototype.at = wrapperAt;
        lodash.prototype.chain = wrapperChain;
        lodash.prototype.commit = wrapperCommit;
        lodash.prototype.next = wrapperNext;
        lodash.prototype.plant = wrapperPlant;
        lodash.prototype.reverse = wrapperReverse;
        lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
        lodash.prototype.first = lodash.prototype.head;
        if (symIterator) {
          lodash.prototype[symIterator] = wrapperToIterator;
        }
        return lodash;
      };
      var _4 = runInContext();
      if (typeof define == "function" && typeof define.amd == "object" && define.amd) {
        root._ = _4;
        define(function() {
          return _4;
        });
      } else if (freeModule) {
        (freeModule.exports = _4)._ = _4;
        freeExports._ = _4;
      } else {
        root._ = _4;
      }
    }).call(exports);
  }
});

// node_modules/highlight.js/lib/core.js
var require_core = __commonJS({
  "node_modules/highlight.js/lib/core.js"(exports, module) {
    "use strict";
    function deepFreeze(obj) {
      if (obj instanceof Map) {
        obj.clear = obj.delete = obj.set = function() {
          throw new Error("map is read-only");
        };
      } else if (obj instanceof Set) {
        obj.add = obj.clear = obj.delete = function() {
          throw new Error("set is read-only");
        };
      }
      Object.freeze(obj);
      Object.getOwnPropertyNames(obj).forEach((name2) => {
        const prop = obj[name2];
        const type = typeof prop;
        if ((type === "object" || type === "function") && !Object.isFrozen(prop)) {
          deepFreeze(prop);
        }
      });
      return obj;
    }
    var Response2 = class {
      /**
       * @param {CompiledMode} mode
       */
      constructor(mode) {
        if (mode.data === void 0) mode.data = {};
        this.data = mode.data;
        this.isMatchIgnored = false;
      }
      ignoreMatch() {
        this.isMatchIgnored = true;
      }
    };
    function escapeHTML(value) {
      return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#x27;");
    }
    function inherit$1(original, ...objects) {
      const result = /* @__PURE__ */ Object.create(null);
      for (const key in original) {
        result[key] = original[key];
      }
      objects.forEach(function(obj) {
        for (const key in obj) {
          result[key] = obj[key];
        }
      });
      return (
        /** @type {T} */
        result
      );
    }
    var SPAN_CLOSE = "</span>";
    var emitsWrappingTags = (node) => {
      return !!node.scope;
    };
    var scopeToCSSClass = (name2, { prefix }) => {
      if (name2.startsWith("language:")) {
        return name2.replace("language:", "language-");
      }
      if (name2.includes(".")) {
        const pieces = name2.split(".");
        return [
          `${prefix}${pieces.shift()}`,
          ...pieces.map((x, i) => `${x}${"_".repeat(i + 1)}`)
        ].join(" ");
      }
      return `${prefix}${name2}`;
    };
    var HTMLRenderer = class {
      /**
       * Creates a new HTMLRenderer
       *
       * @param {Tree} parseTree - the parse tree (must support `walk` API)
       * @param {{classPrefix: string}} options
       */
      constructor(parseTree, options) {
        this.buffer = "";
        this.classPrefix = options.classPrefix;
        parseTree.walk(this);
      }
      /**
       * Adds texts to the output stream
       *
       * @param {string} text */
      addText(text) {
        this.buffer += escapeHTML(text);
      }
      /**
       * Adds a node open to the output stream (if needed)
       *
       * @param {Node} node */
      openNode(node) {
        if (!emitsWrappingTags(node)) return;
        const className = scopeToCSSClass(
          node.scope,
          { prefix: this.classPrefix }
        );
        this.span(className);
      }
      /**
       * Adds a node close to the output stream (if needed)
       *
       * @param {Node} node */
      closeNode(node) {
        if (!emitsWrappingTags(node)) return;
        this.buffer += SPAN_CLOSE;
      }
      /**
       * returns the accumulated buffer
      */
      value() {
        return this.buffer;
      }
      // helpers
      /**
       * Builds a span element
       *
       * @param {string} className */
      span(className) {
        this.buffer += `<span class="${className}">`;
      }
    };
    var newNode = (opts = {}) => {
      const result = { children: [] };
      Object.assign(result, opts);
      return result;
    };
    var TokenTree = class _TokenTree {
      constructor() {
        this.rootNode = newNode();
        this.stack = [this.rootNode];
      }
      get top() {
        return this.stack[this.stack.length - 1];
      }
      get root() {
        return this.rootNode;
      }
      /** @param {Node} node */
      add(node) {
        this.top.children.push(node);
      }
      /** @param {string} scope */
      openNode(scope) {
        const node = newNode({ scope });
        this.add(node);
        this.stack.push(node);
      }
      closeNode() {
        if (this.stack.length > 1) {
          return this.stack.pop();
        }
        return void 0;
      }
      closeAllNodes() {
        while (this.closeNode()) ;
      }
      toJSON() {
        return JSON.stringify(this.rootNode, null, 4);
      }
      /**
       * @typedef { import("./html_renderer").Renderer } Renderer
       * @param {Renderer} builder
       */
      walk(builder) {
        return this.constructor._walk(builder, this.rootNode);
      }
      /**
       * @param {Renderer} builder
       * @param {Node} node
       */
      static _walk(builder, node) {
        if (typeof node === "string") {
          builder.addText(node);
        } else if (node.children) {
          builder.openNode(node);
          node.children.forEach((child) => this._walk(builder, child));
          builder.closeNode(node);
        }
        return builder;
      }
      /**
       * @param {Node} node
       */
      static _collapse(node) {
        if (typeof node === "string") return;
        if (!node.children) return;
        if (node.children.every((el) => typeof el === "string")) {
          node.children = [node.children.join("")];
        } else {
          node.children.forEach((child) => {
            _TokenTree._collapse(child);
          });
        }
      }
    };
    var TokenTreeEmitter = class extends TokenTree {
      /**
       * @param {*} options
       */
      constructor(options) {
        super();
        this.options = options;
      }
      /**
       * @param {string} text
       */
      addText(text) {
        if (text === "") {
          return;
        }
        this.add(text);
      }
      /** @param {string} scope */
      startScope(scope) {
        this.openNode(scope);
      }
      endScope() {
        this.closeNode();
      }
      /**
       * @param {Emitter & {root: DataNode}} emitter
       * @param {string} name
       */
      __addSublanguage(emitter, name2) {
        const node = emitter.root;
        if (name2) node.scope = `language:${name2}`;
        this.add(node);
      }
      toHTML() {
        const renderer = new HTMLRenderer(this, this.options);
        return renderer.value();
      }
      finalize() {
        this.closeAllNodes();
        return true;
      }
    };
    function source(re) {
      if (!re) return null;
      if (typeof re === "string") return re;
      return re.source;
    }
    function lookahead(re) {
      return concat2("(?=", re, ")");
    }
    function anyNumberOfTimes(re) {
      return concat2("(?:", re, ")*");
    }
    function optional(re) {
      return concat2("(?:", re, ")?");
    }
    function concat2(...args) {
      const joined = args.map((x) => source(x)).join("");
      return joined;
    }
    function stripOptionsFromArgs(args) {
      const opts = args[args.length - 1];
      if (typeof opts === "object" && opts.constructor === Object) {
        args.splice(args.length - 1, 1);
        return opts;
      } else {
        return {};
      }
    }
    function either(...args) {
      const opts = stripOptionsFromArgs(args);
      const joined = "(" + (opts.capture ? "" : "?:") + args.map((x) => source(x)).join("|") + ")";
      return joined;
    }
    function countMatchGroups(re) {
      return new RegExp(re.toString() + "|").exec("").length - 1;
    }
    function startsWith(re, lexeme) {
      const match2 = re && re.exec(lexeme);
      return match2 && match2.index === 0;
    }
    var BACKREF_RE = /\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;
    function _rewriteBackreferences(regexps, { joinWith }) {
      let numCaptures = 0;
      return regexps.map((regex) => {
        numCaptures += 1;
        const offset = numCaptures;
        let re = source(regex);
        let out = "";
        while (re.length > 0) {
          const match2 = BACKREF_RE.exec(re);
          if (!match2) {
            out += re;
            break;
          }
          out += re.substring(0, match2.index);
          re = re.substring(match2.index + match2[0].length);
          if (match2[0][0] === "\\" && match2[1]) {
            out += "\\" + String(Number(match2[1]) + offset);
          } else {
            out += match2[0];
            if (match2[0] === "(") {
              numCaptures++;
            }
          }
        }
        return out;
      }).map((re) => `(${re})`).join(joinWith);
    }
    var MATCH_NOTHING_RE = /\b\B/;
    var IDENT_RE = "[a-zA-Z]\\w*";
    var UNDERSCORE_IDENT_RE = "[a-zA-Z_]\\w*";
    var NUMBER_RE = "\\b\\d+(\\.\\d+)?";
    var C_NUMBER_RE = "(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)";
    var BINARY_NUMBER_RE = "\\b(0b[01]+)";
    var RE_STARTERS_RE = "!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";
    var SHEBANG = (opts = {}) => {
      const beginShebang = /^#![ ]*\//;
      if (opts.binary) {
        opts.begin = concat2(
          beginShebang,
          /.*\b/,
          opts.binary,
          /\b.*/
        );
      }
      return inherit$1({
        scope: "meta",
        begin: beginShebang,
        end: /$/,
        relevance: 0,
        /** @type {ModeCallback} */
        "on:begin": (m, resp) => {
          if (m.index !== 0) resp.ignoreMatch();
        }
      }, opts);
    };
    var BACKSLASH_ESCAPE = {
      begin: "\\\\[\\s\\S]",
      relevance: 0
    };
    var APOS_STRING_MODE = {
      scope: "string",
      begin: "'",
      end: "'",
      illegal: "\\n",
      contains: [BACKSLASH_ESCAPE]
    };
    var QUOTE_STRING_MODE = {
      scope: "string",
      begin: '"',
      end: '"',
      illegal: "\\n",
      contains: [BACKSLASH_ESCAPE]
    };
    var PHRASAL_WORDS_MODE = {
      begin: /\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/
    };
    var COMMENT = function(begin, end, modeOptions = {}) {
      const mode = inherit$1(
        {
          scope: "comment",
          begin,
          end,
          contains: []
        },
        modeOptions
      );
      mode.contains.push({
        scope: "doctag",
        // hack to avoid the space from being included. the space is necessary to
        // match here to prevent the plain text rule below from gobbling up doctags
        begin: "[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",
        end: /(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,
        excludeBegin: true,
        relevance: 0
      });
      const ENGLISH_WORD = either(
        // list of common 1 and 2 letter words in English
        "I",
        "a",
        "is",
        "so",
        "us",
        "to",
        "at",
        "if",
        "in",
        "it",
        "on",
        // note: this is not an exhaustive list of contractions, just popular ones
        /[A-Za-z]+['](d|ve|re|ll|t|s|n)/,
        // contractions - can't we'd they're let's, etc
        /[A-Za-z]+[-][a-z]+/,
        // `no-way`, etc.
        /[A-Za-z][a-z]{2,}/
        // allow capitalized words at beginning of sentences
      );
      mode.contains.push(
        {
          // TODO: how to include ", (, ) without breaking grammars that use these for
          // comment delimiters?
          // begin: /[ ]+([()"]?([A-Za-z'-]{3,}|is|a|I|so|us|[tT][oO]|at|if|in|it|on)[.]?[()":]?([.][ ]|[ ]|\))){3}/
          // ---
          // this tries to find sequences of 3 english words in a row (without any
          // "programming" type syntax) this gives us a strong signal that we've
          // TRULY found a comment - vs perhaps scanning with the wrong language.
          // It's possible to find something that LOOKS like the start of the
          // comment - but then if there is no readable text - good chance it is a
          // false match and not a comment.
          //
          // for a visual example please see:
          // https://github.com/highlightjs/highlight.js/issues/2827
          begin: concat2(
            /[ ]+/,
            // necessary to prevent us gobbling up doctags like /* @author Bob Mcgill */
            "(",
            ENGLISH_WORD,
            /[.]?[:]?([.][ ]|[ ])/,
            "){3}"
          )
          // look for 3 words in a row
        }
      );
      return mode;
    };
    var C_LINE_COMMENT_MODE = COMMENT("//", "$");
    var C_BLOCK_COMMENT_MODE = COMMENT("/\\*", "\\*/");
    var HASH_COMMENT_MODE = COMMENT("#", "$");
    var NUMBER_MODE = {
      scope: "number",
      begin: NUMBER_RE,
      relevance: 0
    };
    var C_NUMBER_MODE = {
      scope: "number",
      begin: C_NUMBER_RE,
      relevance: 0
    };
    var BINARY_NUMBER_MODE = {
      scope: "number",
      begin: BINARY_NUMBER_RE,
      relevance: 0
    };
    var REGEXP_MODE = {
      scope: "regexp",
      begin: /\/(?=[^/\n]*\/)/,
      end: /\/[gimuy]*/,
      contains: [
        BACKSLASH_ESCAPE,
        {
          begin: /\[/,
          end: /\]/,
          relevance: 0,
          contains: [BACKSLASH_ESCAPE]
        }
      ]
    };
    var TITLE_MODE = {
      scope: "title",
      begin: IDENT_RE,
      relevance: 0
    };
    var UNDERSCORE_TITLE_MODE = {
      scope: "title",
      begin: UNDERSCORE_IDENT_RE,
      relevance: 0
    };
    var METHOD_GUARD = {
      // excludes method names from keyword processing
      begin: "\\.\\s*" + UNDERSCORE_IDENT_RE,
      relevance: 0
    };
    var END_SAME_AS_BEGIN = function(mode) {
      return Object.assign(
        mode,
        {
          /** @type {ModeCallback} */
          "on:begin": (m, resp) => {
            resp.data._beginMatch = m[1];
          },
          /** @type {ModeCallback} */
          "on:end": (m, resp) => {
            if (resp.data._beginMatch !== m[1]) resp.ignoreMatch();
          }
        }
      );
    };
    var MODES = /* @__PURE__ */ Object.freeze({
      __proto__: null,
      APOS_STRING_MODE,
      BACKSLASH_ESCAPE,
      BINARY_NUMBER_MODE,
      BINARY_NUMBER_RE,
      COMMENT,
      C_BLOCK_COMMENT_MODE,
      C_LINE_COMMENT_MODE,
      C_NUMBER_MODE,
      C_NUMBER_RE,
      END_SAME_AS_BEGIN,
      HASH_COMMENT_MODE,
      IDENT_RE,
      MATCH_NOTHING_RE,
      METHOD_GUARD,
      NUMBER_MODE,
      NUMBER_RE,
      PHRASAL_WORDS_MODE,
      QUOTE_STRING_MODE,
      REGEXP_MODE,
      RE_STARTERS_RE,
      SHEBANG,
      TITLE_MODE,
      UNDERSCORE_IDENT_RE,
      UNDERSCORE_TITLE_MODE
    });
    function skipIfHasPrecedingDot(match2, response) {
      const before = match2.input[match2.index - 1];
      if (before === ".") {
        response.ignoreMatch();
      }
    }
    function scopeClassName(mode, _parent) {
      if (mode.className !== void 0) {
        mode.scope = mode.className;
        delete mode.className;
      }
    }
    function beginKeywords(mode, parent) {
      if (!parent) return;
      if (!mode.beginKeywords) return;
      mode.begin = "\\b(" + mode.beginKeywords.split(" ").join("|") + ")(?!\\.)(?=\\b|\\s)";
      mode.__beforeBegin = skipIfHasPrecedingDot;
      mode.keywords = mode.keywords || mode.beginKeywords;
      delete mode.beginKeywords;
      if (mode.relevance === void 0) mode.relevance = 0;
    }
    function compileIllegal(mode, _parent) {
      if (!Array.isArray(mode.illegal)) return;
      mode.illegal = either(...mode.illegal);
    }
    function compileMatch(mode, _parent) {
      if (!mode.match) return;
      if (mode.begin || mode.end) throw new Error("begin & end are not supported with match");
      mode.begin = mode.match;
      delete mode.match;
    }
    function compileRelevance(mode, _parent) {
      if (mode.relevance === void 0) mode.relevance = 1;
    }
    var beforeMatchExt = (mode, parent) => {
      if (!mode.beforeMatch) return;
      if (mode.starts) throw new Error("beforeMatch cannot be used with starts");
      const originalMode = Object.assign({}, mode);
      Object.keys(mode).forEach((key) => {
        delete mode[key];
      });
      mode.keywords = originalMode.keywords;
      mode.begin = concat2(originalMode.beforeMatch, lookahead(originalMode.begin));
      mode.starts = {
        relevance: 0,
        contains: [
          Object.assign(originalMode, { endsParent: true })
        ]
      };
      mode.relevance = 0;
      delete originalMode.beforeMatch;
    };
    var COMMON_KEYWORDS = [
      "of",
      "and",
      "for",
      "in",
      "not",
      "or",
      "if",
      "then",
      "parent",
      // common variable name
      "list",
      // common variable name
      "value"
      // common variable name
    ];
    var DEFAULT_KEYWORD_SCOPE = "keyword";
    function compileKeywords(rawKeywords, caseInsensitive, scopeName = DEFAULT_KEYWORD_SCOPE) {
      const compiledKeywords = /* @__PURE__ */ Object.create(null);
      if (typeof rawKeywords === "string") {
        compileList(scopeName, rawKeywords.split(" "));
      } else if (Array.isArray(rawKeywords)) {
        compileList(scopeName, rawKeywords);
      } else {
        Object.keys(rawKeywords).forEach(function(scopeName2) {
          Object.assign(
            compiledKeywords,
            compileKeywords(rawKeywords[scopeName2], caseInsensitive, scopeName2)
          );
        });
      }
      return compiledKeywords;
      function compileList(scopeName2, keywordList) {
        if (caseInsensitive) {
          keywordList = keywordList.map((x) => x.toLowerCase());
        }
        keywordList.forEach(function(keyword) {
          const pair = keyword.split("|");
          compiledKeywords[pair[0]] = [scopeName2, scoreForKeyword(pair[0], pair[1])];
        });
      }
    }
    function scoreForKeyword(keyword, providedScore) {
      if (providedScore) {
        return Number(providedScore);
      }
      return commonKeyword(keyword) ? 0 : 1;
    }
    function commonKeyword(keyword) {
      return COMMON_KEYWORDS.includes(keyword.toLowerCase());
    }
    var seenDeprecations = {};
    var error = (message) => {
      console.error(message);
    };
    var warn2 = (message, ...args) => {
      console.log(`WARN: ${message}`, ...args);
    };
    var deprecated = (version2, message) => {
      if (seenDeprecations[`${version2}/${message}`]) return;
      console.log(`Deprecated as of ${version2}. ${message}`);
      seenDeprecations[`${version2}/${message}`] = true;
    };
    var MultiClassError = new Error();
    function remapScopeNames(mode, regexes, { key }) {
      let offset = 0;
      const scopeNames = mode[key];
      const emit = {};
      const positions = {};
      for (let i = 1; i <= regexes.length; i++) {
        positions[i + offset] = scopeNames[i];
        emit[i + offset] = true;
        offset += countMatchGroups(regexes[i - 1]);
      }
      mode[key] = positions;
      mode[key]._emit = emit;
      mode[key]._multi = true;
    }
    function beginMultiClass(mode) {
      if (!Array.isArray(mode.begin)) return;
      if (mode.skip || mode.excludeBegin || mode.returnBegin) {
        error("skip, excludeBegin, returnBegin not compatible with beginScope: {}");
        throw MultiClassError;
      }
      if (typeof mode.beginScope !== "object" || mode.beginScope === null) {
        error("beginScope must be object");
        throw MultiClassError;
      }
      remapScopeNames(mode, mode.begin, { key: "beginScope" });
      mode.begin = _rewriteBackreferences(mode.begin, { joinWith: "" });
    }
    function endMultiClass(mode) {
      if (!Array.isArray(mode.end)) return;
      if (mode.skip || mode.excludeEnd || mode.returnEnd) {
        error("skip, excludeEnd, returnEnd not compatible with endScope: {}");
        throw MultiClassError;
      }
      if (typeof mode.endScope !== "object" || mode.endScope === null) {
        error("endScope must be object");
        throw MultiClassError;
      }
      remapScopeNames(mode, mode.end, { key: "endScope" });
      mode.end = _rewriteBackreferences(mode.end, { joinWith: "" });
    }
    function scopeSugar(mode) {
      if (mode.scope && typeof mode.scope === "object" && mode.scope !== null) {
        mode.beginScope = mode.scope;
        delete mode.scope;
      }
    }
    function MultiClass(mode) {
      scopeSugar(mode);
      if (typeof mode.beginScope === "string") {
        mode.beginScope = { _wrap: mode.beginScope };
      }
      if (typeof mode.endScope === "string") {
        mode.endScope = { _wrap: mode.endScope };
      }
      beginMultiClass(mode);
      endMultiClass(mode);
    }
    function compileLanguage(language) {
      function langRe(value, global2) {
        return new RegExp(
          source(value),
          "m" + (language.case_insensitive ? "i" : "") + (language.unicodeRegex ? "u" : "") + (global2 ? "g" : "")
        );
      }
      class MultiRegex {
        constructor() {
          this.matchIndexes = {};
          this.regexes = [];
          this.matchAt = 1;
          this.position = 0;
        }
        // @ts-ignore
        addRule(re, opts) {
          opts.position = this.position++;
          this.matchIndexes[this.matchAt] = opts;
          this.regexes.push([opts, re]);
          this.matchAt += countMatchGroups(re) + 1;
        }
        compile() {
          if (this.regexes.length === 0) {
            this.exec = () => null;
          }
          const terminators = this.regexes.map((el) => el[1]);
          this.matcherRe = langRe(_rewriteBackreferences(terminators, { joinWith: "|" }), true);
          this.lastIndex = 0;
        }
        /** @param {string} s */
        exec(s) {
          this.matcherRe.lastIndex = this.lastIndex;
          const match2 = this.matcherRe.exec(s);
          if (!match2) {
            return null;
          }
          const i = match2.findIndex((el, i2) => i2 > 0 && el !== void 0);
          const matchData = this.matchIndexes[i];
          match2.splice(0, i);
          return Object.assign(match2, matchData);
        }
      }
      class ResumableMultiRegex {
        constructor() {
          this.rules = [];
          this.multiRegexes = [];
          this.count = 0;
          this.lastIndex = 0;
          this.regexIndex = 0;
        }
        // @ts-ignore
        getMatcher(index) {
          if (this.multiRegexes[index]) return this.multiRegexes[index];
          const matcher = new MultiRegex();
          this.rules.slice(index).forEach(([re, opts]) => matcher.addRule(re, opts));
          matcher.compile();
          this.multiRegexes[index] = matcher;
          return matcher;
        }
        resumingScanAtSamePosition() {
          return this.regexIndex !== 0;
        }
        considerAll() {
          this.regexIndex = 0;
        }
        // @ts-ignore
        addRule(re, opts) {
          this.rules.push([re, opts]);
          if (opts.type === "begin") this.count++;
        }
        /** @param {string} s */
        exec(s) {
          const m = this.getMatcher(this.regexIndex);
          m.lastIndex = this.lastIndex;
          let result = m.exec(s);
          if (this.resumingScanAtSamePosition()) {
            if (result && result.index === this.lastIndex) ;
            else {
              const m2 = this.getMatcher(0);
              m2.lastIndex = this.lastIndex + 1;
              result = m2.exec(s);
            }
          }
          if (result) {
            this.regexIndex += result.position + 1;
            if (this.regexIndex === this.count) {
              this.considerAll();
            }
          }
          return result;
        }
      }
      function buildModeRegex(mode) {
        const mm = new ResumableMultiRegex();
        mode.contains.forEach((term) => mm.addRule(term.begin, { rule: term, type: "begin" }));
        if (mode.terminatorEnd) {
          mm.addRule(mode.terminatorEnd, { type: "end" });
        }
        if (mode.illegal) {
          mm.addRule(mode.illegal, { type: "illegal" });
        }
        return mm;
      }
      function compileMode(mode, parent) {
        const cmode = (
          /** @type CompiledMode */
          mode
        );
        if (mode.isCompiled) return cmode;
        [
          scopeClassName,
          // do this early so compiler extensions generally don't have to worry about
          // the distinction between match/begin
          compileMatch,
          MultiClass,
          beforeMatchExt
        ].forEach((ext) => ext(mode, parent));
        language.compilerExtensions.forEach((ext) => ext(mode, parent));
        mode.__beforeBegin = null;
        [
          beginKeywords,
          // do this later so compiler extensions that come earlier have access to the
          // raw array if they wanted to perhaps manipulate it, etc.
          compileIllegal,
          // default to 1 relevance if not specified
          compileRelevance
        ].forEach((ext) => ext(mode, parent));
        mode.isCompiled = true;
        let keywordPattern = null;
        if (typeof mode.keywords === "object" && mode.keywords.$pattern) {
          mode.keywords = Object.assign({}, mode.keywords);
          keywordPattern = mode.keywords.$pattern;
          delete mode.keywords.$pattern;
        }
        keywordPattern = keywordPattern || /\w+/;
        if (mode.keywords) {
          mode.keywords = compileKeywords(mode.keywords, language.case_insensitive);
        }
        cmode.keywordPatternRe = langRe(keywordPattern, true);
        if (parent) {
          if (!mode.begin) mode.begin = /\B|\b/;
          cmode.beginRe = langRe(cmode.begin);
          if (!mode.end && !mode.endsWithParent) mode.end = /\B|\b/;
          if (mode.end) cmode.endRe = langRe(cmode.end);
          cmode.terminatorEnd = source(cmode.end) || "";
          if (mode.endsWithParent && parent.terminatorEnd) {
            cmode.terminatorEnd += (mode.end ? "|" : "") + parent.terminatorEnd;
          }
        }
        if (mode.illegal) cmode.illegalRe = langRe(
          /** @type {RegExp | string} */
          mode.illegal
        );
        if (!mode.contains) mode.contains = [];
        mode.contains = [].concat(...mode.contains.map(function(c) {
          return expandOrCloneMode(c === "self" ? mode : c);
        }));
        mode.contains.forEach(function(c) {
          compileMode(
            /** @type Mode */
            c,
            cmode
          );
        });
        if (mode.starts) {
          compileMode(mode.starts, parent);
        }
        cmode.matcher = buildModeRegex(cmode);
        return cmode;
      }
      if (!language.compilerExtensions) language.compilerExtensions = [];
      if (language.contains && language.contains.includes("self")) {
        throw new Error("ERR: contains `self` is not supported at the top-level of a language.  See documentation.");
      }
      language.classNameAliases = inherit$1(language.classNameAliases || {});
      return compileMode(
        /** @type Mode */
        language
      );
    }
    function dependencyOnParent(mode) {
      if (!mode) return false;
      return mode.endsWithParent || dependencyOnParent(mode.starts);
    }
    function expandOrCloneMode(mode) {
      if (mode.variants && !mode.cachedVariants) {
        mode.cachedVariants = mode.variants.map(function(variant) {
          return inherit$1(mode, { variants: null }, variant);
        });
      }
      if (mode.cachedVariants) {
        return mode.cachedVariants;
      }
      if (dependencyOnParent(mode)) {
        return inherit$1(mode, { starts: mode.starts ? inherit$1(mode.starts) : null });
      }
      if (Object.isFrozen(mode)) {
        return inherit$1(mode);
      }
      return mode;
    }
    var version = "11.11.1";
    var HTMLInjectionError = class extends Error {
      constructor(reason, html) {
        super(reason);
        this.name = "HTMLInjectionError";
        this.html = html;
      }
    };
    var escape2 = escapeHTML;
    var inherit = inherit$1;
    var NO_MATCH = Symbol("nomatch");
    var MAX_KEYWORD_HITS = 7;
    var HLJS = function(hljs) {
      const languages = /* @__PURE__ */ Object.create(null);
      const aliases = /* @__PURE__ */ Object.create(null);
      const plugins = [];
      let SAFE_MODE = true;
      const LANGUAGE_NOT_FOUND = "Could not find the language '{}', did you forget to load/include a language module?";
      const PLAINTEXT_LANGUAGE = { disableAutodetect: true, name: "Plain text", contains: [] };
      let options = {
        ignoreUnescapedHTML: false,
        throwUnescapedHTML: false,
        noHighlightRe: /^(no-?highlight)$/i,
        languageDetectRe: /\blang(?:uage)?-([\w-]+)\b/i,
        classPrefix: "hljs-",
        cssSelector: "pre code",
        languages: null,
        // beta configuration options, subject to change, welcome to discuss
        // https://github.com/highlightjs/highlight.js/issues/1086
        __emitter: TokenTreeEmitter
      };
      function shouldNotHighlight(languageName) {
        return options.noHighlightRe.test(languageName);
      }
      function blockLanguage(block) {
        let classes = block.className + " ";
        classes += block.parentNode ? block.parentNode.className : "";
        const match2 = options.languageDetectRe.exec(classes);
        if (match2) {
          const language = getLanguage(match2[1]);
          if (!language) {
            warn2(LANGUAGE_NOT_FOUND.replace("{}", match2[1]));
            warn2("Falling back to no-highlight mode for this block.", block);
          }
          return language ? match2[1] : "no-highlight";
        }
        return classes.split(/\s+/).find((_class) => shouldNotHighlight(_class) || getLanguage(_class));
      }
      function highlight2(codeOrLanguageName, optionsOrCode, ignoreIllegals) {
        let code = "";
        let languageName = "";
        if (typeof optionsOrCode === "object") {
          code = codeOrLanguageName;
          ignoreIllegals = optionsOrCode.ignoreIllegals;
          languageName = optionsOrCode.language;
        } else {
          deprecated("10.7.0", "highlight(lang, code, ...args) has been deprecated.");
          deprecated("10.7.0", "Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277");
          languageName = codeOrLanguageName;
          code = optionsOrCode;
        }
        if (ignoreIllegals === void 0) {
          ignoreIllegals = true;
        }
        const context2 = {
          code,
          language: languageName
        };
        fire("before:highlight", context2);
        const result = context2.result ? context2.result : _highlight(context2.language, context2.code, ignoreIllegals);
        result.code = context2.code;
        fire("after:highlight", result);
        return result;
      }
      function _highlight(languageName, codeToHighlight, ignoreIllegals, continuation) {
        const keywordHits = /* @__PURE__ */ Object.create(null);
        function keywordData(mode, matchText) {
          return mode.keywords[matchText];
        }
        function processKeywords() {
          if (!top.keywords) {
            emitter.addText(modeBuffer);
            return;
          }
          let lastIndex = 0;
          top.keywordPatternRe.lastIndex = 0;
          let match2 = top.keywordPatternRe.exec(modeBuffer);
          let buf = "";
          while (match2) {
            buf += modeBuffer.substring(lastIndex, match2.index);
            const word = language.case_insensitive ? match2[0].toLowerCase() : match2[0];
            const data = keywordData(top, word);
            if (data) {
              const [kind, keywordRelevance] = data;
              emitter.addText(buf);
              buf = "";
              keywordHits[word] = (keywordHits[word] || 0) + 1;
              if (keywordHits[word] <= MAX_KEYWORD_HITS) relevance += keywordRelevance;
              if (kind.startsWith("_")) {
                buf += match2[0];
              } else {
                const cssClass = language.classNameAliases[kind] || kind;
                emitKeyword(match2[0], cssClass);
              }
            } else {
              buf += match2[0];
            }
            lastIndex = top.keywordPatternRe.lastIndex;
            match2 = top.keywordPatternRe.exec(modeBuffer);
          }
          buf += modeBuffer.substring(lastIndex);
          emitter.addText(buf);
        }
        function processSubLanguage() {
          if (modeBuffer === "") return;
          let result2 = null;
          if (typeof top.subLanguage === "string") {
            if (!languages[top.subLanguage]) {
              emitter.addText(modeBuffer);
              return;
            }
            result2 = _highlight(top.subLanguage, modeBuffer, true, continuations[top.subLanguage]);
            continuations[top.subLanguage] = /** @type {CompiledMode} */
            result2._top;
          } else {
            result2 = highlightAuto(modeBuffer, top.subLanguage.length ? top.subLanguage : null);
          }
          if (top.relevance > 0) {
            relevance += result2.relevance;
          }
          emitter.__addSublanguage(result2._emitter, result2.language);
        }
        function processBuffer() {
          if (top.subLanguage != null) {
            processSubLanguage();
          } else {
            processKeywords();
          }
          modeBuffer = "";
        }
        function emitKeyword(keyword, scope) {
          if (keyword === "") return;
          emitter.startScope(scope);
          emitter.addText(keyword);
          emitter.endScope();
        }
        function emitMultiClass(scope, match2) {
          let i = 1;
          const max = match2.length - 1;
          while (i <= max) {
            if (!scope._emit[i]) {
              i++;
              continue;
            }
            const klass = language.classNameAliases[scope[i]] || scope[i];
            const text = match2[i];
            if (klass) {
              emitKeyword(text, klass);
            } else {
              modeBuffer = text;
              processKeywords();
              modeBuffer = "";
            }
            i++;
          }
        }
        function startNewMode(mode, match2) {
          if (mode.scope && typeof mode.scope === "string") {
            emitter.openNode(language.classNameAliases[mode.scope] || mode.scope);
          }
          if (mode.beginScope) {
            if (mode.beginScope._wrap) {
              emitKeyword(modeBuffer, language.classNameAliases[mode.beginScope._wrap] || mode.beginScope._wrap);
              modeBuffer = "";
            } else if (mode.beginScope._multi) {
              emitMultiClass(mode.beginScope, match2);
              modeBuffer = "";
            }
          }
          top = Object.create(mode, { parent: { value: top } });
          return top;
        }
        function endOfMode(mode, match2, matchPlusRemainder) {
          let matched = startsWith(mode.endRe, matchPlusRemainder);
          if (matched) {
            if (mode["on:end"]) {
              const resp = new Response2(mode);
              mode["on:end"](match2, resp);
              if (resp.isMatchIgnored) matched = false;
            }
            if (matched) {
              while (mode.endsParent && mode.parent) {
                mode = mode.parent;
              }
              return mode;
            }
          }
          if (mode.endsWithParent) {
            return endOfMode(mode.parent, match2, matchPlusRemainder);
          }
        }
        function doIgnore(lexeme) {
          if (top.matcher.regexIndex === 0) {
            modeBuffer += lexeme[0];
            return 1;
          } else {
            resumeScanAtSamePosition = true;
            return 0;
          }
        }
        function doBeginMatch(match2) {
          const lexeme = match2[0];
          const newMode = match2.rule;
          const resp = new Response2(newMode);
          const beforeCallbacks = [newMode.__beforeBegin, newMode["on:begin"]];
          for (const cb of beforeCallbacks) {
            if (!cb) continue;
            cb(match2, resp);
            if (resp.isMatchIgnored) return doIgnore(lexeme);
          }
          if (newMode.skip) {
            modeBuffer += lexeme;
          } else {
            if (newMode.excludeBegin) {
              modeBuffer += lexeme;
            }
            processBuffer();
            if (!newMode.returnBegin && !newMode.excludeBegin) {
              modeBuffer = lexeme;
            }
          }
          startNewMode(newMode, match2);
          return newMode.returnBegin ? 0 : lexeme.length;
        }
        function doEndMatch(match2) {
          const lexeme = match2[0];
          const matchPlusRemainder = codeToHighlight.substring(match2.index);
          const endMode = endOfMode(top, match2, matchPlusRemainder);
          if (!endMode) {
            return NO_MATCH;
          }
          const origin = top;
          if (top.endScope && top.endScope._wrap) {
            processBuffer();
            emitKeyword(lexeme, top.endScope._wrap);
          } else if (top.endScope && top.endScope._multi) {
            processBuffer();
            emitMultiClass(top.endScope, match2);
          } else if (origin.skip) {
            modeBuffer += lexeme;
          } else {
            if (!(origin.returnEnd || origin.excludeEnd)) {
              modeBuffer += lexeme;
            }
            processBuffer();
            if (origin.excludeEnd) {
              modeBuffer = lexeme;
            }
          }
          do {
            if (top.scope) {
              emitter.closeNode();
            }
            if (!top.skip && !top.subLanguage) {
              relevance += top.relevance;
            }
            top = top.parent;
          } while (top !== endMode.parent);
          if (endMode.starts) {
            startNewMode(endMode.starts, match2);
          }
          return origin.returnEnd ? 0 : lexeme.length;
        }
        function processContinuations() {
          const list = [];
          for (let current = top; current !== language; current = current.parent) {
            if (current.scope) {
              list.unshift(current.scope);
            }
          }
          list.forEach((item) => emitter.openNode(item));
        }
        let lastMatch = {};
        function processLexeme(textBeforeMatch, match2) {
          const lexeme = match2 && match2[0];
          modeBuffer += textBeforeMatch;
          if (lexeme == null) {
            processBuffer();
            return 0;
          }
          if (lastMatch.type === "begin" && match2.type === "end" && lastMatch.index === match2.index && lexeme === "") {
            modeBuffer += codeToHighlight.slice(match2.index, match2.index + 1);
            if (!SAFE_MODE) {
              const err = new Error(`0 width match regex (${languageName})`);
              err.languageName = languageName;
              err.badRule = lastMatch.rule;
              throw err;
            }
            return 1;
          }
          lastMatch = match2;
          if (match2.type === "begin") {
            return doBeginMatch(match2);
          } else if (match2.type === "illegal" && !ignoreIllegals) {
            const err = new Error('Illegal lexeme "' + lexeme + '" for mode "' + (top.scope || "<unnamed>") + '"');
            err.mode = top;
            throw err;
          } else if (match2.type === "end") {
            const processed = doEndMatch(match2);
            if (processed !== NO_MATCH) {
              return processed;
            }
          }
          if (match2.type === "illegal" && lexeme === "") {
            modeBuffer += "\n";
            return 1;
          }
          if (iterations > 1e5 && iterations > match2.index * 3) {
            const err = new Error("potential infinite loop, way more iterations than matches");
            throw err;
          }
          modeBuffer += lexeme;
          return lexeme.length;
        }
        const language = getLanguage(languageName);
        if (!language) {
          error(LANGUAGE_NOT_FOUND.replace("{}", languageName));
          throw new Error('Unknown language: "' + languageName + '"');
        }
        const md = compileLanguage(language);
        let result = "";
        let top = continuation || md;
        const continuations = {};
        const emitter = new options.__emitter(options);
        processContinuations();
        let modeBuffer = "";
        let relevance = 0;
        let index = 0;
        let iterations = 0;
        let resumeScanAtSamePosition = false;
        try {
          if (!language.__emitTokens) {
            top.matcher.considerAll();
            for (; ; ) {
              iterations++;
              if (resumeScanAtSamePosition) {
                resumeScanAtSamePosition = false;
              } else {
                top.matcher.considerAll();
              }
              top.matcher.lastIndex = index;
              const match2 = top.matcher.exec(codeToHighlight);
              if (!match2) break;
              const beforeMatch = codeToHighlight.substring(index, match2.index);
              const processedCount = processLexeme(beforeMatch, match2);
              index = match2.index + processedCount;
            }
            processLexeme(codeToHighlight.substring(index));
          } else {
            language.__emitTokens(codeToHighlight, emitter);
          }
          emitter.finalize();
          result = emitter.toHTML();
          return {
            language: languageName,
            value: result,
            relevance,
            illegal: false,
            _emitter: emitter,
            _top: top
          };
        } catch (err) {
          if (err.message && err.message.includes("Illegal")) {
            return {
              language: languageName,
              value: escape2(codeToHighlight),
              illegal: true,
              relevance: 0,
              _illegalBy: {
                message: err.message,
                index,
                context: codeToHighlight.slice(index - 100, index + 100),
                mode: err.mode,
                resultSoFar: result
              },
              _emitter: emitter
            };
          } else if (SAFE_MODE) {
            return {
              language: languageName,
              value: escape2(codeToHighlight),
              illegal: false,
              relevance: 0,
              errorRaised: err,
              _emitter: emitter,
              _top: top
            };
          } else {
            throw err;
          }
        }
      }
      function justTextHighlightResult(code) {
        const result = {
          value: escape2(code),
          illegal: false,
          relevance: 0,
          _top: PLAINTEXT_LANGUAGE,
          _emitter: new options.__emitter(options)
        };
        result._emitter.addText(code);
        return result;
      }
      function highlightAuto(code, languageSubset) {
        languageSubset = languageSubset || options.languages || Object.keys(languages);
        const plaintext = justTextHighlightResult(code);
        const results = languageSubset.filter(getLanguage).filter(autoDetection).map(
          (name2) => _highlight(name2, code, false)
        );
        results.unshift(plaintext);
        const sorted = results.sort((a, b) => {
          if (a.relevance !== b.relevance) return b.relevance - a.relevance;
          if (a.language && b.language) {
            if (getLanguage(a.language).supersetOf === b.language) {
              return 1;
            } else if (getLanguage(b.language).supersetOf === a.language) {
              return -1;
            }
          }
          return 0;
        });
        const [best, secondBest] = sorted;
        const result = best;
        result.secondBest = secondBest;
        return result;
      }
      function updateClassName(element, currentLang, resultLang) {
        const language = currentLang && aliases[currentLang] || resultLang;
        element.classList.add("hljs");
        element.classList.add(`language-${language}`);
      }
      function highlightElement(element) {
        let node = null;
        const language = blockLanguage(element);
        if (shouldNotHighlight(language)) return;
        fire(
          "before:highlightElement",
          { el: element, language }
        );
        if (element.dataset.highlighted) {
          console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.", element);
          return;
        }
        if (element.children.length > 0) {
          if (!options.ignoreUnescapedHTML) {
            console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk.");
            console.warn("https://github.com/highlightjs/highlight.js/wiki/security");
            console.warn("The element with unescaped HTML:");
            console.warn(element);
          }
          if (options.throwUnescapedHTML) {
            const err = new HTMLInjectionError(
              "One of your code blocks includes unescaped HTML.",
              element.innerHTML
            );
            throw err;
          }
        }
        node = element;
        const text = node.textContent;
        const result = language ? highlight2(text, { language, ignoreIllegals: true }) : highlightAuto(text);
        element.innerHTML = result.value;
        element.dataset.highlighted = "yes";
        updateClassName(element, language, result.language);
        element.result = {
          language: result.language,
          // TODO: remove with version 11.0
          re: result.relevance,
          relevance: result.relevance
        };
        if (result.secondBest) {
          element.secondBest = {
            language: result.secondBest.language,
            relevance: result.secondBest.relevance
          };
        }
        fire("after:highlightElement", { el: element, result, text });
      }
      function configure(userOptions) {
        options = inherit(options, userOptions);
      }
      const initHighlighting = () => {
        highlightAll();
        deprecated("10.6.0", "initHighlighting() deprecated.  Use highlightAll() now.");
      };
      function initHighlightingOnLoad() {
        highlightAll();
        deprecated("10.6.0", "initHighlightingOnLoad() deprecated.  Use highlightAll() now.");
      }
      let wantsHighlight = false;
      function highlightAll() {
        function boot() {
          highlightAll();
        }
        if (document.readyState === "loading") {
          if (!wantsHighlight) {
            window.addEventListener("DOMContentLoaded", boot, false);
          }
          wantsHighlight = true;
          return;
        }
        const blocks = document.querySelectorAll(options.cssSelector);
        blocks.forEach(highlightElement);
      }
      function registerLanguage(languageName, languageDefinition) {
        let lang = null;
        try {
          lang = languageDefinition(hljs);
        } catch (error$1) {
          error("Language definition for '{}' could not be registered.".replace("{}", languageName));
          if (!SAFE_MODE) {
            throw error$1;
          } else {
            error(error$1);
          }
          lang = PLAINTEXT_LANGUAGE;
        }
        if (!lang.name) lang.name = languageName;
        languages[languageName] = lang;
        lang.rawDefinition = languageDefinition.bind(null, hljs);
        if (lang.aliases) {
          registerAliases(lang.aliases, { languageName });
        }
      }
      function unregisterLanguage(languageName) {
        delete languages[languageName];
        for (const alias of Object.keys(aliases)) {
          if (aliases[alias] === languageName) {
            delete aliases[alias];
          }
        }
      }
      function listLanguages() {
        return Object.keys(languages);
      }
      function getLanguage(name2) {
        name2 = (name2 || "").toLowerCase();
        return languages[name2] || languages[aliases[name2]];
      }
      function registerAliases(aliasList, { languageName }) {
        if (typeof aliasList === "string") {
          aliasList = [aliasList];
        }
        aliasList.forEach((alias) => {
          aliases[alias.toLowerCase()] = languageName;
        });
      }
      function autoDetection(name2) {
        const lang = getLanguage(name2);
        return lang && !lang.disableAutodetect;
      }
      function upgradePluginAPI(plugin) {
        if (plugin["before:highlightBlock"] && !plugin["before:highlightElement"]) {
          plugin["before:highlightElement"] = (data) => {
            plugin["before:highlightBlock"](
              Object.assign({ block: data.el }, data)
            );
          };
        }
        if (plugin["after:highlightBlock"] && !plugin["after:highlightElement"]) {
          plugin["after:highlightElement"] = (data) => {
            plugin["after:highlightBlock"](
              Object.assign({ block: data.el }, data)
            );
          };
        }
      }
      function addPlugin(plugin) {
        upgradePluginAPI(plugin);
        plugins.push(plugin);
      }
      function removePlugin(plugin) {
        const index = plugins.indexOf(plugin);
        if (index !== -1) {
          plugins.splice(index, 1);
        }
      }
      function fire(event, args) {
        const cb = event;
        plugins.forEach(function(plugin) {
          if (plugin[cb]) {
            plugin[cb](args);
          }
        });
      }
      function deprecateHighlightBlock(el) {
        deprecated("10.7.0", "highlightBlock will be removed entirely in v12.0");
        deprecated("10.7.0", "Please use highlightElement now.");
        return highlightElement(el);
      }
      Object.assign(hljs, {
        highlight: highlight2,
        highlightAuto,
        highlightAll,
        highlightElement,
        // TODO: Remove with v12 API
        highlightBlock: deprecateHighlightBlock,
        configure,
        initHighlighting,
        initHighlightingOnLoad,
        registerLanguage,
        unregisterLanguage,
        listLanguages,
        getLanguage,
        registerAliases,
        autoDetection,
        inherit,
        addPlugin,
        removePlugin
      });
      hljs.debugMode = function() {
        SAFE_MODE = false;
      };
      hljs.safeMode = function() {
        SAFE_MODE = true;
      };
      hljs.versionString = version;
      hljs.regex = {
        concat: concat2,
        lookahead,
        either,
        optional,
        anyNumberOfTimes
      };
      for (const key in MODES) {
        if (typeof MODES[key] === "object") {
          deepFreeze(MODES[key]);
        }
      }
      Object.assign(hljs, MODES);
      return hljs;
    };
    var highlight = HLJS({});
    highlight.newInstance = () => HLJS({});
    module.exports = highlight;
    highlight.HighlightJS = highlight;
    highlight.default = highlight;
  }
});

// node_modules/@angular/core/fesm2022/not_found.mjs
var _currentInjector = void 0;
function getCurrentInjector() {
  return _currentInjector;
}
function setCurrentInjector(injector) {
  const former = _currentInjector;
  _currentInjector = injector;
  return former;
}
var NOT_FOUND = Symbol("NotFound");
function isNotFound(e) {
  return e === NOT_FOUND || e?.name === "\u0275NotFound";
}

// node_modules/@angular/core/fesm2022/signal.mjs
function defaultEquals(a, b) {
  return Object.is(a, b);
}
var activeConsumer = null;
var inNotificationPhase = false;
var epoch = 1;
var postProducerCreatedFn = null;
var SIGNAL = /* @__PURE__ */ Symbol("SIGNAL");
function setActiveConsumer(consumer) {
  const prev = activeConsumer;
  activeConsumer = consumer;
  return prev;
}
function getActiveConsumer() {
  return activeConsumer;
}
function isInNotificationPhase() {
  return inNotificationPhase;
}
var REACTIVE_NODE = {
  version: 0,
  lastCleanEpoch: 0,
  dirty: false,
  producerNode: void 0,
  producerLastReadVersion: void 0,
  producerIndexOfThis: void 0,
  nextProducerIndex: 0,
  liveConsumerNode: void 0,
  liveConsumerIndexOfThis: void 0,
  consumerAllowSignalWrites: false,
  consumerIsAlwaysLive: false,
  kind: "unknown",
  producerMustRecompute: () => false,
  producerRecomputeValue: () => {
  },
  consumerMarkedDirty: () => {
  },
  consumerOnSignalRead: () => {
  }
};
function producerAccessed(node) {
  if (inNotificationPhase) {
    throw new Error(typeof ngDevMode !== "undefined" && ngDevMode ? `Assertion error: signal read during notification phase` : "");
  }
  if (activeConsumer === null) {
    return;
  }
  activeConsumer.consumerOnSignalRead(node);
  const idx = activeConsumer.nextProducerIndex++;
  assertConsumerNode(activeConsumer);
  if (idx < activeConsumer.producerNode.length && activeConsumer.producerNode[idx] !== node) {
    if (consumerIsLive(activeConsumer)) {
      const staleProducer = activeConsumer.producerNode[idx];
      producerRemoveLiveConsumerAtIndex(staleProducer, activeConsumer.producerIndexOfThis[idx]);
    }
  }
  if (activeConsumer.producerNode[idx] !== node) {
    activeConsumer.producerNode[idx] = node;
    activeConsumer.producerIndexOfThis[idx] = consumerIsLive(activeConsumer) ? producerAddLiveConsumer(node, activeConsumer, idx) : 0;
  }
  activeConsumer.producerLastReadVersion[idx] = node.version;
}
function producerIncrementEpoch() {
  epoch++;
}
function producerUpdateValueVersion(node) {
  if (consumerIsLive(node) && !node.dirty) {
    return;
  }
  if (!node.dirty && node.lastCleanEpoch === epoch) {
    return;
  }
  if (!node.producerMustRecompute(node) && !consumerPollProducersForChange(node)) {
    producerMarkClean(node);
    return;
  }
  node.producerRecomputeValue(node);
  producerMarkClean(node);
}
function producerNotifyConsumers(node) {
  if (node.liveConsumerNode === void 0) {
    return;
  }
  const prev = inNotificationPhase;
  inNotificationPhase = true;
  try {
    for (const consumer of node.liveConsumerNode) {
      if (!consumer.dirty) {
        consumerMarkDirty(consumer);
      }
    }
  } finally {
    inNotificationPhase = prev;
  }
}
function producerUpdatesAllowed() {
  return activeConsumer?.consumerAllowSignalWrites !== false;
}
function consumerMarkDirty(node) {
  node.dirty = true;
  producerNotifyConsumers(node);
  node.consumerMarkedDirty?.(node);
}
function producerMarkClean(node) {
  node.dirty = false;
  node.lastCleanEpoch = epoch;
}
function consumerBeforeComputation(node) {
  node && (node.nextProducerIndex = 0);
  return setActiveConsumer(node);
}
function consumerAfterComputation(node, prevConsumer) {
  setActiveConsumer(prevConsumer);
  if (!node || node.producerNode === void 0 || node.producerIndexOfThis === void 0 || node.producerLastReadVersion === void 0) {
    return;
  }
  if (consumerIsLive(node)) {
    for (let i = node.nextProducerIndex; i < node.producerNode.length; i++) {
      producerRemoveLiveConsumerAtIndex(node.producerNode[i], node.producerIndexOfThis[i]);
    }
  }
  while (node.producerNode.length > node.nextProducerIndex) {
    node.producerNode.pop();
    node.producerLastReadVersion.pop();
    node.producerIndexOfThis.pop();
  }
}
function consumerPollProducersForChange(node) {
  assertConsumerNode(node);
  for (let i = 0; i < node.producerNode.length; i++) {
    const producer = node.producerNode[i];
    const seenVersion = node.producerLastReadVersion[i];
    if (seenVersion !== producer.version) {
      return true;
    }
    producerUpdateValueVersion(producer);
    if (seenVersion !== producer.version) {
      return true;
    }
  }
  return false;
}
function consumerDestroy(node) {
  assertConsumerNode(node);
  if (consumerIsLive(node)) {
    for (let i = 0; i < node.producerNode.length; i++) {
      producerRemoveLiveConsumerAtIndex(node.producerNode[i], node.producerIndexOfThis[i]);
    }
  }
  node.producerNode.length = node.producerLastReadVersion.length = node.producerIndexOfThis.length = 0;
  if (node.liveConsumerNode) {
    node.liveConsumerNode.length = node.liveConsumerIndexOfThis.length = 0;
  }
}
function producerAddLiveConsumer(node, consumer, indexOfThis) {
  assertProducerNode(node);
  if (node.liveConsumerNode.length === 0 && isConsumerNode(node)) {
    for (let i = 0; i < node.producerNode.length; i++) {
      node.producerIndexOfThis[i] = producerAddLiveConsumer(node.producerNode[i], node, i);
    }
  }
  node.liveConsumerIndexOfThis.push(indexOfThis);
  return node.liveConsumerNode.push(consumer) - 1;
}
function producerRemoveLiveConsumerAtIndex(node, idx) {
  assertProducerNode(node);
  if (typeof ngDevMode !== "undefined" && ngDevMode && idx >= node.liveConsumerNode.length) {
    throw new Error(`Assertion error: active consumer index ${idx} is out of bounds of ${node.liveConsumerNode.length} consumers)`);
  }
  if (node.liveConsumerNode.length === 1 && isConsumerNode(node)) {
    for (let i = 0; i < node.producerNode.length; i++) {
      producerRemoveLiveConsumerAtIndex(node.producerNode[i], node.producerIndexOfThis[i]);
    }
  }
  const lastIdx = node.liveConsumerNode.length - 1;
  node.liveConsumerNode[idx] = node.liveConsumerNode[lastIdx];
  node.liveConsumerIndexOfThis[idx] = node.liveConsumerIndexOfThis[lastIdx];
  node.liveConsumerNode.length--;
  node.liveConsumerIndexOfThis.length--;
  if (idx < node.liveConsumerNode.length) {
    const idxProducer = node.liveConsumerIndexOfThis[idx];
    const consumer = node.liveConsumerNode[idx];
    assertConsumerNode(consumer);
    consumer.producerIndexOfThis[idxProducer] = idx;
  }
}
function consumerIsLive(node) {
  return node.consumerIsAlwaysLive || (node?.liveConsumerNode?.length ?? 0) > 0;
}
function assertConsumerNode(node) {
  node.producerNode ??= [];
  node.producerIndexOfThis ??= [];
  node.producerLastReadVersion ??= [];
}
function assertProducerNode(node) {
  node.liveConsumerNode ??= [];
  node.liveConsumerIndexOfThis ??= [];
}
function isConsumerNode(node) {
  return node.producerNode !== void 0;
}
function runPostProducerCreatedFn(node) {
  postProducerCreatedFn?.(node);
}
function createComputed(computation, equal) {
  const node = Object.create(COMPUTED_NODE);
  node.computation = computation;
  if (equal !== void 0) {
    node.equal = equal;
  }
  const computed2 = () => {
    producerUpdateValueVersion(node);
    producerAccessed(node);
    if (node.value === ERRORED) {
      throw node.error;
    }
    return node.value;
  };
  computed2[SIGNAL] = node;
  if (typeof ngDevMode !== "undefined" && ngDevMode) {
    const debugName = node.debugName ? " (" + node.debugName + ")" : "";
    computed2.toString = () => `[Computed${debugName}: ${node.value}]`;
  }
  runPostProducerCreatedFn(node);
  return computed2;
}
var UNSET = /* @__PURE__ */ Symbol("UNSET");
var COMPUTING = /* @__PURE__ */ Symbol("COMPUTING");
var ERRORED = /* @__PURE__ */ Symbol("ERRORED");
var COMPUTED_NODE = /* @__PURE__ */ (() => {
  return __spreadProps(__spreadValues({}, REACTIVE_NODE), {
    value: UNSET,
    dirty: true,
    error: null,
    equal: defaultEquals,
    kind: "computed",
    producerMustRecompute(node) {
      return node.value === UNSET || node.value === COMPUTING;
    },
    producerRecomputeValue(node) {
      if (node.value === COMPUTING) {
        throw new Error(typeof ngDevMode !== "undefined" && ngDevMode ? "Detected cycle in computations." : "");
      }
      const oldValue = node.value;
      node.value = COMPUTING;
      const prevConsumer = consumerBeforeComputation(node);
      let newValue;
      let wasEqual = false;
      try {
        newValue = node.computation();
        setActiveConsumer(null);
        wasEqual = oldValue !== UNSET && oldValue !== ERRORED && newValue !== ERRORED && node.equal(oldValue, newValue);
      } catch (err) {
        newValue = ERRORED;
        node.error = err;
      } finally {
        consumerAfterComputation(node, prevConsumer);
      }
      if (wasEqual) {
        node.value = oldValue;
        return;
      }
      node.value = newValue;
      node.version++;
    }
  });
})();
function defaultThrowError() {
  throw new Error();
}
var throwInvalidWriteToSignalErrorFn = defaultThrowError;
function throwInvalidWriteToSignalError(node) {
  throwInvalidWriteToSignalErrorFn(node);
}
function setThrowInvalidWriteToSignalError(fn) {
  throwInvalidWriteToSignalErrorFn = fn;
}
var postSignalSetFn = null;
function createSignal(initialValue, equal) {
  const node = Object.create(SIGNAL_NODE);
  node.value = initialValue;
  if (equal !== void 0) {
    node.equal = equal;
  }
  const getter = () => signalGetFn(node);
  getter[SIGNAL] = node;
  if (typeof ngDevMode !== "undefined" && ngDevMode) {
    const debugName = node.debugName ? " (" + node.debugName + ")" : "";
    getter.toString = () => `[Signal${debugName}: ${node.value}]`;
  }
  runPostProducerCreatedFn(node);
  const set2 = (newValue) => signalSetFn(node, newValue);
  const update = (updateFn) => signalUpdateFn(node, updateFn);
  return [getter, set2, update];
}
function signalGetFn(node) {
  producerAccessed(node);
  return node.value;
}
function signalSetFn(node, newValue) {
  if (!producerUpdatesAllowed()) {
    throwInvalidWriteToSignalError(node);
  }
  if (!node.equal(node.value, newValue)) {
    node.value = newValue;
    signalValueChanged(node);
  }
}
function signalUpdateFn(node, updater) {
  if (!producerUpdatesAllowed()) {
    throwInvalidWriteToSignalError(node);
  }
  signalSetFn(node, updater(node.value));
}
var SIGNAL_NODE = /* @__PURE__ */ (() => {
  return __spreadProps(__spreadValues({}, REACTIVE_NODE), {
    equal: defaultEquals,
    value: void 0,
    kind: "signal"
  });
})();
function signalValueChanged(node) {
  node.version++;
  producerIncrementEpoch();
  producerNotifyConsumers(node);
  postSignalSetFn?.(node);
}

// node_modules/rxjs/dist/esm/internal/util/isFunction.js
function isFunction(value) {
  return typeof value === "function";
}

// node_modules/rxjs/dist/esm/internal/util/createErrorClass.js
function createErrorClass(createImpl) {
  const _super = (instance) => {
    Error.call(instance);
    instance.stack = new Error().stack;
  };
  const ctorFunc = createImpl(_super);
  ctorFunc.prototype = Object.create(Error.prototype);
  ctorFunc.prototype.constructor = ctorFunc;
  return ctorFunc;
}

// node_modules/rxjs/dist/esm/internal/util/UnsubscriptionError.js
var UnsubscriptionError = createErrorClass((_super) => function UnsubscriptionErrorImpl(errors) {
  _super(this);
  this.message = errors ? `${errors.length} errors occurred during unsubscription:
${errors.map((err, i) => `${i + 1}) ${err.toString()}`).join("\n  ")}` : "";
  this.name = "UnsubscriptionError";
  this.errors = errors;
});

// node_modules/rxjs/dist/esm/internal/util/arrRemove.js
function arrRemove(arr, item) {
  if (arr) {
    const index = arr.indexOf(item);
    0 <= index && arr.splice(index, 1);
  }
}

// node_modules/rxjs/dist/esm/internal/Subscription.js
var Subscription = class _Subscription {
  constructor(initialTeardown) {
    this.initialTeardown = initialTeardown;
    this.closed = false;
    this._parentage = null;
    this._finalizers = null;
  }
  unsubscribe() {
    let errors;
    if (!this.closed) {
      this.closed = true;
      const { _parentage } = this;
      if (_parentage) {
        this._parentage = null;
        if (Array.isArray(_parentage)) {
          for (const parent of _parentage) {
            parent.remove(this);
          }
        } else {
          _parentage.remove(this);
        }
      }
      const { initialTeardown: initialFinalizer } = this;
      if (isFunction(initialFinalizer)) {
        try {
          initialFinalizer();
        } catch (e) {
          errors = e instanceof UnsubscriptionError ? e.errors : [e];
        }
      }
      const { _finalizers } = this;
      if (_finalizers) {
        this._finalizers = null;
        for (const finalizer of _finalizers) {
          try {
            execFinalizer(finalizer);
          } catch (err) {
            errors = errors !== null && errors !== void 0 ? errors : [];
            if (err instanceof UnsubscriptionError) {
              errors = [...errors, ...err.errors];
            } else {
              errors.push(err);
            }
          }
        }
      }
      if (errors) {
        throw new UnsubscriptionError(errors);
      }
    }
  }
  add(teardown) {
    var _a;
    if (teardown && teardown !== this) {
      if (this.closed) {
        execFinalizer(teardown);
      } else {
        if (teardown instanceof _Subscription) {
          if (teardown.closed || teardown._hasParent(this)) {
            return;
          }
          teardown._addParent(this);
        }
        (this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
      }
    }
  }
  _hasParent(parent) {
    const { _parentage } = this;
    return _parentage === parent || Array.isArray(_parentage) && _parentage.includes(parent);
  }
  _addParent(parent) {
    const { _parentage } = this;
    this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
  }
  _removeParent(parent) {
    const { _parentage } = this;
    if (_parentage === parent) {
      this._parentage = null;
    } else if (Array.isArray(_parentage)) {
      arrRemove(_parentage, parent);
    }
  }
  remove(teardown) {
    const { _finalizers } = this;
    _finalizers && arrRemove(_finalizers, teardown);
    if (teardown instanceof _Subscription) {
      teardown._removeParent(this);
    }
  }
};
Subscription.EMPTY = (() => {
  const empty = new Subscription();
  empty.closed = true;
  return empty;
})();
var EMPTY_SUBSCRIPTION = Subscription.EMPTY;
function isSubscription(value) {
  return value instanceof Subscription || value && "closed" in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe);
}
function execFinalizer(finalizer) {
  if (isFunction(finalizer)) {
    finalizer();
  } else {
    finalizer.unsubscribe();
  }
}

// node_modules/rxjs/dist/esm/internal/config.js
var config = {
  onUnhandledError: null,
  onStoppedNotification: null,
  Promise: void 0,
  useDeprecatedSynchronousErrorHandling: false,
  useDeprecatedNextContext: false
};

// node_modules/rxjs/dist/esm/internal/scheduler/timeoutProvider.js
var timeoutProvider = {
  setTimeout(handler, timeout, ...args) {
    const { delegate } = timeoutProvider;
    if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {
      return delegate.setTimeout(handler, timeout, ...args);
    }
    return setTimeout(handler, timeout, ...args);
  },
  clearTimeout(handle) {
    const { delegate } = timeoutProvider;
    return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);
  },
  delegate: void 0
};

// node_modules/rxjs/dist/esm/internal/util/reportUnhandledError.js
function reportUnhandledError(err) {
  timeoutProvider.setTimeout(() => {
    const { onUnhandledError } = config;
    if (onUnhandledError) {
      onUnhandledError(err);
    } else {
      throw err;
    }
  });
}

// node_modules/rxjs/dist/esm/internal/util/noop.js
function noop() {
}

// node_modules/rxjs/dist/esm/internal/NotificationFactories.js
var COMPLETE_NOTIFICATION = (() => createNotification("C", void 0, void 0))();
function errorNotification(error) {
  return createNotification("E", void 0, error);
}
function nextNotification(value) {
  return createNotification("N", value, void 0);
}
function createNotification(kind, value, error) {
  return {
    kind,
    value,
    error
  };
}

// node_modules/rxjs/dist/esm/internal/util/errorContext.js
var context = null;
function errorContext(cb) {
  if (config.useDeprecatedSynchronousErrorHandling) {
    const isRoot = !context;
    if (isRoot) {
      context = { errorThrown: false, error: null };
    }
    cb();
    if (isRoot) {
      const { errorThrown, error } = context;
      context = null;
      if (errorThrown) {
        throw error;
      }
    }
  } else {
    cb();
  }
}
function captureError(err) {
  if (config.useDeprecatedSynchronousErrorHandling && context) {
    context.errorThrown = true;
    context.error = err;
  }
}

// node_modules/rxjs/dist/esm/internal/Subscriber.js
var Subscriber = class extends Subscription {
  constructor(destination) {
    super();
    this.isStopped = false;
    if (destination) {
      this.destination = destination;
      if (isSubscription(destination)) {
        destination.add(this);
      }
    } else {
      this.destination = EMPTY_OBSERVER;
    }
  }
  static create(next, error, complete) {
    return new SafeSubscriber(next, error, complete);
  }
  next(value) {
    if (this.isStopped) {
      handleStoppedNotification(nextNotification(value), this);
    } else {
      this._next(value);
    }
  }
  error(err) {
    if (this.isStopped) {
      handleStoppedNotification(errorNotification(err), this);
    } else {
      this.isStopped = true;
      this._error(err);
    }
  }
  complete() {
    if (this.isStopped) {
      handleStoppedNotification(COMPLETE_NOTIFICATION, this);
    } else {
      this.isStopped = true;
      this._complete();
    }
  }
  unsubscribe() {
    if (!this.closed) {
      this.isStopped = true;
      super.unsubscribe();
      this.destination = null;
    }
  }
  _next(value) {
    this.destination.next(value);
  }
  _error(err) {
    try {
      this.destination.error(err);
    } finally {
      this.unsubscribe();
    }
  }
  _complete() {
    try {
      this.destination.complete();
    } finally {
      this.unsubscribe();
    }
  }
};
var _bind = Function.prototype.bind;
function bind(fn, thisArg) {
  return _bind.call(fn, thisArg);
}
var ConsumerObserver = class {
  constructor(partialObserver) {
    this.partialObserver = partialObserver;
  }
  next(value) {
    const { partialObserver } = this;
    if (partialObserver.next) {
      try {
        partialObserver.next(value);
      } catch (error) {
        handleUnhandledError(error);
      }
    }
  }
  error(err) {
    const { partialObserver } = this;
    if (partialObserver.error) {
      try {
        partialObserver.error(err);
      } catch (error) {
        handleUnhandledError(error);
      }
    } else {
      handleUnhandledError(err);
    }
  }
  complete() {
    const { partialObserver } = this;
    if (partialObserver.complete) {
      try {
        partialObserver.complete();
      } catch (error) {
        handleUnhandledError(error);
      }
    }
  }
};
var SafeSubscriber = class extends Subscriber {
  constructor(observerOrNext, error, complete) {
    super();
    let partialObserver;
    if (isFunction(observerOrNext) || !observerOrNext) {
      partialObserver = {
        next: observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : void 0,
        error: error !== null && error !== void 0 ? error : void 0,
        complete: complete !== null && complete !== void 0 ? complete : void 0
      };
    } else {
      let context2;
      if (this && config.useDeprecatedNextContext) {
        context2 = Object.create(observerOrNext);
        context2.unsubscribe = () => this.unsubscribe();
        partialObserver = {
          next: observerOrNext.next && bind(observerOrNext.next, context2),
          error: observerOrNext.error && bind(observerOrNext.error, context2),
          complete: observerOrNext.complete && bind(observerOrNext.complete, context2)
        };
      } else {
        partialObserver = observerOrNext;
      }
    }
    this.destination = new ConsumerObserver(partialObserver);
  }
};
function handleUnhandledError(error) {
  if (config.useDeprecatedSynchronousErrorHandling) {
    captureError(error);
  } else {
    reportUnhandledError(error);
  }
}
function defaultErrorHandler(err) {
  throw err;
}
function handleStoppedNotification(notification, subscriber) {
  const { onStoppedNotification } = config;
  onStoppedNotification && timeoutProvider.setTimeout(() => onStoppedNotification(notification, subscriber));
}
var EMPTY_OBSERVER = {
  closed: true,
  next: noop,
  error: defaultErrorHandler,
  complete: noop
};

// node_modules/rxjs/dist/esm/internal/symbol/observable.js
var observable = (() => typeof Symbol === "function" && Symbol.observable || "@@observable")();

// node_modules/rxjs/dist/esm/internal/util/identity.js
function identity(x) {
  return x;
}

// node_modules/rxjs/dist/esm/internal/util/pipe.js
function pipe(...fns) {
  return pipeFromArray(fns);
}
function pipeFromArray(fns) {
  if (fns.length === 0) {
    return identity;
  }
  if (fns.length === 1) {
    return fns[0];
  }
  return function piped(input2) {
    return fns.reduce((prev, fn) => fn(prev), input2);
  };
}

// node_modules/rxjs/dist/esm/internal/Observable.js
var Observable = class _Observable {
  constructor(subscribe) {
    if (subscribe) {
      this._subscribe = subscribe;
    }
  }
  lift(operator) {
    const observable2 = new _Observable();
    observable2.source = this;
    observable2.operator = operator;
    return observable2;
  }
  subscribe(observerOrNext, error, complete) {
    const subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);
    errorContext(() => {
      const { operator, source } = this;
      subscriber.add(operator ? operator.call(subscriber, source) : source ? this._subscribe(subscriber) : this._trySubscribe(subscriber));
    });
    return subscriber;
  }
  _trySubscribe(sink) {
    try {
      return this._subscribe(sink);
    } catch (err) {
      sink.error(err);
    }
  }
  forEach(next, promiseCtor) {
    promiseCtor = getPromiseCtor(promiseCtor);
    return new promiseCtor((resolve, reject) => {
      const subscriber = new SafeSubscriber({
        next: (value) => {
          try {
            next(value);
          } catch (err) {
            reject(err);
            subscriber.unsubscribe();
          }
        },
        error: reject,
        complete: resolve
      });
      this.subscribe(subscriber);
    });
  }
  _subscribe(subscriber) {
    var _a;
    return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);
  }
  [observable]() {
    return this;
  }
  pipe(...operations) {
    return pipeFromArray(operations)(this);
  }
  toPromise(promiseCtor) {
    promiseCtor = getPromiseCtor(promiseCtor);
    return new promiseCtor((resolve, reject) => {
      let value;
      this.subscribe((x) => value = x, (err) => reject(err), () => resolve(value));
    });
  }
};
Observable.create = (subscribe) => {
  return new Observable(subscribe);
};
function getPromiseCtor(promiseCtor) {
  var _a;
  return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;
}
function isObserver(value) {
  return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
}
function isSubscriber(value) {
  return value && value instanceof Subscriber || isObserver(value) && isSubscription(value);
}

// node_modules/rxjs/dist/esm/internal/util/lift.js
function hasLift(source) {
  return isFunction(source === null || source === void 0 ? void 0 : source.lift);
}
function operate(init) {
  return (source) => {
    if (hasLift(source)) {
      return source.lift(function(liftedSource) {
        try {
          return init(liftedSource, this);
        } catch (err) {
          this.error(err);
        }
      });
    }
    throw new TypeError("Unable to lift unknown Observable type");
  };
}

// node_modules/rxjs/dist/esm/internal/operators/OperatorSubscriber.js
function createOperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) {
  return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize);
}
var OperatorSubscriber = class extends Subscriber {
  constructor(destination, onNext, onComplete, onError, onFinalize, shouldUnsubscribe) {
    super(destination);
    this.onFinalize = onFinalize;
    this.shouldUnsubscribe = shouldUnsubscribe;
    this._next = onNext ? function(value) {
      try {
        onNext(value);
      } catch (err) {
        destination.error(err);
      }
    } : super._next;
    this._error = onError ? function(err) {
      try {
        onError(err);
      } catch (err2) {
        destination.error(err2);
      } finally {
        this.unsubscribe();
      }
    } : super._error;
    this._complete = onComplete ? function() {
      try {
        onComplete();
      } catch (err) {
        destination.error(err);
      } finally {
        this.unsubscribe();
      }
    } : super._complete;
  }
  unsubscribe() {
    var _a;
    if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
      const { closed } = this;
      super.unsubscribe();
      !closed && ((_a = this.onFinalize) === null || _a === void 0 ? void 0 : _a.call(this));
    }
  }
};

// node_modules/rxjs/dist/esm/internal/operators/refCount.js
function refCount() {
  return operate((source, subscriber) => {
    let connection = null;
    source._refCount++;
    const refCounter = createOperatorSubscriber(subscriber, void 0, void 0, void 0, () => {
      if (!source || source._refCount <= 0 || 0 < --source._refCount) {
        connection = null;
        return;
      }
      const sharedConnection = source._connection;
      const conn = connection;
      connection = null;
      if (sharedConnection && (!conn || sharedConnection === conn)) {
        sharedConnection.unsubscribe();
      }
      subscriber.unsubscribe();
    });
    source.subscribe(refCounter);
    if (!refCounter.closed) {
      connection = source.connect();
    }
  });
}

// node_modules/rxjs/dist/esm/internal/observable/ConnectableObservable.js
var ConnectableObservable = class extends Observable {
  constructor(source, subjectFactory) {
    super();
    this.source = source;
    this.subjectFactory = subjectFactory;
    this._subject = null;
    this._refCount = 0;
    this._connection = null;
    if (hasLift(source)) {
      this.lift = source.lift;
    }
  }
  _subscribe(subscriber) {
    return this.getSubject().subscribe(subscriber);
  }
  getSubject() {
    const subject = this._subject;
    if (!subject || subject.isStopped) {
      this._subject = this.subjectFactory();
    }
    return this._subject;
  }
  _teardown() {
    this._refCount = 0;
    const { _connection } = this;
    this._subject = this._connection = null;
    _connection === null || _connection === void 0 ? void 0 : _connection.unsubscribe();
  }
  connect() {
    let connection = this._connection;
    if (!connection) {
      connection = this._connection = new Subscription();
      const subject = this.getSubject();
      connection.add(this.source.subscribe(createOperatorSubscriber(subject, void 0, () => {
        this._teardown();
        subject.complete();
      }, (err) => {
        this._teardown();
        subject.error(err);
      }, () => this._teardown())));
      if (connection.closed) {
        this._connection = null;
        connection = Subscription.EMPTY;
      }
    }
    return connection;
  }
  refCount() {
    return refCount()(this);
  }
};

// node_modules/rxjs/dist/esm/internal/scheduler/animationFrameProvider.js
var animationFrameProvider = {
  schedule(callback) {
    let request = requestAnimationFrame;
    let cancel = cancelAnimationFrame;
    const { delegate } = animationFrameProvider;
    if (delegate) {
      request = delegate.requestAnimationFrame;
      cancel = delegate.cancelAnimationFrame;
    }
    const handle = request((timestamp2) => {
      cancel = void 0;
      callback(timestamp2);
    });
    return new Subscription(() => cancel === null || cancel === void 0 ? void 0 : cancel(handle));
  },
  requestAnimationFrame(...args) {
    const { delegate } = animationFrameProvider;
    return ((delegate === null || delegate === void 0 ? void 0 : delegate.requestAnimationFrame) || requestAnimationFrame)(...args);
  },
  cancelAnimationFrame(...args) {
    const { delegate } = animationFrameProvider;
    return ((delegate === null || delegate === void 0 ? void 0 : delegate.cancelAnimationFrame) || cancelAnimationFrame)(...args);
  },
  delegate: void 0
};

// node_modules/rxjs/dist/esm/internal/util/ObjectUnsubscribedError.js
var ObjectUnsubscribedError = createErrorClass((_super) => function ObjectUnsubscribedErrorImpl() {
  _super(this);
  this.name = "ObjectUnsubscribedError";
  this.message = "object unsubscribed";
});

// node_modules/rxjs/dist/esm/internal/Subject.js
var Subject = class extends Observable {
  constructor() {
    super();
    this.closed = false;
    this.currentObservers = null;
    this.observers = [];
    this.isStopped = false;
    this.hasError = false;
    this.thrownError = null;
  }
  lift(operator) {
    const subject = new AnonymousSubject(this, this);
    subject.operator = operator;
    return subject;
  }
  _throwIfClosed() {
    if (this.closed) {
      throw new ObjectUnsubscribedError();
    }
  }
  next(value) {
    errorContext(() => {
      this._throwIfClosed();
      if (!this.isStopped) {
        if (!this.currentObservers) {
          this.currentObservers = Array.from(this.observers);
        }
        for (const observer of this.currentObservers) {
          observer.next(value);
        }
      }
    });
  }
  error(err) {
    errorContext(() => {
      this._throwIfClosed();
      if (!this.isStopped) {
        this.hasError = this.isStopped = true;
        this.thrownError = err;
        const { observers } = this;
        while (observers.length) {
          observers.shift().error(err);
        }
      }
    });
  }
  complete() {
    errorContext(() => {
      this._throwIfClosed();
      if (!this.isStopped) {
        this.isStopped = true;
        const { observers } = this;
        while (observers.length) {
          observers.shift().complete();
        }
      }
    });
  }
  unsubscribe() {
    this.isStopped = this.closed = true;
    this.observers = this.currentObservers = null;
  }
  get observed() {
    var _a;
    return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0;
  }
  _trySubscribe(subscriber) {
    this._throwIfClosed();
    return super._trySubscribe(subscriber);
  }
  _subscribe(subscriber) {
    this._throwIfClosed();
    this._checkFinalizedStatuses(subscriber);
    return this._innerSubscribe(subscriber);
  }
  _innerSubscribe(subscriber) {
    const { hasError, isStopped, observers } = this;
    if (hasError || isStopped) {
      return EMPTY_SUBSCRIPTION;
    }
    this.currentObservers = null;
    observers.push(subscriber);
    return new Subscription(() => {
      this.currentObservers = null;
      arrRemove(observers, subscriber);
    });
  }
  _checkFinalizedStatuses(subscriber) {
    const { hasError, thrownError, isStopped } = this;
    if (hasError) {
      subscriber.error(thrownError);
    } else if (isStopped) {
      subscriber.complete();
    }
  }
  asObservable() {
    const observable2 = new Observable();
    observable2.source = this;
    return observable2;
  }
};
Subject.create = (destination, source) => {
  return new AnonymousSubject(destination, source);
};
var AnonymousSubject = class extends Subject {
  constructor(destination, source) {
    super();
    this.destination = destination;
    this.source = source;
  }
  next(value) {
    var _a, _b;
    (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value);
  }
  error(err) {
    var _a, _b;
    (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err);
  }
  complete() {
    var _a, _b;
    (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 ? void 0 : _b.call(_a);
  }
  _subscribe(subscriber) {
    var _a, _b;
    return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION;
  }
};

// node_modules/rxjs/dist/esm/internal/BehaviorSubject.js
var BehaviorSubject = class extends Subject {
  constructor(_value) {
    super();
    this._value = _value;
  }
  get value() {
    return this.getValue();
  }
  _subscribe(subscriber) {
    const subscription = super._subscribe(subscriber);
    !subscription.closed && subscriber.next(this._value);
    return subscription;
  }
  getValue() {
    const { hasError, thrownError, _value } = this;
    if (hasError) {
      throw thrownError;
    }
    this._throwIfClosed();
    return _value;
  }
  next(value) {
    super.next(this._value = value);
  }
};

// node_modules/rxjs/dist/esm/internal/scheduler/dateTimestampProvider.js
var dateTimestampProvider = {
  now() {
    return (dateTimestampProvider.delegate || Date).now();
  },
  delegate: void 0
};

// node_modules/rxjs/dist/esm/internal/ReplaySubject.js
var ReplaySubject = class extends Subject {
  constructor(_bufferSize = Infinity, _windowTime = Infinity, _timestampProvider = dateTimestampProvider) {
    super();
    this._bufferSize = _bufferSize;
    this._windowTime = _windowTime;
    this._timestampProvider = _timestampProvider;
    this._buffer = [];
    this._infiniteTimeWindow = true;
    this._infiniteTimeWindow = _windowTime === Infinity;
    this._bufferSize = Math.max(1, _bufferSize);
    this._windowTime = Math.max(1, _windowTime);
  }
  next(value) {
    const { isStopped, _buffer, _infiniteTimeWindow, _timestampProvider, _windowTime } = this;
    if (!isStopped) {
      _buffer.push(value);
      !_infiniteTimeWindow && _buffer.push(_timestampProvider.now() + _windowTime);
    }
    this._trimBuffer();
    super.next(value);
  }
  _subscribe(subscriber) {
    this._throwIfClosed();
    this._trimBuffer();
    const subscription = this._innerSubscribe(subscriber);
    const { _infiniteTimeWindow, _buffer } = this;
    const copy = _buffer.slice();
    for (let i = 0; i < copy.length && !subscriber.closed; i += _infiniteTimeWindow ? 1 : 2) {
      subscriber.next(copy[i]);
    }
    this._checkFinalizedStatuses(subscriber);
    return subscription;
  }
  _trimBuffer() {
    const { _bufferSize, _timestampProvider, _buffer, _infiniteTimeWindow } = this;
    const adjustedBufferSize = (_infiniteTimeWindow ? 1 : 2) * _bufferSize;
    _bufferSize < Infinity && adjustedBufferSize < _buffer.length && _buffer.splice(0, _buffer.length - adjustedBufferSize);
    if (!_infiniteTimeWindow) {
      const now = _timestampProvider.now();
      let last4 = 0;
      for (let i = 1; i < _buffer.length && _buffer[i] <= now; i += 2) {
        last4 = i;
      }
      last4 && _buffer.splice(0, last4 + 1);
    }
  }
};

// node_modules/rxjs/dist/esm/internal/scheduler/Action.js
var Action = class extends Subscription {
  constructor(scheduler, work) {
    super();
  }
  schedule(state, delay = 0) {
    return this;
  }
};

// node_modules/rxjs/dist/esm/internal/scheduler/intervalProvider.js
var intervalProvider = {
  setInterval(handler, timeout, ...args) {
    const { delegate } = intervalProvider;
    if (delegate === null || delegate === void 0 ? void 0 : delegate.setInterval) {
      return delegate.setInterval(handler, timeout, ...args);
    }
    return setInterval(handler, timeout, ...args);
  },
  clearInterval(handle) {
    const { delegate } = intervalProvider;
    return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearInterval) || clearInterval)(handle);
  },
  delegate: void 0
};

// node_modules/rxjs/dist/esm/internal/scheduler/AsyncAction.js
var AsyncAction = class extends Action {
  constructor(scheduler, work) {
    super(scheduler, work);
    this.scheduler = scheduler;
    this.work = work;
    this.pending = false;
  }
  schedule(state, delay = 0) {
    var _a;
    if (this.closed) {
      return this;
    }
    this.state = state;
    const id = this.id;
    const scheduler = this.scheduler;
    if (id != null) {
      this.id = this.recycleAsyncId(scheduler, id, delay);
    }
    this.pending = true;
    this.delay = delay;
    this.id = (_a = this.id) !== null && _a !== void 0 ? _a : this.requestAsyncId(scheduler, this.id, delay);
    return this;
  }
  requestAsyncId(scheduler, _id, delay = 0) {
    return intervalProvider.setInterval(scheduler.flush.bind(scheduler, this), delay);
  }
  recycleAsyncId(_scheduler, id, delay = 0) {
    if (delay != null && this.delay === delay && this.pending === false) {
      return id;
    }
    if (id != null) {
      intervalProvider.clearInterval(id);
    }
    return void 0;
  }
  execute(state, delay) {
    if (this.closed) {
      return new Error("executing a cancelled action");
    }
    this.pending = false;
    const error = this._execute(state, delay);
    if (error) {
      return error;
    } else if (this.pending === false && this.id != null) {
      this.id = this.recycleAsyncId(this.scheduler, this.id, null);
    }
  }
  _execute(state, _delay) {
    let errored = false;
    let errorValue;
    try {
      this.work(state);
    } catch (e) {
      errored = true;
      errorValue = e ? e : new Error("Scheduled action threw falsy error");
    }
    if (errored) {
      this.unsubscribe();
      return errorValue;
    }
  }
  unsubscribe() {
    if (!this.closed) {
      const { id, scheduler } = this;
      const { actions } = scheduler;
      this.work = this.state = this.scheduler = null;
      this.pending = false;
      arrRemove(actions, this);
      if (id != null) {
        this.id = this.recycleAsyncId(scheduler, id, null);
      }
      this.delay = null;
      super.unsubscribe();
    }
  }
};

// node_modules/rxjs/dist/esm/internal/util/Immediate.js
var nextHandle = 1;
var resolved;
var activeHandles = {};
function findAndClearHandle(handle) {
  if (handle in activeHandles) {
    delete activeHandles[handle];
    return true;
  }
  return false;
}
var Immediate = {
  setImmediate(cb) {
    const handle = nextHandle++;
    activeHandles[handle] = true;
    if (!resolved) {
      resolved = Promise.resolve();
    }
    resolved.then(() => findAndClearHandle(handle) && cb());
    return handle;
  },
  clearImmediate(handle) {
    findAndClearHandle(handle);
  }
};

// node_modules/rxjs/dist/esm/internal/scheduler/immediateProvider.js
var { setImmediate: setImmediate2, clearImmediate } = Immediate;
var immediateProvider = {
  setImmediate(...args) {
    const { delegate } = immediateProvider;
    return ((delegate === null || delegate === void 0 ? void 0 : delegate.setImmediate) || setImmediate2)(...args);
  },
  clearImmediate(handle) {
    const { delegate } = immediateProvider;
    return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearImmediate) || clearImmediate)(handle);
  },
  delegate: void 0
};

// node_modules/rxjs/dist/esm/internal/scheduler/AsapAction.js
var AsapAction = class extends AsyncAction {
  constructor(scheduler, work) {
    super(scheduler, work);
    this.scheduler = scheduler;
    this.work = work;
  }
  requestAsyncId(scheduler, id, delay = 0) {
    if (delay !== null && delay > 0) {
      return super.requestAsyncId(scheduler, id, delay);
    }
    scheduler.actions.push(this);
    return scheduler._scheduled || (scheduler._scheduled = immediateProvider.setImmediate(scheduler.flush.bind(scheduler, void 0)));
  }
  recycleAsyncId(scheduler, id, delay = 0) {
    var _a;
    if (delay != null ? delay > 0 : this.delay > 0) {
      return super.recycleAsyncId(scheduler, id, delay);
    }
    const { actions } = scheduler;
    if (id != null && ((_a = actions[actions.length - 1]) === null || _a === void 0 ? void 0 : _a.id) !== id) {
      immediateProvider.clearImmediate(id);
      if (scheduler._scheduled === id) {
        scheduler._scheduled = void 0;
      }
    }
    return void 0;
  }
};

// node_modules/rxjs/dist/esm/internal/Scheduler.js
var Scheduler = class _Scheduler {
  constructor(schedulerActionCtor, now = _Scheduler.now) {
    this.schedulerActionCtor = schedulerActionCtor;
    this.now = now;
  }
  schedule(work, delay = 0, state) {
    return new this.schedulerActionCtor(this, work).schedule(state, delay);
  }
};
Scheduler.now = dateTimestampProvider.now;

// node_modules/rxjs/dist/esm/internal/scheduler/AsyncScheduler.js
var AsyncScheduler = class extends Scheduler {
  constructor(SchedulerAction, now = Scheduler.now) {
    super(SchedulerAction, now);
    this.actions = [];
    this._active = false;
  }
  flush(action) {
    const { actions } = this;
    if (this._active) {
      actions.push(action);
      return;
    }
    let error;
    this._active = true;
    do {
      if (error = action.execute(action.state, action.delay)) {
        break;
      }
    } while (action = actions.shift());
    this._active = false;
    if (error) {
      while (action = actions.shift()) {
        action.unsubscribe();
      }
      throw error;
    }
  }
};

// node_modules/rxjs/dist/esm/internal/scheduler/AsapScheduler.js
var AsapScheduler = class extends AsyncScheduler {
  flush(action) {
    this._active = true;
    const flushId = this._scheduled;
    this._scheduled = void 0;
    const { actions } = this;
    let error;
    action = action || actions.shift();
    do {
      if (error = action.execute(action.state, action.delay)) {
        break;
      }
    } while ((action = actions[0]) && action.id === flushId && actions.shift());
    this._active = false;
    if (error) {
      while ((action = actions[0]) && action.id === flushId && actions.shift()) {
        action.unsubscribe();
      }
      throw error;
    }
  }
};

// node_modules/rxjs/dist/esm/internal/scheduler/asap.js
var asapScheduler = new AsapScheduler(AsapAction);

// node_modules/rxjs/dist/esm/internal/scheduler/async.js
var asyncScheduler = new AsyncScheduler(AsyncAction);
var async = asyncScheduler;

// node_modules/rxjs/dist/esm/internal/scheduler/AnimationFrameAction.js
var AnimationFrameAction = class extends AsyncAction {
  constructor(scheduler, work) {
    super(scheduler, work);
    this.scheduler = scheduler;
    this.work = work;
  }
  requestAsyncId(scheduler, id, delay = 0) {
    if (delay !== null && delay > 0) {
      return super.requestAsyncId(scheduler, id, delay);
    }
    scheduler.actions.push(this);
    return scheduler._scheduled || (scheduler._scheduled = animationFrameProvider.requestAnimationFrame(() => scheduler.flush(void 0)));
  }
  recycleAsyncId(scheduler, id, delay = 0) {
    var _a;
    if (delay != null ? delay > 0 : this.delay > 0) {
      return super.recycleAsyncId(scheduler, id, delay);
    }
    const { actions } = scheduler;
    if (id != null && id === scheduler._scheduled && ((_a = actions[actions.length - 1]) === null || _a === void 0 ? void 0 : _a.id) !== id) {
      animationFrameProvider.cancelAnimationFrame(id);
      scheduler._scheduled = void 0;
    }
    return void 0;
  }
};

// node_modules/rxjs/dist/esm/internal/scheduler/AnimationFrameScheduler.js
var AnimationFrameScheduler = class extends AsyncScheduler {
  flush(action) {
    this._active = true;
    let flushId;
    if (action) {
      flushId = action.id;
    } else {
      flushId = this._scheduled;
      this._scheduled = void 0;
    }
    const { actions } = this;
    let error;
    action = action || actions.shift();
    do {
      if (error = action.execute(action.state, action.delay)) {
        break;
      }
    } while ((action = actions[0]) && action.id === flushId && actions.shift());
    this._active = false;
    if (error) {
      while ((action = actions[0]) && action.id === flushId && actions.shift()) {
        action.unsubscribe();
      }
      throw error;
    }
  }
};

// node_modules/rxjs/dist/esm/internal/scheduler/animationFrame.js
var animationFrameScheduler = new AnimationFrameScheduler(AnimationFrameAction);

// node_modules/rxjs/dist/esm/internal/observable/empty.js
var EMPTY = new Observable((subscriber) => subscriber.complete());

// node_modules/rxjs/dist/esm/internal/util/isScheduler.js
function isScheduler(value) {
  return value && isFunction(value.schedule);
}

// node_modules/rxjs/dist/esm/internal/util/args.js
function last(arr) {
  return arr[arr.length - 1];
}
function popResultSelector(args) {
  return isFunction(last(args)) ? args.pop() : void 0;
}
function popScheduler(args) {
  return isScheduler(last(args)) ? args.pop() : void 0;
}
function popNumber(args, defaultValue) {
  return typeof last(args) === "number" ? args.pop() : defaultValue;
}

// node_modules/tslib/tslib.es6.mjs
function __awaiter(thisArg, _arguments, P2, generator) {
  function adopt(value) {
    return value instanceof P2 ? value : new P2(function(resolve) {
      resolve(value);
    });
  }
  return new (P2 || (P2 = Promise))(function(resolve, reject) {
    function fulfilled(value) {
      try {
        step(generator.next(value));
      } catch (e) {
        reject(e);
      }
    }
    function rejected(value) {
      try {
        step(generator["throw"](value));
      } catch (e) {
        reject(e);
      }
    }
    function step(result) {
      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
    }
    step((generator = generator.apply(thisArg, _arguments || [])).next());
  });
}
function __values(o) {
  var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
  if (m) return m.call(o);
  if (o && typeof o.length === "number") return {
    next: function() {
      if (o && i >= o.length) o = void 0;
      return { value: o && o[i++], done: !o };
    }
  };
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
function __await(v) {
  return this instanceof __await ? (this.v = v, this) : new __await(v);
}
function __asyncGenerator(thisArg, _arguments, generator) {
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  var g = generator.apply(thisArg, _arguments || []), i, q = [];
  return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() {
    return this;
  }, i;
  function awaitReturn(f) {
    return function(v) {
      return Promise.resolve(v).then(f, reject);
    };
  }
  function verb(n, f) {
    if (g[n]) {
      i[n] = function(v) {
        return new Promise(function(a, b) {
          q.push([n, v, a, b]) > 1 || resume(n, v);
        });
      };
      if (f) i[n] = f(i[n]);
    }
  }
  function resume(n, v) {
    try {
      step(g[n](v));
    } catch (e) {
      settle(q[0][3], e);
    }
  }
  function step(r) {
    r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
  }
  function fulfill(value) {
    resume("next", value);
  }
  function reject(value) {
    resume("throw", value);
  }
  function settle(f, v) {
    if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);
  }
}
function __asyncValues(o) {
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  var m = o[Symbol.asyncIterator], i;
  return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
    return this;
  }, i);
  function verb(n) {
    i[n] = o[n] && function(v) {
      return new Promise(function(resolve, reject) {
        v = o[n](v), settle(resolve, reject, v.done, v.value);
      });
    };
  }
  function settle(resolve, reject, d, v) {
    Promise.resolve(v).then(function(v2) {
      resolve({ value: v2, done: d });
    }, reject);
  }
}

// node_modules/rxjs/dist/esm/internal/util/isArrayLike.js
var isArrayLike = (x) => x && typeof x.length === "number" && typeof x !== "function";

// node_modules/rxjs/dist/esm/internal/util/isPromise.js
function isPromise(value) {
  return isFunction(value === null || value === void 0 ? void 0 : value.then);
}

// node_modules/rxjs/dist/esm/internal/util/isInteropObservable.js
function isInteropObservable(input2) {
  return isFunction(input2[observable]);
}

// node_modules/rxjs/dist/esm/internal/util/isAsyncIterable.js
function isAsyncIterable(obj) {
  return Symbol.asyncIterator && isFunction(obj === null || obj === void 0 ? void 0 : obj[Symbol.asyncIterator]);
}

// node_modules/rxjs/dist/esm/internal/util/throwUnobservableError.js
function createInvalidObservableTypeError(input2) {
  return new TypeError(`You provided ${input2 !== null && typeof input2 === "object" ? "an invalid object" : `'${input2}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`);
}

// node_modules/rxjs/dist/esm/internal/symbol/iterator.js
function getSymbolIterator() {
  if (typeof Symbol !== "function" || !Symbol.iterator) {
    return "@@iterator";
  }
  return Symbol.iterator;
}
var iterator = getSymbolIterator();

// node_modules/rxjs/dist/esm/internal/util/isIterable.js
function isIterable(input2) {
  return isFunction(input2 === null || input2 === void 0 ? void 0 : input2[iterator]);
}

// node_modules/rxjs/dist/esm/internal/util/isReadableStreamLike.js
function readableStreamLikeToAsyncGenerator(readableStream) {
  return __asyncGenerator(this, arguments, function* readableStreamLikeToAsyncGenerator_1() {
    const reader = readableStream.getReader();
    try {
      while (true) {
        const { value, done } = yield __await(reader.read());
        if (done) {
          return yield __await(void 0);
        }
        yield yield __await(value);
      }
    } finally {
      reader.releaseLock();
    }
  });
}
function isReadableStreamLike(obj) {
  return isFunction(obj === null || obj === void 0 ? void 0 : obj.getReader);
}

// node_modules/rxjs/dist/esm/internal/observable/innerFrom.js
function innerFrom(input2) {
  if (input2 instanceof Observable) {
    return input2;
  }
  if (input2 != null) {
    if (isInteropObservable(input2)) {
      return fromInteropObservable(input2);
    }
    if (isArrayLike(input2)) {
      return fromArrayLike(input2);
    }
    if (isPromise(input2)) {
      return fromPromise(input2);
    }
    if (isAsyncIterable(input2)) {
      return fromAsyncIterable(input2);
    }
    if (isIterable(input2)) {
      return fromIterable(input2);
    }
    if (isReadableStreamLike(input2)) {
      return fromReadableStreamLike(input2);
    }
  }
  throw createInvalidObservableTypeError(input2);
}
function fromInteropObservable(obj) {
  return new Observable((subscriber) => {
    const obs = obj[observable]();
    if (isFunction(obs.subscribe)) {
      return obs.subscribe(subscriber);
    }
    throw new TypeError("Provided object does not correctly implement Symbol.observable");
  });
}
function fromArrayLike(array) {
  return new Observable((subscriber) => {
    for (let i = 0; i < array.length && !subscriber.closed; i++) {
      subscriber.next(array[i]);
    }
    subscriber.complete();
  });
}
function fromPromise(promise) {
  return new Observable((subscriber) => {
    promise.then((value) => {
      if (!subscriber.closed) {
        subscriber.next(value);
        subscriber.complete();
      }
    }, (err) => subscriber.error(err)).then(null, reportUnhandledError);
  });
}
function fromIterable(iterable) {
  return new Observable((subscriber) => {
    for (const value of iterable) {
      subscriber.next(value);
      if (subscriber.closed) {
        return;
      }
    }
    subscriber.complete();
  });
}
function fromAsyncIterable(asyncIterable) {
  return new Observable((subscriber) => {
    process2(asyncIterable, subscriber).catch((err) => subscriber.error(err));
  });
}
function fromReadableStreamLike(readableStream) {
  return fromAsyncIterable(readableStreamLikeToAsyncGenerator(readableStream));
}
function process2(asyncIterable, subscriber) {
  var asyncIterable_1, asyncIterable_1_1;
  var e_1, _a;
  return __awaiter(this, void 0, void 0, function* () {
    try {
      for (asyncIterable_1 = __asyncValues(asyncIterable); asyncIterable_1_1 = yield asyncIterable_1.next(), !asyncIterable_1_1.done; ) {
        const value = asyncIterable_1_1.value;
        subscriber.next(value);
        if (subscriber.closed) {
          return;
        }
      }
    } catch (e_1_1) {
      e_1 = { error: e_1_1 };
    } finally {
      try {
        if (asyncIterable_1_1 && !asyncIterable_1_1.done && (_a = asyncIterable_1.return)) yield _a.call(asyncIterable_1);
      } finally {
        if (e_1) throw e_1.error;
      }
    }
    subscriber.complete();
  });
}

// node_modules/rxjs/dist/esm/internal/util/executeSchedule.js
function executeSchedule(parentSubscription, scheduler, work, delay = 0, repeat = false) {
  const scheduleSubscription = scheduler.schedule(function() {
    work();
    if (repeat) {
      parentSubscription.add(this.schedule(null, delay));
    } else {
      this.unsubscribe();
    }
  }, delay);
  parentSubscription.add(scheduleSubscription);
  if (!repeat) {
    return scheduleSubscription;
  }
}

// node_modules/rxjs/dist/esm/internal/operators/observeOn.js
function observeOn(scheduler, delay = 0) {
  return operate((source, subscriber) => {
    source.subscribe(createOperatorSubscriber(subscriber, (value) => executeSchedule(subscriber, scheduler, () => subscriber.next(value), delay), () => executeSchedule(subscriber, scheduler, () => subscriber.complete(), delay), (err) => executeSchedule(subscriber, scheduler, () => subscriber.error(err), delay)));
  });
}

// node_modules/rxjs/dist/esm/internal/operators/subscribeOn.js
function subscribeOn(scheduler, delay = 0) {
  return operate((source, subscriber) => {
    subscriber.add(scheduler.schedule(() => source.subscribe(subscriber), delay));
  });
}

// node_modules/rxjs/dist/esm/internal/scheduled/scheduleObservable.js
function scheduleObservable(input2, scheduler) {
  return innerFrom(input2).pipe(subscribeOn(scheduler), observeOn(scheduler));
}

// node_modules/rxjs/dist/esm/internal/scheduled/schedulePromise.js
function schedulePromise(input2, scheduler) {
  return innerFrom(input2).pipe(subscribeOn(scheduler), observeOn(scheduler));
}

// node_modules/rxjs/dist/esm/internal/scheduled/scheduleArray.js
function scheduleArray(input2, scheduler) {
  return new Observable((subscriber) => {
    let i = 0;
    return scheduler.schedule(function() {
      if (i === input2.length) {
        subscriber.complete();
      } else {
        subscriber.next(input2[i++]);
        if (!subscriber.closed) {
          this.schedule();
        }
      }
    });
  });
}

// node_modules/rxjs/dist/esm/internal/scheduled/scheduleIterable.js
function scheduleIterable(input2, scheduler) {
  return new Observable((subscriber) => {
    let iterator2;
    executeSchedule(subscriber, scheduler, () => {
      iterator2 = input2[iterator]();
      executeSchedule(subscriber, scheduler, () => {
        let value;
        let done;
        try {
          ({ value, done } = iterator2.next());
        } catch (err) {
          subscriber.error(err);
          return;
        }
        if (done) {
          subscriber.complete();
        } else {
          subscriber.next(value);
        }
      }, 0, true);
    });
    return () => isFunction(iterator2 === null || iterator2 === void 0 ? void 0 : iterator2.return) && iterator2.return();
  });
}

// node_modules/rxjs/dist/esm/internal/scheduled/scheduleAsyncIterable.js
function scheduleAsyncIterable(input2, scheduler) {
  if (!input2) {
    throw new Error("Iterable cannot be null");
  }
  return new Observable((subscriber) => {
    executeSchedule(subscriber, scheduler, () => {
      const iterator2 = input2[Symbol.asyncIterator]();
      executeSchedule(subscriber, scheduler, () => {
        iterator2.next().then((result) => {
          if (result.done) {
            subscriber.complete();
          } else {
            subscriber.next(result.value);
          }
        });
      }, 0, true);
    });
  });
}

// node_modules/rxjs/dist/esm/internal/scheduled/scheduleReadableStreamLike.js
function scheduleReadableStreamLike(input2, scheduler) {
  return scheduleAsyncIterable(readableStreamLikeToAsyncGenerator(input2), scheduler);
}

// node_modules/rxjs/dist/esm/internal/scheduled/scheduled.js
function scheduled(input2, scheduler) {
  if (input2 != null) {
    if (isInteropObservable(input2)) {
      return scheduleObservable(input2, scheduler);
    }
    if (isArrayLike(input2)) {
      return scheduleArray(input2, scheduler);
    }
    if (isPromise(input2)) {
      return schedulePromise(input2, scheduler);
    }
    if (isAsyncIterable(input2)) {
      return scheduleAsyncIterable(input2, scheduler);
    }
    if (isIterable(input2)) {
      return scheduleIterable(input2, scheduler);
    }
    if (isReadableStreamLike(input2)) {
      return scheduleReadableStreamLike(input2, scheduler);
    }
  }
  throw createInvalidObservableTypeError(input2);
}

// node_modules/rxjs/dist/esm/internal/observable/from.js
function from(input2, scheduler) {
  return scheduler ? scheduled(input2, scheduler) : innerFrom(input2);
}

// node_modules/rxjs/dist/esm/internal/observable/of.js
function of(...args) {
  const scheduler = popScheduler(args);
  return from(args, scheduler);
}

// node_modules/rxjs/dist/esm/internal/observable/throwError.js
function throwError(errorOrErrorFactory, scheduler) {
  const errorFactory = isFunction(errorOrErrorFactory) ? errorOrErrorFactory : () => errorOrErrorFactory;
  const init = (subscriber) => subscriber.error(errorFactory());
  return new Observable(scheduler ? (subscriber) => scheduler.schedule(init, 0, subscriber) : init);
}

// node_modules/rxjs/dist/esm/internal/util/isObservable.js
function isObservable(obj) {
  return !!obj && (obj instanceof Observable || isFunction(obj.lift) && isFunction(obj.subscribe));
}

// node_modules/rxjs/dist/esm/internal/util/EmptyError.js
var EmptyError = createErrorClass((_super) => function EmptyErrorImpl() {
  _super(this);
  this.name = "EmptyError";
  this.message = "no elements in sequence";
});

// node_modules/rxjs/dist/esm/internal/firstValueFrom.js
function firstValueFrom(source, config2) {
  const hasConfig = typeof config2 === "object";
  return new Promise((resolve, reject) => {
    const subscriber = new SafeSubscriber({
      next: (value) => {
        resolve(value);
        subscriber.unsubscribe();
      },
      error: reject,
      complete: () => {
        if (hasConfig) {
          resolve(config2.defaultValue);
        } else {
          reject(new EmptyError());
        }
      }
    });
    source.subscribe(subscriber);
  });
}

// node_modules/rxjs/dist/esm/internal/util/isDate.js
function isValidDate(value) {
  return value instanceof Date && !isNaN(value);
}

// node_modules/rxjs/dist/esm/internal/operators/map.js
function map(project, thisArg) {
  return operate((source, subscriber) => {
    let index = 0;
    source.subscribe(createOperatorSubscriber(subscriber, (value) => {
      subscriber.next(project.call(thisArg, value, index++));
    }));
  });
}

// node_modules/rxjs/dist/esm/internal/util/mapOneOrManyArgs.js
var { isArray } = Array;
function callOrApply(fn, args) {
  return isArray(args) ? fn(...args) : fn(args);
}
function mapOneOrManyArgs(fn) {
  return map((args) => callOrApply(fn, args));
}

// node_modules/rxjs/dist/esm/internal/util/argsArgArrayOrObject.js
var { isArray: isArray2 } = Array;
var { getPrototypeOf, prototype: objectProto, keys: getKeys } = Object;
function argsArgArrayOrObject(args) {
  if (args.length === 1) {
    const first2 = args[0];
    if (isArray2(first2)) {
      return { args: first2, keys: null };
    }
    if (isPOJO(first2)) {
      const keys = getKeys(first2);
      return {
        args: keys.map((key) => first2[key]),
        keys
      };
    }
  }
  return { args, keys: null };
}
function isPOJO(obj) {
  return obj && typeof obj === "object" && getPrototypeOf(obj) === objectProto;
}

// node_modules/rxjs/dist/esm/internal/util/createObject.js
function createObject(keys, values) {
  return keys.reduce((result, key, i) => (result[key] = values[i], result), {});
}

// node_modules/rxjs/dist/esm/internal/observable/combineLatest.js
function combineLatest(...args) {
  const scheduler = popScheduler(args);
  const resultSelector = popResultSelector(args);
  const { args: observables, keys } = argsArgArrayOrObject(args);
  if (observables.length === 0) {
    return from([], scheduler);
  }
  const result = new Observable(combineLatestInit(observables, scheduler, keys ? (values) => createObject(keys, values) : identity));
  return resultSelector ? result.pipe(mapOneOrManyArgs(resultSelector)) : result;
}
function combineLatestInit(observables, scheduler, valueTransform = identity) {
  return (subscriber) => {
    maybeSchedule(scheduler, () => {
      const { length } = observables;
      const values = new Array(length);
      let active = length;
      let remainingFirstValues = length;
      for (let i = 0; i < length; i++) {
        maybeSchedule(scheduler, () => {
          const source = from(observables[i], scheduler);
          let hasFirstValue = false;
          source.subscribe(createOperatorSubscriber(subscriber, (value) => {
            values[i] = value;
            if (!hasFirstValue) {
              hasFirstValue = true;
              remainingFirstValues--;
            }
            if (!remainingFirstValues) {
              subscriber.next(valueTransform(values.slice()));
            }
          }, () => {
            if (!--active) {
              subscriber.complete();
            }
          }));
        }, subscriber);
      }
    }, subscriber);
  };
}
function maybeSchedule(scheduler, execute, subscription) {
  if (scheduler) {
    executeSchedule(subscription, scheduler, execute);
  } else {
    execute();
  }
}

// node_modules/rxjs/dist/esm/internal/operators/mergeInternals.js
function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, expand, innerSubScheduler, additionalFinalizer) {
  const buffer = [];
  let active = 0;
  let index = 0;
  let isComplete = false;
  const checkComplete = () => {
    if (isComplete && !buffer.length && !active) {
      subscriber.complete();
    }
  };
  const outerNext = (value) => active < concurrent ? doInnerSub(value) : buffer.push(value);
  const doInnerSub = (value) => {
    expand && subscriber.next(value);
    active++;
    let innerComplete = false;
    innerFrom(project(value, index++)).subscribe(createOperatorSubscriber(subscriber, (innerValue) => {
      onBeforeNext === null || onBeforeNext === void 0 ? void 0 : onBeforeNext(innerValue);
      if (expand) {
        outerNext(innerValue);
      } else {
        subscriber.next(innerValue);
      }
    }, () => {
      innerComplete = true;
    }, void 0, () => {
      if (innerComplete) {
        try {
          active--;
          while (buffer.length && active < concurrent) {
            const bufferedValue = buffer.shift();
            if (innerSubScheduler) {
              executeSchedule(subscriber, innerSubScheduler, () => doInnerSub(bufferedValue));
            } else {
              doInnerSub(bufferedValue);
            }
          }
          checkComplete();
        } catch (err) {
          subscriber.error(err);
        }
      }
    }));
  };
  source.subscribe(createOperatorSubscriber(subscriber, outerNext, () => {
    isComplete = true;
    checkComplete();
  }));
  return () => {
    additionalFinalizer === null || additionalFinalizer === void 0 ? void 0 : additionalFinalizer();
  };
}

// node_modules/rxjs/dist/esm/internal/operators/mergeMap.js
function mergeMap(project, resultSelector, concurrent = Infinity) {
  if (isFunction(resultSelector)) {
    return mergeMap((a, i) => map((b, ii) => resultSelector(a, b, i, ii))(innerFrom(project(a, i))), concurrent);
  } else if (typeof resultSelector === "number") {
    concurrent = resultSelector;
  }
  return operate((source, subscriber) => mergeInternals(source, subscriber, project, concurrent));
}

// node_modules/rxjs/dist/esm/internal/operators/mergeAll.js
function mergeAll(concurrent = Infinity) {
  return mergeMap(identity, concurrent);
}

// node_modules/rxjs/dist/esm/internal/operators/concatAll.js
function concatAll() {
  return mergeAll(1);
}

// node_modules/rxjs/dist/esm/internal/observable/concat.js
function concat(...args) {
  return concatAll()(from(args, popScheduler(args)));
}

// node_modules/rxjs/dist/esm/internal/observable/defer.js
function defer(observableFactory) {
  return new Observable((subscriber) => {
    innerFrom(observableFactory()).subscribe(subscriber);
  });
}

// node_modules/rxjs/dist/esm/internal/observable/forkJoin.js
function forkJoin(...args) {
  const resultSelector = popResultSelector(args);
  const { args: sources, keys } = argsArgArrayOrObject(args);
  const result = new Observable((subscriber) => {
    const { length } = sources;
    if (!length) {
      subscriber.complete();
      return;
    }
    const values = new Array(length);
    let remainingCompletions = length;
    let remainingEmissions = length;
    for (let sourceIndex = 0; sourceIndex < length; sourceIndex++) {
      let hasValue = false;
      innerFrom(sources[sourceIndex]).subscribe(createOperatorSubscriber(subscriber, (value) => {
        if (!hasValue) {
          hasValue = true;
          remainingEmissions--;
        }
        values[sourceIndex] = value;
      }, () => remainingCompletions--, void 0, () => {
        if (!remainingCompletions || !hasValue) {
          if (!remainingEmissions) {
            subscriber.next(keys ? createObject(keys, values) : values);
          }
          subscriber.complete();
        }
      }));
    }
  });
  return resultSelector ? result.pipe(mapOneOrManyArgs(resultSelector)) : result;
}

// node_modules/rxjs/dist/esm/internal/observable/timer.js
function timer(dueTime = 0, intervalOrScheduler, scheduler = async) {
  let intervalDuration = -1;
  if (intervalOrScheduler != null) {
    if (isScheduler(intervalOrScheduler)) {
      scheduler = intervalOrScheduler;
    } else {
      intervalDuration = intervalOrScheduler;
    }
  }
  return new Observable((subscriber) => {
    let due = isValidDate(dueTime) ? +dueTime - scheduler.now() : dueTime;
    if (due < 0) {
      due = 0;
    }
    let n = 0;
    return scheduler.schedule(function() {
      if (!subscriber.closed) {
        subscriber.next(n++);
        if (0 <= intervalDuration) {
          this.schedule(void 0, intervalDuration);
        } else {
          subscriber.complete();
        }
      }
    }, due);
  });
}

// node_modules/rxjs/dist/esm/internal/observable/merge.js
function merge(...args) {
  const scheduler = popScheduler(args);
  const concurrent = popNumber(args, Infinity);
  const sources = args;
  return !sources.length ? EMPTY : sources.length === 1 ? innerFrom(sources[0]) : mergeAll(concurrent)(from(sources, scheduler));
}

// node_modules/rxjs/dist/esm/internal/operators/filter.js
function filter(predicate, thisArg) {
  return operate((source, subscriber) => {
    let index = 0;
    source.subscribe(createOperatorSubscriber(subscriber, (value) => predicate.call(thisArg, value, index++) && subscriber.next(value)));
  });
}

// node_modules/rxjs/dist/esm/internal/operators/audit.js
function audit(durationSelector) {
  return operate((source, subscriber) => {
    let hasValue = false;
    let lastValue = null;
    let durationSubscriber = null;
    let isComplete = false;
    const endDuration = () => {
      durationSubscriber === null || durationSubscriber === void 0 ? void 0 : durationSubscriber.unsubscribe();
      durationSubscriber = null;
      if (hasValue) {
        hasValue = false;
        const value = lastValue;
        lastValue = null;
        subscriber.next(value);
      }
      isComplete && subscriber.complete();
    };
    const cleanupDuration = () => {
      durationSubscriber = null;
      isComplete && subscriber.complete();
    };
    source.subscribe(createOperatorSubscriber(subscriber, (value) => {
      hasValue = true;
      lastValue = value;
      if (!durationSubscriber) {
        innerFrom(durationSelector(value)).subscribe(durationSubscriber = createOperatorSubscriber(subscriber, endDuration, cleanupDuration));
      }
    }, () => {
      isComplete = true;
      (!hasValue || !durationSubscriber || durationSubscriber.closed) && subscriber.complete();
    }));
  });
}

// node_modules/rxjs/dist/esm/internal/operators/auditTime.js
function auditTime(duration, scheduler = asyncScheduler) {
  return audit(() => timer(duration, scheduler));
}

// node_modules/rxjs/dist/esm/internal/operators/catchError.js
function catchError(selector) {
  return operate((source, subscriber) => {
    let innerSub = null;
    let syncUnsub = false;
    let handledResult;
    innerSub = source.subscribe(createOperatorSubscriber(subscriber, void 0, void 0, (err) => {
      handledResult = innerFrom(selector(err, catchError(selector)(source)));
      if (innerSub) {
        innerSub.unsubscribe();
        innerSub = null;
        handledResult.subscribe(subscriber);
      } else {
        syncUnsub = true;
      }
    }));
    if (syncUnsub) {
      innerSub.unsubscribe();
      innerSub = null;
      handledResult.subscribe(subscriber);
    }
  });
}

// node_modules/rxjs/dist/esm/internal/operators/scanInternals.js
function scanInternals(accumulator, seed, hasSeed, emitOnNext, emitBeforeComplete) {
  return (source, subscriber) => {
    let hasState = hasSeed;
    let state = seed;
    let index = 0;
    source.subscribe(createOperatorSubscriber(subscriber, (value) => {
      const i = index++;
      state = hasState ? accumulator(state, value, i) : (hasState = true, value);
      emitOnNext && subscriber.next(state);
    }, emitBeforeComplete && (() => {
      hasState && subscriber.next(state);
      subscriber.complete();
    })));
  };
}

// node_modules/rxjs/dist/esm/internal/operators/concatMap.js
function concatMap(project, resultSelector) {
  return isFunction(resultSelector) ? mergeMap(project, resultSelector, 1) : mergeMap(project, 1);
}

// node_modules/rxjs/dist/esm/internal/operators/debounceTime.js
function debounceTime(dueTime, scheduler = asyncScheduler) {
  return operate((source, subscriber) => {
    let activeTask = null;
    let lastValue = null;
    let lastTime = null;
    const emit = () => {
      if (activeTask) {
        activeTask.unsubscribe();
        activeTask = null;
        const value = lastValue;
        lastValue = null;
        subscriber.next(value);
      }
    };
    function emitWhenIdle() {
      const targetTime = lastTime + dueTime;
      const now = scheduler.now();
      if (now < targetTime) {
        activeTask = this.schedule(void 0, targetTime - now);
        subscriber.add(activeTask);
        return;
      }
      emit();
    }
    source.subscribe(createOperatorSubscriber(subscriber, (value) => {
      lastValue = value;
      lastTime = scheduler.now();
      if (!activeTask) {
        activeTask = scheduler.schedule(emitWhenIdle, dueTime);
        subscriber.add(activeTask);
      }
    }, () => {
      emit();
      subscriber.complete();
    }, void 0, () => {
      lastValue = activeTask = null;
    }));
  });
}

// node_modules/rxjs/dist/esm/internal/operators/defaultIfEmpty.js
function defaultIfEmpty(defaultValue) {
  return operate((source, subscriber) => {
    let hasValue = false;
    source.subscribe(createOperatorSubscriber(subscriber, (value) => {
      hasValue = true;
      subscriber.next(value);
    }, () => {
      if (!hasValue) {
        subscriber.next(defaultValue);
      }
      subscriber.complete();
    }));
  });
}

// node_modules/rxjs/dist/esm/internal/operators/take.js
function take(count) {
  return count <= 0 ? () => EMPTY : operate((source, subscriber) => {
    let seen = 0;
    source.subscribe(createOperatorSubscriber(subscriber, (value) => {
      if (++seen <= count) {
        subscriber.next(value);
        if (count <= seen) {
          subscriber.complete();
        }
      }
    }));
  });
}

// node_modules/rxjs/dist/esm/internal/operators/distinctUntilChanged.js
function distinctUntilChanged(comparator, keySelector = identity) {
  comparator = comparator !== null && comparator !== void 0 ? comparator : defaultCompare;
  return operate((source, subscriber) => {
    let previousKey;
    let first2 = true;
    source.subscribe(createOperatorSubscriber(subscriber, (value) => {
      const currentKey = keySelector(value);
      if (first2 || !comparator(previousKey, currentKey)) {
        first2 = false;
        previousKey = currentKey;
        subscriber.next(value);
      }
    }));
  });
}
function defaultCompare(a, b) {
  return a === b;
}

// node_modules/rxjs/dist/esm/internal/operators/throwIfEmpty.js
function throwIfEmpty(errorFactory = defaultErrorFactory) {
  return operate((source, subscriber) => {
    let hasValue = false;
    source.subscribe(createOperatorSubscriber(subscriber, (value) => {
      hasValue = true;
      subscriber.next(value);
    }, () => hasValue ? subscriber.complete() : subscriber.error(errorFactory())));
  });
}
function defaultErrorFactory() {
  return new EmptyError();
}

// node_modules/rxjs/dist/esm/internal/operators/finalize.js
function finalize(callback) {
  return operate((source, subscriber) => {
    try {
      source.subscribe(subscriber);
    } finally {
      subscriber.add(callback);
    }
  });
}

// node_modules/rxjs/dist/esm/internal/operators/first.js
function first(predicate, defaultValue) {
  const hasDefaultValue = arguments.length >= 2;
  return (source) => source.pipe(predicate ? filter((v, i) => predicate(v, i, source)) : identity, take(1), hasDefaultValue ? defaultIfEmpty(defaultValue) : throwIfEmpty(() => new EmptyError()));
}

// node_modules/rxjs/dist/esm/internal/operators/takeLast.js
function takeLast(count) {
  return count <= 0 ? () => EMPTY : operate((source, subscriber) => {
    let buffer = [];
    source.subscribe(createOperatorSubscriber(subscriber, (value) => {
      buffer.push(value);
      count < buffer.length && buffer.shift();
    }, () => {
      for (const value of buffer) {
        subscriber.next(value);
      }
      subscriber.complete();
    }, void 0, () => {
      buffer = null;
    }));
  });
}

// node_modules/rxjs/dist/esm/internal/operators/last.js
function last2(predicate, defaultValue) {
  const hasDefaultValue = arguments.length >= 2;
  return (source) => source.pipe(predicate ? filter((v, i) => predicate(v, i, source)) : identity, takeLast(1), hasDefaultValue ? defaultIfEmpty(defaultValue) : throwIfEmpty(() => new EmptyError()));
}

// node_modules/rxjs/dist/esm/internal/operators/pairwise.js
function pairwise() {
  return operate((source, subscriber) => {
    let prev;
    let hasPrev = false;
    source.subscribe(createOperatorSubscriber(subscriber, (value) => {
      const p = prev;
      prev = value;
      hasPrev && subscriber.next([p, value]);
      hasPrev = true;
    }));
  });
}

// node_modules/rxjs/dist/esm/internal/operators/scan.js
function scan(accumulator, seed) {
  return operate(scanInternals(accumulator, seed, arguments.length >= 2, true));
}

// node_modules/rxjs/dist/esm/internal/operators/share.js
function share(options = {}) {
  const { connector = () => new Subject(), resetOnError = true, resetOnComplete = true, resetOnRefCountZero = true } = options;
  return (wrapperSource) => {
    let connection;
    let resetConnection;
    let subject;
    let refCount2 = 0;
    let hasCompleted = false;
    let hasErrored = false;
    const cancelReset = () => {
      resetConnection === null || resetConnection === void 0 ? void 0 : resetConnection.unsubscribe();
      resetConnection = void 0;
    };
    const reset = () => {
      cancelReset();
      connection = subject = void 0;
      hasCompleted = hasErrored = false;
    };
    const resetAndUnsubscribe = () => {
      const conn = connection;
      reset();
      conn === null || conn === void 0 ? void 0 : conn.unsubscribe();
    };
    return operate((source, subscriber) => {
      refCount2++;
      if (!hasErrored && !hasCompleted) {
        cancelReset();
      }
      const dest = subject = subject !== null && subject !== void 0 ? subject : connector();
      subscriber.add(() => {
        refCount2--;
        if (refCount2 === 0 && !hasErrored && !hasCompleted) {
          resetConnection = handleReset(resetAndUnsubscribe, resetOnRefCountZero);
        }
      });
      dest.subscribe(subscriber);
      if (!connection && refCount2 > 0) {
        connection = new SafeSubscriber({
          next: (value) => dest.next(value),
          error: (err) => {
            hasErrored = true;
            cancelReset();
            resetConnection = handleReset(reset, resetOnError, err);
            dest.error(err);
          },
          complete: () => {
            hasCompleted = true;
            cancelReset();
            resetConnection = handleReset(reset, resetOnComplete);
            dest.complete();
          }
        });
        innerFrom(source).subscribe(connection);
      }
    })(wrapperSource);
  };
}
function handleReset(reset, on, ...args) {
  if (on === true) {
    reset();
    return;
  }
  if (on === false) {
    return;
  }
  const onSubscriber = new SafeSubscriber({
    next: () => {
      onSubscriber.unsubscribe();
      reset();
    }
  });
  return innerFrom(on(...args)).subscribe(onSubscriber);
}

// node_modules/rxjs/dist/esm/internal/operators/shareReplay.js
function shareReplay(configOrBufferSize, windowTime, scheduler) {
  let bufferSize;
  let refCount2 = false;
  if (configOrBufferSize && typeof configOrBufferSize === "object") {
    ({ bufferSize = Infinity, windowTime = Infinity, refCount: refCount2 = false, scheduler } = configOrBufferSize);
  } else {
    bufferSize = configOrBufferSize !== null && configOrBufferSize !== void 0 ? configOrBufferSize : Infinity;
  }
  return share({
    connector: () => new ReplaySubject(bufferSize, windowTime, scheduler),
    resetOnError: true,
    resetOnComplete: false,
    resetOnRefCountZero: refCount2
  });
}

// node_modules/rxjs/dist/esm/internal/operators/skip.js
function skip(count) {
  return filter((_4, index) => count <= index);
}

// node_modules/rxjs/dist/esm/internal/operators/skipWhile.js
function skipWhile(predicate) {
  return operate((source, subscriber) => {
    let taking = false;
    let index = 0;
    source.subscribe(createOperatorSubscriber(subscriber, (value) => (taking || (taking = !predicate(value, index++))) && subscriber.next(value)));
  });
}

// node_modules/rxjs/dist/esm/internal/operators/startWith.js
function startWith(...values) {
  const scheduler = popScheduler(values);
  return operate((source, subscriber) => {
    (scheduler ? concat(values, source, scheduler) : concat(values, source)).subscribe(subscriber);
  });
}

// node_modules/rxjs/dist/esm/internal/operators/switchMap.js
function switchMap(project, resultSelector) {
  return operate((source, subscriber) => {
    let innerSubscriber = null;
    let index = 0;
    let isComplete = false;
    const checkComplete = () => isComplete && !innerSubscriber && subscriber.complete();
    source.subscribe(createOperatorSubscriber(subscriber, (value) => {
      innerSubscriber === null || innerSubscriber === void 0 ? void 0 : innerSubscriber.unsubscribe();
      let innerIndex = 0;
      const outerIndex = index++;
      innerFrom(project(value, outerIndex)).subscribe(innerSubscriber = createOperatorSubscriber(subscriber, (innerValue) => subscriber.next(resultSelector ? resultSelector(value, innerValue, outerIndex, innerIndex++) : innerValue), () => {
        innerSubscriber = null;
        checkComplete();
      }));
    }, () => {
      isComplete = true;
      checkComplete();
    }));
  });
}

// node_modules/rxjs/dist/esm/internal/operators/takeUntil.js
function takeUntil(notifier) {
  return operate((source, subscriber) => {
    innerFrom(notifier).subscribe(createOperatorSubscriber(subscriber, () => subscriber.complete(), noop));
    !subscriber.closed && source.subscribe(subscriber);
  });
}

// node_modules/rxjs/dist/esm/internal/operators/takeWhile.js
function takeWhile(predicate, inclusive = false) {
  return operate((source, subscriber) => {
    let index = 0;
    source.subscribe(createOperatorSubscriber(subscriber, (value) => {
      const result = predicate(value, index++);
      (result || inclusive) && subscriber.next(value);
      !result && subscriber.complete();
    }));
  });
}

// node_modules/rxjs/dist/esm/internal/operators/tap.js
function tap(observerOrNext, error, complete) {
  const tapObserver = isFunction(observerOrNext) || error || complete ? { next: observerOrNext, error, complete } : observerOrNext;
  return tapObserver ? operate((source, subscriber) => {
    var _a;
    (_a = tapObserver.subscribe) === null || _a === void 0 ? void 0 : _a.call(tapObserver);
    let isUnsub = true;
    source.subscribe(createOperatorSubscriber(subscriber, (value) => {
      var _a2;
      (_a2 = tapObserver.next) === null || _a2 === void 0 ? void 0 : _a2.call(tapObserver, value);
      subscriber.next(value);
    }, () => {
      var _a2;
      isUnsub = false;
      (_a2 = tapObserver.complete) === null || _a2 === void 0 ? void 0 : _a2.call(tapObserver);
      subscriber.complete();
    }, (err) => {
      var _a2;
      isUnsub = false;
      (_a2 = tapObserver.error) === null || _a2 === void 0 ? void 0 : _a2.call(tapObserver, err);
      subscriber.error(err);
    }, () => {
      var _a2, _b;
      if (isUnsub) {
        (_a2 = tapObserver.unsubscribe) === null || _a2 === void 0 ? void 0 : _a2.call(tapObserver);
      }
      (_b = tapObserver.finalize) === null || _b === void 0 ? void 0 : _b.call(tapObserver);
    }));
  }) : identity;
}

// node_modules/rxjs/dist/esm/internal/operators/throttle.js
function throttle(durationSelector, config2) {
  return operate((source, subscriber) => {
    const { leading = true, trailing = false } = config2 !== null && config2 !== void 0 ? config2 : {};
    let hasValue = false;
    let sendValue = null;
    let throttled = null;
    let isComplete = false;
    const endThrottling = () => {
      throttled === null || throttled === void 0 ? void 0 : throttled.unsubscribe();
      throttled = null;
      if (trailing) {
        send();
        isComplete && subscriber.complete();
      }
    };
    const cleanupThrottling = () => {
      throttled = null;
      isComplete && subscriber.complete();
    };
    const startThrottle = (value) => throttled = innerFrom(durationSelector(value)).subscribe(createOperatorSubscriber(subscriber, endThrottling, cleanupThrottling));
    const send = () => {
      if (hasValue) {
        hasValue = false;
        const value = sendValue;
        sendValue = null;
        subscriber.next(value);
        !isComplete && startThrottle(value);
      }
    };
    source.subscribe(createOperatorSubscriber(subscriber, (value) => {
      hasValue = true;
      sendValue = value;
      !(throttled && !throttled.closed) && (leading ? send() : startThrottle(value));
    }, () => {
      isComplete = true;
      !(trailing && hasValue && throttled && !throttled.closed) && subscriber.complete();
    }));
  });
}

// node_modules/rxjs/dist/esm/internal/operators/throttleTime.js
function throttleTime(duration, scheduler = asyncScheduler, config2) {
  const duration$ = timer(duration, scheduler);
  return throttle(() => duration$, config2);
}

// node_modules/@angular/core/fesm2022/untracked.mjs
function createLinkedSignal(sourceFn, computationFn, equalityFn) {
  const node = Object.create(LINKED_SIGNAL_NODE);
  node.source = sourceFn;
  node.computation = computationFn;
  if (equalityFn != void 0) {
    node.equal = equalityFn;
  }
  const linkedSignalGetter = () => {
    producerUpdateValueVersion(node);
    producerAccessed(node);
    if (node.value === ERRORED) {
      throw node.error;
    }
    return node.value;
  };
  const getter = linkedSignalGetter;
  getter[SIGNAL] = node;
  if (typeof ngDevMode !== "undefined" && ngDevMode) {
    const debugName = node.debugName ? " (" + node.debugName + ")" : "";
    getter.toString = () => `[LinkedSignal${debugName}: ${node.value}]`;
  }
  runPostProducerCreatedFn(node);
  return getter;
}
function linkedSignalSetFn(node, newValue) {
  producerUpdateValueVersion(node);
  signalSetFn(node, newValue);
  producerMarkClean(node);
}
function linkedSignalUpdateFn(node, updater) {
  producerUpdateValueVersion(node);
  signalUpdateFn(node, updater);
  producerMarkClean(node);
}
var LINKED_SIGNAL_NODE = /* @__PURE__ */ (() => {
  return __spreadProps(__spreadValues({}, REACTIVE_NODE), {
    value: UNSET,
    dirty: true,
    error: null,
    equal: defaultEquals,
    kind: "linkedSignal",
    producerMustRecompute(node) {
      return node.value === UNSET || node.value === COMPUTING;
    },
    producerRecomputeValue(node) {
      if (node.value === COMPUTING) {
        throw new Error(typeof ngDevMode !== "undefined" && ngDevMode ? "Detected cycle in computations." : "");
      }
      const oldValue = node.value;
      node.value = COMPUTING;
      const prevConsumer = consumerBeforeComputation(node);
      let newValue;
      try {
        const newSourceValue = node.source();
        const prev = oldValue === UNSET || oldValue === ERRORED ? void 0 : {
          source: node.sourceValue,
          value: oldValue
        };
        newValue = node.computation(newSourceValue, prev);
        node.sourceValue = newSourceValue;
      } catch (err) {
        newValue = ERRORED;
        node.error = err;
      } finally {
        consumerAfterComputation(node, prevConsumer);
      }
      if (oldValue !== UNSET && newValue !== ERRORED && node.equal(oldValue, newValue)) {
        node.value = oldValue;
        return;
      }
      node.value = newValue;
      node.version++;
    }
  });
})();
function untracked(nonReactiveReadsFn) {
  const prevConsumer = setActiveConsumer(null);
  try {
    return nonReactiveReadsFn();
  } finally {
    setActiveConsumer(prevConsumer);
  }
}

// node_modules/@angular/core/fesm2022/root_effect_scheduler.mjs
var ERROR_DETAILS_PAGE_BASE_URL = "https://angular.dev/errors";
var XSS_SECURITY_URL = "https://angular.dev/best-practices/security#preventing-cross-site-scripting-xss";
var RuntimeError = class extends Error {
  code;
  constructor(code, message) {
    super(formatRuntimeError(code, message));
    this.code = code;
  }
};
function formatRuntimeErrorCode(code) {
  return `NG0${Math.abs(code)}`;
}
function formatRuntimeError(code, message) {
  const fullCode = formatRuntimeErrorCode(code);
  let errorMessage = `${fullCode}${message ? ": " + message : ""}`;
  if (ngDevMode && code < 0) {
    const addPeriodSeparator = !errorMessage.match(/[.,;!?\n]$/);
    const separator = addPeriodSeparator ? "." : "";
    errorMessage = `${errorMessage}${separator} Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/${fullCode}`;
  }
  return errorMessage;
}
var _global = globalThis;
function ngDevModeResetPerfCounters() {
  const locationString = typeof location !== "undefined" ? location.toString() : "";
  const newCounters = {
    hydratedNodes: 0,
    hydratedComponents: 0,
    dehydratedViewsRemoved: 0,
    dehydratedViewsCleanupRuns: 0,
    componentsSkippedHydration: 0,
    deferBlocksWithIncrementalHydration: 0
  };
  const allowNgDevModeTrue = locationString.indexOf("ngDevMode=false") === -1;
  if (!allowNgDevModeTrue) {
    _global["ngDevMode"] = false;
  } else {
    if (typeof _global["ngDevMode"] !== "object") {
      _global["ngDevMode"] = {};
    }
    Object.assign(_global["ngDevMode"], newCounters);
  }
  return newCounters;
}
function initNgDevMode() {
  if (typeof ngDevMode === "undefined" || ngDevMode) {
    if (typeof ngDevMode !== "object" || Object.keys(ngDevMode).length === 0) {
      ngDevModeResetPerfCounters();
    }
    return typeof ngDevMode !== "undefined" && !!ngDevMode;
  }
  return false;
}
function getClosureSafeProperty(objWithPropertyToExtract) {
  for (let key in objWithPropertyToExtract) {
    if (objWithPropertyToExtract[key] === getClosureSafeProperty) {
      return key;
    }
  }
  throw Error(typeof ngDevMode !== "undefined" && ngDevMode ? "Could not find renamed property on target object." : "");
}
function fillProperties(target, source) {
  for (const key in source) {
    if (source.hasOwnProperty(key) && !target.hasOwnProperty(key)) {
      target[key] = source[key];
    }
  }
}
function stringify(token) {
  if (typeof token === "string") {
    return token;
  }
  if (Array.isArray(token)) {
    return `[${token.map(stringify).join(", ")}]`;
  }
  if (token == null) {
    return "" + token;
  }
  const name2 = token.overriddenName || token.name;
  if (name2) {
    return `${name2}`;
  }
  const result = token.toString();
  if (result == null) {
    return "" + result;
  }
  const newLineIndex = result.indexOf("\n");
  return newLineIndex >= 0 ? result.slice(0, newLineIndex) : result;
}
function concatStringsWithSpace(before, after) {
  if (!before)
    return after || "";
  if (!after)
    return before;
  return `${before} ${after}`;
}
var __forward_ref__ = getClosureSafeProperty({ __forward_ref__: getClosureSafeProperty });
function forwardRef(forwardRefFn) {
  forwardRefFn.__forward_ref__ = forwardRef;
  forwardRefFn.toString = function() {
    return stringify(this());
  };
  return forwardRefFn;
}
function resolveForwardRef(type) {
  return isForwardRef(type) ? type() : type;
}
function isForwardRef(fn) {
  return typeof fn === "function" && fn.hasOwnProperty(__forward_ref__) && fn.__forward_ref__ === forwardRef;
}
function assertNumber(actual, msg) {
  if (!(typeof actual === "number")) {
    throwError2(msg, typeof actual, "number", "===");
  }
}
function assertNumberInRange(actual, minInclusive, maxInclusive) {
  assertNumber(actual, "Expected a number");
  assertLessThanOrEqual(actual, maxInclusive, "Expected number to be less than or equal to");
  assertGreaterThanOrEqual(actual, minInclusive, "Expected number to be greater than or equal to");
}
function assertString(actual, msg) {
  if (!(typeof actual === "string")) {
    throwError2(msg, actual === null ? "null" : typeof actual, "string", "===");
  }
}
function assertFunction(actual, msg) {
  if (!(typeof actual === "function")) {
    throwError2(msg, actual === null ? "null" : typeof actual, "function", "===");
  }
}
function assertEqual(actual, expected, msg) {
  if (!(actual == expected)) {
    throwError2(msg, actual, expected, "==");
  }
}
function assertNotEqual(actual, expected, msg) {
  if (!(actual != expected)) {
    throwError2(msg, actual, expected, "!=");
  }
}
function assertSame(actual, expected, msg) {
  if (!(actual === expected)) {
    throwError2(msg, actual, expected, "===");
  }
}
function assertNotSame(actual, expected, msg) {
  if (!(actual !== expected)) {
    throwError2(msg, actual, expected, "!==");
  }
}
function assertLessThan(actual, expected, msg) {
  if (!(actual < expected)) {
    throwError2(msg, actual, expected, "<");
  }
}
function assertLessThanOrEqual(actual, expected, msg) {
  if (!(actual <= expected)) {
    throwError2(msg, actual, expected, "<=");
  }
}
function assertGreaterThan(actual, expected, msg) {
  if (!(actual > expected)) {
    throwError2(msg, actual, expected, ">");
  }
}
function assertGreaterThanOrEqual(actual, expected, msg) {
  if (!(actual >= expected)) {
    throwError2(msg, actual, expected, ">=");
  }
}
function assertDefined(actual, msg) {
  if (actual == null) {
    throwError2(msg, actual, null, "!=");
  }
}
function throwError2(msg, actual, expected, comparison) {
  throw new Error(`ASSERTION ERROR: ${msg}` + (comparison == null ? "" : ` [Expected=> ${expected} ${comparison} ${actual} <=Actual]`));
}
function assertDomNode(node) {
  if (!(node instanceof Node)) {
    throwError2(`The provided value must be an instance of a DOM Node but got ${stringify(node)}`);
  }
}
function assertElement(node) {
  if (!(node instanceof Element)) {
    throwError2(`The provided value must be an element but got ${stringify(node)}`);
  }
}
function assertIndexInRange(arr, index) {
  assertDefined(arr, "Array must be defined.");
  const maxLen = arr.length;
  if (index < 0 || index >= maxLen) {
    throwError2(`Index expected to be less than ${maxLen} but got ${index}`);
  }
}
function assertOneOf(value, ...validValues) {
  if (validValues.indexOf(value) !== -1)
    return true;
  throwError2(`Expected value to be one of ${JSON.stringify(validValues)} but was ${JSON.stringify(value)}.`);
}
function assertNotReactive(fn) {
  if (getActiveConsumer() !== null) {
    throwError2(`${fn}() should never be called in a reactive context.`);
  }
}
function \u0275\u0275defineInjectable(opts) {
  return {
    token: opts.token,
    providedIn: opts.providedIn || null,
    factory: opts.factory,
    value: void 0
  };
}
function \u0275\u0275defineInjector(options) {
  return { providers: options.providers || [], imports: options.imports || [] };
}
function getInjectableDef(type) {
  return getOwnDefinition(type, NG_PROV_DEF);
}
function isInjectable(type) {
  return getInjectableDef(type) !== null;
}
function getOwnDefinition(type, field) {
  return type.hasOwnProperty(field) && type[field] || null;
}
function getInheritedInjectableDef(type) {
  const def = type?.[NG_PROV_DEF] ?? null;
  if (def) {
    ngDevMode && console.warn(`DEPRECATED: DI is instantiating a token "${type.name}" that inherits its @Injectable decorator but does not provide one itself.
This will become an error in a future version of Angular. Please add @Injectable() to the "${type.name}" class.`);
    return def;
  } else {
    return null;
  }
}
function getInjectorDef(type) {
  return type && type.hasOwnProperty(NG_INJ_DEF) ? type[NG_INJ_DEF] : null;
}
var NG_PROV_DEF = getClosureSafeProperty({ \u0275prov: getClosureSafeProperty });
var NG_INJ_DEF = getClosureSafeProperty({ \u0275inj: getClosureSafeProperty });
var InjectionToken = class {
  _desc;
  /** @internal */
  ngMetadataName = "InjectionToken";
  \u0275prov;
  /**
   * @param _desc   Description for the token,
   *                used only for debugging purposes,
   *                it should but does not need to be unique
   * @param options Options for the token's usage, as described above
   */
  constructor(_desc, options) {
    this._desc = _desc;
    this.\u0275prov = void 0;
    if (typeof options == "number") {
      (typeof ngDevMode === "undefined" || ngDevMode) && assertLessThan(options, 0, "Only negative numbers are supported here");
      this.__NG_ELEMENT_ID__ = options;
    } else if (options !== void 0) {
      this.\u0275prov = \u0275\u0275defineInjectable({
        token: this,
        providedIn: options.providedIn || "root",
        factory: options.factory
      });
    }
  }
  /**
   * @internal
   */
  get multi() {
    return this;
  }
  toString() {
    return `InjectionToken ${this._desc}`;
  }
};
var _injectorProfilerContext;
function getInjectorProfilerContext() {
  !ngDevMode && throwError2("getInjectorProfilerContext should never be called in production mode");
  return _injectorProfilerContext;
}
function setInjectorProfilerContext(context2) {
  !ngDevMode && throwError2("setInjectorProfilerContext should never be called in production mode");
  const previous = _injectorProfilerContext;
  _injectorProfilerContext = context2;
  return previous;
}
var injectorProfilerCallbacks = [];
var NOOP_PROFILER_REMOVAL = () => {
};
function removeProfiler(profiler2) {
  const profilerIdx = injectorProfilerCallbacks.indexOf(profiler2);
  if (profilerIdx !== -1) {
    injectorProfilerCallbacks.splice(profilerIdx, 1);
  }
}
function setInjectorProfiler(injectorProfiler2) {
  !ngDevMode && throwError2("setInjectorProfiler should never be called in production mode");
  if (injectorProfiler2 !== null) {
    if (!injectorProfilerCallbacks.includes(injectorProfiler2)) {
      injectorProfilerCallbacks.push(injectorProfiler2);
    }
    return () => removeProfiler(injectorProfiler2);
  } else {
    injectorProfilerCallbacks.length = 0;
    return NOOP_PROFILER_REMOVAL;
  }
}
function injectorProfiler(event) {
  !ngDevMode && throwError2("Injector profiler should never be called in production mode");
  for (let i = 0; i < injectorProfilerCallbacks.length; i++) {
    const injectorProfilerCallback = injectorProfilerCallbacks[i];
    injectorProfilerCallback(event);
  }
}
function emitProviderConfiguredEvent(eventProvider, isViewProvider = false) {
  !ngDevMode && throwError2("Injector profiler should never be called in production mode");
  let token;
  if (typeof eventProvider === "function") {
    token = eventProvider;
  } else if (eventProvider instanceof InjectionToken) {
    token = eventProvider;
  } else {
    token = resolveForwardRef(eventProvider.provide);
  }
  let provider = eventProvider;
  if (eventProvider instanceof InjectionToken) {
    provider = eventProvider.\u0275prov || eventProvider;
  }
  injectorProfiler({
    type: 2,
    context: getInjectorProfilerContext(),
    providerRecord: { token, provider, isViewProvider }
  });
}
function emitInjectorToCreateInstanceEvent(token) {
  !ngDevMode && throwError2("Injector profiler should never be called in production mode");
  injectorProfiler({
    type: 4,
    context: getInjectorProfilerContext(),
    token
  });
}
function emitInstanceCreatedByInjectorEvent(instance) {
  !ngDevMode && throwError2("Injector profiler should never be called in production mode");
  injectorProfiler({
    type: 1,
    context: getInjectorProfilerContext(),
    instance: { value: instance }
  });
}
function emitInjectEvent(token, value, flags) {
  !ngDevMode && throwError2("Injector profiler should never be called in production mode");
  injectorProfiler({
    type: 0,
    context: getInjectorProfilerContext(),
    service: { token, value, flags }
  });
}
function emitEffectCreatedEvent(effect2) {
  !ngDevMode && throwError2("Injector profiler should never be called in production mode");
  injectorProfiler({
    type: 3,
    context: getInjectorProfilerContext(),
    effect: effect2
  });
}
function runInInjectorProfilerContext(injector, token, callback) {
  !ngDevMode && throwError2("runInInjectorProfilerContext should never be called in production mode");
  const prevInjectContext = setInjectorProfilerContext({ injector, token });
  try {
    callback();
  } finally {
    setInjectorProfilerContext(prevInjectContext);
  }
}
function isEnvironmentProviders(value) {
  return value && !!value.\u0275providers;
}
var NG_COMP_DEF = getClosureSafeProperty({ \u0275cmp: getClosureSafeProperty });
var NG_DIR_DEF = getClosureSafeProperty({ \u0275dir: getClosureSafeProperty });
var NG_PIPE_DEF = getClosureSafeProperty({ \u0275pipe: getClosureSafeProperty });
var NG_MOD_DEF = getClosureSafeProperty({ \u0275mod: getClosureSafeProperty });
var NG_FACTORY_DEF = getClosureSafeProperty({ \u0275fac: getClosureSafeProperty });
var NG_ELEMENT_ID = getClosureSafeProperty({
  __NG_ELEMENT_ID__: getClosureSafeProperty
});
var NG_ENV_ID = getClosureSafeProperty({ __NG_ENV_ID__: getClosureSafeProperty });
function renderStringify(value) {
  if (typeof value === "string")
    return value;
  if (value == null)
    return "";
  return String(value);
}
function stringifyForError(value) {
  if (typeof value === "function")
    return value.name || value.toString();
  if (typeof value === "object" && value != null && typeof value.type === "function") {
    return value.type.name || value.type.toString();
  }
  return renderStringify(value);
}
var NG_RUNTIME_ERROR_CODE = getClosureSafeProperty({ "ngErrorCode": getClosureSafeProperty });
var NG_RUNTIME_ERROR_MESSAGE = getClosureSafeProperty({ "ngErrorMessage": getClosureSafeProperty });
var NG_TOKEN_PATH = getClosureSafeProperty({ "ngTokenPath": getClosureSafeProperty });
function cyclicDependencyError(token, path) {
  const message = ngDevMode ? `Circular dependency detected for \`${token}\`.` : "";
  return createRuntimeError(message, -200, path);
}
function cyclicDependencyErrorWithDetails(token, path) {
  return augmentRuntimeError(cyclicDependencyError(token, path), null);
}
function throwMixedMultiProviderError() {
  throw new Error(`Cannot mix multi providers and regular providers`);
}
function throwInvalidProviderError(ngModuleType, providers, provider) {
  if (ngModuleType && providers) {
    const providerDetail = providers.map((v) => v == provider ? "?" + provider + "?" : "...");
    throw new Error(`Invalid provider for the NgModule '${stringify(ngModuleType)}' - only instances of Provider and Type are allowed, got: [${providerDetail.join(", ")}]`);
  } else if (isEnvironmentProviders(provider)) {
    if (provider.\u0275fromNgModule) {
      throw new RuntimeError(207, `Invalid providers from 'importProvidersFrom' present in a non-environment injector. 'importProvidersFrom' can't be used for component providers.`);
    } else {
      throw new RuntimeError(207, `Invalid providers present in a non-environment injector. 'EnvironmentProviders' can't be used for component providers.`);
    }
  } else {
    throw new Error("Invalid provider");
  }
}
function throwProviderNotFoundError(token, injectorName) {
  const errorMessage = ngDevMode && `No provider for ${stringifyForError(token)} found${injectorName ? ` in ${injectorName}` : ""}`;
  throw new RuntimeError(-201, errorMessage);
}
function prependTokenToDependencyPath(error, token) {
  error[NG_TOKEN_PATH] ??= [];
  const currentPath = error[NG_TOKEN_PATH];
  let pathStr;
  if (typeof token === "object" && "multi" in token && token?.multi === true) {
    assertDefined(token.provide, "Token with multi: true should have a provide property");
    pathStr = stringifyForError(token.provide);
  } else {
    pathStr = stringifyForError(token);
  }
  if (currentPath[0] !== pathStr) {
    error[NG_TOKEN_PATH].unshift(pathStr);
  }
}
function augmentRuntimeError(error, source) {
  const tokenPath = error[NG_TOKEN_PATH];
  const errorCode = error[NG_RUNTIME_ERROR_CODE];
  const message = error[NG_RUNTIME_ERROR_MESSAGE] || error.message;
  error.message = formatErrorMessage(message, errorCode, tokenPath, source);
  return error;
}
function createRuntimeError(message, code, path) {
  const error = new RuntimeError(code, message);
  error[NG_RUNTIME_ERROR_CODE] = code;
  error[NG_RUNTIME_ERROR_MESSAGE] = message;
  if (path) {
    error[NG_TOKEN_PATH] = path;
  }
  return error;
}
function getRuntimeErrorCode(error) {
  return error[NG_RUNTIME_ERROR_CODE];
}
function formatErrorMessage(text, code, path = [], source = null) {
  let pathDetails = "";
  if (path && path.length > 1) {
    pathDetails = ` Path: ${path.join(" -> ")}.`;
  }
  const sourceDetails = source ? ` Source: ${source}.` : "";
  return formatRuntimeError(code, `${text}${sourceDetails}${pathDetails}`);
}
var _injectImplementation;
function getInjectImplementation() {
  return _injectImplementation;
}
function setInjectImplementation(impl) {
  const previous = _injectImplementation;
  _injectImplementation = impl;
  return previous;
}
function injectRootLimpMode(token, notFoundValue, flags) {
  const injectableDef = getInjectableDef(token);
  if (injectableDef && injectableDef.providedIn == "root") {
    return injectableDef.value === void 0 ? injectableDef.value = injectableDef.factory() : injectableDef.value;
  }
  if (flags & 8)
    return null;
  if (notFoundValue !== void 0)
    return notFoundValue;
  throwProviderNotFoundError(token, "Injector");
}
function assertInjectImplementationNotEqual(fn) {
  ngDevMode && assertNotEqual(_injectImplementation, fn, "Calling \u0275\u0275inject would cause infinite recursion");
}
var _THROW_IF_NOT_FOUND = {};
var THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND;
var DI_DECORATOR_FLAG = "__NG_DI_FLAG__";
var RetrievingInjector = class {
  injector;
  constructor(injector) {
    this.injector = injector;
  }
  retrieve(token, options) {
    const flags = convertToBitFlags(options) || 0;
    try {
      return this.injector.get(
        token,
        // When a dependency is requested with an optional flag, DI returns null as the default value.
        flags & 8 ? null : THROW_IF_NOT_FOUND,
        flags
      );
    } catch (e) {
      if (isNotFound(e)) {
        return e;
      }
      throw e;
    }
  }
};
function injectInjectorOnly(token, flags = 0) {
  const currentInjector = getCurrentInjector();
  if (currentInjector === void 0) {
    throw new RuntimeError(-203, ngDevMode && `The \`${stringify(token)}\` token injection failed. \`inject()\` function must be called from an injection context such as a constructor, a factory function, a field initializer, or a function used with \`runInInjectionContext\`.`);
  } else if (currentInjector === null) {
    return injectRootLimpMode(token, void 0, flags);
  } else {
    const options = convertToInjectOptions(flags);
    const value = currentInjector.retrieve(token, options);
    ngDevMode && emitInjectEvent(token, value, flags);
    if (isNotFound(value)) {
      if (options.optional) {
        return null;
      }
      throw value;
    }
    return value;
  }
}
function \u0275\u0275inject(token, flags = 0) {
  return (getInjectImplementation() || injectInjectorOnly)(resolveForwardRef(token), flags);
}
function \u0275\u0275invalidFactoryDep(index) {
  throw new RuntimeError(202, ngDevMode && `This constructor is not compatible with Angular Dependency Injection because its dependency at index ${index} of the parameter list is invalid.
This can happen if the dependency type is a primitive like a string or if an ancestor of this class is missing an Angular decorator.

Please check that 1) the type for the parameter at index ${index} is correct and 2) the correct Angular decorators are defined for this class and its ancestors.`);
}
function inject2(token, options) {
  return \u0275\u0275inject(token, convertToBitFlags(options));
}
function convertToBitFlags(flags) {
  if (typeof flags === "undefined" || typeof flags === "number") {
    return flags;
  }
  return 0 | // comment to force a line break in the formatter
  (flags.optional && 8) | (flags.host && 1) | (flags.self && 2) | (flags.skipSelf && 4);
}
function convertToInjectOptions(flags) {
  return {
    optional: !!(flags & 8),
    host: !!(flags & 1),
    self: !!(flags & 2),
    skipSelf: !!(flags & 4)
  };
}
function injectArgs(types) {
  const args = [];
  for (let i = 0; i < types.length; i++) {
    const arg = resolveForwardRef(types[i]);
    if (Array.isArray(arg)) {
      if (arg.length === 0) {
        throw new RuntimeError(900, ngDevMode && "Arguments array must have arguments.");
      }
      let type = void 0;
      let flags = 0;
      for (let j = 0; j < arg.length; j++) {
        const meta = arg[j];
        const flag = getInjectFlag(meta);
        if (typeof flag === "number") {
          if (flag === -1) {
            type = meta.token;
          } else {
            flags |= flag;
          }
        } else {
          type = meta;
        }
      }
      args.push(\u0275\u0275inject(type, flags));
    } else {
      args.push(\u0275\u0275inject(arg));
    }
  }
  return args;
}
function attachInjectFlag(decorator, flag) {
  decorator[DI_DECORATOR_FLAG] = flag;
  decorator.prototype[DI_DECORATOR_FLAG] = flag;
  return decorator;
}
function getInjectFlag(token) {
  return token[DI_DECORATOR_FLAG];
}
function getFactoryDef(type, throwNotFound) {
  const hasFactoryDef = type.hasOwnProperty(NG_FACTORY_DEF);
  if (!hasFactoryDef && throwNotFound === true && ngDevMode) {
    throw new Error(`Type ${stringify(type)} does not have '\u0275fac' property.`);
  }
  return hasFactoryDef ? type[NG_FACTORY_DEF] : null;
}
function arrayEquals(a, b, identityAccessor) {
  if (a.length !== b.length)
    return false;
  for (let i = 0; i < a.length; i++) {
    let valueA = a[i];
    let valueB = b[i];
    if (identityAccessor) {
      valueA = identityAccessor(valueA);
      valueB = identityAccessor(valueB);
    }
    if (valueB !== valueA) {
      return false;
    }
  }
  return true;
}
function flatten(list) {
  return list.flat(Number.POSITIVE_INFINITY);
}
function deepForEach(input2, fn) {
  input2.forEach((value) => Array.isArray(value) ? deepForEach(value, fn) : fn(value));
}
function addToArray(arr, index, value) {
  if (index >= arr.length) {
    arr.push(value);
  } else {
    arr.splice(index, 0, value);
  }
}
function removeFromArray(arr, index) {
  if (index >= arr.length - 1) {
    return arr.pop();
  } else {
    return arr.splice(index, 1)[0];
  }
}
function newArray(size, value) {
  const list = [];
  for (let i = 0; i < size; i++) {
    list.push(value);
  }
  return list;
}
function arraySplice(array, index, count) {
  const length = array.length - count;
  while (index < length) {
    array[index] = array[index + count];
    index++;
  }
  while (count--) {
    array.pop();
  }
}
function arrayInsert2(array, index, value1, value2) {
  ngDevMode && assertLessThanOrEqual(index, array.length, "Can't insert past array end.");
  let end = array.length;
  if (end == index) {
    array.push(value1, value2);
  } else if (end === 1) {
    array.push(value2, array[0]);
    array[0] = value1;
  } else {
    end--;
    array.push(array[end - 1], array[end]);
    while (end > index) {
      const previousEnd = end - 2;
      array[end] = array[previousEnd];
      end--;
    }
    array[index] = value1;
    array[index + 1] = value2;
  }
}
function keyValueArraySet(keyValueArray, key, value) {
  let index = keyValueArrayIndexOf(keyValueArray, key);
  if (index >= 0) {
    keyValueArray[index | 1] = value;
  } else {
    index = ~index;
    arrayInsert2(keyValueArray, index, key, value);
  }
  return index;
}
function keyValueArrayGet(keyValueArray, key) {
  const index = keyValueArrayIndexOf(keyValueArray, key);
  if (index >= 0) {
    return keyValueArray[index | 1];
  }
  return void 0;
}
function keyValueArrayIndexOf(keyValueArray, key) {
  return _arrayIndexOfSorted(keyValueArray, key, 1);
}
function _arrayIndexOfSorted(array, value, shift) {
  ngDevMode && assertEqual(Array.isArray(array), true, "Expecting an array");
  let start = 0;
  let end = array.length >> shift;
  while (end !== start) {
    const middle = start + (end - start >> 1);
    const current = array[middle << shift];
    if (value === current) {
      return middle << shift;
    } else if (current > value) {
      end = middle;
    } else {
      start = middle + 1;
    }
  }
  return ~(end << shift);
}
var EMPTY_OBJ = {};
var EMPTY_ARRAY = [];
if ((typeof ngDevMode === "undefined" || ngDevMode) && initNgDevMode()) {
  Object.freeze(EMPTY_OBJ);
  Object.freeze(EMPTY_ARRAY);
}
var ENVIRONMENT_INITIALIZER = new InjectionToken(ngDevMode ? "ENVIRONMENT_INITIALIZER" : "");
var INJECTOR$1 = new InjectionToken(
  ngDevMode ? "INJECTOR" : "",
  // Disable tslint because this is const enum which gets inlined not top level prop access.
  // tslint:disable-next-line: no-toplevel-property-access
  -1
  /* InjectorMarkers.Injector */
);
var INJECTOR_DEF_TYPES = new InjectionToken(ngDevMode ? "INJECTOR_DEF_TYPES" : "");
var NullInjector = class {
  get(token, notFoundValue = THROW_IF_NOT_FOUND) {
    if (notFoundValue === THROW_IF_NOT_FOUND) {
      const message = ngDevMode ? `No provider found for \`${stringify(token)}\`.` : "";
      const error = createRuntimeError(
        message,
        -201
        /* RuntimeErrorCode.PROVIDER_NOT_FOUND */
      );
      error.name = "\u0275NotFound";
      throw error;
    }
    return notFoundValue;
  }
};
function getNgModuleDef(type) {
  return type[NG_MOD_DEF] || null;
}
function getNgModuleDefOrThrow(type) {
  const ngModuleDef = getNgModuleDef(type);
  if (!ngModuleDef) {
    throw new RuntimeError(915, (typeof ngDevMode === "undefined" || ngDevMode) && `Type ${stringify(type)} does not have '\u0275mod' property.`);
  }
  return ngModuleDef;
}
function getComponentDef(type) {
  return type[NG_COMP_DEF] || null;
}
function getDirectiveDefOrThrow(type) {
  const def = getDirectiveDef(type);
  if (!def) {
    throw new RuntimeError(916, (typeof ngDevMode === "undefined" || ngDevMode) && `Type ${stringify(type)} does not have '\u0275dir' property.`);
  }
  return def;
}
function getDirectiveDef(type) {
  return type[NG_DIR_DEF] || null;
}
function getPipeDef(type) {
  return type[NG_PIPE_DEF] || null;
}
function isStandalone(type) {
  const def = getComponentDef(type) || getDirectiveDef(type) || getPipeDef(type);
  return def !== null && def.standalone;
}
function makeEnvironmentProviders(providers) {
  return {
    \u0275providers: providers
  };
}
function provideEnvironmentInitializer(initializerFn) {
  return makeEnvironmentProviders([
    {
      provide: ENVIRONMENT_INITIALIZER,
      multi: true,
      useValue: initializerFn
    }
  ]);
}
function importProvidersFrom(...sources) {
  return {
    \u0275providers: internalImportProvidersFrom(true, sources),
    \u0275fromNgModule: true
  };
}
function internalImportProvidersFrom(checkForStandaloneCmp, ...sources) {
  const providersOut = [];
  const dedup = /* @__PURE__ */ new Set();
  let injectorTypesWithProviders;
  const collectProviders = (provider) => {
    providersOut.push(provider);
  };
  deepForEach(sources, (source) => {
    if ((typeof ngDevMode === "undefined" || ngDevMode) && checkForStandaloneCmp) {
      const cmpDef = getComponentDef(source);
      if (cmpDef?.standalone) {
        throw new RuntimeError(800, `Importing providers supports NgModule or ModuleWithProviders but got a standalone component "${stringifyForError(source)}"`);
      }
    }
    const internalSource = source;
    if (walkProviderTree(internalSource, collectProviders, [], dedup)) {
      injectorTypesWithProviders ||= [];
      injectorTypesWithProviders.push(internalSource);
    }
  });
  if (injectorTypesWithProviders !== void 0) {
    processInjectorTypesWithProviders(injectorTypesWithProviders, collectProviders);
  }
  return providersOut;
}
function processInjectorTypesWithProviders(typesWithProviders, visitor) {
  for (let i = 0; i < typesWithProviders.length; i++) {
    const { ngModule, providers } = typesWithProviders[i];
    deepForEachProvider(providers, (provider) => {
      ngDevMode && validateProvider(provider, providers || EMPTY_ARRAY, ngModule);
      visitor(provider, ngModule);
    });
  }
}
function walkProviderTree(container, visitor, parents, dedup) {
  container = resolveForwardRef(container);
  if (!container)
    return false;
  let defType = null;
  let injDef = getInjectorDef(container);
  const cmpDef = !injDef && getComponentDef(container);
  if (!injDef && !cmpDef) {
    const ngModule = container.ngModule;
    injDef = getInjectorDef(ngModule);
    if (injDef) {
      defType = ngModule;
    } else {
      return false;
    }
  } else if (cmpDef && !cmpDef.standalone) {
    return false;
  } else {
    defType = container;
  }
  if (ngDevMode && parents.indexOf(defType) !== -1) {
    const defName = stringify(defType);
    const path = parents.map(stringify).concat(defName);
    throw cyclicDependencyErrorWithDetails(defName, path);
  }
  const isDuplicate = dedup.has(defType);
  if (cmpDef) {
    if (isDuplicate) {
      return false;
    }
    dedup.add(defType);
    if (cmpDef.dependencies) {
      const deps = typeof cmpDef.dependencies === "function" ? cmpDef.dependencies() : cmpDef.dependencies;
      for (const dep of deps) {
        walkProviderTree(dep, visitor, parents, dedup);
      }
    }
  } else if (injDef) {
    if (injDef.imports != null && !isDuplicate) {
      ngDevMode && parents.push(defType);
      dedup.add(defType);
      let importTypesWithProviders;
      try {
        deepForEach(injDef.imports, (imported) => {
          if (walkProviderTree(imported, visitor, parents, dedup)) {
            importTypesWithProviders ||= [];
            importTypesWithProviders.push(imported);
          }
        });
      } finally {
        ngDevMode && parents.pop();
      }
      if (importTypesWithProviders !== void 0) {
        processInjectorTypesWithProviders(importTypesWithProviders, visitor);
      }
    }
    if (!isDuplicate) {
      const factory = getFactoryDef(defType) || (() => new defType());
      visitor({ provide: defType, useFactory: factory, deps: EMPTY_ARRAY }, defType);
      visitor({ provide: INJECTOR_DEF_TYPES, useValue: defType, multi: true }, defType);
      visitor({ provide: ENVIRONMENT_INITIALIZER, useValue: () => \u0275\u0275inject(defType), multi: true }, defType);
    }
    const defProviders = injDef.providers;
    if (defProviders != null && !isDuplicate) {
      const injectorType = container;
      deepForEachProvider(defProviders, (provider) => {
        ngDevMode && validateProvider(provider, defProviders, injectorType);
        visitor(provider, injectorType);
      });
    }
  } else {
    return false;
  }
  return defType !== container && container.providers !== void 0;
}
function validateProvider(provider, providers, containerType) {
  if (isTypeProvider(provider) || isValueProvider(provider) || isFactoryProvider(provider) || isExistingProvider(provider)) {
    return;
  }
  const classRef = resolveForwardRef(provider && (provider.useClass || provider.provide));
  if (!classRef) {
    throwInvalidProviderError(containerType, providers, provider);
  }
}
function deepForEachProvider(providers, fn) {
  for (let provider of providers) {
    if (isEnvironmentProviders(provider)) {
      provider = provider.\u0275providers;
    }
    if (Array.isArray(provider)) {
      deepForEachProvider(provider, fn);
    } else {
      fn(provider);
    }
  }
}
var USE_VALUE = getClosureSafeProperty({
  provide: String,
  useValue: getClosureSafeProperty
});
function isValueProvider(value) {
  return value !== null && typeof value == "object" && USE_VALUE in value;
}
function isExistingProvider(value) {
  return !!(value && value.useExisting);
}
function isFactoryProvider(value) {
  return !!(value && value.useFactory);
}
function isTypeProvider(value) {
  return typeof value === "function";
}
function isClassProvider(value) {
  return !!value.useClass;
}
var INJECTOR_SCOPE = new InjectionToken(ngDevMode ? "Set Injector scope." : "");
var NOT_YET = {};
var CIRCULAR = {};
var NULL_INJECTOR = void 0;
function getNullInjector() {
  if (NULL_INJECTOR === void 0) {
    NULL_INJECTOR = new NullInjector();
  }
  return NULL_INJECTOR;
}
var EnvironmentInjector = class {
};
var R3Injector = class extends EnvironmentInjector {
  parent;
  source;
  scopes;
  /**
   * Map of tokens to records which contain the instances of those tokens.
   * - `null` value implies that we don't have the record. Used by tree-shakable injectors
   * to prevent further searches.
   */
  records = /* @__PURE__ */ new Map();
  /**
   * Set of values instantiated by this injector which contain `ngOnDestroy` lifecycle hooks.
   */
  _ngOnDestroyHooks = /* @__PURE__ */ new Set();
  _onDestroyHooks = [];
  /**
   * Flag indicating that this injector was previously destroyed.
   */
  get destroyed() {
    return this._destroyed;
  }
  _destroyed = false;
  injectorDefTypes;
  constructor(providers, parent, source, scopes) {
    super();
    this.parent = parent;
    this.source = source;
    this.scopes = scopes;
    forEachSingleProvider(providers, (provider) => this.processProvider(provider));
    this.records.set(INJECTOR$1, makeRecord(void 0, this));
    if (scopes.has("environment")) {
      this.records.set(EnvironmentInjector, makeRecord(void 0, this));
    }
    const record = this.records.get(INJECTOR_SCOPE);
    if (record != null && typeof record.value === "string") {
      this.scopes.add(record.value);
    }
    this.injectorDefTypes = new Set(this.get(INJECTOR_DEF_TYPES, EMPTY_ARRAY, { self: true }));
  }
  retrieve(token, options) {
    const flags = convertToBitFlags(options) || 0;
    try {
      return this.get(
        token,
        // When a dependency is requested with an optional flag, DI returns null as the default value.
        THROW_IF_NOT_FOUND,
        flags
      );
    } catch (e) {
      if (isNotFound(e)) {
        return e;
      }
      throw e;
    }
  }
  /**
   * Destroy the injector and release references to every instance or provider associated with it.
   *
   * Also calls the `OnDestroy` lifecycle hooks of every instance that was created for which a
   * hook was found.
   */
  destroy() {
    assertNotDestroyed(this);
    this._destroyed = true;
    const prevConsumer = setActiveConsumer(null);
    try {
      for (const service of this._ngOnDestroyHooks) {
        service.ngOnDestroy();
      }
      const onDestroyHooks = this._onDestroyHooks;
      this._onDestroyHooks = [];
      for (const hook of onDestroyHooks) {
        hook();
      }
    } finally {
      this.records.clear();
      this._ngOnDestroyHooks.clear();
      this.injectorDefTypes.clear();
      setActiveConsumer(prevConsumer);
    }
  }
  onDestroy(callback) {
    assertNotDestroyed(this);
    this._onDestroyHooks.push(callback);
    return () => this.removeOnDestroy(callback);
  }
  runInContext(fn) {
    assertNotDestroyed(this);
    const previousInjector = setCurrentInjector(this);
    const previousInjectImplementation = setInjectImplementation(void 0);
    let prevInjectContext;
    if (ngDevMode) {
      prevInjectContext = setInjectorProfilerContext({ injector: this, token: null });
    }
    try {
      return fn();
    } finally {
      setCurrentInjector(previousInjector);
      setInjectImplementation(previousInjectImplementation);
      ngDevMode && setInjectorProfilerContext(prevInjectContext);
    }
  }
  get(token, notFoundValue = THROW_IF_NOT_FOUND, options) {
    assertNotDestroyed(this);
    if (token.hasOwnProperty(NG_ENV_ID)) {
      return token[NG_ENV_ID](this);
    }
    const flags = convertToBitFlags(options);
    let prevInjectContext;
    if (ngDevMode) {
      prevInjectContext = setInjectorProfilerContext({ injector: this, token });
    }
    const previousInjector = setCurrentInjector(this);
    const previousInjectImplementation = setInjectImplementation(void 0);
    try {
      if (!(flags & 4)) {
        let record = this.records.get(token);
        if (record === void 0) {
          const def = couldBeInjectableType(token) && getInjectableDef(token);
          if (def && this.injectableDefInScope(def)) {
            if (ngDevMode) {
              runInInjectorProfilerContext(this, token, () => {
                emitProviderConfiguredEvent(token);
              });
            }
            record = makeRecord(injectableDefOrInjectorDefFactory(token), NOT_YET);
          } else {
            record = null;
          }
          this.records.set(token, record);
        }
        if (record != null) {
          return this.hydrate(token, record, flags);
        }
      }
      const nextInjector = !(flags & 2) ? this.parent : getNullInjector();
      notFoundValue = flags & 8 && notFoundValue === THROW_IF_NOT_FOUND ? null : notFoundValue;
      return nextInjector.get(token, notFoundValue);
    } catch (error) {
      const errorCode = getRuntimeErrorCode(error);
      if (errorCode === -200 || errorCode === -201) {
        if (!ngDevMode) {
          throw new RuntimeError(errorCode, null);
        }
        prependTokenToDependencyPath(error, token);
        if (previousInjector) {
          throw error;
        } else {
          throw augmentRuntimeError(error, this.source);
        }
      } else {
        throw error;
      }
    } finally {
      setInjectImplementation(previousInjectImplementation);
      setCurrentInjector(previousInjector);
      ngDevMode && setInjectorProfilerContext(prevInjectContext);
    }
  }
  /** @internal */
  resolveInjectorInitializers() {
    const prevConsumer = setActiveConsumer(null);
    const previousInjector = setCurrentInjector(this);
    const previousInjectImplementation = setInjectImplementation(void 0);
    let prevInjectContext;
    if (ngDevMode) {
      prevInjectContext = setInjectorProfilerContext({ injector: this, token: null });
    }
    try {
      const initializers = this.get(ENVIRONMENT_INITIALIZER, EMPTY_ARRAY, { self: true });
      if (ngDevMode && !Array.isArray(initializers)) {
        throw new RuntimeError(-209, `Unexpected type of the \`ENVIRONMENT_INITIALIZER\` token value (expected an array, but got ${typeof initializers}). Please check that the \`ENVIRONMENT_INITIALIZER\` token is configured as a \`multi: true\` provider.`);
      }
      for (const initializer of initializers) {
        initializer();
      }
    } finally {
      setCurrentInjector(previousInjector);
      setInjectImplementation(previousInjectImplementation);
      ngDevMode && setInjectorProfilerContext(prevInjectContext);
      setActiveConsumer(prevConsumer);
    }
  }
  toString() {
    const tokens = [];
    const records = this.records;
    for (const token of records.keys()) {
      tokens.push(stringify(token));
    }
    return `R3Injector[${tokens.join(", ")}]`;
  }
  /**
   * Process a `SingleProvider` and add it.
   */
  processProvider(provider) {
    provider = resolveForwardRef(provider);
    let token = isTypeProvider(provider) ? provider : resolveForwardRef(provider && provider.provide);
    const record = providerToRecord(provider);
    if (ngDevMode) {
      runInInjectorProfilerContext(this, token, () => {
        if (isValueProvider(provider)) {
          emitInjectorToCreateInstanceEvent(token);
          emitInstanceCreatedByInjectorEvent(provider.useValue);
        }
        emitProviderConfiguredEvent(provider);
      });
    }
    if (!isTypeProvider(provider) && provider.multi === true) {
      let multiRecord = this.records.get(token);
      if (multiRecord) {
        if (ngDevMode && multiRecord.multi === void 0) {
          throwMixedMultiProviderError();
        }
      } else {
        multiRecord = makeRecord(void 0, NOT_YET, true);
        multiRecord.factory = () => injectArgs(multiRecord.multi);
        this.records.set(token, multiRecord);
      }
      token = provider;
      multiRecord.multi.push(provider);
    } else {
      if (ngDevMode) {
        const existing = this.records.get(token);
        if (existing && existing.multi !== void 0) {
          throwMixedMultiProviderError();
        }
      }
    }
    this.records.set(token, record);
  }
  hydrate(token, record, flags) {
    const prevConsumer = setActiveConsumer(null);
    try {
      if (record.value === CIRCULAR) {
        throw cyclicDependencyError(stringify(token));
      } else if (record.value === NOT_YET) {
        record.value = CIRCULAR;
        if (ngDevMode) {
          runInInjectorProfilerContext(this, token, () => {
            emitInjectorToCreateInstanceEvent(token);
            record.value = record.factory(void 0, flags);
            emitInstanceCreatedByInjectorEvent(record.value);
          });
        } else {
          record.value = record.factory(void 0, flags);
        }
      }
      if (typeof record.value === "object" && record.value && hasOnDestroy(record.value)) {
        this._ngOnDestroyHooks.add(record.value);
      }
      return record.value;
    } finally {
      setActiveConsumer(prevConsumer);
    }
  }
  injectableDefInScope(def) {
    if (!def.providedIn) {
      return false;
    }
    const providedIn = resolveForwardRef(def.providedIn);
    if (typeof providedIn === "string") {
      return providedIn === "any" || this.scopes.has(providedIn);
    } else {
      return this.injectorDefTypes.has(providedIn);
    }
  }
  removeOnDestroy(callback) {
    const destroyCBIdx = this._onDestroyHooks.indexOf(callback);
    if (destroyCBIdx !== -1) {
      this._onDestroyHooks.splice(destroyCBIdx, 1);
    }
  }
};
function injectableDefOrInjectorDefFactory(token) {
  const injectableDef = getInjectableDef(token);
  const factory = injectableDef !== null ? injectableDef.factory : getFactoryDef(token);
  if (factory !== null) {
    return factory;
  }
  if (token instanceof InjectionToken) {
    throw new RuntimeError(204, ngDevMode && `Token ${stringify(token)} is missing a \u0275prov definition.`);
  }
  if (token instanceof Function) {
    return getUndecoratedInjectableFactory(token);
  }
  throw new RuntimeError(204, ngDevMode && "unreachable");
}
function getUndecoratedInjectableFactory(token) {
  const paramLength = token.length;
  if (paramLength > 0) {
    throw new RuntimeError(204, ngDevMode && `Can't resolve all parameters for ${stringify(token)}: (${newArray(paramLength, "?").join(", ")}).`);
  }
  const inheritedInjectableDef = getInheritedInjectableDef(token);
  if (inheritedInjectableDef !== null) {
    return () => inheritedInjectableDef.factory(token);
  } else {
    return () => new token();
  }
}
function providerToRecord(provider) {
  if (isValueProvider(provider)) {
    return makeRecord(void 0, provider.useValue);
  } else {
    const factory = providerToFactory(provider);
    return makeRecord(factory, NOT_YET);
  }
}
function providerToFactory(provider, ngModuleType, providers) {
  let factory = void 0;
  if (ngDevMode && isEnvironmentProviders(provider)) {
    throwInvalidProviderError(void 0, providers, provider);
  }
  if (isTypeProvider(provider)) {
    const unwrappedProvider = resolveForwardRef(provider);
    return getFactoryDef(unwrappedProvider) || injectableDefOrInjectorDefFactory(unwrappedProvider);
  } else {
    if (isValueProvider(provider)) {
      factory = () => resolveForwardRef(provider.useValue);
    } else if (isFactoryProvider(provider)) {
      factory = () => provider.useFactory(...injectArgs(provider.deps || []));
    } else if (isExistingProvider(provider)) {
      factory = (_4, flags) => \u0275\u0275inject(resolveForwardRef(provider.useExisting), flags !== void 0 && flags & 8 ? 8 : void 0);
    } else {
      const classRef = resolveForwardRef(provider && (provider.useClass || provider.provide));
      if (ngDevMode && !classRef) {
        throwInvalidProviderError(ngModuleType, providers, provider);
      }
      if (hasDeps(provider)) {
        factory = () => new classRef(...injectArgs(provider.deps));
      } else {
        return getFactoryDef(classRef) || injectableDefOrInjectorDefFactory(classRef);
      }
    }
  }
  return factory;
}
function assertNotDestroyed(injector) {
  if (injector.destroyed) {
    throw new RuntimeError(205, ngDevMode && "Injector has already been destroyed.");
  }
}
function makeRecord(factory, value, multi = false) {
  return {
    factory,
    value,
    multi: multi ? [] : void 0
  };
}
function hasDeps(value) {
  return !!value.deps;
}
function hasOnDestroy(value) {
  return value !== null && typeof value === "object" && typeof value.ngOnDestroy === "function";
}
function couldBeInjectableType(value) {
  return typeof value === "function" || typeof value === "object" && value.ngMetadataName === "InjectionToken";
}
function forEachSingleProvider(providers, fn) {
  for (const provider of providers) {
    if (Array.isArray(provider)) {
      forEachSingleProvider(provider, fn);
    } else if (provider && isEnvironmentProviders(provider)) {
      forEachSingleProvider(provider.\u0275providers, fn);
    } else {
      fn(provider);
    }
  }
}
function runInInjectionContext(injector, fn) {
  let internalInjector;
  if (injector instanceof R3Injector) {
    assertNotDestroyed(injector);
    internalInjector = injector;
  } else {
    internalInjector = new RetrievingInjector(injector);
  }
  let prevInjectorProfilerContext;
  if (ngDevMode) {
    prevInjectorProfilerContext = setInjectorProfilerContext({ injector, token: null });
  }
  const prevInjector = setCurrentInjector(internalInjector);
  const previousInjectImplementation = setInjectImplementation(void 0);
  try {
    return fn();
  } finally {
    setCurrentInjector(prevInjector);
    ngDevMode && setInjectorProfilerContext(prevInjectorProfilerContext);
    setInjectImplementation(previousInjectImplementation);
  }
}
function isInInjectionContext() {
  return getInjectImplementation() !== void 0 || getCurrentInjector() != null;
}
function assertInInjectionContext(debugFn) {
  if (!isInInjectionContext()) {
    throw new RuntimeError(-203, ngDevMode && debugFn.name + "() can only be used within an injection context such as a constructor, a factory function, a field initializer, or a function used with `runInInjectionContext`");
  }
}
var HOST = 0;
var TVIEW = 1;
var FLAGS = 2;
var PARENT = 3;
var NEXT = 4;
var T_HOST = 5;
var HYDRATION = 6;
var CLEANUP = 7;
var CONTEXT = 8;
var INJECTOR = 9;
var ENVIRONMENT = 10;
var RENDERER = 11;
var CHILD_HEAD = 12;
var CHILD_TAIL = 13;
var DECLARATION_VIEW = 14;
var DECLARATION_COMPONENT_VIEW = 15;
var DECLARATION_LCONTAINER = 16;
var PREORDER_HOOK_FLAGS = 17;
var QUERIES = 18;
var ID = 19;
var EMBEDDED_VIEW_INJECTOR = 20;
var ON_DESTROY_HOOKS = 21;
var EFFECTS_TO_SCHEDULE = 22;
var EFFECTS = 23;
var REACTIVE_TEMPLATE_CONSUMER = 24;
var AFTER_RENDER_SEQUENCES_TO_ADD = 25;
var HEADER_OFFSET = 26;
var TYPE = 1;
var DEHYDRATED_VIEWS = 6;
var NATIVE = 7;
var VIEW_REFS = 8;
var MOVED_VIEWS = 9;
var CONTAINER_HEADER_OFFSET = 10;
function isLView(value) {
  return Array.isArray(value) && typeof value[TYPE] === "object";
}
function isLContainer(value) {
  return Array.isArray(value) && value[TYPE] === true;
}
function isContentQueryHost(tNode) {
  return (tNode.flags & 4) !== 0;
}
function isComponentHost(tNode) {
  return tNode.componentOffset > -1;
}
function isDirectiveHost(tNode) {
  return (tNode.flags & 1) === 1;
}
function isComponentDef(def) {
  return !!def.template;
}
function isRootView(target) {
  return (target[FLAGS] & 512) !== 0;
}
function isDestroyed(lView) {
  return (lView[FLAGS] & 256) === 256;
}
function assertTNodeForLView(tNode, lView) {
  assertTNodeForTView(tNode, lView[TVIEW]);
}
function assertTNodeCreationIndex(lView, index) {
  const adjustedIndex = index + HEADER_OFFSET;
  assertIndexInRange(lView, adjustedIndex);
  assertLessThan(adjustedIndex, lView[TVIEW].bindingStartIndex, "TNodes should be created before any bindings");
}
function assertTNodeForTView(tNode, tView) {
  assertTNode(tNode);
  const tData = tView.data;
  for (let i = HEADER_OFFSET; i < tData.length; i++) {
    if (tData[i] === tNode) {
      return;
    }
  }
  throwError2("This TNode does not belong to this TView.");
}
function assertTNode(tNode) {
  assertDefined(tNode, "TNode must be defined");
  if (!(tNode && typeof tNode === "object" && tNode.hasOwnProperty("directiveStylingLast"))) {
    throwError2("Not of type TNode, got: " + tNode);
  }
}
function assertTIcu(tIcu) {
  assertDefined(tIcu, "Expected TIcu to be defined");
  if (!(typeof tIcu.currentCaseLViewIndex === "number")) {
    throwError2("Object is not of TIcu type.");
  }
}
function assertComponentType(actual, msg = "Type passed in is not ComponentType, it does not have '\u0275cmp' property.") {
  if (!getComponentDef(actual)) {
    throwError2(msg);
  }
}
function assertNgModuleType(actual, msg = "Type passed in is not NgModuleType, it does not have '\u0275mod' property.") {
  if (!getNgModuleDef(actual)) {
    throwError2(msg);
  }
}
function assertHasParent(tNode) {
  assertDefined(tNode, "currentTNode should exist!");
  assertDefined(tNode.parent, "currentTNode should have a parent");
}
function assertLContainer(value) {
  assertDefined(value, "LContainer must be defined");
  assertEqual(isLContainer(value), true, "Expecting LContainer");
}
function assertLViewOrUndefined(value) {
  value && assertEqual(isLView(value), true, "Expecting LView or undefined or null");
}
function assertLView(value) {
  assertDefined(value, "LView must be defined");
  assertEqual(isLView(value), true, "Expecting LView");
}
function assertFirstCreatePass(tView, errMessage) {
  assertEqual(tView.firstCreatePass, true, errMessage || "Should only be called in first create pass.");
}
function assertFirstUpdatePass(tView, errMessage) {
  assertEqual(tView.firstUpdatePass, true, "Should only be called in first update pass.");
}
function assertDirectiveDef(obj) {
  if (obj.type === void 0 || obj.selectors == void 0 || obj.inputs === void 0) {
    throwError2(`Expected a DirectiveDef/ComponentDef and this object does not seem to have the expected shape.`);
  }
}
function assertIndexInDeclRange(tView, index) {
  assertBetween(HEADER_OFFSET, tView.bindingStartIndex, index);
}
function assertIndexInExpandoRange(lView, index) {
  const tView = lView[1];
  assertBetween(tView.expandoStartIndex, lView.length, index);
}
function assertBetween(lower, upper, index) {
  if (!(lower <= index && index < upper)) {
    throwError2(`Index out of range (expecting ${lower} <= ${index} < ${upper})`);
  }
}
function assertProjectionSlots(lView, errMessage) {
  assertDefined(lView[DECLARATION_COMPONENT_VIEW], "Component views should exist.");
  assertDefined(lView[DECLARATION_COMPONENT_VIEW][T_HOST].projection, "Components with projection nodes (<ng-content>) must have projection slots defined.");
}
function assertParentView(lView, errMessage) {
  assertDefined(lView, "Component views should always have a parent view (component's host view)");
}
function assertNodeInjector(lView, injectorIndex) {
  assertIndexInExpandoRange(lView, injectorIndex);
  assertIndexInExpandoRange(
    lView,
    injectorIndex + 8
    /* NodeInjectorOffset.PARENT */
  );
  assertNumber(lView[injectorIndex + 0], "injectorIndex should point to a bloom filter");
  assertNumber(lView[injectorIndex + 1], "injectorIndex should point to a bloom filter");
  assertNumber(lView[injectorIndex + 2], "injectorIndex should point to a bloom filter");
  assertNumber(lView[injectorIndex + 3], "injectorIndex should point to a bloom filter");
  assertNumber(lView[injectorIndex + 4], "injectorIndex should point to a bloom filter");
  assertNumber(lView[injectorIndex + 5], "injectorIndex should point to a bloom filter");
  assertNumber(lView[injectorIndex + 6], "injectorIndex should point to a bloom filter");
  assertNumber(lView[injectorIndex + 7], "injectorIndex should point to a bloom filter");
  assertNumber(lView[
    injectorIndex + 8
    /* NodeInjectorOffset.PARENT */
  ], "injectorIndex should point to parent injector");
}
var SVG_NAMESPACE = "svg";
var MATH_ML_NAMESPACE = "math";
function unwrapRNode(value) {
  while (Array.isArray(value)) {
    value = value[HOST];
  }
  return value;
}
function unwrapLView(value) {
  while (Array.isArray(value)) {
    if (typeof value[TYPE] === "object")
      return value;
    value = value[HOST];
  }
  return null;
}
function getNativeByIndex(index, lView) {
  ngDevMode && assertIndexInRange(lView, index);
  ngDevMode && assertGreaterThanOrEqual(index, HEADER_OFFSET, "Expected to be past HEADER_OFFSET");
  return unwrapRNode(lView[index]);
}
function getNativeByTNode(tNode, lView) {
  ngDevMode && assertTNodeForLView(tNode, lView);
  ngDevMode && assertIndexInRange(lView, tNode.index);
  const node = unwrapRNode(lView[tNode.index]);
  return node;
}
function getTNode(tView, index) {
  ngDevMode && assertGreaterThan(index, -1, "wrong index for TNode");
  ngDevMode && assertLessThan(index, tView.data.length, "wrong index for TNode");
  const tNode = tView.data[index];
  ngDevMode && tNode !== null && assertTNode(tNode);
  return tNode;
}
function load(view, index) {
  ngDevMode && assertIndexInRange(view, index);
  return view[index];
}
function store(tView, lView, index, value) {
  if (index >= tView.data.length) {
    tView.data[index] = null;
    tView.blueprint[index] = null;
  }
  lView[index] = value;
}
function getComponentLViewByIndex(nodeIndex, hostView) {
  ngDevMode && assertIndexInRange(hostView, nodeIndex);
  const slotValue = hostView[nodeIndex];
  const lView = isLView(slotValue) ? slotValue : slotValue[HOST];
  return lView;
}
function isCreationMode(view) {
  return (view[FLAGS] & 4) === 4;
}
function viewAttachedToChangeDetector(view) {
  return (view[FLAGS] & 128) === 128;
}
function viewAttachedToContainer(view) {
  return isLContainer(view[PARENT]);
}
function getConstant(consts, index) {
  if (index === null || index === void 0)
    return null;
  ngDevMode && assertIndexInRange(consts, index);
  return consts[index];
}
function resetPreOrderHookFlags(lView) {
  lView[PREORDER_HOOK_FLAGS] = 0;
}
function markViewForRefresh(lView) {
  if (lView[FLAGS] & 1024) {
    return;
  }
  lView[FLAGS] |= 1024;
  if (viewAttachedToChangeDetector(lView)) {
    markAncestorsForTraversal(lView);
  }
}
function walkUpViews(nestingLevel, currentView) {
  while (nestingLevel > 0) {
    ngDevMode && assertDefined(currentView[DECLARATION_VIEW], "Declaration view should be defined if nesting level is greater than 0.");
    currentView = currentView[DECLARATION_VIEW];
    nestingLevel--;
  }
  return currentView;
}
function requiresRefreshOrTraversal(lView) {
  return !!(lView[FLAGS] & (1024 | 8192) || lView[REACTIVE_TEMPLATE_CONSUMER]?.dirty);
}
function updateAncestorTraversalFlagsOnAttach(lView) {
  lView[ENVIRONMENT].changeDetectionScheduler?.notify(
    8
    /* NotificationSource.ViewAttached */
  );
  if (lView[FLAGS] & 64) {
    lView[FLAGS] |= 1024;
  }
  if (requiresRefreshOrTraversal(lView)) {
    markAncestorsForTraversal(lView);
  }
}
function markAncestorsForTraversal(lView) {
  lView[ENVIRONMENT].changeDetectionScheduler?.notify(
    0
    /* NotificationSource.MarkAncestorsForTraversal */
  );
  let parent = getLViewParent(lView);
  while (parent !== null) {
    if (parent[FLAGS] & 8192) {
      break;
    }
    parent[FLAGS] |= 8192;
    if (!viewAttachedToChangeDetector(parent)) {
      break;
    }
    parent = getLViewParent(parent);
  }
}
function storeLViewOnDestroy(lView, onDestroyCallback) {
  if (isDestroyed(lView)) {
    throw new RuntimeError(911, ngDevMode && "View has already been destroyed.");
  }
  if (lView[ON_DESTROY_HOOKS] === null) {
    lView[ON_DESTROY_HOOKS] = [];
  }
  lView[ON_DESTROY_HOOKS].push(onDestroyCallback);
}
function removeLViewOnDestroy(lView, onDestroyCallback) {
  if (lView[ON_DESTROY_HOOKS] === null)
    return;
  const destroyCBIdx = lView[ON_DESTROY_HOOKS].indexOf(onDestroyCallback);
  if (destroyCBIdx !== -1) {
    lView[ON_DESTROY_HOOKS].splice(destroyCBIdx, 1);
  }
}
function getLViewParent(lView) {
  ngDevMode && assertLView(lView);
  const parent = lView[PARENT];
  return isLContainer(parent) ? parent[PARENT] : parent;
}
function getOrCreateLViewCleanup(view) {
  return view[CLEANUP] ??= [];
}
function getOrCreateTViewCleanup(tView) {
  return tView.cleanup ??= [];
}
function storeCleanupWithContext(tView, lView, context2, cleanupFn) {
  const lCleanup = getOrCreateLViewCleanup(lView);
  ngDevMode && assertDefined(context2, "Cleanup context is mandatory when registering framework-level destroy hooks");
  lCleanup.push(context2);
  if (tView.firstCreatePass) {
    getOrCreateTViewCleanup(tView).push(cleanupFn, lCleanup.length - 1);
  } else {
    if (ngDevMode) {
      Object.freeze(getOrCreateTViewCleanup(tView));
    }
  }
}
var instructionState = {
  lFrame: createLFrame(null),
  bindingsEnabled: true,
  skipHydrationRootTNode: null
};
var CheckNoChangesMode;
(function(CheckNoChangesMode2) {
  CheckNoChangesMode2[CheckNoChangesMode2["Off"] = 0] = "Off";
  CheckNoChangesMode2[CheckNoChangesMode2["Exhaustive"] = 1] = "Exhaustive";
  CheckNoChangesMode2[CheckNoChangesMode2["OnlyDirtyViews"] = 2] = "OnlyDirtyViews";
})(CheckNoChangesMode || (CheckNoChangesMode = {}));
var _checkNoChangesMode = 0;
var _isRefreshingViews = false;
function getElementDepthCount() {
  return instructionState.lFrame.elementDepthCount;
}
function increaseElementDepthCount() {
  instructionState.lFrame.elementDepthCount++;
}
function decreaseElementDepthCount() {
  instructionState.lFrame.elementDepthCount--;
}
function getBindingsEnabled() {
  return instructionState.bindingsEnabled;
}
function isInSkipHydrationBlock() {
  return instructionState.skipHydrationRootTNode !== null;
}
function isSkipHydrationRootTNode(tNode) {
  return instructionState.skipHydrationRootTNode === tNode;
}
function \u0275\u0275enableBindings() {
  instructionState.bindingsEnabled = true;
}
function \u0275\u0275disableBindings() {
  instructionState.bindingsEnabled = false;
}
function leaveSkipHydrationBlock() {
  instructionState.skipHydrationRootTNode = null;
}
function getLView() {
  return instructionState.lFrame.lView;
}
function getTView() {
  return instructionState.lFrame.tView;
}
function \u0275\u0275restoreView(viewToRestore) {
  instructionState.lFrame.contextLView = viewToRestore;
  return viewToRestore[CONTEXT];
}
function \u0275\u0275resetView(value) {
  instructionState.lFrame.contextLView = null;
  return value;
}
function getCurrentTNode() {
  let currentTNode = getCurrentTNodePlaceholderOk();
  while (currentTNode !== null && currentTNode.type === 64) {
    currentTNode = currentTNode.parent;
  }
  return currentTNode;
}
function getCurrentTNodePlaceholderOk() {
  return instructionState.lFrame.currentTNode;
}
function getCurrentParentTNode() {
  const lFrame = instructionState.lFrame;
  const currentTNode = lFrame.currentTNode;
  return lFrame.isParent ? currentTNode : currentTNode.parent;
}
function setCurrentTNode(tNode, isParent) {
  ngDevMode && tNode && assertTNodeForTView(tNode, instructionState.lFrame.tView);
  const lFrame = instructionState.lFrame;
  lFrame.currentTNode = tNode;
  lFrame.isParent = isParent;
}
function isCurrentTNodeParent() {
  return instructionState.lFrame.isParent;
}
function setCurrentTNodeAsNotParent() {
  instructionState.lFrame.isParent = false;
}
function getContextLView() {
  const contextLView = instructionState.lFrame.contextLView;
  ngDevMode && assertDefined(contextLView, "contextLView must be defined.");
  return contextLView;
}
function isInCheckNoChangesMode() {
  !ngDevMode && throwError2("Must never be called in production mode");
  return _checkNoChangesMode !== CheckNoChangesMode.Off;
}
function isExhaustiveCheckNoChanges() {
  !ngDevMode && throwError2("Must never be called in production mode");
  return _checkNoChangesMode === CheckNoChangesMode.Exhaustive;
}
function setIsInCheckNoChangesMode(mode) {
  !ngDevMode && throwError2("Must never be called in production mode");
  _checkNoChangesMode = mode;
}
function isRefreshingViews() {
  return _isRefreshingViews;
}
function setIsRefreshingViews(mode) {
  const prev = _isRefreshingViews;
  _isRefreshingViews = mode;
  return prev;
}
function getBindingRoot() {
  const lFrame = instructionState.lFrame;
  let index = lFrame.bindingRootIndex;
  if (index === -1) {
    index = lFrame.bindingRootIndex = lFrame.tView.bindingStartIndex;
  }
  return index;
}
function getBindingIndex() {
  return instructionState.lFrame.bindingIndex;
}
function setBindingIndex(value) {
  return instructionState.lFrame.bindingIndex = value;
}
function nextBindingIndex() {
  return instructionState.lFrame.bindingIndex++;
}
function incrementBindingIndex(count) {
  const lFrame = instructionState.lFrame;
  const index = lFrame.bindingIndex;
  lFrame.bindingIndex = lFrame.bindingIndex + count;
  return index;
}
function isInI18nBlock() {
  return instructionState.lFrame.inI18n;
}
function setInI18nBlock(isInI18nBlock2) {
  instructionState.lFrame.inI18n = isInI18nBlock2;
}
function setBindingRootForHostBindings(bindingRootIndex, currentDirectiveIndex) {
  const lFrame = instructionState.lFrame;
  lFrame.bindingIndex = lFrame.bindingRootIndex = bindingRootIndex;
  setCurrentDirectiveIndex(currentDirectiveIndex);
}
function getCurrentDirectiveIndex() {
  return instructionState.lFrame.currentDirectiveIndex;
}
function setCurrentDirectiveIndex(currentDirectiveIndex) {
  instructionState.lFrame.currentDirectiveIndex = currentDirectiveIndex;
}
function getCurrentDirectiveDef(tData) {
  const currentDirectiveIndex = instructionState.lFrame.currentDirectiveIndex;
  return currentDirectiveIndex === -1 ? null : tData[currentDirectiveIndex];
}
function getCurrentQueryIndex() {
  return instructionState.lFrame.currentQueryIndex;
}
function setCurrentQueryIndex(value) {
  instructionState.lFrame.currentQueryIndex = value;
}
function getDeclarationTNode(lView) {
  const tView = lView[TVIEW];
  if (tView.type === 2) {
    ngDevMode && assertDefined(tView.declTNode, "Embedded TNodes should have declaration parents.");
    return tView.declTNode;
  }
  if (tView.type === 1) {
    return lView[T_HOST];
  }
  return null;
}
function enterDI(lView, tNode, flags) {
  ngDevMode && assertLViewOrUndefined(lView);
  if (flags & 4) {
    ngDevMode && assertTNodeForTView(tNode, lView[TVIEW]);
    let parentTNode = tNode;
    let parentLView = lView;
    while (true) {
      ngDevMode && assertDefined(parentTNode, "Parent TNode should be defined");
      parentTNode = parentTNode.parent;
      if (parentTNode === null && !(flags & 1)) {
        parentTNode = getDeclarationTNode(parentLView);
        if (parentTNode === null)
          break;
        ngDevMode && assertDefined(parentLView, "Parent LView should be defined");
        parentLView = parentLView[DECLARATION_VIEW];
        if (parentTNode.type & (2 | 8)) {
          break;
        }
      } else {
        break;
      }
    }
    if (parentTNode === null) {
      return false;
    } else {
      tNode = parentTNode;
      lView = parentLView;
    }
  }
  ngDevMode && assertTNodeForLView(tNode, lView);
  const lFrame = instructionState.lFrame = allocLFrame();
  lFrame.currentTNode = tNode;
  lFrame.lView = lView;
  return true;
}
function enterView(newView) {
  ngDevMode && assertNotEqual(newView[0], newView[1], "????");
  ngDevMode && assertLViewOrUndefined(newView);
  const newLFrame = allocLFrame();
  if (ngDevMode) {
    assertEqual(newLFrame.isParent, true, "Expected clean LFrame");
    assertEqual(newLFrame.lView, null, "Expected clean LFrame");
    assertEqual(newLFrame.tView, null, "Expected clean LFrame");
    assertEqual(newLFrame.selectedIndex, -1, "Expected clean LFrame");
    assertEqual(newLFrame.elementDepthCount, 0, "Expected clean LFrame");
    assertEqual(newLFrame.currentDirectiveIndex, -1, "Expected clean LFrame");
    assertEqual(newLFrame.currentNamespace, null, "Expected clean LFrame");
    assertEqual(newLFrame.bindingRootIndex, -1, "Expected clean LFrame");
    assertEqual(newLFrame.currentQueryIndex, 0, "Expected clean LFrame");
  }
  const tView = newView[TVIEW];
  instructionState.lFrame = newLFrame;
  ngDevMode && tView.firstChild && assertTNodeForTView(tView.firstChild, tView);
  newLFrame.currentTNode = tView.firstChild;
  newLFrame.lView = newView;
  newLFrame.tView = tView;
  newLFrame.contextLView = newView;
  newLFrame.bindingIndex = tView.bindingStartIndex;
  newLFrame.inI18n = false;
}
function allocLFrame() {
  const currentLFrame = instructionState.lFrame;
  const childLFrame = currentLFrame === null ? null : currentLFrame.child;
  const newLFrame = childLFrame === null ? createLFrame(currentLFrame) : childLFrame;
  return newLFrame;
}
function createLFrame(parent) {
  const lFrame = {
    currentTNode: null,
    isParent: true,
    lView: null,
    tView: null,
    selectedIndex: -1,
    contextLView: null,
    elementDepthCount: 0,
    currentNamespace: null,
    currentDirectiveIndex: -1,
    bindingRootIndex: -1,
    bindingIndex: -1,
    currentQueryIndex: 0,
    parent,
    child: null,
    inI18n: false
  };
  parent !== null && (parent.child = lFrame);
  return lFrame;
}
function leaveViewLight() {
  const oldLFrame = instructionState.lFrame;
  instructionState.lFrame = oldLFrame.parent;
  oldLFrame.currentTNode = null;
  oldLFrame.lView = null;
  return oldLFrame;
}
var leaveDI = leaveViewLight;
function leaveView() {
  const oldLFrame = leaveViewLight();
  oldLFrame.isParent = true;
  oldLFrame.tView = null;
  oldLFrame.selectedIndex = -1;
  oldLFrame.contextLView = null;
  oldLFrame.elementDepthCount = 0;
  oldLFrame.currentDirectiveIndex = -1;
  oldLFrame.currentNamespace = null;
  oldLFrame.bindingRootIndex = -1;
  oldLFrame.bindingIndex = -1;
  oldLFrame.currentQueryIndex = 0;
}
function nextContextImpl(level) {
  const contextLView = instructionState.lFrame.contextLView = walkUpViews(level, instructionState.lFrame.contextLView);
  return contextLView[CONTEXT];
}
function getSelectedIndex() {
  return instructionState.lFrame.selectedIndex;
}
function setSelectedIndex(index) {
  ngDevMode && index !== -1 && assertGreaterThanOrEqual(index, HEADER_OFFSET, "Index must be past HEADER_OFFSET (or -1).");
  ngDevMode && assertLessThan(index, instructionState.lFrame.lView.length, "Can't set index passed end of LView");
  instructionState.lFrame.selectedIndex = index;
}
function getSelectedTNode() {
  const lFrame = instructionState.lFrame;
  return getTNode(lFrame.tView, lFrame.selectedIndex);
}
function \u0275\u0275namespaceSVG() {
  instructionState.lFrame.currentNamespace = SVG_NAMESPACE;
}
function \u0275\u0275namespaceMathML() {
  instructionState.lFrame.currentNamespace = MATH_ML_NAMESPACE;
}
function \u0275\u0275namespaceHTML() {
  namespaceHTMLInternal();
}
function namespaceHTMLInternal() {
  instructionState.lFrame.currentNamespace = null;
}
function getNamespace() {
  return instructionState.lFrame.currentNamespace;
}
var _wasLastNodeCreated = true;
function wasLastNodeCreated() {
  return _wasLastNodeCreated;
}
function lastNodeWasCreated(flag) {
  _wasLastNodeCreated = flag;
}
function createInjector(defType, parent = null, additionalProviders = null, name2) {
  const injector = createInjectorWithoutInjectorInstances(defType, parent, additionalProviders, name2);
  injector.resolveInjectorInitializers();
  return injector;
}
function createInjectorWithoutInjectorInstances(defType, parent = null, additionalProviders = null, name2, scopes = /* @__PURE__ */ new Set()) {
  const providers = [additionalProviders || EMPTY_ARRAY, importProvidersFrom(defType)];
  name2 = name2 || (typeof defType === "object" ? void 0 : stringify(defType));
  return new R3Injector(providers, parent || getNullInjector(), name2 || null, scopes);
}
var Injector = class _Injector {
  static THROW_IF_NOT_FOUND = THROW_IF_NOT_FOUND;
  static NULL = new NullInjector();
  static create(options, parent) {
    if (Array.isArray(options)) {
      return createInjector({ name: "" }, parent, options, "");
    } else {
      const name2 = options.name ?? "";
      return createInjector({ name: name2 }, options.parent, options.providers, name2);
    }
  }
  /** @nocollapse */
  static \u0275prov = (
    /** @pureOrBreakMyCode */
    /* @__PURE__ */ \u0275\u0275defineInjectable({
      token: _Injector,
      providedIn: "any",
      factory: () => \u0275\u0275inject(INJECTOR$1)
    })
  );
  /**
   * @internal
   * @nocollapse
   */
  static __NG_ELEMENT_ID__ = -1;
};
var DOCUMENT = new InjectionToken(ngDevMode ? "DocumentToken" : "");
var DestroyRef = class {
  /**
   * @internal
   * @nocollapse
   */
  static __NG_ELEMENT_ID__ = injectDestroyRef;
  /**
   * @internal
   * @nocollapse
   */
  static __NG_ENV_ID__ = (injector) => injector;
};
var NodeInjectorDestroyRef = class extends DestroyRef {
  _lView;
  constructor(_lView) {
    super();
    this._lView = _lView;
  }
  get destroyed() {
    return isDestroyed(this._lView);
  }
  onDestroy(callback) {
    const lView = this._lView;
    storeLViewOnDestroy(lView, callback);
    return () => removeLViewOnDestroy(lView, callback);
  }
};
function injectDestroyRef() {
  return new NodeInjectorDestroyRef(getLView());
}
var ErrorHandler = class {
  /**
   * @internal
   */
  _console = console;
  handleError(error) {
    this._console.error("ERROR", error);
  }
};
var INTERNAL_APPLICATION_ERROR_HANDLER = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "internal error handler" : "", {
  providedIn: "root",
  factory: () => {
    const injector = inject2(EnvironmentInjector);
    let userErrorHandler;
    return (e) => {
      if (injector.destroyed && !userErrorHandler) {
        setTimeout(() => {
          throw e;
        });
      } else {
        userErrorHandler ??= injector.get(ErrorHandler);
        userErrorHandler.handleError(e);
      }
    };
  }
});
var errorHandlerEnvironmentInitializer = {
  provide: ENVIRONMENT_INITIALIZER,
  useValue: () => void inject2(ErrorHandler),
  multi: true
};
var globalErrorListeners = new InjectionToken(ngDevMode ? "GlobalErrorListeners" : "", {
  providedIn: "root",
  factory: () => {
    if (false) {
      return;
    }
    const window2 = inject2(DOCUMENT).defaultView;
    if (!window2) {
      return;
    }
    const errorHandler2 = inject2(INTERNAL_APPLICATION_ERROR_HANDLER);
    const rejectionListener = (e) => {
      errorHandler2(e.reason);
      e.preventDefault();
    };
    const errorListener = (e) => {
      if (e.error) {
        errorHandler2(e.error);
      } else {
        errorHandler2(new Error(ngDevMode ? `An ErrorEvent with no error occurred. See Error.cause for details: ${e.message}` : e.message, { cause: e }));
      }
      e.preventDefault();
    };
    const setupEventListeners = () => {
      window2.addEventListener("unhandledrejection", rejectionListener);
      window2.addEventListener("error", errorListener);
    };
    if (typeof Zone !== "undefined") {
      Zone.root.run(setupEventListeners);
    } else {
      setupEventListeners();
    }
    inject2(DestroyRef).onDestroy(() => {
      window2.removeEventListener("error", errorListener);
      window2.removeEventListener("unhandledrejection", rejectionListener);
    });
  }
});
function provideBrowserGlobalErrorListeners() {
  return makeEnvironmentProviders([
    provideEnvironmentInitializer(() => void inject2(globalErrorListeners))
  ]);
}
function isSignal(value) {
  return typeof value === "function" && value[SIGNAL] !== void 0;
}
function signal(initialValue, options) {
  const [get, set2, update] = createSignal(initialValue, options?.equal);
  const signalFn = get;
  const node = signalFn[SIGNAL];
  signalFn.set = set2;
  signalFn.update = update;
  signalFn.asReadonly = signalAsReadonlyFn.bind(signalFn);
  if (ngDevMode) {
    signalFn.toString = () => `[Signal: ${signalFn()}]`;
    node.debugName = options?.debugName;
  }
  return signalFn;
}
function signalAsReadonlyFn() {
  const node = this[SIGNAL];
  if (node.readonlyFn === void 0) {
    const readonlyFn = () => this();
    readonlyFn[SIGNAL] = node;
    node.readonlyFn = readonlyFn;
  }
  return node.readonlyFn;
}
function isWritableSignal(value) {
  return isSignal(value) && typeof value.set === "function";
}
var ChangeDetectionScheduler = class {
};
var ZONELESS_ENABLED = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "Zoneless enabled" : "", { providedIn: "root", factory: () => false });
var PROVIDED_ZONELESS = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "Zoneless provided" : "", { providedIn: "root", factory: () => false });
var ZONELESS_SCHEDULER_DISABLED = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "scheduler disabled" : "");
var SCHEDULE_IN_ROOT_ZONE = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "run changes outside zone in root" : "");
function assertNotInReactiveContext(debugFn, extraContext) {
  if (getActiveConsumer() !== null) {
    throw new RuntimeError(-602, ngDevMode && `${debugFn.name}() cannot be called from within a reactive context.${extraContext ? ` ${extraContext}` : ""}`);
  }
}
var ViewContext = class {
  view;
  node;
  constructor(view, node) {
    this.view = view;
    this.node = node;
  }
  /**
   * @internal
   * @nocollapse
   */
  static __NG_ELEMENT_ID__ = injectViewContext;
};
function injectViewContext() {
  return new ViewContext(getLView(), getCurrentTNode());
}
var PendingTasksInternal = class _PendingTasksInternal {
  taskId = 0;
  pendingTasks = /* @__PURE__ */ new Set();
  destroyed = false;
  pendingTask = new BehaviorSubject(false);
  get hasPendingTasks() {
    return this.destroyed ? false : this.pendingTask.value;
  }
  /**
   * In case the service is about to be destroyed, return a self-completing observable.
   * Otherwise, return the observable that emits the current state of pending tasks.
   */
  get hasPendingTasksObservable() {
    if (this.destroyed) {
      return new Observable((subscriber) => {
        subscriber.next(false);
        subscriber.complete();
      });
    }
    return this.pendingTask;
  }
  add() {
    if (!this.hasPendingTasks && !this.destroyed) {
      this.pendingTask.next(true);
    }
    const taskId = this.taskId++;
    this.pendingTasks.add(taskId);
    return taskId;
  }
  has(taskId) {
    return this.pendingTasks.has(taskId);
  }
  remove(taskId) {
    this.pendingTasks.delete(taskId);
    if (this.pendingTasks.size === 0 && this.hasPendingTasks) {
      this.pendingTask.next(false);
    }
  }
  ngOnDestroy() {
    this.pendingTasks.clear();
    if (this.hasPendingTasks) {
      this.pendingTask.next(false);
    }
    this.destroyed = true;
    this.pendingTask.unsubscribe();
  }
  /** @nocollapse */
  static \u0275prov = (
    /** @pureOrBreakMyCode */
    /* @__PURE__ */ \u0275\u0275defineInjectable({
      token: _PendingTasksInternal,
      providedIn: "root",
      factory: () => new _PendingTasksInternal()
    })
  );
};
var PendingTasks = class _PendingTasks {
  internalPendingTasks = inject2(PendingTasksInternal);
  scheduler = inject2(ChangeDetectionScheduler);
  errorHandler = inject2(INTERNAL_APPLICATION_ERROR_HANDLER);
  /**
   * Adds a new task that should block application's stability.
   * @returns A cleanup function that removes a task when called.
   */
  add() {
    const taskId = this.internalPendingTasks.add();
    return () => {
      if (!this.internalPendingTasks.has(taskId)) {
        return;
      }
      this.scheduler.notify(
        11
        /* NotificationSource.PendingTaskRemoved */
      );
      this.internalPendingTasks.remove(taskId);
    };
  }
  /**
   * Runs an asynchronous function and blocks the application's stability until the function completes.
   *
   * ```ts
   * pendingTasks.run(async () => {
   *   const userData = await fetch('/api/user');
   *   this.userData.set(userData);
   * });
   * ```
   *
   * @param fn The asynchronous function to execute
   * @developerPreview 19.0
   */
  run(fn) {
    const removeTask = this.add();
    fn().catch(this.errorHandler).finally(removeTask);
  }
  /** @nocollapse */
  static \u0275prov = (
    /** @pureOrBreakMyCode */
    /* @__PURE__ */ \u0275\u0275defineInjectable({
      token: _PendingTasks,
      providedIn: "root",
      factory: () => new _PendingTasks()
    })
  );
};
function noop2(...args) {
}
var EffectScheduler = class _EffectScheduler {
  /** @nocollapse */
  static \u0275prov = (
    /** @pureOrBreakMyCode */
    /* @__PURE__ */ \u0275\u0275defineInjectable({
      token: _EffectScheduler,
      providedIn: "root",
      factory: () => new ZoneAwareEffectScheduler()
    })
  );
};
var ZoneAwareEffectScheduler = class {
  dirtyEffectCount = 0;
  queues = /* @__PURE__ */ new Map();
  add(handle) {
    this.enqueue(handle);
    this.schedule(handle);
  }
  schedule(handle) {
    if (!handle.dirty) {
      return;
    }
    this.dirtyEffectCount++;
  }
  remove(handle) {
    const zone = handle.zone;
    const queue = this.queues.get(zone);
    if (!queue.has(handle)) {
      return;
    }
    queue.delete(handle);
    if (handle.dirty) {
      this.dirtyEffectCount--;
    }
  }
  enqueue(handle) {
    const zone = handle.zone;
    if (!this.queues.has(zone)) {
      this.queues.set(zone, /* @__PURE__ */ new Set());
    }
    const queue = this.queues.get(zone);
    if (queue.has(handle)) {
      return;
    }
    queue.add(handle);
  }
  /**
   * Run all scheduled effects.
   *
   * Execution order of effects within the same zone is guaranteed to be FIFO, but there is no
   * ordering guarantee between effects scheduled in different zones.
   */
  flush() {
    while (this.dirtyEffectCount > 0) {
      let ranOneEffect = false;
      for (const [zone, queue] of this.queues) {
        if (zone === null) {
          ranOneEffect ||= this.flushQueue(queue);
        } else {
          ranOneEffect ||= zone.run(() => this.flushQueue(queue));
        }
      }
      if (!ranOneEffect) {
        this.dirtyEffectCount = 0;
      }
    }
  }
  flushQueue(queue) {
    let ranOneEffect = false;
    for (const handle of queue) {
      if (!handle.dirty) {
        continue;
      }
      this.dirtyEffectCount--;
      ranOneEffect = true;
      handle.run();
    }
    return ranOneEffect;
  }
};

// node_modules/@angular/core/fesm2022/debug_node.mjs
function noSideEffects(fn) {
  return { toString: fn }.toString();
}
var ANNOTATIONS = "__annotations__";
var PARAMETERS = "__parameters__";
var PROP_METADATA = "__prop__metadata__";
function makeDecorator(name2, props, parentClass, additionalProcessing, typeFn) {
  return noSideEffects(() => {
    const metaCtor = makeMetadataCtor(props);
    function DecoratorFactory(...args) {
      if (this instanceof DecoratorFactory) {
        metaCtor.call(this, ...args);
        return this;
      }
      const annotationInstance = new DecoratorFactory(...args);
      return function TypeDecorator(cls) {
        if (typeFn)
          typeFn(cls, ...args);
        const annotations = cls.hasOwnProperty(ANNOTATIONS) ? cls[ANNOTATIONS] : Object.defineProperty(cls, ANNOTATIONS, { value: [] })[ANNOTATIONS];
        annotations.push(annotationInstance);
        return cls;
      };
    }
    if (parentClass) {
      DecoratorFactory.prototype = Object.create(parentClass.prototype);
    }
    DecoratorFactory.prototype.ngMetadataName = name2;
    DecoratorFactory.annotationCls = DecoratorFactory;
    return DecoratorFactory;
  });
}
function makeMetadataCtor(props) {
  return function ctor(...args) {
    if (props) {
      const values = props(...args);
      for (const propName in values) {
        this[propName] = values[propName];
      }
    }
  };
}
function makeParamDecorator(name2, props, parentClass) {
  return noSideEffects(() => {
    const metaCtor = makeMetadataCtor(props);
    function ParamDecoratorFactory(...args) {
      if (this instanceof ParamDecoratorFactory) {
        metaCtor.apply(this, args);
        return this;
      }
      const annotationInstance = new ParamDecoratorFactory(...args);
      ParamDecorator.annotation = annotationInstance;
      return ParamDecorator;
      function ParamDecorator(cls, unusedKey, index) {
        const parameters = cls.hasOwnProperty(PARAMETERS) ? cls[PARAMETERS] : Object.defineProperty(cls, PARAMETERS, { value: [] })[PARAMETERS];
        while (parameters.length <= index) {
          parameters.push(null);
        }
        (parameters[index] = parameters[index] || []).push(annotationInstance);
        return cls;
      }
    }
    ParamDecoratorFactory.prototype.ngMetadataName = name2;
    ParamDecoratorFactory.annotationCls = ParamDecoratorFactory;
    return ParamDecoratorFactory;
  });
}
function makePropDecorator(name2, props, parentClass, additionalProcessing) {
  return noSideEffects(() => {
    const metaCtor = makeMetadataCtor(props);
    function PropDecoratorFactory(...args) {
      if (this instanceof PropDecoratorFactory) {
        metaCtor.apply(this, args);
        return this;
      }
      const decoratorInstance = new PropDecoratorFactory(...args);
      function PropDecorator(target, name3) {
        if (target === void 0) {
          throw new Error("Standard Angular field decorators are not supported in JIT mode.");
        }
        const constructor = target.constructor;
        const meta = constructor.hasOwnProperty(PROP_METADATA) ? constructor[PROP_METADATA] : Object.defineProperty(constructor, PROP_METADATA, { value: {} })[PROP_METADATA];
        meta[name3] = meta.hasOwnProperty(name3) && meta[name3] || [];
        meta[name3].unshift(decoratorInstance);
      }
      return PropDecorator;
    }
    if (parentClass) {
      PropDecoratorFactory.prototype = Object.create(parentClass.prototype);
    }
    PropDecoratorFactory.prototype.ngMetadataName = name2;
    PropDecoratorFactory.annotationCls = PropDecoratorFactory;
    return PropDecoratorFactory;
  });
}
var Inject = attachInjectFlag(
  // Disable tslint because `DecoratorFlags` is a const enum which gets inlined.
  makeParamDecorator("Inject", (token) => ({ token })),
  -1
  /* DecoratorFlags.Inject */
);
var Optional = (
  // Disable tslint because `InternalInjectFlags` is a const enum which gets inlined.
  // tslint:disable-next-line: no-toplevel-property-access
  attachInjectFlag(
    makeParamDecorator("Optional"),
    8
    /* InternalInjectFlags.Optional */
  )
);
var Self = (
  // Disable tslint because `InternalInjectFlags` is a const enum which gets inlined.
  // tslint:disable-next-line: no-toplevel-property-access
  attachInjectFlag(
    makeParamDecorator("Self"),
    2
    /* InternalInjectFlags.Self */
  )
);
var SkipSelf = (
  // Disable tslint because `InternalInjectFlags` is a const enum which gets inlined.
  // tslint:disable-next-line: no-toplevel-property-access
  attachInjectFlag(
    makeParamDecorator("SkipSelf"),
    4
    /* InternalInjectFlags.SkipSelf */
  )
);
var Host = (
  // Disable tslint because `InternalInjectFlags` is a const enum which gets inlined.
  // tslint:disable-next-line: no-toplevel-property-access
  attachInjectFlag(
    makeParamDecorator("Host"),
    1
    /* InternalInjectFlags.Host */
  )
);
function getCompilerFacade(request) {
  const globalNg = _global["ng"];
  if (globalNg && globalNg.\u0275compilerFacade) {
    return globalNg.\u0275compilerFacade;
  }
  if (typeof ngDevMode === "undefined" || ngDevMode) {
    console.error(`JIT compilation failed for ${request.kind}`, request.type);
    let message = `The ${request.kind} '${request.type.name}' needs to be compiled using the JIT compiler, but '@angular/compiler' is not available.

`;
    if (request.usage === 1) {
      message += `The ${request.kind} is part of a library that has been partially compiled.
`;
      message += `However, the Angular Linker has not processed the library such that JIT compilation is used as fallback.
`;
      message += "\n";
      message += `Ideally, the library is processed using the Angular Linker to become fully AOT compiled.
`;
    } else {
      message += `JIT compilation is discouraged for production use-cases! Consider using AOT mode instead.
`;
    }
    message += `Alternatively, the JIT compiler should be loaded by bootstrapping using '@angular/platform-browser-dynamic' or '@angular/platform-server',
`;
    message += `or manually provide the compiler with 'import "@angular/compiler";' before bootstrapping.`;
    throw new Error(message);
  } else {
    throw new Error("JIT compiler unavailable");
  }
}
var angularCoreDiEnv = {
  "\u0275\u0275defineInjectable": \u0275\u0275defineInjectable,
  "\u0275\u0275defineInjector": \u0275\u0275defineInjector,
  "\u0275\u0275inject": \u0275\u0275inject,
  "\u0275\u0275invalidFactoryDep": \u0275\u0275invalidFactoryDep,
  "resolveForwardRef": resolveForwardRef
};
var Type = Function;
function isType(v) {
  return typeof v === "function";
}
var ES5_DELEGATE_CTOR = /^function\s+\S+\(\)\s*{[\s\S]+\.apply\(this,\s*(arguments|(?:[^()]+\(\[\],)?[^()]+\(arguments\).*)\)/;
var ES2015_INHERITED_CLASS = /^class\s+[A-Za-z\d$_]*\s*extends\s+[^{]+{/;
var ES2015_INHERITED_CLASS_WITH_CTOR = /^class\s+[A-Za-z\d$_]*\s*extends\s+[^{]+{[\s\S]*constructor\s*\(/;
var ES2015_INHERITED_CLASS_WITH_DELEGATE_CTOR = /^class\s+[A-Za-z\d$_]*\s*extends\s+[^{]+{[\s\S]*constructor\s*\(\)\s*{[^}]*super\(\.\.\.arguments\)/;
function isDelegateCtor(typeStr) {
  return ES5_DELEGATE_CTOR.test(typeStr) || ES2015_INHERITED_CLASS_WITH_DELEGATE_CTOR.test(typeStr) || ES2015_INHERITED_CLASS.test(typeStr) && !ES2015_INHERITED_CLASS_WITH_CTOR.test(typeStr);
}
var ReflectionCapabilities = class {
  _reflect;
  constructor(reflect) {
    this._reflect = reflect || _global["Reflect"];
  }
  factory(t) {
    return (...args) => new t(...args);
  }
  /** @internal */
  _zipTypesAndAnnotations(paramTypes, paramAnnotations) {
    let result;
    if (typeof paramTypes === "undefined") {
      result = newArray(paramAnnotations.length);
    } else {
      result = newArray(paramTypes.length);
    }
    for (let i = 0; i < result.length; i++) {
      if (typeof paramTypes === "undefined") {
        result[i] = [];
      } else if (paramTypes[i] && paramTypes[i] != Object) {
        result[i] = [paramTypes[i]];
      } else {
        result[i] = [];
      }
      if (paramAnnotations && paramAnnotations[i] != null) {
        result[i] = result[i].concat(paramAnnotations[i]);
      }
    }
    return result;
  }
  _ownParameters(type, parentCtor) {
    const typeStr = type.toString();
    if (isDelegateCtor(typeStr)) {
      return null;
    }
    if (type.parameters && type.parameters !== parentCtor.parameters) {
      return type.parameters;
    }
    const tsickleCtorParams = type.ctorParameters;
    if (tsickleCtorParams && tsickleCtorParams !== parentCtor.ctorParameters) {
      const ctorParameters = typeof tsickleCtorParams === "function" ? tsickleCtorParams() : tsickleCtorParams;
      const paramTypes2 = ctorParameters.map((ctorParam) => ctorParam && ctorParam.type);
      const paramAnnotations2 = ctorParameters.map((ctorParam) => ctorParam && convertTsickleDecoratorIntoMetadata(ctorParam.decorators));
      return this._zipTypesAndAnnotations(paramTypes2, paramAnnotations2);
    }
    const paramAnnotations = type.hasOwnProperty(PARAMETERS) && type[PARAMETERS];
    const paramTypes = this._reflect && this._reflect.getOwnMetadata && this._reflect.getOwnMetadata("design:paramtypes", type);
    if (paramTypes || paramAnnotations) {
      return this._zipTypesAndAnnotations(paramTypes, paramAnnotations);
    }
    return newArray(type.length);
  }
  parameters(type) {
    if (!isType(type)) {
      return [];
    }
    const parentCtor = getParentCtor(type);
    let parameters = this._ownParameters(type, parentCtor);
    if (!parameters && parentCtor !== Object) {
      parameters = this.parameters(parentCtor);
    }
    return parameters || [];
  }
  _ownAnnotations(typeOrFunc, parentCtor) {
    if (typeOrFunc.annotations && typeOrFunc.annotations !== parentCtor.annotations) {
      let annotations = typeOrFunc.annotations;
      if (typeof annotations === "function" && annotations.annotations) {
        annotations = annotations.annotations;
      }
      return annotations;
    }
    if (typeOrFunc.decorators && typeOrFunc.decorators !== parentCtor.decorators) {
      return convertTsickleDecoratorIntoMetadata(typeOrFunc.decorators);
    }
    if (typeOrFunc.hasOwnProperty(ANNOTATIONS)) {
      return typeOrFunc[ANNOTATIONS];
    }
    return null;
  }
  annotations(typeOrFunc) {
    if (!isType(typeOrFunc)) {
      return [];
    }
    const parentCtor = getParentCtor(typeOrFunc);
    const ownAnnotations = this._ownAnnotations(typeOrFunc, parentCtor) || [];
    const parentAnnotations = parentCtor !== Object ? this.annotations(parentCtor) : [];
    return parentAnnotations.concat(ownAnnotations);
  }
  _ownPropMetadata(typeOrFunc, parentCtor) {
    if (typeOrFunc.propMetadata && typeOrFunc.propMetadata !== parentCtor.propMetadata) {
      let propMetadata = typeOrFunc.propMetadata;
      if (typeof propMetadata === "function" && propMetadata.propMetadata) {
        propMetadata = propMetadata.propMetadata;
      }
      return propMetadata;
    }
    if (typeOrFunc.propDecorators && typeOrFunc.propDecorators !== parentCtor.propDecorators) {
      const propDecorators = typeOrFunc.propDecorators;
      const propMetadata = {};
      Object.keys(propDecorators).forEach((prop) => {
        propMetadata[prop] = convertTsickleDecoratorIntoMetadata(propDecorators[prop]);
      });
      return propMetadata;
    }
    if (typeOrFunc.hasOwnProperty(PROP_METADATA)) {
      return typeOrFunc[PROP_METADATA];
    }
    return null;
  }
  propMetadata(typeOrFunc) {
    if (!isType(typeOrFunc)) {
      return {};
    }
    const parentCtor = getParentCtor(typeOrFunc);
    const propMetadata = {};
    if (parentCtor !== Object) {
      const parentPropMetadata = this.propMetadata(parentCtor);
      Object.keys(parentPropMetadata).forEach((propName) => {
        propMetadata[propName] = parentPropMetadata[propName];
      });
    }
    const ownPropMetadata = this._ownPropMetadata(typeOrFunc, parentCtor);
    if (ownPropMetadata) {
      Object.keys(ownPropMetadata).forEach((propName) => {
        const decorators = [];
        if (propMetadata.hasOwnProperty(propName)) {
          decorators.push(...propMetadata[propName]);
        }
        decorators.push(...ownPropMetadata[propName]);
        propMetadata[propName] = decorators;
      });
    }
    return propMetadata;
  }
  ownPropMetadata(typeOrFunc) {
    if (!isType(typeOrFunc)) {
      return {};
    }
    return this._ownPropMetadata(typeOrFunc, getParentCtor(typeOrFunc)) || {};
  }
  hasLifecycleHook(type, lcProperty) {
    return type instanceof Type && lcProperty in type.prototype;
  }
};
function convertTsickleDecoratorIntoMetadata(decoratorInvocations) {
  if (!decoratorInvocations) {
    return [];
  }
  return decoratorInvocations.map((decoratorInvocation) => {
    const decoratorType = decoratorInvocation.type;
    const annotationCls = decoratorType.annotationCls;
    const annotationArgs = decoratorInvocation.args ? decoratorInvocation.args : [];
    return new annotationCls(...annotationArgs);
  });
}
function getParentCtor(ctor) {
  const parentProto = ctor.prototype ? Object.getPrototypeOf(ctor.prototype) : null;
  const parentCtor = parentProto ? parentProto.constructor : null;
  return parentCtor || Object;
}
var SimpleChange = class {
  previousValue;
  currentValue;
  firstChange;
  constructor(previousValue, currentValue, firstChange) {
    this.previousValue = previousValue;
    this.currentValue = currentValue;
    this.firstChange = firstChange;
  }
  /**
   * Check whether the new value is the first value assigned.
   */
  isFirstChange() {
    return this.firstChange;
  }
};
function applyValueToInputField(instance, inputSignalNode, privateName, value) {
  if (inputSignalNode !== null) {
    inputSignalNode.applyValueToInputSignal(inputSignalNode, value);
  } else {
    instance[privateName] = value;
  }
}
var \u0275\u0275NgOnChangesFeature = /* @__PURE__ */ (() => {
  const \u0275\u0275NgOnChangesFeatureImpl = () => NgOnChangesFeatureImpl;
  \u0275\u0275NgOnChangesFeatureImpl.ngInherit = true;
  return \u0275\u0275NgOnChangesFeatureImpl;
})();
function NgOnChangesFeatureImpl(definition) {
  if (definition.type.prototype.ngOnChanges) {
    definition.setInput = ngOnChangesSetInput;
  }
  return rememberChangeHistoryAndInvokeOnChangesHook;
}
function rememberChangeHistoryAndInvokeOnChangesHook() {
  const simpleChangesStore = getSimpleChangesStore(this);
  const current = simpleChangesStore?.current;
  if (current) {
    const previous = simpleChangesStore.previous;
    if (previous === EMPTY_OBJ) {
      simpleChangesStore.previous = current;
    } else {
      for (let key in current) {
        previous[key] = current[key];
      }
    }
    simpleChangesStore.current = null;
    this.ngOnChanges(current);
  }
}
function ngOnChangesSetInput(instance, inputSignalNode, value, publicName, privateName) {
  const declaredName = this.declaredInputs[publicName];
  ngDevMode && assertString(declaredName, "Name of input in ngOnChanges has to be a string");
  const simpleChangesStore = getSimpleChangesStore(instance) || setSimpleChangesStore(instance, { previous: EMPTY_OBJ, current: null });
  const current = simpleChangesStore.current || (simpleChangesStore.current = {});
  const previous = simpleChangesStore.previous;
  const previousChange = previous[declaredName];
  current[declaredName] = new SimpleChange(previousChange && previousChange.currentValue, value, previous === EMPTY_OBJ);
  applyValueToInputField(instance, inputSignalNode, privateName, value);
}
var SIMPLE_CHANGES_STORE = "__ngSimpleChanges__";
function getSimpleChangesStore(instance) {
  return instance[SIMPLE_CHANGES_STORE] || null;
}
function setSimpleChangesStore(instance, store2) {
  return instance[SIMPLE_CHANGES_STORE] = store2;
}
var profilerCallbacks = [];
var NOOP_PROFILER_REMOVAL2 = () => {
};
function removeProfiler2(profiler2) {
  const profilerIdx = profilerCallbacks.indexOf(profiler2);
  if (profilerIdx !== -1) {
    profilerCallbacks.splice(profilerIdx, 1);
  }
}
function setProfiler(profiler2) {
  if (profiler2 !== null) {
    if (!profilerCallbacks.includes(profiler2)) {
      profilerCallbacks.push(profiler2);
    }
    return () => removeProfiler2(profiler2);
  } else {
    profilerCallbacks.length = 0;
    return NOOP_PROFILER_REMOVAL2;
  }
}
var profiler = function(event, instance = null, eventFn) {
  for (let i = 0; i < profilerCallbacks.length; i++) {
    const profilerCallback = profilerCallbacks[i];
    profilerCallback(event, instance, eventFn);
  }
};
function registerPreOrderHooks(directiveIndex, directiveDef, tView) {
  ngDevMode && assertFirstCreatePass(tView);
  const { ngOnChanges, ngOnInit, ngDoCheck } = directiveDef.type.prototype;
  if (ngOnChanges) {
    const wrappedOnChanges = NgOnChangesFeatureImpl(directiveDef);
    (tView.preOrderHooks ??= []).push(directiveIndex, wrappedOnChanges);
    (tView.preOrderCheckHooks ??= []).push(directiveIndex, wrappedOnChanges);
  }
  if (ngOnInit) {
    (tView.preOrderHooks ??= []).push(0 - directiveIndex, ngOnInit);
  }
  if (ngDoCheck) {
    (tView.preOrderHooks ??= []).push(directiveIndex, ngDoCheck);
    (tView.preOrderCheckHooks ??= []).push(directiveIndex, ngDoCheck);
  }
}
function registerPostOrderHooks(tView, tNode) {
  ngDevMode && assertFirstCreatePass(tView);
  for (let i = tNode.directiveStart, end = tNode.directiveEnd; i < end; i++) {
    const directiveDef = tView.data[i];
    ngDevMode && assertDefined(directiveDef, "Expecting DirectiveDef");
    const lifecycleHooks = directiveDef.type.prototype;
    const { ngAfterContentInit, ngAfterContentChecked, ngAfterViewInit, ngAfterViewChecked, ngOnDestroy } = lifecycleHooks;
    if (ngAfterContentInit) {
      (tView.contentHooks ??= []).push(-i, ngAfterContentInit);
    }
    if (ngAfterContentChecked) {
      (tView.contentHooks ??= []).push(i, ngAfterContentChecked);
      (tView.contentCheckHooks ??= []).push(i, ngAfterContentChecked);
    }
    if (ngAfterViewInit) {
      (tView.viewHooks ??= []).push(-i, ngAfterViewInit);
    }
    if (ngAfterViewChecked) {
      (tView.viewHooks ??= []).push(i, ngAfterViewChecked);
      (tView.viewCheckHooks ??= []).push(i, ngAfterViewChecked);
    }
    if (ngOnDestroy != null) {
      (tView.destroyHooks ??= []).push(i, ngOnDestroy);
    }
  }
}
function executeCheckHooks(lView, hooks, nodeIndex) {
  callHooks(lView, hooks, 3, nodeIndex);
}
function executeInitAndCheckHooks(lView, hooks, initPhase, nodeIndex) {
  ngDevMode && assertNotEqual(initPhase, 3, "Init pre-order hooks should not be called more than once");
  if ((lView[FLAGS] & 3) === initPhase) {
    callHooks(lView, hooks, initPhase, nodeIndex);
  }
}
function incrementInitPhaseFlags(lView, initPhase) {
  ngDevMode && assertNotEqual(initPhase, 3, "Init hooks phase should not be incremented after all init hooks have been run.");
  let flags = lView[FLAGS];
  if ((flags & 3) === initPhase) {
    flags &= 16383;
    flags += 1;
    lView[FLAGS] = flags;
  }
}
function callHooks(currentView, arr, initPhase, currentNodeIndex) {
  ngDevMode && assertEqual(isInCheckNoChangesMode(), false, "Hooks should never be run when in check no changes mode.");
  const startIndex = currentNodeIndex !== void 0 ? currentView[PREORDER_HOOK_FLAGS] & 65535 : 0;
  const nodeIndexLimit = currentNodeIndex != null ? currentNodeIndex : -1;
  const max = arr.length - 1;
  let lastNodeIndexFound = 0;
  for (let i = startIndex; i < max; i++) {
    const hook = arr[i + 1];
    if (typeof hook === "number") {
      lastNodeIndexFound = arr[i];
      if (currentNodeIndex != null && lastNodeIndexFound >= currentNodeIndex) {
        break;
      }
    } else {
      const isInitHook = arr[i] < 0;
      if (isInitHook) {
        currentView[PREORDER_HOOK_FLAGS] += 65536;
      }
      if (lastNodeIndexFound < nodeIndexLimit || nodeIndexLimit == -1) {
        callHook(currentView, initPhase, arr, i);
        currentView[PREORDER_HOOK_FLAGS] = (currentView[PREORDER_HOOK_FLAGS] & 4294901760) + i + 2;
      }
      i++;
    }
  }
}
function callHookInternal(directive, hook) {
  profiler(4, directive, hook);
  const prevConsumer = setActiveConsumer(null);
  try {
    hook.call(directive);
  } finally {
    setActiveConsumer(prevConsumer);
    profiler(5, directive, hook);
  }
}
function callHook(currentView, initPhase, arr, i) {
  const isInitHook = arr[i] < 0;
  const hook = arr[i + 1];
  const directiveIndex = isInitHook ? -arr[i] : arr[i];
  const directive = currentView[directiveIndex];
  if (isInitHook) {
    const indexWithintInitPhase = currentView[FLAGS] >> 14;
    if (indexWithintInitPhase < currentView[PREORDER_HOOK_FLAGS] >> 16 && (currentView[FLAGS] & 3) === initPhase) {
      currentView[FLAGS] += 16384;
      callHookInternal(directive, hook);
    }
  } else {
    callHookInternal(directive, hook);
  }
}
var NO_PARENT_INJECTOR = -1;
var NodeInjectorFactory = class {
  factory;
  name;
  /**
   * The inject implementation to be activated when using the factory.
   */
  injectImpl;
  /**
   * Marker set to true during factory invocation to see if we get into recursive loop.
   * Recursive loop causes an error to be displayed.
   */
  resolving = false;
  /**
   * Marks that the token can see other Tokens declared in `viewProviders` on the same node.
   */
  canSeeViewProviders;
  /**
   * An array of factories to use in case of `multi` provider.
   */
  multi;
  /**
   * Number of `multi`-providers which belong to the component.
   *
   * This is needed because when multiple components and directives declare the `multi` provider
   * they have to be concatenated in the correct order.
   *
   * Example:
   *
   * If we have a component and directive active an a single element as declared here
   * ```ts
   * component:
   *   providers: [ {provide: String, useValue: 'component', multi: true} ],
   *   viewProviders: [ {provide: String, useValue: 'componentView', multi: true} ],
   *
   * directive:
   *   providers: [ {provide: String, useValue: 'directive', multi: true} ],
   * ```
   *
   * Then the expected results are:
   *
   * ```ts
   * providers: ['component', 'directive']
   * viewProviders: ['component', 'componentView', 'directive']
   * ```
   *
   * The way to think about it is that the `viewProviders` have been inserted after the component
   * but before the directives, which is why we need to know how many `multi`s have been declared by
   * the component.
   */
  componentProviders;
  /**
   * Current index of the Factory in the `data`. Needed for `viewProviders` and `providers` merging.
   * See `providerFactory`.
   */
  index;
  /**
   * Because the same `multi` provider can be declared in `providers` and `viewProviders` it is
   * possible for `viewProviders` to shadow the `providers`. For this reason we store the
   * `provideFactory` of the `providers` so that `providers` can be extended with `viewProviders`.
   *
   * Example:
   *
   * Given:
   * ```ts
   * providers: [ {provide: String, useValue: 'all', multi: true} ],
   * viewProviders: [ {provide: String, useValue: 'viewOnly', multi: true} ],
   * ```
   *
   * We have to return `['all']` in case of content injection, but `['all', 'viewOnly']` in case
   * of view injection. We further have to make sure that the shared instances (in our case
   * `all`) are the exact same instance in both the content as well as the view injection. (We
   * have to make sure that we don't double instantiate.) For this reason the `viewProviders`
   * `Factory` has a pointer to the shadowed `providers` factory so that it can instantiate the
   * `providers` (`['all']`) and then extend it with `viewProviders` (`['all'] + ['viewOnly'] =
   * ['all', 'viewOnly']`).
   */
  providerFactory;
  constructor(factory, isViewProvider, injectImplementation, name2) {
    this.factory = factory;
    this.name = name2;
    ngDevMode && assertDefined(factory, "Factory not specified");
    ngDevMode && assertEqual(typeof factory, "function", "Expected factory function.");
    this.canSeeViewProviders = isViewProvider;
    this.injectImpl = injectImplementation;
  }
};
function toTNodeTypeAsString(tNodeType) {
  let text = "";
  tNodeType & 1 && (text += "|Text");
  tNodeType & 2 && (text += "|Element");
  tNodeType & 4 && (text += "|Container");
  tNodeType & 8 && (text += "|ElementContainer");
  tNodeType & 16 && (text += "|Projection");
  tNodeType & 32 && (text += "|IcuContainer");
  tNodeType & 64 && (text += "|Placeholder");
  tNodeType & 128 && (text += "|LetDeclaration");
  return text.length > 0 ? text.substring(1) : text;
}
function isTNodeShape(value) {
  return value != null && typeof value === "object" && (value.insertBeforeIndex === null || typeof value.insertBeforeIndex === "number" || Array.isArray(value.insertBeforeIndex));
}
function hasClassInput(tNode) {
  return (tNode.flags & 8) !== 0;
}
function hasStyleInput(tNode) {
  return (tNode.flags & 16) !== 0;
}
function assertTNodeType(tNode, expectedTypes, message) {
  assertDefined(tNode, "should be called with a TNode");
  if ((tNode.type & expectedTypes) === 0) {
    throwError2(message || `Expected [${toTNodeTypeAsString(expectedTypes)}] but got ${toTNodeTypeAsString(tNode.type)}.`);
  }
}
function assertPureTNodeType(type) {
  if (!(type === 2 || type === 1 || type === 4 || type === 8 || type === 32 || type === 16 || type === 64 || type === 128)) {
    throwError2(`Expected TNodeType to have only a single type selected, but got ${toTNodeTypeAsString(type)}.`);
  }
}
function setUpAttributes(renderer, native, attrs) {
  let i = 0;
  while (i < attrs.length) {
    const value = attrs[i];
    if (typeof value === "number") {
      if (value !== 0) {
        break;
      }
      i++;
      const namespaceURI = attrs[i++];
      const attrName = attrs[i++];
      const attrVal = attrs[i++];
      renderer.setAttribute(native, attrName, attrVal, namespaceURI);
    } else {
      const attrName = value;
      const attrVal = attrs[++i];
      if (isAnimationProp(attrName)) {
        renderer.setProperty(native, attrName, attrVal);
      } else {
        renderer.setAttribute(native, attrName, attrVal);
      }
      i++;
    }
  }
  return i;
}
function isNameOnlyAttributeMarker(marker) {
  return marker === 3 || marker === 4 || marker === 6;
}
function isAnimationProp(name2) {
  return name2.charCodeAt(0) === 64;
}
function mergeHostAttrs(dst2, src) {
  if (src === null || src.length === 0) ;
  else if (dst2 === null || dst2.length === 0) {
    dst2 = src.slice();
  } else {
    let srcMarker = -1;
    for (let i = 0; i < src.length; i++) {
      const item = src[i];
      if (typeof item === "number") {
        srcMarker = item;
      } else {
        if (srcMarker === 0) ;
        else if (srcMarker === -1 || srcMarker === 2) {
          mergeHostAttribute(dst2, srcMarker, item, null, src[++i]);
        } else {
          mergeHostAttribute(dst2, srcMarker, item, null, null);
        }
      }
    }
  }
  return dst2;
}
function mergeHostAttribute(dst2, marker, key1, key2, value) {
  let i = 0;
  let markerInsertPosition = dst2.length;
  if (marker === -1) {
    markerInsertPosition = -1;
  } else {
    while (i < dst2.length) {
      const dstValue = dst2[i++];
      if (typeof dstValue === "number") {
        if (dstValue === marker) {
          markerInsertPosition = -1;
          break;
        } else if (dstValue > marker) {
          markerInsertPosition = i - 1;
          break;
        }
      }
    }
  }
  while (i < dst2.length) {
    const item = dst2[i];
    if (typeof item === "number") {
      break;
    } else if (item === key1) {
      {
        if (value !== null) {
          dst2[i + 1] = value;
        }
        return;
      }
    }
    i++;
    if (value !== null)
      i++;
  }
  if (markerInsertPosition !== -1) {
    dst2.splice(markerInsertPosition, 0, marker);
    i = markerInsertPosition + 1;
  }
  dst2.splice(i++, 0, key1);
  if (value !== null) {
    dst2.splice(i++, 0, value);
  }
}
function hasParentInjector(parentLocation) {
  return parentLocation !== NO_PARENT_INJECTOR;
}
function getParentInjectorIndex(parentLocation) {
  if (ngDevMode) {
    assertNumber(parentLocation, "Number expected");
    assertNotEqual(parentLocation, -1, "Not a valid state.");
    const parentInjectorIndex = parentLocation & 32767;
    assertGreaterThan(parentInjectorIndex, HEADER_OFFSET, "Parent injector must be pointing past HEADER_OFFSET.");
  }
  return parentLocation & 32767;
}
function getParentInjectorViewOffset(parentLocation) {
  return parentLocation >> 16;
}
function getParentInjectorView(location2, startView) {
  let viewOffset = getParentInjectorViewOffset(location2);
  let parentView = startView;
  while (viewOffset > 0) {
    parentView = parentView[DECLARATION_VIEW];
    viewOffset--;
  }
  return parentView;
}
var includeViewProviders = true;
function setIncludeViewProviders(v) {
  const oldValue = includeViewProviders;
  includeViewProviders = v;
  return oldValue;
}
var BLOOM_SIZE = 256;
var BLOOM_MASK = BLOOM_SIZE - 1;
var BLOOM_BUCKET_BITS = 5;
var nextNgElementId = 0;
var NOT_FOUND2 = {};
function bloomAdd(injectorIndex, tView, type) {
  ngDevMode && assertEqual(tView.firstCreatePass, true, "expected firstCreatePass to be true");
  let id;
  if (typeof type === "string") {
    id = type.charCodeAt(0) || 0;
  } else if (type.hasOwnProperty(NG_ELEMENT_ID)) {
    id = type[NG_ELEMENT_ID];
  }
  if (id == null) {
    id = type[NG_ELEMENT_ID] = nextNgElementId++;
  }
  const bloomHash = id & BLOOM_MASK;
  const mask = 1 << bloomHash;
  tView.data[injectorIndex + (bloomHash >> BLOOM_BUCKET_BITS)] |= mask;
}
function getOrCreateNodeInjectorForNode(tNode, lView) {
  const existingInjectorIndex = getInjectorIndex(tNode, lView);
  if (existingInjectorIndex !== -1) {
    return existingInjectorIndex;
  }
  const tView = lView[TVIEW];
  if (tView.firstCreatePass) {
    tNode.injectorIndex = lView.length;
    insertBloom(tView.data, tNode);
    insertBloom(lView, null);
    insertBloom(tView.blueprint, null);
  }
  const parentLoc = getParentInjectorLocation(tNode, lView);
  const injectorIndex = tNode.injectorIndex;
  if (hasParentInjector(parentLoc)) {
    const parentIndex = getParentInjectorIndex(parentLoc);
    const parentLView = getParentInjectorView(parentLoc, lView);
    const parentData = parentLView[TVIEW].data;
    for (let i = 0; i < 8; i++) {
      lView[injectorIndex + i] = parentLView[parentIndex + i] | parentData[parentIndex + i];
    }
  }
  lView[
    injectorIndex + 8
    /* NodeInjectorOffset.PARENT */
  ] = parentLoc;
  return injectorIndex;
}
function insertBloom(arr, footer) {
  arr.push(0, 0, 0, 0, 0, 0, 0, 0, footer);
}
function getInjectorIndex(tNode, lView) {
  if (tNode.injectorIndex === -1 || // If the injector index is the same as its parent's injector index, then the index has been
  // copied down from the parent node. No injector has been created yet on this node.
  tNode.parent && tNode.parent.injectorIndex === tNode.injectorIndex || // After the first template pass, the injector index might exist but the parent values
  // might not have been calculated yet for this instance
  lView[
    tNode.injectorIndex + 8
    /* NodeInjectorOffset.PARENT */
  ] === null) {
    return -1;
  } else {
    ngDevMode && assertIndexInRange(lView, tNode.injectorIndex);
    return tNode.injectorIndex;
  }
}
function getParentInjectorLocation(tNode, lView) {
  if (tNode.parent && tNode.parent.injectorIndex !== -1) {
    return tNode.parent.injectorIndex;
  }
  let declarationViewOffset = 0;
  let parentTNode = null;
  let lViewCursor = lView;
  while (lViewCursor !== null) {
    parentTNode = getTNodeFromLView(lViewCursor);
    if (parentTNode === null) {
      return NO_PARENT_INJECTOR;
    }
    ngDevMode && parentTNode && assertTNodeForLView(parentTNode, lViewCursor[DECLARATION_VIEW]);
    declarationViewOffset++;
    lViewCursor = lViewCursor[DECLARATION_VIEW];
    if (parentTNode.injectorIndex !== -1) {
      return parentTNode.injectorIndex | declarationViewOffset << 16;
    }
  }
  return NO_PARENT_INJECTOR;
}
function diPublicInInjector(injectorIndex, tView, token) {
  bloomAdd(injectorIndex, tView, token);
}
function injectAttributeImpl(tNode, attrNameToInject) {
  ngDevMode && assertTNodeType(
    tNode,
    12 | 3
    /* TNodeType.AnyRNode */
  );
  ngDevMode && assertDefined(tNode, "expecting tNode");
  if (attrNameToInject === "class") {
    return tNode.classes;
  }
  if (attrNameToInject === "style") {
    return tNode.styles;
  }
  const attrs = tNode.attrs;
  if (attrs) {
    const attrsLength = attrs.length;
    let i = 0;
    while (i < attrsLength) {
      const value = attrs[i];
      if (isNameOnlyAttributeMarker(value))
        break;
      if (value === 0) {
        i = i + 2;
      } else if (typeof value === "number") {
        i++;
        while (i < attrsLength && typeof attrs[i] === "string") {
          i++;
        }
      } else if (value === attrNameToInject) {
        return attrs[i + 1];
      } else {
        i = i + 2;
      }
    }
  }
  return null;
}
function notFoundValueOrThrow(notFoundValue, token, flags) {
  if (flags & 8 || notFoundValue !== void 0) {
    return notFoundValue;
  } else {
    throwProviderNotFoundError(token, "NodeInjector");
  }
}
function lookupTokenUsingModuleInjector(lView, token, flags, notFoundValue) {
  if (flags & 8 && notFoundValue === void 0) {
    notFoundValue = null;
  }
  if ((flags & (2 | 1)) === 0) {
    const moduleInjector = lView[INJECTOR];
    const previousInjectImplementation = setInjectImplementation(void 0);
    try {
      if (moduleInjector) {
        return moduleInjector.get(
          token,
          notFoundValue,
          flags & 8
          /* InternalInjectFlags.Optional */
        );
      } else {
        return injectRootLimpMode(
          token,
          notFoundValue,
          flags & 8
          /* InternalInjectFlags.Optional */
        );
      }
    } finally {
      setInjectImplementation(previousInjectImplementation);
    }
  }
  return notFoundValueOrThrow(notFoundValue, token, flags);
}
function getOrCreateInjectable(tNode, lView, token, flags = 0, notFoundValue) {
  if (tNode !== null) {
    if (lView[FLAGS] & 2048 && // The token must be present on the current node injector when the `Self`
    // flag is set, so the lookup on embedded view injector(s) can be skipped.
    !(flags & 2)) {
      const embeddedInjectorValue = lookupTokenUsingEmbeddedInjector(tNode, lView, token, flags, NOT_FOUND2);
      if (embeddedInjectorValue !== NOT_FOUND2) {
        return embeddedInjectorValue;
      }
    }
    const value = lookupTokenUsingNodeInjector(tNode, lView, token, flags, NOT_FOUND2);
    if (value !== NOT_FOUND2) {
      return value;
    }
  }
  return lookupTokenUsingModuleInjector(lView, token, flags, notFoundValue);
}
function lookupTokenUsingNodeInjector(tNode, lView, token, flags, notFoundValue) {
  const bloomHash = bloomHashBitOrFactory(token);
  if (typeof bloomHash === "function") {
    if (!enterDI(lView, tNode, flags)) {
      return flags & 1 ? notFoundValueOrThrow(notFoundValue, token, flags) : lookupTokenUsingModuleInjector(lView, token, flags, notFoundValue);
    }
    try {
      let value;
      if (ngDevMode) {
        runInInjectorProfilerContext(new NodeInjector(getCurrentTNode(), getLView()), token, () => {
          emitInjectorToCreateInstanceEvent(token);
          value = bloomHash(flags);
          emitInstanceCreatedByInjectorEvent(value);
        });
      } else {
        value = bloomHash(flags);
      }
      if (value == null && !(flags & 8)) {
        throwProviderNotFoundError(token);
      } else {
        return value;
      }
    } finally {
      leaveDI();
    }
  } else if (typeof bloomHash === "number") {
    let previousTView = null;
    let injectorIndex = getInjectorIndex(tNode, lView);
    let parentLocation = NO_PARENT_INJECTOR;
    let hostTElementNode = flags & 1 ? lView[DECLARATION_COMPONENT_VIEW][T_HOST] : null;
    if (injectorIndex === -1 || flags & 4) {
      parentLocation = injectorIndex === -1 ? getParentInjectorLocation(tNode, lView) : lView[
        injectorIndex + 8
        /* NodeInjectorOffset.PARENT */
      ];
      if (parentLocation === NO_PARENT_INJECTOR || !shouldSearchParent(flags, false)) {
        injectorIndex = -1;
      } else {
        previousTView = lView[TVIEW];
        injectorIndex = getParentInjectorIndex(parentLocation);
        lView = getParentInjectorView(parentLocation, lView);
      }
    }
    while (injectorIndex !== -1) {
      ngDevMode && assertNodeInjector(lView, injectorIndex);
      const tView = lView[TVIEW];
      ngDevMode && assertTNodeForLView(tView.data[
        injectorIndex + 8
        /* NodeInjectorOffset.TNODE */
      ], lView);
      if (bloomHasToken(bloomHash, injectorIndex, tView.data)) {
        const instance = searchTokensOnInjector(injectorIndex, lView, token, previousTView, flags, hostTElementNode);
        if (instance !== NOT_FOUND2) {
          return instance;
        }
      }
      parentLocation = lView[
        injectorIndex + 8
        /* NodeInjectorOffset.PARENT */
      ];
      if (parentLocation !== NO_PARENT_INJECTOR && shouldSearchParent(flags, lView[TVIEW].data[
        injectorIndex + 8
        /* NodeInjectorOffset.TNODE */
      ] === hostTElementNode) && bloomHasToken(bloomHash, injectorIndex, lView)) {
        previousTView = tView;
        injectorIndex = getParentInjectorIndex(parentLocation);
        lView = getParentInjectorView(parentLocation, lView);
      } else {
        injectorIndex = -1;
      }
    }
  }
  return notFoundValue;
}
function searchTokensOnInjector(injectorIndex, lView, token, previousTView, flags, hostTElementNode) {
  const currentTView = lView[TVIEW];
  const tNode = currentTView.data[
    injectorIndex + 8
    /* NodeInjectorOffset.TNODE */
  ];
  const canAccessViewProviders = previousTView == null ? (
    // 1) This is the first invocation `previousTView == null` which means that we are at the
    // `TNode` of where injector is starting to look. In such a case the only time we are allowed
    // to look into the ViewProviders is if:
    // - we are on a component
    // - AND the injector set `includeViewProviders` to true (implying that the token can see
    // ViewProviders because it is the Component or a Service which itself was declared in
    // ViewProviders)
    isComponentHost(tNode) && includeViewProviders
  ) : (
    // 2) `previousTView != null` which means that we are now walking across the parent nodes.
    // In such a case we are only allowed to look into the ViewProviders if:
    // - We just crossed from child View to Parent View `previousTView != currentTView`
    // - AND the parent TNode is an Element.
    // This means that we just came from the Component's View and therefore are allowed to see
    // into the ViewProviders.
    previousTView != currentTView && (tNode.type & 3) !== 0
  );
  const isHostSpecialCase = flags & 1 && hostTElementNode === tNode;
  const injectableIdx = locateDirectiveOrProvider(tNode, currentTView, token, canAccessViewProviders, isHostSpecialCase);
  if (injectableIdx !== null) {
    return getNodeInjectable(lView, currentTView, injectableIdx, tNode, flags);
  } else {
    return NOT_FOUND2;
  }
}
function locateDirectiveOrProvider(tNode, tView, token, canAccessViewProviders, isHostSpecialCase) {
  const nodeProviderIndexes = tNode.providerIndexes;
  const tInjectables = tView.data;
  const injectablesStart = nodeProviderIndexes & 1048575;
  const directivesStart = tNode.directiveStart;
  const directiveEnd = tNode.directiveEnd;
  const cptViewProvidersCount = nodeProviderIndexes >> 20;
  const startingIndex = canAccessViewProviders ? injectablesStart : injectablesStart + cptViewProvidersCount;
  const endIndex = isHostSpecialCase ? injectablesStart + cptViewProvidersCount : directiveEnd;
  for (let i = startingIndex; i < endIndex; i++) {
    const providerTokenOrDef = tInjectables[i];
    if (i < directivesStart && token === providerTokenOrDef || i >= directivesStart && providerTokenOrDef.type === token) {
      return i;
    }
  }
  if (isHostSpecialCase) {
    const dirDef = tInjectables[directivesStart];
    if (dirDef && isComponentDef(dirDef) && dirDef.type === token) {
      return directivesStart;
    }
  }
  return null;
}
var injectionPath = [];
function getNodeInjectable(lView, tView, index, tNode, flags) {
  let value = lView[index];
  const tData = tView.data;
  if (value instanceof NodeInjectorFactory) {
    const factory = value;
    ngDevMode && injectionPath.push(factory.name ?? "unknown");
    if (factory.resolving) {
      const token2 = stringifyForError(tData[index]);
      if (ngDevMode) {
        throw cyclicDependencyErrorWithDetails(token2, injectionPath);
      } else {
        throw cyclicDependencyError(token2);
      }
    }
    const previousIncludeViewProviders = setIncludeViewProviders(factory.canSeeViewProviders);
    factory.resolving = true;
    const token = tData[index].type || tData[index];
    let prevInjectContext;
    if (ngDevMode) {
      const injector = new NodeInjector(tNode, lView);
      prevInjectContext = setInjectorProfilerContext({ injector, token });
    }
    const previousInjectImplementation = factory.injectImpl ? setInjectImplementation(factory.injectImpl) : null;
    const success = enterDI(
      lView,
      tNode,
      0
      /* InternalInjectFlags.Default */
    );
    ngDevMode && assertEqual(success, true, "Because flags do not contain `SkipSelf' we expect this to always succeed.");
    try {
      ngDevMode && emitInjectorToCreateInstanceEvent(token);
      value = lView[index] = factory.factory(void 0, flags, tData, lView, tNode);
      ngDevMode && emitInstanceCreatedByInjectorEvent(value);
      if (tView.firstCreatePass && index >= tNode.directiveStart) {
        ngDevMode && assertDirectiveDef(tData[index]);
        registerPreOrderHooks(index, tData[index], tView);
      }
    } finally {
      ngDevMode && setInjectorProfilerContext(prevInjectContext);
      previousInjectImplementation !== null && setInjectImplementation(previousInjectImplementation);
      setIncludeViewProviders(previousIncludeViewProviders);
      factory.resolving = false;
      leaveDI();
      ngDevMode && (injectionPath = []);
    }
  }
  return value;
}
function bloomHashBitOrFactory(token) {
  ngDevMode && assertDefined(token, "token must be defined");
  if (typeof token === "string") {
    return token.charCodeAt(0) || 0;
  }
  const tokenId = (
    // First check with `hasOwnProperty` so we don't get an inherited ID.
    token.hasOwnProperty(NG_ELEMENT_ID) ? token[NG_ELEMENT_ID] : void 0
  );
  if (typeof tokenId === "number") {
    if (tokenId >= 0) {
      return tokenId & BLOOM_MASK;
    } else {
      ngDevMode && assertEqual(tokenId, -1, "Expecting to get Special Injector Id");
      return createNodeInjector;
    }
  } else {
    return tokenId;
  }
}
function bloomHasToken(bloomHash, injectorIndex, injectorView) {
  const mask = 1 << bloomHash;
  const value = injectorView[injectorIndex + (bloomHash >> BLOOM_BUCKET_BITS)];
  return !!(value & mask);
}
function shouldSearchParent(flags, isFirstHostTNode) {
  return !(flags & 2) && !(flags & 1 && isFirstHostTNode);
}
function getNodeInjectorLView(nodeInjector) {
  return nodeInjector._lView;
}
function getNodeInjectorTNode(nodeInjector) {
  return nodeInjector._tNode;
}
var NodeInjector = class {
  _tNode;
  _lView;
  constructor(_tNode, _lView) {
    this._tNode = _tNode;
    this._lView = _lView;
  }
  get(token, notFoundValue, flags) {
    return getOrCreateInjectable(this._tNode, this._lView, token, convertToBitFlags(flags), notFoundValue);
  }
};
function createNodeInjector() {
  return new NodeInjector(getCurrentTNode(), getLView());
}
function \u0275\u0275getInheritedFactory(type) {
  return noSideEffects(() => {
    const ownConstructor = type.prototype.constructor;
    const ownFactory = ownConstructor[NG_FACTORY_DEF] || getFactoryOf(ownConstructor);
    const objectPrototype = Object.prototype;
    let parent = Object.getPrototypeOf(type.prototype).constructor;
    while (parent && parent !== objectPrototype) {
      const factory = parent[NG_FACTORY_DEF] || getFactoryOf(parent);
      if (factory && factory !== ownFactory) {
        return factory;
      }
      parent = Object.getPrototypeOf(parent);
    }
    return (t) => new t();
  });
}
function getFactoryOf(type) {
  if (isForwardRef(type)) {
    return () => {
      const factory = getFactoryOf(resolveForwardRef(type));
      return factory && factory();
    };
  }
  return getFactoryDef(type);
}
function lookupTokenUsingEmbeddedInjector(tNode, lView, token, flags, notFoundValue) {
  let currentTNode = tNode;
  let currentLView = lView;
  while (currentTNode !== null && currentLView !== null && currentLView[FLAGS] & 2048 && !isRootView(currentLView)) {
    ngDevMode && assertTNodeForLView(currentTNode, currentLView);
    const nodeInjectorValue = lookupTokenUsingNodeInjector(currentTNode, currentLView, token, flags | 2, NOT_FOUND2);
    if (nodeInjectorValue !== NOT_FOUND2) {
      return nodeInjectorValue;
    }
    let parentTNode = currentTNode.parent;
    if (!parentTNode) {
      const embeddedViewInjector = currentLView[EMBEDDED_VIEW_INJECTOR];
      if (embeddedViewInjector) {
        const embeddedViewInjectorValue = embeddedViewInjector.get(token, NOT_FOUND2, flags);
        if (embeddedViewInjectorValue !== NOT_FOUND2) {
          return embeddedViewInjectorValue;
        }
      }
      parentTNode = getTNodeFromLView(currentLView);
      currentLView = currentLView[DECLARATION_VIEW];
    }
    currentTNode = parentTNode;
  }
  return notFoundValue;
}
function getTNodeFromLView(lView) {
  const tView = lView[TVIEW];
  const tViewType = tView.type;
  if (tViewType === 2) {
    ngDevMode && assertDefined(tView.declTNode, "Embedded TNodes should have declaration parents.");
    return tView.declTNode;
  } else if (tViewType === 1) {
    return lView[T_HOST];
  }
  return null;
}
function \u0275\u0275injectAttribute(attrNameToInject) {
  return injectAttributeImpl(getCurrentTNode(), attrNameToInject);
}
var Attribute = makeParamDecorator("Attribute", (attributeName) => ({
  attributeName,
  __NG_ELEMENT_ID__: () => \u0275\u0275injectAttribute(attributeName)
}));
var _reflect = null;
function getReflect() {
  return _reflect = _reflect || new ReflectionCapabilities();
}
function reflectDependencies(type) {
  return convertDependencies(getReflect().parameters(type));
}
function convertDependencies(deps) {
  return deps.map((dep) => reflectDependency(dep));
}
function reflectDependency(dep) {
  const meta = {
    token: null,
    attribute: null,
    host: false,
    optional: false,
    self: false,
    skipSelf: false
  };
  if (Array.isArray(dep) && dep.length > 0) {
    for (let j = 0; j < dep.length; j++) {
      const param = dep[j];
      if (param === void 0) {
        continue;
      }
      const proto = Object.getPrototypeOf(param);
      if (param instanceof Optional || proto.ngMetadataName === "Optional") {
        meta.optional = true;
      } else if (param instanceof SkipSelf || proto.ngMetadataName === "SkipSelf") {
        meta.skipSelf = true;
      } else if (param instanceof Self || proto.ngMetadataName === "Self") {
        meta.self = true;
      } else if (param instanceof Host || proto.ngMetadataName === "Host") {
        meta.host = true;
      } else if (param instanceof Inject) {
        meta.token = param.token;
      } else if (param instanceof Attribute) {
        if (param.attributeName === void 0) {
          throw new RuntimeError(204, ngDevMode && `Attribute name must be defined.`);
        }
        meta.attribute = param.attributeName;
      } else {
        meta.token = param;
      }
    }
  } else if (dep === void 0 || Array.isArray(dep) && dep.length === 0) {
    meta.token = null;
  } else {
    meta.token = dep;
  }
  return meta;
}
function compileInjectable(type, meta) {
  let ngInjectableDef = null;
  let ngFactoryDef = null;
  if (!type.hasOwnProperty(NG_PROV_DEF)) {
    Object.defineProperty(type, NG_PROV_DEF, {
      get: () => {
        if (ngInjectableDef === null) {
          const compiler = getCompilerFacade({
            usage: 0,
            kind: "injectable",
            type
          });
          ngInjectableDef = compiler.compileInjectable(angularCoreDiEnv, `ng:///${type.name}/\u0275prov.js`, getInjectableMetadata(type, meta));
        }
        return ngInjectableDef;
      }
    });
  }
  if (!type.hasOwnProperty(NG_FACTORY_DEF)) {
    Object.defineProperty(type, NG_FACTORY_DEF, {
      get: () => {
        if (ngFactoryDef === null) {
          const compiler = getCompilerFacade({
            usage: 0,
            kind: "injectable",
            type
          });
          ngFactoryDef = compiler.compileFactory(angularCoreDiEnv, `ng:///${type.name}/\u0275fac.js`, {
            name: type.name,
            type,
            typeArgumentCount: 0,
            // In JIT mode types are not available nor used.
            deps: reflectDependencies(type),
            target: compiler.FactoryTarget.Injectable
          });
        }
        return ngFactoryDef;
      },
      // Leave this configurable so that the factories from directives or pipes can take precedence.
      configurable: true
    });
  }
}
var USE_VALUE2 = getClosureSafeProperty({
  provide: String,
  useValue: getClosureSafeProperty
});
function isUseClassProvider(meta) {
  return meta.useClass !== void 0;
}
function isUseValueProvider(meta) {
  return USE_VALUE2 in meta;
}
function isUseFactoryProvider(meta) {
  return meta.useFactory !== void 0;
}
function isUseExistingProvider(meta) {
  return meta.useExisting !== void 0;
}
function getInjectableMetadata(type, srcMeta) {
  const meta = srcMeta || { providedIn: null };
  const compilerMeta = {
    name: type.name,
    type,
    typeArgumentCount: 0,
    providedIn: meta.providedIn
  };
  if ((isUseClassProvider(meta) || isUseFactoryProvider(meta)) && meta.deps !== void 0) {
    compilerMeta.deps = convertDependencies(meta.deps);
  }
  if (isUseClassProvider(meta)) {
    compilerMeta.useClass = meta.useClass;
  } else if (isUseValueProvider(meta)) {
    compilerMeta.useValue = meta.useValue;
  } else if (isUseFactoryProvider(meta)) {
    compilerMeta.useFactory = meta.useFactory;
  } else if (isUseExistingProvider(meta)) {
    compilerMeta.useExisting = meta.useExisting;
  }
  return compilerMeta;
}
var Injectable = makeDecorator("Injectable", void 0, void 0, void 0, (type, meta) => compileInjectable(type, meta));
function injectElementRef() {
  return createElementRef(getCurrentTNode(), getLView());
}
function createElementRef(tNode, lView) {
  return new ElementRef(getNativeByTNode(tNode, lView));
}
var ElementRef = class {
  /**
   * <div class="docs-alert docs-alert-important">
   *   <header>Use with caution</header>
   *   <p>
   *    Use this API as the last resort when direct access to DOM is needed. Use templating and
   *    data-binding provided by Angular instead. If used, it is recommended in combination with
   *    {@link /best-practices/security#direct-use-of-the-dom-apis-and-explicit-sanitization-calls DomSanitizer}
   *    for maxiumum security;
   *   </p>
   * </div>
   */
  nativeElement;
  constructor(nativeElement) {
    this.nativeElement = nativeElement;
  }
  /**
   * @internal
   * @nocollapse
   */
  static __NG_ELEMENT_ID__ = injectElementRef;
};
function unwrapElementRef(value) {
  return value instanceof ElementRef ? value.nativeElement : value;
}
function symbolIterator() {
  return this._results[Symbol.iterator]();
}
var QueryList = class {
  _emitDistinctChangesOnly;
  dirty = true;
  _onDirty = void 0;
  _results = [];
  _changesDetected = false;
  _changes = void 0;
  length = 0;
  first = void 0;
  last = void 0;
  /**
   * Returns `Observable` of `QueryList` notifying the subscriber of changes.
   */
  get changes() {
    return this._changes ??= new Subject();
  }
  /**
   * @param emitDistinctChangesOnly Whether `QueryList.changes` should fire only when actual change
   *     has occurred. Or if it should fire when query is recomputed. (recomputing could resolve in
   *     the same result)
   */
  constructor(_emitDistinctChangesOnly = false) {
    this._emitDistinctChangesOnly = _emitDistinctChangesOnly;
  }
  /**
   * Returns the QueryList entry at `index`.
   */
  get(index) {
    return this._results[index];
  }
  /**
   * See
   * [Array.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)
   */
  map(fn) {
    return this._results.map(fn);
  }
  filter(fn) {
    return this._results.filter(fn);
  }
  /**
   * See
   * [Array.find](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find)
   */
  find(fn) {
    return this._results.find(fn);
  }
  /**
   * See
   * [Array.reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce)
   */
  reduce(fn, init) {
    return this._results.reduce(fn, init);
  }
  /**
   * See
   * [Array.forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach)
   */
  forEach(fn) {
    this._results.forEach(fn);
  }
  /**
   * See
   * [Array.some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some)
   */
  some(fn) {
    return this._results.some(fn);
  }
  /**
   * Returns a copy of the internal results list as an Array.
   */
  toArray() {
    return this._results.slice();
  }
  toString() {
    return this._results.toString();
  }
  /**
   * Updates the stored data of the query list, and resets the `dirty` flag to `false`, so that
   * on change detection, it will not notify of changes to the queries, unless a new change
   * occurs.
   *
   * @param resultsTree The query results to store
   * @param identityAccessor Optional function for extracting stable object identity from a value
   *    in the array. This function is executed for each element of the query result list while
   *    comparing current query list with the new one (provided as a first argument of the `reset`
   *    function) to detect if the lists are different. If the function is not provided, elements
   *    are compared as is (without any pre-processing).
   */
  reset(resultsTree, identityAccessor) {
    this.dirty = false;
    const newResultFlat = flatten(resultsTree);
    if (this._changesDetected = !arrayEquals(this._results, newResultFlat, identityAccessor)) {
      this._results = newResultFlat;
      this.length = newResultFlat.length;
      this.last = newResultFlat[this.length - 1];
      this.first = newResultFlat[0];
    }
  }
  /**
   * Triggers a change event by emitting on the `changes` {@link EventEmitter}.
   */
  notifyOnChanges() {
    if (this._changes !== void 0 && (this._changesDetected || !this._emitDistinctChangesOnly))
      this._changes.next(this);
  }
  /** @internal */
  onDirty(cb) {
    this._onDirty = cb;
  }
  /** internal */
  setDirty() {
    this.dirty = true;
    this._onDirty?.();
  }
  /** internal */
  destroy() {
    if (this._changes !== void 0) {
      this._changes.complete();
      this._changes.unsubscribe();
    }
  }
  [Symbol.iterator] = /* @__PURE__ */ (() => symbolIterator)();
};
function hasInSkipHydrationBlockFlag(tNode) {
  return (tNode.flags & 128) === 128;
}
var ChangeDetectionStrategy;
(function(ChangeDetectionStrategy2) {
  ChangeDetectionStrategy2[ChangeDetectionStrategy2["OnPush"] = 0] = "OnPush";
  ChangeDetectionStrategy2[ChangeDetectionStrategy2["Default"] = 1] = "Default";
})(ChangeDetectionStrategy || (ChangeDetectionStrategy = {}));
var TRACKED_LVIEWS = /* @__PURE__ */ new Map();
var uniqueIdCounter = 0;
function getUniqueLViewId() {
  return uniqueIdCounter++;
}
function registerLView(lView) {
  ngDevMode && assertNumber(lView[ID], "LView must have an ID in order to be registered");
  TRACKED_LVIEWS.set(lView[ID], lView);
}
function getLViewById(id) {
  ngDevMode && assertNumber(id, "ID used for LView lookup must be a number");
  return TRACKED_LVIEWS.get(id) || null;
}
function unregisterLView(lView) {
  ngDevMode && assertNumber(lView[ID], "Cannot stop tracking an LView that does not have an ID");
  TRACKED_LVIEWS.delete(lView[ID]);
}
function getTrackedLViews() {
  return TRACKED_LVIEWS;
}
var LContext = class {
  lViewId;
  nodeIndex;
  native;
  /**
   * The instance of the Component node.
   */
  component;
  /**
   * The list of active directives that exist on this element.
   */
  directives;
  /**
   * The map of local references (local reference name => element or directive instance) that
   * exist on this element.
   */
  localRefs;
  /** Component's parent view data. */
  get lView() {
    return getLViewById(this.lViewId);
  }
  constructor(lViewId, nodeIndex, native) {
    this.lViewId = lViewId;
    this.nodeIndex = nodeIndex;
    this.native = native;
  }
};
function getLContext(target) {
  let mpValue = readPatchedData(target);
  if (mpValue) {
    if (isLView(mpValue)) {
      const lView = mpValue;
      let nodeIndex;
      let component = void 0;
      let directives = void 0;
      if (isComponentInstance(target)) {
        nodeIndex = findViaComponent(lView, target);
        if (nodeIndex == -1) {
          throw new Error("The provided component was not found in the application");
        }
        component = target;
      } else if (isDirectiveInstance(target)) {
        nodeIndex = findViaDirective(lView, target);
        if (nodeIndex == -1) {
          throw new Error("The provided directive was not found in the application");
        }
        directives = getDirectivesAtNodeIndex(nodeIndex, lView);
      } else {
        nodeIndex = findViaNativeElement(lView, target);
        if (nodeIndex == -1) {
          return null;
        }
      }
      const native = unwrapRNode(lView[nodeIndex]);
      const existingCtx = readPatchedData(native);
      const context2 = existingCtx && !Array.isArray(existingCtx) ? existingCtx : createLContext(lView, nodeIndex, native);
      if (component && context2.component === void 0) {
        context2.component = component;
        attachPatchData(context2.component, context2);
      }
      if (directives && context2.directives === void 0) {
        context2.directives = directives;
        for (let i = 0; i < directives.length; i++) {
          attachPatchData(directives[i], context2);
        }
      }
      attachPatchData(context2.native, context2);
      mpValue = context2;
    }
  } else {
    const rElement = target;
    ngDevMode && assertDomNode(rElement);
    let parent = rElement;
    while (parent = parent.parentNode) {
      const parentContext = readPatchedData(parent);
      if (parentContext) {
        const lView = Array.isArray(parentContext) ? parentContext : parentContext.lView;
        if (!lView) {
          return null;
        }
        const index = findViaNativeElement(lView, rElement);
        if (index >= 0) {
          const native = unwrapRNode(lView[index]);
          const context2 = createLContext(lView, index, native);
          attachPatchData(native, context2);
          mpValue = context2;
          break;
        }
      }
    }
  }
  return mpValue || null;
}
function createLContext(lView, nodeIndex, native) {
  return new LContext(lView[ID], nodeIndex, native);
}
function getComponentViewByInstance(componentInstance) {
  let patchedData = readPatchedData(componentInstance);
  let lView;
  if (isLView(patchedData)) {
    const contextLView = patchedData;
    const nodeIndex = findViaComponent(contextLView, componentInstance);
    lView = getComponentLViewByIndex(nodeIndex, contextLView);
    const context2 = createLContext(contextLView, nodeIndex, lView[HOST]);
    context2.component = componentInstance;
    attachPatchData(componentInstance, context2);
    attachPatchData(context2.native, context2);
  } else {
    const context2 = patchedData;
    const contextLView = context2.lView;
    ngDevMode && assertLView(contextLView);
    lView = getComponentLViewByIndex(context2.nodeIndex, contextLView);
  }
  return lView;
}
var MONKEY_PATCH_KEY_NAME = "__ngContext__";
function attachPatchData(target, data) {
  ngDevMode && assertDefined(target, "Target expected");
  if (isLView(data)) {
    target[MONKEY_PATCH_KEY_NAME] = data[ID];
    registerLView(data);
  } else {
    target[MONKEY_PATCH_KEY_NAME] = data;
  }
}
function readPatchedData(target) {
  ngDevMode && assertDefined(target, "Target expected");
  const data = target[MONKEY_PATCH_KEY_NAME];
  return typeof data === "number" ? getLViewById(data) : data || null;
}
function readPatchedLView(target) {
  const value = readPatchedData(target);
  if (value) {
    return isLView(value) ? value : value.lView;
  }
  return null;
}
function isComponentInstance(instance) {
  return instance && instance.constructor && instance.constructor.\u0275cmp;
}
function isDirectiveInstance(instance) {
  return instance && instance.constructor && instance.constructor.\u0275dir;
}
function findViaNativeElement(lView, target) {
  const tView = lView[TVIEW];
  for (let i = HEADER_OFFSET; i < tView.bindingStartIndex; i++) {
    if (unwrapRNode(lView[i]) === target) {
      return i;
    }
  }
  return -1;
}
function traverseNextElement(tNode) {
  if (tNode.child) {
    return tNode.child;
  } else if (tNode.next) {
    return tNode.next;
  } else {
    while (tNode.parent && !tNode.parent.next) {
      tNode = tNode.parent;
    }
    return tNode.parent && tNode.parent.next;
  }
}
function findViaComponent(lView, componentInstance) {
  const componentIndices = lView[TVIEW].components;
  if (componentIndices) {
    for (let i = 0; i < componentIndices.length; i++) {
      const elementComponentIndex = componentIndices[i];
      const componentView = getComponentLViewByIndex(elementComponentIndex, lView);
      if (componentView[CONTEXT] === componentInstance) {
        return elementComponentIndex;
      }
    }
  } else {
    const rootComponentView = getComponentLViewByIndex(HEADER_OFFSET, lView);
    const rootComponent = rootComponentView[CONTEXT];
    if (rootComponent === componentInstance) {
      return HEADER_OFFSET;
    }
  }
  return -1;
}
function findViaDirective(lView, directiveInstance) {
  let tNode = lView[TVIEW].firstChild;
  while (tNode) {
    const directiveIndexStart = tNode.directiveStart;
    const directiveIndexEnd = tNode.directiveEnd;
    for (let i = directiveIndexStart; i < directiveIndexEnd; i++) {
      if (lView[i] === directiveInstance) {
        return tNode.index;
      }
    }
    tNode = traverseNextElement(tNode);
  }
  return -1;
}
function getDirectivesAtNodeIndex(nodeIndex, lView) {
  const tNode = lView[TVIEW].data[nodeIndex];
  if (tNode.directiveStart === 0)
    return EMPTY_ARRAY;
  const results = [];
  for (let i = tNode.directiveStart; i < tNode.directiveEnd; i++) {
    const directiveInstance = lView[i];
    if (!isComponentInstance(directiveInstance)) {
      results.push(directiveInstance);
    }
  }
  return results;
}
function getComponentAtNodeIndex(nodeIndex, lView) {
  const tNode = lView[TVIEW].data[nodeIndex];
  return isComponentHost(tNode) ? lView[tNode.directiveStart + tNode.componentOffset] : null;
}
function getRootView(componentOrLView) {
  ngDevMode && assertDefined(componentOrLView, "component");
  let lView = isLView(componentOrLView) ? componentOrLView : readPatchedLView(componentOrLView);
  while (lView && !isRootView(lView)) {
    lView = getLViewParent(lView);
  }
  ngDevMode && assertLView(lView);
  return lView;
}
function getRootContext(viewOrComponent) {
  const rootView = getRootView(viewOrComponent);
  ngDevMode && assertDefined(rootView[CONTEXT], "Root view has no context. Perhaps it is disconnected?");
  return rootView[CONTEXT];
}
function getFirstLContainer(lView) {
  return getNearestLContainer(lView[CHILD_HEAD]);
}
function getNextLContainer(container) {
  return getNearestLContainer(container[NEXT]);
}
function getNearestLContainer(viewOrContainer) {
  while (viewOrContainer !== null && !isLContainer(viewOrContainer)) {
    viewOrContainer = viewOrContainer[NEXT];
  }
  return viewOrContainer;
}
function getComponent(element) {
  ngDevMode && assertDomElement(element);
  const context2 = getLContext(element);
  if (context2 === null)
    return null;
  if (context2.component === void 0) {
    const lView = context2.lView;
    if (lView === null) {
      return null;
    }
    context2.component = getComponentAtNodeIndex(context2.nodeIndex, lView);
  }
  return context2.component;
}
function getContext(element) {
  assertDomElement(element);
  const context2 = getLContext(element);
  const lView = context2 ? context2.lView : null;
  return lView === null ? null : lView[CONTEXT];
}
function getOwningComponent(elementOrDir) {
  const context2 = getLContext(elementOrDir);
  let lView = context2 ? context2.lView : null;
  if (lView === null)
    return null;
  let parent;
  while (lView[TVIEW].type === 2 && (parent = getLViewParent(lView))) {
    lView = parent;
  }
  return isRootView(lView) ? null : lView[CONTEXT];
}
function getRootComponents(elementOrDir) {
  const lView = readPatchedLView(elementOrDir);
  return lView !== null ? [getRootContext(lView)] : [];
}
function getInjector(elementOrDir) {
  const context2 = getLContext(elementOrDir);
  const lView = context2 ? context2.lView : null;
  if (lView === null)
    return Injector.NULL;
  const tNode = lView[TVIEW].data[context2.nodeIndex];
  return new NodeInjector(tNode, lView);
}
function getDirectives(node) {
  if (node instanceof Text) {
    return [];
  }
  const context2 = getLContext(node);
  const lView = context2 ? context2.lView : null;
  if (lView === null) {
    return [];
  }
  const tView = lView[TVIEW];
  const nodeIndex = context2.nodeIndex;
  if (!tView?.data[nodeIndex]) {
    return [];
  }
  if (context2.directives === void 0) {
    context2.directives = getDirectivesAtNodeIndex(nodeIndex, lView);
  }
  return context2.directives === null ? [] : [...context2.directives];
}
var Framework;
(function(Framework2) {
  Framework2["Angular"] = "angular";
  Framework2["ACX"] = "acx";
  Framework2["Wiz"] = "wiz";
})(Framework || (Framework = {}));
var AcxChangeDetectionStrategy;
(function(AcxChangeDetectionStrategy2) {
  AcxChangeDetectionStrategy2[AcxChangeDetectionStrategy2["Default"] = 0] = "Default";
  AcxChangeDetectionStrategy2[AcxChangeDetectionStrategy2["OnPush"] = 1] = "OnPush";
})(AcxChangeDetectionStrategy || (AcxChangeDetectionStrategy = {}));
var AcxViewEncapsulation;
(function(AcxViewEncapsulation2) {
  AcxViewEncapsulation2[AcxViewEncapsulation2["Emulated"] = 0] = "Emulated";
  AcxViewEncapsulation2[AcxViewEncapsulation2["None"] = 1] = "None";
})(AcxViewEncapsulation || (AcxViewEncapsulation = {}));
function getDirectiveMetadata$1(directiveOrComponentInstance) {
  const { constructor } = directiveOrComponentInstance;
  if (!constructor) {
    throw new Error("Unable to find the instance constructor");
  }
  const componentDef = getComponentDef(constructor);
  if (componentDef) {
    const inputs = extractInputDebugMetadata(componentDef.inputs);
    return {
      inputs,
      outputs: componentDef.outputs,
      encapsulation: componentDef.encapsulation,
      changeDetection: componentDef.onPush ? ChangeDetectionStrategy.OnPush : ChangeDetectionStrategy.Default
    };
  }
  const directiveDef = getDirectiveDef(constructor);
  if (directiveDef) {
    const inputs = extractInputDebugMetadata(directiveDef.inputs);
    return { inputs, outputs: directiveDef.outputs };
  }
  return null;
}
function getHostElement(componentOrDirective) {
  return getLContext(componentOrDirective).native;
}
function getListeners(element) {
  ngDevMode && assertDomElement(element);
  const lContext = getLContext(element);
  const lView = lContext === null ? null : lContext.lView;
  if (lView === null)
    return [];
  const tView = lView[TVIEW];
  const lCleanup = lView[CLEANUP];
  const tCleanup = tView.cleanup;
  const listeners = [];
  if (tCleanup && lCleanup) {
    for (let i = 0; i < tCleanup.length; ) {
      const firstParam = tCleanup[i++];
      const secondParam = tCleanup[i++];
      if (typeof firstParam === "string") {
        const name2 = firstParam;
        const listenerElement = unwrapRNode(lView[secondParam]);
        const callback = lCleanup[tCleanup[i++]];
        const useCaptureOrIndx = tCleanup[i++];
        const type = typeof useCaptureOrIndx === "boolean" || useCaptureOrIndx >= 0 ? "dom" : "output";
        const useCapture = typeof useCaptureOrIndx === "boolean" ? useCaptureOrIndx : false;
        if (element == listenerElement) {
          listeners.push({ element, name: name2, callback, useCapture, type });
        }
      }
    }
  }
  listeners.sort(sortListeners);
  return listeners;
}
function sortListeners(a, b) {
  if (a.name == b.name)
    return 0;
  return a.name < b.name ? -1 : 1;
}
function assertDomElement(value) {
  if (typeof Element !== "undefined" && !(value instanceof Element)) {
    throw new Error("Expecting instance of DOM Element");
  }
}
function extractInputDebugMetadata(inputs) {
  const res = {};
  for (const key in inputs) {
    if (inputs.hasOwnProperty(key)) {
      const value = inputs[key];
      if (value !== void 0) {
        res[key] = value[0];
      }
    }
  }
  return res;
}
var DOCUMENT2 = void 0;
function setDocument(document2) {
  DOCUMENT2 = document2;
}
function getDocument() {
  if (DOCUMENT2 !== void 0) {
    return DOCUMENT2;
  } else if (typeof document !== "undefined") {
    return document;
  }
  throw new RuntimeError(210, (typeof ngDevMode === "undefined" || ngDevMode) && `The document object is not available in this context. Make sure the DOCUMENT injection token is provided.`);
}
var APP_ID = new InjectionToken(ngDevMode ? "AppId" : "", {
  providedIn: "root",
  factory: () => DEFAULT_APP_ID
});
var DEFAULT_APP_ID = "ng";
var PLATFORM_INITIALIZER = new InjectionToken(ngDevMode ? "Platform Initializer" : "");
var PLATFORM_ID = new InjectionToken(ngDevMode ? "Platform ID" : "", {
  providedIn: "platform",
  factory: () => "unknown"
  // set a default platform name, when none set explicitly
});
var PACKAGE_ROOT_URL = new InjectionToken(ngDevMode ? "Application Packages Root URL" : "");
var ANIMATION_MODULE_TYPE = new InjectionToken(ngDevMode ? "AnimationModuleType" : "");
var CSP_NONCE = new InjectionToken(ngDevMode ? "CSP nonce" : "", {
  providedIn: "root",
  factory: () => {
    return getDocument().body?.querySelector("[ngCspNonce]")?.getAttribute("ngCspNonce") || null;
  }
});
var IMAGE_CONFIG_DEFAULTS = {
  breakpoints: [16, 32, 48, 64, 96, 128, 256, 384, 640, 750, 828, 1080, 1200, 1920, 2048, 3840],
  placeholderResolution: 30,
  disableImageSizeWarning: false,
  disableImageLazyLoadWarning: false
};
var IMAGE_CONFIG = new InjectionToken(ngDevMode ? "ImageConfig" : "", {
  providedIn: "root",
  factory: () => IMAGE_CONFIG_DEFAULTS
});
function makeStateKey(key) {
  return key;
}
function initTransferState() {
  const transferState = new TransferState();
  if (true) {
    transferState.store = retrieveTransferredState(getDocument(), inject2(APP_ID));
  }
  return transferState;
}
var TransferState = class _TransferState {
  /** @nocollapse */
  static \u0275prov = (
    /** @pureOrBreakMyCode */
    /* @__PURE__ */ \u0275\u0275defineInjectable({
      token: _TransferState,
      providedIn: "root",
      factory: initTransferState
    })
  );
  /** @internal */
  store = {};
  onSerializeCallbacks = {};
  /**
   * Get the value corresponding to a key. Return `defaultValue` if key is not found.
   */
  get(key, defaultValue) {
    return this.store[key] !== void 0 ? this.store[key] : defaultValue;
  }
  /**
   * Set the value corresponding to a key.
   */
  set(key, value) {
    this.store[key] = value;
  }
  /**
   * Remove a key from the store.
   */
  remove(key) {
    delete this.store[key];
  }
  /**
   * Test whether a key exists in the store.
   */
  hasKey(key) {
    return this.store.hasOwnProperty(key);
  }
  /**
   * Indicates whether the state is empty.
   */
  get isEmpty() {
    return Object.keys(this.store).length === 0;
  }
  /**
   * Register a callback to provide the value for a key when `toJson` is called.
   */
  onSerialize(key, callback) {
    this.onSerializeCallbacks[key] = callback;
  }
  /**
   * Serialize the current state of the store to JSON.
   */
  toJson() {
    for (const key in this.onSerializeCallbacks) {
      if (this.onSerializeCallbacks.hasOwnProperty(key)) {
        try {
          this.store[key] = this.onSerializeCallbacks[key]();
        } catch (e) {
          console.warn("Exception in onSerialize callback: ", e);
        }
      }
    }
    return JSON.stringify(this.store).replace(/</g, "\\u003C");
  }
};
function retrieveTransferredState(doc, appId) {
  const script = doc.getElementById(appId + "-state");
  if (script?.textContent) {
    try {
      return JSON.parse(script.textContent);
    } catch (e) {
      console.warn("Exception while restoring TransferState for app " + appId, e);
    }
  }
  return {};
}
var REFERENCE_NODE_HOST = "h";
var REFERENCE_NODE_BODY = "b";
var NUM_ROOT_NODES = "r";
var DEFER_BLOCK_ID = "di";
var DEFER_BLOCK_STATE$1 = "s";
var DEFER_PARENT_BLOCK_ID = "p";
var IS_HYDRATION_DOM_REUSE_ENABLED = new InjectionToken(typeof ngDevMode === "undefined" || !!ngDevMode ? "IS_HYDRATION_DOM_REUSE_ENABLED" : "");
var PRESERVE_HOST_CONTENT_DEFAULT = false;
var PRESERVE_HOST_CONTENT = new InjectionToken(typeof ngDevMode === "undefined" || !!ngDevMode ? "PRESERVE_HOST_CONTENT" : "", {
  providedIn: "root",
  factory: () => PRESERVE_HOST_CONTENT_DEFAULT
});
var IS_I18N_HYDRATION_ENABLED = new InjectionToken(typeof ngDevMode === "undefined" || !!ngDevMode ? "IS_I18N_HYDRATION_ENABLED" : "");
var IS_EVENT_REPLAY_ENABLED = new InjectionToken(typeof ngDevMode === "undefined" || !!ngDevMode ? "IS_EVENT_REPLAY_ENABLED" : "");
var IS_INCREMENTAL_HYDRATION_ENABLED = new InjectionToken(typeof ngDevMode === "undefined" || !!ngDevMode ? "IS_INCREMENTAL_HYDRATION_ENABLED" : "");
var JSACTION_BLOCK_ELEMENT_MAP = new InjectionToken(ngDevMode ? "JSACTION_BLOCK_ELEMENT_MAP" : "", {
  providedIn: "root",
  factory: () => /* @__PURE__ */ new Map()
});
var eventListenerOptions = {
  passive: true,
  capture: true
};
var hoverTriggers = /* @__PURE__ */ new WeakMap();
var interactionTriggers = /* @__PURE__ */ new WeakMap();
var viewportTriggers = /* @__PURE__ */ new WeakMap();
var interactionEventNames = ["click", "keydown"];
var hoverEventNames = ["mouseenter", "mouseover", "focusin"];
var intersectionObserver = null;
var observedViewportElements = 0;
var DeferEventEntry = class {
  callbacks = /* @__PURE__ */ new Set();
  listener = () => {
    for (const callback of this.callbacks) {
      callback();
    }
  };
};
function onInteraction(trigger, callback) {
  let entry = interactionTriggers.get(trigger);
  if (!entry) {
    entry = new DeferEventEntry();
    interactionTriggers.set(trigger, entry);
    for (const name2 of interactionEventNames) {
      trigger.addEventListener(name2, entry.listener, eventListenerOptions);
    }
  }
  entry.callbacks.add(callback);
  return () => {
    const { callbacks, listener } = entry;
    callbacks.delete(callback);
    if (callbacks.size === 0) {
      interactionTriggers.delete(trigger);
      for (const name2 of interactionEventNames) {
        trigger.removeEventListener(name2, listener, eventListenerOptions);
      }
    }
  };
}
function onHover(trigger, callback) {
  let entry = hoverTriggers.get(trigger);
  if (!entry) {
    entry = new DeferEventEntry();
    hoverTriggers.set(trigger, entry);
    for (const name2 of hoverEventNames) {
      trigger.addEventListener(name2, entry.listener, eventListenerOptions);
    }
  }
  entry.callbacks.add(callback);
  return () => {
    const { callbacks, listener } = entry;
    callbacks.delete(callback);
    if (callbacks.size === 0) {
      for (const name2 of hoverEventNames) {
        trigger.removeEventListener(name2, listener, eventListenerOptions);
      }
      hoverTriggers.delete(trigger);
    }
  };
}
function createIntersectionObserver() {
  return new IntersectionObserver((entries) => {
    for (const current of entries) {
      if (current.isIntersecting && viewportTriggers.has(current.target)) {
        viewportTriggers.get(current.target).listener();
      }
    }
  });
}
function onViewport(trigger, callback, observerFactoryFn) {
  let entry = viewportTriggers.get(trigger);
  intersectionObserver = intersectionObserver || observerFactoryFn();
  if (!entry) {
    entry = new DeferEventEntry();
    intersectionObserver.observe(trigger);
    viewportTriggers.set(trigger, entry);
    observedViewportElements++;
  }
  entry.callbacks.add(callback);
  return () => {
    if (!viewportTriggers.has(trigger)) {
      return;
    }
    entry.callbacks.delete(callback);
    if (entry.callbacks.size === 0) {
      intersectionObserver?.unobserve(trigger);
      viewportTriggers.delete(trigger);
      observedViewportElements--;
    }
    if (observedViewportElements === 0) {
      intersectionObserver?.disconnect();
      intersectionObserver = null;
    }
  };
}
var JSACTION_EVENT_CONTRACT = new InjectionToken(ngDevMode ? "EVENT_CONTRACT_DETAILS" : "", {
  providedIn: "root",
  factory: () => ({})
});
var _stashEventListenerImpl = (lView, target, eventName, wrappedListener) => {
};
function stashEventListenerImpl(lView, target, eventName, wrappedListener) {
  _stashEventListenerImpl(lView, target, eventName, wrappedListener);
}
var DEHYDRATED_BLOCK_REGISTRY = new InjectionToken(ngDevMode ? "DEHYDRATED_BLOCK_REGISTRY" : "");
function isDetachedByI18n(tNode) {
  return (tNode.flags & 32) === 32;
}
var TRANSFER_STATE_TOKEN_ID = "__nghData__";
var NGH_DATA_KEY = makeStateKey(TRANSFER_STATE_TOKEN_ID);
var TRANSFER_STATE_DEFER_BLOCKS_INFO = "__nghDeferData__";
var NGH_DEFER_BLOCKS_KEY = makeStateKey(TRANSFER_STATE_DEFER_BLOCKS_INFO);
var _retrieveHydrationInfoImpl = () => null;
function retrieveHydrationInfo(rNode, injector, isRootView2 = false) {
  return _retrieveHydrationInfoImpl(rNode, injector, isRootView2);
}
function getLNodeForHydration(viewRef) {
  let lView = viewRef._lView;
  const tView = lView[TVIEW];
  if (tView.type === 2) {
    return null;
  }
  if (isRootView(lView)) {
    lView = lView[HEADER_OFFSET];
  }
  return lView;
}
var HydrationStatus;
(function(HydrationStatus2) {
  HydrationStatus2["Hydrated"] = "hydrated";
  HydrationStatus2["Skipped"] = "skipped";
  HydrationStatus2["Mismatched"] = "mismatched";
})(HydrationStatus || (HydrationStatus = {}));
var HYDRATION_INFO_KEY = "__ngDebugHydrationInfo__";
function patchHydrationInfo(node, info) {
  node[HYDRATION_INFO_KEY] = info;
}
function markRNodeAsHavingHydrationMismatch(node, expectedNodeDetails = null, actualNodeDetails = null) {
  if (!ngDevMode) {
    throw new Error("Calling `markRNodeAsMismatchedByHydration` in prod mode is not supported and likely a mistake.");
  }
  while (node && !getComponent(node)) {
    node = node?.parentNode;
  }
  if (node) {
    patchHydrationInfo(node, {
      status: HydrationStatus.Mismatched,
      expectedNodeDetails,
      actualNodeDetails
    });
  }
}
function isIncrementalHydrationEnabled(injector) {
  return injector.get(IS_INCREMENTAL_HYDRATION_ENABLED, false, {
    optional: true
  });
}
function assertIncrementalHydrationIsConfigured(injector) {
  if (!isIncrementalHydrationEnabled(injector)) {
    throw new RuntimeError(508, "Angular has detected that some `@defer` blocks use `hydrate` triggers, but incremental hydration was not enabled. Please ensure that the `withIncrementalHydration()` call is added as an argument for the `provideClientHydration()` function call in your application config.");
  }
}
function assertSsrIdDefined(ssrUniqueId) {
  assertDefined(ssrUniqueId, "Internal error: expecting an SSR id for a defer block that should be hydrated, but the id is not present");
}
function getParentBlockHydrationQueue(deferBlockId, injector) {
  const dehydratedBlockRegistry = injector.get(DEHYDRATED_BLOCK_REGISTRY);
  const transferState = injector.get(TransferState);
  const deferBlockParents = transferState.get(NGH_DEFER_BLOCKS_KEY, {});
  let isTopMostDeferBlock = false;
  let currentBlockId = deferBlockId;
  let parentBlockPromise = null;
  const hydrationQueue = [];
  while (!isTopMostDeferBlock && currentBlockId) {
    ngDevMode && assertEqual(hydrationQueue.indexOf(currentBlockId), -1, "Internal error: defer block hierarchy has a cycle.");
    isTopMostDeferBlock = dehydratedBlockRegistry.has(currentBlockId);
    const hydratingParentBlock = dehydratedBlockRegistry.hydrating.get(currentBlockId);
    if (parentBlockPromise === null && hydratingParentBlock != null) {
      parentBlockPromise = hydratingParentBlock.promise;
      break;
    }
    hydrationQueue.unshift(currentBlockId);
    currentBlockId = deferBlockParents[currentBlockId][DEFER_PARENT_BLOCK_ID];
  }
  return { parentBlockPromise, hydrationQueue };
}
function refreshContentQueries(tView, lView) {
  const contentQueries = tView.contentQueries;
  if (contentQueries !== null) {
    const prevConsumer = setActiveConsumer(null);
    try {
      for (let i = 0; i < contentQueries.length; i += 2) {
        const queryStartIdx = contentQueries[i];
        const directiveDefIdx = contentQueries[i + 1];
        if (directiveDefIdx !== -1) {
          const directiveDef = tView.data[directiveDefIdx];
          ngDevMode && assertDefined(directiveDef, "DirectiveDef not found.");
          ngDevMode && assertDefined(directiveDef.contentQueries, "contentQueries function should be defined");
          setCurrentQueryIndex(queryStartIdx);
          directiveDef.contentQueries(2, lView[directiveDefIdx], directiveDefIdx);
        }
      }
    } finally {
      setActiveConsumer(prevConsumer);
    }
  }
}
function executeViewQueryFn(flags, viewQueryFn, component) {
  ngDevMode && assertDefined(viewQueryFn, "View queries function to execute must be defined.");
  setCurrentQueryIndex(0);
  const prevConsumer = setActiveConsumer(null);
  try {
    viewQueryFn(flags, component);
  } finally {
    setActiveConsumer(prevConsumer);
  }
}
function executeContentQueries(tView, tNode, lView) {
  if (isContentQueryHost(tNode)) {
    const prevConsumer = setActiveConsumer(null);
    try {
      const start = tNode.directiveStart;
      const end = tNode.directiveEnd;
      for (let directiveIndex = start; directiveIndex < end; directiveIndex++) {
        const def = tView.data[directiveIndex];
        if (def.contentQueries) {
          const directiveInstance = lView[directiveIndex];
          ngDevMode && assertDefined(directiveIndex, "Incorrect reference to a directive defining a content query");
          def.contentQueries(1, directiveInstance, directiveIndex);
        }
      }
    } finally {
      setActiveConsumer(prevConsumer);
    }
  }
}
var ViewEncapsulation;
(function(ViewEncapsulation3) {
  ViewEncapsulation3[ViewEncapsulation3["Emulated"] = 0] = "Emulated";
  ViewEncapsulation3[ViewEncapsulation3["None"] = 2] = "None";
  ViewEncapsulation3[ViewEncapsulation3["ShadowDom"] = 3] = "ShadowDom";
})(ViewEncapsulation || (ViewEncapsulation = {}));
var policy$1;
function getPolicy$1() {
  if (policy$1 === void 0) {
    policy$1 = null;
    if (_global.trustedTypes) {
      try {
        policy$1 = _global.trustedTypes.createPolicy("angular", {
          createHTML: (s) => s,
          createScript: (s) => s,
          createScriptURL: (s) => s
        });
      } catch {
      }
    }
  }
  return policy$1;
}
function trustedHTMLFromString(html) {
  return getPolicy$1()?.createHTML(html) || html;
}
function trustedScriptURLFromString(url) {
  return getPolicy$1()?.createScriptURL(url) || url;
}
var policy;
function getPolicy() {
  if (policy === void 0) {
    policy = null;
    if (_global.trustedTypes) {
      try {
        policy = _global.trustedTypes.createPolicy("angular#unsafe-bypass", {
          createHTML: (s) => s,
          createScript: (s) => s,
          createScriptURL: (s) => s
        });
      } catch {
      }
    }
  }
  return policy;
}
function trustedHTMLFromStringBypass(html) {
  return getPolicy()?.createHTML(html) || html;
}
function trustedScriptFromStringBypass(script) {
  return getPolicy()?.createScript(script) || script;
}
function trustedScriptURLFromStringBypass(url) {
  return getPolicy()?.createScriptURL(url) || url;
}
var SafeValueImpl = class {
  changingThisBreaksApplicationSecurity;
  constructor(changingThisBreaksApplicationSecurity) {
    this.changingThisBreaksApplicationSecurity = changingThisBreaksApplicationSecurity;
  }
  toString() {
    return `SafeValue must use [property]=binding: ${this.changingThisBreaksApplicationSecurity} (see ${XSS_SECURITY_URL})`;
  }
};
var SafeHtmlImpl = class extends SafeValueImpl {
  getTypeName() {
    return "HTML";
  }
};
var SafeStyleImpl = class extends SafeValueImpl {
  getTypeName() {
    return "Style";
  }
};
var SafeScriptImpl = class extends SafeValueImpl {
  getTypeName() {
    return "Script";
  }
};
var SafeUrlImpl = class extends SafeValueImpl {
  getTypeName() {
    return "URL";
  }
};
var SafeResourceUrlImpl = class extends SafeValueImpl {
  getTypeName() {
    return "ResourceURL";
  }
};
function unwrapSafeValue(value) {
  return value instanceof SafeValueImpl ? value.changingThisBreaksApplicationSecurity : value;
}
function allowSanitizationBypassAndThrow(value, type) {
  const actualType = getSanitizationBypassType(value);
  if (actualType != null && actualType !== type) {
    if (actualType === "ResourceURL" && type === "URL")
      return true;
    throw new Error(`Required a safe ${type}, got a ${actualType} (see ${XSS_SECURITY_URL})`);
  }
  return actualType === type;
}
function getSanitizationBypassType(value) {
  return value instanceof SafeValueImpl && value.getTypeName() || null;
}
function bypassSanitizationTrustHtml(trustedHtml) {
  return new SafeHtmlImpl(trustedHtml);
}
function bypassSanitizationTrustStyle(trustedStyle) {
  return new SafeStyleImpl(trustedStyle);
}
function bypassSanitizationTrustScript(trustedScript) {
  return new SafeScriptImpl(trustedScript);
}
function bypassSanitizationTrustUrl(trustedUrl) {
  return new SafeUrlImpl(trustedUrl);
}
function bypassSanitizationTrustResourceUrl(trustedResourceUrl) {
  return new SafeResourceUrlImpl(trustedResourceUrl);
}
function getInertBodyHelper(defaultDoc) {
  const inertDocumentHelper = new InertDocumentHelper(defaultDoc);
  return isDOMParserAvailable() ? new DOMParserHelper(inertDocumentHelper) : inertDocumentHelper;
}
var DOMParserHelper = class {
  inertDocumentHelper;
  constructor(inertDocumentHelper) {
    this.inertDocumentHelper = inertDocumentHelper;
  }
  getInertBodyElement(html) {
    html = "<body><remove></remove>" + html;
    try {
      const body = new window.DOMParser().parseFromString(trustedHTMLFromString(html), "text/html").body;
      if (body === null) {
        return this.inertDocumentHelper.getInertBodyElement(html);
      }
      body.firstChild?.remove();
      return body;
    } catch {
      return null;
    }
  }
};
var InertDocumentHelper = class {
  defaultDoc;
  inertDocument;
  constructor(defaultDoc) {
    this.defaultDoc = defaultDoc;
    this.inertDocument = this.defaultDoc.implementation.createHTMLDocument("sanitization-inert");
  }
  getInertBodyElement(html) {
    const templateEl = this.inertDocument.createElement("template");
    templateEl.innerHTML = trustedHTMLFromString(html);
    return templateEl;
  }
};
function isDOMParserAvailable() {
  try {
    return !!new window.DOMParser().parseFromString(trustedHTMLFromString(""), "text/html");
  } catch {
    return false;
  }
}
var SAFE_URL_PATTERN = /^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:\/?#]*(?:[\/?#]|$))/i;
function _sanitizeUrl(url) {
  url = String(url);
  if (url.match(SAFE_URL_PATTERN))
    return url;
  if (typeof ngDevMode === "undefined" || ngDevMode) {
    console.warn(`WARNING: sanitizing unsafe URL value ${url} (see ${XSS_SECURITY_URL})`);
  }
  return "unsafe:" + url;
}
function tagSet(tags) {
  const res = {};
  for (const t of tags.split(","))
    res[t] = true;
  return res;
}
function merge2(...sets) {
  const res = {};
  for (const s of sets) {
    for (const v in s) {
      if (s.hasOwnProperty(v))
        res[v] = true;
    }
  }
  return res;
}
var VOID_ELEMENTS = tagSet("area,br,col,hr,img,wbr");
var OPTIONAL_END_TAG_BLOCK_ELEMENTS = tagSet("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr");
var OPTIONAL_END_TAG_INLINE_ELEMENTS = tagSet("rp,rt");
var OPTIONAL_END_TAG_ELEMENTS = merge2(OPTIONAL_END_TAG_INLINE_ELEMENTS, OPTIONAL_END_TAG_BLOCK_ELEMENTS);
var BLOCK_ELEMENTS = merge2(OPTIONAL_END_TAG_BLOCK_ELEMENTS, tagSet("address,article,aside,blockquote,caption,center,del,details,dialog,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,h6,header,hgroup,hr,ins,main,map,menu,nav,ol,pre,section,summary,table,ul"));
var INLINE_ELEMENTS = merge2(OPTIONAL_END_TAG_INLINE_ELEMENTS, tagSet("a,abbr,acronym,audio,b,bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,picture,q,ruby,rp,rt,s,samp,small,source,span,strike,strong,sub,sup,time,track,tt,u,var,video"));
var VALID_ELEMENTS = merge2(VOID_ELEMENTS, BLOCK_ELEMENTS, INLINE_ELEMENTS, OPTIONAL_END_TAG_ELEMENTS);
var URI_ATTRS = tagSet("background,cite,href,itemtype,longdesc,poster,src,xlink:href");
var HTML_ATTRS = tagSet("abbr,accesskey,align,alt,autoplay,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,compact,controls,coords,datetime,default,dir,download,face,headers,height,hidden,hreflang,hspace,ismap,itemscope,itemprop,kind,label,lang,language,loop,media,muted,nohref,nowrap,open,preload,rel,rev,role,rows,rowspan,rules,scope,scrolling,shape,size,sizes,span,srclang,srcset,start,summary,tabindex,target,title,translate,type,usemap,valign,value,vspace,width");
var ARIA_ATTRS = tagSet("aria-activedescendant,aria-atomic,aria-autocomplete,aria-busy,aria-checked,aria-colcount,aria-colindex,aria-colspan,aria-controls,aria-current,aria-describedby,aria-details,aria-disabled,aria-dropeffect,aria-errormessage,aria-expanded,aria-flowto,aria-grabbed,aria-haspopup,aria-hidden,aria-invalid,aria-keyshortcuts,aria-label,aria-labelledby,aria-level,aria-live,aria-modal,aria-multiline,aria-multiselectable,aria-orientation,aria-owns,aria-placeholder,aria-posinset,aria-pressed,aria-readonly,aria-relevant,aria-required,aria-roledescription,aria-rowcount,aria-rowindex,aria-rowspan,aria-selected,aria-setsize,aria-sort,aria-valuemax,aria-valuemin,aria-valuenow,aria-valuetext");
var VALID_ATTRS = merge2(URI_ATTRS, HTML_ATTRS, ARIA_ATTRS);
var SKIP_TRAVERSING_CONTENT_IF_INVALID_ELEMENTS = tagSet("script,style,template");
var SanitizingHtmlSerializer = class {
  // Explicitly track if something was stripped, to avoid accidentally warning of sanitization just
  // because characters were re-encoded.
  sanitizedSomething = false;
  buf = [];
  sanitizeChildren(el) {
    let current = el.firstChild;
    let traverseContent = true;
    let parentNodes = [];
    while (current) {
      if (current.nodeType === Node.ELEMENT_NODE) {
        traverseContent = this.startElement(current);
      } else if (current.nodeType === Node.TEXT_NODE) {
        this.chars(current.nodeValue);
      } else {
        this.sanitizedSomething = true;
      }
      if (traverseContent && current.firstChild) {
        parentNodes.push(current);
        current = getFirstChild(current);
        continue;
      }
      while (current) {
        if (current.nodeType === Node.ELEMENT_NODE) {
          this.endElement(current);
        }
        let next = getNextSibling(current);
        if (next) {
          current = next;
          break;
        }
        current = parentNodes.pop();
      }
    }
    return this.buf.join("");
  }
  /**
   * Sanitizes an opening element tag (if valid) and returns whether the element's contents should
   * be traversed. Element content must always be traversed (even if the element itself is not
   * valid/safe), unless the element is one of `SKIP_TRAVERSING_CONTENT_IF_INVALID_ELEMENTS`.
   *
   * @param element The element to sanitize.
   * @return True if the element's contents should be traversed.
   */
  startElement(element) {
    const tagName = getNodeName(element).toLowerCase();
    if (!VALID_ELEMENTS.hasOwnProperty(tagName)) {
      this.sanitizedSomething = true;
      return !SKIP_TRAVERSING_CONTENT_IF_INVALID_ELEMENTS.hasOwnProperty(tagName);
    }
    this.buf.push("<");
    this.buf.push(tagName);
    const elAttrs = element.attributes;
    for (let i = 0; i < elAttrs.length; i++) {
      const elAttr = elAttrs.item(i);
      const attrName = elAttr.name;
      const lower = attrName.toLowerCase();
      if (!VALID_ATTRS.hasOwnProperty(lower)) {
        this.sanitizedSomething = true;
        continue;
      }
      let value = elAttr.value;
      if (URI_ATTRS[lower])
        value = _sanitizeUrl(value);
      this.buf.push(" ", attrName, '="', encodeEntities(value), '"');
    }
    this.buf.push(">");
    return true;
  }
  endElement(current) {
    const tagName = getNodeName(current).toLowerCase();
    if (VALID_ELEMENTS.hasOwnProperty(tagName) && !VOID_ELEMENTS.hasOwnProperty(tagName)) {
      this.buf.push("</");
      this.buf.push(tagName);
      this.buf.push(">");
    }
  }
  chars(chars) {
    this.buf.push(encodeEntities(chars));
  }
};
function isClobberedElement(parentNode, childNode) {
  return (parentNode.compareDocumentPosition(childNode) & Node.DOCUMENT_POSITION_CONTAINED_BY) !== Node.DOCUMENT_POSITION_CONTAINED_BY;
}
function getNextSibling(node) {
  const nextSibling = node.nextSibling;
  if (nextSibling && node !== nextSibling.previousSibling) {
    throw clobberedElementError(nextSibling);
  }
  return nextSibling;
}
function getFirstChild(node) {
  const firstChild = node.firstChild;
  if (firstChild && isClobberedElement(node, firstChild)) {
    throw clobberedElementError(firstChild);
  }
  return firstChild;
}
function getNodeName(node) {
  const nodeName = node.nodeName;
  return typeof nodeName === "string" ? nodeName : "FORM";
}
function clobberedElementError(node) {
  return new Error(`Failed to sanitize html because the element is clobbered: ${node.outerHTML}`);
}
var SURROGATE_PAIR_REGEXP = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
var NON_ALPHANUMERIC_REGEXP = /([^\#-~ |!])/g;
function encodeEntities(value) {
  return value.replace(/&/g, "&amp;").replace(SURROGATE_PAIR_REGEXP, function(match2) {
    const hi = match2.charCodeAt(0);
    const low = match2.charCodeAt(1);
    return "&#" + ((hi - 55296) * 1024 + (low - 56320) + 65536) + ";";
  }).replace(NON_ALPHANUMERIC_REGEXP, function(match2) {
    return "&#" + match2.charCodeAt(0) + ";";
  }).replace(/</g, "&lt;").replace(/>/g, "&gt;");
}
var inertBodyHelper;
function _sanitizeHtml(defaultDoc, unsafeHtmlInput) {
  let inertBodyElement = null;
  try {
    inertBodyHelper = inertBodyHelper || getInertBodyHelper(defaultDoc);
    let unsafeHtml = unsafeHtmlInput ? String(unsafeHtmlInput) : "";
    inertBodyElement = inertBodyHelper.getInertBodyElement(unsafeHtml);
    let mXSSAttempts = 5;
    let parsedHtml = unsafeHtml;
    do {
      if (mXSSAttempts === 0) {
        throw new Error("Failed to sanitize html because the input is unstable");
      }
      mXSSAttempts--;
      unsafeHtml = parsedHtml;
      parsedHtml = inertBodyElement.innerHTML;
      inertBodyElement = inertBodyHelper.getInertBodyElement(unsafeHtml);
    } while (unsafeHtml !== parsedHtml);
    const sanitizer = new SanitizingHtmlSerializer();
    const safeHtml = sanitizer.sanitizeChildren(getTemplateContent(inertBodyElement) || inertBodyElement);
    if ((typeof ngDevMode === "undefined" || ngDevMode) && sanitizer.sanitizedSomething) {
      console.warn(`WARNING: sanitizing HTML stripped some content, see ${XSS_SECURITY_URL}`);
    }
    return trustedHTMLFromString(safeHtml);
  } finally {
    if (inertBodyElement) {
      const parent = getTemplateContent(inertBodyElement) || inertBodyElement;
      while (parent.firstChild) {
        parent.firstChild.remove();
      }
    }
  }
}
function getTemplateContent(el) {
  return "content" in el && isTemplateElement(el) ? el.content : null;
}
function isTemplateElement(el) {
  return el.nodeType === Node.ELEMENT_NODE && el.nodeName === "TEMPLATE";
}
var SecurityContext;
(function(SecurityContext2) {
  SecurityContext2[SecurityContext2["NONE"] = 0] = "NONE";
  SecurityContext2[SecurityContext2["HTML"] = 1] = "HTML";
  SecurityContext2[SecurityContext2["STYLE"] = 2] = "STYLE";
  SecurityContext2[SecurityContext2["SCRIPT"] = 3] = "SCRIPT";
  SecurityContext2[SecurityContext2["URL"] = 4] = "URL";
  SecurityContext2[SecurityContext2["RESOURCE_URL"] = 5] = "RESOURCE_URL";
})(SecurityContext || (SecurityContext = {}));
function \u0275\u0275sanitizeHtml(unsafeHtml) {
  const sanitizer = getSanitizer();
  if (sanitizer) {
    return trustedHTMLFromStringBypass(sanitizer.sanitize(SecurityContext.HTML, unsafeHtml) || "");
  }
  if (allowSanitizationBypassAndThrow(
    unsafeHtml,
    "HTML"
    /* BypassType.Html */
  )) {
    return trustedHTMLFromStringBypass(unwrapSafeValue(unsafeHtml));
  }
  return _sanitizeHtml(getDocument(), renderStringify(unsafeHtml));
}
function \u0275\u0275sanitizeStyle(unsafeStyle) {
  const sanitizer = getSanitizer();
  if (sanitizer) {
    return sanitizer.sanitize(SecurityContext.STYLE, unsafeStyle) || "";
  }
  if (allowSanitizationBypassAndThrow(
    unsafeStyle,
    "Style"
    /* BypassType.Style */
  )) {
    return unwrapSafeValue(unsafeStyle);
  }
  return renderStringify(unsafeStyle);
}
function \u0275\u0275sanitizeUrl(unsafeUrl) {
  const sanitizer = getSanitizer();
  if (sanitizer) {
    return sanitizer.sanitize(SecurityContext.URL, unsafeUrl) || "";
  }
  if (allowSanitizationBypassAndThrow(
    unsafeUrl,
    "URL"
    /* BypassType.Url */
  )) {
    return unwrapSafeValue(unsafeUrl);
  }
  return _sanitizeUrl(renderStringify(unsafeUrl));
}
function \u0275\u0275sanitizeResourceUrl(unsafeResourceUrl) {
  const sanitizer = getSanitizer();
  if (sanitizer) {
    return trustedScriptURLFromStringBypass(sanitizer.sanitize(SecurityContext.RESOURCE_URL, unsafeResourceUrl) || "");
  }
  if (allowSanitizationBypassAndThrow(
    unsafeResourceUrl,
    "ResourceURL"
    /* BypassType.ResourceUrl */
  )) {
    return trustedScriptURLFromStringBypass(unwrapSafeValue(unsafeResourceUrl));
  }
  throw new RuntimeError(904, ngDevMode && `unsafe value used in a resource URL context (see ${XSS_SECURITY_URL})`);
}
function \u0275\u0275sanitizeScript(unsafeScript) {
  const sanitizer = getSanitizer();
  if (sanitizer) {
    return trustedScriptFromStringBypass(sanitizer.sanitize(SecurityContext.SCRIPT, unsafeScript) || "");
  }
  if (allowSanitizationBypassAndThrow(
    unsafeScript,
    "Script"
    /* BypassType.Script */
  )) {
    return trustedScriptFromStringBypass(unwrapSafeValue(unsafeScript));
  }
  throw new RuntimeError(905, ngDevMode && "unsafe value used in a script context");
}
function \u0275\u0275trustConstantHtml(html) {
  if (ngDevMode && (!Array.isArray(html) || !Array.isArray(html.raw) || html.length !== 1)) {
    throw new Error(`Unexpected interpolation in trusted HTML constant: ${html.join("?")}`);
  }
  return trustedHTMLFromString(html[0]);
}
function \u0275\u0275trustConstantResourceUrl(url) {
  if (ngDevMode && (!Array.isArray(url) || !Array.isArray(url.raw) || url.length !== 1)) {
    throw new Error(`Unexpected interpolation in trusted URL constant: ${url.join("?")}`);
  }
  return trustedScriptURLFromString(url[0]);
}
function getUrlSanitizer(tag, prop) {
  if (prop === "src" && (tag === "embed" || tag === "frame" || tag === "iframe" || tag === "media" || tag === "script") || prop === "href" && (tag === "base" || tag === "link")) {
    return \u0275\u0275sanitizeResourceUrl;
  }
  return \u0275\u0275sanitizeUrl;
}
function \u0275\u0275sanitizeUrlOrResourceUrl(unsafeUrl, tag, prop) {
  return getUrlSanitizer(tag, prop)(unsafeUrl);
}
function validateAgainstEventProperties(name2) {
  if (name2.toLowerCase().startsWith("on")) {
    const errorMessage = `Binding to event property '${name2}' is disallowed for security reasons, please use (${name2.slice(2)})=...
If '${name2}' is a directive input, make sure the directive is imported by the current module.`;
    throw new RuntimeError(306, errorMessage);
  }
}
function validateAgainstEventAttributes(name2) {
  if (name2.toLowerCase().startsWith("on")) {
    const errorMessage = `Binding to event attribute '${name2}' is disallowed for security reasons, please use (${name2.slice(2)})=...`;
    throw new RuntimeError(306, errorMessage);
  }
}
function getSanitizer() {
  const lView = getLView();
  return lView && lView[ENVIRONMENT].sanitizer;
}
var COMMENT_DISALLOWED = /^>|^->|<!--|-->|--!>|<!-$/g;
var COMMENT_DELIMITER = /(<|>)/g;
var COMMENT_DELIMITER_ESCAPED = "\u200B$1\u200B";
function escapeCommentText(value) {
  return value.replace(COMMENT_DISALLOWED, (text) => text.replace(COMMENT_DELIMITER, COMMENT_DELIMITER_ESCAPED));
}
var NG_REFLECT_ATTRS_FLAG_DEFAULT = false;
var NG_REFLECT_ATTRS_FLAG = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "NG_REFLECT_FLAG" : "", {
  providedIn: "root",
  factory: () => NG_REFLECT_ATTRS_FLAG_DEFAULT
});
function normalizeDebugBindingName(name2) {
  name2 = camelCaseToDashCase(name2.replace(/[$@]/g, "_"));
  return `ng-reflect-${name2}`;
}
var CAMEL_CASE_REGEXP = /([A-Z])/g;
function camelCaseToDashCase(input2) {
  return input2.replace(CAMEL_CASE_REGEXP, (...m) => "-" + m[1].toLowerCase());
}
function normalizeDebugBindingValue(value) {
  try {
    return value != null ? value.toString().slice(0, 30) : value;
  } catch (e) {
    return "[ERROR] Exception while trying to serialize the value";
  }
}
var CUSTOM_ELEMENTS_SCHEMA = {
  name: "custom-elements"
};
var NO_ERRORS_SCHEMA = {
  name: "no-errors-schema"
};
var shouldThrowErrorOnUnknownElement = false;
var shouldThrowErrorOnUnknownProperty = false;
function validateElementIsKnown(lView, tNode) {
  const tView = lView[TVIEW];
  if (tView.schemas === null)
    return;
  const tagName = tNode.value;
  if (!isDirectiveHost(tNode) && tagName !== null) {
    const isUnknown = (
      // Note that we can't check for `typeof HTMLUnknownElement === 'function'` because
      // Domino doesn't expose HTMLUnknownElement globally.
      typeof HTMLUnknownElement !== "undefined" && HTMLUnknownElement && getNativeByTNode(tNode, lView) instanceof HTMLUnknownElement || typeof customElements !== "undefined" && tagName.indexOf("-") > -1 && !customElements.get(tagName)
    );
    if (isUnknown && !matchingSchemas(tView.schemas, tagName)) {
      const isHostStandalone = isHostComponentStandalone(lView);
      const templateLocation = getTemplateLocationDetails(lView);
      const schemas2 = `'${isHostStandalone ? "@Component" : "@NgModule"}.schemas'`;
      let message = `'${tagName}' is not a known element${templateLocation}:
`;
      message += `1. If '${tagName}' is an Angular component, then verify that it is ${isHostStandalone ? "included in the '@Component.imports' of this component" : "a part of an @NgModule where this component is declared"}.
`;
      if (tagName && tagName.indexOf("-") > -1) {
        message += `2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas2} of this component to suppress this message.`;
      } else {
        message += `2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas2} of this component.`;
      }
      if (shouldThrowErrorOnUnknownElement) {
        throw new RuntimeError(304, message);
      } else {
        console.error(formatRuntimeError(304, message));
      }
    }
  }
}
function isPropertyValid(element, propName, tagName, schemas2) {
  if (schemas2 === null)
    return true;
  if (matchingSchemas(schemas2, tagName) || propName in element || isAnimationProp(propName)) {
    return true;
  }
  return typeof Node === "undefined" || Node === null || !(element instanceof Node);
}
function handleUnknownPropertyError(propName, tagName, nodeType, lView) {
  if (!tagName && nodeType === 4) {
    tagName = "ng-template";
  }
  const isHostStandalone = isHostComponentStandalone(lView);
  const templateLocation = getTemplateLocationDetails(lView);
  let message = `Can't bind to '${propName}' since it isn't a known property of '${tagName}'${templateLocation}.`;
  const schemas2 = `'${isHostStandalone ? "@Component" : "@NgModule"}.schemas'`;
  const importLocation = isHostStandalone ? "included in the '@Component.imports' of this component" : "a part of an @NgModule where this component is declared";
  if (KNOWN_CONTROL_FLOW_DIRECTIVES.has(propName)) {
    const correspondingImport = KNOWN_CONTROL_FLOW_DIRECTIVES.get(propName);
    message += `
If the '${propName}' is an Angular control flow directive, please make sure that either the '${correspondingImport}' directive or the 'CommonModule' is ${importLocation}.`;
  } else {
    message += `
1. If '${tagName}' is an Angular component and it has the '${propName}' input, then verify that it is ${importLocation}.`;
    if (tagName && tagName.indexOf("-") > -1) {
      message += `
2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas2} of this component to suppress this message.`;
      message += `
3. To allow any property add 'NO_ERRORS_SCHEMA' to the ${schemas2} of this component.`;
    } else {
      message += `
2. To allow any property add 'NO_ERRORS_SCHEMA' to the ${schemas2} of this component.`;
    }
  }
  reportUnknownPropertyError(message);
}
function reportUnknownPropertyError(message) {
  if (shouldThrowErrorOnUnknownProperty) {
    throw new RuntimeError(303, message);
  } else {
    console.error(formatRuntimeError(303, message));
  }
}
function getDeclarationComponentDef(lView) {
  !ngDevMode && throwError2("Must never be called in production mode");
  const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
  const context2 = declarationLView[CONTEXT];
  if (!context2)
    return null;
  return context2.constructor ? getComponentDef(context2.constructor) : null;
}
function isHostComponentStandalone(lView) {
  !ngDevMode && throwError2("Must never be called in production mode");
  const componentDef = getDeclarationComponentDef(lView);
  return !!componentDef?.standalone;
}
function getTemplateLocationDetails(lView) {
  !ngDevMode && throwError2("Must never be called in production mode");
  const hostComponentDef = getDeclarationComponentDef(lView);
  const componentClassName = hostComponentDef?.type?.name;
  return componentClassName ? ` (used in the '${componentClassName}' component template)` : "";
}
var KNOWN_CONTROL_FLOW_DIRECTIVES = /* @__PURE__ */ new Map([
  ["ngIf", "NgIf"],
  ["ngFor", "NgFor"],
  ["ngSwitchCase", "NgSwitchCase"],
  ["ngSwitchDefault", "NgSwitchDefault"]
]);
function matchingSchemas(schemas2, tagName) {
  if (schemas2 !== null) {
    for (let i = 0; i < schemas2.length; i++) {
      const schema4 = schemas2[i];
      if (schema4 === NO_ERRORS_SCHEMA || schema4 === CUSTOM_ELEMENTS_SCHEMA && tagName && tagName.indexOf("-") > -1) {
        return true;
      }
    }
  }
  return false;
}
function \u0275\u0275resolveWindow(element) {
  return element.ownerDocument.defaultView;
}
function \u0275\u0275resolveDocument(element) {
  return element.ownerDocument;
}
function \u0275\u0275resolveBody(element) {
  return element.ownerDocument.body;
}
var INTERPOLATION_DELIMITER = `\uFFFD`;
function maybeUnwrapFn(value) {
  if (value instanceof Function) {
    return value();
  } else {
    return value;
  }
}
var VALUE_STRING_LENGTH_LIMIT = 200;
function assertStandaloneComponentType(type) {
  assertComponentDef(type);
  const componentDef = getComponentDef(type);
  if (!componentDef.standalone) {
    throw new RuntimeError(907, `The ${stringifyForError(type)} component is not marked as standalone, but Angular expects to have a standalone component here. Please make sure the ${stringifyForError(type)} component has the \`standalone: true\` flag in the decorator.`);
  }
}
function assertComponentDef(type) {
  if (!getComponentDef(type)) {
    throw new RuntimeError(906, `The ${stringifyForError(type)} is not an Angular component, make sure it has the \`@Component\` decorator.`);
  }
}
function throwMultipleComponentError(tNode, first2, second) {
  throw new RuntimeError(-300, `Multiple components match node with tagname ${tNode.value}: ${stringifyForError(first2)} and ${stringifyForError(second)}`);
}
function throwErrorIfNoChangesMode(creationMode, oldValue, currValue, propName, lView) {
  const hostComponentDef = getDeclarationComponentDef(lView);
  const componentClassName = hostComponentDef?.type?.name;
  const field = propName ? ` for '${propName}'` : "";
  let msg = `ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value${field}: '${formatValue(oldValue)}'. Current value: '${formatValue(currValue)}'.${componentClassName ? ` Expression location: ${componentClassName} component` : ""}`;
  if (creationMode) {
    msg += ` It seems like the view has been created after its parent and its children have been dirty checked. Has it been created in a change detection hook?`;
  }
  throw new RuntimeError(-100, msg);
}
function formatValue(value) {
  let strValue = String(value);
  try {
    if (Array.isArray(value) || strValue === "[object Object]") {
      strValue = JSON.stringify(value);
    }
  } catch (error) {
  }
  return strValue.length > VALUE_STRING_LENGTH_LIMIT ? strValue.substring(0, VALUE_STRING_LENGTH_LIMIT) + "\u2026" : strValue;
}
function constructDetailsForInterpolation(lView, rootIndex, expressionIndex, meta, changedValue) {
  const [propName, prefix, ...chunks] = meta.split(INTERPOLATION_DELIMITER);
  let oldValue = prefix, newValue = prefix;
  for (let i = 0; i < chunks.length; i++) {
    const slotIdx = rootIndex + i;
    oldValue += `${lView[slotIdx]}${chunks[i]}`;
    newValue += `${slotIdx === expressionIndex ? changedValue : lView[slotIdx]}${chunks[i]}`;
  }
  return { propName, oldValue, newValue };
}
function getExpressionChangedErrorDetails(lView, bindingIndex, oldValue, newValue) {
  const tData = lView[TVIEW].data;
  const metadata = tData[bindingIndex];
  if (typeof metadata === "string") {
    if (metadata.indexOf(INTERPOLATION_DELIMITER) > -1) {
      return constructDetailsForInterpolation(lView, bindingIndex, bindingIndex, metadata, newValue);
    }
    return { propName: metadata, oldValue, newValue };
  }
  if (metadata === null) {
    let idx = bindingIndex - 1;
    while (typeof tData[idx] !== "string" && tData[idx + 1] === null) {
      idx--;
    }
    const meta = tData[idx];
    if (typeof meta === "string") {
      const matches = meta.match(new RegExp(INTERPOLATION_DELIMITER, "g"));
      if (matches && matches.length - 1 > bindingIndex - idx) {
        return constructDetailsForInterpolation(lView, idx, bindingIndex, meta, newValue);
      }
    }
  }
  return { propName: void 0, oldValue, newValue };
}
function classIndexOf(className, classToSearch, startingIndex) {
  ngDevMode && assertNotEqual(classToSearch, "", 'can not look for "" string.');
  let end = className.length;
  while (true) {
    const foundIndex = className.indexOf(classToSearch, startingIndex);
    if (foundIndex === -1)
      return foundIndex;
    if (foundIndex === 0 || className.charCodeAt(foundIndex - 1) <= 32) {
      const length = classToSearch.length;
      if (foundIndex + length === end || className.charCodeAt(foundIndex + length) <= 32) {
        return foundIndex;
      }
    }
    startingIndex = foundIndex + 1;
  }
}
var NG_TEMPLATE_SELECTOR = "ng-template";
function isCssClassMatching(tNode, attrs, cssClassToMatch, isProjectionMode) {
  ngDevMode && assertEqual(cssClassToMatch, cssClassToMatch.toLowerCase(), "Class name expected to be lowercase.");
  let i = 0;
  if (isProjectionMode) {
    for (; i < attrs.length && typeof attrs[i] === "string"; i += 2) {
      if (attrs[i] === "class" && classIndexOf(attrs[i + 1].toLowerCase(), cssClassToMatch, 0) !== -1) {
        return true;
      }
    }
  } else if (isInlineTemplate(tNode)) {
    return false;
  }
  i = attrs.indexOf(1, i);
  if (i > -1) {
    let item;
    while (++i < attrs.length && typeof (item = attrs[i]) === "string") {
      if (item.toLowerCase() === cssClassToMatch) {
        return true;
      }
    }
  }
  return false;
}
function isInlineTemplate(tNode) {
  return tNode.type === 4 && tNode.value !== NG_TEMPLATE_SELECTOR;
}
function hasTagAndTypeMatch(tNode, currentSelector, isProjectionMode) {
  const tagNameToCompare = tNode.type === 4 && !isProjectionMode ? NG_TEMPLATE_SELECTOR : tNode.value;
  return currentSelector === tagNameToCompare;
}
function isNodeMatchingSelector(tNode, selector, isProjectionMode) {
  ngDevMode && assertDefined(selector[0], "Selector should have a tag name");
  let mode = 4;
  const nodeAttrs = tNode.attrs;
  const nameOnlyMarkerIdx = nodeAttrs !== null ? getNameOnlyMarkerIndex(nodeAttrs) : 0;
  let skipToNextSelector = false;
  for (let i = 0; i < selector.length; i++) {
    const current = selector[i];
    if (typeof current === "number") {
      if (!skipToNextSelector && !isPositive(mode) && !isPositive(current)) {
        return false;
      }
      if (skipToNextSelector && isPositive(current))
        continue;
      skipToNextSelector = false;
      mode = current | mode & 1;
      continue;
    }
    if (skipToNextSelector)
      continue;
    if (mode & 4) {
      mode = 2 | mode & 1;
      if (current !== "" && !hasTagAndTypeMatch(tNode, current, isProjectionMode) || current === "" && selector.length === 1) {
        if (isPositive(mode))
          return false;
        skipToNextSelector = true;
      }
    } else if (mode & 8) {
      if (nodeAttrs === null || !isCssClassMatching(tNode, nodeAttrs, current, isProjectionMode)) {
        if (isPositive(mode))
          return false;
        skipToNextSelector = true;
      }
    } else {
      const selectorAttrValue = selector[++i];
      const attrIndexInNode = findAttrIndexInNode(current, nodeAttrs, isInlineTemplate(tNode), isProjectionMode);
      if (attrIndexInNode === -1) {
        if (isPositive(mode))
          return false;
        skipToNextSelector = true;
        continue;
      }
      if (selectorAttrValue !== "") {
        let nodeAttrValue;
        if (attrIndexInNode > nameOnlyMarkerIdx) {
          nodeAttrValue = "";
        } else {
          ngDevMode && assertNotEqual(nodeAttrs[attrIndexInNode], 0, "We do not match directives on namespaced attributes");
          nodeAttrValue = nodeAttrs[attrIndexInNode + 1].toLowerCase();
        }
        if (mode & 2 && selectorAttrValue !== nodeAttrValue) {
          if (isPositive(mode))
            return false;
          skipToNextSelector = true;
        }
      }
    }
  }
  return isPositive(mode) || skipToNextSelector;
}
function isPositive(mode) {
  return (mode & 1) === 0;
}
function findAttrIndexInNode(name2, attrs, isInlineTemplate2, isProjectionMode) {
  if (attrs === null)
    return -1;
  let i = 0;
  if (isProjectionMode || !isInlineTemplate2) {
    let bindingsMode = false;
    while (i < attrs.length) {
      const maybeAttrName = attrs[i];
      if (maybeAttrName === name2) {
        return i;
      } else if (maybeAttrName === 3 || maybeAttrName === 6) {
        bindingsMode = true;
      } else if (maybeAttrName === 1 || maybeAttrName === 2) {
        let value = attrs[++i];
        while (typeof value === "string") {
          value = attrs[++i];
        }
        continue;
      } else if (maybeAttrName === 4) {
        break;
      } else if (maybeAttrName === 0) {
        i += 4;
        continue;
      }
      i += bindingsMode ? 1 : 2;
    }
    return -1;
  } else {
    return matchTemplateAttribute(attrs, name2);
  }
}
function isNodeMatchingSelectorList(tNode, selector, isProjectionMode = false) {
  for (let i = 0; i < selector.length; i++) {
    if (isNodeMatchingSelector(tNode, selector[i], isProjectionMode)) {
      return true;
    }
  }
  return false;
}
function getProjectAsAttrValue(tNode) {
  const nodeAttrs = tNode.attrs;
  if (nodeAttrs != null) {
    const ngProjectAsAttrIdx = nodeAttrs.indexOf(
      5
      /* AttributeMarker.ProjectAs */
    );
    if ((ngProjectAsAttrIdx & 1) === 0) {
      return nodeAttrs[ngProjectAsAttrIdx + 1];
    }
  }
  return null;
}
function getNameOnlyMarkerIndex(nodeAttrs) {
  for (let i = 0; i < nodeAttrs.length; i++) {
    const nodeAttr = nodeAttrs[i];
    if (isNameOnlyAttributeMarker(nodeAttr)) {
      return i;
    }
  }
  return nodeAttrs.length;
}
function matchTemplateAttribute(attrs, name2) {
  let i = attrs.indexOf(
    4
    /* AttributeMarker.Template */
  );
  if (i > -1) {
    i++;
    while (i < attrs.length) {
      const attr = attrs[i];
      if (typeof attr === "number")
        return -1;
      if (attr === name2)
        return i;
      i++;
    }
  }
  return -1;
}
function isSelectorInSelectorList(selector, list) {
  selectorListLoop: for (let i = 0; i < list.length; i++) {
    const currentSelectorInList = list[i];
    if (selector.length !== currentSelectorInList.length) {
      continue;
    }
    for (let j = 0; j < selector.length; j++) {
      if (selector[j] !== currentSelectorInList[j]) {
        continue selectorListLoop;
      }
    }
    return true;
  }
  return false;
}
function maybeWrapInNotSelector(isNegativeMode, chunk) {
  return isNegativeMode ? ":not(" + chunk.trim() + ")" : chunk;
}
function stringifyCSSSelector(selector) {
  let result = selector[0];
  let i = 1;
  let mode = 2;
  let currentChunk = "";
  let isNegativeMode = false;
  while (i < selector.length) {
    let valueOrMarker = selector[i];
    if (typeof valueOrMarker === "string") {
      if (mode & 2) {
        const attrValue = selector[++i];
        currentChunk += "[" + valueOrMarker + (attrValue.length > 0 ? '="' + attrValue + '"' : "") + "]";
      } else if (mode & 8) {
        currentChunk += "." + valueOrMarker;
      } else if (mode & 4) {
        currentChunk += " " + valueOrMarker;
      }
    } else {
      if (currentChunk !== "" && !isPositive(valueOrMarker)) {
        result += maybeWrapInNotSelector(isNegativeMode, currentChunk);
        currentChunk = "";
      }
      mode = valueOrMarker;
      isNegativeMode = isNegativeMode || !isPositive(mode);
    }
    i++;
  }
  if (currentChunk !== "") {
    result += maybeWrapInNotSelector(isNegativeMode, currentChunk);
  }
  return result;
}
function stringifyCSSSelectorList(selectorList) {
  return selectorList.map(stringifyCSSSelector).join(",");
}
function extractAttrsAndClassesFromSelector(selector) {
  const attrs = [];
  const classes = [];
  let i = 1;
  let mode = 2;
  while (i < selector.length) {
    let valueOrMarker = selector[i];
    if (typeof valueOrMarker === "string") {
      if (mode === 2) {
        if (valueOrMarker !== "") {
          attrs.push(valueOrMarker, selector[++i]);
        }
      } else if (mode === 8) {
        classes.push(valueOrMarker);
      }
    } else {
      if (!isPositive(mode))
        break;
      mode = valueOrMarker;
    }
    i++;
  }
  if (classes.length) {
    attrs.push(1, ...classes);
  }
  return attrs;
}
var NO_CHANGE = typeof ngDevMode === "undefined" || ngDevMode ? { __brand__: "NO_CHANGE" } : {};
function createTextNode(renderer, value) {
  return renderer.createText(value);
}
function updateTextNode(renderer, rNode, value) {
  renderer.setValue(rNode, value);
}
function createCommentNode(renderer, value) {
  return renderer.createComment(escapeCommentText(value));
}
function createElementNode(renderer, name2, namespace) {
  return renderer.createElement(name2, namespace);
}
function nativeInsertBefore(renderer, parent, child, beforeNode, isMove) {
  renderer.insertBefore(parent, child, beforeNode, isMove);
}
function nativeAppendChild(renderer, parent, child) {
  ngDevMode && assertDefined(parent, "parent node must be defined");
  renderer.appendChild(parent, child);
}
function nativeAppendOrInsertBefore(renderer, parent, child, beforeNode, isMove) {
  if (beforeNode !== null) {
    nativeInsertBefore(renderer, parent, child, beforeNode, isMove);
  } else {
    nativeAppendChild(renderer, parent, child);
  }
}
function nativeRemoveNode(renderer, rNode, isHostElement) {
  renderer.removeChild(null, rNode, isHostElement);
}
function writeDirectStyle(renderer, element, newValue) {
  ngDevMode && assertString(newValue, "'newValue' should be a string");
  renderer.setAttribute(element, "style", newValue);
}
function writeDirectClass(renderer, element, newValue) {
  ngDevMode && assertString(newValue, "'newValue' should be a string");
  if (newValue === "") {
    renderer.removeAttribute(element, "class");
  } else {
    renderer.setAttribute(element, "class", newValue);
  }
}
function setupStaticAttributes(renderer, element, tNode) {
  const { mergedAttrs, classes, styles } = tNode;
  if (mergedAttrs !== null) {
    setUpAttributes(renderer, element, mergedAttrs);
  }
  if (classes !== null) {
    writeDirectClass(renderer, element, classes);
  }
  if (styles !== null) {
    writeDirectStyle(renderer, element, styles);
  }
}
function createTView(type, declTNode, templateFn, decls, vars, directives, pipes, viewQuery, schemas2, constsOrFactory, ssrId) {
  const bindingStartIndex = HEADER_OFFSET + decls;
  const initialViewLength = bindingStartIndex + vars;
  const blueprint = createViewBlueprint(bindingStartIndex, initialViewLength);
  const consts = typeof constsOrFactory === "function" ? constsOrFactory() : constsOrFactory;
  const tView = blueprint[TVIEW] = {
    type,
    blueprint,
    template: templateFn,
    queries: null,
    viewQuery,
    declTNode,
    data: blueprint.slice().fill(null, bindingStartIndex),
    bindingStartIndex,
    expandoStartIndex: initialViewLength,
    hostBindingOpCodes: null,
    firstCreatePass: true,
    firstUpdatePass: true,
    staticViewQueries: false,
    staticContentQueries: false,
    preOrderHooks: null,
    preOrderCheckHooks: null,
    contentHooks: null,
    contentCheckHooks: null,
    viewHooks: null,
    viewCheckHooks: null,
    destroyHooks: null,
    cleanup: null,
    contentQueries: null,
    components: null,
    directiveRegistry: typeof directives === "function" ? directives() : directives,
    pipeRegistry: typeof pipes === "function" ? pipes() : pipes,
    firstChild: null,
    schemas: schemas2,
    consts,
    incompleteFirstPass: false,
    ssrId
  };
  if (ngDevMode) {
    Object.seal(tView);
  }
  return tView;
}
function createViewBlueprint(bindingStartIndex, initialViewLength) {
  const blueprint = [];
  for (let i = 0; i < initialViewLength; i++) {
    blueprint.push(i < bindingStartIndex ? null : NO_CHANGE);
  }
  return blueprint;
}
function getOrCreateComponentTView(def) {
  const tView = def.tView;
  if (tView === null || tView.incompleteFirstPass) {
    const declTNode = null;
    return def.tView = createTView(1, declTNode, def.template, def.decls, def.vars, def.directiveDefs, def.pipeDefs, def.viewQuery, def.schemas, def.consts, def.id);
  }
  return tView;
}
function createLView(parentLView, tView, context2, flags, host, tHostNode, environment, renderer, injector, embeddedViewInjector, hydrationInfo) {
  const lView = tView.blueprint.slice();
  lView[HOST] = host;
  lView[FLAGS] = flags | 4 | 128 | 8 | 64 | 1024;
  if (embeddedViewInjector !== null || parentLView && parentLView[FLAGS] & 2048) {
    lView[FLAGS] |= 2048;
  }
  resetPreOrderHookFlags(lView);
  ngDevMode && tView.declTNode && parentLView && assertTNodeForLView(tView.declTNode, parentLView);
  lView[PARENT] = lView[DECLARATION_VIEW] = parentLView;
  lView[CONTEXT] = context2;
  lView[ENVIRONMENT] = environment || parentLView && parentLView[ENVIRONMENT];
  ngDevMode && assertDefined(lView[ENVIRONMENT], "LViewEnvironment is required");
  lView[RENDERER] = renderer || parentLView && parentLView[RENDERER];
  ngDevMode && assertDefined(lView[RENDERER], "Renderer is required");
  lView[INJECTOR] = injector || parentLView && parentLView[INJECTOR] || null;
  lView[T_HOST] = tHostNode;
  lView[ID] = getUniqueLViewId();
  lView[HYDRATION] = hydrationInfo;
  lView[EMBEDDED_VIEW_INJECTOR] = embeddedViewInjector;
  ngDevMode && assertEqual(tView.type == 2 ? parentLView !== null : true, true, "Embedded views must have parentLView");
  lView[DECLARATION_COMPONENT_VIEW] = tView.type == 2 ? parentLView[DECLARATION_COMPONENT_VIEW] : lView;
  return lView;
}
function createComponentLView(lView, hostTNode, def) {
  const native = getNativeByTNode(hostTNode, lView);
  const tView = getOrCreateComponentTView(def);
  const rendererFactory = lView[ENVIRONMENT].rendererFactory;
  const componentView = addToEndOfViewTree(lView, createLView(lView, tView, null, getInitialLViewFlagsFromDef(def), native, hostTNode, null, rendererFactory.createRenderer(native, def), null, null, null));
  return lView[hostTNode.index] = componentView;
}
function getInitialLViewFlagsFromDef(def) {
  let flags = 16;
  if (def.signals) {
    flags = 4096;
  } else if (def.onPush) {
    flags = 64;
  }
  return flags;
}
function allocExpando(tView, lView, numSlotsToAlloc, initialValue) {
  if (numSlotsToAlloc === 0)
    return -1;
  if (ngDevMode) {
    assertFirstCreatePass(tView);
    assertSame(tView, lView[TVIEW], "`LView` must be associated with `TView`!");
    assertEqual(tView.data.length, lView.length, "Expecting LView to be same size as TView");
    assertEqual(tView.data.length, tView.blueprint.length, "Expecting Blueprint to be same size as TView");
    assertFirstUpdatePass(tView);
  }
  const allocIdx = lView.length;
  for (let i = 0; i < numSlotsToAlloc; i++) {
    lView.push(initialValue);
    tView.blueprint.push(initialValue);
    tView.data.push(null);
  }
  return allocIdx;
}
function addToEndOfViewTree(lView, lViewOrLContainer) {
  if (lView[CHILD_HEAD]) {
    lView[CHILD_TAIL][NEXT] = lViewOrLContainer;
  } else {
    lView[CHILD_HEAD] = lViewOrLContainer;
  }
  lView[CHILD_TAIL] = lViewOrLContainer;
  return lViewOrLContainer;
}
function \u0275\u0275advance(delta = 1) {
  ngDevMode && assertGreaterThan(delta, 0, "Can only advance forward");
  selectIndexInternal(getTView(), getLView(), getSelectedIndex() + delta, !!ngDevMode && isInCheckNoChangesMode());
}
function selectIndexInternal(tView, lView, index, checkNoChangesMode) {
  ngDevMode && assertIndexInDeclRange(lView[TVIEW], index);
  if (!checkNoChangesMode) {
    const hooksInitPhaseCompleted = (lView[FLAGS] & 3) === 3;
    if (hooksInitPhaseCompleted) {
      const preOrderCheckHooks = tView.preOrderCheckHooks;
      if (preOrderCheckHooks !== null) {
        executeCheckHooks(lView, preOrderCheckHooks, index);
      }
    } else {
      const preOrderHooks = tView.preOrderHooks;
      if (preOrderHooks !== null) {
        executeInitAndCheckHooks(lView, preOrderHooks, 0, index);
      }
    }
  }
  setSelectedIndex(index);
}
var InputFlags;
(function(InputFlags2) {
  InputFlags2[InputFlags2["None"] = 0] = "None";
  InputFlags2[InputFlags2["SignalBased"] = 1] = "SignalBased";
  InputFlags2[InputFlags2["HasDecoratorInputTransform"] = 2] = "HasDecoratorInputTransform";
})(InputFlags || (InputFlags = {}));
function writeToDirectiveInput(def, instance, publicName, value) {
  const prevConsumer = setActiveConsumer(null);
  try {
    if (ngDevMode) {
      if (!def.inputs.hasOwnProperty(publicName)) {
        throw new Error(`ASSERTION ERROR: Directive ${def.type.name} does not have an input with a public name of "${publicName}"`);
      }
      if (instance instanceof NodeInjectorFactory) {
        throw new Error(`ASSERTION ERROR: Cannot write input to factory for type ${def.type.name}. Directive has not been created yet.`);
      }
    }
    const [privateName, flags, transform] = def.inputs[publicName];
    let inputSignalNode = null;
    if ((flags & InputFlags.SignalBased) !== 0) {
      const field = instance[privateName];
      inputSignalNode = field[SIGNAL];
    }
    if (inputSignalNode !== null && inputSignalNode.transformFn !== void 0) {
      value = inputSignalNode.transformFn(value);
    } else if (transform !== null) {
      value = transform.call(instance, value);
    }
    if (def.setInput !== null) {
      def.setInput(instance, inputSignalNode, value, publicName, privateName);
    } else {
      applyValueToInputField(instance, inputSignalNode, privateName, value);
    }
  } finally {
    setActiveConsumer(prevConsumer);
  }
}
var RendererStyleFlags2;
(function(RendererStyleFlags22) {
  RendererStyleFlags22[RendererStyleFlags22["Important"] = 1] = "Important";
  RendererStyleFlags22[RendererStyleFlags22["DashCase"] = 2] = "DashCase";
})(RendererStyleFlags2 || (RendererStyleFlags2 = {}));
var _icuContainerIterate;
function icuContainerIterate(tIcuContainerNode, lView) {
  return _icuContainerIterate(tIcuContainerNode, lView);
}
function ensureIcuContainerVisitorLoaded(loader) {
  if (_icuContainerIterate === void 0) {
    _icuContainerIterate = loader();
  }
}
function applyToElementOrContainer(action, renderer, parent, lNodeToHandle, beforeNode) {
  if (lNodeToHandle != null) {
    let lContainer;
    let isComponent2 = false;
    if (isLContainer(lNodeToHandle)) {
      lContainer = lNodeToHandle;
    } else if (isLView(lNodeToHandle)) {
      isComponent2 = true;
      ngDevMode && assertDefined(lNodeToHandle[HOST], "HOST must be defined for a component LView");
      lNodeToHandle = lNodeToHandle[HOST];
    }
    const rNode = unwrapRNode(lNodeToHandle);
    if (action === 0 && parent !== null) {
      if (beforeNode == null) {
        nativeAppendChild(renderer, parent, rNode);
      } else {
        nativeInsertBefore(renderer, parent, rNode, beforeNode || null, true);
      }
    } else if (action === 1 && parent !== null) {
      nativeInsertBefore(renderer, parent, rNode, beforeNode || null, true);
    } else if (action === 2) {
      nativeRemoveNode(renderer, rNode, isComponent2);
    } else if (action === 3) {
      renderer.destroyNode(rNode);
    }
    if (lContainer != null) {
      applyContainer(renderer, action, lContainer, parent, beforeNode);
    }
  }
}
function removeViewFromDOM(tView, lView) {
  detachViewFromDOM(tView, lView);
  lView[HOST] = null;
  lView[T_HOST] = null;
}
function addViewToDOM(tView, parentTNode, renderer, lView, parentNativeNode, beforeNode) {
  lView[HOST] = parentNativeNode;
  lView[T_HOST] = parentTNode;
  applyView(tView, lView, renderer, 1, parentNativeNode, beforeNode);
}
function detachViewFromDOM(tView, lView) {
  lView[ENVIRONMENT].changeDetectionScheduler?.notify(
    9
    /* NotificationSource.ViewDetachedFromDOM */
  );
  applyView(tView, lView, lView[RENDERER], 2, null, null);
}
function destroyViewTree(rootView) {
  let lViewOrLContainer = rootView[CHILD_HEAD];
  if (!lViewOrLContainer) {
    return cleanUpView(rootView[TVIEW], rootView);
  }
  while (lViewOrLContainer) {
    let next = null;
    if (isLView(lViewOrLContainer)) {
      next = lViewOrLContainer[CHILD_HEAD];
    } else {
      ngDevMode && assertLContainer(lViewOrLContainer);
      const firstView = lViewOrLContainer[CONTAINER_HEADER_OFFSET];
      if (firstView)
        next = firstView;
    }
    if (!next) {
      while (lViewOrLContainer && !lViewOrLContainer[NEXT] && lViewOrLContainer !== rootView) {
        if (isLView(lViewOrLContainer)) {
          cleanUpView(lViewOrLContainer[TVIEW], lViewOrLContainer);
        }
        lViewOrLContainer = lViewOrLContainer[PARENT];
      }
      if (lViewOrLContainer === null)
        lViewOrLContainer = rootView;
      if (isLView(lViewOrLContainer)) {
        cleanUpView(lViewOrLContainer[TVIEW], lViewOrLContainer);
      }
      next = lViewOrLContainer && lViewOrLContainer[NEXT];
    }
    lViewOrLContainer = next;
  }
}
function detachMovedView(declarationContainer, lView) {
  ngDevMode && assertLContainer(declarationContainer);
  ngDevMode && assertDefined(declarationContainer[MOVED_VIEWS], "A projected view should belong to a non-empty projected views collection");
  const movedViews = declarationContainer[MOVED_VIEWS];
  const declarationViewIndex = movedViews.indexOf(lView);
  movedViews.splice(declarationViewIndex, 1);
}
function destroyLView(tView, lView) {
  if (isDestroyed(lView)) {
    return;
  }
  const renderer = lView[RENDERER];
  if (renderer.destroyNode) {
    applyView(tView, lView, renderer, 3, null, null);
  }
  destroyViewTree(lView);
}
function cleanUpView(tView, lView) {
  if (isDestroyed(lView)) {
    return;
  }
  const prevConsumer = setActiveConsumer(null);
  try {
    lView[FLAGS] &= ~128;
    lView[FLAGS] |= 256;
    lView[REACTIVE_TEMPLATE_CONSUMER] && consumerDestroy(lView[REACTIVE_TEMPLATE_CONSUMER]);
    executeOnDestroys(tView, lView);
    processCleanups(tView, lView);
    if (lView[TVIEW].type === 1) {
      lView[RENDERER].destroy();
    }
    const declarationContainer = lView[DECLARATION_LCONTAINER];
    if (declarationContainer !== null && isLContainer(lView[PARENT])) {
      if (declarationContainer !== lView[PARENT]) {
        detachMovedView(declarationContainer, lView);
      }
      const lQueries = lView[QUERIES];
      if (lQueries !== null) {
        lQueries.detachView(tView);
      }
    }
    unregisterLView(lView);
  } finally {
    setActiveConsumer(prevConsumer);
  }
}
function processCleanups(tView, lView) {
  ngDevMode && assertNotReactive(processCleanups.name);
  const tCleanup = tView.cleanup;
  const lCleanup = lView[CLEANUP];
  if (tCleanup !== null) {
    for (let i = 0; i < tCleanup.length - 1; i += 2) {
      if (typeof tCleanup[i] === "string") {
        const targetIdx = tCleanup[i + 3];
        ngDevMode && assertNumber(targetIdx, "cleanup target must be a number");
        if (targetIdx >= 0) {
          lCleanup[targetIdx]();
        } else {
          lCleanup[-targetIdx].unsubscribe();
        }
        i += 2;
      } else {
        const context2 = lCleanup[tCleanup[i + 1]];
        tCleanup[i].call(context2);
      }
    }
  }
  if (lCleanup !== null) {
    lView[CLEANUP] = null;
  }
  const destroyHooks = lView[ON_DESTROY_HOOKS];
  if (destroyHooks !== null) {
    lView[ON_DESTROY_HOOKS] = null;
    for (let i = 0; i < destroyHooks.length; i++) {
      const destroyHooksFn = destroyHooks[i];
      ngDevMode && assertFunction(destroyHooksFn, "Expecting destroy hook to be a function.");
      destroyHooksFn();
    }
  }
  const effects = lView[EFFECTS];
  if (effects !== null) {
    lView[EFFECTS] = null;
    for (const effect2 of effects) {
      effect2.destroy();
    }
  }
}
function executeOnDestroys(tView, lView) {
  ngDevMode && assertNotReactive(executeOnDestroys.name);
  let destroyHooks;
  if (tView != null && (destroyHooks = tView.destroyHooks) != null) {
    for (let i = 0; i < destroyHooks.length; i += 2) {
      const context2 = lView[destroyHooks[i]];
      if (!(context2 instanceof NodeInjectorFactory)) {
        const toCall = destroyHooks[i + 1];
        if (Array.isArray(toCall)) {
          for (let j = 0; j < toCall.length; j += 2) {
            const callContext = context2[toCall[j]];
            const hook = toCall[j + 1];
            profiler(4, callContext, hook);
            try {
              hook.call(callContext);
            } finally {
              profiler(5, callContext, hook);
            }
          }
        } else {
          profiler(4, context2, toCall);
          try {
            toCall.call(context2);
          } finally {
            profiler(5, context2, toCall);
          }
        }
      }
    }
  }
}
function getParentRElement(tView, tNode, lView) {
  return getClosestRElement(tView, tNode.parent, lView);
}
function getClosestRElement(tView, tNode, lView) {
  let parentTNode = tNode;
  while (parentTNode !== null && parentTNode.type & (8 | 32 | 128)) {
    tNode = parentTNode;
    parentTNode = tNode.parent;
  }
  if (parentTNode === null) {
    return lView[HOST];
  } else {
    ngDevMode && assertTNodeType(
      parentTNode,
      3 | 4
      /* TNodeType.Container */
    );
    if (isComponentHost(parentTNode)) {
      ngDevMode && assertTNodeForLView(parentTNode, lView);
      const { encapsulation } = tView.data[parentTNode.directiveStart + parentTNode.componentOffset];
      if (encapsulation === ViewEncapsulation.None || encapsulation === ViewEncapsulation.Emulated) {
        return null;
      }
    }
    return getNativeByTNode(parentTNode, lView);
  }
}
function getInsertInFrontOfRNode(parentTNode, currentTNode, lView) {
  return _getInsertInFrontOfRNodeWithI18n(parentTNode, currentTNode, lView);
}
function getInsertInFrontOfRNodeWithNoI18n(parentTNode, currentTNode, lView) {
  if (parentTNode.type & (8 | 32)) {
    return getNativeByTNode(parentTNode, lView);
  }
  return null;
}
var _getInsertInFrontOfRNodeWithI18n = getInsertInFrontOfRNodeWithNoI18n;
var _processI18nInsertBefore;
function setI18nHandling(getInsertInFrontOfRNodeWithI18n2, processI18nInsertBefore2) {
  _getInsertInFrontOfRNodeWithI18n = getInsertInFrontOfRNodeWithI18n2;
  _processI18nInsertBefore = processI18nInsertBefore2;
}
function appendChild(tView, lView, childRNode, childTNode) {
  const parentRNode = getParentRElement(tView, childTNode, lView);
  const renderer = lView[RENDERER];
  const parentTNode = childTNode.parent || lView[T_HOST];
  const anchorNode = getInsertInFrontOfRNode(parentTNode, childTNode, lView);
  if (parentRNode != null) {
    if (Array.isArray(childRNode)) {
      for (let i = 0; i < childRNode.length; i++) {
        nativeAppendOrInsertBefore(renderer, parentRNode, childRNode[i], anchorNode, false);
      }
    } else {
      nativeAppendOrInsertBefore(renderer, parentRNode, childRNode, anchorNode, false);
    }
  }
  _processI18nInsertBefore !== void 0 && _processI18nInsertBefore(renderer, childTNode, lView, childRNode, parentRNode);
}
function getFirstNativeNode(lView, tNode) {
  if (tNode !== null) {
    ngDevMode && assertTNodeType(
      tNode,
      3 | 12 | 32 | 16 | 128
      /* TNodeType.LetDeclaration */
    );
    const tNodeType = tNode.type;
    if (tNodeType & 3) {
      return getNativeByTNode(tNode, lView);
    } else if (tNodeType & 4) {
      return getBeforeNodeForView(-1, lView[tNode.index]);
    } else if (tNodeType & 8) {
      const elIcuContainerChild = tNode.child;
      if (elIcuContainerChild !== null) {
        return getFirstNativeNode(lView, elIcuContainerChild);
      } else {
        const rNodeOrLContainer = lView[tNode.index];
        if (isLContainer(rNodeOrLContainer)) {
          return getBeforeNodeForView(-1, rNodeOrLContainer);
        } else {
          return unwrapRNode(rNodeOrLContainer);
        }
      }
    } else if (tNodeType & 128) {
      return getFirstNativeNode(lView, tNode.next);
    } else if (tNodeType & 32) {
      let nextRNode = icuContainerIterate(tNode, lView);
      let rNode = nextRNode();
      return rNode || unwrapRNode(lView[tNode.index]);
    } else {
      const projectionNodes = getProjectionNodes(lView, tNode);
      if (projectionNodes !== null) {
        if (Array.isArray(projectionNodes)) {
          return projectionNodes[0];
        }
        const parentView = getLViewParent(lView[DECLARATION_COMPONENT_VIEW]);
        ngDevMode && assertParentView(parentView);
        return getFirstNativeNode(parentView, projectionNodes);
      } else {
        return getFirstNativeNode(lView, tNode.next);
      }
    }
  }
  return null;
}
function getProjectionNodes(lView, tNode) {
  if (tNode !== null) {
    const componentView = lView[DECLARATION_COMPONENT_VIEW];
    const componentHost = componentView[T_HOST];
    const slotIdx = tNode.projection;
    ngDevMode && assertProjectionSlots(lView);
    return componentHost.projection[slotIdx];
  }
  return null;
}
function getBeforeNodeForView(viewIndexInContainer, lContainer) {
  const nextViewIndex = CONTAINER_HEADER_OFFSET + viewIndexInContainer + 1;
  if (nextViewIndex < lContainer.length) {
    const lView = lContainer[nextViewIndex];
    const firstTNodeOfView = lView[TVIEW].firstChild;
    if (firstTNodeOfView !== null) {
      return getFirstNativeNode(lView, firstTNodeOfView);
    }
  }
  return lContainer[NATIVE];
}
function applyNodes(renderer, action, tNode, lView, parentRElement, beforeNode, isProjection) {
  while (tNode != null) {
    ngDevMode && assertTNodeForLView(tNode, lView);
    if (tNode.type === 128) {
      tNode = tNode.next;
      continue;
    }
    ngDevMode && assertTNodeType(
      tNode,
      3 | 12 | 16 | 32
      /* TNodeType.Icu */
    );
    const rawSlotValue = lView[tNode.index];
    const tNodeType = tNode.type;
    if (isProjection) {
      if (action === 0) {
        rawSlotValue && attachPatchData(unwrapRNode(rawSlotValue), lView);
        tNode.flags |= 2;
      }
    }
    if (!isDetachedByI18n(tNode)) {
      if (tNodeType & 8) {
        applyNodes(renderer, action, tNode.child, lView, parentRElement, beforeNode, false);
        applyToElementOrContainer(action, renderer, parentRElement, rawSlotValue, beforeNode);
      } else if (tNodeType & 32) {
        const nextRNode = icuContainerIterate(tNode, lView);
        let rNode;
        while (rNode = nextRNode()) {
          applyToElementOrContainer(action, renderer, parentRElement, rNode, beforeNode);
        }
        applyToElementOrContainer(action, renderer, parentRElement, rawSlotValue, beforeNode);
      } else if (tNodeType & 16) {
        applyProjectionRecursive(renderer, action, lView, tNode, parentRElement, beforeNode);
      } else {
        ngDevMode && assertTNodeType(
          tNode,
          3 | 4
          /* TNodeType.Container */
        );
        applyToElementOrContainer(action, renderer, parentRElement, rawSlotValue, beforeNode);
      }
    }
    tNode = isProjection ? tNode.projectionNext : tNode.next;
  }
}
function applyView(tView, lView, renderer, action, parentRElement, beforeNode) {
  applyNodes(renderer, action, tView.firstChild, lView, parentRElement, beforeNode, false);
}
function applyProjection(tView, lView, tProjectionNode) {
  const renderer = lView[RENDERER];
  const parentRNode = getParentRElement(tView, tProjectionNode, lView);
  const parentTNode = tProjectionNode.parent || lView[T_HOST];
  let beforeNode = getInsertInFrontOfRNode(parentTNode, tProjectionNode, lView);
  applyProjectionRecursive(renderer, 0, lView, tProjectionNode, parentRNode, beforeNode);
}
function applyProjectionRecursive(renderer, action, lView, tProjectionNode, parentRElement, beforeNode) {
  const componentLView = lView[DECLARATION_COMPONENT_VIEW];
  const componentNode = componentLView[T_HOST];
  ngDevMode && assertEqual(typeof tProjectionNode.projection, "number", "expecting projection index");
  const nodeToProjectOrRNodes = componentNode.projection[tProjectionNode.projection];
  if (Array.isArray(nodeToProjectOrRNodes)) {
    for (let i = 0; i < nodeToProjectOrRNodes.length; i++) {
      const rNode = nodeToProjectOrRNodes[i];
      applyToElementOrContainer(action, renderer, parentRElement, rNode, beforeNode);
    }
  } else {
    let nodeToProject = nodeToProjectOrRNodes;
    const projectedComponentLView = componentLView[PARENT];
    if (hasInSkipHydrationBlockFlag(tProjectionNode)) {
      nodeToProject.flags |= 128;
    }
    applyNodes(renderer, action, nodeToProject, projectedComponentLView, parentRElement, beforeNode, true);
  }
}
function applyContainer(renderer, action, lContainer, parentRElement, beforeNode) {
  ngDevMode && assertLContainer(lContainer);
  const anchor = lContainer[NATIVE];
  const native = unwrapRNode(lContainer);
  if (anchor !== native) {
    applyToElementOrContainer(action, renderer, parentRElement, anchor, beforeNode);
  }
  for (let i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) {
    const lView = lContainer[i];
    applyView(lView[TVIEW], lView, renderer, action, parentRElement, anchor);
  }
}
function applyStyling(renderer, isClassBased, rNode, prop, value) {
  if (isClassBased) {
    if (!value) {
      renderer.removeClass(rNode, prop);
    } else {
      renderer.addClass(rNode, prop);
    }
  } else {
    let flags = prop.indexOf("-") === -1 ? void 0 : RendererStyleFlags2.DashCase;
    if (value == null) {
      renderer.removeStyle(rNode, prop, flags);
    } else {
      const isImportant = typeof value === "string" ? value.endsWith("!important") : false;
      if (isImportant) {
        value = value.slice(0, -10);
        flags |= RendererStyleFlags2.Important;
      }
      renderer.setStyle(rNode, prop, value, flags);
    }
  }
}
function executeTemplate(tView, lView, templateFn, rf, context2) {
  const prevSelectedIndex = getSelectedIndex();
  const isUpdatePhase = rf & 2;
  try {
    setSelectedIndex(-1);
    if (isUpdatePhase && lView.length > HEADER_OFFSET) {
      selectIndexInternal(tView, lView, HEADER_OFFSET, !!ngDevMode && isInCheckNoChangesMode());
    }
    const preHookType = isUpdatePhase ? 2 : 0;
    profiler(preHookType, context2, templateFn);
    templateFn(rf, context2);
  } finally {
    setSelectedIndex(prevSelectedIndex);
    const postHookType = isUpdatePhase ? 3 : 1;
    profiler(postHookType, context2, templateFn);
  }
}
function createDirectivesInstances(tView, lView, tNode) {
  instantiateAllDirectives(tView, lView, tNode);
  if ((tNode.flags & 64) === 64) {
    invokeDirectivesHostBindings(tView, lView, tNode);
  }
}
function saveResolvedLocalsInData(viewData, tNode, localRefExtractor = getNativeByTNode) {
  const localNames = tNode.localNames;
  if (localNames !== null) {
    let localIndex = tNode.index + 1;
    for (let i = 0; i < localNames.length; i += 2) {
      const index = localNames[i + 1];
      const value = index === -1 ? localRefExtractor(tNode, viewData) : viewData[index];
      viewData[localIndex++] = value;
    }
  }
}
function locateHostElement(renderer, elementOrSelector, encapsulation, injector) {
  const preserveHostContent = injector.get(PRESERVE_HOST_CONTENT, PRESERVE_HOST_CONTENT_DEFAULT);
  const preserveContent = preserveHostContent || encapsulation === ViewEncapsulation.ShadowDom;
  const rootElement = renderer.selectRootElement(elementOrSelector, preserveContent);
  applyRootElementTransform(rootElement);
  return rootElement;
}
function applyRootElementTransform(rootElement) {
  _applyRootElementTransformImpl(rootElement);
}
var _applyRootElementTransformImpl = () => null;
function mapPropName(name2) {
  if (name2 === "class")
    return "className";
  if (name2 === "for")
    return "htmlFor";
  if (name2 === "formaction")
    return "formAction";
  if (name2 === "innerHtml")
    return "innerHTML";
  if (name2 === "readonly")
    return "readOnly";
  if (name2 === "tabindex")
    return "tabIndex";
  return name2;
}
function setPropertyAndInputs(tNode, lView, propName, value, renderer, sanitizer) {
  ngDevMode && assertNotSame(value, NO_CHANGE, "Incoming value should never be NO_CHANGE.");
  const tView = lView[TVIEW];
  const hasSetInput = setAllInputsForProperty(tNode, tView, lView, propName, value);
  if (hasSetInput) {
    isComponentHost(tNode) && markDirtyIfOnPush(lView, tNode.index);
    ngDevMode && setNgReflectProperties(lView, tView, tNode, propName, value);
    return;
  }
  if (tNode.type & 3) {
    propName = mapPropName(propName);
  }
  setDomProperty(tNode, lView, propName, value, renderer, sanitizer);
}
function setDomProperty(tNode, lView, propName, value, renderer, sanitizer) {
  if (tNode.type & 3) {
    const element = getNativeByTNode(tNode, lView);
    if (ngDevMode) {
      validateAgainstEventProperties(propName);
      if (!isPropertyValid(element, propName, tNode.value, lView[TVIEW].schemas)) {
        handleUnknownPropertyError(propName, tNode.value, tNode.type, lView);
      }
    }
    value = sanitizer != null ? sanitizer(value, tNode.value || "", propName) : value;
    renderer.setProperty(element, propName, value);
  } else if (tNode.type & 12) {
    if (ngDevMode && !matchingSchemas(lView[TVIEW].schemas, tNode.value)) {
      handleUnknownPropertyError(propName, tNode.value, tNode.type, lView);
    }
  }
}
function markDirtyIfOnPush(lView, viewIndex) {
  ngDevMode && assertLView(lView);
  const childComponentLView = getComponentLViewByIndex(viewIndex, lView);
  if (!(childComponentLView[FLAGS] & 16)) {
    childComponentLView[FLAGS] |= 64;
  }
}
function setNgReflectProperty(lView, tNode, attrName, value) {
  const environment = lView[ENVIRONMENT];
  if (!environment.ngReflect) {
    return;
  }
  const element = getNativeByTNode(tNode, lView);
  const renderer = lView[RENDERER];
  attrName = normalizeDebugBindingName(attrName);
  const debugValue = normalizeDebugBindingValue(value);
  if (tNode.type & 3) {
    if (value == null) {
      renderer.removeAttribute(element, attrName);
    } else {
      renderer.setAttribute(element, attrName, debugValue);
    }
  } else {
    const textContent = escapeCommentText(`bindings=${JSON.stringify({ [attrName]: debugValue }, null, 2)}`);
    renderer.setValue(element, textContent);
  }
}
function setNgReflectProperties(lView, tView, tNode, publicName, value) {
  const environment = lView[ENVIRONMENT];
  if (!environment.ngReflect || !(tNode.type & (3 | 4))) {
    return;
  }
  const inputConfig = tNode.inputs?.[publicName];
  const hostInputConfig = tNode.hostDirectiveInputs?.[publicName];
  if (hostInputConfig) {
    for (let i = 0; i < hostInputConfig.length; i += 2) {
      const index = hostInputConfig[i];
      const publicName2 = hostInputConfig[i + 1];
      const def = tView.data[index];
      setNgReflectProperty(lView, tNode, def.inputs[publicName2][0], value);
    }
  }
  if (inputConfig) {
    for (const index of inputConfig) {
      const def = tView.data[index];
      setNgReflectProperty(lView, tNode, def.inputs[publicName][0], value);
    }
  }
}
function instantiateAllDirectives(tView, lView, tNode) {
  const start = tNode.directiveStart;
  const end = tNode.directiveEnd;
  if (isComponentHost(tNode)) {
    ngDevMode && assertTNodeType(
      tNode,
      3
      /* TNodeType.AnyRNode */
    );
    createComponentLView(lView, tNode, tView.data[start + tNode.componentOffset]);
  }
  if (!tView.firstCreatePass) {
    getOrCreateNodeInjectorForNode(tNode, lView);
  }
  const initialInputs = tNode.initialInputs;
  for (let i = start; i < end; i++) {
    const def = tView.data[i];
    const directive = getNodeInjectable(lView, tView, i, tNode);
    attachPatchData(directive, lView);
    if (initialInputs !== null) {
      setInputsFromAttrs(lView, i - start, directive, def, tNode, initialInputs);
    }
    if (isComponentDef(def)) {
      const componentView = getComponentLViewByIndex(tNode.index, lView);
      componentView[CONTEXT] = getNodeInjectable(lView, tView, i, tNode);
    }
  }
}
function invokeDirectivesHostBindings(tView, lView, tNode) {
  const start = tNode.directiveStart;
  const end = tNode.directiveEnd;
  const elementIndex = tNode.index;
  const currentDirectiveIndex = getCurrentDirectiveIndex();
  try {
    setSelectedIndex(elementIndex);
    for (let dirIndex = start; dirIndex < end; dirIndex++) {
      const def = tView.data[dirIndex];
      const directive = lView[dirIndex];
      setCurrentDirectiveIndex(dirIndex);
      if (def.hostBindings !== null || def.hostVars !== 0 || def.hostAttrs !== null) {
        invokeHostBindingsInCreationMode(def, directive);
      }
    }
  } finally {
    setSelectedIndex(-1);
    setCurrentDirectiveIndex(currentDirectiveIndex);
  }
}
function invokeHostBindingsInCreationMode(def, directive) {
  if (def.hostBindings !== null) {
    def.hostBindings(1, directive);
  }
}
function findDirectiveDefMatches(tView, tNode) {
  ngDevMode && assertFirstCreatePass(tView);
  ngDevMode && assertTNodeType(
    tNode,
    3 | 12
    /* TNodeType.AnyContainer */
  );
  const registry = tView.directiveRegistry;
  let matches = null;
  if (registry) {
    for (let i = 0; i < registry.length; i++) {
      const def = registry[i];
      if (isNodeMatchingSelectorList(
        tNode,
        def.selectors,
        /* isProjectionMode */
        false
      )) {
        matches ??= [];
        if (isComponentDef(def)) {
          if (ngDevMode) {
            assertTNodeType(tNode, 2, `"${tNode.value}" tags cannot be used as component hosts. Please use a different tag to activate the ${stringify(def.type)} component.`);
            if (matches.length && isComponentDef(matches[0])) {
              throwMultipleComponentError(tNode, matches.find(isComponentDef).type, def.type);
            }
          }
          matches.unshift(def);
        } else {
          matches.push(def);
        }
      }
    }
  }
  return matches;
}
function elementAttributeInternal(tNode, lView, name2, value, sanitizer, namespace) {
  if (ngDevMode) {
    assertNotSame(value, NO_CHANGE, "Incoming value should never be NO_CHANGE.");
    validateAgainstEventAttributes(name2);
    assertTNodeType(tNode, 2, `Attempted to set attribute \`${name2}\` on a container node. Host bindings are not valid on ng-container or ng-template.`);
  }
  const element = getNativeByTNode(tNode, lView);
  setElementAttribute(lView[RENDERER], element, namespace, tNode.value, name2, value, sanitizer);
}
function setElementAttribute(renderer, element, namespace, tagName, name2, value, sanitizer) {
  if (value == null) {
    renderer.removeAttribute(element, name2, namespace);
  } else {
    const strValue = sanitizer == null ? renderStringify(value) : sanitizer(value, tagName || "", name2);
    renderer.setAttribute(element, name2, strValue, namespace);
  }
}
function setInputsFromAttrs(lView, directiveIndex, instance, def, tNode, initialInputData) {
  const initialInputs = initialInputData[directiveIndex];
  if (initialInputs !== null) {
    for (let i = 0; i < initialInputs.length; i += 2) {
      const lookupName = initialInputs[i];
      const value = initialInputs[i + 1];
      writeToDirectiveInput(def, instance, lookupName, value);
      if (ngDevMode) {
        setNgReflectProperty(lView, tNode, def.inputs[lookupName][0], value);
      }
    }
  }
}
function elementLikeStartShared(tNode, lView, index, name2, locateOrCreateNativeNode) {
  const adjustedIndex = HEADER_OFFSET + index;
  const tView = lView[TVIEW];
  const native = locateOrCreateNativeNode(tView, lView, tNode, name2, index);
  lView[adjustedIndex] = native;
  setCurrentTNode(tNode, true);
  const isElement = tNode.type === 2;
  if (isElement) {
    setupStaticAttributes(lView[RENDERER], native, tNode);
    if (getElementDepthCount() === 0 || isDirectiveHost(tNode)) {
      attachPatchData(native, lView);
    }
    increaseElementDepthCount();
  } else {
    attachPatchData(native, lView);
  }
  if (wasLastNodeCreated() && (!isElement || !isDetachedByI18n(tNode))) {
    appendChild(tView, lView, native, tNode);
  }
  return tNode;
}
function elementLikeEndShared(tNode) {
  let currentTNode = tNode;
  if (isCurrentTNodeParent()) {
    setCurrentTNodeAsNotParent();
  } else {
    ngDevMode && assertHasParent(getCurrentTNode());
    currentTNode = currentTNode.parent;
    setCurrentTNode(currentTNode, false);
  }
  return currentTNode;
}
function storePropertyBindingMetadata(tData, tNode, propertyName, bindingIndex, ...interpolationParts) {
  if (tData[bindingIndex] === null) {
    if (!tNode.inputs?.[propertyName] && !tNode.hostDirectiveInputs?.[propertyName]) {
      const propBindingIdxs = tNode.propertyBindings || (tNode.propertyBindings = []);
      propBindingIdxs.push(bindingIndex);
      let bindingMetadata = propertyName;
      if (interpolationParts.length > 0) {
        bindingMetadata += INTERPOLATION_DELIMITER + interpolationParts.join(INTERPOLATION_DELIMITER);
      }
      tData[bindingIndex] = bindingMetadata;
    }
  }
}
function loadComponentRenderer(currentDef, tNode, lView) {
  if (currentDef === null || isComponentDef(currentDef)) {
    lView = unwrapLView(lView[tNode.index]);
  }
  return lView[RENDERER];
}
function handleUncaughtError(lView, error) {
  const injector = lView[INJECTOR];
  if (!injector) {
    return;
  }
  const errorHandler2 = injector.get(INTERNAL_APPLICATION_ERROR_HANDLER, null);
  errorHandler2?.(error);
}
function setAllInputsForProperty(tNode, tView, lView, publicName, value) {
  const inputs = tNode.inputs?.[publicName];
  const hostDirectiveInputs = tNode.hostDirectiveInputs?.[publicName];
  let hasMatch = false;
  if (hostDirectiveInputs) {
    for (let i = 0; i < hostDirectiveInputs.length; i += 2) {
      const index = hostDirectiveInputs[i];
      ngDevMode && assertIndexInRange(lView, index);
      const publicName2 = hostDirectiveInputs[i + 1];
      const def = tView.data[index];
      writeToDirectiveInput(def, lView[index], publicName2, value);
      hasMatch = true;
    }
  }
  if (inputs) {
    for (const index of inputs) {
      ngDevMode && assertIndexInRange(lView, index);
      const instance = lView[index];
      const def = tView.data[index];
      writeToDirectiveInput(def, instance, publicName, value);
      hasMatch = true;
    }
  }
  return hasMatch;
}
function renderComponent(hostLView, componentHostIdx) {
  ngDevMode && assertEqual(isCreationMode(hostLView), true, "Should be run in creation mode");
  const componentView = getComponentLViewByIndex(componentHostIdx, hostLView);
  const componentTView = componentView[TVIEW];
  syncViewWithBlueprint(componentTView, componentView);
  const hostRNode = componentView[HOST];
  if (hostRNode !== null && componentView[HYDRATION] === null) {
    componentView[HYDRATION] = retrieveHydrationInfo(hostRNode, componentView[INJECTOR]);
  }
  profiler(
    18
    /* ProfilerEvent.ComponentStart */
  );
  renderView(componentTView, componentView, componentView[CONTEXT]);
  profiler(19, componentView[CONTEXT]);
}
function syncViewWithBlueprint(tView, lView) {
  for (let i = lView.length; i < tView.blueprint.length; i++) {
    lView.push(tView.blueprint[i]);
  }
}
function renderView(tView, lView, context2) {
  ngDevMode && assertEqual(isCreationMode(lView), true, "Should be run in creation mode");
  ngDevMode && assertNotReactive(renderView.name);
  enterView(lView);
  try {
    const viewQuery = tView.viewQuery;
    if (viewQuery !== null) {
      executeViewQueryFn(1, viewQuery, context2);
    }
    const templateFn = tView.template;
    if (templateFn !== null) {
      executeTemplate(tView, lView, templateFn, 1, context2);
    }
    if (tView.firstCreatePass) {
      tView.firstCreatePass = false;
    }
    lView[QUERIES]?.finishViewCreation(tView);
    if (tView.staticContentQueries) {
      refreshContentQueries(tView, lView);
    }
    if (tView.staticViewQueries) {
      executeViewQueryFn(2, tView.viewQuery, context2);
    }
    const components = tView.components;
    if (components !== null) {
      renderChildComponents(lView, components);
    }
  } catch (error) {
    if (tView.firstCreatePass) {
      tView.incompleteFirstPass = true;
      tView.firstCreatePass = false;
    }
    throw error;
  } finally {
    lView[FLAGS] &= ~4;
    leaveView();
  }
}
function renderChildComponents(hostLView, components) {
  for (let i = 0; i < components.length; i++) {
    renderComponent(hostLView, components[i]);
  }
}
function createAndRenderEmbeddedLView(declarationLView, templateTNode, context2, options) {
  const prevConsumer = setActiveConsumer(null);
  try {
    const embeddedTView = templateTNode.tView;
    ngDevMode && assertDefined(embeddedTView, "TView must be defined for a template node.");
    ngDevMode && assertTNodeForLView(templateTNode, declarationLView);
    const isSignalView = declarationLView[FLAGS] & 4096;
    const viewFlags = isSignalView ? 4096 : 16;
    const embeddedLView = createLView(declarationLView, embeddedTView, context2, viewFlags, null, templateTNode, null, null, options?.injector ?? null, options?.embeddedViewInjector ?? null, options?.dehydratedView ?? null);
    const declarationLContainer = declarationLView[templateTNode.index];
    ngDevMode && assertLContainer(declarationLContainer);
    embeddedLView[DECLARATION_LCONTAINER] = declarationLContainer;
    const declarationViewLQueries = declarationLView[QUERIES];
    if (declarationViewLQueries !== null) {
      embeddedLView[QUERIES] = declarationViewLQueries.createEmbeddedView(embeddedTView);
    }
    renderView(embeddedTView, embeddedLView, context2);
    return embeddedLView;
  } finally {
    setActiveConsumer(prevConsumer);
  }
}
function shouldAddViewToDom(tNode, dehydratedView) {
  return !dehydratedView || dehydratedView.firstChild === null || hasInSkipHydrationBlockFlag(tNode);
}
var USE_EXHAUSTIVE_CHECK_NO_CHANGES_DEFAULT = false;
var UseExhaustiveCheckNoChanges = new InjectionToken(ngDevMode ? "exhaustive checkNoChanges" : "");
function collectNativeNodes(tView, lView, tNode, result, isProjection = false) {
  while (tNode !== null) {
    if (tNode.type === 128) {
      tNode = isProjection ? tNode.projectionNext : tNode.next;
      continue;
    }
    ngDevMode && assertTNodeType(
      tNode,
      3 | 12 | 16 | 32
      /* TNodeType.Icu */
    );
    const lNode = lView[tNode.index];
    if (lNode !== null) {
      result.push(unwrapRNode(lNode));
    }
    if (isLContainer(lNode)) {
      collectNativeNodesInLContainer(lNode, result);
    }
    const tNodeType = tNode.type;
    if (tNodeType & 8) {
      collectNativeNodes(tView, lView, tNode.child, result);
    } else if (tNodeType & 32) {
      const nextRNode = icuContainerIterate(tNode, lView);
      let rNode;
      while (rNode = nextRNode()) {
        result.push(rNode);
      }
    } else if (tNodeType & 16) {
      const nodesInSlot = getProjectionNodes(lView, tNode);
      if (Array.isArray(nodesInSlot)) {
        result.push(...nodesInSlot);
      } else {
        const parentView = getLViewParent(lView[DECLARATION_COMPONENT_VIEW]);
        ngDevMode && assertParentView(parentView);
        collectNativeNodes(parentView[TVIEW], parentView, nodesInSlot, result, true);
      }
    }
    tNode = isProjection ? tNode.projectionNext : tNode.next;
  }
  return result;
}
function collectNativeNodesInLContainer(lContainer, result) {
  for (let i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) {
    const lViewInAContainer = lContainer[i];
    const lViewFirstChildTNode = lViewInAContainer[TVIEW].firstChild;
    if (lViewFirstChildTNode !== null) {
      collectNativeNodes(lViewInAContainer[TVIEW], lViewInAContainer, lViewFirstChildTNode, result);
    }
  }
  if (lContainer[NATIVE] !== lContainer[HOST]) {
    result.push(lContainer[NATIVE]);
  }
}
function addAfterRenderSequencesForView(lView) {
  if (lView[AFTER_RENDER_SEQUENCES_TO_ADD] !== null) {
    for (const sequence of lView[AFTER_RENDER_SEQUENCES_TO_ADD]) {
      sequence.impl.addSequence(sequence);
    }
    lView[AFTER_RENDER_SEQUENCES_TO_ADD].length = 0;
  }
}
var freeConsumers = [];
function getOrBorrowReactiveLViewConsumer(lView) {
  return lView[REACTIVE_TEMPLATE_CONSUMER] ?? borrowReactiveLViewConsumer(lView);
}
function borrowReactiveLViewConsumer(lView) {
  const consumer = freeConsumers.pop() ?? Object.create(REACTIVE_LVIEW_CONSUMER_NODE);
  consumer.lView = lView;
  return consumer;
}
function maybeReturnReactiveLViewConsumer(consumer) {
  if (consumer.lView[REACTIVE_TEMPLATE_CONSUMER] === consumer) {
    return;
  }
  consumer.lView = null;
  freeConsumers.push(consumer);
}
var REACTIVE_LVIEW_CONSUMER_NODE = __spreadProps(__spreadValues({}, REACTIVE_NODE), {
  consumerIsAlwaysLive: true,
  kind: "template",
  consumerMarkedDirty: (node) => {
    markAncestorsForTraversal(node.lView);
  },
  consumerOnSignalRead() {
    this.lView[REACTIVE_TEMPLATE_CONSUMER] = this;
  }
});
function getOrCreateTemporaryConsumer(lView) {
  const consumer = lView[REACTIVE_TEMPLATE_CONSUMER] ?? Object.create(TEMPORARY_CONSUMER_NODE);
  consumer.lView = lView;
  return consumer;
}
var TEMPORARY_CONSUMER_NODE = __spreadProps(__spreadValues({}, REACTIVE_NODE), {
  consumerIsAlwaysLive: true,
  kind: "template",
  consumerMarkedDirty: (node) => {
    let parent = getLViewParent(node.lView);
    while (parent && !viewShouldHaveReactiveConsumer(parent[TVIEW])) {
      parent = getLViewParent(parent);
    }
    if (!parent) {
      return;
    }
    markViewForRefresh(parent);
  },
  consumerOnSignalRead() {
    this.lView[REACTIVE_TEMPLATE_CONSUMER] = this;
  }
});
function viewShouldHaveReactiveConsumer(tView) {
  return tView.type !== 2;
}
function isReactiveLViewConsumer(node) {
  return node.kind === "template";
}
function runEffectsInView(view) {
  if (view[EFFECTS] === null) {
    return;
  }
  let tryFlushEffects = true;
  while (tryFlushEffects) {
    let foundDirtyEffect = false;
    for (const effect2 of view[EFFECTS]) {
      if (!effect2.dirty) {
        continue;
      }
      foundDirtyEffect = true;
      if (effect2.zone === null || Zone.current === effect2.zone) {
        effect2.run();
      } else {
        effect2.zone.run(() => effect2.run());
      }
    }
    tryFlushEffects = foundDirtyEffect && !!(view[FLAGS] & 8192);
  }
}
var MAXIMUM_REFRESH_RERUNS$1 = 100;
function detectChangesInternal(lView, mode = 0) {
  const environment = lView[ENVIRONMENT];
  const rendererFactory = environment.rendererFactory;
  const checkNoChangesMode = !!ngDevMode && isInCheckNoChangesMode();
  if (!checkNoChangesMode) {
    rendererFactory.begin?.();
  }
  try {
    detectChangesInViewWhileDirty(lView, mode);
  } finally {
    if (!checkNoChangesMode) {
      rendererFactory.end?.();
    }
  }
}
function detectChangesInViewWhileDirty(lView, mode) {
  const lastIsRefreshingViewsValue = isRefreshingViews();
  try {
    setIsRefreshingViews(true);
    detectChangesInView(lView, mode);
    if (ngDevMode && isExhaustiveCheckNoChanges()) {
      return;
    }
    let retries = 0;
    while (requiresRefreshOrTraversal(lView)) {
      if (retries === MAXIMUM_REFRESH_RERUNS$1) {
        throw new RuntimeError(103, ngDevMode && "Infinite change detection while trying to refresh views. There may be components which each cause the other to require a refresh, causing an infinite loop.");
      }
      retries++;
      detectChangesInView(
        lView,
        1
        /* ChangeDetectionMode.Targeted */
      );
    }
  } finally {
    setIsRefreshingViews(lastIsRefreshingViewsValue);
  }
}
function checkNoChangesInternal(lView, exhaustive) {
  setIsInCheckNoChangesMode(exhaustive ? CheckNoChangesMode.Exhaustive : CheckNoChangesMode.OnlyDirtyViews);
  try {
    detectChangesInternal(lView);
  } finally {
    setIsInCheckNoChangesMode(CheckNoChangesMode.Off);
  }
}
function refreshView(tView, lView, templateFn, context2) {
  ngDevMode && assertEqual(isCreationMode(lView), false, "Should be run in update mode");
  if (isDestroyed(lView))
    return;
  const flags = lView[FLAGS];
  const isInCheckNoChangesPass = ngDevMode && isInCheckNoChangesMode();
  const isInExhaustiveCheckNoChangesPass = ngDevMode && isExhaustiveCheckNoChanges();
  enterView(lView);
  let returnConsumerToPool = true;
  let prevConsumer = null;
  let currentConsumer = null;
  if (!isInCheckNoChangesPass) {
    if (viewShouldHaveReactiveConsumer(tView)) {
      currentConsumer = getOrBorrowReactiveLViewConsumer(lView);
      prevConsumer = consumerBeforeComputation(currentConsumer);
    } else if (getActiveConsumer() === null) {
      returnConsumerToPool = false;
      currentConsumer = getOrCreateTemporaryConsumer(lView);
      prevConsumer = consumerBeforeComputation(currentConsumer);
    } else if (lView[REACTIVE_TEMPLATE_CONSUMER]) {
      consumerDestroy(lView[REACTIVE_TEMPLATE_CONSUMER]);
      lView[REACTIVE_TEMPLATE_CONSUMER] = null;
    }
  }
  try {
    resetPreOrderHookFlags(lView);
    setBindingIndex(tView.bindingStartIndex);
    if (templateFn !== null) {
      executeTemplate(tView, lView, templateFn, 2, context2);
    }
    const hooksInitPhaseCompleted = (flags & 3) === 3;
    if (!isInCheckNoChangesPass) {
      if (hooksInitPhaseCompleted) {
        const preOrderCheckHooks = tView.preOrderCheckHooks;
        if (preOrderCheckHooks !== null) {
          executeCheckHooks(lView, preOrderCheckHooks, null);
        }
      } else {
        const preOrderHooks = tView.preOrderHooks;
        if (preOrderHooks !== null) {
          executeInitAndCheckHooks(lView, preOrderHooks, 0, null);
        }
        incrementInitPhaseFlags(
          lView,
          0
          /* InitPhaseState.OnInitHooksToBeRun */
        );
      }
    }
    if (!isInExhaustiveCheckNoChangesPass) {
      markTransplantedViewsForRefresh(lView);
    }
    runEffectsInView(lView);
    detectChangesInEmbeddedViews(
      lView,
      0
      /* ChangeDetectionMode.Global */
    );
    if (tView.contentQueries !== null) {
      refreshContentQueries(tView, lView);
    }
    if (!isInCheckNoChangesPass) {
      if (hooksInitPhaseCompleted) {
        const contentCheckHooks = tView.contentCheckHooks;
        if (contentCheckHooks !== null) {
          executeCheckHooks(lView, contentCheckHooks);
        }
      } else {
        const contentHooks = tView.contentHooks;
        if (contentHooks !== null) {
          executeInitAndCheckHooks(
            lView,
            contentHooks,
            1
            /* InitPhaseState.AfterContentInitHooksToBeRun */
          );
        }
        incrementInitPhaseFlags(
          lView,
          1
          /* InitPhaseState.AfterContentInitHooksToBeRun */
        );
      }
    }
    processHostBindingOpCodes(tView, lView);
    const components = tView.components;
    if (components !== null) {
      detectChangesInChildComponents(
        lView,
        components,
        0
        /* ChangeDetectionMode.Global */
      );
    }
    const viewQuery = tView.viewQuery;
    if (viewQuery !== null) {
      executeViewQueryFn(2, viewQuery, context2);
    }
    if (!isInCheckNoChangesPass) {
      if (hooksInitPhaseCompleted) {
        const viewCheckHooks = tView.viewCheckHooks;
        if (viewCheckHooks !== null) {
          executeCheckHooks(lView, viewCheckHooks);
        }
      } else {
        const viewHooks = tView.viewHooks;
        if (viewHooks !== null) {
          executeInitAndCheckHooks(
            lView,
            viewHooks,
            2
            /* InitPhaseState.AfterViewInitHooksToBeRun */
          );
        }
        incrementInitPhaseFlags(
          lView,
          2
          /* InitPhaseState.AfterViewInitHooksToBeRun */
        );
      }
    }
    if (tView.firstUpdatePass === true) {
      tView.firstUpdatePass = false;
    }
    if (lView[EFFECTS_TO_SCHEDULE]) {
      for (const notifyEffect of lView[EFFECTS_TO_SCHEDULE]) {
        notifyEffect();
      }
      lView[EFFECTS_TO_SCHEDULE] = null;
    }
    if (!isInCheckNoChangesPass) {
      addAfterRenderSequencesForView(lView);
      lView[FLAGS] &= ~(64 | 8);
    }
  } catch (e) {
    if (!isInCheckNoChangesPass) {
      markAncestorsForTraversal(lView);
    }
    throw e;
  } finally {
    if (currentConsumer !== null) {
      consumerAfterComputation(currentConsumer, prevConsumer);
      if (returnConsumerToPool) {
        maybeReturnReactiveLViewConsumer(currentConsumer);
      }
    }
    leaveView();
  }
}
function detectChangesInEmbeddedViews(lView, mode) {
  for (let lContainer = getFirstLContainer(lView); lContainer !== null; lContainer = getNextLContainer(lContainer)) {
    for (let i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) {
      const embeddedLView = lContainer[i];
      detectChangesInViewIfAttached(embeddedLView, mode);
    }
  }
}
function markTransplantedViewsForRefresh(lView) {
  for (let lContainer = getFirstLContainer(lView); lContainer !== null; lContainer = getNextLContainer(lContainer)) {
    if (!(lContainer[FLAGS] & 2))
      continue;
    const movedViews = lContainer[MOVED_VIEWS];
    ngDevMode && assertDefined(movedViews, "Transplanted View flags set but missing MOVED_VIEWS");
    for (let i = 0; i < movedViews.length; i++) {
      const movedLView = movedViews[i];
      markViewForRefresh(movedLView);
    }
  }
}
function detectChangesInComponent(hostLView, componentHostIdx, mode) {
  ngDevMode && assertEqual(isCreationMode(hostLView), false, "Should be run in update mode");
  profiler(
    18
    /* ProfilerEvent.ComponentStart */
  );
  const componentView = getComponentLViewByIndex(componentHostIdx, hostLView);
  detectChangesInViewIfAttached(componentView, mode);
  profiler(19, componentView[CONTEXT]);
}
function detectChangesInViewIfAttached(lView, mode) {
  if (!viewAttachedToChangeDetector(lView)) {
    return;
  }
  detectChangesInView(lView, mode);
}
function detectChangesInView(lView, mode) {
  const isInCheckNoChangesPass = ngDevMode && isInCheckNoChangesMode();
  const tView = lView[TVIEW];
  const flags = lView[FLAGS];
  const consumer = lView[REACTIVE_TEMPLATE_CONSUMER];
  let shouldRefreshView = !!(mode === 0 && flags & 16);
  shouldRefreshView ||= !!(flags & 64 && mode === 0 && !isInCheckNoChangesPass);
  shouldRefreshView ||= !!(flags & 1024);
  shouldRefreshView ||= !!(consumer?.dirty && consumerPollProducersForChange(consumer));
  shouldRefreshView ||= !!(ngDevMode && isExhaustiveCheckNoChanges());
  if (consumer) {
    consumer.dirty = false;
  }
  lView[FLAGS] &= ~(8192 | 1024);
  if (shouldRefreshView) {
    refreshView(tView, lView, tView.template, lView[CONTEXT]);
  } else if (flags & 8192) {
    const prevConsumer = setActiveConsumer(null);
    try {
      if (!isInCheckNoChangesPass) {
        runEffectsInView(lView);
      }
      detectChangesInEmbeddedViews(
        lView,
        1
        /* ChangeDetectionMode.Targeted */
      );
      const components = tView.components;
      if (components !== null) {
        detectChangesInChildComponents(
          lView,
          components,
          1
          /* ChangeDetectionMode.Targeted */
        );
      }
      if (!isInCheckNoChangesPass) {
        addAfterRenderSequencesForView(lView);
      }
    } finally {
      setActiveConsumer(prevConsumer);
    }
  }
}
function detectChangesInChildComponents(hostLView, components, mode) {
  for (let i = 0; i < components.length; i++) {
    detectChangesInComponent(hostLView, components[i], mode);
  }
}
function processHostBindingOpCodes(tView, lView) {
  const hostBindingOpCodes = tView.hostBindingOpCodes;
  if (hostBindingOpCodes === null)
    return;
  try {
    for (let i = 0; i < hostBindingOpCodes.length; i++) {
      const opCode = hostBindingOpCodes[i];
      if (opCode < 0) {
        setSelectedIndex(~opCode);
      } else {
        const directiveIdx = opCode;
        const bindingRootIndx = hostBindingOpCodes[++i];
        const hostBindingFn = hostBindingOpCodes[++i];
        setBindingRootForHostBindings(bindingRootIndx, directiveIdx);
        const context2 = lView[directiveIdx];
        profiler(24, context2);
        hostBindingFn(2, context2);
        profiler(25, context2);
      }
    }
  } finally {
    setSelectedIndex(-1);
  }
}
function markViewDirty(lView, source) {
  const dirtyBitsToUse = isRefreshingViews() ? (
    // When we are actively refreshing views, we only use the `Dirty` bit to mark a view
    64
  ) : (
    // When we are not actively refreshing a view tree, it is absolutely
    // valid to update state and mark views dirty. We use the `RefreshView` flag in this
    // case to allow synchronously rerunning change detection. This applies today to
    // afterRender hooks as well as animation listeners which execute after detecting
    // changes in a view when the render factory flushes.
    1024 | 64
  );
  lView[ENVIRONMENT].changeDetectionScheduler?.notify(source);
  while (lView) {
    lView[FLAGS] |= dirtyBitsToUse;
    const parent = getLViewParent(lView);
    if (isRootView(lView) && !parent) {
      return lView;
    }
    lView = parent;
  }
  return null;
}
function createLContainer(hostNative, currentView, native, tNode) {
  ngDevMode && assertLView(currentView);
  const lContainer = [
    hostNative,
    // host native
    true,
    // Boolean `true` in this position signifies that this is an `LContainer`
    0,
    // flags
    currentView,
    // parent
    null,
    // next
    tNode,
    // t_host
    null,
    // dehydrated views
    native,
    // native,
    null,
    // view refs
    null
    // moved views
  ];
  ngDevMode && assertEqual(lContainer.length, CONTAINER_HEADER_OFFSET, "Should allocate correct number of slots for LContainer header.");
  return lContainer;
}
function getLViewFromLContainer(lContainer, index) {
  const adjustedIndex = CONTAINER_HEADER_OFFSET + index;
  if (adjustedIndex < lContainer.length) {
    const lView = lContainer[adjustedIndex];
    ngDevMode && assertLView(lView);
    return lView;
  }
  return void 0;
}
function addLViewToLContainer(lContainer, lView, index, addToDOM = true) {
  const tView = lView[TVIEW];
  insertView(tView, lView, lContainer, index);
  if (addToDOM) {
    const beforeNode = getBeforeNodeForView(index, lContainer);
    const renderer = lView[RENDERER];
    const parentRNode = renderer.parentNode(lContainer[NATIVE]);
    if (parentRNode !== null) {
      addViewToDOM(tView, lContainer[T_HOST], renderer, lView, parentRNode, beforeNode);
    }
  }
  const hydrationInfo = lView[HYDRATION];
  if (hydrationInfo !== null && hydrationInfo.firstChild !== null) {
    hydrationInfo.firstChild = null;
  }
}
function removeLViewFromLContainer(lContainer, index) {
  const lView = detachView(lContainer, index);
  if (lView !== void 0) {
    destroyLView(lView[TVIEW], lView);
  }
  return lView;
}
function detachView(lContainer, removeIndex) {
  if (lContainer.length <= CONTAINER_HEADER_OFFSET)
    return;
  const indexInContainer = CONTAINER_HEADER_OFFSET + removeIndex;
  const viewToDetach = lContainer[indexInContainer];
  if (viewToDetach) {
    const declarationLContainer = viewToDetach[DECLARATION_LCONTAINER];
    if (declarationLContainer !== null && declarationLContainer !== lContainer) {
      detachMovedView(declarationLContainer, viewToDetach);
    }
    if (removeIndex > 0) {
      lContainer[indexInContainer - 1][NEXT] = viewToDetach[NEXT];
    }
    const removedLView = removeFromArray(lContainer, CONTAINER_HEADER_OFFSET + removeIndex);
    removeViewFromDOM(viewToDetach[TVIEW], viewToDetach);
    const lQueries = removedLView[QUERIES];
    if (lQueries !== null) {
      lQueries.detachView(removedLView[TVIEW]);
    }
    viewToDetach[PARENT] = null;
    viewToDetach[NEXT] = null;
    viewToDetach[FLAGS] &= ~128;
  }
  return viewToDetach;
}
function insertView(tView, lView, lContainer, index) {
  ngDevMode && assertLView(lView);
  ngDevMode && assertLContainer(lContainer);
  const indexInContainer = CONTAINER_HEADER_OFFSET + index;
  const containerLength = lContainer.length;
  if (index > 0) {
    lContainer[indexInContainer - 1][NEXT] = lView;
  }
  if (index < containerLength - CONTAINER_HEADER_OFFSET) {
    lView[NEXT] = lContainer[indexInContainer];
    addToArray(lContainer, CONTAINER_HEADER_OFFSET + index, lView);
  } else {
    lContainer.push(lView);
    lView[NEXT] = null;
  }
  lView[PARENT] = lContainer;
  const declarationLContainer = lView[DECLARATION_LCONTAINER];
  if (declarationLContainer !== null && lContainer !== declarationLContainer) {
    trackMovedView(declarationLContainer, lView);
  }
  const lQueries = lView[QUERIES];
  if (lQueries !== null) {
    lQueries.insertView(tView);
  }
  updateAncestorTraversalFlagsOnAttach(lView);
  lView[FLAGS] |= 128;
}
function trackMovedView(declarationContainer, lView) {
  ngDevMode && assertDefined(lView, "LView required");
  ngDevMode && assertLContainer(declarationContainer);
  const movedViews = declarationContainer[MOVED_VIEWS];
  const parent = lView[PARENT];
  ngDevMode && assertDefined(parent, "missing parent");
  if (isLView(parent)) {
    declarationContainer[FLAGS] |= 2;
  } else {
    const insertedComponentLView = parent[PARENT][DECLARATION_COMPONENT_VIEW];
    ngDevMode && assertDefined(insertedComponentLView, "Missing insertedComponentLView");
    const declaredComponentLView = lView[DECLARATION_COMPONENT_VIEW];
    ngDevMode && assertDefined(declaredComponentLView, "Missing declaredComponentLView");
    if (declaredComponentLView !== insertedComponentLView) {
      declarationContainer[FLAGS] |= 2;
    }
  }
  if (movedViews === null) {
    declarationContainer[MOVED_VIEWS] = [lView];
  } else {
    movedViews.push(lView);
  }
}
var ViewRef = class {
  _lView;
  _cdRefInjectingView;
  _appRef = null;
  _attachedToViewContainer = false;
  exhaustive;
  get rootNodes() {
    const lView = this._lView;
    const tView = lView[TVIEW];
    return collectNativeNodes(tView, lView, tView.firstChild, []);
  }
  constructor(_lView, _cdRefInjectingView) {
    this._lView = _lView;
    this._cdRefInjectingView = _cdRefInjectingView;
  }
  get context() {
    return this._lView[CONTEXT];
  }
  /**
   * @deprecated Replacing the full context object is not supported. Modify the context
   *   directly, or consider using a `Proxy` if you need to replace the full object.
   * // TODO(devversion): Remove this.
   */
  set context(value) {
    if (ngDevMode) {
      console.warn("Angular: Replacing the `context` object of an `EmbeddedViewRef` is deprecated.");
    }
    this._lView[CONTEXT] = value;
  }
  get destroyed() {
    return isDestroyed(this._lView);
  }
  destroy() {
    if (this._appRef) {
      this._appRef.detachView(this);
    } else if (this._attachedToViewContainer) {
      const parent = this._lView[PARENT];
      if (isLContainer(parent)) {
        const viewRefs = parent[VIEW_REFS];
        const index = viewRefs ? viewRefs.indexOf(this) : -1;
        if (index > -1) {
          ngDevMode && assertEqual(index, parent.indexOf(this._lView) - CONTAINER_HEADER_OFFSET, "An attached view should be in the same position within its container as its ViewRef in the VIEW_REFS array.");
          detachView(parent, index);
          removeFromArray(viewRefs, index);
        }
      }
      this._attachedToViewContainer = false;
    }
    destroyLView(this._lView[TVIEW], this._lView);
  }
  onDestroy(callback) {
    storeLViewOnDestroy(this._lView, callback);
  }
  /**
   * Marks a view and all of its ancestors dirty.
   *
   * This can be used to ensure an {@link ChangeDetectionStrategy#OnPush} component is
   * checked when it needs to be re-rendered but the two normal triggers haven't marked it
   * dirty (i.e. inputs haven't changed and events haven't fired in the view).
   *
   * <!-- TODO: Add a link to a chapter on OnPush components -->
   *
   * @usageNotes
   * ### Example
   *
   * ```ts
   * @Component({
   *   selector: 'app-root',
   *   template: `Number of ticks: {{numberOfTicks}}`
   *   changeDetection: ChangeDetectionStrategy.OnPush,
   * })
   * class AppComponent {
   *   numberOfTicks = 0;
   *
   *   constructor(private ref: ChangeDetectorRef) {
   *     setInterval(() => {
   *       this.numberOfTicks++;
   *       // the following is required, otherwise the view will not be updated
   *       this.ref.markForCheck();
   *     }, 1000);
   *   }
   * }
   * ```
   */
  markForCheck() {
    markViewDirty(
      this._cdRefInjectingView || this._lView,
      4
      /* NotificationSource.MarkForCheck */
    );
  }
  /**
   * Detaches the view from the change detection tree.
   *
   * Detached views will not be checked during change detection runs until they are
   * re-attached, even if they are dirty. `detach` can be used in combination with
   * {@link ChangeDetectorRef#detectChanges} to implement local change
   * detection checks.
   *
   * <!-- TODO: Add a link to a chapter on detach/reattach/local digest -->
   * <!-- TODO: Add a live demo once ref.detectChanges is merged into master -->
   *
   * @usageNotes
   * ### Example
   *
   * The following example defines a component with a large list of readonly data.
   * Imagine the data changes constantly, many times per second. For performance reasons,
   * we want to check and update the list every five seconds. We can do that by detaching
   * the component's change detector and doing a local check every five seconds.
   *
   * ```ts
   * class DataProvider {
   *   // in a real application the returned data will be different every time
   *   get data() {
   *     return [1,2,3,4,5];
   *   }
   * }
   *
   * @Component({
   *   selector: 'giant-list',
   *   template: `
   *     @for(d of dataProvider.data; track $index) {
   *        <li>Data {{d}}</li>
   *     }
   *   `,
   * })
   * class GiantList {
   *   constructor(private ref: ChangeDetectorRef, private dataProvider: DataProvider) {
   *     ref.detach();
   *     setInterval(() => {
   *       this.ref.detectChanges();
   *     }, 5000);
   *   }
   * }
   *
   * @Component({
   *   selector: 'app',
   *   providers: [DataProvider],
   *   template: `
   *     <giant-list><giant-list>
   *   `,
   * })
   * class App {
   * }
   * ```
   */
  detach() {
    this._lView[FLAGS] &= ~128;
  }
  /**
   * Re-attaches a view to the change detection tree.
   *
   * This can be used to re-attach views that were previously detached from the tree
   * using {@link ChangeDetectorRef#detach}. Views are attached to the tree by default.
   *
   * <!-- TODO: Add a link to a chapter on detach/reattach/local digest -->
   *
   * @usageNotes
   * ### Example
   *
   * The following example creates a component displaying `live` data. The component will detach
   * its change detector from the main change detector tree when the component's live property
   * is set to false.
   *
   * ```ts
   * class DataProvider {
   *   data = 1;
   *
   *   constructor() {
   *     setInterval(() => {
   *       this.data = this.data * 2;
   *     }, 500);
   *   }
   * }
   *
   * @Component({
   *   selector: 'live-data',
   *   inputs: ['live'],
   *   template: 'Data: {{dataProvider.data}}'
   * })
   * class LiveData {
   *   constructor(private ref: ChangeDetectorRef, private dataProvider: DataProvider) {}
   *
   *   set live(value) {
   *     if (value) {
   *       this.ref.reattach();
   *     } else {
   *       this.ref.detach();
   *     }
   *   }
   * }
   *
   * @Component({
   *   selector: 'app-root',
   *   providers: [DataProvider],
   *   template: `
   *     Live Update: <input type="checkbox" [(ngModel)]="live">
   *     <live-data [live]="live"><live-data>
   *   `,
   * })
   * class AppComponent {
   *   live = true;
   * }
   * ```
   */
  reattach() {
    updateAncestorTraversalFlagsOnAttach(this._lView);
    this._lView[FLAGS] |= 128;
  }
  /**
   * Checks the view and its children.
   *
   * This can also be used in combination with {@link ChangeDetectorRef#detach} to implement
   * local change detection checks.
   *
   * <!-- TODO: Add a link to a chapter on detach/reattach/local digest -->
   * <!-- TODO: Add a live demo once ref.detectChanges is merged into master -->
   *
   * @usageNotes
   * ### Example
   *
   * The following example defines a component with a large list of readonly data.
   * Imagine, the data changes constantly, many times per second. For performance reasons,
   * we want to check and update the list every five seconds.
   *
   * We can do that by detaching the component's change detector and doing a local change detection
   * check every five seconds.
   *
   * See {@link ChangeDetectorRef#detach} for more information.
   */
  detectChanges() {
    this._lView[FLAGS] |= 1024;
    detectChangesInternal(this._lView);
  }
  /**
   * Checks the change detector and its children, and throws if any changes are detected.
   *
   * This is used in development mode to verify that running change detection doesn't
   * introduce other changes.
   */
  checkNoChanges() {
    if (!ngDevMode)
      return;
    try {
      this.exhaustive ??= this._lView[INJECTOR].get(UseExhaustiveCheckNoChanges, USE_EXHAUSTIVE_CHECK_NO_CHANGES_DEFAULT);
    } catch {
      this.exhaustive = USE_EXHAUSTIVE_CHECK_NO_CHANGES_DEFAULT;
    }
    checkNoChangesInternal(this._lView, this.exhaustive);
  }
  attachToViewContainerRef() {
    if (this._appRef) {
      throw new RuntimeError(902, ngDevMode && "This view is already attached directly to the ApplicationRef!");
    }
    this._attachedToViewContainer = true;
  }
  detachFromAppRef() {
    this._appRef = null;
    const isRoot = isRootView(this._lView);
    const declarationContainer = this._lView[DECLARATION_LCONTAINER];
    if (declarationContainer !== null && !isRoot) {
      detachMovedView(declarationContainer, this._lView);
    }
    detachViewFromDOM(this._lView[TVIEW], this._lView);
  }
  attachToAppRef(appRef) {
    if (this._attachedToViewContainer) {
      throw new RuntimeError(902, ngDevMode && "This view is already attached to a ViewContainer!");
    }
    this._appRef = appRef;
    const isRoot = isRootView(this._lView);
    const declarationContainer = this._lView[DECLARATION_LCONTAINER];
    if (declarationContainer !== null && !isRoot) {
      trackMovedView(declarationContainer, this._lView);
    }
    updateAncestorTraversalFlagsOnAttach(this._lView);
  }
};
var TemplateRef = class {
  _declarationLView;
  _declarationTContainer;
  /**
   * The anchor element in the parent view for this embedded view.
   *
   * The data-binding and [injection contexts](guide/di/dependency-injection-context) of embedded
   * views created from this `TemplateRef` inherit from the contexts of this location.
   *
   * Typically new embedded views are attached to the view container of this location, but in
   * advanced use-cases, the view can be attached to a different container while keeping the
   * data-binding and injection context from the original location.
   *
   */
  elementRef;
  /**
   * @internal
   * @nocollapse
   */
  static __NG_ELEMENT_ID__ = injectTemplateRef;
  /** @internal */
  constructor(_declarationLView, _declarationTContainer, elementRef) {
    this._declarationLView = _declarationLView;
    this._declarationTContainer = _declarationTContainer;
    this.elementRef = elementRef;
  }
  /**
   * Returns an `ssrId` associated with a TView, which was used to
   * create this instance of the `TemplateRef`.
   *
   * @internal
   */
  get ssrId() {
    return this._declarationTContainer.tView?.ssrId || null;
  }
  /**
   * Instantiates an unattached embedded view based on this template.
   * @param context The data-binding context of the embedded view, as declared
   * in the `<ng-template>` usage.
   * @param injector Injector to be used within the embedded view.
   * @returns The new embedded view object.
   */
  createEmbeddedView(context2, injector) {
    return this.createEmbeddedViewImpl(context2, injector);
  }
  /**
   * Implementation of the `createEmbeddedView` function.
   *
   * This implementation is internal and allows framework code
   * to invoke it with extra parameters (e.g. for hydration) without
   * affecting public API.
   *
   * @internal
   */
  createEmbeddedViewImpl(context2, injector, dehydratedView) {
    const embeddedLView = createAndRenderEmbeddedLView(this._declarationLView, this._declarationTContainer, context2, { embeddedViewInjector: injector, dehydratedView });
    return new ViewRef(embeddedLView);
  }
};
function injectTemplateRef() {
  return createTemplateRef(getCurrentTNode(), getLView());
}
function createTemplateRef(hostTNode, hostLView) {
  if (hostTNode.type & 4) {
    ngDevMode && assertDefined(hostTNode.tView, "TView must be allocated");
    return new TemplateRef(hostLView, hostTNode, createElementRef(hostTNode, hostLView));
  }
  return null;
}
var AT_THIS_LOCATION = "<-- AT THIS LOCATION";
function getFriendlyStringFromTNodeType(tNodeType) {
  switch (tNodeType) {
    case 4:
      return "view container";
    case 2:
      return "element";
    case 8:
      return "ng-container";
    case 32:
      return "icu";
    case 64:
      return "i18n";
    case 16:
      return "projection";
    case 1:
      return "text";
    case 128:
      return "@let";
    default:
      return "<unknown>";
  }
}
function validateSiblingNodeExists(node) {
  validateNodeExists(node);
  if (!node.nextSibling) {
    const header = "During hydration Angular expected more sibling nodes to be present.\n\n";
    const actual = `Actual DOM is:

${describeDomFromNode(node)}

`;
    const footer = getHydrationErrorFooter();
    const message = header + actual + footer;
    markRNodeAsHavingHydrationMismatch(node, "", actual);
    throw new RuntimeError(-501, message);
  }
}
function validateNodeExists(node, lView = null, tNode = null) {
  if (!node) {
    const header = "During hydration, Angular expected an element to be present at this location.\n\n";
    let expected = "";
    let footer = "";
    if (lView !== null && tNode !== null) {
      expected = describeExpectedDom(lView, tNode, false);
      footer = getHydrationErrorFooter();
      markRNodeAsHavingHydrationMismatch(unwrapRNode(lView[HOST]), expected, "");
    }
    throw new RuntimeError(-502, `${header}${expected}

${footer}`);
  }
}
function stringifyTNodeAttrs(tNode) {
  const results = [];
  if (tNode.attrs) {
    for (let i = 0; i < tNode.attrs.length; ) {
      const attrName = tNode.attrs[i++];
      if (typeof attrName == "number") {
        break;
      }
      const attrValue = tNode.attrs[i++];
      results.push(`${attrName}="${shorten(attrValue)}"`);
    }
  }
  return results.join(" ");
}
var internalAttrs = /* @__PURE__ */ new Set(["ngh", "ng-version", "ng-server-context"]);
function stringifyRNodeAttrs(rNode) {
  const results = [];
  for (let i = 0; i < rNode.attributes.length; i++) {
    const attr = rNode.attributes[i];
    if (internalAttrs.has(attr.name))
      continue;
    results.push(`${attr.name}="${shorten(attr.value)}"`);
  }
  return results.join(" ");
}
function describeTNode(tNode, innerContent = "\u2026") {
  switch (tNode.type) {
    case 1:
      const content = tNode.value ? `(${tNode.value})` : "";
      return `#text${content}`;
    case 2:
      const attrs = stringifyTNodeAttrs(tNode);
      const tag = tNode.value.toLowerCase();
      return `<${tag}${attrs ? " " + attrs : ""}>${innerContent}</${tag}>`;
    case 8:
      return "<!-- ng-container -->";
    case 4:
      return "<!-- container -->";
    default:
      const typeAsString = getFriendlyStringFromTNodeType(tNode.type);
      return `#node(${typeAsString})`;
  }
}
function describeRNode(rNode, innerContent = "\u2026") {
  const node = rNode;
  switch (node.nodeType) {
    case Node.ELEMENT_NODE:
      const tag = node.tagName.toLowerCase();
      const attrs = stringifyRNodeAttrs(node);
      return `<${tag}${attrs ? " " + attrs : ""}>${innerContent}</${tag}>`;
    case Node.TEXT_NODE:
      const content = node.textContent ? shorten(node.textContent) : "";
      return `#text${content ? `(${content})` : ""}`;
    case Node.COMMENT_NODE:
      return `<!-- ${shorten(node.textContent ?? "")} -->`;
    default:
      return `#node(${node.nodeType})`;
  }
}
function describeExpectedDom(lView, tNode, isViewContainerAnchor) {
  const spacer = "  ";
  let content = "";
  if (tNode.prev) {
    content += spacer + "\u2026\n";
    content += spacer + describeTNode(tNode.prev) + "\n";
  } else if (tNode.type && tNode.type & 12) {
    content += spacer + "\u2026\n";
  }
  if (isViewContainerAnchor) {
    content += spacer + describeTNode(tNode) + "\n";
    content += spacer + `<!-- container -->  ${AT_THIS_LOCATION}
`;
  } else {
    content += spacer + describeTNode(tNode) + `  ${AT_THIS_LOCATION}
`;
  }
  content += spacer + "\u2026\n";
  const parentRNode = tNode.type ? getParentRElement(lView[TVIEW], tNode, lView) : null;
  if (parentRNode) {
    content = describeRNode(parentRNode, "\n" + content);
  }
  return content;
}
function describeDomFromNode(node) {
  const spacer = "  ";
  let content = "";
  const currentNode = node;
  if (currentNode.previousSibling) {
    content += spacer + "\u2026\n";
    content += spacer + describeRNode(currentNode.previousSibling) + "\n";
  }
  content += spacer + describeRNode(currentNode) + `  ${AT_THIS_LOCATION}
`;
  if (node.nextSibling) {
    content += spacer + "\u2026\n";
  }
  if (node.parentNode) {
    content = describeRNode(currentNode.parentNode, "\n" + content);
  }
  return content;
}
function getHydrationErrorFooter(componentClassName) {
  const componentInfo = componentClassName ? `the "${componentClassName}"` : "corresponding";
  return `To fix this problem:
  * check ${componentInfo} component for hydration-related issues
  * check to see if your template has valid HTML structure
  * or skip hydration by adding the \`ngSkipHydration\` attribute to its host node in a template

`;
}
function stripNewlines(input2) {
  return input2.replace(/\s+/gm, "");
}
function shorten(input2, maxLength = 50) {
  if (!input2) {
    return "";
  }
  input2 = stripNewlines(input2);
  return input2.length > maxLength ? `${input2.substring(0, maxLength - 1)}\u2026` : input2;
}
function getInsertInFrontOfRNodeWithI18n(parentTNode, currentTNode, lView) {
  const tNodeInsertBeforeIndex = currentTNode.insertBeforeIndex;
  const insertBeforeIndex = Array.isArray(tNodeInsertBeforeIndex) ? tNodeInsertBeforeIndex[0] : tNodeInsertBeforeIndex;
  if (insertBeforeIndex === null) {
    return getInsertInFrontOfRNodeWithNoI18n(parentTNode, currentTNode, lView);
  } else {
    ngDevMode && assertIndexInRange(lView, insertBeforeIndex);
    return unwrapRNode(lView[insertBeforeIndex]);
  }
}
function processI18nInsertBefore(renderer, childTNode, lView, childRNode, parentRElement) {
  const tNodeInsertBeforeIndex = childTNode.insertBeforeIndex;
  if (Array.isArray(tNodeInsertBeforeIndex)) {
    ngDevMode && assertDomNode(childRNode);
    let i18nParent = childRNode;
    let anchorRNode = null;
    if (!(childTNode.type & 3)) {
      anchorRNode = i18nParent;
      i18nParent = parentRElement;
    }
    if (i18nParent !== null && childTNode.componentOffset === -1) {
      for (let i = 1; i < tNodeInsertBeforeIndex.length; i++) {
        const i18nChild = lView[tNodeInsertBeforeIndex[i]];
        nativeInsertBefore(renderer, i18nParent, i18nChild, anchorRNode, false);
      }
    }
  }
}
function getOrCreateTNode(tView, index, type, name2, attrs) {
  ngDevMode && index !== 0 && // 0 are bogus nodes and they are OK. See `createContainerRef` in
  // `view_engine_compatibility` for additional context.
  assertGreaterThanOrEqual(index, HEADER_OFFSET, "TNodes can't be in the LView header.");
  ngDevMode && assertPureTNodeType(type);
  let tNode = tView.data[index];
  if (tNode === null) {
    tNode = createTNodeAtIndex(tView, index, type, name2, attrs);
    if (isInI18nBlock()) {
      tNode.flags |= 32;
    }
  } else if (tNode.type & 64) {
    tNode.type = type;
    tNode.value = name2;
    tNode.attrs = attrs;
    const parent = getCurrentParentTNode();
    tNode.injectorIndex = parent === null ? -1 : parent.injectorIndex;
    ngDevMode && assertTNodeForTView(tNode, tView);
    ngDevMode && assertEqual(index, tNode.index, "Expecting same index");
  }
  setCurrentTNode(tNode, true);
  return tNode;
}
function createTNodeAtIndex(tView, index, type, name2, attrs) {
  const currentTNode = getCurrentTNodePlaceholderOk();
  const isParent = isCurrentTNodeParent();
  const parent = isParent ? currentTNode : currentTNode && currentTNode.parent;
  const tNode = tView.data[index] = createTNode(tView, parent, type, index, name2, attrs);
  linkTNodeInTView(tView, tNode, currentTNode, isParent);
  return tNode;
}
function linkTNodeInTView(tView, tNode, currentTNode, isParent) {
  if (tView.firstChild === null) {
    tView.firstChild = tNode;
  }
  if (currentTNode !== null) {
    if (isParent) {
      if (currentTNode.child == null && tNode.parent !== null) {
        currentTNode.child = tNode;
      }
    } else {
      if (currentTNode.next === null) {
        currentTNode.next = tNode;
        tNode.prev = currentTNode;
      }
    }
  }
}
function createTNode(tView, tParent, type, index, value, attrs) {
  ngDevMode && index !== 0 && // 0 are bogus nodes and they are OK. See `createContainerRef` in
  // `view_engine_compatibility` for additional context.
  assertGreaterThanOrEqual(index, HEADER_OFFSET, "TNodes can't be in the LView header.");
  ngDevMode && assertNotSame(attrs, void 0, "'undefined' is not valid value for 'attrs'");
  ngDevMode && tParent && assertTNodeForTView(tParent, tView);
  let injectorIndex = tParent ? tParent.injectorIndex : -1;
  let flags = 0;
  if (isInSkipHydrationBlock()) {
    flags |= 128;
  }
  const tNode = {
    type,
    index,
    insertBeforeIndex: null,
    injectorIndex,
    directiveStart: -1,
    directiveEnd: -1,
    directiveStylingLast: -1,
    componentOffset: -1,
    propertyBindings: null,
    flags,
    providerIndexes: 0,
    value,
    attrs,
    mergedAttrs: null,
    localNames: null,
    initialInputs: null,
    inputs: null,
    hostDirectiveInputs: null,
    outputs: null,
    hostDirectiveOutputs: null,
    directiveToIndex: null,
    tView: null,
    next: null,
    prev: null,
    projectionNext: null,
    child: null,
    parent: tParent,
    projection: null,
    styles: null,
    stylesWithoutHost: null,
    residualStyles: void 0,
    classes: null,
    classesWithoutHost: null,
    residualClasses: void 0,
    classBindings: 0,
    styleBindings: 0
  };
  if (ngDevMode) {
    Object.seal(tNode);
  }
  return tNode;
}
function addTNodeAndUpdateInsertBeforeIndex(previousTNodes, newTNode) {
  ngDevMode && assertEqual(newTNode.insertBeforeIndex, null, "We expect that insertBeforeIndex is not set");
  previousTNodes.push(newTNode);
  if (previousTNodes.length > 1) {
    for (let i = previousTNodes.length - 2; i >= 0; i--) {
      const existingTNode = previousTNodes[i];
      if (!isI18nText(existingTNode)) {
        if (isNewTNodeCreatedBefore(existingTNode, newTNode) && getInsertBeforeIndex(existingTNode) === null) {
          setInsertBeforeIndex(existingTNode, newTNode.index);
        }
      }
    }
  }
}
function isI18nText(tNode) {
  return !(tNode.type & 64);
}
function isNewTNodeCreatedBefore(existingTNode, newTNode) {
  return isI18nText(newTNode) || existingTNode.index > newTNode.index;
}
function getInsertBeforeIndex(tNode) {
  const index = tNode.insertBeforeIndex;
  return Array.isArray(index) ? index[0] : index;
}
function setInsertBeforeIndex(tNode, value) {
  const index = tNode.insertBeforeIndex;
  if (Array.isArray(index)) {
    index[0] = value;
  } else {
    setI18nHandling(getInsertInFrontOfRNodeWithI18n, processI18nInsertBefore);
    tNode.insertBeforeIndex = value;
  }
}
function getTIcu(tView, index) {
  const value = tView.data[index];
  if (value === null || typeof value === "string")
    return null;
  if (ngDevMode && !(value.hasOwnProperty("tView") || value.hasOwnProperty("currentCaseLViewIndex"))) {
    throwError2("We expect to get 'null'|'TIcu'|'TIcuContainer', but got: " + value);
  }
  const tIcu = value.hasOwnProperty("currentCaseLViewIndex") ? value : value.value;
  ngDevMode && assertTIcu(tIcu);
  return tIcu;
}
function setTIcu(tView, index, tIcu) {
  const tNode = tView.data[index];
  ngDevMode && assertEqual(tNode === null || tNode.hasOwnProperty("tView"), true, "We expect to get 'null'|'TIcuContainer'");
  if (tNode === null) {
    tView.data[index] = tIcu;
  } else {
    ngDevMode && assertTNodeType(
      tNode,
      32
      /* TNodeType.Icu */
    );
    tNode.value = tIcu;
  }
}
function setTNodeInsertBeforeIndex(tNode, index) {
  ngDevMode && assertTNode(tNode);
  let insertBeforeIndex = tNode.insertBeforeIndex;
  if (insertBeforeIndex === null) {
    setI18nHandling(getInsertInFrontOfRNodeWithI18n, processI18nInsertBefore);
    insertBeforeIndex = tNode.insertBeforeIndex = [
      null,
      index
    ];
  } else {
    assertEqual(Array.isArray(insertBeforeIndex), true, "Expecting array here");
    insertBeforeIndex.push(index);
  }
}
function createTNodePlaceholder(tView, previousTNodes, index) {
  const tNode = createTNodeAtIndex(tView, index, 64, null, null);
  addTNodeAndUpdateInsertBeforeIndex(previousTNodes, tNode);
  return tNode;
}
function getCurrentICUCaseIndex(tIcu, lView) {
  const currentCase = lView[tIcu.currentCaseLViewIndex];
  return currentCase === null ? currentCase : currentCase < 0 ? ~currentCase : currentCase;
}
function getParentFromIcuCreateOpCode(mergedCode) {
  return mergedCode >>> 17;
}
function getRefFromIcuCreateOpCode(mergedCode) {
  return (mergedCode & 131070) >>> 1;
}
function getInstructionFromIcuCreateOpCode(mergedCode) {
  return mergedCode & 1;
}
function icuCreateOpCode(opCode, parentIdx, refIdx) {
  ngDevMode && assertGreaterThanOrEqual(parentIdx, 0, "Missing parent index");
  ngDevMode && assertGreaterThan(refIdx, 0, "Missing ref index");
  return opCode | parentIdx << 17 | refIdx << 1;
}
function isRootTemplateMessage(subTemplateIndex) {
  return subTemplateIndex === -1;
}
function enterIcu(state, tIcu, lView) {
  state.index = 0;
  const currentCase = getCurrentICUCaseIndex(tIcu, lView);
  if (currentCase !== null) {
    ngDevMode && assertNumberInRange(currentCase, 0, tIcu.cases.length - 1);
    state.removes = tIcu.remove[currentCase];
  } else {
    state.removes = EMPTY_ARRAY;
  }
}
function icuContainerIteratorNext(state) {
  if (state.index < state.removes.length) {
    const removeOpCode = state.removes[state.index++];
    ngDevMode && assertNumber(removeOpCode, "Expecting OpCode number");
    if (removeOpCode > 0) {
      const rNode = state.lView[removeOpCode];
      ngDevMode && assertDomNode(rNode);
      return rNode;
    } else {
      state.stack.push(state.index, state.removes);
      const tIcuIndex = ~removeOpCode;
      const tIcu = state.lView[TVIEW].data[tIcuIndex];
      ngDevMode && assertTIcu(tIcu);
      enterIcu(state, tIcu, state.lView);
      return icuContainerIteratorNext(state);
    }
  } else {
    if (state.stack.length === 0) {
      return null;
    } else {
      state.removes = state.stack.pop();
      state.index = state.stack.pop();
      return icuContainerIteratorNext(state);
    }
  }
}
function loadIcuContainerVisitor() {
  const _state = {
    stack: [],
    index: -1
  };
  function icuContainerIteratorStart(tIcuContainerNode, lView) {
    _state.lView = lView;
    while (_state.stack.length)
      _state.stack.pop();
    ngDevMode && assertTNodeForLView(tIcuContainerNode, lView);
    enterIcu(_state, tIcuContainerNode.value, lView);
    return icuContainerIteratorNext.bind(null, _state);
  }
  return icuContainerIteratorStart;
}
var REF_EXTRACTOR_REGEXP = /* @__PURE__ */ new RegExp(`^(\\d+)*(${REFERENCE_NODE_BODY}|${REFERENCE_NODE_HOST})*(.*)`);
var _prepareI18nBlockForHydrationImpl = () => {
};
function prepareI18nBlockForHydration(lView, index, parentTNode, subTemplateIndex) {
  _prepareI18nBlockForHydrationImpl(lView, index, parentTNode, subTemplateIndex);
}
var _claimDehydratedIcuCaseImpl = () => {
};
function claimDehydratedIcuCase(lView, icuIndex, caseIndex) {
  _claimDehydratedIcuCaseImpl(lView, icuIndex, caseIndex);
}
function cleanupI18nHydrationData(lView) {
  const hydrationInfo = lView[HYDRATION];
  if (hydrationInfo) {
    const { i18nNodes, dehydratedIcuData: dehydratedIcuDataMap } = hydrationInfo;
    if (i18nNodes && dehydratedIcuDataMap) {
      const renderer = lView[RENDERER];
      for (const dehydratedIcuData of dehydratedIcuDataMap.values()) {
        cleanupDehydratedIcuData(renderer, i18nNodes, dehydratedIcuData);
      }
    }
    hydrationInfo.i18nNodes = void 0;
    hydrationInfo.dehydratedIcuData = void 0;
  }
}
function cleanupDehydratedIcuData(renderer, i18nNodes, dehydratedIcuData) {
  for (const node of dehydratedIcuData.node.cases[dehydratedIcuData.case]) {
    const rNode = i18nNodes.get(node.index - HEADER_OFFSET);
    if (rNode) {
      nativeRemoveNode(renderer, rNode, false);
    }
  }
}
function removeDehydratedViews(lContainer) {
  const views = lContainer[DEHYDRATED_VIEWS] ?? [];
  const parentLView = lContainer[PARENT];
  const renderer = parentLView[RENDERER];
  const retainedViews = [];
  for (const view of views) {
    if (view.data[DEFER_BLOCK_ID] !== void 0) {
      retainedViews.push(view);
    } else {
      removeDehydratedView(view, renderer);
      ngDevMode && ngDevMode.dehydratedViewsRemoved++;
    }
  }
  lContainer[DEHYDRATED_VIEWS] = retainedViews;
}
function removeDehydratedViewList(deferBlock) {
  const { lContainer } = deferBlock;
  const dehydratedViews = lContainer[DEHYDRATED_VIEWS];
  if (dehydratedViews === null)
    return;
  const parentLView = lContainer[PARENT];
  const renderer = parentLView[RENDERER];
  for (const view of dehydratedViews) {
    removeDehydratedView(view, renderer);
    ngDevMode && ngDevMode.dehydratedViewsRemoved++;
  }
}
function removeDehydratedView(dehydratedView, renderer) {
  let nodesRemoved = 0;
  let currentRNode = dehydratedView.firstChild;
  if (currentRNode) {
    const numNodes = dehydratedView.data[NUM_ROOT_NODES];
    while (nodesRemoved < numNodes) {
      ngDevMode && validateSiblingNodeExists(currentRNode);
      const nextSibling = currentRNode.nextSibling;
      nativeRemoveNode(renderer, currentRNode, false);
      currentRNode = nextSibling;
      nodesRemoved++;
    }
  }
}
function cleanupLContainer(lContainer) {
  removeDehydratedViews(lContainer);
  const hostLView = lContainer[HOST];
  if (isLView(hostLView)) {
    cleanupLView(hostLView);
  }
  for (let i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) {
    cleanupLView(lContainer[i]);
  }
}
function cleanupLView(lView) {
  cleanupI18nHydrationData(lView);
  const tView = lView[TVIEW];
  for (let i = HEADER_OFFSET; i < tView.bindingStartIndex; i++) {
    if (isLContainer(lView[i])) {
      const lContainer = lView[i];
      cleanupLContainer(lContainer);
    } else if (isLView(lView[i])) {
      cleanupLView(lView[i]);
    }
  }
}
function cleanupDehydratedViews(appRef) {
  const viewRefs = appRef._views;
  for (const viewRef of viewRefs) {
    const lNode = getLNodeForHydration(viewRef);
    if (lNode !== null && lNode[HOST] !== null) {
      if (isLView(lNode)) {
        cleanupLView(lNode);
      } else {
        cleanupLContainer(lNode);
      }
      ngDevMode && ngDevMode.dehydratedViewsCleanupRuns++;
    }
  }
}
function cleanupHydratedDeferBlocks(deferBlock, hydratedBlocks, registry, appRef) {
  if (deferBlock !== null) {
    registry.cleanup(hydratedBlocks);
    cleanupLContainer(deferBlock.lContainer);
    cleanupDehydratedViews(appRef);
  }
}
var _findMatchingDehydratedViewImpl = () => null;
var _findAndReconcileMatchingDehydratedViewsImpl = () => null;
function findMatchingDehydratedView(lContainer, template) {
  return _findMatchingDehydratedViewImpl(lContainer, template);
}
function findAndReconcileMatchingDehydratedViews(lContainer, templateTNode, hostLView) {
  return _findAndReconcileMatchingDehydratedViewsImpl(lContainer, templateTNode, hostLView);
}
var ComponentRef$1 = class ComponentRef {
};
var ComponentFactory$1 = class ComponentFactory {
};
var _NullComponentFactoryResolver = class {
  resolveComponentFactory(component) {
    throw new RuntimeError(917, typeof ngDevMode !== "undefined" && ngDevMode && `No component factory found for ${stringify(component)}.`);
  }
};
var ComponentFactoryResolver$1 = class ComponentFactoryResolver {
  static NULL = new _NullComponentFactoryResolver();
};
var RendererFactory2 = class {
};
var Renderer2 = class {
  /**
   * If null or undefined, the view engine won't call it.
   * This is used as a performance optimization for production mode.
   */
  destroyNode = null;
  /**
   * @internal
   * @nocollapse
   */
  static __NG_ELEMENT_ID__ = () => injectRenderer2();
};
function injectRenderer2() {
  const lView = getLView();
  const tNode = getCurrentTNode();
  const nodeAtIndex = getComponentLViewByIndex(tNode.index, lView);
  return (isLView(nodeAtIndex) ? nodeAtIndex : lView)[RENDERER];
}
var Sanitizer = class _Sanitizer {
  /** @nocollapse */
  static \u0275prov = (
    /** @pureOrBreakMyCode */
    /* @__PURE__ */ \u0275\u0275defineInjectable({
      token: _Sanitizer,
      providedIn: "root",
      factory: () => null
    })
  );
};
function isModuleWithProviders(value) {
  return value.ngModule !== void 0;
}
function isNgModule(value) {
  return !!getNgModuleDef(value);
}
function isPipe(value) {
  return !!getPipeDef(value);
}
function isDirective(value) {
  return !!getDirectiveDef(value);
}
function isComponent(value) {
  return !!getComponentDef(value);
}
function getDependencyTypeForError(type) {
  if (getComponentDef(type))
    return "component";
  if (getDirectiveDef(type))
    return "directive";
  if (getPipeDef(type))
    return "pipe";
  return "type";
}
function verifyStandaloneImport(depType, importingType) {
  if (isForwardRef(depType)) {
    depType = resolveForwardRef(depType);
    if (!depType) {
      throw new Error(`Expected forwardRef function, imported from "${stringifyForError(importingType)}", to return a standalone entity or NgModule but got "${stringifyForError(depType) || depType}".`);
    }
  }
  if (getNgModuleDef(depType) == null) {
    const def = getComponentDef(depType) || getDirectiveDef(depType) || getPipeDef(depType);
    if (def != null) {
      if (!def.standalone) {
        throw new Error(`The "${stringifyForError(depType)}" ${getDependencyTypeForError(depType)}, imported from "${stringifyForError(importingType)}", is not standalone. Did you forget to add the standalone: true flag?`);
      }
    } else {
      if (isModuleWithProviders(depType)) {
        throw new Error(`A module with providers was imported from "${stringifyForError(importingType)}". Modules with providers are not supported in standalone components imports.`);
      } else {
        throw new Error(`The "${stringifyForError(depType)}" type, imported from "${stringifyForError(importingType)}", must be a standalone component / directive / pipe or an NgModule. Did you forget to add the required @Component / @Directive / @Pipe or @NgModule annotation?`);
      }
    }
  }
}
var DepsTracker = class {
  ownerNgModule = /* @__PURE__ */ new Map();
  ngModulesWithSomeUnresolvedDecls = /* @__PURE__ */ new Set();
  ngModulesScopeCache = /* @__PURE__ */ new Map();
  standaloneComponentsScopeCache = /* @__PURE__ */ new Map();
  /**
   * Attempts to resolve ng module's forward ref declarations as much as possible and add them to
   * the `ownerNgModule` map. This method normally should be called after the initial parsing when
   * all the forward refs are resolved (e.g., when trying to render a component)
   */
  resolveNgModulesDecls() {
    if (this.ngModulesWithSomeUnresolvedDecls.size === 0) {
      return;
    }
    for (const moduleType of this.ngModulesWithSomeUnresolvedDecls) {
      const def = getNgModuleDef(moduleType);
      if (def?.declarations) {
        for (const decl of maybeUnwrapFn(def.declarations)) {
          if (isComponent(decl)) {
            this.ownerNgModule.set(decl, moduleType);
          }
        }
      }
    }
    this.ngModulesWithSomeUnresolvedDecls.clear();
  }
  /** @override */
  getComponentDependencies(type, rawImports) {
    this.resolveNgModulesDecls();
    const def = getComponentDef(type);
    if (def === null) {
      throw new Error(`Attempting to get component dependencies for a type that is not a component: ${type}`);
    }
    if (def.standalone) {
      const scope = this.getStandaloneComponentScope(type, rawImports);
      if (scope.compilation.isPoisoned) {
        return { dependencies: [] };
      }
      return {
        dependencies: [
          ...scope.compilation.directives,
          ...scope.compilation.pipes,
          ...scope.compilation.ngModules
        ]
      };
    } else {
      if (!this.ownerNgModule.has(type)) {
        return { dependencies: [] };
      }
      const scope = this.getNgModuleScope(this.ownerNgModule.get(type));
      if (scope.compilation.isPoisoned) {
        return { dependencies: [] };
      }
      return {
        dependencies: [...scope.compilation.directives, ...scope.compilation.pipes]
      };
    }
  }
  /**
   * @override
   * This implementation does not make use of param scopeInfo since it assumes the scope info is
   * already added to the type itself through methods like {@link ɵɵsetNgModuleScope}
   */
  registerNgModule(type, scopeInfo) {
    if (!isNgModule(type)) {
      throw new Error(`Attempting to register a Type which is not NgModule as NgModule: ${type}`);
    }
    this.ngModulesWithSomeUnresolvedDecls.add(type);
  }
  /** @override */
  clearScopeCacheFor(type) {
    this.ngModulesScopeCache.delete(type);
    this.standaloneComponentsScopeCache.delete(type);
  }
  /** @override */
  getNgModuleScope(type) {
    if (this.ngModulesScopeCache.has(type)) {
      return this.ngModulesScopeCache.get(type);
    }
    const scope = this.computeNgModuleScope(type);
    this.ngModulesScopeCache.set(type, scope);
    return scope;
  }
  /** Compute NgModule scope afresh. */
  computeNgModuleScope(type) {
    const def = getNgModuleDefOrThrow(type);
    const scope = {
      exported: { directives: /* @__PURE__ */ new Set(), pipes: /* @__PURE__ */ new Set() },
      compilation: { directives: /* @__PURE__ */ new Set(), pipes: /* @__PURE__ */ new Set() }
    };
    for (const imported of maybeUnwrapFn(def.imports)) {
      if (isNgModule(imported)) {
        const importedScope = this.getNgModuleScope(imported);
        addSet(importedScope.exported.directives, scope.compilation.directives);
        addSet(importedScope.exported.pipes, scope.compilation.pipes);
      } else if (isStandalone(imported)) {
        if (isDirective(imported) || isComponent(imported)) {
          scope.compilation.directives.add(imported);
        } else if (isPipe(imported)) {
          scope.compilation.pipes.add(imported);
        } else {
          throw new RuntimeError(980, "The standalone imported type is neither a component nor a directive nor a pipe");
        }
      } else {
        scope.compilation.isPoisoned = true;
        break;
      }
    }
    if (!scope.compilation.isPoisoned) {
      for (const decl of maybeUnwrapFn(def.declarations)) {
        if (isNgModule(decl) || isStandalone(decl)) {
          scope.compilation.isPoisoned = true;
          break;
        }
        if (isPipe(decl)) {
          scope.compilation.pipes.add(decl);
        } else {
          scope.compilation.directives.add(decl);
        }
      }
    }
    for (const exported of maybeUnwrapFn(def.exports)) {
      if (isNgModule(exported)) {
        const exportedScope = this.getNgModuleScope(exported);
        addSet(exportedScope.exported.directives, scope.exported.directives);
        addSet(exportedScope.exported.pipes, scope.exported.pipes);
        addSet(exportedScope.exported.directives, scope.compilation.directives);
        addSet(exportedScope.exported.pipes, scope.compilation.pipes);
      } else if (isPipe(exported)) {
        scope.exported.pipes.add(exported);
      } else {
        scope.exported.directives.add(exported);
      }
    }
    return scope;
  }
  /** @override */
  getStandaloneComponentScope(type, rawImports) {
    if (this.standaloneComponentsScopeCache.has(type)) {
      return this.standaloneComponentsScopeCache.get(type);
    }
    const ans = this.computeStandaloneComponentScope(type, rawImports);
    this.standaloneComponentsScopeCache.set(type, ans);
    return ans;
  }
  computeStandaloneComponentScope(type, rawImports) {
    const ans = {
      compilation: {
        // Standalone components are always able to self-reference.
        directives: /* @__PURE__ */ new Set([type]),
        pipes: /* @__PURE__ */ new Set(),
        ngModules: /* @__PURE__ */ new Set()
      }
    };
    for (const rawImport of flatten(rawImports ?? [])) {
      const imported = resolveForwardRef(rawImport);
      try {
        verifyStandaloneImport(imported, type);
      } catch (e) {
        ans.compilation.isPoisoned = true;
        return ans;
      }
      if (isNgModule(imported)) {
        ans.compilation.ngModules.add(imported);
        const importedScope = this.getNgModuleScope(imported);
        if (importedScope.exported.isPoisoned) {
          ans.compilation.isPoisoned = true;
          return ans;
        }
        addSet(importedScope.exported.directives, ans.compilation.directives);
        addSet(importedScope.exported.pipes, ans.compilation.pipes);
      } else if (isPipe(imported)) {
        ans.compilation.pipes.add(imported);
      } else if (isDirective(imported) || isComponent(imported)) {
        ans.compilation.directives.add(imported);
      } else {
        ans.compilation.isPoisoned = true;
        return ans;
      }
    }
    return ans;
  }
  /** @override */
  isOrphanComponent(cmp) {
    const def = getComponentDef(cmp);
    if (!def || def.standalone) {
      return false;
    }
    this.resolveNgModulesDecls();
    return !this.ownerNgModule.has(cmp);
  }
};
function addSet(sourceSet, targetSet) {
  for (const m of sourceSet) {
    targetSet.add(m);
  }
}
var depsTracker = new DepsTracker();
var NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR = {};
var ChainedInjector = class {
  injector;
  parentInjector;
  constructor(injector, parentInjector) {
    this.injector = injector;
    this.parentInjector = parentInjector;
  }
  get(token, notFoundValue, options) {
    const value = this.injector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, options);
    if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR || notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) {
      return value;
    }
    return this.parentInjector.get(token, notFoundValue, options);
  }
};
function computeStaticStyling(tNode, attrs, writeToHost) {
  ngDevMode && assertFirstCreatePass(getTView(), "Expecting to be called in first template pass only");
  let styles = writeToHost ? tNode.styles : null;
  let classes = writeToHost ? tNode.classes : null;
  let mode = 0;
  if (attrs !== null) {
    for (let i = 0; i < attrs.length; i++) {
      const value = attrs[i];
      if (typeof value === "number") {
        mode = value;
      } else if (mode == 1) {
        classes = concatStringsWithSpace(classes, value);
      } else if (mode == 2) {
        const style = value;
        const styleValue = attrs[++i];
        styles = concatStringsWithSpace(styles, style + ": " + styleValue + ";");
      }
    }
  }
  writeToHost ? tNode.styles = styles : tNode.stylesWithoutHost = styles;
  writeToHost ? tNode.classes = classes : tNode.classesWithoutHost = classes;
}
function \u0275\u0275directiveInject(token, flags = 0) {
  const lView = getLView();
  if (lView === null) {
    ngDevMode && assertInjectImplementationNotEqual(\u0275\u0275directiveInject);
    return \u0275\u0275inject(token, flags);
  }
  const tNode = getCurrentTNode();
  const value = getOrCreateInjectable(tNode, lView, resolveForwardRef(token), flags);
  ngDevMode && emitInjectEvent(token, value, flags);
  return value;
}
function \u0275\u0275invalidFactory() {
  const msg = ngDevMode ? `This constructor was not compatible with Dependency Injection.` : "invalid";
  throw new Error(msg);
}
function resolveDirectives(tView, lView, tNode, localRefs, directiveMatcher) {
  ngDevMode && assertFirstCreatePass(tView);
  const exportsMap = localRefs === null ? null : { "": -1 };
  const matchedDirectiveDefs = directiveMatcher(tView, tNode);
  if (matchedDirectiveDefs !== null) {
    let directiveDefs = matchedDirectiveDefs;
    let hostDirectiveDefs = null;
    let hostDirectiveRanges = null;
    for (const def of matchedDirectiveDefs) {
      if (def.resolveHostDirectives !== null) {
        [directiveDefs, hostDirectiveDefs, hostDirectiveRanges] = def.resolveHostDirectives(matchedDirectiveDefs);
        break;
      }
    }
    ngDevMode && assertNoDuplicateDirectives(directiveDefs);
    initializeDirectives(tView, lView, tNode, directiveDefs, exportsMap, hostDirectiveDefs, hostDirectiveRanges);
  }
  if (exportsMap !== null && localRefs !== null) {
    cacheMatchingLocalNames(tNode, localRefs, exportsMap);
  }
}
function cacheMatchingLocalNames(tNode, localRefs, exportsMap) {
  const localNames = tNode.localNames = [];
  for (let i = 0; i < localRefs.length; i += 2) {
    const index = exportsMap[localRefs[i + 1]];
    if (index == null)
      throw new RuntimeError(-301, ngDevMode && `Export of name '${localRefs[i + 1]}' not found!`);
    localNames.push(localRefs[i], index);
  }
}
function markAsComponentHost(tView, hostTNode, componentOffset) {
  ngDevMode && assertFirstCreatePass(tView);
  ngDevMode && assertGreaterThan(componentOffset, -1, "componentOffset must be great than -1");
  hostTNode.componentOffset = componentOffset;
  (tView.components ??= []).push(hostTNode.index);
}
function initializeDirectives(tView, lView, tNode, directives, exportsMap, hostDirectiveDefs, hostDirectiveRanges) {
  ngDevMode && assertFirstCreatePass(tView);
  const directivesLength = directives.length;
  let hasSeenComponent = false;
  for (let i = 0; i < directivesLength; i++) {
    const def = directives[i];
    if (!hasSeenComponent && isComponentDef(def)) {
      hasSeenComponent = true;
      markAsComponentHost(tView, tNode, i);
    }
    diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, lView), tView, def.type);
  }
  initTNodeFlags(tNode, tView.data.length, directivesLength);
  for (let i = 0; i < directivesLength; i++) {
    const def = directives[i];
    if (def.providersResolver)
      def.providersResolver(def);
  }
  let preOrderHooksFound = false;
  let preOrderCheckHooksFound = false;
  let directiveIdx = allocExpando(tView, lView, directivesLength, null);
  ngDevMode && assertSame(directiveIdx, tNode.directiveStart, "TNode.directiveStart should point to just allocated space");
  if (directivesLength > 0) {
    tNode.directiveToIndex = /* @__PURE__ */ new Map();
  }
  for (let i = 0; i < directivesLength; i++) {
    const def = directives[i];
    tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, def.hostAttrs);
    configureViewWithDirective(tView, tNode, lView, directiveIdx, def);
    saveNameToExportMap(directiveIdx, def, exportsMap);
    if (hostDirectiveRanges !== null && hostDirectiveRanges.has(def)) {
      const [start, end] = hostDirectiveRanges.get(def);
      tNode.directiveToIndex.set(def.type, [
        directiveIdx,
        start + tNode.directiveStart,
        end + tNode.directiveStart
      ]);
    } else if (hostDirectiveDefs === null || !hostDirectiveDefs.has(def)) {
      tNode.directiveToIndex.set(def.type, directiveIdx);
    }
    if (def.contentQueries !== null)
      tNode.flags |= 4;
    if (def.hostBindings !== null || def.hostAttrs !== null || def.hostVars !== 0)
      tNode.flags |= 64;
    const lifeCycleHooks = def.type.prototype;
    if (!preOrderHooksFound && (lifeCycleHooks.ngOnChanges || lifeCycleHooks.ngOnInit || lifeCycleHooks.ngDoCheck)) {
      (tView.preOrderHooks ??= []).push(tNode.index);
      preOrderHooksFound = true;
    }
    if (!preOrderCheckHooksFound && (lifeCycleHooks.ngOnChanges || lifeCycleHooks.ngDoCheck)) {
      (tView.preOrderCheckHooks ??= []).push(tNode.index);
      preOrderCheckHooksFound = true;
    }
    directiveIdx++;
  }
  initializeInputAndOutputAliases(tView, tNode, hostDirectiveDefs);
}
function initializeInputAndOutputAliases(tView, tNode, hostDirectiveDefs) {
  ngDevMode && assertFirstCreatePass(tView);
  for (let index = tNode.directiveStart; index < tNode.directiveEnd; index++) {
    const directiveDef = tView.data[index];
    if (hostDirectiveDefs === null || !hostDirectiveDefs.has(directiveDef)) {
      setupSelectorMatchedInputsOrOutputs(0, tNode, directiveDef, index);
      setupSelectorMatchedInputsOrOutputs(1, tNode, directiveDef, index);
      setupInitialInputs(tNode, index, false);
    } else {
      const hostDirectiveDef = hostDirectiveDefs.get(directiveDef);
      setupHostDirectiveInputsOrOutputs(0, tNode, hostDirectiveDef, index);
      setupHostDirectiveInputsOrOutputs(1, tNode, hostDirectiveDef, index);
      setupInitialInputs(tNode, index, true);
    }
  }
}
function setupSelectorMatchedInputsOrOutputs(mode, tNode, def, directiveIndex) {
  const aliasMap = mode === 0 ? def.inputs : def.outputs;
  for (const publicName in aliasMap) {
    if (aliasMap.hasOwnProperty(publicName)) {
      let bindings;
      if (mode === 0) {
        bindings = tNode.inputs ??= {};
      } else {
        bindings = tNode.outputs ??= {};
      }
      bindings[publicName] ??= [];
      bindings[publicName].push(directiveIndex);
      setShadowStylingInputFlags(tNode, publicName);
    }
  }
}
function setupHostDirectiveInputsOrOutputs(mode, tNode, config2, directiveIndex) {
  const aliasMap = mode === 0 ? config2.inputs : config2.outputs;
  for (const initialName in aliasMap) {
    if (aliasMap.hasOwnProperty(initialName)) {
      const publicName = aliasMap[initialName];
      let bindings;
      if (mode === 0) {
        bindings = tNode.hostDirectiveInputs ??= {};
      } else {
        bindings = tNode.hostDirectiveOutputs ??= {};
      }
      bindings[publicName] ??= [];
      bindings[publicName].push(directiveIndex, initialName);
      setShadowStylingInputFlags(tNode, publicName);
    }
  }
}
function setShadowStylingInputFlags(tNode, publicName) {
  if (publicName === "class") {
    tNode.flags |= 8;
  } else if (publicName === "style") {
    tNode.flags |= 16;
  }
}
function setupInitialInputs(tNode, directiveIndex, isHostDirective) {
  const { attrs, inputs, hostDirectiveInputs } = tNode;
  if (attrs === null || !isHostDirective && inputs === null || isHostDirective && hostDirectiveInputs === null || // Do not use unbound attributes as inputs to structural directives, since structural
  // directive inputs can only be set using microsyntax (e.g. `<div *dir="exp">`).
  isInlineTemplate(tNode)) {
    tNode.initialInputs ??= [];
    tNode.initialInputs.push(null);
    return;
  }
  let inputsToStore = null;
  let i = 0;
  while (i < attrs.length) {
    const attrName = attrs[i];
    if (attrName === 0) {
      i += 4;
      continue;
    } else if (attrName === 5) {
      i += 2;
      continue;
    } else if (typeof attrName === "number") {
      break;
    }
    if (!isHostDirective && inputs.hasOwnProperty(attrName)) {
      const inputConfig = inputs[attrName];
      for (const index of inputConfig) {
        if (index === directiveIndex) {
          inputsToStore ??= [];
          inputsToStore.push(attrName, attrs[i + 1]);
          break;
        }
      }
    } else if (isHostDirective && hostDirectiveInputs.hasOwnProperty(attrName)) {
      const config2 = hostDirectiveInputs[attrName];
      for (let j = 0; j < config2.length; j += 2) {
        if (config2[j] === directiveIndex) {
          inputsToStore ??= [];
          inputsToStore.push(config2[j + 1], attrs[i + 1]);
          break;
        }
      }
    }
    i += 2;
  }
  tNode.initialInputs ??= [];
  tNode.initialInputs.push(inputsToStore);
}
function configureViewWithDirective(tView, tNode, lView, directiveIndex, def) {
  ngDevMode && assertGreaterThanOrEqual(directiveIndex, HEADER_OFFSET, "Must be in Expando section");
  tView.data[directiveIndex] = def;
  const directiveFactory = def.factory || (def.factory = getFactoryDef(def.type, true));
  const nodeInjectorFactory = new NodeInjectorFactory(directiveFactory, isComponentDef(def), \u0275\u0275directiveInject, ngDevMode ? def.type.name : null);
  tView.blueprint[directiveIndex] = nodeInjectorFactory;
  lView[directiveIndex] = nodeInjectorFactory;
  registerHostBindingOpCodes(tView, tNode, directiveIndex, allocExpando(tView, lView, def.hostVars, NO_CHANGE), def);
}
function registerHostBindingOpCodes(tView, tNode, directiveIdx, directiveVarsIdx, def) {
  ngDevMode && assertFirstCreatePass(tView);
  const hostBindings = def.hostBindings;
  if (hostBindings) {
    let hostBindingOpCodes = tView.hostBindingOpCodes;
    if (hostBindingOpCodes === null) {
      hostBindingOpCodes = tView.hostBindingOpCodes = [];
    }
    const elementIndx = ~tNode.index;
    if (lastSelectedElementIdx(hostBindingOpCodes) != elementIndx) {
      hostBindingOpCodes.push(elementIndx);
    }
    hostBindingOpCodes.push(directiveIdx, directiveVarsIdx, hostBindings);
  }
}
function lastSelectedElementIdx(hostBindingOpCodes) {
  let i = hostBindingOpCodes.length;
  while (i > 0) {
    const value = hostBindingOpCodes[--i];
    if (typeof value === "number" && value < 0) {
      return value;
    }
  }
  return 0;
}
function saveNameToExportMap(directiveIdx, def, exportsMap) {
  if (exportsMap) {
    if (def.exportAs) {
      for (let i = 0; i < def.exportAs.length; i++) {
        exportsMap[def.exportAs[i]] = directiveIdx;
      }
    }
    if (isComponentDef(def))
      exportsMap[""] = directiveIdx;
  }
}
function initTNodeFlags(tNode, index, numberOfDirectives) {
  ngDevMode && assertNotEqual(numberOfDirectives, tNode.directiveEnd - tNode.directiveStart, "Reached the max number of directives");
  tNode.flags |= 1;
  tNode.directiveStart = index;
  tNode.directiveEnd = index + numberOfDirectives;
  tNode.providerIndexes = index;
}
function assertNoDuplicateDirectives(directives) {
  if (directives.length < 2) {
    return;
  }
  const seenDirectives = /* @__PURE__ */ new Set();
  for (const current of directives) {
    if (seenDirectives.has(current)) {
      throw new RuntimeError(309, `Directive ${current.type.name} matches multiple times on the same element. Directives can only match an element once.`);
    }
    seenDirectives.add(current);
  }
}
function directiveHostFirstCreatePass(index, lView, type, name2, directiveMatcher, bindingsEnabled, attrsIndex, localRefsIndex) {
  const tView = lView[TVIEW];
  ngDevMode && assertFirstCreatePass(tView);
  const tViewConsts = tView.consts;
  const attrs = getConstant(tViewConsts, attrsIndex);
  const tNode = getOrCreateTNode(tView, index, type, name2, attrs);
  if (bindingsEnabled) {
    resolveDirectives(tView, lView, tNode, getConstant(tViewConsts, localRefsIndex), directiveMatcher);
  }
  tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, tNode.attrs);
  if (tNode.attrs !== null) {
    computeStaticStyling(tNode, tNode.attrs, false);
  }
  if (tNode.mergedAttrs !== null) {
    computeStaticStyling(tNode, tNode.mergedAttrs, true);
  }
  if (tView.queries !== null) {
    tView.queries.elementStart(tView, tNode);
  }
  return tNode;
}
function directiveHostEndFirstCreatePass(tView, tNode) {
  ngDevMode && assertFirstCreatePass(tView);
  registerPostOrderHooks(tView, tNode);
  if (isContentQueryHost(tNode)) {
    tView.queries.elementEnd(tNode);
  }
}
function domOnlyFirstCreatePass(index, tView, type, name2, attrsIndex, localRefsIndex) {
  ngDevMode && assertFirstCreatePass(tView);
  const tViewConsts = tView.consts;
  const attrs = getConstant(tViewConsts, attrsIndex);
  const tNode = getOrCreateTNode(tView, index, type, name2, attrs);
  tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, tNode.attrs);
  if (localRefsIndex != null) {
    const refs = getConstant(tViewConsts, localRefsIndex);
    tNode.localNames = [];
    for (let i = 0; i < refs.length; i += 2) {
      tNode.localNames.push(refs[i], -1);
    }
  }
  if (tNode.attrs !== null) {
    computeStaticStyling(tNode, tNode.attrs, false);
  }
  if (tNode.mergedAttrs !== null) {
    computeStaticStyling(tNode, tNode.mergedAttrs, true);
  }
  if (tView.queries !== null) {
    tView.queries.elementStart(tView, tNode);
  }
  return tNode;
}
function isListLikeIterable(obj) {
  if (!isJsObject(obj))
    return false;
  return Array.isArray(obj) || !(obj instanceof Map) && // JS Map are iterables but return entries as [k, v]
  Symbol.iterator in obj;
}
function areIterablesEqual(a, b, comparator) {
  const iterator1 = a[Symbol.iterator]();
  const iterator2 = b[Symbol.iterator]();
  while (true) {
    const item1 = iterator1.next();
    const item2 = iterator2.next();
    if (item1.done && item2.done)
      return true;
    if (item1.done || item2.done)
      return false;
    if (!comparator(item1.value, item2.value))
      return false;
  }
}
function iterateListLike(obj, fn) {
  if (Array.isArray(obj)) {
    for (let i = 0; i < obj.length; i++) {
      fn(obj[i]);
    }
  } else {
    const iterator2 = obj[Symbol.iterator]();
    let item;
    while (!(item = iterator2.next()).done) {
      fn(item.value);
    }
  }
}
function isJsObject(o) {
  return o !== null && (typeof o === "function" || typeof o === "object");
}
function devModeEqual(a, b) {
  const isListLikeIterableA = isListLikeIterable(a);
  const isListLikeIterableB = isListLikeIterable(b);
  if (isListLikeIterableA && isListLikeIterableB) {
    return areIterablesEqual(a, b, devModeEqual);
  } else {
    const isAObject = a && (typeof a === "object" || typeof a === "function");
    const isBObject = b && (typeof b === "object" || typeof b === "function");
    if (!isListLikeIterableA && isAObject && !isListLikeIterableB && isBObject) {
      return true;
    } else {
      return Object.is(a, b);
    }
  }
}
function updateBinding(lView, bindingIndex, value) {
  return lView[bindingIndex] = value;
}
function getBinding(lView, bindingIndex) {
  ngDevMode && assertIndexInRange(lView, bindingIndex);
  ngDevMode && assertNotSame(lView[bindingIndex], NO_CHANGE, "Stored value should never be NO_CHANGE.");
  return lView[bindingIndex];
}
function bindingUpdated(lView, bindingIndex, value) {
  ngDevMode && assertLessThan(bindingIndex, lView.length, `Slot should have been initialized to NO_CHANGE`);
  if (value === NO_CHANGE) {
    return false;
  }
  const oldValue = lView[bindingIndex];
  if (Object.is(oldValue, value)) {
    return false;
  } else {
    if (ngDevMode && isInCheckNoChangesMode()) {
      const oldValueToCompare = oldValue !== NO_CHANGE ? oldValue : void 0;
      if (!devModeEqual(oldValueToCompare, value)) {
        const details = getExpressionChangedErrorDetails(lView, bindingIndex, oldValueToCompare, value);
        throwErrorIfNoChangesMode(oldValue === NO_CHANGE, details.oldValue, details.newValue, details.propName, lView);
      }
      return false;
    }
    lView[bindingIndex] = value;
    return true;
  }
}
function bindingUpdated2(lView, bindingIndex, exp1, exp2) {
  const different = bindingUpdated(lView, bindingIndex, exp1);
  return bindingUpdated(lView, bindingIndex + 1, exp2) || different;
}
function bindingUpdated3(lView, bindingIndex, exp1, exp2, exp3) {
  const different = bindingUpdated2(lView, bindingIndex, exp1, exp2);
  return bindingUpdated(lView, bindingIndex + 2, exp3) || different;
}
function bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4) {
  const different = bindingUpdated2(lView, bindingIndex, exp1, exp2);
  return bindingUpdated2(lView, bindingIndex + 2, exp3, exp4) || different;
}
function wrapListener(tNode, lView, listenerFn) {
  return function wrapListenerIn_markDirtyAndPreventDefault(event) {
    const startView = isComponentHost(tNode) ? getComponentLViewByIndex(tNode.index, lView) : lView;
    markViewDirty(
      startView,
      5
      /* NotificationSource.Listener */
    );
    const context2 = lView[CONTEXT];
    let result = executeListenerWithErrorHandling(lView, context2, listenerFn, event);
    let nextListenerFn = wrapListenerIn_markDirtyAndPreventDefault.__ngNextListenerFn__;
    while (nextListenerFn) {
      result = executeListenerWithErrorHandling(lView, context2, nextListenerFn, event) && result;
      nextListenerFn = nextListenerFn.__ngNextListenerFn__;
    }
    return result;
  };
}
function executeListenerWithErrorHandling(lView, context2, listenerFn, e) {
  const prevConsumer = setActiveConsumer(null);
  try {
    profiler(6, context2, listenerFn);
    return listenerFn(e) !== false;
  } catch (error) {
    handleUncaughtError(lView, error);
    return false;
  } finally {
    profiler(7, context2, listenerFn);
    setActiveConsumer(prevConsumer);
  }
}
function listenToDomEvent(tNode, tView, lView, eventTargetResolver, renderer, eventName, originalListener, wrappedListener) {
  ngDevMode && assertNotSame(wrappedListener, originalListener, "Expected wrapped and original listeners to be different.");
  const isTNodeDirectiveHost = isDirectiveHost(tNode);
  let hasCoalesced = false;
  let existingListener = null;
  if (!eventTargetResolver && isTNodeDirectiveHost) {
    existingListener = findExistingListener(tView, lView, eventName, tNode.index);
  }
  if (existingListener !== null) {
    const lastListenerFn = existingListener.__ngLastListenerFn__ || existingListener;
    lastListenerFn.__ngNextListenerFn__ = originalListener;
    existingListener.__ngLastListenerFn__ = originalListener;
    hasCoalesced = true;
  } else {
    const native = getNativeByTNode(tNode, lView);
    const target = eventTargetResolver ? eventTargetResolver(native) : native;
    stashEventListenerImpl(lView, target, eventName, wrappedListener);
    const cleanupFn = renderer.listen(target, eventName, wrappedListener);
    const idxOrTargetGetter = eventTargetResolver ? (_lView) => eventTargetResolver(unwrapRNode(_lView[tNode.index])) : tNode.index;
    storeListenerCleanup(idxOrTargetGetter, tView, lView, eventName, wrappedListener, cleanupFn, false);
  }
  return hasCoalesced;
}
function findExistingListener(tView, lView, eventName, tNodeIndex) {
  const tCleanup = tView.cleanup;
  if (tCleanup != null) {
    for (let i = 0; i < tCleanup.length - 1; i += 2) {
      const cleanupEventName = tCleanup[i];
      if (cleanupEventName === eventName && tCleanup[i + 1] === tNodeIndex) {
        const lCleanup = lView[CLEANUP];
        const listenerIdxInLCleanup = tCleanup[i + 2];
        return lCleanup && lCleanup.length > listenerIdxInLCleanup ? lCleanup[listenerIdxInLCleanup] : null;
      }
      if (typeof cleanupEventName === "string") {
        i += 2;
      }
    }
  }
  return null;
}
function storeListenerCleanup(indexOrTargetGetter, tView, lView, eventName, listenerFn, cleanup, isOutput) {
  const tCleanup = tView.firstCreatePass ? getOrCreateTViewCleanup(tView) : null;
  const lCleanup = getOrCreateLViewCleanup(lView);
  const index = lCleanup.length;
  lCleanup.push(listenerFn, cleanup);
  tCleanup && tCleanup.push(eventName, indexOrTargetGetter, index, (index + 1) * (isOutput ? -1 : 1));
}
function listenToOutput(tNode, lView, directiveIndex, lookupName, eventName, listenerFn) {
  ngDevMode && assertIndexInRange(lView, directiveIndex);
  const instance = lView[directiveIndex];
  const tView = lView[TVIEW];
  const def = tView.data[directiveIndex];
  const propertyName = def.outputs[lookupName];
  const output2 = instance[propertyName];
  if (ngDevMode && !isOutputSubscribable(output2)) {
    throw new Error(`@Output ${propertyName} not initialized in '${instance.constructor.name}'.`);
  }
  const subscription = output2.subscribe(listenerFn);
  storeListenerCleanup(tNode.index, tView, lView, eventName, listenerFn, subscription, true);
}
function isOutputSubscribable(value) {
  return value != null && typeof value.subscribe === "function";
}
var BINDING = /* @__PURE__ */ Symbol("BINDING");
var ComponentFactoryResolver2 = class extends ComponentFactoryResolver$1 {
  ngModule;
  /**
   * @param ngModule The NgModuleRef to which all resolved factories are bound.
   */
  constructor(ngModule) {
    super();
    this.ngModule = ngModule;
  }
  resolveComponentFactory(component) {
    ngDevMode && assertComponentType(component);
    const componentDef = getComponentDef(component);
    return new ComponentFactory2(componentDef, this.ngModule);
  }
};
function toInputRefArray(map3) {
  return Object.keys(map3).map((name2) => {
    const [propName, flags, transform] = map3[name2];
    const inputData = {
      propName,
      templateName: name2,
      isSignal: (flags & InputFlags.SignalBased) !== 0
    };
    if (transform) {
      inputData.transform = transform;
    }
    return inputData;
  });
}
function toOutputRefArray(map3) {
  return Object.keys(map3).map((name2) => ({ propName: map3[name2], templateName: name2 }));
}
function verifyNotAnOrphanComponent(componentDef) {
  if (false) {
    if (depsTracker.isOrphanComponent(componentDef.type)) {
      throw new RuntimeError(981, `Orphan component found! Trying to render the component ${debugStringifyTypeForError(componentDef.type)} without first loading the NgModule that declares it. It is recommended to make this component standalone in order to avoid this error. If this is not possible now, import the component's NgModule in the appropriate NgModule, or the standalone component in which you are trying to render this component. If this is a lazy import, load the NgModule lazily as well and use its module injector.`);
    }
  }
}
function createRootViewInjector(componentDef, environmentInjector, injector) {
  let realEnvironmentInjector = environmentInjector instanceof EnvironmentInjector ? environmentInjector : environmentInjector?.injector;
  if (realEnvironmentInjector && componentDef.getStandaloneInjector !== null) {
    realEnvironmentInjector = componentDef.getStandaloneInjector(realEnvironmentInjector) || realEnvironmentInjector;
  }
  const rootViewInjector = realEnvironmentInjector ? new ChainedInjector(injector, realEnvironmentInjector) : injector;
  return rootViewInjector;
}
function createRootLViewEnvironment(rootLViewInjector) {
  const rendererFactory = rootLViewInjector.get(RendererFactory2, null);
  if (rendererFactory === null) {
    throw new RuntimeError(407, ngDevMode && "Angular was not able to inject a renderer (RendererFactory2). Likely this is due to a broken DI hierarchy. Make sure that any injector used to create this component has a correct parent.");
  }
  const sanitizer = rootLViewInjector.get(Sanitizer, null);
  const changeDetectionScheduler = rootLViewInjector.get(ChangeDetectionScheduler, null);
  let ngReflect = false;
  if (typeof ngDevMode === "undefined" || ngDevMode) {
    ngReflect = rootLViewInjector.get(NG_REFLECT_ATTRS_FLAG, NG_REFLECT_ATTRS_FLAG_DEFAULT);
  }
  return {
    rendererFactory,
    sanitizer,
    changeDetectionScheduler,
    ngReflect
  };
}
function createHostElement(componentDef, render) {
  const tagName = (componentDef.selectors[0][0] || "div").toLowerCase();
  const namespace = tagName === "svg" ? SVG_NAMESPACE : tagName === "math" ? MATH_ML_NAMESPACE : null;
  return createElementNode(render, tagName, namespace);
}
var ComponentFactory2 = class extends ComponentFactory$1 {
  componentDef;
  ngModule;
  selector;
  componentType;
  ngContentSelectors;
  isBoundToModule;
  cachedInputs = null;
  cachedOutputs = null;
  get inputs() {
    this.cachedInputs ??= toInputRefArray(this.componentDef.inputs);
    return this.cachedInputs;
  }
  get outputs() {
    this.cachedOutputs ??= toOutputRefArray(this.componentDef.outputs);
    return this.cachedOutputs;
  }
  /**
   * @param componentDef The component definition.
   * @param ngModule The NgModuleRef to which the factory is bound.
   */
  constructor(componentDef, ngModule) {
    super();
    this.componentDef = componentDef;
    this.ngModule = ngModule;
    this.componentType = componentDef.type;
    this.selector = stringifyCSSSelectorList(componentDef.selectors);
    this.ngContentSelectors = componentDef.ngContentSelectors ?? [];
    this.isBoundToModule = !!ngModule;
  }
  create(injector, projectableNodes, rootSelectorOrNode, environmentInjector, directives, componentBindings) {
    profiler(
      22
      /* ProfilerEvent.DynamicComponentStart */
    );
    const prevConsumer = setActiveConsumer(null);
    try {
      const cmpDef = this.componentDef;
      ngDevMode && verifyNotAnOrphanComponent(cmpDef);
      const rootTView = createRootTView(rootSelectorOrNode, cmpDef, componentBindings, directives);
      const rootViewInjector = createRootViewInjector(cmpDef, environmentInjector || this.ngModule, injector);
      const environment = createRootLViewEnvironment(rootViewInjector);
      const hostRenderer = environment.rendererFactory.createRenderer(null, cmpDef);
      const hostElement = rootSelectorOrNode ? locateHostElement(hostRenderer, rootSelectorOrNode, cmpDef.encapsulation, rootViewInjector) : createHostElement(cmpDef, hostRenderer);
      const hasInputBindings = componentBindings?.some(isInputBinding) || directives?.some((d) => typeof d !== "function" && d.bindings.some(isInputBinding));
      const rootLView = createLView(null, rootTView, null, 512 | getInitialLViewFlagsFromDef(cmpDef), null, null, environment, hostRenderer, rootViewInjector, null, retrieveHydrationInfo(
        hostElement,
        rootViewInjector,
        true
        /* isRootView */
      ));
      rootLView[HEADER_OFFSET] = hostElement;
      enterView(rootLView);
      let componentView = null;
      try {
        const hostTNode = directiveHostFirstCreatePass(HEADER_OFFSET, rootLView, 2, "#host", () => rootTView.directiveRegistry, true, 0);
        if (hostElement) {
          setupStaticAttributes(hostRenderer, hostElement, hostTNode);
          attachPatchData(hostElement, rootLView);
        }
        createDirectivesInstances(rootTView, rootLView, hostTNode);
        executeContentQueries(rootTView, hostTNode, rootLView);
        directiveHostEndFirstCreatePass(rootTView, hostTNode);
        if (projectableNodes !== void 0) {
          projectNodes(hostTNode, this.ngContentSelectors, projectableNodes);
        }
        componentView = getComponentLViewByIndex(hostTNode.index, rootLView);
        rootLView[CONTEXT] = componentView[CONTEXT];
        renderView(rootTView, rootLView, null);
      } catch (e) {
        if (componentView !== null) {
          unregisterLView(componentView);
        }
        unregisterLView(rootLView);
        throw e;
      } finally {
        profiler(
          23
          /* ProfilerEvent.DynamicComponentEnd */
        );
        leaveView();
      }
      return new ComponentRef2(this.componentType, rootLView, !!hasInputBindings);
    } finally {
      setActiveConsumer(prevConsumer);
    }
  }
};
function createRootTView(rootSelectorOrNode, componentDef, componentBindings, directives) {
  const tAttributes = rootSelectorOrNode ? ["ng-version", "20.1.3"] : (
    // Extract attributes and classes from the first selector only to match VE behavior.
    extractAttrsAndClassesFromSelector(componentDef.selectors[0])
  );
  let creationBindings = null;
  let updateBindings = null;
  let varsToAllocate = 0;
  if (componentBindings) {
    for (const binding of componentBindings) {
      varsToAllocate += binding[BINDING].requiredVars;
      if (binding.create) {
        binding.targetIdx = 0;
        (creationBindings ??= []).push(binding);
      }
      if (binding.update) {
        binding.targetIdx = 0;
        (updateBindings ??= []).push(binding);
      }
    }
  }
  if (directives) {
    for (let i = 0; i < directives.length; i++) {
      const directive = directives[i];
      if (typeof directive !== "function") {
        for (const binding of directive.bindings) {
          varsToAllocate += binding[BINDING].requiredVars;
          const targetDirectiveIdx = i + 1;
          if (binding.create) {
            binding.targetIdx = targetDirectiveIdx;
            (creationBindings ??= []).push(binding);
          }
          if (binding.update) {
            binding.targetIdx = targetDirectiveIdx;
            (updateBindings ??= []).push(binding);
          }
        }
      }
    }
  }
  const directivesToApply = [componentDef];
  if (directives) {
    for (const directive of directives) {
      const directiveType = typeof directive === "function" ? directive : directive.type;
      const directiveDef = ngDevMode ? getDirectiveDefOrThrow(directiveType) : getDirectiveDef(directiveType);
      if (ngDevMode && !directiveDef.standalone) {
        throw new RuntimeError(907, `The ${stringifyForError(directiveType)} directive must be standalone in order to be applied to a dynamically-created component.`);
      }
      directivesToApply.push(directiveDef);
    }
  }
  const rootTView = createTView(0, null, getRootTViewTemplate(creationBindings, updateBindings), 1, varsToAllocate, directivesToApply, null, null, null, [tAttributes], null);
  return rootTView;
}
function getRootTViewTemplate(creationBindings, updateBindings) {
  if (!creationBindings && !updateBindings) {
    return null;
  }
  return (flags) => {
    if (flags & 1 && creationBindings) {
      for (const binding of creationBindings) {
        binding.create();
      }
    }
    if (flags & 2 && updateBindings) {
      for (const binding of updateBindings) {
        binding.update();
      }
    }
  };
}
function isInputBinding(binding) {
  const kind = binding[BINDING].kind;
  return kind === "input" || kind === "twoWay";
}
var ComponentRef2 = class extends ComponentRef$1 {
  _rootLView;
  _hasInputBindings;
  instance;
  hostView;
  changeDetectorRef;
  componentType;
  location;
  previousInputValues = null;
  _tNode;
  constructor(componentType, _rootLView, _hasInputBindings) {
    super();
    this._rootLView = _rootLView;
    this._hasInputBindings = _hasInputBindings;
    this._tNode = getTNode(_rootLView[TVIEW], HEADER_OFFSET);
    this.location = createElementRef(this._tNode, _rootLView);
    this.instance = getComponentLViewByIndex(this._tNode.index, _rootLView)[CONTEXT];
    this.hostView = this.changeDetectorRef = new ViewRef(
      _rootLView,
      void 0
      /* _cdRefInjectingView */
    );
    this.componentType = componentType;
  }
  setInput(name2, value) {
    if (this._hasInputBindings && ngDevMode) {
      throw new RuntimeError(317, "Cannot call `setInput` on a component that is using the `inputBinding` or `twoWayBinding` functions.");
    }
    const tNode = this._tNode;
    this.previousInputValues ??= /* @__PURE__ */ new Map();
    if (this.previousInputValues.has(name2) && Object.is(this.previousInputValues.get(name2), value)) {
      return;
    }
    const lView = this._rootLView;
    const hasSetInput = setAllInputsForProperty(tNode, lView[TVIEW], lView, name2, value);
    this.previousInputValues.set(name2, value);
    const childComponentLView = getComponentLViewByIndex(tNode.index, lView);
    markViewDirty(
      childComponentLView,
      1
      /* NotificationSource.SetInput */
    );
    if (ngDevMode && !hasSetInput) {
      const cmpNameForError = stringifyForError(this.componentType);
      let message = `Can't set value of the '${name2}' input on the '${cmpNameForError}' component. `;
      message += `Make sure that the '${name2}' property is declared as an input using the @Input() decorator or the input() function.`;
      reportUnknownPropertyError(message);
    }
  }
  get injector() {
    return new NodeInjector(this._tNode, this._rootLView);
  }
  destroy() {
    this.hostView.destroy();
  }
  onDestroy(callback) {
    this.hostView.onDestroy(callback);
  }
};
function projectNodes(tNode, ngContentSelectors, projectableNodes) {
  const projection = tNode.projection = [];
  for (let i = 0; i < ngContentSelectors.length; i++) {
    const nodesforSlot = projectableNodes[i];
    projection.push(nodesforSlot != null && nodesforSlot.length ? Array.from(nodesforSlot) : null);
  }
}
var ViewContainerRef = class {
  /**
   * @internal
   * @nocollapse
   */
  static __NG_ELEMENT_ID__ = injectViewContainerRef;
};
function injectViewContainerRef() {
  const previousTNode = getCurrentTNode();
  return createContainerRef(previousTNode, getLView());
}
var VE_ViewContainerRef = ViewContainerRef;
var R3ViewContainerRef = class ViewContainerRef2 extends VE_ViewContainerRef {
  _lContainer;
  _hostTNode;
  _hostLView;
  constructor(_lContainer, _hostTNode, _hostLView) {
    super();
    this._lContainer = _lContainer;
    this._hostTNode = _hostTNode;
    this._hostLView = _hostLView;
  }
  get element() {
    return createElementRef(this._hostTNode, this._hostLView);
  }
  get injector() {
    return new NodeInjector(this._hostTNode, this._hostLView);
  }
  /** @deprecated No replacement */
  get parentInjector() {
    const parentLocation = getParentInjectorLocation(this._hostTNode, this._hostLView);
    if (hasParentInjector(parentLocation)) {
      const parentView = getParentInjectorView(parentLocation, this._hostLView);
      const injectorIndex = getParentInjectorIndex(parentLocation);
      ngDevMode && assertNodeInjector(parentView, injectorIndex);
      const parentTNode = parentView[TVIEW].data[
        injectorIndex + 8
        /* NodeInjectorOffset.TNODE */
      ];
      return new NodeInjector(parentTNode, parentView);
    } else {
      return new NodeInjector(null, this._hostLView);
    }
  }
  clear() {
    while (this.length > 0) {
      this.remove(this.length - 1);
    }
  }
  get(index) {
    const viewRefs = getViewRefs(this._lContainer);
    return viewRefs !== null && viewRefs[index] || null;
  }
  get length() {
    return this._lContainer.length - CONTAINER_HEADER_OFFSET;
  }
  createEmbeddedView(templateRef, context2, indexOrOptions) {
    let index;
    let injector;
    if (typeof indexOrOptions === "number") {
      index = indexOrOptions;
    } else if (indexOrOptions != null) {
      index = indexOrOptions.index;
      injector = indexOrOptions.injector;
    }
    const dehydratedView = findMatchingDehydratedView(this._lContainer, templateRef.ssrId);
    const viewRef = templateRef.createEmbeddedViewImpl(context2 || {}, injector, dehydratedView);
    this.insertImpl(viewRef, index, shouldAddViewToDom(this._hostTNode, dehydratedView));
    return viewRef;
  }
  createComponent(componentFactoryOrType, indexOrOptions, injector, projectableNodes, environmentInjector, directives, bindings) {
    const isComponentFactory = componentFactoryOrType && !isType(componentFactoryOrType);
    let index;
    if (isComponentFactory) {
      if (ngDevMode) {
        assertEqual(typeof indexOrOptions !== "object", true, "It looks like Component factory was provided as the first argument and an options object as the second argument. This combination of arguments is incompatible. You can either change the first argument to provide Component type or change the second argument to be a number (representing an index at which to insert the new component's host view into this container)");
      }
      index = indexOrOptions;
    } else {
      if (ngDevMode) {
        assertDefined(getComponentDef(componentFactoryOrType), `Provided Component class doesn't contain Component definition. Please check whether provided class has @Component decorator.`);
        assertEqual(typeof indexOrOptions !== "number", true, "It looks like Component type was provided as the first argument and a number (representing an index at which to insert the new component's host view into this container as the second argument. This combination of arguments is incompatible. Please use an object as the second argument instead.");
      }
      const options = indexOrOptions || {};
      if (ngDevMode && options.environmentInjector && options.ngModuleRef) {
        throwError2(`Cannot pass both environmentInjector and ngModuleRef options to createComponent().`);
      }
      index = options.index;
      injector = options.injector;
      projectableNodes = options.projectableNodes;
      environmentInjector = options.environmentInjector || options.ngModuleRef;
      directives = options.directives;
      bindings = options.bindings;
    }
    const componentFactory = isComponentFactory ? componentFactoryOrType : new ComponentFactory2(getComponentDef(componentFactoryOrType));
    const contextInjector = injector || this.parentInjector;
    if (!environmentInjector && componentFactory.ngModule == null) {
      const _injector = isComponentFactory ? contextInjector : this.parentInjector;
      const result = _injector.get(EnvironmentInjector, null);
      if (result) {
        environmentInjector = result;
      }
    }
    const componentDef = getComponentDef(componentFactory.componentType ?? {});
    const dehydratedView = findMatchingDehydratedView(this._lContainer, componentDef?.id ?? null);
    const rNode = dehydratedView?.firstChild ?? null;
    const componentRef = componentFactory.create(contextInjector, projectableNodes, rNode, environmentInjector, directives, bindings);
    this.insertImpl(componentRef.hostView, index, shouldAddViewToDom(this._hostTNode, dehydratedView));
    return componentRef;
  }
  insert(viewRef, index) {
    return this.insertImpl(viewRef, index, true);
  }
  insertImpl(viewRef, index, addToDOM) {
    const lView = viewRef._lView;
    if (ngDevMode && viewRef.destroyed) {
      throw new Error("Cannot insert a destroyed View in a ViewContainer!");
    }
    if (viewAttachedToContainer(lView)) {
      const prevIdx = this.indexOf(viewRef);
      if (prevIdx !== -1) {
        this.detach(prevIdx);
      } else {
        const prevLContainer = lView[PARENT];
        ngDevMode && assertEqual(isLContainer(prevLContainer), true, "An attached view should have its PARENT point to a container.");
        const prevVCRef = new R3ViewContainerRef(prevLContainer, prevLContainer[T_HOST], prevLContainer[PARENT]);
        prevVCRef.detach(prevVCRef.indexOf(viewRef));
      }
    }
    const adjustedIdx = this._adjustIndex(index);
    const lContainer = this._lContainer;
    addLViewToLContainer(lContainer, lView, adjustedIdx, addToDOM);
    viewRef.attachToViewContainerRef();
    addToArray(getOrCreateViewRefs(lContainer), adjustedIdx, viewRef);
    return viewRef;
  }
  move(viewRef, newIndex) {
    if (ngDevMode && viewRef.destroyed) {
      throw new Error("Cannot move a destroyed View in a ViewContainer!");
    }
    return this.insert(viewRef, newIndex);
  }
  indexOf(viewRef) {
    const viewRefsArr = getViewRefs(this._lContainer);
    return viewRefsArr !== null ? viewRefsArr.indexOf(viewRef) : -1;
  }
  remove(index) {
    const adjustedIdx = this._adjustIndex(index, -1);
    const detachedView = detachView(this._lContainer, adjustedIdx);
    if (detachedView) {
      removeFromArray(getOrCreateViewRefs(this._lContainer), adjustedIdx);
      destroyLView(detachedView[TVIEW], detachedView);
    }
  }
  detach(index) {
    const adjustedIdx = this._adjustIndex(index, -1);
    const view = detachView(this._lContainer, adjustedIdx);
    const wasDetached = view && removeFromArray(getOrCreateViewRefs(this._lContainer), adjustedIdx) != null;
    return wasDetached ? new ViewRef(view) : null;
  }
  _adjustIndex(index, shift = 0) {
    if (index == null) {
      return this.length + shift;
    }
    if (ngDevMode) {
      assertGreaterThan(index, -1, `ViewRef index must be positive, got ${index}`);
      assertLessThan(index, this.length + 1 + shift, "index");
    }
    return index;
  }
};
function getViewRefs(lContainer) {
  return lContainer[VIEW_REFS];
}
function getOrCreateViewRefs(lContainer) {
  return lContainer[VIEW_REFS] || (lContainer[VIEW_REFS] = []);
}
function createContainerRef(hostTNode, hostLView) {
  ngDevMode && assertTNodeType(
    hostTNode,
    12 | 3
    /* TNodeType.AnyRNode */
  );
  let lContainer;
  const slotValue = hostLView[hostTNode.index];
  if (isLContainer(slotValue)) {
    lContainer = slotValue;
  } else {
    lContainer = createLContainer(slotValue, hostLView, null, hostTNode);
    hostLView[hostTNode.index] = lContainer;
    addToEndOfViewTree(hostLView, lContainer);
  }
  _locateOrCreateAnchorNode(lContainer, hostLView, hostTNode, slotValue);
  return new R3ViewContainerRef(lContainer, hostTNode, hostLView);
}
function insertAnchorNode(hostLView, hostTNode) {
  const renderer = hostLView[RENDERER];
  const commentNode = renderer.createComment(ngDevMode ? "container" : "");
  const hostNative = getNativeByTNode(hostTNode, hostLView);
  const parentOfHostNative = renderer.parentNode(hostNative);
  nativeInsertBefore(renderer, parentOfHostNative, commentNode, renderer.nextSibling(hostNative), false);
  return commentNode;
}
var _locateOrCreateAnchorNode = createAnchorNode;
var _populateDehydratedViewsInLContainer = () => false;
function populateDehydratedViewsInLContainer(lContainer, tNode, hostLView) {
  return _populateDehydratedViewsInLContainer(lContainer, tNode, hostLView);
}
function createAnchorNode(lContainer, hostLView, hostTNode, slotValue) {
  if (lContainer[NATIVE])
    return;
  let commentNode;
  if (hostTNode.type & 8) {
    commentNode = unwrapRNode(slotValue);
  } else {
    commentNode = insertAnchorNode(hostLView, hostTNode);
  }
  lContainer[NATIVE] = commentNode;
}
var LQuery_ = class _LQuery_ {
  queryList;
  matches = null;
  constructor(queryList) {
    this.queryList = queryList;
  }
  clone() {
    return new _LQuery_(this.queryList);
  }
  setDirty() {
    this.queryList.setDirty();
  }
};
var LQueries_ = class _LQueries_ {
  queries;
  constructor(queries = []) {
    this.queries = queries;
  }
  createEmbeddedView(tView) {
    const tQueries = tView.queries;
    if (tQueries !== null) {
      const noOfInheritedQueries = tView.contentQueries !== null ? tView.contentQueries[0] : tQueries.length;
      const viewLQueries = [];
      for (let i = 0; i < noOfInheritedQueries; i++) {
        const tQuery = tQueries.getByIndex(i);
        const parentLQuery = this.queries[tQuery.indexInDeclarationView];
        viewLQueries.push(parentLQuery.clone());
      }
      return new _LQueries_(viewLQueries);
    }
    return null;
  }
  insertView(tView) {
    this.dirtyQueriesWithMatches(tView);
  }
  detachView(tView) {
    this.dirtyQueriesWithMatches(tView);
  }
  finishViewCreation(tView) {
    this.dirtyQueriesWithMatches(tView);
  }
  dirtyQueriesWithMatches(tView) {
    for (let i = 0; i < this.queries.length; i++) {
      if (getTQuery(tView, i).matches !== null) {
        this.queries[i].setDirty();
      }
    }
  }
};
var TQueryMetadata_ = class {
  flags;
  read;
  predicate;
  constructor(predicate, flags, read = null) {
    this.flags = flags;
    this.read = read;
    if (typeof predicate === "string") {
      this.predicate = splitQueryMultiSelectors(predicate);
    } else {
      this.predicate = predicate;
    }
  }
};
var TQueries_ = class _TQueries_ {
  queries;
  constructor(queries = []) {
    this.queries = queries;
  }
  elementStart(tView, tNode) {
    ngDevMode && assertFirstCreatePass(tView, "Queries should collect results on the first template pass only");
    for (let i = 0; i < this.queries.length; i++) {
      this.queries[i].elementStart(tView, tNode);
    }
  }
  elementEnd(tNode) {
    for (let i = 0; i < this.queries.length; i++) {
      this.queries[i].elementEnd(tNode);
    }
  }
  embeddedTView(tNode) {
    let queriesForTemplateRef = null;
    for (let i = 0; i < this.length; i++) {
      const childQueryIndex = queriesForTemplateRef !== null ? queriesForTemplateRef.length : 0;
      const tqueryClone = this.getByIndex(i).embeddedTView(tNode, childQueryIndex);
      if (tqueryClone) {
        tqueryClone.indexInDeclarationView = i;
        if (queriesForTemplateRef !== null) {
          queriesForTemplateRef.push(tqueryClone);
        } else {
          queriesForTemplateRef = [tqueryClone];
        }
      }
    }
    return queriesForTemplateRef !== null ? new _TQueries_(queriesForTemplateRef) : null;
  }
  template(tView, tNode) {
    ngDevMode && assertFirstCreatePass(tView, "Queries should collect results on the first template pass only");
    for (let i = 0; i < this.queries.length; i++) {
      this.queries[i].template(tView, tNode);
    }
  }
  getByIndex(index) {
    ngDevMode && assertIndexInRange(this.queries, index);
    return this.queries[index];
  }
  get length() {
    return this.queries.length;
  }
  track(tquery) {
    this.queries.push(tquery);
  }
};
var TQuery_ = class _TQuery_ {
  metadata;
  matches = null;
  indexInDeclarationView = -1;
  crossesNgTemplate = false;
  /**
   * A node index on which a query was declared (-1 for view queries and ones inherited from the
   * declaration template). We use this index (alongside with _appliesToNextNode flag) to know
   * when to apply content queries to elements in a template.
   */
  _declarationNodeIndex;
  /**
   * A flag indicating if a given query still applies to nodes it is crossing. We use this flag
   * (alongside with _declarationNodeIndex) to know when to stop applying content queries to
   * elements in a template.
   */
  _appliesToNextNode = true;
  constructor(metadata, nodeIndex = -1) {
    this.metadata = metadata;
    this._declarationNodeIndex = nodeIndex;
  }
  elementStart(tView, tNode) {
    if (this.isApplyingToNode(tNode)) {
      this.matchTNode(tView, tNode);
    }
  }
  elementEnd(tNode) {
    if (this._declarationNodeIndex === tNode.index) {
      this._appliesToNextNode = false;
    }
  }
  template(tView, tNode) {
    this.elementStart(tView, tNode);
  }
  embeddedTView(tNode, childQueryIndex) {
    if (this.isApplyingToNode(tNode)) {
      this.crossesNgTemplate = true;
      this.addMatch(-tNode.index, childQueryIndex);
      return new _TQuery_(this.metadata);
    }
    return null;
  }
  isApplyingToNode(tNode) {
    if (this._appliesToNextNode && (this.metadata.flags & 1) !== 1) {
      const declarationNodeIdx = this._declarationNodeIndex;
      let parent = tNode.parent;
      while (parent !== null && parent.type & 8 && parent.index !== declarationNodeIdx) {
        parent = parent.parent;
      }
      return declarationNodeIdx === (parent !== null ? parent.index : -1);
    }
    return this._appliesToNextNode;
  }
  matchTNode(tView, tNode) {
    const predicate = this.metadata.predicate;
    if (Array.isArray(predicate)) {
      for (let i = 0; i < predicate.length; i++) {
        const name2 = predicate[i];
        this.matchTNodeWithReadOption(tView, tNode, getIdxOfMatchingSelector(tNode, name2));
        this.matchTNodeWithReadOption(tView, tNode, locateDirectiveOrProvider(tNode, tView, name2, false, false));
      }
    } else {
      if (predicate === TemplateRef) {
        if (tNode.type & 4) {
          this.matchTNodeWithReadOption(tView, tNode, -1);
        }
      } else {
        this.matchTNodeWithReadOption(tView, tNode, locateDirectiveOrProvider(tNode, tView, predicate, false, false));
      }
    }
  }
  matchTNodeWithReadOption(tView, tNode, nodeMatchIdx) {
    if (nodeMatchIdx !== null) {
      const read = this.metadata.read;
      if (read !== null) {
        if (read === ElementRef || read === ViewContainerRef || read === TemplateRef && tNode.type & 4) {
          this.addMatch(tNode.index, -2);
        } else {
          const directiveOrProviderIdx = locateDirectiveOrProvider(tNode, tView, read, false, false);
          if (directiveOrProviderIdx !== null) {
            this.addMatch(tNode.index, directiveOrProviderIdx);
          }
        }
      } else {
        this.addMatch(tNode.index, nodeMatchIdx);
      }
    }
  }
  addMatch(tNodeIdx, matchIdx) {
    if (this.matches === null) {
      this.matches = [tNodeIdx, matchIdx];
    } else {
      this.matches.push(tNodeIdx, matchIdx);
    }
  }
};
function getIdxOfMatchingSelector(tNode, selector) {
  const localNames = tNode.localNames;
  if (localNames !== null) {
    for (let i = 0; i < localNames.length; i += 2) {
      if (localNames[i] === selector) {
        return localNames[i + 1];
      }
    }
  }
  return null;
}
function createResultByTNodeType(tNode, currentView) {
  if (tNode.type & (3 | 8)) {
    return createElementRef(tNode, currentView);
  } else if (tNode.type & 4) {
    return createTemplateRef(tNode, currentView);
  }
  return null;
}
function createResultForNode(lView, tNode, matchingIdx, read) {
  if (matchingIdx === -1) {
    return createResultByTNodeType(tNode, lView);
  } else if (matchingIdx === -2) {
    return createSpecialToken(lView, tNode, read);
  } else {
    return getNodeInjectable(lView, lView[TVIEW], matchingIdx, tNode);
  }
}
function createSpecialToken(lView, tNode, read) {
  if (read === ElementRef) {
    return createElementRef(tNode, lView);
  } else if (read === TemplateRef) {
    return createTemplateRef(tNode, lView);
  } else if (read === ViewContainerRef) {
    ngDevMode && assertTNodeType(
      tNode,
      3 | 12
      /* TNodeType.AnyContainer */
    );
    return createContainerRef(tNode, lView);
  } else {
    ngDevMode && throwError2(`Special token to read should be one of ElementRef, TemplateRef or ViewContainerRef but got ${stringify(read)}.`);
  }
}
function materializeViewResults(tView, lView, tQuery, queryIndex) {
  const lQuery = lView[QUERIES].queries[queryIndex];
  if (lQuery.matches === null) {
    const tViewData = tView.data;
    const tQueryMatches = tQuery.matches;
    const result = [];
    for (let i = 0; tQueryMatches !== null && i < tQueryMatches.length; i += 2) {
      const matchedNodeIdx = tQueryMatches[i];
      if (matchedNodeIdx < 0) {
        result.push(null);
      } else {
        ngDevMode && assertIndexInRange(tViewData, matchedNodeIdx);
        const tNode = tViewData[matchedNodeIdx];
        result.push(createResultForNode(lView, tNode, tQueryMatches[i + 1], tQuery.metadata.read));
      }
    }
    lQuery.matches = result;
  }
  return lQuery.matches;
}
function collectQueryResults(tView, lView, queryIndex, result) {
  const tQuery = tView.queries.getByIndex(queryIndex);
  const tQueryMatches = tQuery.matches;
  if (tQueryMatches !== null) {
    const lViewResults = materializeViewResults(tView, lView, tQuery, queryIndex);
    for (let i = 0; i < tQueryMatches.length; i += 2) {
      const tNodeIdx = tQueryMatches[i];
      if (tNodeIdx > 0) {
        result.push(lViewResults[i / 2]);
      } else {
        const childQueryIndex = tQueryMatches[i + 1];
        const declarationLContainer = lView[-tNodeIdx];
        ngDevMode && assertLContainer(declarationLContainer);
        for (let i2 = CONTAINER_HEADER_OFFSET; i2 < declarationLContainer.length; i2++) {
          const embeddedLView = declarationLContainer[i2];
          if (embeddedLView[DECLARATION_LCONTAINER] === embeddedLView[PARENT]) {
            collectQueryResults(embeddedLView[TVIEW], embeddedLView, childQueryIndex, result);
          }
        }
        if (declarationLContainer[MOVED_VIEWS] !== null) {
          const embeddedLViews = declarationLContainer[MOVED_VIEWS];
          for (let i2 = 0; i2 < embeddedLViews.length; i2++) {
            const embeddedLView = embeddedLViews[i2];
            collectQueryResults(embeddedLView[TVIEW], embeddedLView, childQueryIndex, result);
          }
        }
      }
    }
  }
  return result;
}
function loadQueryInternal(lView, queryIndex) {
  ngDevMode && assertDefined(lView[QUERIES], "LQueries should be defined when trying to load a query");
  ngDevMode && assertIndexInRange(lView[QUERIES].queries, queryIndex);
  return lView[QUERIES].queries[queryIndex].queryList;
}
function createLQuery(tView, lView, flags) {
  const queryList = new QueryList(
    (flags & 4) === 4
    /* QueryFlags.emitDistinctChangesOnly */
  );
  storeCleanupWithContext(tView, lView, queryList, queryList.destroy);
  const lQueries = (lView[QUERIES] ??= new LQueries_()).queries;
  return lQueries.push(new LQuery_(queryList)) - 1;
}
function createViewQuery(predicate, flags, read) {
  ngDevMode && assertNumber(flags, "Expecting flags");
  const tView = getTView();
  if (tView.firstCreatePass) {
    createTQuery(tView, new TQueryMetadata_(predicate, flags, read), -1);
    if ((flags & 2) === 2) {
      tView.staticViewQueries = true;
    }
  }
  return createLQuery(tView, getLView(), flags);
}
function createContentQuery(directiveIndex, predicate, flags, read) {
  ngDevMode && assertNumber(flags, "Expecting flags");
  const tView = getTView();
  if (tView.firstCreatePass) {
    const tNode = getCurrentTNode();
    createTQuery(tView, new TQueryMetadata_(predicate, flags, read), tNode.index);
    saveContentQueryAndDirectiveIndex(tView, directiveIndex);
    if ((flags & 2) === 2) {
      tView.staticContentQueries = true;
    }
  }
  return createLQuery(tView, getLView(), flags);
}
function splitQueryMultiSelectors(locator) {
  return locator.split(",").map((s) => s.trim());
}
function createTQuery(tView, metadata, nodeIndex) {
  if (tView.queries === null)
    tView.queries = new TQueries_();
  tView.queries.track(new TQuery_(metadata, nodeIndex));
}
function saveContentQueryAndDirectiveIndex(tView, directiveIndex) {
  const tViewContentQueries = tView.contentQueries || (tView.contentQueries = []);
  const lastSavedDirectiveIndex = tViewContentQueries.length ? tViewContentQueries[tViewContentQueries.length - 1] : -1;
  if (directiveIndex !== lastSavedDirectiveIndex) {
    tViewContentQueries.push(tView.queries.length - 1, directiveIndex);
  }
}
function getTQuery(tView, index) {
  ngDevMode && assertDefined(tView.queries, "TQueries must be defined to retrieve a TQuery");
  return tView.queries.getByIndex(index);
}
function getQueryResults(lView, queryIndex) {
  const tView = lView[TVIEW];
  const tQuery = getTQuery(tView, queryIndex);
  return tQuery.crossesNgTemplate ? collectQueryResults(tView, lView, queryIndex, []) : materializeViewResults(tView, lView, tQuery, queryIndex);
}
function createQuerySignalFn(firstOnly, required, opts) {
  let node;
  const signalFn = createComputed(() => {
    node._dirtyCounter();
    const value = refreshSignalQuery(node, firstOnly);
    if (required && value === void 0) {
      throw new RuntimeError(-951, ngDevMode && "Child query result is required but no value is available.");
    }
    return value;
  });
  node = signalFn[SIGNAL];
  node._dirtyCounter = signal(0);
  node._flatValue = void 0;
  if (ngDevMode) {
    signalFn.toString = () => `[Query Signal]`;
    node.debugName = opts?.debugName;
  }
  return signalFn;
}
function createSingleResultOptionalQuerySignalFn(opts) {
  return createQuerySignalFn(
    /* firstOnly */
    true,
    /* required */
    false,
    opts
  );
}
function createSingleResultRequiredQuerySignalFn(opts) {
  return createQuerySignalFn(
    /* firstOnly */
    true,
    /* required */
    true,
    opts
  );
}
function createMultiResultQuerySignalFn(opts) {
  return createQuerySignalFn(
    /* firstOnly */
    false,
    /* required */
    false,
    opts
  );
}
function bindQueryToSignal(target, queryIndex) {
  const node = target[SIGNAL];
  node._lView = getLView();
  node._queryIndex = queryIndex;
  node._queryList = loadQueryInternal(node._lView, queryIndex);
  node._queryList.onDirty(() => node._dirtyCounter.update((v) => v + 1));
}
function refreshSignalQuery(node, firstOnly) {
  const lView = node._lView;
  const queryIndex = node._queryIndex;
  if (lView === void 0 || queryIndex === void 0 || lView[FLAGS] & 4) {
    return firstOnly ? void 0 : EMPTY_ARRAY;
  }
  const queryList = loadQueryInternal(lView, queryIndex);
  const results = getQueryResults(lView, queryIndex);
  queryList.reset(results, unwrapElementRef);
  if (firstOnly) {
    return queryList.first;
  } else {
    const resultChanged = queryList._changesDetected;
    if (resultChanged || node._flatValue === void 0) {
      return node._flatValue = queryList.toArray();
    }
    return node._flatValue;
  }
}
function resolveComponentResources(resourceResolver) {
  const componentResolved = [];
  const urlMap = /* @__PURE__ */ new Map();
  function cachedResourceResolve(url) {
    let promise = urlMap.get(url);
    if (!promise) {
      const resp = resourceResolver(url);
      urlMap.set(url, promise = resp.then(unwrapResponse));
    }
    return promise;
  }
  componentResourceResolutionQueue.forEach((component, type) => {
    const promises = [];
    if (component.templateUrl) {
      promises.push(cachedResourceResolve(component.templateUrl).then((template) => {
        component.template = template;
      }));
    }
    const styles = typeof component.styles === "string" ? [component.styles] : component.styles || [];
    component.styles = styles;
    if (component.styleUrl && component.styleUrls?.length) {
      throw new Error("@Component cannot define both `styleUrl` and `styleUrls`. Use `styleUrl` if the component has one stylesheet, or `styleUrls` if it has multiple");
    } else if (component.styleUrls?.length) {
      const styleOffset = component.styles.length;
      const styleUrls = component.styleUrls;
      component.styleUrls.forEach((styleUrl, index) => {
        styles.push("");
        promises.push(cachedResourceResolve(styleUrl).then((style) => {
          styles[styleOffset + index] = style;
          styleUrls.splice(styleUrls.indexOf(styleUrl), 1);
          if (styleUrls.length == 0) {
            component.styleUrls = void 0;
          }
        }));
      });
    } else if (component.styleUrl) {
      promises.push(cachedResourceResolve(component.styleUrl).then((style) => {
        styles.push(style);
        component.styleUrl = void 0;
      }));
    }
    const fullyResolved = Promise.all(promises).then(() => componentDefResolved(type));
    componentResolved.push(fullyResolved);
  });
  clearResolutionOfComponentResourcesQueue();
  return Promise.all(componentResolved).then(() => void 0);
}
var componentResourceResolutionQueue = /* @__PURE__ */ new Map();
var componentDefPendingResolution = /* @__PURE__ */ new Set();
function maybeQueueResolutionOfComponentResources(type, metadata) {
  if (componentNeedsResolution(metadata)) {
    componentResourceResolutionQueue.set(type, metadata);
    componentDefPendingResolution.add(type);
  }
}
function componentNeedsResolution(component) {
  return !!(component.templateUrl && !component.hasOwnProperty("template") || component.styleUrls && component.styleUrls.length || component.styleUrl);
}
function clearResolutionOfComponentResourcesQueue() {
  const old = componentResourceResolutionQueue;
  componentResourceResolutionQueue = /* @__PURE__ */ new Map();
  return old;
}
function isComponentResourceResolutionQueueEmpty() {
  return componentResourceResolutionQueue.size === 0;
}
function unwrapResponse(response) {
  return typeof response == "string" ? response : response.text();
}
function componentDefResolved(type) {
  componentDefPendingResolution.delete(type);
}
var modules = /* @__PURE__ */ new Map();
var checkForDuplicateNgModules = true;
function assertSameOrNotExisting(id, type, incoming) {
  if (type && type !== incoming && checkForDuplicateNgModules) {
    throw new Error(`Duplicate module registered for ${id} - ${stringify(type)} vs ${stringify(type.name)}`);
  }
}
function registerNgModuleType(ngModuleType, id) {
  const existing = modules.get(id) || null;
  assertSameOrNotExisting(id, existing, ngModuleType);
  modules.set(id, ngModuleType);
}
function \u0275\u0275validateIframeAttribute(attrValue, tagName, attrName) {
  const lView = getLView();
  const tNode = getSelectedTNode();
  const element = getNativeByTNode(tNode, lView);
  if (tNode.type === 2 && tagName.toLowerCase() === "iframe") {
    const iframe = element;
    iframe.src = "";
    iframe.srcdoc = trustedHTMLFromString("");
    nativeRemoveNode(lView[RENDERER], iframe);
    const errorMessage = ngDevMode && `Angular has detected that the \`${attrName}\` was applied as a binding to an <iframe>${getTemplateLocationDetails(lView)}. For security reasons, the \`${attrName}\` can be set on an <iframe> as a static attribute only. 
To fix this, switch the \`${attrName}\` binding to a static attribute in a template or in host bindings section.`;
    throw new RuntimeError(-910, errorMessage);
  }
  return attrValue;
}
var markedFeatures = /* @__PURE__ */ new Set();
function performanceMarkFeature(feature) {
  if (markedFeatures.has(feature)) {
    return;
  }
  markedFeatures.add(feature);
  performance?.mark?.("mark_feature_usage", { detail: { feature } });
}
var NgModuleRef$1 = class NgModuleRef {
};
var NgModuleFactory$1 = class NgModuleFactory {
};
function createNgModule(ngModule, parentInjector) {
  return new NgModuleRef2(ngModule, parentInjector ?? null, []);
}
var NgModuleRef2 = class extends NgModuleRef$1 {
  ngModuleType;
  _parent;
  // tslint:disable-next-line:require-internal-with-underscore
  _bootstrapComponents = [];
  _r3Injector;
  instance;
  destroyCbs = [];
  // When bootstrapping a module we have a dependency graph that looks like this:
  // ApplicationRef -> ComponentFactoryResolver -> NgModuleRef. The problem is that if the
  // module being resolved tries to inject the ComponentFactoryResolver, it'll create a
  // circular dependency which will result in a runtime error, because the injector doesn't
  // exist yet. We work around the issue by creating the ComponentFactoryResolver ourselves
  // and providing it, rather than letting the injector resolve it.
  componentFactoryResolver = new ComponentFactoryResolver2(this);
  constructor(ngModuleType, _parent, additionalProviders, runInjectorInitializers = true) {
    super();
    this.ngModuleType = ngModuleType;
    this._parent = _parent;
    const ngModuleDef = getNgModuleDef(ngModuleType);
    ngDevMode && assertDefined(ngModuleDef, `NgModule '${stringify(ngModuleType)}' is not a subtype of 'NgModuleType'.`);
    this._bootstrapComponents = maybeUnwrapFn(ngModuleDef.bootstrap);
    this._r3Injector = createInjectorWithoutInjectorInstances(ngModuleType, _parent, [
      { provide: NgModuleRef$1, useValue: this },
      {
        provide: ComponentFactoryResolver$1,
        useValue: this.componentFactoryResolver
      },
      ...additionalProviders
    ], stringify(ngModuleType), /* @__PURE__ */ new Set(["environment"]));
    if (runInjectorInitializers) {
      this.resolveInjectorInitializers();
    }
  }
  resolveInjectorInitializers() {
    this._r3Injector.resolveInjectorInitializers();
    this.instance = this._r3Injector.get(this.ngModuleType);
  }
  get injector() {
    return this._r3Injector;
  }
  destroy() {
    ngDevMode && assertDefined(this.destroyCbs, "NgModule already destroyed");
    const injector = this._r3Injector;
    !injector.destroyed && injector.destroy();
    this.destroyCbs.forEach((fn) => fn());
    this.destroyCbs = null;
  }
  onDestroy(callback) {
    ngDevMode && assertDefined(this.destroyCbs, "NgModule already destroyed");
    this.destroyCbs.push(callback);
  }
};
var NgModuleFactory2 = class extends NgModuleFactory$1 {
  moduleType;
  constructor(moduleType) {
    super();
    this.moduleType = moduleType;
  }
  create(parentInjector) {
    return new NgModuleRef2(this.moduleType, parentInjector, []);
  }
};
function createNgModuleRefWithProviders(moduleType, parentInjector, additionalProviders) {
  return new NgModuleRef2(moduleType, parentInjector, additionalProviders, false);
}
var EnvironmentNgModuleRefAdapter = class extends NgModuleRef$1 {
  injector;
  componentFactoryResolver = new ComponentFactoryResolver2(this);
  instance = null;
  constructor(config2) {
    super();
    const injector = new R3Injector([
      ...config2.providers,
      { provide: NgModuleRef$1, useValue: this },
      { provide: ComponentFactoryResolver$1, useValue: this.componentFactoryResolver }
    ], config2.parent || getNullInjector(), config2.debugName, /* @__PURE__ */ new Set(["environment"]));
    this.injector = injector;
    if (config2.runEnvironmentInitializers) {
      injector.resolveInjectorInitializers();
    }
  }
  destroy() {
    this.injector.destroy();
  }
  onDestroy(callback) {
    this.injector.onDestroy(callback);
  }
};
function createEnvironmentInjector(providers, parent, debugName = null) {
  const adapter = new EnvironmentNgModuleRefAdapter({
    providers,
    parent,
    debugName,
    runEnvironmentInitializers: true
  });
  return adapter.injector;
}
var StandaloneService = class _StandaloneService {
  _injector;
  cachedInjectors = /* @__PURE__ */ new Map();
  constructor(_injector) {
    this._injector = _injector;
  }
  getOrCreateStandaloneInjector(componentDef) {
    if (!componentDef.standalone) {
      return null;
    }
    if (!this.cachedInjectors.has(componentDef)) {
      const providers = internalImportProvidersFrom(false, componentDef.type);
      const standaloneInjector = providers.length > 0 ? createEnvironmentInjector([providers], this._injector, `Standalone[${componentDef.type.name}]`) : null;
      this.cachedInjectors.set(componentDef, standaloneInjector);
    }
    return this.cachedInjectors.get(componentDef);
  }
  ngOnDestroy() {
    try {
      for (const injector of this.cachedInjectors.values()) {
        if (injector !== null) {
          injector.destroy();
        }
      }
    } finally {
      this.cachedInjectors.clear();
    }
  }
  /** @nocollapse */
  static \u0275prov = (
    /** @pureOrBreakMyCode */
    /* @__PURE__ */ \u0275\u0275defineInjectable({
      token: _StandaloneService,
      providedIn: "environment",
      factory: () => new _StandaloneService(\u0275\u0275inject(EnvironmentInjector))
    })
  );
};
function \u0275\u0275defineComponent(componentDefinition) {
  return noSideEffects(() => {
    (typeof ngDevMode === "undefined" || ngDevMode) && initNgDevMode();
    const baseDef = getNgDirectiveDef(componentDefinition);
    const def = __spreadProps(__spreadValues({}, baseDef), {
      decls: componentDefinition.decls,
      vars: componentDefinition.vars,
      template: componentDefinition.template,
      consts: componentDefinition.consts || null,
      ngContentSelectors: componentDefinition.ngContentSelectors,
      onPush: componentDefinition.changeDetection === ChangeDetectionStrategy.OnPush,
      directiveDefs: null,
      // assigned in noSideEffects
      pipeDefs: null,
      // assigned in noSideEffects
      dependencies: baseDef.standalone && componentDefinition.dependencies || null,
      getStandaloneInjector: baseDef.standalone ? (parentInjector) => {
        return parentInjector.get(StandaloneService).getOrCreateStandaloneInjector(def);
      } : null,
      getExternalStyles: null,
      signals: componentDefinition.signals ?? false,
      data: componentDefinition.data || {},
      encapsulation: componentDefinition.encapsulation || ViewEncapsulation.Emulated,
      styles: componentDefinition.styles || EMPTY_ARRAY,
      _: null,
      schemas: componentDefinition.schemas || null,
      tView: null,
      id: ""
    });
    if (baseDef.standalone) {
      performanceMarkFeature("NgStandalone");
    }
    initFeatures(def);
    const dependencies = componentDefinition.dependencies;
    def.directiveDefs = extractDefListOrFactory(dependencies, extractDirectiveDef);
    def.pipeDefs = extractDefListOrFactory(dependencies, getPipeDef);
    def.id = getComponentId(def);
    return def;
  });
}
function extractDirectiveDef(type) {
  return getComponentDef(type) || getDirectiveDef(type);
}
function \u0275\u0275defineNgModule(def) {
  return noSideEffects(() => {
    const res = {
      type: def.type,
      bootstrap: def.bootstrap || EMPTY_ARRAY,
      declarations: def.declarations || EMPTY_ARRAY,
      imports: def.imports || EMPTY_ARRAY,
      exports: def.exports || EMPTY_ARRAY,
      transitiveCompileScopes: null,
      schemas: def.schemas || null,
      id: def.id || null
    };
    return res;
  });
}
function parseAndConvertInputsForDefinition(obj, declaredInputs) {
  if (obj == null)
    return EMPTY_OBJ;
  const newLookup = {};
  for (const minifiedKey in obj) {
    if (obj.hasOwnProperty(minifiedKey)) {
      const value = obj[minifiedKey];
      let publicName;
      let declaredName;
      let inputFlags;
      let transform;
      if (Array.isArray(value)) {
        inputFlags = value[0];
        publicName = value[1];
        declaredName = value[2] ?? publicName;
        transform = value[3] || null;
      } else {
        publicName = value;
        declaredName = value;
        inputFlags = InputFlags.None;
        transform = null;
      }
      newLookup[publicName] = [minifiedKey, inputFlags, transform];
      declaredInputs[publicName] = declaredName;
    }
  }
  return newLookup;
}
function parseAndConvertOutputsForDefinition(obj) {
  if (obj == null)
    return EMPTY_OBJ;
  const newLookup = {};
  for (const minifiedKey in obj) {
    if (obj.hasOwnProperty(minifiedKey)) {
      newLookup[obj[minifiedKey]] = minifiedKey;
    }
  }
  return newLookup;
}
function \u0275\u0275defineDirective(directiveDefinition) {
  return noSideEffects(() => {
    const def = getNgDirectiveDef(directiveDefinition);
    initFeatures(def);
    return def;
  });
}
function \u0275\u0275definePipe(pipeDef) {
  return {
    type: pipeDef.type,
    name: pipeDef.name,
    factory: null,
    pure: pipeDef.pure !== false,
    standalone: pipeDef.standalone ?? true,
    onDestroy: pipeDef.type.prototype.ngOnDestroy || null
  };
}
function getNgDirectiveDef(directiveDefinition) {
  const declaredInputs = {};
  return {
    type: directiveDefinition.type,
    providersResolver: null,
    factory: null,
    hostBindings: directiveDefinition.hostBindings || null,
    hostVars: directiveDefinition.hostVars || 0,
    hostAttrs: directiveDefinition.hostAttrs || null,
    contentQueries: directiveDefinition.contentQueries || null,
    declaredInputs,
    inputConfig: directiveDefinition.inputs || EMPTY_OBJ,
    exportAs: directiveDefinition.exportAs || null,
    standalone: directiveDefinition.standalone ?? true,
    signals: directiveDefinition.signals === true,
    selectors: directiveDefinition.selectors || EMPTY_ARRAY,
    viewQuery: directiveDefinition.viewQuery || null,
    features: directiveDefinition.features || null,
    setInput: null,
    resolveHostDirectives: null,
    hostDirectives: null,
    inputs: parseAndConvertInputsForDefinition(directiveDefinition.inputs, declaredInputs),
    outputs: parseAndConvertOutputsForDefinition(directiveDefinition.outputs),
    debugInfo: null
  };
}
function initFeatures(definition) {
  definition.features?.forEach((fn) => fn(definition));
}
function extractDefListOrFactory(dependencies, defExtractor) {
  if (!dependencies) {
    return null;
  }
  return () => {
    const resolvedDependencies = typeof dependencies === "function" ? dependencies() : dependencies;
    const result = [];
    for (const dep of resolvedDependencies) {
      const definition = defExtractor(dep);
      if (definition !== null) {
        result.push(definition);
      }
    }
    return result;
  };
}
var GENERATED_COMP_IDS = /* @__PURE__ */ new Map();
function getComponentId(componentDef) {
  let hash = 0;
  const componentDefConsts = typeof componentDef.consts === "function" ? "" : componentDef.consts;
  const hashSelectors = [
    componentDef.selectors,
    componentDef.ngContentSelectors,
    componentDef.hostVars,
    componentDef.hostAttrs,
    componentDefConsts,
    componentDef.vars,
    componentDef.decls,
    componentDef.encapsulation,
    componentDef.standalone,
    componentDef.signals,
    componentDef.exportAs,
    JSON.stringify(componentDef.inputs),
    JSON.stringify(componentDef.outputs),
    // We cannot use 'componentDef.type.name' as the name of the symbol will change and will not
    // match in the server and browser bundles.
    Object.getOwnPropertyNames(componentDef.type.prototype),
    !!componentDef.contentQueries,
    !!componentDef.viewQuery
  ];
  if (typeof ngDevMode === "undefined" || ngDevMode) {
    for (const item of hashSelectors) {
      assertNotEqual(typeof item, "function", "Internal error: attempting to use a function in component id computation logic.");
    }
  }
  for (const char of hashSelectors.join("|")) {
    hash = Math.imul(31, hash) + char.charCodeAt(0) << 0;
  }
  hash += 2147483647 + 1;
  const compId = "c" + hash;
  if ((typeof ngDevMode === "undefined" || ngDevMode) && true) {
    if (GENERATED_COMP_IDS.has(compId)) {
      const previousCompDefType = GENERATED_COMP_IDS.get(compId);
      if (previousCompDefType !== componentDef.type) {
        console.warn(formatRuntimeError(-912, `Component ID generation collision detected. Components '${previousCompDefType.name}' and '${componentDef.type.name}' with selector '${stringifyCSSSelectorList(componentDef.selectors)}' generated the same component ID. To fix this, you can change the selector of one of those components or add an extra host attribute to force a different ID.`));
      }
    } else {
      GENERATED_COMP_IDS.set(compId, componentDef.type);
    }
  }
  return compId;
}
function getSuperType(type) {
  return Object.getPrototypeOf(type.prototype).constructor;
}
function \u0275\u0275InheritDefinitionFeature(definition) {
  let superType = getSuperType(definition.type);
  let shouldInheritFields = true;
  const inheritanceChain = [definition];
  while (superType) {
    let superDef = void 0;
    if (isComponentDef(definition)) {
      superDef = superType.\u0275cmp || superType.\u0275dir;
    } else {
      if (superType.\u0275cmp) {
        throw new RuntimeError(903, ngDevMode && `Directives cannot inherit Components. Directive ${stringifyForError(definition.type)} is attempting to extend component ${stringifyForError(superType)}`);
      }
      superDef = superType.\u0275dir;
    }
    if (superDef) {
      if (shouldInheritFields) {
        inheritanceChain.push(superDef);
        const writeableDef = definition;
        writeableDef.inputs = maybeUnwrapEmpty(definition.inputs);
        writeableDef.declaredInputs = maybeUnwrapEmpty(definition.declaredInputs);
        writeableDef.outputs = maybeUnwrapEmpty(definition.outputs);
        const superHostBindings = superDef.hostBindings;
        superHostBindings && inheritHostBindings(definition, superHostBindings);
        const superViewQuery = superDef.viewQuery;
        const superContentQueries = superDef.contentQueries;
        superViewQuery && inheritViewQuery(definition, superViewQuery);
        superContentQueries && inheritContentQueries(definition, superContentQueries);
        mergeInputsWithTransforms(definition, superDef);
        fillProperties(definition.outputs, superDef.outputs);
        if (isComponentDef(superDef) && superDef.data.animation) {
          const defData = definition.data;
          defData.animation = (defData.animation || []).concat(superDef.data.animation);
        }
      }
      const features = superDef.features;
      if (features) {
        for (let i = 0; i < features.length; i++) {
          const feature = features[i];
          if (feature && feature.ngInherit) {
            feature(definition);
          }
          if (feature === \u0275\u0275InheritDefinitionFeature) {
            shouldInheritFields = false;
          }
        }
      }
    }
    superType = Object.getPrototypeOf(superType);
  }
  mergeHostAttrsAcrossInheritance(inheritanceChain);
}
function mergeInputsWithTransforms(target, source) {
  for (const key in source.inputs) {
    if (!source.inputs.hasOwnProperty(key)) {
      continue;
    }
    if (target.inputs.hasOwnProperty(key)) {
      continue;
    }
    const value = source.inputs[key];
    if (value !== void 0) {
      target.inputs[key] = value;
      target.declaredInputs[key] = source.declaredInputs[key];
    }
  }
}
function mergeHostAttrsAcrossInheritance(inheritanceChain) {
  let hostVars = 0;
  let hostAttrs = null;
  for (let i = inheritanceChain.length - 1; i >= 0; i--) {
    const def = inheritanceChain[i];
    def.hostVars = hostVars += def.hostVars;
    def.hostAttrs = mergeHostAttrs(def.hostAttrs, hostAttrs = mergeHostAttrs(hostAttrs, def.hostAttrs));
  }
}
function maybeUnwrapEmpty(value) {
  if (value === EMPTY_OBJ) {
    return {};
  } else if (value === EMPTY_ARRAY) {
    return [];
  } else {
    return value;
  }
}
function inheritViewQuery(definition, superViewQuery) {
  const prevViewQuery = definition.viewQuery;
  if (prevViewQuery) {
    definition.viewQuery = (rf, ctx) => {
      superViewQuery(rf, ctx);
      prevViewQuery(rf, ctx);
    };
  } else {
    definition.viewQuery = superViewQuery;
  }
}
function inheritContentQueries(definition, superContentQueries) {
  const prevContentQueries = definition.contentQueries;
  if (prevContentQueries) {
    definition.contentQueries = (rf, ctx, directiveIndex) => {
      superContentQueries(rf, ctx, directiveIndex);
      prevContentQueries(rf, ctx, directiveIndex);
    };
  } else {
    definition.contentQueries = superContentQueries;
  }
}
function inheritHostBindings(definition, superHostBindings) {
  const prevHostBindings = definition.hostBindings;
  if (prevHostBindings) {
    definition.hostBindings = (rf, ctx) => {
      superHostBindings(rf, ctx);
      prevHostBindings(rf, ctx);
    };
  } else {
    definition.hostBindings = superHostBindings;
  }
}
var COPY_DIRECTIVE_FIELDS = [
  // The child class should use the providers of its parent.
  "providersResolver"
  // Not listed here are any fields which are handled by the `ɵɵInheritDefinitionFeature`, such
  // as inputs, outputs, and host binding functions.
];
var COPY_COMPONENT_FIELDS = [
  // The child class should use the template function of its parent, including all template
  // semantics.
  "template",
  "decls",
  "consts",
  "vars",
  "onPush",
  "ngContentSelectors",
  // The child class should use the CSS styles of its parent, including all styling semantics.
  "styles",
  "encapsulation",
  // The child class should be checked by the runtime in the same way as its parent.
  "schemas"
];
function \u0275\u0275CopyDefinitionFeature(definition) {
  let superType = getSuperType(definition.type);
  let superDef = void 0;
  if (isComponentDef(definition)) {
    superDef = superType.\u0275cmp;
  } else {
    superDef = superType.\u0275dir;
  }
  const defAny = definition;
  for (const field of COPY_DIRECTIVE_FIELDS) {
    defAny[field] = superDef[field];
  }
  if (isComponentDef(superDef)) {
    for (const field of COPY_COMPONENT_FIELDS) {
      defAny[field] = superDef[field];
    }
  }
}
function \u0275\u0275HostDirectivesFeature(rawHostDirectives) {
  const feature = (definition) => {
    const isEager = Array.isArray(rawHostDirectives);
    if (definition.hostDirectives === null) {
      definition.resolveHostDirectives = resolveHostDirectives;
      definition.hostDirectives = isEager ? rawHostDirectives.map(createHostDirectiveDef) : [rawHostDirectives];
    } else if (isEager) {
      definition.hostDirectives.unshift(...rawHostDirectives.map(createHostDirectiveDef));
    } else {
      definition.hostDirectives.unshift(rawHostDirectives);
    }
  };
  feature.ngInherit = true;
  return feature;
}
function resolveHostDirectives(matches) {
  const allDirectiveDefs = [];
  let hasComponent = false;
  let hostDirectiveDefs = null;
  let hostDirectiveRanges = null;
  for (let i = 0; i < matches.length; i++) {
    const def = matches[i];
    if (def.hostDirectives !== null) {
      const start = allDirectiveDefs.length;
      hostDirectiveDefs ??= /* @__PURE__ */ new Map();
      hostDirectiveRanges ??= /* @__PURE__ */ new Map();
      findHostDirectiveDefs(def, allDirectiveDefs, hostDirectiveDefs);
      hostDirectiveRanges.set(def, [start, allDirectiveDefs.length - 1]);
    }
    if (i === 0 && isComponentDef(def)) {
      hasComponent = true;
      allDirectiveDefs.push(def);
    }
  }
  for (let i = hasComponent ? 1 : 0; i < matches.length; i++) {
    allDirectiveDefs.push(matches[i]);
  }
  return [allDirectiveDefs, hostDirectiveDefs, hostDirectiveRanges];
}
function findHostDirectiveDefs(currentDef, matchedDefs, hostDirectiveDefs) {
  if (currentDef.hostDirectives !== null) {
    for (const configOrFn of currentDef.hostDirectives) {
      if (typeof configOrFn === "function") {
        const resolved2 = configOrFn();
        for (const config2 of resolved2) {
          trackHostDirectiveDef(createHostDirectiveDef(config2), matchedDefs, hostDirectiveDefs);
        }
      } else {
        trackHostDirectiveDef(configOrFn, matchedDefs, hostDirectiveDefs);
      }
    }
  }
}
function trackHostDirectiveDef(def, matchedDefs, hostDirectiveDefs) {
  const hostDirectiveDef = getDirectiveDef(def.directive);
  if (typeof ngDevMode === "undefined" || ngDevMode) {
    validateHostDirective(def, hostDirectiveDef);
  }
  patchDeclaredInputs(hostDirectiveDef.declaredInputs, def.inputs);
  findHostDirectiveDefs(hostDirectiveDef, matchedDefs, hostDirectiveDefs);
  hostDirectiveDefs.set(hostDirectiveDef, def);
  matchedDefs.push(hostDirectiveDef);
}
function createHostDirectiveDef(config2) {
  return typeof config2 === "function" ? { directive: resolveForwardRef(config2), inputs: EMPTY_OBJ, outputs: EMPTY_OBJ } : {
    directive: resolveForwardRef(config2.directive),
    inputs: bindingArrayToMap(config2.inputs),
    outputs: bindingArrayToMap(config2.outputs)
  };
}
function bindingArrayToMap(bindings) {
  if (bindings === void 0 || bindings.length === 0) {
    return EMPTY_OBJ;
  }
  const result = {};
  for (let i = 0; i < bindings.length; i += 2) {
    result[bindings[i]] = bindings[i + 1];
  }
  return result;
}
function patchDeclaredInputs(declaredInputs, exposedInputs) {
  for (const publicName in exposedInputs) {
    if (exposedInputs.hasOwnProperty(publicName)) {
      const remappedPublicName = exposedInputs[publicName];
      const privateName = declaredInputs[publicName];
      if ((typeof ngDevMode === "undefined" || ngDevMode) && declaredInputs.hasOwnProperty(remappedPublicName)) {
        assertEqual(declaredInputs[remappedPublicName], declaredInputs[publicName], `Conflicting host directive input alias ${publicName}.`);
      }
      declaredInputs[remappedPublicName] = privateName;
    }
  }
}
function validateHostDirective(hostDirectiveConfig, directiveDef) {
  const type = hostDirectiveConfig.directive;
  if (directiveDef === null) {
    if (getComponentDef(type) !== null) {
      throw new RuntimeError(310, `Host directive ${type.name} cannot be a component.`);
    }
    throw new RuntimeError(307, `Could not resolve metadata for host directive ${type.name}. Make sure that the ${type.name} class is annotated with an @Directive decorator.`);
  }
  if (!directiveDef.standalone) {
    throw new RuntimeError(308, `Host directive ${directiveDef.type.name} must be standalone.`);
  }
  validateMappings("input", directiveDef, hostDirectiveConfig.inputs);
  validateMappings("output", directiveDef, hostDirectiveConfig.outputs);
}
function validateMappings(bindingType, def, hostDirectiveBindings) {
  const className = def.type.name;
  const bindings = bindingType === "input" ? def.inputs : def.outputs;
  for (const publicName in hostDirectiveBindings) {
    if (hostDirectiveBindings.hasOwnProperty(publicName)) {
      if (!bindings.hasOwnProperty(publicName)) {
        throw new RuntimeError(311, `Directive ${className} does not have an ${bindingType} with a public name of ${publicName}.`);
      }
      const remappedPublicName = hostDirectiveBindings[publicName];
      if (bindings.hasOwnProperty(remappedPublicName) && remappedPublicName !== publicName) {
        throw new RuntimeError(312, `Cannot alias ${bindingType} ${publicName} of host directive ${className} to ${remappedPublicName}, because it already has a different ${bindingType} with the same public name.`);
      }
    }
  }
}
function templateCreate(tNode, declarationLView, declarationTView, index, templateFn, decls, vars, flags) {
  if (declarationTView.firstCreatePass) {
    tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, tNode.attrs);
    const embeddedTView = tNode.tView = createTView(
      2,
      tNode,
      templateFn,
      decls,
      vars,
      declarationTView.directiveRegistry,
      declarationTView.pipeRegistry,
      null,
      declarationTView.schemas,
      declarationTView.consts,
      null
      /* ssrId */
    );
    if (declarationTView.queries !== null) {
      declarationTView.queries.template(declarationTView, tNode);
      embeddedTView.queries = declarationTView.queries.embeddedTView(tNode);
    }
  }
  if (flags) {
    tNode.flags |= flags;
  }
  setCurrentTNode(tNode, false);
  const comment = _locateOrCreateContainerAnchor(declarationTView, declarationLView, tNode, index);
  if (wasLastNodeCreated()) {
    appendChild(declarationTView, declarationLView, comment, tNode);
  }
  attachPatchData(comment, declarationLView);
  const lContainer = createLContainer(comment, declarationLView, comment, tNode);
  declarationLView[index + HEADER_OFFSET] = lContainer;
  addToEndOfViewTree(declarationLView, lContainer);
  populateDehydratedViewsInLContainer(lContainer, tNode, declarationLView);
}
function declareDirectiveHostTemplate(declarationLView, declarationTView, index, templateFn, decls, vars, tagName, attrs, flags, localRefsIndex, localRefExtractor) {
  const adjustedIndex = index + HEADER_OFFSET;
  let tNode;
  if (declarationTView.firstCreatePass) {
    tNode = getOrCreateTNode(declarationTView, adjustedIndex, 4, tagName || null, attrs || null);
    if (getBindingsEnabled()) {
      resolveDirectives(declarationTView, declarationLView, tNode, getConstant(declarationTView.consts, localRefsIndex), findDirectiveDefMatches);
    }
    registerPostOrderHooks(declarationTView, tNode);
  } else {
    tNode = declarationTView.data[adjustedIndex];
  }
  templateCreate(tNode, declarationLView, declarationTView, index, templateFn, decls, vars, flags);
  if (isDirectiveHost(tNode)) {
    createDirectivesInstances(declarationTView, declarationLView, tNode);
  }
  if (localRefsIndex != null) {
    saveResolvedLocalsInData(declarationLView, tNode, localRefExtractor);
  }
  return tNode;
}
function declareNoDirectiveHostTemplate(declarationLView, declarationTView, index, templateFn, decls, vars, tagName, attrs, flags, localRefsIndex, localRefExtractor) {
  const adjustedIndex = index + HEADER_OFFSET;
  let tNode;
  if (declarationTView.firstCreatePass) {
    tNode = getOrCreateTNode(declarationTView, adjustedIndex, 4, tagName || null, attrs || null);
    if (localRefsIndex != null) {
      const refs = getConstant(declarationTView.consts, localRefsIndex);
      tNode.localNames = [];
      for (let i = 0; i < refs.length; i += 2) {
        tNode.localNames.push(refs[i], -1);
      }
    }
  } else {
    tNode = declarationTView.data[adjustedIndex];
  }
  templateCreate(tNode, declarationLView, declarationTView, index, templateFn, decls, vars, flags);
  if (localRefsIndex != null) {
    saveResolvedLocalsInData(declarationLView, tNode, localRefExtractor);
  }
  return tNode;
}
function \u0275\u0275template(index, templateFn, decls, vars, tagName, attrsIndex, localRefsIndex, localRefExtractor) {
  const lView = getLView();
  const tView = getTView();
  const attrs = getConstant(tView.consts, attrsIndex);
  declareDirectiveHostTemplate(lView, tView, index, templateFn, decls, vars, tagName, attrs, void 0, localRefsIndex, localRefExtractor);
  return \u0275\u0275template;
}
function \u0275\u0275domTemplate(index, templateFn, decls, vars, tagName, attrsIndex, localRefsIndex, localRefExtractor) {
  const lView = getLView();
  const tView = getTView();
  const attrs = getConstant(tView.consts, attrsIndex);
  declareNoDirectiveHostTemplate(lView, tView, index, templateFn, decls, vars, tagName, attrs, void 0, localRefsIndex, localRefExtractor);
  return \u0275\u0275domTemplate;
}
var _locateOrCreateContainerAnchor = createContainerAnchorImpl;
function createContainerAnchorImpl(tView, lView, tNode, index) {
  lastNodeWasCreated(true);
  return lView[RENDERER].createComment(ngDevMode ? "container" : "");
}
var DeferDependenciesLoadingState;
(function(DeferDependenciesLoadingState2) {
  DeferDependenciesLoadingState2[DeferDependenciesLoadingState2["NOT_STARTED"] = 0] = "NOT_STARTED";
  DeferDependenciesLoadingState2[DeferDependenciesLoadingState2["IN_PROGRESS"] = 1] = "IN_PROGRESS";
  DeferDependenciesLoadingState2[DeferDependenciesLoadingState2["COMPLETE"] = 2] = "COMPLETE";
  DeferDependenciesLoadingState2[DeferDependenciesLoadingState2["FAILED"] = 3] = "FAILED";
})(DeferDependenciesLoadingState || (DeferDependenciesLoadingState = {}));
var MINIMUM_SLOT = 0;
var LOADING_AFTER_SLOT = 1;
var DeferBlockState;
(function(DeferBlockState2) {
  DeferBlockState2[DeferBlockState2["Placeholder"] = 0] = "Placeholder";
  DeferBlockState2[DeferBlockState2["Loading"] = 1] = "Loading";
  DeferBlockState2[DeferBlockState2["Complete"] = 2] = "Complete";
  DeferBlockState2[DeferBlockState2["Error"] = 3] = "Error";
})(DeferBlockState || (DeferBlockState = {}));
var DeferBlockInternalState;
(function(DeferBlockInternalState2) {
  DeferBlockInternalState2[DeferBlockInternalState2["Initial"] = -1] = "Initial";
})(DeferBlockInternalState || (DeferBlockInternalState = {}));
var NEXT_DEFER_BLOCK_STATE = 0;
var DEFER_BLOCK_STATE = 1;
var STATE_IS_FROZEN_UNTIL = 2;
var LOADING_AFTER_CLEANUP_FN = 3;
var TRIGGER_CLEANUP_FNS = 4;
var PREFETCH_TRIGGER_CLEANUP_FNS = 5;
var SSR_UNIQUE_ID = 6;
var SSR_BLOCK_STATE = 7;
var ON_COMPLETE_FNS = 8;
var HYDRATE_TRIGGER_CLEANUP_FNS = 9;
var DeferBlockBehavior;
(function(DeferBlockBehavior2) {
  DeferBlockBehavior2[DeferBlockBehavior2["Manual"] = 0] = "Manual";
  DeferBlockBehavior2[DeferBlockBehavior2["Playthrough"] = 1] = "Playthrough";
})(DeferBlockBehavior || (DeferBlockBehavior = {}));
function storeTriggerCleanupFn(type, lDetails, cleanupFn) {
  const key = getCleanupFnKeyByType(type);
  if (lDetails[key] === null) {
    lDetails[key] = [];
  }
  lDetails[key].push(cleanupFn);
}
function invokeTriggerCleanupFns(type, lDetails) {
  const key = getCleanupFnKeyByType(type);
  const cleanupFns = lDetails[key];
  if (cleanupFns !== null) {
    for (const cleanupFn of cleanupFns) {
      cleanupFn();
    }
    lDetails[key] = null;
  }
}
function invokeAllTriggerCleanupFns(lDetails) {
  invokeTriggerCleanupFns(1, lDetails);
  invokeTriggerCleanupFns(0, lDetails);
  invokeTriggerCleanupFns(2, lDetails);
}
function getCleanupFnKeyByType(type) {
  let key = TRIGGER_CLEANUP_FNS;
  if (type === 1) {
    key = PREFETCH_TRIGGER_CLEANUP_FNS;
  } else if (type === 2) {
    key = HYDRATE_TRIGGER_CLEANUP_FNS;
  }
  return key;
}
var TracingAction;
(function(TracingAction2) {
  TracingAction2[TracingAction2["CHANGE_DETECTION"] = 0] = "CHANGE_DETECTION";
  TracingAction2[TracingAction2["AFTER_NEXT_RENDER"] = 1] = "AFTER_NEXT_RENDER";
})(TracingAction || (TracingAction = {}));
var TracingService = new InjectionToken(ngDevMode ? "TracingService" : "");
var SCHEDULE_IN_ROOT_ZONE_DEFAULT = false;
var EventEmitter_ = class extends Subject {
  // tslint:disable-next-line:require-internal-with-underscore
  __isAsync;
  destroyRef = void 0;
  pendingTasks = void 0;
  constructor(isAsync = false) {
    super();
    this.__isAsync = isAsync;
    if (isInInjectionContext()) {
      this.destroyRef = inject2(DestroyRef, { optional: true }) ?? void 0;
      this.pendingTasks = inject2(PendingTasksInternal, { optional: true }) ?? void 0;
    }
  }
  emit(value) {
    const prevConsumer = setActiveConsumer(null);
    try {
      super.next(value);
    } finally {
      setActiveConsumer(prevConsumer);
    }
  }
  subscribe(observerOrNext, error, complete) {
    let nextFn = observerOrNext;
    let errorFn = error || (() => null);
    let completeFn = complete;
    if (observerOrNext && typeof observerOrNext === "object") {
      const observer = observerOrNext;
      nextFn = observer.next?.bind(observer);
      errorFn = observer.error?.bind(observer);
      completeFn = observer.complete?.bind(observer);
    }
    if (this.__isAsync) {
      errorFn = this.wrapInTimeout(errorFn);
      if (nextFn) {
        nextFn = this.wrapInTimeout(nextFn);
      }
      if (completeFn) {
        completeFn = this.wrapInTimeout(completeFn);
      }
    }
    const sink = super.subscribe({ next: nextFn, error: errorFn, complete: completeFn });
    if (observerOrNext instanceof Subscription) {
      observerOrNext.add(sink);
    }
    return sink;
  }
  wrapInTimeout(fn) {
    return (value) => {
      const taskId = this.pendingTasks?.add();
      setTimeout(() => {
        try {
          fn(value);
        } finally {
          if (taskId !== void 0) {
            this.pendingTasks?.remove(taskId);
          }
        }
      });
    };
  }
};
var EventEmitter = EventEmitter_;
function scheduleCallbackWithRafRace(callback) {
  let timeoutId;
  let animationFrameId;
  function cleanup() {
    callback = noop2;
    try {
      if (animationFrameId !== void 0 && typeof cancelAnimationFrame === "function") {
        cancelAnimationFrame(animationFrameId);
      }
      if (timeoutId !== void 0) {
        clearTimeout(timeoutId);
      }
    } catch {
    }
  }
  timeoutId = setTimeout(() => {
    callback();
    cleanup();
  });
  if (typeof requestAnimationFrame === "function") {
    animationFrameId = requestAnimationFrame(() => {
      callback();
      cleanup();
    });
  }
  return () => cleanup();
}
function scheduleCallbackWithMicrotask(callback) {
  queueMicrotask(() => callback());
  return () => {
    callback = noop2;
  };
}
var AsyncStackTaggingZoneSpec = class {
  createTask;
  constructor(namePrefix, consoleAsyncStackTaggingImpl = console) {
    this.name = "asyncStackTagging for " + namePrefix;
    this.createTask = consoleAsyncStackTaggingImpl?.createTask ?? (() => null);
  }
  // ZoneSpec implementation below.
  name;
  onScheduleTask(delegate, _current, target, task) {
    task.consoleTask = this.createTask(`Zone - ${task.source || task.type}`);
    return delegate.scheduleTask(target, task);
  }
  onInvokeTask(delegate, _currentZone, targetZone, task, applyThis, applyArgs) {
    let ret;
    if (task.consoleTask) {
      ret = task.consoleTask.run(() => delegate.invokeTask(targetZone, task, applyThis, applyArgs));
    } else {
      ret = delegate.invokeTask(targetZone, task, applyThis, applyArgs);
    }
    return ret;
  }
};
var isAngularZoneProperty = "isAngularZone";
var angularZoneInstanceIdProperty = isAngularZoneProperty + "_ID";
var ngZoneInstanceId = 0;
var NgZone = class _NgZone {
  hasPendingMacrotasks = false;
  hasPendingMicrotasks = false;
  /**
   * Whether there are no outstanding microtasks or macrotasks.
   */
  isStable = true;
  /**
   * Notifies when code enters Angular Zone. This gets fired first on VM Turn.
   */
  onUnstable = new EventEmitter(false);
  /**
   * Notifies when there is no more microtasks enqueued in the current VM Turn.
   * This is a hint for Angular to do change detection, which may enqueue more microtasks.
   * For this reason this event can fire multiple times per VM Turn.
   */
  onMicrotaskEmpty = new EventEmitter(false);
  /**
   * Notifies when the last `onMicrotaskEmpty` has run and there are no more microtasks, which
   * implies we are about to relinquish VM turn.
   * This event gets called just once.
   */
  onStable = new EventEmitter(false);
  /**
   * Notifies that an error has been delivered.
   */
  onError = new EventEmitter(false);
  constructor(options) {
    const { enableLongStackTrace = false, shouldCoalesceEventChangeDetection = false, shouldCoalesceRunChangeDetection = false, scheduleInRootZone = SCHEDULE_IN_ROOT_ZONE_DEFAULT } = options;
    if (typeof Zone == "undefined") {
      throw new RuntimeError(908, ngDevMode && `In this configuration Angular requires Zone.js`);
    }
    Zone.assertZonePatched();
    const self2 = this;
    self2._nesting = 0;
    self2._outer = self2._inner = Zone.current;
    if (ngDevMode) {
      self2._inner = self2._inner.fork(new AsyncStackTaggingZoneSpec("Angular"));
    }
    if (Zone["TaskTrackingZoneSpec"]) {
      self2._inner = self2._inner.fork(new Zone["TaskTrackingZoneSpec"]());
    }
    if (enableLongStackTrace && Zone["longStackTraceZoneSpec"]) {
      self2._inner = self2._inner.fork(Zone["longStackTraceZoneSpec"]);
    }
    self2.shouldCoalesceEventChangeDetection = !shouldCoalesceRunChangeDetection && shouldCoalesceEventChangeDetection;
    self2.shouldCoalesceRunChangeDetection = shouldCoalesceRunChangeDetection;
    self2.callbackScheduled = false;
    self2.scheduleInRootZone = scheduleInRootZone;
    forkInnerZoneWithAngularBehavior(self2);
  }
  /**
    This method checks whether the method call happens within an Angular Zone instance.
  */
  static isInAngularZone() {
    return typeof Zone !== "undefined" && Zone.current.get(isAngularZoneProperty) === true;
  }
  /**
    Assures that the method is called within the Angular Zone, otherwise throws an error.
  */
  static assertInAngularZone() {
    if (!_NgZone.isInAngularZone()) {
      throw new RuntimeError(909, ngDevMode && "Expected to be in Angular Zone, but it is not!");
    }
  }
  /**
    Assures that the method is called outside of the Angular Zone, otherwise throws an error.
  */
  static assertNotInAngularZone() {
    if (_NgZone.isInAngularZone()) {
      throw new RuntimeError(909, ngDevMode && "Expected to not be in Angular Zone, but it is!");
    }
  }
  /**
   * Executes the `fn` function synchronously within the Angular zone and returns value returned by
   * the function.
   *
   * Running functions via `run` allows you to reenter Angular zone from a task that was executed
   * outside of the Angular zone (typically started via {@link #runOutsideAngular}).
   *
   * Any future tasks or microtasks scheduled from within this function will continue executing from
   * within the Angular zone.
   *
   * If a synchronous error happens it will be rethrown and not reported via `onError`.
   */
  run(fn, applyThis, applyArgs) {
    return this._inner.run(fn, applyThis, applyArgs);
  }
  /**
   * Executes the `fn` function synchronously within the Angular zone as a task and returns value
   * returned by the function.
   *
   * Running functions via `runTask` allows you to reenter Angular zone from a task that was executed
   * outside of the Angular zone (typically started via {@link #runOutsideAngular}).
   *
   * Any future tasks or microtasks scheduled from within this function will continue executing from
   * within the Angular zone.
   *
   * If a synchronous error happens it will be rethrown and not reported via `onError`.
   */
  runTask(fn, applyThis, applyArgs, name2) {
    const zone = this._inner;
    const task = zone.scheduleEventTask("NgZoneEvent: " + name2, fn, EMPTY_PAYLOAD, noop2, noop2);
    try {
      return zone.runTask(task, applyThis, applyArgs);
    } finally {
      zone.cancelTask(task);
    }
  }
  /**
   * Same as `run`, except that synchronous errors are caught and forwarded via `onError` and not
   * rethrown.
   */
  runGuarded(fn, applyThis, applyArgs) {
    return this._inner.runGuarded(fn, applyThis, applyArgs);
  }
  /**
   * Executes the `fn` function synchronously in Angular's parent zone and returns value returned by
   * the function.
   *
   * Running functions via {@link #runOutsideAngular} allows you to escape Angular's zone and do
   * work that
   * doesn't trigger Angular change-detection or is subject to Angular's error handling.
   *
   * Any future tasks or microtasks scheduled from within this function will continue executing from
   * outside of the Angular zone.
   *
   * Use {@link #run} to reenter the Angular zone and do work that updates the application model.
   */
  runOutsideAngular(fn) {
    return this._outer.run(fn);
  }
};
var EMPTY_PAYLOAD = {};
function checkStable(zone) {
  if (zone._nesting == 0 && !zone.hasPendingMicrotasks && !zone.isStable) {
    try {
      zone._nesting++;
      zone.onMicrotaskEmpty.emit(null);
    } finally {
      zone._nesting--;
      if (!zone.hasPendingMicrotasks) {
        try {
          zone.runOutsideAngular(() => zone.onStable.emit(null));
        } finally {
          zone.isStable = true;
        }
      }
    }
  }
}
function delayChangeDetectionForEvents(zone) {
  if (zone.isCheckStableRunning || zone.callbackScheduled) {
    return;
  }
  zone.callbackScheduled = true;
  function scheduleCheckStable() {
    scheduleCallbackWithRafRace(() => {
      zone.callbackScheduled = false;
      updateMicroTaskStatus(zone);
      zone.isCheckStableRunning = true;
      checkStable(zone);
      zone.isCheckStableRunning = false;
    });
  }
  if (zone.scheduleInRootZone) {
    Zone.root.run(() => {
      scheduleCheckStable();
    });
  } else {
    zone._outer.run(() => {
      scheduleCheckStable();
    });
  }
  updateMicroTaskStatus(zone);
}
function forkInnerZoneWithAngularBehavior(zone) {
  const delayChangeDetectionForEventsDelegate = () => {
    delayChangeDetectionForEvents(zone);
  };
  const instanceId = ngZoneInstanceId++;
  zone._inner = zone._inner.fork({
    name: "angular",
    properties: {
      [isAngularZoneProperty]: true,
      [angularZoneInstanceIdProperty]: instanceId,
      [angularZoneInstanceIdProperty + instanceId]: true
    },
    onInvokeTask: (delegate, current, target, task, applyThis, applyArgs) => {
      if (shouldBeIgnoredByZone(applyArgs)) {
        return delegate.invokeTask(target, task, applyThis, applyArgs);
      }
      try {
        onEnter(zone);
        return delegate.invokeTask(target, task, applyThis, applyArgs);
      } finally {
        if (zone.shouldCoalesceEventChangeDetection && task.type === "eventTask" || zone.shouldCoalesceRunChangeDetection) {
          delayChangeDetectionForEventsDelegate();
        }
        onLeave(zone);
      }
    },
    onInvoke: (delegate, current, target, callback, applyThis, applyArgs, source) => {
      try {
        onEnter(zone);
        return delegate.invoke(target, callback, applyThis, applyArgs, source);
      } finally {
        if (zone.shouldCoalesceRunChangeDetection && // Do not delay change detection when the task is the scheduler's tick.
        // We need to synchronously trigger the stability logic so that the
        // zone-based scheduler can prevent a duplicate ApplicationRef.tick
        // by first checking if the scheduler tick is running. This does seem a bit roundabout,
        // but we _do_ still want to trigger all the correct events when we exit the zone.run
        // (`onMicrotaskEmpty` and `onStable` _should_ emit; developers can have code which
        // relies on these events happening after change detection runs).
        // Note: `zone.callbackScheduled` is already in delayChangeDetectionForEventsDelegate
        // but is added here as well to prevent reads of applyArgs when not necessary
        !zone.callbackScheduled && !isSchedulerTick(applyArgs)) {
          delayChangeDetectionForEventsDelegate();
        }
        onLeave(zone);
      }
    },
    onHasTask: (delegate, current, target, hasTaskState) => {
      delegate.hasTask(target, hasTaskState);
      if (current === target) {
        if (hasTaskState.change == "microTask") {
          zone._hasPendingMicrotasks = hasTaskState.microTask;
          updateMicroTaskStatus(zone);
          checkStable(zone);
        } else if (hasTaskState.change == "macroTask") {
          zone.hasPendingMacrotasks = hasTaskState.macroTask;
        }
      }
    },
    onHandleError: (delegate, current, target, error) => {
      delegate.handleError(target, error);
      zone.runOutsideAngular(() => zone.onError.emit(error));
      return false;
    }
  });
}
function updateMicroTaskStatus(zone) {
  if (zone._hasPendingMicrotasks || (zone.shouldCoalesceEventChangeDetection || zone.shouldCoalesceRunChangeDetection) && zone.callbackScheduled === true) {
    zone.hasPendingMicrotasks = true;
  } else {
    zone.hasPendingMicrotasks = false;
  }
}
function onEnter(zone) {
  zone._nesting++;
  if (zone.isStable) {
    zone.isStable = false;
    zone.onUnstable.emit(null);
  }
}
function onLeave(zone) {
  zone._nesting--;
  checkStable(zone);
}
var NoopNgZone = class {
  hasPendingMicrotasks = false;
  hasPendingMacrotasks = false;
  isStable = true;
  onUnstable = new EventEmitter();
  onMicrotaskEmpty = new EventEmitter();
  onStable = new EventEmitter();
  onError = new EventEmitter();
  run(fn, applyThis, applyArgs) {
    return fn.apply(applyThis, applyArgs);
  }
  runGuarded(fn, applyThis, applyArgs) {
    return fn.apply(applyThis, applyArgs);
  }
  runOutsideAngular(fn) {
    return fn();
  }
  runTask(fn, applyThis, applyArgs, name2) {
    return fn.apply(applyThis, applyArgs);
  }
};
function shouldBeIgnoredByZone(applyArgs) {
  return hasApplyArgsData(applyArgs, "__ignore_ng_zone__");
}
function isSchedulerTick(applyArgs) {
  return hasApplyArgsData(applyArgs, "__scheduler_tick__");
}
function hasApplyArgsData(applyArgs, key) {
  if (!Array.isArray(applyArgs)) {
    return false;
  }
  if (applyArgs.length !== 1) {
    return false;
  }
  return applyArgs[0]?.data?.[key] === true;
}
function getNgZone(ngZoneToUse = "zone.js", options) {
  if (ngZoneToUse === "noop") {
    return new NoopNgZone();
  }
  if (ngZoneToUse === "zone.js") {
    return new NgZone(options);
  }
  return ngZoneToUse;
}
var AfterRenderManager = class _AfterRenderManager {
  impl = null;
  execute() {
    this.impl?.execute();
  }
  /** @nocollapse */
  static \u0275prov = (
    /** @pureOrBreakMyCode */
    /* @__PURE__ */ \u0275\u0275defineInjectable({
      token: _AfterRenderManager,
      providedIn: "root",
      factory: () => new _AfterRenderManager()
    })
  );
};
var AFTER_RENDER_PHASES = /* @__PURE__ */ (() => [
  0,
  1,
  2,
  3
])();
var AfterRenderImpl = class _AfterRenderImpl {
  ngZone = inject2(NgZone);
  scheduler = inject2(ChangeDetectionScheduler);
  errorHandler = inject2(ErrorHandler, { optional: true });
  /** Current set of active sequences. */
  sequences = /* @__PURE__ */ new Set();
  /** Tracks registrations made during the current set of executions. */
  deferredRegistrations = /* @__PURE__ */ new Set();
  /** Whether the `AfterRenderManager` is currently executing hooks. */
  executing = false;
  constructor() {
    inject2(TracingService, { optional: true });
  }
  /**
   * Run the sequence of phases of hooks, once through. As a result of executing some hooks, more
   * might be scheduled.
   */
  execute() {
    const hasSequencesToExecute = this.sequences.size > 0;
    if (hasSequencesToExecute) {
      profiler(
        16
        /* ProfilerEvent.AfterRenderHooksStart */
      );
    }
    this.executing = true;
    for (const phase of AFTER_RENDER_PHASES) {
      for (const sequence of this.sequences) {
        if (sequence.erroredOrDestroyed || !sequence.hooks[phase]) {
          continue;
        }
        try {
          sequence.pipelinedValue = this.ngZone.runOutsideAngular(() => this.maybeTrace(() => {
            const hookFn = sequence.hooks[phase];
            const value = hookFn(sequence.pipelinedValue);
            return value;
          }, sequence.snapshot));
        } catch (err) {
          sequence.erroredOrDestroyed = true;
          this.errorHandler?.handleError(err);
        }
      }
    }
    this.executing = false;
    for (const sequence of this.sequences) {
      sequence.afterRun();
      if (sequence.once) {
        this.sequences.delete(sequence);
        sequence.destroy();
      }
    }
    for (const sequence of this.deferredRegistrations) {
      this.sequences.add(sequence);
    }
    if (this.deferredRegistrations.size > 0) {
      this.scheduler.notify(
        7
        /* NotificationSource.RenderHook */
      );
    }
    this.deferredRegistrations.clear();
    if (hasSequencesToExecute) {
      profiler(
        17
        /* ProfilerEvent.AfterRenderHooksEnd */
      );
    }
  }
  register(sequence) {
    const { view } = sequence;
    if (view !== void 0) {
      (view[AFTER_RENDER_SEQUENCES_TO_ADD] ??= []).push(sequence);
      markAncestorsForTraversal(view);
      view[FLAGS] |= 8192;
    } else if (!this.executing) {
      this.addSequence(sequence);
    } else {
      this.deferredRegistrations.add(sequence);
    }
  }
  addSequence(sequence) {
    this.sequences.add(sequence);
    this.scheduler.notify(
      7
      /* NotificationSource.RenderHook */
    );
  }
  unregister(sequence) {
    if (this.executing && this.sequences.has(sequence)) {
      sequence.erroredOrDestroyed = true;
      sequence.pipelinedValue = void 0;
      sequence.once = true;
    } else {
      this.sequences.delete(sequence);
      this.deferredRegistrations.delete(sequence);
    }
  }
  maybeTrace(fn, snapshot) {
    return snapshot ? snapshot.run(TracingAction.AFTER_NEXT_RENDER, fn) : fn();
  }
  /** @nocollapse */
  static \u0275prov = (
    /** @pureOrBreakMyCode */
    /* @__PURE__ */ \u0275\u0275defineInjectable({
      token: _AfterRenderImpl,
      providedIn: "root",
      factory: () => new _AfterRenderImpl()
    })
  );
};
var AfterRenderSequence = class {
  impl;
  hooks;
  view;
  once;
  snapshot;
  /**
   * Whether this sequence errored or was destroyed during this execution, and hooks should no
   * longer run for it.
   */
  erroredOrDestroyed = false;
  /**
   * The value returned by the last hook execution (if any), ready to be pipelined into the next
   * one.
   */
  pipelinedValue = void 0;
  unregisterOnDestroy;
  constructor(impl, hooks, view, once, destroyRef, snapshot = null) {
    this.impl = impl;
    this.hooks = hooks;
    this.view = view;
    this.once = once;
    this.snapshot = snapshot;
    this.unregisterOnDestroy = destroyRef?.onDestroy(() => this.destroy());
  }
  afterRun() {
    this.erroredOrDestroyed = false;
    this.pipelinedValue = void 0;
    this.snapshot?.dispose();
    this.snapshot = null;
  }
  destroy() {
    this.impl.unregister(this);
    this.unregisterOnDestroy?.();
    const scheduled2 = this.view?.[AFTER_RENDER_SEQUENCES_TO_ADD];
    if (scheduled2) {
      this.view[AFTER_RENDER_SEQUENCES_TO_ADD] = scheduled2.filter((s) => s !== this);
    }
  }
};
function afterEveryRender(callbackOrSpec, options) {
  ngDevMode && assertNotInReactiveContext(afterEveryRender, "Call `afterEveryRender` outside of a reactive context. For example, schedule the render callback inside the component constructor`.");
  if (ngDevMode && !options?.injector) {
    assertInInjectionContext(afterEveryRender);
  }
  const injector = options?.injector ?? inject2(Injector);
  if (false) {
    return NOOP_AFTER_RENDER_REF;
  }
  performanceMarkFeature("NgAfterRender");
  return afterEveryRenderImpl(
    callbackOrSpec,
    injector,
    options,
    /* once */
    false
  );
}
function afterNextRender(callbackOrSpec, options) {
  if (ngDevMode && !options?.injector) {
    assertInInjectionContext(afterNextRender);
  }
  const injector = options?.injector ?? inject2(Injector);
  if (false) {
    return NOOP_AFTER_RENDER_REF;
  }
  performanceMarkFeature("NgAfterNextRender");
  return afterEveryRenderImpl(
    callbackOrSpec,
    injector,
    options,
    /* once */
    true
  );
}
function getHooks(callbackOrSpec) {
  if (callbackOrSpec instanceof Function) {
    return [
      void 0,
      void 0,
      /* MixedReadWrite */
      callbackOrSpec,
      void 0
    ];
  } else {
    return [
      callbackOrSpec.earlyRead,
      callbackOrSpec.write,
      callbackOrSpec.mixedReadWrite,
      callbackOrSpec.read
    ];
  }
}
function afterEveryRenderImpl(callbackOrSpec, injector, options, once) {
  const manager = injector.get(AfterRenderManager);
  manager.impl ??= injector.get(AfterRenderImpl);
  const tracing = injector.get(TracingService, null, { optional: true });
  const destroyRef = options?.manualCleanup !== true ? injector.get(DestroyRef) : null;
  const viewContext = injector.get(ViewContext, null, { optional: true });
  const sequence = new AfterRenderSequence(manager.impl, getHooks(callbackOrSpec), viewContext?.view, once, destroyRef, tracing?.snapshot(null));
  manager.impl.register(sequence);
  return sequence;
}
function getDeferBlockDataIndex(deferBlockIndex) {
  return deferBlockIndex + 1;
}
function getLDeferBlockDetails(lView, tNode) {
  const tView = lView[TVIEW];
  const slotIndex = getDeferBlockDataIndex(tNode.index);
  ngDevMode && assertIndexInDeclRange(tView, slotIndex);
  return lView[slotIndex];
}
function setLDeferBlockDetails(lView, deferBlockIndex, lDetails) {
  const tView = lView[TVIEW];
  const slotIndex = getDeferBlockDataIndex(deferBlockIndex);
  ngDevMode && assertIndexInDeclRange(tView, slotIndex);
  lView[slotIndex] = lDetails;
}
function getTDeferBlockDetails(tView, tNode) {
  const slotIndex = getDeferBlockDataIndex(tNode.index);
  ngDevMode && assertIndexInDeclRange(tView, slotIndex);
  return tView.data[slotIndex];
}
function setTDeferBlockDetails(tView, deferBlockIndex, deferBlockConfig) {
  const slotIndex = getDeferBlockDataIndex(deferBlockIndex);
  ngDevMode && assertIndexInDeclRange(tView, slotIndex);
  tView.data[slotIndex] = deferBlockConfig;
}
function getTemplateIndexForState(newState, hostLView, tNode) {
  const tView = hostLView[TVIEW];
  const tDetails = getTDeferBlockDetails(tView, tNode);
  switch (newState) {
    case DeferBlockState.Complete:
      return tDetails.primaryTmplIndex;
    case DeferBlockState.Loading:
      return tDetails.loadingTmplIndex;
    case DeferBlockState.Error:
      return tDetails.errorTmplIndex;
    case DeferBlockState.Placeholder:
      return tDetails.placeholderTmplIndex;
    default:
      ngDevMode && throwError2(`Unexpected defer block state: ${newState}`);
      return null;
  }
}
function getMinimumDurationForState(tDetails, currentState) {
  if (currentState === DeferBlockState.Placeholder) {
    return tDetails.placeholderBlockConfig?.[MINIMUM_SLOT] ?? null;
  } else if (currentState === DeferBlockState.Loading) {
    return tDetails.loadingBlockConfig?.[MINIMUM_SLOT] ?? null;
  }
  return null;
}
function getLoadingBlockAfter(tDetails) {
  return tDetails.loadingBlockConfig?.[LOADING_AFTER_SLOT] ?? null;
}
function addDepsToRegistry(currentDeps, newDeps) {
  if (!currentDeps || currentDeps.length === 0) {
    return newDeps;
  }
  const currentDepSet = new Set(currentDeps);
  for (const dep of newDeps) {
    currentDepSet.add(dep);
  }
  return currentDeps.length === currentDepSet.size ? currentDeps : Array.from(currentDepSet);
}
function getPrimaryBlockTNode(tView, tDetails) {
  const adjustedIndex = tDetails.primaryTmplIndex + HEADER_OFFSET;
  return getTNode(tView, adjustedIndex);
}
function assertDeferredDependenciesLoaded(tDetails) {
  assertEqual(tDetails.loadingState, DeferDependenciesLoadingState.COMPLETE, "Expecting all deferred dependencies to be loaded.");
}
function isTDeferBlockDetails(value) {
  return value !== null && typeof value === "object" && typeof value.primaryTmplIndex === "number";
}
function trackTriggerForDebugging(tView, tNode, textRepresentation) {
  const tDetails = getTDeferBlockDetails(tView, tNode);
  tDetails.debug ??= {};
  tDetails.debug.triggers ??= /* @__PURE__ */ new Set();
  tDetails.debug.triggers.add(textRepresentation);
}
function onViewportWrapper(trigger, callback, injector) {
  const ngZone = injector.get(NgZone);
  return onViewport(trigger, () => ngZone.run(callback), () => ngZone.runOutsideAngular(() => createIntersectionObserver()));
}
function getTriggerLView(deferredHostLView, deferredTNode, walkUpTimes) {
  if (walkUpTimes == null) {
    return deferredHostLView;
  }
  if (walkUpTimes >= 0) {
    return walkUpViews(walkUpTimes, deferredHostLView);
  }
  const deferredContainer = deferredHostLView[deferredTNode.index];
  ngDevMode && assertLContainer(deferredContainer);
  const triggerLView = deferredContainer[CONTAINER_HEADER_OFFSET] ?? null;
  if (ngDevMode && triggerLView !== null) {
    const lDetails = getLDeferBlockDetails(deferredHostLView, deferredTNode);
    const renderedState = lDetails[DEFER_BLOCK_STATE];
    assertEqual(renderedState, DeferBlockState.Placeholder, "Expected a placeholder to be rendered in this defer block.");
    assertLView(triggerLView);
  }
  return triggerLView;
}
function getTriggerElement(triggerLView, triggerIndex) {
  const element = getNativeByIndex(HEADER_OFFSET + triggerIndex, triggerLView);
  ngDevMode && assertElement(element);
  return element;
}
function registerDomTrigger(initialLView, tNode, triggerIndex, walkUpTimes, registerFn, callback, type) {
  const injector = initialLView[INJECTOR];
  const zone = injector.get(NgZone);
  let poll;
  function pollDomTrigger() {
    if (isDestroyed(initialLView)) {
      poll.destroy();
      return;
    }
    const lDetails = getLDeferBlockDetails(initialLView, tNode);
    const renderedState = lDetails[DEFER_BLOCK_STATE];
    if (renderedState !== DeferBlockInternalState.Initial && renderedState !== DeferBlockState.Placeholder) {
      poll.destroy();
      return;
    }
    const triggerLView = getTriggerLView(initialLView, tNode, walkUpTimes);
    if (!triggerLView) {
      return;
    }
    poll.destroy();
    if (isDestroyed(triggerLView)) {
      return;
    }
    const element = getTriggerElement(triggerLView, triggerIndex);
    const cleanup = registerFn(element, () => {
      zone.run(() => {
        if (initialLView !== triggerLView) {
          removeLViewOnDestroy(triggerLView, cleanup);
        }
        callback();
      });
    }, injector);
    if (initialLView !== triggerLView) {
      storeLViewOnDestroy(triggerLView, cleanup);
    }
    storeTriggerCleanupFn(type, lDetails, cleanup);
  }
  poll = afterEveryRender({ read: pollDomTrigger }, { injector });
}
function onIdle(callback, injector) {
  const scheduler = injector.get(IdleScheduler);
  const cleanupFn = () => scheduler.remove(callback);
  scheduler.add(callback);
  return cleanupFn;
}
var _requestIdleCallback = () => typeof requestIdleCallback !== "undefined" ? requestIdleCallback : setTimeout;
var _cancelIdleCallback = () => typeof requestIdleCallback !== "undefined" ? cancelIdleCallback : clearTimeout;
var IdleScheduler = class _IdleScheduler {
  // Indicates whether current callbacks are being invoked.
  executingCallbacks = false;
  // Currently scheduled idle callback id.
  idleId = null;
  // Set of callbacks to be invoked next.
  current = /* @__PURE__ */ new Set();
  // Set of callbacks collected while invoking current set of callbacks.
  // Those callbacks are scheduled for the next idle period.
  deferred = /* @__PURE__ */ new Set();
  ngZone = inject2(NgZone);
  requestIdleCallbackFn = _requestIdleCallback().bind(globalThis);
  cancelIdleCallbackFn = _cancelIdleCallback().bind(globalThis);
  add(callback) {
    const target = this.executingCallbacks ? this.deferred : this.current;
    target.add(callback);
    if (this.idleId === null) {
      this.scheduleIdleCallback();
    }
  }
  remove(callback) {
    const { current, deferred } = this;
    current.delete(callback);
    deferred.delete(callback);
    if (current.size === 0 && deferred.size === 0) {
      this.cancelIdleCallback();
    }
  }
  scheduleIdleCallback() {
    const callback = () => {
      this.cancelIdleCallback();
      this.executingCallbacks = true;
      for (const callback2 of this.current) {
        callback2();
      }
      this.current.clear();
      this.executingCallbacks = false;
      if (this.deferred.size > 0) {
        for (const callback2 of this.deferred) {
          this.current.add(callback2);
        }
        this.deferred.clear();
        this.scheduleIdleCallback();
      }
    };
    this.idleId = this.requestIdleCallbackFn(() => this.ngZone.run(callback));
  }
  cancelIdleCallback() {
    if (this.idleId !== null) {
      this.cancelIdleCallbackFn(this.idleId);
      this.idleId = null;
    }
  }
  ngOnDestroy() {
    this.cancelIdleCallback();
    this.current.clear();
    this.deferred.clear();
  }
  /** @nocollapse */
  static \u0275prov = (
    /** @pureOrBreakMyCode */
    /* @__PURE__ */ \u0275\u0275defineInjectable({
      token: _IdleScheduler,
      providedIn: "root",
      factory: () => new _IdleScheduler()
    })
  );
};
function onTimer(delay) {
  return (callback, injector) => scheduleTimerTrigger(delay, callback, injector);
}
function scheduleTimerTrigger(delay, callback, injector) {
  const scheduler = injector.get(TimerScheduler);
  const ngZone = injector.get(NgZone);
  const cleanupFn = () => scheduler.remove(callback);
  scheduler.add(delay, callback, ngZone);
  return cleanupFn;
}
var TimerScheduler = class _TimerScheduler {
  // Indicates whether current callbacks are being invoked.
  executingCallbacks = false;
  // Currently scheduled `setTimeout` id.
  timeoutId = null;
  // When currently scheduled timer would fire.
  invokeTimerAt = null;
  // List of callbacks to be invoked.
  // For each callback we also store a timestamp on when the callback
  // should be invoked. We store timestamps and callback functions
  // in a flat array to avoid creating new objects for each entry.
  // [timestamp1, callback1, timestamp2, callback2, ...]
  current = [];
  // List of callbacks collected while invoking current set of callbacks.
  // Those callbacks are added to the "current" queue at the end of
  // the current callback invocation. The shape of this list is the same
  // as the shape of the `current` list.
  deferred = [];
  add(delay, callback, ngZone) {
    const target = this.executingCallbacks ? this.deferred : this.current;
    this.addToQueue(target, Date.now() + delay, callback);
    this.scheduleTimer(ngZone);
  }
  remove(callback) {
    const { current, deferred } = this;
    const callbackIndex = this.removeFromQueue(current, callback);
    if (callbackIndex === -1) {
      this.removeFromQueue(deferred, callback);
    }
    if (current.length === 0 && deferred.length === 0) {
      this.clearTimeout();
    }
  }
  addToQueue(target, invokeAt, callback) {
    let insertAtIndex = target.length;
    for (let i = 0; i < target.length; i += 2) {
      const invokeQueuedCallbackAt = target[i];
      if (invokeQueuedCallbackAt > invokeAt) {
        insertAtIndex = i;
        break;
      }
    }
    arrayInsert2(target, insertAtIndex, invokeAt, callback);
  }
  removeFromQueue(target, callback) {
    let index = -1;
    for (let i = 0; i < target.length; i += 2) {
      const queuedCallback = target[i + 1];
      if (queuedCallback === callback) {
        index = i;
        break;
      }
    }
    if (index > -1) {
      arraySplice(target, index, 2);
    }
    return index;
  }
  scheduleTimer(ngZone) {
    const callback = () => {
      this.clearTimeout();
      this.executingCallbacks = true;
      const current = [...this.current];
      const now = Date.now();
      for (let i = 0; i < current.length; i += 2) {
        const invokeAt = current[i];
        const callback2 = current[i + 1];
        if (invokeAt <= now) {
          callback2();
        } else {
          break;
        }
      }
      let lastCallbackIndex = -1;
      for (let i = 0; i < this.current.length; i += 2) {
        const invokeAt = this.current[i];
        if (invokeAt <= now) {
          lastCallbackIndex = i + 1;
        } else {
          break;
        }
      }
      if (lastCallbackIndex >= 0) {
        arraySplice(this.current, 0, lastCallbackIndex + 1);
      }
      this.executingCallbacks = false;
      if (this.deferred.length > 0) {
        for (let i = 0; i < this.deferred.length; i += 2) {
          const invokeAt = this.deferred[i];
          const callback2 = this.deferred[i + 1];
          this.addToQueue(this.current, invokeAt, callback2);
        }
        this.deferred.length = 0;
      }
      this.scheduleTimer(ngZone);
    };
    const FRAME_DURATION_MS = 16;
    if (this.current.length > 0) {
      const now = Date.now();
      const invokeAt = this.current[0];
      if (this.timeoutId === null || // Reschedule a timer in case a queue contains an item with
      // an earlier timestamp and the delta is more than an average
      // frame duration.
      this.invokeTimerAt && this.invokeTimerAt - invokeAt > FRAME_DURATION_MS) {
        this.clearTimeout();
        const timeout = Math.max(invokeAt - now, FRAME_DURATION_MS);
        this.invokeTimerAt = invokeAt;
        this.timeoutId = ngZone.runOutsideAngular(() => {
          return setTimeout(() => ngZone.run(callback), timeout);
        });
      }
    }
  }
  clearTimeout() {
    if (this.timeoutId !== null) {
      clearTimeout(this.timeoutId);
      this.timeoutId = null;
    }
  }
  ngOnDestroy() {
    this.clearTimeout();
    this.current.length = 0;
    this.deferred.length = 0;
  }
  /** @nocollapse */
  static \u0275prov = (
    /** @pureOrBreakMyCode */
    /* @__PURE__ */ \u0275\u0275defineInjectable({
      token: _TimerScheduler,
      providedIn: "root",
      factory: () => new _TimerScheduler()
    })
  );
};
var CachedInjectorService = class _CachedInjectorService {
  cachedInjectors = /* @__PURE__ */ new Map();
  getOrCreateInjector(key, parentInjector, providers, debugName) {
    if (!this.cachedInjectors.has(key)) {
      const injector = providers.length > 0 ? createEnvironmentInjector(providers, parentInjector, debugName) : null;
      this.cachedInjectors.set(key, injector);
    }
    return this.cachedInjectors.get(key);
  }
  ngOnDestroy() {
    try {
      for (const injector of this.cachedInjectors.values()) {
        if (injector !== null) {
          injector.destroy();
        }
      }
    } finally {
      this.cachedInjectors.clear();
    }
  }
  /** @nocollapse */
  static \u0275prov = (
    /** @pureOrBreakMyCode */
    /* @__PURE__ */ \u0275\u0275defineInjectable({
      token: _CachedInjectorService,
      providedIn: "environment",
      factory: () => new _CachedInjectorService()
    })
  );
};
var DEFER_BLOCK_DEPENDENCY_INTERCEPTOR = /* @__PURE__ */ new InjectionToken("DEFER_BLOCK_DEPENDENCY_INTERCEPTOR");
var DEFER_BLOCK_CONFIG = new InjectionToken(ngDevMode ? "DEFER_BLOCK_CONFIG" : "");
function getOrCreateEnvironmentInjector(parentInjector, tDetails, providers) {
  return parentInjector.get(CachedInjectorService).getOrCreateInjector(tDetails, parentInjector, providers, ngDevMode ? "DeferBlock Injector" : "");
}
function createDeferBlockInjector(parentInjector, tDetails, providers) {
  if (parentInjector instanceof ChainedInjector) {
    const origInjector = parentInjector.injector;
    const parentEnvInjector2 = parentInjector.parentInjector;
    const envInjector = getOrCreateEnvironmentInjector(parentEnvInjector2, tDetails, providers);
    return new ChainedInjector(origInjector, envInjector);
  }
  const parentEnvInjector = parentInjector.get(EnvironmentInjector);
  if (parentEnvInjector !== parentInjector) {
    const envInjector = getOrCreateEnvironmentInjector(parentEnvInjector, tDetails, providers);
    return new ChainedInjector(parentInjector, envInjector);
  }
  return getOrCreateEnvironmentInjector(parentInjector, tDetails, providers);
}
function renderDeferBlockState(newState, tNode, lContainer, skipTimerScheduling = false) {
  const hostLView = lContainer[PARENT];
  const hostTView = hostLView[TVIEW];
  if (isDestroyed(hostLView))
    return;
  ngDevMode && assertTNodeForLView(tNode, hostLView);
  const lDetails = getLDeferBlockDetails(hostLView, tNode);
  ngDevMode && assertDefined(lDetails, "Expected a defer block state defined");
  const currentState = lDetails[DEFER_BLOCK_STATE];
  const ssrState = lDetails[SSR_BLOCK_STATE];
  if (ssrState !== null && newState < ssrState) {
    return;
  }
  if (isValidStateChange(currentState, newState) && isValidStateChange(lDetails[NEXT_DEFER_BLOCK_STATE] ?? -1, newState)) {
    const tDetails = getTDeferBlockDetails(hostTView, tNode);
    const needsScheduling = !skipTimerScheduling && true && (getLoadingBlockAfter(tDetails) !== null || getMinimumDurationForState(tDetails, DeferBlockState.Loading) !== null || getMinimumDurationForState(tDetails, DeferBlockState.Placeholder));
    if (ngDevMode && needsScheduling) {
      assertDefined(applyDeferBlockStateWithSchedulingImpl, "Expected scheduling function to be defined");
    }
    const applyStateFn = needsScheduling ? applyDeferBlockStateWithSchedulingImpl : applyDeferBlockState;
    try {
      applyStateFn(newState, lDetails, lContainer, tNode, hostLView);
    } catch (error) {
      handleUncaughtError(hostLView, error);
    }
  }
}
function findMatchingDehydratedViewForDeferBlock(lContainer, lDetails) {
  const dehydratedViewIx = lContainer[DEHYDRATED_VIEWS]?.findIndex((view) => view.data[DEFER_BLOCK_STATE$1] === lDetails[DEFER_BLOCK_STATE]) ?? -1;
  const dehydratedView = dehydratedViewIx > -1 ? lContainer[DEHYDRATED_VIEWS][dehydratedViewIx] : null;
  return { dehydratedView, dehydratedViewIx };
}
function applyDeferBlockState(newState, lDetails, lContainer, tNode, hostLView) {
  profiler(
    20
    /* ProfilerEvent.DeferBlockStateStart */
  );
  const stateTmplIndex = getTemplateIndexForState(newState, hostLView, tNode);
  if (stateTmplIndex !== null) {
    lDetails[DEFER_BLOCK_STATE] = newState;
    const hostTView = hostLView[TVIEW];
    const adjustedIndex = stateTmplIndex + HEADER_OFFSET;
    const activeBlockTNode = getTNode(hostTView, adjustedIndex);
    const viewIndex = 0;
    removeLViewFromLContainer(lContainer, viewIndex);
    let injector;
    if (newState === DeferBlockState.Complete) {
      const tDetails = getTDeferBlockDetails(hostTView, tNode);
      const providers = tDetails.providers;
      if (providers && providers.length > 0) {
        injector = createDeferBlockInjector(hostLView[INJECTOR], tDetails, providers);
      }
    }
    const { dehydratedView, dehydratedViewIx } = findMatchingDehydratedViewForDeferBlock(lContainer, lDetails);
    const embeddedLView = createAndRenderEmbeddedLView(hostLView, activeBlockTNode, null, {
      injector,
      dehydratedView
    });
    addLViewToLContainer(lContainer, embeddedLView, viewIndex, shouldAddViewToDom(activeBlockTNode, dehydratedView));
    markViewDirty(
      embeddedLView,
      2
      /* NotificationSource.DeferBlockStateUpdate */
    );
    if (dehydratedViewIx > -1) {
      lContainer[DEHYDRATED_VIEWS]?.splice(dehydratedViewIx, 1);
    }
    if ((newState === DeferBlockState.Complete || newState === DeferBlockState.Error) && Array.isArray(lDetails[ON_COMPLETE_FNS])) {
      for (const callback of lDetails[ON_COMPLETE_FNS]) {
        callback();
      }
      lDetails[ON_COMPLETE_FNS] = null;
    }
  }
  profiler(
    21
    /* ProfilerEvent.DeferBlockStateEnd */
  );
}
function applyDeferBlockStateWithScheduling(newState, lDetails, lContainer, tNode, hostLView) {
  const now = Date.now();
  const hostTView = hostLView[TVIEW];
  const tDetails = getTDeferBlockDetails(hostTView, tNode);
  if (lDetails[STATE_IS_FROZEN_UNTIL] === null || lDetails[STATE_IS_FROZEN_UNTIL] <= now) {
    lDetails[STATE_IS_FROZEN_UNTIL] = null;
    const loadingAfter = getLoadingBlockAfter(tDetails);
    const inLoadingAfterPhase = lDetails[LOADING_AFTER_CLEANUP_FN] !== null;
    if (newState === DeferBlockState.Loading && loadingAfter !== null && !inLoadingAfterPhase) {
      lDetails[NEXT_DEFER_BLOCK_STATE] = newState;
      const cleanupFn = scheduleDeferBlockUpdate(loadingAfter, lDetails, tNode, lContainer, hostLView);
      lDetails[LOADING_AFTER_CLEANUP_FN] = cleanupFn;
    } else {
      if (newState > DeferBlockState.Loading && inLoadingAfterPhase) {
        lDetails[LOADING_AFTER_CLEANUP_FN]();
        lDetails[LOADING_AFTER_CLEANUP_FN] = null;
        lDetails[NEXT_DEFER_BLOCK_STATE] = null;
      }
      applyDeferBlockState(newState, lDetails, lContainer, tNode, hostLView);
      const duration = getMinimumDurationForState(tDetails, newState);
      if (duration !== null) {
        lDetails[STATE_IS_FROZEN_UNTIL] = now + duration;
        scheduleDeferBlockUpdate(duration, lDetails, tNode, lContainer, hostLView);
      }
    }
  } else {
    lDetails[NEXT_DEFER_BLOCK_STATE] = newState;
  }
}
function scheduleDeferBlockUpdate(timeout, lDetails, tNode, lContainer, hostLView) {
  const callback = () => {
    const nextState = lDetails[NEXT_DEFER_BLOCK_STATE];
    lDetails[STATE_IS_FROZEN_UNTIL] = null;
    lDetails[NEXT_DEFER_BLOCK_STATE] = null;
    if (nextState !== null) {
      renderDeferBlockState(nextState, tNode, lContainer);
    }
  };
  return scheduleTimerTrigger(timeout, callback, hostLView[INJECTOR]);
}
function isValidStateChange(currentState, newState) {
  return currentState < newState;
}
function renderPlaceholder(lView, tNode) {
  const lContainer = lView[tNode.index];
  ngDevMode && assertLContainer(lContainer);
  renderDeferBlockState(DeferBlockState.Placeholder, tNode, lContainer);
}
function renderDeferStateAfterResourceLoading(tDetails, tNode, lContainer) {
  ngDevMode && assertDefined(tDetails.loadingPromise, "Expected loading Promise to exist on this defer block");
  tDetails.loadingPromise.then(() => {
    if (tDetails.loadingState === DeferDependenciesLoadingState.COMPLETE) {
      ngDevMode && assertDeferredDependenciesLoaded(tDetails);
      renderDeferBlockState(DeferBlockState.Complete, tNode, lContainer);
    } else if (tDetails.loadingState === DeferDependenciesLoadingState.FAILED) {
      renderDeferBlockState(DeferBlockState.Error, tNode, lContainer);
    }
  });
}
var applyDeferBlockStateWithSchedulingImpl = null;
function \u0275\u0275deferEnableTimerScheduling(tView, tDetails, placeholderConfigIndex, loadingConfigIndex) {
  const tViewConsts = tView.consts;
  if (placeholderConfigIndex != null) {
    tDetails.placeholderBlockConfig = getConstant(tViewConsts, placeholderConfigIndex);
  }
  if (loadingConfigIndex != null) {
    tDetails.loadingBlockConfig = getConstant(tViewConsts, loadingConfigIndex);
  }
  if (applyDeferBlockStateWithSchedulingImpl === null) {
    applyDeferBlockStateWithSchedulingImpl = applyDeferBlockStateWithScheduling;
  }
}
function setClassMetadata(type, decorators, ctorParameters, propDecorators) {
  return noSideEffects(() => {
    const clazz = type;
    if (decorators !== null) {
      if (clazz.hasOwnProperty("decorators") && clazz.decorators !== void 0) {
        clazz.decorators.push(...decorators);
      } else {
        clazz.decorators = decorators;
      }
    }
    if (ctorParameters !== null) {
      clazz.ctorParameters = ctorParameters;
    }
    if (propDecorators !== null) {
      if (clazz.hasOwnProperty("propDecorators") && clazz.propDecorators !== void 0) {
        clazz.propDecorators = __spreadValues(__spreadValues({}, clazz.propDecorators), propDecorators);
      } else {
        clazz.propDecorators = propDecorators;
      }
    }
  });
}
var Console = class _Console {
  log(message) {
    console.log(message);
  }
  // Note: for reporting errors use `DOM.logError()` as it is platform specific
  warn(message) {
    console.warn(message);
  }
  static \u0275fac = function Console_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _Console)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _Console, factory: _Console.\u0275fac, providedIn: "platform" });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(Console, [{
    type: Injectable,
    args: [{ providedIn: "platform" }]
  }], null, null);
})();
var DIDebugData = class {
  resolverToTokenToDependencies = /* @__PURE__ */ new WeakMap();
  resolverToProviders = /* @__PURE__ */ new WeakMap();
  resolverToEffects = /* @__PURE__ */ new WeakMap();
  standaloneInjectorToComponent = /* @__PURE__ */ new WeakMap();
  reset() {
    this.resolverToTokenToDependencies = /* @__PURE__ */ new WeakMap();
    this.resolverToProviders = /* @__PURE__ */ new WeakMap();
    this.standaloneInjectorToComponent = /* @__PURE__ */ new WeakMap();
  }
};
var frameworkDIDebugData = new DIDebugData();
function getFrameworkDIDebugData() {
  return frameworkDIDebugData;
}
function setupFrameworkInjectorProfiler() {
  frameworkDIDebugData.reset();
  setInjectorProfiler(injectorProfilerEventHandler);
}
function injectorProfilerEventHandler(injectorProfilerEvent) {
  const { context: context2, type } = injectorProfilerEvent;
  if (type === 0) {
    handleInjectEvent(context2, injectorProfilerEvent.service);
  } else if (type === 1) {
    handleInstanceCreatedByInjectorEvent(context2, injectorProfilerEvent.instance);
  } else if (type === 2) {
    handleProviderConfiguredEvent(context2, injectorProfilerEvent.providerRecord);
  } else if (type === 3) {
    handleEffectCreatedEvent(context2, injectorProfilerEvent.effect);
  }
}
function handleEffectCreatedEvent(context2, effect2) {
  const diResolver = getDIResolver(context2.injector);
  if (diResolver === null) {
    throwError2("An EffectCreated event must be run within an injection context.");
  }
  const { resolverToEffects } = frameworkDIDebugData;
  if (!resolverToEffects.has(diResolver)) {
    resolverToEffects.set(diResolver, []);
  }
  resolverToEffects.get(diResolver).push(effect2);
}
function handleInjectEvent(context2, data) {
  const diResolver = getDIResolver(context2.injector);
  if (diResolver === null) {
    throwError2("An Inject event must be run within an injection context.");
  }
  const diResolverToInstantiatedToken = frameworkDIDebugData.resolverToTokenToDependencies;
  if (!diResolverToInstantiatedToken.has(diResolver)) {
    diResolverToInstantiatedToken.set(diResolver, /* @__PURE__ */ new WeakMap());
  }
  if (!canBeHeldWeakly(context2.token)) {
    return;
  }
  const instantiatedTokenToDependencies = diResolverToInstantiatedToken.get(diResolver);
  if (!instantiatedTokenToDependencies.has(context2.token)) {
    instantiatedTokenToDependencies.set(context2.token, []);
  }
  const { token, value, flags } = data;
  assertDefined(context2.token, "Injector profiler context token is undefined.");
  const dependencies = instantiatedTokenToDependencies.get(context2.token);
  assertDefined(dependencies, "Could not resolve dependencies for token.");
  if (context2.injector instanceof NodeInjector) {
    dependencies.push({ token, value, flags, injectedIn: getNodeInjectorContext(context2.injector) });
  } else {
    dependencies.push({ token, value, flags });
  }
}
function getNodeInjectorContext(injector) {
  if (!(injector instanceof NodeInjector)) {
    throwError2("getNodeInjectorContext must be called with a NodeInjector");
  }
  const lView = getNodeInjectorLView(injector);
  const tNode = getNodeInjectorTNode(injector);
  if (tNode === null) {
    return;
  }
  assertTNodeForLView(tNode, lView);
  return { lView, tNode };
}
function handleInstanceCreatedByInjectorEvent(context2, data) {
  const { value } = data;
  if (data.value == null) {
    return;
  }
  if (getDIResolver(context2.injector) === null) {
    throwError2("An InjectorCreatedInstance event must be run within an injection context.");
  }
  let standaloneComponent = void 0;
  if (typeof value === "object") {
    standaloneComponent = value?.constructor;
  }
  if (standaloneComponent == void 0 || !isStandaloneComponent(standaloneComponent)) {
    return;
  }
  const environmentInjector = context2.injector.get(EnvironmentInjector, null, { optional: true });
  if (environmentInjector === null) {
    return;
  }
  const { standaloneInjectorToComponent } = frameworkDIDebugData;
  if (standaloneInjectorToComponent.has(environmentInjector)) {
    return;
  }
  standaloneInjectorToComponent.set(environmentInjector, standaloneComponent);
}
function isStandaloneComponent(value) {
  const def = getComponentDef(value);
  return !!def?.standalone;
}
function handleProviderConfiguredEvent(context2, data) {
  const { resolverToProviders } = frameworkDIDebugData;
  let diResolver;
  if (context2?.injector instanceof NodeInjector) {
    diResolver = getNodeInjectorTNode(context2.injector);
  } else {
    diResolver = context2.injector;
  }
  if (diResolver === null) {
    throwError2("A ProviderConfigured event must be run within an injection context.");
  }
  if (!resolverToProviders.has(diResolver)) {
    resolverToProviders.set(diResolver, []);
  }
  resolverToProviders.get(diResolver).push(data);
}
function getDIResolver(injector) {
  let diResolver = null;
  if (injector === void 0) {
    return diResolver;
  }
  if (injector instanceof NodeInjector) {
    diResolver = getNodeInjectorLView(injector);
  } else {
    diResolver = injector;
  }
  return diResolver;
}
function canBeHeldWeakly(value) {
  return value !== null && (typeof value === "object" || typeof value === "function" || typeof value === "symbol");
}
function applyChanges(component) {
  ngDevMode && assertDefined(component, "component");
  markViewDirty(
    getComponentViewByInstance(component),
    3
    /* NotificationSource.DebugApplyChanges */
  );
  getRootComponents(component).forEach((rootComponent) => detectChanges(rootComponent));
}
function detectChanges(component) {
  const view = getComponentViewByInstance(component);
  view[FLAGS] |= 1024;
  detectChangesInternal(view);
}
function getDeferBlocks$1(lView, deferBlocks) {
  const tView = lView[TVIEW];
  for (let i = HEADER_OFFSET; i < tView.bindingStartIndex; i++) {
    if (isLContainer(lView[i])) {
      const lContainer = lView[i];
      const isLast = i === tView.bindingStartIndex - 1;
      if (!isLast) {
        const tNode = tView.data[i];
        const tDetails = getTDeferBlockDetails(tView, tNode);
        if (isTDeferBlockDetails(tDetails)) {
          deferBlocks.push({ lContainer, lView, tNode, tDetails });
          continue;
        }
      }
      if (isLView(lContainer[HOST])) {
        getDeferBlocks$1(lContainer[HOST], deferBlocks);
      }
      for (let j = CONTAINER_HEADER_OFFSET; j < lContainer.length; j++) {
        getDeferBlocks$1(lContainer[j], deferBlocks);
      }
    } else if (isLView(lView[i])) {
      getDeferBlocks$1(lView[i], deferBlocks);
    }
  }
}
function getDeferBlocks(node) {
  const results = [];
  const lView = getLContext(node)?.lView;
  if (lView) {
    findDeferBlocks(node, lView, results);
  }
  return results;
}
function findDeferBlocks(node, lView, results) {
  const viewInjector = lView[INJECTOR];
  const registry = viewInjector.get(DEHYDRATED_BLOCK_REGISTRY, null, { optional: true });
  const blocks = [];
  getDeferBlocks$1(lView, blocks);
  const transferState = viewInjector.get(TransferState);
  const deferBlockParents = transferState.get(NGH_DEFER_BLOCKS_KEY, {});
  for (const details of blocks) {
    const native = getNativeByTNode(details.tNode, details.lView);
    const lDetails = getLDeferBlockDetails(details.lView, details.tNode);
    if (!node.contains(native)) {
      continue;
    }
    const tDetails = details.tDetails;
    const renderedLView = getRendererLView(details);
    const rootNodes = [];
    const hydrationState = inferHydrationState(tDetails, lDetails, registry);
    if (renderedLView !== null) {
      collectNativeNodes(renderedLView[TVIEW], renderedLView, renderedLView[TVIEW].firstChild, rootNodes);
    } else if (hydrationState === "dehydrated") {
      const deferId = lDetails[SSR_UNIQUE_ID];
      const deferData = deferBlockParents[deferId];
      const numberOfRootNodes = deferData[NUM_ROOT_NODES];
      let collectedNodeCount = 0;
      const deferBlockCommentNode = details.lContainer[NATIVE];
      let currentNode = deferBlockCommentNode.previousSibling;
      while (collectedNodeCount < numberOfRootNodes && currentNode) {
        rootNodes.unshift(currentNode);
        currentNode = currentNode.previousSibling;
        collectedNodeCount++;
      }
    }
    const data = {
      state: stringifyState(lDetails[DEFER_BLOCK_STATE]),
      incrementalHydrationState: hydrationState,
      hasErrorBlock: tDetails.errorTmplIndex !== null,
      loadingBlock: {
        exists: tDetails.loadingTmplIndex !== null,
        minimumTime: tDetails.loadingBlockConfig?.[MINIMUM_SLOT] ?? null,
        afterTime: tDetails.loadingBlockConfig?.[LOADING_AFTER_SLOT] ?? null
      },
      placeholderBlock: {
        exists: tDetails.placeholderTmplIndex !== null,
        minimumTime: tDetails.placeholderBlockConfig?.[MINIMUM_SLOT] ?? null
      },
      triggers: tDetails.debug?.triggers ? Array.from(tDetails.debug.triggers).sort() : [],
      rootNodes
    };
    results.push(data);
    if (renderedLView !== null) {
      findDeferBlocks(node, renderedLView, results);
    }
  }
}
function stringifyState(state) {
  switch (state) {
    case DeferBlockState.Complete:
      return "complete";
    case DeferBlockState.Loading:
      return "loading";
    case DeferBlockState.Placeholder:
      return "placeholder";
    case DeferBlockState.Error:
      return "error";
    case DeferBlockInternalState.Initial:
      return "initial";
    default:
      throw new Error(`Unrecognized state ${state}`);
  }
}
function inferHydrationState(tDetails, lDetails, registry) {
  if (registry === null || lDetails[SSR_UNIQUE_ID] === null || tDetails.hydrateTriggers === null || tDetails.hydrateTriggers.has(
    7
    /* DeferBlockTrigger.Never */
  )) {
    return "not-configured";
  }
  return registry.has(lDetails[SSR_UNIQUE_ID]) ? "dehydrated" : "hydrated";
}
function getRendererLView(details) {
  if (details.lContainer.length <= CONTAINER_HEADER_OFFSET) {
    return null;
  }
  const lView = details.lContainer[CONTAINER_HEADER_OFFSET];
  ngDevMode && assertLView(lView);
  return lView;
}
function getDependenciesFromInjectable(injector, token) {
  const instance = injector.get(token, null, { self: true, optional: true });
  if (instance === null) {
    throw new Error(`Unable to determine instance of ${token} in given injector`);
  }
  const unformattedDependencies = getDependenciesForTokenInInjector(token, injector);
  const resolutionPath = getInjectorResolutionPath(injector);
  const dependencies = unformattedDependencies.map((dep) => {
    const formattedDependency = {
      value: dep.value
    };
    const flags = dep.flags;
    formattedDependency.flags = {
      optional: (8 & flags) === 8,
      host: (1 & flags) === 1,
      self: (2 & flags) === 2,
      skipSelf: (4 & flags) === 4
    };
    for (let i = 0; i < resolutionPath.length; i++) {
      const injectorToCheck = resolutionPath[i];
      if (i === 0 && formattedDependency.flags.skipSelf) {
        continue;
      }
      if (formattedDependency.flags.host && injectorToCheck instanceof EnvironmentInjector) {
        break;
      }
      const instance2 = injectorToCheck.get(dep.token, null, {
        self: true,
        optional: true
      });
      if (instance2 !== null) {
        if (formattedDependency.flags.host) {
          const firstInjector = resolutionPath[0];
          const lookupFromFirstInjector = firstInjector.get(dep.token, null, __spreadProps(__spreadValues({}, formattedDependency.flags), {
            optional: true
          }));
          if (lookupFromFirstInjector !== null) {
            formattedDependency.providedIn = injectorToCheck;
          }
          break;
        }
        formattedDependency.providedIn = injectorToCheck;
        break;
      }
      if (i === 0 && formattedDependency.flags.self) {
        break;
      }
    }
    if (dep.token)
      formattedDependency.token = dep.token;
    return formattedDependency;
  });
  return { instance, dependencies };
}
function getDependenciesForTokenInInjector(token, injector) {
  const { resolverToTokenToDependencies } = getFrameworkDIDebugData();
  if (!(injector instanceof NodeInjector)) {
    return resolverToTokenToDependencies.get(injector)?.get?.(token) ?? [];
  }
  const lView = getNodeInjectorLView(injector);
  const tokenDependencyMap = resolverToTokenToDependencies.get(lView);
  const dependencies = tokenDependencyMap?.get(token) ?? [];
  return dependencies.filter((dependency) => {
    const dependencyNode = dependency.injectedIn?.tNode;
    if (dependencyNode === void 0) {
      return false;
    }
    const instanceNode = getNodeInjectorTNode(injector);
    assertTNode(dependencyNode);
    assertTNode(instanceNode);
    return dependencyNode === instanceNode;
  });
}
function getProviderImportsContainer(injector) {
  const { standaloneInjectorToComponent } = getFrameworkDIDebugData();
  if (standaloneInjectorToComponent.has(injector)) {
    return standaloneInjectorToComponent.get(injector);
  }
  const defTypeRef = injector.get(NgModuleRef$1, null, { self: true, optional: true });
  if (defTypeRef === null) {
    return null;
  }
  if (defTypeRef.instance === null) {
    return null;
  }
  return defTypeRef.instance.constructor;
}
function getNodeInjectorProviders(injector) {
  const diResolver = getNodeInjectorTNode(injector);
  const { resolverToProviders } = getFrameworkDIDebugData();
  return resolverToProviders.get(diResolver) ?? [];
}
function getProviderImportPaths(providerImportsContainer) {
  const providerToPath = /* @__PURE__ */ new Map();
  const visitedContainers = /* @__PURE__ */ new Set();
  const visitor = walkProviderTreeToDiscoverImportPaths(providerToPath, visitedContainers);
  walkProviderTree(providerImportsContainer, visitor, [], /* @__PURE__ */ new Set());
  return providerToPath;
}
function walkProviderTreeToDiscoverImportPaths(providerToPath, visitedContainers) {
  return (provider, container) => {
    if (!providerToPath.has(provider)) {
      providerToPath.set(provider, [container]);
    }
    if (!visitedContainers.has(container)) {
      for (const prov of providerToPath.keys()) {
        const existingImportPath = providerToPath.get(prov);
        let containerDef = getInjectorDef(container);
        if (!containerDef) {
          const ngModule = container.ngModule;
          containerDef = getInjectorDef(ngModule);
        }
        if (!containerDef) {
          return;
        }
        const lastContainerAddedToPath = existingImportPath[0];
        let isNextStepInPath = false;
        deepForEach(containerDef.imports, (moduleImport) => {
          if (isNextStepInPath) {
            return;
          }
          isNextStepInPath = moduleImport.ngModule === lastContainerAddedToPath || moduleImport === lastContainerAddedToPath;
          if (isNextStepInPath) {
            providerToPath.get(prov)?.unshift(container);
          }
        });
      }
    }
    visitedContainers.add(container);
  };
}
function getEnvironmentInjectorProviders(injector) {
  const providerRecordsWithoutImportPaths = getFrameworkDIDebugData().resolverToProviders.get(injector) ?? [];
  if (isPlatformInjector(injector)) {
    return providerRecordsWithoutImportPaths;
  }
  const providerImportsContainer = getProviderImportsContainer(injector);
  if (providerImportsContainer === null) {
    return providerRecordsWithoutImportPaths;
  }
  const providerToPath = getProviderImportPaths(providerImportsContainer);
  const providerRecords = [];
  for (const providerRecord of providerRecordsWithoutImportPaths) {
    const provider = providerRecord.provider;
    const token = provider.provide;
    if (token === ENVIRONMENT_INITIALIZER || token === INJECTOR_DEF_TYPES) {
      continue;
    }
    let importPath = providerToPath.get(provider) ?? [];
    const def = getComponentDef(providerImportsContainer);
    const isStandaloneComponent2 = !!def?.standalone;
    if (isStandaloneComponent2) {
      importPath = [providerImportsContainer, ...importPath];
    }
    providerRecords.push(__spreadProps(__spreadValues({}, providerRecord), { importPath }));
  }
  return providerRecords;
}
function isPlatformInjector(injector) {
  return injector instanceof R3Injector && injector.scopes.has("platform");
}
function getInjectorProviders(injector) {
  if (injector instanceof NodeInjector) {
    return getNodeInjectorProviders(injector);
  } else if (injector instanceof EnvironmentInjector) {
    return getEnvironmentInjectorProviders(injector);
  }
  throwError2("getInjectorProviders only supports NodeInjector and EnvironmentInjector");
}
function getInjectorMetadata(injector) {
  if (injector instanceof NodeInjector) {
    const lView = getNodeInjectorLView(injector);
    const tNode = getNodeInjectorTNode(injector);
    assertTNodeForLView(tNode, lView);
    return { type: "element", source: getNativeByTNode(tNode, lView) };
  }
  if (injector instanceof R3Injector) {
    return { type: "environment", source: injector.source ?? null };
  }
  if (injector instanceof NullInjector) {
    return { type: "null", source: null };
  }
  return null;
}
function getInjectorResolutionPath(injector) {
  const resolutionPath = [injector];
  getInjectorResolutionPathHelper(injector, resolutionPath);
  return resolutionPath;
}
function getInjectorResolutionPathHelper(injector, resolutionPath) {
  const parent = getInjectorParent(injector);
  if (parent === null) {
    if (injector instanceof NodeInjector) {
      const firstInjector = resolutionPath[0];
      if (firstInjector instanceof NodeInjector) {
        const moduleInjector = getModuleInjectorOfNodeInjector(firstInjector);
        if (moduleInjector === null) {
          throwError2("NodeInjector must have some connection to the module injector tree");
        }
        resolutionPath.push(moduleInjector);
        getInjectorResolutionPathHelper(moduleInjector, resolutionPath);
      }
      return resolutionPath;
    }
  } else {
    resolutionPath.push(parent);
    getInjectorResolutionPathHelper(parent, resolutionPath);
  }
  return resolutionPath;
}
function getInjectorParent(injector) {
  if (injector instanceof R3Injector) {
    return injector.parent;
  }
  let tNode;
  let lView;
  if (injector instanceof NodeInjector) {
    tNode = getNodeInjectorTNode(injector);
    lView = getNodeInjectorLView(injector);
  } else if (injector instanceof NullInjector) {
    return null;
  } else if (injector instanceof ChainedInjector) {
    return injector.parentInjector;
  } else {
    throwError2("getInjectorParent only support injectors of type R3Injector, NodeInjector, NullInjector");
  }
  const parentLocation = getParentInjectorLocation(tNode, lView);
  if (hasParentInjector(parentLocation)) {
    const parentInjectorIndex = getParentInjectorIndex(parentLocation);
    const parentLView = getParentInjectorView(parentLocation, lView);
    const parentTView = parentLView[TVIEW];
    const parentTNode = parentTView.data[
      parentInjectorIndex + 8
      /* NodeInjectorOffset.TNODE */
    ];
    return new NodeInjector(parentTNode, parentLView);
  } else {
    const chainedInjector = lView[INJECTOR];
    const injectorParent = chainedInjector.injector?.parent;
    if (injectorParent instanceof NodeInjector) {
      return injectorParent;
    }
  }
  return null;
}
function getModuleInjectorOfNodeInjector(injector) {
  let lView;
  if (injector instanceof NodeInjector) {
    lView = getNodeInjectorLView(injector);
  } else {
    throwError2("getModuleInjectorOfNodeInjector must be called with a NodeInjector");
  }
  const inj = lView[INJECTOR];
  const moduleInjector = inj instanceof ChainedInjector ? inj.parentInjector : inj.parent;
  if (!moduleInjector) {
    throwError2("NodeInjector must have some connection to the module injector tree");
  }
  return moduleInjector;
}
function isComputedNode(node) {
  return node.kind === "computed";
}
function isTemplateEffectNode(node) {
  return node.kind === "template";
}
function isSignalNode(node) {
  return node.kind === "signal";
}
function getTemplateConsumer(injector) {
  const tNode = getNodeInjectorTNode(injector);
  assertTNode(tNode);
  const lView = getNodeInjectorLView(injector);
  assertLView(lView);
  const templateLView = lView[tNode.index];
  if (isLView(templateLView)) {
    return templateLView[REACTIVE_TEMPLATE_CONSUMER] ?? null;
  }
  return null;
}
var signalDebugMap = /* @__PURE__ */ new WeakMap();
var counter$1 = 0;
function getNodesAndEdgesFromSignalMap(signalMap) {
  const nodes = Array.from(signalMap.keys());
  const debugSignalGraphNodes = [];
  const edges = [];
  for (const [consumer, producers] of signalMap.entries()) {
    const consumerIndex = nodes.indexOf(consumer);
    let id = signalDebugMap.get(consumer);
    if (!id) {
      counter$1++;
      id = counter$1.toString();
      signalDebugMap.set(consumer, id);
    }
    if (isComputedNode(consumer)) {
      debugSignalGraphNodes.push({
        label: consumer.debugName,
        value: consumer.value,
        kind: consumer.kind,
        epoch: consumer.version,
        debuggableFn: consumer.computation,
        id
      });
    } else if (isSignalNode(consumer)) {
      debugSignalGraphNodes.push({
        label: consumer.debugName,
        value: consumer.value,
        kind: consumer.kind,
        epoch: consumer.version,
        id
      });
    } else if (isTemplateEffectNode(consumer)) {
      debugSignalGraphNodes.push({
        label: consumer.debugName ?? consumer.lView?.[HOST]?.tagName?.toLowerCase?.(),
        kind: consumer.kind,
        epoch: consumer.version,
        id
      });
    } else {
      debugSignalGraphNodes.push({
        label: consumer.debugName,
        kind: consumer.kind,
        epoch: consumer.version,
        id
      });
    }
    for (const producer of producers) {
      edges.push({ consumer: consumerIndex, producer: nodes.indexOf(producer) });
    }
  }
  return { nodes: debugSignalGraphNodes, edges };
}
function extractEffectsFromInjector(injector) {
  let diResolver = injector;
  if (injector instanceof NodeInjector) {
    const lView = getNodeInjectorLView(injector);
    diResolver = lView;
  }
  const resolverToEffects = getFrameworkDIDebugData().resolverToEffects;
  const effects = resolverToEffects.get(diResolver) ?? [];
  return effects.map((effect2) => effect2[SIGNAL]);
}
function extractSignalNodesAndEdgesFromRoots(nodes, signalDependenciesMap = /* @__PURE__ */ new Map()) {
  for (const node of nodes) {
    if (signalDependenciesMap.has(node)) {
      continue;
    }
    const producerNodes = node.producerNode ?? [];
    signalDependenciesMap.set(node, producerNodes);
    extractSignalNodesAndEdgesFromRoots(producerNodes, signalDependenciesMap);
  }
  return signalDependenciesMap;
}
function getSignalGraph(injector) {
  let templateConsumer = null;
  if (!(injector instanceof NodeInjector) && !(injector instanceof R3Injector)) {
    return throwError2("getSignalGraph must be called with a NodeInjector or R3Injector");
  }
  if (injector instanceof NodeInjector) {
    templateConsumer = getTemplateConsumer(injector);
  }
  const nonTemplateEffectNodes = extractEffectsFromInjector(injector);
  const signalNodes = templateConsumer ? [templateConsumer, ...nonTemplateEffectNodes] : nonTemplateEffectNodes;
  const signalDependenciesMap = extractSignalNodesAndEdgesFromRoots(signalNodes);
  return getNodesAndEdgesFromSignalMap(signalDependenciesMap);
}
var changeDetectionRuns = 0;
var changeDetectionSyncRuns = 0;
var counter = 0;
var eventsStack = [];
function measureStart(startEvent) {
  eventsStack.push([startEvent, counter]);
  console.timeStamp("Event_" + startEvent + "_" + counter++);
}
function measureEnd(startEvent, entryName, color) {
  const top = eventsStack.pop();
  assertDefined(top, "Profiling error: could not find start event entry " + startEvent);
  assertEqual(top[0], startEvent, `Profiling error: expected to see ${startEvent} event but got ${top[0]}`);
  console.timeStamp(entryName, "Event_" + top[0] + "_" + top[1], void 0, "\u{1F170}\uFE0F Angular", void 0, color);
}
var chromeDevToolsInjectorProfiler = (event) => {
  const eventType = event.type;
  if (eventType === 4) {
    measureStart(
      100
      /* ProfilerDIEvent.InjectorToCreateInstanceEvent */
    );
  } else if (eventType === 1) {
    const token = event.context.token;
    measureEnd(100, getProviderTokenMeasureName(token), "tertiary-dark");
  }
};
var devToolsProfiler = (event, instance, eventFn) => {
  switch (event) {
    case 8:
    case 10:
    case 12:
    case 14:
    case 16:
    case 18:
    case 20:
    case 22:
    case 0:
    case 4:
    case 2:
    case 24:
    case 6: {
      measureStart(event);
      break;
    }
    case 9: {
      measureEnd(8, "Bootstrap application", "primary-dark");
      break;
    }
    case 11: {
      measureEnd(10, "Bootstrap component", "primary-dark");
      break;
    }
    case 13: {
      changeDetectionSyncRuns = 0;
      measureEnd(12, "Change detection " + changeDetectionRuns++, "primary-dark");
      break;
    }
    case 15: {
      measureEnd(14, "Synchronization " + changeDetectionSyncRuns++, "primary");
      break;
    }
    case 17: {
      measureEnd(16, "After render hooks", "primary");
      break;
    }
    case 19: {
      const typeName = getComponentMeasureName(instance);
      measureEnd(18, typeName, "primary-light");
      break;
    }
    case 21: {
      measureEnd(20, "Defer block", "primary-dark");
      break;
    }
    case 23: {
      measureEnd(22, "Dynamic component creation", "primary-dark");
      break;
    }
    case 3: {
      measureEnd(2, stringifyForError(eventFn) + " (update)", "secondary-dark");
      break;
    }
    case 1: {
      measureEnd(0, stringifyForError(eventFn) + " (create)", "secondary");
      break;
    }
    case 25: {
      measureEnd(24, "HostBindings", "secondary-dark");
      break;
    }
    case 5: {
      const typeName = getComponentMeasureName(instance);
      measureEnd(4, `${typeName}:${stringifyForError(eventFn)}`, "tertiary");
      break;
    }
    case 7: {
      measureEnd(6, stringifyForError(eventFn), "tertiary-light");
      break;
    }
    default: {
      throw new Error("Unexpected profiling event type: " + event);
    }
  }
};
function getComponentMeasureName(instance) {
  return instance.constructor.name;
}
function getProviderTokenMeasureName(token) {
  if (isTypeProvider(token)) {
    return token.name;
  } else if (token.provide != null) {
    return getProviderTokenMeasureName(token.provide);
  }
  return token.toString();
}
function enableProfiling() {
  performanceMarkFeature("Chrome DevTools profiling");
  if (typeof ngDevMode !== "undefined" && ngDevMode) {
    const removeInjectorProfiler = setInjectorProfiler(chromeDevToolsInjectorProfiler);
    const removeProfiler3 = setProfiler(devToolsProfiler);
    return () => {
      removeInjectorProfiler();
      removeProfiler3();
    };
  }
  return () => {
  };
}
var GLOBAL_PUBLISH_EXPANDO_KEY = "ng";
var globalUtilsFunctions = {
  /**
   * Warning: functions that start with `ɵ` are considered *INTERNAL* and should not be relied upon
   * in application's code. The contract of those functions might be changed in any release and/or a
   * function can be removed completely.
   */
  "\u0275getDependenciesFromInjectable": getDependenciesFromInjectable,
  "\u0275getInjectorProviders": getInjectorProviders,
  "\u0275getInjectorResolutionPath": getInjectorResolutionPath,
  "\u0275getInjectorMetadata": getInjectorMetadata,
  "\u0275setProfiler": setProfiler,
  "\u0275getSignalGraph": getSignalGraph,
  "\u0275getDeferBlocks": getDeferBlocks,
  "getDirectiveMetadata": getDirectiveMetadata$1,
  "getComponent": getComponent,
  "getContext": getContext,
  "getListeners": getListeners,
  "getOwningComponent": getOwningComponent,
  "getHostElement": getHostElement,
  "getInjector": getInjector,
  "getRootComponents": getRootComponents,
  "getDirectives": getDirectives,
  "applyChanges": applyChanges,
  "isSignal": isSignal,
  "enableProfiling": enableProfiling
};
var _published = false;
function publishDefaultGlobalUtils$1() {
  if (!_published) {
    _published = true;
    if (typeof window !== "undefined") {
      setupFrameworkInjectorProfiler();
    }
    for (const [methodName, method] of Object.entries(globalUtilsFunctions)) {
      publishGlobalUtil(methodName, method);
    }
  }
}
function publishGlobalUtil(name2, fn) {
  publishUtil(name2, fn);
}
function publishUtil(name2, fn) {
  if (typeof COMPILED === "undefined" || !COMPILED) {
    const w = _global;
    ngDevMode && assertDefined(fn, "function not defined");
    w[GLOBAL_PUBLISH_EXPANDO_KEY] ??= {};
    w[GLOBAL_PUBLISH_EXPANDO_KEY][name2] = fn;
  }
}
var TESTABILITY = new InjectionToken("");
var TESTABILITY_GETTER = new InjectionToken("");
var Testability = class _Testability {
  _ngZone;
  registry;
  _isZoneStable = true;
  _callbacks = [];
  _taskTrackingZone = null;
  _destroyRef;
  constructor(_ngZone, registry, testabilityGetter) {
    this._ngZone = _ngZone;
    this.registry = registry;
    if (isInInjectionContext()) {
      this._destroyRef = inject2(DestroyRef, { optional: true }) ?? void 0;
    }
    if (!_testabilityGetter) {
      setTestabilityGetter(testabilityGetter);
      testabilityGetter.addToWindow(registry);
    }
    this._watchAngularEvents();
    _ngZone.run(() => {
      this._taskTrackingZone = typeof Zone == "undefined" ? null : Zone.current.get("TaskTrackingZone");
    });
  }
  _watchAngularEvents() {
    const onUnstableSubscription = this._ngZone.onUnstable.subscribe({
      next: () => {
        this._isZoneStable = false;
      }
    });
    const onStableSubscription = this._ngZone.runOutsideAngular(() => this._ngZone.onStable.subscribe({
      next: () => {
        NgZone.assertNotInAngularZone();
        queueMicrotask(() => {
          this._isZoneStable = true;
          this._runCallbacksIfReady();
        });
      }
    }));
    this._destroyRef?.onDestroy(() => {
      onUnstableSubscription.unsubscribe();
      onStableSubscription.unsubscribe();
    });
  }
  /**
   * Whether an associated application is stable
   */
  isStable() {
    return this._isZoneStable && !this._ngZone.hasPendingMacrotasks;
  }
  _runCallbacksIfReady() {
    if (this.isStable()) {
      queueMicrotask(() => {
        while (this._callbacks.length !== 0) {
          let cb = this._callbacks.pop();
          clearTimeout(cb.timeoutId);
          cb.doneCb();
        }
      });
    } else {
      let pending = this.getPendingTasks();
      this._callbacks = this._callbacks.filter((cb) => {
        if (cb.updateCb && cb.updateCb(pending)) {
          clearTimeout(cb.timeoutId);
          return false;
        }
        return true;
      });
    }
  }
  getPendingTasks() {
    if (!this._taskTrackingZone) {
      return [];
    }
    return this._taskTrackingZone.macroTasks.map((t) => {
      return {
        source: t.source,
        // From TaskTrackingZone:
        // https://github.com/angular/zone.js/blob/master/lib/zone-spec/task-tracking.ts#L40
        creationLocation: t.creationLocation,
        data: t.data
      };
    });
  }
  addCallback(cb, timeout, updateCb) {
    let timeoutId = -1;
    if (timeout && timeout > 0) {
      timeoutId = setTimeout(() => {
        this._callbacks = this._callbacks.filter((cb2) => cb2.timeoutId !== timeoutId);
        cb();
      }, timeout);
    }
    this._callbacks.push({ doneCb: cb, timeoutId, updateCb });
  }
  /**
   * Wait for the application to be stable with a timeout. If the timeout is reached before that
   * happens, the callback receives a list of the macro tasks that were pending, otherwise null.
   *
   * @param doneCb The callback to invoke when Angular is stable or the timeout expires
   *    whichever comes first.
   * @param timeout Optional. The maximum time to wait for Angular to become stable. If not
   *    specified, whenStable() will wait forever.
   * @param updateCb Optional. If specified, this callback will be invoked whenever the set of
   *    pending macrotasks changes. If this callback returns true doneCb will not be invoked
   *    and no further updates will be issued.
   */
  whenStable(doneCb, timeout, updateCb) {
    if (updateCb && !this._taskTrackingZone) {
      throw new Error('Task tracking zone is required when passing an update callback to whenStable(). Is "zone.js/plugins/task-tracking" loaded?');
    }
    this.addCallback(doneCb, timeout, updateCb);
    this._runCallbacksIfReady();
  }
  /**
   * Registers an application with a testability hook so that it can be tracked.
   * @param token token of application, root element
   *
   * @internal
   */
  registerApplication(token) {
    this.registry.registerApplication(token, this);
  }
  /**
   * Unregisters an application.
   * @param token token of application, root element
   *
   * @internal
   */
  unregisterApplication(token) {
    this.registry.unregisterApplication(token);
  }
  /**
   * Find providers by name
   * @param using The root element to search from
   * @param provider The name of binding variable
   * @param exactMatch Whether using exactMatch
   */
  findProviders(using, provider, exactMatch) {
    return [];
  }
  static \u0275fac = function Testability_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _Testability)(\u0275\u0275inject(NgZone), \u0275\u0275inject(TestabilityRegistry), \u0275\u0275inject(TESTABILITY_GETTER));
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _Testability, factory: _Testability.\u0275fac });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(Testability, [{
    type: Injectable
  }], () => [{ type: NgZone }, { type: TestabilityRegistry }, { type: void 0, decorators: [{
    type: Inject,
    args: [TESTABILITY_GETTER]
  }] }], null);
})();
var TestabilityRegistry = class _TestabilityRegistry {
  /** @internal */
  _applications = /* @__PURE__ */ new Map();
  /**
   * Registers an application with a testability hook so that it can be tracked
   * @param token token of application, root element
   * @param testability Testability hook
   */
  registerApplication(token, testability) {
    this._applications.set(token, testability);
  }
  /**
   * Unregisters an application.
   * @param token token of application, root element
   */
  unregisterApplication(token) {
    this._applications.delete(token);
  }
  /**
   * Unregisters all applications
   */
  unregisterAllApplications() {
    this._applications.clear();
  }
  /**
   * Get a testability hook associated with the application
   * @param elem root element
   */
  getTestability(elem) {
    return this._applications.get(elem) || null;
  }
  /**
   * Get all registered testabilities
   */
  getAllTestabilities() {
    return Array.from(this._applications.values());
  }
  /**
   * Get all registered applications(root elements)
   */
  getAllRootElements() {
    return Array.from(this._applications.keys());
  }
  /**
   * Find testability of a node in the Tree
   * @param elem node
   * @param findInAncestors whether finding testability in ancestors if testability was not found in
   * current node
   */
  findTestabilityInTree(elem, findInAncestors = true) {
    return _testabilityGetter?.findTestabilityInTree(this, elem, findInAncestors) ?? null;
  }
  static \u0275fac = function TestabilityRegistry_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _TestabilityRegistry)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _TestabilityRegistry, factory: _TestabilityRegistry.\u0275fac, providedIn: "platform" });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(TestabilityRegistry, [{
    type: Injectable,
    args: [{ providedIn: "platform" }]
  }], null, null);
})();
function setTestabilityGetter(getter) {
  _testabilityGetter = getter;
}
var _testabilityGetter;
function isPromise2(obj) {
  return !!obj && typeof obj.then === "function";
}
function isSubscribable(obj) {
  return !!obj && typeof obj.subscribe === "function";
}
var APP_INITIALIZER = new InjectionToken(ngDevMode ? "Application Initializer" : "");
function provideAppInitializer(initializerFn) {
  return makeEnvironmentProviders([
    {
      provide: APP_INITIALIZER,
      multi: true,
      useValue: initializerFn
    }
  ]);
}
var ApplicationInitStatus = class _ApplicationInitStatus {
  // Using non null assertion, these fields are defined below
  // within the `new Promise` callback (synchronously).
  resolve;
  reject;
  initialized = false;
  done = false;
  donePromise = new Promise((res, rej) => {
    this.resolve = res;
    this.reject = rej;
  });
  appInits = inject2(APP_INITIALIZER, { optional: true }) ?? [];
  injector = inject2(Injector);
  constructor() {
    if ((typeof ngDevMode === "undefined" || ngDevMode) && !Array.isArray(this.appInits)) {
      throw new RuntimeError(-209, `Unexpected type of the \`APP_INITIALIZER\` token value (expected an array, but got ${typeof this.appInits}). Please check that the \`APP_INITIALIZER\` token is configured as a \`multi: true\` provider.`);
    }
  }
  /** @internal */
  runInitializers() {
    if (this.initialized) {
      return;
    }
    const asyncInitPromises = [];
    for (const appInits of this.appInits) {
      const initResult = runInInjectionContext(this.injector, appInits);
      if (isPromise2(initResult)) {
        asyncInitPromises.push(initResult);
      } else if (isSubscribable(initResult)) {
        const observableAsPromise = new Promise((resolve, reject) => {
          initResult.subscribe({ complete: resolve, error: reject });
        });
        asyncInitPromises.push(observableAsPromise);
      }
    }
    const complete = () => {
      this.done = true;
      this.resolve();
    };
    Promise.all(asyncInitPromises).then(() => {
      complete();
    }).catch((e) => {
      this.reject(e);
    });
    if (asyncInitPromises.length === 0) {
      complete();
    }
    this.initialized = true;
  }
  static \u0275fac = function ApplicationInitStatus_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _ApplicationInitStatus)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _ApplicationInitStatus, factory: _ApplicationInitStatus.\u0275fac, providedIn: "root" });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ApplicationInitStatus, [{
    type: Injectable,
    args: [{ providedIn: "root" }]
  }], () => [], null);
})();
var APP_BOOTSTRAP_LISTENER = new InjectionToken(ngDevMode ? "appBootstrapListener" : "");
function publishDefaultGlobalUtils() {
  ngDevMode && publishDefaultGlobalUtils$1();
}
function publishSignalConfiguration() {
  setThrowInvalidWriteToSignalError(() => {
    let errorMessage = "";
    if (ngDevMode) {
      const activeConsumer2 = getActiveConsumer();
      errorMessage = activeConsumer2 && isReactiveLViewConsumer(activeConsumer2) ? "Writing to signals is not allowed while Angular renders the template (eg. interpolations)" : "Writing to signals is not allowed in a `computed`";
    }
    throw new RuntimeError(600, errorMessage);
  });
}
function isBoundToModule(cf) {
  return cf.isBoundToModule;
}
var MAXIMUM_REFRESH_RERUNS = 10;
function optionsReducer(dst2, objs) {
  if (Array.isArray(objs)) {
    return objs.reduce(optionsReducer, dst2);
  }
  return __spreadValues(__spreadValues({}, dst2), objs);
}
var ApplicationRef = class _ApplicationRef {
  /** @internal */
  _runningTick = false;
  _destroyed = false;
  _destroyListeners = [];
  /** @internal */
  _views = [];
  internalErrorHandler = inject2(INTERNAL_APPLICATION_ERROR_HANDLER);
  afterRenderManager = inject2(AfterRenderManager);
  zonelessEnabled = inject2(ZONELESS_ENABLED);
  rootEffectScheduler = inject2(EffectScheduler);
  /**
   * Current dirty state of the application across a number of dimensions (views, afterRender hooks,
   * etc).
   *
   * A flag set here means that `tick()` will attempt to resolve the dirtiness when executed.
   *
   * @internal
   */
  dirtyFlags = 0;
  /**
   * Most recent snapshot from the `TracingService`, if any.
   *
   * This snapshot attempts to capture the context when `tick()` was first
   * scheduled. It then runs wrapped in this context.
   *
   * @internal
   */
  tracingSnapshot = null;
  // Needed for ComponentFixture temporarily during migration of autoDetect behavior
  // Eventually the hostView of the fixture should just attach to ApplicationRef.
  allTestViews = /* @__PURE__ */ new Set();
  autoDetectTestViews = /* @__PURE__ */ new Set();
  includeAllTestViews = false;
  /** @internal */
  afterTick = new Subject();
  /** @internal */
  get allViews() {
    return [
      ...(this.includeAllTestViews ? this.allTestViews : this.autoDetectTestViews).keys(),
      ...this._views
    ];
  }
  /**
   * Indicates whether this instance was destroyed.
   */
  get destroyed() {
    return this._destroyed;
  }
  /**
   * Get a list of component types registered to this application.
   * This list is populated even before the component is created.
   */
  componentTypes = [];
  /**
   * Get a list of components registered to this application.
   */
  components = [];
  internalPendingTask = inject2(PendingTasksInternal);
  /**
   * Returns an Observable that indicates when the application is stable or unstable.
   */
  get isStable() {
    return this.internalPendingTask.hasPendingTasksObservable.pipe(map((pending) => !pending));
  }
  constructor() {
    inject2(TracingService, { optional: true });
  }
  /**
   * @returns A promise that resolves when the application becomes stable
   */
  whenStable() {
    let subscription;
    return new Promise((resolve) => {
      subscription = this.isStable.subscribe({
        next: (stable) => {
          if (stable) {
            resolve();
          }
        }
      });
    }).finally(() => {
      subscription.unsubscribe();
    });
  }
  _injector = inject2(EnvironmentInjector);
  _rendererFactory = null;
  /**
   * The `EnvironmentInjector` used to create this application.
   */
  get injector() {
    return this._injector;
  }
  /**
   * Bootstrap a component onto the element identified by its selector or, optionally, to a
   * specified element.
   *
   * @usageNotes
   * ### Bootstrap process
   *
   * When bootstrapping a component, Angular mounts it onto a target DOM element
   * and kicks off automatic change detection. The target DOM element can be
   * provided using the `rootSelectorOrNode` argument.
   *
   * If the target DOM element is not provided, Angular tries to find one on a page
   * using the `selector` of the component that is being bootstrapped
   * (first matched element is used).
   *
   * ### Example
   *
   * Generally, we define the component to bootstrap in the `bootstrap` array of `NgModule`,
   * but it requires us to know the component while writing the application code.
   *
   * Imagine a situation where we have to wait for an API call to decide about the component to
   * bootstrap. We can use the `ngDoBootstrap` hook of the `NgModule` and call this method to
   * dynamically bootstrap a component.
   *
   * {@example core/ts/platform/platform.ts region='componentSelector'}
   *
   * Optionally, a component can be mounted onto a DOM element that does not match the
   * selector of the bootstrapped component.
   *
   * In the following example, we are providing a CSS selector to match the target element.
   *
   * {@example core/ts/platform/platform.ts region='cssSelector'}
   *
   * While in this example, we are providing reference to a DOM node.
   *
   * {@example core/ts/platform/platform.ts region='domNode'}
   */
  bootstrap(componentOrFactory, rootSelectorOrNode) {
    return this.bootstrapImpl(componentOrFactory, rootSelectorOrNode);
  }
  bootstrapImpl(componentOrFactory, rootSelectorOrNode, injector = Injector.NULL) {
    const ngZone = this._injector.get(NgZone);
    return ngZone.run(() => {
      profiler(
        10
        /* ProfilerEvent.BootstrapComponentStart */
      );
      (typeof ngDevMode === "undefined" || ngDevMode) && warnIfDestroyed(this._destroyed);
      const isComponentFactory = componentOrFactory instanceof ComponentFactory$1;
      const initStatus = this._injector.get(ApplicationInitStatus);
      if (!initStatus.done) {
        let errorMessage = "";
        if (typeof ngDevMode === "undefined" || ngDevMode) {
          const standalone = !isComponentFactory && isStandalone(componentOrFactory);
          errorMessage = "Cannot bootstrap as there are still asynchronous initializers running." + (standalone ? "" : " Bootstrap components in the `ngDoBootstrap` method of the root module.");
        }
        throw new RuntimeError(405, errorMessage);
      }
      let componentFactory;
      if (isComponentFactory) {
        componentFactory = componentOrFactory;
      } else {
        const resolver = this._injector.get(ComponentFactoryResolver$1);
        componentFactory = resolver.resolveComponentFactory(componentOrFactory);
      }
      this.componentTypes.push(componentFactory.componentType);
      const ngModule = isBoundToModule(componentFactory) ? void 0 : this._injector.get(NgModuleRef$1);
      const selectorOrNode = rootSelectorOrNode || componentFactory.selector;
      const compRef = componentFactory.create(injector, [], selectorOrNode, ngModule);
      const nativeElement = compRef.location.nativeElement;
      const testability = compRef.injector.get(TESTABILITY, null);
      testability?.registerApplication(nativeElement);
      compRef.onDestroy(() => {
        this.detachView(compRef.hostView);
        remove(this.components, compRef);
        testability?.unregisterApplication(nativeElement);
      });
      this._loadComponent(compRef);
      if (typeof ngDevMode === "undefined" || ngDevMode) {
        const _console = this._injector.get(Console);
        _console.log(`Angular is running in development mode.`);
      }
      profiler(11, compRef);
      return compRef;
    });
  }
  /**
   * Invoke this method to explicitly process change detection and its side-effects.
   *
   * In development mode, `tick()` also performs a second change detection cycle to ensure that no
   * further changes are detected. If additional changes are picked up during this second cycle,
   * bindings in the app have side-effects that cannot be resolved in a single change detection
   * pass.
   * In this case, Angular throws an error, since an Angular application can only have one change
   * detection pass during which all change detection must complete.
   */
  tick() {
    if (!this.zonelessEnabled) {
      this.dirtyFlags |= 1;
    }
    this._tick();
  }
  /** @internal */
  _tick() {
    profiler(
      12
      /* ProfilerEvent.ChangeDetectionStart */
    );
    if (this.tracingSnapshot !== null) {
      this.tracingSnapshot.run(TracingAction.CHANGE_DETECTION, this.tickImpl);
    } else {
      this.tickImpl();
    }
  }
  tickImpl = () => {
    (typeof ngDevMode === "undefined" || ngDevMode) && warnIfDestroyed(this._destroyed);
    if (this._runningTick) {
      throw new RuntimeError(101, ngDevMode && "ApplicationRef.tick is called recursively");
    }
    const prevConsumer = setActiveConsumer(null);
    try {
      this._runningTick = true;
      this.synchronize();
      if (typeof ngDevMode === "undefined" || ngDevMode) {
        for (let view of this.allViews) {
          view.checkNoChanges();
        }
      }
    } finally {
      this._runningTick = false;
      this.tracingSnapshot?.dispose();
      this.tracingSnapshot = null;
      setActiveConsumer(prevConsumer);
      this.afterTick.next();
      profiler(
        13
        /* ProfilerEvent.ChangeDetectionEnd */
      );
    }
  };
  /**
   * Performs the core work of synchronizing the application state with the UI, resolving any
   * pending dirtiness (potentially in a loop).
   */
  synchronize() {
    if (this._rendererFactory === null && !this._injector.destroyed) {
      this._rendererFactory = this._injector.get(RendererFactory2, null, { optional: true });
    }
    let runs = 0;
    while (this.dirtyFlags !== 0 && runs++ < MAXIMUM_REFRESH_RERUNS) {
      profiler(
        14
        /* ProfilerEvent.ChangeDetectionSyncStart */
      );
      this.synchronizeOnce();
      profiler(
        15
        /* ProfilerEvent.ChangeDetectionSyncEnd */
      );
    }
    if ((typeof ngDevMode === "undefined" || ngDevMode) && runs >= MAXIMUM_REFRESH_RERUNS) {
      throw new RuntimeError(103, ngDevMode && "Infinite change detection while refreshing application views. Ensure views are not calling `markForCheck` on every template execution or that afterRender hooks always mark views for check.");
    }
  }
  /**
   * Perform a single synchronization pass.
   */
  synchronizeOnce() {
    if (this.dirtyFlags & 16) {
      this.dirtyFlags &= ~16;
      this.rootEffectScheduler.flush();
    }
    let ranDetectChanges = false;
    if (this.dirtyFlags & 7) {
      const useGlobalCheck = Boolean(
        this.dirtyFlags & 1
        /* ApplicationRefDirtyFlags.ViewTreeGlobal */
      );
      this.dirtyFlags &= ~7;
      this.dirtyFlags |= 8;
      for (let { _lView } of this.allViews) {
        if (!useGlobalCheck && !requiresRefreshOrTraversal(_lView)) {
          continue;
        }
        const mode = useGlobalCheck && !this.zonelessEnabled ? (
          // Global mode includes `CheckAlways` views.
          0
        ) : (
          // Only refresh views with the `RefreshView` flag or views is a changed signal
          1
        );
        detectChangesInternal(_lView, mode);
        ranDetectChanges = true;
      }
      this.dirtyFlags &= ~4;
      this.syncDirtyFlagsWithViews();
      if (this.dirtyFlags & (7 | 16)) {
        return;
      }
    }
    if (!ranDetectChanges) {
      this._rendererFactory?.begin?.();
      this._rendererFactory?.end?.();
    }
    if (this.dirtyFlags & 8) {
      this.dirtyFlags &= ~8;
      this.afterRenderManager.execute();
    }
    this.syncDirtyFlagsWithViews();
  }
  /**
   * Checks `allViews` for views which require refresh/traversal, and updates `dirtyFlags`
   * accordingly, with two potential behaviors:
   *
   * 1. If any of our views require updating, then this adds the `ViewTreeTraversal` dirty flag.
   *    This _should_ be a no-op, since the scheduler should've added the flag at the same time the
   *    view was marked as needing updating.
   *
   *    TODO(alxhub): figure out if this behavior is still needed for edge cases.
   *
   * 2. If none of our views require updating, then clear the view-related `dirtyFlag`s. This
   *    happens when the scheduler is notified of a view becoming dirty, but the view itself isn't
   *    reachable through traversal from our roots (e.g. it's detached from the CD tree).
   */
  syncDirtyFlagsWithViews() {
    if (this.allViews.some(({ _lView }) => requiresRefreshOrTraversal(_lView))) {
      this.dirtyFlags |= 2;
      return;
    } else {
      this.dirtyFlags &= ~7;
    }
  }
  /**
   * Attaches a view so that it will be dirty checked.
   * The view will be automatically detached when it is destroyed.
   * This will throw if the view is already attached to a ViewContainer.
   */
  attachView(viewRef) {
    (typeof ngDevMode === "undefined" || ngDevMode) && warnIfDestroyed(this._destroyed);
    const view = viewRef;
    this._views.push(view);
    view.attachToAppRef(this);
  }
  /**
   * Detaches a view from dirty checking again.
   */
  detachView(viewRef) {
    (typeof ngDevMode === "undefined" || ngDevMode) && warnIfDestroyed(this._destroyed);
    const view = viewRef;
    remove(this._views, view);
    view.detachFromAppRef();
  }
  _loadComponent(componentRef) {
    this.attachView(componentRef.hostView);
    try {
      this.tick();
    } catch (e) {
      this.internalErrorHandler(e);
    }
    this.components.push(componentRef);
    const listeners = this._injector.get(APP_BOOTSTRAP_LISTENER, []);
    if (ngDevMode && !Array.isArray(listeners)) {
      throw new RuntimeError(-209, `Unexpected type of the \`APP_BOOTSTRAP_LISTENER\` token value (expected an array, but got ${typeof listeners}). Please check that the \`APP_BOOTSTRAP_LISTENER\` token is configured as a \`multi: true\` provider.`);
    }
    listeners.forEach((listener) => listener(componentRef));
  }
  /** @internal */
  ngOnDestroy() {
    if (this._destroyed)
      return;
    try {
      this._destroyListeners.forEach((listener) => listener());
      this._views.slice().forEach((view) => view.destroy());
    } finally {
      this._destroyed = true;
      this._views = [];
      this._destroyListeners = [];
    }
  }
  /**
   * Registers a listener to be called when an instance is destroyed.
   *
   * @param callback A callback function to add as a listener.
   * @returns A function which unregisters a listener.
   */
  onDestroy(callback) {
    (typeof ngDevMode === "undefined" || ngDevMode) && warnIfDestroyed(this._destroyed);
    this._destroyListeners.push(callback);
    return () => remove(this._destroyListeners, callback);
  }
  /**
   * Destroys an Angular application represented by this `ApplicationRef`. Calling this function
   * will destroy the associated environment injectors as well as all the bootstrapped components
   * with their views.
   */
  destroy() {
    if (this._destroyed) {
      throw new RuntimeError(406, ngDevMode && "This instance of the `ApplicationRef` has already been destroyed.");
    }
    const injector = this._injector;
    if (injector.destroy && !injector.destroyed) {
      injector.destroy();
    }
  }
  /**
   * Returns the number of attached views.
   */
  get viewCount() {
    return this._views.length;
  }
  static \u0275fac = function ApplicationRef_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _ApplicationRef)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _ApplicationRef, factory: _ApplicationRef.\u0275fac, providedIn: "root" });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ApplicationRef, [{
    type: Injectable,
    args: [{ providedIn: "root" }]
  }], () => [], null);
})();
function warnIfDestroyed(destroyed) {
  if (destroyed) {
    console.warn(formatRuntimeError(406, "This instance of the `ApplicationRef` has already been destroyed."));
  }
}
function remove(list, el) {
  const index = list.indexOf(el);
  if (index > -1) {
    list.splice(index, 1);
  }
}
function scheduleDelayedTrigger(scheduleFn) {
  const lView = getLView();
  const tNode = getCurrentTNode();
  renderPlaceholder(lView, tNode);
  if (!shouldTriggerDeferBlock(0, lView))
    return;
  const injector = lView[INJECTOR];
  const lDetails = getLDeferBlockDetails(lView, tNode);
  const cleanupFn = scheduleFn(() => triggerDeferBlock(0, lView, tNode), injector);
  storeTriggerCleanupFn(0, lDetails, cleanupFn);
}
function scheduleDelayedPrefetching(scheduleFn, trigger) {
  if (false)
    return;
  const lView = getLView();
  const injector = lView[INJECTOR];
  const tNode = getCurrentTNode();
  const tView = lView[TVIEW];
  const tDetails = getTDeferBlockDetails(tView, tNode);
  if (tDetails.loadingState === DeferDependenciesLoadingState.NOT_STARTED) {
    const lDetails = getLDeferBlockDetails(lView, tNode);
    const prefetch = () => triggerPrefetching(tDetails, lView, tNode);
    const cleanupFn = scheduleFn(prefetch, injector);
    storeTriggerCleanupFn(1, lDetails, cleanupFn);
  }
}
function scheduleDelayedHydrating(scheduleFn, lView, tNode) {
  if (false)
    return;
  const injector = lView[INJECTOR];
  const lDetails = getLDeferBlockDetails(lView, tNode);
  const ssrUniqueId = lDetails[SSR_UNIQUE_ID];
  ngDevMode && assertSsrIdDefined(ssrUniqueId);
  const cleanupFn = scheduleFn(() => triggerHydrationFromBlockName(injector, ssrUniqueId), injector);
  storeTriggerCleanupFn(2, lDetails, cleanupFn);
}
function triggerPrefetching(tDetails, lView, tNode) {
  triggerResourceLoading(tDetails, lView, tNode);
}
function triggerResourceLoading(tDetails, lView, tNode) {
  const injector = lView[INJECTOR];
  const tView = lView[TVIEW];
  if (tDetails.loadingState !== DeferDependenciesLoadingState.NOT_STARTED) {
    return tDetails.loadingPromise ?? Promise.resolve();
  }
  const lDetails = getLDeferBlockDetails(lView, tNode);
  const primaryBlockTNode = getPrimaryBlockTNode(tView, tDetails);
  tDetails.loadingState = DeferDependenciesLoadingState.IN_PROGRESS;
  invokeTriggerCleanupFns(1, lDetails);
  let dependenciesFn = tDetails.dependencyResolverFn;
  if (ngDevMode) {
    const deferDependencyInterceptor = injector.get(DEFER_BLOCK_DEPENDENCY_INTERCEPTOR, null, {
      optional: true
    });
    if (deferDependencyInterceptor) {
      dependenciesFn = deferDependencyInterceptor.intercept(dependenciesFn);
    }
  }
  const removeTask = injector.get(PendingTasks).add();
  if (!dependenciesFn) {
    tDetails.loadingPromise = Promise.resolve().then(() => {
      tDetails.loadingPromise = null;
      tDetails.loadingState = DeferDependenciesLoadingState.COMPLETE;
      removeTask();
    });
    return tDetails.loadingPromise;
  }
  tDetails.loadingPromise = Promise.allSettled(dependenciesFn()).then((results) => {
    let failed = false;
    const directiveDefs = [];
    const pipeDefs = [];
    for (const result of results) {
      if (result.status === "fulfilled") {
        const dependency = result.value;
        const directiveDef = getComponentDef(dependency) || getDirectiveDef(dependency);
        if (directiveDef) {
          directiveDefs.push(directiveDef);
        } else {
          const pipeDef = getPipeDef(dependency);
          if (pipeDef) {
            pipeDefs.push(pipeDef);
          }
        }
      } else {
        failed = true;
        break;
      }
    }
    if (failed) {
      tDetails.loadingState = DeferDependenciesLoadingState.FAILED;
      if (tDetails.errorTmplIndex === null) {
        const templateLocation = ngDevMode ? getTemplateLocationDetails(lView) : "";
        const error = new RuntimeError(-750, ngDevMode && `Loading dependencies for \`@defer\` block failed, but no \`@error\` block was configured${templateLocation}. Consider using the \`@error\` block to render an error state.`);
        handleUncaughtError(lView, error);
      }
    } else {
      tDetails.loadingState = DeferDependenciesLoadingState.COMPLETE;
      const primaryBlockTView = primaryBlockTNode.tView;
      if (directiveDefs.length > 0) {
        primaryBlockTView.directiveRegistry = addDepsToRegistry(primaryBlockTView.directiveRegistry, directiveDefs);
        const directiveTypes = directiveDefs.map((def) => def.type);
        const providers = internalImportProvidersFrom(false, ...directiveTypes);
        tDetails.providers = providers;
      }
      if (pipeDefs.length > 0) {
        primaryBlockTView.pipeRegistry = addDepsToRegistry(primaryBlockTView.pipeRegistry, pipeDefs);
      }
    }
  });
  return tDetails.loadingPromise.finally(() => {
    tDetails.loadingPromise = null;
    removeTask();
  });
}
function shouldTriggerDeferBlock(triggerType, lView) {
  if (triggerType === 0 && true && false) {
    return false;
  }
  const injector = lView[INJECTOR];
  const config2 = injector.get(DEFER_BLOCK_CONFIG, null, { optional: true });
  if (config2?.behavior === DeferBlockBehavior.Manual) {
    return false;
  }
  return true;
}
function triggerDeferBlock(triggerType, lView, tNode) {
  const tView = lView[TVIEW];
  const lContainer = lView[tNode.index];
  ngDevMode && assertLContainer(lContainer);
  if (!shouldTriggerDeferBlock(triggerType, lView))
    return;
  const lDetails = getLDeferBlockDetails(lView, tNode);
  const tDetails = getTDeferBlockDetails(tView, tNode);
  invokeAllTriggerCleanupFns(lDetails);
  switch (tDetails.loadingState) {
    case DeferDependenciesLoadingState.NOT_STARTED:
      renderDeferBlockState(DeferBlockState.Loading, tNode, lContainer);
      triggerResourceLoading(tDetails, lView, tNode);
      if (tDetails.loadingState === DeferDependenciesLoadingState.IN_PROGRESS) {
        renderDeferStateAfterResourceLoading(tDetails, tNode, lContainer);
      }
      break;
    case DeferDependenciesLoadingState.IN_PROGRESS:
      renderDeferBlockState(DeferBlockState.Loading, tNode, lContainer);
      renderDeferStateAfterResourceLoading(tDetails, tNode, lContainer);
      break;
    case DeferDependenciesLoadingState.COMPLETE:
      ngDevMode && assertDeferredDependenciesLoaded(tDetails);
      renderDeferBlockState(DeferBlockState.Complete, tNode, lContainer);
      break;
    case DeferDependenciesLoadingState.FAILED:
      renderDeferBlockState(DeferBlockState.Error, tNode, lContainer);
      break;
    default:
      if (ngDevMode) {
        throwError2("Unknown defer block state");
      }
  }
}
async function triggerHydrationFromBlockName(injector, blockName, replayQueuedEventsFn) {
  const dehydratedBlockRegistry = injector.get(DEHYDRATED_BLOCK_REGISTRY);
  const blocksBeingHydrated = dehydratedBlockRegistry.hydrating;
  if (blocksBeingHydrated.has(blockName)) {
    return;
  }
  const { parentBlockPromise, hydrationQueue } = getParentBlockHydrationQueue(blockName, injector);
  if (hydrationQueue.length === 0)
    return;
  if (parentBlockPromise !== null) {
    hydrationQueue.shift();
  }
  populateHydratingStateForQueue(dehydratedBlockRegistry, hydrationQueue);
  if (parentBlockPromise !== null) {
    await parentBlockPromise;
  }
  const topmostParentBlock = hydrationQueue[0];
  if (dehydratedBlockRegistry.has(topmostParentBlock)) {
    await triggerHydrationForBlockQueue(injector, hydrationQueue, replayQueuedEventsFn);
  } else {
    dehydratedBlockRegistry.awaitParentBlock(topmostParentBlock, async () => await triggerHydrationForBlockQueue(injector, hydrationQueue, replayQueuedEventsFn));
  }
}
async function triggerHydrationForBlockQueue(injector, hydrationQueue, replayQueuedEventsFn) {
  const dehydratedBlockRegistry = injector.get(DEHYDRATED_BLOCK_REGISTRY);
  const blocksBeingHydrated = dehydratedBlockRegistry.hydrating;
  const pendingTasks = injector.get(PendingTasksInternal);
  const taskId = pendingTasks.add();
  for (let blockQueueIdx = 0; blockQueueIdx < hydrationQueue.length; blockQueueIdx++) {
    const dehydratedBlockId = hydrationQueue[blockQueueIdx];
    const dehydratedDeferBlock = dehydratedBlockRegistry.get(dehydratedBlockId);
    if (dehydratedDeferBlock != null) {
      await triggerResourceLoadingForHydration(dehydratedDeferBlock);
      await nextRender(injector);
      if (deferBlockHasErrored(dehydratedDeferBlock)) {
        removeDehydratedViewList(dehydratedDeferBlock);
        cleanupRemainingHydrationQueue(hydrationQueue.slice(blockQueueIdx), dehydratedBlockRegistry);
        break;
      }
      blocksBeingHydrated.get(dehydratedBlockId).resolve();
    } else {
      cleanupParentContainer(blockQueueIdx, hydrationQueue, dehydratedBlockRegistry);
      cleanupRemainingHydrationQueue(hydrationQueue.slice(blockQueueIdx), dehydratedBlockRegistry);
      break;
    }
  }
  const lastBlockName = hydrationQueue[hydrationQueue.length - 1];
  await blocksBeingHydrated.get(lastBlockName)?.promise;
  pendingTasks.remove(taskId);
  if (replayQueuedEventsFn) {
    replayQueuedEventsFn(hydrationQueue);
  }
  cleanupHydratedDeferBlocks(dehydratedBlockRegistry.get(lastBlockName), hydrationQueue, dehydratedBlockRegistry, injector.get(ApplicationRef));
}
function deferBlockHasErrored(deferBlock) {
  return getLDeferBlockDetails(deferBlock.lView, deferBlock.tNode)[DEFER_BLOCK_STATE] === DeferBlockState.Error;
}
function cleanupParentContainer(currentBlockIdx, hydrationQueue, dehydratedBlockRegistry) {
  const parentDeferBlockIdx = currentBlockIdx - 1;
  const parentDeferBlock = parentDeferBlockIdx > -1 ? dehydratedBlockRegistry.get(hydrationQueue[parentDeferBlockIdx]) : null;
  if (parentDeferBlock) {
    cleanupLContainer(parentDeferBlock.lContainer);
  }
}
function cleanupRemainingHydrationQueue(hydrationQueue, dehydratedBlockRegistry) {
  const blocksBeingHydrated = dehydratedBlockRegistry.hydrating;
  for (const dehydratedBlockId in hydrationQueue) {
    blocksBeingHydrated.get(dehydratedBlockId)?.reject();
  }
  dehydratedBlockRegistry.cleanup(hydrationQueue);
}
function populateHydratingStateForQueue(registry, queue) {
  for (let blockId of queue) {
    registry.hydrating.set(blockId, Promise.withResolvers());
  }
}
function nextRender(injector) {
  return new Promise((resolveFn) => afterNextRender(resolveFn, { injector }));
}
async function triggerResourceLoadingForHydration(dehydratedBlock) {
  const { tNode, lView } = dehydratedBlock;
  const lDetails = getLDeferBlockDetails(lView, tNode);
  return new Promise((resolve) => {
    onDeferBlockCompletion(lDetails, resolve);
    triggerDeferBlock(2, lView, tNode);
  });
}
function onDeferBlockCompletion(lDetails, callback) {
  if (!Array.isArray(lDetails[ON_COMPLETE_FNS])) {
    lDetails[ON_COMPLETE_FNS] = [];
  }
  lDetails[ON_COMPLETE_FNS].push(callback);
}
function shouldAttachTrigger(triggerType, lView, tNode) {
  if (triggerType === 0) {
    return shouldAttachRegularTrigger(lView, tNode);
  } else if (triggerType === 2) {
    return !shouldAttachRegularTrigger(lView, tNode);
  }
  return true;
}
function hasHydrateTriggers(flags) {
  return flags != null && (flags & 1) === 1;
}
function shouldAttachRegularTrigger(lView, tNode) {
  const injector = lView[INJECTOR];
  const tDetails = getTDeferBlockDetails(lView[TVIEW], tNode);
  const incrementalHydrationEnabled = isIncrementalHydrationEnabled(injector);
  const _hasHydrateTriggers = hasHydrateTriggers(tDetails.flags);
  if (false) {
    return !incrementalHydrationEnabled || !_hasHydrateTriggers;
  }
  const lDetails = getLDeferBlockDetails(lView, tNode);
  const wasServerSideRendered = lDetails[SSR_UNIQUE_ID] !== null;
  if (_hasHydrateTriggers && wasServerSideRendered && incrementalHydrationEnabled) {
    return false;
  }
  return true;
}
function getHydrateTriggers(tView, tNode) {
  const tDetails = getTDeferBlockDetails(tView, tNode);
  return tDetails.hydrateTriggers ??= /* @__PURE__ */ new Map();
}
function \u0275\u0275defer(index, primaryTmplIndex, dependencyResolverFn, loadingTmplIndex, placeholderTmplIndex, errorTmplIndex, loadingConfigIndex, placeholderConfigIndex, enableTimerScheduling, flags) {
  const lView = getLView();
  const tView = getTView();
  const adjustedIndex = index + HEADER_OFFSET;
  const tNode = declareNoDirectiveHostTemplate(lView, tView, index, null, 0, 0);
  const injector = lView[INJECTOR];
  if (tView.firstCreatePass) {
    performanceMarkFeature("NgDefer");
    if (ngDevMode) {
      if (false) {
        logHmrWarning(injector);
      }
      if (hasHydrateTriggers(flags)) {
        assertIncrementalHydrationIsConfigured(injector);
      }
    }
    const tDetails = {
      primaryTmplIndex,
      loadingTmplIndex: loadingTmplIndex ?? null,
      placeholderTmplIndex: placeholderTmplIndex ?? null,
      errorTmplIndex: errorTmplIndex ?? null,
      placeholderBlockConfig: null,
      loadingBlockConfig: null,
      dependencyResolverFn: dependencyResolverFn ?? null,
      loadingState: DeferDependenciesLoadingState.NOT_STARTED,
      loadingPromise: null,
      providers: null,
      hydrateTriggers: null,
      debug: null,
      flags: flags ?? 0
    };
    enableTimerScheduling?.(tView, tDetails, placeholderConfigIndex, loadingConfigIndex);
    setTDeferBlockDetails(tView, adjustedIndex, tDetails);
  }
  const lContainer = lView[adjustedIndex];
  populateDehydratedViewsInLContainer(lContainer, tNode, lView);
  let ssrBlockState = null;
  let ssrUniqueId = null;
  if (lContainer[DEHYDRATED_VIEWS]?.length > 0) {
    const info = lContainer[DEHYDRATED_VIEWS][0].data;
    ssrUniqueId = info[DEFER_BLOCK_ID] ?? null;
    ssrBlockState = info[DEFER_BLOCK_STATE$1];
  }
  const lDetails = [
    null,
    // NEXT_DEFER_BLOCK_STATE
    DeferBlockInternalState.Initial,
    // DEFER_BLOCK_STATE
    null,
    // STATE_IS_FROZEN_UNTIL
    null,
    // LOADING_AFTER_CLEANUP_FN
    null,
    // TRIGGER_CLEANUP_FNS
    null,
    // PREFETCH_TRIGGER_CLEANUP_FNS
    ssrUniqueId,
    // SSR_UNIQUE_ID
    ssrBlockState,
    // SSR_BLOCK_STATE
    null,
    // ON_COMPLETE_FNS
    null
    // HYDRATE_TRIGGER_CLEANUP_FNS
  ];
  setLDeferBlockDetails(lView, adjustedIndex, lDetails);
  let registry = null;
  if (ssrUniqueId !== null) {
    registry = injector.get(DEHYDRATED_BLOCK_REGISTRY);
    registry.add(ssrUniqueId, { lView, tNode, lContainer });
  }
  const onLViewDestroy = () => {
    invokeAllTriggerCleanupFns(lDetails);
    if (ssrUniqueId !== null) {
      registry?.cleanup([ssrUniqueId]);
    }
  };
  storeTriggerCleanupFn(0, lDetails, () => removeLViewOnDestroy(lView, onLViewDestroy));
  storeLViewOnDestroy(lView, onLViewDestroy);
}
function \u0275\u0275deferWhen(rawValue) {
  const lView = getLView();
  const tNode = getSelectedTNode();
  if (ngDevMode) {
    trackTriggerForDebugging(lView[TVIEW], tNode, "when <expression>");
  }
  if (!shouldAttachTrigger(0, lView, tNode))
    return;
  const bindingIndex = nextBindingIndex();
  if (bindingUpdated(lView, bindingIndex, rawValue)) {
    const prevConsumer = setActiveConsumer(null);
    try {
      const value = Boolean(rawValue);
      const lDetails = getLDeferBlockDetails(lView, tNode);
      const renderedState = lDetails[DEFER_BLOCK_STATE];
      if (value === false && renderedState === DeferBlockInternalState.Initial) {
        renderPlaceholder(lView, tNode);
      } else if (value === true && (renderedState === DeferBlockInternalState.Initial || renderedState === DeferBlockState.Placeholder)) {
        triggerDeferBlock(0, lView, tNode);
      }
    } finally {
      setActiveConsumer(prevConsumer);
    }
  }
}
function \u0275\u0275deferPrefetchWhen(rawValue) {
  const lView = getLView();
  const tNode = getSelectedTNode();
  if (ngDevMode) {
    trackTriggerForDebugging(lView[TVIEW], tNode, "prefetch when <expression>");
  }
  if (!shouldAttachTrigger(1, lView, tNode))
    return;
  const bindingIndex = nextBindingIndex();
  if (bindingUpdated(lView, bindingIndex, rawValue)) {
    const prevConsumer = setActiveConsumer(null);
    try {
      const value = Boolean(rawValue);
      const tView = lView[TVIEW];
      const tNode2 = getSelectedTNode();
      const tDetails = getTDeferBlockDetails(tView, tNode2);
      if (value === true && tDetails.loadingState === DeferDependenciesLoadingState.NOT_STARTED) {
        triggerPrefetching(tDetails, lView, tNode2);
      }
    } finally {
      setActiveConsumer(prevConsumer);
    }
  }
}
function \u0275\u0275deferHydrateWhen(rawValue) {
  const lView = getLView();
  const tNode = getSelectedTNode();
  if (ngDevMode) {
    trackTriggerForDebugging(lView[TVIEW], tNode, "hydrate when <expression>");
  }
  if (!shouldAttachTrigger(2, lView, tNode))
    return;
  const bindingIndex = nextBindingIndex();
  const tView = getTView();
  const hydrateTriggers = getHydrateTriggers(tView, tNode);
  hydrateTriggers.set(6, null);
  if (bindingUpdated(lView, bindingIndex, rawValue)) {
    if (false) {
      triggerDeferBlock(2, lView, tNode);
    } else {
      const injector = lView[INJECTOR];
      const prevConsumer = setActiveConsumer(null);
      try {
        const value = Boolean(rawValue);
        if (value === true) {
          const lDetails = getLDeferBlockDetails(lView, tNode);
          const ssrUniqueId = lDetails[SSR_UNIQUE_ID];
          ngDevMode && assertSsrIdDefined(ssrUniqueId);
          triggerHydrationFromBlockName(injector, ssrUniqueId);
        }
      } finally {
        setActiveConsumer(prevConsumer);
      }
    }
  }
}
function \u0275\u0275deferHydrateNever() {
  const lView = getLView();
  const tNode = getCurrentTNode();
  if (ngDevMode) {
    trackTriggerForDebugging(lView[TVIEW], tNode, "hydrate never");
  }
  if (!shouldAttachTrigger(2, lView, tNode))
    return;
  const hydrateTriggers = getHydrateTriggers(getTView(), tNode);
  hydrateTriggers.set(7, null);
  if (false) {
    triggerDeferBlock(2, lView, tNode);
  }
}
function \u0275\u0275deferOnIdle() {
  const lView = getLView();
  const tNode = getCurrentTNode();
  if (ngDevMode) {
    trackTriggerForDebugging(lView[TVIEW], tNode, "on idle");
  }
  if (!shouldAttachTrigger(0, lView, tNode))
    return;
  scheduleDelayedTrigger(onIdle);
}
function \u0275\u0275deferPrefetchOnIdle() {
  const lView = getLView();
  const tNode = getCurrentTNode();
  if (ngDevMode) {
    trackTriggerForDebugging(lView[TVIEW], tNode, "prefetch on idle");
  }
  if (!shouldAttachTrigger(1, lView, tNode))
    return;
  scheduleDelayedPrefetching(onIdle);
}
function \u0275\u0275deferHydrateOnIdle() {
  const lView = getLView();
  const tNode = getCurrentTNode();
  if (ngDevMode) {
    trackTriggerForDebugging(lView[TVIEW], tNode, "hydrate on idle");
  }
  if (!shouldAttachTrigger(2, lView, tNode))
    return;
  const hydrateTriggers = getHydrateTriggers(getTView(), tNode);
  hydrateTriggers.set(0, null);
  if (false) {
    triggerDeferBlock(2, lView, tNode);
  } else {
    scheduleDelayedHydrating(onIdle, lView, tNode);
  }
}
function \u0275\u0275deferOnImmediate() {
  const lView = getLView();
  const tNode = getCurrentTNode();
  if (ngDevMode) {
    trackTriggerForDebugging(lView[TVIEW], tNode, "on immediate");
  }
  if (!shouldAttachTrigger(0, lView, tNode))
    return;
  const tDetails = getTDeferBlockDetails(lView[TVIEW], tNode);
  if (tDetails.loadingTmplIndex === null) {
    renderPlaceholder(lView, tNode);
  }
  triggerDeferBlock(0, lView, tNode);
}
function \u0275\u0275deferPrefetchOnImmediate() {
  const lView = getLView();
  const tNode = getCurrentTNode();
  if (ngDevMode) {
    trackTriggerForDebugging(lView[TVIEW], tNode, "prefetch on immediate");
  }
  if (!shouldAttachTrigger(1, lView, tNode))
    return;
  const tView = lView[TVIEW];
  const tDetails = getTDeferBlockDetails(tView, tNode);
  if (tDetails.loadingState === DeferDependenciesLoadingState.NOT_STARTED) {
    triggerResourceLoading(tDetails, lView, tNode);
  }
}
function \u0275\u0275deferHydrateOnImmediate() {
  const lView = getLView();
  const tNode = getCurrentTNode();
  if (ngDevMode) {
    trackTriggerForDebugging(lView[TVIEW], tNode, "hydrate on immediate");
  }
  if (!shouldAttachTrigger(2, lView, tNode))
    return;
  const hydrateTriggers = getHydrateTriggers(getTView(), tNode);
  hydrateTriggers.set(1, null);
  if (false) {
    triggerDeferBlock(2, lView, tNode);
  } else {
    const injector = lView[INJECTOR];
    const lDetails = getLDeferBlockDetails(lView, tNode);
    const ssrUniqueId = lDetails[SSR_UNIQUE_ID];
    ngDevMode && assertSsrIdDefined(ssrUniqueId);
    triggerHydrationFromBlockName(injector, ssrUniqueId);
  }
}
function \u0275\u0275deferOnTimer(delay) {
  const lView = getLView();
  const tNode = getCurrentTNode();
  if (ngDevMode) {
    trackTriggerForDebugging(lView[TVIEW], tNode, `on timer(${delay}ms)`);
  }
  if (!shouldAttachTrigger(0, lView, tNode))
    return;
  scheduleDelayedTrigger(onTimer(delay));
}
function \u0275\u0275deferPrefetchOnTimer(delay) {
  const lView = getLView();
  const tNode = getCurrentTNode();
  if (ngDevMode) {
    trackTriggerForDebugging(lView[TVIEW], tNode, `prefetch on timer(${delay}ms)`);
  }
  if (!shouldAttachTrigger(1, lView, tNode))
    return;
  scheduleDelayedPrefetching(onTimer(delay));
}
function \u0275\u0275deferHydrateOnTimer(delay) {
  const lView = getLView();
  const tNode = getCurrentTNode();
  if (ngDevMode) {
    trackTriggerForDebugging(lView[TVIEW], tNode, `hydrate on timer(${delay}ms)`);
  }
  if (!shouldAttachTrigger(2, lView, tNode))
    return;
  const hydrateTriggers = getHydrateTriggers(getTView(), tNode);
  hydrateTriggers.set(5, { delay });
  if (false) {
    triggerDeferBlock(2, lView, tNode);
  } else {
    scheduleDelayedHydrating(onTimer(delay), lView, tNode);
  }
}
function \u0275\u0275deferOnHover(triggerIndex, walkUpTimes) {
  const lView = getLView();
  const tNode = getCurrentTNode();
  if (ngDevMode) {
    trackTriggerForDebugging(lView[TVIEW], tNode, `on hover${walkUpTimes === -1 ? "" : "(<target>)"}`);
  }
  if (!shouldAttachTrigger(0, lView, tNode))
    return;
  renderPlaceholder(lView, tNode);
  if (true) {
    registerDomTrigger(
      lView,
      tNode,
      triggerIndex,
      walkUpTimes,
      onHover,
      () => triggerDeferBlock(0, lView, tNode),
      0
      /* TriggerType.Regular */
    );
  }
}
function \u0275\u0275deferPrefetchOnHover(triggerIndex, walkUpTimes) {
  const lView = getLView();
  const tNode = getCurrentTNode();
  if (ngDevMode) {
    trackTriggerForDebugging(lView[TVIEW], tNode, `prefetch on hover${walkUpTimes === -1 ? "" : "(<target>)"}`);
  }
  if (!shouldAttachTrigger(1, lView, tNode))
    return;
  const tView = lView[TVIEW];
  const tDetails = getTDeferBlockDetails(tView, tNode);
  if (tDetails.loadingState === DeferDependenciesLoadingState.NOT_STARTED) {
    registerDomTrigger(
      lView,
      tNode,
      triggerIndex,
      walkUpTimes,
      onHover,
      () => triggerPrefetching(tDetails, lView, tNode),
      1
      /* TriggerType.Prefetch */
    );
  }
}
function \u0275\u0275deferHydrateOnHover() {
  const lView = getLView();
  const tNode = getCurrentTNode();
  if (ngDevMode) {
    trackTriggerForDebugging(lView[TVIEW], tNode, "hydrate on hover");
  }
  if (!shouldAttachTrigger(2, lView, tNode))
    return;
  const hydrateTriggers = getHydrateTriggers(getTView(), tNode);
  hydrateTriggers.set(4, null);
  if (false) {
    triggerDeferBlock(2, lView, tNode);
  }
}
function \u0275\u0275deferOnInteraction(triggerIndex, walkUpTimes) {
  const lView = getLView();
  const tNode = getCurrentTNode();
  if (ngDevMode) {
    trackTriggerForDebugging(lView[TVIEW], tNode, `on interaction${walkUpTimes === -1 ? "" : "(<target>)"}`);
  }
  if (!shouldAttachTrigger(0, lView, tNode))
    return;
  renderPlaceholder(lView, tNode);
  if (true) {
    registerDomTrigger(
      lView,
      tNode,
      triggerIndex,
      walkUpTimes,
      onInteraction,
      () => triggerDeferBlock(0, lView, tNode),
      0
      /* TriggerType.Regular */
    );
  }
}
function \u0275\u0275deferPrefetchOnInteraction(triggerIndex, walkUpTimes) {
  const lView = getLView();
  const tNode = getCurrentTNode();
  if (ngDevMode) {
    trackTriggerForDebugging(lView[TVIEW], tNode, `prefetch on interaction${walkUpTimes === -1 ? "" : "(<target>)"}`);
  }
  if (!shouldAttachTrigger(1, lView, tNode))
    return;
  const tView = lView[TVIEW];
  const tDetails = getTDeferBlockDetails(tView, tNode);
  if (tDetails.loadingState === DeferDependenciesLoadingState.NOT_STARTED) {
    registerDomTrigger(
      lView,
      tNode,
      triggerIndex,
      walkUpTimes,
      onInteraction,
      () => triggerPrefetching(tDetails, lView, tNode),
      1
      /* TriggerType.Prefetch */
    );
  }
}
function \u0275\u0275deferHydrateOnInteraction() {
  const lView = getLView();
  const tNode = getCurrentTNode();
  if (ngDevMode) {
    trackTriggerForDebugging(lView[TVIEW], tNode, "hydrate on interaction");
  }
  if (!shouldAttachTrigger(2, lView, tNode))
    return;
  const hydrateTriggers = getHydrateTriggers(getTView(), tNode);
  hydrateTriggers.set(3, null);
  if (false) {
    triggerDeferBlock(2, lView, tNode);
  }
}
function \u0275\u0275deferOnViewport(triggerIndex, walkUpTimes) {
  const lView = getLView();
  const tNode = getCurrentTNode();
  if (ngDevMode) {
    trackTriggerForDebugging(lView[TVIEW], tNode, `on viewport${walkUpTimes === -1 ? "" : "(<target>)"}`);
  }
  if (!shouldAttachTrigger(0, lView, tNode))
    return;
  renderPlaceholder(lView, tNode);
  if (true) {
    registerDomTrigger(
      lView,
      tNode,
      triggerIndex,
      walkUpTimes,
      onViewportWrapper,
      () => triggerDeferBlock(0, lView, tNode),
      0
      /* TriggerType.Regular */
    );
  }
}
function \u0275\u0275deferPrefetchOnViewport(triggerIndex, walkUpTimes) {
  const lView = getLView();
  const tNode = getCurrentTNode();
  if (ngDevMode) {
    trackTriggerForDebugging(lView[TVIEW], tNode, `prefetch on viewport${walkUpTimes === -1 ? "" : "(<target>)"}`);
  }
  if (!shouldAttachTrigger(1, lView, tNode))
    return;
  const tView = lView[TVIEW];
  const tDetails = getTDeferBlockDetails(tView, tNode);
  if (tDetails.loadingState === DeferDependenciesLoadingState.NOT_STARTED) {
    registerDomTrigger(
      lView,
      tNode,
      triggerIndex,
      walkUpTimes,
      onViewportWrapper,
      () => triggerPrefetching(tDetails, lView, tNode),
      1
      /* TriggerType.Prefetch */
    );
  }
}
function \u0275\u0275deferHydrateOnViewport() {
  const lView = getLView();
  const tNode = getCurrentTNode();
  if (ngDevMode) {
    trackTriggerForDebugging(lView[TVIEW], tNode, "hydrate on viewport");
  }
  if (!shouldAttachTrigger(2, lView, tNode))
    return;
  const hydrateTriggers = getHydrateTriggers(getTView(), tNode);
  hydrateTriggers.set(2, null);
  if (false) {
    triggerDeferBlock(2, lView, tNode);
  }
}
function \u0275\u0275attribute(name2, value, sanitizer, namespace) {
  const lView = getLView();
  const bindingIndex = nextBindingIndex();
  if (bindingUpdated(lView, bindingIndex, value)) {
    const tView = getTView();
    const tNode = getSelectedTNode();
    elementAttributeInternal(tNode, lView, name2, value, sanitizer, namespace);
    ngDevMode && storePropertyBindingMetadata(tView.data, tNode, "attr." + name2, bindingIndex);
  }
  return \u0275\u0275attribute;
}
function \u0275\u0275componentInstance() {
  const instance = getLView()[DECLARATION_COMPONENT_VIEW][CONTEXT];
  ngDevMode && assertDefined(instance, "Expected component instance to be defined");
  return instance;
}
var LiveCollection = class {
  destroy(item) {
  }
  updateValue(index, value) {
  }
  // operations below could be implemented on top of the operations defined so far, but having
  // them explicitly allow clear expression of intent and potentially more performant
  // implementations
  swap(index1, index2) {
    const startIdx = Math.min(index1, index2);
    const endIdx = Math.max(index1, index2);
    const endItem = this.detach(endIdx);
    if (endIdx - startIdx > 1) {
      const startItem = this.detach(startIdx);
      this.attach(startIdx, endItem);
      this.attach(endIdx, startItem);
    } else {
      this.attach(startIdx, endItem);
    }
  }
  move(prevIndex, newIdx) {
    this.attach(newIdx, this.detach(prevIndex));
  }
};
function valuesMatching(liveIdx, liveValue, newIdx, newValue, trackBy) {
  if (liveIdx === newIdx && Object.is(liveValue, newValue)) {
    return 1;
  } else if (Object.is(trackBy(liveIdx, liveValue), trackBy(newIdx, newValue))) {
    return -1;
  }
  return 0;
}
function recordDuplicateKeys(keyToIdx, key, idx) {
  const idxSoFar = keyToIdx.get(key);
  if (idxSoFar !== void 0) {
    idxSoFar.add(idx);
  } else {
    keyToIdx.set(key, /* @__PURE__ */ new Set([idx]));
  }
}
function reconcile(liveCollection, newCollection, trackByFn) {
  let detachedItems = void 0;
  let liveKeysInTheFuture = void 0;
  let liveStartIdx = 0;
  let liveEndIdx = liveCollection.length - 1;
  const duplicateKeys = ngDevMode ? /* @__PURE__ */ new Map() : void 0;
  if (Array.isArray(newCollection)) {
    let newEndIdx = newCollection.length - 1;
    while (liveStartIdx <= liveEndIdx && liveStartIdx <= newEndIdx) {
      const liveStartValue = liveCollection.at(liveStartIdx);
      const newStartValue = newCollection[liveStartIdx];
      if (ngDevMode) {
        recordDuplicateKeys(duplicateKeys, trackByFn(liveStartIdx, newStartValue), liveStartIdx);
      }
      const isStartMatching = valuesMatching(liveStartIdx, liveStartValue, liveStartIdx, newStartValue, trackByFn);
      if (isStartMatching !== 0) {
        if (isStartMatching < 0) {
          liveCollection.updateValue(liveStartIdx, newStartValue);
        }
        liveStartIdx++;
        continue;
      }
      const liveEndValue = liveCollection.at(liveEndIdx);
      const newEndValue = newCollection[newEndIdx];
      if (ngDevMode) {
        recordDuplicateKeys(duplicateKeys, trackByFn(newEndIdx, newEndValue), newEndIdx);
      }
      const isEndMatching = valuesMatching(liveEndIdx, liveEndValue, newEndIdx, newEndValue, trackByFn);
      if (isEndMatching !== 0) {
        if (isEndMatching < 0) {
          liveCollection.updateValue(liveEndIdx, newEndValue);
        }
        liveEndIdx--;
        newEndIdx--;
        continue;
      }
      const liveStartKey = trackByFn(liveStartIdx, liveStartValue);
      const liveEndKey = trackByFn(liveEndIdx, liveEndValue);
      const newStartKey = trackByFn(liveStartIdx, newStartValue);
      if (Object.is(newStartKey, liveEndKey)) {
        const newEndKey = trackByFn(newEndIdx, newEndValue);
        if (Object.is(newEndKey, liveStartKey)) {
          liveCollection.swap(liveStartIdx, liveEndIdx);
          liveCollection.updateValue(liveEndIdx, newEndValue);
          newEndIdx--;
          liveEndIdx--;
        } else {
          liveCollection.move(liveEndIdx, liveStartIdx);
        }
        liveCollection.updateValue(liveStartIdx, newStartValue);
        liveStartIdx++;
        continue;
      }
      detachedItems ??= new UniqueValueMultiKeyMap();
      liveKeysInTheFuture ??= initLiveItemsInTheFuture(liveCollection, liveStartIdx, liveEndIdx, trackByFn);
      if (attachPreviouslyDetached(liveCollection, detachedItems, liveStartIdx, newStartKey)) {
        liveCollection.updateValue(liveStartIdx, newStartValue);
        liveStartIdx++;
        liveEndIdx++;
      } else if (!liveKeysInTheFuture.has(newStartKey)) {
        const newItem = liveCollection.create(liveStartIdx, newCollection[liveStartIdx]);
        liveCollection.attach(liveStartIdx, newItem);
        liveStartIdx++;
        liveEndIdx++;
      } else {
        detachedItems.set(liveStartKey, liveCollection.detach(liveStartIdx));
        liveEndIdx--;
      }
    }
    while (liveStartIdx <= newEndIdx) {
      createOrAttach(liveCollection, detachedItems, trackByFn, liveStartIdx, newCollection[liveStartIdx]);
      liveStartIdx++;
    }
  } else if (newCollection != null) {
    const newCollectionIterator = newCollection[Symbol.iterator]();
    let newIterationResult = newCollectionIterator.next();
    while (!newIterationResult.done && liveStartIdx <= liveEndIdx) {
      const liveValue = liveCollection.at(liveStartIdx);
      const newValue = newIterationResult.value;
      if (ngDevMode) {
        recordDuplicateKeys(duplicateKeys, trackByFn(liveStartIdx, newValue), liveStartIdx);
      }
      const isStartMatching = valuesMatching(liveStartIdx, liveValue, liveStartIdx, newValue, trackByFn);
      if (isStartMatching !== 0) {
        if (isStartMatching < 0) {
          liveCollection.updateValue(liveStartIdx, newValue);
        }
        liveStartIdx++;
        newIterationResult = newCollectionIterator.next();
      } else {
        detachedItems ??= new UniqueValueMultiKeyMap();
        liveKeysInTheFuture ??= initLiveItemsInTheFuture(liveCollection, liveStartIdx, liveEndIdx, trackByFn);
        const newKey = trackByFn(liveStartIdx, newValue);
        if (attachPreviouslyDetached(liveCollection, detachedItems, liveStartIdx, newKey)) {
          liveCollection.updateValue(liveStartIdx, newValue);
          liveStartIdx++;
          liveEndIdx++;
          newIterationResult = newCollectionIterator.next();
        } else if (!liveKeysInTheFuture.has(newKey)) {
          liveCollection.attach(liveStartIdx, liveCollection.create(liveStartIdx, newValue));
          liveStartIdx++;
          liveEndIdx++;
          newIterationResult = newCollectionIterator.next();
        } else {
          const liveKey = trackByFn(liveStartIdx, liveValue);
          detachedItems.set(liveKey, liveCollection.detach(liveStartIdx));
          liveEndIdx--;
        }
      }
    }
    while (!newIterationResult.done) {
      createOrAttach(liveCollection, detachedItems, trackByFn, liveCollection.length, newIterationResult.value);
      newIterationResult = newCollectionIterator.next();
    }
  }
  while (liveStartIdx <= liveEndIdx) {
    liveCollection.destroy(liveCollection.detach(liveEndIdx--));
  }
  detachedItems?.forEach((item) => {
    liveCollection.destroy(item);
  });
  if (ngDevMode) {
    let duplicatedKeysMsg = [];
    for (const [key, idxSet] of duplicateKeys) {
      if (idxSet.size > 1) {
        const idx = [...idxSet].sort((a, b) => a - b);
        for (let i = 1; i < idx.length; i++) {
          duplicatedKeysMsg.push(`key "${stringifyForError(key)}" at index "${idx[i - 1]}" and "${idx[i]}"`);
        }
      }
    }
    if (duplicatedKeysMsg.length > 0) {
      const message = formatRuntimeError(-955, "The provided track expression resulted in duplicated keys for a given collection. Adjust the tracking expression such that it uniquely identifies all the items in the collection. Duplicated keys were: \n" + duplicatedKeysMsg.join(", \n") + ".");
      console.warn(message);
    }
  }
}
function attachPreviouslyDetached(prevCollection, detachedItems, index, key) {
  if (detachedItems !== void 0 && detachedItems.has(key)) {
    prevCollection.attach(index, detachedItems.get(key));
    detachedItems.delete(key);
    return true;
  }
  return false;
}
function createOrAttach(liveCollection, detachedItems, trackByFn, index, value) {
  if (!attachPreviouslyDetached(liveCollection, detachedItems, index, trackByFn(index, value))) {
    const newItem = liveCollection.create(index, value);
    liveCollection.attach(index, newItem);
  } else {
    liveCollection.updateValue(index, value);
  }
}
function initLiveItemsInTheFuture(liveCollection, start, end, trackByFn) {
  const keys = /* @__PURE__ */ new Set();
  for (let i = start; i <= end; i++) {
    keys.add(trackByFn(i, liveCollection.at(i)));
  }
  return keys;
}
var UniqueValueMultiKeyMap = class {
  // A map from a key to the first value corresponding to this key.
  kvMap = /* @__PURE__ */ new Map();
  // A map that acts as a linked list of values - each value maps to the next value in this "linked
  // list" (this only works if values are unique). Allocated lazily to avoid memory consumption when
  // there are no duplicated values.
  _vMap = void 0;
  has(key) {
    return this.kvMap.has(key);
  }
  delete(key) {
    if (!this.has(key))
      return false;
    const value = this.kvMap.get(key);
    if (this._vMap !== void 0 && this._vMap.has(value)) {
      this.kvMap.set(key, this._vMap.get(value));
      this._vMap.delete(value);
    } else {
      this.kvMap.delete(key);
    }
    return true;
  }
  get(key) {
    return this.kvMap.get(key);
  }
  set(key, value) {
    if (this.kvMap.has(key)) {
      let prevValue = this.kvMap.get(key);
      if (ngDevMode && prevValue === value) {
        throw new Error(`Detected a duplicated value ${value} for the key ${key}`);
      }
      if (this._vMap === void 0) {
        this._vMap = /* @__PURE__ */ new Map();
      }
      const vMap = this._vMap;
      while (vMap.has(prevValue)) {
        prevValue = vMap.get(prevValue);
      }
      vMap.set(prevValue, value);
    } else {
      this.kvMap.set(key, value);
    }
  }
  forEach(cb) {
    for (let [key, value] of this.kvMap) {
      cb(value, key);
      if (this._vMap !== void 0) {
        const vMap = this._vMap;
        while (vMap.has(value)) {
          value = vMap.get(value);
          cb(value, key);
        }
      }
    }
  }
};
function \u0275\u0275conditionalCreate(index, templateFn, decls, vars, tagName, attrsIndex, localRefsIndex, localRefExtractor) {
  performanceMarkFeature("NgControlFlow");
  const lView = getLView();
  const tView = getTView();
  const attrs = getConstant(tView.consts, attrsIndex);
  declareNoDirectiveHostTemplate(lView, tView, index, templateFn, decls, vars, tagName, attrs, 256, localRefsIndex, localRefExtractor);
  return \u0275\u0275conditionalBranchCreate;
}
function \u0275\u0275conditionalBranchCreate(index, templateFn, decls, vars, tagName, attrsIndex, localRefsIndex, localRefExtractor) {
  performanceMarkFeature("NgControlFlow");
  const lView = getLView();
  const tView = getTView();
  const attrs = getConstant(tView.consts, attrsIndex);
  declareNoDirectiveHostTemplate(lView, tView, index, templateFn, decls, vars, tagName, attrs, 512, localRefsIndex, localRefExtractor);
  return \u0275\u0275conditionalBranchCreate;
}
function \u0275\u0275conditional(matchingTemplateIndex, contextValue) {
  performanceMarkFeature("NgControlFlow");
  const hostLView = getLView();
  const bindingIndex = nextBindingIndex();
  const prevMatchingTemplateIndex = hostLView[bindingIndex] !== NO_CHANGE ? hostLView[bindingIndex] : -1;
  const prevContainer = prevMatchingTemplateIndex !== -1 ? getLContainer(hostLView, HEADER_OFFSET + prevMatchingTemplateIndex) : void 0;
  const viewInContainerIdx = 0;
  if (bindingUpdated(hostLView, bindingIndex, matchingTemplateIndex)) {
    const prevConsumer = setActiveConsumer(null);
    try {
      if (prevContainer !== void 0) {
        removeLViewFromLContainer(prevContainer, viewInContainerIdx);
      }
      if (matchingTemplateIndex !== -1) {
        const nextLContainerIndex = HEADER_OFFSET + matchingTemplateIndex;
        const nextContainer = getLContainer(hostLView, nextLContainerIndex);
        const templateTNode = getExistingTNode(hostLView[TVIEW], nextLContainerIndex);
        const dehydratedView = findAndReconcileMatchingDehydratedViews(nextContainer, templateTNode, hostLView);
        const embeddedLView = createAndRenderEmbeddedLView(hostLView, templateTNode, contextValue, {
          dehydratedView
        });
        addLViewToLContainer(nextContainer, embeddedLView, viewInContainerIdx, shouldAddViewToDom(templateTNode, dehydratedView));
      }
    } finally {
      setActiveConsumer(prevConsumer);
    }
  } else if (prevContainer !== void 0) {
    const lView = getLViewFromLContainer(prevContainer, viewInContainerIdx);
    if (lView !== void 0) {
      lView[CONTEXT] = contextValue;
    }
  }
}
var RepeaterContext = class {
  lContainer;
  $implicit;
  $index;
  constructor(lContainer, $implicit, $index) {
    this.lContainer = lContainer;
    this.$implicit = $implicit;
    this.$index = $index;
  }
  get $count() {
    return this.lContainer.length - CONTAINER_HEADER_OFFSET;
  }
};
function \u0275\u0275repeaterTrackByIndex(index) {
  return index;
}
function \u0275\u0275repeaterTrackByIdentity(_4, value) {
  return value;
}
var RepeaterMetadata = class {
  hasEmptyBlock;
  trackByFn;
  liveCollection;
  constructor(hasEmptyBlock, trackByFn, liveCollection) {
    this.hasEmptyBlock = hasEmptyBlock;
    this.trackByFn = trackByFn;
    this.liveCollection = liveCollection;
  }
};
function \u0275\u0275repeaterCreate(index, templateFn, decls, vars, tagName, attrsIndex, trackByFn, trackByUsesComponentInstance, emptyTemplateFn, emptyDecls, emptyVars, emptyTagName, emptyAttrsIndex) {
  performanceMarkFeature("NgControlFlow");
  ngDevMode && assertFunction(trackByFn, `A track expression must be a function, was ${typeof trackByFn} instead.`);
  const lView = getLView();
  const tView = getTView();
  const hasEmptyBlock = emptyTemplateFn !== void 0;
  const hostLView = getLView();
  const boundTrackBy = trackByUsesComponentInstance ? (
    // We only want to bind when necessary, because it produces a
    // new function. For pure functions it's not necessary.
    trackByFn.bind(hostLView[DECLARATION_COMPONENT_VIEW][CONTEXT])
  ) : trackByFn;
  const metadata = new RepeaterMetadata(hasEmptyBlock, boundTrackBy);
  hostLView[HEADER_OFFSET + index] = metadata;
  declareNoDirectiveHostTemplate(
    lView,
    tView,
    index + 1,
    templateFn,
    decls,
    vars,
    tagName,
    getConstant(tView.consts, attrsIndex),
    256
    /* TNodeFlags.isControlFlowStart */
  );
  if (hasEmptyBlock) {
    ngDevMode && assertDefined(emptyDecls, "Missing number of declarations for the empty repeater block.");
    ngDevMode && assertDefined(emptyVars, "Missing number of bindings for the empty repeater block.");
    declareNoDirectiveHostTemplate(
      lView,
      tView,
      index + 2,
      emptyTemplateFn,
      emptyDecls,
      emptyVars,
      emptyTagName,
      getConstant(tView.consts, emptyAttrsIndex),
      512
      /* TNodeFlags.isInControlFlow */
    );
  }
}
function isViewExpensiveToRecreate(lView) {
  return lView.length - HEADER_OFFSET > 2;
}
var OperationsCounter = class {
  created = 0;
  destroyed = 0;
  reset() {
    this.created = 0;
    this.destroyed = 0;
  }
  recordCreate() {
    this.created++;
  }
  recordDestroy() {
    this.destroyed++;
  }
  /**
   * A method indicating if the entire collection was re-created as part of the reconciliation pass.
   * Used to warn developers about the usage of a tracking function that might result in excessive
   * amount of view creation / destroy operations.
   *
   * @returns boolean value indicating if a live collection was re-created
   */
  wasReCreated(collectionLen) {
    return collectionLen > 0 && this.created === this.destroyed && this.created === collectionLen;
  }
};
var LiveCollectionLContainerImpl = class extends LiveCollection {
  lContainer;
  hostLView;
  templateTNode;
  operationsCounter = ngDevMode ? new OperationsCounter() : void 0;
  /**
    Property indicating if indexes in the repeater context need to be updated following the live
    collection changes. Index updates are necessary if and only if views are inserted / removed in
    the middle of LContainer. Adds and removals at the end don't require index updates.
  */
  needsIndexUpdate = false;
  constructor(lContainer, hostLView, templateTNode) {
    super();
    this.lContainer = lContainer;
    this.hostLView = hostLView;
    this.templateTNode = templateTNode;
  }
  get length() {
    return this.lContainer.length - CONTAINER_HEADER_OFFSET;
  }
  at(index) {
    return this.getLView(index)[CONTEXT].$implicit;
  }
  attach(index, lView) {
    const dehydratedView = lView[HYDRATION];
    this.needsIndexUpdate ||= index !== this.length;
    addLViewToLContainer(this.lContainer, lView, index, shouldAddViewToDom(this.templateTNode, dehydratedView));
  }
  detach(index) {
    this.needsIndexUpdate ||= index !== this.length - 1;
    return detachExistingView(this.lContainer, index);
  }
  create(index, value) {
    const dehydratedView = findMatchingDehydratedView(this.lContainer, this.templateTNode.tView.ssrId);
    const embeddedLView = createAndRenderEmbeddedLView(this.hostLView, this.templateTNode, new RepeaterContext(this.lContainer, value, index), { dehydratedView });
    this.operationsCounter?.recordCreate();
    return embeddedLView;
  }
  destroy(lView) {
    destroyLView(lView[TVIEW], lView);
    this.operationsCounter?.recordDestroy();
  }
  updateValue(index, value) {
    this.getLView(index)[CONTEXT].$implicit = value;
  }
  reset() {
    this.needsIndexUpdate = false;
    this.operationsCounter?.reset();
  }
  updateIndexes() {
    if (this.needsIndexUpdate) {
      for (let i = 0; i < this.length; i++) {
        this.getLView(i)[CONTEXT].$index = i;
      }
    }
  }
  getLView(index) {
    return getExistingLViewFromLContainer(this.lContainer, index);
  }
};
function \u0275\u0275repeater(collection) {
  const prevConsumer = setActiveConsumer(null);
  const metadataSlotIdx = getSelectedIndex();
  try {
    const hostLView = getLView();
    const hostTView = hostLView[TVIEW];
    const metadata = hostLView[metadataSlotIdx];
    const containerIndex = metadataSlotIdx + 1;
    const lContainer = getLContainer(hostLView, containerIndex);
    if (metadata.liveCollection === void 0) {
      const itemTemplateTNode = getExistingTNode(hostTView, containerIndex);
      metadata.liveCollection = new LiveCollectionLContainerImpl(lContainer, hostLView, itemTemplateTNode);
    } else {
      metadata.liveCollection.reset();
    }
    const liveCollection = metadata.liveCollection;
    reconcile(liveCollection, collection, metadata.trackByFn);
    if (ngDevMode && metadata.trackByFn === \u0275\u0275repeaterTrackByIdentity && liveCollection.operationsCounter?.wasReCreated(liveCollection.length) && isViewExpensiveToRecreate(getExistingLViewFromLContainer(lContainer, 0))) {
      const message = formatRuntimeError(-956, `The configured tracking expression (track by identity) caused re-creation of the entire collection of size ${liveCollection.length}. This is an expensive operation requiring destruction and subsequent creation of DOM nodes, directives, components etc. Please review the "track expression" and make sure that it uniquely identifies items in a collection.`);
      console.warn(message);
    }
    liveCollection.updateIndexes();
    if (metadata.hasEmptyBlock) {
      const bindingIndex = nextBindingIndex();
      const isCollectionEmpty = liveCollection.length === 0;
      if (bindingUpdated(hostLView, bindingIndex, isCollectionEmpty)) {
        const emptyTemplateIndex = metadataSlotIdx + 2;
        const lContainerForEmpty = getLContainer(hostLView, emptyTemplateIndex);
        if (isCollectionEmpty) {
          const emptyTemplateTNode = getExistingTNode(hostTView, emptyTemplateIndex);
          const dehydratedView = findAndReconcileMatchingDehydratedViews(lContainerForEmpty, emptyTemplateTNode, hostLView);
          const embeddedLView = createAndRenderEmbeddedLView(hostLView, emptyTemplateTNode, void 0, { dehydratedView });
          addLViewToLContainer(lContainerForEmpty, embeddedLView, 0, shouldAddViewToDom(emptyTemplateTNode, dehydratedView));
        } else {
          if (hostTView.firstUpdatePass) {
            removeDehydratedViews(lContainerForEmpty);
          }
          removeLViewFromLContainer(lContainerForEmpty, 0);
        }
      }
    }
  } finally {
    setActiveConsumer(prevConsumer);
  }
}
function getLContainer(lView, index) {
  const lContainer = lView[index];
  ngDevMode && assertLContainer(lContainer);
  return lContainer;
}
function detachExistingView(lContainer, index) {
  const existingLView = detachView(lContainer, index);
  ngDevMode && assertLView(existingLView);
  return existingLView;
}
function getExistingLViewFromLContainer(lContainer, index) {
  const existingLView = getLViewFromLContainer(lContainer, index);
  ngDevMode && assertLView(existingLView);
  return existingLView;
}
function getExistingTNode(tView, index) {
  const tNode = getTNode(tView, index);
  ngDevMode && assertTNode(tNode);
  return tNode;
}
function \u0275\u0275property(propName, value, sanitizer) {
  const lView = getLView();
  const bindingIndex = nextBindingIndex();
  if (bindingUpdated(lView, bindingIndex, value)) {
    const tView = getTView();
    const tNode = getSelectedTNode();
    setPropertyAndInputs(tNode, lView, propName, value, lView[RENDERER], sanitizer);
    ngDevMode && storePropertyBindingMetadata(tView.data, tNode, propName, bindingIndex);
  }
  return \u0275\u0275property;
}
function setDirectiveInputsWhichShadowsStyling(tView, tNode, lView, value, isClassBased) {
  setAllInputsForProperty(tNode, tView, lView, isClassBased ? "class" : "style", value);
}
function \u0275\u0275elementStart(index, name2, attrsIndex, localRefsIndex) {
  const lView = getLView();
  ngDevMode && assertTNodeCreationIndex(lView, index);
  const tView = lView[TVIEW];
  const adjustedIndex = index + HEADER_OFFSET;
  const tNode = tView.firstCreatePass ? directiveHostFirstCreatePass(adjustedIndex, lView, 2, name2, findDirectiveDefMatches, getBindingsEnabled(), attrsIndex, localRefsIndex) : tView.data[adjustedIndex];
  elementLikeStartShared(tNode, lView, index, name2, _locateOrCreateElementNode);
  if (isDirectiveHost(tNode)) {
    const tView2 = lView[TVIEW];
    createDirectivesInstances(tView2, lView, tNode);
    executeContentQueries(tView2, tNode, lView);
  }
  if (localRefsIndex != null) {
    saveResolvedLocalsInData(lView, tNode);
  }
  if (ngDevMode && lView[TVIEW].firstCreatePass) {
    validateElementIsKnown(lView, tNode);
  }
  return \u0275\u0275elementStart;
}
function \u0275\u0275elementEnd() {
  const tView = getTView();
  const initialTNode = getCurrentTNode();
  ngDevMode && assertDefined(initialTNode, "No parent node to close.");
  const currentTNode = elementLikeEndShared(initialTNode);
  ngDevMode && assertTNodeType(
    currentTNode,
    3
    /* TNodeType.AnyRNode */
  );
  if (tView.firstCreatePass) {
    directiveHostEndFirstCreatePass(tView, currentTNode);
  }
  if (isSkipHydrationRootTNode(currentTNode)) {
    leaveSkipHydrationBlock();
  }
  decreaseElementDepthCount();
  if (currentTNode.classesWithoutHost != null && hasClassInput(currentTNode)) {
    setDirectiveInputsWhichShadowsStyling(tView, currentTNode, getLView(), currentTNode.classesWithoutHost, true);
  }
  if (currentTNode.stylesWithoutHost != null && hasStyleInput(currentTNode)) {
    setDirectiveInputsWhichShadowsStyling(tView, currentTNode, getLView(), currentTNode.stylesWithoutHost, false);
  }
  return \u0275\u0275elementEnd;
}
function \u0275\u0275element(index, name2, attrsIndex, localRefsIndex) {
  \u0275\u0275elementStart(index, name2, attrsIndex, localRefsIndex);
  \u0275\u0275elementEnd();
  return \u0275\u0275element;
}
function \u0275\u0275domElementStart(index, name2, attrsIndex, localRefsIndex) {
  const lView = getLView();
  ngDevMode && assertTNodeCreationIndex(lView, index);
  const tView = lView[TVIEW];
  const adjustedIndex = index + HEADER_OFFSET;
  const tNode = tView.firstCreatePass ? domOnlyFirstCreatePass(adjustedIndex, tView, 2, name2, attrsIndex, localRefsIndex) : tView.data[adjustedIndex];
  elementLikeStartShared(tNode, lView, index, name2, _locateOrCreateElementNode);
  if (localRefsIndex != null) {
    saveResolvedLocalsInData(lView, tNode);
  }
  if (ngDevMode && lView[TVIEW].firstCreatePass) {
    validateElementIsKnown(lView, tNode);
  }
  return \u0275\u0275domElementStart;
}
function \u0275\u0275domElementEnd() {
  const initialTNode = getCurrentTNode();
  ngDevMode && assertDefined(initialTNode, "No parent node to close.");
  const currentTNode = elementLikeEndShared(initialTNode);
  ngDevMode && assertTNodeType(
    currentTNode,
    3
    /* TNodeType.AnyRNode */
  );
  if (isSkipHydrationRootTNode(currentTNode)) {
    leaveSkipHydrationBlock();
  }
  decreaseElementDepthCount();
  return \u0275\u0275domElementEnd;
}
function \u0275\u0275domElement(index, name2, attrsIndex, localRefsIndex) {
  \u0275\u0275domElementStart(index, name2, attrsIndex, localRefsIndex);
  \u0275\u0275domElementEnd();
  return \u0275\u0275domElement;
}
var _locateOrCreateElementNode = (tView, lView, tNode, name2, index) => {
  lastNodeWasCreated(true);
  return createElementNode(lView[RENDERER], name2, getNamespace());
};
function \u0275\u0275elementContainerStart(index, attrsIndex, localRefsIndex) {
  const lView = getLView();
  ngDevMode && assertTNodeCreationIndex(lView, index);
  const tView = lView[TVIEW];
  const adjustedIndex = index + HEADER_OFFSET;
  const tNode = tView.firstCreatePass ? directiveHostFirstCreatePass(adjustedIndex, lView, 8, "ng-container", findDirectiveDefMatches, getBindingsEnabled(), attrsIndex, localRefsIndex) : tView.data[adjustedIndex];
  elementLikeStartShared(tNode, lView, index, "ng-container", _locateOrCreateElementContainerNode);
  if (isDirectiveHost(tNode)) {
    const tView2 = lView[TVIEW];
    createDirectivesInstances(tView2, lView, tNode);
    executeContentQueries(tView2, tNode, lView);
  }
  if (localRefsIndex != null) {
    saveResolvedLocalsInData(lView, tNode);
  }
  return \u0275\u0275elementContainerStart;
}
function \u0275\u0275elementContainerEnd() {
  const tView = getTView();
  const initialTNode = getCurrentTNode();
  ngDevMode && assertDefined(initialTNode, "No parent node to close.");
  const currentTNode = elementLikeEndShared(initialTNode);
  if (tView.firstCreatePass) {
    directiveHostEndFirstCreatePass(tView, currentTNode);
  }
  ngDevMode && assertTNodeType(
    currentTNode,
    8
    /* TNodeType.ElementContainer */
  );
  return \u0275\u0275elementContainerEnd;
}
function \u0275\u0275elementContainer(index, attrsIndex, localRefsIndex) {
  \u0275\u0275elementContainerStart(index, attrsIndex, localRefsIndex);
  \u0275\u0275elementContainerEnd();
  return \u0275\u0275elementContainer;
}
function \u0275\u0275domElementContainerStart(index, attrsIndex, localRefsIndex) {
  const lView = getLView();
  ngDevMode && assertTNodeCreationIndex(lView, index);
  const tView = lView[TVIEW];
  const adjustedIndex = index + HEADER_OFFSET;
  const tNode = tView.firstCreatePass ? domOnlyFirstCreatePass(adjustedIndex, tView, 8, "ng-container", attrsIndex, localRefsIndex) : tView.data[adjustedIndex];
  elementLikeStartShared(tNode, lView, index, "ng-container", _locateOrCreateElementContainerNode);
  if (localRefsIndex != null) {
    saveResolvedLocalsInData(lView, tNode);
  }
  return \u0275\u0275domElementContainerStart;
}
function \u0275\u0275domElementContainerEnd() {
  const initialTNode = getCurrentTNode();
  ngDevMode && assertDefined(initialTNode, "No parent node to close.");
  const currentTNode = elementLikeEndShared(initialTNode);
  ngDevMode && assertTNodeType(
    currentTNode,
    8
    /* TNodeType.ElementContainer */
  );
  return \u0275\u0275elementContainerEnd;
}
function \u0275\u0275domElementContainer(index, attrsIndex, localRefsIndex) {
  \u0275\u0275domElementContainerStart(index, attrsIndex, localRefsIndex);
  \u0275\u0275domElementContainerEnd();
  return \u0275\u0275domElementContainer;
}
var _locateOrCreateElementContainerNode = (tView, lView, tNode, commentText, index) => {
  lastNodeWasCreated(true);
  return createCommentNode(lView[RENDERER], ngDevMode ? commentText : "");
};
function \u0275\u0275getCurrentView() {
  return getLView();
}
function \u0275\u0275domProperty(propName, value, sanitizer) {
  const lView = getLView();
  const bindingIndex = nextBindingIndex();
  if (bindingUpdated(lView, bindingIndex, value)) {
    const tView = getTView();
    const tNode = getSelectedTNode();
    setDomProperty(tNode, lView, propName, value, lView[RENDERER], sanitizer);
    ngDevMode && storePropertyBindingMetadata(tView.data, tNode, propName, bindingIndex);
  }
  return \u0275\u0275domProperty;
}
function \u0275\u0275syntheticHostProperty(propName, value, sanitizer) {
  const lView = getLView();
  const bindingIndex = nextBindingIndex();
  if (bindingUpdated(lView, bindingIndex, value)) {
    const tView = getTView();
    const tNode = getSelectedTNode();
    const currentDef = getCurrentDirectiveDef(tView.data);
    const renderer = loadComponentRenderer(currentDef, tNode, lView);
    setDomProperty(tNode, lView, propName, value, renderer, sanitizer);
    ngDevMode && storePropertyBindingMetadata(tView.data, tNode, propName, bindingIndex);
  }
  return \u0275\u0275syntheticHostProperty;
}
var u = void 0;
function plural(val) {
  const i = Math.floor(Math.abs(val)), v = val.toString().replace(/^[^.]*\.?/, "").length;
  if (i === 1 && v === 0)
    return 1;
  return 5;
}
var localeEn = ["en", [["a", "p"], ["AM", "PM"], u], [["AM", "PM"], u, u], [["S", "M", "T", "W", "T", "F", "S"], ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]], u, [["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"], ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]], u, [["B", "A"], ["BC", "AD"], ["Before Christ", "Anno Domini"]], 0, [6, 0], ["M/d/yy", "MMM d, y", "MMMM d, y", "EEEE, MMMM d, y"], ["h:mm a", "h:mm:ss a", "h:mm:ss a z", "h:mm:ss a zzzz"], ["{1}, {0}", u, "{1} 'at' {0}", u], [".", ",", ";", "%", "+", "-", "E", "\xD7", "\u2030", "\u221E", "NaN", ":"], ["#,##0.###", "#,##0%", "\xA4#,##0.00", "#E0"], "USD", "$", "US Dollar", {}, "ltr", plural];
var LOCALE_DATA = {};
function findLocaleData(locale) {
  const normalizedLocale = normalizeLocale(locale);
  let match2 = getLocaleData(normalizedLocale);
  if (match2) {
    return match2;
  }
  const parentLocale = normalizedLocale.split("-")[0];
  match2 = getLocaleData(parentLocale);
  if (match2) {
    return match2;
  }
  if (parentLocale === "en") {
    return localeEn;
  }
  throw new RuntimeError(701, ngDevMode && `Missing locale data for the locale "${locale}".`);
}
function getLocalePluralCase(locale) {
  const data = findLocaleData(locale);
  return data[LocaleDataIndex.PluralCase];
}
function getLocaleData(normalizedLocale) {
  if (!(normalizedLocale in LOCALE_DATA)) {
    LOCALE_DATA[normalizedLocale] = _global.ng && _global.ng.common && _global.ng.common.locales && _global.ng.common.locales[normalizedLocale];
  }
  return LOCALE_DATA[normalizedLocale];
}
var LocaleDataIndex;
(function(LocaleDataIndex2) {
  LocaleDataIndex2[LocaleDataIndex2["LocaleId"] = 0] = "LocaleId";
  LocaleDataIndex2[LocaleDataIndex2["DayPeriodsFormat"] = 1] = "DayPeriodsFormat";
  LocaleDataIndex2[LocaleDataIndex2["DayPeriodsStandalone"] = 2] = "DayPeriodsStandalone";
  LocaleDataIndex2[LocaleDataIndex2["DaysFormat"] = 3] = "DaysFormat";
  LocaleDataIndex2[LocaleDataIndex2["DaysStandalone"] = 4] = "DaysStandalone";
  LocaleDataIndex2[LocaleDataIndex2["MonthsFormat"] = 5] = "MonthsFormat";
  LocaleDataIndex2[LocaleDataIndex2["MonthsStandalone"] = 6] = "MonthsStandalone";
  LocaleDataIndex2[LocaleDataIndex2["Eras"] = 7] = "Eras";
  LocaleDataIndex2[LocaleDataIndex2["FirstDayOfWeek"] = 8] = "FirstDayOfWeek";
  LocaleDataIndex2[LocaleDataIndex2["WeekendRange"] = 9] = "WeekendRange";
  LocaleDataIndex2[LocaleDataIndex2["DateFormat"] = 10] = "DateFormat";
  LocaleDataIndex2[LocaleDataIndex2["TimeFormat"] = 11] = "TimeFormat";
  LocaleDataIndex2[LocaleDataIndex2["DateTimeFormat"] = 12] = "DateTimeFormat";
  LocaleDataIndex2[LocaleDataIndex2["NumberSymbols"] = 13] = "NumberSymbols";
  LocaleDataIndex2[LocaleDataIndex2["NumberFormats"] = 14] = "NumberFormats";
  LocaleDataIndex2[LocaleDataIndex2["CurrencyCode"] = 15] = "CurrencyCode";
  LocaleDataIndex2[LocaleDataIndex2["CurrencySymbol"] = 16] = "CurrencySymbol";
  LocaleDataIndex2[LocaleDataIndex2["CurrencyName"] = 17] = "CurrencyName";
  LocaleDataIndex2[LocaleDataIndex2["Currencies"] = 18] = "Currencies";
  LocaleDataIndex2[LocaleDataIndex2["Directionality"] = 19] = "Directionality";
  LocaleDataIndex2[LocaleDataIndex2["PluralCase"] = 20] = "PluralCase";
  LocaleDataIndex2[LocaleDataIndex2["ExtraData"] = 21] = "ExtraData";
})(LocaleDataIndex || (LocaleDataIndex = {}));
function normalizeLocale(locale) {
  return locale.toLowerCase().replace(/_/g, "-");
}
var pluralMapping = ["zero", "one", "two", "few", "many"];
function getPluralCase(value, locale) {
  const plural2 = getLocalePluralCase(locale)(parseInt(value, 10));
  const result = pluralMapping[plural2];
  return result !== void 0 ? result : "other";
}
var DEFAULT_LOCALE_ID = "en-US";
var USD_CURRENCY_CODE = "USD";
var ELEMENT_MARKER = {
  marker: "element"
};
var ICU_MARKER = {
  marker: "ICU"
};
var I18nCreateOpCode;
(function(I18nCreateOpCode2) {
  I18nCreateOpCode2[I18nCreateOpCode2["SHIFT"] = 2] = "SHIFT";
  I18nCreateOpCode2[I18nCreateOpCode2["APPEND_EAGERLY"] = 1] = "APPEND_EAGERLY";
  I18nCreateOpCode2[I18nCreateOpCode2["COMMENT"] = 2] = "COMMENT";
})(I18nCreateOpCode || (I18nCreateOpCode = {}));
var LOCALE_ID$1 = DEFAULT_LOCALE_ID;
function setLocaleId(localeId) {
  ngDevMode && assertDefined(localeId, `Expected localeId to be defined`);
  if (typeof localeId === "string") {
    LOCALE_ID$1 = localeId.toLowerCase().replace(/_/g, "-");
  }
}
function getLocaleId() {
  return LOCALE_ID$1;
}
var changeMask = 0;
var changeMaskCounter = 0;
function setMaskBit(hasChange) {
  if (hasChange) {
    changeMask = changeMask | 1 << Math.min(changeMaskCounter, 31);
  }
  changeMaskCounter++;
}
function applyI18n(tView, lView, index) {
  if (changeMaskCounter > 0) {
    ngDevMode && assertDefined(tView, `tView should be defined`);
    const tI18n = tView.data[index];
    const updateOpCodes = Array.isArray(tI18n) ? tI18n : tI18n.update;
    const bindingsStartIndex = getBindingIndex() - changeMaskCounter - 1;
    applyUpdateOpCodes(tView, lView, updateOpCodes, bindingsStartIndex, changeMask);
  }
  changeMask = 0;
  changeMaskCounter = 0;
}
function createNodeWithoutHydration(lView, textOrName, nodeType) {
  const renderer = lView[RENDERER];
  switch (nodeType) {
    case Node.COMMENT_NODE:
      return createCommentNode(renderer, textOrName);
    case Node.TEXT_NODE:
      return createTextNode(renderer, textOrName);
    case Node.ELEMENT_NODE:
      return createElementNode(renderer, textOrName, null);
  }
}
var _locateOrCreateNode = (lView, index, textOrName, nodeType) => {
  lastNodeWasCreated(true);
  return createNodeWithoutHydration(lView, textOrName, nodeType);
};
function applyCreateOpCodes(lView, createOpCodes, parentRNode, insertInFrontOf) {
  const renderer = lView[RENDERER];
  for (let i = 0; i < createOpCodes.length; i++) {
    const opCode = createOpCodes[i++];
    const text = createOpCodes[i];
    const isComment = (opCode & I18nCreateOpCode.COMMENT) === I18nCreateOpCode.COMMENT;
    const appendNow = (opCode & I18nCreateOpCode.APPEND_EAGERLY) === I18nCreateOpCode.APPEND_EAGERLY;
    const index = opCode >>> I18nCreateOpCode.SHIFT;
    let rNode = lView[index];
    let lastNodeWasCreated2 = false;
    if (rNode === null) {
      rNode = lView[index] = _locateOrCreateNode(lView, index, text, isComment ? Node.COMMENT_NODE : Node.TEXT_NODE);
      lastNodeWasCreated2 = wasLastNodeCreated();
    }
    if (appendNow && parentRNode !== null && lastNodeWasCreated2) {
      nativeInsertBefore(renderer, parentRNode, rNode, insertInFrontOf, false);
    }
  }
}
function applyMutableOpCodes(tView, mutableOpCodes, lView, anchorRNode) {
  ngDevMode && assertDomNode(anchorRNode);
  const renderer = lView[RENDERER];
  let rootIdx = null;
  let rootRNode;
  for (let i = 0; i < mutableOpCodes.length; i++) {
    const opCode = mutableOpCodes[i];
    if (typeof opCode == "string") {
      const textNodeIndex = mutableOpCodes[++i];
      if (lView[textNodeIndex] === null) {
        ngDevMode && assertIndexInRange(lView, textNodeIndex);
        lView[textNodeIndex] = _locateOrCreateNode(lView, textNodeIndex, opCode, Node.TEXT_NODE);
      }
    } else if (typeof opCode == "number") {
      switch (opCode & 1) {
        case 0:
          const parentIdx = getParentFromIcuCreateOpCode(opCode);
          if (rootIdx === null) {
            rootIdx = parentIdx;
            rootRNode = renderer.parentNode(anchorRNode);
          }
          let insertInFrontOf;
          let parentRNode;
          if (parentIdx === rootIdx) {
            insertInFrontOf = anchorRNode;
            parentRNode = rootRNode;
          } else {
            insertInFrontOf = null;
            parentRNode = unwrapRNode(lView[parentIdx]);
          }
          if (parentRNode !== null) {
            ngDevMode && assertDomNode(parentRNode);
            const refIdx = getRefFromIcuCreateOpCode(opCode);
            ngDevMode && assertGreaterThan(refIdx, HEADER_OFFSET, "Missing ref");
            const child = lView[refIdx];
            ngDevMode && assertDomNode(child);
            nativeInsertBefore(renderer, parentRNode, child, insertInFrontOf, false);
            const tIcu = getTIcu(tView, refIdx);
            if (tIcu !== null && typeof tIcu === "object") {
              ngDevMode && assertTIcu(tIcu);
              const caseIndex = getCurrentICUCaseIndex(tIcu, lView);
              if (caseIndex !== null) {
                applyMutableOpCodes(tView, tIcu.create[caseIndex], lView, lView[tIcu.anchorIdx]);
              }
            }
          }
          break;
        case 1:
          const elementNodeIndex = opCode >>> 1;
          const attrName = mutableOpCodes[++i];
          const attrValue = mutableOpCodes[++i];
          setElementAttribute(renderer, getNativeByIndex(elementNodeIndex, lView), null, null, attrName, attrValue, null);
          break;
        default:
          if (ngDevMode) {
            throw new RuntimeError(700, `Unable to determine the type of mutate operation for "${opCode}"`);
          }
      }
    } else {
      switch (opCode) {
        case ICU_MARKER:
          const commentValue = mutableOpCodes[++i];
          const commentNodeIndex = mutableOpCodes[++i];
          if (lView[commentNodeIndex] === null) {
            ngDevMode && assertEqual(typeof commentValue, "string", `Expected "${commentValue}" to be a comment node value`);
            ngDevMode && assertIndexInExpandoRange(lView, commentNodeIndex);
            const commentRNode = lView[commentNodeIndex] = _locateOrCreateNode(lView, commentNodeIndex, commentValue, Node.COMMENT_NODE);
            attachPatchData(commentRNode, lView);
          }
          break;
        case ELEMENT_MARKER:
          const tagName = mutableOpCodes[++i];
          const elementNodeIndex = mutableOpCodes[++i];
          if (lView[elementNodeIndex] === null) {
            ngDevMode && assertEqual(typeof tagName, "string", `Expected "${tagName}" to be an element node tag name`);
            ngDevMode && assertIndexInExpandoRange(lView, elementNodeIndex);
            const elementRNode = lView[elementNodeIndex] = _locateOrCreateNode(lView, elementNodeIndex, tagName, Node.ELEMENT_NODE);
            attachPatchData(elementRNode, lView);
          }
          break;
        default:
          ngDevMode && throwError2(`Unable to determine the type of mutate operation for "${opCode}"`);
      }
    }
  }
}
function applyUpdateOpCodes(tView, lView, updateOpCodes, bindingsStartIndex, changeMask2) {
  for (let i = 0; i < updateOpCodes.length; i++) {
    const checkBit = updateOpCodes[i];
    const skipCodes = updateOpCodes[++i];
    if (checkBit & changeMask2) {
      let value = "";
      for (let j = i + 1; j <= i + skipCodes; j++) {
        const opCode = updateOpCodes[j];
        if (typeof opCode == "string") {
          value += opCode;
        } else if (typeof opCode == "number") {
          if (opCode < 0) {
            value += renderStringify(lView[bindingsStartIndex - opCode]);
          } else {
            const nodeIndex = opCode >>> 2;
            switch (opCode & 3) {
              case 1:
                const propName = updateOpCodes[++j];
                const sanitizeFn = updateOpCodes[++j];
                const tNodeOrTagName = tView.data[nodeIndex];
                ngDevMode && assertDefined(tNodeOrTagName, "Experting TNode or string");
                if (typeof tNodeOrTagName === "string") {
                  setElementAttribute(lView[RENDERER], lView[nodeIndex], null, tNodeOrTagName, propName, value, sanitizeFn);
                } else {
                  setPropertyAndInputs(tNodeOrTagName, lView, propName, value, lView[RENDERER], sanitizeFn);
                }
                break;
              case 0:
                const rText = lView[nodeIndex];
                rText !== null && updateTextNode(lView[RENDERER], rText, value);
                break;
              case 2:
                applyIcuSwitchCase(tView, getTIcu(tView, nodeIndex), lView, value);
                break;
              case 3:
                applyIcuUpdateCase(tView, getTIcu(tView, nodeIndex), bindingsStartIndex, lView);
                break;
            }
          }
        }
      }
    } else {
      const opCode = updateOpCodes[i + 1];
      if (opCode > 0 && (opCode & 3) === 3) {
        const nodeIndex = opCode >>> 2;
        const tIcu = getTIcu(tView, nodeIndex);
        const currentIndex = lView[tIcu.currentCaseLViewIndex];
        if (currentIndex < 0) {
          applyIcuUpdateCase(tView, tIcu, bindingsStartIndex, lView);
        }
      }
    }
    i += skipCodes;
  }
}
function applyIcuUpdateCase(tView, tIcu, bindingsStartIndex, lView) {
  ngDevMode && assertIndexInRange(lView, tIcu.currentCaseLViewIndex);
  let activeCaseIndex = lView[tIcu.currentCaseLViewIndex];
  if (activeCaseIndex !== null) {
    let mask = changeMask;
    if (activeCaseIndex < 0) {
      activeCaseIndex = lView[tIcu.currentCaseLViewIndex] = ~activeCaseIndex;
      mask = -1;
    }
    applyUpdateOpCodes(tView, lView, tIcu.update[activeCaseIndex], bindingsStartIndex, mask);
  }
}
function applyIcuSwitchCase(tView, tIcu, lView, value) {
  const caseIndex = getCaseIndex(tIcu, value);
  let activeCaseIndex = getCurrentICUCaseIndex(tIcu, lView);
  if (activeCaseIndex !== caseIndex) {
    applyIcuSwitchCaseRemove(tView, tIcu, lView);
    lView[tIcu.currentCaseLViewIndex] = caseIndex === null ? null : ~caseIndex;
    if (caseIndex !== null) {
      const anchorRNode = lView[tIcu.anchorIdx];
      if (anchorRNode) {
        ngDevMode && assertDomNode(anchorRNode);
        applyMutableOpCodes(tView, tIcu.create[caseIndex], lView, anchorRNode);
      }
      claimDehydratedIcuCase(lView, tIcu.anchorIdx, caseIndex);
    }
  }
}
function applyIcuSwitchCaseRemove(tView, tIcu, lView) {
  let activeCaseIndex = getCurrentICUCaseIndex(tIcu, lView);
  if (activeCaseIndex !== null) {
    const removeCodes = tIcu.remove[activeCaseIndex];
    for (let i = 0; i < removeCodes.length; i++) {
      const nodeOrIcuIndex = removeCodes[i];
      if (nodeOrIcuIndex > 0) {
        const rNode = getNativeByIndex(nodeOrIcuIndex, lView);
        rNode !== null && nativeRemoveNode(lView[RENDERER], rNode);
      } else {
        applyIcuSwitchCaseRemove(tView, getTIcu(tView, ~nodeOrIcuIndex), lView);
      }
    }
  }
}
function getCaseIndex(icuExpression, bindingValue) {
  let index = icuExpression.cases.indexOf(bindingValue);
  if (index === -1) {
    switch (icuExpression.type) {
      case 1: {
        const resolvedCase = getPluralCase(bindingValue, getLocaleId());
        index = icuExpression.cases.indexOf(resolvedCase);
        if (index === -1 && resolvedCase !== "other") {
          index = icuExpression.cases.indexOf("other");
        }
        break;
      }
      case 0: {
        index = icuExpression.cases.indexOf("other");
        break;
      }
    }
  }
  return index === -1 ? null : index;
}
function i18nCreateOpCodesToString(opcodes) {
  const createOpCodes = opcodes || (Array.isArray(this) ? this : []);
  let lines = [];
  for (let i = 0; i < createOpCodes.length; i++) {
    const opCode = createOpCodes[i++];
    const text = createOpCodes[i];
    const isComment = (opCode & I18nCreateOpCode.COMMENT) === I18nCreateOpCode.COMMENT;
    const appendNow = (opCode & I18nCreateOpCode.APPEND_EAGERLY) === I18nCreateOpCode.APPEND_EAGERLY;
    const index = opCode >>> I18nCreateOpCode.SHIFT;
    lines.push(`lView[${index}] = document.${isComment ? "createComment" : "createText"}(${JSON.stringify(text)});`);
    if (appendNow) {
      lines.push(`parent.appendChild(lView[${index}]);`);
    }
  }
  return lines;
}
function i18nUpdateOpCodesToString(opcodes) {
  const parser = new OpCodeParser(opcodes || (Array.isArray(this) ? this : []));
  let lines = [];
  function consumeOpCode(value) {
    const ref = value >>> 2;
    const opCode = value & 3;
    switch (opCode) {
      case 0:
        return `(lView[${ref}] as Text).textContent = $$$`;
      case 1:
        const attrName = parser.consumeString();
        const sanitizationFn = parser.consumeFunction();
        const value2 = sanitizationFn ? `(${sanitizationFn})($$$)` : "$$$";
        return `(lView[${ref}] as Element).setAttribute('${attrName}', ${value2})`;
      case 2:
        return `icuSwitchCase(${ref}, $$$)`;
      case 3:
        return `icuUpdateCase(${ref})`;
    }
    throw new Error("unexpected OpCode");
  }
  while (parser.hasMore()) {
    let mask = parser.consumeNumber();
    let size = parser.consumeNumber();
    const end = parser.i + size;
    const statements = [];
    let statement = "";
    while (parser.i < end) {
      let value = parser.consumeNumberOrString();
      if (typeof value === "string") {
        statement += value;
      } else if (value < 0) {
        statement += "${lView[i" + value + "]}";
      } else {
        const opCodeText = consumeOpCode(value);
        statements.push(opCodeText.replace("$$$", "`" + statement + "`") + ";");
        statement = "";
      }
    }
    lines.push(`if (mask & 0b${mask.toString(2)}) { ${statements.join(" ")} }`);
  }
  return lines;
}
function icuCreateOpCodesToString(opcodes) {
  const parser = new OpCodeParser(opcodes || (Array.isArray(this) ? this : []));
  let lines = [];
  function consumeOpCode(opCode) {
    const parent = getParentFromIcuCreateOpCode(opCode);
    const ref = getRefFromIcuCreateOpCode(opCode);
    switch (getInstructionFromIcuCreateOpCode(opCode)) {
      case 0:
        return `(lView[${parent}] as Element).appendChild(lView[${lastRef}])`;
      case 1:
        return `(lView[${ref}] as Element).setAttribute("${parser.consumeString()}", "${parser.consumeString()}")`;
    }
    throw new Error("Unexpected OpCode: " + getInstructionFromIcuCreateOpCode(opCode));
  }
  let lastRef = -1;
  while (parser.hasMore()) {
    let value = parser.consumeNumberStringOrMarker();
    if (value === ICU_MARKER) {
      const text = parser.consumeString();
      lastRef = parser.consumeNumber();
      lines.push(`lView[${lastRef}] = document.createComment("${text}")`);
    } else if (value === ELEMENT_MARKER) {
      const text = parser.consumeString();
      lastRef = parser.consumeNumber();
      lines.push(`lView[${lastRef}] = document.createElement("${text}")`);
    } else if (typeof value === "string") {
      lastRef = parser.consumeNumber();
      lines.push(`lView[${lastRef}] = document.createTextNode("${value}")`);
    } else if (typeof value === "number") {
      const line = consumeOpCode(value);
      line && lines.push(line);
    } else {
      throw new Error("Unexpected value");
    }
  }
  return lines;
}
function i18nRemoveOpCodesToString(opcodes) {
  const removeCodes = opcodes || (Array.isArray(this) ? this : []);
  let lines = [];
  for (let i = 0; i < removeCodes.length; i++) {
    const nodeOrIcuIndex = removeCodes[i];
    if (nodeOrIcuIndex > 0) {
      lines.push(`remove(lView[${nodeOrIcuIndex}])`);
    } else {
      lines.push(`removeNestedICU(${~nodeOrIcuIndex})`);
    }
  }
  return lines;
}
var OpCodeParser = class {
  i = 0;
  codes;
  constructor(codes) {
    this.codes = codes;
  }
  hasMore() {
    return this.i < this.codes.length;
  }
  consumeNumber() {
    let value = this.codes[this.i++];
    assertNumber(value, "expecting number in OpCode");
    return value;
  }
  consumeString() {
    let value = this.codes[this.i++];
    assertString(value, "expecting string in OpCode");
    return value;
  }
  consumeFunction() {
    let value = this.codes[this.i++];
    if (value === null || typeof value === "function") {
      return value;
    }
    throw new Error("expecting function in OpCode");
  }
  consumeNumberOrString() {
    let value = this.codes[this.i++];
    if (typeof value === "string") {
      return value;
    }
    assertNumber(value, "expecting number or string in OpCode");
    return value;
  }
  consumeNumberStringOrMarker() {
    let value = this.codes[this.i++];
    if (typeof value === "string" || typeof value === "number" || value == ICU_MARKER || value == ELEMENT_MARKER) {
      return value;
    }
    assertNumber(value, "expecting number, string, ICU_MARKER or ELEMENT_MARKER in OpCode");
    return value;
  }
};
var BINDING_REGEXP = /�(\d+):?\d*�/gi;
var ICU_REGEXP = /({\s*�\d+:?\d*�\s*,\s*\S{6}\s*,[\s\S]*})/gi;
var NESTED_ICU = /�(\d+)�/;
var ICU_BLOCK_REGEXP = /^\s*(�\d+:?\d*�)\s*,\s*(select|plural)\s*,/;
var MARKER = `\uFFFD`;
var SUBTEMPLATE_REGEXP = /�\/?\*(\d+:\d+)�/gi;
var PH_REGEXP = /�(\/?[#*]\d+):?\d*�/gi;
var NGSP_UNICODE_REGEXP = /\uE500/g;
function replaceNgsp(value) {
  return value.replace(NGSP_UNICODE_REGEXP, " ");
}
function attachDebugGetter(obj, debugGetter) {
  if (ngDevMode) {
    Object.defineProperty(obj, "debug", { get: debugGetter, enumerable: false });
  } else {
    throw new Error("This method should be guarded with `ngDevMode` so that it can be tree shaken in production!");
  }
}
function i18nStartFirstCreatePass(tView, parentTNodeIndex, lView, index, message, subTemplateIndex) {
  const rootTNode = getCurrentParentTNode();
  const createOpCodes = [];
  const updateOpCodes = [];
  const existingTNodeStack = [[]];
  const astStack = [[]];
  if (ngDevMode) {
    attachDebugGetter(createOpCodes, i18nCreateOpCodesToString);
    attachDebugGetter(updateOpCodes, i18nUpdateOpCodesToString);
  }
  message = getTranslationForTemplate(message, subTemplateIndex);
  const msgParts = replaceNgsp(message).split(PH_REGEXP);
  for (let i = 0; i < msgParts.length; i++) {
    let value = msgParts[i];
    if ((i & 1) === 0) {
      const parts = i18nParseTextIntoPartsAndICU(value);
      for (let j = 0; j < parts.length; j++) {
        let part = parts[j];
        if ((j & 1) === 0) {
          const text = part;
          ngDevMode && assertString(text, "Parsed ICU part should be string");
          if (text !== "") {
            i18nStartFirstCreatePassProcessTextNode(astStack[0], tView, rootTNode, existingTNodeStack[0], createOpCodes, updateOpCodes, lView, text);
          }
        } else {
          const icuExpression = part;
          if (typeof icuExpression !== "object") {
            throw new Error(`Unable to parse ICU expression in "${message}" message.`);
          }
          const icuContainerTNode = createTNodeAndAddOpCode(tView, rootTNode, existingTNodeStack[0], lView, createOpCodes, ngDevMode ? `ICU ${index}:${icuExpression.mainBinding}` : "", true);
          const icuNodeIndex = icuContainerTNode.index;
          ngDevMode && assertGreaterThanOrEqual(icuNodeIndex, HEADER_OFFSET, "Index must be in absolute LView offset");
          icuStart(astStack[0], tView, lView, updateOpCodes, parentTNodeIndex, icuExpression, icuNodeIndex);
        }
      }
    } else {
      const isClosing = value.charCodeAt(0) === 47;
      const type = value.charCodeAt(isClosing ? 1 : 0);
      ngDevMode && assertOneOf(
        type,
        42,
        35
        /* CharCode.HASH */
      );
      const index2 = HEADER_OFFSET + Number.parseInt(value.substring(isClosing ? 2 : 1));
      if (isClosing) {
        existingTNodeStack.shift();
        astStack.shift();
        setCurrentTNode(getCurrentParentTNode(), false);
      } else {
        const tNode = createTNodePlaceholder(tView, existingTNodeStack[0], index2);
        existingTNodeStack.unshift([]);
        setCurrentTNode(tNode, true);
        const placeholderNode = {
          kind: 2,
          index: index2,
          children: [],
          type: type === 35 ? 0 : 1
        };
        astStack[0].push(placeholderNode);
        astStack.unshift(placeholderNode.children);
      }
    }
  }
  tView.data[index] = {
    create: createOpCodes,
    update: updateOpCodes,
    ast: astStack[0],
    parentTNodeIndex
  };
}
function createTNodeAndAddOpCode(tView, rootTNode, existingTNodes, lView, createOpCodes, text, isICU) {
  const i18nNodeIdx = allocExpando(tView, lView, 1, null);
  let opCode = i18nNodeIdx << I18nCreateOpCode.SHIFT;
  let parentTNode = getCurrentParentTNode();
  if (rootTNode === parentTNode) {
    parentTNode = null;
  }
  if (parentTNode === null) {
    opCode |= I18nCreateOpCode.APPEND_EAGERLY;
  }
  if (isICU) {
    opCode |= I18nCreateOpCode.COMMENT;
    ensureIcuContainerVisitorLoaded(loadIcuContainerVisitor);
  }
  createOpCodes.push(opCode, text === null ? "" : text);
  const tNode = createTNodeAtIndex(tView, i18nNodeIdx, isICU ? 32 : 1, text === null ? ngDevMode ? "{{?}}" : "" : text, null);
  addTNodeAndUpdateInsertBeforeIndex(existingTNodes, tNode);
  const tNodeIdx = tNode.index;
  setCurrentTNode(
    tNode,
    false
    /* Text nodes are self closing */
  );
  if (parentTNode !== null && rootTNode !== parentTNode) {
    setTNodeInsertBeforeIndex(parentTNode, tNodeIdx);
  }
  return tNode;
}
function i18nStartFirstCreatePassProcessTextNode(ast2, tView, rootTNode, existingTNodes, createOpCodes, updateOpCodes, lView, text) {
  const hasBinding = text.match(BINDING_REGEXP);
  const tNode = createTNodeAndAddOpCode(tView, rootTNode, existingTNodes, lView, createOpCodes, hasBinding ? null : text, false);
  const index = tNode.index;
  if (hasBinding) {
    generateBindingUpdateOpCodes(updateOpCodes, text, index, null, 0, null);
  }
  ast2.push({ kind: 0, index });
}
function i18nAttributesFirstPass(tView, index, values) {
  const previousElement = getCurrentTNode();
  const previousElementIndex = previousElement.index;
  const updateOpCodes = [];
  if (ngDevMode) {
    attachDebugGetter(updateOpCodes, i18nUpdateOpCodesToString);
  }
  if (tView.firstCreatePass && tView.data[index] === null) {
    for (let i = 0; i < values.length; i += 2) {
      const attrName = values[i];
      const message = values[i + 1];
      if (message !== "") {
        if (ICU_REGEXP.test(message)) {
          throw new Error(`ICU expressions are not supported in attributes. Message: "${message}".`);
        }
        generateBindingUpdateOpCodes(updateOpCodes, message, previousElementIndex, attrName, countBindings(updateOpCodes), null);
      }
    }
    tView.data[index] = updateOpCodes;
  }
}
function generateBindingUpdateOpCodes(updateOpCodes, str, destinationNode, attrName, bindingStart, sanitizeFn) {
  ngDevMode && assertGreaterThanOrEqual(destinationNode, HEADER_OFFSET, "Index must be in absolute LView offset");
  const maskIndex = updateOpCodes.length;
  const sizeIndex = maskIndex + 1;
  updateOpCodes.push(null, null);
  const startIndex = maskIndex + 2;
  if (ngDevMode) {
    attachDebugGetter(updateOpCodes, i18nUpdateOpCodesToString);
  }
  const textParts = str.split(BINDING_REGEXP);
  let mask = 0;
  for (let j = 0; j < textParts.length; j++) {
    const textValue = textParts[j];
    if (j & 1) {
      const bindingIndex = bindingStart + parseInt(textValue, 10);
      updateOpCodes.push(-1 - bindingIndex);
      mask = mask | toMaskBit(bindingIndex);
    } else if (textValue !== "") {
      updateOpCodes.push(textValue);
    }
  }
  updateOpCodes.push(destinationNode << 2 | (attrName ? 1 : 0));
  if (attrName) {
    updateOpCodes.push(attrName, sanitizeFn);
  }
  updateOpCodes[maskIndex] = mask;
  updateOpCodes[sizeIndex] = updateOpCodes.length - startIndex;
  return mask;
}
function countBindings(opCodes) {
  let count = 0;
  for (let i = 0; i < opCodes.length; i++) {
    const opCode = opCodes[i];
    if (typeof opCode === "number" && opCode < 0) {
      count++;
    }
  }
  return count;
}
function toMaskBit(bindingIndex) {
  return 1 << Math.min(bindingIndex, 31);
}
function removeInnerTemplateTranslation(message) {
  let match2;
  let res = "";
  let index = 0;
  let inTemplate = false;
  let tagMatched;
  while ((match2 = SUBTEMPLATE_REGEXP.exec(message)) !== null) {
    if (!inTemplate) {
      res += message.substring(index, match2.index + match2[0].length);
      tagMatched = match2[1];
      inTemplate = true;
    } else {
      if (match2[0] === `${MARKER}/*${tagMatched}${MARKER}`) {
        index = match2.index;
        inTemplate = false;
      }
    }
  }
  ngDevMode && assertEqual(inTemplate, false, `Tag mismatch: unable to find the end of the sub-template in the translation "${message}"`);
  res += message.slice(index);
  return res;
}
function getTranslationForTemplate(message, subTemplateIndex) {
  if (isRootTemplateMessage(subTemplateIndex)) {
    return removeInnerTemplateTranslation(message);
  } else {
    const start = message.indexOf(`:${subTemplateIndex}${MARKER}`) + 2 + subTemplateIndex.toString().length;
    const end = message.search(new RegExp(`${MARKER}\\/\\*\\d+:${subTemplateIndex}${MARKER}`));
    return removeInnerTemplateTranslation(message.substring(start, end));
  }
}
function icuStart(ast2, tView, lView, updateOpCodes, parentIdx, icuExpression, anchorIdx) {
  ngDevMode && assertDefined(icuExpression, "ICU expression must be defined");
  let bindingMask = 0;
  const tIcu = {
    type: icuExpression.type,
    currentCaseLViewIndex: allocExpando(tView, lView, 1, null),
    anchorIdx,
    cases: [],
    create: [],
    remove: [],
    update: []
  };
  addUpdateIcuSwitch(updateOpCodes, icuExpression, anchorIdx);
  setTIcu(tView, anchorIdx, tIcu);
  const values = icuExpression.values;
  const cases = [];
  for (let i = 0; i < values.length; i++) {
    const valueArr = values[i];
    const nestedIcus = [];
    for (let j = 0; j < valueArr.length; j++) {
      const value = valueArr[j];
      if (typeof value !== "string") {
        const icuIndex = nestedIcus.push(value) - 1;
        valueArr[j] = `<!--\uFFFD${icuIndex}\uFFFD-->`;
      }
    }
    const caseAst = [];
    cases.push(caseAst);
    bindingMask = parseIcuCase(caseAst, tView, tIcu, lView, updateOpCodes, parentIdx, icuExpression.cases[i], valueArr.join(""), nestedIcus) | bindingMask;
  }
  if (bindingMask) {
    addUpdateIcuUpdate(updateOpCodes, bindingMask, anchorIdx);
  }
  ast2.push({
    kind: 3,
    index: anchorIdx,
    cases,
    currentCaseLViewIndex: tIcu.currentCaseLViewIndex
  });
}
function parseICUBlock(pattern) {
  const cases = [];
  const values = [];
  let icuType = 1;
  let mainBinding = 0;
  pattern = pattern.replace(ICU_BLOCK_REGEXP, function(str, binding, type) {
    if (type === "select") {
      icuType = 0;
    } else {
      icuType = 1;
    }
    mainBinding = parseInt(binding.slice(1), 10);
    return "";
  });
  const parts = i18nParseTextIntoPartsAndICU(pattern);
  for (let pos = 0; pos < parts.length; ) {
    let key = parts[pos++].trim();
    if (icuType === 1) {
      key = key.replace(/\s*(?:=)?(\w+)\s*/, "$1");
    }
    if (key.length) {
      cases.push(key);
    }
    const blocks = i18nParseTextIntoPartsAndICU(parts[pos++]);
    if (cases.length > values.length) {
      values.push(blocks);
    }
  }
  return { type: icuType, mainBinding, cases, values };
}
function i18nParseTextIntoPartsAndICU(pattern) {
  if (!pattern) {
    return [];
  }
  let prevPos = 0;
  const braceStack = [];
  const results = [];
  const braces = /[{}]/g;
  braces.lastIndex = 0;
  let match2;
  while (match2 = braces.exec(pattern)) {
    const pos = match2.index;
    if (match2[0] == "}") {
      braceStack.pop();
      if (braceStack.length == 0) {
        const block = pattern.substring(prevPos, pos);
        if (ICU_BLOCK_REGEXP.test(block)) {
          results.push(parseICUBlock(block));
        } else {
          results.push(block);
        }
        prevPos = pos + 1;
      }
    } else {
      if (braceStack.length == 0) {
        const substring2 = pattern.substring(prevPos, pos);
        results.push(substring2);
        prevPos = pos + 1;
      }
      braceStack.push("{");
    }
  }
  const substring = pattern.substring(prevPos);
  results.push(substring);
  return results;
}
function parseIcuCase(ast2, tView, tIcu, lView, updateOpCodes, parentIdx, caseName, unsafeCaseHtml, nestedIcus) {
  const create = [];
  const remove2 = [];
  const update = [];
  if (ngDevMode) {
    attachDebugGetter(create, icuCreateOpCodesToString);
    attachDebugGetter(remove2, i18nRemoveOpCodesToString);
    attachDebugGetter(update, i18nUpdateOpCodesToString);
  }
  tIcu.cases.push(caseName);
  tIcu.create.push(create);
  tIcu.remove.push(remove2);
  tIcu.update.push(update);
  const inertBodyHelper2 = getInertBodyHelper(getDocument());
  const inertBodyElement = inertBodyHelper2.getInertBodyElement(unsafeCaseHtml);
  ngDevMode && assertDefined(inertBodyElement, "Unable to generate inert body element");
  const inertRootNode = getTemplateContent(inertBodyElement) || inertBodyElement;
  if (inertRootNode) {
    return walkIcuTree(ast2, tView, tIcu, lView, updateOpCodes, create, remove2, update, inertRootNode, parentIdx, nestedIcus, 0);
  } else {
    return 0;
  }
}
function walkIcuTree(ast2, tView, tIcu, lView, sharedUpdateOpCodes, create, remove2, update, parentNode, parentIdx, nestedIcus, depth) {
  let bindingMask = 0;
  let currentNode = parentNode.firstChild;
  while (currentNode) {
    const newIndex = allocExpando(tView, lView, 1, null);
    switch (currentNode.nodeType) {
      case Node.ELEMENT_NODE:
        const element = currentNode;
        const tagName = element.tagName.toLowerCase();
        if (VALID_ELEMENTS.hasOwnProperty(tagName)) {
          addCreateNodeAndAppend(create, ELEMENT_MARKER, tagName, parentIdx, newIndex);
          tView.data[newIndex] = tagName;
          const elAttrs = element.attributes;
          for (let i = 0; i < elAttrs.length; i++) {
            const attr = elAttrs.item(i);
            const lowerAttrName = attr.name.toLowerCase();
            const hasBinding2 = !!attr.value.match(BINDING_REGEXP);
            if (hasBinding2) {
              if (VALID_ATTRS.hasOwnProperty(lowerAttrName)) {
                if (URI_ATTRS[lowerAttrName]) {
                  generateBindingUpdateOpCodes(update, attr.value, newIndex, attr.name, 0, _sanitizeUrl);
                } else {
                  generateBindingUpdateOpCodes(update, attr.value, newIndex, attr.name, 0, null);
                }
              } else {
                ngDevMode && console.warn(`WARNING: ignoring unsafe attribute value ${lowerAttrName} on element ${tagName} (see ${XSS_SECURITY_URL})`);
              }
            } else {
              addCreateAttribute(create, newIndex, attr);
            }
          }
          const elementNode = {
            kind: 1,
            index: newIndex,
            children: []
          };
          ast2.push(elementNode);
          bindingMask = walkIcuTree(elementNode.children, tView, tIcu, lView, sharedUpdateOpCodes, create, remove2, update, currentNode, newIndex, nestedIcus, depth + 1) | bindingMask;
          addRemoveNode(remove2, newIndex, depth);
        }
        break;
      case Node.TEXT_NODE:
        const value = currentNode.textContent || "";
        const hasBinding = value.match(BINDING_REGEXP);
        addCreateNodeAndAppend(create, null, hasBinding ? "" : value, parentIdx, newIndex);
        addRemoveNode(remove2, newIndex, depth);
        if (hasBinding) {
          bindingMask = generateBindingUpdateOpCodes(update, value, newIndex, null, 0, null) | bindingMask;
        }
        ast2.push({
          kind: 0,
          index: newIndex
        });
        break;
      case Node.COMMENT_NODE:
        const isNestedIcu = NESTED_ICU.exec(currentNode.textContent || "");
        if (isNestedIcu) {
          const nestedIcuIndex = parseInt(isNestedIcu[1], 10);
          const icuExpression = nestedIcus[nestedIcuIndex];
          addCreateNodeAndAppend(create, ICU_MARKER, ngDevMode ? `nested ICU ${nestedIcuIndex}` : "", parentIdx, newIndex);
          icuStart(ast2, tView, lView, sharedUpdateOpCodes, parentIdx, icuExpression, newIndex);
          addRemoveNestedIcu(remove2, newIndex, depth);
        }
        break;
    }
    currentNode = currentNode.nextSibling;
  }
  return bindingMask;
}
function addRemoveNode(remove2, index, depth) {
  if (depth === 0) {
    remove2.push(index);
  }
}
function addRemoveNestedIcu(remove2, index, depth) {
  if (depth === 0) {
    remove2.push(~index);
    remove2.push(index);
  }
}
function addUpdateIcuSwitch(update, icuExpression, index) {
  update.push(
    toMaskBit(icuExpression.mainBinding),
    2,
    -1 - icuExpression.mainBinding,
    index << 2 | 2
    /* I18nUpdateOpCode.IcuSwitch */
  );
}
function addUpdateIcuUpdate(update, bindingMask, index) {
  update.push(
    bindingMask,
    1,
    index << 2 | 3
    /* I18nUpdateOpCode.IcuUpdate */
  );
}
function addCreateNodeAndAppend(create, marker, text, appendToParentIdx, createAtIdx) {
  if (marker !== null) {
    create.push(marker);
  }
  create.push(text, createAtIdx, icuCreateOpCode(0, appendToParentIdx, createAtIdx));
}
function addCreateAttribute(create, newIndex, attr) {
  create.push(newIndex << 1 | 1, attr.name, attr.value);
}
var ROOT_TEMPLATE_ID = 0;
var PP_MULTI_VALUE_PLACEHOLDERS_REGEXP = /\[(�.+?�?)\]/;
var PP_PLACEHOLDERS_REGEXP = /\[(�.+?�?)\]|(�\/?\*\d+:\d+�)/g;
var PP_ICU_VARS_REGEXP = /({\s*)(VAR_(PLURAL|SELECT)(_\d+)?)(\s*,)/g;
var PP_ICU_PLACEHOLDERS_REGEXP = /{([A-Z0-9_]+)}/g;
var PP_ICUS_REGEXP = /�I18N_EXP_(ICU(_\d+)?)�/g;
var PP_CLOSE_TEMPLATE_REGEXP = /\/\*/;
var PP_TEMPLATE_ID_REGEXP = /\d+\:(\d+)/;
function i18nPostprocess(message, replacements = {}) {
  let result = message;
  if (PP_MULTI_VALUE_PLACEHOLDERS_REGEXP.test(message)) {
    const matches = {};
    const templateIdsStack = [ROOT_TEMPLATE_ID];
    result = result.replace(PP_PLACEHOLDERS_REGEXP, (m, phs, tmpl) => {
      const content = phs || tmpl;
      const placeholders = matches[content] || [];
      if (!placeholders.length) {
        content.split("|").forEach((placeholder2) => {
          const match2 = placeholder2.match(PP_TEMPLATE_ID_REGEXP);
          const templateId2 = match2 ? parseInt(match2[1], 10) : ROOT_TEMPLATE_ID;
          const isCloseTemplateTag2 = PP_CLOSE_TEMPLATE_REGEXP.test(placeholder2);
          placeholders.push([templateId2, isCloseTemplateTag2, placeholder2]);
        });
        matches[content] = placeholders;
      }
      if (!placeholders.length) {
        throw new Error(`i18n postprocess: unmatched placeholder - ${content}`);
      }
      const currentTemplateId = templateIdsStack[templateIdsStack.length - 1];
      let idx = 0;
      for (let i = 0; i < placeholders.length; i++) {
        if (placeholders[i][0] === currentTemplateId) {
          idx = i;
          break;
        }
      }
      const [templateId, isCloseTemplateTag, placeholder] = placeholders[idx];
      if (isCloseTemplateTag) {
        templateIdsStack.pop();
      } else if (currentTemplateId !== templateId) {
        templateIdsStack.push(templateId);
      }
      placeholders.splice(idx, 1);
      return placeholder;
    });
  }
  if (!Object.keys(replacements).length) {
    return result;
  }
  result = result.replace(PP_ICU_VARS_REGEXP, (match2, start, key, _type, _idx, end) => {
    return replacements.hasOwnProperty(key) ? `${start}${replacements[key]}${end}` : match2;
  });
  result = result.replace(PP_ICU_PLACEHOLDERS_REGEXP, (match2, key) => {
    return replacements.hasOwnProperty(key) ? replacements[key] : match2;
  });
  result = result.replace(PP_ICUS_REGEXP, (match2, key) => {
    if (replacements.hasOwnProperty(key)) {
      const list = replacements[key];
      if (!list.length) {
        throw new Error(`i18n postprocess: unmatched ICU - ${match2} with key: ${key}`);
      }
      return list.shift();
    }
    return match2;
  });
  return result;
}
function \u0275\u0275i18nStart(index, messageIndex, subTemplateIndex = -1) {
  const tView = getTView();
  const lView = getLView();
  const adjustedIndex = HEADER_OFFSET + index;
  ngDevMode && assertDefined(tView, `tView should be defined`);
  const message = getConstant(tView.consts, messageIndex);
  const parentTNode = getCurrentParentTNode();
  if (tView.firstCreatePass) {
    i18nStartFirstCreatePass(tView, parentTNode === null ? 0 : parentTNode.index, lView, adjustedIndex, message, subTemplateIndex);
  }
  if (tView.type === 2) {
    const componentLView = lView[DECLARATION_COMPONENT_VIEW];
    componentLView[FLAGS] |= 32;
  } else {
    lView[FLAGS] |= 32;
  }
  const tI18n = tView.data[adjustedIndex];
  const sameViewParentTNode = parentTNode === lView[T_HOST] ? null : parentTNode;
  const parentRNode = getClosestRElement(tView, sameViewParentTNode, lView);
  const insertInFrontOf = parentTNode && parentTNode.type & 8 ? lView[parentTNode.index] : null;
  prepareI18nBlockForHydration(lView, adjustedIndex, parentTNode, subTemplateIndex);
  applyCreateOpCodes(lView, tI18n.create, parentRNode, insertInFrontOf);
  setInI18nBlock(true);
}
function \u0275\u0275i18nEnd() {
  setInI18nBlock(false);
}
function \u0275\u0275i18n(index, messageIndex, subTemplateIndex) {
  \u0275\u0275i18nStart(index, messageIndex, subTemplateIndex);
  \u0275\u0275i18nEnd();
}
function \u0275\u0275i18nAttributes(index, attrsIndex) {
  const tView = getTView();
  ngDevMode && assertDefined(tView, `tView should be defined`);
  const attrs = getConstant(tView.consts, attrsIndex);
  i18nAttributesFirstPass(tView, index + HEADER_OFFSET, attrs);
}
function \u0275\u0275i18nExp(value) {
  const lView = getLView();
  setMaskBit(bindingUpdated(lView, nextBindingIndex(), value));
  return \u0275\u0275i18nExp;
}
function \u0275\u0275i18nApply(index) {
  applyI18n(getTView(), getLView(), index + HEADER_OFFSET);
}
function \u0275\u0275i18nPostprocess(message, replacements = {}) {
  return i18nPostprocess(message, replacements);
}
function \u0275\u0275listener(eventName, listenerFn, eventTargetResolver) {
  const lView = getLView();
  const tView = getTView();
  const tNode = getCurrentTNode();
  listenerInternal(tView, lView, lView[RENDERER], tNode, eventName, listenerFn, eventTargetResolver);
  return \u0275\u0275listener;
}
function \u0275\u0275syntheticHostListener(eventName, listenerFn) {
  const tNode = getCurrentTNode();
  const lView = getLView();
  const tView = getTView();
  const currentDef = getCurrentDirectiveDef(tView.data);
  const renderer = loadComponentRenderer(currentDef, tNode, lView);
  listenerInternal(tView, lView, renderer, tNode, eventName, listenerFn);
  return \u0275\u0275syntheticHostListener;
}
function \u0275\u0275domListener(eventName, listenerFn, eventTargetResolver) {
  const lView = getLView();
  const tView = getTView();
  const tNode = getCurrentTNode();
  if (tNode.type & 3 || eventTargetResolver) {
    listenToDomEvent(tNode, tView, lView, eventTargetResolver, lView[RENDERER], eventName, listenerFn, wrapListener(tNode, lView, listenerFn));
  }
  return \u0275\u0275domListener;
}
function listenerInternal(tView, lView, renderer, tNode, eventName, listenerFn, eventTargetResolver) {
  ngDevMode && assertTNodeType(
    tNode,
    3 | 12
    /* TNodeType.AnyContainer */
  );
  let processOutputs = true;
  let wrappedListener = null;
  if (tNode.type & 3 || eventTargetResolver) {
    wrappedListener ??= wrapListener(tNode, lView, listenerFn);
    const hasCoalescedDomEvent = listenToDomEvent(tNode, tView, lView, eventTargetResolver, renderer, eventName, listenerFn, wrappedListener);
    if (hasCoalescedDomEvent) {
      processOutputs = false;
    }
  }
  if (processOutputs) {
    const outputConfig = tNode.outputs?.[eventName];
    const hostDirectiveOutputConfig = tNode.hostDirectiveOutputs?.[eventName];
    if (hostDirectiveOutputConfig && hostDirectiveOutputConfig.length) {
      for (let i = 0; i < hostDirectiveOutputConfig.length; i += 2) {
        const index = hostDirectiveOutputConfig[i];
        const lookupName = hostDirectiveOutputConfig[i + 1];
        wrappedListener ??= wrapListener(tNode, lView, listenerFn);
        listenToOutput(tNode, lView, index, lookupName, eventName, wrappedListener);
      }
    }
    if (outputConfig && outputConfig.length) {
      for (const index of outputConfig) {
        wrappedListener ??= wrapListener(tNode, lView, listenerFn);
        listenToOutput(tNode, lView, index, eventName, eventName, wrappedListener);
      }
    }
  }
}
function \u0275\u0275nextContext(level = 1) {
  return nextContextImpl(level);
}
function matchingProjectionSlotIndex(tNode, projectionSlots) {
  let wildcardNgContentIndex = null;
  const ngProjectAsAttrVal = getProjectAsAttrValue(tNode);
  for (let i = 0; i < projectionSlots.length; i++) {
    const slotValue = projectionSlots[i];
    if (slotValue === "*") {
      wildcardNgContentIndex = i;
      continue;
    }
    if (ngProjectAsAttrVal === null ? isNodeMatchingSelectorList(
      tNode,
      slotValue,
      /* isProjectionMode */
      true
    ) : isSelectorInSelectorList(ngProjectAsAttrVal, slotValue)) {
      return i;
    }
  }
  return wildcardNgContentIndex;
}
function \u0275\u0275projectionDef(projectionSlots) {
  const componentNode = getLView()[DECLARATION_COMPONENT_VIEW][T_HOST];
  if (!componentNode.projection) {
    const numProjectionSlots = projectionSlots ? projectionSlots.length : 1;
    const projectionHeads = componentNode.projection = newArray(numProjectionSlots, null);
    const tails = projectionHeads.slice();
    let componentChild = componentNode.child;
    while (componentChild !== null) {
      if (componentChild.type !== 128) {
        const slotIndex = projectionSlots ? matchingProjectionSlotIndex(componentChild, projectionSlots) : 0;
        if (slotIndex !== null) {
          if (tails[slotIndex]) {
            tails[slotIndex].projectionNext = componentChild;
          } else {
            projectionHeads[slotIndex] = componentChild;
          }
          tails[slotIndex] = componentChild;
        }
      }
      componentChild = componentChild.next;
    }
  }
}
function \u0275\u0275projection(nodeIndex, selectorIndex = 0, attrs, fallbackTemplateFn, fallbackDecls, fallbackVars) {
  const lView = getLView();
  const tView = getTView();
  const fallbackIndex = fallbackTemplateFn ? nodeIndex + 1 : null;
  if (fallbackIndex !== null) {
    declareNoDirectiveHostTemplate(lView, tView, fallbackIndex, fallbackTemplateFn, fallbackDecls, fallbackVars, null, attrs);
  }
  const tProjectionNode = getOrCreateTNode(tView, HEADER_OFFSET + nodeIndex, 16, null, attrs || null);
  if (tProjectionNode.projection === null) {
    tProjectionNode.projection = selectorIndex;
  }
  setCurrentTNodeAsNotParent();
  const hydrationInfo = lView[HYDRATION];
  const isNodeCreationMode = !hydrationInfo || isInSkipHydrationBlock();
  const componentHostNode = lView[DECLARATION_COMPONENT_VIEW][T_HOST];
  const isEmpty = componentHostNode.projection[tProjectionNode.projection] === null;
  if (isEmpty && fallbackIndex !== null) {
    insertFallbackContent(lView, tView, fallbackIndex);
  } else if (isNodeCreationMode && !isDetachedByI18n(tProjectionNode)) {
    applyProjection(tView, lView, tProjectionNode);
  }
}
function insertFallbackContent(lView, tView, fallbackIndex) {
  const adjustedIndex = HEADER_OFFSET + fallbackIndex;
  const fallbackTNode = tView.data[adjustedIndex];
  const fallbackLContainer = lView[adjustedIndex];
  ngDevMode && assertTNode(fallbackTNode);
  ngDevMode && assertLContainer(fallbackLContainer);
  const dehydratedView = findMatchingDehydratedView(fallbackLContainer, fallbackTNode.tView.ssrId);
  const fallbackLView = createAndRenderEmbeddedLView(lView, fallbackTNode, void 0, {
    dehydratedView
  });
  addLViewToLContainer(fallbackLContainer, fallbackLView, 0, shouldAddViewToDom(fallbackTNode, dehydratedView));
}
function \u0275\u0275contentQuery(directiveIndex, predicate, flags, read) {
  createContentQuery(directiveIndex, predicate, flags, read);
}
function \u0275\u0275viewQuery(predicate, flags, read) {
  createViewQuery(predicate, flags, read);
}
function \u0275\u0275queryRefresh(queryList) {
  const lView = getLView();
  const tView = getTView();
  const queryIndex = getCurrentQueryIndex();
  setCurrentQueryIndex(queryIndex + 1);
  const tQuery = getTQuery(tView, queryIndex);
  if (queryList.dirty && isCreationMode(lView) === ((tQuery.metadata.flags & 2) === 2)) {
    if (tQuery.matches === null) {
      queryList.reset([]);
    } else {
      const result = getQueryResults(lView, queryIndex);
      queryList.reset(result, unwrapElementRef);
      queryList.notifyOnChanges();
    }
    return true;
  }
  return false;
}
function \u0275\u0275loadQuery() {
  return loadQueryInternal(getLView(), getCurrentQueryIndex());
}
function \u0275\u0275contentQuerySignal(directiveIndex, target, predicate, flags, read) {
  bindQueryToSignal(target, createContentQuery(directiveIndex, predicate, flags, read));
}
function \u0275\u0275viewQuerySignal(target, predicate, flags, read) {
  bindQueryToSignal(target, createViewQuery(predicate, flags, read));
}
function \u0275\u0275queryAdvance(indexOffset = 1) {
  setCurrentQueryIndex(getCurrentQueryIndex() + indexOffset);
}
function \u0275\u0275reference(index) {
  const contextLView = getContextLView();
  return load(contextLView, HEADER_OFFSET + index);
}
function toTStylingRange(prev, next) {
  ngDevMode && assertNumberInRange(
    prev,
    0,
    32767
    /* StylingRange.UNSIGNED_MASK */
  );
  ngDevMode && assertNumberInRange(
    next,
    0,
    32767
    /* StylingRange.UNSIGNED_MASK */
  );
  return prev << 17 | next << 2;
}
function getTStylingRangePrev(tStylingRange) {
  ngDevMode && assertNumber(tStylingRange, "expected number");
  return tStylingRange >> 17 & 32767;
}
function getTStylingRangePrevDuplicate(tStylingRange) {
  ngDevMode && assertNumber(tStylingRange, "expected number");
  return (tStylingRange & 2) == 2;
}
function setTStylingRangePrev(tStylingRange, previous) {
  ngDevMode && assertNumber(tStylingRange, "expected number");
  ngDevMode && assertNumberInRange(
    previous,
    0,
    32767
    /* StylingRange.UNSIGNED_MASK */
  );
  return tStylingRange & ~4294836224 | previous << 17;
}
function setTStylingRangePrevDuplicate(tStylingRange) {
  ngDevMode && assertNumber(tStylingRange, "expected number");
  return tStylingRange | 2;
}
function getTStylingRangeNext(tStylingRange) {
  ngDevMode && assertNumber(tStylingRange, "expected number");
  return (tStylingRange & 131068) >> 2;
}
function setTStylingRangeNext(tStylingRange, next) {
  ngDevMode && assertNumber(tStylingRange, "expected number");
  ngDevMode && assertNumberInRange(
    next,
    0,
    32767
    /* StylingRange.UNSIGNED_MASK */
  );
  return tStylingRange & ~131068 | //
  next << 2;
}
function getTStylingRangeNextDuplicate(tStylingRange) {
  ngDevMode && assertNumber(tStylingRange, "expected number");
  return (tStylingRange & 1) === 1;
}
function setTStylingRangeNextDuplicate(tStylingRange) {
  ngDevMode && assertNumber(tStylingRange, "expected number");
  return tStylingRange | 1;
}
function insertTStylingBinding(tData, tNode, tStylingKeyWithStatic, index, isHostBinding, isClassBinding) {
  ngDevMode && assertFirstUpdatePass(getTView());
  let tBindings = isClassBinding ? tNode.classBindings : tNode.styleBindings;
  let tmplHead = getTStylingRangePrev(tBindings);
  let tmplTail = getTStylingRangeNext(tBindings);
  tData[index] = tStylingKeyWithStatic;
  let isKeyDuplicateOfStatic = false;
  let tStylingKey;
  if (Array.isArray(tStylingKeyWithStatic)) {
    const staticKeyValueArray = tStylingKeyWithStatic;
    tStylingKey = staticKeyValueArray[1];
    if (tStylingKey === null || keyValueArrayIndexOf(staticKeyValueArray, tStylingKey) > 0) {
      isKeyDuplicateOfStatic = true;
    }
  } else {
    tStylingKey = tStylingKeyWithStatic;
  }
  if (isHostBinding) {
    const hasTemplateBindings = tmplTail !== 0;
    if (hasTemplateBindings) {
      const previousNode = getTStylingRangePrev(tData[tmplHead + 1]);
      tData[index + 1] = toTStylingRange(previousNode, tmplHead);
      if (previousNode !== 0) {
        tData[previousNode + 1] = setTStylingRangeNext(tData[previousNode + 1], index);
      }
      tData[tmplHead + 1] = setTStylingRangePrev(tData[tmplHead + 1], index);
    } else {
      tData[index + 1] = toTStylingRange(tmplHead, 0);
      if (tmplHead !== 0) {
        tData[tmplHead + 1] = setTStylingRangeNext(tData[tmplHead + 1], index);
      }
      tmplHead = index;
    }
  } else {
    tData[index + 1] = toTStylingRange(tmplTail, 0);
    ngDevMode && assertEqual(tmplHead !== 0 && tmplTail === 0, false, "Adding template bindings after hostBindings is not allowed.");
    if (tmplHead === 0) {
      tmplHead = index;
    } else {
      tData[tmplTail + 1] = setTStylingRangeNext(tData[tmplTail + 1], index);
    }
    tmplTail = index;
  }
  if (isKeyDuplicateOfStatic) {
    tData[index + 1] = setTStylingRangePrevDuplicate(tData[index + 1]);
  }
  markDuplicates(tData, tStylingKey, index, true);
  markDuplicates(tData, tStylingKey, index, false);
  markDuplicateOfResidualStyling(tNode, tStylingKey, tData, index, isClassBinding);
  tBindings = toTStylingRange(tmplHead, tmplTail);
  if (isClassBinding) {
    tNode.classBindings = tBindings;
  } else {
    tNode.styleBindings = tBindings;
  }
}
function markDuplicateOfResidualStyling(tNode, tStylingKey, tData, index, isClassBinding) {
  const residual = isClassBinding ? tNode.residualClasses : tNode.residualStyles;
  if (residual != null && typeof tStylingKey == "string" && keyValueArrayIndexOf(residual, tStylingKey) >= 0) {
    tData[index + 1] = setTStylingRangeNextDuplicate(tData[index + 1]);
  }
}
function markDuplicates(tData, tStylingKey, index, isPrevDir) {
  const tStylingAtIndex = tData[index + 1];
  const isMap2 = tStylingKey === null;
  let cursor = isPrevDir ? getTStylingRangePrev(tStylingAtIndex) : getTStylingRangeNext(tStylingAtIndex);
  let foundDuplicate = false;
  while (cursor !== 0 && (foundDuplicate === false || isMap2)) {
    ngDevMode && assertIndexInRange(tData, cursor);
    const tStylingValueAtCursor = tData[cursor];
    const tStyleRangeAtCursor = tData[cursor + 1];
    if (isStylingMatch(tStylingValueAtCursor, tStylingKey)) {
      foundDuplicate = true;
      tData[cursor + 1] = isPrevDir ? setTStylingRangeNextDuplicate(tStyleRangeAtCursor) : setTStylingRangePrevDuplicate(tStyleRangeAtCursor);
    }
    cursor = isPrevDir ? getTStylingRangePrev(tStyleRangeAtCursor) : getTStylingRangeNext(tStyleRangeAtCursor);
  }
  if (foundDuplicate) {
    tData[index + 1] = isPrevDir ? setTStylingRangePrevDuplicate(tStylingAtIndex) : setTStylingRangeNextDuplicate(tStylingAtIndex);
  }
}
function isStylingMatch(tStylingKeyCursor, tStylingKey) {
  ngDevMode && assertNotEqual(Array.isArray(tStylingKey), true, "Expected that 'tStylingKey' has been unwrapped");
  if (tStylingKeyCursor === null || // If the cursor is `null` it means that we have map at that
  // location so we must assume that we have a match.
  tStylingKey == null || // If `tStylingKey` is `null` then it is a map therefor assume that it
  // contains a match.
  (Array.isArray(tStylingKeyCursor) ? tStylingKeyCursor[1] : tStylingKeyCursor) === tStylingKey) {
    return true;
  } else if (Array.isArray(tStylingKeyCursor) && typeof tStylingKey === "string") {
    return keyValueArrayIndexOf(tStylingKeyCursor, tStylingKey) >= 0;
  }
  return false;
}
var parserState = {
  textEnd: 0,
  key: 0,
  keyEnd: 0,
  value: 0,
  valueEnd: 0
};
function getLastParsedKey(text) {
  return text.substring(parserState.key, parserState.keyEnd);
}
function getLastParsedValue(text) {
  return text.substring(parserState.value, parserState.valueEnd);
}
function parseClassName(text) {
  resetParserState(text);
  return parseClassNameNext(text, consumeWhitespace(text, 0, parserState.textEnd));
}
function parseClassNameNext(text, index) {
  const end = parserState.textEnd;
  if (end === index) {
    return -1;
  }
  index = parserState.keyEnd = consumeClassToken(text, parserState.key = index, end);
  return consumeWhitespace(text, index, end);
}
function parseStyle(text) {
  resetParserState(text);
  return parseStyleNext(text, consumeWhitespace(text, 0, parserState.textEnd));
}
function parseStyleNext(text, startIndex) {
  const end = parserState.textEnd;
  let index = parserState.key = consumeWhitespace(text, startIndex, end);
  if (end === index) {
    return -1;
  }
  index = parserState.keyEnd = consumeStyleKey(text, index, end);
  index = consumeSeparator(
    text,
    index,
    end,
    58
    /* CharCode.COLON */
  );
  index = parserState.value = consumeWhitespace(text, index, end);
  index = parserState.valueEnd = consumeStyleValue(text, index, end);
  return consumeSeparator(
    text,
    index,
    end,
    59
    /* CharCode.SEMI_COLON */
  );
}
function resetParserState(text) {
  parserState.key = 0;
  parserState.keyEnd = 0;
  parserState.value = 0;
  parserState.valueEnd = 0;
  parserState.textEnd = text.length;
}
function consumeWhitespace(text, startIndex, endIndex) {
  while (startIndex < endIndex && text.charCodeAt(startIndex) <= 32) {
    startIndex++;
  }
  return startIndex;
}
function consumeClassToken(text, startIndex, endIndex) {
  while (startIndex < endIndex && text.charCodeAt(startIndex) > 32) {
    startIndex++;
  }
  return startIndex;
}
function consumeStyleKey(text, startIndex, endIndex) {
  let ch;
  while (startIndex < endIndex && ((ch = text.charCodeAt(startIndex)) === 45 || ch === 95 || (ch & -33) >= 65 && (ch & -33) <= 90 || ch >= 48 && ch <= 57)) {
    startIndex++;
  }
  return startIndex;
}
function consumeSeparator(text, startIndex, endIndex, separator) {
  startIndex = consumeWhitespace(text, startIndex, endIndex);
  if (startIndex < endIndex) {
    if (ngDevMode && text.charCodeAt(startIndex) !== separator) {
      malformedStyleError(text, String.fromCharCode(separator), startIndex);
    }
    startIndex++;
  }
  return startIndex;
}
function consumeStyleValue(text, startIndex, endIndex) {
  let ch1 = -1;
  let ch2 = -1;
  let ch3 = -1;
  let i = startIndex;
  let lastChIndex = i;
  while (i < endIndex) {
    const ch = text.charCodeAt(i++);
    if (ch === 59) {
      return lastChIndex;
    } else if (ch === 34 || ch === 39) {
      lastChIndex = i = consumeQuotedText(text, ch, i, endIndex);
    } else if (startIndex === i - 4 && // We have seen only 4 characters so far "URL(" (Ignore "foo_URL()")
    ch3 === 85 && ch2 === 82 && ch1 === 76 && ch === 40) {
      lastChIndex = i = consumeQuotedText(text, 41, i, endIndex);
    } else if (ch > 32) {
      lastChIndex = i;
    }
    ch3 = ch2;
    ch2 = ch1;
    ch1 = ch & -33;
  }
  return lastChIndex;
}
function consumeQuotedText(text, quoteCharCode, startIndex, endIndex) {
  let ch1 = -1;
  let index = startIndex;
  while (index < endIndex) {
    const ch = text.charCodeAt(index++);
    if (ch == quoteCharCode && ch1 !== 92) {
      return index;
    }
    if (ch == 92 && ch1 === 92) {
      ch1 = 0;
    } else {
      ch1 = ch;
    }
  }
  throw ngDevMode ? malformedStyleError(text, String.fromCharCode(quoteCharCode), endIndex) : new Error();
}
function malformedStyleError(text, expecting, index) {
  ngDevMode && assertEqual(typeof text === "string", true, "String expected here");
  throw throwError2(`Malformed style at location ${index} in string '` + text.substring(0, index) + "[>>" + text.substring(index, index + 1) + "<<]" + text.slice(index + 1) + `'. Expecting '${expecting}'.`);
}
function \u0275\u0275styleProp(prop, value, suffix) {
  checkStylingProperty(prop, value, suffix, false);
  return \u0275\u0275styleProp;
}
function \u0275\u0275classProp(className, value) {
  checkStylingProperty(className, value, null, true);
  return \u0275\u0275classProp;
}
function \u0275\u0275styleMap(styles) {
  checkStylingMap(styleKeyValueArraySet, styleStringParser, styles, false);
}
function styleStringParser(keyValueArray, text) {
  for (let i = parseStyle(text); i >= 0; i = parseStyleNext(text, i)) {
    styleKeyValueArraySet(keyValueArray, getLastParsedKey(text), getLastParsedValue(text));
  }
}
function \u0275\u0275classMap(classes) {
  checkStylingMap(classKeyValueArraySet, classStringParser, classes, true);
}
function classStringParser(keyValueArray, text) {
  for (let i = parseClassName(text); i >= 0; i = parseClassNameNext(text, i)) {
    keyValueArraySet(keyValueArray, getLastParsedKey(text), true);
  }
}
function checkStylingProperty(prop, value, suffix, isClassBased) {
  const lView = getLView();
  const tView = getTView();
  const bindingIndex = incrementBindingIndex(2);
  if (tView.firstUpdatePass) {
    stylingFirstUpdatePass(tView, prop, bindingIndex, isClassBased);
  }
  if (value !== NO_CHANGE && bindingUpdated(lView, bindingIndex, value)) {
    const tNode = tView.data[getSelectedIndex()];
    updateStyling(tView, tNode, lView, lView[RENDERER], prop, lView[bindingIndex + 1] = normalizeSuffix(value, suffix), isClassBased, bindingIndex);
  }
}
function checkStylingMap(keyValueArraySet2, stringParser, value, isClassBased) {
  const tView = getTView();
  const bindingIndex = incrementBindingIndex(2);
  if (tView.firstUpdatePass) {
    stylingFirstUpdatePass(tView, null, bindingIndex, isClassBased);
  }
  const lView = getLView();
  if (value !== NO_CHANGE && bindingUpdated(lView, bindingIndex, value)) {
    const tNode = tView.data[getSelectedIndex()];
    if (hasStylingInputShadow(tNode, isClassBased) && !isInHostBindings(tView, bindingIndex)) {
      if (ngDevMode) {
        const tStylingKey = tView.data[bindingIndex];
        assertEqual(Array.isArray(tStylingKey) ? tStylingKey[1] : tStylingKey, false, "Styling linked list shadow input should be marked as 'false'");
      }
      let staticPrefix = isClassBased ? tNode.classesWithoutHost : tNode.stylesWithoutHost;
      ngDevMode && isClassBased === false && staticPrefix !== null && assertEqual(staticPrefix.endsWith(";"), true, "Expecting static portion to end with ';'");
      if (staticPrefix !== null) {
        value = concatStringsWithSpace(staticPrefix, value ? value : "");
      }
      setDirectiveInputsWhichShadowsStyling(tView, tNode, lView, value, isClassBased);
    } else {
      updateStylingMap(tView, tNode, lView, lView[RENDERER], lView[bindingIndex + 1], lView[bindingIndex + 1] = toStylingKeyValueArray(keyValueArraySet2, stringParser, value), isClassBased, bindingIndex);
    }
  }
}
function isInHostBindings(tView, bindingIndex) {
  return bindingIndex >= tView.expandoStartIndex;
}
function stylingFirstUpdatePass(tView, tStylingKey, bindingIndex, isClassBased) {
  ngDevMode && assertFirstUpdatePass(tView);
  const tData = tView.data;
  if (tData[bindingIndex + 1] === null) {
    const tNode = tData[getSelectedIndex()];
    ngDevMode && assertDefined(tNode, "TNode expected");
    const isHostBindings = isInHostBindings(tView, bindingIndex);
    if (hasStylingInputShadow(tNode, isClassBased) && tStylingKey === null && !isHostBindings) {
      tStylingKey = false;
    }
    tStylingKey = wrapInStaticStylingKey(tData, tNode, tStylingKey, isClassBased);
    insertTStylingBinding(tData, tNode, tStylingKey, bindingIndex, isHostBindings, isClassBased);
  }
}
function wrapInStaticStylingKey(tData, tNode, stylingKey, isClassBased) {
  const hostDirectiveDef = getCurrentDirectiveDef(tData);
  let residual = isClassBased ? tNode.residualClasses : tNode.residualStyles;
  if (hostDirectiveDef === null) {
    const isFirstStylingInstructionInTemplate = (isClassBased ? tNode.classBindings : tNode.styleBindings) === 0;
    if (isFirstStylingInstructionInTemplate) {
      stylingKey = collectStylingFromDirectives(null, tData, tNode, stylingKey, isClassBased);
      stylingKey = collectStylingFromTAttrs(stylingKey, tNode.attrs, isClassBased);
      residual = null;
    }
  } else {
    const directiveStylingLast = tNode.directiveStylingLast;
    const isFirstStylingInstructionInHostBinding = directiveStylingLast === -1 || tData[directiveStylingLast] !== hostDirectiveDef;
    if (isFirstStylingInstructionInHostBinding) {
      stylingKey = collectStylingFromDirectives(hostDirectiveDef, tData, tNode, stylingKey, isClassBased);
      if (residual === null) {
        let templateStylingKey = getTemplateHeadTStylingKey(tData, tNode, isClassBased);
        if (templateStylingKey !== void 0 && Array.isArray(templateStylingKey)) {
          templateStylingKey = collectStylingFromDirectives(null, tData, tNode, templateStylingKey[1], isClassBased);
          templateStylingKey = collectStylingFromTAttrs(templateStylingKey, tNode.attrs, isClassBased);
          setTemplateHeadTStylingKey(tData, tNode, isClassBased, templateStylingKey);
        }
      } else {
        residual = collectResidual(tData, tNode, isClassBased);
      }
    }
  }
  if (residual !== void 0) {
    isClassBased ? tNode.residualClasses = residual : tNode.residualStyles = residual;
  }
  return stylingKey;
}
function getTemplateHeadTStylingKey(tData, tNode, isClassBased) {
  const bindings = isClassBased ? tNode.classBindings : tNode.styleBindings;
  if (getTStylingRangeNext(bindings) === 0) {
    return void 0;
  }
  return tData[getTStylingRangePrev(bindings)];
}
function setTemplateHeadTStylingKey(tData, tNode, isClassBased, tStylingKey) {
  const bindings = isClassBased ? tNode.classBindings : tNode.styleBindings;
  ngDevMode && assertNotEqual(getTStylingRangeNext(bindings), 0, "Expecting to have at least one template styling binding.");
  tData[getTStylingRangePrev(bindings)] = tStylingKey;
}
function collectResidual(tData, tNode, isClassBased) {
  let residual = void 0;
  const directiveEnd = tNode.directiveEnd;
  ngDevMode && assertNotEqual(tNode.directiveStylingLast, -1, "By the time this function gets called at least one hostBindings-node styling instruction must have executed.");
  for (let i = 1 + tNode.directiveStylingLast; i < directiveEnd; i++) {
    const attrs = tData[i].hostAttrs;
    residual = collectStylingFromTAttrs(residual, attrs, isClassBased);
  }
  return collectStylingFromTAttrs(residual, tNode.attrs, isClassBased);
}
function collectStylingFromDirectives(hostDirectiveDef, tData, tNode, stylingKey, isClassBased) {
  let currentDirective = null;
  const directiveEnd = tNode.directiveEnd;
  let directiveStylingLast = tNode.directiveStylingLast;
  if (directiveStylingLast === -1) {
    directiveStylingLast = tNode.directiveStart;
  } else {
    directiveStylingLast++;
  }
  while (directiveStylingLast < directiveEnd) {
    currentDirective = tData[directiveStylingLast];
    ngDevMode && assertDefined(currentDirective, "expected to be defined");
    stylingKey = collectStylingFromTAttrs(stylingKey, currentDirective.hostAttrs, isClassBased);
    if (currentDirective === hostDirectiveDef)
      break;
    directiveStylingLast++;
  }
  if (hostDirectiveDef !== null) {
    tNode.directiveStylingLast = directiveStylingLast;
  }
  return stylingKey;
}
function collectStylingFromTAttrs(stylingKey, attrs, isClassBased) {
  const desiredMarker = isClassBased ? 1 : 2;
  let currentMarker = -1;
  if (attrs !== null) {
    for (let i = 0; i < attrs.length; i++) {
      const item = attrs[i];
      if (typeof item === "number") {
        currentMarker = item;
      } else {
        if (currentMarker === desiredMarker) {
          if (!Array.isArray(stylingKey)) {
            stylingKey = stylingKey === void 0 ? [] : ["", stylingKey];
          }
          keyValueArraySet(stylingKey, item, isClassBased ? true : attrs[++i]);
        }
      }
    }
  }
  return stylingKey === void 0 ? null : stylingKey;
}
function toStylingKeyValueArray(keyValueArraySet2, stringParser, value) {
  if (value == null || value === "")
    return EMPTY_ARRAY;
  const styleKeyValueArray = [];
  const unwrappedValue = unwrapSafeValue(value);
  if (Array.isArray(unwrappedValue)) {
    for (let i = 0; i < unwrappedValue.length; i++) {
      keyValueArraySet2(styleKeyValueArray, unwrappedValue[i], true);
    }
  } else if (typeof unwrappedValue === "object") {
    for (const key in unwrappedValue) {
      if (unwrappedValue.hasOwnProperty(key)) {
        keyValueArraySet2(styleKeyValueArray, key, unwrappedValue[key]);
      }
    }
  } else if (typeof unwrappedValue === "string") {
    stringParser(styleKeyValueArray, unwrappedValue);
  } else {
    ngDevMode && throwError2("Unsupported styling type: " + typeof unwrappedValue + " (" + unwrappedValue + ")");
  }
  return styleKeyValueArray;
}
function styleKeyValueArraySet(keyValueArray, key, value) {
  keyValueArraySet(keyValueArray, key, unwrapSafeValue(value));
}
function classKeyValueArraySet(keyValueArray, key, value) {
  const stringKey = String(key);
  if (stringKey !== "" && !stringKey.includes(" ")) {
    keyValueArraySet(keyValueArray, stringKey, value);
  }
}
function updateStylingMap(tView, tNode, lView, renderer, oldKeyValueArray, newKeyValueArray, isClassBased, bindingIndex) {
  if (oldKeyValueArray === NO_CHANGE) {
    oldKeyValueArray = EMPTY_ARRAY;
  }
  let oldIndex = 0;
  let newIndex = 0;
  let oldKey = 0 < oldKeyValueArray.length ? oldKeyValueArray[0] : null;
  let newKey = 0 < newKeyValueArray.length ? newKeyValueArray[0] : null;
  while (oldKey !== null || newKey !== null) {
    ngDevMode && assertLessThan(oldIndex, 999, "Are we stuck in infinite loop?");
    ngDevMode && assertLessThan(newIndex, 999, "Are we stuck in infinite loop?");
    const oldValue = oldIndex < oldKeyValueArray.length ? oldKeyValueArray[oldIndex + 1] : void 0;
    const newValue = newIndex < newKeyValueArray.length ? newKeyValueArray[newIndex + 1] : void 0;
    let setKey = null;
    let setValue = void 0;
    if (oldKey === newKey) {
      oldIndex += 2;
      newIndex += 2;
      if (oldValue !== newValue) {
        setKey = newKey;
        setValue = newValue;
      }
    } else if (newKey === null || oldKey !== null && oldKey < newKey) {
      oldIndex += 2;
      setKey = oldKey;
    } else {
      ngDevMode && assertDefined(newKey, "Expecting to have a valid key");
      newIndex += 2;
      setKey = newKey;
      setValue = newValue;
    }
    if (setKey !== null) {
      updateStyling(tView, tNode, lView, renderer, setKey, setValue, isClassBased, bindingIndex);
    }
    oldKey = oldIndex < oldKeyValueArray.length ? oldKeyValueArray[oldIndex] : null;
    newKey = newIndex < newKeyValueArray.length ? newKeyValueArray[newIndex] : null;
  }
}
function updateStyling(tView, tNode, lView, renderer, prop, value, isClassBased, bindingIndex) {
  if (!(tNode.type & 3)) {
    return;
  }
  const tData = tView.data;
  const tRange = tData[bindingIndex + 1];
  const higherPriorityValue = getTStylingRangeNextDuplicate(tRange) ? findStylingValue(tData, tNode, lView, prop, getTStylingRangeNext(tRange), isClassBased) : void 0;
  if (!isStylingValuePresent(higherPriorityValue)) {
    if (!isStylingValuePresent(value)) {
      if (getTStylingRangePrevDuplicate(tRange)) {
        value = findStylingValue(tData, null, lView, prop, bindingIndex, isClassBased);
      }
    }
    const rNode = getNativeByIndex(getSelectedIndex(), lView);
    applyStyling(renderer, isClassBased, rNode, prop, value);
  }
}
function findStylingValue(tData, tNode, lView, prop, index, isClassBased) {
  const isPrevDirection = tNode === null;
  let value = void 0;
  while (index > 0) {
    const rawKey = tData[index];
    const containsStatics = Array.isArray(rawKey);
    const key = containsStatics ? rawKey[1] : rawKey;
    const isStylingMap = key === null;
    let valueAtLViewIndex = lView[index + 1];
    if (valueAtLViewIndex === NO_CHANGE) {
      valueAtLViewIndex = isStylingMap ? EMPTY_ARRAY : void 0;
    }
    let currentValue = isStylingMap ? keyValueArrayGet(valueAtLViewIndex, prop) : key === prop ? valueAtLViewIndex : void 0;
    if (containsStatics && !isStylingValuePresent(currentValue)) {
      currentValue = keyValueArrayGet(rawKey, prop);
    }
    if (isStylingValuePresent(currentValue)) {
      value = currentValue;
      if (isPrevDirection) {
        return value;
      }
    }
    const tRange = tData[index + 1];
    index = isPrevDirection ? getTStylingRangePrev(tRange) : getTStylingRangeNext(tRange);
  }
  if (tNode !== null) {
    let residual = isClassBased ? tNode.residualClasses : tNode.residualStyles;
    if (residual != null) {
      value = keyValueArrayGet(residual, prop);
    }
  }
  return value;
}
function isStylingValuePresent(value) {
  return value !== void 0;
}
function normalizeSuffix(value, suffix) {
  if (value == null || value === "") ;
  else if (typeof suffix === "string") {
    value = value + suffix;
  } else if (typeof value === "object") {
    value = stringify(unwrapSafeValue(value));
  }
  return value;
}
function hasStylingInputShadow(tNode, isClassBased) {
  return (tNode.flags & (isClassBased ? 8 : 16)) !== 0;
}
function \u0275\u0275text(index, value = "") {
  const lView = getLView();
  const tView = getTView();
  const adjustedIndex = index + HEADER_OFFSET;
  ngDevMode && assertTNodeCreationIndex(lView, index);
  const tNode = tView.firstCreatePass ? getOrCreateTNode(tView, adjustedIndex, 1, value, null) : tView.data[adjustedIndex];
  const textNative = _locateOrCreateTextNode(tView, lView, tNode, value, index);
  lView[adjustedIndex] = textNative;
  if (wasLastNodeCreated()) {
    appendChild(tView, lView, textNative, tNode);
  }
  setCurrentTNode(tNode, false);
}
var _locateOrCreateTextNode = (tView, lView, tNode, value, index) => {
  lastNodeWasCreated(true);
  return createTextNode(lView[RENDERER], value);
};
function interpolationV(lView, values) {
  ngDevMode && assertLessThan(2, values.length, "should have at least 3 values");
  let isBindingUpdated = false;
  let bindingIndex = getBindingIndex();
  for (let i = 1; i < values.length; i += 2) {
    isBindingUpdated = bindingUpdated(lView, bindingIndex++, values[i]) || isBindingUpdated;
  }
  setBindingIndex(bindingIndex);
  if (!isBindingUpdated) {
    return NO_CHANGE;
  }
  let content = values[0];
  for (let i = 1; i < values.length; i += 2) {
    content += renderStringify(values[i]) + (i + 1 !== values.length ? values[i + 1] : "");
  }
  return content;
}
function interpolation1(lView, prefix, v0, suffix = "") {
  const different = bindingUpdated(lView, nextBindingIndex(), v0);
  return different ? prefix + renderStringify(v0) + suffix : NO_CHANGE;
}
function interpolation2(lView, prefix, v0, i02, v1, suffix = "") {
  const bindingIndex = getBindingIndex();
  const different = bindingUpdated2(lView, bindingIndex, v0, v1);
  incrementBindingIndex(2);
  return different ? prefix + renderStringify(v0) + i02 + renderStringify(v1) + suffix : NO_CHANGE;
}
function interpolation3(lView, prefix, v0, i02, v1, i12, v2, suffix = "") {
  const bindingIndex = getBindingIndex();
  const different = bindingUpdated3(lView, bindingIndex, v0, v1, v2);
  incrementBindingIndex(3);
  return different ? prefix + renderStringify(v0) + i02 + renderStringify(v1) + i12 + renderStringify(v2) + suffix : NO_CHANGE;
}
function interpolation4(lView, prefix, v0, i02, v1, i12, v2, i2, v3, suffix = "") {
  const bindingIndex = getBindingIndex();
  const different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
  incrementBindingIndex(4);
  return different ? prefix + renderStringify(v0) + i02 + renderStringify(v1) + i12 + renderStringify(v2) + i2 + renderStringify(v3) + suffix : NO_CHANGE;
}
function interpolation5(lView, prefix, v0, i02, v1, i12, v2, i2, v3, i3, v4, suffix = "") {
  const bindingIndex = getBindingIndex();
  let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
  different = bindingUpdated(lView, bindingIndex + 4, v4) || different;
  incrementBindingIndex(5);
  return different ? prefix + renderStringify(v0) + i02 + renderStringify(v1) + i12 + renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + suffix : NO_CHANGE;
}
function interpolation6(lView, prefix, v0, i02, v1, i12, v2, i2, v3, i3, v4, i4, v5, suffix = "") {
  const bindingIndex = getBindingIndex();
  let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
  different = bindingUpdated2(lView, bindingIndex + 4, v4, v5) || different;
  incrementBindingIndex(6);
  return different ? prefix + renderStringify(v0) + i02 + renderStringify(v1) + i12 + renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + i4 + renderStringify(v5) + suffix : NO_CHANGE;
}
function interpolation7(lView, prefix, v0, i02, v1, i12, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix = "") {
  const bindingIndex = getBindingIndex();
  let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
  different = bindingUpdated3(lView, bindingIndex + 4, v4, v5, v6) || different;
  incrementBindingIndex(7);
  return different ? prefix + renderStringify(v0) + i02 + renderStringify(v1) + i12 + renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + i4 + renderStringify(v5) + i5 + renderStringify(v6) + suffix : NO_CHANGE;
}
function interpolation8(lView, prefix, v0, i02, v1, i12, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix = "") {
  const bindingIndex = getBindingIndex();
  let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
  different = bindingUpdated4(lView, bindingIndex + 4, v4, v5, v6, v7) || different;
  incrementBindingIndex(8);
  return different ? prefix + renderStringify(v0) + i02 + renderStringify(v1) + i12 + renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + i4 + renderStringify(v5) + i5 + renderStringify(v6) + i6 + renderStringify(v7) + suffix : NO_CHANGE;
}
function \u0275\u0275textInterpolate(v0) {
  \u0275\u0275textInterpolate1("", v0);
  return \u0275\u0275textInterpolate;
}
function \u0275\u0275textInterpolate1(prefix, v0, suffix) {
  const lView = getLView();
  const interpolated = interpolation1(lView, prefix, v0, suffix);
  if (interpolated !== NO_CHANGE) {
    textBindingInternal(lView, getSelectedIndex(), interpolated);
  }
  return \u0275\u0275textInterpolate1;
}
function \u0275\u0275textInterpolate2(prefix, v0, i02, v1, suffix) {
  const lView = getLView();
  const interpolated = interpolation2(lView, prefix, v0, i02, v1, suffix);
  if (interpolated !== NO_CHANGE) {
    textBindingInternal(lView, getSelectedIndex(), interpolated);
  }
  return \u0275\u0275textInterpolate2;
}
function \u0275\u0275textInterpolate3(prefix, v0, i02, v1, i12, v2, suffix) {
  const lView = getLView();
  const interpolated = interpolation3(lView, prefix, v0, i02, v1, i12, v2, suffix);
  if (interpolated !== NO_CHANGE) {
    textBindingInternal(lView, getSelectedIndex(), interpolated);
  }
  return \u0275\u0275textInterpolate3;
}
function \u0275\u0275textInterpolate4(prefix, v0, i02, v1, i12, v2, i2, v3, suffix) {
  const lView = getLView();
  const interpolated = interpolation4(lView, prefix, v0, i02, v1, i12, v2, i2, v3, suffix);
  if (interpolated !== NO_CHANGE) {
    textBindingInternal(lView, getSelectedIndex(), interpolated);
  }
  return \u0275\u0275textInterpolate4;
}
function \u0275\u0275textInterpolate5(prefix, v0, i02, v1, i12, v2, i2, v3, i3, v4, suffix) {
  const lView = getLView();
  const interpolated = interpolation5(lView, prefix, v0, i02, v1, i12, v2, i2, v3, i3, v4, suffix);
  if (interpolated !== NO_CHANGE) {
    textBindingInternal(lView, getSelectedIndex(), interpolated);
  }
  return \u0275\u0275textInterpolate5;
}
function \u0275\u0275textInterpolate6(prefix, v0, i02, v1, i12, v2, i2, v3, i3, v4, i4, v5, suffix) {
  const lView = getLView();
  const interpolated = interpolation6(lView, prefix, v0, i02, v1, i12, v2, i2, v3, i3, v4, i4, v5, suffix);
  if (interpolated !== NO_CHANGE) {
    textBindingInternal(lView, getSelectedIndex(), interpolated);
  }
  return \u0275\u0275textInterpolate6;
}
function \u0275\u0275textInterpolate7(prefix, v0, i02, v1, i12, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix) {
  const lView = getLView();
  const interpolated = interpolation7(lView, prefix, v0, i02, v1, i12, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix);
  if (interpolated !== NO_CHANGE) {
    textBindingInternal(lView, getSelectedIndex(), interpolated);
  }
  return \u0275\u0275textInterpolate7;
}
function \u0275\u0275textInterpolate8(prefix, v0, i02, v1, i12, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix) {
  const lView = getLView();
  const interpolated = interpolation8(lView, prefix, v0, i02, v1, i12, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix);
  if (interpolated !== NO_CHANGE) {
    textBindingInternal(lView, getSelectedIndex(), interpolated);
  }
  return \u0275\u0275textInterpolate8;
}
function \u0275\u0275textInterpolateV(values) {
  const lView = getLView();
  const interpolated = interpolationV(lView, values);
  if (interpolated !== NO_CHANGE) {
    textBindingInternal(lView, getSelectedIndex(), interpolated);
  }
  return \u0275\u0275textInterpolateV;
}
function textBindingInternal(lView, index, value) {
  ngDevMode && assertString(value, "Value should be a string");
  ngDevMode && assertNotSame(value, NO_CHANGE, "value should not be NO_CHANGE");
  ngDevMode && assertIndexInRange(lView, index);
  const element = getNativeByIndex(index, lView);
  ngDevMode && assertDefined(element, "native element should exist");
  updateTextNode(lView[RENDERER], element, value);
}
function \u0275\u0275twoWayProperty(propName, value, sanitizer) {
  if (isWritableSignal(value)) {
    value = value();
  }
  const lView = getLView();
  const bindingIndex = nextBindingIndex();
  if (bindingUpdated(lView, bindingIndex, value)) {
    const tView = getTView();
    const tNode = getSelectedTNode();
    setPropertyAndInputs(tNode, lView, propName, value, lView[RENDERER], sanitizer);
    ngDevMode && storePropertyBindingMetadata(tView.data, tNode, propName, bindingIndex);
  }
  return \u0275\u0275twoWayProperty;
}
function \u0275\u0275twoWayBindingSet(target, value) {
  const canWrite = isWritableSignal(target);
  canWrite && target.set(value);
  return canWrite;
}
function \u0275\u0275twoWayListener(eventName, listenerFn) {
  const lView = getLView();
  const tView = getTView();
  const tNode = getCurrentTNode();
  listenerInternal(tView, lView, lView[RENDERER], tNode, eventName, listenerFn);
  return \u0275\u0275twoWayListener;
}
var UNINITIALIZED_LET = {};
function \u0275\u0275declareLet(index) {
  const tView = getTView();
  const lView = getLView();
  const adjustedIndex = index + HEADER_OFFSET;
  const tNode = getOrCreateTNode(tView, adjustedIndex, 128, null, null);
  setCurrentTNode(tNode, false);
  store(tView, lView, adjustedIndex, UNINITIALIZED_LET);
  return \u0275\u0275declareLet;
}
function \u0275\u0275storeLet(value) {
  performanceMarkFeature("NgLet");
  const tView = getTView();
  const lView = getLView();
  const index = getSelectedIndex();
  store(tView, lView, index, value);
  return value;
}
function \u0275\u0275readContextLet(index) {
  const contextLView = getContextLView();
  const value = load(contextLView, HEADER_OFFSET + index);
  if (value === UNINITIALIZED_LET) {
    throw new RuntimeError(314, ngDevMode && "Attempting to access a @let declaration whose value is not available yet");
  }
  return value;
}
function \u0275\u0275attachSourceLocations(templatePath, locations) {
  const tView = getTView();
  const lView = getLView();
  const renderer = lView[RENDERER];
  const attributeName = "data-ng-source-location";
  for (const [index, offset, line, column] of locations) {
    const tNode = getTNode(tView, index + HEADER_OFFSET);
    ngDevMode && assertTNodeType(
      tNode,
      2
      /* TNodeType.Element */
    );
    const node = getNativeByIndex(index + HEADER_OFFSET, lView);
    if (!node.hasAttribute(attributeName)) {
      const attributeValue = `${templatePath}@o:${offset},l:${line},c:${column}`;
      renderer.setAttribute(node, attributeName, attributeValue);
    }
  }
}
function \u0275\u0275interpolate(v0) {
  return bindingUpdated(getLView(), nextBindingIndex(), v0) ? renderStringify(v0) : NO_CHANGE;
}
function \u0275\u0275interpolate1(prefix, v0, suffix = "") {
  return interpolation1(getLView(), prefix, v0, suffix);
}
function \u0275\u0275interpolate2(prefix, v0, i02, v1, suffix = "") {
  return interpolation2(getLView(), prefix, v0, i02, v1, suffix);
}
function \u0275\u0275interpolate3(prefix, v0, i02, v1, i12, v2, suffix = "") {
  return interpolation3(getLView(), prefix, v0, i02, v1, i12, v2, suffix);
}
function \u0275\u0275interpolate4(prefix, v0, i02, v1, i12, v2, i2, v3, suffix = "") {
  return interpolation4(getLView(), prefix, v0, i02, v1, i12, v2, i2, v3, suffix);
}
function \u0275\u0275interpolate5(prefix, v0, i02, v1, i12, v2, i2, v3, i3, v4, suffix = "") {
  return interpolation5(getLView(), prefix, v0, i02, v1, i12, v2, i2, v3, i3, v4, suffix);
}
function \u0275\u0275interpolate6(prefix, v0, i02, v1, i12, v2, i2, v3, i3, v4, i4, v5, suffix = "") {
  return interpolation6(getLView(), prefix, v0, i02, v1, i12, v2, i2, v3, i3, v4, i4, v5, suffix);
}
function \u0275\u0275interpolate7(prefix, v0, i02, v1, i12, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix = "") {
  return interpolation7(getLView(), prefix, v0, i02, v1, i12, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix);
}
function \u0275\u0275interpolate8(prefix, v0, i02, v1, i12, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix = "") {
  return interpolation8(getLView(), prefix, v0, i02, v1, i12, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix);
}
function \u0275\u0275interpolateV(values) {
  return interpolationV(getLView(), values);
}
function providersResolver(def, providers, viewProviders) {
  const tView = getTView();
  if (tView.firstCreatePass) {
    const isComponent2 = isComponentDef(def);
    resolveProvider(viewProviders, tView.data, tView.blueprint, isComponent2, true);
    resolveProvider(providers, tView.data, tView.blueprint, isComponent2, false);
  }
}
function resolveProvider(provider, tInjectables, lInjectablesBlueprint, isComponent2, isViewProvider) {
  provider = resolveForwardRef(provider);
  if (Array.isArray(provider)) {
    for (let i = 0; i < provider.length; i++) {
      resolveProvider(provider[i], tInjectables, lInjectablesBlueprint, isComponent2, isViewProvider);
    }
  } else {
    const tView = getTView();
    const lView = getLView();
    const tNode = getCurrentTNode();
    let token = isTypeProvider(provider) ? provider : resolveForwardRef(provider.provide);
    const providerFactory = providerToFactory(provider);
    if (ngDevMode) {
      const injector = new NodeInjector(tNode, lView);
      runInInjectorProfilerContext(injector, token, () => {
        emitProviderConfiguredEvent(provider, isViewProvider);
      });
    }
    const beginIndex = tNode.providerIndexes & 1048575;
    const endIndex = tNode.directiveStart;
    const cptViewProvidersCount = tNode.providerIndexes >> 20;
    if (isTypeProvider(provider) || !provider.multi) {
      const factory = new NodeInjectorFactory(providerFactory, isViewProvider, \u0275\u0275directiveInject, ngDevMode ? providerName(provider) : null);
      const existingFactoryIndex = indexOf(token, tInjectables, isViewProvider ? beginIndex : beginIndex + cptViewProvidersCount, endIndex);
      if (existingFactoryIndex === -1) {
        diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, lView), tView, token);
        registerDestroyHooksIfSupported(tView, provider, tInjectables.length);
        tInjectables.push(token);
        tNode.directiveStart++;
        tNode.directiveEnd++;
        if (isViewProvider) {
          tNode.providerIndexes += 1048576;
        }
        lInjectablesBlueprint.push(factory);
        lView.push(factory);
      } else {
        lInjectablesBlueprint[existingFactoryIndex] = factory;
        lView[existingFactoryIndex] = factory;
      }
    } else {
      const existingProvidersFactoryIndex = indexOf(token, tInjectables, beginIndex + cptViewProvidersCount, endIndex);
      const existingViewProvidersFactoryIndex = indexOf(token, tInjectables, beginIndex, beginIndex + cptViewProvidersCount);
      const doesProvidersFactoryExist = existingProvidersFactoryIndex >= 0 && lInjectablesBlueprint[existingProvidersFactoryIndex];
      const doesViewProvidersFactoryExist = existingViewProvidersFactoryIndex >= 0 && lInjectablesBlueprint[existingViewProvidersFactoryIndex];
      if (isViewProvider && !doesViewProvidersFactoryExist || !isViewProvider && !doesProvidersFactoryExist) {
        diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, lView), tView, token);
        const factory = multiFactory(isViewProvider ? multiViewProvidersFactoryResolver : multiProvidersFactoryResolver, lInjectablesBlueprint.length, isViewProvider, isComponent2, providerFactory, provider);
        if (!isViewProvider && doesViewProvidersFactoryExist) {
          lInjectablesBlueprint[existingViewProvidersFactoryIndex].providerFactory = factory;
        }
        registerDestroyHooksIfSupported(tView, provider, tInjectables.length, 0);
        tInjectables.push(token);
        tNode.directiveStart++;
        tNode.directiveEnd++;
        if (isViewProvider) {
          tNode.providerIndexes += 1048576;
        }
        lInjectablesBlueprint.push(factory);
        lView.push(factory);
      } else {
        const indexInFactory = multiFactoryAdd(lInjectablesBlueprint[isViewProvider ? existingViewProvidersFactoryIndex : existingProvidersFactoryIndex], providerFactory, !isViewProvider && isComponent2);
        registerDestroyHooksIfSupported(tView, provider, existingProvidersFactoryIndex > -1 ? existingProvidersFactoryIndex : existingViewProvidersFactoryIndex, indexInFactory);
      }
      if (!isViewProvider && isComponent2 && doesViewProvidersFactoryExist) {
        lInjectablesBlueprint[existingViewProvidersFactoryIndex].componentProviders++;
      }
    }
  }
}
function registerDestroyHooksIfSupported(tView, provider, contextIndex, indexInFactory) {
  const providerIsTypeProvider = isTypeProvider(provider);
  const providerIsClassProvider = isClassProvider(provider);
  if (providerIsTypeProvider || providerIsClassProvider) {
    const classToken = providerIsClassProvider ? resolveForwardRef(provider.useClass) : provider;
    const prototype = classToken.prototype;
    const ngOnDestroy = prototype.ngOnDestroy;
    if (ngOnDestroy) {
      const hooks = tView.destroyHooks || (tView.destroyHooks = []);
      if (!providerIsTypeProvider && provider.multi) {
        ngDevMode && assertDefined(indexInFactory, "indexInFactory when registering multi factory destroy hook");
        const existingCallbacksIndex = hooks.indexOf(contextIndex);
        if (existingCallbacksIndex === -1) {
          hooks.push(contextIndex, [indexInFactory, ngOnDestroy]);
        } else {
          hooks[existingCallbacksIndex + 1].push(indexInFactory, ngOnDestroy);
        }
      } else {
        hooks.push(contextIndex, ngOnDestroy);
      }
    }
  }
}
function multiFactoryAdd(multiFactory2, factory, isComponentProvider) {
  if (isComponentProvider) {
    multiFactory2.componentProviders++;
  }
  return multiFactory2.multi.push(factory) - 1;
}
function indexOf(item, arr, begin, end) {
  for (let i = begin; i < end; i++) {
    if (arr[i] === item)
      return i;
  }
  return -1;
}
function multiProvidersFactoryResolver(_4, flags, tData, lData, tNode) {
  return multiResolve(this.multi, []);
}
function multiViewProvidersFactoryResolver(_4, _flags, _tData, lView, tNode) {
  const factories = this.multi;
  let result;
  if (this.providerFactory) {
    const componentCount = this.providerFactory.componentProviders;
    const multiProviders = getNodeInjectable(lView, lView[TVIEW], this.providerFactory.index, tNode);
    result = multiProviders.slice(0, componentCount);
    multiResolve(factories, result);
    for (let i = componentCount; i < multiProviders.length; i++) {
      result.push(multiProviders[i]);
    }
  } else {
    result = [];
    multiResolve(factories, result);
  }
  return result;
}
function multiResolve(factories, result) {
  for (let i = 0; i < factories.length; i++) {
    const factory = factories[i];
    result.push(factory());
  }
  return result;
}
function multiFactory(factoryFn, index, isViewProvider, isComponent2, f, provider) {
  const factory = new NodeInjectorFactory(factoryFn, isViewProvider, \u0275\u0275directiveInject, ngDevMode ? providerName(provider) : null);
  factory.multi = [];
  factory.index = index;
  factory.componentProviders = 0;
  multiFactoryAdd(factory, f, isComponent2 && !isViewProvider);
  return factory;
}
function providerName(provider) {
  if (Array.isArray(provider)) {
    return null;
  }
  if (isTypeProvider(provider)) {
    return provider.name;
  } else if (isClassProvider(provider)) {
    if (provider.provide instanceof InjectionToken) {
      return `('${provider.provide.toString()}':${provider.useClass.name})`;
    }
    return provider.useClass.name;
  } else if (provider.provide instanceof InjectionToken) {
    return provider.provide.toString();
  } else if (typeof provider.provide === "string") {
    return provider.provide;
  } else {
    return null;
  }
}
function \u0275\u0275ProvidersFeature(providers, viewProviders = []) {
  return (definition) => {
    definition.providersResolver = (def, processProvidersFn) => {
      return providersResolver(
        def,
        //
        processProvidersFn ? processProvidersFn(providers) : providers,
        //
        viewProviders
      );
    };
  };
}
function \u0275\u0275ExternalStylesFeature(styleUrls) {
  return (definition) => {
    if (styleUrls.length < 1) {
      return;
    }
    definition.getExternalStyles = (encapsulationId) => {
      const urls = styleUrls.map((value) => value + "?ngcomp" + (encapsulationId ? "=" + encodeURIComponent(encapsulationId) : "") + "&e=" + definition.encapsulation);
      return urls;
    };
  };
}
function \u0275\u0275setComponentScope(type, directives, pipes) {
  const def = type.\u0275cmp;
  def.directiveDefs = extractDefListOrFactory(directives, extractDirectiveDef);
  def.pipeDefs = extractDefListOrFactory(pipes, getPipeDef);
}
function \u0275\u0275setNgModuleScope(type, scope) {
  return noSideEffects(() => {
    const ngModuleDef = getNgModuleDefOrThrow(type);
    ngModuleDef.declarations = convertToTypeArray(scope.declarations || EMPTY_ARRAY);
    ngModuleDef.imports = convertToTypeArray(scope.imports || EMPTY_ARRAY);
    ngModuleDef.exports = convertToTypeArray(scope.exports || EMPTY_ARRAY);
    if (scope.bootstrap) {
      ngModuleDef.bootstrap = convertToTypeArray(scope.bootstrap);
    }
    depsTracker.registerNgModule(type, scope);
  });
}
function convertToTypeArray(values) {
  if (typeof values === "function") {
    return values;
  }
  const flattenValues = flatten(values);
  if (flattenValues.some(isForwardRef)) {
    return () => flattenValues.map(resolveForwardRef).map(maybeUnwrapModuleWithProviders);
  } else {
    return flattenValues.map(maybeUnwrapModuleWithProviders);
  }
}
function maybeUnwrapModuleWithProviders(value) {
  return isModuleWithProviders(value) ? value.ngModule : value;
}
function \u0275\u0275pureFunction0(slotOffset, pureFn, thisArg) {
  const bindingIndex = getBindingRoot() + slotOffset;
  const lView = getLView();
  return lView[bindingIndex] === NO_CHANGE ? updateBinding(lView, bindingIndex, thisArg ? pureFn.call(thisArg) : pureFn()) : getBinding(lView, bindingIndex);
}
function \u0275\u0275pureFunction1(slotOffset, pureFn, exp, thisArg) {
  return pureFunction1Internal(getLView(), getBindingRoot(), slotOffset, pureFn, exp, thisArg);
}
function \u0275\u0275pureFunction2(slotOffset, pureFn, exp1, exp2, thisArg) {
  return pureFunction2Internal(getLView(), getBindingRoot(), slotOffset, pureFn, exp1, exp2, thisArg);
}
function \u0275\u0275pureFunction3(slotOffset, pureFn, exp1, exp2, exp3, thisArg) {
  return pureFunction3Internal(getLView(), getBindingRoot(), slotOffset, pureFn, exp1, exp2, exp3, thisArg);
}
function \u0275\u0275pureFunction4(slotOffset, pureFn, exp1, exp2, exp3, exp4, thisArg) {
  return pureFunction4Internal(getLView(), getBindingRoot(), slotOffset, pureFn, exp1, exp2, exp3, exp4, thisArg);
}
function \u0275\u0275pureFunction5(slotOffset, pureFn, exp1, exp2, exp3, exp4, exp5, thisArg) {
  const bindingIndex = getBindingRoot() + slotOffset;
  const lView = getLView();
  const different = bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4);
  return bindingUpdated(lView, bindingIndex + 4, exp5) || different ? updateBinding(lView, bindingIndex + 5, thisArg ? pureFn.call(thisArg, exp1, exp2, exp3, exp4, exp5) : pureFn(exp1, exp2, exp3, exp4, exp5)) : getBinding(lView, bindingIndex + 5);
}
function \u0275\u0275pureFunction6(slotOffset, pureFn, exp1, exp2, exp3, exp4, exp5, exp6, thisArg) {
  const bindingIndex = getBindingRoot() + slotOffset;
  const lView = getLView();
  const different = bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4);
  return bindingUpdated2(lView, bindingIndex + 4, exp5, exp6) || different ? updateBinding(lView, bindingIndex + 6, thisArg ? pureFn.call(thisArg, exp1, exp2, exp3, exp4, exp5, exp6) : pureFn(exp1, exp2, exp3, exp4, exp5, exp6)) : getBinding(lView, bindingIndex + 6);
}
function \u0275\u0275pureFunction7(slotOffset, pureFn, exp1, exp2, exp3, exp4, exp5, exp6, exp7, thisArg) {
  const bindingIndex = getBindingRoot() + slotOffset;
  const lView = getLView();
  let different = bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4);
  return bindingUpdated3(lView, bindingIndex + 4, exp5, exp6, exp7) || different ? updateBinding(lView, bindingIndex + 7, thisArg ? pureFn.call(thisArg, exp1, exp2, exp3, exp4, exp5, exp6, exp7) : pureFn(exp1, exp2, exp3, exp4, exp5, exp6, exp7)) : getBinding(lView, bindingIndex + 7);
}
function \u0275\u0275pureFunction8(slotOffset, pureFn, exp1, exp2, exp3, exp4, exp5, exp6, exp7, exp8, thisArg) {
  const bindingIndex = getBindingRoot() + slotOffset;
  const lView = getLView();
  const different = bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4);
  return bindingUpdated4(lView, bindingIndex + 4, exp5, exp6, exp7, exp8) || different ? updateBinding(lView, bindingIndex + 8, thisArg ? pureFn.call(thisArg, exp1, exp2, exp3, exp4, exp5, exp6, exp7, exp8) : pureFn(exp1, exp2, exp3, exp4, exp5, exp6, exp7, exp8)) : getBinding(lView, bindingIndex + 8);
}
function \u0275\u0275pureFunctionV(slotOffset, pureFn, exps, thisArg) {
  return pureFunctionVInternal(getLView(), getBindingRoot(), slotOffset, pureFn, exps, thisArg);
}
function getPureFunctionReturnValue(lView, returnValueIndex) {
  ngDevMode && assertIndexInRange(lView, returnValueIndex);
  const lastReturnValue = lView[returnValueIndex];
  return lastReturnValue === NO_CHANGE ? void 0 : lastReturnValue;
}
function pureFunction1Internal(lView, bindingRoot, slotOffset, pureFn, exp, thisArg) {
  const bindingIndex = bindingRoot + slotOffset;
  return bindingUpdated(lView, bindingIndex, exp) ? updateBinding(lView, bindingIndex + 1, thisArg ? pureFn.call(thisArg, exp) : pureFn(exp)) : getPureFunctionReturnValue(lView, bindingIndex + 1);
}
function pureFunction2Internal(lView, bindingRoot, slotOffset, pureFn, exp1, exp2, thisArg) {
  const bindingIndex = bindingRoot + slotOffset;
  return bindingUpdated2(lView, bindingIndex, exp1, exp2) ? updateBinding(lView, bindingIndex + 2, thisArg ? pureFn.call(thisArg, exp1, exp2) : pureFn(exp1, exp2)) : getPureFunctionReturnValue(lView, bindingIndex + 2);
}
function pureFunction3Internal(lView, bindingRoot, slotOffset, pureFn, exp1, exp2, exp3, thisArg) {
  const bindingIndex = bindingRoot + slotOffset;
  return bindingUpdated3(lView, bindingIndex, exp1, exp2, exp3) ? updateBinding(lView, bindingIndex + 3, thisArg ? pureFn.call(thisArg, exp1, exp2, exp3) : pureFn(exp1, exp2, exp3)) : getPureFunctionReturnValue(lView, bindingIndex + 3);
}
function pureFunction4Internal(lView, bindingRoot, slotOffset, pureFn, exp1, exp2, exp3, exp4, thisArg) {
  const bindingIndex = bindingRoot + slotOffset;
  return bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4) ? updateBinding(lView, bindingIndex + 4, thisArg ? pureFn.call(thisArg, exp1, exp2, exp3, exp4) : pureFn(exp1, exp2, exp3, exp4)) : getPureFunctionReturnValue(lView, bindingIndex + 4);
}
function pureFunctionVInternal(lView, bindingRoot, slotOffset, pureFn, exps, thisArg) {
  let bindingIndex = bindingRoot + slotOffset;
  let different = false;
  for (let i = 0; i < exps.length; i++) {
    bindingUpdated(lView, bindingIndex++, exps[i]) && (different = true);
  }
  return different ? updateBinding(lView, bindingIndex, pureFn.apply(thisArg, exps)) : getPureFunctionReturnValue(lView, bindingIndex);
}
function \u0275\u0275pipe(index, pipeName) {
  const tView = getTView();
  let pipeDef;
  const adjustedIndex = index + HEADER_OFFSET;
  if (tView.firstCreatePass) {
    pipeDef = getPipeDef2(pipeName, tView.pipeRegistry);
    tView.data[adjustedIndex] = pipeDef;
    if (pipeDef.onDestroy) {
      (tView.destroyHooks ??= []).push(adjustedIndex, pipeDef.onDestroy);
    }
  } else {
    pipeDef = tView.data[adjustedIndex];
  }
  const pipeFactory = pipeDef.factory || (pipeDef.factory = getFactoryDef(pipeDef.type, true));
  let previousInjectorProfilerContext;
  if (ngDevMode) {
    previousInjectorProfilerContext = setInjectorProfilerContext({
      injector: new NodeInjector(getCurrentTNode(), getLView()),
      token: pipeDef.type
    });
  }
  const previousInjectImplementation = setInjectImplementation(\u0275\u0275directiveInject);
  try {
    const previousIncludeViewProviders = setIncludeViewProviders(false);
    const pipeInstance = pipeFactory();
    setIncludeViewProviders(previousIncludeViewProviders);
    store(tView, getLView(), adjustedIndex, pipeInstance);
    return pipeInstance;
  } finally {
    setInjectImplementation(previousInjectImplementation);
    ngDevMode && setInjectorProfilerContext(previousInjectorProfilerContext);
  }
}
function getPipeDef2(name2, registry) {
  if (registry) {
    if (ngDevMode) {
      const pipes = registry.filter((pipe2) => pipe2.name === name2);
      if (pipes.length > 1) {
        console.warn(formatRuntimeError(313, getMultipleMatchingPipesMessage(name2)));
      }
    }
    for (let i = registry.length - 1; i >= 0; i--) {
      const pipeDef = registry[i];
      if (name2 === pipeDef.name) {
        return pipeDef;
      }
    }
  }
  if (ngDevMode) {
    throw new RuntimeError(-302, getPipeNotFoundErrorMessage(name2));
  }
  return;
}
function getMultipleMatchingPipesMessage(name2) {
  const lView = getLView();
  const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
  const context2 = declarationLView[CONTEXT];
  const hostIsStandalone = isHostComponentStandalone(lView);
  const componentInfoMessage = context2 ? ` in the '${context2.constructor.name}' component` : "";
  const verifyMessage = `check ${hostIsStandalone ? "'@Component.imports' of this component" : "the imports of this module"}`;
  const errorMessage = `Multiple pipes match the name \`${name2}\`${componentInfoMessage}. ${verifyMessage}`;
  return errorMessage;
}
function getPipeNotFoundErrorMessage(name2) {
  const lView = getLView();
  const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
  const context2 = declarationLView[CONTEXT];
  const hostIsStandalone = isHostComponentStandalone(lView);
  const componentInfoMessage = context2 ? ` in the '${context2.constructor.name}' component` : "";
  const verifyMessage = `Verify that it is ${hostIsStandalone ? "included in the '@Component.imports' of this component" : "declared or imported in this module"}`;
  const errorMessage = `The pipe '${name2}' could not be found${componentInfoMessage}. ${verifyMessage}`;
  return errorMessage;
}
function \u0275\u0275pipeBind1(index, offset, v1) {
  const adjustedIndex = index + HEADER_OFFSET;
  const lView = getLView();
  const pipeInstance = load(lView, adjustedIndex);
  return isPure(lView, adjustedIndex) ? pureFunction1Internal(lView, getBindingRoot(), offset, pipeInstance.transform, v1, pipeInstance) : pipeInstance.transform(v1);
}
function \u0275\u0275pipeBind2(index, slotOffset, v1, v2) {
  const adjustedIndex = index + HEADER_OFFSET;
  const lView = getLView();
  const pipeInstance = load(lView, adjustedIndex);
  return isPure(lView, adjustedIndex) ? pureFunction2Internal(lView, getBindingRoot(), slotOffset, pipeInstance.transform, v1, v2, pipeInstance) : pipeInstance.transform(v1, v2);
}
function \u0275\u0275pipeBind3(index, slotOffset, v1, v2, v3) {
  const adjustedIndex = index + HEADER_OFFSET;
  const lView = getLView();
  const pipeInstance = load(lView, adjustedIndex);
  return isPure(lView, adjustedIndex) ? pureFunction3Internal(lView, getBindingRoot(), slotOffset, pipeInstance.transform, v1, v2, v3, pipeInstance) : pipeInstance.transform(v1, v2, v3);
}
function \u0275\u0275pipeBind4(index, slotOffset, v1, v2, v3, v4) {
  const adjustedIndex = index + HEADER_OFFSET;
  const lView = getLView();
  const pipeInstance = load(lView, adjustedIndex);
  return isPure(lView, adjustedIndex) ? pureFunction4Internal(lView, getBindingRoot(), slotOffset, pipeInstance.transform, v1, v2, v3, v4, pipeInstance) : pipeInstance.transform(v1, v2, v3, v4);
}
function \u0275\u0275pipeBindV(index, slotOffset, values) {
  const adjustedIndex = index + HEADER_OFFSET;
  const lView = getLView();
  const pipeInstance = load(lView, adjustedIndex);
  return isPure(lView, adjustedIndex) ? pureFunctionVInternal(lView, getBindingRoot(), slotOffset, pipeInstance.transform, values, pipeInstance) : pipeInstance.transform.apply(pipeInstance, values);
}
function isPure(lView, index) {
  return lView[TVIEW].data[index].pure;
}
function \u0275\u0275templateRefExtractor(tNode, lView) {
  return createTemplateRef(tNode, lView);
}
function \u0275\u0275getComponentDepsFactory(type, rawImports) {
  return () => {
    try {
      return depsTracker.getComponentDependencies(type, rawImports).dependencies;
    } catch (e) {
      console.error(`Computing dependencies in local compilation mode for the component "${type.name}" failed with the exception:`, e);
      throw e;
    }
  };
}
function \u0275setClassDebugInfo(type, debugInfo) {
  const def = getComponentDef(type);
  if (def !== null) {
    def.debugInfo = debugInfo;
  }
}
function \u0275\u0275getReplaceMetadataURL(id, timestamp2, base) {
  const url = `./@ng/component?c=${id}&t=${encodeURIComponent(timestamp2)}`;
  return new URL(url, base).href;
}
function \u0275\u0275replaceMetadata(type, applyMetadata, namespaces, locals, importMeta = null, id = null) {
  ngDevMode && assertComponentDef(type);
  const currentDef = getComponentDef(type);
  applyMetadata.apply(null, [type, namespaces, ...locals]);
  const { newDef, oldDef } = mergeWithExistingDefinition(currentDef, getComponentDef(type));
  type[NG_COMP_DEF] = newDef;
  if (oldDef.tView) {
    const trackedViews = getTrackedLViews().values();
    for (const root of trackedViews) {
      if (isRootView(root) && root[PARENT] === null) {
        recreateMatchingLViews(importMeta, id, newDef, oldDef, root);
      }
    }
  }
}
function mergeWithExistingDefinition(currentDef, newDef) {
  const clone = __spreadValues({}, currentDef);
  const replacement = Object.assign(currentDef, newDef, {
    // We need to keep the existing directive and pipe defs, because they can get patched on
    // by a call to `setComponentScope` from a module file. That call won't make it into the
    // HMR replacement function, because it lives in an entirely different file.
    directiveDefs: clone.directiveDefs,
    pipeDefs: clone.pipeDefs,
    // Preserve the old `setInput` function, because it has some state.
    // This is fine, because the component instance is preserved as well.
    setInput: clone.setInput,
    // Externally this is redundant since we redeclare the definition using the original type.
    // Internally we may receive a definition with an alternate, but identical, type so we have
    // to ensure that the original one is preserved.
    type: clone.type
  });
  ngDevMode && assertEqual(replacement, currentDef, "Expected definition to be merged in place");
  return { newDef: replacement, oldDef: clone };
}
function recreateMatchingLViews(importMeta, id, newDef, oldDef, rootLView) {
  ngDevMode && assertDefined(oldDef.tView, "Expected a component definition that has been instantiated at least once");
  const tView = rootLView[TVIEW];
  if (tView === oldDef.tView) {
    ngDevMode && assertComponentDef(oldDef.type);
    recreateLView(importMeta, id, newDef, oldDef, rootLView);
    return;
  }
  for (let i = HEADER_OFFSET; i < tView.bindingStartIndex; i++) {
    const current = rootLView[i];
    if (isLContainer(current)) {
      if (isLView(current[HOST])) {
        recreateMatchingLViews(importMeta, id, newDef, oldDef, current[HOST]);
      }
      for (let j = CONTAINER_HEADER_OFFSET; j < current.length; j++) {
        recreateMatchingLViews(importMeta, id, newDef, oldDef, current[j]);
      }
    } else if (isLView(current)) {
      recreateMatchingLViews(importMeta, id, newDef, oldDef, current);
    }
  }
}
function clearRendererCache(factory, def) {
  factory.componentReplaced?.(def.id);
}
function recreateLView(importMeta, id, newDef, oldDef, lView) {
  const instance = lView[CONTEXT];
  let host = lView[HOST];
  const parentLView = lView[PARENT];
  ngDevMode && assertLView(parentLView);
  const tNode = lView[T_HOST];
  ngDevMode && assertTNodeType(
    tNode,
    2
    /* TNodeType.Element */
  );
  ngDevMode && assertNotEqual(newDef, oldDef, "Expected different component definition");
  const zone = lView[INJECTOR].get(NgZone, null);
  const recreate = () => {
    if (oldDef.encapsulation === ViewEncapsulation.ShadowDom) {
      const newHost = host.cloneNode(false);
      host.replaceWith(newHost);
      host = newHost;
    }
    const newTView = getOrCreateComponentTView(newDef);
    const newLView = createLView(
      parentLView,
      newTView,
      instance,
      getInitialLViewFlagsFromDef(newDef),
      host,
      tNode,
      null,
      null,
      // The renderer will be created a bit further down once the old one is destroyed.
      null,
      null,
      null
    );
    replaceLViewInTree(parentLView, lView, newLView, tNode.index);
    destroyLView(lView[TVIEW], lView);
    const rendererFactory = lView[ENVIRONMENT].rendererFactory;
    clearRendererCache(rendererFactory, oldDef);
    newLView[RENDERER] = rendererFactory.createRenderer(host, newDef);
    removeViewFromDOM(lView[TVIEW], lView);
    resetProjectionState(tNode);
    renderView(newTView, newLView, instance);
    refreshView(newTView, newLView, newTView.template, instance);
  };
  if (zone === null) {
    executeWithInvalidateFallback(importMeta, id, recreate);
  } else {
    zone.run(() => executeWithInvalidateFallback(importMeta, id, recreate));
  }
}
function executeWithInvalidateFallback(importMeta, id, callback) {
  try {
    callback();
  } catch (e) {
    const error = e;
    if (id !== null && error.message) {
      const toLog = error.message + (error.stack ? "\n" + error.stack : "");
      importMeta?.hot?.send?.("angular:invalidate", { id, message: toLog, error: true });
    }
    throw e;
  }
}
function replaceLViewInTree(parentLView, oldLView, newLView, index) {
  for (let i = HEADER_OFFSET; i < parentLView[TVIEW].bindingStartIndex; i++) {
    const current = parentLView[i];
    if ((isLView(current) || isLContainer(current)) && current[NEXT] === oldLView) {
      current[NEXT] = newLView;
      break;
    }
  }
  if (parentLView[CHILD_HEAD] === oldLView) {
    parentLView[CHILD_HEAD] = newLView;
  }
  if (parentLView[CHILD_TAIL] === oldLView) {
    parentLView[CHILD_TAIL] = newLView;
  }
  newLView[NEXT] = oldLView[NEXT];
  oldLView[NEXT] = null;
  parentLView[index] = newLView;
}
function resetProjectionState(tNode) {
  if (tNode.projection !== null) {
    for (const current of tNode.projection) {
      if (isTNodeShape(current)) {
        current.projectionNext = null;
        current.flags &= ~2;
      }
    }
    tNode.projection = null;
  }
}
var angularCoreEnv = /* @__PURE__ */ (() => ({
  "\u0275\u0275attribute": \u0275\u0275attribute,
  "\u0275\u0275defineComponent": \u0275\u0275defineComponent,
  "\u0275\u0275defineDirective": \u0275\u0275defineDirective,
  "\u0275\u0275defineInjectable": \u0275\u0275defineInjectable,
  "\u0275\u0275defineInjector": \u0275\u0275defineInjector,
  "\u0275\u0275defineNgModule": \u0275\u0275defineNgModule,
  "\u0275\u0275definePipe": \u0275\u0275definePipe,
  "\u0275\u0275directiveInject": \u0275\u0275directiveInject,
  "\u0275\u0275getInheritedFactory": \u0275\u0275getInheritedFactory,
  "\u0275\u0275inject": \u0275\u0275inject,
  "\u0275\u0275injectAttribute": \u0275\u0275injectAttribute,
  "\u0275\u0275invalidFactory": \u0275\u0275invalidFactory,
  "\u0275\u0275invalidFactoryDep": \u0275\u0275invalidFactoryDep,
  "\u0275\u0275templateRefExtractor": \u0275\u0275templateRefExtractor,
  "\u0275\u0275resetView": \u0275\u0275resetView,
  "\u0275\u0275HostDirectivesFeature": \u0275\u0275HostDirectivesFeature,
  "\u0275\u0275NgOnChangesFeature": \u0275\u0275NgOnChangesFeature,
  "\u0275\u0275ProvidersFeature": \u0275\u0275ProvidersFeature,
  "\u0275\u0275CopyDefinitionFeature": \u0275\u0275CopyDefinitionFeature,
  "\u0275\u0275InheritDefinitionFeature": \u0275\u0275InheritDefinitionFeature,
  "\u0275\u0275ExternalStylesFeature": \u0275\u0275ExternalStylesFeature,
  "\u0275\u0275nextContext": \u0275\u0275nextContext,
  "\u0275\u0275namespaceHTML": \u0275\u0275namespaceHTML,
  "\u0275\u0275namespaceMathML": \u0275\u0275namespaceMathML,
  "\u0275\u0275namespaceSVG": \u0275\u0275namespaceSVG,
  "\u0275\u0275enableBindings": \u0275\u0275enableBindings,
  "\u0275\u0275disableBindings": \u0275\u0275disableBindings,
  "\u0275\u0275elementStart": \u0275\u0275elementStart,
  "\u0275\u0275elementEnd": \u0275\u0275elementEnd,
  "\u0275\u0275element": \u0275\u0275element,
  "\u0275\u0275elementContainerStart": \u0275\u0275elementContainerStart,
  "\u0275\u0275elementContainerEnd": \u0275\u0275elementContainerEnd,
  "\u0275\u0275domElement": \u0275\u0275domElement,
  "\u0275\u0275domElementStart": \u0275\u0275domElementStart,
  "\u0275\u0275domElementEnd": \u0275\u0275domElementEnd,
  "\u0275\u0275domElementContainer": \u0275\u0275domElementContainer,
  "\u0275\u0275domElementContainerStart": \u0275\u0275domElementContainerStart,
  "\u0275\u0275domElementContainerEnd": \u0275\u0275domElementContainerEnd,
  "\u0275\u0275domTemplate": \u0275\u0275domTemplate,
  "\u0275\u0275domListener": \u0275\u0275domListener,
  "\u0275\u0275elementContainer": \u0275\u0275elementContainer,
  "\u0275\u0275pureFunction0": \u0275\u0275pureFunction0,
  "\u0275\u0275pureFunction1": \u0275\u0275pureFunction1,
  "\u0275\u0275pureFunction2": \u0275\u0275pureFunction2,
  "\u0275\u0275pureFunction3": \u0275\u0275pureFunction3,
  "\u0275\u0275pureFunction4": \u0275\u0275pureFunction4,
  "\u0275\u0275pureFunction5": \u0275\u0275pureFunction5,
  "\u0275\u0275pureFunction6": \u0275\u0275pureFunction6,
  "\u0275\u0275pureFunction7": \u0275\u0275pureFunction7,
  "\u0275\u0275pureFunction8": \u0275\u0275pureFunction8,
  "\u0275\u0275pureFunctionV": \u0275\u0275pureFunctionV,
  "\u0275\u0275getCurrentView": \u0275\u0275getCurrentView,
  "\u0275\u0275restoreView": \u0275\u0275restoreView,
  "\u0275\u0275listener": \u0275\u0275listener,
  "\u0275\u0275projection": \u0275\u0275projection,
  "\u0275\u0275syntheticHostProperty": \u0275\u0275syntheticHostProperty,
  "\u0275\u0275syntheticHostListener": \u0275\u0275syntheticHostListener,
  "\u0275\u0275pipeBind1": \u0275\u0275pipeBind1,
  "\u0275\u0275pipeBind2": \u0275\u0275pipeBind2,
  "\u0275\u0275pipeBind3": \u0275\u0275pipeBind3,
  "\u0275\u0275pipeBind4": \u0275\u0275pipeBind4,
  "\u0275\u0275pipeBindV": \u0275\u0275pipeBindV,
  "\u0275\u0275projectionDef": \u0275\u0275projectionDef,
  "\u0275\u0275domProperty": \u0275\u0275domProperty,
  "\u0275\u0275property": \u0275\u0275property,
  "\u0275\u0275pipe": \u0275\u0275pipe,
  "\u0275\u0275queryRefresh": \u0275\u0275queryRefresh,
  "\u0275\u0275queryAdvance": \u0275\u0275queryAdvance,
  "\u0275\u0275viewQuery": \u0275\u0275viewQuery,
  "\u0275\u0275viewQuerySignal": \u0275\u0275viewQuerySignal,
  "\u0275\u0275loadQuery": \u0275\u0275loadQuery,
  "\u0275\u0275contentQuery": \u0275\u0275contentQuery,
  "\u0275\u0275contentQuerySignal": \u0275\u0275contentQuerySignal,
  "\u0275\u0275reference": \u0275\u0275reference,
  "\u0275\u0275classMap": \u0275\u0275classMap,
  "\u0275\u0275styleMap": \u0275\u0275styleMap,
  "\u0275\u0275styleProp": \u0275\u0275styleProp,
  "\u0275\u0275classProp": \u0275\u0275classProp,
  "\u0275\u0275advance": \u0275\u0275advance,
  "\u0275\u0275template": \u0275\u0275template,
  "\u0275\u0275conditional": \u0275\u0275conditional,
  "\u0275\u0275conditionalCreate": \u0275\u0275conditionalCreate,
  "\u0275\u0275conditionalBranchCreate": \u0275\u0275conditionalBranchCreate,
  "\u0275\u0275defer": \u0275\u0275defer,
  "\u0275\u0275deferWhen": \u0275\u0275deferWhen,
  "\u0275\u0275deferOnIdle": \u0275\u0275deferOnIdle,
  "\u0275\u0275deferOnImmediate": \u0275\u0275deferOnImmediate,
  "\u0275\u0275deferOnTimer": \u0275\u0275deferOnTimer,
  "\u0275\u0275deferOnHover": \u0275\u0275deferOnHover,
  "\u0275\u0275deferOnInteraction": \u0275\u0275deferOnInteraction,
  "\u0275\u0275deferOnViewport": \u0275\u0275deferOnViewport,
  "\u0275\u0275deferPrefetchWhen": \u0275\u0275deferPrefetchWhen,
  "\u0275\u0275deferPrefetchOnIdle": \u0275\u0275deferPrefetchOnIdle,
  "\u0275\u0275deferPrefetchOnImmediate": \u0275\u0275deferPrefetchOnImmediate,
  "\u0275\u0275deferPrefetchOnTimer": \u0275\u0275deferPrefetchOnTimer,
  "\u0275\u0275deferPrefetchOnHover": \u0275\u0275deferPrefetchOnHover,
  "\u0275\u0275deferPrefetchOnInteraction": \u0275\u0275deferPrefetchOnInteraction,
  "\u0275\u0275deferPrefetchOnViewport": \u0275\u0275deferPrefetchOnViewport,
  "\u0275\u0275deferHydrateWhen": \u0275\u0275deferHydrateWhen,
  "\u0275\u0275deferHydrateNever": \u0275\u0275deferHydrateNever,
  "\u0275\u0275deferHydrateOnIdle": \u0275\u0275deferHydrateOnIdle,
  "\u0275\u0275deferHydrateOnImmediate": \u0275\u0275deferHydrateOnImmediate,
  "\u0275\u0275deferHydrateOnTimer": \u0275\u0275deferHydrateOnTimer,
  "\u0275\u0275deferHydrateOnHover": \u0275\u0275deferHydrateOnHover,
  "\u0275\u0275deferHydrateOnInteraction": \u0275\u0275deferHydrateOnInteraction,
  "\u0275\u0275deferHydrateOnViewport": \u0275\u0275deferHydrateOnViewport,
  "\u0275\u0275deferEnableTimerScheduling": \u0275\u0275deferEnableTimerScheduling,
  "\u0275\u0275repeater": \u0275\u0275repeater,
  "\u0275\u0275repeaterCreate": \u0275\u0275repeaterCreate,
  "\u0275\u0275repeaterTrackByIndex": \u0275\u0275repeaterTrackByIndex,
  "\u0275\u0275repeaterTrackByIdentity": \u0275\u0275repeaterTrackByIdentity,
  "\u0275\u0275componentInstance": \u0275\u0275componentInstance,
  "\u0275\u0275text": \u0275\u0275text,
  "\u0275\u0275textInterpolate": \u0275\u0275textInterpolate,
  "\u0275\u0275textInterpolate1": \u0275\u0275textInterpolate1,
  "\u0275\u0275textInterpolate2": \u0275\u0275textInterpolate2,
  "\u0275\u0275textInterpolate3": \u0275\u0275textInterpolate3,
  "\u0275\u0275textInterpolate4": \u0275\u0275textInterpolate4,
  "\u0275\u0275textInterpolate5": \u0275\u0275textInterpolate5,
  "\u0275\u0275textInterpolate6": \u0275\u0275textInterpolate6,
  "\u0275\u0275textInterpolate7": \u0275\u0275textInterpolate7,
  "\u0275\u0275textInterpolate8": \u0275\u0275textInterpolate8,
  "\u0275\u0275textInterpolateV": \u0275\u0275textInterpolateV,
  "\u0275\u0275i18n": \u0275\u0275i18n,
  "\u0275\u0275i18nAttributes": \u0275\u0275i18nAttributes,
  "\u0275\u0275i18nExp": \u0275\u0275i18nExp,
  "\u0275\u0275i18nStart": \u0275\u0275i18nStart,
  "\u0275\u0275i18nEnd": \u0275\u0275i18nEnd,
  "\u0275\u0275i18nApply": \u0275\u0275i18nApply,
  "\u0275\u0275i18nPostprocess": \u0275\u0275i18nPostprocess,
  "\u0275\u0275resolveWindow": \u0275\u0275resolveWindow,
  "\u0275\u0275resolveDocument": \u0275\u0275resolveDocument,
  "\u0275\u0275resolveBody": \u0275\u0275resolveBody,
  "\u0275\u0275setComponentScope": \u0275\u0275setComponentScope,
  "\u0275\u0275setNgModuleScope": \u0275\u0275setNgModuleScope,
  "\u0275\u0275registerNgModuleType": registerNgModuleType,
  "\u0275\u0275getComponentDepsFactory": \u0275\u0275getComponentDepsFactory,
  "\u0275setClassDebugInfo": \u0275setClassDebugInfo,
  "\u0275\u0275declareLet": \u0275\u0275declareLet,
  "\u0275\u0275storeLet": \u0275\u0275storeLet,
  "\u0275\u0275readContextLet": \u0275\u0275readContextLet,
  "\u0275\u0275attachSourceLocations": \u0275\u0275attachSourceLocations,
  "\u0275\u0275interpolate": \u0275\u0275interpolate,
  "\u0275\u0275interpolate1": \u0275\u0275interpolate1,
  "\u0275\u0275interpolate2": \u0275\u0275interpolate2,
  "\u0275\u0275interpolate3": \u0275\u0275interpolate3,
  "\u0275\u0275interpolate4": \u0275\u0275interpolate4,
  "\u0275\u0275interpolate5": \u0275\u0275interpolate5,
  "\u0275\u0275interpolate6": \u0275\u0275interpolate6,
  "\u0275\u0275interpolate7": \u0275\u0275interpolate7,
  "\u0275\u0275interpolate8": \u0275\u0275interpolate8,
  "\u0275\u0275interpolateV": \u0275\u0275interpolateV,
  "\u0275\u0275sanitizeHtml": \u0275\u0275sanitizeHtml,
  "\u0275\u0275sanitizeStyle": \u0275\u0275sanitizeStyle,
  "\u0275\u0275sanitizeResourceUrl": \u0275\u0275sanitizeResourceUrl,
  "\u0275\u0275sanitizeScript": \u0275\u0275sanitizeScript,
  "\u0275\u0275sanitizeUrl": \u0275\u0275sanitizeUrl,
  "\u0275\u0275sanitizeUrlOrResourceUrl": \u0275\u0275sanitizeUrlOrResourceUrl,
  "\u0275\u0275trustConstantHtml": \u0275\u0275trustConstantHtml,
  "\u0275\u0275trustConstantResourceUrl": \u0275\u0275trustConstantResourceUrl,
  "\u0275\u0275validateIframeAttribute": \u0275\u0275validateIframeAttribute,
  "forwardRef": forwardRef,
  "resolveForwardRef": resolveForwardRef,
  "\u0275\u0275twoWayProperty": \u0275\u0275twoWayProperty,
  "\u0275\u0275twoWayBindingSet": \u0275\u0275twoWayBindingSet,
  "\u0275\u0275twoWayListener": \u0275\u0275twoWayListener,
  "\u0275\u0275replaceMetadata": \u0275\u0275replaceMetadata,
  "\u0275\u0275getReplaceMetadataURL": \u0275\u0275getReplaceMetadataURL
}))();
var jitOptions = null;
function setJitOptions(options) {
  if (jitOptions !== null) {
    if (options.defaultEncapsulation !== jitOptions.defaultEncapsulation) {
      ngDevMode && console.error("Provided value for `defaultEncapsulation` can not be changed once it has been set.");
      return;
    }
    if (options.preserveWhitespaces !== jitOptions.preserveWhitespaces) {
      ngDevMode && console.error("Provided value for `preserveWhitespaces` can not be changed once it has been set.");
      return;
    }
  }
  jitOptions = options;
}
function getJitOptions() {
  return jitOptions;
}
var moduleQueue = [];
function enqueueModuleForDelayedScoping(moduleType, ngModule) {
  moduleQueue.push({ moduleType, ngModule });
}
var flushingModuleQueue = false;
function flushModuleScopingQueueAsMuchAsPossible() {
  if (!flushingModuleQueue) {
    flushingModuleQueue = true;
    try {
      for (let i = moduleQueue.length - 1; i >= 0; i--) {
        const { moduleType, ngModule } = moduleQueue[i];
        if (ngModule.declarations && ngModule.declarations.every(isResolvedDeclaration)) {
          moduleQueue.splice(i, 1);
          setScopeOnDeclaredComponents(moduleType, ngModule);
        }
      }
    } finally {
      flushingModuleQueue = false;
    }
  }
}
function isResolvedDeclaration(declaration) {
  if (Array.isArray(declaration)) {
    return declaration.every(isResolvedDeclaration);
  }
  return !!resolveForwardRef(declaration);
}
function compileNgModule(moduleType, ngModule = {}) {
  compileNgModuleDefs(moduleType, ngModule);
  if (ngModule.id !== void 0) {
    registerNgModuleType(moduleType, ngModule.id);
  }
  enqueueModuleForDelayedScoping(moduleType, ngModule);
}
function compileNgModuleDefs(moduleType, ngModule, allowDuplicateDeclarationsInRoot = false) {
  ngDevMode && assertDefined(moduleType, "Required value moduleType");
  ngDevMode && assertDefined(ngModule, "Required value ngModule");
  const declarations = flatten(ngModule.declarations || EMPTY_ARRAY);
  let ngModuleDef = null;
  Object.defineProperty(moduleType, NG_MOD_DEF, {
    configurable: true,
    get: () => {
      if (ngModuleDef === null) {
        if (ngDevMode && ngModule.imports && ngModule.imports.indexOf(moduleType) > -1) {
          throw new Error(`'${stringifyForError(moduleType)}' module can't import itself`);
        }
        const compiler = getCompilerFacade({
          usage: 0,
          kind: "NgModule",
          type: moduleType
        });
        ngModuleDef = compiler.compileNgModule(angularCoreEnv, `ng:///${moduleType.name}/\u0275mod.js`, {
          type: moduleType,
          bootstrap: flatten(ngModule.bootstrap || EMPTY_ARRAY).map(resolveForwardRef),
          declarations: declarations.map(resolveForwardRef),
          imports: flatten(ngModule.imports || EMPTY_ARRAY).map(resolveForwardRef).map(expandModuleWithProviders),
          exports: flatten(ngModule.exports || EMPTY_ARRAY).map(resolveForwardRef).map(expandModuleWithProviders),
          schemas: ngModule.schemas ? flatten(ngModule.schemas) : null,
          id: ngModule.id || null
        });
        if (!ngModuleDef.schemas) {
          ngModuleDef.schemas = [];
        }
      }
      return ngModuleDef;
    }
  });
  let ngFactoryDef = null;
  Object.defineProperty(moduleType, NG_FACTORY_DEF, {
    get: () => {
      if (ngFactoryDef === null) {
        const compiler = getCompilerFacade({
          usage: 0,
          kind: "NgModule",
          type: moduleType
        });
        ngFactoryDef = compiler.compileFactory(angularCoreEnv, `ng:///${moduleType.name}/\u0275fac.js`, {
          name: moduleType.name,
          type: moduleType,
          deps: reflectDependencies(moduleType),
          target: compiler.FactoryTarget.NgModule,
          typeArgumentCount: 0
        });
      }
      return ngFactoryDef;
    },
    // Make the property configurable in dev mode to allow overriding in tests
    configurable: !!ngDevMode
  });
  let ngInjectorDef = null;
  Object.defineProperty(moduleType, NG_INJ_DEF, {
    get: () => {
      if (ngInjectorDef === null) {
        ngDevMode && verifySemanticsOfNgModuleDef(moduleType, allowDuplicateDeclarationsInRoot);
        const meta = {
          name: moduleType.name,
          type: moduleType,
          providers: ngModule.providers || EMPTY_ARRAY,
          imports: [
            (ngModule.imports || EMPTY_ARRAY).map(resolveForwardRef),
            (ngModule.exports || EMPTY_ARRAY).map(resolveForwardRef)
          ]
        };
        const compiler = getCompilerFacade({
          usage: 0,
          kind: "NgModule",
          type: moduleType
        });
        ngInjectorDef = compiler.compileInjector(angularCoreEnv, `ng:///${moduleType.name}/\u0275inj.js`, meta);
      }
      return ngInjectorDef;
    },
    // Make the property configurable in dev mode to allow overriding in tests
    configurable: !!ngDevMode
  });
}
function generateStandaloneInDeclarationsError(type, location2) {
  const prefix = `Unexpected "${stringifyForError(type)}" found in the "declarations" array of the`;
  const suffix = `"${stringifyForError(type)}" is marked as standalone and can't be declared in any NgModule - did you intend to import it instead (by adding it to the "imports" array)?`;
  return `${prefix} ${location2}, ${suffix}`;
}
function verifySemanticsOfNgModuleDef(moduleType, allowDuplicateDeclarationsInRoot, importingModule) {
  if (verifiedNgModule.get(moduleType))
    return;
  if (isStandalone(moduleType))
    return;
  verifiedNgModule.set(moduleType, true);
  moduleType = resolveForwardRef(moduleType);
  let ngModuleDef;
  if (importingModule) {
    ngModuleDef = getNgModuleDef(moduleType);
    if (!ngModuleDef) {
      throw new Error(`Unexpected value '${moduleType.name}' imported by the module '${importingModule.name}'. Please add an @NgModule annotation.`);
    }
  } else {
    ngModuleDef = getNgModuleDefOrThrow(moduleType);
  }
  const errors = [];
  const declarations = maybeUnwrapFn(ngModuleDef.declarations);
  const imports = maybeUnwrapFn(ngModuleDef.imports);
  flatten(imports).map(unwrapModuleWithProvidersImports).forEach((modOrStandaloneCmpt) => {
    verifySemanticsOfNgModuleImport(modOrStandaloneCmpt, moduleType);
    verifySemanticsOfNgModuleDef(modOrStandaloneCmpt, false, moduleType);
  });
  const exports = maybeUnwrapFn(ngModuleDef.exports);
  declarations.forEach(verifyDeclarationsHaveDefinitions);
  declarations.forEach(verifyDirectivesHaveSelector);
  declarations.forEach((declarationType) => verifyNotStandalone(declarationType, moduleType));
  const combinedDeclarations = [
    ...declarations.map(resolveForwardRef),
    ...flatten(imports.map(computeCombinedExports)).map(resolveForwardRef)
  ];
  exports.forEach(verifyExportsAreDeclaredOrReExported);
  declarations.forEach((decl) => verifyDeclarationIsUnique(decl, allowDuplicateDeclarationsInRoot));
  const ngModule = getAnnotation(moduleType, "NgModule");
  if (ngModule) {
    ngModule.imports && flatten(ngModule.imports).map(unwrapModuleWithProvidersImports).forEach((mod) => {
      verifySemanticsOfNgModuleImport(mod, moduleType);
      verifySemanticsOfNgModuleDef(mod, false, moduleType);
    });
    ngModule.bootstrap && deepForEach(ngModule.bootstrap, verifyCorrectBootstrapType);
    ngModule.bootstrap && deepForEach(ngModule.bootstrap, verifyComponentIsPartOfNgModule);
  }
  if (errors.length) {
    throw new Error(errors.join("\n"));
  }
  function verifyDeclarationsHaveDefinitions(type) {
    type = resolveForwardRef(type);
    const def = getComponentDef(type) || getDirectiveDef(type) || getPipeDef(type);
    if (!def) {
      errors.push(`Unexpected value '${stringifyForError(type)}' declared by the module '${stringifyForError(moduleType)}'. Please add a @Pipe/@Directive/@Component annotation.`);
    }
  }
  function verifyDirectivesHaveSelector(type) {
    type = resolveForwardRef(type);
    const def = getDirectiveDef(type);
    if (!getComponentDef(type) && def && def.selectors.length == 0) {
      errors.push(`Directive ${stringifyForError(type)} has no selector, please add it!`);
    }
  }
  function verifyNotStandalone(type, moduleType2) {
    type = resolveForwardRef(type);
    const def = getComponentDef(type) || getDirectiveDef(type) || getPipeDef(type);
    if (def?.standalone) {
      const location2 = `"${stringifyForError(moduleType2)}" NgModule`;
      errors.push(generateStandaloneInDeclarationsError(type, location2));
    }
  }
  function verifyExportsAreDeclaredOrReExported(type) {
    type = resolveForwardRef(type);
    const kind = getComponentDef(type) && "component" || getDirectiveDef(type) && "directive" || getPipeDef(type) && "pipe";
    if (kind) {
      if (combinedDeclarations.lastIndexOf(type) === -1) {
        errors.push(`Can't export ${kind} ${stringifyForError(type)} from ${stringifyForError(moduleType)} as it was neither declared nor imported!`);
      }
    }
  }
  function verifyDeclarationIsUnique(type, suppressErrors) {
    type = resolveForwardRef(type);
    const existingModule = ownerNgModule.get(type);
    if (existingModule && existingModule !== moduleType) {
      if (!suppressErrors) {
        const modules2 = [existingModule, moduleType].map(stringifyForError).sort();
        errors.push(`Type ${stringifyForError(type)} is part of the declarations of 2 modules: ${modules2[0]} and ${modules2[1]}! Please consider moving ${stringifyForError(type)} to a higher module that imports ${modules2[0]} and ${modules2[1]}. You can also create a new NgModule that exports and includes ${stringifyForError(type)} then import that NgModule in ${modules2[0]} and ${modules2[1]}.`);
      }
    } else {
      ownerNgModule.set(type, moduleType);
    }
  }
  function verifyComponentIsPartOfNgModule(type) {
    type = resolveForwardRef(type);
    const existingModule = ownerNgModule.get(type);
    if (!existingModule && !isStandalone(type)) {
      errors.push(`Component ${stringifyForError(type)} is not part of any NgModule or the module has not been imported into your module.`);
    }
  }
  function verifyCorrectBootstrapType(type) {
    type = resolveForwardRef(type);
    if (!getComponentDef(type)) {
      errors.push(`${stringifyForError(type)} cannot be used as an entry component.`);
    }
    if (isStandalone(type)) {
      errors.push(`The \`${stringifyForError(type)}\` class is a standalone component, which can not be used in the \`@NgModule.bootstrap\` array. Use the \`bootstrapApplication\` function for bootstrap instead.`);
    }
  }
  function verifySemanticsOfNgModuleImport(type, importingModule2) {
    type = resolveForwardRef(type);
    const directiveDef = getComponentDef(type) || getDirectiveDef(type);
    if (directiveDef !== null && !directiveDef.standalone) {
      throw new Error(`Unexpected directive '${type.name}' imported by the module '${importingModule2.name}'. Please add an @NgModule annotation.`);
    }
    const pipeDef = getPipeDef(type);
    if (pipeDef !== null && !pipeDef.standalone) {
      throw new Error(`Unexpected pipe '${type.name}' imported by the module '${importingModule2.name}'. Please add an @NgModule annotation.`);
    }
  }
}
function unwrapModuleWithProvidersImports(typeOrWithProviders) {
  typeOrWithProviders = resolveForwardRef(typeOrWithProviders);
  return typeOrWithProviders.ngModule || typeOrWithProviders;
}
function getAnnotation(type, name2) {
  let annotation = null;
  collect(type.__annotations__);
  collect(type.decorators);
  return annotation;
  function collect(annotations) {
    if (annotations) {
      annotations.forEach(readAnnotation);
    }
  }
  function readAnnotation(decorator) {
    if (!annotation) {
      const proto = Object.getPrototypeOf(decorator);
      if (proto.ngMetadataName == name2) {
        annotation = decorator;
      } else if (decorator.type) {
        const proto2 = Object.getPrototypeOf(decorator.type);
        if (proto2.ngMetadataName == name2) {
          annotation = decorator.args[0];
        }
      }
    }
  }
}
var ownerNgModule = /* @__PURE__ */ new WeakMap();
var verifiedNgModule = /* @__PURE__ */ new WeakMap();
function computeCombinedExports(type) {
  type = resolveForwardRef(type);
  const ngModuleDef = getNgModuleDef(type);
  if (ngModuleDef === null) {
    return [type];
  }
  return flatten(maybeUnwrapFn(ngModuleDef.exports).map((type2) => {
    const ngModuleDef2 = getNgModuleDef(type2);
    if (ngModuleDef2) {
      verifySemanticsOfNgModuleDef(type2, false);
      return computeCombinedExports(type2);
    } else {
      return type2;
    }
  }));
}
function setScopeOnDeclaredComponents(moduleType, ngModule) {
  const declarations = flatten(ngModule.declarations || EMPTY_ARRAY);
  const transitiveScopes = transitiveScopesFor(moduleType);
  declarations.forEach((declaration) => {
    declaration = resolveForwardRef(declaration);
    if (declaration.hasOwnProperty(NG_COMP_DEF)) {
      const component = declaration;
      const componentDef = getComponentDef(component);
      patchComponentDefWithScope(componentDef, transitiveScopes);
    } else if (!declaration.hasOwnProperty(NG_DIR_DEF) && !declaration.hasOwnProperty(NG_PIPE_DEF)) {
      declaration.ngSelectorScope = moduleType;
    }
  });
}
function patchComponentDefWithScope(componentDef, transitiveScopes) {
  componentDef.directiveDefs = () => Array.from(transitiveScopes.compilation.directives).map((dir) => dir.hasOwnProperty(NG_COMP_DEF) ? getComponentDef(dir) : getDirectiveDef(dir)).filter((def) => !!def);
  componentDef.pipeDefs = () => Array.from(transitiveScopes.compilation.pipes).map((pipe2) => getPipeDef(pipe2));
  componentDef.schemas = transitiveScopes.schemas;
  componentDef.tView = null;
}
function transitiveScopesFor(type) {
  if (isNgModule(type)) {
    const scope = depsTracker.getNgModuleScope(type);
    const def = getNgModuleDefOrThrow(type);
    return __spreadValues({
      schemas: def.schemas || null
    }, scope);
  } else if (isStandalone(type)) {
    const directiveDef = getComponentDef(type) || getDirectiveDef(type);
    if (directiveDef !== null) {
      return {
        schemas: null,
        compilation: {
          directives: /* @__PURE__ */ new Set(),
          pipes: /* @__PURE__ */ new Set()
        },
        exported: {
          directives: /* @__PURE__ */ new Set([type]),
          pipes: /* @__PURE__ */ new Set()
        }
      };
    }
    const pipeDef = getPipeDef(type);
    if (pipeDef !== null) {
      return {
        schemas: null,
        compilation: {
          directives: /* @__PURE__ */ new Set(),
          pipes: /* @__PURE__ */ new Set()
        },
        exported: {
          directives: /* @__PURE__ */ new Set(),
          pipes: /* @__PURE__ */ new Set([type])
        }
      };
    }
  }
  throw new Error(`${type.name} does not have a module def (\u0275mod property)`);
}
function expandModuleWithProviders(value) {
  if (isModuleWithProviders(value)) {
    return value.ngModule;
  }
  return value;
}
var compilationDepth = 0;
function compileComponent(type, metadata) {
  (typeof ngDevMode === "undefined" || ngDevMode) && initNgDevMode();
  let ngComponentDef = null;
  maybeQueueResolutionOfComponentResources(type, metadata);
  addDirectiveFactoryDef(type, metadata);
  Object.defineProperty(type, NG_COMP_DEF, {
    get: () => {
      if (ngComponentDef === null) {
        const compiler = getCompilerFacade({
          usage: 0,
          kind: "component",
          type
        });
        if (componentNeedsResolution(metadata)) {
          const error = [`Component '${type.name}' is not resolved:`];
          if (metadata.templateUrl) {
            error.push(` - templateUrl: ${metadata.templateUrl}`);
          }
          if (metadata.styleUrls && metadata.styleUrls.length) {
            error.push(` - styleUrls: ${JSON.stringify(metadata.styleUrls)}`);
          }
          if (metadata.styleUrl) {
            error.push(` - styleUrl: ${metadata.styleUrl}`);
          }
          error.push(`Did you run and wait for 'resolveComponentResources()'?`);
          throw new Error(error.join("\n"));
        }
        const options = getJitOptions();
        let preserveWhitespaces = metadata.preserveWhitespaces;
        if (preserveWhitespaces === void 0) {
          if (options !== null && options.preserveWhitespaces !== void 0) {
            preserveWhitespaces = options.preserveWhitespaces;
          } else {
            preserveWhitespaces = false;
          }
        }
        let encapsulation = metadata.encapsulation;
        if (encapsulation === void 0) {
          if (options !== null && options.defaultEncapsulation !== void 0) {
            encapsulation = options.defaultEncapsulation;
          } else {
            encapsulation = ViewEncapsulation.Emulated;
          }
        }
        const templateUrl = metadata.templateUrl || `ng:///${type.name}/template.html`;
        const baseMeta = directiveMetadata(type, metadata);
        const meta = __spreadProps(__spreadValues({}, baseMeta), {
          typeSourceSpan: compiler.createParseSourceSpan("Component", type.name, templateUrl),
          template: metadata.template || "",
          preserveWhitespaces,
          styles: typeof metadata.styles === "string" ? [metadata.styles] : metadata.styles || EMPTY_ARRAY,
          animations: metadata.animations,
          // JIT components are always compiled against an empty set of `declarations`. Instead, the
          // `directiveDefs` and `pipeDefs` are updated at a later point:
          //  * for NgModule-based components, they're set when the NgModule which declares the
          //    component resolves in the module scoping queue
          //  * for standalone components, they're set just below, after `compileComponent`.
          declarations: [],
          changeDetection: metadata.changeDetection,
          encapsulation,
          interpolation: metadata.interpolation,
          viewProviders: metadata.viewProviders || null,
          // We can't inspect whether any of the dependencies are actually directives, because they
          // get patched on after compilation. That's why in JIT mode we consider that any
          // dependency might be a directive dependency.
          hasDirectiveDependencies: !baseMeta.isStandalone || metadata.imports != null && metadata.imports.length > 0
        });
        compilationDepth++;
        try {
          if (meta.usesInheritance) {
            addDirectiveDefToUndecoratedParents(type);
          }
          ngComponentDef = compiler.compileComponent(angularCoreEnv, templateUrl, meta);
          if (meta.isStandalone) {
            const imports = flatten(metadata.imports || EMPTY_ARRAY);
            const { directiveDefs, pipeDefs } = getStandaloneDefFunctions(type, imports);
            ngComponentDef.directiveDefs = directiveDefs;
            ngComponentDef.pipeDefs = pipeDefs;
            ngComponentDef.dependencies = () => imports.map(resolveForwardRef);
          }
        } finally {
          compilationDepth--;
        }
        if (compilationDepth === 0) {
          flushModuleScopingQueueAsMuchAsPossible();
        }
        if (hasSelectorScope(type)) {
          const scopes = transitiveScopesFor(type.ngSelectorScope);
          patchComponentDefWithScope(ngComponentDef, scopes);
        }
        if (metadata.schemas) {
          if (meta.isStandalone) {
            ngComponentDef.schemas = metadata.schemas;
          } else {
            throw new Error(`The 'schemas' was specified for the ${stringifyForError(type)} but is only valid on a component that is standalone.`);
          }
        } else if (meta.isStandalone) {
          ngComponentDef.schemas = [];
        }
      }
      return ngComponentDef;
    },
    set: (def) => {
      ngComponentDef = def;
    },
    // Make the property configurable in dev mode to allow overriding in tests
    configurable: !!ngDevMode
  });
}
function getStandaloneDefFunctions(type, imports) {
  const directiveDefs = () => {
    if (ngDevMode) {
      for (const rawDep of imports) {
        verifyStandaloneImport(rawDep, type);
      }
    }
    if (!isComponent(type)) {
      return [];
    }
    const scope = depsTracker.getStandaloneComponentScope(type, imports);
    return [...scope.compilation.directives].map((p) => getComponentDef(p) || getDirectiveDef(p)).filter((d) => d !== null);
  };
  const pipeDefs = () => {
    if (ngDevMode) {
      for (const rawDep of imports) {
        verifyStandaloneImport(rawDep, type);
      }
    }
    if (!isComponent(type)) {
      return [];
    }
    const scope = depsTracker.getStandaloneComponentScope(type, imports);
    return [...scope.compilation.pipes].map((p) => getPipeDef(p)).filter((d) => d !== null);
  };
  return {
    directiveDefs,
    pipeDefs
  };
}
function hasSelectorScope(component) {
  return component.ngSelectorScope !== void 0;
}
function compileDirective(type, directive) {
  let ngDirectiveDef = null;
  addDirectiveFactoryDef(type, directive || {});
  Object.defineProperty(type, NG_DIR_DEF, {
    get: () => {
      if (ngDirectiveDef === null) {
        const meta = getDirectiveMetadata(type, directive || {});
        const compiler = getCompilerFacade({
          usage: 0,
          kind: "directive",
          type
        });
        ngDirectiveDef = compiler.compileDirective(angularCoreEnv, meta.sourceMapUrl, meta.metadata);
      }
      return ngDirectiveDef;
    },
    // Make the property configurable in dev mode to allow overriding in tests
    configurable: !!ngDevMode
  });
}
function getDirectiveMetadata(type, metadata) {
  const name2 = type && type.name;
  const sourceMapUrl = `ng:///${name2}/\u0275dir.js`;
  const compiler = getCompilerFacade({ usage: 0, kind: "directive", type });
  const facade = directiveMetadata(type, metadata);
  facade.typeSourceSpan = compiler.createParseSourceSpan("Directive", name2, sourceMapUrl);
  if (facade.usesInheritance) {
    addDirectiveDefToUndecoratedParents(type);
  }
  return { metadata: facade, sourceMapUrl };
}
function addDirectiveFactoryDef(type, metadata) {
  let ngFactoryDef = null;
  Object.defineProperty(type, NG_FACTORY_DEF, {
    get: () => {
      if (ngFactoryDef === null) {
        const meta = getDirectiveMetadata(type, metadata);
        const compiler = getCompilerFacade({
          usage: 0,
          kind: "directive",
          type
        });
        ngFactoryDef = compiler.compileFactory(angularCoreEnv, `ng:///${type.name}/\u0275fac.js`, {
          name: meta.metadata.name,
          type: meta.metadata.type,
          typeArgumentCount: 0,
          deps: reflectDependencies(type),
          target: compiler.FactoryTarget.Directive
        });
      }
      return ngFactoryDef;
    },
    // Make the property configurable in dev mode to allow overriding in tests
    configurable: !!ngDevMode
  });
}
function extendsDirectlyFromObject(type) {
  return Object.getPrototypeOf(type.prototype) === Object.prototype;
}
function directiveMetadata(type, metadata) {
  const reflect = getReflect();
  const propMetadata = reflect.ownPropMetadata(type);
  return {
    name: type.name,
    type,
    selector: metadata.selector !== void 0 ? metadata.selector : null,
    host: metadata.host || EMPTY_OBJ,
    propMetadata,
    inputs: metadata.inputs || EMPTY_ARRAY,
    outputs: metadata.outputs || EMPTY_ARRAY,
    queries: extractQueriesMetadata(type, propMetadata, isContentQuery),
    lifecycle: { usesOnChanges: reflect.hasLifecycleHook(type, "ngOnChanges") },
    typeSourceSpan: null,
    usesInheritance: !extendsDirectlyFromObject(type),
    exportAs: extractExportAs(metadata.exportAs),
    providers: metadata.providers || null,
    viewQueries: extractQueriesMetadata(type, propMetadata, isViewQuery),
    isStandalone: metadata.standalone === void 0 ? true : !!metadata.standalone,
    isSignal: !!metadata.signals,
    hostDirectives: metadata.hostDirectives?.map((directive) => typeof directive === "function" ? { directive } : directive) || null
  };
}
function addDirectiveDefToUndecoratedParents(type) {
  const objPrototype = Object.prototype;
  let parent = Object.getPrototypeOf(type.prototype).constructor;
  while (parent && parent !== objPrototype) {
    if (!getDirectiveDef(parent) && !getComponentDef(parent) && shouldAddAbstractDirective(parent)) {
      compileDirective(parent, null);
    }
    parent = Object.getPrototypeOf(parent);
  }
}
function convertToR3QueryPredicate(selector) {
  return typeof selector === "string" ? splitByComma(selector) : resolveForwardRef(selector);
}
function convertToR3QueryMetadata(propertyName, ann) {
  return {
    propertyName,
    predicate: convertToR3QueryPredicate(ann.selector),
    descendants: ann.descendants,
    first: ann.first,
    read: ann.read ? ann.read : null,
    static: !!ann.static,
    emitDistinctChangesOnly: !!ann.emitDistinctChangesOnly,
    isSignal: !!ann.isSignal
  };
}
function extractQueriesMetadata(type, propMetadata, isQueryAnn) {
  const queriesMeta = [];
  for (const field in propMetadata) {
    if (propMetadata.hasOwnProperty(field)) {
      const annotations = propMetadata[field];
      annotations.forEach((ann) => {
        if (isQueryAnn(ann)) {
          if (!ann.selector) {
            throw new Error(`Can't construct a query for the property "${field}" of "${stringifyForError(type)}" since the query selector wasn't defined.`);
          }
          if (annotations.some(isInputAnnotation)) {
            throw new Error(`Cannot combine @Input decorators with query decorators`);
          }
          queriesMeta.push(convertToR3QueryMetadata(field, ann));
        }
      });
    }
  }
  return queriesMeta;
}
function extractExportAs(exportAs) {
  return exportAs === void 0 ? null : splitByComma(exportAs);
}
function isContentQuery(value) {
  const name2 = value.ngMetadataName;
  return name2 === "ContentChild" || name2 === "ContentChildren";
}
function isViewQuery(value) {
  const name2 = value.ngMetadataName;
  return name2 === "ViewChild" || name2 === "ViewChildren";
}
function isInputAnnotation(value) {
  return value.ngMetadataName === "Input";
}
function splitByComma(value) {
  return value.split(",").map((piece) => piece.trim());
}
var LIFECYCLE_HOOKS = [
  "ngOnChanges",
  "ngOnInit",
  "ngOnDestroy",
  "ngDoCheck",
  "ngAfterViewInit",
  "ngAfterViewChecked",
  "ngAfterContentInit",
  "ngAfterContentChecked"
];
function shouldAddAbstractDirective(type) {
  const reflect = getReflect();
  if (LIFECYCLE_HOOKS.some((hookName) => reflect.hasLifecycleHook(type, hookName))) {
    return true;
  }
  const propMetadata = reflect.propMetadata(type);
  for (const field in propMetadata) {
    const annotations = propMetadata[field];
    for (let i = 0; i < annotations.length; i++) {
      const current = annotations[i];
      const metadataName = current.ngMetadataName;
      if (isInputAnnotation(current) || isContentQuery(current) || isViewQuery(current) || metadataName === "Output" || metadataName === "HostBinding" || metadataName === "HostListener") {
        return true;
      }
    }
  }
  return false;
}
function compilePipe(type, meta) {
  let ngPipeDef = null;
  let ngFactoryDef = null;
  Object.defineProperty(type, NG_FACTORY_DEF, {
    get: () => {
      if (ngFactoryDef === null) {
        const metadata = getPipeMetadata(type, meta);
        const compiler = getCompilerFacade({
          usage: 0,
          kind: "pipe",
          type: metadata.type
        });
        ngFactoryDef = compiler.compileFactory(angularCoreEnv, `ng:///${metadata.name}/\u0275fac.js`, {
          name: metadata.name,
          type: metadata.type,
          typeArgumentCount: 0,
          deps: reflectDependencies(type),
          target: compiler.FactoryTarget.Pipe
        });
      }
      return ngFactoryDef;
    },
    // Make the property configurable in dev mode to allow overriding in tests
    configurable: !!ngDevMode
  });
  Object.defineProperty(type, NG_PIPE_DEF, {
    get: () => {
      if (ngPipeDef === null) {
        const metadata = getPipeMetadata(type, meta);
        const compiler = getCompilerFacade({
          usage: 0,
          kind: "pipe",
          type: metadata.type
        });
        ngPipeDef = compiler.compilePipe(angularCoreEnv, `ng:///${metadata.name}/\u0275pipe.js`, metadata);
      }
      return ngPipeDef;
    },
    // Make the property configurable in dev mode to allow overriding in tests
    configurable: !!ngDevMode
  });
}
function getPipeMetadata(type, meta) {
  return {
    type,
    name: type.name,
    pipeName: meta.name,
    pure: meta.pure !== void 0 ? meta.pure : true,
    isStandalone: meta.standalone === void 0 ? true : !!meta.standalone
  };
}
var Directive = makeDecorator("Directive", (dir = {}) => dir, void 0, void 0, (type, meta) => compileDirective(type, meta));
var Component = makeDecorator("Component", (c = {}) => __spreadValues({ changeDetection: ChangeDetectionStrategy.Default }, c), Directive, void 0, (type, meta) => compileComponent(type, meta));
var Pipe = makeDecorator("Pipe", (p) => __spreadValues({ pure: true }, p), void 0, void 0, (type, meta) => compilePipe(type, meta));
var Input = makePropDecorator("Input", (arg) => {
  if (!arg) {
    return {};
  }
  return typeof arg === "string" ? { alias: arg } : arg;
});
var Output = makePropDecorator("Output", (alias) => ({ alias }));
var HostBinding = makePropDecorator("HostBinding", (hostPropertyName) => ({ hostPropertyName }));
var HostListener = makePropDecorator("HostListener", (eventName, args) => ({ eventName, args }));
var NgModule = makeDecorator(
  "NgModule",
  (ngModule) => ngModule,
  void 0,
  void 0,
  /**
   * Decorator that marks the following class as an NgModule, and supplies
   * configuration metadata for it.
   *
   * * The `declarations` option configures the compiler
   * with information about what belongs to the NgModule.
   * * The `providers` options configures the NgModule's injector to provide
   * dependencies the NgModule members.
   * * The `imports` and `exports` options bring in members from other modules, and make
   * this module's members available to others.
   */
  (type, meta) => compileNgModule(type, meta)
);
var ModuleWithComponentFactories = class {
  ngModuleFactory;
  componentFactories;
  constructor(ngModuleFactory, componentFactories) {
    this.ngModuleFactory = ngModuleFactory;
    this.componentFactories = componentFactories;
  }
};
var Compiler = class _Compiler {
  /**
   * Compiles the given NgModule and all of its components. All templates of the components
   * have to be inlined.
   */
  compileModuleSync(moduleType) {
    return new NgModuleFactory2(moduleType);
  }
  /**
   * Compiles the given NgModule and all of its components
   */
  compileModuleAsync(moduleType) {
    return Promise.resolve(this.compileModuleSync(moduleType));
  }
  /**
   * Same as {@link Compiler#compileModuleSync compileModuleSync} but also creates ComponentFactories for all components.
   */
  compileModuleAndAllComponentsSync(moduleType) {
    const ngModuleFactory = this.compileModuleSync(moduleType);
    const moduleDef = getNgModuleDef(moduleType);
    const componentFactories = maybeUnwrapFn(moduleDef.declarations).reduce((factories, declaration) => {
      const componentDef = getComponentDef(declaration);
      componentDef && factories.push(new ComponentFactory2(componentDef));
      return factories;
    }, []);
    return new ModuleWithComponentFactories(ngModuleFactory, componentFactories);
  }
  /**
   * Same as {@link Compiler#compileModuleAsync compileModuleAsync} but also creates ComponentFactories for all components.
   */
  compileModuleAndAllComponentsAsync(moduleType) {
    return Promise.resolve(this.compileModuleAndAllComponentsSync(moduleType));
  }
  /**
   * Clears all caches.
   */
  clearCache() {
  }
  /**
   * Clears the cache for the given component/ngModule.
   */
  clearCacheFor(type) {
  }
  /**
   * Returns the id for a given NgModule, if one is defined and known to the compiler.
   */
  getModuleId(moduleType) {
    return void 0;
  }
  static \u0275fac = function Compiler_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _Compiler)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _Compiler, factory: _Compiler.\u0275fac, providedIn: "root" });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(Compiler, [{
    type: Injectable,
    args: [{ providedIn: "root" }]
  }], null, null);
})();
var COMPILER_OPTIONS = new InjectionToken(ngDevMode ? "compilerOptions" : "");
var NgZoneChangeDetectionScheduler = class _NgZoneChangeDetectionScheduler {
  zone = inject2(NgZone);
  changeDetectionScheduler = inject2(ChangeDetectionScheduler);
  applicationRef = inject2(ApplicationRef);
  applicationErrorHandler = inject2(INTERNAL_APPLICATION_ERROR_HANDLER);
  _onMicrotaskEmptySubscription;
  initialize() {
    if (this._onMicrotaskEmptySubscription) {
      return;
    }
    this._onMicrotaskEmptySubscription = this.zone.onMicrotaskEmpty.subscribe({
      next: () => {
        if (this.changeDetectionScheduler.runningTick) {
          return;
        }
        this.zone.run(() => {
          try {
            this.applicationRef.dirtyFlags |= 1;
            this.applicationRef._tick();
          } catch (e) {
            this.applicationErrorHandler(e);
          }
        });
      }
    });
  }
  ngOnDestroy() {
    this._onMicrotaskEmptySubscription?.unsubscribe();
  }
  static \u0275fac = function NgZoneChangeDetectionScheduler_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _NgZoneChangeDetectionScheduler)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _NgZoneChangeDetectionScheduler, factory: _NgZoneChangeDetectionScheduler.\u0275fac, providedIn: "root" });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgZoneChangeDetectionScheduler, [{
    type: Injectable,
    args: [{ providedIn: "root" }]
  }], null, null);
})();
var PROVIDED_NG_ZONE = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "provideZoneChangeDetection token" : "", { factory: () => false });
function internalProvideZoneChangeDetection({ ngZoneFactory, ignoreChangesOutsideZone, scheduleInRootZone }) {
  ngZoneFactory ??= () => new NgZone(__spreadProps(__spreadValues({}, getNgZoneOptions()), { scheduleInRootZone }));
  return [
    { provide: NgZone, useFactory: ngZoneFactory },
    {
      provide: ENVIRONMENT_INITIALIZER,
      multi: true,
      useFactory: () => {
        const ngZoneChangeDetectionScheduler = inject2(NgZoneChangeDetectionScheduler, {
          optional: true
        });
        if ((typeof ngDevMode === "undefined" || ngDevMode) && ngZoneChangeDetectionScheduler === null) {
          throw new RuntimeError(402, `A required Injectable was not found in the dependency injection tree. If you are bootstrapping an NgModule, make sure that the \`BrowserModule\` is imported.`);
        }
        return () => ngZoneChangeDetectionScheduler.initialize();
      }
    },
    {
      provide: ENVIRONMENT_INITIALIZER,
      multi: true,
      useFactory: () => {
        const service = inject2(ZoneStablePendingTask);
        return () => {
          service.initialize();
        };
      }
    },
    // Always disable scheduler whenever explicitly disabled, even if another place called
    // `provideZoneChangeDetection` without the 'ignore' option.
    ignoreChangesOutsideZone === true ? { provide: ZONELESS_SCHEDULER_DISABLED, useValue: true } : [],
    {
      provide: SCHEDULE_IN_ROOT_ZONE,
      useValue: scheduleInRootZone ?? SCHEDULE_IN_ROOT_ZONE_DEFAULT
    },
    {
      provide: INTERNAL_APPLICATION_ERROR_HANDLER,
      useFactory: () => {
        const zone = inject2(NgZone);
        const injector = inject2(EnvironmentInjector);
        let userErrorHandler;
        return (e) => {
          zone.runOutsideAngular(() => {
            if (injector.destroyed && !userErrorHandler) {
              setTimeout(() => {
                throw e;
              });
            } else {
              userErrorHandler ??= injector.get(ErrorHandler);
              userErrorHandler.handleError(e);
            }
          });
        };
      }
    }
  ];
}
function getNgZoneOptions(options) {
  return {
    enableLongStackTrace: typeof ngDevMode === "undefined" ? false : !!ngDevMode,
    shouldCoalesceEventChangeDetection: options?.eventCoalescing ?? false,
    shouldCoalesceRunChangeDetection: options?.runCoalescing ?? false
  };
}
var ZoneStablePendingTask = class _ZoneStablePendingTask {
  subscription = new Subscription();
  initialized = false;
  zone = inject2(NgZone);
  pendingTasks = inject2(PendingTasksInternal);
  initialize() {
    if (this.initialized) {
      return;
    }
    this.initialized = true;
    let task = null;
    if (!this.zone.isStable && !this.zone.hasPendingMacrotasks && !this.zone.hasPendingMicrotasks) {
      task = this.pendingTasks.add();
    }
    this.zone.runOutsideAngular(() => {
      this.subscription.add(this.zone.onStable.subscribe(() => {
        NgZone.assertNotInAngularZone();
        queueMicrotask(() => {
          if (task !== null && !this.zone.hasPendingMacrotasks && !this.zone.hasPendingMicrotasks) {
            this.pendingTasks.remove(task);
            task = null;
          }
        });
      }));
    });
    this.subscription.add(this.zone.onUnstable.subscribe(() => {
      NgZone.assertInAngularZone();
      task ??= this.pendingTasks.add();
    }));
  }
  ngOnDestroy() {
    this.subscription.unsubscribe();
  }
  static \u0275fac = function ZoneStablePendingTask_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _ZoneStablePendingTask)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _ZoneStablePendingTask, factory: _ZoneStablePendingTask.\u0275fac, providedIn: "root" });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ZoneStablePendingTask, [{
    type: Injectable,
    args: [{ providedIn: "root" }]
  }], null, null);
})();
var CONSECUTIVE_MICROTASK_NOTIFICATION_LIMIT = 100;
var consecutiveMicrotaskNotifications = 0;
var stackFromLastFewNotifications = [];
function trackMicrotaskNotificationForDebugging() {
  consecutiveMicrotaskNotifications++;
  if (CONSECUTIVE_MICROTASK_NOTIFICATION_LIMIT - consecutiveMicrotaskNotifications < 5) {
    const stack = new Error().stack;
    if (stack) {
      stackFromLastFewNotifications.push(stack);
    }
  }
  if (consecutiveMicrotaskNotifications === CONSECUTIVE_MICROTASK_NOTIFICATION_LIMIT) {
    throw new RuntimeError(103, "Angular could not stabilize because there were endless change notifications within the browser event loop. The stack from the last several notifications: \n" + stackFromLastFewNotifications.join("\n"));
  }
}
var ChangeDetectionSchedulerImpl = class _ChangeDetectionSchedulerImpl {
  applicationErrorHandler = inject2(INTERNAL_APPLICATION_ERROR_HANDLER);
  appRef = inject2(ApplicationRef);
  taskService = inject2(PendingTasksInternal);
  ngZone = inject2(NgZone);
  zonelessEnabled = inject2(ZONELESS_ENABLED);
  tracing = inject2(TracingService, { optional: true });
  disableScheduling = inject2(ZONELESS_SCHEDULER_DISABLED, { optional: true }) ?? false;
  zoneIsDefined = typeof Zone !== "undefined" && !!Zone.root.run;
  schedulerTickApplyArgs = [{ data: { "__scheduler_tick__": true } }];
  subscriptions = new Subscription();
  angularZoneId = this.zoneIsDefined ? this.ngZone._inner?.get(angularZoneInstanceIdProperty) : null;
  scheduleInRootZone = !this.zonelessEnabled && this.zoneIsDefined && (inject2(SCHEDULE_IN_ROOT_ZONE, { optional: true }) ?? false);
  cancelScheduledCallback = null;
  useMicrotaskScheduler = false;
  runningTick = false;
  pendingRenderTaskId = null;
  constructor() {
    this.subscriptions.add(this.appRef.afterTick.subscribe(() => {
      if (!this.runningTick) {
        this.cleanup();
      }
    }));
    this.subscriptions.add(this.ngZone.onUnstable.subscribe(() => {
      if (!this.runningTick) {
        this.cleanup();
      }
    }));
    this.disableScheduling ||= !this.zonelessEnabled && // NoopNgZone without enabling zoneless means no scheduling whatsoever
    (this.ngZone instanceof NoopNgZone || // The same goes for the lack of Zone without enabling zoneless scheduling
    !this.zoneIsDefined);
  }
  notify(source) {
    if (!this.zonelessEnabled && source === 5) {
      return;
    }
    let force = false;
    switch (source) {
      case 0: {
        this.appRef.dirtyFlags |= 2;
        break;
      }
      case 3:
      case 2:
      case 4:
      case 5:
      case 1: {
        this.appRef.dirtyFlags |= 4;
        break;
      }
      case 6: {
        this.appRef.dirtyFlags |= 2;
        force = true;
        break;
      }
      case 12: {
        this.appRef.dirtyFlags |= 16;
        force = true;
        break;
      }
      case 13: {
        this.appRef.dirtyFlags |= 2;
        force = true;
        break;
      }
      case 11: {
        force = true;
        break;
      }
      case 9:
      case 8:
      case 7:
      case 10:
      default: {
        this.appRef.dirtyFlags |= 8;
      }
    }
    this.appRef.tracingSnapshot = this.tracing?.snapshot(this.appRef.tracingSnapshot) ?? null;
    if (!this.shouldScheduleTick(force)) {
      return;
    }
    if (typeof ngDevMode === "undefined" || ngDevMode) {
      if (this.useMicrotaskScheduler) {
        trackMicrotaskNotificationForDebugging();
      } else {
        consecutiveMicrotaskNotifications = 0;
        stackFromLastFewNotifications.length = 0;
      }
    }
    const scheduleCallback = this.useMicrotaskScheduler ? scheduleCallbackWithMicrotask : scheduleCallbackWithRafRace;
    this.pendingRenderTaskId = this.taskService.add();
    if (this.scheduleInRootZone) {
      this.cancelScheduledCallback = Zone.root.run(() => scheduleCallback(() => this.tick()));
    } else {
      this.cancelScheduledCallback = this.ngZone.runOutsideAngular(() => scheduleCallback(() => this.tick()));
    }
  }
  shouldScheduleTick(force) {
    if (this.disableScheduling && !force || this.appRef.destroyed) {
      return false;
    }
    if (this.pendingRenderTaskId !== null || this.runningTick || this.appRef._runningTick) {
      return false;
    }
    if (!this.zonelessEnabled && this.zoneIsDefined && Zone.current.get(angularZoneInstanceIdProperty + this.angularZoneId)) {
      return false;
    }
    return true;
  }
  /**
   * Calls ApplicationRef._tick inside the `NgZone`.
   *
   * Calling `tick` directly runs change detection and cancels any change detection that had been
   * scheduled previously.
   *
   * @param shouldRefreshViews Passed directly to `ApplicationRef._tick` and skips straight to
   *     render hooks when `false`.
   */
  tick() {
    if (this.runningTick || this.appRef.destroyed) {
      return;
    }
    if (this.appRef.dirtyFlags === 0) {
      this.cleanup();
      return;
    }
    if (!this.zonelessEnabled && this.appRef.dirtyFlags & 7) {
      this.appRef.dirtyFlags |= 1;
    }
    const task = this.taskService.add();
    try {
      this.ngZone.run(() => {
        this.runningTick = true;
        this.appRef._tick();
      }, void 0, this.schedulerTickApplyArgs);
    } catch (e) {
      this.taskService.remove(task);
      this.applicationErrorHandler(e);
    } finally {
      this.cleanup();
    }
    this.useMicrotaskScheduler = true;
    scheduleCallbackWithMicrotask(() => {
      this.useMicrotaskScheduler = false;
      this.taskService.remove(task);
    });
  }
  ngOnDestroy() {
    this.subscriptions.unsubscribe();
    this.cleanup();
  }
  cleanup() {
    this.runningTick = false;
    this.cancelScheduledCallback?.();
    this.cancelScheduledCallback = null;
    if (this.pendingRenderTaskId !== null) {
      const taskId = this.pendingRenderTaskId;
      this.pendingRenderTaskId = null;
      this.taskService.remove(taskId);
    }
  }
  static \u0275fac = function ChangeDetectionSchedulerImpl_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _ChangeDetectionSchedulerImpl)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _ChangeDetectionSchedulerImpl, factory: _ChangeDetectionSchedulerImpl.\u0275fac, providedIn: "root" });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ChangeDetectionSchedulerImpl, [{
    type: Injectable,
    args: [{ providedIn: "root" }]
  }], () => [], null);
})();
function provideZonelessChangeDetection() {
  performanceMarkFeature("NgZoneless");
  if ((typeof ngDevMode === "undefined" || ngDevMode) && typeof Zone !== "undefined" && Zone) {
    const message = formatRuntimeError(914, `The application is using zoneless change detection, but is still loading Zone.js. Consider removing Zone.js to get the full benefits of zoneless. In applications using the Angular CLI, Zone.js is typically included in the "polyfills" section of the angular.json file.`);
    console.warn(message);
  }
  return makeEnvironmentProviders([
    { provide: ChangeDetectionScheduler, useExisting: ChangeDetectionSchedulerImpl },
    { provide: NgZone, useClass: NoopNgZone },
    { provide: ZONELESS_ENABLED, useValue: true },
    { provide: SCHEDULE_IN_ROOT_ZONE, useValue: false },
    typeof ngDevMode === "undefined" || ngDevMode ? [{ provide: PROVIDED_ZONELESS, useValue: true }] : []
  ]);
}
function getGlobalLocale() {
  if (false) {
    return goog.LOCALE;
  } else {
    return typeof $localize !== "undefined" && $localize.locale || DEFAULT_LOCALE_ID;
  }
}
var LOCALE_ID = new InjectionToken(ngDevMode ? "LocaleId" : "", {
  providedIn: "root",
  factory: () => inject2(LOCALE_ID, { optional: true, skipSelf: true }) || getGlobalLocale()
});
var DEFAULT_CURRENCY_CODE = new InjectionToken(ngDevMode ? "DefaultCurrencyCode" : "", {
  providedIn: "root",
  factory: () => USD_CURRENCY_CODE
});
var TRANSLATIONS = new InjectionToken(ngDevMode ? "Translations" : "");
var TRANSLATIONS_FORMAT = new InjectionToken(ngDevMode ? "TranslationsFormat" : "");
var MissingTranslationStrategy;
(function(MissingTranslationStrategy2) {
  MissingTranslationStrategy2[MissingTranslationStrategy2["Error"] = 0] = "Error";
  MissingTranslationStrategy2[MissingTranslationStrategy2["Warning"] = 1] = "Warning";
  MissingTranslationStrategy2[MissingTranslationStrategy2["Ignore"] = 2] = "Ignore";
})(MissingTranslationStrategy || (MissingTranslationStrategy = {}));

// node_modules/@angular/core/fesm2022/resource.mjs
var OutputEmitterRef = class {
  destroyed = false;
  listeners = null;
  errorHandler = inject2(ErrorHandler, { optional: true });
  /** @internal */
  destroyRef = inject2(DestroyRef);
  constructor() {
    this.destroyRef.onDestroy(() => {
      this.destroyed = true;
      this.listeners = null;
    });
  }
  subscribe(callback) {
    if (this.destroyed) {
      throw new RuntimeError(953, ngDevMode && "Unexpected subscription to destroyed `OutputRef`. The owning directive/component is destroyed.");
    }
    (this.listeners ??= []).push(callback);
    return {
      unsubscribe: () => {
        const idx = this.listeners?.indexOf(callback);
        if (idx !== void 0 && idx !== -1) {
          this.listeners?.splice(idx, 1);
        }
      }
    };
  }
  /** Emits a new value to the output. */
  emit(value) {
    if (this.destroyed) {
      console.warn(formatRuntimeError(953, ngDevMode && "Unexpected emit for destroyed `OutputRef`. The owning directive/component is destroyed."));
      return;
    }
    if (this.listeners === null) {
      return;
    }
    const previousConsumer = setActiveConsumer(null);
    try {
      for (const listenerFn of this.listeners) {
        try {
          listenerFn(value);
        } catch (err) {
          this.errorHandler?.handleError(err);
        }
      }
    } finally {
      setActiveConsumer(previousConsumer);
    }
  }
};
function untracked2(nonReactiveReadsFn) {
  return untracked(nonReactiveReadsFn);
}
function computed(computation, options) {
  const getter = createComputed(computation, options?.equal);
  if (ngDevMode) {
    getter.toString = () => `[Computed: ${getter()}]`;
    getter[SIGNAL].debugName = options?.debugName;
  }
  return getter;
}
var EffectRefImpl = class {
  [SIGNAL];
  constructor(node) {
    this[SIGNAL] = node;
  }
  destroy() {
    this[SIGNAL].destroy();
  }
};
function effect(effectFn, options) {
  ngDevMode && assertNotInReactiveContext(effect, "Call `effect` outside of a reactive context. For example, schedule the effect inside the component constructor.");
  if (ngDevMode && !options?.injector) {
    assertInInjectionContext(effect);
  }
  if (ngDevMode && options?.allowSignalWrites !== void 0) {
    console.warn(`The 'allowSignalWrites' flag is deprecated and no longer impacts effect() (writes are always allowed)`);
  }
  const injector = options?.injector ?? inject2(Injector);
  let destroyRef = options?.manualCleanup !== true ? injector.get(DestroyRef) : null;
  let node;
  const viewContext = injector.get(ViewContext, null, { optional: true });
  const notifier = injector.get(ChangeDetectionScheduler);
  if (viewContext !== null) {
    node = createViewEffect(viewContext.view, notifier, effectFn);
    if (destroyRef instanceof NodeInjectorDestroyRef && destroyRef._lView === viewContext.view) {
      destroyRef = null;
    }
  } else {
    node = createRootEffect(effectFn, injector.get(EffectScheduler), notifier);
  }
  node.injector = injector;
  if (destroyRef !== null) {
    node.onDestroyFn = destroyRef.onDestroy(() => node.destroy());
  }
  const effectRef = new EffectRefImpl(node);
  if (ngDevMode) {
    node.debugName = options?.debugName ?? "";
    const prevInjectorProfilerContext = setInjectorProfilerContext({ injector, token: null });
    try {
      emitEffectCreatedEvent(effectRef);
    } finally {
      setInjectorProfilerContext(prevInjectorProfilerContext);
    }
  }
  return effectRef;
}
var BASE_EFFECT_NODE = /* @__PURE__ */ (() => __spreadProps(__spreadValues({}, REACTIVE_NODE), {
  consumerIsAlwaysLive: true,
  consumerAllowSignalWrites: true,
  dirty: true,
  hasRun: false,
  cleanupFns: void 0,
  zone: null,
  kind: "effect",
  onDestroyFn: noop2,
  run() {
    this.dirty = false;
    if (ngDevMode && isInNotificationPhase()) {
      throw new Error(`Schedulers cannot synchronously execute watches while scheduling.`);
    }
    if (this.hasRun && !consumerPollProducersForChange(this)) {
      return;
    }
    this.hasRun = true;
    const registerCleanupFn = (cleanupFn) => (this.cleanupFns ??= []).push(cleanupFn);
    const prevNode = consumerBeforeComputation(this);
    const prevRefreshingViews = setIsRefreshingViews(false);
    try {
      this.maybeCleanup();
      this.fn(registerCleanupFn);
    } finally {
      setIsRefreshingViews(prevRefreshingViews);
      consumerAfterComputation(this, prevNode);
    }
  },
  maybeCleanup() {
    if (!this.cleanupFns?.length) {
      return;
    }
    const prevConsumer = setActiveConsumer(null);
    try {
      while (this.cleanupFns.length) {
        this.cleanupFns.pop()();
      }
    } finally {
      this.cleanupFns = [];
      setActiveConsumer(prevConsumer);
    }
  }
}))();
var ROOT_EFFECT_NODE = /* @__PURE__ */ (() => __spreadProps(__spreadValues({}, BASE_EFFECT_NODE), {
  consumerMarkedDirty() {
    this.scheduler.schedule(this);
    this.notifier.notify(
      12
      /* NotificationSource.RootEffect */
    );
  },
  destroy() {
    consumerDestroy(this);
    this.onDestroyFn();
    this.maybeCleanup();
    this.scheduler.remove(this);
  }
}))();
var VIEW_EFFECT_NODE = /* @__PURE__ */ (() => __spreadProps(__spreadValues({}, BASE_EFFECT_NODE), {
  consumerMarkedDirty() {
    this.view[FLAGS] |= 8192;
    markAncestorsForTraversal(this.view);
    this.notifier.notify(
      13
      /* NotificationSource.ViewEffect */
    );
  },
  destroy() {
    consumerDestroy(this);
    this.onDestroyFn();
    this.maybeCleanup();
    this.view[EFFECTS]?.delete(this);
  }
}))();
function createViewEffect(view, notifier, fn) {
  const node = Object.create(VIEW_EFFECT_NODE);
  node.view = view;
  node.zone = typeof Zone !== "undefined" ? Zone.current : null;
  node.notifier = notifier;
  node.fn = fn;
  view[EFFECTS] ??= /* @__PURE__ */ new Set();
  view[EFFECTS].add(node);
  node.consumerMarkedDirty(node);
  return node;
}
function createRootEffect(fn, scheduler, notifier) {
  const node = Object.create(ROOT_EFFECT_NODE);
  node.fn = fn;
  node.scheduler = scheduler;
  node.notifier = notifier;
  node.zone = typeof Zone !== "undefined" ? Zone.current : null;
  node.scheduler.add(node);
  node.notifier.notify(
    12
    /* NotificationSource.RootEffect */
  );
  return node;
}
var identityFn = (v) => v;
function linkedSignal(optionsOrComputation, options) {
  if (typeof optionsOrComputation === "function") {
    const getter = createLinkedSignal(optionsOrComputation, identityFn, options?.equal);
    return upgradeLinkedSignalGetter(getter);
  } else {
    const getter = createLinkedSignal(optionsOrComputation.source, optionsOrComputation.computation, optionsOrComputation.equal);
    return upgradeLinkedSignalGetter(getter);
  }
}
function upgradeLinkedSignalGetter(getter) {
  if (ngDevMode) {
    getter.toString = () => `[LinkedSignal: ${getter()}]`;
  }
  const node = getter[SIGNAL];
  const upgradedGetter = getter;
  upgradedGetter.set = (newValue) => linkedSignalSetFn(node, newValue);
  upgradedGetter.update = (updateFn) => linkedSignalUpdateFn(node, updateFn);
  upgradedGetter.asReadonly = signalAsReadonlyFn.bind(getter);
  return upgradedGetter;
}
var RESOURCE_VALUE_THROWS_ERRORS_DEFAULT = true;
var BaseWritableResource = class {
  value;
  constructor(value) {
    this.value = value;
    this.value.set = this.set.bind(this);
    this.value.update = this.update.bind(this);
    this.value.asReadonly = signalAsReadonlyFn;
  }
  isError = computed(() => this.status() === "error");
  update(updateFn) {
    this.set(updateFn(untracked2(this.value)));
  }
  isLoading = computed(() => this.status() === "loading" || this.status() === "reloading");
  // Use a computed here to avoid triggering reactive consumers if the value changes while staying
  // either defined or undefined.
  isValueDefined = computed(() => {
    if (this.isError()) {
      return false;
    }
    return this.value() !== void 0;
  });
  hasValue() {
    return this.isValueDefined();
  }
  asReadonly() {
    return this;
  }
};
var ResourceImpl = class extends BaseWritableResource {
  loaderFn;
  equal;
  pendingTasks;
  /**
   * The current state of the resource. Status, value, and error are derived from this.
   */
  state;
  /**
   * Combines the current request with a reload counter which allows the resource to be reloaded on
   * imperative command.
   */
  extRequest;
  effectRef;
  pendingController;
  resolvePendingTask = void 0;
  destroyed = false;
  unregisterOnDestroy;
  constructor(request, loaderFn, defaultValue, equal, injector, throwErrorsFromValue = RESOURCE_VALUE_THROWS_ERRORS_DEFAULT) {
    super(
      // Feed a computed signal for the value to `BaseWritableResource`, which will upgrade it to a
      // `WritableSignal` that delegates to `ResourceImpl.set`.
      computed(() => {
        const streamValue = this.state().stream?.();
        if (!streamValue) {
          return defaultValue;
        }
        if (this.state().status === "loading" && this.error()) {
          return defaultValue;
        }
        if (!isResolved(streamValue)) {
          if (throwErrorsFromValue) {
            throw new ResourceValueError(this.error());
          } else {
            return defaultValue;
          }
        }
        return streamValue.value;
      }, { equal })
    );
    this.loaderFn = loaderFn;
    this.equal = equal;
    this.extRequest = linkedSignal({
      source: request,
      computation: (request2) => ({ request: request2, reload: 0 })
    });
    this.state = linkedSignal({
      // Whenever the request changes,
      source: this.extRequest,
      // Compute the state of the resource given a change in status.
      computation: (extRequest, previous) => {
        const status = extRequest.request === void 0 ? "idle" : "loading";
        if (!previous) {
          return {
            extRequest,
            status,
            previousStatus: "idle",
            stream: void 0
          };
        } else {
          return {
            extRequest,
            status,
            previousStatus: projectStatusOfState(previous.value),
            // If the request hasn't changed, keep the previous stream.
            stream: previous.value.extRequest.request === extRequest.request ? previous.value.stream : void 0
          };
        }
      }
    });
    this.effectRef = effect(this.loadEffect.bind(this), {
      injector,
      manualCleanup: true
    });
    this.pendingTasks = injector.get(PendingTasks);
    this.unregisterOnDestroy = injector.get(DestroyRef).onDestroy(() => this.destroy());
  }
  status = computed(() => projectStatusOfState(this.state()));
  error = computed(() => {
    const stream = this.state().stream?.();
    return stream && !isResolved(stream) ? stream.error : void 0;
  });
  /**
   * Called either directly via `WritableResource.set` or via `.value.set()`.
   */
  set(value) {
    if (this.destroyed) {
      return;
    }
    const error = untracked2(this.error);
    const state = untracked2(this.state);
    if (!error) {
      const current = untracked2(this.value);
      if (state.status === "local" && (this.equal ? this.equal(current, value) : current === value)) {
        return;
      }
    }
    this.state.set({
      extRequest: state.extRequest,
      status: "local",
      previousStatus: "local",
      stream: signal({ value })
    });
    this.abortInProgressLoad();
  }
  reload() {
    const { status } = untracked2(this.state);
    if (status === "idle" || status === "loading") {
      return false;
    }
    this.extRequest.update(({ request, reload }) => ({ request, reload: reload + 1 }));
    return true;
  }
  destroy() {
    this.destroyed = true;
    this.unregisterOnDestroy();
    this.effectRef.destroy();
    this.abortInProgressLoad();
    this.state.set({
      extRequest: { request: void 0, reload: 0 },
      status: "idle",
      previousStatus: "idle",
      stream: void 0
    });
  }
  async loadEffect() {
    const extRequest = this.extRequest();
    const { status: currentStatus, previousStatus } = untracked2(this.state);
    if (extRequest.request === void 0) {
      return;
    } else if (currentStatus !== "loading") {
      return;
    }
    this.abortInProgressLoad();
    let resolvePendingTask = this.resolvePendingTask = this.pendingTasks.add();
    const { signal: abortSignal } = this.pendingController = new AbortController();
    try {
      const stream = await untracked2(() => {
        return this.loaderFn({
          params: extRequest.request,
          // TODO(alxhub): cleanup after g3 removal of `request` alias.
          request: extRequest.request,
          abortSignal,
          previous: {
            status: previousStatus
          }
        });
      });
      if (abortSignal.aborted || untracked2(this.extRequest) !== extRequest) {
        return;
      }
      this.state.set({
        extRequest,
        status: "resolved",
        previousStatus: "resolved",
        stream
      });
    } catch (err) {
      if (abortSignal.aborted || untracked2(this.extRequest) !== extRequest) {
        return;
      }
      this.state.set({
        extRequest,
        status: "resolved",
        previousStatus: "error",
        stream: signal({ error: encapsulateResourceError(err) })
      });
    } finally {
      resolvePendingTask?.();
      resolvePendingTask = void 0;
    }
  }
  abortInProgressLoad() {
    untracked2(() => this.pendingController?.abort());
    this.pendingController = void 0;
    this.resolvePendingTask?.();
    this.resolvePendingTask = void 0;
  }
};
function projectStatusOfState(state) {
  switch (state.status) {
    case "loading":
      return state.extRequest.reload === 0 ? "loading" : "reloading";
    case "resolved":
      return isResolved(state.stream()) ? "resolved" : "error";
    default:
      return state.status;
  }
}
function isResolved(state) {
  return state.error === void 0;
}
function encapsulateResourceError(error) {
  if (error instanceof Error) {
    return error;
  }
  return new ResourceWrappedError(error);
}
var ResourceValueError = class extends Error {
  constructor(error) {
    super(ngDevMode ? `Resource is currently in an error state (see Error.cause for details): ${error.message}` : error.message, { cause: error });
  }
};
var ResourceWrappedError = class extends Error {
  constructor(error) {
    super(ngDevMode ? `Resource returned an error that's not an Error instance: ${String(error)}. Check this error's .cause for the actual error.` : String(error), { cause: error });
  }
};

// node_modules/@angular/core/fesm2022/core.mjs
var REQUIRED_UNSET_VALUE = /* @__PURE__ */ Symbol("InputSignalNode#UNSET");
var INPUT_SIGNAL_NODE = /* @__PURE__ */ (() => {
  return __spreadProps(__spreadValues({}, SIGNAL_NODE), {
    transformFn: void 0,
    applyValueToInputSignal(node, value) {
      signalSetFn(node, value);
    }
  });
})();
function createInputSignal(initialValue, options) {
  const node = Object.create(INPUT_SIGNAL_NODE);
  node.value = initialValue;
  node.transformFn = options?.transform;
  function inputValueFn() {
    producerAccessed(node);
    if (node.value === REQUIRED_UNSET_VALUE) {
      let message = null;
      if (ngDevMode) {
        const name2 = options?.debugName ?? options?.alias;
        message = `Input${name2 ? ` "${name2}"` : ""} is required but no value is available yet.`;
      }
      throw new RuntimeError(-950, message);
    }
    return node.value;
  }
  inputValueFn[SIGNAL] = node;
  if (ngDevMode) {
    inputValueFn.toString = () => `[Input Signal: ${inputValueFn()}]`;
    node.debugName = options?.debugName;
  }
  return inputValueFn;
}
var FactoryTarget;
(function(FactoryTarget2) {
  FactoryTarget2[FactoryTarget2["Directive"] = 0] = "Directive";
  FactoryTarget2[FactoryTarget2["Component"] = 1] = "Component";
  FactoryTarget2[FactoryTarget2["Injectable"] = 2] = "Injectable";
  FactoryTarget2[FactoryTarget2["Pipe"] = 3] = "Pipe";
  FactoryTarget2[FactoryTarget2["NgModule"] = 4] = "NgModule";
})(FactoryTarget || (FactoryTarget = {}));
var R3TemplateDependencyKind;
(function(R3TemplateDependencyKind2) {
  R3TemplateDependencyKind2[R3TemplateDependencyKind2["Directive"] = 0] = "Directive";
  R3TemplateDependencyKind2[R3TemplateDependencyKind2["Pipe"] = 1] = "Pipe";
  R3TemplateDependencyKind2[R3TemplateDependencyKind2["NgModule"] = 2] = "NgModule";
})(R3TemplateDependencyKind || (R3TemplateDependencyKind = {}));
var ViewEncapsulation2;
(function(ViewEncapsulation3) {
  ViewEncapsulation3[ViewEncapsulation3["Emulated"] = 0] = "Emulated";
  ViewEncapsulation3[ViewEncapsulation3["None"] = 2] = "None";
  ViewEncapsulation3[ViewEncapsulation3["ShadowDom"] = 3] = "ShadowDom";
})(ViewEncapsulation2 || (ViewEncapsulation2 = {}));
var HostAttributeToken = class {
  attributeName;
  constructor(attributeName) {
    this.attributeName = attributeName;
  }
  /** @internal */
  __NG_ELEMENT_ID__ = () => \u0275\u0275injectAttribute(this.attributeName);
  toString() {
    return `HostAttributeToken ${this.attributeName}`;
  }
};
var HOST_TAG_NAME = new InjectionToken(ngDevMode ? "HOST_TAG_NAME" : "");
HOST_TAG_NAME.__NG_ELEMENT_ID__ = (flags) => {
  const tNode = getCurrentTNode();
  if (tNode === null) {
    throw new RuntimeError(204, ngDevMode && "HOST_TAG_NAME can only be injected in directives and components during construction time (in a class constructor or as a class field initializer)");
  }
  if (tNode.type & 2) {
    return tNode.value;
  }
  if (flags & 8) {
    return null;
  }
  throw new RuntimeError(204, ngDevMode && `HOST_TAG_NAME was used on ${getDevModeNodeName(tNode)} which doesn't have an underlying element in the DOM. This is invalid, and so the dependency should be marked as optional.`);
};
function getDevModeNodeName(tNode) {
  if (tNode.type & 8) {
    return "an <ng-container>";
  } else if (tNode.type & 4) {
    return "an <ng-template>";
  } else if (tNode.type & 128) {
    return "an @let declaration";
  } else {
    return "a node";
  }
}
function output(opts) {
  ngDevMode && assertInInjectionContext(output);
  return new OutputEmitterRef();
}
function inputFunction(initialValue, opts) {
  ngDevMode && assertInInjectionContext(input);
  return createInputSignal(initialValue, opts);
}
function inputRequiredFunction(opts) {
  ngDevMode && assertInInjectionContext(input);
  return createInputSignal(REQUIRED_UNSET_VALUE, opts);
}
var input = (() => {
  inputFunction.required = inputRequiredFunction;
  return inputFunction;
})();
function viewChildFn(locator, opts) {
  ngDevMode && assertInInjectionContext(viewChild);
  return createSingleResultOptionalQuerySignalFn(opts);
}
function viewChildRequiredFn(locator, opts) {
  ngDevMode && assertInInjectionContext(viewChild);
  return createSingleResultRequiredQuerySignalFn(opts);
}
var viewChild = (() => {
  viewChildFn.required = viewChildRequiredFn;
  return viewChildFn;
})();
function contentChildFn(locator, opts) {
  ngDevMode && assertInInjectionContext(contentChild);
  return createSingleResultOptionalQuerySignalFn(opts);
}
function contentChildRequiredFn(locator, opts) {
  ngDevMode && assertInInjectionContext(contentChildren);
  return createSingleResultRequiredQuerySignalFn(opts);
}
var contentChild = (() => {
  contentChildFn.required = contentChildRequiredFn;
  return contentChildFn;
})();
function contentChildren(locator, opts) {
  return createMultiResultQuerySignalFn(opts);
}
function createModelSignal(initialValue, opts) {
  const node = Object.create(INPUT_SIGNAL_NODE);
  const emitterRef = new OutputEmitterRef();
  node.value = initialValue;
  function getter() {
    producerAccessed(node);
    assertModelSet(node.value);
    return node.value;
  }
  getter[SIGNAL] = node;
  getter.asReadonly = signalAsReadonlyFn.bind(getter);
  getter.set = (newValue) => {
    if (!node.equal(node.value, newValue)) {
      signalSetFn(node, newValue);
      emitterRef.emit(newValue);
    }
  };
  getter.update = (updateFn) => {
    assertModelSet(node.value);
    getter.set(updateFn(node.value));
  };
  getter.subscribe = emitterRef.subscribe.bind(emitterRef);
  getter.destroyRef = emitterRef.destroyRef;
  if (ngDevMode) {
    getter.toString = () => `[Model Signal: ${getter()}]`;
    node.debugName = opts?.debugName;
  }
  return getter;
}
function assertModelSet(value) {
  if (value === REQUIRED_UNSET_VALUE) {
    throw new RuntimeError(952, ngDevMode && "Model is required but no value is available yet.");
  }
}
function modelFunction(initialValue, opts) {
  ngDevMode && assertInInjectionContext(model);
  return createModelSignal(initialValue, opts);
}
function modelRequiredFunction(opts) {
  ngDevMode && assertInInjectionContext(model);
  return createModelSignal(REQUIRED_UNSET_VALUE, opts);
}
var model = (() => {
  modelFunction.required = modelRequiredFunction;
  return modelFunction;
})();
var emitDistinctChangesOnlyDefaultValue = true;
var Query = class {
};
var ContentChildren = makePropDecorator("ContentChildren", (selector, opts = {}) => __spreadValues({
  selector,
  first: false,
  isViewQuery: false,
  descendants: false,
  emitDistinctChangesOnly: emitDistinctChangesOnlyDefaultValue
}, opts), Query);
var ContentChild = makePropDecorator("ContentChild", (selector, opts = {}) => __spreadValues({
  selector,
  first: true,
  isViewQuery: false,
  descendants: true
}, opts), Query);
var ViewChildren = makePropDecorator("ViewChildren", (selector, opts = {}) => __spreadValues({
  selector,
  first: false,
  isViewQuery: true,
  descendants: true,
  emitDistinctChangesOnly: emitDistinctChangesOnlyDefaultValue
}, opts), Query);
var ViewChild = makePropDecorator("ViewChild", (selector, opts) => __spreadValues({
  selector,
  first: true,
  isViewQuery: true,
  descendants: true
}, opts), Query);
var Version = class {
  full;
  major;
  minor;
  patch;
  constructor(full) {
    this.full = full;
    const parts = full.split(".");
    this.major = parts[0];
    this.minor = parts[1];
    this.patch = parts.slice(2).join(".");
  }
};
var VERSION = new Version("20.1.3");
function compileNgModuleFactory(injector, options, moduleType) {
  ngDevMode && assertNgModuleType(moduleType);
  const moduleFactory = new NgModuleFactory2(moduleType);
  if (true) {
    return Promise.resolve(moduleFactory);
  }
  const compilerOptions = injector.get(COMPILER_OPTIONS, []).concat(options);
  setJitOptions({
    defaultEncapsulation: _lastDefined(compilerOptions.map((opts) => opts.defaultEncapsulation)),
    preserveWhitespaces: _lastDefined(compilerOptions.map((opts) => opts.preserveWhitespaces))
  });
  if (isComponentResourceResolutionQueueEmpty()) {
    return Promise.resolve(moduleFactory);
  }
  const compilerProviders = compilerOptions.flatMap((option) => option.providers ?? []);
  if (compilerProviders.length === 0) {
    return Promise.resolve(moduleFactory);
  }
  const compiler = getCompilerFacade({
    usage: 0,
    kind: "NgModule",
    type: moduleType
  });
  const compilerInjector = Injector.create({ providers: compilerProviders });
  const resourceLoader = compilerInjector.get(compiler.ResourceLoader);
  return resolveComponentResources((url) => Promise.resolve(resourceLoader.get(url))).then(() => moduleFactory);
}
function _lastDefined(args) {
  for (let i = args.length - 1; i >= 0; i--) {
    if (args[i] !== void 0) {
      return args[i];
    }
  }
  return void 0;
}
var SCAN_DELAY = 200;
var OVERSIZED_IMAGE_TOLERANCE = 1200;
var ImagePerformanceWarning = class _ImagePerformanceWarning {
  // Map of full image URLs -> original `ngSrc` values.
  window = null;
  observer = null;
  options = inject2(IMAGE_CONFIG);
  lcpImageUrl;
  start() {
    if (typeof PerformanceObserver === "undefined" || this.options?.disableImageSizeWarning && this.options?.disableImageLazyLoadWarning) {
      return;
    }
    this.observer = this.initPerformanceObserver();
    const doc = getDocument();
    const win = doc.defaultView;
    if (win) {
      this.window = win;
      const waitToScan = () => {
        setTimeout(this.scanImages.bind(this), SCAN_DELAY);
      };
      const setup = () => {
        if (doc.readyState === "complete") {
          waitToScan();
        } else {
          this.window?.addEventListener("load", waitToScan, { once: true });
        }
      };
      if (typeof Zone !== "undefined") {
        Zone.root.run(() => setup());
      } else {
        setup();
      }
    }
  }
  ngOnDestroy() {
    this.observer?.disconnect();
  }
  initPerformanceObserver() {
    if (typeof PerformanceObserver === "undefined") {
      return null;
    }
    const observer = new PerformanceObserver((entryList) => {
      const entries = entryList.getEntries();
      if (entries.length === 0)
        return;
      const lcpElement = entries[entries.length - 1];
      const imgSrc = lcpElement.element?.src ?? "";
      if (imgSrc.startsWith("data:") || imgSrc.startsWith("blob:"))
        return;
      this.lcpImageUrl = imgSrc;
    });
    observer.observe({ type: "largest-contentful-paint", buffered: true });
    return observer;
  }
  scanImages() {
    const images = getDocument().querySelectorAll("img");
    let lcpElementFound, lcpElementLoadedCorrectly = false;
    for (let index = 0; index < images.length; index++) {
      const image = images[index];
      if (!image) {
        continue;
      }
      if (!this.options?.disableImageSizeWarning) {
        if (!image.getAttribute("ng-img") && this.isOversized(image)) {
          logOversizedImageWarning(image.src);
        }
      }
      if (!this.options?.disableImageLazyLoadWarning && this.lcpImageUrl) {
        if (image.src === this.lcpImageUrl) {
          lcpElementFound = true;
          if (image.loading !== "lazy" || image.getAttribute("ng-img")) {
            lcpElementLoadedCorrectly = true;
          }
        }
      }
    }
    if (lcpElementFound && !lcpElementLoadedCorrectly && this.lcpImageUrl && !this.options?.disableImageLazyLoadWarning) {
      logLazyLCPWarning(this.lcpImageUrl);
    }
  }
  isOversized(image) {
    if (!this.window) {
      return false;
    }
    const nonOversizedImageExtentions = [
      // SVG images are vector-based, which means they can scale
      // to any size without losing quality.
      ".svg"
    ];
    const imageSource = (image.src || "").toLowerCase();
    if (nonOversizedImageExtentions.some((extension) => imageSource.endsWith(extension))) {
      return false;
    }
    const computedStyle = this.window.getComputedStyle(image);
    let renderedWidth = parseFloat(computedStyle.getPropertyValue("width"));
    let renderedHeight = parseFloat(computedStyle.getPropertyValue("height"));
    const boxSizing = computedStyle.getPropertyValue("box-sizing");
    const objectFit = computedStyle.getPropertyValue("object-fit");
    if (objectFit === `cover`) {
      return false;
    }
    if (boxSizing === "border-box") {
      const paddingTop = computedStyle.getPropertyValue("padding-top");
      const paddingRight = computedStyle.getPropertyValue("padding-right");
      const paddingBottom = computedStyle.getPropertyValue("padding-bottom");
      const paddingLeft = computedStyle.getPropertyValue("padding-left");
      renderedWidth -= parseFloat(paddingRight) + parseFloat(paddingLeft);
      renderedHeight -= parseFloat(paddingTop) + parseFloat(paddingBottom);
    }
    const intrinsicWidth = image.naturalWidth;
    const intrinsicHeight = image.naturalHeight;
    const recommendedWidth = this.window.devicePixelRatio * renderedWidth;
    const recommendedHeight = this.window.devicePixelRatio * renderedHeight;
    const oversizedWidth = intrinsicWidth - recommendedWidth >= OVERSIZED_IMAGE_TOLERANCE;
    const oversizedHeight = intrinsicHeight - recommendedHeight >= OVERSIZED_IMAGE_TOLERANCE;
    return oversizedWidth || oversizedHeight;
  }
  static \u0275fac = function ImagePerformanceWarning_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _ImagePerformanceWarning)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _ImagePerformanceWarning, factory: _ImagePerformanceWarning.\u0275fac, providedIn: "root" });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ImagePerformanceWarning, [{
    type: Injectable,
    args: [{ providedIn: "root" }]
  }], null, null);
})();
function logLazyLCPWarning(src) {
  console.warn(formatRuntimeError(-913, `An image with src ${src} is the Largest Contentful Paint (LCP) element but was given a "loading" value of "lazy", which can negatively impact application loading performance. This warning can be addressed by changing the loading value of the LCP image to "eager", or by using the NgOptimizedImage directive's prioritization utilities. For more information about addressing or disabling this warning, see https://angular.dev/errors/NG0913`));
}
function logOversizedImageWarning(src) {
  console.warn(formatRuntimeError(-913, `An image with src ${src} has intrinsic file dimensions much larger than its rendered size. This can negatively impact application loading performance. For more information about addressing or disabling this warning, see https://angular.dev/errors/NG0913`));
}
var PLATFORM_DESTROY_LISTENERS = new InjectionToken(ngDevMode ? "PlatformDestroyListeners" : "");
var ENABLE_ROOT_COMPONENT_BOOTSTRAP = new InjectionToken(ngDevMode ? "ENABLE_ROOT_COMPONENT_BOOTSTRAP" : "");
function isApplicationBootstrapConfig(config2) {
  return !config2.moduleRef;
}
function bootstrap(config2) {
  const envInjector = isApplicationBootstrapConfig(config2) ? config2.r3Injector : config2.moduleRef.injector;
  const ngZone = envInjector.get(NgZone);
  return ngZone.run(() => {
    if (isApplicationBootstrapConfig(config2)) {
      config2.r3Injector.resolveInjectorInitializers();
    } else {
      config2.moduleRef.resolveInjectorInitializers();
    }
    const exceptionHandler = envInjector.get(INTERNAL_APPLICATION_ERROR_HANDLER);
    if (typeof ngDevMode === "undefined" || ngDevMode) {
      if (envInjector.get(PROVIDED_ZONELESS) && envInjector.get(PROVIDED_NG_ZONE)) {
        throw new RuntimeError(408, "Invalid change detection configuration: provideZoneChangeDetection and provideZonelessChangeDetection cannot be used together.");
      }
    }
    let onErrorSubscription;
    ngZone.runOutsideAngular(() => {
      onErrorSubscription = ngZone.onError.subscribe({
        next: exceptionHandler
      });
    });
    if (isApplicationBootstrapConfig(config2)) {
      const destroyListener = () => envInjector.destroy();
      const onPlatformDestroyListeners = config2.platformInjector.get(PLATFORM_DESTROY_LISTENERS);
      onPlatformDestroyListeners.add(destroyListener);
      envInjector.onDestroy(() => {
        onErrorSubscription.unsubscribe();
        onPlatformDestroyListeners.delete(destroyListener);
      });
    } else {
      const destroyListener = () => config2.moduleRef.destroy();
      const onPlatformDestroyListeners = config2.platformInjector.get(PLATFORM_DESTROY_LISTENERS);
      onPlatformDestroyListeners.add(destroyListener);
      config2.moduleRef.onDestroy(() => {
        remove(config2.allPlatformModules, config2.moduleRef);
        onErrorSubscription.unsubscribe();
        onPlatformDestroyListeners.delete(destroyListener);
      });
    }
    return _callAndReportToErrorHandler(exceptionHandler, ngZone, () => {
      const pendingTasks = envInjector.get(PendingTasksInternal);
      const taskId = pendingTasks.add();
      const initStatus = envInjector.get(ApplicationInitStatus);
      initStatus.runInitializers();
      return initStatus.donePromise.then(() => {
        const localeId = envInjector.get(LOCALE_ID, DEFAULT_LOCALE_ID);
        setLocaleId(localeId || DEFAULT_LOCALE_ID);
        const enableRootComponentBoostrap = envInjector.get(ENABLE_ROOT_COMPONENT_BOOTSTRAP, true);
        if (!enableRootComponentBoostrap) {
          if (isApplicationBootstrapConfig(config2)) {
            return envInjector.get(ApplicationRef);
          }
          config2.allPlatformModules.push(config2.moduleRef);
          return config2.moduleRef;
        }
        if (typeof ngDevMode === "undefined" || ngDevMode) {
          const imagePerformanceService = envInjector.get(ImagePerformanceWarning);
          imagePerformanceService.start();
        }
        if (isApplicationBootstrapConfig(config2)) {
          const appRef = envInjector.get(ApplicationRef);
          if (config2.rootComponent !== void 0) {
            appRef.bootstrap(config2.rootComponent);
          }
          return appRef;
        } else {
          moduleBootstrapImpl?.(config2.moduleRef, config2.allPlatformModules);
          return config2.moduleRef;
        }
      }).finally(() => void pendingTasks.remove(taskId));
    });
  });
}
var moduleBootstrapImpl;
function setModuleBootstrapImpl() {
  moduleBootstrapImpl = _moduleDoBootstrap;
}
function _moduleDoBootstrap(moduleRef, allPlatformModules) {
  const appRef = moduleRef.injector.get(ApplicationRef);
  if (moduleRef._bootstrapComponents.length > 0) {
    moduleRef._bootstrapComponents.forEach((f) => appRef.bootstrap(f));
  } else if (moduleRef.instance.ngDoBootstrap) {
    moduleRef.instance.ngDoBootstrap(appRef);
  } else {
    throw new RuntimeError(-403, ngDevMode && `The module ${stringify(moduleRef.instance.constructor)} was bootstrapped, but it does not declare "@NgModule.bootstrap" components nor a "ngDoBootstrap" method. Please define one of these.`);
  }
  allPlatformModules.push(moduleRef);
}
function _callAndReportToErrorHandler(errorHandler2, ngZone, callback) {
  try {
    const result = callback();
    if (isPromise2(result)) {
      return result.catch((e) => {
        ngZone.runOutsideAngular(() => errorHandler2(e));
        throw e;
      });
    }
    return result;
  } catch (e) {
    ngZone.runOutsideAngular(() => errorHandler2(e));
    throw e;
  }
}
var PlatformRef = class _PlatformRef {
  _injector;
  _modules = [];
  _destroyListeners = [];
  _destroyed = false;
  /** @internal */
  constructor(_injector) {
    this._injector = _injector;
  }
  /**
   * Creates an instance of an `@NgModule` for the given platform.
   *
   * @deprecated Passing NgModule factories as the `PlatformRef.bootstrapModuleFactory` function
   *     argument is deprecated. Use the `PlatformRef.bootstrapModule` API instead.
   */
  bootstrapModuleFactory(moduleFactory, options) {
    const scheduleInRootZone = options?.scheduleInRootZone;
    const ngZoneFactory = () => getNgZone(options?.ngZone, __spreadProps(__spreadValues({}, getNgZoneOptions({
      eventCoalescing: options?.ngZoneEventCoalescing,
      runCoalescing: options?.ngZoneRunCoalescing
    })), {
      scheduleInRootZone
    }));
    const ignoreChangesOutsideZone = options?.ignoreChangesOutsideZone;
    const allAppProviders = [
      internalProvideZoneChangeDetection({
        ngZoneFactory,
        ignoreChangesOutsideZone
      }),
      { provide: ChangeDetectionScheduler, useExisting: ChangeDetectionSchedulerImpl },
      errorHandlerEnvironmentInitializer
    ];
    const moduleRef = createNgModuleRefWithProviders(moduleFactory.moduleType, this.injector, allAppProviders);
    setModuleBootstrapImpl();
    return bootstrap({
      moduleRef,
      allPlatformModules: this._modules,
      platformInjector: this.injector
    });
  }
  /**
   * Creates an instance of an `@NgModule` for a given platform.
   *
   * @usageNotes
   * ### Simple Example
   *
   * ```ts
   * @NgModule({
   *   imports: [BrowserModule]
   * })
   * class MyModule {}
   *
   * let moduleRef = platformBrowser().bootstrapModule(MyModule);
   * ```
   *
   */
  bootstrapModule(moduleType, compilerOptions = []) {
    const options = optionsReducer({}, compilerOptions);
    setModuleBootstrapImpl();
    return compileNgModuleFactory(this.injector, options, moduleType).then((moduleFactory) => this.bootstrapModuleFactory(moduleFactory, options));
  }
  /**
   * Registers a listener to be called when the platform is destroyed.
   */
  onDestroy(callback) {
    this._destroyListeners.push(callback);
  }
  /**
   * Retrieves the platform {@link Injector}, which is the parent injector for
   * every Angular application on the page and provides singleton providers.
   */
  get injector() {
    return this._injector;
  }
  /**
   * Destroys the current Angular platform and all Angular applications on the page.
   * Destroys all modules and listeners registered with the platform.
   */
  destroy() {
    if (this._destroyed) {
      throw new RuntimeError(404, ngDevMode && "The platform has already been destroyed!");
    }
    this._modules.slice().forEach((module) => module.destroy());
    this._destroyListeners.forEach((listener) => listener());
    const destroyListeners = this._injector.get(PLATFORM_DESTROY_LISTENERS, null);
    if (destroyListeners) {
      destroyListeners.forEach((listener) => listener());
      destroyListeners.clear();
    }
    this._destroyed = true;
  }
  /**
   * Indicates whether this instance was destroyed.
   */
  get destroyed() {
    return this._destroyed;
  }
  static \u0275fac = function PlatformRef_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _PlatformRef)(\u0275\u0275inject(Injector));
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _PlatformRef, factory: _PlatformRef.\u0275fac, providedIn: "platform" });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PlatformRef, [{
    type: Injectable,
    args: [{ providedIn: "platform" }]
  }], () => [{ type: Injector }], null);
})();
var _platformInjector = null;
var ALLOW_MULTIPLE_PLATFORMS = new InjectionToken(ngDevMode ? "AllowMultipleToken" : "");
function createPlatform(injector) {
  if (_platformInjector && !_platformInjector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {
    throw new RuntimeError(400, ngDevMode && "There can be only one platform. Destroy the previous one to create a new one.");
  }
  publishDefaultGlobalUtils();
  publishSignalConfiguration();
  _platformInjector = injector;
  const platform = injector.get(PlatformRef);
  runPlatformInitializers(injector);
  return platform;
}
function createPlatformFactory(parentPlatformFactory, name2, providers = []) {
  const desc = `Platform: ${name2}`;
  const marker = new InjectionToken(desc);
  return (extraProviders = []) => {
    let platform = getPlatform();
    if (!platform || platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {
      const platformProviders = [
        ...providers,
        ...extraProviders,
        { provide: marker, useValue: true }
      ];
      if (parentPlatformFactory) {
        parentPlatformFactory(platformProviders);
      } else {
        createPlatform(createPlatformInjector(platformProviders, desc));
      }
    }
    return assertPlatform(marker);
  };
}
function createPlatformInjector(providers = [], name2) {
  return Injector.create({
    name: name2,
    providers: [
      { provide: INJECTOR_SCOPE, useValue: "platform" },
      { provide: PLATFORM_DESTROY_LISTENERS, useValue: /* @__PURE__ */ new Set([() => _platformInjector = null]) },
      ...providers
    ]
  });
}
function assertPlatform(requiredToken) {
  const platform = getPlatform();
  if (!platform) {
    throw new RuntimeError(401, ngDevMode && "No platform exists!");
  }
  if ((typeof ngDevMode === "undefined" || ngDevMode) && !platform.injector.get(requiredToken, null)) {
    throw new RuntimeError(400, "A platform with a different configuration has been created. Please destroy it first.");
  }
  return platform;
}
function getPlatform() {
  return _platformInjector?.get(PlatformRef) ?? null;
}
function createOrReusePlatformInjector(providers = []) {
  if (_platformInjector)
    return _platformInjector;
  publishDefaultGlobalUtils();
  const injector = createPlatformInjector(providers);
  _platformInjector = injector;
  publishSignalConfiguration();
  runPlatformInitializers(injector);
  return injector;
}
function runPlatformInitializers(injector) {
  const inits = injector.get(PLATFORM_INITIALIZER, null);
  runInInjectionContext(injector, () => {
    inits?.forEach((init) => init());
  });
}
var ChangeDetectorRef = class {
  /**
   * @internal
   * @nocollapse
   */
  static __NG_ELEMENT_ID__ = injectChangeDetectorRef;
};
function injectChangeDetectorRef(flags) {
  return createViewRef(
    getCurrentTNode(),
    getLView(),
    (flags & 16) === 16
    /* InternalInjectFlags.ForPipe */
  );
}
function createViewRef(tNode, lView, isPipe2) {
  if (isComponentHost(tNode) && !isPipe2) {
    const componentView = getComponentLViewByIndex(tNode.index, lView);
    return new ViewRef(componentView, componentView);
  } else if (tNode.type & (3 | 12 | 32 | 128)) {
    const hostComponentView = lView[DECLARATION_COMPONENT_VIEW];
    return new ViewRef(hostComponentView, lView);
  }
  return null;
}
var DefaultIterableDifferFactory = class {
  constructor() {
  }
  supports(obj) {
    return isListLikeIterable(obj);
  }
  create(trackByFn) {
    return new DefaultIterableDiffer(trackByFn);
  }
};
var trackByIdentity = (index, item) => item;
var DefaultIterableDiffer = class {
  length = 0;
  // TODO: confirm the usage of `collection` as it's unused, readonly and on a non public API.
  collection;
  // Keeps track of the used records at any point in time (during & across `_check()` calls)
  _linkedRecords = null;
  // Keeps track of the removed records at any point in time during `_check()` calls.
  _unlinkedRecords = null;
  _previousItHead = null;
  _itHead = null;
  _itTail = null;
  _additionsHead = null;
  _additionsTail = null;
  _movesHead = null;
  _movesTail = null;
  _removalsHead = null;
  _removalsTail = null;
  // Keeps track of records where custom track by is the same, but item identity has changed
  _identityChangesHead = null;
  _identityChangesTail = null;
  _trackByFn;
  constructor(trackByFn) {
    this._trackByFn = trackByFn || trackByIdentity;
  }
  forEachItem(fn) {
    let record;
    for (record = this._itHead; record !== null; record = record._next) {
      fn(record);
    }
  }
  forEachOperation(fn) {
    let nextIt = this._itHead;
    let nextRemove = this._removalsHead;
    let addRemoveOffset = 0;
    let moveOffsets = null;
    while (nextIt || nextRemove) {
      const record = !nextRemove || nextIt && nextIt.currentIndex < getPreviousIndex(nextRemove, addRemoveOffset, moveOffsets) ? nextIt : nextRemove;
      const adjPreviousIndex = getPreviousIndex(record, addRemoveOffset, moveOffsets);
      const currentIndex = record.currentIndex;
      if (record === nextRemove) {
        addRemoveOffset--;
        nextRemove = nextRemove._nextRemoved;
      } else {
        nextIt = nextIt._next;
        if (record.previousIndex == null) {
          addRemoveOffset++;
        } else {
          if (!moveOffsets)
            moveOffsets = [];
          const localMovePreviousIndex = adjPreviousIndex - addRemoveOffset;
          const localCurrentIndex = currentIndex - addRemoveOffset;
          if (localMovePreviousIndex != localCurrentIndex) {
            for (let i = 0; i < localMovePreviousIndex; i++) {
              const offset = i < moveOffsets.length ? moveOffsets[i] : moveOffsets[i] = 0;
              const index = offset + i;
              if (localCurrentIndex <= index && index < localMovePreviousIndex) {
                moveOffsets[i] = offset + 1;
              }
            }
            const previousIndex = record.previousIndex;
            moveOffsets[previousIndex] = localCurrentIndex - localMovePreviousIndex;
          }
        }
      }
      if (adjPreviousIndex !== currentIndex) {
        fn(record, adjPreviousIndex, currentIndex);
      }
    }
  }
  forEachPreviousItem(fn) {
    let record;
    for (record = this._previousItHead; record !== null; record = record._nextPrevious) {
      fn(record);
    }
  }
  forEachAddedItem(fn) {
    let record;
    for (record = this._additionsHead; record !== null; record = record._nextAdded) {
      fn(record);
    }
  }
  forEachMovedItem(fn) {
    let record;
    for (record = this._movesHead; record !== null; record = record._nextMoved) {
      fn(record);
    }
  }
  forEachRemovedItem(fn) {
    let record;
    for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
      fn(record);
    }
  }
  forEachIdentityChange(fn) {
    let record;
    for (record = this._identityChangesHead; record !== null; record = record._nextIdentityChange) {
      fn(record);
    }
  }
  diff(collection) {
    if (collection == null)
      collection = [];
    if (!isListLikeIterable(collection)) {
      throw new RuntimeError(900, ngDevMode && `Error trying to diff '${stringify(collection)}'. Only arrays and iterables are allowed`);
    }
    if (this.check(collection)) {
      return this;
    } else {
      return null;
    }
  }
  onDestroy() {
  }
  check(collection) {
    this._reset();
    let record = this._itHead;
    let mayBeDirty = false;
    let index;
    let item;
    let itemTrackBy;
    if (Array.isArray(collection)) {
      this.length = collection.length;
      for (let index2 = 0; index2 < this.length; index2++) {
        item = collection[index2];
        itemTrackBy = this._trackByFn(index2, item);
        if (record === null || !Object.is(record.trackById, itemTrackBy)) {
          record = this._mismatch(record, item, itemTrackBy, index2);
          mayBeDirty = true;
        } else {
          if (mayBeDirty) {
            record = this._verifyReinsertion(record, item, itemTrackBy, index2);
          }
          if (!Object.is(record.item, item))
            this._addIdentityChange(record, item);
        }
        record = record._next;
      }
    } else {
      index = 0;
      iterateListLike(collection, (item2) => {
        itemTrackBy = this._trackByFn(index, item2);
        if (record === null || !Object.is(record.trackById, itemTrackBy)) {
          record = this._mismatch(record, item2, itemTrackBy, index);
          mayBeDirty = true;
        } else {
          if (mayBeDirty) {
            record = this._verifyReinsertion(record, item2, itemTrackBy, index);
          }
          if (!Object.is(record.item, item2))
            this._addIdentityChange(record, item2);
        }
        record = record._next;
        index++;
      });
      this.length = index;
    }
    this._truncate(record);
    this.collection = collection;
    return this.isDirty;
  }
  /* CollectionChanges is considered dirty if it has any additions, moves, removals, or identity
   * changes.
   */
  get isDirty() {
    return this._additionsHead !== null || this._movesHead !== null || this._removalsHead !== null || this._identityChangesHead !== null;
  }
  /**
   * Reset the state of the change objects to show no changes. This means set previousKey to
   * currentKey, and clear all of the queues (additions, moves, removals).
   * Set the previousIndexes of moved and added items to their currentIndexes
   * Reset the list of additions, moves and removals
   *
   * @internal
   */
  _reset() {
    if (this.isDirty) {
      let record;
      for (record = this._previousItHead = this._itHead; record !== null; record = record._next) {
        record._nextPrevious = record._next;
      }
      for (record = this._additionsHead; record !== null; record = record._nextAdded) {
        record.previousIndex = record.currentIndex;
      }
      this._additionsHead = this._additionsTail = null;
      for (record = this._movesHead; record !== null; record = record._nextMoved) {
        record.previousIndex = record.currentIndex;
      }
      this._movesHead = this._movesTail = null;
      this._removalsHead = this._removalsTail = null;
      this._identityChangesHead = this._identityChangesTail = null;
    }
  }
  /**
   * This is the core function which handles differences between collections.
   *
   * - `record` is the record which we saw at this position last time. If null then it is a new
   *   item.
   * - `item` is the current item in the collection
   * - `index` is the position of the item in the collection
   *
   * @internal
   */
  _mismatch(record, item, itemTrackBy, index) {
    let previousRecord;
    if (record === null) {
      previousRecord = this._itTail;
    } else {
      previousRecord = record._prev;
      this._remove(record);
    }
    record = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy, null);
    if (record !== null) {
      if (!Object.is(record.item, item))
        this._addIdentityChange(record, item);
      this._reinsertAfter(record, previousRecord, index);
    } else {
      record = this._linkedRecords === null ? null : this._linkedRecords.get(itemTrackBy, index);
      if (record !== null) {
        if (!Object.is(record.item, item))
          this._addIdentityChange(record, item);
        this._moveAfter(record, previousRecord, index);
      } else {
        record = this._addAfter(new IterableChangeRecord_(item, itemTrackBy), previousRecord, index);
      }
    }
    return record;
  }
  /**
   * This check is only needed if an array contains duplicates. (Short circuit of nothing dirty)
   *
   * Use case: `[a, a]` => `[b, a, a]`
   *
   * If we did not have this check then the insertion of `b` would:
   *   1) evict first `a`
   *   2) insert `b` at `0` index.
   *   3) leave `a` at index `1` as is. <-- this is wrong!
   *   3) reinsert `a` at index 2. <-- this is wrong!
   *
   * The correct behavior is:
   *   1) evict first `a`
   *   2) insert `b` at `0` index.
   *   3) reinsert `a` at index 1.
   *   3) move `a` at from `1` to `2`.
   *
   *
   * Double check that we have not evicted a duplicate item. We need to check if the item type may
   * have already been removed:
   * The insertion of b will evict the first 'a'. If we don't reinsert it now it will be reinserted
   * at the end. Which will show up as the two 'a's switching position. This is incorrect, since a
   * better way to think of it is as insert of 'b' rather then switch 'a' with 'b' and then add 'a'
   * at the end.
   *
   * @internal
   */
  _verifyReinsertion(record, item, itemTrackBy, index) {
    let reinsertRecord = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy, null);
    if (reinsertRecord !== null) {
      record = this._reinsertAfter(reinsertRecord, record._prev, index);
    } else if (record.currentIndex != index) {
      record.currentIndex = index;
      this._addToMoves(record, index);
    }
    return record;
  }
  /**
   * Get rid of any excess {@link IterableChangeRecord_}s from the previous collection
   *
   * - `record` The first excess {@link IterableChangeRecord_}.
   *
   * @internal
   */
  _truncate(record) {
    while (record !== null) {
      const nextRecord = record._next;
      this._addToRemovals(this._unlink(record));
      record = nextRecord;
    }
    if (this._unlinkedRecords !== null) {
      this._unlinkedRecords.clear();
    }
    if (this._additionsTail !== null) {
      this._additionsTail._nextAdded = null;
    }
    if (this._movesTail !== null) {
      this._movesTail._nextMoved = null;
    }
    if (this._itTail !== null) {
      this._itTail._next = null;
    }
    if (this._removalsTail !== null) {
      this._removalsTail._nextRemoved = null;
    }
    if (this._identityChangesTail !== null) {
      this._identityChangesTail._nextIdentityChange = null;
    }
  }
  /** @internal */
  _reinsertAfter(record, prevRecord, index) {
    if (this._unlinkedRecords !== null) {
      this._unlinkedRecords.remove(record);
    }
    const prev = record._prevRemoved;
    const next = record._nextRemoved;
    if (prev === null) {
      this._removalsHead = next;
    } else {
      prev._nextRemoved = next;
    }
    if (next === null) {
      this._removalsTail = prev;
    } else {
      next._prevRemoved = prev;
    }
    this._insertAfter(record, prevRecord, index);
    this._addToMoves(record, index);
    return record;
  }
  /** @internal */
  _moveAfter(record, prevRecord, index) {
    this._unlink(record);
    this._insertAfter(record, prevRecord, index);
    this._addToMoves(record, index);
    return record;
  }
  /** @internal */
  _addAfter(record, prevRecord, index) {
    this._insertAfter(record, prevRecord, index);
    if (this._additionsTail === null) {
      this._additionsTail = this._additionsHead = record;
    } else {
      this._additionsTail = this._additionsTail._nextAdded = record;
    }
    return record;
  }
  /** @internal */
  _insertAfter(record, prevRecord, index) {
    const next = prevRecord === null ? this._itHead : prevRecord._next;
    record._next = next;
    record._prev = prevRecord;
    if (next === null) {
      this._itTail = record;
    } else {
      next._prev = record;
    }
    if (prevRecord === null) {
      this._itHead = record;
    } else {
      prevRecord._next = record;
    }
    if (this._linkedRecords === null) {
      this._linkedRecords = new _DuplicateMap();
    }
    this._linkedRecords.put(record);
    record.currentIndex = index;
    return record;
  }
  /** @internal */
  _remove(record) {
    return this._addToRemovals(this._unlink(record));
  }
  /** @internal */
  _unlink(record) {
    if (this._linkedRecords !== null) {
      this._linkedRecords.remove(record);
    }
    const prev = record._prev;
    const next = record._next;
    if (prev === null) {
      this._itHead = next;
    } else {
      prev._next = next;
    }
    if (next === null) {
      this._itTail = prev;
    } else {
      next._prev = prev;
    }
    return record;
  }
  /** @internal */
  _addToMoves(record, toIndex) {
    if (record.previousIndex === toIndex) {
      return record;
    }
    if (this._movesTail === null) {
      this._movesTail = this._movesHead = record;
    } else {
      this._movesTail = this._movesTail._nextMoved = record;
    }
    return record;
  }
  _addToRemovals(record) {
    if (this._unlinkedRecords === null) {
      this._unlinkedRecords = new _DuplicateMap();
    }
    this._unlinkedRecords.put(record);
    record.currentIndex = null;
    record._nextRemoved = null;
    if (this._removalsTail === null) {
      this._removalsTail = this._removalsHead = record;
      record._prevRemoved = null;
    } else {
      record._prevRemoved = this._removalsTail;
      this._removalsTail = this._removalsTail._nextRemoved = record;
    }
    return record;
  }
  /** @internal */
  _addIdentityChange(record, item) {
    record.item = item;
    if (this._identityChangesTail === null) {
      this._identityChangesTail = this._identityChangesHead = record;
    } else {
      this._identityChangesTail = this._identityChangesTail._nextIdentityChange = record;
    }
    return record;
  }
};
var IterableChangeRecord_ = class {
  item;
  trackById;
  currentIndex = null;
  previousIndex = null;
  /** @internal */
  _nextPrevious = null;
  /** @internal */
  _prev = null;
  /** @internal */
  _next = null;
  /** @internal */
  _prevDup = null;
  /** @internal */
  _nextDup = null;
  /** @internal */
  _prevRemoved = null;
  /** @internal */
  _nextRemoved = null;
  /** @internal */
  _nextAdded = null;
  /** @internal */
  _nextMoved = null;
  /** @internal */
  _nextIdentityChange = null;
  constructor(item, trackById) {
    this.item = item;
    this.trackById = trackById;
  }
};
var _DuplicateItemRecordList = class {
  /** @internal */
  _head = null;
  /** @internal */
  _tail = null;
  /**
   * Append the record to the list of duplicates.
   *
   * Note: by design all records in the list of duplicates hold the same value in record.item.
   */
  add(record) {
    if (this._head === null) {
      this._head = this._tail = record;
      record._nextDup = null;
      record._prevDup = null;
    } else {
      this._tail._nextDup = record;
      record._prevDup = this._tail;
      record._nextDup = null;
      this._tail = record;
    }
  }
  // Returns a IterableChangeRecord_ having IterableChangeRecord_.trackById == trackById and
  // IterableChangeRecord_.currentIndex >= atOrAfterIndex
  get(trackById, atOrAfterIndex) {
    let record;
    for (record = this._head; record !== null; record = record._nextDup) {
      if ((atOrAfterIndex === null || atOrAfterIndex <= record.currentIndex) && Object.is(record.trackById, trackById)) {
        return record;
      }
    }
    return null;
  }
  /**
   * Remove one {@link IterableChangeRecord_} from the list of duplicates.
   *
   * Returns whether the list of duplicates is empty.
   */
  remove(record) {
    const prev = record._prevDup;
    const next = record._nextDup;
    if (prev === null) {
      this._head = next;
    } else {
      prev._nextDup = next;
    }
    if (next === null) {
      this._tail = prev;
    } else {
      next._prevDup = prev;
    }
    return this._head === null;
  }
};
var _DuplicateMap = class {
  map = /* @__PURE__ */ new Map();
  put(record) {
    const key = record.trackById;
    let duplicates = this.map.get(key);
    if (!duplicates) {
      duplicates = new _DuplicateItemRecordList();
      this.map.set(key, duplicates);
    }
    duplicates.add(record);
  }
  /**
   * Retrieve the `value` using key. Because the IterableChangeRecord_ value may be one which we
   * have already iterated over, we use the `atOrAfterIndex` to pretend it is not there.
   *
   * Use case: `[a, b, c, a, a]` if we are at index `3` which is the second `a` then asking if we
   * have any more `a`s needs to return the second `a`.
   */
  get(trackById, atOrAfterIndex) {
    const key = trackById;
    const recordList = this.map.get(key);
    return recordList ? recordList.get(trackById, atOrAfterIndex) : null;
  }
  /**
   * Removes a {@link IterableChangeRecord_} from the list of duplicates.
   *
   * The list of duplicates also is removed from the map if it gets empty.
   */
  remove(record) {
    const key = record.trackById;
    const recordList = this.map.get(key);
    if (recordList.remove(record)) {
      this.map.delete(key);
    }
    return record;
  }
  get isEmpty() {
    return this.map.size === 0;
  }
  clear() {
    this.map.clear();
  }
};
function getPreviousIndex(item, addRemoveOffset, moveOffsets) {
  const previousIndex = item.previousIndex;
  if (previousIndex === null)
    return previousIndex;
  let moveOffset = 0;
  if (moveOffsets && previousIndex < moveOffsets.length) {
    moveOffset = moveOffsets[previousIndex];
  }
  return previousIndex + addRemoveOffset + moveOffset;
}
var DefaultKeyValueDifferFactory = class {
  constructor() {
  }
  supports(obj) {
    return obj instanceof Map || isJsObject(obj);
  }
  create() {
    return new DefaultKeyValueDiffer();
  }
};
var DefaultKeyValueDiffer = class {
  _records = /* @__PURE__ */ new Map();
  _mapHead = null;
  // _appendAfter is used in the check loop
  _appendAfter = null;
  _previousMapHead = null;
  _changesHead = null;
  _changesTail = null;
  _additionsHead = null;
  _additionsTail = null;
  _removalsHead = null;
  _removalsTail = null;
  get isDirty() {
    return this._additionsHead !== null || this._changesHead !== null || this._removalsHead !== null;
  }
  forEachItem(fn) {
    let record;
    for (record = this._mapHead; record !== null; record = record._next) {
      fn(record);
    }
  }
  forEachPreviousItem(fn) {
    let record;
    for (record = this._previousMapHead; record !== null; record = record._nextPrevious) {
      fn(record);
    }
  }
  forEachChangedItem(fn) {
    let record;
    for (record = this._changesHead; record !== null; record = record._nextChanged) {
      fn(record);
    }
  }
  forEachAddedItem(fn) {
    let record;
    for (record = this._additionsHead; record !== null; record = record._nextAdded) {
      fn(record);
    }
  }
  forEachRemovedItem(fn) {
    let record;
    for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
      fn(record);
    }
  }
  diff(map3) {
    if (!map3) {
      map3 = /* @__PURE__ */ new Map();
    } else if (!(map3 instanceof Map || isJsObject(map3))) {
      throw new RuntimeError(900, ngDevMode && `Error trying to diff '${stringify(map3)}'. Only maps and objects are allowed`);
    }
    return this.check(map3) ? this : null;
  }
  onDestroy() {
  }
  /**
   * Check the current state of the map vs the previous.
   * The algorithm is optimised for when the keys do no change.
   */
  check(map3) {
    this._reset();
    let insertBefore = this._mapHead;
    this._appendAfter = null;
    this._forEach(map3, (value, key) => {
      if (insertBefore && insertBefore.key === key) {
        this._maybeAddToChanges(insertBefore, value);
        this._appendAfter = insertBefore;
        insertBefore = insertBefore._next;
      } else {
        const record = this._getOrCreateRecordForKey(key, value);
        insertBefore = this._insertBeforeOrAppend(insertBefore, record);
      }
    });
    if (insertBefore) {
      if (insertBefore._prev) {
        insertBefore._prev._next = null;
      }
      this._removalsHead = insertBefore;
      for (let record = insertBefore; record !== null; record = record._nextRemoved) {
        if (record === this._mapHead) {
          this._mapHead = null;
        }
        this._records.delete(record.key);
        record._nextRemoved = record._next;
        record.previousValue = record.currentValue;
        record.currentValue = null;
        record._prev = null;
        record._next = null;
      }
    }
    if (this._changesTail)
      this._changesTail._nextChanged = null;
    if (this._additionsTail)
      this._additionsTail._nextAdded = null;
    return this.isDirty;
  }
  /**
   * Inserts a record before `before` or append at the end of the list when `before` is null.
   *
   * Notes:
   * - This method appends at `this._appendAfter`,
   * - This method updates `this._appendAfter`,
   * - The return value is the new value for the insertion pointer.
   */
  _insertBeforeOrAppend(before, record) {
    if (before) {
      const prev = before._prev;
      record._next = before;
      record._prev = prev;
      before._prev = record;
      if (prev) {
        prev._next = record;
      }
      if (before === this._mapHead) {
        this._mapHead = record;
      }
      this._appendAfter = before;
      return before;
    }
    if (this._appendAfter) {
      this._appendAfter._next = record;
      record._prev = this._appendAfter;
    } else {
      this._mapHead = record;
    }
    this._appendAfter = record;
    return null;
  }
  _getOrCreateRecordForKey(key, value) {
    if (this._records.has(key)) {
      const record2 = this._records.get(key);
      this._maybeAddToChanges(record2, value);
      const prev = record2._prev;
      const next = record2._next;
      if (prev) {
        prev._next = next;
      }
      if (next) {
        next._prev = prev;
      }
      record2._next = null;
      record2._prev = null;
      return record2;
    }
    const record = new KeyValueChangeRecord_(key);
    this._records.set(key, record);
    record.currentValue = value;
    this._addToAdditions(record);
    return record;
  }
  /** @internal */
  _reset() {
    if (this.isDirty) {
      let record;
      this._previousMapHead = this._mapHead;
      for (record = this._previousMapHead; record !== null; record = record._next) {
        record._nextPrevious = record._next;
      }
      for (record = this._changesHead; record !== null; record = record._nextChanged) {
        record.previousValue = record.currentValue;
      }
      for (record = this._additionsHead; record != null; record = record._nextAdded) {
        record.previousValue = record.currentValue;
      }
      this._changesHead = this._changesTail = null;
      this._additionsHead = this._additionsTail = null;
      this._removalsHead = null;
    }
  }
  // Add the record or a given key to the list of changes only when the value has actually changed
  _maybeAddToChanges(record, newValue) {
    if (!Object.is(newValue, record.currentValue)) {
      record.previousValue = record.currentValue;
      record.currentValue = newValue;
      this._addToChanges(record);
    }
  }
  _addToAdditions(record) {
    if (this._additionsHead === null) {
      this._additionsHead = this._additionsTail = record;
    } else {
      this._additionsTail._nextAdded = record;
      this._additionsTail = record;
    }
  }
  _addToChanges(record) {
    if (this._changesHead === null) {
      this._changesHead = this._changesTail = record;
    } else {
      this._changesTail._nextChanged = record;
      this._changesTail = record;
    }
  }
  /** @internal */
  _forEach(obj, fn) {
    if (obj instanceof Map) {
      obj.forEach(fn);
    } else {
      Object.keys(obj).forEach((k) => fn(obj[k], k));
    }
  }
};
var KeyValueChangeRecord_ = class {
  key;
  previousValue = null;
  currentValue = null;
  /** @internal */
  _nextPrevious = null;
  /** @internal */
  _next = null;
  /** @internal */
  _prev = null;
  /** @internal */
  _nextAdded = null;
  /** @internal */
  _nextRemoved = null;
  /** @internal */
  _nextChanged = null;
  constructor(key) {
    this.key = key;
  }
};
function defaultIterableDiffersFactory() {
  return new IterableDiffers([new DefaultIterableDifferFactory()]);
}
var IterableDiffers = class _IterableDiffers {
  factories;
  /** @nocollapse */
  static \u0275prov = (
    /** @pureOrBreakMyCode */
    /* @__PURE__ */ \u0275\u0275defineInjectable({
      token: _IterableDiffers,
      providedIn: "root",
      factory: defaultIterableDiffersFactory
    })
  );
  constructor(factories) {
    this.factories = factories;
  }
  static create(factories, parent) {
    if (parent != null) {
      const copied = parent.factories.slice();
      factories = factories.concat(copied);
    }
    return new _IterableDiffers(factories);
  }
  /**
   * Takes an array of {@link IterableDifferFactory} and returns a provider used to extend the
   * inherited {@link IterableDiffers} instance with the provided factories and return a new
   * {@link IterableDiffers} instance.
   *
   * @usageNotes
   * ### Example
   *
   * The following example shows how to extend an existing list of factories,
   * which will only be applied to the injector for this component and its children.
   * This step is all that's required to make a new {@link IterableDiffer} available.
   *
   * ```ts
   * @Component({
   *   viewProviders: [
   *     IterableDiffers.extend([new ImmutableListDiffer()])
   *   ]
   * })
   * ```
   */
  static extend(factories) {
    return {
      provide: _IterableDiffers,
      useFactory: (parent) => {
        return _IterableDiffers.create(factories, parent || defaultIterableDiffersFactory());
      },
      // Dependency technically isn't optional, but we can provide a better error message this way.
      deps: [[_IterableDiffers, new SkipSelf(), new Optional()]]
    };
  }
  find(iterable) {
    const factory = this.factories.find((f) => f.supports(iterable));
    if (factory != null) {
      return factory;
    } else {
      throw new RuntimeError(901, ngDevMode && `Cannot find a differ supporting object '${iterable}' of type '${getTypeNameForDebugging(iterable)}'`);
    }
  }
};
function getTypeNameForDebugging(type) {
  return type["name"] || typeof type;
}
function defaultKeyValueDiffersFactory() {
  return new KeyValueDiffers([new DefaultKeyValueDifferFactory()]);
}
var KeyValueDiffers = class _KeyValueDiffers {
  /** @nocollapse */
  static \u0275prov = (
    /** @pureOrBreakMyCode */
    /* @__PURE__ */ \u0275\u0275defineInjectable({
      token: _KeyValueDiffers,
      providedIn: "root",
      factory: defaultKeyValueDiffersFactory
    })
  );
  factories;
  constructor(factories) {
    this.factories = factories;
  }
  static create(factories, parent) {
    if (parent) {
      const copied = parent.factories.slice();
      factories = factories.concat(copied);
    }
    return new _KeyValueDiffers(factories);
  }
  /**
   * Takes an array of {@link KeyValueDifferFactory} and returns a provider used to extend the
   * inherited {@link KeyValueDiffers} instance with the provided factories and return a new
   * {@link KeyValueDiffers} instance.
   *
   * @usageNotes
   * ### Example
   *
   * The following example shows how to extend an existing list of factories,
   * which will only be applied to the injector for this component and its children.
   * This step is all that's required to make a new {@link KeyValueDiffer} available.
   *
   * ```ts
   * @Component({
   *   viewProviders: [
   *     KeyValueDiffers.extend([new ImmutableMapDiffer()])
   *   ]
   * })
   * ```
   */
  static extend(factories) {
    return {
      provide: _KeyValueDiffers,
      useFactory: (parent) => {
        return _KeyValueDiffers.create(factories, parent || defaultKeyValueDiffersFactory());
      },
      // Dependency technically isn't optional, but we can provide a better error message this way.
      deps: [[_KeyValueDiffers, new SkipSelf(), new Optional()]]
    };
  }
  find(kv) {
    const factory = this.factories.find((f) => f.supports(kv));
    if (factory) {
      return factory;
    }
    throw new RuntimeError(901, ngDevMode && `Cannot find a differ supporting object '${kv}'`);
  }
};
var keyValDiff = [new DefaultKeyValueDifferFactory()];
var iterableDiff = [new DefaultIterableDifferFactory()];
var defaultIterableDiffers = new IterableDiffers(iterableDiff);
var defaultKeyValueDiffers = new KeyValueDiffers(keyValDiff);
var platformCore = createPlatformFactory(null, "core", []);
var ApplicationModule = class _ApplicationModule {
  // Inject ApplicationRef to make it eager...
  constructor(appRef) {
  }
  static \u0275fac = function ApplicationModule_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _ApplicationModule)(\u0275\u0275inject(ApplicationRef));
  };
  static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({ type: _ApplicationModule });
  static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({});
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ApplicationModule, [{
    type: NgModule
  }], () => [{ type: ApplicationRef }], null);
})();
function internalCreateApplication(config2) {
  profiler(
    8
    /* ProfilerEvent.BootstrapApplicationStart */
  );
  try {
    const { rootComponent, appProviders, platformProviders } = config2;
    if ((typeof ngDevMode === "undefined" || ngDevMode) && rootComponent !== void 0) {
      assertStandaloneComponentType(rootComponent);
    }
    const platformInjector = createOrReusePlatformInjector(platformProviders);
    const allAppProviders = [
      internalProvideZoneChangeDetection({}),
      { provide: ChangeDetectionScheduler, useExisting: ChangeDetectionSchedulerImpl },
      errorHandlerEnvironmentInitializer,
      ...appProviders || []
    ];
    const adapter = new EnvironmentNgModuleRefAdapter({
      providers: allAppProviders,
      parent: platformInjector,
      debugName: typeof ngDevMode === "undefined" || ngDevMode ? "Environment Injector" : "",
      // We skip environment initializers because we need to run them inside the NgZone, which
      // happens after we get the NgZone instance from the Injector.
      runEnvironmentInitializers: false
    });
    return bootstrap({
      r3Injector: adapter.injector,
      platformInjector,
      rootComponent
    });
  } catch (e) {
    return Promise.reject(e);
  } finally {
    profiler(
      9
      /* ProfilerEvent.BootstrapApplicationEnd */
    );
  }
}
function booleanAttribute(value) {
  return typeof value === "boolean" ? value : value != null && value !== "false";
}
function numberAttribute(value, fallbackValue = NaN) {
  const isNumberValue = !isNaN(parseFloat(value)) && !isNaN(Number(value));
  return isNumberValue ? Number(value) : fallbackValue;
}
function createComponent(component, options) {
  ngDevMode && assertComponentDef(component);
  const componentDef = getComponentDef(component);
  const elementInjector = options.elementInjector || getNullInjector();
  const factory = new ComponentFactory2(componentDef);
  return factory.create(elementInjector, options.projectableNodes, options.hostElement, options.environmentInjector, options.directives, options.bindings);
}
function reflectComponentType(component) {
  const componentDef = getComponentDef(component);
  if (!componentDef)
    return null;
  const factory = new ComponentFactory2(componentDef);
  return {
    get selector() {
      return factory.selector;
    },
    get type() {
      return factory.componentType;
    },
    get inputs() {
      return factory.inputs;
    },
    get outputs() {
      return factory.outputs;
    },
    get ngContentSelectors() {
      return factory.ngContentSelectors;
    },
    get isStandalone() {
      return componentDef.standalone;
    },
    get isSignal() {
      return componentDef.signals;
    }
  };
}
var REQUEST = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "REQUEST" : "", {
  providedIn: "platform",
  factory: () => null
});
var RESPONSE_INIT = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "RESPONSE_INIT" : "", {
  providedIn: "platform",
  factory: () => null
});
var REQUEST_CONTEXT = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "REQUEST_CONTEXT" : "", {
  providedIn: "platform",
  factory: () => null
});

// node_modules/@angular/common/fesm2022/location.mjs
var _DOM = null;
function getDOM() {
  return _DOM;
}
function setRootDomAdapter(adapter) {
  _DOM ??= adapter;
}
var DomAdapter = class {
};
var PlatformLocation = class _PlatformLocation {
  historyGo(relativePosition) {
    throw new Error(ngDevMode ? "Not implemented" : "");
  }
  static \u0275fac = function PlatformLocation_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _PlatformLocation)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _PlatformLocation,
    factory: () => (() => inject2(BrowserPlatformLocation))(),
    providedIn: "platform"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PlatformLocation, [{
    type: Injectable,
    args: [{
      providedIn: "platform",
      useFactory: () => inject2(BrowserPlatformLocation)
    }]
  }], null, null);
})();
var LOCATION_INITIALIZED = new InjectionToken(ngDevMode ? "Location Initialized" : "");
var BrowserPlatformLocation = class _BrowserPlatformLocation extends PlatformLocation {
  _location;
  _history;
  _doc = inject2(DOCUMENT);
  constructor() {
    super();
    this._location = window.location;
    this._history = window.history;
  }
  getBaseHrefFromDOM() {
    return getDOM().getBaseHref(this._doc);
  }
  onPopState(fn) {
    const window2 = getDOM().getGlobalEventTarget(this._doc, "window");
    window2.addEventListener("popstate", fn, false);
    return () => window2.removeEventListener("popstate", fn);
  }
  onHashChange(fn) {
    const window2 = getDOM().getGlobalEventTarget(this._doc, "window");
    window2.addEventListener("hashchange", fn, false);
    return () => window2.removeEventListener("hashchange", fn);
  }
  get href() {
    return this._location.href;
  }
  get protocol() {
    return this._location.protocol;
  }
  get hostname() {
    return this._location.hostname;
  }
  get port() {
    return this._location.port;
  }
  get pathname() {
    return this._location.pathname;
  }
  get search() {
    return this._location.search;
  }
  get hash() {
    return this._location.hash;
  }
  set pathname(newPath) {
    this._location.pathname = newPath;
  }
  pushState(state, title, url) {
    this._history.pushState(state, title, url);
  }
  replaceState(state, title, url) {
    this._history.replaceState(state, title, url);
  }
  forward() {
    this._history.forward();
  }
  back() {
    this._history.back();
  }
  historyGo(relativePosition = 0) {
    this._history.go(relativePosition);
  }
  getState() {
    return this._history.state;
  }
  static \u0275fac = function BrowserPlatformLocation_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _BrowserPlatformLocation)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _BrowserPlatformLocation,
    factory: () => (() => new _BrowserPlatformLocation())(),
    providedIn: "platform"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(BrowserPlatformLocation, [{
    type: Injectable,
    args: [{
      providedIn: "platform",
      useFactory: () => new BrowserPlatformLocation()
    }]
  }], () => [], null);
})();
function joinWithSlash(start, end) {
  if (!start) return end;
  if (!end) return start;
  if (start.endsWith("/")) {
    return end.startsWith("/") ? start + end.slice(1) : start + end;
  }
  return end.startsWith("/") ? start + end : `${start}/${end}`;
}
function stripTrailingSlash(url) {
  const pathEndIdx = url.search(/#|\?|$/);
  return url[pathEndIdx - 1] === "/" ? url.slice(0, pathEndIdx - 1) + url.slice(pathEndIdx) : url;
}
function normalizeQueryParams(params) {
  return params && params[0] !== "?" ? `?${params}` : params;
}
var LocationStrategy = class _LocationStrategy {
  historyGo(relativePosition) {
    throw new Error(ngDevMode ? "Not implemented" : "");
  }
  static \u0275fac = function LocationStrategy_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _LocationStrategy)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _LocationStrategy,
    factory: () => (() => inject2(PathLocationStrategy))(),
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(LocationStrategy, [{
    type: Injectable,
    args: [{
      providedIn: "root",
      useFactory: () => inject2(PathLocationStrategy)
    }]
  }], null, null);
})();
var APP_BASE_HREF = new InjectionToken(ngDevMode ? "appBaseHref" : "");
var PathLocationStrategy = class _PathLocationStrategy extends LocationStrategy {
  _platformLocation;
  _baseHref;
  _removeListenerFns = [];
  constructor(_platformLocation, href) {
    super();
    this._platformLocation = _platformLocation;
    this._baseHref = href ?? this._platformLocation.getBaseHrefFromDOM() ?? inject2(DOCUMENT).location?.origin ?? "";
  }
  /** @docs-private */
  ngOnDestroy() {
    while (this._removeListenerFns.length) {
      this._removeListenerFns.pop()();
    }
  }
  onPopState(fn) {
    this._removeListenerFns.push(this._platformLocation.onPopState(fn), this._platformLocation.onHashChange(fn));
  }
  getBaseHref() {
    return this._baseHref;
  }
  prepareExternalUrl(internal) {
    return joinWithSlash(this._baseHref, internal);
  }
  path(includeHash = false) {
    const pathname = this._platformLocation.pathname + normalizeQueryParams(this._platformLocation.search);
    const hash = this._platformLocation.hash;
    return hash && includeHash ? `${pathname}${hash}` : pathname;
  }
  pushState(state, title, url, queryParams) {
    const externalUrl = this.prepareExternalUrl(url + normalizeQueryParams(queryParams));
    this._platformLocation.pushState(state, title, externalUrl);
  }
  replaceState(state, title, url, queryParams) {
    const externalUrl = this.prepareExternalUrl(url + normalizeQueryParams(queryParams));
    this._platformLocation.replaceState(state, title, externalUrl);
  }
  forward() {
    this._platformLocation.forward();
  }
  back() {
    this._platformLocation.back();
  }
  getState() {
    return this._platformLocation.getState();
  }
  historyGo(relativePosition = 0) {
    this._platformLocation.historyGo?.(relativePosition);
  }
  static \u0275fac = function PathLocationStrategy_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _PathLocationStrategy)(\u0275\u0275inject(PlatformLocation), \u0275\u0275inject(APP_BASE_HREF, 8));
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _PathLocationStrategy,
    factory: _PathLocationStrategy.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PathLocationStrategy, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], () => [{
    type: PlatformLocation
  }, {
    type: void 0,
    decorators: [{
      type: Optional
    }, {
      type: Inject,
      args: [APP_BASE_HREF]
    }]
  }], null);
})();
var Location = class _Location {
  /** @internal */
  _subject = new Subject();
  /** @internal */
  _basePath;
  /** @internal */
  _locationStrategy;
  /** @internal */
  _urlChangeListeners = [];
  /** @internal */
  _urlChangeSubscription = null;
  constructor(locationStrategy) {
    this._locationStrategy = locationStrategy;
    const baseHref = this._locationStrategy.getBaseHref();
    this._basePath = _stripOrigin(stripTrailingSlash(_stripIndexHtml(baseHref)));
    this._locationStrategy.onPopState((ev) => {
      this._subject.next({
        "url": this.path(true),
        "pop": true,
        "state": ev.state,
        "type": ev.type
      });
    });
  }
  /** @docs-private */
  ngOnDestroy() {
    this._urlChangeSubscription?.unsubscribe();
    this._urlChangeListeners = [];
  }
  /**
   * Normalizes the URL path for this location.
   *
   * @param includeHash True to include an anchor fragment in the path.
   *
   * @returns The normalized URL path.
   */
  // TODO: vsavkin. Remove the boolean flag and always include hash once the deprecated router is
  // removed.
  path(includeHash = false) {
    return this.normalize(this._locationStrategy.path(includeHash));
  }
  /**
   * Reports the current state of the location history.
   * @returns The current value of the `history.state` object.
   */
  getState() {
    return this._locationStrategy.getState();
  }
  /**
   * Normalizes the given path and compares to the current normalized path.
   *
   * @param path The given URL path.
   * @param query Query parameters.
   *
   * @returns True if the given URL path is equal to the current normalized path, false
   * otherwise.
   */
  isCurrentPathEqualTo(path, query = "") {
    return this.path() == this.normalize(path + normalizeQueryParams(query));
  }
  /**
   * Normalizes a URL path by stripping any trailing slashes.
   *
   * @param url String representing a URL.
   *
   * @returns The normalized URL string.
   */
  normalize(url) {
    return _Location.stripTrailingSlash(_stripBasePath(this._basePath, _stripIndexHtml(url)));
  }
  /**
   * Normalizes an external URL path.
   * If the given URL doesn't begin with a leading slash (`'/'`), adds one
   * before normalizing. Adds a hash if `HashLocationStrategy` is
   * in use, or the `APP_BASE_HREF` if the `PathLocationStrategy` is in use.
   *
   * @param url String representing a URL.
   *
   * @returns  A normalized platform-specific URL.
   */
  prepareExternalUrl(url) {
    if (url && url[0] !== "/") {
      url = "/" + url;
    }
    return this._locationStrategy.prepareExternalUrl(url);
  }
  // TODO: rename this method to pushState
  /**
   * Changes the browser's URL to a normalized version of a given URL, and pushes a
   * new item onto the platform's history.
   *
   * @param path  URL path to normalize.
   * @param query Query parameters.
   * @param state Location history state.
   *
   */
  go(path, query = "", state = null) {
    this._locationStrategy.pushState(state, "", path, query);
    this._notifyUrlChangeListeners(this.prepareExternalUrl(path + normalizeQueryParams(query)), state);
  }
  /**
   * Changes the browser's URL to a normalized version of the given URL, and replaces
   * the top item on the platform's history stack.
   *
   * @param path  URL path to normalize.
   * @param query Query parameters.
   * @param state Location history state.
   */
  replaceState(path, query = "", state = null) {
    this._locationStrategy.replaceState(state, "", path, query);
    this._notifyUrlChangeListeners(this.prepareExternalUrl(path + normalizeQueryParams(query)), state);
  }
  /**
   * Navigates forward in the platform's history.
   */
  forward() {
    this._locationStrategy.forward();
  }
  /**
   * Navigates back in the platform's history.
   */
  back() {
    this._locationStrategy.back();
  }
  /**
   * Navigate to a specific page from session history, identified by its relative position to the
   * current page.
   *
   * @param relativePosition  Position of the target page in the history relative to the current
   *     page.
   * A negative value moves backwards, a positive value moves forwards, e.g. `location.historyGo(2)`
   * moves forward two pages and `location.historyGo(-2)` moves back two pages. When we try to go
   * beyond what's stored in the history session, we stay in the current page. Same behaviour occurs
   * when `relativePosition` equals 0.
   * @see https://developer.mozilla.org/en-US/docs/Web/API/History_API#Moving_to_a_specific_point_in_history
   */
  historyGo(relativePosition = 0) {
    this._locationStrategy.historyGo?.(relativePosition);
  }
  /**
   * Registers a URL change listener. Use to catch updates performed by the Angular
   * framework that are not detectible through "popstate" or "hashchange" events.
   *
   * @param fn The change handler function, which take a URL and a location history state.
   * @returns A function that, when executed, unregisters a URL change listener.
   */
  onUrlChange(fn) {
    this._urlChangeListeners.push(fn);
    this._urlChangeSubscription ??= this.subscribe((v) => {
      this._notifyUrlChangeListeners(v.url, v.state);
    });
    return () => {
      const fnIndex = this._urlChangeListeners.indexOf(fn);
      this._urlChangeListeners.splice(fnIndex, 1);
      if (this._urlChangeListeners.length === 0) {
        this._urlChangeSubscription?.unsubscribe();
        this._urlChangeSubscription = null;
      }
    };
  }
  /** @internal */
  _notifyUrlChangeListeners(url = "", state) {
    this._urlChangeListeners.forEach((fn) => fn(url, state));
  }
  /**
   * Subscribes to the platform's `popState` events.
   *
   * Note: `Location.go()` does not trigger the `popState` event in the browser. Use
   * `Location.onUrlChange()` to subscribe to URL changes instead.
   *
   * @param value Event that is triggered when the state history changes.
   * @param exception The exception to throw.
   *
   * @see [onpopstate](https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onpopstate)
   *
   * @returns Subscribed events.
   */
  subscribe(onNext, onThrow, onReturn) {
    return this._subject.subscribe({
      next: onNext,
      error: onThrow ?? void 0,
      complete: onReturn ?? void 0
    });
  }
  /**
   * Normalizes URL parameters by prepending with `?` if needed.
   *
   * @param  params String of URL parameters.
   *
   * @returns The normalized URL parameters string.
   */
  static normalizeQueryParams = normalizeQueryParams;
  /**
   * Joins two parts of a URL with a slash if needed.
   *
   * @param start  URL string
   * @param end    URL string
   *
   *
   * @returns The joined URL string.
   */
  static joinWithSlash = joinWithSlash;
  /**
   * Removes a trailing slash from a URL string if needed.
   * Looks for the first occurrence of either `#`, `?`, or the end of the
   * line as `/` characters and removes the trailing slash if one exists.
   *
   * @param url URL string.
   *
   * @returns The URL string, modified if needed.
   */
  static stripTrailingSlash = stripTrailingSlash;
  static \u0275fac = function Location_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _Location)(\u0275\u0275inject(LocationStrategy));
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _Location,
    factory: () => createLocation(),
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(Location, [{
    type: Injectable,
    args: [{
      providedIn: "root",
      // See #23917
      useFactory: createLocation
    }]
  }], () => [{
    type: LocationStrategy
  }], null);
})();
function createLocation() {
  return new Location(\u0275\u0275inject(LocationStrategy));
}
function _stripBasePath(basePath, url) {
  if (!basePath || !url.startsWith(basePath)) {
    return url;
  }
  const strippedUrl = url.substring(basePath.length);
  if (strippedUrl === "" || ["/", ";", "?", "#"].includes(strippedUrl[0])) {
    return strippedUrl;
  }
  return url;
}
function _stripIndexHtml(url) {
  return url.replace(/\/index.html$/, "");
}
function _stripOrigin(baseHref) {
  const isAbsoluteUrl2 = new RegExp("^(https?:)?//").test(baseHref);
  if (isAbsoluteUrl2) {
    const [, pathname] = baseHref.split(/\/\/[^\/]+/);
    return pathname;
  }
  return baseHref;
}

// node_modules/@angular/common/fesm2022/common_module.mjs
var HashLocationStrategy = class _HashLocationStrategy extends LocationStrategy {
  _platformLocation;
  _baseHref = "";
  _removeListenerFns = [];
  constructor(_platformLocation, _baseHref) {
    super();
    this._platformLocation = _platformLocation;
    if (_baseHref != null) {
      this._baseHref = _baseHref;
    }
  }
  /** @docs-private */
  ngOnDestroy() {
    while (this._removeListenerFns.length) {
      this._removeListenerFns.pop()();
    }
  }
  onPopState(fn) {
    this._removeListenerFns.push(this._platformLocation.onPopState(fn), this._platformLocation.onHashChange(fn));
  }
  getBaseHref() {
    return this._baseHref;
  }
  path(includeHash = false) {
    const path = this._platformLocation.hash ?? "#";
    return path.length > 0 ? path.substring(1) : path;
  }
  prepareExternalUrl(internal) {
    const url = joinWithSlash(this._baseHref, internal);
    return url.length > 0 ? "#" + url : url;
  }
  pushState(state, title, path, queryParams) {
    const url = this.prepareExternalUrl(path + normalizeQueryParams(queryParams)) || this._platformLocation.pathname;
    this._platformLocation.pushState(state, title, url);
  }
  replaceState(state, title, path, queryParams) {
    const url = this.prepareExternalUrl(path + normalizeQueryParams(queryParams)) || this._platformLocation.pathname;
    this._platformLocation.replaceState(state, title, url);
  }
  forward() {
    this._platformLocation.forward();
  }
  back() {
    this._platformLocation.back();
  }
  getState() {
    return this._platformLocation.getState();
  }
  historyGo(relativePosition = 0) {
    this._platformLocation.historyGo?.(relativePosition);
  }
  static \u0275fac = function HashLocationStrategy_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _HashLocationStrategy)(\u0275\u0275inject(PlatformLocation), \u0275\u0275inject(APP_BASE_HREF, 8));
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _HashLocationStrategy,
    factory: _HashLocationStrategy.\u0275fac
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HashLocationStrategy, [{
    type: Injectable
  }], () => [{
    type: PlatformLocation
  }, {
    type: void 0,
    decorators: [{
      type: Optional
    }, {
      type: Inject,
      args: [APP_BASE_HREF]
    }]
  }], null);
})();
var CURRENCIES_EN = {
  "ADP": [void 0, void 0, 0],
  "AFN": [void 0, "\u060B", 0],
  "ALL": [void 0, void 0, 0],
  "AMD": [void 0, "\u058F", 2],
  "AOA": [void 0, "Kz"],
  "ARS": [void 0, "$"],
  "AUD": ["A$", "$"],
  "AZN": [void 0, "\u20BC"],
  "BAM": [void 0, "KM"],
  "BBD": [void 0, "$"],
  "BDT": [void 0, "\u09F3"],
  "BHD": [void 0, void 0, 3],
  "BIF": [void 0, void 0, 0],
  "BMD": [void 0, "$"],
  "BND": [void 0, "$"],
  "BOB": [void 0, "Bs"],
  "BRL": ["R$"],
  "BSD": [void 0, "$"],
  "BWP": [void 0, "P"],
  "BYN": [void 0, void 0, 2],
  "BYR": [void 0, void 0, 0],
  "BZD": [void 0, "$"],
  "CAD": ["CA$", "$", 2],
  "CHF": [void 0, void 0, 2],
  "CLF": [void 0, void 0, 4],
  "CLP": [void 0, "$", 0],
  "CNY": ["CN\xA5", "\xA5"],
  "COP": [void 0, "$", 2],
  "CRC": [void 0, "\u20A1", 2],
  "CUC": [void 0, "$"],
  "CUP": [void 0, "$"],
  "CZK": [void 0, "K\u010D", 2],
  "DJF": [void 0, void 0, 0],
  "DKK": [void 0, "kr", 2],
  "DOP": [void 0, "$"],
  "EGP": [void 0, "E\xA3"],
  "ESP": [void 0, "\u20A7", 0],
  "EUR": ["\u20AC"],
  "FJD": [void 0, "$"],
  "FKP": [void 0, "\xA3"],
  "GBP": ["\xA3"],
  "GEL": [void 0, "\u20BE"],
  "GHS": [void 0, "GH\u20B5"],
  "GIP": [void 0, "\xA3"],
  "GNF": [void 0, "FG", 0],
  "GTQ": [void 0, "Q"],
  "GYD": [void 0, "$", 2],
  "HKD": ["HK$", "$"],
  "HNL": [void 0, "L"],
  "HRK": [void 0, "kn"],
  "HUF": [void 0, "Ft", 2],
  "IDR": [void 0, "Rp", 2],
  "ILS": ["\u20AA"],
  "INR": ["\u20B9"],
  "IQD": [void 0, void 0, 0],
  "IRR": [void 0, void 0, 0],
  "ISK": [void 0, "kr", 0],
  "ITL": [void 0, void 0, 0],
  "JMD": [void 0, "$"],
  "JOD": [void 0, void 0, 3],
  "JPY": ["\xA5", void 0, 0],
  "KHR": [void 0, "\u17DB"],
  "KMF": [void 0, "CF", 0],
  "KPW": [void 0, "\u20A9", 0],
  "KRW": ["\u20A9", void 0, 0],
  "KWD": [void 0, void 0, 3],
  "KYD": [void 0, "$"],
  "KZT": [void 0, "\u20B8"],
  "LAK": [void 0, "\u20AD", 0],
  "LBP": [void 0, "L\xA3", 0],
  "LKR": [void 0, "Rs"],
  "LRD": [void 0, "$"],
  "LTL": [void 0, "Lt"],
  "LUF": [void 0, void 0, 0],
  "LVL": [void 0, "Ls"],
  "LYD": [void 0, void 0, 3],
  "MGA": [void 0, "Ar", 0],
  "MGF": [void 0, void 0, 0],
  "MMK": [void 0, "K", 0],
  "MNT": [void 0, "\u20AE", 2],
  "MRO": [void 0, void 0, 0],
  "MUR": [void 0, "Rs", 2],
  "MXN": ["MX$", "$"],
  "MYR": [void 0, "RM"],
  "NAD": [void 0, "$"],
  "NGN": [void 0, "\u20A6"],
  "NIO": [void 0, "C$"],
  "NOK": [void 0, "kr", 2],
  "NPR": [void 0, "Rs"],
  "NZD": ["NZ$", "$"],
  "OMR": [void 0, void 0, 3],
  "PHP": ["\u20B1"],
  "PKR": [void 0, "Rs", 2],
  "PLN": [void 0, "z\u0142"],
  "PYG": [void 0, "\u20B2", 0],
  "RON": [void 0, "lei"],
  "RSD": [void 0, void 0, 0],
  "RUB": [void 0, "\u20BD"],
  "RWF": [void 0, "RF", 0],
  "SBD": [void 0, "$"],
  "SEK": [void 0, "kr", 2],
  "SGD": [void 0, "$"],
  "SHP": [void 0, "\xA3"],
  "SLE": [void 0, void 0, 2],
  "SLL": [void 0, void 0, 0],
  "SOS": [void 0, void 0, 0],
  "SRD": [void 0, "$"],
  "SSP": [void 0, "\xA3"],
  "STD": [void 0, void 0, 0],
  "STN": [void 0, "Db"],
  "SYP": [void 0, "\xA3", 0],
  "THB": [void 0, "\u0E3F"],
  "TMM": [void 0, void 0, 0],
  "TND": [void 0, void 0, 3],
  "TOP": [void 0, "T$"],
  "TRL": [void 0, void 0, 0],
  "TRY": [void 0, "\u20BA"],
  "TTD": [void 0, "$"],
  "TWD": ["NT$", "$", 2],
  "TZS": [void 0, void 0, 2],
  "UAH": [void 0, "\u20B4"],
  "UGX": [void 0, void 0, 0],
  "USD": ["$"],
  "UYI": [void 0, void 0, 0],
  "UYU": [void 0, "$"],
  "UYW": [void 0, void 0, 4],
  "UZS": [void 0, void 0, 2],
  "VEF": [void 0, "Bs", 2],
  "VND": ["\u20AB", void 0, 0],
  "VUV": [void 0, void 0, 0],
  "XAF": ["FCFA", void 0, 0],
  "XCD": ["EC$", "$"],
  "XOF": ["F\u202FCFA", void 0, 0],
  "XPF": ["CFPF", void 0, 0],
  "XXX": ["\xA4"],
  "YER": [void 0, void 0, 0],
  "ZAR": [void 0, "R"],
  "ZMK": [void 0, void 0, 0],
  "ZMW": [void 0, "ZK"],
  "ZWD": [void 0, void 0, 0]
};
var NumberFormatStyle;
(function(NumberFormatStyle2) {
  NumberFormatStyle2[NumberFormatStyle2["Decimal"] = 0] = "Decimal";
  NumberFormatStyle2[NumberFormatStyle2["Percent"] = 1] = "Percent";
  NumberFormatStyle2[NumberFormatStyle2["Currency"] = 2] = "Currency";
  NumberFormatStyle2[NumberFormatStyle2["Scientific"] = 3] = "Scientific";
})(NumberFormatStyle || (NumberFormatStyle = {}));
var Plural;
(function(Plural2) {
  Plural2[Plural2["Zero"] = 0] = "Zero";
  Plural2[Plural2["One"] = 1] = "One";
  Plural2[Plural2["Two"] = 2] = "Two";
  Plural2[Plural2["Few"] = 3] = "Few";
  Plural2[Plural2["Many"] = 4] = "Many";
  Plural2[Plural2["Other"] = 5] = "Other";
})(Plural || (Plural = {}));
var FormStyle;
(function(FormStyle2) {
  FormStyle2[FormStyle2["Format"] = 0] = "Format";
  FormStyle2[FormStyle2["Standalone"] = 1] = "Standalone";
})(FormStyle || (FormStyle = {}));
var TranslationWidth;
(function(TranslationWidth2) {
  TranslationWidth2[TranslationWidth2["Narrow"] = 0] = "Narrow";
  TranslationWidth2[TranslationWidth2["Abbreviated"] = 1] = "Abbreviated";
  TranslationWidth2[TranslationWidth2["Wide"] = 2] = "Wide";
  TranslationWidth2[TranslationWidth2["Short"] = 3] = "Short";
})(TranslationWidth || (TranslationWidth = {}));
var FormatWidth;
(function(FormatWidth2) {
  FormatWidth2[FormatWidth2["Short"] = 0] = "Short";
  FormatWidth2[FormatWidth2["Medium"] = 1] = "Medium";
  FormatWidth2[FormatWidth2["Long"] = 2] = "Long";
  FormatWidth2[FormatWidth2["Full"] = 3] = "Full";
})(FormatWidth || (FormatWidth = {}));
var NumberSymbol = {
  /**
   * Decimal separator.
   * For `en-US`, the dot character.
   * Example: 2,345`.`67
   */
  Decimal: 0,
  /**
   * Grouping separator, typically for thousands.
   * For `en-US`, the comma character.
   * Example: 2`,`345.67
   */
  Group: 1,
  /**
   * List-item separator.
   * Example: "one, two, and three"
   */
  List: 2,
  /**
   * Sign for percentage (out of 100).
   * Example: 23.4%
   */
  PercentSign: 3,
  /**
   * Sign for positive numbers.
   * Example: +23
   */
  PlusSign: 4,
  /**
   * Sign for negative numbers.
   * Example: -23
   */
  MinusSign: 5,
  /**
   * Computer notation for exponential value (n times a power of 10).
   * Example: 1.2E3
   */
  Exponential: 6,
  /**
   * Human-readable format of exponential.
   * Example: 1.2x103
   */
  SuperscriptingExponent: 7,
  /**
   * Sign for permille (out of 1000).
   * Example: 23.4‰
   */
  PerMille: 8,
  /**
   * Infinity, can be used with plus and minus.
   * Example: ∞, +∞, -∞
   */
  Infinity: 9,
  /**
   * Not a number.
   * Example: NaN
   */
  NaN: 10,
  /**
   * Symbol used between time units.
   * Example: 10:52
   */
  TimeSeparator: 11,
  /**
   * Decimal separator for currency values (fallback to `Decimal`).
   * Example: $2,345.67
   */
  CurrencyDecimal: 12,
  /**
   * Group separator for currency values (fallback to `Group`).
   * Example: $2,345.67
   */
  CurrencyGroup: 13
};
var WeekDay;
(function(WeekDay2) {
  WeekDay2[WeekDay2["Sunday"] = 0] = "Sunday";
  WeekDay2[WeekDay2["Monday"] = 1] = "Monday";
  WeekDay2[WeekDay2["Tuesday"] = 2] = "Tuesday";
  WeekDay2[WeekDay2["Wednesday"] = 3] = "Wednesday";
  WeekDay2[WeekDay2["Thursday"] = 4] = "Thursday";
  WeekDay2[WeekDay2["Friday"] = 5] = "Friday";
  WeekDay2[WeekDay2["Saturday"] = 6] = "Saturday";
})(WeekDay || (WeekDay = {}));
function getLocaleId2(locale) {
  return findLocaleData(locale)[LocaleDataIndex.LocaleId];
}
function getLocaleDayPeriods(locale, formStyle, width) {
  const data = findLocaleData(locale);
  const amPmData = [data[LocaleDataIndex.DayPeriodsFormat], data[LocaleDataIndex.DayPeriodsStandalone]];
  const amPm = getLastDefinedValue(amPmData, formStyle);
  return getLastDefinedValue(amPm, width);
}
function getLocaleDayNames(locale, formStyle, width) {
  const data = findLocaleData(locale);
  const daysData = [data[LocaleDataIndex.DaysFormat], data[LocaleDataIndex.DaysStandalone]];
  const days = getLastDefinedValue(daysData, formStyle);
  return getLastDefinedValue(days, width);
}
function getLocaleMonthNames(locale, formStyle, width) {
  const data = findLocaleData(locale);
  const monthsData = [data[LocaleDataIndex.MonthsFormat], data[LocaleDataIndex.MonthsStandalone]];
  const months = getLastDefinedValue(monthsData, formStyle);
  return getLastDefinedValue(months, width);
}
function getLocaleEraNames(locale, width) {
  const data = findLocaleData(locale);
  const erasData = data[LocaleDataIndex.Eras];
  return getLastDefinedValue(erasData, width);
}
function getLocaleDateFormat(locale, width) {
  const data = findLocaleData(locale);
  return getLastDefinedValue(data[LocaleDataIndex.DateFormat], width);
}
function getLocaleTimeFormat(locale, width) {
  const data = findLocaleData(locale);
  return getLastDefinedValue(data[LocaleDataIndex.TimeFormat], width);
}
function getLocaleDateTimeFormat(locale, width) {
  const data = findLocaleData(locale);
  const dateTimeFormatData = data[LocaleDataIndex.DateTimeFormat];
  return getLastDefinedValue(dateTimeFormatData, width);
}
function getLocaleNumberSymbol(locale, symbol) {
  const data = findLocaleData(locale);
  const res = data[LocaleDataIndex.NumberSymbols][symbol];
  if (typeof res === "undefined") {
    if (symbol === NumberSymbol.CurrencyDecimal) {
      return data[LocaleDataIndex.NumberSymbols][NumberSymbol.Decimal];
    } else if (symbol === NumberSymbol.CurrencyGroup) {
      return data[LocaleDataIndex.NumberSymbols][NumberSymbol.Group];
    }
  }
  return res;
}
function getLocaleNumberFormat(locale, type) {
  const data = findLocaleData(locale);
  return data[LocaleDataIndex.NumberFormats][type];
}
function getLocaleCurrencies(locale) {
  const data = findLocaleData(locale);
  return data[LocaleDataIndex.Currencies];
}
var getLocalePluralCase2 = getLocalePluralCase;
function checkFullData(data) {
  if (!data[LocaleDataIndex.ExtraData]) {
    throw new RuntimeError(2303, ngDevMode && `Missing extra locale data for the locale "${data[LocaleDataIndex.LocaleId]}". Use "registerLocaleData" to load new data. See the "I18n guide" on angular.io to know more.`);
  }
}
function getLocaleExtraDayPeriodRules(locale) {
  const data = findLocaleData(locale);
  checkFullData(data);
  const rules = data[LocaleDataIndex.ExtraData][
    2
    /* ɵExtraLocaleDataIndex.ExtraDayPeriodsRules */
  ] || [];
  return rules.map((rule) => {
    if (typeof rule === "string") {
      return extractTime(rule);
    }
    return [extractTime(rule[0]), extractTime(rule[1])];
  });
}
function getLocaleExtraDayPeriods(locale, formStyle, width) {
  const data = findLocaleData(locale);
  checkFullData(data);
  const dayPeriodsData = [data[LocaleDataIndex.ExtraData][
    0
    /* ɵExtraLocaleDataIndex.ExtraDayPeriodFormats */
  ], data[LocaleDataIndex.ExtraData][
    1
    /* ɵExtraLocaleDataIndex.ExtraDayPeriodStandalone */
  ]];
  const dayPeriods = getLastDefinedValue(dayPeriodsData, formStyle) || [];
  return getLastDefinedValue(dayPeriods, width) || [];
}
function getLastDefinedValue(data, index) {
  for (let i = index; i > -1; i--) {
    if (typeof data[i] !== "undefined") {
      return data[i];
    }
  }
  throw new RuntimeError(2304, ngDevMode && "Locale data API: locale data undefined");
}
function extractTime(time) {
  const [h, m] = time.split(":");
  return {
    hours: +h,
    minutes: +m
  };
}
function getCurrencySymbol(code, format, locale = "en") {
  const currency = getLocaleCurrencies(locale)[code] || CURRENCIES_EN[code] || [];
  const symbolNarrow = currency[
    1
    /* ɵCurrencyIndex.SymbolNarrow */
  ];
  if (format === "narrow" && typeof symbolNarrow === "string") {
    return symbolNarrow;
  }
  return currency[
    0
    /* ɵCurrencyIndex.Symbol */
  ] || code;
}
var DEFAULT_NB_OF_CURRENCY_DIGITS = 2;
function getNumberOfCurrencyDigits(code) {
  let digits;
  const currency = CURRENCIES_EN[code];
  if (currency) {
    digits = currency[
      2
      /* ɵCurrencyIndex.NbOfDigits */
    ];
  }
  return typeof digits === "number" ? digits : DEFAULT_NB_OF_CURRENCY_DIGITS;
}
var ISO8601_DATE_REGEX = /^(\d{4,})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;
var NAMED_FORMATS = {};
var DATE_FORMATS_SPLIT = /((?:[^BEGHLMOSWYZabcdhmswyz']+)|(?:'(?:[^']|'')*')|(?:G{1,5}|y{1,4}|Y{1,4}|M{1,5}|L{1,5}|w{1,2}|W{1}|d{1,2}|E{1,6}|c{1,6}|a{1,5}|b{1,5}|B{1,5}|h{1,2}|H{1,2}|m{1,2}|s{1,2}|S{1,3}|z{1,4}|Z{1,5}|O{1,4}))([\s\S]*)/;
function formatDate(value, format, locale, timezone) {
  let date = toDate(value);
  const namedFormat = getNamedFormat(locale, format);
  format = namedFormat || format;
  let parts = [];
  let match2;
  while (format) {
    match2 = DATE_FORMATS_SPLIT.exec(format);
    if (match2) {
      parts = parts.concat(match2.slice(1));
      const part = parts.pop();
      if (!part) {
        break;
      }
      format = part;
    } else {
      parts.push(format);
      break;
    }
  }
  if (typeof ngDevMode === "undefined" || ngDevMode) {
    assertValidDateFormat(parts);
  }
  let dateTimezoneOffset = date.getTimezoneOffset();
  if (timezone) {
    dateTimezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
    date = convertTimezoneToLocal(date, timezone);
  }
  let text = "";
  parts.forEach((value2) => {
    const dateFormatter = getDateFormatter(value2);
    text += dateFormatter ? dateFormatter(date, locale, dateTimezoneOffset) : value2 === "''" ? "'" : value2.replace(/(^'|'$)/g, "").replace(/''/g, "'");
  });
  return text;
}
function assertValidDateFormat(parts) {
  if (parts.some((part) => /^Y+$/.test(part)) && !parts.some((part) => /^w+$/.test(part))) {
    const message = `Suspicious use of week-based year "Y" in date pattern "${parts.join("")}". Did you mean to use calendar year "y" instead?`;
    if (parts.length === 1) {
      console.error(formatRuntimeError(2300, message));
    } else {
      throw new RuntimeError(2300, message);
    }
  }
}
function createDate(year, month, date) {
  const newDate = /* @__PURE__ */ new Date(0);
  newDate.setFullYear(year, month, date);
  newDate.setHours(0, 0, 0);
  return newDate;
}
function getNamedFormat(locale, format) {
  const localeId = getLocaleId2(locale);
  NAMED_FORMATS[localeId] ??= {};
  if (NAMED_FORMATS[localeId][format]) {
    return NAMED_FORMATS[localeId][format];
  }
  let formatValue2 = "";
  switch (format) {
    case "shortDate":
      formatValue2 = getLocaleDateFormat(locale, FormatWidth.Short);
      break;
    case "mediumDate":
      formatValue2 = getLocaleDateFormat(locale, FormatWidth.Medium);
      break;
    case "longDate":
      formatValue2 = getLocaleDateFormat(locale, FormatWidth.Long);
      break;
    case "fullDate":
      formatValue2 = getLocaleDateFormat(locale, FormatWidth.Full);
      break;
    case "shortTime":
      formatValue2 = getLocaleTimeFormat(locale, FormatWidth.Short);
      break;
    case "mediumTime":
      formatValue2 = getLocaleTimeFormat(locale, FormatWidth.Medium);
      break;
    case "longTime":
      formatValue2 = getLocaleTimeFormat(locale, FormatWidth.Long);
      break;
    case "fullTime":
      formatValue2 = getLocaleTimeFormat(locale, FormatWidth.Full);
      break;
    case "short":
      const shortTime = getNamedFormat(locale, "shortTime");
      const shortDate = getNamedFormat(locale, "shortDate");
      formatValue2 = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Short), [shortTime, shortDate]);
      break;
    case "medium":
      const mediumTime = getNamedFormat(locale, "mediumTime");
      const mediumDate = getNamedFormat(locale, "mediumDate");
      formatValue2 = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Medium), [mediumTime, mediumDate]);
      break;
    case "long":
      const longTime = getNamedFormat(locale, "longTime");
      const longDate = getNamedFormat(locale, "longDate");
      formatValue2 = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Long), [longTime, longDate]);
      break;
    case "full":
      const fullTime = getNamedFormat(locale, "fullTime");
      const fullDate = getNamedFormat(locale, "fullDate");
      formatValue2 = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Full), [fullTime, fullDate]);
      break;
  }
  if (formatValue2) {
    NAMED_FORMATS[localeId][format] = formatValue2;
  }
  return formatValue2;
}
function formatDateTime(str, opt_values) {
  if (opt_values) {
    str = str.replace(/\{([^}]+)}/g, function(match2, key) {
      return opt_values != null && key in opt_values ? opt_values[key] : match2;
    });
  }
  return str;
}
function padNumber(num, digits, minusSign = "-", trim, negWrap) {
  let neg = "";
  if (num < 0 || negWrap && num <= 0) {
    if (negWrap) {
      num = -num + 1;
    } else {
      num = -num;
      neg = minusSign;
    }
  }
  let strNum = String(num);
  while (strNum.length < digits) {
    strNum = "0" + strNum;
  }
  if (trim) {
    strNum = strNum.slice(strNum.length - digits);
  }
  return neg + strNum;
}
function formatFractionalSeconds(milliseconds, digits) {
  const strMs = padNumber(milliseconds, 3);
  return strMs.substring(0, digits);
}
function dateGetter(name2, size, offset = 0, trim = false, negWrap = false) {
  return function(date, locale) {
    let part = getDatePart(name2, date);
    if (offset > 0 || part > -offset) {
      part += offset;
    }
    if (name2 === 3) {
      if (part === 0 && offset === -12) {
        part = 12;
      }
    } else if (name2 === 6) {
      return formatFractionalSeconds(part, size);
    }
    const localeMinus = getLocaleNumberSymbol(locale, NumberSymbol.MinusSign);
    return padNumber(part, size, localeMinus, trim, negWrap);
  };
}
function getDatePart(part, date) {
  switch (part) {
    case 0:
      return date.getFullYear();
    case 1:
      return date.getMonth();
    case 2:
      return date.getDate();
    case 3:
      return date.getHours();
    case 4:
      return date.getMinutes();
    case 5:
      return date.getSeconds();
    case 6:
      return date.getMilliseconds();
    case 7:
      return date.getDay();
    default:
      throw new RuntimeError(2301, ngDevMode && `Unknown DateType value "${part}".`);
  }
}
function dateStrGetter(name2, width, form = FormStyle.Format, extended = false) {
  return function(date, locale) {
    return getDateTranslation(date, locale, name2, width, form, extended);
  };
}
function getDateTranslation(date, locale, name2, width, form, extended) {
  switch (name2) {
    case 2:
      return getLocaleMonthNames(locale, form, width)[date.getMonth()];
    case 1:
      return getLocaleDayNames(locale, form, width)[date.getDay()];
    case 0:
      const currentHours = date.getHours();
      const currentMinutes = date.getMinutes();
      if (extended) {
        const rules = getLocaleExtraDayPeriodRules(locale);
        const dayPeriods = getLocaleExtraDayPeriods(locale, form, width);
        const index = rules.findIndex((rule) => {
          if (Array.isArray(rule)) {
            const [from2, to] = rule;
            const afterFrom = currentHours >= from2.hours && currentMinutes >= from2.minutes;
            const beforeTo = currentHours < to.hours || currentHours === to.hours && currentMinutes < to.minutes;
            if (from2.hours < to.hours) {
              if (afterFrom && beforeTo) {
                return true;
              }
            } else if (afterFrom || beforeTo) {
              return true;
            }
          } else {
            if (rule.hours === currentHours && rule.minutes === currentMinutes) {
              return true;
            }
          }
          return false;
        });
        if (index !== -1) {
          return dayPeriods[index];
        }
      }
      return getLocaleDayPeriods(locale, form, width)[currentHours < 12 ? 0 : 1];
    case 3:
      return getLocaleEraNames(locale, width)[date.getFullYear() <= 0 ? 0 : 1];
    default:
      const unexpected = name2;
      throw new RuntimeError(2302, ngDevMode && `unexpected translation type ${unexpected}`);
  }
}
function timeZoneGetter(width) {
  return function(date, locale, offset) {
    const zone = -1 * offset;
    const minusSign = getLocaleNumberSymbol(locale, NumberSymbol.MinusSign);
    const hours = zone > 0 ? Math.floor(zone / 60) : Math.ceil(zone / 60);
    switch (width) {
      case 0:
        return (zone >= 0 ? "+" : "") + padNumber(hours, 2, minusSign) + padNumber(Math.abs(zone % 60), 2, minusSign);
      case 1:
        return "GMT" + (zone >= 0 ? "+" : "") + padNumber(hours, 1, minusSign);
      case 2:
        return "GMT" + (zone >= 0 ? "+" : "") + padNumber(hours, 2, minusSign) + ":" + padNumber(Math.abs(zone % 60), 2, minusSign);
      case 3:
        if (offset === 0) {
          return "Z";
        } else {
          return (zone >= 0 ? "+" : "") + padNumber(hours, 2, minusSign) + ":" + padNumber(Math.abs(zone % 60), 2, minusSign);
        }
      default:
        throw new RuntimeError(2302, ngDevMode && `Unknown zone width "${width}"`);
    }
  };
}
var JANUARY = 0;
var THURSDAY = 4;
function getFirstThursdayOfYear(year) {
  const firstDayOfYear = createDate(year, JANUARY, 1).getDay();
  return createDate(year, 0, 1 + (firstDayOfYear <= THURSDAY ? THURSDAY : THURSDAY + 7) - firstDayOfYear);
}
function getThursdayThisIsoWeek(datetime) {
  const currentDay = datetime.getDay();
  const deltaToThursday = currentDay === 0 ? -3 : THURSDAY - currentDay;
  return createDate(datetime.getFullYear(), datetime.getMonth(), datetime.getDate() + deltaToThursday);
}
function weekGetter(size, monthBased = false) {
  return function(date, locale) {
    let result;
    if (monthBased) {
      const nbDaysBefore1stDayOfMonth = new Date(date.getFullYear(), date.getMonth(), 1).getDay() - 1;
      const today = date.getDate();
      result = 1 + Math.floor((today + nbDaysBefore1stDayOfMonth) / 7);
    } else {
      const thisThurs = getThursdayThisIsoWeek(date);
      const firstThurs = getFirstThursdayOfYear(thisThurs.getFullYear());
      const diff = thisThurs.getTime() - firstThurs.getTime();
      result = 1 + Math.round(diff / 6048e5);
    }
    return padNumber(result, size, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));
  };
}
function weekNumberingYearGetter(size, trim = false) {
  return function(date, locale) {
    const thisThurs = getThursdayThisIsoWeek(date);
    const weekNumberingYear = thisThurs.getFullYear();
    return padNumber(weekNumberingYear, size, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign), trim);
  };
}
var DATE_FORMATS = {};
function getDateFormatter(format) {
  if (DATE_FORMATS[format]) {
    return DATE_FORMATS[format];
  }
  let formatter;
  switch (format) {
    // Era name (AD/BC)
    case "G":
    case "GG":
    case "GGG":
      formatter = dateStrGetter(3, TranslationWidth.Abbreviated);
      break;
    case "GGGG":
      formatter = dateStrGetter(3, TranslationWidth.Wide);
      break;
    case "GGGGG":
      formatter = dateStrGetter(3, TranslationWidth.Narrow);
      break;
    // 1 digit representation of the year, e.g. (AD 1 => 1, AD 199 => 199)
    case "y":
      formatter = dateGetter(0, 1, 0, false, true);
      break;
    // 2 digit representation of the year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10)
    case "yy":
      formatter = dateGetter(0, 2, 0, true, true);
      break;
    // 3 digit representation of the year, padded (000-999). (e.g. AD 2001 => 01, AD 2010 => 10)
    case "yyy":
      formatter = dateGetter(0, 3, 0, false, true);
      break;
    // 4 digit representation of the year (e.g. AD 1 => 0001, AD 2010 => 2010)
    case "yyyy":
      formatter = dateGetter(0, 4, 0, false, true);
      break;
    // 1 digit representation of the week-numbering year, e.g. (AD 1 => 1, AD 199 => 199)
    case "Y":
      formatter = weekNumberingYearGetter(1);
      break;
    // 2 digit representation of the week-numbering year, padded (00-99). (e.g. AD 2001 => 01, AD
    // 2010 => 10)
    case "YY":
      formatter = weekNumberingYearGetter(2, true);
      break;
    // 3 digit representation of the week-numbering year, padded (000-999). (e.g. AD 1 => 001, AD
    // 2010 => 2010)
    case "YYY":
      formatter = weekNumberingYearGetter(3);
      break;
    // 4 digit representation of the week-numbering year (e.g. AD 1 => 0001, AD 2010 => 2010)
    case "YYYY":
      formatter = weekNumberingYearGetter(4);
      break;
    // Month of the year (1-12), numeric
    case "M":
    case "L":
      formatter = dateGetter(1, 1, 1);
      break;
    case "MM":
    case "LL":
      formatter = dateGetter(1, 2, 1);
      break;
    // Month of the year (January, ...), string, format
    case "MMM":
      formatter = dateStrGetter(2, TranslationWidth.Abbreviated);
      break;
    case "MMMM":
      formatter = dateStrGetter(2, TranslationWidth.Wide);
      break;
    case "MMMMM":
      formatter = dateStrGetter(2, TranslationWidth.Narrow);
      break;
    // Month of the year (January, ...), string, standalone
    case "LLL":
      formatter = dateStrGetter(2, TranslationWidth.Abbreviated, FormStyle.Standalone);
      break;
    case "LLLL":
      formatter = dateStrGetter(2, TranslationWidth.Wide, FormStyle.Standalone);
      break;
    case "LLLLL":
      formatter = dateStrGetter(2, TranslationWidth.Narrow, FormStyle.Standalone);
      break;
    // Week of the year (1, ... 52)
    case "w":
      formatter = weekGetter(1);
      break;
    case "ww":
      formatter = weekGetter(2);
      break;
    // Week of the month (1, ...)
    case "W":
      formatter = weekGetter(1, true);
      break;
    // Day of the month (1-31)
    case "d":
      formatter = dateGetter(2, 1);
      break;
    case "dd":
      formatter = dateGetter(2, 2);
      break;
    // Day of the Week StandAlone (1, 1, Mon, Monday, M, Mo)
    case "c":
    case "cc":
      formatter = dateGetter(7, 1);
      break;
    case "ccc":
      formatter = dateStrGetter(1, TranslationWidth.Abbreviated, FormStyle.Standalone);
      break;
    case "cccc":
      formatter = dateStrGetter(1, TranslationWidth.Wide, FormStyle.Standalone);
      break;
    case "ccccc":
      formatter = dateStrGetter(1, TranslationWidth.Narrow, FormStyle.Standalone);
      break;
    case "cccccc":
      formatter = dateStrGetter(1, TranslationWidth.Short, FormStyle.Standalone);
      break;
    // Day of the Week
    case "E":
    case "EE":
    case "EEE":
      formatter = dateStrGetter(1, TranslationWidth.Abbreviated);
      break;
    case "EEEE":
      formatter = dateStrGetter(1, TranslationWidth.Wide);
      break;
    case "EEEEE":
      formatter = dateStrGetter(1, TranslationWidth.Narrow);
      break;
    case "EEEEEE":
      formatter = dateStrGetter(1, TranslationWidth.Short);
      break;
    // Generic period of the day (am-pm)
    case "a":
    case "aa":
    case "aaa":
      formatter = dateStrGetter(0, TranslationWidth.Abbreviated);
      break;
    case "aaaa":
      formatter = dateStrGetter(0, TranslationWidth.Wide);
      break;
    case "aaaaa":
      formatter = dateStrGetter(0, TranslationWidth.Narrow);
      break;
    // Extended period of the day (midnight, at night, ...), standalone
    case "b":
    case "bb":
    case "bbb":
      formatter = dateStrGetter(0, TranslationWidth.Abbreviated, FormStyle.Standalone, true);
      break;
    case "bbbb":
      formatter = dateStrGetter(0, TranslationWidth.Wide, FormStyle.Standalone, true);
      break;
    case "bbbbb":
      formatter = dateStrGetter(0, TranslationWidth.Narrow, FormStyle.Standalone, true);
      break;
    // Extended period of the day (midnight, night, ...), standalone
    case "B":
    case "BB":
    case "BBB":
      formatter = dateStrGetter(0, TranslationWidth.Abbreviated, FormStyle.Format, true);
      break;
    case "BBBB":
      formatter = dateStrGetter(0, TranslationWidth.Wide, FormStyle.Format, true);
      break;
    case "BBBBB":
      formatter = dateStrGetter(0, TranslationWidth.Narrow, FormStyle.Format, true);
      break;
    // Hour in AM/PM, (1-12)
    case "h":
      formatter = dateGetter(3, 1, -12);
      break;
    case "hh":
      formatter = dateGetter(3, 2, -12);
      break;
    // Hour of the day (0-23)
    case "H":
      formatter = dateGetter(3, 1);
      break;
    // Hour in day, padded (00-23)
    case "HH":
      formatter = dateGetter(3, 2);
      break;
    // Minute of the hour (0-59)
    case "m":
      formatter = dateGetter(4, 1);
      break;
    case "mm":
      formatter = dateGetter(4, 2);
      break;
    // Second of the minute (0-59)
    case "s":
      formatter = dateGetter(5, 1);
      break;
    case "ss":
      formatter = dateGetter(5, 2);
      break;
    // Fractional second
    case "S":
      formatter = dateGetter(6, 1);
      break;
    case "SS":
      formatter = dateGetter(6, 2);
      break;
    case "SSS":
      formatter = dateGetter(6, 3);
      break;
    // Timezone ISO8601 short format (-0430)
    case "Z":
    case "ZZ":
    case "ZZZ":
      formatter = timeZoneGetter(
        0
        /* ZoneWidth.Short */
      );
      break;
    // Timezone ISO8601 extended format (-04:30)
    case "ZZZZZ":
      formatter = timeZoneGetter(
        3
        /* ZoneWidth.Extended */
      );
      break;
    // Timezone GMT short format (GMT+4)
    case "O":
    case "OO":
    case "OOO":
    // Should be location, but fallback to format O instead because we don't have the data yet
    case "z":
    case "zz":
    case "zzz":
      formatter = timeZoneGetter(
        1
        /* ZoneWidth.ShortGMT */
      );
      break;
    // Timezone GMT long format (GMT+0430)
    case "OOOO":
    case "ZZZZ":
    // Should be location, but fallback to format O instead because we don't have the data yet
    case "zzzz":
      formatter = timeZoneGetter(
        2
        /* ZoneWidth.Long */
      );
      break;
    default:
      return null;
  }
  DATE_FORMATS[format] = formatter;
  return formatter;
}
function timezoneToOffset(timezone, fallback) {
  timezone = timezone.replace(/:/g, "");
  const requestedTimezoneOffset = Date.parse("Jan 01, 1970 00:00:00 " + timezone) / 6e4;
  return isNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset;
}
function addDateMinutes(date, minutes) {
  date = new Date(date.getTime());
  date.setMinutes(date.getMinutes() + minutes);
  return date;
}
function convertTimezoneToLocal(date, timezone, reverse) {
  const reverseValue = -1;
  const dateTimezoneOffset = date.getTimezoneOffset();
  const timezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
  return addDateMinutes(date, reverseValue * (timezoneOffset - dateTimezoneOffset));
}
function toDate(value) {
  if (isDate(value)) {
    return value;
  }
  if (typeof value === "number" && !isNaN(value)) {
    return new Date(value);
  }
  if (typeof value === "string") {
    value = value.trim();
    if (/^(\d{4}(-\d{1,2}(-\d{1,2})?)?)$/.test(value)) {
      const [y, m = 1, d = 1] = value.split("-").map((val) => +val);
      return createDate(y, m - 1, d);
    }
    const parsedNb = parseFloat(value);
    if (!isNaN(value - parsedNb)) {
      return new Date(parsedNb);
    }
    let match2;
    if (match2 = value.match(ISO8601_DATE_REGEX)) {
      return isoStringToDate(match2);
    }
  }
  const date = new Date(value);
  if (!isDate(date)) {
    throw new RuntimeError(2302, ngDevMode && `Unable to convert "${value}" into a date`);
  }
  return date;
}
function isoStringToDate(match2) {
  const date = /* @__PURE__ */ new Date(0);
  let tzHour = 0;
  let tzMin = 0;
  const dateSetter = match2[8] ? date.setUTCFullYear : date.setFullYear;
  const timeSetter = match2[8] ? date.setUTCHours : date.setHours;
  if (match2[9]) {
    tzHour = Number(match2[9] + match2[10]);
    tzMin = Number(match2[9] + match2[11]);
  }
  dateSetter.call(date, Number(match2[1]), Number(match2[2]) - 1, Number(match2[3]));
  const h = Number(match2[4] || 0) - tzHour;
  const m = Number(match2[5] || 0) - tzMin;
  const s = Number(match2[6] || 0);
  const ms = Math.floor(parseFloat("0." + (match2[7] || 0)) * 1e3);
  timeSetter.call(date, h, m, s, ms);
  return date;
}
function isDate(value) {
  return value instanceof Date && !isNaN(value.valueOf());
}
var NUMBER_FORMAT_REGEXP = /^(\d+)?\.((\d+)(-(\d+))?)?$/;
var MAX_DIGITS = 22;
var DECIMAL_SEP = ".";
var ZERO_CHAR = "0";
var PATTERN_SEP = ";";
var GROUP_SEP = ",";
var DIGIT_CHAR = "#";
var CURRENCY_CHAR = "\xA4";
var PERCENT_CHAR = "%";
function formatNumberToLocaleString(value, pattern, locale, groupSymbol, decimalSymbol, digitsInfo, isPercent = false) {
  let formattedText = "";
  let isZero = false;
  if (!isFinite(value)) {
    formattedText = getLocaleNumberSymbol(locale, NumberSymbol.Infinity);
  } else {
    let parsedNumber = parseNumber(value);
    if (isPercent) {
      parsedNumber = toPercent(parsedNumber);
    }
    let minInt = pattern.minInt;
    let minFraction = pattern.minFrac;
    let maxFraction = pattern.maxFrac;
    if (digitsInfo) {
      const parts = digitsInfo.match(NUMBER_FORMAT_REGEXP);
      if (parts === null) {
        throw new RuntimeError(2306, ngDevMode && `${digitsInfo} is not a valid digit info`);
      }
      const minIntPart = parts[1];
      const minFractionPart = parts[3];
      const maxFractionPart = parts[5];
      if (minIntPart != null) {
        minInt = parseIntAutoRadix(minIntPart);
      }
      if (minFractionPart != null) {
        minFraction = parseIntAutoRadix(minFractionPart);
      }
      if (maxFractionPart != null) {
        maxFraction = parseIntAutoRadix(maxFractionPart);
      } else if (minFractionPart != null && minFraction > maxFraction) {
        maxFraction = minFraction;
      }
    }
    roundNumber(parsedNumber, minFraction, maxFraction);
    let digits = parsedNumber.digits;
    let integerLen = parsedNumber.integerLen;
    const exponent = parsedNumber.exponent;
    let decimals = [];
    isZero = digits.every((d) => !d);
    for (; integerLen < minInt; integerLen++) {
      digits.unshift(0);
    }
    for (; integerLen < 0; integerLen++) {
      digits.unshift(0);
    }
    if (integerLen > 0) {
      decimals = digits.splice(integerLen, digits.length);
    } else {
      decimals = digits;
      digits = [0];
    }
    const groups = [];
    if (digits.length >= pattern.lgSize) {
      groups.unshift(digits.splice(-pattern.lgSize, digits.length).join(""));
    }
    while (digits.length > pattern.gSize) {
      groups.unshift(digits.splice(-pattern.gSize, digits.length).join(""));
    }
    if (digits.length) {
      groups.unshift(digits.join(""));
    }
    formattedText = groups.join(getLocaleNumberSymbol(locale, groupSymbol));
    if (decimals.length) {
      formattedText += getLocaleNumberSymbol(locale, decimalSymbol) + decimals.join("");
    }
    if (exponent) {
      formattedText += getLocaleNumberSymbol(locale, NumberSymbol.Exponential) + "+" + exponent;
    }
  }
  if (value < 0 && !isZero) {
    formattedText = pattern.negPre + formattedText + pattern.negSuf;
  } else {
    formattedText = pattern.posPre + formattedText + pattern.posSuf;
  }
  return formattedText;
}
function formatCurrency(value, locale, currency, currencyCode, digitsInfo) {
  const format = getLocaleNumberFormat(locale, NumberFormatStyle.Currency);
  const pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));
  pattern.minFrac = getNumberOfCurrencyDigits(currencyCode);
  pattern.maxFrac = pattern.minFrac;
  const res = formatNumberToLocaleString(value, pattern, locale, NumberSymbol.CurrencyGroup, NumberSymbol.CurrencyDecimal, digitsInfo);
  return res.replace(CURRENCY_CHAR, currency).replace(CURRENCY_CHAR, "").trim();
}
function formatPercent(value, locale, digitsInfo) {
  const format = getLocaleNumberFormat(locale, NumberFormatStyle.Percent);
  const pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));
  const res = formatNumberToLocaleString(value, pattern, locale, NumberSymbol.Group, NumberSymbol.Decimal, digitsInfo, true);
  return res.replace(new RegExp(PERCENT_CHAR, "g"), getLocaleNumberSymbol(locale, NumberSymbol.PercentSign));
}
function formatNumber(value, locale, digitsInfo) {
  const format = getLocaleNumberFormat(locale, NumberFormatStyle.Decimal);
  const pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));
  return formatNumberToLocaleString(value, pattern, locale, NumberSymbol.Group, NumberSymbol.Decimal, digitsInfo);
}
function parseNumberFormat(format, minusSign = "-") {
  const p = {
    minInt: 1,
    minFrac: 0,
    maxFrac: 0,
    posPre: "",
    posSuf: "",
    negPre: "",
    negSuf: "",
    gSize: 0,
    lgSize: 0
  };
  const patternParts = format.split(PATTERN_SEP);
  const positive = patternParts[0];
  const negative = patternParts[1];
  const positiveParts = positive.indexOf(DECIMAL_SEP) !== -1 ? positive.split(DECIMAL_SEP) : [positive.substring(0, positive.lastIndexOf(ZERO_CHAR) + 1), positive.substring(positive.lastIndexOf(ZERO_CHAR) + 1)], integer = positiveParts[0], fraction = positiveParts[1] || "";
  p.posPre = integer.substring(0, integer.indexOf(DIGIT_CHAR));
  for (let i = 0; i < fraction.length; i++) {
    const ch = fraction.charAt(i);
    if (ch === ZERO_CHAR) {
      p.minFrac = p.maxFrac = i + 1;
    } else if (ch === DIGIT_CHAR) {
      p.maxFrac = i + 1;
    } else {
      p.posSuf += ch;
    }
  }
  const groups = integer.split(GROUP_SEP);
  p.gSize = groups[1] ? groups[1].length : 0;
  p.lgSize = groups[2] || groups[1] ? (groups[2] || groups[1]).length : 0;
  if (negative) {
    const trunkLen = positive.length - p.posPre.length - p.posSuf.length, pos = negative.indexOf(DIGIT_CHAR);
    p.negPre = negative.substring(0, pos).replace(/'/g, "");
    p.negSuf = negative.slice(pos + trunkLen).replace(/'/g, "");
  } else {
    p.negPre = minusSign + p.posPre;
    p.negSuf = p.posSuf;
  }
  return p;
}
function toPercent(parsedNumber) {
  if (parsedNumber.digits[0] === 0) {
    return parsedNumber;
  }
  const fractionLen = parsedNumber.digits.length - parsedNumber.integerLen;
  if (parsedNumber.exponent) {
    parsedNumber.exponent += 2;
  } else {
    if (fractionLen === 0) {
      parsedNumber.digits.push(0, 0);
    } else if (fractionLen === 1) {
      parsedNumber.digits.push(0);
    }
    parsedNumber.integerLen += 2;
  }
  return parsedNumber;
}
function parseNumber(num) {
  let numStr = Math.abs(num) + "";
  let exponent = 0, digits, integerLen;
  let i, j, zeros;
  if ((integerLen = numStr.indexOf(DECIMAL_SEP)) > -1) {
    numStr = numStr.replace(DECIMAL_SEP, "");
  }
  if ((i = numStr.search(/e/i)) > 0) {
    if (integerLen < 0) integerLen = i;
    integerLen += +numStr.slice(i + 1);
    numStr = numStr.substring(0, i);
  } else if (integerLen < 0) {
    integerLen = numStr.length;
  }
  for (i = 0; numStr.charAt(i) === ZERO_CHAR; i++) {
  }
  if (i === (zeros = numStr.length)) {
    digits = [0];
    integerLen = 1;
  } else {
    zeros--;
    while (numStr.charAt(zeros) === ZERO_CHAR) zeros--;
    integerLen -= i;
    digits = [];
    for (j = 0; i <= zeros; i++, j++) {
      digits[j] = Number(numStr.charAt(i));
    }
  }
  if (integerLen > MAX_DIGITS) {
    digits = digits.splice(0, MAX_DIGITS - 1);
    exponent = integerLen - 1;
    integerLen = 1;
  }
  return {
    digits,
    exponent,
    integerLen
  };
}
function roundNumber(parsedNumber, minFrac, maxFrac) {
  if (minFrac > maxFrac) {
    throw new RuntimeError(2307, ngDevMode && `The minimum number of digits after fraction (${minFrac}) is higher than the maximum (${maxFrac}).`);
  }
  let digits = parsedNumber.digits;
  let fractionLen = digits.length - parsedNumber.integerLen;
  const fractionSize = Math.min(Math.max(minFrac, fractionLen), maxFrac);
  let roundAt = fractionSize + parsedNumber.integerLen;
  let digit = digits[roundAt];
  if (roundAt > 0) {
    digits.splice(Math.max(parsedNumber.integerLen, roundAt));
    for (let j = roundAt; j < digits.length; j++) {
      digits[j] = 0;
    }
  } else {
    fractionLen = Math.max(0, fractionLen);
    parsedNumber.integerLen = 1;
    digits.length = Math.max(1, roundAt = fractionSize + 1);
    digits[0] = 0;
    for (let i = 1; i < roundAt; i++) digits[i] = 0;
  }
  if (digit >= 5) {
    if (roundAt - 1 < 0) {
      for (let k = 0; k > roundAt; k--) {
        digits.unshift(0);
        parsedNumber.integerLen++;
      }
      digits.unshift(1);
      parsedNumber.integerLen++;
    } else {
      digits[roundAt - 1]++;
    }
  }
  for (; fractionLen < Math.max(0, fractionSize); fractionLen++) digits.push(0);
  let dropTrailingZeros = fractionSize !== 0;
  const minLen = minFrac + parsedNumber.integerLen;
  const carry = digits.reduceRight(function(carry2, d, i, digits2) {
    d = d + carry2;
    digits2[i] = d < 10 ? d : d - 10;
    if (dropTrailingZeros) {
      if (digits2[i] === 0 && i >= minLen) {
        digits2.pop();
      } else {
        dropTrailingZeros = false;
      }
    }
    return d >= 10 ? 1 : 0;
  }, 0);
  if (carry) {
    digits.unshift(carry);
    parsedNumber.integerLen++;
  }
}
function parseIntAutoRadix(text) {
  const result = parseInt(text);
  if (isNaN(result)) {
    throw new RuntimeError(2305, ngDevMode && "Invalid integer literal when parsing " + text);
  }
  return result;
}
var NgLocalization = class _NgLocalization {
  static \u0275fac = function NgLocalization_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _NgLocalization)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _NgLocalization,
    factory: function NgLocalization_Factory(__ngFactoryType__) {
      let __ngConditionalFactory__ = null;
      if (__ngFactoryType__) {
        __ngConditionalFactory__ = new __ngFactoryType__();
      } else {
        __ngConditionalFactory__ = ((locale) => new NgLocaleLocalization(locale))(\u0275\u0275inject(LOCALE_ID));
      }
      return __ngConditionalFactory__;
    },
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgLocalization, [{
    type: Injectable,
    args: [{
      providedIn: "root",
      useFactory: (locale) => new NgLocaleLocalization(locale),
      deps: [LOCALE_ID]
    }]
  }], null, null);
})();
function getPluralCategory(value, cases, ngLocalization, locale) {
  let key = `=${value}`;
  if (cases.indexOf(key) > -1) {
    return key;
  }
  key = ngLocalization.getPluralCategory(value, locale);
  if (cases.indexOf(key) > -1) {
    return key;
  }
  if (cases.indexOf("other") > -1) {
    return "other";
  }
  throw new RuntimeError(2308, ngDevMode && `No plural message found for value "${value}"`);
}
var NgLocaleLocalization = class _NgLocaleLocalization extends NgLocalization {
  locale;
  constructor(locale) {
    super();
    this.locale = locale;
  }
  getPluralCategory(value, locale) {
    const plural2 = getLocalePluralCase2(locale || this.locale)(value);
    switch (plural2) {
      case Plural.Zero:
        return "zero";
      case Plural.One:
        return "one";
      case Plural.Two:
        return "two";
      case Plural.Few:
        return "few";
      case Plural.Many:
        return "many";
      default:
        return "other";
    }
  }
  static \u0275fac = function NgLocaleLocalization_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _NgLocaleLocalization)(\u0275\u0275inject(LOCALE_ID));
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _NgLocaleLocalization,
    factory: _NgLocaleLocalization.\u0275fac
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgLocaleLocalization, [{
    type: Injectable
  }], () => [{
    type: void 0,
    decorators: [{
      type: Inject,
      args: [LOCALE_ID]
    }]
  }], null);
})();
var WS_REGEXP = /\s+/;
var EMPTY_ARRAY2 = [];
var NgClass = class _NgClass {
  _ngEl;
  _renderer;
  initialClasses = EMPTY_ARRAY2;
  rawClass;
  stateMap = /* @__PURE__ */ new Map();
  constructor(_ngEl, _renderer) {
    this._ngEl = _ngEl;
    this._renderer = _renderer;
  }
  set klass(value) {
    this.initialClasses = value != null ? value.trim().split(WS_REGEXP) : EMPTY_ARRAY2;
  }
  set ngClass(value) {
    this.rawClass = typeof value === "string" ? value.trim().split(WS_REGEXP) : value;
  }
  /*
  The NgClass directive uses the custom change detection algorithm for its inputs. The custom
  algorithm is necessary since inputs are represented as complex object or arrays that need to be
  deeply-compared.
     This algorithm is perf-sensitive since NgClass is used very frequently and its poor performance
  might negatively impact runtime performance of the entire change detection cycle. The design of
  this algorithm is making sure that:
  - there is no unnecessary DOM manipulation (CSS classes are added / removed from the DOM only when
  needed), even if references to bound objects change;
  - there is no memory allocation if nothing changes (even relatively modest memory allocation
  during the change detection cycle can result in GC pauses for some of the CD cycles).
     The algorithm works by iterating over the set of bound classes, staring with [class] binding and
  then going over [ngClass] binding. For each CSS class name:
  - check if it was seen before (this information is tracked in the state map) and if its value
  changed;
  - mark it as "touched" - names that are not marked are not present in the latest set of binding
  and we can remove such class name from the internal data structures;
     After iteration over all the CSS class names we've got data structure with all the information
  necessary to synchronize changes to the DOM - it is enough to iterate over the state map, flush
  changes to the DOM and reset internal data structures so those are ready for the next change
  detection cycle.
   */
  ngDoCheck() {
    for (const klass of this.initialClasses) {
      this._updateState(klass, true);
    }
    const rawClass = this.rawClass;
    if (Array.isArray(rawClass) || rawClass instanceof Set) {
      for (const klass of rawClass) {
        this._updateState(klass, true);
      }
    } else if (rawClass != null) {
      for (const klass of Object.keys(rawClass)) {
        this._updateState(klass, Boolean(rawClass[klass]));
      }
    }
    this._applyStateDiff();
  }
  _updateState(klass, nextEnabled) {
    const state = this.stateMap.get(klass);
    if (state !== void 0) {
      if (state.enabled !== nextEnabled) {
        state.changed = true;
        state.enabled = nextEnabled;
      }
      state.touched = true;
    } else {
      this.stateMap.set(klass, {
        enabled: nextEnabled,
        changed: true,
        touched: true
      });
    }
  }
  _applyStateDiff() {
    for (const stateEntry of this.stateMap) {
      const klass = stateEntry[0];
      const state = stateEntry[1];
      if (state.changed) {
        this._toggleClass(klass, state.enabled);
        state.changed = false;
      } else if (!state.touched) {
        if (state.enabled) {
          this._toggleClass(klass, false);
        }
        this.stateMap.delete(klass);
      }
      state.touched = false;
    }
  }
  _toggleClass(klass, enabled) {
    if (ngDevMode) {
      if (typeof klass !== "string") {
        throw new Error(`NgClass can only toggle CSS classes expressed as strings, got ${stringify(klass)}`);
      }
    }
    klass = klass.trim();
    if (klass.length > 0) {
      klass.split(WS_REGEXP).forEach((klass2) => {
        if (enabled) {
          this._renderer.addClass(this._ngEl.nativeElement, klass2);
        } else {
          this._renderer.removeClass(this._ngEl.nativeElement, klass2);
        }
      });
    }
  }
  static \u0275fac = function NgClass_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _NgClass)(\u0275\u0275directiveInject(ElementRef), \u0275\u0275directiveInject(Renderer2));
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _NgClass,
    selectors: [["", "ngClass", ""]],
    inputs: {
      klass: [0, "class", "klass"],
      ngClass: "ngClass"
    }
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgClass, [{
    type: Directive,
    args: [{
      selector: "[ngClass]"
    }]
  }], () => [{
    type: ElementRef
  }, {
    type: Renderer2
  }], {
    klass: [{
      type: Input,
      args: ["class"]
    }],
    ngClass: [{
      type: Input,
      args: ["ngClass"]
    }]
  });
})();
var NgComponentOutlet = class _NgComponentOutlet {
  _viewContainerRef;
  // TODO(crisbeto): this should be `Type<T>`, but doing so broke a few
  // targets in a TGP so we need to do it in a major version.
  /** Component that should be rendered in the outlet. */
  ngComponentOutlet = null;
  ngComponentOutletInputs;
  ngComponentOutletInjector;
  ngComponentOutletEnvironmentInjector;
  ngComponentOutletContent;
  ngComponentOutletNgModule;
  /**
   * @deprecated This input is deprecated, use `ngComponentOutletNgModule` instead.
   */
  ngComponentOutletNgModuleFactory;
  _componentRef;
  _moduleRef;
  /**
   * A helper data structure that allows us to track inputs that were part of the
   * ngComponentOutletInputs expression. Tracking inputs is necessary for proper removal of ones
   * that are no longer referenced.
   */
  _inputsUsed = /* @__PURE__ */ new Map();
  /**
   * Gets the instance of the currently-rendered component.
   * Will be null if no component has been rendered.
   */
  get componentInstance() {
    return this._componentRef?.instance ?? null;
  }
  constructor(_viewContainerRef) {
    this._viewContainerRef = _viewContainerRef;
  }
  _needToReCreateNgModuleInstance(changes) {
    return changes["ngComponentOutletNgModule"] !== void 0 || changes["ngComponentOutletNgModuleFactory"] !== void 0;
  }
  _needToReCreateComponentInstance(changes) {
    return changes["ngComponentOutlet"] !== void 0 || changes["ngComponentOutletContent"] !== void 0 || changes["ngComponentOutletInjector"] !== void 0 || changes["ngComponentOutletEnvironmentInjector"] !== void 0 || this._needToReCreateNgModuleInstance(changes);
  }
  /** @docs-private */
  ngOnChanges(changes) {
    if (this._needToReCreateComponentInstance(changes)) {
      this._viewContainerRef.clear();
      this._inputsUsed.clear();
      this._componentRef = void 0;
      if (this.ngComponentOutlet) {
        const injector = this.ngComponentOutletInjector || this._viewContainerRef.parentInjector;
        if (this._needToReCreateNgModuleInstance(changes)) {
          this._moduleRef?.destroy();
          if (this.ngComponentOutletNgModule) {
            this._moduleRef = createNgModule(this.ngComponentOutletNgModule, getParentInjector(injector));
          } else if (this.ngComponentOutletNgModuleFactory) {
            this._moduleRef = this.ngComponentOutletNgModuleFactory.create(getParentInjector(injector));
          } else {
            this._moduleRef = void 0;
          }
        }
        this._componentRef = this._viewContainerRef.createComponent(this.ngComponentOutlet, {
          injector,
          ngModuleRef: this._moduleRef,
          projectableNodes: this.ngComponentOutletContent,
          environmentInjector: this.ngComponentOutletEnvironmentInjector
        });
      }
    }
  }
  /** @docs-private */
  ngDoCheck() {
    if (this._componentRef) {
      if (this.ngComponentOutletInputs) {
        for (const inputName of Object.keys(this.ngComponentOutletInputs)) {
          this._inputsUsed.set(inputName, true);
        }
      }
      this._applyInputStateDiff(this._componentRef);
    }
  }
  /** @docs-private */
  ngOnDestroy() {
    this._moduleRef?.destroy();
  }
  _applyInputStateDiff(componentRef) {
    for (const [inputName, touched] of this._inputsUsed) {
      if (!touched) {
        componentRef.setInput(inputName, void 0);
        this._inputsUsed.delete(inputName);
      } else {
        componentRef.setInput(inputName, this.ngComponentOutletInputs[inputName]);
        this._inputsUsed.set(inputName, false);
      }
    }
  }
  static \u0275fac = function NgComponentOutlet_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _NgComponentOutlet)(\u0275\u0275directiveInject(ViewContainerRef));
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _NgComponentOutlet,
    selectors: [["", "ngComponentOutlet", ""]],
    inputs: {
      ngComponentOutlet: "ngComponentOutlet",
      ngComponentOutletInputs: "ngComponentOutletInputs",
      ngComponentOutletInjector: "ngComponentOutletInjector",
      ngComponentOutletEnvironmentInjector: "ngComponentOutletEnvironmentInjector",
      ngComponentOutletContent: "ngComponentOutletContent",
      ngComponentOutletNgModule: "ngComponentOutletNgModule",
      ngComponentOutletNgModuleFactory: "ngComponentOutletNgModuleFactory"
    },
    exportAs: ["ngComponentOutlet"],
    features: [\u0275\u0275NgOnChangesFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgComponentOutlet, [{
    type: Directive,
    args: [{
      selector: "[ngComponentOutlet]",
      exportAs: "ngComponentOutlet"
    }]
  }], () => [{
    type: ViewContainerRef
  }], {
    ngComponentOutlet: [{
      type: Input
    }],
    ngComponentOutletInputs: [{
      type: Input
    }],
    ngComponentOutletInjector: [{
      type: Input
    }],
    ngComponentOutletEnvironmentInjector: [{
      type: Input
    }],
    ngComponentOutletContent: [{
      type: Input
    }],
    ngComponentOutletNgModule: [{
      type: Input
    }],
    ngComponentOutletNgModuleFactory: [{
      type: Input
    }]
  });
})();
function getParentInjector(injector) {
  const parentNgModule = injector.get(NgModuleRef$1);
  return parentNgModule.injector;
}
var NgForOfContext = class {
  $implicit;
  ngForOf;
  index;
  count;
  constructor($implicit, ngForOf, index, count) {
    this.$implicit = $implicit;
    this.ngForOf = ngForOf;
    this.index = index;
    this.count = count;
  }
  // Indicates whether this is the first item in the collection.
  get first() {
    return this.index === 0;
  }
  // Indicates whether this is the last item in the collection.
  get last() {
    return this.index === this.count - 1;
  }
  // Indicates whether an index of this item in the collection is even.
  get even() {
    return this.index % 2 === 0;
  }
  // Indicates whether an index of this item in the collection is odd.
  get odd() {
    return !this.even;
  }
};
var NgForOf = class _NgForOf {
  _viewContainer;
  _template;
  _differs;
  /**
   * The value of the iterable expression, which can be used as a
   * [template input variable](guide/directives/structural-directives#shorthand).
   * @deprecated The `ngFor` directive is deprecated. Use the `@for` block instead.
   */
  set ngForOf(ngForOf) {
    this._ngForOf = ngForOf;
    this._ngForOfDirty = true;
  }
  /**
   * Specifies a custom `TrackByFunction` to compute the identity of items in an iterable.
   *
   * If a custom `TrackByFunction` is not provided, `NgForOf` will use the item's [object
   * identity](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is)
   * as the key.
   *
   * `NgForOf` uses the computed key to associate items in an iterable with DOM elements
   * it produces for these items.
   *
   * A custom `TrackByFunction` is useful to provide good user experience in cases when items in an
   * iterable rendered using `NgForOf` have a natural identifier (for example, custom ID or a
   * primary key), and this iterable could be updated with new object instances that still
   * represent the same underlying entity (for example, when data is re-fetched from the server,
   * and the iterable is recreated and re-rendered, but most of the data is still the same).
   *
   * @see {@link TrackByFunction}
   * @deprecated The `ngFor` directive is deprecated. Use the `@for` block instead.
   */
  set ngForTrackBy(fn) {
    if ((typeof ngDevMode === "undefined" || ngDevMode) && fn != null && typeof fn !== "function") {
      console.warn(`trackBy must be a function, but received ${JSON.stringify(fn)}. See https://angular.io/api/common/NgForOf#change-propagation for more information.`);
    }
    this._trackByFn = fn;
  }
  get ngForTrackBy() {
    return this._trackByFn;
  }
  _ngForOf = null;
  _ngForOfDirty = true;
  _differ = null;
  // waiting for microsoft/typescript#43662 to allow the return type `TrackByFunction|undefined` for
  // the getter
  _trackByFn;
  constructor(_viewContainer, _template, _differs) {
    this._viewContainer = _viewContainer;
    this._template = _template;
    this._differs = _differs;
  }
  /**
   * A reference to the template that is stamped out for each item in the iterable.
   * @see [template reference variable](guide/templates/variables#template-reference-variables)
   * @deprecated The `ngFor` directive is deprecated. Use the `@for` block instead.
   */
  set ngForTemplate(value) {
    if (value) {
      this._template = value;
    }
  }
  /**
   * Applies the changes when needed.
   * @docs-private
   */
  ngDoCheck() {
    if (this._ngForOfDirty) {
      this._ngForOfDirty = false;
      const value = this._ngForOf;
      if (!this._differ && value) {
        if (typeof ngDevMode === "undefined" || ngDevMode) {
          try {
            this._differ = this._differs.find(value).create(this.ngForTrackBy);
          } catch {
            let errorMessage = `Cannot find a differ supporting object '${value}' of type '${getTypeName(value)}'. NgFor only supports binding to Iterables, such as Arrays.`;
            if (typeof value === "object") {
              errorMessage += " Did you mean to use the keyvalue pipe?";
            }
            throw new RuntimeError(-2200, errorMessage);
          }
        } else {
          this._differ = this._differs.find(value).create(this.ngForTrackBy);
        }
      }
    }
    if (this._differ) {
      const changes = this._differ.diff(this._ngForOf);
      if (changes) this._applyChanges(changes);
    }
  }
  _applyChanges(changes) {
    const viewContainer = this._viewContainer;
    changes.forEachOperation((item, adjustedPreviousIndex, currentIndex) => {
      if (item.previousIndex == null) {
        viewContainer.createEmbeddedView(this._template, new NgForOfContext(item.item, this._ngForOf, -1, -1), currentIndex === null ? void 0 : currentIndex);
      } else if (currentIndex == null) {
        viewContainer.remove(adjustedPreviousIndex === null ? void 0 : adjustedPreviousIndex);
      } else if (adjustedPreviousIndex !== null) {
        const view = viewContainer.get(adjustedPreviousIndex);
        viewContainer.move(view, currentIndex);
        applyViewChange(view, item);
      }
    });
    for (let i = 0, ilen = viewContainer.length; i < ilen; i++) {
      const viewRef = viewContainer.get(i);
      const context2 = viewRef.context;
      context2.index = i;
      context2.count = ilen;
      context2.ngForOf = this._ngForOf;
    }
    changes.forEachIdentityChange((record) => {
      const viewRef = viewContainer.get(record.currentIndex);
      applyViewChange(viewRef, record);
    });
  }
  /**
   * Asserts the correct type of the context for the template that `NgForOf` will render.
   *
   * The presence of this method is a signal to the Ivy template type-check compiler that the
   * `NgForOf` structural directive renders its template with a specific context type.
   */
  static ngTemplateContextGuard(dir, ctx) {
    return true;
  }
  static \u0275fac = function NgForOf_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _NgForOf)(\u0275\u0275directiveInject(ViewContainerRef), \u0275\u0275directiveInject(TemplateRef), \u0275\u0275directiveInject(IterableDiffers));
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _NgForOf,
    selectors: [["", "ngFor", "", "ngForOf", ""]],
    inputs: {
      ngForOf: "ngForOf",
      ngForTrackBy: "ngForTrackBy",
      ngForTemplate: "ngForTemplate"
    }
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgForOf, [{
    type: Directive,
    args: [{
      selector: "[ngFor][ngForOf]"
    }]
  }], () => [{
    type: ViewContainerRef
  }, {
    type: TemplateRef
  }, {
    type: IterableDiffers
  }], {
    ngForOf: [{
      type: Input
    }],
    ngForTrackBy: [{
      type: Input
    }],
    ngForTemplate: [{
      type: Input
    }]
  });
})();
function applyViewChange(view, record) {
  view.context.$implicit = record.item;
}
function getTypeName(type) {
  return type["name"] || typeof type;
}
var NgIf = class _NgIf {
  _viewContainer;
  _context = new NgIfContext();
  _thenTemplateRef = null;
  _elseTemplateRef = null;
  _thenViewRef = null;
  _elseViewRef = null;
  constructor(_viewContainer, templateRef) {
    this._viewContainer = _viewContainer;
    this._thenTemplateRef = templateRef;
  }
  /**
   * The Boolean expression to evaluate as the condition for showing a template.
   * @deprecated Use the `@if` block instead. Intent to remove in v22
   */
  set ngIf(condition) {
    this._context.$implicit = this._context.ngIf = condition;
    this._updateView();
  }
  /**
   * A template to show if the condition expression evaluates to true.
   * @deprecated Use the `@if` block instead. Intent to remove in v22
   */
  set ngIfThen(templateRef) {
    assertTemplate(templateRef, (typeof ngDevMode === "undefined" || ngDevMode) && "ngIfThen");
    this._thenTemplateRef = templateRef;
    this._thenViewRef = null;
    this._updateView();
  }
  /**
   * A template to show if the condition expression evaluates to false.
   * @deprecated Use the `@if` block instead. Intent to remove in v22
   */
  set ngIfElse(templateRef) {
    assertTemplate(templateRef, (typeof ngDevMode === "undefined" || ngDevMode) && "ngIfElse");
    this._elseTemplateRef = templateRef;
    this._elseViewRef = null;
    this._updateView();
  }
  _updateView() {
    if (this._context.$implicit) {
      if (!this._thenViewRef) {
        this._viewContainer.clear();
        this._elseViewRef = null;
        if (this._thenTemplateRef) {
          this._thenViewRef = this._viewContainer.createEmbeddedView(this._thenTemplateRef, this._context);
        }
      }
    } else {
      if (!this._elseViewRef) {
        this._viewContainer.clear();
        this._thenViewRef = null;
        if (this._elseTemplateRef) {
          this._elseViewRef = this._viewContainer.createEmbeddedView(this._elseTemplateRef, this._context);
        }
      }
    }
  }
  /** @internal */
  static ngIfUseIfTypeGuard;
  /**
   * Assert the correct type of the expression bound to the `ngIf` input within the template.
   *
   * The presence of this static field is a signal to the Ivy template type check compiler that
   * when the `NgIf` structural directive renders its template, the type of the expression bound
   * to `ngIf` should be narrowed in some way. For `NgIf`, the binding expression itself is used to
   * narrow its type, which allows the strictNullChecks feature of TypeScript to work with `NgIf`.
   */
  static ngTemplateGuard_ngIf;
  /**
   * Asserts the correct type of the context for the template that `NgIf` will render.
   *
   * The presence of this method is a signal to the Ivy template type-check compiler that the
   * `NgIf` structural directive renders its template with a specific context type.
   */
  static ngTemplateContextGuard(dir, ctx) {
    return true;
  }
  static \u0275fac = function NgIf_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _NgIf)(\u0275\u0275directiveInject(ViewContainerRef), \u0275\u0275directiveInject(TemplateRef));
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _NgIf,
    selectors: [["", "ngIf", ""]],
    inputs: {
      ngIf: "ngIf",
      ngIfThen: "ngIfThen",
      ngIfElse: "ngIfElse"
    }
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgIf, [{
    type: Directive,
    args: [{
      selector: "[ngIf]"
    }]
  }], () => [{
    type: ViewContainerRef
  }, {
    type: TemplateRef
  }], {
    ngIf: [{
      type: Input
    }],
    ngIfThen: [{
      type: Input
    }],
    ngIfElse: [{
      type: Input
    }]
  });
})();
var NgIfContext = class {
  $implicit = null;
  ngIf = null;
};
function assertTemplate(templateRef, property) {
  if (templateRef && !templateRef.createEmbeddedView) {
    throw new RuntimeError(2020, (typeof ngDevMode === "undefined" || ngDevMode) && `${property} must be a TemplateRef, but received '${stringify(templateRef)}'.`);
  }
}
var SwitchView = class {
  _viewContainerRef;
  _templateRef;
  _created = false;
  constructor(_viewContainerRef, _templateRef) {
    this._viewContainerRef = _viewContainerRef;
    this._templateRef = _templateRef;
  }
  create() {
    this._created = true;
    this._viewContainerRef.createEmbeddedView(this._templateRef);
  }
  destroy() {
    this._created = false;
    this._viewContainerRef.clear();
  }
  enforceState(created) {
    if (created && !this._created) {
      this.create();
    } else if (!created && this._created) {
      this.destroy();
    }
  }
};
var NgSwitch = class _NgSwitch {
  _defaultViews = [];
  _defaultUsed = false;
  _caseCount = 0;
  _lastCaseCheckIndex = 0;
  _lastCasesMatched = false;
  _ngSwitch;
  /** @deprecated Use the `@switch` block instead. Intent to remove in v22 */
  set ngSwitch(newValue) {
    this._ngSwitch = newValue;
    if (this._caseCount === 0) {
      this._updateDefaultCases(true);
    }
  }
  /** @internal */
  _addCase() {
    return this._caseCount++;
  }
  /** @internal */
  _addDefault(view) {
    this._defaultViews.push(view);
  }
  /** @internal */
  _matchCase(value) {
    const matched = value === this._ngSwitch;
    this._lastCasesMatched ||= matched;
    this._lastCaseCheckIndex++;
    if (this._lastCaseCheckIndex === this._caseCount) {
      this._updateDefaultCases(!this._lastCasesMatched);
      this._lastCaseCheckIndex = 0;
      this._lastCasesMatched = false;
    }
    return matched;
  }
  _updateDefaultCases(useDefault) {
    if (this._defaultViews.length > 0 && useDefault !== this._defaultUsed) {
      this._defaultUsed = useDefault;
      for (const defaultView of this._defaultViews) {
        defaultView.enforceState(useDefault);
      }
    }
  }
  static \u0275fac = function NgSwitch_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _NgSwitch)();
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _NgSwitch,
    selectors: [["", "ngSwitch", ""]],
    inputs: {
      ngSwitch: "ngSwitch"
    }
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgSwitch, [{
    type: Directive,
    args: [{
      selector: "[ngSwitch]"
    }]
  }], null, {
    ngSwitch: [{
      type: Input
    }]
  });
})();
var NgSwitchCase = class _NgSwitchCase {
  ngSwitch;
  _view;
  /**
   * Stores the HTML template to be selected on match.
   * @deprecated Use the `@case` block within a `@switch` block instead. Intent to remove in v22
   */
  ngSwitchCase;
  constructor(viewContainer, templateRef, ngSwitch) {
    this.ngSwitch = ngSwitch;
    if ((typeof ngDevMode === "undefined" || ngDevMode) && !ngSwitch) {
      throwNgSwitchProviderNotFoundError("ngSwitchCase", "NgSwitchCase");
    }
    ngSwitch._addCase();
    this._view = new SwitchView(viewContainer, templateRef);
  }
  /**
   * Performs case matching. For internal use only.
   * @docs-private
   */
  ngDoCheck() {
    this._view.enforceState(this.ngSwitch._matchCase(this.ngSwitchCase));
  }
  static \u0275fac = function NgSwitchCase_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _NgSwitchCase)(\u0275\u0275directiveInject(ViewContainerRef), \u0275\u0275directiveInject(TemplateRef), \u0275\u0275directiveInject(NgSwitch, 9));
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _NgSwitchCase,
    selectors: [["", "ngSwitchCase", ""]],
    inputs: {
      ngSwitchCase: "ngSwitchCase"
    }
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgSwitchCase, [{
    type: Directive,
    args: [{
      selector: "[ngSwitchCase]"
    }]
  }], () => [{
    type: ViewContainerRef
  }, {
    type: TemplateRef
  }, {
    type: NgSwitch,
    decorators: [{
      type: Optional
    }, {
      type: Host
    }]
  }], {
    ngSwitchCase: [{
      type: Input
    }]
  });
})();
var NgSwitchDefault = class _NgSwitchDefault {
  constructor(viewContainer, templateRef, ngSwitch) {
    if ((typeof ngDevMode === "undefined" || ngDevMode) && !ngSwitch) {
      throwNgSwitchProviderNotFoundError("ngSwitchDefault", "NgSwitchDefault");
    }
    ngSwitch._addDefault(new SwitchView(viewContainer, templateRef));
  }
  static \u0275fac = function NgSwitchDefault_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _NgSwitchDefault)(\u0275\u0275directiveInject(ViewContainerRef), \u0275\u0275directiveInject(TemplateRef), \u0275\u0275directiveInject(NgSwitch, 9));
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _NgSwitchDefault,
    selectors: [["", "ngSwitchDefault", ""]]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgSwitchDefault, [{
    type: Directive,
    args: [{
      selector: "[ngSwitchDefault]"
    }]
  }], () => [{
    type: ViewContainerRef
  }, {
    type: TemplateRef
  }, {
    type: NgSwitch,
    decorators: [{
      type: Optional
    }, {
      type: Host
    }]
  }], null);
})();
function throwNgSwitchProviderNotFoundError(attrName, directiveName) {
  throw new RuntimeError(2e3, `An element with the "${attrName}" attribute (matching the "${directiveName}" directive) must be located inside an element with the "ngSwitch" attribute (matching "NgSwitch" directive)`);
}
var NgPlural = class _NgPlural {
  _localization;
  _activeView;
  _caseViews = {};
  constructor(_localization) {
    this._localization = _localization;
  }
  set ngPlural(value) {
    this._updateView(value);
  }
  addCase(value, switchView) {
    this._caseViews[value] = switchView;
  }
  _updateView(switchValue) {
    this._clearViews();
    const cases = Object.keys(this._caseViews);
    const key = getPluralCategory(switchValue, cases, this._localization);
    this._activateView(this._caseViews[key]);
  }
  _clearViews() {
    if (this._activeView) this._activeView.destroy();
  }
  _activateView(view) {
    if (view) {
      this._activeView = view;
      this._activeView.create();
    }
  }
  static \u0275fac = function NgPlural_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _NgPlural)(\u0275\u0275directiveInject(NgLocalization));
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _NgPlural,
    selectors: [["", "ngPlural", ""]],
    inputs: {
      ngPlural: "ngPlural"
    }
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgPlural, [{
    type: Directive,
    args: [{
      selector: "[ngPlural]"
    }]
  }], () => [{
    type: NgLocalization
  }], {
    ngPlural: [{
      type: Input
    }]
  });
})();
var NgPluralCase = class _NgPluralCase {
  value;
  constructor(value, template, viewContainer, ngPlural) {
    this.value = value;
    const isANumber = !isNaN(Number(value));
    ngPlural.addCase(isANumber ? `=${value}` : value, new SwitchView(viewContainer, template));
  }
  static \u0275fac = function NgPluralCase_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _NgPluralCase)(\u0275\u0275injectAttribute("ngPluralCase"), \u0275\u0275directiveInject(TemplateRef), \u0275\u0275directiveInject(ViewContainerRef), \u0275\u0275directiveInject(NgPlural, 1));
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _NgPluralCase,
    selectors: [["", "ngPluralCase", ""]]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgPluralCase, [{
    type: Directive,
    args: [{
      selector: "[ngPluralCase]"
    }]
  }], () => [{
    type: void 0,
    decorators: [{
      type: Attribute,
      args: ["ngPluralCase"]
    }]
  }, {
    type: TemplateRef
  }, {
    type: ViewContainerRef
  }, {
    type: NgPlural,
    decorators: [{
      type: Host
    }]
  }], null);
})();
var NgStyle = class _NgStyle {
  _ngEl;
  _differs;
  _renderer;
  _ngStyle = null;
  _differ = null;
  constructor(_ngEl, _differs, _renderer) {
    this._ngEl = _ngEl;
    this._differs = _differs;
    this._renderer = _renderer;
  }
  set ngStyle(values) {
    this._ngStyle = values;
    if (!this._differ && values) {
      this._differ = this._differs.find(values).create();
    }
  }
  ngDoCheck() {
    if (this._differ) {
      const changes = this._differ.diff(this._ngStyle);
      if (changes) {
        this._applyChanges(changes);
      }
    }
  }
  _setStyle(nameAndUnit, value) {
    const [name2, unit] = nameAndUnit.split(".");
    const flags = name2.indexOf("-") === -1 ? void 0 : RendererStyleFlags2.DashCase;
    if (value != null) {
      this._renderer.setStyle(this._ngEl.nativeElement, name2, unit ? `${value}${unit}` : value, flags);
    } else {
      this._renderer.removeStyle(this._ngEl.nativeElement, name2, flags);
    }
  }
  _applyChanges(changes) {
    changes.forEachRemovedItem((record) => this._setStyle(record.key, null));
    changes.forEachAddedItem((record) => this._setStyle(record.key, record.currentValue));
    changes.forEachChangedItem((record) => this._setStyle(record.key, record.currentValue));
  }
  static \u0275fac = function NgStyle_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _NgStyle)(\u0275\u0275directiveInject(ElementRef), \u0275\u0275directiveInject(KeyValueDiffers), \u0275\u0275directiveInject(Renderer2));
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _NgStyle,
    selectors: [["", "ngStyle", ""]],
    inputs: {
      ngStyle: "ngStyle"
    }
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgStyle, [{
    type: Directive,
    args: [{
      selector: "[ngStyle]"
    }]
  }], () => [{
    type: ElementRef
  }, {
    type: KeyValueDiffers
  }, {
    type: Renderer2
  }], {
    ngStyle: [{
      type: Input,
      args: ["ngStyle"]
    }]
  });
})();
var NgTemplateOutlet = class _NgTemplateOutlet {
  _viewContainerRef;
  _viewRef = null;
  /**
   * A context object to attach to the {@link EmbeddedViewRef}. This should be an
   * object, the object's keys will be available for binding by the local template `let`
   * declarations.
   * Using the key `$implicit` in the context object will set its value as default.
   */
  ngTemplateOutletContext = null;
  /**
   * A string defining the template reference and optionally the context object for the template.
   */
  ngTemplateOutlet = null;
  /** Injector to be used within the embedded view. */
  ngTemplateOutletInjector = null;
  constructor(_viewContainerRef) {
    this._viewContainerRef = _viewContainerRef;
  }
  ngOnChanges(changes) {
    if (this._shouldRecreateView(changes)) {
      const viewContainerRef = this._viewContainerRef;
      if (this._viewRef) {
        viewContainerRef.remove(viewContainerRef.indexOf(this._viewRef));
      }
      if (!this.ngTemplateOutlet) {
        this._viewRef = null;
        return;
      }
      const viewContext = this._createContextForwardProxy();
      this._viewRef = viewContainerRef.createEmbeddedView(this.ngTemplateOutlet, viewContext, {
        injector: this.ngTemplateOutletInjector ?? void 0
      });
    }
  }
  /**
   * We need to re-create existing embedded view if either is true:
   * - the outlet changed.
   * - the injector changed.
   */
  _shouldRecreateView(changes) {
    return !!changes["ngTemplateOutlet"] || !!changes["ngTemplateOutletInjector"];
  }
  /**
   * For a given outlet instance, we create a proxy object that delegates
   * to the user-specified context. This allows changing, or swapping out
   * the context object completely without having to destroy/re-create the view.
   */
  _createContextForwardProxy() {
    return new Proxy({}, {
      set: (_target, prop, newValue) => {
        if (!this.ngTemplateOutletContext) {
          return false;
        }
        return Reflect.set(this.ngTemplateOutletContext, prop, newValue);
      },
      get: (_target, prop, receiver) => {
        if (!this.ngTemplateOutletContext) {
          return void 0;
        }
        return Reflect.get(this.ngTemplateOutletContext, prop, receiver);
      }
    });
  }
  static \u0275fac = function NgTemplateOutlet_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _NgTemplateOutlet)(\u0275\u0275directiveInject(ViewContainerRef));
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _NgTemplateOutlet,
    selectors: [["", "ngTemplateOutlet", ""]],
    inputs: {
      ngTemplateOutletContext: "ngTemplateOutletContext",
      ngTemplateOutlet: "ngTemplateOutlet",
      ngTemplateOutletInjector: "ngTemplateOutletInjector"
    },
    features: [\u0275\u0275NgOnChangesFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgTemplateOutlet, [{
    type: Directive,
    args: [{
      selector: "[ngTemplateOutlet]"
    }]
  }], () => [{
    type: ViewContainerRef
  }], {
    ngTemplateOutletContext: [{
      type: Input
    }],
    ngTemplateOutlet: [{
      type: Input
    }],
    ngTemplateOutletInjector: [{
      type: Input
    }]
  });
})();
var COMMON_DIRECTIVES = [NgClass, NgComponentOutlet, NgForOf, NgIf, NgTemplateOutlet, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, NgPlural, NgPluralCase];
function invalidPipeArgumentError(type, value) {
  return new RuntimeError(2100, ngDevMode && `InvalidPipeArgument: '${value}' for pipe '${stringify(type)}'`);
}
var SubscribableStrategy = class {
  createSubscription(async2, updateLatestValue, onError) {
    return untracked2(() => async2.subscribe({
      next: updateLatestValue,
      error: onError
    }));
  }
  dispose(subscription) {
    untracked2(() => subscription.unsubscribe());
  }
};
var PromiseStrategy = class {
  createSubscription(async2, updateLatestValue, onError) {
    async2.then(
      // Using optional chaining because we may have set it to `null`; since the promise
      // is async, the view might be destroyed by the time the promise resolves.
      (v) => updateLatestValue?.(v),
      (e) => onError?.(e)
    );
    return {
      unsubscribe: () => {
        updateLatestValue = null;
        onError = null;
      }
    };
  }
  dispose(subscription) {
    subscription.unsubscribe();
  }
};
var _promiseStrategy = new PromiseStrategy();
var _subscribableStrategy = new SubscribableStrategy();
var AsyncPipe = class _AsyncPipe {
  _ref;
  _latestValue = null;
  markForCheckOnValueUpdate = true;
  _subscription = null;
  _obj = null;
  _strategy = null;
  applicationErrorHandler = inject2(INTERNAL_APPLICATION_ERROR_HANDLER);
  constructor(ref) {
    this._ref = ref;
  }
  ngOnDestroy() {
    if (this._subscription) {
      this._dispose();
    }
    this._ref = null;
  }
  transform(obj) {
    if (!this._obj) {
      if (obj) {
        try {
          this.markForCheckOnValueUpdate = false;
          this._subscribe(obj);
        } finally {
          this.markForCheckOnValueUpdate = true;
        }
      }
      return this._latestValue;
    }
    if (obj !== this._obj) {
      this._dispose();
      return this.transform(obj);
    }
    return this._latestValue;
  }
  _subscribe(obj) {
    this._obj = obj;
    this._strategy = this._selectStrategy(obj);
    this._subscription = this._strategy.createSubscription(obj, (value) => this._updateLatestValue(obj, value), (e) => this.applicationErrorHandler(e));
  }
  _selectStrategy(obj) {
    if (isPromise2(obj)) {
      return _promiseStrategy;
    }
    if (isSubscribable(obj)) {
      return _subscribableStrategy;
    }
    throw invalidPipeArgumentError(_AsyncPipe, obj);
  }
  _dispose() {
    this._strategy.dispose(this._subscription);
    this._latestValue = null;
    this._subscription = null;
    this._obj = null;
  }
  _updateLatestValue(async2, value) {
    if (async2 === this._obj) {
      this._latestValue = value;
      if (this.markForCheckOnValueUpdate) {
        this._ref?.markForCheck();
      }
    }
  }
  static \u0275fac = function AsyncPipe_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _AsyncPipe)(\u0275\u0275directiveInject(ChangeDetectorRef, 16));
  };
  static \u0275pipe = /* @__PURE__ */ \u0275\u0275definePipe({
    name: "async",
    type: _AsyncPipe,
    pure: false
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(AsyncPipe, [{
    type: Pipe,
    args: [{
      name: "async",
      pure: false
    }]
  }], () => [{
    type: ChangeDetectorRef
  }], null);
})();
var LowerCasePipe = class _LowerCasePipe {
  transform(value) {
    if (value == null) return null;
    if (typeof value !== "string") {
      throw invalidPipeArgumentError(_LowerCasePipe, value);
    }
    return value.toLowerCase();
  }
  static \u0275fac = function LowerCasePipe_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _LowerCasePipe)();
  };
  static \u0275pipe = /* @__PURE__ */ \u0275\u0275definePipe({
    name: "lowercase",
    type: _LowerCasePipe,
    pure: true
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(LowerCasePipe, [{
    type: Pipe,
    args: [{
      name: "lowercase"
    }]
  }], null, null);
})();
var unicodeWordMatch = /(?:[0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])\S*/g;
var TitleCasePipe = class _TitleCasePipe {
  transform(value) {
    if (value == null) return null;
    if (typeof value !== "string") {
      throw invalidPipeArgumentError(_TitleCasePipe, value);
    }
    return value.replace(unicodeWordMatch, (txt) => txt[0].toUpperCase() + txt.slice(1).toLowerCase());
  }
  static \u0275fac = function TitleCasePipe_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _TitleCasePipe)();
  };
  static \u0275pipe = /* @__PURE__ */ \u0275\u0275definePipe({
    name: "titlecase",
    type: _TitleCasePipe,
    pure: true
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(TitleCasePipe, [{
    type: Pipe,
    args: [{
      name: "titlecase"
    }]
  }], null, null);
})();
var UpperCasePipe = class _UpperCasePipe {
  transform(value) {
    if (value == null) return null;
    if (typeof value !== "string") {
      throw invalidPipeArgumentError(_UpperCasePipe, value);
    }
    return value.toUpperCase();
  }
  static \u0275fac = function UpperCasePipe_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _UpperCasePipe)();
  };
  static \u0275pipe = /* @__PURE__ */ \u0275\u0275definePipe({
    name: "uppercase",
    type: _UpperCasePipe,
    pure: true
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(UpperCasePipe, [{
    type: Pipe,
    args: [{
      name: "uppercase"
    }]
  }], null, null);
})();
var DEFAULT_DATE_FORMAT = "mediumDate";
var DATE_PIPE_DEFAULT_TIMEZONE = new InjectionToken(ngDevMode ? "DATE_PIPE_DEFAULT_TIMEZONE" : "");
var DATE_PIPE_DEFAULT_OPTIONS = new InjectionToken(ngDevMode ? "DATE_PIPE_DEFAULT_OPTIONS" : "");
var DatePipe = class _DatePipe {
  locale;
  defaultTimezone;
  defaultOptions;
  constructor(locale, defaultTimezone, defaultOptions) {
    this.locale = locale;
    this.defaultTimezone = defaultTimezone;
    this.defaultOptions = defaultOptions;
  }
  transform(value, format, timezone, locale) {
    if (value == null || value === "" || value !== value) return null;
    try {
      const _format = format ?? this.defaultOptions?.dateFormat ?? DEFAULT_DATE_FORMAT;
      const _timezone = timezone ?? this.defaultOptions?.timezone ?? this.defaultTimezone ?? void 0;
      return formatDate(value, _format, locale || this.locale, _timezone);
    } catch (error) {
      throw invalidPipeArgumentError(_DatePipe, error.message);
    }
  }
  static \u0275fac = function DatePipe_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _DatePipe)(\u0275\u0275directiveInject(LOCALE_ID, 16), \u0275\u0275directiveInject(DATE_PIPE_DEFAULT_TIMEZONE, 24), \u0275\u0275directiveInject(DATE_PIPE_DEFAULT_OPTIONS, 24));
  };
  static \u0275pipe = /* @__PURE__ */ \u0275\u0275definePipe({
    name: "date",
    type: _DatePipe,
    pure: true
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(DatePipe, [{
    type: Pipe,
    args: [{
      name: "date"
    }]
  }], () => [{
    type: void 0,
    decorators: [{
      type: Inject,
      args: [LOCALE_ID]
    }]
  }, {
    type: void 0,
    decorators: [{
      type: Inject,
      args: [DATE_PIPE_DEFAULT_TIMEZONE]
    }, {
      type: Optional
    }]
  }, {
    type: void 0,
    decorators: [{
      type: Inject,
      args: [DATE_PIPE_DEFAULT_OPTIONS]
    }, {
      type: Optional
    }]
  }], null);
})();
var _INTERPOLATION_REGEXP = /#/g;
var I18nPluralPipe = class _I18nPluralPipe {
  _localization;
  constructor(_localization) {
    this._localization = _localization;
  }
  /**
   * @param value the number to be formatted
   * @param pluralMap an object that mimics the ICU format, see
   * https://unicode-org.github.io/icu/userguide/format_parse/messages/.
   * @param locale a `string` defining the locale to use (uses the current {@link LOCALE_ID} by
   * default).
   */
  transform(value, pluralMap, locale) {
    if (value == null) return "";
    if (typeof pluralMap !== "object" || pluralMap === null) {
      throw invalidPipeArgumentError(_I18nPluralPipe, pluralMap);
    }
    const key = getPluralCategory(value, Object.keys(pluralMap), this._localization, locale);
    return pluralMap[key].replace(_INTERPOLATION_REGEXP, value.toString());
  }
  static \u0275fac = function I18nPluralPipe_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _I18nPluralPipe)(\u0275\u0275directiveInject(NgLocalization, 16));
  };
  static \u0275pipe = /* @__PURE__ */ \u0275\u0275definePipe({
    name: "i18nPlural",
    type: _I18nPluralPipe,
    pure: true
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(I18nPluralPipe, [{
    type: Pipe,
    args: [{
      name: "i18nPlural"
    }]
  }], () => [{
    type: NgLocalization
  }], null);
})();
var I18nSelectPipe = class _I18nSelectPipe {
  /**
   * @param value a string to be internationalized.
   * @param mapping an object that indicates the text that should be displayed
   * for different values of the provided `value`.
   */
  transform(value, mapping) {
    if (value == null) return "";
    if (typeof mapping !== "object" || typeof value !== "string") {
      throw invalidPipeArgumentError(_I18nSelectPipe, mapping);
    }
    if (mapping.hasOwnProperty(value)) {
      return mapping[value];
    }
    if (mapping.hasOwnProperty("other")) {
      return mapping["other"];
    }
    return "";
  }
  static \u0275fac = function I18nSelectPipe_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _I18nSelectPipe)();
  };
  static \u0275pipe = /* @__PURE__ */ \u0275\u0275definePipe({
    name: "i18nSelect",
    type: _I18nSelectPipe,
    pure: true
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(I18nSelectPipe, [{
    type: Pipe,
    args: [{
      name: "i18nSelect"
    }]
  }], null, null);
})();
var JsonPipe = class _JsonPipe {
  /**
   * @param value A value of any type to convert into a JSON-format string.
   */
  transform(value) {
    return JSON.stringify(value, null, 2);
  }
  static \u0275fac = function JsonPipe_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _JsonPipe)();
  };
  static \u0275pipe = /* @__PURE__ */ \u0275\u0275definePipe({
    name: "json",
    type: _JsonPipe,
    pure: false
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(JsonPipe, [{
    type: Pipe,
    args: [{
      name: "json",
      pure: false
    }]
  }], null, null);
})();
function makeKeyValuePair(key, value) {
  return {
    key,
    value
  };
}
var KeyValuePipe = class _KeyValuePipe {
  differs;
  constructor(differs) {
    this.differs = differs;
  }
  differ;
  keyValues = [];
  compareFn = defaultComparator;
  transform(input2, compareFn = defaultComparator) {
    if (!input2 || !(input2 instanceof Map) && typeof input2 !== "object") {
      return null;
    }
    this.differ ??= this.differs.find(input2).create();
    const differChanges = this.differ.diff(input2);
    const compareFnChanged = compareFn !== this.compareFn;
    if (differChanges) {
      this.keyValues = [];
      differChanges.forEachItem((r) => {
        this.keyValues.push(makeKeyValuePair(r.key, r.currentValue));
      });
    }
    if (differChanges || compareFnChanged) {
      if (compareFn) {
        this.keyValues.sort(compareFn);
      }
      this.compareFn = compareFn;
    }
    return this.keyValues;
  }
  static \u0275fac = function KeyValuePipe_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _KeyValuePipe)(\u0275\u0275directiveInject(KeyValueDiffers, 16));
  };
  static \u0275pipe = /* @__PURE__ */ \u0275\u0275definePipe({
    name: "keyvalue",
    type: _KeyValuePipe,
    pure: false
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(KeyValuePipe, [{
    type: Pipe,
    args: [{
      name: "keyvalue",
      pure: false
    }]
  }], () => [{
    type: KeyValueDiffers
  }], null);
})();
function defaultComparator(keyValueA, keyValueB) {
  const a = keyValueA.key;
  const b = keyValueB.key;
  if (a === b) return 0;
  if (a == null) return 1;
  if (b == null) return -1;
  if (typeof a == "string" && typeof b == "string") {
    return a < b ? -1 : 1;
  }
  if (typeof a == "number" && typeof b == "number") {
    return a - b;
  }
  if (typeof a == "boolean" && typeof b == "boolean") {
    return a < b ? -1 : 1;
  }
  const aString = String(a);
  const bString = String(b);
  return aString == bString ? 0 : aString < bString ? -1 : 1;
}
var DecimalPipe = class _DecimalPipe {
  _locale;
  constructor(_locale) {
    this._locale = _locale;
  }
  transform(value, digitsInfo, locale) {
    if (!isValue(value)) return null;
    locale ||= this._locale;
    try {
      const num = strToNumber(value);
      return formatNumber(num, locale, digitsInfo);
    } catch (error) {
      throw invalidPipeArgumentError(_DecimalPipe, error.message);
    }
  }
  static \u0275fac = function DecimalPipe_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _DecimalPipe)(\u0275\u0275directiveInject(LOCALE_ID, 16));
  };
  static \u0275pipe = /* @__PURE__ */ \u0275\u0275definePipe({
    name: "number",
    type: _DecimalPipe,
    pure: true
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(DecimalPipe, [{
    type: Pipe,
    args: [{
      name: "number"
    }]
  }], () => [{
    type: void 0,
    decorators: [{
      type: Inject,
      args: [LOCALE_ID]
    }]
  }], null);
})();
var PercentPipe = class _PercentPipe {
  _locale;
  constructor(_locale) {
    this._locale = _locale;
  }
  /**
   *
   * @param value The number to be formatted as a percentage.
   * @param digitsInfo Decimal representation options, specified by a string
   * in the following format:<br>
   * <code>{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}</code>.
   *   - `minIntegerDigits`: The minimum number of integer digits before the decimal point.
   * Default is `1`.
   *   - `minFractionDigits`: The minimum number of digits after the decimal point.
   * Default is `0`.
   *   - `maxFractionDigits`: The maximum number of digits after the decimal point.
   * Default is `0`.
   * @param locale A locale code for the locale format rules to use.
   * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default.
   * See [Setting your app locale](guide/i18n/locale-id).
   */
  transform(value, digitsInfo, locale) {
    if (!isValue(value)) return null;
    locale ||= this._locale;
    try {
      const num = strToNumber(value);
      return formatPercent(num, locale, digitsInfo);
    } catch (error) {
      throw invalidPipeArgumentError(_PercentPipe, error.message);
    }
  }
  static \u0275fac = function PercentPipe_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _PercentPipe)(\u0275\u0275directiveInject(LOCALE_ID, 16));
  };
  static \u0275pipe = /* @__PURE__ */ \u0275\u0275definePipe({
    name: "percent",
    type: _PercentPipe,
    pure: true
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PercentPipe, [{
    type: Pipe,
    args: [{
      name: "percent"
    }]
  }], () => [{
    type: void 0,
    decorators: [{
      type: Inject,
      args: [LOCALE_ID]
    }]
  }], null);
})();
var CurrencyPipe = class _CurrencyPipe {
  _locale;
  _defaultCurrencyCode;
  constructor(_locale, _defaultCurrencyCode = "USD") {
    this._locale = _locale;
    this._defaultCurrencyCode = _defaultCurrencyCode;
  }
  transform(value, currencyCode = this._defaultCurrencyCode, display = "symbol", digitsInfo, locale) {
    if (!isValue(value)) return null;
    locale ||= this._locale;
    if (typeof display === "boolean") {
      if (typeof ngDevMode === "undefined" || ngDevMode) {
        console.warn(`Warning: the currency pipe has been changed in Angular v5. The symbolDisplay option (third parameter) is now a string instead of a boolean. The accepted values are "code", "symbol" or "symbol-narrow".`);
      }
      display = display ? "symbol" : "code";
    }
    let currency = currencyCode || this._defaultCurrencyCode;
    if (display !== "code") {
      if (display === "symbol" || display === "symbol-narrow") {
        currency = getCurrencySymbol(currency, display === "symbol" ? "wide" : "narrow", locale);
      } else {
        currency = display;
      }
    }
    try {
      const num = strToNumber(value);
      return formatCurrency(num, locale, currency, currencyCode, digitsInfo);
    } catch (error) {
      throw invalidPipeArgumentError(_CurrencyPipe, error.message);
    }
  }
  static \u0275fac = function CurrencyPipe_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _CurrencyPipe)(\u0275\u0275directiveInject(LOCALE_ID, 16), \u0275\u0275directiveInject(DEFAULT_CURRENCY_CODE, 16));
  };
  static \u0275pipe = /* @__PURE__ */ \u0275\u0275definePipe({
    name: "currency",
    type: _CurrencyPipe,
    pure: true
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CurrencyPipe, [{
    type: Pipe,
    args: [{
      name: "currency"
    }]
  }], () => [{
    type: void 0,
    decorators: [{
      type: Inject,
      args: [LOCALE_ID]
    }]
  }, {
    type: void 0,
    decorators: [{
      type: Inject,
      args: [DEFAULT_CURRENCY_CODE]
    }]
  }], null);
})();
function isValue(value) {
  return !(value == null || value === "" || value !== value);
}
function strToNumber(value) {
  if (typeof value === "string" && !isNaN(Number(value) - parseFloat(value))) {
    return Number(value);
  }
  if (typeof value !== "number") {
    throw new RuntimeError(2309, ngDevMode && `${value} is not a number`);
  }
  return value;
}
var SlicePipe = class _SlicePipe {
  transform(value, start, end) {
    if (value == null) return null;
    const supports = typeof value === "string" || Array.isArray(value);
    if (!supports) {
      throw invalidPipeArgumentError(_SlicePipe, value);
    }
    return value.slice(start, end);
  }
  static \u0275fac = function SlicePipe_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _SlicePipe)();
  };
  static \u0275pipe = /* @__PURE__ */ \u0275\u0275definePipe({
    name: "slice",
    type: _SlicePipe,
    pure: false
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(SlicePipe, [{
    type: Pipe,
    args: [{
      name: "slice",
      pure: false
    }]
  }], null, null);
})();
var COMMON_PIPES = [AsyncPipe, UpperCasePipe, LowerCasePipe, JsonPipe, SlicePipe, DecimalPipe, PercentPipe, TitleCasePipe, CurrencyPipe, DatePipe, I18nPluralPipe, I18nSelectPipe, KeyValuePipe];
var CommonModule = class _CommonModule {
  static \u0275fac = function CommonModule_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _CommonModule)();
  };
  static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
    type: _CommonModule,
    imports: [NgClass, NgComponentOutlet, NgForOf, NgIf, NgTemplateOutlet, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, NgPlural, NgPluralCase, AsyncPipe, UpperCasePipe, LowerCasePipe, JsonPipe, SlicePipe, DecimalPipe, PercentPipe, TitleCasePipe, CurrencyPipe, DatePipe, I18nPluralPipe, I18nSelectPipe, KeyValuePipe],
    exports: [NgClass, NgComponentOutlet, NgForOf, NgIf, NgTemplateOutlet, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, NgPlural, NgPluralCase, AsyncPipe, UpperCasePipe, LowerCasePipe, JsonPipe, SlicePipe, DecimalPipe, PercentPipe, TitleCasePipe, CurrencyPipe, DatePipe, I18nPluralPipe, I18nSelectPipe, KeyValuePipe]
  });
  static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({});
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CommonModule, [{
    type: NgModule,
    args: [{
      imports: [COMMON_DIRECTIVES, COMMON_PIPES],
      exports: [COMMON_DIRECTIVES, COMMON_PIPES]
    }]
  }], null, null);
})();

// node_modules/@angular/common/fesm2022/xhr.mjs
function parseCookieValue(cookieStr, name2) {
  name2 = encodeURIComponent(name2);
  for (const cookie of cookieStr.split(";")) {
    const eqIndex = cookie.indexOf("=");
    const [cookieName, cookieValue] = eqIndex == -1 ? [cookie, ""] : [cookie.slice(0, eqIndex), cookie.slice(eqIndex + 1)];
    if (cookieName.trim() === name2) {
      return decodeURIComponent(cookieValue);
    }
  }
  return null;
}
var XhrFactory = class {
};

// node_modules/@angular/common/fesm2022/common.mjs
var PLATFORM_BROWSER_ID = "browser";
function isPlatformBrowser(platformId) {
  return platformId === PLATFORM_BROWSER_ID;
}
var VERSION2 = new Version("20.1.3");
var ViewportScroller = class _ViewportScroller {
  // De-sugared tree-shakable injection
  // See #23917
  /** @nocollapse */
  static \u0275prov = (
    /** @pureOrBreakMyCode */
    /* @__PURE__ */ \u0275\u0275defineInjectable({
      token: _ViewportScroller,
      providedIn: "root",
      factory: () => false ? new NullViewportScroller() : new BrowserViewportScroller(inject2(DOCUMENT), window)
    })
  );
};
var BrowserViewportScroller = class {
  document;
  window;
  offset = () => [0, 0];
  constructor(document2, window2) {
    this.document = document2;
    this.window = window2;
  }
  /**
   * Configures the top offset used when scrolling to an anchor.
   * @param offset A position in screen coordinates (a tuple with x and y values)
   * or a function that returns the top offset position.
   *
   */
  setOffset(offset) {
    if (Array.isArray(offset)) {
      this.offset = () => offset;
    } else {
      this.offset = offset;
    }
  }
  /**
   * Retrieves the current scroll position.
   * @returns The position in screen coordinates.
   */
  getScrollPosition() {
    return [this.window.scrollX, this.window.scrollY];
  }
  /**
   * Sets the scroll position.
   * @param position The new position in screen coordinates.
   */
  scrollToPosition(position, options) {
    this.window.scrollTo(__spreadProps(__spreadValues({}, options), {
      left: position[0],
      top: position[1]
    }));
  }
  /**
   * Scrolls to an element and attempts to focus the element.
   *
   * Note that the function name here is misleading in that the target string may be an ID for a
   * non-anchor element.
   *
   * @param target The ID of an element or name of the anchor.
   *
   * @see https://html.spec.whatwg.org/#the-indicated-part-of-the-document
   * @see https://html.spec.whatwg.org/#scroll-to-fragid
   */
  scrollToAnchor(target, options) {
    const elSelected = findAnchorFromDocument(this.document, target);
    if (elSelected) {
      this.scrollToElement(elSelected, options);
      elSelected.focus();
    }
  }
  /**
   * Disables automatic scroll restoration provided by the browser.
   */
  setHistoryScrollRestoration(scrollRestoration) {
    try {
      this.window.history.scrollRestoration = scrollRestoration;
    } catch {
      console.warn(formatRuntimeError(2400, ngDevMode && "Failed to set `window.history.scrollRestoration`. This may occur when:\n\u2022 The script is running inside a sandboxed iframe\n\u2022 The window is partially navigated or inactive\n\u2022 The script is executed in an untrusted or special context (e.g., test runners, browser extensions, or content previews)\nScroll position may not be preserved across navigation."));
    }
  }
  /**
   * Scrolls to an element using the native offset and the specified offset set on this scroller.
   *
   * The offset can be used when we know that there is a floating header and scrolling naively to an
   * element (ex: `scrollIntoView`) leaves the element hidden behind the floating header.
   */
  scrollToElement(el, options) {
    const rect = el.getBoundingClientRect();
    const left = rect.left + this.window.pageXOffset;
    const top = rect.top + this.window.pageYOffset;
    const offset = this.offset();
    this.window.scrollTo(__spreadProps(__spreadValues({}, options), {
      left: left - offset[0],
      top: top - offset[1]
    }));
  }
};
function findAnchorFromDocument(document2, target) {
  const documentResult = document2.getElementById(target) || document2.getElementsByName(target)[0];
  if (documentResult) {
    return documentResult;
  }
  if (typeof document2.createTreeWalker === "function" && document2.body && typeof document2.body.attachShadow === "function") {
    const treeWalker = document2.createTreeWalker(document2.body, NodeFilter.SHOW_ELEMENT);
    let currentNode = treeWalker.currentNode;
    while (currentNode) {
      const shadowRoot = currentNode.shadowRoot;
      if (shadowRoot) {
        const result = shadowRoot.getElementById(target) || shadowRoot.querySelector(`[name="${target}"]`);
        if (result) {
          return result;
        }
      }
      currentNode = treeWalker.nextNode();
    }
  }
  return null;
}
var PLACEHOLDER_QUALITY = "20";
function getUrl(src, win) {
  return isAbsoluteUrl(src) ? new URL(src) : new URL(src, win.location.href);
}
function isAbsoluteUrl(src) {
  return /^https?:\/\//.test(src);
}
function extractHostname(url) {
  return isAbsoluteUrl(url) ? new URL(url).hostname : url;
}
function isValidPath(path) {
  const isString = typeof path === "string";
  if (!isString || path.trim() === "") {
    return false;
  }
  try {
    const url = new URL(path);
    return true;
  } catch {
    return false;
  }
}
function normalizePath(path) {
  return path.endsWith("/") ? path.slice(0, -1) : path;
}
function normalizeSrc(src) {
  return src.startsWith("/") ? src.slice(1) : src;
}
var noopImageLoader = (config2) => config2.src;
var IMAGE_LOADER = new InjectionToken(ngDevMode ? "ImageLoader" : "", {
  providedIn: "root",
  factory: () => noopImageLoader
});
function createImageLoader(buildUrlFn, exampleUrls) {
  return function provideImageLoader(path) {
    if (!isValidPath(path)) {
      throwInvalidPathError(path, exampleUrls || []);
    }
    path = normalizePath(path);
    const loaderFn = (config2) => {
      if (isAbsoluteUrl(config2.src)) {
        throwUnexpectedAbsoluteUrlError(path, config2.src);
      }
      return buildUrlFn(path, __spreadProps(__spreadValues({}, config2), {
        src: normalizeSrc(config2.src)
      }));
    };
    const providers = [{
      provide: IMAGE_LOADER,
      useValue: loaderFn
    }];
    return providers;
  };
}
function throwInvalidPathError(path, exampleUrls) {
  throw new RuntimeError(2959, ngDevMode && `Image loader has detected an invalid path (\`${path}\`). To fix this, supply a path using one of the following formats: ${exampleUrls.join(" or ")}`);
}
function throwUnexpectedAbsoluteUrlError(path, url) {
  throw new RuntimeError(2959, ngDevMode && `Image loader has detected a \`<img>\` tag with an invalid \`ngSrc\` attribute: ${url}. This image loader expects \`ngSrc\` to be a relative URL - however the provided value is an absolute URL. To fix this, provide \`ngSrc\` as a path relative to the base URL configured for this loader (\`${path}\`).`);
}
var provideCloudflareLoader = createImageLoader(createCloudflareUrl, ngDevMode ? ["https://<ZONE>/cdn-cgi/image/<OPTIONS>/<SOURCE-IMAGE>"] : void 0);
function createCloudflareUrl(path, config2) {
  let params = `format=auto`;
  if (config2.width) {
    params += `,width=${config2.width}`;
  }
  if (config2.isPlaceholder) {
    params += `,quality=${PLACEHOLDER_QUALITY}`;
  }
  return `${path}/cdn-cgi/image/${params}/${config2.src}`;
}
var cloudinaryLoaderInfo = {
  name: "Cloudinary",
  testUrl: isCloudinaryUrl
};
var CLOUDINARY_LOADER_REGEX = /https?\:\/\/[^\/]+\.cloudinary\.com\/.+/;
function isCloudinaryUrl(url) {
  return CLOUDINARY_LOADER_REGEX.test(url);
}
var provideCloudinaryLoader = createImageLoader(createCloudinaryUrl, ngDevMode ? ["https://res.cloudinary.com/mysite", "https://mysite.cloudinary.com", "https://subdomain.mysite.com"] : void 0);
function createCloudinaryUrl(path, config2) {
  const quality = config2.isPlaceholder ? "q_auto:low" : "q_auto";
  let params = `f_auto,${quality}`;
  if (config2.width) {
    params += `,w_${config2.width}`;
  }
  if (config2.loaderParams?.["rounded"]) {
    params += `,r_max`;
  }
  return `${path}/image/upload/${params}/${config2.src}`;
}
var imageKitLoaderInfo = {
  name: "ImageKit",
  testUrl: isImageKitUrl
};
var IMAGE_KIT_LOADER_REGEX = /https?\:\/\/[^\/]+\.imagekit\.io\/.+/;
function isImageKitUrl(url) {
  return IMAGE_KIT_LOADER_REGEX.test(url);
}
var provideImageKitLoader = createImageLoader(createImagekitUrl, ngDevMode ? ["https://ik.imagekit.io/mysite", "https://subdomain.mysite.com"] : void 0);
function createImagekitUrl(path, config2) {
  const {
    src,
    width
  } = config2;
  const params = [];
  if (width) {
    params.push(`w-${width}`);
  }
  if (config2.isPlaceholder) {
    params.push(`q-${PLACEHOLDER_QUALITY}`);
  }
  const urlSegments = params.length ? [path, `tr:${params.join(",")}`, src] : [path, src];
  const url = new URL(urlSegments.join("/"));
  return url.href;
}
var imgixLoaderInfo = {
  name: "Imgix",
  testUrl: isImgixUrl
};
var IMGIX_LOADER_REGEX = /https?\:\/\/[^\/]+\.imgix\.net\/.+/;
function isImgixUrl(url) {
  return IMGIX_LOADER_REGEX.test(url);
}
var provideImgixLoader = createImageLoader(createImgixUrl, ngDevMode ? ["https://somepath.imgix.net/"] : void 0);
function createImgixUrl(path, config2) {
  const url = new URL(`${path}/${config2.src}`);
  url.searchParams.set("auto", "format");
  if (config2.width) {
    url.searchParams.set("w", config2.width.toString());
  }
  if (config2.isPlaceholder) {
    url.searchParams.set("q", PLACEHOLDER_QUALITY);
  }
  return url.href;
}
var netlifyLoaderInfo = {
  name: "Netlify",
  testUrl: isNetlifyUrl
};
var NETLIFY_LOADER_REGEX = /https?\:\/\/[^\/]+\.netlify\.app\/.+/;
function isNetlifyUrl(url) {
  return NETLIFY_LOADER_REGEX.test(url);
}
function imgDirectiveDetails(ngSrc, includeNgSrc = true) {
  const ngSrcInfo = includeNgSrc ? `(activated on an <img> element with the \`ngSrc="${ngSrc}"\`) ` : "";
  return `The NgOptimizedImage directive ${ngSrcInfo}has detected that`;
}
function assertDevMode(checkName) {
  if (!ngDevMode) {
    throw new RuntimeError(2958, `Unexpected invocation of the ${checkName} in the prod mode. Please make sure that the prod mode is enabled for production builds.`);
  }
}
var LCPImageObserver = class _LCPImageObserver {
  // Map of full image URLs -> original `ngSrc` values.
  images = /* @__PURE__ */ new Map();
  window = inject2(DOCUMENT).defaultView;
  observer = null;
  constructor() {
    assertDevMode("LCP checker");
    if (typeof PerformanceObserver !== "undefined") {
      this.observer = this.initPerformanceObserver();
    }
  }
  /**
   * Inits PerformanceObserver and subscribes to LCP events.
   * Based on https://web.dev/lcp/#measure-lcp-in-javascript
   */
  initPerformanceObserver() {
    const observer = new PerformanceObserver((entryList) => {
      const entries = entryList.getEntries();
      if (entries.length === 0) return;
      const lcpElement = entries[entries.length - 1];
      const imgSrc = lcpElement.element?.src ?? "";
      if (imgSrc.startsWith("data:") || imgSrc.startsWith("blob:")) return;
      const img = this.images.get(imgSrc);
      if (!img) return;
      if (!img.priority && !img.alreadyWarnedPriority) {
        img.alreadyWarnedPriority = true;
        logMissingPriorityError(imgSrc);
      }
      if (img.modified && !img.alreadyWarnedModified) {
        img.alreadyWarnedModified = true;
        logModifiedWarning(imgSrc);
      }
    });
    observer.observe({
      type: "largest-contentful-paint",
      buffered: true
    });
    return observer;
  }
  registerImage(rewrittenSrc, originalNgSrc, isPriority) {
    if (!this.observer) return;
    const newObservedImageState = {
      priority: isPriority,
      modified: false,
      alreadyWarnedModified: false,
      alreadyWarnedPriority: false
    };
    this.images.set(getUrl(rewrittenSrc, this.window).href, newObservedImageState);
  }
  unregisterImage(rewrittenSrc) {
    if (!this.observer) return;
    this.images.delete(getUrl(rewrittenSrc, this.window).href);
  }
  updateImage(originalSrc, newSrc) {
    if (!this.observer) return;
    const originalUrl = getUrl(originalSrc, this.window).href;
    const img = this.images.get(originalUrl);
    if (img) {
      img.modified = true;
      this.images.set(getUrl(newSrc, this.window).href, img);
      this.images.delete(originalUrl);
    }
  }
  ngOnDestroy() {
    if (!this.observer) return;
    this.observer.disconnect();
    this.images.clear();
  }
  static \u0275fac = function LCPImageObserver_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _LCPImageObserver)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _LCPImageObserver,
    factory: _LCPImageObserver.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(LCPImageObserver, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], () => [], null);
})();
function logMissingPriorityError(ngSrc) {
  const directiveDetails = imgDirectiveDetails(ngSrc);
  console.error(formatRuntimeError(2955, `${directiveDetails} this image is the Largest Contentful Paint (LCP) element but was not marked "priority". This image should be marked "priority" in order to prioritize its loading. To fix this, add the "priority" attribute.`));
}
function logModifiedWarning(ngSrc) {
  const directiveDetails = imgDirectiveDetails(ngSrc);
  console.warn(formatRuntimeError(2964, `${directiveDetails} this image is the Largest Contentful Paint (LCP) element and has had its "ngSrc" attribute modified. This can cause slower loading performance. It is recommended not to modify the "ngSrc" property on any image which could be the LCP element.`));
}
var INTERNAL_PRECONNECT_CHECK_BLOCKLIST = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "0.0.0.0"]);
var PRECONNECT_CHECK_BLOCKLIST = new InjectionToken(ngDevMode ? "PRECONNECT_CHECK_BLOCKLIST" : "");
var PreconnectLinkChecker = class _PreconnectLinkChecker {
  document = inject2(DOCUMENT);
  /**
   * Set of <link rel="preconnect"> tags found on this page.
   * The `null` value indicates that there was no DOM query operation performed.
   */
  preconnectLinks = null;
  /*
   * Keep track of all already seen origin URLs to avoid repeating the same check.
   */
  alreadySeen = /* @__PURE__ */ new Set();
  window = this.document.defaultView;
  blocklist = new Set(INTERNAL_PRECONNECT_CHECK_BLOCKLIST);
  constructor() {
    assertDevMode("preconnect link checker");
    const blocklist = inject2(PRECONNECT_CHECK_BLOCKLIST, {
      optional: true
    });
    if (blocklist) {
      this.populateBlocklist(blocklist);
    }
  }
  populateBlocklist(origins) {
    if (Array.isArray(origins)) {
      deepForEach2(origins, (origin) => {
        this.blocklist.add(extractHostname(origin));
      });
    } else {
      this.blocklist.add(extractHostname(origins));
    }
  }
  /**
   * Checks that a preconnect resource hint exists in the head for the
   * given src.
   *
   * @param rewrittenSrc src formatted with loader
   * @param originalNgSrc ngSrc value
   */
  assertPreconnect(rewrittenSrc, originalNgSrc) {
    if (false) return;
    const imgUrl = getUrl(rewrittenSrc, this.window);
    if (this.blocklist.has(imgUrl.hostname) || this.alreadySeen.has(imgUrl.origin)) return;
    this.alreadySeen.add(imgUrl.origin);
    this.preconnectLinks ??= this.queryPreconnectLinks();
    if (!this.preconnectLinks.has(imgUrl.origin)) {
      console.warn(formatRuntimeError(2956, `${imgDirectiveDetails(originalNgSrc)} there is no preconnect tag present for this image. Preconnecting to the origin(s) that serve priority images ensures that these images are delivered as soon as possible. To fix this, please add the following element into the <head> of the document:
  <link rel="preconnect" href="${imgUrl.origin}">`));
    }
  }
  queryPreconnectLinks() {
    const preconnectUrls = /* @__PURE__ */ new Set();
    const links = this.document.querySelectorAll("link[rel=preconnect]");
    for (const link of links) {
      const url = getUrl(link.href, this.window);
      preconnectUrls.add(url.origin);
    }
    return preconnectUrls;
  }
  ngOnDestroy() {
    this.preconnectLinks?.clear();
    this.alreadySeen.clear();
  }
  static \u0275fac = function PreconnectLinkChecker_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _PreconnectLinkChecker)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _PreconnectLinkChecker,
    factory: _PreconnectLinkChecker.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PreconnectLinkChecker, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], () => [], null);
})();
function deepForEach2(input2, fn) {
  for (let value of input2) {
    Array.isArray(value) ? deepForEach2(value, fn) : fn(value);
  }
}
var DEFAULT_PRELOADED_IMAGES_LIMIT = 5;
var PRELOADED_IMAGES = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "NG_OPTIMIZED_PRELOADED_IMAGES" : "", {
  providedIn: "root",
  factory: () => /* @__PURE__ */ new Set()
});
var PreloadLinkCreator = class _PreloadLinkCreator {
  preloadedImages = inject2(PRELOADED_IMAGES);
  document = inject2(DOCUMENT);
  errorShown = false;
  /**
   * @description Add a preload `<link>` to the `<head>` of the `index.html` that is served from the
   * server while using Angular Universal and SSR to kick off image loads for high priority images.
   *
   * The `sizes` (passed in from the user) and `srcset` (parsed and formatted from `ngSrcset`)
   * properties used to set the corresponding attributes, `imagesizes` and `imagesrcset`
   * respectively, on the preload `<link>` tag so that the correctly sized image is preloaded from
   * the CDN.
   *
   * {@link https://web.dev/preload-responsive-images/#imagesrcset-and-imagesizes}
   *
   * @param renderer The `Renderer2` passed in from the directive
   * @param src The original src of the image that is set on the `ngSrc` input.
   * @param srcset The parsed and formatted srcset created from the `ngSrcset` input
   * @param sizes The value of the `sizes` attribute passed in to the `<img>` tag
   */
  createPreloadLinkTag(renderer, src, srcset, sizes) {
    if (ngDevMode && !this.errorShown && this.preloadedImages.size >= DEFAULT_PRELOADED_IMAGES_LIMIT) {
      this.errorShown = true;
      console.warn(formatRuntimeError(2961, `The \`NgOptimizedImage\` directive has detected that more than ${DEFAULT_PRELOADED_IMAGES_LIMIT} images were marked as priority. This might negatively affect an overall performance of the page. To fix this, remove the "priority" attribute from images with less priority.`));
    }
    if (this.preloadedImages.has(src)) {
      return;
    }
    this.preloadedImages.add(src);
    const preload = renderer.createElement("link");
    renderer.setAttribute(preload, "as", "image");
    renderer.setAttribute(preload, "href", src);
    renderer.setAttribute(preload, "rel", "preload");
    renderer.setAttribute(preload, "fetchpriority", "high");
    if (sizes) {
      renderer.setAttribute(preload, "imageSizes", sizes);
    }
    if (srcset) {
      renderer.setAttribute(preload, "imageSrcset", srcset);
    }
    renderer.appendChild(this.document.head, preload);
  }
  static \u0275fac = function PreloadLinkCreator_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _PreloadLinkCreator)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _PreloadLinkCreator,
    factory: _PreloadLinkCreator.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PreloadLinkCreator, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], null, null);
})();
var BASE64_IMG_MAX_LENGTH_IN_ERROR = 50;
var VALID_WIDTH_DESCRIPTOR_SRCSET = /^((\s*\d+w\s*(,|$)){1,})$/;
var VALID_DENSITY_DESCRIPTOR_SRCSET = /^((\s*\d+(\.\d+)?x\s*(,|$)){1,})$/;
var ABSOLUTE_SRCSET_DENSITY_CAP = 3;
var RECOMMENDED_SRCSET_DENSITY_CAP = 2;
var DENSITY_SRCSET_MULTIPLIERS = [1, 2];
var VIEWPORT_BREAKPOINT_CUTOFF = 640;
var ASPECT_RATIO_TOLERANCE = 0.1;
var OVERSIZED_IMAGE_TOLERANCE2 = 1e3;
var FIXED_SRCSET_WIDTH_LIMIT = 1920;
var FIXED_SRCSET_HEIGHT_LIMIT = 1080;
var PLACEHOLDER_DIMENSION_LIMIT = 1e3;
var DATA_URL_WARN_LIMIT = 4e3;
var DATA_URL_ERROR_LIMIT = 1e4;
var BUILT_IN_LOADERS = [imgixLoaderInfo, imageKitLoaderInfo, cloudinaryLoaderInfo, netlifyLoaderInfo];
var PRIORITY_COUNT_THRESHOLD = 10;
var IMGS_WITH_PRIORITY_ATTR_COUNT = 0;
var NgOptimizedImage = class _NgOptimizedImage {
  imageLoader = inject2(IMAGE_LOADER);
  config = processConfig(inject2(IMAGE_CONFIG));
  renderer = inject2(Renderer2);
  imgElement = inject2(ElementRef).nativeElement;
  injector = inject2(Injector);
  // An LCP image observer should be injected only in development mode.
  // Do not assign it to `null` to avoid having a redundant property in the production bundle.
  lcpObserver;
  /**
   * Calculate the rewritten `src` once and store it.
   * This is needed to avoid repetitive calculations and make sure the directive cleanup in the
   * `ngOnDestroy` does not rely on the `IMAGE_LOADER` logic (which in turn can rely on some other
   * instance that might be already destroyed).
   */
  _renderedSrc = null;
  /**
   * Name of the source image.
   * Image name will be processed by the image loader and the final URL will be applied as the `src`
   * property of the image.
   */
  ngSrc;
  /**
   * A comma separated list of width or density descriptors.
   * The image name will be taken from `ngSrc` and combined with the list of width or density
   * descriptors to generate the final `srcset` property of the image.
   *
   * Example:
   * ```html
   * <img ngSrc="hello.jpg" ngSrcset="100w, 200w" />  =>
   * <img src="path/hello.jpg" srcset="path/hello.jpg?w=100 100w, path/hello.jpg?w=200 200w" />
   * ```
   */
  ngSrcset;
  /**
   * The base `sizes` attribute passed through to the `<img>` element.
   * Providing sizes causes the image to create an automatic responsive srcset.
   */
  sizes;
  /**
   * For responsive images: the intrinsic width of the image in pixels.
   * For fixed size images: the desired rendered width of the image in pixels.
   */
  width;
  /**
   * For responsive images: the intrinsic height of the image in pixels.
   * For fixed size images: the desired rendered height of the image in pixels.
   */
  height;
  /**
   * The desired decoding behavior for the image. Defaults to `auto`
   * if not explicitly set, matching native browser behavior.
   *
   * Use `async` to decode the image off the main thread (non-blocking),
   * `sync` for immediate decoding (blocking), or `auto` to let the
   * browser decide the optimal strategy.
   *
   * [Spec](https://html.spec.whatwg.org/multipage/images.html#image-decoding-hint)
   */
  decoding;
  /**
   * The desired loading behavior (lazy, eager, or auto). Defaults to `lazy`,
   * which is recommended for most images.
   *
   * Warning: Setting images as loading="eager" or loading="auto" marks them
   * as non-priority images and can hurt loading performance. For images which
   * may be the LCP element, use the `priority` attribute instead of `loading`.
   */
  loading;
  /**
   * Indicates whether this image should have a high priority.
   */
  priority = false;
  /**
   * Data to pass through to custom loaders.
   */
  loaderParams;
  /**
   * Disables automatic srcset generation for this image.
   */
  disableOptimizedSrcset = false;
  /**
   * Sets the image to "fill mode", which eliminates the height/width requirement and adds
   * styles such that the image fills its containing element.
   */
  fill = false;
  /**
   * A URL or data URL for an image to be used as a placeholder while this image loads.
   */
  placeholder;
  /**
   * Configuration object for placeholder settings. Options:
   *   * blur: Setting this to false disables the automatic CSS blur.
   */
  placeholderConfig;
  /**
   * Value of the `src` attribute if set on the host `<img>` element.
   * This input is exclusively read to assert that `src` is not set in conflict
   * with `ngSrc` and that images don't start to load until a lazy loading strategy is set.
   * @internal
   */
  src;
  /**
   * Value of the `srcset` attribute if set on the host `<img>` element.
   * This input is exclusively read to assert that `srcset` is not set in conflict
   * with `ngSrcset` and that images don't start to load until a lazy loading strategy is set.
   * @internal
   */
  srcset;
  constructor() {
    if (ngDevMode) {
      this.lcpObserver = this.injector.get(LCPImageObserver);
      const destroyRef = inject2(DestroyRef);
      destroyRef.onDestroy(() => {
        if (!this.priority && this._renderedSrc !== null) {
          this.lcpObserver.unregisterImage(this._renderedSrc);
        }
      });
    }
  }
  /** @docs-private */
  ngOnInit() {
    performanceMarkFeature("NgOptimizedImage");
    if (ngDevMode) {
      const ngZone = this.injector.get(NgZone);
      assertNonEmptyInput(this, "ngSrc", this.ngSrc);
      assertValidNgSrcset(this, this.ngSrcset);
      assertNoConflictingSrc(this);
      if (this.ngSrcset) {
        assertNoConflictingSrcset(this);
      }
      assertNotBase64Image(this);
      assertNotBlobUrl(this);
      if (this.fill) {
        assertEmptyWidthAndHeight(this);
        ngZone.runOutsideAngular(() => assertNonZeroRenderedHeight(this, this.imgElement, this.renderer));
      } else {
        assertNonEmptyWidthAndHeight(this);
        if (this.height !== void 0) {
          assertGreaterThanZero(this, this.height, "height");
        }
        if (this.width !== void 0) {
          assertGreaterThanZero(this, this.width, "width");
        }
        ngZone.runOutsideAngular(() => assertNoImageDistortion(this, this.imgElement, this.renderer));
      }
      assertValidLoadingInput(this);
      assertValidDecodingInput(this);
      if (!this.ngSrcset) {
        assertNoComplexSizes(this);
      }
      assertValidPlaceholder(this, this.imageLoader);
      assertNotMissingBuiltInLoader(this.ngSrc, this.imageLoader);
      assertNoNgSrcsetWithoutLoader(this, this.imageLoader);
      assertNoLoaderParamsWithoutLoader(this, this.imageLoader);
      ngZone.runOutsideAngular(() => {
        this.lcpObserver.registerImage(this.getRewrittenSrc(), this.ngSrc, this.priority);
      });
      if (this.priority) {
        const checker = this.injector.get(PreconnectLinkChecker);
        checker.assertPreconnect(this.getRewrittenSrc(), this.ngSrc);
        if (true) {
          const applicationRef = this.injector.get(ApplicationRef);
          assetPriorityCountBelowThreshold(applicationRef);
        }
      }
    }
    if (this.placeholder) {
      this.removePlaceholderOnLoad(this.imgElement);
    }
    this.setHostAttributes();
  }
  setHostAttributes() {
    if (this.fill) {
      this.sizes ||= "100vw";
    } else {
      this.setHostAttribute("width", this.width.toString());
      this.setHostAttribute("height", this.height.toString());
    }
    this.setHostAttribute("loading", this.getLoadingBehavior());
    this.setHostAttribute("fetchpriority", this.getFetchPriority());
    this.setHostAttribute("decoding", this.getDecoding());
    this.setHostAttribute("ng-img", "true");
    const rewrittenSrcset = this.updateSrcAndSrcset();
    if (this.sizes) {
      if (this.getLoadingBehavior() === "lazy") {
        this.setHostAttribute("sizes", "auto, " + this.sizes);
      } else {
        this.setHostAttribute("sizes", this.sizes);
      }
    } else {
      if (this.ngSrcset && VALID_WIDTH_DESCRIPTOR_SRCSET.test(this.ngSrcset) && this.getLoadingBehavior() === "lazy") {
        this.setHostAttribute("sizes", "auto, 100vw");
      }
    }
    if (false) {
      const preloadLinkCreator = this.injector.get(PreloadLinkCreator);
      preloadLinkCreator.createPreloadLinkTag(this.renderer, this.getRewrittenSrc(), rewrittenSrcset, this.sizes);
    }
  }
  /** @docs-private */
  ngOnChanges(changes) {
    if (ngDevMode) {
      assertNoPostInitInputChange(this, changes, ["ngSrcset", "width", "height", "priority", "fill", "loading", "sizes", "loaderParams", "disableOptimizedSrcset"]);
    }
    if (changes["ngSrc"] && !changes["ngSrc"].isFirstChange()) {
      const oldSrc = this._renderedSrc;
      this.updateSrcAndSrcset(true);
      if (ngDevMode) {
        const newSrc = this._renderedSrc;
        if (oldSrc && newSrc && oldSrc !== newSrc) {
          const ngZone = this.injector.get(NgZone);
          ngZone.runOutsideAngular(() => {
            this.lcpObserver.updateImage(oldSrc, newSrc);
          });
        }
      }
    }
    if (ngDevMode && changes["placeholder"]?.currentValue && true && true) {
      assertPlaceholderDimensions(this, this.imgElement);
    }
  }
  callImageLoader(configWithoutCustomParams) {
    let augmentedConfig = configWithoutCustomParams;
    if (this.loaderParams) {
      augmentedConfig.loaderParams = this.loaderParams;
    }
    return this.imageLoader(augmentedConfig);
  }
  getLoadingBehavior() {
    if (!this.priority && this.loading !== void 0) {
      return this.loading;
    }
    return this.priority ? "eager" : "lazy";
  }
  getFetchPriority() {
    return this.priority ? "high" : "auto";
  }
  getDecoding() {
    if (this.priority) {
      return "sync";
    }
    return this.decoding ?? "auto";
  }
  getRewrittenSrc() {
    if (!this._renderedSrc) {
      const imgConfig = {
        src: this.ngSrc
      };
      this._renderedSrc = this.callImageLoader(imgConfig);
    }
    return this._renderedSrc;
  }
  getRewrittenSrcset() {
    const widthSrcSet = VALID_WIDTH_DESCRIPTOR_SRCSET.test(this.ngSrcset);
    const finalSrcs = this.ngSrcset.split(",").filter((src) => src !== "").map((srcStr) => {
      srcStr = srcStr.trim();
      const width = widthSrcSet ? parseFloat(srcStr) : parseFloat(srcStr) * this.width;
      return `${this.callImageLoader({
        src: this.ngSrc,
        width
      })} ${srcStr}`;
    });
    return finalSrcs.join(", ");
  }
  getAutomaticSrcset() {
    if (this.sizes) {
      return this.getResponsiveSrcset();
    } else {
      return this.getFixedSrcset();
    }
  }
  getResponsiveSrcset() {
    const {
      breakpoints
    } = this.config;
    let filteredBreakpoints = breakpoints;
    if (this.sizes?.trim() === "100vw") {
      filteredBreakpoints = breakpoints.filter((bp) => bp >= VIEWPORT_BREAKPOINT_CUTOFF);
    }
    const finalSrcs = filteredBreakpoints.map((bp) => `${this.callImageLoader({
      src: this.ngSrc,
      width: bp
    })} ${bp}w`);
    return finalSrcs.join(", ");
  }
  updateSrcAndSrcset(forceSrcRecalc = false) {
    if (forceSrcRecalc) {
      this._renderedSrc = null;
    }
    const rewrittenSrc = this.getRewrittenSrc();
    this.setHostAttribute("src", rewrittenSrc);
    let rewrittenSrcset = void 0;
    if (this.ngSrcset) {
      rewrittenSrcset = this.getRewrittenSrcset();
    } else if (this.shouldGenerateAutomaticSrcset()) {
      rewrittenSrcset = this.getAutomaticSrcset();
    }
    if (rewrittenSrcset) {
      this.setHostAttribute("srcset", rewrittenSrcset);
    }
    return rewrittenSrcset;
  }
  getFixedSrcset() {
    const finalSrcs = DENSITY_SRCSET_MULTIPLIERS.map((multiplier) => `${this.callImageLoader({
      src: this.ngSrc,
      width: this.width * multiplier
    })} ${multiplier}x`);
    return finalSrcs.join(", ");
  }
  shouldGenerateAutomaticSrcset() {
    let oversizedImage = false;
    if (!this.sizes) {
      oversizedImage = this.width > FIXED_SRCSET_WIDTH_LIMIT || this.height > FIXED_SRCSET_HEIGHT_LIMIT;
    }
    return !this.disableOptimizedSrcset && !this.srcset && this.imageLoader !== noopImageLoader && !oversizedImage;
  }
  /**
   * Returns an image url formatted for use with the CSS background-image property. Expects one of:
   * * A base64 encoded image, which is wrapped and passed through.
   * * A boolean. If true, calls the image loader to generate a small placeholder url.
   */
  generatePlaceholder(placeholderInput) {
    const {
      placeholderResolution
    } = this.config;
    if (placeholderInput === true) {
      return `url(${this.callImageLoader({
        src: this.ngSrc,
        width: placeholderResolution,
        isPlaceholder: true
      })})`;
    } else if (typeof placeholderInput === "string") {
      return `url(${placeholderInput})`;
    }
    return null;
  }
  /**
   * Determines if blur should be applied, based on an optional boolean
   * property `blur` within the optional configuration object `placeholderConfig`.
   */
  shouldBlurPlaceholder(placeholderConfig) {
    if (!placeholderConfig || !placeholderConfig.hasOwnProperty("blur")) {
      return true;
    }
    return Boolean(placeholderConfig.blur);
  }
  removePlaceholderOnLoad(img) {
    const callback = () => {
      const changeDetectorRef = this.injector.get(ChangeDetectorRef);
      removeLoadListenerFn();
      removeErrorListenerFn();
      this.placeholder = false;
      changeDetectorRef.markForCheck();
    };
    const removeLoadListenerFn = this.renderer.listen(img, "load", callback);
    const removeErrorListenerFn = this.renderer.listen(img, "error", callback);
    callOnLoadIfImageIsLoaded(img, callback);
  }
  setHostAttribute(name2, value) {
    this.renderer.setAttribute(this.imgElement, name2, value);
  }
  static \u0275fac = function NgOptimizedImage_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _NgOptimizedImage)();
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _NgOptimizedImage,
    selectors: [["img", "ngSrc", ""]],
    hostVars: 18,
    hostBindings: function NgOptimizedImage_HostBindings(rf, ctx) {
      if (rf & 2) {
        \u0275\u0275styleProp("position", ctx.fill ? "absolute" : null)("width", ctx.fill ? "100%" : null)("height", ctx.fill ? "100%" : null)("inset", ctx.fill ? "0" : null)("background-size", ctx.placeholder ? "cover" : null)("background-position", ctx.placeholder ? "50% 50%" : null)("background-repeat", ctx.placeholder ? "no-repeat" : null)("background-image", ctx.placeholder ? ctx.generatePlaceholder(ctx.placeholder) : null)("filter", ctx.placeholder && ctx.shouldBlurPlaceholder(ctx.placeholderConfig) ? "blur(15px)" : null);
      }
    },
    inputs: {
      ngSrc: [2, "ngSrc", "ngSrc", unwrapSafeUrl],
      ngSrcset: "ngSrcset",
      sizes: "sizes",
      width: [2, "width", "width", numberAttribute],
      height: [2, "height", "height", numberAttribute],
      decoding: "decoding",
      loading: "loading",
      priority: [2, "priority", "priority", booleanAttribute],
      loaderParams: "loaderParams",
      disableOptimizedSrcset: [2, "disableOptimizedSrcset", "disableOptimizedSrcset", booleanAttribute],
      fill: [2, "fill", "fill", booleanAttribute],
      placeholder: [2, "placeholder", "placeholder", booleanOrUrlAttribute],
      placeholderConfig: "placeholderConfig",
      src: "src",
      srcset: "srcset"
    },
    features: [\u0275\u0275NgOnChangesFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgOptimizedImage, [{
    type: Directive,
    args: [{
      selector: "img[ngSrc]",
      host: {
        "[style.position]": 'fill ? "absolute" : null',
        "[style.width]": 'fill ? "100%" : null',
        "[style.height]": 'fill ? "100%" : null',
        "[style.inset]": 'fill ? "0" : null',
        "[style.background-size]": 'placeholder ? "cover" : null',
        "[style.background-position]": 'placeholder ? "50% 50%" : null',
        "[style.background-repeat]": 'placeholder ? "no-repeat" : null',
        "[style.background-image]": "placeholder ? generatePlaceholder(placeholder) : null",
        "[style.filter]": 'placeholder && shouldBlurPlaceholder(placeholderConfig) ? "blur(15px)" : null'
      }
    }]
  }], () => [], {
    ngSrc: [{
      type: Input,
      args: [{
        required: true,
        transform: unwrapSafeUrl
      }]
    }],
    ngSrcset: [{
      type: Input
    }],
    sizes: [{
      type: Input
    }],
    width: [{
      type: Input,
      args: [{
        transform: numberAttribute
      }]
    }],
    height: [{
      type: Input,
      args: [{
        transform: numberAttribute
      }]
    }],
    decoding: [{
      type: Input
    }],
    loading: [{
      type: Input
    }],
    priority: [{
      type: Input,
      args: [{
        transform: booleanAttribute
      }]
    }],
    loaderParams: [{
      type: Input
    }],
    disableOptimizedSrcset: [{
      type: Input,
      args: [{
        transform: booleanAttribute
      }]
    }],
    fill: [{
      type: Input,
      args: [{
        transform: booleanAttribute
      }]
    }],
    placeholder: [{
      type: Input,
      args: [{
        transform: booleanOrUrlAttribute
      }]
    }],
    placeholderConfig: [{
      type: Input
    }],
    src: [{
      type: Input
    }],
    srcset: [{
      type: Input
    }]
  });
})();
function processConfig(config2) {
  let sortedBreakpoints = {};
  if (config2.breakpoints) {
    sortedBreakpoints.breakpoints = config2.breakpoints.sort((a, b) => a - b);
  }
  return Object.assign({}, IMAGE_CONFIG_DEFAULTS, config2, sortedBreakpoints);
}
function assertNoConflictingSrc(dir) {
  if (dir.src) {
    throw new RuntimeError(2950, `${imgDirectiveDetails(dir.ngSrc)} both \`src\` and \`ngSrc\` have been set. Supplying both of these attributes breaks lazy loading. The NgOptimizedImage directive sets \`src\` itself based on the value of \`ngSrc\`. To fix this, please remove the \`src\` attribute.`);
  }
}
function assertNoConflictingSrcset(dir) {
  if (dir.srcset) {
    throw new RuntimeError(2951, `${imgDirectiveDetails(dir.ngSrc)} both \`srcset\` and \`ngSrcset\` have been set. Supplying both of these attributes breaks lazy loading. The NgOptimizedImage directive sets \`srcset\` itself based on the value of \`ngSrcset\`. To fix this, please remove the \`srcset\` attribute.`);
  }
}
function assertNotBase64Image(dir) {
  let ngSrc = dir.ngSrc.trim();
  if (ngSrc.startsWith("data:")) {
    if (ngSrc.length > BASE64_IMG_MAX_LENGTH_IN_ERROR) {
      ngSrc = ngSrc.substring(0, BASE64_IMG_MAX_LENGTH_IN_ERROR) + "...";
    }
    throw new RuntimeError(2952, `${imgDirectiveDetails(dir.ngSrc, false)} \`ngSrc\` is a Base64-encoded string (${ngSrc}). NgOptimizedImage does not support Base64-encoded strings. To fix this, disable the NgOptimizedImage directive for this element by removing \`ngSrc\` and using a standard \`src\` attribute instead.`);
  }
}
function assertNoComplexSizes(dir) {
  let sizes = dir.sizes;
  if (sizes?.match(/((\)|,)\s|^)\d+px/)) {
    throw new RuntimeError(2952, `${imgDirectiveDetails(dir.ngSrc, false)} \`sizes\` was set to a string including pixel values. For automatic \`srcset\` generation, \`sizes\` must only include responsive values, such as \`sizes="50vw"\` or \`sizes="(min-width: 768px) 50vw, 100vw"\`. To fix this, modify the \`sizes\` attribute, or provide your own \`ngSrcset\` value directly.`);
  }
}
function assertValidPlaceholder(dir, imageLoader) {
  assertNoPlaceholderConfigWithoutPlaceholder(dir);
  assertNoRelativePlaceholderWithoutLoader(dir, imageLoader);
  assertNoOversizedDataUrl(dir);
}
function assertNoPlaceholderConfigWithoutPlaceholder(dir) {
  if (dir.placeholderConfig && !dir.placeholder) {
    throw new RuntimeError(2952, `${imgDirectiveDetails(dir.ngSrc, false)} \`placeholderConfig\` options were provided for an image that does not use the \`placeholder\` attribute, and will have no effect.`);
  }
}
function assertNoRelativePlaceholderWithoutLoader(dir, imageLoader) {
  if (dir.placeholder === true && imageLoader === noopImageLoader) {
    throw new RuntimeError(2963, `${imgDirectiveDetails(dir.ngSrc)} the \`placeholder\` attribute is set to true but no image loader is configured (i.e. the default one is being used), which would result in the same image being used for the primary image and its placeholder. To fix this, provide a loader or remove the \`placeholder\` attribute from the image.`);
  }
}
function assertNoOversizedDataUrl(dir) {
  if (dir.placeholder && typeof dir.placeholder === "string" && dir.placeholder.startsWith("data:")) {
    if (dir.placeholder.length > DATA_URL_ERROR_LIMIT) {
      throw new RuntimeError(2965, `${imgDirectiveDetails(dir.ngSrc)} the \`placeholder\` attribute is set to a data URL which is longer than ${DATA_URL_ERROR_LIMIT} characters. This is strongly discouraged, as large inline placeholders directly increase the bundle size of Angular and hurt page load performance. To fix this, generate a smaller data URL placeholder.`);
    }
    if (dir.placeholder.length > DATA_URL_WARN_LIMIT) {
      console.warn(formatRuntimeError(2965, `${imgDirectiveDetails(dir.ngSrc)} the \`placeholder\` attribute is set to a data URL which is longer than ${DATA_URL_WARN_LIMIT} characters. This is discouraged, as large inline placeholders directly increase the bundle size of Angular and hurt page load performance. For better loading performance, generate a smaller data URL placeholder.`));
    }
  }
}
function assertNotBlobUrl(dir) {
  const ngSrc = dir.ngSrc.trim();
  if (ngSrc.startsWith("blob:")) {
    throw new RuntimeError(2952, `${imgDirectiveDetails(dir.ngSrc)} \`ngSrc\` was set to a blob URL (${ngSrc}). Blob URLs are not supported by the NgOptimizedImage directive. To fix this, disable the NgOptimizedImage directive for this element by removing \`ngSrc\` and using a regular \`src\` attribute instead.`);
  }
}
function assertNonEmptyInput(dir, name2, value) {
  const isString = typeof value === "string";
  const isEmptyString = isString && value.trim() === "";
  if (!isString || isEmptyString) {
    throw new RuntimeError(2952, `${imgDirectiveDetails(dir.ngSrc)} \`${name2}\` has an invalid value (\`${value}\`). To fix this, change the value to a non-empty string.`);
  }
}
function assertValidNgSrcset(dir, value) {
  if (value == null) return;
  assertNonEmptyInput(dir, "ngSrcset", value);
  const stringVal = value;
  const isValidWidthDescriptor = VALID_WIDTH_DESCRIPTOR_SRCSET.test(stringVal);
  const isValidDensityDescriptor = VALID_DENSITY_DESCRIPTOR_SRCSET.test(stringVal);
  if (isValidDensityDescriptor) {
    assertUnderDensityCap(dir, stringVal);
  }
  const isValidSrcset = isValidWidthDescriptor || isValidDensityDescriptor;
  if (!isValidSrcset) {
    throw new RuntimeError(2952, `${imgDirectiveDetails(dir.ngSrc)} \`ngSrcset\` has an invalid value (\`${value}\`). To fix this, supply \`ngSrcset\` using a comma-separated list of one or more width descriptors (e.g. "100w, 200w") or density descriptors (e.g. "1x, 2x").`);
  }
}
function assertUnderDensityCap(dir, value) {
  const underDensityCap = value.split(",").every((num) => num === "" || parseFloat(num) <= ABSOLUTE_SRCSET_DENSITY_CAP);
  if (!underDensityCap) {
    throw new RuntimeError(2952, `${imgDirectiveDetails(dir.ngSrc)} the \`ngSrcset\` contains an unsupported image density:\`${value}\`. NgOptimizedImage generally recommends a max image density of ${RECOMMENDED_SRCSET_DENSITY_CAP}x but supports image densities up to ${ABSOLUTE_SRCSET_DENSITY_CAP}x. The human eye cannot distinguish between image densities greater than ${RECOMMENDED_SRCSET_DENSITY_CAP}x - which makes them unnecessary for most use cases. Images that will be pinch-zoomed are typically the primary use case for ${ABSOLUTE_SRCSET_DENSITY_CAP}x images. Please remove the high density descriptor and try again.`);
  }
}
function postInitInputChangeError(dir, inputName) {
  let reason;
  if (inputName === "width" || inputName === "height") {
    reason = `Changing \`${inputName}\` may result in different attribute value applied to the underlying image element and cause layout shifts on a page.`;
  } else {
    reason = `Changing the \`${inputName}\` would have no effect on the underlying image element, because the resource loading has already occurred.`;
  }
  return new RuntimeError(2953, `${imgDirectiveDetails(dir.ngSrc)} \`${inputName}\` was updated after initialization. The NgOptimizedImage directive will not react to this input change. ${reason} To fix this, either switch \`${inputName}\` to a static value or wrap the image element in an @if that is gated on the necessary value.`);
}
function assertNoPostInitInputChange(dir, changes, inputs) {
  inputs.forEach((input2) => {
    const isUpdated = changes.hasOwnProperty(input2);
    if (isUpdated && !changes[input2].isFirstChange()) {
      if (input2 === "ngSrc") {
        dir = {
          ngSrc: changes[input2].previousValue
        };
      }
      throw postInitInputChangeError(dir, input2);
    }
  });
}
function assertGreaterThanZero(dir, inputValue, inputName) {
  const validNumber = typeof inputValue === "number" && inputValue > 0;
  const validString = typeof inputValue === "string" && /^\d+$/.test(inputValue.trim()) && parseInt(inputValue) > 0;
  if (!validNumber && !validString) {
    throw new RuntimeError(2952, `${imgDirectiveDetails(dir.ngSrc)} \`${inputName}\` has an invalid value. To fix this, provide \`${inputName}\` as a number greater than 0.`);
  }
}
function assertNoImageDistortion(dir, img, renderer) {
  const callback = () => {
    removeLoadListenerFn();
    removeErrorListenerFn();
    const computedStyle = window.getComputedStyle(img);
    let renderedWidth = parseFloat(computedStyle.getPropertyValue("width"));
    let renderedHeight = parseFloat(computedStyle.getPropertyValue("height"));
    const boxSizing = computedStyle.getPropertyValue("box-sizing");
    if (boxSizing === "border-box") {
      const paddingTop = computedStyle.getPropertyValue("padding-top");
      const paddingRight = computedStyle.getPropertyValue("padding-right");
      const paddingBottom = computedStyle.getPropertyValue("padding-bottom");
      const paddingLeft = computedStyle.getPropertyValue("padding-left");
      renderedWidth -= parseFloat(paddingRight) + parseFloat(paddingLeft);
      renderedHeight -= parseFloat(paddingTop) + parseFloat(paddingBottom);
    }
    const renderedAspectRatio = renderedWidth / renderedHeight;
    const nonZeroRenderedDimensions = renderedWidth !== 0 && renderedHeight !== 0;
    const intrinsicWidth = img.naturalWidth;
    const intrinsicHeight = img.naturalHeight;
    const intrinsicAspectRatio = intrinsicWidth / intrinsicHeight;
    const suppliedWidth = dir.width;
    const suppliedHeight = dir.height;
    const suppliedAspectRatio = suppliedWidth / suppliedHeight;
    const inaccurateDimensions = Math.abs(suppliedAspectRatio - intrinsicAspectRatio) > ASPECT_RATIO_TOLERANCE;
    const stylingDistortion = nonZeroRenderedDimensions && Math.abs(intrinsicAspectRatio - renderedAspectRatio) > ASPECT_RATIO_TOLERANCE;
    if (inaccurateDimensions) {
      console.warn(formatRuntimeError(2952, `${imgDirectiveDetails(dir.ngSrc)} the aspect ratio of the image does not match the aspect ratio indicated by the width and height attributes. 
Intrinsic image size: ${intrinsicWidth}w x ${intrinsicHeight}h (aspect-ratio: ${round(intrinsicAspectRatio)}). 
Supplied width and height attributes: ${suppliedWidth}w x ${suppliedHeight}h (aspect-ratio: ${round(suppliedAspectRatio)}). 
To fix this, update the width and height attributes.`));
    } else if (stylingDistortion) {
      console.warn(formatRuntimeError(2952, `${imgDirectiveDetails(dir.ngSrc)} the aspect ratio of the rendered image does not match the image's intrinsic aspect ratio. 
Intrinsic image size: ${intrinsicWidth}w x ${intrinsicHeight}h (aspect-ratio: ${round(intrinsicAspectRatio)}). 
Rendered image size: ${renderedWidth}w x ${renderedHeight}h (aspect-ratio: ${round(renderedAspectRatio)}). 
This issue can occur if "width" and "height" attributes are added to an image without updating the corresponding image styling. To fix this, adjust image styling. In most cases, adding "height: auto" or "width: auto" to the image styling will fix this issue.`));
    } else if (!dir.ngSrcset && nonZeroRenderedDimensions) {
      const recommendedWidth = RECOMMENDED_SRCSET_DENSITY_CAP * renderedWidth;
      const recommendedHeight = RECOMMENDED_SRCSET_DENSITY_CAP * renderedHeight;
      const oversizedWidth = intrinsicWidth - recommendedWidth >= OVERSIZED_IMAGE_TOLERANCE2;
      const oversizedHeight = intrinsicHeight - recommendedHeight >= OVERSIZED_IMAGE_TOLERANCE2;
      if (oversizedWidth || oversizedHeight) {
        console.warn(formatRuntimeError(2960, `${imgDirectiveDetails(dir.ngSrc)} the intrinsic image is significantly larger than necessary. 
Rendered image size: ${renderedWidth}w x ${renderedHeight}h. 
Intrinsic image size: ${intrinsicWidth}w x ${intrinsicHeight}h. 
Recommended intrinsic image size: ${recommendedWidth}w x ${recommendedHeight}h. 
Note: Recommended intrinsic image size is calculated assuming a maximum DPR of ${RECOMMENDED_SRCSET_DENSITY_CAP}. To improve loading time, resize the image or consider using the "ngSrcset" and "sizes" attributes.`));
      }
    }
  };
  const removeLoadListenerFn = renderer.listen(img, "load", callback);
  const removeErrorListenerFn = renderer.listen(img, "error", () => {
    removeLoadListenerFn();
    removeErrorListenerFn();
  });
  callOnLoadIfImageIsLoaded(img, callback);
}
function assertNonEmptyWidthAndHeight(dir) {
  let missingAttributes = [];
  if (dir.width === void 0) missingAttributes.push("width");
  if (dir.height === void 0) missingAttributes.push("height");
  if (missingAttributes.length > 0) {
    throw new RuntimeError(2954, `${imgDirectiveDetails(dir.ngSrc)} these required attributes are missing: ${missingAttributes.map((attr) => `"${attr}"`).join(", ")}. Including "width" and "height" attributes will prevent image-related layout shifts. To fix this, include "width" and "height" attributes on the image tag or turn on "fill" mode with the \`fill\` attribute.`);
  }
}
function assertEmptyWidthAndHeight(dir) {
  if (dir.width || dir.height) {
    throw new RuntimeError(2952, `${imgDirectiveDetails(dir.ngSrc)} the attributes \`height\` and/or \`width\` are present along with the \`fill\` attribute. Because \`fill\` mode causes an image to fill its containing element, the size attributes have no effect and should be removed.`);
  }
}
function assertNonZeroRenderedHeight(dir, img, renderer) {
  const callback = () => {
    removeLoadListenerFn();
    removeErrorListenerFn();
    const renderedHeight = img.clientHeight;
    if (dir.fill && renderedHeight === 0) {
      console.warn(formatRuntimeError(2952, `${imgDirectiveDetails(dir.ngSrc)} the height of the fill-mode image is zero. This is likely because the containing element does not have the CSS 'position' property set to one of the following: "relative", "fixed", or "absolute". To fix this problem, make sure the container element has the CSS 'position' property defined and the height of the element is not zero.`));
    }
  };
  const removeLoadListenerFn = renderer.listen(img, "load", callback);
  const removeErrorListenerFn = renderer.listen(img, "error", () => {
    removeLoadListenerFn();
    removeErrorListenerFn();
  });
  callOnLoadIfImageIsLoaded(img, callback);
}
function assertValidLoadingInput(dir) {
  if (dir.loading && dir.priority) {
    throw new RuntimeError(2952, `${imgDirectiveDetails(dir.ngSrc)} the \`loading\` attribute was used on an image that was marked "priority". Setting \`loading\` on priority images is not allowed because these images will always be eagerly loaded. To fix this, remove the \u201Cloading\u201D attribute from the priority image.`);
  }
  const validInputs = ["auto", "eager", "lazy"];
  if (typeof dir.loading === "string" && !validInputs.includes(dir.loading)) {
    throw new RuntimeError(2952, `${imgDirectiveDetails(dir.ngSrc)} the \`loading\` attribute has an invalid value (\`${dir.loading}\`). To fix this, provide a valid value ("lazy", "eager", or "auto").`);
  }
}
function assertValidDecodingInput(dir) {
  const validInputs = ["sync", "async", "auto"];
  if (typeof dir.decoding === "string" && !validInputs.includes(dir.decoding)) {
    throw new RuntimeError(2952, `${imgDirectiveDetails(dir.ngSrc)} the \`decoding\` attribute has an invalid value (\`${dir.decoding}\`). To fix this, provide a valid value ("sync", "async", or "auto").`);
  }
}
function assertNotMissingBuiltInLoader(ngSrc, imageLoader) {
  if (imageLoader === noopImageLoader) {
    let builtInLoaderName = "";
    for (const loader of BUILT_IN_LOADERS) {
      if (loader.testUrl(ngSrc)) {
        builtInLoaderName = loader.name;
        break;
      }
    }
    if (builtInLoaderName) {
      console.warn(formatRuntimeError(2962, `NgOptimizedImage: It looks like your images may be hosted on the ${builtInLoaderName} CDN, but your app is not using Angular's built-in loader for that CDN. We recommend switching to use the built-in by calling \`provide${builtInLoaderName}Loader()\` in your \`providers\` and passing it your instance's base URL. If you don't want to use the built-in loader, define a custom loader function using IMAGE_LOADER to silence this warning.`));
    }
  }
}
function assertNoNgSrcsetWithoutLoader(dir, imageLoader) {
  if (dir.ngSrcset && imageLoader === noopImageLoader) {
    console.warn(formatRuntimeError(2963, `${imgDirectiveDetails(dir.ngSrc)} the \`ngSrcset\` attribute is present but no image loader is configured (i.e. the default one is being used), which would result in the same image being used for all configured sizes. To fix this, provide a loader or remove the \`ngSrcset\` attribute from the image.`));
  }
}
function assertNoLoaderParamsWithoutLoader(dir, imageLoader) {
  if (dir.loaderParams && imageLoader === noopImageLoader) {
    console.warn(formatRuntimeError(2963, `${imgDirectiveDetails(dir.ngSrc)} the \`loaderParams\` attribute is present but no image loader is configured (i.e. the default one is being used), which means that the loaderParams data will not be consumed and will not affect the URL. To fix this, provide a custom loader or remove the \`loaderParams\` attribute from the image.`));
  }
}
async function assetPriorityCountBelowThreshold(appRef) {
  if (IMGS_WITH_PRIORITY_ATTR_COUNT === 0) {
    IMGS_WITH_PRIORITY_ATTR_COUNT++;
    await appRef.whenStable();
    if (IMGS_WITH_PRIORITY_ATTR_COUNT > PRIORITY_COUNT_THRESHOLD) {
      console.warn(formatRuntimeError(2966, `NgOptimizedImage: The "priority" attribute is set to true more than ${PRIORITY_COUNT_THRESHOLD} times (${IMGS_WITH_PRIORITY_ATTR_COUNT} times). Marking too many images as "high" priority can hurt your application's LCP (https://web.dev/lcp). "Priority" should only be set on the image expected to be the page's LCP element.`));
    }
  } else {
    IMGS_WITH_PRIORITY_ATTR_COUNT++;
  }
}
function assertPlaceholderDimensions(dir, imgElement) {
  const computedStyle = window.getComputedStyle(imgElement);
  let renderedWidth = parseFloat(computedStyle.getPropertyValue("width"));
  let renderedHeight = parseFloat(computedStyle.getPropertyValue("height"));
  if (renderedWidth > PLACEHOLDER_DIMENSION_LIMIT || renderedHeight > PLACEHOLDER_DIMENSION_LIMIT) {
    console.warn(formatRuntimeError(2967, `${imgDirectiveDetails(dir.ngSrc)} it uses a placeholder image, but at least one of the dimensions attribute (height or width) exceeds the limit of ${PLACEHOLDER_DIMENSION_LIMIT}px. To fix this, use a smaller image as a placeholder.`));
  }
}
function callOnLoadIfImageIsLoaded(img, callback) {
  if (img.complete && img.naturalWidth) {
    callback();
  }
}
function round(input2) {
  return Number.isInteger(input2) ? input2 : input2.toFixed(2);
}
function unwrapSafeUrl(value) {
  if (typeof value === "string") {
    return value;
  }
  return unwrapSafeValue(value);
}
function booleanOrUrlAttribute(value) {
  if (typeof value === "string" && value !== "true" && value !== "false" && value !== "") {
    return value;
  }
  return booleanAttribute(value);
}

// node_modules/@angular/platform-browser/fesm2022/dom_renderer.mjs
var EVENT_MANAGER_PLUGINS = new InjectionToken(ngDevMode ? "EventManagerPlugins" : "");
var EventManager = class _EventManager {
  _zone;
  _plugins;
  _eventNameToPlugin = /* @__PURE__ */ new Map();
  /**
   * Initializes an instance of the event-manager service.
   */
  constructor(plugins, _zone) {
    this._zone = _zone;
    plugins.forEach((plugin) => {
      plugin.manager = this;
    });
    this._plugins = plugins.slice().reverse();
  }
  /**
   * Registers a handler for a specific element and event.
   *
   * @param element The HTML element to receive event notifications.
   * @param eventName The name of the event to listen for.
   * @param handler A function to call when the notification occurs. Receives the
   * event object as an argument.
   * @param options Options that configure how the event listener is bound.
   * @returns  A callback function that can be used to remove the handler.
   */
  addEventListener(element, eventName, handler, options) {
    const plugin = this._findPluginFor(eventName);
    return plugin.addEventListener(element, eventName, handler, options);
  }
  /**
   * Retrieves the compilation zone in which event listeners are registered.
   */
  getZone() {
    return this._zone;
  }
  /** @internal */
  _findPluginFor(eventName) {
    let plugin = this._eventNameToPlugin.get(eventName);
    if (plugin) {
      return plugin;
    }
    const plugins = this._plugins;
    plugin = plugins.find((plugin2) => plugin2.supports(eventName));
    if (!plugin) {
      throw new RuntimeError(5101, (typeof ngDevMode === "undefined" || ngDevMode) && `No event manager plugin found for event ${eventName}`);
    }
    this._eventNameToPlugin.set(eventName, plugin);
    return plugin;
  }
  static \u0275fac = function EventManager_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _EventManager)(\u0275\u0275inject(EVENT_MANAGER_PLUGINS), \u0275\u0275inject(NgZone));
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _EventManager,
    factory: _EventManager.\u0275fac
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(EventManager, [{
    type: Injectable
  }], () => [{
    type: void 0,
    decorators: [{
      type: Inject,
      args: [EVENT_MANAGER_PLUGINS]
    }]
  }, {
    type: NgZone
  }], null);
})();
var EventManagerPlugin = class {
  _doc;
  // TODO: remove (has some usage in G3)
  constructor(_doc) {
    this._doc = _doc;
  }
  // Using non-null assertion because it's set by EventManager's constructor
  manager;
};
var APP_ID_ATTRIBUTE_NAME = "ng-app-id";
function removeElements(elements) {
  for (const element of elements) {
    element.remove();
  }
}
function createStyleElement(style, doc) {
  const styleElement = doc.createElement("style");
  styleElement.textContent = style;
  return styleElement;
}
function addServerStyles(doc, appId, inline, external) {
  const elements = doc.head?.querySelectorAll(`style[${APP_ID_ATTRIBUTE_NAME}="${appId}"],link[${APP_ID_ATTRIBUTE_NAME}="${appId}"]`);
  if (elements) {
    for (const styleElement of elements) {
      styleElement.removeAttribute(APP_ID_ATTRIBUTE_NAME);
      if (styleElement instanceof HTMLLinkElement) {
        external.set(styleElement.href.slice(styleElement.href.lastIndexOf("/") + 1), {
          usage: 0,
          elements: [styleElement]
        });
      } else if (styleElement.textContent) {
        inline.set(styleElement.textContent, {
          usage: 0,
          elements: [styleElement]
        });
      }
    }
  }
}
function createLinkElement(url, doc) {
  const linkElement = doc.createElement("link");
  linkElement.setAttribute("rel", "stylesheet");
  linkElement.setAttribute("href", url);
  return linkElement;
}
var SharedStylesHost = class _SharedStylesHost {
  doc;
  appId;
  nonce;
  /**
   * Provides usage information for active inline style content and associated HTML <style> elements.
   * Embedded styles typically originate from the `styles` metadata of a rendered component.
   */
  inline = /* @__PURE__ */ new Map();
  /**
   * Provides usage information for active external style URLs and the associated HTML <link> elements.
   * External styles typically originate from the `ɵɵExternalStylesFeature` of a rendered component.
   */
  external = /* @__PURE__ */ new Map();
  /**
   * Set of host DOM nodes that will have styles attached.
   */
  hosts = /* @__PURE__ */ new Set();
  constructor(doc, appId, nonce, platformId = {}) {
    this.doc = doc;
    this.appId = appId;
    this.nonce = nonce;
    addServerStyles(doc, appId, this.inline, this.external);
    this.hosts.add(doc.head);
  }
  /**
   * Adds embedded styles to the DOM via HTML `style` elements.
   * @param styles An array of style content strings.
   */
  addStyles(styles, urls) {
    for (const value of styles) {
      this.addUsage(value, this.inline, createStyleElement);
    }
    urls?.forEach((value) => this.addUsage(value, this.external, createLinkElement));
  }
  /**
   * Removes embedded styles from the DOM that were added as HTML `style` elements.
   * @param styles An array of style content strings.
   */
  removeStyles(styles, urls) {
    for (const value of styles) {
      this.removeUsage(value, this.inline);
    }
    urls?.forEach((value) => this.removeUsage(value, this.external));
  }
  addUsage(value, usages, creator) {
    const record = usages.get(value);
    if (record) {
      if ((typeof ngDevMode === "undefined" || ngDevMode) && record.usage === 0) {
        record.elements.forEach((element) => element.setAttribute("ng-style-reused", ""));
      }
      record.usage++;
    } else {
      usages.set(value, {
        usage: 1,
        elements: [...this.hosts].map((host) => this.addElement(host, creator(value, this.doc)))
      });
    }
  }
  removeUsage(value, usages) {
    const record = usages.get(value);
    if (record) {
      record.usage--;
      if (record.usage <= 0) {
        removeElements(record.elements);
        usages.delete(value);
      }
    }
  }
  ngOnDestroy() {
    for (const [, {
      elements
    }] of [...this.inline, ...this.external]) {
      removeElements(elements);
    }
    this.hosts.clear();
  }
  /**
   * Adds a host node to the set of style hosts and adds all existing style usage to
   * the newly added host node.
   *
   * This is currently only used for Shadow DOM encapsulation mode.
   */
  addHost(hostNode) {
    this.hosts.add(hostNode);
    for (const [style, {
      elements
    }] of this.inline) {
      elements.push(this.addElement(hostNode, createStyleElement(style, this.doc)));
    }
    for (const [url, {
      elements
    }] of this.external) {
      elements.push(this.addElement(hostNode, createLinkElement(url, this.doc)));
    }
  }
  removeHost(hostNode) {
    this.hosts.delete(hostNode);
  }
  addElement(host, element) {
    if (this.nonce) {
      element.setAttribute("nonce", this.nonce);
    }
    if (false) {
      element.setAttribute(APP_ID_ATTRIBUTE_NAME, this.appId);
    }
    return host.appendChild(element);
  }
  static \u0275fac = function SharedStylesHost_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _SharedStylesHost)(\u0275\u0275inject(DOCUMENT), \u0275\u0275inject(APP_ID), \u0275\u0275inject(CSP_NONCE, 8), \u0275\u0275inject(PLATFORM_ID));
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _SharedStylesHost,
    factory: _SharedStylesHost.\u0275fac
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(SharedStylesHost, [{
    type: Injectable
  }], () => [{
    type: Document,
    decorators: [{
      type: Inject,
      args: [DOCUMENT]
    }]
  }, {
    type: void 0,
    decorators: [{
      type: Inject,
      args: [APP_ID]
    }]
  }, {
    type: void 0,
    decorators: [{
      type: Inject,
      args: [CSP_NONCE]
    }, {
      type: Optional
    }]
  }, {
    type: void 0,
    decorators: [{
      type: Inject,
      args: [PLATFORM_ID]
    }]
  }], null);
})();
var NAMESPACE_URIS = {
  "svg": "http://www.w3.org/2000/svg",
  "xhtml": "http://www.w3.org/1999/xhtml",
  "xlink": "http://www.w3.org/1999/xlink",
  "xml": "http://www.w3.org/XML/1998/namespace",
  "xmlns": "http://www.w3.org/2000/xmlns/",
  "math": "http://www.w3.org/1998/Math/MathML"
};
var COMPONENT_REGEX = /%COMP%/g;
var SOURCEMAP_URL_REGEXP = /\/\*#\s*sourceMappingURL=(.+?)\s*\*\//;
var PROTOCOL_REGEXP = /^https?:/;
var COMPONENT_VARIABLE = "%COMP%";
var HOST_ATTR = `_nghost-${COMPONENT_VARIABLE}`;
var CONTENT_ATTR = `_ngcontent-${COMPONENT_VARIABLE}`;
var REMOVE_STYLES_ON_COMPONENT_DESTROY_DEFAULT = true;
var REMOVE_STYLES_ON_COMPONENT_DESTROY = new InjectionToken(ngDevMode ? "RemoveStylesOnCompDestroy" : "", {
  providedIn: "root",
  factory: () => REMOVE_STYLES_ON_COMPONENT_DESTROY_DEFAULT
});
function shimContentAttribute(componentShortId) {
  return CONTENT_ATTR.replace(COMPONENT_REGEX, componentShortId);
}
function shimHostAttribute(componentShortId) {
  return HOST_ATTR.replace(COMPONENT_REGEX, componentShortId);
}
function shimStylesContent(compId, styles) {
  return styles.map((s) => s.replace(COMPONENT_REGEX, compId));
}
function addBaseHrefToCssSourceMap(baseHref, styles) {
  if (!baseHref) {
    return styles;
  }
  const absoluteBaseHrefUrl = new URL(baseHref, "http://localhost");
  return styles.map((cssContent) => {
    if (!cssContent.includes("sourceMappingURL=")) {
      return cssContent;
    }
    return cssContent.replace(SOURCEMAP_URL_REGEXP, (_4, sourceMapUrl) => {
      if (sourceMapUrl[0] === "/" || sourceMapUrl.startsWith("data:") || PROTOCOL_REGEXP.test(sourceMapUrl)) {
        return `/*# sourceMappingURL=${sourceMapUrl} */`;
      }
      const {
        pathname: resolvedSourceMapUrl
      } = new URL(sourceMapUrl, absoluteBaseHrefUrl);
      return `/*# sourceMappingURL=${resolvedSourceMapUrl} */`;
    });
  });
}
var DomRendererFactory2 = class _DomRendererFactory2 {
  eventManager;
  sharedStylesHost;
  appId;
  removeStylesOnCompDestroy;
  doc;
  platformId;
  ngZone;
  nonce;
  tracingService;
  rendererByCompId = /* @__PURE__ */ new Map();
  defaultRenderer;
  platformIsServer;
  constructor(eventManager, sharedStylesHost, appId, removeStylesOnCompDestroy, doc, platformId, ngZone, nonce = null, tracingService = null) {
    this.eventManager = eventManager;
    this.sharedStylesHost = sharedStylesHost;
    this.appId = appId;
    this.removeStylesOnCompDestroy = removeStylesOnCompDestroy;
    this.doc = doc;
    this.platformId = platformId;
    this.ngZone = ngZone;
    this.nonce = nonce;
    this.tracingService = tracingService;
    this.platformIsServer = false;
    this.defaultRenderer = new DefaultDomRenderer2(eventManager, doc, ngZone, this.platformIsServer, this.tracingService);
  }
  createRenderer(element, type) {
    if (!element || !type) {
      return this.defaultRenderer;
    }
    if (false) {
      type = __spreadProps(__spreadValues({}, type), {
        encapsulation: ViewEncapsulation.Emulated
      });
    }
    const renderer = this.getOrCreateRenderer(element, type);
    if (renderer instanceof EmulatedEncapsulationDomRenderer2) {
      renderer.applyToHost(element);
    } else if (renderer instanceof NoneEncapsulationDomRenderer) {
      renderer.applyStyles();
    }
    return renderer;
  }
  getOrCreateRenderer(element, type) {
    const rendererByCompId = this.rendererByCompId;
    let renderer = rendererByCompId.get(type.id);
    if (!renderer) {
      const doc = this.doc;
      const ngZone = this.ngZone;
      const eventManager = this.eventManager;
      const sharedStylesHost = this.sharedStylesHost;
      const removeStylesOnCompDestroy = this.removeStylesOnCompDestroy;
      const platformIsServer = this.platformIsServer;
      const tracingService = this.tracingService;
      switch (type.encapsulation) {
        case ViewEncapsulation.Emulated:
          renderer = new EmulatedEncapsulationDomRenderer2(eventManager, sharedStylesHost, type, this.appId, removeStylesOnCompDestroy, doc, ngZone, platformIsServer, tracingService);
          break;
        case ViewEncapsulation.ShadowDom:
          return new ShadowDomRenderer(eventManager, sharedStylesHost, element, type, doc, ngZone, this.nonce, platformIsServer, tracingService);
        default:
          renderer = new NoneEncapsulationDomRenderer(eventManager, sharedStylesHost, type, removeStylesOnCompDestroy, doc, ngZone, platformIsServer, tracingService);
          break;
      }
      rendererByCompId.set(type.id, renderer);
    }
    return renderer;
  }
  ngOnDestroy() {
    this.rendererByCompId.clear();
  }
  /**
   * Used during HMR to clear any cached data about a component.
   * @param componentId ID of the component that is being replaced.
   */
  componentReplaced(componentId) {
    this.rendererByCompId.delete(componentId);
  }
  static \u0275fac = function DomRendererFactory2_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _DomRendererFactory2)(\u0275\u0275inject(EventManager), \u0275\u0275inject(SharedStylesHost), \u0275\u0275inject(APP_ID), \u0275\u0275inject(REMOVE_STYLES_ON_COMPONENT_DESTROY), \u0275\u0275inject(DOCUMENT), \u0275\u0275inject(PLATFORM_ID), \u0275\u0275inject(NgZone), \u0275\u0275inject(CSP_NONCE), \u0275\u0275inject(TracingService, 8));
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _DomRendererFactory2,
    factory: _DomRendererFactory2.\u0275fac
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(DomRendererFactory2, [{
    type: Injectable
  }], () => [{
    type: EventManager
  }, {
    type: SharedStylesHost
  }, {
    type: void 0,
    decorators: [{
      type: Inject,
      args: [APP_ID]
    }]
  }, {
    type: void 0,
    decorators: [{
      type: Inject,
      args: [REMOVE_STYLES_ON_COMPONENT_DESTROY]
    }]
  }, {
    type: Document,
    decorators: [{
      type: Inject,
      args: [DOCUMENT]
    }]
  }, {
    type: Object,
    decorators: [{
      type: Inject,
      args: [PLATFORM_ID]
    }]
  }, {
    type: NgZone
  }, {
    type: void 0,
    decorators: [{
      type: Inject,
      args: [CSP_NONCE]
    }]
  }, {
    type: TracingService,
    decorators: [{
      type: Inject,
      args: [TracingService]
    }, {
      type: Optional
    }]
  }], null);
})();
var DefaultDomRenderer2 = class {
  eventManager;
  doc;
  ngZone;
  platformIsServer;
  tracingService;
  data = /* @__PURE__ */ Object.create(null);
  /**
   * By default this renderer throws when encountering synthetic properties
   * This can be disabled for example by the AsyncAnimationRendererFactory
   */
  throwOnSyntheticProps = true;
  constructor(eventManager, doc, ngZone, platformIsServer, tracingService) {
    this.eventManager = eventManager;
    this.doc = doc;
    this.ngZone = ngZone;
    this.platformIsServer = platformIsServer;
    this.tracingService = tracingService;
  }
  destroy() {
  }
  destroyNode = null;
  createElement(name2, namespace) {
    if (namespace) {
      return this.doc.createElementNS(NAMESPACE_URIS[namespace] || namespace, name2);
    }
    return this.doc.createElement(name2);
  }
  createComment(value) {
    return this.doc.createComment(value);
  }
  createText(value) {
    return this.doc.createTextNode(value);
  }
  appendChild(parent, newChild) {
    const targetParent = isTemplateNode(parent) ? parent.content : parent;
    targetParent.appendChild(newChild);
  }
  insertBefore(parent, newChild, refChild) {
    if (parent) {
      const targetParent = isTemplateNode(parent) ? parent.content : parent;
      targetParent.insertBefore(newChild, refChild);
    }
  }
  removeChild(_parent, oldChild) {
    oldChild.remove();
  }
  selectRootElement(selectorOrNode, preserveContent) {
    let el = typeof selectorOrNode === "string" ? this.doc.querySelector(selectorOrNode) : selectorOrNode;
    if (!el) {
      throw new RuntimeError(-5104, (typeof ngDevMode === "undefined" || ngDevMode) && `The selector "${selectorOrNode}" did not match any elements`);
    }
    if (!preserveContent) {
      el.textContent = "";
    }
    return el;
  }
  parentNode(node) {
    return node.parentNode;
  }
  nextSibling(node) {
    return node.nextSibling;
  }
  setAttribute(el, name2, value, namespace) {
    if (namespace) {
      name2 = namespace + ":" + name2;
      const namespaceUri = NAMESPACE_URIS[namespace];
      if (namespaceUri) {
        el.setAttributeNS(namespaceUri, name2, value);
      } else {
        el.setAttribute(name2, value);
      }
    } else {
      el.setAttribute(name2, value);
    }
  }
  removeAttribute(el, name2, namespace) {
    if (namespace) {
      const namespaceUri = NAMESPACE_URIS[namespace];
      if (namespaceUri) {
        el.removeAttributeNS(namespaceUri, name2);
      } else {
        el.removeAttribute(`${namespace}:${name2}`);
      }
    } else {
      el.removeAttribute(name2);
    }
  }
  addClass(el, name2) {
    el.classList.add(name2);
  }
  removeClass(el, name2) {
    el.classList.remove(name2);
  }
  setStyle(el, style, value, flags) {
    if (flags & (RendererStyleFlags2.DashCase | RendererStyleFlags2.Important)) {
      el.style.setProperty(style, value, flags & RendererStyleFlags2.Important ? "important" : "");
    } else {
      el.style[style] = value;
    }
  }
  removeStyle(el, style, flags) {
    if (flags & RendererStyleFlags2.DashCase) {
      el.style.removeProperty(style);
    } else {
      el.style[style] = "";
    }
  }
  setProperty(el, name2, value) {
    if (el == null) {
      return;
    }
    (typeof ngDevMode === "undefined" || ngDevMode) && this.throwOnSyntheticProps && checkNoSyntheticProp(name2, "property");
    el[name2] = value;
  }
  setValue(node, value) {
    node.nodeValue = value;
  }
  listen(target, event, callback, options) {
    (typeof ngDevMode === "undefined" || ngDevMode) && this.throwOnSyntheticProps && checkNoSyntheticProp(event, "listener");
    if (typeof target === "string") {
      target = getDOM().getGlobalEventTarget(this.doc, target);
      if (!target) {
        throw new RuntimeError(5102, (typeof ngDevMode === "undefined" || ngDevMode) && `Unsupported event target ${target} for event ${event}`);
      }
    }
    let wrappedCallback = this.decoratePreventDefault(callback);
    if (this.tracingService?.wrapEventListener) {
      wrappedCallback = this.tracingService.wrapEventListener(target, event, wrappedCallback);
    }
    return this.eventManager.addEventListener(target, event, wrappedCallback, options);
  }
  decoratePreventDefault(eventHandler) {
    return (event) => {
      if (event === "__ngUnwrap__") {
        return eventHandler;
      }
      const allowDefaultBehavior = false ? this.ngZone.runGuarded(() => eventHandler(event)) : eventHandler(event);
      if (allowDefaultBehavior === false) {
        event.preventDefault();
      }
      return void 0;
    };
  }
};
var AT_CHARCODE = (() => "@".charCodeAt(0))();
function checkNoSyntheticProp(name2, nameKind) {
  if (name2.charCodeAt(0) === AT_CHARCODE) {
    throw new RuntimeError(5105, `Unexpected synthetic ${nameKind} ${name2} found. Please make sure that:
  - Make sure \`provideAnimationsAsync()\`, \`provideAnimations()\` or \`provideNoopAnimations()\` call was added to a list of providers used to bootstrap an application.
  - There is a corresponding animation configuration named \`${name2}\` defined in the \`animations\` field of the \`@Component\` decorator (see https://angular.dev/api/core/Component#animations).`);
  }
}
function isTemplateNode(node) {
  return node.tagName === "TEMPLATE" && node.content !== void 0;
}
var ShadowDomRenderer = class extends DefaultDomRenderer2 {
  sharedStylesHost;
  hostEl;
  shadowRoot;
  constructor(eventManager, sharedStylesHost, hostEl, component, doc, ngZone, nonce, platformIsServer, tracingService) {
    super(eventManager, doc, ngZone, platformIsServer, tracingService);
    this.sharedStylesHost = sharedStylesHost;
    this.hostEl = hostEl;
    this.shadowRoot = hostEl.attachShadow({
      mode: "open"
    });
    this.sharedStylesHost.addHost(this.shadowRoot);
    let styles = component.styles;
    if (ngDevMode) {
      const baseHref = getDOM().getBaseHref(doc) ?? "";
      styles = addBaseHrefToCssSourceMap(baseHref, styles);
    }
    styles = shimStylesContent(component.id, styles);
    for (const style of styles) {
      const styleEl = document.createElement("style");
      if (nonce) {
        styleEl.setAttribute("nonce", nonce);
      }
      styleEl.textContent = style;
      this.shadowRoot.appendChild(styleEl);
    }
    const styleUrls = component.getExternalStyles?.();
    if (styleUrls) {
      for (const styleUrl of styleUrls) {
        const linkEl = createLinkElement(styleUrl, doc);
        if (nonce) {
          linkEl.setAttribute("nonce", nonce);
        }
        this.shadowRoot.appendChild(linkEl);
      }
    }
  }
  nodeOrShadowRoot(node) {
    return node === this.hostEl ? this.shadowRoot : node;
  }
  appendChild(parent, newChild) {
    return super.appendChild(this.nodeOrShadowRoot(parent), newChild);
  }
  insertBefore(parent, newChild, refChild) {
    return super.insertBefore(this.nodeOrShadowRoot(parent), newChild, refChild);
  }
  removeChild(_parent, oldChild) {
    return super.removeChild(null, oldChild);
  }
  parentNode(node) {
    return this.nodeOrShadowRoot(super.parentNode(this.nodeOrShadowRoot(node)));
  }
  destroy() {
    this.sharedStylesHost.removeHost(this.shadowRoot);
  }
};
var NoneEncapsulationDomRenderer = class extends DefaultDomRenderer2 {
  sharedStylesHost;
  removeStylesOnCompDestroy;
  styles;
  styleUrls;
  constructor(eventManager, sharedStylesHost, component, removeStylesOnCompDestroy, doc, ngZone, platformIsServer, tracingService, compId) {
    super(eventManager, doc, ngZone, platformIsServer, tracingService);
    this.sharedStylesHost = sharedStylesHost;
    this.removeStylesOnCompDestroy = removeStylesOnCompDestroy;
    let styles = component.styles;
    if (ngDevMode) {
      const baseHref = getDOM().getBaseHref(doc) ?? "";
      styles = addBaseHrefToCssSourceMap(baseHref, styles);
    }
    this.styles = compId ? shimStylesContent(compId, styles) : styles;
    this.styleUrls = component.getExternalStyles?.(compId);
  }
  applyStyles() {
    this.sharedStylesHost.addStyles(this.styles, this.styleUrls);
  }
  destroy() {
    if (!this.removeStylesOnCompDestroy) {
      return;
    }
    this.sharedStylesHost.removeStyles(this.styles, this.styleUrls);
  }
};
var EmulatedEncapsulationDomRenderer2 = class extends NoneEncapsulationDomRenderer {
  contentAttr;
  hostAttr;
  constructor(eventManager, sharedStylesHost, component, appId, removeStylesOnCompDestroy, doc, ngZone, platformIsServer, tracingService) {
    const compId = appId + "-" + component.id;
    super(eventManager, sharedStylesHost, component, removeStylesOnCompDestroy, doc, ngZone, platformIsServer, tracingService, compId);
    this.contentAttr = shimContentAttribute(compId);
    this.hostAttr = shimHostAttribute(compId);
  }
  applyToHost(element) {
    this.applyStyles();
    this.setAttribute(element, this.hostAttr, "");
  }
  createElement(parent, name2) {
    const el = super.createElement(parent, name2);
    super.setAttribute(el, this.contentAttr, "");
    return el;
  }
};

// node_modules/@angular/platform-browser/fesm2022/browser.mjs
var BrowserDomAdapter = class _BrowserDomAdapter extends DomAdapter {
  supportsDOMEvents = true;
  static makeCurrent() {
    setRootDomAdapter(new _BrowserDomAdapter());
  }
  onAndCancel(el, evt2, listener, options) {
    el.addEventListener(evt2, listener, options);
    return () => {
      el.removeEventListener(evt2, listener, options);
    };
  }
  dispatchEvent(el, evt2) {
    el.dispatchEvent(evt2);
  }
  remove(node) {
    node.remove();
  }
  createElement(tagName, doc) {
    doc = doc || this.getDefaultDocument();
    return doc.createElement(tagName);
  }
  createHtmlDocument() {
    return document.implementation.createHTMLDocument("fakeTitle");
  }
  getDefaultDocument() {
    return document;
  }
  isElementNode(node) {
    return node.nodeType === Node.ELEMENT_NODE;
  }
  isShadowRoot(node) {
    return node instanceof DocumentFragment;
  }
  /** @deprecated No longer being used in Ivy code. To be removed in version 14. */
  getGlobalEventTarget(doc, target) {
    if (target === "window") {
      return window;
    }
    if (target === "document") {
      return doc;
    }
    if (target === "body") {
      return doc.body;
    }
    return null;
  }
  getBaseHref(doc) {
    const href = getBaseElementHref();
    return href == null ? null : relativePath(href);
  }
  resetBaseElement() {
    baseElement = null;
  }
  getUserAgent() {
    return window.navigator.userAgent;
  }
  getCookie(name2) {
    return parseCookieValue(document.cookie, name2);
  }
};
var baseElement = null;
function getBaseElementHref() {
  baseElement = baseElement || document.head.querySelector("base");
  return baseElement ? baseElement.getAttribute("href") : null;
}
function relativePath(url) {
  return new URL(url, document.baseURI).pathname;
}
var BrowserGetTestability = class {
  addToWindow(registry) {
    _global["getAngularTestability"] = (elem, findInAncestors = true) => {
      const testability = registry.findTestabilityInTree(elem, findInAncestors);
      if (testability == null) {
        throw new RuntimeError(5103, (typeof ngDevMode === "undefined" || ngDevMode) && "Could not find testability for element.");
      }
      return testability;
    };
    _global["getAllAngularTestabilities"] = () => registry.getAllTestabilities();
    _global["getAllAngularRootElements"] = () => registry.getAllRootElements();
    const whenAllStable = (callback) => {
      const testabilities = _global["getAllAngularTestabilities"]();
      let count = testabilities.length;
      const decrement = function() {
        count--;
        if (count == 0) {
          callback();
        }
      };
      testabilities.forEach((testability) => {
        testability.whenStable(decrement);
      });
    };
    if (!_global["frameworkStabilizers"]) {
      _global["frameworkStabilizers"] = [];
    }
    _global["frameworkStabilizers"].push(whenAllStable);
  }
  findTestabilityInTree(registry, elem, findInAncestors) {
    if (elem == null) {
      return null;
    }
    const t = registry.getTestability(elem);
    if (t != null) {
      return t;
    } else if (!findInAncestors) {
      return null;
    }
    if (getDOM().isShadowRoot(elem)) {
      return this.findTestabilityInTree(registry, elem.host, true);
    }
    return this.findTestabilityInTree(registry, elem.parentElement, true);
  }
};
var BrowserXhr = class _BrowserXhr {
  build() {
    return new XMLHttpRequest();
  }
  static \u0275fac = function BrowserXhr_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _BrowserXhr)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _BrowserXhr,
    factory: _BrowserXhr.\u0275fac
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(BrowserXhr, [{
    type: Injectable
  }], null, null);
})();
var DomEventsPlugin = class _DomEventsPlugin extends EventManagerPlugin {
  constructor(doc) {
    super(doc);
  }
  // This plugin should come last in the list of plugins, because it accepts all
  // events.
  supports(eventName) {
    return true;
  }
  addEventListener(element, eventName, handler, options) {
    element.addEventListener(eventName, handler, options);
    return () => this.removeEventListener(element, eventName, handler, options);
  }
  removeEventListener(target, eventName, callback, options) {
    return target.removeEventListener(eventName, callback, options);
  }
  static \u0275fac = function DomEventsPlugin_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _DomEventsPlugin)(\u0275\u0275inject(DOCUMENT));
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _DomEventsPlugin,
    factory: _DomEventsPlugin.\u0275fac
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(DomEventsPlugin, [{
    type: Injectable
  }], () => [{
    type: void 0,
    decorators: [{
      type: Inject,
      args: [DOCUMENT]
    }]
  }], null);
})();
var MODIFIER_KEYS = ["alt", "control", "meta", "shift"];
var _keyMap = {
  "\b": "Backspace",
  "	": "Tab",
  "\x7F": "Delete",
  "\x1B": "Escape",
  "Del": "Delete",
  "Esc": "Escape",
  "Left": "ArrowLeft",
  "Right": "ArrowRight",
  "Up": "ArrowUp",
  "Down": "ArrowDown",
  "Menu": "ContextMenu",
  "Scroll": "ScrollLock",
  "Win": "OS"
};
var MODIFIER_KEY_GETTERS = {
  "alt": (event) => event.altKey,
  "control": (event) => event.ctrlKey,
  "meta": (event) => event.metaKey,
  "shift": (event) => event.shiftKey
};
var KeyEventsPlugin = class _KeyEventsPlugin extends EventManagerPlugin {
  /**
   * Initializes an instance of the browser plug-in.
   * @param doc The document in which key events will be detected.
   */
  constructor(doc) {
    super(doc);
  }
  /**
   * Reports whether a named key event is supported.
   * @param eventName The event name to query.
   * @return True if the named key event is supported.
   */
  supports(eventName) {
    return _KeyEventsPlugin.parseEventName(eventName) != null;
  }
  /**
   * Registers a handler for a specific element and key event.
   * @param element The HTML element to receive event notifications.
   * @param eventName The name of the key event to listen for.
   * @param handler A function to call when the notification occurs. Receives the
   * event object as an argument.
   * @returns The key event that was registered.
   */
  addEventListener(element, eventName, handler, options) {
    const parsedEvent = _KeyEventsPlugin.parseEventName(eventName);
    const outsideHandler = _KeyEventsPlugin.eventCallback(parsedEvent["fullKey"], handler, this.manager.getZone());
    return this.manager.getZone().runOutsideAngular(() => {
      return getDOM().onAndCancel(element, parsedEvent["domEventName"], outsideHandler, options);
    });
  }
  /**
   * Parses the user provided full keyboard event definition and normalizes it for
   * later internal use. It ensures the string is all lowercase, converts special
   * characters to a standard spelling, and orders all the values consistently.
   *
   * @param eventName The name of the key event to listen for.
   * @returns an object with the full, normalized string, and the dom event name
   * or null in the case when the event doesn't match a keyboard event.
   */
  static parseEventName(eventName) {
    const parts = eventName.toLowerCase().split(".");
    const domEventName = parts.shift();
    if (parts.length === 0 || !(domEventName === "keydown" || domEventName === "keyup")) {
      return null;
    }
    const key = _KeyEventsPlugin._normalizeKey(parts.pop());
    let fullKey = "";
    let codeIX = parts.indexOf("code");
    if (codeIX > -1) {
      parts.splice(codeIX, 1);
      fullKey = "code.";
    }
    MODIFIER_KEYS.forEach((modifierName) => {
      const index = parts.indexOf(modifierName);
      if (index > -1) {
        parts.splice(index, 1);
        fullKey += modifierName + ".";
      }
    });
    fullKey += key;
    if (parts.length != 0 || key.length === 0) {
      return null;
    }
    const result = {};
    result["domEventName"] = domEventName;
    result["fullKey"] = fullKey;
    return result;
  }
  /**
   * Determines whether the actual keys pressed match the configured key code string.
   * The `fullKeyCode` event is normalized in the `parseEventName` method when the
   * event is attached to the DOM during the `addEventListener` call. This is unseen
   * by the end user and is normalized for internal consistency and parsing.
   *
   * @param event The keyboard event.
   * @param fullKeyCode The normalized user defined expected key event string
   * @returns boolean.
   */
  static matchEventFullKeyCode(event, fullKeyCode) {
    let keycode = _keyMap[event.key] || event.key;
    let key = "";
    if (fullKeyCode.indexOf("code.") > -1) {
      keycode = event.code;
      key = "code.";
    }
    if (keycode == null || !keycode) return false;
    keycode = keycode.toLowerCase();
    if (keycode === " ") {
      keycode = "space";
    } else if (keycode === ".") {
      keycode = "dot";
    }
    MODIFIER_KEYS.forEach((modifierName) => {
      if (modifierName !== keycode) {
        const modifierGetter = MODIFIER_KEY_GETTERS[modifierName];
        if (modifierGetter(event)) {
          key += modifierName + ".";
        }
      }
    });
    key += keycode;
    return key === fullKeyCode;
  }
  /**
   * Configures a handler callback for a key event.
   * @param fullKey The event name that combines all simultaneous keystrokes.
   * @param handler The function that responds to the key event.
   * @param zone The zone in which the event occurred.
   * @returns A callback function.
   */
  static eventCallback(fullKey, handler, zone) {
    return (event) => {
      if (_KeyEventsPlugin.matchEventFullKeyCode(event, fullKey)) {
        zone.runGuarded(() => handler(event));
      }
    };
  }
  /** @internal */
  static _normalizeKey(keyName) {
    return keyName === "esc" ? "escape" : keyName;
  }
  static \u0275fac = function KeyEventsPlugin_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _KeyEventsPlugin)(\u0275\u0275inject(DOCUMENT));
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _KeyEventsPlugin,
    factory: _KeyEventsPlugin.\u0275fac
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(KeyEventsPlugin, [{
    type: Injectable
  }], () => [{
    type: void 0,
    decorators: [{
      type: Inject,
      args: [DOCUMENT]
    }]
  }], null);
})();
function bootstrapApplication(rootComponent, options) {
  const config2 = __spreadValues({
    rootComponent
  }, createProvidersConfig(options));
  if (false) {
    return resolveComponentResources(fetch).catch((error) => {
      console.error(error);
      return Promise.resolve();
    }).then(() => internalCreateApplication(config2));
  }
  return internalCreateApplication(config2);
}
function createProvidersConfig(options) {
  return {
    appProviders: [...BROWSER_MODULE_PROVIDERS, ...options?.providers ?? []],
    platformProviders: INTERNAL_BROWSER_PLATFORM_PROVIDERS
  };
}
function initDomAdapter() {
  BrowserDomAdapter.makeCurrent();
}
function errorHandler() {
  return new ErrorHandler();
}
function _document() {
  setDocument(document);
  return document;
}
var INTERNAL_BROWSER_PLATFORM_PROVIDERS = [{
  provide: PLATFORM_ID,
  useValue: PLATFORM_BROWSER_ID
}, {
  provide: PLATFORM_INITIALIZER,
  useValue: initDomAdapter,
  multi: true
}, {
  provide: DOCUMENT,
  useFactory: _document
}];
var platformBrowser = createPlatformFactory(platformCore, "browser", INTERNAL_BROWSER_PLATFORM_PROVIDERS);
var BROWSER_MODULE_PROVIDERS_MARKER = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "BrowserModule Providers Marker" : "");
var TESTABILITY_PROVIDERS = [{
  provide: TESTABILITY_GETTER,
  useClass: BrowserGetTestability
}, {
  provide: TESTABILITY,
  useClass: Testability,
  deps: [NgZone, TestabilityRegistry, TESTABILITY_GETTER]
}, {
  provide: Testability,
  // Also provide as `Testability` for backwards-compatibility.
  useClass: Testability,
  deps: [NgZone, TestabilityRegistry, TESTABILITY_GETTER]
}];
var BROWSER_MODULE_PROVIDERS = [{
  provide: INJECTOR_SCOPE,
  useValue: "root"
}, {
  provide: ErrorHandler,
  useFactory: errorHandler
}, {
  provide: EVENT_MANAGER_PLUGINS,
  useClass: DomEventsPlugin,
  multi: true,
  deps: [DOCUMENT]
}, {
  provide: EVENT_MANAGER_PLUGINS,
  useClass: KeyEventsPlugin,
  multi: true,
  deps: [DOCUMENT]
}, DomRendererFactory2, SharedStylesHost, EventManager, {
  provide: RendererFactory2,
  useExisting: DomRendererFactory2
}, {
  provide: XhrFactory,
  useClass: BrowserXhr
}, typeof ngDevMode === "undefined" || ngDevMode ? {
  provide: BROWSER_MODULE_PROVIDERS_MARKER,
  useValue: true
} : []];
var BrowserModule = class _BrowserModule {
  constructor() {
    if (typeof ngDevMode === "undefined" || ngDevMode) {
      const providersAlreadyPresent = inject2(BROWSER_MODULE_PROVIDERS_MARKER, {
        optional: true,
        skipSelf: true
      });
      if (providersAlreadyPresent) {
        throw new RuntimeError(5100, `Providers from the \`BrowserModule\` have already been loaded. If you need access to common directives such as NgIf and NgFor, import the \`CommonModule\` instead.`);
      }
    }
  }
  static \u0275fac = function BrowserModule_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _BrowserModule)();
  };
  static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
    type: _BrowserModule,
    exports: [CommonModule, ApplicationModule]
  });
  static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({
    providers: [...BROWSER_MODULE_PROVIDERS, ...TESTABILITY_PROVIDERS],
    imports: [CommonModule, ApplicationModule]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(BrowserModule, [{
    type: NgModule,
    args: [{
      providers: [...BROWSER_MODULE_PROVIDERS, ...TESTABILITY_PROVIDERS],
      exports: [CommonModule, ApplicationModule]
    }]
  }], () => [], null);
})();

// node_modules/@angular/common/fesm2022/module.mjs
var HttpHandler = class {
};
var HttpBackend = class {
};
var HttpHeaders = class _HttpHeaders {
  /**
   * Internal map of lowercase header names to values.
   */
  headers;
  /**
   * Internal map of lowercased header names to the normalized
   * form of the name (the form seen first).
   */
  normalizedNames = /* @__PURE__ */ new Map();
  /**
   * Complete the lazy initialization of this object (needed before reading).
   */
  lazyInit;
  /**
   * Queued updates to be materialized the next initialization.
   */
  lazyUpdate = null;
  /**  Constructs a new HTTP header object with the given values.*/
  constructor(headers) {
    if (!headers) {
      this.headers = /* @__PURE__ */ new Map();
    } else if (typeof headers === "string") {
      this.lazyInit = () => {
        this.headers = /* @__PURE__ */ new Map();
        headers.split("\n").forEach((line) => {
          const index = line.indexOf(":");
          if (index > 0) {
            const name2 = line.slice(0, index);
            const value = line.slice(index + 1).trim();
            this.addHeaderEntry(name2, value);
          }
        });
      };
    } else if (typeof Headers !== "undefined" && headers instanceof Headers) {
      this.headers = /* @__PURE__ */ new Map();
      headers.forEach((value, name2) => {
        this.addHeaderEntry(name2, value);
      });
    } else {
      this.lazyInit = () => {
        if (typeof ngDevMode === "undefined" || ngDevMode) {
          assertValidHeaders(headers);
        }
        this.headers = /* @__PURE__ */ new Map();
        Object.entries(headers).forEach(([name2, values]) => {
          this.setHeaderEntries(name2, values);
        });
      };
    }
  }
  /**
   * Checks for existence of a given header.
   *
   * @param name The header name to check for existence.
   *
   * @returns True if the header exists, false otherwise.
   */
  has(name2) {
    this.init();
    return this.headers.has(name2.toLowerCase());
  }
  /**
   * Retrieves the first value of a given header.
   *
   * @param name The header name.
   *
   * @returns The value string if the header exists, null otherwise
   */
  get(name2) {
    this.init();
    const values = this.headers.get(name2.toLowerCase());
    return values && values.length > 0 ? values[0] : null;
  }
  /**
   * Retrieves the names of the headers.
   *
   * @returns A list of header names.
   */
  keys() {
    this.init();
    return Array.from(this.normalizedNames.values());
  }
  /**
   * Retrieves a list of values for a given header.
   *
   * @param name The header name from which to retrieve values.
   *
   * @returns A string of values if the header exists, null otherwise.
   */
  getAll(name2) {
    this.init();
    return this.headers.get(name2.toLowerCase()) || null;
  }
  /**
   * Appends a new value to the existing set of values for a header
   * and returns them in a clone of the original instance.
   *
   * @param name The header name for which to append the values.
   * @param value The value to append.
   *
   * @returns A clone of the HTTP headers object with the value appended to the given header.
   */
  append(name2, value) {
    return this.clone({
      name: name2,
      value,
      op: "a"
    });
  }
  /**
   * Sets or modifies a value for a given header in a clone of the original instance.
   * If the header already exists, its value is replaced with the given value
   * in the returned object.
   *
   * @param name The header name.
   * @param value The value or values to set or override for the given header.
   *
   * @returns A clone of the HTTP headers object with the newly set header value.
   */
  set(name2, value) {
    return this.clone({
      name: name2,
      value,
      op: "s"
    });
  }
  /**
   * Deletes values for a given header in a clone of the original instance.
   *
   * @param name The header name.
   * @param value The value or values to delete for the given header.
   *
   * @returns A clone of the HTTP headers object with the given value deleted.
   */
  delete(name2, value) {
    return this.clone({
      name: name2,
      value,
      op: "d"
    });
  }
  maybeSetNormalizedName(name2, lcName) {
    if (!this.normalizedNames.has(lcName)) {
      this.normalizedNames.set(lcName, name2);
    }
  }
  init() {
    if (!!this.lazyInit) {
      if (this.lazyInit instanceof _HttpHeaders) {
        this.copyFrom(this.lazyInit);
      } else {
        this.lazyInit();
      }
      this.lazyInit = null;
      if (!!this.lazyUpdate) {
        this.lazyUpdate.forEach((update) => this.applyUpdate(update));
        this.lazyUpdate = null;
      }
    }
  }
  copyFrom(other) {
    other.init();
    Array.from(other.headers.keys()).forEach((key) => {
      this.headers.set(key, other.headers.get(key));
      this.normalizedNames.set(key, other.normalizedNames.get(key));
    });
  }
  clone(update) {
    const clone = new _HttpHeaders();
    clone.lazyInit = !!this.lazyInit && this.lazyInit instanceof _HttpHeaders ? this.lazyInit : this;
    clone.lazyUpdate = (this.lazyUpdate || []).concat([update]);
    return clone;
  }
  applyUpdate(update) {
    const key = update.name.toLowerCase();
    switch (update.op) {
      case "a":
      case "s":
        let value = update.value;
        if (typeof value === "string") {
          value = [value];
        }
        if (value.length === 0) {
          return;
        }
        this.maybeSetNormalizedName(update.name, key);
        const base = (update.op === "a" ? this.headers.get(key) : void 0) || [];
        base.push(...value);
        this.headers.set(key, base);
        break;
      case "d":
        const toDelete = update.value;
        if (!toDelete) {
          this.headers.delete(key);
          this.normalizedNames.delete(key);
        } else {
          let existing = this.headers.get(key);
          if (!existing) {
            return;
          }
          existing = existing.filter((value2) => toDelete.indexOf(value2) === -1);
          if (existing.length === 0) {
            this.headers.delete(key);
            this.normalizedNames.delete(key);
          } else {
            this.headers.set(key, existing);
          }
        }
        break;
    }
  }
  addHeaderEntry(name2, value) {
    const key = name2.toLowerCase();
    this.maybeSetNormalizedName(name2, key);
    if (this.headers.has(key)) {
      this.headers.get(key).push(value);
    } else {
      this.headers.set(key, [value]);
    }
  }
  setHeaderEntries(name2, values) {
    const headerValues = (Array.isArray(values) ? values : [values]).map((value) => value.toString());
    const key = name2.toLowerCase();
    this.headers.set(key, headerValues);
    this.maybeSetNormalizedName(name2, key);
  }
  /**
   * @internal
   */
  forEach(fn) {
    this.init();
    Array.from(this.normalizedNames.keys()).forEach((key) => fn(this.normalizedNames.get(key), this.headers.get(key)));
  }
};
function assertValidHeaders(headers) {
  for (const [key, value] of Object.entries(headers)) {
    if (!(typeof value === "string" || typeof value === "number") && !Array.isArray(value)) {
      throw new Error(`Unexpected value of the \`${key}\` header provided. Expecting either a string, a number or an array, but got: \`${value}\`.`);
    }
  }
}
var HttpUrlEncodingCodec = class {
  /**
   * Encodes a key name for a URL parameter or query-string.
   * @param key The key name.
   * @returns The encoded key name.
   */
  encodeKey(key) {
    return standardEncoding(key);
  }
  /**
   * Encodes the value of a URL parameter or query-string.
   * @param value The value.
   * @returns The encoded value.
   */
  encodeValue(value) {
    return standardEncoding(value);
  }
  /**
   * Decodes an encoded URL parameter or query-string key.
   * @param key The encoded key name.
   * @returns The decoded key name.
   */
  decodeKey(key) {
    return decodeURIComponent(key);
  }
  /**
   * Decodes an encoded URL parameter or query-string value.
   * @param value The encoded value.
   * @returns The decoded value.
   */
  decodeValue(value) {
    return decodeURIComponent(value);
  }
};
function paramParser(rawParams, codec) {
  const map3 = /* @__PURE__ */ new Map();
  if (rawParams.length > 0) {
    const params = rawParams.replace(/^\?/, "").split("&");
    params.forEach((param) => {
      const eqIdx = param.indexOf("=");
      const [key, val] = eqIdx == -1 ? [codec.decodeKey(param), ""] : [codec.decodeKey(param.slice(0, eqIdx)), codec.decodeValue(param.slice(eqIdx + 1))];
      const list = map3.get(key) || [];
      list.push(val);
      map3.set(key, list);
    });
  }
  return map3;
}
var STANDARD_ENCODING_REGEX = /%(\d[a-f0-9])/gi;
var STANDARD_ENCODING_REPLACEMENTS = {
  "40": "@",
  "3A": ":",
  "24": "$",
  "2C": ",",
  "3B": ";",
  "3D": "=",
  "3F": "?",
  "2F": "/"
};
function standardEncoding(v) {
  return encodeURIComponent(v).replace(STANDARD_ENCODING_REGEX, (s, t) => STANDARD_ENCODING_REPLACEMENTS[t] ?? s);
}
function valueToString(value) {
  return `${value}`;
}
var HttpParams = class _HttpParams {
  map;
  encoder;
  updates = null;
  cloneFrom = null;
  constructor(options = {}) {
    this.encoder = options.encoder || new HttpUrlEncodingCodec();
    if (options.fromString) {
      if (options.fromObject) {
        throw new RuntimeError(2805, ngDevMode && "Cannot specify both fromString and fromObject.");
      }
      this.map = paramParser(options.fromString, this.encoder);
    } else if (!!options.fromObject) {
      this.map = /* @__PURE__ */ new Map();
      Object.keys(options.fromObject).forEach((key) => {
        const value = options.fromObject[key];
        const values = Array.isArray(value) ? value.map(valueToString) : [valueToString(value)];
        this.map.set(key, values);
      });
    } else {
      this.map = null;
    }
  }
  /**
   * Reports whether the body includes one or more values for a given parameter.
   * @param param The parameter name.
   * @returns True if the parameter has one or more values,
   * false if it has no value or is not present.
   */
  has(param) {
    this.init();
    return this.map.has(param);
  }
  /**
   * Retrieves the first value for a parameter.
   * @param param The parameter name.
   * @returns The first value of the given parameter,
   * or `null` if the parameter is not present.
   */
  get(param) {
    this.init();
    const res = this.map.get(param);
    return !!res ? res[0] : null;
  }
  /**
   * Retrieves all values for a  parameter.
   * @param param The parameter name.
   * @returns All values in a string array,
   * or `null` if the parameter not present.
   */
  getAll(param) {
    this.init();
    return this.map.get(param) || null;
  }
  /**
   * Retrieves all the parameters for this body.
   * @returns The parameter names in a string array.
   */
  keys() {
    this.init();
    return Array.from(this.map.keys());
  }
  /**
   * Appends a new value to existing values for a parameter.
   * @param param The parameter name.
   * @param value The new value to add.
   * @return A new body with the appended value.
   */
  append(param, value) {
    return this.clone({
      param,
      value,
      op: "a"
    });
  }
  /**
   * Constructs a new body with appended values for the given parameter name.
   * @param params parameters and values
   * @return A new body with the new value.
   */
  appendAll(params) {
    const updates = [];
    Object.keys(params).forEach((param) => {
      const value = params[param];
      if (Array.isArray(value)) {
        value.forEach((_value) => {
          updates.push({
            param,
            value: _value,
            op: "a"
          });
        });
      } else {
        updates.push({
          param,
          value,
          op: "a"
        });
      }
    });
    return this.clone(updates);
  }
  /**
   * Replaces the value for a parameter.
   * @param param The parameter name.
   * @param value The new value.
   * @return A new body with the new value.
   */
  set(param, value) {
    return this.clone({
      param,
      value,
      op: "s"
    });
  }
  /**
   * Removes a given value or all values from a parameter.
   * @param param The parameter name.
   * @param value The value to remove, if provided.
   * @return A new body with the given value removed, or with all values
   * removed if no value is specified.
   */
  delete(param, value) {
    return this.clone({
      param,
      value,
      op: "d"
    });
  }
  /**
   * Serializes the body to an encoded string, where key-value pairs (separated by `=`) are
   * separated by `&`s.
   */
  toString() {
    this.init();
    return this.keys().map((key) => {
      const eKey = this.encoder.encodeKey(key);
      return this.map.get(key).map((value) => eKey + "=" + this.encoder.encodeValue(value)).join("&");
    }).filter((param) => param !== "").join("&");
  }
  clone(update) {
    const clone = new _HttpParams({
      encoder: this.encoder
    });
    clone.cloneFrom = this.cloneFrom || this;
    clone.updates = (this.updates || []).concat(update);
    return clone;
  }
  init() {
    if (this.map === null) {
      this.map = /* @__PURE__ */ new Map();
    }
    if (this.cloneFrom !== null) {
      this.cloneFrom.init();
      this.cloneFrom.keys().forEach((key) => this.map.set(key, this.cloneFrom.map.get(key)));
      this.updates.forEach((update) => {
        switch (update.op) {
          case "a":
          case "s":
            const base = (update.op === "a" ? this.map.get(update.param) : void 0) || [];
            base.push(valueToString(update.value));
            this.map.set(update.param, base);
            break;
          case "d":
            if (update.value !== void 0) {
              let base2 = this.map.get(update.param) || [];
              const idx = base2.indexOf(valueToString(update.value));
              if (idx !== -1) {
                base2.splice(idx, 1);
              }
              if (base2.length > 0) {
                this.map.set(update.param, base2);
              } else {
                this.map.delete(update.param);
              }
            } else {
              this.map.delete(update.param);
              break;
            }
        }
      });
      this.cloneFrom = this.updates = null;
    }
  }
};
var HttpContext = class {
  map = /* @__PURE__ */ new Map();
  /**
   * Store a value in the context. If a value is already present it will be overwritten.
   *
   * @param token The reference to an instance of `HttpContextToken`.
   * @param value The value to store.
   *
   * @returns A reference to itself for easy chaining.
   */
  set(token, value) {
    this.map.set(token, value);
    return this;
  }
  /**
   * Retrieve the value associated with the given token.
   *
   * @param token The reference to an instance of `HttpContextToken`.
   *
   * @returns The stored value or default if one is defined.
   */
  get(token) {
    if (!this.map.has(token)) {
      this.map.set(token, token.defaultValue());
    }
    return this.map.get(token);
  }
  /**
   * Delete the value associated with the given token.
   *
   * @param token The reference to an instance of `HttpContextToken`.
   *
   * @returns A reference to itself for easy chaining.
   */
  delete(token) {
    this.map.delete(token);
    return this;
  }
  /**
   * Checks for existence of a given token.
   *
   * @param token The reference to an instance of `HttpContextToken`.
   *
   * @returns True if the token exists, false otherwise.
   */
  has(token) {
    return this.map.has(token);
  }
  /**
   * @returns a list of tokens currently stored in the context.
   */
  keys() {
    return this.map.keys();
  }
};
function mightHaveBody(method) {
  switch (method) {
    case "DELETE":
    case "GET":
    case "HEAD":
    case "OPTIONS":
    case "JSONP":
      return false;
    default:
      return true;
  }
}
function isArrayBuffer(value) {
  return typeof ArrayBuffer !== "undefined" && value instanceof ArrayBuffer;
}
function isBlob(value) {
  return typeof Blob !== "undefined" && value instanceof Blob;
}
function isFormData(value) {
  return typeof FormData !== "undefined" && value instanceof FormData;
}
function isUrlSearchParams(value) {
  return typeof URLSearchParams !== "undefined" && value instanceof URLSearchParams;
}
var CONTENT_TYPE_HEADER = "Content-Type";
var ACCEPT_HEADER = "Accept";
var X_REQUEST_URL_HEADER = "X-Request-URL";
var TEXT_CONTENT_TYPE = "text/plain";
var JSON_CONTENT_TYPE = "application/json";
var ACCEPT_HEADER_VALUE = `${JSON_CONTENT_TYPE}, ${TEXT_CONTENT_TYPE}, */*`;
var HttpRequest = class _HttpRequest {
  url;
  /**
   * The request body, or `null` if one isn't set.
   *
   * Bodies are not enforced to be immutable, as they can include a reference to any
   * user-defined data type. However, interceptors should take care to preserve
   * idempotence by treating them as such.
   */
  body = null;
  /**
   * Outgoing headers for this request.
   */
  headers;
  /**
   * Shared and mutable context that can be used by interceptors
   */
  context;
  /**
   * Whether this request should be made in a way that exposes progress events.
   *
   * Progress events are expensive (change detection runs on each event) and so
   * they should only be requested if the consumer intends to monitor them.
   *
   * Note: The `FetchBackend` doesn't support progress report on uploads.
   */
  reportProgress = false;
  /**
   * Whether this request should be sent with outgoing credentials (cookies).
   */
  withCredentials = false;
  /**
   *  The credentials mode of the request, which determines how cookies and HTTP authentication are handled.
   *  This can affect whether cookies are sent with the request, and how authentication is handled.
   */
  credentials;
  /**
   * When using the fetch implementation and set to `true`, the browser will not abort the associated request if the page that initiated it is unloaded before the request is complete.
   */
  keepalive = false;
  /**
   * Controls how the request will interact with the browser's HTTP cache.
   * This affects whether a response is retrieved from the cache, how it is stored, or if it bypasses the cache altogether.
   */
  cache;
  /**
   * Indicates the relative priority of the request. This may be used by the browser to decide the order in which requests are dispatched and resources fetched.
   */
  priority;
  /**
   * The mode of the request, which determines how the request will interact with the browser's security model.
   * This can affect things like CORS (Cross-Origin Resource Sharing) and same-origin policies.
   */
  mode;
  /**
   * The redirect mode of the request, which determines how redirects are handled.
   * This can affect whether the request follows redirects automatically, or if it fails when a redirect occurs.
   */
  redirect;
  /**
   * The expected response type of the server.
   *
   * This is used to parse the response appropriately before returning it to
   * the requestee.
   */
  responseType = "json";
  /**
   * The outgoing HTTP request method.
   */
  method;
  /**
   * Outgoing URL parameters.
   *
   * To pass a string representation of HTTP parameters in the URL-query-string format,
   * the `HttpParamsOptions`' `fromString` may be used. For example:
   *
   * ```ts
   * new HttpParams({fromString: 'angular=awesome'})
   * ```
   */
  params;
  /**
   * The outgoing URL with all URL parameters set.
   */
  urlWithParams;
  /**
   * The HttpTransferCache option for the request
   */
  transferCache;
  /**
   * The timeout for the backend HTTP request in ms.
   */
  timeout;
  constructor(method, url, third, fourth) {
    this.url = url;
    this.method = method.toUpperCase();
    let options;
    if (mightHaveBody(this.method) || !!fourth) {
      this.body = third !== void 0 ? third : null;
      options = fourth;
    } else {
      options = third;
    }
    if (options) {
      this.reportProgress = !!options.reportProgress;
      this.withCredentials = !!options.withCredentials;
      this.keepalive = !!options.keepalive;
      if (!!options.responseType) {
        this.responseType = options.responseType;
      }
      if (options.headers) {
        this.headers = options.headers;
      }
      if (options.context) {
        this.context = options.context;
      }
      if (options.params) {
        this.params = options.params;
      }
      if (options.priority) {
        this.priority = options.priority;
      }
      if (options.cache) {
        this.cache = options.cache;
      }
      if (options.credentials) {
        this.credentials = options.credentials;
      }
      if (typeof options.timeout === "number") {
        if (options.timeout < 1 || !Number.isInteger(options.timeout)) {
          throw new Error(ngDevMode ? "`timeout` must be a positive integer value" : "");
        }
        this.timeout = options.timeout;
      }
      if (options.mode) {
        this.mode = options.mode;
      }
      if (options.redirect) {
        this.redirect = options.redirect;
      }
      this.transferCache = options.transferCache;
    }
    this.headers ??= new HttpHeaders();
    this.context ??= new HttpContext();
    if (!this.params) {
      this.params = new HttpParams();
      this.urlWithParams = url;
    } else {
      const params = this.params.toString();
      if (params.length === 0) {
        this.urlWithParams = url;
      } else {
        const qIdx = url.indexOf("?");
        const sep = qIdx === -1 ? "?" : qIdx < url.length - 1 ? "&" : "";
        this.urlWithParams = url + sep + params;
      }
    }
  }
  /**
   * Transform the free-form body into a serialized format suitable for
   * transmission to the server.
   */
  serializeBody() {
    if (this.body === null) {
      return null;
    }
    if (typeof this.body === "string" || isArrayBuffer(this.body) || isBlob(this.body) || isFormData(this.body) || isUrlSearchParams(this.body)) {
      return this.body;
    }
    if (this.body instanceof HttpParams) {
      return this.body.toString();
    }
    if (typeof this.body === "object" || typeof this.body === "boolean" || Array.isArray(this.body)) {
      return JSON.stringify(this.body);
    }
    return this.body.toString();
  }
  /**
   * Examine the body and attempt to infer an appropriate MIME type
   * for it.
   *
   * If no such type can be inferred, this method will return `null`.
   */
  detectContentTypeHeader() {
    if (this.body === null) {
      return null;
    }
    if (isFormData(this.body)) {
      return null;
    }
    if (isBlob(this.body)) {
      return this.body.type || null;
    }
    if (isArrayBuffer(this.body)) {
      return null;
    }
    if (typeof this.body === "string") {
      return TEXT_CONTENT_TYPE;
    }
    if (this.body instanceof HttpParams) {
      return "application/x-www-form-urlencoded;charset=UTF-8";
    }
    if (typeof this.body === "object" || typeof this.body === "number" || typeof this.body === "boolean") {
      return JSON_CONTENT_TYPE;
    }
    return null;
  }
  clone(update = {}) {
    const method = update.method || this.method;
    const url = update.url || this.url;
    const responseType = update.responseType || this.responseType;
    const keepalive = update.keepalive ?? this.keepalive;
    const priority = update.priority || this.priority;
    const cache = update.cache || this.cache;
    const mode = update.mode || this.mode;
    const redirect = update.redirect || this.redirect;
    const credentials = update.credentials || this.credentials;
    const transferCache = update.transferCache ?? this.transferCache;
    const timeout = update.timeout ?? this.timeout;
    const body = update.body !== void 0 ? update.body : this.body;
    const withCredentials = update.withCredentials ?? this.withCredentials;
    const reportProgress = update.reportProgress ?? this.reportProgress;
    let headers = update.headers || this.headers;
    let params = update.params || this.params;
    const context2 = update.context ?? this.context;
    if (update.setHeaders !== void 0) {
      headers = Object.keys(update.setHeaders).reduce((headers2, name2) => headers2.set(name2, update.setHeaders[name2]), headers);
    }
    if (update.setParams) {
      params = Object.keys(update.setParams).reduce((params2, param) => params2.set(param, update.setParams[param]), params);
    }
    return new _HttpRequest(method, url, body, {
      params,
      headers,
      context: context2,
      reportProgress,
      responseType,
      withCredentials,
      transferCache,
      keepalive,
      cache,
      priority,
      timeout,
      mode,
      redirect,
      credentials
    });
  }
};
var HttpEventType;
(function(HttpEventType2) {
  HttpEventType2[HttpEventType2["Sent"] = 0] = "Sent";
  HttpEventType2[HttpEventType2["UploadProgress"] = 1] = "UploadProgress";
  HttpEventType2[HttpEventType2["ResponseHeader"] = 2] = "ResponseHeader";
  HttpEventType2[HttpEventType2["DownloadProgress"] = 3] = "DownloadProgress";
  HttpEventType2[HttpEventType2["Response"] = 4] = "Response";
  HttpEventType2[HttpEventType2["User"] = 5] = "User";
})(HttpEventType || (HttpEventType = {}));
var HttpResponseBase = class {
  /**
   * All response headers.
   */
  headers;
  /**
   * Response status code.
   */
  status;
  /**
   * Textual description of response status code, defaults to OK.
   *
   * Do not depend on this.
   */
  statusText;
  /**
   * URL of the resource retrieved, or null if not available.
   */
  url;
  /**
   * Whether the status code falls in the 2xx range.
   */
  ok;
  /**
   * Type of the response, narrowed to either the full response or the header.
   */
  type;
  /**
   * Super-constructor for all responses.
   *
   * The single parameter accepted is an initialization hash. Any properties
   * of the response passed there will override the default values.
   */
  constructor(init, defaultStatus = 200, defaultStatusText = "OK") {
    this.headers = init.headers || new HttpHeaders();
    this.status = init.status !== void 0 ? init.status : defaultStatus;
    this.statusText = init.statusText || defaultStatusText;
    this.url = init.url || null;
    this.ok = this.status >= 200 && this.status < 300;
  }
};
var HttpHeaderResponse = class _HttpHeaderResponse extends HttpResponseBase {
  /**
   * Create a new `HttpHeaderResponse` with the given parameters.
   */
  constructor(init = {}) {
    super(init);
  }
  type = HttpEventType.ResponseHeader;
  /**
   * Copy this `HttpHeaderResponse`, overriding its contents with the
   * given parameter hash.
   */
  clone(update = {}) {
    return new _HttpHeaderResponse({
      headers: update.headers || this.headers,
      status: update.status !== void 0 ? update.status : this.status,
      statusText: update.statusText || this.statusText,
      url: update.url || this.url || void 0
    });
  }
};
var HttpResponse = class _HttpResponse extends HttpResponseBase {
  /**
   * The response body, or `null` if one was not returned.
   */
  body;
  /**
   * Construct a new `HttpResponse`.
   */
  constructor(init = {}) {
    super(init);
    this.body = init.body !== void 0 ? init.body : null;
  }
  type = HttpEventType.Response;
  clone(update = {}) {
    return new _HttpResponse({
      body: update.body !== void 0 ? update.body : this.body,
      headers: update.headers || this.headers,
      status: update.status !== void 0 ? update.status : this.status,
      statusText: update.statusText || this.statusText,
      url: update.url || this.url || void 0
    });
  }
};
var HttpErrorResponse = class extends HttpResponseBase {
  name = "HttpErrorResponse";
  message;
  error;
  /**
   * Errors are never okay, even when the status code is in the 2xx success range.
   */
  ok = false;
  constructor(init) {
    super(init, 0, "Unknown Error");
    if (this.status >= 200 && this.status < 300) {
      this.message = `Http failure during parsing for ${init.url || "(unknown url)"}`;
    } else {
      this.message = `Http failure response for ${init.url || "(unknown url)"}: ${init.status} ${init.statusText}`;
    }
    this.error = init.error || null;
  }
};
var HTTP_STATUS_CODE_OK = 200;
var HTTP_STATUS_CODE_NO_CONTENT = 204;
var HttpStatusCode;
(function(HttpStatusCode2) {
  HttpStatusCode2[HttpStatusCode2["Continue"] = 100] = "Continue";
  HttpStatusCode2[HttpStatusCode2["SwitchingProtocols"] = 101] = "SwitchingProtocols";
  HttpStatusCode2[HttpStatusCode2["Processing"] = 102] = "Processing";
  HttpStatusCode2[HttpStatusCode2["EarlyHints"] = 103] = "EarlyHints";
  HttpStatusCode2[HttpStatusCode2["Ok"] = 200] = "Ok";
  HttpStatusCode2[HttpStatusCode2["Created"] = 201] = "Created";
  HttpStatusCode2[HttpStatusCode2["Accepted"] = 202] = "Accepted";
  HttpStatusCode2[HttpStatusCode2["NonAuthoritativeInformation"] = 203] = "NonAuthoritativeInformation";
  HttpStatusCode2[HttpStatusCode2["NoContent"] = 204] = "NoContent";
  HttpStatusCode2[HttpStatusCode2["ResetContent"] = 205] = "ResetContent";
  HttpStatusCode2[HttpStatusCode2["PartialContent"] = 206] = "PartialContent";
  HttpStatusCode2[HttpStatusCode2["MultiStatus"] = 207] = "MultiStatus";
  HttpStatusCode2[HttpStatusCode2["AlreadyReported"] = 208] = "AlreadyReported";
  HttpStatusCode2[HttpStatusCode2["ImUsed"] = 226] = "ImUsed";
  HttpStatusCode2[HttpStatusCode2["MultipleChoices"] = 300] = "MultipleChoices";
  HttpStatusCode2[HttpStatusCode2["MovedPermanently"] = 301] = "MovedPermanently";
  HttpStatusCode2[HttpStatusCode2["Found"] = 302] = "Found";
  HttpStatusCode2[HttpStatusCode2["SeeOther"] = 303] = "SeeOther";
  HttpStatusCode2[HttpStatusCode2["NotModified"] = 304] = "NotModified";
  HttpStatusCode2[HttpStatusCode2["UseProxy"] = 305] = "UseProxy";
  HttpStatusCode2[HttpStatusCode2["Unused"] = 306] = "Unused";
  HttpStatusCode2[HttpStatusCode2["TemporaryRedirect"] = 307] = "TemporaryRedirect";
  HttpStatusCode2[HttpStatusCode2["PermanentRedirect"] = 308] = "PermanentRedirect";
  HttpStatusCode2[HttpStatusCode2["BadRequest"] = 400] = "BadRequest";
  HttpStatusCode2[HttpStatusCode2["Unauthorized"] = 401] = "Unauthorized";
  HttpStatusCode2[HttpStatusCode2["PaymentRequired"] = 402] = "PaymentRequired";
  HttpStatusCode2[HttpStatusCode2["Forbidden"] = 403] = "Forbidden";
  HttpStatusCode2[HttpStatusCode2["NotFound"] = 404] = "NotFound";
  HttpStatusCode2[HttpStatusCode2["MethodNotAllowed"] = 405] = "MethodNotAllowed";
  HttpStatusCode2[HttpStatusCode2["NotAcceptable"] = 406] = "NotAcceptable";
  HttpStatusCode2[HttpStatusCode2["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired";
  HttpStatusCode2[HttpStatusCode2["RequestTimeout"] = 408] = "RequestTimeout";
  HttpStatusCode2[HttpStatusCode2["Conflict"] = 409] = "Conflict";
  HttpStatusCode2[HttpStatusCode2["Gone"] = 410] = "Gone";
  HttpStatusCode2[HttpStatusCode2["LengthRequired"] = 411] = "LengthRequired";
  HttpStatusCode2[HttpStatusCode2["PreconditionFailed"] = 412] = "PreconditionFailed";
  HttpStatusCode2[HttpStatusCode2["PayloadTooLarge"] = 413] = "PayloadTooLarge";
  HttpStatusCode2[HttpStatusCode2["UriTooLong"] = 414] = "UriTooLong";
  HttpStatusCode2[HttpStatusCode2["UnsupportedMediaType"] = 415] = "UnsupportedMediaType";
  HttpStatusCode2[HttpStatusCode2["RangeNotSatisfiable"] = 416] = "RangeNotSatisfiable";
  HttpStatusCode2[HttpStatusCode2["ExpectationFailed"] = 417] = "ExpectationFailed";
  HttpStatusCode2[HttpStatusCode2["ImATeapot"] = 418] = "ImATeapot";
  HttpStatusCode2[HttpStatusCode2["MisdirectedRequest"] = 421] = "MisdirectedRequest";
  HttpStatusCode2[HttpStatusCode2["UnprocessableEntity"] = 422] = "UnprocessableEntity";
  HttpStatusCode2[HttpStatusCode2["Locked"] = 423] = "Locked";
  HttpStatusCode2[HttpStatusCode2["FailedDependency"] = 424] = "FailedDependency";
  HttpStatusCode2[HttpStatusCode2["TooEarly"] = 425] = "TooEarly";
  HttpStatusCode2[HttpStatusCode2["UpgradeRequired"] = 426] = "UpgradeRequired";
  HttpStatusCode2[HttpStatusCode2["PreconditionRequired"] = 428] = "PreconditionRequired";
  HttpStatusCode2[HttpStatusCode2["TooManyRequests"] = 429] = "TooManyRequests";
  HttpStatusCode2[HttpStatusCode2["RequestHeaderFieldsTooLarge"] = 431] = "RequestHeaderFieldsTooLarge";
  HttpStatusCode2[HttpStatusCode2["UnavailableForLegalReasons"] = 451] = "UnavailableForLegalReasons";
  HttpStatusCode2[HttpStatusCode2["InternalServerError"] = 500] = "InternalServerError";
  HttpStatusCode2[HttpStatusCode2["NotImplemented"] = 501] = "NotImplemented";
  HttpStatusCode2[HttpStatusCode2["BadGateway"] = 502] = "BadGateway";
  HttpStatusCode2[HttpStatusCode2["ServiceUnavailable"] = 503] = "ServiceUnavailable";
  HttpStatusCode2[HttpStatusCode2["GatewayTimeout"] = 504] = "GatewayTimeout";
  HttpStatusCode2[HttpStatusCode2["HttpVersionNotSupported"] = 505] = "HttpVersionNotSupported";
  HttpStatusCode2[HttpStatusCode2["VariantAlsoNegotiates"] = 506] = "VariantAlsoNegotiates";
  HttpStatusCode2[HttpStatusCode2["InsufficientStorage"] = 507] = "InsufficientStorage";
  HttpStatusCode2[HttpStatusCode2["LoopDetected"] = 508] = "LoopDetected";
  HttpStatusCode2[HttpStatusCode2["NotExtended"] = 510] = "NotExtended";
  HttpStatusCode2[HttpStatusCode2["NetworkAuthenticationRequired"] = 511] = "NetworkAuthenticationRequired";
})(HttpStatusCode || (HttpStatusCode = {}));
function addBody(options, body) {
  return {
    body,
    headers: options.headers,
    context: options.context,
    observe: options.observe,
    params: options.params,
    reportProgress: options.reportProgress,
    responseType: options.responseType,
    withCredentials: options.withCredentials,
    transferCache: options.transferCache,
    keepalive: options.keepalive,
    priority: options.priority,
    cache: options.cache,
    mode: options.mode,
    redirect: options.redirect
  };
}
var HttpClient = class _HttpClient {
  handler;
  constructor(handler) {
    this.handler = handler;
  }
  /**
   * Constructs an observable for a generic HTTP request that, when subscribed,
   * fires the request through the chain of registered interceptors and on to the
   * server.
   *
   * You can pass an `HttpRequest` directly as the only parameter. In this case,
   * the call returns an observable of the raw `HttpEvent` stream.
   *
   * Alternatively you can pass an HTTP method as the first parameter,
   * a URL string as the second, and an options hash containing the request body as the third.
   * See `addBody()`. In this case, the specified `responseType` and `observe` options determine the
   * type of returned observable.
   *   * The `responseType` value determines how a successful response body is parsed.
   *   * If `responseType` is the default `json`, you can pass a type interface for the resulting
   * object as a type parameter to the call.
   *
   * The `observe` value determines the return type, according to what you are interested in
   * observing.
   *   * An `observe` value of events returns an observable of the raw `HttpEvent` stream, including
   * progress events by default.
   *   * An `observe` value of response returns an observable of `HttpResponse<T>`,
   * where the `T` parameter depends on the `responseType` and any optionally provided type
   * parameter.
   *   * An `observe` value of body returns an observable of `<T>` with the same `T` body type.
   *
   */
  request(first2, url, options = {}) {
    let req;
    if (first2 instanceof HttpRequest) {
      req = first2;
    } else {
      let headers = void 0;
      if (options.headers instanceof HttpHeaders) {
        headers = options.headers;
      } else {
        headers = new HttpHeaders(options.headers);
      }
      let params = void 0;
      if (!!options.params) {
        if (options.params instanceof HttpParams) {
          params = options.params;
        } else {
          params = new HttpParams({
            fromObject: options.params
          });
        }
      }
      req = new HttpRequest(first2, url, options.body !== void 0 ? options.body : null, {
        headers,
        context: options.context,
        params,
        reportProgress: options.reportProgress,
        // By default, JSON is assumed to be returned for all calls.
        responseType: options.responseType || "json",
        withCredentials: options.withCredentials,
        transferCache: options.transferCache,
        keepalive: options.keepalive,
        priority: options.priority,
        cache: options.cache,
        mode: options.mode,
        redirect: options.redirect,
        credentials: options.credentials
      });
    }
    const events$ = of(req).pipe(concatMap((req2) => this.handler.handle(req2)));
    if (first2 instanceof HttpRequest || options.observe === "events") {
      return events$;
    }
    const res$ = events$.pipe(filter((event) => event instanceof HttpResponse));
    switch (options.observe || "body") {
      case "body":
        switch (req.responseType) {
          case "arraybuffer":
            return res$.pipe(map((res) => {
              if (res.body !== null && !(res.body instanceof ArrayBuffer)) {
                throw new RuntimeError(2806, ngDevMode && "Response is not an ArrayBuffer.");
              }
              return res.body;
            }));
          case "blob":
            return res$.pipe(map((res) => {
              if (res.body !== null && !(res.body instanceof Blob)) {
                throw new RuntimeError(2807, ngDevMode && "Response is not a Blob.");
              }
              return res.body;
            }));
          case "text":
            return res$.pipe(map((res) => {
              if (res.body !== null && typeof res.body !== "string") {
                throw new RuntimeError(2808, ngDevMode && "Response is not a string.");
              }
              return res.body;
            }));
          case "json":
          default:
            return res$.pipe(map((res) => res.body));
        }
      case "response":
        return res$;
      default:
        throw new RuntimeError(2809, ngDevMode && `Unreachable: unhandled observe type ${options.observe}}`);
    }
  }
  /**
   * Constructs an observable that, when subscribed, causes the configured
   * `DELETE` request to execute on the server. See the individual overloads for
   * details on the return type.
   *
   * @param url     The endpoint URL.
   * @param options The HTTP options to send with the request.
   *
   */
  delete(url, options = {}) {
    return this.request("DELETE", url, options);
  }
  /**
   * Constructs an observable that, when subscribed, causes the configured
   * `GET` request to execute on the server. See the individual overloads for
   * details on the return type.
   */
  get(url, options = {}) {
    return this.request("GET", url, options);
  }
  /**
   * Constructs an observable that, when subscribed, causes the configured
   * `HEAD` request to execute on the server. The `HEAD` method returns
   * meta information about the resource without transferring the
   * resource itself. See the individual overloads for
   * details on the return type.
   */
  head(url, options = {}) {
    return this.request("HEAD", url, options);
  }
  /**
   * Constructs an `Observable` that, when subscribed, causes a request with the special method
   * `JSONP` to be dispatched via the interceptor pipeline.
   * The [JSONP pattern](https://en.wikipedia.org/wiki/JSONP) works around limitations of certain
   * API endpoints that don't support newer,
   * and preferable [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) protocol.
   * JSONP treats the endpoint API as a JavaScript file and tricks the browser to process the
   * requests even if the API endpoint is not located on the same domain (origin) as the client-side
   * application making the request.
   * The endpoint API must support JSONP callback for JSONP requests to work.
   * The resource API returns the JSON response wrapped in a callback function.
   * You can pass the callback function name as one of the query parameters.
   * Note that JSONP requests can only be used with `GET` requests.
   *
   * @param url The resource URL.
   * @param callbackParam The callback function name.
   *
   */
  jsonp(url, callbackParam) {
    return this.request("JSONP", url, {
      params: new HttpParams().append(callbackParam, "JSONP_CALLBACK"),
      observe: "body",
      responseType: "json"
    });
  }
  /**
   * Constructs an `Observable` that, when subscribed, causes the configured
   * `OPTIONS` request to execute on the server. This method allows the client
   * to determine the supported HTTP methods and other capabilities of an endpoint,
   * without implying a resource action. See the individual overloads for
   * details on the return type.
   */
  options(url, options = {}) {
    return this.request("OPTIONS", url, options);
  }
  /**
   * Constructs an observable that, when subscribed, causes the configured
   * `PATCH` request to execute on the server. See the individual overloads for
   * details on the return type.
   */
  patch(url, body, options = {}) {
    return this.request("PATCH", url, addBody(options, body));
  }
  /**
   * Constructs an observable that, when subscribed, causes the configured
   * `POST` request to execute on the server. The server responds with the location of
   * the replaced resource. See the individual overloads for
   * details on the return type.
   */
  post(url, body, options = {}) {
    return this.request("POST", url, addBody(options, body));
  }
  /**
   * Constructs an observable that, when subscribed, causes the configured
   * `PUT` request to execute on the server. The `PUT` method replaces an existing resource
   * with a new set of values.
   * See the individual overloads for details on the return type.
   */
  put(url, body, options = {}) {
    return this.request("PUT", url, addBody(options, body));
  }
  static \u0275fac = function HttpClient_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _HttpClient)(\u0275\u0275inject(HttpHandler));
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _HttpClient,
    factory: _HttpClient.\u0275fac
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HttpClient, [{
    type: Injectable
  }], () => [{
    type: HttpHandler
  }], null);
})();
var XSSI_PREFIX$1 = /^\)\]\}',?\n/;
function getResponseUrl$1(response) {
  if (response.url) {
    return response.url;
  }
  const xRequestUrl = X_REQUEST_URL_HEADER.toLocaleLowerCase();
  return response.headers.get(xRequestUrl);
}
var FETCH_BACKEND = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "FETCH_BACKEND" : "");
var FetchBackend = class _FetchBackend {
  // We use an arrow function to always reference the current global implementation of `fetch`.
  // This is helpful for cases when the global `fetch` implementation is modified by external code,
  // see https://github.com/angular/angular/issues/57527.
  fetchImpl = inject2(FetchFactory, {
    optional: true
  })?.fetch ?? ((...args) => globalThis.fetch(...args));
  ngZone = inject2(NgZone);
  destroyRef = inject2(DestroyRef);
  destroyed = false;
  constructor() {
    this.destroyRef.onDestroy(() => {
      this.destroyed = true;
    });
  }
  handle(request) {
    return new Observable((observer) => {
      const aborter = new AbortController();
      this.doRequest(request, aborter.signal, observer).then(noop3, (error) => observer.error(new HttpErrorResponse({
        error
      })));
      let timeoutId;
      if (request.timeout) {
        timeoutId = this.ngZone.runOutsideAngular(() => setTimeout(() => {
          if (!aborter.signal.aborted) {
            aborter.abort(new DOMException("signal timed out", "TimeoutError"));
          }
        }, request.timeout));
      }
      return () => {
        if (timeoutId !== void 0) {
          clearTimeout(timeoutId);
        }
        aborter.abort();
      };
    });
  }
  async doRequest(request, signal2, observer) {
    const init = this.createRequestInit(request);
    let response;
    try {
      const fetchPromise = this.ngZone.runOutsideAngular(() => this.fetchImpl(request.urlWithParams, __spreadValues({
        signal: signal2
      }, init)));
      silenceSuperfluousUnhandledPromiseRejection(fetchPromise);
      observer.next({
        type: HttpEventType.Sent
      });
      response = await fetchPromise;
    } catch (error) {
      observer.error(new HttpErrorResponse({
        error,
        status: error.status ?? 0,
        statusText: error.statusText,
        url: request.urlWithParams,
        headers: error.headers
      }));
      return;
    }
    const headers = new HttpHeaders(response.headers);
    const statusText = response.statusText;
    const url = getResponseUrl$1(response) ?? request.urlWithParams;
    let status = response.status;
    let body = null;
    if (request.reportProgress) {
      observer.next(new HttpHeaderResponse({
        headers,
        status,
        statusText,
        url
      }));
    }
    if (response.body) {
      const contentLength = response.headers.get("content-length");
      const chunks = [];
      const reader = response.body.getReader();
      let receivedLength = 0;
      let decoder;
      let partialText;
      const reqZone = typeof Zone !== "undefined" && Zone.current;
      let canceled = false;
      await this.ngZone.runOutsideAngular(async () => {
        while (true) {
          if (this.destroyed) {
            await reader.cancel();
            canceled = true;
            break;
          }
          const {
            done,
            value
          } = await reader.read();
          if (done) {
            break;
          }
          chunks.push(value);
          receivedLength += value.length;
          if (request.reportProgress) {
            partialText = request.responseType === "text" ? (partialText ?? "") + (decoder ??= new TextDecoder()).decode(value, {
              stream: true
            }) : void 0;
            const reportProgress = () => observer.next({
              type: HttpEventType.DownloadProgress,
              total: contentLength ? +contentLength : void 0,
              loaded: receivedLength,
              partialText
            });
            reqZone ? reqZone.run(reportProgress) : reportProgress();
          }
        }
      });
      if (canceled) {
        observer.complete();
        return;
      }
      const chunksAll = this.concatChunks(chunks, receivedLength);
      try {
        const contentType = response.headers.get(CONTENT_TYPE_HEADER) ?? "";
        body = this.parseBody(request, chunksAll, contentType);
      } catch (error) {
        observer.error(new HttpErrorResponse({
          error,
          headers: new HttpHeaders(response.headers),
          status: response.status,
          statusText: response.statusText,
          url: getResponseUrl$1(response) ?? request.urlWithParams
        }));
        return;
      }
    }
    if (status === 0) {
      status = body ? HTTP_STATUS_CODE_OK : 0;
    }
    const ok = status >= 200 && status < 300;
    if (ok) {
      observer.next(new HttpResponse({
        body,
        headers,
        status,
        statusText,
        url
      }));
      observer.complete();
    } else {
      observer.error(new HttpErrorResponse({
        error: body,
        headers,
        status,
        statusText,
        url
      }));
    }
  }
  parseBody(request, binContent, contentType) {
    switch (request.responseType) {
      case "json":
        const text = new TextDecoder().decode(binContent).replace(XSSI_PREFIX$1, "");
        return text === "" ? null : JSON.parse(text);
      case "text":
        return new TextDecoder().decode(binContent);
      case "blob":
        return new Blob([binContent], {
          type: contentType
        });
      case "arraybuffer":
        return binContent.buffer;
    }
  }
  createRequestInit(req) {
    const headers = {};
    let credentials;
    credentials = req.credentials;
    if (req.withCredentials) {
      (typeof ngDevMode === "undefined" || ngDevMode) && warningOptionsMessage(req);
      credentials = "include";
    }
    req.headers.forEach((name2, values) => headers[name2] = values.join(","));
    if (!req.headers.has(ACCEPT_HEADER)) {
      headers[ACCEPT_HEADER] = ACCEPT_HEADER_VALUE;
    }
    if (!req.headers.has(CONTENT_TYPE_HEADER)) {
      const detectedType = req.detectContentTypeHeader();
      if (detectedType !== null) {
        headers[CONTENT_TYPE_HEADER] = detectedType;
      }
    }
    return {
      body: req.serializeBody(),
      method: req.method,
      headers,
      credentials,
      keepalive: req.keepalive,
      cache: req.cache,
      priority: req.priority,
      mode: req.mode,
      redirect: req.redirect
    };
  }
  concatChunks(chunks, totalLength) {
    const chunksAll = new Uint8Array(totalLength);
    let position = 0;
    for (const chunk of chunks) {
      chunksAll.set(chunk, position);
      position += chunk.length;
    }
    return chunksAll;
  }
  static \u0275fac = function FetchBackend_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _FetchBackend)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _FetchBackend,
    factory: _FetchBackend.\u0275fac
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(FetchBackend, [{
    type: Injectable
  }], () => [], null);
})();
var FetchFactory = class {
};
function noop3() {
}
function warningOptionsMessage(req) {
  if (req.credentials && req.withCredentials) {
    console.warn(formatRuntimeError(2819, `Angular detected that a \`HttpClient\` request has both \`withCredentials: true\` and \`credentials: '${req.credentials}'\` options. The \`withCredentials\` option is overriding the explicit \`credentials\` setting to 'include'. Consider removing \`withCredentials\` and using \`credentials: '${req.credentials}'\` directly for clarity.`));
  }
}
function silenceSuperfluousUnhandledPromiseRejection(promise) {
  promise.then(noop3, noop3);
}
function interceptorChainEndFn(req, finalHandlerFn) {
  return finalHandlerFn(req);
}
function adaptLegacyInterceptorToChain(chainTailFn, interceptor) {
  return (initialRequest, finalHandlerFn) => interceptor.intercept(initialRequest, {
    handle: (downstreamRequest) => chainTailFn(downstreamRequest, finalHandlerFn)
  });
}
function chainedInterceptorFn(chainTailFn, interceptorFn, injector) {
  return (initialRequest, finalHandlerFn) => runInInjectionContext(injector, () => interceptorFn(initialRequest, (downstreamRequest) => chainTailFn(downstreamRequest, finalHandlerFn)));
}
var HTTP_INTERCEPTORS = new InjectionToken(ngDevMode ? "HTTP_INTERCEPTORS" : "");
var HTTP_INTERCEPTOR_FNS = new InjectionToken(ngDevMode ? "HTTP_INTERCEPTOR_FNS" : "");
var HTTP_ROOT_INTERCEPTOR_FNS = new InjectionToken(ngDevMode ? "HTTP_ROOT_INTERCEPTOR_FNS" : "");
var REQUESTS_CONTRIBUTE_TO_STABILITY = new InjectionToken(ngDevMode ? "REQUESTS_CONTRIBUTE_TO_STABILITY" : "", {
  providedIn: "root",
  factory: () => true
});
function legacyInterceptorFnFactory() {
  let chain = null;
  return (req, handler) => {
    if (chain === null) {
      const interceptors = inject2(HTTP_INTERCEPTORS, {
        optional: true
      }) ?? [];
      chain = interceptors.reduceRight(adaptLegacyInterceptorToChain, interceptorChainEndFn);
    }
    const pendingTasks = inject2(PendingTasks);
    const contributeToStability = inject2(REQUESTS_CONTRIBUTE_TO_STABILITY);
    if (contributeToStability) {
      const removeTask = pendingTasks.add();
      return chain(req, handler).pipe(finalize(removeTask));
    } else {
      return chain(req, handler);
    }
  };
}
var fetchBackendWarningDisplayed = false;
var HttpInterceptorHandler = class _HttpInterceptorHandler extends HttpHandler {
  backend;
  injector;
  chain = null;
  pendingTasks = inject2(PendingTasks);
  contributeToStability = inject2(REQUESTS_CONTRIBUTE_TO_STABILITY);
  constructor(backend, injector) {
    super();
    this.backend = backend;
    this.injector = injector;
    if ((typeof ngDevMode === "undefined" || ngDevMode) && !fetchBackendWarningDisplayed) {
      const isTestingBackend = this.backend.isTestingBackend;
      if (false) {
        fetchBackendWarningDisplayed = true;
        injector.get(Console).warn(formatRuntimeError(2801, "Angular detected that `HttpClient` is not configured to use `fetch` APIs. It's strongly recommended to enable `fetch` for applications that use Server-Side Rendering for better performance and compatibility. To enable `fetch`, add the `withFetch()` to the `provideHttpClient()` call at the root of the application."));
      }
    }
  }
  handle(initialRequest) {
    if (this.chain === null) {
      const dedupedInterceptorFns = Array.from(/* @__PURE__ */ new Set([...this.injector.get(HTTP_INTERCEPTOR_FNS), ...this.injector.get(HTTP_ROOT_INTERCEPTOR_FNS, [])]));
      this.chain = dedupedInterceptorFns.reduceRight((nextSequencedFn, interceptorFn) => chainedInterceptorFn(nextSequencedFn, interceptorFn, this.injector), interceptorChainEndFn);
    }
    if (this.contributeToStability) {
      const removeTask = this.pendingTasks.add();
      return this.chain(initialRequest, (downstreamRequest) => this.backend.handle(downstreamRequest)).pipe(finalize(removeTask));
    } else {
      return this.chain(initialRequest, (downstreamRequest) => this.backend.handle(downstreamRequest));
    }
  }
  static \u0275fac = function HttpInterceptorHandler_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _HttpInterceptorHandler)(\u0275\u0275inject(HttpBackend), \u0275\u0275inject(EnvironmentInjector));
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _HttpInterceptorHandler,
    factory: _HttpInterceptorHandler.\u0275fac
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HttpInterceptorHandler, [{
    type: Injectable
  }], () => [{
    type: HttpBackend
  }, {
    type: EnvironmentInjector
  }], null);
})();
var nextRequestId = 0;
var foreignDocument;
var JSONP_ERR_NO_CALLBACK = "JSONP injected script did not invoke callback.";
var JSONP_ERR_WRONG_METHOD = "JSONP requests must use JSONP request method.";
var JSONP_ERR_WRONG_RESPONSE_TYPE = "JSONP requests must use Json response type.";
var JSONP_ERR_HEADERS_NOT_SUPPORTED = "JSONP requests do not support headers.";
var JsonpCallbackContext = class {
};
function jsonpCallbackContext() {
  if (typeof window === "object") {
    return window;
  }
  return {};
}
var JsonpClientBackend = class _JsonpClientBackend {
  callbackMap;
  document;
  /**
   * A resolved promise that can be used to schedule microtasks in the event handlers.
   */
  resolvedPromise = Promise.resolve();
  constructor(callbackMap, document2) {
    this.callbackMap = callbackMap;
    this.document = document2;
  }
  /**
   * Get the name of the next callback method, by incrementing the global `nextRequestId`.
   */
  nextCallback() {
    return `ng_jsonp_callback_${nextRequestId++}`;
  }
  /**
   * Processes a JSONP request and returns an event stream of the results.
   * @param req The request object.
   * @returns An observable of the response events.
   *
   */
  handle(req) {
    if (req.method !== "JSONP") {
      throw new RuntimeError(2810, ngDevMode && JSONP_ERR_WRONG_METHOD);
    } else if (req.responseType !== "json") {
      throw new RuntimeError(2811, ngDevMode && JSONP_ERR_WRONG_RESPONSE_TYPE);
    }
    if (req.headers.keys().length > 0) {
      throw new RuntimeError(2812, ngDevMode && JSONP_ERR_HEADERS_NOT_SUPPORTED);
    }
    return new Observable((observer) => {
      const callback = this.nextCallback();
      const url = req.urlWithParams.replace(/=JSONP_CALLBACK(&|$)/, `=${callback}$1`);
      const node = this.document.createElement("script");
      node.src = url;
      let body = null;
      let finished = false;
      this.callbackMap[callback] = (data) => {
        delete this.callbackMap[callback];
        body = data;
        finished = true;
      };
      const cleanup = () => {
        node.removeEventListener("load", onLoad);
        node.removeEventListener("error", onError);
        node.remove();
        delete this.callbackMap[callback];
      };
      const onLoad = () => {
        this.resolvedPromise.then(() => {
          cleanup();
          if (!finished) {
            observer.error(new HttpErrorResponse({
              url,
              status: 0,
              statusText: "JSONP Error",
              error: new Error(JSONP_ERR_NO_CALLBACK)
            }));
            return;
          }
          observer.next(new HttpResponse({
            body,
            status: HTTP_STATUS_CODE_OK,
            statusText: "OK",
            url
          }));
          observer.complete();
        });
      };
      const onError = (error) => {
        cleanup();
        observer.error(new HttpErrorResponse({
          error,
          status: 0,
          statusText: "JSONP Error",
          url
        }));
      };
      node.addEventListener("load", onLoad);
      node.addEventListener("error", onError);
      this.document.body.appendChild(node);
      observer.next({
        type: HttpEventType.Sent
      });
      return () => {
        if (!finished) {
          this.removeListeners(node);
        }
        cleanup();
      };
    });
  }
  removeListeners(script) {
    foreignDocument ??= this.document.implementation.createHTMLDocument();
    foreignDocument.adoptNode(script);
  }
  static \u0275fac = function JsonpClientBackend_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _JsonpClientBackend)(\u0275\u0275inject(JsonpCallbackContext), \u0275\u0275inject(DOCUMENT));
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _JsonpClientBackend,
    factory: _JsonpClientBackend.\u0275fac
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(JsonpClientBackend, [{
    type: Injectable
  }], () => [{
    type: JsonpCallbackContext
  }, {
    type: void 0,
    decorators: [{
      type: Inject,
      args: [DOCUMENT]
    }]
  }], null);
})();
function jsonpInterceptorFn(req, next) {
  if (req.method === "JSONP") {
    return inject2(JsonpClientBackend).handle(req);
  }
  return next(req);
}
var JsonpInterceptor = class _JsonpInterceptor {
  injector;
  constructor(injector) {
    this.injector = injector;
  }
  /**
   * Identifies and handles a given JSONP request.
   * @param initialRequest The outgoing request object to handle.
   * @param next The next interceptor in the chain, or the backend
   * if no interceptors remain in the chain.
   * @returns An observable of the event stream.
   */
  intercept(initialRequest, next) {
    return runInInjectionContext(this.injector, () => jsonpInterceptorFn(initialRequest, (downstreamRequest) => next.handle(downstreamRequest)));
  }
  static \u0275fac = function JsonpInterceptor_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _JsonpInterceptor)(\u0275\u0275inject(EnvironmentInjector));
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _JsonpInterceptor,
    factory: _JsonpInterceptor.\u0275fac
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(JsonpInterceptor, [{
    type: Injectable
  }], () => [{
    type: EnvironmentInjector
  }], null);
})();
var XSSI_PREFIX = /^\)\]\}',?\n/;
var X_REQUEST_URL_REGEXP = RegExp(`^${X_REQUEST_URL_HEADER}:`, "m");
function getResponseUrl(xhr) {
  if ("responseURL" in xhr && xhr.responseURL) {
    return xhr.responseURL;
  }
  if (X_REQUEST_URL_REGEXP.test(xhr.getAllResponseHeaders())) {
    return xhr.getResponseHeader(X_REQUEST_URL_HEADER);
  }
  return null;
}
function validateXhrCompatibility(req) {
  const unsupportedOptions = [{
    property: "keepalive",
    errorCode: 2813
    /* RuntimeErrorCode.KEEPALIVE_NOT_SUPPORTED_WITH_XHR */
  }, {
    property: "cache",
    errorCode: 2814
    /* RuntimeErrorCode.CACHE_NOT_SUPPORTED_WITH_XHR */
  }, {
    property: "priority",
    errorCode: 2815
    /* RuntimeErrorCode.PRIORITY_NOT_SUPPORTED_WITH_XHR */
  }, {
    property: "mode",
    errorCode: 2816
    /* RuntimeErrorCode.MODE_NOT_SUPPORTED_WITH_XHR */
  }, {
    property: "redirect",
    errorCode: 2817
    /* RuntimeErrorCode.REDIRECT_NOT_SUPPORTED_WITH_XHR */
  }, {
    property: "credentials",
    errorCode: 2818
    /* RuntimeErrorCode.CREDENTIALS_NOT_SUPPORTED_WITH_XHR */
  }];
  for (const {
    property,
    errorCode
  } of unsupportedOptions) {
    if (req[property]) {
      console.warn(formatRuntimeError(errorCode, `Angular detected that a \`HttpClient\` request with the \`${property}\` option was sent using XHR, which does not support it. To use the \`${property}\` option, enable Fetch API support by passing \`withFetch()\` as an argument to \`provideHttpClient()\`.`));
    }
  }
}
var HttpXhrBackend = class _HttpXhrBackend {
  xhrFactory;
  constructor(xhrFactory) {
    this.xhrFactory = xhrFactory;
  }
  /**
   * Processes a request and returns a stream of response events.
   * @param req The request object.
   * @returns An observable of the response events.
   */
  handle(req) {
    if (req.method === "JSONP") {
      throw new RuntimeError(-2800, (typeof ngDevMode === "undefined" || ngDevMode) && `Cannot make a JSONP request without JSONP support. To fix the problem, either add the \`withJsonpSupport()\` call (if \`provideHttpClient()\` is used) or import the \`HttpClientJsonpModule\` in the root NgModule.`);
    }
    ngDevMode && validateXhrCompatibility(req);
    const xhrFactory = this.xhrFactory;
    const source = (
      // Note that `ɵloadImpl` is never defined in client bundles and can be
      // safely dropped whenever we're running in the browser.
      // This branching is redundant.
      // The `ngServerMode` guard also enables tree-shaking of the `from()`
      // function from the common bundle, as it's only used in server code.
      false ? from(xhrFactory.\u0275loadImpl()) : of(null)
    );
    return source.pipe(switchMap(() => {
      return new Observable((observer) => {
        const xhr = xhrFactory.build();
        xhr.open(req.method, req.urlWithParams);
        if (req.withCredentials) {
          xhr.withCredentials = true;
        }
        req.headers.forEach((name2, values) => xhr.setRequestHeader(name2, values.join(",")));
        if (!req.headers.has(ACCEPT_HEADER)) {
          xhr.setRequestHeader(ACCEPT_HEADER, ACCEPT_HEADER_VALUE);
        }
        if (!req.headers.has(CONTENT_TYPE_HEADER)) {
          const detectedType = req.detectContentTypeHeader();
          if (detectedType !== null) {
            xhr.setRequestHeader(CONTENT_TYPE_HEADER, detectedType);
          }
        }
        if (req.timeout) {
          xhr.timeout = req.timeout;
        }
        if (req.responseType) {
          const responseType = req.responseType.toLowerCase();
          xhr.responseType = responseType !== "json" ? responseType : "text";
        }
        const reqBody = req.serializeBody();
        let headerResponse = null;
        const partialFromXhr = () => {
          if (headerResponse !== null) {
            return headerResponse;
          }
          const statusText = xhr.statusText || "OK";
          const headers = new HttpHeaders(xhr.getAllResponseHeaders());
          const url = getResponseUrl(xhr) || req.url;
          headerResponse = new HttpHeaderResponse({
            headers,
            status: xhr.status,
            statusText,
            url
          });
          return headerResponse;
        };
        const onLoad = () => {
          let {
            headers,
            status,
            statusText,
            url
          } = partialFromXhr();
          let body = null;
          if (status !== HTTP_STATUS_CODE_NO_CONTENT) {
            body = typeof xhr.response === "undefined" ? xhr.responseText : xhr.response;
          }
          if (status === 0) {
            status = !!body ? HTTP_STATUS_CODE_OK : 0;
          }
          let ok = status >= 200 && status < 300;
          if (req.responseType === "json" && typeof body === "string") {
            const originalBody = body;
            body = body.replace(XSSI_PREFIX, "");
            try {
              body = body !== "" ? JSON.parse(body) : null;
            } catch (error) {
              body = originalBody;
              if (ok) {
                ok = false;
                body = {
                  error,
                  text: body
                };
              }
            }
          }
          if (ok) {
            observer.next(new HttpResponse({
              body,
              headers,
              status,
              statusText,
              url: url || void 0
            }));
            observer.complete();
          } else {
            observer.error(new HttpErrorResponse({
              // The error in this case is the response body (error from the server).
              error: body,
              headers,
              status,
              statusText,
              url: url || void 0
            }));
          }
        };
        const onError = (error) => {
          const {
            url
          } = partialFromXhr();
          const res = new HttpErrorResponse({
            error,
            status: xhr.status || 0,
            statusText: xhr.statusText || "Unknown Error",
            url: url || void 0
          });
          observer.error(res);
        };
        let onTimeout = onError;
        if (req.timeout) {
          onTimeout = (_4) => {
            const {
              url
            } = partialFromXhr();
            const res = new HttpErrorResponse({
              error: new DOMException("Request timed out", "TimeoutError"),
              status: xhr.status || 0,
              statusText: xhr.statusText || "Request timeout",
              url: url || void 0
            });
            observer.error(res);
          };
        }
        let sentHeaders = false;
        const onDownProgress = (event) => {
          if (!sentHeaders) {
            observer.next(partialFromXhr());
            sentHeaders = true;
          }
          let progressEvent = {
            type: HttpEventType.DownloadProgress,
            loaded: event.loaded
          };
          if (event.lengthComputable) {
            progressEvent.total = event.total;
          }
          if (req.responseType === "text" && !!xhr.responseText) {
            progressEvent.partialText = xhr.responseText;
          }
          observer.next(progressEvent);
        };
        const onUpProgress = (event) => {
          let progress = {
            type: HttpEventType.UploadProgress,
            loaded: event.loaded
          };
          if (event.lengthComputable) {
            progress.total = event.total;
          }
          observer.next(progress);
        };
        xhr.addEventListener("load", onLoad);
        xhr.addEventListener("error", onError);
        xhr.addEventListener("timeout", onTimeout);
        xhr.addEventListener("abort", onError);
        if (req.reportProgress) {
          xhr.addEventListener("progress", onDownProgress);
          if (reqBody !== null && xhr.upload) {
            xhr.upload.addEventListener("progress", onUpProgress);
          }
        }
        xhr.send(reqBody);
        observer.next({
          type: HttpEventType.Sent
        });
        return () => {
          xhr.removeEventListener("error", onError);
          xhr.removeEventListener("abort", onError);
          xhr.removeEventListener("load", onLoad);
          xhr.removeEventListener("timeout", onTimeout);
          if (req.reportProgress) {
            xhr.removeEventListener("progress", onDownProgress);
            if (reqBody !== null && xhr.upload) {
              xhr.upload.removeEventListener("progress", onUpProgress);
            }
          }
          if (xhr.readyState !== xhr.DONE) {
            xhr.abort();
          }
        };
      });
    }));
  }
  static \u0275fac = function HttpXhrBackend_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _HttpXhrBackend)(\u0275\u0275inject(XhrFactory));
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _HttpXhrBackend,
    factory: _HttpXhrBackend.\u0275fac
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HttpXhrBackend, [{
    type: Injectable
  }], () => [{
    type: XhrFactory
  }], null);
})();
var XSRF_ENABLED = new InjectionToken(ngDevMode ? "XSRF_ENABLED" : "");
var XSRF_DEFAULT_COOKIE_NAME = "XSRF-TOKEN";
var XSRF_COOKIE_NAME = new InjectionToken(ngDevMode ? "XSRF_COOKIE_NAME" : "", {
  providedIn: "root",
  factory: () => XSRF_DEFAULT_COOKIE_NAME
});
var XSRF_DEFAULT_HEADER_NAME = "X-XSRF-TOKEN";
var XSRF_HEADER_NAME = new InjectionToken(ngDevMode ? "XSRF_HEADER_NAME" : "", {
  providedIn: "root",
  factory: () => XSRF_DEFAULT_HEADER_NAME
});
var HttpXsrfTokenExtractor = class {
};
var HttpXsrfCookieExtractor = class _HttpXsrfCookieExtractor {
  doc;
  cookieName;
  lastCookieString = "";
  lastToken = null;
  /**
   * @internal for testing
   */
  parseCount = 0;
  constructor(doc, cookieName) {
    this.doc = doc;
    this.cookieName = cookieName;
  }
  getToken() {
    if (false) {
      return null;
    }
    const cookieString = this.doc.cookie || "";
    if (cookieString !== this.lastCookieString) {
      this.parseCount++;
      this.lastToken = parseCookieValue(cookieString, this.cookieName);
      this.lastCookieString = cookieString;
    }
    return this.lastToken;
  }
  static \u0275fac = function HttpXsrfCookieExtractor_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _HttpXsrfCookieExtractor)(\u0275\u0275inject(DOCUMENT), \u0275\u0275inject(XSRF_COOKIE_NAME));
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _HttpXsrfCookieExtractor,
    factory: _HttpXsrfCookieExtractor.\u0275fac
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HttpXsrfCookieExtractor, [{
    type: Injectable
  }], () => [{
    type: void 0,
    decorators: [{
      type: Inject,
      args: [DOCUMENT]
    }]
  }, {
    type: void 0,
    decorators: [{
      type: Inject,
      args: [XSRF_COOKIE_NAME]
    }]
  }], null);
})();
function xsrfInterceptorFn(req, next) {
  const lcUrl = req.url.toLowerCase();
  if (!inject2(XSRF_ENABLED) || req.method === "GET" || req.method === "HEAD" || lcUrl.startsWith("http://") || lcUrl.startsWith("https://")) {
    return next(req);
  }
  const token = inject2(HttpXsrfTokenExtractor).getToken();
  const headerName = inject2(XSRF_HEADER_NAME);
  if (token != null && !req.headers.has(headerName)) {
    req = req.clone({
      headers: req.headers.set(headerName, token)
    });
  }
  return next(req);
}
var HttpXsrfInterceptor = class _HttpXsrfInterceptor {
  injector;
  constructor(injector) {
    this.injector = injector;
  }
  intercept(initialRequest, next) {
    return runInInjectionContext(this.injector, () => xsrfInterceptorFn(initialRequest, (downstreamRequest) => next.handle(downstreamRequest)));
  }
  static \u0275fac = function HttpXsrfInterceptor_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _HttpXsrfInterceptor)(\u0275\u0275inject(EnvironmentInjector));
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _HttpXsrfInterceptor,
    factory: _HttpXsrfInterceptor.\u0275fac
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HttpXsrfInterceptor, [{
    type: Injectable
  }], () => [{
    type: EnvironmentInjector
  }], null);
})();
var HttpFeatureKind;
(function(HttpFeatureKind2) {
  HttpFeatureKind2[HttpFeatureKind2["Interceptors"] = 0] = "Interceptors";
  HttpFeatureKind2[HttpFeatureKind2["LegacyInterceptors"] = 1] = "LegacyInterceptors";
  HttpFeatureKind2[HttpFeatureKind2["CustomXsrfConfiguration"] = 2] = "CustomXsrfConfiguration";
  HttpFeatureKind2[HttpFeatureKind2["NoXsrfProtection"] = 3] = "NoXsrfProtection";
  HttpFeatureKind2[HttpFeatureKind2["JsonpSupport"] = 4] = "JsonpSupport";
  HttpFeatureKind2[HttpFeatureKind2["RequestsMadeViaParent"] = 5] = "RequestsMadeViaParent";
  HttpFeatureKind2[HttpFeatureKind2["Fetch"] = 6] = "Fetch";
})(HttpFeatureKind || (HttpFeatureKind = {}));
function makeHttpFeature(kind, providers) {
  return {
    \u0275kind: kind,
    \u0275providers: providers
  };
}
function provideHttpClient(...features) {
  if (ngDevMode) {
    const featureKinds = new Set(features.map((f) => f.\u0275kind));
    if (featureKinds.has(HttpFeatureKind.NoXsrfProtection) && featureKinds.has(HttpFeatureKind.CustomXsrfConfiguration)) {
      throw new Error(ngDevMode ? `Configuration error: found both withXsrfConfiguration() and withNoXsrfProtection() in the same call to provideHttpClient(), which is a contradiction.` : "");
    }
  }
  const providers = [HttpClient, HttpXhrBackend, HttpInterceptorHandler, {
    provide: HttpHandler,
    useExisting: HttpInterceptorHandler
  }, {
    provide: HttpBackend,
    useFactory: () => {
      return inject2(FETCH_BACKEND, {
        optional: true
      }) ?? inject2(HttpXhrBackend);
    }
  }, {
    provide: HTTP_INTERCEPTOR_FNS,
    useValue: xsrfInterceptorFn,
    multi: true
  }, {
    provide: XSRF_ENABLED,
    useValue: true
  }, {
    provide: HttpXsrfTokenExtractor,
    useClass: HttpXsrfCookieExtractor
  }];
  for (const feature of features) {
    providers.push(...feature.\u0275providers);
  }
  return makeEnvironmentProviders(providers);
}
var LEGACY_INTERCEPTOR_FN = new InjectionToken(ngDevMode ? "LEGACY_INTERCEPTOR_FN" : "");
function withInterceptorsFromDi() {
  return makeHttpFeature(HttpFeatureKind.LegacyInterceptors, [{
    provide: LEGACY_INTERCEPTOR_FN,
    useFactory: legacyInterceptorFnFactory
  }, {
    provide: HTTP_INTERCEPTOR_FNS,
    useExisting: LEGACY_INTERCEPTOR_FN,
    multi: true
  }]);
}
function withXsrfConfiguration({
  cookieName,
  headerName
}) {
  const providers = [];
  if (cookieName !== void 0) {
    providers.push({
      provide: XSRF_COOKIE_NAME,
      useValue: cookieName
    });
  }
  if (headerName !== void 0) {
    providers.push({
      provide: XSRF_HEADER_NAME,
      useValue: headerName
    });
  }
  return makeHttpFeature(HttpFeatureKind.CustomXsrfConfiguration, providers);
}
function withNoXsrfProtection() {
  return makeHttpFeature(HttpFeatureKind.NoXsrfProtection, [{
    provide: XSRF_ENABLED,
    useValue: false
  }]);
}
function withJsonpSupport() {
  return makeHttpFeature(HttpFeatureKind.JsonpSupport, [JsonpClientBackend, {
    provide: JsonpCallbackContext,
    useFactory: jsonpCallbackContext
  }, {
    provide: HTTP_INTERCEPTOR_FNS,
    useValue: jsonpInterceptorFn,
    multi: true
  }]);
}
var HttpClientXsrfModule = class _HttpClientXsrfModule {
  /**
   * Disable the default XSRF protection.
   */
  static disable() {
    return {
      ngModule: _HttpClientXsrfModule,
      providers: [withNoXsrfProtection().\u0275providers]
    };
  }
  /**
   * Configure XSRF protection.
   * @param options An object that can specify either or both
   * cookie name or header name.
   * - Cookie name default is `XSRF-TOKEN`.
   * - Header name default is `X-XSRF-TOKEN`.
   *
   */
  static withOptions(options = {}) {
    return {
      ngModule: _HttpClientXsrfModule,
      providers: withXsrfConfiguration(options).\u0275providers
    };
  }
  static \u0275fac = function HttpClientXsrfModule_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _HttpClientXsrfModule)();
  };
  static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
    type: _HttpClientXsrfModule
  });
  static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({
    providers: [HttpXsrfInterceptor, {
      provide: HTTP_INTERCEPTORS,
      useExisting: HttpXsrfInterceptor,
      multi: true
    }, {
      provide: HttpXsrfTokenExtractor,
      useClass: HttpXsrfCookieExtractor
    }, withXsrfConfiguration({
      cookieName: XSRF_DEFAULT_COOKIE_NAME,
      headerName: XSRF_DEFAULT_HEADER_NAME
    }).\u0275providers, {
      provide: XSRF_ENABLED,
      useValue: true
    }]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HttpClientXsrfModule, [{
    type: NgModule,
    args: [{
      providers: [HttpXsrfInterceptor, {
        provide: HTTP_INTERCEPTORS,
        useExisting: HttpXsrfInterceptor,
        multi: true
      }, {
        provide: HttpXsrfTokenExtractor,
        useClass: HttpXsrfCookieExtractor
      }, withXsrfConfiguration({
        cookieName: XSRF_DEFAULT_COOKIE_NAME,
        headerName: XSRF_DEFAULT_HEADER_NAME
      }).\u0275providers, {
        provide: XSRF_ENABLED,
        useValue: true
      }]
    }]
  }], null, null);
})();
var HttpClientModule = class _HttpClientModule {
  static \u0275fac = function HttpClientModule_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _HttpClientModule)();
  };
  static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
    type: _HttpClientModule
  });
  static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({
    providers: [provideHttpClient(withInterceptorsFromDi())]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HttpClientModule, [{
    type: NgModule,
    args: [{
      /**
       * Configures the dependency injector where it is imported
       * with supporting services for HTTP communications.
       */
      providers: [provideHttpClient(withInterceptorsFromDi())]
    }]
  }], null, null);
})();
var HttpClientJsonpModule = class _HttpClientJsonpModule {
  static \u0275fac = function HttpClientJsonpModule_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _HttpClientJsonpModule)();
  };
  static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
    type: _HttpClientJsonpModule
  });
  static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({
    providers: [withJsonpSupport().\u0275providers]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HttpClientJsonpModule, [{
    type: NgModule,
    args: [{
      providers: [withJsonpSupport().\u0275providers]
    }]
  }], null, null);
})();

// node_modules/@angular/common/fesm2022/http.mjs
var httpResource = (() => {
  const jsonFn = makeHttpResourceFn("json");
  jsonFn.arrayBuffer = makeHttpResourceFn("arraybuffer");
  jsonFn.blob = makeHttpResourceFn("blob");
  jsonFn.text = makeHttpResourceFn("text");
  return jsonFn;
})();
function makeHttpResourceFn(responseType) {
  return function httpResource2(request, options) {
    if (ngDevMode && !options?.injector) {
      assertInInjectionContext(httpResource2);
    }
    const injector = options?.injector ?? inject2(Injector);
    return new HttpResourceImpl(injector, () => normalizeRequest(request, responseType), options?.defaultValue, options?.parse, options?.equal);
  };
}
function normalizeRequest(request, responseType) {
  let unwrappedRequest = typeof request === "function" ? request() : request;
  if (unwrappedRequest === void 0) {
    return void 0;
  } else if (typeof unwrappedRequest === "string") {
    unwrappedRequest = { url: unwrappedRequest };
  }
  const headers = unwrappedRequest.headers instanceof HttpHeaders ? unwrappedRequest.headers : new HttpHeaders(unwrappedRequest.headers);
  const params = unwrappedRequest.params instanceof HttpParams ? unwrappedRequest.params : new HttpParams({ fromObject: unwrappedRequest.params });
  return new HttpRequest(unwrappedRequest.method ?? "GET", unwrappedRequest.url, unwrappedRequest.body ?? null, {
    headers,
    params,
    reportProgress: unwrappedRequest.reportProgress,
    withCredentials: unwrappedRequest.withCredentials,
    keepalive: unwrappedRequest.keepalive,
    cache: unwrappedRequest.cache,
    priority: unwrappedRequest.priority,
    mode: unwrappedRequest.mode,
    redirect: unwrappedRequest.redirect,
    responseType,
    context: unwrappedRequest.context,
    transferCache: unwrappedRequest.transferCache,
    credentials: unwrappedRequest.credentials,
    timeout: unwrappedRequest.timeout
  });
}
var HttpResourceImpl = class extends ResourceImpl {
  client;
  _headers = linkedSignal({
    source: this.extRequest,
    computation: () => void 0
  });
  _progress = linkedSignal({
    source: this.extRequest,
    computation: () => void 0
  });
  _statusCode = linkedSignal({
    source: this.extRequest,
    computation: () => void 0
  });
  headers = computed(() => this.status() === "resolved" || this.status() === "error" ? this._headers() : void 0, ...ngDevMode ? [{ debugName: "headers" }] : []);
  progress = this._progress.asReadonly();
  statusCode = this._statusCode.asReadonly();
  constructor(injector, request, defaultValue, parse2, equal) {
    super(request, ({ params: request2, abortSignal }) => {
      let sub;
      const onAbort = () => sub.unsubscribe();
      abortSignal.addEventListener("abort", onAbort);
      const stream = signal({ value: void 0 }, ...ngDevMode ? [{ debugName: "stream" }] : []);
      let resolve;
      const promise = new Promise((r) => resolve = r);
      const send = (value) => {
        stream.set(value);
        resolve?.(stream);
        resolve = void 0;
      };
      sub = this.client.request(request2).subscribe({
        next: (event) => {
          switch (event.type) {
            case HttpEventType.Response:
              this._headers.set(event.headers);
              this._statusCode.set(event.status);
              try {
                send({ value: parse2 ? parse2(event.body) : event.body });
              } catch (error) {
                send({ error: encapsulateResourceError(error) });
              }
              break;
            case HttpEventType.DownloadProgress:
              this._progress.set(event);
              break;
          }
        },
        error: (error) => {
          if (error instanceof HttpErrorResponse) {
            this._headers.set(error.headers);
            this._statusCode.set(error.status);
          }
          send({ error });
          abortSignal.removeEventListener("abort", onAbort);
        },
        complete: () => {
          if (resolve) {
            send({
              error: new RuntimeError(991, ngDevMode && "Resource completed before producing a value")
            });
          }
          abortSignal.removeEventListener("abort", onAbort);
        }
      });
      return promise;
    }, defaultValue, equal, injector);
    this.client = injector.get(HttpClient);
  }
};
var HTTP_TRANSFER_CACHE_ORIGIN_MAP = new InjectionToken(ngDevMode ? "HTTP_TRANSFER_CACHE_ORIGIN_MAP" : "");
var CACHE_OPTIONS = new InjectionToken(ngDevMode ? "HTTP_TRANSFER_STATE_CACHE_OPTIONS" : "");

// node_modules/@angular/platform-browser/fesm2022/platform-browser.mjs
var Meta = class _Meta {
  _doc;
  _dom;
  constructor(_doc) {
    this._doc = _doc;
    this._dom = getDOM();
  }
  /**
   * Retrieves or creates a specific `<meta>` tag element in the current HTML document.
   * In searching for an existing tag, Angular attempts to match the `name` or `property` attribute
   * values in the provided tag definition, and verifies that all other attribute values are equal.
   * If an existing element is found, it is returned and is not modified in any way.
   * @param tag The definition of a `<meta>` element to match or create.
   * @param forceCreation True to create a new element without checking whether one already exists.
   * @returns The existing element with the same attributes and values if found,
   * the new element if no match is found, or `null` if the tag parameter is not defined.
   */
  addTag(tag, forceCreation = false) {
    if (!tag) return null;
    return this._getOrCreateElement(tag, forceCreation);
  }
  /**
   * Retrieves or creates a set of `<meta>` tag elements in the current HTML document.
   * In searching for an existing tag, Angular attempts to match the `name` or `property` attribute
   * values in the provided tag definition, and verifies that all other attribute values are equal.
   * @param tags An array of tag definitions to match or create.
   * @param forceCreation True to create new elements without checking whether they already exist.
   * @returns The matching elements if found, or the new elements.
   */
  addTags(tags, forceCreation = false) {
    if (!tags) return [];
    return tags.reduce((result, tag) => {
      if (tag) {
        result.push(this._getOrCreateElement(tag, forceCreation));
      }
      return result;
    }, []);
  }
  /**
   * Retrieves a `<meta>` tag element in the current HTML document.
   * @param attrSelector The tag attribute and value to match against, in the format
   * `"tag_attribute='value string'"`.
   * @returns The matching element, if any.
   */
  getTag(attrSelector) {
    if (!attrSelector) return null;
    return this._doc.querySelector(`meta[${attrSelector}]`) || null;
  }
  /**
   * Retrieves a set of `<meta>` tag elements in the current HTML document.
   * @param attrSelector The tag attribute and value to match against, in the format
   * `"tag_attribute='value string'"`.
   * @returns The matching elements, if any.
   */
  getTags(attrSelector) {
    if (!attrSelector) return [];
    const list = this._doc.querySelectorAll(`meta[${attrSelector}]`);
    return list ? [].slice.call(list) : [];
  }
  /**
   * Modifies an existing `<meta>` tag element in the current HTML document.
   * @param tag The tag description with which to replace the existing tag content.
   * @param selector A tag attribute and value to match against, to identify
   * an existing tag. A string in the format `"tag_attribute=`value string`"`.
   * If not supplied, matches a tag with the same `name` or `property` attribute value as the
   * replacement tag.
   * @return The modified element.
   */
  updateTag(tag, selector) {
    if (!tag) return null;
    selector = selector || this._parseSelector(tag);
    const meta = this.getTag(selector);
    if (meta) {
      return this._setMetaElementAttributes(tag, meta);
    }
    return this._getOrCreateElement(tag, true);
  }
  /**
   * Removes an existing `<meta>` tag element from the current HTML document.
   * @param attrSelector A tag attribute and value to match against, to identify
   * an existing tag. A string in the format `"tag_attribute=`value string`"`.
   */
  removeTag(attrSelector) {
    this.removeTagElement(this.getTag(attrSelector));
  }
  /**
   * Removes an existing `<meta>` tag element from the current HTML document.
   * @param meta The tag definition to match against to identify an existing tag.
   */
  removeTagElement(meta) {
    if (meta) {
      this._dom.remove(meta);
    }
  }
  _getOrCreateElement(meta, forceCreation = false) {
    if (!forceCreation) {
      const selector = this._parseSelector(meta);
      const elem = this.getTags(selector).filter((elem2) => this._containsAttributes(meta, elem2))[0];
      if (elem !== void 0) return elem;
    }
    const element = this._dom.createElement("meta");
    this._setMetaElementAttributes(meta, element);
    const head = this._doc.getElementsByTagName("head")[0];
    head.appendChild(element);
    return element;
  }
  _setMetaElementAttributes(tag, el) {
    Object.keys(tag).forEach((prop) => el.setAttribute(this._getMetaKeyMap(prop), tag[prop]));
    return el;
  }
  _parseSelector(tag) {
    const attr = tag.name ? "name" : "property";
    return `${attr}="${tag[attr]}"`;
  }
  _containsAttributes(tag, elem) {
    return Object.keys(tag).every((key) => elem.getAttribute(this._getMetaKeyMap(key)) === tag[key]);
  }
  _getMetaKeyMap(prop) {
    return META_KEYS_MAP[prop] || prop;
  }
  static \u0275fac = function Meta_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _Meta)(\u0275\u0275inject(DOCUMENT));
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _Meta,
    factory: _Meta.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(Meta, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], () => [{
    type: void 0,
    decorators: [{
      type: Inject,
      args: [DOCUMENT]
    }]
  }], null);
})();
var META_KEYS_MAP = {
  httpEquiv: "http-equiv"
};
var Title = class _Title {
  _doc;
  constructor(_doc) {
    this._doc = _doc;
  }
  /**
   * Get the title of the current HTML document.
   */
  getTitle() {
    return this._doc.title;
  }
  /**
   * Set the title of the current HTML document.
   * @param newTitle
   */
  setTitle(newTitle) {
    this._doc.title = newTitle || "";
  }
  static \u0275fac = function Title_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _Title)(\u0275\u0275inject(DOCUMENT));
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _Title,
    factory: _Title.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(Title, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], () => [{
    type: void 0,
    decorators: [{
      type: Inject,
      args: [DOCUMENT]
    }]
  }], null);
})();
var EVENT_NAMES = {
  // pan
  "pan": true,
  "panstart": true,
  "panmove": true,
  "panend": true,
  "pancancel": true,
  "panleft": true,
  "panright": true,
  "panup": true,
  "pandown": true,
  // pinch
  "pinch": true,
  "pinchstart": true,
  "pinchmove": true,
  "pinchend": true,
  "pinchcancel": true,
  "pinchin": true,
  "pinchout": true,
  // press
  "press": true,
  "pressup": true,
  // rotate
  "rotate": true,
  "rotatestart": true,
  "rotatemove": true,
  "rotateend": true,
  "rotatecancel": true,
  // swipe
  "swipe": true,
  "swipeleft": true,
  "swiperight": true,
  "swipeup": true,
  "swipedown": true,
  // tap
  "tap": true,
  "doubletap": true
};
var HAMMER_GESTURE_CONFIG = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "HammerGestureConfig" : "");
var HAMMER_LOADER = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "HammerLoader" : "");
var HammerGestureConfig = class _HammerGestureConfig {
  /**
   * A set of supported event names for gestures to be used in Angular.
   * Angular supports all built-in recognizers, as listed in
   * [HammerJS documentation](https://hammerjs.github.io/).
   */
  events = [];
  /**
   * Maps gesture event names to a set of configuration options
   * that specify overrides to the default values for specific properties.
   *
   * The key is a supported event name to be configured,
   * and the options object contains a set of properties, with override values
   * to be applied to the named recognizer event.
   * For example, to disable recognition of the rotate event, specify
   *  `{"rotate": {"enable": false}}`.
   *
   * Properties that are not present take the HammerJS default values.
   * For information about which properties are supported for which events,
   * and their allowed and default values, see
   * [HammerJS documentation](https://hammerjs.github.io/).
   *
   */
  overrides = {};
  /**
   * Properties whose default values can be overridden for a given event.
   * Different sets of properties apply to different events.
   * For information about which properties are supported for which events,
   * and their allowed and default values, see
   * [HammerJS documentation](https://hammerjs.github.io/).
   */
  options;
  /**
   * Creates a [HammerJS Manager](https://hammerjs.github.io/api/#hammermanager)
   * and attaches it to a given HTML element.
   * @param element The element that will recognize gestures.
   * @returns A HammerJS event-manager object.
   */
  buildHammer(element) {
    const mc = new Hammer(element, this.options);
    mc.get("pinch").set({
      enable: true
    });
    mc.get("rotate").set({
      enable: true
    });
    for (const eventName in this.overrides) {
      mc.get(eventName).set(this.overrides[eventName]);
    }
    return mc;
  }
  static \u0275fac = function HammerGestureConfig_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _HammerGestureConfig)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _HammerGestureConfig,
    factory: _HammerGestureConfig.\u0275fac
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HammerGestureConfig, [{
    type: Injectable
  }], null, null);
})();
var HammerGesturesPlugin = class _HammerGesturesPlugin extends EventManagerPlugin {
  _config;
  _injector;
  loader;
  _loaderPromise = null;
  constructor(doc, _config, _injector, loader) {
    super(doc);
    this._config = _config;
    this._injector = _injector;
    this.loader = loader;
  }
  supports(eventName) {
    if (!EVENT_NAMES.hasOwnProperty(eventName.toLowerCase()) && !this.isCustomEvent(eventName)) {
      return false;
    }
    if (!window.Hammer && !this.loader) {
      if (typeof ngDevMode === "undefined" || ngDevMode) {
        const _console = this._injector.get(Console);
        _console.warn(`The "${eventName}" event cannot be bound because Hammer.JS is not loaded and no custom loader has been specified.`);
      }
      return false;
    }
    return true;
  }
  addEventListener(element, eventName, handler) {
    const zone = this.manager.getZone();
    eventName = eventName.toLowerCase();
    if (!window.Hammer && this.loader) {
      this._loaderPromise = this._loaderPromise || zone.runOutsideAngular(() => this.loader());
      let cancelRegistration = false;
      let deregister = () => {
        cancelRegistration = true;
      };
      zone.runOutsideAngular(() => this._loaderPromise.then(() => {
        if (!window.Hammer) {
          if (typeof ngDevMode === "undefined" || ngDevMode) {
            const _console = this._injector.get(Console);
            _console.warn(`The custom HAMMER_LOADER completed, but Hammer.JS is not present.`);
          }
          deregister = () => {
          };
          return;
        }
        if (!cancelRegistration) {
          deregister = this.addEventListener(element, eventName, handler);
        }
      }).catch(() => {
        if (typeof ngDevMode === "undefined" || ngDevMode) {
          const _console = this._injector.get(Console);
          _console.warn(`The "${eventName}" event cannot be bound because the custom Hammer.JS loader failed.`);
        }
        deregister = () => {
        };
      }));
      return () => {
        deregister();
      };
    }
    return zone.runOutsideAngular(() => {
      const mc = this._config.buildHammer(element);
      const callback = function(eventObj) {
        zone.runGuarded(function() {
          handler(eventObj);
        });
      };
      mc.on(eventName, callback);
      return () => {
        mc.off(eventName, callback);
        if (typeof mc.destroy === "function") {
          mc.destroy();
        }
      };
    });
  }
  isCustomEvent(eventName) {
    return this._config.events.indexOf(eventName) > -1;
  }
  static \u0275fac = function HammerGesturesPlugin_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _HammerGesturesPlugin)(\u0275\u0275inject(DOCUMENT), \u0275\u0275inject(HAMMER_GESTURE_CONFIG), \u0275\u0275inject(Injector), \u0275\u0275inject(HAMMER_LOADER, 8));
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _HammerGesturesPlugin,
    factory: _HammerGesturesPlugin.\u0275fac
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HammerGesturesPlugin, [{
    type: Injectable
  }], () => [{
    type: void 0,
    decorators: [{
      type: Inject,
      args: [DOCUMENT]
    }]
  }, {
    type: HammerGestureConfig,
    decorators: [{
      type: Inject,
      args: [HAMMER_GESTURE_CONFIG]
    }]
  }, {
    type: Injector
  }, {
    type: void 0,
    decorators: [{
      type: Optional
    }, {
      type: Inject,
      args: [HAMMER_LOADER]
    }]
  }], null);
})();
var HammerModule = class _HammerModule {
  static \u0275fac = function HammerModule_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _HammerModule)();
  };
  static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
    type: _HammerModule
  });
  static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({
    providers: [{
      provide: EVENT_MANAGER_PLUGINS,
      useClass: HammerGesturesPlugin,
      multi: true,
      deps: [DOCUMENT, HAMMER_GESTURE_CONFIG, Injector, [new Optional(), HAMMER_LOADER]]
    }, {
      provide: HAMMER_GESTURE_CONFIG,
      useClass: HammerGestureConfig
    }]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HammerModule, [{
    type: NgModule,
    args: [{
      providers: [{
        provide: EVENT_MANAGER_PLUGINS,
        useClass: HammerGesturesPlugin,
        multi: true,
        deps: [DOCUMENT, HAMMER_GESTURE_CONFIG, Injector, [new Optional(), HAMMER_LOADER]]
      }, {
        provide: HAMMER_GESTURE_CONFIG,
        useClass: HammerGestureConfig
      }]
    }]
  }], null, null);
})();
var DomSanitizer = class _DomSanitizer {
  static \u0275fac = function DomSanitizer_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _DomSanitizer)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _DomSanitizer,
    factory: function DomSanitizer_Factory(__ngFactoryType__) {
      let __ngConditionalFactory__ = null;
      if (__ngFactoryType__) {
        __ngConditionalFactory__ = new (__ngFactoryType__ || _DomSanitizer)();
      } else {
        __ngConditionalFactory__ = \u0275\u0275inject(DomSanitizerImpl);
      }
      return __ngConditionalFactory__;
    },
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(DomSanitizer, [{
    type: Injectable,
    args: [{
      providedIn: "root",
      useExisting: forwardRef(() => DomSanitizerImpl)
    }]
  }], null, null);
})();
var DomSanitizerImpl = class _DomSanitizerImpl extends DomSanitizer {
  _doc;
  constructor(_doc) {
    super();
    this._doc = _doc;
  }
  sanitize(ctx, value) {
    if (value == null) return null;
    switch (ctx) {
      case SecurityContext.NONE:
        return value;
      case SecurityContext.HTML:
        if (allowSanitizationBypassAndThrow(
          value,
          "HTML"
          /* BypassType.Html */
        )) {
          return unwrapSafeValue(value);
        }
        return _sanitizeHtml(this._doc, String(value)).toString();
      case SecurityContext.STYLE:
        if (allowSanitizationBypassAndThrow(
          value,
          "Style"
          /* BypassType.Style */
        )) {
          return unwrapSafeValue(value);
        }
        return value;
      case SecurityContext.SCRIPT:
        if (allowSanitizationBypassAndThrow(
          value,
          "Script"
          /* BypassType.Script */
        )) {
          return unwrapSafeValue(value);
        }
        throw new RuntimeError(5200, (typeof ngDevMode === "undefined" || ngDevMode) && "unsafe value used in a script context");
      case SecurityContext.URL:
        if (allowSanitizationBypassAndThrow(
          value,
          "URL"
          /* BypassType.Url */
        )) {
          return unwrapSafeValue(value);
        }
        return _sanitizeUrl(String(value));
      case SecurityContext.RESOURCE_URL:
        if (allowSanitizationBypassAndThrow(
          value,
          "ResourceURL"
          /* BypassType.ResourceUrl */
        )) {
          return unwrapSafeValue(value);
        }
        throw new RuntimeError(5201, (typeof ngDevMode === "undefined" || ngDevMode) && `unsafe value used in a resource URL context (see ${XSS_SECURITY_URL})`);
      default:
        throw new RuntimeError(5202, (typeof ngDevMode === "undefined" || ngDevMode) && `Unexpected SecurityContext ${ctx} (see ${XSS_SECURITY_URL})`);
    }
  }
  bypassSecurityTrustHtml(value) {
    return bypassSanitizationTrustHtml(value);
  }
  bypassSecurityTrustStyle(value) {
    return bypassSanitizationTrustStyle(value);
  }
  bypassSecurityTrustScript(value) {
    return bypassSanitizationTrustScript(value);
  }
  bypassSecurityTrustUrl(value) {
    return bypassSanitizationTrustUrl(value);
  }
  bypassSecurityTrustResourceUrl(value) {
    return bypassSanitizationTrustResourceUrl(value);
  }
  static \u0275fac = function DomSanitizerImpl_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _DomSanitizerImpl)(\u0275\u0275inject(DOCUMENT));
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _DomSanitizerImpl,
    factory: _DomSanitizerImpl.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(DomSanitizerImpl, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], () => [{
    type: void 0,
    decorators: [{
      type: Inject,
      args: [DOCUMENT]
    }]
  }], null);
})();
var HydrationFeatureKind;
(function(HydrationFeatureKind2) {
  HydrationFeatureKind2[HydrationFeatureKind2["NoHttpTransferCache"] = 0] = "NoHttpTransferCache";
  HydrationFeatureKind2[HydrationFeatureKind2["HttpTransferCacheOptions"] = 1] = "HttpTransferCacheOptions";
  HydrationFeatureKind2[HydrationFeatureKind2["I18nSupport"] = 2] = "I18nSupport";
  HydrationFeatureKind2[HydrationFeatureKind2["EventReplay"] = 3] = "EventReplay";
  HydrationFeatureKind2[HydrationFeatureKind2["IncrementalHydration"] = 4] = "IncrementalHydration";
})(HydrationFeatureKind || (HydrationFeatureKind = {}));
var VERSION3 = new Version("20.1.3");

// node_modules/@angular/router/fesm2022/router2.mjs
var PRIMARY_OUTLET = "primary";
var RouteTitleKey = /* @__PURE__ */ Symbol("RouteTitle");
var ParamsAsMap = class {
  params;
  constructor(params) {
    this.params = params || {};
  }
  has(name2) {
    return Object.prototype.hasOwnProperty.call(this.params, name2);
  }
  get(name2) {
    if (this.has(name2)) {
      const v = this.params[name2];
      return Array.isArray(v) ? v[0] : v;
    }
    return null;
  }
  getAll(name2) {
    if (this.has(name2)) {
      const v = this.params[name2];
      return Array.isArray(v) ? v : [v];
    }
    return [];
  }
  get keys() {
    return Object.keys(this.params);
  }
};
function convertToParamMap(params) {
  return new ParamsAsMap(params);
}
function defaultUrlMatcher(segments, segmentGroup, route) {
  const parts = route.path.split("/");
  if (parts.length > segments.length) {
    return null;
  }
  if (route.pathMatch === "full" && (segmentGroup.hasChildren() || parts.length < segments.length)) {
    return null;
  }
  const posParams = {};
  for (let index = 0; index < parts.length; index++) {
    const part = parts[index];
    const segment = segments[index];
    const isParameter = part[0] === ":";
    if (isParameter) {
      posParams[part.substring(1)] = segment;
    } else if (part !== segment.path) {
      return null;
    }
  }
  return {
    consumed: segments.slice(0, parts.length),
    posParams
  };
}
function shallowEqualArrays(a, b) {
  if (a.length !== b.length) return false;
  for (let i = 0; i < a.length; ++i) {
    if (!shallowEqual(a[i], b[i])) return false;
  }
  return true;
}
function shallowEqual(a, b) {
  const k1 = a ? getDataKeys(a) : void 0;
  const k2 = b ? getDataKeys(b) : void 0;
  if (!k1 || !k2 || k1.length != k2.length) {
    return false;
  }
  let key;
  for (let i = 0; i < k1.length; i++) {
    key = k1[i];
    if (!equalArraysOrString(a[key], b[key])) {
      return false;
    }
  }
  return true;
}
function getDataKeys(obj) {
  return [...Object.keys(obj), ...Object.getOwnPropertySymbols(obj)];
}
function equalArraysOrString(a, b) {
  if (Array.isArray(a) && Array.isArray(b)) {
    if (a.length !== b.length) return false;
    const aSorted = [...a].sort();
    const bSorted = [...b].sort();
    return aSorted.every((val, index) => bSorted[index] === val);
  } else {
    return a === b;
  }
}
function last3(a) {
  return a.length > 0 ? a[a.length - 1] : null;
}
function wrapIntoObservable(value) {
  if (isObservable(value)) {
    return value;
  }
  if (isPromise2(value)) {
    return from(Promise.resolve(value));
  }
  return of(value);
}
var pathCompareMap = {
  "exact": equalSegmentGroups,
  "subset": containsSegmentGroup
};
var paramCompareMap = {
  "exact": equalParams,
  "subset": containsParams,
  "ignored": () => true
};
function containsTree(container, containee, options) {
  return pathCompareMap[options.paths](container.root, containee.root, options.matrixParams) && paramCompareMap[options.queryParams](container.queryParams, containee.queryParams) && !(options.fragment === "exact" && container.fragment !== containee.fragment);
}
function equalParams(container, containee) {
  return shallowEqual(container, containee);
}
function equalSegmentGroups(container, containee, matrixParams) {
  if (!equalPath(container.segments, containee.segments)) return false;
  if (!matrixParamsMatch(container.segments, containee.segments, matrixParams)) {
    return false;
  }
  if (container.numberOfChildren !== containee.numberOfChildren) return false;
  for (const c in containee.children) {
    if (!container.children[c]) return false;
    if (!equalSegmentGroups(container.children[c], containee.children[c], matrixParams)) return false;
  }
  return true;
}
function containsParams(container, containee) {
  return Object.keys(containee).length <= Object.keys(container).length && Object.keys(containee).every((key) => equalArraysOrString(container[key], containee[key]));
}
function containsSegmentGroup(container, containee, matrixParams) {
  return containsSegmentGroupHelper(container, containee, containee.segments, matrixParams);
}
function containsSegmentGroupHelper(container, containee, containeePaths, matrixParams) {
  if (container.segments.length > containeePaths.length) {
    const current = container.segments.slice(0, containeePaths.length);
    if (!equalPath(current, containeePaths)) return false;
    if (containee.hasChildren()) return false;
    if (!matrixParamsMatch(current, containeePaths, matrixParams)) return false;
    return true;
  } else if (container.segments.length === containeePaths.length) {
    if (!equalPath(container.segments, containeePaths)) return false;
    if (!matrixParamsMatch(container.segments, containeePaths, matrixParams)) return false;
    for (const c in containee.children) {
      if (!container.children[c]) return false;
      if (!containsSegmentGroup(container.children[c], containee.children[c], matrixParams)) {
        return false;
      }
    }
    return true;
  } else {
    const current = containeePaths.slice(0, container.segments.length);
    const next = containeePaths.slice(container.segments.length);
    if (!equalPath(container.segments, current)) return false;
    if (!matrixParamsMatch(container.segments, current, matrixParams)) return false;
    if (!container.children[PRIMARY_OUTLET]) return false;
    return containsSegmentGroupHelper(container.children[PRIMARY_OUTLET], containee, next, matrixParams);
  }
}
function matrixParamsMatch(containerPaths, containeePaths, options) {
  return containeePaths.every((containeeSegment, i) => {
    return paramCompareMap[options](containerPaths[i].parameters, containeeSegment.parameters);
  });
}
var UrlTree = class {
  root;
  queryParams;
  fragment;
  /** @internal */
  _queryParamMap;
  constructor(root = new UrlSegmentGroup([], {}), queryParams = {}, fragment = null) {
    this.root = root;
    this.queryParams = queryParams;
    this.fragment = fragment;
    if (typeof ngDevMode === "undefined" || ngDevMode) {
      if (root.segments.length > 0) {
        throw new RuntimeError(4015, "The root `UrlSegmentGroup` should not contain `segments`. Instead, these segments belong in the `children` so they can be associated with a named outlet.");
      }
    }
  }
  get queryParamMap() {
    this._queryParamMap ??= convertToParamMap(this.queryParams);
    return this._queryParamMap;
  }
  /** @docsNotRequired */
  toString() {
    return DEFAULT_SERIALIZER.serialize(this);
  }
};
var UrlSegmentGroup = class {
  segments;
  children;
  /** The parent node in the url tree */
  parent = null;
  constructor(segments, children) {
    this.segments = segments;
    this.children = children;
    Object.values(children).forEach((v) => v.parent = this);
  }
  /** Whether the segment has child segments */
  hasChildren() {
    return this.numberOfChildren > 0;
  }
  /** Number of child segments */
  get numberOfChildren() {
    return Object.keys(this.children).length;
  }
  /** @docsNotRequired */
  toString() {
    return serializePaths(this);
  }
};
var UrlSegment = class {
  path;
  parameters;
  /** @internal */
  _parameterMap;
  constructor(path, parameters) {
    this.path = path;
    this.parameters = parameters;
  }
  get parameterMap() {
    this._parameterMap ??= convertToParamMap(this.parameters);
    return this._parameterMap;
  }
  /** @docsNotRequired */
  toString() {
    return serializePath(this);
  }
};
function equalSegments(as, bs) {
  return equalPath(as, bs) && as.every((a, i) => shallowEqual(a.parameters, bs[i].parameters));
}
function equalPath(as, bs) {
  if (as.length !== bs.length) return false;
  return as.every((a, i) => a.path === bs[i].path);
}
function mapChildrenIntoArray(segment, fn) {
  let res = [];
  Object.entries(segment.children).forEach(([childOutlet, child]) => {
    if (childOutlet === PRIMARY_OUTLET) {
      res = res.concat(fn(child, childOutlet));
    }
  });
  Object.entries(segment.children).forEach(([childOutlet, child]) => {
    if (childOutlet !== PRIMARY_OUTLET) {
      res = res.concat(fn(child, childOutlet));
    }
  });
  return res;
}
var UrlSerializer = class _UrlSerializer {
  static \u0275fac = function UrlSerializer_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _UrlSerializer)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _UrlSerializer,
    factory: () => (() => new DefaultUrlSerializer())(),
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(UrlSerializer, [{
    type: Injectable,
    args: [{
      providedIn: "root",
      useFactory: () => new DefaultUrlSerializer()
    }]
  }], null, null);
})();
var DefaultUrlSerializer = class {
  /** Parses a url into a `UrlTree` */
  parse(url) {
    const p = new UrlParser(url);
    return new UrlTree(p.parseRootSegment(), p.parseQueryParams(), p.parseFragment());
  }
  /** Converts a `UrlTree` into a url */
  serialize(tree2) {
    const segment = `/${serializeSegment(tree2.root, true)}`;
    const query = serializeQueryParams(tree2.queryParams);
    const fragment = typeof tree2.fragment === `string` ? `#${encodeUriFragment(tree2.fragment)}` : "";
    return `${segment}${query}${fragment}`;
  }
};
var DEFAULT_SERIALIZER = new DefaultUrlSerializer();
function serializePaths(segment) {
  return segment.segments.map((p) => serializePath(p)).join("/");
}
function serializeSegment(segment, root) {
  if (!segment.hasChildren()) {
    return serializePaths(segment);
  }
  if (root) {
    const primary = segment.children[PRIMARY_OUTLET] ? serializeSegment(segment.children[PRIMARY_OUTLET], false) : "";
    const children = [];
    Object.entries(segment.children).forEach(([k, v]) => {
      if (k !== PRIMARY_OUTLET) {
        children.push(`${k}:${serializeSegment(v, false)}`);
      }
    });
    return children.length > 0 ? `${primary}(${children.join("//")})` : primary;
  } else {
    const children = mapChildrenIntoArray(segment, (v, k) => {
      if (k === PRIMARY_OUTLET) {
        return [serializeSegment(segment.children[PRIMARY_OUTLET], false)];
      }
      return [`${k}:${serializeSegment(v, false)}`];
    });
    if (Object.keys(segment.children).length === 1 && segment.children[PRIMARY_OUTLET] != null) {
      return `${serializePaths(segment)}/${children[0]}`;
    }
    return `${serializePaths(segment)}/(${children.join("//")})`;
  }
}
function encodeUriString(s) {
  return encodeURIComponent(s).replace(/%40/g, "@").replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",");
}
function encodeUriQuery(s) {
  return encodeUriString(s).replace(/%3B/gi, ";");
}
function encodeUriFragment(s) {
  return encodeURI(s);
}
function encodeUriSegment(s) {
  return encodeUriString(s).replace(/\(/g, "%28").replace(/\)/g, "%29").replace(/%26/gi, "&");
}
function decode(s) {
  return decodeURIComponent(s);
}
function decodeQuery(s) {
  return decode(s.replace(/\+/g, "%20"));
}
function serializePath(path) {
  return `${encodeUriSegment(path.path)}${serializeMatrixParams(path.parameters)}`;
}
function serializeMatrixParams(params) {
  return Object.entries(params).map(([key, value]) => `;${encodeUriSegment(key)}=${encodeUriSegment(value)}`).join("");
}
function serializeQueryParams(params) {
  const strParams = Object.entries(params).map(([name2, value]) => {
    return Array.isArray(value) ? value.map((v) => `${encodeUriQuery(name2)}=${encodeUriQuery(v)}`).join("&") : `${encodeUriQuery(name2)}=${encodeUriQuery(value)}`;
  }).filter((s) => s);
  return strParams.length ? `?${strParams.join("&")}` : "";
}
var SEGMENT_RE = /^[^\/()?;#]+/;
function matchSegments(str) {
  const match2 = str.match(SEGMENT_RE);
  return match2 ? match2[0] : "";
}
var MATRIX_PARAM_SEGMENT_RE = /^[^\/()?;=#]+/;
function matchMatrixKeySegments(str) {
  const match2 = str.match(MATRIX_PARAM_SEGMENT_RE);
  return match2 ? match2[0] : "";
}
var QUERY_PARAM_RE = /^[^=?&#]+/;
function matchQueryParams(str) {
  const match2 = str.match(QUERY_PARAM_RE);
  return match2 ? match2[0] : "";
}
var QUERY_PARAM_VALUE_RE = /^[^&#]+/;
function matchUrlQueryParamValue(str) {
  const match2 = str.match(QUERY_PARAM_VALUE_RE);
  return match2 ? match2[0] : "";
}
var UrlParser = class {
  url;
  remaining;
  constructor(url) {
    this.url = url;
    this.remaining = url;
  }
  parseRootSegment() {
    this.consumeOptional("/");
    if (this.remaining === "" || this.peekStartsWith("?") || this.peekStartsWith("#")) {
      return new UrlSegmentGroup([], {});
    }
    return new UrlSegmentGroup([], this.parseChildren());
  }
  parseQueryParams() {
    const params = {};
    if (this.consumeOptional("?")) {
      do {
        this.parseQueryParam(params);
      } while (this.consumeOptional("&"));
    }
    return params;
  }
  parseFragment() {
    return this.consumeOptional("#") ? decodeURIComponent(this.remaining) : null;
  }
  parseChildren() {
    if (this.remaining === "") {
      return {};
    }
    this.consumeOptional("/");
    const segments = [];
    if (!this.peekStartsWith("(")) {
      segments.push(this.parseSegment());
    }
    while (this.peekStartsWith("/") && !this.peekStartsWith("//") && !this.peekStartsWith("/(")) {
      this.capture("/");
      segments.push(this.parseSegment());
    }
    let children = {};
    if (this.peekStartsWith("/(")) {
      this.capture("/");
      children = this.parseParens(true);
    }
    let res = {};
    if (this.peekStartsWith("(")) {
      res = this.parseParens(false);
    }
    if (segments.length > 0 || Object.keys(children).length > 0) {
      res[PRIMARY_OUTLET] = new UrlSegmentGroup(segments, children);
    }
    return res;
  }
  // parse a segment with its matrix parameters
  // ie `name;k1=v1;k2`
  parseSegment() {
    const path = matchSegments(this.remaining);
    if (path === "" && this.peekStartsWith(";")) {
      throw new RuntimeError(4009, (typeof ngDevMode === "undefined" || ngDevMode) && `Empty path url segment cannot have parameters: '${this.remaining}'.`);
    }
    this.capture(path);
    return new UrlSegment(decode(path), this.parseMatrixParams());
  }
  parseMatrixParams() {
    const params = {};
    while (this.consumeOptional(";")) {
      this.parseParam(params);
    }
    return params;
  }
  parseParam(params) {
    const key = matchMatrixKeySegments(this.remaining);
    if (!key) {
      return;
    }
    this.capture(key);
    let value = "";
    if (this.consumeOptional("=")) {
      const valueMatch = matchSegments(this.remaining);
      if (valueMatch) {
        value = valueMatch;
        this.capture(value);
      }
    }
    params[decode(key)] = decode(value);
  }
  // Parse a single query parameter `name[=value]`
  parseQueryParam(params) {
    const key = matchQueryParams(this.remaining);
    if (!key) {
      return;
    }
    this.capture(key);
    let value = "";
    if (this.consumeOptional("=")) {
      const valueMatch = matchUrlQueryParamValue(this.remaining);
      if (valueMatch) {
        value = valueMatch;
        this.capture(value);
      }
    }
    const decodedKey = decodeQuery(key);
    const decodedVal = decodeQuery(value);
    if (params.hasOwnProperty(decodedKey)) {
      let currentVal = params[decodedKey];
      if (!Array.isArray(currentVal)) {
        currentVal = [currentVal];
        params[decodedKey] = currentVal;
      }
      currentVal.push(decodedVal);
    } else {
      params[decodedKey] = decodedVal;
    }
  }
  // parse `(a/b//outlet_name:c/d)`
  parseParens(allowPrimary) {
    const segments = {};
    this.capture("(");
    while (!this.consumeOptional(")") && this.remaining.length > 0) {
      const path = matchSegments(this.remaining);
      const next = this.remaining[path.length];
      if (next !== "/" && next !== ")" && next !== ";") {
        throw new RuntimeError(4010, (typeof ngDevMode === "undefined" || ngDevMode) && `Cannot parse url '${this.url}'`);
      }
      let outletName = void 0;
      if (path.indexOf(":") > -1) {
        outletName = path.slice(0, path.indexOf(":"));
        this.capture(outletName);
        this.capture(":");
      } else if (allowPrimary) {
        outletName = PRIMARY_OUTLET;
      }
      const children = this.parseChildren();
      segments[outletName] = Object.keys(children).length === 1 ? children[PRIMARY_OUTLET] : new UrlSegmentGroup([], children);
      this.consumeOptional("//");
    }
    return segments;
  }
  peekStartsWith(str) {
    return this.remaining.startsWith(str);
  }
  // Consumes the prefix when it is present and returns whether it has been consumed
  consumeOptional(str) {
    if (this.peekStartsWith(str)) {
      this.remaining = this.remaining.substring(str.length);
      return true;
    }
    return false;
  }
  capture(str) {
    if (!this.consumeOptional(str)) {
      throw new RuntimeError(4011, (typeof ngDevMode === "undefined" || ngDevMode) && `Expected "${str}".`);
    }
  }
};
function createRoot(rootCandidate) {
  return rootCandidate.segments.length > 0 ? new UrlSegmentGroup([], {
    [PRIMARY_OUTLET]: rootCandidate
  }) : rootCandidate;
}
function squashSegmentGroup(segmentGroup) {
  const newChildren = {};
  for (const [childOutlet, child] of Object.entries(segmentGroup.children)) {
    const childCandidate = squashSegmentGroup(child);
    if (childOutlet === PRIMARY_OUTLET && childCandidate.segments.length === 0 && childCandidate.hasChildren()) {
      for (const [grandChildOutlet, grandChild] of Object.entries(childCandidate.children)) {
        newChildren[grandChildOutlet] = grandChild;
      }
    } else if (childCandidate.segments.length > 0 || childCandidate.hasChildren()) {
      newChildren[childOutlet] = childCandidate;
    }
  }
  const s = new UrlSegmentGroup(segmentGroup.segments, newChildren);
  return mergeTrivialChildren(s);
}
function mergeTrivialChildren(s) {
  if (s.numberOfChildren === 1 && s.children[PRIMARY_OUTLET]) {
    const c = s.children[PRIMARY_OUTLET];
    return new UrlSegmentGroup(s.segments.concat(c.segments), c.children);
  }
  return s;
}
function isUrlTree(v) {
  return v instanceof UrlTree;
}
function createUrlTreeFromSnapshot(relativeTo, commands, queryParams = null, fragment = null) {
  const relativeToUrlSegmentGroup = createSegmentGroupFromRoute(relativeTo);
  return createUrlTreeFromSegmentGroup(relativeToUrlSegmentGroup, commands, queryParams, fragment);
}
function createSegmentGroupFromRoute(route) {
  let targetGroup;
  function createSegmentGroupFromRouteRecursive(currentRoute) {
    const childOutlets = {};
    for (const childSnapshot of currentRoute.children) {
      const root = createSegmentGroupFromRouteRecursive(childSnapshot);
      childOutlets[childSnapshot.outlet] = root;
    }
    const segmentGroup = new UrlSegmentGroup(currentRoute.url, childOutlets);
    if (currentRoute === route) {
      targetGroup = segmentGroup;
    }
    return segmentGroup;
  }
  const rootCandidate = createSegmentGroupFromRouteRecursive(route.root);
  const rootSegmentGroup = createRoot(rootCandidate);
  return targetGroup ?? rootSegmentGroup;
}
function createUrlTreeFromSegmentGroup(relativeTo, commands, queryParams, fragment) {
  let root = relativeTo;
  while (root.parent) {
    root = root.parent;
  }
  if (commands.length === 0) {
    return tree(root, root, root, queryParams, fragment);
  }
  const nav = computeNavigation(commands);
  if (nav.toRoot()) {
    return tree(root, root, new UrlSegmentGroup([], {}), queryParams, fragment);
  }
  const position = findStartingPositionForTargetGroup(nav, root, relativeTo);
  const newSegmentGroup = position.processChildren ? updateSegmentGroupChildren(position.segmentGroup, position.index, nav.commands) : updateSegmentGroup(position.segmentGroup, position.index, nav.commands);
  return tree(root, position.segmentGroup, newSegmentGroup, queryParams, fragment);
}
function isMatrixParams(command) {
  return typeof command === "object" && command != null && !command.outlets && !command.segmentPath;
}
function isCommandWithOutlets(command) {
  return typeof command === "object" && command != null && command.outlets;
}
function tree(oldRoot, oldSegmentGroup, newSegmentGroup, queryParams, fragment) {
  let qp2 = {};
  if (queryParams) {
    Object.entries(queryParams).forEach(([name2, value]) => {
      qp2[name2] = Array.isArray(value) ? value.map((v) => `${v}`) : `${value}`;
    });
  }
  let rootCandidate;
  if (oldRoot === oldSegmentGroup) {
    rootCandidate = newSegmentGroup;
  } else {
    rootCandidate = replaceSegment(oldRoot, oldSegmentGroup, newSegmentGroup);
  }
  const newRoot = createRoot(squashSegmentGroup(rootCandidate));
  return new UrlTree(newRoot, qp2, fragment);
}
function replaceSegment(current, oldSegment, newSegment) {
  const children = {};
  Object.entries(current.children).forEach(([outletName, c]) => {
    if (c === oldSegment) {
      children[outletName] = newSegment;
    } else {
      children[outletName] = replaceSegment(c, oldSegment, newSegment);
    }
  });
  return new UrlSegmentGroup(current.segments, children);
}
var Navigation = class {
  isAbsolute;
  numberOfDoubleDots;
  commands;
  constructor(isAbsolute, numberOfDoubleDots, commands) {
    this.isAbsolute = isAbsolute;
    this.numberOfDoubleDots = numberOfDoubleDots;
    this.commands = commands;
    if (isAbsolute && commands.length > 0 && isMatrixParams(commands[0])) {
      throw new RuntimeError(4003, (typeof ngDevMode === "undefined" || ngDevMode) && "Root segment cannot have matrix parameters");
    }
    const cmdWithOutlet = commands.find(isCommandWithOutlets);
    if (cmdWithOutlet && cmdWithOutlet !== last3(commands)) {
      throw new RuntimeError(4004, (typeof ngDevMode === "undefined" || ngDevMode) && "{outlets:{}} has to be the last command");
    }
  }
  toRoot() {
    return this.isAbsolute && this.commands.length === 1 && this.commands[0] == "/";
  }
};
function computeNavigation(commands) {
  if (typeof commands[0] === "string" && commands.length === 1 && commands[0] === "/") {
    return new Navigation(true, 0, commands);
  }
  let numberOfDoubleDots = 0;
  let isAbsolute = false;
  const res = commands.reduce((res2, cmd, cmdIdx) => {
    if (typeof cmd === "object" && cmd != null) {
      if (cmd.outlets) {
        const outlets = {};
        Object.entries(cmd.outlets).forEach(([name2, commands2]) => {
          outlets[name2] = typeof commands2 === "string" ? commands2.split("/") : commands2;
        });
        return [...res2, {
          outlets
        }];
      }
      if (cmd.segmentPath) {
        return [...res2, cmd.segmentPath];
      }
    }
    if (!(typeof cmd === "string")) {
      return [...res2, cmd];
    }
    if (cmdIdx === 0) {
      cmd.split("/").forEach((urlPart, partIndex) => {
        if (partIndex == 0 && urlPart === ".") ;
        else if (partIndex == 0 && urlPart === "") {
          isAbsolute = true;
        } else if (urlPart === "..") {
          numberOfDoubleDots++;
        } else if (urlPart != "") {
          res2.push(urlPart);
        }
      });
      return res2;
    }
    return [...res2, cmd];
  }, []);
  return new Navigation(isAbsolute, numberOfDoubleDots, res);
}
var Position = class {
  segmentGroup;
  processChildren;
  index;
  constructor(segmentGroup, processChildren, index) {
    this.segmentGroup = segmentGroup;
    this.processChildren = processChildren;
    this.index = index;
  }
};
function findStartingPositionForTargetGroup(nav, root, target) {
  if (nav.isAbsolute) {
    return new Position(root, true, 0);
  }
  if (!target) {
    return new Position(root, false, NaN);
  }
  if (target.parent === null) {
    return new Position(target, true, 0);
  }
  const modifier = isMatrixParams(nav.commands[0]) ? 0 : 1;
  const index = target.segments.length - 1 + modifier;
  return createPositionApplyingDoubleDots(target, index, nav.numberOfDoubleDots);
}
function createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) {
  let g = group;
  let ci = index;
  let dd = numberOfDoubleDots;
  while (dd > ci) {
    dd -= ci;
    g = g.parent;
    if (!g) {
      throw new RuntimeError(4005, (typeof ngDevMode === "undefined" || ngDevMode) && "Invalid number of '../'");
    }
    ci = g.segments.length;
  }
  return new Position(g, false, ci - dd);
}
function getOutlets(commands) {
  if (isCommandWithOutlets(commands[0])) {
    return commands[0].outlets;
  }
  return {
    [PRIMARY_OUTLET]: commands
  };
}
function updateSegmentGroup(segmentGroup, startIndex, commands) {
  segmentGroup ??= new UrlSegmentGroup([], {});
  if (segmentGroup.segments.length === 0 && segmentGroup.hasChildren()) {
    return updateSegmentGroupChildren(segmentGroup, startIndex, commands);
  }
  const m = prefixedWith(segmentGroup, startIndex, commands);
  const slicedCommands = commands.slice(m.commandIndex);
  if (m.match && m.pathIndex < segmentGroup.segments.length) {
    const g = new UrlSegmentGroup(segmentGroup.segments.slice(0, m.pathIndex), {});
    g.children[PRIMARY_OUTLET] = new UrlSegmentGroup(segmentGroup.segments.slice(m.pathIndex), segmentGroup.children);
    return updateSegmentGroupChildren(g, 0, slicedCommands);
  } else if (m.match && slicedCommands.length === 0) {
    return new UrlSegmentGroup(segmentGroup.segments, {});
  } else if (m.match && !segmentGroup.hasChildren()) {
    return createNewSegmentGroup(segmentGroup, startIndex, commands);
  } else if (m.match) {
    return updateSegmentGroupChildren(segmentGroup, 0, slicedCommands);
  } else {
    return createNewSegmentGroup(segmentGroup, startIndex, commands);
  }
}
function updateSegmentGroupChildren(segmentGroup, startIndex, commands) {
  if (commands.length === 0) {
    return new UrlSegmentGroup(segmentGroup.segments, {});
  } else {
    const outlets = getOutlets(commands);
    const children = {};
    if (Object.keys(outlets).some((o) => o !== PRIMARY_OUTLET) && segmentGroup.children[PRIMARY_OUTLET] && segmentGroup.numberOfChildren === 1 && segmentGroup.children[PRIMARY_OUTLET].segments.length === 0) {
      const childrenOfEmptyChild = updateSegmentGroupChildren(segmentGroup.children[PRIMARY_OUTLET], startIndex, commands);
      return new UrlSegmentGroup(segmentGroup.segments, childrenOfEmptyChild.children);
    }
    Object.entries(outlets).forEach(([outlet, commands2]) => {
      if (typeof commands2 === "string") {
        commands2 = [commands2];
      }
      if (commands2 !== null) {
        children[outlet] = updateSegmentGroup(segmentGroup.children[outlet], startIndex, commands2);
      }
    });
    Object.entries(segmentGroup.children).forEach(([childOutlet, child]) => {
      if (outlets[childOutlet] === void 0) {
        children[childOutlet] = child;
      }
    });
    return new UrlSegmentGroup(segmentGroup.segments, children);
  }
}
function prefixedWith(segmentGroup, startIndex, commands) {
  let currentCommandIndex = 0;
  let currentPathIndex = startIndex;
  const noMatch2 = {
    match: false,
    pathIndex: 0,
    commandIndex: 0
  };
  while (currentPathIndex < segmentGroup.segments.length) {
    if (currentCommandIndex >= commands.length) return noMatch2;
    const path = segmentGroup.segments[currentPathIndex];
    const command = commands[currentCommandIndex];
    if (isCommandWithOutlets(command)) {
      break;
    }
    const curr = `${command}`;
    const next = currentCommandIndex < commands.length - 1 ? commands[currentCommandIndex + 1] : null;
    if (currentPathIndex > 0 && curr === void 0) break;
    if (curr && next && typeof next === "object" && next.outlets === void 0) {
      if (!compare(curr, next, path)) return noMatch2;
      currentCommandIndex += 2;
    } else {
      if (!compare(curr, {}, path)) return noMatch2;
      currentCommandIndex++;
    }
    currentPathIndex++;
  }
  return {
    match: true,
    pathIndex: currentPathIndex,
    commandIndex: currentCommandIndex
  };
}
function createNewSegmentGroup(segmentGroup, startIndex, commands) {
  const paths = segmentGroup.segments.slice(0, startIndex);
  let i = 0;
  while (i < commands.length) {
    const command = commands[i];
    if (isCommandWithOutlets(command)) {
      const children = createNewSegmentChildren(command.outlets);
      return new UrlSegmentGroup(paths, children);
    }
    if (i === 0 && isMatrixParams(commands[0])) {
      const p = segmentGroup.segments[startIndex];
      paths.push(new UrlSegment(p.path, stringify2(commands[0])));
      i++;
      continue;
    }
    const curr = isCommandWithOutlets(command) ? command.outlets[PRIMARY_OUTLET] : `${command}`;
    const next = i < commands.length - 1 ? commands[i + 1] : null;
    if (curr && next && isMatrixParams(next)) {
      paths.push(new UrlSegment(curr, stringify2(next)));
      i += 2;
    } else {
      paths.push(new UrlSegment(curr, {}));
      i++;
    }
  }
  return new UrlSegmentGroup(paths, {});
}
function createNewSegmentChildren(outlets) {
  const children = {};
  Object.entries(outlets).forEach(([outlet, commands]) => {
    if (typeof commands === "string") {
      commands = [commands];
    }
    if (commands !== null) {
      children[outlet] = createNewSegmentGroup(new UrlSegmentGroup([], {}), 0, commands);
    }
  });
  return children;
}
function stringify2(params) {
  const res = {};
  Object.entries(params).forEach(([k, v]) => res[k] = `${v}`);
  return res;
}
function compare(path, params, segment) {
  return path == segment.path && shallowEqual(params, segment.parameters);
}
var IMPERATIVE_NAVIGATION = "imperative";
var EventType;
(function(EventType2) {
  EventType2[EventType2["NavigationStart"] = 0] = "NavigationStart";
  EventType2[EventType2["NavigationEnd"] = 1] = "NavigationEnd";
  EventType2[EventType2["NavigationCancel"] = 2] = "NavigationCancel";
  EventType2[EventType2["NavigationError"] = 3] = "NavigationError";
  EventType2[EventType2["RoutesRecognized"] = 4] = "RoutesRecognized";
  EventType2[EventType2["ResolveStart"] = 5] = "ResolveStart";
  EventType2[EventType2["ResolveEnd"] = 6] = "ResolveEnd";
  EventType2[EventType2["GuardsCheckStart"] = 7] = "GuardsCheckStart";
  EventType2[EventType2["GuardsCheckEnd"] = 8] = "GuardsCheckEnd";
  EventType2[EventType2["RouteConfigLoadStart"] = 9] = "RouteConfigLoadStart";
  EventType2[EventType2["RouteConfigLoadEnd"] = 10] = "RouteConfigLoadEnd";
  EventType2[EventType2["ChildActivationStart"] = 11] = "ChildActivationStart";
  EventType2[EventType2["ChildActivationEnd"] = 12] = "ChildActivationEnd";
  EventType2[EventType2["ActivationStart"] = 13] = "ActivationStart";
  EventType2[EventType2["ActivationEnd"] = 14] = "ActivationEnd";
  EventType2[EventType2["Scroll"] = 15] = "Scroll";
  EventType2[EventType2["NavigationSkipped"] = 16] = "NavigationSkipped";
})(EventType || (EventType = {}));
var RouterEvent = class {
  id;
  url;
  constructor(id, url) {
    this.id = id;
    this.url = url;
  }
};
var NavigationStart = class extends RouterEvent {
  type = EventType.NavigationStart;
  /**
   * Identifies the call or event that triggered the navigation.
   * An `imperative` trigger is a call to `router.navigateByUrl()` or `router.navigate()`.
   *
   * @see {@link NavigationEnd}
   * @see {@link NavigationCancel}
   * @see {@link NavigationError}
   */
  navigationTrigger;
  /**
   * The navigation state that was previously supplied to the `pushState` call,
   * when the navigation is triggered by a `popstate` event. Otherwise null.
   *
   * The state object is defined by `NavigationExtras`, and contains any
   * developer-defined state value, as well as a unique ID that
   * the router assigns to every router transition/navigation.
   *
   * From the perspective of the router, the router never "goes back".
   * When the user clicks on the back button in the browser,
   * a new navigation ID is created.
   *
   * Use the ID in this previous-state object to differentiate between a newly created
   * state and one returned to by a `popstate` event, so that you can restore some
   * remembered state, such as scroll position.
   *
   */
  restoredState;
  constructor(id, url, navigationTrigger = "imperative", restoredState = null) {
    super(id, url);
    this.navigationTrigger = navigationTrigger;
    this.restoredState = restoredState;
  }
  /** @docsNotRequired */
  toString() {
    return `NavigationStart(id: ${this.id}, url: '${this.url}')`;
  }
};
var NavigationEnd = class extends RouterEvent {
  urlAfterRedirects;
  type = EventType.NavigationEnd;
  constructor(id, url, urlAfterRedirects) {
    super(id, url);
    this.urlAfterRedirects = urlAfterRedirects;
  }
  /** @docsNotRequired */
  toString() {
    return `NavigationEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}')`;
  }
};
var NavigationCancellationCode;
(function(NavigationCancellationCode2) {
  NavigationCancellationCode2[NavigationCancellationCode2["Redirect"] = 0] = "Redirect";
  NavigationCancellationCode2[NavigationCancellationCode2["SupersededByNewNavigation"] = 1] = "SupersededByNewNavigation";
  NavigationCancellationCode2[NavigationCancellationCode2["NoDataFromResolver"] = 2] = "NoDataFromResolver";
  NavigationCancellationCode2[NavigationCancellationCode2["GuardRejected"] = 3] = "GuardRejected";
  NavigationCancellationCode2[NavigationCancellationCode2["Aborted"] = 4] = "Aborted";
})(NavigationCancellationCode || (NavigationCancellationCode = {}));
var NavigationSkippedCode;
(function(NavigationSkippedCode2) {
  NavigationSkippedCode2[NavigationSkippedCode2["IgnoredSameUrlNavigation"] = 0] = "IgnoredSameUrlNavigation";
  NavigationSkippedCode2[NavigationSkippedCode2["IgnoredByUrlHandlingStrategy"] = 1] = "IgnoredByUrlHandlingStrategy";
})(NavigationSkippedCode || (NavigationSkippedCode = {}));
var NavigationCancel = class extends RouterEvent {
  reason;
  code;
  type = EventType.NavigationCancel;
  constructor(id, url, reason, code) {
    super(id, url);
    this.reason = reason;
    this.code = code;
  }
  /** @docsNotRequired */
  toString() {
    return `NavigationCancel(id: ${this.id}, url: '${this.url}')`;
  }
};
var NavigationSkipped = class extends RouterEvent {
  reason;
  code;
  type = EventType.NavigationSkipped;
  constructor(id, url, reason, code) {
    super(id, url);
    this.reason = reason;
    this.code = code;
  }
};
var NavigationError = class extends RouterEvent {
  error;
  target;
  type = EventType.NavigationError;
  constructor(id, url, error, target) {
    super(id, url);
    this.error = error;
    this.target = target;
  }
  /** @docsNotRequired */
  toString() {
    return `NavigationError(id: ${this.id}, url: '${this.url}', error: ${this.error})`;
  }
};
var RoutesRecognized = class extends RouterEvent {
  urlAfterRedirects;
  state;
  type = EventType.RoutesRecognized;
  constructor(id, url, urlAfterRedirects, state) {
    super(id, url);
    this.urlAfterRedirects = urlAfterRedirects;
    this.state = state;
  }
  /** @docsNotRequired */
  toString() {
    return `RoutesRecognized(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`;
  }
};
var GuardsCheckStart = class extends RouterEvent {
  urlAfterRedirects;
  state;
  type = EventType.GuardsCheckStart;
  constructor(id, url, urlAfterRedirects, state) {
    super(id, url);
    this.urlAfterRedirects = urlAfterRedirects;
    this.state = state;
  }
  toString() {
    return `GuardsCheckStart(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`;
  }
};
var GuardsCheckEnd = class extends RouterEvent {
  urlAfterRedirects;
  state;
  shouldActivate;
  type = EventType.GuardsCheckEnd;
  constructor(id, url, urlAfterRedirects, state, shouldActivate) {
    super(id, url);
    this.urlAfterRedirects = urlAfterRedirects;
    this.state = state;
    this.shouldActivate = shouldActivate;
  }
  toString() {
    return `GuardsCheckEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state}, shouldActivate: ${this.shouldActivate})`;
  }
};
var ResolveStart = class extends RouterEvent {
  urlAfterRedirects;
  state;
  type = EventType.ResolveStart;
  constructor(id, url, urlAfterRedirects, state) {
    super(id, url);
    this.urlAfterRedirects = urlAfterRedirects;
    this.state = state;
  }
  toString() {
    return `ResolveStart(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`;
  }
};
var ResolveEnd = class extends RouterEvent {
  urlAfterRedirects;
  state;
  type = EventType.ResolveEnd;
  constructor(id, url, urlAfterRedirects, state) {
    super(id, url);
    this.urlAfterRedirects = urlAfterRedirects;
    this.state = state;
  }
  toString() {
    return `ResolveEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`;
  }
};
var RouteConfigLoadStart = class {
  route;
  type = EventType.RouteConfigLoadStart;
  constructor(route) {
    this.route = route;
  }
  toString() {
    return `RouteConfigLoadStart(path: ${this.route.path})`;
  }
};
var RouteConfigLoadEnd = class {
  route;
  type = EventType.RouteConfigLoadEnd;
  constructor(route) {
    this.route = route;
  }
  toString() {
    return `RouteConfigLoadEnd(path: ${this.route.path})`;
  }
};
var ChildActivationStart = class {
  snapshot;
  type = EventType.ChildActivationStart;
  constructor(snapshot) {
    this.snapshot = snapshot;
  }
  toString() {
    const path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || "";
    return `ChildActivationStart(path: '${path}')`;
  }
};
var ChildActivationEnd = class {
  snapshot;
  type = EventType.ChildActivationEnd;
  constructor(snapshot) {
    this.snapshot = snapshot;
  }
  toString() {
    const path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || "";
    return `ChildActivationEnd(path: '${path}')`;
  }
};
var ActivationStart = class {
  snapshot;
  type = EventType.ActivationStart;
  constructor(snapshot) {
    this.snapshot = snapshot;
  }
  toString() {
    const path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || "";
    return `ActivationStart(path: '${path}')`;
  }
};
var ActivationEnd = class {
  snapshot;
  type = EventType.ActivationEnd;
  constructor(snapshot) {
    this.snapshot = snapshot;
  }
  toString() {
    const path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || "";
    return `ActivationEnd(path: '${path}')`;
  }
};
var Scroll = class {
  routerEvent;
  position;
  anchor;
  type = EventType.Scroll;
  constructor(routerEvent, position, anchor) {
    this.routerEvent = routerEvent;
    this.position = position;
    this.anchor = anchor;
  }
  toString() {
    const pos = this.position ? `${this.position[0]}, ${this.position[1]}` : null;
    return `Scroll(anchor: '${this.anchor}', position: '${pos}')`;
  }
};
var BeforeActivateRoutes = class {
};
var RedirectRequest = class {
  url;
  navigationBehaviorOptions;
  constructor(url, navigationBehaviorOptions) {
    this.url = url;
    this.navigationBehaviorOptions = navigationBehaviorOptions;
  }
};
function isPublicRouterEvent(e) {
  return !(e instanceof BeforeActivateRoutes) && !(e instanceof RedirectRequest);
}
function stringifyEvent(routerEvent) {
  switch (routerEvent.type) {
    case EventType.ActivationEnd:
      return `ActivationEnd(path: '${routerEvent.snapshot.routeConfig?.path || ""}')`;
    case EventType.ActivationStart:
      return `ActivationStart(path: '${routerEvent.snapshot.routeConfig?.path || ""}')`;
    case EventType.ChildActivationEnd:
      return `ChildActivationEnd(path: '${routerEvent.snapshot.routeConfig?.path || ""}')`;
    case EventType.ChildActivationStart:
      return `ChildActivationStart(path: '${routerEvent.snapshot.routeConfig?.path || ""}')`;
    case EventType.GuardsCheckEnd:
      return `GuardsCheckEnd(id: ${routerEvent.id}, url: '${routerEvent.url}', urlAfterRedirects: '${routerEvent.urlAfterRedirects}', state: ${routerEvent.state}, shouldActivate: ${routerEvent.shouldActivate})`;
    case EventType.GuardsCheckStart:
      return `GuardsCheckStart(id: ${routerEvent.id}, url: '${routerEvent.url}', urlAfterRedirects: '${routerEvent.urlAfterRedirects}', state: ${routerEvent.state})`;
    case EventType.NavigationCancel:
      return `NavigationCancel(id: ${routerEvent.id}, url: '${routerEvent.url}')`;
    case EventType.NavigationSkipped:
      return `NavigationSkipped(id: ${routerEvent.id}, url: '${routerEvent.url}')`;
    case EventType.NavigationEnd:
      return `NavigationEnd(id: ${routerEvent.id}, url: '${routerEvent.url}', urlAfterRedirects: '${routerEvent.urlAfterRedirects}')`;
    case EventType.NavigationError:
      return `NavigationError(id: ${routerEvent.id}, url: '${routerEvent.url}', error: ${routerEvent.error})`;
    case EventType.NavigationStart:
      return `NavigationStart(id: ${routerEvent.id}, url: '${routerEvent.url}')`;
    case EventType.ResolveEnd:
      return `ResolveEnd(id: ${routerEvent.id}, url: '${routerEvent.url}', urlAfterRedirects: '${routerEvent.urlAfterRedirects}', state: ${routerEvent.state})`;
    case EventType.ResolveStart:
      return `ResolveStart(id: ${routerEvent.id}, url: '${routerEvent.url}', urlAfterRedirects: '${routerEvent.urlAfterRedirects}', state: ${routerEvent.state})`;
    case EventType.RouteConfigLoadEnd:
      return `RouteConfigLoadEnd(path: ${routerEvent.route.path})`;
    case EventType.RouteConfigLoadStart:
      return `RouteConfigLoadStart(path: ${routerEvent.route.path})`;
    case EventType.RoutesRecognized:
      return `RoutesRecognized(id: ${routerEvent.id}, url: '${routerEvent.url}', urlAfterRedirects: '${routerEvent.urlAfterRedirects}', state: ${routerEvent.state})`;
    case EventType.Scroll:
      const pos = routerEvent.position ? `${routerEvent.position[0]}, ${routerEvent.position[1]}` : null;
      return `Scroll(anchor: '${routerEvent.anchor}', position: '${pos}')`;
  }
}
function getOrCreateRouteInjectorIfNeeded(route, currentInjector) {
  if (route.providers && !route._injector) {
    route._injector = createEnvironmentInjector(route.providers, currentInjector, `Route: ${route.path}`);
  }
  return route._injector ?? currentInjector;
}
function validateConfig(config2, parentPath = "", requireStandaloneComponents = false) {
  for (let i = 0; i < config2.length; i++) {
    const route = config2[i];
    const fullPath = getFullPath(parentPath, route);
    validateNode(route, fullPath, requireStandaloneComponents);
  }
}
function assertStandalone(fullPath, component) {
  if (component && isNgModule(component)) {
    throw new RuntimeError(4014, `Invalid configuration of route '${fullPath}'. You are using 'loadComponent' with a module, but it must be used with standalone components. Use 'loadChildren' instead.`);
  } else if (component && !isStandalone(component)) {
    throw new RuntimeError(4014, `Invalid configuration of route '${fullPath}'. The component must be standalone.`);
  }
}
function validateNode(route, fullPath, requireStandaloneComponents) {
  if (typeof ngDevMode === "undefined" || ngDevMode) {
    if (!route) {
      throw new RuntimeError(4014, `
      Invalid configuration of route '${fullPath}': Encountered undefined route.
      The reason might be an extra comma.

      Example:
      const routes: Routes = [
        { path: '', redirectTo: '/dashboard', pathMatch: 'full' },
        { path: 'dashboard',  component: DashboardComponent },, << two commas
        { path: 'detail/:id', component: HeroDetailComponent }
      ];
    `);
    }
    if (Array.isArray(route)) {
      throw new RuntimeError(4014, `Invalid configuration of route '${fullPath}': Array cannot be specified`);
    }
    if (!route.redirectTo && !route.component && !route.loadComponent && !route.children && !route.loadChildren && route.outlet && route.outlet !== PRIMARY_OUTLET) {
      throw new RuntimeError(4014, `Invalid configuration of route '${fullPath}': a componentless route without children or loadChildren cannot have a named outlet set`);
    }
    if (route.redirectTo && route.children) {
      throw new RuntimeError(4014, `Invalid configuration of route '${fullPath}': redirectTo and children cannot be used together`);
    }
    if (route.redirectTo && route.loadChildren) {
      throw new RuntimeError(4014, `Invalid configuration of route '${fullPath}': redirectTo and loadChildren cannot be used together`);
    }
    if (route.children && route.loadChildren) {
      throw new RuntimeError(4014, `Invalid configuration of route '${fullPath}': children and loadChildren cannot be used together`);
    }
    if (route.component && route.loadComponent) {
      throw new RuntimeError(4014, `Invalid configuration of route '${fullPath}': component and loadComponent cannot be used together`);
    }
    if (route.redirectTo) {
      if (route.component || route.loadComponent) {
        throw new RuntimeError(4014, `Invalid configuration of route '${fullPath}': redirectTo and component/loadComponent cannot be used together`);
      }
      if (route.canMatch || route.canActivate) {
        throw new RuntimeError(4014, `Invalid configuration of route '${fullPath}': redirectTo and ${route.canMatch ? "canMatch" : "canActivate"} cannot be used together.Redirects happen before guards are executed.`);
      }
    }
    if (route.path && route.matcher) {
      throw new RuntimeError(4014, `Invalid configuration of route '${fullPath}': path and matcher cannot be used together`);
    }
    if (route.redirectTo === void 0 && !route.component && !route.loadComponent && !route.children && !route.loadChildren) {
      throw new RuntimeError(4014, `Invalid configuration of route '${fullPath}'. One of the following must be provided: component, loadComponent, redirectTo, children or loadChildren`);
    }
    if (route.path === void 0 && route.matcher === void 0) {
      throw new RuntimeError(4014, `Invalid configuration of route '${fullPath}': routes must have either a path or a matcher specified`);
    }
    if (typeof route.path === "string" && route.path.charAt(0) === "/") {
      throw new RuntimeError(4014, `Invalid configuration of route '${fullPath}': path cannot start with a slash`);
    }
    if (route.path === "" && route.redirectTo !== void 0 && route.pathMatch === void 0) {
      const exp = `The default value of 'pathMatch' is 'prefix', but often the intent is to use 'full'.`;
      throw new RuntimeError(4014, `Invalid configuration of route '{path: "${fullPath}", redirectTo: "${route.redirectTo}"}': please provide 'pathMatch'. ${exp}`);
    }
    if (requireStandaloneComponents) {
      assertStandalone(fullPath, route.component);
    }
  }
  if (route.children) {
    validateConfig(route.children, fullPath, requireStandaloneComponents);
  }
}
function getFullPath(parentPath, currentRoute) {
  if (!currentRoute) {
    return parentPath;
  }
  if (!parentPath && !currentRoute.path) {
    return "";
  } else if (parentPath && !currentRoute.path) {
    return `${parentPath}/`;
  } else if (!parentPath && currentRoute.path) {
    return currentRoute.path;
  } else {
    return `${parentPath}/${currentRoute.path}`;
  }
}
function getOutlet(route) {
  return route.outlet || PRIMARY_OUTLET;
}
function sortByMatchingOutlets(routes2, outletName) {
  const sortedConfig = routes2.filter((r) => getOutlet(r) === outletName);
  sortedConfig.push(...routes2.filter((r) => getOutlet(r) !== outletName));
  return sortedConfig;
}
function getClosestRouteInjector(snapshot) {
  if (!snapshot) return null;
  if (snapshot.routeConfig?._injector) {
    return snapshot.routeConfig._injector;
  }
  for (let s = snapshot.parent; s; s = s.parent) {
    const route = s.routeConfig;
    if (route?._loadedInjector) return route._loadedInjector;
    if (route?._injector) return route._injector;
  }
  return null;
}
var OutletContext = class {
  rootInjector;
  outlet = null;
  route = null;
  children;
  attachRef = null;
  get injector() {
    return getClosestRouteInjector(this.route?.snapshot) ?? this.rootInjector;
  }
  constructor(rootInjector) {
    this.rootInjector = rootInjector;
    this.children = new ChildrenOutletContexts(this.rootInjector);
  }
};
var ChildrenOutletContexts = class _ChildrenOutletContexts {
  rootInjector;
  // contexts for child outlets, by name.
  contexts = /* @__PURE__ */ new Map();
  /** @docs-private */
  constructor(rootInjector) {
    this.rootInjector = rootInjector;
  }
  /** Called when a `RouterOutlet` directive is instantiated */
  onChildOutletCreated(childName, outlet) {
    const context2 = this.getOrCreateContext(childName);
    context2.outlet = outlet;
    this.contexts.set(childName, context2);
  }
  /**
   * Called when a `RouterOutlet` directive is destroyed.
   * We need to keep the context as the outlet could be destroyed inside a NgIf and might be
   * re-created later.
   */
  onChildOutletDestroyed(childName) {
    const context2 = this.getContext(childName);
    if (context2) {
      context2.outlet = null;
      context2.attachRef = null;
    }
  }
  /**
   * Called when the corresponding route is deactivated during navigation.
   * Because the component get destroyed, all children outlet are destroyed.
   */
  onOutletDeactivated() {
    const contexts = this.contexts;
    this.contexts = /* @__PURE__ */ new Map();
    return contexts;
  }
  onOutletReAttached(contexts) {
    this.contexts = contexts;
  }
  getOrCreateContext(childName) {
    let context2 = this.getContext(childName);
    if (!context2) {
      context2 = new OutletContext(this.rootInjector);
      this.contexts.set(childName, context2);
    }
    return context2;
  }
  getContext(childName) {
    return this.contexts.get(childName) || null;
  }
  static \u0275fac = function ChildrenOutletContexts_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _ChildrenOutletContexts)(\u0275\u0275inject(EnvironmentInjector));
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _ChildrenOutletContexts,
    factory: _ChildrenOutletContexts.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ChildrenOutletContexts, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], () => [{
    type: EnvironmentInjector
  }], null);
})();
var Tree = class {
  /** @internal */
  _root;
  constructor(root) {
    this._root = root;
  }
  get root() {
    return this._root.value;
  }
  /**
   * @internal
   */
  parent(t) {
    const p = this.pathFromRoot(t);
    return p.length > 1 ? p[p.length - 2] : null;
  }
  /**
   * @internal
   */
  children(t) {
    const n = findNode(t, this._root);
    return n ? n.children.map((t2) => t2.value) : [];
  }
  /**
   * @internal
   */
  firstChild(t) {
    const n = findNode(t, this._root);
    return n && n.children.length > 0 ? n.children[0].value : null;
  }
  /**
   * @internal
   */
  siblings(t) {
    const p = findPath(t, this._root);
    if (p.length < 2) return [];
    const c = p[p.length - 2].children.map((c2) => c2.value);
    return c.filter((cc) => cc !== t);
  }
  /**
   * @internal
   */
  pathFromRoot(t) {
    return findPath(t, this._root).map((s) => s.value);
  }
};
function findNode(value, node) {
  if (value === node.value) return node;
  for (const child of node.children) {
    const node2 = findNode(value, child);
    if (node2) return node2;
  }
  return null;
}
function findPath(value, node) {
  if (value === node.value) return [node];
  for (const child of node.children) {
    const path = findPath(value, child);
    if (path.length) {
      path.unshift(node);
      return path;
    }
  }
  return [];
}
var TreeNode = class {
  value;
  children;
  constructor(value, children) {
    this.value = value;
    this.children = children;
  }
  toString() {
    return `TreeNode(${this.value})`;
  }
};
function nodeChildrenAsMap(node) {
  const map3 = {};
  if (node) {
    node.children.forEach((child) => map3[child.value.outlet] = child);
  }
  return map3;
}
var RouterState = class extends Tree {
  snapshot;
  /** @internal */
  constructor(root, snapshot) {
    super(root);
    this.snapshot = snapshot;
    setRouterState(this, root);
  }
  toString() {
    return this.snapshot.toString();
  }
};
function createEmptyState(rootComponent) {
  const snapshot = createEmptyStateSnapshot(rootComponent);
  const emptyUrl = new BehaviorSubject([new UrlSegment("", {})]);
  const emptyParams = new BehaviorSubject({});
  const emptyData = new BehaviorSubject({});
  const emptyQueryParams = new BehaviorSubject({});
  const fragment = new BehaviorSubject("");
  const activated = new ActivatedRoute(emptyUrl, emptyParams, emptyQueryParams, fragment, emptyData, PRIMARY_OUTLET, rootComponent, snapshot.root);
  activated.snapshot = snapshot.root;
  return new RouterState(new TreeNode(activated, []), snapshot);
}
function createEmptyStateSnapshot(rootComponent) {
  const emptyParams = {};
  const emptyData = {};
  const emptyQueryParams = {};
  const fragment = "";
  const activated = new ActivatedRouteSnapshot([], emptyParams, emptyQueryParams, fragment, emptyData, PRIMARY_OUTLET, rootComponent, null, {});
  return new RouterStateSnapshot("", new TreeNode(activated, []));
}
var ActivatedRoute = class {
  urlSubject;
  paramsSubject;
  queryParamsSubject;
  fragmentSubject;
  dataSubject;
  outlet;
  component;
  /** The current snapshot of this route */
  snapshot;
  /** @internal */
  _futureSnapshot;
  /** @internal */
  _routerState;
  /** @internal */
  _paramMap;
  /** @internal */
  _queryParamMap;
  /** An Observable of the resolved route title */
  title;
  /** An observable of the URL segments matched by this route. */
  url;
  /** An observable of the matrix parameters scoped to this route. */
  params;
  /** An observable of the query parameters shared by all the routes. */
  queryParams;
  /** An observable of the URL fragment shared by all the routes. */
  fragment;
  /** An observable of the static and resolved data of this route. */
  data;
  /** @internal */
  constructor(urlSubject, paramsSubject, queryParamsSubject, fragmentSubject, dataSubject, outlet, component, futureSnapshot) {
    this.urlSubject = urlSubject;
    this.paramsSubject = paramsSubject;
    this.queryParamsSubject = queryParamsSubject;
    this.fragmentSubject = fragmentSubject;
    this.dataSubject = dataSubject;
    this.outlet = outlet;
    this.component = component;
    this._futureSnapshot = futureSnapshot;
    this.title = this.dataSubject?.pipe(map((d) => d[RouteTitleKey])) ?? of(void 0);
    this.url = urlSubject;
    this.params = paramsSubject;
    this.queryParams = queryParamsSubject;
    this.fragment = fragmentSubject;
    this.data = dataSubject;
  }
  /** The configuration used to match this route. */
  get routeConfig() {
    return this._futureSnapshot.routeConfig;
  }
  /** The root of the router state. */
  get root() {
    return this._routerState.root;
  }
  /** The parent of this route in the router state tree. */
  get parent() {
    return this._routerState.parent(this);
  }
  /** The first child of this route in the router state tree. */
  get firstChild() {
    return this._routerState.firstChild(this);
  }
  /** The children of this route in the router state tree. */
  get children() {
    return this._routerState.children(this);
  }
  /** The path from the root of the router state tree to this route. */
  get pathFromRoot() {
    return this._routerState.pathFromRoot(this);
  }
  /**
   * An Observable that contains a map of the required and optional parameters
   * specific to the route.
   * The map supports retrieving single and multiple values from the same parameter.
   */
  get paramMap() {
    this._paramMap ??= this.params.pipe(map((p) => convertToParamMap(p)));
    return this._paramMap;
  }
  /**
   * An Observable that contains a map of the query parameters available to all routes.
   * The map supports retrieving single and multiple values from the query parameter.
   */
  get queryParamMap() {
    this._queryParamMap ??= this.queryParams.pipe(map((p) => convertToParamMap(p)));
    return this._queryParamMap;
  }
  toString() {
    return this.snapshot ? this.snapshot.toString() : `Future(${this._futureSnapshot})`;
  }
};
function getInherited(route, parent, paramsInheritanceStrategy = "emptyOnly") {
  let inherited;
  const {
    routeConfig
  } = route;
  if (parent !== null && (paramsInheritanceStrategy === "always" || // inherit parent data if route is empty path
  routeConfig?.path === "" || // inherit parent data if parent was componentless
  !parent.component && !parent.routeConfig?.loadComponent)) {
    inherited = {
      params: __spreadValues(__spreadValues({}, parent.params), route.params),
      data: __spreadValues(__spreadValues({}, parent.data), route.data),
      resolve: __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, route.data), parent.data), routeConfig?.data), route._resolvedData)
    };
  } else {
    inherited = {
      params: __spreadValues({}, route.params),
      data: __spreadValues({}, route.data),
      resolve: __spreadValues(__spreadValues({}, route.data), route._resolvedData ?? {})
    };
  }
  if (routeConfig && hasStaticTitle(routeConfig)) {
    inherited.resolve[RouteTitleKey] = routeConfig.title;
  }
  return inherited;
}
var ActivatedRouteSnapshot = class {
  url;
  params;
  queryParams;
  fragment;
  data;
  outlet;
  component;
  /** The configuration used to match this route **/
  routeConfig;
  /** @internal */
  _resolve;
  /** @internal */
  _resolvedData;
  /** @internal */
  _routerState;
  /** @internal */
  _paramMap;
  /** @internal */
  _queryParamMap;
  /** The resolved route title */
  get title() {
    return this.data?.[RouteTitleKey];
  }
  /** @internal */
  constructor(url, params, queryParams, fragment, data, outlet, component, routeConfig, resolve) {
    this.url = url;
    this.params = params;
    this.queryParams = queryParams;
    this.fragment = fragment;
    this.data = data;
    this.outlet = outlet;
    this.component = component;
    this.routeConfig = routeConfig;
    this._resolve = resolve;
  }
  /** The root of the router state */
  get root() {
    return this._routerState.root;
  }
  /** The parent of this route in the router state tree */
  get parent() {
    return this._routerState.parent(this);
  }
  /** The first child of this route in the router state tree */
  get firstChild() {
    return this._routerState.firstChild(this);
  }
  /** The children of this route in the router state tree */
  get children() {
    return this._routerState.children(this);
  }
  /** The path from the root of the router state tree to this route */
  get pathFromRoot() {
    return this._routerState.pathFromRoot(this);
  }
  get paramMap() {
    this._paramMap ??= convertToParamMap(this.params);
    return this._paramMap;
  }
  get queryParamMap() {
    this._queryParamMap ??= convertToParamMap(this.queryParams);
    return this._queryParamMap;
  }
  toString() {
    const url = this.url.map((segment) => segment.toString()).join("/");
    const matched = this.routeConfig ? this.routeConfig.path : "";
    return `Route(url:'${url}', path:'${matched}')`;
  }
};
var RouterStateSnapshot = class extends Tree {
  url;
  /** @internal */
  constructor(url, root) {
    super(root);
    this.url = url;
    setRouterState(this, root);
  }
  toString() {
    return serializeNode(this._root);
  }
};
function setRouterState(state, node) {
  node.value._routerState = state;
  node.children.forEach((c) => setRouterState(state, c));
}
function serializeNode(node) {
  const c = node.children.length > 0 ? ` { ${node.children.map(serializeNode).join(", ")} } ` : "";
  return `${node.value}${c}`;
}
function advanceActivatedRoute(route) {
  if (route.snapshot) {
    const currentSnapshot = route.snapshot;
    const nextSnapshot = route._futureSnapshot;
    route.snapshot = nextSnapshot;
    if (!shallowEqual(currentSnapshot.queryParams, nextSnapshot.queryParams)) {
      route.queryParamsSubject.next(nextSnapshot.queryParams);
    }
    if (currentSnapshot.fragment !== nextSnapshot.fragment) {
      route.fragmentSubject.next(nextSnapshot.fragment);
    }
    if (!shallowEqual(currentSnapshot.params, nextSnapshot.params)) {
      route.paramsSubject.next(nextSnapshot.params);
    }
    if (!shallowEqualArrays(currentSnapshot.url, nextSnapshot.url)) {
      route.urlSubject.next(nextSnapshot.url);
    }
    if (!shallowEqual(currentSnapshot.data, nextSnapshot.data)) {
      route.dataSubject.next(nextSnapshot.data);
    }
  } else {
    route.snapshot = route._futureSnapshot;
    route.dataSubject.next(route._futureSnapshot.data);
  }
}
function equalParamsAndUrlSegments(a, b) {
  const equalUrlParams = shallowEqual(a.params, b.params) && equalSegments(a.url, b.url);
  const parentsMismatch = !a.parent !== !b.parent;
  return equalUrlParams && !parentsMismatch && (!a.parent || equalParamsAndUrlSegments(a.parent, b.parent));
}
function hasStaticTitle(config2) {
  return typeof config2.title === "string" || config2.title === null;
}
var ROUTER_OUTLET_DATA = new InjectionToken(ngDevMode ? "RouterOutlet data" : "");
var RouterOutlet = class _RouterOutlet {
  activated = null;
  /** @internal */
  get activatedComponentRef() {
    return this.activated;
  }
  _activatedRoute = null;
  /**
   * The name of the outlet
   *
   */
  name = PRIMARY_OUTLET;
  activateEvents = new EventEmitter();
  deactivateEvents = new EventEmitter();
  /**
   * Emits an attached component instance when the `RouteReuseStrategy` instructs to re-attach a
   * previously detached subtree.
   **/
  attachEvents = new EventEmitter();
  /**
   * Emits a detached component instance when the `RouteReuseStrategy` instructs to detach the
   * subtree.
   */
  detachEvents = new EventEmitter();
  /**
   * Data that will be provided to the child injector through the `ROUTER_OUTLET_DATA` token.
   *
   * When unset, the value of the token is `undefined` by default.
   */
  routerOutletData = input(void 0, ...ngDevMode ? [{
    debugName: "routerOutletData"
  }] : []);
  parentContexts = inject2(ChildrenOutletContexts);
  location = inject2(ViewContainerRef);
  changeDetector = inject2(ChangeDetectorRef);
  inputBinder = inject2(INPUT_BINDER, {
    optional: true
  });
  /** @docs-private */
  supportsBindingToComponentInputs = true;
  /** @docs-private */
  ngOnChanges(changes) {
    if (changes["name"]) {
      const {
        firstChange,
        previousValue
      } = changes["name"];
      if (firstChange) {
        return;
      }
      if (this.isTrackedInParentContexts(previousValue)) {
        this.deactivate();
        this.parentContexts.onChildOutletDestroyed(previousValue);
      }
      this.initializeOutletWithName();
    }
  }
  /** @docs-private */
  ngOnDestroy() {
    if (this.isTrackedInParentContexts(this.name)) {
      this.parentContexts.onChildOutletDestroyed(this.name);
    }
    this.inputBinder?.unsubscribeFromRouteData(this);
  }
  isTrackedInParentContexts(outletName) {
    return this.parentContexts.getContext(outletName)?.outlet === this;
  }
  /** @docs-private */
  ngOnInit() {
    this.initializeOutletWithName();
  }
  initializeOutletWithName() {
    this.parentContexts.onChildOutletCreated(this.name, this);
    if (this.activated) {
      return;
    }
    const context2 = this.parentContexts.getContext(this.name);
    if (context2?.route) {
      if (context2.attachRef) {
        this.attach(context2.attachRef, context2.route);
      } else {
        this.activateWith(context2.route, context2.injector);
      }
    }
  }
  get isActivated() {
    return !!this.activated;
  }
  /**
   * @returns The currently activated component instance.
   * @throws An error if the outlet is not activated.
   */
  get component() {
    if (!this.activated) throw new RuntimeError(4012, (typeof ngDevMode === "undefined" || ngDevMode) && "Outlet is not activated");
    return this.activated.instance;
  }
  get activatedRoute() {
    if (!this.activated) throw new RuntimeError(4012, (typeof ngDevMode === "undefined" || ngDevMode) && "Outlet is not activated");
    return this._activatedRoute;
  }
  get activatedRouteData() {
    if (this._activatedRoute) {
      return this._activatedRoute.snapshot.data;
    }
    return {};
  }
  /**
   * Called when the `RouteReuseStrategy` instructs to detach the subtree
   */
  detach() {
    if (!this.activated) throw new RuntimeError(4012, (typeof ngDevMode === "undefined" || ngDevMode) && "Outlet is not activated");
    this.location.detach();
    const cmp = this.activated;
    this.activated = null;
    this._activatedRoute = null;
    this.detachEvents.emit(cmp.instance);
    return cmp;
  }
  /**
   * Called when the `RouteReuseStrategy` instructs to re-attach a previously detached subtree
   */
  attach(ref, activatedRoute) {
    this.activated = ref;
    this._activatedRoute = activatedRoute;
    this.location.insert(ref.hostView);
    this.inputBinder?.bindActivatedRouteToOutletComponent(this);
    this.attachEvents.emit(ref.instance);
  }
  deactivate() {
    if (this.activated) {
      const c = this.component;
      this.activated.destroy();
      this.activated = null;
      this._activatedRoute = null;
      this.deactivateEvents.emit(c);
    }
  }
  activateWith(activatedRoute, environmentInjector) {
    if (this.isActivated) {
      throw new RuntimeError(4013, (typeof ngDevMode === "undefined" || ngDevMode) && "Cannot activate an already activated outlet");
    }
    this._activatedRoute = activatedRoute;
    const location2 = this.location;
    const snapshot = activatedRoute.snapshot;
    const component = snapshot.component;
    const childContexts = this.parentContexts.getOrCreateContext(this.name).children;
    const injector = new OutletInjector(activatedRoute, childContexts, location2.injector, this.routerOutletData);
    this.activated = location2.createComponent(component, {
      index: location2.length,
      injector,
      environmentInjector
    });
    this.changeDetector.markForCheck();
    this.inputBinder?.bindActivatedRouteToOutletComponent(this);
    this.activateEvents.emit(this.activated.instance);
  }
  static \u0275fac = function RouterOutlet_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _RouterOutlet)();
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _RouterOutlet,
    selectors: [["router-outlet"]],
    inputs: {
      name: "name",
      routerOutletData: [1, "routerOutletData"]
    },
    outputs: {
      activateEvents: "activate",
      deactivateEvents: "deactivate",
      attachEvents: "attach",
      detachEvents: "detach"
    },
    exportAs: ["outlet"],
    features: [\u0275\u0275NgOnChangesFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(RouterOutlet, [{
    type: Directive,
    args: [{
      selector: "router-outlet",
      exportAs: "outlet"
    }]
  }], null, {
    name: [{
      type: Input
    }],
    activateEvents: [{
      type: Output,
      args: ["activate"]
    }],
    deactivateEvents: [{
      type: Output,
      args: ["deactivate"]
    }],
    attachEvents: [{
      type: Output,
      args: ["attach"]
    }],
    detachEvents: [{
      type: Output,
      args: ["detach"]
    }]
  });
})();
var OutletInjector = class {
  route;
  childContexts;
  parent;
  outletData;
  constructor(route, childContexts, parent, outletData) {
    this.route = route;
    this.childContexts = childContexts;
    this.parent = parent;
    this.outletData = outletData;
  }
  get(token, notFoundValue) {
    if (token === ActivatedRoute) {
      return this.route;
    }
    if (token === ChildrenOutletContexts) {
      return this.childContexts;
    }
    if (token === ROUTER_OUTLET_DATA) {
      return this.outletData;
    }
    return this.parent.get(token, notFoundValue);
  }
};
var INPUT_BINDER = new InjectionToken("");
var RoutedComponentInputBinder = class _RoutedComponentInputBinder {
  outletDataSubscriptions = /* @__PURE__ */ new Map();
  bindActivatedRouteToOutletComponent(outlet) {
    this.unsubscribeFromRouteData(outlet);
    this.subscribeToRouteData(outlet);
  }
  unsubscribeFromRouteData(outlet) {
    this.outletDataSubscriptions.get(outlet)?.unsubscribe();
    this.outletDataSubscriptions.delete(outlet);
  }
  subscribeToRouteData(outlet) {
    const {
      activatedRoute
    } = outlet;
    const dataSubscription = combineLatest([activatedRoute.queryParams, activatedRoute.params, activatedRoute.data]).pipe(switchMap(([queryParams, params, data], index) => {
      data = __spreadValues(__spreadValues(__spreadValues({}, queryParams), params), data);
      if (index === 0) {
        return of(data);
      }
      return Promise.resolve(data);
    })).subscribe((data) => {
      if (!outlet.isActivated || !outlet.activatedComponentRef || outlet.activatedRoute !== activatedRoute || activatedRoute.component === null) {
        this.unsubscribeFromRouteData(outlet);
        return;
      }
      const mirror = reflectComponentType(activatedRoute.component);
      if (!mirror) {
        this.unsubscribeFromRouteData(outlet);
        return;
      }
      for (const {
        templateName
      } of mirror.inputs) {
        outlet.activatedComponentRef.setInput(templateName, data[templateName]);
      }
    });
    this.outletDataSubscriptions.set(outlet, dataSubscription);
  }
  static \u0275fac = function RoutedComponentInputBinder_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _RoutedComponentInputBinder)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _RoutedComponentInputBinder,
    factory: _RoutedComponentInputBinder.\u0275fac
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(RoutedComponentInputBinder, [{
    type: Injectable
  }], null, null);
})();
var \u0275EmptyOutletComponent = class _\u0275EmptyOutletComponent {
  static \u0275fac = function \u0275EmptyOutletComponent_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _\u0275EmptyOutletComponent)();
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({
    type: _\u0275EmptyOutletComponent,
    selectors: [["ng-component"]],
    exportAs: ["emptyRouterOutlet"],
    decls: 1,
    vars: 0,
    template: function _EmptyOutletComponent_Template(rf, ctx) {
      if (rf & 1) {
        \u0275\u0275element(0, "router-outlet");
      }
    },
    dependencies: [RouterOutlet],
    encapsulation: 2
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(\u0275EmptyOutletComponent, [{
    type: Component,
    args: [{
      template: `<router-outlet/>`,
      imports: [RouterOutlet],
      // Used to avoid component ID collisions with user code.
      exportAs: "emptyRouterOutlet"
    }]
  }], null, null);
})();
function standardizeConfig(r) {
  const children = r.children && r.children.map(standardizeConfig);
  const c = children ? __spreadProps(__spreadValues({}, r), {
    children
  }) : __spreadValues({}, r);
  if (!c.component && !c.loadComponent && (children || c.loadChildren) && c.outlet && c.outlet !== PRIMARY_OUTLET) {
    c.component = \u0275EmptyOutletComponent;
  }
  return c;
}
function createRouterState(routeReuseStrategy, curr, prevState) {
  const root = createNode(routeReuseStrategy, curr._root, prevState ? prevState._root : void 0);
  return new RouterState(root, curr);
}
function createNode(routeReuseStrategy, curr, prevState) {
  if (prevState && routeReuseStrategy.shouldReuseRoute(curr.value, prevState.value.snapshot)) {
    const value = prevState.value;
    value._futureSnapshot = curr.value;
    const children = createOrReuseChildren(routeReuseStrategy, curr, prevState);
    return new TreeNode(value, children);
  } else {
    if (routeReuseStrategy.shouldAttach(curr.value)) {
      const detachedRouteHandle = routeReuseStrategy.retrieve(curr.value);
      if (detachedRouteHandle !== null) {
        const tree2 = detachedRouteHandle.route;
        tree2.value._futureSnapshot = curr.value;
        tree2.children = curr.children.map((c) => createNode(routeReuseStrategy, c));
        return tree2;
      }
    }
    const value = createActivatedRoute(curr.value);
    const children = curr.children.map((c) => createNode(routeReuseStrategy, c));
    return new TreeNode(value, children);
  }
}
function createOrReuseChildren(routeReuseStrategy, curr, prevState) {
  return curr.children.map((child) => {
    for (const p of prevState.children) {
      if (routeReuseStrategy.shouldReuseRoute(child.value, p.value.snapshot)) {
        return createNode(routeReuseStrategy, child, p);
      }
    }
    return createNode(routeReuseStrategy, child);
  });
}
function createActivatedRoute(c) {
  return new ActivatedRoute(new BehaviorSubject(c.url), new BehaviorSubject(c.params), new BehaviorSubject(c.queryParams), new BehaviorSubject(c.fragment), new BehaviorSubject(c.data), c.outlet, c.component, c);
}
var RedirectCommand = class {
  redirectTo;
  navigationBehaviorOptions;
  constructor(redirectTo, navigationBehaviorOptions) {
    this.redirectTo = redirectTo;
    this.navigationBehaviorOptions = navigationBehaviorOptions;
  }
};
var NAVIGATION_CANCELING_ERROR = "ngNavigationCancelingError";
function redirectingNavigationError(urlSerializer, redirect) {
  const {
    redirectTo,
    navigationBehaviorOptions
  } = isUrlTree(redirect) ? {
    redirectTo: redirect,
    navigationBehaviorOptions: void 0
  } : redirect;
  const error = navigationCancelingError(ngDevMode && `Redirecting to "${urlSerializer.serialize(redirectTo)}"`, NavigationCancellationCode.Redirect);
  error.url = redirectTo;
  error.navigationBehaviorOptions = navigationBehaviorOptions;
  return error;
}
function navigationCancelingError(message, code) {
  const error = new Error(`NavigationCancelingError: ${message || ""}`);
  error[NAVIGATION_CANCELING_ERROR] = true;
  error.cancellationCode = code;
  return error;
}
function isRedirectingNavigationCancelingError(error) {
  return isNavigationCancelingError(error) && isUrlTree(error.url);
}
function isNavigationCancelingError(error) {
  return !!error && error[NAVIGATION_CANCELING_ERROR];
}
var warnedAboutUnsupportedInputBinding = false;
var activateRoutes = (rootContexts, routeReuseStrategy, forwardEvent, inputBindingEnabled) => map((t) => {
  new ActivateRoutes(routeReuseStrategy, t.targetRouterState, t.currentRouterState, forwardEvent, inputBindingEnabled).activate(rootContexts);
  return t;
});
var ActivateRoutes = class {
  routeReuseStrategy;
  futureState;
  currState;
  forwardEvent;
  inputBindingEnabled;
  constructor(routeReuseStrategy, futureState, currState, forwardEvent, inputBindingEnabled) {
    this.routeReuseStrategy = routeReuseStrategy;
    this.futureState = futureState;
    this.currState = currState;
    this.forwardEvent = forwardEvent;
    this.inputBindingEnabled = inputBindingEnabled;
  }
  activate(parentContexts) {
    const futureRoot = this.futureState._root;
    const currRoot = this.currState ? this.currState._root : null;
    this.deactivateChildRoutes(futureRoot, currRoot, parentContexts);
    advanceActivatedRoute(this.futureState.root);
    this.activateChildRoutes(futureRoot, currRoot, parentContexts);
  }
  // De-activate the child route that are not re-used for the future state
  deactivateChildRoutes(futureNode, currNode, contexts) {
    const children = nodeChildrenAsMap(currNode);
    futureNode.children.forEach((futureChild) => {
      const childOutletName = futureChild.value.outlet;
      this.deactivateRoutes(futureChild, children[childOutletName], contexts);
      delete children[childOutletName];
    });
    Object.values(children).forEach((v) => {
      this.deactivateRouteAndItsChildren(v, contexts);
    });
  }
  deactivateRoutes(futureNode, currNode, parentContext) {
    const future = futureNode.value;
    const curr = currNode ? currNode.value : null;
    if (future === curr) {
      if (future.component) {
        const context2 = parentContext.getContext(future.outlet);
        if (context2) {
          this.deactivateChildRoutes(futureNode, currNode, context2.children);
        }
      } else {
        this.deactivateChildRoutes(futureNode, currNode, parentContext);
      }
    } else {
      if (curr) {
        this.deactivateRouteAndItsChildren(currNode, parentContext);
      }
    }
  }
  deactivateRouteAndItsChildren(route, parentContexts) {
    if (route.value.component && this.routeReuseStrategy.shouldDetach(route.value.snapshot)) {
      this.detachAndStoreRouteSubtree(route, parentContexts);
    } else {
      this.deactivateRouteAndOutlet(route, parentContexts);
    }
  }
  detachAndStoreRouteSubtree(route, parentContexts) {
    const context2 = parentContexts.getContext(route.value.outlet);
    const contexts = context2 && route.value.component ? context2.children : parentContexts;
    const children = nodeChildrenAsMap(route);
    for (const treeNode of Object.values(children)) {
      this.deactivateRouteAndItsChildren(treeNode, contexts);
    }
    if (context2 && context2.outlet) {
      const componentRef = context2.outlet.detach();
      const contexts2 = context2.children.onOutletDeactivated();
      this.routeReuseStrategy.store(route.value.snapshot, {
        componentRef,
        route,
        contexts: contexts2
      });
    }
  }
  deactivateRouteAndOutlet(route, parentContexts) {
    const context2 = parentContexts.getContext(route.value.outlet);
    const contexts = context2 && route.value.component ? context2.children : parentContexts;
    const children = nodeChildrenAsMap(route);
    for (const treeNode of Object.values(children)) {
      this.deactivateRouteAndItsChildren(treeNode, contexts);
    }
    if (context2) {
      if (context2.outlet) {
        context2.outlet.deactivate();
        context2.children.onOutletDeactivated();
      }
      context2.attachRef = null;
      context2.route = null;
    }
  }
  activateChildRoutes(futureNode, currNode, contexts) {
    const children = nodeChildrenAsMap(currNode);
    futureNode.children.forEach((c) => {
      this.activateRoutes(c, children[c.value.outlet], contexts);
      this.forwardEvent(new ActivationEnd(c.value.snapshot));
    });
    if (futureNode.children.length) {
      this.forwardEvent(new ChildActivationEnd(futureNode.value.snapshot));
    }
  }
  activateRoutes(futureNode, currNode, parentContexts) {
    const future = futureNode.value;
    const curr = currNode ? currNode.value : null;
    advanceActivatedRoute(future);
    if (future === curr) {
      if (future.component) {
        const context2 = parentContexts.getOrCreateContext(future.outlet);
        this.activateChildRoutes(futureNode, currNode, context2.children);
      } else {
        this.activateChildRoutes(futureNode, currNode, parentContexts);
      }
    } else {
      if (future.component) {
        const context2 = parentContexts.getOrCreateContext(future.outlet);
        if (this.routeReuseStrategy.shouldAttach(future.snapshot)) {
          const stored = this.routeReuseStrategy.retrieve(future.snapshot);
          this.routeReuseStrategy.store(future.snapshot, null);
          context2.children.onOutletReAttached(stored.contexts);
          context2.attachRef = stored.componentRef;
          context2.route = stored.route.value;
          if (context2.outlet) {
            context2.outlet.attach(stored.componentRef, stored.route.value);
          }
          advanceActivatedRoute(stored.route.value);
          this.activateChildRoutes(futureNode, null, context2.children);
        } else {
          context2.attachRef = null;
          context2.route = future;
          if (context2.outlet) {
            context2.outlet.activateWith(future, context2.injector);
          }
          this.activateChildRoutes(futureNode, null, context2.children);
        }
      } else {
        this.activateChildRoutes(futureNode, null, parentContexts);
      }
    }
    if (typeof ngDevMode === "undefined" || ngDevMode) {
      const context2 = parentContexts.getOrCreateContext(future.outlet);
      const outlet = context2.outlet;
      if (outlet && this.inputBindingEnabled && !outlet.supportsBindingToComponentInputs && !warnedAboutUnsupportedInputBinding) {
        console.warn(`'withComponentInputBinding' feature is enabled but this application is using an outlet that may not support binding to component inputs.`);
        warnedAboutUnsupportedInputBinding = true;
      }
    }
  }
};
var CanActivate = class {
  path;
  route;
  constructor(path) {
    this.path = path;
    this.route = this.path[this.path.length - 1];
  }
};
var CanDeactivate = class {
  component;
  route;
  constructor(component, route) {
    this.component = component;
    this.route = route;
  }
};
function getAllRouteGuards(future, curr, parentContexts) {
  const futureRoot = future._root;
  const currRoot = curr ? curr._root : null;
  return getChildRouteGuards(futureRoot, currRoot, parentContexts, [futureRoot.value]);
}
function getCanActivateChild(p) {
  const canActivateChild = p.routeConfig ? p.routeConfig.canActivateChild : null;
  if (!canActivateChild || canActivateChild.length === 0) return null;
  return {
    node: p,
    guards: canActivateChild
  };
}
function getTokenOrFunctionIdentity(tokenOrFunction, injector) {
  const NOT_FOUND3 = Symbol();
  const result = injector.get(tokenOrFunction, NOT_FOUND3);
  if (result === NOT_FOUND3) {
    if (typeof tokenOrFunction === "function" && !isInjectable(tokenOrFunction)) {
      return tokenOrFunction;
    } else {
      return injector.get(tokenOrFunction);
    }
  }
  return result;
}
function getChildRouteGuards(futureNode, currNode, contexts, futurePath, checks = {
  canDeactivateChecks: [],
  canActivateChecks: []
}) {
  const prevChildren = nodeChildrenAsMap(currNode);
  futureNode.children.forEach((c) => {
    getRouteGuards(c, prevChildren[c.value.outlet], contexts, futurePath.concat([c.value]), checks);
    delete prevChildren[c.value.outlet];
  });
  Object.entries(prevChildren).forEach(([k, v]) => deactivateRouteAndItsChildren(v, contexts.getContext(k), checks));
  return checks;
}
function getRouteGuards(futureNode, currNode, parentContexts, futurePath, checks = {
  canDeactivateChecks: [],
  canActivateChecks: []
}) {
  const future = futureNode.value;
  const curr = currNode ? currNode.value : null;
  const context2 = parentContexts ? parentContexts.getContext(futureNode.value.outlet) : null;
  if (curr && future.routeConfig === curr.routeConfig) {
    const shouldRun = shouldRunGuardsAndResolvers(curr, future, future.routeConfig.runGuardsAndResolvers);
    if (shouldRun) {
      checks.canActivateChecks.push(new CanActivate(futurePath));
    } else {
      future.data = curr.data;
      future._resolvedData = curr._resolvedData;
    }
    if (future.component) {
      getChildRouteGuards(futureNode, currNode, context2 ? context2.children : null, futurePath, checks);
    } else {
      getChildRouteGuards(futureNode, currNode, parentContexts, futurePath, checks);
    }
    if (shouldRun && context2 && context2.outlet && context2.outlet.isActivated) {
      checks.canDeactivateChecks.push(new CanDeactivate(context2.outlet.component, curr));
    }
  } else {
    if (curr) {
      deactivateRouteAndItsChildren(currNode, context2, checks);
    }
    checks.canActivateChecks.push(new CanActivate(futurePath));
    if (future.component) {
      getChildRouteGuards(futureNode, null, context2 ? context2.children : null, futurePath, checks);
    } else {
      getChildRouteGuards(futureNode, null, parentContexts, futurePath, checks);
    }
  }
  return checks;
}
function shouldRunGuardsAndResolvers(curr, future, mode) {
  if (typeof mode === "function") {
    return mode(curr, future);
  }
  switch (mode) {
    case "pathParamsChange":
      return !equalPath(curr.url, future.url);
    case "pathParamsOrQueryParamsChange":
      return !equalPath(curr.url, future.url) || !shallowEqual(curr.queryParams, future.queryParams);
    case "always":
      return true;
    case "paramsOrQueryParamsChange":
      return !equalParamsAndUrlSegments(curr, future) || !shallowEqual(curr.queryParams, future.queryParams);
    case "paramsChange":
    default:
      return !equalParamsAndUrlSegments(curr, future);
  }
}
function deactivateRouteAndItsChildren(route, context2, checks) {
  const children = nodeChildrenAsMap(route);
  const r = route.value;
  Object.entries(children).forEach(([childName, node]) => {
    if (!r.component) {
      deactivateRouteAndItsChildren(node, context2, checks);
    } else if (context2) {
      deactivateRouteAndItsChildren(node, context2.children.getContext(childName), checks);
    } else {
      deactivateRouteAndItsChildren(node, null, checks);
    }
  });
  if (!r.component) {
    checks.canDeactivateChecks.push(new CanDeactivate(null, r));
  } else if (context2 && context2.outlet && context2.outlet.isActivated) {
    checks.canDeactivateChecks.push(new CanDeactivate(context2.outlet.component, r));
  } else {
    checks.canDeactivateChecks.push(new CanDeactivate(null, r));
  }
}
function isFunction2(v) {
  return typeof v === "function";
}
function isBoolean(v) {
  return typeof v === "boolean";
}
function isCanLoad(guard) {
  return guard && isFunction2(guard.canLoad);
}
function isCanActivate(guard) {
  return guard && isFunction2(guard.canActivate);
}
function isCanActivateChild(guard) {
  return guard && isFunction2(guard.canActivateChild);
}
function isCanDeactivate(guard) {
  return guard && isFunction2(guard.canDeactivate);
}
function isCanMatch(guard) {
  return guard && isFunction2(guard.canMatch);
}
function isEmptyError(e) {
  return e instanceof EmptyError || e?.name === "EmptyError";
}
var INITIAL_VALUE = /* @__PURE__ */ Symbol("INITIAL_VALUE");
function prioritizedGuardValue() {
  return switchMap((obs) => {
    return combineLatest(obs.map((o) => o.pipe(take(1), startWith(INITIAL_VALUE)))).pipe(map((results) => {
      for (const result of results) {
        if (result === true) {
          continue;
        } else if (result === INITIAL_VALUE) {
          return INITIAL_VALUE;
        } else if (result === false || isRedirect(result)) {
          return result;
        }
      }
      return true;
    }), filter((item) => item !== INITIAL_VALUE), take(1));
  });
}
function isRedirect(val) {
  return isUrlTree(val) || val instanceof RedirectCommand;
}
function checkGuards(injector, forwardEvent) {
  return mergeMap((t) => {
    const {
      targetSnapshot,
      currentSnapshot,
      guards: {
        canActivateChecks,
        canDeactivateChecks
      }
    } = t;
    if (canDeactivateChecks.length === 0 && canActivateChecks.length === 0) {
      return of(__spreadProps(__spreadValues({}, t), {
        guardsResult: true
      }));
    }
    return runCanDeactivateChecks(canDeactivateChecks, targetSnapshot, currentSnapshot, injector).pipe(mergeMap((canDeactivate) => {
      return canDeactivate && isBoolean(canDeactivate) ? runCanActivateChecks(targetSnapshot, canActivateChecks, injector, forwardEvent) : of(canDeactivate);
    }), map((guardsResult) => __spreadProps(__spreadValues({}, t), {
      guardsResult
    })));
  });
}
function runCanDeactivateChecks(checks, futureRSS, currRSS, injector) {
  return from(checks).pipe(mergeMap((check) => runCanDeactivate(check.component, check.route, currRSS, futureRSS, injector)), first((result) => {
    return result !== true;
  }, true));
}
function runCanActivateChecks(futureSnapshot, checks, injector, forwardEvent) {
  return from(checks).pipe(concatMap((check) => {
    return concat(fireChildActivationStart(check.route.parent, forwardEvent), fireActivationStart(check.route, forwardEvent), runCanActivateChild(futureSnapshot, check.path, injector), runCanActivate(futureSnapshot, check.route, injector));
  }), first((result) => {
    return result !== true;
  }, true));
}
function fireActivationStart(snapshot, forwardEvent) {
  if (snapshot !== null && forwardEvent) {
    forwardEvent(new ActivationStart(snapshot));
  }
  return of(true);
}
function fireChildActivationStart(snapshot, forwardEvent) {
  if (snapshot !== null && forwardEvent) {
    forwardEvent(new ChildActivationStart(snapshot));
  }
  return of(true);
}
function runCanActivate(futureRSS, futureARS, injector) {
  const canActivate = futureARS.routeConfig ? futureARS.routeConfig.canActivate : null;
  if (!canActivate || canActivate.length === 0) return of(true);
  const canActivateObservables = canActivate.map((canActivate2) => {
    return defer(() => {
      const closestInjector = getClosestRouteInjector(futureARS) ?? injector;
      const guard = getTokenOrFunctionIdentity(canActivate2, closestInjector);
      const guardVal = isCanActivate(guard) ? guard.canActivate(futureARS, futureRSS) : runInInjectionContext(closestInjector, () => guard(futureARS, futureRSS));
      return wrapIntoObservable(guardVal).pipe(first());
    });
  });
  return of(canActivateObservables).pipe(prioritizedGuardValue());
}
function runCanActivateChild(futureRSS, path, injector) {
  const futureARS = path[path.length - 1];
  const canActivateChildGuards = path.slice(0, path.length - 1).reverse().map((p) => getCanActivateChild(p)).filter((_4) => _4 !== null);
  const canActivateChildGuardsMapped = canActivateChildGuards.map((d) => {
    return defer(() => {
      const guardsMapped = d.guards.map((canActivateChild) => {
        const closestInjector = getClosestRouteInjector(d.node) ?? injector;
        const guard = getTokenOrFunctionIdentity(canActivateChild, closestInjector);
        const guardVal = isCanActivateChild(guard) ? guard.canActivateChild(futureARS, futureRSS) : runInInjectionContext(closestInjector, () => guard(futureARS, futureRSS));
        return wrapIntoObservable(guardVal).pipe(first());
      });
      return of(guardsMapped).pipe(prioritizedGuardValue());
    });
  });
  return of(canActivateChildGuardsMapped).pipe(prioritizedGuardValue());
}
function runCanDeactivate(component, currARS, currRSS, futureRSS, injector) {
  const canDeactivate = currARS && currARS.routeConfig ? currARS.routeConfig.canDeactivate : null;
  if (!canDeactivate || canDeactivate.length === 0) return of(true);
  const canDeactivateObservables = canDeactivate.map((c) => {
    const closestInjector = getClosestRouteInjector(currARS) ?? injector;
    const guard = getTokenOrFunctionIdentity(c, closestInjector);
    const guardVal = isCanDeactivate(guard) ? guard.canDeactivate(component, currARS, currRSS, futureRSS) : runInInjectionContext(closestInjector, () => guard(component, currARS, currRSS, futureRSS));
    return wrapIntoObservable(guardVal).pipe(first());
  });
  return of(canDeactivateObservables).pipe(prioritizedGuardValue());
}
function runCanLoadGuards(injector, route, segments, urlSerializer) {
  const canLoad = route.canLoad;
  if (canLoad === void 0 || canLoad.length === 0) {
    return of(true);
  }
  const canLoadObservables = canLoad.map((injectionToken) => {
    const guard = getTokenOrFunctionIdentity(injectionToken, injector);
    const guardVal = isCanLoad(guard) ? guard.canLoad(route, segments) : runInInjectionContext(injector, () => guard(route, segments));
    return wrapIntoObservable(guardVal);
  });
  return of(canLoadObservables).pipe(prioritizedGuardValue(), redirectIfUrlTree(urlSerializer));
}
function redirectIfUrlTree(urlSerializer) {
  return pipe(tap((result) => {
    if (typeof result === "boolean") return;
    throw redirectingNavigationError(urlSerializer, result);
  }), map((result) => result === true));
}
function runCanMatchGuards(injector, route, segments, urlSerializer) {
  const canMatch = route.canMatch;
  if (!canMatch || canMatch.length === 0) return of(true);
  const canMatchObservables = canMatch.map((injectionToken) => {
    const guard = getTokenOrFunctionIdentity(injectionToken, injector);
    const guardVal = isCanMatch(guard) ? guard.canMatch(route, segments) : runInInjectionContext(injector, () => guard(route, segments));
    return wrapIntoObservable(guardVal);
  });
  return of(canMatchObservables).pipe(prioritizedGuardValue(), redirectIfUrlTree(urlSerializer));
}
var NoMatch = class {
  segmentGroup;
  constructor(segmentGroup) {
    this.segmentGroup = segmentGroup || null;
  }
};
var AbsoluteRedirect = class extends Error {
  urlTree;
  constructor(urlTree) {
    super();
    this.urlTree = urlTree;
  }
};
function noMatch$1(segmentGroup) {
  return throwError(new NoMatch(segmentGroup));
}
function namedOutletsRedirect(redirectTo) {
  return throwError(new RuntimeError(4e3, (typeof ngDevMode === "undefined" || ngDevMode) && `Only absolute redirects can have named outlets. redirectTo: '${redirectTo}'`));
}
function canLoadFails(route) {
  return throwError(navigationCancelingError((typeof ngDevMode === "undefined" || ngDevMode) && `Cannot load children because the guard of the route "path: '${route.path}'" returned false`, NavigationCancellationCode.GuardRejected));
}
var ApplyRedirects = class {
  urlSerializer;
  urlTree;
  constructor(urlSerializer, urlTree) {
    this.urlSerializer = urlSerializer;
    this.urlTree = urlTree;
  }
  lineralizeSegments(route, urlTree) {
    let res = [];
    let c = urlTree.root;
    while (true) {
      res = res.concat(c.segments);
      if (c.numberOfChildren === 0) {
        return of(res);
      }
      if (c.numberOfChildren > 1 || !c.children[PRIMARY_OUTLET]) {
        return namedOutletsRedirect(`${route.redirectTo}`);
      }
      c = c.children[PRIMARY_OUTLET];
    }
  }
  applyRedirectCommands(segments, redirectTo, posParams, currentSnapshot, injector) {
    return getRedirectResult(redirectTo, currentSnapshot, injector).pipe(map((redirect) => {
      if (redirect instanceof UrlTree) {
        throw new AbsoluteRedirect(redirect);
      }
      const newTree = this.applyRedirectCreateUrlTree(redirect, this.urlSerializer.parse(redirect), segments, posParams);
      if (redirect[0] === "/") {
        throw new AbsoluteRedirect(newTree);
      }
      return newTree;
    }));
  }
  applyRedirectCreateUrlTree(redirectTo, urlTree, segments, posParams) {
    const newRoot = this.createSegmentGroup(redirectTo, urlTree.root, segments, posParams);
    return new UrlTree(newRoot, this.createQueryParams(urlTree.queryParams, this.urlTree.queryParams), urlTree.fragment);
  }
  createQueryParams(redirectToParams, actualParams) {
    const res = {};
    Object.entries(redirectToParams).forEach(([k, v]) => {
      const copySourceValue = typeof v === "string" && v[0] === ":";
      if (copySourceValue) {
        const sourceName = v.substring(1);
        res[k] = actualParams[sourceName];
      } else {
        res[k] = v;
      }
    });
    return res;
  }
  createSegmentGroup(redirectTo, group, segments, posParams) {
    const updatedSegments = this.createSegments(redirectTo, group.segments, segments, posParams);
    let children = {};
    Object.entries(group.children).forEach(([name2, child]) => {
      children[name2] = this.createSegmentGroup(redirectTo, child, segments, posParams);
    });
    return new UrlSegmentGroup(updatedSegments, children);
  }
  createSegments(redirectTo, redirectToSegments, actualSegments, posParams) {
    return redirectToSegments.map((s) => s.path[0] === ":" ? this.findPosParam(redirectTo, s, posParams) : this.findOrReturn(s, actualSegments));
  }
  findPosParam(redirectTo, redirectToUrlSegment, posParams) {
    const pos = posParams[redirectToUrlSegment.path.substring(1)];
    if (!pos) throw new RuntimeError(4001, (typeof ngDevMode === "undefined" || ngDevMode) && `Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`);
    return pos;
  }
  findOrReturn(redirectToUrlSegment, actualSegments) {
    let idx = 0;
    for (const s of actualSegments) {
      if (s.path === redirectToUrlSegment.path) {
        actualSegments.splice(idx);
        return s;
      }
      idx++;
    }
    return redirectToUrlSegment;
  }
};
function getRedirectResult(redirectTo, currentSnapshot, injector) {
  if (typeof redirectTo === "string") {
    return of(redirectTo);
  }
  const redirectToFn = redirectTo;
  const {
    queryParams,
    fragment,
    routeConfig,
    url,
    outlet,
    params,
    data,
    title
  } = currentSnapshot;
  return wrapIntoObservable(runInInjectionContext(injector, () => redirectToFn({
    params,
    data,
    queryParams,
    fragment,
    routeConfig,
    url,
    outlet,
    title
  })));
}
var noMatch = {
  matched: false,
  consumedSegments: [],
  remainingSegments: [],
  parameters: {},
  positionalParamSegments: {}
};
function matchWithChecks(segmentGroup, route, segments, injector, urlSerializer) {
  const result = match(segmentGroup, route, segments);
  if (!result.matched) {
    return of(result);
  }
  injector = getOrCreateRouteInjectorIfNeeded(route, injector);
  return runCanMatchGuards(injector, route, segments, urlSerializer).pipe(map((v) => v === true ? result : __spreadValues({}, noMatch)));
}
function match(segmentGroup, route, segments) {
  if (route.path === "**") {
    return createWildcardMatchResult(segments);
  }
  if (route.path === "") {
    if (route.pathMatch === "full" && (segmentGroup.hasChildren() || segments.length > 0)) {
      return __spreadValues({}, noMatch);
    }
    return {
      matched: true,
      consumedSegments: [],
      remainingSegments: segments,
      parameters: {},
      positionalParamSegments: {}
    };
  }
  const matcher = route.matcher || defaultUrlMatcher;
  const res = matcher(segments, segmentGroup, route);
  if (!res) return __spreadValues({}, noMatch);
  const posParams = {};
  Object.entries(res.posParams ?? {}).forEach(([k, v]) => {
    posParams[k] = v.path;
  });
  const parameters = res.consumed.length > 0 ? __spreadValues(__spreadValues({}, posParams), res.consumed[res.consumed.length - 1].parameters) : posParams;
  return {
    matched: true,
    consumedSegments: res.consumed,
    remainingSegments: segments.slice(res.consumed.length),
    // TODO(atscott): investigate combining parameters and positionalParamSegments
    parameters,
    positionalParamSegments: res.posParams ?? {}
  };
}
function createWildcardMatchResult(segments) {
  return {
    matched: true,
    parameters: segments.length > 0 ? last3(segments).parameters : {},
    consumedSegments: segments,
    remainingSegments: [],
    positionalParamSegments: {}
  };
}
function split(segmentGroup, consumedSegments, slicedSegments, config2) {
  if (slicedSegments.length > 0 && containsEmptyPathMatchesWithNamedOutlets(segmentGroup, slicedSegments, config2)) {
    const s2 = new UrlSegmentGroup(consumedSegments, createChildrenForEmptyPaths(config2, new UrlSegmentGroup(slicedSegments, segmentGroup.children)));
    return {
      segmentGroup: s2,
      slicedSegments: []
    };
  }
  if (slicedSegments.length === 0 && containsEmptyPathMatches(segmentGroup, slicedSegments, config2)) {
    const s2 = new UrlSegmentGroup(segmentGroup.segments, addEmptyPathsToChildrenIfNeeded(segmentGroup, slicedSegments, config2, segmentGroup.children));
    return {
      segmentGroup: s2,
      slicedSegments
    };
  }
  const s = new UrlSegmentGroup(segmentGroup.segments, segmentGroup.children);
  return {
    segmentGroup: s,
    slicedSegments
  };
}
function addEmptyPathsToChildrenIfNeeded(segmentGroup, slicedSegments, routes2, children) {
  const res = {};
  for (const r of routes2) {
    if (emptyPathMatch(segmentGroup, slicedSegments, r) && !children[getOutlet(r)]) {
      const s = new UrlSegmentGroup([], {});
      res[getOutlet(r)] = s;
    }
  }
  return __spreadValues(__spreadValues({}, children), res);
}
function createChildrenForEmptyPaths(routes2, primarySegment) {
  const res = {};
  res[PRIMARY_OUTLET] = primarySegment;
  for (const r of routes2) {
    if (r.path === "" && getOutlet(r) !== PRIMARY_OUTLET) {
      const s = new UrlSegmentGroup([], {});
      res[getOutlet(r)] = s;
    }
  }
  return res;
}
function containsEmptyPathMatchesWithNamedOutlets(segmentGroup, slicedSegments, routes2) {
  return routes2.some((r) => emptyPathMatch(segmentGroup, slicedSegments, r) && getOutlet(r) !== PRIMARY_OUTLET);
}
function containsEmptyPathMatches(segmentGroup, slicedSegments, routes2) {
  return routes2.some((r) => emptyPathMatch(segmentGroup, slicedSegments, r));
}
function emptyPathMatch(segmentGroup, slicedSegments, r) {
  if ((segmentGroup.hasChildren() || slicedSegments.length > 0) && r.pathMatch === "full") {
    return false;
  }
  return r.path === "";
}
function noLeftoversInUrl(segmentGroup, segments, outlet) {
  return segments.length === 0 && !segmentGroup.children[outlet];
}
var NoLeftoversInUrl = class {
};
function recognize$1(injector, configLoader, rootComponentType, config2, urlTree, urlSerializer, paramsInheritanceStrategy = "emptyOnly") {
  return new Recognizer(injector, configLoader, rootComponentType, config2, urlTree, paramsInheritanceStrategy, urlSerializer).recognize();
}
var MAX_ALLOWED_REDIRECTS = 31;
var Recognizer = class {
  injector;
  configLoader;
  rootComponentType;
  config;
  urlTree;
  paramsInheritanceStrategy;
  urlSerializer;
  applyRedirects;
  absoluteRedirectCount = 0;
  allowRedirects = true;
  constructor(injector, configLoader, rootComponentType, config2, urlTree, paramsInheritanceStrategy, urlSerializer) {
    this.injector = injector;
    this.configLoader = configLoader;
    this.rootComponentType = rootComponentType;
    this.config = config2;
    this.urlTree = urlTree;
    this.paramsInheritanceStrategy = paramsInheritanceStrategy;
    this.urlSerializer = urlSerializer;
    this.applyRedirects = new ApplyRedirects(this.urlSerializer, this.urlTree);
  }
  noMatchError(e) {
    return new RuntimeError(4002, typeof ngDevMode === "undefined" || ngDevMode ? `Cannot match any routes. URL Segment: '${e.segmentGroup}'` : `'${e.segmentGroup}'`);
  }
  recognize() {
    const rootSegmentGroup = split(this.urlTree.root, [], [], this.config).segmentGroup;
    return this.match(rootSegmentGroup).pipe(map(({
      children,
      rootSnapshot
    }) => {
      const rootNode = new TreeNode(rootSnapshot, children);
      const routeState = new RouterStateSnapshot("", rootNode);
      const tree2 = createUrlTreeFromSnapshot(rootSnapshot, [], this.urlTree.queryParams, this.urlTree.fragment);
      tree2.queryParams = this.urlTree.queryParams;
      routeState.url = this.urlSerializer.serialize(tree2);
      return {
        state: routeState,
        tree: tree2
      };
    }));
  }
  match(rootSegmentGroup) {
    const rootSnapshot = new ActivatedRouteSnapshot([], Object.freeze({}), Object.freeze(__spreadValues({}, this.urlTree.queryParams)), this.urlTree.fragment, Object.freeze({}), PRIMARY_OUTLET, this.rootComponentType, null, {});
    return this.processSegmentGroup(this.injector, this.config, rootSegmentGroup, PRIMARY_OUTLET, rootSnapshot).pipe(map((children) => {
      return {
        children,
        rootSnapshot
      };
    }), catchError((e) => {
      if (e instanceof AbsoluteRedirect) {
        this.urlTree = e.urlTree;
        return this.match(e.urlTree.root);
      }
      if (e instanceof NoMatch) {
        throw this.noMatchError(e);
      }
      throw e;
    }));
  }
  processSegmentGroup(injector, config2, segmentGroup, outlet, parentRoute) {
    if (segmentGroup.segments.length === 0 && segmentGroup.hasChildren()) {
      return this.processChildren(injector, config2, segmentGroup, parentRoute);
    }
    return this.processSegment(injector, config2, segmentGroup, segmentGroup.segments, outlet, true, parentRoute).pipe(map((child) => child instanceof TreeNode ? [child] : []));
  }
  /**
   * Matches every child outlet in the `segmentGroup` to a `Route` in the config. Returns `null` if
   * we cannot find a match for _any_ of the children.
   *
   * @param config - The `Routes` to match against
   * @param segmentGroup - The `UrlSegmentGroup` whose children need to be matched against the
   *     config.
   */
  processChildren(injector, config2, segmentGroup, parentRoute) {
    const childOutlets = [];
    for (const child of Object.keys(segmentGroup.children)) {
      if (child === "primary") {
        childOutlets.unshift(child);
      } else {
        childOutlets.push(child);
      }
    }
    return from(childOutlets).pipe(concatMap((childOutlet) => {
      const child = segmentGroup.children[childOutlet];
      const sortedConfig = sortByMatchingOutlets(config2, childOutlet);
      return this.processSegmentGroup(injector, sortedConfig, child, childOutlet, parentRoute);
    }), scan((children, outletChildren) => {
      children.push(...outletChildren);
      return children;
    }), defaultIfEmpty(null), last2(), mergeMap((children) => {
      if (children === null) return noMatch$1(segmentGroup);
      const mergedChildren = mergeEmptyPathMatches(children);
      if (typeof ngDevMode === "undefined" || ngDevMode) {
        checkOutletNameUniqueness(mergedChildren);
      }
      sortActivatedRouteSnapshots(mergedChildren);
      return of(mergedChildren);
    }));
  }
  processSegment(injector, routes2, segmentGroup, segments, outlet, allowRedirects, parentRoute) {
    return from(routes2).pipe(concatMap((r) => {
      return this.processSegmentAgainstRoute(r._injector ?? injector, routes2, r, segmentGroup, segments, outlet, allowRedirects, parentRoute).pipe(catchError((e) => {
        if (e instanceof NoMatch) {
          return of(null);
        }
        throw e;
      }));
    }), first((x) => !!x), catchError((e) => {
      if (isEmptyError(e)) {
        if (noLeftoversInUrl(segmentGroup, segments, outlet)) {
          return of(new NoLeftoversInUrl());
        }
        return noMatch$1(segmentGroup);
      }
      throw e;
    }));
  }
  processSegmentAgainstRoute(injector, routes2, route, rawSegment, segments, outlet, allowRedirects, parentRoute) {
    if (getOutlet(route) !== outlet && (outlet === PRIMARY_OUTLET || !emptyPathMatch(rawSegment, segments, route))) {
      return noMatch$1(rawSegment);
    }
    if (route.redirectTo === void 0) {
      return this.matchSegmentAgainstRoute(injector, rawSegment, route, segments, outlet, parentRoute);
    }
    if (this.allowRedirects && allowRedirects) {
      return this.expandSegmentAgainstRouteUsingRedirect(injector, rawSegment, routes2, route, segments, outlet, parentRoute);
    }
    return noMatch$1(rawSegment);
  }
  expandSegmentAgainstRouteUsingRedirect(injector, segmentGroup, routes2, route, segments, outlet, parentRoute) {
    const {
      matched,
      parameters,
      consumedSegments,
      positionalParamSegments,
      remainingSegments
    } = match(segmentGroup, route, segments);
    if (!matched) return noMatch$1(segmentGroup);
    if (typeof route.redirectTo === "string" && route.redirectTo[0] === "/") {
      this.absoluteRedirectCount++;
      if (this.absoluteRedirectCount > MAX_ALLOWED_REDIRECTS) {
        if (ngDevMode) {
          throw new RuntimeError(4016, `Detected possible infinite redirect when redirecting from '${this.urlTree}' to '${route.redirectTo}'.
This is currently a dev mode only error but will become a call stack size exceeded error in production in a future major version.`);
        }
        this.allowRedirects = false;
      }
    }
    const currentSnapshot = new ActivatedRouteSnapshot(segments, parameters, Object.freeze(__spreadValues({}, this.urlTree.queryParams)), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getResolve(route));
    const inherited = getInherited(currentSnapshot, parentRoute, this.paramsInheritanceStrategy);
    currentSnapshot.params = Object.freeze(inherited.params);
    currentSnapshot.data = Object.freeze(inherited.data);
    const newTree$ = this.applyRedirects.applyRedirectCommands(consumedSegments, route.redirectTo, positionalParamSegments, currentSnapshot, injector);
    return newTree$.pipe(switchMap((newTree) => this.applyRedirects.lineralizeSegments(route, newTree)), mergeMap((newSegments) => {
      return this.processSegment(injector, routes2, segmentGroup, newSegments.concat(remainingSegments), outlet, false, parentRoute);
    }));
  }
  matchSegmentAgainstRoute(injector, rawSegment, route, segments, outlet, parentRoute) {
    const matchResult = matchWithChecks(rawSegment, route, segments, injector, this.urlSerializer);
    if (route.path === "**") {
      rawSegment.children = {};
    }
    return matchResult.pipe(switchMap((result) => {
      if (!result.matched) {
        return noMatch$1(rawSegment);
      }
      injector = route._injector ?? injector;
      return this.getChildConfig(injector, route, segments).pipe(switchMap(({
        routes: childConfig
      }) => {
        const childInjector = route._loadedInjector ?? injector;
        const {
          parameters,
          consumedSegments,
          remainingSegments
        } = result;
        const snapshot = new ActivatedRouteSnapshot(consumedSegments, parameters, Object.freeze(__spreadValues({}, this.urlTree.queryParams)), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getResolve(route));
        const inherited = getInherited(snapshot, parentRoute, this.paramsInheritanceStrategy);
        snapshot.params = Object.freeze(inherited.params);
        snapshot.data = Object.freeze(inherited.data);
        const {
          segmentGroup,
          slicedSegments
        } = split(rawSegment, consumedSegments, remainingSegments, childConfig);
        if (slicedSegments.length === 0 && segmentGroup.hasChildren()) {
          return this.processChildren(childInjector, childConfig, segmentGroup, snapshot).pipe(map((children) => {
            return new TreeNode(snapshot, children);
          }));
        }
        if (childConfig.length === 0 && slicedSegments.length === 0) {
          return of(new TreeNode(snapshot, []));
        }
        const matchedOnOutlet = getOutlet(route) === outlet;
        return this.processSegment(childInjector, childConfig, segmentGroup, slicedSegments, matchedOnOutlet ? PRIMARY_OUTLET : outlet, true, snapshot).pipe(map((child) => {
          return new TreeNode(snapshot, child instanceof TreeNode ? [child] : []);
        }));
      }));
    }));
  }
  getChildConfig(injector, route, segments) {
    if (route.children) {
      return of({
        routes: route.children,
        injector
      });
    }
    if (route.loadChildren) {
      if (route._loadedRoutes !== void 0) {
        return of({
          routes: route._loadedRoutes,
          injector: route._loadedInjector
        });
      }
      return runCanLoadGuards(injector, route, segments, this.urlSerializer).pipe(mergeMap((shouldLoadResult) => {
        if (shouldLoadResult) {
          return this.configLoader.loadChildren(injector, route).pipe(tap((cfg) => {
            route._loadedRoutes = cfg.routes;
            route._loadedInjector = cfg.injector;
          }));
        }
        return canLoadFails(route);
      }));
    }
    return of({
      routes: [],
      injector
    });
  }
};
function sortActivatedRouteSnapshots(nodes) {
  nodes.sort((a, b) => {
    if (a.value.outlet === PRIMARY_OUTLET) return -1;
    if (b.value.outlet === PRIMARY_OUTLET) return 1;
    return a.value.outlet.localeCompare(b.value.outlet);
  });
}
function hasEmptyPathConfig(node) {
  const config2 = node.value.routeConfig;
  return config2 && config2.path === "";
}
function mergeEmptyPathMatches(nodes) {
  const result = [];
  const mergedNodes = /* @__PURE__ */ new Set();
  for (const node of nodes) {
    if (!hasEmptyPathConfig(node)) {
      result.push(node);
      continue;
    }
    const duplicateEmptyPathNode = result.find((resultNode) => node.value.routeConfig === resultNode.value.routeConfig);
    if (duplicateEmptyPathNode !== void 0) {
      duplicateEmptyPathNode.children.push(...node.children);
      mergedNodes.add(duplicateEmptyPathNode);
    } else {
      result.push(node);
    }
  }
  for (const mergedNode of mergedNodes) {
    const mergedChildren = mergeEmptyPathMatches(mergedNode.children);
    result.push(new TreeNode(mergedNode.value, mergedChildren));
  }
  return result.filter((n) => !mergedNodes.has(n));
}
function checkOutletNameUniqueness(nodes) {
  const names = {};
  nodes.forEach((n) => {
    const routeWithSameOutletName = names[n.value.outlet];
    if (routeWithSameOutletName) {
      const p = routeWithSameOutletName.url.map((s) => s.toString()).join("/");
      const c = n.value.url.map((s) => s.toString()).join("/");
      throw new RuntimeError(4006, (typeof ngDevMode === "undefined" || ngDevMode) && `Two segments cannot have the same outlet name: '${p}' and '${c}'.`);
    }
    names[n.value.outlet] = n.value;
  });
}
function getData(route) {
  return route.data || {};
}
function getResolve(route) {
  return route.resolve || {};
}
function recognize(injector, configLoader, rootComponentType, config2, serializer, paramsInheritanceStrategy) {
  return mergeMap((t) => recognize$1(injector, configLoader, rootComponentType, config2, t.extractedUrl, serializer, paramsInheritanceStrategy).pipe(map(({
    state: targetSnapshot,
    tree: urlAfterRedirects
  }) => {
    return __spreadProps(__spreadValues({}, t), {
      targetSnapshot,
      urlAfterRedirects
    });
  })));
}
function resolveData(paramsInheritanceStrategy, injector) {
  return mergeMap((t) => {
    const {
      targetSnapshot,
      guards: {
        canActivateChecks
      }
    } = t;
    if (!canActivateChecks.length) {
      return of(t);
    }
    const routesWithResolversToRun = new Set(canActivateChecks.map((check) => check.route));
    const routesNeedingDataUpdates = /* @__PURE__ */ new Set();
    for (const route of routesWithResolversToRun) {
      if (routesNeedingDataUpdates.has(route)) {
        continue;
      }
      for (const newRoute of flattenRouteTree(route)) {
        routesNeedingDataUpdates.add(newRoute);
      }
    }
    let routesProcessed = 0;
    return from(routesNeedingDataUpdates).pipe(concatMap((route) => {
      if (routesWithResolversToRun.has(route)) {
        return runResolve(route, targetSnapshot, paramsInheritanceStrategy, injector);
      } else {
        route.data = getInherited(route, route.parent, paramsInheritanceStrategy).resolve;
        return of(void 0);
      }
    }), tap(() => routesProcessed++), takeLast(1), mergeMap((_4) => routesProcessed === routesNeedingDataUpdates.size ? of(t) : EMPTY));
  });
}
function flattenRouteTree(route) {
  const descendants = route.children.map((child) => flattenRouteTree(child)).flat();
  return [route, ...descendants];
}
function runResolve(futureARS, futureRSS, paramsInheritanceStrategy, injector) {
  const config2 = futureARS.routeConfig;
  const resolve = futureARS._resolve;
  if (config2?.title !== void 0 && !hasStaticTitle(config2)) {
    resolve[RouteTitleKey] = config2.title;
  }
  return defer(() => {
    futureARS.data = getInherited(futureARS, futureARS.parent, paramsInheritanceStrategy).resolve;
    return resolveNode(resolve, futureARS, futureRSS, injector).pipe(map((resolvedData) => {
      futureARS._resolvedData = resolvedData;
      futureARS.data = __spreadValues(__spreadValues({}, futureARS.data), resolvedData);
      return null;
    }));
  });
}
function resolveNode(resolve, futureARS, futureRSS, injector) {
  const keys = getDataKeys(resolve);
  if (keys.length === 0) {
    return of({});
  }
  const data = {};
  return from(keys).pipe(mergeMap((key) => getResolver(resolve[key], futureARS, futureRSS, injector).pipe(first(), tap((value) => {
    if (value instanceof RedirectCommand) {
      throw redirectingNavigationError(new DefaultUrlSerializer(), value);
    }
    data[key] = value;
  }))), takeLast(1), map(() => data), catchError((e) => isEmptyError(e) ? EMPTY : throwError(e)));
}
function getResolver(injectionToken, futureARS, futureRSS, injector) {
  const closestInjector = getClosestRouteInjector(futureARS) ?? injector;
  const resolver = getTokenOrFunctionIdentity(injectionToken, closestInjector);
  const resolverValue = resolver.resolve ? resolver.resolve(futureARS, futureRSS) : runInInjectionContext(closestInjector, () => resolver(futureARS, futureRSS));
  return wrapIntoObservable(resolverValue);
}
function switchTap(next) {
  return switchMap((v) => {
    const nextResult = next(v);
    if (nextResult) {
      return from(nextResult).pipe(map(() => v));
    }
    return of(v);
  });
}
var TitleStrategy = class _TitleStrategy {
  /**
   * @returns The `title` of the deepest primary route.
   */
  buildTitle(snapshot) {
    let pageTitle;
    let route = snapshot.root;
    while (route !== void 0) {
      pageTitle = this.getResolvedTitleForRoute(route) ?? pageTitle;
      route = route.children.find((child) => child.outlet === PRIMARY_OUTLET);
    }
    return pageTitle;
  }
  /**
   * Given an `ActivatedRouteSnapshot`, returns the final value of the
   * `Route.title` property, which can either be a static string or a resolved value.
   */
  getResolvedTitleForRoute(snapshot) {
    return snapshot.data[RouteTitleKey];
  }
  static \u0275fac = function TitleStrategy_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _TitleStrategy)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _TitleStrategy,
    factory: () => (() => inject2(DefaultTitleStrategy))(),
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(TitleStrategy, [{
    type: Injectable,
    args: [{
      providedIn: "root",
      useFactory: () => inject2(DefaultTitleStrategy)
    }]
  }], null, null);
})();
var DefaultTitleStrategy = class _DefaultTitleStrategy extends TitleStrategy {
  title;
  constructor(title) {
    super();
    this.title = title;
  }
  /**
   * Sets the title of the browser to the given value.
   *
   * @param title The `pageTitle` from the deepest primary route.
   */
  updateTitle(snapshot) {
    const title = this.buildTitle(snapshot);
    if (title !== void 0) {
      this.title.setTitle(title);
    }
  }
  static \u0275fac = function DefaultTitleStrategy_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _DefaultTitleStrategy)(\u0275\u0275inject(Title));
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _DefaultTitleStrategy,
    factory: _DefaultTitleStrategy.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(DefaultTitleStrategy, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], () => [{
    type: Title
  }], null);
})();
var ROUTER_CONFIGURATION = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "router config" : "", {
  providedIn: "root",
  factory: () => ({})
});
var ROUTES = new InjectionToken(ngDevMode ? "ROUTES" : "");
var RouterConfigLoader = class _RouterConfigLoader {
  componentLoaders = /* @__PURE__ */ new WeakMap();
  childrenLoaders = /* @__PURE__ */ new WeakMap();
  onLoadStartListener;
  onLoadEndListener;
  compiler = inject2(Compiler);
  loadComponent(injector, route) {
    if (this.componentLoaders.get(route)) {
      return this.componentLoaders.get(route);
    } else if (route._loadedComponent) {
      return of(route._loadedComponent);
    }
    if (this.onLoadStartListener) {
      this.onLoadStartListener(route);
    }
    const loadRunner = wrapIntoObservable(runInInjectionContext(injector, () => route.loadComponent())).pipe(map(maybeUnwrapDefaultExport), tap((component) => {
      if (this.onLoadEndListener) {
        this.onLoadEndListener(route);
      }
      (typeof ngDevMode === "undefined" || ngDevMode) && assertStandalone(route.path ?? "", component);
      route._loadedComponent = component;
    }), finalize(() => {
      this.componentLoaders.delete(route);
    }));
    const loader = new ConnectableObservable(loadRunner, () => new Subject()).pipe(refCount());
    this.componentLoaders.set(route, loader);
    return loader;
  }
  loadChildren(parentInjector, route) {
    if (this.childrenLoaders.get(route)) {
      return this.childrenLoaders.get(route);
    } else if (route._loadedRoutes) {
      return of({
        routes: route._loadedRoutes,
        injector: route._loadedInjector
      });
    }
    if (this.onLoadStartListener) {
      this.onLoadStartListener(route);
    }
    const moduleFactoryOrRoutes$ = loadChildren(route, this.compiler, parentInjector, this.onLoadEndListener);
    const loadRunner = moduleFactoryOrRoutes$.pipe(finalize(() => {
      this.childrenLoaders.delete(route);
    }));
    const loader = new ConnectableObservable(loadRunner, () => new Subject()).pipe(refCount());
    this.childrenLoaders.set(route, loader);
    return loader;
  }
  static \u0275fac = function RouterConfigLoader_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _RouterConfigLoader)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _RouterConfigLoader,
    factory: _RouterConfigLoader.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(RouterConfigLoader, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], null, null);
})();
function loadChildren(route, compiler, parentInjector, onLoadEndListener) {
  return wrapIntoObservable(runInInjectionContext(parentInjector, () => route.loadChildren())).pipe(map(maybeUnwrapDefaultExport), mergeMap((t) => {
    if (t instanceof NgModuleFactory$1 || Array.isArray(t)) {
      return of(t);
    } else {
      return from(compiler.compileModuleAsync(t));
    }
  }), map((factoryOrRoutes) => {
    if (onLoadEndListener) {
      onLoadEndListener(route);
    }
    let injector;
    let rawRoutes;
    let requireStandaloneComponents = false;
    if (Array.isArray(factoryOrRoutes)) {
      rawRoutes = factoryOrRoutes;
      requireStandaloneComponents = true;
    } else {
      injector = factoryOrRoutes.create(parentInjector).injector;
      rawRoutes = injector.get(ROUTES, [], {
        optional: true,
        self: true
      }).flat();
    }
    const routes2 = rawRoutes.map(standardizeConfig);
    (typeof ngDevMode === "undefined" || ngDevMode) && validateConfig(routes2, route.path, requireStandaloneComponents);
    return {
      routes: routes2,
      injector
    };
  }));
}
function isWrappedDefaultExport(value) {
  return value && typeof value === "object" && "default" in value;
}
function maybeUnwrapDefaultExport(input2) {
  return isWrappedDefaultExport(input2) ? input2["default"] : input2;
}
var UrlHandlingStrategy = class _UrlHandlingStrategy {
  static \u0275fac = function UrlHandlingStrategy_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _UrlHandlingStrategy)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _UrlHandlingStrategy,
    factory: () => (() => inject2(DefaultUrlHandlingStrategy))(),
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(UrlHandlingStrategy, [{
    type: Injectable,
    args: [{
      providedIn: "root",
      useFactory: () => inject2(DefaultUrlHandlingStrategy)
    }]
  }], null, null);
})();
var DefaultUrlHandlingStrategy = class _DefaultUrlHandlingStrategy {
  shouldProcessUrl(url) {
    return true;
  }
  extract(url) {
    return url;
  }
  merge(newUrlPart, wholeUrl) {
    return newUrlPart;
  }
  static \u0275fac = function DefaultUrlHandlingStrategy_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _DefaultUrlHandlingStrategy)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _DefaultUrlHandlingStrategy,
    factory: _DefaultUrlHandlingStrategy.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(DefaultUrlHandlingStrategy, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], null, null);
})();
var CREATE_VIEW_TRANSITION = new InjectionToken(ngDevMode ? "view transition helper" : "");
var VIEW_TRANSITION_OPTIONS = new InjectionToken(ngDevMode ? "view transition options" : "");
function createViewTransition(injector, from2, to) {
  const transitionOptions = injector.get(VIEW_TRANSITION_OPTIONS);
  const document2 = injector.get(DOCUMENT);
  if (!document2.startViewTransition || transitionOptions.skipNextTransition) {
    transitionOptions.skipNextTransition = false;
    return new Promise((resolve) => setTimeout(resolve));
  }
  let resolveViewTransitionStarted;
  const viewTransitionStarted = new Promise((resolve) => {
    resolveViewTransitionStarted = resolve;
  });
  const transition = document2.startViewTransition(() => {
    resolveViewTransitionStarted();
    return createRenderPromise(injector);
  });
  transition.ready.catch((error) => {
    if (typeof ngDevMode === "undefined" || ngDevMode) {
      console.error(error);
    }
  });
  const {
    onViewTransitionCreated
  } = transitionOptions;
  if (onViewTransitionCreated) {
    runInInjectionContext(injector, () => onViewTransitionCreated({
      transition,
      from: from2,
      to
    }));
  }
  return viewTransitionStarted;
}
function createRenderPromise(injector) {
  return new Promise((resolve) => {
    afterNextRender({
      read: () => setTimeout(resolve)
    }, {
      injector
    });
  });
}
var NAVIGATION_ERROR_HANDLER = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "navigation error handler" : "");
var NavigationTransitions = class _NavigationTransitions {
  currentNavigation = null;
  currentTransition = null;
  lastSuccessfulNavigation = null;
  /**
   * These events are used to communicate back to the Router about the state of the transition. The
   * Router wants to respond to these events in various ways. Because the `NavigationTransition`
   * class is not public, this event subject is not publicly exposed.
   */
  events = new Subject();
  /**
   * Used to abort the current transition with an error.
   */
  transitionAbortWithErrorSubject = new Subject();
  configLoader = inject2(RouterConfigLoader);
  environmentInjector = inject2(EnvironmentInjector);
  destroyRef = inject2(DestroyRef);
  urlSerializer = inject2(UrlSerializer);
  rootContexts = inject2(ChildrenOutletContexts);
  location = inject2(Location);
  inputBindingEnabled = inject2(INPUT_BINDER, {
    optional: true
  }) !== null;
  titleStrategy = inject2(TitleStrategy);
  options = inject2(ROUTER_CONFIGURATION, {
    optional: true
  }) || {};
  paramsInheritanceStrategy = this.options.paramsInheritanceStrategy || "emptyOnly";
  urlHandlingStrategy = inject2(UrlHandlingStrategy);
  createViewTransition = inject2(CREATE_VIEW_TRANSITION, {
    optional: true
  });
  navigationErrorHandler = inject2(NAVIGATION_ERROR_HANDLER, {
    optional: true
  });
  navigationId = 0;
  get hasRequestedNavigation() {
    return this.navigationId !== 0;
  }
  transitions;
  /**
   * Hook that enables you to pause navigation after the preactivation phase.
   * Used by `RouterModule`.
   *
   * @internal
   */
  afterPreactivation = () => of(void 0);
  /** @internal */
  rootComponentType = null;
  destroyed = false;
  constructor() {
    const onLoadStart = (r) => this.events.next(new RouteConfigLoadStart(r));
    const onLoadEnd = (r) => this.events.next(new RouteConfigLoadEnd(r));
    this.configLoader.onLoadEndListener = onLoadEnd;
    this.configLoader.onLoadStartListener = onLoadStart;
    this.destroyRef.onDestroy(() => {
      this.destroyed = true;
    });
  }
  complete() {
    this.transitions?.complete();
  }
  handleNavigationRequest(request) {
    const id = ++this.navigationId;
    this.transitions?.next(__spreadProps(__spreadValues({}, request), {
      extractedUrl: this.urlHandlingStrategy.extract(request.rawUrl),
      targetSnapshot: null,
      targetRouterState: null,
      guards: {
        canActivateChecks: [],
        canDeactivateChecks: []
      },
      guardsResult: null,
      abortController: new AbortController(),
      id
    }));
  }
  setupNavigations(router) {
    this.transitions = new BehaviorSubject(null);
    return this.transitions.pipe(
      filter((t) => t !== null),
      // Using switchMap so we cancel executing navigations when a new one comes in
      switchMap((overallTransitionState) => {
        let completedOrAborted = false;
        return of(overallTransitionState).pipe(
          switchMap((t) => {
            if (this.navigationId > overallTransitionState.id) {
              const cancellationReason = typeof ngDevMode === "undefined" || ngDevMode ? `Navigation ID ${overallTransitionState.id} is not equal to the current navigation id ${this.navigationId}` : "";
              this.cancelNavigationTransition(overallTransitionState, cancellationReason, NavigationCancellationCode.SupersededByNewNavigation);
              return EMPTY;
            }
            this.currentTransition = overallTransitionState;
            this.currentNavigation = {
              id: t.id,
              initialUrl: t.rawUrl,
              extractedUrl: t.extractedUrl,
              targetBrowserUrl: typeof t.extras.browserUrl === "string" ? this.urlSerializer.parse(t.extras.browserUrl) : t.extras.browserUrl,
              trigger: t.source,
              extras: t.extras,
              previousNavigation: !this.lastSuccessfulNavigation ? null : __spreadProps(__spreadValues({}, this.lastSuccessfulNavigation), {
                previousNavigation: null
              }),
              abort: () => t.abortController.abort()
            };
            const urlTransition = !router.navigated || this.isUpdatingInternalState() || this.isUpdatedBrowserUrl();
            const onSameUrlNavigation = t.extras.onSameUrlNavigation ?? router.onSameUrlNavigation;
            if (!urlTransition && onSameUrlNavigation !== "reload") {
              const reason = typeof ngDevMode === "undefined" || ngDevMode ? `Navigation to ${t.rawUrl} was ignored because it is the same as the current Router URL.` : "";
              this.events.next(new NavigationSkipped(t.id, this.urlSerializer.serialize(t.rawUrl), reason, NavigationSkippedCode.IgnoredSameUrlNavigation));
              t.resolve(false);
              return EMPTY;
            }
            if (this.urlHandlingStrategy.shouldProcessUrl(t.rawUrl)) {
              return of(t).pipe(
                // Fire NavigationStart event
                switchMap((t2) => {
                  this.events.next(new NavigationStart(t2.id, this.urlSerializer.serialize(t2.extractedUrl), t2.source, t2.restoredState));
                  if (t2.id !== this.navigationId) {
                    return EMPTY;
                  }
                  return Promise.resolve(t2);
                }),
                // Recognize
                recognize(this.environmentInjector, this.configLoader, this.rootComponentType, router.config, this.urlSerializer, this.paramsInheritanceStrategy),
                // Update URL if in `eager` update mode
                tap((t2) => {
                  overallTransitionState.targetSnapshot = t2.targetSnapshot;
                  overallTransitionState.urlAfterRedirects = t2.urlAfterRedirects;
                  this.currentNavigation = __spreadProps(__spreadValues({}, this.currentNavigation), {
                    finalUrl: t2.urlAfterRedirects
                  });
                  const routesRecognized = new RoutesRecognized(t2.id, this.urlSerializer.serialize(t2.extractedUrl), this.urlSerializer.serialize(t2.urlAfterRedirects), t2.targetSnapshot);
                  this.events.next(routesRecognized);
                })
              );
            } else if (urlTransition && this.urlHandlingStrategy.shouldProcessUrl(t.currentRawUrl)) {
              const {
                id,
                extractedUrl,
                source,
                restoredState,
                extras
              } = t;
              const navStart = new NavigationStart(id, this.urlSerializer.serialize(extractedUrl), source, restoredState);
              this.events.next(navStart);
              const targetSnapshot = createEmptyState(this.rootComponentType).snapshot;
              this.currentTransition = overallTransitionState = __spreadProps(__spreadValues({}, t), {
                targetSnapshot,
                urlAfterRedirects: extractedUrl,
                extras: __spreadProps(__spreadValues({}, extras), {
                  skipLocationChange: false,
                  replaceUrl: false
                })
              });
              this.currentNavigation.finalUrl = extractedUrl;
              return of(overallTransitionState);
            } else {
              const reason = typeof ngDevMode === "undefined" || ngDevMode ? `Navigation was ignored because the UrlHandlingStrategy indicated neither the current URL ${t.currentRawUrl} nor target URL ${t.rawUrl} should be processed.` : "";
              this.events.next(new NavigationSkipped(t.id, this.urlSerializer.serialize(t.extractedUrl), reason, NavigationSkippedCode.IgnoredByUrlHandlingStrategy));
              t.resolve(false);
              return EMPTY;
            }
          }),
          // --- GUARDS ---
          tap((t) => {
            const guardsStart = new GuardsCheckStart(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);
            this.events.next(guardsStart);
          }),
          map((t) => {
            this.currentTransition = overallTransitionState = __spreadProps(__spreadValues({}, t), {
              guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.rootContexts)
            });
            return overallTransitionState;
          }),
          checkGuards(this.environmentInjector, (evt2) => this.events.next(evt2)),
          tap((t) => {
            overallTransitionState.guardsResult = t.guardsResult;
            if (t.guardsResult && typeof t.guardsResult !== "boolean") {
              throw redirectingNavigationError(this.urlSerializer, t.guardsResult);
            }
            const guardsEnd = new GuardsCheckEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot, !!t.guardsResult);
            this.events.next(guardsEnd);
          }),
          filter((t) => {
            if (!t.guardsResult) {
              this.cancelNavigationTransition(t, "", NavigationCancellationCode.GuardRejected);
              return false;
            }
            return true;
          }),
          // --- RESOLVE ---
          switchTap((t) => {
            if (t.guards.canActivateChecks.length === 0) {
              return void 0;
            }
            return of(t).pipe(tap((t2) => {
              const resolveStart = new ResolveStart(t2.id, this.urlSerializer.serialize(t2.extractedUrl), this.urlSerializer.serialize(t2.urlAfterRedirects), t2.targetSnapshot);
              this.events.next(resolveStart);
            }), switchMap((t2) => {
              let dataResolved = false;
              return of(t2).pipe(resolveData(this.paramsInheritanceStrategy, this.environmentInjector), tap({
                next: () => dataResolved = true,
                complete: () => {
                  if (!dataResolved) {
                    this.cancelNavigationTransition(t2, typeof ngDevMode === "undefined" || ngDevMode ? `At least one route resolver didn't emit any value.` : "", NavigationCancellationCode.NoDataFromResolver);
                  }
                }
              }));
            }), tap((t2) => {
              const resolveEnd2 = new ResolveEnd(t2.id, this.urlSerializer.serialize(t2.extractedUrl), this.urlSerializer.serialize(t2.urlAfterRedirects), t2.targetSnapshot);
              this.events.next(resolveEnd2);
            }));
          }),
          // --- LOAD COMPONENTS ---
          switchTap((t) => {
            const loadComponents = (route) => {
              const loaders = [];
              if (route.routeConfig?.loadComponent && !route.routeConfig._loadedComponent) {
                const injector = getClosestRouteInjector(route) ?? this.environmentInjector;
                loaders.push(this.configLoader.loadComponent(injector, route.routeConfig).pipe(tap((loadedComponent) => {
                  route.component = loadedComponent;
                }), map(() => void 0)));
              }
              for (const child of route.children) {
                loaders.push(...loadComponents(child));
              }
              return loaders;
            };
            return combineLatest(loadComponents(t.targetSnapshot.root)).pipe(defaultIfEmpty(null), take(1));
          }),
          switchTap(() => this.afterPreactivation()),
          switchMap(() => {
            const {
              currentSnapshot,
              targetSnapshot
            } = overallTransitionState;
            const viewTransitionStarted = this.createViewTransition?.(this.environmentInjector, currentSnapshot.root, targetSnapshot.root);
            return viewTransitionStarted ? from(viewTransitionStarted).pipe(map(() => overallTransitionState)) : of(overallTransitionState);
          }),
          map((t) => {
            const targetRouterState = createRouterState(router.routeReuseStrategy, t.targetSnapshot, t.currentRouterState);
            this.currentTransition = overallTransitionState = __spreadProps(__spreadValues({}, t), {
              targetRouterState
            });
            this.currentNavigation.targetRouterState = targetRouterState;
            return overallTransitionState;
          }),
          tap(() => {
            this.events.next(new BeforeActivateRoutes());
          }),
          activateRoutes(this.rootContexts, router.routeReuseStrategy, (evt2) => this.events.next(evt2), this.inputBindingEnabled),
          // Ensure that if some observable used to drive the transition doesn't
          // complete, the navigation still finalizes This should never happen, but
          // this is done as a safety measure to avoid surfacing this error (#49567).
          take(1),
          takeUntil(new Observable((subscriber) => {
            const abortSignal = overallTransitionState.abortController.signal;
            const handler = () => subscriber.next();
            abortSignal.addEventListener("abort", handler);
            return () => abortSignal.removeEventListener("abort", handler);
          }).pipe(
            // Ignore aborts if we are already completed, canceled, or are in the activation stage (we have targetRouterState)
            filter(() => !completedOrAborted && !overallTransitionState.targetRouterState),
            tap(() => {
              this.cancelNavigationTransition(overallTransitionState, overallTransitionState.abortController.signal.reason + "", NavigationCancellationCode.Aborted);
            })
          )),
          tap({
            next: (t) => {
              completedOrAborted = true;
              this.lastSuccessfulNavigation = this.currentNavigation;
              this.events.next(new NavigationEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects)));
              this.titleStrategy?.updateTitle(t.targetRouterState.snapshot);
              t.resolve(true);
            },
            complete: () => {
              completedOrAborted = true;
            }
          }),
          // There used to be a lot more logic happening directly within the
          // transition Observable. Some of this logic has been refactored out to
          // other places but there may still be errors that happen there. This gives
          // us a way to cancel the transition from the outside. This may also be
          // required in the future to support something like the abort signal of the
          // Navigation API where the navigation gets aborted from outside the
          // transition.
          takeUntil(this.transitionAbortWithErrorSubject.pipe(tap((err) => {
            throw err;
          }))),
          finalize(() => {
            if (!completedOrAborted) {
              const cancelationReason = typeof ngDevMode === "undefined" || ngDevMode ? `Navigation ID ${overallTransitionState.id} is not equal to the current navigation id ${this.navigationId}` : "";
              this.cancelNavigationTransition(overallTransitionState, cancelationReason, NavigationCancellationCode.SupersededByNewNavigation);
            }
            if (this.currentTransition?.id === overallTransitionState.id) {
              this.currentNavigation = null;
              this.currentTransition = null;
            }
          }),
          catchError((e) => {
            if (this.destroyed) {
              overallTransitionState.resolve(false);
              return EMPTY;
            }
            completedOrAborted = true;
            if (isNavigationCancelingError(e)) {
              this.events.next(new NavigationCancel(overallTransitionState.id, this.urlSerializer.serialize(overallTransitionState.extractedUrl), e.message, e.cancellationCode));
              if (!isRedirectingNavigationCancelingError(e)) {
                overallTransitionState.resolve(false);
              } else {
                this.events.next(new RedirectRequest(e.url, e.navigationBehaviorOptions));
              }
            } else {
              const navigationError = new NavigationError(overallTransitionState.id, this.urlSerializer.serialize(overallTransitionState.extractedUrl), e, overallTransitionState.targetSnapshot ?? void 0);
              try {
                const navigationErrorHandlerResult = runInInjectionContext(this.environmentInjector, () => this.navigationErrorHandler?.(navigationError));
                if (navigationErrorHandlerResult instanceof RedirectCommand) {
                  const {
                    message,
                    cancellationCode
                  } = redirectingNavigationError(this.urlSerializer, navigationErrorHandlerResult);
                  this.events.next(new NavigationCancel(overallTransitionState.id, this.urlSerializer.serialize(overallTransitionState.extractedUrl), message, cancellationCode));
                  this.events.next(new RedirectRequest(navigationErrorHandlerResult.redirectTo, navigationErrorHandlerResult.navigationBehaviorOptions));
                } else {
                  this.events.next(navigationError);
                  throw e;
                }
              } catch (ee) {
                if (this.options.resolveNavigationPromiseOnError) {
                  overallTransitionState.resolve(false);
                } else {
                  overallTransitionState.reject(ee);
                }
              }
            }
            return EMPTY;
          })
        );
      })
    );
  }
  cancelNavigationTransition(t, reason, code) {
    const navCancel = new NavigationCancel(t.id, this.urlSerializer.serialize(t.extractedUrl), reason, code);
    this.events.next(navCancel);
    t.resolve(false);
  }
  /**
   * @returns Whether we're navigating to somewhere that is not what the Router is
   * currently set to.
   */
  isUpdatingInternalState() {
    return this.currentTransition?.extractedUrl.toString() !== this.currentTransition?.currentUrlTree.toString();
  }
  /**
   * @returns Whether we're updating the browser URL to something new (navigation is going
   * to somewhere not displayed in the URL bar and we will update the URL
   * bar if navigation succeeds).
   */
  isUpdatedBrowserUrl() {
    const currentBrowserUrl = this.urlHandlingStrategy.extract(this.urlSerializer.parse(this.location.path(true)));
    const targetBrowserUrl = this.currentNavigation?.targetBrowserUrl ?? this.currentNavigation?.extractedUrl;
    return currentBrowserUrl.toString() !== targetBrowserUrl?.toString() && !this.currentNavigation?.extras.skipLocationChange;
  }
  static \u0275fac = function NavigationTransitions_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _NavigationTransitions)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _NavigationTransitions,
    factory: _NavigationTransitions.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NavigationTransitions, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], () => [], null);
})();
function isBrowserTriggeredNavigation(source) {
  return source !== IMPERATIVE_NAVIGATION;
}
var RouteReuseStrategy = class _RouteReuseStrategy {
  static \u0275fac = function RouteReuseStrategy_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _RouteReuseStrategy)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _RouteReuseStrategy,
    factory: () => (() => inject2(DefaultRouteReuseStrategy))(),
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(RouteReuseStrategy, [{
    type: Injectable,
    args: [{
      providedIn: "root",
      useFactory: () => inject2(DefaultRouteReuseStrategy)
    }]
  }], null, null);
})();
var BaseRouteReuseStrategy = class {
  /**
   * Whether the given route should detach for later reuse.
   * Always returns false for `BaseRouteReuseStrategy`.
   * */
  shouldDetach(route) {
    return false;
  }
  /**
   * A no-op; the route is never stored since this strategy never detaches routes for later re-use.
   */
  store(route, detachedTree) {
  }
  /** Returns `false`, meaning the route (and its subtree) is never reattached */
  shouldAttach(route) {
    return false;
  }
  /** Returns `null` because this strategy does not store routes for later re-use. */
  retrieve(route) {
    return null;
  }
  /**
   * Determines if a route should be reused.
   * This strategy returns `true` when the future route config and current route config are
   * identical.
   */
  shouldReuseRoute(future, curr) {
    return future.routeConfig === curr.routeConfig;
  }
};
var DefaultRouteReuseStrategy = class _DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
  static \u0275fac = /* @__PURE__ */ (() => {
    let \u0275DefaultRouteReuseStrategy_BaseFactory;
    return function DefaultRouteReuseStrategy_Factory(__ngFactoryType__) {
      return (\u0275DefaultRouteReuseStrategy_BaseFactory || (\u0275DefaultRouteReuseStrategy_BaseFactory = \u0275\u0275getInheritedFactory(_DefaultRouteReuseStrategy)))(__ngFactoryType__ || _DefaultRouteReuseStrategy);
    };
  })();
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _DefaultRouteReuseStrategy,
    factory: _DefaultRouteReuseStrategy.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(DefaultRouteReuseStrategy, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], null, null);
})();
var StateManager = class _StateManager {
  urlSerializer = inject2(UrlSerializer);
  options = inject2(ROUTER_CONFIGURATION, {
    optional: true
  }) || {};
  canceledNavigationResolution = this.options.canceledNavigationResolution || "replace";
  location = inject2(Location);
  urlHandlingStrategy = inject2(UrlHandlingStrategy);
  urlUpdateStrategy = this.options.urlUpdateStrategy || "deferred";
  currentUrlTree = new UrlTree();
  /**
   * Returns the currently activated `UrlTree`.
   *
   * This `UrlTree` shows only URLs that the `Router` is configured to handle (through
   * `UrlHandlingStrategy`).
   *
   * The value is set after finding the route config tree to activate but before activating the
   * route.
   */
  getCurrentUrlTree() {
    return this.currentUrlTree;
  }
  rawUrlTree = this.currentUrlTree;
  /**
   * Returns a `UrlTree` that is represents what the browser is actually showing.
   *
   * In the life of a navigation transition:
   * 1. When a navigation begins, the raw `UrlTree` is updated to the full URL that's being
   * navigated to.
   * 2. During a navigation, redirects are applied, which might only apply to _part_ of the URL (due
   * to `UrlHandlingStrategy`).
   * 3. Just before activation, the raw `UrlTree` is updated to include the redirects on top of the
   * original raw URL.
   *
   * Note that this is _only_ here to support `UrlHandlingStrategy.extract` and
   * `UrlHandlingStrategy.shouldProcessUrl`. Without those APIs, the current `UrlTree` would not
   * deviated from the raw `UrlTree`.
   *
   * For `extract`, a raw `UrlTree` is needed because `extract` may only return part
   * of the navigation URL. Thus, the current `UrlTree` may only represent _part_ of the browser
   * URL. When a navigation gets cancelled and the router needs to reset the URL or a new navigation
   * occurs, it needs to know the _whole_ browser URL, not just the part handled by
   * `UrlHandlingStrategy`.
   * For `shouldProcessUrl`, when the return is `false`, the router ignores the navigation but
   * still updates the raw `UrlTree` with the assumption that the navigation was caused by the
   * location change listener due to a URL update by the AngularJS router. In this case, the router
   * still need to know what the browser's URL is for future navigations.
   */
  getRawUrlTree() {
    return this.rawUrlTree;
  }
  createBrowserPath({
    finalUrl,
    initialUrl,
    targetBrowserUrl
  }) {
    const rawUrl = finalUrl !== void 0 ? this.urlHandlingStrategy.merge(finalUrl, initialUrl) : initialUrl;
    const url = targetBrowserUrl ?? rawUrl;
    const path = url instanceof UrlTree ? this.urlSerializer.serialize(url) : url;
    return path;
  }
  commitTransition({
    targetRouterState,
    finalUrl,
    initialUrl
  }) {
    if (finalUrl && targetRouterState) {
      this.currentUrlTree = finalUrl;
      this.rawUrlTree = this.urlHandlingStrategy.merge(finalUrl, initialUrl);
      this.routerState = targetRouterState;
    } else {
      this.rawUrlTree = initialUrl;
    }
  }
  routerState = createEmptyState(null);
  /** Returns the current RouterState. */
  getRouterState() {
    return this.routerState;
  }
  stateMemento = this.createStateMemento();
  updateStateMemento() {
    this.stateMemento = this.createStateMemento();
  }
  createStateMemento() {
    return {
      rawUrlTree: this.rawUrlTree,
      currentUrlTree: this.currentUrlTree,
      routerState: this.routerState
    };
  }
  resetInternalState({
    finalUrl
  }) {
    this.routerState = this.stateMemento.routerState;
    this.currentUrlTree = this.stateMemento.currentUrlTree;
    this.rawUrlTree = this.urlHandlingStrategy.merge(this.currentUrlTree, finalUrl ?? this.rawUrlTree);
  }
  static \u0275fac = function StateManager_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _StateManager)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _StateManager,
    factory: () => (() => inject2(HistoryStateManager))(),
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(StateManager, [{
    type: Injectable,
    args: [{
      providedIn: "root",
      useFactory: () => inject2(HistoryStateManager)
    }]
  }], null, null);
})();
var HistoryStateManager = class _HistoryStateManager extends StateManager {
  /**
   * The id of the currently active page in the router.
   * Updated to the transition's target id on a successful navigation.
   *
   * This is used to track what page the router last activated. When an attempted navigation fails,
   * the router can then use this to compute how to restore the state back to the previously active
   * page.
   */
  currentPageId = 0;
  lastSuccessfulId = -1;
  restoredState() {
    return this.location.getState();
  }
  /**
   * The ɵrouterPageId of whatever page is currently active in the browser history. This is
   * important for computing the target page id for new navigations because we need to ensure each
   * page id in the browser history is 1 more than the previous entry.
   */
  get browserPageId() {
    if (this.canceledNavigationResolution !== "computed") {
      return this.currentPageId;
    }
    return this.restoredState()?.\u0275routerPageId ?? this.currentPageId;
  }
  registerNonRouterCurrentEntryChangeListener(listener) {
    return this.location.subscribe((event) => {
      if (event["type"] === "popstate") {
        setTimeout(() => {
          listener(event["url"], event.state, "popstate");
        });
      }
    });
  }
  handleRouterEvent(e, currentTransition) {
    if (e instanceof NavigationStart) {
      this.updateStateMemento();
    } else if (e instanceof NavigationSkipped) {
      this.commitTransition(currentTransition);
    } else if (e instanceof RoutesRecognized) {
      if (this.urlUpdateStrategy === "eager") {
        if (!currentTransition.extras.skipLocationChange) {
          this.setBrowserUrl(this.createBrowserPath(currentTransition), currentTransition);
        }
      }
    } else if (e instanceof BeforeActivateRoutes) {
      this.commitTransition(currentTransition);
      if (this.urlUpdateStrategy === "deferred" && !currentTransition.extras.skipLocationChange) {
        this.setBrowserUrl(this.createBrowserPath(currentTransition), currentTransition);
      }
    } else if (e instanceof NavigationCancel && e.code !== NavigationCancellationCode.SupersededByNewNavigation && e.code !== NavigationCancellationCode.Redirect) {
      this.restoreHistory(currentTransition);
    } else if (e instanceof NavigationError) {
      this.restoreHistory(currentTransition, true);
    } else if (e instanceof NavigationEnd) {
      this.lastSuccessfulId = e.id;
      this.currentPageId = this.browserPageId;
    }
  }
  setBrowserUrl(path, {
    extras,
    id
  }) {
    const {
      replaceUrl,
      state
    } = extras;
    if (this.location.isCurrentPathEqualTo(path) || !!replaceUrl) {
      const currentBrowserPageId = this.browserPageId;
      const newState = __spreadValues(__spreadValues({}, state), this.generateNgRouterState(id, currentBrowserPageId));
      this.location.replaceState(path, "", newState);
    } else {
      const newState = __spreadValues(__spreadValues({}, state), this.generateNgRouterState(id, this.browserPageId + 1));
      this.location.go(path, "", newState);
    }
  }
  /**
   * Performs the necessary rollback action to restore the browser URL to the
   * state before the transition.
   */
  restoreHistory(navigation, restoringFromCaughtError = false) {
    if (this.canceledNavigationResolution === "computed") {
      const currentBrowserPageId = this.browserPageId;
      const targetPagePosition = this.currentPageId - currentBrowserPageId;
      if (targetPagePosition !== 0) {
        this.location.historyGo(targetPagePosition);
      } else if (this.getCurrentUrlTree() === navigation.finalUrl && targetPagePosition === 0) {
        this.resetInternalState(navigation);
        this.resetUrlToCurrentUrlTree();
      } else ;
    } else if (this.canceledNavigationResolution === "replace") {
      if (restoringFromCaughtError) {
        this.resetInternalState(navigation);
      }
      this.resetUrlToCurrentUrlTree();
    }
  }
  resetUrlToCurrentUrlTree() {
    this.location.replaceState(this.urlSerializer.serialize(this.getRawUrlTree()), "", this.generateNgRouterState(this.lastSuccessfulId, this.currentPageId));
  }
  generateNgRouterState(navigationId, routerPageId) {
    if (this.canceledNavigationResolution === "computed") {
      return {
        navigationId,
        \u0275routerPageId: routerPageId
      };
    }
    return {
      navigationId
    };
  }
  static \u0275fac = /* @__PURE__ */ (() => {
    let \u0275HistoryStateManager_BaseFactory;
    return function HistoryStateManager_Factory(__ngFactoryType__) {
      return (\u0275HistoryStateManager_BaseFactory || (\u0275HistoryStateManager_BaseFactory = \u0275\u0275getInheritedFactory(_HistoryStateManager)))(__ngFactoryType__ || _HistoryStateManager);
    };
  })();
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _HistoryStateManager,
    factory: _HistoryStateManager.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HistoryStateManager, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], null, null);
})();
function afterNextNavigation(router, action) {
  router.events.pipe(filter((e) => e instanceof NavigationEnd || e instanceof NavigationCancel || e instanceof NavigationError || e instanceof NavigationSkipped), map((e) => {
    if (e instanceof NavigationEnd || e instanceof NavigationSkipped) {
      return 0;
    }
    const redirecting = e instanceof NavigationCancel ? e.code === NavigationCancellationCode.Redirect || e.code === NavigationCancellationCode.SupersededByNewNavigation : false;
    return redirecting ? 2 : 1;
  }), filter(
    (result) => result !== 2
    /* NavigationResult.REDIRECTING */
  ), take(1)).subscribe(() => {
    action();
  });
}
var exactMatchOptions = {
  paths: "exact",
  fragment: "ignored",
  matrixParams: "ignored",
  queryParams: "exact"
};
var subsetMatchOptions = {
  paths: "subset",
  fragment: "ignored",
  matrixParams: "ignored",
  queryParams: "subset"
};
var Router = class _Router {
  get currentUrlTree() {
    return this.stateManager.getCurrentUrlTree();
  }
  get rawUrlTree() {
    return this.stateManager.getRawUrlTree();
  }
  disposed = false;
  nonRouterCurrentEntryChangeSubscription;
  console = inject2(Console);
  stateManager = inject2(StateManager);
  options = inject2(ROUTER_CONFIGURATION, {
    optional: true
  }) || {};
  pendingTasks = inject2(PendingTasksInternal);
  urlUpdateStrategy = this.options.urlUpdateStrategy || "deferred";
  navigationTransitions = inject2(NavigationTransitions);
  urlSerializer = inject2(UrlSerializer);
  location = inject2(Location);
  urlHandlingStrategy = inject2(UrlHandlingStrategy);
  injector = inject2(EnvironmentInjector);
  /**
   * The private `Subject` type for the public events exposed in the getter. This is used internally
   * to push events to. The separate field allows us to expose separate types in the public API
   * (i.e., an Observable rather than the Subject).
   */
  _events = new Subject();
  /**
   * An event stream for routing events.
   */
  get events() {
    return this._events;
  }
  /**
   * The current state of routing in this NgModule.
   */
  get routerState() {
    return this.stateManager.getRouterState();
  }
  /**
   * True if at least one navigation event has occurred,
   * false otherwise.
   */
  navigated = false;
  /**
   * A strategy for re-using routes.
   *
   * @deprecated Configure using `providers` instead:
   *   `{provide: RouteReuseStrategy, useClass: MyStrategy}`.
   */
  routeReuseStrategy = inject2(RouteReuseStrategy);
  /**
   * How to handle a navigation request to the current URL.
   *
   *
   * @deprecated Configure this through `provideRouter` or `RouterModule.forRoot` instead.
   * @see {@link withRouterConfig}
   * @see {@link provideRouter}
   * @see {@link RouterModule}
   */
  onSameUrlNavigation = this.options.onSameUrlNavigation || "ignore";
  config = inject2(ROUTES, {
    optional: true
  })?.flat() ?? [];
  /**
   * Indicates whether the application has opted in to binding Router data to component inputs.
   *
   * This option is enabled by the `withComponentInputBinding` feature of `provideRouter` or
   * `bindToComponentInputs` in the `ExtraOptions` of `RouterModule.forRoot`.
   */
  componentInputBindingEnabled = !!inject2(INPUT_BINDER, {
    optional: true
  });
  constructor() {
    this.resetConfig(this.config);
    this.navigationTransitions.setupNavigations(this).subscribe({
      error: (e) => {
        this.console.warn(ngDevMode ? `Unhandled Navigation Error: ${e}` : e);
      }
    });
    this.subscribeToNavigationEvents();
  }
  eventsSubscription = new Subscription();
  subscribeToNavigationEvents() {
    const subscription = this.navigationTransitions.events.subscribe((e) => {
      try {
        const currentTransition = this.navigationTransitions.currentTransition;
        const currentNavigation = this.navigationTransitions.currentNavigation;
        if (currentTransition !== null && currentNavigation !== null) {
          this.stateManager.handleRouterEvent(e, currentNavigation);
          if (e instanceof NavigationCancel && e.code !== NavigationCancellationCode.Redirect && e.code !== NavigationCancellationCode.SupersededByNewNavigation) {
            this.navigated = true;
          } else if (e instanceof NavigationEnd) {
            this.navigated = true;
          } else if (e instanceof RedirectRequest) {
            const opts = e.navigationBehaviorOptions;
            const mergedTree = this.urlHandlingStrategy.merge(e.url, currentTransition.currentRawUrl);
            const extras = __spreadValues({
              browserUrl: currentTransition.extras.browserUrl,
              info: currentTransition.extras.info,
              skipLocationChange: currentTransition.extras.skipLocationChange,
              // The URL is already updated at this point if we have 'eager' URL
              // updates or if the navigation was triggered by the browser (back
              // button, URL bar, etc). We want to replace that item in history
              // if the navigation is rejected.
              replaceUrl: currentTransition.extras.replaceUrl || this.urlUpdateStrategy === "eager" || isBrowserTriggeredNavigation(currentTransition.source)
            }, opts);
            this.scheduleNavigation(mergedTree, IMPERATIVE_NAVIGATION, null, extras, {
              resolve: currentTransition.resolve,
              reject: currentTransition.reject,
              promise: currentTransition.promise
            });
          }
        }
        if (isPublicRouterEvent(e)) {
          this._events.next(e);
        }
      } catch (e2) {
        this.navigationTransitions.transitionAbortWithErrorSubject.next(e2);
      }
    });
    this.eventsSubscription.add(subscription);
  }
  /** @internal */
  resetRootComponentType(rootComponentType) {
    this.routerState.root.component = rootComponentType;
    this.navigationTransitions.rootComponentType = rootComponentType;
  }
  /**
   * Sets up the location change listener and performs the initial navigation.
   */
  initialNavigation() {
    this.setUpLocationChangeListener();
    if (!this.navigationTransitions.hasRequestedNavigation) {
      this.navigateToSyncWithBrowser(this.location.path(true), IMPERATIVE_NAVIGATION, this.stateManager.restoredState());
    }
  }
  /**
   * Sets up the location change listener. This listener detects navigations triggered from outside
   * the Router (the browser back/forward buttons, for example) and schedules a corresponding Router
   * navigation so that the correct events, guards, etc. are triggered.
   */
  setUpLocationChangeListener() {
    this.nonRouterCurrentEntryChangeSubscription ??= this.stateManager.registerNonRouterCurrentEntryChangeListener((url, state, source) => {
      this.navigateToSyncWithBrowser(url, source, state);
    });
  }
  /**
   * Schedules a router navigation to synchronize Router state with the browser state.
   *
   * This is done as a response to a popstate event and the initial navigation. These
   * two scenarios represent times when the browser URL/state has been updated and
   * the Router needs to respond to ensure its internal state matches.
   */
  navigateToSyncWithBrowser(url, source, state) {
    const extras = {
      replaceUrl: true
    };
    const restoredState = state?.navigationId ? state : null;
    if (state) {
      const stateCopy = __spreadValues({}, state);
      delete stateCopy.navigationId;
      delete stateCopy.\u0275routerPageId;
      if (Object.keys(stateCopy).length !== 0) {
        extras.state = stateCopy;
      }
    }
    const urlTree = this.parseUrl(url);
    this.scheduleNavigation(urlTree, source, restoredState, extras).catch((e) => {
      if (this.disposed) {
        return;
      }
      this.injector.get(INTERNAL_APPLICATION_ERROR_HANDLER)(e);
    });
  }
  /** The current URL. */
  get url() {
    return this.serializeUrl(this.currentUrlTree);
  }
  /**
   * Returns the current `Navigation` object when the router is navigating,
   * and `null` when idle.
   */
  getCurrentNavigation() {
    return this.navigationTransitions.currentNavigation;
  }
  /**
   * The `Navigation` object of the most recent navigation to succeed and `null` if there
   *     has not been a successful navigation yet.
   */
  get lastSuccessfulNavigation() {
    return this.navigationTransitions.lastSuccessfulNavigation;
  }
  /**
   * Resets the route configuration used for navigation and generating links.
   *
   * @param config The route array for the new configuration.
   *
   * @usageNotes
   *
   * ```ts
   * router.resetConfig([
   *  { path: 'team/:id', component: TeamCmp, children: [
   *    { path: 'simple', component: SimpleCmp },
   *    { path: 'user/:name', component: UserCmp }
   *  ]}
   * ]);
   * ```
   */
  resetConfig(config2) {
    (typeof ngDevMode === "undefined" || ngDevMode) && validateConfig(config2);
    this.config = config2.map(standardizeConfig);
    this.navigated = false;
  }
  /** @docs-private */
  ngOnDestroy() {
    this.dispose();
  }
  /** Disposes of the router. */
  dispose() {
    this._events.unsubscribe();
    this.navigationTransitions.complete();
    if (this.nonRouterCurrentEntryChangeSubscription) {
      this.nonRouterCurrentEntryChangeSubscription.unsubscribe();
      this.nonRouterCurrentEntryChangeSubscription = void 0;
    }
    this.disposed = true;
    this.eventsSubscription.unsubscribe();
  }
  /**
   * Appends URL segments to the current URL tree to create a new URL tree.
   *
   * @param commands An array of URL fragments with which to construct the new URL tree.
   * If the path is static, can be the literal URL string. For a dynamic path, pass an array of path
   * segments, followed by the parameters for each segment.
   * The fragments are applied to the current URL tree or the one provided  in the `relativeTo`
   * property of the options object, if supplied.
   * @param navigationExtras Options that control the navigation strategy.
   * @returns The new URL tree.
   *
   * @usageNotes
   *
   * ```
   * // create /team/33/user/11
   * router.createUrlTree(['/team', 33, 'user', 11]);
   *
   * // create /team/33;expand=true/user/11
   * router.createUrlTree(['/team', 33, {expand: true}, 'user', 11]);
   *
   * // you can collapse static segments like this (this works only with the first passed-in value):
   * router.createUrlTree(['/team/33/user', userId]);
   *
   * // If the first segment can contain slashes, and you do not want the router to split it,
   * // you can do the following:
   * router.createUrlTree([{segmentPath: '/one/two'}]);
   *
   * // create /team/33/(user/11//right:chat)
   * router.createUrlTree(['/team', 33, {outlets: {primary: 'user/11', right: 'chat'}}]);
   *
   * // remove the right secondary node
   * router.createUrlTree(['/team', 33, {outlets: {primary: 'user/11', right: null}}]);
   *
   * // assuming the current url is `/team/33/user/11` and the route points to `user/11`
   *
   * // navigate to /team/33/user/11/details
   * router.createUrlTree(['details'], {relativeTo: route});
   *
   * // navigate to /team/33/user/22
   * router.createUrlTree(['../22'], {relativeTo: route});
   *
   * // navigate to /team/44/user/22
   * router.createUrlTree(['../../team/44/user/22'], {relativeTo: route});
   *
   * Note that a value of `null` or `undefined` for `relativeTo` indicates that the
   * tree should be created relative to the root.
   * ```
   */
  createUrlTree(commands, navigationExtras = {}) {
    const {
      relativeTo,
      queryParams,
      fragment,
      queryParamsHandling,
      preserveFragment
    } = navigationExtras;
    const f = preserveFragment ? this.currentUrlTree.fragment : fragment;
    let q = null;
    switch (queryParamsHandling ?? this.options.defaultQueryParamsHandling) {
      case "merge":
        q = __spreadValues(__spreadValues({}, this.currentUrlTree.queryParams), queryParams);
        break;
      case "preserve":
        q = this.currentUrlTree.queryParams;
        break;
      default:
        q = queryParams || null;
    }
    if (q !== null) {
      q = this.removeEmptyProps(q);
    }
    let relativeToUrlSegmentGroup;
    try {
      const relativeToSnapshot = relativeTo ? relativeTo.snapshot : this.routerState.snapshot.root;
      relativeToUrlSegmentGroup = createSegmentGroupFromRoute(relativeToSnapshot);
    } catch (e) {
      if (typeof commands[0] !== "string" || commands[0][0] !== "/") {
        commands = [];
      }
      relativeToUrlSegmentGroup = this.currentUrlTree.root;
    }
    return createUrlTreeFromSegmentGroup(relativeToUrlSegmentGroup, commands, q, f ?? null);
  }
  /**
   * Navigates to a view using an absolute route path.
   *
   * @param url An absolute path for a defined route. The function does not apply any delta to the
   *     current URL.
   * @param extras An object containing properties that modify the navigation strategy.
   *
   * @returns A Promise that resolves to 'true' when navigation succeeds,
   * to 'false' when navigation fails, or is rejected on error.
   *
   * @usageNotes
   *
   * The following calls request navigation to an absolute path.
   *
   * ```ts
   * router.navigateByUrl("/team/33/user/11");
   *
   * // Navigate without updating the URL
   * router.navigateByUrl("/team/33/user/11", { skipLocationChange: true });
   * ```
   *
   * @see [Routing and Navigation guide](guide/routing/common-router-tasks)
   *
   */
  navigateByUrl(url, extras = {
    skipLocationChange: false
  }) {
    const urlTree = isUrlTree(url) ? url : this.parseUrl(url);
    const mergedTree = this.urlHandlingStrategy.merge(urlTree, this.rawUrlTree);
    return this.scheduleNavigation(mergedTree, IMPERATIVE_NAVIGATION, null, extras);
  }
  /**
   * Navigate based on the provided array of commands and a starting point.
   * If no starting route is provided, the navigation is absolute.
   *
   * @param commands An array of URL fragments with which to construct the target URL.
   * If the path is static, can be the literal URL string. For a dynamic path, pass an array of path
   * segments, followed by the parameters for each segment.
   * The fragments are applied to the current URL or the one provided  in the `relativeTo` property
   * of the options object, if supplied.
   * @param extras An options object that determines how the URL should be constructed or
   *     interpreted.
   *
   * @returns A Promise that resolves to `true` when navigation succeeds, or `false` when navigation
   *     fails. The Promise is rejected when an error occurs if `resolveNavigationPromiseOnError` is
   * not `true`.
   *
   * @usageNotes
   *
   * The following calls request navigation to a dynamic route path relative to the current URL.
   *
   * ```ts
   * router.navigate(['team', 33, 'user', 11], {relativeTo: route});
   *
   * // Navigate without updating the URL, overriding the default behavior
   * router.navigate(['team', 33, 'user', 11], {relativeTo: route, skipLocationChange: true});
   * ```
   *
   * @see [Routing and Navigation guide](guide/routing/common-router-tasks)
   *
   */
  navigate(commands, extras = {
    skipLocationChange: false
  }) {
    validateCommands(commands);
    return this.navigateByUrl(this.createUrlTree(commands, extras), extras);
  }
  /** Serializes a `UrlTree` into a string */
  serializeUrl(url) {
    return this.urlSerializer.serialize(url);
  }
  /** Parses a string into a `UrlTree` */
  parseUrl(url) {
    try {
      return this.urlSerializer.parse(url);
    } catch {
      return this.urlSerializer.parse("/");
    }
  }
  isActive(url, matchOptions) {
    let options;
    if (matchOptions === true) {
      options = __spreadValues({}, exactMatchOptions);
    } else if (matchOptions === false) {
      options = __spreadValues({}, subsetMatchOptions);
    } else {
      options = matchOptions;
    }
    if (isUrlTree(url)) {
      return containsTree(this.currentUrlTree, url, options);
    }
    const urlTree = this.parseUrl(url);
    return containsTree(this.currentUrlTree, urlTree, options);
  }
  removeEmptyProps(params) {
    return Object.entries(params).reduce((result, [key, value]) => {
      if (value !== null && value !== void 0) {
        result[key] = value;
      }
      return result;
    }, {});
  }
  scheduleNavigation(rawUrl, source, restoredState, extras, priorPromise) {
    if (this.disposed) {
      return Promise.resolve(false);
    }
    let resolve;
    let reject;
    let promise;
    if (priorPromise) {
      resolve = priorPromise.resolve;
      reject = priorPromise.reject;
      promise = priorPromise.promise;
    } else {
      promise = new Promise((res, rej) => {
        resolve = res;
        reject = rej;
      });
    }
    const taskId = this.pendingTasks.add();
    afterNextNavigation(this, () => {
      queueMicrotask(() => this.pendingTasks.remove(taskId));
    });
    this.navigationTransitions.handleNavigationRequest({
      source,
      restoredState,
      currentUrlTree: this.currentUrlTree,
      currentRawUrl: this.currentUrlTree,
      rawUrl,
      extras,
      resolve,
      reject,
      promise,
      currentSnapshot: this.routerState.snapshot,
      currentRouterState: this.routerState
    });
    return promise.catch((e) => {
      return Promise.reject(e);
    });
  }
  static \u0275fac = function Router_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _Router)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _Router,
    factory: _Router.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(Router, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], () => [], null);
})();
function validateCommands(commands) {
  for (let i = 0; i < commands.length; i++) {
    const cmd = commands[i];
    if (cmd == null) {
      throw new RuntimeError(4008, (typeof ngDevMode === "undefined" || ngDevMode) && `The requested path contains ${cmd} segment at index ${i}`);
    }
  }
}

// node_modules/@angular/router/fesm2022/router_module.mjs
var RouterLink = class _RouterLink {
  router;
  route;
  tabIndexAttribute;
  renderer;
  el;
  locationStrategy;
  /** @nodoc */
  reactiveHref = signal(null, ...ngDevMode ? [{
    debugName: "reactiveHref"
  }] : []);
  /**
   * Represents an `href` attribute value applied to a host element,
   * when a host element is an `<a>`/`<area>` tag or a compatible custom element.
   * For other tags, the value is `null`.
   */
  get href() {
    return untracked2(this.reactiveHref);
  }
  /** @deprecated */
  set href(value) {
    this.reactiveHref.set(value);
  }
  /**
   * Represents the `target` attribute on a host element.
   * This is only used when the host element is
   * an `<a>`/`<area>` tag or a compatible custom element.
   */
  target;
  /**
   * Passed to {@link Router#createUrlTree} as part of the
   * `UrlCreationOptions`.
   * @see {@link UrlCreationOptions#queryParams}
   * @see {@link Router#createUrlTree}
   */
  queryParams;
  /**
   * Passed to {@link Router#createUrlTree} as part of the
   * `UrlCreationOptions`.
   * @see {@link UrlCreationOptions#fragment}
   * @see {@link Router#createUrlTree}
   */
  fragment;
  /**
   * Passed to {@link Router#createUrlTree} as part of the
   * `UrlCreationOptions`.
   * @see {@link UrlCreationOptions#queryParamsHandling}
   * @see {@link Router#createUrlTree}
   */
  queryParamsHandling;
  /**
   * Passed to {@link Router#navigateByUrl} as part of the
   * `NavigationBehaviorOptions`.
   * @see {@link NavigationBehaviorOptions#state}
   * @see {@link Router#navigateByUrl}
   */
  state;
  /**
   * Passed to {@link Router#navigateByUrl} as part of the
   * `NavigationBehaviorOptions`.
   * @see {@link NavigationBehaviorOptions#info}
   * @see {@link Router#navigateByUrl}
   */
  info;
  /**
   * Passed to {@link Router#createUrlTree} as part of the
   * `UrlCreationOptions`.
   * Specify a value here when you do not want to use the default value
   * for `routerLink`, which is the current activated route.
   * Note that a value of `undefined` here will use the `routerLink` default.
   * @see {@link UrlCreationOptions#relativeTo}
   * @see {@link Router#createUrlTree}
   */
  relativeTo;
  /** Whether a host element is an `<a>`/`<area>` tag or a compatible custom element. */
  isAnchorElement;
  subscription;
  /** @internal */
  onChanges = new Subject();
  applicationErrorHandler = inject2(INTERNAL_APPLICATION_ERROR_HANDLER);
  options = inject2(ROUTER_CONFIGURATION, {
    optional: true
  });
  constructor(router, route, tabIndexAttribute, renderer, el, locationStrategy) {
    this.router = router;
    this.route = route;
    this.tabIndexAttribute = tabIndexAttribute;
    this.renderer = renderer;
    this.el = el;
    this.locationStrategy = locationStrategy;
    this.reactiveHref.set(inject2(new HostAttributeToken("href"), {
      optional: true
    }));
    const tagName = el.nativeElement.tagName?.toLowerCase();
    this.isAnchorElement = tagName === "a" || tagName === "area" || !!// Avoid breaking in an SSR context where customElements might not be defined.
    (typeof customElements === "object" && // observedAttributes is an optional static property/getter on a custom element.
    // The spec states that this must be an array of strings.
    customElements.get(tagName)?.observedAttributes?.includes?.("href"));
    if (!this.isAnchorElement) {
      this.subscribeToNavigationEventsIfNecessary();
    } else {
      this.setTabIndexIfNotOnNativeEl("0");
    }
  }
  subscribeToNavigationEventsIfNecessary() {
    if (this.subscription !== void 0 || !this.isAnchorElement) {
      return;
    }
    let createSubcription = this.preserveFragment;
    const dependsOnRouterState = (handling) => handling === "merge" || handling === "preserve";
    createSubcription ||= dependsOnRouterState(this.queryParamsHandling);
    createSubcription ||= !this.queryParamsHandling && !dependsOnRouterState(this.options?.defaultQueryParamsHandling);
    if (!createSubcription) {
      return;
    }
    this.subscription = this.router.events.subscribe((s) => {
      if (s instanceof NavigationEnd) {
        this.updateHref();
      }
    });
  }
  /**
   * Passed to {@link Router#createUrlTree} as part of the
   * `UrlCreationOptions`.
   * @see {@link UrlCreationOptions#preserveFragment}
   * @see {@link Router#createUrlTree}
   */
  preserveFragment = false;
  /**
   * Passed to {@link Router#navigateByUrl} as part of the
   * `NavigationBehaviorOptions`.
   * @see {@link NavigationBehaviorOptions#skipLocationChange}
   * @see {@link Router#navigateByUrl}
   */
  skipLocationChange = false;
  /**
   * Passed to {@link Router#navigateByUrl} as part of the
   * `NavigationBehaviorOptions`.
   * @see {@link NavigationBehaviorOptions#replaceUrl}
   * @see {@link Router#navigateByUrl}
   */
  replaceUrl = false;
  /**
   * Modifies the tab index if there was not a tabindex attribute on the element during
   * instantiation.
   */
  setTabIndexIfNotOnNativeEl(newTabIndex) {
    if (this.tabIndexAttribute != null || this.isAnchorElement) {
      return;
    }
    this.applyAttributeValue("tabindex", newTabIndex);
  }
  /** @docs-private */
  // TODO(atscott): Remove changes parameter in major version as a breaking change.
  ngOnChanges(changes) {
    if (ngDevMode && isUrlTree(this.routerLinkInput) && (this.fragment !== void 0 || this.queryParams || this.queryParamsHandling || this.preserveFragment || this.relativeTo)) {
      throw new RuntimeError(4016, "Cannot configure queryParams or fragment when using a UrlTree as the routerLink input value.");
    }
    if (this.isAnchorElement) {
      this.updateHref();
      this.subscribeToNavigationEventsIfNecessary();
    }
    this.onChanges.next(this);
  }
  routerLinkInput = null;
  /**
   * Commands to pass to {@link Router#createUrlTree} or a `UrlTree`.
   *   - **array**: commands to pass to {@link Router#createUrlTree}.
   *   - **string**: shorthand for array of commands with just the string, i.e. `['/route']`
   *   - **UrlTree**: a `UrlTree` for this link rather than creating one from the commands
   *     and other inputs that correspond to properties of `UrlCreationOptions`.
   *   - **null|undefined**: effectively disables the `routerLink`
   * @see {@link Router#createUrlTree}
   */
  set routerLink(commandsOrUrlTree) {
    if (commandsOrUrlTree == null) {
      this.routerLinkInput = null;
      this.setTabIndexIfNotOnNativeEl(null);
    } else {
      if (isUrlTree(commandsOrUrlTree)) {
        this.routerLinkInput = commandsOrUrlTree;
      } else {
        this.routerLinkInput = Array.isArray(commandsOrUrlTree) ? commandsOrUrlTree : [commandsOrUrlTree];
      }
      this.setTabIndexIfNotOnNativeEl("0");
    }
  }
  /** @docs-private */
  onClick(button, ctrlKey, shiftKey, altKey, metaKey) {
    const urlTree = this.urlTree;
    if (urlTree === null) {
      return true;
    }
    if (this.isAnchorElement) {
      if (button !== 0 || ctrlKey || shiftKey || altKey || metaKey) {
        return true;
      }
      if (typeof this.target === "string" && this.target != "_self") {
        return true;
      }
    }
    const extras = {
      skipLocationChange: this.skipLocationChange,
      replaceUrl: this.replaceUrl,
      state: this.state,
      info: this.info
    };
    this.router.navigateByUrl(urlTree, extras)?.catch((e) => {
      this.applicationErrorHandler(e);
    });
    return !this.isAnchorElement;
  }
  /** @docs-private */
  ngOnDestroy() {
    this.subscription?.unsubscribe();
  }
  updateHref() {
    const urlTree = this.urlTree;
    this.reactiveHref.set(urlTree !== null && this.locationStrategy ? this.locationStrategy?.prepareExternalUrl(this.router.serializeUrl(urlTree)) ?? "" : null);
  }
  applyAttributeValue(attrName, attrValue) {
    const renderer = this.renderer;
    const nativeElement = this.el.nativeElement;
    if (attrValue !== null) {
      renderer.setAttribute(nativeElement, attrName, attrValue);
    } else {
      renderer.removeAttribute(nativeElement, attrName);
    }
  }
  get urlTree() {
    if (this.routerLinkInput === null) {
      return null;
    } else if (isUrlTree(this.routerLinkInput)) {
      return this.routerLinkInput;
    }
    return this.router.createUrlTree(this.routerLinkInput, {
      // If the `relativeTo` input is not defined, we want to use `this.route` by default.
      // Otherwise, we should use the value provided by the user in the input.
      relativeTo: this.relativeTo !== void 0 ? this.relativeTo : this.route,
      queryParams: this.queryParams,
      fragment: this.fragment,
      queryParamsHandling: this.queryParamsHandling,
      preserveFragment: this.preserveFragment
    });
  }
  static \u0275fac = function RouterLink_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _RouterLink)(\u0275\u0275directiveInject(Router), \u0275\u0275directiveInject(ActivatedRoute), \u0275\u0275injectAttribute("tabindex"), \u0275\u0275directiveInject(Renderer2), \u0275\u0275directiveInject(ElementRef), \u0275\u0275directiveInject(LocationStrategy));
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _RouterLink,
    selectors: [["", "routerLink", ""]],
    hostVars: 2,
    hostBindings: function RouterLink_HostBindings(rf, ctx) {
      if (rf & 1) {
        \u0275\u0275listener("click", function RouterLink_click_HostBindingHandler($event) {
          return ctx.onClick($event.button, $event.ctrlKey, $event.shiftKey, $event.altKey, $event.metaKey);
        });
      }
      if (rf & 2) {
        \u0275\u0275attribute("href", ctx.reactiveHref(), \u0275\u0275sanitizeUrlOrResourceUrl)("target", ctx.target);
      }
    },
    inputs: {
      target: "target",
      queryParams: "queryParams",
      fragment: "fragment",
      queryParamsHandling: "queryParamsHandling",
      state: "state",
      info: "info",
      relativeTo: "relativeTo",
      preserveFragment: [2, "preserveFragment", "preserveFragment", booleanAttribute],
      skipLocationChange: [2, "skipLocationChange", "skipLocationChange", booleanAttribute],
      replaceUrl: [2, "replaceUrl", "replaceUrl", booleanAttribute],
      routerLink: "routerLink"
    },
    features: [\u0275\u0275NgOnChangesFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(RouterLink, [{
    type: Directive,
    args: [{
      selector: "[routerLink]",
      host: {
        "[attr.href]": "reactiveHref()"
      }
    }]
  }], () => [{
    type: Router
  }, {
    type: ActivatedRoute
  }, {
    type: void 0,
    decorators: [{
      type: Attribute,
      args: ["tabindex"]
    }]
  }, {
    type: Renderer2
  }, {
    type: ElementRef
  }, {
    type: LocationStrategy
  }], {
    target: [{
      type: HostBinding,
      args: ["attr.target"]
    }, {
      type: Input
    }],
    queryParams: [{
      type: Input
    }],
    fragment: [{
      type: Input
    }],
    queryParamsHandling: [{
      type: Input
    }],
    state: [{
      type: Input
    }],
    info: [{
      type: Input
    }],
    relativeTo: [{
      type: Input
    }],
    preserveFragment: [{
      type: Input,
      args: [{
        transform: booleanAttribute
      }]
    }],
    skipLocationChange: [{
      type: Input,
      args: [{
        transform: booleanAttribute
      }]
    }],
    replaceUrl: [{
      type: Input,
      args: [{
        transform: booleanAttribute
      }]
    }],
    routerLink: [{
      type: Input
    }],
    onClick: [{
      type: HostListener,
      args: ["click", ["$event.button", "$event.ctrlKey", "$event.shiftKey", "$event.altKey", "$event.metaKey"]]
    }]
  });
})();
var RouterLinkActive = class _RouterLinkActive {
  router;
  element;
  renderer;
  cdr;
  link;
  links;
  classes = [];
  routerEventsSubscription;
  linkInputChangesSubscription;
  _isActive = false;
  get isActive() {
    return this._isActive;
  }
  /**
   * Options to configure how to determine if the router link is active.
   *
   * These options are passed to the `Router.isActive()` function.
   *
   * @see {@link Router#isActive}
   */
  routerLinkActiveOptions = {
    exact: false
  };
  /**
   * Aria-current attribute to apply when the router link is active.
   *
   * Possible values: `'page'` | `'step'` | `'location'` | `'date'` | `'time'` | `true` | `false`.
   *
   * @see {@link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current}
   */
  ariaCurrentWhenActive;
  /**
   *
   * You can use the output `isActiveChange` to get notified each time the link becomes
   * active or inactive.
   *
   * Emits:
   * true  -> Route is active
   * false -> Route is inactive
   *
   * ```html
   * <a
   *  routerLink="/user/bob"
   *  routerLinkActive="active-link"
   *  (isActiveChange)="this.onRouterLinkActive($event)">Bob</a>
   * ```
   */
  isActiveChange = new EventEmitter();
  constructor(router, element, renderer, cdr, link) {
    this.router = router;
    this.element = element;
    this.renderer = renderer;
    this.cdr = cdr;
    this.link = link;
    this.routerEventsSubscription = router.events.subscribe((s) => {
      if (s instanceof NavigationEnd) {
        this.update();
      }
    });
  }
  /** @docs-private */
  ngAfterContentInit() {
    of(this.links.changes, of(null)).pipe(mergeAll()).subscribe((_4) => {
      this.update();
      this.subscribeToEachLinkOnChanges();
    });
  }
  subscribeToEachLinkOnChanges() {
    this.linkInputChangesSubscription?.unsubscribe();
    const allLinkChanges = [...this.links.toArray(), this.link].filter((link) => !!link).map((link) => link.onChanges);
    this.linkInputChangesSubscription = from(allLinkChanges).pipe(mergeAll()).subscribe((link) => {
      if (this._isActive !== this.isLinkActive(this.router)(link)) {
        this.update();
      }
    });
  }
  set routerLinkActive(data) {
    const classes = Array.isArray(data) ? data : data.split(" ");
    this.classes = classes.filter((c) => !!c);
  }
  /** @docs-private */
  ngOnChanges(changes) {
    this.update();
  }
  /** @docs-private */
  ngOnDestroy() {
    this.routerEventsSubscription.unsubscribe();
    this.linkInputChangesSubscription?.unsubscribe();
  }
  update() {
    if (!this.links || !this.router.navigated) return;
    queueMicrotask(() => {
      const hasActiveLinks = this.hasActiveLinks();
      this.classes.forEach((c) => {
        if (hasActiveLinks) {
          this.renderer.addClass(this.element.nativeElement, c);
        } else {
          this.renderer.removeClass(this.element.nativeElement, c);
        }
      });
      if (hasActiveLinks && this.ariaCurrentWhenActive !== void 0) {
        this.renderer.setAttribute(this.element.nativeElement, "aria-current", this.ariaCurrentWhenActive.toString());
      } else {
        this.renderer.removeAttribute(this.element.nativeElement, "aria-current");
      }
      if (this._isActive !== hasActiveLinks) {
        this._isActive = hasActiveLinks;
        this.cdr.markForCheck();
        this.isActiveChange.emit(hasActiveLinks);
      }
    });
  }
  isLinkActive(router) {
    const options = isActiveMatchOptions(this.routerLinkActiveOptions) ? this.routerLinkActiveOptions : (
      // While the types should disallow `undefined` here, it's possible without strict inputs
      this.routerLinkActiveOptions.exact || false
    );
    return (link) => {
      const urlTree = link.urlTree;
      return urlTree ? router.isActive(urlTree, options) : false;
    };
  }
  hasActiveLinks() {
    const isActiveCheckFn = this.isLinkActive(this.router);
    return this.link && isActiveCheckFn(this.link) || this.links.some(isActiveCheckFn);
  }
  static \u0275fac = function RouterLinkActive_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _RouterLinkActive)(\u0275\u0275directiveInject(Router), \u0275\u0275directiveInject(ElementRef), \u0275\u0275directiveInject(Renderer2), \u0275\u0275directiveInject(ChangeDetectorRef), \u0275\u0275directiveInject(RouterLink, 8));
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _RouterLinkActive,
    selectors: [["", "routerLinkActive", ""]],
    contentQueries: function RouterLinkActive_ContentQueries(rf, ctx, dirIndex) {
      if (rf & 1) {
        \u0275\u0275contentQuery(dirIndex, RouterLink, 5);
      }
      if (rf & 2) {
        let _t;
        \u0275\u0275queryRefresh(_t = \u0275\u0275loadQuery()) && (ctx.links = _t);
      }
    },
    inputs: {
      routerLinkActiveOptions: "routerLinkActiveOptions",
      ariaCurrentWhenActive: "ariaCurrentWhenActive",
      routerLinkActive: "routerLinkActive"
    },
    outputs: {
      isActiveChange: "isActiveChange"
    },
    exportAs: ["routerLinkActive"],
    features: [\u0275\u0275NgOnChangesFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(RouterLinkActive, [{
    type: Directive,
    args: [{
      selector: "[routerLinkActive]",
      exportAs: "routerLinkActive"
    }]
  }], () => [{
    type: Router
  }, {
    type: ElementRef
  }, {
    type: Renderer2
  }, {
    type: ChangeDetectorRef
  }, {
    type: RouterLink,
    decorators: [{
      type: Optional
    }]
  }], {
    links: [{
      type: ContentChildren,
      args: [RouterLink, {
        descendants: true
      }]
    }],
    routerLinkActiveOptions: [{
      type: Input
    }],
    ariaCurrentWhenActive: [{
      type: Input
    }],
    isActiveChange: [{
      type: Output
    }],
    routerLinkActive: [{
      type: Input
    }]
  });
})();
function isActiveMatchOptions(options) {
  return !!options.paths;
}
var PreloadingStrategy = class {
};
var PreloadAllModules = class _PreloadAllModules {
  preload(route, fn) {
    return fn().pipe(catchError(() => of(null)));
  }
  static \u0275fac = function PreloadAllModules_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _PreloadAllModules)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _PreloadAllModules,
    factory: _PreloadAllModules.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PreloadAllModules, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], null, null);
})();
var NoPreloading = class _NoPreloading {
  preload(route, fn) {
    return of(null);
  }
  static \u0275fac = function NoPreloading_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _NoPreloading)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _NoPreloading,
    factory: _NoPreloading.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NoPreloading, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], null, null);
})();
var RouterPreloader = class _RouterPreloader {
  router;
  injector;
  preloadingStrategy;
  loader;
  subscription;
  constructor(router, injector, preloadingStrategy, loader) {
    this.router = router;
    this.injector = injector;
    this.preloadingStrategy = preloadingStrategy;
    this.loader = loader;
  }
  setUpPreloading() {
    this.subscription = this.router.events.pipe(filter((e) => e instanceof NavigationEnd), concatMap(() => this.preload())).subscribe(() => {
    });
  }
  preload() {
    return this.processRoutes(this.injector, this.router.config);
  }
  /** @docs-private */
  ngOnDestroy() {
    if (this.subscription) {
      this.subscription.unsubscribe();
    }
  }
  processRoutes(injector, routes2) {
    const res = [];
    for (const route of routes2) {
      if (route.providers && !route._injector) {
        route._injector = createEnvironmentInjector(route.providers, injector, `Route: ${route.path}`);
      }
      const injectorForCurrentRoute = route._injector ?? injector;
      const injectorForChildren = route._loadedInjector ?? injectorForCurrentRoute;
      if (route.loadChildren && !route._loadedRoutes && route.canLoad === void 0 || route.loadComponent && !route._loadedComponent) {
        res.push(this.preloadConfig(injectorForCurrentRoute, route));
      }
      if (route.children || route._loadedRoutes) {
        res.push(this.processRoutes(injectorForChildren, route.children ?? route._loadedRoutes));
      }
    }
    return from(res).pipe(mergeAll());
  }
  preloadConfig(injector, route) {
    return this.preloadingStrategy.preload(route, () => {
      let loadedChildren$;
      if (route.loadChildren && route.canLoad === void 0) {
        loadedChildren$ = this.loader.loadChildren(injector, route);
      } else {
        loadedChildren$ = of(null);
      }
      const recursiveLoadChildren$ = loadedChildren$.pipe(mergeMap((config2) => {
        if (config2 === null) {
          return of(void 0);
        }
        route._loadedRoutes = config2.routes;
        route._loadedInjector = config2.injector;
        return this.processRoutes(config2.injector ?? injector, config2.routes);
      }));
      if (route.loadComponent && !route._loadedComponent) {
        const loadComponent$ = this.loader.loadComponent(injector, route);
        return from([recursiveLoadChildren$, loadComponent$]).pipe(mergeAll());
      } else {
        return recursiveLoadChildren$;
      }
    });
  }
  static \u0275fac = function RouterPreloader_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _RouterPreloader)(\u0275\u0275inject(Router), \u0275\u0275inject(EnvironmentInjector), \u0275\u0275inject(PreloadingStrategy), \u0275\u0275inject(RouterConfigLoader));
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _RouterPreloader,
    factory: _RouterPreloader.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(RouterPreloader, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], () => [{
    type: Router
  }, {
    type: EnvironmentInjector
  }, {
    type: PreloadingStrategy
  }, {
    type: RouterConfigLoader
  }], null);
})();
var ROUTER_SCROLLER = new InjectionToken("");
var RouterScroller = class _RouterScroller {
  urlSerializer;
  transitions;
  viewportScroller;
  zone;
  options;
  routerEventsSubscription;
  scrollEventsSubscription;
  lastId = 0;
  lastSource = IMPERATIVE_NAVIGATION;
  restoredId = 0;
  store = {};
  /** @docs-private */
  constructor(urlSerializer, transitions, viewportScroller, zone, options = {}) {
    this.urlSerializer = urlSerializer;
    this.transitions = transitions;
    this.viewportScroller = viewportScroller;
    this.zone = zone;
    this.options = options;
    options.scrollPositionRestoration ||= "disabled";
    options.anchorScrolling ||= "disabled";
  }
  init() {
    if (this.options.scrollPositionRestoration !== "disabled") {
      this.viewportScroller.setHistoryScrollRestoration("manual");
    }
    this.routerEventsSubscription = this.createScrollEvents();
    this.scrollEventsSubscription = this.consumeScrollEvents();
  }
  createScrollEvents() {
    return this.transitions.events.subscribe((e) => {
      if (e instanceof NavigationStart) {
        this.store[this.lastId] = this.viewportScroller.getScrollPosition();
        this.lastSource = e.navigationTrigger;
        this.restoredId = e.restoredState ? e.restoredState.navigationId : 0;
      } else if (e instanceof NavigationEnd) {
        this.lastId = e.id;
        this.scheduleScrollEvent(e, this.urlSerializer.parse(e.urlAfterRedirects).fragment);
      } else if (e instanceof NavigationSkipped && e.code === NavigationSkippedCode.IgnoredSameUrlNavigation) {
        this.lastSource = void 0;
        this.restoredId = 0;
        this.scheduleScrollEvent(e, this.urlSerializer.parse(e.url).fragment);
      }
    });
  }
  consumeScrollEvents() {
    return this.transitions.events.subscribe((e) => {
      if (!(e instanceof Scroll)) return;
      if (e.position) {
        if (this.options.scrollPositionRestoration === "top") {
          this.viewportScroller.scrollToPosition([0, 0]);
        } else if (this.options.scrollPositionRestoration === "enabled") {
          this.viewportScroller.scrollToPosition(e.position);
        }
      } else {
        if (e.anchor && this.options.anchorScrolling === "enabled") {
          this.viewportScroller.scrollToAnchor(e.anchor);
        } else if (this.options.scrollPositionRestoration !== "disabled") {
          this.viewportScroller.scrollToPosition([0, 0]);
        }
      }
    });
  }
  scheduleScrollEvent(routerEvent, anchor) {
    this.zone.runOutsideAngular(async () => {
      await new Promise((resolve) => {
        setTimeout(resolve);
        if (typeof requestAnimationFrame !== "undefined") {
          requestAnimationFrame(resolve);
        }
      });
      this.zone.run(() => {
        this.transitions.events.next(new Scroll(routerEvent, this.lastSource === "popstate" ? this.store[this.restoredId] : null, anchor));
      });
    });
  }
  /** @docs-private */
  ngOnDestroy() {
    this.routerEventsSubscription?.unsubscribe();
    this.scrollEventsSubscription?.unsubscribe();
  }
  static \u0275fac = function RouterScroller_Factory(__ngFactoryType__) {
    \u0275\u0275invalidFactory();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _RouterScroller,
    factory: _RouterScroller.\u0275fac
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(RouterScroller, [{
    type: Injectable
  }], () => [{
    type: UrlSerializer
  }, {
    type: NavigationTransitions
  }, {
    type: ViewportScroller
  }, {
    type: NgZone
  }, {
    type: void 0
  }], null);
})();
function provideRouter(routes2, ...features) {
  return makeEnvironmentProviders([{
    provide: ROUTES,
    multi: true,
    useValue: routes2
  }, typeof ngDevMode === "undefined" || ngDevMode ? {
    provide: ROUTER_IS_PROVIDED,
    useValue: true
  } : [], {
    provide: ActivatedRoute,
    useFactory: rootRoute,
    deps: [Router]
  }, {
    provide: APP_BOOTSTRAP_LISTENER,
    multi: true,
    useFactory: getBootstrapListener
  }, features.map((feature) => feature.\u0275providers)]);
}
function rootRoute(router) {
  return router.routerState.root;
}
function routerFeature(kind, providers) {
  return {
    \u0275kind: kind,
    \u0275providers: providers
  };
}
var ROUTER_IS_PROVIDED = new InjectionToken("", {
  providedIn: "root",
  factory: () => false
});
function getBootstrapListener() {
  const injector = inject2(Injector);
  return (bootstrappedComponentRef) => {
    const ref = injector.get(ApplicationRef);
    if (bootstrappedComponentRef !== ref.components[0]) {
      return;
    }
    const router = injector.get(Router);
    const bootstrapDone = injector.get(BOOTSTRAP_DONE);
    if (injector.get(INITIAL_NAVIGATION) === 1) {
      router.initialNavigation();
    }
    injector.get(ROUTER_PRELOADER, null, {
      optional: true
    })?.setUpPreloading();
    injector.get(ROUTER_SCROLLER, null, {
      optional: true
    })?.init();
    router.resetRootComponentType(ref.componentTypes[0]);
    if (!bootstrapDone.closed) {
      bootstrapDone.next();
      bootstrapDone.complete();
      bootstrapDone.unsubscribe();
    }
  };
}
var BOOTSTRAP_DONE = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "bootstrap done indicator" : "", {
  factory: () => {
    return new Subject();
  }
});
var INITIAL_NAVIGATION = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "initial navigation" : "", {
  providedIn: "root",
  factory: () => 1
  /* InitialNavigation.EnabledNonBlocking */
});
function withEnabledBlockingInitialNavigation() {
  const providers = [{
    provide: INITIAL_NAVIGATION,
    useValue: 0
    /* InitialNavigation.EnabledBlocking */
  }, provideAppInitializer(() => {
    const injector = inject2(Injector);
    const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve());
    return locationInitialized.then(() => {
      return new Promise((resolve) => {
        const router = injector.get(Router);
        const bootstrapDone = injector.get(BOOTSTRAP_DONE);
        afterNextNavigation(router, () => {
          resolve(true);
        });
        injector.get(NavigationTransitions).afterPreactivation = () => {
          resolve(true);
          return bootstrapDone.closed ? of(void 0) : bootstrapDone;
        };
        router.initialNavigation();
      });
    });
  })];
  return routerFeature(2, providers);
}
function withDisabledInitialNavigation() {
  const providers = [provideAppInitializer(() => {
    inject2(Router).setUpLocationChangeListener();
  }), {
    provide: INITIAL_NAVIGATION,
    useValue: 2
    /* InitialNavigation.Disabled */
  }];
  return routerFeature(3, providers);
}
function withDebugTracing() {
  let providers = [];
  if (typeof ngDevMode === "undefined" || ngDevMode) {
    providers = [{
      provide: ENVIRONMENT_INITIALIZER,
      multi: true,
      useFactory: () => {
        const router = inject2(Router);
        return () => router.events.subscribe((e) => {
          console.group?.(`Router Event: ${e.constructor.name}`);
          console.log(stringifyEvent(e));
          console.log(e);
          console.groupEnd?.();
        });
      }
    }];
  } else {
    providers = [];
  }
  return routerFeature(1, providers);
}
var ROUTER_PRELOADER = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "router preloader" : "");
function withPreloading(preloadingStrategy) {
  const providers = [{
    provide: ROUTER_PRELOADER,
    useExisting: RouterPreloader
  }, {
    provide: PreloadingStrategy,
    useExisting: preloadingStrategy
  }];
  return routerFeature(0, providers);
}
function withComponentInputBinding() {
  const providers = [RoutedComponentInputBinder, {
    provide: INPUT_BINDER,
    useExisting: RoutedComponentInputBinder
  }];
  return routerFeature(8, providers);
}
function withViewTransitions(options) {
  performanceMarkFeature("NgRouterViewTransitions");
  const providers = [{
    provide: CREATE_VIEW_TRANSITION,
    useValue: createViewTransition
  }, {
    provide: VIEW_TRANSITION_OPTIONS,
    useValue: __spreadValues({
      skipNextTransition: !!options?.skipInitialTransition
    }, options)
  }];
  return routerFeature(9, providers);
}
var ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkActive, \u0275EmptyOutletComponent];
var ROUTER_FORROOT_GUARD = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "router duplicate forRoot guard" : "");
var ROUTER_PROVIDERS = [
  Location,
  {
    provide: UrlSerializer,
    useClass: DefaultUrlSerializer
  },
  Router,
  ChildrenOutletContexts,
  {
    provide: ActivatedRoute,
    useFactory: rootRoute,
    deps: [Router]
  },
  RouterConfigLoader,
  // Only used to warn when `provideRoutes` is used without `RouterModule` or `provideRouter`. Can
  // be removed when `provideRoutes` is removed.
  typeof ngDevMode === "undefined" || ngDevMode ? {
    provide: ROUTER_IS_PROVIDED,
    useValue: true
  } : []
];
var RouterModule = class _RouterModule {
  constructor() {
    if (typeof ngDevMode === "undefined" || ngDevMode) {
      inject2(ROUTER_FORROOT_GUARD, {
        optional: true
      });
    }
  }
  /**
   * Creates and configures a module with all the router providers and directives.
   * Optionally sets up an application listener to perform an initial navigation.
   *
   * When registering the NgModule at the root, import as follows:
   *
   * ```ts
   * @NgModule({
   *   imports: [RouterModule.forRoot(ROUTES)]
   * })
   * class MyNgModule {}
   * ```
   *
   * @param routes An array of `Route` objects that define the navigation paths for the application.
   * @param config An `ExtraOptions` configuration object that controls how navigation is performed.
   * @return The new `NgModule`.
   *
   */
  static forRoot(routes2, config2) {
    return {
      ngModule: _RouterModule,
      providers: [ROUTER_PROVIDERS, typeof ngDevMode === "undefined" || ngDevMode ? config2?.enableTracing ? withDebugTracing().\u0275providers : [] : [], {
        provide: ROUTES,
        multi: true,
        useValue: routes2
      }, typeof ngDevMode === "undefined" || ngDevMode ? {
        provide: ROUTER_FORROOT_GUARD,
        useFactory: provideForRootGuard,
        deps: [[Router, new Optional(), new SkipSelf()]]
      } : [], config2?.errorHandler ? {
        provide: NAVIGATION_ERROR_HANDLER,
        useValue: config2.errorHandler
      } : [], {
        provide: ROUTER_CONFIGURATION,
        useValue: config2 ? config2 : {}
      }, config2?.useHash ? provideHashLocationStrategy() : providePathLocationStrategy(), provideRouterScroller(), config2?.preloadingStrategy ? withPreloading(config2.preloadingStrategy).\u0275providers : [], config2?.initialNavigation ? provideInitialNavigation(config2) : [], config2?.bindToComponentInputs ? withComponentInputBinding().\u0275providers : [], config2?.enableViewTransitions ? withViewTransitions().\u0275providers : [], provideRouterInitializer()]
    };
  }
  /**
   * Creates a module with all the router directives and a provider registering routes,
   * without creating a new Router service.
   * When registering for submodules and lazy-loaded submodules, create the NgModule as follows:
   *
   * ```ts
   * @NgModule({
   *   imports: [RouterModule.forChild(ROUTES)]
   * })
   * class MyNgModule {}
   * ```
   *
   * @param routes An array of `Route` objects that define the navigation paths for the submodule.
   * @return The new NgModule.
   *
   */
  static forChild(routes2) {
    return {
      ngModule: _RouterModule,
      providers: [{
        provide: ROUTES,
        multi: true,
        useValue: routes2
      }]
    };
  }
  static \u0275fac = function RouterModule_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _RouterModule)();
  };
  static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
    type: _RouterModule,
    imports: [RouterOutlet, RouterLink, RouterLinkActive, \u0275EmptyOutletComponent],
    exports: [RouterOutlet, RouterLink, RouterLinkActive, \u0275EmptyOutletComponent]
  });
  static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({});
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(RouterModule, [{
    type: NgModule,
    args: [{
      imports: ROUTER_DIRECTIVES,
      exports: ROUTER_DIRECTIVES
    }]
  }], () => [], null);
})();
function provideRouterScroller() {
  return {
    provide: ROUTER_SCROLLER,
    useFactory: () => {
      const viewportScroller = inject2(ViewportScroller);
      const zone = inject2(NgZone);
      const config2 = inject2(ROUTER_CONFIGURATION);
      const transitions = inject2(NavigationTransitions);
      const urlSerializer = inject2(UrlSerializer);
      if (config2.scrollOffset) {
        viewportScroller.setOffset(config2.scrollOffset);
      }
      return new RouterScroller(urlSerializer, transitions, viewportScroller, zone, config2);
    }
  };
}
function provideHashLocationStrategy() {
  return {
    provide: LocationStrategy,
    useClass: HashLocationStrategy
  };
}
function providePathLocationStrategy() {
  return {
    provide: LocationStrategy,
    useClass: PathLocationStrategy
  };
}
function provideForRootGuard(router) {
  if (router) {
    throw new RuntimeError(4007, `The Router was provided more than once. This can happen if 'forRoot' is used outside of the root injector. Lazy loaded modules should use RouterModule.forChild() instead.`);
  }
  return "guarded";
}
function provideInitialNavigation(config2) {
  return [config2.initialNavigation === "disabled" ? withDisabledInitialNavigation().\u0275providers : [], config2.initialNavigation === "enabledBlocking" ? withEnabledBlockingInitialNavigation().\u0275providers : []];
}
var ROUTER_INITIALIZER = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "Router Initializer" : "");
function provideRouterInitializer() {
  return [
    // ROUTER_INITIALIZER token should be removed. It's public API but shouldn't be. We can just
    // have `getBootstrapListener` directly attached to APP_BOOTSTRAP_LISTENER.
    {
      provide: ROUTER_INITIALIZER,
      useFactory: getBootstrapListener
    },
    {
      provide: APP_BOOTSTRAP_LISTENER,
      multi: true,
      useExisting: ROUTER_INITIALIZER
    }
  ];
}

// node_modules/@angular/router/fesm2022/router.mjs
var VERSION4 = new Version("20.1.3");

// src/app/rpc.service.ts
var RpcService = class _RpcService {
  http = inject2(HttpClient);
  callObservable(method, params) {
    return this.http.post(`/app/v0/rpc/${method}`, params ?? null, {
      headers: { "Content-type": "application/json" }
    });
  }
  call(method, params) {
    const observable2 = this.callObservable(method, params);
    return firstValueFrom(observable2);
  }
  static \u0275fac = function RpcService_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _RpcService)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _RpcService, factory: _RpcService.\u0275fac, providedIn: "root" });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(RpcService, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], null, null);
})();

// src/app/project-info.ts
var ProjectInfo = class {
  // absolute path on server filesystem
  data_dir;
  // absolute path on server filesystem
  model_dir;
  views;
  keypoint_names;
  constructor(projectInfo) {
    this.data_dir = String(projectInfo.data_dir);
    this.model_dir = String(projectInfo.model_dir);
    this.views = projectInfo.views ?? [];
    this.keypoint_names = projectInfo.keypoint_names ?? [];
  }
};

// node_modules/@angular/core/fesm2022/rxjs-interop.mjs
function takeUntilDestroyed(destroyRef) {
  if (!destroyRef) {
    ngDevMode && assertInInjectionContext(takeUntilDestroyed);
    destroyRef = inject2(DestroyRef);
  }
  const destroyed$ = new Observable((subscriber) => {
    if (destroyRef.destroyed) {
      subscriber.next();
      return;
    }
    const unregisterFn = destroyRef.onDestroy(subscriber.next.bind(subscriber));
    return unregisterFn;
  });
  return (source) => {
    return source.pipe(takeUntil(destroyed$));
  };
}
function toSignal(source, options) {
  typeof ngDevMode !== "undefined" && ngDevMode && assertNotInReactiveContext(toSignal, "Invoking `toSignal` causes new subscriptions every time. Consider moving `toSignal` outside of the reactive context and read the signal value where needed.");
  const requiresCleanup = !options?.manualCleanup;
  if (ngDevMode && requiresCleanup && !options?.injector) {
    assertInInjectionContext(toSignal);
  }
  const cleanupRef = requiresCleanup ? options?.injector?.get(DestroyRef) ?? inject2(DestroyRef) : null;
  const equal = makeToSignalEqual(options?.equal);
  let state;
  if (options?.requireSync) {
    state = signal({
      kind: 0
      /* StateKind.NoValue */
    }, { equal });
  } else {
    state = signal({ kind: 1, value: options?.initialValue }, { equal });
  }
  let destroyUnregisterFn;
  const sub = source.subscribe({
    next: (value) => state.set({ kind: 1, value }),
    error: (error) => {
      state.set({ kind: 2, error });
      destroyUnregisterFn?.();
    },
    complete: () => {
      destroyUnregisterFn?.();
    }
    // Completion of the Observable is meaningless to the signal. Signals don't have a concept of
    // "complete".
  });
  if (options?.requireSync && state().kind === 0) {
    throw new RuntimeError(601, (typeof ngDevMode === "undefined" || ngDevMode) && "`toSignal()` called with `requireSync` but `Observable` did not emit synchronously.");
  }
  destroyUnregisterFn = cleanupRef?.onDestroy(sub.unsubscribe.bind(sub));
  return computed(() => {
    const current = state();
    switch (current.kind) {
      case 1:
        return current.value;
      case 2:
        throw current.error;
      case 0:
        throw new RuntimeError(601, (typeof ngDevMode === "undefined" || ngDevMode) && "`toSignal()` called with `requireSync` but `Observable` did not emit synchronously.");
    }
  }, { equal: options?.equal });
}
function makeToSignalEqual(userEquality = Object.is) {
  return (a, b) => a.kind === 1 && b.kind === 1 && userEquality(a.value, b.value);
}

// src/app/project-info.service.ts
var ProjectInfoService = class _ProjectInfoService {
  rpc = inject2(RpcService);
  // undefined means not yet requested
  // null means requested and not present
  _projectInfo = void 0;
  // The directory that we are storing fine videos in.
  fineVideoDir = "";
  async loadProjectInfo() {
    const promises = [];
    promises.push(this.rpc.call("getProjectInfo").then((response) => response).then((response) => {
      this._projectInfo = response.projectInfo ? new ProjectInfo(response.projectInfo) : null;
      this.setAllViews(this._projectInfo?.views ?? []);
    }));
    promises.push(this.rpc.call("getFineVideoDir").then((response) => response).then((response) => {
      this.fineVideoDir = response.path;
    }));
    return Promise.allSettled(promises);
  }
  get projectInfo() {
    return this._projectInfo;
  }
  async setProjectInfo(projectInfo) {
    await this.rpc.call("setProjectInfo", { projectInfo });
    await this.loadProjectInfo();
  }
  // Newer style of models.
  _allViews = new BehaviorSubject([]);
  allViews$ = this._allViews.asObservable().pipe(distinctUntilChanged());
  allViews = toSignal(this.allViews$, { requireSync: true });
  setAllViews(views) {
    this._allViews.next(views.concat(["unknown"]));
  }
  _allKeypoints = new BehaviorSubject([]);
  allKeypoints$ = this._allKeypoints.asObservable().pipe(distinctUntilChanged());
  allKeypoints = toSignal(this.allKeypoints$, { requireSync: true });
  setAllKeypoints(keypoints) {
    this._allKeypoints.next(keypoints);
  }
  _allModels = new BehaviorSubject([]);
  allModels$ = this._allModels.asObservable().pipe(distinctUntilChanged());
  allModels = toSignal(this.allModels$, { requireSync: true });
  setAllModels(models) {
    this._allModels.next(models);
  }
  static \u0275fac = function ProjectInfoService_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _ProjectInfoService)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _ProjectInfoService, factory: _ProjectInfoService.\u0275fac, providedIn: "root" });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ProjectInfoService, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], null, null);
})();

// src/app/csv-parser.service.ts
var import_papaparse = __toESM(require_papaparse_min());

// src/app/utils/pair.ts
var Pair = class _Pair {
  first;
  second;
  /**
   * Creates a new Pair instance.
   * @param first The first value of the pair.
   * @param second The second value of the pair.
   */
  constructor(first2, second) {
    this.first = first2;
    this.second = second;
  }
  /**
   * Converts this Pair instance into a unique string key suitable for use in a Map.
   * It uses `JSON.stringify` to safely serialize the pair's contents,
   * ensuring consistent and reliable key generation even with complex values (if JSON-serializable).
   *
   * @returns A string representation of the pair that can serve as a Map key.
   */
  toMapKey() {
    return JSON.stringify([this.first, this.second]);
  }
  /**
   * Reconstructs a Pair instance from a string key previously generated by `toMapKey()`.
   * This is a static method as it does not operate on an existing Pair instance.
   *
   * @param key The string key to parse, expected to be in the format generated by `toMapKey()`.
   * @returns A new Pair instance containing the parsed values.
   * @throws {Error} If the key is not a valid JSON string representing a two-element array.
   */
  static fromMapKey(key) {
    try {
      const parsed = JSON.parse(key);
      if (Array.isArray(parsed) && parsed.length === 2) {
        return new _Pair(parsed[0], parsed[1]);
      } else {
        throw new Error("Invalid key format: Expected a JSON array with two elements.");
      }
    } catch (e) {
      throw new Error(`Failed to parse Map key "${key}": ${e instanceof Error ? e.message : String(e)}`);
    }
  }
  /**
   * Provides a human-readable string representation of the Pair for debugging or logging.
   * @returns A string like "Pair(value1, value2)".
   */
  toString() {
    return `Pair(${String(this.first)}, ${String(this.second)})`;
  }
  /**
   * Performs a value-based comparison with another Pair instance.
   * This method is for direct Pair-to-Pair comparison, not for Map key comparison.
   * Note: This uses strict equality (===) for its members. For deep comparison of nested objects,
   * you'd need a more complex equality check.
   *
   * @param other The other Pair instance to compare against.
   * @returns True if both pairs have identical first and second values, false otherwise.
   */
  equals(other) {
    return this.first === other.first && this.second === other.second;
  }
};

// node_modules/danfojs/lib/bundle.esm.js
var ese = Object.create;
var rL = Object.defineProperty;
var tse = Object.getOwnPropertyDescriptor;
var rse = Object.getOwnPropertyNames;
var nse = Object.getPrototypeOf;
var ase = Object.prototype.hasOwnProperty;
var Tb = ((e) => typeof __require != "undefined" ? __require : typeof Proxy != "undefined" ? new Proxy(e, { get: (t, r) => (typeof __require != "undefined" ? __require : t)[r] }) : e)(function(e) {
  if (typeof __require != "undefined") return __require.apply(this, arguments);
  throw new Error('Dynamic require of "' + e + '" is not supported');
});
var ri = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports);
var ise = (e, t, r, n) => {
  if (t && typeof t == "object" || typeof t == "function") for (let a of rse(t)) !ase.call(e, a) && a !== r && rL(e, a, { get: () => t[a], enumerable: !(n = tse(t, a)) || n.enumerable });
  return e;
};
var km = (e, t, r) => (r = e != null ? ese(nse(e)) : {}, ise(t || !e || !e.__esModule ? rL(r, "default", { value: e, enumerable: true }) : r, e));
var r3 = ri(() => {
});
var nL = ri(() => {
});
var aL = ri(() => {
});
var Gm = ri((Gt) => {
  "use strict";
  Object.defineProperty(Gt, "__esModule", { value: true });
  var ose = r3();
  function sse(e) {
    return e && typeof e == "object" && "default" in e ? e : { default: e };
  }
  var lse = sse(ose);
  var t4 = function(e, t) {
    return t4 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, n) {
      r.__proto__ = n;
    } || function(r, n) {
      for (var a in n) n.hasOwnProperty(a) && (r[a] = n[a]);
    }, t4(e, t);
  };
  function y0(e, t) {
    t4(e, t);
    function r() {
      this.constructor = e;
    }
    e.prototype = t === null ? Object.create(t) : (r.prototype = t.prototype, new r());
  }
  function xi(e, t, r, n) {
    function a(o) {
      return o instanceof r ? o : new r(function(s) {
        s(o);
      });
    }
    return new (r || (r = Promise))(function(o, s) {
      function i(c) {
        try {
          u2(n.next(c));
        } catch (f) {
          s(f);
        }
      }
      function l(c) {
        try {
          u2(n.throw(c));
        } catch (f) {
          s(f);
        }
      }
      function u2(c) {
        c.done ? o(c.value) : a(c.value).then(i, l);
      }
      u2((n = n.apply(e, t || [])).next());
    });
  }
  function bi(e, t) {
    var r = { label: 0, sent: function() {
      if (o[0] & 1) throw o[1];
      return o[1];
    }, trys: [], ops: [] }, n, a, o, s;
    return s = { next: i(0), throw: i(1), return: i(2) }, typeof Symbol == "function" && (s[Symbol.iterator] = function() {
      return this;
    }), s;
    function i(u2) {
      return function(c) {
        return l([u2, c]);
      };
    }
    function l(u2) {
      if (n) throw new TypeError("Generator is already executing.");
      for (; r; ) try {
        if (n = 1, a && (o = u2[0] & 2 ? a.return : u2[0] ? a.throw || ((o = a.return) && o.call(a), 0) : a.next) && !(o = o.call(a, u2[1])).done) return o;
        switch (a = 0, o && (u2 = [u2[0] & 2, o.value]), u2[0]) {
          case 0:
          case 1:
            o = u2;
            break;
          case 4:
            return r.label++, { value: u2[1], done: false };
          case 5:
            r.label++, a = u2[1], u2 = [0];
            continue;
          case 7:
            u2 = r.ops.pop(), r.trys.pop();
            continue;
          default:
            if (o = r.trys, !(o = o.length > 0 && o[o.length - 1]) && (u2[0] === 6 || u2[0] === 2)) {
              r = 0;
              continue;
            }
            if (u2[0] === 3 && (!o || u2[1] > o[0] && u2[1] < o[3])) {
              r.label = u2[1];
              break;
            }
            if (u2[0] === 6 && r.label < o[1]) {
              r.label = o[1], o = u2;
              break;
            }
            if (o && r.label < o[2]) {
              r.label = o[2], r.ops.push(u2);
              break;
            }
            o[2] && r.ops.pop(), r.trys.pop();
            continue;
        }
        u2 = t.call(e, r);
      } catch (c) {
        u2 = [6, c], a = 0;
      } finally {
        n = o = 0;
      }
      if (u2[0] & 5) throw u2[1];
      return { value: u2[0] ? u2[1] : void 0, done: true };
    }
  }
  function Qf(e) {
    var t = typeof Symbol == "function" && Symbol.iterator, r = t && e[t], n = 0;
    if (r) return r.call(e);
    if (e && typeof e.length == "number") return { next: function() {
      return e && n >= e.length && (e = void 0), { value: e && e[n++], done: !e };
    } };
    throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
  }
  function hi(e, t) {
    var r = typeof Symbol == "function" && e[Symbol.iterator];
    if (!r) return e;
    var n = r.call(e), a, o = [], s;
    try {
      for (; (t === void 0 || t-- > 0) && !(a = n.next()).done; ) o.push(a.value);
    } catch (i) {
      s = { error: i };
    } finally {
      try {
        a && !a.done && (r = n.return) && r.call(n);
      } finally {
        if (s) throw s.error;
      }
    }
    return o;
  }
  function ys() {
    for (var e = [], t = 0; t < arguments.length; t++) e = e.concat(hi(arguments[t]));
    return e;
  }
  var use = 1e-7, cse = 1e-4, fse = function() {
    function e(t, r) {
      this.backend = t, this.dataMover = r, this.data = /* @__PURE__ */ new WeakMap(), this.dataIdsCount = 0;
    }
    return e.prototype.get = function(t) {
      return this.data.has(t) || this.dataMover.moveData(this.backend, t), this.data.get(t);
    }, e.prototype.set = function(t, r) {
      this.dataIdsCount++, this.data.set(t, r);
    }, e.prototype.has = function(t) {
      return this.data.has(t);
    }, e.prototype.delete = function(t) {
      return this.dataIdsCount--, this.data.delete(t);
    }, e.prototype.numDataIds = function() {
      return this.dataIdsCount;
    }, e;
  }(), TL = function() {
    function e() {
    }
    return e.prototype.refCount = function(t) {
      return Ah("refCount");
    }, e.prototype.incRef = function(t) {
      return Ah("incRef");
    }, e.prototype.timerAvailable = function() {
      return true;
    }, e.prototype.time = function(t) {
      return Ah("time");
    }, e.prototype.read = function(t) {
      return Ah("read");
    }, e.prototype.readSync = function(t) {
      return Ah("readSync");
    }, e.prototype.readToGPU = function(t, r) {
      return Ah("readToGPU");
    }, e.prototype.numDataIds = function() {
      return Ah("numDataIds");
    }, e.prototype.disposeData = function(t, r) {
      return Ah("disposeData");
    }, e.prototype.write = function(t, r, n) {
      return Ah("write");
    }, e.prototype.move = function(t, r, n, a, o) {
      return Ah("move");
    }, e.prototype.memory = function() {
      return Ah("memory");
    }, e.prototype.floatPrecision = function() {
      return Ah("floatPrecision");
    }, e.prototype.epsilon = function() {
      return this.floatPrecision() === 32 ? use : cse;
    }, e.prototype.dispose = function() {
      return Ah("dispose");
    }, e;
  }();
  function Ah(e) {
    throw new Error("'" + e + "' not yet implemented or not found in the registry. This kernel may not be supported by the tfjs backend you have chosen");
  }
  function AL(e) {
    for (var t = e.length, r = 0; t > 0; ) r = Math.random() * t | 0, t--, s3(e, t, r);
  }
  function hse(e, t) {
    if (e.length !== t.length) throw new Error("Array sizes must match to be shuffled together " + ("First array length was " + e.length) + ("Second array length was " + t.length));
    for (var r = e.length, n = 0; r > 0; ) n = Math.random() * r | 0, r--, s3(e, r, n), s3(t, r, n);
  }
  function Nb(e, t, r) {
    return Math.max(e, Math.min(t, r));
  }
  function pse(e) {
    return e % 2 === 0 ? e : e + 1;
  }
  function s3(e, t, r) {
    var n = e[t];
    e[t] = e[r], e[r] = n;
  }
  function dse(e) {
    for (var t = 0, r = 0; r < e.length; r++) t += e[r];
    return t;
  }
  function vse(e, t) {
    var r = Math.random();
    return t * r + (1 - r) * e;
  }
  function mse(e, t) {
    for (var r = 0, n = 0; n < e.length; n++) {
      var a = Number(e[n]) - Number(t[n]);
      r += a * a;
    }
    return r;
  }
  function Dr(e, t) {
    if (!e) throw new Error(typeof t == "string" ? t : t());
  }
  function nf(e, t, r) {
    r === void 0 && (r = ""), Dr(mv(e, t), function() {
      return r + (" Shapes " + e + " and " + t + " must match");
    });
  }
  function Bm(e) {
    Dr(e != null, function() {
      return "The input to the tensor constructor must be a non-null value.";
    });
  }
  function Fm(e, t, r) {
    if (t === void 0 && (t = []), r === void 0 && (r = false), t == null && (t = []), Array.isArray(e) || Gc(e) && !r) for (var n = 0; n < e.length; ++n) Fm(e[n], t, r);
    else t.push(e);
    return t;
  }
  function Ml(e) {
    if (e.length === 0) return 1;
    for (var t = e[0], r = 1; r < e.length; r++) t *= e[r];
    return t;
  }
  function gse(e) {
    return e.length === 0;
  }
  function mv(e, t) {
    if (e === t) return true;
    if (e == null || t == null || e.length !== t.length) return false;
    for (var r = 0; r < e.length; r++) if (e[r] !== t[r]) return false;
    return true;
  }
  function Q1(e) {
    return e % 1 === 0;
  }
  function yse(e) {
    if (Math.tanh != null) return Math.tanh(e);
    if (e === 1 / 0) return 1;
    if (e === -1 / 0) return -1;
    var t = Math.exp(2 * e);
    return (t - 1) / (t + 1);
  }
  function xse(e) {
    var t = Math.ceil(Math.sqrt(e));
    return [t, Math.ceil(e / t)];
  }
  function bse(e) {
    for (var t = new Uint32Array(e), r = 0; r < e; ++r) t[r] = r;
    return AL(t), t;
  }
  function Cb(e, t) {
    return t <= e.length ? e : e + " ".repeat(t - e.length);
  }
  function _se(e, t, r) {
    return t === void 0 && (t = function(n) {
      return 0;
    }), new Promise(function(n, a) {
      var o = 0, s = function() {
        if (e()) {
          n();
          return;
        }
        o++;
        var i = t(o);
        if (r != null && o >= r) {
          a();
          return;
        }
        setTimeout(s, i);
      };
      s();
    });
  }
  function wse(e, t) {
    for (var r = 1, n = -1, a = 0; a < e.length; ++a) if (e[a] >= 0) r *= e[a];
    else if (e[a] === -1) {
      if (n !== -1) throw Error("Shapes can only have 1 implicit size. " + ("Found -1 at dim " + n + " and dim " + a));
      n = a;
    } else if (e[a] < 0) throw Error("Shapes can not be < 0. Found " + e[a] + " at dim " + a);
    if (n === -1) {
      if (t > 0 && t !== r) throw Error("Size(" + t + ") must match the product of shape " + e);
      return e;
    }
    if (r === 0) throw Error("Cannot infer the missing size in [" + e + "] when there are 0 elements");
    if (t % r !== 0) throw Error("The implicit shape can't be a fractional number. " + ("Got " + t + " / " + r));
    var o = e.slice();
    return o[n] = t / r, o;
  }
  function Wb(e, t) {
    var r = t.length;
    return e = e == null ? t.map(function(n, a) {
      return a;
    }) : [].concat(e), Dr(e.every(function(n) {
      return n >= -r && n < r;
    }), function() {
      return "All values in axis param must be in range [-" + r + ", " + r + ") but " + ("got axis " + e);
    }), Dr(e.every(function(n) {
      return Q1(n);
    }), function() {
      return "All values in axis param must be integers but " + ("got axis " + e);
    }), e.map(function(n) {
      return n < 0 ? r + n : n;
    });
  }
  function SL(e, t) {
    for (var r = [], n = [], a = t != null && Array.isArray(t) && t.length === 0, o = t == null || a ? null : Wb(t, e).sort(), s = 0, i = 0; i < e.length; ++i) {
      if (o != null) {
        if (o[s] === i && e[i] !== 1) throw new Error("Can't squeeze axis " + i + " since its dim '" + e[i] + "' is not 1");
        (o[s] == null || o[s] > i) && e[i] === 1 && (r.push(e[i]), n.push(i)), o[s] <= i && s++;
      }
      e[i] !== 1 && (r.push(e[i]), n.push(i));
    }
    return { newShape: r, keptDims: n };
  }
  function EL(e, t) {
    var r = null;
    if (e == null || e === "float32") r = new Float32Array(t);
    else if (e === "int32") r = new Int32Array(t);
    else if (e === "bool") r = new Uint8Array(t);
    else throw new Error("Unknown data type " + e);
    return r;
  }
  function DL(e, t) {
    var r = null;
    if (e == null || e === "float32") r = new Float32Array(t);
    else if (e === "int32") r = new Int32Array(t);
    else if (e === "bool") r = new Uint8Array(t);
    else if (e === "string") r = new Array(t);
    else throw new Error("Unknown data type " + e);
    return r;
  }
  function CL(e, t) {
    for (var r = 0; r < e.length; r++) {
      var n = e[r];
      if (isNaN(n) || !isFinite(n)) throw Error("A tensor of type " + t + " being uploaded contains " + n + ".");
    }
  }
  function ML(e) {
    return e === "bool" || e === "complex64" || e === "float32" || e === "int32" || e === "string";
  }
  function kse(e, t) {
    return !(t === "complex64" || t === "float32" && e !== "complex64" || t === "int32" && e !== "float32" && e !== "complex64" || t === "bool" && e === "bool");
  }
  function Gc(e) {
    return e instanceof Float32Array || e instanceof Int32Array || e instanceof Uint8Array || e instanceof Uint8ClampedArray;
  }
  function r4(e) {
    if (e === "float32" || e === "int32") return 4;
    if (e === "complex64") return 8;
    if (e === "bool") return 1;
    throw new Error("Unknown dtype " + e);
  }
  function IL(e) {
    if (e == null) return 0;
    var t = 0;
    return e.forEach(function(r) {
      return t += r.length;
    }), t;
  }
  function cv(e) {
    return typeof e == "string" || e instanceof String;
  }
  function NL(e) {
    return typeof e == "boolean";
  }
  function FL(e) {
    return typeof e == "number";
  }
  function w3(e) {
    return Array.isArray(e) ? w3(e[0]) : e instanceof Float32Array ? "float32" : e instanceof Int32Array || e instanceof Uint8Array || e instanceof Uint8ClampedArray ? "int32" : FL(e) ? "float32" : cv(e) ? "string" : NL(e) ? "bool" : "float32";
  }
  function dv(e) {
    return !!(e && e.constructor && e.call && e.apply);
  }
  function l3(e, t) {
    for (var r = t; r < e; ++r) if (e % r === 0) return r;
    return e;
  }
  function ay(e) {
    var t = e.length;
    if (t < 2) return [];
    var r = new Array(t - 1);
    r[t - 2] = e[t - 1];
    for (var n = t - 3; n >= 0; --n) r[n] = r[n + 1] * e[n + 1];
    return r;
  }
  function OL(e, t, r, n) {
    n === void 0 && (n = false);
    var a = new Array();
    if (t.length === 1) for (var o = t[0] * (n ? 2 : 1), s = 0; s < o; s++) a[s] = r[e + s];
    else for (var o = t[0], i = t.slice(1), l = i.reduce(function(c, f) {
      return c * f;
    }) * (n ? 2 : 1), s = 0; s < o; s++) a[s] = OL(e + s * l, i, r, n);
    return a;
  }
  function q1(e, t, r) {
    if (r === void 0 && (r = false), e.length === 0) return t[0];
    var n = e.reduce(function(a, o) {
      return a * o;
    }) * (r ? 2 : 1);
    if (n === 0) return [];
    if (n !== t.length) throw new Error("[" + e + "] does not match the input size " + t.length + (r ? " for a complex tensor" : "") + ".");
    return OL(0, e, t, r);
  }
  function E4(e, t) {
    for (var r = k3(e, t), n = 0; n < r.length; n++) r[n] = 1;
    return r;
  }
  function k3(e, t) {
    if (t == null || t === "float32" || t === "complex64") return new Float32Array(e);
    if (t === "int32") return new Int32Array(e);
    if (t === "bool") return new Uint8Array(e);
    throw new Error("Unknown data type " + t);
  }
  function Tse(e, t) {
    var r = e.reduce(function(n, a) {
      return n * a;
    }, 1);
    if (t == null || t === "float32") return q1(e, new Float32Array(r));
    if (t === "int32") return q1(e, new Int32Array(r));
    if (t === "bool") return q1(e, new Uint8Array(r));
    throw new Error("Unknown data type " + t);
  }
  function D4(e) {
    e.forEach(function(t) {
      Dr(Number.isInteger(t) && t >= 0, function() {
        return "Tensor must have a shape comprised of positive integers but got " + ("shape [" + e + "].");
      });
    });
  }
  function Ase(e, t, r) {
    if (t === 0) return 0;
    if (t === 1) return e[0];
    for (var n = e[e.length - 1], a = 0; a < e.length - 1; ++a) n += r[a] * e[a];
    return n;
  }
  function Sse(e, t, r) {
    if (t === 0) return [];
    if (t === 1) return [e];
    for (var n = new Array(t), a = 0; a < n.length - 1; ++a) n[a] = Math.floor(e / r[a]), e -= n[a] * r[a];
    return n[n.length - 1] = e, n;
  }
  function C4(e) {
    return e && e.then && typeof e.then == "function";
  }
  var iL = "tfjsflags", PL = function() {
    function e(t) {
      this.global = t, this.flags = {}, this.flagRegistry = {}, this.urlFlags = {}, this.getQueryParams = Ese, this.populateURLFlags();
    }
    return e.prototype.setPlatform = function(t, r) {
      this.platform != null && (So().getBool("IS_TEST") || So().getBool("PROD") || console.warn("Platform " + this.platformName + " has already been set. " + ("Overwriting the platform with " + r + "."))), this.platformName = t, this.platform = r;
    }, e.prototype.registerFlag = function(t, r, n) {
      if (this.flagRegistry[t] = { evaluationFn: r, setHook: n }, this.urlFlags[t] != null) {
        var a = this.urlFlags[t];
        So().getBool("IS_TEST") || So().getBool("PROD") || console.warn("Setting feature override from URL " + t + ": " + a + "."), this.set(t, a);
      }
    }, e.prototype.getAsync = function(t) {
      return xi(this, void 0, void 0, function() {
        var r, n;
        return bi(this, function(a) {
          switch (a.label) {
            case 0:
              return t in this.flags ? [2, this.flags[t]] : (r = this.flags, n = t, [4, this.evaluateFlag(t)]);
            case 1:
              return r[n] = a.sent(), [2, this.flags[t]];
          }
        });
      });
    }, e.prototype.get = function(t) {
      if (t in this.flags) return this.flags[t];
      var r = this.evaluateFlag(t);
      if (C4(r)) throw new Error("Flag " + t + " cannot be synchronously evaluated. Please use getAsync() instead.");
      return this.flags[t] = r, this.flags[t];
    }, e.prototype.getNumber = function(t) {
      return this.get(t);
    }, e.prototype.getBool = function(t) {
      return this.get(t);
    }, e.prototype.getFlags = function() {
      return this.flags;
    }, Object.defineProperty(e.prototype, "features", { get: function() {
      return this.flags;
    }, enumerable: true, configurable: true }), e.prototype.set = function(t, r) {
      if (this.flagRegistry[t] == null) throw new Error("Cannot set flag " + t + " as it has not been registered.");
      this.flags[t] = r, this.flagRegistry[t].setHook != null && this.flagRegistry[t].setHook(r);
    }, e.prototype.evaluateFlag = function(t) {
      if (this.flagRegistry[t] == null) throw new Error("Cannot evaluate flag '" + t + "': no evaluation function found.");
      return this.flagRegistry[t].evaluationFn();
    }, e.prototype.setFlags = function(t) {
      this.flags = Object.assign({}, t);
    }, e.prototype.reset = function() {
      this.flags = {}, this.urlFlags = {}, this.populateURLFlags();
    }, e.prototype.populateURLFlags = function() {
      var t = this;
      if (!(typeof this.global > "u" || typeof this.global.location > "u" || typeof this.global.location.search > "u")) {
        var r = this.getQueryParams(this.global.location.search);
        if (iL in r) {
          var n = r[iL].split(",");
          n.forEach(function(a) {
            var o = hi(a.split(":"), 2), s = o[0], i = o[1];
            t.urlFlags[s] = Cse(s, i);
          });
        }
      }
    }, e;
  }();
  function Ese(e) {
    var t = {};
    return e.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g, function(r) {
      for (var n = [], a = 1; a < arguments.length; a++) n[a - 1] = arguments[a];
      return Dse(t, n[0], n[1]), n.join("=");
    }), t;
  }
  function Dse(e, t, r) {
    e[decodeURIComponent(t)] = decodeURIComponent(r || "");
  }
  function Cse(e, t) {
    if (t = t.toLowerCase(), t === "true" || t === "false") return t === "true";
    if ("" + +t === t) return +t;
    throw new Error("Could not parse value flag value " + t + " for flag " + e + ".");
  }
  function So() {
    return Gt.ENV;
  }
  Gt.ENV = null;
  function Mse(e) {
    Gt.ENV = e;
  }
  var KE;
  function LL() {
    if (KE == null) {
      var e = void 0;
      if (typeof window < "u") e = window;
      else if (typeof global < "u") e = global;
      else if (typeof process < "u") e = process;
      else if (typeof self < "u") e = self;
      else throw new Error("Could not find a global object");
      KE = e;
    }
    return KE;
  }
  function Ise() {
    var e = LL();
    return e._tfGlobals == null && (e._tfGlobals = /* @__PURE__ */ new Map()), e._tfGlobals;
  }
  function M4(e, t) {
    var r = Ise();
    if (r.has(e)) return r.get(e);
    var n = t();
    return r.set(e, n), r.get(e);
  }
  var RL = "Abs", zL = "Acos", BL = "Acosh", I4 = "Add", UL = "AddN", VL = "All", jL = "Any", WL = "ArgMax", GL = "ArgMin", $L = "Asin", HL = "Asinh", qL = "Atan", XL = "Atanh", KL = "Atan2", YL = "AvgPool", Nse = "AvgPoolGrad", ZL = "AvgPool3D", Fse = "AvgPool3DGrad", JL = "BatchMatMul", QL = "BatchToSpaceND", eR = "Bincount", Ose = "BroadcastTo", tR = "BroadcastArgs", N4 = "Cast", rR = "Ceil", nR = "ClipByValue", aR = "Complex", iR = "ComplexAbs", oR = "Concat", sR = "Conv2D", lR = "Conv2DBackpropFilter", uR = "Conv2DBackpropInput", cR = "Conv3D", Pse = "Conv3DBackpropFilterV2", fR = "Conv3DBackpropInputV2", hR = "Cos", pR = "Cosh", dR = "Cumsum", vR = "CropAndResize", mR = "DenseBincount", gR = "DepthToSpace", yR = "DepthwiseConv2dNative", xR = "DepthwiseConv2dNativeBackpropFilter", bR = "DepthwiseConv2dNativeBackpropInput", _R = "Diag", wR = "Dilation2D", Lse = "Dilation2DBackpropInput", Rse = "Dilation2DBackpropFilter", kR = "RealDiv", TR = "Einsum", AR = "Elu", zse = "EluGrad", SR = "Erf", ER = "Equal", DR = "Exp", CR = "ExpandDims", MR = "Expm1", IR = "FFT", NR = "Fill", FR = "FlipLeftRight", OR = "Floor", PR = "FloorDiv", LR = "FusedBatchNorm", RR = "GatherV2", zR = "GatherNd", BR = "Greater", UR = "GreaterEqual", F42 = "Identity", VR = "IFFT", jR = "Imag", WR = "IsFinite", GR = "IsInf", $R = "IsNan", HR = "LeakyRelu", qR = "Less", XR = "LessEqual", KR = "LinSpace", YR = "Log", ZR = "Log1p", JR = "LogicalAnd", QR = "LogicalNot", e7 = "LogicalOr", Bse = "LogSoftmax", t7 = "LRN", Use = "LRNGrad", r7 = "Max", n7 = "Maximum", a7 = "MaxPool", Vse = "MaxPoolGrad", i7 = "MaxPool3D", jse = "MaxPool3DGrad", o7 = "MaxPoolWithArgmax", s7 = "Mean", l7 = "Min", u7 = "Minimum", c7 = "MirrorPad", f7 = "Mod", h7 = "Multinomial", p7 = "Multiply", d7 = "Neg", v7 = "NotEqual", m7 = "NonMaxSuppressionV3", g7 = "NonMaxSuppressionV4", y7 = "NonMaxSuppressionV5", x7 = "OnesLike", b7 = "OneHot", _7 = "Pack", w7 = "PadV2", Wse = "Pool", k7 = "Pow", T7 = "Prelu", A7 = "Prod", S7 = "Range", E7 = "Real", D7 = "Reciprocal", C7 = "Relu", M7 = "Reshape", I7 = "ResizeNearestNeighbor", Gse = "ResizeNearestNeighborGrad", N7 = "ResizeBilinear", $se = "ResizeBilinearGrad", F72 = "Relu6", O7 = "Reverse", P7 = "Round", L7 = "Rsqrt", R7 = "ScatterNd", z7 = "Select", B7 = "Selu", U7 = "Slice", V7 = "Sin", j7 = "Sinh", W7 = "Sign", G7 = "Sigmoid", $7 = "Softplus", H7 = "Sqrt", q7 = "Sum", X7 = "SpaceToBatchND", K7 = "SplitV", Y7 = "Softmax", Z7 = "SparseFillEmptyRows", J7 = "SparseReshape", Q7 = "SparseSegmentMean", e9 = "SparseSegmentSum", t9 = "SparseToDense", r9 = "SquaredDifference", Hse = "Square", n9 = "StridedSlice", a9 = "StringNGrams", i9 = "StringSplit", o9 = "StringToHashBucketFast", s9 = "Sub", l9 = "Tan", u9 = "Tanh", O4 = "Tile", c9 = "TopK", f9 = "Transform", h9 = "Transpose", p9 = "Unique", d9 = "Unpack", v9 = "UnsortedSegmentSum", m9 = "ZerosLike", g9 = "Step", n4 = "FromPixels", y9 = "RotateWithOffset", a4 = "_FusedMatMul", i4 = "FusedConv2D", o4 = "FusedDepthwiseConv2D";
  function uv() {
    for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
    So().getBool("IS_TEST") || So().getBool("PROD") || console.warn.apply(console, ys(e));
  }
  function qse() {
    for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
    So().getBool("IS_TEST") || So().getBool("PROD") || console.log.apply(console, ys(e));
  }
  var ey = M4("kernelRegistry", function() {
    return /* @__PURE__ */ new Map();
  }), Fb = M4("gradRegistry", function() {
    return /* @__PURE__ */ new Map();
  });
  function u3(e, t) {
    var r = P4(e, t);
    return ey.get(r);
  }
  function s4(e) {
    return Fb.get(e);
  }
  function c3(e) {
    for (var t = ey.entries(), r = []; ; ) {
      var n = t.next(), a = n.done, o = n.value;
      if (a) break;
      var s = hi(o, 2), i = s[0], l = s[1], u2 = hi(i.split("_"), 1), c = u2[0];
      c === e && r.push(l);
    }
    return r;
  }
  function x9(e) {
    var t = e.kernelName, r = e.backendName, n = P4(t, r);
    ey.has(n) && uv("The kernel '" + t + "' for backend " + ("'" + r + "' is already registered")), ey.set(n, e);
  }
  function Xse(e) {
    var t = e.kernelName;
    Fb.has(t) && So().getBool("DEBUG") && uv("Overriding the gradient for '" + t + "'"), Fb.set(t, e);
  }
  function Kse(e, t) {
    var r = P4(e, t);
    if (!ey.has(r)) throw new Error("The kernel '" + e + "' for backend " + ("'" + t + "' is not registered"));
    ey.delete(r);
  }
  function Yse(e) {
    if (!Fb.has(e)) throw new Error("The gradient '" + e + "' for backend is not registered");
    Fb.delete(e);
  }
  function Zse(e, t) {
    var r = c3(e);
    r.forEach(function(n) {
      var a = Object.assign({}, n, { backendName: t });
      x9(a);
    });
  }
  function P4(e, t) {
    return t + "_" + e;
  }
  var l4 = fl, Qh = null;
  try {
    Qh = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11])), {}).exports;
  } catch {
  }
  function fl(e, t, r) {
    this.low = e | 0, this.high = t | 0, this.unsigned = !!r;
  }
  fl.prototype.__isLong__;
  Object.defineProperty(fl.prototype, "__isLong__", { value: true });
  function th(e) {
    return (e && e.__isLong__) === true;
  }
  fl.isLong = th;
  var oL = {}, sL = {};
  function Um(e, t) {
    var r, n, a;
    return t ? (e >>>= 0, (a = 0 <= e && e < 256) && (n = sL[e], n) ? n : (r = hl(e, (e | 0) < 0 ? -1 : 0, true), a && (sL[e] = r), r)) : (e |= 0, (a = -128 <= e && e < 128) && (n = oL[e], n) ? n : (r = hl(e, e < 0 ? -1 : 0, false), a && (oL[e] = r), r));
  }
  fl.fromInt = Um;
  function ep(e, t) {
    if (isNaN(e)) return t ? Dm : tp;
    if (t) {
      if (e < 0) return Dm;
      if (e >= b9) return k9;
    } else {
      if (e <= -uL) return Jf;
      if (e + 1 >= uL) return w9;
    }
    return e < 0 ? ep(-e, t).neg() : hl(e % ty | 0, e / ty | 0, t);
  }
  fl.fromNumber = ep;
  function hl(e, t, r) {
    return new fl(e, t, r);
  }
  fl.fromBits = hl;
  var f3 = Math.pow;
  function L4(e, t, r) {
    if (e.length === 0) throw Error("empty string");
    if (e === "NaN" || e === "Infinity" || e === "+Infinity" || e === "-Infinity") return tp;
    if (typeof t == "number" ? (r = t, t = false) : t = !!t, r = r || 10, r < 2 || 36 < r) throw RangeError("radix");
    var n;
    if ((n = e.indexOf("-")) > 0) throw Error("interior hyphen");
    if (n === 0) return L4(e.substring(1), t, r).neg();
    for (var a = ep(f3(r, 8)), o = tp, s = 0; s < e.length; s += 8) {
      var i = Math.min(8, e.length - s), l = parseInt(e.substring(s, s + i), r);
      if (i < 8) {
        var u2 = ep(f3(r, i));
        o = o.mul(u2).add(ep(l));
      } else o = o.mul(a), o = o.add(ep(l));
    }
    return o.unsigned = t, o;
  }
  fl.fromString = L4;
  function Jp(e, t) {
    return typeof e == "number" ? ep(e, t) : typeof e == "string" ? L4(e, t) : hl(e.low, e.high, typeof t == "boolean" ? t : e.unsigned);
  }
  fl.fromValue = Jp;
  var lL = 1 << 16, Jse = 1 << 24, ty = lL * lL, b9 = ty * ty, uL = b9 / 2, cL = Um(Jse), tp = Um(0);
  fl.ZERO = tp;
  var Dm = Um(0, true);
  fl.UZERO = Dm;
  var H1 = Um(1);
  fl.ONE = H1;
  var _9 = Um(1, true);
  fl.UONE = _9;
  var u4 = Um(-1);
  fl.NEG_ONE = u4;
  var w9 = hl(-1, 2147483647, false);
  fl.MAX_VALUE = w9;
  var k9 = hl(-1, -1, true);
  fl.MAX_UNSIGNED_VALUE = k9;
  var Jf = hl(0, -2147483648, false);
  fl.MIN_VALUE = Jf;
  var za = fl.prototype;
  za.toInt = function() {
    return this.unsigned ? this.low >>> 0 : this.low;
  };
  za.toNumber = function() {
    return this.unsigned ? (this.high >>> 0) * ty + (this.low >>> 0) : this.high * ty + (this.low >>> 0);
  };
  za.toString = function(t) {
    if (t = t || 10, t < 2 || 36 < t) throw RangeError("radix");
    if (this.isZero()) return "0";
    if (this.isNegative()) if (this.eq(Jf)) {
      var r = ep(t), n = this.div(r), a = n.mul(r).sub(this);
      return n.toString(t) + a.toInt().toString(t);
    } else return "-" + this.neg().toString(t);
    for (var o = ep(f3(t, 6), this.unsigned), s = this, i = ""; ; ) {
      var l = s.div(o), u2 = s.sub(l.mul(o)).toInt() >>> 0, c = u2.toString(t);
      if (s = l, s.isZero()) return c + i;
      for (; c.length < 6; ) c = "0" + c;
      i = "" + c + i;
    }
  };
  za.getHighBits = function() {
    return this.high;
  };
  za.getHighBitsUnsigned = function() {
    return this.high >>> 0;
  };
  za.getLowBits = function() {
    return this.low;
  };
  za.getLowBitsUnsigned = function() {
    return this.low >>> 0;
  };
  za.getNumBitsAbs = function() {
    if (this.isNegative()) return this.eq(Jf) ? 64 : this.neg().getNumBitsAbs();
    for (var t = this.high != 0 ? this.high : this.low, r = 31; r > 0 && (t & 1 << r) == 0; r--) ;
    return this.high != 0 ? r + 33 : r + 1;
  };
  za.isZero = function() {
    return this.high === 0 && this.low === 0;
  };
  za.eqz = za.isZero;
  za.isNegative = function() {
    return !this.unsigned && this.high < 0;
  };
  za.isPositive = function() {
    return this.unsigned || this.high >= 0;
  };
  za.isOdd = function() {
    return (this.low & 1) === 1;
  };
  za.isEven = function() {
    return (this.low & 1) === 0;
  };
  za.equals = function(t) {
    return th(t) || (t = Jp(t)), this.unsigned !== t.unsigned && this.high >>> 31 === 1 && t.high >>> 31 === 1 ? false : this.high === t.high && this.low === t.low;
  };
  za.eq = za.equals;
  za.notEquals = function(t) {
    return !this.eq(t);
  };
  za.neq = za.notEquals;
  za.ne = za.notEquals;
  za.lessThan = function(t) {
    return this.comp(t) < 0;
  };
  za.lt = za.lessThan;
  za.lessThanOrEqual = function(t) {
    return this.comp(t) <= 0;
  };
  za.lte = za.lessThanOrEqual;
  za.le = za.lessThanOrEqual;
  za.greaterThan = function(t) {
    return this.comp(t) > 0;
  };
  za.gt = za.greaterThan;
  za.greaterThanOrEqual = function(t) {
    return this.comp(t) >= 0;
  };
  za.gte = za.greaterThanOrEqual;
  za.ge = za.greaterThanOrEqual;
  za.compare = function(t) {
    if (th(t) || (t = Jp(t)), this.eq(t)) return 0;
    var r = this.isNegative(), n = t.isNegative();
    return r && !n ? -1 : !r && n ? 1 : this.unsigned ? t.high >>> 0 > this.high >>> 0 || t.high === this.high && t.low >>> 0 > this.low >>> 0 ? -1 : 1 : this.sub(t).isNegative() ? -1 : 1;
  };
  za.comp = za.compare;
  za.negate = function() {
    return !this.unsigned && this.eq(Jf) ? Jf : this.not().add(H1);
  };
  za.neg = za.negate;
  za.add = function(t) {
    th(t) || (t = Jp(t));
    var r = this.high >>> 16, n = this.high & 65535, a = this.low >>> 16, o = this.low & 65535, s = t.high >>> 16, i = t.high & 65535, l = t.low >>> 16, u2 = t.low & 65535, c = 0, f = 0, h = 0, p = 0;
    return p += o + u2, h += p >>> 16, p &= 65535, h += a + l, f += h >>> 16, h &= 65535, f += n + i, c += f >>> 16, f &= 65535, c += r + s, c &= 65535, hl(h << 16 | p, c << 16 | f, this.unsigned);
  };
  za.subtract = function(t) {
    return th(t) || (t = Jp(t)), this.add(t.neg());
  };
  za.sub = za.subtract;
  za.multiply = function(t) {
    if (this.isZero()) return tp;
    if (th(t) || (t = Jp(t)), Qh) {
      var r = Qh.mul(this.low, this.high, t.low, t.high);
      return hl(r, Qh.get_high(), this.unsigned);
    }
    if (t.isZero()) return tp;
    if (this.eq(Jf)) return t.isOdd() ? Jf : tp;
    if (t.eq(Jf)) return this.isOdd() ? Jf : tp;
    if (this.isNegative()) return t.isNegative() ? this.neg().mul(t.neg()) : this.neg().mul(t).neg();
    if (t.isNegative()) return this.mul(t.neg()).neg();
    if (this.lt(cL) && t.lt(cL)) return ep(this.toNumber() * t.toNumber(), this.unsigned);
    var n = this.high >>> 16, a = this.high & 65535, o = this.low >>> 16, s = this.low & 65535, i = t.high >>> 16, l = t.high & 65535, u2 = t.low >>> 16, c = t.low & 65535, f = 0, h = 0, p = 0, d = 0;
    return d += s * c, p += d >>> 16, d &= 65535, p += o * c, h += p >>> 16, p &= 65535, p += s * u2, h += p >>> 16, p &= 65535, h += a * c, f += h >>> 16, h &= 65535, h += o * u2, f += h >>> 16, h &= 65535, h += s * l, f += h >>> 16, h &= 65535, f += n * c + a * u2 + o * l + s * i, f &= 65535, hl(p << 16 | d, f << 16 | h, this.unsigned);
  };
  za.mul = za.multiply;
  za.divide = function(t) {
    if (th(t) || (t = Jp(t)), t.isZero()) throw Error("division by zero");
    if (Qh) {
      if (!this.unsigned && this.high === -2147483648 && t.low === -1 && t.high === -1) return this;
      var r = (this.unsigned ? Qh.div_u : Qh.div_s)(this.low, this.high, t.low, t.high);
      return hl(r, Qh.get_high(), this.unsigned);
    }
    if (this.isZero()) return this.unsigned ? Dm : tp;
    var n, a, o;
    if (this.unsigned) {
      if (t.unsigned || (t = t.toUnsigned()), t.gt(this)) return Dm;
      if (t.gt(this.shru(1))) return _9;
      o = Dm;
    } else {
      if (this.eq(Jf)) {
        if (t.eq(H1) || t.eq(u4)) return Jf;
        if (t.eq(Jf)) return H1;
        var s = this.shr(1);
        return n = s.div(t).shl(1), n.eq(tp) ? t.isNegative() ? H1 : u4 : (a = this.sub(t.mul(n)), o = n.add(a.div(t)), o);
      } else if (t.eq(Jf)) return this.unsigned ? Dm : tp;
      if (this.isNegative()) return t.isNegative() ? this.neg().div(t.neg()) : this.neg().div(t).neg();
      if (t.isNegative()) return this.div(t.neg()).neg();
      o = tp;
    }
    for (a = this; a.gte(t); ) {
      n = Math.max(1, Math.floor(a.toNumber() / t.toNumber()));
      for (var i = Math.ceil(Math.log(n) / Math.LN2), l = i <= 48 ? 1 : f3(2, i - 48), u2 = ep(n), c = u2.mul(t); c.isNegative() || c.gt(a); ) n -= l, u2 = ep(n, this.unsigned), c = u2.mul(t);
      u2.isZero() && (u2 = H1), o = o.add(u2), a = a.sub(c);
    }
    return o;
  };
  za.div = za.divide;
  za.modulo = function(t) {
    if (th(t) || (t = Jp(t)), Qh) {
      var r = (this.unsigned ? Qh.rem_u : Qh.rem_s)(this.low, this.high, t.low, t.high);
      return hl(r, Qh.get_high(), this.unsigned);
    }
    return this.sub(this.div(t).mul(t));
  };
  za.mod = za.modulo;
  za.rem = za.modulo;
  za.not = function() {
    return hl(~this.low, ~this.high, this.unsigned);
  };
  za.and = function(t) {
    return th(t) || (t = Jp(t)), hl(this.low & t.low, this.high & t.high, this.unsigned);
  };
  za.or = function(t) {
    return th(t) || (t = Jp(t)), hl(this.low | t.low, this.high | t.high, this.unsigned);
  };
  za.xor = function(t) {
    return th(t) || (t = Jp(t)), hl(this.low ^ t.low, this.high ^ t.high, this.unsigned);
  };
  za.shiftLeft = function(t) {
    return th(t) && (t = t.toInt()), (t &= 63) === 0 ? this : t < 32 ? hl(this.low << t, this.high << t | this.low >>> 32 - t, this.unsigned) : hl(0, this.low << t - 32, this.unsigned);
  };
  za.shl = za.shiftLeft;
  za.shiftRight = function(t) {
    return th(t) && (t = t.toInt()), (t &= 63) === 0 ? this : t < 32 ? hl(this.low >>> t | this.high << 32 - t, this.high >> t, this.unsigned) : hl(this.high >> t - 32, this.high >= 0 ? 0 : -1, this.unsigned);
  };
  za.shr = za.shiftRight;
  za.shiftRightUnsigned = function(t) {
    if (th(t) && (t = t.toInt()), t &= 63, t === 0) return this;
    var r = this.high;
    if (t < 32) {
      var n = this.low;
      return hl(n >>> t | r << 32 - t, r >>> t, this.unsigned);
    } else return t === 32 ? hl(r, 0, this.unsigned) : hl(r >>> t - 32, 0, this.unsigned);
  };
  za.shru = za.shiftRightUnsigned;
  za.shr_u = za.shiftRightUnsigned;
  za.toSigned = function() {
    return this.unsigned ? hl(this.low, this.high, false) : this;
  };
  za.toUnsigned = function() {
    return this.unsigned ? this : hl(this.low, this.high, true);
  };
  za.toBytes = function(t) {
    return t ? this.toBytesLE() : this.toBytesBE();
  };
  za.toBytesLE = function() {
    var t = this.high, r = this.low;
    return [r & 255, r >>> 8 & 255, r >>> 16 & 255, r >>> 24, t & 255, t >>> 8 & 255, t >>> 16 & 255, t >>> 24];
  };
  za.toBytesBE = function() {
    var t = this.high, r = this.low;
    return [t >>> 24, t >>> 16 & 255, t >>> 8 & 255, t & 255, r >>> 24, r >>> 16 & 255, r >>> 8 & 255, r & 255];
  };
  fl.fromBytes = function(t, r, n) {
    return n ? fl.fromBytesLE(t, r) : fl.fromBytesBE(t, r);
  };
  fl.fromBytesLE = function(t, r) {
    return new fl(t[0] | t[1] << 8 | t[2] << 16 | t[3] << 24, t[4] | t[5] << 8 | t[6] << 16 | t[7] << 24, r);
  };
  fl.fromBytesBE = function(t, r) {
    return new fl(t[4] << 24 | t[5] << 16 | t[6] << 8 | t[7], t[0] << 24 | t[1] << 16 | t[2] << 8 | t[3], r);
  };
  var Qse = Object.assign(/* @__PURE__ */ Object.create(null), l4, { default: l4 }), Em = l4 || Qse;
  function Gb(e) {
    return Em.fromString(e, true, 16);
  }
  var T9 = Gb("c3a5c85c97cb3127"), Am = Gb("b492b66fbe98f273"), rf = Gb("9ae16a3b2f90404f");
  function c4(e) {
    return e.xor(e.shru(47));
  }
  function A9(e, t, r) {
    var n = e.slice(t, t + r);
    return Em.fromBytes(Array.from(n), true, true);
  }
  function Js(e, t) {
    return A9(e, t, 8);
  }
  function fL(e, t) {
    return A9(e, t, 4);
  }
  function uc(e, t) {
    return t === 0 ? e : e.shru(t).or(e.shl(64 - t));
  }
  function hv(e, t, r) {
    r === void 0 && (r = Gb("9ddfea08eb382d69"));
    var n = e.xor(t).mul(r);
    n = n.xor(n.shru(47));
    var a = t.xor(n).mul(r);
    return a = a.xor(a.shru(47)), a = a.mul(r), a;
  }
  function ele(e, t, r, n, a, o) {
    a = a.add(e), o = uc(o.add(a).add(n), 21);
    var s = a;
    return a = a.add(t), a = a.add(r), o = o.add(uc(a, 44)), [a.add(n), o.add(s)];
  }
  function n3(e, t, r, n) {
    return ele(Js(e, t), Js(e, t + 8), Js(e, t + 16), Js(e, t + 24), r, n);
  }
  function tle(e, t) {
    if (t === void 0 && (t = e.length), t >= 8) {
      var r = rf.add(t * 2), n = Js(e, 0).add(rf), a = Js(e, t - 8), o = uc(a, 37).mul(r).add(n), s = uc(n, 25).add(a).mul(r);
      return hv(o, s, r);
    }
    if (t >= 4) {
      var r = rf.add(t * 2), n = fL(e, 0);
      return hv(n.shl(3).add(t), fL(e, t - 4), r);
    }
    if (t > 0) {
      var n = e[0], a = e[t >> 1], o = e[t - 1], i = n + (a << 8), l = t + (o << 2);
      return c4(rf.mul(i).xor(T9.mul(l))).mul(rf);
    }
    return rf;
  }
  function rle(e, t) {
    t === void 0 && (t = e.length);
    var r = rf.add(t * 2), n = Js(e, 0).mul(Am), a = Js(e, 8), o = Js(e, t - 8).mul(r), s = Js(e, t - 16).mul(rf);
    return hv(uc(n.add(a), 43).add(uc(o, 30)).add(s), n.add(uc(a.add(rf), 18)).add(o), r);
  }
  function nle(e, t) {
    t === void 0 && (t = e.length);
    var r = rf.add(t * 2), n = Js(e, 0).mul(rf), a = Js(e, 8), o = Js(e, t - 8).mul(r), s = Js(e, t - 16).mul(rf), i = uc(n.add(a), 43).add(uc(o, 30)).add(s), l = hv(i, n.add(uc(a.add(rf), 18)).add(o), r), u2 = Js(e, 16).mul(r), c = Js(e, 24), f = i.add(Js(e, t - 32)).mul(r), h = l.add(Js(e, t - 24)).mul(r);
    return hv(uc(u2.add(c), 43).add(uc(f, 30)).add(h), u2.add(uc(c.add(n), 18)).add(f), r);
  }
  function ale(e, t) {
    var r, n;
    t === void 0 && (t = e.length);
    var a = Em.fromNumber(81, true);
    if (t <= 32) return t <= 16 ? tle(e, t) : rle(e, t);
    if (t <= 64) return nle(e, t);
    var o = a, s = a.mul(Am).add(113), i = c4(s.mul(rf).add(113)).mul(rf), l = [Em.UZERO, Em.UZERO], u2 = [Em.UZERO, Em.UZERO];
    o = o.mul(rf).add(Js(e, 0));
    var c = 0, f = (t - 1 >> 6) * 64, h = f + (t - 1 & 63) - 63;
    do
      o = uc(o.add(s).add(l[0]).add(Js(e, c + 8)), 37).mul(Am), s = uc(s.add(l[1]).add(Js(e, c + 48)), 42).mul(Am), o = o.xor(u2[1]), s = s.add(l[0]).add(Js(e, c + 40)), i = uc(i.add(u2[0]), 33).mul(Am), l = n3(e, c, l[1].mul(Am), o.add(u2[0])), u2 = n3(e, c + 32, i.add(u2[1]), s.add(Js(e, c + 16))), r = hi([o, i], 2), i = r[0], o = r[1], c += 64;
    while (c !== f);
    var p = Am.add(i.and(255).shl(1));
    return c = h, u2[0] = u2[0].add(t - 1 & 63), l[0] = l[0].add(u2[0]), u2[0] = u2[0].add(l[0]), o = uc(o.add(s).add(l[0]).add(Js(e, c + 8)), 37).mul(p), s = uc(s.add(l[1]).add(Js(e, c + 48)), 42).mul(p), o = o.xor(u2[1].mul(9)), s = s.add(l[0].mul(9).add(Js(e, c + 40))), i = uc(i.add(u2[0]), 33).mul(p), l = n3(e, c, l[1].mul(p), o.add(u2[0])), u2 = n3(e, c + 32, i.add(u2[1]), s.add(Js(e, c + 16))), n = hi([o, i], 2), i = n[0], o = n[1], hv(hv(l[0], u2[0], p).add(c4(s).mul(T9)).add(i), hv(l[1], u2[1], p).add(o), p);
  }
  function ile(e, t) {
    return t === "string" ? $b(e) : T3([e], t);
  }
  function ole(e, t) {
    return e instanceof Float32Array && t === "float32" || e instanceof Int32Array && t === "int32" || e instanceof Uint8Array && t === "bool";
  }
  function T3(e, t) {
    if (t === "string") throw new Error("Cannot convert a string[] to a TypedArray");
    if (Array.isArray(e) && (e = Fm(e)), So().getBool("DEBUG") && CL(e, t), ole(e, t)) return e;
    if (t == null || t === "float32" || t === "complex64") return new Float32Array(e);
    if (t === "int32") return new Int32Array(e);
    if (t === "bool") {
      for (var r = new Uint8Array(e.length), n = 0; n < r.length; ++n) Math.round(e[n]) !== 0 && (r[n] = 1);
      return r;
    } else throw new Error("Unknown data type " + t);
  }
  function Ob() {
    return So().platform.now();
  }
  function sle(e, t) {
    return So().platform.fetch(e, t);
  }
  function $b(e, t) {
    return t === void 0 && (t = "utf-8"), t = t || "utf-8", So().platform.encode(e, t);
  }
  function h3(e, t) {
    return t === void 0 && (t = "utf-8"), t = t || "utf-8", So().platform.decode(e, t);
  }
  var lle = { __proto__: null, createScalarValue: ile, toTypedArray: T3, now: Ob, fetch: sle, encodeString: $b, decodeString: h3, shuffle: AL, shuffleCombo: hse, clamp: Nb, nearestLargerEven: pse, swap: s3, sum: dse, randUniform: vse, distSquared: mse, assert: Dr, assertShapesMatch: nf, assertNonNull: Bm, flatten: Fm, sizeFromShape: Ml, isScalarShape: gse, arraysEqual: mv, isInt: Q1, tanh: yse, sizeToSquarishShape: xse, createShuffledIndices: bse, rightPad: Cb, repeatedTry: _se, inferFromImplicitShape: wse, parseAxisParam: Wb, squeezeShape: SL, getTypedArrayFromDType: EL, getArrayFromDType: DL, checkConversionForErrors: CL, isValidDtype: ML, hasEncodingLoss: kse, isTypedArray: Gc, bytesPerElement: r4, bytesFromStringArray: IL, isString: cv, isBoolean: NL, isNumber: FL, inferDtype: w3, isFunction: dv, nearestDivisor: l3, computeStrides: ay, toNestedArray: q1, makeOnesTypedArray: E4, makeZerosTypedArray: k3, makeZerosNestedTypedArray: Tse, assertNonNegativeIntegerDimensions: D4, locToIndex: Ase, indexToLoc: Sse, isPromise: C4, hexToLong: Gb, fingerPrint64: ale }, ule = function() {
    function e(t, r) {
      this.backendTimer = t, this.logger = r, r == null && (this.logger = new fle());
    }
    return e.prototype.profileKernel = function(t, r, n) {
      var a, o, s, i = function() {
        s = n();
      }, l, u2 = Ob();
      if (this.backendTimer.timerAvailable()) l = this.backendTimer.time(i);
      else {
        i();
        try {
          for (var c = Qf(s), f = c.next(); !f.done; f = c.next()) {
            var h = f.value;
            h.dataSync();
          }
        } catch (m) {
          a = { error: m };
        } finally {
          try {
            f && !f.done && (o = c.return) && o.call(c);
          } finally {
            if (a) throw a.error;
          }
        }
        l = Promise.resolve({ kernelMs: Ob() - u2 });
      }
      if (So().getBool("CHECK_COMPUTATION_FOR_ERRORS")) for (var p = function(m) {
        var g = s[m];
        g.data().then(function(x) {
          cle(x, g.dtype, t);
        });
      }, d = 0; d < s.length; d++) p(d);
      var v = { kernelName: t, outputs: s, inputs: r, timeMs: l.then(function(m) {
        return m.kernelMs;
      }), extraInfo: l.then(function(m) {
        return m.getExtraProfileInfo != null ? m.getExtraProfileInfo() : "";
      }) };
      return v;
    }, e.prototype.logKernelProfile = function(t) {
      var r = this, n = t.kernelName, a = t.outputs, o = t.timeMs, s = t.inputs, i = t.extraInfo;
      a.forEach(function(l) {
        Promise.all([l.data(), o, i]).then(function(u2) {
          r.logger.logKernelProfile(n, l, u2[0], u2[1], s, u2[2]);
        });
      });
    }, e;
  }();
  function cle(e, t, r) {
    if (t !== "float32") return false;
    for (var n = 0; n < e.length; n++) {
      var a = e[n];
      if (isNaN(a) || !isFinite(a)) return console.warn("Found " + a + " in the result of '" + r + "'"), true;
    }
    return false;
  }
  var fle = function() {
    function e() {
    }
    return e.prototype.logKernelProfile = function(t, r, n, a, o, s) {
      var i = typeof a == "number" ? Cb(a + "ms", 9) : a.error, l = Cb(t, 25), u2 = r.rank, c = r.size, f = Cb(r.shape.toString(), 14), h = "";
      for (var p in o) {
        var d = o[p];
        if (d != null) {
          var v = d.shape || r.shape, m = v.length;
          h += p + ": " + m + "D " + (m > 0 ? v : "") + " ";
        }
      }
      console.log("%c" + l + "	%c" + i + "	%c" + u2 + "D " + f + "	%c" + c + "	%c" + h + "	%c" + s, "font-weight:bold", "color:red", "color:blue", "color: orange", "color: green", "color: steelblue");
    }, e;
  }();
  function hle(e, t, r) {
    for (var n = {}, a = {}, o = 0; o < t.length; o++) n[t[o].id] = true;
    for (var o = 0; o < e.length; o++) {
      var s = e[o], i = s.inputs;
      for (var l in i) {
        for (var u2 = i[l], c = false, f = 0; f < t.length; f++) if (n[u2.id]) {
          s.outputs.forEach(function(b) {
            return n[b.id] = true;
          }), c = true, a[s.id] = true;
          break;
        }
        if (c) break;
      }
    }
    var h = {};
    h[r.id] = true;
    for (var p = {}, o = e.length - 1; o >= 0; o--) for (var s = e[o], i = s.inputs, f = 0; f < s.outputs.length; f++) if (h[s.outputs[f].id]) {
      for (var l in i) h[i[l].id] = true, p[s.id] = true;
      break;
    }
    for (var d = [], o = 0; o < e.length; o++) {
      var s = e[o];
      if (a[s.id] && p[s.id]) {
        var v = {};
        for (var l in s.inputs) {
          var m = s.inputs[l];
          n[m.id] && (v[l] = m);
        }
        var g = Object.assign({}, s);
        g.inputs = v, g.outputs = s.outputs, d.push(g);
      }
    }
    return d;
  }
  function ple(e, t, r, n) {
    for (var a = function(s) {
      var i = t[s], l = [];
      if (i.outputs.forEach(function(h) {
        var p = e[h.id];
        p != null ? l.push(p) : l.push(null);
      }), i.gradient == null) throw new Error("Cannot compute gradient: gradient function not found " + ("for " + i.kernelName + "."));
      var u2 = i.gradient(l), c = function(h) {
        if (!(h in u2)) throw new Error("Cannot backprop through input " + h + ". " + ("Available gradients found: " + Object.keys(u2) + "."));
        var p = r(function() {
          return u2[h]();
        });
        if (p.dtype !== "float32") throw new Error("Error in gradient for op " + i.kernelName + ". The gradient of input " + (h + " must have 'float32' dtype, but has '" + p.dtype + "'"));
        var d = i.inputs[h];
        if (!mv(p.shape, d.shape)) throw new Error("Error in gradient for op " + i.kernelName + ". The gradient of input " + ("'" + h + "' has shape '" + p.shape + "', which does not match ") + ("the shape of the input '" + d.shape + "'"));
        if (e[d.id] == null) e[d.id] = p;
        else {
          var v = e[d.id];
          e[d.id] = n(v, p), v.dispose();
        }
      };
      for (var f in i.inputs) c(f);
    }, o = t.length - 1; o >= 0; o--) a(o);
  }
  var hL = 20, Sb = 3, YE = 7;
  function dle(e, t, r, n) {
    var a = ay(t), o = vle(e, t, r, a), s = t.length, i = a3(e, t, r, a, o), l = ["Tensor"];
    return n && (l.push("  dtype: " + r), l.push("  rank: " + s), l.push("  shape: [" + t + "]"), l.push("  values:")), l.push(i.map(function(u2) {
      return "    " + u2;
    }).join(`
`)), l.join(`
`);
  }
  function vle(e, t, r, n) {
    var a = Ml(t), o = n[n.length - 1], s = new Array(o).fill(0), i = t.length, l = r === "complex64" ? Db(e) : e;
    if (i > 1) for (var u2 = 0; u2 < a / o; u2++) for (var c = u2 * o, f = 0; f < o; f++) s[f] = Math.max(s[f], Eb(l[c + f], 0, r).length);
    return s;
  }
  function Eb(e, t, r) {
    var n;
    return Array.isArray(e) ? n = parseFloat(e[0].toFixed(YE)) + " + " + (parseFloat(e[1].toFixed(YE)) + "j") : cv(e) ? n = "'" + e + "'" : r === "bool" ? n = S9(e) : n = parseFloat(e.toFixed(YE)).toString(), Cb(n, t);
  }
  function S9(e) {
    return e === 0 ? "false" : "true";
  }
  function a3(e, t, r, n, a, o) {
    o === void 0 && (o = true);
    var s = r === "complex64" ? 2 : 1, i = t[0], l = t.length;
    if (l === 0) {
      if (r === "complex64") {
        var u2 = Db(e);
        return [Eb(u2[0], 0, r)];
      }
      return r === "bool" ? [S9(e[0])] : [e[0].toString()];
    }
    if (l === 1) {
      if (i > hL) {
        var c = Sb * s, f = Array.from(e.slice(0, c)), h = Array.from(e.slice((i - Sb) * s, i * s));
        return r === "complex64" && (f = Db(f), h = Db(h)), ["[" + f.map(function(k, T2) {
          return Eb(k, a[T2], r);
        }).join(", ") + ", ..., " + h.map(function(k, T2) {
          return Eb(k, a[i - Sb + T2], r);
        }).join(", ") + "]"];
      }
      var p = r === "complex64" ? Db(e) : Array.from(e);
      return ["[" + p.map(function(k, T2) {
        return Eb(k, a[T2], r);
      }).join(", ") + "]"];
    }
    var d = t.slice(1), v = n.slice(1), m = n[0] * s, g = [];
    if (i > hL) {
      for (var x = 0; x < Sb; x++) {
        var b = x * m, y = b + m;
        g.push.apply(g, ys(a3(e.slice(b, y), d, r, v, a, false)));
      }
      g.push("...");
      for (var x = i - Sb; x < i; x++) {
        var b = x * m, y = b + m;
        g.push.apply(g, ys(a3(e.slice(b, y), d, r, v, a, x === i - 1)));
      }
    } else for (var x = 0; x < i; x++) {
      var b = x * m, y = b + m;
      g.push.apply(g, ys(a3(e.slice(b, y), d, r, v, a, x === i - 1)));
    }
    var w = l === 2 ? "," : "";
    g[0] = "[" + g[0] + w;
    for (var x = 1; x < g.length - 1; x++) g[x] = " " + g[x] + w;
    for (var _5 = `,
`, x = 2; x < l; x++) _5 += `
`;
    return g[g.length - 1] = " " + g[g.length - 1] + "]" + (o ? "" : _5), g;
  }
  function Db(e) {
    for (var t = [], r = 0; r < e.length; r += 2) t.push([e[r], e[r + 1]]);
    return t;
  }
  var p3 = function() {
    function e(t, r, n) {
      var a = this;
      if (this.dtype = r, this.shape = t.slice(), this.size = Ml(t), n != null) {
        var o = n.length;
        Dr(o === this.size, function() {
          return "Length of values '" + o + "' does not match the size " + ("inferred by the shape '" + a.size + "'.");
        });
      }
      if (r === "complex64") throw new Error("complex64 dtype TensorBuffers are not supported. Please create a TensorBuffer for the real and imaginary parts separately and call tf.complex(real, imag).");
      this.values = n || DL(r, this.size), this.strides = ay(t);
    }
    return e.prototype.set = function(t) {
      for (var r = this, n = [], a = 1; a < arguments.length; a++) n[a - 1] = arguments[a];
      n.length === 0 && (n = [0]), Dr(n.length === this.rank, function() {
        return "The number of provided coordinates (" + n.length + ") must " + ("match the rank (" + r.rank + ")");
      });
      var o = this.locToIndex(n);
      this.values[o] = t;
    }, e.prototype.get = function() {
      for (var t, r, n = [], a = 0; a < arguments.length; a++) n[a] = arguments[a];
      n.length === 0 && (n = [0]);
      var o = 0;
      try {
        for (var s = Qf(n), i = s.next(); !i.done; i = s.next()) {
          var l = i.value;
          if (l < 0 || l >= this.shape[o]) {
            var u2 = "Requested out of range element at " + n + ". " + ("  Buffer shape=" + this.shape);
            throw new Error(u2);
          }
          o++;
        }
      } catch (h) {
        t = { error: h };
      } finally {
        try {
          i && !i.done && (r = s.return) && r.call(s);
        } finally {
          if (t) throw t.error;
        }
      }
      for (var c = n[n.length - 1], f = 0; f < n.length - 1; ++f) c += this.strides[f] * n[f];
      return this.values[c];
    }, e.prototype.locToIndex = function(t) {
      if (this.rank === 0) return 0;
      if (this.rank === 1) return t[0];
      for (var r = t[t.length - 1], n = 0; n < t.length - 1; ++n) r += this.strides[n] * t[n];
      return r;
    }, e.prototype.indexToLoc = function(t) {
      if (this.rank === 0) return [];
      if (this.rank === 1) return [t];
      for (var r = new Array(this.shape.length), n = 0; n < r.length - 1; ++n) r[n] = Math.floor(t / this.strides[n]), t -= r[n] * this.strides[n];
      return r[r.length - 1] = t, r;
    }, Object.defineProperty(e.prototype, "rank", { get: function() {
      return this.shape.length;
    }, enumerable: true, configurable: true }), e.prototype.toTensor = function() {
      return Xp().makeTensor(this.values, this.shape, this.dtype);
    }, e;
  }(), Xp = null, G1 = null;
  function mle(e) {
    Xp = e;
  }
  function gle(e) {
    G1 = e;
  }
  var Du = function() {
    function e(t, r, n, a) {
      this.kept = false, this.isDisposedInternal = false, this.shape = t.slice(), this.dtype = r || "float32", this.size = Ml(t), this.strides = ay(t), this.dataId = n, this.id = a, this.rankType = this.rank < 5 ? this.rank.toString() : "higher";
    }
    return Object.defineProperty(e.prototype, "rank", { get: function() {
      return this.shape.length;
    }, enumerable: true, configurable: true }), e.prototype.buffer = function() {
      return xi(this, void 0, void 0, function() {
        var t;
        return bi(this, function(r) {
          switch (r.label) {
            case 0:
              return [4, this.data()];
            case 1:
              return t = r.sent(), [2, G1.buffer(this.shape, this.dtype, t)];
          }
        });
      });
    }, e.prototype.bufferSync = function() {
      return G1.buffer(this.shape, this.dtype, this.dataSync());
    }, e.prototype.array = function() {
      return xi(this, void 0, void 0, function() {
        var t;
        return bi(this, function(r) {
          switch (r.label) {
            case 0:
              return [4, this.data()];
            case 1:
              return t = r.sent(), [2, q1(this.shape, t, this.dtype === "complex64")];
          }
        });
      });
    }, e.prototype.arraySync = function() {
      return q1(this.shape, this.dataSync(), this.dtype === "complex64");
    }, e.prototype.data = function() {
      return xi(this, void 0, void 0, function() {
        var t, r;
        return bi(this, function(n) {
          switch (n.label) {
            case 0:
              return this.throwIfDisposed(), t = Xp().read(this.dataId), this.dtype !== "string" ? [3, 2] : [4, t];
            case 1:
              r = n.sent();
              try {
                return [2, r.map(function(a) {
                  return h3(a);
                })];
              } catch {
                throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().");
              }
              n.label = 2;
            case 2:
              return [2, t];
          }
        });
      });
    }, e.prototype.dataToGPU = function(t) {
      return this.throwIfDisposed(), Xp().readToGPU(this.dataId, t);
    }, e.prototype.dataSync = function() {
      this.throwIfDisposed();
      var t = Xp().readSync(this.dataId);
      if (this.dtype === "string") try {
        return t.map(function(r) {
          return h3(r);
        });
      } catch {
        throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().");
      }
      return t;
    }, e.prototype.bytes = function() {
      return xi(this, void 0, void 0, function() {
        var t;
        return bi(this, function(r) {
          switch (r.label) {
            case 0:
              return this.throwIfDisposed(), [4, Xp().read(this.dataId)];
            case 1:
              return t = r.sent(), this.dtype === "string" ? [2, t] : [2, new Uint8Array(t.buffer)];
          }
        });
      });
    }, e.prototype.dispose = function() {
      this.isDisposed || (Xp().disposeTensor(this), this.isDisposedInternal = true);
    }, Object.defineProperty(e.prototype, "isDisposed", { get: function() {
      return this.isDisposedInternal;
    }, enumerable: true, configurable: true }), e.prototype.throwIfDisposed = function() {
      if (this.isDisposed) throw new Error("Tensor is disposed.");
    }, e.prototype.print = function(t) {
      return t === void 0 && (t = false), G1.print(this, t);
    }, e.prototype.clone = function() {
      return this.throwIfDisposed(), G1.clone(this);
    }, e.prototype.toString = function(t) {
      t === void 0 && (t = false);
      var r = this.dataSync();
      return dle(r, this.shape, this.dtype, t);
    }, e.prototype.cast = function(t) {
      return this.throwIfDisposed(), G1.cast(this, t);
    }, e.prototype.variable = function(t, r, n) {
      return t === void 0 && (t = true), this.throwIfDisposed(), Xp().makeVariable(this, t, r, n);
    }, e;
  }();
  Object.defineProperty(Du, Symbol.hasInstance, { value: function(e) {
    return !!e && e.data != null && e.dataSync != null && e.throwIfDisposed != null;
  } });
  function yle() {
    return M4("Tensor", function() {
      return Du;
    });
  }
  yle();
  var Pb = function(e) {
    y0(t, e);
    function t(r, n, a, o) {
      var s = e.call(this, r.shape, r.dtype, r.dataId, o) || this;
      return s.trainable = n, s.name = a, s;
    }
    return t.prototype.assign = function(r) {
      if (r.dtype !== this.dtype) throw new Error("dtype of the new value (" + r.dtype + ") and " + ("previous value (" + this.dtype + ") must match"));
      if (!mv(r.shape, this.shape)) throw new Error("shape of the new value (" + r.shape + ") and " + ("previous value (" + this.shape + ") must match"));
      Xp().disposeTensor(this), this.dataId = r.dataId, Xp().incRef(this, null);
    }, t.prototype.dispose = function() {
      Xp().disposeVariable(this), this.isDisposedInternal = true;
    }, t;
  }(Du);
  Object.defineProperty(Pb, Symbol.hasInstance, { value: function(e) {
    return e instanceof Du && e.assign != null && e.assign instanceof Function;
  } });
  Gt.Rank = void 0;
  (function(e) {
    e.R0 = "R0", e.R1 = "R1", e.R2 = "R2", e.R3 = "R3", e.R4 = "R4", e.R5 = "R5", e.R6 = "R6";
  })(Gt.Rank || (Gt.Rank = {}));
  var f4;
  (function(e) {
    e.float32 = "float32", e.int32 = "int32", e.bool = "int32", e.complex64 = "complex64";
  })(f4 || (f4 = {}));
  var h4;
  (function(e) {
    e.float32 = "float32", e.int32 = "int32", e.bool = "bool", e.complex64 = "complex64";
  })(h4 || (h4 = {}));
  var p4;
  (function(e) {
    e.float32 = "float32", e.int32 = "float32", e.bool = "float32", e.complex64 = "complex64";
  })(p4 || (p4 = {}));
  var d4;
  (function(e) {
    e.float32 = "complex64", e.int32 = "complex64", e.bool = "complex64", e.complex64 = "complex64";
  })(d4 || (d4 = {}));
  var xle = { float32: p4, int32: f4, bool: h4, complex64: d4 };
  function A3(e, t) {
    if (e === "string" || t === "string") {
      if (e === "string" && t === "string") return "string";
      throw new Error("Can not upcast " + e + " with " + t);
    }
    return xle[e][t];
  }
  function ble(e) {
    return A3(e, "int32");
  }
  function Bl(e, t) {
    if (e.dtype === t.dtype) return [e, t];
    var r = A3(e.dtype, t.dtype);
    return [e.cast(r), t.cast(r)];
  }
  function E9(e, t) {
    Dr(e.dtype === t.dtype, function() {
      return "The dtypes of the first(" + e.dtype + ") and" + (" second(" + t.dtype + ") input must match");
    });
  }
  function _le(e, t) {
    return t.some(function(r) {
      return r.id === e.id;
    });
  }
  function R4(e) {
    var t = [], r = /* @__PURE__ */ new Set();
    return D9(e, t, r), t;
  }
  function D9(e, t, r) {
    if (e != null) {
      if (e instanceof Du) {
        t.push(e);
        return;
      }
      if (!!wle(e)) {
        var n = e;
        for (var a in n) {
          var o = n[a];
          r.has(o) || (r.add(o), D9(o, t, r));
        }
      }
    }
  }
  function wle(e) {
    return Array.isArray(e) || typeof e == "object";
  }
  var kle = { __proto__: null, makeTypesMatch: Bl, assertTypesMatch: E9, isTensorInList: _le, getTensorsInContainer: R4 };
  function ZE(e) {
    return e.kernelName != null;
  }
  var pL = function() {
    function e() {
      this.registeredVariables = {}, this.nextTapeNodeId = 0, this.numBytes = 0, this.numTensors = 0, this.numStringTensors = 0, this.numDataBuffers = 0, this.gradientDepth = 0, this.kernelDepth = 0, this.scopeStack = [], this.numDataMovesStack = [], this.nextScopeId = 0, this.tensorInfo = /* @__PURE__ */ new WeakMap(), this.profiling = false, this.activeProfile = { newBytes: 0, newTensors: 0, peakBytes: 0, kernels: [], result: null, get kernelNames() {
        return Array.from(new Set(this.kernels.map(function(t) {
          return t.name;
        })));
      } };
    }
    return e.prototype.dispose = function() {
      for (var t in this.registeredVariables) this.registeredVariables[t].dispose();
    }, e;
  }(), z4 = function() {
    function e(t) {
      this.ENV = t, this.registry = {}, this.registryFactory = {}, this.pendingBackendInitId = 0, this.state = new pL();
    }
    return e.prototype.ready = function() {
      return xi(this, void 0, void 0, function() {
        var t, r, n, a;
        return bi(this, function(o) {
          switch (o.label) {
            case 0:
              if (this.pendingBackendInit != null) return [2, this.pendingBackendInit.then(function() {
              })];
              if (this.backendInstance != null) return [2];
              t = this.getSortedBackends(), r = 0, o.label = 1;
            case 1:
              return r < t.length ? (n = t[r], [4, this.initializeBackend(n).success]) : [3, 5];
            case 2:
              return a = o.sent(), a ? [4, this.setBackend(n)] : [3, 4];
            case 3:
              return o.sent(), [2];
            case 4:
              return r++, [3, 1];
            case 5:
              throw new Error("Could not initialize any backends, all backend initializations failed.");
          }
        });
      });
    }, Object.defineProperty(e.prototype, "backend", { get: function() {
      if (this.pendingBackendInit != null) throw new Error("Backend '" + this.backendName + "' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods");
      if (this.backendInstance == null) {
        var t = this.initializeBackendsAndReturnBest(), r = t.name, n = t.asyncInit;
        if (n) throw new Error("The highest priority backend '" + r + "' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods");
        this.setBackend(r);
      }
      return this.backendInstance;
    }, enumerable: true, configurable: true }), e.prototype.backendNames = function() {
      return Object.keys(this.registryFactory);
    }, e.prototype.findBackend = function(t) {
      if (!(t in this.registry)) if (t in this.registryFactory) {
        var r = this.initializeBackend(t).asyncInit;
        if (r) return null;
      } else return null;
      return this.registry[t];
    }, e.prototype.findBackendFactory = function(t) {
      return t in this.registryFactory ? this.registryFactory[t].factory : null;
    }, e.prototype.registerBackend = function(t, r, n) {
      return n === void 0 && (n = 1), t in this.registryFactory ? (uv(t + " backend was already registered. Reusing existing backend factory."), false) : (this.registryFactory[t] = { factory: r, priority: n }, true);
    }, e.prototype.setBackend = function(t) {
      return xi(this, void 0, void 0, function() {
        var r, n, a, o, s;
        return bi(this, function(i) {
          switch (i.label) {
            case 0:
              if (this.registryFactory[t] == null) throw new Error("Backend name '" + t + "' not found in registry");
              return this.backendName = t, this.registry[t] != null ? [3, 4] : (this.backendInstance = null, r = this.initializeBackend(t), n = r.success, a = r.asyncInit, a ? [4, n] : [3, 2]);
            case 1:
              return s = i.sent(), [3, 3];
            case 2:
              s = n, i.label = 3;
            case 3:
              if (o = s, !o) return [2, false];
              i.label = 4;
            case 4:
              return this.backendInstance = this.registry[t], this.setupRegisteredKernels(), this.profiler = new ule(this.backendInstance), [2, true];
          }
        });
      });
    }, e.prototype.setupRegisteredKernels = function() {
      var t = this, r = c3(this.backendName);
      r.forEach(function(n) {
        n.setupFunc != null && n.setupFunc(t.backendInstance);
      });
    }, e.prototype.disposeRegisteredKernels = function(t) {
      var r = this, n = c3(t);
      n.forEach(function(a) {
        a.disposeFunc != null && a.disposeFunc(r.registry[t]);
      });
    }, e.prototype.initializeBackend = function(t) {
      var r = this, n = this.registryFactory[t];
      if (n == null) throw new Error("Cannot initialize backend " + t + ", no registration found.");
      try {
        var a = n.factory();
        if (a && !(a instanceof TL) && typeof a.then == "function") {
          var o = ++this.pendingBackendInitId, s = a.then(function(i) {
            return o < r.pendingBackendInitId ? false : (r.registry[t] = i, r.pendingBackendInit = null, true);
          }).catch(function(i) {
            return o < r.pendingBackendInitId || (r.pendingBackendInit = null, uv("Initialization of backend " + t + " failed"), uv(i.stack || i.message)), false;
          });
          return this.pendingBackendInit = s, { success: s, asyncInit: true };
        } else return this.registry[t] = a, { success: true, asyncInit: false };
      } catch (i) {
        return uv("Initialization of backend " + t + " failed"), uv(i.stack || i.message), { success: false, asyncInit: false };
      }
    }, e.prototype.removeBackend = function(t) {
      if (!(t in this.registryFactory)) throw new Error(t + " backend not found in registry");
      this.backendName === t && this.pendingBackendInit != null && this.pendingBackendInitId++, t in this.registry && (this.disposeRegisteredKernels(t), this.registry[t].dispose(), delete this.registry[t]), delete this.registryFactory[t], this.backendName === t && (this.pendingBackendInit = null, this.backendName = null, this.backendInstance = null);
    }, e.prototype.getSortedBackends = function() {
      var t = this;
      if (Object.keys(this.registryFactory).length === 0) throw new Error("No backend found in registry.");
      return Object.keys(this.registryFactory).sort(function(r, n) {
        return t.registryFactory[n].priority - t.registryFactory[r].priority;
      });
    }, e.prototype.initializeBackendsAndReturnBest = function() {
      for (var t = this.getSortedBackends(), r = 0; r < t.length; r++) {
        var n = t[r], a = this.initializeBackend(n), o = a.success, s = a.asyncInit;
        if (s || o) return { name: n, asyncInit: s };
      }
      throw new Error("Could not initialize any backends, all backend initializations failed.");
    }, e.prototype.moveData = function(t, r) {
      var n = this.state.tensorInfo.get(r), a = n.backend, o = this.readSync(r), s = a.refCount(r);
      a.disposeData(r, true), n.backend = t, t.move(r, o, n.shape, n.dtype, s), this.shouldCheckForMemLeaks() && this.state.numDataMovesStack[this.state.numDataMovesStack.length - 1]++;
    }, e.prototype.tidy = function(t, r) {
      var n = this, a = null;
      if (r == null) {
        if (typeof t != "function") throw new Error("Please provide a function to tidy()");
        r = t;
      } else {
        if (typeof t != "string" && !(t instanceof String)) throw new Error("When calling with two arguments, the first argument to tidy() must be a string");
        if (typeof r != "function") throw new Error("When calling with two arguments, the 2nd argument to tidy() must be a function");
        a = t;
      }
      var o;
      return this.scopedRun(function() {
        return n.startScope(a);
      }, function() {
        return n.endScope(o);
      }, function() {
        return o = r(), o instanceof Promise && console.error("Cannot return a Promise inside of tidy."), o;
      });
    }, e.prototype.scopedRun = function(t, r, n) {
      t();
      try {
        var a = n();
        return r(), a;
      } catch (o) {
        throw r(), o;
      }
    }, e.prototype.nextTensorId = function() {
      return e.nextTensorId++;
    }, e.prototype.nextVariableId = function() {
      return e.nextVariableId++;
    }, e.prototype.clone = function(t) {
      var r = Xr.runKernel(F42, { x: t }), n = { x: t }, a = function(s) {
        return { x: function() {
          var i = "float32", l = { x: s }, u2 = { dtype: i };
          return Xr.runKernel(N4, l, u2);
        } };
      }, o = [];
      return this.addTapeNode(this.state.activeScope.name, n, [r], a, o, {}), r;
    }, e.prototype.runKernel = function(t, r, n) {
      this.backendName == null && this.backend;
      var a = u3(t, this.backendName) != null;
      if (!a) throw new Error("Kernel '" + t + "' not registered for backend '" + this.backendName + "'");
      return this.runKernelFunc({ kernelName: t, inputs: r, attrs: n });
    }, e.prototype.shouldCheckForMemLeaks = function() {
      return this.ENV.getBool("IS_TEST");
    }, e.prototype.checkKernelForMemLeak = function(t, r, n) {
      var a = this.backend.numDataIds(), o = 0;
      n.forEach(function(l) {
        o += l.dtype === "complex64" ? 3 : 1;
      });
      var s = this.state.numDataMovesStack[this.state.numDataMovesStack.length - 1], i = a - r - o - s;
      if (i > 0) throw new Error("Backend '" + this.backendName + "' has an internal memory leak " + ("(" + i + " data ids) after running '" + t + "'"));
    }, e.prototype.runKernelFunc = function(t) {
      var r = this, n, a = [], o = this.isTapeOn(), s = this.state.numBytes, i = this.state.numTensors;
      this.shouldCheckForMemLeaks() && this.state.numDataMovesStack.push(0);
      var l;
      this.backendName == null && this.backend;
      var u2, c = ZE(t) ? t.kernelName : this.state.activeScope != null ? this.state.activeScope.name : "";
      if (ZE(t)) {
        var f = t.kernelName, h = t.inputs, p = t.attrs;
        this.backendName == null && this.backend;
        var d = u3(f, this.backendName);
        Dr(d != null, function() {
          return "Cannot find registered kernel '" + f + "' for backend '" + r.backendName + "'";
        }), l = function() {
          var w = r.backend.numDataIds();
          u2 = d.kernelFunc({ inputs: h, attrs: p, backend: r.backend });
          var _5 = Array.isArray(u2) ? u2 : [u2];
          r.shouldCheckForMemLeaks() && r.checkKernelForMemLeak(f, w, _5);
          var k = _5.map(function(A2) {
            if (A2.rank != null) return A2;
            var S2 = A2.dataId, C2 = A2.shape, E2 = A2.dtype;
            return r.makeTensorFromDataId(S2, C2, E2);
          });
          if (o) {
            var T2 = r.getTensorsForGradient(f, h, k);
            a = r.saveTensorsForBackwardMode(T2);
          }
          return k;
        };
      } else {
        var v = t.forwardFunc, m = function(w) {
          !o || (a = w.map(function(_5) {
            return r.keep(r.clone(_5));
          }));
        };
        l = function() {
          var w = r.backend.numDataIds();
          u2 = r.tidy(function() {
            return v(r.backend, m);
          });
          var _5 = Array.isArray(u2) ? u2 : [u2];
          return r.shouldCheckForMemLeaks() && r.checkKernelForMemLeak(c, w, _5), _5;
        };
      }
      var g = t.inputs, x = t.attrs, b = ZE(t) ? null : t.backwardsFunc, y;
      return this.scopedRun(function() {
        return r.state.kernelDepth++;
      }, function() {
        return r.state.kernelDepth--;
      }, function() {
        !r.ENV.getBool("DEBUG") && !r.state.profiling ? n = l() : (y = r.profiler.profileKernel(c, g, function() {
          return l();
        }), r.ENV.getBool("DEBUG") && r.profiler.logKernelProfile(y), n = y.outputs);
      }), o && this.addTapeNode(c, g, n, b, a, x), this.state.profiling && this.state.activeProfile.kernels.push({ name: c, bytesAdded: this.state.numBytes - s, totalBytesSnapshot: this.state.numBytes, tensorsAdded: this.state.numTensors - i, totalTensorsSnapshot: this.state.numTensors, inputShapes: Object.keys(g).map(function(w) {
        return g[w] != null ? g[w].shape : null;
      }), outputShapes: n.map(function(w) {
        return w.shape;
      }), kernelTimeMs: y.timeMs, extraInfo: y.extraInfo }), Array.isArray(u2) ? n : n[0];
    }, e.prototype.saveTensorsForBackwardMode = function(t) {
      var r = this, n = t.map(function(a) {
        return r.keep(r.clone(a));
      });
      return n;
    }, e.prototype.getTensorsForGradient = function(t, r, n) {
      var a = s4(t);
      if (a != null) {
        var o = a.inputsToSave || [], s = a.outputsToSave || [], i = void 0;
        a.saveAllInputs ? (Dr(Array.isArray(r), function() {
          return "saveAllInputs is true, expected inputs to be an array.";
        }), i = Object.keys(r).map(function(u2) {
          return r[u2];
        })) : i = o.map(function(u2) {
          return r[u2];
        });
        var l = n.filter(function(u2, c) {
          return s[c];
        });
        return i.concat(l);
      }
      return [];
    }, e.prototype.makeTensor = function(t, r, n, a) {
      if (t == null) throw new Error("Values passed to engine.makeTensor() are null");
      n = n || "float32", a = a || this.backend;
      var o = t;
      n === "string" && cv(t[0]) && (o = t.map(function(c) {
        return $b(c);
      }));
      var s = a.write(o, r, n), i = new Du(r, n, s, this.nextTensorId());
      if (this.trackTensor(i, a), n === "string") {
        var l = this.state.tensorInfo.get(s), u2 = IL(o);
        this.state.numBytes += u2 - l.bytes, l.bytes = u2;
      }
      return i;
    }, e.prototype.makeTensorFromDataId = function(t, r, n, a) {
      n = n || "float32";
      var o = new Du(r, n, t, this.nextTensorId());
      return this.trackTensor(o, a), o;
    }, e.prototype.makeVariable = function(t, r, n, a) {
      r === void 0 && (r = true), n = n || this.nextVariableId().toString(), a != null && a !== t.dtype && (t = t.cast(a));
      var o = new Pb(t, r, n, this.nextTensorId());
      if (this.state.registeredVariables[o.name] != null) throw new Error("Variable with name " + o.name + " was already registered");
      return this.state.registeredVariables[o.name] = o, this.incRef(o, this.backend), o;
    }, e.prototype.trackTensor = function(t, r) {
      this.state.numTensors++, t.dtype === "string" && this.state.numStringTensors++;
      var n = 0;
      t.dtype !== "complex64" && t.dtype !== "string" && (n = t.size * r4(t.dtype)), this.state.numBytes += n, this.state.tensorInfo.has(t.dataId) || (this.state.numDataBuffers++, this.state.tensorInfo.set(t.dataId, { backend: r || this.backend, dtype: t.dtype, shape: t.shape, bytes: n })), t instanceof Pb || this.track(t);
    }, e.prototype.incRef = function(t, r) {
      this.trackTensor(t, r), this.backend.incRef(t.dataId);
    }, e.prototype.removeDataId = function(t, r) {
      this.state.tensorInfo.has(t) && this.state.tensorInfo.get(t).backend === r && (this.state.tensorInfo.delete(t), this.state.numDataBuffers--);
    }, e.prototype.disposeTensor = function(t) {
      if (!!this.state.tensorInfo.has(t.dataId)) {
        var r = this.state.tensorInfo.get(t.dataId);
        if (this.state.numTensors--, t.dtype === "string" && (this.state.numStringTensors--, this.state.numBytes -= r.bytes), t.dtype !== "complex64" && t.dtype !== "string") {
          var n = t.size * r4(t.dtype);
          this.state.numBytes -= n;
        }
        r.backend.disposeData(t.dataId) && this.removeDataId(t.dataId, r.backend);
      }
    }, e.prototype.disposeVariables = function() {
      for (var t in this.state.registeredVariables) {
        var r = this.state.registeredVariables[t];
        this.disposeVariable(r);
      }
    }, e.prototype.disposeVariable = function(t) {
      this.disposeTensor(t), this.state.registeredVariables[t.name] != null && delete this.state.registeredVariables[t.name];
    }, e.prototype.memory = function() {
      var t = this.backend.memory();
      return t.numTensors = this.state.numTensors, t.numDataBuffers = this.state.numDataBuffers, t.numBytes = this.state.numBytes, this.state.numStringTensors > 0 && (t.unreliable = true, t.reasons == null && (t.reasons = []), t.reasons.push("Memory usage by string tensors is approximate (2 bytes per character)")), t;
    }, e.prototype.profile = function(t) {
      return xi(this, void 0, void 0, function() {
        var r, n, a, o, s, i, l, u2, c, f, h;
        return bi(this, function(p) {
          switch (p.label) {
            case 0:
              return this.state.profiling = true, r = this.state.numBytes, n = this.state.numTensors, this.state.activeProfile.kernels = [], a = this.state.activeProfile, [4, t()];
            case 1:
              a.result = p.sent(), this.state.profiling = false, this.state.activeProfile.peakBytes = Math.max.apply(Math, ys(this.state.activeProfile.kernels.map(function(d) {
                return d.totalBytesSnapshot;
              }))), this.state.activeProfile.newBytes = this.state.numBytes - r, this.state.activeProfile.newTensors = this.state.numTensors - n, p.label = 2;
            case 2:
              p.trys.push([2, 8, 9, 10]), o = Qf(this.state.activeProfile.kernels), s = o.next(), p.label = 3;
            case 3:
              return s.done ? [3, 7] : (i = s.value, l = i, [4, i.kernelTimeMs]);
            case 4:
              return l.kernelTimeMs = p.sent(), u2 = i, [4, i.extraInfo];
            case 5:
              u2.extraInfo = p.sent(), p.label = 6;
            case 6:
              return s = o.next(), [3, 3];
            case 7:
              return [3, 10];
            case 8:
              return c = p.sent(), f = { error: c }, [3, 10];
            case 9:
              try {
                s && !s.done && (h = o.return) && h.call(o);
              } finally {
                if (f) throw f.error;
              }
              return [7];
            case 10:
              return [2, this.state.activeProfile];
          }
        });
      });
    }, e.prototype.isTapeOn = function() {
      return this.state.gradientDepth > 0 && this.state.kernelDepth === 0;
    }, e.prototype.addTapeNode = function(t, r, n, a, o, s) {
      var i = this, l = { id: this.state.nextTapeNodeId++, kernelName: t, inputs: r, outputs: n, saved: o }, u2 = s4(t);
      u2 != null && (a = u2.gradFunc), a != null && (l.gradient = function(c) {
        return c = c.map(function(f, h) {
          if (f == null) {
            var p = n[h], d = k3(p.size, p.dtype);
            return i.makeTensor(d, p.shape, p.dtype);
          }
          return f;
        }), a(c.length > 1 ? c : c[0], o, s);
      }), this.state.activeTape.push(l);
    }, e.prototype.keep = function(t) {
      return t.kept = true, t;
    }, e.prototype.startTape = function() {
      this.state.gradientDepth === 0 && (this.state.activeTape = []), this.state.gradientDepth++;
    }, e.prototype.endTape = function() {
      this.state.gradientDepth--;
    }, e.prototype.startScope = function(t) {
      var r = { track: [], name: "unnamed scope", id: this.state.nextScopeId++ };
      t && (r.name = t), this.state.scopeStack.push(r), this.state.activeScope = r;
    }, e.prototype.endScope = function(t) {
      for (var r = this, n = R4(t), a = new Set(n.map(function(l) {
        return l.id;
      })), o = 0; o < this.state.activeScope.track.length; o++) {
        var s = this.state.activeScope.track[o];
        !s.kept && !a.has(s.id) && s.dispose();
      }
      var i = this.state.scopeStack.pop();
      this.state.activeScope = this.state.scopeStack.length === 0 ? null : this.state.scopeStack[this.state.scopeStack.length - 1], n.forEach(function(l) {
        !l.kept && l.scopeId === i.id && r.track(l);
      });
    }, e.prototype.gradients = function(t, r, n, a) {
      var o = this;
      if (a === void 0 && (a = false), Dr(r.length > 0, function() {
        return "gradients() received an empty list of xs.";
      }), n != null && n.dtype !== "float32") throw new Error("dy must have 'float32' dtype, but has '" + n.dtype + "'");
      var s = this.scopedRun(function() {
        return o.startTape();
      }, function() {
        return o.endTape();
      }, function() {
        return o.tidy("forward", t);
      });
      Dr(s instanceof Du, function() {
        return "The result y returned by f() must be a tensor.";
      });
      var i = hle(this.state.activeTape, r, s);
      if (!a && i.length === 0 && r.length > 0) throw new Error("Cannot compute gradient of y=f(x) with respect to x. Make sure that the f you passed encloses all operations that lead from x to y.");
      return this.tidy("backward", function() {
        var l = {};
        l[s.id] = n ?? Tle(s.shape), ple(l, i, function(c) {
          return o.tidy(c);
        }, Ale);
        var u2 = r.map(function(c) {
          return l[c.id];
        });
        return o.state.gradientDepth === 0 && (o.state.activeTape.forEach(function(c) {
          var f, h;
          try {
            for (var p = Qf(c.saved), d = p.next(); !d.done; d = p.next()) {
              var v = d.value;
              v.dispose();
            }
          } catch (m) {
            f = { error: m };
          } finally {
            try {
              d && !d.done && (h = p.return) && h.call(p);
            } finally {
              if (f) throw f.error;
            }
          }
        }), o.state.activeTape = null), { value: s, grads: u2 };
      });
    }, e.prototype.customGrad = function(t) {
      var r = this;
      return Dr(dv(t), function() {
        return "The f passed in customGrad(f) must be a function.";
      }), function() {
        for (var n = [], a = 0; a < arguments.length; a++) n[a] = arguments[a];
        Dr(n.every(function(u2) {
          return u2 instanceof Du;
        }), function() {
          return "The args passed in customGrad(f)(x1, x2,...) must all be tensors";
        });
        var o, s = {};
        n.forEach(function(u2, c) {
          s[c] = u2;
        });
        var i = function(u2, c) {
          return o = t.apply(void 0, ys(n, [c])), Dr(o.value instanceof Du, function() {
            return "The function f passed in customGrad(f) must return an object where `obj.value` is a tensor";
          }), Dr(dv(o.gradFunc), function() {
            return "The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function.";
          }), o.value;
        }, l = function(u2, c) {
          var f = o.gradFunc(u2, c), h = Array.isArray(f) ? f : [f];
          Dr(h.length === n.length, function() {
            return "The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns the same number of tensors as inputs passed to f(...).";
          }), Dr(h.every(function(d) {
            return d instanceof Du;
          }), function() {
            return "The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns a list of only tensors.";
          });
          var p = {};
          return h.forEach(function(d, v) {
            p[v] = function() {
              return d;
            };
          }), p;
        };
        return r.runKernelFunc({ forwardFunc: i, backwardsFunc: l, inputs: s });
      };
    }, e.prototype.readSync = function(t) {
      var r = this.state.tensorInfo.get(t);
      return r.backend.readSync(t);
    }, e.prototype.read = function(t) {
      var r = this.state.tensorInfo.get(t);
      return r.backend.read(t);
    }, e.prototype.readToGPU = function(t, r) {
      var n = this.state.tensorInfo.get(t);
      return n.backend.readToGPU(t, r);
    }, e.prototype.time = function(t) {
      return xi(this, void 0, void 0, function() {
        var r, n;
        return bi(this, function(a) {
          switch (a.label) {
            case 0:
              return r = Ob(), [4, this.backend.time(t)];
            case 1:
              return n = a.sent(), n.wallMs = Ob() - r, [2, n];
          }
        });
      });
    }, e.prototype.track = function(t) {
      return this.state.activeScope != null && (t.scopeId = this.state.activeScope.id, this.state.activeScope.track.push(t)), t;
    }, Object.defineProperty(e.prototype, "registeredVariables", { get: function() {
      return this.state.registeredVariables;
    }, enumerable: true, configurable: true }), e.prototype.reset = function() {
      this.pendingBackendInitId++, this.state.dispose(), this.ENV.reset(), this.state = new pL();
      for (var t in this.registry) this.disposeRegisteredKernels(t), this.registry[t].dispose(), delete this.registry[t];
      this.backendName = null, this.backendInstance = null, this.pendingBackendInit = null;
    }, e;
  }();
  z4.nextTensorId = 0;
  z4.nextVariableId = 0;
  function Tle(e) {
    var t = E4(Ml(e), "float32");
    return Xr.makeTensor(t, e, "float32");
  }
  function C9() {
    var e = LL();
    if (e._tfengine == null) {
      var t = new PL(e);
      e._tfengine = new z4(t);
    }
    return Mse(e._tfengine.ENV), mle(function() {
      return e._tfengine;
    }), e._tfengine;
  }
  var Xr = C9();
  function Ale(e, t) {
    var r = { a: e, b: t };
    return Xr.runKernel(I4, r);
  }
  function Sle() {
    return typeof navigator < "u" && navigator != null;
  }
  var v4;
  function Ele(e) {
    v4 = e;
  }
  function Dle(e) {
    if (v4 !== void 0) return v4;
    if (e || Sle()) {
      if (e || (e = navigator), e.product === "ReactNative") return true;
      var t = e.userAgent || e.vendor || (typeof window < "u" ? window.opera : "");
      if (!t) {
        var r = e;
        return r.userAgentData && r.userAgentData.mobile;
      }
      return /(android|bb\d+|meego).+mobile|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(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0, 4));
    }
    return false;
  }
  function M9() {
    return typeof window < "u" && window.document != null || typeof WorkerGlobalScope < "u";
  }
  var Cle = { __proto__: null, mockIsMobile: Ele, isMobile: Dle, isBrowser: M9 };
  var Zp = So();
  Zp.registerFlag("DEBUG", function() {
    return false;
  }, function(e) {
    e && console.warn("Debugging mode is ON. The output of every math call will be downloaded to CPU and checked for NaNs. This significantly impacts performance.");
  });
  Zp.registerFlag("IS_BROWSER", function() {
    return M9();
  });
  Zp.registerFlag("IS_NODE", function() {
    return typeof process < "u" && typeof process.versions < "u" && typeof process.versions.node < "u";
  });
  Zp.registerFlag("IS_CHROME", function() {
    return typeof navigator < "u" && navigator != null && navigator.userAgent != null && /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
  });
  Zp.registerFlag("PROD", function() {
    return false;
  });
  Zp.registerFlag("TENSORLIKE_CHECK_SHAPE_CONSISTENCY", function() {
    return Zp.getBool("DEBUG");
  });
  Zp.registerFlag("DEPRECATION_WARNINGS_ENABLED", function() {
    return true;
  });
  Zp.registerFlag("IS_TEST", function() {
    return false;
  });
  Zp.registerFlag("CHECK_COMPUTATION_FOR_ERRORS", function() {
    return true;
  });
  Zp.registerFlag("WRAP_TO_IMAGEBITMAP", function() {
    return false;
  });
  function Rd(e, t) {
    var r = e;
    if (Gc(e)) return t === "string" ? [] : [e.length];
    if (!Array.isArray(e)) return [];
    for (var n = []; Array.isArray(r) || Gc(r) && t !== "string"; ) n.push(r.length), r = r[0];
    return Array.isArray(e) && So().getBool("TENSORLIKE_CHECK_SHAPE_CONSISTENCY") && I9(e, n, []), n;
  }
  function I9(e, t, r) {
    if (r = r || [], !Array.isArray(e) && !Gc(e)) {
      Dr(t.length === 0, function() {
        return "Element arr[" + r.join("][") + "] is a primitive, " + ("but should be an array/TypedArray of " + t[0] + " elements");
      });
      return;
    }
    Dr(t.length > 0, function() {
      return "Element arr[" + r.join("][") + "] should be a primitive, " + ("but is an array of " + e.length + " elements");
    }), Dr(e.length === t[0], function() {
      return "Element arr[" + r.join("][") + "] should have " + t[0] + " " + ("elements, but has " + e.length + " elements");
    });
    for (var n = t.slice(1), a = 0; a < e.length; ++a) I9(e[a], n, r.concat(a));
  }
  function dL(e, t, r, n) {
    if (e !== "string_or_numeric") {
      if (e == null) throw new Error("Expected dtype cannot be null.");
      if (e !== "numeric" && e !== t || e === "numeric" && t === "string") throw new Error("Argument '" + r + "' passed to '" + n + "' must " + ("be " + e + " tensor, but got " + t + " tensor"));
    }
  }
  function mr(e, t, r, n) {
    if (n === void 0 && (n = "numeric"), e instanceof Du) return dL(n, e.dtype, t, r), e;
    var a = w3(e);
    if (a !== "string" && ["bool", "int32", "float32"].indexOf(n) >= 0 && (a = n), dL(n, a, t, r), e == null || !Gc(e) && !Array.isArray(e) && typeof e != "number" && typeof e != "boolean" && typeof e != "string") {
      var o = e == null ? "null" : e.constructor.name;
      throw new Error("Argument '" + t + "' passed to '" + r + "' must be a " + ("Tensor or TensorLike, but got '" + o + "'"));
    }
    var s = Rd(e, a);
    !Gc(e) && !Array.isArray(e) && (e = [e]);
    var i = true, l = a !== "string" ? T3(e, a) : Fm(e, [], i);
    return Xr.makeTensor(l, s, a);
  }
  function Lb(e, t, r, n) {
    if (n === void 0 && (n = "numeric"), !Array.isArray(e)) throw new Error("Argument " + t + " passed to " + r + " must be a `Tensor[]` or `TensorLike[]`");
    var a = e;
    return a.map(function(o, s) {
      return mr(o, t + "[" + s + "]", r, n);
    });
  }
  var N9 = "__op";
  function Hr(e) {
    var t = Object.keys(e);
    if (t.length !== 1) throw new Error("Please provide an object with a single key (operation name) mapping to a function. Got an object with " + (t.length + " keys."));
    var r = t[0], n = e[r];
    r.endsWith("_") && (r = r.substring(0, r.length - 1)), r = r + N9;
    var a = function() {
      for (var o = [], s = 0; s < arguments.length; s++) o[s] = arguments[s];
      Xr.startScope(r);
      try {
        var i = n.apply(void 0, ys(o));
        return C4(i) && console.error("Cannot return a Promise inside of tidy."), Xr.endScope(i), i;
      } catch (l) {
        throw Xr.endScope(null), l;
      }
    };
    return Object.defineProperty(a, "name", { value: r, configurable: true }), a;
  }
  function Mle(e, t) {
    var r = mr(e, "real", "complex"), n = mr(t, "imag", "complex");
    nf(r.shape, n.shape, "real and imag shapes, " + r.shape + " and " + n.shape + ", must match in call to tf.complex().");
    var a = { real: r, imag: n };
    return Xr.runKernel(aR, a);
  }
  var Om = Hr({ complex_: Mle });
  function gv(e, t, r, n) {
    if (n == null && (n = w3(e)), n === "complex64") throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");
    if (!Gc(e) && !Array.isArray(e) && typeof e != "number" && typeof e != "boolean" && typeof e != "string") throw new Error("values passed to tensor(values) must be a number/boolean/string or an array of numbers/booleans/strings, or a TypedArray");
    if (t != null) {
      D4(t);
      var a = Ml(t), o = Ml(r);
      Dr(a === o, function() {
        return "Based on the provided shape, [" + t + "], the tensor should have " + (a + " values but has " + o);
      });
      for (var s = 0; s < r.length; ++s) {
        var i = r[s], l = s === r.length - 1 ? i !== Ml(t.slice(s)) : true;
        Dr(r[s] === t[s] || !l, function() {
          return "Error creating a new Tensor. Inferred shape " + ("(" + r + ") does not match the provided ") + ("shape (" + t + "). ");
        });
      }
    }
    return !Gc(e) && !Array.isArray(e) && (e = [e]), t = t || r, e = n !== "string" ? T3(e, n) : Fm(e, [], true), Xr.makeTensor(e, t, n);
  }
  function X1(e, t, r) {
    var n = Rd(e, r);
    return gv(e, t, n, r);
  }
  var m4 = { float32: 4, float16: 2, int32: 4, uint16: 2, uint8: 1, bool: 1, complex64: 8 }, d3 = 4;
  function Ile(e, t) {
    return xi(this, void 0, void 0, function() {
      var r, n, a, o, s, i, l = this;
      return bi(this, function(u2) {
        switch (u2.label) {
          case 0:
            for (r = [], n = [], a = Array.isArray(e) ? e.map(function(c) {
              return c.name;
            }) : Object.keys(e), o = function(c) {
              var f = a[c], h = Array.isArray(e) ? e[c].tensor : e[f];
              if (h.dtype !== "float32" && h.dtype !== "int32" && h.dtype !== "bool" && h.dtype !== "string" && h.dtype !== "complex64") throw new Error("Unsupported dtype in weight '" + f + "': " + h.dtype);
              var p = { name: f, shape: h.shape, dtype: h.dtype };
              if (h.dtype === "string") {
                var d = new Promise(function(v) {
                  return xi(l, void 0, void 0, function() {
                    var m, g, x, b, y, w, _5;
                    return bi(this, function(k) {
                      switch (k.label) {
                        case 0:
                          return [4, h.bytes()];
                        case 1:
                          for (m = k.sent(), g = m.reduce(function(T2, A2) {
                            return T2 + A2.length;
                          }, 0) + d3 * m.length, x = new Uint8Array(g), b = 0, y = 0; y < m.length; y++) w = m[y], _5 = new Uint8Array(new Uint32Array([w.length]).buffer), x.set(_5, b), b += d3, x.set(w, b), b += w.length;
                          return v(x), [2];
                      }
                    });
                  });
                });
                n.push(d);
              } else n.push(h.data());
              t != null && (p.group = t), r.push(p);
            }, s = 0; s < a.length; ++s) o(s);
            return [4, Promise.all(n)];
          case 1:
            return i = u2.sent(), [2, { data: Nle(i), specs: r }];
        }
      });
    });
  }
  function F92(e, t) {
    var r, n, a = {}, o, s = 0;
    try {
      for (var i = Qf(t), l = i.next(); !l.done; l = i.next()) {
        var u2 = l.value, c = u2.name, f = u2.dtype, h = u2.shape, p = Ml(h), d = void 0;
        if ("quantization" in u2) {
          var v = u2.quantization;
          if (v.dtype === "uint8" || v.dtype === "uint16") {
            if (!("min" in v && "scale" in v)) throw new Error("Weight " + u2.name + " with quantization " + v.dtype + " doesn't have corresponding metadata min and scale.");
          } else if (v.dtype === "float16") {
            if (f !== "float32") throw new Error("Weight " + u2.name + " is quantized with " + v.dtype + " " + ("which only supports weights of type float32 not " + f + "."));
          } else throw new Error("Weight " + u2.name + " has unknown " + ("quantization dtype " + v.dtype + ". ") + "Supported quantization dtypes are: 'uint8', 'uint16', and 'float16'.");
          var m = m4[v.dtype], g = e.slice(s, s + p * m), x = v.dtype === "uint8" ? new Uint8Array(g) : new Uint16Array(g);
          if (f === "float32") if (v.dtype === "uint8" || v.dtype === "uint16") {
            d = new Float32Array(x.length);
            for (var b = 0; b < x.length; b++) {
              var y = x[b];
              d[b] = y * v.scale + v.min;
            }
          } else if (v.dtype === "float16") o === void 0 && (o = zle()), d = o(x);
          else throw new Error("Unsupported quantization type " + v.dtype + " for weight type float32.");
          else if (f === "int32") {
            if (v.dtype !== "uint8" && v.dtype !== "uint16") throw new Error("Unsupported quantization type " + v.dtype + " for weight type int32.");
            d = new Int32Array(x.length);
            for (var b = 0; b < x.length; b++) {
              var y = x[b];
              d[b] = Math.round(y * v.scale + v.min);
            }
          } else throw new Error("Unsupported dtype in weight '" + c + "': " + f);
          s += p * m;
        } else if (f === "string") {
          var w = Ml(u2.shape);
          d = [];
          for (var b = 0; b < w; b++) {
            var _5 = new Uint32Array(e.slice(s, s + d3))[0];
            s += d3;
            var k = new Uint8Array(e.slice(s, s + _5));
            d.push(k), s += _5;
          }
        } else {
          var T2 = m4[f], g = e.slice(s, s + p * T2);
          if (f === "float32") d = new Float32Array(g);
          else if (f === "int32") d = new Int32Array(g);
          else if (f === "bool") d = new Uint8Array(g);
          else if (f === "complex64") {
            d = new Float32Array(g);
            for (var A2 = new Float32Array(d.length / 2), S2 = new Float32Array(d.length / 2), b = 0; b < A2.length; b++) A2[b] = d[b * 2], S2[b] = d[b * 2 + 1];
            var C2 = X1(A2, h, "float32"), E2 = X1(S2, h, "float32");
            a[c] = Om(C2, E2), C2.dispose(), E2.dispose();
          } else throw new Error("Unsupported dtype in weight '" + c + "': " + f);
          s += p * T2;
        }
        f !== "complex64" && (a[c] = X1(d, h, f));
      }
    } catch (F13) {
      r = { error: F13 };
    } finally {
      try {
        l && !l.done && (n = i.return) && n.call(i);
      } finally {
        if (r) throw r.error;
      }
    }
    return a;
  }
  function Nle(e) {
    if (e === null) throw new Error("Invalid input value: " + JSON.stringify(e));
    var t = 0, r = [];
    e.forEach(function(o) {
      if (t += o.byteLength, r.push(o.byteLength === o.buffer.byteLength ? o : new o.constructor(o)), !(o instanceof Float32Array || o instanceof Int32Array || o instanceof Uint8Array)) throw new Error("Unsupported TypedArray subtype: " + o.constructor.name);
    });
    var n = new Uint8Array(t), a = 0;
    return r.forEach(function(o) {
      n.set(new Uint8Array(o.buffer), a), a += o.byteLength;
    }), n.buffer;
  }
  var B4 = typeof Buffer < "u" && (typeof Blob > "u" || typeof atob > "u" || typeof btoa > "u");
  function vL(e) {
    return B4 ? Buffer.byteLength(e) : new Blob([e]).size;
  }
  function Fle(e) {
    if (B4) return Buffer.from(e).toString("base64");
    for (var t = new Uint8Array(e), r = "", n = 0, a = t.length; n < a; n++) r += String.fromCharCode(t[n]);
    return btoa(r);
  }
  function Ole(e) {
    if (B4) {
      var t = Buffer.from(e, "base64");
      return t.buffer.slice(t.byteOffset, t.byteOffset + t.byteLength);
    }
    for (var r = atob(e), n = new Uint8Array(r.length), a = 0; a < r.length; ++a) n.set([r.charCodeAt(a)], a);
    return n.buffer;
  }
  function U4(e) {
    if (e.length === 1) return e[0];
    var t = 0;
    e.forEach(function(a) {
      t += a.byteLength;
    });
    var r = new Uint8Array(t), n = 0;
    return e.forEach(function(a) {
      r.set(new Uint8Array(a), n), n += a.byteLength;
    }), r.buffer;
  }
  function mL(e) {
    var t = "/";
    for (e = e.trim(); e.endsWith(t); ) e = e.slice(0, e.length - 1);
    var r = e.split(t);
    return r[r.length - 1];
  }
  function O9(e, t) {
    var r = { modelTopology: e.modelTopology, format: e.format, generatedBy: e.generatedBy, convertedBy: e.convertedBy, weightsManifest: t };
    return e.signature != null && (r.signature = e.signature), e.userDefinedMetadata != null && (r.userDefinedMetadata = e.userDefinedMetadata), e.modelInitializer != null && (r.modelInitializer = e.modelInitializer), e.trainingConfig != null && (r.trainingConfig = e.trainingConfig), r;
  }
  function V4(e, t) {
    return xi(this, void 0, void 0, function() {
      var r, n, a, o;
      return bi(this, function(s) {
        switch (s.label) {
          case 0:
            return r = { modelTopology: e.modelTopology, format: e.format, generatedBy: e.generatedBy, convertedBy: e.convertedBy }, e.trainingConfig != null && (r.trainingConfig = e.trainingConfig), e.weightsManifest == null ? [3, 2] : [4, t(e.weightsManifest)];
          case 1:
            n = hi.apply(void 0, [s.sent(), 2]), a = n[0], o = n[1], r.weightSpecs = a, r.weightData = o, s.label = 2;
          case 2:
            return e.signature != null && (r.signature = e.signature), e.userDefinedMetadata != null && (r.userDefinedMetadata = e.userDefinedMetadata), e.modelInitializer != null && (r.modelInitializer = e.modelInitializer), [2, r];
        }
      });
    });
  }
  function Hb(e) {
    if (e.modelTopology instanceof ArrayBuffer) throw new Error("Expected JSON model topology, received ArrayBuffer.");
    return { dateSaved: /* @__PURE__ */ new Date(), modelTopologyType: "JSON", modelTopologyBytes: e.modelTopology == null ? 0 : vL(JSON.stringify(e.modelTopology)), weightSpecsBytes: e.weightSpecs == null ? 0 : vL(JSON.stringify(e.weightSpecs)), weightDataBytes: e.weightData == null ? 0 : e.weightData.byteLength };
  }
  function Ple() {
    var e = function(n) {
      for (var a = n << 13, o = 0; (a & 8388608) === 0; ) o -= 8388608, a <<= 1;
      return a &= -8388609, o += 947912704, a | o;
    }, t = new Uint32Array(2048);
    t[0] = 0;
    for (var r = 1; r < 1024; r++) t[r] = e(r);
    for (var r = 1024; r < 2048; r++) t[r] = 939524096 + (r - 1024 << 13);
    return t;
  }
  function Lle() {
    var e = new Uint32Array(64);
    e[0] = 0, e[31] = 1199570944, e[32] = 2147483648, e[63] = 3347054592;
    for (var t = 1; t < 31; t++) e[t] = t << 23;
    for (var t = 33; t < 63; t++) e[t] = 2147483648 + (t - 32 << 23);
    return e;
  }
  function Rle() {
    for (var e = new Uint32Array(64), t = 0; t < 64; t++) e[t] = 1024;
    return e[0] = e[32] = 0, e;
  }
  function zle() {
    var e = Ple(), t = Lle(), r = Rle();
    return function(n) {
      for (var a = new ArrayBuffer(4 * n.length), o = new Uint32Array(a), s = 0; s < n.length; s++) {
        var i = n[s], l = e[r[i >> 10] + (i & 1023)] + t[i >> 10];
        o[s] = l;
      }
      return new Float32Array(a);
    };
  }
  var Dh = function() {
    function e() {
      this.saveRouters = [], this.loadRouters = [];
    }
    return e.getInstance = function() {
      return e.instance == null && (e.instance = new e()), e.instance;
    }, e.registerSaveRouter = function(t) {
      e.getInstance().saveRouters.push(t);
    }, e.registerLoadRouter = function(t) {
      e.getInstance().loadRouters.push(t);
    }, e.getSaveHandlers = function(t) {
      return e.getHandlers(t, "save");
    }, e.getLoadHandlers = function(t, r) {
      return e.getHandlers(t, "load", r);
    }, e.getHandlers = function(t, r, n) {
      var a = [], o = r === "load" ? e.getInstance().loadRouters : e.getInstance().saveRouters;
      return o.forEach(function(s) {
        var i = s(t, n);
        i !== null && a.push(i);
      }), a;
    }, e;
  }(), Ble = function(e) {
    return Dh.registerSaveRouter(e);
  }, Ule = function(e) {
    return Dh.registerLoadRouter(e);
  }, Vle = function(e) {
    return Dh.getSaveHandlers(e);
  }, jle = function(e, t) {
    return Dh.getLoadHandlers(e, t);
  }, g4 = "tensorflowjs", y4 = 1, Cm = "models_store", fv2 = "model_info_store";
  function P9() {
    if (!So().getBool("IS_BROWSER")) throw new Error("Failed to obtain IndexedDB factory because the current environmentis not a web browser.");
    var e = typeof window > "u" ? self : window, t = e.indexedDB || e.mozIndexedDB || e.webkitIndexedDB || e.msIndexedDB || e.shimIndexedDB;
    if (t == null) throw new Error("The current browser does not appear to support IndexedDB.");
    return t;
  }
  function x4(e) {
    var t = e.result;
    t.createObjectStore(Cm, { keyPath: "modelPath" }), t.createObjectStore(fv2, { keyPath: "modelPath" });
  }
  var Pm = function() {
    function e(t) {
      if (this.indexedDB = P9(), t == null || !t) throw new Error("For IndexedDB, modelPath must not be null, undefined or empty.");
      this.modelPath = t;
    }
    return e.prototype.save = function(t) {
      return xi(this, void 0, void 0, function() {
        return bi(this, function(r) {
          if (t.modelTopology instanceof ArrayBuffer) throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");
          return [2, this.databaseAction(this.modelPath, t)];
        });
      });
    }, e.prototype.load = function() {
      return xi(this, void 0, void 0, function() {
        return bi(this, function(t) {
          return [2, this.databaseAction(this.modelPath)];
        });
      });
    }, e.prototype.databaseAction = function(t, r) {
      var n = this;
      return new Promise(function(a, o) {
        var s = n.indexedDB.open(g4, y4);
        s.onupgradeneeded = function() {
          return x4(s);
        }, s.onsuccess = function() {
          var i = s.result;
          if (r == null) {
            var l = i.transaction(Cm, "readonly"), u2 = l.objectStore(Cm), c = u2.get(n.modelPath);
            c.onsuccess = function() {
              if (c.result == null) return i.close(), o(new Error("Cannot find model with path '" + n.modelPath + "' in IndexedDB."));
              a(c.result.modelArtifacts);
            }, c.onerror = function(m) {
              return i.close(), o(c.error);
            }, l.oncomplete = function() {
              return i.close();
            };
          } else {
            var f = Hb(r), h = i.transaction(fv2, "readwrite"), p = h.objectStore(fv2), d = p.put({ modelPath: n.modelPath, modelArtifactsInfo: f }), v;
            d.onsuccess = function() {
              v = i.transaction(Cm, "readwrite");
              var m = v.objectStore(Cm), g = m.put({ modelPath: n.modelPath, modelArtifacts: r, modelArtifactsInfo: f });
              g.onsuccess = function() {
                return a({ modelArtifactsInfo: f });
              }, g.onerror = function(x) {
                p = h.objectStore(fv2);
                var b = p.delete(n.modelPath);
                b.onsuccess = function() {
                  return i.close(), o(g.error);
                }, b.onerror = function(y) {
                  return i.close(), o(g.error);
                };
              };
            }, d.onerror = function(m) {
              return i.close(), o(d.error);
            }, h.oncomplete = function() {
              v == null ? i.close() : v.oncomplete = function() {
                return i.close();
              };
            };
          }
        }, s.onerror = function(i) {
          return o(s.error);
        };
      });
    }, e;
  }();
  Pm.URL_SCHEME = "indexeddb://";
  var L9 = function(e) {
    return So().getBool("IS_BROWSER") && !Array.isArray(e) && e.startsWith(Pm.URL_SCHEME) ? Wle(e.slice(Pm.URL_SCHEME.length)) : null;
  };
  Dh.registerSaveRouter(L9);
  Dh.registerLoadRouter(L9);
  function Wle(e) {
    return new Pm(e);
  }
  function Gle(e) {
    return e.startsWith(Pm.URL_SCHEME) ? e.slice(Pm.URL_SCHEME.length) : e;
  }
  var $le = function() {
    function e() {
      this.indexedDB = P9();
    }
    return e.prototype.listModels = function() {
      return xi(this, void 0, void 0, function() {
        var t = this;
        return bi(this, function(r) {
          return [2, new Promise(function(n, a) {
            var o = t.indexedDB.open(g4, y4);
            o.onupgradeneeded = function() {
              return x4(o);
            }, o.onsuccess = function() {
              var s = o.result, i = s.transaction(fv2, "readonly"), l = i.objectStore(fv2), u2 = l.getAll();
              u2.onsuccess = function() {
                var c, f, h = {};
                try {
                  for (var p = Qf(u2.result), d = p.next(); !d.done; d = p.next()) {
                    var v = d.value;
                    h[v.modelPath] = v.modelArtifactsInfo;
                  }
                } catch (m) {
                  c = { error: m };
                } finally {
                  try {
                    d && !d.done && (f = p.return) && f.call(p);
                  } finally {
                    if (c) throw c.error;
                  }
                }
                n(h);
              }, u2.onerror = function(c) {
                return s.close(), a(u2.error);
              }, i.oncomplete = function() {
                return s.close();
              };
            }, o.onerror = function(s) {
              return a(o.error);
            };
          })];
        });
      });
    }, e.prototype.removeModel = function(t) {
      return xi(this, void 0, void 0, function() {
        var r = this;
        return bi(this, function(n) {
          return t = Gle(t), [2, new Promise(function(a, o) {
            var s = r.indexedDB.open(g4, y4);
            s.onupgradeneeded = function() {
              return x4(s);
            }, s.onsuccess = function() {
              var i = s.result, l = i.transaction(fv2, "readwrite"), u2 = l.objectStore(fv2), c = u2.get(t), f;
              c.onsuccess = function() {
                if (c.result == null) return i.close(), o(new Error("Cannot find model with path '" + t + "' in IndexedDB."));
                var h = u2.delete(t), p = function() {
                  f = i.transaction(Cm, "readwrite");
                  var d = f.objectStore(Cm), v = d.delete(t);
                  v.onsuccess = function() {
                    return a(c.result.modelArtifactsInfo);
                  }, v.onerror = function(m) {
                    return o(c.error);
                  };
                };
                h.onsuccess = p, h.onerror = function(d) {
                  return p(), i.close(), o(c.error);
                };
              }, c.onerror = function(h) {
                return i.close(), o(c.error);
              }, l.oncomplete = function() {
                f == null ? i.close() : f.oncomplete = function() {
                  return i.close();
                };
              };
            }, s.onerror = function(i) {
              return o(s.error);
            };
          })];
        });
      });
    }, e;
  }(), v0 = "/", $1 = "tensorflowjs_models", R9 = "info", Hle = "model_topology", qle = "weight_specs", Xle = "weight_data", Kle = "model_metadata";
  function z9(e) {
    return { info: [$1, e, R9].join(v0), topology: [$1, e, Hle].join(v0), weightSpecs: [$1, e, qle].join(v0), weightData: [$1, e, Xle].join(v0), modelMetadata: [$1, e, Kle].join(v0) };
  }
  function B9(e) {
    var t, r;
    try {
      for (var n = Qf(Object.values(e)), a = n.next(); !a.done; a = n.next()) {
        var o = a.value;
        window.localStorage.removeItem(o);
      }
    } catch (s) {
      t = { error: s };
    } finally {
      try {
        a && !a.done && (r = n.return) && r.call(n);
      } finally {
        if (t) throw t.error;
      }
    }
  }
  function Yle(e) {
    var t = e.split(v0);
    if (t.length < 3) throw new Error("Invalid key format: " + e);
    return t.slice(1, t.length - 1).join(v0);
  }
  function Zle(e) {
    return e.startsWith(Lm.URL_SCHEME) ? e.slice(Lm.URL_SCHEME.length) : e;
  }
  var Lm = function() {
    function e(t) {
      if (!So().getBool("IS_BROWSER") || typeof window > "u" || typeof window.localStorage > "u") throw new Error("The current environment does not support local storage.");
      if (this.LS = window.localStorage, t == null || !t) throw new Error("For local storage, modelPath must not be null, undefined or empty.");
      this.modelPath = t, this.keys = z9(this.modelPath);
    }
    return e.prototype.save = function(t) {
      return xi(this, void 0, void 0, function() {
        var r, n, a, o;
        return bi(this, function(s) {
          if (t.modelTopology instanceof ArrayBuffer) throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");
          r = JSON.stringify(t.modelTopology), n = JSON.stringify(t.weightSpecs), a = Hb(t);
          try {
            return this.LS.setItem(this.keys.info, JSON.stringify(a)), this.LS.setItem(this.keys.topology, r), this.LS.setItem(this.keys.weightSpecs, n), this.LS.setItem(this.keys.weightData, Fle(t.weightData)), o = { format: t.format, generatedBy: t.generatedBy, convertedBy: t.convertedBy, signature: t.signature != null ? t.signature : void 0, userDefinedMetadata: t.userDefinedMetadata != null ? t.userDefinedMetadata : void 0, modelInitializer: t.modelInitializer != null ? t.modelInitializer : void 0, trainingConfig: t.trainingConfig != null ? t.trainingConfig : void 0 }, this.LS.setItem(this.keys.modelMetadata, JSON.stringify(o)), [2, { modelArtifactsInfo: a }];
          } catch {
            throw B9(this.keys), new Error("Failed to save model '" + this.modelPath + "' to local storage: size quota being exceeded is a possible cause of this failure: " + ("modelTopologyBytes=" + a.modelTopologyBytes + ", ") + ("weightSpecsBytes=" + a.weightSpecsBytes + ", ") + ("weightDataBytes=" + a.weightDataBytes + "."));
          }
          return [2];
        });
      });
    }, e.prototype.load = function() {
      return xi(this, void 0, void 0, function() {
        var t, r, n, a, o, s, i;
        return bi(this, function(l) {
          if (t = JSON.parse(this.LS.getItem(this.keys.info)), t == null) throw new Error("In local storage, there is no model with name '" + this.modelPath + "'");
          if (t.modelTopologyType !== "JSON") throw new Error("BrowserLocalStorage does not support loading non-JSON model topology yet.");
          if (r = {}, n = JSON.parse(this.LS.getItem(this.keys.topology)), n == null) throw new Error("In local storage, the topology of model '" + this.modelPath + "' is missing.");
          if (r.modelTopology = n, a = JSON.parse(this.LS.getItem(this.keys.weightSpecs)), a == null) throw new Error("In local storage, the weight specs of model '" + this.modelPath + "' are missing.");
          if (r.weightSpecs = a, o = this.LS.getItem(this.keys.modelMetadata), o != null && (s = JSON.parse(o), r.format = s.format, r.generatedBy = s.generatedBy, r.convertedBy = s.convertedBy, s.signature != null && (r.signature = s.signature), s.userDefinedMetadata != null && (r.userDefinedMetadata = s.userDefinedMetadata), s.modelInitializer != null && (r.modelInitializer = s.modelInitializer), s.trainingConfig != null && (r.trainingConfig = s.trainingConfig)), i = this.LS.getItem(this.keys.weightData), i == null) throw new Error("In local storage, the binary weight values of model " + ("'" + this.modelPath + "' are missing."));
          return r.weightData = Ole(i), [2, r];
        });
      });
    }, e;
  }();
  Lm.URL_SCHEME = "localstorage://";
  var U9 = function(e) {
    return So().getBool("IS_BROWSER") && !Array.isArray(e) && e.startsWith(Lm.URL_SCHEME) ? Jle(e.slice(Lm.URL_SCHEME.length)) : null;
  };
  Dh.registerSaveRouter(U9);
  Dh.registerLoadRouter(U9);
  function Jle(e) {
    return new Lm(e);
  }
  var Qle = function() {
    function e() {
      Dr(So().getBool("IS_BROWSER"), function() {
        return "Current environment is not a web browser";
      }), Dr(typeof window > "u" || typeof window.localStorage < "u", function() {
        return "Current browser does not appear to support localStorage";
      }), this.LS = window.localStorage;
    }
    return e.prototype.listModels = function() {
      return xi(this, void 0, void 0, function() {
        var t, r, n, a, o, s;
        return bi(this, function(i) {
          for (t = {}, r = $1 + v0, n = v0 + R9, a = 0; a < this.LS.length; ++a) o = this.LS.key(a), o.startsWith(r) && o.endsWith(n) && (s = Yle(o), t[s] = JSON.parse(this.LS.getItem(o)));
          return [2, t];
        });
      });
    }, e.prototype.removeModel = function(t) {
      return xi(this, void 0, void 0, function() {
        var r, n;
        return bi(this, function(a) {
          if (t = Zle(t), r = z9(t), this.LS.getItem(r.info) == null) throw new Error("Cannot find model at path '" + t + "'");
          return n = JSON.parse(this.LS.getItem(r.info)), B9(r), [2, n];
        });
      });
    }, e;
  }(), K1 = "://", vv = function() {
    function e() {
      this.managers = {};
    }
    return e.getInstance = function() {
      return e.instance == null && (e.instance = new e()), e.instance;
    }, e.registerManager = function(t, r) {
      Dr(t != null, function() {
        return "scheme must not be undefined or null.";
      }), t.endsWith(K1) && (t = t.slice(0, t.indexOf(K1))), Dr(t.length > 0, function() {
        return "scheme must not be an empty string.";
      });
      var n = e.getInstance();
      Dr(n.managers[t] == null, function() {
        return "A model store manager is already registered for scheme '" + t + "'.";
      }), n.managers[t] = r;
    }, e.getManager = function(t) {
      var r = this.getInstance().managers[t];
      if (r == null) throw new Error("Cannot find model manager for scheme '" + t + "'");
      return r;
    }, e.getSchemes = function() {
      return Object.keys(this.getInstance().managers);
    }, e;
  }();
  function i3(e) {
    if (e.indexOf(K1) === -1) throw new Error("The url string provided does not contain a scheme. Supported schemes are: " + ("" + vv.getSchemes().join(",")));
    return { scheme: e.split(K1)[0], path: e.split(K1)[1] };
  }
  function V9(e, t, r) {
    return r === void 0 && (r = false), xi(this, void 0, void 0, function() {
      var n, a, o, s, i, l, u2, c, f;
      return bi(this, function(h) {
        switch (h.label) {
          case 0:
            return Dr(e !== t, function() {
              return "Old path and new path are the same: '" + e + "'";
            }), n = Dh.getLoadHandlers(e), Dr(n.length > 0, function() {
              return "Copying failed because no load handler is found for source URL " + e + ".";
            }), Dr(n.length < 2, function() {
              return "Copying failed because more than one (" + n.length + ") " + ("load handlers for source URL " + e + ".");
            }), a = n[0], o = Dh.getSaveHandlers(t), Dr(o.length > 0, function() {
              return "Copying failed because no save handler is found for destination " + ("URL " + t + ".");
            }), Dr(o.length < 2, function() {
              return "Copying failed because more than one (" + n.length + ") " + ("save handlers for destination URL " + t + ".");
            }), s = o[0], i = i3(e).scheme, l = i3(e).path, u2 = i === i3(e).scheme, [4, a.load()];
          case 1:
            return c = h.sent(), r && u2 ? [4, vv.getManager(i).removeModel(l)] : [3, 3];
          case 2:
            h.sent(), h.label = 3;
          case 3:
            return [4, s.save(c)];
          case 4:
            return f = h.sent(), r && !u2 ? [4, vv.getManager(i).removeModel(l)] : [3, 6];
          case 5:
            h.sent(), h.label = 6;
          case 6:
            return [2, f.modelArtifactsInfo];
        }
      });
    });
  }
  function eue() {
    return xi(this, void 0, void 0, function() {
      var e, t, r, n, a, o, s, i, l, u2, c;
      return bi(this, function(f) {
        switch (f.label) {
          case 0:
            e = vv.getSchemes(), t = {}, f.label = 1;
          case 1:
            f.trys.push([1, 6, 7, 8]), r = Qf(e), n = r.next(), f.label = 2;
          case 2:
            return n.done ? [3, 5] : (a = n.value, [4, vv.getManager(a).listModels()]);
          case 3:
            o = f.sent();
            for (s in o) i = a + K1 + s, t[i] = o[s];
            f.label = 4;
          case 4:
            return n = r.next(), [3, 2];
          case 5:
            return [3, 8];
          case 6:
            return l = f.sent(), u2 = { error: l }, [3, 8];
          case 7:
            try {
              n && !n.done && (c = r.return) && c.call(r);
            } finally {
              if (u2) throw u2.error;
            }
            return [7];
          case 8:
            return [2, t];
        }
      });
    });
  }
  function tue(e) {
    return xi(this, void 0, void 0, function() {
      var t, r;
      return bi(this, function(n) {
        return t = i3(e), r = vv.getManager(t.scheme), [2, r.removeModel(t.path)];
      });
    });
  }
  function rue(e, t) {
    return xi(this, void 0, void 0, function() {
      var r;
      return bi(this, function(n) {
        return r = false, [2, V9(e, t, r)];
      });
    });
  }
  function nue(e, t) {
    return xi(this, void 0, void 0, function() {
      var r;
      return bi(this, function(n) {
        return r = true, [2, V9(e, t, r)];
      });
    });
  }
  var aue = function() {
    function e() {
    }
    return e.prototype.fetch = function(t, r) {
      return fetch(t, r);
    }, e.prototype.now = function() {
      return performance.now();
    }, e.prototype.encode = function(t, r) {
      if (r !== "utf-8" && r !== "utf8") throw new Error("Browser's encoder only supports utf-8, but got " + r);
      return this.textEncoder == null && (this.textEncoder = new TextEncoder()), this.textEncoder.encode(t);
    }, e.prototype.decode = function(t, r) {
      return new TextDecoder(r).decode(t);
    }, e;
  }();
  if (So().get("IS_BROWSER")) {
    So().setPlatform("browser", new aue());
    try {
      vv.registerManager(Lm.URL_SCHEME, new Qle());
    } catch {
    }
    try {
      vv.registerManager(Pm.URL_SCHEME, new $le());
    } catch {
    }
  }
  var iue = { importFetch: function() {
    return nL();
  } }, JE, oue = function() {
    function e() {
      this.util = aL(), this.textEncoder = new this.util.TextEncoder();
    }
    return e.prototype.fetch = function(t, r) {
      return So().global.fetch != null ? So().global.fetch(t, r) : (JE == null && (JE = iue.importFetch()), JE(t, r));
    }, e.prototype.now = function() {
      var t = process.hrtime();
      return t[0] * 1e3 + t[1] / 1e6;
    }, e.prototype.encode = function(t, r) {
      if (r !== "utf-8" && r !== "utf8") throw new Error("Node built-in encoder only supports utf-8, but got " + r);
      return this.textEncoder.encode(t);
    }, e.prototype.decode = function(t, r) {
      return t.length === 0 ? "" : new this.util.TextDecoder(r).decode(t);
    }, e;
  }();
  So().get("IS_NODE") && So().setPlatform("node", new oue());
  function m0(e, t, r) {
    return t === void 0 && (t = "float32"), t = t || "float32", D4(e), new p3(e, t, r);
  }
  function sue(e, t) {
    var r = mr(e, "x", "cast");
    if (!ML(t)) throw new Error("Failed to cast to unknown dtype " + t);
    if (t === "string" && r.dtype !== "string" || t !== "string" && r.dtype === "string") throw new Error("Only strings can be casted to strings");
    var n = { x: r }, a = { dtype: t };
    return Xr.runKernel(N4, n, a);
  }
  var iu = Hr({ cast_: sue });
  function lue(e) {
    var t = mr(e, "x", "clone", "string_or_numeric"), r = { x: t };
    return Xr.runKernel(F42, r);
  }
  var Im = Hr({ clone_: lue });
  function j9(e, t) {
    t === void 0 && (t = false), console.log(e.toString(t));
  }
  C9();
  var uue = { buffer: m0, cast: iu, clone: Im, print: j9 };
  gle(uue);
  var cue = "model", fue = ".json", hue = ".weights.bin";
  function gL(e) {
    return new Promise(function(t) {
      return setTimeout(t);
    }).then(e);
  }
  var v3 = function() {
    function e(t) {
      if (!So().getBool("IS_BROWSER")) throw new Error("browserDownloads() cannot proceed because the current environment is not a browser.");
      t.startsWith(e.URL_SCHEME) && (t = t.slice(e.URL_SCHEME.length)), (t == null || t.length === 0) && (t = cue), this.modelJsonFileName = t + fue, this.weightDataFileName = t + hue;
    }
    return e.prototype.save = function(t) {
      return xi(this, void 0, void 0, function() {
        var r, n, a, o, s, i;
        return bi(this, function(l) {
          switch (l.label) {
            case 0:
              if (typeof document > "u") throw new Error("Browser downloads are not supported in this environment since `document` is not present");
              if (r = window.URL.createObjectURL(new Blob([t.weightData], { type: "application/octet-stream" })), !(t.modelTopology instanceof ArrayBuffer)) return [3, 1];
              throw new Error("BrowserDownloads.save() does not support saving model topology in binary formats yet.");
            case 1:
              return n = [{ paths: ["./" + this.weightDataFileName], weights: t.weightSpecs }], a = O9(t, n), o = window.URL.createObjectURL(new Blob([JSON.stringify(a)], { type: "application/json" })), s = this.modelJsonAnchor == null ? document.createElement("a") : this.modelJsonAnchor, s.download = this.modelJsonFileName, s.href = o, [4, gL(function() {
                return s.dispatchEvent(new MouseEvent("click"));
              })];
            case 2:
              return l.sent(), t.weightData == null ? [3, 4] : (i = this.weightDataAnchor == null ? document.createElement("a") : this.weightDataAnchor, i.download = this.weightDataFileName, i.href = r, [4, gL(function() {
                return i.dispatchEvent(new MouseEvent("click"));
              })]);
            case 3:
              l.sent(), l.label = 4;
            case 4:
              return [2, { modelArtifactsInfo: Hb(t) }];
          }
        });
      });
    }, e;
  }();
  v3.URL_SCHEME = "downloads://";
  var pue = function() {
    function e(t) {
      if (t == null || t.length < 1) throw new Error("When calling browserFiles, at least 1 file is required, " + ("but received " + t));
      this.jsonFile = t[0], this.weightsFiles = t.slice(1);
    }
    return e.prototype.load = function() {
      return xi(this, void 0, void 0, function() {
        var t = this;
        return bi(this, function(r) {
          return [2, new Promise(function(n, a) {
            var o = new FileReader();
            o.onload = function(s) {
              var i = JSON.parse(s.target.result), l = i.modelTopology;
              if (l == null) {
                a(new Error("modelTopology field is missing from file " + t.jsonFile.name));
                return;
              }
              var u2 = i.weightsManifest;
              if (u2 == null) {
                a(new Error("weightManifest field is missing from file " + t.jsonFile.name));
                return;
              }
              if (t.weightsFiles.length === 0) {
                n({ modelTopology: l });
                return;
              }
              var c = V4(i, function(f) {
                return t.loadWeights(f);
              });
              n(c);
            }, o.onerror = function(s) {
              return a("Failed to read model topology and weights manifest JSON " + ("from file '" + t.jsonFile.name + "'. BrowserFiles supports loading ") + "Keras-style tf.Model artifacts only.");
            }, o.readAsText(t.jsonFile);
          })];
        });
      });
    }, e.prototype.loadWeights = function(t) {
      var r, n, a = this, o = [], s = [];
      try {
        for (var i = Qf(t), l = i.next(); !l.done; l = i.next()) {
          var u2 = l.value;
          o.push.apply(o, ys(u2.weights)), s.push.apply(s, ys(u2.paths));
        }
      } catch (h) {
        r = { error: h };
      } finally {
        try {
          l && !l.done && (n = i.return) && n.call(i);
        } finally {
          if (r) throw r.error;
        }
      }
      var c = this.checkManifestAndWeightFiles(t), f = s.map(function(h) {
        return a.loadWeightsFile(h, c[h]);
      });
      return Promise.all(f).then(function(h) {
        return [o, U4(h)];
      });
    }, e.prototype.loadWeightsFile = function(t, r) {
      return new Promise(function(n, a) {
        var o = new FileReader();
        o.onload = function(s) {
          var i = s.target.result;
          n(i);
        }, o.onerror = function(s) {
          return a("Failed to weights data from file of path '" + t + "'.");
        }, o.readAsArrayBuffer(r);
      });
    }, e.prototype.checkManifestAndWeightFiles = function(t) {
      var r, n, a = this, o = [], s = this.weightsFiles.map(function(f) {
        return mL(f.name);
      }), i = {};
      try {
        for (var l = Qf(t), u2 = l.next(); !u2.done; u2 = l.next()) {
          var c = u2.value;
          c.paths.forEach(function(f) {
            var h = mL(f);
            if (o.indexOf(h) !== -1) throw new Error("Duplicate file basename found in weights manifest: " + ("'" + h + "'"));
            if (o.push(h), s.indexOf(h) === -1) throw new Error("Weight file with basename '" + h + "' is not provided.");
            i[f] = a.weightsFiles[s.indexOf(h)];
          });
        }
      } catch (f) {
        r = { error: f };
      } finally {
        try {
          u2 && !u2.done && (n = l.return) && n.call(l);
        } finally {
          if (r) throw r.error;
        }
      }
      if (o.length !== this.weightsFiles.length) throw new Error("Mismatch in the number of files in weights manifest " + ("(" + o.length + ") and the number of weight files provided ") + ("(" + this.weightsFiles.length + ")."));
      return i;
    }, e;
  }(), due = function(e) {
    return So().getBool("IS_BROWSER") && !Array.isArray(e) && e.startsWith(v3.URL_SCHEME) ? vue(e.slice(v3.URL_SCHEME.length)) : null;
  };
  Dh.registerSaveRouter(due);
  function vue(e) {
    return e === void 0 && (e = "model"), new v3(e);
  }
  function mue(e) {
    return new pue(e);
  }
  function yL(e, t, r, n) {
    s(e), r = r ?? 0, n = n ?? 1, i(r, n);
    var a = 0, o = function(l) {
      return l.then(function(u2) {
        var c = r + ++a / e.length * (n - r);
        return t(c), u2;
      }), l;
    };
    function s(l) {
      Dr(l != null && Array.isArray(l) && l.length > 0, function() {
        return "promises must be a none empty array";
      });
    }
    function i(l, u2) {
      Dr(l >= 0 && l <= 1, function() {
        return "Progress fraction must be in range [0, 1], but " + ("got startFraction " + l);
      }), Dr(u2 >= 0 && u2 <= 1, function() {
        return "Progress fraction must be in range [0, 1], but " + ("got endFraction " + u2);
      }), Dr(u2 >= l, function() {
        return "startFraction must be no more than endFraction, but " + ("got startFraction " + l + " and endFraction ") + ("" + u2);
      });
    }
    return Promise.all(e.map(o));
  }
  function W9(e, t) {
    return xi(this, void 0, void 0, function() {
      var r, n, a, o, s, i, l, u2, c, f, h;
      return bi(this, function(p) {
        switch (p.label) {
          case 0:
            return t == null && (t = {}), r = t.fetchFunc == null ? So().platform.fetch : t.fetchFunc, n = e.map(function(d) {
              return r(d, t.requestInit, { isBinary: true });
            }), a = 0, o = 0.5, t.onProgress != null ? [3, 2] : [4, Promise.all(n)];
          case 1:
            return i = p.sent(), [3, 4];
          case 2:
            return [4, yL(n, t.onProgress, a, o)];
          case 3:
            i = p.sent(), p.label = 4;
          case 4:
            return s = i, l = s.map(function(d) {
              return d.arrayBuffer();
            }), u2 = 0.5, c = 1, t.onProgress != null ? [3, 6] : [4, Promise.all(l)];
          case 5:
            return h = p.sent(), [3, 8];
          case 6:
            return [4, yL(l, t.onProgress, u2, c)];
          case 7:
            h = p.sent(), p.label = 8;
          case 8:
            return f = h, [2, f];
        }
      });
    });
  }
  function gue(e, t, r, n) {
    return t === void 0 && (t = ""), xi(this, void 0, void 0, function() {
      var a, o;
      return bi(this, function(s) {
        return a = function(i) {
          return W9(i, { requestInit: n });
        }, o = G9(a), [2, o(e, t, r)];
      });
    });
  }
  function G9(e) {
    var t = this;
    return function(r, n, a) {
      return n === void 0 && (n = ""), xi(t, void 0, void 0, function() {
        var o, s, i, l, u2, c, f, h, p, d;
        return bi(this, function(v) {
          switch (v.label) {
            case 0:
              if (o = r.map(function() {
                return false;
              }), s = {}, i = a != null ? a.map(function() {
                return false;
              }) : [], l = [], r.forEach(function(m, g) {
                var x = 0;
                m.weights.forEach(function(b) {
                  var y = "quantization" in b ? b.quantization.dtype : b.dtype, w = m4[y] * Ml(b.shape), _5 = function() {
                    o[g] = true, s[g] == null && (s[g] = []), s[g].push({ manifestEntry: b, groupOffset: x, sizeBytes: w });
                  };
                  a != null ? a.forEach(function(k, T2) {
                    k === b.name && (_5(), i[T2] = true);
                  }) : _5(), l.push(b.name), x += w;
                });
              }), !i.every(function(m) {
                return m;
              })) throw u2 = a.filter(function(m, g) {
                return !i[g];
              }), new Error("Could not find weights in manifest with names: " + (u2.join(", ") + `. 
`) + "Manifest JSON has weights with names: " + (l.join(", ") + "."));
              return c = o.reduce(function(m, g, x) {
                return g && m.push(x), m;
              }, []), f = [], c.forEach(function(m) {
                r[m].paths.forEach(function(g) {
                  var x = n + (n.endsWith("/") ? "" : "/") + g;
                  f.push(x);
                });
              }), [4, e(f)];
            case 1:
              return h = v.sent(), p = {}, d = 0, c.forEach(function(m) {
                for (var g = r[m].paths.length, x = 0, b = 0; b < g; b++) x += h[d + b].byteLength;
                for (var y = new ArrayBuffer(x), w = new Uint8Array(y), _5 = 0, k = 0; k < g; k++) {
                  var T2 = new Uint8Array(h[d + k]);
                  w.set(T2, _5), _5 += T2.byteLength;
                }
                var A2 = s[m];
                A2.forEach(function(S2) {
                  var C2 = y.slice(S2.groupOffset, S2.groupOffset + S2.sizeBytes), E2 = F92(C2, [S2.manifestEntry]);
                  for (var F13 in E2) p[F13] = E2[F13];
                }), d += g;
              }), [2, p];
          }
        });
      });
    };
  }
  var yue = "application/octet-stream", xue = "application/json", j4 = function() {
    function e(t, r) {
      if (this.DEFAULT_METHOD = "POST", r == null && (r = {}), this.weightPathPrefix = r.weightPathPrefix, this.onProgress = r.onProgress, this.weightUrlConverter = r.weightUrlConverter, r.fetchFunc != null ? (Dr(typeof r.fetchFunc == "function", function() {
        return "Must pass a function that matches the signature of `fetch` (see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)";
      }), this.fetch = r.fetchFunc) : this.fetch = So().platform.fetch, Dr(t != null && t.length > 0, function() {
        return "URL path for http must not be null, undefined or empty.";
      }), Array.isArray(t) && Dr(t.length === 2, function() {
        return "URL paths for http must have a length of 2, " + ("(actual length is " + t.length + ").");
      }), this.path = t, r.requestInit != null && r.requestInit.body != null) throw new Error("requestInit is expected to have no pre-existing body, but has one.");
      this.requestInit = r.requestInit || {};
    }
    return e.prototype.save = function(t) {
      return xi(this, void 0, void 0, function() {
        var r, n, a, o;
        return bi(this, function(s) {
          switch (s.label) {
            case 0:
              if (t.modelTopology instanceof ArrayBuffer) throw new Error("BrowserHTTPRequest.save() does not support saving model topology in binary formats yet.");
              return r = Object.assign({ method: this.DEFAULT_METHOD }, this.requestInit), r.body = new FormData(), n = [{ paths: ["./model.weights.bin"], weights: t.weightSpecs }], a = O9(t, n), r.body.append("model.json", new Blob([JSON.stringify(a)], { type: xue }), "model.json"), t.weightData != null && r.body.append("model.weights.bin", new Blob([t.weightData], { type: yue }), "model.weights.bin"), [4, this.fetch(this.path, r)];
            case 1:
              if (o = s.sent(), o.ok) return [2, { modelArtifactsInfo: Hb(t), responses: [o] }];
              throw new Error("BrowserHTTPRequest.save() failed due to HTTP response status " + (o.status + "."));
          }
        });
      });
    }, e.prototype.load = function() {
      return xi(this, void 0, void 0, function() {
        var t, r, n, a, o, s = this;
        return bi(this, function(i) {
          switch (i.label) {
            case 0:
              return [4, this.fetch(this.path, this.requestInit)];
            case 1:
              if (t = i.sent(), !t.ok) throw new Error("Request to " + this.path + " failed with status code " + (t.status + ". Please verify this URL points to ") + "the model JSON of the model to load.");
              i.label = 2;
            case 2:
              return i.trys.push([2, 4, , 5]), [4, t.json()];
            case 3:
              return r = i.sent(), [3, 5];
            case 4:
              throw i.sent(), n = "Failed to parse model JSON of response from " + this.path + ".", this.path.endsWith(".pb") ? n += " Your path contains a .pb file extension. Support for .pb models have been removed in TensorFlow.js 1.0 in favor of .json models. You can re-convert your Python TensorFlow model using the TensorFlow.js 1.0 conversion scripts or you can convert your.pb models with the 'pb2json'NPM script in the tensorflow/tfjs-converter repository." : n += " Please make sure the server is serving valid JSON for this request.", new Error(n);
            case 5:
              if (a = r.modelTopology, o = r.weightsManifest, a == null && o == null) throw new Error("The JSON from HTTP path " + this.path + " contains neither model topology or manifest for weights.");
              return [2, V4(r, function(l) {
                return s.loadWeights(l);
              })];
          }
        });
      });
    }, e.prototype.loadWeights = function(t) {
      return xi(this, void 0, void 0, function() {
        var r, n, a, o, s, i, l, u2, c, f, h, p, d, v, m, g, x, b, y, w, _5, k, T2, A2, S2, C2, E2;
        return bi(this, function(F13) {
          switch (F13.label) {
            case 0:
              r = Array.isArray(this.path) ? this.path[1] : this.path, n = hi(bue(r), 2), a = n[0], o = n[1], s = this.weightPathPrefix || a, i = [];
              try {
                for (l = Qf(t), u2 = l.next(); !u2.done; u2 = l.next()) c = u2.value, i.push.apply(i, ys(c.weights));
              } catch (N2) {
                k = { error: N2 };
              } finally {
                try {
                  u2 && !u2.done && (T2 = l.return) && T2.call(l);
                } finally {
                  if (k) throw k.error;
                }
              }
              f = [], h = [];
              try {
                for (p = Qf(t), d = p.next(); !d.done; d = p.next()) {
                  v = d.value;
                  try {
                    for (m = (C2 = void 0, Qf(v.paths)), g = m.next(); !g.done; g = m.next()) x = g.value, this.weightUrlConverter != null ? h.push(this.weightUrlConverter(x)) : f.push(s + x + o);
                  } catch (N2) {
                    C2 = { error: N2 };
                  } finally {
                    try {
                      g && !g.done && (E2 = m.return) && E2.call(m);
                    } finally {
                      if (C2) throw C2.error;
                    }
                  }
                }
              } catch (N2) {
                A2 = { error: N2 };
              } finally {
                try {
                  d && !d.done && (S2 = p.return) && S2.call(p);
                } finally {
                  if (A2) throw A2.error;
                }
              }
              return this.weightUrlConverter ? (y = (b = f.push).apply, w = [f], [4, Promise.all(h)]) : [3, 2];
            case 1:
              y.apply(b, w.concat([ys.apply(void 0, [F13.sent()])])), F13.label = 2;
            case 2:
              return [4, W9(f, { requestInit: this.requestInit, fetchFunc: this.fetch, onProgress: this.onProgress })];
            case 3:
              return _5 = F13.sent(), [2, [i, U4(_5)]];
          }
        });
      });
    }, e;
  }();
  j4.URL_SCHEME_REGEX = /^https?:\/\//;
  function bue(e) {
    var t = e.lastIndexOf("/"), r = e.lastIndexOf("?"), n = e.substring(0, t), a = r > t ? e.substring(r) : "";
    return [n + "/", a];
  }
  function b4(e) {
    return e.match(j4.URL_SCHEME_REGEX) != null;
  }
  var $9 = function(e, t) {
    if (typeof fetch > "u" && (t == null || t.fetchFunc == null)) return null;
    var r = true;
    return Array.isArray(e) ? r = e.every(function(n) {
      return b4(n);
    }) : r = b4(e), r ? W4(e, t) : null;
  };
  Dh.registerSaveRouter($9);
  Dh.registerLoadRouter($9);
  function W4(e, t) {
    return new j4(e, t);
  }
  function _ue(e, t) {
    return W4(e, t);
  }
  var QE = function() {
    function e(t) {
      this.modelArtifacts = t;
    }
    return e.prototype.load = function() {
      return xi(this, void 0, void 0, function() {
        return bi(this, function(t) {
          return [2, this.modelArtifacts];
        });
      });
    }, e;
  }(), wue = function() {
    function e(t) {
      this.saveHandler = t;
    }
    return e.prototype.save = function(t) {
      return xi(this, void 0, void 0, function() {
        return bi(this, function(r) {
          return [2, this.saveHandler(t)];
        });
      });
    }, e;
  }();
  function kue(e, t, r, n) {
    if (arguments.length === 1) {
      var a = e.modelTopology != null || e.weightSpecs != null;
      return a ? new QE(e) : (console.warn("Please call tf.io.fromMemory() with only one argument. The argument should be of type ModelArtifacts. The multi-argument signature of tf.io.fromMemory() has been deprecated and will be removed in a future release."), new QE({ modelTopology: e }));
    } else return console.warn("Please call tf.io.fromMemory() with only one argument. The argument should be of type ModelArtifacts. The multi-argument signature of tf.io.fromMemory() has been deprecated and will be removed in a future release."), new QE({ modelTopology: e, weightSpecs: t, weightData: r, trainingConfig: n });
  }
  function Tue(e) {
    return new wue(e);
  }
  var Aue = { __proto__: null, browserFiles: mue, browserHTTPRequest: _ue, concatenateArrayBuffers: U4, decodeWeights: F92, encodeWeights: Ile, fromMemory: kue, getLoadHandlers: jle, getModelArtifactsForJSON: V4, getModelArtifactsInfoForJSON: Hb, getSaveHandlers: Vle, http: W4, isHTTPScheme: b4, loadWeights: gue, registerLoadRouter: Ule, registerSaveRouter: Ble, weightsLoaderFactory: G9, withSaveHandler: Tue, copyModel: rue, listModels: eue, moveModel: nue, removeModel: tue };
  function Sue(e, t, r, n) {
    var a;
    r === void 0 && (r = false), n === void 0 && (n = false);
    var o = mr(e, "a", "matMul"), s = mr(t, "b", "matMul");
    a = hi(Bl(o, s), 2), o = a[0], s = a[1];
    var i = { a: o, b: s }, l = { transposeA: r, transposeB: n };
    return Xr.runKernel(JL, i, l);
  }
  var gs = Hr({ matMul_: Sue });
  function Eue(e, t, r, n) {
    if (r === void 0 && (r = 1), n === void 0 && (n = 0), t < 2) throw new Error("Error in oneHot: depth must be >=2, but it is " + t);
    var a = mr(e, "indices", "oneHot", "int32"), o = { indices: a }, s = { depth: t, onValue: r, offValue: n };
    return Xr.runKernel(b7, o, s);
  }
  var _4 = Hr({ oneHot_: Eue });
  function Due(e, t) {
    var r = mr(e, "x", "transpose");
    if (t == null && (t = r.shape.map(function(o, s) {
      return s;
    }).reverse()), Dr(r.rank === t.length, function() {
      return "Error in transpose: rank of input " + r.rank + " " + ("must match length of perm " + t + ".");
    }), t.forEach(function(o) {
      Dr(o >= 0 && o < r.rank, function() {
        return "All entries in 'perm' must be between 0 and " + (r.rank - 1) + (" but got " + t);
      });
    }), r.rank <= 1) return r.clone();
    var n = { x: r }, a = { perm: t };
    return Xr.runKernel(h9, n, a);
  }
  var m3 = Hr({ transpose_: Due });
  function Cue(e, t, r) {
    var n = mr(e, "labels", "confusionMatrix"), a = mr(t, "predictions", "confusionMatrix");
    Dr(r == null || r > 0 && Number.isInteger(r), function() {
      return "If provided, numClasses must be a positive integer, " + ("but got " + r);
    }), Dr(n.rank === 1, function() {
      return "Expected the rank of labels to be 1, but got " + n.rank;
    }), Dr(a.rank === 1, function() {
      return "Expected the rank of predictions to be 1, " + ("but got " + a.rank);
    }), Dr(n.shape[0] === a.shape[0], function() {
      return "Mismatch in the number of examples: " + (n.shape[0] + " vs. " + a.shape[0] + ". ") + "Labels and predictions should have the same number of elements.";
    }), Dr(r > 0 && Number.isInteger(r), function() {
      return "numClasses is required to be a positive integer, but got " + ("" + r);
    });
    var o = _4(iu(n, "int32"), r), s = _4(iu(a, "int32"), r), i = m3(o), l = gs(i, s);
    return iu(l, "int32");
  }
  var Mue = Hr({ confusionMatrix_: Cue });
  var Iue = { __proto__: null, confusionMatrix: Mue };
  function H9(e, t) {
    for (var r = e.length, n = [], a = 0; a < r; a++) {
      var o = r - 1 - a, s = e[o] || 1, i = t[t.length - 1 - a] || 1;
      i > 1 && s === 1 && n.unshift(o);
    }
    return n;
  }
  function G4(e, t) {
    for (var r = [], n = 0; n < t.length; n++) {
      var a = e[e.length - n - 1], o = t.length - n - 1, s = t[o];
      (a == null || a === 1 && s > 1) && r.unshift(o);
    }
    return r;
  }
  function ju(e, t) {
    for (var r = [], n = Math.max(e.length, t.length), a = 0; a < n; a++) {
      var o = e[e.length - a - 1];
      o == null && (o = 1);
      var s = t[t.length - a - 1];
      if (s == null && (s = 1), o === 1) r.unshift(s);
      else if (s === 1) r.unshift(o);
      else if (o !== s) {
        var i = "Operands could not be broadcast together with shapes " + (e + " and " + t + ".");
        throw Error(i);
      } else r.unshift(o);
    }
    return r;
  }
  var Nue = { __proto__: null, getBroadcastDims: H9, getReductionAxes: G4, assertAndGetBroadcastShape: ju };
  function q9(e, t, r) {
    if (Bm(e), t != null && t.length !== 3) throw new Error("tensor3d() requires shape to have three numbers");
    var n = Rd(e, r);
    if (n.length !== 3 && n.length !== 1) throw new Error("tensor3d() requires values to be number[][][] or flat/TypedArray");
    if (n.length === 1 && t == null) throw new Error("tensor3d() requires shape to be provided when `values` are a flat array");
    return gv(e, t, n, r);
  }
  var Tm;
  function X9(e, t) {
    if (t === void 0 && (t = 3), t > 4) throw new Error("Cannot construct Tensor with more than 4 channels from pixels.");
    if (e == null) throw new Error("pixels passed to tf.browser.fromPixels() can not be null");
    var r = false, n = false, a = false, o = false, s = false, i = false;
    if (e.data instanceof Uint8Array) r = true;
    else if (typeof ImageData < "u" && e instanceof ImageData) n = true;
    else if (typeof HTMLVideoElement < "u" && e instanceof HTMLVideoElement) a = true;
    else if (typeof HTMLImageElement < "u" && e instanceof HTMLImageElement) o = true;
    else if (e.getContext != null) s = true;
    else if (typeof ImageBitmap < "u" && e instanceof ImageBitmap) i = true;
    else throw new Error("pixels passed to tf.browser.fromPixels() must be either an HTMLVideoElement, HTMLImageElement, HTMLCanvasElement, ImageData in browser, or OffscreenCanvas, ImageData in webworker or {data: Uint32Array, width: number, height: number}, " + ("but was " + e.constructor.name));
    if (a) {
      var l = 2;
      if (a && e.readyState < l) throw new Error("The video element has not loaded data yet. Please wait for `loadeddata` event on the <video> element.");
    }
    var u2 = u3(n4, Xr.backendName);
    if (u2 != null) {
      var c = { pixels: e }, f = { numChannels: t };
      return Xr.runKernel(n4, c, f);
    }
    var h = hi(a ? [e.videoWidth, e.videoHeight] : [e.width, e.height], 2), p = h[0], d = h[1], v;
    if (s) v = e.getContext("2d").getImageData(0, 0, p, d).data;
    else if (n || r) v = e.data;
    else if (o || a || i) {
      if (Tm == null) if (typeof document > "u") if (typeof OffscreenCanvas < "u" && typeof OffscreenCanvasRenderingContext2D < "u") Tm = new OffscreenCanvas(1, 1).getContext("2d");
      else throw new Error("Cannot parse input in current context. Reason: OffscreenCanvas Context2D rendering is not supported.");
      else Tm = document.createElement("canvas").getContext("2d");
      Tm.canvas.width = p, Tm.canvas.height = d, Tm.drawImage(e, 0, 0, p, d), v = Tm.getImageData(0, 0, p, d).data;
    }
    var m;
    if (t === 4) m = new Int32Array(v);
    else {
      var g = p * d;
      m = new Int32Array(g * t);
      for (var x = 0; x < g; x++) for (var b = 0; b < t; ++b) m[x * t + b] = v[x * 4 + b];
    }
    var y = [d, p, t];
    return q9(m, y, "int32");
  }
  function Fue(e) {
    return e != null && e.data instanceof Uint8Array;
  }
  function Oue() {
    return typeof window < "u" && typeof ImageBitmap < "u" && window.hasOwnProperty("createImageBitmap");
  }
  function Pue(e) {
    return e != null && e.width !== 0 && e.height !== 0;
  }
  function Lue(e) {
    return Oue() && !(e instanceof ImageBitmap) && Pue(e) && !Fue(e);
  }
  function Rue(e, t) {
    return t === void 0 && (t = 3), xi(this, void 0, void 0, function() {
      var r, n;
      return bi(this, function(a) {
        switch (a.label) {
          case 0:
            if (r = null, !(So().getBool("WRAP_TO_IMAGEBITMAP") && Lue(e))) return [3, 5];
            n = void 0, a.label = 1;
          case 1:
            return a.trys.push([1, 3, , 4]), [4, createImageBitmap(e, { premultiplyAlpha: "none" })];
          case 2:
            return n = a.sent(), [3, 4];
          case 3:
            return a.sent(), n = null, [3, 4];
          case 4:
            return n != null && n.width === e.width && n.height === e.height ? r = n : r = e, [3, 6];
          case 5:
            r = e, a.label = 6;
          case 6:
            return [2, X9(r, t)];
        }
      });
    });
  }
  function zue(e, t) {
    return xi(this, void 0, void 0, function() {
      var r, n, a, o, s, i, l, u2, c, f, h, p, d, v, m, g;
      return bi(this, function(x) {
        switch (x.label) {
          case 0:
            if (r = mr(e, "img", "toPixels"), e instanceof Du || (n = r, r = iu(n, "int32"), n.dispose()), r.rank !== 2 && r.rank !== 3) throw new Error("toPixels only supports rank 2 or 3 tensors, got rank " + r.rank + ".");
            if (a = hi(r.shape.slice(0, 2), 2), o = a[0], s = a[1], i = r.rank === 2 ? 1 : r.shape[2], i > 4 || i === 2) throw new Error("toPixels only supports depth of size " + ("1, 3 or 4 but got " + i));
            if (r.dtype !== "float32" && r.dtype !== "int32") throw new Error("Unsupported type for toPixels: " + r.dtype + ". Please use float32 or int32 tensors.");
            return [4, r.data()];
          case 1:
            for (l = x.sent(), u2 = r.dtype === "float32" ? 255 : 1, c = new Uint8ClampedArray(s * o * 4), f = 0; f < o * s; ++f) {
              for (h = [0, 0, 0, 255], p = 0; p < i; p++) {
                if (d = l[f * i + p], r.dtype === "float32") {
                  if (d < 0 || d > 1) throw new Error("Tensor values for a float32 Tensor must be in the " + ("range [0 - 1] but encountered " + d + "."));
                } else if (r.dtype === "int32" && (d < 0 || d > 255)) throw new Error("Tensor values for a int32 Tensor must be in the " + ("range [0 - 255] but encountered " + d + "."));
                i === 1 ? (h[0] = d * u2, h[1] = d * u2, h[2] = d * u2) : h[p] = d * u2;
              }
              v = f * 4, c[v + 0] = Math.round(h[0]), c[v + 1] = Math.round(h[1]), c[v + 2] = Math.round(h[2]), c[v + 3] = Math.round(h[3]);
            }
            return t != null && (t.width = s, t.height = o, m = t.getContext("2d"), g = new ImageData(c, s, o), m.putImageData(g, 0, 0)), r !== e && r.dispose(), [2, c];
        }
      });
    });
  }
  var Bue = Hr({ fromPixels_: X9 }), Uue = { __proto__: null, fromPixelsAsync: Rue, toPixels: zue, fromPixels: Bue };
  function K9(e, t) {
    var r = e.shape.length, n = t.shape.length;
    if (r < 1) throw new Error("tf.gatherND() expects the input to be rank 1 or higher," + (" but the rank was " + r + "."));
    if (n < 1) throw new Error("tf.gatherND() expects the indices to be rank 1 or higher," + (" but the rank was " + n + "."));
    if (t.dtype !== "int32") throw new Error("tf.gatherND() expects the indices to be int32 type," + (" but the dtype was " + t.dtype + "."));
    if (t.shape[n - 1] > r) throw new Error("index innermost dimension length must be <= tensor rank; saw: " + (t.shape[n - 1] + " vs. " + r));
    if (Ml(e.shape) === 0) throw new Error("Requested more than 0 entries, but input is empty." + (" Input shape: " + e.shape + "."));
    for (var a = t.shape, o = a[a.length - 1], s = 1, i = 0; i < a.length - 1; ++i) s *= a[i];
    var l = e.shape, u2 = a.slice();
    u2.pop();
    for (var c = 1, i = o; i < r; ++i) c *= l[i], u2.push(l[i]);
    var f = ys(ay(e.shape).map(function(h) {
      return h / c;
    }), [1]).slice(0, o);
    return [u2, s, c, f];
  }
  var Vue = { __proto__: null, prepareAndValidate: K9 };
  function $4(e, t, r) {
    var n = t.rank > 1 ? t.shape[t.rank - 1] : 1, a = t.rank > 1 ? t.rank - 1 : 1, o = "Must have updates.shape = indices.shape[:batchDim] + " + ("shape[sliceDim:], got updates.shape: " + r.shape) + (", indices.shape: " + t.shape + ", shape: " + e) + (", sliceDim: " + n + ", and batchDim: " + a + ".");
    if (r.rank < a) throw new Error(o + (" update.rank < " + a + ". "));
    if (e.length < n + (r.rank - a)) throw new Error(o + (" Output shape length < " + (n + (r.rank - a))));
    if (r.rank !== a + e.length - n) throw new Error(o + (" update.rank != " + (a + e.length - n)));
    for (var s = 0; s < a; ++s) if (r.shape[s] !== t.shape[s]) throw new Error(o + (" updates.shape[" + s + "] (" + r.shape[s] + ") != indices.shape[" + s + "] (" + t.shape[s] + ")."));
    for (var s = 0; s < r.rank - a; ++s) if (r.shape[s + a] !== e[s + n]) throw new Error(o + (" updates.shape[" + (s + a) + "] (" + r.shape[s + a] + ") != shape[" + (s + a) + "] (" + e[s + a] + ")"));
  }
  function H4(e, t, r) {
    if (t.rank < 1) throw new Error("tf.scatterND() expects the indices to be rank 1 or higher," + (" but the rank was " + t.rank + "."));
    if (e.rank < 1) throw new Error("tf.scatterND() expects the updates to be rank 1 or higher," + (" but the rank was " + e.rank + "."));
    if (t.dtype !== "int32") throw new Error("The dtype of 'indices' should be int32, but got dtype: " + t.dtype);
    if (r.length < 1) throw new Error("Output rank must be greater or equal to 1, but got shape: " + r);
    if (r.length === 0) {
      if (t.size === 0) throw new Error("Indices specified for empty output. indices shape: " + t.shape);
      if (e.size === 0) throw new Error("Updates specified for empty output. updates shape: " + e.shape);
    }
    $4(r, t, e);
  }
  function Y9(e, t, r) {
    for (var n = t.shape.length, a = n > 1 ? t.shape[n - 1] : 1, o = r.length, s = 1, i = a; i < o; ++i) s *= r[i];
    var l = a < 1 ? 1 : a, u2 = Ml(t.shape) / l, c = ys(ay(r.slice(0, a)), [1]), f = Ml(r);
    return { sliceRank: a, numUpdates: u2, sliceSize: s, strides: c, outputSize: f };
  }
  var jue = { __proto__: null, validateUpdateShape: $4, validateInput: H4, calculateShapes: Y9 }, w4 = -2, Wue = -1;
  function Gue(e, t, r) {
    var n = e.shape.length;
    Dr(n === t.length, function() {
      return "Error in slice" + n + "D: Length of begin " + t + " must " + ("match the rank of the array (" + n + ").");
    }), Dr(n === r.length, function() {
      return "Error in slice" + n + "D: Length of size " + r + " must " + ("match the rank of the array (" + n + ").");
    });
    for (var a = function(s) {
      Dr(t[s] + r[s] <= e.shape[s], function() {
        return "Error in slice" + n + "D: begin[" + s + "] + size[" + s + "] " + ("(" + (t[s] + r[s]) + ") would overflow input.shape[" + s + "] (" + e.shape[s] + ")");
      });
    }, o = 0; o < n; ++o) a(o);
  }
  function $ue(e) {
    for (var t = [], r = 0; e > 0; ) e & 1 && t.push(r), e /= 2, r++;
    return t;
  }
  function Hue(e, t, r) {
    for (var n = [], a = 0; a < e.length; a++) n[a] = Math.ceil((t[a] - e[a]) / r[a]);
    return n;
  }
  function Z9(e, t, r, n) {
    for (var a = ys(e), o = a.length; o < n.length; o++) a.push(1);
    for (var o = 0; o < r; o++) o === 0 ? a[t] = 1 : (a.splice(t, 0, 1), a.pop());
    return a;
  }
  function J9(e, t, r) {
    return r <= e ? r : r - (t - 1);
  }
  function Q9(e, t) {
    for (var r = [], n = 0; n < e; n++) r.push(t + n);
    return r;
  }
  function que(e, t, r, n, a, o, s, i, l) {
    var u2 = e.length, c = new Array(u2), f = new Array(u2), h = new Array(u2);
    if (t.length && r > 0) {
      var p = t[0], d = r + 1;
      c = ez(s, p, d, n, e), f = tz(i, p, d, a, e), h = Z9(o, p, d, e);
    } else for (var v = 0; v < u2; v++) c[v] = nz(s, n, o, e, v, l), f[v] = az(i, a, o, e, v, l), h[v] = rz(o, v, l);
    return { begin: c, end: f, strides: h };
  }
  function ez(e, t, r, n, a) {
    for (var o = ys(a), s = Q9(r, t), i = 0; i < o.length; i++) if (s.indexOf(i) > -1) o[i] = 0;
    else {
      var l = J9(t, r, i), u2 = n[l];
      e & 1 << l && (u2 = 0), o[i] = u2;
    }
    return o;
  }
  function tz(e, t, r, n, a) {
    for (var o = ys(a), s = Q9(r, t), i = 0; i < o.length; i++) if (s.indexOf(i) > -1) o[i] = Number.MAX_SAFE_INTEGER;
    else {
      var l = J9(t, r, i), u2 = n[l];
      e & 1 << l && (u2 = Number.MAX_SAFE_INTEGER), o[i] = u2;
    }
    for (var c = 0; c < o.length; c++) {
      var f = a[c];
      o[c] < 0 && (o[c] += f), o[c] = Nb(0, o[c], a[c]);
    }
    return o;
  }
  function rz(e, t, r) {
    var n = e[t];
    return (r & 1 << t || n == null) && (n = 1), n;
  }
  function nz(e, t, r, n, a, o) {
    var s = t[a], i = r[a] || 1;
    (e & 1 << a || o & 1 << a || s == null) && (i > 0 ? s = Number.MIN_SAFE_INTEGER : s = Number.MAX_SAFE_INTEGER);
    var l = n[a];
    return s < 0 && (s += l), s = Nb(0, s, l - 1), s;
  }
  function az(e, t, r, n, a, o) {
    var s = t[a], i = r[a] || 1;
    (e & 1 << a || o & 1 << a || s == null) && (i > 0 ? s = Number.MAX_SAFE_INTEGER : s = Number.MIN_SAFE_INTEGER);
    var l = n[a];
    return s < 0 && (s += l), i > 0 ? s = Nb(0, s, l) : s = Nb(-1, s, l - 1), s;
  }
  function Xue(e, t, r) {
    for (var n = r.length, a = 0; a < r.length; a++) if (r[a] > 1) {
      n = a;
      break;
    }
    for (var a = n + 1; a < r.length; a++) if (t[a] > 0 || r[a] !== e[a]) return false;
    return true;
  }
  function Kue(e, t) {
    for (var r = e.length > 0 ? e[e.length - 1] : 1, n = 0; n < e.length - 1; n++) r += e[n] * t[n];
    return r;
  }
  function Yue(e, t, r) {
    var n, a = e.shape.length;
    typeof t == "number" ? n = ys([t], new Array(a - 1).fill(0)) : t.length < a ? n = t.concat(new Array(a - t.length).fill(0)) : n = t.slice(), n.forEach(function(s) {
      Dr(s !== -1, function() {
        return "slice() does not support negative begin indexing.";
      });
    });
    var o;
    return r == null ? o = new Array(a).fill(-1) : typeof r == "number" ? o = ys([r], new Array(a - 1).fill(-1)) : r.length < a ? o = r.concat(new Array(a - r.length).fill(-1)) : o = r, o = o.map(function(s, i) {
      return s >= 0 ? s : (Dr(s === -1, function() {
        return "Negative size values should be exactly -1 but got " + (s + " for the slice() size at index " + i + ".");
      }), e.shape[i] - n[i]);
    }), [n, o];
  }
  function Zue(e, t, r, n, a, o, s, i, l) {
    var u2;
    if (n == null ? (u2 = new Array(t.length), u2.fill(1)) : u2 = n, s != null && (s & s - 1) !== 0) throw new Error("Multiple ellipses in slice is not allowed.");
    for (var c = false, f = { dims: u2.length, numAddAxisAfterEllipsis: 0, begin: t.slice(), end: r.slice(), strides: u2.slice(), beginMask: a, endMask: o, ellipsisMask: s, newAxisMask: i, shrinkAxisMask: l }, h = 0; h < f.dims; h++) c && (1 << h & i) !== 0 && f.numAddAxisAfterEllipsis++, 1 << h & s && (c = true);
    c || (f.ellipsisMask |= 1 << f.dims, f.dims++);
    var p = { dims: e.length, beginMask: 0, endMask: 0, beginValid: false, endValid: false };
    Jue(f, p);
    for (var d = true, v = true, m = true, g = [], x = [], h = 0; h < e.length; ++h) {
      if (p.strides[h] === 0) throw Error("strides[" + h + "] must be non-zero");
      var b = !!(p.shrinkAxisMask & 1 << h), y = e[h];
      if (y === -1) {
        g.push(b ? 1 : -1);
        continue;
      }
      var w = [p.beginMask & 1 << h, p.endMask & 1 << h], _5 = [p.strides[h] > 0 ? 0 : -1, p.strides[h] > 0 ? y : y - 1];
      if (b && p.strides[h] <= 0) throw Error("only stride 1 allowed on non-range indexing.");
      m = m && p.strides[h] === 1;
      var k = !!(p.beginMask & 1 << h && p.endMask & 1 << h);
      if (p.beginValid && p.endValid) {
        if (b) {
          var T2 = p.begin[h] < 0 ? y + p.begin[h] : p.begin[h];
          if (p.begin[h] = T2, p.end[h] = p.begin[h] + 1, T2 < 0 || T2 >= y) throw Error("slice index " + p.begin[h] + " of dimension " + h + " out of bounds.");
        } else p.begin[h] = xL(p.begin[h], 0, p.strides[h], y, w, _5), p.end[h] = xL(p.end[h], 1, p.strides[h], y, w, _5);
        var A2 = p.strides[h] === 1 && p.begin[h] === 0 && p.end[h] === y;
        d = d && A2, v = v && (h === 0 && p.strides[h] === 1 || A2);
      } else d = d && p.strides[h] === 1 && k, v = v && (h === 0 && p.strides[h] === 1 || k);
      var S2 = void 0, C2 = false;
      if (p.beginValid && p.endValid ? (S2 = p.end[h] - p.begin[h], C2 = true) : b ? (S2 = 1, C2 = true) : k && y >= 0 && (p.strides[h] < 0 ? S2 = -y : S2 = y, C2 = true), C2) {
        var E2 = void 0;
        S2 === 0 || S2 < 0 != p.strides[h] < 0 ? E2 = 0 : E2 = Math.trunc(S2 / p.strides[h]) + (S2 % p.strides[h] !== 0 ? 1 : 0), g.push(E2);
      } else g.push(-1);
    }
    for (var F13 = 0; F13 < p.finalShapeGatherIndices.length; ++F13) {
      var N2 = p.finalShapeGatherIndices[F13];
      N2 >= 0 ? x.push(g[N2]) : N2 === w4 && x.push(1);
    }
    var D2 = x.filter(function(I2, O2) {
      return p.finalShapeGatherIndices[O2] !== w4;
    });
    return { finalShapeSparse: D2, finalShape: x, isIdentity: d, sliceDim0: v, isSimpleSlice: m, begin: p.begin, end: p.end, strides: p.strides };
  }
  function Jue(e, t) {
    t.beginMask = 0, t.endMask = 0, t.shrinkAxisMask = 0;
    var r = 0;
    t.beginValid = e.begin != null, t.endValid = e.end != null, t.begin = new Array(t.dims), t.end = new Array(t.dims), t.strides = new Array(t.dims), t.finalShapeGatherIndices = [], t.finalShapeGatherIndicesSparse = [], t.inputShapeGatherIndicesSparse = new Array(t.dims);
    for (var n = 0; n < e.dims; n++) if (1 << n & e.ellipsisMask) for (var a = Math.min(t.dims - (e.dims - n) + 1 + e.numAddAxisAfterEllipsis, t.dims); r < a; r++) t.begin[r] = 0, t.end[r] = 0, t.strides[r] = 1, t.beginMask |= 1 << r, t.endMask |= 1 << r, t.finalShapeGatherIndices.push(r), t.finalShapeGatherIndicesSparse.push(-1), t.inputShapeGatherIndicesSparse[r] = n;
    else if (1 << n & e.newAxisMask) t.finalShapeGatherIndices.push(w4), t.finalShapeGatherIndicesSparse.push(-1);
    else {
      if (r === t.begin.length) throw Error("Index out of range using input dim " + r + "; input " + ("has only " + t.dims + " dims, " + t.begin.length + "."));
      e.begin != null && (t.begin[r] = e.begin[n]), e.end != null && (t.end[r] = e.end[n]), t.strides[r] = e.strides[n], e.beginMask & 1 << n && (t.beginMask |= 1 << r), e.endMask & 1 << n && (t.endMask |= 1 << r), e.shrinkAxisMask & 1 << n ? (t.finalShapeGatherIndices.push(Wue), t.finalShapeGatherIndicesSparse.push(-1), t.shrinkAxisMask |= 1 << r) : (t.finalShapeGatherIndices.push(r), t.finalShapeGatherIndicesSparse.push(n)), t.inputShapeGatherIndicesSparse[r] = n, r++;
    }
  }
  function xL(e, t, r, n, a, o) {
    if (a[t]) return r > 0 ? o[t] : o[t + 1 & 1];
    var s = e < 0 ? n + e : e;
    return s < o[0] ? o[0] : s > o[1] ? o[1] : s;
  }
  var iz = { __proto__: null, assertParamsValid: Gue, maskToAxes: $ue, computeOutShape: Hue, stridesWithElidedDims: Z9, getNormalizedAxes: que, startIndicesWithElidedDims: ez, stopIndicesWithElidedDims: tz, stridesForAxis: rz, startForAxis: nz, stopForAxis: az, isSliceContinous: Xue, computeFlatOffset: Kue, parseSliceParams: Yue, sliceInfo: Zue };
  var oz = function() {
    function e() {
    }
    return e.prototype.getClassName = function() {
      return this.constructor.className;
    }, e.fromConfig = function(t, r) {
      return new t(r);
    }, e;
  }(), sz = function() {
    function e() {
      this.classNameMap = {};
    }
    return e.getMap = function() {
      return e.instance == null && (e.instance = new e()), e.instance;
    }, e.register = function(t) {
      e.getMap().classNameMap[t.className] = [t, t.fromConfig];
    }, e;
  }();
  function yv(e) {
    Dr(e.className != null, function() {
      return "Class being registered does not have the static className property defined.";
    }), Dr(typeof e.className == "string", function() {
      return "className is required to be a string, but got type " + typeof e.className;
    }), Dr(e.className.length > 0, function() {
      return "Class being registered has an empty-string as its className, which is disallowed.";
    }), sz.register(e);
  }
  var Que = { __proto__: null, Serializable: oz, SerializationMap: sz, registerClass: yv };
  var ece = 1e-3, lz = 0.1;
  function tce(e, t, r) {
    return r == null && (r = q4()), k4(e, t, function(n, a) {
      return X4(n, a, r);
    });
  }
  function q4() {
    return Xr.backend.floatPrecision() === 32 ? ece : lz;
  }
  function k4(e, t, r) {
    var n = true;
    if ((Gc(e) || Gc(t)) && (n = false), Gc(e) && Gc(t) && (n = true), n) {
      var a = e.constructor.name, o = t.constructor.name;
      if (a !== o) throw new Error("Arrays are of different type. Actual: " + a + ". " + ("Expected: " + o));
    }
    if (Array.isArray(e) && Array.isArray(t)) {
      var s = Rd(e), i = Rd(t);
      if (!mv(s, i)) throw new Error("Arrays have different shapes. " + ("Actual: [" + s + "]. Expected: [" + i + "]"));
    }
    var l = Gc(e) ? e : Fm(e), u2 = Gc(t) ? t : Fm(t);
    if (l.length !== u2.length) throw new Error("Arrays have different lengths actual: " + l.length + " vs " + ("expected: " + u2.length + `.
`) + ("Actual:   " + l + `.
`) + ("Expected: " + u2 + "."));
    for (var c = 0; c < u2.length; ++c) {
      var f = l[c], h = u2[c];
      if (!r(f, h)) throw new Error("Arrays differ: actual[" + c + "] = " + f + ", expected[" + c + "] = " + h + `.
` + ("Actual:   " + l + `.
`) + ("Expected: " + u2 + "."));
    }
  }
  function rce(e, t) {
    e().then(function() {
      return t.fail();
    }, function() {
      return t();
    });
  }
  function nce(e, t) {
    var r = typeof t == "string" || typeof t == "number" || typeof t == "boolean" ? [t] : t;
    return cv(e) || cv(e[0]) || cv(t) || cv(t[0]) ? k4(e, r, function(n, a) {
      return n == a;
    }) : k4(e, t, function(n, a) {
      return X4(n, a, 0);
    });
  }
  function ace(e, t, r) {
    if (r == null && (r = q4()), !X4(e, t, r)) throw new Error("Numbers differ: actual === " + e + ", expected === " + t);
  }
  function X4(e, t, r) {
    return !isFinite(e) && !isFinite(t) ? true : !(isNaN(e) || isNaN(t) || Math.abs(e - t) > r);
  }
  function ice(e, t, r) {
    for (var n = 0; n < e.length; n++) if (e[n] < t || e[n] > r) throw new Error("Value out of range:" + e[n] + " low: " + t + ", high: " + r);
  }
  function oce(e, t) {
    var r = new Float32Array(e), n = new Float32Array(t);
    if (r.length !== n.length) throw new Error("Expected ArrayBuffer to be of length " + (n.length + ", but it was " + r.length));
    for (var a = 0; a < n.length; a++) if (r[a] !== n[a]) throw new Error("Expected ArrayBuffer value at " + a + " to be " + (n[a] + " but got " + r[a] + " instead"));
  }
  function uz(e) {
    for (var t = 0; t < e.length; t++) {
      var r = e[t];
      Array.isArray(r) ? uz(r) : e[t] = $b(r);
    }
    return e;
  }
  var sce = { __proto__: null, TEST_EPSILON_FLOAT16: lz, expectArraysClose: tce, testEpsilon: q4, expectPromiseToFail: rce, expectArraysEqual: nce, expectNumbersClose: ace, expectValuesInRange: ice, expectArrayBuffersEqual: oce, encodeStrings: uz };
  var lce = "3.13.0";
  function uce() {
    So().set("PROD", true);
  }
  function cce() {
    So().set("DEBUG", true);
  }
  function fce() {
    So().set("DEPRECATION_WARNINGS_ENABLED", false), console.warn("TensorFlow.js deprecation warnings have been disabled.");
  }
  function hce(e) {
    So().getBool("DEPRECATION_WARNINGS_ENABLED") && console.warn(e + " You can disable deprecation warnings with tf.disableDeprecationWarnings().");
  }
  function pce() {
    Xr.disposeVariables();
  }
  function dce() {
    return Xr;
  }
  function vce() {
    return Xr.memory();
  }
  function mce(e) {
    return Xr.profile(e);
  }
  function Vu(e, t) {
    return Xr.tidy(e, t);
  }
  function If(e) {
    var t = R4(e);
    t.forEach(function(r) {
      return r.dispose();
    });
  }
  function cz(e) {
    return Xr.keep(e);
  }
  function gce(e) {
    return Xr.time(e);
  }
  function yce(e) {
    return Xr.setBackend(e);
  }
  function xce() {
    return Xr.ready();
  }
  function bce() {
    return Xr.backendName;
  }
  function _ce(e) {
    Xr.removeBackend(e);
  }
  function wce(e) {
    return Xr.findBackend(e);
  }
  function kce(e) {
    return Xr.findBackendFactory(e);
  }
  function Tce(e, t, r) {
    return r === void 0 && (r = 1), Xr.registerBackend(e, t, r);
  }
  function Ace() {
    return Xr.backend;
  }
  function Sce(e, t) {
    So().setPlatform(e, t);
  }
  function Ece(e, t) {
    var r, n = mr(e, "a", "add"), a = mr(t, "b", "add");
    r = hi(Bl(n, a), 2), n = r[0], a = r[1];
    var o = { a: n, b: a };
    return Xr.runKernel(I4, o);
  }
  var Hi = Hr({ add_: Ece });
  function Dce(e, t) {
    var r, n = mr(e, "a", "floorDiv"), a = mr(t, "b", "floorDiv");
    r = hi(Bl(n, a), 2), n = r[0], a = r[1];
    var o = { a: n, b: a };
    return Xr.runKernel(PR, o);
  }
  var fz = Hr({ floorDiv_: Dce });
  function Cce(e, t) {
    var r, n = mr(e, "a", "div"), a = mr(t, "b", "div");
    if (r = hi(Bl(n, a), 2), n = r[0], a = r[1], n.dtype === "int32" && a.dtype === "int32") return fz(n, a);
    var o = { a: n, b: a }, s = {};
    return Xr.runKernel(kR, o, s);
  }
  var cl = Hr({ div_: Cce });
  function Mce(e, t) {
    var r, n = mr(e, "a", "mul"), a = mr(t, "b", "mul");
    r = hi(Bl(n, a), 2), n = r[0], a = r[1];
    var o = { a: n, b: a };
    return Xr.runKernel(p7, o);
  }
  var Xa = Hr({ mul_: Mce });
  function Ice(e) {
    var t = mr(e, "x", "abs");
    if (t.dtype === "complex64") {
      var r = { x: t };
      return Xr.runKernel(iR, r);
    } else {
      var r = { x: t };
      return Xr.runKernel(RL, r);
    }
  }
  var Sh = Hr({ abs_: Ice });
  function Nce(e) {
    var t = mr(e, "x", "acos"), r = { x: t };
    return Xr.runKernel(zL, r);
  }
  var Fce = Hr({ acos_: Nce });
  function Oce(e) {
    var t = mr(e, "x", "acosh"), r = { x: t };
    return Xr.runKernel(BL, r);
  }
  var Pce = Hr({ acosh_: Oce });
  function Lce(e) {
    Dr(Array.isArray(e), function() {
      return "The argument passed to tf.addN() must be a list of tensors";
    }), Dr(e.length >= 1, function() {
      return "Must pass at least one tensor to tf.addN(), but got " + ("" + e.length);
    });
    var t = e.map(function(a, o) {
      return mr(a, "tensors" + o, "addN");
    }), r = t[0];
    t.forEach(function(a) {
      if (a.dtype !== r.dtype) throw new Error("All tensors passed to tf.addN() must have the same dtype");
    }), t.forEach(function(a) {
      if (!mv(a.shape, r.shape)) throw new Error("All tensors passed to tf.addN() must have the same shape");
    });
    var n = t;
    return Xr.runKernel(UL, n);
  }
  var Rce = Hr({ addN_: Lce });
  function zce(e, t, r) {
    t === void 0 && (t = null), r === void 0 && (r = false);
    var n = mr(e, "x", "all", "bool"), a = { x: n }, o = { axis: t, keepDims: r };
    return Xr.runKernel(VL, a, o);
  }
  var Bce = Hr({ all_: zce });
  function Uce(e, t, r) {
    t === void 0 && (t = null), r === void 0 && (r = false);
    var n = mr(e, "x", "any", "bool"), a = { x: n }, o = { axis: t, keepDims: r };
    return Xr.runKernel(jL, a, o);
  }
  var Vce = Hr({ any_: Uce });
  function jce(e, t) {
    t === void 0 && (t = 0);
    var r = mr(e, "x", "argMax"), n = { x: r }, a = { axis: t };
    return Xr.runKernel(WL, n, a);
  }
  var Wce = Hr({ argMax_: jce });
  function Gce(e, t) {
    t === void 0 && (t = 0);
    var r = mr(e, "x", "argMin"), n = { x: r }, a = { axis: t };
    return Xr.runKernel(GL, n, a);
  }
  var $ce = Hr({ argMin_: Gce });
  function Hce(e) {
    var t = mr(e, "x", "asin"), r = { x: t };
    return Xr.runKernel($L, r);
  }
  var qce = Hr({ asin_: Hce });
  function Xce(e) {
    var t = mr(e, "x", "asinh"), r = { x: t };
    return Xr.runKernel(HL, r);
  }
  var Kce = Hr({ asinh_: Xce });
  function Yce(e) {
    var t = mr(e, "x", "atan"), r = { x: t };
    return Xr.runKernel(qL, r);
  }
  var Zce = Hr({ atan_: Yce });
  function Jce(e, t) {
    var r, n = mr(e, "a", "atan2"), a = mr(t, "b", "atan2");
    r = hi(Bl(n, a), 2), n = r[0], a = r[1];
    var o = { a: n, b: a };
    return Xr.runKernel(KL, o);
  }
  var Qce = Hr({ atan2_: Jce });
  function efe(e) {
    var t = mr(e, "x", "atanh"), r = { x: t };
    return Xr.runKernel(XL, r);
  }
  var tfe = Hr({ atanh_: efe });
  function rfe(e, t, r, n, a, o) {
    a === void 0 && (a = "NHWC");
    var s = e[3], i = ys(t, [s]), l = dz(a);
    return qb(e, i, r, o, n, null, null, l);
  }
  function hz(e, t, r, n, a, o, s) {
    s === void 0 && (s = "channelsLast");
    var i = hi(g3(t), 2), l = i[0], u2 = i[1], c;
    if (s === "channelsLast") c = [l, u2, e[3], e[3]];
    else if (s === "channelsFirst") c = [l, u2, e[1], e[1]];
    else throw new Error("Unknown dataFormat " + s);
    return qb(e, c, r, n, a, o, false, s);
  }
  function nfe(e, t, r, n, a, o, s) {
    s === void 0 && (s = "NDHWC");
    var i = hi(T4(t), 3), l = i[0], u2 = i[1], c = i[2], f, h;
    if (s === "NDHWC") h = "channelsLast", f = [l, u2, c, e[4], e[4]];
    else if (s === "NCDHW") h = "channelsFirst", f = [l, u2, c, e[1], e[1]];
    else throw new Error("Unknown dataFormat " + s);
    return pz(e, f, r, n, a, false, h, o);
  }
  function qb(e, t, r, n, a, o, s, i) {
    var l, u2;
    s === void 0 && (s = false), i === void 0 && (i = "channelsLast");
    var c = hi([-1, -1, -1, -1], 4), f = c[0], h = c[1], p = c[2], d = c[3];
    if (i === "channelsLast") l = hi(e, 4), f = l[0], h = l[1], p = l[2], d = l[3];
    else if (i === "channelsFirst") u2 = hi(e, 4), f = u2[0], d = u2[1], h = u2[2], p = u2[3];
    else throw new Error("Unknown dataFormat " + i);
    var v = hi(t, 4), m = v[0], g = v[1], x = v[3], b = hi(g3(r), 2), y = b[0], w = b[1], _5 = hi(g3(n), 2), k = _5[0], T2 = _5[1], A2 = Y1(m, k), S2 = Y1(g, T2), C2 = ofe(a, h, p, y, w, A2, S2, o, i), E2 = C2.padInfo, F13 = C2.outHeight, N2 = C2.outWidth, D2 = s ? x * d : x, I2;
    return i === "channelsFirst" ? I2 = [f, D2, F13, N2] : i === "channelsLast" && (I2 = [f, F13, N2, D2]), { batchSize: f, dataFormat: i, inHeight: h, inWidth: p, inChannels: d, outHeight: F13, outWidth: N2, outChannels: D2, padInfo: E2, strideHeight: y, strideWidth: w, filterHeight: m, filterWidth: g, effectiveFilterHeight: A2, effectiveFilterWidth: S2, dilationHeight: k, dilationWidth: T2, inShape: e, outShape: I2, filterShape: t };
  }
  function pz(e, t, r, n, a, o, s, i) {
    var l, u2;
    o === void 0 && (o = false), s === void 0 && (s = "channelsLast");
    var c = hi([-1, -1, -1, -1, -1], 5), f = c[0], h = c[1], p = c[2], d = c[3], v = c[4];
    if (s === "channelsLast") l = hi(e, 5), f = l[0], h = l[1], p = l[2], d = l[3], v = l[4];
    else if (s === "channelsFirst") u2 = hi(e, 5), f = u2[0], v = u2[1], h = u2[2], p = u2[3], d = u2[4];
    else throw new Error("Unknown dataFormat " + s);
    var m = hi(t, 5), g = m[0], x = m[1], b = m[2], y = m[4], w = hi(T4(r), 3), _5 = w[0], k = w[1], T2 = w[2], A2 = hi(T4(n), 3), S2 = A2[0], C2 = A2[1], E2 = A2[2], F13 = Y1(g, S2), N2 = Y1(x, C2), D2 = Y1(b, E2), I2 = sfe(a, h, p, d, _5, k, T2, F13, N2, D2, i), O2 = I2.padInfo, L2 = I2.outDepth, V2 = I2.outHeight, W2 = I2.outWidth, X2 = o ? y * v : y, Y2;
    return s === "channelsFirst" ? Y2 = [f, X2, L2, V2, W2] : s === "channelsLast" && (Y2 = [f, L2, V2, W2, X2]), { batchSize: f, dataFormat: s, inDepth: h, inHeight: p, inWidth: d, inChannels: v, outDepth: L2, outHeight: V2, outWidth: W2, outChannels: X2, padInfo: O2, strideDepth: _5, strideHeight: k, strideWidth: T2, filterDepth: g, filterHeight: x, filterWidth: b, effectiveFilterDepth: F13, effectiveFilterHeight: N2, effectiveFilterWidth: D2, dilationDepth: S2, dilationHeight: C2, dilationWidth: E2, inShape: e, outShape: Y2, filterShape: t };
  }
  function afe(e, t, r, n, a) {
    n == null && (n = K4(e, t, r));
    var o = e[0], s = e[1], i = Nm((o - t + 2 * n) / r + 1, a), l = Nm((s - t + 2 * n) / r + 1, a);
    return [i, l];
  }
  function ife(e, t, r, n, a, o) {
    a == null && (a = K4(e, t, n));
    var s = e[0], i = e[1], l = e[2], u2 = Nm((s - t + 2 * a) / n + 1, o), c = Nm((i - t + 2 * a) / n + 1, o), f = Nm((l - t + 2 * a) / n + 1, o);
    return [u2, c, f, r];
  }
  function K4(e, t, r, n) {
    n === void 0 && (n = 1);
    var a = Y1(t, n);
    return Math.floor((e[0] * (r - 1) - r + a) / 2);
  }
  function g3(e) {
    return typeof e == "number" ? [e, e, e] : e.length === 2 ? [e[0], e[1], 1] : e;
  }
  function T4(e) {
    return typeof e == "number" ? [e, e, e] : e;
  }
  function Y1(e, t) {
    return t <= 1 ? e : e + (e - 1) * (t - 1);
  }
  function ofe(e, t, r, n, a, o, s, i, l) {
    var u2, c, f;
    if (typeof e == "number") {
      var h = e === 0 ? "VALID" : "NUMBER";
      u2 = { top: e, bottom: e, left: e, right: e, type: h };
      var p = afe([t, r], o, n, e, i);
      c = p[0], f = p[1];
    } else if (e === "same") {
      c = Math.ceil(t / n), f = Math.ceil(r / a);
      var d = Math.max(0, (c - 1) * n + o - t), v = Math.max(0, (f - 1) * a + s - r), m = Math.floor(d / 2), g = d - m, x = Math.floor(v / 2), b = v - x;
      u2 = { top: m, bottom: g, left: x, right: b, type: "SAME" };
    } else if (e === "valid") u2 = { top: 0, bottom: 0, left: 0, right: 0, type: "VALID" }, c = Math.ceil((t - o + 1) / n), f = Math.ceil((r - s + 1) / a);
    else if (typeof e == "object") {
      var m = l === "channelsLast" ? e[1][0] : e[2][0], g = l === "channelsLast" ? e[1][1] : e[2][1], x = l === "channelsLast" ? e[2][0] : e[3][0], b = l === "channelsLast" ? e[2][1] : e[3][1], h = m === 0 && g === 0 && x === 0 && b === 0 ? "VALID" : "EXPLICIT";
      u2 = { top: m, bottom: g, left: x, right: b, type: h }, c = Nm((t - o + m + g) / n + 1, i), f = Nm((r - s + x + b) / a + 1, i);
    } else throw Error("Unknown padding parameter: " + e);
    return { padInfo: u2, outHeight: c, outWidth: f };
  }
  function sfe(e, t, r, n, a, o, s, i, l, u2, c) {
    var f, h, p, d;
    if (typeof e == "number") {
      var v = e === 0 ? "VALID" : "NUMBER";
      f = { top: e, bottom: e, left: e, right: e, front: e, back: e, type: v };
      var m = ife([t, r, n, 1], i, 1, a, e, c);
      h = m[0], p = m[1], d = m[2];
    } else if (e === "same") {
      h = Math.ceil(t / a), p = Math.ceil(r / o), d = Math.ceil(n / s);
      var g = (h - 1) * a + i - t, x = (p - 1) * o + l - r, b = (d - 1) * s + u2 - n, y = Math.floor(g / 2), w = g - y, _5 = Math.floor(x / 2), k = x - _5, T2 = Math.floor(b / 2), A2 = b - T2;
      f = { top: _5, bottom: k, left: T2, right: A2, front: y, back: w, type: "SAME" };
    } else if (e === "valid") f = { top: 0, bottom: 0, left: 0, right: 0, front: 0, back: 0, type: "VALID" }, h = Math.ceil((t - i + 1) / a), p = Math.ceil((r - l + 1) / o), d = Math.ceil((n - u2 + 1) / s);
    else throw Error("Unknown padding parameter: " + e);
    return { padInfo: f, outDepth: h, outHeight: p, outWidth: d };
  }
  function Nm(e, t) {
    if (!t) return Math.trunc(e);
    switch (t) {
      case "round":
        return Math.round(e);
      case "ceil":
        return Math.ceil(e);
      case "floor":
        return Math.floor(e);
      default:
        throw new Error("Unknown roundingMode " + t);
    }
  }
  function Rb(e) {
    var t = hi(g3(e), 3), r = t[0], n = t[1], a = t[2];
    return r === 1 && n === 1 && a === 1;
  }
  function x0(e, t) {
    return Rb(e) || Rb(t);
  }
  function dz(e) {
    if (e === "NHWC") return "channelsLast";
    if (e === "NCHW") return "channelsFirst";
    throw new Error("Unknown dataFormat " + e);
  }
  function rp(e, t, r) {
    if (r != null) {
      if (typeof t == "string") throw Error("Error in " + e + ": pad must be an integer when using " + ("dimRoundingMode " + r + " but got pad " + t + "."));
      if (typeof t == "number") Dr(Q1(t), function() {
        return "Error in " + e + ": pad must be an integer when using " + ("dimRoundingMode " + r + " but got pad " + t + ".");
      });
      else if (typeof t == "object") t.forEach(function(n) {
        n.forEach(function(a) {
          Dr(Q1(a), function() {
            return "Error in " + e + ": pad must be an integer when using " + ("dimRoundingMode " + r + " but got pad " + a + ".");
          });
        });
      });
      else throw Error("Error in " + e + ": Unknown padding parameter: " + t);
    }
  }
  function lfe(e, t) {
    var r = mr(e, "x", "reshape", "string_or_numeric"), n = { x: r }, a = { shape: t };
    return Xr.runKernel(M7, n, a);
  }
  var ga = Hr({ reshape_: lfe });
  function ufe(e, t, r, n, a) {
    var o = mr(e, "x", "avgPool", "float32"), s = 1;
    Dr(x0(r, s), function() {
      return "Error in avgPool: Either strides or dilations must be 1. " + ("Got strides " + r + " and dilations '" + s + "'");
    });
    var i = o, l = false;
    o.rank === 3 && (l = true, i = ga(o, [1, o.shape[0], o.shape[1], o.shape[2]])), Dr(i.rank === 4, function() {
      return "Error in avgPool: x must be rank 4 but got rank " + i.rank + ".";
    }), rp("avgPool", n, a);
    var u2 = { x: i }, c = { filterSize: t, strides: r, pad: n, dimRoundingMode: a }, f = Xr.runKernel(YL, u2, c);
    return f = iu(f, o.dtype), l ? ga(f, [f.shape[1], f.shape[2], f.shape[3]]) : f;
  }
  var vz = Hr({ avgPool_: ufe });
  function cfe(e, t, r, n, a, o) {
    o === void 0 && (o = "NDHWC");
    var s = mr(e, "x", "avgPool3d", "float32"), i = s, l = false;
    s.rank === 4 && (l = true, i = ga(s, [1, s.shape[0], s.shape[1], s.shape[2], s.shape[3]])), Dr(i.rank === 5, function() {
      return "Error in avgPool3d: x must be rank 5 but got rank " + i.rank + ".";
    }), Dr(o === "NDHWC", function() {
      return "Error in avgPool3d: Only NDHWC is currently supported, " + ("but got dataFormat of " + o);
    }), rp("avgPool3d", n, a);
    var u2 = { x: i }, c = { filterSize: t, strides: r, pad: n, dimRoundingMode: a, dataFormat: o }, f = Xr.runKernel(ZL, u2, c);
    return f = iu(f, i.dtype), l ? ga(f, [f.shape[1], f.shape[2], f.shape[3], f.shape[4]]) : f;
  }
  var ffe = Hr({ avgPool3d_: cfe });
  function hfe(e, t) {
    t === void 0 && (t = 0), Dr(e.length >= 1, function() {
      return "Pass at least one tensor to concat";
    });
    var r = Lb(e, "tensors", "concat", "string_or_numeric");
    if (r[0].dtype === "complex64" && r.forEach(function(o) {
      if (o.dtype !== "complex64") throw new Error(`Cannot concatenate complex64 tensors with a tensor
          with dtype ` + o.dtype + ". ");
    }), r.length === 1) return Im(r[0]);
    var n = r, a = { axis: t };
    return Xr.runKernel(oR, n, a);
  }
  var eh = Hr({ concat_: hfe });
  function pfe(e) {
    var t = mr(e, "x", "sigmoid", "float32"), r = { x: t };
    return Xr.runKernel(G7, r);
  }
  var Z1 = Hr({ sigmoid_: pfe });
  function dfe(e, t, r) {
    var n = mr(e, "x", "slice", "string_or_numeric");
    if (n.rank === 0) throw new Error("Slicing scalar is not possible");
    var a = { x: n }, o = { begin: t, size: r };
    return Xr.runKernel(U7, a, o);
  }
  var Cl = Hr({ slice_: dfe });
  function vfe(e) {
    var t = mr(e, "x", "tanh", "float32"), r = { x: t };
    return Xr.runKernel(u9, r);
  }
  var A4 = Hr({ tanh_: vfe });
  function mfe(e, t, r, n, a, o) {
    var s = mr(e, "forgetBias", "basicLSTMCell"), i = mr(t, "lstmKernel", "basicLSTMCell"), l = mr(r, "lstmBias", "basicLSTMCell"), u2 = mr(n, "data", "basicLSTMCell"), c = mr(a, "c", "basicLSTMCell"), f = mr(o, "h", "basicLSTMCell"), h = eh([u2, f], 1), p = gs(h, i), d = Hi(p, l), v = d.shape[0], m = d.shape[1] / 4, g = [v, m], x = Cl(d, [0, 0], g), b = Cl(d, [0, m], g), y = Cl(d, [0, m * 2], g), w = Cl(d, [0, m * 3], g), _5 = Hi(Xa(Z1(x), A4(b)), Xa(c, Z1(Hi(s, y)))), k = Xa(A4(_5), Z1(w));
    return [_5, k];
  }
  var gfe = Hr({ basicLSTMCell_: mfe });
  function yfe(e, t, r) {
    var n = mr(e, "x", "batchToSpaceND"), a = t.reduce(function(i, l) {
      return i * l;
    });
    Dr(n.rank >= 1 + t.length, function() {
      return "input rank is " + n.rank + " but should be > than blockShape.length " + t.length;
    }), Dr(r.length === t.length, function() {
      return "crops.length is " + r.length + " but should be equal to blockShape.length  " + t.length;
    }), Dr(n.shape[0] % a === 0, function() {
      return "input tensor batch is " + n.shape[0] + " but is not divisible by the product of " + ("the elements of blockShape " + t.join(" * ") + " === " + a);
    });
    var o = { x: n }, s = { blockShape: t, crops: r };
    return Xr.runKernel(QL, o, s);
  }
  var mz = Hr({ batchToSpaceND_: yfe });
  function xfe(e) {
    var t;
    return e.rank === 0 || e.rank === 1 ? t = ga(e, [1, 1, 1, e.size]) : e.rank === 2 ? t = ga(e, [1, 1, e.shape[0], e.shape[1]]) : e.rank === 3 ? t = ga(e, [1, e.shape[0], e.shape[1], e.shape[2]]) : t = e, t;
  }
  function bfe(e, t, r, n, a, o) {
    o == null && (o = 1e-3);
    var s = mr(e, "x", "batchNorm"), i = mr(t, "mean", "batchNorm"), l = mr(r, "variance", "batchNorm"), u2;
    a != null && (u2 = mr(a, "scale", "batchNorm"));
    var c;
    n != null && (c = mr(n, "offset", "batchNorm")), Dr(i.rank === l.rank, function() {
      return "Batch normalization gradient requires mean and variance to have equal ranks.";
    }), Dr(c == null || i.rank === c.rank, function() {
      return "Batch normalization gradient requires mean and offset to have equal ranks.";
    }), Dr(u2 == null || i.rank === u2.rank, function() {
      return "Batch normalization gradient requires mean and scale to have equal ranks.";
    });
    var f = xfe(s), h = { x: f, scale: u2, offset: c, mean: i, variance: l }, p = { varianceEpsilon: o }, d = Xr.runKernel(LR, h, p);
    return ga(d, s.shape);
  }
  var S3 = Hr({ batchNorm_: bfe });
  function _fe(e, t, r, n, a, o) {
    var s = mr(e, "x", "batchNorm"), i = mr(t, "mean", "batchNorm"), l = mr(r, "variance", "batchNorm"), u2;
    a != null && (u2 = mr(a, "scale", "batchNorm"));
    var c;
    return n != null && (c = mr(n, "offset", "batchNorm")), Dr(s.rank === 2, function() {
      return "Error in batchNorm2D: x must be rank 2 but got rank " + (s.rank + ".");
    }), Dr(i.rank === 2 || i.rank === 1, function() {
      return "Error in batchNorm2D: mean must be rank 2 or rank 1 but " + ("got rank " + i.rank + ".");
    }), Dr(l.rank === 2 || l.rank === 1, function() {
      return "Error in batchNorm2D: variance must be rank 2 or rank 1 " + ("but got rank " + l.rank + ".");
    }), u2 != null && Dr(u2.rank === 2 || u2.rank === 1, function() {
      return "Error in batchNorm2D: scale must be rank 2 or rank 1 " + ("but got rank " + u2.rank + ".");
    }), c != null && Dr(c.rank === 2 || c.rank === 1, function() {
      return "Error in batchNorm2D: offset must be rank 2 or rank 1 " + ("but got rank " + c.rank + ".");
    }), S3(s, i, l, c, u2, o);
  }
  var wfe = Hr({ batchNorm2d_: _fe });
  function kfe(e, t, r, n, a, o) {
    var s = mr(e, "x", "batchNorm"), i = mr(t, "mean", "batchNorm"), l = mr(r, "variance", "batchNorm"), u2;
    a != null && (u2 = mr(a, "scale", "batchNorm"));
    var c;
    return n != null && (c = mr(n, "offset", "batchNorm")), Dr(s.rank === 3, function() {
      return "Error in batchNorm3D: x must be rank 3 but got rank " + (s.rank + ".");
    }), Dr(i.rank === 3 || i.rank === 1, function() {
      return "Error in batchNorm3D: mean must be rank 3 or rank 1 but " + ("got rank " + i.rank + ".");
    }), Dr(l.rank === 3 || l.rank === 1, function() {
      return "Error in batchNorm3D: variance must be rank 3 or rank 1 " + ("but got rank " + l.rank + ".");
    }), u2 != null && Dr(u2.rank === 3 || u2.rank === 1, function() {
      return "Error in batchNorm3D: scale must be rank 3 or rank 1 " + ("but got rank " + u2.rank + ".");
    }), c != null && Dr(c.rank === 3 || c.rank === 1, function() {
      return "Error in batchNorm3D: offset must be rank 3 or rank 1 " + ("but got rank " + c.rank + ".");
    }), S3(s, i, l, c, u2, o);
  }
  var Tfe = Hr({ batchNorm3d_: kfe });
  function Afe(e, t, r, n, a, o) {
    var s = mr(e, "x", "batchNorm"), i = mr(t, "mean", "batchNorm"), l = mr(r, "variance", "batchNorm"), u2;
    a != null && (u2 = mr(a, "scale", "batchNorm"));
    var c;
    return n != null && (c = mr(n, "offset", "batchNorm")), Dr(s.rank === 4, function() {
      return "Error in batchNorm4D: x must be rank 4 but got rank " + (s.rank + ".");
    }), Dr(i.rank === 4 || i.rank === 1, function() {
      return "Error in batchNorm4D: mean must be rank 4 or rank 1 but " + ("got rank " + i.rank + ".");
    }), Dr(l.rank === 4 || l.rank === 1, function() {
      return "Error in batchNorm4D: variance must be rank 4 or rank 1 " + ("but got rank " + l.rank + ".");
    }), u2 != null && Dr(u2.rank === 4 || u2.rank === 1, function() {
      return "Error in batchNorm4D: scale must be rank 4 or rank 1 " + ("but got rank " + u2.rank + ".");
    }), c != null && Dr(c.rank === 4 || c.rank === 1, function() {
      return "Error in batchNorm4D: offset must be rank 4 or rank 1 " + ("but got rank " + c.rank + ".");
    }), S3(s, i, l, c, u2, o);
  }
  var Sfe = Hr({ batchNorm4d_: Afe });
  function Efe(e, t, r) {
    var n = mr(e, "x", "bincount"), a = mr(t, "weights", "bincount");
    Dr(n.dtype === "int32", function() {
      return "Error in bincount: input " + ("dtype must be int32, but got " + n.dtype);
    }), Dr(r >= 0, function() {
      return "size must be non-negative, but got " + r + ".";
    }), Dr(a.size === n.size || a.size === 0, function() {
      return "Error in bincount: weights must have the same size as input or" + ("0-length, but got input shape: " + n.shape + ", weights shape: ") + (a.shape + ".");
    });
    var o = { x: n, weights: a }, s = { size: r };
    return Xr.runKernel(eR, o, s);
  }
  var gz = Hr({ bincount_: Efe });
  function Dfe(e, t) {
    var r = mr(e, "s0", "broadcastArgs", "int32"), n = mr(t, "s1", "broadcastArgs", "int32");
    if (r.rank !== 1) throw new Error("broadcastArgs(): first input must be a vector (rank=1). " + ("Has rank " + r.rank));
    if (n.rank !== 1) throw new Error("broadcastArgs(): second input must be a vector (rank=1). " + ("Has rank " + n.rank));
    var a = { s0: r, s1: n };
    return Xr.runKernel(tR, a);
  }
  var Cfe = Hr({ broadcastArgs_: Dfe });
  function Mfe(e, t) {
    var r = mr(e, "broadcastTo", "x"), n = r.shape;
    if (t.some(function(f) {
      return !(f > 0) || f % 1 !== 0;
    })) throw new Error("broadcastTo(): Invalid broadcast shape [" + t + "].");
    if (t.length < r.rank) throw new Error("broadcastTo(): shape.length=" + t.length + " < input.rank=" + r.rank + ".");
    if (t.length > r.rank) {
      for (var a = r.shape.slice(); a.length < t.length; ) a.unshift(1);
      r = ga(r, a);
    }
    for (var o = r.shape, s = Array.from(t), i = t.length - 1; i >= 0; i--) if (o[i] === t[i]) s[i] = 1;
    else if (r.shape[i] !== 1) throw new Error("broadcastTo(): [" + n + "] cannot be broadcast to [" + t + "].");
    var l = s.map(function(f, h) {
      return f > 1 ? h : -1;
    }).filter(function(f) {
      return f >= 0;
    });
    if (l.length === 0) return Im(r);
    var u2 = { x: r }, c = { reps: s };
    return Xr.runKernel(O4, u2, c);
  }
  var o3 = Hr({ broadcastTo_: Mfe });
  function Ife(e) {
    var t = mr(e, "x", "ceil", "float32"), r = { x: t };
    return Xr.runKernel(rR, r);
  }
  var Nfe = Hr({ ceil_: Ife });
  function Ffe(e, t, r) {
    var n = mr(e, "x", "clipByValue");
    Dr(t <= r, function() {
      return "Error in clip: min (" + t + ") must be " + ("less than or equal to max (" + r + ").");
    });
    var a = { x: n }, o = { clipValueMin: t, clipValueMax: r };
    return Xr.runKernel(nR, a, o);
  }
  var Ofe = Hr({ clipByValue_: Ffe });
  function Pfe(e) {
    return eh(e, 0);
  }
  var Lfe = Hr({ concat1d_: Pfe });
  function Rfe(e, t) {
    return eh(e, t);
  }
  var zfe = Hr({ concat2d_: Rfe });
  function Bfe(e, t) {
    return eh(e, t);
  }
  var Ufe = Hr({ concat3d_: Bfe });
  function Vfe(e, t) {
    return eh(e, t);
  }
  var jfe = Hr({ concat4d_: Vfe });
  function Wfe(e, t, r, n, a, o, s) {
    a === void 0 && (a = "NHWC"), o === void 0 && (o = [1, 1]);
    var i = mr(e, "x", "conv2d", "float32"), l = mr(t, "filter", "conv2d", "float32"), u2 = i, c = false;
    i.rank === 3 && (c = true, u2 = ga(i, [1, i.shape[0], i.shape[1], i.shape[2]])), Dr(u2.rank === 4, function() {
      return "Error in conv2d: input must be rank 4, but got rank " + u2.rank + ".";
    }), Dr(l.rank === 4, function() {
      return "Error in conv2d: filter must be rank 4, but got rank " + (l.rank + ".");
    }), rp("conv2d", n, s);
    var f = a === "NHWC" ? u2.shape[3] : u2.shape[1];
    Dr(f === l.shape[2], function() {
      return "Error in conv2d: depth of input (" + f + ") must match " + ("input depth for filter " + l.shape[2] + ".");
    }), Dr(x0(r, o), function() {
      return "Error in conv2D: Either strides or dilations must be 1. " + ("Got strides " + r + " and dilations '" + o + "'");
    });
    var h = { x: u2, filter: l }, p = { strides: r, pad: n, dataFormat: a, dilations: o, dimRoundingMode: s }, d = Xr.runKernel(sR, h, p);
    return c ? ga(d, [d.shape[1], d.shape[2], d.shape[3]]) : d;
  }
  var E3 = Hr({ conv2d_: Wfe });
  function Gfe(e, t, r, n, a, o, s) {
    a === void 0 && (a = "NWC"), o === void 0 && (o = 1);
    var i = mr(e, "x", "conv1d"), l = mr(t, "filter", "conv1d"), u2 = i, c = false;
    i.rank === 2 && (c = true, u2 = ga(i, [1, i.shape[0], i.shape[1]])), Dr(u2.rank === 3, function() {
      return "Error in conv1d: input must be rank 3, but got rank " + u2.rank + ".";
    }), Dr(l.rank === 3, function() {
      return "Error in conv1d: filter must be rank 3, but got rank " + (l.rank + ".");
    }), rp("conv1d", n, s), Dr(u2.shape[2] === l.shape[1], function() {
      return "Error in conv1d: depth of input (" + u2.shape[2] + ") must match " + ("input depth for filter " + l.shape[1] + ".");
    }), Dr(x0(r, o), function() {
      return "Error in conv1D: Either stride or dilation must be 1. " + ("Got stride " + r + " and dilation '" + o + "'");
    }), Dr(a === "NWC", function() {
      return "Error in conv1d: got dataFormat of " + a + " but only NWC is currently supported.";
    });
    var f = ga(l, [1, l.shape[0], l.shape[1], l.shape[2]]), h = ga(u2, [u2.shape[0], 1, u2.shape[1], u2.shape[2]]), p = [1, r], d = [1, o], v = "NHWC", m = E3(h, f, p, n, v, d, s);
    return c ? ga(m, [m.shape[2], m.shape[3]]) : ga(m, [m.shape[0], m.shape[2], m.shape[3]]);
  }
  var $fe = Hr({ conv1d_: Gfe });
  function Hfe(e, t, r, n, a, o, s) {
    o === void 0 && (o = "NHWC"), Dr(e.length === t.rank, function() {
      return "Length of inShape " + ("(" + e.length + ") and rank of dy (" + t.rank + ") must match");
    });
    var i = e, l = t, u2 = false;
    t.rank === 3 && (u2 = true, l = ga(t, [1, t.shape[0], t.shape[1], t.shape[2]]), i = [1, e[0], e[1], e[2]]), Dr(i.length === 4, function() {
      return "Error in conv2dDerInput: inShape must be length 4, but got length " + (i.length + ".");
    }), Dr(l.rank === 4, function() {
      return "Error in conv2dDerInput: dy must be rank 4, but got " + ("rank " + l.rank);
    }), Dr(r.rank === 4, function() {
      return "Error in conv2dDerInput: filter must be rank 4, but got " + ("rank " + r.rank);
    });
    var c = o === "NHWC" ? i[3] : i[1], f = o === "NHWC" ? l.shape[3] : l.shape[1];
    Dr(c === r.shape[2], function() {
      return "Error in conv2dDerInput: depth of input (" + c + ") must " + ("match input depth for filter " + r.shape[2] + ".");
    }), Dr(f === r.shape[3], function() {
      return "Error in conv2dDerInput: depth of output (" + f + ") must " + ("match output depth for filter " + r.shape[3] + ".");
    }), rp("conv2dDerInput", a, s);
    var h = { dy: l, filter: r }, p = { strides: n, pad: a, dataFormat: o, dimRoundingMode: s, inputShape: i }, d = Xr.runKernel(uR, h, p);
    return u2 ? ga(d, [d.shape[1], d.shape[2], d.shape[3]]) : d;
  }
  var yz = Hr({ conv2DBackpropInput_: Hfe });
  function qfe(e, t, r, n, a, o) {
    var s = mr(e, "x", "conv2dTranspose"), i = mr(t, "filter", "conv2dTranspose");
    return yz(r, s, i, n, a, "NHWC", o);
  }
  var Xfe = Hr({ conv2dTranspose_: qfe });
  function Kfe(e, t, r, n, a, o) {
    a === void 0 && (a = "NDHWC"), o === void 0 && (o = [1, 1, 1]);
    var s = mr(e, "x", "conv3d"), i = mr(t, "filter", "conv3d"), l = s, u2 = false;
    s.rank === 4 && (u2 = true, l = ga(s, [1, s.shape[0], s.shape[1], s.shape[2], s.shape[3]])), Dr(l.rank === 5, function() {
      return "Error in conv3d: input must be rank 5, but got rank " + l.rank + ".";
    }), Dr(i.rank === 5, function() {
      return "Error in conv3d: filter must be rank 5, but got rank " + (i.rank + ".");
    }), Dr(l.shape[4] === i.shape[3], function() {
      return "Error in conv3d: depth of input (" + l.shape[4] + ") must match " + ("input depth for filter " + i.shape[3] + ".");
    }), Dr(x0(r, o), function() {
      return "Error in conv3D: Either strides or dilations must be 1. " + ("Got strides " + r + " and dilations '" + o + "'");
    }), Dr(a === "NDHWC", function() {
      return "Error in conv3d: got dataFormat of " + a + " but only NDHWC is currently supported.";
    });
    var c = { x: l, filter: i }, f = { strides: r, pad: n, dataFormat: a, dilations: o }, h = Xr.runKernel(cR, c, f);
    return u2 ? ga(h, [h.shape[1], h.shape[2], h.shape[3], h.shape[4]]) : h;
  }
  var Yfe = Hr({ conv3d_: Kfe });
  function Zfe(e, t, r, n, a) {
    Dr(e.length === t.rank, function() {
      return "Length of inShape " + ("(" + e.length + ") and rank of dy (" + t.rank + ") must match");
    });
    var o = e, s = t, i = false;
    t.rank === 4 && (i = true, s = ga(t, [1, t.shape[0], t.shape[1], t.shape[2], t.shape[3]]), o = [1, e[0], e[1], e[2], e[3]]);
    var l = o[4], u2 = s.shape[4];
    Dr(o.length === 5, function() {
      return "Error in conv3dDerInput: inShape must be length 5, but got length " + (o.length + ".");
    }), Dr(s.rank === 5, function() {
      return "Error in conv3dDerInput: dy must be rank 5, but got " + ("rank " + s.rank);
    }), Dr(r.rank === 5, function() {
      return "Error in conv3dDerInput: filter must be rank 5, but got " + ("rank " + r.rank);
    }), Dr(l === r.shape[3], function() {
      return "Error in conv3dDerInput: depth of input (" + l + ") must " + ("match input depth for filter " + r.shape[3] + ".");
    }), Dr(u2 === r.shape[4], function() {
      return "Error in conv3dDerInput: depth of output (" + u2 + ") must " + ("match output depth for filter " + r.shape[4] + ".");
    });
    var c = { dy: s, filter: r }, f = { pad: a, strides: n, inputShape: o }, h = Xr.runKernel(fR, c, f);
    return i ? ga(h, [h.shape[1], h.shape[2], h.shape[3], h.shape[4]]) : h;
  }
  var Jfe = Hr({ conv3DBackpropInput_: Zfe });
  function Qfe(e, t, r, n, a) {
    var o = mr(e, "x", "conv3dTranspose"), s = mr(t, "filter", "conv3dTranspose");
    return Jfe(r, o, s, n, a);
  }
  var ehe = Hr({ conv3dTranspose_: Qfe });
  function the(e) {
    var t = mr(e, "x", "cos", "float32"), r = { x: t };
    return Xr.runKernel(hR, r);
  }
  var rhe = Hr({ cos_: the });
  function nhe(e) {
    var t = mr(e, "x", "cosh", "float32"), r = { x: t };
    return Xr.runKernel(pR, r);
  }
  var ahe = Hr({ cosh_: nhe });
  function ihe(e, t, r, n) {
    t === void 0 && (t = 0), r === void 0 && (r = false), n === void 0 && (n = false);
    var a = mr(e, "x", "cumsum"), o = { x: a }, s = { axis: t, exclusive: r, reverse: n };
    return Xr.runKernel(dR, o, s);
  }
  var ohe = Hr({ cumsum_: ihe });
  function she(e, t, r, n) {
    n === void 0 && (n = false);
    var a = mr(e, "x", "denseBincount"), o = mr(t, "weights", "denseBincount");
    Dr(a.dtype === "int32", function() {
      return "Error in denseBincount: input " + ("dtype must be int32, but got " + a.dtype);
    }), Dr(a.rank <= 2, function() {
      return "Error in denseBincount: input must be at most rank 2, but got " + ("rank " + a.rank + ".");
    }), Dr(r >= 0, function() {
      return "size must be non-negative, but got " + r + ".";
    }), Dr(o.size === a.size || o.size === 0, function() {
      return "Error in denseBincount: weights must have the same shape as x or " + ("0-length, but got x shape: " + a.shape + ", weights shape: ") + (o.shape + ".");
    });
    var s = { x: a, weights: o }, i = { size: r, binaryOutput: n };
    return Xr.runKernel(mR, s, i);
  }
  var lhe = Hr({ denseBincount_: she });
  function uhe(e, t, r) {
    r === void 0 && (r = "NHWC");
    var n = mr(e, "x", "depthToSpace", "float32"), a = r === "NHWC" ? n.shape[1] : n.shape[2], o = r === "NHWC" ? n.shape[2] : n.shape[3], s = r === "NHWC" ? n.shape[3] : n.shape[1];
    Dr(t > 1, function() {
      return "blockSize should be > 1 for depthToSpace, but was: " + t;
    }), Dr(a * t >= 0, function() {
      return `Negative dimension size caused by overflow when multiplying
    ` + a + " and " + t + `  for depthToSpace with input shape
    ` + n.shape;
    }), Dr(o * t >= 0, function() {
      return `Negative dimension size caused by overflow when multiplying
    ` + o + " and " + t + ` for depthToSpace with input shape
        ` + n.shape;
    }), Dr(s % (t * t) === 0, function() {
      return "Dimension size must be evenly divisible by " + t * t + " but is " + s + " for depthToSpace with input shape " + n.shape;
    });
    var i = { x: n }, l = { blockSize: t, dataFormat: r };
    return Xr.runKernel(gR, i, l);
  }
  var che = Hr({ depthToSpace_: uhe });
  function fhe(e, t, r, n, a, o, s) {
    a === void 0 && (a = "NHWC"), o === void 0 && (o = [1, 1]);
    var i = mr(e, "x", "depthwiseConv2d", "float32"), l = mr(t, "filter", "depthwiseConv2d", "float32"), u2 = i, c = false;
    i.rank === 3 && (c = true, u2 = ga(i, [1, i.shape[0], i.shape[1], i.shape[2]])), Dr(u2.rank === 4, function() {
      return "Error in depthwiseConv2d: input must be rank 4, but got " + ("rank " + u2.rank + ".");
    }), Dr(l.rank === 4, function() {
      return "Error in depthwiseConv2d: filter must be rank 4, but got rank " + (l.rank + ".");
    }), Dr(u2.shape[3] === l.shape[2], function() {
      return "Error in depthwiseConv2d: number of input channels " + ("(" + u2.shape[3] + ") must match the inChannels dimension in ") + ("filter " + l.shape[2] + ".");
    }), rp("depthwiseConv2d", n, s);
    var f = { x: u2, filter: l }, h = { strides: r, pad: n, dataFormat: a, dilations: o, dimRoundingMode: s }, p = Xr.runKernel(yR, f, h);
    return c ? ga(p, [p.shape[1], p.shape[2], p.shape[3]]) : p;
  }
  var Y4 = Hr({ depthwiseConv2d_: fhe });
  function hhe(e) {
    var t = mr(e, "x", "diag"), r = { x: t };
    return Xr.runKernel(_R, r);
  }
  var phe = Hr({ diag_: hhe });
  function dhe(e, t, r, n, a, o) {
    a === void 0 && (a = [1, 1]), o === void 0 && (o = "NHWC");
    var s = mr(e, "x", "dilation2d"), i = mr(t, "filter", "dilation2d");
    Dr(s.rank === 3 || s.rank === 4, function() {
      return "Error in dilation2d: input must be rank 3 or 4, but got rank " + (s.rank + ".");
    }), Dr(i.rank === 3, function() {
      return "Error in dilation2d: filter must be rank 3, but got rank " + (i.rank + ".");
    }), Dr(o === "NHWC", function() {
      return "Error in dilation2d: Only NHWC is currently supported, " + ("but got dataFormat of " + o);
    });
    var l = s, u2 = false;
    s.rank === 3 && (l = ga(s, [1, s.shape[0], s.shape[1], s.shape[2]]), u2 = true);
    var c = { x: l, filter: i }, f = { strides: r, pad: n, dilations: a }, h = Xr.runKernel(wR, c, f);
    return u2 ? ga(h, [h.shape[1], h.shape[2], h.shape[3]]) : h;
  }
  var vhe = Hr({ dilation2d_: dhe });
  function mhe(e, t) {
    var r, n = mr(e, "a", "equal", "string_or_numeric"), a = mr(t, "b", "equal", "string_or_numeric");
    r = hi(Bl(n, a), 2), n = r[0], a = r[1], ju(n.shape, a.shape);
    var o = { a: n, b: a };
    return Xr.runKernel(ER, o);
  }
  var xz = Hr({ equal_: mhe });
  function ghe(e, t, r) {
    var n = mr(t, "a", "where"), a = mr(r, "b", "where"), o = mr(e, "condition", "where", "bool"), s = ju(ju(o.shape, n.shape), a.shape), i = o3(o, s), l = o3(n, s), u2 = o3(a, s), c = { condition: i, t: l, e: u2 };
    return Xr.runKernel(z7, c);
  }
  var ry = Hr({ where_: ghe });
  function yhe(e) {
    var t = mr(e, "x", "zerosLike"), r = { x: t };
    return Xr.runKernel(m9, r);
  }
  var Eh = Hr({ zerosLike_: yhe });
  function xhe(e, t) {
    var r, n = mr(e, "a", "div"), a = mr(t, "b", "div");
    r = hi(Bl(n, a), 2), n = r[0], a = r[1];
    var o = cl(n, a), s = Eh(o), i = xz(a, s);
    return ry(i, s, o);
  }
  var bhe = Hr({ divNoNan_: xhe });
  function _he(e, t) {
    var r = mr(e, "t1", "dot"), n = mr(t, "t2", "dot");
    Dr((r.rank === 1 || r.rank === 2) && (n.rank === 1 || n.rank === 2), function() {
      return "Error in dot: inputs must all be rank 1 or 2, but got ranks " + (r.rank + " and " + n.rank + ".");
    });
    var a = r.rank === 1 ? r.size : r.shape[1], o = n.rank === 1 ? n.size : n.shape[0];
    if (Dr(a === o, function() {
      return "Error in dot: inner dimensions of inputs must match, but got " + (a + " and " + o + ".");
    }), r.rank === 1 && n.rank === 1) {
      var s = ga(r, [1, -1]), i = ga(n, [-1, 1]), l = gs(s, i);
      return ga(l, []);
    } else if (r.rank === 1 && n.rank === 2) {
      var s = ga(r, [1, -1]), i = ga(n, [n.shape[0], n.shape[1]]), l = gs(s, i);
      return ga(l, [l.size]);
    } else if (r.rank === 2 && n.rank === 1) {
      var i = ga(n, [-1, 1]), l = gs(r, i);
      return ga(l, [l.size]);
    } else {
      var i = ga(n, [n.shape[0], n.shape[1]]), l = gs(r, i);
      return l;
    }
  }
  var whe = Hr({ dot_: _he });
  function khe(e) {
    for (var t = [], r = 1; r < arguments.length; r++) t[r - 1] = arguments[r];
    var n = t.map(function(o, s) {
      return mr(o, "tensors" + s, "einsum");
    }), a = { equation: e };
    return Xr.runKernel(TR, n, a);
  }
  var The = Hr({ einsum_: khe });
  function Ahe(e) {
    var t = mr(e, "x", "elu", "float32"), r = { x: t };
    return Xr.runKernel(AR, r);
  }
  var bz = Hr({ elu_: Ahe });
  function She(e) {
    var t = mr(e, "x", "erf");
    Dr(t.dtype === "int32" || t.dtype === "float32", function() {
      return "Input dtype must be `int32` or `float32`.";
    }), t.dtype === "int32" && (t = iu(t, "float32"));
    var r = { x: t };
    return Xr.runKernel(SR, r);
  }
  var Ehe = Hr({ erf_: She });
  function Dhe(e) {
    var t = mr(e, "x", "exp"), r = { x: t };
    return Xr.runKernel(DR, r);
  }
  var Rm = Hr({ exp_: Dhe });
  function Che(e, t) {
    t === void 0 && (t = 0);
    var r = mr(e, "x", "expandDims", "string_or_numeric");
    Dr(t <= r.rank, function() {
      return "Axis must be <= rank of the tensor";
    });
    var n = { input: r }, a = { dim: t };
    return Xr.runKernel(CR, n, a);
  }
  var Sm = Hr({ expandDims_: Che });
  function Mhe(e) {
    var t = mr(e, "x", "expm1"), r = { x: t };
    return Xr.runKernel(MR, r);
  }
  var Ihe = Hr({ expm1_: Mhe });
  function Nhe(e, t) {
    var r = mr(e, "x", "tile", "string_or_numeric");
    Dr(r.rank === t.length, function() {
      return "Error in transpose: rank of input " + r.rank + " " + ("must match length of reps " + t + ".");
    });
    var n = { x: r }, a = { reps: t };
    return Xr.runKernel(O4, n, a);
  }
  var Mb = Hr({ tile_: Nhe });
  function Fhe(e, t, r, n) {
    n === void 0 && (n = "float32"), t == null && (t = e);
    for (var a = m0([e, t], n), o = e <= t ? e : t, s = 0; s < o; ++s) a.set(1, s, s);
    var i = ga(a.toTensor(), [e, t]);
    if (r == null) return i;
    if (r.length === 1) return Mb(Sm(i, 0), [r[0], 1, 1]);
    if (r.length === 2) return Mb(Sm(Sm(i, 0), 0), [r[0], r[1], 1, 1]);
    if (r.length === 3) return Mb(Sm(Sm(Sm(i, 0), 0), 0), [r[0], r[1], r[2], 1, 1]);
    throw new Error("eye() currently supports only 1D and 2D " + ("batchShapes, but received " + r.length + "D."));
  }
  var _z = Hr({ eye_: Fhe });
  function D3(e, t, r) {
    var n = { shape: e, value: t, dtype: r };
    return Xr.runKernel(NR, {}, n);
  }
  function Ohe(e) {
    var t = mr(e, "x", "floor", "float32"), r = { x: t };
    return Xr.runKernel(OR, r);
  }
  var wz = Hr({ floor_: Ohe });
  function Phe(e, t, r, n) {
    r === void 0 && (r = 0), n === void 0 && (n = 0);
    var a = mr(e, "x", "gather"), o = mr(t, "indices", "gather", "int32"), s = { x: a, indices: o }, i = { axis: r, batchDims: n };
    return Xr.runKernel(RR, s, i);
  }
  var kz = Hr({ gather_: Phe });
  function Lhe(e, t) {
    var r, n = mr(e, "a", "greater", "string_or_numeric"), a = mr(t, "b", "greater", "string_or_numeric");
    r = hi(Bl(n, a), 2), n = r[0], a = r[1], ju(n.shape, a.shape);
    var o = { a: n, b: a };
    return Xr.runKernel(BR, o);
  }
  var C3 = Hr({ greater_: Lhe });
  function Rhe(e, t) {
    var r, n = mr(e, "a", "greaterEqual", "string_or_numeric"), a = mr(t, "b", "greaterEqual", "string_or_numeric");
    r = hi(Bl(n, a), 2), n = r[0], a = r[1], ju(n.shape, a.shape);
    var o = { a: n, b: a };
    return Xr.runKernel(UR, o);
  }
  var Tz = Hr({ greaterEqual_: Rhe });
  function zhe(e) {
    var t = mr(e, "input", "imag"), r = { input: t };
    return Xr.runKernel(jR, r);
  }
  var Z4 = Hr({ imag_: zhe });
  function Bhe(e) {
    var t = mr(e, "x", "isFinite"), r = { x: t };
    return Xr.runKernel(WR, r);
  }
  var Uhe = Hr({ isFinite_: Bhe });
  function Vhe(e) {
    var t = mr(e, "x", "isInf"), r = { x: t };
    return Xr.runKernel(GR, r);
  }
  var jhe = Hr({ isInf_: Vhe });
  function Whe(e) {
    var t = mr(e, "x", "isNaN"), r = { x: t };
    return Xr.runKernel($R, r);
  }
  var Ghe = Hr({ isNaN_: Whe });
  function $he(e, t) {
    t === void 0 && (t = 0.2);
    var r = mr(e, "x", "leakyRelu"), n = { x: r }, a = { alpha: t };
    return Xr.runKernel(HR, n, a);
  }
  var Az = Hr({ leakyRelu_: $he });
  function Hhe(e, t) {
    var r, n = mr(e, "a", "less", "string_or_numeric"), a = mr(t, "b", "less", "string_or_numeric");
    r = hi(Bl(n, a), 2), n = r[0], a = r[1], ju(n.shape, a.shape);
    var o = { a: n, b: a };
    return Xr.runKernel(qR, o);
  }
  var qhe = Hr({ less_: Hhe });
  function Xhe(e, t) {
    var r, n = mr(e, "a", "lessEqual", "string_or_numeric"), a = mr(t, "b", "lessEqual", "string_or_numeric");
    r = hi(Bl(n, a), 2), n = r[0], a = r[1], ju(n.shape, a.shape);
    var o = { a: n, b: a };
    return Xr.runKernel(XR, o);
  }
  var J4 = Hr({ lessEqual_: Xhe });
  function Khe(e, t, r) {
    if (r <= 0) throw new Error("The number of values should be positive.");
    var n = { start: e, stop: t, num: r };
    return Xr.runKernel(KR, {}, n);
  }
  function Yhe(e, t, r, n, a) {
    t === void 0 && (t = 5), r === void 0 && (r = 1), n === void 0 && (n = 1), a === void 0 && (a = 0.5);
    var o = mr(e, "x", "localResponseNormalization");
    Dr(o.rank === 4 || o.rank === 3, function() {
      return `Error in localResponseNormalization: x must be rank 3 or 4 but got
               rank ` + o.rank + ".";
    }), Dr(Q1(t), function() {
      return "Error in localResponseNormalization: depthRadius must be an " + ("integer but got depthRadius " + t + ".");
    });
    var s = o, i = false;
    o.rank === 3 && (i = true, s = ga(o, [1, o.shape[0], o.shape[1], o.shape[2]]));
    var l = { x: s }, u2 = { depthRadius: t, bias: r, alpha: n, beta: a }, c = Xr.runKernel(t7, l, u2);
    return i ? ga(c, [c.shape[1], c.shape[2], c.shape[3]]) : c;
  }
  var Zhe = Hr({ localResponseNormalization_: Yhe });
  function Jhe(e) {
    var t = mr(e, "x", "log", "float32"), r = { x: t };
    return Xr.runKernel(YR, r);
  }
  var zb = Hr({ log_: Jhe });
  function Qhe(e) {
    var t = mr(e, "x", "log1p"), r = { x: t };
    return Xr.runKernel(ZR, r);
  }
  var Sz = Hr({ log1p_: Qhe });
  function epe(e) {
    return Dr(dv(e), function() {
      return "The f passed in grad(f) must be a function";
    }), function(t, r) {
      var n = mr(t, "x", "tf.grad", "string_or_numeric"), a = r != null ? mr(r, "dy", "tf.grad") : null;
      return Xr.tidy(function() {
        var o = Xr.gradients(function() {
          return e(n);
        }, [n], a), s = o.value, i = o.grads;
        return a != null && nf(s.shape, a.shape, "The shape of dy passed in grad(f)(x, dy) must match the shape returned by f(x)"), M3(i), i[0];
      });
    };
  }
  function tpe(e) {
    return Dr(dv(e), function() {
      return "The f passed in grads(f) must be a function";
    }), function(t, r) {
      Dr(Array.isArray(t), function() {
        return "The args passed in grads(f)(args) must be an array of `Tensor`s or `TensorLike`s";
      });
      var n = Lb(t, "args", "tf.grads", "string_or_numeric"), a = r != null ? mr(r, "dy", "tf.grads") : null;
      return Xr.tidy(function() {
        var o = Xr.gradients(function() {
          return e.apply(void 0, ys(n));
        }, n, a), s = o.value, i = o.grads;
        return a != null && nf(s.shape, a.shape, "The shape of dy passed in grads(f)([x1,...], dy) must match the shape returned by f([x1,...])"), M3(i), i;
      });
    };
  }
  function rpe(e) {
    return Dr(dv(e), function() {
      return "The f passed in valueAndGrad(f) must be a function";
    }), function(t, r) {
      Dr(t instanceof Du, function() {
        return "The x passed in valueAndGrad(f)(x) must be a tensor";
      }), Dr(r == null || r instanceof Du, function() {
        return "The dy passed in valueAndGrad(f)(x, dy) must be a tensor";
      });
      var n = Xr.gradients(function() {
        return e(t);
      }, [t], r), a = n.grads, o = n.value;
      return M3(a), { grad: a[0], value: o };
    };
  }
  function npe(e) {
    return Dr(dv(e), function() {
      return "The f passed in valueAndGrads(f) must be a function";
    }), function(t, r) {
      Dr(Array.isArray(t) && t.every(function(a) {
        return a instanceof Du;
      }), function() {
        return "The args passed in valueAndGrads(f)(args) must be array of tensors";
      }), Dr(r == null || r instanceof Du, function() {
        return "The dy passed in valueAndGrads(f)(args, dy) must be a tensor";
      });
      var n = Xr.gradients(function() {
        return e.apply(void 0, ys(t));
      }, t, r);
      return r != null && nf(n.value.shape, r.shape, "The shape of dy passed in valueAndGrads(f)([x1,...], dy) must match the shape returned by f([x1,...])"), M3(n.grads), n;
    };
  }
  function Ez(e, t) {
    Dr(dv(e), function() {
      return "The f passed in variableGrads(f) must be a function";
    }), Dr(t == null || Array.isArray(t) && t.every(function(f) {
      return f instanceof Pb;
    }), function() {
      return "The varList passed in variableGrads(f, varList) must be an array of variables";
    });
    var r = t != null;
    if (!r) {
      t = [];
      for (var n in Xr.registeredVariables) t.push(Xr.registeredVariables[n]);
    }
    var a = r ? t.filter(function(f) {
      return !f.trainable;
    }) : null, o = t.length;
    t = t.filter(function(f) {
      return f.trainable;
    }), Dr(t.length > 0, function() {
      return "variableGrads() expects at least one of the input variables to " + ("be trainable, but none of the " + o + " variables is ") + "trainable.";
    });
    var s = true, i = Xr.gradients(e, t, null, s), l = i.value, u2 = i.grads;
    Dr(u2.some(function(f) {
      return f != null;
    }), function() {
      return "Cannot find a connection between any variable and the result of the loss function y=f(x). Please make sure the operations that use variables are inside the function f passed to minimize().";
    }), Dr(l.rank === 0, function() {
      return "The f passed in variableGrads(f) must return a scalar, but it " + ("returned a rank-" + l.rank + " tensor");
    });
    var c = {};
    return t.forEach(function(f, h) {
      u2[h] != null && (c[f.name] = u2[h]);
    }), a?.forEach(function(f) {
      return c[f.name] = null;
    }), { value: l, grads: c };
  }
  function zd(e) {
    return Xr.customGrad(e);
  }
  function M3(e) {
    var t = e.filter(function(r) {
      return r == null;
    }).length;
    if (t > 0) throw new Error(`Cannot compute gradient of y=f(x) with respect to x. Make sure that
    the f you passed encloses all operations that lead from x to y.`);
  }
  function ape(e) {
    var t = mr(e, "x", "neg"), r = { x: t };
    return Xr.runKernel(d7, r);
  }
  var pv = Hr({ neg_: ape });
  function ipe(e) {
    var t = mr(e, "x", "softplus"), r = { x: t };
    return Xr.runKernel($7, r);
  }
  var Dz = Hr({ softplus_: ipe });
  function ope(e) {
    var t = mr(e, "x", "logSigmoid"), r = zd(function(n) {
      var a = pv(Dz(pv(n))), o = function(s) {
        var i = Xa(s, Z1(pv(n)));
        return i;
      };
      return { value: a, gradFunc: o };
    });
    return r(t);
  }
  var spe = Hr({ logSigmoid_: ope });
  function lpe(e, t, r) {
    t === void 0 && (t = null), r === void 0 && (r = false);
    var n = mr(e, "x", "max"), a = { x: n }, o = { reductionIndices: t, keepDims: r };
    return Xr.runKernel(r7, a, o);
  }
  var J1 = Hr({ max_: lpe });
  function upe(e, t) {
    var r, n = mr(e, "a", "sub"), a = mr(t, "b", "sub");
    r = hi(Bl(n, a), 2), n = r[0], a = r[1];
    var o = { a: n, b: a };
    return Xr.runKernel(s9, o);
  }
  var Ao = Hr({ sub_: upe });
  function cpe(e, t, r) {
    t === void 0 && (t = null), r === void 0 && (r = false);
    var n = mr(e, "x", "sum");
    n.dtype === "bool" && (n = iu(n, "int32"));
    var a = { x: n }, o = { axis: t, keepDims: r };
    return Xr.runKernel(q7, a, o);
  }
  var ul = Hr({ sum_: cpe });
  function fpe(e, t) {
    t === void 0 && (t = -1);
    var r = mr(e, "logits", "logSoftmax");
    if (t === -1 && (t = r.rank - 1), t !== r.rank - 1) throw Error("Log Softmax along a non-last dimension is not yet supported. " + ("Logits was rank " + r.rank + " and axis was " + t));
    var n = zd(function(a, o) {
      var s = true, i = J1(a, t, true), l = Ao(a, i), u2 = Ao(iu(l, "float32"), zb(ul(Rm(l), t, s)));
      o([u2]);
      var c = function(f, h) {
        var p = hi(h, 1), d = p[0], v = true, m = Rm(d);
        return Ao(f, Xa(ul(f, t, v), m));
      };
      return { value: u2, gradFunc: c };
    });
    return n(r);
  }
  var hpe = Hr({ logSoftmax_: fpe });
  function Q4(e, t) {
    for (var r = 0; r < e.length; ++r) if (e[e.length - r - 1] !== t - 1 - r) return false;
    return true;
  }
  function Cz(e, t, r) {
    for (var n = e.length + t.length, a = [], o = 0, s = 0, i = 0; i < n; i++) r.indexOf(i) === -1 ? a.push(e[o++]) : a.push(t[s++]);
    return a;
  }
  function ppe(e, t) {
    for (var r = [], n = e.length, a = 0; a < n; a++) t.indexOf(a) === -1 && r.push(e[a]);
    var o = t.map(function(s) {
      return e[s];
    });
    return [r, o];
  }
  function Xb(e, t) {
    var r = t.map(function(n) {
      return 1;
    });
    return Cz(e, r, t);
  }
  function dpe(e, t, r) {
    Dr(Q4(t, r), function() {
      return e + " supports only inner-most axes for now. " + ("Got axes " + t + " and rank-" + r + " input.");
    });
  }
  function vpe(e, t) {
    if (Q4(e, t)) return null;
    for (var r = [], n = 0; n < t; ++n) e.indexOf(n) === -1 && r.push(n);
    return e.forEach(function(a) {
      return r.push(a);
    }), r;
  }
  function mpe(e) {
    return e.map(function(t, r) {
      return [r, t];
    }).sort(function(t, r) {
      return t[1] - r[1];
    }).map(function(t) {
      return t[0];
    });
  }
  function gpe(e, t) {
    for (var r = [], n = t - e; n < t; ++n) r.push(n);
    return r;
  }
  function ype(e, t, r) {
    t === void 0 && (t = null), r === void 0 && (r = false);
    var n = mr(e, "x", "logSumExp"), a = Wb(t, n.shape), o = J1(n, a, true), s = Ao(n, o), i = Rm(s), l = ul(i, a), u2 = zb(l), c = Hi(ga(o, u2.shape), u2);
    if (r) {
      var f = Xb(c.shape, a);
      return ga(c, f);
    }
    return c;
  }
  var Mz = Hr({ logSumExp_: ype });
  function xpe(e, t) {
    var r = mr(e, "a", "logicalAnd", "bool"), n = mr(t, "b", "logicalAnd", "bool");
    ju(r.shape, n.shape);
    var a = { a: r, b: n };
    return Xr.runKernel(JR, a);
  }
  var y3 = Hr({ logicalAnd_: xpe });
  function bpe(e) {
    var t = mr(e, "x", "logicalNot", "bool"), r = { x: t };
    return Xr.runKernel(QR, r);
  }
  var Iz = Hr({ logicalNot_: bpe });
  function _pe(e, t) {
    var r = mr(e, "a", "logicalOr", "bool"), n = mr(t, "b", "logicalOr", "bool");
    ju(r.shape, n.shape);
    var a = { a: r, b: n };
    return Xr.runKernel(e7, a);
  }
  var Nz = Hr({ logicalOr_: _pe });
  function wpe(e, t) {
    var r = mr(e, "a", "logicalXor", "bool"), n = mr(t, "b", "logicalXor", "bool");
    return ju(r.shape, n.shape), y3(Nz(e, t), Iz(y3(e, t)));
  }
  var kpe = Hr({ logicalXor_: wpe });
  function Tpe(e, t, r, n, a) {
    var o = mr(e, "x", "maxPool"), s = 1, i = o, l = false;
    o.rank === 3 && (l = true, i = ga(o, [1, o.shape[0], o.shape[1], o.shape[2]])), Dr(i.rank === 4, function() {
      return "Error in maxPool: input must be rank 4 but got rank " + i.rank + ".";
    }), Dr(x0(r, s), function() {
      return "Error in maxPool: Either strides or dilations must be 1. " + ("Got strides " + r + " and dilations '" + s + "'");
    }), rp("maxPool", n, a);
    var u2 = { x: i }, c = { filterSize: t, strides: r, pad: n, dimRoundingMode: a }, f = Xr.runKernel(a7, u2, c);
    return l ? ga(f, [f.shape[1], f.shape[2], f.shape[3]]) : f;
  }
  var Fz = Hr({ maxPool_: Tpe });
  function Ape(e, t, r, n, a, o) {
    t === void 0 && (t = [1, 1, 1]), o === void 0 && (o = "NDHWC");
    var s = mr(e, "x", "maxPool3d"), i = s, l = false;
    s.rank === 4 && (l = true, i = ga(s, [1, s.shape[0], s.shape[1], s.shape[2], s.shape[3]])), Dr(i.rank === 5, function() {
      return "Error in maxPool3d: x must be rank 5 but got rank " + i.rank + ".";
    }), Dr(o === "NDHWC", function() {
      return "Error in maxPool3d: Only NDHWC is currently supported, " + ("but got dataFormat of " + o);
    }), rp("maxPool3d", n, a);
    var u2 = { x: i }, c = { filterSize: t, strides: r, pad: n, dimRoundingMode: a, dataFormat: o }, f = Xr.runKernel(i7, u2, c);
    return l ? ga(f, [f.shape[1], f.shape[2], f.shape[3], f.shape[4]]) : f;
  }
  var Spe = Hr({ maxPool3d_: Ape });
  function Epe(e, t, r, n, a) {
    a === void 0 && (a = false);
    var o = mr(e, "x", "maxPoolWithArgmax"), s = { x: o }, i = { filterSize: t, strides: r, pad: n, includeBatchInIndex: a }, l = Xr.runKernel(o7, s, i);
    return { result: l[0], indexes: l[1] };
  }
  var Dpe = Hr({ maxPoolWithArgmax_: Epe });
  function Cpe(e, t) {
    var r, n = mr(e, "a", "maximum"), a = mr(t, "b", "maximum");
    r = hi(Bl(n, a), 2), n = r[0], a = r[1], n.dtype === "bool" && (n = iu(n, "int32"), a = iu(a, "int32")), ju(n.shape, a.shape);
    var o = { a: n, b: a };
    return Xr.runKernel(n7, o);
  }
  var Oz = Hr({ maximum_: Cpe });
  function Mpe(e, t, r) {
    t === void 0 && (t = null), r === void 0 && (r = false);
    var n = mr(e, "x", "mean"), a = { x: n }, o = { axis: t, keepDims: r };
    return Xr.runKernel(s7, a, o);
  }
  var x3 = Hr({ mean_: Mpe });
  function ny(e, t) {
    if (t === void 0 && (t = "float32"), t === "complex64") {
      var r = ny(e, "float32"), n = ny(e, "float32");
      return Om(r, n);
    }
    var a = k3(Ml(e), t);
    return Xr.makeTensor(a, e, t);
  }
  function Mm(e, t) {
    if (t === void 0 && (t = "float32"), t === "complex64") {
      var r = Mm(e, "float32"), n = ny(e, "float32");
      return Om(r, n);
    }
    var a = E4(Ml(e), t);
    return Xr.makeTensor(a, e, t);
  }
  function Ipe(e, t, r) {
    var n = (r === void 0 ? {} : r).indexing, a = n === void 0 ? "xy" : n;
    if (a !== "xy" && a !== "ij") throw new TypeError(a + " is not a valid third argument to meshgrid");
    if (e === void 0) return [];
    var o = mr(e, "x", "meshgrid", e instanceof Du ? e.dtype : "float32");
    if (t === void 0) return [o];
    var s = mr(t, "y", "meshgrid", t instanceof Du ? t.dtype : "float32"), i = Ml(o.shape), l = Ml(s.shape);
    return a === "xy" ? (o = ga(o, [1, -1]), s = ga(s, [-1, 1]), [gs(Mm([l, 1], o.dtype), o), gs(s, Mm([1, i], s.dtype))]) : (o = ga(o, [-1, 1]), s = ga(s, [1, -1]), [gs(o, Mm([1, l], o.dtype)), gs(Mm([i, 1], s.dtype), s)]);
  }
  function Npe(e, t, r) {
    t === void 0 && (t = null), r === void 0 && (r = false);
    var n = mr(e, "x", "min"), a = { x: n }, o = { axis: t, keepDims: r };
    return Xr.runKernel(l7, a, o);
  }
  var S4 = Hr({ min_: Npe });
  function Fpe(e, t) {
    var r, n = mr(e, "a", "minimum"), a = mr(t, "b", "minimum");
    r = hi(Bl(n, a), 2), n = r[0], a = r[1], n.dtype === "bool" && (n = iu(n, "int32"), a = iu(a, "int32")), ju(n.shape, a.shape);
    var o = { a: n, b: a };
    return Xr.runKernel(u7, o);
  }
  var Pz = Hr({ minimum_: Fpe });
  function Ope(e, t, r) {
    Dr(r === "reflect" || r === "symmetric", function() {
      return "Invalid mode. Mode must be either reflect or symmetric. " + ("Got " + r + ".");
    });
    var n = mr(e, "x", "mirrorPad");
    if (n.rank === 0) throw new Error("mirrorPad(scalar) is not defined. Pass non-scalar to mirrorPad");
    Dr(t.length === n.rank, function() {
      return "Padding doesn't match input. Must be " + n.rank + ". " + ("Got " + t.length + ".");
    });
    for (var a = r === "reflect" ? 1 : 0, o = function(u2) {
      Dr(t[u2].length === 2, function() {
        return "Invalid number of paddings. Must be length of 2 each.";
      }), Dr(t[u2][0] >= 0 && t[u2][0] <= n.shape[u2] - a && t[u2][1] >= 0 && t[u2][1] <= n.shape[u2] - a, function() {
        return "Padding in dimension " + u2 + " cannot be greater than or equal " + ("to " + (n.shape[u2] - a) + " or less than 0 for input of ") + ("shape " + n.shape);
      });
    }, s = 0; s < n.rank; s++) o(s);
    var i = { paddings: t, mode: r }, l = { x: n };
    return Xr.runKernel(c7, l, i);
  }
  var Ppe = Hr({ mirrorPad_: Ope });
  function Lpe(e, t) {
    var r, n = mr(e, "a", "mod"), a = mr(t, "b", "mod");
    r = hi(Bl(n, a), 2), n = r[0], a = r[1];
    var o = { a: n, b: a };
    return Xr.runKernel(f7, o);
  }
  var Rpe = Hr({ mod_: Lpe });
  function zpe(e) {
    var t = mr(e, "x", "square"), r = {};
    return Xr.runKernel("Square", { x: t }, r);
  }
  var Yp = Hr({ square_: zpe });
  function Bpe(e, t, r) {
    t === void 0 && (t = null), r === void 0 && (r = false), e = mr(e, "x", "moments");
    var n = Wb(t, e.shape), a = x3(e, n, r), o = a.shape;
    r || (o = Xb(a.shape, n));
    var s = Yp(Ao(iu(e, "float32"), ga(a, o))), i = x3(s, n, r);
    return { mean: a, variance: i };
  }
  var Upe = Hr({ moments_: Bpe });
  function Vpe(e, t, r, n) {
    for (var a = mr(t, "data", "multiRNNCell"), o = Lb(r, "c", "multiRNNCell"), s = Lb(n, "h", "multiRNNCell"), i = a, l = [], u2 = 0; u2 < e.length; u2++) {
      var c = e[u2](i, o[u2], s[u2]);
      l.push(c[0]), l.push(c[1]), i = c[1];
    }
    for (var f = [], h = [], u2 = 0; u2 < l.length; u2 += 2) f.push(l[u2]), h.push(l[u2 + 1]);
    return [f, h];
  }
  var jpe = Hr({ multiRNNCell_: Vpe });
  function Wpe(e, t, r, n) {
    n === void 0 && (n = false);
    var a = mr(e, "logits", "multinomial"), o = a.size, s = a.rank;
    if (o < 2) throw new Error("Error in multinomial: you need at least 2 outcomes, but got " + (o + "."));
    if (s > 2) throw new Error("Rank of probabilities must be 1 or 2, but is " + s);
    r = r || Math.random();
    var i = s === 1 ? ga(a, [1, -1]) : a, l = { logits: i }, u2 = { numSamples: t, seed: r, normalized: n }, c = Xr.runKernel(h7, l, u2);
    return s === 1 ? ga(c, [c.size]) : c;
  }
  var Gpe = Hr({ multinomial_: Wpe });
  function $pe(e, t) {
    var r, n = mr(e, "a", "notEqual", "string_or_numeric"), a = mr(t, "b", "notEqual", "string_or_numeric");
    r = hi(Bl(n, a), 2), n = r[0], a = r[1], ju(n.shape, a.shape);
    var o = { a: n, b: a };
    return Xr.runKernel(v7, o);
  }
  var Lz = Hr({ notEqual_: $pe });
  function Hpe(e) {
    var t = mr(e, "x", "onesLike"), r = { x: t };
    return Xr.runKernel(x7, r);
  }
  var qpe = Hr({ onesLike_: Hpe });
  function Xpe(e, t) {
    var r = mr(e, "v1", "outerProduct"), n = mr(t, "v2", "outerProduct");
    Dr(r.rank === 1 && n.rank === 1, function() {
      return "Error in outerProduct: inputs must be rank 1, but got ranks " + (r.rank + " and " + n.rank + ".");
    });
    var a = ga(r, [-1, 1]), o = ga(n, [1, -1]);
    return gs(a, o);
  }
  var Kpe = Hr({ outerProduct_: Xpe });
  function Ype(e, t, r) {
    r === void 0 && (r = 0);
    var n = mr(e, "x", "pad");
    if (n.rank === 0) throw new Error("pad(scalar) is not defined. Pass non-scalar to pad");
    var a = { paddings: t, constantValue: r }, o = { x: n };
    return Xr.runKernel(w7, o, a);
  }
  var Kb = Hr({ pad_: Ype });
  function Zpe(e, t, r) {
    return r === void 0 && (r = 0), Dr(t.length === 2, function() {
      return "Invalid number of paddings. Must be length of 2.";
    }), Kb(e, [t], r);
  }
  var Jpe = Hr({ pad1d_: Zpe });
  function Qpe(e, t, r) {
    return r === void 0 && (r = 0), Dr(t.length === 2 && t[0].length === 2 && t[1].length === 2, function() {
      return "Invalid number of paddings. Must be length of 2 each.";
    }), Kb(e, t, r);
  }
  var ede = Hr({ pad2d_: Qpe });
  function tde(e, t, r) {
    return r === void 0 && (r = 0), Dr(t.length === 3 && t[0].length === 2 && t[1].length === 2 && t[2].length === 2, function() {
      return "Invalid number of paddings. Must be length of 2 each.";
    }), Kb(e, t, r);
  }
  var rde = Hr({ pad3d_: tde });
  function nde(e, t, r) {
    return r === void 0 && (r = 0), Dr(t.length === 4 && t[0].length === 2 && t[1].length === 2 && t[2].length === 2 && t[3].length === 2, function() {
      return "Invalid number of paddings. Must be length of 2 each.";
    }), Kb(e, t, r);
  }
  var ade = Hr({ pad4d_: nde });
  function ide(e, t, r) {
    var n = mr(e, "x", "spaceToBatchND");
    Dr(n.rank >= 1 + t.length, function() {
      return "input rank " + n.rank + " should be > than [blockShape] " + t.length;
    }), Dr(r.length === t.length, function() {
      return "paddings.shape[0] " + r.length + " must be equal to [blockShape] " + t.length;
    }), Dr(n.shape.reduce(function(s, i, l) {
      return l > 0 && l <= t.length ? s && (i + r[l - 1][0] + r[l - 1][1]) % t[l - 1] === 0 : s;
    }, true), function() {
      return "input spatial dimensions " + n.shape.slice(1) + " with paddings " + r.toString() + " must be divisible by blockShapes " + t.toString();
    });
    var a = { x: n }, o = { blockShape: t, paddings: r };
    return Xr.runKernel(X7, a, o);
  }
  var Rz = Hr({ spaceToBatchND_: ide });
  function ode(e, t, r, n, a, o, s) {
    a == null && (a = [1, 1]), o == null && (o = 1), n === 0 && (n = "valid");
    var i = mr(e, "x", "maxPool"), l = i, u2 = false;
    i.rank === 3 && (u2 = true, l = ga(i, [1, i.shape[0], i.shape[1], i.shape[2]])), Dr(x0(o, a), function() {
      return "Error in pool: Either strides or dilations must be 1. " + ("Got strides " + o + " and dilations '" + a + "'");
    });
    var c = hz(l.shape, t, o, a, n), f = [c.dilationHeight, c.dilationWidth], h;
    n === "same" ? h = lde([c.filterHeight, c.filterWidth], f) : h = [[0, 0], [0, 0]];
    var p = f[0] === 1 && f[1] === 1, d = hi(sde([c.inHeight, c.inWidth], f, h), 2), v = d[0], m = d[1], g = p ? n : "valid", x = p ? l : Rz(l, f, v), b = r === "avg" ? function() {
      return vz(x, t, o, g, s);
    } : function() {
      return Fz(x, t, o, g, s);
    }, y = b(), w = p ? y : mz(y, f, m);
    return u2 ? ga(w, [w.shape[1], w.shape[2], w.shape[3]]) : w;
  }
  function sde(e, t, r) {
    var n = r.map(function(c) {
      return c[0];
    }), a = r.map(function(c) {
      return c[1];
    }), o = e.concat(n, a), s = t.map(function(c, f) {
      return (c - o[f] % c) % c;
    }), i = a.map(function(c, f) {
      return c + s[f];
    }), l = t.map(function(c, f) {
      return [n[f], i[f]];
    }), u2 = t.map(function(c, f) {
      return [0, s[f]];
    });
    return [l, u2];
  }
  function lde(e, t) {
    var r = e.map(function(s, i) {
      return s + (s - 1) * (t[i] - 1);
    }), n = r.map(function(s) {
      return s - 1;
    }), a = n.map(function(s) {
      return Math.floor(s / 2);
    }), o = n.map(function(s, i) {
      return s - a[i];
    });
    return n.map(function(s, i) {
      return [a[i], o[i]];
    });
  }
  var ude = Hr({ pool_: ode });
  function cde(e, t) {
    var r, n = mr(e, "base", "pow"), a = mr(t, "exp", "pow");
    r = hi(Bl(n, a), 2), n = r[0], a = r[1];
    var o = { a: n, b: a };
    return Xr.runKernel(k7, o);
  }
  var Bb = Hr({ pow_: cde });
  function fde(e, t) {
    var r = mr(e, "x", "prelu"), n = mr(t, "alpha", "prelu"), a = { x: r, alpha: n };
    return Xr.runKernel(T7, a);
  }
  var zz = Hr({ prelu_: fde });
  function hde(e, t, r) {
    t === void 0 && (t = null), r === void 0 && (r = false);
    var n = mr(e, "x", "prod");
    n.dtype === "bool" && (n = iu(n, "int32"));
    var a = { x: n }, o = { axis: t, keepDims: r };
    return Xr.runKernel(A7, a, o);
  }
  var pde = Hr({ prod_: hde });
  function dde(e, t, r) {
    var n = Ml(e), a = null;
    if (r == null || r === "float32") a = new Float32Array(n);
    else if (r === "int32") a = new Int32Array(n);
    else if (r === "bool") a = new Uint8Array(n);
    else throw new Error("Unknown data type " + r);
    for (var o = 0; o < n; o++) a[o] = t();
    return Xr.makeTensor(a, e, r);
  }
  var vde = Hr({ rand_: dde }), Vm = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
  function jm(e) {
    var t = { exports: {} };
    return e(t, t.exports), t.exports;
  }
  var mde = jm(function(e) {
    (function(t, r, n) {
      function a(l) {
        var u2 = this, c = i();
        u2.next = function() {
          var f = 2091639 * u2.s0 + u2.c * 23283064365386963e-26;
          return u2.s0 = u2.s1, u2.s1 = u2.s2, u2.s2 = f - (u2.c = f | 0);
        }, u2.c = 1, u2.s0 = c(" "), u2.s1 = c(" "), u2.s2 = c(" "), u2.s0 -= c(l), u2.s0 < 0 && (u2.s0 += 1), u2.s1 -= c(l), u2.s1 < 0 && (u2.s1 += 1), u2.s2 -= c(l), u2.s2 < 0 && (u2.s2 += 1), c = null;
      }
      function o(l, u2) {
        return u2.c = l.c, u2.s0 = l.s0, u2.s1 = l.s1, u2.s2 = l.s2, u2;
      }
      function s(l, u2) {
        var c = new a(l), f = u2 && u2.state, h = c.next;
        return h.int32 = function() {
          return c.next() * 4294967296 | 0;
        }, h.double = function() {
          return h() + (h() * 2097152 | 0) * 11102230246251565e-32;
        }, h.quick = h, f && (typeof f == "object" && o(f, c), h.state = function() {
          return o(c, {});
        }), h;
      }
      function i() {
        var l = 4022871197, u2 = function(c) {
          c = String(c);
          for (var f = 0; f < c.length; f++) {
            l += c.charCodeAt(f);
            var h = 0.02519603282416938 * l;
            l = h >>> 0, h -= l, h *= l, l = h >>> 0, h -= l, l += h * 4294967296;
          }
          return (l >>> 0) * 23283064365386963e-26;
        };
        return u2;
      }
      r && r.exports ? r.exports = s : n && n.amd ? n(function() {
        return s;
      }) : this.alea = s;
    })(Vm, e, false);
  }), gde = jm(function(e) {
    (function(t, r, n) {
      function a(i) {
        var l = this, u2 = "";
        l.x = 0, l.y = 0, l.z = 0, l.w = 0, l.next = function() {
          var f = l.x ^ l.x << 11;
          return l.x = l.y, l.y = l.z, l.z = l.w, l.w ^= l.w >>> 19 ^ f ^ f >>> 8;
        }, i === (i | 0) ? l.x = i : u2 += i;
        for (var c = 0; c < u2.length + 64; c++) l.x ^= u2.charCodeAt(c) | 0, l.next();
      }
      function o(i, l) {
        return l.x = i.x, l.y = i.y, l.z = i.z, l.w = i.w, l;
      }
      function s(i, l) {
        var u2 = new a(i), c = l && l.state, f = function() {
          return (u2.next() >>> 0) / 4294967296;
        };
        return f.double = function() {
          do
            var h = u2.next() >>> 11, p = (u2.next() >>> 0) / 4294967296, d = (h + p) / (1 << 21);
          while (d === 0);
          return d;
        }, f.int32 = u2.next, f.quick = f, c && (typeof c == "object" && o(c, u2), f.state = function() {
          return o(u2, {});
        }), f;
      }
      r && r.exports ? r.exports = s : n && n.amd ? n(function() {
        return s;
      }) : this.xor128 = s;
    })(Vm, e, false);
  }), yde = jm(function(e) {
    (function(t, r, n) {
      function a(i) {
        var l = this, u2 = "";
        l.next = function() {
          var f = l.x ^ l.x >>> 2;
          return l.x = l.y, l.y = l.z, l.z = l.w, l.w = l.v, (l.d = l.d + 362437 | 0) + (l.v = l.v ^ l.v << 4 ^ (f ^ f << 1)) | 0;
        }, l.x = 0, l.y = 0, l.z = 0, l.w = 0, l.v = 0, i === (i | 0) ? l.x = i : u2 += i;
        for (var c = 0; c < u2.length + 64; c++) l.x ^= u2.charCodeAt(c) | 0, c == u2.length && (l.d = l.x << 10 ^ l.x >>> 4), l.next();
      }
      function o(i, l) {
        return l.x = i.x, l.y = i.y, l.z = i.z, l.w = i.w, l.v = i.v, l.d = i.d, l;
      }
      function s(i, l) {
        var u2 = new a(i), c = l && l.state, f = function() {
          return (u2.next() >>> 0) / 4294967296;
        };
        return f.double = function() {
          do
            var h = u2.next() >>> 11, p = (u2.next() >>> 0) / 4294967296, d = (h + p) / (1 << 21);
          while (d === 0);
          return d;
        }, f.int32 = u2.next, f.quick = f, c && (typeof c == "object" && o(c, u2), f.state = function() {
          return o(u2, {});
        }), f;
      }
      r && r.exports ? r.exports = s : n && n.amd ? n(function() {
        return s;
      }) : this.xorwow = s;
    })(Vm, e, false);
  }), xde = jm(function(e) {
    (function(t, r, n) {
      function a(i) {
        var l = this;
        l.next = function() {
          var c = l.x, f = l.i, h, p;
          return h = c[f], h ^= h >>> 7, p = h ^ h << 24, h = c[f + 1 & 7], p ^= h ^ h >>> 10, h = c[f + 3 & 7], p ^= h ^ h >>> 3, h = c[f + 4 & 7], p ^= h ^ h << 7, h = c[f + 7 & 7], h = h ^ h << 13, p ^= h ^ h << 9, c[f] = p, l.i = f + 1 & 7, p;
        };
        function u2(c, f) {
          var h, p = [];
          if (f === (f | 0)) p[0] = f;
          else for (f = "" + f, h = 0; h < f.length; ++h) p[h & 7] = p[h & 7] << 15 ^ f.charCodeAt(h) + p[h + 1 & 7] << 13;
          for (; p.length < 8; ) p.push(0);
          for (h = 0; h < 8 && p[h] === 0; ++h) ;
          for (h == 8 && (p[7] = -1), c.x = p, c.i = 0, h = 256; h > 0; --h) c.next();
        }
        u2(l, i);
      }
      function o(i, l) {
        return l.x = i.x.slice(), l.i = i.i, l;
      }
      function s(i, l) {
        i == null && (i = +/* @__PURE__ */ new Date());
        var u2 = new a(i), c = l && l.state, f = function() {
          return (u2.next() >>> 0) / 4294967296;
        };
        return f.double = function() {
          do
            var h = u2.next() >>> 11, p = (u2.next() >>> 0) / 4294967296, d = (h + p) / (1 << 21);
          while (d === 0);
          return d;
        }, f.int32 = u2.next, f.quick = f, c && (c.x && o(c, u2), f.state = function() {
          return o(u2, {});
        }), f;
      }
      r && r.exports ? r.exports = s : n && n.amd ? n(function() {
        return s;
      }) : this.xorshift7 = s;
    })(Vm, e, false);
  }), bde = jm(function(e) {
    (function(t, r, n) {
      function a(i) {
        var l = this;
        l.next = function() {
          var c = l.w, f = l.X, h = l.i, p, d;
          return l.w = c = c + 1640531527 | 0, d = f[h + 34 & 127], p = f[h = h + 1 & 127], d ^= d << 13, p ^= p << 17, d ^= d >>> 15, p ^= p >>> 12, d = f[h] = d ^ p, l.i = h, d + (c ^ c >>> 16) | 0;
        };
        function u2(c, f) {
          var h, p, d, v, m, g = [], x = 128;
          for (f === (f | 0) ? (p = f, f = null) : (f = f + "\0", p = 0, x = Math.max(x, f.length)), d = 0, v = -32; v < x; ++v) f && (p ^= f.charCodeAt((v + 32) % f.length)), v === 0 && (m = p), p ^= p << 10, p ^= p >>> 15, p ^= p << 4, p ^= p >>> 13, v >= 0 && (m = m + 1640531527 | 0, h = g[v & 127] ^= p + m, d = h == 0 ? d + 1 : 0);
          for (d >= 128 && (g[(f && f.length || 0) & 127] = -1), d = 127, v = 4 * 128; v > 0; --v) p = g[d + 34 & 127], h = g[d = d + 1 & 127], p ^= p << 13, h ^= h << 17, p ^= p >>> 15, h ^= h >>> 12, g[d] = p ^ h;
          c.w = m, c.X = g, c.i = d;
        }
        u2(l, i);
      }
      function o(i, l) {
        return l.i = i.i, l.w = i.w, l.X = i.X.slice(), l;
      }
      function s(i, l) {
        i == null && (i = +/* @__PURE__ */ new Date());
        var u2 = new a(i), c = l && l.state, f = function() {
          return (u2.next() >>> 0) / 4294967296;
        };
        return f.double = function() {
          do
            var h = u2.next() >>> 11, p = (u2.next() >>> 0) / 4294967296, d = (h + p) / (1 << 21);
          while (d === 0);
          return d;
        }, f.int32 = u2.next, f.quick = f, c && (c.X && o(c, u2), f.state = function() {
          return o(u2, {});
        }), f;
      }
      r && r.exports ? r.exports = s : n && n.amd ? n(function() {
        return s;
      }) : this.xor4096 = s;
    })(Vm, e, false);
  }), _de = jm(function(e) {
    (function(t, r, n) {
      function a(i) {
        var l = this, u2 = "";
        l.next = function() {
          var f = l.b, h = l.c, p = l.d, d = l.a;
          return f = f << 25 ^ f >>> 7 ^ h, h = h - p | 0, p = p << 24 ^ p >>> 8 ^ d, d = d - f | 0, l.b = f = f << 20 ^ f >>> 12 ^ h, l.c = h = h - p | 0, l.d = p << 16 ^ h >>> 16 ^ d, l.a = d - f | 0;
        }, l.a = 0, l.b = 0, l.c = -1640531527, l.d = 1367130551, i === Math.floor(i) ? (l.a = i / 4294967296 | 0, l.b = i | 0) : u2 += i;
        for (var c = 0; c < u2.length + 20; c++) l.b ^= u2.charCodeAt(c) | 0, l.next();
      }
      function o(i, l) {
        return l.a = i.a, l.b = i.b, l.c = i.c, l.d = i.d, l;
      }
      function s(i, l) {
        var u2 = new a(i), c = l && l.state, f = function() {
          return (u2.next() >>> 0) / 4294967296;
        };
        return f.double = function() {
          do
            var h = u2.next() >>> 11, p = (u2.next() >>> 0) / 4294967296, d = (h + p) / (1 << 21);
          while (d === 0);
          return d;
        }, f.int32 = u2.next, f.quick = f, c && (typeof c == "object" && o(c, u2), f.state = function() {
          return o(u2, {});
        }), f;
      }
      r && r.exports ? r.exports = s : n && n.amd ? n(function() {
        return s;
      }) : this.tychei = s;
    })(Vm, e, false);
  }), Wm = jm(function(e) {
    (function(t, r, n) {
      var a = 256, o = 6, s = 52, i = "random", l = n.pow(a, o), u2 = n.pow(2, s), c = u2 * 2, f = a - 1, h;
      function p(y, w, _5) {
        var k = [];
        w = w == true ? { entropy: true } : w || {};
        var T2 = g(m(w.entropy ? [y, b(r)] : y ?? x(), 3), k), A2 = new d(k), S2 = function() {
          for (var C2 = A2.g(o), E2 = l, F13 = 0; C2 < u2; ) C2 = (C2 + F13) * a, E2 *= a, F13 = A2.g(1);
          for (; C2 >= c; ) C2 /= 2, E2 /= 2, F13 >>>= 1;
          return (C2 + F13) / E2;
        };
        return S2.int32 = function() {
          return A2.g(4) | 0;
        }, S2.quick = function() {
          return A2.g(4) / 4294967296;
        }, S2.double = S2, g(b(A2.S), r), (w.pass || _5 || function(C2, E2, F13, N2) {
          return N2 && (N2.S && v(N2, A2), C2.state = function() {
            return v(A2, {});
          }), F13 ? (n[i] = C2, E2) : C2;
        })(S2, T2, "global" in w ? w.global : this == n, w.state);
      }
      function d(y) {
        var w, _5 = y.length, k = this, T2 = 0, A2 = k.i = k.j = 0, S2 = k.S = [];
        for (_5 || (y = [_5++]); T2 < a; ) S2[T2] = T2++;
        for (T2 = 0; T2 < a; T2++) S2[T2] = S2[A2 = f & A2 + y[T2 % _5] + (w = S2[T2])], S2[A2] = w;
        (k.g = function(C2) {
          for (var E2, F13 = 0, N2 = k.i, D2 = k.j, I2 = k.S; C2--; ) E2 = I2[N2 = f & N2 + 1], F13 = F13 * a + I2[f & (I2[N2] = I2[D2 = f & D2 + E2]) + (I2[D2] = E2)];
          return k.i = N2, k.j = D2, F13;
        })(a);
      }
      function v(y, w) {
        return w.i = y.i, w.j = y.j, w.S = y.S.slice(), w;
      }
      function m(y, w) {
        var _5 = [], k = typeof y, T2;
        if (w && k == "object") for (T2 in y) try {
          _5.push(m(y[T2], w - 1));
        } catch {
        }
        return _5.length ? _5 : k == "string" ? y : y + "\0";
      }
      function g(y, w) {
        for (var _5 = y + "", k, T2 = 0; T2 < _5.length; ) w[f & T2] = f & (k ^= w[f & T2] * 19) + _5.charCodeAt(T2++);
        return b(w);
      }
      function x() {
        try {
          var y;
          return h && (y = h.randomBytes) ? y = y(a) : (y = new Uint8Array(a), (t.crypto || t.msCrypto).getRandomValues(y)), b(y);
        } catch {
          var w = t.navigator, _5 = w && w.plugins;
          return [+/* @__PURE__ */ new Date(), t, _5, t.screen, b(r)];
        }
      }
      function b(y) {
        return String.fromCharCode.apply(0, y);
      }
      if (g(n.random(), r), e.exports) {
        e.exports = p;
        try {
          h = lse.default;
        } catch {
        }
      } else n["seed" + i] = p;
    })(typeof self < "u" ? self : Vm, [], Math);
  });
  Wm.alea = mde;
  Wm.xor128 = gde;
  Wm.xorwow = yde;
  Wm.xorshift7 = xde;
  Wm.xor4096 = bde;
  Wm.tychei = _de;
  var e5 = Wm;
  var t5 = function() {
    function e(t, r, n, a, o) {
      this.mean = t, this.stdDev = r, this.dtype = n, this.nextVal = NaN, this.truncated = a, this.truncated && (this.upper = this.mean + this.stdDev * 2, this.lower = this.mean - this.stdDev * 2);
      var s = o || Math.random();
      this.random = e5.alea(s.toString());
    }
    return e.prototype.nextValue = function() {
      if (!isNaN(this.nextVal)) {
        var t = this.nextVal;
        return this.nextVal = NaN, t;
      }
      for (var r, n, a = false; !a; ) {
        var o = void 0, s = void 0, i = void 0;
        do
          o = 2 * this.random() - 1, s = 2 * this.random() - 1, i = o * o + s * s;
        while (i >= 1 || i === 0);
        var l = Math.sqrt(-2 * Math.log(i) / i);
        r = this.mean + this.stdDev * o * l, n = this.mean + this.stdDev * s * l, (!this.truncated || this.isValidTruncated(r)) && (a = true);
      }
      return (!this.truncated || this.isValidTruncated(n)) && (this.nextVal = this.convertValue(n)), this.convertValue(r);
    }, e.prototype.convertValue = function(t) {
      return this.dtype == null || this.dtype === "float32" ? t : Math.round(t);
    }, e.prototype.isValidTruncated = function(t) {
      return t <= this.upper && t >= this.lower;
    }, e;
  }(), wde = function() {
    function e(t, r, n, a) {
      this.alpha = t, this.beta = 1 / r, this.dtype = n;
      var o = a || Math.random();
      this.randu = e5.alea(o.toString()), this.randn = new t5(0, 1, n, false, this.randu()), t < 1 ? this.d = t + 2 / 3 : this.d = t - 1 / 3, this.c = 1 / Math.sqrt(9 * this.d);
    }
    return e.prototype.nextValue = function() {
      for (var t, r, n, a, o, s; ; ) {
        do
          a = this.randn.nextValue(), s = 1 + this.c * a;
        while (s <= 0);
        if (s *= s * s, t = a * a, r = 1 - 0.331 * t * t, n = 0.5 * t + this.d * (1 - s + Math.log(s)), o = this.randu(), o < r || Math.log(o) < n) break;
      }
      return s = 1 / this.beta * this.d * s, this.alpha < 1 && (s *= Math.pow(this.randu(), 1 / this.alpha)), this.convertValue(s);
    }, e.prototype.convertValue = function(t) {
      return this.dtype === "float32" ? t : Math.round(t);
    }, e;
  }(), kde = function() {
    function e(t, r, n, a) {
      var o = this;
      if (t === void 0 && (t = 0), r === void 0 && (r = 1), this.canReturnFloat = function() {
        return o.dtype == null || o.dtype === "float32";
      }, this.min = t, this.range = r - t, this.dtype = n, a == null && (a = Math.random()), typeof a == "number" && (a = a.toString()), !this.canReturnFloat() && this.range <= 1) throw new Error("The difference between " + t + " - " + r + " <= 1 and dtype is not float");
      this.random = e5.alea(a);
    }
    return e.prototype.convertValue = function(t) {
      return this.canReturnFloat() ? t : Math.round(t);
    }, e.prototype.nextValue = function() {
      return this.convertValue(this.min + this.range * this.random());
    }, e;
  }();
  function Tde(e, t, r, n, a) {
    if (r === void 0 && (r = 1), n === void 0 && (n = "float32"), r == null && (r = 1), n == null && (n = "float32"), n !== "float32" && n !== "int32") throw new Error("Unsupported data type " + n);
    for (var o = new wde(t, r, n, a), s = m0(e, n), i = 0; i < s.values.length; i++) s.values[i] = o.nextValue();
    return s.toTensor();
  }
  var Ade = Hr({ randomGamma_: Tde });
  function Sde(e, t, r, n, a) {
    if (t === void 0 && (t = 0), r === void 0 && (r = 1), n != null && n === "bool") throw new Error("Unsupported data type " + n);
    for (var o = new t5(t, r, n, false, a), s = m0(e, n), i = 0; i < s.values.length; i++) s.values[i] = o.nextValue();
    return s.toTensor();
  }
  var Ede = Hr({ randomNormal_: Sde });
  function Dde(e, t, r, n, a) {
    t === void 0 && (t = 0), r === void 0 && (r = 1), n === void 0 && (n = "float32");
    for (var o = m0(e, n), s = new kde(t, r, null, a), i = 0; i < o.values.length; i++) o.values[i] = s.nextValue();
    return o.toTensor();
  }
  var Bz = Hr({ randomUniform_: Dde });
  function Ub(e, t, r, n) {
    if (r === void 0 && (r = 1), n === void 0 && (n = "float32"), r === 0) throw new Error("Cannot have a step of zero");
    var a = { start: e, stop: t, step: r, dtype: n };
    return Xr.runKernel(S7, {}, a);
  }
  function Cde(e) {
    var t = mr(e, "input", "real"), r = { input: t };
    return Xr.runKernel(E7, r);
  }
  var b3 = Hr({ real_: Cde });
  function Mde(e) {
    var t = mr(e, "x", "reciprocal"), r = { x: t };
    return Xr.runKernel(D7, r);
  }
  var Ide = Hr({ reciprocal_: Mde });
  function Nde(e) {
    var t = mr(e, "x", "relu"), r = { x: t };
    return Xr.runKernel(C7, r);
  }
  var I3 = Hr({ relu_: Nde });
  function Fde(e) {
    var t = mr(e, "x", "relu6"), r = { x: t };
    return Xr.runKernel(F72, r);
  }
  var Uz = Hr({ relu6_: Fde });
  function Ode(e, t) {
    var r = mr(e, "x", "reverse"), n = { x: r }, a = { dims: t };
    return Xr.runKernel(O7, n, a);
  }
  var zm = Hr({ reverse_: Ode });
  function Pde(e) {
    var t = mr(e, "x", "reverse");
    return Dr(t.rank === 1, function() {
      return "Error in reverse1D: x must be rank 1 but got rank " + t.rank + ".";
    }), zm(t, 0);
  }
  var Lde = Hr({ reverse1d_: Pde });
  function Rde(e, t) {
    var r = mr(e, "x", "reverse");
    return Dr(r.rank === 2, function() {
      return "Error in reverse2D: x must be rank 2 but got rank " + r.rank + ".";
    }), zm(r, t);
  }
  var zde = Hr({ reverse2d_: Rde });
  function Bde(e, t) {
    var r = mr(e, "x", "reverse");
    return Dr(r.rank === 3, function() {
      return "Error in reverse3D: x must be rank 3 but got rank " + r.rank + ".";
    }), zm(r, t);
  }
  var Ude = Hr({ reverse3d_: Bde });
  function Vde(e, t) {
    var r = mr(e, "x", "reverse");
    return Dr(r.rank === 4, function() {
      return "Error in reverse4D: x must be rank 4 but got rank " + r.rank + ".";
    }), zm(r, t);
  }
  var jde = Hr({ reverse4d_: Vde });
  function Wde(e) {
    var t = mr(e, "x", "round"), r = { x: t };
    return Xr.runKernel(P7, r);
  }
  var Vz = Hr({ round_: Wde });
  function Gde(e) {
    var t = mr(e, "x", "rsqrt", "float32"), r = { x: t };
    return Xr.runKernel(L7, r);
  }
  var $de = Hr({ rsqrt_: Gde });
  function xs(e, t) {
    if ((Gc(e) && t !== "string" || Array.isArray(e)) && t !== "complex64") throw new Error("Error creating a new Scalar: value must be a primitive (number|boolean|string)");
    if (t === "string" && Gc(e) && !(e instanceof Uint8Array)) throw new Error("When making a scalar from encoded string, the value must be `Uint8Array`.");
    var r = [], n = [];
    return gv(e, r, n, t);
  }
  function Hde(e) {
    var t = mr(e, "x", "selu"), r = { x: t };
    return Xr.runKernel(B7, r);
  }
  var qde = Hr({ selu_: Hde });
  function Xde(e, t, r, n, a, o, s) {
    o === void 0 && (o = [1, 1]), s === void 0 && (s = "NHWC");
    var i = mr(e, "x", "separableConv2d"), l = mr(t, "depthwiseFilter", "separableConv2d"), u2 = mr(r, "pointwiseFilter", "separableConv2d"), c = i, f = false;
    if (i.rank === 3 && (f = true, c = ga(i, [1, i.shape[0], i.shape[1], i.shape[2]])), s === "NCHW") throw new Error("separableConv2d currently does not support dataFormat NCHW; only NHWC is supported");
    Dr(c.rank === 4, function() {
      return "Error in separableConv2d: input must be rank 4, but got " + ("rank " + c.rank + ".");
    }), Dr(l.rank === 4, function() {
      return "Error in separableConv2d: depthwise filter must be rank 4, but " + ("got rank " + l.rank + ".");
    }), Dr(u2.rank === 4, function() {
      return "Error in separableConv2d: pointwise filter must be rank 4, but " + ("got rank " + l.rank + ".");
    }), Dr(u2.shape[0] === 1, function() {
      return "Error in separableConv2d: the first dimension of pointwise filter " + (" must be 1, but got " + u2.shape[0] + ".");
    }), Dr(u2.shape[1] === 1, function() {
      return "Error in separableConv2d: the second dimension of pointwise " + ("filter must be 1, but got " + u2.shape[1] + ".");
    });
    var h = l.shape[2], p = l.shape[3];
    Dr(u2.shape[2] === h * p, function() {
      return "Error in separableConv2d: the third dimension of pointwise filter " + ("must be " + h * p + ", ") + ("but got " + u2.shape[2] + ".");
    });
    var d = Y4(c, l, n, a, s, o), v = 1, m = E3(d, u2, v, "valid", s);
    return f ? ga(m, [m.shape[1], m.shape[2], m.shape[3]]) : m;
  }
  var Kde = Hr({ separableConv2d_: Xde });
  function Yde(e, t) {
    return xi(this, void 0, void 0, function() {
      var r, n, a, o, s, i, c, l, u2, c, f;
      return bi(this, function(h) {
        switch (h.label) {
          case 0:
            return r = mr(e, "x", "setdiff1d"), n = mr(t, "y", "setdiff1d"), Dr(r.dtype === n.dtype, function() {
              return "x and y should have the same dtype, but got x (" + r.dtype + ") and y (" + n.dtype + ").";
            }), Dr(r.rank === 1, function() {
              return "x should be 1D tensor, but got x (" + r.shape + ").";
            }), Dr(n.rank === 1, function() {
              return "y should be 1D tensor, but got y (" + n.shape + ").";
            }), [4, r.data()];
          case 1:
            return a = h.sent(), [4, n.data()];
          case 2:
            for (o = h.sent(), s = new Set(o), i = 0, c = 0; c < a.length; c++) s.has(a[c]) || i++;
            for (l = new p3([i], r.dtype), u2 = new p3([i], "int32"), c = 0, f = 0; c < a.length; c++) s.has(a[c]) || (l.values[f] = a[c], u2.values[f] = c, f++);
            return [2, [l.toTensor(), u2.toTensor()]];
        }
      });
    });
  }
  var Zde = Yde;
  function Jde(e) {
    var t = mr(e, "x", "sign"), r = { x: t };
    return Xr.runKernel(W7, r);
  }
  var Qde = Hr({ sign_: Jde });
  function e0e(e) {
    var t = mr(e, "x", "sin", "float32"), r = { x: t };
    return Xr.runKernel(V7, r);
  }
  var t0e = Hr({ sin_: e0e });
  function r0e(e) {
    var t = mr(e, "x", "sinh"), r = { x: t };
    return Xr.runKernel(j7, r);
  }
  var n0e = Hr({ sinh_: r0e });
  function a0e(e, t, r) {
    var n = mr(e, "x", "slice1d");
    return Dr(n.rank === 1, function() {
      return "slice1d expects a rank-1 tensor, but got a rank-" + n.rank + " tensor";
    }), Cl(n, [t], [r]);
  }
  var i0e = Hr({ slice1d_: a0e });
  function o0e(e, t, r) {
    var n = mr(e, "x", "slice2d");
    return Dr(n.rank === 2, function() {
      return "slice2d expects a rank-2 tensor, but got a rank-" + n.rank + " tensor";
    }), Cl(n, t, r);
  }
  var s0e = Hr({ slice2d_: o0e });
  function l0e(e, t, r) {
    var n = mr(e, "x", "slice3d");
    return Dr(n.rank === 3, function() {
      return "slice3d expects a rank-3 tensor, but got a rank-" + n.rank + " tensor";
    }), Cl(n, t, r);
  }
  var u0e = Hr({ slice3d_: l0e });
  function c0e(e, t, r) {
    var n = mr(e, "x", "slice4d");
    return Dr(n.rank === 4, function() {
      return "slice4d expects a rank-4 tensor, but got a rank-" + n.rank + " tensor";
    }), Cl(n, t, r);
  }
  var f0e = Hr({ slice4d_: c0e });
  function h0e(e, t) {
    t === void 0 && (t = -1);
    var r = mr(e, "logits", "softmax", "float32");
    if (t === -1 && (t = r.rank - 1), t !== r.rank - 1) throw Error("Softmax along a non-last dimension is not yet supported. " + ("Logits was rank " + r.rank + " and dim was " + t));
    var n = { logits: r }, a = { dim: t };
    return Xr.runKernel(Y7, n, a);
  }
  var p0e = Hr({ softmax_: h0e });
  function d0e(e) {
    Dr(e.dtype === "complex64", function() {
      return "The dtype for tf.spectral.fft() must be complex64 " + ("but got " + e.dtype + ".");
    });
    var t = { input: e };
    return Xr.runKernel(IR, t);
  }
  var r5 = Hr({ fft_: d0e });
  function v0e(e) {
    Dr(e.dtype === "complex64", function() {
      return "The dtype for tf.spectral.ifft() must be complex64 " + ("but got " + e.dtype + ".");
    });
    var t = { input: e };
    return Xr.runKernel(VR, t);
  }
  var _32 = Hr({ ifft_: v0e });
  function m0e(e) {
    var t = e.shape[e.shape.length - 1], r = e.size / t, n;
    if (t <= 2) {
      var a = ga(e, [r, t]);
      n = _32(a);
    } else {
      var o = [r, 2 * (t - 1)], s = ga(b3(e), [r, t]), i = ga(Z4(e), [r, t]), l = zm(Cl(s, [0, 1], [r, t - 2]), 1), u2 = Xa(zm(Cl(i, [0, 1], [r, t - 2]), 1), xs(-1)), c = eh([s, l], 1), f = eh([i, u2], 1), a = ga(Om(c, f), [o[0], o[1]]);
      n = _32(a);
    }
    if (n = b3(n), e.rank === 3 && e.shape[0] !== 0) {
      var h = n, p = e.shape[0];
      n = ga(n, [p, n.shape[0] / p, n.shape[1]]), h.dispose();
    }
    return n;
  }
  var jz = Hr({ irfft_: m0e });
  function g0e(e, t, r) {
    r === void 0 && (r = 0);
    var n = mr(e, "x", "split"), a = { x: n }, o = { numOrSizeSplits: t, axis: r };
    return Xr.runKernel(K7, a, o);
  }
  var Vb = Hr({ split_: g0e });
  function y0e(e, t) {
    Dr(e.dtype === "float32", function() {
      return "The dtype for rfft() must be real value but got " + e.dtype;
    });
    var r = e.shape[e.shape.length - 1], n = e.size / r, a;
    if (t != null && t < r) {
      var o = e.shape.map(function(g) {
        return 0;
      }), s = e.shape.map(function(g) {
        return g;
      });
      s[e.shape.length - 1] = t, a = Cl(e, o, s), r = t;
    } else if (t != null && t > r) {
      var i = e.shape.map(function(g) {
        return g;
      });
      i[e.shape.length - 1] = t - r, a = eh([e, ny(i)], e.shape.length - 1), r = t;
    } else a = e;
    var l = Eh(a), u2 = ga(Om(a, l), [n, r]), c = r5(u2), f = Math.floor(r / 2) + 1, h = b3(c), p = Z4(c), d = Vb(h, [f, r - f], h.shape.length - 1), v = Vb(p, [f, r - f], p.shape.length - 1), m = a.shape.slice();
    return m[a.shape.length - 1] = f, ga(Om(d[0], v[0]), m);
  }
  var n5 = Hr({ rfft_: y0e });
  function x0e(e) {
    var t = mr(e, "x", "sqrt", "float32"), r = { x: t };
    return Xr.runKernel(H7, r);
  }
  var g0 = Hr({ sqrt_: x0e });
  function b0e(e, t) {
    var r, n = mr(e, "a", "squaredDifference"), a = mr(t, "b", "squaredDifference");
    r = hi(Bl(n, a), 2), n = r[0], a = r[1], ju(n.shape, a.shape);
    var o = { a: n, b: a }, s = {};
    return Xr.runKernel(r9, o, s);
  }
  var Wz = Hr({ squaredDifference_: b0e });
  function _0e(e, t) {
    var r = mr(e, "x", "squeeze");
    return ga(r, SL(r.shape, t).newShape);
  }
  var a5 = Hr({ squeeze_: _0e });
  function w0e(e, t) {
    t === void 0 && (t = 0);
    var r = Lb(e, "tensors", "stack", "string_or_numeric");
    Dr(r.length >= 1, function() {
      return "Pass at least one tensor to tf.stack";
    }), r.length > 0 && Dr(t <= r[0].rank, function() {
      return "Axis must be <= rank of the tensor";
    });
    var n = r, a = { axis: t };
    return Xr.runKernel(_7, n, a);
  }
  var jb = Hr({ stack_: w0e });
  function k0e(e, t) {
    t === void 0 && (t = 0);
    var r = mr(e, "x", "step"), n = { x: r }, a = { alpha: t };
    return Xr.runKernel(g9, n, a);
  }
  var Gz = Hr({ step_: k0e });
  function T0e(e, t, r, n, a, o, s, i, l) {
    a === void 0 && (a = 0), o === void 0 && (o = 0), s === void 0 && (s = 0), i === void 0 && (i = 0), l === void 0 && (l = 0);
    var u2 = mr(e, "x", "stridedSlice", "string_or_numeric"), c = { x: u2 }, f = { begin: t, end: r, strides: n, beginMask: a, endMask: o, ellipsisMask: s, newAxisMask: i, shrinkAxisMask: l };
    return Xr.runKernel(n9, c, f);
  }
  var A0e = Hr({ stridedSlice_: T0e });
  function S0e(e) {
    var t = mr(e, "x", "tan", "float32"), r = { x: t };
    return Xr.runKernel(l9, r);
  }
  var E0e = Hr({ tan_: S0e });
  function Kp(e, t) {
    Bm(e);
    var r = Rd(e, t);
    if (r.length !== 1) throw new Error("tensor1d() requires values to be a flat/TypedArray");
    var n = null;
    return gv(e, n, r, t);
  }
  function Ib(e, t, r) {
    if (Bm(e), t != null && t.length !== 2) throw new Error("tensor2d() requires shape to have two numbers");
    var n = Rd(e, r);
    if (n.length !== 2 && n.length !== 1) throw new Error("tensor2d() requires values to be number[][] or flat/TypedArray");
    if (n.length === 1 && t == null) throw new Error("tensor2d() requires shape to be provided when `values` are a flat/TypedArray");
    return gv(e, t, n, r);
  }
  function D0e(e, t, r) {
    if (Bm(e), t != null && t.length !== 4) throw new Error("tensor4d() requires shape to have four numbers");
    var n = Rd(e, r);
    if (n.length !== 4 && n.length !== 1) throw new Error("tensor4d() requires values to be number[][][][] or flat/TypedArray");
    if (n.length === 1 && t == null) throw new Error("tensor4d() requires shape to be provided when `values` are a flat array");
    return gv(e, t, n, r);
  }
  function C0e(e, t, r) {
    if (Bm(e), t != null && t.length !== 5) throw new Error("tensor5d() requires shape to have five numbers");
    var n = Rd(e, r);
    if (n.length !== 5 && n.length !== 1) throw new Error("tensor5d() requires values to be number[][][][][] or flat/TypedArray");
    if (n.length === 1 && t == null) throw new Error("tensor5d() requires shape to be provided when `values` are a flat array");
    return gv(e, t, n, r);
  }
  function M0e(e, t, r) {
    if (Bm(e), t != null && t.length !== 6) throw new Error("tensor6d() requires shape to have six numbers");
    var n = Rd(e, r);
    if (n.length !== 6 && n.length !== 1) throw new Error("tensor6d() requires values to be number[][][][][][] or flat/TypedArray");
    if (n.length === 1 && t == null) throw new Error("tensor6d() requires shape to be provided when `values` are a flat array");
    return t = t || n, gv(e, t, n, r);
  }
  function I0e(e, t, r) {
    t === void 0 && (t = 1), r === void 0 && (r = true);
    var n = mr(e, "x", "topk");
    if (n.rank === 0) throw new Error("topk() expects the input to be of rank 1 or higher");
    var a = n.shape[n.shape.length - 1];
    if (t < 0) throw new Error("'k' passed to topk() must be >= 0 but got " + t);
    if (t > a) throw new Error("'k' passed to topk() must be <= the last dimension (" + a + ") " + ("but got " + t));
    var o = { x: n }, s = { k: t, sorted: r }, i = hi(Xr.runKernel(c9, o, s), 2), l = i[0], u2 = i[1];
    return { values: l, indices: u2 };
  }
  var N0e = Hr({ topk_: I0e });
  function F0e(e, t, r, n, a) {
    if (t === void 0 && (t = 0), r === void 0 && (r = 1), n != null && n === "bool") throw new Error("Unsupported data type $ { dtype }");
    for (var o = new t5(t, r, n, true, a), s = m0(e, n), i = 0; i < s.values.length; i++) s.values[i] = o.nextValue();
    return s.toTensor();
  }
  var O0e = Hr({ truncatedNormal_: F0e });
  function P0e(e, t) {
    t === void 0 && (t = 0);
    var r = mr(e, "x", "unique", "string_or_numeric");
    Dr(r.rank > 0, function() {
      return "The input tensor must be at least 1D";
    });
    var n = { x: r }, a = { axis: t }, o = hi(Xr.runKernel(p9, n, a), 2), s = o[0], i = o[1];
    return { values: s, indices: i };
  }
  var L0e = Hr({ unique_: P0e });
  function R0e(e, t, r) {
    var n = mr(e, "x", "unsortedSegmentSum"), a = mr(t, "segmentIds", "unsortedSegmentSum", "int32");
    Dr(Q1(r), function() {
      return "numSegments must be of dtype int";
    });
    var o = { x: n, segmentIds: a }, s = { numSegments: r };
    return Xr.runKernel(v9, o, s);
  }
  var z0e = Hr({ unsortedSegmentSum_: R0e });
  function B0e(e, t) {
    t === void 0 && (t = 0);
    var r = mr(e, "x", "unstack", "string_or_numeric");
    Dr(t >= -r.shape.length && t < r.shape.length, function() {
      return "Axis = " + t + " is not in [-" + r.shape.length + ", " + r.shape.length + ")";
    });
    var n = { value: r }, a = { axis: t };
    return Xr.runKernel(d9, n, a);
  }
  var i5 = Hr({ unstack_: B0e });
  function U0e(e, t, r, n) {
    return t === void 0 && (t = true), Xr.makeVariable(e, t, r, n);
  }
  function $z(e, t) {
    for (var r = [], n = 0; n < t.length; n++) t[n] && r.push(n);
    for (var a = m0(e, "int32"), o = m0([r.length, e.length], "int32"), n = 0; n < r.length; n++) {
      var s = a.indexToLoc(r[n]), i = n * e.length;
      o.values.set(s, i);
    }
    return o.toTensor();
  }
  function V0e(e) {
    return xi(this, void 0, void 0, function() {
      var t, r, n;
      return bi(this, function(a) {
        switch (a.label) {
          case 0:
            return t = mr(e, "condition", "whereAsync", "bool"), [4, t.data()];
          case 1:
            return r = a.sent(), n = $z(t.shape, r), e !== t && t.dispose(), [2, n];
        }
      });
    });
  }
  var Hz = V0e;
  function j0e(e, t, r) {
    return xi(this, void 0, void 0, function() {
      var n, a, o, s, i, l, u2, c, f, h, p, d, v;
      return bi(this, function(m) {
        switch (m.label) {
          case 0:
            for (n = mr(e, "tensor", "boolMask"), a = mr(t, "mask", "boolMask", "bool"), o = r ?? 0, s = a.rank, i = n.shape, Dr(s > 0, function() {
              return "mask cannot be scalar";
            }), nf(i.slice(o, o + s), a.shape, "mask's shape must match the first K dimensions of tensor's shape,"), l = 1, u2 = o; u2 < o + s; u2++) l *= i[u2];
            return c = i.slice(0, o).concat([l], i.slice(o + s)), f = ga(n, c), h = ga(a, [-1]), [4, Hz(h)];
          case 1:
            return p = m.sent(), d = a5(p, [1]), v = kz(f, d, o), e !== n && n.dispose(), t !== a && a.dispose(), d.dispose(), f.dispose(), h.dispose(), p.dispose(), [2, v];
        }
      });
    });
  }
  var W0e = j0e;
  function G0e(e, t, r, n) {
    t === void 0 && (t = "euclidean"), r === void 0 && (r = null), n === void 0 && (n = false), e = mr(e, "x", "norm");
    var a = qz(e, t, r), o = a.shape;
    if (n) {
      var s = Wb(r, e.shape);
      o = Xb(a.shape, s);
    }
    return ga(a, o);
  }
  function qz(e, t, r) {
    if (r === void 0 && (r = null), e.rank === 0) return Sh(e);
    if (e.rank !== 1 && r === null) return qz(ga(e, [-1]), t, r);
    if (e.rank === 1 || typeof r == "number" || Array.isArray(r) && r.length === 1) {
      if (t === 1) return ul(Sh(e), r);
      if (t === 1 / 0) return J1(Sh(e), r);
      if (t === -1 / 0) return S4(Sh(e), r);
      if (t === "euclidean" || t === 2) return g0(ul(Bb(Sh(e), xs(2, "int32")), r));
      throw new Error("Error in norm: invalid ord value: " + t);
    }
    if (Array.isArray(r) && r.length === 2) {
      if (t === 1) return J1(ul(Sh(e), r[0]), r[1] - 1);
      if (t === 1 / 0) return J1(ul(Sh(e), r[1]), r[0]);
      if (t === -1 / 0) return S4(ul(Sh(e), r[1]), r[0]);
      if (t === "fro" || t === "euclidean") return g0(ul(Yp(e), r));
      throw new Error("Error in norm: invalid ord value: " + t);
    }
    throw new Error("Error in norm: invalid axis: " + r);
  }
  var o5 = Hr({ norm_: G0e });
  function $0e(e, t, r, n, a) {
    a === void 0 && (a = true);
    var o = mr(e, "v", "movingAverage"), s = mr(t, "x", "movingAverage"), i = mr(r, "decay", "movingAverage");
    E9(o, s), Dr(mv(o.shape, s.shape), function() {
      return "Shape mismatch in v and x";
    });
    var l = xs(1), u2 = Ao(l, i), c = Xa(Ao(s, o), u2);
    if (a) {
      Dr(n != null, function() {
        return "When using zeroDebias: true, step is required.";
      });
      var f = mr(n, "step", "movingAverage");
      c = cl(c, Ao(l, Bb(i, f)));
    }
    return Hi(o, c);
  }
  var H0e = Hr({ movingAverage_: $0e });
  function q0e(e, t, r) {
    var n = mr(e, "indices", "scatterND", "int32"), a = mr(t, "updates", "scatterND");
    H4(a, n, r);
    var o = { indices: n, updates: a }, s = { shape: r };
    return Xr.runKernel(R7, o, s);
  }
  var X0e = Hr({ scatterND_: q0e });
  function K0e(e, t, r, n) {
    if (e.dtype !== "int32") throw new Error("tf.sparseToDense() expects the indices to be int32 type," + (" but the dtype was " + e.dtype + "."));
    if (e.rank > 2) throw new Error("sparseIndices should be a scalar, vector, or matrix," + (" but got shape " + e.shape + "."));
    var a = e.rank > 0 ? e.shape[0] : 1, o = e.rank > 1 ? e.shape[1] : 1;
    if (r.length !== o) throw new Error("outputShape has incorrect number of elements:," + (" " + r.length + ", should be: " + o + "."));
    var s = t.size;
    if (!(t.rank === 0 || t.rank === 1 && s === a)) throw new Error("sparseValues has incorrect shape " + (t.shape + ", should be [] or [" + a + "]"));
    if (t.dtype !== n.dtype) throw new Error("sparseValues.dtype must match defaultValues.dtype");
  }
  function Y0e(e, t, r, n) {
    n === void 0 && (n = 0);
    var a = mr(e, "sparseIndices", "sparseToDense", "int32"), o = mr(t, "sparseValues", "sparseToDense"), s = mr(n, "defaultValue", "sparseToDense", o.dtype);
    K0e(a, o, r, s);
    var i = { sparseIndices: a, sparseValues: o, defaultValue: s }, l = { outputShape: r };
    return Xr.runKernel(t9, i, l);
  }
  var Z0e = Hr({ sparseToDense_: Y0e });
  function J0e(e, t) {
    var r = mr(t, "indices", "gatherND", "int32"), n = mr(e, "x", "gatherND", "string_or_numeric"), a = { params: n, indices: r };
    return Xr.runKernel(zR, a);
  }
  var Q0e = Hr({ gatherND_: J0e });
  function eve(e, t) {
    if (t == null) return e.shape.slice();
    if (mv(e.shape, t)) return t;
    if (e.shape.length === t.length) {
      for (var r = [], n = 0; n < e.shape.length; n++) t[n] == null && e.shape[n] != null ? r.push(e.shape[n]) : r.push(t[n]);
      return r;
    }
    return t;
  }
  function tve(e, t, r, n) {
    var a = mr(e, "x", "dropout");
    if (Dr(a.dtype === "float32", function() {
      return "x has to be a floating point tensor since it's going to be " + ("scaled, but got a " + a.dtype + " tensor instead.");
    }), Dr(t >= 0 && t < 1, function() {
      return "rate must be a float in the range [0, 1), but got " + t + ".";
    }), t === 0) return e instanceof Du ? a.clone() : a;
    var o = eve(a, r), s = 1 - t, i = cl(wz(Hi(Bz(o, 0, 1, "float32", n), s)), s);
    return Xa(a, i);
  }
  var rve = Hr({ dropout_: tve });
  function Xz(e) {
    return Math.floor(Math.pow(2, Math.ceil(Math.log(e) / Math.log(2))));
  }
  function s5(e, t, r) {
    for (var n = 1 - e % 2, a = new Float32Array(e), o = 0; o < e; ++o) {
      var s = 2 * Math.PI * o / (e + n - 1);
      a[o] = t - r * Math.cos(s);
    }
    return Kp(a, "float32");
  }
  function nve(e, t, r) {
    return r === void 0 && (r = 1), xi(this, void 0, void 0, function() {
      var n, a, o, s, i, l, u2, c, f, h, p, d, v, m, m;
      return bi(this, function(g) {
        switch (g.label) {
          case 0:
            return n = mr(e, "predictions", "inTopK"), a = mr(t, "targets", "inTopK"), Dr(n.rank > 1, function() {
              return "inTopK() expects the predictions to be of rank 2 or higher, " + ("but got " + n.rank);
            }), Dr(n.rank - 1 === a.rank, function() {
              return "predictions rank should be 1 larger than targets rank, but got predictions rank " + (n.rank + " and targets rank " + a.rank);
            }), nf(n.shape.slice(0, n.shape.length - 1), a.shape, "predictions's shape should be align with the targets' shape, except the last dimension."), o = n.shape[n.shape.length - 1], Dr(r > 0 && r <= o, function() {
              return "'k' passed to inTopK() must be > 0 && <= the predictions last " + ("dimension (" + o + "), but got " + r);
            }), [4, n.data()];
          case 1:
            return s = g.sent(), [4, a.data()];
          case 2:
            for (i = g.sent(), l = hi([s.length / o, o], 2), u2 = l[0], c = l[1], f = EL("bool", u2), h = 0; h < u2; h++) {
              for (p = h * c, d = s.subarray(p, p + c), v = [], m = 0; m < d.length; m++) v.push({ value: d[m], index: m });
              for (v.sort(function(x, b) {
                return b.value - x.value;
              }), f[h] = 0, m = 0; m < r; m++) if (v[m].index === i[h]) {
                f[h] = 1;
                break;
              }
            }
            return e !== n && n.dispose(), t !== a && a.dispose(), [2, X1(f, a.shape, "bool")];
        }
      });
    });
  }
  var ave = nve;
  function ive(e, t, r, n, a, o, s) {
    o === void 0 && (o = "NHWC");
    var i = e;
    e.rank === 3 && (i = ga(e, [1, e.shape[0], e.shape[1], e.shape[2]]));
    var l = t;
    l.rank === 3 && (l = ga(t, [1, t.shape[0], t.shape[1], t.shape[2]])), Dr(i.rank === 4, function() {
      return "Error in conv2dDerFilter: input must be rank 4, but got shape " + (i.shape + ".");
    }), Dr(l.rank === 4, function() {
      return "Error in conv2dDerFilter: dy must be rank 4, but got shape " + (l.shape + ".");
    }), Dr(r.length === 4, function() {
      return "Error in conv2dDerFilter: filterShape must be length 4, but got " + (r + ".");
    });
    var u2 = o === "NHWC" ? i.shape[3] : i.shape[1], c = o === "NHWC" ? l.shape[3] : l.shape[1];
    Dr(u2 === r[2], function() {
      return "Error in conv2dDerFilter: depth of input " + u2 + ") must " + ("match input depth in filter (" + r[2] + ".");
    }), Dr(c === r[3], function() {
      return "Error in conv2dDerFilter: depth of dy (" + c + ") must " + ("match output depth for filter (" + r[3] + ").");
    }), rp("conv2dDerFilter", a, s);
    var f = { x: i, dy: l }, h = { strides: n, pad: a, dataFormat: o, dimRoundingMode: s, filterShape: r };
    return Xr.runKernel(lR, f, h);
  }
  var ove = Hr({ conv2DBackpropFilter_: ive });
  function N3(e, t, r) {
    if (r == null || r === "linear") return e;
    if (r === "relu") return Xa(e, Gz(t));
    throw new Error("Cannot compute gradient for fused activation " + r + ".");
  }
  function F32(e, t) {
    var r = t, n = G4(e.shape, t.shape);
    return n.length > 0 && (r = ul(r, n)), ga(r, e.shape);
  }
  function O3(e, t, r, n) {
    if (t === "linear") return e;
    if (t === "relu") return I3(e);
    if (t === "elu") return bz(e);
    if (t === "relu6") return Uz(e);
    if (t === "prelu") return zz(e, r);
    if (t === "leakyrelu") return Az(e, n);
    if (t === "sigmoid") return Z1(e);
    throw new Error("Unknown fused activation " + t + ".");
  }
  var P3 = function(e, t) {
    var r = e > 0;
    return !r || t === "linear";
  };
  function sve(e) {
    var t, r = e.x, n = e.filter, a = e.strides, o = e.pad, s = e.dataFormat, i = s === void 0 ? "NHWC" : s, l = e.dilations, u2 = l === void 0 ? [1, 1] : l, c = e.dimRoundingMode, f = e.bias, h = e.activation, p = h === void 0 ? "linear" : h, d = e.preluActivationWeights, v = e.leakyreluAlpha;
    if (p = p || "linear", P3(Xr.state.gradientDepth, p) === false) {
      var m = E3(r, n, a, o, i, u2, c);
      return f != null && (m = Hi(m, f)), O3(m, p, d, v);
    }
    var g = mr(r, "x", "conv2d", "float32"), x = mr(n, "filter", "conv2d", "float32"), b = g, y = false;
    g.rank === 3 && (y = true, b = ga(g, [1, g.shape[0], g.shape[1], g.shape[2]])), Dr(b.rank === 4, function() {
      return "Error in fused conv2d: input must be rank 4, but got rank " + (b.rank + ".");
    }), Dr(x.rank === 4, function() {
      return "Error in fused conv2d: filter must be rank 4, but got rank " + (x.rank + ".");
    }), rp("fused conv2d", o, c), Dr(b.shape[3] === x.shape[2], function() {
      return "Error in conv2d: depth of input (" + b.shape[3] + ") must match " + ("input depth for filter " + x.shape[2] + ".");
    }), Dr(x0(a, u2), function() {
      return "Error in conv2D: Either strides or dilations must be 1. " + ("Got strides " + a + " and dilations '" + u2 + "'");
    }), Dr(i === "NHWC", function() {
      return "Error in conv2d: got dataFormat of " + i + " but only NHWC is currently supported.";
    });
    var w = qb(b.shape, x.shape, a, u2, o, c), _5;
    f != null && (_5 = mr(f, "bias", "fused conv2d"), t = hi(Bl(_5, g), 1), _5 = t[0], ju(w.outShape, _5.shape));
    var k;
    d != null && (k = mr(d, "prelu weights", "fused conv2d"));
    var T2 = function(F13, N2) {
      var D2 = hi(N2, 4), I2 = D2[0], O2 = D2[1], L2 = D2[2], V2 = D2[3], W2 = N3(F13, L2, p);
      Dr(Rb(u2), function() {
        return "Error in gradient of fused conv2D: dilation rates greater than 1 " + ("are not yet supported in gradients. Got dilations '" + u2 + "'");
      });
      var X2 = yz(O2.shape, W2, I2, a, o), Y2 = ove(O2, W2, I2.shape, a, o), K2 = [X2, Y2];
      if (V2 != null) {
        var q = F32(V2, W2);
        K2.push(q);
      }
      return K2;
    }, A2 = { x: b, filter: x, bias: _5, preluActivationWeights: k }, S2 = { strides: a, pad: o, dataFormat: i, dilations: u2, dimRoundingMode: c, activation: p, leakyreluAlpha: v };
    if (f == null) {
      var C2 = zd(function(F13, N2, D2) {
        var I2 = Xr.runKernel(i4, A2, S2);
        return D2([N2, F13, I2]), y && (I2 = ga(I2, [I2.shape[1], I2.shape[2], I2.shape[3]])), { value: I2, gradFunc: T2 };
      });
      return C2(b, x);
    } else {
      var E2 = zd(function(F13, N2, D2, I2) {
        var O2 = Xr.runKernel(i4, A2, S2);
        return I2([N2, F13, O2, D2]), y && (O2 = ga(O2, [O2.shape[1], O2.shape[2], O2.shape[3]])), { value: O2, gradFunc: T2 };
      });
      return E2(b, x, _5);
    }
  }
  var lve = Hr({ fusedConv2d_: sve });
  function uve(e, t, r, n, a, o, s) {
    o === void 0 && (o = [1, 1]);
    var i = e;
    e.rank === 3 && (i = ga(e, [1, e.shape[0], e.shape[1], e.shape[2]]));
    var l = t;
    l.rank === 3 && (l = ga(t, [1, t.shape[0], t.shape[1], t.shape[2]]));
    var u2 = { x: i, dy: l }, c = { strides: n, pad: a, dimRoundingMode: s, dilations: o, filterShape: r };
    return Xr.runKernel(xR, u2, c);
  }
  var cve = Hr({ depthwiseConv2dNativeBackpropFilter_: uve });
  function fve(e, t, r, n, a, o, s) {
    o === void 0 && (o = [1, 1]);
    var i = t, l = false;
    t.rank === 3 && (l = true, i = ga(t, [1, t.shape[0], t.shape[1], t.shape[2]]));
    var u2 = { dy: i, filter: r }, c = { strides: n, pad: a, dimRoundingMode: s, dilations: o, inputShape: e }, f = Xr.runKernel(bR, u2, c);
    return l ? ga(f, [f.shape[1], f.shape[2], f.shape[3]]) : f;
  }
  var hve = Hr({ depthwiseConv2dNativeBackpropInput_: fve });
  function pve(e) {
    var t, r = e.x, n = e.filter, a = e.strides, o = e.pad, s = e.dataFormat, i = s === void 0 ? "NHWC" : s, l = e.dilations, u2 = l === void 0 ? [1, 1] : l, c = e.dimRoundingMode, f = e.bias, h = e.activation, p = h === void 0 ? "linear" : h, d = e.preluActivationWeights, v = e.leakyreluAlpha;
    if (P3(Xr.state.gradientDepth, p) === false) {
      var m = Y4(r, n, a, o, i, u2, c);
      return f != null && (m = Hi(m, f)), O3(m, p, d, v);
    }
    var g = mr(r, "x", "depthwiseConv2d", "float32"), x = mr(n, "filter", "depthwiseConv2d", "float32"), b = g, y = false;
    g.rank === 3 && (y = true, b = ga(g, [1, g.shape[0], g.shape[1], g.shape[2]])), Dr(b.rank === 4, function() {
      return "Error in fused depthwiseConv2d: input must be rank 4, but got " + ("rank " + b.rank + ".");
    }), Dr(x.rank === 4, function() {
      return "Error in fused depthwiseConv2d: filter must be rank 4, " + ("but got rank " + x.rank + ".");
    }), Dr(b.shape[3] === x.shape[2], function() {
      return "Error in fused depthwiseConv2d: number of input channels " + ("(" + b.shape[3] + ") must match the inChannels dimension in ") + ("filter " + x.shape[2] + ".");
    }), u2 == null && (u2 = [1, 1]), Dr(x0(a, u2), function() {
      return "Error in fused depthwiseConv2d: Either strides or dilations must " + ("be 1. Got strides " + a + " and dilations '" + u2 + "'");
    }), rp("fused depthwiseConv2d", o, c);
    var w = qb(b.shape, x.shape, a, u2, o, c, true), _5;
    f != null && (_5 = mr(f, "bias", "fused conv2d"), t = hi(Bl(_5, g), 1), _5 = t[0], ju(w.outShape, _5.shape));
    var k;
    d != null && (k = mr(d, "prelu weights", "fused depthwiseConv2d"));
    var T2 = function(F13, N2) {
      Dr(Rb(u2), function() {
        return "Error in gradient of fused depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations " + ("'" + u2 + "'");
      });
      var D2 = hi(N2, 4), I2 = D2[0], O2 = D2[1], L2 = D2[2], V2 = D2[3], W2 = N3(F13, L2, p), X2 = hve(O2.shape, W2, I2, a, o, u2, c), Y2 = cve(O2, W2, I2.shape, a, o, u2, c);
      if (V2 != null) {
        var K2 = F32(_5, W2);
        return [X2, Y2, K2];
      }
      return [X2, Y2];
    }, A2 = { x: b, filter: x, bias: _5, preluActivationWeights: k }, S2 = { strides: a, pad: o, dataFormat: i, dilations: u2, dimRoundingMode: c, activation: p, leakyreluAlpha: v };
    if (f == null) {
      var C2 = zd(function(F13, N2, D2) {
        var I2 = Xr.runKernel(o4, A2, S2);
        return D2([N2, F13, I2]), y && (I2 = ga(I2, [I2.shape[1], I2.shape[2], I2.shape[3]])), { value: I2, gradFunc: T2 };
      });
      return C2(b, x);
    } else {
      var E2 = zd(function(F13, N2, D2, I2) {
        var O2 = Xr.runKernel(o4, A2, S2);
        return I2([N2, F13, O2, D2]), y && (O2 = ga(O2, [O2.shape[1], O2.shape[2], O2.shape[3]])), { value: O2, gradFunc: T2 };
      });
      return E2(b, x, _5);
    }
  }
  var dve = Hr({ fusedDepthwiseConv2d_: pve });
  function vve(e) {
    var t, r, n = e.a, a = e.b, o = e.transposeA, s = o === void 0 ? false : o, i = e.transposeB, l = i === void 0 ? false : i, u2 = e.bias, c = e.activation, f = c === void 0 ? "linear" : c, h = e.preluActivationWeights, p = e.leakyreluAlpha;
    if (P3(Xr.state.gradientDepth, f) === false) {
      var d = gs(n, a, s, l);
      return u2 != null && (d = Hi(d, u2)), O3(d, f, h, p);
    }
    var v = mr(n, "a", "fused matMul"), m = mr(a, "b", "fused matMul");
    t = hi(Bl(v, m), 2), v = t[0], m = t[1];
    var g = s ? v.shape[v.rank - 2] : v.shape[v.rank - 1], x = l ? m.shape[m.rank - 1] : m.shape[m.rank - 2], b = s ? v.shape[v.rank - 1] : v.shape[v.rank - 2], y = l ? m.shape[m.rank - 2] : m.shape[m.rank - 1], w = v.shape.slice(0, -2), _5 = m.shape.slice(0, -2), k = Ml(w), T2 = Ml(_5);
    Dr(g === x, function() {
      return "Error in fused matMul: inner shapes (" + g + ") and (" + (x + ") of Tensors with shapes " + v.shape + " and ") + (m.shape + " and transposeA=" + s) + (" and transposeB=" + l + " must match.");
    });
    var A2 = ju(v.shape.slice(0, -2), m.shape.slice(0, -2)), S2 = A2.concat([b, y]), C2 = s ? ga(v, [k, g, b]) : ga(v, [k, b, g]), E2 = l ? ga(m, [T2, y, x]) : ga(m, [T2, x, y]), F13;
    u2 != null && (F13 = mr(u2, "bias", "fused matMul"), r = hi(Bl(F13, v), 1), F13 = r[0], ju(S2, F13.shape));
    var N2;
    h != null && (N2 = mr(h, "prelu weights", "fused matMul"));
    var D2 = function(W2, X2) {
      var Y2 = hi(X2, 4), K2 = Y2[0], q = Y2[1], re = Y2[2], R2 = Y2[3], z = N3(ga(W2, re.shape), re, f), H2, te;
      if (!s && !l ? (H2 = gs(z, q, false, true), te = gs(K2, z, true, false)) : !s && l ? (H2 = gs(z, q, false, false), te = gs(z, K2, true, false)) : s && !l ? (H2 = gs(q, z, false, true), te = gs(K2, z, false, false)) : (H2 = gs(q, z, true, true), te = gs(z, K2, true, true)), u2 != null) {
        var j = F32(R2, z);
        return [H2, te, j];
      } else return [H2, te];
    }, I2 = { a: C2, b: E2, bias: F13, preluActivationWeights: N2 }, O2 = { transposeA: s, transposeB: l, activation: f, leakyreluAlpha: p };
    if (u2 == null) {
      var L2 = zd(function(W2, X2, Y2) {
        var K2 = Xr.runKernel(a4, I2, O2);
        return Y2([W2, X2, K2]), { value: ga(K2, S2), gradFunc: D2 };
      });
      return L2(C2, E2);
    } else {
      var V2 = zd(function(W2, X2, Y2, K2) {
        var q = Xr.runKernel(a4, I2, O2);
        return K2([W2, X2, q, Y2]), { value: ga(q, S2), gradFunc: D2 };
      });
      return V2(C2, E2, F13);
    }
  }
  var mve = Hr({ fusedMatMul_: vve });
  var gve = { __proto__: null, conv2d: lve, depthwiseConv2d: dve, matMul: mve };
  function yve(e) {
    return s5(e, 0.54, 0.46);
  }
  var xve = Hr({ hammingWindow_: yve });
  function bve(e) {
    return s5(e, 0.5, 0.5);
  }
  var Kz = Hr({ hannWindow_: bve });
  function _ve(e, t, r, n, a) {
    n === void 0 && (n = false), a === void 0 && (a = 0);
    for (var o = 0, s = []; o + t <= e.size; ) s.push(Cl(e, o, t)), o += r;
    if (n) for (; o < e.size; ) {
      var i = o + t - e.size, l = eh([Cl(e, o, t - i), D3([i], a)]);
      s.push(l), o += r;
    }
    return s.length === 0 ? Ib([], [0, t]) : ga(eh(s), [s.length, t]);
  }
  var Yz = Hr({ frame_: _ve });
  function wve(e, t, r, n, a) {
    a === void 0 && (a = Kz), n == null && (n = Xz(t));
    var o = Yz(e, t, r), s = Xa(o, a(t));
    return n5(s, n);
  }
  var kve = Hr({ stft_: wve });
  function Tve(e, t, r, n, a, o) {
    a === void 0 && (a = "bilinear"), o === void 0 && (o = 0);
    var s = mr(e, "image", "cropAndResize"), i = mr(t, "boxes", "cropAndResize", "float32"), l = mr(r, "boxInd", "cropAndResize", "int32"), u2 = i.shape[0];
    Dr(s.rank === 4, function() {
      return "Error in cropAndResize: image must be rank 4," + ("but got rank " + s.rank + ".");
    }), Dr(i.rank === 2 && i.shape[1] === 4, function() {
      return "Error in cropAndResize: boxes must be have size [" + u2 + ",4] " + ("but had shape " + i.shape + ".");
    }), Dr(l.rank === 1 && l.shape[0] === u2, function() {
      return "Error in cropAndResize: boxInd must be have size [" + u2 + "] " + ("but had shape " + i.shape + ".");
    }), Dr(n.length === 2, function() {
      return "Error in cropAndResize: cropSize must be of length 2, but got " + ("length " + n.length + ".");
    }), Dr(n[0] >= 1 && n[1] >= 1, function() {
      return "cropSize must be atleast [1,1], but was " + n;
    }), Dr(a === "bilinear" || a === "nearest", function() {
      return "method must be bilinear or nearest, but was " + a;
    });
    var c = { image: s, boxes: i, boxInd: l }, f = { method: a, extrapolationValue: o, cropSize: n }, h = Xr.runKernel(vR, c, f);
    return h;
  }
  var Ave = Hr({ cropAndResize_: Tve });
  function Sve(e) {
    var t = mr(e, "image", "flipLeftRight", "float32");
    Dr(t.rank === 4, function() {
      return "Error in flipLeftRight: image must be rank 4," + ("but got rank " + t.rank + ".");
    });
    var r = { image: t }, n = Xr.runKernel(FR, r, {});
    return n;
  }
  var Eve = Hr({ flipLeftRight_: Sve });
  function Dve(e) {
    var t = mr(e, "image", "grayscaleToRGB"), r = t.rank - 1, n = t.shape[r];
    Dr(t.rank >= 2, function() {
      return "Error in grayscaleToRGB: images must be at least rank 2, " + ("but got rank " + t.rank + ".");
    }), Dr(n === 1, function() {
      return "Error in grayscaleToRGB: last dimension of a grayscale image " + ("should be size 1, but got size " + n + ".");
    });
    var a = new Array(t.rank);
    return a.fill(1, 0, r), a[r] = 3, Mb(t, a);
  }
  var Cve = Hr({ grayscaleToRGB_: Dve });
  function Mve(e, t, r, n) {
    r === void 0 && (r = 0), n === void 0 && (n = 0.5);
    var a = mr(e, "image", "rotateWithOffset", "float32");
    Dr(a.rank === 4, function() {
      return "Error in rotateWithOffset: image must be rank 4," + ("but got rank " + a.rank + ".");
    });
    var o = { image: a }, s = { radians: t, fillValue: r, center: n }, i = Xr.runKernel(y9, o, s);
    return i;
  }
  var Ive = Hr({ rotateWithOffset_: Mve });
  function iy(e, t, r, n, a, o) {
    n == null && (n = 0.5), a == null && (a = Number.NEGATIVE_INFINITY), o == null && (o = 0);
    var s = e.shape[0];
    return r = Math.min(r, s), Dr(0 <= n && n <= 1, function() {
      return "iouThreshold must be in [0, 1], but was '" + n + "'";
    }), Dr(e.rank === 2, function() {
      return "boxes must be a 2D tensor, but was of rank '" + e.rank + "'";
    }), Dr(e.shape[1] === 4, function() {
      return "boxes must have 4 columns, but 2nd dimension was " + e.shape[1];
    }), Dr(t.rank === 1, function() {
      return "scores must be a 1D tensor";
    }), Dr(t.shape[0] === s, function() {
      return "scores has incompatible shape with boxes. Expected " + s + ", " + ("but was " + t.shape[0]);
    }), Dr(0 <= o && o <= 1, function() {
      return "softNmsSigma must be in [0, 1], but was '" + o + "'";
    }), { maxOutputSize: r, iouThreshold: n, scoreThreshold: a, softNmsSigma: o };
  }
  function Nve(e, t, r, n, a) {
    n === void 0 && (n = 0.5), a === void 0 && (a = Number.NEGATIVE_INFINITY);
    var o = mr(e, "boxes", "nonMaxSuppression", "float32"), s = mr(t, "scores", "nonMaxSuppression", "float32"), i = iy(o, s, r, n, a);
    r = i.maxOutputSize, n = i.iouThreshold, a = i.scoreThreshold;
    var l = { maxOutputSize: r, iouThreshold: n, scoreThreshold: a };
    return Xr.runKernel(m7, { boxes: o, scores: s }, l);
  }
  var Fve = Hr({ nonMaxSuppression_: Nve });
  function Ove(e, t, r) {
    var n = Pve(e, t, r), a = n < 0 ? -(n + 1) : n;
    e.splice(a, 0, t);
  }
  function Pve(e, t, r) {
    return Rve(e, t, r || Lve);
  }
  function Lve(e, t) {
    return e > t ? 1 : e < t ? -1 : 0;
  }
  function Rve(e, t, r) {
    for (var n = 0, a = e.length, o = 0, s = false; n < a; ) {
      o = n + (a - n >>> 1);
      var i = r(t, e[o]);
      i > 0 ? n = o + 1 : (a = o, s = !i);
    }
    return s ? n : -n - 1;
  }
  function Zz(e, t, r, n, a) {
    return l5(e, t, r, n, a, 0);
  }
  function Jz(e, t, r, n, a, o) {
    return l5(e, t, r, n, a, 0, false, o, true);
  }
  function Qz(e, t, r, n, a, o) {
    return l5(e, t, r, n, a, o, true);
  }
  function l5(e, t, r, n, a, o, s, i, l) {
    s === void 0 && (s = false), i === void 0 && (i = false), l === void 0 && (l = false);
    for (var u2 = [], c = 0; c < t.length; c++) t[c] > a && u2.push({ score: t[c], boxIndex: c, suppressBeginIndex: 0 });
    u2.sort(bL);
    for (var f = o > 0 ? -0.5 / o : 0, h = [], p = []; h.length < r && u2.length > 0; ) {
      var d = u2.pop(), v = d.score, m = d.boxIndex, g = d.suppressBeginIndex;
      if (v < a) break;
      for (var x = false, b = h.length - 1; b >= g; --b) {
        var y = zve(e, m, h[b]);
        if (y >= n) {
          x = true;
          break;
        }
        if (d.score = d.score * Bve(n, f, y), d.score <= a) break;
      }
      d.suppressBeginIndex = h.length, x || (d.score === v ? (h.push(m), p.push(d.score)) : d.score > a && Ove(u2, d, bL));
    }
    var w = h.length, _5 = r - w;
    i && _5 > 0 && (h.push.apply(h, ys(new Array(_5).fill(0))), p.push.apply(p, ys(new Array(_5).fill(0))));
    var k = { selectedIndices: h };
    return s && (k.selectedScores = p), l && (k.validOutputs = w), k;
  }
  function zve(e, t, r) {
    var n = e.subarray(t * 4, t * 4 + 4), a = e.subarray(r * 4, r * 4 + 4), o = Math.min(n[0], n[2]), s = Math.min(n[1], n[3]), i = Math.max(n[0], n[2]), l = Math.max(n[1], n[3]), u2 = Math.min(a[0], a[2]), c = Math.min(a[1], a[3]), f = Math.max(a[0], a[2]), h = Math.max(a[1], a[3]), p = (i - o) * (l - s), d = (f - u2) * (h - c);
    if (p <= 0 || d <= 0) return 0;
    var v = Math.max(o, u2), m = Math.max(s, c), g = Math.min(i, f), x = Math.min(l, h), b = Math.max(g - v, 0) * Math.max(x - m, 0);
    return b / (p + d - b);
  }
  function Bve(e, t, r) {
    var n = Math.exp(t * r * r);
    return r <= e ? n : 0;
  }
  function bL(e, t) {
    return e.score - t.score || e.score === t.score && t.boxIndex - e.boxIndex;
  }
  function Uve(e, t, r, n, a) {
    return n === void 0 && (n = 0.5), a === void 0 && (a = Number.NEGATIVE_INFINITY), xi(this, void 0, void 0, function() {
      var o, s, i, l, u2, c, f;
      return bi(this, function(h) {
        switch (h.label) {
          case 0:
            return o = mr(e, "boxes", "nonMaxSuppressionAsync"), s = mr(t, "scores", "nonMaxSuppressionAsync"), i = iy(o, s, r, n, a), r = i.maxOutputSize, n = i.iouThreshold, a = i.scoreThreshold, [4, Promise.all([o.data(), s.data()])];
          case 1:
            return l = h.sent(), u2 = l[0], c = l[1], f = Zz(u2, c, r, n, a).selectedIndices, o !== e && o.dispose(), s !== t && s.dispose(), [2, Kp(f, "int32")];
        }
      });
    });
  }
  var Vve = Uve;
  function jve(e, t, r, n, a, o) {
    n === void 0 && (n = 0.5), a === void 0 && (a = Number.NEGATIVE_INFINITY), o === void 0 && (o = 0);
    var s = mr(e, "boxes", "nonMaxSuppression"), i = mr(t, "scores", "nonMaxSuppression"), l = iy(s, i, r, n, a, o);
    r = l.maxOutputSize, n = l.iouThreshold, a = l.scoreThreshold, o = l.softNmsSigma;
    var u2 = { boxes: s, scores: i }, c = { maxOutputSize: r, iouThreshold: n, scoreThreshold: a, softNmsSigma: o }, f = Xr.runKernel(y7, u2, c);
    return { selectedIndices: f[0], selectedScores: f[1] };
  }
  var Wve = Hr({ nonMaxSuppressionWithScore_: jve });
  function Gve(e, t, r, n, a, o) {
    return n === void 0 && (n = 0.5), a === void 0 && (a = Number.NEGATIVE_INFINITY), o === void 0 && (o = 0), xi(this, void 0, void 0, function() {
      var s, i, l, u2, c, f, h, p, d;
      return bi(this, function(v) {
        switch (v.label) {
          case 0:
            return s = mr(e, "boxes", "nonMaxSuppressionAsync"), i = mr(t, "scores", "nonMaxSuppressionAsync"), l = iy(s, i, r, n, a, o), r = l.maxOutputSize, n = l.iouThreshold, a = l.scoreThreshold, o = l.softNmsSigma, [4, Promise.all([s.data(), i.data()])];
          case 1:
            return u2 = v.sent(), c = u2[0], f = u2[1], h = Qz(c, f, r, n, a, o), p = h.selectedIndices, d = h.selectedScores, s !== e && s.dispose(), i !== t && i.dispose(), [2, { selectedIndices: Kp(p, "int32"), selectedScores: Kp(d) }];
        }
      });
    });
  }
  var $ve = Gve;
  function Hve(e, t, r, n, a, o) {
    n === void 0 && (n = 0.5), a === void 0 && (a = Number.NEGATIVE_INFINITY), o === void 0 && (o = false);
    var s = mr(e, "boxes", "nonMaxSuppression"), i = mr(t, "scores", "nonMaxSuppression"), l = iy(s, i, r, n, a, null), u2 = l.maxOutputSize, c = l.iouThreshold, f = l.scoreThreshold, h = { boxes: s, scores: i }, p = { maxOutputSize: u2, iouThreshold: c, scoreThreshold: f, padToMaxOutputSize: o }, d = Xr.runKernel(g7, h, p);
    return { selectedIndices: d[0], validOutputs: d[1] };
  }
  var qve = Hr({ nonMaxSuppressionPadded_: Hve });
  function Xve(e, t, r, n, a, o) {
    return n === void 0 && (n = 0.5), a === void 0 && (a = Number.NEGATIVE_INFINITY), o === void 0 && (o = false), xi(this, void 0, void 0, function() {
      var s, i, l, u2, c, f, h, p, d, v, m, g;
      return bi(this, function(x) {
        switch (x.label) {
          case 0:
            return s = mr(e, "boxes", "nonMaxSuppressionAsync"), i = mr(t, "scores", "nonMaxSuppressionAsync"), l = iy(s, i, r, n, a, null), u2 = l.maxOutputSize, c = l.iouThreshold, f = l.scoreThreshold, [4, Promise.all([s.data(), i.data()])];
          case 1:
            return h = hi.apply(void 0, [x.sent(), 2]), p = h[0], d = h[1], v = Jz(p, d, u2, c, f, o), m = v.selectedIndices, g = v.validOutputs, s !== e && s.dispose(), i !== t && i.dispose(), [2, { selectedIndices: Kp(m, "int32"), validOutputs: xs(g, "int32") }];
        }
      });
    });
  }
  var Kve = Xve;
  function Yve(e, t, r, n) {
    r === void 0 && (r = false), n === void 0 && (n = false);
    var a = mr(e, "images", "resizeBilinear");
    Dr(a.rank === 3 || a.rank === 4, function() {
      return "Error in resizeBilinear: x must be rank 3 or 4, but got " + ("rank " + a.rank + ".");
    }), Dr(t.length === 2, function() {
      return "Error in resizeBilinear: new shape must 2D, but got shape " + (t + ".");
    }), Dr(n === false || r === false, function() {
      return "Error in resizeBilinear: If halfPixelCenters is true, alignCorners must be false.";
    });
    var o = a, s = false;
    a.rank === 3 && (s = true, o = ga(a, [1, a.shape[0], a.shape[1], a.shape[2]])), hi(t, 0);
    var i = { images: o }, l = { alignCorners: r, halfPixelCenters: n, size: t }, u2 = Xr.runKernel(N7, i, l);
    return s ? ga(u2, [u2.shape[1], u2.shape[2], u2.shape[3]]) : u2;
  }
  var Zve = Hr({ resizeBilinear_: Yve });
  function Jve(e, t, r, n) {
    r === void 0 && (r = false), n === void 0 && (n = false);
    var a = mr(e, "images", "resizeNearestNeighbor");
    Dr(a.rank === 3 || a.rank === 4, function() {
      return "Error in resizeNearestNeighbor: x must be rank 3 or 4, but got " + ("rank " + a.rank + ".");
    }), Dr(t.length === 2, function() {
      return "Error in resizeNearestNeighbor: new shape must 2D, but got shape " + (t + ".");
    }), Dr(a.dtype === "float32" || a.dtype === "int32", function() {
      return "`images` must have `int32` or `float32` as dtype";
    }), Dr(n === false || r === false, function() {
      return "Error in resizeNearestNeighbor: If halfPixelCenters is true, alignCorners must be false.";
    });
    var o = a, s = false;
    a.rank === 3 && (s = true, o = ga(a, [1, a.shape[0], a.shape[1], a.shape[2]])), hi(t, 0);
    var i = { images: o }, l = { alignCorners: r, halfPixelCenters: n, size: t }, u2 = Xr.runKernel(I7, i, l);
    return s ? ga(u2, [u2.shape[1], u2.shape[2], u2.shape[3]]) : u2;
  }
  var Qve = Hr({ resizeNearestNeighbor_: Jve });
  function eme(e, t, r, n) {
    var a;
    t === void 0 && (t = "binary"), r === void 0 && (r = false), n === void 0 && (n = 0.5);
    var o = mr(e, "image", "threshold"), s = 0.2989, i = 0.587, l = 0.114, u2 = o.shape[0] * o.shape[1], c = Xa(Kp([n]), 255), f, h, p, d;
    if (Dr(o.rank === 3, function() {
      return "Error in threshold: image must be rank 3," + ("but got rank " + o.rank + ".");
    }), Dr(o.shape[2] === 3 || o.shape[2] === 1, function() {
      return "Error in threshold: image color channel must be equal to 3 or 1" + ("but got " + o.shape[2] + ".");
    }), Dr(o.dtype === "int32" || o.dtype === "float32", function() {
      return "Error in dtype: image dtype must be int32 or float32," + ("but got dtype " + o.dtype + ".");
    }), Dr(t === "otsu" || t === "binary", function() {
      return "Method must be binary or otsu, but was " + t;
    }), o.shape[2] === 3) {
      a = hi(Vb(o, [1, 1, 1], -1), 3), f = a[0], h = a[1], p = a[2];
      var v = Xa(f, s), m = Xa(h, i), g = Xa(p, l);
      d = Hi(Hi(v, m), g);
    } else d = e;
    if (t === "otsu") {
      var x = gz(iu(Vz(d), "int32"), X1([]), 256);
      c = tme(x, u2);
    }
    var b = r ? J4(d, c) : C3(d, c), y = iu(Xa(b, 255), "int32");
    return y;
  }
  function tme(e, t) {
    for (var r = Kp([-1]), n = Kp([0]), a = Kp([0]), o, s, i, l, u2, c, f = 0; f < e.size - 1; f++) {
      o = Cl(e, 0, f + 1), s = Cl(e, f + 1), u2 = cl(ul(o), t), c = cl(ul(s), t);
      var h = ul(Xa(o, Ub(0, o.size)));
      i = cl(h, ul(o));
      var p = D3(s.shape, o.size), d = Hi(Ub(0, s.size), p), v = Xa(s, d);
      l = cl(ul(v), ul(s));
      var m = Ao(i, l), g = Ao(i, l), x = Xa(u2, c);
      a = Xa(Xa(x, m), g);
      var b = C3(a, n);
      n = ry(b, a, n), r = ry(b, Kp([f]), r);
    }
    return r;
  }
  var rme = Hr({ threshold_: eme });
  function nme(e, t, r, n, a, o) {
    r === void 0 && (r = "nearest"), n === void 0 && (n = "constant"), a === void 0 && (a = 0);
    var s = mr(e, "image", "transform", "float32"), i = mr(t, "transforms", "transform", "float32");
    Dr(s.rank === 4, function() {
      return "Error in transform: image must be rank 4," + ("but got rank " + s.rank + ".");
    }), Dr(i.rank === 2 && (i.shape[0] === s.shape[0] || i.shape[0] === 1) && i.shape[1] === 8, function() {
      return "Error in transform: Input transform should be batch x 8 or 1 x 8";
    }), Dr(o == null || o.length === 2, function() {
      return "Error in transform: outputShape must be [height, width] or null, " + ("but got " + o + ".");
    });
    var l = { image: s, transforms: i }, u2 = { interpolation: r, fillMode: n, fillValue: a, outputShape: o };
    return Xr.runKernel(f9, l, u2);
  }
  var ame = Hr({ transform_: nme });
  function ime(e, t, r) {
    Dr(t % 1 === 0, function() {
      return "bandPart(): numLower must be an integer, got " + t + ".";
    }), Dr(r % 1 === 0, function() {
      return "bandPart(): numUpper must be an integer, got " + r + ".";
    });
    var n = mr(e, "a", "bandPart");
    Dr(n.rank >= 2, function() {
      return "bandPart(): Rank must be at least 2, got " + n.rank + ".";
    });
    var a = n.shape, o = hi(n.shape.slice(-2), 2), s = o[0], i = o[1];
    if (!(t <= s)) throw new Error("bandPart(): numLower (" + t + ")" + (" must not be greater than the number of rows (" + s + ")."));
    if (!(r <= i)) throw new Error("bandPart(): numUpper (" + r + ")" + (" must not be greater than the number of columns (" + i + ")."));
    t < 0 && (t = s), r < 0 && (r = i);
    var l = ga(Ub(0, s, 1, "int32"), [-1, 1]), u2 = Ub(0, i, 1, "int32"), c = Ao(l, u2), f = y3(J4(c, xs(+t, "int32")), Tz(c, xs(-r, "int32"))), h = ny([s, i], n.dtype);
    return ga(jb(i5(ga(n, [-1, s, i])).map(function(p) {
      return ry(f, p, h);
    })), a);
  }
  var ome = Hr({ bandPart_: ime });
  function sme(e) {
    var t;
    if (Array.isArray(e)) {
      t = false, Dr(e != null && e.length > 0, function() {
        return "Gram-Schmidt process: input must not be null, undefined, or empty";
      });
      for (var r = e[0].shape[0], n = function(l) {
        Dr(e[l].shape[0] === r, function() {
          return "Gram-Schmidt: Non-unique lengths found in the input vectors: " + ("(" + e[l].shape[0] + " vs. " + r + ")");
        });
      }, a = 1; a < e.length; ++a) n(a);
    } else t = true, e = Vb(e, e.shape[0], 0).map(function(l) {
      return a5(l, [0]);
    });
    Dr(e.length <= e[0].shape[0], function() {
      return "Gram-Schmidt: Number of vectors (" + e.length + ") exceeds " + ("number of dimensions (" + e[0].shape[0] + ").");
    });
    for (var o = [], s = e, i = function(l) {
      o.push(Xr.tidy(function() {
        var u2 = s[l];
        if (l > 0) for (var c = 0; c < l; ++c) {
          var f = Xa(ul(Xa(o[c], u2)), o[c]);
          u2 = Ao(u2, f);
        }
        return cl(u2, o5(u2, "euclidean"));
      }));
    }, a = 0; a < e.length; ++a) i(a);
    return t ? jb(o, 0) : o;
  }
  var lme = Hr({ gramSchmidt_: sme });
  function ume(e, t) {
    if (t === void 0 && (t = false), Dr(e.rank >= 2, function() {
      return "qr() requires input tensor to have a rank >= 2, but got rank " + e.rank;
    }), e.rank === 2) return _L(e, t);
    var r = e.shape.slice(0, e.shape.length - 2).reduce(function(l, u2) {
      return l * u2;
    }), n = i5(ga(e, [r, e.shape[e.shape.length - 2], e.shape[e.shape.length - 1]]), 0), a = [], o = [];
    n.forEach(function(l) {
      var u2 = hi(_L(l, t), 2), c = u2[0], f = u2[1];
      a.push(c), o.push(f);
    });
    var s = ga(jb(a, 0), e.shape), i = ga(jb(o, 0), e.shape);
    return [s, i];
  }
  function _L(e, t) {
    return t === void 0 && (t = false), Xr.tidy(function() {
      Dr(e.shape.length === 2, function() {
        return "qr2d() requires a 2D Tensor, but got a " + e.shape.length + "D Tensor.";
      });
      for (var r = e.shape[0], n = e.shape[1], a = _z(r), o = Im(e), s = Ib([[1]], [1, 1]), i = Im(s), l = r >= n ? n : r, u2 = function(f) {
        var h, p = o, d = i, v = a;
        h = hi(Xr.tidy(function() {
          var m = Cl(o, [f, f], [r - f, 1]), g = o5(m), x = Cl(o, [f, f], [1, 1]), b = ry(C3(x, 0), Ib([[-1]]), Ib([[1]])), y = Ao(x, Xa(b, g)), w = cl(m, y);
          w.shape[0] === 1 ? i = Im(s) : i = eh([s, Cl(w, [1, 0], [w.shape[0] - 1, w.shape[1]])], 0);
          var _5 = pv(cl(gs(b, y), g)), k = Cl(o, [f, 0], [r - f, n]), T2 = Xa(_5, i), A2 = m3(i);
          if (f === 0) o = Ao(k, gs(T2, gs(A2, k)));
          else {
            var S2 = Ao(k, gs(T2, gs(A2, k)));
            o = eh([Cl(o, [0, 0], [f, n]), S2], 0);
          }
          var C2 = m3(T2), E2 = Cl(a, [0, f], [r, a.shape[1] - f]);
          if (f === 0) a = Ao(E2, gs(gs(E2, i), C2));
          else {
            var F13 = Ao(E2, gs(gs(E2, i), C2));
            a = eh([Cl(a, [0, 0], [r, f]), F13], 1);
          }
          return [i, o, a];
        }), 3), i = h[0], o = h[1], a = h[2], If([p, d, v]);
      }, c = 0; c < l; ++c) u2(c);
      return !t && r > n && (a = Cl(a, [0, 0], [r, n]), o = Cl(o, [0, 0], [n, n])), [a, o];
    });
  }
  var cme = Hr({ qr_: ume });
  Gt.Reduction = void 0;
  (function(e) {
    e[e.NONE = 0] = "NONE", e[e.MEAN = 1] = "MEAN", e[e.SUM = 2] = "SUM", e[e.SUM_BY_NONZERO_WEIGHTS = 3] = "SUM_BY_NONZERO_WEIGHTS";
  })(Gt.Reduction || (Gt.Reduction = {}));
  function fme(e, t, r) {
    r === void 0 && (r = Gt.Reduction.SUM_BY_NONZERO_WEIGHTS);
    var n = mr(e, "losses", "computeWeightedLoss"), a = null;
    t != null && (a = mr(t, "weights", "computeWeightedLoss"));
    var o = a == null ? n : Xa(n, a);
    if (r === Gt.Reduction.NONE) return o;
    if (r === Gt.Reduction.SUM) return ul(o);
    if (r === Gt.Reduction.MEAN) {
      if (a == null) return x3(o);
      var s = n.size / a.size, i = cl(ul(o), ul(a));
      return s > 1 ? cl(i, xs(s)) : i;
    }
    if (r === Gt.Reduction.SUM_BY_NONZERO_WEIGHTS) {
      if (a == null) return cl(ul(o), xs(n.size));
      var l = Xa(a, Mm(n.shape)), u2 = iu(ul(Lz(l, xs(0))), "float32");
      return cl(ul(o), u2);
    }
    throw Error("Unknown reduction: " + r);
  }
  var b0 = Hr({ computeWeightedLoss_: fme });
  function hme(e, t, r, n) {
    n === void 0 && (n = Gt.Reduction.SUM_BY_NONZERO_WEIGHTS);
    var a = mr(e, "labels", "absoluteDifference"), o = mr(t, "predictions", "absoluteDifference"), s = null;
    r != null && (s = mr(r, "weights", "absoluteDifference")), nf(a.shape, o.shape, "Error in absoluteDifference: ");
    var i = Sh(Ao(a, o));
    return b0(i, s, n);
  }
  var pme = Hr({ absoluteDifference_: hme });
  function dme(e, t, r, n, a) {
    a === void 0 && (a = Gt.Reduction.SUM_BY_NONZERO_WEIGHTS);
    var o = mr(e, "labels", "cosineDistance"), s = mr(t, "predictions", "cosineDistance"), i = null;
    n != null && (i = mr(n, "weights", "cosineDistance")), nf(o.shape, s.shape, "Error in cosineDistance: ");
    var l = xs(1), u2 = Ao(l, ul(Xa(o, s), r, true));
    return b0(u2, i, a);
  }
  var vme = Hr({ cosineDistance_: dme });
  function mme(e, t, r, n) {
    n === void 0 && (n = Gt.Reduction.SUM_BY_NONZERO_WEIGHTS);
    var a = mr(e, "labels", "hingeLoss"), o = mr(t, "predictions", "hingeLoss"), s = null;
    r != null && (s = mr(r, "weights", "hingeLoss")), nf(a.shape, o.shape, "Error in hingeLoss: ");
    var i = xs(1);
    a = Ao(Xa(xs(2), a), i);
    var l = I3(Ao(i, Xa(a, o)));
    return b0(l, s, n);
  }
  var gme = Hr({ hingeLoss_: mme });
  function yme(e, t, r, n, a) {
    n === void 0 && (n = 1), a === void 0 && (a = Gt.Reduction.SUM_BY_NONZERO_WEIGHTS);
    var o = mr(e, "labels", "huberLoss"), s = mr(t, "predictions", "huberLoss"), i = null;
    r != null && (i = mr(r, "weights", "huberLoss")), nf(o.shape, s.shape, "Error in huberLoss: ");
    var l = xs(n), u2 = Sh(Ao(s, o)), c = Pz(u2, l), f = Ao(u2, c), h = Hi(Xa(xs(0.5), Yp(c)), Xa(l, f));
    return b0(h, i, a);
  }
  var xme = Hr({ huberLoss_: yme });
  function bme(e, t, r, n, a) {
    n === void 0 && (n = 1e-7), a === void 0 && (a = Gt.Reduction.SUM_BY_NONZERO_WEIGHTS);
    var o = mr(e, "labels", "logLoss"), s = mr(t, "predictions", "logLoss"), i = null;
    r != null && (i = mr(r, "weights", "logLoss")), nf(o.shape, s.shape, "Error in logLoss: ");
    var l = xs(1), u2 = xs(n), c = pv(Xa(o, zb(Hi(s, u2)))), f = Xa(Ao(l, o), zb(Hi(Ao(l, s), u2))), h = Ao(c, f);
    return b0(h, i, a);
  }
  var _me = Hr({ logLoss_: bme });
  function wme(e, t, r, n) {
    n === void 0 && (n = Gt.Reduction.SUM_BY_NONZERO_WEIGHTS);
    var a = mr(e, "labels", "meanSquaredError"), o = mr(t, "predictions", "meanSquaredError"), s = null;
    r != null && (s = mr(r, "weights", "meanSquaredError")), nf(a.shape, o.shape, "Error in meanSquaredError: ");
    var i = Wz(a, o);
    return b0(i, s, n);
  }
  var kme = Hr({ meanSquaredError_: wme });
  function Tme(e, t) {
    var r = mr(e, "labels", "sigmoidCrossEntropyWithLogits"), n = mr(t, "logits", "sigmoidCrossEntropyWithLogits");
    nf(r.shape, n.shape, "Error in sigmoidCrossEntropyWithLogits: ");
    var a = I3(n), o = Xa(n, r), s = Sz(Rm(pv(Sh(n))));
    return Hi(Ao(a, o), s);
  }
  function Ame(e, t, r, n, a) {
    n === void 0 && (n = 0), a === void 0 && (a = Gt.Reduction.SUM_BY_NONZERO_WEIGHTS);
    var o = mr(e, "multiClassLabels", "sigmoidCrossEntropy"), s = mr(t, "logits", "sigmoidCrossEntropy"), i = null;
    if (r != null && (i = mr(r, "weights", "sigmoidCrossEntropy")), nf(o.shape, s.shape, "Error in sigmoidCrossEntropy: "), n > 0) {
      var l = xs(n), u2 = xs(1), c = xs(0.5);
      o = Hi(Xa(o, Ao(u2, l)), Xa(c, l));
    }
    var f = Tme(o, s);
    return b0(f, i, a);
  }
  var Sme = Hr({ sigmoidCrossEntropy_: Ame });
  function Eme(e, t, r) {
    if (r === void 0 && (r = -1), r === -1 && (r = t.rank - 1), r !== t.rank - 1) throw Error("Softmax cross entropy along a non-last dimension is not yet " + ("supported. Labels / logits was rank " + t.rank + " ") + ("and dim was " + r));
    var n = zd(function(a, o, s) {
      var i = true, l = Mz(o, [r], i), u2 = Ao(iu(o, "float32"), l);
      s([a, u2]);
      var c = pv(Xa(u2, a)), f = ul(c, [r]), h = function(p, d) {
        var v = hi(d, 2), m = v[0], g = v[1], x = Xb(p.shape, [r]);
        return [Xa(ga(p, x), Ao(iu(m, "float32"), Rm(g))), Xa(ga(p, x), Ao(Rm(g), iu(m, "float32")))];
      };
      return { value: f, gradFunc: h };
    });
    return n(e, t);
  }
  function Dme(e, t, r, n, a) {
    n === void 0 && (n = 0), a === void 0 && (a = Gt.Reduction.SUM_BY_NONZERO_WEIGHTS);
    var o = mr(e, "onehotLabels", "softmaxCrossEntropy"), s = mr(t, "logits", "softmaxCrossEntropy"), i = null;
    if (r != null && (i = mr(r, "weights", "softmaxCrossEntropy")), nf(o.shape, s.shape, "Error in softmaxCrossEntropy: "), n > 0) {
      var l = xs(n), u2 = xs(1), c = xs(o.shape[1]);
      o = Hi(Xa(o, Ao(u2, l)), cl(l, c));
    }
    var f = Eme(o, s);
    return b0(f, i, a);
  }
  var Cme = Hr({ softmaxCrossEntropy_: Dme });
  function Mme(e, t, r, n) {
    var a = mr(e, "indices", "sparseFillEmptyRows", "int32"), o = mr(t, "values", "sparseFillEmptyRows"), s = mr(r, "denseShape", "sparseFillEmptyRows", "int32"), i = mr(n, "defaultValue", "sparseFillEmptyRows", o.dtype);
    if (a.rank !== 2) throw new Error(`Indices should be Tensor2D but received shape
        ` + a.shape);
    if (o.rank !== 1) throw new Error("Values should be Tensor1D but received shape " + o.shape);
    if (s.rank !== 1) throw new Error("Dense shape should be Tensor1D but received shape " + s.shape);
    if (i.rank !== 0) throw new Error("Default value should be a scalar but received shape " + i.shape);
    var l = { indices: a, values: o, denseShape: s, defaultValue: i }, u2 = Xr.runKernel(Z7, l);
    return { outputIndices: u2[0], outputValues: u2[1], emptyRowIndicator: u2[2], reverseIndexMap: u2[3] };
  }
  var Ime = Hr({ sparseFillEmptyRows_: Mme });
  function Nme(e, t, r) {
    var n = mr(e, "inputIndices", "sparseReshape", "int32"), a = mr(t, "inputShape", "sparseReshape", "int32"), o = mr(r, "newShape", "sparseReshape", "int32");
    if (n.rank !== 2) throw new Error(`Input indices should be Tensor2D but received shape
        ` + n.shape);
    if (a.rank !== 1) throw new Error("Input shape should be Tensor1D but received shape " + a.shape);
    if (o.rank !== 1) throw new Error("New shape should be Tensor1D but received shape " + o.shape);
    var s = { inputIndices: n, inputShape: a, newShape: o }, i = Xr.runKernel(J7, s);
    return { outputIndices: i[0], outputShape: i[1] };
  }
  var Fme = Hr({ sparseReshape_: Nme });
  function Ome(e, t, r) {
    var n = mr(e, "data", "sparseSegmentMean"), a = mr(t, "indices", "sparseSegmentMean", "int32"), o = mr(r, "segmentIds", "sparseSegmentMean", "int32");
    if (n.rank < 1) throw new Error("Data should be at least 1 dimensional but received scalar");
    if (a.rank !== 1) throw new Error(`Indices should be Tensor1D but received shape
          ` + a.shape);
    if (o.rank !== 1) throw new Error(`Segment ids should be Tensor1D but received shape
          ` + o.shape);
    var s = { data: n, indices: a, segmentIds: o };
    return Xr.runKernel(Q7, s);
  }
  var Pme = Hr({ sparseSegmentMean_: Ome });
  function Lme(e, t, r) {
    var n = mr(e, "data", "sparseSegmentSum"), a = mr(t, "indices", "sparseSegmentSum", "int32"), o = mr(r, "segmentIds", "sparseSegmentSum", "int32");
    if (n.rank < 1) throw new Error("Data should be at least 1 dimensional but received scalar");
    if (a.rank !== 1) throw new Error(`Indices should be Tensor1D but received shape
         ` + a.shape);
    if (o.rank !== 1) throw new Error(`Segment ids should be Tensor1D but received shape
         ` + o.shape);
    var s = { data: n, indices: a, segmentIds: o };
    return Xr.runKernel(e9, s);
  }
  var Rme = Hr({ sparseSegmentSum_: Lme });
  function zme(e, t, r, n, a, o, s, i) {
    var l = mr(e, "data", "stringNGrams", "string");
    if (l.dtype !== "string") throw new Error("Data must be of datatype string");
    if (l.shape.length !== 1) throw new Error("Data must be a vector, saw: " + l.shape);
    var u2 = mr(t, "dataSplits", "stringNGrams");
    if (u2.dtype !== "int32") throw new Error("Data splits must be of datatype int32");
    var c = { separator: r, nGramWidths: n, leftPad: a, rightPad: o, padWidth: s, preserveShortSequences: i }, f = { data: l, dataSplits: u2 }, h = Xr.runKernel(a9, f, c);
    return { nGrams: h[0], nGramsSplits: h[1] };
  }
  var Bme = Hr({ stringNGrams_: zme });
  function Ume(e, t, r) {
    r === void 0 && (r = true);
    var n = mr(e, "input", "stringSplit", "string"), a = mr(t, "delimiter", "stringSplit", "string");
    if (n.rank !== 1) throw new Error("Input should be Tensor1D but received shape " + n.shape);
    if (a.rank !== 0) throw new Error("Delimiter should be a scalar but received shape " + a.shape);
    var o = { skipEmpty: r }, s = { input: n, delimiter: a }, i = Xr.runKernel(i9, s, o);
    return { indices: i[0], values: i[1], shape: i[2] };
  }
  var Vme = Hr({ stringSplit_: Ume });
  function jme(e, t) {
    var r = mr(e, "input", "stringToHashBucketFast", "string"), n = { numBuckets: t };
    if (t <= 0) throw new Error("Number of buckets must be at least 1");
    var a = { input: r };
    return Xr.runKernel(o9, a, n);
  }
  var Wme = Hr({ stringToHashBucketFast_: jme });
  var Gme = { fft: r5, ifft: _32, rfft: n5, irfft: jz }, $me = { hammingWindow: xve, hannWindow: Kz, frame: Yz, stft: kve }, Hme = { flipLeftRight: Eve, grayscaleToRGB: Cve, resizeNearestNeighbor: Qve, resizeBilinear: Zve, rotateWithOffset: Ive, cropAndResize: Ave, nonMaxSuppression: Fve, nonMaxSuppressionAsync: Vve, nonMaxSuppressionWithScore: Wve, nonMaxSuppressionWithScoreAsync: $ve, nonMaxSuppressionPadded: qve, nonMaxSuppressionPaddedAsync: Kve, threshold: rme, transform: ame }, qme = { bandPart: ome, gramSchmidt: lme, qr: cme }, Xme = { absoluteDifference: pme, computeWeightedLoss: b0, cosineDistance: vme, hingeLoss: gme, huberLoss: xme, logLoss: _me, meanSquaredError: kme, sigmoidCrossEntropy: Sme, softmaxCrossEntropy: Cme }, Kme = { sparseFillEmptyRows: Ime, sparseReshape: Fme, sparseSegmentMean: Pme, sparseSegmentSum: Rme }, Yme = { stringNGrams: Bme, stringSplit: Vme, stringToHashBucketFast: Wme }, xv = function(e) {
    y0(t, e);
    function t() {
      return e !== null && e.apply(this, arguments) || this;
    }
    return t.prototype.minimize = function(r, n, a) {
      n === void 0 && (n = false);
      var o = this.computeGradients(r, a), s = o.value, i = o.grads;
      if (a != null) {
        var l = a.map(function(u2) {
          return { name: u2.name, tensor: i[u2.name] };
        });
        this.applyGradients(l);
      } else this.applyGradients(i);
      return If(i), n ? s : (s.dispose(), null);
    }, Object.defineProperty(t.prototype, "iterations", { get: function() {
      return this.iterations_ == null && (this.iterations_ = 0), this.iterations_;
    }, enumerable: true, configurable: true }), t.prototype.incrementIterations = function() {
      this.iterations_ = this.iterations + 1;
    }, t.prototype.computeGradients = function(r, n) {
      return Ez(r, n);
    }, t.prototype.dispose = function() {
      this.iterations_ != null && If(this.iterations_);
    }, t.prototype.saveIterations = function() {
      return xi(this, void 0, void 0, function() {
        return bi(this, function(r) {
          return this.iterations_ == null && (this.iterations_ = 0), [2, { name: "iter", tensor: xs(this.iterations_, "int32") }];
        });
      });
    }, t.prototype.getWeights = function() {
      return xi(this, void 0, void 0, function() {
        return bi(this, function(r) {
          throw new Error("getWeights() is not implemented for this optimizer yet.");
        });
      });
    }, t.prototype.setWeights = function(r) {
      return xi(this, void 0, void 0, function() {
        return bi(this, function(n) {
          throw new Error("setWeights() is not implemented for this optimizer class " + ("" + this.getClassName()));
        });
      });
    }, t.prototype.extractIterations = function(r) {
      return xi(this, void 0, void 0, function() {
        var n;
        return bi(this, function(a) {
          switch (a.label) {
            case 0:
              return n = this, [4, r[0].tensor.data()];
            case 1:
              return n.iterations_ = a.sent()[0], [2, r.slice(1)];
          }
        });
      });
    }, t;
  }(oz);
  Object.defineProperty(xv, Symbol.hasInstance, { value: function(e) {
    return e.minimize != null && e.computeGradients != null && e.applyGradients != null;
  } });
  var L3 = function(e) {
    y0(t, e);
    function t(r, n, a) {
      a === void 0 && (a = null);
      var o = e.call(this) || this;
      return o.learningRate = r, o.rho = n, o.epsilon = a, o.accumulatedGrads = [], o.accumulatedUpdates = [], a == null && (o.epsilon = Xr.backend.epsilon()), o;
    }
    return t.prototype.applyGradients = function(r) {
      var n = this, a = Array.isArray(r) ? r.map(function(o) {
        return o.name;
      }) : Object.keys(r);
      a.forEach(function(o, s) {
        var i = Xr.registeredVariables[o], l = false;
        n.accumulatedGrads[s] == null && (n.accumulatedGrads[s] = { originalName: o + "/accum_grad", variable: Vu(function() {
          return Eh(i).variable(l);
        }) }), n.accumulatedUpdates[s] == null && (n.accumulatedUpdates[s] = { originalName: o + "/accum_var", variable: Vu(function() {
          return Eh(i).variable(l);
        }) });
        var u2 = Array.isArray(r) ? r[s].tensor : r[o];
        if (u2 != null) {
          var c = n.accumulatedGrads[s].variable, f = n.accumulatedUpdates[s].variable;
          Vu(function() {
            var h = Hi(Xa(c, n.rho), Xa(Yp(u2), 1 - n.rho)), p = Xa(cl(g0(Hi(f, n.epsilon)), g0(Hi(c, n.epsilon))), u2), d = Hi(Xa(f, n.rho), Xa(Yp(p), 1 - n.rho));
            c.assign(h), f.assign(d);
            var v = Hi(Xa(p, -n.learningRate), i);
            i.assign(v);
          });
        }
      }), this.incrementIterations();
    }, t.prototype.dispose = function() {
      this.accumulatedUpdates != null && (If(this.accumulatedGrads.map(function(r) {
        return r.variable;
      })), If(this.accumulatedUpdates.map(function(r) {
        return r.variable;
      })));
    }, t.prototype.getWeights = function() {
      return xi(this, void 0, void 0, function() {
        var r;
        return bi(this, function(n) {
          switch (n.label) {
            case 0:
              return r = ys(this.accumulatedGrads, this.accumulatedUpdates), [4, this.saveIterations()];
            case 1:
              return [2, [n.sent()].concat(r.map(function(a) {
                return { name: a.originalName, tensor: a.variable };
              }))];
          }
        });
      });
    }, t.prototype.setWeights = function(r) {
      return xi(this, void 0, void 0, function() {
        var n, a;
        return bi(this, function(o) {
          switch (o.label) {
            case 0:
              return [4, this.extractIterations(r)];
            case 1:
              return r = o.sent(), n = r.length / 2, a = false, this.accumulatedGrads = r.slice(0, n).map(function(s) {
                return { originalName: s.name, variable: s.tensor.variable(a) };
              }), this.accumulatedUpdates = r.slice(n, n * 2).map(function(s) {
                return { originalName: s.name, variable: s.tensor.variable(a) };
              }), [2];
          }
        });
      });
    }, t.prototype.getConfig = function() {
      return { learningRate: this.learningRate, rho: this.rho, epsilon: this.epsilon };
    }, t.fromConfig = function(r, n) {
      return new r(n.learningRate, n.rho, n.epsilon);
    }, t;
  }(xv);
  L3.className = "Adadelta";
  yv(L3);
  var R3 = function(e) {
    y0(t, e);
    function t(r, n) {
      n === void 0 && (n = 0.1);
      var a = e.call(this) || this;
      return a.learningRate = r, a.initialAccumulatorValue = n, a.accumulatedGrads = [], a;
    }
    return t.prototype.applyGradients = function(r) {
      var n = this, a = Array.isArray(r) ? r.map(function(o) {
        return o.name;
      }) : Object.keys(r);
      a.forEach(function(o, s) {
        var i = Xr.registeredVariables[o];
        if (n.accumulatedGrads[s] == null) {
          var l = false;
          n.accumulatedGrads[s] = { originalName: o + "/accumulator", variable: Vu(function() {
            return D3(i.shape, n.initialAccumulatorValue).variable(l);
          }) };
        }
        var u2 = Array.isArray(r) ? r[s].tensor : r[o];
        if (u2 != null) {
          var c = n.accumulatedGrads[s].variable;
          Vu(function() {
            var f = Hi(c, Yp(u2));
            c.assign(f);
            var h = Hi(Xa(cl(u2, g0(Hi(f, Xr.backend.epsilon()))), -n.learningRate), i);
            i.assign(h);
          });
        }
      }), this.incrementIterations();
    }, t.prototype.dispose = function() {
      this.accumulatedGrads != null && If(this.accumulatedGrads.map(function(r) {
        return r.variable;
      }));
    }, t.prototype.getWeights = function() {
      return xi(this, void 0, void 0, function() {
        return bi(this, function(r) {
          switch (r.label) {
            case 0:
              return [4, this.saveIterations()];
            case 1:
              return [2, [r.sent()].concat(this.accumulatedGrads.map(function(n) {
                return { name: n.originalName, tensor: n.variable };
              }))];
          }
        });
      });
    }, t.prototype.setWeights = function(r) {
      return xi(this, void 0, void 0, function() {
        var n;
        return bi(this, function(a) {
          switch (a.label) {
            case 0:
              return [4, this.extractIterations(r)];
            case 1:
              return r = a.sent(), n = false, this.accumulatedGrads = r.map(function(o) {
                return { originalName: o.name, variable: o.tensor.variable(n) };
              }), [2];
          }
        });
      });
    }, t.prototype.getConfig = function() {
      return { learningRate: this.learningRate, initialAccumulatorValue: this.initialAccumulatorValue };
    }, t.fromConfig = function(r, n) {
      return new r(n.learningRate, n.initialAccumulatorValue);
    }, t;
  }(xv);
  R3.className = "Adagrad";
  yv(R3);
  var z3 = function(e) {
    y0(t, e);
    function t(r, n, a, o) {
      o === void 0 && (o = null);
      var s = e.call(this) || this;
      return s.learningRate = r, s.beta1 = n, s.beta2 = a, s.epsilon = o, s.accumulatedFirstMoment = [], s.accumulatedSecondMoment = [], Vu(function() {
        s.accBeta1 = xs(n).variable(), s.accBeta2 = xs(a).variable();
      }), o == null && (s.epsilon = Xr.backend.epsilon()), s;
    }
    return t.prototype.applyGradients = function(r) {
      var n = this, a = Array.isArray(r) ? r.map(function(o) {
        return o.name;
      }) : Object.keys(r);
      Vu(function() {
        var o = Ao(1, n.accBeta1), s = Ao(1, n.accBeta2);
        a.forEach(function(i, l) {
          var u2 = Xr.registeredVariables[i], c = false;
          n.accumulatedFirstMoment[l] == null && (n.accumulatedFirstMoment[l] = { originalName: i + "/m", variable: Vu(function() {
            return Eh(u2).variable(c);
          }) }), n.accumulatedSecondMoment[l] == null && (n.accumulatedSecondMoment[l] = { originalName: i + "/v", variable: Vu(function() {
            return Eh(u2).variable(c);
          }) });
          var f = Array.isArray(r) ? r[l].tensor : r[i];
          if (f != null) {
            var h = n.accumulatedFirstMoment[l].variable, p = n.accumulatedSecondMoment[l].variable, d = Hi(Xa(h, n.beta1), Xa(f, 1 - n.beta1)), v = Hi(Xa(p, n.beta2), Xa(Yp(f), 1 - n.beta2)), m = cl(d, o), g = cl(v, s);
            h.assign(d), p.assign(v);
            var x = Hi(Xa(cl(m, Hi(g0(g), n.epsilon)), -n.learningRate), u2);
            u2.assign(x);
          }
        }), n.accBeta1.assign(Xa(n.accBeta1, n.beta1)), n.accBeta2.assign(Xa(n.accBeta2, n.beta2));
      }), this.incrementIterations();
    }, t.prototype.dispose = function() {
      this.accBeta1.dispose(), this.accBeta2.dispose(), this.accumulatedFirstMoment != null && If(this.accumulatedFirstMoment.map(function(r) {
        return r.variable;
      })), this.accumulatedSecondMoment != null && If(this.accumulatedSecondMoment.map(function(r) {
        return r.variable;
      }));
    }, t.prototype.getWeights = function() {
      return xi(this, void 0, void 0, function() {
        var r;
        return bi(this, function(n) {
          switch (n.label) {
            case 0:
              return r = ys(this.accumulatedFirstMoment, this.accumulatedSecondMoment), [4, this.saveIterations()];
            case 1:
              return [2, [n.sent()].concat(r.map(function(a) {
                return { name: a.originalName, tensor: a.variable };
              }))];
          }
        });
      });
    }, t.prototype.setWeights = function(r) {
      return xi(this, void 0, void 0, function() {
        var n, a, o = this;
        return bi(this, function(s) {
          switch (s.label) {
            case 0:
              return [4, this.extractIterations(r)];
            case 1:
              return r = s.sent(), Vu(function() {
                o.accBeta1.assign(Bb(o.beta1, o.iterations_ + 1)), o.accBeta2.assign(Bb(o.beta2, o.iterations_ + 1));
              }), n = r.length / 2, a = false, this.accumulatedFirstMoment = r.slice(0, n).map(function(i) {
                return { originalName: i.name, variable: i.tensor.variable(a) };
              }), this.accumulatedSecondMoment = r.slice(n, n * 2).map(function(i) {
                return { originalName: i.name, variable: i.tensor.variable(a) };
              }), [2];
          }
        });
      });
    }, t.prototype.getConfig = function() {
      return { learningRate: this.learningRate, beta1: this.beta1, beta2: this.beta2, epsilon: this.epsilon };
    }, t.fromConfig = function(r, n) {
      return new r(n.learningRate, n.beta1, n.beta2, n.epsilon);
    }, t;
  }(xv);
  z3.className = "Adam";
  yv(z3);
  var B3 = function(e) {
    y0(t, e);
    function t(r, n, a, o, s) {
      o === void 0 && (o = null), s === void 0 && (s = 0);
      var i = e.call(this) || this;
      return i.learningRate = r, i.beta1 = n, i.beta2 = a, i.epsilon = o, i.decay = s, i.accumulatedFirstMoment = [], i.accumulatedWeightedInfNorm = [], Vu(function() {
        i.iteration = xs(0).variable(), i.accBeta1 = xs(n).variable();
      }), o == null && (i.epsilon = Xr.backend.epsilon()), i;
    }
    return t.prototype.applyGradients = function(r) {
      var n = this, a = Array.isArray(r) ? r.map(function(o) {
        return o.name;
      }) : Object.keys(r);
      Vu(function() {
        var o = Ao(1, n.accBeta1), s = cl(-n.learningRate, Hi(Xa(n.iteration, n.decay), 1));
        a.forEach(function(i, l) {
          var u2 = Xr.registeredVariables[i], c = false;
          n.accumulatedFirstMoment[l] == null && (n.accumulatedFirstMoment[l] = { originalName: i + "/m", variable: Eh(u2).variable(c) }), n.accumulatedWeightedInfNorm[l] == null && (n.accumulatedWeightedInfNorm[l] = { originalName: i + "/v", variable: Eh(u2).variable(c) });
          var f = Array.isArray(r) ? r[l].tensor : r[i];
          if (f != null) {
            var h = n.accumulatedFirstMoment[l].variable, p = n.accumulatedWeightedInfNorm[l].variable, d = Hi(Xa(h, n.beta1), Xa(f, 1 - n.beta1)), v = Xa(p, n.beta2), m = Sh(f), g = Oz(v, m);
            h.assign(d), p.assign(g);
            var x = Hi(Xa(cl(s, o), cl(d, Hi(g, n.epsilon))), u2);
            u2.assign(x);
          }
        }), n.iteration.assign(Hi(n.iteration, 1)), n.accBeta1.assign(Xa(n.accBeta1, n.beta1));
      }), this.incrementIterations();
    }, t.prototype.dispose = function() {
      this.accBeta1.dispose(), this.iteration.dispose(), this.accumulatedFirstMoment != null && If(this.accumulatedFirstMoment.map(function(r) {
        return r.variable;
      })), this.accumulatedWeightedInfNorm != null && If(this.accumulatedWeightedInfNorm.map(function(r) {
        return r.variable;
      }));
    }, t.prototype.getWeights = function() {
      return xi(this, void 0, void 0, function() {
        return bi(this, function(r) {
          throw new Error("getWeights() is not implemented for Adamax yet.");
        });
      });
    }, t.prototype.setWeights = function(r) {
      return xi(this, void 0, void 0, function() {
        return bi(this, function(n) {
          throw new Error("setWeights() is not implemented for Adamax yet.");
        });
      });
    }, t.prototype.getConfig = function() {
      return { learningRate: this.learningRate, beta1: this.beta1, beta2: this.beta2, epsilon: this.epsilon, decay: this.decay };
    }, t.fromConfig = function(r, n) {
      return new r(n.learningRate, n.beta1, n.beta2, n.epsilon, n.decay);
    }, t;
  }(xv);
  B3.className = "Adamax";
  yv(B3);
  var Yb = function(e) {
    y0(t, e);
    function t(r) {
      var n = e.call(this) || this;
      return n.learningRate = r, n.setLearningRate(r), n;
    }
    return t.prototype.applyGradients = function(r) {
      var n = this, a = Array.isArray(r) ? r.map(function(o) {
        return o.name;
      }) : Object.keys(r);
      a.forEach(function(o, s) {
        var i = Array.isArray(r) ? r[s].tensor : r[o];
        if (i != null) {
          var l = Xr.registeredVariables[o];
          Vu(function() {
            var u2 = Hi(Xa(n.c, i), l);
            l.assign(u2);
          });
        }
      }), this.incrementIterations();
    }, t.prototype.setLearningRate = function(r) {
      this.learningRate = r, this.c != null && this.c.dispose(), this.c = cz(xs(-r));
    }, t.prototype.dispose = function() {
      this.c.dispose();
    }, t.prototype.getWeights = function() {
      return xi(this, void 0, void 0, function() {
        return bi(this, function(r) {
          switch (r.label) {
            case 0:
              return [4, this.saveIterations()];
            case 1:
              return [2, [r.sent()]];
          }
        });
      });
    }, t.prototype.setWeights = function(r) {
      return xi(this, void 0, void 0, function() {
        return bi(this, function(n) {
          switch (n.label) {
            case 0:
              return [4, this.extractIterations(r)];
            case 1:
              if (r = n.sent(), r.length !== 0) throw new Error("SGD optimizer does not have settable weights.");
              return [2];
          }
        });
      });
    }, t.prototype.getConfig = function() {
      return { learningRate: this.learningRate };
    }, t.fromConfig = function(r, n) {
      return new r(n.learningRate);
    }, t;
  }(xv);
  Yb.className = "SGD";
  yv(Yb);
  var U3 = function(e) {
    y0(t, e);
    function t(r, n, a) {
      a === void 0 && (a = false);
      var o = e.call(this, r) || this;
      return o.learningRate = r, o.momentum = n, o.useNesterov = a, o.accumulations = [], o.m = xs(o.momentum), o;
    }
    return t.prototype.applyGradients = function(r) {
      var n = this, a = Array.isArray(r) ? r.map(function(o) {
        return o.name;
      }) : Object.keys(r);
      a.forEach(function(o, s) {
        var i = Xr.registeredVariables[o];
        if (n.accumulations[s] == null) {
          var l = false;
          n.accumulations[s] = { originalName: o + "/momentum", variable: Vu(function() {
            return Eh(i).variable(l);
          }) };
        }
        var u2 = n.accumulations[s].variable, c = Array.isArray(r) ? r[s].tensor : r[o];
        c != null && Vu(function() {
          var f, h = Hi(Xa(n.m, u2), c);
          n.useNesterov ? f = Hi(Xa(n.c, Hi(c, Xa(h, n.m))), i) : f = Hi(Xa(n.c, h), i), u2.assign(h), i.assign(f);
        });
      }), this.incrementIterations();
    }, t.prototype.dispose = function() {
      this.m.dispose(), this.accumulations != null && If(this.accumulations.map(function(r) {
        return r.variable;
      }));
    }, t.prototype.setMomentum = function(r) {
      this.momentum = r;
    }, t.prototype.getWeights = function() {
      return xi(this, void 0, void 0, function() {
        return bi(this, function(r) {
          switch (r.label) {
            case 0:
              return [4, this.saveIterations()];
            case 1:
              return [2, [r.sent()].concat(this.accumulations.map(function(n) {
                return { name: n.originalName, tensor: n.variable };
              }))];
          }
        });
      });
    }, t.prototype.setWeights = function(r) {
      return xi(this, void 0, void 0, function() {
        var n;
        return bi(this, function(a) {
          switch (a.label) {
            case 0:
              return [4, this.extractIterations(r)];
            case 1:
              return r = a.sent(), n = false, this.accumulations = r.map(function(o) {
                return { originalName: o.name, variable: o.tensor.variable(n) };
              }), [2];
          }
        });
      });
    }, t.prototype.getConfig = function() {
      return { learningRate: this.learningRate, momentum: this.momentum, useNesterov: this.useNesterov };
    }, t.fromConfig = function(r, n) {
      return new r(n.learningRate, n.momentum, n.useNesterov);
    }, t;
  }(Yb);
  U3.className = "Momentum";
  yv(U3);
  var V3 = function(e) {
    y0(t, e);
    function t(r, n, a, o, s) {
      n === void 0 && (n = 0.9), a === void 0 && (a = 0), o === void 0 && (o = null), s === void 0 && (s = false);
      var i = e.call(this) || this;
      if (i.learningRate = r, i.decay = n, i.momentum = a, i.epsilon = o, i.accumulatedMeanSquares = [], i.accumulatedMoments = [], i.accumulatedMeanGrads = [], i.centered = s, o == null && (i.epsilon = Xr.backend.epsilon()), r == null) throw new Error("learningRate for RMSPropOptimizer must be defined.");
      return i;
    }
    return t.prototype.applyGradients = function(r) {
      var n = this, a = Array.isArray(r) ? r.map(function(o) {
        return o.name;
      }) : Object.keys(r);
      a.forEach(function(o, s) {
        var i = Xr.registeredVariables[o], l = false;
        n.accumulatedMeanSquares[s] == null && (n.accumulatedMeanSquares[s] = { originalName: o + "/rms", variable: Vu(function() {
          return Eh(i).variable(l);
        }) }), n.accumulatedMoments[s] == null && (n.accumulatedMoments[s] = { originalName: o + "/momentum", variable: Vu(function() {
          return Eh(i).variable(l);
        }) }), n.accumulatedMeanGrads[s] == null && n.centered && (n.accumulatedMeanGrads[s] = { originalName: o + "/mg", variable: Vu(function() {
          return Eh(i).variable(l);
        }) });
        var u2 = Array.isArray(r) ? r[s].tensor : r[o];
        if (u2 != null) {
          var c = n.accumulatedMeanSquares[s].variable, f = n.accumulatedMoments[s].variable;
          Vu(function() {
            var h = Hi(Xa(c, n.decay), Xa(Yp(u2), 1 - n.decay));
            if (n.centered) {
              var p = n.accumulatedMeanGrads[s].variable, d = Hi(Xa(p, n.decay), Xa(u2, 1 - n.decay)), v = cl(Xa(u2, n.learningRate), g0(Ao(h, Hi(Yp(d), n.epsilon)))), m = Hi(Xa(f, n.momentum), v);
              c.assign(h), p.assign(d), f.assign(m);
              var g = Ao(i, m);
              i.assign(g);
            } else {
              var x = Hi(Xa(c, n.decay), Xa(Yp(u2), 1 - n.decay)), m = Hi(Xa(f, n.momentum), cl(Xa(u2, n.learningRate), g0(Hi(x, n.epsilon))));
              c.assign(x), f.assign(m);
              var g = Ao(i, m);
              i.assign(g);
            }
          });
        }
      }), this.incrementIterations();
    }, t.prototype.dispose = function() {
      this.accumulatedMeanSquares != null && If(this.accumulatedMeanSquares.map(function(r) {
        return r.variable;
      })), this.accumulatedMeanGrads != null && this.centered && If(this.accumulatedMeanGrads.map(function(r) {
        return r.variable;
      })), this.accumulatedMoments != null && If(this.accumulatedMoments.map(function(r) {
        return r.variable;
      }));
    }, t.prototype.getWeights = function() {
      return xi(this, void 0, void 0, function() {
        var r;
        return bi(this, function(n) {
          switch (n.label) {
            case 0:
              return r = ys(this.accumulatedMeanSquares, this.accumulatedMoments), this.centered && r.push.apply(r, ys(this.accumulatedMeanGrads)), [4, this.saveIterations()];
            case 1:
              return [2, [n.sent()].concat(r.map(function(a) {
                return { name: a.originalName, tensor: a.variable };
              }))];
          }
        });
      });
    }, t.prototype.setWeights = function(r) {
      return xi(this, void 0, void 0, function() {
        var n, a;
        return bi(this, function(o) {
          switch (o.label) {
            case 0:
              return [4, this.extractIterations(r)];
            case 1:
              return r = o.sent(), n = this.centered ? r.length / 3 : r.length / 2, a = false, this.accumulatedMeanSquares = r.slice(0, n).map(function(s) {
                return { originalName: s.name, variable: s.tensor.variable(a) };
              }), this.accumulatedMoments = r.slice(n, n * 2).map(function(s) {
                return { originalName: s.name, variable: s.tensor.variable(a) };
              }), this.centered && (this.accumulatedMeanGrads = r.slice(n * 2, n * 3).map(function(s) {
                return { originalName: s.name, variable: s.tensor.variable(a) };
              })), [2];
          }
        });
      });
    }, t.prototype.getConfig = function() {
      return { learningRate: this.learningRate, decay: this.decay, momentum: this.momentum, epsilon: this.epsilon, centered: this.centered };
    }, t.fromConfig = function(r, n) {
      return new r(n.learningRate, n.decay, n.momentum, n.epsilon, n.centered);
    }, t;
  }(xv);
  V3.className = "RMSProp";
  yv(V3);
  var lv = function() {
    function e() {
    }
    return e.sgd = function(t) {
      return new Yb(t);
    }, e.momentum = function(t, r, n) {
      return n === void 0 && (n = false), new U3(t, r, n);
    }, e.rmsprop = function(t, r, n, a, o) {
      return r === void 0 && (r = 0.9), n === void 0 && (n = 0), a === void 0 && (a = null), o === void 0 && (o = false), new V3(t, r, n, a, o);
    }, e.adam = function(t, r, n, a) {
      return t === void 0 && (t = 1e-3), r === void 0 && (r = 0.9), n === void 0 && (n = 0.999), a === void 0 && (a = null), new z3(t, r, n, a);
    }, e.adadelta = function(t, r, n) {
      return t === void 0 && (t = 1e-3), r === void 0 && (r = 0.95), n === void 0 && (n = null), new L3(t, r, n);
    }, e.adamax = function(t, r, n, a, o) {
      return t === void 0 && (t = 2e-3), r === void 0 && (r = 0.9), n === void 0 && (n = 0.999), a === void 0 && (a = null), o === void 0 && (o = 0), new B3(t, r, n, a, o);
    }, e.adagrad = function(t, r) {
      return r === void 0 && (r = 0.1), new R3(t, r);
    }, e;
  }();
  var Zme = { sgd: lv.sgd, momentum: lv.momentum, adadelta: lv.adadelta, adagrad: lv.adagrad, rmsprop: lv.rmsprop, adamax: lv.adamax, adam: lv.adam };
  var Jme = /* @__PURE__ */ function() {
    return typeof requestAnimationFrame < "u" ? requestAnimationFrame : typeof setImmediate < "u" ? setImmediate : function(e) {
      return e();
    };
  }();
  function Qme() {
    return new Promise(function(e) {
      return Jme(function() {
        return e();
      });
    });
  }
  function ege(e, t) {
    var r = e[0].length;
    e.forEach(function(a, o) {
      Dr(a.length === r, function() {
        return "Error in concat" + r + "D: rank of tensors[" + o + "] must be the same " + ("as the rank of the rest (" + r + ")");
      });
    }), Dr(t >= 0 && t < r, function() {
      return "Error in concat" + r + "D: axis must be between 0 and " + (r - 1) + ".";
    });
    var n = e[0];
    e.forEach(function(a, o) {
      for (var s = 0; s < r; s++) Dr(s === t || a[s] === n[s], function() {
        return "Error in concat" + r + "D: Shape of tensors[" + o + "] (" + a + ") " + ("does not match the shape of the rest (" + n + ") ") + ("along the non-concatenated axis " + o + ".");
      });
    });
  }
  function tge(e, t) {
    for (var r = e[0].slice(), n = 1; n < e.length; n++) r[t] += e[n][t];
    return r;
  }
  var u5 = 30;
  function rge(e) {
    return e <= u5 ? e : l3(e, Math.floor(Math.sqrt(e)));
  }
  function nge(e, t, r) {
    var n = r * (typeof e == "number" ? e : e[0]), a = t * (typeof e == "number" ? e : e[1]);
    return [n, a];
  }
  function age(e, t, r, n) {
    n === void 0 && (n = true);
    var a = [];
    if (n) a = a.concat(t.slice(0)), a.push(e[0] / r), a = a.concat(e.slice(1));
    else {
      a = a.concat(e[0]);
      for (var o = t.length, s = 0; s < o; ++s) a = a.concat([e[s + 1] / t[s], t[s]]);
      a = a.concat(e.slice(o + 1));
    }
    return a;
  }
  function ige(e, t, r) {
    r === void 0 && (r = true);
    var n = [];
    if (r) {
      n.push(t);
      for (var a = t + 1; a < e; ++a) a <= 2 * t ? (n.push(a), n.push(a - (t + 1))) : n.push(a);
    } else {
      for (var o = [], s = [], a = 1; a < e; ++a) a >= t * 2 + 1 || a % 2 === 1 ? s.push(a) : o.push(a);
      n.push.apply(n, ys(o)), n.push(0), n.push.apply(n, ys(s));
    }
    return n;
  }
  function oge(e, t, r, n) {
    n === void 0 && (n = true);
    var a = [];
    n ? a.push(e[0] / r) : a.push(e[0] * r);
    for (var o = 1; o < e.length; ++o) o <= t.length ? n ? a.push(t[o - 1] * e[o]) : a.push(e[o] / t[o - 1]) : a.push(e[o]);
    return a;
  }
  function sge(e, t) {
    for (var r = [0], n = 0; n < t; ++n) r.push(e[n][0]);
    return r;
  }
  function lge(e, t, r) {
    for (var n = e.slice(0, 1), a = 0; a < r; ++a) n.push(e[a + 1] - t[a][0] - t[a][1]);
    return n;
  }
  var uge = 1.7580993408473768, cge = 1.0507009873554805;
  var fge = 0.3275911, hge = 0.254829592, pge = -0.284496736, dge = 1.421413741, vge = -1.453152027, mge = 1.061405429;
  function gge(e, t) {
    if (e.length !== t.length) throw new Error("Cannot merge real and imag arrays of different lengths. real:" + (e.length + ", imag: " + t.length + "."));
    for (var r = new Float32Array(e.length * 2), n = 0; n < r.length; n += 2) r[n] = e[n / 2], r[n + 1] = t[n / 2];
    return r;
  }
  function yge(e) {
    for (var t = new Float32Array(e.length / 2), r = new Float32Array(e.length / 2), n = 0; n < e.length; n += 2) t[n / 2] = e[n], r[n / 2] = e[n + 1];
    return { real: t, imag: r };
  }
  function xge(e) {
    for (var t = Math.ceil(e.length / 4), r = new Float32Array(t), n = new Float32Array(t), a = 0; a < e.length; a += 4) r[Math.floor(a / 4)] = e[a], n[Math.floor(a / 4)] = e[a + 1];
    return { real: r, imag: n };
  }
  function bge(e) {
    for (var t = Math.floor(e.length / 4), r = new Float32Array(t), n = new Float32Array(t), a = 2; a < e.length; a += 4) r[Math.floor(a / 4)] = e[a], n[Math.floor(a / 4)] = e[a + 1];
    return { real: r, imag: n };
  }
  function _ge(e, t) {
    var r = e[t * 2], n = e[t * 2 + 1];
    return { real: r, imag: n };
  }
  function wge(e, t, r, n) {
    e[n * 2] = t, e[n * 2 + 1] = r;
  }
  function kge(e, t) {
    for (var r = new Float32Array(e / 2), n = new Float32Array(e / 2), a = 0; a < Math.ceil(e / 2); a++) {
      var o = (t ? 2 : -2) * Math.PI * (a / e);
      r[a] = Math.cos(o), n[a] = Math.sin(o);
    }
    return { real: r, imag: n };
  }
  function Tge(e, t, r) {
    var n = (r ? 2 : -2) * Math.PI * (e / t), a = Math.cos(n), o = Math.sin(n);
    return { real: a, imag: o };
  }
  var e4 = "->", Age = /->/g, wL = ",", kL = "...";
  function Sge(e, t) {
    e = e.replace(/\s/g, "");
    var r = (e.length - e.replace(Age, "").length) / e4.length;
    if (r < 1) throw new Error("Equations without an arrow are not supported.");
    if (r > 1) throw new Error('Equation must contain exactly one arrow ("' + e4 + '").');
    var n = hi(e.split(e4), 2), a = n[0], o = n[1];
    Dr(a.indexOf(kL) === -1, function() {
      return 'The ellipsis notation ("' + kL + '") is not supported yet.';
    });
    var s = a.split(wL), i = s.length;
    if (t !== i) throw new Error("Expected " + i + " input tensors, received " + t);
    if (i > 2) throw new Error("Support for more than 2 input tensors is not implemented yet.");
    for (var l = [], u2 = function(g) {
      var x = o[g];
      if (!s.some(function(b) {
        return b.indexOf(x) !== -1;
      })) throw new Error("Output subscripts contain the label " + x + " not present in the input subscripts.");
      l.indexOf(x) === -1 && l.push(x);
    }, c = 0; c < o.length; ++c) u2(c);
    for (var c = 0; c < a.length; ++c) {
      var f = a[c];
      l.indexOf(f) === -1 && f !== wL && l.push(f);
    }
    for (var h = new Array(s.length), c = 0; c < i; ++c) {
      if (new Set(s[c].split("")).size !== s[c].length) throw new Error("Found duplicate axes in input component " + s[c] + ". Support for duplicate axes in input is not implemented yet.");
      h[c] = [];
      for (var p = 0; p < s[c].length; ++p) h[c].push(l.indexOf(s[c][p]));
    }
    for (var d = l.length, v = o.length, m = [], c = v; c < d; ++c) m.push(c);
    return { allDims: l, summedDims: m, idDims: h };
  }
  function Ege(e, t) {
    var r = new Array(e);
    r.fill(-1);
    for (var n = 0; n < t.length; ++n) r[t[n]] = n;
    for (var a = [], n = 0; n < e; ++n) r[n] === -1 && a.push(n);
    return r = r.filter(function(o) {
      return o !== -1;
    }), { permutationIndices: r, expandDims: a };
  }
  function Dge(e, t, r) {
    for (var n = new Array(e), a = function(s) {
      for (var i = r[s].shape, l = function(c) {
        n[t[s][c]] === void 0 ? n[t[s][c]] = i[c] : Dr(n[t[s][c]] === i[c], function() {
          return "Expected dimension " + n[t[s][c]] + " at axis " + c + " " + ("of input shaped " + JSON.stringify(i) + ", ") + ("but got dimension " + i[c]);
        });
      }, u2 = 0; u2 < t[s].length; ++u2) l(u2);
    }, o = 0; o < r.length; ++o) a(o);
  }
  function Cge(e, t) {
    var r, n, a = e, o = [], s = 0;
    e.length === 0 && a.push(-1), s = e.length + 1;
    for (var i = 0; i < s; ++i) o.push([]);
    for (var l = [], i = 0; i < a.length; ++i) {
      var u2 = a[i], c = Ige(t, u2);
      try {
        for (var f = (r = void 0, Qf(c)), h = f.next(); !h.done; h = f.next()) {
          var p = h.value;
          l.indexOf(p) === -1 && (o[i].push(p), l.push(p));
        }
      } catch (v) {
        r = { error: v };
      } finally {
        try {
          h && !h.done && (n = f.return) && n.call(f);
        } finally {
          if (r) throw r.error;
        }
      }
    }
    return { path: a, steps: o };
  }
  function Mge(e) {
    return e.every(function(t, r) {
      return t === r;
    });
  }
  function Ige(e, t) {
    for (var r = [], n = 0; n < e.length; ++n) (e[n].length === 0 || e[n].indexOf(t) !== -1 || t === -1) && r.push(n);
    return r;
  }
  function Nge(e, t, r) {
    r === void 0 && (r = 0);
    var n = [];
    if (typeof t == "number") Dr(e.shape[r] % t === 0, function() {
      return "Number of splits must evenly divide the axis.";
    }), n = new Array(t).fill(e.shape[r] / t);
    else {
      var a = t.reduce(function(i, l) {
        return l === -1 && (i += 1), i;
      }, 0);
      Dr(a <= 1, function() {
        return "There should be only one negative value in split array.";
      });
      var o = t.indexOf(-1);
      if (o !== -1) {
        var s = t.reduce(function(i, l) {
          return l > 0 ? i + l : i;
        });
        t[o] = e.shape[r] - s;
      }
      Dr(e.shape[r] === t.reduce(function(i, l) {
        return i + l;
      }), function() {
        return "The sum of sizes must match the size of the axis dimension.";
      }), n = t;
    }
    return n;
  }
  function Fge(e) {
    return `Received SparseTensor with denseShape[0] = 0 but
  indices.shape[0] = ` + e;
  }
  function Oge(e, t) {
    return "indices(" + e + ", 0) is invalid: " + t + " < 0";
  }
  function Pge(e, t, r) {
    return "indices(" + e + ", 0) is invalid: " + t + " >= " + r;
  }
  function Lge(e, t) {
    return "only one output dimension may be -1, not both " + e + " and " + t;
  }
  function Rge(e, t) {
    return "size " + e + " must be non-negative, not " + t;
  }
  function zge() {
    return "reshape cannot infer the missing input size for an empty tensor unless all specified input sizes are non-zero";
  }
  function Bge(e, t) {
    var r = Ml(e), n = Ml(t);
    return "Input to reshape is a SparseTensor with " + r + `
  dense values, but the requested shape requires a multiple of ` + n + ". inputShape=" + e + " outputShape= " + t;
  }
  function Uge(e, t) {
    var r = Ml(e), n = Ml(t);
    return "Input to reshape is a tensor with " + r + " dense values, but the requested shape has " + n + ". inputShape=" + e + " outputShape=" + t;
  }
  function Vge() {
    return "segment ids must be >= 0";
  }
  function jge() {
    return "segment ids are not increasing";
  }
  function Wge(e, t) {
    return "Segment id " + e + " out of range [0, " + t + "), possibly because segmentIds input is not sorted.";
  }
  function Gge(e, t, r) {
    return "Bad: indices[" + e + "] == " + t + " out of range [0, " + r + ")";
  }
  function $ge(e, t) {
    var r = false, n;
    for (e <= u5 ? (n = e, r = true) : n = l3(e, Math.floor(Math.sqrt(e))); !r; ) n > t || n === e ? r = true : n = l3(e, n + 1);
    return n;
  }
  function Hge(e, t, r) {
    for (var n = [], a = e.length, o = 0; o < a; o++) o !== t ? n.push(e[o]) : n.push(r);
    return n;
  }
  function qge(e, t, r, n) {
    var a = t.shape.length, o = e.shape.length;
    if (n !== 0 && (n < -a || n > a)) throw new Error("Expect batchDims in the range of [-" + a + ", " + a + "], but got " + n);
    if (n < 0 && (n += a), n > o) throw new Error("batchDims (" + n + `) must be less than rank(x) (
    ` + o + ").");
    if (r < n) throw new Error("batchDims (" + n + ") must be less than or equal to axis (" + r + ").");
    for (var s = 0; s < n; ++s) if (e.shape[s] !== t.shape[s]) throw new Error("x.shape[" + s + "]: " + e.shape[s] + " should be equal to indices.shape[" + s + "]: " + t.shape[s] + ".");
    for (var i = e.shape[r], l = [], u2 = 1, c = 1, f = 1, s = 0; s < n; ++s) l.push(e.shape[s]), u2 *= e.shape[s];
    for (var s = n; s < r; s++) l.push(e.shape[s]), c *= e.shape[s];
    for (var s = n; s < a; s++) l.push(t.shape[s]);
    for (var s = r + 1; s < o; s++) l.push(e.shape[s]), f *= e.shape[s];
    return { batchSize: u2, sliceSize: f, outerSize: c, dimSize: i, outputShape: l };
  }
  var Xge = { __proto__: null, segOpComputeOptimalWindowSize: $ge, computeOutShape: Hge, collectGatherOpShapeInfo: qge };
  function Kge(e) {
    try {
      return e.map(function(t) {
        return h3(t);
      });
    } catch (t) {
      throw new Error("Failed to decode encoded string bytes into utf-8, error: " + t);
    }
  }
  function Yge(e) {
    return e.map(function(t) {
      return $b(t);
    });
  }
  var Zge = { __proto__: null, slice_util: iz, segment_util: Xge, fromUint8ToStringArray: Kge, fromStringArrayToUint8: Yge, upcastType: A3, axesAreInnerMostDims: Q4, combineLocations: Cz, computeOutAndReduceShapes: ppe, expandShapeToKeepDim: Xb, assertAxesAreInnerMostDims: dpe, getAxesPermutation: vpe, getUndoAxesPermutation: mpe, getInnerMostAxes: gpe, getBroadcastDims: H9, getReductionAxes: G4, assertAndGetBroadcastShape: ju, assertParamsConsistent: ege, computeOutShape: tge, computeDilation2DInfo: rfe, computePool2DInfo: hz, computePool3DInfo: nfe, computeConv2DInfo: qb, computeConv3DInfo: pz, computeDefaultPad: K4, tupleValuesAreOne: Rb, eitherStridesOrDilationsAreOne: x0, convertConv2DDataFormat: dz, checkPadOnDimRoundingMode: rp, getFusedDyActivation: N3, getFusedBiasGradient: F32, applyActivation: O3, shouldFuse: P3, PARALLELIZE_THRESHOLD: u5, computeOptimalWindowSize: rge, getImageCenter: nge, getReshaped: age, getPermuted: ige, getReshapedPermuted: oge, getSliceBeginCoords: sge, getSliceSize: lge, prepareAndValidate: K9, validateUpdateShape: $4, validateInput: H4, calculateShapes: Y9, SELU_SCALEALPHA: uge, SELU_SCALE: cge, ERF_P: fge, ERF_A1: hge, ERF_A2: pge, ERF_A3: dge, ERF_A4: vge, ERF_A5: mge, warn: uv, log: qse, mergeRealAndImagArrays: gge, splitRealAndImagArrays: yge, complexWithEvenIndex: xge, complexWithOddIndex: bge, getComplexWithIndex: _ge, assignToTypedArray: wge, exponents: kge, exponent: Tge, decodeEinsumEquation: Sge, getEinsumPermutation: Ege, checkEinsumDimSizes: Dge, getEinsumComputePath: Cge, isIdentityPermutation: Mge, prepareSplitSize: Nge, getSparseFillEmptyRowsIndicesDenseShapeMismatch: Fge, getSparseFillEmptyRowsNegativeIndexErrorMessage: Oge, getSparseFillEmptyRowsOutOfRangeIndexErrorMessage: Pge, getSparseReshapeMultipleNegativeOneOutputDimErrorMessage: Lge, getSparseReshapeNegativeOutputDimErrorMessage: Rge, getSparseReshapeEmptyTensorZeroOutputDimErrorMessage: zge, getSparseReshapeInputOutputMultipleErrorMessage: Bge, getSparseReshapeInputOutputMismatchErrorMessage: Uge, getSparseSegmentReductionNegativeSegmentIdsErrorMessage: Vge, getSparseSegmentReductionNonIncreasingSegmentIdsErrorMessage: jge, getSparseSegmentReductionSegmentIdOutOfRangeErrorMessage: Wge, getSparseSegmentReductionIndicesOutOfRangeErrorMessage: Gge };
  var Jge = { __proto__: null, nonMaxSuppressionV3Impl: Zz, nonMaxSuppressionV4Impl: Jz, nonMaxSuppressionV5Impl: Qz, whereImpl: $z };
  Gt.Abs = RL;
  Gt.Acos = zL;
  Gt.Acosh = BL;
  Gt.AdadeltaOptimizer = L3;
  Gt.AdagradOptimizer = R3;
  Gt.AdamOptimizer = z3;
  Gt.AdamaxOptimizer = B3;
  Gt.Add = I4;
  Gt.AddN = UL;
  Gt.All = VL;
  Gt.Any = jL;
  Gt.ArgMax = WL;
  Gt.ArgMin = GL;
  Gt.Asin = $L;
  Gt.Asinh = HL;
  Gt.Atan = qL;
  Gt.Atan2 = KL;
  Gt.Atanh = XL;
  Gt.AvgPool = YL;
  Gt.AvgPool3D = ZL;
  Gt.AvgPool3DGrad = Fse;
  Gt.AvgPoolGrad = Nse;
  Gt.BatchMatMul = JL;
  Gt.BatchToSpaceND = QL;
  Gt.Bincount = eR;
  Gt.BroadcastArgs = tR;
  Gt.BroadcastTo = Ose;
  Gt.Cast = N4;
  Gt.Ceil = rR;
  Gt.ClipByValue = nR;
  Gt.Complex = aR;
  Gt.ComplexAbs = iR;
  Gt.Concat = oR;
  Gt.Conv2D = sR;
  Gt.Conv2DBackpropFilter = lR;
  Gt.Conv2DBackpropInput = uR;
  Gt.Conv3D = cR;
  Gt.Conv3DBackpropFilterV2 = Pse;
  Gt.Conv3DBackpropInputV2 = fR;
  Gt.Cos = hR;
  Gt.Cosh = pR;
  Gt.CropAndResize = vR;
  Gt.Cumsum = dR;
  Gt.DataStorage = fse;
  Gt.DenseBincount = mR;
  Gt.DepthToSpace = gR;
  Gt.DepthwiseConv2dNative = yR;
  Gt.DepthwiseConv2dNativeBackpropFilter = xR;
  Gt.DepthwiseConv2dNativeBackpropInput = bR;
  Gt.Diag = _R;
  Gt.Dilation2D = wR;
  Gt.Dilation2DBackpropFilter = Rse;
  Gt.Dilation2DBackpropInput = Lse;
  Gt.Einsum = TR;
  Gt.Elu = AR;
  Gt.EluGrad = zse;
  Gt.Environment = PL;
  Gt.Equal = ER;
  Gt.Erf = SR;
  Gt.Exp = DR;
  Gt.ExpandDims = CR;
  Gt.Expm1 = MR;
  Gt.FFT = IR;
  Gt.Fill = NR;
  Gt.FlipLeftRight = FR;
  Gt.Floor = OR;
  Gt.FloorDiv = PR;
  Gt.FromPixels = n4;
  Gt.FusedBatchNorm = LR;
  Gt.FusedConv2D = i4;
  Gt.FusedDepthwiseConv2D = o4;
  Gt.GatherNd = zR;
  Gt.GatherV2 = RR;
  Gt.Greater = BR;
  Gt.GreaterEqual = UR;
  Gt.IFFT = VR;
  Gt.Identity = F42;
  Gt.Imag = jR;
  Gt.IsFinite = WR;
  Gt.IsInf = GR;
  Gt.IsNan = $R;
  Gt.KernelBackend = TL;
  Gt.LRN = t7;
  Gt.LRNGrad = Use;
  Gt.LeakyRelu = HR;
  Gt.Less = qR;
  Gt.LessEqual = XR;
  Gt.LinSpace = KR;
  Gt.Log = YR;
  Gt.Log1p = ZR;
  Gt.LogSoftmax = Bse;
  Gt.LogicalAnd = JR;
  Gt.LogicalNot = QR;
  Gt.LogicalOr = e7;
  Gt.Max = r7;
  Gt.MaxPool = a7;
  Gt.MaxPool3D = i7;
  Gt.MaxPool3DGrad = jse;
  Gt.MaxPoolGrad = Vse;
  Gt.MaxPoolWithArgmax = o7;
  Gt.Maximum = n7;
  Gt.Mean = s7;
  Gt.Min = l7;
  Gt.Minimum = u7;
  Gt.MirrorPad = c7;
  Gt.Mod = f7;
  Gt.MomentumOptimizer = U3;
  Gt.Multinomial = h7;
  Gt.Multiply = p7;
  Gt.Neg = d7;
  Gt.NonMaxSuppressionV3 = m7;
  Gt.NonMaxSuppressionV4 = g7;
  Gt.NonMaxSuppressionV5 = y7;
  Gt.NotEqual = v7;
  Gt.OP_SCOPE_SUFFIX = N9;
  Gt.OneHot = b7;
  Gt.OnesLike = x7;
  Gt.Optimizer = xv;
  Gt.OptimizerConstructors = lv;
  Gt.Pack = _7;
  Gt.PadV2 = w7;
  Gt.Pool = Wse;
  Gt.Pow = k7;
  Gt.Prelu = T7;
  Gt.Prod = A7;
  Gt.RMSPropOptimizer = V3;
  Gt.Range = S7;
  Gt.Real = E7;
  Gt.RealDiv = kR;
  Gt.Reciprocal = D7;
  Gt.Relu = C7;
  Gt.Relu6 = F72;
  Gt.Reshape = M7;
  Gt.ResizeBilinear = N7;
  Gt.ResizeBilinearGrad = $se;
  Gt.ResizeNearestNeighbor = I7;
  Gt.ResizeNearestNeighborGrad = Gse;
  Gt.Reverse = O7;
  Gt.RotateWithOffset = y9;
  Gt.Round = P7;
  Gt.Rsqrt = L7;
  Gt.SGDOptimizer = Yb;
  Gt.ScatterNd = R7;
  Gt.Select = z7;
  Gt.Selu = B7;
  Gt.Sigmoid = G7;
  Gt.Sign = W7;
  Gt.Sin = V7;
  Gt.Sinh = j7;
  Gt.Slice = U7;
  Gt.Softmax = Y7;
  Gt.Softplus = $7;
  Gt.SpaceToBatchND = X7;
  Gt.SparseFillEmptyRows = Z7;
  Gt.SparseReshape = J7;
  Gt.SparseSegmentMean = Q7;
  Gt.SparseSegmentSum = e9;
  Gt.SparseToDense = t9;
  Gt.SplitV = K7;
  Gt.Sqrt = H7;
  Gt.Square = Hse;
  Gt.SquaredDifference = r9;
  Gt.Step = g9;
  Gt.StridedSlice = n9;
  Gt.StringNGrams = a9;
  Gt.StringSplit = i9;
  Gt.StringToHashBucketFast = o9;
  Gt.Sub = s9;
  Gt.Sum = q7;
  Gt.Tan = l9;
  Gt.Tanh = u9;
  Gt.Tensor = Du;
  Gt.TensorBuffer = p3;
  Gt.Tile = O4;
  Gt.TopK = c9;
  Gt.Transform = f9;
  Gt.Transpose = h9;
  Gt.Unique = p9;
  Gt.Unpack = d9;
  Gt.UnsortedSegmentSum = v9;
  Gt.Variable = Pb;
  Gt.ZerosLike = m9;
  Gt._FusedMatMul = a4;
  Gt.abs = Sh;
  Gt.acos = Fce;
  Gt.acosh = Pce;
  Gt.add = Hi;
  Gt.addN = Rce;
  Gt.all = Bce;
  Gt.any = Vce;
  Gt.argMax = Wce;
  Gt.argMin = $ce;
  Gt.asin = qce;
  Gt.asinh = Kce;
  Gt.atan = Zce;
  Gt.atan2 = Qce;
  Gt.atanh = tfe;
  Gt.avgPool = vz;
  Gt.avgPool3d = ffe;
  Gt.backend = Ace;
  Gt.backend_util = Zge;
  Gt.basicLSTMCell = gfe;
  Gt.batchNorm = S3;
  Gt.batchNorm2d = wfe;
  Gt.batchNorm3d = Tfe;
  Gt.batchNorm4d = Sfe;
  Gt.batchToSpaceND = mz;
  Gt.bincount = gz;
  Gt.booleanMaskAsync = W0e;
  Gt.broadcastArgs = Cfe;
  Gt.broadcastTo = o3;
  Gt.broadcast_util = Nue;
  Gt.browser = Uue;
  Gt.buffer = m0;
  Gt.cast = iu;
  Gt.ceil = Nfe;
  Gt.clipByValue = Ofe;
  Gt.clone = Im;
  Gt.complex = Om;
  Gt.concat = eh;
  Gt.concat1d = Lfe;
  Gt.concat2d = zfe;
  Gt.concat3d = Ufe;
  Gt.concat4d = jfe;
  Gt.conv1d = $fe;
  Gt.conv2d = E3;
  Gt.conv2dTranspose = Xfe;
  Gt.conv3d = Yfe;
  Gt.conv3dTranspose = ehe;
  Gt.copyRegisteredKernels = Zse;
  Gt.cos = rhe;
  Gt.cosh = ahe;
  Gt.cosineWindow = s5;
  Gt.cumsum = ohe;
  Gt.customGrad = zd;
  Gt.denseBincount = lhe;
  Gt.deprecationWarn = hce;
  Gt.depthToSpace = che;
  Gt.depthwiseConv2d = Y4;
  Gt.device_util = Cle;
  Gt.diag = phe;
  Gt.dilation2d = vhe;
  Gt.disableDeprecationWarnings = fce;
  Gt.dispose = If;
  Gt.disposeVariables = pce;
  Gt.div = cl;
  Gt.divNoNan = bhe;
  Gt.dot = whe;
  Gt.dropout = rve;
  Gt.einsum = The;
  Gt.elu = bz;
  Gt.enableDebugMode = cce;
  Gt.enableProdMode = uce;
  Gt.enclosingPowerOfTwo = Xz;
  Gt.engine = dce;
  Gt.env = So;
  Gt.equal = xz;
  Gt.erf = Ehe;
  Gt.exp = Rm;
  Gt.expandDims = Sm;
  Gt.expm1 = Ihe;
  Gt.eye = _z;
  Gt.fft = r5;
  Gt.fill = D3;
  Gt.findBackend = wce;
  Gt.findBackendFactory = kce;
  Gt.floor = wz;
  Gt.floorDiv = fz;
  Gt.fused = gve;
  Gt.gather = kz;
  Gt.gatherND = Q0e;
  Gt.gather_util = Vue;
  Gt.getBackend = bce;
  Gt.getGradient = s4;
  Gt.getKernel = u3;
  Gt.getKernelsForBackend = c3;
  Gt.grad = epe;
  Gt.grads = tpe;
  Gt.greater = C3;
  Gt.greaterEqual = Tz;
  Gt.ifft = _32;
  Gt.imag = Z4;
  Gt.image = Hme;
  Gt.inTopKAsync = ave;
  Gt.io = Aue;
  Gt.irfft = jz;
  Gt.isFinite = Uhe;
  Gt.isInf = jhe;
  Gt.isNaN = Ghe;
  Gt.keep = cz;
  Gt.kernel_impls = Jge;
  Gt.leakyRelu = Az;
  Gt.less = qhe;
  Gt.lessEqual = J4;
  Gt.linalg = qme;
  Gt.linspace = Khe;
  Gt.localResponseNormalization = Zhe;
  Gt.log = zb;
  Gt.log1p = Sz;
  Gt.logSigmoid = spe;
  Gt.logSoftmax = hpe;
  Gt.logSumExp = Mz;
  Gt.logicalAnd = y3;
  Gt.logicalNot = Iz;
  Gt.logicalOr = Nz;
  Gt.logicalXor = kpe;
  Gt.losses = Xme;
  Gt.matMul = gs;
  Gt.math = Iue;
  Gt.max = J1;
  Gt.maxPool = Fz;
  Gt.maxPool3d = Spe;
  Gt.maxPoolWithArgmax = Dpe;
  Gt.maximum = Oz;
  Gt.mean = x3;
  Gt.memory = vce;
  Gt.meshgrid = Ipe;
  Gt.min = S4;
  Gt.minimum = Pz;
  Gt.mirrorPad = Ppe;
  Gt.mod = Rpe;
  Gt.moments = Upe;
  Gt.movingAverage = H0e;
  Gt.mul = Xa;
  Gt.multiRNNCell = jpe;
  Gt.multinomial = Gpe;
  Gt.neg = pv;
  Gt.nextFrame = Qme;
  Gt.norm = o5;
  Gt.notEqual = Lz;
  Gt.oneHot = _4;
  Gt.ones = Mm;
  Gt.onesLike = qpe;
  Gt.op = Hr;
  Gt.outerProduct = Kpe;
  Gt.pad = Kb;
  Gt.pad1d = Jpe;
  Gt.pad2d = ede;
  Gt.pad3d = rde;
  Gt.pad4d = ade;
  Gt.pool = ude;
  Gt.pow = Bb;
  Gt.prelu = zz;
  Gt.print = j9;
  Gt.prod = pde;
  Gt.profile = mce;
  Gt.rand = vde;
  Gt.randomGamma = Ade;
  Gt.randomNormal = Ede;
  Gt.randomUniform = Bz;
  Gt.range = Ub;
  Gt.ready = xce;
  Gt.real = b3;
  Gt.reciprocal = Ide;
  Gt.registerBackend = Tce;
  Gt.registerGradient = Xse;
  Gt.registerKernel = x9;
  Gt.relu = I3;
  Gt.relu6 = Uz;
  Gt.removeBackend = _ce;
  Gt.reshape = ga;
  Gt.reverse = zm;
  Gt.reverse1d = Lde;
  Gt.reverse2d = zde;
  Gt.reverse3d = Ude;
  Gt.reverse4d = jde;
  Gt.rfft = n5;
  Gt.round = Vz;
  Gt.rsqrt = $de;
  Gt.scalar = xs;
  Gt.scatterND = X0e;
  Gt.scatter_util = jue;
  Gt.selu = qde;
  Gt.separableConv2d = Kde;
  Gt.serialization = Que;
  Gt.setBackend = yce;
  Gt.setPlatform = Sce;
  Gt.setdiff1dAsync = Zde;
  Gt.sigmoid = Z1;
  Gt.sign = Qde;
  Gt.signal = $me;
  Gt.sin = t0e;
  Gt.sinh = n0e;
  Gt.slice = Cl;
  Gt.slice1d = i0e;
  Gt.slice2d = s0e;
  Gt.slice3d = u0e;
  Gt.slice4d = f0e;
  Gt.slice_util = iz;
  Gt.softmax = p0e;
  Gt.softplus = Dz;
  Gt.spaceToBatchND = Rz;
  Gt.sparse = Kme;
  Gt.sparseToDense = Z0e;
  Gt.spectral = Gme;
  Gt.split = Vb;
  Gt.sqrt = g0;
  Gt.square = Yp;
  Gt.squaredDifference = Wz;
  Gt.squeeze = a5;
  Gt.stack = jb;
  Gt.step = Gz;
  Gt.stridedSlice = A0e;
  Gt.string = Yme;
  Gt.sub = Ao;
  Gt.sum = ul;
  Gt.sumOutType = ble;
  Gt.tan = E0e;
  Gt.tanh = A4;
  Gt.tensor = X1;
  Gt.tensor1d = Kp;
  Gt.tensor2d = Ib;
  Gt.tensor3d = q9;
  Gt.tensor4d = D0e;
  Gt.tensor5d = C0e;
  Gt.tensor6d = M0e;
  Gt.tensor_util = kle;
  Gt.test_util = sce;
  Gt.tidy = Vu;
  Gt.tile = Mb;
  Gt.time = gce;
  Gt.topk = N0e;
  Gt.train = Zme;
  Gt.transpose = m3;
  Gt.truncatedNormal = O0e;
  Gt.unique = L0e;
  Gt.unregisterGradient = Yse;
  Gt.unregisterKernel = Kse;
  Gt.unsortedSegmentSum = z0e;
  Gt.unstack = i5;
  Gt.upcastType = A3;
  Gt.util = lle;
  Gt.valueAndGrad = rpe;
  Gt.valueAndGrads = npe;
  Gt.variable = U0e;
  Gt.variableGrads = Ez;
  Gt.version_core = lce;
  Gt.where = ry;
  Gt.whereAsync = Hz;
  Gt.zeros = ny;
  Gt.zerosLike = Eh;
});
var cB = ri((q_t, uB) => {
  uB.exports = pl;
  var np = null;
  try {
    np = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11])), {}).exports;
  } catch {
  }
  function pl(e, t, r) {
    this.low = e | 0, this.high = t | 0, this.unsigned = !!r;
  }
  pl.prototype.__isLong__;
  Object.defineProperty(pl.prototype, "__isLong__", { value: true });
  function nh(e) {
    return (e && e.__isLong__) === true;
  }
  pl.isLong = nh;
  var eB = {}, tB = {};
  function Hm(e, t) {
    var r, n, a;
    return t ? (e >>>= 0, (a = 0 <= e && e < 256) && (n = tB[e], n) ? n : (r = dl(e, (e | 0) < 0 ? -1 : 0, true), a && (tB[e] = r), r)) : (e |= 0, (a = -128 <= e && e < 128) && (n = eB[e], n) ? n : (r = dl(e, e < 0 ? -1 : 0, false), a && (eB[e] = r), r));
  }
  pl.fromInt = Hm;
  function ap(e, t) {
    if (isNaN(e)) return t ? $m : ip;
    if (t) {
      if (e < 0) return $m;
      if (e >= iB) return lB;
    } else {
      if (e <= -nB) return rh;
      if (e + 1 >= nB) return sB;
    }
    return e < 0 ? ap(-e, t).neg() : dl(e % sy | 0, e / sy | 0, t);
  }
  pl.fromNumber = ap;
  function dl(e, t, r) {
    return new pl(e, t, r);
  }
  pl.fromBits = dl;
  var j3 = Math.pow;
  function f5(e, t, r) {
    if (e.length === 0) throw Error("empty string");
    if (e === "NaN" || e === "Infinity" || e === "+Infinity" || e === "-Infinity") return ip;
    if (typeof t == "number" ? (r = t, t = false) : t = !!t, r = r || 10, r < 2 || 36 < r) throw RangeError("radix");
    var n;
    if ((n = e.indexOf("-")) > 0) throw Error("interior hyphen");
    if (n === 0) return f5(e.substring(1), t, r).neg();
    for (var a = ap(j3(r, 8)), o = ip, s = 0; s < e.length; s += 8) {
      var i = Math.min(8, e.length - s), l = parseInt(e.substring(s, s + i), r);
      if (i < 8) {
        var u2 = ap(j3(r, i));
        o = o.mul(u2).add(ap(l));
      } else o = o.mul(a), o = o.add(ap(l));
    }
    return o.unsigned = t, o;
  }
  pl.fromString = f5;
  function Qp(e, t) {
    return typeof e == "number" ? ap(e, t) : typeof e == "string" ? f5(e, t) : dl(e.low, e.high, typeof t == "boolean" ? t : e.unsigned);
  }
  pl.fromValue = Qp;
  var rB = 1 << 16, Qge = 1 << 24, sy = rB * rB, iB = sy * sy, nB = iB / 2, aB = Hm(Qge), ip = Hm(0);
  pl.ZERO = ip;
  var $m = Hm(0, true);
  pl.UZERO = $m;
  var oy = Hm(1);
  pl.ONE = oy;
  var oB = Hm(1, true);
  pl.UONE = oB;
  var c5 = Hm(-1);
  pl.NEG_ONE = c5;
  var sB = dl(-1, 2147483647, false);
  pl.MAX_VALUE = sB;
  var lB = dl(-1, -1, true);
  pl.MAX_UNSIGNED_VALUE = lB;
  var rh = dl(0, -2147483648, false);
  pl.MIN_VALUE = rh;
  var Ba = pl.prototype;
  Ba.toInt = function() {
    return this.unsigned ? this.low >>> 0 : this.low;
  };
  Ba.toNumber = function() {
    return this.unsigned ? (this.high >>> 0) * sy + (this.low >>> 0) : this.high * sy + (this.low >>> 0);
  };
  Ba.toString = function(t) {
    if (t = t || 10, t < 2 || 36 < t) throw RangeError("radix");
    if (this.isZero()) return "0";
    if (this.isNegative()) if (this.eq(rh)) {
      var r = ap(t), n = this.div(r), a = n.mul(r).sub(this);
      return n.toString(t) + a.toInt().toString(t);
    } else return "-" + this.neg().toString(t);
    for (var o = ap(j3(t, 6), this.unsigned), s = this, i = ""; ; ) {
      var l = s.div(o), u2 = s.sub(l.mul(o)).toInt() >>> 0, c = u2.toString(t);
      if (s = l, s.isZero()) return c + i;
      for (; c.length < 6; ) c = "0" + c;
      i = "" + c + i;
    }
  };
  Ba.getHighBits = function() {
    return this.high;
  };
  Ba.getHighBitsUnsigned = function() {
    return this.high >>> 0;
  };
  Ba.getLowBits = function() {
    return this.low;
  };
  Ba.getLowBitsUnsigned = function() {
    return this.low >>> 0;
  };
  Ba.getNumBitsAbs = function() {
    if (this.isNegative()) return this.eq(rh) ? 64 : this.neg().getNumBitsAbs();
    for (var t = this.high != 0 ? this.high : this.low, r = 31; r > 0 && (t & 1 << r) == 0; r--) ;
    return this.high != 0 ? r + 33 : r + 1;
  };
  Ba.isZero = function() {
    return this.high === 0 && this.low === 0;
  };
  Ba.eqz = Ba.isZero;
  Ba.isNegative = function() {
    return !this.unsigned && this.high < 0;
  };
  Ba.isPositive = function() {
    return this.unsigned || this.high >= 0;
  };
  Ba.isOdd = function() {
    return (this.low & 1) === 1;
  };
  Ba.isEven = function() {
    return (this.low & 1) === 0;
  };
  Ba.equals = function(t) {
    return nh(t) || (t = Qp(t)), this.unsigned !== t.unsigned && this.high >>> 31 === 1 && t.high >>> 31 === 1 ? false : this.high === t.high && this.low === t.low;
  };
  Ba.eq = Ba.equals;
  Ba.notEquals = function(t) {
    return !this.eq(t);
  };
  Ba.neq = Ba.notEquals;
  Ba.ne = Ba.notEquals;
  Ba.lessThan = function(t) {
    return this.comp(t) < 0;
  };
  Ba.lt = Ba.lessThan;
  Ba.lessThanOrEqual = function(t) {
    return this.comp(t) <= 0;
  };
  Ba.lte = Ba.lessThanOrEqual;
  Ba.le = Ba.lessThanOrEqual;
  Ba.greaterThan = function(t) {
    return this.comp(t) > 0;
  };
  Ba.gt = Ba.greaterThan;
  Ba.greaterThanOrEqual = function(t) {
    return this.comp(t) >= 0;
  };
  Ba.gte = Ba.greaterThanOrEqual;
  Ba.ge = Ba.greaterThanOrEqual;
  Ba.compare = function(t) {
    if (nh(t) || (t = Qp(t)), this.eq(t)) return 0;
    var r = this.isNegative(), n = t.isNegative();
    return r && !n ? -1 : !r && n ? 1 : this.unsigned ? t.high >>> 0 > this.high >>> 0 || t.high === this.high && t.low >>> 0 > this.low >>> 0 ? -1 : 1 : this.sub(t).isNegative() ? -1 : 1;
  };
  Ba.comp = Ba.compare;
  Ba.negate = function() {
    return !this.unsigned && this.eq(rh) ? rh : this.not().add(oy);
  };
  Ba.neg = Ba.negate;
  Ba.add = function(t) {
    nh(t) || (t = Qp(t));
    var r = this.high >>> 16, n = this.high & 65535, a = this.low >>> 16, o = this.low & 65535, s = t.high >>> 16, i = t.high & 65535, l = t.low >>> 16, u2 = t.low & 65535, c = 0, f = 0, h = 0, p = 0;
    return p += o + u2, h += p >>> 16, p &= 65535, h += a + l, f += h >>> 16, h &= 65535, f += n + i, c += f >>> 16, f &= 65535, c += r + s, c &= 65535, dl(h << 16 | p, c << 16 | f, this.unsigned);
  };
  Ba.subtract = function(t) {
    return nh(t) || (t = Qp(t)), this.add(t.neg());
  };
  Ba.sub = Ba.subtract;
  Ba.multiply = function(t) {
    if (this.isZero()) return ip;
    if (nh(t) || (t = Qp(t)), np) {
      var r = np.mul(this.low, this.high, t.low, t.high);
      return dl(r, np.get_high(), this.unsigned);
    }
    if (t.isZero()) return ip;
    if (this.eq(rh)) return t.isOdd() ? rh : ip;
    if (t.eq(rh)) return this.isOdd() ? rh : ip;
    if (this.isNegative()) return t.isNegative() ? this.neg().mul(t.neg()) : this.neg().mul(t).neg();
    if (t.isNegative()) return this.mul(t.neg()).neg();
    if (this.lt(aB) && t.lt(aB)) return ap(this.toNumber() * t.toNumber(), this.unsigned);
    var n = this.high >>> 16, a = this.high & 65535, o = this.low >>> 16, s = this.low & 65535, i = t.high >>> 16, l = t.high & 65535, u2 = t.low >>> 16, c = t.low & 65535, f = 0, h = 0, p = 0, d = 0;
    return d += s * c, p += d >>> 16, d &= 65535, p += o * c, h += p >>> 16, p &= 65535, p += s * u2, h += p >>> 16, p &= 65535, h += a * c, f += h >>> 16, h &= 65535, h += o * u2, f += h >>> 16, h &= 65535, h += s * l, f += h >>> 16, h &= 65535, f += n * c + a * u2 + o * l + s * i, f &= 65535, dl(p << 16 | d, f << 16 | h, this.unsigned);
  };
  Ba.mul = Ba.multiply;
  Ba.divide = function(t) {
    if (nh(t) || (t = Qp(t)), t.isZero()) throw Error("division by zero");
    if (np) {
      if (!this.unsigned && this.high === -2147483648 && t.low === -1 && t.high === -1) return this;
      var r = (this.unsigned ? np.div_u : np.div_s)(this.low, this.high, t.low, t.high);
      return dl(r, np.get_high(), this.unsigned);
    }
    if (this.isZero()) return this.unsigned ? $m : ip;
    var n, a, o;
    if (this.unsigned) {
      if (t.unsigned || (t = t.toUnsigned()), t.gt(this)) return $m;
      if (t.gt(this.shru(1))) return oB;
      o = $m;
    } else {
      if (this.eq(rh)) {
        if (t.eq(oy) || t.eq(c5)) return rh;
        if (t.eq(rh)) return oy;
        var s = this.shr(1);
        return n = s.div(t).shl(1), n.eq(ip) ? t.isNegative() ? oy : c5 : (a = this.sub(t.mul(n)), o = n.add(a.div(t)), o);
      } else if (t.eq(rh)) return this.unsigned ? $m : ip;
      if (this.isNegative()) return t.isNegative() ? this.neg().div(t.neg()) : this.neg().div(t).neg();
      if (t.isNegative()) return this.div(t.neg()).neg();
      o = ip;
    }
    for (a = this; a.gte(t); ) {
      n = Math.max(1, Math.floor(a.toNumber() / t.toNumber()));
      for (var i = Math.ceil(Math.log(n) / Math.LN2), l = i <= 48 ? 1 : j3(2, i - 48), u2 = ap(n), c = u2.mul(t); c.isNegative() || c.gt(a); ) n -= l, u2 = ap(n, this.unsigned), c = u2.mul(t);
      u2.isZero() && (u2 = oy), o = o.add(u2), a = a.sub(c);
    }
    return o;
  };
  Ba.div = Ba.divide;
  Ba.modulo = function(t) {
    if (nh(t) || (t = Qp(t)), np) {
      var r = (this.unsigned ? np.rem_u : np.rem_s)(this.low, this.high, t.low, t.high);
      return dl(r, np.get_high(), this.unsigned);
    }
    return this.sub(this.div(t).mul(t));
  };
  Ba.mod = Ba.modulo;
  Ba.rem = Ba.modulo;
  Ba.not = function() {
    return dl(~this.low, ~this.high, this.unsigned);
  };
  Ba.and = function(t) {
    return nh(t) || (t = Qp(t)), dl(this.low & t.low, this.high & t.high, this.unsigned);
  };
  Ba.or = function(t) {
    return nh(t) || (t = Qp(t)), dl(this.low | t.low, this.high | t.high, this.unsigned);
  };
  Ba.xor = function(t) {
    return nh(t) || (t = Qp(t)), dl(this.low ^ t.low, this.high ^ t.high, this.unsigned);
  };
  Ba.shiftLeft = function(t) {
    return nh(t) && (t = t.toInt()), (t &= 63) === 0 ? this : t < 32 ? dl(this.low << t, this.high << t | this.low >>> 32 - t, this.unsigned) : dl(0, this.low << t - 32, this.unsigned);
  };
  Ba.shl = Ba.shiftLeft;
  Ba.shiftRight = function(t) {
    return nh(t) && (t = t.toInt()), (t &= 63) === 0 ? this : t < 32 ? dl(this.low >>> t | this.high << 32 - t, this.high >> t, this.unsigned) : dl(this.high >> t - 32, this.high >= 0 ? 0 : -1, this.unsigned);
  };
  Ba.shr = Ba.shiftRight;
  Ba.shiftRightUnsigned = function(t) {
    if (nh(t) && (t = t.toInt()), t &= 63, t === 0) return this;
    var r = this.high;
    if (t < 32) {
      var n = this.low;
      return dl(n >>> t | r << 32 - t, r >>> t, this.unsigned);
    } else return t === 32 ? dl(r, 0, this.unsigned) : dl(r >>> t - 32, 0, this.unsigned);
  };
  Ba.shru = Ba.shiftRightUnsigned;
  Ba.shr_u = Ba.shiftRightUnsigned;
  Ba.toSigned = function() {
    return this.unsigned ? dl(this.low, this.high, false) : this;
  };
  Ba.toUnsigned = function() {
    return this.unsigned ? this : dl(this.low, this.high, true);
  };
  Ba.toBytes = function(t) {
    return t ? this.toBytesLE() : this.toBytesBE();
  };
  Ba.toBytesLE = function() {
    var t = this.high, r = this.low;
    return [r & 255, r >>> 8 & 255, r >>> 16 & 255, r >>> 24, t & 255, t >>> 8 & 255, t >>> 16 & 255, t >>> 24];
  };
  Ba.toBytesBE = function() {
    var t = this.high, r = this.low;
    return [t >>> 24, t >>> 16 & 255, t >>> 8 & 255, t & 255, r >>> 24, r >>> 16 & 255, r >>> 8 & 255, r & 255];
  };
  pl.fromBytes = function(t, r, n) {
    return n ? pl.fromBytesLE(t, r) : pl.fromBytesBE(t, r);
  };
  pl.fromBytesLE = function(t, r) {
    return new pl(t[0] | t[1] << 8 | t[2] << 16 | t[3] << 24, t[4] | t[5] << 8 | t[6] << 16 | t[7] << 24, r);
  };
  pl.fromBytesBE = function(t, r) {
    return new pl(t[4] << 24 | t[5] << 16 | t[6] << 8 | t[7], t[0] << 24 | t[1] << 16 | t[2] << 8 | t[3], r);
  };
});
var Aj = ri((xl) => {
  "use strict";
  Object.defineProperty(xl, "__esModule", { value: true });
  var ur = Gm();
  function e1e(e) {
    if (e && e.__esModule) return e;
    var t = /* @__PURE__ */ Object.create(null);
    return e && Object.keys(e).forEach(function(r) {
      if (r !== "default") {
        var n = Object.getOwnPropertyDescriptor(e, r);
        Object.defineProperty(t, r, n.get ? n : { enumerable: true, get: function() {
          return e[r];
        } });
      }
    }), t.default = e, t;
  }
  var Wt = e1e(ur);
  var w5 = function(e, t) {
    return w5 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, n) {
      r.__proto__ = n;
    } || function(r, n) {
      for (var a in n) n.hasOwnProperty(a) && (r[a] = n[a]);
    }, w5(e, t);
  };
  function Hn(e, t) {
    w5(e, t);
    function r() {
      this.constructor = e;
    }
    e.prototype = t === null ? Object.create(t) : (r.prototype = t.prototype, new r());
  }
  function Ni(e, t, r, n) {
    function a(o) {
      return o instanceof r ? o : new r(function(s) {
        s(o);
      });
    }
    return new (r || (r = Promise))(function(o, s) {
      function i(c) {
        try {
          u3(n.next(c));
        } catch (f) {
          s(f);
        }
      }
      function l(c) {
        try {
          u3(n.throw(c));
        } catch (f) {
          s(f);
        }
      }
      function u3(c) {
        c.done ? o(c.value) : a(c.value).then(i, l);
      }
      u3((n = n.apply(e, t || [])).next());
    });
  }
  function Ei(e, t) {
    var r = { label: 0, sent: function() {
      if (o[0] & 1) throw o[1];
      return o[1];
    }, trys: [], ops: [] }, n, a, o, s;
    return s = { next: i(0), throw: i(1), return: i(2) }, typeof Symbol == "function" && (s[Symbol.iterator] = function() {
      return this;
    }), s;
    function i(u3) {
      return function(c) {
        return l([u3, c]);
      };
    }
    function l(u3) {
      if (n) throw new TypeError("Generator is already executing.");
      for (; r; ) try {
        if (n = 1, a && (o = u3[0] & 2 ? a.return : u3[0] ? a.throw || ((o = a.return) && o.call(a), 0) : a.next) && !(o = o.call(a, u3[1])).done) return o;
        switch (a = 0, o && (u3 = [u3[0] & 2, o.value]), u3[0]) {
          case 0:
          case 1:
            o = u3;
            break;
          case 4:
            return r.label++, { value: u3[1], done: false };
          case 5:
            r.label++, a = u3[1], u3 = [0];
            continue;
          case 7:
            u3 = r.ops.pop(), r.trys.pop();
            continue;
          default:
            if (o = r.trys, !(o = o.length > 0 && o[o.length - 1]) && (u3[0] === 6 || u3[0] === 2)) {
              r = 0;
              continue;
            }
            if (u3[0] === 3 && (!o || u3[1] > o[0] && u3[1] < o[3])) {
              r.label = u3[1];
              break;
            }
            if (u3[0] === 6 && r.label < o[1]) {
              r.label = o[1], o = u3;
              break;
            }
            if (o && r.label < o[2]) {
              r.label = o[2], r.ops.push(u3);
              break;
            }
            o[2] && r.ops.pop(), r.trys.pop();
            continue;
        }
        u3 = t.call(e, r);
      } catch (c) {
        u3 = [6, c], a = 0;
      } finally {
        n = o = 0;
      }
      if (u3[0] & 5) throw u3[1];
      return { value: u3[0] ? u3[1] : void 0, done: true };
    }
  }
  function Qn(e) {
    var t = typeof Symbol == "function" && Symbol.iterator, r = t && e[t], n = 0;
    if (r) return r.call(e);
    if (e && typeof e.length == "number") return { next: function() {
      return e && n >= e.length && (e = void 0), { value: e && e[n++], done: !e };
    } };
    throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
  }
  function pa(e, t) {
    var r = typeof Symbol == "function" && e[Symbol.iterator];
    if (!r) return e;
    var n = r.call(e), a, o = [], s;
    try {
      for (; (t === void 0 || t-- > 0) && !(a = n.next()).done; ) o.push(a.value);
    } catch (i) {
      s = { error: i };
    } finally {
      try {
        a && !a.done && (r = n.return) && r.call(n);
      } finally {
        if (s) throw s.error;
      }
    }
    return o;
  }
  function bo() {
    for (var e = [], t = 0; t < arguments.length; t++) e = e.concat(pa(arguments[t]));
    return e;
  }
  var t1e = "Abs", r1e = "Acos", n1e = "Acosh", V5 = "Add", a1e = "AddN", i1e = "ArgMax", o1e = "ArgMin", s1e = "Asin", l1e = "Asinh", u1e = "Atan", c1e = "Atanh", f1e = "Atan2", h1e = "AvgPool", p1e = "AvgPoolGrad", d1e = "AvgPool3D", v1e = "AvgPool3DGrad", iU = "BatchMatMul", oU = "BatchToSpaceND", m1e = "BroadcastTo", j5 = "Cast", g1e = "Ceil", y1e = "ClipByValue", x1e = "Complex", b1e = "ComplexAbs", sU = "Concat", lU = "Conv2D", _1e = "Conv2DBackpropFilter", uU = "Conv2DBackpropInput", w1e = "Conv3D", k1e = "Conv3DBackpropFilterV2", T1e = "Conv3DBackpropInputV2", cU = "Cos", fU = "Cosh", hU = "Cumsum", A1e = "DepthwiseConv2dNative", S1e = "DepthwiseConv2dNativeBackpropFilter", E1e = "DepthwiseConv2dNativeBackpropInput", D1e = "Dilation2D", C1e = "Dilation2DBackpropInput", M1e = "Dilation2DBackpropFilter", pU = "RealDiv", I1e = "Elu", N1e = "EluGrad", F1e = "Erf", O1e = "Equal", dU = "Exp", vU = "ExpandDims", P1e = "Expm1", mU = "Floor", gU = "FloorDiv", L1e = "FusedBatchNorm", yU = "GatherV2", R1e = "Greater", xU = "GreaterEqual", W5 = "Identity", z1e = "IsFinite", B1e = "IsInf", U1e = "IsNan", V1e = "LeakyRelu", j1e = "Less", W1e = "LessEqual", bU = "Log", G1e = "Log1p", $1e = "LogicalAnd", H1e = "LogicalNot", q1e = "LogSoftmax", X1e = "LRN", K1e = "LRNGrad", Y1e = "Max", _U = "Maximum", Z1e = "MaxPool", J1e = "MaxPoolGrad", Q1e = "MaxPool3D", eye = "MaxPool3DGrad", tye = "Mean", rye = "Min", nye = "Minimum", aye = "MirrorPad", iye = "Mod", wU = "Multiply", kU = "Neg", oye = "OnesLike", sye = "OneHot", TU = "Pack", AU = "PadV2", SU = "Pow", lye = "Prelu", uye = "Reciprocal", cye = "Relu", EU = "Reshape", fye = "ResizeNearestNeighbor", hye = "ResizeNearestNeighborGrad", pye = "ResizeBilinear", dye = "ResizeBilinearGrad", vye = "Relu6", DU = "Reverse", mye = "Round", CU = "Rsqrt", MU = "Select", gye = "Selu", IU = "Slice", NU = "Sin", FU = "Sinh", yye = "Sign", OU = "Sigmoid", xye = "Softplus", PU = "Sqrt", LU = "Sum", RU = "SpaceToBatchND", zU = "SplitV", bye = "Softmax", _ye = "SquaredDifference", wye = "Square", BU = "Sub", kye = "Tan", Tye = "Tanh", G5 = "Tile", UU = "Transpose", VU = "Unpack", jU = "UnsortedSegmentSum", WU = "ZerosLike", GU = "Step";
  var Aye = 1e-7, Sye = 1e-4, Eye = function() {
    function e() {
    }
    return e.prototype.refCount = function(t) {
      return Ch("refCount");
    }, e.prototype.incRef = function(t) {
      return Ch("incRef");
    }, e.prototype.timerAvailable = function() {
      return true;
    }, e.prototype.time = function(t) {
      return Ch("time");
    }, e.prototype.read = function(t) {
      return Ch("read");
    }, e.prototype.readSync = function(t) {
      return Ch("readSync");
    }, e.prototype.readToGPU = function(t, r) {
      return Ch("readToGPU");
    }, e.prototype.numDataIds = function() {
      return Ch("numDataIds");
    }, e.prototype.disposeData = function(t, r) {
      return Ch("disposeData");
    }, e.prototype.write = function(t, r, n) {
      return Ch("write");
    }, e.prototype.move = function(t, r, n, a, o) {
      return Ch("move");
    }, e.prototype.memory = function() {
      return Ch("memory");
    }, e.prototype.floatPrecision = function() {
      return Ch("floatPrecision");
    }, e.prototype.epsilon = function() {
      return this.floatPrecision() === 32 ? Aye : Sye;
    }, e.prototype.dispose = function() {
      return Ch("dispose");
    }, e;
  }();
  function Ch(e) {
    throw new Error("'" + e + "' not yet implemented or not found in the registry. This kernel may not be supported by the tfjs backend you have chosen");
  }
  function Ca(e, t) {
    if (!e) throw new Error(typeof t == "string" ? t : t());
  }
  function Dye(e, t, r) {
    r === void 0 && (r = ""), Ca($5(e, t), function() {
      return r + (" Shapes " + e + " and " + t + " must match");
    });
  }
  function lk(e, t, r) {
    if (t === void 0 && (t = []), r === void 0 && (r = false), t == null && (t = []), Array.isArray(e) || $d(e) && !r) for (var n = 0; n < e.length; ++n) lk(e[n], t, r);
    else t.push(e);
    return t;
  }
  function Wd(e) {
    if (e.length === 0) return 1;
    for (var t = e[0], r = 1; r < e.length; r++) t *= e[r];
    return t;
  }
  function $5(e, t) {
    if (e === t) return true;
    if (e == null || t == null || e.length !== t.length) return false;
    for (var r = 0; r < e.length; r++) if (e[r] !== t[r]) return false;
    return true;
  }
  function Y3(e) {
    return e % 1 === 0;
  }
  function X3(e, t) {
    return t <= e.length ? e : e + " ".repeat(t - e.length);
  }
  function Qm(e, t) {
    var r = t.length;
    return e = e == null ? t.map(function(n, a) {
      return a;
    }) : [].concat(e), Ca(e.every(function(n) {
      return n >= -r && n < r;
    }), function() {
      return "All values in axis param must be in range [-" + r + ", " + r + ") but " + ("got axis " + e);
    }), Ca(e.every(function(n) {
      return Y3(n);
    }), function() {
      return "All values in axis param must be integers but " + ("got axis " + e);
    }), e.map(function(n) {
      return n < 0 ? r + n : n;
    });
  }
  function Cye(e, t) {
    var r = null;
    if (e == null || e === "float32") r = new Float32Array(t);
    else if (e === "int32") r = new Int32Array(t);
    else if (e === "bool") r = new Uint8Array(t);
    else if (e === "string") r = new Array(t);
    else throw new Error("Unknown data type " + e);
    return r;
  }
  function Mye(e, t) {
    for (var r = 0; r < e.length; r++) {
      var n = e[r];
      if (isNaN(n) || !isFinite(n)) throw Error("A tensor of type " + t + " being uploaded contains " + n + ".");
    }
  }
  function Iye(e) {
    return e === "bool" || e === "complex64" || e === "float32" || e === "int32" || e === "string";
  }
  function $d(e) {
    return e instanceof Float32Array || e instanceof Int32Array || e instanceof Uint8Array || e instanceof Uint8ClampedArray;
  }
  function fB(e) {
    if (e === "float32" || e === "int32") return 4;
    if (e === "complex64") return 8;
    if (e === "bool") return 1;
    throw new Error("Unknown dtype " + e);
  }
  function Nye(e) {
    if (e == null) return 0;
    var t = 0;
    return e.forEach(function(r) {
      return t += r.length;
    }), t;
  }
  function H5(e) {
    return typeof e == "string" || e instanceof String;
  }
  function Fye(e) {
    return typeof e == "boolean";
  }
  function Oye(e) {
    return typeof e == "number";
  }
  function q5(e) {
    return Array.isArray(e) ? q5(e[0]) : e instanceof Float32Array ? "float32" : e instanceof Int32Array || e instanceof Uint8Array || e instanceof Uint8ClampedArray ? "int32" : Oye(e) ? "float32" : H5(e) ? "string" : Fye(e) ? "bool" : "float32";
  }
  function hB(e) {
    return !!(e && e.constructor && e.call && e.apply);
  }
  function X5(e) {
    var t = e.length;
    if (t < 2) return [];
    var r = new Array(t - 1);
    r[t - 2] = e[t - 1];
    for (var n = t - 3; n >= 0; --n) r[n] = r[n + 1] * e[n + 1];
    return r;
  }
  function $U(e, t, r, n) {
    n === void 0 && (n = false);
    var a = new Array();
    if (t.length === 1) for (var o = t[0] * (n ? 2 : 1), s = 0; s < o; s++) a[s] = r[e + s];
    else for (var o = t[0], i = t.slice(1), l = i.reduce(function(c, f) {
      return c * f;
    }) * (n ? 2 : 1), s = 0; s < o; s++) a[s] = $U(e + s * l, i, r, n);
    return a;
  }
  function pB(e, t, r) {
    if (r === void 0 && (r = false), e.length === 0) return t[0];
    var n = e.reduce(function(a, o) {
      return a * o;
    }) * (r ? 2 : 1);
    if (n === 0) return [];
    if (n !== t.length) throw new Error("[" + e + "] does not match the input size " + t.length + (r ? " for a complex tensor" : "") + ".");
    return $U(0, e, t, r);
  }
  function HU(e, t) {
    for (var r = K5(e, t), n = 0; n < r.length; n++) r[n] = 1;
    return r;
  }
  function K5(e, t) {
    if (t == null || t === "float32" || t === "complex64") return new Float32Array(e);
    if (t === "int32") return new Int32Array(e);
    if (t === "bool") return new Uint8Array(e);
    throw new Error("Unknown data type " + t);
  }
  function Pye(e) {
    e.forEach(function(t) {
      Ca(Number.isInteger(t) && t >= 0, function() {
        return "Tensor must have a shape comprised of positive integers but got " + ("shape [" + e + "].");
      });
    });
  }
  function qU(e) {
    return e && e.then && typeof e.then == "function";
  }
  var dB = "tfjsflags", Lye = function() {
    function e(t) {
      this.global = t, this.flags = {}, this.flagRegistry = {}, this.urlFlags = {}, this.getQueryParams = Rye, this.populateURLFlags();
    }
    return e.prototype.setPlatform = function(t, r) {
      this.platform != null && (Mh().getBool("IS_TEST") || Mh().getBool("PROD") || console.warn("Platform " + this.platformName + " has already been set. " + ("Overwriting the platform with " + r + "."))), this.platformName = t, this.platform = r;
    }, e.prototype.registerFlag = function(t, r, n) {
      if (this.flagRegistry[t] = { evaluationFn: r, setHook: n }, this.urlFlags[t] != null) {
        var a = this.urlFlags[t];
        Mh().getBool("IS_TEST") || Mh().getBool("PROD") || console.warn("Setting feature override from URL " + t + ": " + a + "."), this.set(t, a);
      }
    }, e.prototype.getAsync = function(t) {
      return Ni(this, void 0, void 0, function() {
        var r, n;
        return Ei(this, function(a) {
          switch (a.label) {
            case 0:
              return t in this.flags ? [2, this.flags[t]] : (r = this.flags, n = t, [4, this.evaluateFlag(t)]);
            case 1:
              return r[n] = a.sent(), [2, this.flags[t]];
          }
        });
      });
    }, e.prototype.get = function(t) {
      if (t in this.flags) return this.flags[t];
      var r = this.evaluateFlag(t);
      if (qU(r)) throw new Error("Flag " + t + " cannot be synchronously evaluated. Please use getAsync() instead.");
      return this.flags[t] = r, this.flags[t];
    }, e.prototype.getNumber = function(t) {
      return this.get(t);
    }, e.prototype.getBool = function(t) {
      return this.get(t);
    }, e.prototype.getFlags = function() {
      return this.flags;
    }, Object.defineProperty(e.prototype, "features", { get: function() {
      return this.flags;
    }, enumerable: true, configurable: true }), e.prototype.set = function(t, r) {
      if (this.flagRegistry[t] == null) throw new Error("Cannot set flag " + t + " as it has not been registered.");
      this.flags[t] = r, this.flagRegistry[t].setHook != null && this.flagRegistry[t].setHook(r);
    }, e.prototype.evaluateFlag = function(t) {
      if (this.flagRegistry[t] == null) throw new Error("Cannot evaluate flag '" + t + "': no evaluation function found.");
      return this.flagRegistry[t].evaluationFn();
    }, e.prototype.setFlags = function(t) {
      this.flags = Object.assign({}, t);
    }, e.prototype.reset = function() {
      this.flags = {}, this.urlFlags = {}, this.populateURLFlags();
    }, e.prototype.populateURLFlags = function() {
      var t = this;
      if (!(typeof this.global > "u" || typeof this.global.location > "u" || typeof this.global.location.search > "u")) {
        var r = this.getQueryParams(this.global.location.search);
        if (dB in r) {
          var n = r[dB].split(",");
          n.forEach(function(a) {
            var o = pa(a.split(":"), 2), s = o[0], i = o[1];
            t.urlFlags[s] = Bye(s, i);
          });
        }
      }
    }, e;
  }();
  function Rye(e) {
    var t = {};
    return e.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g, function(r) {
      for (var n = [], a = 1; a < arguments.length; a++) n[a - 1] = arguments[a];
      return zye(t, n[0], n[1]), n.join("=");
    }), t;
  }
  function zye(e, t, r) {
    e[decodeURIComponent(t)] = decodeURIComponent(r || "");
  }
  function Bye(e, t) {
    if (t = t.toLowerCase(), t === "true" || t === "false") return t === "true";
    if ("" + +t === t) return +t;
    throw new Error("Could not parse value flag value " + t + " for flag " + e + ".");
  }
  function Mh() {
    return XU;
  }
  var XU = null;
  function Uye(e) {
    XU = e;
  }
  var h5;
  function KU() {
    if (h5 == null) {
      var e = void 0;
      if (typeof window < "u") e = window;
      else if (typeof global < "u") e = global;
      else if (typeof process < "u") e = process;
      else if (typeof self < "u") e = self;
      else throw new Error("Could not find a global object");
      h5 = e;
    }
    return h5;
  }
  function Vye() {
    var e = KU();
    return e._tfGlobals == null && (e._tfGlobals = /* @__PURE__ */ new Map()), e._tfGlobals;
  }
  function Y5(e, t) {
    var r = Vye();
    if (r.has(e)) return r.get(e);
    var n = t();
    return r.set(e, n), r.get(e);
  }
  function cy() {
    for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
    Mh().getBool("IS_TEST") || Mh().getBool("PROD") || console.warn.apply(console, bo(e));
  }
  var YU = Y5("kernelRegistry", function() {
    return /* @__PURE__ */ new Map();
  }), k5 = Y5("gradRegistry", function() {
    return /* @__PURE__ */ new Map();
  });
  function vB(e, t) {
    var r = Wye(e, t);
    return YU.get(r);
  }
  function mB(e) {
    return k5.get(e);
  }
  function gB(e) {
    for (var t = YU.entries(), r = []; ; ) {
      var n = t.next(), a = n.done, o = n.value;
      if (a) break;
      var s = pa(o, 2), i = s[0], l = s[1], u3 = pa(i.split("_"), 1), c = u3[0];
      c === e && r.push(l);
    }
    return r;
  }
  function jye(e) {
    var t = e.kernelName;
    k5.has(t) && Mh().getBool("DEBUG") && cy("Overriding the gradient for '" + t + "'"), k5.set(t, e);
  }
  function Wye(e, t) {
    return t + "_" + e;
  }
  var T5 = ml, lp = null;
  try {
    lp = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11])), {}).exports;
  } catch {
  }
  function ml(e, t, r) {
    this.low = e | 0, this.high = t | 0, this.unsigned = !!r;
  }
  ml.prototype.__isLong__;
  Object.defineProperty(ml.prototype, "__isLong__", { value: true });
  function ih(e) {
    return (e && e.__isLong__) === true;
  }
  ml.isLong = ih;
  var yB = {}, xB = {};
  function eg(e, t) {
    var r, n, a;
    return t ? (e >>>= 0, (a = 0 <= e && e < 256) && (n = xB[e], n) ? n : (r = yl(e, (e | 0) < 0 ? -1 : 0, true), a && (xB[e] = r), r)) : (e |= 0, (a = -128 <= e && e < 128) && (n = yB[e], n) ? n : (r = yl(e, e < 0 ? -1 : 0, false), a && (yB[e] = r), r));
  }
  ml.fromInt = eg;
  function up(e, t) {
    if (isNaN(e)) return t ? Xm : cp;
    if (t) {
      if (e < 0) return Xm;
      if (e >= ZU) return eV;
    } else {
      if (e <= -_B) return ah;
      if (e + 1 >= _B) return QU;
    }
    return e < 0 ? up(-e, t).neg() : yl(e % vy | 0, e / vy | 0, t);
  }
  ml.fromNumber = up;
  function yl(e, t, r) {
    return new ml(e, t, r);
  }
  ml.fromBits = yl;
  var Z3 = Math.pow;
  function Z5(e, t, r) {
    if (e.length === 0) throw Error("empty string");
    if (e === "NaN" || e === "Infinity" || e === "+Infinity" || e === "-Infinity") return cp;
    if (typeof t == "number" ? (r = t, t = false) : t = !!t, r = r || 10, r < 2 || 36 < r) throw RangeError("radix");
    var n;
    if ((n = e.indexOf("-")) > 0) throw Error("interior hyphen");
    if (n === 0) return Z5(e.substring(1), t, r).neg();
    for (var a = up(Z3(r, 8)), o = cp, s = 0; s < e.length; s += 8) {
      var i = Math.min(8, e.length - s), l = parseInt(e.substring(s, s + i), r);
      if (i < 8) {
        var u3 = up(Z3(r, i));
        o = o.mul(u3).add(up(l));
      } else o = o.mul(a), o = o.add(up(l));
    }
    return o.unsigned = t, o;
  }
  ml.fromString = Z5;
  function sd(e, t) {
    return typeof e == "number" ? up(e, t) : typeof e == "string" ? Z5(e, t) : yl(e.low, e.high, typeof t == "boolean" ? t : e.unsigned);
  }
  ml.fromValue = sd;
  var bB = 1 << 16, Gye = 1 << 24, vy = bB * bB, ZU = vy * vy, _B = ZU / 2, wB = eg(Gye), cp = eg(0);
  ml.ZERO = cp;
  var Xm = eg(0, true);
  ml.UZERO = Xm;
  var fy = eg(1);
  ml.ONE = fy;
  var JU = eg(1, true);
  ml.UONE = JU;
  var A5 = eg(-1);
  ml.NEG_ONE = A5;
  var QU = yl(-1, 2147483647, false);
  ml.MAX_VALUE = QU;
  var eV = yl(-1, -1, true);
  ml.MAX_UNSIGNED_VALUE = eV;
  var ah = yl(0, -2147483648, false);
  ml.MIN_VALUE = ah;
  var Ua = ml.prototype;
  Ua.toInt = function() {
    return this.unsigned ? this.low >>> 0 : this.low;
  };
  Ua.toNumber = function() {
    return this.unsigned ? (this.high >>> 0) * vy + (this.low >>> 0) : this.high * vy + (this.low >>> 0);
  };
  Ua.toString = function(t) {
    if (t = t || 10, t < 2 || 36 < t) throw RangeError("radix");
    if (this.isZero()) return "0";
    if (this.isNegative()) if (this.eq(ah)) {
      var r = up(t), n = this.div(r), a = n.mul(r).sub(this);
      return n.toString(t) + a.toInt().toString(t);
    } else return "-" + this.neg().toString(t);
    for (var o = up(Z3(t, 6), this.unsigned), s = this, i = ""; ; ) {
      var l = s.div(o), u3 = s.sub(l.mul(o)).toInt() >>> 0, c = u3.toString(t);
      if (s = l, s.isZero()) return c + i;
      for (; c.length < 6; ) c = "0" + c;
      i = "" + c + i;
    }
  };
  Ua.getHighBits = function() {
    return this.high;
  };
  Ua.getHighBitsUnsigned = function() {
    return this.high >>> 0;
  };
  Ua.getLowBits = function() {
    return this.low;
  };
  Ua.getLowBitsUnsigned = function() {
    return this.low >>> 0;
  };
  Ua.getNumBitsAbs = function() {
    if (this.isNegative()) return this.eq(ah) ? 64 : this.neg().getNumBitsAbs();
    for (var t = this.high != 0 ? this.high : this.low, r = 31; r > 0 && (t & 1 << r) == 0; r--) ;
    return this.high != 0 ? r + 33 : r + 1;
  };
  Ua.isZero = function() {
    return this.high === 0 && this.low === 0;
  };
  Ua.eqz = Ua.isZero;
  Ua.isNegative = function() {
    return !this.unsigned && this.high < 0;
  };
  Ua.isPositive = function() {
    return this.unsigned || this.high >= 0;
  };
  Ua.isOdd = function() {
    return (this.low & 1) === 1;
  };
  Ua.isEven = function() {
    return (this.low & 1) === 0;
  };
  Ua.equals = function(t) {
    return ih(t) || (t = sd(t)), this.unsigned !== t.unsigned && this.high >>> 31 === 1 && t.high >>> 31 === 1 ? false : this.high === t.high && this.low === t.low;
  };
  Ua.eq = Ua.equals;
  Ua.notEquals = function(t) {
    return !this.eq(t);
  };
  Ua.neq = Ua.notEquals;
  Ua.ne = Ua.notEquals;
  Ua.lessThan = function(t) {
    return this.comp(t) < 0;
  };
  Ua.lt = Ua.lessThan;
  Ua.lessThanOrEqual = function(t) {
    return this.comp(t) <= 0;
  };
  Ua.lte = Ua.lessThanOrEqual;
  Ua.le = Ua.lessThanOrEqual;
  Ua.greaterThan = function(t) {
    return this.comp(t) > 0;
  };
  Ua.gt = Ua.greaterThan;
  Ua.greaterThanOrEqual = function(t) {
    return this.comp(t) >= 0;
  };
  Ua.gte = Ua.greaterThanOrEqual;
  Ua.ge = Ua.greaterThanOrEqual;
  Ua.compare = function(t) {
    if (ih(t) || (t = sd(t)), this.eq(t)) return 0;
    var r = this.isNegative(), n = t.isNegative();
    return r && !n ? -1 : !r && n ? 1 : this.unsigned ? t.high >>> 0 > this.high >>> 0 || t.high === this.high && t.low >>> 0 > this.low >>> 0 ? -1 : 1 : this.sub(t).isNegative() ? -1 : 1;
  };
  Ua.comp = Ua.compare;
  Ua.negate = function() {
    return !this.unsigned && this.eq(ah) ? ah : this.not().add(fy);
  };
  Ua.neg = Ua.negate;
  Ua.add = function(t) {
    ih(t) || (t = sd(t));
    var r = this.high >>> 16, n = this.high & 65535, a = this.low >>> 16, o = this.low & 65535, s = t.high >>> 16, i = t.high & 65535, l = t.low >>> 16, u3 = t.low & 65535, c = 0, f = 0, h = 0, p = 0;
    return p += o + u3, h += p >>> 16, p &= 65535, h += a + l, f += h >>> 16, h &= 65535, f += n + i, c += f >>> 16, f &= 65535, c += r + s, c &= 65535, yl(h << 16 | p, c << 16 | f, this.unsigned);
  };
  Ua.subtract = function(t) {
    return ih(t) || (t = sd(t)), this.add(t.neg());
  };
  Ua.sub = Ua.subtract;
  Ua.multiply = function(t) {
    if (this.isZero()) return cp;
    if (ih(t) || (t = sd(t)), lp) {
      var r = lp.mul(this.low, this.high, t.low, t.high);
      return yl(r, lp.get_high(), this.unsigned);
    }
    if (t.isZero()) return cp;
    if (this.eq(ah)) return t.isOdd() ? ah : cp;
    if (t.eq(ah)) return this.isOdd() ? ah : cp;
    if (this.isNegative()) return t.isNegative() ? this.neg().mul(t.neg()) : this.neg().mul(t).neg();
    if (t.isNegative()) return this.mul(t.neg()).neg();
    if (this.lt(wB) && t.lt(wB)) return up(this.toNumber() * t.toNumber(), this.unsigned);
    var n = this.high >>> 16, a = this.high & 65535, o = this.low >>> 16, s = this.low & 65535, i = t.high >>> 16, l = t.high & 65535, u3 = t.low >>> 16, c = t.low & 65535, f = 0, h = 0, p = 0, d = 0;
    return d += s * c, p += d >>> 16, d &= 65535, p += o * c, h += p >>> 16, p &= 65535, p += s * u3, h += p >>> 16, p &= 65535, h += a * c, f += h >>> 16, h &= 65535, h += o * u3, f += h >>> 16, h &= 65535, h += s * l, f += h >>> 16, h &= 65535, f += n * c + a * u3 + o * l + s * i, f &= 65535, yl(p << 16 | d, f << 16 | h, this.unsigned);
  };
  Ua.mul = Ua.multiply;
  Ua.divide = function(t) {
    if (ih(t) || (t = sd(t)), t.isZero()) throw Error("division by zero");
    if (lp) {
      if (!this.unsigned && this.high === -2147483648 && t.low === -1 && t.high === -1) return this;
      var r = (this.unsigned ? lp.div_u : lp.div_s)(this.low, this.high, t.low, t.high);
      return yl(r, lp.get_high(), this.unsigned);
    }
    if (this.isZero()) return this.unsigned ? Xm : cp;
    var n, a, o;
    if (this.unsigned) {
      if (t.unsigned || (t = t.toUnsigned()), t.gt(this)) return Xm;
      if (t.gt(this.shru(1))) return JU;
      o = Xm;
    } else {
      if (this.eq(ah)) {
        if (t.eq(fy) || t.eq(A5)) return ah;
        if (t.eq(ah)) return fy;
        var s = this.shr(1);
        return n = s.div(t).shl(1), n.eq(cp) ? t.isNegative() ? fy : A5 : (a = this.sub(t.mul(n)), o = n.add(a.div(t)), o);
      } else if (t.eq(ah)) return this.unsigned ? Xm : cp;
      if (this.isNegative()) return t.isNegative() ? this.neg().div(t.neg()) : this.neg().div(t).neg();
      if (t.isNegative()) return this.div(t.neg()).neg();
      o = cp;
    }
    for (a = this; a.gte(t); ) {
      n = Math.max(1, Math.floor(a.toNumber() / t.toNumber()));
      for (var i = Math.ceil(Math.log(n) / Math.LN2), l = i <= 48 ? 1 : Z3(2, i - 48), u3 = up(n), c = u3.mul(t); c.isNegative() || c.gt(a); ) n -= l, u3 = up(n, this.unsigned), c = u3.mul(t);
      u3.isZero() && (u3 = fy), o = o.add(u3), a = a.sub(c);
    }
    return o;
  };
  Ua.div = Ua.divide;
  Ua.modulo = function(t) {
    if (ih(t) || (t = sd(t)), lp) {
      var r = (this.unsigned ? lp.rem_u : lp.rem_s)(this.low, this.high, t.low, t.high);
      return yl(r, lp.get_high(), this.unsigned);
    }
    return this.sub(this.div(t).mul(t));
  };
  Ua.mod = Ua.modulo;
  Ua.rem = Ua.modulo;
  Ua.not = function() {
    return yl(~this.low, ~this.high, this.unsigned);
  };
  Ua.and = function(t) {
    return ih(t) || (t = sd(t)), yl(this.low & t.low, this.high & t.high, this.unsigned);
  };
  Ua.or = function(t) {
    return ih(t) || (t = sd(t)), yl(this.low | t.low, this.high | t.high, this.unsigned);
  };
  Ua.xor = function(t) {
    return ih(t) || (t = sd(t)), yl(this.low ^ t.low, this.high ^ t.high, this.unsigned);
  };
  Ua.shiftLeft = function(t) {
    return ih(t) && (t = t.toInt()), (t &= 63) === 0 ? this : t < 32 ? yl(this.low << t, this.high << t | this.low >>> 32 - t, this.unsigned) : yl(0, this.low << t - 32, this.unsigned);
  };
  Ua.shl = Ua.shiftLeft;
  Ua.shiftRight = function(t) {
    return ih(t) && (t = t.toInt()), (t &= 63) === 0 ? this : t < 32 ? yl(this.low >>> t | this.high << 32 - t, this.high >> t, this.unsigned) : yl(this.high >> t - 32, this.high >= 0 ? 0 : -1, this.unsigned);
  };
  Ua.shr = Ua.shiftRight;
  Ua.shiftRightUnsigned = function(t) {
    if (ih(t) && (t = t.toInt()), t &= 63, t === 0) return this;
    var r = this.high;
    if (t < 32) {
      var n = this.low;
      return yl(n >>> t | r << 32 - t, r >>> t, this.unsigned);
    } else return t === 32 ? yl(r, 0, this.unsigned) : yl(r >>> t - 32, 0, this.unsigned);
  };
  Ua.shru = Ua.shiftRightUnsigned;
  Ua.shr_u = Ua.shiftRightUnsigned;
  Ua.toSigned = function() {
    return this.unsigned ? yl(this.low, this.high, false) : this;
  };
  Ua.toUnsigned = function() {
    return this.unsigned ? this : yl(this.low, this.high, true);
  };
  Ua.toBytes = function(t) {
    return t ? this.toBytesLE() : this.toBytesBE();
  };
  Ua.toBytesLE = function() {
    var t = this.high, r = this.low;
    return [r & 255, r >>> 8 & 255, r >>> 16 & 255, r >>> 24, t & 255, t >>> 8 & 255, t >>> 16 & 255, t >>> 24];
  };
  Ua.toBytesBE = function() {
    var t = this.high, r = this.low;
    return [t >>> 24, t >>> 16 & 255, t >>> 8 & 255, t & 255, r >>> 24, r >>> 16 & 255, r >>> 8 & 255, r & 255];
  };
  ml.fromBytes = function(t, r, n) {
    return n ? ml.fromBytesLE(t, r) : ml.fromBytesBE(t, r);
  };
  ml.fromBytesLE = function(t, r) {
    return new ml(t[0] | t[1] << 8 | t[2] << 16 | t[3] << 24, t[4] | t[5] << 8 | t[6] << 16 | t[7] << 24, r);
  };
  ml.fromBytesBE = function(t, r) {
    return new ml(t[4] << 24 | t[5] << 16 | t[6] << 8 | t[7], t[0] << 24 | t[1] << 16 | t[2] << 8 | t[3], r);
  };
  var $ye = Object.assign(/* @__PURE__ */ Object.create(null), T5, { default: T5 }), Hye = T5 || $ye;
  function J5(e) {
    return Hye.fromString(e, true, 16);
  }
  J5("c3a5c85c97cb3127");
  J5("b492b66fbe98f273");
  J5("9ae16a3b2f90404f");
  function qye(e, t) {
    return e instanceof Float32Array && t === "float32" || e instanceof Int32Array && t === "int32" || e instanceof Uint8Array && t === "bool";
  }
  function tV(e, t) {
    if (t === "string") throw new Error("Cannot convert a string[] to a TypedArray");
    if (Array.isArray(e) && (e = lk(e)), Mh().getBool("DEBUG") && Mye(e, t), qye(e, t)) return e;
    if (t == null || t === "float32" || t === "complex64") return new Float32Array(e);
    if (t === "int32") return new Int32Array(e);
    if (t === "bool") {
      for (var r = new Uint8Array(e.length), n = 0; n < r.length; ++n) Math.round(e[n]) !== 0 && (r[n] = 1);
      return r;
    } else throw new Error("Unknown data type " + t);
  }
  function J3() {
    return Mh().platform.now();
  }
  function Xye(e, t) {
    return t === void 0 && (t = "utf-8"), t = t || "utf-8", Mh().platform.encode(e, t);
  }
  function kB(e, t) {
    return t === void 0 && (t = "utf-8"), t = t || "utf-8", Mh().platform.decode(e, t);
  }
  var Kye = function() {
    function e(t, r) {
      this.backendTimer = t, this.logger = r, r == null && (this.logger = new Zye());
    }
    return e.prototype.profileKernel = function(t, r, n) {
      var a, o, s, i = function() {
        s = n();
      }, l, u3 = J3();
      if (this.backendTimer.timerAvailable()) l = this.backendTimer.time(i);
      else {
        i();
        try {
          for (var c = Qn(s), f = c.next(); !f.done; f = c.next()) {
            var h = f.value;
            h.dataSync();
          }
        } catch (m) {
          a = { error: m };
        } finally {
          try {
            f && !f.done && (o = c.return) && o.call(c);
          } finally {
            if (a) throw a.error;
          }
        }
        l = Promise.resolve({ kernelMs: J3() - u3 });
      }
      if (Mh().getBool("CHECK_COMPUTATION_FOR_ERRORS")) for (var p = function(m) {
        var g = s[m];
        g.data().then(function(x) {
          Yye(x, g.dtype, t);
        });
      }, d = 0; d < s.length; d++) p(d);
      var v = { kernelName: t, outputs: s, inputs: r, timeMs: l.then(function(m) {
        return m.kernelMs;
      }), extraInfo: l.then(function(m) {
        return m.getExtraProfileInfo != null ? m.getExtraProfileInfo() : "";
      }) };
      return v;
    }, e.prototype.logKernelProfile = function(t) {
      var r = this, n = t.kernelName, a = t.outputs, o = t.timeMs, s = t.inputs, i = t.extraInfo;
      a.forEach(function(l) {
        Promise.all([l.data(), o, i]).then(function(u3) {
          r.logger.logKernelProfile(n, l, u3[0], u3[1], s, u3[2]);
        });
      });
    }, e;
  }();
  function Yye(e, t, r) {
    if (t !== "float32") return false;
    for (var n = 0; n < e.length; n++) {
      var a = e[n];
      if (isNaN(a) || !isFinite(a)) return console.warn("Found " + a + " in the result of '" + r + "'"), true;
    }
    return false;
  }
  var Zye = function() {
    function e() {
    }
    return e.prototype.logKernelProfile = function(t, r, n, a, o, s) {
      var i = typeof a == "number" ? X3(a + "ms", 9) : a.error, l = X3(t, 25), u3 = r.rank, c = r.size, f = X3(r.shape.toString(), 14), h = "";
      for (var p in o) {
        var d = o[p];
        if (d != null) {
          var v = d.shape || r.shape, m = v.length;
          h += p + ": " + m + "D " + (m > 0 ? v : "") + " ";
        }
      }
      console.log("%c" + l + "	%c" + i + "	%c" + u3 + "D " + f + "	%c" + c + "	%c" + h + "	%c" + s, "font-weight:bold", "color:red", "color:blue", "color: orange", "color: green", "color: steelblue");
    }, e;
  }();
  function Jye(e, t, r) {
    for (var n = {}, a = {}, o = 0; o < t.length; o++) n[t[o].id] = true;
    for (var o = 0; o < e.length; o++) {
      var s = e[o], i = s.inputs;
      for (var l in i) {
        for (var u3 = i[l], c = false, f = 0; f < t.length; f++) if (n[u3.id]) {
          s.outputs.forEach(function(b) {
            return n[b.id] = true;
          }), c = true, a[s.id] = true;
          break;
        }
        if (c) break;
      }
    }
    var h = {};
    h[r.id] = true;
    for (var p = {}, o = e.length - 1; o >= 0; o--) for (var s = e[o], i = s.inputs, f = 0; f < s.outputs.length; f++) if (h[s.outputs[f].id]) {
      for (var l in i) h[i[l].id] = true, p[s.id] = true;
      break;
    }
    for (var d = [], o = 0; o < e.length; o++) {
      var s = e[o];
      if (a[s.id] && p[s.id]) {
        var v = {};
        for (var l in s.inputs) {
          var m = s.inputs[l];
          n[m.id] && (v[l] = m);
        }
        var g = Object.assign({}, s);
        g.inputs = v, g.outputs = s.outputs, d.push(g);
      }
    }
    return d;
  }
  function Qye(e, t, r, n) {
    for (var a = function(s) {
      var i = t[s], l = [];
      if (i.outputs.forEach(function(h) {
        var p = e[h.id];
        p != null ? l.push(p) : l.push(null);
      }), i.gradient == null) throw new Error("Cannot compute gradient: gradient function not found " + ("for " + i.kernelName + "."));
      var u3 = i.gradient(l), c = function(h) {
        if (!(h in u3)) throw new Error("Cannot backprop through input " + h + ". " + ("Available gradients found: " + Object.keys(u3) + "."));
        var p = r(function() {
          return u3[h]();
        });
        if (p.dtype !== "float32") throw new Error("Error in gradient for op " + i.kernelName + ". The gradient of input " + (h + " must have 'float32' dtype, but has '" + p.dtype + "'"));
        var d = i.inputs[h];
        if (!$5(p.shape, d.shape)) throw new Error("Error in gradient for op " + i.kernelName + ". The gradient of input " + ("'" + h + "' has shape '" + p.shape + "', which does not match ") + ("the shape of the input '" + d.shape + "'"));
        if (e[d.id] == null) e[d.id] = p;
        else {
          var v = e[d.id];
          e[d.id] = n(v, p), v.dispose();
        }
      };
      for (var f in i.inputs) c(f);
    }, o = t.length - 1; o >= 0; o--) a(o);
  }
  var TB = 20, Zb = 3, p5 = 7;
  function exe(e, t, r, n) {
    var a = X5(t), o = txe(e, t, r, a), s = t.length, i = K3(e, t, r, a, o), l = ["Tensor"];
    return n && (l.push("  dtype: " + r), l.push("  rank: " + s), l.push("  shape: [" + t + "]"), l.push("  values:")), l.push(i.map(function(u3) {
      return "    " + u3;
    }).join(`
`)), l.join(`
`);
  }
  function txe(e, t, r, n) {
    var a = Wd(t), o = n[n.length - 1], s = new Array(o).fill(0), i = t.length, l = r === "complex64" ? r2(e) : e;
    if (i > 1) for (var u3 = 0; u3 < a / o; u3++) for (var c = u3 * o, f = 0; f < o; f++) s[f] = Math.max(s[f], t2(l[c + f], 0, r).length);
    return s;
  }
  function t2(e, t, r) {
    var n;
    return Array.isArray(e) ? n = parseFloat(e[0].toFixed(p5)) + " + " + (parseFloat(e[1].toFixed(p5)) + "j") : H5(e) ? n = "'" + e + "'" : r === "bool" ? n = rV(e) : n = parseFloat(e.toFixed(p5)).toString(), X3(n, t);
  }
  function rV(e) {
    return e === 0 ? "false" : "true";
  }
  function K3(e, t, r, n, a, o) {
    o === void 0 && (o = true);
    var s = r === "complex64" ? 2 : 1, i = t[0], l = t.length;
    if (l === 0) {
      if (r === "complex64") {
        var u3 = r2(e);
        return [t2(u3[0], 0, r)];
      }
      return r === "bool" ? [rV(e[0])] : [e[0].toString()];
    }
    if (l === 1) {
      if (i > TB) {
        var c = Zb * s, f = Array.from(e.slice(0, c)), h = Array.from(e.slice((i - Zb) * s, i * s));
        return r === "complex64" && (f = r2(f), h = r2(h)), ["[" + f.map(function(k, T2) {
          return t2(k, a[T2], r);
        }).join(", ") + ", ..., " + h.map(function(k, T2) {
          return t2(k, a[i - Zb + T2], r);
        }).join(", ") + "]"];
      }
      var p = r === "complex64" ? r2(e) : Array.from(e);
      return ["[" + p.map(function(k, T2) {
        return t2(k, a[T2], r);
      }).join(", ") + "]"];
    }
    var d = t.slice(1), v = n.slice(1), m = n[0] * s, g = [];
    if (i > TB) {
      for (var x = 0; x < Zb; x++) {
        var b = x * m, y = b + m;
        g.push.apply(g, bo(K3(e.slice(b, y), d, r, v, a, false)));
      }
      g.push("...");
      for (var x = i - Zb; x < i; x++) {
        var b = x * m, y = b + m;
        g.push.apply(g, bo(K3(e.slice(b, y), d, r, v, a, x === i - 1)));
      }
    } else for (var x = 0; x < i; x++) {
      var b = x * m, y = b + m;
      g.push.apply(g, bo(K3(e.slice(b, y), d, r, v, a, x === i - 1)));
    }
    var w = l === 2 ? "," : "";
    g[0] = "[" + g[0] + w;
    for (var x = 1; x < g.length - 1; x++) g[x] = " " + g[x] + w;
    for (var _4 = `,
`, x = 2; x < l; x++) _4 += `
`;
    return g[g.length - 1] = " " + g[g.length - 1] + "]" + (o ? "" : _4), g;
  }
  function r2(e) {
    for (var t = [], r = 0; r < e.length; r += 2) t.push([e[r], e[r + 1]]);
    return t;
  }
  (function() {
    function e(t, r, n) {
      var a = this;
      if (this.dtype = r, this.shape = t.slice(), this.size = Wd(t), n != null) {
        var o = n.length;
        Ca(o === this.size, function() {
          return "Length of values '" + o + "' does not match the size " + ("inferred by the shape '" + a.size + "'.");
        });
      }
      if (r === "complex64") throw new Error("complex64 dtype TensorBuffers are not supported. Please create a TensorBuffer for the real and imaginary parts separately and call tf.complex(real, imag).");
      this.values = n || Cye(r, this.size), this.strides = X5(t);
    }
    return e.prototype.set = function(t) {
      for (var r = this, n = [], a = 1; a < arguments.length; a++) n[a - 1] = arguments[a];
      n.length === 0 && (n = [0]), Ca(n.length === this.rank, function() {
        return "The number of provided coordinates (" + n.length + ") must " + ("match the rank (" + r.rank + ")");
      });
      var o = this.locToIndex(n);
      this.values[o] = t;
    }, e.prototype.get = function() {
      for (var t, r, n = [], a = 0; a < arguments.length; a++) n[a] = arguments[a];
      n.length === 0 && (n = [0]);
      var o = 0;
      try {
        for (var s = Qn(n), i = s.next(); !i.done; i = s.next()) {
          var l = i.value;
          if (l < 0 || l >= this.shape[o]) {
            var u3 = "Requested out of range element at " + n + ". " + ("  Buffer shape=" + this.shape);
            throw new Error(u3);
          }
          o++;
        }
      } catch (h) {
        t = { error: h };
      } finally {
        try {
          i && !i.done && (r = s.return) && r.call(s);
        } finally {
          if (t) throw t.error;
        }
      }
      for (var c = n[n.length - 1], f = 0; f < n.length - 1; ++f) c += this.strides[f] * n[f];
      return this.values[c];
    }, e.prototype.locToIndex = function(t) {
      if (this.rank === 0) return 0;
      if (this.rank === 1) return t[0];
      for (var r = t[t.length - 1], n = 0; n < t.length - 1; ++n) r += this.strides[n] * t[n];
      return r;
    }, e.prototype.indexToLoc = function(t) {
      if (this.rank === 0) return [];
      if (this.rank === 1) return [t];
      for (var r = new Array(this.shape.length), n = 0; n < r.length - 1; ++n) r[n] = Math.floor(t / this.strides[n]), t -= r[n] * this.strides[n];
      return r[r.length - 1] = t, r;
    }, Object.defineProperty(e.prototype, "rank", { get: function() {
      return this.shape.length;
    }, enumerable: true, configurable: true }), e.prototype.toTensor = function() {
      return ed().makeTensor(this.values, this.shape, this.dtype);
    }, e;
  })();
  var ed = null, Jb = null;
  function rxe(e) {
    ed = e;
  }
  var sp = function() {
    function e(t, r, n, a) {
      this.kept = false, this.isDisposedInternal = false, this.shape = t.slice(), this.dtype = r || "float32", this.size = Wd(t), this.strides = X5(t), this.dataId = n, this.id = a, this.rankType = this.rank < 5 ? this.rank.toString() : "higher";
    }
    return Object.defineProperty(e.prototype, "rank", { get: function() {
      return this.shape.length;
    }, enumerable: true, configurable: true }), e.prototype.buffer = function() {
      return Ni(this, void 0, void 0, function() {
        var t;
        return Ei(this, function(r) {
          switch (r.label) {
            case 0:
              return [4, this.data()];
            case 1:
              return t = r.sent(), [2, Jb.buffer(this.shape, this.dtype, t)];
          }
        });
      });
    }, e.prototype.bufferSync = function() {
      return Jb.buffer(this.shape, this.dtype, this.dataSync());
    }, e.prototype.array = function() {
      return Ni(this, void 0, void 0, function() {
        var t;
        return Ei(this, function(r) {
          switch (r.label) {
            case 0:
              return [4, this.data()];
            case 1:
              return t = r.sent(), [2, pB(this.shape, t, this.dtype === "complex64")];
          }
        });
      });
    }, e.prototype.arraySync = function() {
      return pB(this.shape, this.dataSync(), this.dtype === "complex64");
    }, e.prototype.data = function() {
      return Ni(this, void 0, void 0, function() {
        var t, r;
        return Ei(this, function(n) {
          switch (n.label) {
            case 0:
              return this.throwIfDisposed(), t = ed().read(this.dataId), this.dtype !== "string" ? [3, 2] : [4, t];
            case 1:
              r = n.sent();
              try {
                return [2, r.map(function(a) {
                  return kB(a);
                })];
              } catch {
                throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().");
              }
              n.label = 2;
            case 2:
              return [2, t];
          }
        });
      });
    }, e.prototype.dataToGPU = function(t) {
      return this.throwIfDisposed(), ed().readToGPU(this.dataId, t);
    }, e.prototype.dataSync = function() {
      this.throwIfDisposed();
      var t = ed().readSync(this.dataId);
      if (this.dtype === "string") try {
        return t.map(function(r) {
          return kB(r);
        });
      } catch {
        throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().");
      }
      return t;
    }, e.prototype.bytes = function() {
      return Ni(this, void 0, void 0, function() {
        var t;
        return Ei(this, function(r) {
          switch (r.label) {
            case 0:
              return this.throwIfDisposed(), [4, ed().read(this.dataId)];
            case 1:
              return t = r.sent(), this.dtype === "string" ? [2, t] : [2, new Uint8Array(t.buffer)];
          }
        });
      });
    }, e.prototype.dispose = function() {
      this.isDisposed || (ed().disposeTensor(this), this.isDisposedInternal = true);
    }, Object.defineProperty(e.prototype, "isDisposed", { get: function() {
      return this.isDisposedInternal;
    }, enumerable: true, configurable: true }), e.prototype.throwIfDisposed = function() {
      if (this.isDisposed) throw new Error("Tensor is disposed.");
    }, e.prototype.print = function(t) {
      return t === void 0 && (t = false), Jb.print(this, t);
    }, e.prototype.clone = function() {
      return this.throwIfDisposed(), Jb.clone(this);
    }, e.prototype.toString = function(t) {
      t === void 0 && (t = false);
      var r = this.dataSync();
      return exe(r, this.shape, this.dtype, t);
    }, e.prototype.cast = function(t) {
      return this.throwIfDisposed(), Jb.cast(this, t);
    }, e.prototype.variable = function(t, r, n) {
      return t === void 0 && (t = true), this.throwIfDisposed(), ed().makeVariable(this, t, r, n);
    }, e;
  }();
  Object.defineProperty(sp, Symbol.hasInstance, { value: function(e) {
    return !!e && e.data != null && e.dataSync != null && e.throwIfDisposed != null;
  } });
  function nxe() {
    return Y5("Tensor", function() {
      return sp;
    });
  }
  nxe();
  var S5 = function(e) {
    Hn(t, e);
    function t(r, n, a, o) {
      var s = e.call(this, r.shape, r.dtype, r.dataId, o) || this;
      return s.trainable = n, s.name = a, s;
    }
    return t.prototype.assign = function(r) {
      if (r.dtype !== this.dtype) throw new Error("dtype of the new value (" + r.dtype + ") and " + ("previous value (" + this.dtype + ") must match"));
      if (!$5(r.shape, this.shape)) throw new Error("shape of the new value (" + r.shape + ") and " + ("previous value (" + this.shape + ") must match"));
      ed().disposeTensor(this), this.dataId = r.dataId, ed().incRef(this, null);
    }, t.prototype.dispose = function() {
      ed().disposeVariable(this), this.isDisposedInternal = true;
    }, t;
  }(sp);
  Object.defineProperty(S5, Symbol.hasInstance, { value: function(e) {
    return e instanceof sp && e.assign != null && e.assign instanceof Function;
  } });
  var AB;
  (function(e) {
    e.R0 = "R0", e.R1 = "R1", e.R2 = "R2", e.R3 = "R3", e.R4 = "R4", e.R5 = "R5", e.R6 = "R6";
  })(AB || (AB = {}));
  var E5;
  (function(e) {
    e.float32 = "float32", e.int32 = "int32", e.bool = "int32", e.complex64 = "complex64";
  })(E5 || (E5 = {}));
  var D5;
  (function(e) {
    e.float32 = "float32", e.int32 = "int32", e.bool = "bool", e.complex64 = "complex64";
  })(D5 || (D5 = {}));
  var C5;
  (function(e) {
    e.float32 = "float32", e.int32 = "float32", e.bool = "float32", e.complex64 = "complex64";
  })(C5 || (C5 = {}));
  var M5;
  (function(e) {
    e.float32 = "complex64", e.int32 = "complex64", e.bool = "complex64", e.complex64 = "complex64";
  })(M5 || (M5 = {}));
  var axe = { float32: C5, int32: E5, bool: D5, complex64: M5 };
  function ixe(e, t) {
    if (e === "string" || t === "string") {
      if (e === "string" && t === "string") return "string";
      throw new Error("Can not upcast " + e + " with " + t);
    }
    return axe[e][t];
  }
  function Ih(e, t) {
    if (e.dtype === t.dtype) return [e, t];
    var r = ixe(e.dtype, t.dtype);
    return [e.cast(r), t.cast(r)];
  }
  function oxe(e) {
    var t = [], r = /* @__PURE__ */ new Set();
    return nV(e, t, r), t;
  }
  function nV(e, t, r) {
    if (e != null) {
      if (e instanceof sp) {
        t.push(e);
        return;
      }
      if (!!sxe(e)) {
        var n = e;
        for (var a in n) {
          var o = n[a];
          r.has(o) || (r.add(o), nV(o, t, r));
        }
      }
    }
  }
  function sxe(e) {
    return Array.isArray(e) || typeof e == "object";
  }
  function d5(e) {
    return e.kernelName != null;
  }
  var SB = function() {
    function e() {
      this.registeredVariables = {}, this.nextTapeNodeId = 0, this.numBytes = 0, this.numTensors = 0, this.numStringTensors = 0, this.numDataBuffers = 0, this.gradientDepth = 0, this.kernelDepth = 0, this.scopeStack = [], this.numDataMovesStack = [], this.nextScopeId = 0, this.tensorInfo = /* @__PURE__ */ new WeakMap(), this.profiling = false, this.activeProfile = { newBytes: 0, newTensors: 0, peakBytes: 0, kernels: [], result: null, get kernelNames() {
        return Array.from(new Set(this.kernels.map(function(t) {
          return t.name;
        })));
      } };
    }
    return e.prototype.dispose = function() {
      for (var t in this.registeredVariables) this.registeredVariables[t].dispose();
    }, e;
  }(), Q5 = function() {
    function e(t) {
      this.ENV = t, this.registry = {}, this.registryFactory = {}, this.pendingBackendInitId = 0, this.state = new SB();
    }
    return e.prototype.ready = function() {
      return Ni(this, void 0, void 0, function() {
        var t, r, n, a;
        return Ei(this, function(o) {
          switch (o.label) {
            case 0:
              if (this.pendingBackendInit != null) return [2, this.pendingBackendInit.then(function() {
              })];
              if (this.backendInstance != null) return [2];
              t = this.getSortedBackends(), r = 0, o.label = 1;
            case 1:
              return r < t.length ? (n = t[r], [4, this.initializeBackend(n).success]) : [3, 5];
            case 2:
              return a = o.sent(), a ? [4, this.setBackend(n)] : [3, 4];
            case 3:
              return o.sent(), [2];
            case 4:
              return r++, [3, 1];
            case 5:
              throw new Error("Could not initialize any backends, all backend initializations failed.");
          }
        });
      });
    }, Object.defineProperty(e.prototype, "backend", { get: function() {
      if (this.pendingBackendInit != null) throw new Error("Backend '" + this.backendName + "' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods");
      if (this.backendInstance == null) {
        var t = this.initializeBackendsAndReturnBest(), r = t.name, n = t.asyncInit;
        if (n) throw new Error("The highest priority backend '" + r + "' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods");
        this.setBackend(r);
      }
      return this.backendInstance;
    }, enumerable: true, configurable: true }), e.prototype.backendNames = function() {
      return Object.keys(this.registryFactory);
    }, e.prototype.findBackend = function(t) {
      if (!(t in this.registry)) if (t in this.registryFactory) {
        var r = this.initializeBackend(t).asyncInit;
        if (r) return null;
      } else return null;
      return this.registry[t];
    }, e.prototype.findBackendFactory = function(t) {
      return t in this.registryFactory ? this.registryFactory[t].factory : null;
    }, e.prototype.registerBackend = function(t, r, n) {
      return n === void 0 && (n = 1), t in this.registryFactory ? (cy(t + " backend was already registered. Reusing existing backend factory."), false) : (this.registryFactory[t] = { factory: r, priority: n }, true);
    }, e.prototype.setBackend = function(t) {
      return Ni(this, void 0, void 0, function() {
        var r, n, a, o, s;
        return Ei(this, function(i) {
          switch (i.label) {
            case 0:
              if (this.registryFactory[t] == null) throw new Error("Backend name '" + t + "' not found in registry");
              return this.backendName = t, this.registry[t] != null ? [3, 4] : (this.backendInstance = null, r = this.initializeBackend(t), n = r.success, a = r.asyncInit, a ? [4, n] : [3, 2]);
            case 1:
              return s = i.sent(), [3, 3];
            case 2:
              s = n, i.label = 3;
            case 3:
              if (o = s, !o) return [2, false];
              i.label = 4;
            case 4:
              return this.backendInstance = this.registry[t], this.setupRegisteredKernels(), this.profiler = new Kye(this.backendInstance), [2, true];
          }
        });
      });
    }, e.prototype.setupRegisteredKernels = function() {
      var t = this, r = gB(this.backendName);
      r.forEach(function(n) {
        n.setupFunc != null && n.setupFunc(t.backendInstance);
      });
    }, e.prototype.disposeRegisteredKernels = function(t) {
      var r = this, n = gB(t);
      n.forEach(function(a) {
        a.disposeFunc != null && a.disposeFunc(r.registry[t]);
      });
    }, e.prototype.initializeBackend = function(t) {
      var r = this, n = this.registryFactory[t];
      if (n == null) throw new Error("Cannot initialize backend " + t + ", no registration found.");
      try {
        var a = n.factory();
        if (a && !(a instanceof Eye) && typeof a.then == "function") {
          var o = ++this.pendingBackendInitId, s = a.then(function(i) {
            return o < r.pendingBackendInitId ? false : (r.registry[t] = i, r.pendingBackendInit = null, true);
          }).catch(function(i) {
            return o < r.pendingBackendInitId || (r.pendingBackendInit = null, cy("Initialization of backend " + t + " failed"), cy(i.stack || i.message)), false;
          });
          return this.pendingBackendInit = s, { success: s, asyncInit: true };
        } else return this.registry[t] = a, { success: true, asyncInit: false };
      } catch (i) {
        return cy("Initialization of backend " + t + " failed"), cy(i.stack || i.message), { success: false, asyncInit: false };
      }
    }, e.prototype.removeBackend = function(t) {
      if (!(t in this.registryFactory)) throw new Error(t + " backend not found in registry");
      this.backendName === t && this.pendingBackendInit != null && this.pendingBackendInitId++, t in this.registry && (this.disposeRegisteredKernels(t), this.registry[t].dispose(), delete this.registry[t]), delete this.registryFactory[t], this.backendName === t && (this.pendingBackendInit = null, this.backendName = null, this.backendInstance = null);
    }, e.prototype.getSortedBackends = function() {
      var t = this;
      if (Object.keys(this.registryFactory).length === 0) throw new Error("No backend found in registry.");
      return Object.keys(this.registryFactory).sort(function(r, n) {
        return t.registryFactory[n].priority - t.registryFactory[r].priority;
      });
    }, e.prototype.initializeBackendsAndReturnBest = function() {
      for (var t = this.getSortedBackends(), r = 0; r < t.length; r++) {
        var n = t[r], a = this.initializeBackend(n), o = a.success, s = a.asyncInit;
        if (s || o) return { name: n, asyncInit: s };
      }
      throw new Error("Could not initialize any backends, all backend initializations failed.");
    }, e.prototype.moveData = function(t, r) {
      var n = this.state.tensorInfo.get(r), a = n.backend, o = this.readSync(r), s = a.refCount(r);
      a.disposeData(r, true), n.backend = t, t.move(r, o, n.shape, n.dtype, s), this.shouldCheckForMemLeaks() && this.state.numDataMovesStack[this.state.numDataMovesStack.length - 1]++;
    }, e.prototype.tidy = function(t, r) {
      var n = this, a = null;
      if (r == null) {
        if (typeof t != "function") throw new Error("Please provide a function to tidy()");
        r = t;
      } else {
        if (typeof t != "string" && !(t instanceof String)) throw new Error("When calling with two arguments, the first argument to tidy() must be a string");
        if (typeof r != "function") throw new Error("When calling with two arguments, the 2nd argument to tidy() must be a function");
        a = t;
      }
      var o;
      return this.scopedRun(function() {
        return n.startScope(a);
      }, function() {
        return n.endScope(o);
      }, function() {
        return o = r(), o instanceof Promise && console.error("Cannot return a Promise inside of tidy."), o;
      });
    }, e.prototype.scopedRun = function(t, r, n) {
      t();
      try {
        var a = n();
        return r(), a;
      } catch (o) {
        throw r(), o;
      }
    }, e.prototype.nextTensorId = function() {
      return e.nextTensorId++;
    }, e.prototype.nextVariableId = function() {
      return e.nextVariableId++;
    }, e.prototype.clone = function(t) {
      var r = Ga.runKernel(W5, { x: t }), n = { x: t }, a = function(s) {
        return { x: function() {
          var i = "float32", l = { x: s }, u3 = { dtype: i };
          return Ga.runKernel(j5, l, u3);
        } };
      }, o = [];
      return this.addTapeNode(this.state.activeScope.name, n, [r], a, o, {}), r;
    }, e.prototype.runKernel = function(t, r, n) {
      this.backendName == null && this.backend;
      var a = vB(t, this.backendName) != null;
      if (!a) throw new Error("Kernel '" + t + "' not registered for backend '" + this.backendName + "'");
      return this.runKernelFunc({ kernelName: t, inputs: r, attrs: n });
    }, e.prototype.shouldCheckForMemLeaks = function() {
      return this.ENV.getBool("IS_TEST");
    }, e.prototype.checkKernelForMemLeak = function(t, r, n) {
      var a = this.backend.numDataIds(), o = 0;
      n.forEach(function(l) {
        o += l.dtype === "complex64" ? 3 : 1;
      });
      var s = this.state.numDataMovesStack[this.state.numDataMovesStack.length - 1], i = a - r - o - s;
      if (i > 0) throw new Error("Backend '" + this.backendName + "' has an internal memory leak " + ("(" + i + " data ids) after running '" + t + "'"));
    }, e.prototype.runKernelFunc = function(t) {
      var r = this, n, a = [], o = this.isTapeOn(), s = this.state.numBytes, i = this.state.numTensors;
      this.shouldCheckForMemLeaks() && this.state.numDataMovesStack.push(0);
      var l;
      this.backendName == null && this.backend;
      var u3, c = d5(t) ? t.kernelName : this.state.activeScope != null ? this.state.activeScope.name : "";
      if (d5(t)) {
        var f = t.kernelName, h = t.inputs, p = t.attrs;
        this.backendName == null && this.backend;
        var d = vB(f, this.backendName);
        Ca(d != null, function() {
          return "Cannot find registered kernel '" + f + "' for backend '" + r.backendName + "'";
        }), l = function() {
          var w = r.backend.numDataIds();
          u3 = d.kernelFunc({ inputs: h, attrs: p, backend: r.backend });
          var _4 = Array.isArray(u3) ? u3 : [u3];
          r.shouldCheckForMemLeaks() && r.checkKernelForMemLeak(f, w, _4);
          var k = _4.map(function(A2) {
            if (A2.rank != null) return A2;
            var S2 = A2.dataId, C2 = A2.shape, E2 = A2.dtype;
            return r.makeTensorFromDataId(S2, C2, E2);
          });
          if (o) {
            var T2 = r.getTensorsForGradient(f, h, k);
            a = r.saveTensorsForBackwardMode(T2);
          }
          return k;
        };
      } else {
        var v = t.forwardFunc, m = function(w) {
          !o || (a = w.map(function(_4) {
            return r.keep(r.clone(_4));
          }));
        };
        l = function() {
          var w = r.backend.numDataIds();
          u3 = r.tidy(function() {
            return v(r.backend, m);
          });
          var _4 = Array.isArray(u3) ? u3 : [u3];
          return r.shouldCheckForMemLeaks() && r.checkKernelForMemLeak(c, w, _4), _4;
        };
      }
      var g = t.inputs, x = t.attrs, b = d5(t) ? null : t.backwardsFunc, y;
      return this.scopedRun(function() {
        return r.state.kernelDepth++;
      }, function() {
        return r.state.kernelDepth--;
      }, function() {
        !r.ENV.getBool("DEBUG") && !r.state.profiling ? n = l() : (y = r.profiler.profileKernel(c, g, function() {
          return l();
        }), r.ENV.getBool("DEBUG") && r.profiler.logKernelProfile(y), n = y.outputs);
      }), o && this.addTapeNode(c, g, n, b, a, x), this.state.profiling && this.state.activeProfile.kernels.push({ name: c, bytesAdded: this.state.numBytes - s, totalBytesSnapshot: this.state.numBytes, tensorsAdded: this.state.numTensors - i, totalTensorsSnapshot: this.state.numTensors, inputShapes: Object.keys(g).map(function(w) {
        return g[w] != null ? g[w].shape : null;
      }), outputShapes: n.map(function(w) {
        return w.shape;
      }), kernelTimeMs: y.timeMs, extraInfo: y.extraInfo }), Array.isArray(u3) ? n : n[0];
    }, e.prototype.saveTensorsForBackwardMode = function(t) {
      var r = this, n = t.map(function(a) {
        return r.keep(r.clone(a));
      });
      return n;
    }, e.prototype.getTensorsForGradient = function(t, r, n) {
      var a = mB(t);
      if (a != null) {
        var o = a.inputsToSave || [], s = a.outputsToSave || [], i = void 0;
        a.saveAllInputs ? (Ca(Array.isArray(r), function() {
          return "saveAllInputs is true, expected inputs to be an array.";
        }), i = Object.keys(r).map(function(u3) {
          return r[u3];
        })) : i = o.map(function(u3) {
          return r[u3];
        });
        var l = n.filter(function(u3, c) {
          return s[c];
        });
        return i.concat(l);
      }
      return [];
    }, e.prototype.makeTensor = function(t, r, n, a) {
      if (t == null) throw new Error("Values passed to engine.makeTensor() are null");
      n = n || "float32", a = a || this.backend;
      var o = t;
      n === "string" && H5(t[0]) && (o = t.map(function(c) {
        return Xye(c);
      }));
      var s = a.write(o, r, n), i = new sp(r, n, s, this.nextTensorId());
      if (this.trackTensor(i, a), n === "string") {
        var l = this.state.tensorInfo.get(s), u3 = Nye(o);
        this.state.numBytes += u3 - l.bytes, l.bytes = u3;
      }
      return i;
    }, e.prototype.makeTensorFromDataId = function(t, r, n, a) {
      n = n || "float32";
      var o = new sp(r, n, t, this.nextTensorId());
      return this.trackTensor(o, a), o;
    }, e.prototype.makeVariable = function(t, r, n, a) {
      r === void 0 && (r = true), n = n || this.nextVariableId().toString(), a != null && a !== t.dtype && (t = t.cast(a));
      var o = new S5(t, r, n, this.nextTensorId());
      if (this.state.registeredVariables[o.name] != null) throw new Error("Variable with name " + o.name + " was already registered");
      return this.state.registeredVariables[o.name] = o, this.incRef(o, this.backend), o;
    }, e.prototype.trackTensor = function(t, r) {
      this.state.numTensors++, t.dtype === "string" && this.state.numStringTensors++;
      var n = 0;
      t.dtype !== "complex64" && t.dtype !== "string" && (n = t.size * fB(t.dtype)), this.state.numBytes += n, this.state.tensorInfo.has(t.dataId) || (this.state.numDataBuffers++, this.state.tensorInfo.set(t.dataId, { backend: r || this.backend, dtype: t.dtype, shape: t.shape, bytes: n })), t instanceof S5 || this.track(t);
    }, e.prototype.incRef = function(t, r) {
      this.trackTensor(t, r), this.backend.incRef(t.dataId);
    }, e.prototype.removeDataId = function(t, r) {
      this.state.tensorInfo.has(t) && this.state.tensorInfo.get(t).backend === r && (this.state.tensorInfo.delete(t), this.state.numDataBuffers--);
    }, e.prototype.disposeTensor = function(t) {
      if (!!this.state.tensorInfo.has(t.dataId)) {
        var r = this.state.tensorInfo.get(t.dataId);
        if (this.state.numTensors--, t.dtype === "string" && (this.state.numStringTensors--, this.state.numBytes -= r.bytes), t.dtype !== "complex64" && t.dtype !== "string") {
          var n = t.size * fB(t.dtype);
          this.state.numBytes -= n;
        }
        r.backend.disposeData(t.dataId) && this.removeDataId(t.dataId, r.backend);
      }
    }, e.prototype.disposeVariables = function() {
      for (var t in this.state.registeredVariables) {
        var r = this.state.registeredVariables[t];
        this.disposeVariable(r);
      }
    }, e.prototype.disposeVariable = function(t) {
      this.disposeTensor(t), this.state.registeredVariables[t.name] != null && delete this.state.registeredVariables[t.name];
    }, e.prototype.memory = function() {
      var t = this.backend.memory();
      return t.numTensors = this.state.numTensors, t.numDataBuffers = this.state.numDataBuffers, t.numBytes = this.state.numBytes, this.state.numStringTensors > 0 && (t.unreliable = true, t.reasons == null && (t.reasons = []), t.reasons.push("Memory usage by string tensors is approximate (2 bytes per character)")), t;
    }, e.prototype.profile = function(t) {
      return Ni(this, void 0, void 0, function() {
        var r, n, a, o, s, i, l, u3, c, f, h;
        return Ei(this, function(p) {
          switch (p.label) {
            case 0:
              return this.state.profiling = true, r = this.state.numBytes, n = this.state.numTensors, this.state.activeProfile.kernels = [], a = this.state.activeProfile, [4, t()];
            case 1:
              a.result = p.sent(), this.state.profiling = false, this.state.activeProfile.peakBytes = Math.max.apply(Math, bo(this.state.activeProfile.kernels.map(function(d) {
                return d.totalBytesSnapshot;
              }))), this.state.activeProfile.newBytes = this.state.numBytes - r, this.state.activeProfile.newTensors = this.state.numTensors - n, p.label = 2;
            case 2:
              p.trys.push([2, 8, 9, 10]), o = Qn(this.state.activeProfile.kernels), s = o.next(), p.label = 3;
            case 3:
              return s.done ? [3, 7] : (i = s.value, l = i, [4, i.kernelTimeMs]);
            case 4:
              return l.kernelTimeMs = p.sent(), u3 = i, [4, i.extraInfo];
            case 5:
              u3.extraInfo = p.sent(), p.label = 6;
            case 6:
              return s = o.next(), [3, 3];
            case 7:
              return [3, 10];
            case 8:
              return c = p.sent(), f = { error: c }, [3, 10];
            case 9:
              try {
                s && !s.done && (h = o.return) && h.call(o);
              } finally {
                if (f) throw f.error;
              }
              return [7];
            case 10:
              return [2, this.state.activeProfile];
          }
        });
      });
    }, e.prototype.isTapeOn = function() {
      return this.state.gradientDepth > 0 && this.state.kernelDepth === 0;
    }, e.prototype.addTapeNode = function(t, r, n, a, o, s) {
      var i = this, l = { id: this.state.nextTapeNodeId++, kernelName: t, inputs: r, outputs: n, saved: o }, u3 = mB(t);
      u3 != null && (a = u3.gradFunc), a != null && (l.gradient = function(c) {
        return c = c.map(function(f, h) {
          if (f == null) {
            var p = n[h], d = K5(p.size, p.dtype);
            return i.makeTensor(d, p.shape, p.dtype);
          }
          return f;
        }), a(c.length > 1 ? c : c[0], o, s);
      }), this.state.activeTape.push(l);
    }, e.prototype.keep = function(t) {
      return t.kept = true, t;
    }, e.prototype.startTape = function() {
      this.state.gradientDepth === 0 && (this.state.activeTape = []), this.state.gradientDepth++;
    }, e.prototype.endTape = function() {
      this.state.gradientDepth--;
    }, e.prototype.startScope = function(t) {
      var r = { track: [], name: "unnamed scope", id: this.state.nextScopeId++ };
      t && (r.name = t), this.state.scopeStack.push(r), this.state.activeScope = r;
    }, e.prototype.endScope = function(t) {
      for (var r = this, n = oxe(t), a = new Set(n.map(function(l) {
        return l.id;
      })), o = 0; o < this.state.activeScope.track.length; o++) {
        var s = this.state.activeScope.track[o];
        !s.kept && !a.has(s.id) && s.dispose();
      }
      var i = this.state.scopeStack.pop();
      this.state.activeScope = this.state.scopeStack.length === 0 ? null : this.state.scopeStack[this.state.scopeStack.length - 1], n.forEach(function(l) {
        !l.kept && l.scopeId === i.id && r.track(l);
      });
    }, e.prototype.gradients = function(t, r, n, a) {
      var o = this;
      if (a === void 0 && (a = false), Ca(r.length > 0, function() {
        return "gradients() received an empty list of xs.";
      }), n != null && n.dtype !== "float32") throw new Error("dy must have 'float32' dtype, but has '" + n.dtype + "'");
      var s = this.scopedRun(function() {
        return o.startTape();
      }, function() {
        return o.endTape();
      }, function() {
        return o.tidy("forward", t);
      });
      Ca(s instanceof sp, function() {
        return "The result y returned by f() must be a tensor.";
      });
      var i = Jye(this.state.activeTape, r, s);
      if (!a && i.length === 0 && r.length > 0) throw new Error("Cannot compute gradient of y=f(x) with respect to x. Make sure that the f you passed encloses all operations that lead from x to y.");
      return this.tidy("backward", function() {
        var l = {};
        l[s.id] = n ?? lxe(s.shape), Qye(l, i, function(c) {
          return o.tidy(c);
        }, cxe);
        var u3 = r.map(function(c) {
          return l[c.id];
        });
        return o.state.gradientDepth === 0 && (o.state.activeTape.forEach(function(c) {
          var f, h;
          try {
            for (var p = Qn(c.saved), d = p.next(); !d.done; d = p.next()) {
              var v = d.value;
              v.dispose();
            }
          } catch (m) {
            f = { error: m };
          } finally {
            try {
              d && !d.done && (h = p.return) && h.call(p);
            } finally {
              if (f) throw f.error;
            }
          }
        }), o.state.activeTape = null), { value: s, grads: u3 };
      });
    }, e.prototype.customGrad = function(t) {
      var r = this;
      return Ca(hB(t), function() {
        return "The f passed in customGrad(f) must be a function.";
      }), function() {
        for (var n = [], a = 0; a < arguments.length; a++) n[a] = arguments[a];
        Ca(n.every(function(u3) {
          return u3 instanceof sp;
        }), function() {
          return "The args passed in customGrad(f)(x1, x2,...) must all be tensors";
        });
        var o, s = {};
        n.forEach(function(u3, c) {
          s[c] = u3;
        });
        var i = function(u3, c) {
          return o = t.apply(void 0, bo(n, [c])), Ca(o.value instanceof sp, function() {
            return "The function f passed in customGrad(f) must return an object where `obj.value` is a tensor";
          }), Ca(hB(o.gradFunc), function() {
            return "The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function.";
          }), o.value;
        }, l = function(u3, c) {
          var f = o.gradFunc(u3, c), h = Array.isArray(f) ? f : [f];
          Ca(h.length === n.length, function() {
            return "The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns the same number of tensors as inputs passed to f(...).";
          }), Ca(h.every(function(d) {
            return d instanceof sp;
          }), function() {
            return "The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns a list of only tensors.";
          });
          var p = {};
          return h.forEach(function(d, v) {
            p[v] = function() {
              return d;
            };
          }), p;
        };
        return r.runKernelFunc({ forwardFunc: i, backwardsFunc: l, inputs: s });
      };
    }, e.prototype.readSync = function(t) {
      var r = this.state.tensorInfo.get(t);
      return r.backend.readSync(t);
    }, e.prototype.read = function(t) {
      var r = this.state.tensorInfo.get(t);
      return r.backend.read(t);
    }, e.prototype.readToGPU = function(t, r) {
      var n = this.state.tensorInfo.get(t);
      return n.backend.readToGPU(t, r);
    }, e.prototype.time = function(t) {
      return Ni(this, void 0, void 0, function() {
        var r, n;
        return Ei(this, function(a) {
          switch (a.label) {
            case 0:
              return r = J3(), [4, this.backend.time(t)];
            case 1:
              return n = a.sent(), n.wallMs = J3() - r, [2, n];
          }
        });
      });
    }, e.prototype.track = function(t) {
      return this.state.activeScope != null && (t.scopeId = this.state.activeScope.id, this.state.activeScope.track.push(t)), t;
    }, Object.defineProperty(e.prototype, "registeredVariables", { get: function() {
      return this.state.registeredVariables;
    }, enumerable: true, configurable: true }), e.prototype.reset = function() {
      this.pendingBackendInitId++, this.state.dispose(), this.ENV.reset(), this.state = new SB();
      for (var t in this.registry) this.disposeRegisteredKernels(t), this.registry[t].dispose(), delete this.registry[t];
      this.backendName = null, this.backendInstance = null, this.pendingBackendInit = null;
    }, e;
  }();
  Q5.nextTensorId = 0;
  Q5.nextVariableId = 0;
  function lxe(e) {
    var t = HU(Wd(e), "float32");
    return Ga.makeTensor(t, e, "float32");
  }
  function uxe() {
    var e = KU();
    if (e._tfengine == null) {
      var t = new Lye(e);
      e._tfengine = new Q5(t);
    }
    return Uye(e._tfengine.ENV), rxe(function() {
      return e._tfengine;
    }), e._tfengine;
  }
  var Ga = uxe();
  function cxe(e, t) {
    var r = { a: e, b: t };
    return Ga.runKernel(V5, r);
  }
  function fxe(e, t) {
    var r = e;
    if ($d(e)) return t === "string" ? [] : [e.length];
    if (!Array.isArray(e)) return [];
    for (var n = []; Array.isArray(r) || $d(r) && t !== "string"; ) n.push(r.length), r = r[0];
    return Array.isArray(e) && Mh().getBool("TENSORLIKE_CHECK_SHAPE_CONSISTENCY") && aV(e, n, []), n;
  }
  function aV(e, t, r) {
    if (r = r || [], !Array.isArray(e) && !$d(e)) {
      Ca(t.length === 0, function() {
        return "Element arr[" + r.join("][") + "] is a primitive, " + ("but should be an array/TypedArray of " + t[0] + " elements");
      });
      return;
    }
    Ca(t.length > 0, function() {
      return "Element arr[" + r.join("][") + "] should be a primitive, " + ("but is an array of " + e.length + " elements");
    }), Ca(e.length === t[0], function() {
      return "Element arr[" + r.join("][") + "] should have " + t[0] + " " + ("elements, but has " + e.length + " elements");
    });
    for (var n = t.slice(1), a = 0; a < e.length; ++a) aV(e[a], n, r.concat(a));
  }
  function EB(e, t, r, n) {
    if (e !== "string_or_numeric") {
      if (e == null) throw new Error("Expected dtype cannot be null.");
      if (e !== "numeric" && e !== t || e === "numeric" && t === "string") throw new Error("Argument '" + r + "' passed to '" + n + "' must " + ("be " + e + " tensor, but got " + t + " tensor"));
    }
  }
  function La(e, t, r, n) {
    if (n === void 0 && (n = "numeric"), e instanceof sp) return EB(n, e.dtype, t, r), e;
    var a = q5(e);
    if (a !== "string" && ["bool", "int32", "float32"].indexOf(n) >= 0 && (a = n), EB(n, a, t, r), e == null || !$d(e) && !Array.isArray(e) && typeof e != "number" && typeof e != "boolean" && typeof e != "string") {
      var o = e == null ? "null" : e.constructor.name;
      throw new Error("Argument '" + t + "' passed to '" + r + "' must be a " + ("Tensor or TensorLike, but got '" + o + "'"));
    }
    var s = fxe(e, a);
    !$d(e) && !Array.isArray(e) && (e = [e]);
    var i = true, l = a !== "string" ? tV(e, a) : lk(e, [], i);
    return Ga.makeTensor(l, s, a);
  }
  function iV(e, t, r, n) {
    if (n === void 0 && (n = "numeric"), !Array.isArray(e)) throw new Error("Argument " + t + " passed to " + r + " must be a `Tensor[]` or `TensorLike[]`");
    var a = e;
    return a.map(function(o, s) {
      return La(o, t + "[" + s + "]", r, n);
    });
  }
  var hxe = "__op";
  function vi(e) {
    var t = Object.keys(e);
    if (t.length !== 1) throw new Error("Please provide an object with a single key (operation name) mapping to a function. Got an object with " + (t.length + " keys."));
    var r = t[0], n = e[r];
    r.endsWith("_") && (r = r.substring(0, r.length - 1)), r = r + hxe;
    var a = function() {
      for (var o = [], s = 0; s < arguments.length; s++) o[s] = arguments[s];
      Ga.startScope(r);
      try {
        var i = n.apply(void 0, bo(o));
        return qU(i) && console.error("Cannot return a Promise inside of tidy."), Ga.endScope(i), i;
      } catch (l) {
        throw Ga.endScope(null), l;
      }
    };
    return Object.defineProperty(a, "name", { value: r, configurable: true }), a;
  }
  function pxe(e, t) {
    var r = La(e, "x", "cast");
    if (!Iye(t)) throw new Error("Failed to cast to unknown dtype " + t);
    if (t === "string" && r.dtype !== "string" || t !== "string" && r.dtype === "string") throw new Error("Only strings can be casted to strings");
    var n = { x: r }, a = { dtype: t };
    return Ga.runKernel(j5, n, a);
  }
  var Mo = vi({ cast_: pxe });
  function dxe(e, t) {
    var r, n = La(e, "a", "mul"), a = La(t, "b", "mul");
    r = pa(Ih(n, a), 2), n = r[0], a = r[1];
    var o = { a: n, b: a };
    return Ga.runKernel(wU, o);
  }
  var fi = vi({ mul_: dxe });
  function vxe(e, t) {
    t === void 0 && (t = 0);
    var r = La(e, "x", "step"), n = { x: r }, a = { alpha: t };
    return Ga.runKernel(GU, n, a);
  }
  var eD = vi({ step_: vxe }), oV = { kernelName: t1e, inputsToSave: ["x"], gradFunc: function(e, t) {
    var r = pa(t, 1), n = r[0];
    return { x: function() {
      return fi(e, eD(Mo(n, "float32"), -1));
    } };
  } };
  function mxe(e, t) {
    var r, n = La(e, "a", "floorDiv"), a = La(t, "b", "floorDiv");
    r = pa(Ih(n, a), 2), n = r[0], a = r[1];
    var o = { a: n, b: a };
    return Ga.runKernel(gU, o);
  }
  var gxe = vi({ floorDiv_: mxe });
  function yxe(e, t) {
    var r, n = La(e, "a", "div"), a = La(t, "b", "div");
    if (r = pa(Ih(n, a), 2), n = r[0], a = r[1], n.dtype === "int32" && a.dtype === "int32") return gxe(n, a);
    var o = { a: n, b: a }, s = {};
    return Ga.runKernel(pU, o, s);
  }
  var Hu = vi({ div_: yxe });
  function xxe(e) {
    var t = La(e, "x", "neg"), r = { x: t };
    return Ga.runKernel(kU, r);
  }
  var ld = vi({ neg_: xxe });
  function bxe(e, t, r, n) {
    if (n == null && (n = q5(e)), n === "complex64") throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");
    if (!$d(e) && !Array.isArray(e) && typeof e != "number" && typeof e != "boolean" && typeof e != "string") throw new Error("values passed to tensor(values) must be a number/boolean/string or an array of numbers/booleans/strings, or a TypedArray");
    if (t != null) {
      Pye(t);
      var a = Wd(t), o = Wd(r);
      Ca(a === o, function() {
        return "Based on the provided shape, [" + t + "], the tensor should have " + (a + " values but has " + o);
      });
      for (var s = 0; s < r.length; ++s) {
        var i = r[s], l = s === r.length - 1 ? i !== Wd(t.slice(s)) : true;
        Ca(r[s] === t[s] || !l, function() {
          return "Error creating a new Tensor. Inferred shape " + ("(" + r + ") does not match the provided ") + ("shape (" + t + "). ");
        });
      }
    }
    return !$d(e) && !Array.isArray(e) && (e = [e]), t = t || r, e = n !== "string" ? tV(e, n) : lk(e, [], true), Ga.makeTensor(e, t, n);
  }
  function af(e, t) {
    if (($d(e) && t !== "string" || Array.isArray(e)) && t !== "complex64") throw new Error("Error creating a new Scalar: value must be a primitive (number|boolean|string)");
    if (t === "string" && $d(e) && !(e instanceof Uint8Array)) throw new Error("When making a scalar from encoded string, the value must be `Uint8Array`.");
    var r = [], n = [];
    return bxe(e, r, n, t);
  }
  function _xe(e) {
    var t = La(e, "x", "sqrt", "float32"), r = { x: t };
    return Ga.runKernel(PU, r);
  }
  var c2 = vi({ sqrt_: _xe });
  function wxe(e) {
    var t = La(e, "x", "square"), r = {};
    return Ga.runKernel("Square", { x: t }, r);
  }
  var of2 = vi({ square_: wxe });
  function kxe(e, t) {
    var r, n = La(e, "a", "sub"), a = La(t, "b", "sub");
    r = pa(Ih(n, a), 2), n = r[0], a = r[1];
    var o = { a: n, b: a };
    return Ga.runKernel(BU, o);
  }
  var fp = vi({ sub_: kxe }), Txe = { kernelName: r1e, inputsToSave: ["x"], gradFunc: function(e, t) {
    var r = pa(t, 1), n = r[0];
    return { x: function() {
      var a = of2(Mo(n, "float32")), o = c2(fp(af(1), a));
      return ld(Hu(e, o));
    } };
  } }, Axe = { kernelName: n1e, inputsToSave: ["x"], gradFunc: function(e, t) {
    var r = pa(t, 1), n = r[0];
    return { x: function() {
      var a = c2(fp(of2(Mo(n, "float32")), 1));
      return Hu(e, a);
    } };
  } };
  function Ac(e, t) {
    for (var r = [], n = 0; n < t.length; n++) {
      var a = e[e.length - n - 1], o = t.length - n - 1, s = t[o];
      (a == null || a === 1 && s > 1) && r.unshift(o);
    }
    return r;
  }
  function $c(e, t) {
    for (var r = [], n = Math.max(e.length, t.length), a = 0; a < n; a++) {
      var o = e[e.length - a - 1];
      o == null && (o = 1);
      var s = t[t.length - a - 1];
      if (s == null && (s = 1), o === 1) r.unshift(s);
      else if (s === 1) r.unshift(o);
      else if (o !== s) {
        var i = "Operands could not be broadcast together with shapes " + (e + " and " + t + ".");
        throw Error(i);
      } else r.unshift(o);
    }
    return r;
  }
  function Sxe(e, t) {
    var r = La(e, "x", "reshape", "string_or_numeric"), n = { x: r }, a = { shape: t };
    return Ga.runKernel(EU, n, a);
  }
  var Mi = vi({ reshape_: Sxe });
  function Exe(e, t, r) {
    t === void 0 && (t = null), r === void 0 && (r = false);
    var n = La(e, "x", "sum");
    n.dtype === "bool" && (n = Mo(n, "int32"));
    var a = { x: n }, o = { axis: t, keepDims: r };
    return Ga.runKernel(LU, a, o);
  }
  var Ul = vi({ sum_: Exe }), Dxe = { kernelName: V5, inputsToSave: ["a", "b"], gradFunc: function(e, t) {
    var r = pa(t, 2), n = r[0], a = r[1], o = $c(n.shape, a.shape), s = function() {
      var l = e, u3 = Ac(n.shape, o);
      return u3.length > 0 && (l = Ul(l, u3)), Mi(l, n.shape);
    }, i = function() {
      var l = e, u3 = Ac(a.shape, o);
      return u3.length > 0 && (l = Ul(l, u3)), Mi(l, a.shape);
    };
    return { a: s, b: i };
  } };
  var Cxe = { kernelName: a1e, saveAllInputs: true, gradFunc: function(e, t) {
    var r = {};
    return t.forEach(function(n, a) {
      r[a] = function() {
        return e.clone();
      };
    }), r;
  } };
  function Mxe(e) {
    var t = La(e, "x", "zerosLike"), r = { x: t };
    return Ga.runKernel(WU, r);
  }
  var Mu = vi({ zerosLike_: Mxe }), Ixe = { kernelName: i1e, inputsToSave: ["x"], gradFunc: function(e, t) {
    var r = pa(t, 1), n = r[0];
    return { x: function() {
      return Mu(n);
    } };
  } }, Nxe = { kernelName: o1e, inputsToSave: ["x"], gradFunc: function(e, t) {
    var r = pa(t, 1), n = r[0];
    return { x: function() {
      return Mu(n);
    } };
  } }, Fxe = { kernelName: s1e, inputsToSave: ["x"], gradFunc: function(e, t) {
    var r = pa(t, 1), n = r[0];
    return { x: function() {
      return Hu(e, c2(fp(af(1), of2(Mo(n, "float32")))));
    } };
  } };
  function Oxe(e, t) {
    var r, n = La(e, "a", "add"), a = La(t, "b", "add");
    r = pa(Ih(n, a), 2), n = r[0], a = r[1];
    var o = { a: n, b: a };
    return Ga.runKernel(V5, o);
  }
  var Vd = vi({ add_: Oxe }), Pxe = { kernelName: l1e, inputsToSave: ["x"], gradFunc: function(e, t) {
    var r = pa(t, 1), n = r[0];
    return { x: function() {
      var a = c2(Vd(af(1), of2(Mo(n, "float32"))));
      return Hu(e, a);
    } };
  } }, Lxe = { kernelName: f1e, inputsToSave: ["a", "b"], gradFunc: function(e, t) {
    var r = pa(t, 2), n = r[0], a = r[1], o = $c(n.shape, a.shape), s = function() {
      var l = Vd(of2(n), of2(a)), u3 = fi(e, Hu(a, l)), c = Ac(n.shape, o);
      return c.length > 0 && (u3 = Ul(u3, c)), Mi(u3, n.shape);
    }, i = function() {
      var l = Vd(of2(n), of2(a)), u3 = ld(fi(e, Hu(n, l))), c = Ac(a.shape, o);
      return c.length > 0 && (u3 = Ul(u3, c)), Mi(u3, a.shape);
    };
    return { a: s, b: i };
  } }, Rxe = { kernelName: u1e, inputsToSave: ["x"], gradFunc: function(e, t) {
    var r = pa(t, 1), n = r[0];
    return { x: function() {
      return Hu(e, Vd(of2(Mo(n, "float32")), 1));
    } };
  } }, zxe = { kernelName: c1e, inputsToSave: ["x"], gradFunc: function(e, t) {
    var r = pa(t, 1), n = r[0];
    return { x: function() {
      return Hu(e, fp(af(1), of2(Mo(n, "float32"))));
    } };
  } };
  function Bxe(e) {
    return typeof e == "number" ? [e, e, e] : e.length === 2 ? [e[0], e[1], 1] : e;
  }
  function o2(e) {
    var t = pa(Bxe(e), 3), r = t[0], n = t[1], a = t[2];
    return r === 1 && n === 1 && a === 1;
  }
  function sV(e, t) {
    return o2(e) || o2(t);
  }
  function tg(e, t, r) {
    if (r != null) {
      if (typeof t == "string") throw Error("Error in " + e + ": pad must be an integer when using " + ("dimRoundingMode " + r + " but got pad " + t + "."));
      if (typeof t == "number") Ca(Y3(t), function() {
        return "Error in " + e + ": pad must be an integer when using " + ("dimRoundingMode " + r + " but got pad " + t + ".");
      });
      else if (typeof t == "object") t.forEach(function(n) {
        n.forEach(function(a) {
          Ca(Y3(a), function() {
            return "Error in " + e + ": pad must be an integer when using " + ("dimRoundingMode " + r + " but got pad " + a + ".");
          });
        });
      });
      else throw Error("Error in " + e + ": Unknown padding parameter: " + t);
    }
  }
  function Uxe(e, t, r, n, a, o) {
    var s = La(e, "dy", "avgPool3dGrad"), i = La(t, "input", "avgPool3dGrad"), l = s, u3 = i, c = false;
    i.rank === 4 && (c = true, l = Mi(s, [1, s.shape[0], s.shape[1], s.shape[2], s.shape[3]]), u3 = Mi(i, [1, i.shape[0], i.shape[1], i.shape[2], i.shape[3]])), Ca(l.rank === 5, function() {
      return "Error in avgPool3dGrad: dy must be rank 5 but got rank " + (l.rank + ".");
    }), Ca(u3.rank === 5, function() {
      return "Error in avgPool3dGrad: input must be rank 5 but got rank " + (u3.rank + ".");
    }), tg("avgPool3dGrad", a, o);
    var f = { dy: l, input: u3 }, h = { filterSize: r, strides: n, pad: a, dimRoundingMode: o }, p = Ga.runKernel(v1e, f, h);
    return c ? Mi(p, [p.shape[1], p.shape[2], p.shape[3], p.shape[4]]) : p;
  }
  var Vxe = vi({ avgPool3dGrad_: Uxe }), jxe = { kernelName: d1e, inputsToSave: ["x"], gradFunc: function(e, t, r) {
    var n = pa(t, 1), a = n[0], o = r.filterSize, s = r.strides, i = r.pad, l = r.dimRoundingMode;
    return { x: function() {
      return Vxe(e, a, o, s, i, l);
    } };
  } };
  function Wxe(e, t, r, n, a) {
    var o = La(e, "dy", "avgPoolGrad"), s = La(t, "input", "avgPoolGrad");
    Ca(s.rank === o.rank, function() {
      return "Rank of input (" + s.rank + ") does not match rank of dy (" + o.rank + ")";
    });
    var i = s, l = o, u3 = false;
    s.rank === 3 && (u3 = true, i = Mi(s, [1, s.shape[0], s.shape[1], s.shape[2]]), l = Mi(o, [1, o.shape[0], o.shape[1], o.shape[2]])), Ca(l.rank === 4, function() {
      return "Error in avgPoolGrad: dy must be rank 4 but got rank " + (l.rank + ".");
    }), Ca(i.rank === 4, function() {
      return "Error in avgPoolGrad: input must be rank 4 but got rank " + (i.rank + ".");
    });
    var c = { dy: l, input: i }, f = { filterSize: r, strides: n, pad: a }, h = Ga.runKernel(p1e, c, f);
    return u3 ? Mi(h, [h.shape[1], h.shape[2], h.shape[3]]) : h;
  }
  var Gxe = vi({ avgPoolGrad_: Wxe }), $xe = { kernelName: h1e, inputsToSave: ["x"], gradFunc: function(e, t, r) {
    var n = pa(t, 1), a = n[0], o = r.filterSize, s = r.strides, i = r.pad;
    return { x: function() {
      return Gxe(e, a, o, s, i);
    } };
  } };
  function Hxe(e, t, r, n) {
    var a;
    r === void 0 && (r = false), n === void 0 && (n = false);
    var o = La(e, "a", "matMul"), s = La(t, "b", "matMul");
    a = pa(Ih(o, s), 2), o = a[0], s = a[1];
    var i = { a: o, b: s }, l = { transposeA: r, transposeB: n };
    return Ga.runKernel(iU, i, l);
  }
  var bv = vi({ matMul_: Hxe }), qxe = { kernelName: iU, inputsToSave: ["a", "b"], gradFunc: function(e, t, r) {
    var n = pa(t, 2), a = n[0], o = n[1], s = r.transposeA, i = r.transposeB;
    return !s && !i ? { a: function() {
      return bv(e, o, false, true);
    }, b: function() {
      return bv(a, e, true, false);
    } } : !s && i ? { a: function() {
      return bv(e, o, false, false);
    }, b: function() {
      return bv(e, a, true, false);
    } } : s && !i ? { a: function() {
      return bv(o, e, false, true);
    }, b: function() {
      return bv(a, e, false, false);
    } } : { a: function() {
      return bv(o, e, true, true);
    }, b: function() {
      return bv(e, a, true, true);
    } };
  } };
  function Xxe(e, t, r) {
    var n = La(e, "x", "spaceToBatchND");
    Ca(n.rank >= 1 + t.length, function() {
      return "input rank " + n.rank + " should be > than [blockShape] " + t.length;
    }), Ca(r.length === t.length, function() {
      return "paddings.shape[0] " + r.length + " must be equal to [blockShape] " + t.length;
    }), Ca(n.shape.reduce(function(s, i, l) {
      return l > 0 && l <= t.length ? s && (i + r[l - 1][0] + r[l - 1][1]) % t[l - 1] === 0 : s;
    }, true), function() {
      return "input spatial dimensions " + n.shape.slice(1) + " with paddings " + r.toString() + " must be divisible by blockShapes " + t.toString();
    });
    var a = { x: n }, o = { blockShape: t, paddings: r };
    return Ga.runKernel(RU, a, o);
  }
  var Kxe = vi({ spaceToBatchND_: Xxe });
  var Yxe = { kernelName: oU, gradFunc: function(e, t, r) {
    var n = r.blockShape, a = r.crops;
    return { x: function() {
      return Kxe(e, n, a);
    } };
  } };
  var Zxe = { kernelName: m1e, gradFunc: function(e, t, r) {
    for (var n = r, a = n.inputShape, o = n.shape, s = Array.from(o), i = a.length - 1; i >= 0; i--) if (a[i] === o[i]) s[i] = 1;
    else if (a[i] !== 1) throw new Error("broadcastTo(): [" + a + "] cannot be broadcast to [" + o + "].");
    for (var l = [], i = 0; i < s.length; i++) s[i] > 1 && l.push(i);
    return { x: function() {
      return Ul(e, l, true);
    } };
  } };
  var Jxe = { kernelName: j5, gradFunc: function(e) {
    return { x: function() {
      return e.clone();
    } };
  } };
  var Qxe = { kernelName: g1e, gradFunc: function(e) {
    return { x: function() {
      return Mu(e);
    } };
  } };
  function ebe(e, t) {
    var r, n = La(e, "a", "greaterEqual", "string_or_numeric"), a = La(t, "b", "greaterEqual", "string_or_numeric");
    r = pa(Ih(n, a), 2), n = r[0], a = r[1], $c(n.shape, a.shape);
    var o = { a: n, b: a };
    return Ga.runKernel(xU, o);
  }
  var tD = vi({ greaterEqual_: ebe });
  function tbe(e, t) {
    var r, n = La(e, "a", "lessEqual", "string_or_numeric"), a = La(t, "b", "lessEqual", "string_or_numeric");
    r = pa(Ih(n, a), 2), n = r[0], a = r[1], $c(n.shape, a.shape);
    var o = { a: n, b: a };
    return Ga.runKernel(W1e, o);
  }
  var rD = vi({ lessEqual_: tbe });
  function rbe(e, t) {
    var r = La(e, "a", "logicalAnd", "bool"), n = La(t, "b", "logicalAnd", "bool");
    $c(r.shape, n.shape);
    var a = { a: r, b: n };
    return Ga.runKernel($1e, a);
  }
  var lV = vi({ logicalAnd_: rbe });
  function nbe(e) {
    var t = La(e, "x", "clone", "string_or_numeric"), r = { x: t };
    return Ga.runKernel(W5, r);
  }
  var uV = vi({ clone_: nbe });
  function abe(e, t) {
    var r = La(e, "broadcastTo", "x"), n = r.shape;
    if (t.some(function(f) {
      return !(f > 0) || f % 1 !== 0;
    })) throw new Error("broadcastTo(): Invalid broadcast shape [" + t + "].");
    if (t.length < r.rank) throw new Error("broadcastTo(): shape.length=" + t.length + " < input.rank=" + r.rank + ".");
    if (t.length > r.rank) {
      for (var a = r.shape.slice(); a.length < t.length; ) a.unshift(1);
      r = Mi(r, a);
    }
    for (var o = r.shape, s = Array.from(t), i = t.length - 1; i >= 0; i--) if (o[i] === t[i]) s[i] = 1;
    else if (r.shape[i] !== 1) throw new Error("broadcastTo(): [" + n + "] cannot be broadcast to [" + t + "].");
    var l = s.map(function(f, h) {
      return f > 1 ? h : -1;
    }).filter(function(f) {
      return f >= 0;
    });
    if (l.length === 0) return uV(r);
    var u3 = { x: r }, c = { reps: s };
    return Ga.runKernel(G5, u3, c);
  }
  var v5 = vi({ broadcastTo_: abe });
  function ibe(e, t, r) {
    var n = La(t, "a", "where"), a = La(r, "b", "where"), o = La(e, "condition", "where", "bool"), s = $c($c(o.shape, n.shape), a.shape), i = v5(o, s), l = v5(n, s), u3 = v5(a, s), c = { condition: i, t: l, e: u3 };
    return Ga.runKernel(MU, c);
  }
  var Zm = vi({ where_: ibe }), obe = { kernelName: y1e, inputsToSave: ["x"], gradFunc: function(e, t, r) {
    var n = pa(t, 1), a = n[0], o = r.clipValueMin, s = r.clipValueMax;
    return { x: function() {
      return Zm(lV(tD(a, o), rD(a, s)), e, Mu(e));
    } };
  } };
  var sbe = { kernelName: b1e, inputsToSave: ["x"], gradFunc: oV.gradFunc };
  function lbe(e, t, r) {
    r === void 0 && (r = 0);
    var n = La(e, "x", "split"), a = { x: n }, o = { numOrSizeSplits: t, axis: r };
    return Ga.runKernel(zU, a, o);
  }
  var ube = vi({ split_: lbe });
  var cbe = { kernelName: sU, saveAllInputs: true, gradFunc: function(e, t, r) {
    var n = t.map(function(l) {
      return l.shape;
    }), a = r.axis, o = Qm(a, t[0].shape)[0], s = n.map(function(l) {
      return l[o];
    }), i = ube(e, s, o);
    return i.map(function(l) {
      return function() {
        return l;
      };
    });
  } };
  function fbe(e, t, r, n, a, o, s) {
    o === void 0 && (o = "NHWC");
    var i = e;
    e.rank === 3 && (i = Mi(e, [1, e.shape[0], e.shape[1], e.shape[2]]));
    var l = t;
    l.rank === 3 && (l = Mi(t, [1, t.shape[0], t.shape[1], t.shape[2]])), Ca(i.rank === 4, function() {
      return "Error in conv2dDerFilter: input must be rank 4, but got shape " + (i.shape + ".");
    }), Ca(l.rank === 4, function() {
      return "Error in conv2dDerFilter: dy must be rank 4, but got shape " + (l.shape + ".");
    }), Ca(r.length === 4, function() {
      return "Error in conv2dDerFilter: filterShape must be length 4, but got " + (r + ".");
    });
    var u3 = o === "NHWC" ? i.shape[3] : i.shape[1], c = o === "NHWC" ? l.shape[3] : l.shape[1];
    Ca(u3 === r[2], function() {
      return "Error in conv2dDerFilter: depth of input " + u3 + ") must " + ("match input depth in filter (" + r[2] + ".");
    }), Ca(c === r[3], function() {
      return "Error in conv2dDerFilter: depth of dy (" + c + ") must " + ("match output depth for filter (" + r[3] + ").");
    }), tg("conv2dDerFilter", a, s);
    var f = { x: i, dy: l }, h = { strides: n, pad: a, dataFormat: o, dimRoundingMode: s, filterShape: r };
    return Ga.runKernel(_1e, f, h);
  }
  var cV = vi({ conv2DBackpropFilter_: fbe });
  function hbe(e, t, r, n, a, o, s) {
    o === void 0 && (o = "NHWC"), Ca(e.length === t.rank, function() {
      return "Length of inShape " + ("(" + e.length + ") and rank of dy (" + t.rank + ") must match");
    });
    var i = e, l = t, u3 = false;
    t.rank === 3 && (u3 = true, l = Mi(t, [1, t.shape[0], t.shape[1], t.shape[2]]), i = [1, e[0], e[1], e[2]]), Ca(i.length === 4, function() {
      return "Error in conv2dDerInput: inShape must be length 4, but got length " + (i.length + ".");
    }), Ca(l.rank === 4, function() {
      return "Error in conv2dDerInput: dy must be rank 4, but got " + ("rank " + l.rank);
    }), Ca(r.rank === 4, function() {
      return "Error in conv2dDerInput: filter must be rank 4, but got " + ("rank " + r.rank);
    });
    var c = o === "NHWC" ? i[3] : i[1], f = o === "NHWC" ? l.shape[3] : l.shape[1];
    Ca(c === r.shape[2], function() {
      return "Error in conv2dDerInput: depth of input (" + c + ") must " + ("match input depth for filter " + r.shape[2] + ".");
    }), Ca(f === r.shape[3], function() {
      return "Error in conv2dDerInput: depth of output (" + f + ") must " + ("match output depth for filter " + r.shape[3] + ".");
    }), tg("conv2dDerInput", a, s);
    var h = { dy: l, filter: r }, p = { strides: n, pad: a, dataFormat: o, dimRoundingMode: s, inputShape: i }, d = Ga.runKernel(uU, h, p);
    return u3 ? Mi(d, [d.shape[1], d.shape[2], d.shape[3]]) : d;
  }
  var pbe = vi({ conv2DBackpropInput_: hbe }), dbe = { kernelName: lU, inputsToSave: ["x", "filter"], gradFunc: function(e, t, r) {
    var n = pa(t, 2), a = n[0], o = n[1], s = r.dilations, i = r.strides, l = r.pad, u3 = r.dataFormat;
    return Ca(o2(s), function() {
      return "Error in gradient of conv2D: dilation rates greater than 1 " + ("are not yet supported in gradients. Got dilations '" + s + "'");
    }), { x: function() {
      return pbe(a.shape, e, o, i, l, u3);
    }, filter: function() {
      return cV(a, e, o.shape, i, l, u3);
    } };
  } };
  function vbe(e, t, r, n, a, o, s) {
    a === void 0 && (a = "NHWC"), o === void 0 && (o = [1, 1]);
    var i = La(e, "x", "conv2d", "float32"), l = La(t, "filter", "conv2d", "float32"), u3 = i, c = false;
    i.rank === 3 && (c = true, u3 = Mi(i, [1, i.shape[0], i.shape[1], i.shape[2]])), Ca(u3.rank === 4, function() {
      return "Error in conv2d: input must be rank 4, but got rank " + u3.rank + ".";
    }), Ca(l.rank === 4, function() {
      return "Error in conv2d: filter must be rank 4, but got rank " + (l.rank + ".");
    }), tg("conv2d", n, s);
    var f = a === "NHWC" ? u3.shape[3] : u3.shape[1];
    Ca(f === l.shape[2], function() {
      return "Error in conv2d: depth of input (" + f + ") must match " + ("input depth for filter " + l.shape[2] + ".");
    }), Ca(sV(r, o), function() {
      return "Error in conv2D: Either strides or dilations must be 1. " + ("Got strides " + r + " and dilations '" + o + "'");
    });
    var h = { x: u3, filter: l }, p = { strides: r, pad: n, dataFormat: a, dilations: o, dimRoundingMode: s }, d = Ga.runKernel(lU, h, p);
    return c ? Mi(d, [d.shape[1], d.shape[2], d.shape[3]]) : d;
  }
  var mbe = vi({ conv2d_: vbe }), gbe = { kernelName: uU, inputsToSave: ["dy", "filter"], gradFunc: function(e, t, r) {
    var n = pa(t, 2), a = n[0], o = n[1], s = r.strides, i = r.pad, l = r.dataFormat, u3 = r.dimRoundingMode;
    return { dy: function() {
      return mbe(e, o, s, i, l, 1, u3);
    }, filter: function() {
      return cV(e, a, o.shape, s, i, l, u3);
    } };
  } };
  function ybe(e, t, r, n, a) {
    var o = e;
    e.rank === 4 && (o = Mi(e, [1, e.shape[0], e.shape[1], e.shape[2], e.shape[3]]));
    var s = t;
    s.rank === 4 && (s = Mi(t, [1, t.shape[0], t.shape[1], t.shape[2], t.shape[3]])), Ca(o.rank === 5, function() {
      return "Error in conv3dDerFilter: input must be rank 5, but got shape " + (o.shape + ".");
    }), Ca(s.rank === 5, function() {
      return "Error in conv3dDerFilter: dy must be rank 5, but got shape " + (s.shape + ".");
    }), Ca(r.length === 5, function() {
      return "Error in conv3dDerFilter: filterShape must be length 5, but got " + (r + ".");
    }), Ca(o.shape[4] === r[3], function() {
      return "Error in conv3dDerFilter: depth of input " + o.shape[4] + ") must " + ("match input depth in filter (" + r[3] + ".");
    }), Ca(s.shape[4] === r[4], function() {
      return "Error in conv3dDerFilter: depth of dy (" + s.shape[4] + ") must " + ("match output depth for filter (" + r[4] + ").");
    });
    var i = { x: o, dy: s }, l = { strides: n, pad: a, filterShape: r };
    return Ga.runKernel(k1e, i, l);
  }
  var xbe = vi({ conv3DBackpropFilter_: ybe });
  function bbe(e, t, r, n, a) {
    Ca(e.length === t.rank, function() {
      return "Length of inShape " + ("(" + e.length + ") and rank of dy (" + t.rank + ") must match");
    });
    var o = e, s = t, i = false;
    t.rank === 4 && (i = true, s = Mi(t, [1, t.shape[0], t.shape[1], t.shape[2], t.shape[3]]), o = [1, e[0], e[1], e[2], e[3]]);
    var l = o[4], u3 = s.shape[4];
    Ca(o.length === 5, function() {
      return "Error in conv3dDerInput: inShape must be length 5, but got length " + (o.length + ".");
    }), Ca(s.rank === 5, function() {
      return "Error in conv3dDerInput: dy must be rank 5, but got " + ("rank " + s.rank);
    }), Ca(r.rank === 5, function() {
      return "Error in conv3dDerInput: filter must be rank 5, but got " + ("rank " + r.rank);
    }), Ca(l === r.shape[3], function() {
      return "Error in conv3dDerInput: depth of input (" + l + ") must " + ("match input depth for filter " + r.shape[3] + ".");
    }), Ca(u3 === r.shape[4], function() {
      return "Error in conv3dDerInput: depth of output (" + u3 + ") must " + ("match output depth for filter " + r.shape[4] + ".");
    });
    var c = { dy: s, filter: r }, f = { pad: a, strides: n, inputShape: o }, h = Ga.runKernel(T1e, c, f);
    return i ? Mi(h, [h.shape[1], h.shape[2], h.shape[3], h.shape[4]]) : h;
  }
  var _be = vi({ conv3DBackpropInput_: bbe }), wbe = { kernelName: w1e, inputsToSave: ["x", "filter"], gradFunc: function(e, t, r) {
    var n = r.dilations, a = r.strides, o = r.pad;
    Ca(o2(n), function() {
      return "Error in gradient of conv3D: dilation rates greater than 1 are " + ("not yet supported in gradients. Got dilations '" + n + "'");
    });
    var s = pa(t, 2), i = s[0], l = s[1];
    return { x: function() {
      return _be(i.shape, e, l, a, o);
    }, filter: function() {
      return xbe(i, e, l.shape, a, o);
    } };
  } };
  function kbe(e) {
    var t = La(e, "x", "sin", "float32"), r = { x: t };
    return Ga.runKernel(NU, r);
  }
  var Tbe = vi({ sin_: kbe }), Abe = { kernelName: cU, inputsToSave: ["x"], gradFunc: function(e, t) {
    var r = pa(t, 1), n = r[0];
    return { x: function() {
      return fi(ld(Tbe(Mo(n, "float32"))), e);
    } };
  } };
  function Sbe(e) {
    var t = La(e, "x", "sinh"), r = { x: t };
    return Ga.runKernel(FU, r);
  }
  var Ebe = vi({ sinh_: Sbe }), Dbe = { kernelName: fU, inputsToSave: ["x"], gradFunc: function(e, t) {
    var r = pa(t, 1), n = r[0];
    return { x: function() {
      return fi(Ebe(Mo(n, "float32")), e);
    } };
  } };
  function Cbe(e, t) {
    for (var r = 0; r < e.length; ++r) if (e[e.length - r - 1] !== t - 1 - r) return false;
    return true;
  }
  function Mbe(e, t, r) {
    for (var n = e.length + t.length, a = [], o = 0, s = 0, i = 0; i < n; i++) r.indexOf(i) === -1 ? a.push(e[o++]) : a.push(t[s++]);
    return a;
  }
  function Ibe(e, t) {
    for (var r = [], n = e.length, a = 0; a < n; a++) t.indexOf(a) === -1 && r.push(e[a]);
    var o = t.map(function(s) {
      return e[s];
    });
    return [r, o];
  }
  function DB(e, t) {
    var r = t.map(function(n) {
      return 1;
    });
    return Mbe(e, r, t);
  }
  function Nbe(e, t) {
    if (Cbe(e, t)) return null;
    for (var r = [], n = 0; n < t; ++n) e.indexOf(n) === -1 && r.push(n);
    return e.forEach(function(a) {
      return r.push(a);
    }), r;
  }
  function fV(e) {
    return e.map(function(t, r) {
      return [r, t];
    }).sort(function(t, r) {
      return t[1] - r[1];
    }).map(function(t) {
      return t[0];
    });
  }
  function Fbe(e, t, r, n) {
    t === void 0 && (t = 0), r === void 0 && (r = false), n === void 0 && (n = false);
    var a = La(e, "x", "cumsum"), o = { x: a }, s = { axis: t, exclusive: r, reverse: n };
    return Ga.runKernel(hU, o, s);
  }
  var Obe = vi({ cumsum_: Fbe });
  function Pbe(e, t) {
    var r = La(e, "x", "transpose");
    if (t == null && (t = r.shape.map(function(o, s) {
      return s;
    }).reverse()), Ca(r.rank === t.length, function() {
      return "Error in transpose: rank of input " + r.rank + " " + ("must match length of perm " + t + ".");
    }), t.forEach(function(o) {
      Ca(o >= 0 && o < r.rank, function() {
        return "All entries in 'perm' must be between 0 and " + (r.rank - 1) + (" but got " + t);
      });
    }), r.rank <= 1) return r.clone();
    var n = { x: r }, a = { perm: t };
    return Ga.runKernel(UU, n, a);
  }
  var Q3 = vi({ transpose_: Pbe }), Lbe = { kernelName: hU, inputsToSave: ["x"], gradFunc: function(e, t, r) {
    var n = pa(t, 1), a = n[0], o = r.axis, s = r.exclusive, i = r.reverse;
    return { x: function() {
      var l = Nbe([o], a.rank), u3 = Obe(e, o, s, !i);
      return l != null && (u3 = Q3(u3, l)), u3;
    } };
  } };
  function Rbe(e, t, r, n, a, o, s) {
    o === void 0 && (o = [1, 1]);
    var i = e;
    e.rank === 3 && (i = Mi(e, [1, e.shape[0], e.shape[1], e.shape[2]]));
    var l = t;
    l.rank === 3 && (l = Mi(t, [1, t.shape[0], t.shape[1], t.shape[2]]));
    var u3 = { x: i, dy: l }, c = { strides: n, pad: a, dimRoundingMode: s, dilations: o, filterShape: r };
    return Ga.runKernel(S1e, u3, c);
  }
  var zbe = vi({ depthwiseConv2dNativeBackpropFilter_: Rbe });
  function Bbe(e, t, r, n, a, o, s) {
    o === void 0 && (o = [1, 1]);
    var i = t, l = false;
    t.rank === 3 && (l = true, i = Mi(t, [1, t.shape[0], t.shape[1], t.shape[2]]));
    var u3 = { dy: i, filter: r }, c = { strides: n, pad: a, dimRoundingMode: s, dilations: o, inputShape: e }, f = Ga.runKernel(E1e, u3, c);
    return l ? Mi(f, [f.shape[1], f.shape[2], f.shape[3]]) : f;
  }
  var Ube = vi({ depthwiseConv2dNativeBackpropInput_: Bbe }), Vbe = { kernelName: A1e, inputsToSave: ["x", "filter"], gradFunc: function(e, t, r) {
    var n = r.dilations, a = r.strides, o = r.pad, s = r.dimRoundingMode, i = n ?? [1, 1];
    Ca(o2(i), function() {
      return "Error in gradient of depthwiseConv2dNative: dilation rates greater than 1 are not yet supported. Got dilations " + ("'" + i + "'");
    });
    var l = pa(t, 2), u3 = l[0], c = l[1];
    return Ca(u3.rank === 4, function() {
      return "Error in gradient of depthwiseConv2dNative: input must be " + ("rank 4, but got rank " + u3.rank + ".");
    }), Ca(c.rank === 4, function() {
      return "Error in gradient of depthwiseConv2dNative: filter must be " + ("rank 4, but got rank " + c.rank + ".");
    }), Ca(u3.shape[3] === c.shape[2], function() {
      return "Error in gradient of depthwiseConv2d: number of input " + ("channels (" + u3.shape[3] + ") must match the inChannels dimension ") + ("in filter " + c.shape[2] + ".");
    }), Ca(sV(a, i), function() {
      return "Error in gradient of depthwiseConv2d: Either strides or " + ("dilations must be  1. Got strides " + a + " and dilations ") + ("'" + i + "'.");
    }), tg("depthwiseConv2d", o, s), { x: function() {
      return Ube(u3.shape, e, c, a, o, i, s);
    }, filter: function() {
      return zbe(u3, e, c.shape, a, o, i, s);
    } };
  } }, jbe = { kernelName: D1e, inputsToSave: ["x", "filter"], gradFunc: function(e, t, r) {
    var n = pa(t, 2), a = n[0], o = n[1], s = { x: a, filter: o, dy: e }, i = { x: a, filter: o, dy: e };
    return { x: function() {
      return Ga.runKernel(C1e, s, r);
    }, filter: function() {
      return Ga.runKernel(M1e, i, r);
    } };
  } }, Wbe = { kernelName: I1e, outputsToSave: [true], gradFunc: function(e, t) {
    var r = pa(t, 1), n = r[0], a = { dy: e, y: n };
    return { x: function() {
      return Ga.runKernel(N1e, a);
    } };
  } };
  function Gbe(e) {
    var t = La(e, "x", "exp"), r = { x: t };
    return Ga.runKernel(dU, r);
  }
  var uk = vi({ exp_: Gbe }), $be = { kernelName: F1e, inputsToSave: ["x"], gradFunc: function(e, t) {
    var r = pa(t, 1), n = r[0], a = fi(uk(ld(of2(n))), 2 / Math.sqrt(Math.PI));
    return { x: function() {
      return fi(e, a);
    } };
  } }, Hbe = { kernelName: dU, outputsToSave: [true], gradFunc: function(e, t) {
    var r = pa(t, 1), n = r[0];
    return { x: function() {
      return fi(e, n);
    } };
  } }, qbe = { kernelName: vU, inputsToSave: ["input"], gradFunc: function(e, t) {
    var r = pa(t, 1), n = r[0];
    return { input: function() {
      return Mi(e, n.shape);
    } };
  } }, Xbe = { kernelName: P1e, inputsToSave: ["x"], gradFunc: function(e, t) {
    var r = pa(t, 1), n = r[0];
    return { x: function() {
      return fi(e, uk(n));
    } };
  } };
  var Kbe = { kernelName: mU, gradFunc: function(e) {
    return { x: function() {
      return Mu(e);
    } };
  } }, Ybe = { kernelName: gU, inputsToSave: ["a", "b"], gradFunc: function(e, t) {
    var r = pa(t, 2), n = r[0], a = r[1], o = $c(n.shape, a.shape), s = function() {
      var l = Hu(e, Mo(a, "float32")), u3 = Ac(n.shape, o);
      return u3.length > 0 ? Mi(Ul(l, u3), n.shape) : l;
    }, i = function() {
      var l = fi(e, Mo(n, "float32")), u3 = Ac(a.shape, o);
      u3.length > 0 && (l = Mi(Ul(l, u3), a.shape));
      var c = of2(a);
      return ld(Hu(l, Mo(c, "float32")));
    };
    return { a: s, b: i };
  } };
  function Zbe(e) {
    var t = La(e, "x", "rsqrt", "float32"), r = { x: t };
    return Ga.runKernel(CU, r);
  }
  var Jbe = vi({ rsqrt_: Zbe });
  function Qbe(e, t) {
    var r = La(e, "x", "tile", "string_or_numeric");
    Ca(r.rank === t.length, function() {
      return "Error in transpose: rank of input " + r.rank + " " + ("must match length of reps " + t + ".");
    });
    var n = { x: r }, a = { reps: t };
    return Ga.runKernel(G5, n, a);
  }
  var e2e = vi({ tile_: Qbe }), t2e = { kernelName: L1e, inputsToSave: ["x", "mean", "variance", "scale"], gradFunc: function(e, t, r) {
    var n = r.varianceEpsilon, a = pa(t, 4), o = a[0], s = a[1], i = a[2], l = a[3], u3 = l ?? af(1), c = Ac(s.shape, o.shape), f = [];
    if (s.rank === 1) {
      for (var h = 0; h < o.shape.length - 1; ++h) f.push(o.shape[h]);
      f.push(1);
    }
    var p = fp(o, s), d = fi(e, u3), v = Jbe(Vd(i, af(n))), m = fi(fi(fi(v, v), v), af(-0.5)), g = function() {
      return s.rank === 1 ? Mi(fi(fi(e, e2e(Mi(v, [1, 1, 1, s.shape[0]]), f)), u3), o.shape) : Mi(fi(fi(e, v), u3), o.shape);
    }, x = function() {
      var _4 = fi(fi(v, af(-1)), d);
      return s.rank === 1 && (_4 = Ul(_4, c)), Mi(_4, s.shape);
    }, b = function() {
      var _4 = fi(fi(m, p), d);
      return s.rank === 1 && (_4 = Ul(_4, c)), Mi(_4, s.shape);
    }, y = function() {
      var _4 = fi(p, v), k = fi(e, _4);
      return s.rank === 1 && (k = Ul(k, c)), Mi(k, s.shape);
    }, w = function() {
      var _4 = e;
      return s.rank === 1 && (_4 = Ul(_4, c)), Mi(_4, s.shape);
    };
    return { x: g, mean: x, variance: b, scale: y, offset: w };
  } };
  function r2e(e, t, r) {
    var n = La(e, "x", "unsortedSegmentSum"), a = La(t, "segmentIds", "unsortedSegmentSum", "int32");
    Ca(Y3(r), function() {
      return "numSegments must be of dtype int";
    });
    var o = { x: n, segmentIds: a }, s = { numSegments: r };
    return Ga.runKernel(jU, o, s);
  }
  var n2e = vi({ unsortedSegmentSum_: r2e }), a2e = { kernelName: yU, inputsToSave: ["x", "indices"], gradFunc: function(e, t, r) {
    var n = pa(t, 2), a = n[0], o = n[1], s = r.axis, i = Qm(s, a.shape)[0], l = function() {
      var u3 = a.shape, c = o.size, f = u3.slice(0, i), h = f.length, p = u3.slice(s, u3.length).slice(1), d = p.length, v = CB(0, h), m = CB(h + 1, h + 1 + d), g = MB([f, [c], p]), x = Mi(e, g), b = Mi(o, [c]), y = MB([[h], v, m]), w = Q3(x, y), _4 = n2e(w, b, a.shape[i]), k = fV(y);
      return _4 = Q3(_4, k), _4;
    };
    return { x: l, indices: function() {
      return o;
    } };
  } };
  function CB(e, t) {
    for (var r = [], n = e; n < t; ++n) r.push(n);
    return r;
  }
  function MB(e) {
    for (var t = [], r = 0; r < e.length; ++r) for (var n = 0; n < e[r].length; ++n) t.push(e[r][n]);
    return t;
  }
  var i2e = { kernelName: xU, inputsToSave: ["a", "b"], gradFunc: function(e, t) {
    var r = pa(t, 2), n = r[0], a = r[1];
    return { a: function() {
      return Mu(n);
    }, b: function() {
      return Mu(a);
    } };
  } };
  var o2e = { kernelName: W5, gradFunc: function(e) {
    return { x: function() {
      return Mo(e, "float32");
    } };
  } };
  var s2e = { kernelName: z1e, gradFunc: function(e) {
    return { x: function() {
      return Mu(e);
    } };
  } };
  var l2e = { kernelName: B1e, gradFunc: function(e) {
    return { x: function() {
      return Mu(e);
    } };
  } };
  var u2e = { kernelName: U1e, gradFunc: function(e) {
    return { x: function() {
      return Mu(e);
    } };
  } };
  function c2e(e, t) {
    var r, n = La(e, "a", "greater", "string_or_numeric"), a = La(t, "b", "greater", "string_or_numeric");
    r = pa(Ih(n, a), 2), n = r[0], a = r[1], $c(n.shape, a.shape);
    var o = { a: n, b: a };
    return Ga.runKernel(R1e, o);
  }
  var f2 = vi({ greater_: c2e }), f2e = { kernelName: V1e, inputsToSave: ["x"], gradFunc: function(e, t, r) {
    var n = pa(t, 1), a = n[0], o = r.alpha, s = f2(a, 0);
    return { x: function() {
      return Zm(s, e, fi(e, o));
    } };
  } }, h2e = { kernelName: G1e, inputsToSave: ["x"], gradFunc: function(e, t) {
    var r = pa(t, 1), n = r[0];
    return { x: function() {
      return Hu(e, Vd(n, 1));
    } };
  } }, p2e = { kernelName: bU, inputsToSave: ["x"], gradFunc: function(e, t) {
    var r = pa(t, 1), n = r[0];
    return { x: function() {
      return Hu(e, Mo(n, "float32"));
    } };
  } }, d2e = { kernelName: q1e, inputsToSave: [], outputsToSave: [true], gradFunc: function(e, t, r) {
    var n = pa(t, 1), a = n[0], o = r.axis;
    return { logits: function() {
      var s = true, i = uk(a);
      return fp(e, fi(Ul(e, o, s), i));
    } };
  } };
  function v2e(e, t, r, n, a, o, s) {
    n === void 0 && (n = 5), a === void 0 && (a = 1), o === void 0 && (o = 1), s === void 0 && (s = 0.5);
    var i = { x: e, y: t, dy: r }, l = { depthRadius: n, bias: a, alpha: o, beta: s };
    return Ga.runKernel(K1e, i, l);
  }
  var m2e = vi({ localResponseNormalizationBackprop_: v2e }), g2e = { kernelName: X1e, inputsToSave: ["x"], outputsToSave: [true], gradFunc: function(e, t, r) {
    var n = pa(t, 2), a = n[0], o = n[1], s = r.depthRadius, i = r.bias, l = r.alpha, u3 = r.beta;
    return { x: function() {
      return m2e(a, o, e, s, i, l, u3);
    } };
  } };
  function y2e(e, t) {
    var r, n = La(e, "a", "equal", "string_or_numeric"), a = La(t, "b", "equal", "string_or_numeric");
    r = pa(Ih(n, a), 2), n = r[0], a = r[1], $c(n.shape, a.shape);
    var o = { a: n, b: a };
    return Ga.runKernel(O1e, o);
  }
  var x2e = vi({ equal_: y2e });
  function hV(e, t, r, n) {
    return t.rank < r.rank && (t = Mi(t, DB(t.shape, n))), e.rank < r.rank && (e = Mi(e, DB(e.shape, n))), { x: function() {
      var a = fi(e, Mo(x2e(r, t), e.dtype));
      return a;
    } };
  }
  var IB = { kernelName: Y1e, inputsToSave: ["x"], outputsToSave: [true], gradFunc: function(e, t, r) {
    var n = r, a = n.reductionIndices, o = t[0], s = t[1], i = Qm(a, o.shape), l = hV(e, s, o, i);
    return { x: function() {
      return l.x();
    } };
  } };
  function b2e(e, t) {
    var r, n = La(e, "a", "less", "string_or_numeric"), a = La(t, "b", "less", "string_or_numeric");
    r = pa(Ih(n, a), 2), n = r[0], a = r[1], $c(n.shape, a.shape);
    var o = { a: n, b: a };
    return Ga.runKernel(j1e, o);
  }
  var _2e = vi({ less_: b2e }), w2e = { kernelName: _U, inputsToSave: ["a", "b"], gradFunc: function(e, t) {
    var r = pa(t, 2), n = r[0], a = r[1], o = function() {
      return fi(e, Mo(tD(n, a), "float32"));
    }, s = function() {
      return fi(e, Mo(_2e(n, a), "float32"));
    };
    return { a: o, b: s };
  } };
  function k2e(e, t, r, n, a, o, s) {
    var i = La(e, "dy", "maxPool3dGrad"), l = La(t, "input", "maxPool3dGrad"), u3 = La(r, "output", "maxPool3dGrad"), c = i, f = l, h = u3, p = false;
    l.rank === 4 && (p = true, c = Mi(i, [1, i.shape[0], i.shape[1], i.shape[2], i.shape[3]]), f = Mi(l, [1, l.shape[0], l.shape[1], l.shape[2], l.shape[3]]), h = Mi(u3, [1, u3.shape[0], u3.shape[1], u3.shape[2], u3.shape[3]])), Ca(c.rank === 5, function() {
      return "Error in maxPool3dGrad: dy must be rank 5 but got rank " + (c.rank + ".");
    }), Ca(f.rank === 5, function() {
      return "Error in maxPool3dGrad: input must be rank 5 but got rank " + (f.rank + ".");
    }), Ca(h.rank === 5, function() {
      return "Error in maxPool3dGrad: output must be rank 5 but got rank " + (h.rank + ".");
    }), tg("maxPool3dGrad", o, s);
    var d = { dy: c, input: f, output: h }, v = { filterSize: n, strides: a, pad: o, dimRoundingMode: s }, m = Ga.runKernel(eye, d, v);
    return p ? Mi(m, [m.shape[1], m.shape[2], m.shape[3], m.shape[4]]) : m;
  }
  var T2e = vi({ maxPool3dGrad_: k2e }), A2e = { kernelName: Q1e, inputsToSave: ["x"], outputsToSave: [true], gradFunc: function(e, t, r) {
    var n = pa(t, 2), a = n[0], o = n[1], s = r.filterSize, i = r.strides, l = r.pad, u3 = r.dimRoundingMode;
    return { x: function() {
      return T2e(e, a, o, s, i, l, u3);
    } };
  } };
  function S2e(e, t, r, n, a, o, s) {
    var i = La(e, "dy", "maxPoolGrad"), l = La(t, "input", "maxPoolGrad"), u3 = La(r, "output", "maxPoolGrad");
    Ca(l.rank === i.rank, function() {
      return "Rank of input (" + l.rank + ") does not match rank of dy " + ("(" + i.rank + ")");
    }), Ca(i.rank === 4, function() {
      return "Error in maxPoolGrad: dy must be rank 4 but got rank " + (i.rank + ".");
    }), Ca(l.rank === 4, function() {
      return "Error in maxPoolGrad: input must be rank 4 but got rank " + (l.rank + ".");
    }), tg("maxPoolGrad", o, s);
    var c = { dy: i, input: l, output: u3 }, f = { filterSize: n, strides: a, pad: o, dimRoundingMode: s };
    return Ga.runKernel(J1e, c, f);
  }
  var E2e = vi({ maxPoolGrad_: S2e }), D2e = { kernelName: Z1e, inputsToSave: ["x"], outputsToSave: [true], gradFunc: function(e, t, r) {
    var n = pa(t, 2), a = n[0], o = n[1], s = r.filterSize, i = r.strides, l = r.pad;
    return { x: function() {
      return E2e(e, a, o, s, i, l);
    } };
  } };
  function C2e(e, t) {
    var r = La(e, "real", "complex"), n = La(t, "imag", "complex");
    Dye(r.shape, n.shape, "real and imag shapes, " + r.shape + " and " + n.shape + ", must match in call to tf.complex().");
    var a = { real: r, imag: n };
    return Ga.runKernel(x1e, a);
  }
  var pV = vi({ complex_: C2e });
  function ek(e, t) {
    if (t === void 0 && (t = "float32"), t === "complex64") {
      var r = ek(e, "float32"), n = ek(e, "float32");
      return pV(r, n);
    }
    var a = K5(Wd(e), t);
    return Ga.makeTensor(a, e, t);
  }
  function ck(e, t) {
    if (t === void 0 && (t = "float32"), t === "complex64") {
      var r = ck(e, "float32"), n = ek(e, "float32");
      return pV(r, n);
    }
    var a = HU(Wd(e), t);
    return Ga.makeTensor(a, e, t);
  }
  var M2e = { kernelName: tye, inputsToSave: ["x"], gradFunc: function(e, t, r) {
    var n = pa(t, 1), a = n[0], o = r.axis, s = Qm(o, a.shape), i = Ibe(a.shape, s), l = i[1], u3 = Wd(l), c = function() {
      var f = a.shape.slice();
      s.forEach(function(d) {
        f[d] = 1;
      });
      var h = Mi(e, f), p = Hu(fi(h, ck(a.shape, "float32")), u3);
      return p;
    };
    return { x: c };
  } }, I2e = { kernelName: rye, inputsToSave: ["x"], outputsToSave: [true], gradFunc: function(e, t, r) {
    var n = r, a = n.axis, o = pa(t, 2), s = o[0], i = o[1], l = Qm(a, s.shape), u3 = hV(e, i, s, l);
    return { x: function() {
      return u3.x();
    } };
  } }, N2e = { kernelName: nye, inputsToSave: ["a", "b"], gradFunc: function(e, t) {
    var r = pa(t, 2), n = r[0], a = r[1], o = function() {
      return fi(e, Mo(rD(n, a), "float32"));
    }, s = function() {
      return fi(e, Mo(f2(n, a), "float32"));
    };
    return { a: o, b: s };
  } };
  function F2e(e, t, r) {
    var n = La(e, "x", "slice", "string_or_numeric");
    if (n.rank === 0) throw new Error("Slicing scalar is not possible");
    var a = { x: n }, o = { begin: t, size: r };
    return Ga.runKernel(IU, a, o);
  }
  var hy = vi({ slice_: F2e });
  var O2e = { kernelName: aye, inputsToSave: ["x"], gradFunc: function(e, t, r) {
    var n = t[0], a = r.paddings, o = a.map(function(s) {
      return s[0];
    });
    return { x: function() {
      return hy(e, o, n.shape);
    } };
  } };
  function P2e(e) {
    var t = La(e, "x", "floor", "float32"), r = { x: t };
    return Ga.runKernel(mU, r);
  }
  var L2e = vi({ floor_: P2e }), R2e = { kernelName: iye, inputsToSave: ["a", "b"], gradFunc: function(e, t) {
    var r = pa(t, 2), n = r[0], a = r[1], o = $c(n.shape, a.shape), s = function() {
      var l = Ac(n.shape, o);
      return l.length > 0 ? Mi(Ul(e, l), n.shape) : e;
    }, i = function() {
      var l = fi(e, ld(L2e(Hu(n, a)))), u3 = Ac(a.shape, o);
      return u3.length > 0 ? Mi(Ul(l, u3), a.shape) : l;
    };
    return { a: s, b: i };
  } }, z2e = { kernelName: wU, inputsToSave: ["a", "b"], gradFunc: function(e, t) {
    var r = pa(t, 2), n = r[0], a = r[1], o = $c(n.shape, a.shape), s = function() {
      var l = fi(e, Mo(a, "float32")), u3 = Ac(n.shape, o);
      return u3.length > 0 ? Mi(Ul(l, u3), n.shape) : l;
    }, i = function() {
      var l = fi(e, Mo(n, "float32")), u3 = Ac(a.shape, o);
      return u3.length > 0 ? Mi(Ul(l, u3), a.shape) : l;
    };
    return { a: s, b: i };
  } };
  var B2e = { kernelName: kU, gradFunc: function(e) {
    return { x: function() {
      return ld(e);
    } };
  } };
  var U2e = { kernelName: sye, inputsToSave: ["indices"], gradFunc: function(e, t) {
    var r = t[0];
    return { indices: function() {
      return ek(r.shape, "float32");
    } };
  } };
  var V2e = { kernelName: oye, gradFunc: function(e) {
    return { x: function() {
      return Mu(e);
    } };
  } };
  function j2e(e, t) {
    t === void 0 && (t = 0);
    var r = La(e, "x", "unstack", "string_or_numeric");
    Ca(t >= -r.shape.length && t < r.shape.length, function() {
      return "Axis = " + t + " is not in [-" + r.shape.length + ", " + r.shape.length + ")";
    });
    var n = { value: r }, a = { axis: t };
    return Ga.runKernel(VU, n, a);
  }
  var W2e = vi({ unstack_: j2e });
  var G2e = { kernelName: TU, saveAllInputs: true, gradFunc: function(e, t, r) {
    var n = r.axis, a = W2e(e, n);
    return a.map(function(o) {
      return function() {
        return o;
      };
    });
  } };
  var NB = { kernelName: AU, inputsToSave: ["x"], gradFunc: function(e, t, r) {
    var n = t[0], a = r.paddings, o = a.map(function(s) {
      return s[0];
    });
    return { x: function() {
      return hy(e, o, n.shape);
    } };
  } };
  function $2e(e) {
    var t = La(e, "x", "log", "float32"), r = { x: t };
    return Ga.runKernel(bU, r);
  }
  var H2e = vi({ log_: $2e });
  function q2e(e, t) {
    var r, n = La(e, "base", "pow"), a = La(t, "exp", "pow");
    r = pa(Ih(n, a), 2), n = r[0], a = r[1];
    var o = { a: n, b: a };
    return Ga.runKernel(SU, o);
  }
  var dV = vi({ pow_: q2e }), X2e = { kernelName: SU, inputsToSave: ["a", "b"], outputsToSave: [true], gradFunc: function(e, t) {
    var r = pa(t, 3), n = r[0], a = r[1], o = r[2], s = n, i = a, l = $c(s.shape, i.shape), u3 = function() {
      var f = Mo(i, "float32"), h = fi(e, fi(f, dV(s, fp(f, af(1))))), p = Ac(s.shape, l);
      return p.length > 0 && (h = Ul(h, p)), Mi(h, s.shape);
    }, c = function() {
      var f = f2(s, 0), h = Zm(f, H2e(s), Mu(s)), p = fi(e, fi(o, h)), d = Ac(i.shape, l);
      return d.length > 0 && (p = Ul(p, d)), Mi(p, i.shape);
    };
    return { a: u3, b: c };
  } }, K2e = { kernelName: lye, inputsToSave: ["x", "alpha"], gradFunc: function(e, t) {
    var r = pa(t, 2), n = r[0], a = r[1], o = f2(n, 0);
    return { x: function() {
      return Zm(o, e, fi(e, a));
    }, alpha: function() {
      var s = Zm(o, Mu(e), fi(e, n)), i = Ac(a.shape, e.shape);
      return i.length > 0 && (s = Ul(s, i)), Mi(s, a.shape);
    } };
  } }, Y2e = { kernelName: pU, inputsToSave: ["a", "b"], gradFunc: function(e, t) {
    var r = pa(t, 2), n = r[0], a = r[1], o = $c(n.shape, a.shape), s = function() {
      var l = Hu(e, Mo(a, "float32")), u3 = Ac(n.shape, o);
      return u3.length > 0 ? Mi(Ul(l, u3), n.shape) : l;
    }, i = function() {
      var l = fi(e, Mo(n, "float32")), u3 = Ac(a.shape, o);
      u3.length > 0 && (l = Mi(Ul(l, u3), a.shape));
      var c = of2(a);
      return ld(Hu(l, Mo(c, "float32")));
    };
    return { a: s, b: i };
  } }, Z2e = { kernelName: uye, inputsToSave: ["x"], gradFunc: function(e, t) {
    var r = pa(t, 1), n = r[0];
    return { x: function() {
      return Hu(e, ld(of2(n)));
    } };
  } }, J2e = { kernelName: vye, inputsToSave: ["x"], gradFunc: function(e, t) {
    var r = pa(t, 1), n = r[0], a = fi(rD(n, 6), eD(n));
    return { x: function() {
      return fi(e, Mo(a, "float32"));
    } };
  } }, Q2e = { kernelName: cye, inputsToSave: ["x"], gradFunc: function(e, t) {
    var r = pa(t, 1), n = r[0];
    return { x: function() {
      return fi(e, Mo(eD(n), "float32"));
    } };
  } }, e_e = { kernelName: EU, inputsToSave: ["x"], gradFunc: function(e, t) {
    var r = pa(t, 1), n = r[0];
    return { x: function() {
      return Mi(e, n.shape);
    } };
  } }, t_e = { kernelName: pye, inputsToSave: ["images"], gradFunc: function(e, t, r) {
    var n = pa(t, 1), a = n[0], o = { dy: e, images: a }, s = function() {
      return Ga.runKernel(dye, o, r);
    };
    return { images: s };
  } }, r_e = { kernelName: fye, inputsToSave: ["images"], gradFunc: function(e, t, r) {
    var n = pa(t, 1), a = n[0], o = { dy: e, images: a }, s = function() {
      return Ga.runKernel(hye, o, r);
    };
    return { images: s };
  } };
  function n_e(e, t) {
    var r = La(e, "x", "reverse"), n = { x: r }, a = { dims: t };
    return Ga.runKernel(DU, n, a);
  }
  var a_e = vi({ reverse_: n_e });
  var i_e = { kernelName: DU, gradFunc: function(e, t, r) {
    var n = r.dims, a = Qm(n, e.shape);
    return { x: function() {
      return a_e(e, a);
    } };
  } };
  var o_e = { kernelName: mye, gradFunc: function(e) {
    return { x: function() {
      return Mu(e);
    } };
  } }, s_e = { kernelName: CU, inputsToSave: ["x"], gradFunc: function(e, t) {
    var r = pa(t, 1), n = r[0];
    return { x: function() {
      return ld(Hu(e, fi(dV(n, 1.5), 2)));
    } };
  } };
  function l_e(e) {
    var t = La(e, "x", "logicalNot", "bool"), r = { x: t };
    return Ga.runKernel(H1e, r);
  }
  var u_e = vi({ logicalNot_: l_e }), c_e = { kernelName: MU, inputsToSave: ["condition"], gradFunc: function(e, t) {
    var r = pa(t, 1), n = r[0];
    return { condition: function() {
      return Mo(Mu(n), "float32");
    }, t: function() {
      return fi(e, Mo(n, e.dtype));
    }, e: function() {
      return fi(e, Mo(u_e(n), e.dtype));
    } };
  } };
  var f_e = 1.7580993408473768, h_e = 1.0507009873554805, p_e = { kernelName: gye, inputsToSave: ["x"], gradFunc: function(e, t) {
    var r = pa(t, 1), n = r[0];
    return { x: function() {
      var a = f2(n, af(0)), o = af(f_e), s = af(h_e), i = fi(e, s), l = fi(fi(e, o), uk(Mo(n, "float32")));
      return Zm(a, i, l);
    } };
  } }, d_e = { kernelName: OU, outputsToSave: [true], gradFunc: function(e, t) {
    var r = pa(t, 1), n = r[0];
    return { x: function() {
      return fi(e, fi(n, fp(af(1), n)));
    } };
  } };
  var v_e = { kernelName: yye, gradFunc: function(e) {
    return { x: function() {
      return Mu(e);
    } };
  } };
  function m_e(e) {
    var t = La(e, "x", "cos", "float32"), r = { x: t };
    return Ga.runKernel(cU, r);
  }
  var vV = vi({ cos_: m_e }), g_e = { kernelName: NU, inputsToSave: ["x"], gradFunc: function(e, t) {
    var r = pa(t, 1), n = r[0];
    return { x: function() {
      return fi(vV(Mo(n, "float32")), e);
    } };
  } };
  function y_e(e) {
    var t = La(e, "x", "cosh", "float32"), r = { x: t };
    return Ga.runKernel(fU, r);
  }
  var x_e = vi({ cosh_: y_e }), b_e = { kernelName: FU, inputsToSave: ["x"], gradFunc: function(e, t) {
    var r = pa(t, 1), n = r[0];
    return { x: function() {
      return fi(x_e(Mo(n, "float32")), e);
    } };
  } };
  function __e(e, t, r) {
    r === void 0 && (r = 0);
    var n = La(e, "x", "pad");
    if (n.rank === 0) throw new Error("pad(scalar) is not defined. Pass non-scalar to pad");
    var a = { paddings: t, constantValue: r }, o = { x: n };
    return Ga.runKernel(AU, o, a);
  }
  var w_e = vi({ pad_: __e });
  function k_e(e, t, r) {
    var n, a = e.shape.length;
    typeof t == "number" ? n = bo([t], new Array(a - 1).fill(0)) : t.length < a ? n = t.concat(new Array(a - t.length).fill(0)) : n = t.slice(), n.forEach(function(s) {
      Ca(s !== -1, function() {
        return "slice() does not support negative begin indexing.";
      });
    });
    var o;
    return r == null ? o = new Array(a).fill(-1) : typeof r == "number" ? o = bo([r], new Array(a - 1).fill(-1)) : r.length < a ? o = r.concat(new Array(a - r.length).fill(-1)) : o = r, o = o.map(function(s, i) {
      return s >= 0 ? s : (Ca(s === -1, function() {
        return "Negative size values should be exactly -1 but got " + (s + " for the slice() size at index " + i + ".");
      }), e.shape[i] - n[i]);
    }), [n, o];
  }
  var T_e = { kernelName: IU, inputsToSave: ["x"], gradFunc: function(e, t, r) {
    for (var n = pa(t, 1), a = n[0], o = r.begin, s = r.size, i = a.shape, l = pa(k_e(a, o, s), 2), u3 = l[0], c = l[1], f = [], h = 0; h < e.rank; h++) f.push([u3[h], i[h] - u3[h] - c[h]]);
    return { x: function() {
      return w_e(e, f);
    } };
  } }, A_e = { kernelName: bye, outputsToSave: [true], gradFunc: function(e, t, r) {
    var n = pa(t, 1), a = n[0], o = r.dim, s = true, i = fi(e, a);
    return { logits: function() {
      return fp(i, fi(Ul(i, [o], s), a));
    } };
  } };
  function S_e(e) {
    var t = La(e, "x", "sigmoid", "float32"), r = { x: t };
    return Ga.runKernel(OU, r);
  }
  var E_e = vi({ sigmoid_: S_e }), D_e = { kernelName: xye, inputsToSave: ["x"], gradFunc: function(e, t) {
    var r = pa(t, 1), n = r[0];
    return { x: function() {
      return fi(e, E_e(n));
    } };
  } };
  function C_e(e, t, r) {
    var n = La(e, "x", "batchToSpaceND"), a = t.reduce(function(i, l) {
      return i * l;
    });
    Ca(n.rank >= 1 + t.length, function() {
      return "input rank is " + n.rank + " but should be > than blockShape.length " + t.length;
    }), Ca(r.length === t.length, function() {
      return "crops.length is " + r.length + " but should be equal to blockShape.length  " + t.length;
    }), Ca(n.shape[0] % a === 0, function() {
      return "input tensor batch is " + n.shape[0] + " but is not divisible by the product of " + ("the elements of blockShape " + t.join(" * ") + " === " + a);
    });
    var o = { x: n }, s = { blockShape: t, crops: r };
    return Ga.runKernel(oU, o, s);
  }
  var M_e = vi({ batchToSpaceND_: C_e });
  var FB = { kernelName: RU, gradFunc: function(e, t, r) {
    var n = r.blockShape, a = r.paddings;
    return { x: function() {
      return M_e(e, n, a);
    } };
  } };
  function I_e(e, t) {
    t === void 0 && (t = 0), Ca(e.length >= 1, function() {
      return "Pass at least one tensor to concat";
    });
    var r = iV(e, "tensors", "concat", "string_or_numeric");
    if (r[0].dtype === "complex64" && r.forEach(function(o) {
      if (o.dtype !== "complex64") throw new Error(`Cannot concatenate complex64 tensors with a tensor
          with dtype ` + o.dtype + ". ");
    }), r.length === 1) return uV(r[0]);
    var n = r, a = { axis: t };
    return Ga.runKernel(sU, n, a);
  }
  var N_e = vi({ concat_: I_e });
  var OB = { kernelName: zU, gradFunc: function(e, t, r) {
    var n = r.axis;
    return { x: function() {
      return N_e(e, n);
    } };
  } }, F_e = { kernelName: PU, inputsToSave: ["x"], gradFunc: function(e, t) {
    var r = pa(t, 1), n = r[0];
    return { x: function() {
      return Hu(e, fi(c2(Mo(n, "float32")), 2));
    } };
  } }, O_e = { kernelName: wye, inputsToSave: ["x"], gradFunc: function(e, t) {
    var r = pa(t, 1), n = r[0];
    return { x: function() {
      return fi(e, fi(Mo(n, "float32"), 2));
    } };
  } }, P_e = { kernelName: _ye, inputsToSave: ["a", "b"], gradFunc: function(e, t) {
    var r = pa(t, 2), n = r[0], a = r[1], o = af(2), s = function() {
      return fi(e, fi(o, fp(n, a)));
    }, i = function() {
      return fi(e, fi(o, fp(a, n)));
    };
    return { a: s, b: i };
  } };
  var L_e = { kernelName: GU, gradFunc: function(e) {
    return { x: function() {
      return Mu(e);
    } };
  } }, R_e = { kernelName: BU, inputsToSave: ["a", "b"], gradFunc: function(e, t) {
    var r = pa(t, 2), n = r[0], a = r[1], o = $c(n.shape, a.shape), s = function() {
      var l = e, u3 = Ac(n.shape, o);
      return u3.length > 0 && (l = Ul(l, u3)), Mi(l, n.shape);
    }, i = function() {
      var l = e, u3 = Ac(a.shape, o);
      return u3.length > 0 && (l = Ul(l, u3)), Mi(ld(l), a.shape);
    };
    return { a: s, b: i };
  } }, z_e = { kernelName: LU, inputsToSave: ["x"], gradFunc: function(e, t, r) {
    var n = pa(t, 1), a = n[0], o = a.shape.slice(), s = r.axis, i = Qm(s, a.shape);
    i.forEach(function(c) {
      o[c] = 1;
    });
    var l = Mi(e, o), u3 = fi(l, ck(a.shape, "float32"));
    return { x: function() {
      return u3;
    } };
  } }, B_e = { kernelName: kye, inputsToSave: ["x"], gradFunc: function(e, t) {
    var r = pa(t, 1), n = r[0];
    return { x: function() {
      return Hu(e, of2(vV(n)));
    } };
  } }, U_e = { kernelName: Tye, outputsToSave: [true], gradFunc: function(e, t) {
    var r = pa(t, 1), n = r[0];
    return { x: function() {
      return fi(fp(af(1), of2(n)), e);
    } };
  } }, V_e = { kernelName: G5, inputsToSave: ["x"], gradFunc: function(e, t, r) {
    var n = pa(t, 1), a = n[0], o = r.reps, s = function() {
      var i = Mu(a);
      if (a.rank === 1) for (var l = 0; l < o[0]; ++l) i = Vd(i, hy(e, [l * a.shape[0]], [a.shape[0]]));
      else if (a.rank === 2) for (var l = 0; l < o[0]; ++l) for (var u3 = 0; u3 < o[1]; ++u3) i = Vd(i, hy(e, [l * a.shape[0], u3 * a.shape[1]], [a.shape[0], a.shape[1]]));
      else if (a.rank === 3) for (var l = 0; l < o[0]; ++l) for (var u3 = 0; u3 < o[1]; ++u3) for (var c = 0; c < o[2]; ++c) i = Vd(i, hy(e, [l * a.shape[0], u3 * a.shape[1], c * a.shape[2]], [a.shape[0], a.shape[1], a.shape[2]]));
      else if (a.rank === 4) for (var l = 0; l < o[0]; ++l) for (var u3 = 0; u3 < o[1]; ++u3) for (var c = 0; c < o[2]; ++c) for (var f = 0; f < o[3]; ++f) i = Vd(i, hy(e, [l * a.shape[0], u3 * a.shape[1], c * a.shape[2], f * a.shape[3]], [a.shape[0], a.shape[1], a.shape[2], a.shape[3]]));
      else throw new Error("Gradient for tile operation is not implemented for rank-" + (a.rank + " tensors yet."));
      return i;
    };
    return { x: s };
  } };
  var j_e = { kernelName: UU, gradFunc: function(e, t, r) {
    var n = r, a = n.perm, o = fV(a);
    return { x: function() {
      return Q3(e, o);
    } };
  } };
  function W_e(e, t) {
    t === void 0 && (t = 0);
    var r = iV(e, "tensors", "stack", "string_or_numeric");
    Ca(r.length >= 1, function() {
      return "Pass at least one tensor to tf.stack";
    }), r.length > 0 && Ca(t <= r[0].rank, function() {
      return "Axis must be <= rank of the tensor";
    });
    var n = r, a = { axis: t };
    return Ga.runKernel(TU, n, a);
  }
  var G_e = vi({ stack_: W_e });
  var $_e = { kernelName: VU, gradFunc: function(e, t, r) {
    var n = r, a = n.axis;
    return { value: function() {
      return G_e(e, a);
    } };
  } };
  function H_e(e, t) {
    t === void 0 && (t = 0);
    var r = La(e, "x", "expandDims", "string_or_numeric");
    Ca(t <= r.rank, function() {
      return "Axis must be <= rank of the tensor";
    });
    var n = { input: r }, a = { dim: t };
    return Ga.runKernel(vU, n, a);
  }
  var q_e = vi({ expandDims_: H_e });
  function X_e(e, t, r, n) {
    r === void 0 && (r = 0), n === void 0 && (n = 0);
    var a = La(e, "x", "gather"), o = La(t, "indices", "gather", "int32"), s = { x: a, indices: o }, i = { axis: r, batchDims: n };
    return Ga.runKernel(yU, s, i);
  }
  var K_e = vi({ gather_: X_e });
  function Y_e(e, t) {
    var r, n = La(e, "a", "maximum"), a = La(t, "b", "maximum");
    r = pa(Ih(n, a), 2), n = r[0], a = r[1], n.dtype === "bool" && (n = Mo(n, "int32"), a = Mo(a, "int32")), $c(n.shape, a.shape);
    var o = { a: n, b: a };
    return Ga.runKernel(_U, o);
  }
  var Z_e = vi({ maximum_: Y_e }), J_e = { kernelName: jU, inputsToSave: ["segmentIds"], gradFunc: function(e, t) {
    var r = pa(t, 1), n = r[0], a = function() {
      return Q_e(e, n);
    };
    return { x: a };
  } };
  function Q_e(e, t) {
    for (var r = Z_e(t, Mu(t)), n = K_e(e, r), a = tD(t, af(0, "int32")), o = n.rank - a.rank, s = 0; s < o; ++s) a = q_e(a, s + 1);
    a = lV(a, ck(n.shape, "bool"));
    var i = Mu(n);
    return Zm(a, n, i);
  }
  var ewe = { kernelName: WU, gradFunc: function(e) {
    return { x: function() {
      return Mu(e);
    } };
  } }, m5, PB, twe = [oV, Txe, Axe, Dxe, Cxe, Ixe, Nxe, Fxe, Pxe, Lxe, Rxe, zxe, jxe, $xe, qxe, Yxe, Zxe, Jxe, Qxe, obe, sbe, cbe, gbe, dbe, wbe, Abe, Dbe, Lbe, Vbe, jbe, Y2e, Wbe, $be, Hbe, qbe, Xbe, Ybe, Kbe, t2e, a2e, i2e, o2e, s2e, l2e, u2e, f2e, h2e, p2e, d2e, g2e, IB, IB, w2e, A2e, D2e, M2e, I2e, N2e, O2e, R2e, z2e, B2e, U2e, V2e, G2e, NB, NB, X2e, K2e, Z2e, J2e, Q2e, e_e, t_e, r_e, i_e, o_e, s_e, c_e, p_e, d_e, v_e, g_e, b_e, T_e, A_e, D_e, FB, FB, OB, OB, F_e, P_e, O_e, L_e, R_e, z_e, B_e, U_e, V_e, j_e, $_e, J_e, ewe];
  try {
    for (Qb = Qn(twe), ly = Qb.next(); !ly.done; ly = Qb.next()) LB = ly.value, jye(LB);
  } catch (e) {
    m5 = { error: e };
  } finally {
    try {
      ly && !ly.done && (PB = Qb.return) && PB.call(Qb);
    } finally {
      if (m5) throw m5.error;
    }
  }
  var LB, Qb, ly;
  var g5;
  function Wu() {
    return g5 == null && (g5 = ur.backend().epsilon()), g5;
  }
  function id() {
    return "channelsLast";
  }
  var wv = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r) || this;
      return Object.setPrototypeOf(n, t.prototype), n;
    }
    return t;
  }(Error), jd = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r) || this;
      return Object.setPrototypeOf(n, t.prototype), n;
    }
    return t;
  }(Error), en = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r) || this;
      return Object.setPrototypeOf(n, t.prototype), n;
    }
    return t;
  }(Error), ro = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r) || this;
      return Object.setPrototypeOf(n, t.prototype), n;
    }
    return t;
  }(Error), rwe = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r) || this;
      return Object.setPrototypeOf(n, t.prototype), n;
    }
    return t;
  }(Error);
  (function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r) || this;
      return Object.setPrototypeOf(n, t.prototype), n;
    }
    return t;
  })(Error);
  function Jm(e, t) {
    if (Array.isArray(e)) {
      for (var r = [], n = 0; n < t; n++) r = r.concat(e);
      return r;
    } else {
      var r = new Array(t);
      return r.fill(e), r;
    }
  }
  function Bd(e, t) {
    if (!e) throw new rwe(t);
  }
  function RB(e, t) {
    var r, n, a = 0;
    try {
      for (var o = Qn(e), s = o.next(); !s.done; s = o.next()) {
        var i = s.value;
        i === t && a++;
      }
    } catch (l) {
      r = { error: l };
    } finally {
      try {
        s && !s.done && (n = o.return) && n.call(o);
      } finally {
        if (r) throw r.error;
      }
    }
    return a;
  }
  function Nf(e) {
    return e.length === 1 ? e[0] : e;
  }
  function vl(e) {
    return Array.isArray(e) ? e : [e];
  }
  function _0(e) {
    var t = e.replace(/(.)([A-Z][a-z0-9]+)/g, "$1_$2"), r = t.replace(/([a-z])([A-Z])/g, "$1_$2").toLowerCase();
    return r[0] !== "_" ? r : "private" + r;
  }
  function qm(e) {
    return e.length <= 1 || e.indexOf("_") === -1 ? e : e.replace(/[_]+(\w|$)/g, function(t, r) {
      return r.toUpperCase();
    });
  }
  var op = {};
  function nD(e) {
    if (e == null) return null;
    var t = {};
    return t.className = e.getClassName(), t.config = e.getConfig(), t;
  }
  function I5(e) {
    var t, r;
    if (!(e == null || typeof e != "object")) if (Array.isArray(e)) e.forEach(function(l) {
      return I5(l);
    });
    else {
      var n = Object.keys(e);
      try {
        for (var a = Qn(n), o = a.next(); !o.done; o = a.next()) {
          var s = o.value, i = e[s];
          i != null && typeof i == "object" && (!Array.isArray(i) && i.type === "ndarray" && typeof i.value == "number" ? e[s] = i.value : I5(i));
        }
      } catch (l) {
        t = { error: l };
      } finally {
        try {
          o && !o.done && (r = a.return) && r.call(a);
        } finally {
          if (t) throw t.error;
        }
      }
    }
  }
  function h2(e, t, r, n, a) {
    var o, s, i, l, u3, c, f, h, p, d, v;
    if (t === void 0 && (t = {}), r === void 0 && (r = {}), n === void 0 && (n = "object"), a === void 0 && (a = false), typeof e == "string") {
      var m = e, g = void 0;
      if (m in r) g = r[m];
      else if (m in op) g = op[m];
      else if (g = t[m], g == null) throw new en("Unknown " + n + ": " + e + `. This may be due to one of the following reasons:
` + ("1. The " + n + " is defined in Python, in which ") + `case it needs to be ported to TensorFlow.js or your JavaScript code.
` + ("2. The custom " + n + " is defined in JavaScript, ") + "but is not registered properly with tf.serialization.registerClass().");
      return g;
    } else {
      var x = e;
      if (x.className == null || x.config == null) throw new en(n + ": Improper config format: " + (JSON.stringify(x) + `.
`) + "'className' and 'config' must set.");
      var b = x.className, y = void 0, w = void 0;
      if (b in r ? (o = pa(r[b], 2), y = o[0], w = o[1]) : b in op ? (s = pa(op.className, 2), y = s[0], w = s[1]) : b in t && (i = pa(t[b], 2), y = i[0], w = i[1]), y == null) throw new en("Unknown " + n + ": " + b + `. This may be due to one of the following reasons:
` + ("1. The " + n + " is defined in Python, in which ") + `case it needs to be ported to TensorFlow.js or your JavaScript code.
` + ("2. The custom " + n + " is defined in JavaScript, ") + "but is not registered properly with tf.serialization.registerClass().");
      if (w != null) {
        var _4 = {};
        try {
          for (var k = Qn(Object.keys(op)), T2 = k.next(); !T2.done; T2 = k.next()) {
            var A2 = T2.value;
            _4[A2] = op[A2];
          }
        } catch (V2) {
          l = { error: V2 };
        } finally {
          try {
            T2 && !T2.done && (u3 = k.return) && u3.call(k);
          } finally {
            if (l) throw l.error;
          }
        }
        try {
          for (var S2 = Qn(Object.keys(r)), C2 = S2.next(); !C2.done; C2 = S2.next()) {
            var A2 = C2.value;
            _4[A2] = r[A2];
          }
        } catch (V2) {
          c = { error: V2 };
        } finally {
          try {
            C2 && !C2.done && (f = S2.return) && f.call(S2);
          } finally {
            if (c) throw c.error;
          }
        }
        var E2 = x.config;
        E2.customObjects = _4;
        var F13 = Object.assign({}, op);
        try {
          for (var N2 = Qn(Object.keys(r)), D2 = N2.next(); !D2.done; D2 = N2.next()) {
            var A2 = D2.value;
            op[A2] = r[A2];
          }
        } catch (V2) {
          h = { error: V2 };
        } finally {
          try {
            D2 && !D2.done && (p = N2.return) && p.call(N2);
          } finally {
            if (h) throw h.error;
          }
        }
        I5(x.config);
        var I2 = w(y, x.config, r, a);
        return op = Object.assign({}, F13), I2;
      } else {
        var F13 = Object.assign({}, op);
        try {
          for (var O2 = Qn(Object.keys(r)), L2 = O2.next(); !L2.done; L2 = O2.next()) {
            var A2 = L2.value;
            op[A2] = r[A2];
          }
        } catch (X2) {
          d = { error: X2 };
        } finally {
          try {
            L2 && !L2.done && (v = O2.return) && v.call(O2);
          } finally {
            if (d) throw d.error;
          }
        }
        var I2 = new y(x.config);
        return op = Object.assign({}, F13), I2;
      }
    }
  }
  function nwe(e, t) {
    return e < t ? -1 : e > t ? 1 : 0;
  }
  function W3(e, t) {
    return -1 * nwe(e, t);
  }
  function kv(e) {
    var t, r;
    if (e == null) return e;
    var n = [];
    try {
      for (var a = Qn(e), o = a.next(); !o.done; o = a.next()) {
        var s = o.value;
        n.indexOf(s) === -1 && n.push(s);
      }
    } catch (i) {
      t = { error: i };
    } finally {
      try {
        o && !o.done && (r = a.return) && r.call(a);
      } finally {
        if (t) throw t.error;
      }
    }
    return n;
  }
  function awe(e) {
    if (e == null) throw new en("Invalid value in obj: " + JSON.stringify(e));
    for (var t in e) if (e.hasOwnProperty(t)) return false;
    return true;
  }
  function rg(e, t, r) {
    if (r != null && e.indexOf(r) < 0) throw new en(r + " is not a valid " + t + ".  Valid values are " + e + " or null/undefined.");
  }
  function aD(e, t, r, n) {
    return r === void 0 && (r = 0), n === void 0 && (n = 1 / 0), Bd(r >= 0), Bd(n >= r), Array.isArray(e) && e.length >= r && e.length <= n && e.every(function(a) {
      return typeof a === t;
    });
  }
  function cc(e, t) {
    Array.isArray(e) ? (ur.util.assert(e.length > 0, function() {
      return t + " is unexpectedly an empty array.";
    }), e.forEach(function(r, n) {
      return cc(r, "element " + (n + 1) + " of " + t);
    })) : ur.util.assert(Number.isInteger(e) && e > 0, function() {
      return "Expected " + t + " to be a positive integer, but got " + (mV(e) + ".");
    });
  }
  function mV(e) {
    return e === null ? "null" : Array.isArray(e) ? "[" + e.map(function(t) {
      return mV(t);
    }).join(",") + "]" : typeof e == "string" ? '"' + e + '"' : "" + e;
  }
  function iwe(e, t, r) {
    var n = r != null ? r() : ur.util.now(), a, o = function() {
      for (var s = [], i = 0; i < arguments.length; i++) s[i] = arguments[i];
      var l = r != null ? r() : ur.util.now();
      return l - n < t || (n = l, a = e.apply(void 0, bo(s))), a;
    };
    return o;
  }
  function gV(e) {
    return e === "relu" ? "relu" : e === "linear" ? "linear" : e === "elu" ? "elu" : null;
  }
  function iD(e, t) {
    return ur.tidy(function() {
      return Wt.sqrt(Wt.sum(Wt.mul(e, e), t, true));
    });
  }
  var p2 = function(e) {
    Hn(t, e);
    function t() {
      return e !== null && e.apply(this, arguments) || this;
    }
    return t.prototype.getConfig = function() {
      return {};
    }, t;
  }(ur.serialization.Serializable), oD = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this) || this;
      return n.defaultMaxValue = 2, n.defaultAxis = 0, n.maxValue = r.maxValue != null ? r.maxValue : n.defaultMaxValue, n.axis = r.axis != null ? r.axis : n.defaultAxis, n;
    }
    return t.prototype.apply = function(r) {
      var n = this;
      return ur.tidy(function() {
        var a = iD(r, n.axis), o = Wt.clipByValue(a, 0, n.maxValue);
        return Wt.mul(r, Wt.div(o, Wt.add(Wu(), a)));
      });
    }, t.prototype.getConfig = function() {
      return { maxValue: this.maxValue, axis: this.axis };
    }, t;
  }(p2);
  oD.className = "MaxNorm";
  ur.serialization.registerClass(oD);
  var sD = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this) || this;
      return n.defaultAxis = 0, n.axis = r.axis != null ? r.axis : n.defaultAxis, n;
    }
    return t.prototype.apply = function(r) {
      var n = this;
      return ur.tidy(function() {
        return Wt.div(r, Wt.add(Wu(), iD(r, n.axis)));
      });
    }, t.prototype.getConfig = function() {
      return { axis: this.axis };
    }, t;
  }(p2);
  sD.className = "UnitNorm";
  ur.serialization.registerClass(sD);
  var lD = function(e) {
    Hn(t, e);
    function t() {
      return e !== null && e.apply(this, arguments) || this;
    }
    return t.prototype.apply = function(r) {
      return Wt.relu(r);
    }, t;
  }(p2);
  lD.className = "NonNeg";
  ur.serialization.registerClass(lD);
  var uD = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this) || this;
      return n.defaultMinValue = 0, n.defaultMaxValue = 1, n.defaultRate = 1, n.defaultAxis = 0, n.minValue = r.minValue != null ? r.minValue : n.defaultMinValue, n.maxValue = r.maxValue != null ? r.maxValue : n.defaultMaxValue, n.rate = r.rate != null ? r.rate : n.defaultRate, n.axis = r.axis != null ? r.axis : n.defaultAxis, n;
    }
    return t.prototype.apply = function(r) {
      var n = this;
      return ur.tidy(function() {
        var a = iD(r, n.axis), o = Wt.add(Wt.mul(n.rate, Wt.clipByValue(a, n.minValue, n.maxValue)), Wt.mul(1 - n.rate, a));
        return Wt.mul(r, Wt.div(o, Wt.add(Wu(), a)));
      });
    }, t.prototype.getConfig = function() {
      return { minValue: this.minValue, maxValue: this.maxValue, rate: this.rate, axis: this.axis };
    }, t;
  }(p2);
  uD.className = "MinMaxNorm";
  ur.serialization.registerClass(uD);
  var zB = { maxNorm: "MaxNorm", minMaxNorm: "MinMaxNorm", nonNeg: "NonNeg", unitNorm: "UnitNorm" };
  function Gu(e) {
    return nD(e);
  }
  function BB(e, t) {
    return t === void 0 && (t = {}), h2(e, ur.serialization.SerializationMap.getMap().classNameMap, t, "constraint");
  }
  function $u(e) {
    if (e == null) return null;
    if (typeof e == "string") {
      var t = e in zB ? zB[e] : e, r = { className: t, config: {} };
      return BB(r);
    } else return e instanceof p2 ? e : BB(e);
  }
  function owe(e) {
    return new oD(e);
  }
  function swe(e) {
    return new sD(e);
  }
  function lwe() {
    return new lD();
  }
  function uwe(e) {
    return new uD(e);
  }
  var cwe = { __proto__: null, maxNorm: owe, unitNorm: swe, nonNeg: lwe, minMaxNorm: uwe };
  var fwe = ["channelsFirst", "channelsLast"], hwe = ["nearest", "bilinear"], pwe = ["valid", "same", "causal"], dwe = ["max", "avg"], vwe = ["sum", "mul", "concat", "ave"];
  var uy = /* @__PURE__ */ new Map();
  function pu(e) {
    rg(fwe, "DataFormat", e);
  }
  function mwe(e) {
    rg(hwe, "InterpolationFormat", e);
  }
  function Nh(e) {
    rg(pwe, "PaddingMode", e);
  }
  function yV(e) {
    rg(dwe, "PoolMode", e);
  }
  var i2 = [], UB = "/";
  function Km(e, t) {
    i2.push(e);
    try {
      var r = t();
      return i2.pop(), r;
    } catch (n) {
      throw i2.pop(), n;
    }
  }
  function gwe() {
    return i2.length === 0 ? "" : i2.join(UB) + UB;
  }
  function xV(e) {
    if (!_V(e)) throw new Error("Not a valid tensor name: '" + e + "'");
    return gwe() + e;
  }
  function bV(e) {
    if (!_V(e)) throw new Error("Not a valid tensor name: '" + e + "'");
    uy.has(e) || uy.set(e, 0);
    var t = uy.get(e);
    if (uy.set(e, uy.get(e) + 1), t > 0) {
      var r = e + "_" + t;
      return uy.set(r, 1), r;
    } else return e;
  }
  var ywe = new RegExp(/^[A-Za-z0-9][-A-Za-z0-9\._\/]*$/);
  function _V(e) {
    return !!e.match(ywe);
  }
  function xwe(e) {
    return e === parseInt(e.toString(), 10);
  }
  function Tv(e, t, r) {
    t == null && (t = 0), r == null && (r = e.length);
    for (var n = 1, a = t; a < r; ++a) n *= e[a];
    return n;
  }
  function my(e) {
    if (e.length === 0) return Number.NaN;
    for (var t = Number.POSITIVE_INFINITY, r = 0; r < e.length; r++) {
      var n = e[r];
      n < t && (t = n);
    }
    return t;
  }
  function Av(e) {
    if (e.length === 0) return Number.NaN;
    for (var t = Number.NEGATIVE_INFINITY, r = 0; r < e.length; r++) {
      var n = e[r];
      n > t && (t = n);
    }
    return t;
  }
  function od(e, t) {
    if (t < e) throw new en("end (" + t + ") < begin (" + e + ") is forbidden.");
    for (var r = [], n = e; n < t; ++n) r.push(n);
    return r;
  }
  function fk(e, t) {
    return Wt.cast(e, t);
  }
  function d2(e, t) {
    t === void 0 && (t = -1);
    var r = e.shape.slice();
    return t < 0 && (t = r.length + t + 1), r.splice(t, 0, 1), Wt.reshape(e, r);
  }
  function bwe(e, t) {
    return ur.tidy(function() {
      if (e.shape.length !== 2) throw new en("repeat() expects a rank-2 tensor, but received a " + ("rank-" + e.shape.length + " tensor."));
      var r = d2(e, 1);
      return N5(r, [1, t, 1]);
    });
  }
  function _we(e) {
    var t = [Tv(e.shape)];
    return Wt.reshape(e, t);
  }
  function wwe(e) {
    if (e.rank <= 1) throw new en("batchFlatten requires a minimum rank of 2. Got rank: " + e.rank + ".");
    var t = [e.shape[0], Tv(e.shape, 1)];
    return Wt.reshape(e, t);
  }
  function Ym(e, t, r) {
    return ur.tidy(function() {
      switch (e.rank) {
        case 1:
          return Wt.slice1d(e, t, r);
        case 2:
          return Wt.slice2d(e, [t, 0], [r, e.shape[1]]);
        case 3:
          return Wt.slice3d(e, [t, 0, 0], [r, e.shape[1], e.shape[2]]);
        case 4:
          return Wt.slice4d(e, [t, 0, 0, 0], [r, e.shape[1], e.shape[2], e.shape[3]]);
        case 5:
          return Wt.slice(e, [t, 0, 0, 0, 0], [r, e.shape[1], e.shape[2], e.shape[3], e.shape[4]]);
        case 6:
          return Wt.slice(e, [t, 0, 0, 0, 0, 0], [r, e.shape[1], e.shape[2], e.shape[3], e.shape[4], e.shape[5]]);
        default:
          throw new en("sliceAlongFirstAxis() received an unsupported tensor rank: " + ("" + e.rank));
      }
    });
  }
  function y5(e, t, r) {
    return ur.tidy(function() {
      switch (e.rank) {
        case 1:
          return Wt.slice1d(e, t, r);
        case 2:
          return Wt.slice2d(e, [0, t], [e.shape[0], r]);
        case 3:
          return Wt.slice3d(e, [0, 0, t], [e.shape[0], e.shape[1], r]);
        case 4:
          return Wt.slice4d(e, [0, 0, 0, t], [e.shape[0], e.shape[1], e.shape[2], r]);
        default:
          throw new en("sliceAlongLastAxis() received an unsupported tensor rank: " + ("" + e.rank));
      }
    });
  }
  function G3(e, t, r, n) {
    return ur.tidy(function() {
      switch (e.rank) {
        case 1:
          return Wt.slice1d(e, t, r);
        case 2:
          switch (n) {
            case 1:
              return Ym(e, t, r);
            case 2:
              return y5(e, t, r);
            default:
              throw new en("The axis is not within the rank of the tensor " + ("" + n));
          }
        case 3:
          switch (n) {
            case 1:
              return Ym(e, t, r);
            case 2:
              return Wt.slice3d(e, [0, t, 0], [e.shape[0], r, e.shape[2]]);
            case 3:
              return y5(e, t, r);
            default:
              throw new en("The axis is not within the rank of the tensor " + ("" + n));
          }
        case 4:
          switch (n) {
            case 1:
              return Ym(e, t, r);
            case 2:
              return Wt.slice4d(e, [0, t, 0, 0], [e.shape[0], r, e.shape[2], e.shape[3]]);
            case 3:
              return Wt.slice4d(e, [0, 0, t, 0], [e.shape[0], e.shape[1], r, e.shape[3]]);
            case 4:
              return y5(e, t, r);
            default:
              throw new en("The axis is not within the rank of the tensor " + ("" + n));
          }
        default:
          throw new en("sliceAlongLastAxis() received an unsupported tensor rank: " + ("" + e.rank));
      }
    });
  }
  function cD(e, t) {
    t === void 0 && (t = -1);
    var r;
    return t < 0 && (r = e[0].rank, r !== 0 ? t = r : t = 0), t === e[0].rank && (t = -1), Wt.concat(e, t);
  }
  function VB(e, t) {
    switch (e.rank) {
      case 1:
        return Wt.concat1d([e, t]);
      case 2:
        return Wt.concat2d([e, t], 0);
      case 3:
        return Wt.concat3d([e, t], 0);
      case 4:
        return Wt.concat4d([e, t], 0);
      default:
        throw new en("concatAlongFirstAxis() received an unsupported " + ("tensor rank: " + e.rank));
    }
  }
  function N5(e, t) {
    if (Array.isArray(t) || (t = [t]), e.rank !== t.length) throw new en("The length of input n (" + t.length + ") does not match " + ("the number of dimensions in input x (" + e.rank + ")"));
    return Wt.tile(e, t);
  }
  function hk(e, t, r, n, a) {
    return t === void 0 && (t = 0), r === void 0 && (r = 1), Wt.randomNormal(e, t, r, n, a);
  }
  function Gd(e, t, r, n) {
    if (e.rank < 2 || t.rank < 2) throw new ro("dot requires both inputs to be rank >= 2" + (" but got x shape = " + e.shape + " and y shape = " + t.shape));
    if (t.rank >= 3) {
      var a = e.shape.slice(-1)[0], o = t.shape.slice(-2)[0];
      if (a !== o) throw new ro("If rank y >= 3, then the second last dim" + (" of y must equal the last dim of x but got x shape = " + e.shape + " and ") + (" y shape = " + t.shape));
    }
    if (e.rank === 2 && t.rank === 2) {
      var s = false, i = false;
      return Wt.fused.matMul({ a: e, b: t, transposeA: s, transposeB: i, bias: n ? F52(e.rank, n, id()) : null, activation: r });
    } else {
      var l = e.shape.slice(), u3 = l.pop();
      e = Wt.reshape(e, [-1, u3]);
      var c = t.shape.slice(), f = c.pop(), o = c.pop(), h = bo(c, [f]), p = Array.from({ length: t.rank }, function(x, b) {
        return b === 0 ? t.rank - 2 : b <= t.rank - 2 ? b - 1 : b;
      });
      t = Wt.reshape(Wt.transpose(t, p), [o, -1]);
      var d = bo(l, h), s = false, i = false;
      return Wt.reshape(Wt.fused.matMul({ a: e, b: t, transposeA: s, transposeB: i, bias: n ? F52(e.rank, n, id()) : null, activation: r }), d);
    }
  }
  function wV(e, t, r) {
    return ur.tidy(function() {
      return Array.isArray(t) ? t = ur.tensor1d(t, "int32") : t = Wt.cast(t, "int32"), Wt.gather(e, t, r);
    });
  }
  function v2(e) {
    return Wt.mul(e, e);
  }
  function F52(e, t, r) {
    var n = t.shape;
    if (t.rank !== 1 && t.rank !== e) throw new en("Unexpected bias dimensions: " + t.rank + ("; expected it to be 1 or " + e));
    if (e === 5) {
      if (r === "channelsFirst") return n.length === 1 ? Wt.reshape(t, [1, n[0], 1, 1, 1]) : Wt.reshape(t, [1, n[3], n[0], n[1], n[2]]);
      if (r === "channelsLast") return n.length === 1 ? Wt.reshape(t, [1, 1, 1, 1, n[0]]) : Wt.reshape(t, [1].concat(n));
    } else if (e === 4) {
      if (r === "channelsFirst") return n.length === 1 ? Wt.reshape(t, [1, n[0], 1, 1]) : Wt.reshape(t, [1, n[2], n[0], n[1]]);
      if (r === "channelsLast") return n.length === 1 ? Wt.reshape(t, [1, 1, 1, n[0]]) : Wt.reshape(t, [1].concat(n));
    } else if (e === 3) {
      if (r === "channelsFirst") return n.length === 1 ? Wt.reshape(t, [1, n[0], 1]) : Wt.reshape(t, [1, n[1], n[0]]);
      if (r === "channelsLast") return n.length === 1 ? Wt.reshape(t, [1, 1, n[0]]) : Wt.reshape(t, [1].concat(n));
    } else if (e < 3) return t;
    throw new en("Unsupported input rank by biasAdd: " + t.rank);
  }
  function ud(e, t, r) {
    return ur.tidy(function() {
      return r == null && (r = id()), pu(r), Wt.add(e, F52(e.rank, t, r));
    });
  }
  function kwe(e, t) {
    if (t === void 0 && (t = 1), t !== 1) throw new ro("Support for alpha values other than 1 (" + t + ") is not implemented yet.");
    return Wt.elu(e);
  }
  function Twe(e) {
    return ur.tidy(function() {
      return Wt.div(e, Wt.add(Wt.abs(e), 1));
    });
  }
  function kV(e, t, r, n) {
    return ur.tidy(function() {
      return Wt.dropout(e, t, r, n);
    });
  }
  function Awe(e) {
    return ur.tidy(function() {
      var t = Wt.add(0.5, Wt.mul(0.2, e));
      return Wt.clipByValue(t, 0, 1);
    });
  }
  function m2(e, t, r) {
    return r === void 0 && (r = false), r ? e() : t();
  }
  var Swe = ["fanIn", "fanOut", "fanAvg"], Ewe = ["normal", "uniform", "truncatedNormal"];
  function Dwe(e) {
    rg(Swe, "FanMode", e);
  }
  function Cwe(e) {
    rg(Ewe, "Distribution", e);
  }
  var hp = function(e) {
    Hn(t, e);
    function t() {
      return e !== null && e.apply(this, arguments) || this;
    }
    return t.prototype.fromConfigUsesCustomObjects = function() {
      return false;
    }, t.prototype.getConfig = function() {
      return {};
    }, t;
  }(ur.serialization.Serializable), fD = function(e) {
    Hn(t, e);
    function t() {
      return e !== null && e.apply(this, arguments) || this;
    }
    return t.prototype.apply = function(r, n) {
      return ur.zeros(r, n);
    }, t;
  }(hp);
  fD.className = "Zeros";
  ur.serialization.registerClass(fD);
  var pk = function(e) {
    Hn(t, e);
    function t() {
      return e !== null && e.apply(this, arguments) || this;
    }
    return t.prototype.apply = function(r, n) {
      return ur.ones(r, n);
    }, t;
  }(hp);
  pk.className = "Ones";
  ur.serialization.registerClass(pk);
  var hD = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this) || this;
      if (typeof r != "object") throw new en("Expected argument of type ConstantConfig but got " + r);
      if (r.value === void 0) throw new en("config must have value set but got " + r);
      return n.value = r.value, n;
    }
    return t.prototype.apply = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        return ur.mul(ur.scalar(a.value), ur.ones(r, n));
      });
    }, t.prototype.getConfig = function() {
      return { value: this.value };
    }, t;
  }(hp);
  hD.className = "Constant";
  ur.serialization.registerClass(hD);
  var pD = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this) || this;
      return n.DEFAULT_MINVAL = -0.05, n.DEFAULT_MAXVAL = 0.05, n.minval = r.minval || n.DEFAULT_MINVAL, n.maxval = r.maxval || n.DEFAULT_MAXVAL, n.seed = r.seed, n;
    }
    return t.prototype.apply = function(r, n) {
      return ur.randomUniform(r, this.minval, this.maxval, n);
    }, t.prototype.getConfig = function() {
      return { minval: this.minval, maxval: this.maxval, seed: this.seed };
    }, t;
  }(hp);
  pD.className = "RandomUniform";
  ur.serialization.registerClass(pD);
  var dD = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this) || this;
      return n.DEFAULT_MEAN = 0, n.DEFAULT_STDDEV = 0.05, n.mean = r.mean || n.DEFAULT_MEAN, n.stddev = r.stddev || n.DEFAULT_STDDEV, n.seed = r.seed, n;
    }
    return t.prototype.apply = function(r, n) {
      if (n = n || "float32", n !== "float32" && n !== "int32") throw new ro("randomNormal does not support dType " + n + ".");
      return hk(r, this.mean, this.stddev, n, this.seed);
    }, t.prototype.getConfig = function() {
      return { mean: this.mean, stddev: this.stddev, seed: this.seed };
    }, t;
  }(hp);
  dD.className = "RandomNormal";
  ur.serialization.registerClass(dD);
  var vD = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this) || this;
      return n.DEFAULT_MEAN = 0, n.DEFAULT_STDDEV = 0.05, n.mean = r.mean || n.DEFAULT_MEAN, n.stddev = r.stddev || n.DEFAULT_STDDEV, n.seed = r.seed, n;
    }
    return t.prototype.apply = function(r, n) {
      if (n = n || "float32", n !== "float32" && n !== "int32") throw new ro("truncatedNormal does not support dType " + n + ".");
      return ur.truncatedNormal(r, this.mean, this.stddev, n, this.seed);
    }, t.prototype.getConfig = function() {
      return { mean: this.mean, stddev: this.stddev, seed: this.seed };
    }, t;
  }(hp);
  vD.className = "TruncatedNormal";
  ur.serialization.registerClass(vD);
  var mD = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this) || this;
      return n.gain = r.gain != null ? r.gain : 1, n;
    }
    return t.prototype.apply = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        if (r.length !== 2 || r[0] !== r[1]) throw new en("Identity matrix initializer can only be used for 2D square matrices.");
        return ur.mul(a.gain, ur.eye(r[0]));
      });
    }, t.prototype.getConfig = function() {
      return { gain: this.gain };
    }, t;
  }(hp);
  mD.className = "Identity";
  ur.serialization.registerClass(mD);
  function Mwe(e, t) {
    t === void 0 && (t = "channelsLast");
    var r, n;
    if (pu(t), e.length === 2) r = e[0], n = e[1];
    else if ([3, 4, 5].indexOf(e.length) !== -1) {
      if (t === "channelsFirst") {
        var a = Tv(e, 2);
        r = e[1] * a, n = e[0] * a;
      } else if (t === "channelsLast") {
        var a = Tv(e, 0, e.length - 2);
        r = e[e.length - 2] * a, n = e[e.length - 1] * a;
      }
    } else {
      var o = Tv(e);
      r = Math.sqrt(o), n = Math.sqrt(o);
    }
    return [r, n];
  }
  var Ff = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this) || this;
      if (r.scale < 0) throw new en("scale must be a positive float. Got: " + r.scale);
      return n.scale = r.scale == null ? 1 : r.scale, n.mode = r.mode == null ? "fanIn" : r.mode, Dwe(n.mode), n.distribution = r.distribution == null ? "normal" : r.distribution, Cwe(n.distribution), n.seed = r.seed, n;
    }
    return t.prototype.apply = function(r, n) {
      var a = Mwe(r), o = a[0], s = a[1], i = this.scale;
      if (this.mode === "fanIn" ? i /= Math.max(1, o) : this.mode === "fanOut" ? i /= Math.max(1, s) : i /= Math.max(1, (o + s) / 2), this.distribution === "normal") {
        var l = Math.sqrt(i);
        if (n = n || "float32", n !== "float32" && n !== "int32") throw new ro(this.getClassName() + " does not support dType " + n + ".");
        return ur.truncatedNormal(r, 0, l, n, this.seed);
      } else {
        var u3 = Math.sqrt(3 * i);
        return ur.randomUniform(r, -u3, u3, n);
      }
    }, t.prototype.getConfig = function() {
      return { scale: this.scale, mode: this.mode, distribution: this.distribution, seed: this.seed };
    }, t;
  }(hp);
  Ff.className = "VarianceScaling";
  ur.serialization.registerClass(Ff);
  var dk = function(e) {
    Hn(t, e);
    function t(r) {
      return e.call(this, { scale: 1, mode: "fanAvg", distribution: "uniform", seed: r == null ? null : r.seed }) || this;
    }
    return t.prototype.getClassName = function() {
      return Ff.className;
    }, t;
  }(Ff);
  dk.className = "GlorotUniform";
  ur.serialization.registerClass(dk);
  var vk = function(e) {
    Hn(t, e);
    function t(r) {
      return e.call(this, { scale: 1, mode: "fanAvg", distribution: "normal", seed: r == null ? null : r.seed }) || this;
    }
    return t.prototype.getClassName = function() {
      return Ff.className;
    }, t;
  }(Ff);
  vk.className = "GlorotNormal";
  ur.serialization.registerClass(vk);
  var mk = function(e) {
    Hn(t, e);
    function t(r) {
      return e.call(this, { scale: 2, mode: "fanIn", distribution: "normal", seed: r == null ? null : r.seed }) || this;
    }
    return t.prototype.getClassName = function() {
      return Ff.className;
    }, t;
  }(Ff);
  mk.className = "HeNormal";
  ur.serialization.registerClass(mk);
  var gk = function(e) {
    Hn(t, e);
    function t(r) {
      return e.call(this, { scale: 2, mode: "fanIn", distribution: "uniform", seed: r == null ? null : r.seed }) || this;
    }
    return t.prototype.getClassName = function() {
      return Ff.className;
    }, t;
  }(Ff);
  gk.className = "HeUniform";
  ur.serialization.registerClass(gk);
  var yk = function(e) {
    Hn(t, e);
    function t(r) {
      return e.call(this, { scale: 1, mode: "fanIn", distribution: "normal", seed: r == null ? null : r.seed }) || this;
    }
    return t.prototype.getClassName = function() {
      return Ff.className;
    }, t;
  }(Ff);
  yk.className = "LeCunNormal";
  ur.serialization.registerClass(yk);
  var xk = function(e) {
    Hn(t, e);
    function t(r) {
      return e.call(this, { scale: 1, mode: "fanIn", distribution: "uniform", seed: r == null ? null : r.seed }) || this;
    }
    return t.prototype.getClassName = function() {
      return Ff.className;
    }, t;
  }(Ff);
  xk.className = "LeCunNormal";
  ur.serialization.registerClass(xk);
  var gD = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this) || this;
      if (n.DEFAULT_GAIN = 1, n.gain = r.gain == null ? n.DEFAULT_GAIN : r.gain, n.seed = r.seed, n.seed != null) throw new ro("Random seed is not implemented for Orthogonal Initializer yet.");
      return n;
    }
    return t.prototype.apply = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        if (r.length < 2) throw new ro("Shape must be at least 2D.");
        r[0] * r[1] > 2e3 && console.warn("Orthogonal initializer is being called on a matrix with more " + ("than 2000 (" + r[0] * r[1] + ") elements: ") + "Slowness may result.");
        var o = r[0] > r[1] ? [r[1], r[0]] : r, s = hk(o, 0, 1, "float32"), i = ur.linalg.gramSchmidt(s);
        return r[0] > r[1] && (i = ur.transpose(i)), ur.mul(a.gain, i);
      });
    }, t.prototype.getConfig = function() {
      return { gain: this.gain, seed: this.seed };
    }, t;
  }(hp);
  gD.className = "Orthogonal";
  ur.serialization.registerClass(gD);
  var jB = { constant: "Constant", glorotNormal: "GlorotNormal", glorotUniform: "GlorotUniform", heNormal: "HeNormal", heUniform: "HeUniform", identity: "Identity", leCunNormal: "LeCunNormal", leCunUniform: "LeCunUniform", ones: "Ones", orthogonal: "Orthogonal", randomNormal: "RandomNormal", randomUniform: "RandomUniform", truncatedNormal: "TruncatedNormal", varianceScaling: "VarianceScaling", zeros: "Zeros" };
  function WB(e, t) {
    return t === void 0 && (t = {}), h2(e, ur.serialization.SerializationMap.getMap().classNameMap, t, "initializer");
  }
  function Vl(e) {
    return nD(e);
  }
  function Il(e) {
    if (typeof e == "string") {
      var t = e in jB ? jB[e] : e;
      if (t === "GlorotNormal") return new vk();
      if (t === "GlorotUniform") return new dk();
      if (t === "HeNormal") return new mk();
      if (t === "HeUniform") return new gk();
      if (t === "LeCunNormal") return new yk();
      if (t === "LeCunUniform") return new xk();
      var r = {};
      return r.className = t, r.config = {}, WB(r);
    } else return e instanceof hp ? e : WB(e);
  }
  function Iwe() {
    return new fD();
  }
  function Nwe() {
    return new pk();
  }
  function Fwe(e) {
    return new hD(e);
  }
  function Owe(e) {
    return new pD(e);
  }
  function Pwe(e) {
    return new dD(e);
  }
  function Lwe(e) {
    return new vD(e);
  }
  function Rwe(e) {
    return new mD(e);
  }
  function zwe(e) {
    return new Ff(e);
  }
  function Bwe(e) {
    return new dk(e);
  }
  function Uwe(e) {
    return new vk(e);
  }
  function Vwe(e) {
    return new mk(e);
  }
  function jwe(e) {
    return new gk(e);
  }
  function Wwe(e) {
    return new yk(e);
  }
  function Gwe(e) {
    return new xk(e);
  }
  function $we(e) {
    return new gD(e);
  }
  var Hwe = { __proto__: null, zeros: Iwe, ones: Nwe, constant: Fwe, randomUniform: Owe, randomNormal: Pwe, truncatedNormal: Lwe, identity: Rwe, varianceScaling: zwe, glorotUniform: Bwe, glorotNormal: Uwe, heNormal: Vwe, heUniform: jwe, leCunNormal: Wwe, leCunUniform: Gwe, orthogonal: $we };
  var qwe = 0;
  function TV() {
    return qwe++;
  }
  var $3 = {};
  function bk(e) {
    return e === void 0 && (e = ""), e in $3 || ($3[e] = 0), $3[e] += 1, e + $3[e].toString();
  }
  function O5(e) {
    return Array.isArray(e) && Array.isArray(e[0]);
  }
  function tk(e) {
    return e.length === 0 ? [] : Array.isArray(e[0]) ? e : [e];
  }
  function no(e) {
    var t;
    if (Array.isArray(e)) {
      if (e.length !== 1) throw new en("Expected Tensor length to be 1; got " + e.length);
      t = e[0];
    } else t = e;
    return t;
  }
  function bs(e) {
    if (Array.isArray(e) && Array.isArray(e[0])) {
      if (e.length === 1) return e = e, e[0];
      throw new en("Expected exactly 1 Shape; got " + e.length);
    } else return e;
  }
  function rk(e) {
    var t, r, n = 0;
    try {
      for (var a = Qn(e), o = a.next(); !o.done; o = a.next()) {
        var s = o.value;
        s.shape.length === 0 ? n += 1 : n += s.shape.reduce(function(i, l) {
          return i * l;
        });
      }
    } catch (i) {
      t = { error: i };
    } finally {
      try {
        o && !o.done && (r = a.return) && r.call(a);
      } finally {
        if (t) throw t.error;
      }
    }
    return n;
  }
  var GB = "Variable", AV = function() {
    function e(t, r, n, a, o) {
      r === void 0 && (r = "float32"), n === void 0 && (n = GB), a === void 0 && (a = true), o === void 0 && (o = null), this.dtype = r ?? "float32", this.shape = t.shape, this.id = TV(), n = n ?? GB, this.originalName = xV(n), this.name = bV(this.originalName), this.trainable_ = a, this.constraint = o, this.val = Wt.variable(t, this.trainable_, this.name, this.dtype);
    }
    return e.prototype.read = function() {
      return this.assertNotDisposed(), this.val;
    }, e.prototype.write = function(t) {
      return this.assertNotDisposed(), Xwe(this.val, t), this.val.id !== t.id && (this.val.assign(t), this.constraint != null && this.val.assign(this.constraint.apply(this.val))), this;
    }, e.prototype.dispose = function() {
      this.assertNotDisposed(), this.val.dispose();
    }, e.prototype.assertNotDisposed = function() {
      if (this.val.isDisposed) throw new Error("LayersVariable " + this.name + " is already disposed.");
    }, Object.defineProperty(e.prototype, "trainable", { get: function() {
      return this.trainable_;
    }, set: function(t) {
      this.trainable_ = t, this.val.trainable = t;
    }, enumerable: true, configurable: true }), e;
  }();
  function Xwe(e, t) {
    if (e.shape.toString() !== t.shape.toString()) throw new Error("Shape mismatch: " + JSON.stringify(e.shape) + " vs. " + JSON.stringify(t.shape));
  }
  function P5(e) {
    return e.map(function(t) {
      return t.read();
    });
  }
  function yD(e) {
    e.forEach(function(t) {
      var r = t[0];
      r.write(t[1]);
    });
  }
  var Cu = /* @__PURE__ */ function() {
    function e(t) {
      this.dtype = t.dtype, this.shape = t.shape, t.shape != null ? this.ndim = t.shape.length : this.ndim = t.ndim, this.maxNDim = t.maxNDim, this.minNDim = t.minNDim, this.axes = t.axes || {};
    }
    return e;
  }(), rd = /* @__PURE__ */ function() {
    function e(t, r, n, a, o, s, i) {
      this.dtype = t, this.shape = r, this.sourceLayer = n, this.inputs = a, this.callArgs = o, this.outputTensorIndex = i, this.id = TV(), s != null && (this.originalName = xV(s), this.name = bV(this.originalName)), this.rank = r.length;
    }
    return e;
  }(), Kwe = 0, _k = function() {
    function e(t, r) {
      var n, a;
      this.callArgs = r, this.id = Kwe++, this.outboundLayer = t.outboundLayer, this.inboundLayers = t.inboundLayers, this.nodeIndices = t.nodeIndices, this.tensorIndices = t.tensorIndices, this.inputTensors = t.inputTensors, this.outputTensors = t.outputTensors, this.inputMasks = t.inputMasks, this.outputMasks = t.outputMasks, this.inputShapes = t.inputShapes, this.outputShapes = t.outputShapes;
      try {
        for (var o = Qn(t.inboundLayers), s = o.next(); !s.done; s = o.next()) {
          var i = s.value;
          i?.outboundNodes.push(this);
        }
      } catch (l) {
        n = { error: l };
      } finally {
        try {
          s && !s.done && (a = o.return) && a.call(o);
        } finally {
          if (n) throw n.error;
        }
      }
      t.outboundLayer.inboundNodes.push(this);
    }
    return e.prototype.getConfig = function() {
      var t, r, n = [];
      try {
        for (var a = Qn(this.inboundLayers), o = a.next(); !o.done; o = a.next()) {
          var s = o.value;
          s != null ? n.push(s.name) : n.push(null);
        }
      } catch (i) {
        t = { error: i };
      } finally {
        try {
          o && !o.done && (r = a.return) && r.call(a);
        } finally {
          if (t) throw t.error;
        }
      }
      return { outboundLayer: this.outboundLayer ? this.outboundLayer.name : null, inboundLayers: n, nodeIndices: this.nodeIndices, tensorIndices: this.tensorIndices };
    }, e;
  }(), Ywe = 0, Wo = function(e) {
    Hn(t, e);
    function t(r) {
      r === void 0 && (r = {});
      var n = e.call(this) || this;
      n._callHook = null, n._addedWeightNames = [], n._stateful = false, n.id = Ywe++, n.activityRegularizer = null, n.inputSpec = null, n.supportsMasking = false, n._trainableWeights = [], n._nonTrainableWeights = [], n._losses = [], n._updates = [], n._built = false, n.inboundNodes = [], n.outboundNodes = [];
      var a = r.name;
      if (!a) {
        var o = n.getClassName();
        a = _0(o) + "_" + bk(o);
      }
      if (n.name = a, n.trainable_ = r.trainable == null ? true : r.trainable, r.inputShape != null || r.batchInputShape != null) {
        var s = void 0;
        if (r.batchInputShape != null) s = r.batchInputShape;
        else if (r.inputShape != null) {
          var i = null;
          r.batchSize != null && (i = r.batchSize), s = [i].concat(r.inputShape);
        }
        n.batchInputShape = s;
        var l = r.dtype;
        l == null && (l = r.inputDType), l == null && (l = "float32"), n.dtype = l;
      }
      return r.weights != null ? n.initialWeights = r.weights : n.initialWeights = null, n._refCount = null, n.fastWeightInitDuringBuild = false, n;
    }
    return t.nodeKey = function(r, n) {
      return r.name + "_ib-" + n.toString();
    }, t.prototype.getNodeAtIndex = function(r, n) {
      if (this.inboundNodes.length === 0) throw new jd("The layer has never been called " + ("and thus has no defined " + n + "."));
      if (this.inboundNodes.length <= r) throw new en("Asked to get " + n + " at node " + r + ", " + ("but the layer has only " + this.inboundNodes.length + " inbound nodes."));
      return this.inboundNodes[r];
    }, t.prototype.getInputAt = function(r) {
      return Nf(this.getNodeAtIndex(r, "input").inputTensors);
    }, t.prototype.getOutputAt = function(r) {
      return Nf(this.getNodeAtIndex(r, "output").outputTensors);
    }, Object.defineProperty(t.prototype, "input", { get: function() {
      if (this.inboundNodes.length > 1) throw new wv("Layer " + this.name + ' has multiple inbound nodes, hence the notion of "layer input" is ill-defined. Use `getInputAt(nodeIndex)` instead.');
      if (this.inboundNodes.length === 0) throw new wv("Layer " + this.name + " is not connected, no input to return.");
      return Nf(this.getNodeAtIndex(0, "input").inputTensors);
    }, enumerable: true, configurable: true }), Object.defineProperty(t.prototype, "output", { get: function() {
      if (this.inboundNodes.length === 0) throw new wv("Layer " + this.name + " has no inbound nodes.");
      if (this.inboundNodes.length > 1) throw new wv("Layer " + this.name + ' has multiple inbound nodes, hence the notion of "layer output" is ill-defined. Use `getOutputAt(nodeIndex)` instead.');
      return Nf(this.getNodeAtIndex(0, "output").outputTensors);
    }, enumerable: true, configurable: true }), Object.defineProperty(t.prototype, "losses", { get: function() {
      return this._losses;
    }, enumerable: true, configurable: true }), t.prototype.calculateLosses = function() {
      return this.losses.map(function(r) {
        return r();
      });
    }, Object.defineProperty(t.prototype, "updates", { get: function() {
      return this._updates;
    }, enumerable: true, configurable: true }), Object.defineProperty(t.prototype, "built", { get: function() {
      return this._built;
    }, set: function(r) {
      this._built = r;
    }, enumerable: true, configurable: true }), Object.defineProperty(t.prototype, "trainable", { get: function() {
      return this.trainable_;
    }, set: function(r) {
      this._trainableWeights.forEach(function(n) {
        return n.trainable = r;
      }), this.trainable_ = r;
    }, enumerable: true, configurable: true }), Object.defineProperty(t.prototype, "trainableWeights", { get: function() {
      return this.trainable_ ? this._trainableWeights.filter(function(r) {
        return r.trainable;
      }) : [];
    }, set: function(r) {
      this._trainableWeights = r;
    }, enumerable: true, configurable: true }), Object.defineProperty(t.prototype, "nonTrainableWeights", { get: function() {
      return this.trainable ? this._trainableWeights.filter(function(r) {
        return !r.trainable;
      }).concat(this._nonTrainableWeights) : this._trainableWeights.concat(this._nonTrainableWeights);
    }, set: function(r) {
      this._nonTrainableWeights = r;
    }, enumerable: true, configurable: true }), Object.defineProperty(t.prototype, "weights", { get: function() {
      return this.trainableWeights.concat(this.nonTrainableWeights);
    }, enumerable: true, configurable: true }), Object.defineProperty(t.prototype, "stateful", { get: function() {
      return this._stateful;
    }, enumerable: true, configurable: true }), t.prototype.resetStates = function() {
      if (!this.stateful) throw new Error("Cannot call the resetStates() method of a non-stateful Layer object.");
    }, t.prototype.assertInputCompatibility = function(r) {
      if (r = vl(r), !(this.inputSpec == null || this.inputSpec.length === 0)) {
        var n = vl(this.inputSpec);
        if (r.length !== n.length) throw new en("Layer " + this.name + " expects " + n.length + " inputs, " + ("but it received " + r.length + " input tensors. ") + ("Input received: " + r));
        for (var a = 0; a < r.length; a++) {
          var o = r[a], s = n[a];
          if (s != null) {
            var i = o.rank;
            if (s.ndim != null && i !== s.ndim) throw new en("Input " + a + " is incompatible with layer " + this.name + ": " + ("expected ndim=" + s.ndim + ", found ndim=" + i));
            if (s.maxNDim != null && i > s.maxNDim) throw new en("Input " + a + " is incompatible with layer " + this.name + (": expected max_ndim=" + s.maxNDim + ", found ndim=" + i));
            if (s.minNDim != null && i < s.minNDim) throw new en("Input " + a + " is incompatible with layer " + this.name + (": expected min_ndim=" + s.minNDim + ", found ndim=" + i + "."));
            if (s.dtype != null && o.dtype !== s.dtype) throw new en("Input " + a + " is incompatible with layer " + this.name + " " + (": expected dtype=" + s.dtype + ", found dtype=" + o.dtype + "."));
            if (s.axes) {
              var l = o.shape;
              for (var u3 in s.axes) {
                var c = Number(u3), f = s.axes[u3], h = c >= 0 ? l[c] : l[l.length + c];
                if (f != null && [f, null].indexOf(h) === -1) throw new en("Input " + a + " is incompatible with layer " + (this.name + ": expected axis " + c + " of input shape to ") + ("have value " + f + " but got shape " + l + "."));
              }
            }
            if (s.shape != null) for (var p = 0; p < s.shape.length; ++p) {
              var d = s.shape[p], v = o.shape[p];
              if (d != null && v != null && d !== v) throw new en("Input " + a + " is incompatible with layer " + (this.name + ": expected shape=" + s.shape + ", ") + ("found shape=" + o.shape + "."));
            }
          }
        }
      }
    }, t.prototype.call = function(r, n) {
      return r;
    }, t.prototype.invokeCallHook = function(r, n) {
      this._callHook != null && this._callHook(r, n);
    }, t.prototype.setCallHook = function(r) {
      this._callHook = r;
    }, t.prototype.clearCallHook = function() {
      this._callHook = null;
    }, t.prototype.apply = function(r, n) {
      var a, o, s, i, l = this;
      n = n || {}, this.assertNotDisposed();
      var u3 = vl(r), c = true;
      try {
        for (var f = Qn(u3), h = f.next(); !h.done; h = f.next()) {
          var p = h.value;
          if (!(p instanceof rd)) {
            c = false;
            break;
          }
        }
      } catch (g) {
        a = { error: g };
      } finally {
        try {
          h && !h.done && (o = f.return) && o.call(f);
        } finally {
          if (a) throw a.error;
        }
      }
      var d = true;
      try {
        for (var v = Qn(u3), m = v.next(); !m.done; m = v.next()) {
          var p = m.value;
          if (p instanceof rd) {
            d = false;
            break;
          }
        }
      } catch (g) {
        s = { error: g };
      } finally {
        try {
          m && !m.done && (i = v.return) && i.call(v);
        } finally {
          if (s) throw s.error;
        }
      }
      if (c === d) throw new en("Arguments to apply() must be all SymbolicTensors or all Tensors");
      return Km(this.name, function() {
        var g, x, b, y;
        if (!l.built) {
          l.assertInputCompatibility(r);
          var w = [];
          try {
            for (var _4 = Qn(vl(r)), k = _4.next(); !k.done; k = _4.next()) {
              var T2 = k.value;
              w.push(T2.shape);
            }
          } catch (L2) {
            g = { error: L2 };
          } finally {
            try {
              k && !k.done && (x = _4.return) && x.call(_4);
            } finally {
              if (g) throw g.error;
            }
          }
          l.build(Nf(w)), l.built = true, l.initialWeights && l.setWeights(l.initialWeights), l._refCount === null && d && (l._refCount = 1);
        }
        if (l.assertInputCompatibility(r), d) {
          var A2 = l.call(r, n), S2 = vl(A2), C2 = [];
          try {
            for (var E2 = Qn(S2), F13 = E2.next(); !F13.done; F13 = E2.next()) {
              var N2 = F13.value;
              u3.indexOf(N2) !== -1 && (N2 = N2.clone()), C2.push(N2);
            }
          } catch (L2) {
            b = { error: L2 };
          } finally {
            try {
              F13 && !F13.done && (y = E2.return) && y.call(E2);
            } finally {
              if (b) throw b.error;
            }
          }
          if (A2 = Nf(C2), l.activityRegularizer != null) throw new ro("Layer invocation in the presence of activity regularizer(s) is not supported yet.");
          return A2;
        } else {
          var D2 = Zwe(r), I2 = l.computeOutputShape(D2), A2 = void 0, O2 = Jwe(r);
          if (l.warnOnIncompatibleInputShape(Array.isArray(r) ? D2[0] : D2), I2 != null && I2.length > 0 && Array.isArray(I2[0]) ? A2 = I2.map(function(V2, W2) {
            return new rd(O2, V2, l, vl(r), n, l.name, W2);
          }) : A2 = new rd(O2, I2, l, vl(r), n, l.name), l.addInboundNode(r, A2, null, null, D2, I2, n), l._refCount++, l.activityRegularizer != null) throw new ro("Layer invocation in the presence of activity regularizer(s) is not supported yet.");
          return A2;
        }
      });
    }, t.prototype.warnOnIncompatibleInputShape = function(r) {
      if (this.batchInputShape != null) if (r.length !== this.batchInputShape.length) console.warn("The rank of the input tensor provided (shape: " + (JSON.stringify(r) + ") does not match that of the ") + ("batchInputShape (" + JSON.stringify(this.batchInputShape) + ") ") + ("of the layer " + this.name));
      else {
        var n = false;
        this.batchInputShape.forEach(function(a, o) {
          a != null && r[o] != null && r[o] !== a && (n = true);
        }), n && console.warn("The shape of the input tensor " + ("(" + JSON.stringify(r) + ") does not ") + ("match the expectation of layer " + this.name + ": ") + ("" + JSON.stringify(this.batchInputShape)));
      }
    }, Object.defineProperty(t.prototype, "outputShape", { get: function() {
      var r, n;
      if (this.inboundNodes == null || this.inboundNodes.length === 0) throw new wv("The layer " + this.name + " has never been called and thus has no defined output shape.");
      var a = [];
      try {
        for (var o = Qn(this.inboundNodes), s = o.next(); !s.done; s = o.next()) {
          var i = s.value, l = JSON.stringify(i.outputShapes);
          a.indexOf(l) === -1 && a.push(l);
        }
      } catch (c) {
        r = { error: c };
      } finally {
        try {
          s && !s.done && (n = o.return) && n.call(o);
        } finally {
          if (r) throw r.error;
        }
      }
      if (a.length === 1) {
        var u3 = this.inboundNodes[0].outputShapes;
        return Array.isArray(u3) && Array.isArray(u3[0]) && u3.length === 1 ? u3[0] : u3;
      } else throw new wv("The layer " + this.name + ' has multiple inbound nodes with different output shapes. Hence the notion of "output shape" is ill-defined for the layer.');
    }, enumerable: true, configurable: true }), t.prototype.countParams = function() {
      if (!this.built) throw new jd("You tried to call countParams() on " + this.name + ", but the layer is not built yet. Build it first by calling build(batchInputShape).");
      return rk(this.weights);
    }, t.prototype.build = function(r) {
      this.built = true;
    }, t.prototype.getWeights = function(r) {
      return r === void 0 && (r = false), P5(r ? this.trainableWeights : this.weights);
    }, t.prototype.setWeights = function(r) {
      var n = this;
      ur.tidy(function() {
        var a = n.weights;
        if (a.length !== r.length) throw new en('You called setWeights(weights) on layer "' + n.name + '" ' + ("with a weight list of length " + r.length + ", ") + ("but the layer was expecting " + a.length + " weights. ") + ("Provided weights: " + r + "..."));
        if (a.length !== 0) {
          for (var o = [], s = P5(a), i = 0; i < s.length; ++i) {
            var l = s[i], u3 = a[i], c = r[i];
            if (!ur.util.arraysEqual(l.shape, c.shape)) throw new en("Layer weight shape " + l.shape + " " + ("not compatible with provided weight shape " + c.shape));
            o.push([u3, c]);
          }
          yD(o);
        }
      });
    }, t.prototype.addWeight = function(r, n, a, o, s, i, l, u3) {
      if (this._addedWeightNames.indexOf(r) !== -1) throw new en("Duplicate weight name " + r + " for layer " + this.name);
      this._addedWeightNames.push(r), a == null && (a = "float32"), this.fastWeightInitDuringBuild && (o = u3 != null ? u3() : Il("zeros"));
      var c = o.apply(n, a), f = new AV(c, a, r, i, l);
      return c.dispose(), s != null && this.addLoss(function() {
        return s.apply(f.read());
      }), i == null && (i = true), i ? this._trainableWeights.push(f) : this._nonTrainableWeights.push(f), f;
    }, t.prototype.setFastWeightInitDuringBuild = function(r) {
      this.fastWeightInitDuringBuild = r;
    }, t.prototype.addLoss = function(r) {
      var n;
      r == null || Array.isArray(r) && r.length === 0 || (r = vl(r), this._losses !== void 0 && this._losses !== null && (n = this.losses).push.apply(n, bo(r)));
    }, t.prototype.computeOutputShape = function(r) {
      return r;
    }, t.prototype.computeMask = function(r, n) {
      var a = this;
      if (!this.supportsMasking) {
        if (n != null) if (Array.isArray(n)) n.forEach(function(o) {
          if (o != null) throw new TypeError("Layer " + a.name + " does not support masking, but was passed an inputMask.");
        });
        else throw new TypeError("Layer " + this.name + " does not support masking, but was passed an inputMask.");
        return null;
      }
      return n;
    }, t.prototype.addInboundNode = function(r, n, a, o, s, i, l) {
      var u3, c;
      l === void 0 && (l = null);
      var f = vl(r);
      n = vl(n), a = vl(a), o = vl(o), s = tk(s), i = tk(i);
      var h = [], p = [], d = [];
      try {
        for (var v = Qn(f), m = v.next(); !m.done; m = v.next()) {
          var g = m.value;
          h.push(g.sourceLayer), p.push(g.nodeIndex), d.push(g.tensorIndex);
        }
      } catch (b) {
        u3 = { error: b };
      } finally {
        try {
          m && !m.done && (c = v.return) && c.call(v);
        } finally {
          if (u3) throw u3.error;
        }
      }
      new _k({ outboundLayer: this, inboundLayers: h, nodeIndices: p, tensorIndices: d, inputTensors: f, outputTensors: n, inputMasks: a, outputMasks: o, inputShapes: s, outputShapes: i }, l);
      for (var x = 0; x < n.length; x++) n[x].sourceLayer = this, n[x].nodeIndex = this.inboundNodes.length - 1, n[x].tensorIndex = x;
    }, t.prototype.getConfig = function() {
      var r = { name: this.name, trainable: this.trainable };
      return this.batchInputShape != null && (r.batchInputShape = this.batchInputShape), this.dtype != null && (r.dtype = this.dtype), r;
    }, t.prototype.disposeWeights = function() {
      return this.weights.forEach(function(r) {
        return r.dispose();
      }), this.weights.length;
    }, t.prototype.assertNotDisposed = function() {
      if (this._refCount === 0) throw new Error("Layer '" + this.name + "' is already disposed.");
    }, t.prototype.dispose = function() {
      if (!this.built) throw new Error("Cannot dispose Layer " + this.name + " because it has not been built yet.");
      if (this._refCount === null) throw new Error("Cannot dispose Layer " + this.name + " because it has not been used yet.");
      this.assertNotDisposed();
      var r = 0;
      return --this._refCount === 0 && (r = this.disposeWeights()), { refCountAfterDispose: this._refCount, numDisposedVariables: r };
    }, t;
  }(ur.serialization.Serializable);
  function Zwe(e) {
    var t, r;
    e = vl(e);
    var n = [];
    try {
      for (var a = Qn(e), o = a.next(); !o.done; o = a.next()) {
        var s = o.value;
        n.push(s.shape);
      }
    } catch (i) {
      t = { error: i };
    } finally {
      try {
        o && !o.done && (r = a.return) && r.call(a);
      } finally {
        if (t) throw t.error;
      }
    }
    return Nf(n);
  }
  function Jwe(e) {
    return "float32";
  }
  function SV(e, t, r) {
    var n, a;
    if ((t == null || r != null && r > 0) && (t = e.sourceLayer, r = e.nodeIndex), t.inboundNodes.length === 0) return [e];
    var o = t.inboundNodes[r];
    if (o.inboundLayers.length === 0) return o.inputTensors;
    for (var s = [], i = 0; i < o.inboundLayers.length; i++) {
      var l = o.inputTensors[i], u3 = o.inboundLayers[i], c = o.nodeIndices[i], f = SV(l, u3, c);
      try {
        for (var h = (n = void 0, Qn(f)), p = h.next(); !p.done; p = h.next()) {
          var d = p.value;
          s.indexOf(d) === -1 && s.push(d);
        }
      } catch (v) {
        n = { error: v };
      } finally {
        try {
          p && !p.done && (a = h.return) && a.call(h);
        } finally {
          if (n) throw n.error;
        }
      }
    }
    return s;
  }
  var yy = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, { dtype: r.dtype, name: r.name != null ? r.name : bk("input").toString() }) || this;
      if (r.batchSize == null && (r.batchSize = null), r.sparse == null && (r.sparse = false), n.trainable = false, n.built = true, n.sparse = r.sparse, r.inputShape != null && r.batchInputShape != null) throw new en("Only provide the inputShape OR batchInputShape argument to inputLayer, not both at the same time.");
      var a = r.batchInputShape;
      if (a == null) {
        if (r.inputShape == null) throw new en("An InputLayer should be passed either a `batchInputShape` or an `inputShape`.");
        a = [r.batchSize].concat(r.inputShape);
      } else if (r.batchSize != null) throw new en("Cannot specify batchSize if batchInputShape is specified when creating an InputLayer.");
      var o = r.dtype || "float32";
      n.batchInputShape = a, n.dtype = o, n.inputSpec = [{ shape: a }];
      var s = new rd(n.dtype, n.batchInputShape, n, [], {}, n.name);
      return s.nodeIndex = 0, s.tensorIndex = 0, new _k({ outboundLayer: n, inboundLayers: [], nodeIndices: [], tensorIndices: [], inputTensors: [s], outputTensors: [s], inputMasks: [null], outputMasks: [null], inputShapes: [a], outputShapes: [a] }), n;
    }
    return t.prototype.apply = function(r, n) {
      throw new en("Cannot pass any input to an " + ("InputLayer's apply() method. InputLayer name: " + this.name));
    }, t.prototype.dispose = function() {
      return { refCountAfterDispose: this._refCount, numDisposedVariables: 0 };
    }, t.prototype.getConfig = function() {
      return { batchInputShape: this.batchInputShape, dtype: this.dtype, sparse: this.sparse, name: this.name };
    }, t;
  }(Wo);
  yy.className = "InputLayer";
  ur.serialization.registerClass(yy);
  function EV(e) {
    if (e.batchShape == null && e.shape == null) throw new Error("Please provide to Input either a `shape` or a `batchShape` argument. Note that `shape` does not include the batch dimension.");
    if (e.batchShape != null && e.shape != null) throw new en("Please provide either a `shape` or `batchShape` argument to Input, but not both.");
    var t = e.batchShape;
    e.shape != null && t == null && (t = [null].concat(e.shape));
    var r = e.dtype;
    r == null && (r = "float32");
    var n = new yy({ batchInputShape: t, name: e.name, dtype: r, sparse: e.sparse }), a = n.inboundNodes[0].outputTensors;
    return a[0];
  }
  function _v(e) {
    return Ni(this, void 0, void 0, function() {
      var t, r, n, a, o, s, i, l;
      return Ei(this, function(u3) {
        switch (u3.label) {
          case 0:
            if (e == null) return [2];
            t = [], r = [], n = [];
            for (a in e) o = e[a], typeof o != "number" && (s = o, t.push(s.data()), r.push(a), n.push(s));
            return t.length > 0 ? [4, Promise.all(t)] : [3, 2];
          case 1:
            for (i = u3.sent(), l = 0; l < i.length; ++l) e[r[l]] = i[l][0];
            ur.dispose(n), u3.label = 2;
          case 2:
            return [2];
        }
      });
    });
  }
  function DV(e) {
    if (e != null) for (var t in e) {
      var r = e[t];
      typeof r != "number" && r.dispose();
    }
  }
  var $B;
  (function(e) {
    e[e.SILENT = 0] = "SILENT", e[e.VERBOSE = 1] = "VERBOSE";
  })($B || ($B = {}));
  var Qwe = 125, gy = function() {
    function e() {
      this.validationData = null;
    }
    return e.prototype.setParams = function(t) {
      this.params = t;
    }, e.prototype.onEpochBegin = function(t, r) {
      return Ni(this, void 0, void 0, function() {
        return Ei(this, function(n) {
          return [2];
        });
      });
    }, e.prototype.onEpochEnd = function(t, r) {
      return Ni(this, void 0, void 0, function() {
        return Ei(this, function(n) {
          return [2];
        });
      });
    }, e.prototype.onBatchBegin = function(t, r) {
      return Ni(this, void 0, void 0, function() {
        return Ei(this, function(n) {
          return [2];
        });
      });
    }, e.prototype.onBatchEnd = function(t, r) {
      return Ni(this, void 0, void 0, function() {
        return Ei(this, function(n) {
          return [2];
        });
      });
    }, e.prototype.onTrainBegin = function(t) {
      return Ni(this, void 0, void 0, function() {
        return Ei(this, function(r) {
          return [2];
        });
      });
    }, e.prototype.onTrainEnd = function(t) {
      return Ni(this, void 0, void 0, function() {
        return Ei(this, function(r) {
          return [2];
        });
      });
    }, e.prototype.setModel = function(t) {
    }, e;
  }(), CV = function() {
    function e(t, r) {
      r === void 0 && (r = 10), t == null && (t = []), this.callbacks = t, this.queueLength = r;
    }
    return e.prototype.append = function(t) {
      this.callbacks.push(t);
    }, e.prototype.setParams = function(t) {
      var r, n;
      try {
        for (var a = Qn(this.callbacks), o = a.next(); !o.done; o = a.next()) {
          var s = o.value;
          s.setParams(t);
        }
      } catch (i) {
        r = { error: i };
      } finally {
        try {
          o && !o.done && (n = a.return) && n.call(a);
        } finally {
          if (r) throw r.error;
        }
      }
    }, e.prototype.setModel = function(t) {
      var r, n;
      try {
        for (var a = Qn(this.callbacks), o = a.next(); !o.done; o = a.next()) {
          var s = o.value;
          s.setModel(t);
        }
      } catch (i) {
        r = { error: i };
      } finally {
        try {
          o && !o.done && (n = a.return) && n.call(a);
        } finally {
          if (r) throw r.error;
        }
      }
    }, e.prototype.onEpochBegin = function(t, r) {
      return Ni(this, void 0, void 0, function() {
        var n, a, o, s, i, l;
        return Ei(this, function(u3) {
          switch (u3.label) {
            case 0:
              r == null && (r = {}), u3.label = 1;
            case 1:
              u3.trys.push([1, 6, 7, 8]), n = Qn(this.callbacks), a = n.next(), u3.label = 2;
            case 2:
              return a.done ? [3, 5] : (o = a.value, [4, o.onEpochBegin(t, r)]);
            case 3:
              u3.sent(), u3.label = 4;
            case 4:
              return a = n.next(), [3, 2];
            case 5:
              return [3, 8];
            case 6:
              return s = u3.sent(), i = { error: s }, [3, 8];
            case 7:
              try {
                a && !a.done && (l = n.return) && l.call(n);
              } finally {
                if (i) throw i.error;
              }
              return [7];
            case 8:
              return [2];
          }
        });
      });
    }, e.prototype.onEpochEnd = function(t, r) {
      return Ni(this, void 0, void 0, function() {
        var n, a, o, s, i, l;
        return Ei(this, function(u3) {
          switch (u3.label) {
            case 0:
              r == null && (r = {}), u3.label = 1;
            case 1:
              u3.trys.push([1, 6, 7, 8]), n = Qn(this.callbacks), a = n.next(), u3.label = 2;
            case 2:
              return a.done ? [3, 5] : (o = a.value, [4, o.onEpochEnd(t, r)]);
            case 3:
              u3.sent(), u3.label = 4;
            case 4:
              return a = n.next(), [3, 2];
            case 5:
              return [3, 8];
            case 6:
              return s = u3.sent(), i = { error: s }, [3, 8];
            case 7:
              try {
                a && !a.done && (l = n.return) && l.call(n);
              } finally {
                if (i) throw i.error;
              }
              return [7];
            case 8:
              return [2];
          }
        });
      });
    }, e.prototype.onBatchBegin = function(t, r) {
      return Ni(this, void 0, void 0, function() {
        var n, a, o, s, i, l;
        return Ei(this, function(u3) {
          switch (u3.label) {
            case 0:
              r == null && (r = {}), u3.label = 1;
            case 1:
              u3.trys.push([1, 6, 7, 8]), n = Qn(this.callbacks), a = n.next(), u3.label = 2;
            case 2:
              return a.done ? [3, 5] : (o = a.value, [4, o.onBatchBegin(t, r)]);
            case 3:
              u3.sent(), u3.label = 4;
            case 4:
              return a = n.next(), [3, 2];
            case 5:
              return [3, 8];
            case 6:
              return s = u3.sent(), i = { error: s }, [3, 8];
            case 7:
              try {
                a && !a.done && (l = n.return) && l.call(n);
              } finally {
                if (i) throw i.error;
              }
              return [7];
            case 8:
              return [2];
          }
        });
      });
    }, e.prototype.onBatchEnd = function(t, r) {
      return Ni(this, void 0, void 0, function() {
        var n, a, o, s, i, l;
        return Ei(this, function(u3) {
          switch (u3.label) {
            case 0:
              r == null && (r = {}), u3.label = 1;
            case 1:
              u3.trys.push([1, 6, 7, 8]), n = Qn(this.callbacks), a = n.next(), u3.label = 2;
            case 2:
              return a.done ? [3, 5] : (o = a.value, [4, o.onBatchEnd(t, r)]);
            case 3:
              u3.sent(), u3.label = 4;
            case 4:
              return a = n.next(), [3, 2];
            case 5:
              return [3, 8];
            case 6:
              return s = u3.sent(), i = { error: s }, [3, 8];
            case 7:
              try {
                a && !a.done && (l = n.return) && l.call(n);
              } finally {
                if (i) throw i.error;
              }
              return [7];
            case 8:
              return [2];
          }
        });
      });
    }, e.prototype.onTrainBegin = function(t) {
      return Ni(this, void 0, void 0, function() {
        var r, n, a, o, s, i;
        return Ei(this, function(l) {
          switch (l.label) {
            case 0:
              t == null && (t = {}), l.label = 1;
            case 1:
              l.trys.push([1, 6, 7, 8]), r = Qn(this.callbacks), n = r.next(), l.label = 2;
            case 2:
              return n.done ? [3, 5] : (a = n.value, [4, a.onTrainBegin(t)]);
            case 3:
              l.sent(), l.label = 4;
            case 4:
              return n = r.next(), [3, 2];
            case 5:
              return [3, 8];
            case 6:
              return o = l.sent(), s = { error: o }, [3, 8];
            case 7:
              try {
                n && !n.done && (i = r.return) && i.call(r);
              } finally {
                if (s) throw s.error;
              }
              return [7];
            case 8:
              return [2];
          }
        });
      });
    }, e.prototype.onTrainEnd = function(t) {
      return Ni(this, void 0, void 0, function() {
        var r, n, a, o, s, i;
        return Ei(this, function(l) {
          switch (l.label) {
            case 0:
              t == null && (t = {}), l.label = 1;
            case 1:
              l.trys.push([1, 6, 7, 8]), r = Qn(this.callbacks), n = r.next(), l.label = 2;
            case 2:
              return n.done ? [3, 5] : (a = n.value, [4, a.onTrainEnd(t)]);
            case 3:
              l.sent(), l.label = 4;
            case 4:
              return n = r.next(), [3, 2];
            case 5:
              return [3, 8];
            case 6:
              return o = l.sent(), s = { error: o }, [3, 8];
            case 7:
              try {
                n && !n.done && (i = r.return) && i.call(r);
              } finally {
                if (s) throw s.error;
              }
              return [7];
            case 8:
              return [2];
          }
        });
      });
    }, e;
  }(), e3e = function(e) {
    Hn(t, e);
    function t() {
      return e.call(this) || this;
    }
    return t.prototype.onEpochBegin = function(r) {
      return Ni(this, void 0, void 0, function() {
        return Ei(this, function(n) {
          return this.seen = 0, this.totals = {}, [2];
        });
      });
    }, t.prototype.onBatchEnd = function(r, n) {
      return Ni(this, void 0, void 0, function() {
        var a, o, s, i, l = this;
        return Ei(this, function(u3) {
          n == null && (n = {}), a = n.size == null ? 0 : n.size, this.seen += a, o = function(c) {
            var f = n[c];
            if (typeof f == "number") s.totals.hasOwnProperty(c) || (s.totals[c] = 0), s.totals[c] = s.totals[c] + f * a;
            else {
              var h = void 0;
              c in s.totals ? h = s.totals[c] : s.totals[c] = 0;
              var p = ur.tidy(function() {
                return ur.add(l.totals[c], ur.mul(f, a));
              });
              s.totals[c] = p, h?.dispose();
            }
          }, s = this;
          for (i in n) o(i);
          return [2];
        });
      });
    }, t.prototype.onEpochEnd = function(r, n) {
      return Ni(this, void 0, void 0, function() {
        var a, o, s, i, l, u3, c, f = this;
        return Ei(this, function(h) {
          if (n != null) {
            a = function(p) {
              if (o.totals[p] == null) return "continue";
              typeof o.totals[p] == "number" ? n[p] = o.totals[p] / o.seen : ur.tidy(function() {
                var d = ur.mul(ur.div(1, f.seen), f.totals[p]);
                n[p] = d, f.totals[p].dispose(), ur.keep(n[p]);
              });
            }, o = this;
            try {
              for (s = Qn(this.params.metrics), i = s.next(); !i.done; i = s.next()) l = i.value, a(l);
            } catch (p) {
              u3 = { error: p };
            } finally {
              try {
                i && !i.done && (c = s.return) && c.call(s);
              } finally {
                if (u3) throw u3.error;
              }
            }
          }
          return [2];
        });
      });
    }, t;
  }(gy), MV = function(e) {
    Hn(t, e);
    function t() {
      return e !== null && e.apply(this, arguments) || this;
    }
    return t.prototype.onTrainBegin = function(r) {
      return Ni(this, void 0, void 0, function() {
        return Ei(this, function(n) {
          return this.epoch = [], this.history = {}, [2];
        });
      });
    }, t.prototype.onEpochEnd = function(r, n) {
      return Ni(this, void 0, void 0, function() {
        var a;
        return Ei(this, function(o) {
          n == null && (n = {}), this.epoch.push(r);
          for (a in n) this.history[a] == null && (this.history[a] = []), this.history[a].push(n[a]);
          return [2];
        });
      });
    }, t.prototype.syncData = function() {
      return Ni(this, void 0, void 0, function() {
        var r, n, a, o, s, i, l, u3, c, f;
        return Ei(this, function(h) {
          switch (h.label) {
            case 0:
              r = [], n = [], a = [];
              for (o in this.history) for (s = this.history[o], i = 0; i < s.length; ++i) typeof s[i] != "number" && (l = s[i], r.push(l.data()), n.push(o), a.push(i));
              return [4, Promise.all(r)];
            case 1:
              for (u3 = h.sent(), c = 0; c < u3.length; ++c) f = this.history[n[c]][a[c]], f.dispose(), this.history[n[c]][a[c]] = u3[c][0];
              return [2];
          }
        });
      });
    }, t;
  }(gy), IV = function(e) {
    Hn(t, e);
    function t(r, n) {
      var a = e.call(this) || this;
      if (a.currentEpoch = 0, a.nowFunc = r.nowFunc, a.nextFrameFunc = r.nextFrameFunc || ur.nextFrame, a.yieldEvery = n || "auto", a.yieldEvery === "auto" && (a.yieldEvery = Qwe), a.yieldEvery === "never" && r.onYield != null) throw new Error("yieldEvery is `never` but you provided an `onYield` callback. Either change `yieldEvery` or remove the callback");
      return ur.util.isNumber(a.yieldEvery) && (a.maybeWait = iwe(a.maybeWait.bind(a), a.yieldEvery, a.nowFunc)), a.trainBegin = r.onTrainBegin, a.trainEnd = r.onTrainEnd, a.epochBegin = r.onEpochBegin, a.epochEnd = r.onEpochEnd, a.batchBegin = r.onBatchBegin, a.batchEnd = r.onBatchEnd, a.yield = r.onYield, a;
    }
    return t.prototype.maybeWait = function(r, n, a) {
      return Ni(this, void 0, void 0, function() {
        var o;
        return Ei(this, function(s) {
          switch (s.label) {
            case 0:
              return o = [], this.yield == null ? [3, 2] : [4, _v(a)];
            case 1:
              s.sent(), o.push(this.yield(r, n, a)), s.label = 2;
            case 2:
              return o.push(this.nextFrameFunc()), [4, Promise.all(o)];
            case 3:
              return s.sent(), [2];
          }
        });
      });
    }, t.prototype.onEpochBegin = function(r, n) {
      return Ni(this, void 0, void 0, function() {
        return Ei(this, function(a) {
          switch (a.label) {
            case 0:
              return this.currentEpoch = r, this.epochBegin == null ? [3, 3] : [4, _v(n)];
            case 1:
              return a.sent(), [4, this.epochBegin(r, n)];
            case 2:
              a.sent(), a.label = 3;
            case 3:
              return [2];
          }
        });
      });
    }, t.prototype.onEpochEnd = function(r, n) {
      return Ni(this, void 0, void 0, function() {
        var a;
        return Ei(this, function(o) {
          switch (o.label) {
            case 0:
              return a = [], this.epochEnd == null ? [3, 2] : [4, _v(n)];
            case 1:
              o.sent(), a.push(this.epochEnd(r, n)), o.label = 2;
            case 2:
              return this.yieldEvery === "epoch" && a.push(this.nextFrameFunc()), [4, Promise.all(a)];
            case 3:
              return o.sent(), [2];
          }
        });
      });
    }, t.prototype.onBatchBegin = function(r, n) {
      return Ni(this, void 0, void 0, function() {
        return Ei(this, function(a) {
          switch (a.label) {
            case 0:
              return this.batchBegin == null ? [3, 3] : [4, _v(n)];
            case 1:
              return a.sent(), [4, this.batchBegin(r, n)];
            case 2:
              a.sent(), a.label = 3;
            case 3:
              return [2];
          }
        });
      });
    }, t.prototype.onBatchEnd = function(r, n) {
      return Ni(this, void 0, void 0, function() {
        var a;
        return Ei(this, function(o) {
          switch (o.label) {
            case 0:
              return a = [], this.batchEnd == null ? [3, 2] : [4, _v(n)];
            case 1:
              o.sent(), a.push(this.batchEnd(r, n)), o.label = 2;
            case 2:
              return this.yieldEvery === "batch" ? a.push(this.nextFrameFunc()) : ur.util.isNumber(this.yieldEvery) && a.push(this.maybeWait(this.currentEpoch, r, n)), [4, Promise.all(a)];
            case 3:
              return o.sent(), [2];
          }
        });
      });
    }, t.prototype.onTrainBegin = function(r) {
      return Ni(this, void 0, void 0, function() {
        return Ei(this, function(n) {
          switch (n.label) {
            case 0:
              return this.trainBegin == null ? [3, 3] : [4, _v(r)];
            case 1:
              return n.sent(), [4, this.trainBegin(r)];
            case 2:
              n.sent(), n.label = 3;
            case 3:
              return [2];
          }
        });
      });
    }, t.prototype.onTrainEnd = function(r) {
      return Ni(this, void 0, void 0, function() {
        return Ei(this, function(n) {
          switch (n.label) {
            case 0:
              return this.trainEnd == null ? [3, 3] : [4, _v(r)];
            case 1:
              return n.sent(), [4, this.trainEnd(r)];
            case 2:
              n.sent(), n.label = 3;
            case 3:
              return [2];
          }
        });
      });
    }, t;
  }(gy);
  function NV(e, t) {
    if (e == null && (e = {}), e instanceof gy) return [e];
    if (Array.isArray(e) && e[0] instanceof gy) return e;
    var r = vl(e);
    return r.map(function(n) {
      return new IV(n, t);
    });
  }
  var xD = function() {
    function e() {
    }
    return e.registerCallbackConstructor = function(t, r) {
      ur.util.assert(t >= 0 && Number.isInteger(t), function() {
        return "Verbosity level is expected to be an integer >= 0, " + ("but got " + t);
      }), e.checkForDuplicate(r), e.constructors[t] == null && (e.constructors[t] = []), e.constructors[t].push(r);
    }, e.checkForDuplicate = function(t) {
      for (var r in e.constructors) {
        var n = e.constructors[+r];
        n.forEach(function(a) {
          if (a === t) throw new en("Duplicate callback constructor.");
        });
      }
    }, e.clear = function() {
      e.constructors = {};
    }, e.createCallbacks = function(t) {
      var r = [];
      for (var n in e.constructors) {
        var a = +n;
        t >= a && r.push.apply(r, bo(e.constructors[a]));
      }
      return r.map(function(o) {
        return new o();
      });
    }, e;
  }();
  xD.constructors = {};
  function FV(e, t, r, n, a, o, s, i, l) {
    var u3 = new MV(), c = bo([new e3e()], xD.createCallbacks(t));
    e != null && c.push.apply(c, bo(e)), c.push(u3);
    var f = new CV(c);
    return f.setParams({ epochs: r, initialEpoch: n, samples: a, steps: o, batchSize: s, verbose: t, doValidation: i, metrics: l }), { callbackList: f, history: u3 };
  }
  function nd(e, t, r) {
    return t === void 0 && (t = {}), r === void 0 && (r = false), h2(e, ur.serialization.SerializationMap.getMap().classNameMap, t, "layer", r);
  }
  function nk(e, t) {
    return ur.tidy(function() {
      e.dtype !== "float32" && (e = Wt.cast(e, "float32"));
      var r = Wt.sum(v2(e), t, true), n = Wt.fill(r.shape, Wu()), a = Wt.sqrt(Wt.maximum(r, n));
      return Wt.div(e, a);
    });
  }
  function ng(e, t) {
    return ur.tidy(function() {
      return Wt.mean(v2(Wt.sub(t, e)), -1);
    });
  }
  function wk(e, t) {
    return ur.tidy(function() {
      return Wt.mean(Wt.abs(Wt.sub(t, e)), -1);
    });
  }
  function xy(e, t) {
    return ur.tidy(function() {
      var r = Wt.sub(e, t), n = Wt.clipByValue(Wt.abs(e), Wu(), Number.MAX_VALUE), a = Wt.abs(Wt.div(r, n));
      return Wt.mul(100, Wt.mean(a, -1));
    });
  }
  function t3e(e, t) {
    return ur.tidy(function() {
      var r = Wt.clipByValue(t, Wu(), Number.MAX_VALUE), n = Wt.log(Wt.add(1, r)), a = Wt.clipByValue(e, Wu(), Number.MAX_VALUE), o = Wt.log(Wt.add(1, a));
      return Wt.mean(v2(Wt.sub(n, o)), -1);
    });
  }
  function r3e(e, t) {
    return ur.tidy(function() {
      var r = Wt.maximum(0, Wt.sub(1, Wt.mul(e, t)));
      return Wt.mean(v2(r), -1);
    });
  }
  function n3e(e, t) {
    return ur.tidy(function() {
      var r = Wt.maximum(0, Wt.sub(1, Wt.mul(e, t)));
      return Wt.mean(r, -1);
    });
  }
  function a3e(e, t) {
    return ur.tidy(function() {
      var r = Wt.sum(Wt.mul(e, t), -1), n = Wt.max(Wt.mul(Wt.sub(1, e), t), -1);
      return Wt.maximum(0, Wt.add(1, Wt.sub(n, r)));
    });
  }
  function i3e(e, t) {
    return ur.tidy(function() {
      var r = Math.log(2), n = Wt.sub(t, e), a = Wt.sub(Wt.add(n, Wt.softplus(Wt.mul(-2, n))), r);
      return Wt.mean(a, -1);
    });
  }
  function s2(e, t, r) {
    return r === void 0 && (r = false), ur.tidy(function() {
      if (r) t = Wt.softmax(t);
      else {
        var n = Wt.sum(t, t.shape.length - 1, true);
        t = Wt.div(t, n);
      }
      return t = Wt.clipByValue(t, Wu(), 1 - Wu()), Wt.neg(Wt.sum(Wt.mul(Wt.cast(e, "float32"), Wt.log(t)), t.shape.length - 1));
    });
  }
  function ak(e, t, r) {
    return r === void 0 && (r = false), ur.tidy(function() {
      var n = Wt.cast(Wt.floor(_we(e)), "int32");
      t = Wt.clipByValue(t, Wu(), 1 - Wu());
      var a = t.shape, o = Wt.reshape(Wt.oneHot(n, a[a.length - 1]), a);
      return s2(o, t, r);
    });
  }
  function o3e(e, t) {
    if (!ur.util.arraysEqual(e.shape, t.shape)) throw new en("logits and labels must have the same shape, but got shapes " + (JSON.stringify(e.shape) + " and " + JSON.stringify(t.shape)));
    return ur.tidy(function() {
      var r = Wt.relu(t), n = Wt.neg(Wt.abs(t));
      return Wt.add(Wt.sub(r, Wt.mul(t, e)), Wt.log1p(Wt.exp(n)));
    });
  }
  function kk(e, t) {
    return ur.tidy(function() {
      var r;
      return r = Wt.clipByValue(t, Wu(), 1 - Wu()), r = Wt.log(Wt.div(r, Wt.sub(1, r))), Wt.mean(o3e(e, r), -1);
    });
  }
  function s3e(e, t) {
    return ur.tidy(function() {
      var r = Wt.clipByValue(e, Wu(), 1), n = Wt.clipByValue(t, Wu(), 1);
      return Wt.sum(Wt.mul(e, Wt.log(Wt.div(r, n))), -1);
    });
  }
  function l3e(e, t) {
    return ur.tidy(function() {
      var r = Wt.log(Wt.add(Wu(), t));
      return Wt.mean(Wt.sub(t, Wt.mul(e, r)), -1);
    });
  }
  function bD(e, t) {
    return ur.tidy(function() {
      var r = nk(e, -1), n = nk(t, -1), a = Wt.mul(r, n);
      return Wt.neg(Wt.sum(a, -1));
    });
  }
  var ik = { meanSquaredError: ng, meanAbsoluteError: wk, meanAbsolutePercentageError: xy, meanSquaredLogarithmicError: t3e, squaredHinge: r3e, hinge: n3e, categoricalHinge: a3e, logcosh: i3e, categoricalCrossentropy: s2, sparseCategoricalCrossentropy: ak, binaryCrossentropy: kk, kullbackLeiblerDivergence: s3e, poisson: l3e, cosineProximity: bD };
  function x5(e) {
    if (typeof e == "string") {
      if (e in ik) return ik[e];
      var t = "Unknown loss " + e;
      throw e.toLowerCase().includes("softmaxcrossentropy") && (t = "Unknown loss " + e + '. Use "categoricalCrossentropy" as the string name for tf.losses.softmaxCrossEntropy'), new en(t);
    } else return e;
  }
  function _D(e, t) {
    return ur.tidy(function() {
      var r = Wt.mul(0.5, Wt.onesLike(t)), n = fk(Wt.greater(t, r), e.dtype);
      return Wt.mean(Wt.equal(e, n), -1);
    });
  }
  function wD(e, t) {
    return ur.tidy(function() {
      return fk(Wt.equal(Wt.argMax(e, -1), Wt.argMax(t, -1)), "float32");
    });
  }
  function OV(e, t) {
    return ur.tidy(function() {
      return Wt.cast(Wt.sum(Wt.logicalAnd(Wt.equal(e, 1), Wt.equal(t, 1))), "float32");
    });
  }
  function u3e(e, t) {
    return ur.tidy(function() {
      return Wt.cast(Wt.sum(Wt.logicalAnd(Wt.equal(e, 1), Wt.equal(t, 0))), "float32");
    });
  }
  function c3e(e, t) {
    return ur.tidy(function() {
      return Wt.cast(Wt.sum(Wt.logicalAnd(Wt.equal(e, 0), Wt.equal(t, 1))), "float32");
    });
  }
  function PV(e, t) {
    return ur.tidy(function() {
      var r = OV(e, t), n = c3e(e, t), a = Wt.add(r, n);
      return Wt.cast(Wt.where(Wt.greater(a, 0), Wt.div(r, a), 0), "float32");
    });
  }
  function f3e(e, t) {
    return ur.tidy(function() {
      var r = OV(e, t), n = u3e(e, t), a = Wt.add(r, n);
      return Wt.cast(Wt.where(Wt.greater(a, 0), Wt.div(r, a), 0), "float32");
    });
  }
  function LV(e, t) {
    return kk(e, t);
  }
  function RV(e, t) {
    return e.rank === t.rank && (e = Wt.squeeze(e, [e.rank - 1])), t = Wt.argMax(t, -1), t.dtype !== e.dtype && (t = Wt.cast(t, e.dtype)), Wt.cast(Wt.equal(e, t), "float32");
  }
  var h3e = ng, p3e = ng, d3e = wk, v3e = wk, m3e = xy, g3e = xy, kD = s2, y3e = bD, zV = ak, ok = { binaryAccuracy: _D, categoricalAccuracy: wD, precision: PV, categoricalCrossentropy: kD, sparseCategoricalCrossentropy: zV, mse: h3e, MSE: p3e, mae: d3e, MAE: v3e, mape: m3e, MAPE: g3e, cosine: y3e };
  function x3e(e) {
    if (typeof e == "string" && e in ok) return ok[e];
    if (typeof e != "string" && e != null) return e;
    throw new en("Unknown metric " + e);
  }
  function H3(e) {
    var t, r, n, a;
    if (Bd(e !== null, "Unknown LossOrMetricFn " + e), typeof e == "string") return e;
    var o = void 0;
    try {
      for (var s = Qn(Object.keys(ik)), i = s.next(); !i.done; i = s.next()) {
        var l = i.value;
        if (ik[l] === e) {
          o = l;
          break;
        }
      }
    } catch (f) {
      t = { error: f };
    } finally {
      try {
        i && !i.done && (r = s.return) && r.call(s);
      } finally {
        if (t) throw t.error;
      }
    }
    if (o !== void 0) return o;
    try {
      for (var u3 = Qn(Object.keys(ok)), c = u3.next(); !c.done; c = u3.next()) {
        var l = c.value;
        if (ok[l] === e) {
          o = l;
          break;
        }
      }
    } catch (f) {
      n = { error: f };
    } finally {
      try {
        c && !c.done && (a = u3.return) && a.call(u3);
      } finally {
        if (n) throw n.error;
      }
    }
    return o !== void 0 ? o : e.name;
  }
  function b3e(e) {
    var t = { Adagrad: function() {
      return ur.train.adagrad(0.01);
    }, Adadelta: function() {
      return ur.train.adadelta(1, 0.95, Wu());
    }, Adam: function() {
      return ur.train.adam(1e-3, 0.9, 0.999, Wu());
    }, Adamax: function() {
      return ur.train.adamax(2e-3, 0.9, 0.999, Wu(), 0);
    }, RMSProp: function() {
      return ur.train.rmsprop(1e-3, 0.9, 0, Wu());
    }, SGD: function() {
      return ur.train.sgd(0.01);
    } };
    if (t.adagrad = t.Adagrad, t.adadelta = t.Adadelta, t.adam = t.Adam, t.adamax = t.Adamax, t.rmsprop = t.RMSProp, t.sgd = t.SGD, e in t) return t[e]();
    throw new en("Unknown Optimizer " + e);
  }
  var HB = 1 * 1024 * 1024;
  function qB(e, t, r) {
    if (r === void 0 && (r = false), e == null || typeof e != "object" || Object.getPrototypeOf(e) !== Object.prototype || !L5(e)) throw new Error("User-defined metadata is expected to be a JSON object, but is not.");
    if (r) {
      var n = JSON.stringify(e);
      n.length > HB && console.warn('User-defined metadata of model "' + t + '" is too large in ' + ("size (length=" + n.length + " when serialized). It is not ") + "recommended to store such large objects in user-defined metadata. Please make sure its serialized length is <= " + (HB + "."));
    }
  }
  function L5(e) {
    var t, r, n, a;
    if (e === null) return true;
    if (typeof e == "object") if (Object.getPrototypeOf(e) === Object.prototype) {
      var o = Object.keys(e);
      try {
        for (var s = Qn(o), i = s.next(); !i.done; i = s.next()) {
          var l = i.value;
          if (typeof l != "string" || !L5(e[l])) return false;
        }
      } catch (p) {
        t = { error: p };
      } finally {
        try {
          i && !i.done && (r = s.return) && r.call(s);
        } finally {
          if (t) throw t.error;
        }
      }
      return true;
    } else if (Array.isArray(e)) {
      try {
        for (var u3 = Qn(e), c = u3.next(); !c.done; c = u3.next()) {
          var f = c.value;
          if (!L5(f)) return false;
        }
      } catch (p) {
        n = { error: p };
      } finally {
        try {
          c && !c.done && (a = u3.return) && a.call(u3);
        } finally {
          if (n) throw n.error;
        }
      }
      return true;
    } else return false;
    else {
      var h = typeof e;
      return h === "string" || h === "number" || h === "boolean";
    }
  }
  function _3e(e, t, r, n) {
    n === void 0 && (n = console.log);
    var a = k3e(e), o = ["Layer (type)", "Output shape", "Param #"];
    a ? (t = t || 65, r = r || [0.45, 0.85, 1]) : (t = t || 98, r = r || [0.33, 0.55, 0.67, 1]), r[r.length - 1] <= 1 && (r = r.map(function(h) {
      return Math.floor(t * h);
    }));
    var s;
    if (!a) {
      o.push("Receives inputs"), s = [];
      for (var i in e.nodesByDepth) s.push.apply(s, bo(e.nodesByDepth[i]));
    }
    n("_".repeat(t)), sk(o, r, n), n("=".repeat(t));
    for (var l = e.layers, u3 = 0; u3 < l.length; ++u3) a ? T3e(l[u3], r, n) : A3e(l[u3], r, s, n), n((u3 === l.length - 1 ? "=" : "_").repeat(t));
    e.checkTrainableWeightsConsistency();
    var c = w3e(e), f = rk(e.nonTrainableWeights);
    n("Total params: " + (c + f)), n("Trainable params: " + c), n("Non-trainable params: " + f), n("_".repeat(t));
  }
  function w3e(e) {
    var t;
    return e.collectedTrainableWeights != null ? t = rk(e.collectedTrainableWeights) : t = rk(e.trainableWeights), t;
  }
  function k3e(e) {
    var t, r, n, a, o, s, i = true, l = [], u3 = [];
    for (var c in e.nodesByDepth) l.push(e.nodesByDepth[c]);
    try {
      for (var f = Qn(l), h = f.next(); !h.done; h = f.next()) {
        var p = h.value;
        if (p.length > 1 || p.length === 1 && p[0].inboundLayers.length > 1) {
          i = false;
          break;
        }
        u3.push.apply(u3, bo(p));
      }
    } catch (w) {
      t = { error: w };
    } finally {
      try {
        h && !h.done && (r = f.return) && r.call(f);
      } finally {
        if (t) throw t.error;
      }
    }
    if (i) try {
      for (var d = Qn(e.layers), v = d.next(); !v.done; v = d.next()) {
        var m = v.value, g = false;
        try {
          for (var x = (o = void 0, Qn(m.inboundNodes)), b = x.next(); !b.done; b = x.next()) {
            var y = b.value;
            if (u3.indexOf(y) !== -1) if (g) {
              i = false;
              break;
            } else g = true;
          }
        } catch (w) {
          o = { error: w };
        } finally {
          try {
            b && !b.done && (s = x.return) && s.call(x);
          } finally {
            if (o) throw o.error;
          }
        }
        if (!i) break;
      }
    } catch (w) {
      n = { error: w };
    } finally {
      try {
        v && !v.done && (a = d.return) && a.call(d);
      } finally {
        if (n) throw n.error;
      }
    }
    return i;
  }
  function sk(e, t, r) {
    r === void 0 && (r = console.log);
    for (var n = "", a = 0; a < e.length; ++a) a > 0 && (n = n.slice(0, n.length - 1) + " "), n += e[a], n = n.slice(0, t[a]), n += " ".repeat(t[a] - n.length);
    r(n);
  }
  function T3e(e, t, r) {
    var n;
    try {
      n = JSON.stringify(e.outputShape);
    } catch {
      n = "multiple";
    }
    var a = e.name, o = e.getClassName(), s = [a + " (" + o + ")", n, e.countParams().toString()];
    sk(s, t, r);
  }
  function A3e(e, t, r, n) {
    var a, o, s;
    try {
      s = JSON.stringify(e.outputShape);
    } catch {
      s = "multiple";
    }
    var i = [];
    try {
      for (var l = Qn(e.inboundNodes), u3 = l.next(); !u3.done; u3 = l.next()) {
        var c = u3.value;
        if (!(r != null && r.length > 0 && r.indexOf(c) === -1)) for (var f = 0; f < c.inboundLayers.length; ++f) {
          var h = c.inboundLayers[f].name, p = c.nodeIndices[f], d = c.tensorIndices[f];
          i.push(h + "[" + p + "][" + d + "]");
        }
      }
    } catch (b) {
      a = { error: b };
    } finally {
      try {
        u3 && !u3.done && (o = l.return) && o.call(l);
      } finally {
        if (a) throw a.error;
      }
    }
    var v = e.name, m = e.getClassName(), g = i.length === 0 ? "" : i[0], x = [v + " (" + m + ")", s, e.countParams().toString(), g];
    sk(x, t, n);
    for (var f = 1; f < i.length; ++f) sk(["", "", "", i[f]], t, n);
  }
  function BV(e, t, r) {
    return (e === "inboundNodes" || e === "outputLayers" || e === "inputLayers") && t === 0 && typeof r == "string";
  }
  function l2(e, t) {
    var r, n;
    if (e === null) return null;
    if (typeof e == "string") return qm(e);
    if (typeof e == "number" || typeof e == "boolean") return e;
    if (e instanceof Array) {
      for (var a = [], o = e.length, s = 0; s < o; ++s) {
        var i = e[s];
        BV(t, s, i) ? a.push(i) : a.push(l2(i, t));
      }
      return a;
    } else {
      var l = {};
      try {
        for (var u3 = Qn(Object.keys(e)), c = u3.next(); !c.done; c = u3.next()) {
          var f = c.value, h = e[f];
          if (f === "name" && typeof h == "string") l[f] = h;
          else {
            var p = qm(f);
            l[p] = l2(h, p);
          }
        }
      } catch (d) {
        r = { error: d };
      } finally {
        try {
          c && !c.done && (n = u3.return) && n.call(u3);
        } finally {
          if (r) throw r.error;
        }
      }
      return l;
    }
  }
  function R5(e, t) {
    var r, n;
    if (e == null) return null;
    if (typeof e == "string") return _0(e);
    if (typeof e == "number" || typeof e == "boolean") return e;
    if (e instanceof Array) {
      for (var a = [], o = e.length, s = 0; s < o; ++s) {
        var i = e[s];
        BV(t, s, i) ? a.push(i) : a.push(R5(i, t));
      }
      return a;
    } else {
      var l = {};
      try {
        for (var u3 = Qn(Object.keys(e)), c = u3.next(); !c.done; c = u3.next()) {
          var f = c.value, h = e[f], p = _0(f);
          (f === "name" || f === "className") && typeof h == "string" ? l[p] = h : l[p] = R5(h, f);
        }
      } catch (d) {
        r = { error: d };
      } finally {
        try {
          c && !c.done && (n = u3.return) && n.call(u3);
        } finally {
          if (r) throw r.error;
        }
      }
      return l;
    }
  }
  var TD = "3.13.0";
  function S3e(e, t) {
    if (e.dtype == null || e.dtype === t.dtype) return t;
    try {
      return ur.cast(t, e.dtype);
    } catch {
      throw new en("The dtype of the feed (" + t.dtype + ") can not be cast to the dtype " + ("of the key '" + e.name + "' (" + e.dtype + ")."));
    }
  }
  var py = function() {
    function e(t) {
      var r, n;
      if (this.id2Value = {}, this.id2Mask = {}, this.name2Id = {}, t instanceof e) for (var a in t.id2Value) this.id2Value[a] = t.id2Value[a], a in t.id2Mask && (this.id2Mask[a] = t.id2Mask[a]);
      else {
        if (t == null) return;
        try {
          for (var o = Qn(t), s = o.next(); !s.done; s = o.next()) {
            var i = s.value;
            this.add(i.key, i.value);
          }
        } catch (l) {
          r = { error: l };
        } finally {
          try {
            s && !s.done && (n = o.return) && n.call(o);
          } finally {
            if (r) throw r.error;
          }
        }
      }
    }
    return e.prototype.add = function(t, r, n) {
      if (this.id2Value[t.id] == null) this.id2Value[t.id] = S3e(t, r), this.name2Id[t.name] = t.id, n != null && (this.id2Mask[t.id] = n);
      else throw new en("Duplicate key: name=" + t.name + ", id=" + t.id);
      return this;
    }, e.prototype.addFeed = function(t) {
      this.add(t.key, t.value);
    }, e.prototype.hasKey = function(t) {
      return this.id2Value[t.id] != null;
    }, e.prototype.names = function() {
      return Object.keys(this.name2Id);
    }, e.prototype.getValue = function(t) {
      if (t instanceof rd) {
        if (this.id2Value[t.id] == null) throw new en("Nonexistent key: " + t.name);
        return this.id2Value[t.id];
      } else {
        var r = this.name2Id[t];
        if (r == null) throw new en("Feed dict has no SymbolicTensor name: " + t);
        return this.id2Value[r];
      }
    }, e.prototype.getMask = function(t) {
      if (t instanceof rd) {
        if (this.id2Value[t.id] == null) throw new en("Nonexistent key: " + t.name);
        return this.id2Mask[t.id];
      } else {
        var r = this.name2Id[t];
        if (r == null) throw new en("Feed dict has no SymbolicTensor name: " + t);
        return this.id2Mask[r];
      }
    }, e.prototype.disposeMasks = function() {
      this.id2Mask != null && ur.dispose(this.id2Mask);
    }, e;
  }(), b5 = {}, XB = {};
  function n2(e, t, r, n) {
    var a, o, s, i, l = r == null ? false : r.training, u3 = Array.isArray(e), c = u3 ? e : [e], f = c.map(function(re) {
      return re.name;
    }), h = [], p = t.names();
    try {
      for (var d = Qn(f), v = d.next(); !v.done; v = d.next()) {
        var m = v.value;
        p.indexOf(m) !== -1 ? h.push(t.getValue(m)) : h.push(null);
      }
    } catch (re) {
      a = { error: re };
    } finally {
      try {
        v && !v.done && (o = d.return) && o.call(d);
      } finally {
        if (a) throw a.error;
      }
    }
    n != null && (n.maxNumTensors = -1 / 0, n.minNumTensors = 1 / 0);
    var g = f.join(",") + "|" + t.names().join(","), x, b;
    if (b5[g] == null) {
      var y = E3e(c, t);
      x = y.sorted, b = y.recipientCounts, b5[g] = x, XB[g] = b;
    }
    x = b5[g], b = {}, l || Object.assign(b, XB[g]);
    for (var w = new py(t), _4 = 0; _4 < x.length; ++_4) {
      if (n != null) {
        var k = ur.memory().numTensors;
        k > n.maxNumTensors && (n.maxNumTensors = k), k < n.minNumTensors && (n.minNumTensors = k);
      }
      var T2 = x[_4], A2 = T2.sourceLayer;
      if (!(A2 instanceof yy)) {
        var S2 = [], C2 = [], E2 = [], F13 = false;
        try {
          for (var N2 = (s = void 0, Qn(T2.inputs)), D2 = N2.next(); !D2.done; D2 = N2.next()) {
            var I2 = D2.value, O2 = w.getValue(I2), L2 = w.getMask(I2);
            S2.push(O2), C2.push(L2), L2 != null && (F13 = true), l || (b[I2.name]--, b[I2.name] === 0 && !t.hasKey(I2) && f.indexOf(I2.name) === -1 && !O2.isDisposed && I2.sourceLayer.stateful !== true && E2.push(O2));
          }
        } catch (re) {
          s = { error: re };
        } finally {
          try {
            D2 && !D2.done && (i = N2.return) && i.call(N2);
          } finally {
            if (s) throw s.error;
          }
        }
        F13 && (r = r || {}, r.mask = C2[0]);
        var V2 = vl(A2.apply(S2, r)), W2 = null;
        A2.supportsMasking && (W2 = A2.computeMask(S2, C2));
        for (var X2 = C3e(T2), Y2 = Array.isArray(X2) ? X2 : [X2], K2 = 0; K2 < Y2.length; ++K2) {
          w.hasKey(Y2[K2]) || w.add(Y2[K2], V2[K2], Array.isArray(W2) ? W2[0] : W2);
          var q = f.indexOf(Y2[K2].name);
          q !== -1 && (h[q] = V2[K2]);
        }
        l || ur.dispose(E2);
      }
    }
    return w.disposeMasks(), u3 ? h : h[0];
  }
  function E3e(e, t) {
    var r, n, a, o;
    ur.util.assert(e != null && e.length > 0, function() {
      return "Expected at least one fetch, got none";
    });
    var s = [], i = {};
    if (e.length === 1) {
      var l = KB(e[0], t);
      s = l.sorted, i = l.recipientMap;
    } else {
      var u3 = /* @__PURE__ */ new Set();
      try {
        for (var c = Qn(e), f = c.next(); !f.done; f = c.next()) {
          var h = f.value, p = KB(h, t), d = p.sorted, v = p.recipientMap;
          try {
            for (var m = (a = void 0, Qn(d)), g = m.next(); !g.done; g = m.next()) {
              var x = g.value;
              u3.has(x.name) || (s.push(x), u3.add(x.name));
            }
          } catch (w) {
            a = { error: w };
          } finally {
            try {
              g && !g.done && (o = m.return) && o.call(m);
            } finally {
              if (a) throw a.error;
            }
          }
          var b = function(w) {
            i[w] == null && (i[w] = /* @__PURE__ */ new Set()), v[w].forEach(function(_4) {
              return i[w].add(_4);
            });
          };
          for (var y in v) b(y);
        }
      } catch (w) {
        r = { error: w };
      } finally {
        try {
          f && !f.done && (n = c.return) && n.call(c);
        } finally {
          if (r) throw r.error;
        }
      }
    }
    return { sorted: s, recipientCounts: D3e(i) };
  }
  function D3e(e) {
    var t = {};
    for (var r in e) t[r] = e[r].size;
    return t;
  }
  function KB(e, t) {
    var r, n, a, o, s = /* @__PURE__ */ new Set(), i = [], l = {};
    try {
      for (var u3 = Qn(t.names()), c = u3.next(); !c.done; c = u3.next()) {
        var f = c.value;
        s.add(f);
      }
    } catch (b) {
      r = { error: b };
    } finally {
      try {
        c && !c.done && (n = u3.return) && n.call(u3);
      } finally {
        if (r) throw r.error;
      }
    }
    var h = [], p = [];
    for (h.push(e); h.length > 0; ) {
      var d = h[h.length - 1];
      if (s.has(d.name)) {
        h.pop();
        continue;
      }
      var v = p[p.length - 1] === h.length - 1;
      if (d.inputs.length === 0 || v) h.pop(), i.push(d), s.add(d.name), v && p.pop();
      else {
        p.push(h.length - 1);
        try {
          for (var m = (a = void 0, Qn(d.inputs)), g = m.next(); !g.done; g = m.next()) {
            var x = g.value;
            l[x.name] == null && (l[x.name] = /* @__PURE__ */ new Set()), l[x.name].add(d.name), !s.has(x.name) && h.push(x);
          }
        } catch (b) {
          a = { error: b };
        } finally {
          try {
            g && !g.done && (o = m.return) && o.call(m);
          } finally {
            if (a) throw a.error;
          }
        }
      }
    }
    return { sorted: i, recipientMap: l };
  }
  function C3e(e) {
    var t, r, n;
    if (e.sourceLayer.inboundNodes.length === 1) n = e.sourceLayer.output;
    else {
      for (var a = null, o = 0; o < e.sourceLayer.inboundNodes.length; ++o) try {
        for (var s = (t = void 0, Qn(e.sourceLayer.inboundNodes[o].outputTensors)), i = s.next(); !i.done; i = s.next()) {
          var l = i.value;
          if (l.id === e.id) {
            a = o;
            break;
          }
        }
      } catch (u3) {
        t = { error: u3 };
      } finally {
        try {
          i && !i.done && (r = s.return) && r.call(s);
        } finally {
          if (t) throw t.error;
        }
      }
      n = e.sourceLayer.getOutputAt(a);
    }
    return n;
  }
  var M3e = function(e) {
    Hn(t, e);
    function t(r) {
      var n, a, o, s, i, l, u3, c, f, h, p, d, v, m, g, x, b, y, w, _4, k, T2, A2, S2, C2 = e.call(this, {}) || this;
      if (C2.containerNodes = /* @__PURE__ */ new Set(), C2.name = r.name, C2.name == null) {
        var E2 = C2.getClassName().toLowerCase();
        C2.name = bk(E2);
      }
      if (C2.supportsMasking = false, C2.trainable_ = true, Array.isArray(r.inputs) ? C2.inputs = r.inputs.slice() : C2.inputs = [r.inputs], Array.isArray(r.outputs) ? C2.outputs = r.outputs.slice() : C2.outputs = [r.outputs], kv(C2.inputs).length !== C2.inputs.length) throw new en("The list of inputs passed to the model is redundant. All inputs should only appear once. Found: " + ("" + C2.inputs.map(function(Ge) {
        return Ge.name;
      })));
      kv(C2.outputs).length !== C2.outputs.length && console.warn("The list of outputs passed to the model is redundant. All outputs should only appear once. Found: " + ("" + C2.outputs.map(function(Ge) {
        return Ge.name;
      }))), C2.inputLayers = [], C2.inputLayersNodeIndices = [], C2.inputLayersTensorIndices = [], C2.outputLayers = [], C2.outputLayersNodeIndices = [], C2.outputLayersTensorIndices = [], C2.layers = [], C2.internalContainerRefs = [];
      try {
        for (var F13 = Qn(C2.outputs), N2 = F13.next(); !N2.done; N2 = F13.next()) {
          var D2 = N2.value, I2 = D2.sourceLayer, O2 = D2.nodeIndex, L2 = D2.tensorIndex;
          C2.outputLayers.push(I2), C2.outputLayersNodeIndices.push(O2), C2.outputLayersTensorIndices.push(L2);
        }
      } catch (Ge) {
        n = { error: Ge };
      } finally {
        try {
          N2 && !N2.done && (a = F13.return) && a.call(F13);
        } finally {
          if (n) throw n.error;
        }
      }
      try {
        for (var V2 = Qn(C2.inputs), W2 = V2.next(); !W2.done; W2 = V2.next()) {
          var D2 = W2.value, I2 = D2.sourceLayer, O2 = D2.nodeIndex, L2 = D2.tensorIndex;
          Bd(O2 === 0, "input layer has >1 nodes"), Bd(L2 === 0, "input layer has >1 tensors"), C2.inputLayers.push(I2), C2.inputLayersNodeIndices.push(O2), C2.inputLayersTensorIndices.push(L2);
        }
      } catch (Ge) {
        o = { error: Ge };
      } finally {
        try {
          W2 && !W2.done && (s = V2.return) && s.call(V2);
        } finally {
          if (o) throw o.error;
        }
      }
      C2.inputNames = [], C2.outputNames = [], C2.feedInputShapes = [], C2.feedInputNames = [], C2.feedOutputNames = [];
      for (var X2 = 0; X2 < C2.inputLayers.length; X2++) {
        var I2 = C2.inputLayers[X2];
        if (!(I2 instanceof yy)) throw new TypeError("Input layers to a LayersModel must be InputLayer objects. " + ("Received inputs: " + r.inputs + ". ") + ("Input " + X2 + " (0-based) originates ") + ("from layer type " + I2.getClassName() + "."));
        C2.inputNames.push(I2.name), C2.feedInputShapes.push(I2.batchInputShape), C2.feedInputNames.push(I2.name);
      }
      try {
        for (var Y2 = Qn(C2.outputLayers), K2 = Y2.next(); !K2.done; K2 = Y2.next()) {
          var I2 = K2.value;
          C2.outputNames.push(I2.name);
        }
      } catch (Ge) {
        i = { error: Ge };
      } finally {
        try {
          K2 && !K2.done && (l = Y2.return) && l.call(Y2);
        } finally {
          if (i) throw i.error;
        }
      }
      C2.internalInputShapes = C2.inputs.map(function(Ge) {
        return Ge.shape;
      }), C2.internalOutputShapes = C2.outputs.map(function(Ge) {
        return Ge.shape;
      });
      var q = {}, re = {}, R2 = {}, z = {}, H2 = {}, te = [], j = function(Ge, st, Ie, Pe, $e, Ve) {
        (Pe == null || $e == null || Ve == null) && (Pe = Ge.sourceLayer, $e = Ge.nodeIndex, Ve = Ge.tensorIndex);
        var ut = Pe.inboundNodes[$e];
        if (Ie.indexOf(ut) !== -1) throw new jd("The tensor " + Ge.name + ' at layer "' + Pe.name + '" is part of a cycle.');
        if (st.indexOf(ut) === -1) {
          C2.containerNodes.add(t.nodeKey(Pe, $e)), Pe.id in H2 || (H2[Pe.id] = Object.keys(H2).length), Ie.indexOf(ut) === -1 && Ie.push(ut);
          for (var Re = ut.inboundLayers.length, qe = 0; qe < Re; qe++) {
            var je = ut.inputTensors[qe], rt = ut.inboundLayers[qe], He = ut.nodeIndices[qe], xe = ut.tensorIndices[qe];
            j(je, st, Ie, rt, He, xe);
          }
          for (st.push(ut); Ie.indexOf(ut) >= 0; ) Ie.splice(Ie.indexOf(ut), 1);
          te.push(ut);
        }
      }, Q2 = [], Z2 = [];
      try {
        for (var ne = Qn(C2.outputs), ae = ne.next(); !ae.done; ae = ne.next()) {
          var D2 = ae.value;
          j(D2, Q2, Z2);
        }
      } catch (Ge) {
        u3 = { error: Ge };
      } finally {
        try {
          ae && !ae.done && (c = ne.return) && c.call(ne);
        } finally {
          if (u3) throw u3.error;
        }
      }
      var ue = te.slice().reverse();
      try {
        for (var le = Qn(ue), ce = le.next(); !ce.done; ce = le.next()) {
          var se = ce.value;
          re[se.id] = se, se.id in q || (q[se.id] = 0);
          var he = q[se.id], me = R2[se.outboundLayer.id] == null ? 0 : R2[se.outboundLayer.id];
          he = Math.max(he, me), R2[se.outboundLayer.id] = he, z[se.outboundLayer.id] = se.outboundLayer, q[se.id] = he;
          for (var X2 = 0; X2 < se.inboundLayers.length; X2++) {
            var we = se.inboundLayers[X2], O2 = se.nodeIndices[X2], be = we.inboundNodes[O2], Ae = q[be.id] == null ? 0 : q[be.id];
            q[be.id] = Math.max(he + 1, Ae), re[be.id] = be;
          }
        }
      } catch (Ge) {
        f = { error: Ge };
      } finally {
        try {
          ce && !ce.done && (h = le.return) && h.call(le);
        } finally {
          if (f) throw f.error;
        }
      }
      var pe = {};
      for (var ve in q) {
        var he = q[ve];
        he in pe || (pe[he] = []), pe[he].push(re[ve]);
      }
      var Ee = {};
      for (var Se in R2) {
        var he = R2[Se];
        he in Ee || (Ee[he] = []), Ee[he].push(z[Se]);
      }
      var Ce = Object.keys(Ee).map(function(Ge) {
        return parseInt(Ge, 10);
      }).sort(W3);
      C2.layers = [];
      try {
        for (var Be = Qn(Ce), Ue = Be.next(); !Ue.done; Ue = Be.next()) {
          var he = Ue.value, Ke = Ee[he];
          Ke.sort(function(st, Ie) {
            var Pe = H2[st.id], $e = H2[Ie.id];
            return Pe < $e ? -1 : Pe > $e ? 1 : 0;
          });
          try {
            for (var ct = (v = void 0, Qn(Ke)), We = ct.next(); !We.done; We = ct.next()) {
              var I2 = We.value;
              I2 instanceof t && C2.internalContainerRefs.push(I2), C2.layers.push(I2);
            }
          } catch (st) {
            v = { error: st };
          } finally {
            try {
              We && !We.done && (m = ct.return) && m.call(ct);
            } finally {
              if (v) throw v.error;
            }
          }
        }
      } catch (Ge) {
        p = { error: Ge };
      } finally {
        try {
          Ue && !Ue.done && (d = Be.return) && d.call(Be);
        } finally {
          if (p) throw p.error;
        }
      }
      C2.layersByDepth = Ee, Ce = Object.keys(pe).map(function(Ge) {
        return parseInt(Ge, 10);
      }).sort(W3);
      var Ze = C2.inputs.slice(), it = [];
      try {
        for (var ot = Qn(Ce), mt = ot.next(); !mt.done; mt = ot.next()) {
          var he = mt.value;
          try {
            for (var wt = (b = void 0, Qn(pe[he])), Et = wt.next(); !Et.done; Et = wt.next()) {
              var se = Et.value, I2 = se.outboundLayer;
              if (I2 != null) {
                try {
                  for (var zt = (w = void 0, Qn(se.inputTensors)), Nt = zt.next(); !Nt.done; Nt = zt.next()) {
                    var D2 = Nt.value;
                    if (Ze.indexOf(D2) === -1) throw new jd("Graph disconnected: cannot obtain value for tensor " + D2 + (' at layer "' + I2.name + '". ') + "The following previous layers were accessed without " + ("issue: " + it));
                  }
                } catch (Pe) {
                  w = { error: Pe };
                } finally {
                  try {
                    Nt && !Nt.done && (_4 = zt.return) && _4.call(zt);
                  } finally {
                    if (w) throw w.error;
                  }
                }
                try {
                  for (var yt = (k = void 0, Qn(se.outputTensors)), pt = yt.next(); !pt.done; pt = yt.next()) {
                    var D2 = pt.value;
                    Ze.push(D2);
                  }
                } catch (Pe) {
                  k = { error: Pe };
                } finally {
                  try {
                    pt && !pt.done && (T2 = yt.return) && T2.call(yt);
                  } finally {
                    if (k) throw k.error;
                  }
                }
                it.push(I2.name);
              }
            }
          } catch (st) {
            b = { error: st };
          } finally {
            try {
              Et && !Et.done && (y = wt.return) && y.call(wt);
            } finally {
              if (b) throw b.error;
            }
          }
        }
      } catch (Ge) {
        g = { error: Ge };
      } finally {
        try {
          mt && !mt.done && (x = ot.return) && x.call(ot);
        } finally {
          if (g) throw g.error;
        }
      }
      C2.nodesByDepth = pe;
      var Ot = C2.layers.map(function(Ge) {
        return Ge.name;
      }), Jt = function(Ge) {
        var st = Ot.filter(function(Ie) {
          return Ie === Ge;
        }).length;
        if (st !== 1) throw new jd('The name "' + Ge + '" is used ' + st + " times in the model. All layer names should be unique. Layer names: " + JSON.stringify(Ot));
      };
      try {
        for (var tr = Qn(Ot), Ye = tr.next(); !Ye.done; Ye = tr.next()) {
          var at = Ye.value;
          Jt(at);
        }
      } catch (Ge) {
        A2 = { error: Ge };
      } finally {
        try {
          Ye && !Ye.done && (S2 = tr.return) && S2.call(tr);
        } finally {
          if (A2) throw A2.error;
        }
      }
      return C2.outboundNodes = [], C2.inboundNodes = [], new _k({ outboundLayer: C2, inboundLayers: [], nodeIndices: [], tensorIndices: [], inputTensors: C2.inputs, outputTensors: C2.outputs, inputMasks: C2.inputs.map(function(Ge) {
        return null;
      }), outputMasks: C2.outputs.map(function(Ge) {
        return null;
      }), inputShapes: C2.inputs.map(function(Ge) {
        return Ge.shape;
      }), outputShapes: C2.outputs.map(function(Ge) {
        return Ge.shape;
      }) }), C2.built = true, C2._refCount = 1, C2;
    }
    return t.prototype.assertNotDisposed = function() {
      if (this._refCount === 0) throw new Error("Container '" + this.name + "' is already disposed.");
    }, t.prototype.dispose = function() {
      var r, n, a, o;
      this.assertNotDisposed();
      var s = { refCountAfterDispose: null, numDisposedVariables: 0 };
      if (--this._refCount === 0) {
        try {
          for (var i = Qn(this.layers), l = i.next(); !l.done; l = i.next()) {
            var u3 = l.value;
            s.numDisposedVariables += u3.dispose().numDisposedVariables;
          }
        } catch (p) {
          r = { error: p };
        } finally {
          try {
            l && !l.done && (n = i.return) && n.call(i);
          } finally {
            if (r) throw r.error;
          }
        }
        try {
          for (var c = Qn(this.internalContainerRefs), f = c.next(); !f.done; f = c.next()) {
            var h = f.value;
            s.numDisposedVariables += h.dispose().numDisposedVariables;
          }
        } catch (p) {
          a = { error: p };
        } finally {
          try {
            f && !f.done && (o = c.return) && o.call(c);
          } finally {
            if (a) throw a.error;
          }
        }
      }
      return s.refCountAfterDispose = this._refCount, s;
    }, Object.defineProperty(t.prototype, "trainable", { get: function() {
      return this.trainable_;
    }, set: function(r) {
      this.layers.forEach(function(n) {
        n._trainableWeights.forEach(function(a) {
          return a.trainable = r;
        });
      }), this.trainable_ = r;
    }, enumerable: true, configurable: true }), Object.defineProperty(t.prototype, "trainableWeights", { get: function() {
      var r, n;
      if (this._trainableWeights.length > 0) throw new en("Container instance unexpectedly contains _trainableWeights.The trainable weights of a Container are a union of the trainable weights of its consituent Layers. Its own _trainableWeights must remain an empty Array.");
      if (!this.trainable) return [];
      var a = [];
      try {
        for (var o = Qn(this.layers), s = o.next(); !s.done; s = o.next()) {
          var i = s.value;
          a = a.concat(i.trainableWeights);
        }
      } catch (l) {
        r = { error: l };
      } finally {
        try {
          s && !s.done && (n = o.return) && n.call(o);
        } finally {
          if (r) throw r.error;
        }
      }
      return a;
    }, enumerable: true, configurable: true }), Object.defineProperty(t.prototype, "nonTrainableWeights", { get: function() {
      var r, n, a, o, s = [];
      try {
        for (var i = Qn(this.layers), l = i.next(); !l.done; l = i.next()) {
          var u3 = l.value;
          s.push.apply(s, bo(u3.nonTrainableWeights));
        }
      } catch (p) {
        r = { error: p };
      } finally {
        try {
          l && !l.done && (n = i.return) && n.call(i);
        } finally {
          if (r) throw r.error;
        }
      }
      if (!this.trainable) {
        var c = [];
        try {
          for (var f = Qn(this.layers), h = f.next(); !h.done; h = f.next()) {
            var u3 = h.value;
            c.push.apply(c, bo(u3.trainableWeights));
          }
        } catch (p) {
          a = { error: p };
        } finally {
          try {
            h && !h.done && (o = f.return) && o.call(f);
          } finally {
            if (a) throw a.error;
          }
        }
        return c.concat(s);
      }
      return s;
    }, enumerable: true, configurable: true }), Object.defineProperty(t.prototype, "weights", { get: function() {
      return this.trainableWeights.concat(this.nonTrainableWeights);
    }, enumerable: true, configurable: true }), t.prototype.loadWeights = function(r, n) {
      var a, o, s, i;
      n === void 0 && (n = true);
      var l = {}, u3 = 0;
      try {
        for (var c = Qn(this.layers), f = c.next(); !f.done; f = c.next()) {
          var h = f.value;
          try {
            for (var p = (s = void 0, Qn(h.weights)), d = p.next(); !d.done; d = p.next()) {
              var v = d.value;
              if (l[v.originalName] != null) throw new en("Duplicate weight name: " + v.originalName);
              l[v.originalName] = v, u3++;
            }
          } catch (_4) {
            s = { error: _4 };
          } finally {
            try {
              d && !d.done && (i = p.return) && i.call(p);
            } finally {
              if (s) throw s.error;
            }
          }
        }
      } catch (_4) {
        a = { error: _4 };
      } finally {
        try {
          f && !f.done && (o = c.return) && o.call(c);
        } finally {
          if (a) throw a.error;
        }
      }
      var m = [];
      for (var g in r) {
        var x = g;
        if (l[g] == null) {
          var b = g.split("/"), y = b.slice(0, -2).concat([b[b.length - 1]]);
          x = y.join("/");
        }
        if (l[x] != null) m.push([l[x], r[g]]);
        else if (n) throw new en("Provided weight data has no target variable: " + g);
        delete l[x];
      }
      if (n) {
        var w = [];
        for (var g in l) w.push(g);
        if (w.length > 0) throw new en(w.length + " of " + u3 + " weights are not set: " + ("" + w));
      }
      yD(m);
    }, t.prototype.updatedConfig = function() {
      var r = this.getConfig(), n = {};
      return n.className = this.getClassName(), n.config = r, n.kerasVersion = "tfjs-layers " + TD, n.backend = "TensorFlow.js", n;
    }, t.prototype.toJSON = function(r, n) {
      n === void 0 && (n = true);
      var a = R5(this.updatedConfig());
      return n ? JSON.stringify(a) : a;
    }, t.prototype.call = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        r = vl(r);
        for (var o = new py(), s = 0; s < a.inputs.length; ++s) o.add(a.inputs[s], r[s]);
        return n2(a.outputs, o, n);
      });
    }, t.prototype.computeMask = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        r = vl(r);
        var o;
        return n == null ? o = Jm(null, r.length) : o = vl(n), a.runInternalGraph(r, o)[1];
      });
    }, t.prototype.computeOutputShape = function(r) {
      var n, a, o, s, i = tk(r);
      if (i.length !== this.inputLayers.length) throw new en("Invalid inputShape argument " + r + ": " + ("model has " + this.inputLayers.length + " tensor inputs."));
      for (var l = {}, u3 = 0; u3 < i.length; u3++) {
        var c = this.inputLayers[u3], f = i[u3], h = c.name + "_0_0";
        l[h] = f;
      }
      var p = Object.keys(this.nodesByDepth).map(function(O2) {
        return parseInt(O2, 10);
      }).sort(W3);
      if (p.length > 1) try {
        for (var d = Qn(p), v = d.next(); !v.done; v = d.next()) {
          var m = v.value, g = this.nodesByDepth[m];
          try {
            for (var x = (o = void 0, Qn(g)), b = x.next(); !b.done; b = x.next()) {
              var y = b.value, c = y.outboundLayer;
              if (this.inputLayers.map(function(L2) {
                return L2.id;
              }).indexOf(c.id) === -1) {
                for (var w = [], _4 = 0; _4 < y.inboundLayers.length; _4++) {
                  var k = y.inboundLayers[_4], T2 = y.nodeIndices[_4], A2 = y.tensorIndices[_4], h = k.name + "_" + T2 + "_" + A2, S2 = l[h];
                  w.push(S2);
                }
                for (var C2 = c.computeOutputShape(Nf(w)), E2 = tk(C2), F13 = c.inboundNodes.indexOf(y), _4 = 0; _4 < E2.length; _4++) {
                  var h = c.name + "_" + F13 + "_" + _4;
                  l[h] = E2[_4];
                }
              }
            }
          } catch (O2) {
            o = { error: O2 };
          } finally {
            try {
              b && !b.done && (s = x.return) && s.call(x);
            } finally {
              if (o) throw o.error;
            }
          }
        }
      } catch (O2) {
        n = { error: O2 };
      } finally {
        try {
          v && !v.done && (a = d.return) && a.call(d);
        } finally {
          if (n) throw n.error;
        }
      }
      for (var N2 = [], D2 = [], u3 = 0; u3 < this.outputLayers.length; u3++) {
        var c = this.outputLayers[u3], F13 = this.outputLayersNodeIndices[u3], A2 = this.outputLayersTensorIndices[u3], h = c.name + "_" + F13 + "_" + A2;
        D2.push(h);
      }
      for (var u3 = 0; u3 < D2.length; u3++) {
        var I2 = D2[u3];
        Bd(I2 in l), N2.push(l[I2]);
      }
      return Nf(N2);
    }, t.prototype.runInternalGraph = function(r, n) {
      var a, o, s, i, l, u3, c, f;
      n == null && (n = Jm(null, r.length));
      for (var h = {}, p = 0; p < this.inputs.length; ++p) {
        var d = this.inputs[p], v = r[p], m = n[p];
        h[d.id] = [v, m];
      }
      var g = Object.keys(this.nodesByDepth).map(function(j) {
        return parseInt(j, 10);
      }).sort(W3);
      try {
        for (var x = Qn(g), b = x.next(); !b.done; b = x.next()) {
          var y = b.value, w = this.nodesByDepth[y];
          try {
            for (var _4 = (s = void 0, Qn(w)), k = _4.next(); !k.done; k = _4.next()) {
              var T2 = k.value, A2 = T2.outboundLayer, S2 = T2.inputTensors, C2 = T2.outputTensors, E2 = new Array();
              try {
                for (var F13 = (l = void 0, Qn(S2)), N2 = F13.next(); !N2.done; N2 = F13.next()) {
                  var d = N2.value;
                  d.id in h && E2.push(h[d.id]);
                }
              } catch (j) {
                l = { error: j };
              } finally {
                try {
                  N2 && !N2.done && (u3 = F13.return) && u3.call(F13);
                } finally {
                  if (l) throw l.error;
                }
              }
              if (E2.length === S2.length) {
                var D2 = {}, I2 = void 0, O2 = void 0, L2 = void 0, V2 = void 0;
                if (T2.callArgs != null && (D2 = T2.callArgs), E2.length === 1) {
                  var W2 = pa(E2[0], 2), X2 = W2[0], Y2 = W2[1];
                  D2.mask == null && (D2.mask = Y2), L2 = vl(A2.call(X2, D2)), V2 = vl(A2.computeMask(X2, Y2)), I2 = [X2], O2 = [Y2];
                } else I2 = E2.map(function(j) {
                  return j[0];
                }), O2 = E2.map(function(j) {
                  return j[1];
                }), D2.mask == null && (D2.mask = O2), L2 = vl(A2.call(I2, D2)), V2 = vl(A2.computeMask(I2, O2));
                if (A2.activityRegularizer) throw new ro("LayersModel invocation with concrete Tensor value(s) in the presence of activity regularizer(s) is not supported yet.");
                for (var p = 0; p < C2.length; ++p) {
                  var d = C2[p], v = L2[p], m = V2[p];
                  h[d.id] = [v, m];
                }
              }
            }
          } catch (j) {
            s = { error: j };
          } finally {
            try {
              k && !k.done && (i = _4.return) && i.call(_4);
            } finally {
              if (s) throw s.error;
            }
          }
        }
      } catch (j) {
        a = { error: j };
      } finally {
        try {
          b && !b.done && (o = x.return) && o.call(x);
        } finally {
          if (a) throw a.error;
        }
      }
      var K2 = [], q = [], re = [];
      try {
        for (var R2 = Qn(this.outputs), z = R2.next(); !z.done; z = R2.next()) {
          var d = z.value;
          Bd(d.id in h, "Could not compute output " + d.name + " : " + d.id);
          var H2 = pa(h[d.id], 2), te = H2[0], m = H2[1];
          re.push(te.shape), K2.push(te), q.push(m);
        }
      } catch (j) {
        c = { error: j };
      } finally {
        try {
          z && !z.done && (f = R2.return) && f.call(R2);
        } finally {
          if (c) throw c.error;
        }
      }
      return [K2, q, re];
    }, t.prototype.buildNodeConversionMap = function(r) {
      var n, a, o = {}, s;
      try {
        for (var i = Qn(this.layers), l = i.next(); !l.done; l = i.next()) {
          var u3 = l.value;
          s = u3 instanceof t ? 1 : 0;
          for (var c = 0; c < u3.inboundNodes.length; c++) {
            var f = t.nodeKey(u3, c);
            this.containerNodes.has(f) && (o[f] = s, s += 1);
          }
        }
      } catch (h) {
        n = { error: h };
      } finally {
        try {
          l && !l.done && (a = i.return) && a.call(i);
        } finally {
          if (n) throw n.error;
        }
      }
      return o;
    }, t.prototype.getLayer = function(r, n) {
      var a, o;
      if (n != null) {
        if (this.layers.length <= n) throw new en("Was asked to retrieve layer at index " + n + ", but model only " + ("has " + this.layers.length + " layer(s)."));
        return this.layers[n];
      } else if (r == null) throw new en("Provide either a layer name or layer index");
      try {
        for (var s = Qn(this.layers), i = s.next(); !i.done; i = s.next()) {
          var l = i.value;
          if (l.name === r) return l;
        }
      } catch (u3) {
        a = { error: u3 };
      } finally {
        try {
          i && !i.done && (o = s.return) && o.call(s);
        } finally {
          if (a) throw a.error;
        }
      }
      throw new en("No such layer: " + r);
    }, t.prototype.calculateLosses = function() {
      var r = this;
      return ur.tidy(function() {
        var n, a, o = [];
        try {
          for (var s = Qn(r.layers), i = s.next(); !i.done; i = s.next()) for (var l = i.value, u3 = 0; u3 < l.inboundNodes.length; ++u3) {
            var c = t.nodeKey(l, u3);
            r.containerNodes.has(c) && o.push.apply(o, bo(l.calculateLosses()));
          }
        } catch (f) {
          n = { error: f };
        } finally {
          try {
            i && !i.done && (a = s.return) && a.call(s);
          } finally {
            if (n) throw n.error;
          }
        }
        return o;
      });
    }, t.prototype.getConfig = function() {
      var r, n, a = { name: this.name }, o = this.buildNodeConversionMap(this.layers), s = [];
      try {
        for (var i = Qn(this.layers), l = i.next(); !l.done; l = i.next()) {
          for (var u3 = l.value, c = u3.getClassName(), f = u3.getConfig(), h = [], p = 0; p < u3.inboundNodes.length; p++) {
            var d = u3.inboundNodes[p], v = t.nodeKey(u3, p), m = {};
            if (this.containerNodes.has(v)) {
              if (d.callArgs) try {
                JSON.stringify(d.callArgs), m = d.callArgs;
              } catch {
                console.warn("Layer " + u3.name + " was passed non-serializable keyword arguments: " + (d.callArgs + ". They will not be included ") + "in the serialized model (and thus will be missing at deserialization time)."), m = {};
              }
              if (d.inboundLayers.length > 0) {
                for (var g = [], x = 0; x < d.inboundLayers.length; x++) {
                  var b = d.inboundLayers[x], y = d.nodeIndices[x], w = d.tensorIndices[x], _4 = t.nodeKey(b, y), k = o[_4];
                  k == null && (k = 0), g.push([b.name, k, w, m]);
                }
                h.push(g);
              }
            }
          }
          var T2 = {};
          T2.name = u3.name, T2.className = c, T2.config = f, T2.inboundNodes = h, s.push(T2);
        }
      } catch (C2) {
        r = { error: C2 };
      } finally {
        try {
          l && !l.done && (n = i.return) && n.call(i);
        } finally {
          if (r) throw r.error;
        }
      }
      a.layers = s;
      for (var A2 = [], x = 0; x < this.inputLayers.length; x++) {
        var u3 = this.inputLayers[x], y = this.inputLayersNodeIndices[x], v = t.nodeKey(u3, y);
        if (!!this.containerNodes.has(v)) {
          var k = o[v];
          k == null && (k = 0);
          var w = this.inputLayersTensorIndices[x];
          A2.push([u3.name, k, w]);
        }
      }
      a.inputLayers = A2;
      for (var S2 = [], x = 0; x < this.outputLayers.length; x++) {
        var u3 = this.outputLayers[x], y = this.outputLayersNodeIndices[x], v = t.nodeKey(u3, y);
        if (!!this.containerNodes.has(v)) {
          var k = o[v];
          k == null && (k = 0);
          var w = this.outputLayersTensorIndices[x];
          S2.push([u3.name, k, w]);
        }
      }
      return a.outputLayers = S2, a;
    }, t.fromConfig = function(r, n, a, o) {
      var s, i, l, u3, c, f, h, p, d, v;
      o === void 0 && (o = false);
      var m = {}, g = {};
      function x(te, j) {
        te.name in g ? g[te.name].push(j) : g[te.name] = [j];
      }
      function b(te, j) {
        var Q2, Z2, ne = [], ae;
        try {
          for (var ue = Qn(j), le = ue.next(); !le.done; le = ue.next()) {
            var ce = le.value, se = ce[0], he = ce[1], me = ce[2];
            if (ae = ce[3] == null ? {} : ce[3], !(se in m)) {
              x(te, j);
              return;
            }
            var we = m[se];
            if (we.inboundNodes.length <= he) {
              x(te, j);
              return;
            }
            var be = we.inboundNodes[he];
            ne.push(be.outputTensors[me]);
          }
        } catch (Ae) {
          Q2 = { error: Ae };
        } finally {
          try {
            le && !le.done && (Z2 = ue.return) && Z2.call(ue);
          } finally {
            if (Q2) throw Q2.error;
          }
        }
        ne.length > 0 && te.apply(Nf(ne), ae);
      }
      function y(te) {
        var j = te.name, Q2 = nd(te, n.customObjects != null ? n.customObjects : {});
        Q2.setFastWeightInitDuringBuild(o), m[j] = Q2;
        var Z2 = te.inboundNodes;
        Z2.forEach(function(ne) {
          if (!(ne instanceof Array)) throw new en("Corrupted configuration, expected array for nodeData: " + ne);
          x(Q2, ne);
        });
      }
      var w = n.name, _4 = n.layers;
      try {
        for (var k = Qn(_4), T2 = k.next(); !T2.done; T2 = k.next()) {
          var A2 = T2.value;
          y(A2);
        }
      } catch (te) {
        s = { error: te };
      } finally {
        try {
          T2 && !T2.done && (i = k.return) && i.call(k);
        } finally {
          if (s) throw s.error;
        }
      }
      for (; !awe(g); ) try {
        for (var S2 = (l = void 0, Qn(_4)), C2 = S2.next(); !C2.done; C2 = S2.next()) {
          var A2 = C2.value, E2 = m[A2.name];
          if (E2.name in g) {
            var F13 = g[E2.name];
            delete g[E2.name];
            try {
              for (var N2 = (c = void 0, Qn(F13)), D2 = N2.next(); !D2.done; D2 = N2.next()) {
                var I2 = D2.value;
                b(E2, I2);
              }
            } catch (j) {
              c = { error: j };
            } finally {
              try {
                D2 && !D2.done && (f = N2.return) && f.call(N2);
              } finally {
                if (c) throw c.error;
              }
            }
          }
        }
      } catch (te) {
        l = { error: te };
      } finally {
        try {
          C2 && !C2.done && (u3 = S2.return) && u3.call(S2);
        } finally {
          if (l) throw l.error;
        }
      }
      var O2 = [], L2 = [], V2 = n.inputLayers;
      try {
        for (var W2 = Qn(V2), X2 = W2.next(); !X2.done; X2 = W2.next()) {
          var A2 = X2.value, Y2 = A2[0], K2 = A2[1], q = A2[2];
          Bd(Y2 in m);
          var E2 = m[Y2], re = E2.inboundNodes[K2].outputTensors;
          O2.push(re[q]);
        }
      } catch (te) {
        h = { error: te };
      } finally {
        try {
          X2 && !X2.done && (p = W2.return) && p.call(W2);
        } finally {
          if (h) throw h.error;
        }
      }
      var R2 = n.outputLayers;
      try {
        for (var z = Qn(R2), H2 = z.next(); !H2.done; H2 = z.next()) {
          var A2 = H2.value, Y2 = A2[0], K2 = A2[1], q = A2[2];
          Bd(Y2 in m);
          var E2 = m[Y2], re = E2.inboundNodes[K2].outputTensors;
          L2.push(re[q]);
        }
      } catch (te) {
        d = { error: te };
      } finally {
        try {
          H2 && !H2.done && (v = z.return) && v.call(z);
        } finally {
          if (d) throw d.error;
        }
      }
      return new r({ inputs: O2, outputs: L2, name: w });
    }, Object.defineProperty(t.prototype, "stateful", { get: function() {
      var r, n;
      if (this._stateful) throw new en("Container instance unexpectedly has _stateful = true. The statefulness of a Container is determined by the Layers it contains. Its _stateful property must remain the default false.");
      try {
        for (var a = Qn(this.layers), o = a.next(); !o.done; o = a.next()) {
          var s = o.value;
          if (s.stateful) return true;
        }
      } catch (i) {
        r = { error: i };
      } finally {
        try {
          o && !o.done && (n = a.return) && n.call(a);
        } finally {
          if (r) throw r.error;
        }
      }
      return false;
    }, enumerable: true, configurable: true }), t.prototype.resetStates = function() {
      var r = this;
      ur.tidy(function() {
        r.layers.forEach(function(n) {
          n.stateful && n.resetStates();
        });
      });
    }, t;
  }(Wo);
  function I3e(e, t, r) {
    var n = t.length;
    if (e == null || Array.isArray(e) && e.length === 0) return t.map(function(o) {
      return null;
    });
    if (n === 1) return Array.isArray(e) && e.length === 1 ? e : typeof e == "object" && t[0] in e ? [e[t[0]]] : [e];
    if (Array.isArray(e)) {
      if (e.length !== n) throw new Error("Provided " + r + " is an array of " + e.length + " " + ("element(s), but the model has " + n + " outputs. ") + "Make sure a set of weights is provided for each model output.");
      return e;
    } else if (typeof e == "object" && Object.keys(e).length > 0 && typeof e[Object.keys(e)[0]] == "object") {
      var a = [];
      return t.forEach(function(o) {
        o in e ? a.push(e[o]) : a.push(null);
      }), a;
    } else throw new Error("The model has multiple (" + n + ") outputs, " + ("so " + r + " must be either an array with ") + (n + " elements or an object with " + t + " keys. ") + ("Provided " + r + " not understood: " + JSON.stringify(e)));
  }
  function UV(e, t) {
    return I3e(e, t, "classWeight");
  }
  function VV(e, t, r, n) {
    return Ni(this, void 0, void 0, function() {
      var a, o, s, i, l;
      return Ei(this, function(u3) {
        switch (u3.label) {
          case 0:
            if (t != null || n != null) throw new Error("Support sampleWeight is not implemented yet");
            return r == null ? [3, 2] : (a = ur.tidy(function() {
              if (e.shape.length === 1) return ur.clone(e);
              if (e.shape.length === 2) if (e.shape[1] > 1) {
                var c = 1;
                return ur.argMax(e, c);
              } else {
                if (e.shape[1] === 1) return ur.reshape(e, [e.shape[0]]);
                throw new Error("Encountered unexpected last-dimension size (" + e.shape[1] + ") during handling of class weights. The size is expected to be >= 1.");
              }
              else throw new Error("Unexpected rank of target (y) tensor (" + e.rank + ") during handling of class weights. The rank is expected to be 1 or 2.");
            }), i = (s = Array).from, [4, a.data()]);
          case 1:
            return o = i.apply(s, [u3.sent()]), ur.dispose(a), l = [], o.forEach(function(c) {
              if (r[c] == null) throw new Error("classWeight must contain all classes in the training data. " + ("The class " + c + " exists in the data but not in ") + "classWeight");
              l.push(r[c]);
            }), [2, ur.tensor1d(l, "float32")];
          case 2:
            return [2, null];
        }
      });
    });
  }
  function N3e(e, t) {
    return ur.mul(e, t);
  }
  var F3e = 32;
  function jV(e, t) {
    var r, n, a = t;
    r = a.xs, n = a.ys, Wt.util.assert(r != null && n != null, function() {
      return "A Dataset iterator for fitDataset() is expected to generate objects of the form `{xs: xVal, ys: yVal}`, where the two values may be `tf.Tensor`, an array of Tensors, or a map of string to Tensor.  The provided Dataset instead generates " + ("" + t);
    });
    var o = YB("input", e.inputNames, r), s = YB("output", e.outputNames, n), i = o[0].shape[0];
    Wt.util.assert(o.length === e.inputs.length, function() {
      return "LayersModel has " + e.inputs.length + " inputs, but the dataset " + ("provides " + o.length + " inputs.  (Expected input keys: ") + (JSON.stringify(e.inputNames) + ")");
    }), Wt.util.assert(s.length === e.outputs.length, function() {
      return "LayersModel has " + e.outputs.length + " outputs, but the dataset " + ("provides " + s.length + " outputs.  (Expected output keys: ") + (JSON.stringify(e.outputNames) + ")");
    });
    for (var l = function(h) {
      Wt.util.assert(o[h].shape[0] === i, function() {
        return "Batch size mismatch: input " + (e.inputNames[h] + " has " + o[h].shape[0] + "; ") + ("expected  " + i + " based on input " + e.inputNames[0] + ".");
      });
    }, u3 = 0; u3 < o.length; u3++) l(u3);
    for (var c = function(h) {
      Wt.util.assert(s[h].shape[0] === i, function() {
        return "Batch size mismatch: output " + (e.outputNames[h] + " has " + s[h].shape[0] + "; ") + ("expected  " + i + " based on input " + e.inputNames[0] + ".");
      });
    }, f = 0; f < s.length; f++) c(f);
    return { xs: o, ys: s };
  }
  function YB(e, t, r) {
    var n, a;
    if (r instanceof Wt.Tensor) return [r];
    if (Array.isArray(r)) return Wt.util.assert(r.length === t.length, function() {
      return "Received an array of " + r.length + " Tensors, but expected " + t.length + " to match the " + e + " keys " + t + ".";
    }), r;
    var o = [];
    try {
      for (var s = Qn(t), i = s.next(); !i.done; i = s.next()) {
        var l = i.value;
        if (r[l] == null) throw new en("The feature data generated by the dataset lacks the required " + (e + " key '" + l + "'."));
        o.push(r[l]);
      }
    } catch (u3) {
      n = { error: u3 };
    } finally {
      try {
        i && !i.done && (a = s.return) && a.call(s);
      } finally {
        if (n) throw n.error;
      }
    }
    return o;
  }
  function O3e(e) {
    if (e.length === 3) throw new ro("Validation with sample weights is not implemented yet.");
    return { xs: e[0], ys: e[1] };
  }
  function P3e(e, t, r) {
    return Ni(this, void 0, void 0, function() {
      var n, a, o, s, i, l, u3, c, f, h, p, d, v, m, g, x, b, y, w, _4, k, T2, A2, S2, C2, W2, E2, F13, N2, D2, W2, I2, O2, L2, V2, W2;
      return Ei(this, function(X2) {
        switch (X2.label) {
          case 0:
            if (n = r.batchesPerEpoch != null, Wt.util.assert(e.optimizer != null, function() {
              return "You must compile a model before training/testing. Use LayersModel.compile(modelCompileConfig).";
            }), Wt.util.assert(r != null, function() {
              return "For fitDataset(), the 2nd argument (config) is required, but it is not provided in this call.";
            }), Wt.util.assert(r.epochs != null && r.epochs > 0 && Number.isInteger(r.epochs), function() {
              return "For fitDataset(), config.epochs is expected to be a positive " + ("integer, but got " + r.epochs);
            }), Wt.util.assert(!n || r.batchesPerEpoch > 0 && Number.isInteger(r.batchesPerEpoch), function() {
              return "For fitDataset(), config.batchesPerEpoch is expected to be a " + ("positive integer if specified, but got " + r.batchesPerEpoch);
            }), Wt.util.assert(r.validationSplit == null, function() {
              return "`validationSplit` is not supported by `fitDataset()`. Use validationData instead.";
            }), e.isTraining) throw new Error("Cannot start training because another fit() call is ongoing.");
            e.isTraining = true, X2.label = 1;
          case 1:
            return X2.trys.push([1, , 26, 27]), a = r.validationData != null, o = void 0, s = void 0, a && (ZB(r.validationData) ? Wt.util.assert(r.validationBatches == null || r.validationBatches > 0 && Number.isInteger(r.validationBatches), function() {
              return "For fitDataset() with dataset-based validation, config.validationBatches is expected not to be provided, or to be a positive integer, " + ("but got " + r.validationBatches);
            }) : (i = O3e(r.validationData), o = i.xs, s = i.ys)), l = e.makeTrainFunction(), u3 = e.getDedupedMetricsNames(), c = void 0, a ? c = u3.slice().concat(u3.map(function(Y2) {
              return "val_" + Y2;
            })) : c = u3.slice(), f = NV(r.callbacks, r.yieldEvery), h = r.verbose == null ? 1 : r.verbose, p = FV(f, h, r.epochs, null, null, L3e(t, r), null, a, c), d = p.callbackList, v = p.history, d.setModel(e), e.history = v, [4, d.onTrainBegin()];
          case 2:
            return X2.sent(), e.stopTraining_ = false, m = r.initialEpoch == null ? 0 : r.initialEpoch, [4, t.iterator()];
          case 3:
            g = X2.sent(), X2.label = 4;
          case 4:
            return m < r.epochs ? (x = {}, [4, d.onEpochBegin(m)]) : [3, 23];
          case 5:
            return X2.sent(), b = 0, y = 0, n ? [3, 7] : [4, t.iterator()];
          case 6:
            g = X2.sent(), X2.label = 7;
          case 7:
            return !n || b < r.batchesPerEpoch ? [4, g.next()] : [3, 21];
          case 8:
            return w = X2.sent(), n && w.done ? (console.warn("You provided `batchesPerEpoch` as " + (r.batchesPerEpoch + ", ") + "but your dataset iterator ran out of data after " + (b + " batches; ") + "interrupting training. Make sure that your dataset can generate at least `batchesPerEpoch * epochs` batches (in this case, " + (r.batchesPerEpoch * r.epochs + " batches). ") + "You may need to use the repeat() function when building your dataset."), [3, 21]) : w.value == null ? [3, 15] : (_4 = jV(e, w.value), k = _4.xs, T2 = _4.ys, A2 = {}, A2.batch = y, A2.size = k[0].shape[0], [4, d.onBatchBegin(y, A2)]);
          case 9:
            if (X2.sent(), S2 = [], r.classWeight == null) return [3, 13];
            C2 = UV(r.classWeight, e.outputNames), W2 = 0, X2.label = 10;
          case 10:
            return W2 < C2.length ? (F13 = (E2 = S2).push, [4, VV(T2[W2], null, C2[W2])]) : [3, 13];
          case 11:
            F13.apply(E2, [X2.sent()]), X2.label = 12;
          case 12:
            return ++W2, [3, 10];
          case 13:
            for (N2 = k.concat(T2).concat(S2), D2 = l(N2), Wt.dispose(N2), W2 = 0; W2 < u3.length; ++W2) I2 = u3[W2], O2 = D2[W2], A2[I2] = O2, Wt.keep(O2);
            return [4, d.onBatchEnd(y, A2)];
          case 14:
            X2.sent(), DV(A2), y++, b++, X2.label = 15;
          case 15:
            return (n ? b >= r.batchesPerEpoch : w.done) ? a ? (L2 = void 0, ZB(r.validationData) ? (V2 = vl, [4, e.evaluateDataset(r.validationData, { batches: r.validationBatches })]) : [3, 17]) : [3, 19] : [3, 20];
          case 16:
            return L2 = V2.apply(void 0, [X2.sent()]), [3, 18];
          case 17:
            L2 = vl(e.evaluate(o, s, { batchSize: r.validationBatchSize == null ? F3e : r.validationBatchSize, verbose: 0 })), X2.label = 18;
          case 18:
            for (W2 = 0; W2 < e.metricsNames.length; ++W2) x["val_" + e.metricsNames[W2]] = L2[W2];
            X2.label = 19;
          case 19:
            return [3, 21];
          case 20:
            return e.stopTraining_ ? [3, 21] : [3, 7];
          case 21:
            return [4, d.onEpochEnd(m, x)];
          case 22:
            return X2.sent(), m++, e.stopTraining_ ? [3, 23] : [3, 4];
          case 23:
            return [4, d.onTrainEnd()];
          case 24:
            return X2.sent(), [4, e.history.syncData()];
          case 25:
            return X2.sent(), [2, e.history];
          case 26:
            return e.isTraining = false, [7];
          case 27:
            return [2];
        }
      });
    });
  }
  function L3e(e, t) {
    var r = null;
    return t.batchesPerEpoch != null ? r = t.batchesPerEpoch : Number.isFinite(e.size) && (r = e.size), r;
  }
  function ZB(e) {
    return typeof e.iterator == "function";
  }
  function R3e(e) {
    return typeof e.next == "function";
  }
  function z3e(e, t, r) {
    return Ni(this, void 0, void 0, function() {
      var n, a, o, s, i, l, u3, c, f, h, p;
      return Ei(this, function(d) {
        switch (d.label) {
          case 0:
            if (r = r || {}, n = r.batches != null, a = e.testFunction, o = [], r.verbose > 0) throw new ro("Verbose mode is not implemented yet.");
            return Wt.util.assert(!n || r.batches > 0 && Number.isInteger(r.batches), function() {
              return "Test loop expects `batches` to be a positive integer, but " + ("received " + JSON.stringify(r.batches));
            }), R3e(t) ? (i = t, [3, 3]) : [3, 1];
          case 1:
            return [4, t.iterator()];
          case 2:
            i = d.sent(), d.label = 3;
          case 3:
            s = i, l = 0, u3 = 0, c = function() {
              var v;
              return Ei(this, function(m) {
                switch (m.label) {
                  case 0:
                    return [4, s.next()];
                  case 1:
                    return v = m.sent(), o = Wt.tidy(function() {
                      if (v.value) {
                        var g = jV(e, v.value), x = g.xs, b = g.ys, y = x.concat(b), w = Wt.tidy(function() {
                          return a(y);
                        });
                        if (Wt.dispose(y), u3 === 0) for (var _4 = 0; _4 < w.length; ++_4) o.push(ur.scalar(0));
                        for (var k = y[0].shape[0], T2 = function(A2) {
                          var S2 = w[A2], C2 = o[A2];
                          o[A2] = Wt.tidy(function() {
                            return Wt.add(o[A2], Wt.mul(k, S2));
                          }), u3 > 0 && Wt.dispose(C2);
                        }, _4 = 0; _4 < w.length; ++_4) T2(_4);
                        Wt.dispose(w), l += k, ++u3;
                      }
                      return o;
                    }), v.done ? (n && console.warn("Your dataset iterator ran out of data during evaluateDataset(). Interrupting evalution. Make sure that your dataset can generate at least `batches` " + ("batches (in this case, " + r.batches + " batches). ") + "You may need to use the repeat() function when building your dataset."), [2, "break"]) : [2];
                }
              });
            }, d.label = 4;
          case 4:
            return !n || u3 < r.batches ? [5, c()] : [3, 6];
          case 5:
            return f = d.sent(), f === "break" ? [3, 6] : [3, 4];
          case 6:
            for (h = 0; h < o.length; ++h) p = o[h], o[h] = Wt.div(o[h], l), Wt.dispose(p);
            return [2, Nf(o)];
        }
      });
    });
  }
  function z5(e) {
    Wt.util.assert(e > 0 && Number.isInteger(e), function() {
      return "batchSize is required to be a positive integer, but got " + e;
    });
  }
  function a2(e, t, r) {
    return e == null ? [null] : Array.isArray(e) ? e.map(function(n) {
      return Ym(n, t, r - t);
    }) : Ym(e, t, r - t);
  }
  function AD(e, t) {
    return Wt.tidy(function() {
      return e == null ? null : Array.isArray(e) ? e.map(function(r) {
        return AD(r, t);
      }) : wV(e, t.dtype === "int32" ? t : Wt.cast(t, "int32"));
    });
  }
  function B5(e, t) {
    for (var r = [], n = 0, a = null; n < e; ) a = n + t, a >= e && (a = e), r.push([n, a]), n = a;
    return r;
  }
  function B3e(e, t, r, n, a, o, s, i, l, u3, c, f, h, p, d) {
    return Ni(this, void 0, void 0, function() {
      var v, m, g, x, b, y, w, _4, k;
      return Ei(this, function(T2) {
        switch (T2.label) {
          case 0:
            if (a == null && (a = 32), o == null && (o = 1), c == null && (c = true), h == null && (h = 0), v = false, l != null && u3 != null && (v = true), d != null && (v = true, p == null)) throw new en("Can only use `validationSteps` when doing step-wise training, i.e., `stepsPerEpoch` must be set.");
            return m = e.checkNumSamples(r, a, p, "steps_per_epoch"), m != null && (g = od(0, m)), s == null && (s = 1), x = FV(i, s, o, h, m, p, a, v, f), b = x.callbackList, y = x.history, b.setModel(e), e.history = y, [4, b.onTrainBegin()];
          case 1:
            T2.sent(), e.stopTraining_ = false, w = function(A2) {
              var S2, C2, E2, F13, N2, D2;
              return Ei(this, function(I2) {
                switch (I2.label) {
                  case 0:
                    return [4, b.onEpochBegin(A2)];
                  case 1:
                    if (I2.sent(), S2 = {}, p == null) return [3, 2];
                    throw new ro("stepsPerEpoch mode is not implemented yet.");
                  case 2:
                    if (c === "batch") throw new ro("batch shuffling is not implemneted yet");
                    c && ur.util.shuffle(g), C2 = ur.tensor1d(g), E2 = B5(m, a), F13 = function(O2) {
                      var L2;
                      return Ei(this, function(V2) {
                        switch (V2.label) {
                          case 0:
                            return L2 = {}, [4, b.onBatchBegin(O2, L2)];
                          case 1:
                            return V2.sent(), Wt.tidy(function() {
                              var W2 = E2[O2][0], X2 = E2[O2][1], Y2 = Ym(C2, W2, X2 - W2);
                              L2.batch = O2, L2.size = X2 - W2;
                              for (var K2 = AD(r, Y2), q = t(K2), re = 0; re < n.length; ++re) {
                                var R2 = n[re], z = q[re];
                                L2[R2] = z, Wt.keep(z);
                              }
                              if (O2 === E2.length - 1 && v) for (var H2 = e.testLoop(l, u3, a), re = 0; re < n.length; ++re) {
                                var R2 = n[re], z = H2[re];
                                Wt.keep(z), S2["val_" + R2] = z;
                              }
                            }), [4, b.onBatchEnd(O2, L2)];
                          case 2:
                            return V2.sent(), DV(L2), e.stopTraining_ ? [2, "break"] : [2];
                        }
                      });
                    }, N2 = 0, I2.label = 3;
                  case 3:
                    return N2 < E2.length ? [5, F13(N2)] : [3, 6];
                  case 4:
                    if (D2 = I2.sent(), D2 === "break") return [3, 6];
                    I2.label = 5;
                  case 5:
                    return ++N2, [3, 3];
                  case 6:
                    C2.dispose(), I2.label = 7;
                  case 7:
                    return [4, b.onEpochEnd(A2, S2)];
                  case 8:
                    return I2.sent(), e.stopTraining_ ? [2, "break"] : [2];
                }
              });
            }, _4 = h, T2.label = 2;
          case 2:
            return _4 < o ? [5, w(_4)] : [3, 5];
          case 3:
            if (k = T2.sent(), k === "break") return [3, 5];
            T2.label = 4;
          case 4:
            return ++_4, [3, 2];
          case 5:
            return [4, b.onTrainEnd()];
          case 6:
            return T2.sent(), [4, e.history.syncData()];
          case 7:
            return T2.sent(), [2, e.history];
        }
      });
    });
  }
  function U3e(e, t, r, n) {
    return n === void 0 && (n = {}), Ni(this, void 0, void 0, function() {
      var a, o, s, i, l, u3, c, f, h, p, d, v, m, g, x, b, y, w, _4, k, T2, A2, S2, C2, E2;
      return Ei(this, function(F13) {
        switch (F13.label) {
          case 0:
            if (e.isTraining) throw new Error("Cannot start training because another fit() call is ongoing.");
            e.isTraining = true, F13.label = 1;
          case 1:
            return F13.trys.push([1, , 7, 8]), p = n.batchSize == null ? 32 : n.batchSize, z5(p), d = false, [4, e.standardizeUserData(t, r, n.sampleWeight, n.classWeight, d, p)];
          case 2:
            if (v = F13.sent(), a = v[0], o = v[1], h = v[2], m = false, g = void 0, !(n.validationData != null && n.validationData.length > 0)) return [3, 4];
            if (m = true, n.validationData.length === 2) l = n.validationData[0], u3 = n.validationData[1];
            else throw n.validationData.length === 3 ? new ro("validationData including sample weights is not supported yet.") : new en("When passing validation data, it must contain 2 (valX, valY) or 3 (valX, valY, valSampleWeight) items; " + (n.validationData + " is invalid."));
            return x = true, [4, e.standardizeUserData(l, u3, null, null, x, p)];
          case 3:
            return b = F13.sent(), c = b[0], f = b[1], g = c.concat(f), [3, 5];
          case 4:
            n.validationSplit != null && n.validationSplit > 0 && n.validationSplit < 1 ? (m = true, y = Math.floor(a[0].shape[0] * (1 - n.validationSplit)), w = a[0].shape[0], c = a2(a, y, w), s = a, a = a2(a, 0, y), f = a2(o, y, w), i = o, o = a2(o, 0, y), g = c.concat(f)) : n.validationSteps != null && (m = true), F13.label = 5;
          case 5:
            return _4 = a.concat(o).concat(h), e.checkTrainableWeightsConsistency(), k = e.makeTrainFunction(), T2 = e.getDedupedMetricsNames(), A2 = void 0, S2 = void 0, m ? (e.makeTestFunction(), A2 = e.testFunction, S2 = T2.slice().concat(T2.map(function(N2) {
              return "val_" + N2;
            }))) : (A2 = null, g = [], S2 = T2.slice()), C2 = NV(n.callbacks, n.yieldEvery), [4, B3e(e, k, _4, T2, p, n.epochs, n.verbose, C2, A2, g, n.shuffle, S2, n.initialEpoch, null, null)];
          case 6:
            return E2 = F13.sent(), [2, E2];
          case 7:
            return e.isTraining = false, td(a, t), td(o, r), td(s, t), td(i, r), td(c, l), td(f, u3), h != null && Wt.dispose(h), [7];
          case 8:
            return [2];
        }
      });
    });
  }
  function WV(e) {
    var t = [];
    e instanceof ur.Tensor && (e = [e]);
    for (var r = 0; r < e.length; ++r) {
      var n = e[r];
      if (n.rank === 1) t.push(d2(n, 1));
      else {
        if (n.rank === 0) throw new Error("Expected tensor to be at least 1D, but received a 0D tensor (scalar).");
        t.push(n);
      }
    }
    return t;
  }
  function td(e, t) {
    if (e != null) {
      var r = [];
      if (t instanceof ur.Tensor) r.push(t.id);
      else if (Array.isArray(t)) t.forEach(function(i) {
        return r.push(i.id);
      });
      else if (t != null) for (var n in t) {
        var a = t[n];
        r.push(a.id);
      }
      var o = [];
      if (e instanceof ur.Tensor) r.indexOf(e.id) === -1 && o.push(e);
      else if (Array.isArray(e)) e.forEach(function(i) {
        r.indexOf(i.id) === -1 && o.push(i);
      });
      else if (e != null) for (var n in e) {
        var s = e[n];
        r.indexOf(s.id) === -1 && o.push(s);
      }
      o.forEach(function(i) {
        i.isDisposed || i.dispose();
      });
    }
  }
  function V3e(e) {
    return e instanceof ur.Tensor;
  }
  function U5(e) {
    return Array.isArray(e);
  }
  function JB(e) {
    return !V3e(e) && !U5(e);
  }
  function QB(e, t, r, n, a) {
    var o, s;
    if (n === void 0 && (n = true), a === void 0 && (a = ""), t == null || t.length === 0) {
      if (e != null) {
        var i = false;
        if (U5(e) && e.length > 0) i = true;
        else if (JB(e)) {
          for (var l in e) if (e.hasOwnProperty(l)) {
            i = true;
            break;
          }
        } else i = true;
        if (i) throw new en("Error when checking model " + a + " expected no data, " + ("but got " + e));
      }
      return [];
    }
    if (e == null) return t.map(function(x) {
      return null;
    });
    var u3;
    if (JB(e)) {
      e = e, u3 = [];
      try {
        for (var c = Qn(t), f = c.next(); !f.done; f = c.next()) {
          var h = f.value;
          if (e[h] == null) throw new en('No data provided for "' + h + '". Need data for each key in: ' + ("" + t));
          u3.push(e[h]);
        }
      } catch (x) {
        o = { error: x };
      } finally {
        try {
          f && !f.done && (s = c.return) && s.call(c);
        } finally {
          if (o) throw o.error;
        }
      }
    } else if (U5(e)) {
      if (e = e, e.length !== t.length) throw new en("Error when checking model " + a + ": the Array of Tensors that you are passing to your model is not the size the " + ("model expected. Expected to see " + t.length + " Tensor(s), but ") + ("instead got the following list of Tensor(s): " + e));
      u3 = e;
    } else {
      if (e = e, t.length > 1) throw new en("The model " + a + " expects " + t.length + " Tensor(s), " + ("but only received one Tensor. Found: Tensor with shape " + e.shape));
      u3 = [e];
    }
    if (u3 = WV(u3), r != null) {
      for (var p = 0; p < t.length; ++p) if (r[p] != null) {
        var d = u3[p];
        if (d.shape.length !== r[p].length) throw new en("Error when checking " + a + ": expected " + t[p] + " " + ("to have " + r[p].length + " dimension(s). but got array with ") + ("shape " + d.shape));
        for (var v = 0; v < r[p].length; ++v) if (!(v === 0 && !n)) {
          var m = d.shape[v], g = r[p][v];
          if (g != null && g >= 0 && m !== g) throw new en(a + " expected a batch of elements where each " + ("example has shape [" + r[p].slice(1, r[p].length) + "] ") + ("(i.e.,tensor shape [*," + r[p].slice(1, r[p].length) + "])") + (" but the " + a + " received an input with " + d.shape[0]) + (" examples, each with shape [" + d.shape.slice(1, d.shape.length) + "]") + (" (tensor shape [" + d.shape + "])"));
        }
      }
    }
    return u3;
  }
  function j3e(e, t, r) {
    var n = kv(e.map(function(o) {
      return o.shape[0];
    }));
    n.sort();
    var a = kv(t.map(function(o) {
      return o.shape[0];
    }));
    if (a.sort(), n.length > 1) throw new en("All input Tensors (x) should have the same number of samples. Got array shapes: " + ("" + JSON.stringify(e.map(function(o) {
      return o.shape;
    }))));
    if (a.length > 1) throw new en("All target Tensors (y) should have the same number of samples. Got array shapes: " + ("" + JSON.stringify(t.map(function(o) {
      return o.shape;
    }))));
    if (n.length > 0 && a.length > 0 && !ur.util.arraysEqual(n, a)) throw new en("Input Tensors should have the same number of samples as target " + ("Tensors. Found " + n[0] + " input sample(s) and " + a[0] + " target ") + "sample(s).");
  }
  function W3e(e, t, r) {
    for (var n = [ng, kk, s2], a = 0; a < e.length; ++a) {
      var o = e[a], s = t[a], i = r[a];
      if (s != null) {
        if (s === s2 && o.shape[o.shape.length - 1] === 1) throw new en("You are passing a target array of shape " + o.shape + " while using a loss 'categorical_crossentropy'. 'categorical_crossentropy'expects targets to be binary matrices (1s and 0s) of shape [samples, classes].");
        if (n.indexOf(s) !== -1) for (var l = o.shape.slice(1), u3 = i.slice(1), c = 0; c < l.length; ++c) {
          var f = l[c], h = u3[c];
          if (h != null && f !== h) throw new en("A target Tensor with shape " + o.shape + " was passed for an " + ("output of shape " + i + ", while using a loss function that ") + "expects targets to have the same shape as the output.");
        }
      }
    }
  }
  function eU(e, t, r, n, a) {
    n === void 0 && (n = true), a === void 0 && (a = "");
    var o;
    if (Array.isArray(e)) {
      if (e.length !== t.length) throw new en("Error when checking model " + a + ": the Array of Tensors that you are passing to your model is not the size the " + ("the model expected. Expected to see " + t.length + " Tensor(s),") + (" but instead got " + e.length + " Tensors(s)."));
      o = e;
    } else {
      if (t.length > 1) throw new en("The model expects " + t.length + " " + a + " Tensors, but only received one Tensor. Found: array with shape " + (JSON.stringify(e.shape) + "."));
      o = [e];
    }
    if (r != null) {
      for (var s = 0; s < t.length; ++s) if (r[s] != null) {
        var i = o[s];
        if (i.shape.length !== r[s].length) throw new en("Error when checking " + a + ": expected " + t[s] + " " + ("to have " + r[s].length + " dimension(s), but got array with ") + ("shape " + JSON.stringify(i.shape)));
        for (var l = 0; l < r[s].length; ++l) if (!(l === 0 && !n)) {
          var u3 = i.shape[l], c = r[s][l];
          if (c != null && c !== u3) throw new en("Error when checking " + a + ": expected " + (t[s] + " to have shape " + JSON.stringify(r[s]) + " but ") + ("got array with shape " + JSON.stringify(i.shape) + "."));
        }
      }
    }
  }
  function G3e(e, t) {
    var r, n;
    if (e == null || Array.isArray(e) && e.length === 0) return t.map(function(c) {
      return [];
    });
    var a;
    if (typeof e == "string" || typeof e == "function") a = [e];
    else if (Array.isArray(e) || typeof e == "object") a = e;
    else throw new TypeError("Type of metrics argument not understood. Expected an string," + ("function, Array, or Object, found: " + e));
    if (Array.isArray(a)) return t.map(function(c) {
      return a;
    });
    var o = [];
    try {
      for (var s = Qn(t), i = s.next(); !i.done; i = s.next()) {
        var l = i.value, u3 = a.hasOwnProperty(l) ? a[l] : [];
        Array.isArray(u3) || (u3 = [u3]), o.push(u3);
      }
    } catch (c) {
      r = { error: c };
    } finally {
      try {
        i && !i.done && (n = s.return) && n.call(s);
      } finally {
        if (r) throw r.error;
      }
    }
    return o;
  }
  var $3e = "layers-model", w0 = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r) || this;
      return n.isTraining = false, n;
    }
    return t.prototype.summary = function(r, n, a) {
      if (a === void 0 && (a = console.log), !this.built) throw new en("This model has never been called, thus its weights have not been created yet. So no summary can be displayed. Build the model first (e.g., by calling it on some test data).");
      _3e(this, r, n, a);
    }, t.prototype.compile = function(r) {
      var n, a, o = this;
      if (r.loss == null && (r.loss = []), this.loss = r.loss, typeof r.optimizer == "string") this.optimizer_ = b3e(r.optimizer), this.isOptimizerOwned = true;
      else {
        if (!(r.optimizer instanceof ur.Optimizer)) throw new en("User-defined optimizer must be an instance of tf.Optimizer.");
        this.optimizer_ = r.optimizer, this.isOptimizerOwned = false;
      }
      var s = [];
      if (!Array.isArray(r.loss) && typeof r.loss != "string" && typeof r.loss != "function") {
        r.loss = r.loss;
        for (var i in r.loss) if (this.outputNames.indexOf(i) === -1) throw new en('Unknown entry in loss dictionary: "' + i + '". ' + ("Only expected the following keys: " + this.outputNames));
        try {
          for (var l = Qn(this.outputNames), u3 = l.next(); !u3.done; u3 = l.next()) {
            var i = u3.value;
            r.loss[i] == null && console.warn('Output "' + i + '" is missing from loss dictionary. We assume this was done on purpose, and we will not be expecting data ' + ("to be passed to " + i + " during training")), s.push(x5(r.loss[i]));
          }
        } catch (g) {
          n = { error: g };
        } finally {
          try {
            u3 && !u3.done && (a = l.return) && a.call(l);
          } finally {
            if (n) throw n.error;
          }
        }
      } else if (Array.isArray(r.loss)) {
        if (r.loss.length !== this.outputs.length) throw new en("When passing an Array as loss, it should have one entry per " + ("model output. The model has " + this.outputs.length + " output(s), ") + ("but you passed loss=" + r.loss + "."));
        var c = r.loss;
        s = c.map(function(g) {
          return x5(g);
        });
      } else {
        var f = x5(r.loss);
        this.outputs.forEach(function(g) {
          s.push(f);
        });
      }
      this.lossFunctions = s, this.feedOutputNames = [], this.feedOutputShapes = [], this.feedLossFns = [];
      for (var h = 0; h < this.outputs.length; ++h) {
        var p = this.internalOutputShapes[h], i = this.outputNames[h];
        this.feedOutputNames.push(i), this.feedOutputShapes.push(p), this.feedLossFns.push(this.lossFunctions[h]);
      }
      var d = [];
      this.metrics = r.metrics, this.metricsNames = ["loss"], this.metricsTensors = [], Km("loss", function() {
        for (var g = 0; g < o.outputs.length; ++g) if (d.indexOf(g) === -1) {
          var x = o.lossFunctions[g];
          o.outputs.length > 1 && (o.metricsTensors.push([x, g]), o.metricsNames.push(o.outputNames[g] + "_loss"));
        }
      });
      var v = G3e(r.metrics, this.outputNames), m = function(g, x, b) {
        o.outputNames.length > 1 && (x = o.outputNames[g] + "_" + x), o.metricsNames.push(x), o.metricsTensors.push([b, g]);
      };
      Km("metric", function() {
        for (var g = function(b) {
          if (d.indexOf(b) !== -1) return "continue";
          var y = v[b], w = function(_4) {
            var k, T2, A2 = "", S2, C2, E2, F13 = function(O2) {
              if (typeof O2 == "string" && ["accuracy", "acc", "crossentropy", "ce"].indexOf(O2) !== -1) {
                var L2 = o.internalOutputShapes[b];
                L2[L2.length - 1] === 1 || o.lossFunctions[b] === kk ? ["accuracy", "acc"].indexOf(O2) !== -1 ? C2 = _D : ["crossentropy", "ce"].indexOf(O2) !== -1 && (C2 = LV) : o.lossFunctions[b] === ak ? ["accuracy", "acc"].indexOf(O2) !== -1 ? C2 = RV : ["crossentropy", "ce"].indexOf(O2) !== -1 && (C2 = zV) : ["accuracy", "acc"].indexOf(O2) !== -1 ? C2 = wD : ["crossentropy", "ce"].indexOf(O2) !== -1 && (C2 = kD);
                var V2 = void 0;
                ["accuracy", "acc"].indexOf(O2) !== -1 ? V2 = "acc" : ["crossentropy", "ce"].indexOf(O2) !== -1 && (V2 = "ce"), E2 = C2, S2 = A2 + V2;
              } else {
                var W2 = x3e(O2);
                E2 = W2, S2 = A2 + H3(O2);
              }
              var X2;
              Km(S2, function() {
                X2 = E2;
              }), m(b, S2, X2);
            };
            try {
              for (var N2 = (k = void 0, Qn(_4)), D2 = N2.next(); !D2.done; D2 = N2.next()) {
                var I2 = D2.value;
                F13(I2);
              }
            } catch (O2) {
              k = { error: O2 };
            } finally {
              try {
                D2 && !D2.done && (T2 = N2.return) && T2.call(N2);
              } finally {
                if (k) throw k.error;
              }
            }
          };
          w(y);
        }, x = 0; x < o.outputs.length; ++x) g(x);
      }), this.collectedTrainableWeights = this.trainableWeights;
    }, t.prototype.checkTrainableWeightsConsistency = function() {
      this.collectedTrainableWeights != null && this.trainableWeights.length !== this.collectedTrainableWeights.length && console.warn("Discrepancy between trainableweights and collected trainable weights. Did you set `model.trainable` without calling `model.compile()` afterwards?");
    }, t.prototype.evaluate = function(r, n, a) {
      a === void 0 && (a = {});
      var o = a.batchSize == null ? 32 : a.batchSize;
      z5(o);
      var s = true, i = this.standardizeUserDataXY(r, n, s, o);
      try {
        var l = i[0].concat(i[1]);
        this.makeTestFunction();
        var u3 = this.testFunction, c = this.testLoop(u3, l, o, a.verbose, a.steps);
        return Nf(c);
      } finally {
        td(i[0], r), td(i[1], n);
      }
    }, t.prototype.evaluateDataset = function(r, n) {
      return Ni(this, void 0, void 0, function() {
        return Ei(this, function(a) {
          return this.makeTestFunction(), [2, z3e(this, r, n)];
        });
      });
    }, t.prototype.checkNumSamples = function(r, n, a, o) {
      o === void 0 && (o = "steps");
      var s;
      if (a != null) {
        if (s = null, n != null) throw new en("If " + o + " is set, batchSize must be null or undefined." + ("Got batchSize = " + n));
      } else if (r != null) Array.isArray(r) ? s = r[0].shape[0] : s = r.shape[0];
      else throw new en("Either the input data should have a defined shape, or " + (o + " shoud be specified."));
      return s;
    }, t.prototype.execute = function(r, n) {
      var a, o;
      if (Array.isArray(n) && n.length === 0) throw new en("`outputs` is an empty Array, which is not allowed.");
      var s = Array.isArray(n), i = s ? n : [n], l = this.retrieveSymbolicTensors(i), u3 = new py();
      if (r instanceof ur.Tensor && (r = [r]), Array.isArray(r)) {
        if (r.length !== this.inputs.length) throw new en("The number of inputs provided (" + r.length + ") does not match the number of inputs of this model " + ("(" + this.inputs.length + ")."));
        for (var c = 0; c < this.inputs.length; ++c) u3.add(this.inputs[c], r[c]);
      } else try {
        for (var f = Qn(this.inputs), h = f.next(); !h.done; h = f.next()) {
          var p = h.value, d = r[p.name];
          if (d == null) throw new en("No value is provided for the model's input " + p.name);
          u3.add(p, d);
        }
      } catch (m) {
        a = { error: m };
      } finally {
        try {
          h && !h.done && (o = f.return) && o.call(f);
        } finally {
          if (a) throw a.error;
        }
      }
      var v = n2(l, u3);
      return s ? v : v[0];
    }, t.prototype.retrieveSymbolicTensors = function(r) {
      var n, a, o = Jm(null, r.length), s = r.length;
      try {
        for (var i = Qn(this.layers), l = i.next(); !l.done; l = i.next()) {
          for (var u3 = l.value, c = Array.isArray(u3.output) ? u3.output : [u3.output], f = c.map(function(v) {
            return v.name;
          }), h = 0; h < r.length; ++h) {
            var p = f.indexOf(r[h]);
            if (p !== -1 && (o[h] = c[p], s--), s === 0) break;
          }
          if (s === 0) break;
        }
      } catch (v) {
        n = { error: v };
      } finally {
        try {
          l && !l.done && (a = i.return) && a.call(i);
        } finally {
          if (n) throw n.error;
        }
      }
      if (s > 0) {
        var d = [];
        throw o.forEach(function(v, m) {
          v == null && d.push(r[m]);
        }), new en("Cannot find SymbolicTensors for output name(s): " + ("" + JSON.stringify(d)));
      }
      return o;
    }, t.prototype.predictLoop = function(r, n, a) {
      var o = this;
      return n === void 0 && (n = 32), a === void 0 && (a = false), Wt.tidy(function() {
        var s = o.checkNumSamples(r);
        if (a) throw new ro("Verbose predictLoop() is not implemented yet.");
        for (var i = B5(s, n), l = o.outputs.map(function(f) {
          return [];
        }), u3 = function(f) {
          var h = Wt.tidy(function() {
            var p = i[f][0], d = i[f][1], v = a2(r, p, d), m = [];
            if (Array.isArray(v)) for (var g = 0; g < v.length; ++g) m.push({ key: o.inputs[g], value: v[g] });
            else m.push({ key: o.inputs[0], value: v });
            var x = new py(m);
            return n2(o.outputs, x);
          });
          h.forEach(function(p, d) {
            return l[d].push(p);
          });
        }, c = 0; c < i.length; ++c) u3(c);
        return Nf(l.map(function(f) {
          return Wt.concat(f, 0);
        }));
      });
    }, t.prototype.predict = function(r, n) {
      n === void 0 && (n = {});
      var a = WV(r);
      eU(a, this.inputNames, this.feedInputShapes, false);
      try {
        var o = n.batchSize == null ? 32 : n.batchSize;
        return z5(o), this.predictLoop(a, o);
      } finally {
        td(a, r);
      }
    }, t.prototype.predictOnBatch = function(r) {
      eU(r, this.inputNames, this.feedInputShapes, true);
      var n = (Array.isArray(r) ? r[0] : r).shape[0];
      return this.predictLoop(r, n);
    }, t.prototype.standardizeUserDataXY = function(r, n, a, o) {
      if (this.optimizer_ == null) throw new jd("You must compile a model before training/testing. Use LayersModel.compile(modelCompileArgs).");
      for (var s = [], i = 0; i < this.feedOutputShapes.length; ++i) {
        var l = this.feedOutputShapes[i], u3 = this.feedLossFns[i];
        u3 === ak ? s.push(l.slice(0, l.length - 1).concat([1])) : s.push(l);
      }
      if (r = QB(r, this.feedInputNames, this.feedInputShapes, false, "input"), n = QB(n, this.feedOutputNames, s, false, "target"), j3e(r, n), W3e(n, this.feedLossFns, this.feedOutputShapes), this.stateful && o != null && o > 0 && r[0].shape[0] % o !== 0) throw new en("In a stateful network, you should only pass inputs with a number of samples that is divisible by the batch size " + (o + ". Found: " + r[0].shape[0] + " sample(s)."));
      return [r, n];
    }, t.prototype.standardizeUserData = function(r, n, a, o, s, i) {
      return s === void 0 && (s = true), Ni(this, void 0, void 0, function() {
        var l, u3, c, f, h, p, d, v;
        return Ei(this, function(m) {
          switch (m.label) {
            case 0:
              if (l = pa(this.standardizeUserDataXY(r, n, s, i), 2), u3 = l[0], c = l[1], a != null) throw new Error("sample weight is not supported yet.");
              if (f = null, o == null) return [3, 4];
              h = UV(o, this.outputNames), f = [], p = 0, m.label = 1;
            case 1:
              return p < h.length ? (v = (d = f).push, [4, VV(c[p], null, h[p])]) : [3, 4];
            case 2:
              v.apply(d, [m.sent()]), m.label = 3;
            case 3:
              return ++p, [3, 1];
            case 4:
              return [2, [u3, c, f]];
          }
        });
      });
    }, t.prototype.testLoop = function(r, n, a, o, s) {
      var i = this;
      return o === void 0 && (o = 0), Wt.tidy(function() {
        var l = i.checkNumSamples(n, a, s, "steps"), u3 = [];
        if (o > 0) throw new ro("Verbose mode is not implemented yet.");
        if (s != null) throw new ro("steps mode in testLoop() is not implemented yet");
        for (var c = B5(l, a), f = ur.tensor1d(od(0, l)), h = 0; h < c.length; ++h) {
          var p = c[h][0], d = c[h][1], v = Ym(f, p, d - p), m = AD(n, v), g = r(m);
          if (h === 0) for (var x = 0; x < g.length; ++x) u3.push(ur.scalar(0));
          for (var x = 0; x < g.length; ++x) {
            var b = g[x];
            u3[x] = Wt.add(u3[x], Wt.mul(d - p, b));
          }
        }
        for (var x = 0; x < u3.length; ++x) u3[x] = Wt.div(u3[x], l);
        return u3;
      });
    }, t.prototype.getDedupedMetricsNames = function() {
      for (var r = this.metricsNames, n = [], a = 0; a < r.length; ++a) {
        var o = r[a], s = o;
        if (RB(r, o) > 1) {
          var i = RB(r.slice(0, a), o);
          s += "_" + i;
        }
        n.push(s);
      }
      return n;
    }, t.prototype.makeTrainFunction = function() {
      var r = this;
      return function(n) {
        var a = [], o = n.slice(0, r.inputs.length), s = n.slice(r.inputs.length, r.inputs.length + r.outputs.length), i = n.slice(r.inputs.length + r.outputs.length, r.inputs.length + r.outputs.length * 2), l = [], u3 = function() {
          for (var p = [], d = 0; d < r.inputs.length; ++d) p.push({ key: r.inputs[d], value: o[d] });
          for (var v = new py(p), m = n2(r.outputs, v, { training: true }), g, d = 0; d < r.lossFunctions.length; ++d) {
            var x = r.lossFunctions[d], b = x(s[d], m[d]);
            i[d] != null && (b = N3e(b, i[d]));
            var y = Wt.mean(b);
            a.push(y), d === 0 ? g = b : g = Wt.add(g, b);
          }
          for (var d = 0; d < r.metricsTensors.length; ++d) {
            var w = void 0;
            if (r.outputs.length > 1 && d < r.outputs.length) w = a[d];
            else {
              var _4 = r.metricsTensors[d][0], k = r.metricsTensors[d][1];
              w = Wt.mean(_4(s[k], m[k]));
            }
            Wt.keep(w), l.push(w);
          }
          return g = Wt.mean(g), r.calculateLosses().forEach(function(T2) {
            g = Wt.add(g, T2);
          }), g;
        }, c = r.collectedTrainableWeights.map(function(p) {
          return p.read();
        }), f = true, h = r.optimizer_.minimize(u3, f, c);
        return [h].concat(l);
      };
    }, t.prototype.makeTestFunction = function() {
      var r = this;
      this.testFunction = function(n) {
        return Wt.tidy(function() {
          for (var a = [], o, s = n.slice(0, r.inputs.length), i = n.slice(r.inputs.length, r.inputs.length + r.outputs.length), l = [], u3 = 0; u3 < r.inputs.length; ++u3) l.push({ key: r.inputs[u3], value: s[u3] });
          for (var c = new py(l), f = n2(r.outputs, c), u3 = 0; u3 < r.lossFunctions.length; ++u3) {
            var h = r.lossFunctions[u3], p = Wt.mean(h(i[u3], f[u3]));
            u3 === 0 ? o = p : o = Wt.add(o, p), a.push(o);
          }
          for (var u3 = 0; u3 < r.metricsTensors.length; ++u3) {
            var d = r.metricsTensors[u3][0], v = r.metricsTensors[u3][1], m = Wt.mean(d(i[v], f[v]));
            a.push(m);
          }
          return a;
        });
      };
    }, t.prototype.fit = function(r, n, a) {
      return a === void 0 && (a = {}), Ni(this, void 0, void 0, function() {
        return Ei(this, function(o) {
          return [2, U3e(this, r, n, a)];
        });
      });
    }, t.prototype.fitDataset = function(r, n) {
      return Ni(this, void 0, void 0, function() {
        return Ei(this, function(a) {
          return [2, P3e(this, r, n)];
        });
      });
    }, t.prototype.trainOnBatch = function(r, n) {
      return Ni(this, void 0, void 0, function() {
        var a, o, s, i, l, u3, c, f, h, p, d, v, m;
        return Ei(this, function(g) {
          switch (g.label) {
            case 0:
              return [4, this.standardizeUserData(r, n)];
            case 1:
              a = g.sent(), o = a[0], s = a[1], i = this.makeTrainFunction(), l = i(o.concat(s)), u3 = [], g.label = 2;
            case 2:
              g.trys.push([2, 7, 8, 9]), c = Qn(l), f = c.next(), g.label = 3;
            case 3:
              return f.done ? [3, 6] : (h = f.value, [4, h.data()]);
            case 4:
              p = g.sent(), u3.push(p[0]), g.label = 5;
            case 5:
              return f = c.next(), [3, 3];
            case 6:
              return [3, 9];
            case 7:
              return d = g.sent(), v = { error: d }, [3, 9];
            case 8:
              try {
                f && !f.done && (m = c.return) && m.call(c);
              } finally {
                if (v) throw v.error;
              }
              return [7];
            case 9:
              return Wt.dispose(l), td(a[0], r), td(a[1], n), [2, Nf(u3)];
          }
        });
      });
    }, t.prototype.getNamedWeights = function(r) {
      for (var n = [], a = r != null && r.trainableOnly, o = a ? this.trainableWeights : this.weights, s = this.getWeights(a), i = 0; i < o.length; ++i) a && !o[i].trainable || n.push({ name: o[i].originalName, tensor: s[i] });
      return n;
    }, Object.defineProperty(t.prototype, "stopTraining", { get: function() {
      return this.stopTraining_;
    }, set: function(r) {
      this.stopTraining_ = r;
    }, enumerable: true, configurable: true }), Object.defineProperty(t.prototype, "optimizer", { get: function() {
      return this.optimizer_;
    }, set: function(r) {
      this.optimizer_ !== r && (this.optimizer_ = r, this.isOptimizerOwned = false);
    }, enumerable: true, configurable: true }), t.prototype.dispose = function() {
      var r = e.prototype.dispose.call(this);
      if (r.refCountAfterDispose === 0 && this.optimizer != null && this.isOptimizerOwned) {
        var n = Wt.memory().numTensors;
        this.optimizer_.dispose(), r.numDisposedVariables += n - Wt.memory().numTensors;
      }
      return r;
    }, t.prototype.getLossIdentifiers = function() {
      var r, n, a, o, s;
      if (typeof this.loss == "string") s = _0(this.loss);
      else if (Array.isArray(this.loss)) {
        try {
          for (var i = Qn(this.loss), l = i.next(); !l.done; l = i.next()) {
            var u3 = l.value;
            if (typeof u3 != "string") throw new Error("Serialization of non-string loss is not supported.");
          }
        } catch (v) {
          r = { error: v };
        } finally {
          try {
            l && !l.done && (n = i.return) && n.call(i);
          } finally {
            if (r) throw r.error;
          }
        }
        s = this.loss.map(function(v) {
          return _0(v);
        });
      } else {
        var c = Object.keys(this.loss);
        s = {};
        var f = this.loss;
        try {
          for (var h = Qn(c), p = h.next(); !p.done; p = h.next()) {
            var d = p.value;
            if (typeof f[d] == "string") s[d] = _0(f[d]);
            else throw new Error("Serialization of non-string loss is not supported.");
          }
        } catch (v) {
          a = { error: v };
        } finally {
          try {
            p && !p.done && (o = h.return) && o.call(h);
          } finally {
            if (a) throw a.error;
          }
        }
      }
      return s;
    }, t.prototype.getMetricIdentifiers = function() {
      if (typeof this.metrics == "string" || typeof this.metrics == "function") return [_0(H3(this.metrics))];
      if (Array.isArray(this.metrics)) return this.metrics.map(function(a) {
        return _0(H3(a));
      });
      var r = {};
      for (var n in this.metrics) r[n] = _0(H3(this.metrics[n]));
      return r;
    }, t.prototype.getTrainingConfig = function() {
      return { loss: this.getLossIdentifiers(), metrics: this.getMetricIdentifiers(), optimizer_config: { class_name: this.optimizer.getClassName(), config: this.optimizer.getConfig() } };
    }, t.prototype.loadTrainingConfig = function(r) {
      if (r.weighted_metrics != null) throw new Error("Loading weight_metrics is not supported yet.");
      if (r.loss_weights != null) throw new Error("Loading loss_weights is not supported yet.");
      if (r.sample_weight_mode != null) throw new Error("Loading sample_weight_mode is not supported yet.");
      var n = l2(r.optimizer_config), a = nd(n), o;
      if (typeof r.loss == "string") o = qm(r.loss);
      else if (Array.isArray(r.loss)) o = r.loss.map(function(l) {
        return qm(l);
      });
      else if (r.loss != null) {
        o = {};
        for (var s in r.loss) o[s] = qm(r.loss[s]);
      }
      var i;
      if (Array.isArray(r.metrics)) i = r.metrics.map(function(l) {
        return qm(l);
      });
      else if (r.metrics != null) {
        i = {};
        for (var s in r.metrics) i[s] = qm(r.metrics[s]);
      }
      this.compile({ loss: o, metrics: i, optimizer: a });
    }, t.prototype.save = function(r, n) {
      return Ni(this, void 0, void 0, function() {
        var a, o, s, i, l, u3, c, f, h, p, d, v, m, g, x;
        return Ei(this, function(b) {
          switch (b.label) {
            case 0:
              if (typeof r == "string") {
                if (a = ur.io.getSaveHandlers(r), a.length === 0) throw new en("Cannot find any save handlers for URL '" + r + "'");
                if (a.length > 1) throw new en("Found more than one (" + a.length + ") save handlers for " + ("URL '" + r + "'"));
                r = a[0];
              }
              if (r.save == null) throw new en("LayersModel.save() cannot proceed because the IOHandler provided does not have the `save` attribute defined.");
              return [4, ur.io.encodeWeights(this.getNamedWeights(n))];
            case 1:
              return o = b.sent(), s = false, i = null, l = this.toJSON(i, s), u3 = { modelTopology: l, format: $3e, generatedBy: "TensorFlow.js tfjs-layers v" + TD, convertedBy: null }, c = n == null ? false : n.includeOptimizer, c && this.optimizer != null ? (u3.trainingConfig = this.getTrainingConfig(), f = "optimizer", m = (v = ur.io).encodeWeights, [4, this.optimizer.getWeights()]) : [3, 4];
            case 2:
              return [4, m.apply(v, [b.sent(), f])];
            case 3:
              h = b.sent(), p = h.data, d = h.specs, (x = o.specs).push.apply(x, bo(d)), o.data = ur.io.concatenateArrayBuffers([o.data, p]), b.label = 4;
            case 4:
              return this.userDefinedMetadata != null && (g = true, qB(this.userDefinedMetadata, this.name, g), u3.userDefinedMetadata = this.userDefinedMetadata), u3.weightData = o.data, u3.weightSpecs = o.specs, [2, r.save(u3)];
          }
        });
      });
    }, t.prototype.setUserDefinedMetadata = function(r) {
      qB(r, this.name), this.userDefinedMetadata = r;
    }, t.prototype.getUserDefinedMetadata = function() {
      return this.userDefinedMetadata;
    }, t;
  }(M3e);
  w0.className = "Model";
  ur.serialization.registerClass(w0);
  var GV = function(e) {
    Hn(t, e);
    function t() {
      return e !== null && e.apply(this, arguments) || this;
    }
    return t;
  }(w0);
  GV.className = "Functional";
  ur.serialization.registerClass(GV);
  function H3e(e, t) {
    return Ni(this, void 0, void 0, function() {
      var r, n, a, o, s, i, l, u3, c, f;
      return Ei(this, function(h) {
        switch (h.label) {
          case 0:
            return "modelTopology" in e || (e = { modelTopology: e }), e = e, r = e.modelTopology, r.model_config != null && (r = r.model_config), n = l2(r), a = nd(n, t), e.weightsManifest == null ? [3, 2] : [4, ur.io.loadWeights(e.weightsManifest, e.pathPrefix, a.weights.map(function(p) {
              return p.originalName;
            }))];
          case 1:
            o = h.sent(), s = {};
            try {
              for (i = Qn(a.weights), l = i.next(); !l.done; l = i.next()) u3 = l.value, s[u3.originalName] = o[u3.originalName];
            } catch (p) {
              c = { error: p };
            } finally {
              try {
                l && !l.done && (f = i.return) && f.call(i);
              } finally {
                if (c) throw c.error;
              }
            }
            a.loadWeights(s), ur.dispose(o), h.label = 2;
          case 2:
            return [2, a];
        }
      });
    });
  }
  function q3e(e, t) {
    return Ni(this, void 0, void 0, function() {
      var r;
      return Ei(this, function(n) {
        if (t == null && (t = {}), typeof e == "string") {
          if (r = ur.io.getLoadHandlers(e, t), r.length === 0) r.push(ur.io.browserHTTPRequest(e, t));
          else if (r.length > 1) throw new en("Found more than one (" + r.length + ") load handlers for " + ("URL '" + e + "'"));
          e = r[0];
        }
        return [2, X3e(e, void 0, t)];
      });
    });
  }
  function X3e(e, t, r) {
    return Ni(this, void 0, void 0, function() {
      var n, a, o, s, i, l, u3, c, f;
      return Ei(this, function(h) {
        switch (h.label) {
          case 0:
            if (r == null && (r = {}), e.load == null) throw new en("Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.");
            return [4, e.load()];
          case 1:
            if (n = h.sent(), a = n.modelTopology, a.model_config != null && (a = a.model_config), o = r.strict == null ? true : r.strict, s = n.weightData != null && n.weightSpecs != null && o, i = nd(l2(a), t, s), l = n.trainingConfig, l != null && i.loadTrainingConfig(l), n.userDefinedMetadata != null && i.setUserDefinedMetadata(n.userDefinedMetadata), n.weightData == null) return [3, 4];
            if (n.weightSpecs == null) throw new en("LayersModel artifacts contains weight data, but not weight specs. Therefore loading of weights cannot proceed.");
            return u3 = K3e(n.weightData, n.weightSpecs), c = u3.modelWeights, f = u3.optimizerWeights, i.loadWeights(c, o), i.optimizer != null && f.length > 0 ? [4, i.optimizer.setWeights(f)] : [3, 3];
          case 2:
            h.sent(), h.label = 3;
          case 3:
            ur.dispose(c), ur.dispose(f.map(function(p) {
              return p.tensor;
            })), h.label = 4;
          case 4:
            return [2, i];
        }
      });
    });
  }
  function K3e(e, t) {
    var r = ur.io.decodeWeights(e, t), n = {}, a = [];
    return t.forEach(function(o) {
      o.group === "optimizer" ? a.push({ name: o.name, tensor: r[o.name] }) : n[o.name] = r[o.name];
    }), { modelWeights: n, optimizerWeights: a };
  }
  var Tk = function(e) {
    Hn(t, e);
    function t(r) {
      var n, a, o = e.call(this, { inputs: [], outputs: [] }) || this;
      if (r = r || {}, o.trainable = true, o.built = false, o.name = r.name != null ? r.name : bk("sequential_"), r.layers != null) try {
        for (var s = Qn(r.layers), i = s.next(); !i.done; i = s.next()) {
          var l = i.value;
          o.add(l);
        }
      } catch (u3) {
        n = { error: u3 };
      } finally {
        try {
          i && !i.done && (a = s.return) && a.call(s);
        } finally {
          if (n) throw n.error;
        }
      }
      return o;
    }
    return t.prototype.checkShape = function(r) {
      var n = r.inboundNodes[0].outputTensors[0].shape;
      if (n.some(function(a) {
        return a < 0;
      })) throw new en("Negative dimension size caused by adding layer " + (r.name + " with input shape [") + (r.inboundNodes[0].inputTensors[0].shape + "]"));
    }, t.prototype.add = function(r) {
      var n = r instanceof t || r instanceof w0, a;
      if (n) {
        if (a = r, a.outputs.length !== 1) throw new en("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");
        if (a.inputs.length !== 1) throw new en("All layers in a Sequential model should have a single input tensor. For multi-input layers, use the functional API.");
      }
      if (this.outputs.length === 0) {
        if (r.inboundNodes.length === 0) {
          if (r.batchInputShape == null) throw new en("The first layer in a Sequential model must get an `inputShape` or `batchInputShape` argument.");
          var o = EV({ batchShape: r.batchInputShape, dtype: r.dtype, name: r.name + "_input" });
          r.apply(o);
        }
        if (n) this.outputs = a.outputs, this.inputs = a.inputs;
        else {
          if (r.inboundNodes.length !== 1) throw new en("A layer added to a Sequential model must not already be " + ("connected somewhere else. LayersModel received layer " + r.name + " ") + ("which has " + r.inboundNodes.length + " pre-existing inbound ") + "connections.");
          if (r.inboundNodes[0].outputTensors.length !== 1) throw new en("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");
          this.checkShape(r), this.outputs = [r.inboundNodes[0].outputTensors[0]], this.inputs = SV(this.outputs[0]);
        }
        this.inboundNodes = [], new _k({ outboundLayer: this, inboundLayers: [], nodeIndices: [], tensorIndices: [], inputTensors: this.inputs, outputTensors: this.outputs, inputMasks: Jm(null, this.inputs.length), outputMasks: [null], inputShapes: this.inputs.map(function(i) {
          return i.shape;
        }), outputShapes: this.outputs[0].shape });
      } else {
        var s = r.apply(this.outputs[0]);
        if (Array.isArray(s)) throw new TypeError("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");
        this.checkShape(r), this.outputs = [s], this.inboundNodes[0].outputTensors = this.outputs, this.inboundNodes[0].outputShapes = [this.outputs[0].shape];
      }
      this.layers.push(r), this.built = false;
    }, t.prototype.pop = function() {
      if (this.layers.length === 0) throw new TypeError("There are no layers in the model.");
      if (this.layers.pop(), this.layers.length === 0) this.outputs = [], this.inboundNodes = [], this.outboundNodes = [];
      else {
        var r = this.layers.length - 1;
        this.layers[r].outboundNodes = [], this.outputs = [this.layers[r].output], this.inboundNodes[0].outputTensors = this.outputs, this.inboundNodes[0].outputShapes = [this.outputs[0].shape];
      }
    }, t.prototype.call = function(r, n) {
      return this.model == null && this.build(), this.model.call(r, n);
    }, t.prototype.build = function(r) {
      if (bs(r), this.inputs.length === 0 || this.outputs.length === 0) throw new TypeError("Sequential model cannot be built: model is empty. Add some layers first.");
      this.model = new w0({ inputs: this.inputs, outputs: this.outputs[0], name: this.name + "_model" }), this.model.trainable = this.trainable, this.supportsMasking = this.model.supportsMasking, this.inputLayers = this.model.inputLayers, this.inputLayersNodeIndices = this.model.inputLayersNodeIndices, this.inputLayersTensorIndices = this.model.inputLayersTensorIndices, this.outputLayers = this.model.outputLayers, this.outputLayersNodeIndices = this.model.outputLayersNodeIndices, this.outputLayersTensorIndices = this.model.outputLayersTensorIndices, this.nodesByDepth = this.model.nodesByDepth, this.containerNodes = this.model.containerNodes, this.outputNames = this.model.outputNames, this.inputNames = this.model.inputNames, this.built = true;
    }, t.prototype.countParams = function() {
      return this.built || this.build(), e.prototype.countParams.call(this);
    }, t.prototype.summary = function(r, n, a) {
      a === void 0 && (a = console.log), this.built || this.build(), e.prototype.summary.call(this, r, n, a);
    }, t.prototype.setWeights = function(r) {
      this.model == null && this.build(), this.model.setWeights(r);
    }, t.prototype.evaluate = function(r, n, a) {
      if (a === void 0 && (a = {}), !this.built) throw new jd("The model needs to be compiled before being used.");
      return this.model.evaluate(r, n, a);
    }, t.prototype.evaluateDataset = function(r, n) {
      return Ni(this, void 0, void 0, function() {
        return Ei(this, function(a) {
          if (!this.built) throw new jd("The model needs to be compiled before being used.");
          return [2, this.model.evaluateDataset(r, n)];
        });
      });
    }, t.prototype.predict = function(r, n) {
      return n === void 0 && (n = {}), this.model == null && this.build(), this.model.predict(r, n);
    }, t.prototype.predictOnBatch = function(r) {
      return this.model == null && this.build(), this.model.predictOnBatch(r);
    }, t.prototype.compile = function(r) {
      this.build(), this.model.compile(r), this.optimizer_ = this.model.optimizer, this.isOptimizerOwned = this.model.isOptimizerOwned, this.loss = this.model.loss, this.metrics = this.model.metrics, this.metricsTensors = this.model.metricsTensors, this.metricsNames = this.model.metricsNames;
    }, Object.defineProperty(t.prototype, "optimizer", { get: function() {
      return this.model == null ? void 0 : this.model.optimizer;
    }, set: function(r) {
      this.model.optimizer = r;
    }, enumerable: true, configurable: true }), t.prototype.fit = function(r, n, a) {
      return a === void 0 && (a = {}), Ni(this, void 0, void 0, function() {
        return Ei(this, function(o) {
          if (!this.built) throw new jd("The model needs to be compiled before being used.");
          return [2, this.model.fit(r, n, a)];
        });
      });
    }, t.prototype.fitDataset = function(r, n) {
      return Ni(this, void 0, void 0, function() {
        return Ei(this, function(a) {
          if (!this.built) throw new jd("The model needs to be compiled before being used.");
          return [2, this.model.fitDataset(r, n)];
        });
      });
    }, t.prototype.trainOnBatch = function(r, n) {
      return Ni(this, void 0, void 0, function() {
        return Ei(this, function(a) {
          return [2, this.model.trainOnBatch(r, n)];
        });
      });
    }, t.fromConfig = function(r, n, a, o) {
      var s, i;
      o === void 0 && (o = false);
      var l, u3 = {};
      if (n instanceof Array) {
        if (n[0].className == null || n[0].className === "Merge") throw new en("Legacy serialization format not supported yet.");
        l = n;
      } else ur.util.assert(n.layers != null, function() {
        return "When the config data for a Sequential model is not an Array, it must be an Object that contains the 'layers' field.";
      }), l = n.layers, delete n.layers, u3 = n;
      var c = new r(u3);
      if (!(c instanceof t)) throw new ro("Sequential.fromConfig called on non-Sequential input: " + c);
      try {
        for (var f = Qn(l), h = f.next(); !h.done; h = f.next()) {
          var p = h.value, d = void 0, v = nd(p, d, o);
          o && v.setFastWeightInitDuringBuild(true), c.add(v);
        }
      } catch (m) {
        s = { error: m };
      } finally {
        try {
          h && !h.done && (i = f.return) && i.call(f);
        } finally {
          if (s) throw s.error;
        }
      }
      return c;
    }, Object.defineProperty(t.prototype, "stopTraining", { get: function() {
      if (this.model == null) throw new en("Cannot get the stopTraining property of a sequential model before it is compiled.");
      return this.model.stopTraining;
    }, set: function(r) {
      if (this.model == null) throw new en("Cannot set the stopTraining property of a sequential model before it is compiled.");
      this.model.stopTraining = r;
    }, enumerable: true, configurable: true }), t.prototype.getConfig = function() {
      var r, n, a = [];
      try {
        for (var o = Qn(this.layers), s = o.next(); !s.done; s = o.next()) {
          var i = s.value, l = {};
          l.className = i.getClassName(), l.config = i.getConfig(), a.push(l);
        }
      } catch (u3) {
        r = { error: u3 };
      } finally {
        try {
          s && !s.done && (n = o.return) && n.call(o);
        } finally {
          if (r) throw r.error;
        }
      }
      return { name: this.name, layers: a };
    }, t;
  }(w0);
  Tk.className = "Sequential";
  ur.serialization.registerClass(Tk);
  function Y3e(e) {
    return new w0(e);
  }
  function Z3e(e) {
    return new Tk(e);
  }
  function J3e(e, t) {
    return t == null && (t = {}), q3e(e, t);
  }
  function $V(e) {
    return EV(e);
  }
  function Q3e(e, t) {
    xD.registerCallbackConstructor(e, t);
  }
  var Of = function(e) {
    Hn(t, e);
    function t() {
      return e !== null && e.apply(this, arguments) || this;
    }
    return t.prototype.getConfig = function() {
      return {};
    }, t;
  }(ur.serialization.Serializable), HV = function(e) {
    Hn(t, e);
    function t() {
      return e !== null && e.apply(this, arguments) || this;
    }
    return t.prototype.apply = function(r, n) {
      return n === void 0 && (n = 1), kwe(r, n);
    }, t;
  }(Of);
  HV.className = "elu";
  ur.serialization.registerClass(HV);
  var qV = function(e) {
    Hn(t, e);
    function t() {
      return e !== null && e.apply(this, arguments) || this;
    }
    return t.prototype.apply = function(r) {
      return Wt.selu(r);
    }, t;
  }(Of);
  qV.className = "selu";
  ur.serialization.registerClass(qV);
  var XV = function(e) {
    Hn(t, e);
    function t() {
      return e !== null && e.apply(this, arguments) || this;
    }
    return t.prototype.apply = function(r) {
      return Wt.relu(r);
    }, t;
  }(Of);
  XV.className = "relu";
  ur.serialization.registerClass(XV);
  var KV = function(e) {
    Hn(t, e);
    function t() {
      return e !== null && e.apply(this, arguments) || this;
    }
    return t.prototype.apply = function(r) {
      return ur.tidy(function() {
        return Wt.minimum(6, Wt.relu(r));
      });
    }, t;
  }(Of);
  KV.className = "relu6";
  ur.serialization.registerClass(KV);
  var YV = function(e) {
    Hn(t, e);
    function t() {
      return e !== null && e.apply(this, arguments) || this;
    }
    return t.prototype.apply = function(r) {
      return r;
    }, t;
  }(Of);
  YV.className = "linear";
  ur.serialization.registerClass(YV);
  var ZV = function(e) {
    Hn(t, e);
    function t() {
      return e !== null && e.apply(this, arguments) || this;
    }
    return t.prototype.apply = function(r) {
      return Wt.sigmoid(r);
    }, t;
  }(Of);
  ZV.className = "sigmoid";
  ur.serialization.registerClass(ZV);
  var JV = function(e) {
    Hn(t, e);
    function t() {
      return e !== null && e.apply(this, arguments) || this;
    }
    return t.prototype.apply = function(r) {
      return Awe(r);
    }, t;
  }(Of);
  JV.className = "hardSigmoid";
  ur.serialization.registerClass(JV);
  var QV = function(e) {
    Hn(t, e);
    function t() {
      return e !== null && e.apply(this, arguments) || this;
    }
    return t.prototype.apply = function(r) {
      return Wt.softplus(r);
    }, t;
  }(Of);
  QV.className = "softplus";
  ur.serialization.registerClass(QV);
  var ej = function(e) {
    Hn(t, e);
    function t() {
      return e !== null && e.apply(this, arguments) || this;
    }
    return t.prototype.apply = function(r) {
      return Twe(r);
    }, t;
  }(Of);
  ej.className = "softsign";
  ur.serialization.registerClass(ej);
  var tj = function(e) {
    Hn(t, e);
    function t() {
      return e !== null && e.apply(this, arguments) || this;
    }
    return t.prototype.apply = function(r) {
      return Wt.tanh(r);
    }, t;
  }(Of);
  tj.className = "tanh";
  ur.serialization.registerClass(tj);
  var SD = function(e) {
    Hn(t, e);
    function t() {
      return e !== null && e.apply(this, arguments) || this;
    }
    return t.prototype.apply = function(r, n) {
      return n === void 0 && (n = -1), Wt.softmax(r, n);
    }, t;
  }(Of);
  SD.className = "softmax";
  ur.serialization.registerClass(SD);
  var rj = function(e) {
    Hn(t, e);
    function t() {
      return e !== null && e.apply(this, arguments) || this;
    }
    return t.prototype.apply = function(r, n) {
      return n === void 0 && (n = -1), Wt.logSoftmax(r, n);
    }, t;
  }(Of);
  rj.className = "logSoftmax";
  ur.serialization.registerClass(rj);
  var nj = function(e) {
    Hn(t, e);
    function t() {
      return e !== null && e.apply(this, arguments) || this;
    }
    return t.prototype.apply = function(r, n) {
      return n === void 0 && (n = 1), ur.tidy(function() {
        return Wt.mul(Wt.sigmoid(Wt.mul(r, n)), r);
      });
    }, t;
  }(Of);
  nj.className = "swish";
  ur.serialization.registerClass(nj);
  var aj = function(e) {
    Hn(t, e);
    function t() {
      return e !== null && e.apply(this, arguments) || this;
    }
    return t.prototype.apply = function(r) {
      return ur.tidy(function() {
        return Wt.mul(r, Wt.tanh(Wt.softplus(r)));
      });
    }, t;
  }(Of);
  aj.className = "mish";
  ur.serialization.registerClass(aj);
  function Sv(e) {
    return e.getClassName();
  }
  function _5(e, t) {
    return t === void 0 && (t = {}), h2(e, ur.serialization.SerializationMap.getMap().classNameMap, t, "activation");
  }
  function Ev(e) {
    if (e == null) {
      var t = {};
      return t.className = "linear", t.config = {}, _5(t);
    }
    if (typeof e == "string") {
      var t = {};
      return t.className = e, t.config = {}, _5(t);
    } else return e instanceof Of ? e : _5(e);
  }
  function ED(e) {
    if (e != null && typeof e != "object") throw new Error("Argument to L1L2 regularizer's constructor is expected to be an " + ("object, but received: " + e));
  }
  var ij = function(e) {
    Hn(t, e);
    function t() {
      return e !== null && e.apply(this, arguments) || this;
    }
    return t;
  }(ur.serialization.Serializable), g2 = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this) || this;
      return ED(r), n.l1 = r == null || r.l1 == null ? 0.01 : r.l1, n.l2 = r == null || r.l2 == null ? 0.01 : r.l2, n.hasL1 = n.l1 !== 0, n.hasL2 = n.l2 !== 0, n;
    }
    return t.prototype.apply = function(r) {
      var n = this;
      return ur.tidy(function() {
        var a = ur.zeros([1]);
        return n.hasL1 && (a = ur.add(a, ur.sum(Wt.mul(n.l1, ur.abs(r))))), n.hasL2 && (a = ur.add(a, ur.sum(Wt.mul(n.l2, v2(r))))), Wt.reshape(a, []);
      });
    }, t.prototype.getConfig = function() {
      return { l1: this.l1, l2: this.l2 };
    }, t.fromConfig = function(r, n) {
      return new r({ l1: n.l1, l2: n.l2 });
    }, t;
  }(ij);
  g2.className = "L1L2";
  ur.serialization.registerClass(g2);
  function eke(e) {
    return ED(e), new g2({ l1: e != null ? e.l1 : null, l2: 0 });
  }
  function tke(e) {
    return ED(e), new g2({ l2: e != null ? e.l2 : null, l1: 0 });
  }
  var tU = { l1l2: "L1L2" };
  function Gs(e) {
    return nD(e);
  }
  function rU(e, t) {
    return t === void 0 && (t = {}), h2(e, ur.serialization.SerializationMap.getMap().classNameMap, t, "regularizer");
  }
  function Nl(e) {
    if (e == null) return null;
    if (typeof e == "string") {
      var t = e in tU ? tU[e] : e, r = { className: t, config: {} };
      return rU(r);
    } else return e instanceof ij ? e : rU(e);
  }
  var DD = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r ?? {}) || this;
      return n.supportsMasking = true, r != null && (n.maxValue = r.maxValue), n;
    }
    return t.prototype.call = function(r, n) {
      r = no(r);
      var a = ur.relu(r);
      return this.maxValue != null && (a = ur.clipByValue(a, 0, this.maxValue)), a;
    }, t.prototype.computeOutputShape = function(r) {
      return r;
    }, t.prototype.getConfig = function() {
      var r = { maxValue: this.maxValue }, n = e.prototype.getConfig.call(this);
      return Object.assign(r, n), r;
    }, t;
  }(Wo);
  DD.className = "ReLU";
  ur.serialization.registerClass(DD);
  var CD = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r ?? {}) || this;
      return n.DEFAULT_ALPHA = 0.3, r == null && (r = {}), n.alpha = r.alpha == null ? n.DEFAULT_ALPHA : r.alpha, n;
    }
    return t.prototype.call = function(r, n) {
      var a = no(r);
      return ur.leakyRelu(a, this.alpha);
    }, t.prototype.computeOutputShape = function(r) {
      return r;
    }, t.prototype.getConfig = function() {
      var r = { alpha: this.alpha }, n = e.prototype.getConfig.call(this);
      return Object.assign(r, n), r;
    }, t;
  }(Wo);
  CD.className = "LeakyReLU";
  ur.serialization.registerClass(CD);
  var MD = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r ?? {}) || this;
      if (n.DEFAULT_ALPHA_INITIALIZER = "zeros", r == null && (r = {}), n.supportsMasking = true, n.alphaInitializer = Il(r.alphaInitializer || n.DEFAULT_ALPHA_INITIALIZER), n.alphaRegularizer = Nl(r.alphaRegularizer), n.alphaConstraint = $u(r.alphaConstraint), r.sharedAxes == null) n.sharedAxes = null;
      else if (Array.isArray(r.sharedAxes)) n.sharedAxes = r.sharedAxes;
      else if (typeof r.sharedAxes == "number") n.sharedAxes = [r.sharedAxes];
      else throw new en("Expected sharedAxes to be a number or an array of numbers, " + ("but got " + r.sharedAxes));
      return n;
    }
    return t.prototype.build = function(r) {
      var n, a;
      r = bs(r);
      var o = r.slice(1);
      if (this.sharedAxes != null) try {
        for (var s = Qn(this.sharedAxes), i = s.next(); !i.done; i = s.next()) {
          var l = i.value;
          o[l - 1] = 1;
        }
      } catch (c) {
        n = { error: c };
      } finally {
        try {
          i && !i.done && (a = s.return) && a.call(s);
        } finally {
          if (n) throw n.error;
        }
      }
      this.alpha = this.addWeight("alpha", o, "float32", this.alphaInitializer, this.alphaRegularizer, true, this.alphaConstraint);
      var u3 = {};
      if (this.sharedAxes != null) for (var l = 1; l < r.length; ++l) u3[l] = r[l];
      this.inputSpec = [new Cu({ ndim: r.length, axes: u3 })], this.built = true;
    }, t.prototype.call = function(r, n) {
      return r = no(r), ur.prelu(r, this.alpha.read());
    }, t.prototype.getConfig = function() {
      var r = { alphaInitializer: Vl(this.alphaInitializer), alphaRegularizer: Gs(this.alphaRegularizer), alphaConstraint: Gu(this.alphaConstraint), sharedAxes: this.sharedAxes }, n = e.prototype.getConfig.call(this);
      return Object.assign(r, n), r;
    }, t;
  }(Wo);
  MD.className = "PReLU";
  ur.serialization.registerClass(MD);
  var ID2 = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r ?? {}) || this;
      if (n.DEFAULT_ALPHA = 1, r == null && (r = {}), r.alpha != null && r.alpha !== n.DEFAULT_ALPHA) throw new ro("Non-default alpha value (" + r.alpha + ") is not supported by the ELU layer yet.");
      return n.alpha = r.alpha == null ? n.DEFAULT_ALPHA : r.alpha, n;
    }
    return t.prototype.call = function(r, n) {
      var a = no(r);
      return ur.elu(a);
    }, t.prototype.computeOutputShape = function(r) {
      return r;
    }, t.prototype.getConfig = function() {
      var r = { alpha: this.alpha }, n = e.prototype.getConfig.call(this);
      return Object.assign(r, n), r;
    }, t;
  }(Wo);
  ID2.className = "ELU";
  ur.serialization.registerClass(ID2);
  var ND = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r ?? {}) || this;
      return n.DEFAULT_THETA = 1, r == null && (r = {}), n.theta = r.theta == null ? n.DEFAULT_THETA : r.theta, n;
    }
    return t.prototype.call = function(r, n) {
      var a = no(r);
      return ur.mul(a, ur.cast(ur.greater(a, this.theta), "float32"));
    }, t.prototype.computeOutputShape = function(r) {
      return r;
    }, t.prototype.getConfig = function() {
      var r = { theta: this.theta }, n = e.prototype.getConfig.call(this);
      return Object.assign(r, n), r;
    }, t;
  }(Wo);
  ND.className = "ThresholdedReLU";
  ur.serialization.registerClass(ND);
  var FD = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r ?? {}) || this;
      return n.DEFAULT_AXIS = 1, r == null && (r = {}), n.softmax = new SD().apply, n.axis = r.axis == null ? n.DEFAULT_AXIS : r.axis, n;
    }
    return t.prototype.call = function(r, n) {
      var a = no(r);
      return this.softmax(a, this.axis);
    }, t.prototype.computeOutputShape = function(r) {
      return r;
    }, t.prototype.getConfig = function() {
      var r = { axis: this.axis }, n = e.prototype.getConfig.call(this);
      return Object.assign(r, n), r;
    }, t;
  }(Wo);
  FD.className = "Softmax";
  ur.serialization.registerClass(FD);
  function dy(e, t, r) {
    if (typeof e == "number") return Jm(e, t);
    if (e.length !== t) throw new en("The " + r + " argument must be an integer or tuple of " + t + " integers." + (" Received: " + e.length + " elements."));
    for (var n = 0; n < t; ++n) {
      var a = e[n];
      if (!xwe(a)) throw new en("The " + r + " argument must be an integer or tuple of " + t + (" integers. Received: " + JSON.stringify(e) + " including a") + (" non-integer number " + a));
    }
    return e;
  }
  function ad(e, t, r, n, a) {
    if (a === void 0 && (a = 1), e == null) return e;
    var o = t + (t - 1) * (a - 1), s;
    return r === "same" ? s = e : s = e - o + 1, Math.floor((s + n - 1) / n);
  }
  function Ud(e, t, r, n) {
    if (e == null) return null;
    if (n === "valid") e = e * t + Av([r - t, 0]);
    else if (n === "same") e = e * t;
    else throw new en("Unsupport padding mode: " + n + ".");
    return e;
  }
  function OD(e, t) {
    return ur.tidy(function() {
      return pu(t), t === "channelsFirst" ? Wt.transpose(e, [0, 2, 3, 1]) : e;
    });
  }
  function oj(e, t) {
    return ur.tidy(function() {
      return pu(t), t === "channelsFirst" ? Wt.transpose(e, [0, 2, 3, 4, 1]) : e;
    });
  }
  function rke(e, t, r, n, a, o, s) {
    return n === void 0 && (n = 1), a === void 0 && (a = "valid"), s === void 0 && (s = 1), ur.tidy(function() {
      if (o == null && (o = id()), pu(o), e.shape.length !== 3) throw new en("The input of a conv1dWithBias operation should be 3, but is " + (e.shape.length + " instead."));
      if (t.shape.length !== 3) throw new en("The kernel for a conv1dWithBias operation should be 3, but is " + (t.shape.length + " instead"));
      if (r != null && r.shape.length !== 1) throw new en("The bias for a conv1dWithBias operation should be 1, but is " + (t.shape.length + " instead"));
      if (o === "channelsFirst" && (e = Wt.transpose(e, [0, 2, 1])), a === "causal") throw new ro("The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.");
      var i = Wt.conv1d(e, t, n, a === "same" ? "same" : "valid", "NWC", s);
      return r != null && (i = ud(i, r)), i;
    });
  }
  function nU(e, t, r, n, a, o, s, i) {
    return n === void 0 && (n = [1, 1]), a === void 0 && (a = "valid"), i === void 0 && (i = null), ur.tidy(function() {
      if (o == null && (o = id()), pu(o), e.rank !== 3 && e.rank !== 4) throw new en("conv2dWithBiasActivation expects input to be of rank 3 or 4, " + ("but received " + e.rank + "."));
      if (t.rank !== 3 && t.rank !== 4) throw new en("conv2dWithBiasActivation expects kernel to be of rank 3 or 4, " + ("but received " + e.rank + "."));
      var l = OD(e, o);
      if (a === "causal") throw new ro("The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.");
      return l = Wt.fused.conv2d({ x: l, filter: t, strides: n, pad: a === "same" ? "same" : "valid", dilations: s, dataFormat: "NHWC", bias: r, activation: i }), o === "channelsFirst" && (l = Wt.transpose(l, [0, 3, 1, 2])), l;
    });
  }
  function nke(e, t, r, n, a, o, s) {
    return n === void 0 && (n = [1, 1, 1]), a === void 0 && (a = "valid"), ur.tidy(function() {
      if (o == null && (o = id()), pu(o), e.rank !== 4 && e.rank !== 5) throw new en("conv3dWithBias expects input to be of rank 4 or 5, but received " + (e.rank + "."));
      if (t.rank !== 4 && t.rank !== 5) throw new en("conv3dWithBias expects kernel to be of rank 4 or 5, but received " + (e.rank + "."));
      var i = oj(e, o);
      if (a === "causal") throw new ro("The support for CAUSAL padding mode in conv3dWithBias is not implemented yet.");
      return i = Wt.conv3d(i, t, n, a === "same" ? "same" : "valid", "NDHWC", s), r != null && (i = ud(i, r)), o === "channelsFirst" && (i = Wt.transpose(i, [0, 4, 1, 2, 3])), i;
    });
  }
  var sj = function(e) {
    Hn(t, e);
    function t(r, n) {
      var a = e.call(this, n) || this;
      if (a.bias = null, a.DEFAULT_KERNEL_INITIALIZER = "glorotNormal", a.DEFAULT_BIAS_INITIALIZER = "zeros", t.verifyArgs(n), a.rank = r, cc(a.rank, "rank"), a.rank !== 1 && a.rank !== 2 && a.rank !== 3) throw new ro("Convolution layer for rank other than 1, 2, or 3 (" + a.rank + ") is not implemented yet.");
      if (a.kernelSize = dy(n.kernelSize, r, "kernelSize"), a.strides = dy(n.strides == null ? 1 : n.strides, r, "strides"), a.padding = n.padding == null ? "valid" : n.padding, Nh(a.padding), a.dataFormat = n.dataFormat == null ? "channelsLast" : n.dataFormat, pu(a.dataFormat), a.activation = Ev(n.activation), a.useBias = n.useBias == null ? true : n.useBias, a.biasInitializer = Il(n.biasInitializer || a.DEFAULT_BIAS_INITIALIZER), a.biasConstraint = $u(n.biasConstraint), a.biasRegularizer = Nl(n.biasRegularizer), a.activityRegularizer = Nl(n.activityRegularizer), a.dilationRate = dy(n.dilationRate == null ? 1 : n.dilationRate, r, "dilationRate"), a.rank === 1 && Array.isArray(a.dilationRate) && a.dilationRate.length !== 1) throw new en("dilationRate must be a number or an array of a single number for 1D convolution, but received " + ("" + JSON.stringify(a.dilationRate)));
      if (a.rank === 2) {
        if (typeof a.dilationRate == "number") a.dilationRate = [a.dilationRate, a.dilationRate];
        else if (a.dilationRate.length !== 2) throw new en("dilationRate must be a number or array of two numbers for 2D " + ("convolution, but received " + JSON.stringify(a.dilationRate)));
      } else if (a.rank === 3) {
        if (typeof a.dilationRate == "number") a.dilationRate = [a.dilationRate, a.dilationRate, a.dilationRate];
        else if (a.dilationRate.length !== 3) throw new en("dilationRate must be a number or array of three numbers for 3D " + ("convolution, but received " + JSON.stringify(a.dilationRate)));
      }
      return a;
    }
    return t.verifyArgs = function(r) {
      if (Bd("kernelSize" in r, "required key 'kernelSize' not in config"), typeof r.kernelSize != "number" && !aD(r.kernelSize, "number", 1, 3)) throw new en("BaseConv expects config.kernelSize to be number or number[] with " + ("length 1, 2, or 3, but received " + JSON.stringify(r.kernelSize) + "."));
    }, t.prototype.getConfig = function() {
      var r = { kernelSize: this.kernelSize, strides: this.strides, padding: this.padding, dataFormat: this.dataFormat, dilationRate: this.dilationRate, activation: Sv(this.activation), useBias: this.useBias, biasInitializer: Vl(this.biasInitializer), biasRegularizer: Gs(this.biasRegularizer), activityRegularizer: Gs(this.activityRegularizer), biasConstraint: Gu(this.biasConstraint) }, n = e.prototype.getConfig.call(this);
      return Object.assign(r, n), r;
    }, t;
  }(Wo), Ak = function(e) {
    Hn(t, e);
    function t(r, n) {
      var a = e.call(this, r, n) || this;
      return a.kernel = null, t.verifyArgs(n), a.filters = n.filters, cc(a.filters, "filters"), a.kernelInitializer = Il(n.kernelInitializer || a.DEFAULT_KERNEL_INITIALIZER), a.kernelConstraint = $u(n.kernelConstraint), a.kernelRegularizer = Nl(n.kernelRegularizer), a;
    }
    return t.prototype.build = function(r) {
      var n;
      r = bs(r);
      var a = this.dataFormat === "channelsFirst" ? 1 : r.length - 1;
      if (r[a] == null) throw new en("The channel dimension of the input should be defined. " + ("Found " + r[a]));
      var o = r[a], s = this.kernelSize.concat([o, this.filters]);
      this.kernel = this.addWeight("kernel", s, null, this.kernelInitializer, this.kernelRegularizer, true, this.kernelConstraint), this.useBias && (this.bias = this.addWeight("bias", [this.filters], null, this.biasInitializer, this.biasRegularizer, true, this.biasConstraint)), this.inputSpec = [{ ndim: this.rank + 2, axes: (n = {}, n[a] = o, n) }], this.built = true;
    }, t.prototype.call = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        r = no(r);
        var o, s = a.bias == null ? null : a.bias.read(), i = gV(a.activation.getClassName());
        if (i != null && a.rank === 2) o = nU(r, a.kernel.read(), s, a.strides, a.padding, a.dataFormat, a.dilationRate, i);
        else {
          if (a.rank === 1) o = rke(r, a.kernel.read(), s, a.strides[0], a.padding, a.dataFormat, a.dilationRate[0]);
          else if (a.rank === 2) o = nU(r, a.kernel.read(), s, a.strides, a.padding, a.dataFormat, a.dilationRate);
          else if (a.rank === 3) o = nke(r, a.kernel.read(), s, a.strides, a.padding, a.dataFormat, a.dilationRate);
          else throw new ro("convolutions greater than 3D are not implemented yet.");
          a.activation != null && (o = a.activation.apply(o));
        }
        return o;
      });
    }, t.prototype.computeOutputShape = function(r) {
      r = bs(r);
      for (var n = [], a = this.dataFormat === "channelsLast" ? r.slice(1, r.length - 1) : r.slice(2), o = 0; o < a.length; ++o) {
        var s = ad(a[o], this.kernelSize[o], this.padding, this.strides[o], typeof this.dilationRate == "number" ? this.dilationRate : this.dilationRate[o]);
        n.push(s);
      }
      var i = [r[0]];
      return this.dataFormat === "channelsLast" ? (i = i.concat(n), i.push(this.filters)) : (i.push(this.filters), i = i.concat(n)), i;
    }, t.prototype.getConfig = function() {
      var r = { filters: this.filters, kernelInitializer: Vl(this.kernelInitializer), kernelRegularizer: Gs(this.kernelRegularizer), kernelConstraint: Gu(this.kernelConstraint) }, n = e.prototype.getConfig.call(this);
      return Object.assign(r, n), r;
    }, t.verifyArgs = function(r) {
      if (!("filters" in r) || typeof r.filters != "number" || r.filters < 1) throw new en("Convolution layer expected config.filters to be a 'number' > 0 " + ("but got " + JSON.stringify(r.filters)));
    }, t;
  }(sj), Sk = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, 2, r) || this;
      return t.verifyArgs(r), n;
    }
    return t.prototype.getConfig = function() {
      var r = e.prototype.getConfig.call(this);
      return delete r.rank, r;
    }, t.verifyArgs = function(r) {
      if (typeof r.kernelSize != "number" && !aD(r.kernelSize, "number", 1, 2)) throw new en("Conv2D expects config.kernelSize to be number or number[] with " + ("length 1 or 2, but received " + JSON.stringify(r.kernelSize) + "."));
    }, t;
  }(Ak);
  Sk.className = "Conv2D";
  ur.serialization.registerClass(Sk);
  var Ek = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, 3, r) || this;
      return t.verifyArgs(r), n;
    }
    return t.prototype.getConfig = function() {
      var r = e.prototype.getConfig.call(this);
      return delete r.rank, r;
    }, t.verifyArgs = function(r) {
      if (typeof r.kernelSize != "number" && !(Array.isArray(r.kernelSize) && (r.kernelSize.length === 1 || r.kernelSize.length === 3))) throw new en("Conv3D expects config.kernelSize to be number or" + (" [number, number, number], but received " + JSON.stringify(r.kernelSize) + "."));
    }, t;
  }(Ak);
  Ek.className = "Conv3D";
  ur.serialization.registerClass(Ek);
  var PD = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r) || this;
      if (n.inputSpec = [new Cu({ ndim: 4 })], n.padding !== "same" && n.padding !== "valid") throw new en("Conv2DTranspose currently supports only padding modes 'same' " + ("and 'valid', but received padding mode " + n.padding));
      return n;
    }
    return t.prototype.build = function(r) {
      var n;
      if (r = bs(r), r.length !== 4) throw new en("Input should have rank 4; Received input shape: " + JSON.stringify(r));
      var a = this.dataFormat === "channelsFirst" ? 1 : r.length - 1;
      if (r[a] == null) throw new en("The channel dimension of the inputs should be defined. Found `None`.");
      var o = r[a], s = this.kernelSize.concat([this.filters, o]);
      this.kernel = this.addWeight("kernel", s, "float32", this.kernelInitializer, this.kernelRegularizer, true, this.kernelConstraint), this.useBias && (this.bias = this.addWeight("bias", [this.filters], "float32", this.biasInitializer, this.biasRegularizer, true, this.biasConstraint)), this.inputSpec = [new Cu({ ndim: 4, axes: (n = {}, n[a] = o, n) })], this.built = true;
    }, t.prototype.call = function(r, n) {
      var a = this;
      return Wt.tidy(function() {
        var o = no(r);
        if (o.shape.length !== 4) throw new en("Conv2DTranspose.call() expects input tensor to be rank-4, but " + ("received a tensor of rank-" + o.shape.length));
        var s = o.shape, i = s[0], l, u3;
        a.dataFormat === "channelsFirst" ? (l = 2, u3 = 3) : (l = 1, u3 = 2);
        var c = s[l], f = s[u3], h = a.kernelSize[0], p = a.kernelSize[1], d = a.strides[0], v = a.strides[1], m = Ud(c, d, h, a.padding), g = Ud(f, v, p, a.padding), x = [i, m, g, a.filters];
        a.dataFormat !== "channelsLast" && (o = Wt.transpose(o, [0, 2, 3, 1]));
        var b = Wt.conv2dTranspose(o, a.kernel.read(), x, a.strides, a.padding);
        return a.dataFormat !== "channelsLast" && (b = Wt.transpose(b, [0, 3, 1, 2])), a.bias != null && (b = ud(b, a.bias.read(), a.dataFormat)), a.activation != null && (b = a.activation.apply(b)), b;
      });
    }, t.prototype.computeOutputShape = function(r) {
      r = bs(r);
      var n = r.slice(), a, o, s;
      this.dataFormat === "channelsFirst" ? (a = 1, o = 2, s = 3) : (a = 3, o = 1, s = 2);
      var i = this.kernelSize[0], l = this.kernelSize[1], u3 = this.strides[0], c = this.strides[1];
      return n[a] = this.filters, n[o] = Ud(n[o], u3, i, this.padding), n[s] = Ud(n[s], c, l, this.padding), n;
    }, t.prototype.getConfig = function() {
      var r = e.prototype.getConfig.call(this);
      return delete r.dilationRate, r;
    }, t;
  }(Sk);
  PD.className = "Conv2DTranspose";
  ur.serialization.registerClass(PD);
  var LD = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r) || this;
      if (n.inputSpec = [new Cu({ ndim: 5 })], n.padding !== "same" && n.padding !== "valid") throw new en("Conv3DTranspose currently supports only padding modes 'same' " + ("and 'valid', but received padding mode " + n.padding));
      return n;
    }
    return t.prototype.build = function(r) {
      var n;
      if (r = bs(r), r.length !== 5) throw new en("Input should have rank 5; Received input shape: " + JSON.stringify(r));
      var a = this.dataFormat === "channelsFirst" ? 1 : r.length - 1;
      if (r[a] == null) throw new en("The channel dimension of the inputs should be defined. Found `None`.");
      var o = r[a], s = this.kernelSize.concat([this.filters, o]);
      this.kernel = this.addWeight("kernel", s, "float32", this.kernelInitializer, this.kernelRegularizer, true, this.kernelConstraint), this.useBias && (this.bias = this.addWeight("bias", [this.filters], "float32", this.biasInitializer, this.biasRegularizer, true, this.biasConstraint)), this.inputSpec = [new Cu({ ndim: 5, axes: (n = {}, n[a] = o, n) })], this.built = true;
    }, t.prototype.call = function(r, n) {
      var a = this;
      return Wt.tidy(function() {
        var o = no(r);
        if (o.shape.length !== 5) throw new en("Conv3DTranspose.call() expects input tensor to be rank-4, but " + ("received a tensor of rank-" + o.shape.length));
        var s = o.shape, i = s[0], l, u3, c;
        a.dataFormat === "channelsFirst" ? (c = 2, l = 3, u3 = 4) : (c = 1, l = 2, u3 = 3);
        var f = s[c], h = s[l], p = s[u3], d = a.kernelSize[0], v = a.kernelSize[1], m = a.kernelSize[2], g = a.strides[0], x = a.strides[1], b = a.strides[2], y = Ud(f, g, d, a.padding), w = Ud(h, x, v, a.padding), _4 = Ud(p, b, m, a.padding), k = [i, y, w, _4, a.filters];
        a.dataFormat !== "channelsLast" && (o = Wt.transpose(o, [0, 2, 3, 4, 1]));
        var T2 = Wt.conv3dTranspose(o, a.kernel.read(), k, a.strides, a.padding);
        return a.dataFormat !== "channelsLast" && (T2 = Wt.transpose(T2, [0, 4, 1, 2, 3])), a.bias !== null && (T2 = ud(T2, a.bias.read(), a.dataFormat)), a.activation !== null && (T2 = a.activation.apply(T2)), T2;
      });
    }, t.prototype.computeOutputShape = function(r) {
      r = bs(r);
      var n = r.slice(), a, o, s, i;
      this.dataFormat === "channelsFirst" ? (a = 1, o = 2, s = 3, i = 4) : (a = 4, o = 1, s = 2, i = 3);
      var l = this.kernelSize[0], u3 = this.kernelSize[1], c = this.kernelSize[2], f = this.strides[0], h = this.strides[1], p = this.strides[2];
      return n[a] = this.filters, n[o] = Ud(n[o], f, l, this.padding), n[s] = Ud(n[s], h, u3, this.padding), n[i] = Ud(n[i], p, c, this.padding), n;
    }, t.prototype.getConfig = function() {
      var r = e.prototype.getConfig.call(this);
      return delete r.dilationRate, r;
    }, t;
  }(Ek);
  LD.className = "Conv3DTranspose";
  ur.serialization.registerClass(LD);
  var lj = function(e) {
    Hn(t, e);
    function t(r, n) {
      var a = e.call(this, r, n) || this;
      if (a.DEFAULT_DEPTHWISE_INITIALIZER = "glorotUniform", a.DEFAULT_POINTWISE_INITIALIZER = "glorotUniform", a.depthwiseKernel = null, a.pointwiseKernel = null, n.filters == null) throw new en("The `filters` configuration field is required by SeparableConv, but is unspecified.");
      if (n.kernelInitializer != null || n.kernelRegularizer != null || n.kernelConstraint != null) throw new en("Fields kernelInitializer, kernelRegularizer and kernelConstraint are invalid for SeparableConv2D. Use depthwiseInitializer, depthwiseRegularizer, depthwiseConstraint, pointwiseInitializer, pointwiseRegularizer and pointwiseConstraint instead.");
      if (n.padding != null && n.padding !== "same" && n.padding !== "valid") throw new en("SeparableConv" + a.rank + "D supports only padding modes: " + ("'same' and 'valid', but received " + JSON.stringify(n.padding)));
      return a.depthMultiplier = n.depthMultiplier == null ? 1 : n.depthMultiplier, a.depthwiseInitializer = Il(n.depthwiseInitializer || a.DEFAULT_DEPTHWISE_INITIALIZER), a.depthwiseRegularizer = Nl(n.depthwiseRegularizer), a.depthwiseConstraint = $u(n.depthwiseConstraint), a.pointwiseInitializer = Il(n.depthwiseInitializer || a.DEFAULT_POINTWISE_INITIALIZER), a.pointwiseRegularizer = Nl(n.pointwiseRegularizer), a.pointwiseConstraint = $u(n.pointwiseConstraint), a;
    }
    return t.prototype.build = function(r) {
      var n;
      if (r = bs(r), r.length < this.rank + 2) throw new en("Inputs to SeparableConv" + this.rank + "D should have rank " + (this.rank + 2 + ", but received input shape: ") + ("" + JSON.stringify(r)));
      var a = this.dataFormat === "channelsFirst" ? 1 : r.length - 1;
      if (r[a] == null || r[a] < 0) throw new en("The channel dimension of the inputs should be defined, " + ("but found " + JSON.stringify(r[a])));
      for (var o = r[a], s = this.kernelSize.concat([o, this.depthMultiplier]), i = [], l = 0; l < this.rank; ++l) i.push(1);
      i.push(o * this.depthMultiplier, this.filters);
      var u3 = true;
      this.depthwiseKernel = this.addWeight("depthwise_kernel", s, "float32", this.depthwiseInitializer, this.depthwiseRegularizer, u3, this.depthwiseConstraint), this.pointwiseKernel = this.addWeight("pointwise_kernel", i, "float32", this.pointwiseInitializer, this.pointwiseRegularizer, u3, this.pointwiseConstraint), this.useBias ? this.bias = this.addWeight("bias", [this.filters], "float32", this.biasInitializer, this.biasRegularizer, u3, this.biasConstraint) : this.bias = null, this.inputSpec = [new Cu({ ndim: this.rank + 2, axes: (n = {}, n[a] = o, n) })], this.built = true;
    }, t.prototype.call = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        r = no(r);
        var o;
        if (a.rank === 1) throw new ro("1D separable convolution is not implemented yet.");
        return a.rank === 2 && (a.dataFormat === "channelsFirst" && (r = Wt.transpose(r, [0, 2, 3, 1])), o = Wt.separableConv2d(r, a.depthwiseKernel.read(), a.pointwiseKernel.read(), a.strides, a.padding, a.dilationRate, "NHWC")), a.useBias && (o = ud(o, a.bias.read(), a.dataFormat)), a.activation != null && (o = a.activation.apply(o)), a.dataFormat === "channelsFirst" && (o = Wt.transpose(o, [0, 3, 1, 2])), o;
      });
    }, t.prototype.getConfig = function() {
      var r = e.prototype.getConfig.call(this);
      return delete r.rank, delete r.kernelInitializer, delete r.kernelRegularizer, delete r.kernelConstraint, r.depthwiseInitializer = Vl(this.depthwiseInitializer), r.pointwiseInitializer = Vl(this.pointwiseInitializer), r.depthwiseRegularizer = Gs(this.depthwiseRegularizer), r.pointwiseRegularizer = Gs(this.pointwiseRegularizer), r.depthwiseConstraint = Gu(this.depthwiseConstraint), r.pointwiseConstraint = Gu(this.pointwiseConstraint), r;
    }, t;
  }(Ak);
  lj.className = "SeparableConv";
  var RD = function(e) {
    Hn(t, e);
    function t(r) {
      return e.call(this, 2, r) || this;
    }
    return t;
  }(lj);
  RD.className = "SeparableConv2D";
  ur.serialization.registerClass(RD);
  var zD = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, 1, r) || this;
      return t.verifyArgs(r), n.inputSpec = [{ ndim: 3 }], n;
    }
    return t.prototype.getConfig = function() {
      var r = e.prototype.getConfig.call(this);
      return delete r.rank, delete r.dataFormat, r;
    }, t.verifyArgs = function(r) {
      if (typeof r.kernelSize != "number" && !aD(r.kernelSize, "number", 1, 1)) throw new en("Conv1D expects config.kernelSize to be number or number[] with " + ("length 1, but received " + JSON.stringify(r.kernelSize) + "."));
    }, t;
  }(Ak);
  zD.className = "Conv1D";
  ur.serialization.registerClass(zD);
  var BD = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r) || this;
      return typeof r.cropping == "number" ? n.cropping = [[r.cropping, r.cropping], [r.cropping, r.cropping]] : typeof r.cropping[0] == "number" ? n.cropping = [[r.cropping[0], r.cropping[0]], [r.cropping[1], r.cropping[1]]] : n.cropping = r.cropping, n.dataFormat = r.dataFormat === void 0 ? "channelsLast" : r.dataFormat, n.inputSpec = [{ ndim: 4 }], n;
    }
    return t.prototype.computeOutputShape = function(r) {
      return this.dataFormat === "channelsFirst" ? [r[0], r[1], r[2] - this.cropping[0][0] - this.cropping[0][1], r[3] - this.cropping[1][0] - this.cropping[1][1]] : [r[0], r[1] - this.cropping[0][0] - this.cropping[0][1], r[2] - this.cropping[1][0] - this.cropping[1][1], r[3]];
    }, t.prototype.call = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        if (r = no(r), a.dataFormat === "channelsLast") {
          var o = G3(r, a.cropping[0][0], r.shape[1] - a.cropping[0][0] - a.cropping[0][1], 2);
          return G3(o, a.cropping[1][0], r.shape[2] - a.cropping[1][1] - a.cropping[1][0], 3);
        } else {
          var o = G3(r, a.cropping[0][0], r.shape[2] - a.cropping[0][0] - a.cropping[0][1], 3);
          return G3(o, a.cropping[1][0], r.shape[3] - a.cropping[1][1] - a.cropping[1][0], 4);
        }
      });
    }, t.prototype.getConfig = function() {
      var r = { cropping: this.cropping, dataFormat: this.dataFormat }, n = e.prototype.getConfig.call(this);
      return Object.assign(r, n), r;
    }, t;
  }(Wo);
  BD.className = "Cropping2D";
  ur.serialization.registerClass(BD);
  var UD = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r) || this;
      return n.DEFAULT_SIZE = [2, 2], n.inputSpec = [{ ndim: 4 }], n.size = r.size == null ? n.DEFAULT_SIZE : r.size, n.dataFormat = r.dataFormat == null ? "channelsLast" : r.dataFormat, pu(n.dataFormat), n.interpolation = r.interpolation == null ? "nearest" : r.interpolation, mwe(n.interpolation), n;
    }
    return t.prototype.computeOutputShape = function(r) {
      if (this.dataFormat === "channelsFirst") {
        var n = r[2] == null ? null : this.size[0] * r[2], a = r[3] == null ? null : this.size[1] * r[3];
        return [r[0], r[1], n, a];
      } else {
        var n = r[1] == null ? null : this.size[0] * r[1], a = r[2] == null ? null : this.size[1] * r[2];
        return [r[0], n, a, r[3]];
      }
    }, t.prototype.call = function(r, n) {
      var a = this;
      return Wt.tidy(function() {
        var o = no(r), s = o.shape;
        if (a.dataFormat === "channelsFirst") {
          o = Wt.transpose(o, [0, 2, 3, 1]);
          var i = a.size[0] * s[2], l = a.size[1] * s[3], u3 = a.interpolation === "nearest" ? Wt.image.resizeNearestNeighbor(o, [i, l]) : Wt.image.resizeBilinear(o, [i, l]);
          return Wt.transpose(u3, [0, 3, 1, 2]);
        } else {
          var i = a.size[0] * s[1], l = a.size[1] * s[2];
          return a.interpolation === "nearest" ? Wt.image.resizeNearestNeighbor(o, [i, l]) : Wt.image.resizeBilinear(o, [i, l]);
        }
      });
    }, t.prototype.getConfig = function() {
      var r = { size: this.size, dataFormat: this.dataFormat }, n = e.prototype.getConfig.call(this);
      return Object.assign(r, n), r;
    }, t;
  }(Wo);
  UD.className = "UpSampling2D";
  ur.serialization.registerClass(UD);
  function ake(e, t, r, n, a, o) {
    return r === void 0 && (r = [1, 1]), n === void 0 && (n = "valid"), ur.tidy(function() {
      a == null && (a = id()), pu(a);
      var s = OD(e, a);
      if (e.rank !== 4) throw new en("Input for depthwiseConv2d is required to be 4-D, but is instead " + (e.rank + "-D"));
      if (t.rank !== 4) throw new en("depthwiseKernel is required to be 4-D, but is instead " + (t.rank + "-D"));
      return s = Wt.depthwiseConv2d(s, t, r, n === "same" ? "same" : "valid", "NHWC", o), a === "channelsFirst" && (s = Wt.transpose(s, [0, 3, 1, 2])), s;
    });
  }
  var VD = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, 2, r) || this;
      return n.depthwiseKernel = null, n.depthMultiplier = r.depthMultiplier == null ? 1 : r.depthMultiplier, n.depthwiseInitializer = Il(r.depthwiseInitializer || n.DEFAULT_KERNEL_INITIALIZER), n.depthwiseConstraint = $u(r.depthwiseConstraint), n.depthwiseRegularizer = Nl(r.depthwiseRegularizer), n;
    }
    return t.prototype.build = function(r) {
      if (r = bs(r), r.length < 4) throw new en("Inputs to DepthwiseConv2D should have rank 4. " + ("Received input shape: " + JSON.stringify(r) + "."));
      var n = this.dataFormat === "channelsFirst" ? 1 : 3;
      if (r[n] == null || r[n] < 0) throw new en("The channel dimension of the inputs to DepthwiseConv2D should " + ("be defined, but is not (" + r[n] + ")."));
      var a = r[n], o = [this.kernelSize[0], this.kernelSize[1], a, this.depthMultiplier];
      this.depthwiseKernel = this.addWeight("depthwise_kernel", o, null, this.depthwiseInitializer, this.depthwiseRegularizer, true, this.depthwiseConstraint), this.useBias ? this.bias = this.addWeight("bias", [a * this.depthMultiplier], null, this.biasInitializer, this.biasRegularizer, true, this.biasConstraint) : this.bias = null, this.built = true;
    }, t.prototype.call = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        r = no(r);
        var o = ake(r, a.depthwiseKernel.read(), a.strides, a.padding, a.dataFormat, null);
        return a.useBias && (o = ud(o, a.bias.read(), a.dataFormat)), a.activation != null && (o = a.activation.apply(o)), o;
      });
    }, t.prototype.computeOutputShape = function(r) {
      r = bs(r);
      var n = this.dataFormat === "channelsFirst" ? r[2] : r[1], a = this.dataFormat === "channelsFirst" ? r[3] : r[2], o = this.dataFormat === "channelsFirst" ? r[1] * this.depthMultiplier : r[3] * this.depthMultiplier, s = ad(n, this.kernelSize[0], this.padding, this.strides[0]), i = ad(a, this.kernelSize[1], this.padding, this.strides[1]);
      return this.dataFormat === "channelsFirst" ? [r[0], o, s, i] : [r[0], s, i, o];
    }, t.prototype.getConfig = function() {
      var r = e.prototype.getConfig.call(this);
      return r.depthMultiplier = this.depthMultiplier, r.depthwiseInitializer = Vl(this.depthwiseInitializer), r.depthwiseRegularizer = Gs(this.depthwiseRegularizer), r.depthwiseConstraint = Gu(this.depthwiseRegularizer), r;
    }, t;
  }(sj);
  VD.className = "DepthwiseConv2D";
  ur.serialization.registerClass(VD);
  function uj(e, t, r, n) {
    if (Array.isArray(e)) {
      if (t != null || r != null) throw new en("When inputs is an array, neither initialState or constants should be provided");
      n != null && (r = e.slice(e.length - n, e.length), e = e.slice(0, e.length - n)), e.length > 1 && (t = e.slice(1, e.length)), e = e[0];
    }
    function a(o) {
      return o == null || Array.isArray(o) ? o : [o];
    }
    return t = a(t), r = a(r), { inputs: e, initialState: t, constants: r };
  }
  function cj(e, t, r, n, a, o, s, i) {
    return n === void 0 && (n = false), s === void 0 && (s = false), i === void 0 && (i = false), Wt.tidy(function() {
      var l = t.shape.length;
      if (l < 3) throw new en("Input should be at least 3D, but is " + l + "D.");
      var u3 = [1, 0].concat(od(2, l));
      if (t = Wt.transpose(t, u3), o != null) throw new ro("The rnn() functoin of the deeplearn.js backend does not support constants yet.");
      s && console.warn("Backend rnn(): the unroll = true option is not applicable to the imperative deeplearn.js backend."), a != null && (a = Wt.cast(Wt.cast(a, "bool"), "float32"), a.rank === l - 1 && (a = Wt.expandDims(a, -1)), a = Wt.transpose(a, u3)), n && (t = Wt.reverse(t, 0), a != null && (a = Wt.reverse(a, 0)));
      var c = [], f, h = r, p = t.shape[0], d = Wt.unstack(t), v;
      a != null && (v = Wt.unstack(a));
      for (var m = function(y) {
        var w = d[y], _4 = Wt.tidy(function() {
          return e(w, h);
        });
        if (a == null) f = _4[0], h = _4[1];
        else {
          var k = Wt.tidy(function() {
            var T2 = v[y], A2 = Wt.sub(Wt.onesLike(T2), T2), S2 = Wt.add(Wt.mul(_4[0], T2), Wt.mul(h[0], A2)), C2 = h.map(function(E2, F13) {
              return Wt.add(Wt.mul(_4[1][F13], T2), Wt.mul(E2, A2));
            });
            return { output: S2, newStates: C2 };
          });
          f = k.output, h = k.newStates;
        }
        i && c.push(f);
      }, g = 0; g < p; ++g) m(g);
      var x;
      if (i) {
        var b = 1;
        x = Wt.stack(c, b);
      }
      return [f, x, h];
    });
  }
  var k0 = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r) || this, a;
      if (r.cell == null) throw new en("cell property is missing for the constructor of RNN.");
      if (Array.isArray(r.cell) ? a = new Mk({ cells: r.cell }) : a = r.cell, a.stateSize == null) throw new en("The RNN cell should have an attribute `stateSize` (tuple of integers, one integer per RNN state).");
      return n.cell = a, n.returnSequences = r.returnSequences == null ? false : r.returnSequences, n.returnState = r.returnState == null ? false : r.returnState, n.goBackwards = r.goBackwards == null ? false : r.goBackwards, n._stateful = r.stateful == null ? false : r.stateful, n.unroll = r.unroll == null ? false : r.unroll, n.supportsMasking = true, n.inputSpec = [new Cu({ ndim: 3 })], n.stateSpec = null, n.states_ = null, n.numConstants = null, n.keptStates = [], n;
    }
    return t.prototype.getStates = function() {
      if (this.states_ == null) {
        var r = Array.isArray(this.cell.stateSize) ? this.cell.stateSize.length : 1;
        return od(0, r).map(function(n) {
          return null;
        });
      } else return this.states_;
    }, t.prototype.setStates = function(r) {
      this.states_ = r;
    }, t.prototype.computeOutputShape = function(r) {
      var n, a;
      O5(r) && (r = r[0]), r = r;
      var o = this.cell.stateSize;
      Array.isArray(o) || (o = [o]);
      var s = o[0], i;
      if (this.returnSequences ? i = [r[0], r[1], s] : i = [r[0], s], this.returnState) {
        var l = [];
        try {
          for (var u3 = Qn(o), c = u3.next(); !c.done; c = u3.next()) {
            var f = c.value;
            l.push([r[0], f]);
          }
        } catch (h) {
          n = { error: h };
        } finally {
          try {
            c && !c.done && (a = u3.return) && a.call(u3);
          } finally {
            if (n) throw n.error;
          }
        }
        return [i].concat(l);
      } else return i;
    }, t.prototype.computeMask = function(r, n) {
      var a = this;
      return Wt.tidy(function() {
        Array.isArray(n) && (n = n[0]);
        var o = a.returnSequences ? n : null;
        if (a.returnState) {
          var s = a.states.map(function(i) {
            return null;
          });
          return [o].concat(s);
        } else return o;
      });
    }, Object.defineProperty(t.prototype, "states", { get: function() {
      if (this.states_ == null) {
        for (var r = Array.isArray(this.cell.stateSize) ? this.cell.stateSize.length : 1, n = [], a = 0; a < r; ++a) n.push(null);
        return n;
      } else return this.states_;
    }, set: function(r) {
      this.states_ = r;
    }, enumerable: true, configurable: true }), t.prototype.build = function(r) {
      if (this.numConstants != null) throw new ro("Constants support is not implemented in RNN yet.");
      O5(r) && (r = r[0]), r = r;
      var n = this.stateful ? r[0] : null, a = r.slice(2);
      this.inputSpec[0] = new Cu({ shape: bo([n, null], a) });
      var o = [r[0]].concat(r.slice(2));
      this.cell.build(o);
      var s;
      if (Array.isArray(this.cell.stateSize) ? s = this.cell.stateSize : s = [this.cell.stateSize], this.stateSpec != null) {
        if (!ur.util.arraysEqual(this.stateSpec.map(function(i) {
          return i.shape[i.shape.length - 1];
        }), s)) throw new en("An initialState was passed that is not compatible with " + ("cell.stateSize. Received stateSpec=" + this.stateSpec + "; ") + ("However cell.stateSize is " + this.cell.stateSize));
      } else this.stateSpec = s.map(function(i) {
        return new Cu({ shape: [null, i] });
      });
      this.stateful && this.resetStates();
    }, t.prototype.resetStates = function(r, n) {
      var a = this;
      n === void 0 && (n = false), ur.tidy(function() {
        if (!a.stateful) throw new wv("Cannot call resetStates() on an RNN Layer that is not stateful.");
        var o = a.inputSpec[0].shape[0];
        if (o == null) throw new en("If an RNN is stateful, it needs to know its batch size. Specify the batch size of your input tensors: \n- If using a Sequential model, specify the batch size by passing a `batchInputShape` option to your first layer.\n- If using the functional API, specify the batch size by passing a `batchShape` option to your Input layer.");
        if (a.states_ == null) Array.isArray(a.cell.stateSize) ? a.states_ = a.cell.stateSize.map(function(c) {
          return Wt.zeros([o, c]);
        }) : a.states_ = [Wt.zeros([o, a.cell.stateSize])];
        else if (r == null) Wt.dispose(a.states_), a.keptStates != null && (Wt.dispose(a.keptStates), a.keptStates = []), Array.isArray(a.cell.stateSize) ? a.states_ = a.cell.stateSize.map(function(c) {
          return Wt.zeros([o, c]);
        }) : a.states_[0] = Wt.zeros([o, a.cell.stateSize]);
        else {
          if (Array.isArray(r) || (r = [r]), r.length !== a.states_.length) throw new en("Layer " + a.name + " expects " + a.states_.length + " state(s), " + ("but it received " + r.length + " state value(s). Input ") + ("received: " + r));
          n === true ? a.keptStates.push(a.states_.slice()) : Wt.dispose(a.states_);
          for (var s = 0; s < a.states_.length; ++s) {
            var i = r[s], l = Array.isArray(a.cell.stateSize) ? a.cell.stateSize[s] : a.cell.stateSize, u3 = [o, l];
            if (!ur.util.arraysEqual(i.shape, u3)) throw new en("State " + s + " is incompatible with layer " + a.name + ": " + ("expected shape=" + u3 + ", received shape=" + i.shape));
            a.states_[s] = i;
          }
        }
        a.states_ = a.states_.map(function(c) {
          return Wt.keep(c.clone());
        });
      });
    }, t.prototype.apply = function(r, n) {
      var a, o, s = n == null ? null : n.initialState, i = n == null ? null : n.constants;
      n == null && (n = {});
      var l = uj(r, s, i, this.numConstants);
      r = l.inputs, s = l.initialState, i = l.constants;
      var u3 = [], c = [];
      if (s != null) {
        n.initialState = s, u3 = u3.concat(s), this.stateSpec = [];
        try {
          for (var f = Qn(s), h = f.next(); !h.done; h = f.next()) {
            var p = h.value;
            this.stateSpec.push(new Cu({ shape: p.shape }));
          }
        } catch (b) {
          a = { error: b };
        } finally {
          try {
            h && !h.done && (o = f.return) && o.call(f);
          } finally {
            if (a) throw a.error;
          }
        }
        c = c.concat(this.stateSpec);
      }
      i != null && (n.constants = i, u3 = u3.concat(i), this.numConstants = i.length);
      var d = u3[0] instanceof rd;
      if (d) {
        var v = [r].concat(u3), m = this.inputSpec.concat(c), g = this.inputSpec;
        this.inputSpec = m;
        var x = e.prototype.apply.call(this, v, n);
        return this.inputSpec = g, x;
      } else return e.prototype.apply.call(this, r, n);
    }, t.prototype.call = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        var o = n == null ? null : n.mask, s = n == null ? null : n.training, i = n == null ? null : n.initialState;
        r = no(r), i == null && (a.stateful ? i = a.states_ : i = a.getInitialState(r));
        var l = Array.isArray(a.cell.stateSize) ? a.cell.stateSize.length : 1;
        if (i.length !== l) throw new en("RNN Layer has " + l + " state(s) but was passed " + (i.length + " initial state(s)."));
        a.unroll && console.warn("Ignoring unroll = true for RNN layer, due to imperative backend.");
        var u3 = { training: s }, c = function(m, g) {
          var x = a.cell.call([m].concat(g), u3);
          return [x[0], x.slice(1)];
        }, f = cj(c, r, i, a.goBackwards, o, null, a.unroll, a.returnSequences), h = f[0], p = f[1], d = f[2];
        a.stateful && a.resetStates(d, s);
        var v = a.returnSequences ? p : h;
        return a.returnState ? [v].concat(d) : v;
      });
    }, t.prototype.getInitialState = function(r) {
      var n = this;
      return ur.tidy(function() {
        var a = Wt.zeros(r.shape);
        return a = Wt.sum(a, [1, 2]), a = d2(a), Array.isArray(n.cell.stateSize) ? n.cell.stateSize.map(function(o) {
          return o > 1 ? N5(a, [1, o]) : a;
        }) : n.cell.stateSize > 1 ? [N5(a, [1, n.cell.stateSize])] : [a];
      });
    }, Object.defineProperty(t.prototype, "trainableWeights", { get: function() {
      return this.trainable ? this.cell.trainableWeights : [];
    }, enumerable: true, configurable: true }), Object.defineProperty(t.prototype, "nonTrainableWeights", { get: function() {
      return this.trainable ? this.cell.nonTrainableWeights : this.cell.weights;
    }, enumerable: true, configurable: true }), t.prototype.setFastWeightInitDuringBuild = function(r) {
      e.prototype.setFastWeightInitDuringBuild.call(this, r), this.cell != null && this.cell.setFastWeightInitDuringBuild(r);
    }, t.prototype.getConfig = function() {
      var r = e.prototype.getConfig.call(this), n = { returnSequences: this.returnSequences, returnState: this.returnState, goBackwards: this.goBackwards, stateful: this.stateful, unroll: this.unroll };
      this.numConstants != null && (n.numConstants = this.numConstants);
      var a = this.cell.getConfig();
      return this.getClassName() === t.className && (n.cell = { className: this.cell.getClassName(), config: a }), Object.assign({}, a, r, n);
    }, t.fromConfig = function(r, n, a) {
      a === void 0 && (a = {});
      var o = n.cell, s = nd(o, a);
      return new r(Object.assign(n, { cell: s }));
    }, t;
  }(Wo);
  k0.className = "RNN";
  ur.serialization.registerClass(k0);
  var by = function(e) {
    Hn(t, e);
    function t() {
      return e !== null && e.apply(this, arguments) || this;
    }
    return t;
  }(Wo), Dk = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r) || this;
      return n.DEFAULT_ACTIVATION = "tanh", n.DEFAULT_KERNEL_INITIALIZER = "glorotNormal", n.DEFAULT_RECURRENT_INITIALIZER = "orthogonal", n.DEFAULT_BIAS_INITIALIZER = "zeros", n.units = r.units, cc(n.units, "units"), n.activation = Ev(r.activation == null ? n.DEFAULT_ACTIVATION : r.activation), n.useBias = r.useBias == null ? true : r.useBias, n.kernelInitializer = Il(r.kernelInitializer || n.DEFAULT_KERNEL_INITIALIZER), n.recurrentInitializer = Il(r.recurrentInitializer || n.DEFAULT_RECURRENT_INITIALIZER), n.biasInitializer = Il(r.biasInitializer || n.DEFAULT_BIAS_INITIALIZER), n.kernelRegularizer = Nl(r.kernelRegularizer), n.recurrentRegularizer = Nl(r.recurrentRegularizer), n.biasRegularizer = Nl(r.biasRegularizer), n.kernelConstraint = $u(r.kernelConstraint), n.recurrentConstraint = $u(r.recurrentConstraint), n.biasConstraint = $u(r.biasConstraint), n.dropout = my([1, Av([0, r.dropout == null ? 0 : r.dropout])]), n.recurrentDropout = my([1, Av([0, r.recurrentDropout == null ? 0 : r.recurrentDropout])]), n.dropoutFunc = r.dropoutFunc, n.stateSize = n.units, n.dropoutMask = null, n.recurrentDropoutMask = null, n;
    }
    return t.prototype.build = function(r) {
      r = bs(r), this.kernel = this.addWeight("kernel", [r[r.length - 1], this.units], null, this.kernelInitializer, this.kernelRegularizer, true, this.kernelConstraint), this.recurrentKernel = this.addWeight("recurrent_kernel", [this.units, this.units], null, this.recurrentInitializer, this.recurrentRegularizer, true, this.recurrentConstraint), this.useBias ? this.bias = this.addWeight("bias", [this.units], null, this.biasInitializer, this.biasRegularizer, true, this.biasConstraint) : this.bias = null, this.built = true;
    }, t.prototype.call = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        if (r = r, r.length !== 2) throw new en("SimpleRNNCell expects 2 input Tensors, got " + r.length + ".");
        var o = r[1];
        r = r[0];
        var s = n.training == null ? false : n.training;
        0 < a.dropout && a.dropout < 1 && a.dropoutMask == null && (a.dropoutMask = Dv({ ones: function() {
          return Wt.onesLike(r);
        }, rate: a.dropout, training: s, dropoutFunc: a.dropoutFunc })), 0 < a.recurrentDropout && a.recurrentDropout < 1 && a.recurrentDropoutMask == null && (a.recurrentDropoutMask = Dv({ ones: function() {
          return Wt.onesLike(o);
        }, rate: a.recurrentDropout, training: s, dropoutFunc: a.dropoutFunc }));
        var i, l = a.dropoutMask, u3 = a.recurrentDropoutMask;
        l != null ? i = Gd(Wt.mul(r, l), a.kernel.read()) : i = Gd(r, a.kernel.read()), a.bias != null && (i = ud(i, a.bias.read())), u3 != null && (o = Wt.mul(o, u3));
        var c = Wt.add(i, Gd(o, a.recurrentKernel.read()));
        return a.activation != null && (c = a.activation.apply(c)), [c, c];
      });
    }, t.prototype.getConfig = function() {
      var r = e.prototype.getConfig.call(this), n = { units: this.units, activation: Sv(this.activation), useBias: this.useBias, kernelInitializer: Vl(this.kernelInitializer), recurrentInitializer: Vl(this.recurrentInitializer), biasInitializer: Vl(this.biasInitializer), kernelRegularizer: Gs(this.kernelRegularizer), recurrentRegularizer: Gs(this.recurrentRegularizer), biasRegularizer: Gs(this.biasRegularizer), activityRegularizer: Gs(this.activityRegularizer), kernelConstraint: Gu(this.kernelConstraint), recurrentConstraint: Gu(this.recurrentConstraint), biasConstraint: Gu(this.biasConstraint), dropout: this.dropout, recurrentDropout: this.recurrentDropout };
      return Object.assign({}, r, n);
    }, t;
  }(by);
  Dk.className = "SimpleRNNCell";
  ur.serialization.registerClass(Dk);
  var jD = function(e) {
    Hn(t, e);
    function t(r) {
      var n = this;
      return r.cell = new Dk(r), n = e.call(this, r) || this, n;
    }
    return t.prototype.call = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        a.cell.dropoutMask != null && (Wt.dispose(a.cell.dropoutMask), a.cell.dropoutMask = null), a.cell.recurrentDropoutMask != null && (Wt.dispose(a.cell.recurrentDropoutMask), a.cell.recurrentDropoutMask = null);
        var o = n == null ? null : n.mask, s = n == null ? null : n.training, i = n == null ? null : n.initialState;
        return e.prototype.call.call(a, r, { mask: o, training: s, initialState: i });
      });
    }, t.fromConfig = function(r, n) {
      return new r(n);
    }, t;
  }(k0);
  jD.className = "SimpleRNN";
  ur.serialization.registerClass(jD);
  var Ck = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r) || this;
      if (n.DEFAULT_ACTIVATION = "tanh", n.DEFAULT_RECURRENT_ACTIVATION = "hardSigmoid", n.DEFAULT_KERNEL_INITIALIZER = "glorotNormal", n.DEFAULT_RECURRENT_INITIALIZER = "orthogonal", n.DEFAULT_BIAS_INITIALIZER = "zeros", r.resetAfter) throw new en("GRUCell does not support reset_after parameter set to true.");
      return n.units = r.units, cc(n.units, "units"), n.activation = Ev(r.activation === void 0 ? n.DEFAULT_ACTIVATION : r.activation), n.recurrentActivation = Ev(r.recurrentActivation === void 0 ? n.DEFAULT_RECURRENT_ACTIVATION : r.recurrentActivation), n.useBias = r.useBias == null ? true : r.useBias, n.kernelInitializer = Il(r.kernelInitializer || n.DEFAULT_KERNEL_INITIALIZER), n.recurrentInitializer = Il(r.recurrentInitializer || n.DEFAULT_RECURRENT_INITIALIZER), n.biasInitializer = Il(r.biasInitializer || n.DEFAULT_BIAS_INITIALIZER), n.kernelRegularizer = Nl(r.kernelRegularizer), n.recurrentRegularizer = Nl(r.recurrentRegularizer), n.biasRegularizer = Nl(r.biasRegularizer), n.kernelConstraint = $u(r.kernelConstraint), n.recurrentConstraint = $u(r.recurrentConstraint), n.biasConstraint = $u(r.biasConstraint), n.dropout = my([1, Av([0, r.dropout == null ? 0 : r.dropout])]), n.recurrentDropout = my([1, Av([0, r.recurrentDropout == null ? 0 : r.recurrentDropout])]), n.dropoutFunc = r.dropoutFunc, n.implementation = r.implementation, n.stateSize = n.units, n.dropoutMask = null, n.recurrentDropoutMask = null, n;
    }
    return t.prototype.build = function(r) {
      r = bs(r);
      var n = r[r.length - 1];
      this.kernel = this.addWeight("kernel", [n, this.units * 3], null, this.kernelInitializer, this.kernelRegularizer, true, this.kernelConstraint), this.recurrentKernel = this.addWeight("recurrent_kernel", [this.units, this.units * 3], null, this.recurrentInitializer, this.recurrentRegularizer, true, this.recurrentConstraint), this.useBias ? this.bias = this.addWeight("bias", [this.units * 3], null, this.biasInitializer, this.biasRegularizer, true, this.biasConstraint) : this.bias = null, this.built = true;
    }, t.prototype.call = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        if (r = r, r.length !== 2) throw new en("GRUCell expects 2 input Tensors (inputs, h, c), got " + (r.length + "."));
        var o = n.training == null ? false : n.training, s = r[1];
        r = r[0], 0 < a.dropout && a.dropout < 1 && a.dropoutMask == null && (a.dropoutMask = Dv({ ones: function() {
          return Wt.onesLike(r);
        }, rate: a.dropout, training: o, count: 3, dropoutFunc: a.dropoutFunc })), 0 < a.recurrentDropout && a.recurrentDropout < 1 && a.recurrentDropoutMask == null && (a.recurrentDropoutMask = Dv({ ones: function() {
          return Wt.onesLike(s);
        }, rate: a.recurrentDropout, training: o, count: 3, dropoutFunc: a.dropoutFunc }));
        var i = a.dropoutMask, l = a.recurrentDropoutMask, u3, c, f;
        0 < a.dropout && a.dropout < 1 && (r = Wt.mul(r, i[0]));
        var h = Gd(r, a.kernel.read());
        a.useBias && (h = ud(h, a.bias.read())), 0 < a.recurrentDropout && a.recurrentDropout < 1 && (s = Wt.mul(s, l[0]));
        var p = a.recurrentKernel.read(), d = pa(Wt.split(p, [2 * a.units, a.units], p.rank - 1), 2), v = d[0], m = d[1], g = Gd(s, v), x = pa(Wt.split(h, 3, h.rank - 1), 3), b = x[0], y = x[1], w = x[2], _4 = pa(Wt.split(g, 2, g.rank - 1), 2), k = _4[0], T2 = _4[1];
        u3 = a.recurrentActivation.apply(Wt.add(b, k)), c = a.recurrentActivation.apply(Wt.add(y, T2));
        var A2 = Gd(Wt.mul(c, s), m);
        f = a.activation.apply(Wt.add(w, A2));
        var S2 = Wt.add(Wt.mul(u3, s), Wt.mul(Wt.add(1, Wt.neg(u3)), f));
        return [S2, S2];
      });
    }, t.prototype.getConfig = function() {
      var r = e.prototype.getConfig.call(this), n = { units: this.units, activation: Sv(this.activation), recurrentActivation: Sv(this.recurrentActivation), useBias: this.useBias, kernelInitializer: Vl(this.kernelInitializer), recurrentInitializer: Vl(this.recurrentInitializer), biasInitializer: Vl(this.biasInitializer), kernelRegularizer: Gs(this.kernelRegularizer), recurrentRegularizer: Gs(this.recurrentRegularizer), biasRegularizer: Gs(this.biasRegularizer), activityRegularizer: Gs(this.activityRegularizer), kernelConstraint: Gu(this.kernelConstraint), recurrentConstraint: Gu(this.recurrentConstraint), biasConstraint: Gu(this.biasConstraint), dropout: this.dropout, recurrentDropout: this.recurrentDropout, implementation: this.implementation, resetAfter: false };
      return Object.assign({}, r, n);
    }, t;
  }(by);
  Ck.className = "GRUCell";
  ur.serialization.registerClass(Ck);
  var WD = function(e) {
    Hn(t, e);
    function t(r) {
      var n = this;
      return r.implementation === 0 && console.warn("`implementation=0` has been deprecated, and now defaults to `implementation=1`. Please update your layer call."), r.cell = new Ck(r), n = e.call(this, r) || this, n;
    }
    return t.prototype.call = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        a.cell.dropoutMask != null && (Wt.dispose(a.cell.dropoutMask), a.cell.dropoutMask = null), a.cell.recurrentDropoutMask != null && (Wt.dispose(a.cell.recurrentDropoutMask), a.cell.recurrentDropoutMask = null);
        var o = n == null ? null : n.mask, s = n == null ? null : n.training, i = n == null ? null : n.initialState;
        return e.prototype.call.call(a, r, { mask: o, training: s, initialState: i });
      });
    }, t.fromConfig = function(r, n) {
      return n.implmentation === 0 && (n.implementation = 1), new r(n);
    }, t;
  }(k0);
  WD.className = "GRU";
  ur.serialization.registerClass(WD);
  var y2 = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r) || this;
      return n.DEFAULT_ACTIVATION = "tanh", n.DEFAULT_RECURRENT_ACTIVATION = "hardSigmoid", n.DEFAULT_KERNEL_INITIALIZER = "glorotNormal", n.DEFAULT_RECURRENT_INITIALIZER = "orthogonal", n.DEFAULT_BIAS_INITIALIZER = "zeros", n.units = r.units, cc(n.units, "units"), n.activation = Ev(r.activation === void 0 ? n.DEFAULT_ACTIVATION : r.activation), n.recurrentActivation = Ev(r.recurrentActivation === void 0 ? n.DEFAULT_RECURRENT_ACTIVATION : r.recurrentActivation), n.useBias = r.useBias == null ? true : r.useBias, n.kernelInitializer = Il(r.kernelInitializer || n.DEFAULT_KERNEL_INITIALIZER), n.recurrentInitializer = Il(r.recurrentInitializer || n.DEFAULT_RECURRENT_INITIALIZER), n.biasInitializer = Il(r.biasInitializer || n.DEFAULT_BIAS_INITIALIZER), n.unitForgetBias = r.unitForgetBias, n.kernelRegularizer = Nl(r.kernelRegularizer), n.recurrentRegularizer = Nl(r.recurrentRegularizer), n.biasRegularizer = Nl(r.biasRegularizer), n.kernelConstraint = $u(r.kernelConstraint), n.recurrentConstraint = $u(r.recurrentConstraint), n.biasConstraint = $u(r.biasConstraint), n.dropout = my([1, Av([0, r.dropout == null ? 0 : r.dropout])]), n.recurrentDropout = my([1, Av([0, r.recurrentDropout == null ? 0 : r.recurrentDropout])]), n.dropoutFunc = r.dropoutFunc, n.implementation = r.implementation, n.stateSize = [n.units, n.units], n.dropoutMask = null, n.recurrentDropoutMask = null, n;
    }
    return t.prototype.build = function(r) {
      var n;
      r = bs(r);
      var a = r[r.length - 1];
      this.kernel = this.addWeight("kernel", [a, this.units * 4], null, this.kernelInitializer, this.kernelRegularizer, true, this.kernelConstraint), this.recurrentKernel = this.addWeight("recurrent_kernel", [this.units, this.units * 4], null, this.recurrentInitializer, this.recurrentRegularizer, true, this.recurrentConstraint);
      var o;
      if (this.useBias) {
        if (this.unitForgetBias) {
          var s = this.biasInitializer, i = this.units;
          o = new (n = function(l) {
            Hn(u3, l);
            function u3() {
              return l !== null && l.apply(this, arguments) || this;
            }
            return u3.prototype.apply = function(c, f) {
              var h = s.apply([i]), p = new pk().apply([i]), d = s.apply([i * 2]);
              return VB(VB(h, p), d);
            }, u3;
          }(hp), n.className = "CustomInit", n)();
        } else o = this.biasInitializer;
        this.bias = this.addWeight("bias", [this.units * 4], null, o, this.biasRegularizer, true, this.biasConstraint);
      } else this.bias = null;
      this.built = true;
    }, t.prototype.call = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        var o = n.training == null ? false : n.training;
        if (r = r, r.length !== 3) throw new en("LSTMCell expects 3 input Tensors (inputs, h, c), got " + (r.length + "."));
        var s = r[1], i = r[2];
        r = r[0], 0 < a.dropout && a.dropout < 1 && a.dropoutMask == null && (a.dropoutMask = Dv({ ones: function() {
          return Wt.onesLike(r);
        }, rate: a.dropout, training: o, count: 4, dropoutFunc: a.dropoutFunc })), 0 < a.recurrentDropout && a.recurrentDropout < 1 && a.recurrentDropoutMask == null && (a.recurrentDropoutMask = Dv({ ones: function() {
          return Wt.onesLike(s);
        }, rate: a.recurrentDropout, training: o, count: 4, dropoutFunc: a.dropoutFunc }));
        var l = a.dropoutMask, u3 = a.recurrentDropoutMask, c, f, h, p;
        0 < a.dropout && a.dropout < 1 && (r = Wt.mul(r, l[0]));
        var d = Gd(r, a.kernel.read());
        0 < a.recurrentDropout && a.recurrentDropout < 1 && (s = Wt.mul(s, u3[0])), d = Wt.add(d, Gd(s, a.recurrentKernel.read())), a.useBias && (d = ud(d, a.bias.read()));
        var v = pa(Wt.split(d, 4, d.rank - 1), 4), m = v[0], g = v[1], x = v[2], b = v[3];
        c = a.recurrentActivation.apply(m), f = a.recurrentActivation.apply(g), h = Wt.add(Wt.mul(f, i), Wt.mul(c, a.activation.apply(x))), p = a.recurrentActivation.apply(b);
        var y = Wt.mul(p, a.activation.apply(h));
        return [y, y, h];
      });
    }, t.prototype.getConfig = function() {
      var r = e.prototype.getConfig.call(this), n = { units: this.units, activation: Sv(this.activation), recurrentActivation: Sv(this.recurrentActivation), useBias: this.useBias, kernelInitializer: Vl(this.kernelInitializer), recurrentInitializer: Vl(this.recurrentInitializer), biasInitializer: Vl(this.biasInitializer), unitForgetBias: this.unitForgetBias, kernelRegularizer: Gs(this.kernelRegularizer), recurrentRegularizer: Gs(this.recurrentRegularizer), biasRegularizer: Gs(this.biasRegularizer), activityRegularizer: Gs(this.activityRegularizer), kernelConstraint: Gu(this.kernelConstraint), recurrentConstraint: Gu(this.recurrentConstraint), biasConstraint: Gu(this.biasConstraint), dropout: this.dropout, recurrentDropout: this.recurrentDropout, implementation: this.implementation };
      return Object.assign({}, r, n);
    }, t;
  }(by);
  y2.className = "LSTMCell";
  ur.serialization.registerClass(y2);
  var GD = function(e) {
    Hn(t, e);
    function t(r) {
      var n = this;
      return r.implementation === 0 && console.warn("`implementation=0` has been deprecated, and now defaults to `implementation=1`. Please update your layer call."), r.cell = new y2(r), n = e.call(this, r) || this, n;
    }
    return t.prototype.call = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        a.cell.dropoutMask != null && (Wt.dispose(a.cell.dropoutMask), a.cell.dropoutMask = null), a.cell.recurrentDropoutMask != null && (Wt.dispose(a.cell.recurrentDropoutMask), a.cell.recurrentDropoutMask = null);
        var o = n == null ? null : n.mask, s = n == null ? null : n.training, i = n == null ? null : n.initialState;
        return e.prototype.call.call(a, r, { mask: o, training: s, initialState: i });
      });
    }, t.fromConfig = function(r, n) {
      return n.implmentation === 0 && (n.implementation = 1), new r(n);
    }, t;
  }(k0);
  GD.className = "LSTM";
  ur.serialization.registerClass(GD);
  var Mk = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r) || this;
      return n.cells = r.cells, n;
    }
    return Object.defineProperty(t.prototype, "stateSize", { get: function() {
      var r, n, a = [];
      try {
        for (var o = Qn(this.cells.slice().reverse()), s = o.next(); !s.done; s = o.next()) {
          var i = s.value;
          Array.isArray(i.stateSize) ? a.push.apply(a, bo(i.stateSize)) : a.push(i.stateSize);
        }
      } catch (l) {
        r = { error: l };
      } finally {
        try {
          s && !s.done && (n = o.return) && n.call(o);
        } finally {
          if (r) throw r.error;
        }
      }
      return a;
    }, enumerable: true, configurable: true }), t.prototype.call = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        var o, s, i, l;
        r = r;
        var u3 = r.slice(1), c = [];
        try {
          for (var f = Qn(a.cells.slice().reverse()), h = f.next(); !h.done; h = f.next()) {
            var p = h.value;
            Array.isArray(p.stateSize) ? c.push(u3.splice(0, p.stateSize.length)) : c.push(u3.splice(0, 1));
          }
        } catch (y) {
          o = { error: y };
        } finally {
          try {
            h && !h.done && (s = f.return) && s.call(f);
          } finally {
            if (o) throw o.error;
          }
        }
        c.reverse();
        for (var d = [], v, m = 0; m < a.cells.length; ++m) {
          var p = a.cells[m];
          u3 = c[m], m === 0 ? v = [r[0]].concat(u3) : v = [v[0]].concat(u3), v = p.call(v, n), d.push(v.slice(1));
        }
        u3 = [];
        try {
          for (var g = Qn(d.slice().reverse()), x = g.next(); !x.done; x = g.next()) {
            var b = x.value;
            u3.push.apply(u3, bo(b));
          }
        } catch (y) {
          i = { error: y };
        } finally {
          try {
            x && !x.done && (l = g.return) && l.call(g);
          } finally {
            if (i) throw i.error;
          }
        }
        return [v[0]].concat(u3);
      });
    }, t.prototype.build = function(r) {
      O5(r) && (r = r[0]), r = r;
      var n;
      this.cells.forEach(function(a, o) {
        Km("RNNCell_" + o, function() {
          a.build(r), Array.isArray(a.stateSize) ? n = a.stateSize[0] : n = a.stateSize, r = [r[0], n];
        });
      }), this.built = true;
    }, t.prototype.getConfig = function() {
      var r = e.prototype.getConfig.call(this), n = function(s) {
        return { className: s.getClassName(), config: s.getConfig() };
      }, a = this.cells.map(n), o = { cells: a };
      return Object.assign({}, r, o);
    }, t.fromConfig = function(r, n, a) {
      var o, s;
      a === void 0 && (a = {});
      var i = [];
      try {
        for (var l = Qn(n.cells), u3 = l.next(); !u3.done; u3 = l.next()) {
          var c = u3.value;
          i.push(nd(c, a));
        }
      } catch (f) {
        o = { error: f };
      } finally {
        try {
          u3 && !u3.done && (s = l.return) && s.call(l);
        } finally {
          if (o) throw o.error;
        }
      }
      return new r({ cells: i });
    }, Object.defineProperty(t.prototype, "trainableWeights", { get: function() {
      var r, n;
      if (!this.trainable) return [];
      var a = [];
      try {
        for (var o = Qn(this.cells), s = o.next(); !s.done; s = o.next()) {
          var i = s.value;
          a.push.apply(a, bo(i.trainableWeights));
        }
      } catch (l) {
        r = { error: l };
      } finally {
        try {
          s && !s.done && (n = o.return) && n.call(o);
        } finally {
          if (r) throw r.error;
        }
      }
      return a;
    }, enumerable: true, configurable: true }), Object.defineProperty(t.prototype, "nonTrainableWeights", { get: function() {
      var r, n, a, o, s = [];
      try {
        for (var i = Qn(this.cells), l = i.next(); !l.done; l = i.next()) {
          var u3 = l.value;
          s.push.apply(s, bo(u3.nonTrainableWeights));
        }
      } catch (p) {
        r = { error: p };
      } finally {
        try {
          l && !l.done && (n = i.return) && n.call(i);
        } finally {
          if (r) throw r.error;
        }
      }
      if (!this.trainable) {
        var c = [];
        try {
          for (var f = Qn(this.cells), h = f.next(); !h.done; h = f.next()) {
            var u3 = h.value;
            c.push.apply(c, bo(u3.trainableWeights));
          }
        } catch (p) {
          a = { error: p };
        } finally {
          try {
            h && !h.done && (o = f.return) && o.call(f);
          } finally {
            if (a) throw a.error;
          }
        }
        return c.concat(s);
      }
      return s;
    }, enumerable: true, configurable: true }), t.prototype.getWeights = function() {
      var r, n, a = [];
      try {
        for (var o = Qn(this.cells), s = o.next(); !s.done; s = o.next()) {
          var i = s.value;
          a.push.apply(a, bo(i.weights));
        }
      } catch (l) {
        r = { error: l };
      } finally {
        try {
          s && !s.done && (n = o.return) && n.call(o);
        } finally {
          if (r) throw r.error;
        }
      }
      return P5(a);
    }, t.prototype.setWeights = function(r) {
      var n, a, o = [];
      try {
        for (var s = Qn(this.cells), i = s.next(); !i.done; i = s.next()) for (var l = i.value, u3 = l.weights.length, c = r.splice(u3), f = 0; f < l.weights.length; ++f) o.push([l.weights[f], c[f]]);
      } catch (h) {
        n = { error: h };
      } finally {
        try {
          i && !i.done && (a = s.return) && a.call(s);
        } finally {
          if (n) throw n.error;
        }
      }
      yD(o);
    }, t;
  }(by);
  Mk.className = "StackedRNNCells";
  ur.serialization.registerClass(Mk);
  function Dv(e) {
    var t = e.ones, r = e.rate, n = e.training, a = n === void 0 ? false : n, o = e.count, s = o === void 0 ? 1 : o, i = e.dropoutFunc, l = function() {
      return i != null ? i(t(), r) : kV(t(), r);
    }, u3 = function() {
      return m2(l, t, a);
    };
    if (!s || s <= 1) return Wt.keep(u3().clone());
    var c = Array(s).fill(void 0).map(u3);
    return c.map(function(f) {
      return Wt.keep(f.clone());
    });
  }
  var ike = function(e, t) {
    var r = {};
    for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (r[n] = e[n]);
    if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var a = 0, n = Object.getOwnPropertySymbols(e); a < n.length; a++) t.indexOf(n[a]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[a]) && (r[n[a]] = e[n[a]]);
    return r;
  };
  (function(e) {
    Hn(t, e);
    function t() {
      return e !== null && e.apply(this, arguments) || this;
    }
    return t;
  })(by);
  var fj = function(e) {
    Hn(t, e);
    function t(r) {
      var n = this;
      if (r.unroll) throw new ro("Unrolling is not possible with convolutional RNNs.");
      if (Array.isArray(r.cell)) throw new ro("It is not possible at the moment to stack convolutional cells.");
      return n = e.call(this, r) || this, n.inputSpec = [new Cu({ ndim: 5 })], n;
    }
    return t.prototype.call = function(r, n) {
      var a = this;
      return Wt.tidy(function() {
        if (a.cell.dropoutMask != null && (Wt.dispose(a.cell.dropoutMask), a.cell.dropoutMask = null), a.cell.recurrentDropoutMask != null && (Wt.dispose(a.cell.recurrentDropoutMask), a.cell.recurrentDropoutMask = null), n && n.constants) throw new en("ConvRNN2D cell does not support constants");
        var o = n == null ? null : n.mask, s = n == null ? null : n.training, i = n == null ? null : n.initialState;
        return e.prototype.call.call(a, r, { mask: o, training: s, initialState: i });
      });
    }, t.prototype.computeOutputShape = function(r) {
      var n = this.computeSingleOutputShape(r);
      return this.returnSequences || (n = bo([n[0]], n.slice(2))), this.returnState && (n = bo([n], Array(2).fill(bo([r[0]], n.slice(-3))))), n;
    }, t.prototype.getInitialState = function(r) {
      var n = this;
      return Wt.tidy(function() {
        var a = n.cell.stateSize, o = r.shape, s = n.computeSingleOutputShape(o), i = bo([s[0]], s.slice(2)), l = Wt.zeros(i);
        return Array.isArray(a) ? Array(a.length).fill(l) : [l];
      });
    }, t.prototype.resetStates = function(r, n) {
      var a = this;
      n === void 0 && (n = false), Wt.tidy(function() {
        if (!a.stateful) throw new wv("Cannot call resetStates() on an RNN Layer that is not stateful.");
        var o = a.inputSpec[0].shape, s = a.computeSingleOutputShape(o), i = bo([s[0]], s.slice(2)), l = o[0];
        if (l == null) throw new en("If an RNN is stateful, it needs to know its batch size. Specify the batch size of your input tensors: \n- If using a Sequential model, specify the batch size by passing a `batchInputShape` option to your first layer.\n- If using the functional API, specify the batch size by passing a `batchShape` option to your Input layer.");
        if (a.getStates() == null) Array.isArray(a.cell.stateSize) ? a.states_ = a.cell.stateSize.map(function() {
          return Wt.zeros(i);
        }) : a.states_ = [Wt.zeros(i)];
        else if (r == null) Wt.dispose(a.states_), a.keptStates != null && (Wt.dispose(a.keptStates), a.keptStates = []), Array.isArray(a.cell.stateSize) ? a.states_ = a.cell.stateSize.map(function() {
          return Wt.zeros(i);
        }) : a.states_[0] = Wt.zeros(i);
        else {
          if (Array.isArray(r) || (r = [r]), r.length !== a.states_.length) throw new en("Layer " + a.name + " expects " + a.states_.length + " state(s), " + ("but it received " + r.length + " state value(s). Input ") + ("received: " + r));
          n ? a.keptStates.push(a.states_.slice()) : Wt.dispose(a.states_);
          for (var u3 = 0; u3 < a.states_.length; ++u3) {
            var c = r[u3], f = i;
            if (!ur.util.arraysEqual(c.shape, f)) throw new en("State " + u3 + " is incompatible with layer " + a.name + ": " + ("expected shape=" + f + ", received shape=" + c.shape));
            a.states_[u3] = c;
          }
        }
        a.states_ = a.states_.map(function(h) {
          return Wt.keep(h.clone());
        });
      });
    }, t.prototype.computeSingleOutputShape = function(r) {
      var n = this.cell, a = n.dataFormat, o = n.filters, s = n.kernelSize, i = n.padding, l = n.strides, u3 = n.dilationRate, c = a === "channelsFirst", f = r[c ? 3 : 2], h = r[c ? 4 : 3], p = ad(f, s[0], i, l[0], u3[0]), d = ad(h, s[1], i, l[1], u3[1]), v = bo(r.slice(0, 2), c ? [o, p, d] : [p, d, o]);
      return v;
    }, t;
  }(k0);
  fj.className = "ConvRNN2D";
  var Ik = function(e) {
    Hn(t, e);
    function t(r) {
      var n = this, a = r.filters, o = r.kernelSize, s = r.strides, i = r.padding, l = r.dataFormat, u3 = r.dilationRate;
      return n = e.call(this, Object.assign({}, r, { units: a })) || this, n.filters = a, cc(n.filters, "filters"), n.kernelSize = dy(o, 2, "kernelSize"), n.kernelSize.forEach(function(c) {
        return cc(c, "kernelSize");
      }), n.strides = dy(s || 1, 2, "strides"), n.strides.forEach(function(c) {
        return cc(c, "strides");
      }), n.padding = i || "valid", Nh(n.padding), n.dataFormat = l || "channelsLast", pu(n.dataFormat), n.dilationRate = dy(u3 || 1, 2, "dilationRate"), n.dilationRate.forEach(function(c) {
        return cc(c, "dilationRate");
      }), n;
    }
    return t.prototype.build = function(r) {
      var n;
      r = bs(r);
      var a = this.dataFormat === "channelsFirst" ? 1 : r.length - 1;
      if (r[a] == null) throw new en("The channel dimension of the input should be defined. " + ("Found " + r[a]));
      var o = r[a], s = 4, i = this.kernelSize.concat([o, this.filters * s]);
      this.kernel = this.addWeight("kernel", i, null, this.kernelInitializer, this.kernelRegularizer, true, this.kernelConstraint);
      var l = this.kernelSize.concat([this.filters, this.filters * s]);
      if (this.recurrentKernel = this.addWeight("recurrent_kernel", l, null, this.recurrentInitializer, this.recurrentRegularizer, true, this.recurrentConstraint), this.useBias) {
        var u3 = void 0;
        if (this.unitForgetBias) {
          var c = this.biasInitializer, f = this.filters;
          u3 = new (n = function(h) {
            Hn(p, h);
            function p() {
              return h !== null && h.apply(this, arguments) || this;
            }
            return p.prototype.apply = function(d, v) {
              var m = c.apply([f]), g = Wt.ones([f]), x = c.apply([f * 2]);
              return cD([m, g, x]);
            }, p;
          }(hp), n.className = "CustomInit", n)();
        } else u3 = this.biasInitializer;
        this.bias = this.addWeight("bias", [this.filters * s], null, u3, this.biasRegularizer, true, this.biasConstraint);
      }
      this.built = true;
    }, t.prototype.call = function(r, n) {
      var a = this;
      return Wt.tidy(function() {
        if (r.length !== 3) throw new en("ConvLSTM2DCell expects 3 input Tensors (inputs, h, c), got " + (r.length + "."));
        var o = n.training || false, s = r[0], i = r[1], l = r[2], u3 = 4;
        0 < a.dropout && a.dropout < 1 && a.dropoutMask == null && (a.dropoutMask = Dv({ ones: function() {
          return Wt.onesLike(s);
        }, rate: a.dropout, training: o, count: u3, dropoutFunc: a.dropoutFunc }));
        var c = a.dropoutMask, f = function(re, R2, z) {
          return !R2 || !R2[z] ? re : Wt.mul(R2[z], re);
        }, h = f(s, c, 0), p = f(s, c, 1), d = f(s, c, 2), v = f(s, c, 3);
        0 < a.recurrentDropout && a.recurrentDropout < 1 && a.recurrentDropoutMask == null && (a.recurrentDropoutMask = Dv({ ones: function() {
          return Wt.onesLike(i);
        }, rate: a.recurrentDropout, training: o, count: u3, dropoutFunc: a.dropoutFunc }));
        var m = a.recurrentDropoutMask, g = f(i, m, 0), x = f(i, m, 1), b = f(i, m, 2), y = f(i, m, 3), w = 3, _4 = pa(Wt.split(a.kernel.read(), u3, w), 4), k = _4[0], T2 = _4[1], A2 = _4[2], S2 = _4[3], C2 = pa(a.useBias ? Wt.split(a.bias.read(), u3) : [null, null, null, null], 4), E2 = C2[0], F13 = C2[1], N2 = C2[2], D2 = C2[3];
        h = a.inputConv(h, k, E2, a.padding), p = a.inputConv(p, T2, F13, a.padding), d = a.inputConv(d, A2, N2, a.padding), v = a.inputConv(v, S2, D2, a.padding);
        var I2 = pa(Wt.split(a.recurrentKernel.read(), u3, w), 4), O2 = I2[0], L2 = I2[1], V2 = I2[2], W2 = I2[3];
        g = a.recurrentConv(g, O2), x = a.recurrentConv(x, L2), b = a.recurrentConv(b, V2), y = a.recurrentConv(y, W2);
        var X2 = a.recurrentActivation.apply(Wt.add(h, g)), Y2 = a.recurrentActivation.apply(Wt.add(p, x)), K2 = Wt.add(Wt.mul(Y2, l), Wt.mul(X2, a.activation.apply(Wt.add(d, b)))), q = Wt.mul(a.recurrentActivation.apply(Wt.add(v, y)), a.activation.apply(K2));
        return [q, q, K2];
      });
    }, t.prototype.getConfig = function() {
      var r = e.prototype.getConfig.call(this);
      r.units;
      var n = ike(r, ["units"]), a = { filters: this.filters, kernelSize: this.kernelSize, padding: this.padding, dataFormat: this.dataFormat, dilationRate: this.dilationRate, strides: this.strides };
      return Object.assign({}, n, a);
    }, t.prototype.inputConv = function(r, n, a, o) {
      var s = Wt.conv2d(r, n, this.strides, o || "valid", this.dataFormat === "channelsFirst" ? "NCHW" : "NHWC", this.dilationRate);
      return a ? ud(s, a, this.dataFormat) : s;
    }, t.prototype.recurrentConv = function(r, n) {
      var a = 1;
      return Wt.conv2d(r, n, a, "same", this.dataFormat === "channelsFirst" ? "NCHW" : "NHWC");
    }, t;
  }(y2);
  Ik.className = "ConvLSTM2DCell";
  Wt.serialization.registerClass(Ik);
  var $D = function(e) {
    Hn(t, e);
    function t(r) {
      var n = this, a = new Ik(r);
      return n = e.call(this, Object.assign({}, r, { cell: a })) || this, n;
    }
    return t.fromConfig = function(r, n) {
      return new r(n);
    }, t;
  }(fj);
  $D.className = "ConvLSTM2D";
  Wt.serialization.registerClass($D);
  var Nk = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r) || this;
      return n.rate = Math.max(Math.min(r.rate, 1), 0), n.noiseShape = r.noiseShape, n.seed = r.seed, n.supportsMasking = true, n;
    }
    return t.prototype.getNoiseShape = function(r) {
      if (this.noiseShape == null) return this.noiseShape;
      for (var n = r.shape, a = [], o = 0; o < this.noiseShape.length; ++o) a.push(this.noiseShape[o] == null ? n[o] : this.noiseShape[o]);
      return a;
    }, t.prototype.call = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        a.invokeCallHook(r, n);
        var o = no(r);
        if (0 < a.rate && a.rate < 1) {
          var s = n.training == null ? false : n.training, i = a.getNoiseShape(o), l = m2(function() {
            return kV(o, a.rate, i, a.seed);
          }, function() {
            return o;
          }, s);
          return l;
        }
        return r;
      });
    }, t.prototype.getConfig = function() {
      var r = { rate: this.rate, noiseShape: this.noiseShape, seed: this.seed }, n = e.prototype.getConfig.call(this);
      return Object.assign(r, n), r;
    }, t.prototype.dispose = function() {
      return e.prototype.dispose.call(this);
    }, t;
  }(Wo);
  Nk.className = "Dropout";
  ur.serialization.registerClass(Nk);
  var HD = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r) || this;
      return n.inputSpec = [{ ndim: 3 }], n;
    }
    return t.prototype.getNoiseShape = function(r) {
      var n = r.shape;
      return [n[0], 1, n[2]];
    }, t;
  }(Nk);
  HD.className = "SpatialDropout1D";
  ur.serialization.registerClass(HD);
  var qD = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r) || this;
      if (n.activation = null, n.useBias = true, n.kernel = null, n.bias = null, n.DEFAULT_KERNEL_INITIALIZER = "glorotNormal", n.DEFAULT_BIAS_INITIALIZER = "zeros", r.batchInputShape == null && r.inputShape == null && r.inputDim != null) {
        var a = null;
        r.batchSize != null && (a = r.batchSize), n.batchInputShape = [a, r.inputDim];
      }
      return n.units = r.units, cc(n.units, "units"), n.activation = Ev(r.activation), r.useBias != null && (n.useBias = r.useBias), n.kernelInitializer = Il(r.kernelInitializer || n.DEFAULT_KERNEL_INITIALIZER), n.biasInitializer = Il(r.biasInitializer || n.DEFAULT_BIAS_INITIALIZER), n.kernelConstraint = $u(r.kernelConstraint), n.biasConstraint = $u(r.biasConstraint), n.kernelRegularizer = Nl(r.kernelRegularizer), n.biasRegularizer = Nl(r.biasRegularizer), n.activityRegularizer = Nl(r.activityRegularizer), n.supportsMasking = true, n.inputSpec = [{ minNDim: 2 }], n;
    }
    return t.prototype.build = function(r) {
      var n;
      r = bs(r);
      var a = r[r.length - 1];
      this.kernel == null && (this.kernel = this.addWeight("kernel", [a, this.units], null, this.kernelInitializer, this.kernelRegularizer, true, this.kernelConstraint), this.useBias && (this.bias = this.addWeight("bias", [this.units], null, this.biasInitializer, this.biasRegularizer, true, this.biasConstraint))), this.inputSpec = [{ minNDim: 2, axes: (n = {}, n[-1] = a, n) }], this.built = true;
    }, t.prototype.computeOutputShape = function(r) {
      r = bs(r);
      var n = r.slice();
      return n[n.length - 1] = this.units, n;
    }, t.prototype.call = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        a.invokeCallHook(r, n);
        var o = no(r), s = gV(a.activation.getClassName()), i;
        return s != null ? i = Gd(o, a.kernel.read(), s, a.bias ? a.bias.read() : null) : (i = Gd(o, a.kernel.read()), a.bias != null && (i = ud(i, a.bias.read())), a.activation != null && (i = a.activation.apply(i))), i;
      });
    }, t.prototype.getConfig = function() {
      var r = { units: this.units, activation: Sv(this.activation), useBias: this.useBias, kernelInitializer: Vl(this.kernelInitializer), biasInitializer: Vl(this.biasInitializer), kernelRegularizer: Gs(this.kernelRegularizer), biasRegularizer: Gs(this.biasRegularizer), activityRegularizer: Gs(this.activityRegularizer), kernelConstraint: Gu(this.kernelConstraint), biasConstraint: Gu(this.biasConstraint) }, n = e.prototype.getConfig.call(this);
      return Object.assign(r, n), r;
    }, t;
  }(Wo);
  qD.className = "Dense";
  ur.serialization.registerClass(qD);
  var XD = function(e) {
    Hn(t, e);
    function t(r) {
      var n = this;
      return r = r || {}, n = e.call(this, r) || this, n.inputSpec = [{ minNDim: 3 }], n.dataFormat = r.dataFormat, n;
    }
    return t.prototype.computeOutputShape = function(r) {
      var n, a;
      r = bs(r);
      try {
        for (var o = Qn(r.slice(1)), s = o.next(); !s.done; s = o.next()) {
          var i = s.value;
          if (i == null) throw new en('The shape of the input to "Flatten" is not fully defined ' + ("(got " + r.slice(1) + "). Make sure to pass a complete ") + '"input_shape" or "batch_input_shape" argument to the first layer in your model.');
        }
      } catch (l) {
        n = { error: l };
      } finally {
        try {
          s && !s.done && (a = o.return) && a.call(o);
        } finally {
          if (n) throw n.error;
        }
      }
      return [r[0], Tv(r, 1)];
    }, t.prototype.call = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        a.invokeCallHook(r, n);
        var o = no(r);
        if (a.dataFormat === "channelsFirst" && o.rank > 1) {
          for (var s = [0], i = 2; i < o.rank; ++i) s.push(i);
          s.push(1), o = ur.transpose(o, s);
        }
        return wwe(o);
      });
    }, t.prototype.getConfig = function() {
      var r = {};
      this.dataFormat != null && (r.dataFormat = this.dataFormat);
      var n = e.prototype.getConfig.call(this);
      return Object.assign(r, n), r;
    }, t;
  }(Wo);
  XD.className = "Flatten";
  ur.serialization.registerClass(XD);
  var KD = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r) || this;
      return n.supportsMasking = true, n.activation = Ev(r.activation), n;
    }
    return t.prototype.call = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        a.invokeCallHook(r, n);
        var o = no(r);
        return a.activation.apply(o);
      });
    }, t.prototype.getConfig = function() {
      var r = { activation: Sv(this.activation) }, n = e.prototype.getConfig.call(this);
      return Object.assign(r, n), r;
    }, t;
  }(Wo);
  KD.className = "Activation";
  ur.serialization.registerClass(KD);
  var YD = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r) || this;
      return n.n = r.n, n.inputSpec = [{ ndim: 2 }], n;
    }
    return t.prototype.computeOutputShape = function(r) {
      return [r[0], this.n, r[1]];
    }, t.prototype.call = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        return r = no(r), bwe(r, a.n);
      });
    }, t.prototype.getConfig = function() {
      var r = { n: this.n }, n = e.prototype.getConfig.call(this);
      return Object.assign(r, n), r;
    }, t;
  }(Wo);
  YD.className = "RepeatVector";
  ur.serialization.registerClass(YD);
  var ZD = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r) || this;
      n.targetShape = r.targetShape;
      for (var a = 0; a < n.targetShape.length; ++a) n.isUnknown(n.targetShape[a]) && (n.targetShape[a] = null);
      return n;
    }
    return t.prototype.isUnknown = function(r) {
      return r < 0 || r == null;
    }, t.prototype.fixUnknownDimension = function(r, n) {
      for (var a = "Total size of new array must be unchanged.", o = n.slice(), s = 1, i = null, l = 0; l < o.length; ++l) {
        var u3 = o[l];
        if (this.isUnknown(u3)) if (i === null) i = l;
        else throw new en("Can only specifiy one unknown dimension.");
        else s *= u3;
      }
      var c = Tv(r);
      if (i !== null) {
        if (s === 0 || c % s !== 0) throw new en(a);
        o[i] = c / s;
      } else if (c !== s) throw new en(a);
      return o;
    }, t.prototype.computeOutputShape = function(r) {
      for (var n = false, a = 0; a < r.length; ++a) if (this.isUnknown(r[a])) {
        n = true;
        break;
      }
      return n ? r.slice(0, 1).concat(this.targetShape) : r.slice(0, 1).concat(this.fixUnknownDimension(r.slice(1), this.targetShape));
    }, t.prototype.call = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        a.invokeCallHook(r, n);
        var o = no(r), s = o.shape, i = s.slice(0, 1).concat(a.fixUnknownDimension(s.slice(1), a.targetShape));
        return ur.reshape(o, i);
      });
    }, t.prototype.getConfig = function() {
      var r = { targetShape: this.targetShape }, n = e.prototype.getConfig.call(this);
      return Object.assign(r, n), r;
    }, t;
  }(Wo);
  ZD.className = "Reshape";
  ur.serialization.registerClass(ZD);
  var JD = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r) || this;
      if (r.dims == null) throw new Error("Required configuration field `dims` is missing during Permute constructor call.");
      if (!Array.isArray(r.dims)) throw new Error("Permute constructor requires `dims` to be an Array, but received " + (r.dims + " instead."));
      var a = od(1, r.dims.length + 1);
      if (!ur.util.arraysEqual(r.dims.slice().sort(), a)) throw new Error("Invalid permutation `dims`: " + JSON.stringify(r.dims) + " `dims` must contain consecutive integers starting from 1.");
      return n.dims = r.dims, n.dimsIncludingBatch = [0].concat(n.dims), n.inputSpec = [new Cu({ ndim: n.dims.length + 1 })], n;
    }
    return t.prototype.computeOutputShape = function(r) {
      r = bs(r);
      var n = r.slice();
      return this.dims.forEach(function(a, o) {
        n[o + 1] = r[a];
      }), n;
    }, t.prototype.call = function(r, n) {
      return ur.transpose(no(r), this.dimsIncludingBatch);
    }, t.prototype.getConfig = function() {
      var r = { dims: this.dims }, n = e.prototype.getConfig.call(this);
      return Object.assign(r, n), r;
    }, t;
  }(Wo);
  JD.className = "Permute";
  ur.serialization.registerClass(JD);
  var QD = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r ?? {}) || this;
      return n.supportsMasking = true, r != null ? n.maskValue = r.maskValue == null ? 0 : r.maskValue : n.maskValue = 0, n;
    }
    return t.prototype.computeOutputShape = function(r) {
      return r;
    }, t.prototype.getConfig = function() {
      var r = e.prototype.getConfig.call(this), n = { maskValue: this.maskValue };
      return Object.assign(n, r), n;
    }, t.prototype.computeMask = function(r, n) {
      var a = no(r), o = -1;
      return ur.any(ur.notEqual(a, this.maskValue), o);
    }, t.prototype.call = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        a.invokeCallHook(r, n);
        var o = no(r), s = -1, i = true, l = ur.any(ur.notEqual(o, a.maskValue), s, i), u3 = ur.mul(o, ur.cast(l, o.dtype));
        return u3;
      });
    }, t;
  }(Wo);
  QD.className = "Masking";
  ur.serialization.registerClass(QD);
  var eC = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r) || this;
      if (n.embeddings = null, n.DEFAULT_EMBEDDINGS_INITIALIZER = "randomUniform", r.batchInputShape == null && r.inputShape == null) {
        var a = null;
        r.batchSize != null && (a = r.batchSize), r.inputLength == null ? n.batchInputShape = [a, null] : n.batchInputShape = [a].concat(vl(r.inputLength));
      }
      return n.inputDim = r.inputDim, cc(n.inputDim, "inputDim"), n.outputDim = r.outputDim, cc(n.outputDim, "outputDim"), n.embeddingsInitializer = Il(r.embeddingsInitializer || n.DEFAULT_EMBEDDINGS_INITIALIZER), n.embeddingsRegularizer = Nl(r.embeddingsRegularizer), n.activityRegularizer = Nl(r.activityRegularizer), n.embeddingsConstraint = $u(r.embeddingsConstraint), n.maskZero = r.maskZero, n.supportsMasking = r.maskZero, n.inputLength = r.inputLength, n;
    }
    return t.prototype.build = function(r) {
      this.embeddings = this.addWeight("embeddings", [this.inputDim, this.outputDim], this.dtype, this.embeddingsInitializer, this.embeddingsRegularizer, true, this.embeddingsConstraint), this.built = true;
    }, t.prototype.warnOnIncompatibleInputShape = function(r) {
    }, t.prototype.computeMask = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        return a.maskZero ? (r = no(r), ur.notEqual(r, ur.zerosLike(r))) : null;
      });
    }, t.prototype.computeOutputShape = function(r) {
      if (r = bs(r), this.inputLength == null) return bo(r, [this.outputDim]);
      var n = vl(this.inputLength);
      if (n.length !== r.length - 1) throw new en('"inputLength" is ' + this.inputLength + ", but received " + ("input shape has shape " + r));
      for (var a = 0, o = 0; o < n.length; ++o) {
        var s = n[o], i = r[o + 1];
        if (s != null && i != null && s !== i) throw new en('"inputLength" is ' + this.inputLength + ", but received " + ("input shape has shape " + r));
        s == null && (n[a] = i), a++;
      }
      return bo([r[0]], n, [this.outputDim]);
    }, t.prototype.call = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        a.invokeCallHook(r, n);
        var o = no(r);
        o.dtype !== "int32" && (o = fk(o, "int32"));
        var s = wV(a.embeddings.read(), ur.reshape(o, [o.size]));
        return ur.reshape(s, bs(a.computeOutputShape(o.shape)));
      });
    }, t.prototype.getConfig = function() {
      var r = { inputDim: this.inputDim, outputDim: this.outputDim, embeddingsInitializer: Vl(this.embeddingsInitializer), embeddingsRegularizer: Gs(this.embeddingsRegularizer), activityRegularizer: Gs(this.activityRegularizer), embeddingsConstraint: Gu(this.embeddingsConstraint), maskZero: this.maskZero, inputLength: this.inputLength }, n = e.prototype.getConfig.call(this);
      return Object.assign(r, n), r;
    }, t;
  }(Wo);
  eC.className = "Embedding";
  ur.serialization.registerClass(eC);
  var ag = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r || {}) || this;
      return n.supportsMasking = true, n;
    }
    return t.prototype.mergeFunction = function(r) {
      throw new ro();
    }, t.prototype.computeElementwiseOpOutputShape = function(r, n) {
      if (r == null || n == null) return null;
      if (r.length < n.length) return this.computeElementwiseOpOutputShape(n, r);
      if (n.length === 0) return r;
      for (var a = r.slice(0, r.length - n.length), o = 0; o < n.length; ++o) {
        var s = r[r.length - n.length + o], i = n[o];
        if (s == null || i == null || s < 0 || i < 0) a.push(null);
        else if (s === 1) a.push(i);
        else if (i === 1) a.push(s);
        else {
          if (s !== i) throw new en("Operands could not be broadcast together with shapes " + JSON.stringify(r) + " " + JSON.stringify(n));
          a.push(s);
        }
      }
      return a;
    }, t.prototype.build = function(r) {
      var n, a;
      if (Array.isArray(r) && !Array.isArray(r[0]) && (r = [bs(r)]), r = r, r.length < 2) throw new en("A merge layer should be called on an Array of at least 2 inputs." + (" Got " + r.length + " input(s)."));
      var o = [];
      try {
        for (var s = Qn(r), i = s.next(); !i.done; i = s.next()) {
          var l = i.value;
          l != null && l[0] !== null && o.push(l[0]);
        }
      } catch (h) {
        n = { error: h };
      } finally {
        try {
          i && !i.done && (a = s.return) && a.call(s);
        } finally {
          if (n) throw n.error;
        }
      }
      if (o = kv(o), o.length > 1) throw new en("Can not merge tensors with different batch sizes. " + ("Got tensors with shapes: " + JSON.stringify(r) + "."));
      for (var u3 = r[0] == null ? null : r[0].slice(1), c = 1; c < r.length; ++c) {
        var l = r[c] == null ? null : r[c].slice(1);
        u3 = this.computeElementwiseOpOutputShape(u3, l);
      }
      var f = r.map(function(h) {
        return h.length;
      });
      r.indexOf(null) === -1 && kv(f).length === 1 ? this.reshapeRequired = false : this.reshapeRequired = true;
    }, t.prototype.call = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        var o, s, i, l;
        if (r = r, a.reshapeRequired) {
          var u3 = [], c = r.map(function(F13) {
            return F13.rank;
          });
          if (c.indexOf(null) === -1) {
            var f = Av(c);
            try {
              for (var h = Qn(r), p = h.next(); !p.done; p = h.next()) {
                for (var d = p.value, v = d.rank, m = 0; m < f - v; ++m) d = d2(d, 1);
                u3.push(d);
              }
            } catch (F13) {
              o = { error: F13 };
            } finally {
              try {
                p && !p.done && (s = h.return) && s.call(h);
              } finally {
                if (o) throw o.error;
              }
            }
            return a.mergeFunction(u3);
          } else {
            var g = false;
            try {
              for (var x = Qn(r), b = x.next(); !b.done; b = x.next()) {
                var d = b.value, v = d.rank;
                if (v == null) {
                  var y = d.shape, w = y[0], _4 = y.slice(1).concat([w]), k = Wt.reshape(d, [w].concat(Tv(y.slice(1))));
                  k = Wt.transpose(k, [1, 0]), k = Wt.reshape(k, _4), u3.push(k), g = true;
                } else if (v > 1) {
                  var T2 = od(1, v).concat([0]);
                  u3.push(Wt.transpose(d, T2)), g = true;
                } else u3.push(d);
              }
            } catch (F13) {
              i = { error: F13 };
            } finally {
              try {
                b && !b.done && (l = x.return) && l.call(x);
              } finally {
                if (i) throw i.error;
              }
            }
            var A2 = a.mergeFunction(u3), S2 = A2.rank;
            if (g) {
              if (S2 == null) {
                var C2 = A2.shape, E2 = C2.length, w = C2[E2 - 1], _4 = [w].concat(C2.slice(0, C2.length - 1));
                A2 = Wt.reshape(Wt.transpose(Wt.reshape(A2, [-1, w]), [1, 0]), _4);
              } else if (S2 > 1) {
                var T2 = [S2 - 1].concat(od(0, S2 - 1));
                A2 = Wt.transpose(A2, T2);
              }
            }
            return A2;
          }
        } else return a.mergeFunction(r);
      });
    }, t.prototype.computeOutputShape = function(r) {
      var n, a;
      r = r;
      var o;
      r[0] == null ? o = null : o = r[0].slice(1);
      for (var s = 1; s < r.length; ++s) {
        var i = r[s] == null ? null : r[s].slice(1);
        o = this.computeElementwiseOpOutputShape(o, i);
      }
      var l = [];
      try {
        for (var u3 = Qn(r), c = u3.next(); !c.done; c = u3.next()) {
          var i = c.value;
          i != null && i[0] !== null && l.push(i[0]);
        }
      } catch (f) {
        n = { error: f };
      } finally {
        try {
          c && !c.done && (a = u3.return) && a.call(u3);
        } finally {
          if (n) throw n.error;
        }
      }
      return l = kv(l), l.length === 1 ? o = l.concat(o) : o = [null].concat(o), o;
    }, t.prototype.computeMask = function(r, n) {
      return Wt.tidy(function() {
        if (n == null) return null;
        if (!Array.isArray(n)) throw new en("`mask` should be an Array");
        if (!Array.isArray(r)) throw new en("`inputs` should be an Array");
        if (n.length !== r.length) throw new en("The Array 'inputs' and 'mask' are expected to have the same length, but have different lengths " + ("(" + r.length + " vs " + n.length + ")"));
        if (n.every(function(s) {
          return s == null;
        })) return null;
        n = n.map(function(s) {
          return s == null ? s : Wt.expandDims(s, 0);
        });
        for (var a = n[0], o = 1; o < n.length - 1; ++o) a = Wt.logicalAnd(a, n[o]);
        return a;
      });
    }, t;
  }(Wo), tC = function(e) {
    Hn(t, e);
    function t(r) {
      return e.call(this, r) || this;
    }
    return t.prototype.mergeFunction = function(r) {
      return ur.tidy(function() {
        for (var n = r[0].clone(), a = 1; a < r.length; ++a) n = Wt.add(n, r[a]);
        return n;
      });
    }, t;
  }(ag);
  tC.className = "Add";
  ur.serialization.registerClass(tC);
  var rC = function(e) {
    Hn(t, e);
    function t(r) {
      return e.call(this, r) || this;
    }
    return t.prototype.mergeFunction = function(r) {
      return ur.tidy(function() {
        for (var n = r[0].clone(), a = 1; a < r.length; ++a) n = Wt.mul(n, r[a]);
        return n;
      });
    }, t;
  }(ag);
  rC.className = "Multiply";
  ur.serialization.registerClass(rC);
  var nC = function(e) {
    Hn(t, e);
    function t(r) {
      return e.call(this, r) || this;
    }
    return t.prototype.mergeFunction = function(r) {
      return ur.tidy(function() {
        for (var n = r[0].clone(), a = 1; a < r.length; ++a) n = Wt.add(n, r[a]);
        return Wt.mul(1 / r.length, n);
      });
    }, t;
  }(ag);
  nC.className = "Average";
  ur.serialization.registerClass(nC);
  var aC = function(e) {
    Hn(t, e);
    function t(r) {
      return e.call(this, r) || this;
    }
    return t.prototype.mergeFunction = function(r) {
      return ur.tidy(function() {
        for (var n = r[0], a = 1; a < r.length; ++a) n = Wt.maximum(n, r[a]);
        return n;
      });
    }, t;
  }(ag);
  aC.className = "Maximum";
  ur.serialization.registerClass(aC);
  var iC = function(e) {
    Hn(t, e);
    function t(r) {
      return e.call(this, r) || this;
    }
    return t.prototype.mergeFunction = function(r) {
      return ur.tidy(function() {
        for (var n = r[0], a = 1; a < r.length; ++a) n = Wt.minimum(n, r[a]);
        return n;
      });
    }, t;
  }(ag);
  iC.className = "Minimum";
  ur.serialization.registerClass(iC);
  var oC = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r) || this;
      return n.DEFAULT_AXIS = -1, r == null && (r = {}), n.axis = r.axis == null ? n.DEFAULT_AXIS : r.axis, n.supportsMasking = true, n.reshapeRequired = false, n;
    }
    return t.prototype.build = function(r) {
      var n, a, o, s;
      if (!(Array.isArray(r) && Array.isArray(r[0])) || r.length === 1) throw new en("A `Concatenate` layer should be called on a list of at least 2 inputs");
      r = r;
      var i = true;
      try {
        for (var l = Qn(r), u3 = l.next(); !u3.done; u3 = l.next()) {
          var c = u3.value;
          if (c != null) {
            i = false;
            break;
          }
        }
      } catch (g) {
        n = { error: g };
      } finally {
        try {
          u3 && !u3.done && (a = l.return) && a.call(l);
        } finally {
          if (n) throw n.error;
        }
      }
      if (!i) {
        for (var f = [], h = 0; h < r.length; ++h) {
          var p = r[h].slice();
          p.splice(this.axis, 1);
          var d = false;
          try {
            for (var v = (o = void 0, Qn(f)), m = v.next(); !m.done; m = v.next()) {
              var c = m.value;
              if (ur.util.arraysEqual(c, p)) {
                d = true;
                break;
              }
            }
          } catch (g) {
            o = { error: g };
          } finally {
            try {
              m && !m.done && (s = v.return) && s.call(v);
            } finally {
              if (o) throw o.error;
            }
          }
          d || f.push(p);
        }
        if (f.length > 1) throw new en("A `Concatenate` layer requires inputs with matching shapes except for the concat axis. Got input shapes: " + JSON.stringify(r));
      }
    }, t.prototype.mergeFunction = function(r) {
      var n = this;
      return ur.tidy(function() {
        return cD(r, n.axis);
      });
    }, t.prototype.computeOutputShape = function(r) {
      var n, a;
      if (!(Array.isArray(r) && Array.isArray(r[0]))) throw new en("A `Concatenate` layer should be called on a list of inputs.");
      var o = r, s = o[0].slice(), i = this.axis < 0 ? s.length + this.axis : this.axis;
      try {
        for (var l = Qn(o.slice(1)), u3 = l.next(); !u3.done; u3 = l.next()) {
          var c = u3.value;
          if (s[i] == null || c[i] == null) {
            s[i] = null;
            break;
          }
          s[i] += c[i];
        }
      } catch (f) {
        n = { error: f };
      } finally {
        try {
          u3 && !u3.done && (a = l.return) && a.call(l);
        } finally {
          if (n) throw n.error;
        }
      }
      return s;
    }, t.prototype.computeMask = function(r, n) {
      var a = this;
      if (n == null) return null;
      if (!Array.isArray(n)) throw new en("`mask` should be an array for Concatenate");
      if (!Array.isArray(r)) throw new en("`inputs` should be an array for Concatenate");
      if (n.length !== r.length) throw new en("Mismatch in the length of mask (" + n.length + ") " + ("and the legnth of inputs (" + r.length + ")"));
      return Wt.tidy(function() {
        var o = true;
        if (n.forEach(function(u3) {
          if (u3 != null) {
            o = false;
            return;
          }
        }), o) return null;
        for (var s = [], i = 0; i < r.length; ++i) n[i] == null ? s.push(Wt.cast(Wt.onesLike(r[i]), "bool")) : n[i].rank < r[i].rank ? s.push(Wt.expandDims(n[i], -1)) : s.push(n[i]);
        var l = Wt.concat(s, a.axis);
        return Wt.all(l, -1, false);
      });
    }, t.prototype.getConfig = function() {
      var r = { axis: this.axis }, n = e.prototype.getConfig.call(this);
      return Object.assign(r, n), r;
    }, t;
  }(ag);
  oC.className = "Concatenate";
  ur.serialization.registerClass(oC);
  function e2(e, t) {
    for (; e < 0; ) e += t;
    return e;
  }
  function oke(e, t, r) {
    if (e.shape.length > 3 || t.shape.length > 3) throw new ro("batchDot is not implemented for tensors of 4D or higher rank yet");
    if (Wt.util.assert(e.shape.length >= 2, function() {
      return "batchDot requires the rank of x to be >= 2, " + ("but got " + e.shape.length);
    }), Wt.util.assert(e.shape.length >= 2, function() {
      return "batchDot requires the rank of y to be >= 2, " + ("but got " + t.shape.length);
    }), typeof r == "number" && (r = [r, r]), e.dtype === "complex64" || t.dtype === "complex64") throw new ro("batchDot is not implemented for complex64-type Tensors yet.");
    var n = e.shape.length, a = t.shape.length;
    r == null && (r = [n - 1, a - 2]);
    var o = r;
    return Wt.tidy(function() {
      var s;
      if (n > a) {
        s = n - a;
        for (var i = [], l = 0; l < s; ++l) i.push(1);
        t = Wt.reshape(t, t.shape.concat(i));
      } else if (a > n) {
        s = a - n;
        for (var i = [], l = 0; l < s; ++l) i.push(1);
        e = Wt.reshape(e, e.shape.concat(i));
      } else s = 0;
      var u3;
      if (e.shape.length === 2 && t.shape.length === 2) o[0] === o[1] ? u3 = Wt.sum(Wt.mul(e, t), o[0]) : u3 = Wt.sum(Wt.mul(Wt.transpose(e, [1, 0]), t), o[1]);
      else {
        var c = o[0] !== e.shape.length - 1, f = o[1] === t.shape.length - 1;
        u3 = Wt.matMul(e, t, c, f);
      }
      if (s > 0) {
        var h = void 0;
        n > a ? h = n + a - 3 : h = n - 1;
        for (var p = [], l = h; l < h + s; ++l) p.push(l);
        u3 = Wt.squeeze(u3, p);
      }
      return u3.shape.length === 1 && (u3 = Wt.expandDims(u3, 1)), u3;
    });
  }
  var sC = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r) || this;
      return n.axes = r.axes, n.normalize = r.normalize == null ? false : r.normalize, n.supportsMasking = true, n.reshapeRequired = false, n;
    }
    return t.prototype.build = function(r) {
      Wt.util.assert(Array.isArray(r) && r.length === 2 && Array.isArray(r[0]) && Array.isArray(r[1]), function() {
        return "A `Dot` layer should be called on a list of exactly 2 inputs.";
      });
      var n = r[0], a = r[1];
      if (n.length > 3 || a.length > 3) throw new ro("Dot layer does not support tensors of 4D or higher rank yet.");
      var o = this.interpretAxes(n, a);
      if (n[o[0]] !== a[o[1]]) throw new en("Dimension incompatibility: " + (n[o[0]] + " !== " + a[o[1]]));
    }, t.prototype.mergeFunction = function(r) {
      if (r.length !== 2) throw new en("A `Dot` layer must be called on exactly 2 inputs, " + ("but received " + r.length + " input(s)."));
      var n = r[0], a = r[1], o;
      return Array.isArray(this.axes) ? o = this.axes.map(function(s, i) {
        return e2(s, r[i].shape.length);
      }) : o = [e2(this.axes, n.shape.length), e2(this.axes, a.shape.length)], this.normalize && (n = nk(n, o[0]), a = nk(a, o[1])), oke(n, a, o);
    }, t.prototype.interpretAxes = function(r, n) {
      var a;
      return Array.isArray(this.axes) ? a = this.axes : a = [e2(this.axes, r.length), e2(this.axes, n.length)], a;
    }, t.prototype.computeOutputShape = function(r) {
      Wt.util.assert(Array.isArray(r) && r.length === 2 && Array.isArray(r[0]) && Array.isArray(r[1]), function() {
        return "A `Dot` layer should be called on a list of exactly 2 inputs.";
      });
      var n = r[0].slice(), a = r[1].slice();
      if (n.length > 3 || a.length > 3) throw new ro("Dot layer does not support tensors of 4D or higher rank yet.");
      var o = this.interpretAxes(n, a);
      n.splice(o[0], 1), a.splice(o[1], 1), a.splice(0, 1);
      var s = n.concat(a);
      return s.length === 1 && s.push(1), s;
    }, t.prototype.computeMask = function(r, n) {
      return null;
    }, t.prototype.getConfig = function() {
      var r = { axes: this.axes, normalize: this.normalize }, n = e.prototype.getConfig.call(this);
      return Object.assign(r, n), r;
    }, t;
  }(ag);
  sC.className = "Dot";
  ur.serialization.registerClass(sC);
  var lC = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r) || this;
      return n.supportsMasking = true, n.stddev = r.stddev, n;
    }
    return t.prototype.computeOutputShape = function(r) {
      return r;
    }, t.prototype.getConfig = function() {
      var r = e.prototype.getConfig.call(this), n = { stddev: this.stddev };
      return Object.assign(n, r), n;
    }, t.prototype.call = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        a.invokeCallHook(r, n);
        var o = no(r), s = function() {
          return ur.add(hk(o.shape, 0, a.stddev), o);
        }, i = m2(s, function() {
          return o;
        }, n.training || false);
        return i;
      });
    }, t;
  }(Wo);
  lC.className = "GaussianNoise";
  ur.serialization.registerClass(lC);
  var uC = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r) || this;
      return n.supportsMasking = true, n.rate = r.rate, n;
    }
    return t.prototype.computeOutputShape = function(r) {
      return r;
    }, t.prototype.getConfig = function() {
      var r = e.prototype.getConfig.call(this), n = { rate: this.rate };
      return Object.assign(n, r), n;
    }, t.prototype.call = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        a.invokeCallHook(r, n);
        var o = no(r);
        if (a.rate > 0 && a.rate < 1) {
          var s = function() {
            var i = Math.sqrt(a.rate / (1 - a.rate));
            return ur.mul(o, hk(o.shape, 1, i));
          };
          return m2(s, function() {
            return o;
          }, n.training || false);
        }
        return o;
      });
    }, t;
  }(Wo);
  uC.className = "GaussianDropout";
  ur.serialization.registerClass(uC);
  var cC = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r) || this;
      return n.supportsMasking = true, n.rate = r.rate, n.noiseShape = r.noiseShape, n;
    }
    return t.prototype._getNoiseShape = function(r) {
      return this.noiseShape || no(r).shape;
    }, t.prototype.computeOutputShape = function(r) {
      return r;
    }, t.prototype.getConfig = function() {
      var r = e.prototype.getConfig.call(this), n = { rate: this.rate };
      return Object.assign(n, r), n;
    }, t.prototype.call = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        if (a.rate < 1 && a.rate > 0) {
          var o = a._getNoiseShape(r), s = function() {
            var i = no(r), l = 1.6732632423543772, u3 = 1.0507009873554805, c = -l * u3, f = ur.greaterEqual(ur.randomUniform(o), a.rate);
            f = fk(f, "float32");
            var h = Math.pow((1 - a.rate) * (1 + a.rate * Math.pow(c, 2)), -0.5), p = -h * c * a.rate, d = ur.add(ur.mul(i, f), ur.mul(ur.add(f, -1), c));
            return ur.add(ur.mul(d, h), p);
          };
          return m2(s, function() {
            return no(r);
          }, n.training || false);
        }
        return r;
      });
    }, t;
  }(Wo);
  cC.className = "AlphaDropout";
  ur.serialization.registerClass(cC);
  function u2(e, t, r, n, a, o) {
    o === void 0 && (o = 1e-3);
    var s;
    if (e.rank === 2) s = Wt.batchNorm2d(e, t, r, n, a, o);
    else if (e.rank === 3) s = Wt.batchNorm3d(e, t, r, n, a, o);
    else if (e.rank === 4) s = Wt.batchNorm4d(e, t, r, n, a, o);
    else throw new ro("batchNormalization is not implemented for array of rank " + e.rank + " yet");
    return s;
  }
  function ske(e, t, r, n, a) {
    return a === void 0 && (a = 1e-3), ur.tidy(function() {
      var o = Wt.moments(e, n), s = o.mean, i = o.variance, l = u2(e, s, i, r, t, a);
      return [l, s, i];
    });
  }
  function lke(e, t, r, n, a) {
    return a === void 0 && (a = 1e-3), ur.tidy(function() {
      var o, s, i = Wt.moments(e, n), l = i.mean, u3 = i.variance, c = [];
      try {
        for (var f = Qn(od(0, e.rank)), h = f.next(); !h.done; h = f.next()) {
          var p = h.value;
          n.indexOf(p) !== -1 ? c.push(1) : c.push(e.shape[p]);
        }
      } catch (b) {
        o = { error: b };
      } finally {
        try {
          h && !h.done && (s = f.return) && s.call(f);
        } finally {
          if (o) throw o.error;
        }
      }
      var d = ur.reshape(l, c), v = ur.reshape(u3, c), m = t == null ? null : ur.reshape(t, c), g = r == null ? null : ur.reshape(r, c), x = u2(e, d, v, g, m, a);
      return [x, l, u3];
    });
  }
  function uke(e, t, r, n, a) {
    return a === void 0 && (a = 1e-3), ur.util.arraysEqual(n.slice().sort(), od(0, e.rank - 1)) ? ske(e, t, r, n, a) : lke(e, t, r, n, a);
  }
  var fC = function(e) {
    Hn(t, e);
    function t(r) {
      var n = this;
      return r == null && (r = {}), n = e.call(this, r) || this, n.supportsMasking = true, n.axis = r.axis == null ? -1 : r.axis, n.momentum = r.momentum == null ? 0.99 : r.momentum, n.epsilon = r.epsilon == null ? 1e-3 : r.epsilon, n.center = r.center == null ? true : r.center, n.scale = r.scale == null ? true : r.scale, n.betaInitializer = Il(r.betaInitializer || "zeros"), n.gammaInitializer = Il(r.gammaInitializer || "ones"), n.movingMeanInitializer = Il(r.movingMeanInitializer || "zeros"), n.movingVarianceInitializer = Il(r.movingVarianceInitializer || "ones"), n.betaConstraint = $u(r.betaConstraint), n.gammaConstraint = $u(r.gammaConstraint), n.betaRegularizer = Nl(r.betaRegularizer), n.gammaRegularizer = Nl(r.gammaRegularizer), n;
    }
    return t.prototype.build = function(r) {
      var n;
      r = bs(r);
      var a = this.axis >= 0 ? this.axis : this.axis + r.length, o = r[a];
      if (o == null) throw new en("Axis " + a + " of input tensor should have a defined dimension but the layer received an input with shape " + (JSON.stringify(r) + "."));
      this.inputSpec = [new Cu({ ndim: r.length, axes: (n = {}, n[a] = o, n) })];
      var s = [o];
      this.scale && (this.gamma = this.addWeight("gamma", s, null, this.gammaInitializer, this.gammaRegularizer, true, this.gammaConstraint)), this.center && (this.beta = this.addWeight("beta", s, null, this.betaInitializer, this.betaRegularizer, true, this.betaConstraint)), this.movingMean = this.addWeight("moving_mean", s, null, this.movingMeanInitializer, null, false), this.movingVariance = this.addWeight("moving_variance", s, null, this.movingVarianceInitializer, null, false), this.built = true;
    }, t.prototype.call = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        var o = n.training == null ? false : n.training, s = no(r), i = s.shape, l = i.length, u3 = od(0, l), c = a.axis >= 0 ? a.axis : a.axis + l;
        u3.splice(c, 1);
        var f = Jm(1, l);
        f[c] = i[c];
        var h = u3.slice();
        h.sort();
        var p = !ur.util.arraysEqual(h, od(0, l).slice(0, l - 1)), d = function() {
          if (p) {
            var w = ur.reshape(a.movingMean.read(), f), _4 = ur.reshape(a.movingVariance.read(), f), k = a.center ? ur.reshape(a.beta.read(), f) : null, T2 = a.scale ? ur.reshape(a.gamma.read(), f) : null;
            return u2(s, w, _4, k, T2, a.epsilon);
          } else return u2(s, a.movingMean.read(), a.movingVariance.read(), a.beta == null ? null : a.beta.read(), a.gamma == null ? null : a.gamma.read(), a.epsilon);
        };
        if (!o) return d();
        var v = pa(uke(s, a.gamma.read(), a.beta.read(), u3, a.epsilon), 3), m = v[0], g = v[1], x = v[2], b = function(w, _4, k) {
          Wt.tidy(function() {
            var T2 = 1 - k, A2 = w.read(), S2 = Wt.mul(Wt.sub(A2, _4), T2);
            w.write(Wt.sub(A2, S2));
          });
        }, y = function() {
          b(a.movingMean, g, a.momentum), b(a.movingVariance, x, a.momentum);
        };
        return y(), m;
      });
    }, t.prototype.getConfig = function() {
      var r = { axis: this.axis, momentum: this.momentum, epsilon: this.epsilon, center: this.center, scale: this.scale, betaInitializer: Vl(this.betaInitializer), gammaInitializer: Vl(this.gammaInitializer), movingMeanInitializer: Vl(this.movingMeanInitializer), movingVarianceInitializer: Vl(this.movingVarianceInitializer), betaRegularizer: Gs(this.betaRegularizer), gammaRegularizer: Gs(this.gammaRegularizer), betaConstraint: Gu(this.betaConstraint), gammaConstraint: Gu(this.gammaConstraint) }, n = e.prototype.getConfig.call(this);
      return Object.assign(r, n), r;
    }, t;
  }(Wo);
  fC.className = "BatchNormalization";
  ur.serialization.registerClass(fC);
  var hC = function(e) {
    Hn(t, e);
    function t(r) {
      var n, a, o = this;
      if (r == null && (r = {}), o = e.call(this, r) || this, o.axis = r.axis == null ? -1 : r.axis, typeof o.axis == "number") {
        if (!Number.isInteger(o.axis)) throw new Error("Expected axis to be an integer, but received " + o.axis);
      } else if (Array.isArray(o.axis)) try {
        for (var s = Qn(o.axis), i = s.next(); !i.done; i = s.next()) {
          var l = i.value;
          if (!Number.isInteger(l)) throw new Error("Expected axis to be an array of integers, " + ("but received " + JSON.stringify(o.axis)));
        }
      } catch (u3) {
        n = { error: u3 };
      } finally {
        try {
          i && !i.done && (a = s.return) && a.call(s);
        } finally {
          if (n) throw n.error;
        }
      }
      else throw new Error("Expected axis to be an integer or an array of integers, " + ("but received " + JSON.stringify(o.axis)));
      return o.epsilon = r.epsilon == null ? 1e-3 : r.epsilon, o.center = r.center == null ? true : r.center, o.scale = r.scale == null ? true : r.scale, o.betaInitializer = Il(r.betaInitializer || "zeros"), o.gammaInitializer = Il(r.gammaInitializer || "ones"), o.betaRegularizer = Nl(r.betaRegularizer), o.gammaRegularizer = Nl(r.gammaRegularizer), o.supportsMasking = true, o;
    }
    return t.prototype.build = function(r) {
      var n, a;
      r = bs(r);
      var o = r.length;
      typeof this.axis == "number" && (this.axis = [this.axis]);
      for (var s = 0; s < this.axis.length; ++s) this.axis[s] < 0 && (this.axis[s] += o);
      try {
        for (var i = Qn(this.axis), l = i.next(); !l.done; l = i.next()) {
          var u3 = l.value;
          if (u3 < 0 || u3 >= o) throw new Error("Invalid axis: " + u3);
        }
      } catch (h) {
        n = { error: h };
      } finally {
        try {
          l && !l.done && (a = i.return) && a.call(i);
        } finally {
          if (n) throw n.error;
        }
      }
      if (this.axis.length !== kv(this.axis).length) throw new Error("Found duplicate axes in: " + this.axis);
      var c = this.axis.map(function(h) {
        return r[h];
      }), f = true;
      this.scale ? this.gamma = this.addWeight("gamma", c, "float32", this.gammaInitializer, this.gammaRegularizer, f) : this.gamma = null, this.center ? this.beta = this.addWeight("beta", c, "float32", this.betaInitializer, this.betaRegularizer, f) : this.beta = null, this.built = true;
    }, t.prototype.call = function(r, n) {
      var a = this, o = no(r), s = o.shape, i = s.length;
      return ur.tidy(function() {
        var l, u3, c = true, f = ur.moments(o, a.axis, c), h = f.mean, p = f.variance, d = Jm(1, i);
        try {
          for (var v = Qn(a.axis), m = v.next(); !m.done; m = v.next()) {
            var g = m.value;
            d[g] = s[g];
          }
        } catch (T2) {
          l = { error: T2 };
        } finally {
          try {
            m && !m.done && (u3 = v.return) && u3.call(v);
          } finally {
            if (l) throw l.error;
          }
        }
        for (var x = function(T2) {
          return T2 != null && T2.shape.length !== i ? Wt.reshape(T2, d) : T2;
        }, b = x(a.gamma.read()), y = x(a.beta.read()), w = [], _4 = [], k = 0; k < i; ++k) a.axis.indexOf(k) !== -1 ? (w.push(s[k]), _4.push(1)) : (w.push(1), _4.push(s[k]));
        return h = Wt.tile(h, w), p = Wt.tile(p, w), b = Wt.tile(b, _4), y = Wt.tile(y, _4), u2(o, h, p, y, b, a.epsilon);
      });
    }, t.prototype.getConfig = function() {
      var r = { axis: this.axis, epsilon: this.epsilon, center: this.center, scale: this.scale, betaInitializer: Vl(this.betaInitializer), gammaInitializer: Vl(this.gammaInitializer), betaRegularizer: Gs(this.betaRegularizer), gammaRegularizer: Gs(this.gammaRegularizer) }, n = e.prototype.getConfig.call(this);
      return Object.assign(r, n), r;
    }, t;
  }(Wo);
  hC.className = "LayerNormalization";
  ur.serialization.registerClass(hC);
  function cke(e, t, r) {
    return ur.tidy(function() {
      if (e.rank !== 4) throw new en("temporalPadding expects input tensor to be 4-D, but received a " + (e.rank + "-D tensor."));
      if (t == null && (t = [[1, 1], [1, 1]]), t.length !== 2 || t[0].length !== 2 || t[1].length !== 2) throw new en("spatial2dPadding expects `padding` to be an Array of two Arrays, each of which is an Array of two integers.");
      if (r == null && (r = id()), r !== "channelsLast" && r !== "channelsFirst") throw new en("Unknown data format: " + r + ". Supported data formats are 'channelsLast' and 'channelsFirst.");
      var n;
      return r === "channelsFirst" ? n = [[0, 0], [0, 0], t[0], t[1]] : n = [[0, 0], t[0], t[1], [0, 0]], Wt.pad(e, n);
    });
  }
  var pC = function(e) {
    Hn(t, e);
    function t(r) {
      var n = this;
      if (r == null && (r = {}), n = e.call(this, r) || this, n.dataFormat = r.dataFormat == null ? id() : r.dataFormat, r.padding == null) n.padding = [[1, 1], [1, 1]];
      else if (typeof r.padding == "number") n.padding = [[r.padding, r.padding], [r.padding, r.padding]];
      else {
        if (r.padding = r.padding, r.padding.length !== 2) throw new en("ZeroPadding2D expects padding to be a length-2 array, but " + ("received a length-" + r.padding.length + " array."));
        var a = void 0, o = void 0;
        if (typeof r.padding[0] == "number") a = [r.padding[0], r.padding[0]], o = [r.padding[1], r.padding[1]];
        else {
          if (r.padding = r.padding, r.padding[0].length !== 2) throw new en("ZeroPadding2D expects height padding to be a length-2 array, " + ("but received a length-" + r.padding[0].length + " array."));
          if (a = r.padding[0], r.padding[1].length !== 2) throw new en("ZeroPadding2D expects width padding to be a length-2 array, " + ("but received a length-" + r.padding[1].length + " array."));
          o = r.padding[1];
        }
        n.padding = [a, o];
      }
      return n.inputSpec = [new Cu({ ndim: 4 })], n;
    }
    return t.prototype.computeOutputShape = function(r) {
      r = bs(r);
      var n, a;
      return this.dataFormat === "channelsFirst" ? (r[2] != null && r[2] >= 0 ? n = r[2] + this.padding[0][0] + this.padding[0][1] : n = null, r[3] != null && r[3] >= 0 ? a = r[3] + this.padding[1][0] + this.padding[1][1] : a = null, [r[0], r[1], n, a]) : (r[1] != null && r[1] >= 0 ? n = r[1] + this.padding[0][0] + this.padding[0][1] : n = null, r[2] != null && r[2] >= 0 ? a = r[2] + this.padding[1][0] + this.padding[1][1] : a = null, [r[0], n, a, r[3]]);
    }, t.prototype.call = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        return cke(no(r), a.padding, a.dataFormat);
      });
    }, t.prototype.getConfig = function() {
      var r = { padding: this.padding, dataFormat: this.dataFormat }, n = e.prototype.getConfig.call(this);
      return Object.assign(r, n), r;
    }, t;
  }(Wo);
  pC.className = "ZeroPadding2D";
  ur.serialization.registerClass(pC);
  function Fk(e, t, r, n, a, o) {
    return ur.tidy(function() {
      pu(a), yV(o), Nh(n), r == null && (r = [1, 1]), n == null && (n = "valid"), a == null && (a = id()), o == null && (o = "max"), e = OD(e, a);
      var s, i = n === "same" ? "same" : "valid";
      return o === "max" ? s = Wt.maxPool(e, t, r, i) : s = Wt.avgPool(e, t, r, i), a === "channelsFirst" && (s = Wt.transpose(s, [0, 3, 1, 2])), s;
    });
  }
  function hj(e, t, r, n, a, o) {
    return ur.tidy(function() {
      pu(a), yV(o), Nh(n), r == null && (r = [1, 1, 1]), n == null && (n = "valid"), a == null && (a = id()), o == null && (o = "max"), e = oj(e, a);
      var s, i = n === "same" ? "same" : "valid";
      return o === "max" ? s = Wt.maxPool3d(e, t, r, i) : s = Wt.avgPool3d(e, t, r, i), a === "channelsFirst" && (s = Wt.transpose(s, [0, 4, 1, 2, 3])), s;
    });
  }
  var pj = function(e) {
    Hn(t, e);
    function t(r) {
      var n = this;
      if (r.poolSize == null && (r.poolSize = 2), n = e.call(this, r) || this, typeof r.poolSize == "number") n.poolSize = [r.poolSize];
      else if (Array.isArray(r.poolSize) && r.poolSize.length === 1 && typeof r.poolSize[0] == "number") n.poolSize = r.poolSize;
      else throw new en("poolSize for 1D convolutional layer must be a number or an Array of a single number, but received " + ("" + JSON.stringify(r.poolSize)));
      if (cc(n.poolSize, "poolSize"), r.strides == null) n.strides = n.poolSize;
      else if (typeof r.strides == "number") n.strides = [r.strides];
      else if (Array.isArray(r.strides) && r.strides.length === 1 && typeof r.strides[0] == "number") n.strides = r.strides;
      else throw new en("strides for 1D convolutional layer must be a number or an Array of a single number, but received " + ("" + JSON.stringify(r.strides)));
      return cc(n.strides, "strides"), n.padding = r.padding == null ? "valid" : r.padding, Nh(n.padding), n.inputSpec = [new Cu({ ndim: 3 })], n;
    }
    return t.prototype.computeOutputShape = function(r) {
      r = bs(r);
      var n = ad(r[1], this.poolSize[0], this.padding, this.strides[0]);
      return [r[0], n, r[2]];
    }, t.prototype.call = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        a.invokeCallHook(r, n), r = d2(no(r), 2);
        var o = a.poolingFunction(no(r), [a.poolSize[0], 1], [a.strides[0], 1], a.padding, "channelsLast");
        return Wt.squeeze(o, [2]);
      });
    }, t.prototype.getConfig = function() {
      var r = { poolSize: this.poolSize, padding: this.padding, strides: this.strides }, n = e.prototype.getConfig.call(this);
      return Object.assign(r, n), r;
    }, t;
  }(Wo), dC = function(e) {
    Hn(t, e);
    function t(r) {
      return e.call(this, r) || this;
    }
    return t.prototype.poolingFunction = function(r, n, a, o, s) {
      return pu(s), Nh(o), Fk(r, n, a, o, s, "max");
    }, t;
  }(pj);
  dC.className = "MaxPooling1D";
  ur.serialization.registerClass(dC);
  var vC = function(e) {
    Hn(t, e);
    function t(r) {
      return e.call(this, r) || this;
    }
    return t.prototype.poolingFunction = function(r, n, a, o, s) {
      return pu(s), Nh(o), Fk(r, n, a, o, s, "avg");
    }, t;
  }(pj);
  vC.className = "AveragePooling1D";
  ur.serialization.registerClass(vC);
  var dj = function(e) {
    Hn(t, e);
    function t(r) {
      var n = this;
      if (r.poolSize == null && (r.poolSize = [2, 2]), n = e.call(this, r) || this, n.poolSize = Array.isArray(r.poolSize) ? r.poolSize : [r.poolSize, r.poolSize], r.strides == null) n.strides = n.poolSize;
      else if (Array.isArray(r.strides)) {
        if (r.strides.length !== 2) throw new en("If the strides property of a 2D pooling layer is an Array, it is expected to have a length of 2, but received length " + (r.strides.length + "."));
        n.strides = r.strides;
      } else n.strides = [r.strides, r.strides];
      return cc(n.poolSize, "poolSize"), cc(n.strides, "strides"), n.padding = r.padding == null ? "valid" : r.padding, n.dataFormat = r.dataFormat == null ? "channelsLast" : r.dataFormat, pu(n.dataFormat), Nh(n.padding), n.inputSpec = [new Cu({ ndim: 4 })], n;
    }
    return t.prototype.computeOutputShape = function(r) {
      r = bs(r);
      var n = this.dataFormat === "channelsFirst" ? r[2] : r[1], a = this.dataFormat === "channelsFirst" ? r[3] : r[2];
      return n = ad(n, this.poolSize[0], this.padding, this.strides[0]), a = ad(a, this.poolSize[1], this.padding, this.strides[1]), this.dataFormat === "channelsFirst" ? [r[0], r[1], n, a] : [r[0], n, a, r[3]];
    }, t.prototype.call = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        return a.invokeCallHook(r, n), a.poolingFunction(no(r), a.poolSize, a.strides, a.padding, a.dataFormat);
      });
    }, t.prototype.getConfig = function() {
      var r = { poolSize: this.poolSize, padding: this.padding, strides: this.strides, dataFormat: this.dataFormat }, n = e.prototype.getConfig.call(this);
      return Object.assign(r, n), r;
    }, t;
  }(Wo), mC = function(e) {
    Hn(t, e);
    function t(r) {
      return e.call(this, r) || this;
    }
    return t.prototype.poolingFunction = function(r, n, a, o, s) {
      return pu(s), Nh(o), Fk(r, n, a, o, s, "max");
    }, t;
  }(dj);
  mC.className = "MaxPooling2D";
  ur.serialization.registerClass(mC);
  var gC = function(e) {
    Hn(t, e);
    function t(r) {
      return e.call(this, r) || this;
    }
    return t.prototype.poolingFunction = function(r, n, a, o, s) {
      return pu(s), Nh(o), Fk(r, n, a, o, s, "avg");
    }, t;
  }(dj);
  gC.className = "AveragePooling2D";
  ur.serialization.registerClass(gC);
  var vj = function(e) {
    Hn(t, e);
    function t(r) {
      var n = this;
      if (r.poolSize == null && (r.poolSize = [2, 2, 2]), n = e.call(this, r) || this, n.poolSize = Array.isArray(r.poolSize) ? r.poolSize : [r.poolSize, r.poolSize, r.poolSize], r.strides == null) n.strides = n.poolSize;
      else if (Array.isArray(r.strides)) {
        if (r.strides.length !== 3) throw new en("If the strides property of a 3D pooling layer is an Array, it is expected to have a length of 3, but received length " + (r.strides.length + "."));
        n.strides = r.strides;
      } else n.strides = [r.strides, r.strides, r.strides];
      return cc(n.poolSize, "poolSize"), cc(n.strides, "strides"), n.padding = r.padding == null ? "valid" : r.padding, n.dataFormat = r.dataFormat == null ? "channelsLast" : r.dataFormat, pu(n.dataFormat), Nh(n.padding), n.inputSpec = [new Cu({ ndim: 5 })], n;
    }
    return t.prototype.computeOutputShape = function(r) {
      r = bs(r);
      var n = this.dataFormat === "channelsFirst" ? r[2] : r[1], a = this.dataFormat === "channelsFirst" ? r[3] : r[2], o = this.dataFormat === "channelsFirst" ? r[4] : r[3];
      return n = ad(n, this.poolSize[0], this.padding, this.strides[0]), a = ad(a, this.poolSize[1], this.padding, this.strides[1]), o = ad(o, this.poolSize[2], this.padding, this.strides[2]), this.dataFormat === "channelsFirst" ? [r[0], r[1], n, a, o] : [r[0], n, a, o, r[4]];
    }, t.prototype.call = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        return a.invokeCallHook(r, n), a.poolingFunction(no(r), a.poolSize, a.strides, a.padding, a.dataFormat);
      });
    }, t.prototype.getConfig = function() {
      var r = { poolSize: this.poolSize, padding: this.padding, strides: this.strides, dataFormat: this.dataFormat }, n = e.prototype.getConfig.call(this);
      return Object.assign(r, n), r;
    }, t;
  }(Wo), yC = function(e) {
    Hn(t, e);
    function t(r) {
      return e.call(this, r) || this;
    }
    return t.prototype.poolingFunction = function(r, n, a, o, s) {
      return pu(s), Nh(o), hj(r, n, a, o, s, "max");
    }, t;
  }(vj);
  yC.className = "MaxPooling3D";
  ur.serialization.registerClass(yC);
  var xC = function(e) {
    Hn(t, e);
    function t(r) {
      return e.call(this, r) || this;
    }
    return t.prototype.poolingFunction = function(r, n, a, o, s) {
      return pu(s), Nh(o), hj(r, n, a, o, s, "avg");
    }, t;
  }(vj);
  xC.className = "AveragePooling3D";
  ur.serialization.registerClass(xC);
  var mj = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r) || this;
      return n.inputSpec = [new Cu({ ndim: 3 })], n;
    }
    return t.prototype.computeOutputShape = function(r) {
      return [r[0], r[2]];
    }, t.prototype.call = function(r, n) {
      throw new ro();
    }, t;
  }(Wo), bC = function(e) {
    Hn(t, e);
    function t(r) {
      return e.call(this, r || {}) || this;
    }
    return t.prototype.call = function(r, n) {
      return ur.tidy(function() {
        var a = no(r);
        return Wt.mean(a, 1);
      });
    }, t;
  }(mj);
  bC.className = "GlobalAveragePooling1D";
  ur.serialization.registerClass(bC);
  var _C = function(e) {
    Hn(t, e);
    function t(r) {
      return e.call(this, r || {}) || this;
    }
    return t.prototype.call = function(r, n) {
      return ur.tidy(function() {
        var a = no(r);
        return Wt.max(a, 1);
      });
    }, t;
  }(mj);
  _C.className = "GlobalMaxPooling1D";
  ur.serialization.registerClass(_C);
  var gj = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r) || this;
      return n.dataFormat = r.dataFormat == null ? "channelsLast" : r.dataFormat, pu(n.dataFormat), n.inputSpec = [new Cu({ ndim: 4 })], n;
    }
    return t.prototype.computeOutputShape = function(r) {
      return r = r, this.dataFormat === "channelsLast" ? [r[0], r[3]] : [r[0], r[1]];
    }, t.prototype.call = function(r, n) {
      throw new ro();
    }, t.prototype.getConfig = function() {
      var r = { dataFormat: this.dataFormat }, n = e.prototype.getConfig.call(this);
      return Object.assign(r, n), r;
    }, t;
  }(Wo), wC = function(e) {
    Hn(t, e);
    function t() {
      return e !== null && e.apply(this, arguments) || this;
    }
    return t.prototype.call = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        var o = no(r);
        return a.dataFormat === "channelsLast" ? Wt.mean(o, [1, 2]) : Wt.mean(o, [2, 3]);
      });
    }, t;
  }(gj);
  wC.className = "GlobalAveragePooling2D";
  ur.serialization.registerClass(wC);
  var kC = function(e) {
    Hn(t, e);
    function t() {
      return e !== null && e.apply(this, arguments) || this;
    }
    return t.prototype.call = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        var o = no(r);
        return a.dataFormat === "channelsLast" ? Wt.max(o, [1, 2]) : Wt.max(o, [2, 3]);
      });
    }, t;
  }(gj);
  kC.className = "GlobalMaxPooling2D";
  ur.serialization.registerClass(kC);
  var yj = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r) || this;
      return n.layer = r.layer, n;
    }
    return t.prototype.build = function(r) {
      this.built = true;
    }, Object.defineProperty(t.prototype, "trainable", { get: function() {
      return this.layer != null ? this.layer.trainable : false;
    }, set: function(r) {
      this.layer != null && (this.layer.trainable = r);
    }, enumerable: true, configurable: true }), Object.defineProperty(t.prototype, "trainableWeights", { get: function() {
      return this.layer.trainableWeights;
    }, enumerable: true, configurable: true }), Object.defineProperty(t.prototype, "nonTrainableWeights", { get: function() {
      return this.layer.nonTrainableWeights;
    }, enumerable: true, configurable: true }), Object.defineProperty(t.prototype, "updates", { get: function() {
      return this.layer._updates;
    }, enumerable: true, configurable: true }), Object.defineProperty(t.prototype, "losses", { get: function() {
      return this.layer.losses;
    }, enumerable: true, configurable: true }), t.prototype.getWeights = function() {
      return this.layer.getWeights();
    }, t.prototype.setWeights = function(r) {
      this.layer.setWeights(r);
    }, t.prototype.getConfig = function() {
      var r = { layer: { className: this.layer.getClassName(), config: this.layer.getConfig() } }, n = e.prototype.getConfig.call(this);
      return Object.assign(r, n), r;
    }, t.prototype.setFastWeightInitDuringBuild = function(r) {
      e.prototype.setFastWeightInitDuringBuild.call(this, r), this.layer != null && this.layer.setFastWeightInitDuringBuild(r);
    }, t.fromConfig = function(r, n, a) {
      a === void 0 && (a = {});
      var o = n.layer, s = nd(o, a);
      delete n.layer;
      var i = { layer: s };
      return Object.assign(i, n), new r(i);
    }, t;
  }(Wo), TC = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r) || this;
      return n.supportsMasking = true, n;
    }
    return t.prototype.build = function(r) {
      if (r = bs(r), r.length < 3) throw new en("TimeDistributed layer expects an input shape >= 3D, but received " + ("input shape " + JSON.stringify(r)));
      this.inputSpec = [{ shape: r }];
      var n = [r[0]].concat(r.slice(2));
      this.layer.built || (this.layer.build(n), this.layer.built = true), e.prototype.build.call(this, r);
    }, t.prototype.computeOutputShape = function(r) {
      r = bs(r);
      var n = [r[0]].concat(r.slice(2)), a = this.layer.computeOutputShape(n), o = r[1];
      return [a[0], o].concat(a.slice(1));
    }, t.prototype.call = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        r = no(r);
        var o = function(l, u3) {
          var c = no(a.layer.call(l, n));
          return [c, []];
        }, s = cj(o, r, [], false, null, null, false, true), i = s[1];
        return i;
      });
    }, t;
  }(yj);
  TC.className = "TimeDistributed";
  ur.serialization.registerClass(TC);
  function fke(e) {
    rg(vwe, "BidirectionalMergeMode", e);
  }
  var hke = "concat", AC = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this, r) || this, a = r.layer.getConfig(), o = {};
      o.className = r.layer.getClassName(), o.config = a, n.forwardLayer = nd(o), a.goBackwards = a.goBackwards !== true;
      var s = {};
      if (s.className = r.layer.getClassName(), s.config = a, n.backwardLayer = nd(s), n.forwardLayer.name = "forward_" + n.forwardLayer.name, n.backwardLayer.name = "backward_" + n.backwardLayer.name, n.mergeMode = r.mergeMode === void 0 ? hke : r.mergeMode, fke(n.mergeMode), r.weights) throw new ro("weights support is not implemented for Bidirectional layer yet.");
      return n._stateful = r.layer.stateful, n.returnSequences = r.layer.returnSequences, n.returnState = r.layer.returnState, n.supportsMasking = true, n._trainable = true, n.inputSpec = r.layer.inputSpec, n.numConstants = null, n;
    }
    return Object.defineProperty(t.prototype, "trainable", { get: function() {
      return this._trainable;
    }, set: function(r) {
      this._trainable = r, this.forwardLayer != null && (this.forwardLayer.trainable = r), this.backwardLayer != null && (this.backwardLayer.trainable = r);
    }, enumerable: true, configurable: true }), t.prototype.getWeights = function() {
      return this.forwardLayer.getWeights().concat(this.backwardLayer.getWeights());
    }, t.prototype.setWeights = function(r) {
      var n = r.length, a = Math.floor(n / 2);
      this.forwardLayer.setWeights(r.slice(0, a)), this.backwardLayer.setWeights(r.slice(a));
    }, t.prototype.computeOutputShape = function(r) {
      var n = this.forwardLayer.computeOutputShape(r);
      Array.isArray(n) && Array.isArray(n[0]) || (n = [n]), n = n;
      var a, o, s;
      return this.returnState && (s = n.slice(1)), a = n[0], a = a, this.mergeMode === "concat" ? (a[a.length - 1] *= 2, o = [a]) : this.mergeMode == null ? o = [a, a.slice()] : o = [a], this.returnState ? this.mergeMode == null ? o.concat(s).concat(s.slice()) : [a].concat(s).concat(s.slice()) : Nf(o);
    }, t.prototype.apply = function(r, n) {
      var a, o, s = n == null ? null : n.initialState, i = n == null ? null : n.constants;
      n == null && (n = {});
      var l = uj(r, s, i, this.numConstants);
      if (r = l.inputs, s = l.initialState, i = l.constants, Array.isArray(r) && (s = r.slice(1), r = r[0]), (s == null || s.length === 0) && i == null) return e.prototype.apply.call(this, r, n);
      var u3 = [], c = [];
      if (s != null) {
        var f = s.length;
        if (f % 2 > 0) throw new en("When passing `initialState` to a Bidrectional RNN, the state should be an Array containing the states of the underlying RNNs.");
        n.initialState = s, u3.push.apply(u3, bo(s));
        var h = s.map(function(w) {
          return new Cu({ shape: w.shape });
        });
        this.forwardLayer.stateSpec = h.slice(0, f / 2), this.backwardLayer.stateSpec = h.slice(f / 2), c.push.apply(c, bo(h));
      }
      if (i != null) throw new ro("Support for constants in Bidirectional layers is not implemented yet.");
      var p = u3[0] instanceof rd;
      try {
        for (var d = Qn(u3), v = d.next(); !v.done; v = d.next()) {
          var m = v.value;
          if (m instanceof rd !== p) throw new en("The initial state of a Bidirectional layer cannot be specified as a mix of symbolic and non-symbolic tensors");
        }
      } catch (w) {
        a = { error: w };
      } finally {
        try {
          v && !v.done && (o = d.return) && o.call(d);
        } finally {
          if (a) throw a.error;
        }
      }
      if (p) {
        var g = [r].concat(u3), x = this.inputSpec.concat(c), b = this.inputSpec;
        this.inputSpec = x;
        var y = e.prototype.apply.call(this, g, n);
        return this.inputSpec = b, y;
      } else return e.prototype.apply.call(this, r, n);
    }, t.prototype.call = function(r, n) {
      var a = this;
      return ur.tidy(function() {
        var o = n.initialState, s, i;
        if (o == null) s = a.forwardLayer.call(r, n), i = a.backwardLayer.call(r, n);
        else {
          var l = o.slice(0, o.length / 2), u3 = o.slice(o.length / 2);
          s = a.forwardLayer.call(r, Object.assign(n, { initialState: l })), i = a.backwardLayer.call(r, Object.assign(n, { initialState: u3 }));
        }
        var c;
        a.returnState && (Array.isArray(s) && (c = s.slice(1).concat(i.slice(1))), s = s[0], i = i[0]), a.returnSequences && (i = Wt.reverse(i, 1));
        var f;
        return a.mergeMode === "concat" ? f = cD([s, i]) : a.mergeMode === "sum" ? f = Wt.add(s, i) : a.mergeMode === "ave" ? f = Wt.mul(0.5, Wt.add(s, i)) : a.mergeMode === "mul" ? f = Wt.mul(s, i) : a.mergeMode == null && (f = [s, i]), a.returnState ? a.mergeMode == null ? f.concat(c) : [f].concat(c) : f;
      });
    }, t.prototype.resetStates = function(r) {
      this.forwardLayer.resetStates(), this.backwardLayer.resetStates();
    }, t.prototype.build = function(r) {
      var n = this;
      Km(this.forwardLayer.name, function() {
        n.forwardLayer.build(r);
      }), Km(this.backwardLayer.name, function() {
        n.backwardLayer.build(r);
      }), this.built = true;
    }, t.prototype.computeMask = function(r, n) {
      Array.isArray(n) && (n = n[0]);
      var a;
      if (this.returnSequences ? this.mergeMode == null ? a = [n, n] : a = n : this.mergeMode == null ? a = [null, null] : a = null, this.returnState) {
        var o = this.forwardLayer.states, s = o.map(function(i) {
          return null;
        });
        return Array.isArray(a) ? a.concat(s).concat(s) : [a].concat(s).concat(s);
      } else return a;
    }, Object.defineProperty(t.prototype, "trainableWeights", { get: function() {
      return this.forwardLayer.trainableWeights.concat(this.backwardLayer.trainableWeights);
    }, enumerable: true, configurable: true }), Object.defineProperty(t.prototype, "nonTrainableWeights", { get: function() {
      return this.forwardLayer.nonTrainableWeights.concat(this.backwardLayer.nonTrainableWeights);
    }, enumerable: true, configurable: true }), t.prototype.setFastWeightInitDuringBuild = function(r) {
      e.prototype.setFastWeightInitDuringBuild.call(this, r), this.forwardLayer != null && this.forwardLayer.setFastWeightInitDuringBuild(r), this.backwardLayer != null && this.backwardLayer.setFastWeightInitDuringBuild(r);
    }, t.prototype.getConfig = function() {
      var r = { mergeMode: this.mergeMode }, n = e.prototype.getConfig.call(this);
      return Object.assign(r, n), r;
    }, t.fromConfig = function(r, n) {
      var a = nd(n.layer);
      if (delete n.layer, n.numConstants != null) throw new ro("Deserialization of a Bidirectional layer with numConstants present is not supported yet.");
      var o = n;
      return o.layer = a, new r(o);
    }, t;
  }(yj);
  AC.className = "Bidirectional";
  ur.serialization.registerClass(AC);
  function pke(e) {
    return new yy(e);
  }
  function dke(e) {
    return new ID2(e);
  }
  function vke(e) {
    return new DD(e);
  }
  function mke(e) {
    return new CD(e);
  }
  function gke(e) {
    return new MD(e);
  }
  function yke(e) {
    return new FD(e);
  }
  function xke(e) {
    return new ND(e);
  }
  function bke(e) {
    return new zD(e);
  }
  function _ke(e) {
    return new Sk(e);
  }
  function wke(e) {
    return new PD(e);
  }
  function kke(e) {
    return new Ek(e);
  }
  function Tke(e) {
    return new LD(e);
  }
  function Ake(e) {
    return new RD(e);
  }
  function Ske(e) {
    return new BD(e);
  }
  function Eke(e) {
    return new UD(e);
  }
  function Dke(e) {
    return new VD(e);
  }
  function Cke(e) {
    return new KD(e);
  }
  function Mke(e) {
    return new qD(e);
  }
  function Ike(e) {
    return new Nk(e);
  }
  function Nke(e) {
    return new HD(e);
  }
  function Fke(e) {
    return new XD(e);
  }
  function Oke(e) {
    return new YD(e);
  }
  function Pke(e) {
    return new ZD(e);
  }
  function Lke(e) {
    return new JD(e);
  }
  function Rke(e) {
    return new eC(e);
  }
  function zke(e) {
    return new tC(e);
  }
  function Bke(e) {
    return new nC(e);
  }
  function Uke(e) {
    return new oC(e);
  }
  function Vke(e) {
    return new aC(e);
  }
  function jke(e) {
    return new iC(e);
  }
  function Wke(e) {
    return new rC(e);
  }
  function Gke(e) {
    return new sC(e);
  }
  function $ke(e) {
    return new fC(e);
  }
  function Hke(e) {
    return new hC(e);
  }
  function qke(e) {
    return new pC(e);
  }
  function SC(e) {
    return new vC(e);
  }
  function Xke(e) {
    return SC(e);
  }
  function Kke(e) {
    return SC(e);
  }
  function EC(e) {
    return new gC(e);
  }
  function Yke(e) {
    return EC(e);
  }
  function Zke(e) {
    return EC(e);
  }
  function DC(e) {
    return new xC(e);
  }
  function Jke(e) {
    return DC(e);
  }
  function Qke(e) {
    return DC(e);
  }
  function eTe(e) {
    return new bC(e);
  }
  function tTe(e) {
    return new wC(e);
  }
  function xj(e) {
    return new _C(e);
  }
  function bj(e) {
    return new kC(e);
  }
  function _j(e) {
    return new dC(e);
  }
  function wj(e) {
    return new mC(e);
  }
  function rTe(e) {
    return new yC(e);
  }
  function nTe(e) {
    return new WD(e);
  }
  function aTe(e) {
    return new Ck(e);
  }
  function iTe(e) {
    return new GD(e);
  }
  function oTe(e) {
    return new y2(e);
  }
  function sTe(e) {
    return new jD(e);
  }
  function lTe(e) {
    return new Dk(e);
  }
  function uTe(e) {
    return new $D(e);
  }
  function cTe(e) {
    return new Ik(e);
  }
  function fTe(e) {
    return new k0(e);
  }
  function hTe(e) {
    return new Mk(e);
  }
  function pTe(e) {
    return new AC(e);
  }
  function dTe(e) {
    return new TC(e);
  }
  var vTe = xj, mTe = bj, gTe = _j, yTe = wj;
  function xTe(e) {
    return new lC(e);
  }
  function bTe(e) {
    return new uC(e);
  }
  function _Te(e) {
    return new cC(e);
  }
  function wTe(e) {
    return new QD(e);
  }
  var kTe = { __proto__: null, inputLayer: pke, elu: dke, reLU: vke, leakyReLU: mke, prelu: gke, softmax: yke, thresholdedReLU: xke, conv1d: bke, conv2d: _ke, conv2dTranspose: wke, conv3d: kke, conv3dTranspose: Tke, separableConv2d: Ake, cropping2D: Ske, upSampling2d: Eke, depthwiseConv2d: Dke, activation: Cke, dense: Mke, dropout: Ike, spatialDropout1d: Nke, flatten: Fke, repeatVector: Oke, reshape: Pke, permute: Lke, embedding: Rke, add: zke, average: Bke, concatenate: Uke, maximum: Vke, minimum: jke, multiply: Wke, dot: Gke, batchNormalization: $ke, layerNormalization: Hke, zeroPadding2d: qke, averagePooling1d: SC, avgPool1d: Xke, avgPooling1d: Kke, averagePooling2d: EC, avgPool2d: Yke, avgPooling2d: Zke, averagePooling3d: DC, avgPool3d: Jke, avgPooling3d: Qke, globalAveragePooling1d: eTe, globalAveragePooling2d: tTe, globalMaxPooling1d: xj, globalMaxPooling2d: bj, maxPooling1d: _j, maxPooling2d: wj, maxPooling3d: rTe, gru: nTe, gruCell: aTe, lstm: iTe, lstmCell: oTe, simpleRNN: sTe, simpleRNNCell: lTe, convLstm2d: uTe, convLstm2dCell: cTe, rnn: fTe, stackedRNNCells: hTe, bidirectional: pTe, timeDistributed: dTe, globalMaxPool1d: vTe, globalMaxPool2d: mTe, maxPool1d: gTe, maxPool2d: yTe, Layer: Wo, RNN: k0, RNNCell: by, input: $V, gaussianNoise: xTe, gaussianDropout: bTe, alphaDropout: _Te, masking: wTe };
  function TTe(e, t) {
    return _D(e, t);
  }
  function ATe(e, t) {
    return LV(e, t);
  }
  function STe(e, t) {
    return RV(e, t);
  }
  function ETe(e, t) {
    return wD(e, t);
  }
  function DTe(e, t) {
    return kD(e, t);
  }
  function CTe(e, t) {
    return PV(e, t);
  }
  function MTe(e, t) {
    return f3e(e, t);
  }
  function ITe(e, t) {
    return bD(e, t);
  }
  function NTe(e, t) {
    return wk(e, t);
  }
  function FTe(e, t) {
    return xy(e, t);
  }
  function OTe(e, t) {
    return xy(e, t);
  }
  function PTe(e, t) {
    return xy(e, t);
  }
  function LTe(e, t) {
    return ng(e, t);
  }
  function RTe(e, t) {
    return ng(e, t);
  }
  function zTe(e, t) {
    return ng(e, t);
  }
  var BTe = { __proto__: null, binaryAccuracy: TTe, binaryCrossentropy: ATe, sparseCategoricalAccuracy: STe, categoricalAccuracy: ETe, categoricalCrossentropy: DTe, precision: CTe, recall: MTe, cosineProximity: ITe, meanAbsoluteError: NTe, meanAbsolutePercentageError: FTe, MAPE: OTe, mape: PTe, meanSquaredError: LTe, MSE: RTe, mse: zTe };
  var UTe = { __proto__: null, modelFromJSON: H3e };
  function VTe(e) {
    return new g2(e);
  }
  function jTe(e) {
    return eke(e);
  }
  function WTe(e) {
    return tke(e);
  }
  var GTe = { __proto__: null, l1l2: VTe, l1: jTe, l2: WTe }, kj = function(e) {
    Hn(t, e);
    function t() {
      var r = e.apply(this, bo(arguments)) || this;
      return r.model = null, r;
    }
    return t.prototype.setModel = function(r) {
      if (!(r instanceof w0)) throw new Error("model must be a LayersModel, not some other Container");
      this.model = r;
    }, t;
  }(gy);
  function q3(e, t) {
    return e < t;
  }
  function aU(e, t) {
    return e > t;
  }
  var Tj = function(e) {
    Hn(t, e);
    function t(r) {
      var n = e.call(this) || this;
      if (r == null && (r = {}), r.restoreBestWeights) throw new ro("restoreBestWeights = True is not implemented in EarlyStopping yet.");
      return n.monitor = r.monitor || "val_loss", n.minDelta = Math.abs(r.minDelta || 0), n.patience = r.patience || 0, n.verbose = r.verbose || 0, n.mode = r.mode || "auto", n.baseline = r.baseline, ["auto", "min", "max"].indexOf(n.mode) === -1 && (console.warn("EarlyStopping mode '" + n.mode + "' is invalid. Falling back to mode 'auto'."), n.mode = "auto"), n.mode === "min" ? n.monitorFunc = q3 : n.mode === "max" || n.monitor.indexOf("acc") !== -1 ? n.monitorFunc = aU : n.monitorFunc = q3, n.monitorFunc === q3 && (n.minDelta *= -1), n;
    }
    return t.prototype.onTrainBegin = function(r) {
      return Ni(this, void 0, void 0, function() {
        return Ei(this, function(n) {
          return this.wait = 0, this.stoppedEpoch = 0, this.baseline != null ? this.best = this.baseline : this.best = this.monitorFunc === q3 ? 1 / 0 : -1 / 0, [2];
        });
      });
    }, t.prototype.onEpochEnd = function(r, n) {
      return Ni(this, void 0, void 0, function() {
        var a;
        return Ei(this, function(o) {
          switch (o.label) {
            case 0:
              return [4, _v(n)];
            case 1:
              return o.sent(), a = this.getMonitorValue(n), a == null ? [2] : (this.monitorFunc(a - this.minDelta, this.best) ? (this.best = a, this.wait = 0) : (this.wait++, this.wait >= this.patience && (this.stoppedEpoch = r, this.model.stopTraining = true)), [2]);
          }
        });
      });
    }, t.prototype.onTrainEnd = function(r) {
      return Ni(this, void 0, void 0, function() {
        return Ei(this, function(n) {
          return this.stoppedEpoch > 0 && this.verbose && console.log("Epoch " + this.stoppedEpoch + ": early stopping."), [2];
        });
      });
    }, t.prototype.getMonitorValue = function(r) {
      r == null && (r = {});
      var n = r[this.monitor];
      return n == null && console.warn("Metric for EarlyStopping " + this.monitor + " is not available. " + ("Available metrics are: " + Object.keys(r))), n;
    }, t;
  }(kj);
  function $Te(e) {
    return new Tj(e);
  }
  var HTe = { earlyStopping: $Te };
  xl.Callback = kj;
  xl.CallbackList = CV;
  xl.CustomCallback = IV;
  xl.EarlyStopping = Tj;
  xl.History = MV;
  xl.InputSpec = Cu;
  xl.LayerVariable = AV;
  xl.LayersModel = w0;
  xl.RNN = k0;
  xl.Sequential = Tk;
  xl.SymbolicTensor = rd;
  xl.callbacks = HTe;
  xl.constraints = cwe;
  xl.initializers = Hwe;
  xl.input = $V;
  xl.layers = kTe;
  xl.loadLayersModel = J3e;
  xl.metrics = BTe;
  xl.model = Y3e;
  xl.models = UTe;
  xl.registerCallbackConstructor = Q3e;
  xl.regularizers = GTe;
  xl.sequential = Z3e;
  xl.version_layers = TD;
});
var jG = ri((mg) => {
  "use strict";
  Object.defineProperty(mg, "__esModule", { value: true });
  var ui = Gm();
  function qTe(e) {
    if (e && e.__esModule) return e;
    var t = /* @__PURE__ */ Object.create(null);
    return e && Object.keys(e).forEach(function(r) {
      if (r !== "default") {
        var n = Object.getOwnPropertyDescriptor(e, r);
        Object.defineProperty(t, r, n.get ? n : { enumerable: true, get: function() {
          return e[r];
        } });
      }
    }), t.default = e, t;
  }
  var Hc = qTe(ui);
  var XTe = ui.env();
  XTe.registerFlag("KEEP_INTERMEDIATE_TENSORS", function() {
    return false;
  }, function(e) {
    e && console.warn("Keep intermediate tensors is ON. This will print the values of all intermediate tensors during model inference. Not all models support this mode. For details, check e2e/benchmarks/ model_config.js. This significantly impacts performance.");
  });
  var FC = function(e, t) {
    return FC = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, n) {
      r.__proto__ = n;
    } || function(r, n) {
      for (var a in n) n.hasOwnProperty(a) && (r[a] = n[a]);
    }, FC(e, t);
  };
  function KTe(e, t) {
    FC(e, t);
    function r() {
      this.constructor = e;
    }
    e.prototype = t === null ? Object.create(t) : (r.prototype = t.prototype, new r());
  }
  function Ps(e, t, r, n) {
    function a(o) {
      return o instanceof r ? o : new r(function(s) {
        s(o);
      });
    }
    return new (r || (r = Promise))(function(o, s) {
      function i(c) {
        try {
          u2(n.next(c));
        } catch (f) {
          s(f);
        }
      }
      function l(c) {
        try {
          u2(n.throw(c));
        } catch (f) {
          s(f);
        }
      }
      function u2(c) {
        c.done ? o(c.value) : a(c.value).then(i, l);
      }
      u2((n = n.apply(e, t || [])).next());
    });
  }
  function ws(e, t) {
    var r = { label: 0, sent: function() {
      if (o[0] & 1) throw o[1];
      return o[1];
    }, trys: [], ops: [] }, n, a, o, s;
    return s = { next: i(0), throw: i(1), return: i(2) }, typeof Symbol == "function" && (s[Symbol.iterator] = function() {
      return this;
    }), s;
    function i(u2) {
      return function(c) {
        return l([u2, c]);
      };
    }
    function l(u2) {
      if (n) throw new TypeError("Generator is already executing.");
      for (; r; ) try {
        if (n = 1, a && (o = u2[0] & 2 ? a.return : u2[0] ? a.throw || ((o = a.return) && o.call(a), 0) : a.next) && !(o = o.call(a, u2[1])).done) return o;
        switch (a = 0, o && (u2 = [u2[0] & 2, o.value]), u2[0]) {
          case 0:
          case 1:
            o = u2;
            break;
          case 4:
            return r.label++, { value: u2[1], done: false };
          case 5:
            r.label++, a = u2[1], u2 = [0];
            continue;
          case 7:
            u2 = r.ops.pop(), r.trys.pop();
            continue;
          default:
            if (o = r.trys, !(o = o.length > 0 && o[o.length - 1]) && (u2[0] === 6 || u2[0] === 2)) {
              r = 0;
              continue;
            }
            if (u2[0] === 3 && (!o || u2[1] > o[0] && u2[1] < o[3])) {
              r.label = u2[1];
              break;
            }
            if (u2[0] === 6 && r.label < o[1]) {
              r.label = o[1], o = u2;
              break;
            }
            if (o && r.label < o[2]) {
              r.label = o[2], r.ops.push(u2);
              break;
            }
            o[2] && r.ops.pop(), r.trys.pop();
            continue;
        }
        u2 = t.call(e, r);
      } catch (c) {
        u2 = [6, c], a = 0;
      } finally {
        n = o = 0;
      }
      if (u2[0] & 5) throw u2[1];
      return { value: u2[0] ? u2[1] : void 0, done: true };
    }
  }
  function zk(e) {
    var t = typeof Symbol == "function" && Symbol.iterator, r = t && e[t], n = 0;
    if (r) return r.call(e);
    if (e && typeof e.length == "number") return { next: function() {
      return e && n >= e.length && (e = void 0), { value: e && e[n++], done: !e };
    } };
    throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
  }
  function ni(e, t) {
    var r = typeof Symbol == "function" && e[Symbol.iterator];
    if (!r) return e;
    var n = r.call(e), a, o = [], s;
    try {
      for (; (t === void 0 || t-- > 0) && !(a = n.next()).done; ) o.push(a.value);
    } catch (i) {
      s = { error: i };
    } finally {
      try {
        a && !a.done && (r = n.return) && r.call(n);
      } finally {
        if (s) throw s.error;
      }
    }
    return o;
  }
  function Sc() {
    for (var e = [], t = 0; t < arguments.length; t++) e = e.concat(ni(arguments[t]));
    return e;
  }
  var pp;
  (function(e) {
    e[e.DT_INVALID = 0] = "DT_INVALID", e[e.DT_FLOAT = 1] = "DT_FLOAT", e[e.DT_DOUBLE = 2] = "DT_DOUBLE", e[e.DT_INT32 = 3] = "DT_INT32", e[e.DT_UINT8 = 4] = "DT_UINT8", e[e.DT_INT16 = 5] = "DT_INT16", e[e.DT_INT8 = 6] = "DT_INT8", e[e.DT_STRING = 7] = "DT_STRING", e[e.DT_COMPLEX64 = 8] = "DT_COMPLEX64", e[e.DT_INT64 = 9] = "DT_INT64", e[e.DT_BOOL = 10] = "DT_BOOL", e[e.DT_QINT8 = 11] = "DT_QINT8", e[e.DT_QUINT8 = 12] = "DT_QUINT8", e[e.DT_QINT32 = 13] = "DT_QINT32", e[e.DT_BFLOAT16 = 14] = "DT_BFLOAT16", e[e.DT_QINT16 = 15] = "DT_QINT16", e[e.DT_QUINT16 = 16] = "DT_QUINT16", e[e.DT_UINT16 = 17] = "DT_UINT16", e[e.DT_COMPLEX128 = 18] = "DT_COMPLEX128", e[e.DT_HALF = 19] = "DT_HALF", e[e.DT_RESOURCE = 20] = "DT_RESOURCE", e[e.DT_VARIANT = 21] = "DT_VARIANT", e[e.DT_UINT32 = 22] = "DT_UINT32", e[e.DT_UINT64 = 23] = "DT_UINT64", e[e.DT_FLOAT_REF = 101] = "DT_FLOAT_REF", e[e.DT_DOUBLE_REF = 102] = "DT_DOUBLE_REF", e[e.DT_INT32_REF = 103] = "DT_INT32_REF", e[e.DT_UINT8_REF = 104] = "DT_UINT8_REF", e[e.DT_INT16_REF = 105] = "DT_INT16_REF", e[e.DT_INT8_REF = 106] = "DT_INT8_REF", e[e.DT_STRING_REF = 107] = "DT_STRING_REF", e[e.DT_COMPLEX64_REF = 108] = "DT_COMPLEX64_REF", e[e.DT_INT64_REF = 109] = "DT_INT64_REF", e[e.DT_BOOL_REF = 110] = "DT_BOOL_REF", e[e.DT_QINT8_REF = 111] = "DT_QINT8_REF", e[e.DT_QUINT8_REF = 112] = "DT_QUINT8_REF", e[e.DT_QINT32_REF = 113] = "DT_QINT32_REF", e[e.DT_BFLOAT16_REF = 114] = "DT_BFLOAT16_REF", e[e.DT_QINT16_REF = 115] = "DT_QINT16_REF", e[e.DT_QUINT16_REF = 116] = "DT_QUINT16_REF", e[e.DT_UINT16_REF = 117] = "DT_UINT16_REF", e[e.DT_COMPLEX128_REF = 118] = "DT_COMPLEX128_REF", e[e.DT_HALF_REF = 119] = "DT_HALF_REF", e[e.DT_RESOURCE_REF = 120] = "DT_RESOURCE_REF", e[e.DT_VARIANT_REF = 121] = "DT_VARIANT_REF", e[e.DT_UINT32_REF = 122] = "DT_UINT32_REF", e[e.DT_UINT64_REF = 123] = "DT_UINT64_REF";
  })(pp || (pp = {}));
  var Sj;
  (function(e) {
    (function(t) {
      t[t.LEGACY = 0] = "LEGACY", t[t.V1 = 1] = "V1", t[t.V2 = 2] = "V2";
    })(e.CheckpointFormatVersion || (e.CheckpointFormatVersion = {}));
  })(Sj || (Sj = {}));
  var tM = {};
  function YTe(e, t) {
    var r = { tfOpName: e, category: "custom", inputs: [], attrs: [], customExecutor: t };
    tM[e] = r;
  }
  function nW(e) {
    return tM[e];
  }
  function ZTe(e) {
    delete tM[e];
  }
  function Bt(e, t, r, n, a) {
    var o = t.inputParams[e];
    if (o && o.inputIndexStart !== void 0) {
      var s = o.inputIndexStart, i = o.inputIndexEnd === 0 ? void 0 : o.inputIndexEnd === void 0 ? s + 1 : o.inputIndexEnd;
      if (o.type === "tensor") return sf(t.inputNames[o.inputIndexStart], r, n, a);
      if (o.type === "tensors") {
        var l = t.inputNames.slice(s, i);
        return l.map(function(h) {
          return sf(h, r, n, a);
        });
      }
      var u2 = sf(t.inputNames.slice(s)[0], r, n, a), c = u2.dataSync();
      return o.type === "number" ? c[0] : ui.util.toNestedArray(u2.shape, c);
    }
    var f = t.attrParams[e];
    return f && f.value;
  }
  function sf(e, t, r, n) {
    var a = ni(oh(e), 2), o = a[0], s = a[1];
    if (n != null) {
      var i = n.getHashTableHandleByName(o);
      if (i != null) return i;
    }
    var l = r.currentContextIds.find(function(u2) {
      return !!t[Bk(o, u2)];
    });
    return l !== void 0 ? t[Bk(o, l)][s] : void 0;
  }
  function JTe(e, t, r) {
    return t[Bk(e, r.currentContextId)];
  }
  function Hd(e, t) {
    var r = ni(oh(e), 3), n = r[0], a = r[1], o = r[2];
    return [Bk(n, t && t.currentContextId), a, o];
  }
  function Bk(e, t) {
    return t ? e + "-" + t : e;
  }
  function oh(e) {
    var t = e.split(":");
    if (t.length === 1) return [e, 0, void 0];
    var r = t[0], n = t.length === 3 ? t[1] : void 0, a = Number(t[t.length - 1]);
    return [r, a, n];
  }
  function Ok(e, t, r) {
    var n = Bt("pad", e, t, r);
    if (n === "explicit") {
      n = Bt("explicitPaddings", e, t, r);
      for (var a = [[0, 0], [0, 0], [0, 0], [0, 0]], o = 0; o < 4; o++) a[o][0] = n[o * 2], a[o][1] = n[o * 2 + 1];
      return a;
    }
    return n;
  }
  function T0(e) {
    return e.kept ? e : ui.clone(e);
  }
  var QTe = [{ tfOpName: "Add", category: "arithmetic", inputs: [{ start: 0, name: "a", type: "tensor" }, { start: 1, name: "b", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "AddV2", category: "arithmetic", inputs: [{ start: 0, name: "a", type: "tensor" }, { start: 1, name: "b", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "AddN", category: "arithmetic", inputs: [{ start: 0, end: 0, name: "tensors", type: "tensors" }] }, { tfOpName: "BiasAdd", category: "arithmetic", inputs: [{ start: 0, name: "a", type: "tensor" }, { start: 1, name: "b", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }, { tfName: "data_format", name: "dataFormat", type: "string", notSupported: true }] }, { tfOpName: "Sub", category: "arithmetic", inputs: [{ start: 0, name: "a", type: "tensor" }, { start: 1, name: "b", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "RealDiv", category: "arithmetic", inputs: [{ start: 0, name: "a", type: "tensor" }, { start: 1, name: "b", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Div", category: "arithmetic", inputs: [{ start: 0, name: "a", type: "tensor" }, { start: 1, name: "b", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "DivNoNan", category: "arithmetic", inputs: [{ start: 0, name: "a", type: "tensor" }, { start: 1, name: "b", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "FloorDiv", category: "arithmetic", inputs: [{ start: 0, name: "a", type: "tensor" }, { start: 1, name: "b", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Mul", category: "arithmetic", inputs: [{ start: 0, name: "a", type: "tensor" }, { start: 1, name: "b", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Maximum", category: "arithmetic", inputs: [{ start: 0, name: "a", type: "tensor" }, { start: 1, name: "b", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Minimum", category: "arithmetic", inputs: [{ start: 0, name: "a", type: "tensor" }, { start: 1, name: "b", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Pow", category: "arithmetic", inputs: [{ start: 0, name: "a", type: "tensor" }, { start: 1, name: "b", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "SquaredDifference", category: "arithmetic", inputs: [{ start: 0, name: "a", type: "tensor" }, { start: 1, name: "b", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Mod", category: "arithmetic", inputs: [{ start: 0, name: "a", type: "tensor" }, { start: 1, name: "b", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "FloorMod", category: "arithmetic", inputs: [{ start: 0, name: "a", type: "tensor" }, { start: 1, name: "b", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }], eAe = { __proto__: null, json: QTe };
  var tAe = [{ tfOpName: "Abs", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Acos", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Asin", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Atan", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Atan2", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "y", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Ceil", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "ClipByValue", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "clipValueMin", type: "number" }, { start: 2, name: "clipValueMax", type: "number" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Complex", category: "basic_math", inputs: [{ start: 0, name: "real", type: "tensor" }, { start: 1, name: "imag", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "ComplexAbs", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Cos", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Cosh", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Elu", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Exp", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Floor", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Log", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Imag", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }, { tfName: "Tout", name: "outputType", type: "dtype", notSupported: true }] }, { tfOpName: "Neg", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Real", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }, { tfName: "Tout", name: "outputType", type: "dtype", notSupported: true }] }, { tfOpName: "Prelu", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "alpha", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Relu", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Relu6", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Selu", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Sigmoid", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Sin", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Sinh", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Sqrt", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Rsqrt", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Square", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Tan", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Tanh", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Sign", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Round", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Expm1", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Log1p", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Reciprocal", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Softplus", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Asinh", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Acosh", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Atanh", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Erf", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Prod", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "axes", type: "number[]" }], attrs: [{ tfName: "keep_dims", name: "keepDims", type: "bool", notSupported: true }, { tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "LeakyRelu", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "alpha", name: "alpha", type: "number", defaultValue: 0.2 }, { tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "IsNan", category: "basic_math", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }], rAe = { __proto__: null, json: tAe };
  var nAe = [{ tfOpName: "EmptyTensorList", category: "control", inputs: [{ start: 0, name: "elementShape", type: "shape" }, { start: 1, name: "maxNumElements", type: "number" }], attrs: [{ tfName: "element_dtype", name: "elementDType", type: "dtype" }] }, { tfOpName: "LoopCond", category: "control", inputs: [{ start: 0, name: "pred", type: "tensor" }] }, { tfOpName: "Switch", category: "control", inputs: [{ start: 0, name: "data", type: "tensor" }, { start: 1, name: "pred", type: "tensor" }] }, { tfOpName: "Merge", category: "control", inputs: [{ start: 0, end: 0, name: "tensors", type: "tensors" }] }, { tfOpName: "Enter", category: "control", inputs: [{ start: 0, name: "tensor", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }, { tfName: "frame_name", name: "frameName", type: "string" }, { tfName: "is_constant", name: "isConstant", type: "bool" }] }, { tfOpName: "Exit", category: "control", inputs: [{ start: 0, name: "tensor", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "NextIteration", category: "control", inputs: [{ start: 0, name: "tensor", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "TensorArrayV3", category: "control", inputs: [{ start: 0, name: "size", type: "number" }], attrs: [{ tfName: "dtype", name: "dtype", type: "dtype" }, { tfName: "element_shape", name: "elementShape", type: "shape" }, { tfName: "dynamic_size", name: "dynamicSize", type: "bool" }, { tfName: "clear_after_read", name: "clearAfterRead", type: "bool" }, { tfName: "identical_element_shapes", name: "identicalElementShapes", type: "bool" }, { tfName: "tensor_array_name", name: "name", type: "string" }] }, { tfOpName: "TensorArrayWriteV3", category: "control", inputs: [{ start: 0, name: "tensorArrayId", type: "tensor" }, { start: 1, name: "index", type: "number" }, { start: 2, name: "tensor", type: "tensor" }, { start: 3, name: "flowIn", type: "number" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "TensorArrayReadV3", category: "control", inputs: [{ start: 0, name: "tensorArrayId", type: "tensor" }, { start: 1, name: "index", type: "number" }, { start: 2, name: "flowIn", type: "number" }], attrs: [{ tfName: "dtype", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "TensorArrayGatherV3", category: "control", inputs: [{ start: 0, name: "tensorArrayId", type: "tensor" }, { start: 1, name: "indices", type: "number[]" }, { start: 2, name: "flowIn", type: "number" }], attrs: [{ tfName: "dtype", name: "dtype", type: "dtype" }, { tfName: "element_shape", name: "elementShape", type: "shape" }] }, { tfOpName: "TensorArrayScatterV3", category: "control", inputs: [{ start: 0, name: "tensorArrayId", type: "tensor" }, { start: 1, name: "indices", type: "number[]" }, { start: 2, name: "tensor", type: "tensor" }, { start: 3, name: "flowIn", type: "number" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype" }] }, { tfOpName: "TensorArrayConcatV3", category: "control", inputs: [{ start: 0, name: "tensorArrayId", type: "tensor" }, { start: 1, name: "flowIn", type: "number" }], attrs: [{ tfName: "dtype", name: "dtype", type: "dtype" }, { tfName: "element_shape_except0", name: "elementShapeExcept0", type: "shape", notSupported: true }] }, { tfOpName: "TensorArraySplitV3", category: "control", inputs: [{ start: 0, name: "tensorArrayId", type: "tensor" }, { start: 1, name: "tensor", type: "tensor" }, { start: 2, name: "lengths", type: "number[]" }, { start: 3, name: "flowIn", type: "number" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype" }] }, { tfOpName: "TensorArraySizeV3", category: "control", inputs: [{ start: 0, name: "tensorArrayId", type: "tensor" }, { start: 1, name: "flowIn", type: "number" }] }, { tfOpName: "TensorArrayCloseV3", category: "control", inputs: [{ start: 0, name: "tensorArrayId", type: "tensor" }] }, { tfOpName: "StatelessIf", category: "control", inputs: [{ start: 0, name: "cond", type: "tensor" }, { start: 1, end: 0, name: "args", type: "tensors" }], attrs: [{ tfName: "then_branch", name: "thenBranch", type: "func" }, { tfName: "else_branch", name: "elseBranch", type: "func" }] }, { tfOpName: "If", category: "control", inputs: [{ start: 0, name: "cond", type: "tensor" }, { start: 1, end: 0, name: "args", type: "tensors" }], attrs: [{ tfName: "then_branch", name: "thenBranch", type: "func" }, { tfName: "else_branch", name: "elseBranch", type: "func" }] }, { tfOpName: "StatelessWhile", category: "control", inputs: [{ start: 0, end: 0, name: "args", type: "tensors" }], attrs: [{ tfName: "cond", name: "cond", type: "func" }, { tfName: "body", name: "body", type: "func" }] }, { tfOpName: "While", category: "control", inputs: [{ start: 0, end: 0, name: "args", type: "tensors" }], attrs: [{ tfName: "cond", name: "cond", type: "func" }, { tfName: "body", name: "body", type: "func" }] }, { tfOpName: "TensorListScatter", category: "control", inputs: [{ start: 0, name: "tensor", type: "tensor" }, { start: 1, name: "indices", type: "number[]" }, { start: 2, name: "elementShape", type: "shape" }], attrs: [{ tfName: "element_dtype", name: "elementDType", type: "dtype" }] }, { tfOpName: "TensorListScatterV2", category: "control", inputs: [{ start: 0, name: "tensor", type: "tensor" }, { start: 1, name: "indices", type: "number[]" }, { start: 2, name: "elementShape", type: "shape" }, { start: 3, name: "numElements", type: "number" }], attrs: [{ tfName: "element_dtype", name: "elementDType", type: "dtype" }] }, { tfOpName: "TensorListGather", category: "control", inputs: [{ start: 0, name: "tensorListId", type: "tensor" }, { start: 1, name: "indices", type: "number[]" }, { start: 2, name: "elementShape", type: "shape" }], attrs: [{ tfName: "element_dtype", name: "elementDType", type: "dtype" }] }, { tfOpName: "TensorListGetItem", category: "control", inputs: [{ start: 0, name: "tensorListId", type: "tensor" }, { start: 1, name: "index", type: "number" }, { start: 2, name: "elementShape", type: "shape" }], attrs: [{ tfName: "element_dtype", name: "elementDType", type: "dtype" }] }, { tfOpName: "TensorListSetItem", category: "control", inputs: [{ start: 0, name: "tensorListId", type: "tensor" }, { start: 1, name: "index", type: "number" }, { start: 2, name: "tensor", type: "tensor" }], attrs: [{ tfName: "element_dtype", name: "elementDType", type: "dtype" }] }, { tfOpName: "TensorListReserve", category: "control", inputs: [{ start: 0, name: "elementShape", type: "shape" }, { start: 1, name: "numElements", type: "number" }], attrs: [{ tfName: "element_dtype", name: "elementDType", type: "dtype" }] }, { tfOpName: "TensorListFromTensor", category: "control", inputs: [{ start: 0, name: "tensor", type: "tensor" }, { start: 1, name: "elementShape", type: "shape" }], attrs: [{ tfName: "element_dtype", name: "elementDType", type: "dtype" }] }, { tfOpName: "TensorListStack", category: "control", inputs: [{ start: 0, name: "tensorListId", type: "tensor" }, { start: 1, name: "elementShape", type: "shape" }], attrs: [{ tfName: "element_dtype", name: "elementDType", type: "dtype" }, { tfName: "num_elements", name: "numElements", type: "dtype" }] }, { tfOpName: "TensorListSplit", category: "control", inputs: [{ start: 0, name: "tensor", type: "tensor" }, { start: 1, name: "elementShape", type: "shape" }, { start: 2, name: "lengths", type: "number[]" }], attrs: [{ tfName: "element_dtype", name: "elementDType", type: "dtype" }] }, { tfOpName: "TensorListConcat", category: "control", inputs: [{ start: 0, name: "tensorListId", type: "tensor" }], attrs: [{ tfName: "element_shape", name: "elementShape", type: "shape" }, { tfName: "element_dtype", name: "elementDType", type: "dtype" }] }, { tfOpName: "TensorListPopBack", category: "control", inputs: [{ start: 0, name: "tensorListId", type: "tensor" }, { start: 1, name: "elementShape", type: "shape" }], attrs: [{ tfName: "element_dtype", name: "elementDType", type: "dtype" }] }, { tfOpName: "TensorListPushBack", category: "control", inputs: [{ start: 0, name: "tensorListId", type: "tensor" }, { start: 1, name: "tensor", type: "tensor" }], attrs: [{ tfName: "element_dtype", name: "elementDType", type: "dtype" }] }], aAe = { __proto__: null, json: nAe };
  var iAe = [{ tfOpName: "AvgPool", category: "convolution", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "strides", name: "strides", type: "number[]" }, { tfName: "padding", name: "pad", type: "string" }, { tfName: "data_format", name: "dataFormat", type: "string", notSupported: true }, { tfName: "ksize", name: "kernelSize", type: "number[]" }, { tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "MaxPool", category: "convolution", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "strides", name: "strides", type: "number[]" }, { tfName: "padding", name: "pad", type: "string" }, { tfName: "data_format", name: "dataFormat", type: "string", notSupported: true }, { tfName: "ksize", name: "kernelSize", type: "number[]" }, { tfName: "explicit_paddings", name: "explicitPaddings", type: "number[]", defaultValue: [], notSupported: true }, { tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "MaxPoolWithArgmax", category: "convolution", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "strides", name: "strides", type: "number[]" }, { tfName: "padding", name: "pad", type: "string" }, { tfName: "ksize", name: "kernelSize", type: "number[]" }, { tfName: "include_batch_in_index", name: "includeBatchInIndex", type: "bool" }, { tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "AvgPool3D", category: "convolution", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "strides", name: "strides", type: "number[]" }, { tfName: "padding", name: "pad", type: "string" }, { tfName: "data_format", name: "dataFormat", type: "string", notSupported: true }, { tfName: "ksize", name: "kernelSize", type: "number[]" }, { tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "MaxPool3D", category: "convolution", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "strides", name: "strides", type: "number[]" }, { tfName: "padding", name: "pad", type: "string" }, { tfName: "data_format", name: "dataFormat", type: "string", notSupported: true }, { tfName: "ksize", name: "kernelSize", type: "number[]" }, { tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Conv1D", category: "convolution", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "filter", type: "tensor" }], attrs: [{ tfName: "stride", name: "stride", type: "number" }, { tfName: "padding", name: "pad", type: "string" }, { tfName: "data_format", name: "dataFormat", type: "string", defaultValue: "NWC" }, { tfName: "T", name: "dtype", type: "dtype", notSupported: true }, { tfName: "dilation", name: "dilation", type: "number", defaultValue: 1 }] }, { tfOpName: "Conv2D", category: "convolution", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "filter", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }, { tfName: "strides", name: "strides", type: "number[]" }, { tfName: "padding", name: "pad", type: "string" }, { tfName: "useCudnnOnGpu", name: "useCudnnOnGpu", type: "bool" }, { tfName: "data_format", name: "dataFormat", type: "string", defaultValue: "NHWC" }, { tfName: "explicit_paddings", name: "explicitPaddings", type: "number[]", defaultValue: [] }, { tfName: "dilations", name: "dilations", type: "number[]" }] }, { tfOpName: "_FusedConv2D", category: "convolution", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "filter", type: "tensor" }, { start: 2, end: 0, name: "args", type: "tensors" }], attrs: [{ tfName: "num_args", name: "numArgs", type: "number" }, { tfName: "T", name: "dtype", type: "dtype", notSupported: true }, { tfName: "strides", name: "strides", type: "number[]" }, { tfName: "padding", name: "pad", type: "string" }, { tfName: "explicit_paddings", name: "explicitPaddings", type: "number[]", defaultValue: [] }, { tfName: "use_cudnn_on_gpu", name: "useCudnnOnGpu", type: "bool", defaultValue: true }, { tfName: "data_format", name: "dataFormat", type: "string", defaultValue: "NHWC" }, { tfName: "dilations", name: "dilations", type: "number[]", defaultValue: [1, 1, 1, 1] }, { tfName: "fused_ops", name: "fusedOps", type: "string[]", defaultValue: [] }, { tfName: "epsilon", name: "epsilon", type: "number", defaultValue: 1e-4 }, { tfName: "leakyrelu_alpha", name: "leakyreluAlpha", type: "number" }] }, { tfOpName: "Conv2DBackpropInput", category: "convolution", inputs: [{ start: 2, name: "x", type: "tensor" }, { start: 1, name: "filter", type: "tensor" }, { start: 0, name: "outputShape", type: "number[]" }], attrs: [{ tfName: "strides", name: "strides", type: "number[]" }, { tfName: "padding", name: "pad", type: "string" }, { tfName: "data_format", name: "dataFormat", type: "string", notSupported: true }, { tfName: "explicit_paddings", name: "explicitPaddings", type: "number[]", defaultValue: [] }, { tfName: "dilations", name: "dilations", type: "number[]", notSupported: true }] }, { tfOpName: "DepthwiseConv2d", category: "convolution", inputs: [{ start: 0, name: "input", type: "tensor" }, { start: 1, name: "filter", type: "tensor" }], attrs: [{ tfName: "strides", name: "strides", type: "number[]" }, { tfName: "padding", name: "pad", type: "string" }, { tfName: "data_format", name: "dataFormat", type: "string", defaultValue: "NHWC" }, { tfName: "explicit_paddings", name: "explicitPaddings", type: "number[]", defaultValue: [] }, { tfName: "dilations", name: "dilations", type: "number[]" }] }, { tfOpName: "DepthwiseConv2dNative", category: "convolution", inputs: [{ start: 0, name: "input", type: "tensor" }, { start: 1, name: "filter", type: "tensor" }], attrs: [{ tfName: "strides", name: "strides", type: "number[]" }, { tfName: "padding", name: "pad", type: "string" }, { tfName: "data_format", name: "dataFormat", type: "string", defaultValue: "NHWC" }, { tfName: "explicit_paddings", name: "explicitPaddings", type: "number[]", defaultValue: [] }, { tfName: "dilations", name: "dilations", type: "number[]" }] }, { tfOpName: "FusedDepthwiseConv2dNative", category: "convolution", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "filter", type: "tensor" }, { start: 2, end: 0, name: "args", type: "tensors" }], attrs: [{ tfName: "num_args", name: "numArgs", type: "number" }, { tfName: "T", name: "dtype", type: "dtype", notSupported: true }, { tfName: "strides", name: "strides", type: "number[]" }, { tfName: "padding", name: "pad", type: "string" }, { tfName: "data_format", name: "dataFormat", type: "string", defaultValue: "NHWC" }, { tfName: "dilations", name: "dilations", type: "number[]", defaultValue: [1, 1, 1, 1] }, { tfName: "fused_ops", name: "fusedOps", type: "string[]", defaultValue: [] }, { tfName: "explicit_paddings", name: "explicitPaddings", type: "number[]", defaultValue: [] }] }, { tfOpName: "Conv3D", category: "convolution", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "filter", type: "tensor" }], attrs: [{ tfName: "strides", name: "strides", type: "number[]" }, { tfName: "padding", name: "pad", type: "string" }, { tfName: "data_format", name: "dataFormat", type: "string", defaultValue: "NHWC" }, { tfName: "dilations", name: "dilations", type: "number[]" }] }, { tfOpName: "Dilation2D", category: "convolution", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "filter", type: "tensor" }], attrs: [{ tfName: "strides", name: "strides", type: "number[]" }, { tfName: "rates", name: "dilations", type: "number[]" }, { tfName: "padding", name: "pad", type: "string" }] }], oAe = { __proto__: null, json: iAe };
  var sAe = [{ tfOpName: "Fill", category: "creation", inputs: [{ start: 0, name: "shape", type: "number[]" }, { start: 1, name: "value", type: "number" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype" }] }, { tfOpName: "LinSpace", category: "creation", inputs: [{ start: 0, name: "start", type: "number" }, { start: 1, name: "stop", type: "number" }, { start: 2, name: "num", type: "number" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "OneHot", category: "creation", inputs: [{ start: 0, name: "indices", type: "tensor" }, { start: 1, name: "depth", type: "number" }, { start: 2, name: "onValue", type: "number", defaultValue: 1 }, { start: 3, name: "offValue", type: "number", defaultValue: 0 }], attrs: [{ tfName: "axis", name: "axis", type: "number", notSupported: true }, { tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Ones", category: "creation", inputs: [{ start: 0, name: "shape", type: "number[]" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype" }] }, { tfOpName: "OnesLike", category: "creation", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "dtype", name: "dtype", type: "dtype" }] }, { tfOpName: "RandomUniform", category: "creation", inputs: [{ start: 0, name: "shape", type: "number[]" }], attrs: [{ tfName: "minval", name: "minval", type: "number", defaultValue: 0 }, { tfName: "maxval", name: "maxval", type: "number", defaultValue: 1 }, { tfName: "dtype", name: "dtype", type: "dtype" }, { tfName: "seed", name: "seed", type: "number", defaultValue: 0 }, { tfName: "seed2", name: "seed2", type: "number", defaultValue: 0, notSupported: true }, { tfName: "T", name: "T", type: "number", notSupported: true }] }, { tfOpName: "Range", category: "creation", inputs: [{ start: 0, name: "start", type: "number" }, { start: 1, name: "stop", type: "number" }, { start: 2, name: "step", type: "number", defaultValue: 0 }], attrs: [{ tfName: "Tidx", name: "dtype", type: "dtype" }] }, { tfOpName: "TruncatedNormal", category: "creation", inputs: [{ start: 0, name: "shape", type: "number[]" }], attrs: [{ tfName: "means", name: "mean", type: "number", defaultValue: 0 }, { tfName: "stddev", name: "stdDev", type: "number", defaultValue: 1 }, { tfName: "seed", name: "seed", type: "number" }, { tfName: "seed2", name: "seed2", type: "number", defaultValue: 0, notSupported: true }, { tfName: "dtype", name: "dtype", type: "dtype" }, { tfName: "T", name: "T", type: "number", notSupported: true }] }, { tfOpName: "Zeros", category: "creation", inputs: [{ start: 0, name: "shape", type: "number[]" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype" }] }, { tfOpName: "ZerosLike", category: "creation", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype" }] }, { tfOpName: "Multinomial", category: "creation", inputs: [{ start: 0, name: "logits", type: "tensor" }, { start: 1, name: "numSamples", type: "number" }], attrs: [{ tfName: "seed", name: "seed", type: "number" }, { tfName: "seed2", name: "seed2", type: "number" }, { tfName: "T", name: "dtype", type: "dtype" }, { tfName: "output_dtype", name: "output_dtype", type: "dtype" }] }], lAe = { __proto__: null, json: sAe };
  var uAe = [{ tfOpName: "NonMaxSuppressionV2", category: "dynamic", inputs: [{ start: 0, name: "boxes", type: "tensor" }, { start: 1, name: "scores", type: "tensor" }, { start: 2, name: "maxOutputSize", type: "number" }, { start: 3, name: "iouThreshold", type: "number" }] }, { tfOpName: "NonMaxSuppressionV3", category: "dynamic", inputs: [{ start: 0, name: "boxes", type: "tensor" }, { start: 1, name: "scores", type: "tensor" }, { start: 2, name: "maxOutputSize", type: "number" }, { start: 3, name: "iouThreshold", type: "number" }, { start: 4, name: "scoreThreshold", type: "number" }] }, { tfOpName: "NonMaxSuppressionV4", category: "dynamic", inputs: [{ start: 0, name: "boxes", type: "tensor" }, { start: 1, name: "scores", type: "tensor" }, { start: 2, name: "maxOutputSize", type: "number" }, { start: 3, name: "iouThreshold", type: "number" }, { start: 4, name: "scoreThreshold", type: "number" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }, { tfName: "T_threshold", name: "threshold", type: "dtype", notSupported: true }, { tfName: "pad_to_max_output_size", name: "padToMaxOutputSize", type: "bool" }] }, { tfOpName: "NonMaxSuppressionV5", category: "dynamic", inputs: [{ start: 0, name: "boxes", type: "tensor" }, { start: 1, name: "scores", type: "tensor" }, { start: 2, name: "maxOutputSize", type: "number" }, { start: 3, name: "iouThreshold", type: "number" }, { start: 4, name: "scoreThreshold", type: "number" }, { start: 5, name: "softNmsSigma", type: "number" }] }, { tfOpName: "Where", category: "dynamic", inputs: [{ start: 0, name: "condition", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "ListDiff", category: "dynamic", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "y", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }], cAe = { __proto__: null, json: uAe };
  var fAe = [{ tfOpName: "TopKV2", category: "evaluation", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "k", type: "number" }], attrs: [{ tfName: "sorted", name: "sorted", type: "bool" }] }, { tfOpName: "Unique", category: "evaluation", inputs: [{ start: 0, name: "x", type: "tensor" }] }, { tfOpName: "UniqueV2", category: "evaluation", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "axis", type: "number" }] }], hAe = { __proto__: null, json: fAe };
  var pAe = [{ tfOpName: "PlaceholderWithDefault", category: "graph", inputs: [{ start: 0, name: "default", type: "tensor" }], attrs: [{ tfName: "shape", name: "shape", type: "shape" }, { tfName: "dtype", name: "dtype", type: "dtype" }] }, { tfOpName: "Placeholder", category: "graph", attrs: [{ tfName: "shape", name: "shape", type: "shape" }, { tfName: "dtype", name: "dtype", type: "dtype" }] }, { tfOpName: "Const", category: "graph" }, { tfOpName: "Identity", category: "graph", inputs: [{ start: 0, name: "x", type: "tensor" }] }, { tfOpName: "IdentityN", category: "graph", inputs: [{ start: 0, end: 0, name: "x", type: "tensors" }] }, { tfOpName: "Snapshot", category: "graph", inputs: [{ start: 0, name: "x", type: "tensor" }] }, { tfOpName: "Rank", category: "graph", inputs: [{ start: 0, name: "x", type: "tensor" }] }, { tfOpName: "Size", category: "graph", inputs: [{ start: 0, name: "x", type: "tensor" }] }, { tfOpName: "Shape", category: "graph", inputs: [{ start: 0, name: "x", type: "tensor" }] }, { tfOpName: "ShapeN", category: "graph", inputs: [{ start: 0, end: 0, name: "x", type: "tensors" }] }, { tfOpName: "Print", category: "graph", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "data", type: "tensors" }], attrs: [{ tfName: "message", name: "message", type: "string" }, { tfName: "first_n", name: "firstN", type: "number", notSupported: true }, { tfName: "summarize", name: "summarize", type: "number", defaultValue: 3 }] }, { tfOpName: "NoOp", category: "graph", inputs: [] }, { tfOpName: "StopGradient", category: "graph", inputs: [{ start: 0, name: "x", type: "tensor" }] }, { tfOpName: "FakeQuantWithMinMaxVars", category: "graph", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "min", name: "min", type: "number" }, { tfName: "max", name: "max", type: "number" }] }], dAe = { __proto__: null, json: pAe };
  var vAe = [{ tfOpName: "HashTable", category: "hash_table", inputs: [], attrs: [{ tfName: "shared_name", name: "sharedName", type: "string" }, { tfName: "use_node_name_sharing", name: "useNodeNameSharing", type: "bool" }, { tfName: "key_dtype", name: "keyDType", type: "dtype" }, { tfName: "value_dtype", name: "valueDType", type: "dtype" }] }, { tfOpName: "HashTableV2", category: "hash_table", inputs: [], attrs: [{ tfName: "shared_name", name: "sharedName", type: "string" }, { tfName: "use_node_name_sharing", name: "useNodeNameSharing", type: "bool" }, { tfName: "key_dtype", name: "keyDType", type: "dtype" }, { tfName: "value_dtype", name: "valueDType", type: "dtype" }] }, { tfOpName: "LookupTableImport", category: "hash_table", inputs: [{ start: 0, name: "tableHandle", type: "tensor" }, { start: 1, name: "keys", type: "tensor" }, { start: 2, name: "values", type: "tensor" }], attrs: [{ tfName: "Tin", name: "tIn", type: "dtype", notSupported: true }, { tfName: "Tout", name: "tOut", type: "dtype", notSupported: true }] }, { tfOpName: "LookupTableImportV2", category: "hash_table", inputs: [{ start: 0, name: "tableHandle", type: "tensor" }, { start: 1, name: "keys", type: "tensor" }, { start: 2, name: "values", type: "tensor" }], attrs: [{ tfName: "Tin", name: "tIn", type: "dtype", notSupported: true }, { tfName: "Tout", name: "tOut", type: "dtype", notSupported: true }] }, { tfOpName: "LookupTableFind", category: "hash_table", inputs: [{ start: 0, name: "tableHandle", type: "tensor" }, { start: 1, name: "keys", type: "tensor" }, { start: 2, name: "defaultValue", type: "tensor" }], attrs: [{ tfName: "Tin", name: "tIn", type: "dtype", notSupported: true }, { tfName: "Tout", name: "tOut", type: "dtype", notSupported: true }] }, { tfOpName: "LookupTableFindV2", category: "hash_table", inputs: [{ start: 0, name: "tableHandle", type: "tensor" }, { start: 1, name: "keys", type: "tensor" }, { start: 2, name: "defaultValue", type: "tensor" }], attrs: [{ tfName: "Tin", name: "tIn", type: "dtype", notSupported: true }, { tfName: "Tout", name: "tOut", type: "dtype", notSupported: true }] }, { tfOpName: "LookupTableSize", category: "hash_table", inputs: [{ start: 0, name: "tableHandle", type: "tensor" }] }, { tfOpName: "LookupTableSizeV2", category: "hash_table", inputs: [{ start: 0, name: "tableHandle", type: "tensor" }] }], mAe = { __proto__: null, json: vAe };
  var gAe = [{ tfOpName: "ResizeBilinear", category: "image", inputs: [{ start: 0, name: "images", type: "tensor" }, { start: 1, name: "size", type: "number[]" }], attrs: [{ tfName: "align_corners", name: "alignCorners", type: "bool" }, { tfName: "half_pixel_centers", name: "halfPixelCenters", type: "bool" }, { tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "ResizeNearestNeighbor", category: "image", inputs: [{ start: 0, name: "images", type: "tensor" }, { start: 1, name: "size", type: "number[]" }], attrs: [{ tfName: "align_corners", name: "alignCorners", type: "bool" }, { tfName: "half_pixel_centers", name: "halfPixelCenters", type: "bool" }, { tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "CropAndResize", category: "image", inputs: [{ start: 0, name: "image", type: "tensor" }, { start: 1, name: "boxes", type: "tensor" }, { start: 2, name: "boxInd", type: "tensor" }, { start: 3, name: "cropSize", type: "number[]" }], attrs: [{ tfName: "method", name: "method", type: "string" }, { tfName: "extrapolation_value", name: "extrapolationValue", type: "number" }] }], yAe = { __proto__: null, json: gAe };
  var xAe = [{ tfOpName: "Equal", category: "logical", inputs: [{ start: 0, name: "a", type: "tensor" }, { start: 1, name: "b", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "NotEqual", category: "logical", inputs: [{ start: 0, name: "a", type: "tensor" }, { start: 1, name: "b", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Greater", category: "logical", inputs: [{ start: 0, name: "a", type: "tensor" }, { start: 1, name: "b", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "GreaterEqual", category: "logical", inputs: [{ start: 0, name: "a", type: "tensor" }, { start: 1, name: "b", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Less", category: "logical", inputs: [{ start: 0, name: "a", type: "tensor" }, { start: 1, name: "b", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "LessEqual", category: "logical", inputs: [{ start: 0, name: "a", type: "tensor" }, { start: 1, name: "b", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "LogicalAnd", category: "logical", inputs: [{ start: 0, name: "a", type: "tensor" }, { start: 1, name: "b", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "LogicalNot", category: "logical", inputs: [{ start: 0, name: "a", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "LogicalOr", category: "logical", inputs: [{ start: 0, name: "a", type: "tensor" }, { start: 1, name: "b", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Select", category: "logical", inputs: [{ start: 0, name: "condition", type: "tensor" }, { start: 1, name: "a", type: "tensor" }, { start: 2, name: "b", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "SelectV2", category: "logical", inputs: [{ start: 0, name: "condition", type: "tensor" }, { start: 1, name: "a", type: "tensor" }, { start: 2, name: "b", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }], bAe = { __proto__: null, json: xAe };
  var _Ae = [{ tfOpName: "_FusedMatMul", category: "matrices", inputs: [{ start: 0, name: "a", type: "tensor" }, { start: 1, name: "b", type: "tensor" }, { start: 2, end: 0, name: "args", type: "tensors" }], attrs: [{ tfName: "num_args", name: "numArgs", type: "number" }, { tfName: "fused_ops", name: "fusedOps", type: "string[]", defaultValue: [] }, { tfName: "epsilon", name: "epsilon", type: "number", defaultValue: 1e-4 }, { tfName: "transpose_a", name: "transposeA", type: "bool", defaultValue: false }, { tfName: "transpose_b", name: "transposeB", type: "bool", defaultValue: false }, { tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "MatMul", category: "matrices", inputs: [{ start: 0, name: "a", type: "tensor" }, { start: 1, name: "b", type: "tensor" }], attrs: [{ tfName: "transpose_a", name: "transposeA", type: "bool", defaultValue: false }, { tfName: "transpose_b", name: "transposeB", type: "bool", defaultValue: false }, { tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "BatchMatMul", category: "matrices", inputs: [{ start: 0, name: "a", type: "tensor" }, { start: 1, name: "b", type: "tensor" }], attrs: [{ tfName: "adj_x", name: "transposeA", type: "bool", defaultValue: false }, { tfName: "adj_y", name: "transposeB", type: "bool", defaultValue: false }, { tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "BatchMatMulV2", category: "matrices", inputs: [{ start: 0, name: "a", type: "tensor" }, { start: 1, name: "b", type: "tensor" }], attrs: [{ tfName: "adj_x", name: "transposeA", type: "bool", defaultValue: false }, { tfName: "adj_y", name: "transposeB", type: "bool", defaultValue: false }, { tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Transpose", category: "matrices", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "perm", type: "number[]" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "Einsum", category: "matrices", inputs: [{ start: 0, end: 0, name: "tensors", type: "tensors" }], attrs: [{ tfName: "equation", name: "equation", type: "string" }, { tfName: "N", name: "n", type: "number", defaultValue: 2 }, { tfName: "T", name: "dtype", type: "dtype" }] }], wAe = { __proto__: null, json: _Ae };
  var kAe = [{ tfOpName: "FusedBatchNorm", category: "normalization", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "scale", type: "tensor" }, { start: 2, name: "offset", type: "tensor" }, { start: 3, name: "mean", type: "tensor" }, { start: 4, name: "variance", type: "tensor" }], attrs: [{ tfName: "epsilon", name: "epsilon", type: "number", defaultValue: 1e-3 }, { tfName: "data_format", name: "dataFormat", type: "string", notSupported: true }] }, { tfOpName: "FusedBatchNormV2", category: "normalization", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "scale", type: "tensor" }, { start: 2, name: "offset", type: "tensor" }, { start: 3, name: "mean", type: "tensor" }, { start: 4, name: "variance", type: "tensor" }], attrs: [{ tfName: "epsilon", name: "epsilon", type: "number", defaultValue: 1e-3 }, { tfName: "data_format", name: "dataFormat", type: "string", notSupported: true }] }, { tfOpName: "FusedBatchNormV3", category: "normalization", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "scale", type: "tensor" }, { start: 2, name: "offset", type: "tensor" }, { start: 3, name: "mean", type: "tensor" }, { start: 4, name: "variance", type: "tensor" }], attrs: [{ tfName: "epsilon", name: "epsilon", type: "number", defaultValue: 1e-3 }, { tfName: "data_format", name: "dataFormat", type: "string", notSupported: true }] }, { tfOpName: "LRN", category: "normalization", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "depth_radius", name: "radius", type: "number", defaultValue: 5 }, { tfName: "bias", name: "bias", type: "number", defaultValue: 1 }, { tfName: "alpha", name: "alpha", type: "number", defaultValue: 1 }, { tfName: "beta", name: "beta", type: "number", defaultValue: 0.5 }] }, { tfOpName: "Softmax", category: "normalization", inputs: [{ start: 0, name: "x", type: "tensor" }] }, { tfOpName: "LogSoftmax", category: "normalization", inputs: [{ start: 0, name: "x", type: "tensor" }] }, { tfOpName: "SparseToDense", category: "normalization", inputs: [{ start: 0, name: "sparseIndices", type: "tensor" }, { start: 1, name: "outputShape", type: "number[]" }, { start: 2, name: "sparseValues", type: "tensor" }, { start: 3, name: "defaultValue", type: "tensor" }], attrs: [{ tfName: "validate_indices", name: "validateIndices", type: "bool", defaultValue: true, notSupported: true }] }], TAe = { __proto__: null, json: kAe };
  var AAe = [{ tfOpName: "Bincount", category: "reduction", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "size", type: "number" }, { start: 2, name: "weights", type: "tensor" }] }, { tfOpName: "DenseBincount", category: "reduction", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "size", type: "number" }, { start: 2, name: "weights", type: "tensor" }], attrs: [{ tfName: "binary_output", name: "binaryOutput", type: "bool" }] }, { tfOpName: "Max", category: "reduction", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "axis", type: "number[]" }], attrs: [{ tfName: "keep_dims", name: "keepDims", type: "bool" }] }, { tfOpName: "Mean", category: "reduction", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "axis", type: "number[]" }], attrs: [{ tfName: "keep_dims", name: "keepDims", type: "bool" }] }, { tfOpName: "Min", category: "reduction", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "axis", type: "number[]" }], attrs: [{ tfName: "keep_dims", name: "keepDims", type: "bool" }] }, { tfOpName: "Sum", category: "reduction", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "axis", type: "number[]" }], attrs: [{ tfName: "keep_dims", name: "keepDims", type: "bool" }] }, { tfOpName: "All", category: "reduction", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "axis", type: "number[]" }], attrs: [{ tfName: "keep_dims", name: "keepDims", type: "bool" }] }, { tfOpName: "Any", category: "reduction", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "axis", type: "number[]" }], attrs: [{ tfName: "keep_dims", name: "keepDims", type: "bool" }] }, { tfOpName: "ArgMax", category: "reduction", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "axis", type: "number" }] }, { tfOpName: "ArgMin", category: "reduction", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "axis", type: "number" }] }, { tfOpName: "Prod", category: "reduction", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "axis", type: "number[]" }], attrs: [{ tfName: "keep_dims", name: "keepDims", type: "bool" }] }, { tfOpName: "Cumsum", category: "reduction", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "axis", type: "number" }], attrs: [{ tfName: "exclusive", name: "exclusive", type: "bool" }, { tfName: "reverse", name: "reverse", type: "bool" }] }], SAe = { __proto__: null, json: AAe };
  var EAe = [{ tfOpName: "ConcatV2", category: "slice_join", inputs: [{ start: 0, end: -1, name: "tensors", type: "tensors" }, { start: -1, name: "axis", type: "number" }], attrs: [{ tfName: "N", name: "n", type: "number", defaultValue: 2 }] }, { tfOpName: "Concat", category: "slice_join", inputs: [{ start: 1, end: 0, name: "tensors", type: "tensors" }, { start: 0, name: "axis", type: "number" }], attrs: [{ tfName: "N", name: "n", type: "number", defaultValue: 2 }] }, { tfOpName: "GatherV2", category: "slice_join", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "indices", type: "tensor" }, { start: 2, name: "axis", type: "number", defaultValue: 0 }], attrs: [{ tfName: "batch_dims", name: "batchDims", type: "number", defaultValue: 0 }] }, { tfOpName: "Gather", category: "slice_join", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "indices", type: "tensor" }], attrs: [{ tfName: "validate_indices", name: "validateIndices", type: "bool", notSupported: true }] }, { tfOpName: "Reverse", category: "slice_join", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "dims", type: "bool[]" }] }, { tfOpName: "ReverseV2", category: "slice_join", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "axis", type: "number[]" }] }, { tfOpName: "Slice", category: "slice_join", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "begin", type: "number[]" }, { start: 2, name: "size", type: "number[]" }] }, { tfOpName: "StridedSlice", category: "slice_join", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "begin", type: "number[]" }, { start: 2, name: "end", type: "number[]" }, { start: 3, name: "strides", type: "number[]" }], attrs: [{ tfName: "begin_mask", name: "beginMask", type: "number", defaultValue: 0 }, { tfName: "end_mask", name: "endMask", type: "number", defaultValue: 0 }, { tfName: "new_axis_mask", name: "newAxisMask", type: "number", defaultValue: 0 }, { tfName: "ellipsis_mask", name: "ellipsisMask", type: "number", defaultValue: 0 }, { tfName: "shrink_axis_mask", name: "shrinkAxisMask", type: "number", defaultValue: 0 }] }, { tfOpName: "Pack", category: "slice_join", inputs: [{ start: 0, end: 0, name: "tensors", type: "tensors" }], attrs: [{ tfName: "axis", name: "axis", type: "number", defaultValue: 0 }] }, { tfOpName: "Unpack", category: "slice_join", inputs: [{ start: 0, name: "tensor", type: "tensor" }], attrs: [{ tfName: "axis", name: "axis", type: "number", defaultValue: 0 }, { tfName: "num", name: "num", type: "number", defaultValue: 0, notSupported: true }] }, { tfOpName: "Tile", category: "slice_join", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "reps", type: "number[]" }] }, { tfOpName: "Split", category: "slice_join", inputs: [{ start: 0, name: "axis", type: "number", defaultValue: 0 }, { start: 1, name: "x", type: "tensor" }], attrs: [{ tfName: "num_split", name: "numOrSizeSplits", type: "number", defaultValue: 1 }] }, { tfOpName: "SplitV", category: "slice_join", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "numOrSizeSplits", type: "number[]" }, { start: 2, name: "axis", type: "number", defaultValue: 0 }] }, { tfOpName: "ScatterNd", category: "slice_join", inputs: [{ start: 0, name: "indices", type: "tensor" }, { start: 1, name: "values", type: "tensor" }, { start: 2, name: "shape", type: "number[]" }] }, { tfOpName: "GatherNd", category: "slice_join", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "indices", type: "tensor" }] }, { tfOpName: "SparseToDense", category: "slice_join", inputs: [{ start: 0, name: "sparseIndices", type: "tensor" }, { start: 1, name: "outputShape", type: "number[]" }, { start: 2, name: "sparseValues", type: "tensor" }, { start: 3, name: "defaultValue", type: "tensor" }], attrs: [{ tfName: "validate_indices", name: "validateIndices", type: "bool", defaultValue: false, notSupported: true }] }], DAe = { __proto__: null, json: EAe };
  var CAe = [{ tfOpName: "SparseFillEmptyRows", category: "sparse", inputs: [{ start: 0, name: "indices", type: "tensor" }, { start: 1, name: "values", type: "tensor" }, { start: 2, name: "denseShape", type: "tensor" }, { start: 3, name: "defaultValue", type: "tensor" }] }, { tfOpName: "SparseReshape", category: "sparse", inputs: [{ start: 0, name: "inputIndices", type: "tensor" }, { start: 1, name: "inputShape", type: "tensor" }, { start: 2, name: "newShape", type: "tensor" }], attrs: [{ tfName: "T", name: "dtype", type: "dtype", notSupported: true }] }, { tfOpName: "SparseSegmentMean", category: "sparse", inputs: [{ start: 0, name: "data", type: "tensor" }, { start: 1, name: "indices", type: "tensor" }, { start: 2, name: "segmentIds", type: "tensor" }] }, { tfOpName: "SparseSegmentSum", category: "sparse", inputs: [{ start: 0, name: "data", type: "tensor" }, { start: 1, name: "indices", type: "tensor" }, { start: 2, name: "segmentIds", type: "tensor" }] }], MAe = { __proto__: null, json: CAe };
  var IAe = [{ tfOpName: "FFT", category: "spectral", inputs: [{ start: 0, name: "x", type: "tensor" }] }, { tfOpName: "IFFT", category: "spectral", inputs: [{ start: 0, name: "x", type: "tensor" }] }, { tfOpName: "RFFT", category: "spectral", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "fft_length", type: "number", notSupported: true }] }, { tfOpName: "IRFFT", category: "spectral", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "fft_length", type: "number", notSupported: true }] }], NAe = { __proto__: null, json: IAe };
  var FAe = [{ tfOpName: "StringNGrams", category: "string", inputs: [{ start: 0, name: "data", type: "tensor" }, { start: 1, name: "dataSplits", type: "tensor" }], attrs: [{ tfName: "separator", name: "separator", type: "string" }, { tfName: "ngram_widths", name: "nGramWidths", type: "number[]" }, { tfName: "left_pad", name: "leftPad", type: "string" }, { tfName: "right_pad", name: "rightPad", type: "string" }, { tfName: "pad_width", name: "padWidth", type: "number" }, { tfName: "preserve_short_sequences", name: "preserveShortSequences", type: "bool" }], outputs: ["ngrams", "ngrams_splits"] }, { tfOpName: "StringSplit", category: "string", inputs: [{ start: 0, name: "input", type: "tensor" }, { start: 1, name: "delimiter", type: "tensor" }], attrs: [{ tfName: "skip_empty", name: "skipEmpty", type: "bool" }], outputs: ["indices", "values", "shape"] }, { tfOpName: "StringToHashBucketFast", category: "string", inputs: [{ start: 0, name: "input", type: "tensor" }], attrs: [{ tfName: "num_buckets", name: "numBuckets", type: "number" }] }], OAe = { __proto__: null, json: FAe };
  var PAe = [{ tfOpName: "Cast", category: "transformation", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "SrcT", name: "sdtype", type: "dtype", notSupported: true }, { tfName: "DstT", name: "dtype", type: "dtype" }] }, { tfOpName: "ExpandDims", category: "transformation", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "axis", type: "number" }] }, { tfOpName: "MirrorPad", category: "transformation", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "padding", type: "number[]" }], attrs: [{ tfName: "mode", name: "mode", type: "string" }] }, { tfOpName: "Pad", category: "transformation", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "padding", type: "number[]" }], attrs: [{ tfName: "constant_value", name: "constantValue", type: "number", defaultValue: 0 }] }, { tfOpName: "PadV2", category: "transformation", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "padding", type: "number[]" }, { start: 2, name: "constantValue", type: "number", defaultValue: 0 }] }, { tfOpName: "Reshape", category: "transformation", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "shape", type: "number[]" }] }, { tfOpName: "Squeeze", category: "transformation", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "axis", tfDeprecatedName: "squeeze_dims", name: "axis", type: "number[]" }] }, { tfOpName: "SpaceToBatchND", category: "transformation", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "blockShape", type: "number[]" }, { start: 2, name: "paddings", type: "number[]" }] }, { tfOpName: "BatchToSpaceND", category: "transformation", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "blockShape", type: "number[]" }, { start: 2, name: "crops", type: "number[]" }] }, { tfOpName: "DepthToSpace", category: "transformation", inputs: [{ start: 0, name: "x", type: "tensor" }], attrs: [{ tfName: "block_size", name: "blockSize", type: "number" }, { tfName: "data_format", name: "dataFormat", type: "string" }] }, { tfOpName: "BroadcastTo", category: "transformation", inputs: [{ start: 0, name: "x", type: "tensor" }, { start: 1, name: "shape", type: "number[]" }], attrs: [] }, { tfOpName: "BroadcastArgs", category: "transformation", inputs: [{ start: 0, name: "s0", type: "tensor" }, { start: 1, name: "s1", type: "tensor" }], attrs: [] }], LAe = { __proto__: null, json: PAe }, Ej = function() {
    function e() {
      var t = [eAe, rAe, aAe, oAe, lAe, cAe, hAe, dAe, mAe, yAe, bAe, wAe, TAe, SAe, DAe, MAe, NAe, OAe, LAe], r = [].concat.apply([], Sc(t.map(function(n) {
        return n.json;
      })));
      this.opMappers = r.reduce(function(n, a) {
        return n[a.tfOpName] = a, n;
      }, {});
    }
    return Object.defineProperty(e, "Instance", { get: function() {
      return this._instance || (this._instance = new this());
    }, enumerable: true, configurable: true }), e.prototype.transformGraph = function(t, r) {
      var n = this;
      r === void 0 && (r = {});
      var a = t.node, o = [], s = [], i = [], l = a.reduce(function(m, g) {
        return m[g.name] = n.mapNode(g), g.op.startsWith("Placeholder") ? o.push(m[g.name]) : g.op === "Const" ? s.push(m[g.name]) : (g.input == null || g.input.length === 0) && i.push(m[g.name]), m;
      }, {}), u2 = [], c = [], f = {}, h = {};
      r != null && (f = this.mapSignatureEntries(r.inputs), h = this.mapSignatureEntries(r.outputs));
      var p = Object.keys(l);
      p.forEach(function(m) {
        var g = l[m];
        g.inputNames.forEach(function(x, b) {
          var y = ni(Hd(x), 3), w = y[0], _4 = y[2], k = l[w];
          if (k.outputs != null) {
            var T3 = k.outputs.indexOf(_4);
            if (T3 !== -1) {
              var A3 = w + ":" + T3;
              g.inputNames[b] = A3;
            }
          }
          g.inputs.push(k), k.children.push(g);
        });
      }), Object.keys(h).length === 0 ? p.forEach(function(m) {
        var g = l[m];
        g.children.length === 0 && c.push(g);
      }) : Object.keys(h).forEach(function(m) {
        var g = ni(Hd(m), 1), x = g[0], b = l[x];
        b != null && (b.signatureKey = h[m], c.push(b));
      }), Object.keys(f).length > 0 ? Object.keys(f).forEach(function(m) {
        var g = ni(Hd(m), 1), x = g[0], b = l[x];
        b && (b.signatureKey = f[m], u2.push(b));
      }) : u2 = o;
      var d = {};
      t.library != null && t.library.function != null && (d = t.library.function.reduce(function(m, g) {
        return m[g.signature.name] = n.mapFunction(g), m;
      }, {}));
      var v = { nodes: l, inputs: u2, outputs: c, weights: s, placeholders: o, signature: r, functions: d };
      return i.length > 0 && (v.initNodes = i), v;
    }, e.prototype.mapSignatureEntries = function(t) {
      return Object.keys(t || {}).reduce(function(r, n) {
        return r[t[n].name] = n, r;
      }, {});
    }, e.prototype.mapNode = function(t) {
      var r = nW(t.op) || this.opMappers[t.op] || {};
      t.attr == null && (t.attr = {});
      var n = { name: t.name, op: t.op, category: r.category, inputNames: (t.input || []).map(function(a) {
        return a.startsWith("^") ? a.substr(1) : a;
      }), inputs: [], children: [], inputParams: {}, attrParams: {}, rawAttrs: t.attr, outputs: r.outputs };
      return r.inputs != null && (n.inputParams = r.inputs.reduce(function(a, o) {
        return a[o.name] = { type: o.type, inputIndexStart: o.start, inputIndexEnd: o.end }, a;
      }, {})), r.attrs != null && (n.attrParams = r.attrs.reduce(function(a, o) {
        var s = o.type, i = void 0;
        switch (o.type) {
          case "string":
            i = OC(t.attr, o.tfName, o.defaultValue), i === void 0 && !!o.tfDeprecatedName && (i = OC(t.attr, o.tfDeprecatedName, o.defaultValue));
            break;
          case "string[]":
            i = VC(t.attr, o.tfName, o.defaultValue), i === void 0 && !!o.tfDeprecatedName && (i = VC(t.attr, o.tfDeprecatedName, o.defaultValue));
            break;
          case "number":
            i = LC(t.attr, o.tfName, o.defaultValue || 0), i === void 0 && !!o.tfDeprecatedName && (i = LC(t.attr, o.tfDeprecatedName, o.defaultValue));
            break;
          case "number[]":
            i = UC(t.attr, o.tfName, o.defaultValue), i === void 0 && !!o.tfDeprecatedName && (i = UC(t.attr, o.tfDeprecatedName, o.defaultValue));
            break;
          case "bool":
            i = PC(t.attr, o.tfName, o.defaultValue), i === void 0 && !!o.tfDeprecatedName && (i = PC(t.attr, o.tfDeprecatedName, o.defaultValue));
            break;
          case "bool[]":
            i = WC(t.attr, o.tfName, o.defaultValue), i === void 0 && !!o.tfDeprecatedName && (i = WC(t.attr, o.tfDeprecatedName, o.defaultValue));
            break;
          case "shape":
            i = BC(t.attr, o.tfName, o.defaultValue), i === void 0 && !!o.tfDeprecatedName && (i = BC(t.attr, o.tfDeprecatedName, o.defaultValue));
            break;
          case "shape[]":
            i = jC(t.attr, o.tfName, o.defaultValue), i === void 0 && !!o.tfDeprecatedName && (i = jC(t.attr, o.tfDeprecatedName, o.defaultValue));
            break;
          case "dtype":
            i = RC(t.attr, o.tfName, o.defaultValue), i === void 0 && !!o.tfDeprecatedName && (i = RC(t.attr, o.tfDeprecatedName, o.defaultValue));
            break;
          case "dtype[]":
            i = zC(t.attr, o.tfName, o.defaultValue), i === void 0 && !!o.tfDeprecatedName && (i = zC(t.attr, o.tfDeprecatedName, o.defaultValue));
            break;
          case "func":
            i = Dj(t.attr, o.tfName, o.defaultValue), i === void 0 && !!o.tfDeprecatedName && (i = Dj(t.attr, o.tfDeprecatedName, o.defaultValue));
            break;
          case "tensor":
          case "tensors":
            break;
          default:
            throw new Error("Unsupported param type: " + o.type + " for op: " + t.op);
        }
        return a[o.name] = { value: i, type: s }, a;
      }, {})), n;
    }, e.prototype.mapFunction = function(t) {
      var r = this, n = t.nodeDef, a = [], o = [], s = {};
      n != null && (s = n.reduce(function(h, p) {
        return h[p.name] = r.mapNode(p), p.op === "Const" && o.push(h[p.name]), h;
      }, {}));
      var i = [], l = [];
      t.signature.inputArg.forEach(function(h) {
        var p = ni(Hd(h.name), 1), d = p[0], v = { name: d, op: "Placeholder", inputs: [], inputNames: [], category: "graph", inputParams: {}, attrParams: { dtype: { value: rM(h.type), type: "dtype" } }, children: [] };
        v.signatureKey = h.name, i.push(v), s[d] = v;
      });
      var u2 = Object.keys(s);
      u2.forEach(function(h) {
        var p = s[h];
        p.inputNames.forEach(function(d, v) {
          var m = ni(Hd(d), 3), g = m[0], x = m[2], b = s[g];
          if (b.outputs != null) {
            var y = b.outputs.indexOf(x);
            if (y !== -1) {
              var w = g + ":" + y;
              p.inputNames[v] = w;
            }
          }
          p.inputs.push(b), b.children.push(p);
        });
      });
      var c = t.ret;
      t.signature.outputArg.forEach(function(h) {
        var p = ni(Hd(c[h.name]), 2), d = p[0], v = p[1], m = s[d];
        m != null && (m.defaultOutput = v, l.push(m));
      });
      var f = this.mapArgsToSignature(t);
      return { nodes: s, inputs: i, outputs: l, weights: o, placeholders: a, signature: f };
    }, e.prototype.mapArgsToSignature = function(t) {
      var r = this;
      return { methodName: t.signature.name, inputs: t.signature.inputArg.reduce(function(n, a) {
        return n[a.name] = r.mapArgToTensorInfo(a), n;
      }, {}), outputs: t.signature.outputArg.reduce(function(n, a) {
        return n[a.name] = r.mapArgToTensorInfo(a, t.ret), n;
      }, {}) };
    }, e.prototype.mapArgToTensorInfo = function(t, r) {
      var n = t.name;
      return r != null && (n = r[n]), { name: n, dtype: t.type };
    }, e;
  }();
  function RAe(e) {
    var t = ui.env().global;
    if (typeof t.atob < "u") return t.atob(e);
    if (typeof Buffer < "u") return new Buffer(e, "base64").toString();
    throw new Error("Unable to decode base64 in this environment. Missing built-in atob() or Buffer()");
  }
  function aW(e, t) {
    var r = Array.isArray(e) ? String.fromCharCode.apply(null, e) : RAe(e);
    return t ? r : r.toLowerCase();
  }
  function OC(e, t, r, n) {
    n === void 0 && (n = false);
    var a = e[t];
    return a != null ? aW(a.s, n) : r;
  }
  function PC(e, t, r) {
    var n = e[t];
    return n ? n.b : r;
  }
  function LC(e, t, r) {
    var n = e[t] || {}, a = n.i != null ? n.i : n.f != null ? n.f : r;
    return typeof a == "number" ? a : parseInt(a, 10);
  }
  function rM(e) {
    switch (typeof e == "string" && (e = pp[e]), e) {
      case pp.DT_FLOAT:
      case pp.DT_HALF:
        return "float32";
      case pp.DT_INT32:
      case pp.DT_INT64:
      case pp.DT_INT8:
      case pp.DT_UINT8:
        return "int32";
      case pp.DT_BOOL:
        return "bool";
      case pp.DT_DOUBLE:
        return "float32";
      case pp.DT_STRING:
        return "string";
      default:
        return null;
    }
  }
  function Dj(e, t, r) {
    var n = e[t];
    return n && n.func ? n.func.name : r;
  }
  function RC(e, t, r) {
    var n = e[t];
    return n && n.type ? rM(n.type) : r;
  }
  function zC(e, t, r) {
    var n = e[t];
    return n && n.list && n.list.type ? n.list.type.map(function(a) {
      return rM(a);
    }) : r;
  }
  function iW(e) {
    if (!e.unknownRank) return e.dim != null ? e.dim.map(function(t) {
      return typeof t.size == "number" ? t.size : parseInt(t.size, 10);
    }) : [];
  }
  function BC(e, t, r) {
    var n = e[t];
    return n && n.shape ? iW(n.shape) : r;
  }
  function UC(e, t, r) {
    var n = e[t];
    return n ? ((n.list.f && n.list.f.length ? n.list.f : n.list.i) || []).map(function(a) {
      return typeof a == "number" ? a : parseInt(a, 10);
    }) : r;
  }
  function VC(e, t, r, n) {
    n === void 0 && (n = false);
    var a = e[t];
    return a && a.list && a.list.s ? a.list.s.map(function(o) {
      return aW(o, n);
    }) : r;
  }
  function jC(e, t, r) {
    var n = e[t];
    return n && n.list && n.list.shape ? n.list.shape.map(function(a) {
      return iW(a);
    }) : r;
  }
  function WC(e, t, r) {
    var n = e[t];
    return n && n.list && n.list.b ? n.list.b : r;
  }
  var zAe = function() {
    function e(t, r, n) {
      var a = this;
      this.node = t, this.tensorMap = r, this.context = n, this.inputs = [], this.attrs = {}, this.inputs = t.inputNames.map(function(o) {
        return a.getInput(o);
      }), t.rawAttrs != null && (this.attrs = Object.keys(t.rawAttrs).reduce(function(o, s) {
        return o[s] = a.getAttr(s), o;
      }, {}));
    }
    return e.prototype.getInput = function(t) {
      return sf(t, this.tensorMap, this.context);
    }, e.prototype.getAttr = function(t, r) {
      var n = this.node.rawAttrs[t];
      if (n.tensor != null) return sf(t, this.tensorMap, this.context);
      if (n.i != null || n.f != null) return LC(this.node.rawAttrs, t, r);
      if (n.s != null) return OC(this.node.rawAttrs, t, r);
      if (n.b != null) return PC(this.node.rawAttrs, t, r);
      if (n.shape != null) return BC(this.node.rawAttrs, t, r);
      if (n.type != null) return RC(this.node.rawAttrs, t, r);
      if (n.list != null) {
        if (n.list.i != null || n.list.f != null) return UC(this.node.rawAttrs, t, r);
        if (n.list.s != null) return VC(this.node.rawAttrs, t, r);
        if (n.list.shape != null) return jC(this.node.rawAttrs, t, r);
        if (n.list.b != null) return WC(this.node.rawAttrs, t, r);
        if (n.list.type != null) return zC(this.node.rawAttrs, t, r);
      }
      return r;
    }, e;
  }();
  var BAe = 1e-7, UAe = 1e-4, VAe = function() {
    function e() {
    }
    return e.prototype.refCount = function(t) {
      return Fh("refCount");
    }, e.prototype.incRef = function(t) {
      return Fh("incRef");
    }, e.prototype.timerAvailable = function() {
      return true;
    }, e.prototype.time = function(t) {
      return Fh("time");
    }, e.prototype.read = function(t) {
      return Fh("read");
    }, e.prototype.readSync = function(t) {
      return Fh("readSync");
    }, e.prototype.readToGPU = function(t, r) {
      return Fh("readToGPU");
    }, e.prototype.numDataIds = function() {
      return Fh("numDataIds");
    }, e.prototype.disposeData = function(t, r) {
      return Fh("disposeData");
    }, e.prototype.write = function(t, r, n) {
      return Fh("write");
    }, e.prototype.move = function(t, r, n, a, o) {
      return Fh("move");
    }, e.prototype.memory = function() {
      return Fh("memory");
    }, e.prototype.floatPrecision = function() {
      return Fh("floatPrecision");
    }, e.prototype.epsilon = function() {
      return this.floatPrecision() === 32 ? BAe : UAe;
    }, e.prototype.dispose = function() {
      return Fh("dispose");
    }, e;
  }();
  function Fh(e) {
    throw new Error("'" + e + "' not yet implemented or not found in the registry. This kernel may not be supported by the tfjs backend you have chosen");
  }
  function Yr(e, t) {
    if (!e) throw new Error(typeof t == "string" ? t : t());
  }
  function xp(e, t, r) {
    r === void 0 && (r = ""), Yr(Ny(e, t), function() {
      return r + (" Shapes " + e + " and " + t + " must match");
    });
  }
  function Iy(e) {
    Yr(e != null, function() {
      return "The input to the tensor constructor must be a non-null value.";
    });
  }
  function Zk(e, t, r) {
    if (t === void 0 && (t = []), r === void 0 && (r = false), t == null && (t = []), Array.isArray(e) || qd(e) && !r) for (var n = 0; n < e.length; ++n) Zk(e[n], t, r);
    else t.push(e);
    return t;
  }
  function lh(e) {
    if (e.length === 0) return 1;
    for (var t = e[0], r = 1; r < e.length; r++) t *= e[r];
    return t;
  }
  function Ny(e, t) {
    if (e === t) return true;
    if (e == null || t == null || e.length !== t.length) return false;
    for (var r = 0; r < e.length; r++) if (e[r] !== t[r]) return false;
    return true;
  }
  function D2(e) {
    return e % 1 === 0;
  }
  function Pk(e, t) {
    return t <= e.length ? e : e + " ".repeat(t - e.length);
  }
  function Jk(e, t) {
    var r = t.length;
    return e = e == null ? t.map(function(n, a) {
      return a;
    }) : [].concat(e), Yr(e.every(function(n) {
      return n >= -r && n < r;
    }), function() {
      return "All values in axis param must be in range [-" + r + ", " + r + ") but " + ("got axis " + e);
    }), Yr(e.every(function(n) {
      return D2(n);
    }), function() {
      return "All values in axis param must be integers but " + ("got axis " + e);
    }), e.map(function(n) {
      return n < 0 ? r + n : n;
    });
  }
  function jAe(e, t) {
    for (var r = [], n = [], a = t != null && Array.isArray(t) && t.length === 0, o = t == null || a ? null : Jk(t, e).sort(), s = 0, i = 0; i < e.length; ++i) {
      if (o != null) {
        if (o[s] === i && e[i] !== 1) throw new Error("Can't squeeze axis " + i + " since its dim '" + e[i] + "' is not 1");
        (o[s] == null || o[s] > i) && e[i] === 1 && (r.push(e[i]), n.push(i)), o[s] <= i && s++;
      }
      e[i] !== 1 && (r.push(e[i]), n.push(i));
    }
    return { newShape: r, keptDims: n };
  }
  function WAe(e, t) {
    var r = null;
    if (e == null || e === "float32") r = new Float32Array(t);
    else if (e === "int32") r = new Int32Array(t);
    else if (e === "bool") r = new Uint8Array(t);
    else throw new Error("Unknown data type " + e);
    return r;
  }
  function GAe(e, t) {
    var r = null;
    if (e == null || e === "float32") r = new Float32Array(t);
    else if (e === "int32") r = new Int32Array(t);
    else if (e === "bool") r = new Uint8Array(t);
    else if (e === "string") r = new Array(t);
    else throw new Error("Unknown data type " + e);
    return r;
  }
  function $Ae(e, t) {
    for (var r = 0; r < e.length; r++) {
      var n = e[r];
      if (isNaN(n) || !isFinite(n)) throw Error("A tensor of type " + t + " being uploaded contains " + n + ".");
    }
  }
  function HAe(e) {
    return e === "bool" || e === "complex64" || e === "float32" || e === "int32" || e === "string";
  }
  function qd(e) {
    return e instanceof Float32Array || e instanceof Int32Array || e instanceof Uint8Array || e instanceof Uint8ClampedArray;
  }
  function Cj(e) {
    if (e === "float32" || e === "int32") return 4;
    if (e === "complex64") return 8;
    if (e === "bool") return 1;
    throw new Error("Unknown dtype " + e);
  }
  function qAe(e) {
    if (e == null) return 0;
    var t = 0;
    return e.forEach(function(r) {
      return t += r.length;
    }), t;
  }
  function nM(e) {
    return typeof e == "string" || e instanceof String;
  }
  function XAe(e) {
    return typeof e == "boolean";
  }
  function KAe(e) {
    return typeof e == "number";
  }
  function aM(e) {
    return Array.isArray(e) ? aM(e[0]) : e instanceof Float32Array ? "float32" : e instanceof Int32Array || e instanceof Uint8Array || e instanceof Uint8ClampedArray ? "int32" : KAe(e) ? "float32" : nM(e) ? "string" : XAe(e) ? "bool" : "float32";
  }
  function Mj(e) {
    return !!(e && e.constructor && e.call && e.apply);
  }
  function iM(e) {
    var t = e.length;
    if (t < 2) return [];
    var r = new Array(t - 1);
    r[t - 2] = e[t - 1];
    for (var n = t - 3; n >= 0; --n) r[n] = r[n + 1] * e[n + 1];
    return r;
  }
  function oW(e, t, r, n) {
    n === void 0 && (n = false);
    var a = new Array();
    if (t.length === 1) for (var o = t[0] * (n ? 2 : 1), s = 0; s < o; s++) a[s] = r[e + s];
    else for (var o = t[0], i = t.slice(1), l = i.reduce(function(c, f) {
      return c * f;
    }) * (n ? 2 : 1), s = 0; s < o; s++) a[s] = oW(e + s * l, i, r, n);
    return a;
  }
  function Ij(e, t, r) {
    if (r === void 0 && (r = false), e.length === 0) return t[0];
    var n = e.reduce(function(a, o) {
      return a * o;
    }) * (r ? 2 : 1);
    if (n === 0) return [];
    if (n !== t.length) throw new Error("[" + e + "] does not match the input size " + t.length + (r ? " for a complex tensor" : "") + ".");
    return oW(0, e, t, r);
  }
  function sW(e, t) {
    for (var r = oM(e, t), n = 0; n < r.length; n++) r[n] = 1;
    return r;
  }
  function oM(e, t) {
    if (t == null || t === "float32" || t === "complex64") return new Float32Array(e);
    if (t === "int32") return new Int32Array(e);
    if (t === "bool") return new Uint8Array(e);
    throw new Error("Unknown data type " + t);
  }
  function lW(e) {
    e.forEach(function(t) {
      Yr(Number.isInteger(t) && t >= 0, function() {
        return "Tensor must have a shape comprised of positive integers but got " + ("shape [" + e + "].");
      });
    });
  }
  function uW(e) {
    return e && e.then && typeof e.then == "function";
  }
  var Nj = "tfjsflags", YAe = function() {
    function e(t) {
      this.global = t, this.flags = {}, this.flagRegistry = {}, this.urlFlags = {}, this.getQueryParams = ZAe, this.populateURLFlags();
    }
    return e.prototype.setPlatform = function(t, r) {
      this.platform != null && (vp().getBool("IS_TEST") || vp().getBool("PROD") || console.warn("Platform " + this.platformName + " has already been set. " + ("Overwriting the platform with " + r + "."))), this.platformName = t, this.platform = r;
    }, e.prototype.registerFlag = function(t, r, n) {
      if (this.flagRegistry[t] = { evaluationFn: r, setHook: n }, this.urlFlags[t] != null) {
        var a = this.urlFlags[t];
        vp().getBool("IS_TEST") || vp().getBool("PROD") || console.warn("Setting feature override from URL " + t + ": " + a + "."), this.set(t, a);
      }
    }, e.prototype.getAsync = function(t) {
      return Ps(this, void 0, void 0, function() {
        var r, n;
        return ws(this, function(a) {
          switch (a.label) {
            case 0:
              return t in this.flags ? [2, this.flags[t]] : (r = this.flags, n = t, [4, this.evaluateFlag(t)]);
            case 1:
              return r[n] = a.sent(), [2, this.flags[t]];
          }
        });
      });
    }, e.prototype.get = function(t) {
      if (t in this.flags) return this.flags[t];
      var r = this.evaluateFlag(t);
      if (uW(r)) throw new Error("Flag " + t + " cannot be synchronously evaluated. Please use getAsync() instead.");
      return this.flags[t] = r, this.flags[t];
    }, e.prototype.getNumber = function(t) {
      return this.get(t);
    }, e.prototype.getBool = function(t) {
      return this.get(t);
    }, e.prototype.getFlags = function() {
      return this.flags;
    }, Object.defineProperty(e.prototype, "features", { get: function() {
      return this.flags;
    }, enumerable: true, configurable: true }), e.prototype.set = function(t, r) {
      if (this.flagRegistry[t] == null) throw new Error("Cannot set flag " + t + " as it has not been registered.");
      this.flags[t] = r, this.flagRegistry[t].setHook != null && this.flagRegistry[t].setHook(r);
    }, e.prototype.evaluateFlag = function(t) {
      if (this.flagRegistry[t] == null) throw new Error("Cannot evaluate flag '" + t + "': no evaluation function found.");
      return this.flagRegistry[t].evaluationFn();
    }, e.prototype.setFlags = function(t) {
      this.flags = Object.assign({}, t);
    }, e.prototype.reset = function() {
      this.flags = {}, this.urlFlags = {}, this.populateURLFlags();
    }, e.prototype.populateURLFlags = function() {
      var t = this;
      if (!(typeof this.global > "u" || typeof this.global.location > "u" || typeof this.global.location.search > "u")) {
        var r = this.getQueryParams(this.global.location.search);
        if (Nj in r) {
          var n = r[Nj].split(",");
          n.forEach(function(a) {
            var o = ni(a.split(":"), 2), s = o[0], i = o[1];
            t.urlFlags[s] = QAe(s, i);
          });
        }
      }
    }, e;
  }();
  function ZAe(e) {
    var t = {};
    return e.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g, function(r) {
      for (var n = [], a = 1; a < arguments.length; a++) n[a - 1] = arguments[a];
      return JAe(t, n[0], n[1]), n.join("=");
    }), t;
  }
  function JAe(e, t, r) {
    e[decodeURIComponent(t)] = decodeURIComponent(r || "");
  }
  function QAe(e, t) {
    if (t = t.toLowerCase(), t === "true" || t === "false") return t === "true";
    if ("" + +t === t) return +t;
    throw new Error("Could not parse value flag value " + t + " for flag " + e + ".");
  }
  function vp() {
    return cW;
  }
  var cW = null;
  function eSe(e) {
    cW = e;
  }
  var CC;
  function fW() {
    if (CC == null) {
      var e = void 0;
      if (typeof window < "u") e = window;
      else if (typeof global < "u") e = global;
      else if (typeof process < "u") e = process;
      else if (typeof self < "u") e = self;
      else throw new Error("Could not find a global object");
      CC = e;
    }
    return CC;
  }
  function tSe() {
    var e = fW();
    return e._tfGlobals == null && (e._tfGlobals = /* @__PURE__ */ new Map()), e._tfGlobals;
  }
  function sM(e, t) {
    var r = tSe();
    if (r.has(e)) return r.get(e);
    var n = t();
    return r.set(e, n), r.get(e);
  }
  var rSe = "Abs", nSe = "Acos", aSe = "Acosh", hW = "Add", iSe = "AddN", oSe = "All", sSe = "Any", lSe = "ArgMax", uSe = "ArgMin", cSe = "Asin", fSe = "Asinh", hSe = "Atan", pSe = "Atanh", dSe = "Atan2", vSe = "AvgPool", mSe = "AvgPool3D", gSe = "BatchMatMul", ySe = "BatchToSpaceND", xSe = "Bincount", bSe = "BroadcastArgs", pW = "Cast", _Se = "Ceil", wSe = "ClipByValue", kSe = "Complex", TSe = "ComplexAbs", ASe = "Concat", SSe = "Conv2D", ESe = "Conv2DBackpropFilter", DSe = "Conv2DBackpropInput", CSe = "Conv3D", MSe = "Conv3DBackpropInputV2", ISe = "Cos", NSe = "Cosh", FSe = "Cumsum", OSe = "CropAndResize", PSe = "DenseBincount", LSe = "DepthToSpace", RSe = "DepthwiseConv2dNative", zSe = "DepthwiseConv2dNativeBackpropFilter", BSe = "DepthwiseConv2dNativeBackpropInput", USe = "Diag", VSe = "Dilation2D", jSe = "RealDiv", WSe = "Einsum", GSe = "Elu", $Se = "Erf", HSe = "Equal", qSe = "Exp", XSe = "ExpandDims", KSe = "Expm1", YSe = "FFT", ZSe = "Fill", JSe = "FlipLeftRight", QSe = "Floor", eEe = "FloorDiv", tEe = "FusedBatchNorm", rEe = "GatherV2", nEe = "GatherNd", aEe = "Greater", iEe = "GreaterEqual", dW = "Identity", oEe = "IFFT", sEe = "Imag", lEe = "IsFinite", uEe = "IsInf", cEe = "IsNan", fEe = "LeakyRelu", hEe = "Less", pEe = "LessEqual", dEe = "LinSpace", vEe = "Log", mEe = "Log1p", gEe = "LogicalAnd", yEe = "LogicalNot", xEe = "LogicalOr", bEe = "LRN", _Ee = "Max", wEe = "Maximum", kEe = "MaxPool", TEe = "MaxPool3D", AEe = "MaxPoolWithArgmax", SEe = "Mean", EEe = "Min", DEe = "Minimum", CEe = "MirrorPad", MEe = "Mod", IEe = "Multinomial", NEe = "Multiply", FEe = "Neg", OEe = "NotEqual", PEe = "NonMaxSuppressionV3", LEe = "NonMaxSuppressionV4", REe = "NonMaxSuppressionV5", zEe = "OnesLike", BEe = "OneHot", UEe = "Pack", VEe = "PadV2", jEe = "Pow", WEe = "Prelu", GEe = "Prod", $Ee = "Range", HEe = "Real", qEe = "Reciprocal", XEe = "Relu", KEe = "Reshape", YEe = "ResizeNearestNeighbor", ZEe = "ResizeBilinear", JEe = "Relu6", QEe = "Reverse", e4e = "Round", t4e = "Rsqrt", r4e = "ScatterNd", n4e = "Select", a4e = "Selu", i4e = "Slice", o4e = "Sin", s4e = "Sinh", l4e = "Sign", u4e = "Sigmoid", c4e = "Softplus", f4e = "Sqrt", h4e = "Sum", p4e = "SpaceToBatchND", d4e = "SplitV", v4e = "Softmax", m4e = "SparseFillEmptyRows", g4e = "SparseReshape", y4e = "SparseSegmentMean", x4e = "SparseSegmentSum", b4e = "SparseToDense", _4e = "SquaredDifference", w4e = "StridedSlice", k4e = "StringNGrams", T4e = "StringSplit", A4e = "StringToHashBucketFast", S4e = "Sub", E4e = "Tan", D4e = "Tanh", vW = "Tile", C4e = "TopK", M4e = "Transform", I4e = "Transpose", N4e = "Unique", F4e = "Unpack", O4e = "UnsortedSegmentSum", P4e = "ZerosLike", L4e = "Step", R4e = "RotateWithOffset", Fj = "_FusedMatMul", Oj = "FusedConv2D", Pj = "FusedDepthwiseConv2D";
  function x2() {
    for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
    vp().getBool("IS_TEST") || vp().getBool("PROD") || console.warn.apply(console, Sc(e));
  }
  var mW = sM("kernelRegistry", function() {
    return /* @__PURE__ */ new Map();
  }), z4e = sM("gradRegistry", function() {
    return /* @__PURE__ */ new Map();
  });
  function Lj(e, t) {
    var r = B4e(e, t);
    return mW.get(r);
  }
  function Rj(e) {
    return z4e.get(e);
  }
  function zj(e) {
    for (var t = mW.entries(), r = []; ; ) {
      var n = t.next(), a = n.done, o = n.value;
      if (a) break;
      var s = ni(o, 2), i = s[0], l = s[1], u2 = ni(i.split("_"), 1), c = u2[0];
      c === e && r.push(l);
    }
    return r;
  }
  function B4e(e, t) {
    return t + "_" + e;
  }
  var GC = _l, mp = null;
  try {
    mp = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11])), {}).exports;
  } catch {
  }
  function _l(e, t, r) {
    this.low = e | 0, this.high = t | 0, this.unsigned = !!r;
  }
  _l.prototype.__isLong__;
  Object.defineProperty(_l.prototype, "__isLong__", { value: true });
  function uh(e) {
    return (e && e.__isLong__) === true;
  }
  _l.isLong = uh;
  var Bj = {}, Uj = {};
  function hg(e, t) {
    var r, n, a;
    return t ? (e >>>= 0, (a = 0 <= e && e < 256) && (n = Uj[e], n) ? n : (r = wl(e, (e | 0) < 0 ? -1 : 0, true), a && (Uj[e] = r), r)) : (e |= 0, (a = -128 <= e && e < 128) && (n = Bj[e], n) ? n : (r = wl(e, e < 0 ? -1 : 0, false), a && (Bj[e] = r), r));
  }
  _l.fromInt = hg;
  function gp(e, t) {
    if (isNaN(e)) return t ? ig : yp;
    if (t) {
      if (e < 0) return ig;
      if (e >= gW) return bW;
    } else {
      if (e <= -jj) return sh;
      if (e + 1 >= jj) return xW;
    }
    return e < 0 ? gp(-e, t).neg() : wl(e % Ty | 0, e / Ty | 0, t);
  }
  _l.fromNumber = gp;
  function wl(e, t, r) {
    return new _l(e, t, r);
  }
  _l.fromBits = wl;
  var Uk = Math.pow;
  function lM(e, t, r) {
    if (e.length === 0) throw Error("empty string");
    if (e === "NaN" || e === "Infinity" || e === "+Infinity" || e === "-Infinity") return yp;
    if (typeof t == "number" ? (r = t, t = false) : t = !!t, r = r || 10, r < 2 || 36 < r) throw RangeError("radix");
    var n;
    if ((n = e.indexOf("-")) > 0) throw Error("interior hyphen");
    if (n === 0) return lM(e.substring(1), t, r).neg();
    for (var a = gp(Uk(r, 8)), o = yp, s = 0; s < e.length; s += 8) {
      var i = Math.min(8, e.length - s), l = parseInt(e.substring(s, s + i), r);
      if (i < 8) {
        var u2 = gp(Uk(r, i));
        o = o.mul(u2).add(gp(l));
      } else o = o.mul(a), o = o.add(gp(l));
    }
    return o.unsigned = t, o;
  }
  _l.fromString = lM;
  function fd(e, t) {
    return typeof e == "number" ? gp(e, t) : typeof e == "string" ? lM(e, t) : wl(e.low, e.high, typeof t == "boolean" ? t : e.unsigned);
  }
  _l.fromValue = fd;
  var Vj = 1 << 16, U4e = 1 << 24, Ty = Vj * Vj, gW = Ty * Ty, jj = gW / 2, Wj = hg(U4e), yp = hg(0);
  _l.ZERO = yp;
  var ig = hg(0, true);
  _l.UZERO = ig;
  var _y = hg(1);
  _l.ONE = _y;
  var yW = hg(1, true);
  _l.UONE = yW;
  var $C = hg(-1);
  _l.NEG_ONE = $C;
  var xW = wl(-1, 2147483647, false);
  _l.MAX_VALUE = xW;
  var bW = wl(-1, -1, true);
  _l.MAX_UNSIGNED_VALUE = bW;
  var sh = wl(0, -2147483648, false);
  _l.MIN_VALUE = sh;
  var Va = _l.prototype;
  Va.toInt = function() {
    return this.unsigned ? this.low >>> 0 : this.low;
  };
  Va.toNumber = function() {
    return this.unsigned ? (this.high >>> 0) * Ty + (this.low >>> 0) : this.high * Ty + (this.low >>> 0);
  };
  Va.toString = function(t) {
    if (t = t || 10, t < 2 || 36 < t) throw RangeError("radix");
    if (this.isZero()) return "0";
    if (this.isNegative()) if (this.eq(sh)) {
      var r = gp(t), n = this.div(r), a = n.mul(r).sub(this);
      return n.toString(t) + a.toInt().toString(t);
    } else return "-" + this.neg().toString(t);
    for (var o = gp(Uk(t, 6), this.unsigned), s = this, i = ""; ; ) {
      var l = s.div(o), u2 = s.sub(l.mul(o)).toInt() >>> 0, c = u2.toString(t);
      if (s = l, s.isZero()) return c + i;
      for (; c.length < 6; ) c = "0" + c;
      i = "" + c + i;
    }
  };
  Va.getHighBits = function() {
    return this.high;
  };
  Va.getHighBitsUnsigned = function() {
    return this.high >>> 0;
  };
  Va.getLowBits = function() {
    return this.low;
  };
  Va.getLowBitsUnsigned = function() {
    return this.low >>> 0;
  };
  Va.getNumBitsAbs = function() {
    if (this.isNegative()) return this.eq(sh) ? 64 : this.neg().getNumBitsAbs();
    for (var t = this.high != 0 ? this.high : this.low, r = 31; r > 0 && (t & 1 << r) == 0; r--) ;
    return this.high != 0 ? r + 33 : r + 1;
  };
  Va.isZero = function() {
    return this.high === 0 && this.low === 0;
  };
  Va.eqz = Va.isZero;
  Va.isNegative = function() {
    return !this.unsigned && this.high < 0;
  };
  Va.isPositive = function() {
    return this.unsigned || this.high >= 0;
  };
  Va.isOdd = function() {
    return (this.low & 1) === 1;
  };
  Va.isEven = function() {
    return (this.low & 1) === 0;
  };
  Va.equals = function(t) {
    return uh(t) || (t = fd(t)), this.unsigned !== t.unsigned && this.high >>> 31 === 1 && t.high >>> 31 === 1 ? false : this.high === t.high && this.low === t.low;
  };
  Va.eq = Va.equals;
  Va.notEquals = function(t) {
    return !this.eq(t);
  };
  Va.neq = Va.notEquals;
  Va.ne = Va.notEquals;
  Va.lessThan = function(t) {
    return this.comp(t) < 0;
  };
  Va.lt = Va.lessThan;
  Va.lessThanOrEqual = function(t) {
    return this.comp(t) <= 0;
  };
  Va.lte = Va.lessThanOrEqual;
  Va.le = Va.lessThanOrEqual;
  Va.greaterThan = function(t) {
    return this.comp(t) > 0;
  };
  Va.gt = Va.greaterThan;
  Va.greaterThanOrEqual = function(t) {
    return this.comp(t) >= 0;
  };
  Va.gte = Va.greaterThanOrEqual;
  Va.ge = Va.greaterThanOrEqual;
  Va.compare = function(t) {
    if (uh(t) || (t = fd(t)), this.eq(t)) return 0;
    var r = this.isNegative(), n = t.isNegative();
    return r && !n ? -1 : !r && n ? 1 : this.unsigned ? t.high >>> 0 > this.high >>> 0 || t.high === this.high && t.low >>> 0 > this.low >>> 0 ? -1 : 1 : this.sub(t).isNegative() ? -1 : 1;
  };
  Va.comp = Va.compare;
  Va.negate = function() {
    return !this.unsigned && this.eq(sh) ? sh : this.not().add(_y);
  };
  Va.neg = Va.negate;
  Va.add = function(t) {
    uh(t) || (t = fd(t));
    var r = this.high >>> 16, n = this.high & 65535, a = this.low >>> 16, o = this.low & 65535, s = t.high >>> 16, i = t.high & 65535, l = t.low >>> 16, u2 = t.low & 65535, c = 0, f = 0, h = 0, p = 0;
    return p += o + u2, h += p >>> 16, p &= 65535, h += a + l, f += h >>> 16, h &= 65535, f += n + i, c += f >>> 16, f &= 65535, c += r + s, c &= 65535, wl(h << 16 | p, c << 16 | f, this.unsigned);
  };
  Va.subtract = function(t) {
    return uh(t) || (t = fd(t)), this.add(t.neg());
  };
  Va.sub = Va.subtract;
  Va.multiply = function(t) {
    if (this.isZero()) return yp;
    if (uh(t) || (t = fd(t)), mp) {
      var r = mp.mul(this.low, this.high, t.low, t.high);
      return wl(r, mp.get_high(), this.unsigned);
    }
    if (t.isZero()) return yp;
    if (this.eq(sh)) return t.isOdd() ? sh : yp;
    if (t.eq(sh)) return this.isOdd() ? sh : yp;
    if (this.isNegative()) return t.isNegative() ? this.neg().mul(t.neg()) : this.neg().mul(t).neg();
    if (t.isNegative()) return this.mul(t.neg()).neg();
    if (this.lt(Wj) && t.lt(Wj)) return gp(this.toNumber() * t.toNumber(), this.unsigned);
    var n = this.high >>> 16, a = this.high & 65535, o = this.low >>> 16, s = this.low & 65535, i = t.high >>> 16, l = t.high & 65535, u2 = t.low >>> 16, c = t.low & 65535, f = 0, h = 0, p = 0, d = 0;
    return d += s * c, p += d >>> 16, d &= 65535, p += o * c, h += p >>> 16, p &= 65535, p += s * u2, h += p >>> 16, p &= 65535, h += a * c, f += h >>> 16, h &= 65535, h += o * u2, f += h >>> 16, h &= 65535, h += s * l, f += h >>> 16, h &= 65535, f += n * c + a * u2 + o * l + s * i, f &= 65535, wl(p << 16 | d, f << 16 | h, this.unsigned);
  };
  Va.mul = Va.multiply;
  Va.divide = function(t) {
    if (uh(t) || (t = fd(t)), t.isZero()) throw Error("division by zero");
    if (mp) {
      if (!this.unsigned && this.high === -2147483648 && t.low === -1 && t.high === -1) return this;
      var r = (this.unsigned ? mp.div_u : mp.div_s)(this.low, this.high, t.low, t.high);
      return wl(r, mp.get_high(), this.unsigned);
    }
    if (this.isZero()) return this.unsigned ? ig : yp;
    var n, a, o;
    if (this.unsigned) {
      if (t.unsigned || (t = t.toUnsigned()), t.gt(this)) return ig;
      if (t.gt(this.shru(1))) return yW;
      o = ig;
    } else {
      if (this.eq(sh)) {
        if (t.eq(_y) || t.eq($C)) return sh;
        if (t.eq(sh)) return _y;
        var s = this.shr(1);
        return n = s.div(t).shl(1), n.eq(yp) ? t.isNegative() ? _y : $C : (a = this.sub(t.mul(n)), o = n.add(a.div(t)), o);
      } else if (t.eq(sh)) return this.unsigned ? ig : yp;
      if (this.isNegative()) return t.isNegative() ? this.neg().div(t.neg()) : this.neg().div(t).neg();
      if (t.isNegative()) return this.div(t.neg()).neg();
      o = yp;
    }
    for (a = this; a.gte(t); ) {
      n = Math.max(1, Math.floor(a.toNumber() / t.toNumber()));
      for (var i = Math.ceil(Math.log(n) / Math.LN2), l = i <= 48 ? 1 : Uk(2, i - 48), u2 = gp(n), c = u2.mul(t); c.isNegative() || c.gt(a); ) n -= l, u2 = gp(n, this.unsigned), c = u2.mul(t);
      u2.isZero() && (u2 = _y), o = o.add(u2), a = a.sub(c);
    }
    return o;
  };
  Va.div = Va.divide;
  Va.modulo = function(t) {
    if (uh(t) || (t = fd(t)), mp) {
      var r = (this.unsigned ? mp.rem_u : mp.rem_s)(this.low, this.high, t.low, t.high);
      return wl(r, mp.get_high(), this.unsigned);
    }
    return this.sub(this.div(t).mul(t));
  };
  Va.mod = Va.modulo;
  Va.rem = Va.modulo;
  Va.not = function() {
    return wl(~this.low, ~this.high, this.unsigned);
  };
  Va.and = function(t) {
    return uh(t) || (t = fd(t)), wl(this.low & t.low, this.high & t.high, this.unsigned);
  };
  Va.or = function(t) {
    return uh(t) || (t = fd(t)), wl(this.low | t.low, this.high | t.high, this.unsigned);
  };
  Va.xor = function(t) {
    return uh(t) || (t = fd(t)), wl(this.low ^ t.low, this.high ^ t.high, this.unsigned);
  };
  Va.shiftLeft = function(t) {
    return uh(t) && (t = t.toInt()), (t &= 63) === 0 ? this : t < 32 ? wl(this.low << t, this.high << t | this.low >>> 32 - t, this.unsigned) : wl(0, this.low << t - 32, this.unsigned);
  };
  Va.shl = Va.shiftLeft;
  Va.shiftRight = function(t) {
    return uh(t) && (t = t.toInt()), (t &= 63) === 0 ? this : t < 32 ? wl(this.low >>> t | this.high << 32 - t, this.high >> t, this.unsigned) : wl(this.high >> t - 32, this.high >= 0 ? 0 : -1, this.unsigned);
  };
  Va.shr = Va.shiftRight;
  Va.shiftRightUnsigned = function(t) {
    if (uh(t) && (t = t.toInt()), t &= 63, t === 0) return this;
    var r = this.high;
    if (t < 32) {
      var n = this.low;
      return wl(n >>> t | r << 32 - t, r >>> t, this.unsigned);
    } else return t === 32 ? wl(r, 0, this.unsigned) : wl(r >>> t - 32, 0, this.unsigned);
  };
  Va.shru = Va.shiftRightUnsigned;
  Va.shr_u = Va.shiftRightUnsigned;
  Va.toSigned = function() {
    return this.unsigned ? wl(this.low, this.high, false) : this;
  };
  Va.toUnsigned = function() {
    return this.unsigned ? this : wl(this.low, this.high, true);
  };
  Va.toBytes = function(t) {
    return t ? this.toBytesLE() : this.toBytesBE();
  };
  Va.toBytesLE = function() {
    var t = this.high, r = this.low;
    return [r & 255, r >>> 8 & 255, r >>> 16 & 255, r >>> 24, t & 255, t >>> 8 & 255, t >>> 16 & 255, t >>> 24];
  };
  Va.toBytesBE = function() {
    var t = this.high, r = this.low;
    return [t >>> 24, t >>> 16 & 255, t >>> 8 & 255, t & 255, r >>> 24, r >>> 16 & 255, r >>> 8 & 255, r & 255];
  };
  _l.fromBytes = function(t, r, n) {
    return n ? _l.fromBytesLE(t, r) : _l.fromBytesBE(t, r);
  };
  _l.fromBytesLE = function(t, r) {
    return new _l(t[0] | t[1] << 8 | t[2] << 16 | t[3] << 24, t[4] | t[5] << 8 | t[6] << 16 | t[7] << 24, r);
  };
  _l.fromBytesBE = function(t, r) {
    return new _l(t[4] << 24 | t[5] << 16 | t[6] << 8 | t[7], t[0] << 24 | t[1] << 16 | t[2] << 8 | t[3], r);
  };
  var V4e = Object.assign(/* @__PURE__ */ Object.create(null), GC, { default: GC }), j4e = GC || V4e;
  function uM(e) {
    return j4e.fromString(e, true, 16);
  }
  uM("c3a5c85c97cb3127");
  uM("b492b66fbe98f273");
  uM("9ae16a3b2f90404f");
  function W4e(e, t) {
    return e instanceof Float32Array && t === "float32" || e instanceof Int32Array && t === "int32" || e instanceof Uint8Array && t === "bool";
  }
  function _W(e, t) {
    if (t === "string") throw new Error("Cannot convert a string[] to a TypedArray");
    if (Array.isArray(e) && (e = Zk(e)), vp().getBool("DEBUG") && $Ae(e, t), W4e(e, t)) return e;
    if (t == null || t === "float32" || t === "complex64") return new Float32Array(e);
    if (t === "int32") return new Int32Array(e);
    if (t === "bool") {
      for (var r = new Uint8Array(e.length), n = 0; n < r.length; ++n) Math.round(e[n]) !== 0 && (r[n] = 1);
      return r;
    } else throw new Error("Unknown data type " + t);
  }
  function Vk() {
    return vp().platform.now();
  }
  function G4e(e, t) {
    return t === void 0 && (t = "utf-8"), t = t || "utf-8", vp().platform.encode(e, t);
  }
  function Gj(e, t) {
    return t === void 0 && (t = "utf-8"), t = t || "utf-8", vp().platform.decode(e, t);
  }
  var $4e = function() {
    function e(t, r) {
      this.backendTimer = t, this.logger = r, r == null && (this.logger = new q4e());
    }
    return e.prototype.profileKernel = function(t, r, n) {
      var a, o, s, i = function() {
        s = n();
      }, l, u2 = Vk();
      if (this.backendTimer.timerAvailable()) l = this.backendTimer.time(i);
      else {
        i();
        try {
          for (var c = zk(s), f = c.next(); !f.done; f = c.next()) {
            var h = f.value;
            h.dataSync();
          }
        } catch (m) {
          a = { error: m };
        } finally {
          try {
            f && !f.done && (o = c.return) && o.call(c);
          } finally {
            if (a) throw a.error;
          }
        }
        l = Promise.resolve({ kernelMs: Vk() - u2 });
      }
      if (vp().getBool("CHECK_COMPUTATION_FOR_ERRORS")) for (var p = function(m) {
        var g = s[m];
        g.data().then(function(x) {
          H4e(x, g.dtype, t);
        });
      }, d = 0; d < s.length; d++) p(d);
      var v = { kernelName: t, outputs: s, inputs: r, timeMs: l.then(function(m) {
        return m.kernelMs;
      }), extraInfo: l.then(function(m) {
        return m.getExtraProfileInfo != null ? m.getExtraProfileInfo() : "";
      }) };
      return v;
    }, e.prototype.logKernelProfile = function(t) {
      var r = this, n = t.kernelName, a = t.outputs, o = t.timeMs, s = t.inputs, i = t.extraInfo;
      a.forEach(function(l) {
        Promise.all([l.data(), o, i]).then(function(u2) {
          r.logger.logKernelProfile(n, l, u2[0], u2[1], s, u2[2]);
        });
      });
    }, e;
  }();
  function H4e(e, t, r) {
    if (t !== "float32") return false;
    for (var n = 0; n < e.length; n++) {
      var a = e[n];
      if (isNaN(a) || !isFinite(a)) return console.warn("Found " + a + " in the result of '" + r + "'"), true;
    }
    return false;
  }
  var q4e = function() {
    function e() {
    }
    return e.prototype.logKernelProfile = function(t, r, n, a, o, s) {
      var i = typeof a == "number" ? Pk(a + "ms", 9) : a.error, l = Pk(t, 25), u2 = r.rank, c = r.size, f = Pk(r.shape.toString(), 14), h = "";
      for (var p in o) {
        var d = o[p];
        if (d != null) {
          var v = d.shape || r.shape, m = v.length;
          h += p + ": " + m + "D " + (m > 0 ? v : "") + " ";
        }
      }
      console.log("%c" + l + "	%c" + i + "	%c" + u2 + "D " + f + "	%c" + c + "	%c" + h + "	%c" + s, "font-weight:bold", "color:red", "color:blue", "color: orange", "color: green", "color: steelblue");
    }, e;
  }();
  function X4e(e, t, r) {
    for (var n = {}, a = {}, o = 0; o < t.length; o++) n[t[o].id] = true;
    for (var o = 0; o < e.length; o++) {
      var s = e[o], i = s.inputs;
      for (var l in i) {
        for (var u2 = i[l], c = false, f = 0; f < t.length; f++) if (n[u2.id]) {
          s.outputs.forEach(function(b) {
            return n[b.id] = true;
          }), c = true, a[s.id] = true;
          break;
        }
        if (c) break;
      }
    }
    var h = {};
    h[r.id] = true;
    for (var p = {}, o = e.length - 1; o >= 0; o--) for (var s = e[o], i = s.inputs, f = 0; f < s.outputs.length; f++) if (h[s.outputs[f].id]) {
      for (var l in i) h[i[l].id] = true, p[s.id] = true;
      break;
    }
    for (var d = [], o = 0; o < e.length; o++) {
      var s = e[o];
      if (a[s.id] && p[s.id]) {
        var v = {};
        for (var l in s.inputs) {
          var m = s.inputs[l];
          n[m.id] && (v[l] = m);
        }
        var g = Object.assign({}, s);
        g.inputs = v, g.outputs = s.outputs, d.push(g);
      }
    }
    return d;
  }
  function K4e(e, t, r, n) {
    for (var a = function(s) {
      var i = t[s], l = [];
      if (i.outputs.forEach(function(h) {
        var p = e[h.id];
        p != null ? l.push(p) : l.push(null);
      }), i.gradient == null) throw new Error("Cannot compute gradient: gradient function not found " + ("for " + i.kernelName + "."));
      var u2 = i.gradient(l), c = function(h) {
        if (!(h in u2)) throw new Error("Cannot backprop through input " + h + ". " + ("Available gradients found: " + Object.keys(u2) + "."));
        var p = r(function() {
          return u2[h]();
        });
        if (p.dtype !== "float32") throw new Error("Error in gradient for op " + i.kernelName + ". The gradient of input " + (h + " must have 'float32' dtype, but has '" + p.dtype + "'"));
        var d = i.inputs[h];
        if (!Ny(p.shape, d.shape)) throw new Error("Error in gradient for op " + i.kernelName + ". The gradient of input " + ("'" + h + "' has shape '" + p.shape + "', which does not match ") + ("the shape of the input '" + d.shape + "'"));
        if (e[d.id] == null) e[d.id] = p;
        else {
          var v = e[d.id];
          e[d.id] = n(v, p), v.dispose();
        }
      };
      for (var f in i.inputs) c(f);
    }, o = t.length - 1; o >= 0; o--) a(o);
  }
  var $j = 20, b2 = 3, MC = 7;
  function Y4e(e, t, r, n) {
    var a = iM(t), o = Z4e(e, t, r, a), s = t.length, i = Lk(e, t, r, a, o), l = ["Tensor"];
    return n && (l.push("  dtype: " + r), l.push("  rank: " + s), l.push("  shape: [" + t + "]"), l.push("  values:")), l.push(i.map(function(u2) {
      return "    " + u2;
    }).join(`
`)), l.join(`
`);
  }
  function Z4e(e, t, r, n) {
    var a = lh(t), o = n[n.length - 1], s = new Array(o).fill(0), i = t.length, l = r === "complex64" ? T2(e) : e;
    if (i > 1) for (var u2 = 0; u2 < a / o; u2++) for (var c = u2 * o, f = 0; f < o; f++) s[f] = Math.max(s[f], k2(l[c + f], 0, r).length);
    return s;
  }
  function k2(e, t, r) {
    var n;
    return Array.isArray(e) ? n = parseFloat(e[0].toFixed(MC)) + " + " + (parseFloat(e[1].toFixed(MC)) + "j") : nM(e) ? n = "'" + e + "'" : r === "bool" ? n = wW(e) : n = parseFloat(e.toFixed(MC)).toString(), Pk(n, t);
  }
  function wW(e) {
    return e === 0 ? "false" : "true";
  }
  function Lk(e, t, r, n, a, o) {
    o === void 0 && (o = true);
    var s = r === "complex64" ? 2 : 1, i = t[0], l = t.length;
    if (l === 0) {
      if (r === "complex64") {
        var u2 = T2(e);
        return [k2(u2[0], 0, r)];
      }
      return r === "bool" ? [wW(e[0])] : [e[0].toString()];
    }
    if (l === 1) {
      if (i > $j) {
        var c = b2 * s, f = Array.from(e.slice(0, c)), h = Array.from(e.slice((i - b2) * s, i * s));
        return r === "complex64" && (f = T2(f), h = T2(h)), ["[" + f.map(function(k, T3) {
          return k2(k, a[T3], r);
        }).join(", ") + ", ..., " + h.map(function(k, T3) {
          return k2(k, a[i - b2 + T3], r);
        }).join(", ") + "]"];
      }
      var p = r === "complex64" ? T2(e) : Array.from(e);
      return ["[" + p.map(function(k, T3) {
        return k2(k, a[T3], r);
      }).join(", ") + "]"];
    }
    var d = t.slice(1), v = n.slice(1), m = n[0] * s, g = [];
    if (i > $j) {
      for (var x = 0; x < b2; x++) {
        var b = x * m, y = b + m;
        g.push.apply(g, Sc(Lk(e.slice(b, y), d, r, v, a, false)));
      }
      g.push("...");
      for (var x = i - b2; x < i; x++) {
        var b = x * m, y = b + m;
        g.push.apply(g, Sc(Lk(e.slice(b, y), d, r, v, a, x === i - 1)));
      }
    } else for (var x = 0; x < i; x++) {
      var b = x * m, y = b + m;
      g.push.apply(g, Sc(Lk(e.slice(b, y), d, r, v, a, x === i - 1)));
    }
    var w = l === 2 ? "," : "";
    g[0] = "[" + g[0] + w;
    for (var x = 1; x < g.length - 1; x++) g[x] = " " + g[x] + w;
    for (var _4 = `,
`, x = 2; x < l; x++) _4 += `
`;
    return g[g.length - 1] = " " + g[g.length - 1] + "]" + (o ? "" : _4), g;
  }
  function T2(e) {
    for (var t = [], r = 0; r < e.length; r += 2) t.push([e[r], e[r + 1]]);
    return t;
  }
  var HC = function() {
    function e(t, r, n) {
      var a = this;
      if (this.dtype = r, this.shape = t.slice(), this.size = lh(t), n != null) {
        var o = n.length;
        Yr(o === this.size, function() {
          return "Length of values '" + o + "' does not match the size " + ("inferred by the shape '" + a.size + "'.");
        });
      }
      if (r === "complex64") throw new Error("complex64 dtype TensorBuffers are not supported. Please create a TensorBuffer for the real and imaginary parts separately and call tf.complex(real, imag).");
      this.values = n || GAe(r, this.size), this.strides = iM(t);
    }
    return e.prototype.set = function(t) {
      for (var r = this, n = [], a = 1; a < arguments.length; a++) n[a - 1] = arguments[a];
      n.length === 0 && (n = [0]), Yr(n.length === this.rank, function() {
        return "The number of provided coordinates (" + n.length + ") must " + ("match the rank (" + r.rank + ")");
      });
      var o = this.locToIndex(n);
      this.values[o] = t;
    }, e.prototype.get = function() {
      for (var t, r, n = [], a = 0; a < arguments.length; a++) n[a] = arguments[a];
      n.length === 0 && (n = [0]);
      var o = 0;
      try {
        for (var s = zk(n), i = s.next(); !i.done; i = s.next()) {
          var l = i.value;
          if (l < 0 || l >= this.shape[o]) {
            var u2 = "Requested out of range element at " + n + ". " + ("  Buffer shape=" + this.shape);
            throw new Error(u2);
          }
          o++;
        }
      } catch (h) {
        t = { error: h };
      } finally {
        try {
          i && !i.done && (r = s.return) && r.call(s);
        } finally {
          if (t) throw t.error;
        }
      }
      for (var c = n[n.length - 1], f = 0; f < n.length - 1; ++f) c += this.strides[f] * n[f];
      return this.values[c];
    }, e.prototype.locToIndex = function(t) {
      if (this.rank === 0) return 0;
      if (this.rank === 1) return t[0];
      for (var r = t[t.length - 1], n = 0; n < t.length - 1; ++n) r += this.strides[n] * t[n];
      return r;
    }, e.prototype.indexToLoc = function(t) {
      if (this.rank === 0) return [];
      if (this.rank === 1) return [t];
      for (var r = new Array(this.shape.length), n = 0; n < r.length - 1; ++n) r[n] = Math.floor(t / this.strides[n]), t -= r[n] * this.strides[n];
      return r[r.length - 1] = t, r;
    }, Object.defineProperty(e.prototype, "rank", { get: function() {
      return this.shape.length;
    }, enumerable: true, configurable: true }), e.prototype.toTensor = function() {
      return cd().makeTensor(this.values, this.shape, this.dtype);
    }, e;
  }(), cd = null, _22 = null;
  function J4e(e) {
    cd = e;
  }
  var Pf = function() {
    function e(t, r, n, a) {
      this.kept = false, this.isDisposedInternal = false, this.shape = t.slice(), this.dtype = r || "float32", this.size = lh(t), this.strides = iM(t), this.dataId = n, this.id = a, this.rankType = this.rank < 5 ? this.rank.toString() : "higher";
    }
    return Object.defineProperty(e.prototype, "rank", { get: function() {
      return this.shape.length;
    }, enumerable: true, configurable: true }), e.prototype.buffer = function() {
      return Ps(this, void 0, void 0, function() {
        var t;
        return ws(this, function(r) {
          switch (r.label) {
            case 0:
              return [4, this.data()];
            case 1:
              return t = r.sent(), [2, _22.buffer(this.shape, this.dtype, t)];
          }
        });
      });
    }, e.prototype.bufferSync = function() {
      return _22.buffer(this.shape, this.dtype, this.dataSync());
    }, e.prototype.array = function() {
      return Ps(this, void 0, void 0, function() {
        var t;
        return ws(this, function(r) {
          switch (r.label) {
            case 0:
              return [4, this.data()];
            case 1:
              return t = r.sent(), [2, Ij(this.shape, t, this.dtype === "complex64")];
          }
        });
      });
    }, e.prototype.arraySync = function() {
      return Ij(this.shape, this.dataSync(), this.dtype === "complex64");
    }, e.prototype.data = function() {
      return Ps(this, void 0, void 0, function() {
        var t, r;
        return ws(this, function(n) {
          switch (n.label) {
            case 0:
              return this.throwIfDisposed(), t = cd().read(this.dataId), this.dtype !== "string" ? [3, 2] : [4, t];
            case 1:
              r = n.sent();
              try {
                return [2, r.map(function(a) {
                  return Gj(a);
                })];
              } catch {
                throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().");
              }
              n.label = 2;
            case 2:
              return [2, t];
          }
        });
      });
    }, e.prototype.dataToGPU = function(t) {
      return this.throwIfDisposed(), cd().readToGPU(this.dataId, t);
    }, e.prototype.dataSync = function() {
      this.throwIfDisposed();
      var t = cd().readSync(this.dataId);
      if (this.dtype === "string") try {
        return t.map(function(r) {
          return Gj(r);
        });
      } catch {
        throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().");
      }
      return t;
    }, e.prototype.bytes = function() {
      return Ps(this, void 0, void 0, function() {
        var t;
        return ws(this, function(r) {
          switch (r.label) {
            case 0:
              return this.throwIfDisposed(), [4, cd().read(this.dataId)];
            case 1:
              return t = r.sent(), this.dtype === "string" ? [2, t] : [2, new Uint8Array(t.buffer)];
          }
        });
      });
    }, e.prototype.dispose = function() {
      this.isDisposed || (cd().disposeTensor(this), this.isDisposedInternal = true);
    }, Object.defineProperty(e.prototype, "isDisposed", { get: function() {
      return this.isDisposedInternal;
    }, enumerable: true, configurable: true }), e.prototype.throwIfDisposed = function() {
      if (this.isDisposed) throw new Error("Tensor is disposed.");
    }, e.prototype.print = function(t) {
      return t === void 0 && (t = false), _22.print(this, t);
    }, e.prototype.clone = function() {
      return this.throwIfDisposed(), _22.clone(this);
    }, e.prototype.toString = function(t) {
      t === void 0 && (t = false);
      var r = this.dataSync();
      return Y4e(r, this.shape, this.dtype, t);
    }, e.prototype.cast = function(t) {
      return this.throwIfDisposed(), _22.cast(this, t);
    }, e.prototype.variable = function(t, r, n) {
      return t === void 0 && (t = true), this.throwIfDisposed(), cd().makeVariable(this, t, r, n);
    }, e;
  }();
  Object.defineProperty(Pf, Symbol.hasInstance, { value: function(e) {
    return !!e && e.data != null && e.dataSync != null && e.throwIfDisposed != null;
  } });
  function Q4e() {
    return sM("Tensor", function() {
      return Pf;
    });
  }
  Q4e();
  var qC = function(e) {
    KTe(t, e);
    function t(r, n, a, o) {
      var s = e.call(this, r.shape, r.dtype, r.dataId, o) || this;
      return s.trainable = n, s.name = a, s;
    }
    return t.prototype.assign = function(r) {
      if (r.dtype !== this.dtype) throw new Error("dtype of the new value (" + r.dtype + ") and " + ("previous value (" + this.dtype + ") must match"));
      if (!Ny(r.shape, this.shape)) throw new Error("shape of the new value (" + r.shape + ") and " + ("previous value (" + this.shape + ") must match"));
      cd().disposeTensor(this), this.dataId = r.dataId, cd().incRef(this, null);
    }, t.prototype.dispose = function() {
      cd().disposeVariable(this), this.isDisposedInternal = true;
    }, t;
  }(Pf);
  Object.defineProperty(qC, Symbol.hasInstance, { value: function(e) {
    return e instanceof Pf && e.assign != null && e.assign instanceof Function;
  } });
  var Hj;
  (function(e) {
    e.R0 = "R0", e.R1 = "R1", e.R2 = "R2", e.R3 = "R3", e.R4 = "R4", e.R5 = "R5", e.R6 = "R6";
  })(Hj || (Hj = {}));
  var XC;
  (function(e) {
    e.float32 = "float32", e.int32 = "int32", e.bool = "int32", e.complex64 = "complex64";
  })(XC || (XC = {}));
  var KC;
  (function(e) {
    e.float32 = "float32", e.int32 = "int32", e.bool = "bool", e.complex64 = "complex64";
  })(KC || (KC = {}));
  var YC;
  (function(e) {
    e.float32 = "float32", e.int32 = "float32", e.bool = "float32", e.complex64 = "complex64";
  })(YC || (YC = {}));
  var ZC;
  (function(e) {
    e.float32 = "complex64", e.int32 = "complex64", e.bool = "complex64", e.complex64 = "complex64";
  })(ZC || (ZC = {}));
  var e5e = { float32: YC, int32: XC, bool: KC, complex64: ZC };
  function t5e(e, t) {
    if (e === "string" || t === "string") {
      if (e === "string" && t === "string") return "string";
      throw new Error("Can not upcast " + e + " with " + t);
    }
    return e5e[e][t];
  }
  function su(e, t) {
    if (e.dtype === t.dtype) return [e, t];
    var r = t5e(e.dtype, t.dtype);
    return [e.cast(r), t.cast(r)];
  }
  function r5e(e, t) {
    Yr(e.dtype === t.dtype, function() {
      return "The dtypes of the first(" + e.dtype + ") and" + (" second(" + t.dtype + ") input must match");
    });
  }
  function kW(e) {
    var t = [], r = /* @__PURE__ */ new Set();
    return TW(e, t, r), t;
  }
  function TW(e, t, r) {
    if (e != null) {
      if (e instanceof Pf) {
        t.push(e);
        return;
      }
      if (!!n5e(e)) {
        var n = e;
        for (var a in n) {
          var o = n[a];
          r.has(o) || (r.add(o), TW(o, t, r));
        }
      }
    }
  }
  function n5e(e) {
    return Array.isArray(e) || typeof e == "object";
  }
  function IC(e) {
    return e.kernelName != null;
  }
  var qj = function() {
    function e() {
      this.registeredVariables = {}, this.nextTapeNodeId = 0, this.numBytes = 0, this.numTensors = 0, this.numStringTensors = 0, this.numDataBuffers = 0, this.gradientDepth = 0, this.kernelDepth = 0, this.scopeStack = [], this.numDataMovesStack = [], this.nextScopeId = 0, this.tensorInfo = /* @__PURE__ */ new WeakMap(), this.profiling = false, this.activeProfile = { newBytes: 0, newTensors: 0, peakBytes: 0, kernels: [], result: null, get kernelNames() {
        return Array.from(new Set(this.kernels.map(function(t) {
          return t.name;
        })));
      } };
    }
    return e.prototype.dispose = function() {
      for (var t in this.registeredVariables) this.registeredVariables[t].dispose();
    }, e;
  }(), cM = function() {
    function e(t) {
      this.ENV = t, this.registry = {}, this.registryFactory = {}, this.pendingBackendInitId = 0, this.state = new qj();
    }
    return e.prototype.ready = function() {
      return Ps(this, void 0, void 0, function() {
        var t, r, n, a;
        return ws(this, function(o) {
          switch (o.label) {
            case 0:
              if (this.pendingBackendInit != null) return [2, this.pendingBackendInit.then(function() {
              })];
              if (this.backendInstance != null) return [2];
              t = this.getSortedBackends(), r = 0, o.label = 1;
            case 1:
              return r < t.length ? (n = t[r], [4, this.initializeBackend(n).success]) : [3, 5];
            case 2:
              return a = o.sent(), a ? [4, this.setBackend(n)] : [3, 4];
            case 3:
              return o.sent(), [2];
            case 4:
              return r++, [3, 1];
            case 5:
              throw new Error("Could not initialize any backends, all backend initializations failed.");
          }
        });
      });
    }, Object.defineProperty(e.prototype, "backend", { get: function() {
      if (this.pendingBackendInit != null) throw new Error("Backend '" + this.backendName + "' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods");
      if (this.backendInstance == null) {
        var t = this.initializeBackendsAndReturnBest(), r = t.name, n = t.asyncInit;
        if (n) throw new Error("The highest priority backend '" + r + "' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods");
        this.setBackend(r);
      }
      return this.backendInstance;
    }, enumerable: true, configurable: true }), e.prototype.backendNames = function() {
      return Object.keys(this.registryFactory);
    }, e.prototype.findBackend = function(t) {
      if (!(t in this.registry)) if (t in this.registryFactory) {
        var r = this.initializeBackend(t).asyncInit;
        if (r) return null;
      } else return null;
      return this.registry[t];
    }, e.prototype.findBackendFactory = function(t) {
      return t in this.registryFactory ? this.registryFactory[t].factory : null;
    }, e.prototype.registerBackend = function(t, r, n) {
      return n === void 0 && (n = 1), t in this.registryFactory ? (x2(t + " backend was already registered. Reusing existing backend factory."), false) : (this.registryFactory[t] = { factory: r, priority: n }, true);
    }, e.prototype.setBackend = function(t) {
      return Ps(this, void 0, void 0, function() {
        var r, n, a, o, s;
        return ws(this, function(i) {
          switch (i.label) {
            case 0:
              if (this.registryFactory[t] == null) throw new Error("Backend name '" + t + "' not found in registry");
              return this.backendName = t, this.registry[t] != null ? [3, 4] : (this.backendInstance = null, r = this.initializeBackend(t), n = r.success, a = r.asyncInit, a ? [4, n] : [3, 2]);
            case 1:
              return s = i.sent(), [3, 3];
            case 2:
              s = n, i.label = 3;
            case 3:
              if (o = s, !o) return [2, false];
              i.label = 4;
            case 4:
              return this.backendInstance = this.registry[t], this.setupRegisteredKernels(), this.profiler = new $4e(this.backendInstance), [2, true];
          }
        });
      });
    }, e.prototype.setupRegisteredKernels = function() {
      var t = this, r = zj(this.backendName);
      r.forEach(function(n) {
        n.setupFunc != null && n.setupFunc(t.backendInstance);
      });
    }, e.prototype.disposeRegisteredKernels = function(t) {
      var r = this, n = zj(t);
      n.forEach(function(a) {
        a.disposeFunc != null && a.disposeFunc(r.registry[t]);
      });
    }, e.prototype.initializeBackend = function(t) {
      var r = this, n = this.registryFactory[t];
      if (n == null) throw new Error("Cannot initialize backend " + t + ", no registration found.");
      try {
        var a = n.factory();
        if (a && !(a instanceof VAe) && typeof a.then == "function") {
          var o = ++this.pendingBackendInitId, s = a.then(function(i) {
            return o < r.pendingBackendInitId ? false : (r.registry[t] = i, r.pendingBackendInit = null, true);
          }).catch(function(i) {
            return o < r.pendingBackendInitId || (r.pendingBackendInit = null, x2("Initialization of backend " + t + " failed"), x2(i.stack || i.message)), false;
          });
          return this.pendingBackendInit = s, { success: s, asyncInit: true };
        } else return this.registry[t] = a, { success: true, asyncInit: false };
      } catch (i) {
        return x2("Initialization of backend " + t + " failed"), x2(i.stack || i.message), { success: false, asyncInit: false };
      }
    }, e.prototype.removeBackend = function(t) {
      if (!(t in this.registryFactory)) throw new Error(t + " backend not found in registry");
      this.backendName === t && this.pendingBackendInit != null && this.pendingBackendInitId++, t in this.registry && (this.disposeRegisteredKernels(t), this.registry[t].dispose(), delete this.registry[t]), delete this.registryFactory[t], this.backendName === t && (this.pendingBackendInit = null, this.backendName = null, this.backendInstance = null);
    }, e.prototype.getSortedBackends = function() {
      var t = this;
      if (Object.keys(this.registryFactory).length === 0) throw new Error("No backend found in registry.");
      return Object.keys(this.registryFactory).sort(function(r, n) {
        return t.registryFactory[n].priority - t.registryFactory[r].priority;
      });
    }, e.prototype.initializeBackendsAndReturnBest = function() {
      for (var t = this.getSortedBackends(), r = 0; r < t.length; r++) {
        var n = t[r], a = this.initializeBackend(n), o = a.success, s = a.asyncInit;
        if (s || o) return { name: n, asyncInit: s };
      }
      throw new Error("Could not initialize any backends, all backend initializations failed.");
    }, e.prototype.moveData = function(t, r) {
      var n = this.state.tensorInfo.get(r), a = n.backend, o = this.readSync(r), s = a.refCount(r);
      a.disposeData(r, true), n.backend = t, t.move(r, o, n.shape, n.dtype, s), this.shouldCheckForMemLeaks() && this.state.numDataMovesStack[this.state.numDataMovesStack.length - 1]++;
    }, e.prototype.tidy = function(t, r) {
      var n = this, a = null;
      if (r == null) {
        if (typeof t != "function") throw new Error("Please provide a function to tidy()");
        r = t;
      } else {
        if (typeof t != "string" && !(t instanceof String)) throw new Error("When calling with two arguments, the first argument to tidy() must be a string");
        if (typeof r != "function") throw new Error("When calling with two arguments, the 2nd argument to tidy() must be a function");
        a = t;
      }
      var o;
      return this.scopedRun(function() {
        return n.startScope(a);
      }, function() {
        return n.endScope(o);
      }, function() {
        return o = r(), o instanceof Promise && console.error("Cannot return a Promise inside of tidy."), o;
      });
    }, e.prototype.scopedRun = function(t, r, n) {
      t();
      try {
        var a = n();
        return r(), a;
      } catch (o) {
        throw r(), o;
      }
    }, e.prototype.nextTensorId = function() {
      return e.nextTensorId++;
    }, e.prototype.nextVariableId = function() {
      return e.nextVariableId++;
    }, e.prototype.clone = function(t) {
      var r = fn.runKernel(dW, { x: t }), n = { x: t }, a = function(s) {
        return { x: function() {
          var i = "float32", l = { x: s }, u2 = { dtype: i };
          return fn.runKernel(pW, l, u2);
        } };
      }, o = [];
      return this.addTapeNode(this.state.activeScope.name, n, [r], a, o, {}), r;
    }, e.prototype.runKernel = function(t, r, n) {
      this.backendName == null && this.backend;
      var a = Lj(t, this.backendName) != null;
      if (!a) throw new Error("Kernel '" + t + "' not registered for backend '" + this.backendName + "'");
      return this.runKernelFunc({ kernelName: t, inputs: r, attrs: n });
    }, e.prototype.shouldCheckForMemLeaks = function() {
      return this.ENV.getBool("IS_TEST");
    }, e.prototype.checkKernelForMemLeak = function(t, r, n) {
      var a = this.backend.numDataIds(), o = 0;
      n.forEach(function(l) {
        o += l.dtype === "complex64" ? 3 : 1;
      });
      var s = this.state.numDataMovesStack[this.state.numDataMovesStack.length - 1], i = a - r - o - s;
      if (i > 0) throw new Error("Backend '" + this.backendName + "' has an internal memory leak " + ("(" + i + " data ids) after running '" + t + "'"));
    }, e.prototype.runKernelFunc = function(t) {
      var r = this, n, a = [], o = this.isTapeOn(), s = this.state.numBytes, i = this.state.numTensors;
      this.shouldCheckForMemLeaks() && this.state.numDataMovesStack.push(0);
      var l;
      this.backendName == null && this.backend;
      var u2, c = IC(t) ? t.kernelName : this.state.activeScope != null ? this.state.activeScope.name : "";
      if (IC(t)) {
        var f = t.kernelName, h = t.inputs, p = t.attrs;
        this.backendName == null && this.backend;
        var d = Lj(f, this.backendName);
        Yr(d != null, function() {
          return "Cannot find registered kernel '" + f + "' for backend '" + r.backendName + "'";
        }), l = function() {
          var w = r.backend.numDataIds();
          u2 = d.kernelFunc({ inputs: h, attrs: p, backend: r.backend });
          var _4 = Array.isArray(u2) ? u2 : [u2];
          r.shouldCheckForMemLeaks() && r.checkKernelForMemLeak(f, w, _4);
          var k = _4.map(function(A3) {
            if (A3.rank != null) return A3;
            var S3 = A3.dataId, C3 = A3.shape, E3 = A3.dtype;
            return r.makeTensorFromDataId(S3, C3, E3);
          });
          if (o) {
            var T3 = r.getTensorsForGradient(f, h, k);
            a = r.saveTensorsForBackwardMode(T3);
          }
          return k;
        };
      } else {
        var v = t.forwardFunc, m = function(w) {
          !o || (a = w.map(function(_4) {
            return r.keep(r.clone(_4));
          }));
        };
        l = function() {
          var w = r.backend.numDataIds();
          u2 = r.tidy(function() {
            return v(r.backend, m);
          });
          var _4 = Array.isArray(u2) ? u2 : [u2];
          return r.shouldCheckForMemLeaks() && r.checkKernelForMemLeak(c, w, _4), _4;
        };
      }
      var g = t.inputs, x = t.attrs, b = IC(t) ? null : t.backwardsFunc, y;
      return this.scopedRun(function() {
        return r.state.kernelDepth++;
      }, function() {
        return r.state.kernelDepth--;
      }, function() {
        !r.ENV.getBool("DEBUG") && !r.state.profiling ? n = l() : (y = r.profiler.profileKernel(c, g, function() {
          return l();
        }), r.ENV.getBool("DEBUG") && r.profiler.logKernelProfile(y), n = y.outputs);
      }), o && this.addTapeNode(c, g, n, b, a, x), this.state.profiling && this.state.activeProfile.kernels.push({ name: c, bytesAdded: this.state.numBytes - s, totalBytesSnapshot: this.state.numBytes, tensorsAdded: this.state.numTensors - i, totalTensorsSnapshot: this.state.numTensors, inputShapes: Object.keys(g).map(function(w) {
        return g[w] != null ? g[w].shape : null;
      }), outputShapes: n.map(function(w) {
        return w.shape;
      }), kernelTimeMs: y.timeMs, extraInfo: y.extraInfo }), Array.isArray(u2) ? n : n[0];
    }, e.prototype.saveTensorsForBackwardMode = function(t) {
      var r = this, n = t.map(function(a) {
        return r.keep(r.clone(a));
      });
      return n;
    }, e.prototype.getTensorsForGradient = function(t, r, n) {
      var a = Rj(t);
      if (a != null) {
        var o = a.inputsToSave || [], s = a.outputsToSave || [], i = void 0;
        a.saveAllInputs ? (Yr(Array.isArray(r), function() {
          return "saveAllInputs is true, expected inputs to be an array.";
        }), i = Object.keys(r).map(function(u2) {
          return r[u2];
        })) : i = o.map(function(u2) {
          return r[u2];
        });
        var l = n.filter(function(u2, c) {
          return s[c];
        });
        return i.concat(l);
      }
      return [];
    }, e.prototype.makeTensor = function(t, r, n, a) {
      if (t == null) throw new Error("Values passed to engine.makeTensor() are null");
      n = n || "float32", a = a || this.backend;
      var o = t;
      n === "string" && nM(t[0]) && (o = t.map(function(c) {
        return G4e(c);
      }));
      var s = a.write(o, r, n), i = new Pf(r, n, s, this.nextTensorId());
      if (this.trackTensor(i, a), n === "string") {
        var l = this.state.tensorInfo.get(s), u2 = qAe(o);
        this.state.numBytes += u2 - l.bytes, l.bytes = u2;
      }
      return i;
    }, e.prototype.makeTensorFromDataId = function(t, r, n, a) {
      n = n || "float32";
      var o = new Pf(r, n, t, this.nextTensorId());
      return this.trackTensor(o, a), o;
    }, e.prototype.makeVariable = function(t, r, n, a) {
      r === void 0 && (r = true), n = n || this.nextVariableId().toString(), a != null && a !== t.dtype && (t = t.cast(a));
      var o = new qC(t, r, n, this.nextTensorId());
      if (this.state.registeredVariables[o.name] != null) throw new Error("Variable with name " + o.name + " was already registered");
      return this.state.registeredVariables[o.name] = o, this.incRef(o, this.backend), o;
    }, e.prototype.trackTensor = function(t, r) {
      this.state.numTensors++, t.dtype === "string" && this.state.numStringTensors++;
      var n = 0;
      t.dtype !== "complex64" && t.dtype !== "string" && (n = t.size * Cj(t.dtype)), this.state.numBytes += n, this.state.tensorInfo.has(t.dataId) || (this.state.numDataBuffers++, this.state.tensorInfo.set(t.dataId, { backend: r || this.backend, dtype: t.dtype, shape: t.shape, bytes: n })), t instanceof qC || this.track(t);
    }, e.prototype.incRef = function(t, r) {
      this.trackTensor(t, r), this.backend.incRef(t.dataId);
    }, e.prototype.removeDataId = function(t, r) {
      this.state.tensorInfo.has(t) && this.state.tensorInfo.get(t).backend === r && (this.state.tensorInfo.delete(t), this.state.numDataBuffers--);
    }, e.prototype.disposeTensor = function(t) {
      if (!!this.state.tensorInfo.has(t.dataId)) {
        var r = this.state.tensorInfo.get(t.dataId);
        if (this.state.numTensors--, t.dtype === "string" && (this.state.numStringTensors--, this.state.numBytes -= r.bytes), t.dtype !== "complex64" && t.dtype !== "string") {
          var n = t.size * Cj(t.dtype);
          this.state.numBytes -= n;
        }
        r.backend.disposeData(t.dataId) && this.removeDataId(t.dataId, r.backend);
      }
    }, e.prototype.disposeVariables = function() {
      for (var t in this.state.registeredVariables) {
        var r = this.state.registeredVariables[t];
        this.disposeVariable(r);
      }
    }, e.prototype.disposeVariable = function(t) {
      this.disposeTensor(t), this.state.registeredVariables[t.name] != null && delete this.state.registeredVariables[t.name];
    }, e.prototype.memory = function() {
      var t = this.backend.memory();
      return t.numTensors = this.state.numTensors, t.numDataBuffers = this.state.numDataBuffers, t.numBytes = this.state.numBytes, this.state.numStringTensors > 0 && (t.unreliable = true, t.reasons == null && (t.reasons = []), t.reasons.push("Memory usage by string tensors is approximate (2 bytes per character)")), t;
    }, e.prototype.profile = function(t) {
      return Ps(this, void 0, void 0, function() {
        var r, n, a, o, s, i, l, u2, c, f, h;
        return ws(this, function(p) {
          switch (p.label) {
            case 0:
              return this.state.profiling = true, r = this.state.numBytes, n = this.state.numTensors, this.state.activeProfile.kernels = [], a = this.state.activeProfile, [4, t()];
            case 1:
              a.result = p.sent(), this.state.profiling = false, this.state.activeProfile.peakBytes = Math.max.apply(Math, Sc(this.state.activeProfile.kernels.map(function(d) {
                return d.totalBytesSnapshot;
              }))), this.state.activeProfile.newBytes = this.state.numBytes - r, this.state.activeProfile.newTensors = this.state.numTensors - n, p.label = 2;
            case 2:
              p.trys.push([2, 8, 9, 10]), o = zk(this.state.activeProfile.kernels), s = o.next(), p.label = 3;
            case 3:
              return s.done ? [3, 7] : (i = s.value, l = i, [4, i.kernelTimeMs]);
            case 4:
              return l.kernelTimeMs = p.sent(), u2 = i, [4, i.extraInfo];
            case 5:
              u2.extraInfo = p.sent(), p.label = 6;
            case 6:
              return s = o.next(), [3, 3];
            case 7:
              return [3, 10];
            case 8:
              return c = p.sent(), f = { error: c }, [3, 10];
            case 9:
              try {
                s && !s.done && (h = o.return) && h.call(o);
              } finally {
                if (f) throw f.error;
              }
              return [7];
            case 10:
              return [2, this.state.activeProfile];
          }
        });
      });
    }, e.prototype.isTapeOn = function() {
      return this.state.gradientDepth > 0 && this.state.kernelDepth === 0;
    }, e.prototype.addTapeNode = function(t, r, n, a, o, s) {
      var i = this, l = { id: this.state.nextTapeNodeId++, kernelName: t, inputs: r, outputs: n, saved: o }, u2 = Rj(t);
      u2 != null && (a = u2.gradFunc), a != null && (l.gradient = function(c) {
        return c = c.map(function(f, h) {
          if (f == null) {
            var p = n[h], d = oM(p.size, p.dtype);
            return i.makeTensor(d, p.shape, p.dtype);
          }
          return f;
        }), a(c.length > 1 ? c : c[0], o, s);
      }), this.state.activeTape.push(l);
    }, e.prototype.keep = function(t) {
      return t.kept = true, t;
    }, e.prototype.startTape = function() {
      this.state.gradientDepth === 0 && (this.state.activeTape = []), this.state.gradientDepth++;
    }, e.prototype.endTape = function() {
      this.state.gradientDepth--;
    }, e.prototype.startScope = function(t) {
      var r = { track: [], name: "unnamed scope", id: this.state.nextScopeId++ };
      t && (r.name = t), this.state.scopeStack.push(r), this.state.activeScope = r;
    }, e.prototype.endScope = function(t) {
      for (var r = this, n = kW(t), a = new Set(n.map(function(l) {
        return l.id;
      })), o = 0; o < this.state.activeScope.track.length; o++) {
        var s = this.state.activeScope.track[o];
        !s.kept && !a.has(s.id) && s.dispose();
      }
      var i = this.state.scopeStack.pop();
      this.state.activeScope = this.state.scopeStack.length === 0 ? null : this.state.scopeStack[this.state.scopeStack.length - 1], n.forEach(function(l) {
        !l.kept && l.scopeId === i.id && r.track(l);
      });
    }, e.prototype.gradients = function(t, r, n, a) {
      var o = this;
      if (a === void 0 && (a = false), Yr(r.length > 0, function() {
        return "gradients() received an empty list of xs.";
      }), n != null && n.dtype !== "float32") throw new Error("dy must have 'float32' dtype, but has '" + n.dtype + "'");
      var s = this.scopedRun(function() {
        return o.startTape();
      }, function() {
        return o.endTape();
      }, function() {
        return o.tidy("forward", t);
      });
      Yr(s instanceof Pf, function() {
        return "The result y returned by f() must be a tensor.";
      });
      var i = X4e(this.state.activeTape, r, s);
      if (!a && i.length === 0 && r.length > 0) throw new Error("Cannot compute gradient of y=f(x) with respect to x. Make sure that the f you passed encloses all operations that lead from x to y.");
      return this.tidy("backward", function() {
        var l = {};
        l[s.id] = n ?? a5e(s.shape), K4e(l, i, function(c) {
          return o.tidy(c);
        }, o5e);
        var u2 = r.map(function(c) {
          return l[c.id];
        });
        return o.state.gradientDepth === 0 && (o.state.activeTape.forEach(function(c) {
          var f, h;
          try {
            for (var p = zk(c.saved), d = p.next(); !d.done; d = p.next()) {
              var v = d.value;
              v.dispose();
            }
          } catch (m) {
            f = { error: m };
          } finally {
            try {
              d && !d.done && (h = p.return) && h.call(p);
            } finally {
              if (f) throw f.error;
            }
          }
        }), o.state.activeTape = null), { value: s, grads: u2 };
      });
    }, e.prototype.customGrad = function(t) {
      var r = this;
      return Yr(Mj(t), function() {
        return "The f passed in customGrad(f) must be a function.";
      }), function() {
        for (var n = [], a = 0; a < arguments.length; a++) n[a] = arguments[a];
        Yr(n.every(function(u2) {
          return u2 instanceof Pf;
        }), function() {
          return "The args passed in customGrad(f)(x1, x2,...) must all be tensors";
        });
        var o, s = {};
        n.forEach(function(u2, c) {
          s[c] = u2;
        });
        var i = function(u2, c) {
          return o = t.apply(void 0, Sc(n, [c])), Yr(o.value instanceof Pf, function() {
            return "The function f passed in customGrad(f) must return an object where `obj.value` is a tensor";
          }), Yr(Mj(o.gradFunc), function() {
            return "The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function.";
          }), o.value;
        }, l = function(u2, c) {
          var f = o.gradFunc(u2, c), h = Array.isArray(f) ? f : [f];
          Yr(h.length === n.length, function() {
            return "The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns the same number of tensors as inputs passed to f(...).";
          }), Yr(h.every(function(d) {
            return d instanceof Pf;
          }), function() {
            return "The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns a list of only tensors.";
          });
          var p = {};
          return h.forEach(function(d, v) {
            p[v] = function() {
              return d;
            };
          }), p;
        };
        return r.runKernelFunc({ forwardFunc: i, backwardsFunc: l, inputs: s });
      };
    }, e.prototype.readSync = function(t) {
      var r = this.state.tensorInfo.get(t);
      return r.backend.readSync(t);
    }, e.prototype.read = function(t) {
      var r = this.state.tensorInfo.get(t);
      return r.backend.read(t);
    }, e.prototype.readToGPU = function(t, r) {
      var n = this.state.tensorInfo.get(t);
      return n.backend.readToGPU(t, r);
    }, e.prototype.time = function(t) {
      return Ps(this, void 0, void 0, function() {
        var r, n;
        return ws(this, function(a) {
          switch (a.label) {
            case 0:
              return r = Vk(), [4, this.backend.time(t)];
            case 1:
              return n = a.sent(), n.wallMs = Vk() - r, [2, n];
          }
        });
      });
    }, e.prototype.track = function(t) {
      return this.state.activeScope != null && (t.scopeId = this.state.activeScope.id, this.state.activeScope.track.push(t)), t;
    }, Object.defineProperty(e.prototype, "registeredVariables", { get: function() {
      return this.state.registeredVariables;
    }, enumerable: true, configurable: true }), e.prototype.reset = function() {
      this.pendingBackendInitId++, this.state.dispose(), this.ENV.reset(), this.state = new qj();
      for (var t in this.registry) this.disposeRegisteredKernels(t), this.registry[t].dispose(), delete this.registry[t];
      this.backendName = null, this.backendInstance = null, this.pendingBackendInit = null;
    }, e;
  }();
  cM.nextTensorId = 0;
  cM.nextVariableId = 0;
  function a5e(e) {
    var t = sW(lh(e), "float32");
    return fn.makeTensor(t, e, "float32");
  }
  function i5e() {
    var e = fW();
    if (e._tfengine == null) {
      var t = new YAe(e);
      e._tfengine = new cM(t);
    }
    return eSe(e._tfengine.ENV), J4e(function() {
      return e._tfengine;
    }), e._tfengine;
  }
  var fn = i5e();
  function o5e(e, t) {
    var r = { a: e, b: t };
    return fn.runKernel(hW, r);
  }
  function Fv(e, t) {
    var r = e;
    if (qd(e)) return t === "string" ? [] : [e.length];
    if (!Array.isArray(e)) return [];
    for (var n = []; Array.isArray(r) || qd(r) && t !== "string"; ) n.push(r.length), r = r[0];
    return Array.isArray(e) && vp().getBool("TENSORLIKE_CHECK_SHAPE_CONSISTENCY") && AW(e, n, []), n;
  }
  function AW(e, t, r) {
    if (r = r || [], !Array.isArray(e) && !qd(e)) {
      Yr(t.length === 0, function() {
        return "Element arr[" + r.join("][") + "] is a primitive, " + ("but should be an array/TypedArray of " + t[0] + " elements");
      });
      return;
    }
    Yr(t.length > 0, function() {
      return "Element arr[" + r.join("][") + "] should be a primitive, " + ("but is an array of " + e.length + " elements");
    }), Yr(e.length === t[0], function() {
      return "Element arr[" + r.join("][") + "] should have " + t[0] + " " + ("elements, but has " + e.length + " elements");
    });
    for (var n = t.slice(1), a = 0; a < e.length; ++a) AW(e[a], n, r.concat(a));
  }
  function Xj(e, t, r, n) {
    if (e !== "string_or_numeric") {
      if (e == null) throw new Error("Expected dtype cannot be null.");
      if (e !== "numeric" && e !== t || e === "numeric" && t === "string") throw new Error("Argument '" + r + "' passed to '" + n + "' must " + ("be " + e + " tensor, but got " + t + " tensor"));
    }
  }
  function gr(e, t, r, n) {
    if (n === void 0 && (n = "numeric"), e instanceof Pf) return Xj(n, e.dtype, t, r), e;
    var a = aM(e);
    if (a !== "string" && ["bool", "int32", "float32"].indexOf(n) >= 0 && (a = n), Xj(n, a, t, r), e == null || !qd(e) && !Array.isArray(e) && typeof e != "number" && typeof e != "boolean" && typeof e != "string") {
      var o = e == null ? "null" : e.constructor.name;
      throw new Error("Argument '" + t + "' passed to '" + r + "' must be a " + ("Tensor or TensorLike, but got '" + o + "'"));
    }
    var s = Fv(e, a);
    !qd(e) && !Array.isArray(e) && (e = [e]);
    var i = true, l = a !== "string" ? _W(e, a) : Zk(e, [], i);
    return fn.makeTensor(l, s, a);
  }
  function jk(e, t, r, n) {
    if (n === void 0 && (n = "numeric"), !Array.isArray(e)) throw new Error("Argument " + t + " passed to " + r + " must be a `Tensor[]` or `TensorLike[]`");
    var a = e;
    return a.map(function(o, s) {
      return gr(o, t + "[" + s + "]", r, n);
    });
  }
  var SW = "__op";
  function Kr(e) {
    var t = Object.keys(e);
    if (t.length !== 1) throw new Error("Please provide an object with a single key (operation name) mapping to a function. Got an object with " + (t.length + " keys."));
    var r = t[0], n = e[r];
    r.endsWith("_") && (r = r.substring(0, r.length - 1)), r = r + SW;
    var a = function() {
      for (var o = [], s = 0; s < arguments.length; s++) o[s] = arguments[s];
      fn.startScope(r);
      try {
        var i = n.apply(void 0, Sc(o));
        return uW(i) && console.error("Cannot return a Promise inside of tidy."), fn.endScope(i), i;
      } catch (l) {
        throw fn.endScope(null), l;
      }
    };
    return Object.defineProperty(a, "name", { value: r, configurable: true }), a;
  }
  function s5e(e) {
    var t = gr(e, "x", "abs");
    if (t.dtype === "complex64") {
      var r = { x: t };
      return fn.runKernel(TSe, r);
    } else {
      var r = { x: t };
      return fn.runKernel(rSe, r);
    }
  }
  var Oh = Kr({ abs_: s5e });
  function l5e(e) {
    var t = gr(e, "x", "acos"), r = { x: t };
    return fn.runKernel(nSe, r);
  }
  var EW = Kr({ acos_: l5e });
  function u5e(e) {
    var t = gr(e, "x", "acosh"), r = { x: t };
    return fn.runKernel(aSe, r);
  }
  var DW = Kr({ acosh_: u5e });
  function c5e(e, t) {
    var r, n = gr(e, "a", "add"), a = gr(t, "b", "add");
    r = ni(su(n, a), 2), n = r[0], a = r[1];
    var o = { a: n, b: a };
    return fn.runKernel(hW, o);
  }
  var qu = Kr({ add_: c5e });
  function f5e(e) {
    Yr(Array.isArray(e), function() {
      return "The argument passed to tf.addN() must be a list of tensors";
    }), Yr(e.length >= 1, function() {
      return "Must pass at least one tensor to tf.addN(), but got " + ("" + e.length);
    });
    var t = e.map(function(a, o) {
      return gr(a, "tensors" + o, "addN");
    }), r = t[0];
    t.forEach(function(a) {
      if (a.dtype !== r.dtype) throw new Error("All tensors passed to tf.addN() must have the same dtype");
    }), t.forEach(function(a) {
      if (!Ny(a.shape, r.shape)) throw new Error("All tensors passed to tf.addN() must have the same shape");
    });
    var n = t;
    return fn.runKernel(iSe, n);
  }
  var CW = Kr({ addN_: f5e });
  function h5e(e, t, r) {
    t === void 0 && (t = null), r === void 0 && (r = false);
    var n = gr(e, "x", "all", "bool"), a = { x: n }, o = { axis: t, keepDims: r };
    return fn.runKernel(oSe, a, o);
  }
  var MW = Kr({ all_: h5e });
  function p5e(e, t, r) {
    t === void 0 && (t = null), r === void 0 && (r = false);
    var n = gr(e, "x", "any", "bool"), a = { x: n }, o = { axis: t, keepDims: r };
    return fn.runKernel(sSe, a, o);
  }
  var IW = Kr({ any_: p5e });
  function d5e(e, t) {
    t === void 0 && (t = 0);
    var r = gr(e, "x", "argMax"), n = { x: r }, a = { axis: t };
    return fn.runKernel(lSe, n, a);
  }
  var NW = Kr({ argMax_: d5e });
  function v5e(e, t) {
    t === void 0 && (t = 0);
    var r = gr(e, "x", "argMin"), n = { x: r }, a = { axis: t };
    return fn.runKernel(uSe, n, a);
  }
  var FW = Kr({ argMin_: v5e });
  function m5e(e) {
    var t = gr(e, "x", "asin"), r = { x: t };
    return fn.runKernel(cSe, r);
  }
  var OW = Kr({ asin_: m5e });
  function g5e(e) {
    var t = gr(e, "x", "asinh"), r = { x: t };
    return fn.runKernel(fSe, r);
  }
  var PW = Kr({ asinh_: g5e });
  function y5e(e) {
    var t = gr(e, "x", "atan"), r = { x: t };
    return fn.runKernel(hSe, r);
  }
  var LW = Kr({ atan_: y5e });
  function x5e(e, t) {
    var r, n = gr(e, "a", "atan2"), a = gr(t, "b", "atan2");
    r = ni(su(n, a), 2), n = r[0], a = r[1];
    var o = { a: n, b: a };
    return fn.runKernel(dSe, o);
  }
  var RW = Kr({ atan2_: x5e });
  function b5e(e) {
    var t = gr(e, "x", "atanh"), r = { x: t };
    return fn.runKernel(pSe, r);
  }
  var zW = Kr({ atanh_: b5e });
  function _5e(e, t) {
    var r = gr(e, "x", "cast");
    if (!HAe(t)) throw new Error("Failed to cast to unknown dtype " + t);
    if (t === "string" && r.dtype !== "string" || t !== "string" && r.dtype === "string") throw new Error("Only strings can be casted to strings");
    var n = { x: r }, a = { dtype: t };
    return fn.runKernel(pW, n, a);
  }
  var ou = Kr({ cast_: _5e });
  function w5e(e, t, r, n, a, o, s) {
    s === void 0 && (s = "channelsLast");
    var i = ni(Wk(t), 2), l = i[0], u2 = i[1], c;
    if (s === "channelsLast") c = [l, u2, e[3], e[3]];
    else if (s === "channelsFirst") c = [l, u2, e[1], e[1]];
    else throw new Error("Unknown dataFormat " + s);
    return fM(e, c, r, n, a, o, false, s);
  }
  function fM(e, t, r, n, a, o, s, i) {
    var l, u2;
    s === void 0 && (s = false), i === void 0 && (i = "channelsLast");
    var c = ni([-1, -1, -1, -1], 4), f = c[0], h = c[1], p = c[2], d = c[3];
    if (i === "channelsLast") l = ni(e, 4), f = l[0], h = l[1], p = l[2], d = l[3];
    else if (i === "channelsFirst") u2 = ni(e, 4), f = u2[0], d = u2[1], h = u2[2], p = u2[3];
    else throw new Error("Unknown dataFormat " + i);
    var v = ni(t, 4), m = v[0], g = v[1], x = v[3], b = ni(Wk(r), 2), y = b[0], w = b[1], _4 = ni(Wk(n), 2), k = _4[0], T3 = _4[1], A3 = JC(m, k), S3 = JC(g, T3), C3 = A5e(a, h, p, y, w, A3, S3, o, i), E3 = C3.padInfo, F13 = C3.outHeight, N3 = C3.outWidth, D3 = s ? x * d : x, I3;
    return i === "channelsFirst" ? I3 = [f, D3, F13, N3] : i === "channelsLast" && (I3 = [f, F13, N3, D3]), { batchSize: f, dataFormat: i, inHeight: h, inWidth: p, inChannels: d, outHeight: F13, outWidth: N3, outChannels: D3, padInfo: E3, strideHeight: y, strideWidth: w, filterHeight: m, filterWidth: g, effectiveFilterHeight: A3, effectiveFilterWidth: S3, dilationHeight: k, dilationWidth: T3, inShape: e, outShape: I3, filterShape: t };
  }
  function k5e(e, t, r, n, a) {
    n == null && (n = T5e(e, t, r));
    var o = e[0], s = e[1], i = Gk((o - t + 2 * n) / r + 1, a), l = Gk((s - t + 2 * n) / r + 1, a);
    return [i, l];
  }
  function T5e(e, t, r, n) {
    n === void 0 && (n = 1);
    var a = JC(t, n);
    return Math.floor((e[0] * (r - 1) - r + a) / 2);
  }
  function Wk(e) {
    return typeof e == "number" ? [e, e, e] : e.length === 2 ? [e[0], e[1], 1] : e;
  }
  function JC(e, t) {
    return t <= 1 ? e : e + (e - 1) * (t - 1);
  }
  function A5e(e, t, r, n, a, o, s, i, l) {
    var u2, c, f;
    if (typeof e == "number") {
      var h = e === 0 ? "VALID" : "NUMBER";
      u2 = { top: e, bottom: e, left: e, right: e, type: h };
      var p = k5e([t, r], o, n, e, i);
      c = p[0], f = p[1];
    } else if (e === "same") {
      c = Math.ceil(t / n), f = Math.ceil(r / a);
      var d = Math.max(0, (c - 1) * n + o - t), v = Math.max(0, (f - 1) * a + s - r), m = Math.floor(d / 2), g = d - m, x = Math.floor(v / 2), b = v - x;
      u2 = { top: m, bottom: g, left: x, right: b, type: "SAME" };
    } else if (e === "valid") u2 = { top: 0, bottom: 0, left: 0, right: 0, type: "VALID" }, c = Math.ceil((t - o + 1) / n), f = Math.ceil((r - s + 1) / a);
    else if (typeof e == "object") {
      var m = l === "channelsLast" ? e[1][0] : e[2][0], g = l === "channelsLast" ? e[1][1] : e[2][1], x = l === "channelsLast" ? e[2][0] : e[3][0], b = l === "channelsLast" ? e[2][1] : e[3][1], h = m === 0 && g === 0 && x === 0 && b === 0 ? "VALID" : "EXPLICIT";
      u2 = { top: m, bottom: g, left: x, right: b, type: h }, c = Gk((t - o + m + g) / n + 1, i), f = Gk((r - s + x + b) / a + 1, i);
    } else throw Error("Unknown padding parameter: " + e);
    return { padInfo: u2, outHeight: c, outWidth: f };
  }
  function Gk(e, t) {
    if (!t) return Math.trunc(e);
    switch (t) {
      case "round":
        return Math.round(e);
      case "ceil":
        return Math.ceil(e);
      case "floor":
        return Math.floor(e);
      default:
        throw new Error("Unknown roundingMode " + t);
    }
  }
  function $k(e) {
    var t = ni(Wk(e), 3), r = t[0], n = t[1], a = t[2];
    return r === 1 && n === 1 && a === 1;
  }
  function Ov(e, t) {
    return $k(e) || $k(t);
  }
  function hd(e, t, r) {
    if (r != null) {
      if (typeof t == "string") throw Error("Error in " + e + ": pad must be an integer when using " + ("dimRoundingMode " + r + " but got pad " + t + "."));
      if (typeof t == "number") Yr(D2(t), function() {
        return "Error in " + e + ": pad must be an integer when using " + ("dimRoundingMode " + r + " but got pad " + t + ".");
      });
      else if (typeof t == "object") t.forEach(function(n) {
        n.forEach(function(a) {
          Yr(D2(a), function() {
            return "Error in " + e + ": pad must be an integer when using " + ("dimRoundingMode " + r + " but got pad " + a + ".");
          });
        });
      });
      else throw Error("Error in " + e + ": Unknown padding parameter: " + t);
    }
  }
  function S5e(e, t) {
    var r = gr(e, "x", "reshape", "string_or_numeric"), n = { x: r }, a = { shape: t };
    return fn.runKernel(KEe, n, a);
  }
  var da = Kr({ reshape_: S5e });
  function E5e(e, t, r, n, a) {
    var o = gr(e, "x", "avgPool", "float32"), s = 1;
    Yr(Ov(r, s), function() {
      return "Error in avgPool: Either strides or dilations must be 1. " + ("Got strides " + r + " and dilations '" + s + "'");
    });
    var i = o, l = false;
    o.rank === 3 && (l = true, i = da(o, [1, o.shape[0], o.shape[1], o.shape[2]])), Yr(i.rank === 4, function() {
      return "Error in avgPool: x must be rank 4 but got rank " + i.rank + ".";
    }), hd("avgPool", n, a);
    var u2 = { x: i }, c = { filterSize: t, strides: r, pad: n, dimRoundingMode: a }, f = fn.runKernel(vSe, u2, c);
    return f = ou(f, o.dtype), l ? da(f, [f.shape[1], f.shape[2], f.shape[3]]) : f;
  }
  var hM = Kr({ avgPool_: E5e });
  function D5e(e, t, r, n, a, o) {
    o === void 0 && (o = "NDHWC");
    var s = gr(e, "x", "avgPool3d", "float32"), i = s, l = false;
    s.rank === 4 && (l = true, i = da(s, [1, s.shape[0], s.shape[1], s.shape[2], s.shape[3]])), Yr(i.rank === 5, function() {
      return "Error in avgPool3d: x must be rank 5 but got rank " + i.rank + ".";
    }), Yr(o === "NDHWC", function() {
      return "Error in avgPool3d: Only NDHWC is currently supported, " + ("but got dataFormat of " + o);
    }), hd("avgPool3d", n, a);
    var u2 = { x: i }, c = { filterSize: t, strides: r, pad: n, dimRoundingMode: a, dataFormat: o }, f = fn.runKernel(mSe, u2, c);
    return f = ou(f, i.dtype), l ? da(f, [f.shape[1], f.shape[2], f.shape[3], f.shape[4]]) : f;
  }
  var BW = Kr({ avgPool3d_: D5e });
  function C5e(e) {
    var t = gr(e, "x", "clone", "string_or_numeric"), r = { x: t };
    return fn.runKernel(dW, r);
  }
  var wy = Kr({ clone_: C5e });
  function M5e(e, t) {
    t === void 0 && (t = 0), Yr(e.length >= 1, function() {
      return "Pass at least one tensor to concat";
    });
    var r = jk(e, "tensors", "concat", "string_or_numeric");
    if (r[0].dtype === "complex64" && r.forEach(function(o) {
      if (o.dtype !== "complex64") throw new Error(`Cannot concatenate complex64 tensors with a tensor
          with dtype ` + o.dtype + ". ");
    }), r.length === 1) return wy(r[0]);
    var n = r, a = { axis: t };
    return fn.runKernel(ASe, n, a);
  }
  var Rf = Kr({ concat_: M5e });
  function I5e(e, t, r, n) {
    var a;
    r === void 0 && (r = false), n === void 0 && (n = false);
    var o = gr(e, "a", "matMul"), s = gr(t, "b", "matMul");
    a = ni(su(o, s), 2), o = a[0], s = a[1];
    var i = { a: o, b: s }, l = { transposeA: r, transposeB: n };
    return fn.runKernel(gSe, i, l);
  }
  var _s = Kr({ matMul_: I5e });
  function N5e(e, t) {
    var r, n = gr(e, "a", "mul"), a = gr(t, "b", "mul");
    r = ni(su(n, a), 2), n = r[0], a = r[1];
    var o = { a: n, b: a };
    return fn.runKernel(NEe, o);
  }
  var oo = Kr({ mul_: N5e });
  function F5e(e) {
    var t = gr(e, "x", "sigmoid", "float32"), r = { x: t };
    return fn.runKernel(u4e, r);
  }
  var og = Kr({ sigmoid_: F5e });
  function O5e(e, t, r) {
    var n = gr(e, "x", "slice", "string_or_numeric");
    if (n.rank === 0) throw new Error("Slicing scalar is not possible");
    var a = { x: n }, o = { begin: t, size: r };
    return fn.runKernel(i4e, a, o);
  }
  var bl = Kr({ slice_: O5e });
  function P5e(e) {
    var t = gr(e, "x", "tanh", "float32"), r = { x: t };
    return fn.runKernel(D4e, r);
  }
  var Hk = Kr({ tanh_: P5e });
  function L5e(e, t, r, n, a, o) {
    var s = gr(e, "forgetBias", "basicLSTMCell"), i = gr(t, "lstmKernel", "basicLSTMCell"), l = gr(r, "lstmBias", "basicLSTMCell"), u2 = gr(n, "data", "basicLSTMCell"), c = gr(a, "c", "basicLSTMCell"), f = gr(o, "h", "basicLSTMCell"), h = Rf([u2, f], 1), p = _s(h, i), d = qu(p, l), v = d.shape[0], m = d.shape[1] / 4, g = [v, m], x = bl(d, [0, 0], g), b = bl(d, [0, m], g), y = bl(d, [0, m * 2], g), w = bl(d, [0, m * 3], g), _4 = qu(oo(og(x), Hk(b)), oo(c, og(qu(s, y)))), k = oo(Hk(_4), og(w));
    return [_4, k];
  }
  var R5e = Kr({ basicLSTMCell_: L5e });
  function z5e(e, t, r) {
    var n = gr(e, "x", "batchToSpaceND"), a = t.reduce(function(i, l) {
      return i * l;
    });
    Yr(n.rank >= 1 + t.length, function() {
      return "input rank is " + n.rank + " but should be > than blockShape.length " + t.length;
    }), Yr(r.length === t.length, function() {
      return "crops.length is " + r.length + " but should be equal to blockShape.length  " + t.length;
    }), Yr(n.shape[0] % a === 0, function() {
      return "input tensor batch is " + n.shape[0] + " but is not divisible by the product of " + ("the elements of blockShape " + t.join(" * ") + " === " + a);
    });
    var o = { x: n }, s = { blockShape: t, crops: r };
    return fn.runKernel(ySe, o, s);
  }
  var pM = Kr({ batchToSpaceND_: z5e });
  function B5e(e) {
    var t;
    return e.rank === 0 || e.rank === 1 ? t = da(e, [1, 1, 1, e.size]) : e.rank === 2 ? t = da(e, [1, 1, e.shape[0], e.shape[1]]) : e.rank === 3 ? t = da(e, [1, e.shape[0], e.shape[1], e.shape[2]]) : t = e, t;
  }
  function U5e(e, t, r, n, a, o) {
    o == null && (o = 1e-3);
    var s = gr(e, "x", "batchNorm"), i = gr(t, "mean", "batchNorm"), l = gr(r, "variance", "batchNorm"), u2;
    a != null && (u2 = gr(a, "scale", "batchNorm"));
    var c;
    n != null && (c = gr(n, "offset", "batchNorm")), Yr(i.rank === l.rank, function() {
      return "Batch normalization gradient requires mean and variance to have equal ranks.";
    }), Yr(c == null || i.rank === c.rank, function() {
      return "Batch normalization gradient requires mean and offset to have equal ranks.";
    }), Yr(u2 == null || i.rank === u2.rank, function() {
      return "Batch normalization gradient requires mean and scale to have equal ranks.";
    });
    var f = B5e(s), h = { x: f, scale: u2, offset: c, mean: i, variance: l }, p = { varianceEpsilon: o }, d = fn.runKernel(tEe, h, p);
    return da(d, s.shape);
  }
  var Ay = Kr({ batchNorm_: U5e });
  function V5e(e, t, r, n, a, o) {
    var s = gr(e, "x", "batchNorm"), i = gr(t, "mean", "batchNorm"), l = gr(r, "variance", "batchNorm"), u2;
    a != null && (u2 = gr(a, "scale", "batchNorm"));
    var c;
    return n != null && (c = gr(n, "offset", "batchNorm")), Yr(s.rank === 2, function() {
      return "Error in batchNorm2D: x must be rank 2 but got rank " + (s.rank + ".");
    }), Yr(i.rank === 2 || i.rank === 1, function() {
      return "Error in batchNorm2D: mean must be rank 2 or rank 1 but " + ("got rank " + i.rank + ".");
    }), Yr(l.rank === 2 || l.rank === 1, function() {
      return "Error in batchNorm2D: variance must be rank 2 or rank 1 " + ("but got rank " + l.rank + ".");
    }), u2 != null && Yr(u2.rank === 2 || u2.rank === 1, function() {
      return "Error in batchNorm2D: scale must be rank 2 or rank 1 " + ("but got rank " + u2.rank + ".");
    }), c != null && Yr(c.rank === 2 || c.rank === 1, function() {
      return "Error in batchNorm2D: offset must be rank 2 or rank 1 " + ("but got rank " + c.rank + ".");
    }), Ay(s, i, l, c, u2, o);
  }
  var j5e = Kr({ batchNorm2d_: V5e });
  function W5e(e, t, r, n, a, o) {
    var s = gr(e, "x", "batchNorm"), i = gr(t, "mean", "batchNorm"), l = gr(r, "variance", "batchNorm"), u2;
    a != null && (u2 = gr(a, "scale", "batchNorm"));
    var c;
    return n != null && (c = gr(n, "offset", "batchNorm")), Yr(s.rank === 3, function() {
      return "Error in batchNorm3D: x must be rank 3 but got rank " + (s.rank + ".");
    }), Yr(i.rank === 3 || i.rank === 1, function() {
      return "Error in batchNorm3D: mean must be rank 3 or rank 1 but " + ("got rank " + i.rank + ".");
    }), Yr(l.rank === 3 || l.rank === 1, function() {
      return "Error in batchNorm3D: variance must be rank 3 or rank 1 " + ("but got rank " + l.rank + ".");
    }), u2 != null && Yr(u2.rank === 3 || u2.rank === 1, function() {
      return "Error in batchNorm3D: scale must be rank 3 or rank 1 " + ("but got rank " + u2.rank + ".");
    }), c != null && Yr(c.rank === 3 || c.rank === 1, function() {
      return "Error in batchNorm3D: offset must be rank 3 or rank 1 " + ("but got rank " + c.rank + ".");
    }), Ay(s, i, l, c, u2, o);
  }
  var G5e = Kr({ batchNorm3d_: W5e });
  function $5e(e, t, r, n, a, o) {
    var s = gr(e, "x", "batchNorm"), i = gr(t, "mean", "batchNorm"), l = gr(r, "variance", "batchNorm"), u2;
    a != null && (u2 = gr(a, "scale", "batchNorm"));
    var c;
    return n != null && (c = gr(n, "offset", "batchNorm")), Yr(s.rank === 4, function() {
      return "Error in batchNorm4D: x must be rank 4 but got rank " + (s.rank + ".");
    }), Yr(i.rank === 4 || i.rank === 1, function() {
      return "Error in batchNorm4D: mean must be rank 4 or rank 1 but " + ("got rank " + i.rank + ".");
    }), Yr(l.rank === 4 || l.rank === 1, function() {
      return "Error in batchNorm4D: variance must be rank 4 or rank 1 " + ("but got rank " + l.rank + ".");
    }), u2 != null && Yr(u2.rank === 4 || u2.rank === 1, function() {
      return "Error in batchNorm4D: scale must be rank 4 or rank 1 " + ("but got rank " + u2.rank + ".");
    }), c != null && Yr(c.rank === 4 || c.rank === 1, function() {
      return "Error in batchNorm4D: offset must be rank 4 or rank 1 " + ("but got rank " + c.rank + ".");
    }), Ay(s, i, l, c, u2, o);
  }
  var H5e = Kr({ batchNorm4d_: $5e });
  function q5e(e, t, r) {
    var n = gr(e, "x", "bincount"), a = gr(t, "weights", "bincount");
    Yr(n.dtype === "int32", function() {
      return "Error in bincount: input " + ("dtype must be int32, but got " + n.dtype);
    }), Yr(r >= 0, function() {
      return "size must be non-negative, but got " + r + ".";
    }), Yr(a.size === n.size || a.size === 0, function() {
      return "Error in bincount: weights must have the same size as input or" + ("0-length, but got input shape: " + n.shape + ", weights shape: ") + (a.shape + ".");
    });
    var o = { x: n, weights: a }, s = { size: r };
    return fn.runKernel(xSe, o, s);
  }
  var dM = Kr({ bincount_: q5e });
  function X5e(e, t) {
    var r = gr(e, "s0", "broadcastArgs", "int32"), n = gr(t, "s1", "broadcastArgs", "int32");
    if (r.rank !== 1) throw new Error("broadcastArgs(): first input must be a vector (rank=1). " + ("Has rank " + r.rank));
    if (n.rank !== 1) throw new Error("broadcastArgs(): second input must be a vector (rank=1). " + ("Has rank " + n.rank));
    var a = { s0: r, s1: n };
    return fn.runKernel(bSe, a);
  }
  var UW = Kr({ broadcastArgs_: X5e });
  function K5e(e, t) {
    var r = gr(e, "broadcastTo", "x"), n = r.shape;
    if (t.some(function(f) {
      return !(f > 0) || f % 1 !== 0;
    })) throw new Error("broadcastTo(): Invalid broadcast shape [" + t + "].");
    if (t.length < r.rank) throw new Error("broadcastTo(): shape.length=" + t.length + " < input.rank=" + r.rank + ".");
    if (t.length > r.rank) {
      for (var a = r.shape.slice(); a.length < t.length; ) a.unshift(1);
      r = da(r, a);
    }
    for (var o = r.shape, s = Array.from(t), i = t.length - 1; i >= 0; i--) if (o[i] === t[i]) s[i] = 1;
    else if (r.shape[i] !== 1) throw new Error("broadcastTo(): [" + n + "] cannot be broadcast to [" + t + "].");
    var l = s.map(function(f, h) {
      return f > 1 ? h : -1;
    }).filter(function(f) {
      return f >= 0;
    });
    if (l.length === 0) return wy(r);
    var u2 = { x: r }, c = { reps: s };
    return fn.runKernel(vW, u2, c);
  }
  var S2 = Kr({ broadcastTo_: K5e });
  function Iv(e, t, r) {
    return t === void 0 && (t = "float32"), t = t || "float32", lW(e), new HC(e, t, r);
  }
  function Y5e(e) {
    var t = gr(e, "x", "ceil", "float32"), r = { x: t };
    return fn.runKernel(_Se, r);
  }
  var VW = Kr({ ceil_: Y5e });
  function Z5e(e, t, r) {
    var n = gr(e, "x", "clipByValue");
    Yr(t <= r, function() {
      return "Error in clip: min (" + t + ") must be " + ("less than or equal to max (" + r + ").");
    });
    var a = { x: n }, o = { clipValueMin: t, clipValueMax: r };
    return fn.runKernel(wSe, a, o);
  }
  var jW = Kr({ clipByValue_: Z5e });
  function J5e(e, t) {
    var r = gr(e, "real", "complex"), n = gr(t, "imag", "complex");
    xp(r.shape, n.shape, "real and imag shapes, " + r.shape + " and " + n.shape + ", must match in call to tf.complex().");
    var a = { real: r, imag: n };
    return fn.runKernel(kSe, a);
  }
  var ug = Kr({ complex_: J5e });
  function Q5e(e) {
    return Rf(e, 0);
  }
  var eDe = Kr({ concat1d_: Q5e });
  function tDe(e, t) {
    return Rf(e, t);
  }
  var rDe = Kr({ concat2d_: tDe });
  function nDe(e, t) {
    return Rf(e, t);
  }
  var aDe = Kr({ concat3d_: nDe });
  function iDe(e, t) {
    return Rf(e, t);
  }
  var oDe = Kr({ concat4d_: iDe });
  function sDe(e, t, r, n, a, o, s) {
    a === void 0 && (a = "NHWC"), o === void 0 && (o = [1, 1]);
    var i = gr(e, "x", "conv2d", "float32"), l = gr(t, "filter", "conv2d", "float32"), u2 = i, c = false;
    i.rank === 3 && (c = true, u2 = da(i, [1, i.shape[0], i.shape[1], i.shape[2]])), Yr(u2.rank === 4, function() {
      return "Error in conv2d: input must be rank 4, but got rank " + u2.rank + ".";
    }), Yr(l.rank === 4, function() {
      return "Error in conv2d: filter must be rank 4, but got rank " + (l.rank + ".");
    }), hd("conv2d", n, s);
    var f = a === "NHWC" ? u2.shape[3] : u2.shape[1];
    Yr(f === l.shape[2], function() {
      return "Error in conv2d: depth of input (" + f + ") must match " + ("input depth for filter " + l.shape[2] + ".");
    }), Yr(Ov(r, o), function() {
      return "Error in conv2D: Either strides or dilations must be 1. " + ("Got strides " + r + " and dilations '" + o + "'");
    });
    var h = { x: u2, filter: l }, p = { strides: r, pad: n, dataFormat: a, dilations: o, dimRoundingMode: s }, d = fn.runKernel(SSe, h, p);
    return c ? da(d, [d.shape[1], d.shape[2], d.shape[3]]) : d;
  }
  var F22 = Kr({ conv2d_: sDe });
  function lDe(e, t, r, n, a, o, s) {
    a === void 0 && (a = "NWC"), o === void 0 && (o = 1);
    var i = gr(e, "x", "conv1d"), l = gr(t, "filter", "conv1d"), u2 = i, c = false;
    i.rank === 2 && (c = true, u2 = da(i, [1, i.shape[0], i.shape[1]])), Yr(u2.rank === 3, function() {
      return "Error in conv1d: input must be rank 3, but got rank " + u2.rank + ".";
    }), Yr(l.rank === 3, function() {
      return "Error in conv1d: filter must be rank 3, but got rank " + (l.rank + ".");
    }), hd("conv1d", n, s), Yr(u2.shape[2] === l.shape[1], function() {
      return "Error in conv1d: depth of input (" + u2.shape[2] + ") must match " + ("input depth for filter " + l.shape[1] + ".");
    }), Yr(Ov(r, o), function() {
      return "Error in conv1D: Either stride or dilation must be 1. " + ("Got stride " + r + " and dilation '" + o + "'");
    }), Yr(a === "NWC", function() {
      return "Error in conv1d: got dataFormat of " + a + " but only NWC is currently supported.";
    });
    var f = da(l, [1, l.shape[0], l.shape[1], l.shape[2]]), h = da(u2, [u2.shape[0], 1, u2.shape[1], u2.shape[2]]), p = [1, r], d = [1, o], v = "NHWC", m = F22(h, f, p, n, v, d, s);
    return c ? da(m, [m.shape[2], m.shape[3]]) : da(m, [m.shape[0], m.shape[2], m.shape[3]]);
  }
  var WW = Kr({ conv1d_: lDe });
  function uDe(e, t, r, n, a, o, s) {
    o === void 0 && (o = "NHWC"), Yr(e.length === t.rank, function() {
      return "Length of inShape " + ("(" + e.length + ") and rank of dy (" + t.rank + ") must match");
    });
    var i = e, l = t, u2 = false;
    t.rank === 3 && (u2 = true, l = da(t, [1, t.shape[0], t.shape[1], t.shape[2]]), i = [1, e[0], e[1], e[2]]), Yr(i.length === 4, function() {
      return "Error in conv2dDerInput: inShape must be length 4, but got length " + (i.length + ".");
    }), Yr(l.rank === 4, function() {
      return "Error in conv2dDerInput: dy must be rank 4, but got " + ("rank " + l.rank);
    }), Yr(r.rank === 4, function() {
      return "Error in conv2dDerInput: filter must be rank 4, but got " + ("rank " + r.rank);
    });
    var c = o === "NHWC" ? i[3] : i[1], f = o === "NHWC" ? l.shape[3] : l.shape[1];
    Yr(c === r.shape[2], function() {
      return "Error in conv2dDerInput: depth of input (" + c + ") must " + ("match input depth for filter " + r.shape[2] + ".");
    }), Yr(f === r.shape[3], function() {
      return "Error in conv2dDerInput: depth of output (" + f + ") must " + ("match output depth for filter " + r.shape[3] + ".");
    }), hd("conv2dDerInput", a, s);
    var h = { dy: l, filter: r }, p = { strides: n, pad: a, dataFormat: o, dimRoundingMode: s, inputShape: i }, d = fn.runKernel(DSe, h, p);
    return u2 ? da(d, [d.shape[1], d.shape[2], d.shape[3]]) : d;
  }
  var GW = Kr({ conv2DBackpropInput_: uDe });
  function cDe(e, t, r, n, a, o) {
    var s = gr(e, "x", "conv2dTranspose"), i = gr(t, "filter", "conv2dTranspose");
    return GW(r, s, i, n, a, "NHWC", o);
  }
  var $W = Kr({ conv2dTranspose_: cDe });
  function fDe(e, t, r, n, a, o) {
    a === void 0 && (a = "NDHWC"), o === void 0 && (o = [1, 1, 1]);
    var s = gr(e, "x", "conv3d"), i = gr(t, "filter", "conv3d"), l = s, u2 = false;
    s.rank === 4 && (u2 = true, l = da(s, [1, s.shape[0], s.shape[1], s.shape[2], s.shape[3]])), Yr(l.rank === 5, function() {
      return "Error in conv3d: input must be rank 5, but got rank " + l.rank + ".";
    }), Yr(i.rank === 5, function() {
      return "Error in conv3d: filter must be rank 5, but got rank " + (i.rank + ".");
    }), Yr(l.shape[4] === i.shape[3], function() {
      return "Error in conv3d: depth of input (" + l.shape[4] + ") must match " + ("input depth for filter " + i.shape[3] + ".");
    }), Yr(Ov(r, o), function() {
      return "Error in conv3D: Either strides or dilations must be 1. " + ("Got strides " + r + " and dilations '" + o + "'");
    }), Yr(a === "NDHWC", function() {
      return "Error in conv3d: got dataFormat of " + a + " but only NDHWC is currently supported.";
    });
    var c = { x: l, filter: i }, f = { strides: r, pad: n, dataFormat: a, dilations: o }, h = fn.runKernel(CSe, c, f);
    return u2 ? da(h, [h.shape[1], h.shape[2], h.shape[3], h.shape[4]]) : h;
  }
  var HW = Kr({ conv3d_: fDe });
  function hDe(e, t, r, n, a) {
    Yr(e.length === t.rank, function() {
      return "Length of inShape " + ("(" + e.length + ") and rank of dy (" + t.rank + ") must match");
    });
    var o = e, s = t, i = false;
    t.rank === 4 && (i = true, s = da(t, [1, t.shape[0], t.shape[1], t.shape[2], t.shape[3]]), o = [1, e[0], e[1], e[2], e[3]]);
    var l = o[4], u2 = s.shape[4];
    Yr(o.length === 5, function() {
      return "Error in conv3dDerInput: inShape must be length 5, but got length " + (o.length + ".");
    }), Yr(s.rank === 5, function() {
      return "Error in conv3dDerInput: dy must be rank 5, but got " + ("rank " + s.rank);
    }), Yr(r.rank === 5, function() {
      return "Error in conv3dDerInput: filter must be rank 5, but got " + ("rank " + r.rank);
    }), Yr(l === r.shape[3], function() {
      return "Error in conv3dDerInput: depth of input (" + l + ") must " + ("match input depth for filter " + r.shape[3] + ".");
    }), Yr(u2 === r.shape[4], function() {
      return "Error in conv3dDerInput: depth of output (" + u2 + ") must " + ("match output depth for filter " + r.shape[4] + ".");
    });
    var c = { dy: s, filter: r }, f = { pad: a, strides: n, inputShape: o }, h = fn.runKernel(MSe, c, f);
    return i ? da(h, [h.shape[1], h.shape[2], h.shape[3], h.shape[4]]) : h;
  }
  var pDe = Kr({ conv3DBackpropInput_: hDe });
  function dDe(e, t, r, n, a) {
    var o = gr(e, "x", "conv3dTranspose"), s = gr(t, "filter", "conv3dTranspose");
    return pDe(r, o, s, n, a);
  }
  var vDe = Kr({ conv3dTranspose_: dDe });
  function mDe(e) {
    var t = gr(e, "x", "cos", "float32"), r = { x: t };
    return fn.runKernel(ISe, r);
  }
  var qW = Kr({ cos_: mDe });
  function gDe(e) {
    var t = gr(e, "x", "cosh", "float32"), r = { x: t };
    return fn.runKernel(NSe, r);
  }
  var XW = Kr({ cosh_: gDe });
  function yDe(e, t, r, n) {
    t === void 0 && (t = 0), r === void 0 && (r = false), n === void 0 && (n = false);
    var a = gr(e, "x", "cumsum"), o = { x: a }, s = { axis: t, exclusive: r, reverse: n };
    return fn.runKernel(FSe, o, s);
  }
  var KW = Kr({ cumsum_: yDe });
  function xDe(e, t, r, n) {
    n === void 0 && (n = false);
    var a = gr(e, "x", "denseBincount"), o = gr(t, "weights", "denseBincount");
    Yr(a.dtype === "int32", function() {
      return "Error in denseBincount: input " + ("dtype must be int32, but got " + a.dtype);
    }), Yr(a.rank <= 2, function() {
      return "Error in denseBincount: input must be at most rank 2, but got " + ("rank " + a.rank + ".");
    }), Yr(r >= 0, function() {
      return "size must be non-negative, but got " + r + ".";
    }), Yr(o.size === a.size || o.size === 0, function() {
      return "Error in denseBincount: weights must have the same shape as x or " + ("0-length, but got x shape: " + a.shape + ", weights shape: ") + (o.shape + ".");
    });
    var s = { x: a, weights: o }, i = { size: r, binaryOutput: n };
    return fn.runKernel(PSe, s, i);
  }
  var YW = Kr({ denseBincount_: xDe });
  function bDe(e, t, r) {
    r === void 0 && (r = "NHWC");
    var n = gr(e, "x", "depthToSpace", "float32"), a = r === "NHWC" ? n.shape[1] : n.shape[2], o = r === "NHWC" ? n.shape[2] : n.shape[3], s = r === "NHWC" ? n.shape[3] : n.shape[1];
    Yr(t > 1, function() {
      return "blockSize should be > 1 for depthToSpace, but was: " + t;
    }), Yr(a * t >= 0, function() {
      return `Negative dimension size caused by overflow when multiplying
    ` + a + " and " + t + `  for depthToSpace with input shape
    ` + n.shape;
    }), Yr(o * t >= 0, function() {
      return `Negative dimension size caused by overflow when multiplying
    ` + o + " and " + t + ` for depthToSpace with input shape
        ` + n.shape;
    }), Yr(s % (t * t) === 0, function() {
      return "Dimension size must be evenly divisible by " + t * t + " but is " + s + " for depthToSpace with input shape " + n.shape;
    });
    var i = { x: n }, l = { blockSize: t, dataFormat: r };
    return fn.runKernel(LSe, i, l);
  }
  var ZW = Kr({ depthToSpace_: bDe });
  function _De(e, t, r, n, a, o, s) {
    a === void 0 && (a = "NHWC"), o === void 0 && (o = [1, 1]);
    var i = gr(e, "x", "depthwiseConv2d", "float32"), l = gr(t, "filter", "depthwiseConv2d", "float32"), u2 = i, c = false;
    i.rank === 3 && (c = true, u2 = da(i, [1, i.shape[0], i.shape[1], i.shape[2]])), Yr(u2.rank === 4, function() {
      return "Error in depthwiseConv2d: input must be rank 4, but got " + ("rank " + u2.rank + ".");
    }), Yr(l.rank === 4, function() {
      return "Error in depthwiseConv2d: filter must be rank 4, but got rank " + (l.rank + ".");
    }), Yr(u2.shape[3] === l.shape[2], function() {
      return "Error in depthwiseConv2d: number of input channels " + ("(" + u2.shape[3] + ") must match the inChannels dimension in ") + ("filter " + l.shape[2] + ".");
    }), hd("depthwiseConv2d", n, s);
    var f = { x: u2, filter: l }, h = { strides: r, pad: n, dataFormat: a, dilations: o, dimRoundingMode: s }, p = fn.runKernel(RSe, f, h);
    return c ? da(p, [p.shape[1], p.shape[2], p.shape[3]]) : p;
  }
  var Qk = Kr({ depthwiseConv2d_: _De });
  function wDe(e) {
    var t = gr(e, "x", "diag"), r = { x: t };
    return fn.runKernel(USe, r);
  }
  var kDe = Kr({ diag_: wDe });
  function TDe(e, t, r, n, a, o) {
    a === void 0 && (a = [1, 1]), o === void 0 && (o = "NHWC");
    var s = gr(e, "x", "dilation2d"), i = gr(t, "filter", "dilation2d");
    Yr(s.rank === 3 || s.rank === 4, function() {
      return "Error in dilation2d: input must be rank 3 or 4, but got rank " + (s.rank + ".");
    }), Yr(i.rank === 3, function() {
      return "Error in dilation2d: filter must be rank 3, but got rank " + (i.rank + ".");
    }), Yr(o === "NHWC", function() {
      return "Error in dilation2d: Only NHWC is currently supported, " + ("but got dataFormat of " + o);
    });
    var l = s, u2 = false;
    s.rank === 3 && (l = da(s, [1, s.shape[0], s.shape[1], s.shape[2]]), u2 = true);
    var c = { x: l, filter: i }, f = { strides: r, pad: n, dilations: a }, h = fn.runKernel(VSe, c, f);
    return u2 ? da(h, [h.shape[1], h.shape[2], h.shape[3]]) : h;
  }
  var JW = Kr({ dilation2d_: TDe });
  function ADe(e, t) {
    var r, n = gr(e, "a", "floorDiv"), a = gr(t, "b", "floorDiv");
    r = ni(su(n, a), 2), n = r[0], a = r[1];
    var o = { a: n, b: a };
    return fn.runKernel(eEe, o);
  }
  var vM = Kr({ floorDiv_: ADe });
  function SDe(e, t) {
    var r, n = gr(e, "a", "div"), a = gr(t, "b", "div");
    if (r = ni(su(n, a), 2), n = r[0], a = r[1], n.dtype === "int32" && a.dtype === "int32") return vM(n, a);
    var o = { a: n, b: a }, s = {};
    return fn.runKernel(jSe, o, s);
  }
  var qc = Kr({ div_: SDe });
  function EDe(e, t) {
    for (var r = [], n = 0; n < t.length; n++) {
      var a = e[e.length - n - 1], o = t.length - n - 1, s = t[o];
      (a == null || a === 1 && s > 1) && r.unshift(o);
    }
    return r;
  }
  function Ec(e, t) {
    for (var r = [], n = Math.max(e.length, t.length), a = 0; a < n; a++) {
      var o = e[e.length - a - 1];
      o == null && (o = 1);
      var s = t[t.length - a - 1];
      if (s == null && (s = 1), o === 1) r.unshift(s);
      else if (s === 1) r.unshift(o);
      else if (o !== s) {
        var i = "Operands could not be broadcast together with shapes " + (e + " and " + t + ".");
        throw Error(i);
      } else r.unshift(o);
    }
    return r;
  }
  function DDe(e, t) {
    var r, n = gr(e, "a", "equal", "string_or_numeric"), a = gr(t, "b", "equal", "string_or_numeric");
    r = ni(su(n, a), 2), n = r[0], a = r[1], Ec(n.shape, a.shape);
    var o = { a: n, b: a };
    return fn.runKernel(HSe, o);
  }
  var mM = Kr({ equal_: DDe });
  function CDe(e, t, r) {
    var n = gr(t, "a", "where"), a = gr(r, "b", "where"), o = gr(e, "condition", "where", "bool"), s = Ec(Ec(o.shape, n.shape), a.shape), i = S2(o, s), l = S2(n, s), u2 = S2(a, s), c = { condition: i, t: l, e: u2 };
    return fn.runKernel(n4e, c);
  }
  var cg = Kr({ where_: CDe });
  function MDe(e) {
    var t = gr(e, "x", "zerosLike"), r = { x: t };
    return fn.runKernel(P4e, r);
  }
  var eT = Kr({ zerosLike_: MDe });
  function IDe(e, t) {
    var r, n = gr(e, "a", "div"), a = gr(t, "b", "div");
    r = ni(su(n, a), 2), n = r[0], a = r[1];
    var o = qc(n, a), s = eT(o), i = mM(a, s);
    return cg(i, s, o);
  }
  var QW = Kr({ divNoNan_: IDe });
  function NDe(e, t) {
    var r = gr(e, "t1", "dot"), n = gr(t, "t2", "dot");
    Yr((r.rank === 1 || r.rank === 2) && (n.rank === 1 || n.rank === 2), function() {
      return "Error in dot: inputs must all be rank 1 or 2, but got ranks " + (r.rank + " and " + n.rank + ".");
    });
    var a = r.rank === 1 ? r.size : r.shape[1], o = n.rank === 1 ? n.size : n.shape[0];
    if (Yr(a === o, function() {
      return "Error in dot: inner dimensions of inputs must match, but got " + (a + " and " + o + ".");
    }), r.rank === 1 && n.rank === 1) {
      var s = da(r, [1, -1]), i = da(n, [-1, 1]), l = _s(s, i);
      return da(l, []);
    } else if (r.rank === 1 && n.rank === 2) {
      var s = da(r, [1, -1]), i = da(n, [n.shape[0], n.shape[1]]), l = _s(s, i);
      return da(l, [l.size]);
    } else if (r.rank === 2 && n.rank === 1) {
      var i = da(n, [-1, 1]), l = _s(r, i);
      return da(l, [l.size]);
    } else {
      var i = da(n, [n.shape[0], n.shape[1]]), l = _s(r, i);
      return l;
    }
  }
  var FDe = Kr({ dot_: NDe });
  function ODe(e) {
    for (var t = [], r = 1; r < arguments.length; r++) t[r - 1] = arguments[r];
    var n = t.map(function(o, s) {
      return gr(o, "tensors" + s, "einsum");
    }), a = { equation: e };
    return fn.runKernel(WSe, n, a);
  }
  var eG = Kr({ einsum_: ODe });
  function PDe(e) {
    var t = gr(e, "x", "elu", "float32"), r = { x: t };
    return fn.runKernel(GSe, r);
  }
  var gM = Kr({ elu_: PDe });
  function LDe(e) {
    var t = gr(e, "x", "erf");
    Yr(t.dtype === "int32" || t.dtype === "float32", function() {
      return "Input dtype must be `int32` or `float32`.";
    }), t.dtype === "int32" && (t = ou(t, "float32"));
    var r = { x: t };
    return fn.runKernel($Se, r);
  }
  var tG = Kr({ erf_: LDe });
  function RDe(e) {
    var t = gr(e, "x", "exp"), r = { x: t };
    return fn.runKernel(qSe, r);
  }
  var Nv = Kr({ exp_: RDe });
  function zDe(e, t) {
    t === void 0 && (t = 0);
    var r = gr(e, "x", "expandDims", "string_or_numeric");
    Yr(t <= r.rank, function() {
      return "Axis must be <= rank of the tensor";
    });
    var n = { input: r }, a = { dim: t };
    return fn.runKernel(XSe, n, a);
  }
  var Cv = Kr({ expandDims_: zDe });
  function BDe(e) {
    var t = gr(e, "x", "expm1"), r = { x: t };
    return fn.runKernel(KSe, r);
  }
  var rG = Kr({ expm1_: BDe });
  function UDe(e, t) {
    var r = gr(e, "x", "tile", "string_or_numeric");
    Yr(r.rank === t.length, function() {
      return "Error in transpose: rank of input " + r.rank + " " + ("must match length of reps " + t + ".");
    });
    var n = { x: r }, a = { reps: t };
    return fn.runKernel(vW, n, a);
  }
  var ky = Kr({ tile_: UDe });
  function VDe(e, t, r, n) {
    n === void 0 && (n = "float32"), t == null && (t = e);
    for (var a = Iv([e, t], n), o = e <= t ? e : t, s = 0; s < o; ++s) a.set(1, s, s);
    var i = da(a.toTensor(), [e, t]);
    if (r == null) return i;
    if (r.length === 1) return ky(Cv(i, 0), [r[0], 1, 1]);
    if (r.length === 2) return ky(Cv(Cv(i, 0), 0), [r[0], r[1], 1, 1]);
    if (r.length === 3) return ky(Cv(Cv(Cv(i, 0), 0), 0), [r[0], r[1], r[2], 1, 1]);
    throw new Error("eye() currently supports only 1D and 2D " + ("batchShapes, but received " + r.length + "D."));
  }
  var nG = Kr({ eye_: VDe });
  function tT(e, t, r) {
    var n = { shape: e, value: t, dtype: r };
    return fn.runKernel(ZSe, {}, n);
  }
  function jDe(e) {
    var t = gr(e, "x", "floor", "float32"), r = { x: t };
    return fn.runKernel(QSe, r);
  }
  var yM = Kr({ floor_: jDe });
  function WDe(e, t, r, n) {
    r === void 0 && (r = 0), n === void 0 && (n = 0);
    var a = gr(e, "x", "gather"), o = gr(t, "indices", "gather", "int32"), s = { x: a, indices: o }, i = { axis: r, batchDims: n };
    return fn.runKernel(rEe, s, i);
  }
  var qk = Kr({ gather_: WDe });
  function GDe(e, t) {
    var r, n = gr(e, "a", "greater", "string_or_numeric"), a = gr(t, "b", "greater", "string_or_numeric");
    r = ni(su(n, a), 2), n = r[0], a = r[1], Ec(n.shape, a.shape);
    var o = { a: n, b: a };
    return fn.runKernel(aEe, o);
  }
  var O2 = Kr({ greater_: GDe });
  function $De(e, t) {
    var r, n = gr(e, "a", "greaterEqual", "string_or_numeric"), a = gr(t, "b", "greaterEqual", "string_or_numeric");
    r = ni(su(n, a), 2), n = r[0], a = r[1], Ec(n.shape, a.shape);
    var o = { a: n, b: a };
    return fn.runKernel(iEe, o);
  }
  var xM = Kr({ greaterEqual_: $De });
  function HDe(e) {
    var t = gr(e, "input", "imag"), r = { input: t };
    return fn.runKernel(sEe, r);
  }
  var rT = Kr({ imag_: HDe });
  function qDe(e) {
    var t = gr(e, "x", "isFinite"), r = { x: t };
    return fn.runKernel(lEe, r);
  }
  var XDe = Kr({ isFinite_: qDe });
  function KDe(e) {
    var t = gr(e, "x", "isInf"), r = { x: t };
    return fn.runKernel(uEe, r);
  }
  var YDe = Kr({ isInf_: KDe });
  function ZDe(e) {
    var t = gr(e, "x", "isNaN"), r = { x: t };
    return fn.runKernel(cEe, r);
  }
  var aG = Kr({ isNaN_: ZDe });
  function JDe(e, t) {
    t === void 0 && (t = 0.2);
    var r = gr(e, "x", "leakyRelu"), n = { x: r }, a = { alpha: t };
    return fn.runKernel(fEe, n, a);
  }
  var bM = Kr({ leakyRelu_: JDe });
  function QDe(e, t) {
    var r, n = gr(e, "a", "less", "string_or_numeric"), a = gr(t, "b", "less", "string_or_numeric");
    r = ni(su(n, a), 2), n = r[0], a = r[1], Ec(n.shape, a.shape);
    var o = { a: n, b: a };
    return fn.runKernel(hEe, o);
  }
  var iG = Kr({ less_: QDe });
  function eCe(e, t) {
    var r, n = gr(e, "a", "lessEqual", "string_or_numeric"), a = gr(t, "b", "lessEqual", "string_or_numeric");
    r = ni(su(n, a), 2), n = r[0], a = r[1], Ec(n.shape, a.shape);
    var o = { a: n, b: a };
    return fn.runKernel(pEe, o);
  }
  var nT = Kr({ lessEqual_: eCe });
  function oG(e, t, r) {
    if (r <= 0) throw new Error("The number of values should be positive.");
    var n = { start: e, stop: t, num: r };
    return fn.runKernel(dEe, {}, n);
  }
  function tCe(e, t, r, n, a) {
    t === void 0 && (t = 5), r === void 0 && (r = 1), n === void 0 && (n = 1), a === void 0 && (a = 0.5);
    var o = gr(e, "x", "localResponseNormalization");
    Yr(o.rank === 4 || o.rank === 3, function() {
      return `Error in localResponseNormalization: x must be rank 3 or 4 but got
               rank ` + o.rank + ".";
    }), Yr(D2(t), function() {
      return "Error in localResponseNormalization: depthRadius must be an " + ("integer but got depthRadius " + t + ".");
    });
    var s = o, i = false;
    o.rank === 3 && (i = true, s = da(o, [1, o.shape[0], o.shape[1], o.shape[2]]));
    var l = { x: s }, u2 = { depthRadius: t, bias: r, alpha: n, beta: a }, c = fn.runKernel(bEe, l, u2);
    return i ? da(c, [c.shape[1], c.shape[2], c.shape[3]]) : c;
  }
  var sG = Kr({ localResponseNormalization_: tCe });
  function rCe(e) {
    var t = gr(e, "x", "log", "float32"), r = { x: t };
    return fn.runKernel(vEe, r);
  }
  var Sy = Kr({ log_: rCe });
  function nCe(e) {
    var t = gr(e, "x", "log1p"), r = { x: t };
    return fn.runKernel(mEe, r);
  }
  var _M = Kr({ log1p_: nCe });
  function S0(e) {
    return fn.customGrad(e);
  }
  function aCe(e) {
    var t = gr(e, "x", "neg"), r = { x: t };
    return fn.runKernel(FEe, r);
  }
  var A0 = Kr({ neg_: aCe });
  function iCe(e) {
    var t = gr(e, "x", "softplus"), r = { x: t };
    return fn.runKernel(c4e, r);
  }
  var wM = Kr({ softplus_: iCe });
  function oCe(e) {
    var t = gr(e, "x", "logSigmoid"), r = S0(function(n) {
      var a = A0(wM(A0(n))), o = function(s) {
        var i = oo(s, og(A0(n)));
        return i;
      };
      return { value: a, gradFunc: o };
    });
    return r(t);
  }
  var sCe = Kr({ logSigmoid_: oCe });
  function lCe(e, t, r) {
    t === void 0 && (t = null), r === void 0 && (r = false);
    var n = gr(e, "x", "max"), a = { x: n }, o = { reductionIndices: t, keepDims: r };
    return fn.runKernel(_Ee, a, o);
  }
  var sg = Kr({ max_: lCe });
  function uCe(e, t) {
    var r, n = gr(e, "a", "sub"), a = gr(t, "b", "sub");
    r = ni(su(n, a), 2), n = r[0], a = r[1];
    var o = { a: n, b: a };
    return fn.runKernel(S4e, o);
  }
  var Jo = Kr({ sub_: uCe });
  function cCe(e, t, r) {
    t === void 0 && (t = null), r === void 0 && (r = false);
    var n = gr(e, "x", "sum");
    n.dtype === "bool" && (n = ou(n, "int32"));
    var a = { x: n }, o = { axis: t, keepDims: r };
    return fn.runKernel(h4e, a, o);
  }
  var Qs = Kr({ sum_: cCe });
  function fCe(e, t) {
    t === void 0 && (t = -1);
    var r = gr(e, "logits", "logSoftmax");
    if (t === -1 && (t = r.rank - 1), t !== r.rank - 1) throw Error("Log Softmax along a non-last dimension is not yet supported. " + ("Logits was rank " + r.rank + " and axis was " + t));
    var n = S0(function(a, o) {
      var s = true, i = sg(a, t, true), l = Jo(a, i), u2 = Jo(ou(l, "float32"), Sy(Qs(Nv(l), t, s)));
      o([u2]);
      var c = function(f, h) {
        var p = ni(h, 1), d = p[0], v = true, m = Nv(d);
        return Jo(f, oo(Qs(f, t, v), m));
      };
      return { value: u2, gradFunc: c };
    });
    return n(r);
  }
  var lG = Kr({ logSoftmax_: fCe });
  function hCe(e, t, r) {
    for (var n = e.length + t.length, a = [], o = 0, s = 0, i = 0; i < n; i++) r.indexOf(i) === -1 ? a.push(e[o++]) : a.push(t[s++]);
    return a;
  }
  function aT(e, t) {
    var r = t.map(function(n) {
      return 1;
    });
    return hCe(e, r, t);
  }
  function pCe(e, t, r) {
    t === void 0 && (t = null), r === void 0 && (r = false);
    var n = gr(e, "x", "logSumExp"), a = Jk(t, n.shape), o = sg(n, a, true), s = Jo(n, o), i = Nv(s), l = Qs(i, a), u2 = Sy(l), c = qu(da(o, u2.shape), u2);
    if (r) {
      var f = aT(c.shape, a);
      return da(c, f);
    }
    return c;
  }
  var uG = Kr({ logSumExp_: pCe });
  function dCe(e, t) {
    var r = gr(e, "a", "logicalAnd", "bool"), n = gr(t, "b", "logicalAnd", "bool");
    Ec(r.shape, n.shape);
    var a = { a: r, b: n };
    return fn.runKernel(gEe, a);
  }
  var C2 = Kr({ logicalAnd_: dCe });
  function vCe(e) {
    var t = gr(e, "x", "logicalNot", "bool"), r = { x: t };
    return fn.runKernel(yEe, r);
  }
  var kM = Kr({ logicalNot_: vCe });
  function mCe(e, t) {
    var r = gr(e, "a", "logicalOr", "bool"), n = gr(t, "b", "logicalOr", "bool");
    Ec(r.shape, n.shape);
    var a = { a: r, b: n };
    return fn.runKernel(xEe, a);
  }
  var TM = Kr({ logicalOr_: mCe });
  function gCe(e, t) {
    var r = gr(e, "a", "logicalXor", "bool"), n = gr(t, "b", "logicalXor", "bool");
    return Ec(r.shape, n.shape), C2(TM(e, t), kM(C2(e, t)));
  }
  var yCe = Kr({ logicalXor_: gCe });
  function xCe(e, t, r, n, a) {
    var o = gr(e, "x", "maxPool"), s = 1, i = o, l = false;
    o.rank === 3 && (l = true, i = da(o, [1, o.shape[0], o.shape[1], o.shape[2]])), Yr(i.rank === 4, function() {
      return "Error in maxPool: input must be rank 4 but got rank " + i.rank + ".";
    }), Yr(Ov(r, s), function() {
      return "Error in maxPool: Either strides or dilations must be 1. " + ("Got strides " + r + " and dilations '" + s + "'");
    }), hd("maxPool", n, a);
    var u2 = { x: i }, c = { filterSize: t, strides: r, pad: n, dimRoundingMode: a }, f = fn.runKernel(kEe, u2, c);
    return l ? da(f, [f.shape[1], f.shape[2], f.shape[3]]) : f;
  }
  var AM = Kr({ maxPool_: xCe });
  function bCe(e, t, r, n, a, o) {
    t === void 0 && (t = [1, 1, 1]), o === void 0 && (o = "NDHWC");
    var s = gr(e, "x", "maxPool3d"), i = s, l = false;
    s.rank === 4 && (l = true, i = da(s, [1, s.shape[0], s.shape[1], s.shape[2], s.shape[3]])), Yr(i.rank === 5, function() {
      return "Error in maxPool3d: x must be rank 5 but got rank " + i.rank + ".";
    }), Yr(o === "NDHWC", function() {
      return "Error in maxPool3d: Only NDHWC is currently supported, " + ("but got dataFormat of " + o);
    }), hd("maxPool3d", n, a);
    var u2 = { x: i }, c = { filterSize: t, strides: r, pad: n, dimRoundingMode: a, dataFormat: o }, f = fn.runKernel(TEe, u2, c);
    return l ? da(f, [f.shape[1], f.shape[2], f.shape[3], f.shape[4]]) : f;
  }
  var cG = Kr({ maxPool3d_: bCe });
  function _Ce(e, t, r, n, a) {
    a === void 0 && (a = false);
    var o = gr(e, "x", "maxPoolWithArgmax"), s = { x: o }, i = { filterSize: t, strides: r, pad: n, includeBatchInIndex: a }, l = fn.runKernel(AEe, s, i);
    return { result: l[0], indexes: l[1] };
  }
  var fG = Kr({ maxPoolWithArgmax_: _Ce });
  function wCe(e, t) {
    var r, n = gr(e, "a", "maximum"), a = gr(t, "b", "maximum");
    r = ni(su(n, a), 2), n = r[0], a = r[1], n.dtype === "bool" && (n = ou(n, "int32"), a = ou(a, "int32")), Ec(n.shape, a.shape);
    var o = { a: n, b: a };
    return fn.runKernel(wEe, o);
  }
  var hG = Kr({ maximum_: wCe });
  function kCe(e, t, r) {
    t === void 0 && (t = null), r === void 0 && (r = false);
    var n = gr(e, "x", "mean"), a = { x: n }, o = { axis: t, keepDims: r };
    return fn.runKernel(SEe, a, o);
  }
  var M2 = Kr({ mean_: kCe });
  function fg(e, t) {
    if (t === void 0 && (t = "float32"), t === "complex64") {
      var r = fg(e, "float32"), n = fg(e, "float32");
      return ug(r, n);
    }
    var a = oM(lh(e), t);
    return fn.makeTensor(a, e, t);
  }
  function Mv(e, t) {
    if (t === void 0 && (t = "float32"), t === "complex64") {
      var r = Mv(e, "float32"), n = fg(e, "float32");
      return ug(r, n);
    }
    var a = sW(lh(e), t);
    return fn.makeTensor(a, e, t);
  }
  function TCe(e, t, r) {
    var n = (r === void 0 ? {} : r).indexing, a = n === void 0 ? "xy" : n;
    if (a !== "xy" && a !== "ij") throw new TypeError(a + " is not a valid third argument to meshgrid");
    if (e === void 0) return [];
    var o = gr(e, "x", "meshgrid", e instanceof Pf ? e.dtype : "float32");
    if (t === void 0) return [o];
    var s = gr(t, "y", "meshgrid", t instanceof Pf ? t.dtype : "float32"), i = lh(o.shape), l = lh(s.shape);
    return a === "xy" ? (o = da(o, [1, -1]), s = da(s, [-1, 1]), [_s(Mv([l, 1], o.dtype), o), _s(s, Mv([1, i], s.dtype))]) : (o = da(o, [-1, 1]), s = da(s, [1, -1]), [_s(o, Mv([1, l], o.dtype)), _s(Mv([i, 1], s.dtype), s)]);
  }
  function ACe(e, t, r) {
    t === void 0 && (t = null), r === void 0 && (r = false);
    var n = gr(e, "x", "min"), a = { x: n }, o = { axis: t, keepDims: r };
    return fn.runKernel(EEe, a, o);
  }
  var Xk = Kr({ min_: ACe });
  function SCe(e, t) {
    var r, n = gr(e, "a", "minimum"), a = gr(t, "b", "minimum");
    r = ni(su(n, a), 2), n = r[0], a = r[1], n.dtype === "bool" && (n = ou(n, "int32"), a = ou(a, "int32")), Ec(n.shape, a.shape);
    var o = { a: n, b: a };
    return fn.runKernel(DEe, o);
  }
  var SM = Kr({ minimum_: SCe });
  function ECe(e, t, r) {
    Yr(r === "reflect" || r === "symmetric", function() {
      return "Invalid mode. Mode must be either reflect or symmetric. " + ("Got " + r + ".");
    });
    var n = gr(e, "x", "mirrorPad");
    if (n.rank === 0) throw new Error("mirrorPad(scalar) is not defined. Pass non-scalar to mirrorPad");
    Yr(t.length === n.rank, function() {
      return "Padding doesn't match input. Must be " + n.rank + ". " + ("Got " + t.length + ".");
    });
    for (var a = r === "reflect" ? 1 : 0, o = function(u2) {
      Yr(t[u2].length === 2, function() {
        return "Invalid number of paddings. Must be length of 2 each.";
      }), Yr(t[u2][0] >= 0 && t[u2][0] <= n.shape[u2] - a && t[u2][1] >= 0 && t[u2][1] <= n.shape[u2] - a, function() {
        return "Padding in dimension " + u2 + " cannot be greater than or equal " + ("to " + (n.shape[u2] - a) + " or less than 0 for input of ") + ("shape " + n.shape);
      });
    }, s = 0; s < n.rank; s++) o(s);
    var i = { paddings: t, mode: r }, l = { x: n };
    return fn.runKernel(CEe, l, i);
  }
  var pG = Kr({ mirrorPad_: ECe });
  function DCe(e, t) {
    var r, n = gr(e, "a", "mod"), a = gr(t, "b", "mod");
    r = ni(su(n, a), 2), n = r[0], a = r[1];
    var o = { a: n, b: a };
    return fn.runKernel(MEe, o);
  }
  var dG = Kr({ mod_: DCe });
  function CCe(e) {
    var t = gr(e, "x", "square"), r = {};
    return fn.runKernel("Square", { x: t }, r);
  }
  var P2 = Kr({ square_: CCe });
  function MCe(e, t, r) {
    t === void 0 && (t = null), r === void 0 && (r = false), e = gr(e, "x", "moments");
    var n = Jk(t, e.shape), a = M2(e, n, r), o = a.shape;
    r || (o = aT(a.shape, n));
    var s = P2(Jo(ou(e, "float32"), da(a, o))), i = M2(s, n, r);
    return { mean: a, variance: i };
  }
  var ICe = Kr({ moments_: MCe });
  function NCe(e, t, r, n) {
    for (var a = gr(t, "data", "multiRNNCell"), o = jk(r, "c", "multiRNNCell"), s = jk(n, "h", "multiRNNCell"), i = a, l = [], u2 = 0; u2 < e.length; u2++) {
      var c = e[u2](i, o[u2], s[u2]);
      l.push(c[0]), l.push(c[1]), i = c[1];
    }
    for (var f = [], h = [], u2 = 0; u2 < l.length; u2 += 2) f.push(l[u2]), h.push(l[u2 + 1]);
    return [f, h];
  }
  var FCe = Kr({ multiRNNCell_: NCe });
  function OCe(e, t, r, n) {
    n === void 0 && (n = false);
    var a = gr(e, "logits", "multinomial"), o = a.size, s = a.rank;
    if (o < 2) throw new Error("Error in multinomial: you need at least 2 outcomes, but got " + (o + "."));
    if (s > 2) throw new Error("Rank of probabilities must be 1 or 2, but is " + s);
    r = r || Math.random();
    var i = s === 1 ? da(a, [1, -1]) : a, l = { logits: i }, u2 = { numSamples: t, seed: r, normalized: n }, c = fn.runKernel(IEe, l, u2);
    return s === 1 ? da(c, [c.size]) : c;
  }
  var vG = Kr({ multinomial_: OCe });
  function PCe(e, t) {
    var r, n = gr(e, "a", "notEqual", "string_or_numeric"), a = gr(t, "b", "notEqual", "string_or_numeric");
    r = ni(su(n, a), 2), n = r[0], a = r[1], Ec(n.shape, a.shape);
    var o = { a: n, b: a };
    return fn.runKernel(OEe, o);
  }
  var EM = Kr({ notEqual_: PCe });
  function LCe(e, t, r, n) {
    if (r === void 0 && (r = 1), n === void 0 && (n = 0), t < 2) throw new Error("Error in oneHot: depth must be >=2, but it is " + t);
    var a = gr(e, "indices", "oneHot", "int32"), o = { indices: a }, s = { depth: t, onValue: r, offValue: n };
    return fn.runKernel(BEe, o, s);
  }
  var mG = Kr({ oneHot_: LCe });
  function RCe(e) {
    var t = gr(e, "x", "onesLike"), r = { x: t };
    return fn.runKernel(zEe, r);
  }
  var gG = Kr({ onesLike_: RCe });
  function zCe(e, t) {
    var r = gr(e, "v1", "outerProduct"), n = gr(t, "v2", "outerProduct");
    Yr(r.rank === 1 && n.rank === 1, function() {
      return "Error in outerProduct: inputs must be rank 1, but got ranks " + (r.rank + " and " + n.rank + ".");
    });
    var a = da(r, [-1, 1]), o = da(n, [1, -1]);
    return _s(a, o);
  }
  var BCe = Kr({ outerProduct_: zCe });
  function UCe(e, t, r) {
    r === void 0 && (r = 0);
    var n = gr(e, "x", "pad");
    if (n.rank === 0) throw new Error("pad(scalar) is not defined. Pass non-scalar to pad");
    var a = { paddings: t, constantValue: r }, o = { x: n };
    return fn.runKernel(VEe, o, a);
  }
  var Fy = Kr({ pad_: UCe });
  function VCe(e, t, r) {
    return r === void 0 && (r = 0), Yr(t.length === 2, function() {
      return "Invalid number of paddings. Must be length of 2.";
    }), Fy(e, [t], r);
  }
  var jCe = Kr({ pad1d_: VCe });
  function WCe(e, t, r) {
    return r === void 0 && (r = 0), Yr(t.length === 2 && t[0].length === 2 && t[1].length === 2, function() {
      return "Invalid number of paddings. Must be length of 2 each.";
    }), Fy(e, t, r);
  }
  var GCe = Kr({ pad2d_: WCe });
  function $Ce(e, t, r) {
    return r === void 0 && (r = 0), Yr(t.length === 3 && t[0].length === 2 && t[1].length === 2 && t[2].length === 2, function() {
      return "Invalid number of paddings. Must be length of 2 each.";
    }), Fy(e, t, r);
  }
  var HCe = Kr({ pad3d_: $Ce });
  function qCe(e, t, r) {
    return r === void 0 && (r = 0), Yr(t.length === 4 && t[0].length === 2 && t[1].length === 2 && t[2].length === 2 && t[3].length === 2, function() {
      return "Invalid number of paddings. Must be length of 2 each.";
    }), Fy(e, t, r);
  }
  var XCe = Kr({ pad4d_: qCe });
  function KCe(e, t, r) {
    var n = gr(e, "x", "spaceToBatchND");
    Yr(n.rank >= 1 + t.length, function() {
      return "input rank " + n.rank + " should be > than [blockShape] " + t.length;
    }), Yr(r.length === t.length, function() {
      return "paddings.shape[0] " + r.length + " must be equal to [blockShape] " + t.length;
    }), Yr(n.shape.reduce(function(s, i, l) {
      return l > 0 && l <= t.length ? s && (i + r[l - 1][0] + r[l - 1][1]) % t[l - 1] === 0 : s;
    }, true), function() {
      return "input spatial dimensions " + n.shape.slice(1) + " with paddings " + r.toString() + " must be divisible by blockShapes " + t.toString();
    });
    var a = { x: n }, o = { blockShape: t, paddings: r };
    return fn.runKernel(p4e, a, o);
  }
  var DM = Kr({ spaceToBatchND_: KCe });
  function YCe(e, t, r, n, a, o, s) {
    a == null && (a = [1, 1]), o == null && (o = 1), n === 0 && (n = "valid");
    var i = gr(e, "x", "maxPool"), l = i, u2 = false;
    i.rank === 3 && (u2 = true, l = da(i, [1, i.shape[0], i.shape[1], i.shape[2]])), Yr(Ov(o, a), function() {
      return "Error in pool: Either strides or dilations must be 1. " + ("Got strides " + o + " and dilations '" + a + "'");
    });
    var c = w5e(l.shape, t, o, a, n), f = [c.dilationHeight, c.dilationWidth], h;
    n === "same" ? h = JCe([c.filterHeight, c.filterWidth], f) : h = [[0, 0], [0, 0]];
    var p = f[0] === 1 && f[1] === 1, d = ni(ZCe([c.inHeight, c.inWidth], f, h), 2), v = d[0], m = d[1], g = p ? n : "valid", x = p ? l : DM(l, f, v), b = r === "avg" ? function() {
      return hM(x, t, o, g, s);
    } : function() {
      return AM(x, t, o, g, s);
    }, y = b(), w = p ? y : pM(y, f, m);
    return u2 ? da(w, [w.shape[1], w.shape[2], w.shape[3]]) : w;
  }
  function ZCe(e, t, r) {
    var n = r.map(function(c) {
      return c[0];
    }), a = r.map(function(c) {
      return c[1];
    }), o = e.concat(n, a), s = t.map(function(c, f) {
      return (c - o[f] % c) % c;
    }), i = a.map(function(c, f) {
      return c + s[f];
    }), l = t.map(function(c, f) {
      return [n[f], i[f]];
    }), u2 = t.map(function(c, f) {
      return [0, s[f]];
    });
    return [l, u2];
  }
  function JCe(e, t) {
    var r = e.map(function(s, i) {
      return s + (s - 1) * (t[i] - 1);
    }), n = r.map(function(s) {
      return s - 1;
    }), a = n.map(function(s) {
      return Math.floor(s / 2);
    }), o = n.map(function(s, i) {
      return s - a[i];
    });
    return n.map(function(s, i) {
      return [a[i], o[i]];
    });
  }
  var QCe = Kr({ pool_: YCe });
  function eMe(e, t) {
    var r, n = gr(e, "base", "pow"), a = gr(t, "exp", "pow");
    r = ni(su(n, a), 2), n = r[0], a = r[1];
    var o = { a: n, b: a };
    return fn.runKernel(jEe, o);
  }
  var iT = Kr({ pow_: eMe });
  function tMe(e, t) {
    var r = gr(e, "x", "prelu"), n = gr(t, "alpha", "prelu"), a = { x: r, alpha: n };
    return fn.runKernel(WEe, a);
  }
  var CM = Kr({ prelu_: tMe });
  function rMe(e, t) {
    t === void 0 && (t = false), console.log(e.toString(t));
  }
  function nMe(e, t, r) {
    t === void 0 && (t = null), r === void 0 && (r = false);
    var n = gr(e, "x", "prod");
    n.dtype === "bool" && (n = ou(n, "int32"));
    var a = { x: n }, o = { axis: t, keepDims: r };
    return fn.runKernel(GEe, a, o);
  }
  var MM = Kr({ prod_: nMe });
  function aMe(e, t, r) {
    var n = lh(e), a = null;
    if (r == null || r === "float32") a = new Float32Array(n);
    else if (r === "int32") a = new Int32Array(n);
    else if (r === "bool") a = new Uint8Array(n);
    else throw new Error("Unknown data type " + r);
    for (var o = 0; o < n; o++) a[o] = t();
    return fn.makeTensor(a, e, r);
  }
  var iMe = Kr({ rand_: aMe }), pg = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
  function oMe(e) {
    if (e.__esModule) return e;
    var t = Object.defineProperty({}, "__esModule", { value: true });
    return Object.keys(e).forEach(function(r) {
      var n = Object.getOwnPropertyDescriptor(e, r);
      Object.defineProperty(t, r, n.get ? n : { enumerable: true, get: function() {
        return e[r];
      } });
    }), t;
  }
  function dg(e) {
    var t = { exports: {} };
    return e(t, t.exports), t.exports;
  }
  var sMe = dg(function(e) {
    (function(t, r, n) {
      function a(l) {
        var u2 = this, c = i();
        u2.next = function() {
          var f = 2091639 * u2.s0 + u2.c * 23283064365386963e-26;
          return u2.s0 = u2.s1, u2.s1 = u2.s2, u2.s2 = f - (u2.c = f | 0);
        }, u2.c = 1, u2.s0 = c(" "), u2.s1 = c(" "), u2.s2 = c(" "), u2.s0 -= c(l), u2.s0 < 0 && (u2.s0 += 1), u2.s1 -= c(l), u2.s1 < 0 && (u2.s1 += 1), u2.s2 -= c(l), u2.s2 < 0 && (u2.s2 += 1), c = null;
      }
      function o(l, u2) {
        return u2.c = l.c, u2.s0 = l.s0, u2.s1 = l.s1, u2.s2 = l.s2, u2;
      }
      function s(l, u2) {
        var c = new a(l), f = u2 && u2.state, h = c.next;
        return h.int32 = function() {
          return c.next() * 4294967296 | 0;
        }, h.double = function() {
          return h() + (h() * 2097152 | 0) * 11102230246251565e-32;
        }, h.quick = h, f && (typeof f == "object" && o(f, c), h.state = function() {
          return o(c, {});
        }), h;
      }
      function i() {
        var l = 4022871197, u2 = function(c) {
          c = String(c);
          for (var f = 0; f < c.length; f++) {
            l += c.charCodeAt(f);
            var h = 0.02519603282416938 * l;
            l = h >>> 0, h -= l, h *= l, l = h >>> 0, h -= l, l += h * 4294967296;
          }
          return (l >>> 0) * 23283064365386963e-26;
        };
        return u2;
      }
      r && r.exports ? r.exports = s : n && n.amd ? n(function() {
        return s;
      }) : this.alea = s;
    })(pg, e, false);
  }), lMe = dg(function(e) {
    (function(t, r, n) {
      function a(i) {
        var l = this, u2 = "";
        l.x = 0, l.y = 0, l.z = 0, l.w = 0, l.next = function() {
          var f = l.x ^ l.x << 11;
          return l.x = l.y, l.y = l.z, l.z = l.w, l.w ^= l.w >>> 19 ^ f ^ f >>> 8;
        }, i === (i | 0) ? l.x = i : u2 += i;
        for (var c = 0; c < u2.length + 64; c++) l.x ^= u2.charCodeAt(c) | 0, l.next();
      }
      function o(i, l) {
        return l.x = i.x, l.y = i.y, l.z = i.z, l.w = i.w, l;
      }
      function s(i, l) {
        var u2 = new a(i), c = l && l.state, f = function() {
          return (u2.next() >>> 0) / 4294967296;
        };
        return f.double = function() {
          do
            var h = u2.next() >>> 11, p = (u2.next() >>> 0) / 4294967296, d = (h + p) / (1 << 21);
          while (d === 0);
          return d;
        }, f.int32 = u2.next, f.quick = f, c && (typeof c == "object" && o(c, u2), f.state = function() {
          return o(u2, {});
        }), f;
      }
      r && r.exports ? r.exports = s : n && n.amd ? n(function() {
        return s;
      }) : this.xor128 = s;
    })(pg, e, false);
  }), uMe = dg(function(e) {
    (function(t, r, n) {
      function a(i) {
        var l = this, u2 = "";
        l.next = function() {
          var f = l.x ^ l.x >>> 2;
          return l.x = l.y, l.y = l.z, l.z = l.w, l.w = l.v, (l.d = l.d + 362437 | 0) + (l.v = l.v ^ l.v << 4 ^ (f ^ f << 1)) | 0;
        }, l.x = 0, l.y = 0, l.z = 0, l.w = 0, l.v = 0, i === (i | 0) ? l.x = i : u2 += i;
        for (var c = 0; c < u2.length + 64; c++) l.x ^= u2.charCodeAt(c) | 0, c == u2.length && (l.d = l.x << 10 ^ l.x >>> 4), l.next();
      }
      function o(i, l) {
        return l.x = i.x, l.y = i.y, l.z = i.z, l.w = i.w, l.v = i.v, l.d = i.d, l;
      }
      function s(i, l) {
        var u2 = new a(i), c = l && l.state, f = function() {
          return (u2.next() >>> 0) / 4294967296;
        };
        return f.double = function() {
          do
            var h = u2.next() >>> 11, p = (u2.next() >>> 0) / 4294967296, d = (h + p) / (1 << 21);
          while (d === 0);
          return d;
        }, f.int32 = u2.next, f.quick = f, c && (typeof c == "object" && o(c, u2), f.state = function() {
          return o(u2, {});
        }), f;
      }
      r && r.exports ? r.exports = s : n && n.amd ? n(function() {
        return s;
      }) : this.xorwow = s;
    })(pg, e, false);
  }), cMe = dg(function(e) {
    (function(t, r, n) {
      function a(i) {
        var l = this;
        l.next = function() {
          var c = l.x, f = l.i, h, p;
          return h = c[f], h ^= h >>> 7, p = h ^ h << 24, h = c[f + 1 & 7], p ^= h ^ h >>> 10, h = c[f + 3 & 7], p ^= h ^ h >>> 3, h = c[f + 4 & 7], p ^= h ^ h << 7, h = c[f + 7 & 7], h = h ^ h << 13, p ^= h ^ h << 9, c[f] = p, l.i = f + 1 & 7, p;
        };
        function u2(c, f) {
          var h, p = [];
          if (f === (f | 0)) p[0] = f;
          else for (f = "" + f, h = 0; h < f.length; ++h) p[h & 7] = p[h & 7] << 15 ^ f.charCodeAt(h) + p[h + 1 & 7] << 13;
          for (; p.length < 8; ) p.push(0);
          for (h = 0; h < 8 && p[h] === 0; ++h) ;
          for (h == 8 && (p[7] = -1), c.x = p, c.i = 0, h = 256; h > 0; --h) c.next();
        }
        u2(l, i);
      }
      function o(i, l) {
        return l.x = i.x.slice(), l.i = i.i, l;
      }
      function s(i, l) {
        i == null && (i = +/* @__PURE__ */ new Date());
        var u2 = new a(i), c = l && l.state, f = function() {
          return (u2.next() >>> 0) / 4294967296;
        };
        return f.double = function() {
          do
            var h = u2.next() >>> 11, p = (u2.next() >>> 0) / 4294967296, d = (h + p) / (1 << 21);
          while (d === 0);
          return d;
        }, f.int32 = u2.next, f.quick = f, c && (c.x && o(c, u2), f.state = function() {
          return o(u2, {});
        }), f;
      }
      r && r.exports ? r.exports = s : n && n.amd ? n(function() {
        return s;
      }) : this.xorshift7 = s;
    })(pg, e, false);
  }), fMe = dg(function(e) {
    (function(t, r, n) {
      function a(i) {
        var l = this;
        l.next = function() {
          var c = l.w, f = l.X, h = l.i, p, d;
          return l.w = c = c + 1640531527 | 0, d = f[h + 34 & 127], p = f[h = h + 1 & 127], d ^= d << 13, p ^= p << 17, d ^= d >>> 15, p ^= p >>> 12, d = f[h] = d ^ p, l.i = h, d + (c ^ c >>> 16) | 0;
        };
        function u2(c, f) {
          var h, p, d, v, m, g = [], x = 128;
          for (f === (f | 0) ? (p = f, f = null) : (f = f + "\0", p = 0, x = Math.max(x, f.length)), d = 0, v = -32; v < x; ++v) f && (p ^= f.charCodeAt((v + 32) % f.length)), v === 0 && (m = p), p ^= p << 10, p ^= p >>> 15, p ^= p << 4, p ^= p >>> 13, v >= 0 && (m = m + 1640531527 | 0, h = g[v & 127] ^= p + m, d = h == 0 ? d + 1 : 0);
          for (d >= 128 && (g[(f && f.length || 0) & 127] = -1), d = 127, v = 4 * 128; v > 0; --v) p = g[d + 34 & 127], h = g[d = d + 1 & 127], p ^= p << 13, h ^= h << 17, p ^= p >>> 15, h ^= h >>> 12, g[d] = p ^ h;
          c.w = m, c.X = g, c.i = d;
        }
        u2(l, i);
      }
      function o(i, l) {
        return l.i = i.i, l.w = i.w, l.X = i.X.slice(), l;
      }
      function s(i, l) {
        i == null && (i = +/* @__PURE__ */ new Date());
        var u2 = new a(i), c = l && l.state, f = function() {
          return (u2.next() >>> 0) / 4294967296;
        };
        return f.double = function() {
          do
            var h = u2.next() >>> 11, p = (u2.next() >>> 0) / 4294967296, d = (h + p) / (1 << 21);
          while (d === 0);
          return d;
        }, f.int32 = u2.next, f.quick = f, c && (c.X && o(c, u2), f.state = function() {
          return o(u2, {});
        }), f;
      }
      r && r.exports ? r.exports = s : n && n.amd ? n(function() {
        return s;
      }) : this.xor4096 = s;
    })(pg, e, false);
  }), hMe = dg(function(e) {
    (function(t, r, n) {
      function a(i) {
        var l = this, u2 = "";
        l.next = function() {
          var f = l.b, h = l.c, p = l.d, d = l.a;
          return f = f << 25 ^ f >>> 7 ^ h, h = h - p | 0, p = p << 24 ^ p >>> 8 ^ d, d = d - f | 0, l.b = f = f << 20 ^ f >>> 12 ^ h, l.c = h = h - p | 0, l.d = p << 16 ^ h >>> 16 ^ d, l.a = d - f | 0;
        }, l.a = 0, l.b = 0, l.c = -1640531527, l.d = 1367130551, i === Math.floor(i) ? (l.a = i / 4294967296 | 0, l.b = i | 0) : u2 += i;
        for (var c = 0; c < u2.length + 20; c++) l.b ^= u2.charCodeAt(c) | 0, l.next();
      }
      function o(i, l) {
        return l.a = i.a, l.b = i.b, l.c = i.c, l.d = i.d, l;
      }
      function s(i, l) {
        var u2 = new a(i), c = l && l.state, f = function() {
          return (u2.next() >>> 0) / 4294967296;
        };
        return f.double = function() {
          do
            var h = u2.next() >>> 11, p = (u2.next() >>> 0) / 4294967296, d = (h + p) / (1 << 21);
          while (d === 0);
          return d;
        }, f.int32 = u2.next, f.quick = f, c && (typeof c == "object" && o(c, u2), f.state = function() {
          return o(u2, {});
        }), f;
      }
      r && r.exports ? r.exports = s : n && n.amd ? n(function() {
        return s;
      }) : this.tychei = s;
    })(pg, e, false);
  }), pMe = {}, dMe = { __proto__: null, default: pMe }, vMe = oMe(dMe), vg = dg(function(e) {
    (function(t, r, n) {
      var a = 256, o = 6, s = 52, i = "random", l = n.pow(a, o), u2 = n.pow(2, s), c = u2 * 2, f = a - 1, h;
      function p(y, w, _4) {
        var k = [];
        w = w == true ? { entropy: true } : w || {};
        var T3 = g(m(w.entropy ? [y, b(r)] : y ?? x(), 3), k), A3 = new d(k), S3 = function() {
          for (var C3 = A3.g(o), E3 = l, F13 = 0; C3 < u2; ) C3 = (C3 + F13) * a, E3 *= a, F13 = A3.g(1);
          for (; C3 >= c; ) C3 /= 2, E3 /= 2, F13 >>>= 1;
          return (C3 + F13) / E3;
        };
        return S3.int32 = function() {
          return A3.g(4) | 0;
        }, S3.quick = function() {
          return A3.g(4) / 4294967296;
        }, S3.double = S3, g(b(A3.S), r), (w.pass || _4 || function(C3, E3, F13, N3) {
          return N3 && (N3.S && v(N3, A3), C3.state = function() {
            return v(A3, {});
          }), F13 ? (n[i] = C3, E3) : C3;
        })(S3, T3, "global" in w ? w.global : this == n, w.state);
      }
      function d(y) {
        var w, _4 = y.length, k = this, T3 = 0, A3 = k.i = k.j = 0, S3 = k.S = [];
        for (_4 || (y = [_4++]); T3 < a; ) S3[T3] = T3++;
        for (T3 = 0; T3 < a; T3++) S3[T3] = S3[A3 = f & A3 + y[T3 % _4] + (w = S3[T3])], S3[A3] = w;
        (k.g = function(C3) {
          for (var E3, F13 = 0, N3 = k.i, D3 = k.j, I3 = k.S; C3--; ) E3 = I3[N3 = f & N3 + 1], F13 = F13 * a + I3[f & (I3[N3] = I3[D3 = f & D3 + E3]) + (I3[D3] = E3)];
          return k.i = N3, k.j = D3, F13;
        })(a);
      }
      function v(y, w) {
        return w.i = y.i, w.j = y.j, w.S = y.S.slice(), w;
      }
      function m(y, w) {
        var _4 = [], k = typeof y, T3;
        if (w && k == "object") for (T3 in y) try {
          _4.push(m(y[T3], w - 1));
        } catch {
        }
        return _4.length ? _4 : k == "string" ? y : y + "\0";
      }
      function g(y, w) {
        for (var _4 = y + "", k, T3 = 0; T3 < _4.length; ) w[f & T3] = f & (k ^= w[f & T3] * 19) + _4.charCodeAt(T3++);
        return b(w);
      }
      function x() {
        try {
          var y;
          return h && (y = h.randomBytes) ? y = y(a) : (y = new Uint8Array(a), (t.crypto || t.msCrypto).getRandomValues(y)), b(y);
        } catch {
          var w = t.navigator, _4 = w && w.plugins;
          return [+/* @__PURE__ */ new Date(), t, _4, t.screen, b(r)];
        }
      }
      function b(y) {
        return String.fromCharCode.apply(0, y);
      }
      if (g(n.random(), r), e.exports) {
        e.exports = p;
        try {
          h = vMe;
        } catch {
        }
      } else n["seed" + i] = p;
    })(typeof self < "u" ? self : pg, [], Math);
  });
  vg.alea = sMe;
  vg.xor128 = lMe;
  vg.xorwow = uMe;
  vg.xorshift7 = cMe;
  vg.xor4096 = fMe;
  vg.tychei = hMe;
  var IM = vg;
  var NM = function() {
    function e(t, r, n, a, o) {
      this.mean = t, this.stdDev = r, this.dtype = n, this.nextVal = NaN, this.truncated = a, this.truncated && (this.upper = this.mean + this.stdDev * 2, this.lower = this.mean - this.stdDev * 2);
      var s = o || Math.random();
      this.random = IM.alea(s.toString());
    }
    return e.prototype.nextValue = function() {
      if (!isNaN(this.nextVal)) {
        var t = this.nextVal;
        return this.nextVal = NaN, t;
      }
      for (var r, n, a = false; !a; ) {
        var o = void 0, s = void 0, i = void 0;
        do
          o = 2 * this.random() - 1, s = 2 * this.random() - 1, i = o * o + s * s;
        while (i >= 1 || i === 0);
        var l = Math.sqrt(-2 * Math.log(i) / i);
        r = this.mean + this.stdDev * o * l, n = this.mean + this.stdDev * s * l, (!this.truncated || this.isValidTruncated(r)) && (a = true);
      }
      return (!this.truncated || this.isValidTruncated(n)) && (this.nextVal = this.convertValue(n)), this.convertValue(r);
    }, e.prototype.convertValue = function(t) {
      return this.dtype == null || this.dtype === "float32" ? t : Math.round(t);
    }, e.prototype.isValidTruncated = function(t) {
      return t <= this.upper && t >= this.lower;
    }, e;
  }(), mMe = function() {
    function e(t, r, n, a) {
      this.alpha = t, this.beta = 1 / r, this.dtype = n;
      var o = a || Math.random();
      this.randu = IM.alea(o.toString()), this.randn = new NM(0, 1, n, false, this.randu()), t < 1 ? this.d = t + 2 / 3 : this.d = t - 1 / 3, this.c = 1 / Math.sqrt(9 * this.d);
    }
    return e.prototype.nextValue = function() {
      for (var t, r, n, a, o, s; ; ) {
        do
          a = this.randn.nextValue(), s = 1 + this.c * a;
        while (s <= 0);
        if (s *= s * s, t = a * a, r = 1 - 0.331 * t * t, n = 0.5 * t + this.d * (1 - s + Math.log(s)), o = this.randu(), o < r || Math.log(o) < n) break;
      }
      return s = 1 / this.beta * this.d * s, this.alpha < 1 && (s *= Math.pow(this.randu(), 1 / this.alpha)), this.convertValue(s);
    }, e.prototype.convertValue = function(t) {
      return this.dtype === "float32" ? t : Math.round(t);
    }, e;
  }(), gMe = function() {
    function e(t, r, n, a) {
      var o = this;
      if (t === void 0 && (t = 0), r === void 0 && (r = 1), this.canReturnFloat = function() {
        return o.dtype == null || o.dtype === "float32";
      }, this.min = t, this.range = r - t, this.dtype = n, a == null && (a = Math.random()), typeof a == "number" && (a = a.toString()), !this.canReturnFloat() && this.range <= 1) throw new Error("The difference between " + t + " - " + r + " <= 1 and dtype is not float");
      this.random = IM.alea(a);
    }
    return e.prototype.convertValue = function(t) {
      return this.canReturnFloat() ? t : Math.round(t);
    }, e.prototype.nextValue = function() {
      return this.convertValue(this.min + this.range * this.random());
    }, e;
  }();
  function yMe(e, t, r, n, a) {
    if (r === void 0 && (r = 1), n === void 0 && (n = "float32"), r == null && (r = 1), n == null && (n = "float32"), n !== "float32" && n !== "int32") throw new Error("Unsupported data type " + n);
    for (var o = new mMe(t, r, n, a), s = Iv(e, n), i = 0; i < s.values.length; i++) s.values[i] = o.nextValue();
    return s.toTensor();
  }
  var xMe = Kr({ randomGamma_: yMe });
  function bMe(e, t, r, n, a) {
    if (t === void 0 && (t = 0), r === void 0 && (r = 1), n != null && n === "bool") throw new Error("Unsupported data type " + n);
    for (var o = new NM(t, r, n, false, a), s = Iv(e, n), i = 0; i < s.values.length; i++) s.values[i] = o.nextValue();
    return s.toTensor();
  }
  var _Me = Kr({ randomNormal_: bMe });
  function wMe(e, t, r, n, a) {
    t === void 0 && (t = 0), r === void 0 && (r = 1), n === void 0 && (n = "float32");
    for (var o = Iv(e, n), s = new gMe(t, r, null, a), i = 0; i < o.values.length; i++) o.values[i] = s.nextValue();
    return o.toTensor();
  }
  var FM = Kr({ randomUniform_: wMe });
  function Ey(e, t, r, n) {
    if (r === void 0 && (r = 1), n === void 0 && (n = "float32"), r === 0) throw new Error("Cannot have a step of zero");
    var a = { start: e, stop: t, step: r, dtype: n };
    return fn.runKernel($Ee, {}, a);
  }
  function kMe(e) {
    var t = gr(e, "input", "real"), r = { input: t };
    return fn.runKernel(HEe, r);
  }
  var I2 = Kr({ real_: kMe });
  function TMe(e) {
    var t = gr(e, "x", "reciprocal"), r = { x: t };
    return fn.runKernel(qEe, r);
  }
  var yG = Kr({ reciprocal_: TMe });
  function AMe(e) {
    var t = gr(e, "x", "relu"), r = { x: t };
    return fn.runKernel(XEe, r);
  }
  var L2 = Kr({ relu_: AMe });
  function SMe(e) {
    var t = gr(e, "x", "relu6"), r = { x: t };
    return fn.runKernel(JEe, r);
  }
  var OM = Kr({ relu6_: SMe });
  function EMe(e, t) {
    var r = gr(e, "x", "reverse"), n = { x: r }, a = { dims: t };
    return fn.runKernel(QEe, n, a);
  }
  var E0 = Kr({ reverse_: EMe });
  function DMe(e) {
    var t = gr(e, "x", "reverse");
    return Yr(t.rank === 1, function() {
      return "Error in reverse1D: x must be rank 1 but got rank " + t.rank + ".";
    }), E0(t, 0);
  }
  var CMe = Kr({ reverse1d_: DMe });
  function MMe(e, t) {
    var r = gr(e, "x", "reverse");
    return Yr(r.rank === 2, function() {
      return "Error in reverse2D: x must be rank 2 but got rank " + r.rank + ".";
    }), E0(r, t);
  }
  var IMe = Kr({ reverse2d_: MMe });
  function NMe(e, t) {
    var r = gr(e, "x", "reverse");
    return Yr(r.rank === 3, function() {
      return "Error in reverse3D: x must be rank 3 but got rank " + r.rank + ".";
    }), E0(r, t);
  }
  var FMe = Kr({ reverse3d_: NMe });
  function OMe(e, t) {
    var r = gr(e, "x", "reverse");
    return Yr(r.rank === 4, function() {
      return "Error in reverse4D: x must be rank 4 but got rank " + r.rank + ".";
    }), E0(r, t);
  }
  var PMe = Kr({ reverse4d_: OMe });
  function LMe(e) {
    var t = gr(e, "x", "round"), r = { x: t };
    return fn.runKernel(e4e, r);
  }
  var PM = Kr({ round_: LMe });
  function RMe(e) {
    var t = gr(e, "x", "rsqrt", "float32"), r = { x: t };
    return fn.runKernel(t4e, r);
  }
  var xG = Kr({ rsqrt_: RMe });
  function Pv(e, t, r, n) {
    if (n == null && (n = aM(e)), n === "complex64") throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");
    if (!qd(e) && !Array.isArray(e) && typeof e != "number" && typeof e != "boolean" && typeof e != "string") throw new Error("values passed to tensor(values) must be a number/boolean/string or an array of numbers/booleans/strings, or a TypedArray");
    if (t != null) {
      lW(t);
      var a = lh(t), o = lh(r);
      Yr(a === o, function() {
        return "Based on the provided shape, [" + t + "], the tensor should have " + (a + " values but has " + o);
      });
      for (var s = 0; s < r.length; ++s) {
        var i = r[s], l = s === r.length - 1 ? i !== lh(t.slice(s)) : true;
        Yr(r[s] === t[s] || !l, function() {
          return "Error creating a new Tensor. Inferred shape " + ("(" + r + ") does not match the provided ") + ("shape (" + t + "). ");
        });
      }
    }
    return !qd(e) && !Array.isArray(e) && (e = [e]), t = t || r, e = n !== "string" ? _W(e, n) : Zk(e, [], true), fn.makeTensor(e, t, n);
  }
  function el(e, t) {
    if ((qd(e) && t !== "string" || Array.isArray(e)) && t !== "complex64") throw new Error("Error creating a new Scalar: value must be a primitive (number|boolean|string)");
    if (t === "string" && qd(e) && !(e instanceof Uint8Array)) throw new Error("When making a scalar from encoded string, the value must be `Uint8Array`.");
    var r = [], n = [];
    return Pv(e, r, n, t);
  }
  function zMe(e) {
    var t = gr(e, "x", "selu"), r = { x: t };
    return fn.runKernel(a4e, r);
  }
  var bG = Kr({ selu_: zMe });
  function BMe(e, t, r, n, a, o, s) {
    o === void 0 && (o = [1, 1]), s === void 0 && (s = "NHWC");
    var i = gr(e, "x", "separableConv2d"), l = gr(t, "depthwiseFilter", "separableConv2d"), u2 = gr(r, "pointwiseFilter", "separableConv2d"), c = i, f = false;
    if (i.rank === 3 && (f = true, c = da(i, [1, i.shape[0], i.shape[1], i.shape[2]])), s === "NCHW") throw new Error("separableConv2d currently does not support dataFormat NCHW; only NHWC is supported");
    Yr(c.rank === 4, function() {
      return "Error in separableConv2d: input must be rank 4, but got " + ("rank " + c.rank + ".");
    }), Yr(l.rank === 4, function() {
      return "Error in separableConv2d: depthwise filter must be rank 4, but " + ("got rank " + l.rank + ".");
    }), Yr(u2.rank === 4, function() {
      return "Error in separableConv2d: pointwise filter must be rank 4, but " + ("got rank " + l.rank + ".");
    }), Yr(u2.shape[0] === 1, function() {
      return "Error in separableConv2d: the first dimension of pointwise filter " + (" must be 1, but got " + u2.shape[0] + ".");
    }), Yr(u2.shape[1] === 1, function() {
      return "Error in separableConv2d: the second dimension of pointwise " + ("filter must be 1, but got " + u2.shape[1] + ".");
    });
    var h = l.shape[2], p = l.shape[3];
    Yr(u2.shape[2] === h * p, function() {
      return "Error in separableConv2d: the third dimension of pointwise filter " + ("must be " + h * p + ", ") + ("but got " + u2.shape[2] + ".");
    });
    var d = Qk(c, l, n, a, s, o), v = 1, m = F22(d, u2, v, "valid", s);
    return f ? da(m, [m.shape[1], m.shape[2], m.shape[3]]) : m;
  }
  var UMe = Kr({ separableConv2d_: BMe });
  function VMe(e, t) {
    return Ps(this, void 0, void 0, function() {
      var r, n, a, o, s, i, c, l, u2, c, f;
      return ws(this, function(h) {
        switch (h.label) {
          case 0:
            return r = gr(e, "x", "setdiff1d"), n = gr(t, "y", "setdiff1d"), Yr(r.dtype === n.dtype, function() {
              return "x and y should have the same dtype, but got x (" + r.dtype + ") and y (" + n.dtype + ").";
            }), Yr(r.rank === 1, function() {
              return "x should be 1D tensor, but got x (" + r.shape + ").";
            }), Yr(n.rank === 1, function() {
              return "y should be 1D tensor, but got y (" + n.shape + ").";
            }), [4, r.data()];
          case 1:
            return a = h.sent(), [4, n.data()];
          case 2:
            for (o = h.sent(), s = new Set(o), i = 0, c = 0; c < a.length; c++) s.has(a[c]) || i++;
            for (l = new HC([i], r.dtype), u2 = new HC([i], "int32"), c = 0, f = 0; c < a.length; c++) s.has(a[c]) || (l.values[f] = a[c], u2.values[f] = c, f++);
            return [2, [l.toTensor(), u2.toTensor()]];
        }
      });
    });
  }
  var _G = VMe;
  function jMe(e) {
    var t = gr(e, "x", "sign"), r = { x: t };
    return fn.runKernel(l4e, r);
  }
  var wG = Kr({ sign_: jMe });
  function WMe(e) {
    var t = gr(e, "x", "sin", "float32"), r = { x: t };
    return fn.runKernel(o4e, r);
  }
  var kG = Kr({ sin_: WMe });
  function GMe(e) {
    var t = gr(e, "x", "sinh"), r = { x: t };
    return fn.runKernel(s4e, r);
  }
  var TG = Kr({ sinh_: GMe });
  function $Me(e, t, r) {
    var n = gr(e, "x", "slice1d");
    return Yr(n.rank === 1, function() {
      return "slice1d expects a rank-1 tensor, but got a rank-" + n.rank + " tensor";
    }), bl(n, [t], [r]);
  }
  var HMe = Kr({ slice1d_: $Me });
  function qMe(e, t, r) {
    var n = gr(e, "x", "slice2d");
    return Yr(n.rank === 2, function() {
      return "slice2d expects a rank-2 tensor, but got a rank-" + n.rank + " tensor";
    }), bl(n, t, r);
  }
  var XMe = Kr({ slice2d_: qMe });
  function KMe(e, t, r) {
    var n = gr(e, "x", "slice3d");
    return Yr(n.rank === 3, function() {
      return "slice3d expects a rank-3 tensor, but got a rank-" + n.rank + " tensor";
    }), bl(n, t, r);
  }
  var YMe = Kr({ slice3d_: KMe });
  function ZMe(e, t, r) {
    var n = gr(e, "x", "slice4d");
    return Yr(n.rank === 4, function() {
      return "slice4d expects a rank-4 tensor, but got a rank-" + n.rank + " tensor";
    }), bl(n, t, r);
  }
  var JMe = Kr({ slice4d_: ZMe });
  function QMe(e, t) {
    t === void 0 && (t = -1);
    var r = gr(e, "logits", "softmax", "float32");
    if (t === -1 && (t = r.rank - 1), t !== r.rank - 1) throw Error("Softmax along a non-last dimension is not yet supported. " + ("Logits was rank " + r.rank + " and dim was " + t));
    var n = { logits: r }, a = { dim: t };
    return fn.runKernel(v4e, n, a);
  }
  var AG = Kr({ softmax_: QMe });
  function e6e(e) {
    Yr(e.dtype === "complex64", function() {
      return "The dtype for tf.spectral.fft() must be complex64 " + ("but got " + e.dtype + ".");
    });
    var t = { input: e };
    return fn.runKernel(YSe, t);
  }
  var oT = Kr({ fft_: e6e });
  function t6e(e) {
    Yr(e.dtype === "complex64", function() {
      return "The dtype for tf.spectral.ifft() must be complex64 " + ("but got " + e.dtype + ".");
    });
    var t = { input: e };
    return fn.runKernel(oEe, t);
  }
  var N2 = Kr({ ifft_: t6e });
  function r6e(e) {
    var t = e.shape[e.shape.length - 1], r = e.size / t, n;
    if (t <= 2) {
      var a = da(e, [r, t]);
      n = N2(a);
    } else {
      var o = [r, 2 * (t - 1)], s = da(I2(e), [r, t]), i = da(rT(e), [r, t]), l = E0(bl(s, [0, 1], [r, t - 2]), 1), u2 = oo(E0(bl(i, [0, 1], [r, t - 2]), 1), el(-1)), c = Rf([s, l], 1), f = Rf([i, u2], 1), a = da(ug(c, f), [o[0], o[1]]);
      n = N2(a);
    }
    if (n = I2(n), e.rank === 3 && e.shape[0] !== 0) {
      var h = n, p = e.shape[0];
      n = da(n, [p, n.shape[0] / p, n.shape[1]]), h.dispose();
    }
    return n;
  }
  var LM = Kr({ irfft_: r6e });
  function n6e(e, t, r) {
    r === void 0 && (r = 0);
    var n = gr(e, "x", "split"), a = { x: n }, o = { numOrSizeSplits: t, axis: r };
    return fn.runKernel(d4e, a, o);
  }
  var Dy = Kr({ split_: n6e });
  function a6e(e, t) {
    Yr(e.dtype === "float32", function() {
      return "The dtype for rfft() must be real value but got " + e.dtype;
    });
    var r = e.shape[e.shape.length - 1], n = e.size / r, a;
    if (t != null && t < r) {
      var o = e.shape.map(function(g) {
        return 0;
      }), s = e.shape.map(function(g) {
        return g;
      });
      s[e.shape.length - 1] = t, a = bl(e, o, s), r = t;
    } else if (t != null && t > r) {
      var i = e.shape.map(function(g) {
        return g;
      });
      i[e.shape.length - 1] = t - r, a = Rf([e, fg(i)], e.shape.length - 1), r = t;
    } else a = e;
    var l = eT(a), u2 = da(ug(a, l), [n, r]), c = oT(u2), f = Math.floor(r / 2) + 1, h = I2(c), p = rT(c), d = Dy(h, [f, r - f], h.shape.length - 1), v = Dy(p, [f, r - f], p.shape.length - 1), m = a.shape.slice();
    return m[a.shape.length - 1] = f, da(ug(d[0], v[0]), m);
  }
  var sT = Kr({ rfft_: a6e });
  function i6e(e) {
    var t = gr(e, "x", "sqrt", "float32"), r = { x: t };
    return fn.runKernel(f4e, r);
  }
  var Kk = Kr({ sqrt_: i6e });
  function o6e(e, t) {
    var r, n = gr(e, "a", "squaredDifference"), a = gr(t, "b", "squaredDifference");
    r = ni(su(n, a), 2), n = r[0], a = r[1], Ec(n.shape, a.shape);
    var o = { a: n, b: a }, s = {};
    return fn.runKernel(_4e, o, s);
  }
  var RM = Kr({ squaredDifference_: o6e });
  function s6e(e, t) {
    var r = gr(e, "x", "squeeze");
    return da(r, jAe(r.shape, t).newShape);
  }
  var Cy = Kr({ squeeze_: s6e });
  function l6e(e, t) {
    t === void 0 && (t = 0);
    var r = jk(e, "tensors", "stack", "string_or_numeric");
    Yr(r.length >= 1, function() {
      return "Pass at least one tensor to tf.stack";
    }), r.length > 0 && Yr(t <= r[0].rank, function() {
      return "Axis must be <= rank of the tensor";
    });
    var n = r, a = { axis: t };
    return fn.runKernel(UEe, n, a);
  }
  var My = Kr({ stack_: l6e });
  function u6e(e, t) {
    t === void 0 && (t = 0);
    var r = gr(e, "x", "step"), n = { x: r }, a = { alpha: t };
    return fn.runKernel(L4e, n, a);
  }
  var SG = Kr({ step_: u6e });
  function c6e(e, t, r, n, a, o, s, i, l) {
    a === void 0 && (a = 0), o === void 0 && (o = 0), s === void 0 && (s = 0), i === void 0 && (i = 0), l === void 0 && (l = 0);
    var u2 = gr(e, "x", "stridedSlice", "string_or_numeric"), c = { x: u2 }, f = { begin: t, end: r, strides: n, beginMask: a, endMask: o, ellipsisMask: s, newAxisMask: i, shrinkAxisMask: l };
    return fn.runKernel(w4e, c, f);
  }
  var EG = Kr({ stridedSlice_: c6e });
  function f6e(e) {
    var t = gr(e, "x", "tan", "float32"), r = { x: t };
    return fn.runKernel(E4e, r);
  }
  var DG = Kr({ tan_: f6e });
  function zM(e, t, r) {
    var n = Fv(e, r);
    return Pv(e, t, n, r);
  }
  function Ph(e, t) {
    Iy(e);
    var r = Fv(e, t);
    if (r.length !== 1) throw new Error("tensor1d() requires values to be a flat/TypedArray");
    var n = null;
    return Pv(e, n, r, t);
  }
  function E2(e, t, r) {
    if (Iy(e), t != null && t.length !== 2) throw new Error("tensor2d() requires shape to have two numbers");
    var n = Fv(e, r);
    if (n.length !== 2 && n.length !== 1) throw new Error("tensor2d() requires values to be number[][] or flat/TypedArray");
    if (n.length === 1 && t == null) throw new Error("tensor2d() requires shape to be provided when `values` are a flat/TypedArray");
    return Pv(e, t, n, r);
  }
  function h6e(e, t, r) {
    if (Iy(e), t != null && t.length !== 3) throw new Error("tensor3d() requires shape to have three numbers");
    var n = Fv(e, r);
    if (n.length !== 3 && n.length !== 1) throw new Error("tensor3d() requires values to be number[][][] or flat/TypedArray");
    if (n.length === 1 && t == null) throw new Error("tensor3d() requires shape to be provided when `values` are a flat array");
    return Pv(e, t, n, r);
  }
  function p6e(e, t, r) {
    if (Iy(e), t != null && t.length !== 4) throw new Error("tensor4d() requires shape to have four numbers");
    var n = Fv(e, r);
    if (n.length !== 4 && n.length !== 1) throw new Error("tensor4d() requires values to be number[][][][] or flat/TypedArray");
    if (n.length === 1 && t == null) throw new Error("tensor4d() requires shape to be provided when `values` are a flat array");
    return Pv(e, t, n, r);
  }
  function d6e(e, t, r) {
    if (Iy(e), t != null && t.length !== 5) throw new Error("tensor5d() requires shape to have five numbers");
    var n = Fv(e, r);
    if (n.length !== 5 && n.length !== 1) throw new Error("tensor5d() requires values to be number[][][][][] or flat/TypedArray");
    if (n.length === 1 && t == null) throw new Error("tensor5d() requires shape to be provided when `values` are a flat array");
    return Pv(e, t, n, r);
  }
  function v6e(e, t, r) {
    if (Iy(e), t != null && t.length !== 6) throw new Error("tensor6d() requires shape to have six numbers");
    var n = Fv(e, r);
    if (n.length !== 6 && n.length !== 1) throw new Error("tensor6d() requires values to be number[][][][][][] or flat/TypedArray");
    if (n.length === 1 && t == null) throw new Error("tensor6d() requires shape to be provided when `values` are a flat array");
    return t = t || n, Pv(e, t, n, r);
  }
  function m6e(e, t, r) {
    t === void 0 && (t = 1), r === void 0 && (r = true);
    var n = gr(e, "x", "topk");
    if (n.rank === 0) throw new Error("topk() expects the input to be of rank 1 or higher");
    var a = n.shape[n.shape.length - 1];
    if (t < 0) throw new Error("'k' passed to topk() must be >= 0 but got " + t);
    if (t > a) throw new Error("'k' passed to topk() must be <= the last dimension (" + a + ") " + ("but got " + t));
    var o = { x: n }, s = { k: t, sorted: r }, i = ni(fn.runKernel(C4e, o, s), 2), l = i[0], u2 = i[1];
    return { values: l, indices: u2 };
  }
  var CG = Kr({ topk_: m6e });
  function g6e(e, t, r, n, a) {
    if (t === void 0 && (t = 0), r === void 0 && (r = 1), n != null && n === "bool") throw new Error("Unsupported data type $ { dtype }");
    for (var o = new NM(t, r, n, true, a), s = Iv(e, n), i = 0; i < s.values.length; i++) s.values[i] = o.nextValue();
    return s.toTensor();
  }
  var MG = Kr({ truncatedNormal_: g6e });
  function y6e(e, t) {
    t === void 0 && (t = 0);
    var r = gr(e, "x", "unique", "string_or_numeric");
    Yr(r.rank > 0, function() {
      return "The input tensor must be at least 1D";
    });
    var n = { x: r }, a = { axis: t }, o = ni(fn.runKernel(N4e, n, a), 2), s = o[0], i = o[1];
    return { values: s, indices: i };
  }
  var QC = Kr({ unique_: y6e });
  function x6e(e, t, r) {
    var n = gr(e, "x", "unsortedSegmentSum"), a = gr(t, "segmentIds", "unsortedSegmentSum", "int32");
    Yr(D2(r), function() {
      return "numSegments must be of dtype int";
    });
    var o = { x: n, segmentIds: a }, s = { numSegments: r };
    return fn.runKernel(O4e, o, s);
  }
  var b6e = Kr({ unsortedSegmentSum_: x6e });
  function _6e(e, t) {
    t === void 0 && (t = 0);
    var r = gr(e, "x", "unstack", "string_or_numeric");
    Yr(t >= -r.shape.length && t < r.shape.length, function() {
      return "Axis = " + t + " is not in [-" + r.shape.length + ", " + r.shape.length + ")";
    });
    var n = { value: r }, a = { axis: t };
    return fn.runKernel(F4e, n, a);
  }
  var lT = Kr({ unstack_: _6e });
  function w6e(e, t, r, n) {
    return t === void 0 && (t = true), fn.makeVariable(e, t, r, n);
  }
  function k6e(e, t) {
    for (var r = [], n = 0; n < t.length; n++) t[n] && r.push(n);
    for (var a = Iv(e, "int32"), o = Iv([r.length, e.length], "int32"), n = 0; n < r.length; n++) {
      var s = a.indexToLoc(r[n]), i = n * e.length;
      o.values.set(s, i);
    }
    return o.toTensor();
  }
  function T6e(e) {
    return Ps(this, void 0, void 0, function() {
      var t, r, n;
      return ws(this, function(a) {
        switch (a.label) {
          case 0:
            return t = gr(e, "condition", "whereAsync", "bool"), [4, t.data()];
          case 1:
            return r = a.sent(), n = k6e(t.shape, r), e !== t && t.dispose(), [2, n];
        }
      });
    });
  }
  var BM = T6e;
  function A6e(e, t, r) {
    return Ps(this, void 0, void 0, function() {
      var n, a, o, s, i, l, u2, c, f, h, p, d, v;
      return ws(this, function(m) {
        switch (m.label) {
          case 0:
            for (n = gr(e, "tensor", "boolMask"), a = gr(t, "mask", "boolMask", "bool"), o = r ?? 0, s = a.rank, i = n.shape, Yr(s > 0, function() {
              return "mask cannot be scalar";
            }), xp(i.slice(o, o + s), a.shape, "mask's shape must match the first K dimensions of tensor's shape,"), l = 1, u2 = o; u2 < o + s; u2++) l *= i[u2];
            return c = i.slice(0, o).concat([l], i.slice(o + s)), f = da(n, c), h = da(a, [-1]), [4, BM(h)];
          case 1:
            return p = m.sent(), d = Cy(p, [1]), v = qk(f, d, o), e !== n && n.dispose(), t !== a && a.dispose(), d.dispose(), f.dispose(), h.dispose(), p.dispose(), [2, v];
        }
      });
    });
  }
  var S6e = A6e;
  function E6e(e, t) {
    var r = gr(e, "x", "transpose");
    if (t == null && (t = r.shape.map(function(o, s) {
      return s;
    }).reverse()), Yr(r.rank === t.length, function() {
      return "Error in transpose: rank of input " + r.rank + " " + ("must match length of perm " + t + ".");
    }), t.forEach(function(o) {
      Yr(o >= 0 && o < r.rank, function() {
        return "All entries in 'perm' must be between 0 and " + (r.rank - 1) + (" but got " + t);
      });
    }), r.rank <= 1) return r.clone();
    var n = { x: r }, a = { perm: t };
    return fn.runKernel(I4e, n, a);
  }
  var Yk = Kr({ transpose_: E6e });
  function D6e(e, t, r, n) {
    t === void 0 && (t = "euclidean"), r === void 0 && (r = null), n === void 0 && (n = false), e = gr(e, "x", "norm");
    var a = IG(e, t, r), o = a.shape;
    if (n) {
      var s = Jk(r, e.shape);
      o = aT(a.shape, s);
    }
    return da(a, o);
  }
  function IG(e, t, r) {
    if (r === void 0 && (r = null), e.rank === 0) return Oh(e);
    if (e.rank !== 1 && r === null) return IG(da(e, [-1]), t, r);
    if (e.rank === 1 || typeof r == "number" || Array.isArray(r) && r.length === 1) {
      if (t === 1) return Qs(Oh(e), r);
      if (t === 1 / 0) return sg(Oh(e), r);
      if (t === -1 / 0) return Xk(Oh(e), r);
      if (t === "euclidean" || t === 2) return Kk(Qs(iT(Oh(e), el(2, "int32")), r));
      throw new Error("Error in norm: invalid ord value: " + t);
    }
    if (Array.isArray(r) && r.length === 2) {
      if (t === 1) return sg(Qs(Oh(e), r[0]), r[1] - 1);
      if (t === 1 / 0) return sg(Qs(Oh(e), r[1]), r[0]);
      if (t === -1 / 0) return Xk(Qs(Oh(e), r[1]), r[0]);
      if (t === "fro" || t === "euclidean") return Kk(Qs(P2(e), r));
      throw new Error("Error in norm: invalid ord value: " + t);
    }
    throw new Error("Error in norm: invalid axis: " + r);
  }
  var UM = Kr({ norm_: D6e });
  function C6e(e, t, r, n, a) {
    a === void 0 && (a = true);
    var o = gr(e, "v", "movingAverage"), s = gr(t, "x", "movingAverage"), i = gr(r, "decay", "movingAverage");
    r5e(o, s), Yr(Ny(o.shape, s.shape), function() {
      return "Shape mismatch in v and x";
    });
    var l = el(1), u2 = Jo(l, i), c = oo(Jo(s, o), u2);
    if (a) {
      Yr(n != null, function() {
        return "When using zeroDebias: true, step is required.";
      });
      var f = gr(n, "step", "movingAverage");
      c = qc(c, Jo(l, iT(i, f)));
    }
    return qu(o, c);
  }
  var M6e = Kr({ movingAverage_: C6e });
  function I6e(e, t, r) {
    var n = t.rank > 1 ? t.shape[t.rank - 1] : 1, a = t.rank > 1 ? t.rank - 1 : 1, o = "Must have updates.shape = indices.shape[:batchDim] + " + ("shape[sliceDim:], got updates.shape: " + r.shape) + (", indices.shape: " + t.shape + ", shape: " + e) + (", sliceDim: " + n + ", and batchDim: " + a + ".");
    if (r.rank < a) throw new Error(o + (" update.rank < " + a + ". "));
    if (e.length < n + (r.rank - a)) throw new Error(o + (" Output shape length < " + (n + (r.rank - a))));
    if (r.rank !== a + e.length - n) throw new Error(o + (" update.rank != " + (a + e.length - n)));
    for (var s = 0; s < a; ++s) if (r.shape[s] !== t.shape[s]) throw new Error(o + (" updates.shape[" + s + "] (" + r.shape[s] + ") != indices.shape[" + s + "] (" + t.shape[s] + ")."));
    for (var s = 0; s < r.rank - a; ++s) if (r.shape[s + a] !== e[s + n]) throw new Error(o + (" updates.shape[" + (s + a) + "] (" + r.shape[s + a] + ") != shape[" + (s + a) + "] (" + e[s + a] + ")"));
  }
  function N6e(e, t, r) {
    if (t.rank < 1) throw new Error("tf.scatterND() expects the indices to be rank 1 or higher," + (" but the rank was " + t.rank + "."));
    if (e.rank < 1) throw new Error("tf.scatterND() expects the updates to be rank 1 or higher," + (" but the rank was " + e.rank + "."));
    if (t.dtype !== "int32") throw new Error("The dtype of 'indices' should be int32, but got dtype: " + t.dtype);
    if (r.length < 1) throw new Error("Output rank must be greater or equal to 1, but got shape: " + r);
    if (r.length === 0) {
      if (t.size === 0) throw new Error("Indices specified for empty output. indices shape: " + t.shape);
      if (e.size === 0) throw new Error("Updates specified for empty output. updates shape: " + e.shape);
    }
    I6e(r, t, e);
  }
  function F6e(e, t, r) {
    var n = gr(e, "indices", "scatterND", "int32"), a = gr(t, "updates", "scatterND");
    N6e(a, n, r);
    var o = { indices: n, updates: a }, s = { shape: r };
    return fn.runKernel(r4e, o, s);
  }
  var NG = Kr({ scatterND_: F6e });
  function O6e(e, t, r, n) {
    if (e.dtype !== "int32") throw new Error("tf.sparseToDense() expects the indices to be int32 type," + (" but the dtype was " + e.dtype + "."));
    if (e.rank > 2) throw new Error("sparseIndices should be a scalar, vector, or matrix," + (" but got shape " + e.shape + "."));
    var a = e.rank > 0 ? e.shape[0] : 1, o = e.rank > 1 ? e.shape[1] : 1;
    if (r.length !== o) throw new Error("outputShape has incorrect number of elements:," + (" " + r.length + ", should be: " + o + "."));
    var s = t.size;
    if (!(t.rank === 0 || t.rank === 1 && s === a)) throw new Error("sparseValues has incorrect shape " + (t.shape + ", should be [] or [" + a + "]"));
    if (t.dtype !== n.dtype) throw new Error("sparseValues.dtype must match defaultValues.dtype");
  }
  function P6e(e, t, r, n) {
    n === void 0 && (n = 0);
    var a = gr(e, "sparseIndices", "sparseToDense", "int32"), o = gr(t, "sparseValues", "sparseToDense"), s = gr(n, "defaultValue", "sparseToDense", o.dtype);
    O6e(a, o, r, s);
    var i = { sparseIndices: a, sparseValues: o, defaultValue: s }, l = { outputShape: r };
    return fn.runKernel(b4e, i, l);
  }
  var VM = Kr({ sparseToDense_: P6e });
  function L6e(e, t) {
    var r = gr(t, "indices", "gatherND", "int32"), n = gr(e, "x", "gatherND", "string_or_numeric"), a = { params: n, indices: r };
    return fn.runKernel(nEe, a);
  }
  var FG = Kr({ gatherND_: L6e });
  function R6e(e, t) {
    if (t == null) return e.shape.slice();
    if (Ny(e.shape, t)) return t;
    if (e.shape.length === t.length) {
      for (var r = [], n = 0; n < e.shape.length; n++) t[n] == null && e.shape[n] != null ? r.push(e.shape[n]) : r.push(t[n]);
      return r;
    }
    return t;
  }
  function z6e(e, t, r, n) {
    var a = gr(e, "x", "dropout");
    if (Yr(a.dtype === "float32", function() {
      return "x has to be a floating point tensor since it's going to be " + ("scaled, but got a " + a.dtype + " tensor instead.");
    }), Yr(t >= 0 && t < 1, function() {
      return "rate must be a float in the range [0, 1), but got " + t + ".";
    }), t === 0) return e instanceof Pf ? a.clone() : a;
    var o = R6e(a, r), s = 1 - t, i = qc(yM(qu(FM(o, 0, 1, "float32", n), s)), s);
    return oo(a, i);
  }
  var B6e = Kr({ dropout_: z6e });
  function OG(e) {
    return Math.floor(Math.pow(2, Math.ceil(Math.log(e) / Math.log(2))));
  }
  function jM(e, t, r) {
    for (var n = 1 - e % 2, a = new Float32Array(e), o = 0; o < e; ++o) {
      var s = 2 * Math.PI * o / (e + n - 1);
      a[o] = t - r * Math.cos(s);
    }
    return Ph(a, "float32");
  }
  function U6e(e, t, r) {
    return r === void 0 && (r = 1), Ps(this, void 0, void 0, function() {
      var n, a, o, s, i, l, u2, c, f, h, p, d, v, m, m;
      return ws(this, function(g) {
        switch (g.label) {
          case 0:
            return n = gr(e, "predictions", "inTopK"), a = gr(t, "targets", "inTopK"), Yr(n.rank > 1, function() {
              return "inTopK() expects the predictions to be of rank 2 or higher, " + ("but got " + n.rank);
            }), Yr(n.rank - 1 === a.rank, function() {
              return "predictions rank should be 1 larger than targets rank, but got predictions rank " + (n.rank + " and targets rank " + a.rank);
            }), xp(n.shape.slice(0, n.shape.length - 1), a.shape, "predictions's shape should be align with the targets' shape, except the last dimension."), o = n.shape[n.shape.length - 1], Yr(r > 0 && r <= o, function() {
              return "'k' passed to inTopK() must be > 0 && <= the predictions last " + ("dimension (" + o + "), but got " + r);
            }), [4, n.data()];
          case 1:
            return s = g.sent(), [4, a.data()];
          case 2:
            for (i = g.sent(), l = ni([s.length / o, o], 2), u2 = l[0], c = l[1], f = WAe("bool", u2), h = 0; h < u2; h++) {
              for (p = h * c, d = s.subarray(p, p + c), v = [], m = 0; m < d.length; m++) v.push({ value: d[m], index: m });
              for (v.sort(function(x, b) {
                return b.value - x.value;
              }), f[h] = 0, m = 0; m < r; m++) if (v[m].index === i[h]) {
                f[h] = 1;
                break;
              }
            }
            return e !== n && n.dispose(), t !== a && a.dispose(), [2, zM(f, a.shape, "bool")];
        }
      });
    });
  }
  var V6e = U6e;
  function j6e(e, t, r, n, a, o, s) {
    o === void 0 && (o = "NHWC");
    var i = e;
    e.rank === 3 && (i = da(e, [1, e.shape[0], e.shape[1], e.shape[2]]));
    var l = t;
    l.rank === 3 && (l = da(t, [1, t.shape[0], t.shape[1], t.shape[2]])), Yr(i.rank === 4, function() {
      return "Error in conv2dDerFilter: input must be rank 4, but got shape " + (i.shape + ".");
    }), Yr(l.rank === 4, function() {
      return "Error in conv2dDerFilter: dy must be rank 4, but got shape " + (l.shape + ".");
    }), Yr(r.length === 4, function() {
      return "Error in conv2dDerFilter: filterShape must be length 4, but got " + (r + ".");
    });
    var u2 = o === "NHWC" ? i.shape[3] : i.shape[1], c = o === "NHWC" ? l.shape[3] : l.shape[1];
    Yr(u2 === r[2], function() {
      return "Error in conv2dDerFilter: depth of input " + u2 + ") must " + ("match input depth in filter (" + r[2] + ".");
    }), Yr(c === r[3], function() {
      return "Error in conv2dDerFilter: depth of dy (" + c + ") must " + ("match output depth for filter (" + r[3] + ").");
    }), hd("conv2dDerFilter", a, s);
    var f = { x: i, dy: l }, h = { strides: n, pad: a, dataFormat: o, dimRoundingMode: s, filterShape: r };
    return fn.runKernel(ESe, f, h);
  }
  var W6e = Kr({ conv2DBackpropFilter_: j6e });
  function WM(e, t, r) {
    if (r == null || r === "linear") return e;
    if (r === "relu") return oo(e, SG(t));
    throw new Error("Cannot compute gradient for fused activation " + r + ".");
  }
  function GM(e, t) {
    var r = t, n = EDe(e.shape, t.shape);
    return n.length > 0 && (r = Qs(r, n)), da(r, e.shape);
  }
  function $M(e, t, r, n) {
    if (t === "linear") return e;
    if (t === "relu") return L2(e);
    if (t === "elu") return gM(e);
    if (t === "relu6") return OM(e);
    if (t === "prelu") return CM(e, r);
    if (t === "leakyrelu") return bM(e, n);
    if (t === "sigmoid") return og(e);
    throw new Error("Unknown fused activation " + t + ".");
  }
  var HM = function(e, t) {
    var r = e > 0;
    return !r || t === "linear";
  };
  function G6e(e) {
    var t, r = e.x, n = e.filter, a = e.strides, o = e.pad, s = e.dataFormat, i = s === void 0 ? "NHWC" : s, l = e.dilations, u2 = l === void 0 ? [1, 1] : l, c = e.dimRoundingMode, f = e.bias, h = e.activation, p = h === void 0 ? "linear" : h, d = e.preluActivationWeights, v = e.leakyreluAlpha;
    if (p = p || "linear", HM(fn.state.gradientDepth, p) === false) {
      var m = F22(r, n, a, o, i, u2, c);
      return f != null && (m = qu(m, f)), $M(m, p, d, v);
    }
    var g = gr(r, "x", "conv2d", "float32"), x = gr(n, "filter", "conv2d", "float32"), b = g, y = false;
    g.rank === 3 && (y = true, b = da(g, [1, g.shape[0], g.shape[1], g.shape[2]])), Yr(b.rank === 4, function() {
      return "Error in fused conv2d: input must be rank 4, but got rank " + (b.rank + ".");
    }), Yr(x.rank === 4, function() {
      return "Error in fused conv2d: filter must be rank 4, but got rank " + (x.rank + ".");
    }), hd("fused conv2d", o, c), Yr(b.shape[3] === x.shape[2], function() {
      return "Error in conv2d: depth of input (" + b.shape[3] + ") must match " + ("input depth for filter " + x.shape[2] + ".");
    }), Yr(Ov(a, u2), function() {
      return "Error in conv2D: Either strides or dilations must be 1. " + ("Got strides " + a + " and dilations '" + u2 + "'");
    }), Yr(i === "NHWC", function() {
      return "Error in conv2d: got dataFormat of " + i + " but only NHWC is currently supported.";
    });
    var w = fM(b.shape, x.shape, a, u2, o, c), _4;
    f != null && (_4 = gr(f, "bias", "fused conv2d"), t = ni(su(_4, g), 1), _4 = t[0], Ec(w.outShape, _4.shape));
    var k;
    d != null && (k = gr(d, "prelu weights", "fused conv2d"));
    var T3 = function(F13, N3) {
      var D3 = ni(N3, 4), I3 = D3[0], O3 = D3[1], L3 = D3[2], V2 = D3[3], W2 = WM(F13, L3, p);
      Yr($k(u2), function() {
        return "Error in gradient of fused conv2D: dilation rates greater than 1 " + ("are not yet supported in gradients. Got dilations '" + u2 + "'");
      });
      var X2 = GW(O3.shape, W2, I3, a, o), Y2 = W6e(O3, W2, I3.shape, a, o), K2 = [X2, Y2];
      if (V2 != null) {
        var q = GM(V2, W2);
        K2.push(q);
      }
      return K2;
    }, A3 = { x: b, filter: x, bias: _4, preluActivationWeights: k }, S3 = { strides: a, pad: o, dataFormat: i, dilations: u2, dimRoundingMode: c, activation: p, leakyreluAlpha: v };
    if (f == null) {
      var C3 = S0(function(F13, N3, D3) {
        var I3 = fn.runKernel(Oj, A3, S3);
        return D3([N3, F13, I3]), y && (I3 = da(I3, [I3.shape[1], I3.shape[2], I3.shape[3]])), { value: I3, gradFunc: T3 };
      });
      return C3(b, x);
    } else {
      var E3 = S0(function(F13, N3, D3, I3) {
        var O3 = fn.runKernel(Oj, A3, S3);
        return I3([N3, F13, O3, D3]), y && (O3 = da(O3, [O3.shape[1], O3.shape[2], O3.shape[3]])), { value: O3, gradFunc: T3 };
      });
      return E3(b, x, _4);
    }
  }
  var PG = Kr({ fusedConv2d_: G6e });
  function $6e(e, t, r, n, a, o, s) {
    o === void 0 && (o = [1, 1]);
    var i = e;
    e.rank === 3 && (i = da(e, [1, e.shape[0], e.shape[1], e.shape[2]]));
    var l = t;
    l.rank === 3 && (l = da(t, [1, t.shape[0], t.shape[1], t.shape[2]]));
    var u2 = { x: i, dy: l }, c = { strides: n, pad: a, dimRoundingMode: s, dilations: o, filterShape: r };
    return fn.runKernel(zSe, u2, c);
  }
  var H6e = Kr({ depthwiseConv2dNativeBackpropFilter_: $6e });
  function q6e(e, t, r, n, a, o, s) {
    o === void 0 && (o = [1, 1]);
    var i = t, l = false;
    t.rank === 3 && (l = true, i = da(t, [1, t.shape[0], t.shape[1], t.shape[2]]));
    var u2 = { dy: i, filter: r }, c = { strides: n, pad: a, dimRoundingMode: s, dilations: o, inputShape: e }, f = fn.runKernel(BSe, u2, c);
    return l ? da(f, [f.shape[1], f.shape[2], f.shape[3]]) : f;
  }
  var X6e = Kr({ depthwiseConv2dNativeBackpropInput_: q6e });
  function K6e(e) {
    var t, r = e.x, n = e.filter, a = e.strides, o = e.pad, s = e.dataFormat, i = s === void 0 ? "NHWC" : s, l = e.dilations, u2 = l === void 0 ? [1, 1] : l, c = e.dimRoundingMode, f = e.bias, h = e.activation, p = h === void 0 ? "linear" : h, d = e.preluActivationWeights, v = e.leakyreluAlpha;
    if (HM(fn.state.gradientDepth, p) === false) {
      var m = Qk(r, n, a, o, i, u2, c);
      return f != null && (m = qu(m, f)), $M(m, p, d, v);
    }
    var g = gr(r, "x", "depthwiseConv2d", "float32"), x = gr(n, "filter", "depthwiseConv2d", "float32"), b = g, y = false;
    g.rank === 3 && (y = true, b = da(g, [1, g.shape[0], g.shape[1], g.shape[2]])), Yr(b.rank === 4, function() {
      return "Error in fused depthwiseConv2d: input must be rank 4, but got " + ("rank " + b.rank + ".");
    }), Yr(x.rank === 4, function() {
      return "Error in fused depthwiseConv2d: filter must be rank 4, " + ("but got rank " + x.rank + ".");
    }), Yr(b.shape[3] === x.shape[2], function() {
      return "Error in fused depthwiseConv2d: number of input channels " + ("(" + b.shape[3] + ") must match the inChannels dimension in ") + ("filter " + x.shape[2] + ".");
    }), u2 == null && (u2 = [1, 1]), Yr(Ov(a, u2), function() {
      return "Error in fused depthwiseConv2d: Either strides or dilations must " + ("be 1. Got strides " + a + " and dilations '" + u2 + "'");
    }), hd("fused depthwiseConv2d", o, c);
    var w = fM(b.shape, x.shape, a, u2, o, c, true), _4;
    f != null && (_4 = gr(f, "bias", "fused conv2d"), t = ni(su(_4, g), 1), _4 = t[0], Ec(w.outShape, _4.shape));
    var k;
    d != null && (k = gr(d, "prelu weights", "fused depthwiseConv2d"));
    var T3 = function(F13, N3) {
      Yr($k(u2), function() {
        return "Error in gradient of fused depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations " + ("'" + u2 + "'");
      });
      var D3 = ni(N3, 4), I3 = D3[0], O3 = D3[1], L3 = D3[2], V2 = D3[3], W2 = WM(F13, L3, p), X2 = X6e(O3.shape, W2, I3, a, o, u2, c), Y2 = H6e(O3, W2, I3.shape, a, o, u2, c);
      if (V2 != null) {
        var K2 = GM(_4, W2);
        return [X2, Y2, K2];
      }
      return [X2, Y2];
    }, A3 = { x: b, filter: x, bias: _4, preluActivationWeights: k }, S3 = { strides: a, pad: o, dataFormat: i, dilations: u2, dimRoundingMode: c, activation: p, leakyreluAlpha: v };
    if (f == null) {
      var C3 = S0(function(F13, N3, D3) {
        var I3 = fn.runKernel(Pj, A3, S3);
        return D3([N3, F13, I3]), y && (I3 = da(I3, [I3.shape[1], I3.shape[2], I3.shape[3]])), { value: I3, gradFunc: T3 };
      });
      return C3(b, x);
    } else {
      var E3 = S0(function(F13, N3, D3, I3) {
        var O3 = fn.runKernel(Pj, A3, S3);
        return I3([N3, F13, O3, D3]), y && (O3 = da(O3, [O3.shape[1], O3.shape[2], O3.shape[3]])), { value: O3, gradFunc: T3 };
      });
      return E3(b, x, _4);
    }
  }
  var LG = Kr({ fusedDepthwiseConv2d_: K6e });
  function Y6e(e) {
    var t, r, n = e.a, a = e.b, o = e.transposeA, s = o === void 0 ? false : o, i = e.transposeB, l = i === void 0 ? false : i, u2 = e.bias, c = e.activation, f = c === void 0 ? "linear" : c, h = e.preluActivationWeights, p = e.leakyreluAlpha;
    if (HM(fn.state.gradientDepth, f) === false) {
      var d = _s(n, a, s, l);
      return u2 != null && (d = qu(d, u2)), $M(d, f, h, p);
    }
    var v = gr(n, "a", "fused matMul"), m = gr(a, "b", "fused matMul");
    t = ni(su(v, m), 2), v = t[0], m = t[1];
    var g = s ? v.shape[v.rank - 2] : v.shape[v.rank - 1], x = l ? m.shape[m.rank - 1] : m.shape[m.rank - 2], b = s ? v.shape[v.rank - 1] : v.shape[v.rank - 2], y = l ? m.shape[m.rank - 2] : m.shape[m.rank - 1], w = v.shape.slice(0, -2), _4 = m.shape.slice(0, -2), k = lh(w), T3 = lh(_4);
    Yr(g === x, function() {
      return "Error in fused matMul: inner shapes (" + g + ") and (" + (x + ") of Tensors with shapes " + v.shape + " and ") + (m.shape + " and transposeA=" + s) + (" and transposeB=" + l + " must match.");
    });
    var A3 = Ec(v.shape.slice(0, -2), m.shape.slice(0, -2)), S3 = A3.concat([b, y]), C3 = s ? da(v, [k, g, b]) : da(v, [k, b, g]), E3 = l ? da(m, [T3, y, x]) : da(m, [T3, x, y]), F13;
    u2 != null && (F13 = gr(u2, "bias", "fused matMul"), r = ni(su(F13, v), 1), F13 = r[0], Ec(S3, F13.shape));
    var N3;
    h != null && (N3 = gr(h, "prelu weights", "fused matMul"));
    var D3 = function(W2, X2) {
      var Y2 = ni(X2, 4), K2 = Y2[0], q = Y2[1], re = Y2[2], R2 = Y2[3], z = WM(da(W2, re.shape), re, f), H2, te;
      if (!s && !l ? (H2 = _s(z, q, false, true), te = _s(K2, z, true, false)) : !s && l ? (H2 = _s(z, q, false, false), te = _s(z, K2, true, false)) : s && !l ? (H2 = _s(q, z, false, true), te = _s(K2, z, false, false)) : (H2 = _s(q, z, true, true), te = _s(z, K2, true, true)), u2 != null) {
        var j = GM(R2, z);
        return [H2, te, j];
      } else return [H2, te];
    }, I3 = { a: C3, b: E3, bias: F13, preluActivationWeights: N3 }, O3 = { transposeA: s, transposeB: l, activation: f, leakyreluAlpha: p };
    if (u2 == null) {
      var L3 = S0(function(W2, X2, Y2) {
        var K2 = fn.runKernel(Fj, I3, O3);
        return Y2([W2, X2, K2]), { value: da(K2, S3), gradFunc: D3 };
      });
      return L3(C3, E3);
    } else {
      var V2 = S0(function(W2, X2, Y2, K2) {
        var q = fn.runKernel(Fj, I3, O3);
        return K2([W2, X2, q, Y2]), { value: da(q, S3), gradFunc: D3 };
      });
      return V2(C3, E3, F13);
    }
  }
  var RG = Kr({ fusedMatMul_: Y6e });
  var Z6e = { __proto__: null, conv2d: PG, depthwiseConv2d: LG, matMul: RG };
  function J6e(e) {
    return jM(e, 0.54, 0.46);
  }
  var Q6e = Kr({ hammingWindow_: J6e });
  function eIe(e) {
    return jM(e, 0.5, 0.5);
  }
  var zG = Kr({ hannWindow_: eIe });
  function tIe(e, t, r, n, a) {
    n === void 0 && (n = false), a === void 0 && (a = 0);
    for (var o = 0, s = []; o + t <= e.size; ) s.push(bl(e, o, t)), o += r;
    if (n) for (; o < e.size; ) {
      var i = o + t - e.size, l = Rf([bl(e, o, t - i), tT([i], a)]);
      s.push(l), o += r;
    }
    return s.length === 0 ? E2([], [0, t]) : da(Rf(s), [s.length, t]);
  }
  var BG = Kr({ frame_: tIe });
  function rIe(e, t, r, n, a) {
    a === void 0 && (a = zG), n == null && (n = OG(t));
    var o = BG(e, t, r), s = oo(o, a(t));
    return sT(s, n);
  }
  var nIe = Kr({ stft_: rIe });
  function aIe(e, t, r, n, a, o) {
    a === void 0 && (a = "bilinear"), o === void 0 && (o = 0);
    var s = gr(e, "image", "cropAndResize"), i = gr(t, "boxes", "cropAndResize", "float32"), l = gr(r, "boxInd", "cropAndResize", "int32"), u2 = i.shape[0];
    Yr(s.rank === 4, function() {
      return "Error in cropAndResize: image must be rank 4," + ("but got rank " + s.rank + ".");
    }), Yr(i.rank === 2 && i.shape[1] === 4, function() {
      return "Error in cropAndResize: boxes must be have size [" + u2 + ",4] " + ("but had shape " + i.shape + ".");
    }), Yr(l.rank === 1 && l.shape[0] === u2, function() {
      return "Error in cropAndResize: boxInd must be have size [" + u2 + "] " + ("but had shape " + i.shape + ".");
    }), Yr(n.length === 2, function() {
      return "Error in cropAndResize: cropSize must be of length 2, but got " + ("length " + n.length + ".");
    }), Yr(n[0] >= 1 && n[1] >= 1, function() {
      return "cropSize must be atleast [1,1], but was " + n;
    }), Yr(a === "bilinear" || a === "nearest", function() {
      return "method must be bilinear or nearest, but was " + a;
    });
    var c = { image: s, boxes: i, boxInd: l }, f = { method: a, extrapolationValue: o, cropSize: n }, h = fn.runKernel(OSe, c, f);
    return h;
  }
  var iIe = Kr({ cropAndResize_: aIe });
  function oIe(e) {
    var t = gr(e, "image", "flipLeftRight", "float32");
    Yr(t.rank === 4, function() {
      return "Error in flipLeftRight: image must be rank 4," + ("but got rank " + t.rank + ".");
    });
    var r = { image: t }, n = fn.runKernel(JSe, r, {});
    return n;
  }
  var sIe = Kr({ flipLeftRight_: oIe });
  function lIe(e) {
    var t = gr(e, "image", "grayscaleToRGB"), r = t.rank - 1, n = t.shape[r];
    Yr(t.rank >= 2, function() {
      return "Error in grayscaleToRGB: images must be at least rank 2, " + ("but got rank " + t.rank + ".");
    }), Yr(n === 1, function() {
      return "Error in grayscaleToRGB: last dimension of a grayscale image " + ("should be size 1, but got size " + n + ".");
    });
    var a = new Array(t.rank);
    return a.fill(1, 0, r), a[r] = 3, ky(t, a);
  }
  var uIe = Kr({ grayscaleToRGB_: lIe });
  function cIe(e, t, r, n) {
    r === void 0 && (r = 0), n === void 0 && (n = 0.5);
    var a = gr(e, "image", "rotateWithOffset", "float32");
    Yr(a.rank === 4, function() {
      return "Error in rotateWithOffset: image must be rank 4," + ("but got rank " + a.rank + ".");
    });
    var o = { image: a }, s = { radians: t, fillValue: r, center: n }, i = fn.runKernel(R4e, o, s);
    return i;
  }
  var fIe = Kr({ rotateWithOffset_: cIe });
  function Oy(e, t, r, n, a, o) {
    n == null && (n = 0.5), a == null && (a = Number.NEGATIVE_INFINITY), o == null && (o = 0);
    var s = e.shape[0];
    return r = Math.min(r, s), Yr(0 <= n && n <= 1, function() {
      return "iouThreshold must be in [0, 1], but was '" + n + "'";
    }), Yr(e.rank === 2, function() {
      return "boxes must be a 2D tensor, but was of rank '" + e.rank + "'";
    }), Yr(e.shape[1] === 4, function() {
      return "boxes must have 4 columns, but 2nd dimension was " + e.shape[1];
    }), Yr(t.rank === 1, function() {
      return "scores must be a 1D tensor";
    }), Yr(t.shape[0] === s, function() {
      return "scores has incompatible shape with boxes. Expected " + s + ", " + ("but was " + t.shape[0]);
    }), Yr(0 <= o && o <= 1, function() {
      return "softNmsSigma must be in [0, 1], but was '" + o + "'";
    }), { maxOutputSize: r, iouThreshold: n, scoreThreshold: a, softNmsSigma: o };
  }
  function hIe(e, t, r, n, a) {
    n === void 0 && (n = 0.5), a === void 0 && (a = Number.NEGATIVE_INFINITY);
    var o = gr(e, "boxes", "nonMaxSuppression", "float32"), s = gr(t, "scores", "nonMaxSuppression", "float32"), i = Oy(o, s, r, n, a);
    r = i.maxOutputSize, n = i.iouThreshold, a = i.scoreThreshold;
    var l = { maxOutputSize: r, iouThreshold: n, scoreThreshold: a };
    return fn.runKernel(PEe, { boxes: o, scores: s }, l);
  }
  var pIe = Kr({ nonMaxSuppression_: hIe });
  function dIe(e, t, r) {
    var n = vIe(e, t, r), a = n < 0 ? -(n + 1) : n;
    e.splice(a, 0, t);
  }
  function vIe(e, t, r) {
    return gIe(e, t, r || mIe);
  }
  function mIe(e, t) {
    return e > t ? 1 : e < t ? -1 : 0;
  }
  function gIe(e, t, r) {
    for (var n = 0, a = e.length, o = 0, s = false; n < a; ) {
      o = n + (a - n >>> 1);
      var i = r(t, e[o]);
      i > 0 ? n = o + 1 : (a = o, s = !i);
    }
    return s ? n : -n - 1;
  }
  function yIe(e, t, r, n, a) {
    return qM(e, t, r, n, a, 0);
  }
  function xIe(e, t, r, n, a, o) {
    return qM(e, t, r, n, a, 0, false, o, true);
  }
  function bIe(e, t, r, n, a, o) {
    return qM(e, t, r, n, a, o, true);
  }
  function qM(e, t, r, n, a, o, s, i, l) {
    s === void 0 && (s = false), i === void 0 && (i = false), l === void 0 && (l = false);
    for (var u2 = [], c = 0; c < t.length; c++) t[c] > a && u2.push({ score: t[c], boxIndex: c, suppressBeginIndex: 0 });
    u2.sort(Kj);
    for (var f = o > 0 ? -0.5 / o : 0, h = [], p = []; h.length < r && u2.length > 0; ) {
      var d = u2.pop(), v = d.score, m = d.boxIndex, g = d.suppressBeginIndex;
      if (v < a) break;
      for (var x = false, b = h.length - 1; b >= g; --b) {
        var y = _Ie(e, m, h[b]);
        if (y >= n) {
          x = true;
          break;
        }
        if (d.score = d.score * wIe(n, f, y), d.score <= a) break;
      }
      d.suppressBeginIndex = h.length, x || (d.score === v ? (h.push(m), p.push(d.score)) : d.score > a && dIe(u2, d, Kj));
    }
    var w = h.length, _4 = r - w;
    i && _4 > 0 && (h.push.apply(h, Sc(new Array(_4).fill(0))), p.push.apply(p, Sc(new Array(_4).fill(0))));
    var k = { selectedIndices: h };
    return s && (k.selectedScores = p), l && (k.validOutputs = w), k;
  }
  function _Ie(e, t, r) {
    var n = e.subarray(t * 4, t * 4 + 4), a = e.subarray(r * 4, r * 4 + 4), o = Math.min(n[0], n[2]), s = Math.min(n[1], n[3]), i = Math.max(n[0], n[2]), l = Math.max(n[1], n[3]), u2 = Math.min(a[0], a[2]), c = Math.min(a[1], a[3]), f = Math.max(a[0], a[2]), h = Math.max(a[1], a[3]), p = (i - o) * (l - s), d = (f - u2) * (h - c);
    if (p <= 0 || d <= 0) return 0;
    var v = Math.max(o, u2), m = Math.max(s, c), g = Math.min(i, f), x = Math.min(l, h), b = Math.max(g - v, 0) * Math.max(x - m, 0);
    return b / (p + d - b);
  }
  function wIe(e, t, r) {
    var n = Math.exp(t * r * r);
    return r <= e ? n : 0;
  }
  function Kj(e, t) {
    return e.score - t.score || e.score === t.score && t.boxIndex - e.boxIndex;
  }
  function kIe(e, t, r, n, a) {
    return n === void 0 && (n = 0.5), a === void 0 && (a = Number.NEGATIVE_INFINITY), Ps(this, void 0, void 0, function() {
      var o, s, i, l, u2, c, f;
      return ws(this, function(h) {
        switch (h.label) {
          case 0:
            return o = gr(e, "boxes", "nonMaxSuppressionAsync"), s = gr(t, "scores", "nonMaxSuppressionAsync"), i = Oy(o, s, r, n, a), r = i.maxOutputSize, n = i.iouThreshold, a = i.scoreThreshold, [4, Promise.all([o.data(), s.data()])];
          case 1:
            return l = h.sent(), u2 = l[0], c = l[1], f = yIe(u2, c, r, n, a).selectedIndices, o !== e && o.dispose(), s !== t && s.dispose(), [2, Ph(f, "int32")];
        }
      });
    });
  }
  var TIe = kIe;
  function AIe(e, t, r, n, a, o) {
    n === void 0 && (n = 0.5), a === void 0 && (a = Number.NEGATIVE_INFINITY), o === void 0 && (o = 0);
    var s = gr(e, "boxes", "nonMaxSuppression"), i = gr(t, "scores", "nonMaxSuppression"), l = Oy(s, i, r, n, a, o);
    r = l.maxOutputSize, n = l.iouThreshold, a = l.scoreThreshold, o = l.softNmsSigma;
    var u2 = { boxes: s, scores: i }, c = { maxOutputSize: r, iouThreshold: n, scoreThreshold: a, softNmsSigma: o }, f = fn.runKernel(REe, u2, c);
    return { selectedIndices: f[0], selectedScores: f[1] };
  }
  var SIe = Kr({ nonMaxSuppressionWithScore_: AIe });
  function EIe(e, t, r, n, a, o) {
    return n === void 0 && (n = 0.5), a === void 0 && (a = Number.NEGATIVE_INFINITY), o === void 0 && (o = 0), Ps(this, void 0, void 0, function() {
      var s, i, l, u2, c, f, h, p, d;
      return ws(this, function(v) {
        switch (v.label) {
          case 0:
            return s = gr(e, "boxes", "nonMaxSuppressionAsync"), i = gr(t, "scores", "nonMaxSuppressionAsync"), l = Oy(s, i, r, n, a, o), r = l.maxOutputSize, n = l.iouThreshold, a = l.scoreThreshold, o = l.softNmsSigma, [4, Promise.all([s.data(), i.data()])];
          case 1:
            return u2 = v.sent(), c = u2[0], f = u2[1], h = bIe(c, f, r, n, a, o), p = h.selectedIndices, d = h.selectedScores, s !== e && s.dispose(), i !== t && i.dispose(), [2, { selectedIndices: Ph(p, "int32"), selectedScores: Ph(d) }];
        }
      });
    });
  }
  var DIe = EIe;
  function CIe(e, t, r, n, a, o) {
    n === void 0 && (n = 0.5), a === void 0 && (a = Number.NEGATIVE_INFINITY), o === void 0 && (o = false);
    var s = gr(e, "boxes", "nonMaxSuppression"), i = gr(t, "scores", "nonMaxSuppression"), l = Oy(s, i, r, n, a, null), u2 = l.maxOutputSize, c = l.iouThreshold, f = l.scoreThreshold, h = { boxes: s, scores: i }, p = { maxOutputSize: u2, iouThreshold: c, scoreThreshold: f, padToMaxOutputSize: o }, d = fn.runKernel(LEe, h, p);
    return { selectedIndices: d[0], validOutputs: d[1] };
  }
  var MIe = Kr({ nonMaxSuppressionPadded_: CIe });
  function IIe(e, t, r, n, a, o) {
    return n === void 0 && (n = 0.5), a === void 0 && (a = Number.NEGATIVE_INFINITY), o === void 0 && (o = false), Ps(this, void 0, void 0, function() {
      var s, i, l, u2, c, f, h, p, d, v, m, g;
      return ws(this, function(x) {
        switch (x.label) {
          case 0:
            return s = gr(e, "boxes", "nonMaxSuppressionAsync"), i = gr(t, "scores", "nonMaxSuppressionAsync"), l = Oy(s, i, r, n, a, null), u2 = l.maxOutputSize, c = l.iouThreshold, f = l.scoreThreshold, [4, Promise.all([s.data(), i.data()])];
          case 1:
            return h = ni.apply(void 0, [x.sent(), 2]), p = h[0], d = h[1], v = xIe(p, d, u2, c, f, o), m = v.selectedIndices, g = v.validOutputs, s !== e && s.dispose(), i !== t && i.dispose(), [2, { selectedIndices: Ph(m, "int32"), validOutputs: el(g, "int32") }];
        }
      });
    });
  }
  var NIe = IIe;
  function FIe(e, t, r, n) {
    r === void 0 && (r = false), n === void 0 && (n = false);
    var a = gr(e, "images", "resizeBilinear");
    Yr(a.rank === 3 || a.rank === 4, function() {
      return "Error in resizeBilinear: x must be rank 3 or 4, but got " + ("rank " + a.rank + ".");
    }), Yr(t.length === 2, function() {
      return "Error in resizeBilinear: new shape must 2D, but got shape " + (t + ".");
    }), Yr(n === false || r === false, function() {
      return "Error in resizeBilinear: If halfPixelCenters is true, alignCorners must be false.";
    });
    var o = a, s = false;
    a.rank === 3 && (s = true, o = da(a, [1, a.shape[0], a.shape[1], a.shape[2]])), ni(t, 0);
    var i = { images: o }, l = { alignCorners: r, halfPixelCenters: n, size: t }, u2 = fn.runKernel(ZEe, i, l);
    return s ? da(u2, [u2.shape[1], u2.shape[2], u2.shape[3]]) : u2;
  }
  var OIe = Kr({ resizeBilinear_: FIe });
  function PIe(e, t, r, n) {
    r === void 0 && (r = false), n === void 0 && (n = false);
    var a = gr(e, "images", "resizeNearestNeighbor");
    Yr(a.rank === 3 || a.rank === 4, function() {
      return "Error in resizeNearestNeighbor: x must be rank 3 or 4, but got " + ("rank " + a.rank + ".");
    }), Yr(t.length === 2, function() {
      return "Error in resizeNearestNeighbor: new shape must 2D, but got shape " + (t + ".");
    }), Yr(a.dtype === "float32" || a.dtype === "int32", function() {
      return "`images` must have `int32` or `float32` as dtype";
    }), Yr(n === false || r === false, function() {
      return "Error in resizeNearestNeighbor: If halfPixelCenters is true, alignCorners must be false.";
    });
    var o = a, s = false;
    a.rank === 3 && (s = true, o = da(a, [1, a.shape[0], a.shape[1], a.shape[2]])), ni(t, 0);
    var i = { images: o }, l = { alignCorners: r, halfPixelCenters: n, size: t }, u2 = fn.runKernel(YEe, i, l);
    return s ? da(u2, [u2.shape[1], u2.shape[2], u2.shape[3]]) : u2;
  }
  var LIe = Kr({ resizeNearestNeighbor_: PIe });
  function RIe(e, t, r, n) {
    var a;
    t === void 0 && (t = "binary"), r === void 0 && (r = false), n === void 0 && (n = 0.5);
    var o = gr(e, "image", "threshold"), s = 0.2989, i = 0.587, l = 0.114, u2 = o.shape[0] * o.shape[1], c = oo(Ph([n]), 255), f, h, p, d;
    if (Yr(o.rank === 3, function() {
      return "Error in threshold: image must be rank 3," + ("but got rank " + o.rank + ".");
    }), Yr(o.shape[2] === 3 || o.shape[2] === 1, function() {
      return "Error in threshold: image color channel must be equal to 3 or 1" + ("but got " + o.shape[2] + ".");
    }), Yr(o.dtype === "int32" || o.dtype === "float32", function() {
      return "Error in dtype: image dtype must be int32 or float32," + ("but got dtype " + o.dtype + ".");
    }), Yr(t === "otsu" || t === "binary", function() {
      return "Method must be binary or otsu, but was " + t;
    }), o.shape[2] === 3) {
      a = ni(Dy(o, [1, 1, 1], -1), 3), f = a[0], h = a[1], p = a[2];
      var v = oo(f, s), m = oo(h, i), g = oo(p, l);
      d = qu(qu(v, m), g);
    } else d = e;
    if (t === "otsu") {
      var x = dM(ou(PM(d), "int32"), zM([]), 256);
      c = zIe(x, u2);
    }
    var b = r ? nT(d, c) : O2(d, c), y = ou(oo(b, 255), "int32");
    return y;
  }
  function zIe(e, t) {
    for (var r = Ph([-1]), n = Ph([0]), a = Ph([0]), o, s, i, l, u2, c, f = 0; f < e.size - 1; f++) {
      o = bl(e, 0, f + 1), s = bl(e, f + 1), u2 = qc(Qs(o), t), c = qc(Qs(s), t);
      var h = Qs(oo(o, Ey(0, o.size)));
      i = qc(h, Qs(o));
      var p = tT(s.shape, o.size), d = qu(Ey(0, s.size), p), v = oo(s, d);
      l = qc(Qs(v), Qs(s));
      var m = Jo(i, l), g = Jo(i, l), x = oo(u2, c);
      a = oo(oo(x, m), g);
      var b = O2(a, n);
      n = cg(b, a, n), r = cg(b, Ph([f]), r);
    }
    return r;
  }
  var BIe = Kr({ threshold_: RIe });
  function UIe(e, t, r, n, a, o) {
    r === void 0 && (r = "nearest"), n === void 0 && (n = "constant"), a === void 0 && (a = 0);
    var s = gr(e, "image", "transform", "float32"), i = gr(t, "transforms", "transform", "float32");
    Yr(s.rank === 4, function() {
      return "Error in transform: image must be rank 4," + ("but got rank " + s.rank + ".");
    }), Yr(i.rank === 2 && (i.shape[0] === s.shape[0] || i.shape[0] === 1) && i.shape[1] === 8, function() {
      return "Error in transform: Input transform should be batch x 8 or 1 x 8";
    }), Yr(o == null || o.length === 2, function() {
      return "Error in transform: outputShape must be [height, width] or null, " + ("but got " + o + ".");
    });
    var l = { image: s, transforms: i }, u2 = { interpolation: r, fillMode: n, fillValue: a, outputShape: o };
    return fn.runKernel(M4e, l, u2);
  }
  var VIe = Kr({ transform_: UIe });
  function jIe(e, t, r) {
    Yr(t % 1 === 0, function() {
      return "bandPart(): numLower must be an integer, got " + t + ".";
    }), Yr(r % 1 === 0, function() {
      return "bandPart(): numUpper must be an integer, got " + r + ".";
    });
    var n = gr(e, "a", "bandPart");
    Yr(n.rank >= 2, function() {
      return "bandPart(): Rank must be at least 2, got " + n.rank + ".";
    });
    var a = n.shape, o = ni(n.shape.slice(-2), 2), s = o[0], i = o[1];
    if (!(t <= s)) throw new Error("bandPart(): numLower (" + t + ")" + (" must not be greater than the number of rows (" + s + ")."));
    if (!(r <= i)) throw new Error("bandPart(): numUpper (" + r + ")" + (" must not be greater than the number of columns (" + i + ")."));
    t < 0 && (t = s), r < 0 && (r = i);
    var l = da(Ey(0, s, 1, "int32"), [-1, 1]), u2 = Ey(0, i, 1, "int32"), c = Jo(l, u2), f = C2(nT(c, el(+t, "int32")), xM(c, el(-r, "int32"))), h = fg([s, i], n.dtype);
    return da(My(lT(da(n, [-1, s, i])).map(function(p) {
      return cg(f, p, h);
    })), a);
  }
  var WIe = Kr({ bandPart_: jIe });
  function GIe(e) {
    var t;
    if (Array.isArray(e)) {
      t = false, Yr(e != null && e.length > 0, function() {
        return "Gram-Schmidt process: input must not be null, undefined, or empty";
      });
      for (var r = e[0].shape[0], n = function(l) {
        Yr(e[l].shape[0] === r, function() {
          return "Gram-Schmidt: Non-unique lengths found in the input vectors: " + ("(" + e[l].shape[0] + " vs. " + r + ")");
        });
      }, a = 1; a < e.length; ++a) n(a);
    } else t = true, e = Dy(e, e.shape[0], 0).map(function(l) {
      return Cy(l, [0]);
    });
    Yr(e.length <= e[0].shape[0], function() {
      return "Gram-Schmidt: Number of vectors (" + e.length + ") exceeds " + ("number of dimensions (" + e[0].shape[0] + ").");
    });
    for (var o = [], s = e, i = function(l) {
      o.push(fn.tidy(function() {
        var u2 = s[l];
        if (l > 0) for (var c = 0; c < l; ++c) {
          var f = oo(Qs(oo(o[c], u2)), o[c]);
          u2 = Jo(u2, f);
        }
        return qc(u2, UM(u2, "euclidean"));
      }));
    }, a = 0; a < e.length; ++a) i(a);
    return t ? My(o, 0) : o;
  }
  var $Ie = Kr({ gramSchmidt_: GIe });
  function HIe(e) {
    var t = kW(e);
    t.forEach(function(r) {
      return r.dispose();
    });
  }
  function qIe(e, t) {
    if (t === void 0 && (t = false), Yr(e.rank >= 2, function() {
      return "qr() requires input tensor to have a rank >= 2, but got rank " + e.rank;
    }), e.rank === 2) return Yj(e, t);
    var r = e.shape.slice(0, e.shape.length - 2).reduce(function(l, u2) {
      return l * u2;
    }), n = lT(da(e, [r, e.shape[e.shape.length - 2], e.shape[e.shape.length - 1]]), 0), a = [], o = [];
    n.forEach(function(l) {
      var u2 = ni(Yj(l, t), 2), c = u2[0], f = u2[1];
      a.push(c), o.push(f);
    });
    var s = da(My(a, 0), e.shape), i = da(My(o, 0), e.shape);
    return [s, i];
  }
  function Yj(e, t) {
    return t === void 0 && (t = false), fn.tidy(function() {
      Yr(e.shape.length === 2, function() {
        return "qr2d() requires a 2D Tensor, but got a " + e.shape.length + "D Tensor.";
      });
      for (var r = e.shape[0], n = e.shape[1], a = nG(r), o = wy(e), s = E2([[1]], [1, 1]), i = wy(s), l = r >= n ? n : r, u2 = function(f) {
        var h, p = o, d = i, v = a;
        h = ni(fn.tidy(function() {
          var m = bl(o, [f, f], [r - f, 1]), g = UM(m), x = bl(o, [f, f], [1, 1]), b = cg(O2(x, 0), E2([[-1]]), E2([[1]])), y = Jo(x, oo(b, g)), w = qc(m, y);
          w.shape[0] === 1 ? i = wy(s) : i = Rf([s, bl(w, [1, 0], [w.shape[0] - 1, w.shape[1]])], 0);
          var _4 = A0(qc(_s(b, y), g)), k = bl(o, [f, 0], [r - f, n]), T3 = oo(_4, i), A3 = Yk(i);
          if (f === 0) o = Jo(k, _s(T3, _s(A3, k)));
          else {
            var S3 = Jo(k, _s(T3, _s(A3, k)));
            o = Rf([bl(o, [0, 0], [f, n]), S3], 0);
          }
          var C3 = Yk(T3), E3 = bl(a, [0, f], [r, a.shape[1] - f]);
          if (f === 0) a = Jo(E3, _s(_s(E3, i), C3));
          else {
            var F13 = Jo(E3, _s(_s(E3, i), C3));
            a = Rf([bl(a, [0, 0], [r, f]), F13], 1);
          }
          return [i, o, a];
        }), 3), i = h[0], o = h[1], a = h[2], HIe([p, d, v]);
      }, c = 0; c < l; ++c) u2(c);
      return !t && r > n && (a = bl(a, [0, 0], [r, n]), o = bl(o, [0, 0], [n, n])), [a, o];
    });
  }
  var XIe = Kr({ qr_: qIe });
  var Lf;
  (function(e) {
    e[e.NONE = 0] = "NONE", e[e.MEAN = 1] = "MEAN", e[e.SUM = 2] = "SUM", e[e.SUM_BY_NONZERO_WEIGHTS = 3] = "SUM_BY_NONZERO_WEIGHTS";
  })(Lf || (Lf = {}));
  function KIe(e, t, r) {
    r === void 0 && (r = Lf.SUM_BY_NONZERO_WEIGHTS);
    var n = gr(e, "losses", "computeWeightedLoss"), a = null;
    t != null && (a = gr(t, "weights", "computeWeightedLoss"));
    var o = a == null ? n : oo(n, a);
    if (r === Lf.NONE) return o;
    if (r === Lf.SUM) return Qs(o);
    if (r === Lf.MEAN) {
      if (a == null) return M2(o);
      var s = n.size / a.size, i = qc(Qs(o), Qs(a));
      return s > 1 ? qc(i, el(s)) : i;
    }
    if (r === Lf.SUM_BY_NONZERO_WEIGHTS) {
      if (a == null) return qc(Qs(o), el(n.size));
      var l = oo(a, Mv(n.shape)), u2 = ou(Qs(EM(l, el(0))), "float32");
      return qc(Qs(o), u2);
    }
    throw Error("Unknown reduction: " + r);
  }
  var D0 = Kr({ computeWeightedLoss_: KIe });
  function YIe(e, t, r, n) {
    n === void 0 && (n = Lf.SUM_BY_NONZERO_WEIGHTS);
    var a = gr(e, "labels", "absoluteDifference"), o = gr(t, "predictions", "absoluteDifference"), s = null;
    r != null && (s = gr(r, "weights", "absoluteDifference")), xp(a.shape, o.shape, "Error in absoluteDifference: ");
    var i = Oh(Jo(a, o));
    return D0(i, s, n);
  }
  var ZIe = Kr({ absoluteDifference_: YIe });
  function JIe(e, t, r, n, a) {
    a === void 0 && (a = Lf.SUM_BY_NONZERO_WEIGHTS);
    var o = gr(e, "labels", "cosineDistance"), s = gr(t, "predictions", "cosineDistance"), i = null;
    n != null && (i = gr(n, "weights", "cosineDistance")), xp(o.shape, s.shape, "Error in cosineDistance: ");
    var l = el(1), u2 = Jo(l, Qs(oo(o, s), r, true));
    return D0(u2, i, a);
  }
  var QIe = Kr({ cosineDistance_: JIe });
  function eNe(e, t, r, n) {
    n === void 0 && (n = Lf.SUM_BY_NONZERO_WEIGHTS);
    var a = gr(e, "labels", "hingeLoss"), o = gr(t, "predictions", "hingeLoss"), s = null;
    r != null && (s = gr(r, "weights", "hingeLoss")), xp(a.shape, o.shape, "Error in hingeLoss: ");
    var i = el(1);
    a = Jo(oo(el(2), a), i);
    var l = L2(Jo(i, oo(a, o)));
    return D0(l, s, n);
  }
  var tNe = Kr({ hingeLoss_: eNe });
  function rNe(e, t, r, n, a) {
    n === void 0 && (n = 1), a === void 0 && (a = Lf.SUM_BY_NONZERO_WEIGHTS);
    var o = gr(e, "labels", "huberLoss"), s = gr(t, "predictions", "huberLoss"), i = null;
    r != null && (i = gr(r, "weights", "huberLoss")), xp(o.shape, s.shape, "Error in huberLoss: ");
    var l = el(n), u2 = Oh(Jo(s, o)), c = SM(u2, l), f = Jo(u2, c), h = qu(oo(el(0.5), P2(c)), oo(l, f));
    return D0(h, i, a);
  }
  var nNe = Kr({ huberLoss_: rNe });
  function aNe(e, t, r, n, a) {
    n === void 0 && (n = 1e-7), a === void 0 && (a = Lf.SUM_BY_NONZERO_WEIGHTS);
    var o = gr(e, "labels", "logLoss"), s = gr(t, "predictions", "logLoss"), i = null;
    r != null && (i = gr(r, "weights", "logLoss")), xp(o.shape, s.shape, "Error in logLoss: ");
    var l = el(1), u2 = el(n), c = A0(oo(o, Sy(qu(s, u2)))), f = oo(Jo(l, o), Sy(qu(Jo(l, s), u2))), h = Jo(c, f);
    return D0(h, i, a);
  }
  var iNe = Kr({ logLoss_: aNe });
  function oNe(e, t, r, n) {
    n === void 0 && (n = Lf.SUM_BY_NONZERO_WEIGHTS);
    var a = gr(e, "labels", "meanSquaredError"), o = gr(t, "predictions", "meanSquaredError"), s = null;
    r != null && (s = gr(r, "weights", "meanSquaredError")), xp(a.shape, o.shape, "Error in meanSquaredError: ");
    var i = RM(a, o);
    return D0(i, s, n);
  }
  var sNe = Kr({ meanSquaredError_: oNe });
  function lNe(e, t) {
    var r = gr(e, "labels", "sigmoidCrossEntropyWithLogits"), n = gr(t, "logits", "sigmoidCrossEntropyWithLogits");
    xp(r.shape, n.shape, "Error in sigmoidCrossEntropyWithLogits: ");
    var a = L2(n), o = oo(n, r), s = _M(Nv(A0(Oh(n))));
    return qu(Jo(a, o), s);
  }
  function uNe(e, t, r, n, a) {
    n === void 0 && (n = 0), a === void 0 && (a = Lf.SUM_BY_NONZERO_WEIGHTS);
    var o = gr(e, "multiClassLabels", "sigmoidCrossEntropy"), s = gr(t, "logits", "sigmoidCrossEntropy"), i = null;
    if (r != null && (i = gr(r, "weights", "sigmoidCrossEntropy")), xp(o.shape, s.shape, "Error in sigmoidCrossEntropy: "), n > 0) {
      var l = el(n), u2 = el(1), c = el(0.5);
      o = qu(oo(o, Jo(u2, l)), oo(c, l));
    }
    var f = lNe(o, s);
    return D0(f, i, a);
  }
  var cNe = Kr({ sigmoidCrossEntropy_: uNe });
  function fNe(e, t, r) {
    if (r === void 0 && (r = -1), r === -1 && (r = t.rank - 1), r !== t.rank - 1) throw Error("Softmax cross entropy along a non-last dimension is not yet " + ("supported. Labels / logits was rank " + t.rank + " ") + ("and dim was " + r));
    var n = S0(function(a, o, s) {
      var i = true, l = uG(o, [r], i), u2 = Jo(ou(o, "float32"), l);
      s([a, u2]);
      var c = A0(oo(u2, a)), f = Qs(c, [r]), h = function(p, d) {
        var v = ni(d, 2), m = v[0], g = v[1], x = aT(p.shape, [r]);
        return [oo(da(p, x), Jo(ou(m, "float32"), Nv(g))), oo(da(p, x), Jo(Nv(g), ou(m, "float32")))];
      };
      return { value: f, gradFunc: h };
    });
    return n(e, t);
  }
  function hNe(e, t, r, n, a) {
    n === void 0 && (n = 0), a === void 0 && (a = Lf.SUM_BY_NONZERO_WEIGHTS);
    var o = gr(e, "onehotLabels", "softmaxCrossEntropy"), s = gr(t, "logits", "softmaxCrossEntropy"), i = null;
    if (r != null && (i = gr(r, "weights", "softmaxCrossEntropy")), xp(o.shape, s.shape, "Error in softmaxCrossEntropy: "), n > 0) {
      var l = el(n), u2 = el(1), c = el(o.shape[1]);
      o = qu(oo(o, Jo(u2, l)), qc(l, c));
    }
    var f = fNe(o, s);
    return D0(f, i, a);
  }
  var pNe = Kr({ softmaxCrossEntropy_: hNe });
  function dNe(e, t, r, n) {
    var a = gr(e, "indices", "sparseFillEmptyRows", "int32"), o = gr(t, "values", "sparseFillEmptyRows"), s = gr(r, "denseShape", "sparseFillEmptyRows", "int32"), i = gr(n, "defaultValue", "sparseFillEmptyRows", o.dtype);
    if (a.rank !== 2) throw new Error(`Indices should be Tensor2D but received shape
        ` + a.shape);
    if (o.rank !== 1) throw new Error("Values should be Tensor1D but received shape " + o.shape);
    if (s.rank !== 1) throw new Error("Dense shape should be Tensor1D but received shape " + s.shape);
    if (i.rank !== 0) throw new Error("Default value should be a scalar but received shape " + i.shape);
    var l = { indices: a, values: o, denseShape: s, defaultValue: i }, u2 = fn.runKernel(m4e, l);
    return { outputIndices: u2[0], outputValues: u2[1], emptyRowIndicator: u2[2], reverseIndexMap: u2[3] };
  }
  var vNe = Kr({ sparseFillEmptyRows_: dNe });
  function mNe(e, t, r) {
    var n = gr(e, "inputIndices", "sparseReshape", "int32"), a = gr(t, "inputShape", "sparseReshape", "int32"), o = gr(r, "newShape", "sparseReshape", "int32");
    if (n.rank !== 2) throw new Error(`Input indices should be Tensor2D but received shape
        ` + n.shape);
    if (a.rank !== 1) throw new Error("Input shape should be Tensor1D but received shape " + a.shape);
    if (o.rank !== 1) throw new Error("New shape should be Tensor1D but received shape " + o.shape);
    var s = { inputIndices: n, inputShape: a, newShape: o }, i = fn.runKernel(g4e, s);
    return { outputIndices: i[0], outputShape: i[1] };
  }
  var gNe = Kr({ sparseReshape_: mNe });
  function yNe(e, t, r) {
    var n = gr(e, "data", "sparseSegmentMean"), a = gr(t, "indices", "sparseSegmentMean", "int32"), o = gr(r, "segmentIds", "sparseSegmentMean", "int32");
    if (n.rank < 1) throw new Error("Data should be at least 1 dimensional but received scalar");
    if (a.rank !== 1) throw new Error(`Indices should be Tensor1D but received shape
          ` + a.shape);
    if (o.rank !== 1) throw new Error(`Segment ids should be Tensor1D but received shape
          ` + o.shape);
    var s = { data: n, indices: a, segmentIds: o };
    return fn.runKernel(y4e, s);
  }
  var xNe = Kr({ sparseSegmentMean_: yNe });
  function bNe(e, t, r) {
    var n = gr(e, "data", "sparseSegmentSum"), a = gr(t, "indices", "sparseSegmentSum", "int32"), o = gr(r, "segmentIds", "sparseSegmentSum", "int32");
    if (n.rank < 1) throw new Error("Data should be at least 1 dimensional but received scalar");
    if (a.rank !== 1) throw new Error(`Indices should be Tensor1D but received shape
         ` + a.shape);
    if (o.rank !== 1) throw new Error(`Segment ids should be Tensor1D but received shape
         ` + o.shape);
    var s = { data: n, indices: a, segmentIds: o };
    return fn.runKernel(x4e, s);
  }
  var _Ne = Kr({ sparseSegmentSum_: bNe });
  function wNe(e, t, r, n, a, o, s, i) {
    var l = gr(e, "data", "stringNGrams", "string");
    if (l.dtype !== "string") throw new Error("Data must be of datatype string");
    if (l.shape.length !== 1) throw new Error("Data must be a vector, saw: " + l.shape);
    var u2 = gr(t, "dataSplits", "stringNGrams");
    if (u2.dtype !== "int32") throw new Error("Data splits must be of datatype int32");
    var c = { separator: r, nGramWidths: n, leftPad: a, rightPad: o, padWidth: s, preserveShortSequences: i }, f = { data: l, dataSplits: u2 }, h = fn.runKernel(k4e, f, c);
    return { nGrams: h[0], nGramsSplits: h[1] };
  }
  var kNe = Kr({ stringNGrams_: wNe });
  function TNe(e, t, r) {
    r === void 0 && (r = true);
    var n = gr(e, "input", "stringSplit", "string"), a = gr(t, "delimiter", "stringSplit", "string");
    if (n.rank !== 1) throw new Error("Input should be Tensor1D but received shape " + n.shape);
    if (a.rank !== 0) throw new Error("Delimiter should be a scalar but received shape " + a.shape);
    var o = { skipEmpty: r }, s = { input: n, delimiter: a }, i = fn.runKernel(T4e, s, o);
    return { indices: i[0], values: i[1], shape: i[2] };
  }
  var ANe = Kr({ stringSplit_: TNe });
  function SNe(e, t) {
    var r = gr(e, "input", "stringToHashBucketFast", "string"), n = { numBuckets: t };
    if (t <= 0) throw new Error("Number of buckets must be at least 1");
    var a = { input: r };
    return fn.runKernel(A4e, a, n);
  }
  var ENe = Kr({ stringToHashBucketFast_: SNe });
  var DNe = { fft: oT, ifft: N2, rfft: sT, irfft: LM }, CNe = { hammingWindow: Q6e, hannWindow: zG, frame: BG, stft: nIe }, lg = { flipLeftRight: sIe, grayscaleToRGB: uIe, resizeNearestNeighbor: LIe, resizeBilinear: OIe, rotateWithOffset: fIe, cropAndResize: iIe, nonMaxSuppression: pIe, nonMaxSuppressionAsync: TIe, nonMaxSuppressionWithScore: SIe, nonMaxSuppressionWithScoreAsync: DIe, nonMaxSuppressionPadded: MIe, nonMaxSuppressionPaddedAsync: NIe, threshold: BIe, transform: VIe }, MNe = { bandPart: WIe, gramSchmidt: $Ie, qr: XIe }, INe = { absoluteDifference: ZIe, computeWeightedLoss: D0, cosineDistance: QIe, hingeLoss: tNe, huberLoss: nNe, logLoss: iNe, meanSquaredError: sNe, sigmoidCrossEntropy: cNe, softmaxCrossEntropy: pNe }, A2 = { sparseFillEmptyRows: vNe, sparseReshape: gNe, sparseSegmentMean: xNe, sparseSegmentSum: _Ne }, Rk = { stringNGrams: kNe, stringSplit: ANe, stringToHashBucketFast: ENe };
  var NNe = { __proto__: null, abs: Oh, acos: EW, acosh: DW, add: qu, addN: CW, all: MW, any: IW, argMax: NW, argMin: FW, asin: OW, asinh: PW, atan: LW, atan2: RW, atanh: zW, avgPool: hM, avgPool3d: BW, basicLSTMCell: R5e, batchToSpaceND: pM, batchNorm: Ay, batchNorm2d: j5e, batchNorm3d: G5e, batchNorm4d: H5e, bincount: dM, broadcastArgs: UW, broadcastTo: S2, buffer: Iv, cast: ou, ceil: VW, clipByValue: jW, clone: wy, complex: ug, concat: Rf, concat1d: eDe, concat2d: rDe, concat3d: aDe, concat4d: oDe, conv1d: WW, conv2d: F22, conv2dTranspose: $W, conv3d: HW, conv3dTranspose: vDe, cos: qW, cosh: XW, cumsum: KW, denseBincount: YW, depthToSpace: ZW, depthwiseConv2d: Qk, diag: kDe, dilation2d: JW, div: qc, divNoNan: QW, dot: FDe, einsum: eG, elu: gM, equal: mM, erf: tG, exp: Nv, expandDims: Cv, expm1: rG, eye: nG, fill: tT, floor: yM, floorDiv: vM, gather: qk, greater: O2, greaterEqual: xM, imag: rT, isFinite: XDe, isInf: YDe, isNaN: aG, leakyRelu: bM, less: iG, lessEqual: nT, linspace: oG, localResponseNormalization: sG, log: Sy, log1p: _M, logSigmoid: sCe, logSoftmax: lG, logSumExp: uG, logicalAnd: C2, logicalNot: kM, logicalOr: TM, logicalXor: yCe, matMul: _s, max: sg, maxPool: AM, maxPool3d: cG, maxPoolWithArgmax: fG, maximum: hG, mean: M2, meshgrid: TCe, min: Xk, minimum: SM, mirrorPad: pG, mod: dG, moments: ICe, mul: oo, multiRNNCell: FCe, multinomial: vG, neg: A0, notEqual: EM, oneHot: mG, ones: Mv, onesLike: gG, outerProduct: BCe, pad: Fy, pad1d: jCe, pad2d: GCe, pad3d: HCe, pad4d: XCe, pool: QCe, pow: iT, prelu: CM, print: rMe, prod: MM, rand: iMe, randomGamma: xMe, randomNormal: _Me, randomUniform: FM, range: Ey, real: I2, reciprocal: yG, relu: L2, relu6: OM, reshape: da, reverse: E0, reverse1d: CMe, reverse2d: IMe, reverse3d: FMe, reverse4d: PMe, round: PM, rsqrt: xG, scalar: el, selu: bG, separableConv2d: UMe, setdiff1dAsync: _G, sigmoid: og, sign: wG, sin: kG, sinh: TG, slice: bl, slice1d: HMe, slice2d: XMe, slice3d: YMe, slice4d: JMe, softmax: AG, softplus: wM, spaceToBatchND: DM, fft: oT, ifft: N2, irfft: LM, rfft: sT, split: Dy, sqrt: Kk, square: P2, squaredDifference: RM, squeeze: Cy, stack: My, step: SG, stridedSlice: EG, sub: Jo, sum: Qs, tan: DG, tanh: Hk, tensor: zM, tensor1d: Ph, tensor2d: E2, tensor3d: h6e, tensor4d: p6e, tensor5d: d6e, tensor6d: v6e, tile: ky, topk: CG, truncatedNormal: MG, unique: QC, unsortedSegmentSum: b6e, unstack: lT, variable: w6e, where: cg, whereAsync: BM, zeros: fg, zerosLike: eT, op: Kr, OP_SCOPE_SUFFIX: SW, booleanMaskAsync: S6e, transpose: Yk, norm: UM, movingAverage: M6e, scatterND: NG, sparseToDense: VM, gatherND: FG, dropout: B6e, enclosingPowerOfTwo: OG, cosineWindow: jM, inTopKAsync: V6e, image: lg, linalg: MNe, losses: INe, spectral: DNe, fused: Z6e, signal: CNe, sparse: A2, string: Rk };
  var FNe = function(e, t, r) {
    switch (e.op) {
      case "BiasAdd":
      case "AddV2":
      case "Add":
        return [qu(Bt("a", e, t, r), Bt("b", e, t, r))];
      case "AddN":
        return [CW(Bt("tensors", e, t, r))];
      case "FloorMod":
      case "Mod":
        return [dG(Bt("a", e, t, r), Bt("b", e, t, r))];
      case "Mul":
        return [oo(Bt("a", e, t, r), Bt("b", e, t, r))];
      case "RealDiv":
      case "Div":
        return [qc(Bt("a", e, t, r), Bt("b", e, t, r))];
      case "DivNoNan":
        return [QW(Bt("a", e, t, r), Bt("b", e, t, r))];
      case "FloorDiv":
        return [vM(Bt("a", e, t, r), Bt("b", e, t, r))];
      case "Sub":
        return [Jo(Bt("a", e, t, r), Bt("b", e, t, r))];
      case "Minimum":
        return [SM(Bt("a", e, t, r), Bt("b", e, t, r))];
      case "Maximum":
        return [hG(Bt("a", e, t, r), Bt("b", e, t, r))];
      case "Pow":
        return [iT(Bt("a", e, t, r), Bt("b", e, t, r))];
      case "SquaredDifference":
        return [RM(Bt("a", e, t, r), Bt("b", e, t, r))];
      default:
        throw TypeError("Node type " + e.op + " is not implemented");
    }
  };
  var ONe = function(e, t, r) {
    switch (e.op) {
      case "Abs":
      case "ComplexAbs":
        return [Oh(Bt("x", e, t, r))];
      case "Acos":
        return [EW(Bt("x", e, t, r))];
      case "Acosh":
        return [DW(Bt("x", e, t, r))];
      case "Asin":
        return [OW(Bt("x", e, t, r))];
      case "Asinh":
        return [PW(Bt("x", e, t, r))];
      case "Atan":
        return [LW(Bt("x", e, t, r))];
      case "Atan2":
        return [RW(Bt("x", e, t, r), Bt("y", e, t, r))];
      case "Atanh":
        return [zW(Bt("x", e, t, r))];
      case "Ceil":
        return [VW(Bt("x", e, t, r))];
      case "Complex":
        return [ug(Bt("real", e, t, r), Bt("imag", e, t, r))];
      case "Cos":
        return [qW(Bt("x", e, t, r))];
      case "Cosh":
        return [XW(Bt("x", e, t, r))];
      case "Elu":
        return [gM(Bt("x", e, t, r))];
      case "Erf":
        return [tG(Bt("x", e, t, r))];
      case "Exp":
        return [Nv(Bt("x", e, t, r))];
      case "Expm1":
        return [rG(Bt("x", e, t, r))];
      case "Floor":
        return [yM(Bt("x", e, t, r))];
      case "Log":
        return [Sy(Bt("x", e, t, r))];
      case "Log1p":
        return [_M(Bt("x", e, t, r))];
      case "Imag":
        return [rT(Bt("x", e, t, r))];
      case "Neg":
        return [A0(Bt("x", e, t, r))];
      case "Reciprocal":
        return [yG(Bt("x", e, t, r))];
      case "Real":
        return [I2(Bt("x", e, t, r))];
      case "Relu":
        return [L2(Bt("x", e, t, r))];
      case "Round":
        return [PM(Bt("x", e, t, r))];
      case "Selu":
        return [bG(Bt("x", e, t, r))];
      case "Sigmoid":
        return [og(Bt("x", e, t, r))];
      case "Sin":
        return [kG(Bt("x", e, t, r))];
      case "Sign":
        return [wG(Bt("x", e, t, r))];
      case "Sinh":
        return [TG(Bt("x", e, t, r))];
      case "Softplus":
        return [wM(Bt("x", e, t, r))];
      case "Sqrt":
        return [Kk(Bt("x", e, t, r))];
      case "Square":
        return [P2(Bt("x", e, t, r))];
      case "Tanh":
        return [Hk(Bt("x", e, t, r))];
      case "Tan":
        return [DG(Bt("x", e, t, r))];
      case "ClipByValue":
        return [jW(Bt("x", e, t, r), Bt("clipValueMin", e, t, r), Bt("clipValueMax", e, t, r))];
      case "Relu6":
        return [OM(Bt("x", e, t, r))];
      case "Rsqrt":
        return [xG(sf(e.inputNames[0], t, r))];
      case "Prod":
        return [MM(Bt("x", e, t, r), Bt("axes", e, t, r))];
      case "LeakyRelu":
        return [bM(Bt("x", e, t, r), Bt("alpha", e, t, r))];
      case "Prelu":
        return [CM(Bt("x", e, t, r), Bt("alpha", e, t, r))];
      case "IsNan":
        return [aG(sf(e.inputNames[0], t, r))];
      default:
        throw TypeError("Node type " + e.op + " is not implemented");
    }
  };
  function dp(e, t, r) {
    if (r === void 0 && (r = ""), !(typeof e == "number" || typeof t == "number")) {
      ui.util.assert(e.length === t.length, function() {
        return r + (" Shapes " + e + " and " + t + " must match");
      });
      for (var n = 0; n < e.length; n++) {
        var a = e[n], o = t[n];
        ui.util.assert(a < 0 || o < 0 || a === o, function() {
          return r + (" Shapes " + e + " and " + t + " must match");
        });
      }
    }
  }
  function Zj(e) {
    return !(typeof e == "number" || e.some(function(t) {
      return t < 0;
    }));
  }
  function w2(e, t, r) {
    var n = eM(e, r), a = !Zj(n);
    if (a && t.length === 0) throw new Error("Tried to calculate elements of an empty list" + (" with non-fully-defined elementShape: " + n));
    if (a && t.forEach(function(o) {
      n = eM(o.shape, n);
    }), !Zj(n)) throw new Error("Non-fully-defined elementShape: " + n);
    return n;
  }
  function eM(e, t) {
    if (typeof e == "number") return t;
    if (typeof t == "number") return e;
    if (e.length !== t.length) throw new Error("Incompatible ranks during merge: " + e + " vs. " + t);
    for (var r = [], n = 0; n < e.length; ++n) {
      var a = e[n], o = t[n];
      if (a >= 0 && o >= 0 && a !== o) throw new Error("Incompatible shape during merge: " + e + " vs. " + t);
      r[n] = a >= 0 ? a : o;
    }
    return r;
  }
  var PNe = function() {
    function e(t, r, n, a, o, s, i) {
      this.name = t, this.dtype = r, this.maxSize = n, this.elementShape = a, this.identicalElementShapes = o, this.dynamicSize = s, this.clearAfterRead = i, this.tensors = [], this.closed_ = false, this.idTensor = ui.scalar(0), ui.keep(this.idTensor);
    }
    return Object.defineProperty(e.prototype, "id", { get: function() {
      return this.idTensor.id;
    }, enumerable: true, configurable: true }), Object.defineProperty(e.prototype, "closed", { get: function() {
      return this.closed_;
    }, enumerable: true, configurable: true }), e.prototype.clearAndClose = function(t) {
      this.tensors.forEach(function(r) {
        (t == null || !t.has(r.tensor.id)) && r.tensor.dispose();
      }), this.tensors = [], this.closed_ = true, this.idTensor.dispose();
    }, e.prototype.size = function() {
      return this.tensors.length;
    }, e.prototype.read = function(t) {
      if (this.closed_) throw new Error("TensorArray " + this.name + " has already been closed.");
      if (t < 0 || t >= this.size()) throw new Error("Tried to read from index " + t + ", but array size is: " + this.size());
      var r = this.tensors[t];
      if (r.cleared) throw new Error("TensorArray " + this.name + ": Could not read index " + t + " twice because it was cleared after a previous read (perhaps try setting clear_after_read = false?).");
      return this.clearAfterRead && (r.cleared = true), r.read = true, r.tensor;
    }, e.prototype.readMany = function(t) {
      var r = this;
      return t.map(function(n) {
        return r.read(n);
      });
    }, e.prototype.write = function(t, r) {
      if (this.closed_) throw new Error("TensorArray " + this.name + " has already been closed.");
      if (t < 0 || !this.dynamicSize && t >= this.maxSize) throw new Error("Tried to write to index " + t + ", but array is not resizeable and size is: " + this.maxSize);
      var n = this.tensors[t] || {};
      if (r.dtype !== this.dtype) throw new Error("TensorArray " + this.name + ": Could not write to TensorArray index " + t + `,
          because the value dtype is ` + r.dtype + ", but TensorArray dtype is " + this.dtype + ".");
      if (this.size() === 0 && (this.elementShape == null || this.elementShape.length === 0) && (this.elementShape = r.shape), dp(this.elementShape, r.shape, "TensorArray " + this.name + ": Could not write to TensorArray index " + t + "."), n.read) throw new Error("TensorArray " + this.name + ": Could not write to TensorArray index " + t + ", because it has already been read.");
      if (n.written) throw new Error("TensorArray " + this.name + ": Could not write to TensorArray index " + t + ", because it has already been written.");
      n.tensor = r, ui.keep(r), n.written = true, this.tensors[t] = n;
    }, e.prototype.writeMany = function(t, r) {
      var n = this;
      if (t.length !== r.length) throw new Error("TensorArray " + this.name + ": could not write multiple tensors," + ("because the index size: " + t.length + " is not the same as tensors size: " + r.length + "."));
      t.forEach(function(a, o) {
        return n.write(a, r[o]);
      });
    }, e.prototype.gather = function(t, r) {
      if (!!r && r !== this.dtype) throw new Error("TensorArray dtype is " + this.dtype + " but gather requested dtype " + r);
      if (t) t = t.slice(0, this.size());
      else {
        t = [];
        for (var n = 0; n < this.size(); n++) t.push(n);
      }
      if (t.length === 0) return ui.tensor([], [0].concat(this.elementShape));
      var a = this.readMany(t);
      return dp(this.elementShape, a[0].shape, "TensorArray shape mismatch: "), ui.stack(a, 0);
    }, e.prototype.concat = function(t) {
      if (!!t && t !== this.dtype) throw new Error("TensorArray dtype is " + this.dtype + " but concat requested dtype " + t);
      if (this.size() === 0) return ui.tensor([], [0].concat(this.elementShape));
      for (var r = [], n = 0; n < this.size(); n++) r.push(n);
      var a = this.readMany(r);
      return dp(this.elementShape, a[0].shape, "TensorArray shape mismatch: tensor array shape (" + this.elementShape + ") vs first tensor shape (" + a[0].shape + ")"), ui.concat(a, 0);
    }, e.prototype.scatter = function(t, r) {
      if (r.dtype !== this.dtype) throw new Error("TensorArray dtype is " + this.dtype + " but tensor has dtype " + r.dtype);
      if (t.length !== r.shape[0]) throw new Error("Expected len(indices) == tensor.shape[0], but saw: " + t.length + " vs. " + r.shape[0]);
      var n = Math.max.apply(Math, Sc(t));
      if (!this.dynamicSize && n >= this.maxSize) throw new Error("Max index must be < array size (" + n + "  vs. " + this.maxSize + ")");
      this.writeMany(t, ui.unstack(r, 0));
    }, e.prototype.split = function(t, r) {
      var n = this;
      if (r.dtype !== this.dtype) throw new Error("TensorArray dtype is " + this.dtype + " but tensor has dtype " + r.dtype);
      var a = 0, o = t.map(function(c) {
        return a += c, a;
      });
      if (a !== r.shape[0]) throw new Error(`Expected sum of lengths to be equal to
          tensor.shape[0], but sum of lengths is
        ` + a + ", and tensor's shape is: " + r.shape);
      if (!this.dynamicSize && t.length !== this.maxSize) throw new Error("TensorArray's size is not equal to the size of lengths (" + this.maxSize + " vs. " + t.length + "), and the TensorArray is not marked as dynamically resizeable");
      var s = a === 0 ? 0 : r.size / a, i = [];
      ui.tidy(function() {
        r = ui.reshape(r, [1, a, s]);
        for (var c = 0; c < t.length; ++c) {
          var f = c === 0 ? 0 : o[c - 1], h = [0, f, 0], p = [1, t[c], s];
          i[c] = ui.reshape(ui.slice(r, h, p), n.elementShape);
        }
        return i;
      });
      for (var l = [], u2 = 0; u2 < t.length; u2++) l[u2] = u2;
      this.writeMany(l, i);
    }, e;
  }(), uT = function() {
    function e(t, r, n, a) {
      a === void 0 && (a = -1), this.tensors = t, this.elementShape = r, this.elementDtype = n, t?.forEach(function(o) {
        if (n !== o.dtype) throw new Error("Invalid data types; op elements " + n + ", but list elements " + o.dtype);
        dp(r, o.shape, "TensorList shape mismatch: "), ui.keep(o);
      }), this.idTensor = ui.scalar(0), this.maxNumElements = a, ui.keep(this.idTensor);
    }
    return Object.defineProperty(e.prototype, "id", { get: function() {
      return this.idTensor.id;
    }, enumerable: true, configurable: true }), e.prototype.copy = function() {
      return new e(Sc(this.tensors), this.elementShape, this.elementDtype);
    }, e.prototype.clearAndClose = function(t) {
      this.tensors.forEach(function(r) {
        (t == null || !t.has(r.id)) && r.dispose();
      }), this.tensors.length = 0, this.idTensor.dispose();
    }, e.prototype.size = function() {
      return this.tensors.length;
    }, e.prototype.stack = function(t, r, n) {
      var a = this;
      if (n === void 0 && (n = -1), r !== this.elementDtype) throw new Error("Invalid data types; op elements " + r + ", but list elements " + this.elementDtype);
      if (n !== -1 && this.tensors.length !== n) throw new Error("Operation expected a list with " + n + " elements but got a list with " + this.tensors.length + " elements.");
      dp(t, this.elementShape, "TensorList shape mismatch: ");
      var o = w2(this.elementShape, this.tensors, t);
      return ui.tidy(function() {
        var s = a.tensors.map(function(i) {
          return ui.reshape(i, o);
        });
        return ui.stack(s, 0);
      });
    }, e.prototype.popBack = function(t, r) {
      if (r !== this.elementDtype) throw new Error("Invalid data types; op elements " + r + ", but list elements " + this.elementDtype);
      if (this.size() === 0) throw new Error("Trying to pop from an empty list.");
      var n = w2(this.elementShape, this.tensors, t), a = this.tensors.pop();
      return dp(a.shape, t, "TensorList shape mismatch: "), ui.reshape(a, n);
    }, e.prototype.pushBack = function(t) {
      if (t.dtype !== this.elementDtype) throw new Error("Invalid data types; op elements " + t.dtype + ", but list elements " + this.elementDtype);
      if (dp(t.shape, this.elementShape, "TensorList shape mismatch: "), this.maxNumElements === this.size()) throw new Error("Trying to push element into a full list.");
      ui.keep(t), this.tensors.push(t);
    }, e.prototype.resize = function(t) {
      if (t < 0) throw new Error("TensorListResize expects size to be non-negative. Got: " + t);
      if (this.maxNumElements !== -1 && t > this.maxNumElements) throw new Error("TensorListResize input size " + t + " is greater maxNumElement " + this.maxNumElements + ".");
      this.tensors.length = t;
    }, e.prototype.getItem = function(t, r, n) {
      if (n !== this.elementDtype) throw new Error("Invalid data types; op elements " + n + ", but list elements " + this.elementDtype);
      if (t < 0 || t > this.tensors.length) throw new Error("Trying to access element " + t + " in a list with " + this.tensors.length + " elements.");
      if (this.tensors[t] == null) throw new Error("element at index " + t + " is null.");
      dp(this.tensors[t].shape, r, "TensorList shape mismatch: ");
      var a = w2(this.elementShape, this.tensors, r);
      return ui.reshape(this.tensors[t], a);
    }, e.prototype.setItem = function(t, r) {
      if (r.dtype !== this.elementDtype) throw new Error("Invalid data types; op elements " + r.dtype + ", but list elements " + this.elementDtype);
      if (t < 0 || this.maxNumElements !== -1 && t >= this.maxNumElements) throw new Error("Trying to set element " + t + " in a list with max " + this.maxNumElements + " elements.");
      dp(this.elementShape, r.shape, "TensorList shape mismatch: "), ui.keep(r), this.tensors[t] = r;
    }, e.prototype.gather = function(t, r, n) {
      var a = this;
      if (r !== this.elementDtype) throw new Error("Invalid data types; op elements " + r + ", but list elements " + this.elementDtype);
      dp(this.elementShape, n, "TensorList shape mismatch: "), t = t.slice(0, this.size());
      var o = w2(this.elementShape, this.tensors, n);
      return t.length === 0 ? ui.tensor([], [0].concat(o)) : ui.tidy(function() {
        var s = t.map(function(i) {
          return ui.reshape(a.tensors[i], o);
        });
        return ui.stack(s, 0);
      });
    }, e.prototype.concat = function(t, r) {
      var n = this;
      if (!!t && t !== this.elementDtype) throw new Error("TensorList dtype is " + this.elementDtype + " but concat requested dtype " + t);
      dp(this.elementShape, r, "TensorList shape mismatch: ");
      var a = w2(this.elementShape, this.tensors, r);
      return this.size() === 0 ? ui.tensor([], [0].concat(a)) : ui.tidy(function() {
        var o = n.tensors.map(function(s) {
          return ui.reshape(s, a);
        });
        return ui.concat(o, 0);
      });
    }, e;
  }();
  function LNe(e, t, r) {
    var n = e.dtype;
    if (e.shape.length < 1) throw new Error("Tensor must be at least a vector, but saw shape: " + e.shape);
    if (e.dtype !== r) throw new Error("Invalid data types; op elements " + e.dtype + ", but list elements " + r);
    var a = e.shape.slice(1);
    dp(a, t, "TensorList shape mismatch: ");
    var o = ui.unstack(e);
    return new uT(o, t, n);
  }
  function RNe(e, t, r) {
    return new uT([], e, t, r);
  }
  function zNe(e, t, r, n) {
    if (t.length !== e.shape[0]) throw new Error("Expected len(indices) == tensor.shape[0], but saw: " + t.length + " vs. " + e.shape[0]);
    var a = Math.max.apply(Math, Sc(t));
    if (n != null && n !== -1 && a >= n) throw new Error("Max index must be < array size (" + a + "  vs. " + n + ")");
    var o = new uT([], r, e.dtype, n), s = ui.unstack(e, 0);
    return t.forEach(function(i, l) {
      o.setItem(i, s[l]);
    }), o;
  }
  function BNe(e, t, r) {
    var n = 0, a = t.map(function(f) {
      return n += f, n;
    });
    if (n !== e.shape[0]) throw new Error(`Expected sum of lengths to be equal to
          tensor.shape[0], but sum of lengths is
        ` + n + ", and tensor's shape is: " + e.shape);
    for (var o = e.shape.slice(1), s = eM(o, r), i = n === 0 ? 0 : e.size / n, l = ui.tidy(function() {
      var f = [];
      e = ui.reshape(e, [1, n, i]);
      for (var h = 0; h < t.length; ++h) {
        var p = h === 0 ? 0 : a[h - 1], d = [0, p, 0], v = [1, t[h], i];
        f[h] = ui.reshape(ui.slice(e, d, v), s);
      }
      return e.dispose(), f;
    }), u2 = new uT([], r, e.dtype, t.length), c = 0; c < l.length; c++) u2.setItem(c, l[c]);
    return u2;
  }
  var UNe = void 0, VNe = function(e, t, r) {
    return Ps(UNe, void 0, void 0, function() {
      var n, a, o, s, u2, h, i, l, u2, c, f, h, p, d, v, v, x, m, x, g, x, x, x, b, y, we, w, _4, k, T3, A3, S3, re, ce, C3, E3, R2, F13, j, Q2, N3, D3, I3, z, H2, O3, ue, L3, le, V2, me, be, W2, X2, Y2, K2, q, se, re, ce, Ae, se, R2, we, he, Ae, z, H2, we, Z2, Ae, we, ae, te, Z2, Ae, j, Q2, we, ae, Ae, se, we, ae, Z2, Ae, ne, we, ae, Ae, ue, Ae, le, we, se, ce, Ae, se, we, he, Ae, me, we, be, Ae;
      return ws(this, function(pe) {
        switch (pe.label) {
          case 0:
            switch (n = e.op, n) {
              case "If":
                return [3, 1];
              case "StatelessIf":
                return [3, 1];
              case "While":
                return [3, 3];
              case "StatelessWhile":
                return [3, 3];
              case "LoopCond":
                return [3, 9];
              case "Switch":
                return [3, 10];
              case "Merge":
                return [3, 12];
              case "Enter":
                return [3, 13];
              case "Exit":
                return [3, 14];
              case "NextIteration":
                return [3, 15];
              case "TensorArrayV3":
                return [3, 16];
              case "TensorArrayWriteV3":
                return [3, 17];
              case "TensorArrayReadV3":
                return [3, 18];
              case "TensorArrayGatherV3":
                return [3, 19];
              case "TensorArrayScatterV3":
                return [3, 20];
              case "TensorArrayConcatV3":
                return [3, 21];
              case "TensorArraySplitV3":
                return [3, 22];
              case "TensorArraySizeV3":
                return [3, 23];
              case "TensorArrayCloseV3":
                return [3, 24];
              case "TensorListSetItem":
                return [3, 25];
              case "TensorListGetItem":
                return [3, 26];
              case "TensorListScatterV2":
                return [3, 27];
              case "TensorListScatter":
                return [3, 27];
              case "TensorListReserve":
                return [3, 28];
              case "EmptyTensorList":
                return [3, 28];
              case "TensorListGather":
                return [3, 29];
              case "TensorListStack":
                return [3, 30];
              case "TensorListFromTensor":
                return [3, 31];
              case "TensorListConcat":
                return [3, 32];
              case "TensorListPushBack":
                return [3, 33];
              case "TensorListPopBack":
                return [3, 34];
              case "TensorListSplit":
                return [3, 35];
            }
            return [3, 36];
          case 1:
            return a = Bt("thenBranch", e, t, r), o = Bt("elseBranch", e, t, r), s = Bt("cond", e, t, r), u2 = Bt("args", e, t, r), [4, s.data()];
          case 2:
            return h = pe.sent(), h[0] ? [2, r.functionMap[a].executeFunctionAsync(u2, r.tensorArrayMap, r.tensorListMap)] : [2, r.functionMap[o].executeFunctionAsync(u2, r.tensorArrayMap, r.tensorListMap)];
          case 3:
            return i = Bt("body", e, t, r), l = Bt("cond", e, t, r), u2 = Bt("args", e, t, r), [4, r.functionMap[l].executeFunctionAsync(u2, r.tensorArrayMap, r.tensorListMap)];
          case 4:
            return c = pe.sent(), f = u2.map(function(ve) {
              return ve.id;
            }), [4, c[0].data()];
          case 5:
            h = pe.sent(), c.forEach(function(ve) {
              !ve.kept && f.indexOf(ve.id) === -1 && ve.dispose();
            }), p = u2, d = function() {
              var ve, Ee, Se;
              return ws(this, function(Ce) {
                switch (Ce.label) {
                  case 0:
                    return ve = p, [4, r.functionMap[i].executeFunctionAsync(p, r.tensorArrayMap, r.tensorListMap)];
                  case 1:
                    return p = Ce.sent(), Ee = p.map(function(Be) {
                      return Be.id;
                    }), ve.forEach(function(Be) {
                      !Be.kept && f.indexOf(Be.id) === -1 && Ee.indexOf(Be.id) === -1 && Be.dispose();
                    }), [4, r.functionMap[l].executeFunctionAsync(p, r.tensorArrayMap, r.tensorListMap)];
                  case 2:
                    return Se = Ce.sent(), [4, Se[0].data()];
                  case 3:
                    return h = Ce.sent(), Se.forEach(function(Be) {
                      !Be.kept && f.indexOf(Be.id) === -1 && Ee.indexOf(Be.id) === -1 && Be.dispose();
                    }), [2];
                }
              });
            }, pe.label = 6;
          case 6:
            return h[0] ? [5, d()] : [3, 8];
          case 7:
            return pe.sent(), [3, 6];
          case 8:
            return [2, p];
          case 9:
            return v = Bt("pred", e, t, r), [2, [T0(v)]];
          case 10:
            return v = Bt("pred", e, t, r), x = Bt("data", e, t, r), x.kept || (x = T0(x)), [4, v.data()];
          case 11:
            return [2, pe.sent()[0] ? [void 0, x] : [x, void 0]];
          case 12:
            return m = e.inputNames.find(function(ve) {
              return sf(ve, t, r) !== void 0;
            }), m ? (x = sf(m, t, r), [2, [T0(x)]]) : [2, void 0];
          case 13:
            return g = Bt("frameName", e, t, r), x = Bt("tensor", e, t, r), r.enterFrame(g), [2, [T0(x)]];
          case 14:
            return x = Bt("tensor", e, t, r), r.exitFrame(), [2, [T0(x)]];
          case 15:
            return x = Bt("tensor", e, t, r), r.nextIteration(), [2, [T0(x)]];
          case 16:
            return b = Bt("size", e, t, r), y = Bt("dtype", e, t, r), we = Bt("elementShape", e, t, r), w = Bt("dynamicSize", e, t, r), _4 = Bt("clearAfterRead", e, t, r), k = Bt("identicalElementShapes", e, t, r), T3 = Bt("name", e, t, r), A3 = new PNe(T3, y, b, we, k, w, _4), r.addTensorArray(A3), [2, [A3.idTensor, ui.scalar(1)]];
          case 17:
            return S3 = Bt("tensorArrayId", e, t, r), re = Bt("index", e, t, r), ce = Bt("tensor", e, t, r), C3 = r.getTensorArray(S3.id), C3.write(re, ce), [2, [C3.idTensor]];
          case 18:
            return E3 = Bt("tensorArrayId", e, t, r), R2 = Bt("index", e, t, r), F13 = r.getTensorArray(E3.id), [2, [F13.read(R2)]];
          case 19:
            return j = Bt("tensorArrayId", e, t, r), Q2 = Bt("indices", e, t, r), N3 = Bt("dtype", e, t, r), D3 = r.getTensorArray(j.id), [2, [D3.gather(Q2, N3)]];
          case 20:
            return I3 = Bt("tensorArrayId", e, t, r), z = Bt("indices", e, t, r), H2 = Bt("tensor", e, t, r), O3 = r.getTensorArray(I3.id), O3.scatter(z, H2), [2, [O3.idTensor]];
          case 21:
            return ue = Bt("tensorArrayId", e, t, r), L3 = r.getTensorArray(ue.id), le = Bt("dtype", e, t, r), [2, [L3.concat(le)]];
          case 22:
            return V2 = Bt("tensorArrayId", e, t, r), me = Bt("tensor", e, t, r), be = Bt("lengths", e, t, r), W2 = r.getTensorArray(V2.id), W2.split(be, me), [2, [W2.idTensor]];
          case 23:
            return X2 = Bt("tensorArrayId", e, t, r), Y2 = r.getTensorArray(X2.id), [2, [ui.scalar(Y2.size(), "int32")]];
          case 24:
            return K2 = Bt("tensorArrayId", e, t, r), q = r.getTensorArray(K2.id), q.clearAndClose(), [2, [q.idTensor]];
          case 25:
            return se = Bt("tensorListId", e, t, r), re = Bt("index", e, t, r), ce = Bt("tensor", e, t, r), Ae = r.getTensorList(se.id), Ae.setItem(re, ce), [2, [Ae.idTensor]];
          case 26:
            return se = Bt("tensorListId", e, t, r), R2 = Bt("index", e, t, r), we = Bt("elementShape", e, t, r), he = Bt("elementDType", e, t, r), Ae = r.getTensorList(se.id), [2, [Ae.getItem(R2, we, he)]];
          case 27:
            return z = Bt("indices", e, t, r), H2 = Bt("tensor", e, t, r), we = Bt("elementShape", e, t, r), Z2 = Bt("numElements", e, t, r), Ae = zNe(H2, z, we, Z2), r.addTensorList(Ae), [2, [Ae.idTensor]];
          case 28:
            return we = Bt("elementShape", e, t, r), ae = Bt("elementDType", e, t, r), te = void 0, e.op === "TensorListReserve" ? te = "numElements" : te = "maxNumElements", Z2 = Bt(te, e, t, r), Ae = RNe(we, ae, Z2), r.addTensorList(Ae), [2, [Ae.idTensor]];
          case 29:
            return j = Bt("tensorListId", e, t, r), Q2 = Bt("indices", e, t, r), we = Bt("elementShape", e, t, r), ae = Bt("elementDType", e, t, r), Ae = r.getTensorList(j.id), [2, [Ae.gather(Q2, ae, we)]];
          case 30:
            return se = Bt("tensorListId", e, t, r), we = Bt("elementShape", e, t, r), ae = Bt("elementDType", e, t, r), Z2 = Bt("numElements", e, t, r), Ae = r.getTensorList(se.id), [2, [Ae.stack(we, ae, Z2)]];
          case 31:
            return ne = Bt("tensor", e, t, r), we = Bt("elementShape", e, t, r), ae = Bt("elementDType", e, t, r), Ae = LNe(ne, we, ae), r.addTensorList(Ae), [2, [Ae.idTensor]];
          case 32:
            return ue = Bt("tensorListId", e, t, r), Ae = r.getTensorList(ue.id), le = Bt("dtype", e, t, r), we = Bt("elementShape", e, t, r), [2, [Ae.concat(le, we)]];
          case 33:
            return se = Bt("tensorListId", e, t, r), ce = Bt("tensor", e, t, r), Ae = r.getTensorList(se.id), Ae.pushBack(ce), [2, [Ae.idTensor]];
          case 34:
            return se = Bt("tensorListId", e, t, r), we = Bt("elementShape", e, t, r), he = Bt("elementDType", e, t, r), Ae = r.getTensorList(se.id), [2, [Ae.popBack(we, he)]];
          case 35:
            return me = Bt("tensor", e, t, r), we = Bt("elementShape", e, t, r), be = Bt("lengths", e, t, r), Ae = BNe(me, be, we), r.addTensorList(Ae), [2, [Ae.idTensor]];
          case 36:
            throw TypeError("Node type " + e.op + " is not implemented");
        }
      });
    });
  };
  function Jj(e, t, r) {
    var n = ni(Bt("fusedOps", e, t, r), 2), a = n[0], o = n[1], s = a === "biasadd", i = !s, l = o === "prelu", u2 = a === "fusedbatchnorm", c = Bt("numArgs", e, t, r);
    if (s) {
      if (l && c !== 2) throw new Error("FusedConv2d and DepthwiseConv2d with BiasAdd and Prelu must have two extra arguments: bias and alpha.");
      if (!l && s && c !== 1) throw new Error("FusedConv2d and DepthwiseConv2d with BiasAdd must have one extra argument: bias.");
    }
    if (u2) throw new Error("FusedConv2d and DepthwiseConv2d with FusedBatchNorm is not supported");
    var f = Bt("strides", e, t, r), h = Ok(e, t, r), p = Bt("dataFormat", e, t, r).toUpperCase(), d = Bt("dilations", e, t, r), v = ni(Bt("args", e, t, r), 2), m = v[0], g = v[1];
    i && (g = m, m = void 0);
    var x = Bt("leakyreluAlpha", e, t, r);
    return { stride: f, pad: h, dataFormat: p, dilations: d, biasArg: m, preluArg: g, activationFunc: o, leakyreluAlpha: x };
  }
  var jNe = function(e, t, r) {
    switch (e.op) {
      case "Conv1D": {
        var n = Bt("stride", e, t, r), a = Bt("pad", e, t, r), o = Bt("dataFormat", e, t, r).toUpperCase(), s = Bt("dilation", e, t, r);
        return [WW(Bt("x", e, t, r), Bt("filter", e, t, r), n, a, o, s)];
      }
      case "Conv2D": {
        var n = Bt("strides", e, t, r), a = Ok(e, t, r), o = Bt("dataFormat", e, t, r).toUpperCase(), i = Bt("dilations", e, t, r);
        return [F22(Bt("x", e, t, r), Bt("filter", e, t, r), [n[1], n[2]], a, o, [i[1], i[2]])];
      }
      case "_FusedConv2D": {
        var l = Jj(e, t, r), n = l.stride, a = l.pad, o = l.dataFormat, i = l.dilations, u2 = l.biasArg, c = l.preluArg, f = l.activationFunc, h = l.leakyreluAlpha;
        return [PG({ x: Bt("x", e, t, r), filter: Bt("filter", e, t, r), strides: [n[1], n[2]], pad: a, dataFormat: o, dilations: [i[1], i[2]], bias: u2, activation: f, preluActivationWeights: c, leakyreluAlpha: h })];
      }
      case "FusedDepthwiseConv2dNative": {
        var p = Jj(e, t, r), n = p.stride, a = p.pad, o = p.dataFormat, i = p.dilations, u2 = p.biasArg, c = p.preluArg, f = p.activationFunc, h = p.leakyreluAlpha;
        return [LG({ x: Bt("x", e, t, r), filter: Bt("filter", e, t, r), strides: [n[1], n[2]], pad: a, dataFormat: o, dilations: [i[1], i[2]], bias: u2, activation: f, preluActivationWeights: c, leakyreluAlpha: h })];
      }
      case "Conv2DBackpropInput":
      case "Conv2dTranspose": {
        var d = Bt("outputShape", e, t, r), n = Bt("strides", e, t, r), a = Ok(e, t, r);
        return [$W(Bt("x", e, t, r), Bt("filter", e, t, r), d, [n[1], n[2]], a)];
      }
      case "DepthwiseConv2dNative":
      case "DepthwiseConv2d": {
        var n = Bt("strides", e, t, r), a = Ok(e, t, r), i = Bt("dilations", e, t, r), o = Bt("dataFormat", e, t, r).toUpperCase();
        return [Qk(Bt("input", e, t, r), Bt("filter", e, t, r), [n[1], n[2]], a, o, [i[1], i[2]])];
      }
      case "Conv3D": {
        var n = Bt("strides", e, t, r), a = Bt("pad", e, t, r), o = Bt("dataFormat", e, t, r).toUpperCase(), i = Bt("dilations", e, t, r);
        return [HW(Bt("x", e, t, r), Bt("filter", e, t, r), [n[1], n[2], n[3]], a, o, [i[1], i[2], i[3]])];
      }
      case "AvgPool": {
        var n = Bt("strides", e, t, r), a = Bt("pad", e, t, r), v = Bt("kernelSize", e, t, r);
        return [hM(Bt("x", e, t, r), [v[1], v[2]], [n[1], n[2]], a)];
      }
      case "MaxPool": {
        var n = Bt("strides", e, t, r), a = Bt("pad", e, t, r), v = Bt("kernelSize", e, t, r);
        return [AM(Bt("x", e, t, r), [v[1], v[2]], [n[1], n[2]], a)];
      }
      case "MaxPoolWithArgmax": {
        var n = Bt("strides", e, t, r), a = Bt("pad", e, t, r), v = Bt("kernelSize", e, t, r), m = Bt("includeBatchInIndex", e, t, r), g = fG(Bt("x", e, t, r), [v[1], v[2]], [n[1], n[2]], a, m), x = g.result, b = g.indexes;
        return [x, b];
      }
      case "AvgPool3D": {
        var n = Bt("strides", e, t, r), a = Bt("pad", e, t, r), v = Bt("kernelSize", e, t, r);
        return [BW(Bt("x", e, t, r), [v[1], v[2], v[3]], [n[1], n[2], n[3]], a)];
      }
      case "MaxPool3D": {
        var n = Bt("strides", e, t, r), a = Bt("pad", e, t, r), v = Bt("kernelSize", e, t, r);
        return [cG(Bt("x", e, t, r), [v[1], v[2], v[3]], [n[1], n[2], n[3]], a)];
      }
      case "Dilation2D": {
        var y = Bt("strides", e, t, r), a = Bt("pad", e, t, r), i = Bt("dilations", e, t, r), w = y[1], _4 = y[2], k = i[1], T3 = i[2];
        return [JW(Bt("x", e, t, r), Bt("filter", e, t, r), [w, _4], a, [k, T3], "NHWC")];
      }
      default:
        throw TypeError("Node type " + e.op + " is not implemented");
    }
  };
  var WNe = function(e, t, r) {
    switch (e.op) {
      case "Fill": {
        var n = Bt("shape", e, t, r), a = Bt("dtype", e, t, r), o = Bt("value", e, t, r);
        return [tT(n, o, a)];
      }
      case "LinSpace": {
        var s = Bt("start", e, t, r), i = Bt("stop", e, t, r), l = Bt("num", e, t, r);
        return [oG(s, i, l)];
      }
      case "Multinomial": {
        var u2 = Bt("logits", e, t, r), c = Bt("numSamples", e, t, r), f = Bt("seed", e, t, r);
        return [vG(u2, c, f)];
      }
      case "OneHot": {
        var h = Bt("indices", e, t, r), p = Bt("depth", e, t, r), d = Bt("onValue", e, t, r), v = Bt("offValue", e, t, r);
        return [mG(h, p, d, v)];
      }
      case "Ones":
        return [Mv(Bt("shape", e, t, r), Bt("dtype", e, t, r))];
      case "OnesLike":
        return [gG(Bt("x", e, t, r))];
      case "RandomUniform":
        return [FM(Bt("shape", e, t, r), Bt("minval", e, t, r), Bt("maxval", e, t, r), Bt("dtype", e, t, r))];
      case "Range": {
        var s = Bt("start", e, t, r), i = Bt("stop", e, t, r), m = Bt("step", e, t, r);
        return [Ey(s, i, m, Bt("dtype", e, t, r))];
      }
      case "TruncatedNormal": {
        var n = Bt("shape", e, t, r), g = Bt("mean", e, t, r), x = Bt("stdDev", e, t, r), f = Bt("seed", e, t, r);
        return [MG(n, g, x, Bt("dtype", e, t, r), f)];
      }
      case "Zeros":
        return [fg(Bt("shape", e, t, r), Bt("dtype", e, t, r))];
      case "ZerosLike":
        return [eT(Bt("x", e, t, r))];
      default:
        throw TypeError("Node type " + e.op + " is not implemented");
    }
  }, GNe = void 0;
  function NC(e, t, r) {
    var n = Bt("boxes", e, t, r), a = Bt("scores", e, t, r), o = Bt("maxOutputSize", e, t, r), s = Bt("iouThreshold", e, t, r), i = Bt("scoreThreshold", e, t, r), l = Bt("softNmsSigma", e, t, r);
    return { boxes: n, scores: a, maxOutputSize: o, iouThreshold: s, scoreThreshold: i, softNmsSigma: l };
  }
  var $Ne = function(e, t, r) {
    return Ps(GNe, void 0, void 0, function() {
      var n, a, u2, c, f, h, p, o, v, s, u2, c, f, h, p, i, v, l, u2, c, f, h, p, d, v;
      return ws(this, function(m) {
        switch (m.label) {
          case 0:
            switch (n = e.op, n) {
              case "NonMaxSuppressionV5":
                return [3, 1];
              case "NonMaxSuppressionV4":
                return [3, 3];
              case "NonMaxSuppressionV3":
                return [3, 5];
              case "NonMaxSuppressionV2":
                return [3, 5];
              case "Where":
                return [3, 7];
              case "ListDiff":
                return [3, 9];
            }
            return [3, 10];
          case 1:
            return a = NC(e, t, r), u2 = a.boxes, c = a.scores, f = a.maxOutputSize, h = a.iouThreshold, p = a.scoreThreshold, o = a.softNmsSigma, [4, lg.nonMaxSuppressionWithScoreAsync(u2, c, f, h, p, o)];
          case 2:
            return v = m.sent(), [2, [v.selectedIndices, v.selectedScores]];
          case 3:
            return s = NC(e, t, r), u2 = s.boxes, c = s.scores, f = s.maxOutputSize, h = s.iouThreshold, p = s.scoreThreshold, i = Bt("padToMaxOutputSize", e, t, r), [4, lg.nonMaxSuppressionPaddedAsync(u2, c, f, h, p, i)];
          case 4:
            return v = m.sent(), [2, [v.selectedIndices, v.validOutputs]];
          case 5:
            return l = NC(e, t, r), u2 = l.boxes, c = l.scores, f = l.maxOutputSize, h = l.iouThreshold, p = l.scoreThreshold, [4, lg.nonMaxSuppressionAsync(u2, c, f, h, p)];
          case 6:
            return [2, [m.sent()]];
          case 7:
            return d = ou(Bt("condition", e, t, r), "bool"), [4, BM(d)];
          case 8:
            return v = [m.sent()], d.dispose(), [2, v];
          case 9:
            return [2, _G(Bt("x", e, t, r), Bt("y", e, t, r))];
          case 10:
            throw TypeError("Node type " + e.op + " is not implemented");
        }
      });
    });
  };
  var HNe = function(e, t, r) {
    switch (e.op) {
      case "TopKV2": {
        var n = Bt("x", e, t, r), a = Bt("k", e, t, r), o = Bt("sorted", e, t, r), s = CG(n, a, o);
        return [s.values, s.indices];
      }
      case "Unique": {
        var n = Bt("x", e, t, r), s = QC(n);
        return [s.values, s.indices];
      }
      case "UniqueV2": {
        var n = Bt("x", e, t, r), i = Bt("axis", e, t, r), s = QC(n, i);
        return [s.values, s.indices];
      }
      default:
        throw TypeError("Node type " + e.op + " is not implemented");
    }
  };
  var qNe = function(e, t, r) {
    switch (e.op) {
      case "Const":
        return t[e.name];
      case "PlaceholderWithDefault":
        var n = Bt("default", e, t, r);
        return [sf(e.name, t, r) || n];
      case "Placeholder":
        return [sf(e.name, t, r)];
      case "Identity":
      case "StopGradient":
      case "FakeQuantWithMinMaxVars": {
        var a = Bt("x", e, t, r);
        return [T0(a)];
      }
      case "IdentityN":
        return Bt("x", e, t, r).map(function(f) {
          return T0(f);
        });
      case "Snapshot":
        var o = Bt("x", e, t, r);
        return [T0(o)];
      case "Shape":
        return [Ph(Bt("x", e, t, r).shape, "int32")];
      case "ShapeN":
        return Bt("x", e, t, r).map(function(f) {
          return Ph(f.shape);
        });
      case "Size":
        return [el(Bt("x", e, t, r).size, "int32")];
      case "Rank":
        return [el(Bt("x", e, t, r).rank, "int32")];
      case "NoOp":
        return [el(1)];
      case "Print":
        var s = Bt("x", e, t, r), i = Bt("data", e, t, r), l = Bt("message", e, t, r), u2 = Bt("summarize", e, t, r);
        console.warn("The graph has a tf.print() operation,usually used for debugging, which slows down performance."), console.log(l);
        for (var c = 0; c < i.length; c++) console.log(Array.prototype.slice.call(i[c].dataSync()).slice(0, u2));
        return [s];
      default:
        throw TypeError("Node type " + e.op + " is not implemented");
    }
  }, XNe = function() {
    function e(t, r) {
      this.keyDType = t, this.valueDType = r, this.handle = ui.scalar(0), this.tensorMap = /* @__PURE__ */ new Map(), ui.keep(this.handle);
    }
    return Object.defineProperty(e.prototype, "id", { get: function() {
      return this.handle.id;
    }, enumerable: true, configurable: true }), e.prototype.clearAndClose = function() {
      this.tensorMap.forEach(function(t) {
        return t.dispose();
      }), this.tensorMap.clear(), this.handle.dispose();
    }, e.prototype.size = function() {
      return this.tensorMap.size;
    }, e.prototype.tensorSize = function() {
      return el(this.size(), "int32");
    }, e.prototype.import = function(t, r) {
      return Ps(this, void 0, void 0, function() {
        var n, a = this;
        return ws(this, function(o) {
          switch (o.label) {
            case 0:
              return this.checkKeyAndValueTensor(t, r), [4, t.data()];
            case 1:
              return n = o.sent(), this.tensorMap.forEach(function(s) {
                return s.dispose();
              }), this.tensorMap.clear(), [2, ui.tidy(function() {
                var s = ui.unstack(r), i = n.length, l = s.length;
                ui.util.assert(i === l, function() {
                  return "The number of elements doesn't match, keys has " + (i + " elements, the values has " + l + " ") + "elements.";
                });
                for (var u2 = 0; u2 < i; u2++) {
                  var c = n[u2], f = s[u2];
                  ui.keep(f), a.tensorMap.set(c, f);
                }
                return a.handle;
              })];
          }
        });
      });
    }, e.prototype.find = function(t, r) {
      return Ps(this, void 0, void 0, function() {
        var n, a = this;
        return ws(this, function(o) {
          switch (o.label) {
            case 0:
              return this.checkKeyAndValueTensor(t, r), [4, t.data()];
            case 1:
              return n = o.sent(), [2, ui.tidy(function() {
                for (var s = [], i = 0; i < n.length; i++) {
                  var l = n[i], u2 = a.findWithDefault(l, r);
                  s.push(u2);
                }
                return ui.stack(s);
              })];
          }
        });
      });
    }, e.prototype.findWithDefault = function(t, r) {
      var n = this.tensorMap.get(t);
      return n ?? r;
    }, e.prototype.checkKeyAndValueTensor = function(t, r) {
      if (t.dtype !== this.keyDType) throw new Error("Expect key dtype " + this.keyDType + ", but got " + ("" + t.dtype));
      if (r.dtype !== this.valueDType) throw new Error("Expect value dtype " + this.valueDType + ", but got " + ("" + r.dtype));
    }, e;
  }(), KNe = void 0, YNe = function(e, t, r, n) {
    return Ps(KNe, void 0, void 0, function() {
      var a, o, s, f, c, l, i, f, c, l, u2, f, c, f;
      return ws(this, function(h) {
        switch (h.label) {
          case 0:
            switch (a = e.op, a) {
              case "HashTable":
                return [3, 1];
              case "HashTableV2":
                return [3, 1];
              case "LookupTableImport":
                return [3, 2];
              case "LookupTableImportV2":
                return [3, 2];
              case "LookupTableFind":
                return [3, 4];
              case "LookupTableFindV2":
                return [3, 4];
              case "LookupTableSize":
                return [3, 6];
              case "LookupTableSizeV2":
                return [3, 6];
            }
            return [3, 7];
          case 1:
            return o = Bt("keyDType", e, t, r), s = Bt("valueDType", e, t, r), f = new XNe(o, s), n.addHashTable(e.name, f), [2, [f.handle]];
          case 2:
            return c = Bt("tableHandle", e, t, r, n), l = Bt("keys", e, t, r), i = Bt("values", e, t, r), f = n.getHashTableById(c.id), [4, f.import(l, i)];
          case 3:
            return [2, [h.sent()]];
          case 4:
            return c = Bt("tableHandle", e, t, r, n), l = Bt("keys", e, t, r), u2 = Bt("defaultValue", e, t, r), f = n.getHashTableById(c.id), [4, f.find(l, u2)];
          case 5:
            return [2, [h.sent()]];
          case 6:
            return c = Bt("tableHandle", e, t, r, n), f = n.getHashTableById(c.id), [2, [f.tensorSize()]];
          case 7:
            throw TypeError("Node type " + e.op + " is not implemented");
        }
      });
    });
  };
  var ZNe = function(e, t, r) {
    switch (e.op) {
      case "ResizeBilinear": {
        var n = Bt("images", e, t, r), a = Bt("size", e, t, r), o = Bt("alignCorners", e, t, r), s = Bt("halfPixelCenters", e, t, r);
        return [lg.resizeBilinear(n, [a[0], a[1]], o, s)];
      }
      case "ResizeNearestNeighbor": {
        var n = Bt("images", e, t, r), a = Bt("size", e, t, r), o = Bt("alignCorners", e, t, r), s = Bt("halfPixelCenters", e, t, r);
        return [lg.resizeNearestNeighbor(n, [a[0], a[1]], o, s)];
      }
      case "CropAndResize": {
        var i = Bt("image", e, t, r), l = Bt("boxes", e, t, r), u2 = Bt("boxInd", e, t, r), c = Bt("cropSize", e, t, r), f = Bt("method", e, t, r), h = Bt("extrapolationValue", e, t, r);
        return [lg.cropAndResize(i, l, u2, c, f, h)];
      }
      default:
        throw TypeError("Node type " + e.op + " is not implemented");
    }
  };
  var JNe = function(e, t, r) {
    switch (e.op) {
      case "Equal":
        return [mM(Bt("a", e, t, r), Bt("b", e, t, r))];
      case "NotEqual":
        return [EM(Bt("a", e, t, r), Bt("b", e, t, r))];
      case "Greater":
        return [O2(Bt("a", e, t, r), Bt("b", e, t, r))];
      case "GreaterEqual":
        return [xM(Bt("a", e, t, r), Bt("b", e, t, r))];
      case "Less":
        return [iG(Bt("a", e, t, r), Bt("b", e, t, r))];
      case "LessEqual":
        return [nT(Bt("a", e, t, r), Bt("b", e, t, r))];
      case "LogicalAnd":
        return [C2(Bt("a", e, t, r), Bt("b", e, t, r))];
      case "LogicalNot":
        return [kM(Bt("a", e, t, r))];
      case "LogicalOr":
        return [TM(Bt("a", e, t, r), Bt("b", e, t, r))];
      case "Select":
      case "SelectV2":
        return [cg(Bt("condition", e, t, r), Bt("a", e, t, r), Bt("b", e, t, r))];
      default:
        throw TypeError("Node type " + e.op + " is not implemented");
    }
  }, QNe = function(e, t, r) {
    switch (e.op) {
      case "BatchMatMul":
      case "BatchMatMulV2":
      case "MatMul":
        return [_s(Bt("a", e, t, r), Bt("b", e, t, r), Bt("transposeA", e, t, r), Bt("transposeB", e, t, r))];
      case "Einsum":
        return [eG.apply(NNe, Sc([Bt("equation", e, t, r)], Bt("tensors", e, t, r)))];
      case "Transpose":
        return [Yk(Bt("x", e, t, r), Bt("perm", e, t, r))];
      case "_FusedMatMul":
        var n = ni(Bt("fusedOps", e, t, r), 2), a = n[0], o = n[1], s = a === "biasadd", i = o === "prelu", l = Bt("numArgs", e, t, r), u2 = Bt("leakyreluAlpha", e, t, r);
        if (s) {
          if (i && l !== 2) throw new Error("Fused MatMul with BiasAdd and Prelu must have two extra arguments: bias and alpha.");
          if (!i && l !== 1) throw new Error("Fused MatMul with BiasAdd must have one extra argument: bias.");
        }
        var c = ni(Bt("args", e, t, r), 2), f = c[0], h = c[1];
        return [RG({ a: Bt("a", e, t, r), b: Bt("b", e, t, r), transposeA: Bt("transposeA", e, t, r), transposeB: Bt("transposeB", e, t, r), bias: f, activation: o, preluActivationWeights: h, leakyreluAlpha: u2 })];
      default:
        throw TypeError("Node type " + e.op + " is not implemented");
    }
  };
  var eFe = function(e, t, r) {
    switch (e.op) {
      case "FusedBatchNorm":
      case "FusedBatchNormV2":
        return [Ay(Bt("x", e, t, r), Bt("mean", e, t, r), Bt("variance", e, t, r), Bt("offset", e, t, r), Bt("scale", e, t, r), Bt("epsilon", e, t, r))];
      case "FusedBatchNormV3":
        return [Ay(Bt("x", e, t, r), Bt("mean", e, t, r), Bt("variance", e, t, r), Bt("offset", e, t, r), Bt("scale", e, t, r), Bt("epsilon", e, t, r))];
      case "LRN":
        return [sG(Bt("x", e, t, r), Bt("radius", e, t, r), Bt("bias", e, t, r), Bt("alpha", e, t, r), Bt("beta", e, t, r))];
      case "Softmax":
        return [AG(Bt("x", e, t, r))];
      case "LogSoftmax":
        return [lG(Bt("x", e, t, r))];
      case "SparseToDense":
        return [VM(Bt("sparseIndices", e, t, r), Bt("outputShape", e, t, r), Bt("sparseValues", e, t, r), Bt("defaultValue", e, t, r))];
      default:
        throw TypeError("Node type " + e.op + " is not implemented");
    }
  };
  var tFe = function(e, t, r) {
    switch (e.op) {
      case "Max": {
        var n = Bt("axis", e, t, r), a = Bt("keepDims", e, t, r);
        return [sg(Bt("x", e, t, r), n, a)];
      }
      case "Mean": {
        var n = Bt("axis", e, t, r), a = Bt("keepDims", e, t, r);
        return [M2(Bt("x", e, t, r), n, a)];
      }
      case "Min": {
        var n = Bt("axis", e, t, r), a = Bt("keepDims", e, t, r);
        return [Xk(Bt("x", e, t, r), n, a)];
      }
      case "Sum": {
        var n = Bt("axis", e, t, r), a = Bt("keepDims", e, t, r);
        return [Qs(Bt("x", e, t, r), n, a)];
      }
      case "All": {
        var n = Bt("axis", e, t, r), a = Bt("keepDims", e, t, r);
        return [MW(Bt("x", e, t, r), n, a)];
      }
      case "Any": {
        var n = Bt("axis", e, t, r), a = Bt("keepDims", e, t, r);
        return [IW(Bt("x", e, t, r), n, a)];
      }
      case "ArgMax": {
        var n = Bt("axis", e, t, r);
        return [NW(Bt("x", e, t, r), n)];
      }
      case "ArgMin": {
        var n = Bt("axis", e, t, r);
        return [FW(Bt("x", e, t, r), n)];
      }
      case "Prod": {
        var n = Bt("axis", e, t, r), a = Bt("keepDims", e, t, r);
        return [MM(Bt("x", e, t, r), n, a)];
      }
      case "Cumsum": {
        var n = Bt("axis", e, t, r), o = Bt("exclusive", e, t, r), s = Bt("reverse", e, t, r);
        return [KW(Bt("x", e, t, r), n, o, s)];
      }
      case "Bincount":
        var i = Bt("x", e, t, r), l = Bt("weights", e, t, r), u2 = Bt("size", e, t, r);
        return [dM(i, l, u2)];
      case "DenseBincount": {
        var c = Bt("x", e, t, r), f = Bt("weights", e, t, r), h = Bt("size", e, t, r), p = Bt("binaryOutput", e, t, r);
        return [YW(c, f, h, p)];
      }
      default:
        throw TypeError("Node type " + e.op + " is not implemented");
    }
  };
  var rFe = function(e, t, r) {
    switch (e.op) {
      case "ConcatV2":
      case "Concat": {
        var n = Bt("n", e, t, r), a = Bt("axis", e, t, r), o = Bt("tensors", e, t, r);
        return o = o.slice(0, n), [Rf(o, a)];
      }
      case "Gather": {
        var s = Bt("x", e, t, r), i = Bt("indices", e, t, r);
        return [qk(s, ou(i, "int32"), 0)];
      }
      case "GatherV2": {
        var a = Bt("axis", e, t, r), l = Bt("batchDims", e, t, r), s = Bt("x", e, t, r), i = Bt("indices", e, t, r);
        return [qk(s, ou(i, "int32"), a, l)];
      }
      case "Reverse": {
        for (var u2 = Bt("dims", e, t, r), a = [], c = 0; c < u2.length; c++) u2[c] && a.push(c);
        var s = Bt("x", e, t, r);
        return [E0(s, a)];
      }
      case "ReverseV2": {
        var a = Bt("axis", e, t, r), s = Bt("x", e, t, r);
        return [E0(s, a)];
      }
      case "Slice": {
        var f = Bt("begin", e, t, r), h = Bt("size", e, t, r);
        return [bl(Bt("x", e, t, r), f, h)];
      }
      case "StridedSlice": {
        var f = Bt("begin", e, t, r), p = Bt("end", e, t, r), d = Bt("strides", e, t, r), v = Bt("beginMask", e, t, r), m = Bt("endMask", e, t, r), g = Bt("ellipsisMask", e, t, r), x = Bt("newAxisMask", e, t, r), b = Bt("shrinkAxisMask", e, t, r), y = Bt("x", e, t, r);
        return [EG(y, f, p, d, v, m, g, x, b)];
      }
      case "Pack":
        return ui.tidy(function() {
          var E3 = Bt("axis", e, t, r), F13 = Bt("tensors", e, t, r), N3 = F13[0].shape, D3 = Cy(F13[0]).shape, I3 = F13.map(function(O3) {
            var L3 = ui.util.arraysEqual(O3.shape, N3);
            if (!L3 && !ui.util.arraysEqual(Cy(O3).shape, D3)) throw new Error("the input tensors shape does not match");
            return L3 ? O3 : da(O3, N3);
          });
          return [My(I3, E3)];
        });
      case "Unpack": {
        var a = Bt("axis", e, t, r), y = Bt("tensor", e, t, r);
        return lT(y, a);
      }
      case "Tile": {
        var w = Bt("reps", e, t, r);
        return [ky(Bt("x", e, t, r), w)];
      }
      case "Split":
      case "SplitV": {
        var a = Bt("axis", e, t, r), _4 = Bt("numOrSizeSplits", e, t, r), y = Bt("x", e, t, r);
        return Dy(y, _4, a);
      }
      case "ScatterNd": {
        var i = Bt("indices", e, t, r), k = Bt("values", e, t, r), T3 = Bt("shape", e, t, r);
        return [NG(i, k, T3)];
      }
      case "GatherNd": {
        var A3 = Bt("x", e, t, r), i = Bt("indices", e, t, r);
        return [FG(A3, i)];
      }
      case "SparseToDense": {
        var i = Bt("sparseIndices", e, t, r), T3 = Bt("outputShape", e, t, r), S3 = Bt("sparseValues", e, t, r), C3 = Bt("defaultValue", e, t, r);
        return [VM(i, S3, T3, S3.dtype === C3.dtype ? C3 : ou(C3, S3.dtype))];
      }
      default:
        throw TypeError("Node type " + e.op + " is not implemented");
    }
  };
  var nFe = function(e, t, r) {
    switch (e.op) {
      case "SparseFillEmptyRows": {
        var n = A2.sparseFillEmptyRows(Bt("indices", e, t, r), Bt("values", e, t, r), Bt("denseShape", e, t, r), Bt("defaultValue", e, t, r)), a = n.outputIndices, o = n.outputValues, s = n.emptyRowIndicator, i = n.reverseIndexMap;
        return [a, o, s, i];
      }
      case "SparseReshape": {
        var l = A2.sparseReshape(Bt("inputIndices", e, t, r), Bt("inputShape", e, t, r), Bt("newShape", e, t, r)), a = l.outputIndices, u2 = l.outputShape;
        return [a, u2];
      }
      case "SparseSegmentMean": {
        var c = A2.sparseSegmentMean(Bt("data", e, t, r), Bt("indices", e, t, r), Bt("segmentIds", e, t, r));
        return [c];
      }
      case "SparseSegmentSum": {
        var c = A2.sparseSegmentSum(Bt("data", e, t, r), Bt("indices", e, t, r), Bt("segmentIds", e, t, r));
        return [c];
      }
      default:
        throw TypeError("Node type " + e.op + " is not implemented");
    }
  };
  var aFe = function(e, t, r) {
    switch (e.op) {
      case "FFT":
        return [oT(Bt("x", e, t, r))];
      case "IFFT":
        return [N2(Bt("x", e, t, r))];
      case "RFFT":
        return [sT(Bt("x", e, t, r))];
      case "IRFFT":
        return [LM(Bt("x", e, t, r))];
      default:
        throw TypeError("Node type " + e.op + " is not implemented");
    }
  };
  var iFe = function(e, t, r) {
    switch (e.op) {
      case "StringNGrams": {
        var n = Rk.stringNGrams(Bt("data", e, t, r), Bt("dataSplits", e, t, r), Bt("separator", e, t, r), Bt("nGramWidths", e, t, r), Bt("leftPad", e, t, r), Bt("rightPad", e, t, r), Bt("padWidth", e, t, r), Bt("preserveShortSequences", e, t, r)), a = n.nGrams, o = n.nGramsSplits;
        return [a, o];
      }
      case "StringSplit": {
        var s = Rk.stringSplit(Bt("input", e, t, r), Bt("delimiter", e, t, r), Bt("skipEmpty", e, t, r)), i = s.indices, l = s.values, u2 = s.shape;
        return [i, l, u2];
      }
      case "StringToHashBucketFast": {
        var c = Rk.stringToHashBucketFast(Bt("input", e, t, r), Bt("numBuckets", e, t, r));
        return [c];
      }
      default:
        throw TypeError("Node type " + e.op + " is not implemented");
    }
  };
  var oFe = function(e, t, r) {
    switch (e.op) {
      case "Cast":
        return [ou(Bt("x", e, t, r), Bt("dtype", e, t, r))];
      case "ExpandDims": {
        var n = Bt("axis", e, t, r);
        return [Cv(Bt("x", e, t, r), n)];
      }
      case "Squeeze": {
        var n = Bt("axis", e, t, r);
        return [Cy(Bt("x", e, t, r), n)];
      }
      case "Reshape":
        return [da(Bt("x", e, t, r), Bt("shape", e, t, r))];
      case "MirrorPad":
        return [pG(Bt("x", e, t, r), Bt("padding", e, t, r), Bt("mode", e, t, r))];
      case "PadV2":
      case "Pad":
        return [Fy(Bt("x", e, t, r), Bt("padding", e, t, r), Bt("constantValue", e, t, r))];
      case "SpaceToBatchND": {
        var a = Bt("blockShape", e, t, r), o = Bt("paddings", e, t, r);
        return [DM(Bt("x", e, t, r), a, o)];
      }
      case "BatchToSpaceND": {
        var a = Bt("blockShape", e, t, r), s = Bt("crops", e, t, r);
        return [pM(Bt("x", e, t, r), a, s)];
      }
      case "DepthToSpace": {
        var i = Bt("blockSize", e, t, r), l = Bt("dataFormat", e, t, r).toUpperCase();
        return [ZW(Bt("x", e, t, r), i, l)];
      }
      case "BroadcastTo":
        return [S2(Bt("x", e, t, r), Bt("shape", e, t, r))];
      case "BroadcastArgs":
        return [UW(Bt("s0", e, t, r), Bt("s1", e, t, r))];
      default:
        throw TypeError("Node type " + e.op + " is not implemented");
    }
  };
  function Qj(e, t, r, n) {
    var a = function(o, s, i) {
      switch (o.category) {
        case "arithmetic":
          return Hc.tidy(function() {
            return FNe(o, s, i);
          });
        case "basic_math":
          return Hc.tidy(function() {
            return ONe(o, s, i);
          });
        case "control":
          return VNe(o, s, i);
        case "convolution":
          return Hc.tidy(function() {
            return jNe(o, s, i);
          });
        case "creation":
          return Hc.tidy(function() {
            return WNe(o, s, i);
          });
        case "dynamic":
          return $Ne(o, s, i);
        case "evaluation":
          return Hc.tidy(function() {
            return HNe(o, s, i);
          });
        case "image":
          return Hc.tidy(function() {
            return ZNe(o, s, i);
          });
        case "graph":
          return Hc.tidy(function() {
            return qNe(o, s, i);
          });
        case "logical":
          return Hc.tidy(function() {
            return JNe(o, s, i);
          });
        case "matrices":
          return Hc.tidy(function() {
            return QNe(o, s, i);
          });
        case "normalization":
          return Hc.tidy(function() {
            return eFe(o, s, i);
          });
        case "reduction":
          return Hc.tidy(function() {
            return tFe(o, s, i);
          });
        case "slice_join":
          return Hc.tidy(function() {
            return rFe(o, s, i);
          });
        case "sparse":
          return Hc.tidy(function() {
            return nFe(o, s, i);
          });
        case "spectral":
          return Hc.tidy(function() {
            return aFe(o, s, i);
          });
        case "string":
          return Hc.tidy(function() {
            return iFe(o, s, i);
          });
        case "transformation":
          return Hc.tidy(function() {
            return oFe(o, s, i);
          });
        case "hash_table":
          return YNe(o, s, i, n);
        case "custom":
          var l = nW(o.op);
          if (l && l.customExecutor) return l.customExecutor(new zAe(o, s, i));
          throw TypeError("Custom op " + o.op + " is not registered.");
        default:
          throw TypeError("Unknown op '" + o.op + "'. File an issue at https://github.com/tensorflow/tfjs/issues so we can add it, or register a custom execution with tf.registerOp()");
      }
    }(e, t, r);
    return Hc.util.isPromise(a) ? a.then(function(o) {
      return [].concat(o);
    }) : [].concat(a);
  }
  var eW = function() {
    function e(t, r, n, a) {
      t === void 0 && (t = {}), r === void 0 && (r = {}), n === void 0 && (n = {}), a === void 0 && (a = {}), this.weightMap = t, this.tensorArrayMap = r, this.tensorListMap = n, this.functionMap = a, this.rootContext = { id: 0, frameName: "", iterationId: 0 }, this.contexts = [this.rootContext], this.lastId = 0, this.generateCurrentContextIds();
    }
    return e.prototype.newFrame = function(t, r) {
      return { id: t, frameName: r, iterationId: 0 };
    }, Object.defineProperty(e.prototype, "currentContext", { get: function() {
      return this.contexts;
    }, set: function(t) {
      this.contexts !== t && (this.contexts = t, this.generateCurrentContextIds());
    }, enumerable: true, configurable: true }), Object.defineProperty(e.prototype, "currentContextId", { get: function() {
      return this._currentContextIds[0];
    }, enumerable: true, configurable: true }), Object.defineProperty(e.prototype, "currentContextIds", { get: function() {
      return this._currentContextIds;
    }, enumerable: true, configurable: true }), e.prototype.generateCurrentContextIds = function() {
      for (var t = [], r = 0; r < this.contexts.length - 1; r++) {
        var n = this.contexts.slice(0, this.contexts.length - r);
        t.push(this.contextIdforContexts(n));
      }
      t.push(""), this._currentContextIds = t;
    }, e.prototype.contextIdforContexts = function(t) {
      return t ? t.map(function(r) {
        return r.id === 0 && r.iterationId === 0 ? "" : r.frameName + "-" + r.iterationId;
      }).join("/") : "";
    }, e.prototype.enterFrame = function(t) {
      this.contexts && (this.lastId++, this.contexts = this.contexts.slice(), this.contexts.push(this.newFrame(this.lastId, t)), this._currentContextIds.unshift(this.contextIdforContexts(this.contexts)));
    }, e.prototype.exitFrame = function() {
      if (this.contexts && this.contexts.length > 1) this.contexts = this.contexts.slice(), this.contexts.splice(-1), this.currentContextIds.shift();
      else throw new Error("Cannot exit frame, the context is empty");
    }, e.prototype.nextIteration = function() {
      if (this.contexts && this.contexts.length > 0) {
        this.contexts = this.contexts.slice(), this.lastId++;
        var t = Object.assign({}, this.contexts[this.contexts.length - 1]);
        t.iterationId += 1, t.id = this.lastId, this.contexts.splice(-1, 1, t), this._currentContextIds.splice(0, 1, this.contextIdforContexts(this.contexts));
      } else throw new Error("Cannot increase frame iteration, the context is empty");
    }, e.prototype.getWeight = function(t) {
      return this.weightMap[t];
    }, e.prototype.addTensorArray = function(t) {
      this.tensorArrayMap[t.id] = t;
    }, e.prototype.getTensorArray = function(t) {
      return this.tensorArrayMap[t];
    }, e.prototype.addTensorList = function(t) {
      this.tensorListMap[t.id] = t;
    }, e.prototype.getTensorList = function(t) {
      return this.tensorListMap[t];
    }, e.prototype.dispose = function(t) {
      for (var r in this.tensorArrayMap) this.tensorArrayMap[r].clearAndClose(t);
      for (var r in this.tensorListMap) this.tensorListMap[r].clearAndClose(t);
    }, e;
  }();
  function tW(e, t, r, n) {
    var a = /* @__PURE__ */ new Set(), o = [], s = null, i = null, l = /* @__PURE__ */ new Set(), u2 = Object.keys(e).map(function(p) {
      return oh(p)[0];
    }), c = [];
    n != null && (c = n.map(function(p) {
      return oh(p.name)[0];
    }));
    for (var f = Sc(t); f.length > 0; ) {
      var h = f.pop();
      if ((UG(h) || fFe(h) || hFe(h)) && s == null && (s = h, i = s.children.map(function(p) {
        return p.name;
      }).filter(function(p) {
        return a.has(p);
      })), a.add(h.name), r[h.name] == null && u2.indexOf(h.name) === -1 && c.indexOf(h.name) === -1) {
        if (h.inputs.length === 0) {
          o.push(h.name);
          continue;
        }
        h.inputs.forEach(function(p) {
          l.has(p.name) || (l.add(p.name), f.push(p));
        });
      }
    }
    return { inputs: e, outputs: t, usedNodes: a, missingInputs: o, dynamicNode: s, syncInputs: i };
  }
  function sFe(e, t, r) {
    var n = r.usedNodes, a = r.inputs, o = [], s = Object.keys(a).map(function(f) {
      return oh(f)[0];
    }).map(function(f) {
      return e.nodes[f];
    }), i = e.initNodes;
    s.forEach(function(f) {
      n.has(f.name) && o.push(f);
    }), e.weights.forEach(function(f) {
      n.has(f.name) && o.push(f);
    }), i?.forEach(function(f) {
      n.has(f.name) && o.push(f);
    });
    for (var l = /* @__PURE__ */ new Set(), u2 = []; o.length > 0; ) {
      var c = o.pop();
      l.add(c.name), t[c.name] || u2.push(c), c.children.forEach(function(f) {
        !l.has(f.name) && n.has(f.name) && f.inputs.every(function(h) {
          return l.has(h.name);
        }) && o.push(f);
      });
    }
    return u2;
  }
  var lFe = ["Switch", "Merge", "Enter", "Exit", "NextIteration", "StatelessIf", "StatelessWhile", "if", "While"], uFe = ["NonMaxSuppressionV2", "NonMaxSuppressionV3", "NonMaxSuppressionV5", "Where"], cFe = ["HashTable", "HashTableV2", "LookupTableImport", "LookupTableImportV2", "LookupTableFind", "LookupTableFindV2", "LookupTableSize", "LookupTableSizeV2"];
  function UG(e) {
    return lFe.indexOf(e.op) >= 0;
  }
  function fFe(e) {
    return uFe.indexOf(e.op) >= 0;
  }
  function hFe(e) {
    return cFe.indexOf(e.op) >= 0;
  }
  var rW = function() {
    function e(t, r) {
      var n = this;
      this.graph = t, this.parent = r, this.compiledMap = /* @__PURE__ */ new Map(), this._weightMap = {}, this.SEPERATOR = ",", this._functions = {}, this._functionExecutorMap = {}, this.intermediateTensors = {}, this.keepTensorForDebug = false, this._outputs = t.outputs, this._inputs = t.inputs, this._initNodes = t.initNodes, this._signature = t.signature, this._functions = t.functions, t.functions != null && Object.keys(t.functions).forEach(function(a) {
        n._functionExecutorMap[a] = new e(t.functions[a], n);
      });
    }
    return Object.defineProperty(e.prototype, "weightIds", { get: function() {
      return this.parent ? this.parent.weightIds : this._weightIds;
    }, enumerable: true, configurable: true }), Object.defineProperty(e.prototype, "functionExecutorMap", { get: function() {
      return this.parent ? this.parent.functionExecutorMap : this._functionExecutorMap;
    }, enumerable: true, configurable: true }), Object.defineProperty(e.prototype, "weightMap", { get: function() {
      return this.parent ? this.parent.weightMap : this._weightMap;
    }, set: function(t) {
      var r = Object.keys(t).map(function(n) {
        return t[n].map(function(a) {
          return a.id;
        });
      });
      this._weightIds = [].concat.apply([], Sc(r)), this._weightMap = t;
    }, enumerable: true, configurable: true }), Object.defineProperty(e.prototype, "resourceManager", { set: function(t) {
      this._resourceManager = t;
    }, enumerable: true, configurable: true }), Object.defineProperty(e.prototype, "inputs", { get: function() {
      return this._inputs.map(function(t) {
        return { name: t.name, shape: t.attrParams.shape ? t.attrParams.shape.value : void 0, dtype: t.attrParams.dtype ? t.attrParams.dtype.value : void 0 };
      });
    }, enumerable: true, configurable: true }), Object.defineProperty(e.prototype, "outputs", { get: function() {
      return this._outputs.map(function(t) {
        return { name: t.name, shape: t.attrParams.shape ? t.attrParams.shape.value : void 0, dtype: t.attrParams.dtype ? t.attrParams.dtype.value : void 0 };
      });
    }, enumerable: true, configurable: true }), Object.defineProperty(e.prototype, "inputNodes", { get: function() {
      return this._inputs.map(function(t) {
        return t.signatureKey || t.name;
      });
    }, enumerable: true, configurable: true }), Object.defineProperty(e.prototype, "outputNodes", { get: function() {
      return this._outputs.map(function(t) {
        var r = t.signatureKey || t.name;
        return t.defaultOutput ? r + ":" + t.defaultOutput : r;
      });
    }, enumerable: true, configurable: true }), Object.defineProperty(e.prototype, "functions", { get: function() {
      var t = this;
      return Object.keys(this._functions).reduce(function(r, n) {
        return r[n] = t._functions[n].signature, r;
      }, {});
    }, enumerable: true, configurable: true }), e.prototype.getCompilationKey = function(t, r) {
      var n = t.map(function(o) {
        return o.name;
      }).sort(), a = r.map(function(o) {
        return o.name;
      }).sort();
      return n.join(this.SEPERATOR) + "--" + a.join(this.SEPERATOR);
    }, e.prototype.compile = function(t, r) {
      var n = tW(t, r, this.weightMap, this._initNodes), a = n.missingInputs, o = n.dynamicNode, s = n.syncInputs;
      if (o != null) throw new Error("This execution contains the node '" + o.name + "', which has " + ("the dynamic op '" + o.op + "'. Please use ") + "model.executeAsync() instead. Alternatively, to avoid the " + ("dynamic ops, specify the inputs [" + s + "]"));
      if (a.length > 0) {
        var i = r.map(function(u2) {
          return u2.name;
        }), l = Object.keys(t);
        throw new Error("Cannot compute the outputs [" + i + "] from the provided inputs " + ("[" + l + "]. Missing the following inputs: [" + a + "]"));
      }
      return sFe(this.graph, this.weightMap, n);
    }, e.prototype.execute = function(t, r) {
      var n = this;
      t = this.mapInputs(t);
      var a = Object.keys(t).sort();
      this.checkInputs(t), this.checkInputShapeAndType(t), r = this.mapOutputs(r), this.checkOutputs(r);
      var o = a.map(function(h) {
        return n.graph.nodes[oh(h)[0]];
      }), s = r.map(function(h) {
        return oh(h)[0];
      }), i = s.map(function(h) {
        return n.graph.nodes[h];
      });
      this.resetIntermediateTensors(), i.length === 0 && (i = this._outputs);
      var l = this.getCompilationKey(o, i), u2 = this.compiledMap.get(l);
      u2 == null && (u2 = this.compile(t, i), this.compiledMap.set(l, u2));
      var c = {}, f = {};
      return ui.tidy(function() {
        var h = new eW(n.weightMap, c, f, n.functionExecutorMap), p = Object.assign({}, n.weightMap);
        Object.keys(t).forEach(function(b) {
          var y = ni(oh(b), 2), w = y[0], _4 = y[1], k = [];
          k[_4] = t[b], p[w] = k;
        });
        for (var d = n.getFrozenTensorIds(p), v = {}, m = 0; m < u2.length; m++) {
          var g = u2[m];
          if (!p[g.name]) {
            var x = Qj(g, p, h, n._resourceManager);
            if (ui.util.isPromise(x)) throw new Error("The execution of the op '" + g.op + "' returned a promise. Please use model.executeAsync() instead.");
            p[g.name] = x, n.checkTensorForDisposal(g.name, g, p, h, d, s, v);
          }
        }
        return n.parent == null && h.dispose(d), r.map(function(b) {
          return sf(b, p, h);
        });
      });
    }, e.prototype.getFrozenTensorIds = function(t) {
      var r = [].concat.apply([], Object.keys(t).map(function(n) {
        return t[n];
      }).map(function(n) {
        return n.map(function(a) {
          return a.id;
        });
      }));
      return new Set(r);
    }, e.prototype.checkTensorForDisposal = function(t, r, n, a, o, s, i) {
      var l = this;
      r.category === "control" || s.indexOf(t) !== -1 || (n[t].forEach(function(u2) {
        u2 != null && (i[u2.id] = (i[u2.id] || 0) + r.children.length);
      }), r.inputs.forEach(function(u2) {
        if (u2.category !== "control") {
          var c = JTe(u2.name, n, a);
          c?.forEach(function(f) {
            if (f && !f.kept && !o.has(f.id)) {
              var h = i[f.id];
              if (h === 1) {
                if (!l.keepTensorForDebug) f.dispose();
                else {
                  var p = ni(Hd(r.name, a), 2), d = p[0], v = p[1];
                  l.intermediateTensors[d] || (l.intermediateTensors[d] = []), l.intermediateTensors[d][v] = f;
                }
                delete i[f.id];
              } else h != null && i[f.id]--;
            }
          });
        }
      }));
    }, e.prototype.executeAsync = function(t, r) {
      return Ps(this, void 0, void 0, function() {
        return ws(this, function(n) {
          return [2, this._executeAsync(t, r)];
        });
      });
    }, e.prototype.disposeIntermediateTensors = function() {
      var t = this;
      !this.intermediateTensors || (Object.keys(this.intermediateTensors).forEach(function(r) {
        return t.intermediateTensors[r].forEach(function(n) {
          return n.dispose();
        });
      }), this.disposeTensorsMap());
    }, e.prototype.disposeTensorsMap = function() {
      var t = this;
      !this.tensorsMap || Object.keys(this.tensorsMap).forEach(function(r) {
        var n = t.tensorsMap[r];
        n.forEach(function(a) {
          a && !a.kept && !a.isDisposed && !t.keepIds.has(a.id) && a.dispose();
        });
      });
    }, e.prototype.getIntermediateTensors = function() {
      return this.tensorsMap;
    }, e.prototype.resetIntermediateTensors = function() {
      for (var t in this.intermediateTensors) this.intermediateTensors[t].forEach(function(r) {
        return r.dispose();
      }), delete this.intermediateTensors[t];
    }, e.prototype._executeAsync = function(t, r, n, a, o) {
      return n === void 0 && (n = false), a === void 0 && (a = {}), o === void 0 && (o = {}), Ps(this, void 0, void 0, function() {
        var s, i, l, u2, c, f = this;
        return ws(this, function(h) {
          switch (h.label) {
            case 0:
              n || (t = this.mapInputs(t), this.checkInputs(t), this.checkInputShapeAndType(t), r = this.mapOutputs(r), this.checkOutputs(r));
              try {
                this.keepTensorForDebug = ui.env().getBool("KEEP_INTERMEDIATE_TENSORS");
              } catch (p) {
                console.warn(p.message);
              }
              return this.resetIntermediateTensors(), s = new eW(this.weightMap, a, o, this.functionExecutorMap), i = this, [4, this.executeWithControlFlow(t, s, r, n)];
            case 1:
              return i.tensorsMap = h.sent(), l = r.map(function(p) {
                return sf(p, f.tensorsMap, s);
              }), u2 = l.map(function(p) {
                return p.id;
              }), c = Object.keys(t).map(function(p) {
                return t[p].id;
              }), this.keepIds = new Set(Sc(u2, c, this.weightIds)), this.keepTensorForDebug || this.disposeTensorsMap(), this.parent == null && s.dispose(this.keepIds), [2, l];
          }
        });
      });
    }, e.prototype.executeFunctionAsync = function(t, r, n) {
      return Ps(this, void 0, void 0, function() {
        var a, o = this;
        return ws(this, function(s) {
          return a = t.reduce(function(i, l, u2) {
            return i[o.inputs[u2].name] = l, i;
          }, {}), [2, this._executeAsync(a, this.outputNodes, true, r, n)];
        });
      });
    }, e.prototype.executeWithControlFlow = function(t, r, n, a) {
      return Ps(this, void 0, void 0, function() {
        var o, s, i, l, u2, c, f, h, p, d, v, m, g, x, b, y, w, _4 = this;
        return ws(this, function(k) {
          switch (k.label) {
            case 0:
              o = Object.keys(t), s = o.map(function(T3) {
                return _4.graph.nodes[oh(T3)[0]];
              }), i = n.map(function(T3) {
                return oh(T3)[0];
              }), l = i.map(function(T3) {
                return _4.graph.nodes[T3];
              }), l.length === 0 && (l = this._outputs), u2 = tW(t, l, this.weightMap, this._initNodes), c = u2.usedNodes, f = u2.missingInputs, h = u2.dynamicNode, p = u2.syncInputs, d = Sc(s, this.graph.weights, this._initNodes || []).map(function(T3) {
                return { node: T3, contexts: r.currentContext };
              }), v = Object.assign({}, this.weightMap), Object.keys(t).forEach(function(T3) {
                var A3 = ni(oh(T3), 2), S3 = A3[0], C3 = A3[1], E3 = [];
                E3[C3] = t[T3], v[S3] = E3;
              }), m = {}, g = this.getFrozenTensorIds(v), x = {}, k.label = 1;
            case 1:
              return d.length > 0 ? (b = this.processStack(s, d, r, v, x, g, i, m, c), [4, Promise.all(b)]) : [3, 3];
            case 2:
              return k.sent(), [3, 1];
            case 3:
              if (h == null && !a && console.warn("This model execution did not contain any nodes with control flow or dynamic output shapes. You can use model.execute() instead."), y = l.filter(function(T3) {
                return !UG(T3) && !sf(T3.name, v, r);
              }).map(function(T3) {
                return T3.name;
              }), y.length > 0) throw w = "", h != null && (w = "Alternatively, to avoid the dynamic ops, use model.execute() " + ("and specify the inputs [" + p + "]")), new Error("Cannot compute the outputs [" + y + "] from the provided " + ("inputs [" + o + "]. Consider providing the following inputs: ") + ("[" + f + "]. " + w));
              return [2, v];
          }
        });
      });
    }, e.prototype.processStack = function(t, r, n, a, o, s, i, l, u2) {
      for (var c = this, f = [], h = function() {
        var d, v, m = r.pop();
        n.currentContext = m.contexts;
        var g = "";
        if (m.node.op === "Enter" && Bt("isConstant", m.node, a, n) && (d = ni(Hd(m.node.name, n), 1), g = d[0]), a[m.node.name] == null) {
          var x = Qj(m.node, a, n, p._resourceManager);
          g || (v = ni(Hd(m.node.name, n), 1), g = v[0]);
          var b = n.currentContext;
          ui.util.isPromise(x) ? f.push(x.then(function(y) {
            return a[g] = y, n.currentContext = b, c.checkTensorForDisposal(g, m.node, a, n, s, i, l), c.processChildNodes(m.node, r, n, a, o, u2), y;
          })) : (a[g] = x, p.checkTensorForDisposal(g, m.node, a, n, s, i, l), p.processChildNodes(m.node, r, n, a, o, u2));
        } else p.processChildNodes(m.node, r, n, a, o, u2);
      }, p = this; r.length > 0; ) h();
      return f;
    }, e.prototype.processChildNodes = function(t, r, n, a, o, s) {
      t.children.forEach(function(i) {
        var l = ni(Hd(i.name, n), 1), u2 = l[0];
        o[u2] || !s.has(i.name) || (i.op === "Merge" ? i.inputNames.some(function(c) {
          return !!sf(c, a, n);
        }) && (o[u2] = true, r.push({ contexts: n.currentContext, node: i })) : i.inputNames.every(function(c) {
          return !!sf(c, a, n);
        }) && (o[u2] = true, r.push({ contexts: n.currentContext, node: i })));
      });
    }, e.prototype.dispose = function() {
      var t = this;
      Object.keys(this.weightMap).forEach(function(r) {
        return t.weightMap[r].forEach(function(n) {
          return n.dispose();
        });
      });
    }, e.prototype.checkInputShapeAndType = function(t) {
      var r = this;
      Object.keys(t).forEach(function(n) {
        var a = t[n], o = ni(oh(n), 1), s = o[0], i = r.graph.nodes[s];
        if (i.attrParams.shape && i.attrParams.shape.value) {
          var l = i.attrParams.shape.value, u2 = l.length === a.shape.length && a.shape.every(function(c, f) {
            return l[f] === -1 || l[f] === c;
          });
          ui.util.assert(u2, function() {
            return "The shape of dict['" + i.name + "'] provided in " + ("model.execute(dict) must be [" + l + "], but was ") + ("[" + a.shape + "]");
          });
        }
        i.attrParams.dtype && i.attrParams.dtype.value && ui.util.assert(a.dtype === i.attrParams.dtype.value, function() {
          return "The dtype of dict['" + i.name + "'] provided in model.execute(dict) must be " + (i.attrParams.dtype.value + ", but was " + a.dtype);
        });
      });
    }, e.prototype.mapInputs = function(t) {
      var r = {};
      for (var n in t) if (this._signature != null && this._signature.inputs != null && this._signature.inputs[n] != null) {
        var a = this._signature.inputs[n];
        r[a.name] = t[n];
      } else r[n] = t[n];
      return r;
    }, e.prototype.checkInputs = function(t) {
      var r = this, n = Object.keys(t).filter(function(a) {
        var o = ni(oh(a), 1), s = o[0];
        return r.graph.nodes[s] == null;
      });
      if (n.length > 0) throw new Error("The dict provided in model.execute(dict) has " + ("keys: [" + n + "] that are not part of graph"));
    }, e.prototype.mapOutputs = function(t) {
      var r = this;
      return t.map(function(n) {
        if (r._signature != null && r._signature.outputs != null && r._signature.outputs[n] != null) {
          var a = r._signature.outputs[n];
          return a.name;
        }
        return n;
      }, {});
    }, e.prototype.checkOutputs = function(t) {
      var r = this;
      t.forEach(function(n) {
        var a = ni(oh(n), 1), o = a[0];
        if (!r.graph.nodes[o]) throw new Error("The output '" + n + "' is not found in the graph");
      });
    }, e;
  }(), pFe = function() {
    function e(t, r) {
      t === void 0 && (t = {}), r === void 0 && (r = {}), this.hashTableNameToHandle = t, this.hashTableMap = r;
    }
    return e.prototype.addHashTable = function(t, r) {
      this.hashTableNameToHandle[t] = r.handle, this.hashTableMap[r.id] = r;
    }, e.prototype.getHashTableHandleByName = function(t) {
      return this.hashTableNameToHandle[t];
    }, e.prototype.getHashTableById = function(t) {
      return this.hashTableMap[t];
    }, e.prototype.dispose = function() {
      for (var t in this.hashTableMap) this.hashTableMap[t].clearAndClose(), delete this.hashTableMap[t];
      for (var r in this.hashTableNameToHandle) this.hashTableNameToHandle[r].dispose(), delete this.hashTableNameToHandle[r];
    }, e;
  }(), dFe = "?tfjs-format=file", vFe = "model.json", VG = function() {
    function e(t, r) {
      r === void 0 && (r = {}), this.modelUrl = t, this.loadOptions = r, this.version = "n/a", r == null && (this.loadOptions = {}), this.resourceManager = new pFe();
    }
    return Object.defineProperty(e.prototype, "modelVersion", { get: function() {
      return this.version;
    }, enumerable: true, configurable: true }), Object.defineProperty(e.prototype, "inputNodes", { get: function() {
      return this.executor.inputNodes;
    }, enumerable: true, configurable: true }), Object.defineProperty(e.prototype, "outputNodes", { get: function() {
      return this.executor.outputNodes;
    }, enumerable: true, configurable: true }), Object.defineProperty(e.prototype, "inputs", { get: function() {
      return this.executor.inputs;
    }, enumerable: true, configurable: true }), Object.defineProperty(e.prototype, "outputs", { get: function() {
      return this.executor.outputs;
    }, enumerable: true, configurable: true }), Object.defineProperty(e.prototype, "weights", { get: function() {
      return this.executor.weightMap;
    }, enumerable: true, configurable: true }), Object.defineProperty(e.prototype, "metadata", { get: function() {
      return this.artifacts.userDefinedMetadata;
    }, enumerable: true, configurable: true }), Object.defineProperty(e.prototype, "modelSignature", { get: function() {
      return this.signature;
    }, enumerable: true, configurable: true }), e.prototype.findIOHandler = function() {
      var t = this.modelUrl;
      if (t.load != null) this.handler = t;
      else if (this.loadOptions.requestInit != null) this.handler = ui.io.browserHTTPRequest(t, this.loadOptions);
      else {
        var r = ui.io.getLoadHandlers(t, this.loadOptions);
        if (r.length === 0) r.push(ui.io.browserHTTPRequest(t, this.loadOptions));
        else if (r.length > 1) throw new Error("Found more than one (" + r.length + ") load handlers for " + ("URL '" + [t] + "'"));
        this.handler = r[0];
      }
    }, e.prototype.load = function() {
      return Ps(this, void 0, void 0, function() {
        var t;
        return ws(this, function(r) {
          switch (r.label) {
            case 0:
              if (this.findIOHandler(), this.handler.load == null) throw new Error("Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.");
              return [4, this.handler.load()];
            case 1:
              return t = r.sent(), [2, this.loadSync(t)];
          }
        });
      });
    }, e.prototype.loadSync = function(t) {
      this.artifacts = t;
      var r = this.artifacts.modelTopology, n;
      this.artifacts.userDefinedMetadata != null && this.artifacts.userDefinedMetadata.signature != null ? n = this.artifacts.userDefinedMetadata.signature : n = this.artifacts.signature, this.signature = n, this.version = r.versions.producer + "." + r.versions.minConsumer;
      var a = ui.io.decodeWeights(this.artifacts.weightData, this.artifacts.weightSpecs);
      if (this.executor = new rW(Ej.Instance.transformGraph(r, this.signature)), this.executor.weightMap = this.convertTensorMapToTensorsMap(a), this.executor.resourceManager = this.resourceManager, t.modelInitializer != null && t.modelInitializer.node != null) {
        var o = Ej.Instance.transformGraph(t.modelInitializer);
        this.initializer = new rW(o), this.initializer.weightMap = this.executor.weightMap, this.initializer.resourceManager = this.resourceManager, this.initializer.executeAsync({}, []);
      }
      return true;
    }, e.prototype.save = function(t, r) {
      return Ps(this, void 0, void 0, function() {
        var n;
        return ws(this, function(a) {
          if (typeof t == "string") {
            if (n = ui.io.getSaveHandlers(t), n.length === 0) throw new Error("Cannot find any save handlers for URL '" + t + "'");
            if (n.length > 1) throw new Error("Found more than one (" + n.length + ") save handlers for " + ("URL '" + t + "'"));
            t = n[0];
          }
          if (t.save == null) throw new Error("GraphModel.save() cannot proceed because the IOHandler provided does not have the `save` attribute defined.");
          return [2, t.save(this.artifacts)];
        });
      });
    }, e.prototype.predict = function(t, r) {
      return this.execute(t, this.outputNodes);
    }, e.prototype.normalizeInputs = function(t) {
      if (!(t instanceof ui.Tensor) && !Array.isArray(t)) return t;
      if (t = Array.isArray(t) ? t : [t], t.length !== this.inputNodes.length) throw new Error("Input tensor count mismatch," + ("the graph model has " + this.inputNodes.length + " placeholders, ") + ("while there are " + t.length + " input tensors."));
      return this.inputNodes.reduce(function(r, n, a) {
        return r[n] = t[a], r;
      }, {});
    }, e.prototype.normalizeOutputs = function(t) {
      return t = t || this.outputNodes, Array.isArray(t) ? t : [t];
    }, e.prototype.execute = function(t, r) {
      t = this.normalizeInputs(t), r = this.normalizeOutputs(r);
      var n = this.executor.execute(t, r);
      return n.length > 1 ? n : n[0];
    }, e.prototype.executeAsync = function(t, r) {
      return Ps(this, void 0, void 0, function() {
        var n;
        return ws(this, function(a) {
          switch (a.label) {
            case 0:
              return t = this.normalizeInputs(t), r = this.normalizeOutputs(r), [4, this.executor.executeAsync(t, r)];
            case 1:
              return n = a.sent(), [2, n.length > 1 ? n : n[0]];
          }
        });
      });
    }, e.prototype.getIntermediateTensors = function() {
      return this.executor.getIntermediateTensors();
    }, e.prototype.disposeIntermediateTensors = function() {
      this.executor.disposeIntermediateTensors();
    }, e.prototype.convertTensorMapToTensorsMap = function(t) {
      return Object.keys(t).reduce(function(r, n) {
        return r[n] = [t[n]], r;
      }, {});
    }, e.prototype.dispose = function() {
      this.executor.dispose(), this.initializer && this.initializer.dispose(), this.resourceManager.dispose();
    }, e;
  }();
  function mFe(e, t) {
    return t === void 0 && (t = {}), Ps(this, void 0, void 0, function() {
      var r;
      return ws(this, function(n) {
        switch (n.label) {
          case 0:
            if (e == null) throw new Error("modelUrl in loadGraphModel() cannot be null. Please provide a url or an IOHandler that loads the model");
            return t == null && (t = {}), t.fromTFHub && e.load == null && (e.endsWith("/") || (e = e + "/"), e = "" + e + vFe + dFe), r = new VG(e, t), [4, r.load()];
          case 1:
            return n.sent(), [2, r];
        }
      });
    });
  }
  var gFe = "3.13.0";
  mg.GraphModel = VG;
  mg.deregisterOp = ZTe;
  mg.loadGraphModel = mFe;
  mg.registerOp = YTe;
  mg.version_converter = gFe;
});
var XM = ri(() => {
});
var WG = ri(() => {
});
var c$ = ri((zf) => {
  "use strict";
  Object.defineProperty(zf, "__esModule", { value: true });
  var jl = Gm();
  function yFe(e) {
    if (e && e.__esModule) return e;
    var t = /* @__PURE__ */ Object.create(null);
    return e && Object.keys(e).forEach(function(r) {
      if (r !== "default") {
        var n = Object.getOwnPropertyDescriptor(e, r);
        Object.defineProperty(t, r, n.get ? n : { enumerable: true, get: function() {
          return e[r];
        } });
      }
    }), t.default = e, t;
  }
  var Fl = yFe(jl);
  var YM = function(e, t) {
    return YM = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, n) {
      r.__proto__ = n;
    } || function(r, n) {
      for (var a in n) n.hasOwnProperty(a) && (r[a] = n[a]);
    }, YM(e, t);
  };
  function ps(e, t) {
    YM(e, t);
    function r() {
      this.constructor = e;
    }
    e.prototype = t === null ? Object.create(t) : (r.prototype = t.prototype, new r());
  }
  function Za(e, t, r, n) {
    function a(o) {
      return o instanceof r ? o : new r(function(s) {
        s(o);
      });
    }
    return new (r || (r = Promise))(function(o, s) {
      function i(c) {
        try {
          u2(n.next(c));
        } catch (f) {
          s(f);
        }
      }
      function l(c) {
        try {
          u2(n.throw(c));
        } catch (f) {
          s(f);
        }
      }
      function u2(c) {
        c.done ? o(c.value) : a(c.value).then(i, l);
      }
      u2((n = n.apply(e, t || [])).next());
    });
  }
  function Ja(e, t) {
    var r = { label: 0, sent: function() {
      if (o[0] & 1) throw o[1];
      return o[1];
    }, trys: [], ops: [] }, n, a, o, s;
    return s = { next: i(0), throw: i(1), return: i(2) }, typeof Symbol == "function" && (s[Symbol.iterator] = function() {
      return this;
    }), s;
    function i(u2) {
      return function(c) {
        return l([u2, c]);
      };
    }
    function l(u2) {
      if (n) throw new TypeError("Generator is already executing.");
      for (; r; ) try {
        if (n = 1, a && (o = u2[0] & 2 ? a.return : u2[0] ? a.throw || ((o = a.return) && o.call(a), 0) : a.next) && !(o = o.call(a, u2[1])).done) return o;
        switch (a = 0, o && (u2 = [u2[0] & 2, o.value]), u2[0]) {
          case 0:
          case 1:
            o = u2;
            break;
          case 4:
            return r.label++, { value: u2[1], done: false };
          case 5:
            r.label++, a = u2[1], u2 = [0];
            continue;
          case 7:
            u2 = r.ops.pop(), r.trys.pop();
            continue;
          default:
            if (o = r.trys, !(o = o.length > 0 && o[o.length - 1]) && (u2[0] === 6 || u2[0] === 2)) {
              r = 0;
              continue;
            }
            if (u2[0] === 3 && (!o || u2[1] > o[0] && u2[1] < o[3])) {
              r.label = u2[1];
              break;
            }
            if (u2[0] === 6 && r.label < o[1]) {
              r.label = o[1], o = u2;
              break;
            }
            if (o && r.label < o[2]) {
              r.label = o[2], r.ops.push(u2);
              break;
            }
            o[2] && r.ops.pop(), r.trys.pop();
            continue;
        }
        u2 = t.call(e, r);
      } catch (c) {
        u2 = [6, c], a = 0;
      } finally {
        n = o = 0;
      }
      if (u2[0] & 5) throw u2[1];
      return { value: u2[0] ? u2[1] : void 0, done: true };
    }
  }
  function gg(e) {
    var t = typeof Symbol == "function" && Symbol.iterator, r = t && e[t], n = 0;
    if (r) return r.call(e);
    if (e && typeof e.length == "number") return { next: function() {
      return e && n >= e.length && (e = void 0), { value: e && e[n++], done: !e };
    } };
    throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
  }
  function xFe(e, t) {
    var r = typeof Symbol == "function" && e[Symbol.iterator];
    if (!r) return e;
    var n = r.call(e), a, o = [], s;
    try {
      for (; (t === void 0 || t-- > 0) && !(a = n.next()).done; ) o.push(a.value);
    } catch (i) {
      s = { error: i };
    } finally {
      try {
        a && !a.done && (r = n.return) && r.call(n);
      } finally {
        if (s) throw s.error;
      }
    }
    return o;
  }
  function bFe() {
    for (var e = [], t = 0; t < arguments.length; t++) e = e.concat(xFe(arguments[t]));
    return e;
  }
  var yg = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
  function _Fe(e) {
    if (e.__esModule) return e;
    var t = Object.defineProperty({}, "__esModule", { value: true });
    return Object.keys(e).forEach(function(r) {
      var n = Object.getOwnPropertyDescriptor(e, r);
      Object.defineProperty(t, r, n.get ? n : { enumerable: true, get: function() {
        return e[r];
      } });
    }), t;
  }
  function xg(e) {
    var t = { exports: {} };
    return e(t, t.exports), t.exports;
  }
  var wFe = xg(function(e) {
    (function(t, r, n) {
      function a(l) {
        var u2 = this, c = i();
        u2.next = function() {
          var f = 2091639 * u2.s0 + u2.c * 23283064365386963e-26;
          return u2.s0 = u2.s1, u2.s1 = u2.s2, u2.s2 = f - (u2.c = f | 0);
        }, u2.c = 1, u2.s0 = c(" "), u2.s1 = c(" "), u2.s2 = c(" "), u2.s0 -= c(l), u2.s0 < 0 && (u2.s0 += 1), u2.s1 -= c(l), u2.s1 < 0 && (u2.s1 += 1), u2.s2 -= c(l), u2.s2 < 0 && (u2.s2 += 1), c = null;
      }
      function o(l, u2) {
        return u2.c = l.c, u2.s0 = l.s0, u2.s1 = l.s1, u2.s2 = l.s2, u2;
      }
      function s(l, u2) {
        var c = new a(l), f = u2 && u2.state, h = c.next;
        return h.int32 = function() {
          return c.next() * 4294967296 | 0;
        }, h.double = function() {
          return h() + (h() * 2097152 | 0) * 11102230246251565e-32;
        }, h.quick = h, f && (typeof f == "object" && o(f, c), h.state = function() {
          return o(c, {});
        }), h;
      }
      function i() {
        var l = 4022871197, u2 = function(c) {
          c = String(c);
          for (var f = 0; f < c.length; f++) {
            l += c.charCodeAt(f);
            var h = 0.02519603282416938 * l;
            l = h >>> 0, h -= l, h *= l, l = h >>> 0, h -= l, l += h * 4294967296;
          }
          return (l >>> 0) * 23283064365386963e-26;
        };
        return u2;
      }
      r && r.exports ? r.exports = s : n && n.amd ? n(function() {
        return s;
      }) : this.alea = s;
    })(yg, e, false);
  }), kFe = xg(function(e) {
    (function(t, r, n) {
      function a(i) {
        var l = this, u2 = "";
        l.x = 0, l.y = 0, l.z = 0, l.w = 0, l.next = function() {
          var f = l.x ^ l.x << 11;
          return l.x = l.y, l.y = l.z, l.z = l.w, l.w ^= l.w >>> 19 ^ f ^ f >>> 8;
        }, i === (i | 0) ? l.x = i : u2 += i;
        for (var c = 0; c < u2.length + 64; c++) l.x ^= u2.charCodeAt(c) | 0, l.next();
      }
      function o(i, l) {
        return l.x = i.x, l.y = i.y, l.z = i.z, l.w = i.w, l;
      }
      function s(i, l) {
        var u2 = new a(i), c = l && l.state, f = function() {
          return (u2.next() >>> 0) / 4294967296;
        };
        return f.double = function() {
          do
            var h = u2.next() >>> 11, p = (u2.next() >>> 0) / 4294967296, d = (h + p) / (1 << 21);
          while (d === 0);
          return d;
        }, f.int32 = u2.next, f.quick = f, c && (typeof c == "object" && o(c, u2), f.state = function() {
          return o(u2, {});
        }), f;
      }
      r && r.exports ? r.exports = s : n && n.amd ? n(function() {
        return s;
      }) : this.xor128 = s;
    })(yg, e, false);
  }), TFe = xg(function(e) {
    (function(t, r, n) {
      function a(i) {
        var l = this, u2 = "";
        l.next = function() {
          var f = l.x ^ l.x >>> 2;
          return l.x = l.y, l.y = l.z, l.z = l.w, l.w = l.v, (l.d = l.d + 362437 | 0) + (l.v = l.v ^ l.v << 4 ^ (f ^ f << 1)) | 0;
        }, l.x = 0, l.y = 0, l.z = 0, l.w = 0, l.v = 0, i === (i | 0) ? l.x = i : u2 += i;
        for (var c = 0; c < u2.length + 64; c++) l.x ^= u2.charCodeAt(c) | 0, c == u2.length && (l.d = l.x << 10 ^ l.x >>> 4), l.next();
      }
      function o(i, l) {
        return l.x = i.x, l.y = i.y, l.z = i.z, l.w = i.w, l.v = i.v, l.d = i.d, l;
      }
      function s(i, l) {
        var u2 = new a(i), c = l && l.state, f = function() {
          return (u2.next() >>> 0) / 4294967296;
        };
        return f.double = function() {
          do
            var h = u2.next() >>> 11, p = (u2.next() >>> 0) / 4294967296, d = (h + p) / (1 << 21);
          while (d === 0);
          return d;
        }, f.int32 = u2.next, f.quick = f, c && (typeof c == "object" && o(c, u2), f.state = function() {
          return o(u2, {});
        }), f;
      }
      r && r.exports ? r.exports = s : n && n.amd ? n(function() {
        return s;
      }) : this.xorwow = s;
    })(yg, e, false);
  }), AFe = xg(function(e) {
    (function(t, r, n) {
      function a(i) {
        var l = this;
        l.next = function() {
          var c = l.x, f = l.i, h, p;
          return h = c[f], h ^= h >>> 7, p = h ^ h << 24, h = c[f + 1 & 7], p ^= h ^ h >>> 10, h = c[f + 3 & 7], p ^= h ^ h >>> 3, h = c[f + 4 & 7], p ^= h ^ h << 7, h = c[f + 7 & 7], h = h ^ h << 13, p ^= h ^ h << 9, c[f] = p, l.i = f + 1 & 7, p;
        };
        function u2(c, f) {
          var h, p = [];
          if (f === (f | 0)) p[0] = f;
          else for (f = "" + f, h = 0; h < f.length; ++h) p[h & 7] = p[h & 7] << 15 ^ f.charCodeAt(h) + p[h + 1 & 7] << 13;
          for (; p.length < 8; ) p.push(0);
          for (h = 0; h < 8 && p[h] === 0; ++h) ;
          for (h == 8 && (p[7] = -1), c.x = p, c.i = 0, h = 256; h > 0; --h) c.next();
        }
        u2(l, i);
      }
      function o(i, l) {
        return l.x = i.x.slice(), l.i = i.i, l;
      }
      function s(i, l) {
        i == null && (i = +/* @__PURE__ */ new Date());
        var u2 = new a(i), c = l && l.state, f = function() {
          return (u2.next() >>> 0) / 4294967296;
        };
        return f.double = function() {
          do
            var h = u2.next() >>> 11, p = (u2.next() >>> 0) / 4294967296, d = (h + p) / (1 << 21);
          while (d === 0);
          return d;
        }, f.int32 = u2.next, f.quick = f, c && (c.x && o(c, u2), f.state = function() {
          return o(u2, {});
        }), f;
      }
      r && r.exports ? r.exports = s : n && n.amd ? n(function() {
        return s;
      }) : this.xorshift7 = s;
    })(yg, e, false);
  }), SFe = xg(function(e) {
    (function(t, r, n) {
      function a(i) {
        var l = this;
        l.next = function() {
          var c = l.w, f = l.X, h = l.i, p, d;
          return l.w = c = c + 1640531527 | 0, d = f[h + 34 & 127], p = f[h = h + 1 & 127], d ^= d << 13, p ^= p << 17, d ^= d >>> 15, p ^= p >>> 12, d = f[h] = d ^ p, l.i = h, d + (c ^ c >>> 16) | 0;
        };
        function u2(c, f) {
          var h, p, d, v, m, g = [], x = 128;
          for (f === (f | 0) ? (p = f, f = null) : (f = f + "\0", p = 0, x = Math.max(x, f.length)), d = 0, v = -32; v < x; ++v) f && (p ^= f.charCodeAt((v + 32) % f.length)), v === 0 && (m = p), p ^= p << 10, p ^= p >>> 15, p ^= p << 4, p ^= p >>> 13, v >= 0 && (m = m + 1640531527 | 0, h = g[v & 127] ^= p + m, d = h == 0 ? d + 1 : 0);
          for (d >= 128 && (g[(f && f.length || 0) & 127] = -1), d = 127, v = 4 * 128; v > 0; --v) p = g[d + 34 & 127], h = g[d = d + 1 & 127], p ^= p << 13, h ^= h << 17, p ^= p >>> 15, h ^= h >>> 12, g[d] = p ^ h;
          c.w = m, c.X = g, c.i = d;
        }
        u2(l, i);
      }
      function o(i, l) {
        return l.i = i.i, l.w = i.w, l.X = i.X.slice(), l;
      }
      function s(i, l) {
        i == null && (i = +/* @__PURE__ */ new Date());
        var u2 = new a(i), c = l && l.state, f = function() {
          return (u2.next() >>> 0) / 4294967296;
        };
        return f.double = function() {
          do
            var h = u2.next() >>> 11, p = (u2.next() >>> 0) / 4294967296, d = (h + p) / (1 << 21);
          while (d === 0);
          return d;
        }, f.int32 = u2.next, f.quick = f, c && (c.X && o(c, u2), f.state = function() {
          return o(u2, {});
        }), f;
      }
      r && r.exports ? r.exports = s : n && n.amd ? n(function() {
        return s;
      }) : this.xor4096 = s;
    })(yg, e, false);
  }), EFe = xg(function(e) {
    (function(t, r, n) {
      function a(i) {
        var l = this, u2 = "";
        l.next = function() {
          var f = l.b, h = l.c, p = l.d, d = l.a;
          return f = f << 25 ^ f >>> 7 ^ h, h = h - p | 0, p = p << 24 ^ p >>> 8 ^ d, d = d - f | 0, l.b = f = f << 20 ^ f >>> 12 ^ h, l.c = h = h - p | 0, l.d = p << 16 ^ h >>> 16 ^ d, l.a = d - f | 0;
        }, l.a = 0, l.b = 0, l.c = -1640531527, l.d = 1367130551, i === Math.floor(i) ? (l.a = i / 4294967296 | 0, l.b = i | 0) : u2 += i;
        for (var c = 0; c < u2.length + 20; c++) l.b ^= u2.charCodeAt(c) | 0, l.next();
      }
      function o(i, l) {
        return l.a = i.a, l.b = i.b, l.c = i.c, l.d = i.d, l;
      }
      function s(i, l) {
        var u2 = new a(i), c = l && l.state, f = function() {
          return (u2.next() >>> 0) / 4294967296;
        };
        return f.double = function() {
          do
            var h = u2.next() >>> 11, p = (u2.next() >>> 0) / 4294967296, d = (h + p) / (1 << 21);
          while (d === 0);
          return d;
        }, f.int32 = u2.next, f.quick = f, c && (typeof c == "object" && o(c, u2), f.state = function() {
          return o(u2, {});
        }), f;
      }
      r && r.exports ? r.exports = s : n && n.amd ? n(function() {
        return s;
      }) : this.tychei = s;
    })(yg, e, false);
  }), DFe = {}, CFe = { __proto__: null, default: DFe }, MFe = _Fe(CFe), bg = xg(function(e) {
    (function(t, r, n) {
      var a = 256, o = 6, s = 52, i = "random", l = n.pow(a, o), u2 = n.pow(2, s), c = u2 * 2, f = a - 1, h;
      function p(y, w, _4) {
        var k = [];
        w = w == true ? { entropy: true } : w || {};
        var T2 = g(m(w.entropy ? [y, b(r)] : y ?? x(), 3), k), A2 = new d(k), S2 = function() {
          for (var C2 = A2.g(o), E2 = l, F13 = 0; C2 < u2; ) C2 = (C2 + F13) * a, E2 *= a, F13 = A2.g(1);
          for (; C2 >= c; ) C2 /= 2, E2 /= 2, F13 >>>= 1;
          return (C2 + F13) / E2;
        };
        return S2.int32 = function() {
          return A2.g(4) | 0;
        }, S2.quick = function() {
          return A2.g(4) / 4294967296;
        }, S2.double = S2, g(b(A2.S), r), (w.pass || _4 || function(C2, E2, F13, N2) {
          return N2 && (N2.S && v(N2, A2), C2.state = function() {
            return v(A2, {});
          }), F13 ? (n[i] = C2, E2) : C2;
        })(S2, T2, "global" in w ? w.global : this == n, w.state);
      }
      function d(y) {
        var w, _4 = y.length, k = this, T2 = 0, A2 = k.i = k.j = 0, S2 = k.S = [];
        for (_4 || (y = [_4++]); T2 < a; ) S2[T2] = T2++;
        for (T2 = 0; T2 < a; T2++) S2[T2] = S2[A2 = f & A2 + y[T2 % _4] + (w = S2[T2])], S2[A2] = w;
        (k.g = function(C2) {
          for (var E2, F13 = 0, N2 = k.i, D2 = k.j, I2 = k.S; C2--; ) E2 = I2[N2 = f & N2 + 1], F13 = F13 * a + I2[f & (I2[N2] = I2[D2 = f & D2 + E2]) + (I2[D2] = E2)];
          return k.i = N2, k.j = D2, F13;
        })(a);
      }
      function v(y, w) {
        return w.i = y.i, w.j = y.j, w.S = y.S.slice(), w;
      }
      function m(y, w) {
        var _4 = [], k = typeof y, T2;
        if (w && k == "object") for (T2 in y) try {
          _4.push(m(y[T2], w - 1));
        } catch {
        }
        return _4.length ? _4 : k == "string" ? y : y + "\0";
      }
      function g(y, w) {
        for (var _4 = y + "", k, T2 = 0; T2 < _4.length; ) w[f & T2] = f & (k ^= w[f & T2] * 19) + _4.charCodeAt(T2++);
        return b(w);
      }
      function x() {
        try {
          var y;
          return h && (y = h.randomBytes) ? y = y(a) : (y = new Uint8Array(a), (t.crypto || t.msCrypto).getRandomValues(y)), b(y);
        } catch {
          var w = t.navigator, _4 = w && w.plugins;
          return [+/* @__PURE__ */ new Date(), t, _4, t.screen, b(r)];
        }
      }
      function b(y) {
        return String.fromCharCode.apply(0, y);
      }
      if (g(n.random(), r), e.exports) {
        e.exports = p;
        try {
          h = MFe;
        } catch {
        }
      } else n["seed" + i] = p;
    })(typeof self < "u" ? self : yg, [], Math);
  });
  bg.alea = wFe;
  bg.xor128 = kFe;
  bg.xorwow = TFe;
  bg.xorshift7 = AFe;
  bg.xor4096 = SFe;
  bg.tychei = EFe;
  var qG = bg;
  function IFe(e, t) {
    return hT(e, t);
  }
  function hT(e, t, r, n) {
    if (r === void 0 && (r = /* @__PURE__ */ new Map()), n === void 0 && (n = /* @__PURE__ */ new Set()), e == null) return null;
    if (typeof Blob == "function" && e instanceof Blob) return e.slice();
    if (n.has(e)) throw new Error("Circular references are not supported.");
    if (r.has(e)) return r.get(e);
    var a = t(e);
    if (a.recurse && a.value !== null) throw new Error("A deep map function may not return both a value and recurse=true.");
    if (a.recurse) if (Py(e)) {
      var o = Array.isArray(e) ? [] : {};
      n.add(e);
      for (var s in e) {
        var i = e[s], l = hT(i, t, r, n);
        o[s] = l;
      }
      return n.delete(e), e.__proto__ && (o.__proto__ = e.__proto__), o;
    } else throw new Error("Can't recurse into non-iterable type: " + e);
    else return r.set(e, a.value), a.value;
  }
  function NFe(e, t) {
    return t === void 0 && (t = KG), XG(e, t);
  }
  function XG(e, t, r) {
    r === void 0 && (r = /* @__PURE__ */ new Set());
    var n = e[0];
    if (r.has(n)) throw new Error("Circular references are not supported.");
    var a = t(e);
    if (a.recurse && a.value !== null) throw new Error("A deep zip function may not return both a value and recurse=true.");
    if (a.recurse) if (Py(n)) {
      var o = Array.isArray(n) ? [] : {};
      r.add(n);
      var s = function(l) {
        var u2 = e.map(function(f) {
          return f[l];
        }), c = XG(u2, t, r);
        o[l] = c;
      };
      for (var i in n) s(i);
      return r.delete(n), o;
    } else throw new Error("Can't recurse into non-iterable type: " + n);
    else return a.value;
  }
  function KG(e) {
    return e === null ? null : Py(e[0]) ? { value: null, recurse: true } : { value: e, recurse: false };
  }
  function YG(e, t) {
    return Za(this, void 0, void 0, function() {
      var r, n, a, o, s, i, l, u2, c, f;
      return Ja(this, function(h) {
        switch (h.label) {
          case 0:
            r = /* @__PURE__ */ new Map(), hT(e, t, r), h.label = 1;
          case 1:
            h.trys.push([1, 6, 7, 8]), n = gg(Array.from(r.keys())), a = n.next(), h.label = 2;
          case 2:
            return a.done ? [3, 5] : (o = a.value, s = r.get(o), Fl.util.isPromise(s) ? [4, s] : [3, 4]);
          case 3:
            i = h.sent(), r.set(o, i), h.label = 4;
          case 4:
            return a = n.next(), [3, 2];
          case 5:
            return [3, 8];
          case 6:
            return l = h.sent(), c = { error: l }, [3, 8];
          case 7:
            try {
              a && !a.done && (f = n.return) && f.call(n);
            } finally {
              if (c) throw c.error;
            }
            return [7];
          case 8:
            return u2 = hT(e, t, r), [2, u2];
        }
      });
    });
  }
  function Py(e) {
    var t = false;
    if (Fl.env().get("IS_BROWSER")) t = e instanceof TextDecoder;
    else {
      var r = XM().StringDecoder;
      t = e instanceof r;
    }
    return e != null && !ArrayBuffer.isView(e) && (Array.isArray(e) || typeof e == "object" && !(e instanceof Fl.Tensor) && !(e instanceof Promise) && !t);
  }
  function FFe(e) {
    return e == null || OFe(e) || Array.isArray(e) || typeof e == "object" && e instanceof Fl.Tensor || Fl.util.isTypedArray(e);
  }
  function OFe(e) {
    return e === null || typeof e != "object" && typeof e != "function";
  }
  function PFe(e) {
    return IFe(e, LFe);
  }
  function LFe(e) {
    return e instanceof Fl.Tensor ? { value: e.clone(), recurse: false } : Py(e) ? { value: null, recurse: true } : { value: e, recurse: false };
  }
  var ZG = function() {
    function e(t) {
      if (this.capacity = t, this.begin = 0, this.end = 0, t == null) throw new RangeError("Can't create a ring buffer of unknown capacity.");
      if (t < 1) throw new RangeError("Can't create ring buffer of capacity < 1.");
      this.data = new Array(t), this.doubledCapacity = 2 * t;
    }
    return e.prototype.wrap = function(t) {
      for (; t < 0; ) t += this.doubledCapacity;
      return t % this.doubledCapacity;
    }, e.prototype.get = function(t) {
      if (t < 0) throw new RangeError("Can't get item at a negative index.");
      return this.data[t % this.capacity];
    }, e.prototype.set = function(t, r) {
      if (t < 0) throw new RangeError("Can't set item at a negative index.");
      this.data[t % this.capacity] = r;
    }, e.prototype.length = function() {
      var t = this.end - this.begin;
      return t < 0 && (t = this.doubledCapacity + t), t;
    }, e.prototype.isFull = function() {
      return this.length() === this.capacity;
    }, e.prototype.isEmpty = function() {
      return this.length() === 0;
    }, e.prototype.push = function(t) {
      if (this.isFull()) throw new RangeError("Ring buffer is full.");
      this.set(this.end, t), this.end = this.wrap(this.end + 1);
    }, e.prototype.pushAll = function(t) {
      var r, n;
      try {
        for (var a = gg(t), o = a.next(); !o.done; o = a.next()) {
          var s = o.value;
          this.push(s);
        }
      } catch (i) {
        r = { error: i };
      } finally {
        try {
          o && !o.done && (n = a.return) && n.call(a);
        } finally {
          if (r) throw r.error;
        }
      }
    }, e.prototype.pop = function() {
      if (this.isEmpty()) throw new RangeError("Ring buffer is empty.");
      this.end = this.wrap(this.end - 1);
      var t = this.get(this.end);
      return this.set(this.end, void 0), t;
    }, e.prototype.unshift = function(t) {
      if (this.isFull()) throw new RangeError("Ring buffer is full.");
      this.begin = this.wrap(this.begin - 1), this.set(this.begin, t);
    }, e.prototype.shift = function() {
      if (this.isEmpty()) throw new RangeError("Ring buffer is empty.");
      var t = this.get(this.begin);
      return this.set(this.begin, void 0), this.begin = this.wrap(this.begin + 1), t;
    }, e.prototype.shuffleExcise = function(t) {
      if (this.isEmpty()) throw new RangeError("Ring buffer is empty.");
      var r = this.wrap(this.begin + t), n = this.get(r);
      return this.set(r, this.pop()), n;
    }, e;
  }(), JG = function(e) {
    ps(t, e);
    function t() {
      return e.call(this, t.INITIAL_CAPACITY) || this;
    }
    return t.prototype.isFull = function() {
      return false;
    }, t.prototype.push = function(r) {
      e.prototype.isFull.call(this) && this.expand(), e.prototype.push.call(this, r);
    }, t.prototype.unshift = function(r) {
      e.prototype.isFull.call(this) && this.expand(), e.prototype.unshift.call(this, r);
    }, t.prototype.expand = function() {
      for (var r = this.capacity * 2, n = new Array(r), a = this.length(), o = 0; o < a; o++) n[o] = this.get(this.wrap(this.begin + o));
      this.data = n, this.capacity = r, this.doubledCapacity = 2 * this.capacity, this.begin = 0, this.end = a;
    }, t;
  }(ZG);
  JG.INITIAL_CAPACITY = 32;
  function QG(e) {
    return new BFe(e);
  }
  function ZM(e) {
    return new UFe(e);
  }
  function RFe(e, t) {
    return new e$(e, t);
  }
  function zFe(e, t) {
    return t === void 0 && (t = Lv.FAIL), new KFe(e, t);
  }
  var fc = function() {
    function e() {
    }
    return e.prototype.toArray = function() {
      return Za(this, void 0, void 0, function() {
        var t, r;
        return Ja(this, function(n) {
          switch (n.label) {
            case 0:
              return t = [], [4, this.next()];
            case 1:
              r = n.sent(), n.label = 2;
            case 2:
              return r.done ? [3, 4] : (t.push(r.value), [4, this.next()]);
            case 3:
              return r = n.sent(), [3, 2];
            case 4:
              return [2, t];
          }
        });
      });
    }, e.prototype.toArrayForTest = function() {
      return Za(this, void 0, void 0, function() {
        var t, r, n;
        return Ja(this, function(a) {
          switch (a.label) {
            case 0:
              return t = this.prefetch(100), r = [], [4, t.next()];
            case 1:
              n = a.sent(), a.label = 2;
            case 2:
              return n.done ? [3, 4] : (r.push(n.value), [4, t.next()]);
            case 3:
              return n = a.sent(), [3, 2];
            case 4:
              return [2, r];
          }
        });
      });
    }, e.prototype.resolveFully = function() {
      return Za(this, void 0, void 0, function() {
        var t;
        return Ja(this, function(r) {
          switch (r.label) {
            case 0:
              return [4, this.next()];
            case 1:
              t = r.sent(), r.label = 2;
            case 2:
              return t.done ? [3, 4] : [4, this.next()];
            case 3:
              return t = r.sent(), [3, 2];
            case 4:
              return [2];
          }
        });
      });
    }, e.prototype.resolveWhile = function(t) {
      return Za(this, void 0, void 0, function() {
        var r, n;
        return Ja(this, function(a) {
          switch (a.label) {
            case 0:
              return [4, this.next()];
            case 1:
              r = a.sent(), n = t(r.value), a.label = 2;
            case 2:
              return !r.done && n ? [4, this.next()] : [3, 4];
            case 3:
              return r = a.sent(), n = t(r.value), [3, 2];
            case 4:
              return [2];
          }
        });
      });
    }, e.prototype.handleErrors = function(t) {
      return new qFe(this, t);
    }, e.prototype.filter = function(t) {
      return new $Fe(this, t);
    }, e.prototype.map = function(t) {
      return new HFe(this, t);
    }, e.prototype.mapAsync = function(t) {
      return new GG(this, t);
    }, e.prototype.serialMapAsync = function(t) {
      return new GG(this, t).serial();
    }, e.prototype.flatmap = function(t) {
      return new XFe(this, t);
    }, e.prototype.forEachAsync = function(t) {
      return Za(this, void 0, void 0, function() {
        return Ja(this, function(r) {
          return [2, this.map(t).resolveFully()];
        });
      });
    }, e.prototype.serialForEach = function(t) {
      return Za(this, void 0, void 0, function() {
        return Ja(this, function(r) {
          return [2, this.serialMapAsync(t).resolveWhile(function(n) {
            return n === true;
          })];
        });
      });
    }, e.prototype.rowMajorBatch = function(t, r) {
      return r === void 0 && (r = true), new GFe(this, t, r);
    }, e.prototype.columnMajorBatch = function(t, r, n) {
      r === void 0 && (r = true), n === void 0 && (n = KG);
      var a = this.rowMajorBatch(t, r);
      return a.map(function(o) {
        return NFe(o, n);
      });
    }, e.prototype.concatenate = function(t, r) {
      return new e$(QG([this, t]), r);
    }, e.prototype.take = function(t) {
      return t < 0 || t == null ? this : new WFe(this, t);
    }, e.prototype.skip = function(t) {
      return t < 0 || t == null ? this : new jFe(this, t);
    }, e.prototype.prefetch = function(t) {
      return new t$(this, t);
    }, e.prototype.shuffle = function(t, r) {
      return new YFe(this, t, r);
    }, e.prototype.serial = function() {
      return new VFe(this);
    }, e;
  }(), BFe = function(e) {
    ps(t, e);
    function t(r) {
      var n = e.call(this) || this;
      return n.items = r, n.trav = 0, n;
    }
    return t.prototype.summary = function() {
      return "Array of " + this.items.length + " items";
    }, t.prototype.next = function() {
      return Za(this, void 0, void 0, function() {
        var r;
        return Ja(this, function(n) {
          return this.trav >= this.items.length ? [2, { value: null, done: true }] : (r = this.items[this.trav], this.trav++, [2, { value: PFe(r), done: false }]);
        });
      });
    }, t;
  }(fc), UFe = function(e) {
    ps(t, e);
    function t(r) {
      var n = e.call(this) || this;
      return n.nextFn = r, n;
    }
    return t.prototype.summary = function() {
      return "Function call";
    }, t.prototype.next = function() {
      return Za(this, void 0, void 0, function() {
        return Ja(this, function(r) {
          try {
            return [2, this.nextFn()];
          } catch (n) {
            throw n.message = "Error thrown while iterating through a dataset: " + n.message, n;
          }
          return [2];
        });
      });
    }, t;
  }(fc), VFe = function(e) {
    ps(t, e);
    function t(r) {
      var n = e.call(this) || this;
      return n.upstream = r, n.lastRead = Promise.resolve({ value: null, done: false }), n;
    }
    return t.prototype.summary = function() {
      return this.upstream.summary() + " -> Serial";
    }, t.prototype.next = function() {
      return Za(this, void 0, void 0, function() {
        var r = this;
        return Ja(this, function(n) {
          return this.lastRead = this.lastRead.then(function() {
            return r.serialNext();
          }), [2, this.lastRead];
        });
      });
    }, t.prototype.serialNext = function() {
      return Za(this, void 0, void 0, function() {
        return Ja(this, function(r) {
          return [2, this.upstream.next()];
        });
      });
    }, t;
  }(fc), jFe = function(e) {
    ps(t, e);
    function t(r, n) {
      var a = e.call(this) || this;
      return a.upstream = r, a.maxCount = n, a.count = 0, a.lastRead = Promise.resolve({ value: null, done: false }), a;
    }
    return t.prototype.summary = function() {
      return this.upstream.summary() + " -> Skip";
    }, t.prototype.next = function() {
      return Za(this, void 0, void 0, function() {
        var r = this;
        return Ja(this, function(n) {
          return this.lastRead = this.lastRead.then(function() {
            return r.serialNext();
          }), [2, this.lastRead];
        });
      });
    }, t.prototype.serialNext = function() {
      return Za(this, void 0, void 0, function() {
        var r;
        return Ja(this, function(n) {
          switch (n.label) {
            case 0:
              return this.count++ < this.maxCount ? [4, this.upstream.next()] : [3, 2];
            case 1:
              return r = n.sent(), r.done ? [2, r] : (Fl.dispose(r.value), [3, 0]);
            case 2:
              return [2, this.upstream.next()];
          }
        });
      });
    }, t;
  }(fc), WFe = function(e) {
    ps(t, e);
    function t(r, n) {
      var a = e.call(this) || this;
      return a.upstream = r, a.maxCount = n, a.count = 0, a;
    }
    return t.prototype.summary = function() {
      return this.upstream.summary() + " -> Take";
    }, t.prototype.next = function() {
      return Za(this, void 0, void 0, function() {
        return Ja(this, function(r) {
          return this.count++ >= this.maxCount ? [2, { value: null, done: true }] : [2, this.upstream.next()];
        });
      });
    }, t;
  }(fc), GFe = function(e) {
    ps(t, e);
    function t(r, n, a) {
      a === void 0 && (a = true);
      var o = e.call(this) || this;
      return o.upstream = r, o.batchSize = n, o.enableSmallLastBatch = a, o.lastRead = Promise.resolve({ value: null, done: false }), o;
    }
    return t.prototype.summary = function() {
      return this.upstream.summary() + " -> RowMajorBatch";
    }, t.prototype.next = function() {
      return Za(this, void 0, void 0, function() {
        var r = this;
        return Ja(this, function(n) {
          return this.lastRead = this.lastRead.then(function() {
            return r.serialNext();
          }), [2, this.lastRead];
        });
      });
    }, t.prototype.serialNext = function() {
      return Za(this, void 0, void 0, function() {
        var r, n;
        return Ja(this, function(a) {
          switch (a.label) {
            case 0:
              r = [], a.label = 1;
            case 1:
              return r.length < this.batchSize ? [4, this.upstream.next()] : [3, 3];
            case 2:
              return n = a.sent(), n.done ? this.enableSmallLastBatch && r.length > 0 ? [2, { value: r, done: false }] : [2, { value: null, done: true }] : (r.push(n.value), [3, 1]);
            case 3:
              return [2, { value: r, done: false }];
          }
        });
      });
    }, t;
  }(fc), $Fe = function(e) {
    ps(t, e);
    function t(r, n) {
      var a = e.call(this) || this;
      return a.upstream = r, a.predicate = n, a.lastRead = Promise.resolve({ value: null, done: false }), a;
    }
    return t.prototype.summary = function() {
      return this.upstream.summary() + " -> Filter";
    }, t.prototype.next = function() {
      return Za(this, void 0, void 0, function() {
        var r = this;
        return Ja(this, function(n) {
          return this.lastRead = this.lastRead.then(function() {
            return r.serialNext();
          }), [2, this.lastRead];
        });
      });
    }, t.prototype.serialNext = function() {
      return Za(this, void 0, void 0, function() {
        var r;
        return Ja(this, function(n) {
          switch (n.label) {
            case 0:
              return [4, this.upstream.next()];
            case 1:
              return r = n.sent(), r.done || this.predicate(r.value) ? [2, r] : (Fl.dispose(r.value), [3, 0]);
            case 2:
              return [2];
          }
        });
      });
    }, t;
  }(fc), HFe = function(e) {
    ps(t, e);
    function t(r, n) {
      var a = e.call(this) || this;
      return a.upstream = r, a.transform = n, a;
    }
    return t.prototype.summary = function() {
      return this.upstream.summary() + " -> Map";
    }, t.prototype.next = function() {
      return Za(this, void 0, void 0, function() {
        var r, n, a, o, s, i, l, u2, c;
        return Ja(this, function(f) {
          switch (f.label) {
            case 0:
              return [4, this.upstream.next()];
            case 1:
              if (r = f.sent(), r.done) return [2, { value: null, done: true }];
              n = Fl.tensor_util.getTensorsInContainer(r.value), a = this.transform(r.value), o = Fl.tensor_util.getTensorsInContainer(a);
              try {
                for (s = gg(n), i = s.next(); !i.done; i = s.next()) l = i.value, Fl.tensor_util.isTensorInList(l, o) || l.dispose();
              } catch (h) {
                u2 = { error: h };
              } finally {
                try {
                  i && !i.done && (c = s.return) && c.call(s);
                } finally {
                  if (u2) throw u2.error;
                }
              }
              return [2, { value: a, done: false }];
          }
        });
      });
    }, t;
  }(fc), qFe = function(e) {
    ps(t, e);
    function t(r, n) {
      var a = e.call(this) || this;
      return a.upstream = r, a.handler = n, a.count = 0, a.lastRead = Promise.resolve({ value: null, done: false }), a;
    }
    return t.prototype.summary = function() {
      return this.upstream.summary() + " -> handleErrors";
    }, t.prototype.next = function() {
      return Za(this, void 0, void 0, function() {
        var r = this;
        return Ja(this, function(n) {
          return this.lastRead = this.lastRead.then(function() {
            return r.serialNext();
          }), [2, this.lastRead];
        });
      });
    }, t.prototype.serialNext = function() {
      return Za(this, void 0, void 0, function() {
        var r;
        return Ja(this, function(n) {
          switch (n.label) {
            case 0:
              n.label = 1;
            case 1:
              return n.trys.push([1, 3, , 4]), [4, this.upstream.next()];
            case 2:
              return [2, n.sent()];
            case 3:
              return r = n.sent(), this.handler(r) ? [3, 4] : [2, { value: null, done: true }];
            case 4:
              return [3, 0];
            case 5:
              return [2];
          }
        });
      });
    }, t;
  }(fc), GG = function(e) {
    ps(t, e);
    function t(r, n) {
      var a = e.call(this) || this;
      return a.upstream = r, a.transform = n, a;
    }
    return t.prototype.summary = function() {
      return this.upstream.summary() + " -> AsyncMap";
    }, t.prototype.next = function() {
      return Za(this, void 0, void 0, function() {
        var r, n, a, o, s, i, l, u2, c;
        return Ja(this, function(f) {
          switch (f.label) {
            case 0:
              return [4, this.upstream.next()];
            case 1:
              return r = f.sent(), r.done ? [2, { value: null, done: true }] : (n = Fl.tensor_util.getTensorsInContainer(r.value), [4, this.transform(r.value)]);
            case 2:
              a = f.sent(), o = Fl.tensor_util.getTensorsInContainer(a);
              try {
                for (s = gg(n), i = s.next(); !i.done; i = s.next()) l = i.value, Fl.tensor_util.isTensorInList(l, o) || l.dispose();
              } catch (h) {
                u2 = { error: h };
              } finally {
                try {
                  i && !i.done && (c = s.return) && c.call(s);
                } finally {
                  if (u2) throw u2.error;
                }
              }
              return [2, { value: a, done: false }];
          }
        });
      });
    }, t;
  }(fc), JM = function(e) {
    ps(t, e);
    function t() {
      var r = e.call(this) || this;
      return r.outputQueue = new JG(), r.lastRead = Promise.resolve({ value: null, done: false }), r;
    }
    return t.prototype.next = function() {
      return Za(this, void 0, void 0, function() {
        var r = this;
        return Ja(this, function(n) {
          return this.lastRead = this.lastRead.then(function() {
            return r.serialNext();
          }), [2, this.lastRead];
        });
      });
    }, t.prototype.serialNext = function() {
      return Za(this, void 0, void 0, function() {
        return Ja(this, function(r) {
          switch (r.label) {
            case 0:
              return this.outputQueue.length() !== 0 ? [3, 2] : [4, this.pump()];
            case 1:
              return r.sent() ? [3, 0] : [2, { value: null, done: true }];
            case 2:
              return [2, { value: this.outputQueue.shift(), done: false }];
          }
        });
      });
    }, t;
  }(fc), XFe = function(e) {
    ps(t, e);
    function t(r, n) {
      var a = e.call(this) || this;
      return a.upstream = r, a.transform = n, a;
    }
    return t.prototype.summary = function() {
      return this.upstream.summary() + " -> Flatmap";
    }, t.prototype.pump = function() {
      return Za(this, void 0, void 0, function() {
        var r, n, a, o, s, i, l, u2, c;
        return Ja(this, function(f) {
          switch (f.label) {
            case 0:
              return [4, this.upstream.next()];
            case 1:
              if (r = f.sent(), r.done) return [2, false];
              n = Fl.tensor_util.getTensorsInContainer(r.value), a = this.transform(r.value), o = Fl.tensor_util.getTensorsInContainer(a), this.outputQueue.pushAll(a);
              try {
                for (s = gg(n), i = s.next(); !i.done; i = s.next()) l = i.value, Fl.tensor_util.isTensorInList(l, o) || l.dispose();
              } catch (h) {
                u2 = { error: h };
              } finally {
                try {
                  i && !i.done && (c = s.return) && c.call(s);
                } finally {
                  if (u2) throw u2.error;
                }
              }
              return [2, true];
          }
        });
      });
    }, t;
  }(JM), e$ = function(e) {
    ps(t, e);
    function t(r, n) {
      var a = e.call(this) || this;
      return a.baseErrorHandler = n, a.lastRead = null, a.iterator = null, a.moreIterators = r, a;
    }
    return t.prototype.summary = function() {
      var r = "TODO: fill in upstream of chained summaries";
      return r + " -> Chained";
    }, t.prototype.next = function() {
      return Za(this, void 0, void 0, function() {
        return Ja(this, function(r) {
          return this.lastRead = this.readFromChain(this.lastRead), [2, this.lastRead];
        });
      });
    }, t.prototype.readFromChain = function(r) {
      return Za(this, void 0, void 0, function() {
        var n, a;
        return Ja(this, function(o) {
          switch (o.label) {
            case 0:
              return [4, r];
            case 1:
              return o.sent(), this.iterator != null ? [3, 3] : [4, this.moreIterators.next()];
            case 2:
              if (n = o.sent(), n.done) return [2, { value: null, done: true }];
              this.iterator = n.value, this.baseErrorHandler != null && (this.iterator = this.iterator.handleErrors(this.baseErrorHandler)), o.label = 3;
            case 3:
              return [4, this.iterator.next()];
            case 4:
              return a = o.sent(), a.done ? (this.iterator = null, [2, this.readFromChain(r)]) : [2, a];
          }
        });
      });
    }, t;
  }(fc), Lv;
  (function(e) {
    e[e.FAIL = 0] = "FAIL", e[e.SHORTEST = 1] = "SHORTEST", e[e.LONGEST = 2] = "LONGEST";
  })(Lv || (Lv = {}));
  var KFe = function(e) {
    ps(t, e);
    function t(r, n) {
      n === void 0 && (n = Lv.FAIL);
      var a = e.call(this) || this;
      return a.iterators = r, a.mismatchMode = n, a.count = 0, a.currentPromise = null, a;
    }
    return t.prototype.summary = function() {
      var r = "TODO: fill in upstream of zip summaries";
      return "{" + r + "} -> Zip";
    }, t.prototype.nextState = function(r) {
      return Za(this, void 0, void 0, function() {
        function n(i) {
          if (i instanceof fc) {
            var l = i.next();
            return { value: l.then(function(u2) {
              return a++, u2.done && o++, u2.value;
            }), recurse: false };
          } else return { value: null, recurse: true };
        }
        var a, o, s;
        return Ja(this, function(i) {
          switch (i.label) {
            case 0:
              return [4, r];
            case 1:
              return i.sent(), a = 0, o = 0, [4, YG(this.iterators, n)];
            case 2:
              if (s = i.sent(), a === o) return [2, { value: null, done: true }];
              if (o > 0) switch (this.mismatchMode) {
                case Lv.FAIL:
                  throw new Error("Zipped streams should have the same length. " + ("Mismatched at element " + this.count + "."));
                case Lv.SHORTEST:
                  return [2, { value: null, done: true }];
                case Lv.LONGEST:
              }
              return this.count++, [2, { value: s, done: false }];
          }
        });
      });
    }, t.prototype.next = function() {
      return Za(this, void 0, void 0, function() {
        return Ja(this, function(r) {
          return this.currentPromise = this.nextState(this.currentPromise), [2, this.currentPromise];
        });
      });
    }, t;
  }(fc), t$ = function(e) {
    ps(t, e);
    function t(r, n) {
      var a = e.call(this) || this;
      return a.upstream = r, a.bufferSize = n, a.buffer = new ZG(n), a;
    }
    return t.prototype.summary = function() {
      return this.upstream.summary() + " -> Prefetch";
    }, t.prototype.refill = function() {
      for (; !this.buffer.isFull(); ) {
        var r = this.upstream.next();
        this.buffer.push(r);
      }
    }, t.prototype.next = function() {
      return this.refill(), this.buffer.shift();
    }, t;
  }(fc), YFe = function(e) {
    ps(t, e);
    function t(r, n, a) {
      var o = e.call(this, r, n) || this;
      return o.upstream = r, o.windowSize = n, o.upstreamExhausted = false, o.random = qG.alea(a || Fl.util.now().toString()), o.lastRead = Promise.resolve({ value: null, done: false }), o;
    }
    return t.prototype.next = function() {
      return Za(this, void 0, void 0, function() {
        var r = this;
        return Ja(this, function(n) {
          return this.lastRead = this.lastRead.then(function() {
            return r.serialNext();
          }), [2, this.lastRead];
        });
      });
    }, t.prototype.randomInt = function(r) {
      return Math.floor(this.random() * r);
    }, t.prototype.chooseIndex = function() {
      return this.randomInt(this.buffer.length());
    }, t.prototype.serialNext = function() {
      return Za(this, void 0, void 0, function() {
        var r, n;
        return Ja(this, function(a) {
          switch (a.label) {
            case 0:
              this.upstreamExhausted || this.refill(), a.label = 1;
            case 1:
              return this.buffer.isEmpty() ? [3, 3] : (r = this.chooseIndex(), [4, this.buffer.shuffleExcise(r)]);
            case 2:
              if (n = a.sent(), n.done) this.upstreamExhausted = true;
              else return this.refill(), [2, n];
              return [3, 1];
            case 3:
              return [2, { value: null, done: true }];
          }
        });
      });
    }, t;
  }(t$), Ly = function() {
    function e() {
      this.size = null;
    }
    return e.prototype.batch = function(t, r) {
      var n = this;
      r === void 0 && (r = true);
      var a = this;
      Fl.util.assert(t > 0, function() {
        return `batchSize needs to be positive, but it is
      ` + t;
      });
      var o;
      return this.size === 1 / 0 || this.size == null ? o = this.size : r ? o = Math.ceil(this.size / t) : o = Math.floor(this.size / t), ch(function() {
        return Za(n, void 0, void 0, function() {
          return Ja(this, function(s) {
            switch (s.label) {
              case 0:
                return [4, a.iterator()];
              case 1:
                return [2, s.sent().columnMajorBatch(t, r, QFe)];
            }
          });
        });
      }, o);
    }, e.prototype.concatenate = function(t) {
      var r = this, n = this, a;
      return this.size === 1 / 0 || t.size === 1 / 0 ? a = 1 / 0 : this.size != null && t.size != null ? a = this.size + t.size : a = null, ch(function() {
        return Za(r, void 0, void 0, function() {
          var o, s;
          return Ja(this, function(i) {
            switch (i.label) {
              case 0:
                return [4, n.iterator()];
              case 1:
                return s = (o = i.sent()).concatenate, [4, t.iterator()];
              case 2:
                return [2, s.apply(o, [i.sent()])];
            }
          });
        });
      }, a);
    }, e.prototype.filter = function(t) {
      var r = this, n = this, a;
      return this.size === 1 / 0 ? a = 1 / 0 : a = null, ch(function() {
        return Za(r, void 0, void 0, function() {
          return Ja(this, function(o) {
            switch (o.label) {
              case 0:
                return [4, n.iterator()];
              case 1:
                return [2, o.sent().filter(function(s) {
                  return Fl.tidy(function() {
                    return t(s);
                  });
                })];
            }
          });
        });
      }, a);
    }, e.prototype.forEachAsync = function(t) {
      return Za(this, void 0, void 0, function() {
        return Ja(this, function(r) {
          switch (r.label) {
            case 0:
              return [4, this.iterator()];
            case 1:
              return [2, r.sent().forEachAsync(t)];
          }
        });
      });
    }, e.prototype.map = function(t) {
      var r = this, n = this;
      return ch(function() {
        return Za(r, void 0, void 0, function() {
          return Ja(this, function(a) {
            switch (a.label) {
              case 0:
                return [4, n.iterator()];
              case 1:
                return [2, a.sent().map(function(o) {
                  return Fl.tidy(function() {
                    return t(o);
                  });
                })];
            }
          });
        });
      }, this.size);
    }, e.prototype.mapAsync = function(t) {
      var r = this, n = this;
      return ch(function() {
        return Za(r, void 0, void 0, function() {
          return Ja(this, function(a) {
            switch (a.label) {
              case 0:
                return [4, n.iterator()];
              case 1:
                return [2, a.sent().mapAsync(t)];
            }
          });
        });
      }, this.size);
    }, e.prototype.prefetch = function(t) {
      var r = this;
      if (t == null) throw new RangeError("`Dataset.prefetch()` requires bufferSize to be specified.");
      var n = this;
      return ch(function() {
        return Za(r, void 0, void 0, function() {
          return Ja(this, function(a) {
            switch (a.label) {
              case 0:
                return [4, n.iterator()];
              case 1:
                return [2, a.sent().prefetch(t)];
            }
          });
        });
      }, this.size);
    }, e.prototype.repeat = function(t) {
      var r = this, n = this, a;
      return this.size != null && t > 0 ? a = this.size * t : t === 0 ? a = 0 : this.size != null && (t === void 0 || t < 0) ? a = 1 / 0 : a = null, ch(function() {
        return Za(r, void 0, void 0, function() {
          var o, s = this;
          return Ja(this, function(i) {
            return o = ZM(function() {
              return Za(s, void 0, void 0, function() {
                var l;
                return Ja(this, function(u2) {
                  switch (u2.label) {
                    case 0:
                      return l = {}, [4, n.iterator()];
                    case 1:
                      return [2, (l.value = u2.sent(), l.done = false, l)];
                  }
                });
              });
            }), [2, RFe(o.take(t))];
          });
        });
      }, a);
    }, e.prototype.skip = function(t) {
      var r = this, n = this, a;
      return this.size != null && t >= 0 && this.size >= t ? a = this.size - t : this.size != null && (this.size < t || t === void 0 || t < 0) ? a = 0 : a = null, ch(function() {
        return Za(r, void 0, void 0, function() {
          return Ja(this, function(o) {
            switch (o.label) {
              case 0:
                return [4, n.iterator()];
              case 1:
                return [2, o.sent().skip(t)];
            }
          });
        });
      }, a);
    }, e.prototype.shuffle = function(t, r, n) {
      var a = this;
      if (n === void 0 && (n = true), t == null || t < 0) throw this.size == null ? new RangeError("`Dataset.shuffle()` requires bufferSize to be specified.") : new RangeError("`Dataset.shuffle()` requires bufferSize to be specified.  If your data fits in main memory (for regular JS objects), and/or GPU memory (for `tf.Tensor`s), consider setting " + ("bufferSize to the dataset size (" + this.size + " elements)"));
      var o = this, s = qG.alea(r || Fl.util.now().toString());
      return ch(function() {
        return Za(a, void 0, void 0, function() {
          var i;
          return Ja(this, function(l) {
            switch (l.label) {
              case 0:
                return i = s.int32(), n && (i += s.int32()), [4, o.iterator()];
              case 1:
                return [2, l.sent().shuffle(t, i.toString())];
            }
          });
        });
      }, this.size);
    }, e.prototype.take = function(t) {
      var r = this, n = this, a;
      return this.size != null && this.size > t ? a = t : this.size != null && this.size <= t ? a = this.size : a = null, ch(function() {
        return Za(r, void 0, void 0, function() {
          return Ja(this, function(o) {
            switch (o.label) {
              case 0:
                return [4, n.iterator()];
              case 1:
                return [2, o.sent().take(t)];
            }
          });
        });
      }, a);
    }, e.prototype.toArray = function() {
      return Za(this, void 0, void 0, function() {
        return Ja(this, function(t) {
          switch (t.label) {
            case 0:
              if (this.size === 1 / 0) throw new Error("Can not convert infinite data stream to array.");
              return [4, this.iterator()];
            case 1:
              return [2, t.sent().toArray()];
          }
        });
      });
    }, e.prototype.toArrayForTest = function() {
      return Za(this, void 0, void 0, function() {
        return Ja(this, function(t) {
          switch (t.label) {
            case 0:
              if (this.size === 1 / 0) throw new Error("Can not convert infinite data stream to array.");
              return [4, this.iterator()];
            case 1:
              return [2, t.sent().toArrayForTest()];
          }
        });
      });
    }, e;
  }();
  Ly.MAX_BUFFER_SIZE = 1e4;
  function ch(e, t) {
    return t === void 0 && (t = null), new (function(r) {
      ps(n, r);
      function n() {
        var a = r.apply(this, bFe(arguments)) || this;
        return a.size = t, a;
      }
      return n.prototype.iterator = function() {
        return Za(this, void 0, void 0, function() {
          return Ja(this, function(a) {
            return [2, e()];
          });
        });
      }, n;
    }(Ly))();
  }
  function ZFe(e) {
    var t = this;
    return ch(function() {
      return Za(t, void 0, void 0, function() {
        return Ja(this, function(r) {
          return [2, QG(e)];
        });
      });
    }, e.length);
  }
  function JFe(e) {
    var t = this;
    if (!Py(e)) throw new Error("The argument to zip() must be an object or array.");
    var r;
    if (Array.isArray(e)) for (var n = 0; n < e.length; n++) r = r == null ? e[n].size : Math.min(r, e[n].size);
    else if (e instanceof Object) for (var a in e) r = r == null ? e[a].size : Math.min(r, e[a].size);
    return ch(function() {
      return Za(t, void 0, void 0, function() {
        var o;
        return Ja(this, function(s) {
          switch (s.label) {
            case 0:
              return [4, YG(e, function(i) {
                if (i instanceof Ly) return { value: i.iterator(), recurse: false };
                if (Py(i)) return { value: null, recurse: true };
                throw new Error("Leaves of the structure passed to zip() must be Datasets, not primitives.");
              })];
            case 1:
              return o = s.sent(), [2, zFe(o, Lv.SHORTEST)];
          }
        });
      });
    }, r);
  }
  function QFe(e) {
    if (e === null) return null;
    var t = e[0];
    if (FFe(t)) {
      var r = e8e(e);
      return { value: r, recurse: false };
    }
    return { value: null, recurse: true };
  }
  function e8e(e) {
    if (e.length === 0) throw new Error("Can't make a batch of zero elements.");
    return e[0] instanceof Fl.Tensor ? Fl.stack(e) : Fl.tensor(e);
  }
  var r$ = function(e) {
    ps(t, e);
    function t(r) {
      var n = e.call(this) || this;
      return n.input = r, n;
    }
    return t.prototype.iterator = function() {
      return Za(this, void 0, void 0, function() {
        var r, n, a;
        return Ja(this, function(o) {
          switch (o.label) {
            case 0:
              return [4, this.input.iterator()];
            case 1:
              return r = o.sent(), n = r.decodeUTF8(), a = n.split(`
`).map(function(s) {
                return s.endsWith("\r") && (s = s.slice(0, -1)), s;
              }), [2, a];
          }
        });
      });
    }, t;
  }(Ly), cT = '"', R2 = Symbol("out"), $G = Symbol("field"), fT = Symbol("quote"), KM = Symbol("quoteafterquote"), HG = Symbol("quoteinquote"), n$ = function(e) {
    ps(t, e);
    function t(r, n) {
      var a = e.call(this) || this;
      return a.input = r, a.hasHeader = true, a.fullColumnNames = null, a.columnNamesValidated = false, a.columnConfigs = null, a.configuredColumnsOnly = false, a.delimiter = ",", a.delimWhitespace = false, a.base = new r$(r), n || (n = {}), a.hasHeader = n.hasHeader !== false, a.fullColumnNames = n.columnNames, a.columnConfigs = n.columnConfigs, a.configuredColumnsOnly = n.configuredColumnsOnly, n.delimWhitespace ? (jl.util.assert(n.delimiter == null, function() {
        return "Delimiter should not be provided when delimWhitespace is true.";
      }), a.delimWhitespace = true, a.delimiter = " ") : a.delimiter = n.delimiter ? n.delimiter : ",", a;
    }
    return t.prototype.columnNames = function() {
      return Za(this, void 0, void 0, function() {
        return Ja(this, function(r) {
          switch (r.label) {
            case 0:
              return this.columnNamesValidated ? [3, 2] : [4, this.setColumnNames()];
            case 1:
              r.sent(), r.label = 2;
            case 2:
              return [2, this.configuredColumnsOnly ? Object.keys(this.columnConfigs) : this.fullColumnNames];
          }
        });
      });
    }, t.prototype.setColumnNames = function() {
      return Za(this, void 0, void 0, function() {
        var r, n, a, o, s, i, l, u2, c, f = this;
        return Ja(this, function(h) {
          switch (h.label) {
            case 0:
              return [4, this.maybeReadHeaderLine()];
            case 1:
              if (r = h.sent(), !this.fullColumnNames && !r) throw new Error("Column names must be provided if there is no header line.");
              if (this.fullColumnNames && r && jl.util.assert(r.length === this.fullColumnNames.length, function() {
                return "The length of provided columnNames (" + f.fullColumnNames.length.toString() + ") does not match the length of the header line read from file (" + r.length.toString() + ").";
              }), this.fullColumnNames || (this.fullColumnNames = r), n = this.fullColumnNames.reduce(function(p, d) {
                return p[d] = p[d] + 1 || 1, p;
              }, {}), a = Object.keys(n).filter(function(p) {
                return n[p] > 1;
              }), jl.util.assert(a.length === 0, function() {
                return "Duplicate column names found: " + a.toString();
              }), this.columnConfigs) try {
                for (o = gg(Object.keys(this.columnConfigs)), s = o.next(); !s.done; s = o.next()) if (i = s.value, l = this.fullColumnNames.indexOf(i), l === -1) throw new Error('The key "' + i + '" provided in columnConfigs does not match any of the column names (' + this.fullColumnNames.toString() + ").");
              } catch (p) {
                u2 = { error: p };
              } finally {
                try {
                  s && !s.done && (c = o.return) && c.call(o);
                } finally {
                  if (u2) throw u2.error;
                }
              }
              return this.columnNamesValidated = true, [2];
          }
        });
      });
    }, t.prototype.maybeReadHeaderLine = function() {
      return Za(this, void 0, void 0, function() {
        var r, n, a, o;
        return Ja(this, function(s) {
          switch (s.label) {
            case 0:
              return this.hasHeader ? [4, this.base.iterator()] : [3, 3];
            case 1:
              return r = s.sent(), [4, r.next()];
            case 2:
              if (n = s.sent(), n.done) throw new Error("No data was found for CSV parsing.");
              return a = n.value, o = this.parseRow(a, false), [2, o];
            case 3:
              return [2, null];
          }
        });
      });
    }, t.prototype.iterator = function() {
      return Za(this, void 0, void 0, function() {
        var r, n = this;
        return Ja(this, function(a) {
          switch (a.label) {
            case 0:
              return this.columnNamesValidated ? [3, 2] : [4, this.setColumnNames()];
            case 1:
              a.sent(), a.label = 2;
            case 2:
              return [4, this.base.iterator()];
            case 3:
              return r = a.sent(), this.hasHeader && (r = r.skip(1)), [2, r.map(function(o) {
                return n.makeDataElement(o);
              })];
          }
        });
      });
    }, t.prototype.makeDataElement = function(r) {
      for (var n = this.parseRow(r), a = {}, o = {}, s = 0; s < this.fullColumnNames.length; s++) {
        var i = this.fullColumnNames[s], l = this.columnConfigs ? this.columnConfigs[i] : null;
        if (!(this.configuredColumnsOnly && !l)) {
          var u2 = n[s], c = null;
          if (u2 === "") if (l && l.default !== void 0) c = l.default;
          else {
            if (l && (l.required || l.isLabel)) throw new Error("Required column " + i + " is empty in this line: " + r);
            c = void 0;
          }
          else {
            var f = Number(u2);
            if (isNaN(f)) l && l.dtype === "bool" ? c = this.getBoolean(u2) : c = u2;
            else if (!l || !l.dtype) c = f;
            else switch (l.dtype) {
              case "float32":
                c = f;
                break;
              case "int32":
                c = Math.floor(f);
                break;
              case "bool":
                c = this.getBoolean(u2);
                break;
              default:
                c = f;
            }
          }
          l && l.isLabel ? o[i] = c : a[i] = c;
        }
      }
      return Object.keys(o).length === 0 ? a : { xs: a, ys: o };
    }, t.prototype.getBoolean = function(r) {
      return r === "1" || r.toLowerCase() === "true" ? 1 : 0;
    }, t.prototype.parseRow = function(r, n) {
      n === void 0 && (n = true);
      for (var a = [], o = 0, s = r.length, i = R2, l = 0; l < s; l++) switch (i) {
        case R2:
          switch (r.charAt(l)) {
            case cT:
              o = l + 1, i = fT;
              break;
            case this.delimiter:
              if (o = l + 1, this.delimiter === " " && this.delimWhitespace) break;
              a.push(""), i = R2;
              break;
            default:
              i = $G, o = l;
              break;
          }
          break;
        case $G:
          switch (r.charAt(l)) {
            case this.delimiter:
              a.push(r.substring(o, l)), i = R2, o = l + 1;
              break;
          }
          break;
        case fT:
          switch (r.charAt(l)) {
            case cT:
              i = KM;
              break;
          }
          break;
        case KM:
          switch (r.charAt(l)) {
            case this.delimiter:
              a.push(r.substring(o, l - 1)), i = R2, o = l + 1;
              break;
            case cT:
              i = fT;
              break;
            default:
              i = HG;
              break;
          }
          break;
        case HG:
          switch (r.charAt(l)) {
            case cT:
              i = fT;
              break;
          }
          break;
      }
      if (i === KM ? a.push(r.substring(o, s - 1)) : a.push(r.substring(o)), n && a.length !== this.fullColumnNames.length) throw new Error("Invalid row in csv file. Should have " + this.fullColumnNames.length + " elements in a row, but got " + a);
      return a;
    }, t;
  }(Ly), t8e = function(e) {
    ps(t, e);
    function t(r) {
      var n = e.call(this) || this;
      n.microphoneConfig = r, n.isClosed = false, n.fftSize = r.fftSize || 1024;
      var a = Math.log2(n.fftSize);
      if (n.fftSize < 0 || a < 4 || a > 14 || !Number.isInteger(a)) throw new Error("Invalid fftSize: it must be a power of 2 between " + ("2 to 4 and 2 to 14, but got " + n.fftSize));
      if (n.numFrames = r.numFramesPerSpectrogram || 43, n.sampleRateHz = r.sampleRateHz, n.columnTruncateLength = r.columnTruncateLength || n.fftSize, n.audioTrackConstraints = r.audioTrackConstraints, n.smoothingTimeConstant = r.smoothingTimeConstant || 0, n.includeSpectrogram = r.includeSpectrogram !== false, n.includeWaveform = r.includeWaveform === true, !n.includeSpectrogram && !n.includeWaveform) throw new Error("Both includeSpectrogram and includeWaveform are false. At least one type of data should be returned.");
      return n;
    }
    return t.prototype.summary = function() {
      return "microphone";
    }, t.create = function(r) {
      return r === void 0 && (r = {}), Za(this, void 0, void 0, function() {
        var n;
        return Ja(this, function(a) {
          switch (a.label) {
            case 0:
              if (jl.env().get("IS_NODE")) throw new Error("microphone API is only supported in browser environment.");
              return n = new t(r), [4, n.start()];
            case 1:
              return a.sent(), [2, n];
          }
        });
      });
    }, t.prototype.start = function() {
      return Za(this, void 0, void 0, function() {
        var r, n, a, o;
        return Ja(this, function(s) {
          switch (s.label) {
            case 0:
              return s.trys.push([0, 2, , 3]), r = this, [4, navigator.mediaDevices.getUserMedia({ audio: this.audioTrackConstraints == null ? true : this.audioTrackConstraints, video: false })];
            case 1:
              return r.stream = s.sent(), [3, 3];
            case 2:
              throw n = s.sent(), new Error("Error thrown while initializing video stream: " + n.message);
            case 3:
              if (!this.stream) throw new Error("Could not obtain audio from microphone.");
              if (a = window.AudioContext || window.webkitAudioContext, this.audioContext = new a(), !this.sampleRateHz) this.sampleRateHz = this.audioContext.sampleRate;
              else if (this.audioContext.sampleRate !== this.sampleRateHz) throw new Error("Mismatch in sampling rate: " + ("Expected: " + this.sampleRateHz + "; ") + ("Actual: " + this.audioContext.sampleRate));
              return o = this.audioContext.createMediaStreamSource(this.stream), this.analyser = this.audioContext.createAnalyser(), this.analyser.fftSize = this.fftSize * 2, this.analyser.smoothingTimeConstant = this.smoothingTimeConstant, o.connect(this.analyser), this.freqData = new Float32Array(this.fftSize), this.timeData = new Float32Array(this.fftSize), [2];
          }
        });
      });
    }, t.prototype.next = function() {
      return Za(this, void 0, void 0, function() {
        var r, n, a, o, s;
        return Ja(this, function(i) {
          switch (i.label) {
            case 0:
              return this.isClosed ? [2, { value: null, done: true }] : [4, this.getAudioData()];
            case 1:
              return a = i.sent(), this.includeSpectrogram && (o = this.flattenQueue(a.freqDataQueue), r = this.getTensorFromAudioDataArray(o, [this.numFrames, this.columnTruncateLength, 1])), this.includeWaveform && (s = this.flattenQueue(a.timeDataQueue), n = this.getTensorFromAudioDataArray(s, [this.numFrames * this.fftSize, 1])), [2, { value: { spectrogram: r, waveform: n }, done: false }];
          }
        });
      });
    }, t.prototype.capture = function() {
      return Za(this, void 0, void 0, function() {
        return Ja(this, function(r) {
          switch (r.label) {
            case 0:
              return [4, this.next()];
            case 1:
              return [2, r.sent().value];
          }
        });
      });
    }, t.prototype.getAudioData = function() {
      return Za(this, void 0, void 0, function() {
        var r, n, a, o = this;
        return Ja(this, function(s) {
          return r = [], n = [], a = 0, [2, new Promise(function(i) {
            var l = setInterval(function() {
              o.includeSpectrogram && (o.analyser.getFloatFrequencyData(o.freqData), o.freqData[0] === -1 / 0 && i({ freqDataQueue: r, timeDataQueue: n }), r.push(o.freqData.slice(0, o.columnTruncateLength))), o.includeWaveform && (o.analyser.getFloatTimeDomainData(o.timeData), n.push(o.timeData.slice())), ++a === o.numFrames && (clearInterval(l), i({ freqDataQueue: r, timeDataQueue: n }));
            }, o.fftSize / o.sampleRateHz * 1e3);
          })];
        });
      });
    }, t.prototype.stop = function() {
      this.isClosed || (this.isClosed = true, this.analyser.disconnect(), this.audioContext.close(), this.stream != null && this.stream.getTracks().length > 0 && this.stream.getTracks()[0].stop());
    }, t.prototype.toArray = function() {
      throw new Error("Can not convert infinite audio stream to array.");
    }, t.prototype.getSampleRate = function() {
      return this.sampleRateHz;
    }, t.prototype.flattenQueue = function(r) {
      var n = r[0].length, a = new Float32Array(r.length * n);
      return r.forEach(function(o, s) {
        return a.set(o, s * n);
      }), a;
    }, t.prototype.getTensorFromAudioDataArray = function(r, n) {
      var a = new Float32Array(jl.util.sizeFromShape(n));
      return a.set(r, a.length - r.length), jl.tensor(a, n);
    }, t;
  }(fc), r8e = function(e) {
    ps(t, e);
    function t(r, n) {
      var a = e.call(this) || this;
      if (a.webcamVideoElement = r, a.webcamConfig = n, a.isClosed = true, a.resize = false, a.needToResize()) if (a.resize = true, a.cropSize = [a.webcamConfig.resizeHeight, a.webcamConfig.resizeWidth], a.cropBoxInd = jl.tensor1d([0], "int32"), a.webcamConfig.centerCrop) {
        var o = a.webcamConfig.resizeWidth * 1 / a.webcamVideoElement.width, s = a.webcamConfig.resizeHeight * 1 / a.webcamVideoElement.height, i = (1 - o) / 2, l = (1 - s) / 2, u2 = i + o, c = s + l;
        a.cropBox = jl.tensor2d([l, i, c, u2], [1, 4]);
      } else a.cropBox = jl.tensor2d([0, 0, 1, 1], [1, 4]);
      return a;
    }
    return t.prototype.summary = function() {
      return "webcam";
    }, t.create = function(r, n) {
      return n === void 0 && (n = {}), Za(this, void 0, void 0, function() {
        var a;
        return Ja(this, function(o) {
          switch (o.label) {
            case 0:
              if (jl.env().get("IS_NODE")) throw new Error("tf.data.webcam is only supported in browser environment.");
              if (!r) {
                if (r = document.createElement("video"), !n.resizeWidth || !n.resizeHeight) throw new Error("Please provide webcam video element, or resizeWidth and resizeHeight to create a hidden video element.");
                r.width = n.resizeWidth, r.height = n.resizeHeight;
              }
              return a = new t(r, n), [4, a.start()];
            case 1:
              return o.sent(), [2, a];
          }
        });
      });
    }, t.prototype.start = function() {
      return Za(this, void 0, void 0, function() {
        var r, n, a = this;
        return Ja(this, function(o) {
          switch (o.label) {
            case 0:
              this.webcamConfig.facingMode && jl.util.assert(this.webcamConfig.facingMode === "user" || this.webcamConfig.facingMode === "environment", function() {
                return "Invalid webcam facing mode: " + a.webcamConfig.facingMode + ". Please provide 'user' or 'environment'";
              }), o.label = 1;
            case 1:
              return o.trys.push([1, 3, , 4]), r = this, [4, navigator.mediaDevices.getUserMedia({ video: { deviceId: this.webcamConfig.deviceId, facingMode: this.webcamConfig.facingMode ? this.webcamConfig.facingMode : "user", width: this.webcamVideoElement.width, height: this.webcamVideoElement.height } })];
            case 2:
              return r.stream = o.sent(), [3, 4];
            case 3:
              throw n = o.sent(), n.message = "Error thrown while initializing video stream: " + n.message, n;
            case 4:
              if (!this.stream) throw new Error("Could not obtain video from webcam.");
              try {
                this.webcamVideoElement.srcObject = this.stream;
              } catch (s) {
                console.log(s), this.webcamVideoElement.src = window.URL.createObjectURL(this.stream);
              }
              return this.webcamVideoElement.play(), this.isClosed = false, [2, new Promise(function(s) {
                a.webcamVideoElement.onloadedmetadata = function() {
                  s();
                };
              })];
          }
        });
      });
    }, t.prototype.next = function() {
      return Za(this, void 0, void 0, function() {
        var r;
        return Ja(this, function(n) {
          if (this.isClosed) return [2, { value: null, done: true }];
          try {
            r = jl.browser.fromPixels(this.webcamVideoElement);
          } catch (a) {
            throw new Error("Error thrown converting video to pixels: " + JSON.stringify(a));
          }
          if (this.resize) try {
            return [2, { value: this.cropAndResizeFrame(r), done: false }];
          } catch (a) {
            throw new Error("Error thrown cropping the video: " + a.message);
          } finally {
            r.dispose();
          }
          else return [2, { value: r, done: false }];
          return [2];
        });
      });
    }, t.prototype.needToResize = function() {
      return !!(this.webcamConfig.resizeWidth && this.webcamConfig.resizeHeight && (this.webcamVideoElement.width !== this.webcamConfig.resizeWidth || this.webcamVideoElement.height !== this.webcamConfig.resizeHeight));
    }, t.prototype.cropAndResizeFrame = function(r) {
      var n = this;
      return jl.tidy(function() {
        var a = jl.expandDims(jl.cast(r, "float32"), 0), o;
        o = jl.image.cropAndResize(a, n.cropBox, n.cropBoxInd, n.cropSize, "bilinear");
        var s = o.shape;
        return jl.reshape(o, s.slice(1));
      });
    }, t.prototype.capture = function() {
      return Za(this, void 0, void 0, function() {
        return Ja(this, function(r) {
          switch (r.label) {
            case 0:
              return [4, this.next()];
            case 1:
              return [2, r.sent().value];
          }
        });
      });
    }, t.prototype.stop = function() {
      var r = this.stream.getTracks();
      r.forEach(function(n) {
        return n.stop();
      });
      try {
        this.webcamVideoElement.srcObject = null;
      } catch (n) {
        console.log(n), this.webcamVideoElement.src = null;
      }
      this.isClosed = true;
    }, t.prototype.toArray = function() {
      throw new Error("Can not convert infinite video stream to array.");
    }, t;
  }(fc);
  var a$ = /* @__PURE__ */ function() {
    function e() {
    }
    return e;
  }(), i$ = function(e) {
    ps(t, e);
    function t() {
      return e !== null && e.apply(this, arguments) || this;
    }
    return t.prototype.split = function(r) {
      return new n8e(this, r);
    }, t;
  }(fc), n8e = function(e) {
    ps(t, e);
    function t(r, n) {
      var a = e.call(this) || this;
      return a.upstream = r, a.impl = new a8e(r, n), a;
    }
    return t.prototype.summary = function() {
      return this.impl.summary();
    }, t.prototype.next = function() {
      return Za(this, void 0, void 0, function() {
        return Ja(this, function(r) {
          return [2, this.impl.next()];
        });
      });
    }, t;
  }(i$), a8e = function(e) {
    ps(t, e);
    function t(r, n) {
      var a = e.call(this) || this;
      return a.upstream = r, a.separator = n, a.carryover = "", a;
    }
    return t.prototype.summary = function() {
      return this.upstream.summary() + " -> Split('" + this.separator + "')";
    }, t.prototype.pump = function() {
      return Za(this, void 0, void 0, function() {
        var r, n, a, o, s, i, l;
        return Ja(this, function(u2) {
          switch (u2.label) {
            case 0:
              return [4, this.upstream.next()];
            case 1:
              if (r = u2.sent(), r.done) return this.carryover === "" ? [2, false] : (this.outputQueue.push(this.carryover), this.carryover = "", [2, true]);
              n = r.value.split(this.separator), n[0] = this.carryover + n[0];
              try {
                for (a = gg(n.slice(0, -1)), o = a.next(); !o.done; o = a.next()) s = o.value, this.outputQueue.push(s);
              } catch (c) {
                i = { error: c };
              } finally {
                try {
                  o && !o.done && (l = a.return) && l.call(a);
                } finally {
                  if (i) throw i.error;
                }
              }
              return this.carryover = n[n.length - 1], [2, true];
          }
        });
      });
    }, t;
  }(JM), i8e = function(e) {
    ps(t, e);
    function t() {
      return e !== null && e.apply(this, arguments) || this;
    }
    return t.prototype.decodeUTF8 = function() {
      return new o8e(this);
    }, t;
  }(fc), o8e = function(e) {
    ps(t, e);
    function t(r) {
      var n = e.call(this) || this;
      return n.upstream = r, n.impl = new s8e(r), n;
    }
    return t.prototype.summary = function() {
      return this.impl.summary();
    }, t.prototype.next = function() {
      return Za(this, void 0, void 0, function() {
        return Ja(this, function(r) {
          return [2, this.impl.next()];
        });
      });
    }, t;
  }(i$), s8e = function(e) {
    ps(t, e);
    function t(r) {
      var n = e.call(this) || this;
      if (n.upstream = r, jl.env().get("IS_BROWSER")) n.decoder = new TextDecoder("utf-8");
      else {
        var a = XM().StringDecoder;
        n.decoder = new a("utf8");
      }
      return n;
    }
    return t.prototype.summary = function() {
      return this.upstream.summary() + " -> Utf8";
    }, t.prototype.pump = function() {
      return Za(this, void 0, void 0, function() {
        var r, n, a;
        return Ja(this, function(o) {
          switch (o.label) {
            case 0:
              return [4, this.upstream.next()];
            case 1:
              return r = o.sent(), r.done ? [2, false] : (n = r.value, jl.env().get("IS_BROWSER") ? a = this.decoder.decode(n, { stream: true }) : a = this.decoder.write(Buffer.from(n.buffer)), this.outputQueue.push(a), [2, true]);
          }
        });
      });
    }, t;
  }(JM), o$ = function(e) {
    ps(t, e);
    function t(r, n) {
      n === void 0 && (n = {});
      var a = e.call(this) || this;
      return a.file = r, a.options = n, jl.util.assert(r instanceof Uint8Array || (jl.env().get("IS_BROWSER") ? r instanceof File || r instanceof Blob : false), function() {
        return "FileChunkIterator only supports File, Blob and Uint8Array right now.";
      }), a.offset = n.offset || 0, a.chunkSize = n.chunkSize || 1024 * 1024, a;
    }
    return t.prototype.summary = function() {
      return "FileChunks " + this.file;
    }, t.prototype.next = function() {
      return Za(this, void 0, void 0, function() {
        var r, n, a = this;
        return Ja(this, function(o) {
          switch (o.label) {
            case 0:
              return this.offset >= (this.file instanceof Uint8Array ? this.file.byteLength : this.file.size) ? [2, { value: null, done: true }] : (r = new Promise(function(s, i) {
                var l = a.offset + a.chunkSize;
                if (a.file instanceof Uint8Array) s(new Uint8Array(a.file.slice(a.offset, l)));
                else {
                  var u2 = new FileReader();
                  u2.onload = function(f) {
                    var h = u2.result;
                    if (h instanceof ArrayBuffer && (h = new Uint8Array(h)), !(h instanceof Uint8Array)) return i(new TypeError("FileReader returned unknown type."));
                    s(h);
                  }, u2.onabort = function(f) {
                    return i(new Error("Aborted"));
                  }, u2.onerror = function(f) {
                    return i(new Error(f.type));
                  };
                  var c = a.file.slice(a.offset, l);
                  u2.readAsArrayBuffer(c);
                }
                a.offset = l;
              }), n = {}, [4, r]);
            case 1:
              return [2, (n.value = o.sent(), n.done = false, n)];
          }
        });
      });
    }, t;
  }(i8e);
  function l8e(e, t, r) {
    return t === void 0 && (t = {}), Za(this, void 0, void 0, function() {
      var n, a, o, s, i;
      return Ja(this, function(l) {
        switch (l.label) {
          case 0:
            return typeof e == "string" ? n = e : (n = e.url, a = u8e(e)), [4, (r || jl.util.fetch)(n, a)];
          case 1:
            return o = l.sent(), o.ok ? (i = Uint8Array.bind, [4, o.arrayBuffer()]) : [3, 3];
          case 2:
            return s = new (i.apply(Uint8Array, [void 0, l.sent()]))(), [2, new o$(s, t)];
          case 3:
            throw new Error(o.statusText);
        }
      });
    });
  }
  var u8e = function(e) {
    var t = { method: e.method, headers: e.headers, body: e.body, mode: e.mode, credentials: e.credentials, cache: e.cache, redirect: e.redirect, referrer: e.referrer, integrity: e.integrity };
    return t;
  };
  function s$(e) {
    return typeof e == "string" && e.substr(0, 7) === "file://";
  }
  var l$ = function(e) {
    ps(t, e);
    function t(r, n) {
      n === void 0 && (n = {});
      var a = e.call(this) || this;
      return a.input = r, a.options = n, a;
    }
    return t.prototype.iterator = function() {
      return Za(this, void 0, void 0, function() {
        var r;
        return Ja(this, function(n) {
          return s$(this.input) && jl.env().get("IS_NODE") && (r = WG(), this.input = r.readFileSync(this.input.substr(7))), [2, new o$(this.input, this.options)];
        });
      });
    }, t;
  }(a$), u$ = function(e) {
    ps(t, e);
    function t(r, n) {
      n === void 0 && (n = {});
      var a = e.call(this) || this;
      return a.url = r, a.fileOptions = n, a;
    }
    return t.prototype.iterator = function() {
      return Za(this, void 0, void 0, function() {
        return Ja(this, function(r) {
          return s$(this.url) ? [2, new l$(this.url, this.fileOptions).iterator()] : [2, l8e(this.url, this.fileOptions)];
        });
      });
    }, t;
  }(a$);
  function c8e(e, t) {
    return t === void 0 && (t = {}), new n$(new u$(e), t);
  }
  function f8e(e) {
    var t = this, r = ZM(e);
    return ch(function() {
      return Za(t, void 0, void 0, function() {
        return Ja(this, function(n) {
          return [2, r];
        });
      });
    });
  }
  function h8e(e) {
    var t = this;
    return ch(function() {
      return Za(t, void 0, void 0, function() {
        var r;
        return Ja(this, function(n) {
          switch (n.label) {
            case 0:
              return [4, e()];
            case 1:
              return r = n.sent(), [2, ZM(function() {
                return r.next();
              })];
          }
        });
      });
    });
  }
  function p8e(e, t) {
    return Za(this, void 0, void 0, function() {
      return Ja(this, function(r) {
        return [2, r8e.create(e, t)];
      });
    });
  }
  function d8e(e) {
    return Za(this, void 0, void 0, function() {
      return Ja(this, function(t) {
        return [2, t8e.create(e)];
      });
    });
  }
  var v8e = "3.13.0";
  zf.CSVDataset = n$;
  zf.Dataset = Ly;
  zf.FileDataSource = l$;
  zf.TextLineDataset = r$;
  zf.URLDataSource = u$;
  zf.array = ZFe;
  zf.csv = c8e;
  zf.func = f8e;
  zf.generator = h8e;
  zf.microphone = d8e;
  zf.version_data = v8e;
  zf.webcam = p8e;
  zf.zip = JFe;
});
var h$ = ri((f$, QM) => {
  (function(e, t, r) {
    function n(i) {
      var l = this, u2 = s();
      l.next = function() {
        var c = 2091639 * l.s0 + l.c * 23283064365386963e-26;
        return l.s0 = l.s1, l.s1 = l.s2, l.s2 = c - (l.c = c | 0);
      }, l.c = 1, l.s0 = u2(" "), l.s1 = u2(" "), l.s2 = u2(" "), l.s0 -= u2(i), l.s0 < 0 && (l.s0 += 1), l.s1 -= u2(i), l.s1 < 0 && (l.s1 += 1), l.s2 -= u2(i), l.s2 < 0 && (l.s2 += 1), u2 = null;
    }
    function a(i, l) {
      return l.c = i.c, l.s0 = i.s0, l.s1 = i.s1, l.s2 = i.s2, l;
    }
    function o(i, l) {
      var u2 = new n(i), c = l && l.state, f = u2.next;
      return f.int32 = function() {
        return u2.next() * 4294967296 | 0;
      }, f.double = function() {
        return f() + (f() * 2097152 | 0) * 11102230246251565e-32;
      }, f.quick = f, c && (typeof c == "object" && a(c, u2), f.state = function() {
        return a(u2, {});
      }), f;
    }
    function s() {
      var i = 4022871197, l = function(u2) {
        u2 = u2.toString();
        for (var c = 0; c < u2.length; c++) {
          i += u2.charCodeAt(c);
          var f = 0.02519603282416938 * i;
          i = f >>> 0, f -= i, f *= i, i = f >>> 0, f -= i, i += f * 4294967296;
        }
        return (i >>> 0) * 23283064365386963e-26;
      };
      return l;
    }
    t && t.exports ? t.exports = o : r && r.amd ? r(function() {
      return o;
    }) : this.alea = o;
  })(f$, typeof QM == "object" && QM, typeof define == "function" && define);
});
var d$ = ri((p$, e6) => {
  (function(e, t, r) {
    function n(s) {
      var i = this, l = "";
      i.x = 0, i.y = 0, i.z = 0, i.w = 0, i.next = function() {
        var c = i.x ^ i.x << 11;
        return i.x = i.y, i.y = i.z, i.z = i.w, i.w ^= i.w >>> 19 ^ c ^ c >>> 8;
      }, s === (s | 0) ? i.x = s : l += s;
      for (var u2 = 0; u2 < l.length + 64; u2++) i.x ^= l.charCodeAt(u2) | 0, i.next();
    }
    function a(s, i) {
      return i.x = s.x, i.y = s.y, i.z = s.z, i.w = s.w, i;
    }
    function o(s, i) {
      var l = new n(s), u2 = i && i.state, c = function() {
        return (l.next() >>> 0) / 4294967296;
      };
      return c.double = function() {
        do
          var f = l.next() >>> 11, h = (l.next() >>> 0) / 4294967296, p = (f + h) / (1 << 21);
        while (p === 0);
        return p;
      }, c.int32 = l.next, c.quick = c, u2 && (typeof u2 == "object" && a(u2, l), c.state = function() {
        return a(l, {});
      }), c;
    }
    t && t.exports ? t.exports = o : r && r.amd ? r(function() {
      return o;
    }) : this.xor128 = o;
  })(p$, typeof e6 == "object" && e6, typeof define == "function" && define);
});
var m$ = ri((v$, t6) => {
  (function(e, t, r) {
    function n(s) {
      var i = this, l = "";
      i.next = function() {
        var c = i.x ^ i.x >>> 2;
        return i.x = i.y, i.y = i.z, i.z = i.w, i.w = i.v, (i.d = i.d + 362437 | 0) + (i.v = i.v ^ i.v << 4 ^ (c ^ c << 1)) | 0;
      }, i.x = 0, i.y = 0, i.z = 0, i.w = 0, i.v = 0, s === (s | 0) ? i.x = s : l += s;
      for (var u2 = 0; u2 < l.length + 64; u2++) i.x ^= l.charCodeAt(u2) | 0, u2 == l.length && (i.d = i.x << 10 ^ i.x >>> 4), i.next();
    }
    function a(s, i) {
      return i.x = s.x, i.y = s.y, i.z = s.z, i.w = s.w, i.v = s.v, i.d = s.d, i;
    }
    function o(s, i) {
      var l = new n(s), u2 = i && i.state, c = function() {
        return (l.next() >>> 0) / 4294967296;
      };
      return c.double = function() {
        do
          var f = l.next() >>> 11, h = (l.next() >>> 0) / 4294967296, p = (f + h) / (1 << 21);
        while (p === 0);
        return p;
      }, c.int32 = l.next, c.quick = c, u2 && (typeof u2 == "object" && a(u2, l), c.state = function() {
        return a(l, {});
      }), c;
    }
    t && t.exports ? t.exports = o : r && r.amd ? r(function() {
      return o;
    }) : this.xorwow = o;
  })(v$, typeof t6 == "object" && t6, typeof define == "function" && define);
});
var y$ = ri((g$, r6) => {
  (function(e, t, r) {
    function n(s) {
      var i = this;
      i.next = function() {
        var u2 = i.x, c = i.i, f, h, p;
        return f = u2[c], f ^= f >>> 7, h = f ^ f << 24, f = u2[c + 1 & 7], h ^= f ^ f >>> 10, f = u2[c + 3 & 7], h ^= f ^ f >>> 3, f = u2[c + 4 & 7], h ^= f ^ f << 7, f = u2[c + 7 & 7], f = f ^ f << 13, h ^= f ^ f << 9, u2[c] = h, i.i = c + 1 & 7, h;
      };
      function l(u2, c) {
        var f, h, p = [];
        if (c === (c | 0)) h = p[0] = c;
        else for (c = "" + c, f = 0; f < c.length; ++f) p[f & 7] = p[f & 7] << 15 ^ c.charCodeAt(f) + p[f + 1 & 7] << 13;
        for (; p.length < 8; ) p.push(0);
        for (f = 0; f < 8 && p[f] === 0; ++f) ;
        for (f == 8 ? h = p[7] = -1 : h = p[f], u2.x = p, u2.i = 0, f = 256; f > 0; --f) u2.next();
      }
      l(i, s);
    }
    function a(s, i) {
      return i.x = s.x.slice(), i.i = s.i, i;
    }
    function o(s, i) {
      s == null && (s = +/* @__PURE__ */ new Date());
      var l = new n(s), u2 = i && i.state, c = function() {
        return (l.next() >>> 0) / 4294967296;
      };
      return c.double = function() {
        do
          var f = l.next() >>> 11, h = (l.next() >>> 0) / 4294967296, p = (f + h) / (1 << 21);
        while (p === 0);
        return p;
      }, c.int32 = l.next, c.quick = c, u2 && (u2.x && a(u2, l), c.state = function() {
        return a(l, {});
      }), c;
    }
    t && t.exports ? t.exports = o : r && r.amd ? r(function() {
      return o;
    }) : this.xorshift7 = o;
  })(g$, typeof r6 == "object" && r6, typeof define == "function" && define);
});
var b$ = ri((x$, n6) => {
  (function(e, t, r) {
    function n(s) {
      var i = this;
      i.next = function() {
        var u2 = i.w, c = i.X, f = i.i, h, p;
        return i.w = u2 = u2 + 1640531527 | 0, p = c[f + 34 & 127], h = c[f = f + 1 & 127], p ^= p << 13, h ^= h << 17, p ^= p >>> 15, h ^= h >>> 12, p = c[f] = p ^ h, i.i = f, p + (u2 ^ u2 >>> 16) | 0;
      };
      function l(u2, c) {
        var f, h, p, d, v, m = [], g = 128;
        for (c === (c | 0) ? (h = c, c = null) : (c = c + "\0", h = 0, g = Math.max(g, c.length)), p = 0, d = -32; d < g; ++d) c && (h ^= c.charCodeAt((d + 32) % c.length)), d === 0 && (v = h), h ^= h << 10, h ^= h >>> 15, h ^= h << 4, h ^= h >>> 13, d >= 0 && (v = v + 1640531527 | 0, f = m[d & 127] ^= h + v, p = f == 0 ? p + 1 : 0);
        for (p >= 128 && (m[(c && c.length || 0) & 127] = -1), p = 127, d = 4 * 128; d > 0; --d) h = m[p + 34 & 127], f = m[p = p + 1 & 127], h ^= h << 13, f ^= f << 17, h ^= h >>> 15, f ^= f >>> 12, m[p] = h ^ f;
        u2.w = v, u2.X = m, u2.i = p;
      }
      l(i, s);
    }
    function a(s, i) {
      return i.i = s.i, i.w = s.w, i.X = s.X.slice(), i;
    }
    function o(s, i) {
      s == null && (s = +/* @__PURE__ */ new Date());
      var l = new n(s), u2 = i && i.state, c = function() {
        return (l.next() >>> 0) / 4294967296;
      };
      return c.double = function() {
        do
          var f = l.next() >>> 11, h = (l.next() >>> 0) / 4294967296, p = (f + h) / (1 << 21);
        while (p === 0);
        return p;
      }, c.int32 = l.next, c.quick = c, u2 && (u2.X && a(u2, l), c.state = function() {
        return a(l, {});
      }), c;
    }
    t && t.exports ? t.exports = o : r && r.amd ? r(function() {
      return o;
    }) : this.xor4096 = o;
  })(x$, typeof n6 == "object" && n6, typeof define == "function" && define);
});
var w$ = ri((_$, a6) => {
  (function(e, t, r) {
    function n(s) {
      var i = this, l = "";
      i.next = function() {
        var c = i.b, f = i.c, h = i.d, p = i.a;
        return c = c << 25 ^ c >>> 7 ^ f, f = f - h | 0, h = h << 24 ^ h >>> 8 ^ p, p = p - c | 0, i.b = c = c << 20 ^ c >>> 12 ^ f, i.c = f = f - h | 0, i.d = h << 16 ^ f >>> 16 ^ p, i.a = p - c | 0;
      }, i.a = 0, i.b = 0, i.c = -1640531527, i.d = 1367130551, s === Math.floor(s) ? (i.a = s / 4294967296 | 0, i.b = s | 0) : l += s;
      for (var u2 = 0; u2 < l.length + 20; u2++) i.b ^= l.charCodeAt(u2) | 0, i.next();
    }
    function a(s, i) {
      return i.a = s.a, i.b = s.b, i.c = s.c, i.d = s.d, i;
    }
    function o(s, i) {
      var l = new n(s), u2 = i && i.state, c = function() {
        return (l.next() >>> 0) / 4294967296;
      };
      return c.double = function() {
        do
          var f = l.next() >>> 11, h = (l.next() >>> 0) / 4294967296, p = (f + h) / (1 << 21);
        while (p === 0);
        return p;
      }, c.int32 = l.next, c.quick = c, u2 && (typeof u2 == "object" && a(u2, l), c.state = function() {
        return a(l, {});
      }), c;
    }
    t && t.exports ? t.exports = o : r && r.amd ? r(function() {
      return o;
    }) : this.tychei = o;
  })(_$, typeof a6 == "object" && a6, typeof define == "function" && define);
});
var k$ = ri((twt, pT) => {
  (function(e, t) {
    var r = this, n = 256, a = 6, o = 52, s = "random", i = t.pow(n, a), l = t.pow(2, o), u2 = l * 2, c = n - 1, f;
    function h(b, y, w) {
      var _4 = [];
      y = y == true ? { entropy: true } : y || {};
      var k = m(v(y.entropy ? [b, x(e)] : b ?? g(), 3), _4), T2 = new p(_4), A2 = function() {
        for (var S2 = T2.g(a), C2 = i, E2 = 0; S2 < l; ) S2 = (S2 + E2) * n, C2 *= n, E2 = T2.g(1);
        for (; S2 >= u2; ) S2 /= 2, C2 /= 2, E2 >>>= 1;
        return (S2 + E2) / C2;
      };
      return A2.int32 = function() {
        return T2.g(4) | 0;
      }, A2.quick = function() {
        return T2.g(4) / 4294967296;
      }, A2.double = A2, m(x(T2.S), e), (y.pass || w || function(S2, C2, E2, F13) {
        return F13 && (F13.S && d(F13, T2), S2.state = function() {
          return d(T2, {});
        }), E2 ? (t[s] = S2, C2) : S2;
      })(A2, k, "global" in y ? y.global : this == t, y.state);
    }
    t["seed" + s] = h;
    function p(b) {
      var y, w = b.length, _4 = this, k = 0, T2 = _4.i = _4.j = 0, A2 = _4.S = [];
      for (w || (b = [w++]); k < n; ) A2[k] = k++;
      for (k = 0; k < n; k++) A2[k] = A2[T2 = c & T2 + b[k % w] + (y = A2[k])], A2[T2] = y;
      (_4.g = function(S2) {
        for (var C2, E2 = 0, F13 = _4.i, N2 = _4.j, D2 = _4.S; S2--; ) C2 = D2[F13 = c & F13 + 1], E2 = E2 * n + D2[c & (D2[F13] = D2[N2 = c & N2 + C2]) + (D2[N2] = C2)];
        return _4.i = F13, _4.j = N2, E2;
      })(n);
    }
    function d(b, y) {
      return y.i = b.i, y.j = b.j, y.S = b.S.slice(), y;
    }
    function v(b, y) {
      var w = [], _4 = typeof b, k;
      if (y && _4 == "object") for (k in b) try {
        w.push(v(b[k], y - 1));
      } catch {
      }
      return w.length ? w : _4 == "string" ? b : b + "\0";
    }
    function m(b, y) {
      for (var w = b + "", _4, k = 0; k < w.length; ) y[c & k] = c & (_4 ^= y[c & k] * 19) + w.charCodeAt(k++);
      return x(y);
    }
    function g() {
      try {
        var b;
        return f && (b = f.randomBytes) ? b = b(n) : (b = new Uint8Array(n), (r.crypto || r.msCrypto).getRandomValues(b)), x(b);
      } catch {
        var y = r.navigator, w = y && y.plugins;
        return [+/* @__PURE__ */ new Date(), r, w, r.screen, x(e)];
      }
    }
    function x(b) {
      return String.fromCharCode.apply(0, b);
    }
    if (m(t.random(), e), typeof pT == "object" && pT.exports) {
      pT.exports = h;
      try {
        f = r3();
      } catch {
      }
    } else typeof define == "function" && define.amd && define(function() {
      return h;
    });
  })([], Math);
});
var A$ = ri((rwt, T$) => {
  var m8e = h$(), g8e = d$(), y8e = m$(), x8e = y$(), b8e = b$(), _8e = w$(), _g = k$();
  _g.alea = m8e;
  _g.xor128 = g8e;
  _g.xorwow = y8e;
  _g.xorshift7 = x8e;
  _g.xor4096 = b8e;
  _g.tychei = _8e;
  T$.exports = _g;
});
var LH = ri((W2) => {
  "use strict";
  Object.defineProperty(W2, "__esModule", { value: true });
  var xt = Gm(), w8e = A$();
  function k8e(e) {
    if (e && e.__esModule) return e;
    var t = /* @__PURE__ */ Object.create(null);
    return e && Object.keys(e).forEach(function(r) {
      if (r !== "default") {
        var n = Object.getOwnPropertyDescriptor(e, r);
        Object.defineProperty(t, r, n.get ? n : { enumerable: true, get: function() {
          return e[r];
        } });
      }
    }), t.default = e, t;
  }
  var T8e = k8e(w8e);
  var o6 = function(e, t) {
    return o6 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, n) {
      r.__proto__ = n;
    } || function(r, n) {
      for (var a in n) n.hasOwnProperty(a) && (r[a] = n[a]);
    }, o6(e, t);
  };
  function A8e(e, t) {
    o6(e, t);
    function r() {
      this.constructor = e;
    }
    e.prototype = t === null ? Object.create(t) : (r.prototype = t.prototype, new r());
  }
  function S$(e, t, r, n) {
    function a(o) {
      return o instanceof r ? o : new r(function(s) {
        s(o);
      });
    }
    return new (r || (r = Promise))(function(o, s) {
      function i(c) {
        try {
          u2(n.next(c));
        } catch (f) {
          s(f);
        }
      }
      function l(c) {
        try {
          u2(n.throw(c));
        } catch (f) {
          s(f);
        }
      }
      function u2(c) {
        c.done ? o(c.value) : a(c.value).then(i, l);
      }
      u2((n = n.apply(e, t || [])).next());
    });
  }
  function E$(e, t) {
    var r = { label: 0, sent: function() {
      if (o[0] & 1) throw o[1];
      return o[1];
    }, trys: [], ops: [] }, n, a, o, s;
    return s = { next: i(0), throw: i(1), return: i(2) }, typeof Symbol == "function" && (s[Symbol.iterator] = function() {
      return this;
    }), s;
    function i(u2) {
      return function(c) {
        return l([u2, c]);
      };
    }
    function l(u2) {
      if (n) throw new TypeError("Generator is already executing.");
      for (; r; ) try {
        if (n = 1, a && (o = u2[0] & 2 ? a.return : u2[0] ? a.throw || ((o = a.return) && o.call(a), 0) : a.next) && !(o = o.call(a, u2[1])).done) return o;
        switch (a = 0, o && (u2 = [u2[0] & 2, o.value]), u2[0]) {
          case 0:
          case 1:
            o = u2;
            break;
          case 4:
            return r.label++, { value: u2[1], done: false };
          case 5:
            r.label++, a = u2[1], u2 = [0];
            continue;
          case 7:
            u2 = r.ops.pop(), r.trys.pop();
            continue;
          default:
            if (o = r.trys, !(o = o.length > 0 && o[o.length - 1]) && (u2[0] === 6 || u2[0] === 2)) {
              r = 0;
              continue;
            }
            if (u2[0] === 3 && (!o || u2[1] > o[0] && u2[1] < o[3])) {
              r.label = u2[1];
              break;
            }
            if (u2[0] === 6 && r.label < o[1]) {
              r.label = o[1], o = u2;
              break;
            }
            if (o && r.label < o[2]) {
              r.label = o[2], r.ops.push(u2);
              break;
            }
            o[2] && r.ops.pop(), r.trys.pop();
            continue;
        }
        u2 = t.call(e, r);
      } catch (c) {
        u2 = [6, c], a = 0;
      } finally {
        n = o = 0;
      }
      if (u2[0] & 5) throw u2[1];
      return { value: u2[0] ? u2[1] : void 0, done: true };
    }
  }
  function dT(e) {
    var t = typeof Symbol == "function" && Symbol.iterator, r = t && e[t], n = 0;
    if (r) return r.call(e);
    if (e && typeof e.length == "number") return { next: function() {
      return e && n >= e.length && (e = void 0), { value: e && e[n++], done: !e };
    } };
    throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
  }
  function zi(e, t) {
    var r = typeof Symbol == "function" && e[Symbol.iterator];
    if (!r) return e;
    var n = r.call(e), a, o = [], s;
    try {
      for (; (t === void 0 || t-- > 0) && !(a = n.next()).done; ) o.push(a.value);
    } catch (i) {
      s = { error: i };
    } finally {
      try {
        a && !a.done && (r = n.return) && r.call(n);
      } finally {
        if (s) throw s.error;
      }
    }
    return o;
  }
  function pd() {
    for (var e = [], t = 0; t < arguments.length; t++) e = e.concat(zi(arguments[t]));
    return e;
  }
  function pi(e, t) {
    Array.isArray(e) || (e = [e]), e.forEach(function(r) {
      r != null && xt.util.assert(r.dtype !== "complex64", function() {
        return t + " does not support complex64 tensors in the CPU backend.";
      });
    });
  }
  var S8e = xt.kernel_impls.whereImpl, u6 = function(e) {
    A8e(t, e);
    function t() {
      var r = e.call(this) || this;
      return r.blockSize = 48, r.firstUse = true, r.data = new xt.DataStorage(r, xt.engine()), r;
    }
    return t.prototype.nextDataId = function() {
      return t.nextDataId++;
    }, t.prototype.write = function(r, n, a) {
      this.firstUse && (this.firstUse = false, xt.env().get("IS_NODE") && xt.backend_util.warn(`
============================
Hi there \u{1F44B}. Looks like you are running TensorFlow.js in Node.js. To speed things up dramatically, install our node backend, which binds to TensorFlow C++, by running npm i @tensorflow/tfjs-node, or npm i @tensorflow/tfjs-node-gpu if you have CUDA. Then call require('@tensorflow/tfjs-node'); (-gpu suffix for CUDA) at the start of your program. Visit https://github.com/tensorflow/tfjs-node for more details.
============================`));
      var o = { id: this.nextDataId() };
      return this.data.set(o, { values: r, dtype: a, refCount: 1 }), o;
    }, t.prototype.makeTensorInfo = function(r, n, a) {
      var o;
      if (n === "string" && a != null && a.length > 0 && xt.util.isString(a[0])) {
        var s = a.map(function(i) {
          return xt.util.encodeString(i);
        });
        o = this.write(s, r, n);
      } else o = this.write(a, r, n);
      return { dataId: o, shape: r, dtype: n };
    }, t.prototype.refCount = function(r) {
      if (this.data.has(r)) {
        var n = this.data.get(r);
        return n.refCount;
      }
      return 0;
    }, t.prototype.incRef = function(r) {
      var n = this.data.get(r);
      n.refCount++;
    }, t.prototype.decRef = function(r) {
      if (this.data.has(r)) {
        var n = this.data.get(r);
        n.refCount--;
      }
    }, t.prototype.move = function(r, n, a, o, s) {
      this.data.set(r, { values: n, dtype: o, refCount: s });
    }, t.prototype.numDataIds = function() {
      return this.data.numDataIds();
    }, t.prototype.read = function(r) {
      return S$(this, void 0, void 0, function() {
        return E$(this, function(n) {
          return [2, this.readSync(r)];
        });
      });
    }, t.prototype.readSync = function(r) {
      var n = this.data.get(r), a = n.dtype, o = n.complexTensorInfos;
      if (a === "complex64") {
        var s = this.readSync(o.real.dataId), i = this.readSync(o.imag.dataId);
        return xt.backend_util.mergeRealAndImagArrays(s, i);
      }
      return this.data.get(r).values;
    }, t.prototype.bufferSync = function(r) {
      var n = this.readSync(r.dataId), a = n;
      if (r.dtype === "string") try {
        a = n.map(function(o) {
          return xt.util.decodeString(o);
        });
      } catch {
        throw new Error("Failed to decode encoded string bytes into utf-8");
      }
      return xt.buffer(r.shape, r.dtype, a);
    }, t.prototype.makeOutput = function(r, n, a) {
      var o = this.write(r, n, a);
      return xt.engine().makeTensorFromDataId(o, n, a, this);
    }, t.prototype.disposeData = function(r, n) {
      if (n === void 0 && (n = false), this.data.has(r)) {
        if (this.data.get(r).refCount--, !n && this.data.get(r).refCount > 0) return false;
        var a = this.data.get(r).complexTensorInfos;
        a != null && (this.disposeData(a.real.dataId, true), this.disposeData(a.imag.dataId, true)), this.data.delete(r);
      }
      return true;
    }, t.prototype.disposeIntermediateTensorInfo = function(r) {
      this.disposeData(r.dataId);
    }, t.prototype.time = function(r) {
      return S$(this, void 0, void 0, function() {
        var n, a;
        return E$(this, function(o) {
          return n = xt.util.now(), r(), a = xt.util.now() - n, [2, { kernelMs: a }];
        });
      });
    }, t.prototype.memory = function() {
      return { unreliable: true, reasons: ["The reported memory is an upper bound. Due to automatic garbage collection, the true allocated memory may be less."] };
    }, t.prototype.where = function(r) {
      pi([r], "where");
      var n = this.readSync(r.dataId);
      return S8e(r.shape, n);
    }, t.prototype.dispose = function() {
    }, t.prototype.floatPrecision = function() {
      return 32;
    }, t.prototype.epsilon = function() {
      return e.prototype.epsilon.call(this);
    }, t;
  }(xt.KernelBackend);
  u6.nextDataId = 0;
  function N$(e) {
    for (var t = new Float32Array(e.length), r = 0; r < e.length; ++r) t[r] = Math.abs(e[r]);
    return t;
  }
  var E8e = function(e) {
    var t = e.inputs.x, r = e.backend;
    pi(t, "abs");
    var n = new Float32Array(xt.util.sizeFromShape(t.shape)), a = r.data.get(t.dataId).values;
    return n = N$(a), r.makeOutput(n, t.shape, t.dtype);
  }, D8e = { kernelName: xt.Abs, backendName: "cpu", kernelFunc: E8e };
  function Iu(e) {
    return function(t, r, n, a, o) {
      var s = xt.backend_util.assertAndGetBroadcastShape(t, r), i = s.length, l = xt.util.computeStrides(s), u2 = xt.util.sizeFromShape(s), c = xt.util.getTypedArrayFromDType(o, u2), f = t.length, h = r.length, p = xt.util.computeStrides(t), d = xt.util.computeStrides(r), v = xt.backend_util.getBroadcastDims(t, s), m = xt.backend_util.getBroadcastDims(r, s);
      if (v.length + m.length === 0) for (var g = 0; g < c.length; ++g) c[g] = e(n[g % n.length], a[g % a.length]);
      else for (var x = function(b) {
        var y = xt.util.indexToLoc(b, i, l), w = y.slice(-f);
        v.forEach(function(A2) {
          return w[A2] = 0;
        });
        var _4 = xt.util.locToIndex(w, f, p), k = y.slice(-h);
        m.forEach(function(A2) {
          return k[A2] = 0;
        });
        var T2 = xt.util.locToIndex(k, h, d);
        c[b] = e(n[_4], a[T2]);
      }, g = 0; g < c.length; ++g) x(g);
      return [c, s];
    };
  }
  function fh(e) {
    var t = e.inputs, r = e.backend, n = t.real, a = t.imag, o = r.data.get(n.dataId).values, s = r.data.get(a.dataId).values, i = r.makeTensorInfo(n.shape, "complex64"), l = r.data.get(i.dataId);
    return l.complexTensorInfos = { real: r.makeTensorInfo(n.shape, "float32", o), imag: r.makeTensorInfo(a.shape, "float32", s) }, i;
  }
  var C8e = { kernelName: xt.Complex, backendName: "cpu", kernelFunc: fh };
  function vT(e, t, r) {
    if (r === void 0 && (r = "float32"), r === "complex64") {
      var n = vT(e, t, "float32"), a = vT(e, t, "float32");
      return fh({ inputs: { real: n, imag: a }, backend: e });
    }
    var o = xt.util.makeZerosTypedArray(xt.util.sizeFromShape(t), r);
    return e.makeTensorInfo(t, r, o);
  }
  function Xd(e) {
    var t = e.inputs, r = e.backend, n = t.x;
    return r.incRef(n.dataId), { dataId: n.dataId, shape: n.shape, dtype: n.dtype };
  }
  var M8e = { kernelName: xt.Identity, backendName: "cpu", kernelFunc: Xd };
  function wg(e) {
    var t = e.inputs, r = e.backend, n = t.input, a = r.data.get(n.dataId).complexTensorInfos.real, o = r.data.get(a.dataId).values;
    return r.makeTensorInfo(a.shape, a.dtype, o);
  }
  var I8e = { kernelName: xt.Real, backendName: "cpu", kernelFunc: wg };
  function Rv(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.dtype;
    if (o === "complex64") {
      if (a.dtype === "complex64") return Xd({ inputs: { x: a }, backend: r });
      var s = vT(r, a.shape, a.dtype), i = Rv({ inputs: { x: a }, backend: r, attrs: { dtype: "float32" } }), l = fh({ inputs: { real: i, imag: s }, backend: r });
      return r.disposeIntermediateTensorInfo(s), r.disposeIntermediateTensorInfo(i), l;
    }
    if (a.dtype === "complex64") {
      var u2 = wg({ inputs: { input: a }, backend: r }), l = Rv({ inputs: { x: u2 }, backend: r, attrs: { dtype: o } });
      return r.disposeIntermediateTensorInfo(u2), l;
    }
    if (!xt.util.hasEncodingLoss(a.dtype, o)) {
      var l = Xd({ inputs: { x: a }, backend: r });
      return { dataId: l.dataId, shape: l.shape, dtype: o };
    }
    if (o === "int32") {
      var c = r.data.get(a.dataId).values, f = Int32Array.from(c);
      return r.makeTensorInfo(a.shape, "int32", f);
    }
    if (o === "bool") {
      var h = r.data.get(a.dataId).values, p = xt.util.toTypedArray([0], a.dtype), d = zi(Iu(function(g, x) {
        return g !== x ? 1 : 0;
      })(a.shape, [], h, p, "bool"), 2), v = d[0], m = d[1];
      return r.makeTensorInfo(m, "bool", v);
    }
    throw new Error("Error in Cast: failed to cast " + a.dtype + " to " + o);
  }
  var N8e = { kernelName: xt.Cast, backendName: "cpu", kernelFunc: Rv };
  function hc(e, t, r, n) {
    return r == null ? function(a) {
      var o = a.inputs, s = a.backend, i = o.a, l = o.b, u2 = s;
      pi([i, l], e);
      var c = u2.data.get(i.dataId).values, f = u2.data.get(l.dataId).values, h = i.dtype === "string" ? xt.backend_util.fromUint8ToStringArray(c) : c, p = i.dtype === "string" ? xt.backend_util.fromUint8ToStringArray(f) : f, d = n || i.dtype, v = zi(t(i.shape, l.shape, h, p, d), 2), m = v[0], g = v[1];
      return u2.makeTensorInfo(g, d, m);
    } : function(a) {
      var o = a.inputs, s = a.backend, i = o.a, l = o.b, u2 = s;
      if (i.dtype === "complex64" || l.dtype === "complex64") {
        var c = Rv({ inputs: { x: i }, backend: u2, attrs: { dtype: "complex64" } }), f = u2.data.get(c.dataId), h = f.complexTensorInfos.real, p = f.complexTensorInfos.imag, d = u2.data.get(h.dataId).values, v = u2.data.get(p.dataId).values, m = Rv({ inputs: { x: l }, backend: u2, attrs: { dtype: "complex64" } }), g = u2.data.get(m.dataId), x = g.complexTensorInfos.real, b = g.complexTensorInfos.imag, y = u2.data.get(x.dataId).values, w = u2.data.get(b.dataId).values, _4 = zi(r(i.shape, l.shape, d, v, y, w), 3), k = _4[0], T2 = _4[1], A2 = _4[2], S2 = u2.makeTensorInfo(A2, "float32", k), C2 = u2.makeTensorInfo(A2, "float32", T2), E2 = fh({ inputs: { real: S2, imag: C2 }, backend: u2 });
        return u2.disposeIntermediateTensorInfo(c), u2.disposeIntermediateTensorInfo(m), u2.disposeIntermediateTensorInfo(S2), u2.disposeIntermediateTensorInfo(C2), E2;
      } else {
        var F13 = u2.data.get(i.dataId).values, N2 = u2.data.get(l.dataId).values, D2 = n || i.dtype, I2 = zi(t(i.shape, l.shape, F13, N2, D2), 2), O2 = I2[0], A2 = I2[1];
        return u2.makeTensorInfo(A2, D2, O2);
      }
    };
  }
  function c6(e) {
    return function(t, r, n, a, o, s) {
      var i = xt.backend_util.assertAndGetBroadcastShape(t, r), l = xt.util.sizeFromShape(i), u2 = i.length, c = xt.util.computeStrides(i), f = xt.util.getTypedArrayFromDType("float32", l), h = xt.util.getTypedArrayFromDType("float32", l), p = xt.backend_util.getBroadcastDims(t, i), d = xt.backend_util.getBroadcastDims(r, i), v = xt.backend_util.mergeRealAndImagArrays(n, a), m = xt.backend_util.mergeRealAndImagArrays(o, s), g = t.length, x = xt.util.computeStrides(t), b = r.length, y = xt.util.computeStrides(r);
      if (p.length + d.length === 0) for (var w = 0; w < f.length; w++) {
        var _4 = w % v.length, k = w % m.length, T2 = e(v[_4 * 2], v[_4 * 2 + 1], m[k * 2], m[k * 2 + 1]);
        f[w] = T2.real, h[w] = T2.imag;
      }
      else for (var A2 = function(S2) {
        var C2 = xt.util.indexToLoc(S2, u2, c), E2 = C2.slice(-g);
        p.forEach(function(O2) {
          return E2[O2] = 0;
        });
        var F13 = xt.util.locToIndex(E2, g, x), N2 = C2.slice(-b);
        d.forEach(function(O2) {
          return N2[O2] = 0;
        });
        var D2 = xt.util.locToIndex(N2, b, y), I2 = e(v[F13 * 2], v[F13 * 2 + 1], m[D2 * 2], m[D2 * 2 + 1]);
        f[S2] = I2.real, h[S2] = I2.imag;
      }, w = 0; w < f.length; w++) A2(w);
      return [f, h, i];
    };
  }
  var F$ = Iu(function(e, t) {
    return e + t;
  }), F8e = c6(function(e, t, r, n) {
    return { real: e + r, imag: t + n };
  }), V2 = hc(xt.Add, F$, F8e), O8e = { kernelName: xt.Add, backendName: "cpu", kernelFunc: V2 };
  function f6(e, t, r, n, a) {
    for (var o = xt.util.sizeFromShape(n), s = xt.util.makeZerosTypedArray(a, r), i = 0; i < e.length; i++) {
      var l = e[i];
      if (l < 0) throw new Error("Input x must be non-negative!");
      l >= a || (o > 0 ? s[l] += t[i] : s[l] += 1);
    }
    return s;
  }
  function O$(e, t, r, n) {
    n === void 0 && (n = false);
    for (var a = e.shape[0], o = e.shape[1], s = xt.buffer([a, r], t.dtype), i = 0; i < a; i++) for (var l = 0; l < o; l++) {
      var u2 = e.get(i, l);
      if (u2 < 0) throw new Error("Input x must be non-negative!");
      u2 >= r || (n ? s.set(1, i, u2) : t.size > 0 ? s.set(s.get(i, u2) + t.get(i, l), i, u2) : s.set(s.get(i, u2) + 1, i, u2));
    }
    return s;
  }
  function zv(e) {
    return function(t, r, n) {
      for (var a = xt.util.getTypedArrayFromDType(r, t.length), o = 0; o < t.length; ++o) a[o] = e(t[o], n);
      return a;
    };
  }
  function ks(e, t, r) {
    return function(n) {
      var a = n.inputs, o = n.attrs, s = n.backend, i = a.x;
      if (pi(i, e), i.dtype === "string" || r === "string") throw new Error("unaryKernelFunc does not support string input/output");
      for (var l = s, u2 = l.data.get(i.dataId).values, c = xt.util.sizeFromShape(i.shape), f = r || i.dtype, h = xt.util.getArrayFromDType(f, c), p = 0; p < c; ++p) h[p] = t(u2[p], o);
      return l.makeTensorInfo(i.shape, f, h);
    };
  }
  function Uy(e, t, r) {
    return function(n) {
      var a = n.inputs, o = n.attrs, s = n.backend, i = a.x;
      if (pi(i, e), i.dtype === "string" || r === "string") throw new Error("unaryKernelFunc does not support string input/output");
      var l = s, u2 = l.data.get(i.dataId).values, c = r || i.dtype, f = t(u2, c, o);
      return l.makeTensorInfo(i.shape, c, f);
    };
  }
  var P$ = zv(function(e) {
    return Math.ceil(e);
  }), P8e = Uy(xt.Ceil, P$), L8e = { kernelName: xt.Ceil, backendName: "cpu", kernelFunc: P8e };
  function L$(e, t, r, n) {
    var a = xt.util.getArrayFromDType(r, xt.util.sizeFromShape(t));
    if (n && r !== "string") {
      var o = 0;
      e.forEach(function(i) {
        var l = xt.util.sizeFromShape(i.shape);
        a.set(i.vals, o), o += l;
      });
    } else {
      var s = 0;
      e.forEach(function(i) {
        for (var l = r === "string" ? xt.backend_util.fromUint8ToStringArray(i.vals) : i.vals, u2 = 0, c = 0; c < i.shape[0]; ++c) for (var f = c * t[1] + s, h = 0; h < i.shape[1]; ++h) a[f + h] = l[u2++];
        s += i.shape[1];
      });
    }
    return a;
  }
  var R$ = Iu(function(e, t) {
    return e === t ? 1 : 0;
  }), z$ = hc(xt.Equal, R$, null, "bool"), R8e = { kernelName: xt.Equal, backendName: "cpu", kernelFunc: z$ };
  var B$ = zv(function(e) {
    return Math.exp(e);
  }), U$ = Uy(xt.Exp, B$, "float32"), z8e = { kernelName: xt.Exp, backendName: "cpu", kernelFunc: U$ };
  var V$ = zv(function(e) {
    return Math.expm1(e);
  }), B8e = Uy(xt.Expm1, V$), U8e = { kernelName: xt.Expm1, backendName: "cpu", kernelFunc: B8e };
  var j$ = zv(function(e) {
    return Math.floor(e);
  }), V8e = Uy(xt.Floor, j$), j8e = { kernelName: xt.Floor, backendName: "cpu", kernelFunc: V8e };
  function W$(e, t, r, n, a, o, s, i, l) {
    for (var u2 = xt.buffer([n, o], r), c = 0; c < n; c++) {
      for (var f = [], h = 0, p = 0; p < a; p++) {
        var d = e[c * a + p];
        h += d * s[p], f.push(d);
      }
      if (h < 0 || h >= l / o) throw new Error("Invalid indices: " + f + " does not index into " + i);
      for (var v = 0; v < o; v++) u2.values[c * o + v] = t.get.apply(t, pd(t.indexToLoc(h * o + v)));
    }
    return u2;
  }
  function G$(e, t, r) {
    for (var n = xt.buffer(r, e.dtype), a = 0; a < n.size; ++a) {
      var o = n.indexToLoc(a), s = o.slice(), i = s[0], l = s[2], u2 = t.locToIndex([i, l]);
      s[2] = t.values[u2];
      var c = e.locToIndex(s);
      0 <= c && c < e.values.length && (n.values[a] = e.values[c]);
    }
    return n;
  }
  var $$ = Iu(function(e, t) {
    return e > t ? 1 : 0;
  }), W8e = hc(xt.Greater, $$, null, "bool"), G8e = { kernelName: xt.Greater, backendName: "cpu", kernelFunc: W8e };
  var H$ = Iu(function(e, t) {
    return e >= t ? 1 : 0;
  }), $8e = hc(xt.GreaterEqual, H$, null, "bool"), H8e = { kernelName: xt.GreaterEqual, backendName: "cpu", kernelFunc: $8e };
  var q$ = Iu(function(e, t) {
    return e < t ? 1 : 0;
  }), q8e = hc(xt.Less, q$, null, "bool"), X8e = { kernelName: xt.Less, backendName: "cpu", kernelFunc: q8e };
  var X$ = Iu(function(e, t) {
    return e <= t ? 1 : 0;
  }), K8e = hc(xt.LessEqual, X$, null, "bool"), Y8e = { kernelName: xt.LessEqual, backendName: "cpu", kernelFunc: K8e };
  function K$(e, t, r) {
    var n = (t - e) / (r - 1), a = xt.util.makeZerosTypedArray(r, "float32");
    a[0] = e;
    for (var o = 1; o < a.length; o++) a[o] = a[o - 1] + n;
    return a;
  }
  var Y$ = zv(function(e) {
    return Math.log(e);
  }), Z8e = Uy(xt.Log, Y$), J8e = { kernelName: xt.Log, backendName: "cpu", kernelFunc: Z8e };
  function Z$(e, t, r, n) {
    for (var a = xt.util.getTypedArrayFromDType(n, xt.util.sizeFromShape(r)), o = 0; o < a.length; ++o) {
      for (var s = o * t, i = e[s], l = 0; l < t; ++l) {
        var u2 = e[s + l];
        (Number.isNaN(u2) || u2 > i) && (i = u2);
      }
      a[o] = i;
    }
    return a;
  }
  var J$ = Iu(function(e, t) {
    return Math.max(e, t);
  }), Q8e = hc(xt.Maximum, J$), eOe = { kernelName: xt.Maximum, backendName: "cpu", kernelFunc: Q8e };
  var Q$ = Iu(function(e, t) {
    return Math.min(e, t);
  }), tOe = hc(xt.Minimum, Q$), rOe = { kernelName: xt.Minimum, backendName: "cpu", kernelFunc: tOe };
  var h6 = Iu(function(e, t) {
    return e * t;
  }), nOe = c6(function(e, t, r, n) {
    return { real: e * r - t * n, imag: e * n + t * r };
  }), yT = hc(xt.Multiply, h6, nOe), aOe = { kernelName: xt.Multiply, backendName: "cpu", kernelFunc: yT };
  function eH(e, t, r) {
    var n = xt.util.createScalarValue(-1, r);
    return h6([], t, n, e, r);
  }
  function iOe(e) {
    var t = e.inputs, r = e.backend, n = t.x;
    pi(n, "neg");
    var a = r.data.get(n.dataId).values, o = zi(eH(a, n.shape, n.dtype), 2), s = o[0], i = o[1];
    return r.makeTensorInfo(i, n.dtype, s);
  }
  var oOe = { kernelName: xt.Neg, backendName: "cpu", kernelFunc: iOe };
  var tH = Iu(function(e, t) {
    return e !== t ? 1 : 0;
  }), sOe = hc(xt.NotEqual, tH, null, "bool"), lOe = { kernelName: xt.NotEqual, backendName: "cpu", kernelFunc: sOe };
  function p6(e, t, r, n, a) {
    for (var o = t.length, s = xt.util.sizeFromShape(t), i = xt.util.computeStrides(t), l = xt.util.computeStrides(a), u2 = xt.util.getTypedArrayFromDType(r, xt.util.sizeFromShape(a)), c = 0; c < s; ++c) {
      for (var f = xt.util.indexToLoc(c, o, i), h = new Array(f.length), p = 0; p < h.length; p++) h[p] = f[n[p]];
      var d = xt.util.locToIndex(h, o, l);
      u2[d] = e[c];
    }
    return u2;
  }
  function Lh(e) {
    var t = e.inputs, r = e.attrs, n = e.backend, a = t.x, o = r.perm;
    pi(a, "transpose");
    for (var s = a.shape.length, i = new Array(s), l = 0; l < i.length; l++) i[l] = a.shape[o[l]];
    var u2 = n.data.get(a.dataId).values, c = p6(u2, a.shape, a.dtype, o, i), f = n.write(c, i, a.dtype);
    return { dataId: f, shape: i, dtype: a.dtype };
  }
  var uOe = { kernelName: xt.Transpose, backendName: "cpu", kernelFunc: Lh };
  function rH(e, t, r, n) {
    for (var a = zi(xt.backend_util.computeOutAndReduceShapes(e, n), 2), o = a[0], s = a[1], i = xt.upcastType(t, "int32"), l = xt.util.makeZerosTypedArray(xt.util.sizeFromShape(o), i), u2 = xt.util.sizeFromShape(s), c = 0; c < l.length; ++c) {
      for (var f = c * u2, h = 1, p = 0; p < u2; ++p) h *= r[f + p];
      l[c] = h;
    }
    return { outVals: l, outShape: o, outDtype: i };
  }
  function cOe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.axis, s = n.keepDims;
    pi(a, "prod");
    var i = a.shape.length, l = xt.util.parseAxisParam(o, a.shape), u2 = xt.backend_util.getAxesPermutation(l, i), c = l, f = a, h = [];
    u2 != null && (f = Lh({ inputs: { x: a }, backend: r, attrs: { perm: u2 } }), h.push(f), c = xt.backend_util.getInnerMostAxes(c.length, i));
    var p = r.data.get(f.dataId).values, d = rH(f.shape, f.dtype, p, c), v = d.outVals, m = d.outShape, g = d.outDtype, x = m;
    return s && (x = xt.backend_util.expandShapeToKeepDim(m, l)), h.forEach(function(b) {
      return r.disposeIntermediateTensorInfo(b);
    }), r.makeTensorInfo(x, g, v);
  }
  var fOe = { kernelName: xt.Prod, backendName: "cpu", kernelFunc: cOe };
  function nH(e, t, r, n) {
    var a = e === t, o = e < t && r < 0, s = t < e && r > 1;
    if (a || o || s) return xt.util.makeZerosTypedArray(0, n);
    var i = Math.abs(Math.ceil((t - e) / r)), l = xt.util.makeZerosTypedArray(i, n);
    t < e && r === 1 && (r = -1), l[0] = e;
    for (var u2 = 1; u2 < l.length; u2++) l[u2] = l[u2 - 1] + r;
    return l;
  }
  var aH = zv(function(e) {
    return 1 / Math.sqrt(e);
  }), hOe = Uy(xt.Rsqrt, aH), pOe = { kernelName: xt.Rsqrt, backendName: "cpu", kernelFunc: hOe };
  var dOe = zv(function(e) {
    return 1 / (1 + Math.exp(-e));
  }), iH = ks(xt.Sigmoid, function(e) {
    return 1 / (1 + Math.exp(-e));
  }), vOe = { kernelName: xt.Sigmoid, backendName: "cpu", kernelFunc: iH };
  function oH(e, t, r, n, a) {
    var o = xt.slice_util.isSliceContinous(n, t, r), s = xt.util.sizeFromShape(r), i = xt.util.computeStrides(n);
    if (o) {
      var l = xt.slice_util.computeFlatOffset(t, i);
      return a === "string" ? e.slice(l, l + s) : e.subarray(l, l + s);
    }
    for (var u2 = a === "string" ? xt.backend_util.fromUint8ToStringArray(e) : e, c = xt.buffer(n, a, u2), f = xt.buffer(r, a), h = 0; h < f.size; ++h) {
      var p = f.indexToLoc(h), d = p.map(function(v, m) {
        return v + t[m];
      });
      f.set.apply(f, pd([c.get.apply(c, pd(d))], p));
    }
    return a === "string" ? xt.backend_util.fromStringArrayToUint8(f.values) : f.values;
  }
  function kg(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.begin, s = n.size;
    pi(a, "slice");
    var i = zi(xt.slice_util.parseSliceParams(a, o, s), 2), l = i[0], u2 = i[1];
    xt.slice_util.assertParamsValid(a, l, u2);
    var c = r.data.get(a.dataId).values, f = oH(c, l, u2, a.shape, a.dtype);
    return r.makeTensorInfo(u2, a.dtype, f);
  }
  var mOe = { kernelName: xt.Slice, backendName: "cpu", kernelFunc: kg };
  function sH(e, t, r, n, a, o, s) {
    var i = t[0], l = o[0], u2 = new Array(l), c = new Array(i), f = t[1];
    if (l === 0) {
      if (i !== 0) throw new Error(xt.backend_util.getSparseFillEmptyRowsIndicesDenseShapeMismatch(i));
      var h = xt.util.getArrayFromDType(r, 0), p = xt.util.getArrayFromDType(a, 0);
      return [h, [0, f], p, u2, c];
    }
    for (var d = true, v = 0, m = new Array(l).fill(0), g = 0; g < i; ++g) {
      var x = e[g * f];
      if (x < 0) throw new Error(xt.backend_util.getSparseFillEmptyRowsNegativeIndexErrorMessage(g, x));
      if (x >= l) throw new Error(xt.backend_util.getSparseFillEmptyRowsOutOfRangeIndexErrorMessage(g, x, l));
      ++m[x], d = d && x >= v, v = x;
    }
    for (var b = true, x = 0; x < l; ++x) {
      var y = m[x] === 0;
      u2[x] = y, b = b && !y, m[x] = Math.max(m[x], 1), x > 0 && (m[x] += m[x - 1]);
    }
    if (b && d) {
      for (var h = e, p = n, g = 0; g < i; ++g) c[g] = g;
      return [h, [i, f], p, u2, c];
    } else {
      for (var w = m[l - 1], h = xt.util.getArrayFromDType(r, w * f), p = xt.util.getArrayFromDType(a, w), _4 = new Array(l).fill(0), g = 0; g < i; ++g) {
        var x = e[g * f], k = _4[x], T2 = (x === 0 ? 0 : m[x - 1]) + k;
        _4[x]++;
        for (var A2 = 0; A2 < f; ++A2) h[T2 * f + A2] = e[g * f + A2];
        p[T2] = n[g], c[g] = T2;
      }
      for (var x = 0; x < l; ++x) {
        var S2 = _4[x];
        if (S2 === 0) {
          var C2 = x === 0 ? 0 : m[x - 1];
          h[C2 * f + 0] = x;
          for (var E2 = 1; E2 < f; ++E2) h[C2 * f + E2] = 0;
          p[C2] = s;
        }
      }
      return [h, [w, f], p, u2, c];
    }
  }
  function lH(e, t, r, n, a) {
    for (var o = xt.util.sizeFromShape(n), s = t[0], i = a.length, l = [], u2 = 1, c = -1, f = 0; f < i; ++f) {
      var h = a[f];
      if (h === -1) {
        if (c !== -1) throw new Error(xt.backend_util.getSparseReshapeMultipleNegativeOneOutputDimErrorMessage(c, f));
        c = f, l.push(1);
      } else {
        if (h < 0) throw new Error(xt.backend_util.getSparseReshapeNegativeOutputDimErrorMessage(f, h));
        u2 *= h, l.push(h);
      }
    }
    if (c !== -1) {
      if (u2 <= 0) throw new Error(xt.backend_util.getSparseReshapeEmptyTensorZeroOutputDimErrorMessage());
      var p = Math.trunc(o / u2);
      if (u2 * p !== o) throw new Error(xt.backend_util.getSparseReshapeInputOutputMultipleErrorMessage(n, l));
      l[c] = p;
    }
    var d = xt.util.sizeFromShape(l);
    if (d !== o) throw new Error(xt.backend_util.getSparseReshapeInputOutputMismatchErrorMessage(n, l));
    var v = n.length, m = [];
    if (v > 0) {
      m[v - 1] = 1;
      for (var f = v - 2; f >= 0; --f) m[f] = m[f + 1] * n[f + 1];
    }
    var g = [];
    if (i > 0) {
      g[i - 1] = 1;
      for (var f = i - 2; f >= 0; --f) g[f] = g[f + 1] * l[f + 1];
    }
    for (var x = xt.util.getArrayFromDType(r, s * i), b = 0; b < s; ++b) {
      for (var y = 0, w = 0; w < v; ++w) y += e[b * v + w] * m[w];
      for (var w = 0; w < i; ++w) x[b * i + w] = Math.trunc(y / g[w]), y %= g[w];
    }
    return [x, [s, i], l];
  }
  function d6(e, t, r, n, a, o, s) {
    o === void 0 && (o = false), s === void 0 && (s = 0);
    var i = n.length, l = [t[0], e.length / t[0]], u2 = l[1], c = i > 0 ? a[i - 1] + 1 : 0, f = c;
    if (f < 0) throw new Error(xt.backend_util.getSparseSegmentReductionNegativeSegmentIdsErrorMessage());
    var h = t.slice();
    h[0] = f;
    var p = h.reduce(function(k, T2) {
      return k * T2;
    }, 1), d = xt.util.getArrayFromDType(r, p);
    if (i === 0) return f > 0 && d.fill(s), [d, h];
    if (f <= 0) throw new Error(xt.backend_util.getSparseSegmentReductionNegativeSegmentIdsErrorMessage());
    for (var v = 0, m = 1, g = 0, x = a[v]; ; ) {
      var b = 0;
      if (m < i) {
        if (b = a[m], x === b) {
          ++m;
          continue;
        }
        if (x >= b) throw new Error(xt.backend_util.getSparseSegmentReductionNonIncreasingSegmentIdsErrorMessage());
      }
      if (x < 0 || x >= f) throw new Error(xt.backend_util.getSparseSegmentReductionSegmentIdOutOfRangeErrorMessage(x, f));
      x > g && d.fill(s, g * u2, x * u2);
      for (var y = v; y < m; ++y) {
        var w = n[y];
        if (w < 0 || w >= l[0]) throw new Error(xt.backend_util.getSparseSegmentReductionIndicesOutOfRangeErrorMessage(y, n[y], l[0]));
        for (var _4 = 0; _4 < u2; _4++) d[x * u2 + _4] += e[w * u2 + _4];
      }
      if (o) for (var _4 = 0; _4 < u2; _4++) d[x * u2 + _4] /= m - v;
      if (v = m, ++m, g = x + 1, x = b, m > i) break;
    }
    return g < f && d.fill(s, g * u2, f * u2), [d, h];
  }
  var gOe = zv(function(e) {
    return Math.sqrt(e);
  }), yOe = ks(xt.Sqrt, function(e) {
    return Math.sqrt(e);
  }), xOe = { kernelName: xt.Sqrt, backendName: "cpu", kernelFunc: yOe };
  var uH = Iu(function(e, t) {
    var r = e - t;
    return r * r;
  }), bOe = hc(xt.SquaredDifference, uH), _Oe = { kernelName: xt.SquaredDifference, backendName: "cpu", kernelFunc: bOe };
  function cH(e, t, r, n) {
    for (var a = xt.buffer(e, t.dtype), o = 0; o < a.size; o++) {
      for (var s = a.indexToLoc(o), i = new Array(s.length), l = 0; l < i.length; l++) i[l] = s[l] * r[l] + n[l];
      a.set.apply(a, pd([t.get.apply(t, pd(i))], s));
    }
    return a;
  }
  var wOe = function() {
    function e(t, r, n, a, o, s) {
      this.separator = xt.util.encodeString(t), this.nGramWidths = r, this.leftPad = xt.util.encodeString(n), this.rightPad = xt.util.encodeString(a), this.padWidth = o, this.preserveShort = s;
    }
    return e.prototype.getPadWidth = function(t) {
      return Math.min(this.padWidth < 0 ? t - 1 : this.padWidth, t - 1);
    }, e.prototype.getNumNGrams = function(t, r) {
      var n = this.getPadWidth(r);
      return Math.max(0, t + 2 * n - r + 1);
    }, e.prototype.createNGrams = function(t, r, n, a, o, s) {
      for (var i = function(c) {
        var f = l.getPadWidth(s), h = Math.max(0, f - c), p = Math.max(0, f - (o - (c + 1))), d = s - (h + p), v = r + (h > 0 ? 0 : c - f), m = 0;
        m += h * l.leftPad.length;
        for (var g = 0; g < d; ++g) m += t[v + g].length;
        m += p * l.rightPad.length;
        var x = h + p + d - 1;
        m += x * l.separator.length, n[a + c] = new Uint8Array(m);
        for (var b = n[a + c], y = 0, w = function(_4) {
          return _4.forEach(function(k) {
            return b[y++] = k;
          });
        }, g = 0; g < h; ++g) w(l.leftPad), w(l.separator);
        for (var g = 0; g < d - 1; ++g) w(t[v + g]), w(l.separator);
        if (d > 0) {
          w(t[v + d - 1]);
          for (var g = 0; g < p; ++g) w(l.separator), w(l.rightPad);
        } else {
          for (var g = 0; g < p - 1; ++g) w(l.rightPad), w(l.separator);
          w(l.rightPad);
        }
      }, l = this, u2 = 0; u2 < o; ++u2) i(u2);
    }, e.prototype.compute = function(t, r) {
      var n = this, a = t.length, o = r.length;
      if (o > 0) {
        var s = r[0];
        if (s !== 0) throw new Error("First split value must be 0, got " + s);
        for (var i = 1; i < o; ++i) {
          var l = r[i] >= s;
          if (l = l && r[i] <= a, !l) throw new Error("Invalid split value " + r[i] + ", must be in [" + s + ", " + a + "]");
          s = r[i];
        }
        if (s !== a) throw new Error("Last split value must be data size. Expected " + a + ", got " + s);
      }
      var u2 = o - 1, c = xt.util.getArrayFromDType("int32", o);
      if (a === 0 || o === 0) {
        for (var f = new Array(a), i = 0; i <= u2; ++i) c[i] = 0;
        return [f, c];
      }
      c[0] = 0;
      for (var h = function(g) {
        var x = r[g] - r[g - 1], b = 0;
        p.nGramWidths.forEach(function(y) {
          b += n.getNumNGrams(x, y);
        }), p.preserveShort && x > 0 && b === 0 && (b = 1), c[g] = c[g - 1] + b;
      }, p = this, i = 1; i <= u2; ++i) h(i);
      for (var d = new Array(c[u2]), v = function(g) {
        var x = r[g], b = c[g];
        if (m.nGramWidths.forEach(function(k) {
          var T2 = r[g + 1] - r[g], A2 = n.getNumNGrams(T2, k);
          n.createNGrams(t, x, d, b, A2, k), b += A2;
        }), m.preserveShort && b === c[g]) {
          var y = r[g + 1] - r[g];
          if (y === 0) return "continue";
          var w = y + 2 * m.padWidth, _4 = 1;
          m.createNGrams(t, x, d, b, _4, w);
        }
      }, m = this, i = 0; i < u2; ++i) v(i);
      return [d, c];
    }, e;
  }();
  function fH(e, t, r, n, a, o, s, i) {
    return new wOe(r, n, a, o, s, i).compute(e, t);
  }
  function kOe(e, t, r, n) {
    if (!!e.length) {
      if (t.length === 0) {
        for (var a = 0; a < e.length; ++a) n.push(e.subarray(a, a + 1));
        return;
      }
      if (t.length === 1) {
        for (var o = t[0], s = e.indexOf(o); s !== -1; ) {
          var i = e.subarray(0, s);
          (!r || i.length !== 0) && n.push(i), e = e.subarray(s + 1), s = e.indexOf(o);
        }
        (!r || e.length !== 0) && n.push(e);
        return;
      }
      for (var l = 0, a = 0; a < e.length + 1; a++) if (a === e.length || t.indexOf(e[a]) !== -1) {
        var i = e.subarray(l, a);
        (!r || i.length !== 0) && n.push(i), l = a + 1;
      }
    }
  }
  function hH(e, t, r) {
    for (var n = e.length, a = [], o = 0, s = 0, i = new Array(n), l = 0; l < n; ++l) {
      var u2 = a.length;
      kOe(e[l], t, r, a);
      var c = a.length - u2;
      i[l] = c, o += c, s = Math.max(s, c);
    }
    for (var f = xt.util.getArrayFromDType("int32", o * 2), h = new Array(o), p = [n, s], d = 0, l = 0; l < n; ++l) for (var v = 0; v < i[l]; ++v) f[d * 2] = l, f[d * 2 + 1] = v, h[d] = a[d], ++d;
    return [f, h, p];
  }
  function pH(e, t) {
    for (var r = xt.util.getArrayFromDType("int32", e.length), n = 0; n < e.length; ++n) r[n] = xt.util.fingerPrint64(e[n]).modulo(t).getLowBitsUnsigned();
    return r;
  }
  var dH = Iu(function(e, t) {
    return e - t;
  }), TOe = c6(function(e, t, r, n) {
    return { real: e - r, imag: t - n };
  }), v6 = hc(xt.Sub, dH, TOe), AOe = { kernelName: xt.Sub, backendName: "cpu", kernelFunc: v6 };
  function vH(e, t) {
    for (var r = new Array(e.rank), n = 0; n < r.length; n++) r[n] = e.shape[n] * t[n];
    for (var a = xt.buffer(r, e.dtype), n = 0; n < a.values.length; ++n) {
      for (var o = a.indexToLoc(n), s = new Array(e.rank), i = 0; i < s.length; i++) s[i] = o[i] % e.shape[i];
      var l = e.locToIndex(s);
      a.values[n] = e.values[l];
    }
    return a;
  }
  var B2 = function(e, t) {
    var r = t.value - e.value;
    return r === 0 ? e.index - t.index : r;
  };
  function mH(e, t, r, n) {
    for (r === void 0 && (r = 0), n === void 0 && (n = e.length - 1); n > r; ) {
      if (n - r > 600) {
        var a = n - r + 1, o = t - r + 1, s = Math.log(a), i = 0.5 * Math.exp(2 * s / 3), l = 0.5 * Math.sqrt(s * i * (a - i) / a) * Math.sign(o - a / 2), u2 = Math.max(r, Math.floor(t - o * i / a + l)), c = Math.min(n, Math.floor(t + (a - o) * i / a + l));
        mH(e, t, u2, c);
      }
      var f = e[t], h = r, p = n;
      for (xt.util.swap(e, r, t), B2(e[n], f) > 0 && xt.util.swap(e, r, n); h < p; ) {
        for (xt.util.swap(e, h, p), h++, p--; B2(e[h], f) < 0; ) h = h + 1;
        for (; B2(e[p], f) > 0; ) p = p - 1;
      }
      B2(e[r], f) === 0 ? xt.util.swap(e, r, p) : (p = p + 1, xt.util.swap(e, p, n)), p <= t && (r = p + 1), t <= p && (n = p - 1);
    }
  }
  function gH(e, t, r, n, a) {
    for (var o = t[t.length - 1], s = zi([e.length / o, o], 2), i = s[0], l = s[1], u2 = xt.util.getTypedArrayFromDType(r, i * n), c = xt.util.getTypedArrayFromDType("int32", i * n), f = function(d) {
      var v = d * l, m = e.subarray(v, v + l), g = new Array(m.length);
      m.forEach(function(_4, k) {
        return g[k] = { value: _4, index: k };
      }), n < g.length && (mH(g, n), g = g.slice(0, n)), a && g.sort(B2);
      for (var x = d * n, b = u2.subarray(x, x + n), y = c.subarray(x, x + n), w = 0; w < n; w++) b[w] = g[w].value, y[w] = g[w].index;
    }, h = 0; h < i; h++) f(h);
    var p = t.slice();
    return p[p.length - 1] = n, [xt.buffer(p, r, u2), xt.buffer(p, "int32", c)];
  }
  function yH(e, t, r, n) {
    for (var a = xt.util.parseAxisParam(t, r)[0], o = [1, r[0], 1], s = 0; s < a; s++) o[0] *= r[s];
    o[1] = r[a];
    for (var s = a + 1; s < r.length; s++) o[2] *= r[s];
    for (var i = {}, l = new Int32Array(r[a]), u2 = new xt.TensorBuffer(o, n, e), c = [], f = o[0] === 1 && o[2] === 1, s = 0; s < r[a]; s++) {
      var h = void 0;
      if (f) h = e[s].toString();
      else {
        for (var p = [], d = 0; d < o[0]; d++) for (var v = 0; v < o[2]; v++) p.push(u2.get(d, s, v));
        h = p.join(",");
      }
      if (i[h] !== void 0) l[s] = i[h];
      else {
        var m = Object.keys(i).length;
        i[h] = m, l[s] = m, c.push(s);
      }
    }
    var g = o.slice();
    g[1] = Object.keys(i).length;
    var x = new xt.TensorBuffer(g, n);
    c.forEach(function(y, w) {
      for (var _4 = 0; _4 < o[0]; _4++) for (var k = 0; k < o[2]; k++) x.set(u2.get(_4, y, k), _4, w, k);
    });
    var b = r.slice();
    return b[a] = g[1], { outputValues: x.values, outputShape: b, indices: l };
  }
  var SOe = { __proto__: null, simpleAbsImpl: N$, addImpl: F$, bincountImpl: f6, bincountReduceImpl: O$, ceilImpl: P$, concatImpl: L$, equalImpl: R$, expImpl: B$, expm1Impl: V$, floorImpl: j$, gatherNdImpl: W$, gatherV2Impl: G$, greaterImpl: $$, greaterEqualImpl: H$, lessImpl: q$, lessEqualImpl: X$, linSpaceImpl: K$, logImpl: Y$, maxImpl: Z$, maximumImpl: J$, minimumImpl: Q$, multiplyImpl: h6, negImpl: eH, notEqualImpl: tH, prodImpl: rH, rangeImpl: nH, rsqrtImpl: aH, sigmoidImpl: dOe, sliceImpl: oH, sparseFillEmptyRowsImpl: sH, sparseReshapeImpl: lH, sparseSegmentReductionImpl: d6, sqrtImpl: gOe, squaredDifferenceImpl: uH, stridedSliceImpl: cH, stringNGramsImpl: fH, stringSplitImpl: hH, stringToHashBucketFastImpl: pH, subImpl: dH, tileImpl: vH, topKImpl: gH, transposeImpl: p6, uniqueImpl: yH };
  var EOe = "3.13.0";
  xt.registerBackend("cpu", function() {
    return new u6();
  }, 1);
  var xH = ks(xt.Elu, function(e) {
    return e >= 0 ? e : Math.exp(e) - 1;
  }), DOe = { kernelName: xt.Elu, backendName: "cpu", kernelFunc: xH };
  function bH(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.alpha;
    pi([a], "leakyRelu");
    for (var s = xt.util.sizeFromShape(a.shape), i = r.data.get(a.dataId).values, l = xt.util.getTypedArrayFromDType("float32", s), u2 = 0; u2 < i.length; u2++) l[u2] = i[u2] < 0 ? o * i[u2] : i[u2];
    return r.makeTensorInfo(a.shape, "float32", l);
  }
  var COe = { kernelName: xt.LeakyRelu, backendName: "cpu", kernelFunc: bH }, MOe = Iu(function(e, t) {
    return e < 0 ? t * e : e;
  });
  function _H(e) {
    var t = e.inputs, r = e.backend, n = t.x, a = t.alpha;
    pi([n, a], "prelu");
    var o = r.data.get(n.dataId).values, s = r.data.get(a.dataId).values, i = zi(MOe(n.shape, a.shape, o, s, "float32"), 2), l = i[0], u2 = i[1];
    return r.makeTensorInfo(u2, "float32", l);
  }
  var IOe = { kernelName: xt.Prelu, backendName: "cpu", kernelFunc: _H };
  var wH = ks(xt.Relu, function(e) {
    return Math.max(0, e);
  }), NOe = { kernelName: xt.Relu, backendName: "cpu", kernelFunc: wH };
  var kH = ks(xt.Relu6, function(e) {
    return Math.min(Math.max(0, e), 6);
  }), FOe = { kernelName: xt.Relu6, backendName: "cpu", kernelFunc: kH };
  function m6(e, t, r, n, a) {
    if (r === "linear") return Xd({ inputs: { x: t }, backend: e });
    if (r === "relu") return wH({ inputs: { x: t }, backend: e });
    if (r === "elu") return xH({ inputs: { x: t }, backend: e });
    if (r === "relu6") return kH({ inputs: { x: t }, backend: e });
    if (r === "prelu") return _H({ inputs: { x: t, alpha: n }, backend: e });
    if (r === "leakyrelu") return bH({ inputs: { x: t }, backend: e, attrs: { alpha: a } });
    if (r === "sigmoid") return iH({ inputs: { x: t }, backend: e });
    throw new Error("Activation " + r + " has not been implemented for the CPU backend.");
  }
  function Ol(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.shape, s = xt.util.sizeFromShape(a.shape), i = xt.util.inferFromImplicitShape(o, s), l = xt.util.sizeFromShape(i);
    xt.util.assert(s === l, function() {
      return "The new shape (" + i + ") has " + l + " elements and the old " + ("shape (" + a.shape + ") has " + s + " elements. The new shape and old ") + "shape must have the same number of elements.";
    }), r.incRef(a.dataId);
    var u2 = r.data.get(a.dataId);
    if (u2.complexTensorInfos != null) {
      var c = u2.complexTensorInfos.real, f = u2.complexTensorInfos.imag;
      c.shape = i, f.shape = i;
    }
    return { dataId: a.dataId, shape: i, dtype: a.dtype };
  }
  var OOe = { kernelName: xt.Reshape, backendName: "cpu", kernelFunc: Ol };
  function TH(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.a, o = t.b, s = n.transposeA, i = n.transposeB;
    pi([a, o], "matMul");
    var l = a.shape.length, u2 = o.shape.length, c = s ? a.shape[l - 2] : a.shape[l - 1], f = i ? o.shape[u2 - 1] : o.shape[u2 - 2], h = s ? a.shape[l - 1] : a.shape[l - 2], p = i ? o.shape[u2 - 2] : o.shape[u2 - 1], d = a.shape.slice(0, -2), v = o.shape.slice(0, -2), m = xt.util.sizeFromShape(d), g = xt.util.sizeFromShape(v), x = xt.broadcast_util.assertAndGetBroadcastShape(a.shape.slice(0, -2), o.shape.slice(0, -2)), b = x.concat([h, p]);
    xt.util.assert(c === f, function() {
      return "Error in matMul: inner shapes (" + c + ") and (" + (f + ") of Tensors with shapes " + a.shape + " and ") + (o.shape + " and transposeA=" + s) + (" and transposeB=" + i + " must match.");
    });
    for (var y = s ? [m, c, h] : [m, h, c], w = i ? [g, p, f] : [g, f, p], _4 = Ol({ inputs: { x: a }, backend: r, attrs: { shape: y } }), k = Ol({ inputs: { x: o }, backend: r, attrs: { shape: w } }), T2 = s ? _4.shape[1] : _4.shape[2], A2 = s ? _4.shape[2] : _4.shape[1], S2 = i ? k.shape[1] : k.shape[2], C2 = Math.max(m, g), E2 = r.data.get(_4.dataId).values, F13 = r.data.get(k.dataId).values, N2 = xt.util.computeStrides(_4.shape), D2 = xt.util.computeStrides(k.shape), I2 = zi(s ? [N2[0], 1, N2[1]] : [N2[0], N2[1], 1], 3), O2 = I2[0], L2 = I2[1], V3 = I2[2], W3 = zi(i ? [1, D2[1], D2[0]] : [D2[1], 1, D2[0]], 3), X2 = W3[0], Y2 = W3[1], K2 = W3[2], q = A2 * S2, re = xt.buffer([C2, A2, S2], _4.dtype), R2 = re.values, z = r.blockSize, H2 = 0; H2 < C2; H2++) for (var te = 0; te < A2; te += z) for (var j = 0; j < S2; j += z) for (var Q2 = 0; Q2 < T2; Q2 += z) for (var Z2 = Math.min(te + z, A2), ne = Math.min(j + z, S2), ae = Math.min(Q2 + z, T2), ue = te; ue < Z2; ue++) for (var le = j; le < ne; le++) {
      for (var ce = 0, se = Q2; se < ae; se++) {
        var he = Math.min(H2, m - 1) * O2, me = Math.min(H2, g - 1) * K2, we = E2[he + ue * L2 + se * V3], be = F13[se * X2 + le * Y2 + me];
        ce += we * be;
      }
      R2[H2 * q + (ue * S2 + le)] += ce;
    }
    return r.disposeIntermediateTensorInfo(_4), r.disposeIntermediateTensorInfo(k), r.makeTensorInfo(b, re.dtype, re.values);
  }
  var POe = { kernelName: xt.BatchMatMul, backendName: "cpu", kernelFunc: TH };
  function LOe(e) {
    var t, r, n = e.inputs, a = e.backend, o = e.attrs, s = n.a, i = n.b, l = n.bias, u2 = n.preluActivationWeights, c = o.transposeA, f = o.transposeB, h = o.activation, p = o.leakyreluAlpha, d, v, m, g = [], x = TH({ inputs: { a: s, b: i }, attrs: { transposeA: c, transposeB: f }, backend: a });
    d = x, l && (v = V2({ inputs: { a: d, b: l }, backend: a }), g.push(d), d = v), h && (m = m6(a, d, h, u2, p), g.push(d), d = m);
    try {
      for (var b = dT(g), y = b.next(); !y.done; y = b.next()) {
        var w = y.value;
        a.disposeIntermediateTensorInfo(w);
      }
    } catch (_4) {
      t = { error: _4 };
    } finally {
      try {
        y && !y.done && (r = b.return) && r.call(b);
      } finally {
        if (t) throw t.error;
      }
    }
    return d;
  }
  var ROe = { kernelName: xt._FusedMatMul, backendName: "cpu", kernelFunc: LOe };
  var zOe = ks(xt.Acos, function(e) {
    return Math.acos(e);
  }), BOe = { kernelName: xt.Acos, backendName: "cpu", kernelFunc: zOe };
  var UOe = ks(xt.Acosh, function(e) {
    return Math.acosh(e);
  }), VOe = { kernelName: xt.Acosh, backendName: "cpu", kernelFunc: UOe };
  function jOe(e) {
    var t = e.inputs, r = e.backend, n = t;
    pi(t, "addN");
    for (var a = n.map(function(c) {
      return r.data.get(c.dataId).values;
    }), o = xt.buffer(n[0].shape, n[0].dtype), s = o.values, i = 0; i < n.length; i++) for (var l = a[i], u2 = 0; u2 < s.length; u2++) s[u2] += l[u2];
    return r.makeTensorInfo(o.shape, o.dtype, o.values);
  }
  var WOe = { kernelName: xt.AddN, backendName: "cpu", kernelFunc: jOe };
  function GOe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.axis, s = n.keepDims;
    pi(a, "all");
    var i = xt.util.parseAxisParam(o, a.shape), l = i, u2 = xt.backend_util.getAxesPermutation(l, a.shape.length), c = a;
    u2 != null && (c = Lh({ inputs: { x: a }, backend: r, attrs: { perm: u2 } }), l = xt.backend_util.getInnerMostAxes(l.length, a.shape.length)), xt.backend_util.assertAxesAreInnerMostDims("all", l, c.shape.length);
    for (var f = zi(xt.backend_util.computeOutAndReduceShapes(c.shape, l), 2), h = f[0], p = f[1], d = xt.util.sizeFromShape(p), v = xt.util.makeZerosTypedArray(xt.util.sizeFromShape(h), c.dtype), m = r.data.get(c.dataId).values, g = 0; g < v.length; ++g) {
      for (var x = g * d, b = m[x], y = 0; y < d; ++y) {
        var w = m[x + y];
        b = b && w;
      }
      v[g] = b;
    }
    u2 != null && r.disposeIntermediateTensorInfo(c);
    var _4 = r.makeTensorInfo(h, c.dtype, v);
    if (s) {
      var k = xt.backend_util.expandShapeToKeepDim(h, i), T2 = Ol({ inputs: { x: _4 }, backend: r, attrs: { shape: k } });
      return r.disposeIntermediateTensorInfo(_4), T2;
    }
    return _4;
  }
  var $Oe = { kernelName: xt.All, backendName: "cpu", kernelFunc: GOe };
  function HOe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.axis, s = n.keepDims;
    pi(a, "any");
    var i = xt.util.parseAxisParam(o, a.shape), l = i, u2 = xt.backend_util.getAxesPermutation(l, a.shape.length), c = a;
    u2 != null && (c = Lh({ inputs: { x: a }, backend: r, attrs: { perm: u2 } }), l = xt.backend_util.getInnerMostAxes(l.length, a.shape.length)), xt.backend_util.assertAxesAreInnerMostDims("any", l, c.shape.length);
    for (var f = zi(xt.backend_util.computeOutAndReduceShapes(c.shape, l), 2), h = f[0], p = f[1], d = xt.util.sizeFromShape(p), v = xt.util.makeZerosTypedArray(xt.util.sizeFromShape(h), c.dtype), m = r.data.get(c.dataId).values, g = 0; g < v.length; ++g) {
      for (var x = g * d, b = m[x], y = 0; y < d; ++y) {
        var w = m[x + y];
        b = b || w;
      }
      v[g] = b;
    }
    u2 != null && r.disposeIntermediateTensorInfo(c);
    var _4 = r.makeTensorInfo(h, c.dtype, v);
    if (s) {
      var k = xt.backend_util.expandShapeToKeepDim(h, i), T2 = Ol({ inputs: { x: _4 }, backend: r, attrs: { shape: k } });
      return r.disposeIntermediateTensorInfo(_4), T2;
    }
    return _4;
  }
  var qOe = { kernelName: xt.Any, backendName: "cpu", kernelFunc: HOe };
  function XOe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.axis;
    pi(a, "argMax");
    var s = xt.util.parseAxisParam(o, a.shape), i = xt.backend_util.getAxesPermutation(s, a.shape.length), l = a, u2 = [];
    i != null && (l = Lh({ inputs: { x: a }, backend: r, attrs: { perm: i } }), u2.push(l), s = xt.backend_util.getInnerMostAxes(s.length, l.shape.length)), s = [s[0]], xt.backend_util.assertAxesAreInnerMostDims("argMax", s, l.shape.length);
    for (var c = zi(xt.backend_util.computeOutAndReduceShapes(l.shape, s), 2), f = c[0], h = c[1], p = xt.util.sizeFromShape(f), d = xt.util.makeZerosTypedArray(p, "int32"), v = xt.util.sizeFromShape(h), m = r.data.get(l.dataId).values, g = 0; g < d.length; ++g) {
      for (var x = g * v, b = m[x], y = 0, w = 0; w < v; ++w) {
        var _4 = m[x + w];
        _4 > b && (b = _4, y = w);
      }
      d[g] = y;
    }
    return u2.forEach(function(k) {
      return r.disposeIntermediateTensorInfo(k);
    }), r.makeTensorInfo(f, "int32", d);
  }
  var KOe = { kernelName: xt.ArgMax, backendName: "cpu", kernelFunc: XOe };
  function YOe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.axis;
    pi(a, "argMin");
    var s = xt.util.parseAxisParam(o, a.shape), i = xt.backend_util.getAxesPermutation(s, a.shape.length), l = a, u2 = [];
    i != null && (l = Lh({ inputs: { x: a }, backend: r, attrs: { perm: i } }), u2.push(l), s = xt.backend_util.getInnerMostAxes(s.length, l.shape.length)), s = [s[0]], xt.backend_util.assertAxesAreInnerMostDims("argMin", s, l.shape.length);
    for (var c = zi(xt.backend_util.computeOutAndReduceShapes(l.shape, s), 2), f = c[0], h = c[1], p = xt.util.sizeFromShape(f), d = xt.util.makeZerosTypedArray(p, "int32"), v = xt.util.sizeFromShape(h), m = r.data.get(l.dataId).values, g = 0; g < d.length; ++g) {
      for (var x = g * v, b = m[x], y = 0, w = 0; w < v; ++w) {
        var _4 = m[x + w];
        _4 < b && (b = _4, y = w);
      }
      d[g] = y;
    }
    return u2.forEach(function(k) {
      return r.disposeIntermediateTensorInfo(k);
    }), r.makeTensorInfo(f, "int32", d);
  }
  var ZOe = { kernelName: xt.ArgMin, backendName: "cpu", kernelFunc: YOe };
  var JOe = ks(xt.Asin, function(e) {
    return Math.asin(e);
  }), QOe = { kernelName: xt.Asin, backendName: "cpu", kernelFunc: JOe };
  var ePe = ks(xt.Asinh, function(e) {
    return Math.asinh(e);
  }), tPe = { kernelName: xt.Asinh, backendName: "cpu", kernelFunc: ePe };
  var rPe = ks(xt.Atan, function(e) {
    return Math.atan(e);
  }), nPe = { kernelName: xt.Atan, backendName: "cpu", kernelFunc: rPe };
  var aPe = Iu(function(e, t) {
    return Math.atan2(e, t);
  }), iPe = hc(xt.Atan2, aPe), oPe = { kernelName: xt.Atan2, backendName: "cpu", kernelFunc: iPe };
  var sPe = ks(xt.Atanh, function(e) {
    return Math.atanh(e);
  }), lPe = { kernelName: xt.Atanh, backendName: "cpu", kernelFunc: sPe };
  function g6(e, t, r, n, a, o) {
    for (var s = a.strideHeight, i = a.strideWidth, l = a.dilationHeight, u2 = a.dilationWidth, c = a.effectiveFilterHeight, f = a.effectiveFilterWidth, h = a.padInfo.top, p = a.padInfo.left, d = o === "max" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY, v = xt.buffer(a.outShape, r), m = v.values, g = a.outShape[1] * a.outShape[2] * a.outShape[3], x = a.outShape[2] * a.outShape[3], b = a.outShape[3], y = 0; y < a.batchSize; ++y) for (var w = y * g, _4 = y * n[0], k = 0; k < a.inChannels; ++k) for (var T2 = 0; T2 < a.outHeight; ++T2) for (var A2 = T2 * s - h, S2 = Math.max(0, A2), C2 = Math.min(a.inHeight, c + A2), E2 = w + T2 * x, F13 = 0; F13 < a.outWidth; ++F13) {
      for (var N2 = F13 * i - p, D2 = Math.max(0, N2), I2 = Math.min(a.inWidth, f + N2), O2 = d, L2 = 0, V3 = 0, W3 = S2; W3 < C2; W3 += l) {
        for (var X2 = _4 + W3 * n[1], Y2 = D2; Y2 < I2; Y2 += u2) {
          var K2 = X2 + Y2 * n[2], q = e[K2 + k];
          o === "max" && q > O2 ? O2 = q : o === "avg" && (L2 += q, V3++);
        }
        if (isNaN(O2)) break;
      }
      var re = E2 + F13 * b + k;
      m[re] = o === "avg" ? L2 / V3 : O2;
    }
    return v;
  }
  function AH(e, t, r, n, a, o) {
    a === void 0 && (a = false), o === void 0 && (o = false);
    for (var s = xt.buffer(n.outShape, "int32"), i = n.strideHeight, l = n.strideWidth, u2 = n.dilationHeight, c = n.dilationWidth, f = n.effectiveFilterHeight, h = n.effectiveFilterWidth, p = n.padInfo.top, d = n.padInfo.left, v = xt.buffer(t, r, e), m = 0; m < n.batchSize; ++m) for (var g = 0; g < n.inChannels; ++g) for (var x = 0; x < n.outHeight; ++x) {
      for (var b = x * i - p, y = b; y < 0; ) y += u2;
      for (var w = Math.min(n.inHeight, f + b), _4 = 0; _4 < n.outWidth; ++_4) {
        for (var k = _4 * l - d, T2 = k; T2 < 0; ) T2 += c;
        for (var A2 = Math.min(n.inWidth, h + k), S2 = Number.NEGATIVE_INFINITY, C2 = -1, E2 = y; E2 < w; E2 += u2) for (var F13 = E2 - b, N2 = T2; N2 < A2; N2 += c) {
          var D2 = N2 - k, I2 = v.get(m, E2, N2, g);
          I2 > S2 && (S2 = I2, a ? C2 = o ? ((m * n.inHeight + E2) * n.inWidth + N2) * n.inChannels + g : (E2 * n.inWidth + N2) * n.inChannels + g : C2 = F13 * h + D2);
        }
        s.set(C2, m, x, _4, g);
      }
    }
    return s;
  }
  function SH(e, t, r, n, a, o) {
    for (var s = a.strideDepth, i = a.strideHeight, l = a.strideWidth, u2 = a.dilationDepth, c = a.dilationHeight, f = a.dilationWidth, h = a.effectiveFilterDepth, p = a.effectiveFilterHeight, d = a.effectiveFilterWidth, v = a.padInfo.front, m = a.padInfo.top, g = a.padInfo.left, x = o === "max" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY, b = xt.buffer(a.outShape, r), y = b.values, w = a.outShape[1] * a.outShape[2] * a.outShape[3] * a.outShape[4], _4 = a.outShape[2] * a.outShape[3] * a.outShape[4], k = a.outShape[3] * a.outShape[4], T2 = a.outShape[4], A2 = 0; A2 < a.batchSize; ++A2) for (var S2 = A2 * w, C2 = A2 * n[0], E2 = 0; E2 < a.inChannels; ++E2) for (var F13 = 0; F13 < a.outDepth; ++F13) {
      for (var N2 = F13 * s - v, D2 = N2; D2 < 0; ) D2 += u2;
      for (var I2 = Math.min(a.inDepth, h + N2), O2 = S2 + F13 * _4, L2 = 0; L2 < a.outHeight; ++L2) {
        for (var V3 = L2 * i - m, W3 = V3; W3 < 0; ) W3 += c;
        for (var X2 = Math.min(a.inHeight, p + V3), Y2 = O2 + L2 * k, K2 = 0; K2 < a.outWidth; ++K2) {
          for (var q = K2 * l - g, re = q; re < 0; ) re += f;
          for (var R2 = Math.min(a.inWidth, d + q), z = Y2 + K2 * T2, H2 = x, te = 0, j = 0, Q2 = D2; Q2 < I2; Q2 += u2) {
            for (var Z2 = C2 + Q2 * n[1], ne = W3; ne < X2; ne += c) {
              for (var ae = Z2 + ne * n[2], ue = re; ue < R2; ue += f) {
                var le = ae + ue * n[3], ce = e[le + E2];
                if (o === "max" && ce > H2 ? H2 = ce : o === "avg" && (te += ce, j++), isNaN(H2)) break;
              }
              if (isNaN(H2)) break;
            }
            if (isNaN(H2)) break;
          }
          var se = z + E2;
          y[se] = o === "avg" ? te / j : H2;
        }
      }
    }
    return b;
  }
  function uPe(e, t) {
    for (var r = xt.buffer(t.outShape, "int32"), n = t.strideDepth, a = t.strideHeight, o = t.strideWidth, s = t.dilationDepth, i = t.dilationHeight, l = t.dilationWidth, u2 = t.effectiveFilterDepth, c = t.effectiveFilterHeight, f = t.effectiveFilterWidth, h = t.padInfo.front, p = t.padInfo.top, d = t.padInfo.left, v = 0; v < t.batchSize; ++v) for (var m = 0; m < t.inChannels; ++m) for (var g = 0; g < t.outDepth; ++g) {
      for (var x = g * n - h, b = x; b < 0; ) b += s;
      for (var y = Math.min(t.inDepth, u2 + x), w = 0; w < t.outHeight; ++w) {
        for (var _4 = w * a - p, k = _4; k < 0; ) k += i;
        for (var T2 = Math.min(t.inHeight, c + _4), A2 = 0; A2 < t.outWidth; ++A2) {
          for (var S2 = A2 * o - d, C2 = S2; C2 < 0; ) C2 += l;
          for (var E2 = Math.min(t.inWidth, f + S2), F13 = Number.NEGATIVE_INFINITY, N2 = -1, D2 = b; D2 < y; D2 += s) for (var I2 = D2 - x, O2 = k; O2 < T2; O2 += i) for (var L2 = O2 - _4, V3 = C2; V3 < E2; V3 += l) {
            var W3 = V3 - S2, X2 = e.get(v, D2, O2, V3, m);
            X2 >= F13 && (F13 = X2, N2 = I2 * c * f + L2 * c + W3);
          }
          r.set(N2, v, g, w, A2, m);
        }
      }
    }
    return r;
  }
  function cPe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x;
    pi(a, "avgPool");
    var o = n.filterSize, s = n.strides, i = n.pad, l = n.dimRoundingMode, u2 = 1;
    xt.util.assert(xt.backend_util.eitherStridesOrDilationsAreOne(s, u2), function() {
      return "Error in avgPool: Either strides or dilations must be 1. " + ("Got strides " + s + " and dilations '" + u2 + "'");
    });
    var c = xt.backend_util.computePool2DInfo(a.shape, o, s, u2, i, l), f;
    if (c.filterWidth === 1 && c.filterHeight === 1 && xt.util.arraysEqual(c.inShape, c.outShape)) f = Xd({ inputs: { x: a }, backend: r });
    else {
      var h = r.data.get(a.dataId).values, p = xt.util.computeStrides(a.shape), d = g6(h, a.shape, a.dtype, p, c, "avg");
      f = r.makeTensorInfo(c.outShape, a.dtype, d.values);
    }
    return f;
  }
  var fPe = { kernelName: xt.AvgPool, backendName: "cpu", kernelFunc: cPe };
  function hPe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.filterSize, s = n.strides, i = n.pad, l = n.dimRoundingMode, u2 = n.dataFormat;
    pi(a, "avgPool3d");
    var c = xt.backend_util.computePool3DInfo(a.shape, o, s, 1, i, l, u2), f = r.data.get(a.dataId).values, h = SH(f, a.shape, a.dtype, xt.util.computeStrides(a.shape), c, "avg");
    return r.makeTensorInfo(h.shape, "float32", h.values);
  }
  var pPe = { kernelName: xt.AvgPool3D, backendName: "cpu", kernelFunc: hPe };
  function dPe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.dy, o = t.input, s = n.filterSize, i = n.strides, l = n.pad, u2 = n.dimRoundingMode;
    pi([a, o], "avgPool3DGrad");
    for (var c = xt.backend_util.computePool3DInfo(o.shape, s, i, 1, l, u2), f = c.strideDepth, h = c.strideHeight, p = c.strideWidth, d = c.filterDepth, v = c.filterHeight, m = c.filterWidth, g = c.dilationDepth, x = c.dilationHeight, b = c.dilationWidth, y = c.effectiveFilterDepth, w = c.effectiveFilterHeight, _4 = c.effectiveFilterWidth, k = y - 1 - c.padInfo.front, T2 = _4 - 1 - c.padInfo.left, A2 = w - 1 - c.padInfo.top, S2 = xt.buffer(o.shape, "float32"), C2 = 1 / (d * v * m), E2 = r.bufferSync(a), F13 = 0; F13 < c.batchSize; ++F13) for (var N2 = 0; N2 < c.inChannels; ++N2) for (var D2 = 0; D2 < c.inDepth; ++D2) for (var I2 = 0; I2 < c.inHeight; ++I2) for (var O2 = 0; O2 < c.inWidth; ++O2) {
      for (var L2 = D2 - k, V3 = I2 - A2, W3 = O2 - T2, X2 = 0, Y2 = 0; Y2 < y; Y2 += g) {
        var K2 = (L2 + Y2) / f;
        if (!(K2 < 0 || K2 >= c.outDepth || Math.floor(K2) !== K2)) for (var q = 0; q < w; q += x) {
          var re = (V3 + q) / h;
          if (!(re < 0 || re >= c.outHeight || Math.floor(re) !== re)) for (var R2 = 0; R2 < _4; R2 += b) {
            var z = (W3 + R2) / p;
            if (!(z < 0 || z >= c.outWidth || Math.floor(z) !== z)) {
              var H2 = E2.get(F13, K2, re, z, N2);
              X2 += H2;
            }
          }
        }
      }
      S2.set(X2 * C2, F13, D2, I2, O2, N2);
    }
    return r.makeTensorInfo(S2.shape, S2.dtype, S2.values);
  }
  var vPe = { kernelName: xt.AvgPool3DGrad, backendName: "cpu", kernelFunc: dPe };
  function mPe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.dy, o = t.input, s = o;
    pi([a, o], "avgPoolGrad");
    for (var i = n.filterSize, l = n.strides, u2 = n.pad, c = xt.backend_util.computePool2DInfo(s.shape, i, l, 1, u2), f = c.strideHeight, h = c.strideWidth, p = c.filterHeight, d = c.filterWidth, v = c.dilationHeight, m = c.dilationWidth, g = c.effectiveFilterHeight, x = c.effectiveFilterWidth, b = x - 1 - c.padInfo.left, y = g - 1 - c.padInfo.top, w = xt.buffer(s.shape, "float32"), _4 = 1 / (p * d), k = r.data.get(a.dataId).values, T2 = xt.buffer(a.shape, "float32", k), A2 = 0; A2 < c.batchSize; ++A2) for (var S2 = 0; S2 < c.inChannels; ++S2) for (var C2 = 0; C2 < c.inHeight; ++C2) for (var E2 = 0; E2 < c.inWidth; ++E2) {
      for (var F13 = C2 - y, N2 = E2 - b, D2 = 0, I2 = 0; I2 < g; I2 += v) {
        var O2 = (F13 + I2) / f;
        if (!(O2 < 0 || O2 >= c.outHeight || Math.floor(O2) !== O2)) for (var L2 = 0; L2 < x; L2 += m) {
          var V3 = (N2 + L2) / h;
          if (!(V3 < 0 || V3 >= c.outWidth || Math.floor(V3) !== V3)) {
            var W3 = T2.get(A2, O2, V3, S2);
            D2 += W3;
          }
        }
      }
      w.set(D2 * _4, A2, C2, E2, S2);
    }
    return r.makeTensorInfo(w.shape, w.dtype, w.values);
  }
  var gPe = { kernelName: xt.AvgPoolGrad, backendName: "cpu", kernelFunc: mPe };
  function yPe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = t.scale, s = t.offset, i = t.mean, l = t.variance;
    xt.util.assert(i.shape.length === l.shape.length, function() {
      return "Batch normalization gradient requires mean and variance to have equal ranks.";
    }), xt.util.assert(s == null || i.shape.length === s.shape.length, function() {
      return "Batch normalization gradient requires mean and offset to have equal ranks.";
    }), xt.util.assert(o == null || i.shape.length === o.shape.length, function() {
      return "Batch normalization gradient requires mean and scale to have equal ranks.";
    }), pi([a, i, l, o, s], "batchNorm");
    var u2 = n.varianceEpsilon;
    u2 == null && (u2 = 1e-3);
    for (var c = r.data.get(a.dataId).values, f = r.data.get(i.dataId).values, h = r.data.get(l.dataId).values, p = o ? r.data.get(o.dataId).values : new Float32Array([1]), d = s ? r.data.get(s.dataId).values : new Float32Array([0]), v = new Float32Array(c.length), m = d.length, g = p.length, x = h.length, b = f.length, y = 0, w = 0, _4 = 0, k = 0, T2 = 0; T2 < c.length; ++T2) v[T2] = d[y++] + (c[T2] - f[w++]) * p[_4++] / Math.sqrt(h[k++] + u2), y >= m && (y = 0), w >= b && (w = 0), _4 >= g && (_4 = 0), k >= x && (k = 0);
    return r.makeTensorInfo(a.shape, a.dtype, v);
  }
  var xPe = { kernelName: xt.FusedBatchNorm, backendName: "cpu", kernelFunc: yPe };
  function bPe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.blockShape, s = n.crops;
    pi([a], "batchToSpaceND");
    var i = o.reduce(function(g, x) {
      return g * x;
    }), l = xt.backend_util.getReshaped(a.shape, o, i), u2 = xt.backend_util.getPermuted(l.length, o.length), c = xt.backend_util.getReshapedPermuted(a.shape, o, i), f = xt.backend_util.getSliceBeginCoords(s, o.length), h = xt.backend_util.getSliceSize(c, s, o.length), p = Ol({ inputs: { x: a }, backend: r, attrs: { shape: l } }), d = Lh({ inputs: { x: p }, backend: r, attrs: { perm: u2 } }), v = Ol({ inputs: { x: d }, backend: r, attrs: { shape: c } }), m = kg({ inputs: { x: v }, backend: r, attrs: { begin: f, size: h } });
    return r.disposeIntermediateTensorInfo(p), r.disposeIntermediateTensorInfo(d), r.disposeIntermediateTensorInfo(v), m;
  }
  var _Pe = { kernelName: xt.BatchToSpaceND, backendName: "cpu", kernelFunc: bPe };
  function wPe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = t.weights, s = n.size, i = r.data.get(a.dataId).values, l = r.data.get(o.dataId).values, u2 = f6(i, l, o.dtype, o.shape, s);
    return r.makeTensorInfo([s], o.dtype, u2);
  }
  var kPe = { kernelName: xt.Bincount, backendName: "cpu", kernelFunc: wPe };
  function TPe(e) {
    var t = e.inputs, r = e.backend, n = t.s0, a = t.s1, o = r.data.get(n.dataId).values, s = r.data.get(a.dataId).values, i = xt.backend_util.assertAndGetBroadcastShape(Array.from(o), Array.from(s));
    return r.makeTensorInfo([i.length], "int32", Int32Array.from(i));
  }
  var APe = { kernelName: xt.BroadcastArgs, backendName: "cpu", kernelFunc: TPe };
  var SPe = ks(xt.ClipByValue, function(e, t) {
    var r = t;
    return e > r.clipValueMax ? r.clipValueMax : e < r.clipValueMin ? r.clipValueMin : e;
  }), EPe = { kernelName: xt.ClipByValue, backendName: "cpu", kernelFunc: SPe };
  var DPe = function(e) {
    for (var t = e.inputs.x, r = e.backend, n = new Float32Array(xt.util.sizeFromShape(t.shape)), a = r.data.get(t.dataId), o = a.complexTensorInfos.real, s = a.complexTensorInfos.imag, i = r.data.get(o.dataId).values, l = r.data.get(s.dataId).values, u2 = 0; u2 < i.length; u2++) {
      var c = i[u2], f = l[u2];
      n[u2] = Math.hypot(c, f);
    }
    return r.makeOutput(n, t.shape, "float32");
  }, CPe = { kernelName: xt.ComplexAbs, backendName: "cpu", kernelFunc: DPe };
  function zy(e) {
    var t = e.inputs, r = e.backend, n = t.input, a = r.data.get(n.dataId).complexTensorInfos.imag, o = r.data.get(a.dataId).values;
    return r.makeTensorInfo(a.shape, a.dtype, o);
  }
  var MPe = { kernelName: xt.Imag, backendName: "cpu", kernelFunc: zy };
  function By(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = n.axis, o = xt.util.parseAxisParam(a, t[0].shape)[0], s = xt.backend_util.computeOutShape(t.map(function(y) {
      return y.shape;
    }), o);
    if (xt.util.sizeFromShape(s) === 0) return r.makeTensorInfo(s, t[0].dtype, []);
    var i = t.filter(function(y) {
      return xt.util.sizeFromShape(y.shape) > 0;
    });
    if (i.length === 1) return Xd({ inputs: { x: i[0] }, backend: r });
    var l = i.map(function(y) {
      return y.shape;
    });
    if (xt.backend_util.assertParamsConsistent(l, o), i[0].dtype === "complex64") {
      var u2 = i.map(function(y) {
        return wg({ inputs: { input: y }, backend: r });
      }), c = i.map(function(y) {
        return zy({ inputs: { input: y }, backend: r });
      }), f = By({ inputs: u2, backend: r, attrs: { axis: o } }), h = By({ inputs: c, backend: r, attrs: { axis: o } }), p = fh({ inputs: { real: f, imag: h }, backend: r });
      return u2.forEach(function(y) {
        return r.disposeIntermediateTensorInfo(y);
      }), c.forEach(function(y) {
        return r.disposeIntermediateTensorInfo(y);
      }), r.disposeIntermediateTensorInfo(f), r.disposeIntermediateTensorInfo(h), p;
    }
    var d = i.map(function(y) {
      var w = xt.util.sizeFromShape(y.shape.slice(o)), _4 = [-1, w];
      return Ol({ inputs: { x: y }, backend: r, attrs: { shape: _4 } });
    }), v = d.map(function(y) {
      return { vals: r.data.get(y.dataId).values, shape: y.shape };
    });
    s = xt.backend_util.computeOutShape(d.map(function(y) {
      return y.shape;
    }), 1);
    var m = d[0].shape[0] === 1, g = L$(v, s, t[0].dtype, m), x = xt.backend_util.computeOutShape(i.map(function(y) {
      return y.shape;
    }), o), b = r.makeTensorInfo(x, t[0].dtype, g);
    return d.forEach(function(y) {
      return r.disposeIntermediateTensorInfo(y);
    }), b;
  }
  var IPe = { kernelName: xt.Concat, backendName: "cpu", kernelFunc: By };
  function EH(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = t.filter, s = n.strides, i = n.pad, l = n.dataFormat, u2 = n.dilations, c = n.dimRoundingMode;
    pi([a, o], "conv2d");
    for (var f = xt.backend_util.convertConv2DDataFormat(l), h = xt.backend_util.computeConv2DInfo(a.shape, o.shape, s, u2, i, c, false, f), p = h.filterHeight, d = h.filterWidth, v = h.dilationHeight, m = h.dilationWidth, g = h.padInfo.left, x = h.padInfo.top, b = h.dataFormat === "channelsLast", y = new xt.TensorBuffer(h.outShape, a.dtype), w = xt.util.computeStrides(a.shape), _4 = xt.util.computeStrides(o.shape), k = w[0], T2 = b ? w[1] : w[2], A2 = b ? w[2] : 1, S2 = b ? 1 : w[1], C2 = y.strides[0], E2 = b ? y.strides[1] : y.strides[2], F13 = b ? y.strides[2] : 1, N2 = b ? 1 : y.strides[1], D2 = r.data.get(a.dataId).values, I2 = r.data.get(o.dataId).values, O2 = y.values, L2 = 0; L2 < h.batchSize; ++L2) for (var V3 = L2 * k, W3 = L2 * C2, X2 = 0; X2 < h.outHeight; ++X2) for (var Y2 = W3 + X2 * E2, K2 = X2 * h.strideHeight - x, q = 0; q < p; ++q) {
      var re = K2 + q * v;
      if (!(re < 0 || re >= h.inHeight)) for (var R2 = q * _4[0], z = V3 + re * T2, H2 = 0; H2 < h.outWidth; ++H2) for (var te = Y2 + H2 * F13, j = H2 * h.strideWidth - g, Q2 = 0; Q2 < d; ++Q2) {
        var Z2 = j + Q2 * m;
        if (!(Z2 < 0 || Z2 >= h.inWidth)) for (var ne = R2 + Q2 * _4[1], ae = z + Z2 * A2, ue = ne, le = 0; le < h.inChannels; ++le) {
          for (var ce = D2[ae + le * S2], se = 0; se < h.outChannels; ++se) O2[te + se * N2] += ce * I2[ue + se];
          ue += h.outChannels;
        }
      }
    }
    return r.makeTensorInfo(y.shape, y.dtype, O2);
  }
  var NPe = { kernelName: xt.Conv2D, backendName: "cpu", kernelFunc: EH };
  function FPe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = t.dy, s = n.strides, i = n.pad, l = n.dataFormat, u2 = n.dimRoundingMode, c = n.filterShape;
    pi([a, o], "conv2dBackpropFilter");
    for (var f = xt.backend_util.convertConv2DDataFormat(l), h = xt.backend_util.computeConv2DInfo(a.shape, c, s, 1, i, u2, false, f), p = h.strideHeight, d = h.strideWidth, v = h.filterHeight, m = h.filterWidth, g = h.dataFormat === "channelsLast", x = new xt.TensorBuffer(h.filterShape, "float32"), b = h.padInfo.left, y = h.padInfo.top, w = r.data.get(a.dataId).values, _4 = r.data.get(o.dataId).values, k = new xt.TensorBuffer(a.shape, a.dtype, w), T2 = new xt.TensorBuffer(o.shape, o.dtype, _4), A2 = 0; A2 < v; ++A2) for (var S2 = Math.max(0, Math.ceil((y - A2) / p)), C2 = Math.min(h.outHeight, (h.inHeight + y - A2) / p), E2 = 0; E2 < m; ++E2) for (var F13 = Math.max(0, Math.ceil((b - E2) / d)), N2 = Math.min(h.outWidth, (h.inWidth + b - E2) / d), D2 = 0; D2 < h.inChannels; ++D2) for (var I2 = 0; I2 < h.outChannels; ++I2) {
      for (var O2 = 0, L2 = 0; L2 < h.batchSize; ++L2) for (var V3 = S2; V3 < C2; ++V3) for (var W3 = A2 + V3 * p - y, X2 = F13; X2 < N2; ++X2) {
        var Y2 = E2 + X2 * d - b;
        g ? O2 += k.get(L2, W3, Y2, D2) * T2.get(L2, V3, X2, I2) : O2 += k.get(L2, D2, W3, Y2) * T2.get(L2, I2, V3, X2);
      }
      x.set(O2, A2, E2, D2, I2);
    }
    return r.makeTensorInfo(x.shape, x.dtype, x.values);
  }
  var OPe = { kernelName: xt.Conv2DBackpropFilter, backendName: "cpu", kernelFunc: FPe };
  function PPe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.dy, o = t.filter, s = n.inputShape, i = n.strides, l = n.pad, u2 = n.dataFormat, c = n.dimRoundingMode;
    pi([a, o], "conv2dBackpropInput");
    var f = xt.util.computeStrides(o.shape), h = xt.util.computeStrides(a.shape), p = xt.backend_util.convertConv2DDataFormat(u2), d = xt.backend_util.computeConv2DInfo(s, o.shape, i, 1, l, c, false, p), v = new xt.TensorBuffer(d.inShape, "float32"), m = v.values, g = r.data.get(a.dataId).values, x = r.data.get(o.dataId).values, b = zi(f, 3), y = b[0], w = b[1], _4 = b[2], k = d.batchSize, T2 = d.filterHeight, A2 = d.filterWidth, S2 = d.inChannels, C2 = d.inHeight, E2 = d.inWidth, F13 = d.outChannels, N2 = d.outHeight, D2 = d.outWidth, I2 = d.strideHeight, O2 = d.strideWidth;
    p = d.dataFormat;
    for (var L2 = T2 - 1 - d.padInfo.top, V3 = A2 - 1 - d.padInfo.left, W3 = p === "channelsLast", X2 = v.strides[0], Y2 = W3 ? v.strides[1] : v.strides[2], K2 = W3 ? v.strides[2] : 1, q = W3 ? 1 : v.strides[1], re = h[0], R2 = W3 ? h[1] : h[2], z = W3 ? h[2] : 1, H2 = W3 ? 1 : h[1], te = 0; te < k; ++te) for (var j = 0; j < S2; ++j) for (var Q2 = 0; Q2 < C2; ++Q2) for (var Z2 = Q2 - L2, ne = Math.max(0, Math.ceil(Z2 / I2)), ae = Math.min(N2, (T2 + Z2) / I2), ue = 0; ue < E2; ++ue) {
      for (var le = ue - V3, ce = Math.max(0, Math.ceil(le / O2)), se = Math.min(D2, (A2 + le) / O2), he = 0, me = ne; me < ae; ++me) for (var we = me * I2 - Z2, be = ce; be < se; ++be) for (var Ae = be * O2 - le, pe = re * te + R2 * me + z * be, ve = y * (T2 - 1 - we) + w * (A2 - 1 - Ae) + _4 * j, Ee = 0; Ee < F13; ++Ee) {
        var Se = g[pe + H2 * Ee], Ce = x[ve + Ee];
        he += Se * Ce;
      }
      var Be = X2 * te + Y2 * Q2 + K2 * ue + q * j;
      m[Be] = he;
    }
    return r.makeTensorInfo(v.shape, v.dtype, v.values);
  }
  var LPe = { kernelName: xt.Conv2DBackpropInput, backendName: "cpu", kernelFunc: PPe };
  function RPe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = t.filter, s = n.strides, i = n.pad, l = n.dilations;
    pi([a, o], "conv3d");
    for (var u2 = xt.backend_util.computeConv3DInfo(a.shape, o.shape, s, l, i), c = u2.filterDepth, f = u2.filterHeight, h = u2.filterWidth, p = u2.dilationDepth, d = u2.dilationHeight, v = u2.dilationWidth, m = u2.padInfo, g = m.front, x = m.left, b = m.top, y = new xt.TensorBuffer(u2.outShape, a.dtype), w = r.data.get(a.dataId).values, _4 = r.data.get(o.dataId).values, k = y.values, T2 = xt.util.computeStrides(a.shape), A2 = xt.util.computeStrides(o.shape), S2 = 0; S2 < u2.batchSize; ++S2) for (var C2 = S2 * T2[0], E2 = S2 * y.strides[0], F13 = 0; F13 < u2.outDepth; ++F13) for (var N2 = E2 + F13 * y.strides[1], D2 = F13 * u2.strideDepth - g, I2 = 0; I2 < c; ++I2) {
      var O2 = D2 + I2 * p;
      if (!(O2 < 0 || O2 >= u2.inDepth)) for (var L2 = I2 * A2[0], V3 = C2 + O2 * T2[1], W3 = 0; W3 < u2.outHeight; ++W3) for (var X2 = N2 + W3 * y.strides[2], Y2 = W3 * u2.strideHeight - b, K2 = 0; K2 < f; ++K2) {
        var q = Y2 + K2 * d;
        if (!(q < 0 || q >= u2.inHeight)) for (var re = L2 + K2 * A2[1], R2 = V3 + q * T2[2], z = 0; z < u2.outWidth; ++z) for (var H2 = X2 + z * u2.outChannels, te = z * u2.strideWidth - x, j = 0; j < h; ++j) {
          var Q2 = te + j * v;
          if (!(Q2 < 0 || Q2 >= u2.inWidth)) for (var Z2 = re + j * A2[2], ne = R2 + Q2 * u2.inChannels, ae = Z2, ue = 0; ue < u2.inChannels; ++ue) {
            for (var le = w[ne + ue], ce = 0; ce < u2.outChannels; ++ce) k[H2 + ce] += le * _4[ae + ce];
            ae += u2.outChannels;
          }
        }
      }
    }
    return r.makeTensorInfo(y.shape, y.dtype, y.values);
  }
  var zPe = { kernelName: xt.Conv3D, backendName: "cpu", kernelFunc: RPe };
  function BPe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = t.dy, s = n.strides, i = n.pad, l = n.filterShape;
    pi([a, o], "conv3dBackpropFilterV2");
    for (var u2 = xt.util.computeStrides(a.shape), c = xt.util.computeStrides(o.shape), f = xt.backend_util.computeConv3DInfo(a.shape, l, s, 1, i), h = f.strideDepth, p = f.strideHeight, d = f.strideWidth, v = f.filterDepth, m = f.filterHeight, g = f.filterWidth, x = new xt.TensorBuffer(f.filterShape, "float32"), b = x.values, y = zi(x.strides, 4), w = y[0], _4 = y[1], k = y[2], T2 = y[3], A2 = r.data.get(o.dataId).values, S2 = zi(c, 4), C2 = S2[0], E2 = S2[1], F13 = S2[2], N2 = S2[3], D2 = r.data.get(a.dataId).values, I2 = zi(u2, 4), O2 = I2[0], L2 = I2[1], V3 = I2[2], W3 = I2[3], X2 = f.padInfo.front, Y2 = f.padInfo.left, K2 = f.padInfo.top, q = 0; q < v; ++q) for (var re = Math.max(0, Math.ceil((X2 - q) / h)), R2 = Math.min(f.outDepth, (f.inDepth + X2 - q) / h), z = q * w, H2 = 0; H2 < m; ++H2) for (var te = Math.max(0, Math.ceil((K2 - H2) / p)), j = Math.min(f.outHeight, (f.inHeight + K2 - H2) / p), Q2 = H2 * _4 + z, Z2 = 0; Z2 < g; ++Z2) for (var ne = Math.max(0, Math.ceil((Y2 - Z2) / d)), ae = Math.min(f.outWidth, (f.inWidth + Y2 - Z2) / d), ue = Z2 * k + Q2, le = 0; le < f.inChannels; ++le) for (var ce = le * T2 + ue, se = 0; se < f.outChannels; ++se) {
      for (var he = 0, me = 0; me < f.batchSize; ++me) for (var we = me * O2, be = me * C2, Ae = re; Ae < R2; ++Ae) for (var pe = q + Ae * h - X2, ve = pe * L2 + we, Ee = Ae * E2 + be, Se = te; Se < j; ++Se) for (var Ce = H2 + Se * p - K2, Be = Ce * V3 + ve, Ue = Se * F13 + Ee, Ke = ne; Ke < ae; ++Ke) {
        var ct = Z2 + Ke * d - Y2, We = ct * W3 + Be, Ze = Ke * N2 + Ue;
        he += D2[We + le] * A2[Ze + se];
      }
      b[ce + se] = he;
    }
    return r.makeTensorInfo(x.shape, x.dtype, x.values);
  }
  var UPe = { kernelName: xt.Conv3DBackpropFilterV2, backendName: "cpu", kernelFunc: BPe };
  function VPe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.dy, o = t.filter, s = n.pad, i = n.strides, l = n.inputShape;
    pi([a], "conv3dBackpropInputV2");
    for (var u2 = xt.util.computeStrides(a.shape), c = xt.util.computeStrides(o.shape), f = xt.backend_util.computeConv3DInfo(l, o.shape, i, 1, s), h = new xt.TensorBuffer(f.inShape, "float32"), p = h.values, d = zi(h.strides, 4), v = d[0], m = d[1], g = d[2], x = d[3], b = r.data.get(a.dataId).values, y = zi(u2, 4), w = y[0], _4 = y[1], k = y[2], T2 = y[3], A2 = r.data.get(o.dataId).values, S2 = zi(c, 4), C2 = S2[0], E2 = S2[1], F13 = S2[2], N2 = S2[3], D2 = f.batchSize, I2 = f.filterDepth, O2 = f.filterHeight, L2 = f.filterWidth, V3 = f.inChannels, W3 = f.inDepth, X2 = f.inHeight, Y2 = f.inWidth, K2 = f.outChannels, q = f.outDepth, re = f.outHeight, R2 = f.outWidth, z = f.strideDepth, H2 = f.strideHeight, te = f.strideWidth, j = I2 - 1 - f.padInfo.front, Q2 = O2 - 1 - f.padInfo.top, Z2 = L2 - 1 - f.padInfo.left, ne = 0; ne < D2; ++ne) for (var ae = 0; ae < V3; ++ae) for (var ue = 0; ue < W3; ++ue) for (var le = ue - j, ce = Math.max(0, Math.ceil(le / z)), se = Math.min(q, (I2 + le) / z), he = 0; he < X2; ++he) for (var me = he - Q2, we = Math.max(0, Math.ceil(me / H2)), be = Math.min(re, (O2 + me) / H2), Ae = 0; Ae < Y2; ++Ae) {
      for (var pe = Ae - Z2, ve = Math.max(0, Math.ceil(pe / te)), Ee = Math.min(R2, (L2 + pe) / te), Se = 0, Ce = ce; Ce < se; ++Ce) for (var Be = Ce * z - le, Ue = we; Ue < be; ++Ue) for (var Ke = Ue * H2 - me, ct = ve; ct < Ee; ++ct) for (var We = ct * te - pe, Ze = w * ne + _4 * Ce + k * Ue + T2 * ct, it = C2 * (I2 - 1 - Be) + E2 * (O2 - 1 - Ke) + F13 * (L2 - 1 - We) + N2 * ae, ot = 0; ot < K2; ++ot) {
        var mt = b[Ze + ot], wt = A2[it + ot];
        Se += mt * wt;
      }
      p[v * ne + m * ue + g * he + x * Ae + ae] = Se;
    }
    return r.makeTensorInfo(h.shape, h.dtype, h.values);
  }
  var jPe = { kernelName: xt.Conv3DBackpropInputV2, backendName: "cpu", kernelFunc: VPe };
  var WPe = ks(xt.Cos, function(e) {
    return Math.cos(e);
  }), GPe = { kernelName: xt.Cos, backendName: "cpu", kernelFunc: WPe };
  var $Pe = ks(xt.Cosh, function(e) {
    return Math.cosh(e);
  }), HPe = { kernelName: xt.Cosh, backendName: "cpu", kernelFunc: $Pe };
  function qPe(e) {
    for (var t = e.inputs, r = e.backend, n = e.attrs, a = t.image, o = t.boxes, s = t.boxInd, i = n.cropSize, l = n.method, u2 = n.extrapolationValue, c = zi(a.shape, 4), f = c[0], h = c[1], p = c[2], d = c[3], v = o.shape[0], m = zi(i, 2), g = m[0], x = m[1], b = xt.buffer([v, g, x, d], "float32"), y = r.data.get(o.dataId).values, w = r.data.get(s.dataId).values, _4 = r.data.get(a.dataId).values, k = xt.util.computeStrides(a.shape), T2 = xt.util.computeStrides(b.shape), A2 = 0; A2 < v; A2++) {
      var S2 = A2 * 4, C2 = y[S2], E2 = y[S2 + 1], F13 = y[S2 + 2], N2 = y[S2 + 3], D2 = w[A2];
      if (!(D2 >= f)) for (var I2 = g > 1 ? (F13 - C2) * (h - 1) / (g - 1) : 0, O2 = x > 1 ? (N2 - E2) * (p - 1) / (x - 1) : 0, L2 = 0; L2 < g; L2++) {
        var V3 = g > 1 ? C2 * (h - 1) + L2 * I2 : 0.5 * (C2 + F13) * (h - 1);
        if (V3 < 0 || V3 > h - 1) {
          for (var W3 = 0; W3 < x; W3++) for (var X2 = 0; X2 < d; X2++) {
            var Y2 = X2 + W3 * T2[2] + L2 * T2[1] + A2 * T2[0];
            b.values[Y2] = u2;
          }
          continue;
        }
        if (l === "bilinear") for (var K2 = Math.floor(V3), q = Math.ceil(V3), re = V3 - K2, W3 = 0; W3 < x; W3++) {
          var R2 = x > 1 ? E2 * (p - 1) + W3 * O2 : 0.5 * (E2 + N2) * (p - 1);
          if (R2 < 0 || R2 > p - 1) {
            for (var X2 = 0; X2 < d; X2++) {
              var Y2 = X2 + W3 * T2[2] + L2 * T2[1] + A2 * T2[0];
              b.values[Y2] = u2;
            }
            continue;
          }
          for (var z = Math.floor(R2), H2 = Math.ceil(R2), te = R2 - z, X2 = 0; X2 < d; X2++) {
            var Y2 = X2 + z * k[2] + K2 * k[1] + D2 * k[0], j = _4[Y2];
            Y2 = X2 + H2 * k[2] + K2 * k[1] + D2 * k[0];
            var Q2 = _4[Y2];
            Y2 = X2 + z * k[2] + q * k[1] + D2 * k[0];
            var Z2 = _4[Y2];
            Y2 = X2 + H2 * k[2] + q * k[1] + D2 * k[0];
            var ne = _4[Y2], ae = j + (Q2 - j) * te, ue = Z2 + (ne - Z2) * te;
            Y2 = X2 + W3 * T2[2] + L2 * T2[1] + A2 * T2[0], b.values[Y2] = ae + (ue - ae) * re;
          }
        }
        else for (var W3 = 0; W3 < x; ++W3) {
          var R2 = x > 1 ? E2 * (p - 1) + W3 * O2 : 0.5 * (E2 + N2) * (p - 1);
          if (R2 < 0 || R2 > p - 1) {
            for (var X2 = 0; X2 < d; X2++) {
              var Y2 = X2 + W3 * T2[2] + L2 * T2[1] + A2 * T2[0];
              b.values[Y2] = u2;
            }
            continue;
          }
          for (var le = Math.round(R2), ce = Math.round(V3), X2 = 0; X2 < d; X2++) {
            var se = X2 + le * k[2] + ce * k[1] + D2 * k[0], he = X2 + W3 * T2[2] + L2 * T2[1] + A2 * T2[0];
            b.values[he] = _4[se];
          }
        }
      }
    }
    return r.makeTensorInfo(b.shape, b.dtype, b.values);
  }
  var XPe = { kernelName: xt.CropAndResize, backendName: "cpu", kernelFunc: qPe };
  function KPe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.axis, s = n.exclusive, i = n.reverse;
    pi(a, "cumsum");
    var l = xt.backend_util.getAxesPermutation([o], a.shape.length), u2 = a;
    l != null && (u2 = Lh({ inputs: { x: a }, backend: r, attrs: { perm: l } }));
    var c = xt.backend_util.getInnerMostAxes(1, a.shape.length)[0];
    if (c !== u2.shape.length - 1) throw new Error("backend.cumsum in CPU expects an inner-most " + ("axis=" + (u2.shape.length - 1) + " but got axis=" + c));
    for (var f = xt.upcastType(u2.dtype, "int32"), h = xt.util.makeZerosTypedArray(xt.util.sizeFromShape(u2.shape), f), p = r.data.get(u2.dataId).values, d = u2.shape[u2.shape.length - 1], v = i ? function(k, T2) {
      return k + d - T2 - 1;
    } : function(k, T2) {
      return k + T2;
    }, m = 0; m < p.length; m += d) for (var g = 0; g < d; g++) {
      var x = v(m, g);
      if (g === 0) h[x] = s ? 0 : p[x];
      else {
        var b = v(m, g - 1);
        h[x] = s ? p[b] + h[b] : p[x] + h[b];
      }
    }
    var y = r.makeTensorInfo(u2.shape, f, h);
    if (l != null) {
      var w = xt.backend_util.getUndoAxesPermutation(l), _4 = Lh({ inputs: { x: y }, backend: r, attrs: { perm: w } });
      return r.disposeIntermediateTensorInfo(y), r.disposeIntermediateTensorInfo(u2), _4;
    }
    return y;
  }
  var YPe = { kernelName: xt.Cumsum, backendName: "cpu", kernelFunc: KPe };
  function ZPe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = t.weights, s = n.size, i = n.binaryOutput;
    if (a.shape.length === 1) {
      var l = r.data.get(a.dataId).values, u2 = r.data.get(o.dataId).values, c = f6(l, u2, o.dtype, o.shape, s);
      return r.makeTensorInfo([s], o.dtype, c);
    } else if (a.shape.length === 2) {
      var f = r.bufferSync(a), h = r.bufferSync(o), p = O$(f, h, s, i);
      return r.makeTensorInfo(p.shape, o.dtype, p.values);
    }
    throw new Error("Error in denseBincount: input must be at most rank 2, but got rank" + (a.shape.length + "."));
  }
  var JPe = { kernelName: xt.DenseBincount, backendName: "cpu", kernelFunc: ZPe };
  function QPe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.blockSize, s = n.dataFormat;
    xt.util.assert(s === "NHWC", function() {
      return "Only NHWC dataFormat supported on CPU for depthToSpace. Got " + s;
    });
    for (var i = a.shape[0], l = a.shape[1], u2 = a.shape[2], c = a.shape[3], f = l * o, h = u2 * o, p = c / (o * o), d = r.data.get(a.dataId).values, v = new Float32Array(i * f * h * p), m = 0, g = 0; g < i; ++g) for (var x = 0; x < f; ++x) for (var b = Math.floor(x / o), y = x % o, w = 0; w < h; ++w) for (var _4 = Math.floor(w / o), k = w % o, T2 = (y * o + k) * p, A2 = 0; A2 < p; ++A2) {
      var S2 = A2 + T2, C2 = S2 + c * (_4 + u2 * (b + l * g));
      v[m++] = d[C2];
    }
    return r.makeTensorInfo([i, f, h, p], a.dtype, v);
  }
  var eLe = { kernelName: xt.DepthToSpace, backendName: "cpu", kernelFunc: QPe };
  function DH(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = t.filter, s = n.strides, i = n.pad, l = n.dilations, u2 = n.dimRoundingMode;
    pi([a, o], "depthwiseConv2DNative");
    var c = xt.util.computeStrides(a.shape), f = xt.util.computeStrides(o.shape), h = l;
    h == null && (h = [1, 1]), xt.util.assert(xt.backend_util.eitherStridesOrDilationsAreOne(s, h), function() {
      return "Error in depthwiseConv2d: Either strides or dilations must be " + ("1. Got strides " + s + " and dilations '" + h + "'");
    });
    for (var p = xt.backend_util.computeConv2DInfo(a.shape, o.shape, s, h, i, u2, true), d = p.filterHeight, v = p.filterWidth, m = p.dilationHeight, g = p.dilationWidth, x = p.padInfo, b = x.left, y = x.top, w = p.outChannels / p.inChannels, _4 = new xt.TensorBuffer(p.outShape, a.dtype), k = r.data.get(a.dataId).values, T2 = r.data.get(o.dataId).values, A2 = _4.values, S2 = 0; S2 < p.batchSize; ++S2) for (var C2 = S2 * c[0], E2 = S2 * _4.strides[0], F13 = 0; F13 < p.outHeight; ++F13) for (var N2 = E2 + F13 * _4.strides[1], D2 = F13 * p.strideHeight - y, I2 = 0; I2 < d; ++I2) {
      var O2 = D2 + I2 * m;
      if (!(O2 < 0 || O2 >= p.inHeight)) for (var L2 = I2 * f[0], V3 = C2 + O2 * c[1], W3 = 0; W3 < p.outWidth; ++W3) for (var X2 = N2 + W3 * _4.strides[2], Y2 = W3 * p.strideWidth - b, K2 = 0; K2 < v; ++K2) {
        var q = Y2 + K2 * g;
        if (!(q < 0 || q >= p.inWidth)) for (var re = L2 + K2 * f[1], R2 = V3 + q * p.inChannels, z = X2, H2 = re, te = 0; te < p.inChannels; ++te) {
          for (var j = k[R2 + te], Q2 = 0; Q2 < w; ++Q2) A2[z + Q2] += j * T2[H2 + Q2];
          z += w, H2 += w;
        }
      }
    }
    return r.makeTensorInfo(_4.shape, _4.dtype, _4.values);
  }
  var tLe = { kernelName: xt.DepthwiseConv2dNative, backendName: "cpu", kernelFunc: DH };
  function rLe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = t.dy, s = n.strides, i = n.dilations, l = n.pad, u2 = n.dimRoundingMode, c = n.filterShape;
    pi([a, o], "depthwiseConv2dNativeBackpropFilter");
    for (var f = xt.backend_util.computeConv2DInfo(a.shape, c, s, i, l, u2, true), h = f.strideHeight, p = f.strideWidth, d = f.filterHeight, v = f.filterWidth, m = new xt.TensorBuffer(f.filterShape, "float32"), g = f.padInfo.left, x = f.padInfo.top, b = f.outChannels / f.inChannels, y = r.data.get(a.dataId).values, w = new xt.TensorBuffer(a.shape, a.dtype, y), _4 = r.data.get(o.dataId).values, k = new xt.TensorBuffer(o.shape, o.dtype, _4), T2 = 0; T2 < d; ++T2) for (var A2 = Math.max(0, Math.ceil((x - T2) / h)), S2 = Math.min(f.outHeight, (f.inHeight + x - T2) / h), C2 = 0; C2 < v; ++C2) for (var E2 = Math.max(0, Math.ceil((g - C2) / p)), F13 = Math.min(f.outWidth, (f.inWidth + g - C2) / p), N2 = 0; N2 < f.outChannels; ++N2) {
      for (var D2 = Math.trunc(N2 / b), I2 = N2 % b, O2 = 0, L2 = 0; L2 < f.batchSize; ++L2) for (var V3 = A2; V3 < S2; ++V3) for (var W3 = T2 + V3 * h - x, X2 = E2; X2 < F13; ++X2) {
        var Y2 = C2 + X2 * p - g;
        O2 += w.get(L2, W3, Y2, D2) * k.get(L2, V3, X2, N2);
      }
      m.set(O2, T2, C2, D2, I2);
    }
    return r.makeTensorInfo(m.shape, m.dtype, m.values);
  }
  var nLe = { kernelName: xt.DepthwiseConv2dNativeBackpropFilter, backendName: "cpu", kernelFunc: rLe };
  function aLe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.dy, o = t.filter, s = n.strides, i = n.dilations, l = n.pad, u2 = n.dimRoundingMode, c = n.inputShape;
    pi([a, o], "depthwiseConv2DNativeBackpropInput");
    for (var f = xt.util.computeStrides(a.shape), h = xt.util.computeStrides(o.shape), p = xt.backend_util.computeConv2DInfo(c, o.shape, s, i, l, u2, true), d = new xt.TensorBuffer(p.inShape, "float32"), v = d.values, m = zi(d.strides, 3), g = m[0], x = m[1], b = m[2], y = r.data.get(a.dataId).values, w = zi(f, 3), _4 = w[0], k = w[1], T2 = w[2], A2 = r.data.get(o.dataId).values, S2 = zi(h, 3), C2 = S2[0], E2 = S2[1], F13 = S2[2], N2 = p.batchSize, D2 = p.filterHeight, I2 = p.filterWidth, O2 = p.inChannels, L2 = p.inHeight, V3 = p.inWidth, W3 = p.outChannels, X2 = p.outHeight, Y2 = p.outWidth, K2 = p.strideHeight, q = p.strideWidth, re = D2 - 1 - p.padInfo.top, R2 = I2 - 1 - p.padInfo.left, z = W3 / O2, H2 = 0; H2 < N2; ++H2) for (var te = 0; te < O2; ++te) for (var j = 0; j < L2; ++j) for (var Q2 = j - re, Z2 = Math.max(0, Math.ceil(Q2 / K2)), ne = Math.min(X2, (D2 + Q2) / K2), ae = 0; ae < V3; ++ae) {
      for (var ue = ae - R2, le = Math.max(0, Math.ceil(ue / q)), ce = Math.min(Y2, (I2 + ue) / q), se = 0, he = Z2; he < ne; ++he) for (var me = he * K2 - Q2, we = le; we < ce; ++we) for (var be = we * q - ue, Ae = _4 * H2 + k * he + T2 * we, pe = C2 * (D2 - 1 - me) + E2 * (I2 - 1 - be) + F13 * te, ve = 0; ve < z; ++ve) {
        var Ee = te * z + ve, Se = y[Ae + Ee], Ce = A2[pe + ve];
        se += Se * Ce;
      }
      v[g * H2 + x * j + b * ae + te] = se;
    }
    return r.makeTensorInfo(d.shape, d.dtype, d.values);
  }
  var iLe = { kernelName: xt.DepthwiseConv2dNativeBackpropInput, backendName: "cpu", kernelFunc: aLe };
  function oLe(e) {
    for (var t = e.inputs, r = e.backend, n = t.x, a = xt.util.sizeFromShape(n.shape), o = r.data.get(n.dataId).values, s = xt.buffer([a, a], n.dtype), i = s.values, l = 0; l < o.length; l++) i[l * a + l] = o[l];
    var u2 = pd(n.shape, n.shape);
    return r.makeTensorInfo(u2, s.dtype, s.values);
  }
  var sLe = { kernelName: xt.Diag, backendName: "cpu", kernelFunc: oLe };
  var lLe = { kernelName: xt.Dilation2D, backendName: "cpu", kernelFunc: function(e) {
    for (var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = t.filter, s = n.strides, i = n.pad, l = n.dilations, u2 = r, c = u2.data.get(a.dataId).values, f = a.shape.length, h = u2.data.get(o.dataId).values, p = o.shape.length, d = xt.backend_util.computeDilation2DInfo(a.shape, o.shape, s, i, "NHWC", l), v = d.batchSize, m = d.inHeight, g = d.inWidth, x = d.inChannels, b = d.outHeight, y = d.outWidth, w = d.padInfo, _4 = d.strideHeight, k = d.strideWidth, T2 = d.filterHeight, A2 = d.filterWidth, S2 = d.dilationHeight, C2 = d.dilationWidth, E2 = d.outShape, F13 = xt.util.sizeFromShape(E2), N2 = E2.length, D2 = xt.util.getArrayFromDType(a.dtype, F13), I2 = 0; I2 < v; ++I2) for (var O2 = 0; O2 < b; ++O2) for (var L2 = O2 * _4 - w.top, V3 = 0; V3 < y; ++V3) for (var W3 = V3 * k - w.left, X2 = 0; X2 < x; ++X2) {
      for (var Y2 = Number.MIN_SAFE_INTEGER, K2 = 0; K2 < T2; ++K2) {
        var q = L2 + K2 * S2;
        if (q >= 0 && q < m) for (var re = 0; re < A2; ++re) {
          var R2 = W3 + re * C2;
          if (R2 >= 0 && R2 < g) {
            var z = xt.util.locToIndex([I2, q, R2, X2], f, xt.util.computeStrides(a.shape)), H2 = xt.util.locToIndex([K2, re, X2], p, xt.util.computeStrides(o.shape)), te = c[z] + h[H2];
            te > Y2 && (Y2 = te);
          }
        }
      }
      var j = xt.util.locToIndex([I2, O2, V3, X2], N2, xt.util.computeStrides(E2));
      D2[j] = Y2;
    }
    var Q2 = u2.write(xt.util.toTypedArray(D2, a.dtype), E2, a.dtype);
    return { dataId: Q2, shape: E2, dtype: a.dtype };
  } };
  var uLe = { kernelName: xt.Dilation2DBackpropFilter, backendName: "cpu", kernelFunc: function(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = t.filter, s = t.dy, i = n.strides, l = n.pad, u2 = n.dilations, c = r, f = xt.util.toNestedArray(a.shape, c.data.get(a.dataId).values), h = xt.util.toNestedArray(o.shape, c.data.get(o.dataId).values), p = xt.backend_util.computeDilation2DInfo(a.shape, o.shape, i, l, "NHWC", u2), d = p.batchSize, v = p.inHeight, m = p.inWidth, g = p.inChannels, x = p.outHeight, b = p.outWidth, y = p.padInfo, w = p.strideHeight, _4 = p.strideWidth, k = p.filterHeight, T2 = p.filterWidth, A2 = p.dilationHeight, S2 = p.dilationWidth, C2 = p.outShape;
    xt.util.assert(s.rank === C2.length, function() {
      return "Error in " + xt.Dilation2DBackpropFilter + ", dy " + ("must have the same rank as output " + C2.length + ", but got ") + ("" + s.rank);
    });
    for (var E2 = xt.util.toNestedArray(C2, c.data.get(s.dataId).values), F13 = xt.util.makeZerosNestedTypedArray(o.shape, o.dtype), N2 = 0; N2 < d; ++N2) for (var D2 = 0; D2 < x; ++D2) for (var I2 = D2 * w - y.top, O2 = 0; O2 < b; ++O2) for (var L2 = O2 * _4 - y.left, V3 = 0; V3 < g; ++V3) {
      for (var W3 = Number.MIN_SAFE_INTEGER, X2 = 0, Y2 = 0, K2 = 0; K2 < k; ++K2) {
        var q = I2 + K2 * A2;
        if (q >= 0 && q < v) for (var re = 0; re < T2; ++re) {
          var R2 = L2 + re * S2;
          if (R2 >= 0 && R2 < m) {
            var z = f[N2][q][R2][V3] + h[K2][re][V3];
            z > W3 && (W3 = z, X2 = K2, Y2 = re);
          }
        }
      }
      F13[X2][Y2][V3] += E2[N2][D2][O2][V3];
    }
    var H2 = c.write(xt.util.toTypedArray(F13, a.dtype), o.shape, o.dtype);
    return { dataId: H2, shape: o.shape, dtype: o.dtype };
  } };
  var cLe = { kernelName: xt.Dilation2DBackpropInput, backendName: "cpu", kernelFunc: function(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = t.filter, s = t.dy, i = n.strides, l = n.pad, u2 = n.dilations, c = r, f = xt.util.toNestedArray(a.shape, c.data.get(a.dataId).values), h = xt.util.toNestedArray(o.shape, c.data.get(o.dataId).values), p = xt.backend_util.computeDilation2DInfo(a.shape, o.shape, i, l, "NHWC", u2), d = p.batchSize, v = p.inHeight, m = p.inWidth, g = p.inChannels, x = p.outHeight, b = p.outWidth, y = p.padInfo, w = p.strideHeight, _4 = p.strideWidth, k = p.filterHeight, T2 = p.filterWidth, A2 = p.dilationHeight, S2 = p.dilationWidth, C2 = p.outShape;
    xt.util.assert(s.rank === C2.length, function() {
      return "Error in " + xt.Dilation2DBackpropInput + ", dy " + ("must have the same rank as output " + C2.length + ", but got ") + ("" + s.rank);
    });
    for (var E2 = xt.util.toNestedArray(C2, c.data.get(s.dataId).values), F13 = xt.util.makeZerosNestedTypedArray(a.shape, a.dtype), N2 = 0; N2 < d; ++N2) for (var D2 = 0; D2 < x; ++D2) for (var I2 = D2 * w - y.top, O2 = 0; O2 < b; ++O2) for (var L2 = O2 * _4 - y.left, V3 = 0; V3 < g; ++V3) {
      for (var W3 = Number.MIN_SAFE_INTEGER, X2 = I2 < 0 ? 0 : I2, Y2 = L2 < 0 ? 0 : L2, K2 = 0; K2 < k; ++K2) {
        var q = I2 + K2 * A2;
        if (q >= 0 && q < v) for (var re = 0; re < T2; ++re) {
          var R2 = L2 + re * S2;
          if (R2 >= 0 && R2 < m) {
            var z = f[N2][q][R2][V3] + h[K2][re][V3];
            z > W3 && (W3 = z, X2 = q, Y2 = R2);
          }
        }
      }
      F13[N2][X2][Y2][V3] += E2[N2][D2][O2][V3];
    }
    var H2 = c.write(xt.util.toTypedArray(F13, a.dtype), a.shape, a.dtype);
    return { dataId: H2, shape: a.shape, dtype: a.dtype };
  } };
  function j2(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.axis, s = n.keepDims;
    pi(a, "sum");
    var i;
    a.dtype === "bool" ? i = Rv({ inputs: { x: a }, backend: r, attrs: { dtype: "int32" } }) : i = Xd({ inputs: { x: a }, backend: r });
    var l = i.shape.length, u2 = xt.util.parseAxisParam(o, i.shape), c = xt.backend_util.getAxesPermutation(u2, l), f = u2, h = i;
    c != null && (h = Lh({ inputs: { x: i }, backend: r, attrs: { perm: c } }), f = xt.backend_util.getInnerMostAxes(f.length, l)), xt.backend_util.assertAxesAreInnerMostDims("sum", f, h.shape.length);
    for (var p = zi(xt.backend_util.computeOutAndReduceShapes(h.shape, f), 2), d = p[0], v = p[1], m = xt.backend_util.upcastType(h.dtype, "int32"), g = vT(r, d, m), x = xt.util.sizeFromShape(v), b = r.data.get(g.dataId).values, y = r.data.get(h.dataId).values, w = 0; w < b.length; ++w) {
      for (var _4 = w * x, k = 0, T2 = 0; T2 < x; ++T2) k += y[_4 + T2];
      b[w] = k;
    }
    if (s) {
      var A2 = xt.backend_util.expandShapeToKeepDim(g.shape, u2), S2 = g;
      g = Ol({ inputs: { x: g }, backend: r, attrs: { shape: A2 } }), r.disposeIntermediateTensorInfo(S2);
    }
    return r.disposeIntermediateTensorInfo(i), c != null && r.disposeIntermediateTensorInfo(h), g;
  }
  var fLe = { kernelName: xt.Sum, backendName: "cpu", kernelFunc: j2 };
  function hLe(e) {
    var t, r, n, a, o = e.inputs, s = e.backend, i = e.attrs, l = i.equation, u2 = o, c = xt.backend_util.decodeEinsumEquation(l, u2.length), f = c.allDims, h = c.summedDims, p = c.idDims;
    xt.backend_util.checkEinsumDimSizes(f.length, p, u2);
    for (var d = xt.backend_util.getEinsumComputePath(h, p), v = d.path, m = d.steps, g = m.length, x = null, b = f.length, y = [], w = 0; w < g; ++w) {
      try {
        for (var _4 = (t = void 0, dT(m[w])), k = _4.next(); !k.done; k = _4.next()) {
          var T2 = k.value, A2 = xt.backend_util.getEinsumPermutation(b, p[T2]), S2 = A2.permutationIndices, C2 = A2.expandDims, E2 = void 0;
          xt.backend_util.isIdentityPermutation(S2) ? E2 = u2[T2] : (E2 = Lh({ inputs: { x: u2[T2] }, backend: s, attrs: { perm: S2 } }), y.push(E2));
          for (var F13 = E2.shape.slice(), N2 = 0; N2 < C2.length; ++N2) F13.splice(C2[N2], 0, 1);
          xt.util.arraysEqual(E2.shape, F13) || (E2 = Ol({ inputs: { x: E2 }, backend: s, attrs: { shape: F13 } }), y.push(E2)), x === null ? x = E2 : (x = yT({ inputs: { a: E2, b: x }, backend: s }), y.push(x));
        }
      } catch (L2) {
        t = { error: L2 };
      } finally {
        try {
          k && !k.done && (r = _4.return) && r.call(_4);
        } finally {
          if (t) throw t.error;
        }
      }
      w < g - 1 && (v[w] >= 0 && (x = j2({ inputs: { x }, backend: s, attrs: { axis: v[w] - (f.length - b), keepDims: false } }), y.push(x)), b--);
    }
    try {
      for (var D2 = dT(y), I2 = D2.next(); !I2.done; I2 = D2.next()) {
        var O2 = I2.value;
        O2 !== x && s.disposeIntermediateTensorInfo(O2);
      }
    } catch (L2) {
      n = { error: L2 };
    } finally {
      try {
        I2 && !I2.done && (a = D2.return) && a.call(D2);
      } finally {
        if (n) throw n.error;
      }
    }
    return x;
  }
  var pLe = { kernelName: xt.Einsum, backendName: "cpu", kernelFunc: hLe };
  function dLe(e) {
    var t = e.inputs, r = e.backend, n = t.dy, a = t.y;
    pi([n, a], "eluGrad");
    for (var o = new Float32Array(xt.util.sizeFromShape(a.shape)), s = r.data.get(a.dataId).values, i = r.data.get(n.dataId).values, l = 0; l < s.length; ++l) {
      var u2 = s[l];
      u2 >= 1 ? o[l] = i[l] : o[l] = i[l] * (u2 + 1);
    }
    return r.makeTensorInfo(a.shape, "float32", o);
  }
  var vLe = { kernelName: xt.EluGrad, backendName: "cpu", kernelFunc: dLe };
  var mLe = xt.backend_util.ERF_P, gLe = xt.backend_util.ERF_A1, yLe = xt.backend_util.ERF_A2, xLe = xt.backend_util.ERF_A3, bLe = xt.backend_util.ERF_A4, _Le = xt.backend_util.ERF_A5, wLe = ks(xt.Erf, function(e) {
    var t = Math.sign(e), r = Math.abs(e), n = 1 / (1 + mLe * r);
    return t * (1 - ((((_Le * n + bLe) * n + xLe) * n + yLe) * n + gLe) * n * Math.exp(-r * r));
  }), kLe = { kernelName: xt.Erf, backendName: "cpu", kernelFunc: wLe };
  function mT(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.input, o = n.dim, s = a.shape.length, i = a.shape.slice(), l = o;
    return o < 0 && (xt.util.assert(-(s + 1) <= o, function() {
      return "Axis must be in the interval [" + -(s + 1) + ", " + s + "]";
    }), l = s + o + 1), i.splice(l, 0, 1), Ol({ inputs: { x: a }, backend: r, attrs: { shape: i } });
  }
  var TLe = { kernelName: xt.ExpandDims, backendName: "cpu", kernelFunc: mT };
  var ALe = Iu(function(e, t) {
    return e / t;
  }), y6 = hc(xt.RealDiv, ALe), s6 = { kernelName: xt.RealDiv, backendName: "cpu", kernelFunc: y6 };
  function CH(e, t, r) {
    for (var n = e.shape, a = n[0], o = n[1], s = r.data.get(e.dataId), i = s.complexTensorInfos.real, l = s.complexTensorInfos.imag, u2 = [a, o], c = xt.util.sizeFromShape(u2), f = xt.util.getTypedArrayFromDType("float32", c), h = xt.util.getTypedArrayFromDType("float32", c), p = 0; p < a; p++) {
      for (var d = kg({ inputs: { x: i }, backend: r, attrs: { begin: [p, 0], size: [1, o] } }), v = kg({ inputs: { x: l }, backend: r, attrs: { begin: [p, 0], size: [1, o] } }), m = fh({ inputs: { real: d, imag: v }, backend: r }), g = SLe(m, t, r), x = g.real, b = g.imag, y = xt.backend_util.mergeRealAndImagArrays(x, b), w = 0; w < o; w++) {
        var _4 = xt.backend_util.getComplexWithIndex(y, w);
        f[p * o + w] = _4.real, h[p * o + w] = _4.imag;
      }
      r.disposeIntermediateTensorInfo(d), r.disposeIntermediateTensorInfo(v), r.disposeIntermediateTensorInfo(m);
    }
    var k = r.makeTensorInfo(u2, "float32", f), T2 = r.makeTensorInfo(u2, "float32", h), A2 = fh({ inputs: { real: k, imag: T2 }, backend: r });
    return r.disposeIntermediateTensorInfo(k), r.disposeIntermediateTensorInfo(T2), A2;
  }
  function SLe(e, t, r) {
    var n = xt.util.sizeFromShape(e.shape), a = r.data.get(e.dataId), o = r.data.get(a.complexTensorInfos.real.dataId).values, s = r.data.get(a.complexTensorInfos.imag.dataId).values;
    if (ELe(n)) {
      var i = l6(o, s, n, t, r), l = [e.shape[0], e.shape[1]];
      if (t) {
        var u2 = r.makeTensorInfo(l, "float32", i.real), c = r.makeTensorInfo(l, "float32", i.imag), f = r.makeTensorInfo([], "float32", xt.util.createScalarValue(n, "float32")), h = Xd({ inputs: { x: f }, backend: r }), p = s6.kernelFunc({ inputs: { a: u2, b: f }, backend: r }), d = s6.kernelFunc({ inputs: { a: c, b: h }, backend: r }), v = r.data.get(p.dataId).values, m = r.data.get(d.dataId).values;
        return r.disposeIntermediateTensorInfo(u2), r.disposeIntermediateTensorInfo(c), r.disposeIntermediateTensorInfo(f), r.disposeIntermediateTensorInfo(h), r.disposeIntermediateTensorInfo(p), r.disposeIntermediateTensorInfo(d), { real: v, imag: m };
      }
      return i;
    } else {
      var g = xt.backend_util.mergeRealAndImagArrays(o, s), x = DLe(g, n, t);
      return xt.backend_util.splitRealAndImagArrays(x);
    }
  }
  function ELe(e) {
    return (e & e - 1) === 0;
  }
  function l6(e, t, r, n, a) {
    if (r === 1) return { real: e, imag: t };
    var o = xt.backend_util.mergeRealAndImagArrays(e, t), s = r / 2, i = xt.backend_util.complexWithEvenIndex(o), l = i.real, u2 = i.imag, c = [l.length], f = a.makeTensorInfo(c, "float32", l), h = a.makeTensorInfo(c, "float32", u2), p = fh({ inputs: { real: f, imag: h }, backend: a }), d = xt.backend_util.complexWithOddIndex(o), v = d.real, m = d.imag, g = [v.length], x = a.makeTensorInfo(g, "float32", v), b = a.makeTensorInfo(g, "float32", m), y = fh({ inputs: { real: x, imag: b }, backend: a }), w = l6(l, u2, s, n, a), _4 = w.real, k = w.imag, T2 = [_4.length], A2 = a.makeTensorInfo(T2, "float32", _4), S2 = a.makeTensorInfo(T2, "float32", k), C2 = fh({ inputs: { real: A2, imag: S2 }, backend: a }), E2 = l6(v, m, s, n, a), F13 = E2.real, N2 = E2.imag, D2 = [F13.length], I2 = a.makeTensorInfo(D2, "float32", F13), O2 = a.makeTensorInfo(D2, "float32", N2), L2 = fh({ inputs: { real: I2, imag: O2 }, backend: a }), V3 = xt.backend_util.exponents(r, n), W3 = [V3.real.length], X2 = a.makeTensorInfo(W3, "float32", V3.real), Y2 = a.makeTensorInfo(W3, "float32", V3.imag), K2 = fh({ inputs: { real: X2, imag: Y2 }, backend: a }), q = yT({ inputs: { a: K2, b: L2 }, backend: a }), re = V2({ inputs: { a: C2, b: q }, backend: a }), R2 = v6({ inputs: { a: C2, b: q }, backend: a }), z = wg({ inputs: { input: re }, backend: a }), H2 = wg({ inputs: { input: R2 }, backend: a }), te = zy({ inputs: { input: re }, backend: a }), j = zy({ inputs: { input: R2 }, backend: a }), Q2 = By({ inputs: [z, H2], backend: a, attrs: { axis: 0 } }), Z2 = By({ inputs: [te, j], backend: a, attrs: { axis: 0 } }), ne = a.data.get(Q2.dataId).values, ae = a.data.get(Z2.dataId).values;
    return a.disposeIntermediateTensorInfo(f), a.disposeIntermediateTensorInfo(h), a.disposeIntermediateTensorInfo(p), a.disposeIntermediateTensorInfo(x), a.disposeIntermediateTensorInfo(b), a.disposeIntermediateTensorInfo(y), a.disposeIntermediateTensorInfo(A2), a.disposeIntermediateTensorInfo(S2), a.disposeIntermediateTensorInfo(C2), a.disposeIntermediateTensorInfo(I2), a.disposeIntermediateTensorInfo(O2), a.disposeIntermediateTensorInfo(L2), a.disposeIntermediateTensorInfo(X2), a.disposeIntermediateTensorInfo(Y2), a.disposeIntermediateTensorInfo(K2), a.disposeIntermediateTensorInfo(q), a.disposeIntermediateTensorInfo(re), a.disposeIntermediateTensorInfo(R2), a.disposeIntermediateTensorInfo(z), a.disposeIntermediateTensorInfo(te), a.disposeIntermediateTensorInfo(H2), a.disposeIntermediateTensorInfo(j), a.disposeIntermediateTensorInfo(Q2), a.disposeIntermediateTensorInfo(Z2), { real: ne, imag: ae };
  }
  function DLe(e, t, r) {
    for (var n = new Float32Array(t * 2), a = 0; a < t; a++) {
      for (var o = 0, s = 0, i = 0; i < t; i++) {
        var l = xt.backend_util.exponent(a * i, t, r), u2 = xt.backend_util.getComplexWithIndex(e, i);
        o += u2.real * l.real - u2.imag * l.imag, s += u2.real * l.imag + u2.imag * l.real;
      }
      r && (o /= t, s /= t), xt.backend_util.assignToTypedArray(n, o, s, a);
    }
    return n;
  }
  function CLe(e) {
    var t = e.inputs, r = e.backend, n = t.input, a = xt.util.sizeFromShape(n.shape), o = n.shape[n.shape.length - 1], s = a / o, i = Ol({ inputs: { x: n }, backend: r, attrs: { shape: [s, o] } }), l = CH(i, false, r), u2 = Ol({ inputs: { x: l }, backend: r, attrs: { shape: n.shape } });
    return r.disposeIntermediateTensorInfo(i), r.disposeIntermediateTensorInfo(l), u2;
  }
  var MLe = { kernelName: xt.FFT, backendName: "cpu", kernelFunc: CLe };
  function x6(e) {
    var t = e.backend, r = e.attrs, n = r.shape, a = r.value, o = r.dtype, s = o || xt.util.inferDtype(a), i = xt.util.getArrayFromDType(s, xt.util.sizeFromShape(n));
    return NLe(i, a, s), t.makeTensorInfo(n, s, i);
  }
  var ILe = { kernelName: xt.Fill, backendName: "cpu", kernelFunc: x6 };
  function NLe(e, t, r) {
    e.fill(t);
  }
  var FLe = { kernelName: xt.FlipLeftRight, backendName: "cpu", kernelFunc: function(e) {
    var t = e.inputs;
    e.attrs;
    for (var r = e.backend, n = t.image, a = r, o = xt.util.getTypedArrayFromDType(n.dtype, xt.util.sizeFromShape(n.shape)), s = zi(n.shape, 4), i = s[0], l = s[1], u2 = s[2], c = s[3], f = a.data.get(n.dataId).values, h = 0; h < i; h++) for (var p = h * u2 * l * c, d = 0; d < l; d++) for (var v = d * (u2 * c), m = 0; m < u2; m++) for (var g = m * c, x = 0; x < c; x++) {
      var b = Math.round(u2 - m - 1), y = p + v + g + x, w = f[y];
      if (b >= 0 && b < u2) {
        var _4 = b * c, k = p + v + _4 + x;
        w = f[k];
      }
      o[y] = w;
    }
    var T2 = a.write(o, n.shape, n.dtype);
    return { dataId: T2, shape: n.shape, dtype: n.dtype };
  } };
  var OLe = Iu(function(e, t) {
    return Math.floor(e / t);
  }), PLe = hc(xt.FloorDiv, OLe, null, "int32"), LLe = { kernelName: xt.FloorDiv, backendName: "cpu", kernelFunc: PLe };
  function RLe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = t.filter, s = t.bias, i = t.preluActivationWeights, l = n.strides, u2 = n.pad, c = n.dataFormat, f = n.dilations, h = n.dimRoundingMode, p = n.activation, d = n.leakyreluAlpha, v = EH({ inputs: { x: a, filter: o }, backend: r, attrs: { strides: l, pad: u2, dataFormat: c, dilations: f, dimRoundingMode: h } });
    if (s) {
      var m = v;
      v = V2({ inputs: { a: v, b: s }, backend: r }), r.disposeIntermediateTensorInfo(m);
    }
    if (p) {
      var m = v;
      v = m6(r, v, p, i, d), r.disposeIntermediateTensorInfo(m);
    }
    return v;
  }
  var zLe = { kernelName: xt.FusedConv2D, backendName: "cpu", kernelFunc: RLe };
  function BLe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = t.filter, s = t.bias, i = t.preluActivationWeights, l = n.strides, u2 = n.pad, c = n.dataFormat, f = n.dilations, h = n.dimRoundingMode, p = n.activation, d = n.leakyreluAlpha, v = DH({ inputs: { x: a, filter: o }, backend: r, attrs: { strides: l, pad: u2, dataFormat: c, dilations: f, dimRoundingMode: h } });
    if (s) {
      var m = v;
      v = V2({ inputs: { a: v, b: s }, backend: r }), r.disposeIntermediateTensorInfo(m);
    }
    if (p) {
      var m = v;
      v = m6(r, v, p, i, d), r.disposeIntermediateTensorInfo(m);
    }
    return v;
  }
  var ULe = { kernelName: xt.FusedDepthwiseConv2D, backendName: "cpu", kernelFunc: BLe };
  function VLe(e) {
    var t = e.inputs, r = e.backend, n = t.params, a = t.indices, o = xt.util.sizeFromShape(n.shape), s = a.shape, i = s[s.length - 1], l = zi(xt.backend_util.prepareAndValidate(n, a), 4), u2 = l[0], c = l[1], f = l[2], h = l[3];
    if (c === 0) return r.makeTensorInfo(u2, n.dtype, []);
    var p = r.data.get(a.dataId).values, d = r.bufferSync(n), v = W$(p, d, n.dtype, c, i, f, h, n.shape, o);
    return r.makeTensorInfo(u2, n.dtype, v.values);
  }
  var jLe = { kernelName: xt.GatherNd, backendName: "cpu", kernelFunc: VLe };
  function WLe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = t.indices, s = n.axis, i = n.batchDims;
    pi([a, o], "gatherV2");
    for (var l = xt.util.parseAxisParam(s, a.shape)[0], u2 = r.data.get(o.dataId).values, c = a.shape[l], f = function(_4) {
      var k = u2[_4];
      xt.util.assert(k <= c - 1 && k >= 0, function() {
        return "GatherV2: the index value " + k + " is not in [0, " + (c - 1) + "]";
      });
    }, h = 0; h < u2.length; ++h) f(h);
    var p = i;
    i == null && (p = 0);
    var d = xt.util.sizeFromShape(o.shape), v = xt.backend_util.segment_util.collectGatherOpShapeInfo(a, o, l, p), m = Ol({ inputs: { x: a }, backend: r, attrs: { shape: [v.batchSize, v.outerSize, v.dimSize, v.sliceSize] } }), g = Ol({ inputs: { x: o }, backend: r, attrs: { shape: [v.batchSize, d / v.batchSize] } }), x = [v.batchSize, v.outerSize, d / v.batchSize, v.sliceSize], b = r.bufferSync(g), y = r.bufferSync(m), w = G$(y, b, x);
    return r.disposeIntermediateTensorInfo(m), r.disposeIntermediateTensorInfo(g), r.makeTensorInfo(v.outputShape, w.dtype, w.values);
  }
  var GLe = { kernelName: xt.GatherV2, backendName: "cpu", kernelFunc: WLe };
  function $Le(e) {
    var t = e.inputs, r = e.backend, n = t.input, a = xt.util.sizeFromShape(n.shape), o = n.shape[n.shape.length - 1], s = a / o, i = Ol({ inputs: { x: n }, backend: r, attrs: { shape: [s, o] } }), l = CH(i, true, r), u2 = Ol({ inputs: { x: l }, backend: r, attrs: { shape: n.shape } });
    return r.disposeIntermediateTensorInfo(i), r.disposeIntermediateTensorInfo(l), u2;
  }
  var HLe = { kernelName: xt.IFFT, backendName: "cpu", kernelFunc: $Le };
  var qLe = ks(xt.IsFinite, function(e) {
    return Number.isFinite(e) ? 1 : 0;
  }, "bool"), XLe = { kernelName: xt.IsFinite, backendName: "cpu", kernelFunc: qLe };
  var KLe = ks(xt.IsInf, function(e) {
    return Math.abs(e) === 1 / 0 ? 1 : 0;
  }, "bool"), YLe = { kernelName: xt.IsInf, backendName: "cpu", kernelFunc: KLe };
  var ZLe = ks(xt.IsNan, function(e) {
    return Number.isNaN(e) ? 1 : 0;
  }, "bool"), JLe = { kernelName: xt.IsNan, backendName: "cpu", kernelFunc: ZLe };
  function QLe(e) {
    var t = e.backend, r = e.attrs, n = r.start, a = r.stop, o = r.num, s = K$(n, a, o);
    return t.makeTensorInfo([s.length], "float32", s);
  }
  var eRe = { kernelName: xt.LinSpace, backendName: "cpu", kernelFunc: QLe };
  var tRe = ks(xt.Log1p, function(e) {
    return Math.log1p(e);
  }), rRe = { kernelName: xt.Log1p, backendName: "cpu", kernelFunc: tRe };
  var nRe = Iu(function(e, t) {
    return e && t;
  }), aRe = hc(xt.LogicalAnd, nRe, null, "bool"), iRe = { kernelName: xt.LogicalAnd, backendName: "cpu", kernelFunc: aRe };
  var oRe = ks(xt.LogicalNot, function(e) {
    return e ? 0 : 1;
  }, "bool"), sRe = { kernelName: xt.LogicalNot, backendName: "cpu", kernelFunc: oRe };
  var lRe = Iu(function(e, t) {
    return e || t;
  }), uRe = hc(xt.LogicalOr, lRe, null, "bool"), cRe = { kernelName: xt.LogicalOr, backendName: "cpu", kernelFunc: uRe };
  function fRe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.depthRadius, s = n.bias, i = n.alpha, l = n.beta;
    pi(a, "LRN");
    var u2 = a.shape[3], c = u2 - 1, f = r.data.get(a.dataId).values, h = xt.util.sizeFromShape(a.shape), p = new Float32Array(h);
    function d(x) {
      for (var b = x % u2, y = x - b + Math.max(0, b - o), w = x - b + Math.min(b + o, c), _4 = 0; y <= w; y++) {
        var k = f[y];
        _4 += k * k;
      }
      return _4;
    }
    for (var v = 0; v < h; v++) {
      var m = d(v), g = f[v] * Math.pow(s + i * m, -l);
      p[v] = g;
    }
    return r.makeTensorInfo(a.shape, a.dtype, p);
  }
  var hRe = { kernelName: xt.LRN, backendName: "cpu", kernelFunc: fRe };
  function pRe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = t.y, s = t.dy, i = n.depthRadius, l = n.bias, u2 = n.alpha, c = n.beta;
    pi(s, "LRNGrad");
    for (var f = xt.util.sizeFromShape(s.shape), h = s.shape[3], p = r.data.get(s.dataId).values, d = r.data.get(a.dataId).values, v = r.data.get(o.dataId).values, m = new Float32Array(f), g = f, x = 0; x < g; x++) {
      for (var b = x % h, y = x - b + Math.max(0, b - i), w = x - b + Math.min(h, b + i + 1), _4 = 0, k = y; k < w; k++) _4 += Math.pow(d[k], 2);
      _4 = u2 * _4 + l;
      for (var k = y; k < w; k++) {
        var T2 = -2 * u2 * c * d[k] * v[x] / _4;
        x === k && (T2 += Math.pow(_4, -c)), T2 *= p[x], m[k] += T2;
      }
    }
    return r.makeTensorInfo(s.shape, a.dtype, m);
  }
  var dRe = { kernelName: xt.LRNGrad, backendName: "cpu", kernelFunc: pRe };
  function MH(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.reductionIndices, s = n.keepDims, i = r, l = a.shape, u2 = l.length, c = xt.util.parseAxisParam(o, l), f = c, h = xt.backend_util.getAxesPermutation(f, u2), p = i.data.get(a.dataId).values;
    if (h != null) {
      for (var d = new Array(u2), v = 0; v < d.length; v++) d[v] = l[h[v]];
      p = p6(p, l, a.dtype, h, d), f = xt.backend_util.getInnerMostAxes(f.length, u2), l = d;
    }
    pi(a, "max"), xt.backend_util.assertAxesAreInnerMostDims("max", f, u2);
    var m = zi(xt.backend_util.computeOutAndReduceShapes(l, f), 2), g = m[0], x = m[1], b = xt.util.sizeFromShape(x), y = Z$(p, b, g, a.dtype), w = i.write(y, g, a.dtype), _4 = g;
    if (s) {
      var d = xt.backend_util.expandShapeToKeepDim(g, c);
      _4 = d;
    }
    return { dataId: w, shape: _4, dtype: a.dtype };
  }
  var vRe = { kernelName: xt.Max, backendName: "cpu", kernelFunc: MH };
  function mRe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x;
    pi(a, "maxPool");
    var o = n.filterSize, s = n.strides, i = n.pad, l = n.dimRoundingMode, u2 = 1;
    xt.util.assert(xt.backend_util.eitherStridesOrDilationsAreOne(s, u2), function() {
      return "Error in maxPool: Either strides or dilations must be 1. " + ("Got strides " + s + " and dilations '" + u2 + "'");
    });
    var c = xt.backend_util.computePool2DInfo(a.shape, o, s, u2, i, l), f;
    if (c.filterWidth === 1 && c.filterHeight === 1 && xt.util.arraysEqual(c.inShape, c.outShape)) f = Xd({ inputs: { x: a }, backend: r });
    else {
      var h = r.data.get(a.dataId).values, p = xt.util.computeStrides(a.shape), d = g6(h, a.shape, a.dtype, p, c, "max");
      f = r.makeTensorInfo(c.outShape, a.dtype, d.values);
    }
    return f;
  }
  var gRe = { kernelName: xt.MaxPool, backendName: "cpu", kernelFunc: mRe };
  function yRe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.filterSize, s = n.strides, i = n.pad, l = n.dimRoundingMode, u2 = n.dataFormat;
    pi(a, "maxPool3d");
    var c = xt.backend_util.computePool3DInfo(a.shape, o, s, 1, i, l, u2), f = r.data.get(a.dataId).values, h = SH(f, a.shape, a.dtype, xt.util.computeStrides(a.shape), c, "max");
    return r.makeTensorInfo(h.shape, "float32", h.values);
  }
  var xRe = { kernelName: xt.MaxPool3D, backendName: "cpu", kernelFunc: yRe };
  function bRe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.dy, o = t.input, s = n.filterSize, i = n.strides, l = n.pad, u2 = n.dimRoundingMode;
    pi([a, o], "maxPool3DGrad");
    for (var c = xt.backend_util.computePool3DInfo(o.shape, s, i, 1, l, u2), f = r.bufferSync(o), h = uPe(f, c), p = c.strideDepth, d = c.strideHeight, v = c.strideWidth, m = c.dilationDepth, g = c.dilationHeight, x = c.dilationWidth, b = c.effectiveFilterDepth, y = c.effectiveFilterHeight, w = c.effectiveFilterWidth, _4 = b - 1 - c.padInfo.front, k = w - 1 - c.padInfo.left, T2 = y - 1 - c.padInfo.top, A2 = xt.buffer(o.shape, "float32"), S2 = r.bufferSync(a), C2 = 0; C2 < c.batchSize; ++C2) for (var E2 = 0; E2 < c.inChannels; ++E2) for (var F13 = 0; F13 < c.inDepth; ++F13) for (var N2 = 0; N2 < c.inHeight; ++N2) for (var D2 = 0; D2 < c.inWidth; ++D2) {
      for (var I2 = F13 - _4, O2 = N2 - T2, L2 = D2 - k, V3 = 0, W3 = 0; W3 < b; W3 += m) {
        var X2 = (I2 + W3) / p;
        if (!(X2 < 0 || X2 >= c.outDepth || Math.floor(X2) !== X2)) for (var Y2 = 0; Y2 < y; Y2 += g) {
          var K2 = (O2 + Y2) / d;
          if (!(K2 < 0 || K2 >= c.outHeight || Math.floor(K2) !== K2)) for (var q = 0; q < w; q += x) {
            var re = (L2 + q) / v;
            if (!(re < 0 || re >= c.outWidth || Math.floor(re) !== re)) {
              var R2 = b * y * w - 1 - h.get(C2, X2, K2, re, E2), z = W3 * y * w + Y2 * w + q, H2 = R2 === z ? 1 : 0;
              if (H2 !== 0) {
                var te = S2.get(C2, X2, K2, re, E2);
                V3 += te * H2;
              }
            }
          }
        }
      }
      A2.set(V3, C2, F13, N2, D2, E2);
    }
    return r.makeTensorInfo(A2.shape, A2.dtype, A2.values);
  }
  var _Re = { kernelName: xt.MaxPool3DGrad, backendName: "cpu", kernelFunc: bRe };
  function wRe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.dy, o = t.input, s = t.output, i = o;
    pi([o, s], "maxPoolGrad");
    for (var l = n.filterSize, u2 = n.strides, c = n.pad, f = n.dimRoundingMode, h = xt.backend_util.computePool2DInfo(i.shape, l, u2, 1, c, f), p = r.data.get(i.dataId).values, d = xt.buffer(h.outShape, i.dtype, AH(p, i.shape, i.dtype, h).values), v = h.strideHeight, m = h.strideWidth, g = h.dilationHeight, x = h.dilationWidth, b = h.effectiveFilterHeight, y = h.effectiveFilterWidth, w = y - 1 - h.padInfo.left, _4 = b - 1 - h.padInfo.top, k = xt.buffer(i.shape, "float32"), T2 = r.data.get(a.dataId).values, A2 = xt.buffer(a.shape, "float32", T2), S2 = 0; S2 < h.batchSize; ++S2) for (var C2 = 0; C2 < h.inChannels; ++C2) for (var E2 = 0; E2 < h.inHeight; ++E2) for (var F13 = 0; F13 < h.inWidth; ++F13) {
      for (var N2 = E2 - _4, D2 = F13 - w, I2 = 0, O2 = 0; O2 < b; O2 += g) {
        var L2 = (N2 + O2) / v;
        if (!(L2 < 0 || L2 >= h.outHeight || Math.floor(L2) !== L2)) for (var V3 = 0; V3 < y; V3 += x) {
          var W3 = (D2 + V3) / m;
          if (!(W3 < 0 || W3 >= h.outWidth || Math.floor(W3) !== W3)) {
            var X2 = b * y - 1 - d.get(S2, L2, W3, C2), Y2 = O2 * y + V3, K2 = X2 === Y2 ? 1 : 0;
            if (K2 !== 0) {
              var q = A2.get(S2, L2, W3, C2);
              I2 += q * K2;
            }
          }
        }
      }
      k.set(I2, S2, E2, F13, C2);
    }
    return r.makeTensorInfo(k.shape, k.dtype, k.values);
  }
  var kRe = { kernelName: xt.MaxPoolGrad, backendName: "cpu", kernelFunc: wRe };
  function TRe(e, t, r, n, a) {
    var o = xt.util.computeStrides(t), s = g6(e, t, r, o, a, "max"), i = AH(e, t, r, a, true, n);
    return [s.values, i.values];
  }
  var ARe = { kernelName: xt.MaxPoolWithArgmax, backendName: "cpu", kernelFunc: function(e) {
    var t = e.inputs, r = e.attrs, n = e.backend, a = t.x, o = r.filterSize, s = r.strides, i = r.pad, l = r.includeBatchInIndex, u2 = n;
    pi(a, "MaxPoolWithArgmax");
    var c = u2.data.get(a.dataId).values, f = xt.backend_util.computePool2DInfo(a.shape, o, s, [1, 1], i), h = zi(TRe(c, a.shape, a.dtype, l, f), 2), p = h[0], d = h[1], v = u2.write(p, f.outShape, a.dtype), m = u2.write(d, f.outShape, a.dtype);
    return [{ dataId: v, shape: f.outShape, dtype: a.dtype }, { dataId: m, shape: f.outShape, dtype: "int32" }];
  } };
  function SRe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.axis, s = n.keepDims, i = xt.util.parseAxisParam(o, a.shape), l = xt.backend_util.computeOutAndReduceShapes(a.shape, i), u2 = l[1], c = xt.util.sizeFromShape(u2), f = [], h = r.makeTensorInfo([], "float32", new Float32Array([c]));
    f.push(h);
    var p = Rv({ inputs: { x: a }, backend: r, attrs: { dtype: "float32" } });
    f.push(p);
    var d = y6({ inputs: { a: p, b: h }, backend: r });
    f.push(d);
    var v = j2({ inputs: { x: d }, backend: r, attrs: { axis: o, keepDims: s } });
    return f.forEach(function(m) {
      return r.disposeIntermediateTensorInfo(m);
    }), v;
  }
  var ERe = { kernelName: xt.Mean, backendName: "cpu", kernelFunc: SRe };
  function DRe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.axis, s = n.keepDims;
    pi(a, "min");
    var i = xt.util.parseAxisParam(o, a.shape), l = i, u2 = xt.backend_util.getAxesPermutation(l, a.shape.length), c = a;
    u2 != null && (c = Lh({ inputs: { x: a }, backend: r, attrs: { perm: u2 } }), l = xt.backend_util.getInnerMostAxes(l.length, a.shape.length)), xt.backend_util.assertAxesAreInnerMostDims("min", l, c.shape.length);
    for (var f = zi(xt.backend_util.computeOutAndReduceShapes(c.shape, l), 2), h = f[0], p = f[1], d = xt.util.sizeFromShape(p), v = xt.util.makeZerosTypedArray(xt.util.sizeFromShape(h), c.dtype), m = r.data.get(c.dataId).values, g = 0; g < v.length; ++g) {
      for (var x = g * d, b = m[x], y = 0; y < d; ++y) {
        var w = m[x + y];
        (Number.isNaN(w) || w < b) && (b = w);
      }
      v[g] = b;
    }
    u2 != null && r.disposeIntermediateTensorInfo(c);
    var _4 = r.makeTensorInfo(h, c.dtype, v);
    if (s) {
      var k = xt.backend_util.expandShapeToKeepDim(h, i), T2 = Ol({ inputs: { x: _4 }, backend: r, attrs: { shape: k } });
      return r.disposeIntermediateTensorInfo(_4), T2;
    }
    return _4;
  }
  var CRe = { kernelName: xt.Min, backendName: "cpu", kernelFunc: DRe };
  function MRe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.paddings, s = n.mode;
    pi(a, "mirrorPad");
    for (var i = o.map(function(k, T2) {
      return k[0] + a.shape[T2] + k[1];
    }), l = o.map(function(k) {
      return k[0];
    }), u2 = o.map(function(k, T2) {
      return k[0] + a.shape[T2];
    }), c = s === "reflect" ? 0 : 1, f = r.data.get(a.dataId).values, h = a.shape.length, p = xt.util.computeStrides(a.shape), d = xt.util.sizeFromShape(i), v = i.length, m = xt.util.computeStrides(i), g = xt.util.getTypedArrayFromDType(a.dtype, d), x = 0; x < d; x++) {
      for (var b = xt.util.indexToLoc(x, v, m), y = 0; y < v; y++) b[y] < l[y] ? b[y] = l[y] * 2 - b[y] - c : b[y] >= u2[y] && (b[y] = (u2[y] - 1) * 2 - b[y] + c);
      b = b.map(function(k, T2) {
        return k - l[T2];
      });
      var w = xt.util.locToIndex(b, h, p);
      g[x] = f[w];
    }
    var _4 = r.write(g, i, a.dtype);
    return { dataId: _4, shape: i, dtype: a.dtype };
  }
  var IRe = { kernelName: xt.MirrorPad, backendName: "cpu", kernelFunc: MRe };
  var NRe = Iu(function(e, t) {
    var r = e % t;
    return e < 0 && t < 0 || e >= 0 && t >= 0 ? r : (r + t) % t;
  }), FRe = hc(xt.Mod, NRe), ORe = { kernelName: xt.Mod, backendName: "cpu", kernelFunc: FRe };
  function IH(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.logits, o = n.dim, s = a.shape.length, i = o;
    if (i === -1 && (i = s - 1), i !== s - 1) throw Error("Softmax along a non-last dimension is not yet supported. " + ("Logits was rank " + s + " and dim was " + i));
    var l = xt.util.parseAxisParam([i], a.shape), u2 = MH({ inputs: { x: a }, backend: r, attrs: { reductionIndices: l, keepDims: false } }), c = xt.backend_util.expandShapeToKeepDim(u2.shape, l), f = Ol({ inputs: { x: u2 }, backend: r, attrs: { shape: c } }), h = v6({ inputs: { a, b: f }, backend: r }), p = U$({ inputs: { x: h }, backend: r }), d = j2({ inputs: { x: p }, backend: r, attrs: { axis: l, keepDims: false } }), v = Ol({ inputs: { x: d }, backend: r, attrs: { shape: c } }), m = y6({ inputs: { a: p, b: v }, backend: r });
    return r.disposeIntermediateTensorInfo(u2), r.disposeIntermediateTensorInfo(f), r.disposeIntermediateTensorInfo(h), r.disposeIntermediateTensorInfo(p), r.disposeIntermediateTensorInfo(d), r.disposeIntermediateTensorInfo(v), m;
  }
  var PRe = { kernelName: xt.Softmax, backendName: "cpu", kernelFunc: IH };
  function LRe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.logits, o = n.numSamples, s = n.seed, i = n.normalized;
    pi(a, "multinomial");
    for (var l = i ? a : IH({ inputs: { logits: a }, backend: r, attrs: { dim: -1 } }), u2 = l.shape[0], c = l.shape[1], f = r.data.get(l.dataId).values, h = [u2, o], p = xt.util.makeZerosTypedArray(xt.util.sizeFromShape(h), "int32"), d = 0; d < u2; ++d) {
      var v = d * c, m = new Float32Array(c - 1);
      m[0] = f[v];
      for (var g = 1; g < m.length; ++g) m[g] = m[g - 1] + f[v + g];
      for (var x = T8e.alea(s.toString()), b = d * o, y = 0; y < o; ++y) {
        var w = x();
        p[b + y] = m.length;
        for (var g = 0; g < m.length; g++) if (w < m[g]) {
          p[b + y] = g;
          break;
        }
      }
    }
    return i || r.disposeIntermediateTensorInfo(l), r.makeTensorInfo(h, "int32", p);
  }
  var RRe = { kernelName: xt.Multinomial, backendName: "cpu", kernelFunc: LRe };
  var zRe = xt.kernel_impls.nonMaxSuppressionV3Impl;
  function BRe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.boxes, o = t.scores, s = n.maxOutputSize, i = n.iouThreshold, l = n.scoreThreshold;
    pi(a, "NonMaxSuppression");
    var u2 = r.data.get(a.dataId).values, c = r.data.get(o.dataId).values, f = zRe(u2, c, s, i, l).selectedIndices;
    return r.makeTensorInfo([f.length], "int32", new Int32Array(f));
  }
  var URe = { kernelName: xt.NonMaxSuppressionV3, backendName: "cpu", kernelFunc: BRe };
  var VRe = xt.kernel_impls.nonMaxSuppressionV4Impl;
  function jRe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.boxes, o = t.scores, s = n.maxOutputSize, i = n.iouThreshold, l = n.scoreThreshold, u2 = n.padToMaxOutputSize;
    pi(a, "NonMaxSuppressionPadded");
    var c = r.data.get(a.dataId).values, f = r.data.get(o.dataId).values, h = VRe(c, f, s, i, l, u2), p = h.selectedIndices, d = h.validOutputs;
    return [r.makeTensorInfo([p.length], "int32", new Int32Array(p)), r.makeTensorInfo([], "int32", new Int32Array([d]))];
  }
  var WRe = { kernelName: xt.NonMaxSuppressionV4, backendName: "cpu", kernelFunc: jRe };
  var GRe = xt.kernel_impls.nonMaxSuppressionV5Impl;
  function $Re(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.boxes, o = t.scores, s = n.maxOutputSize, i = n.iouThreshold, l = n.scoreThreshold, u2 = n.softNmsSigma;
    pi(a, "NonMaxSuppressionWithScore");
    var c = r.data.get(a.dataId).values, f = r.data.get(o.dataId).values, h = s, p = i, d = l, v = u2, m = GRe(c, f, h, p, d, v), g = m.selectedIndices, x = m.selectedScores;
    return [r.makeTensorInfo([g.length], "int32", new Int32Array(g)), r.makeTensorInfo([x.length], "float32", new Float32Array(x))];
  }
  var HRe = { kernelName: xt.NonMaxSuppressionV5, backendName: "cpu", kernelFunc: $Re };
  function qRe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.indices, o = n.depth, s = n.onValue, i = n.offValue;
    pi(a, "oneHot");
    var l = xt.util.sizeFromShape(a.shape), u2 = new Float32Array(l * o);
    u2.fill(i);
    for (var c = r.data.get(a.dataId).values, f = 0; f < l; ++f) c[f] >= 0 && c[f] < o && (u2[f * o + c[f]] = s);
    return r.makeTensorInfo(pd(a.shape, [o]), "int32", u2);
  }
  var XRe = { kernelName: xt.OneHot, backendName: "cpu", kernelFunc: qRe };
  function gT(e) {
    var t = e.inputs, r = e.backend, n = t.x;
    if (n.dtype === "string") throw new Error("zerosLike is not supported for string tensors");
    if (n.dtype === "complex64") {
      var a = wg({ inputs: { input: n }, backend: r }), o = gT({ inputs: { x: a }, backend: r }), s = zy({ inputs: { input: n }, backend: r }), i = gT({ inputs: { x: s }, backend: r }), l = fh({ inputs: { real: o, imag: i }, backend: r });
      return r.disposeIntermediateTensorInfo(a), r.disposeIntermediateTensorInfo(o), r.disposeIntermediateTensorInfo(s), r.disposeIntermediateTensorInfo(i), l;
    } else return x6({ backend: r, attrs: { shape: n.shape, value: 0, dtype: n.dtype } });
  }
  var KRe = { kernelName: xt.ZerosLike, backendName: "cpu", kernelFunc: gT };
  function NH(e) {
    var t = e.inputs, r = e.backend, n = t.x;
    if (n.dtype === "string") throw new Error("onesLike is not supported for string tensors");
    if (n.dtype === "complex64") {
      var a = wg({ inputs: { input: n }, backend: r }), o = NH({ inputs: { x: a }, backend: r }), s = zy({ inputs: { input: n }, backend: r }), i = gT({ inputs: { x: s }, backend: r }), l = fh({ inputs: { real: o, imag: i }, backend: r });
      return r.disposeIntermediateTensorInfo(a), r.disposeIntermediateTensorInfo(o), r.disposeIntermediateTensorInfo(s), r.disposeIntermediateTensorInfo(i), l;
    } else return x6({ backend: r, attrs: { shape: n.shape, value: 1, dtype: n.dtype } });
  }
  var YRe = { kernelName: xt.OnesLike, backendName: "cpu", kernelFunc: NH };
  function FH(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = n.axis;
    if (t.length === 1) return mT({ inputs: { input: t[0] }, backend: r, attrs: { dim: a } });
    var o = t[0].shape, s = t[0].dtype;
    t.forEach(function(c) {
      xt.util.assertShapesMatch(o, c.shape, "All tensors passed to stack must have matching shapes"), xt.util.assert(s === c.dtype, function() {
        return "All tensors passed to stack must have matching dtypes";
      });
    });
    var i = [], l = t.map(function(c) {
      var f = mT({ inputs: { input: c }, backend: r, attrs: { dim: a } });
      return i.push(f), f;
    }), u2 = By({ inputs: l, backend: r, attrs: { axis: a } });
    return i.forEach(function(c) {
      return r.disposeIntermediateTensorInfo(c);
    }), u2;
  }
  var ZRe = { kernelName: xt.Pack, backendName: "cpu", kernelFunc: FH };
  function JRe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.paddings, s = n.constantValue;
    pi(a, "pad");
    var i = o.map(function(_4, k) {
      return _4[0] + a.shape[k] + _4[1];
    }), l = o.map(function(_4) {
      return _4[0];
    }), u2 = r.data.get(a.dataId).values, c = xt.util.sizeFromShape(a.shape), f = a.shape.length, h = xt.util.computeStrides(a.shape), p = xt.util.sizeFromShape(i), d = i.length, v = xt.util.computeStrides(i), m = xt.util.getTypedArrayFromDType(a.dtype, p);
    s !== 0 && m.fill(s);
    for (var g = 0; g < c; g++) {
      var x = xt.util.indexToLoc(g, f, h), b = x.map(function(_4, k) {
        return _4 + l[k];
      }), y = xt.util.locToIndex(b, d, v);
      m[y] = u2[g];
    }
    var w = r.write(m, i, a.dtype);
    return { dataId: w, shape: i, dtype: a.dtype };
  }
  var OH = { kernelName: xt.PadV2, backendName: "cpu", kernelFunc: JRe };
  var QRe = Iu(function(e, t) {
    return Math.pow(e, t);
  }), e7e = hc(xt.Pow, QRe), t7e = { kernelName: xt.Pow, backendName: "cpu", kernelFunc: e7e };
  function r7e(e) {
    var t = e.backend, r = e.attrs, n = r.start, a = r.stop, o = r.dtype, s = r.step, i = nH(n, a, s, o);
    return t.makeTensorInfo([i.length], o, i);
  }
  var n7e = { kernelName: xt.Range, backendName: "cpu", kernelFunc: r7e };
  var a7e = ks(xt.Reciprocal, function(e) {
    return 1 / e;
  }), i7e = { kernelName: xt.Reciprocal, backendName: "cpu", kernelFunc: a7e };
  function o7e(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.images, o = n.alignCorners, s = n.halfPixelCenters, i = n.size;
    pi(a, "resizeBilinear");
    for (var l = xt.util.computeStrides(a.shape), u2 = zi(i, 2), c = u2[0], f = u2[1], h = zi(a.shape, 4), p = h[0], d = h[1], v = h[2], m = h[3], g = r.data.get(a.dataId).values, x = new Float32Array(xt.util.sizeFromShape([p, c, f, m])), b = [o && c > 1 ? d - 1 : d, o && f > 1 ? v - 1 : v], y = [o && c > 1 ? c - 1 : c, o && f > 1 ? f - 1 : f], w = 0, _4 = b[0] / y[0], k = b[1] / y[1], T2 = 0; T2 < p; T2++) for (var A2 = 0; A2 < c; A2++) {
      var S2 = void 0;
      s ? S2 = _4 * (A2 + 0.5) - 0.5 : S2 = _4 * A2;
      for (var C2 = Math.max(0, Math.floor(S2)), E2 = S2 - C2, F13 = Math.min(d - 1, Math.ceil(S2)), N2 = T2 * l[0] + C2 * l[1], D2 = T2 * l[0] + F13 * l[1], I2 = 0; I2 < f; I2++) {
        var O2 = void 0;
        s ? O2 = k * (I2 + 0.5) - 0.5 : O2 = k * I2;
        for (var L2 = Math.max(0, Math.floor(O2)), V3 = O2 - L2, W3 = Math.min(v - 1, Math.ceil(O2)), X2 = N2 + L2 * l[2], Y2 = D2 + L2 * l[2], K2 = N2 + W3 * l[2], q = D2 + W3 * l[2], re = 0; re < m; re++) {
          var R2 = g[X2 + re], z = g[Y2 + re], H2 = g[K2 + re], te = g[q + re], j = R2 + (H2 - R2) * V3, Q2 = z + (te - z) * V3, Z2 = j + (Q2 - j) * E2;
          x[w++] = Z2;
        }
      }
    }
    return r.makeTensorInfo([p, c, f, m], "float32", x);
  }
  var s7e = { kernelName: xt.ResizeBilinear, backendName: "cpu", kernelFunc: o7e };
  function l7e(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.images, o = t.dy, s = n.alignCorners;
    pi([o, a], "resizeBilinearGrad");
    for (var i = xt.util.computeStrides(a.shape), l = zi(a.shape, 4), u2 = l[0], c = l[1], f = l[2], h = l[3], p = zi(o.shape, 3), d = p[1], v = p[2], m = new Float32Array(u2 * c * f * h), g = [s && d > 1 ? c - 1 : c, s && v > 1 ? f - 1 : f], x = [s && d > 1 ? d - 1 : d, s && v > 1 ? v - 1 : v], b = g[0] / x[0], y = g[1] / x[1], w = r.data.get(o.dataId).values, _4 = 0, k = 0; k < u2; k++) for (var T2 = k * i[0], A2 = 0; A2 < d; A2++) for (var S2 = A2 * b, C2 = Math.floor(S2), E2 = Math.min(Math.ceil(S2), c - 1), F13 = T2 + C2 * i[1], N2 = T2 + E2 * i[1], D2 = S2 - C2, I2 = 1 - D2, O2 = 0; O2 < v; O2++) for (var L2 = O2 * y, V3 = Math.floor(L2), W3 = Math.min(Math.ceil(L2), f - 1), X2 = L2 - V3, Y2 = 1 - X2, K2 = F13 + V3 * i[2], q = F13 + W3 * i[2], re = N2 + V3 * i[2], R2 = N2 + W3 * i[2], z = I2 * Y2, H2 = I2 * X2, te = D2 * Y2, j = D2 * X2, Q2 = 0; Q2 < h; Q2++) {
      var Z2 = w[_4++];
      m[K2 + Q2] += Z2 * z, m[q + Q2] += Z2 * H2, m[re + Q2] += Z2 * te, m[R2 + Q2] += Z2 * j;
    }
    return r.makeTensorInfo([u2, f, c, h], "float32", m);
  }
  var u7e = { kernelName: xt.ResizeBilinearGrad, backendName: "cpu", kernelFunc: l7e };
  function c7e(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.images, o = n.alignCorners, s = n.halfPixelCenters, i = n.size;
    pi(a, "resizeNearestNeighbor");
    for (var l = xt.util.computeStrides(a.shape), u2 = zi(i, 2), c = u2[0], f = u2[1], h = zi(a.shape, 4), p = h[0], d = h[1], v = h[2], m = h[3], g = r.data.get(a.dataId).values, x = new Float32Array(p * c * f * m), b = [o && c > 1 ? d - 1 : d, o && f > 1 ? v - 1 : v], y = [o && c > 1 ? c - 1 : c, o && f > 1 ? f - 1 : f], w = b[0] / y[0], _4 = b[1] / y[1], k = 0, T2 = 0; T2 < p; T2++) for (var A2 = T2 * l[0], S2 = 0; S2 < c; S2++) {
      var C2 = s ? w * (S2 + 0.5) : w * S2, E2 = Math.min(d - 1, o ? Math.round(C2) : Math.floor(C2));
      s && (E2 = Math.max(0, E2));
      for (var F13 = A2 + E2 * l[1], N2 = 0; N2 < f; N2++) {
        var D2 = s ? _4 * (N2 + 0.5) : _4 * N2, I2 = Math.min(v - 1, o ? Math.round(D2) : Math.floor(D2));
        s && (I2 = Math.max(0, I2));
        for (var O2 = F13 + I2 * l[2], L2 = 0; L2 < m; L2++) {
          var V3 = g[O2 + L2];
          x[k++] = V3;
        }
      }
    }
    return r.makeTensorInfo([p, c, f, m], a.dtype, x);
  }
  var f7e = { kernelName: xt.ResizeNearestNeighbor, backendName: "cpu", kernelFunc: c7e };
  function h7e(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.images, o = t.dy, s = n.alignCorners;
    pi([o, a], "resizeNearestNeighborGrad");
    for (var i = xt.util.computeStrides(a.shape), l = xt.util.computeStrides(o.shape), u2 = zi(a.shape, 4), c = u2[0], f = u2[1], h = u2[2], p = u2[3], d = zi(o.shape, 3), v = d[1], m = d[2], g = new Float32Array(c * f * h * p), x = r.data.get(o.dataId).values, b = [s && v > 1 ? f - 1 : f, s && m > 1 ? h - 1 : h], y = [s && v > 1 ? v - 1 : v, s && m > 1 ? m - 1 : m], w = b[0] / y[0], _4 = b[1] / y[1], k = 1 / w, T2 = 1 / _4, A2 = Math.ceil(k) * 2 + 2, S2 = Math.ceil(T2) * 2 + 2, C2 = 0; C2 < c; C2++) for (var E2 = C2 * i[0], F13 = 0; F13 < f; F13++) for (var N2 = E2 + F13 * i[1], D2 = Math.floor(F13 * k), I2 = Math.floor(D2 - A2 / 2), O2 = 0; O2 < h; O2++) for (var L2 = N2 + O2 * i[2], V3 = Math.floor(O2 * T2), W3 = Math.floor(V3 - S2 / 2), X2 = 0; X2 < p; X2++) {
      for (var Y2 = 0, K2 = 0; K2 < A2; K2++) {
        var q = K2 + I2;
        if (!(q < 0 || q >= v)) {
          var re = E2 + q * l[1], R2 = q * w, z = Math.min(f - 1, s ? Math.round(R2) : Math.floor(R2));
          if (F13 === z) for (var H2 = 0; H2 < S2; H2++) {
            var te = H2 + W3;
            if (!(te < 0 || te >= m)) {
              var j = re + te * l[2], Q2 = te * _4, Z2 = Math.min(h - 1, s ? Math.round(Q2) : Math.floor(Q2));
              O2 === Z2 && (Y2 += x[j + X2]);
            }
          }
        }
      }
      g[L2 + X2] = Y2;
    }
    return r.makeTensorInfo(a.shape, a.dtype, g);
  }
  var p7e = { kernelName: xt.ResizeNearestNeighborGrad, backendName: "cpu", kernelFunc: h7e };
  function d7e(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.dims;
    pi(a, "reverse");
    var s = a.shape.length, i = xt.util.parseAxisParam(o, a.shape);
    if (s === 0) return Xd({ inputs: { x: a }, backend: r });
    for (var l = new xt.TensorBuffer(a.shape, a.dtype), u2 = r.bufferSync(a), c = function(h) {
      var p = l.indexToLoc(h), d = p.slice();
      i.forEach(function(v) {
        return d[v] = a.shape[v] - 1 - d[v];
      }), l.set.apply(l, pd([u2.get.apply(u2, pd(d))], p));
    }, f = 0; f < l.size; f++) c(f);
    return r.makeTensorInfo(l.shape, l.dtype, l.values);
  }
  var v7e = { kernelName: xt.Reverse, backendName: "cpu", kernelFunc: d7e }, m7e = { kernelName: xt.RotateWithOffset, backendName: "cpu", kernelFunc: function(e) {
    for (var t = e.inputs, r = e.attrs, n = e.backend, a = t.image, o = r.radians, s = r.fillValue, i = r.center, l = n, u2 = xt.util.getTypedArrayFromDType(a.dtype, xt.util.sizeFromShape(a.shape)), c = zi(a.shape, 4), f = c[0], h = c[1], p = c[2], d = c[3], v = zi(xt.backend_util.getImageCenter(i, h, p), 2), m = v[0], g = v[1], x = 255, b = Math.sin(o), y = Math.cos(o), w = l.data.get(a.dataId).values, _4 = 0; _4 < f; _4++) for (var k = _4 * p * h * d, T2 = 0; T2 < h; T2++) for (var A2 = T2 * (p * d), S2 = 0; S2 < p; S2++) for (var C2 = S2 * d, E2 = 0; E2 < d; E2++) {
      var F13 = [f, T2, S2, E2], N2 = F13[2], D2 = F13[1], I2 = (N2 - m) * y - (D2 - g) * b, O2 = (N2 - m) * b + (D2 - g) * y;
      I2 = Math.round(I2 + m), O2 = Math.round(O2 + g);
      var L2 = s;
      if (typeof s != "number" && (E2 === 3 ? L2 = x : L2 = s[E2]), I2 >= 0 && I2 < p && O2 >= 0 && O2 < h) {
        var V3 = O2 * (p * d), W3 = I2 * d, X2 = k + V3 + W3 + E2;
        L2 = w[X2];
      }
      var Y2 = k + A2 + C2 + E2;
      u2[Y2] = L2;
    }
    var K2 = l.write(u2, a.shape, a.dtype);
    return { dataId: K2, shape: a.shape, dtype: a.dtype };
  } };
  var g7e = ks(xt.Round, function(e) {
    var t = Math.floor(e);
    return e - t < 0.5 ? Math.floor(e) : e - t > 0.5 ? Math.ceil(e) : t % 2 === 0 ? t : t + 1;
  }), y7e = { kernelName: xt.Round, backendName: "cpu", kernelFunc: g7e };
  function PH(e, t, r, n, a, o, s, i, l, u2) {
    var c = [n / a, a], f = e.values, h = t.values;
    if (n === 0) return xt.buffer(r, t.dtype);
    var p = xt.buffer(c, t.dtype);
    p.values.fill(l);
    for (var d = 0; d < o; d++) {
      for (var v = [], m = 0, g = 0; g < s; g++) {
        var x = f[d * s + g];
        v.push(x), m += x * i[g];
      }
      if (m < 0 || m >= n / a) throw new Error("Invalid indices: " + v + " does not index into " + r);
      for (var b = 0; b < a; b++) u2 ? p.values[m * a + b] += h[d * a + b] : p.values[m * a + b] = t.rank === 0 ? h[0] : h[d * a + b];
    }
    return p;
  }
  function x7e(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.indices, o = t.updates, s = n.shape, i = xt.backend_util.calculateShapes(o, a, s), l = i.sliceRank, u2 = i.numUpdates, c = i.sliceSize, f = i.strides, h = i.outputSize, p = true, d = r.bufferSync(a), v = r.bufferSync(o), m = PH(d, v, s, h, c, u2, l, f, 0, p);
    return r.makeTensorInfo(s, m.dtype, m.values);
  }
  var b7e = { kernelName: xt.ScatterNd, backendName: "cpu", kernelFunc: x7e };
  function _7e(e) {
    var t = e.inputs, r = e.backend, n = t.condition, a = t.t, o = t.e;
    pi([n, a, o], "select");
    for (var s = n.shape.length, i = r.data.get(n.dataId).values, l = r.data.get(a.dataId).values, u2 = r.data.get(o.dataId).values, c = xt.upcastType(a.dtype, o.dtype), f = xt.util.makeZerosTypedArray(xt.util.sizeFromShape(a.shape), c), h = 0, p = s === 0 || s > 1 || a.shape.length === 1 ? 1 : xt.util.sizeFromShape(a.shape.slice(1)), d = 0; d < i.length; d++) for (var v = 0; v < p; v++) i[d] === 1 ? f[h++] = l[d] : f[h++] = u2[d];
    return r.makeTensorInfo(a.shape, c, f);
  }
  var w7e = { kernelName: xt.Select, backendName: "cpu", kernelFunc: _7e };
  var k7e = xt.backend_util.SELU_SCALEALPHA, T7e = xt.backend_util.SELU_SCALE, A7e = ks(xt.Selu, function(e) {
    return e >= 0 ? T7e * e : k7e * (Math.exp(e) - 1);
  }), S7e = { kernelName: xt.Selu, backendName: "cpu", kernelFunc: A7e };
  var E7e = ks(xt.Sign, function(e) {
    return e < 0 ? -1 : e > 0 ? 1 : 0;
  }), D7e = { kernelName: xt.Sign, backendName: "cpu", kernelFunc: E7e };
  var C7e = ks(xt.Sin, function(e) {
    return Math.sin(e);
  }), M7e = { kernelName: xt.Sin, backendName: "cpu", kernelFunc: C7e };
  var I7e = ks(xt.Sinh, function(e) {
    return Math.sinh(e);
  }), N7e = { kernelName: xt.Sinh, backendName: "cpu", kernelFunc: I7e };
  var F7e = 11920928955078125e-23, D$ = Math.log(F7e) + 2, O7e = ks(xt.Softplus, function(e) {
    var t = e > -D$, r = e < D$, n = Math.exp(e), a;
    return r ? a = n : t ? a = e : a = Math.log(1 + n), a;
  }), P7e = { kernelName: xt.Softplus, backendName: "cpu", kernelFunc: O7e };
  function L7e(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.blockShape, s = n.paddings;
    pi([a], "spaceToBatchND");
    var i = xt.util.sizeFromShape(o), l = [[0, 0]];
    l.push.apply(l, pd(s));
    for (var u2 = 1 + o.length; u2 < a.shape.length; ++u2) l.push([0, 0]);
    var c = OH.kernelFunc({ inputs: { x: a }, backend: r, attrs: { paddings: l, constantValue: 0 } }), f = xt.backend_util.getReshaped(c.shape, o, i, false), h = xt.backend_util.getPermuted(f.length, o.length, false), p = xt.backend_util.getReshapedPermuted(c.shape, o, i, false), d = { x: c }, v = { shape: f }, m = Ol({ inputs: d, backend: r, attrs: v }), g = { x: m }, x = { perm: h }, b = Lh({ inputs: g, backend: r, attrs: x }), y = { x: b }, w = { shape: p }, _4 = Ol({ inputs: y, backend: r, attrs: w });
    return r.disposeIntermediateTensorInfo(c), r.disposeIntermediateTensorInfo(m), r.disposeIntermediateTensorInfo(b), _4;
  }
  var R7e = { kernelName: xt.SpaceToBatchND, backendName: "cpu", kernelFunc: L7e };
  function z7e(e) {
    var t = e.inputs, r = e.backend, n = t.indices, a = t.values, o = t.denseShape, s = t.defaultValue;
    if (o.shape.length !== 1) throw new Error(`Dense shape must be a vector, saw:
        ` + o.shape);
    if (n.shape.length !== 2) throw new Error(`Indices must be a matrix, saw:
        ` + n.shape);
    if (a.shape.length !== 1) throw new Error(`Values must be a vector, saw:
        ` + a.shape);
    if (s.shape.length !== 0) throw new Error(`Default value must be a scalar, saw:
        ` + s.shape);
    var i = r.data.get(n.dataId).values, l = r.data.get(a.dataId).values, u2 = r.data.get(o.dataId).values, c = r.data.get(s.dataId).values[0], f = zi(sH(i, n.shape, n.dtype, l, a.dtype, u2, c), 5), h = f[0], p = f[1], d = f[2], v = f[3], m = f[4];
    return [r.makeTensorInfo(p, n.dtype, h), r.makeTensorInfo([p[0]], a.dtype, d), r.makeTensorInfo([v.length], "bool", new Uint8Array(v.map(function(g) {
      return Number(g);
    }))), r.makeTensorInfo([m.length], n.dtype, new Int32Array(m))];
  }
  var B7e = { kernelName: xt.SparseFillEmptyRows, backendName: "cpu", kernelFunc: z7e };
  function U7e(e) {
    var t = e.inputs, r = e.backend, n = t.inputIndices, a = t.inputShape, o = t.newShape;
    if (n.shape.length !== 2) throw new Error(`Input indices should be a matrix but received shape
        ` + n.shape);
    if (a.shape.length !== 1) throw new Error(`Input shape should be a vector but received shape
        ` + a.shape);
    if (o.shape.length !== 1) throw new Error("Target shape should be a vector but received shape " + o.shape);
    var s = Array.from(r.data.get(a.dataId).values), i = r.data.get(n.dataId).values, l = Array.from(r.data.get(o.dataId).values), u2 = zi(lH(i, n.shape, n.dtype, s, l), 3), c = u2[0], f = u2[1], h = u2[2];
    return [r.makeTensorInfo(f, n.dtype, c), r.makeTensorInfo([h.length], o.dtype, new Int32Array(h))];
  }
  var V7e = { kernelName: xt.SparseReshape, backendName: "cpu", kernelFunc: U7e };
  function j7e(e) {
    var t = e.inputs, r = e.backend, n = t.data, a = t.indices, o = t.segmentIds;
    if (n.shape.length < 1) throw new Error("Data should be at least 1 dimensional but received scalar");
    if (a.shape.length !== 1) throw new Error(`Indices should be a vector but received shape
          ` + a.shape);
    if (o.shape.length !== 1) throw new Error(`Segment ids should be a vector but received shape
          ` + o.shape);
    if (a.shape[0] !== o.shape[0]) throw new Error("segmentIds and indices should have same size.");
    var s = r.data.get(n.dataId).values, i = r.data.get(a.dataId).values, l = r.data.get(o.dataId).values, u2 = zi(d6(s, n.shape, n.dtype, i, l, true), 2), c = u2[0], f = u2[1];
    return r.makeTensorInfo(f, n.dtype, c);
  }
  var W7e = { kernelName: xt.SparseSegmentMean, backendName: "cpu", kernelFunc: j7e };
  function G7e(e) {
    var t = e.inputs, r = e.backend, n = t.data, a = t.indices, o = t.segmentIds;
    if (n.shape.length < 1) throw new Error("Data should be at least 1 dimensional but received scalar");
    if (a.shape.length !== 1) throw new Error(`Indices should be a vector but received shape
         ` + a.shape);
    if (o.shape.length !== 1) throw new Error(`Segment ids should be a vector but received shape
         ` + o.shape);
    if (a.shape[0] !== o.shape[0]) throw new Error("segmentIds and indices should have same size.");
    var s = r.data.get(n.dataId).values, i = r.data.get(a.dataId).values, l = r.data.get(o.dataId).values, u2 = zi(d6(s, n.shape, n.dtype, i, l), 2), c = u2[0], f = u2[1];
    return r.makeTensorInfo(f, n.dtype, c);
  }
  var $7e = { kernelName: xt.SparseSegmentSum, backendName: "cpu", kernelFunc: G7e };
  function H7e(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.sparseIndices, o = t.sparseValues, s = t.defaultValue, i = n.outputShape, l = xt.backend_util.calculateShapes(o, a, i), u2 = l.sliceRank, c = l.numUpdates, f = l.sliceSize, h = l.strides, p = l.outputSize, d = false, v = r.bufferSync(a), m = r.bufferSync(o), g = r.data.get(s.dataId).values[0], x = PH(v, m, i, p, f, c, u2, h, g, d);
    return r.makeTensorInfo(i, x.dtype, x.values);
  }
  var q7e = { kernelName: xt.SparseToDense, backendName: "cpu", kernelFunc: H7e };
  function X7e(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.numOrSizeSplits, s = n.axis, i = xt.util.parseAxisParam(s, a.shape)[0], l = xt.backend_util.prepareSplitSize(a, o, i), u2 = new Array(a.shape.length).fill(0), c = a.shape.slice();
    return l.map(function(f) {
      var h = pd(c);
      h[i] = f;
      var p = kg({ inputs: { x: a }, backend: r, attrs: { begin: u2, size: h } });
      return u2[i] += f, p;
    });
  }
  var K7e = { kernelName: xt.SplitV, backendName: "cpu", kernelFunc: X7e };
  var Y7e = { kernelName: xt.Square, backendName: "cpu", kernelFunc: function(e) {
    var t = e.inputs, r = e.backend, n = t.x, a = r;
    pi(n, "square");
    for (var o = a.data.get(n.dataId).values, s = new Float32Array(o.length), i = 0; i < o.length; ++i) {
      var l = o[i];
      s[i] = l * l;
    }
    var u2 = a.write(s, n.shape, n.dtype);
    return { dataId: u2, shape: n.shape, dtype: n.dtype };
  } };
  var Z7e = ks(xt.Step, function(e, t) {
    var r = t;
    return isNaN(e) ? NaN : e > 0 ? 1 : r.alpha;
  }), J7e = { kernelName: xt.Step, backendName: "cpu", kernelFunc: Z7e };
  function Q7e(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.begin, s = n.end, i = n.strides, l = n.beginMask, u2 = n.endMask, c = n.ellipsisMask, f = n.newAxisMask, h = n.shrinkAxisMask;
    pi(a, "stridedSlice");
    var p = xt.slice_util.sliceInfo(a.shape, o, s, i, l, u2, c, f, h), d = p.finalShapeSparse, v = p.finalShape, m = p.isIdentity, g = p.sliceDim0, x = p.isSimpleSlice, b = p.begin, y = p.end, w = p.strides, _4;
    if (m) _4 = Ol({ inputs: { x: a }, backend: r, attrs: { shape: v } });
    else if (g || x) {
      xt.util.assert(a.shape.length >= 1, function() {
        return "Input must have rank at least 1, got: " + a.shape.length;
      });
      var k = xt.slice_util.computeOutShape(b, y, w), T2 = kg({ inputs: { x: a }, backend: r, attrs: { begin: b, size: k } });
      _4 = Ol({ inputs: { x: T2 }, backend: r, attrs: { shape: v } }), r.disposeIntermediateTensorInfo(T2);
    } else {
      var A2 = r.bufferSync(a), S2 = cH(d, A2, w, b);
      _4 = r.makeTensorInfo(v, S2.dtype, S2.values);
    }
    return _4;
  }
  var e9e = { kernelName: xt.StridedSlice, backendName: "cpu", kernelFunc: Q7e };
  function t9e(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = n.separator, o = n.nGramWidths, s = n.leftPad, i = n.rightPad, l = n.padWidth, u2 = n.preserveShortSequences, c = t.data, f = t.dataSplits, h = r.data.get(c.dataId).values, p = r.data.get(f.dataId).values, d = zi(fH(h, p, a, o, s, i, l, u2), 2), v = d[0], m = d[1];
    return [r.makeTensorInfo([v.length], "string", v), r.makeTensorInfo(f.shape, "int32", m)];
  }
  var r9e = { kernelName: xt.StringNGrams, backendName: "cpu", kernelFunc: t9e };
  function n9e(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = n.skipEmpty, o = t.input, s = t.delimiter;
    if (o.dtype !== "string") throw new Error("Input must be of datatype string");
    if (o.shape.length !== 1) throw new Error("Input must be a vector, got shape: " + o.shape);
    if (s.shape.length !== 0) throw new Error("Delimiter must be a scalar, got shape: " + s.shape);
    var i = r.data.get(o.dataId).values, l = r.data.get(s.dataId).values[0], u2 = zi(hH(i, l, a), 3), c = u2[0], f = u2[1], h = u2[2], p = f.length;
    return [r.makeTensorInfo([p, 2], "int32", c), r.makeTensorInfo([p], "string", f), r.makeTensorInfo([2], "int32", new Int32Array(h))];
  }
  var a9e = { kernelName: xt.StringSplit, backendName: "cpu", kernelFunc: n9e };
  function i9e(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = n.numBuckets, o = t.input;
    if (o.dtype !== "string") throw new Error("Input must be of datatype string");
    if (a <= 0) throw new Error("Number of buckets must be at least 1");
    var s = r.data.get(o.dataId).values, i = pH(s, a);
    return r.makeTensorInfo(o.shape, "int32", i);
  }
  var o9e = { kernelName: xt.StringToHashBucketFast, backendName: "cpu", kernelFunc: i9e };
  var s9e = ks(xt.Tan, function(e) {
    return Math.tan(e);
  }), l9e = { kernelName: xt.Tan, backendName: "cpu", kernelFunc: s9e };
  var u9e = ks(xt.Tanh, function(e) {
    return Math.tanh(e);
  }), c9e = { kernelName: xt.Tanh, backendName: "cpu", kernelFunc: u9e };
  function f9e(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.reps;
    pi(a, "tile");
    var s = vH(r.bufferSync(a), o);
    return r.makeTensorInfo(s.shape, s.dtype, s.values);
  }
  var h9e = { kernelName: xt.Tile, backendName: "cpu", kernelFunc: f9e };
  function p9e(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.k, s = n.sorted;
    pi(a, "topk");
    var i = r.data.get(a.dataId).values, l = zi(gH(i, a.shape, a.dtype, o, s), 2), u2 = l[0], c = l[1];
    return [r.makeTensorInfo(u2.shape, u2.dtype, u2.values), r.makeTensorInfo(c.shape, c.dtype, c.values)];
  }
  var d9e = { kernelName: xt.TopK, backendName: "cpu", kernelFunc: p9e };
  function v9e(e) {
    var t = e.inputs, r = e.attrs, n = e.backend, a = t.image, o = t.transforms, s = r.interpolation, i = r.fillMode, l = r.fillValue, u2 = r.outputShape, c = zi(a.shape, 4), f = c[0], h = c[1], p = c[2], d = c[3], v = zi(u2 ?? [h, p], 2), m = v[0], g = v[1], x = [f, m, g, d], b = xt.util.computeStrides(a.shape), y = b[0], w = b[1], _4 = b[2], k = xt.util.getTypedArrayFromDType(a.dtype, xt.util.sizeFromShape(x));
    k.fill(l);
    for (var T2 = n.data.get(a.dataId).values, A2 = n.data.get(o.dataId).values, S2 = 0; S2 < f; ++S2) {
      for (var C2 = o.shape[0] === 1 ? A2 : A2.subarray(S2 * 8, S2 * 8 + 8), E2 = 0; E2 < m; ++E2) for (var F13 = 0; F13 < g; ++F13) for (var N2 = 0; N2 < d; ++N2) {
        var D2 = void 0, I2 = C2[6] * F13 + C2[7] * E2 + 1;
        if (I2 !== 0) {
          var O2 = (C2[0] * F13 + C2[1] * E2 + C2[2]) / I2, L2 = (C2[3] * F13 + C2[4] * E2 + C2[5]) / I2, V3 = C$(O2, p, i), W3 = C$(L2, h, i);
          switch (s) {
            case "nearest":
              D2 = _9e(T2, h, p, y, w, _4, S2, W3, V3, N2, l);
              break;
            case "bilinear":
              D2 = w9e(T2, h, p, y, w, _4, S2, W3, V3, N2, l);
              break;
            default:
              throw new Error("Error in Transform: Expect 'nearest' or " + ("'bilinear', but got " + s));
          }
          var X2 = S2 * y + E2 * w + F13 * _4 + N2;
          k[X2] = D2;
        }
      }
      return n.makeTensorInfo(x, a.dtype, k);
    }
    var Y2 = n.write(k, x, a.dtype);
    return { dataId: Y2, shape: a.shape, dtype: a.dtype };
  }
  var m9e = { kernelName: xt.Transform, backendName: "cpu", kernelFunc: v9e };
  function C$(e, t, r) {
    switch (r) {
      case "reflect":
        return g9e(e, t);
      case "wrap":
        return y9e(e, t);
      case "nearest":
        return b9e(e, t);
      case "constant":
      default:
        return x9e(e);
    }
  }
  function g9e(e, t) {
    var r = e;
    if (r < 0) if (t <= 1) r = 0;
    else {
      var n = 2 * t;
      r < n && (r = n * Math.trunc(-r / n) + r), r = r < -t ? r + n : -r - 1;
    }
    else if (r > t - 1) if (t <= 1) r = 0;
    else {
      var n = 2 * t;
      r -= n * Math.trunc(r / n), r >= t && (r = n - r - 1);
    }
    return xt.util.clamp(0, r, t - 1);
  }
  function y9e(e, t) {
    var r = e;
    if (r < 0) if (t <= 1) r = 0;
    else {
      var n = t - 1;
      r += t * (Math.trunc(-r / n) + 1);
    }
    else if (r > t - 1) if (t <= 1) r = 0;
    else {
      var n = t - 1;
      r -= t * Math.trunc(r / n);
    }
    return xt.util.clamp(0, r, t - 1);
  }
  function x9e(e, t) {
    return e;
  }
  function b9e(e, t) {
    return xt.util.clamp(0, e, t - 1);
  }
  function U2(e, t, r, n, a, o, s, i, l, u2, c) {
    var f = s * n + i * a + l * o + u2;
    return 0 <= i && i < t && 0 <= l && l < r ? e[f] : c;
  }
  function _9e(e, t, r, n, a, o, s, i, l, u2, c) {
    var f = Math.round(i), h = Math.round(l);
    return U2(e, t, r, n, a, o, s, f, h, u2, c);
  }
  function w9e(e, t, r, n, a, o, s, i, l, u2, c) {
    var f = Math.floor(i), h = Math.floor(l), p = f + 1, d = h + 1, v = (d - l) * U2(e, t, r, n, a, o, s, f, h, u2, c) + (l - h) * U2(e, t, r, n, a, o, s, f, d, u2, c), m = (d - l) * U2(e, t, r, n, a, o, s, p, h, u2, c) + (l - h) * U2(e, t, r, n, a, o, s, p, d, u2, c);
    return (p - i) * v + (i - f) * m;
  }
  function k9e(e) {
    var t = e.inputs, r = e.attrs, n = e.backend, a = r.axis, o = t.x;
    pi(o, "unique");
    var s = n.data.get(o.dataId).values, i = yH(s, a, o.shape, o.dtype), l = i.outputValues, u2 = i.outputShape, c = i.indices;
    return [n.makeTensorInfo(u2, o.dtype, l), n.makeTensorInfo([c.length], "int32", c)];
  }
  var T9e = { kernelName: xt.Unique, backendName: "cpu", kernelFunc: k9e };
  function A9e(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.value, o = n.axis;
    o < 0 && (o += a.shape.length);
    for (var s = a.shape.length, i = a.shape[o], l = new Array(s - 1), u2 = 0, c = 0; c < s; c++) c !== o && (l[u2++] = a.shape[c]);
    var f = new Array(s).fill(0), h = a.shape.slice();
    h[o] = 1;
    for (var p = new Array(i), c = 0; c < p.length; c++) {
      f[o] = c;
      var d = kg({ inputs: { x: a }, backend: r, attrs: { begin: f, size: h } });
      p[c] = Ol({ inputs: { x: d }, backend: r, attrs: { shape: l } }), r.disposeIntermediateTensorInfo(d);
    }
    return p;
  }
  var S9e = { kernelName: xt.Unpack, backendName: "cpu", kernelFunc: A9e };
  function E9e(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = t.segmentIds, s = n.numSegments;
    pi(a, "unsortedSegmentSum");
    for (var i = a.shape.length, l = o.shape.length, u2 = [], c = [], f = i - l, h = o, p = 0; p < f; ++p) {
      var d = mT({ inputs: { input: h }, backend: r, attrs: { dim: p + 1 } });
      h = d, c.push(d);
    }
    for (var p = 0; p < s; ++p) {
      var v = xt.util.createScalarValue(p, "int32"), m = r.makeTensorInfo([], "int32", v), g = z$({ inputs: { a: m, b: h }, backend: r }), x = Rv({ inputs: { x: g }, backend: r, attrs: { dtype: "float32" } }), b = yT({ inputs: { a: x, b: a }, backend: r }), y = j2({ inputs: { x: b }, backend: r, attrs: { axis: 0, keepDims: false } });
      u2.push(y), c.push(m), c.push(g), c.push(x), c.push(b), c.push(y);
    }
    var w = FH({ inputs: u2, backend: r, attrs: { axis: 0 } });
    return c.forEach(function(_4) {
      return r.disposeIntermediateTensorInfo(_4);
    }), w;
  }
  var D9e = { kernelName: xt.UnsortedSegmentSum, backendName: "cpu", kernelFunc: E9e }, i6, M$, C9e = [ROe, D8e, BOe, VOe, O8e, WOe, $Oe, qOe, KOe, ZOe, QOe, tPe, nPe, oPe, lPe, fPe, pPe, vPe, gPe, POe, xPe, _Pe, kPe, APe, N8e, L8e, EPe, C8e, CPe, IPe, NPe, OPe, LPe, zPe, UPe, jPe, GPe, HPe, XPe, YPe, JPe, eLe, tLe, nLe, iLe, sLe, lLe, uLe, cLe, pLe, DOe, vLe, R8e, kLe, z8e, TLe, U8e, MLe, ILe, FLe, j8e, LLe, zLe, ULe, jLe, GLe, G8e, H8e, M8e, HLe, MPe, XLe, YLe, JLe, COe, X8e, Y8e, eRe, J8e, rRe, iRe, sRe, cRe, hRe, dRe, vRe, eOe, gRe, xRe, _Re, kRe, ARe, ERe, CRe, rOe, IRe, ORe, RRe, aOe, oOe, URe, WRe, HRe, lOe, XRe, YRe, ZRe, OH, t7e, IOe, fOe, n7e, I8e, s6, i7e, NOe, FOe, OOe, s7e, u7e, f7e, p7e, v7e, m7e, y7e, pOe, b7e, w7e, S7e, vOe, D7e, M7e, N7e, mOe, PRe, P7e, R7e, B7e, V7e, W7e, $7e, q7e, K7e, xOe, Y7e, _Oe, J7e, e9e, r9e, a9e, o9e, AOe, fLe, l9e, c9e, h9e, d9e, m9e, uOe, T9e, S9e, D9e, KRe];
  try {
    for (z2 = dT(C9e), Ry = z2.next(); !Ry.done; Ry = z2.next()) I$ = Ry.value, xt.registerKernel(I$);
  } catch (e) {
    i6 = { error: e };
  } finally {
    try {
      Ry && !Ry.done && (M$ = z2.return) && M$.call(z2);
    } finally {
      if (i6) throw i6.error;
    }
  }
  var I$, z2, Ry;
  W2.MathBackendCPU = u6;
  W2.shared = SOe;
  W2.version_cpu = EOe;
});
var LX = ri((Kd) => {
  "use strict";
  Object.defineProperty(Kd, "__esModule", { value: true });
  var gt = Gm();
  function M9e(e) {
    if (e && e.__esModule) return e;
    var t = /* @__PURE__ */ Object.create(null);
    return e && Object.keys(e).forEach(function(r) {
      if (r !== "default") {
        var n = Object.getOwnPropertyDescriptor(e, r);
        Object.defineProperty(t, r, n.get ? n : { enumerable: true, get: function() {
          return e[r];
        } });
      }
    }), t.default = e, t;
  }
  var I9e = M9e(gt);
  var w6 = function(e, t) {
    return w6 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, n) {
      r.__proto__ = n;
    } || function(r, n) {
      for (var a in n) n.hasOwnProperty(a) && (r[a] = n[a]);
    }, w6(e, t);
  };
  function N9e(e, t) {
    w6(e, t);
    function r() {
      this.constructor = e;
    }
    e.prototype = t === null ? Object.create(t) : (r.prototype = t.prototype, new r());
  }
  function kT(e, t, r, n) {
    function a(o) {
      return o instanceof r ? o : new r(function(s) {
        s(o);
      });
    }
    return new (r || (r = Promise))(function(o, s) {
      function i(c) {
        try {
          u2(n.next(c));
        } catch (f) {
          s(f);
        }
      }
      function l(c) {
        try {
          u2(n.throw(c));
        } catch (f) {
          s(f);
        }
      }
      function u2(c) {
        c.done ? o(c.value) : a(c.value).then(i, l);
      }
      u2((n = n.apply(e, t || [])).next());
    });
  }
  function TT(e, t) {
    var r = { label: 0, sent: function() {
      if (o[0] & 1) throw o[1];
      return o[1];
    }, trys: [], ops: [] }, n, a, o, s;
    return s = { next: i(0), throw: i(1), return: i(2) }, typeof Symbol == "function" && (s[Symbol.iterator] = function() {
      return this;
    }), s;
    function i(u2) {
      return function(c) {
        return l([u2, c]);
      };
    }
    function l(u2) {
      if (n) throw new TypeError("Generator is already executing.");
      for (; r; ) try {
        if (n = 1, a && (o = u2[0] & 2 ? a.return : u2[0] ? a.throw || ((o = a.return) && o.call(a), 0) : a.next) && !(o = o.call(a, u2[1])).done) return o;
        switch (a = 0, o && (u2 = [u2[0] & 2, o.value]), u2[0]) {
          case 0:
          case 1:
            o = u2;
            break;
          case 4:
            return r.label++, { value: u2[1], done: false };
          case 5:
            r.label++, a = u2[1], u2 = [0];
            continue;
          case 7:
            u2 = r.ops.pop(), r.trys.pop();
            continue;
          default:
            if (o = r.trys, !(o = o.length > 0 && o[o.length - 1]) && (u2[0] === 6 || u2[0] === 2)) {
              r = 0;
              continue;
            }
            if (u2[0] === 3 && (!o || u2[1] > o[0] && u2[1] < o[3])) {
              r.label = u2[1];
              break;
            }
            if (u2[0] === 6 && r.label < o[1]) {
              r.label = o[1], o = u2;
              break;
            }
            if (o && r.label < o[2]) {
              r.label = o[2], r.ops.push(u2);
              break;
            }
            o[2] && r.ops.pop(), r.trys.pop();
            continue;
        }
        u2 = t.call(e, r);
      } catch (c) {
        u2 = [6, c], a = 0;
      } finally {
        n = o = 0;
      }
      if (u2[0] & 5) throw u2[1];
      return { value: u2[0] ? u2[1] : void 0, done: true };
    }
  }
  function Eg(e) {
    var t = typeof Symbol == "function" && Symbol.iterator, r = t && e[t], n = 0;
    if (r) return r.call(e);
    if (e && typeof e.length == "number") return { next: function() {
      return e && n >= e.length && (e = void 0), { value: e && e[n++], done: !e };
    } };
    throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
  }
  function _i(e, t) {
    var r = typeof Symbol == "function" && e[Symbol.iterator];
    if (!r) return e;
    var n = r.call(e), a, o = [], s;
    try {
      for (; (t === void 0 || t-- > 0) && !(a = n.next()).done; ) o.push(a.value);
    } catch (i) {
      s = { error: i };
    } finally {
      try {
        a && !a.done && (r = n.return) && r.call(n);
      } finally {
        if (s) throw s.error;
      }
    }
    return o;
  }
  function uf() {
    for (var e = [], t = 0; t < arguments.length; t++) e = e.concat(_i(arguments[t]));
    return e;
  }
  var Ag = {}, b6 = { alpha: false, antialias: false, premultipliedAlpha: false, preserveDrawingBuffer: false, depth: false, stencil: false, failIfMajorPerformanceCaveat: true };
  function lq(e, t) {
    Ag[e] = t;
  }
  function dd(e, t) {
    if (!(e in Ag)) {
      var r = O9e(e, t);
      if (r !== null) Ag[e] = r;
      else return console.log("Could not get context for WebGL version", e), null;
    }
    var n = Ag[e];
    return n == null || n.isContextLost() ? (delete Ag[e], dd(e)) : (n.disable(n.DEPTH_TEST), n.disable(n.STENCIL_TEST), n.disable(n.BLEND), n.disable(n.DITHER), n.disable(n.POLYGON_OFFSET_FILL), n.disable(n.SAMPLE_COVERAGE), n.enable(n.SCISSOR_TEST), n.enable(n.CULL_FACE), n.cullFace(n.BACK), Ag[e]);
  }
  function F9e(e) {
    if (typeof OffscreenCanvas < "u" && e === 2) return new OffscreenCanvas(300, 150);
    if (typeof document < "u") return document.createElement("canvas");
    throw new Error("Cannot create a canvas in this context");
  }
  function O9e(e, t) {
    if (e !== 1 && e !== 2) throw new Error("Cannot get WebGL rendering context, WebGL is disabled.");
    var r = t ?? F9e(e);
    return r.addEventListener("webglcontextlost", function(n) {
      n.preventDefault(), delete Ag[e];
    }, false), e === 1 ? r.getContext("webgl", b6) || r.getContext("experimental-webgl", b6) : r.getContext("webgl2", b6);
  }
  var X2;
  (function(e) {
    e[e.DENSE = 0] = "DENSE", e[e.SHARED_BATCH = 1] = "SHARED_BATCH";
  })(X2 || (X2 = {}));
  var Rh;
  (function(e) {
    e[e.RENDER = 0] = "RENDER", e[e.UPLOAD = 1] = "UPLOAD", e[e.PIXELS = 2] = "PIXELS", e[e.DOWNLOAD = 3] = "DOWNLOAD";
  })(Rh || (Rh = {}));
  var Dc;
  (function(e) {
    e[e.UNPACKED_FLOAT16 = 0] = "UNPACKED_FLOAT16", e[e.UNPACKED_FLOAT32 = 1] = "UNPACKED_FLOAT32", e[e.PACKED_4X1_UNSIGNED_BYTE = 2] = "PACKED_4X1_UNSIGNED_BYTE", e[e.PACKED_2X2_FLOAT32 = 3] = "PACKED_2X2_FLOAT32", e[e.PACKED_2X2_FLOAT16 = 4] = "PACKED_2X2_FLOAT16";
  })(Dc || (Dc = {}));
  function Z2(e, t) {
    return [t, e];
  }
  function P9e(e, t) {
    return e * t;
  }
  function xT(e) {
    var t = gt.util.sizeFromShape(e), r = Math.ceil(t / 4);
    return gt.util.sizeToSquarishShape(r);
  }
  function Hy(e, t) {
    return [Math.max(1, Math.ceil(t / 2)), Math.max(1, Math.ceil(e / 2))];
  }
  function L9e(e, t) {
    var r = _i(Hy(e, t), 2), n = r[0], a = r[1];
    return n * a * 4;
  }
  function M6(e, t) {
    var r = e, n, a, o, s, i, l, u2, c, f, h;
    return gt.env().getNumber("WEBGL_VERSION") === 2 ? (n = r.R32F, a = r.R16F, o = r.RGBA16F, s = r.RGBA32F, i = r.RED, u2 = 4, c = 1, f = r.HALF_FLOAT, h = r.FLOAT, l = r.RGBA8) : (n = e.RGBA, a = e.RGBA, o = e.RGBA, s = r.RGBA, i = e.RGBA, u2 = 4, c = 4, f = t != null ? t.HALF_FLOAT_OES : null, h = e.FLOAT, l = e.RGBA), { internalFormatFloat: n, internalFormatHalfFloat: a, internalFormatPackedHalfFloat: o, internalFormatPackedFloat: s, textureFormatFloat: i, downloadTextureFormat: l, downloadUnpackNumChannels: u2, defaultNumChannels: c, textureTypeHalfFloat: f, textureTypeFloat: h };
  }
  function ai(e, t) {
    var r = t();
    return gt.env().getBool("DEBUG") && R9e(e), r;
  }
  function R9e(e) {
    var t = e.getError();
    if (t !== e.NO_ERROR) throw new Error("WebGL Error: " + cq(e, t));
  }
  var z9e = 596e-10, B9e = 65504;
  function uq(e) {
    return !!(gt.env().getBool("WEBGL_RENDER_FLOAT32_ENABLED") || e === 0 || z9e < Math.abs(e) && Math.abs(e) < B9e);
  }
  function cq(e, t) {
    switch (t) {
      case e.NO_ERROR:
        return "NO_ERROR";
      case e.INVALID_ENUM:
        return "INVALID_ENUM";
      case e.INVALID_VALUE:
        return "INVALID_VALUE";
      case e.INVALID_OPERATION:
        return "INVALID_OPERATION";
      case e.INVALID_FRAMEBUFFER_OPERATION:
        return "INVALID_FRAMEBUFFER_OPERATION";
      case e.OUT_OF_MEMORY:
        return "OUT_OF_MEMORY";
      case e.CONTEXT_LOST_WEBGL:
        return "CONTEXT_LOST_WEBGL";
      default:
        return "Unknown error code " + t;
    }
  }
  function $2(e, t) {
    return M0(e, function() {
      return e.getExtension(t);
    }, 'Extension "' + t + '" not supported on this browser.');
  }
  function fq(e, t) {
    var r = M0(e, function() {
      return e.createShader(e.VERTEX_SHADER);
    }, "Unable to create vertex WebGLShader.");
    if (ai(e, function() {
      return e.shaderSource(r, t);
    }), ai(e, function() {
      return e.compileShader(r);
    }), e.getShaderParameter(r, e.COMPILE_STATUS) === false) throw console.log(e.getShaderInfoLog(r)), new Error("Failed to compile vertex shader.");
    return r;
  }
  function hq(e, t) {
    var r = M0(e, function() {
      return e.createShader(e.FRAGMENT_SHADER);
    }, "Unable to create fragment WebGLShader.");
    if (ai(e, function() {
      return e.shaderSource(r, t);
    }), ai(e, function() {
      return e.compileShader(r);
    }), e.getShaderParameter(r, e.COMPILE_STATUS) === false) throw V9e(t, e.getShaderInfoLog(r)), new Error("Failed to compile fragment shader.");
    return r;
  }
  var U9e = /ERROR: [0-9]+:([0-9]+):/g;
  function V9e(e, t) {
    var r = U9e.exec(t);
    if (r == null) {
      console.log("Couldn't parse line number in error: " + t), console.log(e);
      return;
    }
    for (var n = +r[1], a = e.split(`
`), o = a.length.toString().length + 2, s = a.map(function(h, p) {
      return gt.util.rightPad((p + 1).toString(), o) + h;
    }), i = 0, l = 0; l < s.length; l++) i = Math.max(s[l].length, i);
    var u2 = s.slice(0, n - 1), c = s.slice(n - 1, n), f = s.slice(n);
    console.log(u2.join(`
`)), console.log(t.split(`
`)[0]), console.log("%c " + gt.util.rightPad(c[0], i), "border:1px solid red; background-color:#e3d2d2; color:#a61717"), console.log(f.join(`
`));
  }
  function pq(e) {
    return M0(e, function() {
      return e.createProgram();
    }, "Unable to create WebGLProgram.");
  }
  function dq(e, t) {
    if (ai(e, function() {
      return e.linkProgram(t);
    }), e.getProgramParameter(t, e.LINK_STATUS) === false) throw console.log(e.getProgramInfoLog(t)), new Error("Failed to link vertex and fragment shaders.");
  }
  function AT(e, t) {
    if (ai(e, function() {
      return e.validateProgram(t);
    }), e.getProgramParameter(t, e.VALIDATE_STATUS) === false) throw console.log(e.getProgramInfoLog(t)), new Error("Shader program validation failed.");
  }
  function vq(e, t) {
    var r = M0(e, function() {
      return e.createBuffer();
    }, "Unable to create WebGLBuffer");
    return ai(e, function() {
      return e.bindBuffer(e.ARRAY_BUFFER, r);
    }), ai(e, function() {
      return e.bufferData(e.ARRAY_BUFFER, t, e.STATIC_DRAW);
    }), r;
  }
  function mq(e, t) {
    var r = M0(e, function() {
      return e.createBuffer();
    }, "Unable to create WebGLBuffer");
    return ai(e, function() {
      return e.bindBuffer(e.ELEMENT_ARRAY_BUFFER, r);
    }), ai(e, function() {
      return e.bufferData(e.ELEMENT_ARRAY_BUFFER, t, e.STATIC_DRAW);
    }), r;
  }
  function j9e() {
    return gt.env().getNumber("WEBGL_VERSION") === 2 ? 1 : 4;
  }
  function gq(e) {
    return M0(e, function() {
      return e.createTexture();
    }, "Unable to create WebGLTexture.");
  }
  function yq(e, t) {
    var r = gt.env().getNumber("WEBGL_MAX_TEXTURE_SIZE");
    if (e <= 0 || t <= 0) {
      var n = "[" + e + "x" + t + "]";
      throw new Error("Requested texture size " + n + " is invalid.");
    }
    if (e > r || t > r) {
      var n = "[" + e + "x" + t + "]", a = "[" + r + "x" + r + "]";
      throw new Error("Requested texture size " + n + " greater than WebGL maximum on this browser / GPU " + a + ".");
    }
  }
  function xq(e) {
    return M0(e, function() {
      return e.createFramebuffer();
    }, "Unable to create WebGLFramebuffer.");
  }
  function k6(e, t, r, n, a, o, s) {
    var i = e.getAttribLocation(t, r);
    return i === -1 ? false : (ai(e, function() {
      return e.bindBuffer(e.ARRAY_BUFFER, n);
    }), ai(e, function() {
      return e.vertexAttribPointer(i, a, e.FLOAT, false, o, s);
    }), ai(e, function() {
      return e.enableVertexAttribArray(i);
    }), true);
  }
  function bq(e, t, r) {
    Aq(e, r), ai(e, function() {
      return e.activeTexture(e.TEXTURE0 + r);
    }), ai(e, function() {
      return e.bindTexture(e.TEXTURE_2D, t);
    });
  }
  function W9e(e, t) {
    Aq(e, t), ai(e, function() {
      return e.activeTexture(e.TEXTURE0 + t);
    }), ai(e, function() {
      return e.bindTexture(e.TEXTURE_2D, null);
    });
  }
  function _q(e, t, r) {
    return M0(e, function() {
      return e.getUniformLocation(t, r);
    }, 'uniform "' + r + '" not present in program.');
  }
  function wq(e, t, r) {
    return e.getUniformLocation(t, r);
  }
  function kq(e, t, r, n) {
    ai(e, function() {
      return bq(e, t, n);
    }), ai(e, function() {
      return e.uniform1i(r, n);
    });
  }
  function G9e(e) {
    ai(e, function() {
      return e.bindFramebuffer(e.FRAMEBUFFER, null);
    }), ai(e, function() {
      return e.viewport(0, 0, e.canvas.width, e.canvas.height);
    }), ai(e, function() {
      return e.scissor(0, 0, e.canvas.width, e.canvas.height);
    });
  }
  function ST(e, t, r) {
    ai(e, function() {
      return e.bindFramebuffer(e.FRAMEBUFFER, r);
    }), ai(e, function() {
      return e.framebufferTexture2D(e.FRAMEBUFFER, e.COLOR_ATTACHMENT0, e.TEXTURE_2D, t, 0);
    });
  }
  function T6(e, t) {
    ai(e, function() {
      return e.bindFramebuffer(e.FRAMEBUFFER, t);
    }), ai(e, function() {
      return e.framebufferTexture2D(e.FRAMEBUFFER, e.COLOR_ATTACHMENT0, e.TEXTURE_2D, null, 0);
    });
  }
  function H2(e) {
    var t = e.checkFramebufferStatus(e.FRAMEBUFFER);
    if (t !== e.FRAMEBUFFER_COMPLETE) throw new Error("Error binding framebuffer: " + Tq(e, t));
  }
  function Tq(e, t) {
    switch (t) {
      case e.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
        return "FRAMEBUFFER_INCOMPLETE_ATTACHMENT";
      case e.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
        return "FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";
      case e.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
        return "FRAMEBUFFER_INCOMPLETE_DIMENSIONS";
      case e.FRAMEBUFFER_UNSUPPORTED:
        return "FRAMEBUFFER_UNSUPPORTED";
      default:
        return "unknown error " + t;
    }
  }
  function M0(e, t, r) {
    var n = ai(e, function() {
      return t();
    });
    if (n == null) throw new Error(r);
    return n;
  }
  function Aq(e, t) {
    var r = e.MAX_COMBINED_TEXTURE_IMAGE_UNITS - 1, n = t + e.TEXTURE0;
    if (n < e.TEXTURE0 || n > r) {
      var a = "[gl.TEXTURE0, gl.TEXTURE" + r + "]";
      throw new Error("textureUnit must be in " + a + ".");
    }
  }
  function Dg(e, t) {
    return t === void 0 && (t = 2), gt.util.sizeFromShape(e.slice(0, e.length - t));
  }
  function Cg(e) {
    if (e.length === 0) throw Error("Cannot get rows and columns of an empty shape array.");
    return [e.length > 1 ? e[e.length - 2] : 1, e[e.length - 1]];
  }
  function ET(e) {
    var t = [1, 1, 1], r = e.length === 0 || e.length === 1 && e[0] === 1;
    return r || (t = uf([Dg(e)], Cg(e))), t;
  }
  function Sq(e, t) {
    var r;
    t === void 0 && (t = false);
    var n = gt.env().getNumber("WEBGL_MAX_TEXTURE_SIZE");
    if (t && (n = n * 2, e = e.map(function(u2, c) {
      return c >= e.length - 2 ? gt.util.nearestLargerEven(e[c]) : e[c];
    }), e.length === 1 && (e = [2, e[0]])), e.length !== 2) {
      var a = gt.util.squeezeShape(e);
      e = a.newShape;
    }
    var o = gt.util.sizeFromShape(e);
    if (e.length <= 1 && o <= n) return [1, o];
    if (e.length === 2 && e[0] <= n && e[1] <= n) return e;
    if (e.length === 3 && e[0] * e[1] <= n && e[2] <= n) return [e[0] * e[1], e[2]];
    if (e.length === 3 && e[0] <= n && e[1] * e[2] <= n) return [e[0], e[1] * e[2]];
    if (e.length === 4 && e[0] * e[1] * e[2] <= n && e[3] <= n) return [e[0] * e[1] * e[2], e[3]];
    if (e.length === 4 && e[0] <= n && e[1] * e[2] * e[3] <= n) return [e[0], e[1] * e[2] * e[3]];
    if (t) {
      var s = Dg(e), i = 2, l = 2;
      return e.length && (r = _i(Cg(e), 2), i = r[0], l = r[1]), o = s * (i / 2) * (l / 2), gt.util.sizeToSquarishShape(o).map(function(u2) {
        return u2 * 2;
      });
    }
    return gt.util.sizeToSquarishShape(o);
  }
  function bT(e) {
    return e % 2 === 0;
  }
  function K2(e, t) {
    if (e = e.slice(-2), t = t.slice(-2), gt.util.arraysEqual(e, t) || !e.length || !t.length || e[0] === 0 || e[1] === 0 || t[0] === 0 || t[1] === 0) return true;
    if (e.length !== t.length) {
      var r = e.slice(-1)[0], n = t.slice(-1)[0];
      if (r === n || bT(r) && bT(n) && (e[0] === 1 || t[0] === 1)) return true;
    }
    return e[1] === t[1] && bT(e[0]) && bT(t[0]);
  }
  var DT, CT;
  function Eq(e) {
    if (DT == null) {
      var t = dd(e);
      DT = t.getParameter(t.MAX_TEXTURE_SIZE);
    }
    return DT;
  }
  function $9e() {
    DT = null;
  }
  function H9e() {
    CT = null;
  }
  function Dq(e) {
    if (CT == null) {
      var t = dd(e);
      CT = t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);
    }
    return Math.min(16, CT);
  }
  function Cq(e) {
    if (e === 0) return 0;
    var t, r = dd(e);
    return zh(r, "EXT_disjoint_timer_query_webgl2") && e === 2 ? t = 2 : zh(r, "EXT_disjoint_timer_query") ? t = 1 : t = 0, t;
  }
  function zh(e, t) {
    var r = e.getExtension(t);
    return r != null;
  }
  function A6(e) {
    try {
      var t = dd(e);
      if (t != null) return true;
    } catch (r) {
      return console.log("Error when getting WebGL context: ", r), false;
    }
    return false;
  }
  function Mq(e) {
    if (e === 0) return false;
    var t = dd(e);
    if (e === 1) {
      if (!zh(t, "OES_texture_float")) return false;
    } else if (!zh(t, "EXT_color_buffer_float")) return false;
    var r = S6(t);
    return r;
  }
  function Iq(e) {
    if (e === 0) return false;
    var t = dd(e);
    if (e === 1) {
      if (!zh(t, "OES_texture_float") || !zh(t, "WEBGL_color_buffer_float")) return false;
    } else {
      if (zh(t, "EXT_color_buffer_float")) return S6(t);
      var r = "EXT_color_buffer_half_float";
      if (zh(t, r)) {
        var n = t.getExtension(r);
        return q9e(t, n);
      }
      return false;
    }
    var a = S6(t);
    return a;
  }
  function S6(e) {
    var t = M6(e), r = e.createTexture();
    e.bindTexture(e.TEXTURE_2D, r);
    var n = 1, a = 1;
    e.texImage2D(e.TEXTURE_2D, 0, t.internalFormatFloat, n, a, 0, t.textureFormatFloat, t.textureTypeFloat, null);
    var o = e.createFramebuffer();
    e.bindFramebuffer(e.FRAMEBUFFER, o), e.framebufferTexture2D(e.FRAMEBUFFER, e.COLOR_ATTACHMENT0, e.TEXTURE_2D, r, 0);
    var s = e.checkFramebufferStatus(e.FRAMEBUFFER) === e.FRAMEBUFFER_COMPLETE;
    return e.bindTexture(e.TEXTURE_2D, null), e.bindFramebuffer(e.FRAMEBUFFER, null), e.deleteTexture(r), e.deleteFramebuffer(o), s;
  }
  function q9e(e, t) {
    var r = M6(e, t), n = e.createTexture();
    e.bindTexture(e.TEXTURE_2D, n);
    var a = 1, o = 1;
    e.texImage2D(e.TEXTURE_2D, 0, r.internalFormatHalfFloat, a, o, 0, r.textureFormatFloat, r.textureTypeHalfFloat, null);
    var s = e.createFramebuffer();
    e.bindFramebuffer(e.FRAMEBUFFER, s), e.framebufferTexture2D(e.FRAMEBUFFER, e.COLOR_ATTACHMENT0, e.TEXTURE_2D, n, 0);
    var i = e.checkFramebufferStatus(e.FRAMEBUFFER) === e.FRAMEBUFFER_COMPLETE;
    return e.bindTexture(e.TEXTURE_2D, null), e.bindFramebuffer(e.FRAMEBUFFER, null), e.deleteTexture(n), e.deleteFramebuffer(s), i;
  }
  function Nq(e) {
    if (e !== 2) return false;
    var t = dd(e), r = t.fenceSync != null;
    return r;
  }
  function qy(e, t) {
    Array.isArray(e) || (e = [e]), e.forEach(function(r) {
      r != null && gt.util.assert(r.dtype !== "complex64", function() {
        return t + " does not support complex64 tensors in the WebGL backend.";
      });
    });
  }
  var X9e = { __proto__: null, callAndCheck: ai, canBeRepresented: uq, getWebGLErrorMessage: cq, getExtensionOrThrow: $2, createVertexShader: fq, createFragmentShader: hq, createProgram: pq, linkProgram: dq, validateProgram: AT, createStaticVertexBuffer: vq, createStaticIndexBuffer: mq, getNumChannels: j9e, createTexture: gq, validateTextureSize: yq, createFramebuffer: xq, bindVertexBufferToProgramAttribute: k6, bindTextureUnit: bq, unbindTextureUnit: W9e, getProgramUniformLocationOrThrow: _q, getProgramUniformLocation: wq, bindTextureToProgramUniformSampler: kq, bindCanvasToFramebuffer: G9e, bindColorTextureToFramebuffer: ST, unbindColorTextureFromFramebuffer: T6, validateFramebuffer: H2, getFramebufferErrorMessage: Tq, getBatchDim: Dg, getRowsCols: Cg, getShapeAs3D: ET, getTextureShapeFromLogicalShape: Sq, isReshapeFree: K2, getWebGLMaxTextureSize: Eq, resetMaxTextureSize: $9e, resetMaxTexturesInShader: H9e, getMaxTexturesInShader: Dq, getWebGLDisjointQueryTimerVersion: Cq, hasExtension: zh, isWebGLVersionEnabled: A6, isCapableOfRenderingToFloatTexture: Mq, isDownloadFloatTextureEnabled: Iq, isWebGLFenceEnabled: Nq, assertNotComplex: qy };
  var Pi = gt.env();
  Pi.registerFlag("HAS_WEBGL", function() {
    return Pi.getNumber("WEBGL_VERSION") > 0;
  });
  Pi.registerFlag("WEBGL_VERSION", function() {
    return A6(2) ? 2 : A6(1) ? 1 : 0;
  });
  Pi.registerFlag("WEBGL_CHECK_NUMERICAL_PROBLEMS", function() {
    return false;
  });
  Pi.registerFlag("WEBGL_BUFFER_SUPPORTED", function() {
    return Pi.get("WEBGL_VERSION") === 2;
  });
  Pi.registerFlag("WEBGL_CPU_FORWARD", function() {
    return true;
  });
  Pi.registerFlag("WEBGL_FORCE_F16_TEXTURES", function() {
    return false;
  });
  Pi.registerFlag("WEBGL_PACK", function() {
    return Pi.getBool("HAS_WEBGL");
  });
  Pi.registerFlag("WEBGL_PACK_NORMALIZATION", function() {
    return Pi.getBool("WEBGL_PACK");
  });
  Pi.registerFlag("WEBGL_PACK_CLIP", function() {
    return Pi.getBool("WEBGL_PACK");
  });
  Pi.registerFlag("WEBGL_PACK_DEPTHWISECONV", function() {
    return Pi.getBool("WEBGL_PACK");
  });
  Pi.registerFlag("WEBGL_PACK_BINARY_OPERATIONS", function() {
    return Pi.getBool("WEBGL_PACK");
  });
  Pi.registerFlag("WEBGL_PACK_UNARY_OPERATIONS", function() {
    return Pi.getBool("WEBGL_PACK");
  });
  Pi.registerFlag("WEBGL_PACK_ARRAY_OPERATIONS", function() {
    return Pi.getBool("WEBGL_PACK");
  });
  Pi.registerFlag("WEBGL_PACK_IMAGE_OPERATIONS", function() {
    return Pi.getBool("WEBGL_PACK");
  });
  Pi.registerFlag("WEBGL_PACK_REDUCE", function() {
    return Pi.getBool("WEBGL_PACK");
  });
  Pi.registerFlag("WEBGL_LAZILY_UNPACK", function() {
    return Pi.getBool("WEBGL_PACK");
  });
  Pi.registerFlag("WEBGL_CONV_IM2COL", function() {
    return Pi.getBool("WEBGL_PACK");
  });
  Pi.registerFlag("WEBGL_MAX_TEXTURE_SIZE", function() {
    return Eq(Pi.getNumber("WEBGL_VERSION"));
  });
  Pi.registerFlag("WEBGL_MAX_TEXTURES_IN_SHADER", function() {
    return Dq(Pi.getNumber("WEBGL_VERSION"));
  });
  Pi.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION", function() {
    var e = Pi.getNumber("WEBGL_VERSION");
    return e === 0 ? 0 : Cq(e);
  });
  Pi.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE", function() {
    return Pi.getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION") > 0 && !gt.device_util.isMobile();
  });
  Pi.registerFlag("WEBGL_RENDER_FLOAT32_CAPABLE", function() {
    return Mq(Pi.getNumber("WEBGL_VERSION"));
  });
  Pi.registerFlag("WEBGL_RENDER_FLOAT32_ENABLED", function() {
    return Pi.getBool("WEBGL_FORCE_F16_TEXTURES") ? false : Pi.getBool("WEBGL_RENDER_FLOAT32_CAPABLE");
  });
  Pi.registerFlag("WEBGL_DOWNLOAD_FLOAT_ENABLED", function() {
    return Iq(Pi.getNumber("WEBGL_VERSION"));
  });
  Pi.registerFlag("WEBGL_FENCE_API_ENABLED", function() {
    return Nq(Pi.getNumber("WEBGL_VERSION"));
  });
  Pi.registerFlag("WEBGL_SIZE_UPLOAD_UNIFORM", function() {
    var e = Pi.getBool("WEBGL_RENDER_FLOAT32_ENABLED");
    return e ? 4 : 0;
  });
  Pi.registerFlag("WEBGL_DELETE_TEXTURE_THRESHOLD", function() {
    return -1;
  }, function(e) {
    if (e < 0 && e !== -1) throw new Error("WEBGL_DELETE_TEXTURE_THRESHOLD must be -1 (indicating never " + ("delete) or at least 0, but got " + e + "."));
  });
  Pi.registerFlag("WEBGL_FLUSH_THRESHOLD", function() {
    return gt.device_util.isMobile() ? 1 : -1;
  }, function(e) {
    if (e < 0 && e !== -1) throw new Error("WEBGL_FLUSH_THRESHOLD must be -1 (indicating never " + ("manual flush) or at least 0, but got " + e + "."));
  });
  Pi.registerFlag("CPU_HANDOFF_SIZE_THRESHOLD", function() {
    return 128;
  });
  Pi.registerFlag("WEBGL_USE_SHAPES_UNIFORMS", function() {
    return false;
  });
  Pi.registerFlag("TOPK_LAST_DIM_CPU_HANDOFF_SIZE_THRESHOLD", function() {
    return 1e5;
  });
  Pi.registerFlag("TOPK_K_CPU_HANDOFF_THRESHOLD", function() {
    return 128;
  });
  function ff() {
    var e, t, r, n, a, o, s, i, l, u2;
    return gt.env().getNumber("WEBGL_VERSION") === 2 ? (e = "#version 300 es", t = "in", r = "out", n = "in", a = "texture", o = "outputColor", s = "out vec4 outputColor;", i = `
      bool isnan_custom(float val) {
        return (val > 0.0 || val < 0.0) ? false : val != 0.0;
      }

      bvec4 isnan_custom(vec4 val) {
        return bvec4(isnan_custom(val.x),
          isnan_custom(val.y), isnan_custom(val.z), isnan_custom(val.w));
      }

      #define isnan(value) isnan_custom(value)
    `, l = "", u2 = `
      #define round(value) newRound(value)
      int newRound(float value) {
        return int(floor(value + 0.5));
      }

      ivec4 newRound(vec4 value) {
        return ivec4(floor(value + vec4(0.5)));
      }
    `) : (e = "", t = "attribute", r = "varying", n = "varying", a = "texture2D", o = "gl_FragColor", s = "", i = `
      #define isnan(value) isnan_custom(value)
      bool isnan_custom(float val) {
        return (val > 0. || val < 1. || val == 0.) ? false : true;
      }
      bvec4 isnan_custom(vec4 val) {
        return bvec4(isnan(val.x), isnan(val.y), isnan(val.z), isnan(val.w));
      }
    `, l = `
      uniform float INFINITY;

      bool isinf(float val) {
        return abs(val) == INFINITY;
      }
      bvec4 isinf(vec4 val) {
        return equal(abs(val), vec4(INFINITY));
      }
    `, u2 = `
      int round(float value) {
        return int(floor(value + 0.5));
      }

      ivec4 round(vec4 value) {
        return ivec4(floor(value + vec4(0.5)));
      }
    `), { version: e, attribute: t, varyingVs: r, varyingFs: n, texture2D: a, output: o, defineOutput: s, defineSpecialNaN: i, defineSpecialInf: l, defineRound: u2 };
  }
  function Mg(e, t, r) {
    r === void 0 && (r = "index");
    var n = gt.util.computeStrides(t);
    return n.map(function(a, o) {
      var s = "int " + e[o] + " = " + r + " / " + a, i = o === n.length - 1 ? "int " + e[o + 1] + " = " + r + " - " + e[o] + " * " + a : "index -= " + e[o] + " * " + a;
      return s + "; " + i + ";";
    }).join("");
  }
  function OT(e, t, r) {
    r === void 0 && (r = "index");
    var n = gt.util.computeStrides(t);
    return n.map(function(a, o) {
      var s = "int " + e[o] + " = " + r + " / outShapeStrides[" + o + "]", i = o === n.length - 1 ? "int " + e[o + 1] + " = " + r + " - " + e[o] + " * outShapeStrides[" + o + "]" : "index -= " + e[o] + " * outShapeStrides[" + o + "]";
      return s + "; " + i + ";";
    }).join("");
  }
  function K9e(e, t) {
    var r = e.length, n = e.map(function(s) {
      return t + "[" + s + "]";
    }), a = new Array(r - 1);
    a[r - 2] = n[r - 1];
    for (var o = r - 3; o >= 0; --o) a[o] = "(" + a[o + 1] + " * " + n[o + 1] + ")";
    return a;
  }
  function Y9e(e, t, r) {
    r === void 0 && (r = "index");
    var n = e.map(function(o, s) {
      return s;
    }), a = K9e(n, t);
    return a.map(function(o, s) {
      var i = "int " + e[s] + " = " + r + " / " + a[s], l = s === a.length - 1 ? "int " + e[s + 1] + " = " + r + " - " + e[s] + " * " + a[s] : "index -= " + e[s] + " * " + a[s];
      return i + "; " + l + ";";
    }).join("");
  }
  function I6(e) {
    var t = gt.util.computeStrides(e).map(function(r) {
      return r.toString();
    });
    return `
  int getFlatIndex(ivec3 coords) {
    return coords.x * ` + t[0] + " + coords.y * " + t[1] + ` + coords.z;
  }
`;
  }
  function N6() {
    return `
  int getFlatIndex(ivec3 coords) {
    return coords.x * outShapeStrides[0] + coords.y * outShapeStrides[1] + coords.z;
  }
`;
  }
  var Fq = `
  const float FLOAT_MAX = 1.70141184e38;
  const float FLOAT_MIN = 1.17549435e-38;

  lowp vec4 encode_float(highp float v) {
    if (isnan(v)) {
      return vec4(255, 255, 255, 255);
    }

    highp float av = abs(v);

    if(av < FLOAT_MIN) {
      return vec4(0.0, 0.0, 0.0, 0.0);
    } else if(v > FLOAT_MAX) {
      return vec4(0.0, 0.0, 128.0, 127.0) / 255.0;
    } else if(v < -FLOAT_MAX) {
      return vec4(0.0, 0.0,  128.0, 255.0) / 255.0;
    }

    highp vec4 c = vec4(0,0,0,0);

    highp float e = floor(log2(av));
    highp float m = exp2(fract(log2(av))) - 1.0;

    c[2] = floor(128.0 * m);
    m -= c[2] / 128.0;
    c[1] = floor(32768.0 * m);
    m -= c[1] / 32768.0;
    c[0] = floor(8388608.0 * m);

    highp float ebias = e + 127.0;
    c[3] = floor(ebias / 2.0);
    ebias -= c[3] * 2.0;
    c[2] += floor(ebias) * 128.0;

    c[3] += 128.0 * step(0.0, -v);

    return c / 255.0;
  }
`, Oq = gt.backend_util.getBroadcastDims;
  function Z9e(e, t, r) {
    var n = [];
    if (e.forEach(function(p) {
      var d = gt.util.sizeFromShape(p.shapeInfo.logicalShape);
      if (p.shapeInfo.isUniform ? n.push("uniform float " + p.name + (d > 1 ? "[" + d + "]" : "") + ";") : (n.push("uniform sampler2D " + p.name + ";"), n.push("uniform int offset" + p.name + ";")), r.enableShapeUniforms) {
        var v = F62(r.packedInputs, p.shapeInfo.logicalShape, p.shapeInfo.texShape).uniformShape;
        switch (v.length) {
          case 1:
            n.push("uniform int " + p.name + "Shape;");
            break;
          case 2:
            n.push("uniform ivec2 " + p.name + "Shape;");
            break;
          case 3:
            n.push("uniform ivec3 " + p.name + "Shape;");
            break;
          case 4:
            n.push("uniform ivec4 " + p.name + "Shape;");
            break;
        }
        n.push("uniform ivec2 " + p.name + "TexShape;");
      }
    }), r.enableShapeUniforms) {
      switch (t.logicalShape.length) {
        case 1:
          n.push("uniform int outShape;");
          break;
        case 2:
          n.push("uniform ivec2 outShape;"), n.push("uniform int outShapeStrides;");
          break;
        case 3:
          n.push("uniform ivec3 outShape;"), n.push("uniform ivec2 outShapeStrides;");
          break;
        case 4:
          n.push("uniform ivec4 outShape;"), n.push("uniform ivec3 outShapeStrides;");
          break;
      }
      n.push("uniform ivec2 outTexShape;");
    }
    r.customUniforms && r.customUniforms.forEach(function(p) {
      n.push("uniform " + p.type + " " + p.name + (p.arrayIndex ? "[" + p.arrayIndex + "]" : "") + ";");
    });
    var a = n.join(`
`), o = e.map(function(p) {
      return J9e(p, t, r.packedInputs, r.enableShapeUniforms);
    }).join(`
`), s = t.texShape, i = ff(), l = tze(i), u2, c, f = aze(i);
    t.isPacked ? (u2 = Q9e(t.logicalShape, s, r.enableShapeUniforms), c = nze(i)) : (u2 = eze(t.logicalShape, s, r.enableShapeUniforms), c = rze(i)), r.packedInputs && (f += lze);
    var h = [f, l, c, a, u2, o, r.userCode].join(`
`);
    return h;
  }
  function Xy(e, t) {
    t === void 0 && (t = false);
    var r = e.shapeInfo.logicalShape;
    switch (r.length) {
      case 0:
        return bze(e, t);
      case 1:
        return wze(e, t);
      case 2:
        return Tze(e, t);
      case 3:
        return Sze(e, t);
      case 4:
        return Dze(e, t);
      case 5:
        return Cze(e);
      case 6:
        return Mze(e);
      default:
        throw new Error(r.length + "-D input sampling is not yet supported");
    }
  }
  function Pq(e, t) {
    var r = e.shapeInfo.logicalShape;
    switch (r.length) {
      case 0:
        return xze(e);
      case 1:
        return _ze(e, t);
      case 2:
        return kze(e, t);
      case 3:
        return Aze(e, t);
      default:
        return Eze(e, t);
    }
  }
  function J9e(e, t, r, n) {
    r === void 0 && (r = false);
    var a = "";
    r ? a += Pq(e, n) : a += Xy(e, n);
    var o = e.shapeInfo.logicalShape, s = t.logicalShape;
    return o.length <= s.length && (r ? a += Ize(e, t) : a += Nze(e, t)), a;
  }
  function Q9e(e, t, r) {
    switch (e.length) {
      case 0:
        return Lq();
      case 1:
        return uze(e, t, r);
      case 2:
        return gze(e, t, r);
      case 3:
        return fze(e, t, r);
      default:
        return pze(e, t, r);
    }
  }
  function eze(e, t, r) {
    switch (e.length) {
      case 0:
        return Lq();
      case 1:
        return cze(e, t, r);
      case 2:
        return yze(e, t, r);
      case 3:
        return hze(e, t, r);
      case 4:
        return dze(e, t, r);
      case 5:
        return vze(e, t);
      case 6:
        return mze(e, t);
      default:
        throw new Error(e.length + "-D output sampling is not yet supported");
    }
  }
  function tze(e) {
    return `
    float sampleTexture(sampler2D textureSampler, vec2 uv) {
      return ` + e.texture2D + `(textureSampler, uv).r;
    }
  `;
  }
  function rze(e) {
    return `
    void setOutput(float val) {
      ` + e.output + ` = vec4(val, 0, 0, 0);
    }
  `;
  }
  function nze(e) {
    return `
    void setOutput(vec4 val) {
      ` + e.output + ` = val;
    }
  `;
  }
  function aze(e) {
    var t = e.version + `
    precision highp float;
    precision highp int;
    precision highp sampler2D;
    ` + e.varyingFs + ` vec2 resultUV;
    ` + e.defineOutput + `
    const vec2 halfCR = vec2(0.5, 0.5);

    struct ivec5
    {
      int x;
      int y;
      int z;
      int w;
      int u;
    };

    struct ivec6
    {
      int x;
      int y;
      int z;
      int w;
      int u;
      int v;
    };

    uniform float NAN;
    ` + e.defineSpecialNaN + `
    ` + e.defineSpecialInf + `
    ` + e.defineRound + `

    int imod(int x, int y) {
      return x - y * (x / y);
    }

    int idiv(int a, int b, float sign) {
      int res = a / b;
      int mod = imod(a, b);
      if (sign < 0. && mod != 0) {
        res -= 1;
      }
      return res;
    }

    //Based on the work of Dave Hoskins
    //https://www.shadertoy.com/view/4djSRW
    #define HASHSCALE1 443.8975
    float random(float seed){
      vec2 p = resultUV * seed;
      vec3 p3  = fract(vec3(p.xyx) * HASHSCALE1);
      p3 += dot(p3, p3.yzx + 19.19);
      return fract((p3.x + p3.y) * p3.z);
    }

    ` + ize + `
    ` + oze + `
    ` + sze + `
  `;
    return t;
  }
  var ize = `
vec2 uvFromFlat(int texNumR, int texNumC, int index) {
  int texR = index / texNumC;
  int texC = index - texR * texNumC;
  return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);
}
vec2 packedUVfrom1D(int texNumR, int texNumC, int index) {
  int texelIndex = index / 2;
  int texR = texelIndex / texNumC;
  int texC = texelIndex - texR * texNumC;
  return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);
}
`, oze = `
vec2 packedUVfrom2D(int texelsInLogicalRow, int texNumR,
  int texNumC, int row, int col) {
  int texelIndex = (row / 2) * texelsInLogicalRow + (col / 2);
  int texR = texelIndex / texNumC;
  int texC = texelIndex - texR * texNumC;
  return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);
}
`, sze = `
vec2 packedUVfrom3D(int texNumR, int texNumC,
    int texelsInBatch, int texelsInLogicalRow, int b,
    int row, int col) {
  int index = b * texelsInBatch + (row / 2) * texelsInLogicalRow + (col / 2);
  int texR = index / texNumC;
  int texC = index - texR * texNumC;
  return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);
}
`, lze = `
  float getChannel(vec4 frag, vec2 innerDims) {
    vec2 modCoord = mod(innerDims, 2.);
    return modCoord.x == 0. ?
      (modCoord.y == 0. ? frag.r : frag.g) :
      (modCoord.y == 0. ? frag.b : frag.a);
  }
  float getChannel(vec4 frag, int dim) {
    float modCoord = mod(float(dim), 2.);
    return modCoord == 0. ? frag.r : frag.g;
  }
`;
  function Lq() {
    return `
    int getOutputCoords() {
      return 0;
    }
  `;
  }
  function uze(e, t, r) {
    var n = [Math.ceil(t[0] / 2), Math.ceil(t[1] / 2)];
    return n[0] === 1 ? r ? `
      int getOutputCoords() {
        return 2 * int(resultUV.x * ceil(float(outTexShape[1]) / 2.0));
      }
    ` : `
      int getOutputCoords() {
        return 2 * int(resultUV.x * ` + n[1] + `.0);
      }
    ` : n[1] === 1 ? r ? `
      int getOutputCoords() {
        return 2 * int(resultUV.y * ceil(float(outTexShape[0]) / 2.0));
      }
    ` : `
      int getOutputCoords() {
        return 2 * int(resultUV.y * ` + n[0] + `.0);
      }
    ` : r ? `
    int getOutputCoords() {
      ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));
      ivec2 resTexRC = ivec2(resultUV.yx *
                             vec2(packedTexShape[0], packedTexShape[1]));
      return 2 * (resTexRC.x * packedTexShape[1] + resTexRC.y);
    }
  ` : `
    int getOutputCoords() {
      ivec2 resTexRC = ivec2(resultUV.yx *
                             vec2(` + n[0] + ", " + n[1] + `));
      return 2 * (resTexRC.x * ` + n[1] + ` + resTexRC.y);
    }
  `;
  }
  function cze(e, t, r) {
    return t[0] === 1 ? r ? `
      int getOutputCoords() {
        return int(resultUV.x * float(outTexShape[1]));
      }
    ` : `
      int getOutputCoords() {
        return int(resultUV.x * ` + t[1] + `.0);
      }
    ` : t[1] === 1 ? r ? `
      int getOutputCoords() {
        return int(resultUV.y * float(outTexShape[0]));
      }
    ` : `
      int getOutputCoords() {
        return int(resultUV.y * ` + t[0] + `.0);
      }
    ` : r ? `
    int getOutputCoords() {
      ivec2 resTexRC = ivec2(resultUV.yx *
                             vec2(outTexShape[0], outTexShape[1]));
      return resTexRC.x * outTexShape[1] + resTexRC.y;
    }
  ` : `
    int getOutputCoords() {
      ivec2 resTexRC = ivec2(resultUV.yx *
                             vec2(` + t[0] + ", " + t[1] + `));
      return resTexRC.x * ` + t[1] + ` + resTexRC.y;
    }
  `;
  }
  function fze(e, t, r) {
    if (r) return `
    ivec3 getOutputCoords() {
      ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));
      int texelsInLogicalRow = int(ceil(float(outShape[2]) / 2.0));
      int texelsInBatch = texelsInLogicalRow * int(ceil(float(outShape[1]) / 2.0));
      ivec2 resTexRC = ivec2(resultUV.yx *
                             vec2(packedTexShape[0], packedTexShape[1]));
      int index = resTexRC.x * packedTexShape[1] + resTexRC.y;

      int b = index / texelsInBatch;
      index -= b * texelsInBatch;

      int r = 2 * (index / texelsInLogicalRow);
      int c = imod(index, texelsInLogicalRow) * 2;

      return ivec3(b, r, c);
    }
  `;
    var n = [Math.ceil(t[0] / 2), Math.ceil(t[1] / 2)], a = Math.ceil(e[2] / 2), o = a * Math.ceil(e[1] / 2);
    return `
    ivec3 getOutputCoords() {
      ivec2 resTexRC = ivec2(resultUV.yx *
                             vec2(` + n[0] + ", " + n[1] + `));
      int index = resTexRC.x * ` + n[1] + ` + resTexRC.y;

      int b = index / ` + o + `;
      index -= b * ` + o + `;

      int r = 2 * (index / ` + a + `);
      int c = imod(index, ` + a + `) * 2;

      return ivec3(b, r, c);
    }
  `;
  }
  function hze(e, t, r) {
    if (r) {
      var n = OT(["r", "c", "d"], e);
      return `
  ivec3 getOutputCoords() {
    ivec2 resTexRC = ivec2(resultUV.yx *
                           vec2(outTexShape[0], outTexShape[1]));
    int index = resTexRC.x * outTexShape[1] + resTexRC.y;
    ` + n + `
    return ivec3(r, c, d);
  }
`;
    }
    var a = Mg(["r", "c", "d"], e);
    return `
    ivec3 getOutputCoords() {
      ivec2 resTexRC = ivec2(resultUV.yx *
                             vec2(` + t[0] + ", " + t[1] + `));
      int index = resTexRC.x * ` + t[1] + ` + resTexRC.y;
      ` + a + `
      return ivec3(r, c, d);
    }
  `;
  }
  function pze(e, t, r) {
    if (r) return `
    ivec4 getOutputCoords() {
      ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));
      ivec2 resTexRC = ivec2(resultUV.yx *
                             vec2(packedTexShape[0], packedTexShape[1]));
      int index = resTexRC.x * packedTexShape[1] + resTexRC.y;

      int texelsInLogicalRow = int(ceil(float(outShape[3]) / 2.0));
      int texelsInBatch = texelsInLogicalRow * int(ceil(float(outShape[2]) / 2.0));
      int texelsInBatchN = texelsInBatch * outShape[1];

      int b2 = index / texelsInBatchN;
      index -= b2 * texelsInBatchN;

      int b = index / texelsInBatch;
      index -= b * texelsInBatch;

      int r = 2 * (index / texelsInLogicalRow);
      int c = imod(index, texelsInLogicalRow) * 2;

      return ivec4(b2, b, r, c);
    }
  `;
    for (var n = [Math.ceil(t[0] / 2), Math.ceil(t[1] / 2)], a = Math.ceil(e[e.length - 1] / 2), o = a * Math.ceil(e[e.length - 2] / 2), s = o, i = "", l = "b, r, c", u2 = 2; u2 < e.length - 1; u2++) s *= e[e.length - u2 - 1], i = `
      int b` + u2 + " = index / " + s + `;
      index -= b` + u2 + " * " + s + `;
    ` + i, l = "b" + u2 + ", " + l;
    return `
    ivec` + e.length + ` getOutputCoords() {
      ivec2 resTexRC = ivec2(resultUV.yx *
                             vec2(` + n[0] + ", " + n[1] + `));
      int index = resTexRC.x * ` + n[1] + ` + resTexRC.y;

      ` + i + `

      int b = index / ` + o + `;
      index -= b * ` + o + `;

      int r = 2 * (index / ` + a + `);
      int c = imod(index, ` + a + `) * 2;

      return ivec` + e.length + "(" + l + `);
    }
  `;
  }
  function dze(e, t, r) {
    if (r) {
      var n = OT(["r", "c", "d", "d2"], e);
      return `
    ivec4 getOutputCoords() {
      ivec2 resTexRC = ivec2(resultUV.yx *
        vec2(outTexShape[0], outTexShape[1]));
      int index = resTexRC.x * outTexShape[1] + resTexRC.y;
      ` + n + `
      return ivec4(r, c, d, d2);
    }
  `;
    }
    var a = Mg(["r", "c", "d", "d2"], e);
    return `
    ivec4 getOutputCoords() {
      ivec2 resTexRC = ivec2(resultUV.yx *
        vec2(` + t[0] + ", " + t[1] + `));
      int index = resTexRC.x * ` + t[1] + ` + resTexRC.y;
      ` + a + `
      return ivec4(r, c, d, d2);
    }
  `;
  }
  function vze(e, t) {
    var r = Mg(["r", "c", "d", "d2", "d3"], e);
    return `
    ivec5 getOutputCoords() {
      ivec2 resTexRC = ivec2(resultUV.yx * vec2(` + t[0] + `,
                             ` + t[1] + `));

      int index = resTexRC.x * ` + t[1] + ` + resTexRC.y;

      ` + r + `

      ivec5 outShape = ivec5(r, c, d, d2, d3);
      return outShape;
    }
  `;
  }
  function mze(e, t) {
    var r = Mg(["r", "c", "d", "d2", "d3", "d4"], e);
    return `
    ivec6 getOutputCoords() {
      ivec2 resTexRC = ivec2(resultUV.yx *
        vec2(` + t[0] + ", " + t[1] + `));
      int index = resTexRC.x * ` + t[1] + ` + resTexRC.y;

      ` + r + `

      ivec6 result = ivec6(r, c, d, d2, d3, d4);
      return result;
    }
  `;
  }
  function gze(e, t, r) {
    var n = [Math.ceil(t[0] / 2), Math.ceil(t[1] / 2)];
    if (gt.util.arraysEqual(e, t)) return r ? `
      ivec2 getOutputCoords() {
        ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));
        return 2 * ivec2(resultUV.yx * vec2(packedTexShape[0], packedTexShape[1]));
      }
    ` : `
      ivec2 getOutputCoords() {
        return 2 * ivec2(resultUV.yx * vec2(` + n[0] + ", " + n[1] + `));
      }
    `;
    var a = Math.ceil(e[1] / 2);
    return r ? `
    ivec2 getOutputCoords() {
      ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));
      int texelsInLogicalRow = int(ceil(float(outShape[1]) / 2.0));
      ivec2 resTexRC = ivec2(resultUV.yx *
                             vec2(packedTexShape[0], packedTexShape[1]));

      int index = resTexRC.x * packedTexShape[1] + resTexRC.y;
      int r = 2 * (index / texelsInLogicalRow);
      int c = imod(index, texelsInLogicalRow) * 2;

      return ivec2(r, c);
    }
  ` : `
    ivec2 getOutputCoords() {
      ivec2 resTexRC = ivec2(resultUV.yx *
                             vec2(` + n[0] + ", " + n[1] + `));

      int index = resTexRC.x * ` + n[1] + ` + resTexRC.y;
      int r = 2 * (index / ` + a + `);
      int c = imod(index, ` + a + `) * 2;

      return ivec2(r, c);
    }
  `;
  }
  function yze(e, t, r) {
    return gt.util.arraysEqual(e, t) ? r ? `
      ivec2 getOutputCoords() {
        return ivec2(resultUV.yx * vec2(outTexShape[0], outTexShape[1]));
      }
    ` : `
      ivec2 getOutputCoords() {
        return ivec2(resultUV.yx * vec2(` + t[0] + ", " + t[1] + `));
      }
    ` : e[1] === 1 ? r ? `
      ivec2 getOutputCoords() {
        ivec2 resTexRC = ivec2(resultUV.yx *
                               vec2(outTexShape[0], outTexShape[1]));
        int index = resTexRC.x * outTexShape[1] + resTexRC.y;
        return ivec2(index, 0);
      }
    ` : `
      ivec2 getOutputCoords() {
        ivec2 resTexRC = ivec2(resultUV.yx *
                               vec2(` + t[0] + ", " + t[1] + `));
        int index = resTexRC.x * ` + t[1] + ` + resTexRC.y;
        return ivec2(index, 0);
      }
    ` : e[0] === 1 ? r ? `
      ivec2 getOutputCoords() {
        ivec2 resTexRC = ivec2(resultUV.yx *
                               vec2(outTexShape[0], outTexShape[1]));
        int index = resTexRC.x * outTexShape[1] + resTexRC.y;
        return ivec2(0, index);
      }
    ` : `
      ivec2 getOutputCoords() {
        ivec2 resTexRC = ivec2(resultUV.yx *
                               vec2(` + t[0] + ", " + t[1] + `));
        int index = resTexRC.x * ` + t[1] + ` + resTexRC.y;
        return ivec2(0, index);
      }
    ` : r ? `
    ivec2 getOutputCoords() {
      ivec2 resTexRC = ivec2(resultUV.yx *
                             vec2(outTexShape[0], outTexShape[1]));
      int index = resTexRC.x * outTexShape[1] + resTexRC.y;
      int r = index / outShape[1];
      int c = index - r * outShape[1];
      return ivec2(r, c);
    }
  ` : `
    ivec2 getOutputCoords() {
      ivec2 resTexRC = ivec2(resultUV.yx *
                             vec2(` + t[0] + ", " + t[1] + `));
      int index = resTexRC.x * ` + t[1] + ` + resTexRC.y;
      int r = index / ` + e[1] + `;
      int c = index - r * ` + e[1] + `;
      return ivec2(r, c);
    }
  `;
  }
  function Ig(e) {
    return "offset" + e;
  }
  function xze(e) {
    var t = e.name, r = "get" + t.charAt(0).toUpperCase() + t.slice(1), n = ff();
    return `
    vec4 ` + r + `() {
      return ` + n.texture2D + "(" + t + `, halfCR);
    }
  `;
  }
  function bze(e, t) {
    var r = e.name, n = "get" + r.charAt(0).toUpperCase() + r.slice(1);
    if (e.shapeInfo.isUniform) return "float " + n + "() {return " + r + ";}";
    var a = _i(e.shapeInfo.texShape, 2), o = a[0], s = a[1];
    if (o === 1 && s === 1) return `
      float ` + n + `() {
        return sampleTexture(` + r + `, halfCR);
      }
    `;
    var i = Ig(r);
    if (t) return `
    float ` + n + `() {
      vec2 uv = uvFromFlat(` + r + "TexShape[0], " + r + "TexShape[1], " + i + `);
      return sampleTexture(` + r + `, uv);
    }
  `;
    var l = _i(e.shapeInfo.texShape, 2), u2 = l[0], c = l[1];
    return `
    float ` + n + `() {
      vec2 uv = uvFromFlat(` + u2 + ", " + c + ", " + i + `);
      return sampleTexture(` + r + `, uv);
    }
  `;
  }
  function _ze(e, t) {
    var r = e.name, n = "get" + r.charAt(0).toUpperCase() + r.slice(1), a = e.shapeInfo.texShape, o = ff();
    if (t) return `
    vec4 ` + n + `(int index) {
      ivec2 packedTexShape = ivec2(ceil(float(` + r + "TexShape[0]) / 2.0), ceil(float(" + r + `TexShape[1]) / 2.0));
      vec2 uv = packedUVfrom1D(
        packedTexShape[0], packedTexShape[1], index);
      return ` + o.texture2D + "(" + r + `, uv);
    }
  `;
    var s = [Math.ceil(a[0] / 2), Math.ceil(a[1] / 2)];
    return `
    vec4 ` + n + `(int index) {
      vec2 uv = packedUVfrom1D(
        ` + s[0] + ", " + s[1] + `, index);
      return ` + o.texture2D + "(" + r + `, uv);
    }
  `;
  }
  function wze(e, t) {
    var r = e.name, n = "get" + r.charAt(0).toUpperCase() + r.slice(1);
    if (e.shapeInfo.isUniform) return `
      float ` + n + `(int index) {
        ` + Ky(e) + `
      }
    `;
    var a = e.shapeInfo.texShape, o = a[0], s = a[1];
    if (s === 1 && o === 1) return `
      float ` + n + `(int index) {
        return sampleTexture(` + r + `, halfCR);
      }
    `;
    var i = Ig(r);
    return s === 1 ? t ? `
      float ` + n + `(int index) {
        vec2 uv = vec2(0.5, (float(index + ` + i + ") + 0.5) / float(" + r + `TexShape[0]));
        return sampleTexture(` + r + `, uv);
      }
    ` : `
      float ` + n + `(int index) {
        vec2 uv = vec2(0.5, (float(index + ` + i + ") + 0.5) / " + o + `.0);
        return sampleTexture(` + r + `, uv);
      }
    ` : o === 1 ? t ? `
      float ` + n + `(int index) {
        vec2 uv = vec2((float(index + ` + i + ") + 0.5) / float(" + r + `TexShape[1]), 0.5);
        return sampleTexture(` + r + `, uv);
      }
    ` : `
      float ` + n + `(int index) {
        vec2 uv = vec2((float(index + ` + i + ") + 0.5) / " + s + `.0, 0.5);
        return sampleTexture(` + r + `, uv);
      }
    ` : t ? `
    float ` + n + `(int index) {
      vec2 uv = uvFromFlat(` + r + "TexShape[0], " + r + "TexShape[1], index + " + i + `);
      return sampleTexture(` + r + `, uv);
    }
  ` : `
    float ` + n + `(int index) {
      vec2 uv = uvFromFlat(` + o + ", " + s + ", index + " + i + `);
      return sampleTexture(` + r + `, uv);
    }
  `;
  }
  function kze(e, t) {
    var r = e.shapeInfo.logicalShape, n = e.name, a = "get" + n.charAt(0).toUpperCase() + n.slice(1), o = e.shapeInfo.texShape, s = o[0], i = o[1], l = ff();
    if (o != null && gt.util.arraysEqual(r, o)) return t ? `
      vec4 ` + a + `(int row, int col) {
        vec2 uv = (vec2(col, row) + halfCR) / vec2(` + n + "TexShape[1], " + n + `TexShape[0]);

        return ` + l.texture2D + "(" + n + `, uv);
      }
    ` : `
      vec4 ` + a + `(int row, int col) {
        vec2 uv = (vec2(col, row) + halfCR) / vec2(` + i + ".0, " + s + `.0);

        return ` + l.texture2D + "(" + n + `, uv);
      }
    `;
    if (t) return `
    vec4 ` + a + `(int row, int col) {
      ivec2 packedTexShape = ivec2(ceil(float(` + n + "TexShape[0]) / 2.0), ceil(float(" + n + `TexShape[1]) / 2.0));
      int valuesPerRow = int(ceil(float(` + n + `Shape[1]) / 2.0));
      vec2 uv = packedUVfrom2D(valuesPerRow, packedTexShape[0], packedTexShape[1], row, col);
      return ` + l.texture2D + "(" + n + `, uv);
    }
  `;
    var u2 = [Math.ceil(o[0] / 2), Math.ceil(o[1] / 2)], c = Math.ceil(r[1] / 2);
    return `
    vec4 ` + a + `(int row, int col) {
      vec2 uv = packedUVfrom2D(` + c + ", " + u2[0] + ", " + u2[1] + `, row, col);
      return ` + l.texture2D + "(" + n + `, uv);
    }
  `;
  }
  function Tze(e, t) {
    var r = e.shapeInfo.logicalShape, n = e.name, a = "get" + n.charAt(0).toUpperCase() + n.slice(1), o = e.shapeInfo.texShape;
    if (o != null && gt.util.arraysEqual(r, o)) {
      if (t) return `
      float ` + a + `(int row, int col) {
        vec2 uv = (vec2(col, row) + halfCR) / vec2(` + n + "TexShape[1], " + n + `TexShape[0]);
        return sampleTexture(` + n + `, uv);
      }
    `;
      var s = o[0], i = o[1];
      return `
    float ` + a + `(int row, int col) {
      vec2 uv = (vec2(col, row) + halfCR) / vec2(` + i + ".0, " + s + `.0);
      return sampleTexture(` + n + `, uv);
    }
  `;
    }
    var l = gt.util.squeezeShape(r), u2 = l.newShape, c = l.keptDims, f = u2;
    if (f.length < r.length) {
      var h = Yy(e, f), p = ["row", "col"];
      return `
      ` + Xy(h, t) + `
      float ` + a + `(int row, int col) {
        return ` + a + "(" + Zy(p, c) + `);
      }
    `;
    }
    if (e.shapeInfo.isUniform) return `
      float ` + a + `(int row, int col) {
        int index = round(dot(vec2(row, col), vec2(` + r[1] + `, 1)));
        ` + Ky(e) + `
      }
    `;
    var d = o[0], v = o[1], m = Ig(n);
    return v === 1 ? t ? `
      float ` + a + `(int row, int col) {
        float index = dot(vec3(row, col, ` + m + "), vec3(" + n + `Shape[1], 1, 1));
        vec2 uv = vec2(0.5, (index + 0.5) / float(` + n + `TexShape[0]));
        return sampleTexture(` + n + `, uv);
      }
    ` : `
    float ` + a + `(int row, int col) {
      float index = dot(vec3(row, col, ` + m + "), vec3(" + r[1] + `, 1, 1));
      vec2 uv = vec2(0.5, (index + 0.5) / ` + d + `.0);
      return sampleTexture(` + n + `, uv);
    }
  ` : d === 1 ? t ? `
      float ` + a + `(int row, int col) {
        float index = dot(vec3(row, col, ` + m + "), vec3(" + n + `Shape[1], 1, 1));
        vec2 uv = vec2((index + 0.5) / float(` + n + `TexShape[1]), 0.5);
        return sampleTexture(` + n + `, uv);
      }
    ` : `
    float ` + a + `(int row, int col) {
      float index = dot(vec3(row, col, ` + m + "), vec3(" + r[1] + `, 1, 1));
      vec2 uv = vec2((index + 0.5) / ` + v + `.0, 0.5);
      return sampleTexture(` + n + `, uv);
    }
  ` : t ? `
      float ` + a + `(int row, int col) {
        // Explicitly use integer operations as dot() only works on floats.
        int index = row * ` + n + "Shape[1] + col + " + m + `;
        vec2 uv = uvFromFlat(` + n + "TexShape[0], " + n + `TexShape[1], index);
        return sampleTexture(` + n + `, uv);
      }
    ` : `
  float ` + a + `(int row, int col) {
    // Explicitly use integer operations as dot() only works on floats.
    int index = row * ` + r[1] + " + col + " + m + `;
    vec2 uv = uvFromFlat(` + d + ", " + v + `, index);
    return sampleTexture(` + n + `, uv);
  }
`;
  }
  function Aze(e, t) {
    var r = e.shapeInfo.logicalShape, n = e.name, a = "get" + n.charAt(0).toUpperCase() + n.slice(1), o = e.shapeInfo.texShape, s = [Math.ceil(o[0] / 2), Math.ceil(o[1] / 2)];
    if (r[0] === 1) {
      var i = r.slice(1), l = [1, 2], u2 = Yy(e, i), c = ["b", "row", "col"];
      return `
        ` + Pq(u2, t) + `
        vec4 ` + a + `(int b, int row, int col) {
          return ` + a + "(" + Zy(c, l) + `);
        }
      `;
    }
    var f = ff();
    if (t) return `
    vec4 ` + a + `(int b, int row, int col) {
      ivec2 packedTexShape = ivec2(ceil(float(` + n + "TexShape[0]) / 2.0), ceil(float(" + n + `TexShape[1]) / 2.0));
      int valuesPerRow = int(ceil(float(` + n + `Shape[2]) / 2.0));
      int texelsInBatch = valuesPerRow * int(ceil(float(` + n + `Shape[1]) / 2.0));
      vec2 uv = packedUVfrom3D(
        packedTexShape[0], packedTexShape[1], texelsInBatch, valuesPerRow, b, row, col);
      return ` + f.texture2D + "(" + n + `, uv);
    }
  `;
    var h = s[0], p = s[1], d = Math.ceil(r[2] / 2), v = d * Math.ceil(r[1] / 2);
    return `
    vec4 ` + a + `(int b, int row, int col) {
      vec2 uv = packedUVfrom3D(
        ` + h + ", " + p + ", " + v + ", " + d + `, b, row, col);
      return ` + f.texture2D + "(" + n + `, uv);
    }
  `;
  }
  function Sze(e, t) {
    var r = e.shapeInfo.logicalShape, n = e.name, a = "get" + n.charAt(0).toUpperCase() + n.slice(1), o = r[1] * r[2], s = r[2], i = gt.util.squeezeShape(r), l = i.newShape, u2 = i.keptDims, c = l;
    if (c.length < r.length) {
      var f = Yy(e, c), h = ["row", "col", "depth"];
      return `
        ` + Xy(f, t) + `
        float ` + a + `(int row, int col, int depth) {
          return ` + a + "(" + Zy(h, u2) + `);
        }
      `;
    }
    if (e.shapeInfo.isUniform) return `
      float ` + a + `(int row, int col, int depth) {
        int index = round(dot(vec3(row, col, depth),
                          vec3(` + o + ", " + s + `, 1)));
        ` + Ky(e) + `
      }
    `;
    var p = e.shapeInfo.texShape, d = p[0], v = p[1], m = e.shapeInfo.flatOffset;
    if (v === o && m == null) return t ? `
      float ` + a + `(int row, int col, int depth) {
        int stride1 = ` + n + `Shape[2];
        float texR = float(row);
        float texC = dot(vec2(col, depth), vec2(stride1, 1));
        vec2 uv = (vec2(texC, texR) + halfCR) /
                   vec2(` + n + "TexShape[1], " + n + `TexShape[0]);
        return sampleTexture(` + n + `, uv);
      }
    ` : `
        float ` + a + `(int row, int col, int depth) {
          float texR = float(row);
          float texC = dot(vec2(col, depth), vec2(` + s + `, 1));
          vec2 uv = (vec2(texC, texR) + halfCR) /
                     vec2(` + v + ".0, " + d + `.0);
          return sampleTexture(` + n + `, uv);
        }
      `;
    if (v === s && m == null) return t ? `
      float ` + a + `(int row, int col, int depth) {
        float texR = dot(vec2(row, col), vec2(` + n + `Shape[1], 1));
        float texC = float(depth);
        vec2 uv = (vec2(texC, texR) + halfCR) / vec2(` + n + "TexShape[1], " + n + `TexShape[0]);
        return sampleTexture(` + n + `, uv);
      }
    ` : `
    float ` + a + `(int row, int col, int depth) {
      float texR = dot(vec2(row, col), vec2(` + r[1] + `, 1));
      float texC = float(depth);
      vec2 uv = (vec2(texC, texR) + halfCR) / vec2(` + v + ".0, " + d + `.0);
      return sampleTexture(` + n + `, uv);
    }
  `;
    var g = Ig(n);
    return t ? `
    float ` + a + `(int row, int col, int depth) {
      // Explicitly use integer operations as dot() only works on floats.
      int stride0 = ` + n + "Shape[1] * " + n + `Shape[2];
      int stride1 = ` + n + `Shape[2];
      int index = row * ` + o + " + col * " + s + " + depth + " + g + `;
      vec2 uv = uvFromFlat(` + n + "TexShape[0], " + n + `TexShape[1], index);
      return sampleTexture(` + n + `, uv);
    }
    ` : `
      float ` + a + `(int row, int col, int depth) {
        // Explicitly use integer operations as dot() only works on floats.
        int index = row * ` + o + " + col * " + s + " + depth + " + g + `;
        vec2 uv = uvFromFlat(` + d + ", " + v + `, index);
        return sampleTexture(` + n + `, uv);
      }
  `;
  }
  function Eze(e, t) {
    var r = e.name, n = "get" + r.charAt(0).toUpperCase() + r.slice(1), a = ff();
    if (t) return `
    vec4 ` + n + `(int b2, int b, int row, int col) {
      int valuesPerRow = int(ceil(float(` + r + `Shape[3]) / 2.0));
      int texelsInBatch = valuesPerRow * int(ceil(float(` + r + `Shape[2]) / 2.0));
      int index = b * texelsInBatch + (row / 2) * valuesPerRow + (col / 2);
      texelsInBatch *= ` + r + `Shape[1];
      index = b2 * texelsInBatch + index;
      ivec2 packedTexShape = ivec2(ceil(float(` + r + "TexShape[0]) / 2.0), ceil(float(" + r + `TexShape[1]) / 2.0));
      int texR = index / packedTexShape[1];
      int texC = index - texR * packedTexShape[1];
      vec2 uv = (vec2(texC, texR) + halfCR) / vec2(packedTexShape[1], packedTexShape[0]); return ` + a.texture2D + "(" + r + `, uv);
    }
  `;
    for (var o = e.shapeInfo.logicalShape, s = o.length, i = e.shapeInfo.texShape, l = [Math.ceil(i[0] / 2), Math.ceil(i[1] / 2)], u2 = l[0], c = l[1], f = Math.ceil(o[s - 1] / 2), h = f * Math.ceil(o[s - 2] / 2), p = "int b, int row, int col", d = "b * " + h + " + (row / 2) * " + f + " + (col / 2)", v = 2; v < s - 1; v++) p = "int b" + v + ", " + p, h *= o[s - v - 1], d = "b" + v + " * " + h + " + " + d;
    return `
    vec4 ` + n + "(" + p + `) {
      int index = ` + d + `;
      int texR = index / ` + c + `;
      int texC = index - texR * ` + c + `;
      vec2 uv = (vec2(texC, texR) + halfCR) / vec2(` + c + ", " + u2 + `);
      return ` + a.texture2D + "(" + r + `, uv);
    }
  `;
  }
  function Dze(e, t) {
    var r = e.shapeInfo.logicalShape, n = e.name, a = "get" + n.charAt(0).toUpperCase() + n.slice(1), o = r[3], s = r[2] * o, i = r[1] * s, l = gt.util.squeezeShape(r), u2 = l.newShape, c = l.keptDims;
    if (u2.length < r.length) {
      var f = Yy(e, u2), h = ["row", "col", "depth", "depth2"];
      return `
      ` + Xy(f, t) + `
      float ` + a + `(int row, int col, int depth, int depth2) {
        return ` + a + "(" + Zy(h, c) + `);
      }
    `;
    }
    if (e.shapeInfo.isUniform) return `
      float ` + a + `(int row, int col, int depth, int depth2) {
        int index = round(dot(vec4(row, col, depth, depth2),
                          vec4(` + i + ", " + s + ", " + o + `, 1)));
        ` + Ky(e) + `
      }
    `;
    var p = e.shapeInfo.flatOffset, d = e.shapeInfo.texShape, v = d[0], m = d[1], g = "int stride2 = " + n + "Shape[3];", x = "int stride1 = " + n + "Shape[2] * stride2;", b = "int stride0 = " + n + "Shape[1] * stride1;";
    if (m === i && p == null) return t ? `
      float ` + a + `(int row, int col, int depth, int depth2) {
        ` + g + `
        ` + x + `
        float texR = float(row);
        float texC =
            dot(vec3(col, depth, depth2),
                vec3(stride1, stride2, 1));
        vec2 uv = (vec2(texC, texR) + halfCR) /
                   vec2(` + n + "TexShape[1], " + n + `TexShape[0]);
        return sampleTexture(` + n + `, uv);
      }
    ` : `
      float ` + a + `(int row, int col, int depth, int depth2) {
        float texR = float(row);
        float texC =
            dot(vec3(col, depth, depth2),
                vec3(` + s + ", " + o + `, 1));
        vec2 uv = (vec2(texC, texR) + halfCR) /
                   vec2(` + m + ".0, " + v + `.0);
        return sampleTexture(` + n + `, uv);
      }
    `;
    if (m === o && p == null) return t ? `
      float ` + a + `(int row, int col, int depth, int depth2) {
        float texR = dot(vec3(row, col, depth),
                         vec3(` + n + "Shape[1] * " + n + "Shape[2], " + n + `Shape[2], 1));
        float texC = float(depth2);
        vec2 uv = (vec2(texC, texR) + halfCR) /
                  vec2(` + n + "TexShape[1], " + n + `TexShape[0]);
        return sampleTexture(` + n + `, uv);
      }
    ` : `
      float ` + a + `(int row, int col, int depth, int depth2) {
        float texR = dot(vec3(row, col, depth),
                         vec3(` + r[1] * r[2] + ", " + r[2] + `, 1));
        float texC = float(depth2);
        vec2 uv = (vec2(texC, texR) + halfCR) /
                  vec2(` + m + ".0, " + v + `.0);
        return sampleTexture(` + n + `, uv);
      }
    `;
    var y = Ig(n);
    return t ? `
    float ` + a + `(int row, int col, int depth, int depth2) {
      // Explicitly use integer operations as dot() only works on floats.
      ` + g + `
      ` + x + `
      ` + b + `
      int index = row * stride0 + col * stride1 +
          depth * stride2 + depth2;
      vec2 uv = uvFromFlat(` + n + "TexShape[0], " + n + "TexShape[1], index + " + y + `);
      return sampleTexture(` + n + `, uv);
    }
  ` : `
    float ` + a + `(int row, int col, int depth, int depth2) {
      // Explicitly use integer operations as dot() only works on floats.
      int index = row * ` + i + " + col * " + s + ` +
          depth * ` + o + ` + depth2;
      vec2 uv = uvFromFlat(` + v + ", " + m + ", index + " + y + `);
      return sampleTexture(` + n + `, uv);
    }
  `;
  }
  function Cze(e) {
    var t = e.shapeInfo.logicalShape, r = e.name, n = "get" + r.charAt(0).toUpperCase() + r.slice(1), a = t[4], o = t[3] * a, s = t[2] * o, i = t[1] * s, l = gt.util.squeezeShape(t), u2 = l.newShape, c = l.keptDims;
    if (u2.length < t.length) {
      var f = Yy(e, u2), h = ["row", "col", "depth", "depth2", "depth3"];
      return `
      ` + Xy(f) + `
      float ` + n + `(int row, int col, int depth, int depth2, int depth3) {
        return ` + n + "(" + Zy(h, c) + `);
      }
    `;
    }
    if (e.shapeInfo.isUniform) return `
      float ` + n + `(int row, int col, int depth, int depth2, int depth3) {
        float index = dot(
          vec4(row, col, depth, depth2),
          vec4(` + i + ", " + s + ", " + o + ", " + a + `)) +
          depth3;
        ` + Ky(e) + `
      }
    `;
    var p = e.shapeInfo.flatOffset, d = e.shapeInfo.texShape, v = d[0], m = d[1];
    if (m === i && p == null) return `
      float ` + n + `(int row, int col, int depth, int depth2, int depth3) {
        int texR = row;
        float texC = dot(vec4(col, depth, depth2, depth3),
                         vec4(` + s + ", " + o + ", " + a + `, 1));
        vec2 uv = (vec2(texC, texR) + halfCR) /
                   vec2(` + m + ".0, " + v + `.0);
        return sampleTexture(` + r + `, uv);
      }
    `;
    if (m === a && p == null) return `
      float ` + n + `(int row, int col, int depth, int depth2, int depth3) {
        float texR = dot(
          vec4(row, col, depth, depth2),
          vec4(` + t[1] * t[2] * t[3] + `,
               ` + t[2] * t[3] + ", " + t[3] + `, 1));
        int texC = depth3;
        vec2 uv = (vec2(texC, texR) + halfCR) /
                  vec2(` + m + ".0, " + v + `.0);
        return sampleTexture(` + r + `, uv);
      }
    `;
    var g = Ig(r);
    return `
    float ` + n + `(int row, int col, int depth, int depth2, int depth3) {
      // Explicitly use integer operations as dot() only works on floats.
      int index = row * ` + i + " + col * " + s + " + depth * " + o + ` +
          depth2 * ` + a + " + depth3 + " + g + `;
      vec2 uv = uvFromFlat(` + v + ", " + m + `, index);
      return sampleTexture(` + r + `, uv);
    }
  `;
  }
  function Mze(e) {
    var t = e.shapeInfo.logicalShape, r = e.name, n = "get" + r.charAt(0).toUpperCase() + r.slice(1), a = gt.util.squeezeShape(t), o = a.newShape, s = a.keptDims;
    if (o.length < t.length) {
      var i = Yy(e, o), l = ["row", "col", "depth", "depth2", "depth3", "depth4"];
      return `
      ` + Xy(i) + `
      float ` + n + `(int row, int col, int depth,
                    int depth2, int depth3, int depth4) {
        return ` + n + "(" + Zy(l, s) + `);
      }
    `;
    }
    var u2 = t[5], c = t[4] * u2, f = t[3] * c, h = t[2] * f, p = t[1] * h;
    if (e.shapeInfo.isUniform) return `
      float ` + n + `(int row, int col, int depth,
                  int depth2, int depth3, int depth4) {
        int index = round(dot(
          vec4(row, col, depth, depth2),
          vec4(` + p + ", " + h + ", " + f + ", " + c + `)) +
          dot(
            vec2(depth3, depth4),
            vec2(` + u2 + `, 1)));
        ` + Ky(e) + `
      }
    `;
    var d = e.shapeInfo.flatOffset, v = e.shapeInfo.texShape, m = v[0], g = v[1];
    if (g === p && d == null) return `
      float ` + n + `(int row, int col, int depth,
                    int depth2, int depth3, int depth4) {
        int texR = row;
        float texC = dot(vec4(col, depth, depth2, depth3),
          vec4(` + h + ", " + f + ", " + c + ", " + u2 + `)) +
               float(depth4);
        vec2 uv = (vec2(texC, texR) + halfCR) /
                   vec2(` + g + ".0, " + m + `.0);
        return sampleTexture(` + r + `, uv);
      }
    `;
    if (g === u2 && d == null) return `
      float ` + n + `(int row, int col, int depth,
                    int depth2, int depth3, int depth4) {
        float texR = dot(vec4(row, col, depth, depth2),
          vec4(` + t[1] * t[2] * t[3] * t[4] + `,
               ` + t[2] * t[3] * t[4] + `,
               ` + t[3] * t[4] + `,
               ` + t[4] + `)) + float(depth3);
        int texC = depth4;
        vec2 uv = (vec2(texC, texR) + halfCR) /
                  vec2(` + g + ".0, " + m + `.0);
        return sampleTexture(` + r + `, uv);
      }
    `;
    var x = Ig(r);
    return `
    float ` + n + `(int row, int col, int depth,
                  int depth2, int depth3, int depth4) {
      // Explicitly use integer operations as dot() only works on floats.
      int index = row * ` + p + " + col * " + h + " + depth * " + f + ` +
          depth2 * ` + c + " + depth3 * " + u2 + " + depth4 + " + x + `;
      vec2 uv = uvFromFlat(` + m + ", " + g + `, index);
      return sampleTexture(` + r + `, uv);
    }
  `;
  }
  function Ky(e) {
    var t = e.name, r = gt.util.sizeFromShape(e.shapeInfo.logicalShape);
    return r < 2 ? "return " + t + ";" : `
    for (int i = 0; i < ` + r + `; i++) {
      if (i == index) {
        return ` + t + `[i];
      }
    }
  `;
  }
  function Ize(e, t) {
    var r = e.name, n = r.charAt(0).toUpperCase() + r.slice(1), a = "get" + n + "AtOutCoords", o = e.shapeInfo.logicalShape.length, s = t.logicalShape.length, i = Oq(e.shapeInfo.logicalShape, t.logicalShape), l = $s(s), u2 = s - o, c, f = ["x", "y", "z", "w", "u", "v"];
    o === 0 ? c = "" : s < 2 && i.length >= 1 ? c = "coords = 0;" : c = i.map(function(y) {
      return "coords." + f[y + u2] + " = 0;";
    }).join(`
`);
    var h = "";
    s < 2 && o > 0 ? h = "coords" : h = e.shapeInfo.logicalShape.map(function(y, w) {
      return "coords." + f[w + u2];
    }).join(", ");
    var p = "return outputValue;", d = gt.util.sizeFromShape(e.shapeInfo.logicalShape), v = d === 1, m = gt.util.sizeFromShape(t.logicalShape), g = m === 1;
    if (o === 1 && !v && !g) p = `
      return vec4(outputValue.xy, outputValue.xy);
    `;
    else if (v && !g) s === 1 ? p = `
        return vec4(outputValue.x, outputValue.x, 0., 0.);
      ` : p = `
        return vec4(outputValue.x);
      `;
    else if (i.length) {
      var x = o - 2, b = o - 1;
      i.indexOf(x) > -1 && i.indexOf(b) > -1 ? p = "return vec4(outputValue.x);" : i.indexOf(x) > -1 ? p = "return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);" : i.indexOf(b) > -1 && (p = "return vec4(outputValue.xx, outputValue.zz);");
    }
    return `
    vec4 ` + a + `() {
      ` + l + ` coords = getOutputCoords();
      ` + c + `
      vec4 outputValue = get` + n + "(" + h + `);
      ` + p + `
    }
  `;
  }
  function Nze(e, t) {
    var r = e.name, n = r.charAt(0).toUpperCase() + r.slice(1), a = "get" + n + "AtOutCoords", o = t.texShape, s = e.shapeInfo.texShape, i = e.shapeInfo.logicalShape.length, l = t.logicalShape.length;
    if (!e.shapeInfo.isUniform && i === l && e.shapeInfo.flatOffset == null && gt.util.arraysEqual(s, o)) return `
      float ` + a + `() {
        return sampleTexture(` + r + `, resultUV);
      }
    `;
    var u2 = $s(l), c = Oq(e.shapeInfo.logicalShape, t.logicalShape), f = l - i, h, p = ["x", "y", "z", "w", "u", "v"];
    i === 0 ? h = "" : l < 2 && c.length >= 1 ? h = "coords = 0;" : h = c.map(function(v) {
      return "coords." + p[v + f] + " = 0;";
    }).join(`
`);
    var d = "";
    return l < 2 && i > 0 ? d = "coords" : d = e.shapeInfo.logicalShape.map(function(v, m) {
      return "coords." + p[m + f];
    }).join(", "), `
    float ` + a + `() {
      ` + u2 + ` coords = getOutputCoords();
      ` + h + `
      return get` + n + "(" + d + `);
    }
  `;
  }
  function $s(e) {
    if (e <= 1) return "int";
    if (e === 2) return "ivec2";
    if (e === 3) return "ivec3";
    if (e === 4) return "ivec4";
    if (e === 5) return "ivec5";
    if (e === 6) return "ivec6";
    throw Error("GPU for rank " + e + " is not yet supported");
  }
  function F62(e, t, r) {
    var n = gt.util.squeezeShape(t), a = n.newShape, o = n.keptDims, s = t.length, i = e && s === 3 && t[0] === 1, l = i ? t.slice(1) : a, u2 = !e && s > 1 && !gt.util.arraysEqual(t, r) && a.length < s || i, c = u2 ? l : t;
    return { useSqueezeShape: u2, uniformShape: c, keptDims: o };
  }
  function Yy(e, t) {
    var r = JSON.parse(JSON.stringify(e));
    return r.shapeInfo.logicalShape = t, r;
  }
  function Zy(e, t) {
    return t.map(function(r) {
      return e[r];
    }).join(", ");
  }
  function Fze(e, t, r, n) {
    var a = r.map(function(_4, k) {
      var T2 = { logicalShape: _4.shape, texShape: _4.isUniform ? null : _4.texData.texShape, isUniform: _4.isUniform, isPacked: _4.isUniform ? false : _4.texData.isPacked, flatOffset: null };
      return _4.texData != null && _4.texData.slice != null && _4.texData.slice.flatOffset > 0 && (T2.flatOffset = _4.texData.slice.flatOffset), { name: t.variableNames[k], shapeInfo: T2 };
    }), o = a.map(function(_4) {
      return _4.shapeInfo;
    }), s = { logicalShape: n.shape, texShape: n.texData.texShape, isUniform: false, isPacked: n.texData.isPacked, flatOffset: null }, i = Z9e(a, s, t), l = hq(e.gl, i), u2 = e.createProgram(l), c = null, f = e.getUniformLocation(u2, "NAN", false);
    gt.env().getNumber("WEBGL_VERSION") === 1 && (c = e.getUniformLocation(u2, "INFINITY", false));
    for (var h = false, p = {}, d = {}, v = {}, m = 0; m < t.variableNames.length; m++) {
      var g = t.variableNames[m];
      p[g] = e.getUniformLocation(u2, g, h), p["offset" + g] = e.getUniformLocation(u2, "offset" + g, h), t.enableShapeUniforms && (d[g + "Shape"] = e.getUniformLocation(u2, g + "Shape", h), v[g + "TexShape"] = e.getUniformLocation(u2, g + "TexShape", h));
    }
    var x, b, y;
    t.enableShapeUniforms && (x = e.getUniformLocation(u2, "outShape", h), y = e.getUniformLocation(u2, "outShapeStrides", h), b = e.getUniformLocation(u2, "outTexShape", h));
    var w = [];
    return t.customUniforms && t.customUniforms.forEach(function(_4, k) {
      w[k] = e.getUniformLocation(u2, _4.name, h);
    }), { program: t, fragmentShader: l, source: i, webGLProgram: u2, uniformLocations: p, customUniformLocations: w, inShapeInfos: o, outShapeInfo: s, infLoc: c, nanLoc: f, inShapesLocations: d, inTexShapesLocations: v, outShapeLocation: x, outShapeStridesLocation: y, outTexShapeLocation: b };
  }
  function RH(e, t) {
    if (e.length !== t.length) throw Error("Binary was compiled with " + e.length + " inputs, but " + ("was executed with " + t.length + " inputs"));
    e.forEach(function(r, n) {
      var a = r.logicalShape, o = t[n], s = o.shape;
      if (!gt.util.arraysEqual(a, s)) throw Error("Binary was compiled with different shapes than " + ("the current args. Shapes " + a + " and " + s + " must match"));
      if (!(r.isUniform && o.isUniform)) {
        var i = r.texShape, l = o.isUniform ? null : o.texData.texShape;
        if (!gt.util.arraysEqual(i, l)) throw Error("Binary was compiled with different texture shapes than the" + (" current args. Shape " + i + " and " + l + " must match"));
      }
    });
  }
  function Oze(e, t, r, n, a) {
    t.program.enableShapeUniforms || (RH(t.inShapeInfos, r), RH([t.outShapeInfo], [n]));
    var o = n.texData.texture, s = n.texData.texShape;
    n.texData.isPacked ? e.setOutputPackedMatrixTexture(o.texture, s[0], s[1]) : e.setOutputMatrixTexture(o.texture, s[0], s[1]), e.setProgram(t.webGLProgram), gt.env().getNumber("WEBGL_VERSION") === 1 && t.infLoc !== null && e.gl.uniform1f(t.infLoc, 1 / 0), t.nanLoc !== null && e.gl.uniform1f(t.nanLoc, NaN), r.forEach(function(u2, c) {
      var f = t.program.variableNames[c], h = t.uniformLocations[f], p = t.uniformLocations["offset" + f], d = t.inShapesLocations[f + "Shape"], v = t.inTexShapesLocations[f + "TexShape"];
      if (d) {
        var m = F62(t.program.packedInputs, u2.shape, u2.texData.texShape).uniformShape;
        switch (m.length) {
          case 1:
            e.gl.uniform1iv(d, new Int32Array(m));
            break;
          case 2:
            e.gl.uniform2iv(d, new Int32Array(m));
            break;
          case 3:
            e.gl.uniform3iv(d, new Int32Array(m));
            break;
          case 4:
            e.gl.uniform4iv(d, new Int32Array(m));
            break;
        }
      }
      if (v && e.gl.uniform2i(v, u2.texData.texShape[0], u2.texData.texShape[1]), h != null) {
        if (u2.isUniform) {
          if (gt.util.sizeFromShape(u2.shape) < 2) e.gl.uniform1f(h, u2.uniformValues[0]);
          else {
            var g = u2.uniformValues;
            g instanceof Float32Array || (g = new Float32Array(g)), e.gl.uniform1fv(h, g);
          }
          return;
        }
        u2.texData.slice != null && p != null && e.gl.uniform1i(p, u2.texData.slice.flatOffset), e.setInputMatrixTexture(u2.texData.texture.texture, h, c);
      }
    });
    var i = t.outShapeLocation;
    if (i) switch (n.shape.length) {
      case 1:
        e.gl.uniform1iv(i, new Int32Array(n.shape));
        break;
      case 2:
        e.gl.uniform2iv(i, new Int32Array(n.shape));
        break;
      case 3:
        e.gl.uniform3iv(i, new Int32Array(n.shape));
        break;
      case 4:
        e.gl.uniform4iv(i, new Int32Array(n.shape));
        break;
    }
    if (t.outShapeStridesLocation) {
      var l = gt.util.computeStrides(n.shape);
      switch (n.shape.length) {
        case 2:
          e.gl.uniform1iv(t.outShapeStridesLocation, new Int32Array(l));
          break;
        case 3:
          e.gl.uniform2iv(t.outShapeStridesLocation, new Int32Array(l));
          break;
        case 4:
          e.gl.uniform3iv(t.outShapeStridesLocation, new Int32Array(l));
          break;
      }
    }
    t.outTexShapeLocation && e.gl.uniform2i(t.outTexShapeLocation, n.texData.texShape[0], n.texData.texShape[1]), t.program.customUniforms && a && t.program.customUniforms.forEach(function(u2, c) {
      var f = t.customUniformLocations[c], h = a[c];
      if (u2.type === "float") e.gl.uniform1fv(f, h);
      else if (u2.type === "vec2") e.gl.uniform2fv(f, h);
      else if (u2.type === "vec3") e.gl.uniform3fv(f, h);
      else if (u2.type === "vec4") e.gl.uniform4fv(f, h);
      else if (u2.type === "int") e.gl.uniform1iv(f, h);
      else if (u2.type === "ivec2") e.gl.uniform2iv(f, h);
      else if (u2.type === "ivec3") e.gl.uniform3iv(f, h);
      else if (u2.type === "ivec4") e.gl.uniform4iv(f, h);
      else throw Error("uniform type " + u2.type + " is not supported yet.");
    }), e.executeProgram();
  }
  function Pze(e, t, r) {
    var n = "";
    t.concat(r).forEach(function(s) {
      var i = s.texData != null && s.texData.slice != null && s.texData.slice.flatOffset > 0;
      if (e.enableShapeUniforms && !s.isUniform) {
        var l = s.texData.texShape, u2 = F62(e.packedInputs, s.shape, l), c = u2.useSqueezeShape, f = u2.uniformShape, h = u2.keptDims, p = "", d = "", v = "";
        if (f.length === 1 && e.packedInputs) {
          var m = [Math.ceil(l[0] / 2), Math.ceil(l[1] / 2)];
          p = (m[0] > 1) + "_" + (m[1] > 1);
        } else if (f.length === 2 && !e.packedInputs) d = (f[0] > 1) + "_" + (f[1] > 1);
        else if (f.length > 2 && !e.packedInputs) {
          var g = gt.util.computeStrides(f);
          v = (g[0] === l[1]) + "_" + (g[g.length - 1] === l[1]);
        }
        var x = s.shape.length, b = f.length === 2 && gt.util.arraysEqual(s.shape, l), y = gt.util.sizeFromShape(s.shape) === 1, w = gt.backend_util.getBroadcastDims(s.shape, r.shape), _4 = !e.packedInputs && x === r.shape.length && gt.util.arraysEqual(l, r.texData.texShape), k = e.packedInputs || f.length > 2 ? "" : (l[0] > 1) + "_" + (l[1] > 1);
        n += x + "_" + _4 + "_" + (c ? h : "") + "_" + f.length + "_" + y + "_" + w + "_" + b + "_" + p + "_" + d + "_" + v + "_" + k + "_" + i;
      } else {
        var T2 = s.isUniform ? "uniform" : s.texData.texShape;
        n += s.shape + "_" + T2 + "_" + i;
      }
    });
    var a = e.userCode, o = e.constructor.name;
    return o += "_" + n + "_" + a + ("" + gt.env().getNumber("WEBGL_VERSION")), o;
  }
  function Bf(e) {
    return gt.env().getBool("WEBGL_USE_SHAPES_UNIFORMS") && e <= 4;
  }
  var Lze = /* @__PURE__ */ function() {
    function e(t) {
      this.variableNames = ["A"], this.packedInputs = false, this.packedOutput = true, this.outPackingScheme = X2.DENSE, this.customUniforms = [{ name: "texShape", type: "ivec2" }];
      var r = ff();
      this.outputShape = t, this.enableShapeUniforms = Bf(this.outputShape.length), this.userCode = `
      ivec3 outCoordsFromFlatIndex(int index) {
        ` + (this.enableShapeUniforms ? OT(["r", "c", "d"], t) : Mg(["r", "c", "d"], t)) + `
        return ivec3(r, c, d);
      }

      void main() {
        ivec2 resTexRC = ivec2(resultUV.yx * vec2(texShape[0], texShape[1]));
        int index = 4 * (resTexRC.x * texShape[1] + resTexRC.y);

        vec4 result = vec4(0.);

        for (int i=0; i<4; i++) {
          int flatIndex = index + i;
          ivec3 rc = outCoordsFromFlatIndex(flatIndex);
          result[i] = getA(rc.x, rc.y, rc.z);
        }

        ` + r.output + ` = result;
      }
    `;
    }
    return e;
  }();
  var Rze = /* @__PURE__ */ function() {
    function e(t) {
      this.variableNames = ["A"], this.packedInputs = true, this.packedOutput = true, this.outPackingScheme = X2.DENSE, this.customUniforms = [{ name: "texShape", type: "ivec2" }];
      var r = ff();
      this.outputShape = t, this.enableShapeUniforms = Bf(this.outputShape.length), this.userCode = `
      ivec3 outCoordsFromFlatIndex(int index) {
        ` + (this.enableShapeUniforms ? OT(["r", "c", "d"], t) : Mg(["r", "c", "d"], t)) + `
        return ivec3(r, c, d);
      }

      void main() {
        ivec2 resTexRC = ivec2(resultUV.yx * vec2(texShape[0], texShape[1]));
        int index = 4 * (resTexRC.x * texShape[1] + resTexRC.y);

        vec4 result = vec4(0.);

        for (int i=0; i<4; i++) {
          int flatIndex = index + i;
          ivec3 rc = outCoordsFromFlatIndex(flatIndex);
          result[i] = getChannel(getA(rc.x, rc.y, rc.z), vec2(rc.y, rc.z));
        }

        ` + r.output + ` = result;
      }
    `;
    }
    return e;
  }();
  var zze = /* @__PURE__ */ function() {
    function e(t) {
      this.variableNames = ["A"], this.outTexUsage = Rh.DOWNLOAD;
      var r = ff();
      this.outputShape = t, this.userCode = `
      ` + Fq + `

      void main() {
        float x = getAAtOutCoords();
        ` + r.output + ` = encode_float(x);
      }
    `;
    }
    return e;
  }();
  var Bze = /* @__PURE__ */ function() {
    function e(t) {
      this.variableNames = ["A"], this.packedInputs = true, this.packedOutput = false, this.outTexUsage = Rh.DOWNLOAD;
      var r = ff();
      this.outputShape = t, this.userCode = `
      ` + Fq + `

      void main() {
        ivec3 coords = getOutputCoords();
        float x = getChannel(getAAtOutCoords(), vec2(coords.y, coords.z));
        ` + r.output + ` = encode_float(x);
      }
    `;
    }
    return e;
  }();
  var Uze = /* @__PURE__ */ function() {
    function e(t, r) {
      r === void 0 && (r = false), this.variableNames = ["A"], this.customUniforms = [{ name: "texShape", type: "ivec2" }];
      var n = ff();
      this.outputShape = t, this.enableShapeUniforms = Bf(this.outputShape.length);
      var a = "result";
      r && (a = "floor(result * 255. + 0.5)"), this.userCode = `
      ` + (this.enableShapeUniforms ? N6() : I6(t)) + `

      void main() {
        ivec3 coords = getOutputCoords();

        int flatIndex = getFlatIndex(coords);
        int offset = imod(flatIndex, 4);

        flatIndex = idiv(flatIndex, 4, 1.);

        int r = flatIndex / texShape[1];
        int c = imod(flatIndex, texShape[1]);
        vec2 uv = (vec2(c, r) + halfCR) / vec2(texShape[1], texShape[0]);
        vec4 values = ` + n.texture2D + `(A, uv);

        float result;

        if(offset == 0) {
          result = values[0];
        } else if(offset == 1) {
          result = values[1];
        } else if(offset == 2) {
          result = values[2];
        } else {
          result = values[3];
        }

        ` + n.output + " = vec4(" + a + `, 0., 0., 0.);
      }
    `;
    }
    return e;
  }();
  var Vze = /* @__PURE__ */ function() {
    function e(t, r) {
      r === void 0 && (r = false), this.variableNames = ["A"], this.packedInputs = false, this.packedOutput = true, this.customUniforms = [{ name: "texShape", type: "ivec2" }];
      var n = ff();
      this.outputShape = t, this.enableShapeUniforms = Bf(this.outputShape.length);
      var a = "", o = "result";
      r && (o = "floor(result * 255. + 0.5)");
      for (var s = 0; s <= 1; s++) for (var i = 0; i <= 1; i++) {
        var l = s * 2 + i;
        a += `
          localCoords = coords;
          if(localCoords[2] + ` + i + " < " + (this.enableShapeUniforms ? "outShape[2]" : "" + t[2]) + `) {
          localCoords[2] += ` + i + `;
          if (localCoords[1] + ` + s + " < " + (this.enableShapeUniforms ? "outShape[1]" : "" + t[1]) + `) {
            localCoords[1] += ` + s + `;

            flatIndex = getFlatIndex(localCoords);
            offset = imod(flatIndex, 4);

            flatIndex = idiv(flatIndex, 4, 1.);

            int r = flatIndex / texShape[1];
            int c = imod(flatIndex, texShape[1]);
            vec2 uv = (vec2(c, r) + halfCR) / vec2(texShape[1], texShape[0]);
            values = ` + n.texture2D + `(A, uv);

            if (offset == 0) {
              result[` + l + `] = values[0];
            } else if (offset == 1) {
              result[` + l + `] = values[1];
            } else if (offset == 2) {
              result[` + l + `] = values[2];
            } else {
              result[` + l + `] = values[3];
            }
          }
        }
        `;
      }
      this.userCode = `
        ` + (this.enableShapeUniforms ? N6() : I6(t)) + `

        void main() {
          ivec3 coords = getOutputCoords();

          vec4 result = vec4(0.);
          int flatIndex, r, c, offset;
          ivec3 localCoords;
          vec2 uv;
          vec4 values;

          ` + a + `

          ` + n.output + " = " + o + `;
        }
    `;
    }
    return e;
  }();
  function Rq(e) {
    var t = ff(), r = t.version + `
    precision highp float;
    ` + t.attribute + ` vec3 clipSpacePos;
    ` + t.attribute + ` vec2 uv;
    ` + t.varyingVs + ` vec2 resultUV;

    void main() {
      gl_Position = vec4(clipSpacePos, 1);
      resultUV = uv;
    }`;
    return fq(e, r);
  }
  function zq(e) {
    var t = new Float32Array([-1, 1, 0, 0, 1, -1, -1, 0, 0, 0, 1, 1, 0, 1, 1, 1, -1, 0, 1, 0]);
    return vq(e, t);
  }
  function Bq(e) {
    var t = new Uint16Array([0, 1, 2, 2, 1, 3]);
    return mq(e, t);
  }
  function J2(e, t, r, n, a, o) {
    yq(t, r);
    var s = gq(e), i = e.TEXTURE_2D;
    return ai(e, function() {
      return e.bindTexture(i, s);
    }), ai(e, function() {
      return e.texParameteri(i, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE);
    }), ai(e, function() {
      return e.texParameteri(i, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE);
    }), ai(e, function() {
      return e.texParameteri(i, e.TEXTURE_MIN_FILTER, e.NEAREST);
    }), ai(e, function() {
      return e.texParameteri(i, e.TEXTURE_MAG_FILTER, e.NEAREST);
    }), gt.env().getNumber("WEBGL_VERSION") === 1 ? ai(e, function() {
      return e.texImage2D(i, 0, n, t, r, 0, a, o, null);
    }) : ai(e, function() {
      return e.texStorage2D(i, 1, n, t, r);
    }), ai(e, function() {
      return e.bindTexture(e.TEXTURE_2D, null);
    }), { texture: s, texShape: [r, t] };
  }
  function O6(e) {
    return e.internalFormatFloat;
  }
  function Uq(e, t, r, n) {
    var a = _i(Z2(t, r), 2), o = a[0], s = a[1];
    return J2(e, o, s, O6(n), n.textureFormatFloat, e.FLOAT);
  }
  function P6(e) {
    return e.internalFormatHalfFloat;
  }
  function Vq(e, t, r, n) {
    var a = _i(Z2(t, r), 2), o = a[0], s = a[1];
    return J2(e, o, s, P6(n), n.textureFormatFloat, n.textureTypeHalfFloat);
  }
  function L6(e) {
    return e.downloadTextureFormat;
  }
  function jq(e, t, r, n) {
    var a = _i(Z2(t, r), 2), o = a[0], s = a[1];
    return J2(e, o, s, L6(n), e.RGBA, e.UNSIGNED_BYTE);
  }
  function R6(e) {
    return e.internalFormatPackedFloat;
  }
  function Wq(e, t, r, n) {
    var a = _i(Hy(t, r), 2), o = a[0], s = a[1];
    return J2(e, o, s, R6(n), e.RGBA, e.FLOAT);
  }
  function z6(e) {
    return e.internalFormatPackedHalfFloat;
  }
  function Gq(e, t, r, n) {
    var a = _i(Hy(t, r), 2), o = a[0], s = a[1];
    return J2(e, o, s, z6(n), e.RGBA, n.textureTypeHalfFloat);
  }
  function $q(e, t, r) {
    var n = 0, a = 3 * 4, o = 3 * 4 + 2 * 4;
    ai(e, function() {
      return e.bindBuffer(e.ARRAY_BUFFER, r);
    });
    var s = k6(e, t, "clipSpacePos", r, 3, o, n);
    return s && k6(e, t, "uv", r, 2, o, a);
  }
  function Hq(e, t, r, n, a, o) {
    ai(e, function() {
      return e.bindTexture(e.TEXTURE_2D, t);
    });
    var s, i, l;
    a instanceof Uint8Array ? (s = new Uint8Array(r * n * 4), i = e.UNSIGNED_BYTE, l = e.RGBA) : (s = new Float32Array(r * n * 4), i = e.FLOAT, l = o.internalFormatPackedFloat), s.set(a), gt.env().getNumber("WEBGL_VERSION") === 2 ? ai(e, function() {
      return e.texSubImage2D(e.TEXTURE_2D, 0, 0, 0, r, n, e.RGBA, i, s);
    }) : ai(e, function() {
      return e.texImage2D(e.TEXTURE_2D, 0, l, r, n, 0, e.RGBA, i, s);
    }), ai(e, function() {
      return e.bindTexture(e.TEXTURE_2D, null);
    });
  }
  function qq(e, t, r) {
    ai(e, function() {
      return e.bindTexture(e.TEXTURE_2D, t);
    }), r.data instanceof Uint8Array ? gt.env().getNumber("WEBGL_VERSION") === 2 ? ai(e, function() {
      return e.texSubImage2D(e.TEXTURE_2D, 0, 0, 0, r.width, r.height, e.RGBA, e.UNSIGNED_BYTE, r.data);
    }) : ai(e, function() {
      return e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, r.width, r.height, 0, e.RGBA, e.UNSIGNED_BYTE, r.data);
    }) : gt.env().getNumber("WEBGL_VERSION") === 2 ? ai(e, function() {
      return e.texSubImage2D(e.TEXTURE_2D, 0, 0, 0, e.RGBA, e.UNSIGNED_BYTE, r);
    }) : ai(e, function() {
      return e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, e.RGBA, e.UNSIGNED_BYTE, r);
    }), ai(e, function() {
      return e.bindTexture(e.TEXTURE_2D, null);
    });
  }
  function Xq(e, t, r, n) {
    var a = e.createBuffer();
    ai(e, function() {
      return e.bindBuffer(e.PIXEL_PACK_BUFFER, a);
    });
    var o = 4, s = 4, i = o * s * t * r;
    return ai(e, function() {
      return e.bufferData(e.PIXEL_PACK_BUFFER, i, e.STREAM_READ);
    }), ai(e, function() {
      return e.readPixels(0, 0, r, t, e.RGBA, e.FLOAT, 0);
    }), ai(e, function() {
      return e.bindBuffer(e.PIXEL_PACK_BUFFER, null);
    }), a;
  }
  function Kq(e, t, r) {
    var n = e, a = new Float32Array(r);
    return n.bindBuffer(n.PIXEL_PACK_BUFFER, t), n.getBufferSubData(n.PIXEL_PACK_BUFFER, 0, a), n.bindBuffer(n.PIXEL_PACK_BUFFER, null), a;
  }
  function Yq(e, t, r, n) {
    var a = _i(Z2(t, r), 2), o = a[0], s = a[1], i = 4, l = new Uint8Array(P9e(t * r, i));
    return ai(e, function() {
      return e.readPixels(0, 0, o, s, n.downloadTextureFormat, e.UNSIGNED_BYTE, l);
    }), new Float32Array(l.buffer);
  }
  function Zq(e, t, r, n, a, o, s, i) {
    var l = e, u2 = new Float32Array(L9e(o, s));
    return l.bindBuffer(l.PIXEL_PACK_BUFFER, t), l.getBufferSubData(l.PIXEL_PACK_BUFFER, 0, u2), l.bindBuffer(l.PIXEL_PACK_BUFFER, null), u2;
  }
  function Jq(e, t, r) {
    var n = new Float32Array(t * r * 4);
    return ai(e, function() {
      return e.readPixels(0, 0, r, t, e.RGBA, e.FLOAT, n);
    }), n;
  }
  var jze = { __proto__: null, createVertexShader: Rq, createVertexBuffer: zq, createIndexBuffer: Bq, getInternalFormatForFloat32MatrixTexture: O6, createFloat32MatrixTexture: Uq, getInternalFormatForFloat16MatrixTexture: P6, createFloat16MatrixTexture: Vq, getInternalFormatForUnsignedBytesMatrixTexture: L6, createUnsignedBytesMatrixTexture: jq, getInternalFormatForPackedMatrixTexture: R6, createPackedMatrixTexture: Wq, getInternalFormatForFloat16PackedMatrixTexture: z6, createFloat16PackedMatrixTexture: Gq, bindVertexProgramAttributeStreams: $q, uploadDenseMatrixToTexture: Hq, uploadPixelDataToTexture: qq, createBufferFromOutputTexture: Xq, downloadFloat32MatrixFromBuffer: Kq, downloadByteEncodedFloatMatrixFromOutputTexture: Yq, downloadPackedMatrixFromBuffer: Zq, downloadMatrixFromPackedOutputTexture: Jq }, MT = function() {
    function e(t) {
      this.outputTexture = null, this.program = null, this.disposed = false, this.vertexAttrsAreBound = false, this.itemsToPoll = [];
      var r = gt.env().getNumber("WEBGL_VERSION");
      t != null ? (this.gl = t, lq(r, t)) : this.gl = dd(r);
      var n = "WEBGL_color_buffer_float", a = "EXT_color_buffer_half_float";
      if (gt.env().getNumber("WEBGL_VERSION") === 1) {
        var o = "OES_texture_float", s = "OES_texture_half_float";
        if (this.textureFloatExtension = $2(this.gl, o), zh(this.gl, s)) this.textureHalfFloatExtension = $2(this.gl, s);
        else if (gt.env().get("WEBGL_FORCE_F16_TEXTURES")) throw new Error("GL context does not support half float textures, yet the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.");
        if (this.colorBufferFloatExtension = this.gl.getExtension(n), zh(this.gl, a)) this.colorBufferHalfFloatExtension = $2(this.gl, a);
        else if (gt.env().get("WEBGL_FORCE_F16_TEXTURES")) throw new Error("GL context does not support color renderable half floats, yet the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.");
      } else if (n = "EXT_color_buffer_float", zh(this.gl, n)) this.colorBufferFloatExtension = this.gl.getExtension(n);
      else if (zh(this.gl, a)) this.colorBufferHalfFloatExtension = this.gl.getExtension(a);
      else throw new Error("GL context does not support color renderable floats");
      this.vertexBuffer = zq(this.gl), this.indexBuffer = Bq(this.gl), this.framebuffer = xq(this.gl), this.textureConfig = M6(this.gl, this.textureHalfFloatExtension);
    }
    return Object.defineProperty(e.prototype, "debug", { get: function() {
      return gt.env().getBool("DEBUG");
    }, enumerable: true, configurable: true }), e.prototype.dispose = function() {
      var t = this;
      if (!this.disposed) {
        this.program != null && console.warn("Disposing a GPGPUContext that still has a bound WebGLProgram. This is probably a resource leak, delete the program with GPGPUContext.deleteProgram before disposing."), this.outputTexture != null && console.warn("Disposing a GPGPUContext that still has a bound output matrix texture.  This is probably a resource leak, delete the output matrix texture with GPGPUContext.deleteMatrixTexture before disposing.");
        var r = this.gl;
        ai(r, function() {
          return r.finish();
        }), ai(r, function() {
          return r.bindFramebuffer(r.FRAMEBUFFER, null);
        }), ai(r, function() {
          return r.deleteFramebuffer(t.framebuffer);
        }), ai(r, function() {
          return r.bindBuffer(r.ARRAY_BUFFER, null);
        }), ai(r, function() {
          return r.bindBuffer(r.ELEMENT_ARRAY_BUFFER, null);
        }), ai(r, function() {
          return r.deleteBuffer(t.indexBuffer);
        }), this.disposed = true;
      }
    }, e.prototype.createFloat32MatrixTexture = function(t, r) {
      return this.throwIfDisposed(), Uq(this.gl, t, r, this.textureConfig);
    }, e.prototype.createFloat16MatrixTexture = function(t, r) {
      return this.throwIfDisposed(), Vq(this.gl, t, r, this.textureConfig);
    }, e.prototype.createUnsignedBytesMatrixTexture = function(t, r) {
      return this.throwIfDisposed(), jq(this.gl, t, r, this.textureConfig);
    }, e.prototype.uploadPixelDataToTexture = function(t, r) {
      this.throwIfDisposed(), qq(this.gl, t, r);
    }, e.prototype.uploadDenseMatrixToTexture = function(t, r, n, a) {
      this.throwIfDisposed(), Hq(this.gl, t, r, n, a, this.textureConfig);
    }, e.prototype.createFloat16PackedMatrixTexture = function(t, r) {
      return this.throwIfDisposed(), Gq(this.gl, t, r, this.textureConfig);
    }, e.prototype.createPackedMatrixTexture = function(t, r) {
      return this.throwIfDisposed(), Wq(this.gl, t, r, this.textureConfig);
    }, e.prototype.deleteMatrixTexture = function(t) {
      var r = this;
      this.throwIfDisposed(), this.outputTexture === t && (T6(this.gl, this.framebuffer), this.outputTexture = null), ai(this.gl, function() {
        return r.gl.deleteTexture(t);
      });
    }, e.prototype.downloadByteEncodedFloatMatrixFromOutputTexture = function(t, r, n) {
      var a = this;
      return this.downloadMatrixDriver(t, function() {
        return Yq(a.gl, r, n, a.textureConfig);
      });
    }, e.prototype.downloadPackedMatrixFromBuffer = function(t, r, n, a, o, s) {
      return Zq(this.gl, t, r, n, a, o, s, this.textureConfig);
    }, e.prototype.downloadFloat32MatrixFromBuffer = function(t, r) {
      return Kq(this.gl, t, r);
    }, e.prototype.createBufferFromTexture = function(t, r, n) {
      this.bindTextureToFrameBuffer(t);
      var a = Xq(this.gl, r, n, this.textureConfig);
      return this.unbindTextureToFrameBuffer(), a;
    }, e.prototype.createAndWaitForFence = function() {
      var t = this.createFence(this.gl);
      return this.pollFence(t);
    }, e.prototype.createFence = function(t) {
      var r = this, n, a;
      if (gt.env().getBool("WEBGL_FENCE_API_ENABLED")) {
        var o = t, s = o.fenceSync(o.SYNC_GPU_COMMANDS_COMPLETE, 0);
        t.flush(), a = function() {
          var i = o.clientWaitSync(s, 0, 0);
          return i === o.ALREADY_SIGNALED || i === o.CONDITION_SATISFIED;
        }, n = s;
      } else gt.env().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION") > 0 ? (n = this.beginQuery(), this.endQuery(), a = function() {
        return r.isQueryAvailable(n, gt.env().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"));
      }) : a = function() {
        return true;
      };
      return { query: n, isFencePassed: a };
    }, e.prototype.downloadMatrixFromPackedTexture = function(t, r, n) {
      var a = this;
      return this.downloadMatrixDriver(t, function() {
        return Jq(a.gl, r, n);
      });
    }, e.prototype.createProgram = function(t) {
      var r = this;
      this.throwIfDisposed();
      var n = this.gl;
      this.vertexShader == null && (this.vertexShader = Rq(n));
      var a = pq(n);
      return ai(n, function() {
        return n.attachShader(a, r.vertexShader);
      }), ai(n, function() {
        return n.attachShader(a, t);
      }), dq(n, a), this.debug && AT(n, a), this.vertexAttrsAreBound || (this.setProgram(a), this.vertexAttrsAreBound = $q(n, this.program, this.vertexBuffer)), a;
    }, e.prototype.deleteProgram = function(t) {
      var r = this;
      this.throwIfDisposed(), t === this.program && (this.program = null), t != null && ai(this.gl, function() {
        return r.gl.deleteProgram(t);
      });
    }, e.prototype.setProgram = function(t) {
      var r = this;
      this.throwIfDisposed(), this.program = t, this.program != null && this.debug && AT(this.gl, this.program), ai(this.gl, function() {
        return r.gl.useProgram(t);
      });
    }, e.prototype.getUniformLocation = function(t, r, n) {
      return n === void 0 && (n = true), this.throwIfDisposed(), n ? _q(this.gl, t, r) : wq(this.gl, t, r);
    }, e.prototype.getAttributeLocation = function(t, r) {
      var n = this;
      return this.throwIfDisposed(), ai(this.gl, function() {
        return n.gl.getAttribLocation(t, r);
      });
    }, e.prototype.getUniformLocationNoThrow = function(t, r) {
      return this.throwIfDisposed(), this.gl.getUniformLocation(t, r);
    }, e.prototype.setInputMatrixTexture = function(t, r, n) {
      this.throwIfDisposed(), this.throwIfNoProgram(), kq(this.gl, t, r, n);
    }, e.prototype.setOutputMatrixTexture = function(t, r, n) {
      this.setOutputMatrixTextureDriver(t, n, r);
    }, e.prototype.setOutputPackedMatrixTexture = function(t, r, n) {
      this.throwIfDisposed();
      var a = _i(Hy(r, n), 2), o = a[0], s = a[1];
      this.setOutputMatrixTextureDriver(t, o, s);
    }, e.prototype.setOutputMatrixWriteRegion = function(t, r, n, a) {
      this.setOutputMatrixWriteRegionDriver(n, t, a, r);
    }, e.prototype.setOutputPackedMatrixWriteRegion = function(t, r, n, a) {
      throw new Error("setOutputPackedMatrixWriteRegion not implemented.");
    }, e.prototype.debugValidate = function() {
      this.program != null && AT(this.gl, this.program), H2(this.gl);
    }, e.prototype.executeProgram = function() {
      this.throwIfDisposed(), this.throwIfNoProgram();
      var t = this.gl;
      this.debug && this.debugValidate(), ai(t, function() {
        return t.drawElements(t.TRIANGLES, 6, t.UNSIGNED_SHORT, 0);
      });
    }, e.prototype.blockUntilAllProgramsCompleted = function() {
      var t = this;
      this.throwIfDisposed(), ai(this.gl, function() {
        return t.gl.finish();
      });
    }, e.prototype.getQueryTimerExtension = function() {
      return this.disjointQueryTimerExtension == null && (this.disjointQueryTimerExtension = $2(this.gl, gt.env().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION") === 2 ? "EXT_disjoint_timer_query_webgl2" : "EXT_disjoint_timer_query")), this.disjointQueryTimerExtension;
    }, e.prototype.getQueryTimerExtensionWebGL2 = function() {
      return this.getQueryTimerExtension();
    }, e.prototype.getQueryTimerExtensionWebGL1 = function() {
      return this.getQueryTimerExtension();
    }, e.prototype.beginQuery = function() {
      if (gt.env().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION") === 2) {
        var t = this.gl, r = this.getQueryTimerExtensionWebGL2(), n = t.createQuery();
        return t.beginQuery(r.TIME_ELAPSED_EXT, n), n;
      }
      var a = this.getQueryTimerExtensionWebGL1(), o = a.createQueryEXT();
      return a.beginQueryEXT(a.TIME_ELAPSED_EXT, o), o;
    }, e.prototype.endQuery = function() {
      if (gt.env().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION") === 2) {
        var t = this.gl, r = this.getQueryTimerExtensionWebGL2();
        t.endQuery(r.TIME_ELAPSED_EXT);
        return;
      }
      var n = this.getQueryTimerExtensionWebGL1();
      n.endQueryEXT(n.TIME_ELAPSED_EXT);
    }, e.prototype.waitForQueryAndGetTime = function(t) {
      return kT(this, void 0, void 0, function() {
        var r = this;
        return TT(this, function(n) {
          switch (n.label) {
            case 0:
              return [4, gt.util.repeatedTry(function() {
                return r.disposed || r.isQueryAvailable(t, gt.env().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"));
              })];
            case 1:
              return n.sent(), [2, this.getQueryTime(t, gt.env().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))];
          }
        });
      });
    }, e.prototype.getQueryTime = function(t, r) {
      if (r === 0) return null;
      if (r === 2) {
        var n = this.gl, a = n.getQueryParameter(t, n.QUERY_RESULT);
        return a / 1e6;
      } else {
        var o = this.getQueryTimerExtensionWebGL1(), a = o.getQueryObjectEXT(t, o.QUERY_RESULT_EXT);
        return a / 1e6;
      }
    }, e.prototype.isQueryAvailable = function(t, r) {
      if (r === 0) return true;
      if (r === 2) {
        var n = this.gl, a = this.getQueryTimerExtensionWebGL2(), o = n.getQueryParameter(t, n.QUERY_RESULT_AVAILABLE);
        return this.disjoint == null && (this.disjoint = this.gl.getParameter(a.GPU_DISJOINT_EXT)), o && !this.disjoint;
      } else {
        var a = this.getQueryTimerExtensionWebGL1(), o = a.getQueryObjectEXT(t, a.QUERY_RESULT_AVAILABLE_EXT);
        return this.disjoint == null && (this.disjoint = this.gl.getParameter(a.GPU_DISJOINT_EXT)), o && !this.disjoint;
      }
    }, e.prototype.pollFence = function(t) {
      var r = this;
      return new Promise(function(n) {
        r.addItemToPoll(function() {
          return t.isFencePassed();
        }, function() {
          return n();
        });
      });
    }, e.prototype.pollItems = function() {
      for (var t = Wze(this.itemsToPoll.map(function(a) {
        return a.isDoneFn;
      })), r = 0; r <= t; ++r) {
        var n = this.itemsToPoll[r].resolveFn;
        n();
      }
      this.itemsToPoll = this.itemsToPoll.slice(t + 1);
    }, e.prototype.addItemToPoll = function(t, r) {
      var n = this;
      this.itemsToPoll.push({ isDoneFn: t, resolveFn: r }), !(this.itemsToPoll.length > 1) && gt.util.repeatedTry(function() {
        return n.pollItems(), n.itemsToPoll.length === 0;
      });
    }, e.prototype.bindTextureToFrameBuffer = function(t) {
      this.throwIfDisposed(), ST(this.gl, t, this.framebuffer), this.debug && H2(this.gl);
    }, e.prototype.unbindTextureToFrameBuffer = function() {
      this.outputTexture != null ? (ST(this.gl, this.outputTexture, this.framebuffer), this.debug && H2(this.gl)) : T6(this.gl, this.framebuffer);
    }, e.prototype.downloadMatrixDriver = function(t, r) {
      this.bindTextureToFrameBuffer(t);
      var n = r();
      return this.unbindTextureToFrameBuffer(), n;
    }, e.prototype.setOutputMatrixTextureDriver = function(t, r, n) {
      this.throwIfDisposed();
      var a = this.gl;
      ST(a, t, this.framebuffer), this.debug && H2(a), this.outputTexture = t, ai(a, function() {
        return a.viewport(0, 0, r, n);
      }), ai(a, function() {
        return a.scissor(0, 0, r, n);
      });
    }, e.prototype.setOutputMatrixWriteRegionDriver = function(t, r, n, a) {
      var o = this;
      this.throwIfDisposed(), ai(this.gl, function() {
        return o.gl.scissor(t, r, n, a);
      });
    }, e.prototype.throwIfDisposed = function() {
      if (this.disposed) throw new Error("Attempted to use disposed GPGPUContext.");
    }, e.prototype.throwIfNoProgram = function() {
      if (this.program == null) throw new Error("No GPU program is currently set.");
    }, e;
  }();
  function Wze(e) {
    for (var t = 0; t < e.length; ++t) {
      var r = e[t]();
      if (!r) break;
    }
    return t - 1;
  }
  function Gze(e) {
    for (var t = new Float32Array(e.length), r = 0; r < e.length; ++r) t[r] = Math.abs(e[r]);
    return t;
  }
  function vd(e) {
    return function(t, r, n, a, o) {
      var s = gt.backend_util.assertAndGetBroadcastShape(t, r), i = s.length, l = gt.util.computeStrides(s), u2 = gt.util.sizeFromShape(s), c = gt.util.getTypedArrayFromDType(o, u2), f = t.length, h = r.length, p = gt.util.computeStrides(t), d = gt.util.computeStrides(r), v = gt.backend_util.getBroadcastDims(t, s), m = gt.backend_util.getBroadcastDims(r, s);
      if (v.length + m.length === 0) for (var g = 0; g < c.length; ++g) c[g] = e(n[g % n.length], a[g % a.length]);
      else for (var x = function(b) {
        var y = gt.util.indexToLoc(b, i, l), w = y.slice(-f);
        v.forEach(function(A2) {
          return w[A2] = 0;
        });
        var _4 = gt.util.locToIndex(w, f, p), k = y.slice(-h);
        m.forEach(function(A2) {
          return k[A2] = 0;
        });
        var T2 = gt.util.locToIndex(k, h, d);
        c[b] = e(n[_4], a[T2]);
      }, g = 0; g < c.length; ++g) x(g);
      return [c, s];
    };
  }
  var $ze = vd(function(e, t) {
    return e + t;
  });
  function Hze(e, t, r, n, a) {
    for (var o = gt.util.sizeFromShape(n), s = gt.util.makeZerosTypedArray(a, r), i = 0; i < e.length; i++) {
      var l = e[i];
      if (l < 0) throw new Error("Input x must be non-negative!");
      l >= a || (o > 0 ? s[l] += t[i] : s[l] += 1);
    }
    return s;
  }
  function qze(e, t, r, n) {
    n === void 0 && (n = false);
    for (var a = e.shape[0], o = e.shape[1], s = gt.buffer([a, r], t.dtype), i = 0; i < a; i++) for (var l = 0; l < o; l++) {
      var u2 = e.get(i, l);
      if (u2 < 0) throw new Error("Input x must be non-negative!");
      u2 >= r || (n ? s.set(1, i, u2) : t.size > 0 ? s.set(s.get(i, u2) + t.get(i, l), i, u2) : s.set(s.get(i, u2) + 1, i, u2));
    }
    return s;
  }
  function Bv(e) {
    return function(t, r, n) {
      for (var a = gt.util.getTypedArrayFromDType(r, t.length), o = 0; o < t.length; ++o) a[o] = e(t[o], n);
      return a;
    };
  }
  var Xze = Bv(function(e) {
    return Math.ceil(e);
  });
  function Kze(e, t, r, n) {
    var a = gt.util.getArrayFromDType(r, gt.util.sizeFromShape(t));
    if (n && r !== "string") {
      var o = 0;
      e.forEach(function(i) {
        var l = gt.util.sizeFromShape(i.shape);
        a.set(i.vals, o), o += l;
      });
    } else {
      var s = 0;
      e.forEach(function(i) {
        for (var l = r === "string" ? gt.backend_util.fromUint8ToStringArray(i.vals) : i.vals, u2 = 0, c = 0; c < i.shape[0]; ++c) for (var f = c * t[1] + s, h = 0; h < i.shape[1]; ++h) a[f + h] = l[u2++];
        s += i.shape[1];
      });
    }
    return a;
  }
  var Yze = vd(function(e, t) {
    return e === t ? 1 : 0;
  });
  var Zze = Bv(function(e) {
    return Math.exp(e);
  });
  var Jze = Bv(function(e) {
    return Math.expm1(e);
  });
  var Qze = Bv(function(e) {
    return Math.floor(e);
  });
  function eBe(e, t, r, n, a, o, s, i, l) {
    for (var u2 = gt.buffer([n, o], r), c = 0; c < n; c++) {
      for (var f = [], h = 0, p = 0; p < a; p++) {
        var d = e[c * a + p];
        h += d * s[p], f.push(d);
      }
      if (h < 0 || h >= l / o) throw new Error("Invalid indices: " + f + " does not index into " + i);
      for (var v = 0; v < o; v++) u2.values[c * o + v] = t.get.apply(t, uf(t.indexToLoc(h * o + v)));
    }
    return u2;
  }
  function tBe(e, t, r) {
    for (var n = gt.buffer(r, e.dtype), a = 0; a < n.size; ++a) {
      var o = n.indexToLoc(a), s = o.slice(), i = s[0], l = s[2], u2 = t.locToIndex([i, l]);
      s[2] = t.values[u2];
      var c = e.locToIndex(s);
      0 <= c && c < e.values.length && (n.values[a] = e.values[c]);
    }
    return n;
  }
  var rBe = vd(function(e, t) {
    return e > t ? 1 : 0;
  });
  var nBe = vd(function(e, t) {
    return e >= t ? 1 : 0;
  });
  var aBe = vd(function(e, t) {
    return e < t ? 1 : 0;
  });
  var iBe = vd(function(e, t) {
    return e <= t ? 1 : 0;
  });
  function oBe(e, t, r) {
    var n = (t - e) / (r - 1), a = gt.util.makeZerosTypedArray(r, "float32");
    a[0] = e;
    for (var o = 1; o < a.length; o++) a[o] = a[o - 1] + n;
    return a;
  }
  var sBe = Bv(function(e) {
    return Math.log(e);
  });
  function lBe(e, t, r, n) {
    for (var a = gt.util.getTypedArrayFromDType(n, gt.util.sizeFromShape(r)), o = 0; o < a.length; ++o) {
      for (var s = o * t, i = e[s], l = 0; l < t; ++l) {
        var u2 = e[s + l];
        (Number.isNaN(u2) || u2 > i) && (i = u2);
      }
      a[o] = i;
    }
    return a;
  }
  var uBe = vd(function(e, t) {
    return Math.max(e, t);
  });
  var cBe = vd(function(e, t) {
    return Math.min(e, t);
  });
  var Qq = vd(function(e, t) {
    return e * t;
  });
  function fBe(e, t, r) {
    var n = gt.util.createScalarValue(-1, r);
    return Qq([], t, n, e, r);
  }
  var hBe = vd(function(e, t) {
    return e !== t ? 1 : 0;
  });
  function pBe(e, t, r, n, a) {
    for (var o = t.length, s = gt.util.sizeFromShape(t), i = gt.util.computeStrides(t), l = gt.util.computeStrides(a), u2 = gt.util.getTypedArrayFromDType(r, gt.util.sizeFromShape(a)), c = 0; c < s; ++c) {
      for (var f = gt.util.indexToLoc(c, o, i), h = new Array(f.length), p = 0; p < h.length; p++) h[p] = f[n[p]];
      var d = gt.util.locToIndex(h, o, l);
      u2[d] = e[c];
    }
    return u2;
  }
  function dBe(e, t, r, n) {
    for (var a = _i(gt.backend_util.computeOutAndReduceShapes(e, n), 2), o = a[0], s = a[1], i = gt.upcastType(t, "int32"), l = gt.util.makeZerosTypedArray(gt.util.sizeFromShape(o), i), u2 = gt.util.sizeFromShape(s), c = 0; c < l.length; ++c) {
      for (var f = c * u2, h = 1, p = 0; p < u2; ++p) h *= r[f + p];
      l[c] = h;
    }
    return { outVals: l, outShape: o, outDtype: i };
  }
  function vBe(e, t, r, n) {
    var a = e === t, o = e < t && r < 0, s = t < e && r > 1;
    if (a || o || s) return gt.util.makeZerosTypedArray(0, n);
    var i = Math.abs(Math.ceil((t - e) / r)), l = gt.util.makeZerosTypedArray(i, n);
    t < e && r === 1 && (r = -1), l[0] = e;
    for (var u2 = 1; u2 < l.length; u2++) l[u2] = l[u2 - 1] + r;
    return l;
  }
  var mBe = Bv(function(e) {
    return 1 / Math.sqrt(e);
  });
  var gBe = Bv(function(e) {
    return 1 / (1 + Math.exp(-e));
  });
  function yBe(e, t, r, n, a) {
    var o = gt.slice_util.isSliceContinous(n, t, r), s = gt.util.sizeFromShape(r), i = gt.util.computeStrides(n);
    if (o) {
      var l = gt.slice_util.computeFlatOffset(t, i);
      return a === "string" ? e.slice(l, l + s) : e.subarray(l, l + s);
    }
    for (var u2 = a === "string" ? gt.backend_util.fromUint8ToStringArray(e) : e, c = gt.buffer(n, a, u2), f = gt.buffer(r, a), h = 0; h < f.size; ++h) {
      var p = f.indexToLoc(h), d = p.map(function(v, m) {
        return v + t[m];
      });
      f.set.apply(f, uf([c.get.apply(c, uf(d))], p));
    }
    return a === "string" ? gt.backend_util.fromStringArrayToUint8(f.values) : f.values;
  }
  function xBe(e, t, r, n, a, o, s) {
    var i = t[0], l = o[0], u2 = new Array(l), c = new Array(i), f = t[1];
    if (l === 0) {
      if (i !== 0) throw new Error(gt.backend_util.getSparseFillEmptyRowsIndicesDenseShapeMismatch(i));
      var h = gt.util.getArrayFromDType(r, 0), p = gt.util.getArrayFromDType(a, 0);
      return [h, [0, f], p, u2, c];
    }
    for (var d = true, v = 0, m = new Array(l).fill(0), g = 0; g < i; ++g) {
      var x = e[g * f];
      if (x < 0) throw new Error(gt.backend_util.getSparseFillEmptyRowsNegativeIndexErrorMessage(g, x));
      if (x >= l) throw new Error(gt.backend_util.getSparseFillEmptyRowsOutOfRangeIndexErrorMessage(g, x, l));
      ++m[x], d = d && x >= v, v = x;
    }
    for (var b = true, x = 0; x < l; ++x) {
      var y = m[x] === 0;
      u2[x] = y, b = b && !y, m[x] = Math.max(m[x], 1), x > 0 && (m[x] += m[x - 1]);
    }
    if (b && d) {
      for (var h = e, p = n, g = 0; g < i; ++g) c[g] = g;
      return [h, [i, f], p, u2, c];
    } else {
      for (var w = m[l - 1], h = gt.util.getArrayFromDType(r, w * f), p = gt.util.getArrayFromDType(a, w), _4 = new Array(l).fill(0), g = 0; g < i; ++g) {
        var x = e[g * f], k = _4[x], T2 = (x === 0 ? 0 : m[x - 1]) + k;
        _4[x]++;
        for (var A2 = 0; A2 < f; ++A2) h[T2 * f + A2] = e[g * f + A2];
        p[T2] = n[g], c[g] = T2;
      }
      for (var x = 0; x < l; ++x) {
        var S2 = _4[x];
        if (S2 === 0) {
          var C2 = x === 0 ? 0 : m[x - 1];
          h[C2 * f + 0] = x;
          for (var E2 = 1; E2 < f; ++E2) h[C2 * f + E2] = 0;
          p[C2] = s;
        }
      }
      return [h, [w, f], p, u2, c];
    }
  }
  function bBe(e, t, r, n, a) {
    for (var o = gt.util.sizeFromShape(n), s = t[0], i = a.length, l = [], u2 = 1, c = -1, f = 0; f < i; ++f) {
      var h = a[f];
      if (h === -1) {
        if (c !== -1) throw new Error(gt.backend_util.getSparseReshapeMultipleNegativeOneOutputDimErrorMessage(c, f));
        c = f, l.push(1);
      } else {
        if (h < 0) throw new Error(gt.backend_util.getSparseReshapeNegativeOutputDimErrorMessage(f, h));
        u2 *= h, l.push(h);
      }
    }
    if (c !== -1) {
      if (u2 <= 0) throw new Error(gt.backend_util.getSparseReshapeEmptyTensorZeroOutputDimErrorMessage());
      var p = Math.trunc(o / u2);
      if (u2 * p !== o) throw new Error(gt.backend_util.getSparseReshapeInputOutputMultipleErrorMessage(n, l));
      l[c] = p;
    }
    var d = gt.util.sizeFromShape(l);
    if (d !== o) throw new Error(gt.backend_util.getSparseReshapeInputOutputMismatchErrorMessage(n, l));
    var v = n.length, m = [];
    if (v > 0) {
      m[v - 1] = 1;
      for (var f = v - 2; f >= 0; --f) m[f] = m[f + 1] * n[f + 1];
    }
    var g = [];
    if (i > 0) {
      g[i - 1] = 1;
      for (var f = i - 2; f >= 0; --f) g[f] = g[f + 1] * l[f + 1];
    }
    for (var x = gt.util.getArrayFromDType(r, s * i), b = 0; b < s; ++b) {
      for (var y = 0, w = 0; w < v; ++w) y += e[b * v + w] * m[w];
      for (var w = 0; w < i; ++w) x[b * i + w] = Math.trunc(y / g[w]), y %= g[w];
    }
    return [x, [s, i], l];
  }
  function _Be(e, t, r, n, a, o, s) {
    o === void 0 && (o = false), s === void 0 && (s = 0);
    var i = n.length, l = [t[0], e.length / t[0]], u2 = l[1], c = i > 0 ? a[i - 1] + 1 : 0, f = c;
    if (f < 0) throw new Error(gt.backend_util.getSparseSegmentReductionNegativeSegmentIdsErrorMessage());
    var h = t.slice();
    h[0] = f;
    var p = h.reduce(function(k, T2) {
      return k * T2;
    }, 1), d = gt.util.getArrayFromDType(r, p);
    if (i === 0) return f > 0 && d.fill(s), [d, h];
    if (f <= 0) throw new Error(gt.backend_util.getSparseSegmentReductionNegativeSegmentIdsErrorMessage());
    for (var v = 0, m = 1, g = 0, x = a[v]; ; ) {
      var b = 0;
      if (m < i) {
        if (b = a[m], x === b) {
          ++m;
          continue;
        }
        if (x >= b) throw new Error(gt.backend_util.getSparseSegmentReductionNonIncreasingSegmentIdsErrorMessage());
      }
      if (x < 0 || x >= f) throw new Error(gt.backend_util.getSparseSegmentReductionSegmentIdOutOfRangeErrorMessage(x, f));
      x > g && d.fill(s, g * u2, x * u2);
      for (var y = v; y < m; ++y) {
        var w = n[y];
        if (w < 0 || w >= l[0]) throw new Error(gt.backend_util.getSparseSegmentReductionIndicesOutOfRangeErrorMessage(y, n[y], l[0]));
        for (var _4 = 0; _4 < u2; _4++) d[x * u2 + _4] += e[w * u2 + _4];
      }
      if (o) for (var _4 = 0; _4 < u2; _4++) d[x * u2 + _4] /= m - v;
      if (v = m, ++m, g = x + 1, x = b, m > i) break;
    }
    return g < f && d.fill(s, g * u2, f * u2), [d, h];
  }
  var wBe = Bv(function(e) {
    return Math.sqrt(e);
  });
  function kBe(e, t, r, n) {
    for (var a = gt.buffer(e, t.dtype), o = 0; o < a.size; o++) {
      for (var s = a.indexToLoc(o), i = new Array(s.length), l = 0; l < i.length; l++) i[l] = s[l] * r[l] + n[l];
      a.set.apply(a, uf([t.get.apply(t, uf(i))], s));
    }
    return a;
  }
  var TBe = function() {
    function e(t, r, n, a, o, s) {
      this.separator = gt.util.encodeString(t), this.nGramWidths = r, this.leftPad = gt.util.encodeString(n), this.rightPad = gt.util.encodeString(a), this.padWidth = o, this.preserveShort = s;
    }
    return e.prototype.getPadWidth = function(t) {
      return Math.min(this.padWidth < 0 ? t - 1 : this.padWidth, t - 1);
    }, e.prototype.getNumNGrams = function(t, r) {
      var n = this.getPadWidth(r);
      return Math.max(0, t + 2 * n - r + 1);
    }, e.prototype.createNGrams = function(t, r, n, a, o, s) {
      for (var i = function(c) {
        var f = l.getPadWidth(s), h = Math.max(0, f - c), p = Math.max(0, f - (o - (c + 1))), d = s - (h + p), v = r + (h > 0 ? 0 : c - f), m = 0;
        m += h * l.leftPad.length;
        for (var g = 0; g < d; ++g) m += t[v + g].length;
        m += p * l.rightPad.length;
        var x = h + p + d - 1;
        m += x * l.separator.length, n[a + c] = new Uint8Array(m);
        for (var b = n[a + c], y = 0, w = function(_4) {
          return _4.forEach(function(k) {
            return b[y++] = k;
          });
        }, g = 0; g < h; ++g) w(l.leftPad), w(l.separator);
        for (var g = 0; g < d - 1; ++g) w(t[v + g]), w(l.separator);
        if (d > 0) {
          w(t[v + d - 1]);
          for (var g = 0; g < p; ++g) w(l.separator), w(l.rightPad);
        } else {
          for (var g = 0; g < p - 1; ++g) w(l.rightPad), w(l.separator);
          w(l.rightPad);
        }
      }, l = this, u2 = 0; u2 < o; ++u2) i(u2);
    }, e.prototype.compute = function(t, r) {
      var n = this, a = t.length, o = r.length;
      if (o > 0) {
        var s = r[0];
        if (s !== 0) throw new Error("First split value must be 0, got " + s);
        for (var i = 1; i < o; ++i) {
          var l = r[i] >= s;
          if (l = l && r[i] <= a, !l) throw new Error("Invalid split value " + r[i] + ", must be in [" + s + ", " + a + "]");
          s = r[i];
        }
        if (s !== a) throw new Error("Last split value must be data size. Expected " + a + ", got " + s);
      }
      var u2 = o - 1, c = gt.util.getArrayFromDType("int32", o);
      if (a === 0 || o === 0) {
        for (var f = new Array(a), i = 0; i <= u2; ++i) c[i] = 0;
        return [f, c];
      }
      c[0] = 0;
      for (var h = function(g) {
        var x = r[g] - r[g - 1], b = 0;
        p.nGramWidths.forEach(function(y) {
          b += n.getNumNGrams(x, y);
        }), p.preserveShort && x > 0 && b === 0 && (b = 1), c[g] = c[g - 1] + b;
      }, p = this, i = 1; i <= u2; ++i) h(i);
      for (var d = new Array(c[u2]), v = function(g) {
        var x = r[g], b = c[g];
        if (m.nGramWidths.forEach(function(k) {
          var T2 = r[g + 1] - r[g], A2 = n.getNumNGrams(T2, k);
          n.createNGrams(t, x, d, b, A2, k), b += A2;
        }), m.preserveShort && b === c[g]) {
          var y = r[g + 1] - r[g];
          if (y === 0) return "continue";
          var w = y + 2 * m.padWidth, _4 = 1;
          m.createNGrams(t, x, d, b, _4, w);
        }
      }, m = this, i = 0; i < u2; ++i) v(i);
      return [d, c];
    }, e;
  }();
  function ABe(e, t, r, n, a, o, s, i) {
    return new TBe(r, n, a, o, s, i).compute(e, t);
  }
  function SBe(e, t, r, n) {
    if (!!e.length) {
      if (t.length === 0) {
        for (var a = 0; a < e.length; ++a) n.push(e.subarray(a, a + 1));
        return;
      }
      if (t.length === 1) {
        for (var o = t[0], s = e.indexOf(o); s !== -1; ) {
          var i = e.subarray(0, s);
          (!r || i.length !== 0) && n.push(i), e = e.subarray(s + 1), s = e.indexOf(o);
        }
        (!r || e.length !== 0) && n.push(e);
        return;
      }
      for (var l = 0, a = 0; a < e.length + 1; a++) if (a === e.length || t.indexOf(e[a]) !== -1) {
        var i = e.subarray(l, a);
        (!r || i.length !== 0) && n.push(i), l = a + 1;
      }
    }
  }
  function EBe(e, t, r) {
    for (var n = e.length, a = [], o = 0, s = 0, i = new Array(n), l = 0; l < n; ++l) {
      var u2 = a.length;
      SBe(e[l], t, r, a);
      var c = a.length - u2;
      i[l] = c, o += c, s = Math.max(s, c);
    }
    for (var f = gt.util.getArrayFromDType("int32", o * 2), h = new Array(o), p = [n, s], d = 0, l = 0; l < n; ++l) for (var v = 0; v < i[l]; ++v) f[d * 2] = l, f[d * 2 + 1] = v, h[d] = a[d], ++d;
    return [f, h, p];
  }
  function DBe(e, t) {
    for (var r = gt.util.getArrayFromDType("int32", e.length), n = 0; n < e.length; ++n) r[n] = gt.util.fingerPrint64(e[n]).modulo(t).getLowBitsUnsigned();
    return r;
  }
  var CBe = vd(function(e, t) {
    return e - t;
  });
  function MBe(e, t) {
    for (var r = new Array(e.rank), n = 0; n < r.length; n++) r[n] = e.shape[n] * t[n];
    for (var a = gt.buffer(r, e.dtype), n = 0; n < a.values.length; ++n) {
      for (var o = a.indexToLoc(n), s = new Array(e.rank), i = 0; i < s.length; i++) s[i] = o[i] % e.shape[i];
      var l = e.locToIndex(s);
      a.values[n] = e.values[l];
    }
    return a;
  }
  var q2 = function(e, t) {
    var r = t.value - e.value;
    return r === 0 ? e.index - t.index : r;
  };
  function eX(e, t, r, n) {
    for (r === void 0 && (r = 0), n === void 0 && (n = e.length - 1); n > r; ) {
      if (n - r > 600) {
        var a = n - r + 1, o = t - r + 1, s = Math.log(a), i = 0.5 * Math.exp(2 * s / 3), l = 0.5 * Math.sqrt(s * i * (a - i) / a) * Math.sign(o - a / 2), u2 = Math.max(r, Math.floor(t - o * i / a + l)), c = Math.min(n, Math.floor(t + (a - o) * i / a + l));
        eX(e, t, u2, c);
      }
      var f = e[t], h = r, p = n;
      for (gt.util.swap(e, r, t), q2(e[n], f) > 0 && gt.util.swap(e, r, n); h < p; ) {
        for (gt.util.swap(e, h, p), h++, p--; q2(e[h], f) < 0; ) h = h + 1;
        for (; q2(e[p], f) > 0; ) p = p - 1;
      }
      q2(e[r], f) === 0 ? gt.util.swap(e, r, p) : (p = p + 1, gt.util.swap(e, p, n)), p <= t && (r = p + 1), t <= p && (n = p - 1);
    }
  }
  function IBe(e, t, r, n, a) {
    for (var o = t[t.length - 1], s = _i([e.length / o, o], 2), i = s[0], l = s[1], u2 = gt.util.getTypedArrayFromDType(r, i * n), c = gt.util.getTypedArrayFromDType("int32", i * n), f = function(d) {
      var v = d * l, m = e.subarray(v, v + l), g = new Array(m.length);
      m.forEach(function(_4, k) {
        return g[k] = { value: _4, index: k };
      }), n < g.length && (eX(g, n), g = g.slice(0, n)), a && g.sort(q2);
      for (var x = d * n, b = u2.subarray(x, x + n), y = c.subarray(x, x + n), w = 0; w < n; w++) b[w] = g[w].value, y[w] = g[w].index;
    }, h = 0; h < i; h++) f(h);
    var p = t.slice();
    return p[p.length - 1] = n, [gt.buffer(p, r, u2), gt.buffer(p, "int32", c)];
  }
  function NBe(e, t, r, n) {
    for (var a = gt.util.parseAxisParam(t, r)[0], o = [1, r[0], 1], s = 0; s < a; s++) o[0] *= r[s];
    o[1] = r[a];
    for (var s = a + 1; s < r.length; s++) o[2] *= r[s];
    for (var i = {}, l = new Int32Array(r[a]), u2 = new gt.TensorBuffer(o, n, e), c = [], f = o[0] === 1 && o[2] === 1, s = 0; s < r[a]; s++) {
      var h = void 0;
      if (f) h = e[s].toString();
      else {
        for (var p = [], d = 0; d < o[0]; d++) for (var v = 0; v < o[2]; v++) p.push(u2.get(d, s, v));
        h = p.join(",");
      }
      if (i[h] !== void 0) l[s] = i[h];
      else {
        var m = Object.keys(i).length;
        i[h] = m, l[s] = m, c.push(s);
      }
    }
    var g = o.slice();
    g[1] = Object.keys(i).length;
    var x = new gt.TensorBuffer(g, n);
    c.forEach(function(y, w) {
      for (var _4 = 0; _4 < o[0]; _4++) for (var k = 0; k < o[2]; k++) x.set(u2.get(_4, y, k), _4, w, k);
    });
    var b = r.slice();
    return b[a] = g[1], { outputValues: x.values, outputShape: b, indices: l };
  }
  var FBe = $ze, tX = Hze, OBe = qze, PBe = Xze, LBe = Kze, RBe = Yze, zBe = Zze, BBe = Jze, UBe = Qze, VBe = eBe, jBe = tBe, WBe = rBe, GBe = nBe, $Be = aBe, HBe = iBe, qBe = oBe, XBe = sBe, KBe = lBe, YBe = uBe, ZBe = cBe, JBe = Qq, QBe = fBe, eUe = hBe, tUe = dBe, rUe = vBe, nUe = mBe, aUe = gBe, rX = Gze, iUe = yBe, oUe = xBe, sUe = bBe, nX = _Be, lUe = wBe, uUe = kBe, cUe = ABe, fUe = EBe, hUe = DBe, pUe = CBe, dUe = MBe, vUe = IBe, B6 = pBe, mUe = NBe;
  function aX(e, t) {
    return ["x", "y", "z", "w", "u", "v"].slice(0, t).map(function(r) {
      return e + "." + r;
    });
  }
  function lf(e, t) {
    return t === 1 ? [e] : aX(e, t);
  }
  function gUe(e, t) {
    if (e === 1) return "rc";
    for (var r = "", n = 0; n < e; n++) r += t[n], n < e - 1 && (r += ",");
    return r;
  }
  var yUe = function() {
    function e(t) {
      if (this.variableNames = ["A"], this.packedInputs = false, this.packedOutput = true, this.outputShape = t, this.rank = t.length, this.enableShapeUniforms = Bf(this.outputShape.length), this.rank === 0) this.userCode = `
        void main() {
          setOutput(vec4(getA(), 0., 0., 0.));
        }
      `;
      else {
        var r = lf("rc", this.rank), n = $s(this.rank), a = this.getOutOfBoundsCondition(r), o = this.getSetup(r), s = this.getOutput(r);
        this.userCode = `
        void main() {
          ` + n + ` rc = getOutputCoords();

          if(` + a + `) {
            setOutput(vec4(0));
          } else {
            ` + o + `

            setOutput(vec4(` + s + `));
          }
        }
      `;
      }
    }
    return e.prototype.getSourceCoordsArr = function(t) {
      for (var r = [], n = 0; n <= 1; n++) for (var a = 0; a <= 1; a++) {
        for (var o = (n === 0 ? "r" : "rp1") + ", " + (a === 0 ? "c" : "cp1"), s = 2; s < this.rank; s++) o = t[t.length - 1 - s] + "," + o;
        r.push(o);
      }
      return r;
    }, e.prototype.getOutOfBoundsCondition = function(t) {
      if (this.rank === 1) return "rc > " + (this.enableShapeUniforms ? "outShape" : this.outputShape[0]);
      for (var r = "", n = this.rank - 2; n < this.rank; n++) r += t[n] + " >= " + (this.enableShapeUniforms ? "outShape[" + n + "]" : this.outputShape[n]), n < this.rank - 1 && (r += "||");
      return r;
    }, e.prototype.getSetup = function(t) {
      if (this.rank === 1) return "";
      var r = t.slice(-2), n = this.enableShapeUniforms ? "outShape[" + this.rank + " - 1]" : this.outputShape[this.rank - 1], a = this.enableShapeUniforms ? "outShape[" + this.rank + " - 2]" : this.outputShape[this.rank - 2];
      return `
      int r = ` + r[0] + `;
      int c = ` + r[1] + `;
      int rp1 = r + 1;
      int cp1 = c + 1;

      bool cEdge = cp1 >= ` + n + `;
      bool rEdge = rp1 >= ` + a + `;
    `;
    }, e.prototype.getOutput = function(t) {
      var r = this.getSourceCoordsArr(t);
      if (this.rank === 1) {
        var n = this.enableShapeUniforms ? "outShape" : this.outputShape[0];
        return "getA(rc), (rc + 1 >= " + n + " ? 0. : getA(rc + 1)), 0, 0";
      }
      return "getA(" + r[0] + `),
            cEdge ? 0. : getA(` + r[1] + `),
            rEdge ? 0. : getA(` + r[2] + `),
            rEdge || cEdge ? 0. : getA(` + r[3] + ")";
    }, e;
  }();
  var iX = /* @__PURE__ */ function() {
    function e(t, r) {
      this.variableNames = ["A"], this.packedInputs = true, this.packedOutput = true, this.customUniforms = [{ name: "inputShape", type: "ivec3" }], this.outputShape = t, this.enableShapeUniforms = Bf(this.outputShape.length);
      for (var n = "", a = 0; a < 4; a++) {
        var o = "thisRC = rc;";
        a % 2 === 1 && (o += "thisRC.z += 1;"), a > 1 && (o += "thisRC.y += 1;"), n += `
        ` + o + `
        ` + (a > 0 ? "if(thisRC.y < rows && thisRC.z < cols){" : "") + `
          int flatIndex = getFlatIndex(thisRC);

          ivec3 inputRC = inputCoordsFromReshapedOutCoords(flatIndex);
          vec2 inputRCInnerDims = vec2(float(inputRC.y),float(inputRC.z));

          result[` + a + `] =
            getChannel(getA(inputRC.x, inputRC.y, inputRC.z), inputRCInnerDims);
        ` + (a > 0 ? "}" : "") + `
      `;
      }
      this.userCode = `
      ` + xUe(r, this.enableShapeUniforms) + `
      ` + (this.enableShapeUniforms ? N6() : I6(t)) + `

      void main() {
        ivec3 rc = getOutputCoords();

        vec4 result = vec4(0.);

        ivec3 thisRC;
        int rows = ` + (this.enableShapeUniforms ? "outShape[1]" : t[1]) + `;
        int cols = ` + (this.enableShapeUniforms ? "outShape[2]" : t[2]) + `;

        ` + n + `

        setOutput(result);
      }
    `;
    }
    return e;
  }();
  function xUe(e, t) {
    var r = t ? Y9e(["r", "c", "d"], "inputShape") : Mg(["r", "c", "d"], e);
    return `
    ivec3 inputCoordsFromReshapedOutCoords(int index) {
      ` + r + `
      return ivec3(r, c, d);
    }
  `;
  }
  var bUe = function() {
    function e(t) {
      this.gpgpu = t, this.numUsedTextures = 0, this.numFreeTextures = 0, this._numBytesAllocated = 0, this._numBytesFree = 0, this.freeTextures = {}, this.logEnabled = false, this.usedTextures = {};
    }
    return e.prototype.acquireTexture = function(t, r, n) {
      var a = BH(r, n), o = UH(t, a, n);
      o in this.freeTextures || (this.freeTextures[o] = []), o in this.usedTextures || (this.usedTextures[o] = []);
      var s = zH(t, a, this.gpgpu.gl, this.gpgpu.textureConfig, n);
      if (this.freeTextures[o].length > 0) {
        this.numFreeTextures--, this.numUsedTextures++, this._numBytesFree -= s, this.log();
        var i = this.freeTextures[o].shift();
        return this.usedTextures[o].push(i), i;
      }
      var l;
      return a === Dc.PACKED_2X2_FLOAT32 ? l = this.gpgpu.createPackedMatrixTexture(t[0], t[1]) : a === Dc.PACKED_2X2_FLOAT16 ? l = this.gpgpu.createFloat16PackedMatrixTexture(t[0], t[1]) : a === Dc.UNPACKED_FLOAT32 ? l = this.gpgpu.createFloat32MatrixTexture(t[0], t[1]) : a === Dc.UNPACKED_FLOAT16 ? l = this.gpgpu.createFloat16MatrixTexture(t[0], t[1]) : a === Dc.PACKED_4X1_UNSIGNED_BYTE && (l = this.gpgpu.createUnsignedBytesMatrixTexture(t[0], t[1])), this.usedTextures[o].push(l), this.numUsedTextures++, this._numBytesAllocated += s, this.log(), l;
    }, e.prototype.releaseTexture = function(t, r, n, a) {
      if (this.freeTextures != null) {
        var o = BH(n, a), s = UH(r, o, a);
        s in this.freeTextures || (this.freeTextures[s] = []);
        var i = zH(r, o, this.gpgpu.gl, this.gpgpu.textureConfig, a), l = gt.env().get("WEBGL_DELETE_TEXTURE_THRESHOLD");
        l !== -1 && this._numBytesAllocated > l ? (this.gpgpu.deleteMatrixTexture(t.texture), this._numBytesAllocated -= i) : (this.freeTextures[s].push(t), this.numFreeTextures++, this._numBytesFree += i), this.numUsedTextures--;
        var u2 = this.usedTextures[s], c = u2.indexOf(t);
        if (c < 0) throw new Error("Cannot release a texture that was never provided by this texture manager");
        u2.splice(c, 1), this.log();
      }
    }, e.prototype.log = function() {
      if (!!this.logEnabled) {
        var t = this.numFreeTextures + this.numUsedTextures;
        console.log("Free/Used", this.numFreeTextures + " / " + this.numUsedTextures, "(" + t + ")");
        var r = this._numBytesFree / this._numBytesAllocated;
        console.log("Bytes allocated: " + this._numBytesAllocated), console.log("Bytes unused: " + this._numBytesFree + " (" + Math.round(100 * r) + "%)");
      }
    }, Object.defineProperty(e.prototype, "numBytesAllocated", { get: function() {
      return this._numBytesAllocated;
    }, enumerable: true, configurable: true }), Object.defineProperty(e.prototype, "numBytesFree", { get: function() {
      return this._numBytesFree;
    }, enumerable: true, configurable: true }), e.prototype.getNumUsedTextures = function() {
      return this.numUsedTextures;
    }, e.prototype.getNumFreeTextures = function() {
      return this.numFreeTextures;
    }, e.prototype.dispose = function() {
      var t = this;
      if (this.freeTextures != null) {
        for (var r in this.freeTextures) this.freeTextures[r].forEach(function(n) {
          t.gpgpu.deleteMatrixTexture(n.texture);
        });
        for (var r in this.usedTextures) this.usedTextures[r].forEach(function(a) {
          t.gpgpu.deleteMatrixTexture(a.texture);
        });
        this.freeTextures = null, this.usedTextures = null, this.numUsedTextures = 0, this.numFreeTextures = 0, this._numBytesAllocated = 0, this._numBytesFree = 0;
      }
    }, e;
  }();
  function _Ue(e, t) {
    var r = e;
    if (t === r.R32F) return 4;
    if (t === r.R16F) return 2;
    if (t === r.RGBA32F) return 16;
    if (t === e.RGBA) return 16;
    if (t === r.RGBA16F) return 8;
    if (t === r.RGBA8) return 4;
    throw new Error("Unknown internal format " + t);
  }
  function zH(e, t, r, n, a) {
    var o = wUe(t, n), s;
    if (a) {
      var i = _i(Hy(e[0], e[1]), 2), l = i[0], u2 = i[1];
      s = l * u2;
    } else {
      var c = _i(Z2(e[0], e[1]), 2), f = c[0], h = c[1];
      s = f * h;
    }
    var p = _Ue(r, o);
    return s * p;
  }
  function wUe(e, t) {
    switch (e) {
      case Dc.PACKED_2X2_FLOAT32:
        return R6(t);
      case Dc.PACKED_2X2_FLOAT16:
        return z6(t);
      case Dc.UNPACKED_FLOAT32:
        return O6(t);
      case Dc.UNPACKED_FLOAT16:
        return P6(t);
      case Dc.PACKED_4X1_UNSIGNED_BYTE:
        return L6(t);
      default:
        throw new Error("Unknown physical texture type " + e);
    }
  }
  function kUe(e) {
    return gt.env().getBool("WEBGL_RENDER_FLOAT32_ENABLED") ? e ? Dc.PACKED_2X2_FLOAT32 : Dc.UNPACKED_FLOAT32 : e ? Dc.PACKED_2X2_FLOAT16 : Dc.UNPACKED_FLOAT16;
  }
  function BH(e, t) {
    if (e === Rh.UPLOAD) return Dc.PACKED_2X2_FLOAT32;
    if (e === Rh.RENDER || e == null) return kUe(t);
    if (e === Rh.DOWNLOAD || e === Rh.PIXELS) return Dc.PACKED_4X1_UNSIGNED_BYTE;
    throw new Error("Unknown logical texture type " + e);
  }
  function UH(e, t, r) {
    return e[0] + "_" + e[1] + "_" + t + "_" + r;
  }
  var C0 = /* @__PURE__ */ function() {
    function e(t, r) {
      this.variableNames = ["A"], this.outputShape = t, this.enableShapeUniforms = Bf(this.outputShape.length), this.userCode = `
      float unaryOperation(float x) {
        ` + r + `
      }

      void main() {
        float x = getAAtOutCoords();
        float y = unaryOperation(x);

        setOutput(y);
      }
    `;
    }
    return e;
  }(), bp = "if (isnan(x)) return x;", TUe = "return x;", VH = "return abs(x);", AUe = "return (x >= 0.0) ? x : (exp(x) - 1.0);", SUe = bp + `
  return (x < 0.0) ? 0.0 : x;
`, EUe = bp + `
  return (x < 0.0) ? 0.0 : min(6.0, x);
`, Vy = "return x;", DUe = "return 1.0 / (1.0 + exp(-1.0 * x));";
  var CUe = "return x;", MUe = `
  vec4 result;

  result.r = (x.r >= 0.0) ? x.r : (exp(x.r) - 1.0);
  result.g = (x.g >= 0.0) ? x.g : (exp(x.g) - 1.0);
  result.b = (x.b >= 0.0) ? x.b : (exp(x.b) - 1.0);
  result.a = (x.a >= 0.0) ? x.a : (exp(x.a) - 1.0);

  return result;
`, IUe = `
  vec4 result = x * vec4(greaterThanEqual(x, vec4(0.0)));
  bvec4 isNaN = isnan(x);

  result.r = isNaN.r ? x.r : result.r;
  result.g = isNaN.g ? x.g : result.g;
  result.b = isNaN.b ? x.b : result.b;
  result.a = isNaN.a ? x.a : result.a;

  return result;
`, NUe = `
  vec4 result = min(x, vec4(6.)) * vec4(greaterThanEqual(x, vec4(0.0)));
  bvec4 isNaN = isnan(x);

  result.r = isNaN.r ? x.r : result.r;
  result.g = isNaN.g ? x.g : result.g;
  result.b = isNaN.b ? x.b : result.b;
  result.a = isNaN.a ? x.a : result.a;

  return result;
`, FUe = "return 1.0 / (1.0 + exp(-1.0 * x));", Sg = /* @__PURE__ */ function() {
    function e(t, r) {
      this.variableNames = ["A"], this.packedInputs = true, this.packedOutput = true, this.outputShape = t, this.enableShapeUniforms = Bf(this.outputShape.length), this.userCode = `
      vec4 unaryOperation(vec4 x) {
        ` + r + `
      }

      void main() {
        vec4 x = getAAtOutCoords();
        vec4 y = unaryOperation(x);

        setOutput(y);
      }
    `;
    }
    return e;
  }();
  var OUe = /* @__PURE__ */ function() {
    function e(t) {
      this.variableNames = ["A"], this.packedInputs = true, this.packedOutput = false, this.outputShape = t, this.enableShapeUniforms = Bf(this.outputShape.length);
      var r = t.length, n = lf("rc", r), a = $s(r), o = gUe(r, n), s = n.slice(-2), i = r <= 1 ? "rc" : "vec2(" + s.join(",") + ")";
      this.userCode = `
      void main() {
        ` + a + ` rc = getOutputCoords();
        vec4 packedInput = getA(` + o + `);

        setOutput(getChannel(packedInput, ` + i + `));
      }
    `;
    }
    return e;
  }(), PUe = gt.kernel_impls.whereImpl, LUe = 1e-7, RUe = 1e-4, _T = {};
  function zUe(e) {
    return e in _T || (_T[e] = {}), _T[e];
  }
  var BUe = gt.env().getNumber("CPU_HANDOFF_SIZE_THRESHOLD"), UUe = 600;
  function VUe() {
    return gt.env().global.screen == null ? 1024 : gt.env().global.screen.height * gt.env().global.screen.width * window.devicePixelRatio * UUe / 1024 / 1024;
  }
  var U6 = function(e) {
    N9e(t, e);
    function t(r) {
      var n = e.call(this) || this;
      if (n.pendingRead = /* @__PURE__ */ new WeakMap(), n.pendingDisposal = /* @__PURE__ */ new WeakSet(), n.dataRefCount = /* @__PURE__ */ new WeakMap(), n.numBytesInGPU = 0, n.uploadWaitMs = 0, n.downloadWaitMs = 0, n.lastGlFlushTime = 0, n.warnedAboutMemory = false, n.pendingDeletes = 0, n.disposed = false, !gt.env().getBool("HAS_WEBGL")) throw new Error("WebGL is not supported on this device");
      var a;
      if (r != null) {
        if (r instanceof MT) a = r;
        else {
          var o = dd(gt.env().getNumber("WEBGL_VERSION"), r);
          a = new MT(o);
        }
        n.binaryCache = {}, n.gpgpuCreatedLocally = false;
      } else {
        var o = dd(gt.env().getNumber("WEBGL_VERSION"));
        a = new MT(o), n.binaryCache = zUe(gt.env().getNumber("WEBGL_VERSION")), n.gpgpuCreatedLocally = true;
      }
      return n.gpgpu = a, n.canvas = n.gpgpu.gl.canvas, n.textureManager = new bUe(n.gpgpu), n.numMBBeforeWarning = VUe(), n.texData = new gt.DataStorage(n, gt.engine()), n;
    }
    return t.prototype.nextDataId = function() {
      return t.nextDataId++;
    }, t.prototype.numDataIds = function() {
      return this.texData.numDataIds() - this.pendingDeletes;
    }, t.prototype.write = function(r, n, a) {
      if ((gt.env().getBool("WEBGL_CHECK_NUMERICAL_PROBLEMS") || gt.env().getBool("DEBUG")) && this.checkNumericalProblems(r), a === "complex64" && r != null) throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");
      var o = { id: this.nextDataId() };
      return this.texData.set(o, { shape: n, dtype: a, values: r, usage: Rh.UPLOAD, refCount: 1 }), o;
    }, t.prototype.refCount = function(r) {
      if (this.texData.has(r)) {
        var n = this.texData.get(r);
        return n.refCount;
      }
      return 0;
    }, t.prototype.incRef = function(r) {
      var n = this.texData.get(r);
      n.refCount++;
    }, t.prototype.decRef = function(r) {
      if (this.texData.has(r)) {
        var n = this.texData.get(r);
        n.refCount--;
      }
    }, t.prototype.move = function(r, n, a, o, s) {
      if (gt.env().getBool("DEBUG") && this.checkNumericalProblems(n), o === "complex64") throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");
      this.texData.set(r, { shape: a, dtype: o, values: n, usage: Rh.UPLOAD, refCount: s });
    }, t.prototype.disposeIntermediateTensorInfo = function(r) {
      this.disposeData(r.dataId);
    }, t.prototype.readSync = function(r) {
      var n = this.texData.get(r), a = n.values, o = n.dtype, s = n.complexTensorInfos, i = n.slice, l = n.shape, u2 = n.isPacked;
      if (i != null) {
        var c = void 0;
        u2 ? c = new Sg(l, Vy) : c = new C0(l, Vy);
        var f = this.runWebGLProgram(c, [{ dataId: r, shape: l, dtype: o }], o), h = this.readSync(f.dataId);
        return this.disposeIntermediateTensorInfo(f), h;
      }
      if (a != null) return this.convertAndCacheOnCPU(r);
      if (o === "string") return a;
      var p = this.activeTimers != null, d;
      p && (d = gt.util.now());
      var v;
      if (o === "complex64") {
        var m = this.readSync(s.real.dataId), g = this.readSync(s.imag.dataId);
        v = gt.backend_util.mergeRealAndImagArrays(m, g);
      } else v = this.getValuesFromTexture(r);
      return p && (this.downloadWaitMs += gt.util.now() - d), this.convertAndCacheOnCPU(r, v);
    }, t.prototype.read = function(r) {
      return kT(this, void 0, void 0, function() {
        var n, a, o, s, i, l, u2, c, f, h, p, d, v, m, g, x, b, y, w, _4, k, T2, A2;
        return TT(this, function(S2) {
          switch (S2.label) {
            case 0:
              if (this.pendingRead.has(r)) return n = this.pendingRead.get(r), [2, new Promise(function(C2) {
                return n.push(C2);
              })];
              if (a = this.texData.get(r), o = a.values, s = a.shape, i = a.slice, l = a.dtype, u2 = a.complexTensorInfos, c = a.isPacked, i != null) return f = void 0, c ? f = new Sg(s, Vy) : f = new C0(s, Vy), h = this.runWebGLProgram(f, [{ dataId: r, shape: s, dtype: l }], l), p = this.read(h.dataId), this.disposeIntermediateTensorInfo(h), [2, p];
              if (o != null) return [2, this.convertAndCacheOnCPU(r)];
              if (gt.env().getBool("DEBUG") && !gt.env().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED") && gt.env().getNumber("WEBGL_VERSION") === 2) throw new Error("tensor.data() with WEBGL_DOWNLOAD_FLOAT_ENABLED=false and WEBGL_VERSION=2 not yet supported.");
              return d = null, l !== "complex64" && gt.env().get("WEBGL_BUFFER_SUPPORTED") && (v = this.decode(r), m = this.texData.get(v.dataId), d = (A2 = this.gpgpu).createBufferFromTexture.apply(A2, uf([m.texture.texture], xT(s)))), this.pendingRead.set(r, []), l === "complex64" ? [3, 2] : [4, this.gpgpu.createAndWaitForFence()];
            case 1:
              S2.sent(), S2.label = 2;
            case 2:
              return l !== "complex64" ? [3, 4] : [4, Promise.all([this.read(u2.real.dataId), this.read(u2.imag.dataId)])];
            case 3:
              return x = S2.sent(), b = x[0], y = x[1], g = gt.backend_util.mergeRealAndImagArrays(b, y), [3, 5];
            case 4:
              d == null ? g = this.getValuesFromTexture(r) : (w = gt.util.sizeFromShape(s), g = this.gpgpu.downloadFloat32MatrixFromBuffer(d, w)), S2.label = 5;
            case 5:
              return v != null && this.disposeIntermediateTensorInfo(v), d != null && (_4 = this.gpgpu.gl, ai(_4, function() {
                return _4.deleteBuffer(d);
              })), k = this.convertAndCacheOnCPU(r, g), T2 = this.pendingRead.get(r), this.pendingRead.delete(r), T2.forEach(function(C2) {
                return C2(k);
              }), this.pendingDisposal.has(r) && (this.pendingDisposal.delete(r), this.disposeData(r) && gt.engine().removeDataId(r, this), this.pendingDeletes--), [2, k];
          }
        });
      });
    }, t.prototype.readToGPU = function(r, n) {
      n === void 0 && (n = {});
      var a = this.texData.get(r), o = a.values, s = a.shape, i = a.slice, l = a.dtype, u2 = a.isPacked, c = a.texture;
      if (l === "complex64") throw new Error("Does not support reading texture for complex64 dtype.");
      if (i != null) {
        var f = void 0;
        u2 ? f = new Sg(s, Vy) : f = new C0(s, Vy);
        var h = this.runWebGLProgram(f, [{ dataId: r, shape: s, dtype: l }], l), p = this.readToGPU(h, n);
        return this.disposeIntermediateTensorInfo(h), p;
      }
      if (c == null) throw o != null ? new Error("Data is not on GPU but on CPU.") : new Error("There is no data on GPU or CPU.");
      var d = this.decode(r, n.customTexShape), v = gt.engine().makeTensorFromDataId(d.dataId, d.shape, d.dtype), m = this.texData.get(d.dataId);
      return Object.assign({ tensorRef: v }, m.texture);
    }, t.prototype.bufferSync = function(r) {
      var n = this.readSync(r.dataId), a = n;
      if (r.dtype === "string") try {
        a = n.map(function(o) {
          return gt.util.decodeString(o);
        });
      } catch {
        throw new Error("Failed to decode encoded string bytes into utf-8");
      }
      return gt.buffer(r.shape, r.dtype, a);
    }, t.prototype.checkNumericalProblems = function(r) {
      if (r != null) for (var n = 0; n < r.length; n++) {
        var a = r[n];
        if (!uq(a)) throw gt.env().getBool("WEBGL_RENDER_FLOAT32_CAPABLE") ? Error("The value " + a + " cannot be represented with your current settings. Consider enabling float32 rendering: 'tf.env().set('WEBGL_RENDER_FLOAT32_ENABLED', true);'") : Error("The value " + a + " cannot be represented on this device.");
      }
    }, t.prototype.getValuesFromTexture = function(r) {
      var n, a = this.texData.get(r), o = a.shape, s = a.dtype, i = a.isPacked, l = gt.util.sizeFromShape(o);
      if (gt.env().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")) {
        var u2 = this.decode(r), c = this.texData.get(u2.dataId), f = (n = this.gpgpu).downloadMatrixFromPackedTexture.apply(n, uf([c.texture.texture], xT(o))).subarray(0, l);
        return this.disposeIntermediateTensorInfo(u2), f;
      }
      var h = gt.env().getBool("WEBGL_PACK") && i === true, p = h ? ET(o) : o, d = h ? new Bze(p) : new zze(p), v = this.runWebGLProgram(d, [{ shape: p, dtype: s, dataId: r }], "float32"), m = this.texData.get(v.dataId), g = this.gpgpu.downloadByteEncodedFloatMatrixFromOutputTexture(m.texture.texture, m.texShape[0], m.texShape[1]).subarray(0, l);
      return this.disposeIntermediateTensorInfo(v), g;
    }, t.prototype.timerAvailable = function() {
      return gt.env().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE") > 0;
    }, t.prototype.time = function(r) {
      var n = this, a = this.activeTimers, o = [], s = false;
      this.programTimersStack == null ? (this.programTimersStack = o, s = true) : this.activeTimers.push(o), this.activeTimers = o, r();
      var i = gt.util.flatten(this.activeTimers.map(function(c) {
        return c.query;
      })).filter(function(c) {
        return c != null;
      }), l = gt.util.flatten(this.activeTimers.map(function(c) {
        return c.name;
      })).filter(function(c) {
        return c != null;
      });
      this.activeTimers = a, s && (this.programTimersStack = null);
      var u2 = { uploadWaitMs: this.uploadWaitMs, downloadWaitMs: this.downloadWaitMs, kernelMs: null, wallMs: null };
      return function() {
        return kT(n, void 0, void 0, function() {
          var c;
          return TT(this, function(f) {
            switch (f.label) {
              case 0:
                return gt.env().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE") > 0 ? [4, Promise.all(i)] : [3, 2];
              case 1:
                return c = f.sent(), u2.kernelMs = gt.util.sum(c), u2.getExtraProfileInfo = function() {
                  return c.map(function(h, p) {
                    return { name: l[p], ms: h };
                  }).map(function(h) {
                    return h.name + ": " + h.ms;
                  }).join(", ");
                }, [3, 3];
              case 2:
                u2.kernelMs = { error: "WebGL query timers are not supported in this environment." }, f.label = 3;
              case 3:
                return this.uploadWaitMs = 0, this.downloadWaitMs = 0, [2, u2];
            }
          });
        });
      }();
    }, t.prototype.memory = function() {
      return { unreliable: false, numBytesInGPU: this.numBytesInGPU, numBytesInGPUAllocated: this.textureManager.numBytesAllocated, numBytesInGPUFree: this.textureManager.numBytesFree };
    }, t.prototype.startTimer = function() {
      return gt.env().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE") > 0 ? this.gpgpu.beginQuery() : { startMs: gt.util.now(), endMs: null };
    }, t.prototype.endTimer = function(r) {
      return gt.env().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE") > 0 ? (this.gpgpu.endQuery(), r) : (r.endMs = gt.util.now(), r);
    }, t.prototype.getQueryTime = function(r) {
      return kT(this, void 0, void 0, function() {
        var n;
        return TT(this, function(a) {
          return gt.env().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE") > 0 ? [2, this.gpgpu.waitForQueryAndGetTime(r)] : (n = r, [2, n.endMs - n.startMs]);
        });
      });
    }, t.prototype.disposeData = function(r, n) {
      if (n === void 0 && (n = false), this.pendingDisposal.has(r)) return false;
      if (!this.texData.has(r)) return true;
      if (n ? this.texData.get(r).refCount = 0 : this.texData.get(r).refCount--, !n && this.texData.get(r).refCount > 0) return false;
      if (this.pendingRead.has(r)) return this.pendingDisposal.add(r), this.pendingDeletes++, false;
      this.releaseGPUData(r);
      var a = this.texData.get(r).complexTensorInfos;
      return a != null && (this.disposeData(a.real.dataId, n), this.disposeData(a.imag.dataId, n)), this.texData.delete(r), true;
    }, t.prototype.releaseGPUData = function(r) {
      var n = this.texData.get(r), a = n.texture, o = n.dtype, s = n.texShape, i = n.usage, l = n.isPacked, u2 = n.slice, c = u2 && u2.origDataId || r, f = this.dataRefCount.get(c);
      f > 1 ? this.dataRefCount.set(c, f - 1) : (this.dataRefCount.delete(c), a != null && (this.numBytesInGPU -= this.computeBytes(s, o), this.textureManager.releaseTexture(a, s, i, l)));
      var h = this.texData.get(r);
      h.texture = null, h.texShape = null, h.isPacked = false, h.slice = null;
    }, t.prototype.getTexture = function(r) {
      return this.uploadToGPU(r), this.texData.get(r).texture.texture;
    }, t.prototype.getDataInfo = function(r) {
      return this.texData.get(r);
    }, t.prototype.shouldExecuteOnCPU = function(r, n) {
      var a = this;
      return n === void 0 && (n = BUe), gt.env().getBool("WEBGL_CPU_FORWARD") && r.every(function(o) {
        return a.texData.get(o.dataId).texture == null && gt.util.sizeFromShape(o.shape) < n;
      });
    }, t.prototype.getGPGPUContext = function() {
      return this.gpgpu;
    }, t.prototype.where = function(r) {
      gt.backend_util.warn("tf.where() in webgl locks the UI thread. Call tf.whereAsync() instead");
      var n = r.dataSync();
      return PUe(r.shape, n);
    }, t.prototype.packedUnaryOp = function(r, n, a) {
      var o = new Sg(r.shape, n), s = this.compileAndRun(o, [r], a);
      return gt.engine().makeTensorFromDataId(s.dataId, s.shape, s.dtype);
    }, t.prototype.abs = function(r) {
      if (this.shouldExecuteOnCPU([r]) && r.dtype !== "complex64") {
        var n = rX(this.texData.get(r.dataId).values);
        return this.makeOutput(r.shape, r.dtype, n);
      }
      if (gt.env().getBool("WEBGL_PACK_UNARY_OPERATIONS")) return this.packedUnaryOp(r, VH, r.dtype);
      var a = new C0(r.shape, VH), o = this.compileAndRun(a, [r]);
      return gt.engine().makeTensorFromDataId(o.dataId, o.shape, o.dtype);
    }, t.prototype.makeTensorInfo = function(r, n, a) {
      var o;
      if (n === "string" && a != null && a.length > 0 && gt.util.isString(a[0])) {
        var s = a.map(function(i) {
          return gt.util.encodeString(i);
        });
        o = this.write(s, r, n);
      } else o = this.write(a, r, n);
      return this.texData.get(o).usage = null, { dataId: o, shape: r, dtype: n };
    }, t.prototype.makeOutput = function(r, n, a) {
      var o = this.makeTensorInfo(r, n, a).dataId;
      return gt.engine().makeTensorFromDataId(o, r, n, this);
    }, t.prototype.unpackTensor = function(r) {
      var n = new OUe(r.shape);
      return this.runWebGLProgram(n, [r], r.dtype);
    }, t.prototype.packTensor = function(r) {
      var n = new yUe(r.shape), a = true;
      return this.runWebGLProgram(n, [r], r.dtype, null, a);
    }, t.prototype.packedReshape = function(r, n) {
      var a = uf([Dg(r.shape)], Cg(r.shape)), o = { dtype: r.dtype, shape: a, dataId: r.dataId }, s = uf([Dg(n)], Cg(n)), i = new iX(s, a), l = true, u2 = [a], c = this.runWebGLProgram(i, [o], r.dtype, u2, l);
      return { dataId: c.dataId, shape: n, dtype: c.dtype };
    }, t.prototype.decode = function(r, n) {
      var a = this.texData.get(r), o = a.isPacked, s = a.shape, i = a.dtype;
      if (n != null) {
        var l = gt.util.sizeFromShape(s), u2 = n[0] * n[1] * 4;
        gt.util.assert(l <= u2, function() {
          return "customTexShape is too small. Row * Column * 4 should be equal or larger than the size of the tensor data.";
        });
      }
      var c = ET(s), f;
      o ? f = new Rze(c) : f = new Lze(c);
      var h = true, p = [n ?? xT(c)], d = this.runWebGLProgram(f, [{ shape: c, dtype: i, dataId: r }], i, p, h, n);
      return { dtype: i, shape: s, dataId: d.dataId };
    }, t.prototype.runWebGLProgram = function(r, n, a, o, s, i) {
      var l = this;
      s === void 0 && (s = false);
      var u2 = this.makeTensorInfo(r.outputShape, a), c = this.texData.get(u2.dataId);
      if (r.packedOutput && (c.isPacked = true), r.outPackingScheme === X2.DENSE) {
        var f = i ?? xT(r.outputShape);
        c.texShape = f.map(function(_4) {
          return _4 * 2;
        });
      }
      if (r.outTexUsage != null && (c.usage = r.outTexUsage), gt.util.sizeFromShape(u2.shape) === 0) return c.values = gt.util.getTypedArrayFromDType(u2.dtype, 0), u2;
      var h = [], p = n.map(function(_4) {
        if (_4.dtype === "complex64") throw new Error("GPGPUProgram does not support complex64 input. For complex64 dtypes, please separate the program into real and imaginary parts.");
        var k = l.texData.get(_4.dataId);
        if (k.texture == null) {
          if (!r.packedInputs && gt.util.sizeFromShape(_4.shape) <= gt.env().getNumber("WEBGL_SIZE_UPLOAD_UNIFORM")) return { shape: _4.shape, texData: null, isUniform: true, uniformValues: k.values };
          r.packedInputs && (k.isPacked = true, k.shape = _4.shape);
        }
        if (l.uploadToGPU(_4.dataId), !!k.isPacked != !!r.packedInputs) _4 = k.isPacked ? l.unpackTensor(_4) : l.packTensor(_4), h.push(_4), k = l.texData.get(_4.dataId);
        else if (k.isPacked && !K2(k.shape, _4.shape)) {
          var T2 = _4, A2 = _4.shape;
          _4.shape = k.shape, _4 = l.packedReshape(_4, A2), h.push(_4), k = l.texData.get(_4.dataId), T2.shape = A2;
        }
        return { shape: _4.shape, texData: k, isUniform: false };
      });
      this.uploadToGPU(u2.dataId);
      var d = { shape: u2.shape, texData: c, isUniform: false }, v = Pze(r, p, d), m = this.getAndSaveBinary(v, function() {
        return Fze(l.gpgpu, r, p, d);
      }), g = this.activeTimers != null, x;
      g && (x = this.startTimer()), Oze(this.gpgpu, m, p, d, o), h.forEach(function(_4) {
        return l.disposeIntermediateTensorInfo(_4);
      }), g && (x = this.endTimer(x), this.activeTimers.push({ name: r.constructor.name, query: this.getQueryTime(x) }));
      var b = gt.env().get("WEBGL_FLUSH_THRESHOLD");
      if (b > 0) {
        var y = gt.util.now();
        y - this.lastGlFlushTime > b && (this.gpgpu.gl.flush(), this.lastGlFlushTime = y);
      }
      if (!gt.env().getBool("WEBGL_LAZILY_UNPACK") && c.isPacked && s === false) {
        var w = this.unpackTensor(u2);
        return this.disposeIntermediateTensorInfo(u2), w;
      }
      return u2;
    }, t.prototype.compileAndRun = function(r, n, a, o, s) {
      s === void 0 && (s = false), a = a || n[0].dtype;
      var i = this.runWebGLProgram(r, n, a, o, s);
      return i;
    }, t.prototype.getAndSaveBinary = function(r, n) {
      return r in this.binaryCache || (this.binaryCache[r] = n()), this.binaryCache[r];
    }, t.prototype.getTextureManager = function() {
      return this.textureManager;
    }, t.prototype.dispose = function() {
      var r = this;
      if (!this.disposed) {
        if (!gt.env().getBool("IS_TEST")) {
          var n = Object.keys(this.binaryCache);
          n.forEach(function(a) {
            r.gpgpu.deleteProgram(r.binaryCache[a].webGLProgram), delete r.binaryCache[a];
          });
        }
        this.textureManager.dispose(), this.canvas != null && typeof HTMLCanvasElement < "u" && this.canvas instanceof HTMLCanvasElement ? this.canvas.remove() : this.canvas = null, this.gpgpuCreatedLocally && (this.gpgpu.program = null, this.gpgpu.dispose()), this.disposed = true;
      }
    }, t.prototype.floatPrecision = function() {
      var r = this;
      return this.floatPrecisionValue == null && (this.floatPrecisionValue = gt.tidy(function() {
        if (!gt.env().get("WEBGL_RENDER_FLOAT32_ENABLED")) {
          var n = gt.env().getBool("DEBUG");
          gt.env().set("DEBUG", false);
          var a = r.abs(gt.scalar(1e-8)).dataSync()[0];
          if (gt.env().set("DEBUG", n), a > 0) return 32;
        }
        return 16;
      })), this.floatPrecisionValue;
    }, t.prototype.epsilon = function() {
      return this.floatPrecision() === 32 ? LUe : RUe;
    }, t.prototype.uploadToGPU = function(r) {
      var n, a = this.texData.get(r), o = a.shape, s = a.dtype, i = a.values, l = a.texture, u2 = a.usage, c = a.isPacked;
      if (l == null) {
        var f = this.activeTimers != null, h;
        f && (h = gt.util.now());
        var p = a.texShape;
        if (p == null && (p = Sq(o, c), a.texShape = p), i != null) {
          var d = ET(o), v = void 0, m = p[1], g = p[0], x = i instanceof Uint8Array || i instanceof Uint8ClampedArray;
          (c || !x) && (n = _i(Hy(p[0], p[1]), 2), m = n[0], g = n[1]), c ? v = new Vze(d, x) : v = new Uze(d, x);
          var b = x ? [g, m] : p, y = this.makeTensorInfo(b, s), w = this.texData.get(y.dataId);
          x ? w.usage = Rh.PIXELS : w.usage = Rh.UPLOAD, w.texShape = b, this.gpgpu.uploadDenseMatrixToTexture(this.getTexture(y.dataId), m, g, i);
          var _4 = [[g, m]], k = true, T2 = this.runWebGLProgram(v, [y], s, _4, k), A2 = this.texData.get(T2.dataId);
          a.texture = A2.texture, a.texShape = A2.texShape, a.isPacked = A2.isPacked, a.usage = A2.usage, this.disposeIntermediateTensorInfo(y), this.texData.delete(T2.dataId), a.values = null, f && (this.uploadWaitMs += gt.util.now() - h);
        } else {
          var S2 = this.acquireTexture(p, u2, s, c);
          a.texture = S2;
        }
      }
    }, t.prototype.convertAndCacheOnCPU = function(r, n) {
      var a = this.texData.get(r), o = a.dtype;
      return this.releaseGPUData(r), n != null && (a.values = jUe(n, o)), a.values;
    }, t.prototype.acquireTexture = function(r, n, a, o) {
      if (this.numBytesInGPU += this.computeBytes(r, a), !this.warnedAboutMemory && this.numBytesInGPU > this.numMBBeforeWarning * 1024 * 1024) {
        var s = (this.numBytesInGPU / 1024 / 1024).toFixed(2);
        this.warnedAboutMemory = true, console.warn("High memory usage in GPU: " + s + " MB, most likely due to a memory leak");
      }
      return this.textureManager.acquireTexture(r, n, o);
    }, t.prototype.computeBytes = function(r, n) {
      return r[0] * r[1] * gt.util.bytesPerElement(n);
    }, t;
  }(gt.KernelBackend);
  U6.nextDataId = 0;
  function jUe(e, t) {
    if (t === "float32" || t === "complex64") return e;
    if (t === "int32" || t === "bool") {
      for (var r = t === "int32" ? new Int32Array(e.length) : new Uint8Array(e.length), n = 0; n < r.length; ++n) r[n] = Math.round(e[n]);
      return r;
    } else throw new Error("Unknown dtype " + t);
  }
  var WUe = "3.13.0";
  function oX() {
    gt.env().set("WEBGL_FORCE_F16_TEXTURES", true);
  }
  gt.device_util.isBrowser() && gt.registerBackend("webgl", function() {
    return new U6();
  }, 2);
  var GUe = { forceHalfFloat: oX };
  var sX = `
  if (isnan(a)) return a;
  if (isnan(b)) return b;
`, $y = /* @__PURE__ */ function() {
    function e(t, r, n) {
      this.variableNames = ["A", "B"], this.outputShape = gt.backend_util.assertAndGetBroadcastShape(r, n), this.enableShapeUniforms = Bf(this.outputShape.length), this.userCode = `
      float binaryOperation(float a, float b) {
        ` + t + `
      }

      void main() {
        float a = getAAtOutCoords();
        float b = getBAtOutCoords();
        setOutput(binaryOperation(a, b));
      }
    `;
    }
    return e;
  }();
  var PT = `
  result.r = isNaN.r > 0. ? NAN : result.r;
  result.g = isNaN.g > 0. ? NAN : result.g;
  result.b = isNaN.b > 0. ? NAN : result.b;
  result.a = isNaN.a > 0. ? NAN : result.a;
`, Q2 = /* @__PURE__ */ function() {
    function e(t, r, n, a) {
      a === void 0 && (a = false), this.variableNames = ["A", "B"], this.supportsBroadcasting = true, this.packedInputs = true, this.packedOutput = true, this.outputShape = gt.backend_util.assertAndGetBroadcastShape(r, n);
      var o = this.outputShape.length;
      this.enableShapeUniforms = Bf(o);
      var s = "";
      if (a) if (o === 0 || gt.util.sizeFromShape(this.outputShape) === 1) s = `
          result.y = 0.;
          result.z = 0.;
          result.w = 0.;
        `;
      else {
        var i = $s(o);
        if (s = `
          ` + i + ` coords = getOutputCoords();
        `, o === 1) this.enableShapeUniforms ? s += `
            result.y = (coords + 1) >= outShape ? 0. : result.y;
            result.z = 0.;
            result.w = 0.;
          ` : s += `
            result.y = (coords + 1) >= ` + this.outputShape[0] + ` ? 0. : result.y;
            result.z = 0.;
            result.w = 0.;
          `;
        else {
          var l = lf("coords", o);
          this.enableShapeUniforms ? s += `
            bool nextRowOutOfBounds =
              (` + l[o - 2] + " + 1) >= outShape[" + o + ` - 2];
            bool nextColOutOfBounds =
              (` + l[o - 1] + " + 1) >= outShape[" + o + ` - 1];
            result.y = nextColOutOfBounds ? 0. : result.y;
            result.z = nextRowOutOfBounds ? 0. : result.z;
            result.w = nextColOutOfBounds || nextRowOutOfBounds ? 0. : result.w;
          ` : s += `
            bool nextRowOutOfBounds =
              (` + l[o - 2] + " + 1) >= " + this.outputShape[o - 2] + `;
            bool nextColOutOfBounds =
              (` + l[o - 1] + " + 1) >= " + this.outputShape[o - 1] + `;
            result.y = nextColOutOfBounds ? 0. : result.y;
            result.z = nextRowOutOfBounds ? 0. : result.z;
            result.w = nextColOutOfBounds || nextRowOutOfBounds ? 0. : result.w;
          `;
        }
      }
      this.userCode = `
      vec4 binaryOperation(vec4 a, vec4 b) {
        ` + t + `
      }

      void main() {
        vec4 a = getAAtOutCoords();
        vec4 b = getBAtOutCoords();

        vec4 result = binaryOperation(a, b);
        ` + s + `

        setOutput(result);
      }
    `;
    }
    return e;
  }();
  function hh(e) {
    var t = e.inputs, r = e.backend, n = t.x;
    return r.incRef(n.dataId), { dataId: n.dataId, shape: n.shape, dtype: n.dtype };
  }
  var $Ue = { kernelName: gt.Identity, backendName: "webgl", kernelFunc: hh };
  function Uv(e) {
    var t = e.inputs, r = e.backend, n = t.real, a = t.imag, o = r.makeTensorInfo(n.shape, "complex64"), s = r.texData.get(o.dataId), i = hh({ inputs: { x: n }, backend: r }), l = hh({ inputs: { x: a }, backend: r });
    return s.complexTensorInfos = { real: i, imag: l }, o;
  }
  var HUe = { kernelName: gt.Complex, backendName: "webgl", kernelFunc: Uv };
  var lX = "return (a < 0.) ? b * a : a;", uX = `
  vec4 aLessThanZero = vec4(lessThan(a, vec4(0.)));
  return (aLessThanZero * (b * a)) + ((vec4(1.0) - aLessThanZero) * a);
`;
  function qUe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.alpha, s = r.makeTensorInfo([], "float32", gt.util.createScalarValue(o, "float32")), i = gt.env().getBool("WEBGL_PACK_BINARY_OPERATIONS") ? new Q2(uX, a.shape, s.shape) : new $y(lX, a.shape, s.shape), l = r.runWebGLProgram(i, [a, s], "float32");
    return r.disposeIntermediateTensorInfo(s), l;
  }
  var XUe = { kernelName: gt.LeakyRelu, backendName: "webgl", kernelFunc: qUe };
  var cX = "return (a < 0.) ? b * a : a;", fX = `
  vec4 aLessThanZero = vec4(lessThan(a, vec4(0.)));
  return (aLessThanZero * (b * a)) + ((vec4(1.0) - aLessThanZero) * a);
`;
  function KUe(e) {
    var t = e.inputs, r = e.backend, n = t.x, a = t.alpha, o = gt.env().getBool("WEBGL_PACK_BINARY_OPERATIONS") ? new Q2(fX, n.shape, a.shape) : new $y(cX, n.shape, a.shape);
    return r.runWebGLProgram(o, [n, a], "float32");
  }
  var YUe = { kernelName: gt.Prelu, backendName: "webgl", kernelFunc: KUe }, Jy = "if (isnan(x)) return x;", ZUe = `
  if (isnan(a)) return a;
  if (isnan(b)) return b;
`, JUe = `
  result.r = isNaN.r > 0. ? NAN : result.r;
  result.g = isNaN.g > 0. ? NAN : result.g;
  result.b = isNaN.b > 0. ? NAN : result.b;
  result.a = isNaN.a > 0. ? NAN : result.a;
`;
  function Xo(e) {
    var t = e.opSnippet, r = e.packedOpSnippet, n = e.cpuKernelImpl, a = e.dtype;
    return function(o) {
      var s = o.inputs, i = o.backend, l = s.x, u2 = i, c = a || l.dtype;
      if (u2.shouldExecuteOnCPU([l]) && n != null) {
        var f = u2.texData.get(l.dataId), h = n(f.values, c);
        return u2.makeTensorInfo(l.shape, c, h);
      }
      var p = gt.env().getBool("WEBGL_PACK_UNARY_OPERATIONS") && r != null, d;
      return p ? d = new Sg(l.shape, r) : d = new C0(l.shape, t), u2.runWebGLProgram(d, [l], c);
    };
  }
  function Cc(e) {
    var t = e.opSnippet, r = e.packedOpSnippet, n = e.checkOutOfBounds, a = n === void 0 ? false : n, o = e.supportsComplex, s = o === void 0 ? false : o, i = e.cpuKernelImpl, l = e.dtype;
    return function(u2) {
      var c = u2.inputs, f = u2.backend, h = c.a, p = c.b, d = f;
      if (s && h.dtype === "complex64") {
        var v = d.texData.get(h.dataId), m = d.texData.get(p.dataId), g = _i([[v.complexTensorInfos.real, m.complexTensorInfos.real], [v.complexTensorInfos.imag, m.complexTensorInfos.imag]].map(function(O2) {
          var L2 = _i(O2, 2), V2 = L2[0], W2 = L2[1], X3 = { dataId: V2.dataId, dtype: V2.dtype, shape: h.shape }, Y3 = { dataId: W2.dataId, dtype: W2.dtype, shape: p.shape }, K3 = new $y(t, h.shape, p.shape);
          return d.runWebGLProgram(K3, [X3, Y3], gt.upcastType(V2.dtype, W2.dtype));
        }), 2), x = g[0], b = g[1], y = Uv({ inputs: { real: x, imag: b }, backend: d });
        return d.disposeIntermediateTensorInfo(x), d.disposeIntermediateTensorInfo(b), y;
      }
      var w = l || gt.upcastType(h.dtype, p.dtype);
      if ((h.dtype === "string" || p.dtype === "string" || d.shouldExecuteOnCPU([h, p])) && i != null) {
        var _4 = d.texData.get(h.dataId).values, k = d.texData.get(p.dataId).values, T2 = h.dtype === "string" ? gt.backend_util.fromUint8ToStringArray(_4) : _4, A2 = h.dtype === "string" ? gt.backend_util.fromUint8ToStringArray(k) : k, S2 = _i(i(h.shape, p.shape, T2, A2, w), 2), C2 = S2[0], E2 = S2[1], F13 = d.makeTensorInfo(E2, w), N2 = d.texData.get(F13.dataId);
        return N2.values = C2, F13;
      }
      var D2 = gt.env().getBool("WEBGL_PACK_BINARY_OPERATIONS") && r != null, I2;
      return D2 ? I2 = new Q2(r, h.shape, p.shape, a) : I2 = new $y(t, h.shape, p.shape), d.runWebGLProgram(I2, [h, p], w);
    };
  }
  function LT(e, t) {
    if (t === void 0 && (t = false), e === "linear") return t ? CUe : TUe;
    if (e === "relu") return t ? IUe : SUe;
    if (e === "elu") return t ? MUe : AUe;
    if (e === "relu6") return t ? NUe : EUe;
    if (e === "prelu") return t ? fX : cX;
    if (e === "leakyrelu") return t ? uX : lX;
    if (e === "sigmoid") return t ? FUe : DUe;
    throw new Error("Activation " + e + " has not been implemented for the WebGL backend.");
  }
  var hX = /* @__PURE__ */ function() {
    function e(t, r, n, a, o, s, i, l, u2) {
      a === void 0 && (a = false), o === void 0 && (o = false), s === void 0 && (s = false), i === void 0 && (i = null), l === void 0 && (l = false), u2 === void 0 && (u2 = false), this.variableNames = ["matrixA", "matrixB"], this.packedInputs = true, this.packedOutput = true, this.outputShape = n, this.enableShapeUniforms = Bf(this.outputShape.length);
      var c = a ? t[1] : t[2], f = Math.ceil(c / 2), h = a ? "i * 2, rc.y" : "rc.y, i * 2", p = o ? "rc.z, i * 2" : "i * 2, rc.z", d = a ? ["a.xxyy", "a.zzww"] : ["a.xxzz", "a.yyww"], v = o ? ["b.xzxz", "b.ywyw"] : ["b.xyxy", "b.zwzw"], m = "", g = "";
      i && (l ? m = `vec4 activation(vec4 a) {
          vec4 b = getPreluActivationWeightsAtOutCoords();
          ` + i + `
        }` : u2 ? m = `vec4 activation(vec4 a) {
          vec4 b = getLeakyreluAlphaAtOutCoords();
          ` + i + `
        }` : m = `vec4 activation(vec4 x) {
          ` + i + `
        }`, g = "result = activation(result);");
      var x = s ? "result += getBiasAtOutCoords();" : "";
      s && this.variableNames.push("bias"), l && this.variableNames.push("preluActivationWeights"), u2 && this.variableNames.push("leakyreluAlpha");
      var b = "rc.x", y = "rc.x";
      t[0] < r[0] ? b = "int(min(float(rc.x), " + (t[0] - 1) + ".))" : r[0] < t[0] && (y = "int(min(float(rc.x), " + (r[0] - 1) + ".))"), this.userCode = `
      ` + m + `
      // Don't use uniform for sharedDimensionPacked for performance.
      const float sharedDimension = ` + f + `.0;

      vec4 dot2x2ARowBCol(ivec3 rc) {
        vec4 result = vec4(0);
        for (int i = 0; i < ` + f + `; i++) {
          int batchA = ` + b + `;
          int batchB = ` + y + `;
          vec4 a = getMatrixA(batchA, ` + h + `);
          vec4 b = getMatrixB(batchB, ` + p + `);

          // These swizzled products need to be separately added.
          // See: https://github.com/tensorflow/tfjs/issues/1735
          result += (` + d[0] + " * " + v[0] + `);
          result += (` + d[1] + " * " + v[1] + `);
        }
        return result;
      }

      void main() {
        ivec3 rc = getOutputCoords();
        vec4 result = dot2x2ARowBCol(rc);

        ` + x + `

        ` + g + `

        setOutput(result);
      }
    `;
    }
    return e;
  }();
  var jH = { REAL: "return areal * breal - aimag * bimag;", IMAG: "return areal * bimag + aimag * breal;" }, WH = /* @__PURE__ */ function() {
    function e(t, r, n) {
      this.variableNames = ["AReal", "AImag", "BReal", "BImag"], this.outputShape = gt.backend_util.assertAndGetBroadcastShape(r, n), this.userCode = `
      float binaryOpComplex(
          float areal, float aimag, float breal, float bimag) {
        ` + t + `
      }

      void main() {
        float areal = getARealAtOutCoords();
        float aimag = getAImagAtOutCoords();
        float breal = getBRealAtOutCoords();
        float bimag = getBImagAtOutCoords();
        setOutput(binaryOpComplex(areal, aimag, breal, bimag));
      }
    `;
    }
    return e;
  }(), GH = "return a * b;";
  function V6(e) {
    var t = e.inputs, r = e.backend, n = t.a, a = t.b, o = gt.backend_util.upcastType(n.dtype, a.dtype);
    if (n.dtype === "complex64") {
      var s = r.texData.get(n.dataId), i = r.texData.get(a.dataId), l = new WH(jH.REAL, n.shape, a.shape), u2 = new WH(jH.IMAG, n.shape, a.shape), c = [{ dataId: s.complexTensorInfos.real.dataId, dtype: s.complexTensorInfos.real.dtype, shape: n.shape }, { dataId: s.complexTensorInfos.imag.dataId, dtype: s.complexTensorInfos.imag.dtype, shape: n.shape }, { dataId: i.complexTensorInfos.real.dataId, dtype: i.complexTensorInfos.real.dtype, shape: a.shape }, { dataId: i.complexTensorInfos.imag.dataId, dtype: i.complexTensorInfos.imag.dtype, shape: a.shape }], f = r.runWebGLProgram(l, c, "float32"), h = r.runWebGLProgram(u2, c, "float32"), p = Uv({ inputs: { real: f, imag: h }, backend: r });
      return r.disposeIntermediateTensorInfo(f), r.disposeIntermediateTensorInfo(h), p;
    }
    if (r.shouldExecuteOnCPU([n, a])) {
      var s = r.texData.get(n.dataId), i = r.texData.get(a.dataId), d = _i(JBe(n.shape, a.shape, s.values, i.values, o), 2), v = d[0], m = d[1], g = r.makeTensorInfo(m, o), x = r.texData.get(g.dataId);
      return x.values = v, g;
    }
    var b;
    return gt.env().getBool("WEBGL_PACK_BINARY_OPERATIONS") ? b = new Q2(GH, n.shape, a.shape) : b = new $y(GH, n.shape, a.shape), r.runWebGLProgram(b, [n, a], o);
  }
  var QUe = { kernelName: gt.Multiply, backendName: "webgl", kernelFunc: V6 };
  function eVe(e, t, r) {
    var n = uf([Dg(e.shape)], Cg(e.shape)), a = { dtype: e.dtype, shape: n, dataId: e.dataId }, o = uf([Dg(t)], Cg(t)), s = new iX(o, n), i = true, l = [n], u2 = r.runWebGLProgram(s, [a], e.dtype, l, i);
    return { dataId: u2.dataId, shape: t, dtype: u2.dtype };
  }
  function ti(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.shape, s = r, i = gt.util.sizeFromShape(a.shape), l = gt.util.inferFromImplicitShape(o, i), u2 = gt.util.sizeFromShape(l);
    gt.util.assert(i === u2, function() {
      return "The new shape (" + l + ") has " + u2 + " elements and the old " + ("shape (" + a.shape + ") has " + i + " elements. The new shape and old ") + "shape must have the same number of elements.";
    });
    var c = s.texData.get(a.dataId);
    return c.isPacked && !K2(a.shape, l) && !(c.texture !== null && K2(c.shape, l)) ? eVe(a, l, s) : (s.incRef(a.dataId), { dataId: a.dataId, shape: l, dtype: a.dtype });
  }
  var tVe = { kernelName: gt.Reshape, backendName: "webgl", kernelFunc: ti };
  var $H = /* @__PURE__ */ function() {
    function e(t, r) {
      this.variableNames = ["x"];
      var n = t.windowSize, a = t.batchSize, o = t.inSize, s = t.outSize;
      this.outputShape = [a, s];
      var i = Math.floor(n / 4) * 4, l = n % 4, u2 = "sumValue += dot(values, ones);";
      if (r != null) {
        var c = 1 / r;
        u2 = "sumValue += dot(values * " + (gt.util.isInt(c) ? c.toPrecision(2) : c) + ", ones);";
      }
      var f = "";
      o % n > 0 && (f = `
        if (inIdx < 0 || inIdx >= ` + o + `) {
          return 0.0;
        }
      `), this.userCode = `
      const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);

      float getValue(int batch, int inIdx) {
        ` + f + `
        return getX(batch, inIdx);
      }

      void main() {
        ivec2 coords = getOutputCoords();
        int batch = coords[0];
        int outIdx = coords[1];
        int inOffset = outIdx * ` + n + `;

        float sumValue = 0.0;

        for (int i = 0; i < ` + i + `; i += 4) {
          int inIdx = inOffset + i;
          vec4 values = vec4(
            getValue(batch, inIdx),
            getValue(batch, inIdx + 1),
            getValue(batch, inIdx + 2),
            getValue(batch, inIdx + 3)
          );

          ` + u2 + `
        }

        int inIdx = inOffset + ` + i + `;
        if (` + (l === 1) + `) {
          vec4 values = vec4(getValue(batch, inIdx), 0.0, 0.0, 0.0);

          ` + u2 + `
        } else if (` + (l === 2) + `) {
          vec4 values = vec4(
            getValue(batch, inIdx),
            getValue(batch, inIdx + 1), 0.0, 0.0);

          ` + u2 + `
        } else if (` + (l === 3) + `) {
          vec4 values = vec4(
            getValue(batch, inIdx),
            getValue(batch, inIdx + 1),
            getValue(batch, inIdx + 2), 0.0);

          ` + u2 + `
        }
        setOutput(sumValue);
      }
    `;
    }
    return e;
  }();
  var rVe = /* @__PURE__ */ function() {
    function e(t, r) {
      this.variableNames = ["x"];
      var n = t.windowSize, a = t.batchSize, o = t.inSize, s = t.outSize;
      this.outputShape = [a, s];
      var i = "0.0", l = "";
      r === "prod" ? i = "1.0" : r === "min" ? (i = "1.0 / 1e-20", l = "min") : r === "max" && (i = "-1.0 / 1e-20", l = "max");
      var u2 = r + "(" + r + "(" + r + "(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";
      r === "sum" ? u2 = "sumValue" : r === "prod" ? u2 = "prodValue" : r === "all" ? u2 = "allValue" : r === "any" && (u2 = "anyValue");
      var c = Math.floor(n / 4) * 4, f = n % 4, h = `
      if (` + (r === "sum") + `) {
        sumValue += dot(values, ones);
      } else if (` + (r === "prod") + `) {
        vec2 tmp = vec2(values[0], values[1]) * vec2(values[2], values[3]);
        prodValue *= tmp[0] * tmp[1];
      } else {
        minMaxValue = ` + l + `(values, minMaxValue);
        if (` + (r === "min") + " || " + (r === "max") + `) {
          minMaxValue = ` + l + `(values, minMaxValue);
          bvec4 isNaN = isnan(values);
          if (isNaN.r || isNaN.g || isNaN.b || isNaN.a) {
            minMaxValue = vec4(NAN);
          }
        }
      }
    `, p = "vec4";
      r === "all" ? (i = "1.0", h = `
        bool reducedAllValue = all(values);
        float floatedReducedAllValue = float(reducedAllValue);
        allValue = float(allValue >= 1.0 && floatedReducedAllValue >= 1.0);
      `, p = "bvec4") : r === "any" && (i = "0.0", h = `
        bool reducedAnyValue = any(values);
        float floatedReducedAnyValue = float(reducedAnyValue);
        anyValue = float(anyValue >= 1.0 || floatedReducedAnyValue >= 1.0);
      `, p = "bvec4");
      var d = "";
      o % n > 0 && (d = `
        if (inIdx < 0 || inIdx >= ` + o + `) {
          return initializationValue;
        }
      `), this.userCode = `
      const float initializationValue = ` + i + `;
      const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);

      float getValue(int batch, int inIdx) {
        ` + d + `
        return getX(batch, inIdx);
      }

      void main() {
        ivec2 coords = getOutputCoords();
        int batch = coords[0];
        int outIdx = coords[1];
        int inOffset = outIdx * ` + n + `;

        vec4 minMaxValue = vec4(` + i + `);
        float prodValue = 1.0;
        float sumValue = 0.0;
        float allValue = 1.0;
        float anyValue = 0.0;

        for (int i = 0; i < ` + c + `; i += 4) {
          int inIdx = inOffset + i;
          ` + p + " values = " + p + `(
            getValue(batch, inIdx),
            getValue(batch, inIdx + 1),
            getValue(batch, inIdx + 2),
            getValue(batch, inIdx + 3)
          );

          ` + h + `
        }

        int inIdx = inOffset + ` + c + `;
        if (` + (f === 1) + `) {
          ` + p + " values = " + p + `(
            getValue(batch, inIdx),
            initializationValue,
            initializationValue,
            initializationValue
          );

          ` + h + `
        } else if (` + (f === 2) + `) {
          ` + p + " values = " + p + `(
            getValue(batch, inIdx),
            getValue(batch, inIdx + 1),
            initializationValue,
            initializationValue
          );

          ` + h + `
        } else if (` + (f === 3) + `) {
          ` + p + " values = " + p + `(
            getValue(batch, inIdx),
            getValue(batch, inIdx + 1),
            getValue(batch, inIdx + 2),
            initializationValue
          );

          ` + h + `
        }
        setOutput(` + u2 + `);
      }
    `;
    }
    return e;
  }();
  function nVe(e) {
    for (var t = []; t.length === 0 || t[t.length - 1].outSize !== 1; ) {
      var r = t.length ? t[t.length - 1].outSize : e[1], n = gt.backend_util.computeOptimalWindowSize(r);
      t.push({ inSize: r, windowSize: n, outSize: Math.ceil(r / n) });
    }
    return t;
  }
  function Ng(e, t, r, n) {
    for (var a = nVe(e.shape), o = e, s = 0; s < a.length; s++) {
      var i = a[s], l = i.inSize, u2 = i.windowSize, c = i.outSize, f = void 0, h = void 0;
      r === "mean" ? f = s === 0 ? new $H({ windowSize: u2, inSize: l, batchSize: e.shape[0], outSize: c }, l) : new $H({ windowSize: u2, inSize: l, batchSize: e.shape[0], outSize: c }) : f = new rVe({ windowSize: u2, inSize: l, batchSize: e.shape[0], outSize: c }, r), h = o, o = n.runWebGLProgram(f, [o], t), h.dataId !== e.dataId && n.disposeIntermediateTensorInfo(h);
    }
    return o;
  }
  var aVe = /* @__PURE__ */ function() {
    function e(t, r) {
      this.variableNames = ["A"];
      for (var n = new Array(t.length), a = 0; a < n.length; a++) n[a] = t[r[a]];
      this.outputShape = n, this.rank = n.length;
      var o = $s(this.rank), s = iVe(r);
      this.userCode = `
    void main() {
      ` + o + ` resRC = getOutputCoords();
      setOutput(getA(` + s + `));
    }
    `;
    }
    return e;
  }();
  function iVe(e) {
    var t = e.length;
    if (t > 6) throw Error("Transpose for rank " + t + " is not yet supported");
    for (var r = ["resRC.x", "resRC.y", "resRC.z", "resRC.w", "resRC.u", "resRC.v"], n = new Array(t), a = 0; a < e.length; a++) n[e[a]] = r[a];
    return n.join();
  }
  var oVe = /* @__PURE__ */ function() {
    function e(t, r) {
      this.variableNames = ["A"], this.packedInputs = true, this.packedOutput = true;
      for (var n = new Array(t.length), a = 0; a < n.length; a++) n[a] = t[r[a]];
      if (this.outputShape = n, this.rank = n.length, this.rank > 6) throw Error("Packed transpose for rank " + this.rank + " is not yet supported.");
      for (var o = $s(this.rank), s = aX("rc", this.rank), i = new Array(this.rank), a = 0; a < r.length; a++) i[r[a]] = s[a];
      var l = "vec2(" + i.slice(-2).join() + ")", u2 = "++" + s[this.rank - 1] + " < " + n[this.rank - 1], c = "getChannel(getA(" + i.join() + "), " + l + ")";
      this.userCode = `
    void main() {
      ` + o + ` rc = getOutputCoords();
      vec4 result = vec4(0.);
      result[0] = ` + c + `;
      if(` + u2 + `) {
        result[1] = ` + c + `;
      }
      --` + s[this.rank - 1] + `;
      if(++` + s[this.rank - 2] + " < " + n[this.rank - 2] + `) {
        result[2] = ` + c + `;
        if(` + u2 + `) {
          result[3] = ` + c + `;
        }
      }
      setOutput(result);
    }
    `;
    }
    return e;
  }();
  function RT(e, t, r) {
    var n = gt.env().getBool("WEBGL_PACK_ARRAY_OPERATIONS") ? new oVe(e.shape, t) : new aVe(e.shape, t);
    return r.runWebGLProgram(n, [e], e.dtype);
  }
  function sVe(e, t, r, n) {
    var a = t, o = e.shape.length, s = gt.util.parseAxisParam(a, e.shape), i = s, l = gt.backend_util.getAxesPermutation(i, o), u2 = l != null, c = e;
    u2 && (c = RT(e, l, n), i = gt.backend_util.getInnerMostAxes(i.length, o)), gt.backend_util.assertAxesAreInnerMostDims("sum", i, o);
    var f = _i(gt.backend_util.computeOutAndReduceShapes(c.shape, i), 2), h = f[0], p = f[1], d = h;
    r && (d = gt.backend_util.expandShapeToKeepDim(h, s));
    var v = gt.util.sizeFromShape(p), m = gt.util.sizeFromShape(e.shape), g = m / v, x = ti({ inputs: { x: c }, attrs: { shape: [g, v] }, backend: n }), b = gt.sumOutType(e.dtype), y = Ng(x, b, "sum", n), w = ti({ inputs: { x: y }, attrs: { shape: d }, backend: n });
    return n.disposeIntermediateTensorInfo(x), n.disposeIntermediateTensorInfo(y), u2 && n.disposeIntermediateTensorInfo(c), w;
  }
  function zT(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.axis, s = n.keepDims;
    return sVe(a, o, s, r);
  }
  var lVe = { kernelName: gt.Sum, backendName: "webgl", kernelFunc: zT };
  function cf(e) {
    for (var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.perm, s = r, i = a.shape.length, l = new Array(i), u2 = 0; u2 < l.length; u2++) l[u2] = a.shape[o[u2]];
    var c;
    if (s.shouldExecuteOnCPU([a])) {
      var f = s.texData.get(a.dataId), h = f.values, p = B6(h, a.shape, a.dtype, o, l);
      c = s.makeTensorInfo(l, a.dtype);
      var d = s.texData.get(c.dataId);
      d.values = p;
    } else c = RT(a, o, s);
    return c;
  }
  var uVe = { kernelName: gt.Transpose, backendName: "webgl", kernelFunc: cf }, pX = 1e3;
  function NT(e) {
    var t, r, n = e.a, a = e.b, o = e.transposeA, s = e.transposeB, i = e.backend, l = e.bias, u2 = l === void 0 ? null : l, c = e.preluActivationWeights, f = c === void 0 ? null : c, h = e.leakyreluAlpha, p = h === void 0 ? 0 : h, d = e.activation, v = d === void 0 ? null : d, m = n.shape.length, g = a.shape.length, x = o ? n.shape[m - 2] : n.shape[m - 1], b = s ? a.shape[g - 1] : a.shape[g - 2], y = o ? n.shape[m - 1] : n.shape[m - 2], w = s ? a.shape[g - 2] : a.shape[g - 1], _4 = n.shape.slice(0, -2), k = a.shape.slice(0, -2), T2 = gt.util.sizeFromShape(_4), A2 = gt.util.sizeFromShape(k), S2 = gt.broadcast_util.assertAndGetBroadcastShape(n.shape.slice(0, -2), a.shape.slice(0, -2)), C2 = S2.concat([y, w]);
    gt.util.assert(x === b, function() {
      return "Error in matMul: inner shapes (" + x + ") and (" + (b + ") of Tensors with shapes " + n.shape + " and ") + (a.shape + " and transposeA=" + o) + (" and transposeB=" + s + " must match.");
    });
    var E2 = o ? [T2, x, y] : [T2, y, x], F13 = s ? [A2, w, b] : [A2, b, w], N2 = ti({ inputs: { x: n }, backend: i, attrs: { shape: E2 } }), D2 = ti({ inputs: { x: a }, backend: i, attrs: { shape: F13 } }), I2 = [N2, D2], O2 = Math.max(T2, A2), L2 = o ? N2.shape[1] : N2.shape[2], V2 = u2 != null, W2 = f != null, X3 = v === "leakyrelu", Y3 = v != null ? LT(v, true) : null, K3 = V2 || W2 || X3 || Y3 != null, q;
    if ((y === 1 || w === 1) && L2 > pX && K3 === false) {
      var re = N2, R2 = D2;
      o && (re = cf({ inputs: { x: N2 }, backend: i, attrs: { perm: [0, 2, 1] } }), I2.push(re)), s && (R2 = cf({ inputs: { x: D2 }, backend: i, attrs: { perm: [0, 2, 1] } }), I2.push(R2));
      var z = w !== 1, H3 = w === 1, te = re;
      z && (te = ti({ inputs: { x: re }, backend: i, attrs: { shape: [O2, L2, 1] } }), I2.push(te));
      var j = w === 1 ? 2 : 1, Q3 = R2;
      H3 && (Q3 = ti({ inputs: { x: R2 }, backend: i, attrs: { shape: [O2, 1, L2] } }), I2.push(Q3));
      var Z3 = V6({ inputs: { a: te, b: Q3 }, backend: i });
      q = zT({ inputs: { x: Z3 }, backend: i, attrs: { axis: j, keepDims: true } }), I2.push(Z3);
    } else {
      var ne = gt.upcastType(n.dtype, a.dtype), ae = new hX(E2, F13, [O2, y, w], o, s, V2, Y3, W2, X3), ue = [N2, D2];
      if (u2 != null && ue.push(u2), W2 && ue.push(f), X3) {
        var le = i.makeTensorInfo([], "float32", gt.util.createScalarValue(p, "float32"));
        ue.push(le), I2.push(le);
      }
      q = i.runWebGLProgram(ae, ue, ne);
    }
    var ce = ti({ inputs: { x: q }, backend: i, attrs: { shape: C2 } });
    I2.push(q);
    try {
      for (var se = Eg(I2), he = se.next(); !he.done; he = se.next()) {
        var me = he.value;
        i.disposeIntermediateTensorInfo(me);
      }
    } catch (we) {
      t = { error: we };
    } finally {
      try {
        he && !he.done && (r = se.return) && r.call(se);
      } finally {
        if (t) throw t.error;
      }
    }
    return ce;
  }
  function cVe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.a, o = t.b, s = t.bias, i = t.preluActivationWeights, l = n.transposeA, u2 = n.transposeB, c = n.activation, f = n.leakyreluAlpha;
    return NT({ a, b: o, transposeA: l, transposeB: u2, backend: r, bias: s, preluActivationWeights: i, leakyreluAlpha: f, activation: c });
  }
  var fVe = { kernelName: gt._FusedMatMul, backendName: "webgl", kernelFunc: cVe };
  var HH = "return abs(x);";
  function hVe(e) {
    var t = e.inputs, r = e.backend, n = t.x;
    if (r.shouldExecuteOnCPU([n]) && n.dtype !== "complex64") {
      var a = r.texData.get(n.dataId), o = rX(a.values);
      return r.makeTensorInfo(n.shape, n.dtype, o);
    }
    var s;
    return gt.env().getBool("WEBGL_PACK_UNARY_OPERATIONS") ? s = new Sg(n.shape, HH) : s = new C0(n.shape, HH), r.runWebGLProgram(s, [n], n.dtype);
  }
  var pVe = { kernelName: gt.Abs, backendName: "webgl", kernelFunc: hVe };
  var dVe = bp + `
  if (abs(x) > 1.) {
    return NAN;
  }
  return acos(x);
`, vVe = Xo({ opSnippet: dVe }), mVe = { kernelName: gt.Acos, backendName: "webgl", kernelFunc: vVe };
  var gVe = bp + `
  if (x < 1.0) return NAN;
return log(x + sqrt(x * x - 1.0));`, yVe = Xo({ opSnippet: gVe }), xVe = { kernelName: gt.Acosh, backendName: "webgl", kernelFunc: yVe };
  var qH = "return a + b;", bVe = Cc({ opSnippet: qH, packedOpSnippet: qH, supportsComplex: true, cpuKernelImpl: FBe }), _Ve = { kernelName: gt.Add, backendName: "webgl", kernelFunc: bVe };
  var wVe = /* @__PURE__ */ function() {
    function e(t, r) {
      this.outputShape = [], this.outputShape = t, this.variableNames = r.map(function(o, s) {
        return "T" + s;
      });
      var n = [];
      this.variableNames.forEach(function(o) {
        n.push("float v" + o + " = get" + o + "AtOutCoords();");
      });
      var a = this.variableNames.map(function(o) {
        return "v" + o;
      }).join(" + ");
      this.userCode = `
      void main() {
        ` + n.join(`
        `) + `

        float result = ` + a + `;
        setOutput(result);
      }
    `;
    }
    return e;
  }();
  var kVe = /* @__PURE__ */ function() {
    function e(t, r) {
      this.outputShape = [], this.packedInputs = true, this.packedOutput = true, this.outputShape = t, this.variableNames = r.map(function(o, s) {
        return "T" + s;
      });
      var n = [];
      this.variableNames.forEach(function(o) {
        n.push("vec4 v" + o + " = get" + o + "AtOutCoords();");
      });
      var a = this.variableNames.map(function(o) {
        return "v" + o;
      }).join(" + ");
      this.userCode = `
      void main() {
        ` + n.join(`
        `) + `

        vec4 result = ` + a + `;
        setOutput(result);
      }
    `;
    }
    return e;
  }();
  function IT(e) {
    var t = e.inputs, r = e.backend, n = t;
    if (n.length === 1) return hh({ inputs: { x: n[0] }, backend: r });
    if (n.length > gt.env().get("WEBGL_MAX_TEXTURES_IN_SHADER")) {
      var a = Math.floor(n.length / 2), o = IT({ inputs: n.slice(0, a), backend: r }), s = IT({ inputs: n.slice(a), backend: r });
      return IT({ inputs: [o, s], backend: r });
    }
    var i = n.map(function(f) {
      return f.dtype;
    }).reduce(function(f, h) {
      return gt.upcastType(f, h);
    }), l = n.map(function(f) {
      return f.shape;
    }), u2 = gt.env().getBool("WEBGL_PACK"), c = u2 ? new kVe(n[0].shape, l) : new wVe(n[0].shape, l);
    return r.runWebGLProgram(c, n, i);
  }
  var TVe = { kernelName: gt.AddN, backendName: "webgl", kernelFunc: IT };
  function AVe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.axis, s = n.keepDims, i = a.shape.length, l = gt.util.parseAxisParam(o, a.shape), u2 = l, c = gt.backend_util.getAxesPermutation(u2, i), f = a;
    c != null && (f = cf({ inputs: { x: a }, backend: r, attrs: { perm: c } }), u2 = gt.backend_util.getInnerMostAxes(u2.length, i)), gt.backend_util.assertAxesAreInnerMostDims("all", u2, i);
    var h = _i(gt.backend_util.computeOutAndReduceShapes(f.shape, u2), 2), p = h[0], d = h[1], v = gt.util.sizeFromShape(d), m = ti({ inputs: { x: f }, backend: r, attrs: { shape: [-1, v] } }), g = Ng(m, m.dtype, "all", r), x;
    if (s) {
      var b = gt.backend_util.expandShapeToKeepDim(p, l);
      x = ti({ inputs: { x: g }, backend: r, attrs: { shape: b } });
    } else x = ti({ inputs: { x: g }, backend: r, attrs: { shape: p } });
    return r.disposeIntermediateTensorInfo(m), r.disposeIntermediateTensorInfo(g), c != null && r.disposeIntermediateTensorInfo(f), x;
  }
  var SVe = { kernelName: gt.All, backendName: "webgl", kernelFunc: AVe };
  function EVe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.axis, s = n.keepDims, i = a.shape.length, l = gt.util.parseAxisParam(o, a.shape), u2 = l, c = gt.backend_util.getAxesPermutation(u2, i), f = a;
    c != null && (f = cf({ inputs: { x: a }, backend: r, attrs: { perm: c } }), u2 = gt.backend_util.getInnerMostAxes(u2.length, i)), gt.backend_util.assertAxesAreInnerMostDims("any", u2, i);
    var h = _i(gt.backend_util.computeOutAndReduceShapes(f.shape, u2), 2), p = h[0], d = h[1], v = gt.util.sizeFromShape(d), m = ti({ inputs: { x: f }, backend: r, attrs: { shape: [-1, v] } }), g = Ng(m, m.dtype, "any", r), x;
    if (s) {
      var b = gt.backend_util.expandShapeToKeepDim(p, l);
      x = ti({ inputs: { x: g }, backend: r, attrs: { shape: b } });
    } else x = ti({ inputs: { x: g }, backend: r, attrs: { shape: p } });
    return r.disposeIntermediateTensorInfo(m), r.disposeIntermediateTensorInfo(g), c != null && r.disposeIntermediateTensorInfo(f), x;
  }
  var DVe = { kernelName: gt.Any, backendName: "webgl", kernelFunc: EVe };
  var CVe = /* @__PURE__ */ function() {
    function e(t, r, n) {
      this.variableNames = ["A"];
      var a = t.windowSize, o = t.batchSize, s = t.outSize;
      n || this.variableNames.push("bestIndicesA"), this.outputShape = [o, s];
      var i = r === "max" ? ">" : "<", l = n ? "inOffset + i;" : "round(getBestIndicesA(batch, inOffset + i));";
      this.userCode = `
      void main() {
        ivec2 coords = getOutputCoords();
        int batch = coords[0];
        int outIdx = coords[1];
        int inOffset = outIdx * ` + a + `;

        int bestIndex = inOffset;
        float bestValue = getA(batch, bestIndex);

        for (int i = 0; i < ` + a + `; i++) {
          int inIdx = ` + l + `;
          float candidate = getA(batch, inIdx);
          if (candidate ` + i + ` bestValue) {
            bestValue = candidate;
            bestIndex = inIdx;
          }
        }
        setOutput(float(bestIndex));
      }
    `;
    }
    return e;
  }();
  var MVe = /* @__PURE__ */ function() {
    function e(t, r, n, a) {
      this.variableNames = ["A"], this.packedInputs = true, this.packedOutput = true, gt.util.assert(t.length > 2, function() {
        return "Packed arg" + (n.charAt(0).toUpperCase() + n.slice(1)) + " supports only inputs with rank above 2.";
      });
      var o = t[t.length - 1], s = Math.ceil(o / r);
      this.outputShape = t.slice(0, -1), s > 1 && this.outputShape.push(s), a || this.variableNames.push("bestIndicesA");
      var i = this.outputShape, l = i.length, u2 = $s(l), c = lf("coords", l), f, h;
      if (s === 1) {
        h = l + 1;
        var p = $s(h);
        f = `
        ` + p + " sourceLocR = " + p + "(" + c.join() + `, 0);
        ++` + c[l - 1] + `;
        ` + p + " sourceLocG = " + p + "(" + c.join() + `, 0);
        ++` + c[l - 2] + `;
        ` + p + " sourceLocA = " + p + "(" + c.join() + `, 0);
        --` + c[l - 1] + `;
        ` + p + " sourceLocB = " + p + "(" + c.join() + `, 0);
        --` + c[l - 2] + ";";
      } else h = l, f = `
        ` + u2 + ` sourceLocR = coords;
        ++` + c[l - 1] + `;
        ` + u2 + ` sourceLocG = coords;
        ++` + c[l - 2] + `;
        ` + u2 + ` sourceLocA = coords;
        --` + c[l - 1] + `;
        ` + u2 + ` sourceLocB = coords;
        --` + c[l - 2] + ";";
      var d = ["x", "y", "z", "w", "u", "v"].slice(0, h), v = "." + d[h - 1], m = d.map(function(A2) {
        return "int " + A2;
      }), g = lf("sourceLocR", h - 1).concat("inIdx.r"), x = lf("sourceLocG", h - 1).concat("inIdx.g"), b = lf("sourceLocB", h - 1).concat("inIdx.b"), y = lf("sourceLocA", h - 1).concat("inIdx.a"), w = n === "max" ? "greaterThan" : "lessThan", _4 = a ? "" : `
          inIdx = round(vec4(getBestIndicesAChannel(` + g.join() + `),
                             getBestIndicesAChannel(` + x.join() + `),
                             getBestIndicesAChannel(` + b.join() + `),
                             getBestIndicesAChannel(` + y.join() + ")));", k = `vec4(
            getAChannel(` + g.join() + `),
            hasNextCol ? getAChannel(` + x.join() + `) : 0.,
            hasNextRow ? getAChannel(` + b.join() + `) : 0.,
            hasNextRow && hasNextCol ? getAChannel(` + y.join() + ") : 0.)", T2 = a ? "" : `
      float getBestIndicesAChannel(` + m.join() + `) {
        return getChannel(getBestIndicesA(` + d.join() + `),
                                          vec2(` + d.slice(-2).join() + `));
      }`;
      this.userCode = `
      float getAChannel(` + m.join() + `) {
        return getChannel(getA(` + d.join() + `),
                               vec2(` + d.slice(-2).join() + `));
      }
      ` + T2 + `
      void main() {
        ` + u2 + ` coords = getOutputCoords();
        bool hasNextCol = ` + c[l - 1] + " < " + (i[l - 1] - 1) + `;
        bool hasNextRow = ` + c[l - 2] + " < " + (i[l - 2] - 1) + `;
        ` + f + `
        ivec4 srcIdx = ivec4(sourceLocR` + v + ", sourceLocG" + v + `,
          sourceLocB` + v + ", sourceLocA" + v + ") * " + r + `;
        ivec4 inIdx = srcIdx;
        vec4 bestIndex = vec4(inIdx);
        vec4 bestValue = ` + k + `;

        for (int i = 0; i < ` + r + `; i++) {
          inIdx = srcIdx;
          ` + _4 + `
          vec4 candidate = ` + k + `;
          bvec4 nan = isnan(candidate);
          bvec4 replace = bvec4(
            vec4(` + w + `(candidate, bestValue)) * (vec4(1.0) - vec4(nan)));

          bestValue = vec4(replace.x  ? candidate.x : bestValue.x,
                           replace.y  ? candidate.y : bestValue.y,
                           replace.z  ? candidate.z : bestValue.z,
                           replace.w  ? candidate.w : bestValue.w);
          bestIndex = mix(bestIndex, vec4(inIdx), vec4(replace));
          srcIdx++;
        }
        setOutput(bestIndex);
      }
    `;
    }
    return e;
  }();
  function dX(e, t, r, n) {
    n === void 0 && (n = null);
    var a = t.shape[0], o = t.shape[1];
    n != null && (a = n.shape[0], o = n.shape[1]);
    var s = gt.backend_util.computeOptimalWindowSize(o), i = { windowSize: s, inSize: o, batchSize: a, outSize: Math.ceil(o / s) }, l = new CVe(i, r, n == null), u2 = [t];
    n != null && u2.push(n);
    var c = e.runWebGLProgram(l, u2, "int32");
    if (c.shape[1] === 1) return c;
    var f = dX(e, t, r, c);
    return e.disposeIntermediateTensorInfo(c), f;
  }
  function vX(e, t, r, n) {
    n === void 0 && (n = null);
    var a = n != null ? n.shape : t.shape, o = a[a.length - 1], s = gt.backend_util.computeOptimalWindowSize(o), i = new MVe(a, s, r, n == null), l = n == null ? [t] : [t, n], u2 = e.runWebGLProgram(i, l, "int32");
    if (u2.shape.length === t.shape.length) {
      var c = vX(e, t, r, u2);
      return e.disposeIntermediateTensorInfo(u2), c;
    }
    return u2;
  }
  function mX(e, t, r, n) {
    var a = [r];
    if (gt.backend_util.assertAxesAreInnerMostDims("arg" + n.charAt(0).toUpperCase() + n.slice(1), a, t.shape.length), !gt.env().getBool("WEBGL_PACK_REDUCE") || t.shape.length <= 2) {
      var o = [], s = e.texData.get(t.dataId), i = s !== null && s.isPacked, l = t;
      i && (l = e.unpackTensor(t), o.push(l));
      var u2 = _i(gt.backend_util.computeOutAndReduceShapes(l.shape, a), 2), c = u2[0], f = u2[1], h = gt.util.sizeFromShape(f), p = ti({ inputs: { x: l }, backend: e, attrs: { shape: [-1, h] } });
      o.push(p);
      var d = dX(e, p, n);
      o.push(d);
      var v = ti({ inputs: { x: d }, backend: e, attrs: { shape: c } });
      return o.forEach(function(m) {
        return e.disposeIntermediateTensorInfo(m);
      }), v;
    }
    return vX(e, t, n);
  }
  function IVe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.axis, s = gt.util.parseAxisParam(o, a.shape), i = gt.backend_util.getAxesPermutation(s, a.shape.length), l = a, u2 = [];
    i != null && (l = cf({ inputs: { x: a }, backend: r, attrs: { perm: i } }), u2.push(l), s = gt.backend_util.getInnerMostAxes(s.length, l.shape.length)), gt.backend_util.assertAxesAreInnerMostDims("argMax", [s[0]], l.shape.length);
    var c = mX(r, l, s[0], "max");
    return u2.forEach(function(f) {
      return r.disposeIntermediateTensorInfo(f);
    }), c;
  }
  var NVe = { kernelName: gt.ArgMax, backendName: "webgl", kernelFunc: IVe };
  function FVe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.axis, s = gt.util.parseAxisParam(o, a.shape), i = gt.backend_util.getAxesPermutation(s, a.shape.length), l = a, u2 = [];
    i != null && (l = cf({ inputs: { x: a }, backend: r, attrs: { perm: i } }), u2.push(l), s = gt.backend_util.getInnerMostAxes(s.length, l.shape.length)), gt.backend_util.assertAxesAreInnerMostDims("argMin", [s[0]], l.shape.length);
    var c = mX(r, l, s[0], "min");
    return u2.forEach(function(f) {
      return r.disposeIntermediateTensorInfo(f);
    }), c;
  }
  var OVe = { kernelName: gt.ArgMin, backendName: "webgl", kernelFunc: FVe };
  var PVe = bp + `
  if (abs(x) > 1.) {
    return NAN;
  }
  return asin(x);
`, LVe = Xo({ opSnippet: PVe }), RVe = { kernelName: gt.Asin, backendName: "webgl", kernelFunc: LVe };
  var zVe = bp + "return log(x + sqrt(x * x + 1.0));", BVe = Xo({ opSnippet: zVe }), UVe = { kernelName: gt.Asinh, backendName: "webgl", kernelFunc: BVe };
  var VVe = bp + `
  return atan(x);
`, jVe = Xo({ opSnippet: VVe }), WVe = { kernelName: gt.Atan, backendName: "webgl", kernelFunc: jVe };
  var GVe = ZUe + `
  return atan(a, b);
`, $Ve = `
  vec4 result = atan(a, b);
  vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0));
  ` + JUe + `
  return result;
`, HVe = Cc({ opSnippet: GVe, packedOpSnippet: $Ve }), qVe = { kernelName: gt.Atan2, backendName: "webgl", kernelFunc: HVe };
  var XVe = bp + `
  if ((x < -1.0) || (x > 1.0)) return NAN;
return (log(1.0 + x) - log(1.0 - x)) / 2.0;`, KVe = Xo({ opSnippet: XVe }), YVe = { kernelName: gt.Atanh, backendName: "webgl", kernelFunc: KVe };
  var Y2 = /* @__PURE__ */ function() {
    function e(t, r, n, a, o) {
      if (a === void 0 && (a = false), o === void 0 && (o = false), this.variableNames = ["x"], r === "avg" && n) throw new Error("Cannot compute positions for average pool.");
      var s = t.filterWidth, i = t.strideHeight, l = t.strideWidth, u2 = t.dilationHeight, c = t.dilationWidth, f = t.effectiveFilterHeight, h = t.effectiveFilterWidth, p = t.padInfo.top, d = t.padInfo.left;
      this.outputShape = t.outShape;
      var v = r === "avg", m = "((batch  * " + t.inHeight + " + xR) * " + t.inWidth + " + xC) * " + t.inChannels + " + d", g = "(xR * " + t.inWidth + " + xC) * " + t.inChannels + " + d", x = "0.0";
      if (v || (x = "-1.0 / 1e-20"), n) {
        var b = ">=";
        this.userCode = `
        const ivec2 strides = ivec2(` + i + ", " + l + `);
        const ivec2 pads = ivec2(` + p + ", " + d + `);

        void main() {
          ivec4 coords = getOutputCoords();
          int batch = coords[0];
          int d = coords[3];

          ivec2 xRCCorner = coords.yz * strides - pads;
          int xRCorner = xRCCorner.x;
          int xCCorner = xRCCorner.y;

          // max/min x(?, ?, d) to get y(yR, yC, d).
          // ? = to be determined
          float minMaxValue = 0.0;
          float minMaxValueFound = 0.0;
          int minMaxPosition = 0;
          float avgValue = 0.0;

          for (int wR = 0; wR < ` + f + `;
              wR += ` + u2 + `) {
            int xR = xRCorner + wR;

            if (xR < 0 || xR >= ` + t.inHeight + `) {
              continue;
            }

            for (int wC = 0; wC < ` + h + `;
                wC += ` + c + `) {
              int xC = xCCorner + wC;

              if (xC < 0 || xC >= ` + t.inWidth + `) {
                continue;
              }

              float value = getX(batch, xR, xC, d);

              // If a min / max value has already been found, use it. If not,
              // use the current value.
              float currMinMaxValue = mix(
                  value, minMaxValue, minMaxValueFound);
              if (value ` + b + ` currMinMaxValue) {
                minMaxValue = value;
                minMaxValueFound = 1.0;
                minMaxPosition = ` + (a ? o ? m : g : "wR * " + h + " + wC") + `;
              }
            }
          }
          setOutput(float(minMaxPosition));
        }
      `;
        return;
      }
      var y = "max", w = r + "(" + r + "(" + r + "(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";
      r === "avg" && (w = "avgValue / count");
      var _4 = Math.floor(s / 4) * 4, k = s % 4, T2 = `
      if (` + v + `) {
        avgValue += dot(values, ones);
      } else {
        minMaxValue = ` + y + `(values, minMaxValue);
      }
    `;
      this.userCode = `
      const ivec2 strides = ivec2(` + i + ", " + l + `);
      const ivec2 pads = ivec2(` + p + ", " + d + `);
      const float initializationValue = ` + x + `;
      const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);

      float count = 0.0;

      float getValue(int batch, int xR, int xC, int d) {
        if (xC < 0 || xC >= ` + t.inWidth + `) {
          return initializationValue;
        }
        count += 1.0;
        return getX(batch, xR, xC, d);
      }

      void main() {
        ivec4 coords = getOutputCoords();
        int batch = coords[0];
        int d = coords[3];

        ivec2 xRCCorner = coords.yz * strides - pads;
        int xRCorner = xRCCorner.x;
        int xCCorner = xRCCorner.y;

        // max/min x(?, ?, d) to get y(yR, yC, d).
        // ? = to be determined
        vec4 minMaxValue = vec4(` + x + `);
        float avgValue = 0.0;
        count = 0.0;

        for (int wR = 0; wR < ` + f + `;
            wR += ` + u2 + `) {
          int xR = xRCorner + wR;

          if (xR < 0 || xR >= ` + t.inHeight + `) {
            continue;
          }

          for (int wC = 0; wC < ` + _4 + `; wC += 4) {
            int xC = xCCorner + wC * ` + c + `;

            vec4 values = vec4(
              getValue(batch, xR, xC, d),
              getValue(batch, xR, xC + ` + c + `, d),
              getValue(batch, xR, xC + 2 * ` + c + `, d),
              getValue(batch, xR, xC + 3 * ` + c + `, d)
            );

            ` + T2 + `
          }

          int xC = xCCorner + ` + _4 + `;
          if (` + (k === 1) + `) {
            vec4 values = vec4(
              getValue(batch, xR, xC, d),
              initializationValue,
              initializationValue,
              initializationValue
            );

            ` + T2 + `
          } else if (` + (k === 2) + `) {
            vec4 values = vec4(
              getValue(batch, xR, xC, d),
              getValue(batch, xR, xC + ` + c + `, d),
              initializationValue,
              initializationValue
            );

            ` + T2 + `
          } else if (` + (k === 3) + `) {
            vec4 values = vec4(
              getValue(batch, xR, xC, d),
              getValue(batch, xR, xC + ` + c + `, d),
              getValue(batch, xR, xC + 2 * ` + c + `, d),
              initializationValue
            );

            ` + T2 + `
          }
        }
        setOutput(` + w + `);
      }
    `;
    }
    return e;
  }(), j6 = /* @__PURE__ */ function() {
    function e(t, r, n, a, o) {
      if (a === void 0 && (a = false), o === void 0 && (o = false), this.variableNames = ["x"], r === "avg" && n) throw new Error("Cannot compute positions for average pool.");
      var s = t.filterWidth, i = t.strideDepth, l = t.strideHeight, u2 = t.strideWidth, c = t.dilationDepth, f = t.dilationHeight, h = t.dilationWidth, p = t.effectiveFilterDepth, d = t.effectiveFilterHeight, v = t.effectiveFilterWidth, m = t.padInfo.front, g = t.padInfo.top, x = t.padInfo.left;
      this.outputShape = t.outShape;
      var b = r === "avg", y = "0.0";
      if (b || (y = "-1.0 / 1e-20"), n) {
        var w = ">=";
        this.userCode = `
        const ivec3 strides =
            ivec3(` + i + ", " + l + ", " + u2 + `);
        const ivec3 pads = ivec3(` + m + ", " + g + ", " + x + `);

        void main() {
          ivec5 coords = getOutputCoords();
          int batch = coords.x;
          int ch = coords.u;

          ivec3 xCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;
          int xDCorner = xCorner.x;
          int xRCorner = xCorner.y;
          int xCCorner = xCorner.z;

          // max/min x(?, ?, ?, ch) to get y(yD, yR, yC, ch).
          // ? = to be determined
          float minMaxValue = 0.0;
          float minMaxValueFound = 0.0;
          int minMaxPosition = 0;

          for (int wD = 0; wD < ` + p + `;
              wD += ` + c + `) {
            int xD = xDCorner + wD;

            if (xD < 0 || xD >= ` + t.inDepth + `) {
              continue;
            }

            for (int wR = 0; wR < ` + d + `;
                wR += ` + f + `) {
              int xR = xRCorner + wR;

              if (xR < 0 || xR >= ` + t.inHeight + `) {
                continue;
              }

              for (int wC = 0; wC < ` + v + `;
                  wC += ` + h + `) {
                int xC = xCCorner + wC;

                if (xC < 0 || xC >= ` + t.inWidth + `) {
                  continue;
                }

                float value = getX(batch, xD, xR, xC, ch);

                // If a min / max value has already been found, use it. If not,
                // use the current value.
                float currMinMaxValue = mix(
                    value, minMaxValue, minMaxValueFound);
                if (value ` + w + ` currMinMaxValue) {
                  minMaxValue = value;
                  minMaxValueFound = 1.0;
                  minMaxPosition = ` + (a ? o ? "(((batch * " + t.inDepth + " + xD) * " + t.inHeight + " + xR) * " + t.inWidth + " + xC) * " + t.inChannels + " + ch" : "((xD * " + t.inHeight + " + xR) * " + t.inWidth + " + xC) * " + t.inChannels + " + ch" : "wD * " + d + " * " + v + ` +
                      wR * ` + v + " + wC") + `;
                }
              }
            }
          }
          setOutput(float(minMaxPosition));
        }
      `;
        return;
      }
      var _4 = "max", k = r + "(" + r + "(" + r + "(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";
      r === "avg" && (k = "avgValue / count");
      var T2 = Math.floor(s / 4) * 4, A2 = s % 4, S2 = `
      if (` + b + `) {
        avgValue += dot(values, ones);
      } else {
        minMaxValue = ` + _4 + `(values, minMaxValue);
      }
    `;
      this.userCode = `
      const ivec3 strides =
        ivec3(` + i + ", " + l + ", " + u2 + `);
      const ivec3 pads = ivec3(` + m + ", " + g + ", " + x + `);
      const float initializationValue = ` + y + `;
      const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);

      float count = 0.0;

      float getValue(int batch, int xD, int xR, int xC, int ch) {
        if (xC < 0 || xC >= ` + t.inWidth + `) {
          return initializationValue;
        }
        count += 1.0;
        return getX(batch, xD, xR, xC, ch);
      }

      void main() {
        ivec5 coords = getOutputCoords();
        int batch = coords.x;
        int ch = coords.u;

        ivec3 xCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;
        int xDCorner = xCorner.x;
        int xRCorner = xCorner.y;
        int xCCorner = xCorner.z;

        // max/min x(?, ?, ?, d) to get y(yD, yR, yC, ch).
        // ? = to be determined
        vec4 minMaxValue = vec4(` + y + `);
        float avgValue = 0.0;
        count = 0.0;

        for (int wD = 0; wD < ` + p + `;
            wD += ` + c + `) {
          int xD = xDCorner + wD;

          if (xD < 0 || xD >= ` + t.inDepth + `) {
            continue;
          }

          for (int wR = 0; wR < ` + d + `;
            wR += ` + f + `) {
            int xR = xRCorner + wR;

            if (xR < 0 || xR >= ` + t.inHeight + `) {
              continue;
            }

            for (int wC = 0; wC < ` + T2 + `; wC += 4) {
              int xC = xCCorner + wC * ` + h + `;

              vec4 values = vec4(
                getValue(batch, xD, xR, xC, ch),
                getValue(batch, xD, xR, xC + ` + h + `, ch),
                getValue(batch, xD, xR, xC + 2 * ` + h + `, ch),
                getValue(batch, xD, xR, xC + 3 * ` + h + `, ch)
              );

              ` + S2 + `
            }

            int xC = xCCorner + ` + T2 + `;
            if (` + (A2 === 1) + `) {
              vec4 values = vec4(
                getValue(batch, xD, xR, xC, ch),
                initializationValue,
                initializationValue,
                initializationValue
              );

              ` + S2 + `
            } else if (` + (A2 === 2) + `) {
              vec4 values = vec4(
                getValue(batch, xD, xR, xC, ch),
                getValue(batch, xD, xR, xC + ` + h + `, ch),
                initializationValue,
                initializationValue
              );

              ` + S2 + `
            } else if (` + (A2 === 3) + `) {
              vec4 values = vec4(
                getValue(batch, xD, xR, xC, ch),
                getValue(batch, xD, xR, xC + ` + h + `, ch),
                getValue(batch, xD, xR, xC + 2 * ` + h + `, ch),
                initializationValue
              );

              ` + S2 + `
            }
          }
          setOutput(` + k + `);
        }
      }
    `;
    }
    return e;
  }();
  function ZVe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x;
    qy(a, "avgPool");
    var o = n.filterSize, s = n.strides, i = n.pad, l = n.dimRoundingMode, u2 = 1;
    gt.util.assert(gt.backend_util.eitherStridesOrDilationsAreOne(s, u2), function() {
      return "Error in avgPool: Either strides or dilations must be 1. " + ("Got strides " + s + " and dilations '" + u2 + "'");
    });
    var c = gt.backend_util.computePool2DInfo(a.shape, o, s, u2, i, l);
    if (c.filterWidth === 1 && c.filterHeight === 1 && gt.util.arraysEqual(c.inShape, c.outShape)) return hh({ inputs: { x: a }, backend: r });
    var f = new Y2(c, "avg", false);
    return r.runWebGLProgram(f, [a], "float32");
  }
  var JVe = { kernelName: gt.AvgPool, backendName: "webgl", kernelFunc: ZVe };
  function QVe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.filterSize, s = n.strides, i = n.pad, l = n.dimRoundingMode, u2 = n.dataFormat, c = [1, 1, 1], f = gt.backend_util.computePool3DInfo(a.shape, o, s, c, i, l, u2), h = new j6(f, "avg", false);
    return r.runWebGLProgram(h, [a], "float32");
  }
  var eje = { kernelName: gt.AvgPool3D, backendName: "webgl", kernelFunc: QVe };
  var tje = /* @__PURE__ */ function() {
    function e(t) {
      this.variableNames = ["dy"], this.outputShape = t.inShape;
      var r = t.filterHeight, n = t.filterWidth, a = t.strideHeight, o = t.strideWidth, s = t.dilationHeight, i = t.dilationWidth, l = t.effectiveFilterHeight, u2 = t.effectiveFilterWidth, c = l - 1 - t.padInfo.top, f = u2 - 1 - t.padInfo.left, h = 1 / (r * n);
      this.userCode = `
      const ivec2 pads = ivec2(` + c + ", " + f + `);
      const float avgMultiplier = float(` + h + `);

      void main() {
        ivec4 coords = getOutputCoords();
        int b = coords[0];
        int d = coords[3];

        ivec2 dyRCCorner = coords.yz - pads;
        int dyRCorner = dyRCCorner.x;
        int dyCCorner = dyRCCorner.y;

        // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).
        // ? = to be determined. : = across all values in that axis.
        float dotProd = 0.0;
        for (int wR = 0; wR < ` + l + `;
            wR += ` + s + `) {
          float dyR = float(dyRCorner + wR) / ` + a + `.0;

          if (dyR < 0.0 || dyR >= ` + t.outHeight + `.0 || fract(dyR) > 0.0) {
            continue;
          }
          int idyR = int(dyR);

          for (int wC = 0; wC < ` + u2 + `;
            wC+= ` + i + `) {
            float dyC = float(dyCCorner + wC) / ` + o + `.0;

            if (dyC < 0.0 || dyC >= ` + t.outWidth + `.0 ||
                fract(dyC) > 0.0) {
              continue;
            }
            int idyC = int(dyC);

            float dyValue = getDy(b, idyR, idyC, d);

            dotProd += dyValue * avgMultiplier;
          }
        }
        setOutput(dotProd);
      }
    `;
    }
    return e;
  }(), rje = /* @__PURE__ */ function() {
    function e(t) {
      this.variableNames = ["dy"], this.outputShape = t.inShape;
      var r = t.filterDepth, n = t.filterHeight, a = t.filterWidth, o = t.strideDepth, s = t.strideHeight, i = t.strideWidth, l = t.dilationDepth, u2 = t.dilationHeight, c = t.dilationWidth, f = t.effectiveFilterDepth, h = t.effectiveFilterHeight, p = t.effectiveFilterWidth, d = f - 1 - t.padInfo.front, v = h - 1 - t.padInfo.top, m = p - 1 - t.padInfo.left, g = 1 / (r * n * a);
      this.userCode = `
      const ivec3 pads = ivec3(` + d + ", " + v + ", " + m + `);
      const float avgMultiplier = float(` + g + `);

      void main() {
        ivec5 coords = getOutputCoords();
        int batch = coords.x;
        int ch = coords.u;

        ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;
        int dyDCorner = dyCorner.x;
        int dyRCorner = dyCorner.y;
        int dyCCorner = dyCorner.z;

        // Convolve dy(?, ?, ?, d) with pos mask(:, :, :, ch) to get
        // dx(xD, xR, xC, ch).
        // ? = to be determined. : = across all values in that axis.
        float dotProd = 0.0;

        for (int wD = 0; wD < ` + f + `;
            wD += ` + l + `) {
          float dyD = float(dyDCorner + wD) / ` + o + `.0;

          if (dyD < 0.0 || dyD >= ` + t.outDepth + `.0 || fract(dyD) > 0.0) {
            continue;
          }
          int idyD = int(dyD);

          for (int wR = 0; wR < ` + h + `;
              wR += ` + u2 + `) {
            float dyR = float(dyRCorner + wR) / ` + s + `.0;

            if (dyR < 0.0 || dyR >= ` + t.outHeight + `.0 ||
                fract(dyR) > 0.0) {
              continue;
            }
            int idyR = int(dyR);

            for (int wC = 0; wC < ` + p + `;
                wC += ` + c + `) {
              float dyC = float(dyCCorner + wC) / ` + i + `.0;

              if (dyC < 0.0 || dyC >= ` + t.outWidth + `.0 ||
                  fract(dyC) > 0.0) {
                continue;
              }
              int idyC = int(dyC);

              float dyValue = getDy(batch, idyD, idyR, idyC, ch);

              dotProd += dyValue * avgMultiplier;
            }
          }
        }
        setOutput(dotProd);
      }
    `;
    }
    return e;
  }();
  function nje(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.dy, o = t.input, s = o, i = n.filterSize, l = n.strides, u2 = n.pad, c = n.dimRoundingMode, f = [1, 1, 1], h = gt.backend_util.computePool3DInfo(s.shape, i, l, f, u2, c), p = new rje(h);
    return r.runWebGLProgram(p, [a], s.dtype);
  }
  var aje = { kernelName: gt.AvgPool3DGrad, backendName: "webgl", kernelFunc: nje };
  function ije(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.dy, o = t.input, s = o;
    qy([a, o], "avgPoolGrad");
    var i = n.filterSize, l = n.strides, u2 = n.pad, c = gt.backend_util.computePool2DInfo(s.shape, i, l, 1, u2), f = new tje(c);
    return r.runWebGLProgram(f, [a], s.dtype);
  }
  var oje = { kernelName: gt.AvgPoolGrad, backendName: "webgl", kernelFunc: ije };
  function sje(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.a, o = t.b, s = n.transposeA, i = n.transposeB;
    return NT({ a, b: o, transposeA: s, transposeB: i, backend: r });
  }
  var lje = { kernelName: gt.BatchMatMul, backendName: "webgl", kernelFunc: sje };
  var uje = /* @__PURE__ */ function() {
    function e(t, r, n, a, o, s) {
      this.outputShape = [], this.variableNames = ["x", "mean", "variance"], gt.backend_util.assertAndGetBroadcastShape(t, r), gt.backend_util.assertAndGetBroadcastShape(t, n);
      var i = "0.0";
      a != null && (gt.backend_util.assertAndGetBroadcastShape(t, a), this.variableNames.push("offset"), i = "getOffsetAtOutCoords()");
      var l = "1.0";
      o != null && (gt.backend_util.assertAndGetBroadcastShape(t, o), this.variableNames.push("scale"), l = "getScaleAtOutCoords()"), this.outputShape = t, this.userCode = `
      void main() {
        float x = getXAtOutCoords();
        float mean = getMeanAtOutCoords();
        float variance = getVarianceAtOutCoords();
        float offset = ` + i + `;
        float scale = ` + l + `;
        float inv = scale * inversesqrt(variance + float(` + s + `));
        setOutput(dot(vec3(x, -mean, offset), vec3(inv, inv, 1)));
      }
    `;
    }
    return e;
  }();
  var cje = /* @__PURE__ */ function() {
    function e(t, r, n, a, o, s) {
      this.packedInputs = true, this.packedOutput = true, this.variableNames = ["x", "mean", "variance"], gt.backend_util.assertAndGetBroadcastShape(t, r), gt.backend_util.assertAndGetBroadcastShape(t, n);
      var i = "vec4(0.0)";
      a != null && (gt.backend_util.assertAndGetBroadcastShape(t, a), this.variableNames.push("offset"), i = "getOffsetAtOutCoords()");
      var l = "vec4(1.0)";
      o != null && (gt.backend_util.assertAndGetBroadcastShape(t, o), this.variableNames.push("scale"), l = "getScaleAtOutCoords()"), this.outputShape = t, this.userCode = `
      void main() {
        vec4 offset = ` + i + `;
        vec4 scale = ` + l + `;

        vec4 x = getXAtOutCoords();
        vec4 mean = getMeanAtOutCoords();
        vec4 variance = getVarianceAtOutCoords();

        vec4 inv = scale * inversesqrt(variance + vec4(` + s + `));

        setOutput((x - mean) * inv + offset);
      }
    `;
    }
    return e;
  }();
  var fje = function(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = t.mean, s = t.variance, i = t.offset, l = t.scale;
    gt.util.assert(o.shape.length === s.shape.length, function() {
      return "Batch normalization gradient requires mean and variance to have equal ranks.";
    }), gt.util.assert(i == null || o.shape.length === i.shape.length, function() {
      return "Batch normalization gradient requires mean and offset to have equal ranks.";
    }), gt.util.assert(l == null || o.shape.length === l.shape.length, function() {
      return "Batch normalization gradient requires mean and scale to have equal ranks.";
    });
    var u2 = n.varianceEpsilon;
    u2 == null && (u2 = 1e-3);
    var c = [a, o, s], f = null;
    i != null && (f = i.shape, c.push(i));
    var h = null;
    l != null && (h = l.shape, c.push(l));
    var p = gt.env().getBool("WEBGL_PACK_NORMALIZATION") ? new cje(a.shape, o.shape, s.shape, f, h, u2) : new uje(a.shape, o.shape, s.shape, f, h, u2), d = r.runWebGLProgram(p, c, c[0].dtype);
    return d;
  }, hje = { kernelName: gt.FusedBatchNorm, backendName: "webgl", kernelFunc: fje };
  var pje = /* @__PURE__ */ function() {
    function e(t) {
      this.variableNames = ["source"], this.outputShape = t, this.rank = t.length;
      var r = $s(this.rank);
      this.customUniforms = [{ name: "start", arrayIndex: this.rank, type: "int" }];
      var n = dje(this.rank), a, o = t.map(function(s, i) {
        return "sourceLoc." + E6[i] + " = start[" + i + "] + coords." + E6[i] + ";";
      });
      a = `
        ` + r + ` sourceLoc;
        ` + r + ` coords = getOutputCoords();
        ` + o.join(`
`) + `
      `, this.userCode = `
      void main() {
        ` + a + `
        setOutput(getSource(` + n + `));
      }
    `;
    }
    return e;
  }(), E6 = ["x", "y", "z", "w", "u", "v"];
  function dje(e) {
    if (e === 1) return "sourceLoc";
    if (e <= 6) return E6.slice(0, e).map(function(t) {
      return "sourceLoc." + t;
    }).join(",");
    throw Error("Slicing for rank " + e + " is not yet supported");
  }
  var vje = /* @__PURE__ */ function() {
    function e(t) {
      this.variableNames = ["source"], this.packedInputs = true, this.packedOutput = true, this.outputShape = t, this.rank = t.length, this.customUniforms = [{ name: "start", arrayIndex: this.rank, type: "int" }];
      var r = $s(this.rank), n = lf("coords", this.rank), a = lf("sourceLoc", this.rank), o = this.rank === 1 ? "sourceLoc" : "vec2(" + a.slice(-2).join() + ")", s = "getChannel(getSource(" + a.join() + "), " + o + ")", i = `
      result.x = ` + s + `;
      if (++` + n[this.rank - 1] + " < " + t[this.rank - 1] + `) {
        ++` + a[this.rank - 1] + `;
        result.y = ` + s + `;
        --` + a[this.rank - 1] + `;
      }
    `, l = this.rank === 1 ? "" : `
      --` + n[this.rank - 1] + `;
      if (++` + n[this.rank - 2] + " < " + t[this.rank - 2] + `) {
        ++` + a[this.rank - 2] + `;
        result.z = ` + s + `;
        if (++` + n[this.rank - 1] + " < " + t[this.rank - 1] + `) {
          ++` + a[this.rank - 1] + `;
          result.w = ` + s + `;
        }
      }
    `, u2 = this.rank <= 4 ? `sourceLoc = coords +
            ` + r + "(" + t.map(function(c, f) {
        return "start[" + f + "]";
      }).join() + ");" : t.map(function(c, f) {
        return a[f] + " = " + n[f] + " + start[" + f + "];";
      }).join(`
`);
      this.userCode = `
      void main() {
        ` + r + ` coords = getOutputCoords();
        ` + r + ` sourceLoc;
        ` + u2 + `
        vec4 result = vec4(0.);
        ` + i + `
        ` + l + `
        setOutput(result);
      }
    `;
    }
    return e;
  }();
  function mje(e, t, r, n) {
    var a = n.texData.get(e.dataId), o = n.makeTensorInfo(r, e.dtype), s = n.texData.get(o.dataId);
    Object.assign(s, a), s.refCount = 1, s.shape = r, s.dtype = e.dtype;
    var i = gt.slice_util.computeFlatOffset(t, gt.util.computeStrides(e.shape));
    a.slice && (i += a.slice.flatOffset), s.slice = { flatOffset: i, origDataId: a.slice && a.slice.origDataId || e.dataId };
    var l = n.dataRefCount.get(s.slice.origDataId) || 1;
    return n.dataRefCount.set(s.slice.origDataId, l + 1), o;
  }
  function Qy(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.begin, s = n.size, i = _i(gt.slice_util.parseSliceParams(a, o, s), 2), l = i[0], u2 = i[1];
    if (gt.slice_util.assertParamsValid(a, l, u2), gt.util.sizeFromShape(u2) === 0) return r.makeTensorInfo(u2, a.dtype, []);
    if (r.shouldExecuteOnCPU([a]) || a.dtype === "string") {
      var c = r.texData.get(a.dataId), f = iUe(c.values, l, u2, a.shape, a.dtype);
      return r.makeTensorInfo(u2, a.dtype, f);
    }
    var h = r.texData.get(a.dataId).isPacked, p = gt.slice_util.isSliceContinous(a.shape, l, u2);
    if (h || !p) {
      var d = gt.env().getBool("WEBGL_PACK_ARRAY_OPERATIONS") ? new vje(u2) : new pje(u2), v = [l];
      return r.runWebGLProgram(d, [a], a.dtype, v);
    }
    return r.uploadToGPU(a.dataId), mje(a, l, u2, r);
  }
  var gje = { kernelName: gt.Slice, backendName: "webgl", kernelFunc: Qy };
  var yje = function(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.blockShape, s = n.crops;
    gt.util.assert(a.shape.length <= 4, function() {
      return "batchToSpaceND for rank > 4 with a WebGL backend not implemented yet";
    });
    var i = o.reduce(function(x, b) {
      return x * b;
    }), l = gt.backend_util.getReshaped(a.shape, o, i), u2 = gt.backend_util.getPermuted(l.length, o.length), c = gt.backend_util.getReshapedPermuted(a.shape, o, i), f = gt.backend_util.getSliceBeginCoords(s, o.length), h = gt.backend_util.getSliceSize(c, s, o.length), p = [], d = ti({ inputs: { x: a }, backend: r, attrs: { shape: l } }), v = cf({ inputs: { x: d }, backend: r, attrs: { perm: u2 } }), m = ti({ inputs: { x: v }, backend: r, attrs: { shape: c } }), g = Qy({ inputs: { x: m }, backend: r, attrs: { begin: f, size: h } });
    return p.push(d), p.push(v), p.push(m), p.forEach(function(x) {
      return r.disposeIntermediateTensorInfo(x);
    }), g;
  }, xje = { kernelName: gt.BatchToSpaceND, backendName: "webgl", kernelFunc: yje };
  function bje(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = t.weights, s = n.size, i = r.readSync(a.dataId), l = r.readSync(o.dataId), u2 = tX(i, l, o.dtype, o.shape, s);
    return r.makeTensorInfo([s], o.dtype, u2);
  }
  var _je = { kernelName: gt.Bincount, backendName: "webgl", kernelFunc: bje };
  function wje(e) {
    var t = e.inputs, r = e.backend, n = t.s0, a = t.s1, o = r.readSync(n.dataId), s = r.readSync(a.dataId), i = gt.backend_util.assertAndGetBroadcastShape(Array.from(o), Array.from(s));
    return r.makeTensorInfo([i.length], "int32", Int32Array.from(i));
  }
  var kje = { kernelName: gt.BroadcastArgs, backendName: "webgl", kernelFunc: wje };
  var Tje = "return float(a != b);", gX = Cc({ opSnippet: Tje, cpuKernelImpl: eUe, dtype: "bool" }), Aje = { kernelName: gt.NotEqual, backendName: "webgl", kernelFunc: gX };
  function e_(e) {
    var t = e.inputs, r = e.backend, n = t.input, a = r.texData.get(n.dataId);
    return hh({ inputs: { x: a.complexTensorInfos.real }, backend: r });
  }
  var Sje = { kernelName: gt.Real, backendName: "webgl", kernelFunc: e_ };
  var Eje = "return float(int(x));";
  function Dje(e, t) {
    var r = new C0(e.shape, Eje), n = t.runWebGLProgram(r, [e], "int32");
    return { dataId: n.dataId, shape: n.shape, dtype: n.dtype };
  }
  function D6(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.dtype;
    if (o === "complex64") {
      if (a.dtype === "complex64") return hh({ inputs: { x: a }, backend: r });
      var s = I9e.zeros(a.shape), i = D6({ inputs: { x: a }, backend: r, attrs: { dtype: "float32" } }), l = Uv({ inputs: { real: i, imag: s }, backend: r });
      return s.dispose(), r.disposeIntermediateTensorInfo(i), l;
    }
    if (a.dtype === "complex64") {
      var u2 = e_({ inputs: { input: a }, backend: r }), l = D6({ inputs: { x: u2 }, backend: r, attrs: { dtype: o } });
      return r.disposeIntermediateTensorInfo(u2), l;
    }
    if (!gt.util.hasEncodingLoss(a.dtype, o)) {
      var l = hh({ inputs: { x: a }, backend: r });
      return { dataId: l.dataId, shape: l.shape, dtype: o };
    }
    if (o === "int32") return Dje(a, r);
    if (o === "bool") {
      var c = r.makeTensorInfo([], "bool", gt.util.getTypedArrayFromDType("bool", 1)), f = { a, b: c }, l = gX({ inputs: f, backend: r });
      return r.disposeIntermediateTensorInfo(c), l;
    }
    throw new Error("Error in Cast: failed to cast " + a.dtype + " to " + o);
  }
  var Cje = { kernelName: gt.Cast, backendName: "webgl", kernelFunc: D6 };
  var XH = "return ceil(x);", Mje = Xo({ opSnippet: XH, packedOpSnippet: XH, cpuKernelImpl: PBe }), Ije = { kernelName: gt.Ceil, backendName: "webgl", kernelFunc: Mje };
  var Nje = /* @__PURE__ */ function() {
    function e(t) {
      this.variableNames = ["A"], this.customUniforms = [{ name: "minVal", type: "float" }, { name: "maxVal", type: "float" }], this.outputShape = t, this.userCode = `

      void main() {
        float value = getAAtOutCoords();
        if (isnan(value)) {
          setOutput(value);
          return;
        }

        setOutput(clamp(value, minVal, maxVal));
      }
    `;
    }
    return e;
  }();
  var Fje = /* @__PURE__ */ function() {
    function e(t) {
      this.variableNames = ["A"], this.packedInputs = true, this.packedOutput = true, this.customUniforms = [{ name: "minVal", type: "float" }, { name: "maxVal", type: "float" }], this.outputShape = t, this.userCode = `
      void main() {
        vec4 value = getAAtOutCoords();

        if (any(isnan(value))) {
          setOutput(value);
          return;
        }

        setOutput(clamp(value, vec4(minVal), vec4(maxVal)));
      }
    `;
    }
    return e;
  }();
  function Oje(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.clipValueMin, s = n.clipValueMax, i;
    gt.env().getBool("WEBGL_PACK_CLIP") ? i = new Fje(a.shape) : i = new Nje(a.shape);
    var l = [[o], [s]];
    return r.runWebGLProgram(i, [a], a.dtype, l);
  }
  var Pje = { kernelName: gt.ClipByValue, backendName: "webgl", kernelFunc: Oje };
  var Lje = /* @__PURE__ */ function() {
    function e(t) {
      this.variableNames = ["real", "imag"], this.outputShape = t, this.userCode = `
      void main() {
        float re = abs(getRealAtOutCoords());
        float im = abs(getImagAtOutCoords());
        float mx = max(re, im);

        // sadly the length function in glsl is not underflow-safe
        // (at least not on Intel GPUs). So the safe solution is
        // to ensure underflow-safety in all cases.
        setOutput(
          mx == 0.0 ? 0.0 : mx * length(vec2(1, min(re, im)/mx))
        );
      }
    `;
    }
    return e;
  }();
  function KH(e, t) {
    return { dataId: t.dataId, dtype: t.dtype, shape: e.shape };
  }
  function Rje(e) {
    var t = e.inputs, r = e.backend, n = t.x, a = r.texData.get(n.dataId), o = new Lje(n.shape), s = [KH(n, a.complexTensorInfos.real), KH(n, a.complexTensorInfos.imag)];
    return r.runWebGLProgram(o, s, s[0].dtype);
  }
  var zje = { kernelName: gt.ComplexAbs, backendName: "webgl", kernelFunc: Rje };
  var Bje = /* @__PURE__ */ function() {
    function e(t) {
      this.outputShape = [], this.outputShape = gt.backend_util.computeOutShape(t, 1), this.variableNames = t.map(function(l, u2) {
        return "T" + u2;
      });
      var r = new Array(t.length - 1);
      r[0] = t[0][1];
      for (var n = 1; n < r.length; n++) r[n] = r[n - 1] + t[n][1];
      for (var a = ["if (yC < " + r[0] + ") setOutput(getT0(yR, yC));"], n = 1; n < r.length; n++) {
        var o = r[n - 1];
        a.push("else if (yC < " + r[n] + ") " + ("setOutput(getT" + n + "(yR, yC-" + o + "));"));
      }
      var s = r.length, i = r[r.length - 1];
      a.push("else setOutput(getT" + s + "(yR, yC-" + i + "));"), this.userCode = `
      void main() {
        ivec2 coords = getOutputCoords();
        int yR = coords.x;
        int yC = coords.y;

        ` + a.join(`
        `) + `
      }
    `;
    }
    return e;
  }();
  var Uje = /* @__PURE__ */ function() {
    function e(t, r) {
      this.packedInputs = true, this.packedOutput = true, this.outputShape = [], this.outputShape = gt.backend_util.computeOutShape(t, r);
      var n = this.outputShape, a = n.length, o = $s(a), s = lf("coords", a), i = ["x", "y", "z", "w", "u", "v"].slice(0, a);
      this.variableNames = t.map(function(g, x) {
        return "T" + x;
      });
      var l = new Array(t.length - 1);
      l[0] = t[0][r];
      for (var u2 = 1; u2 < l.length; u2++) l[u2] = l[u2 - 1] + t[u2][r];
      for (var c = i[r], f = i.slice(-2), h = i.join(), p = "if (" + c + " < " + l[0] + `) {
        return getChannel(
            getT0(` + h + "), vec2(" + f.join() + `));
        }`, u2 = 1; u2 < l.length; u2++) {
        var d = l[u2 - 1];
        p += `
        if (` + c + " < " + l[u2] + "  && " + c + " >= " + l[u2 - 1] + `) {
          return getChannel(
            getT` + u2 + "(" + wT(i, c, d) + `),
            vec2(` + wT(f, c, d) + `));
        }`;
      }
      var v = l.length, m = l[l.length - 1];
      p += `
        return getChannel(
          getT` + v + "(" + wT(i, c, m) + `),
          vec2(` + wT(f, c, m) + "));", this.userCode = `
      float getValue(` + i.map(function(g) {
        return "int " + g;
      }) + `) {
        ` + p + `
      }

      void main() {
        ` + o + ` coords = getOutputCoords();
        vec4 result = vec4(getValue(` + s + `), 0., 0., 0.);

        ` + s[a - 1] + " = " + s[a - 1] + ` + 1;
        if (` + s[a - 1] + " < " + n[a - 1] + `) {
          result.g = getValue(` + s + `);
        }

        ` + s[a - 2] + " = " + s[a - 2] + ` + 1;
        if (` + s[a - 2] + " < " + n[a - 2] + `) {
          result.a = getValue(` + s + `);
        }

        ` + s[a - 1] + " = " + s[a - 1] + ` - 1;
        if (` + s[a - 2] + " < " + n[a - 2] + ` &&
            ` + s[a - 1] + " < " + n[a - 1] + `) {
          result.b = getValue(` + s + `);
        }
        setOutput(result);
      }
    `;
    }
    return e;
  }();
  function wT(e, t, r) {
    var n = e.indexOf(t), a = e.map(function(o, s) {
      return s === n ? o + " - " + r : o;
    });
    return a.join();
  }
  function BT(e) {
    var t = e.inputs, r = e.backend, n = t.input, a = r.texData.get(n.dataId);
    return hh({ inputs: { x: a.complexTensorInfos.imag }, backend: r });
  }
  var Vje = { kernelName: gt.Imag, backendName: "webgl", kernelFunc: BT };
  function Gy(e, t, r) {
    var n = e[0].dtype;
    if (n === "complex64") {
      var a = e.map(function(E2) {
        return e_({ inputs: { input: E2 }, backend: r });
      }), o = e.map(function(E2) {
        return BT({ inputs: { input: E2 }, backend: r });
      }), s = Gy(a, t, r), i = Gy(o, t, r), l = Uv({ inputs: { real: s, imag: i }, backend: r });
      return a.forEach(function(E2) {
        return r.disposeIntermediateTensorInfo(E2);
      }), o.forEach(function(E2) {
        return r.disposeIntermediateTensorInfo(E2);
      }), r.disposeIntermediateTensorInfo(s), r.disposeIntermediateTensorInfo(i), l;
    }
    var u2 = r.shouldExecuteOnCPU(e);
    if (n === "string" && (u2 = true), u2) {
      var c = e.map(function(E2) {
        var F13 = gt.util.sizeFromShape(E2.shape.slice(t)), N2 = [-1, F13];
        return ti({ inputs: { x: E2 }, backend: r, attrs: { shape: N2 } });
      }), f = c.map(function(E2) {
        return { vals: r.readSync(E2.dataId), shape: E2.shape };
      }), h = gt.backend_util.computeOutShape(c.map(function(E2) {
        return E2.shape;
      }), 1), p = c[0].shape[0] === 1, d = LBe(f, h, n, p), v = gt.backend_util.computeOutShape(e.map(function(E2) {
        return E2.shape;
      }), t), m = r.makeTensorInfo(v, n, d);
      return c.forEach(function(E2) {
        return r.disposeIntermediateTensorInfo(E2);
      }), m;
    }
    if (e.length > gt.env().getNumber("WEBGL_MAX_TEXTURES_IN_SHADER")) {
      var g = Math.floor(e.length / 2), x = Gy(e.slice(0, g), t, r), b = Gy(e.slice(g), t, r), y = Gy([x, b], t, r);
      return r.disposeIntermediateTensorInfo(x), r.disposeIntermediateTensorInfo(b), y;
    }
    if (gt.env().getBool("WEBGL_PACK_ARRAY_OPERATIONS") && e[0].shape.length > 1) {
      var w = new Uje(e.map(function(E2) {
        return E2.shape;
      }), t);
      return r.runWebGLProgram(w, e, n);
    }
    var _4 = jje(e, t, r), k = _4.tensors2D, T2 = _4.outShape, A2 = new Bje(k.map(function(E2) {
      return E2.shape;
    })), S2 = r.runWebGLProgram(A2, k, n);
    k.forEach(function(E2) {
      return r.disposeIntermediateTensorInfo(E2);
    });
    var C2 = ti({ inputs: { x: S2 }, attrs: { shape: T2 }, backend: r });
    return r.disposeIntermediateTensorInfo(S2), C2;
  }
  function jje(e, t, r) {
    var n = gt.backend_util.computeOutShape(e.map(function(o) {
      return o.shape;
    }), t), a = e.map(function(o) {
      return ti({ inputs: { x: o }, attrs: { shape: [-1, gt.util.sizeFromShape(o.shape.slice(t))] }, backend: r });
    });
    return { tensors2D: a, outShape: n };
  }
  function yX(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = n.axis, o = gt.util.parseAxisParam(a, t[0].shape)[0], s = gt.backend_util.computeOutShape(t.map(function(u2) {
      return u2.shape;
    }), o);
    if (gt.util.sizeFromShape(s) === 0) return r.makeTensorInfo(s, t[0].dtype, []);
    var i = t.filter(function(u2) {
      return gt.util.sizeFromShape(u2.shape) > 0;
    });
    if (i.length === 1) return hh({ inputs: { x: i[0] }, backend: r });
    var l = i.map(function(u2) {
      return u2.shape;
    });
    return gt.backend_util.assertParamsConsistent(l, o), Gy(i, o, r);
  }
  var Wje = { kernelName: gt.Concat, backendName: "webgl", kernelFunc: yX };
  var xX = /* @__PURE__ */ function() {
    function e(t, r, n, a, o) {
      r === void 0 && (r = false), n === void 0 && (n = null), a === void 0 && (a = false), o === void 0 && (o = false), this.variableNames = ["x", "W"], this.outputShape = t.outShape;
      var s = t.padInfo.top, i = t.padInfo.left, l = t.strideHeight, u2 = t.strideWidth, c = t.dilationHeight, f = t.dilationWidth, h = t.filterHeight, p = t.filterWidth, d = Math.floor(t.inChannels / 4) * 4, v = t.inChannels % 4, m = t.dataFormat === "channelsLast", g = m ? 1 : 2, x = m ? 2 : 3, b = m ? 3 : 1, y = "", w = "";
      n && (a ? y = `float activation(float a) {
          float b = getPreluActivationWeightsAtOutCoords();
          ` + n + `
        }` : o ? y = `float activation(float a) {
          float b = getLeakyreluAlphaAtOutCoords();
          ` + n + `
        }` : y = `
          float activation(float x) {
            ` + n + `
          }
        `, w = "result = activation(result);");
      var _4 = r ? "result += getBiasAtOutCoords();" : "";
      r && this.variableNames.push("bias"), a && this.variableNames.push("preluActivationWeights"), o && this.variableNames.push("leakyreluAlpha"), this.userCode = `
      ` + y + `

      const ivec2 strides = ivec2(` + l + ", " + u2 + `);
      const ivec2 pads = ivec2(` + s + ", " + i + `);

      void main() {
        ivec4 coords = getOutputCoords();
        int batch = coords[0];
        int d2 = coords[` + b + `];

        ivec2 xRCCorner =
            ivec2(coords[` + g + "], coords[" + x + `]) * strides - pads;
        int xRCorner = xRCCorner.x;
        int xCCorner = xRCCorner.y;

        // Convolve x(?, ?, d1) with w(:, :, d1, d2) to get y(yR, yC, d2).
        // ? = to be determined. : = across all values in that axis.
        float dotProd = 0.0;
        for (int wR = 0; wR < ` + h + `; wR++) {
          int xR = xRCorner + wR * ` + c + `;

          if (xR < 0 || xR >= ` + t.inHeight + `) {
            continue;
          }

          for (int wC = 0; wC < ` + p + `; wC++) {
            int xC = xCCorner + wC * ` + f + `;

            if (xC < 0 || xC >= ` + t.inWidth + `) {
              continue;
            }

            for (int d1 = 0; d1 < ` + d + `; d1 += 4) {
              vec4 wValues = vec4(
                getW(wR, wC, d1, d2),
                getW(wR, wC, d1 + 1, d2),
                getW(wR, wC, d1 + 2, d2),
                getW(wR, wC, d1 + 3, d2)
              );

              if (` + m + `) {
                vec4 xValues = vec4(
                  getX(batch, xR, xC, d1),
                  getX(batch, xR, xC, d1 + 1),
                  getX(batch, xR, xC, d1 + 2),
                  getX(batch, xR, xC, d1 + 3)
                );
                dotProd += dot(xValues, wValues);
              } else {
                vec4 xValues = vec4(
                  getX(batch, d1, xR, xC),
                  getX(batch, d1 + 1, xR, xC),
                  getX(batch, d1 + 2, xR, xC),
                  getX(batch, d1 + 3, xR, xC)
                );
                dotProd += dot(xValues, wValues);
              }
            }

            if (` + (v === 1) + `) {

              if (` + m + `) {
                dotProd +=
                    getX(batch, xR, xC, ` + d + `) *
                    getW(wR, wC, ` + d + `, d2);
              } else {
                dotProd +=
                    getX(batch, ` + d + `, xR, xC) *
                    getW(wR, wC, ` + d + `, d2);
              }

            } else if (` + (v === 2) + `) {
              vec2 wValues = vec2(
                getW(wR, wC, ` + d + `, d2),
                getW(wR, wC, ` + d + ` + 1, d2)
              );

              if (` + m + `) {
                vec2 xValues = vec2(
                  getX(batch, xR, xC, ` + d + `),
                  getX(batch, xR, xC, ` + d + ` + 1)
                );
                dotProd += dot(xValues, wValues);
              } else {
                vec2 xValues = vec2(
                  getX(batch, ` + d + `, xR, xC),
                  getX(batch, ` + d + ` + 1, xR, xC)
                );
                dotProd += dot(xValues, wValues);
              }

            } else if (` + (v === 3) + `) {
              vec3 wValues = vec3(
                getW(wR, wC, ` + d + `, d2),
                getW(wR, wC, ` + d + ` + 1, d2),
                getW(wR, wC, ` + d + ` + 2, d2)
              );

              if (` + m + `) {
                vec3 xValues = vec3(
                  getX(batch, xR, xC, ` + d + `),
                  getX(batch, xR, xC, ` + d + ` + 1),
                  getX(batch, xR, xC, ` + d + ` + 2)
                );
                dotProd += dot(xValues, wValues);
              } else {
                vec3 xValues = vec3(
                  getX(batch, ` + d + `, xR, xC),
                  getX(batch, ` + d + ` + 1, xR, xC),
                  getX(batch, ` + d + ` + 2, xR, xC)
                );
                dotProd += dot(xValues, wValues);
              }

            }
          }
        }

        float result = dotProd;
        ` + _4 + `
        ` + w + `
        setOutput(result);
      }
    `;
    }
    return e;
  }(), Gje = /* @__PURE__ */ function() {
    function e(t) {
      this.variableNames = ["x", "W"], this.outputShape = t.outShape;
      var r = t.padInfo.front, n = t.padInfo.top, a = t.padInfo.left, o = t.strideDepth, s = t.strideHeight, i = t.strideWidth, l = t.dilationDepth, u2 = t.dilationHeight, c = t.dilationWidth, f = t.filterDepth, h = t.filterHeight, p = t.filterWidth, d = Math.floor(t.inChannels / 4) * 4, v = t.inChannels % 4;
      this.userCode = `
      const ivec3 strides = ivec3(` + o + ", " + s + ", " + i + `);
      const ivec3 pads = ivec3(` + r + ", " + n + ", " + a + `);

      void main() {
        ivec5 coords = getOutputCoords();
        int batch = coords.x;
        int d2 = coords.u;

        ivec3 xFRCCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;
        int xFCorner = xFRCCorner.x;
        int xRCorner = xFRCCorner.y;
        int xCCorner = xFRCCorner.z;

        // Convolve x(?, ?, ?, d1) with w(:, :, :, d1, d2) to get
        // y(yF, yR, yC, d2). ? = to be determined. : = across all
        // values in that axis.
        float dotProd = 0.0;
        for (int wF = 0; wF < ` + f + `; wF++) {
          int xF = xFCorner + wF * ` + l + `;

          if (xF < 0 || xF >= ` + t.inDepth + `) {
            continue;
          }

          for (int wR = 0; wR < ` + h + `; wR++) {
            int xR = xRCorner + wR * ` + u2 + `;

            if (xR < 0 || xR >= ` + t.inHeight + `) {
              continue;
            }

            for (int wC = 0; wC < ` + p + `; wC++) {
              int xC = xCCorner + wC * ` + c + `;

              if (xC < 0 || xC >= ` + t.inWidth + `) {
                continue;
              }

              for (int d1 = 0; d1 < ` + d + `; d1 += 4) {
                vec4 xValues = vec4(
                  getX(batch, xF, xR, xC, d1),
                  getX(batch, xF, xR, xC, d1 + 1),
                  getX(batch, xF, xR, xC, d1 + 2),
                  getX(batch, xF, xR, xC, d1 + 3)
                );
                vec4 wValues = vec4(
                  getW(wF, wR, wC, d1, d2),
                  getW(wF, wR, wC, d1 + 1, d2),
                  getW(wF, wR, wC, d1 + 2, d2),
                  getW(wF, wR, wC, d1 + 3, d2)
                );

                dotProd += dot(xValues, wValues);
              }

              if (` + (v === 1) + `) {
                dotProd +=
                  getX(batch, xF, xR, xC, ` + d + `) *
                  getW(wF, wR, wC, ` + d + `, d2);
              } else if (` + (v === 2) + `) {
                vec2 xValues = vec2(
                  getX(batch, xF, xR, xC, ` + d + `),
                  getX(batch, xF, xR, xC, ` + d + ` + 1)
                );
                vec2 wValues = vec2(
                  getW(wF, wR, wC, ` + d + `, d2),
                  getW(wF, wR, wC, ` + d + ` + 1, d2)
                );
                dotProd += dot(xValues, wValues);
              } else if (` + (v === 3) + `) {
                vec3 xValues = vec3(
                  getX(batch, xF, xR, xC, ` + d + `),
                  getX(batch, xF, xR, xC, ` + d + ` + 1),
                  getX(batch, xF, xR, xC, ` + d + ` + 2)
                );
                vec3 wValues = vec3(
                  getW(wF, wR, wC, ` + d + `, d2),
                  getW(wF, wR, wC, ` + d + ` + 1, d2),
                  getW(wF, wR, wC, ` + d + ` + 2, d2)
                );
                dotProd += dot(xValues, wValues);
              }
            }
          }
        }
        setOutput(dotProd);
      }
    `;
    }
    return e;
  }();
  var $je = /* @__PURE__ */ function() {
    function e(t, r) {
      this.variableNames = ["A"], this.packedInputs = true, this.packedOutput = true, this.customUniforms = [{ name: "inputShape", type: "ivec3" }, { name: "pad", type: "ivec2" }, { name: "stride", type: "ivec2" }, { name: "dilation", type: "ivec2" }, { name: "inChannels", type: "int" }, { name: "itemsPerBlockRow", type: "int" }, { name: "outWidth", type: "int" }], this.outputShape = t, this.enableShapeUniforms = Bf(this.outputShape.length);
      for (var n = r.dataFormat, a = ff(), o = n === "channelsLast", s = o ? 0 : 1, i = o ? 1 : 2, l = this.enableShapeUniforms ? "if(blockIndex < outShape[1] && pos < outShape[0]) {" : "if(blockIndex < " + t[1] + " && pos < " + t[0] + ") {", u2 = "", c = 0; c <= 1; c++) for (var f = 0; f <= 1; f++) u2 += `
          blockIndex = rc.y + ` + f + `;
          pos = rc.x + ` + c + `;

          ` + l + `
            offsetY = int(blockIndex / outWidth) * stride[0] - pad[0];
            d0 = offsetY + dilation[0] * (pos / itemsPerBlockRow);

            if(d0 < inputShape[` + s + `] && d0 >= 0) {
              // Use custom imod instead mod. On Intel GPU, mod may generate
              // unexpected value.
              // https://github.com/tensorflow/tfjs/issues/5447
              offsetX = imod(blockIndex, outWidth) * stride[1] - pad[1];
              d1 = offsetX + dilation[1] * (imod(pos, itemsPerBlockRow) /
                  inChannels);

              if(d1 < inputShape[` + i + `] && d1 >= 0) {

                ch = imod(pos, inChannels);

                if (` + o + `) {
                  innerDims = vec2(d1, ch);
                  result[` + (c * 2 + f) + `] = getChannel(
                    getA(d0, int(innerDims.x),
                    int(innerDims.y)), innerDims);
                } else {
                  innerDims = vec2(d0, d1);
                  result[` + (c * 2 + f) + `] = getChannel(
                    getA(ch, int(innerDims.x),
                    int(innerDims.y)), innerDims);
                }
              }
            }
          }
        `;
      this.userCode = `
      void main() {
        ivec2 rc = getOutputCoords();

        vec4 result = vec4(0);

        int blockIndex, pos, offsetY, d0, offsetX, d1, ch;
        vec2 innerDims;

        ` + u2 + `

        ` + a.output + ` = result;
      }
    `;
    }
    return e;
  }();
  function bX(e) {
    var t, r, n = e.x, a = e.filter, o = e.convInfo, s = e.backend, i = e.bias, l = i === void 0 ? null : i, u2 = e.preluActivationWeights, c = u2 === void 0 ? null : u2, f = e.leakyreluAlpha, h = f === void 0 ? 0 : f, p = e.activation, d = p === void 0 ? null : p, v = n.shape, m = s.texData.get(n.dataId), g = o.inChannels, x = v[0] * v[1] * v[2], b = o.outChannels, y = o.dataFormat === "channelsLast", w = false, _4 = false, k, T2 = [], A2 = (x === 1 || b === 1) && g > pX, S2 = !A2 && m.isPacked && y && m.texture != null && v[2] % 2 !== 0 && gt.util.arraysEqual(m.shape.slice(-3), v.slice(-3));
    if (S2) {
      var C2 = v[0] * v[1] * (v[2] + 1), E2 = { dataId: n.dataId, shape: [1, C2, o.inChannels], dtype: n.dtype }, F13 = m.shape;
      m.shape = m.shape.slice(), m.shape[m.shape.length - 2]++, gt.util.assert(K2(m.shape, E2.shape), function() {
        return "packed reshape " + m.shape + " to " + E2.shape + " isn't free";
      });
      var N2 = ti({ inputs: { x: a }, backend: s, attrs: { shape: [1, o.inChannels, o.outChannels] } });
      T2.push(N2);
      var D2 = NT({ a: E2, b: N2, backend: s, transposeA: w, transposeB: _4, bias: l, activation: d, preluActivationWeights: c, leakyreluAlpha: h }), I2 = s.texData.get(D2.dataId);
      gt.util.assert(I2.isPacked, function() {
        return "batchMatMul result is expected to be packed";
      }), m.shape = F13, I2.shape = o.outShape, k = hh({ inputs: { x: D2 }, backend: s }), k.shape = o.outShape, T2.push(D2);
    } else {
      var C2 = y ? v[0] * v[1] * v[2] : v[0] * v[2] * v[3], O2 = ti({ inputs: { x: n }, backend: s, attrs: { shape: [1, C2, o.inChannels] } }), N2 = ti({ inputs: { x: a }, backend: s, attrs: { shape: [1, o.inChannels, o.outChannels] } }), L2 = NT({ a: O2, b: N2, transposeA: w, transposeB: _4, backend: s, bias: l, activation: d, preluActivationWeights: c, leakyreluAlpha: h });
      k = ti({ inputs: { x: L2 }, backend: s, attrs: { shape: o.outShape } }), T2.push(O2), T2.push(N2), T2.push(L2);
    }
    try {
      for (var V2 = Eg(T2), W2 = V2.next(); !W2.done; W2 = V2.next()) {
        var X3 = W2.value;
        s.disposeIntermediateTensorInfo(X3);
      }
    } catch (Y3) {
      t = { error: Y3 };
    } finally {
      try {
        W2 && !W2.done && (r = V2.return) && r.call(V2);
      } finally {
        if (t) throw t.error;
      }
    }
    return k;
  }
  function _X(e) {
    var t, r, n = e.x, a = e.filter, o = e.convInfo, s = e.backend, i = e.bias, l = i === void 0 ? null : i, u2 = e.preluActivationWeights, c = u2 === void 0 ? null : u2, f = e.leakyreluAlpha, h = f === void 0 ? 0 : f, p = e.activation, d = p === void 0 ? null : p, v = o.filterWidth, m = o.filterHeight, g = o.inChannels, x = o.outWidth, b = o.outHeight, y = o.dataFormat, w = y === "channelsLast", _4 = v * m * g, k = b * x, T2 = [_4, k], A2 = true, S2 = false, C2 = [], E2 = ti({ inputs: { x: n }, backend: s, attrs: { shape: n.shape.slice(1) } }), F13 = ti({ inputs: { x: a }, backend: s, attrs: { shape: [1, _4, gt.util.sizeFromShape(a.shape) / _4] } });
    C2.push(E2), C2.push(F13);
    var N2 = new $je(T2, o), D2 = [E2.shape, [o.padInfo.top, o.padInfo.left], [o.strideHeight, o.strideWidth], [o.dilationHeight, o.dilationWidth], [o.inChannels], [o.filterWidth * o.inChannels], [o.outWidth]], I2 = s.runWebGLProgram(N2, [E2], "float32", D2), O2 = ti({ inputs: { x: I2 }, backend: s, attrs: { shape: [1, T2[0], T2[1]] } });
    C2.push(I2), C2.push(O2);
    var L2 = l != null, V2 = c != null, W2 = d === "leakyrelu", X3 = d ? LT(d, true) : null, Y3 = new hX(O2.shape, F13.shape, [1, k, o.outChannels], A2, S2, L2, X3, V2, W2), K3 = [O2, F13];
    if (l && K3.push(l), V2 && K3.push(c), W2) {
      var q = s.makeTensorInfo([], "float32", gt.util.createScalarValue(h, "float32"));
      K3.push(q), C2.push(q);
    }
    var re = s.runWebGLProgram(Y3, K3, "float32"), R2 = w ? [1, b, x, o.outChannels] : [1, o.outChannels, b, x], z = ti({ inputs: { x: re }, backend: s, attrs: { shape: R2 } });
    C2.push(re);
    try {
      for (var H3 = Eg(C2), te = H3.next(); !te.done; te = H3.next()) {
        var j = te.value;
        s.disposeIntermediateTensorInfo(j);
      }
    } catch (Q3) {
      t = { error: Q3 };
    } finally {
      try {
        te && !te.done && (r = H3.return) && r.call(H3);
      } finally {
        if (t) throw t.error;
      }
    }
    return z;
  }
  function Hje(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = t.filter, s = n.strides, i = n.pad, l = n.dataFormat, u2 = n.dilations, c = n.dimRoundingMode, f = gt.backend_util.convertConv2DDataFormat(l), h = gt.backend_util.computeConv2DInfo(a.shape, o.shape, s, u2, i, c, false, f), p;
    if (h.filterHeight === 1 && h.filterWidth === 1 && h.dilationHeight === 1 && h.dilationWidth === 1 && h.strideHeight === 1 && h.strideWidth === 1 && (h.padInfo.type === "SAME" || h.padInfo.type === "VALID")) p = bX({ x: a, filter: o, convInfo: h, backend: r });
    else if (gt.env().getBool("WEBGL_CONV_IM2COL") && a.shape[0] === 1) p = _X({ x: a, filter: o, convInfo: h, backend: r });
    else {
      var d = new xX(h);
      p = r.runWebGLProgram(d, [a, o], "float32");
    }
    var v = ti({ inputs: { x: p }, backend: r, attrs: { shape: h.outShape } });
    return r.disposeIntermediateTensorInfo(p), v;
  }
  var qje = { kernelName: gt.Conv2D, backendName: "webgl", kernelFunc: Hje };
  var Xje = /* @__PURE__ */ function() {
    function e(t) {
      this.variableNames = ["x", "dy"], this.outputShape = t.filterShape;
      var r = t.strideHeight, n = t.strideWidth, a = t.padInfo.top, o = t.padInfo.left, s = t.dataFormat === "channelsLast";
      this.userCode = `
      void main() {
        ivec4 coords = getOutputCoords();
        int wR = coords.x;
        int wC = coords.y;
        int d1 = coords.z;
        int d2 = coords.w;

        // Convolve x(?, ?, d1) with dy(:, :, d2) to get dw(wR, wC, d1, d2).
        // ? = to be determined. : = across all values in that axis.
        float dotProd = 0.0;

        for (int b = 0; b < ` + t.batchSize + `; b++) {
          for (int yR = 0; yR < ` + t.outHeight + `; yR++) {
            int xR = wR + yR * ` + r + " - " + a + `;

            if (xR < 0 || xR >= ` + t.inHeight + `) {
              continue;
            }

            for (int yC = 0; yC < ` + t.outWidth + `; yC++) {
              int xC = wC + yC * ` + n + " - " + o + `;

              if (xC < 0 || xC >= ` + t.inWidth + `) {
                continue;
              }

              if (` + s + `) {
                float dyValue = getDy(b, yR, yC, d2);
                float xValue = getX(b, xR, xC, d1);
                dotProd += (xValue * dyValue);
              } else {
                float dyValue = getDy(b, d2, yR, yC);
                float xValue = getX(b, d1, xR, xC);
                dotProd += (xValue * dyValue);
              }

            }
          }
        }
        setOutput(dotProd);
      }
    `;
    }
    return e;
  }(), Kje = /* @__PURE__ */ function() {
    function e(t) {
      this.variableNames = ["dy", "W"], this.outputShape = t.inShape;
      var r = t.filterHeight, n = t.filterWidth, a = t.strideHeight, o = t.strideWidth, s = t.dataFormat === "channelsLast", i = r - 1 - t.padInfo.top, l = n - 1 - t.padInfo.left, u2 = s ? 1 : 2, c = s ? 2 : 3, f = s ? 3 : 1;
      this.userCode = `
      const ivec2 pads = ivec2(` + i + ", " + l + `);

      void main() {
        ivec4 coords = getOutputCoords();
        int batch = coords[0];
        int d1 = coords[` + f + `];

        ivec2 dyCorner = ivec2(coords[` + u2 + "], coords[" + c + `]) - pads;
        int dyRCorner = dyCorner.x;
        int dyCCorner = dyCorner.y;

        // Convolve dy(?, ?, d2) with w(:, :, d1, d2) to compute dx(xR, xC, d1).
        // ? = to be determined. : = across all values in that axis.
        float dotProd = 0.0;
        for (int wR = 0; wR < ` + r + `; wR++) {
          float dyR = float(dyRCorner + wR) / ` + a + `.0;

          if (dyR < 0.0 || dyR >= ` + t.outHeight + `.0 || fract(dyR) > 0.0) {
            continue;
          }
          int idyR = int(dyR);

          int wRPerm = ` + r + ` - 1 - wR;

          for (int wC = 0; wC < ` + n + `; wC++) {
            float dyC = float(dyCCorner + wC) / ` + o + `.0;

            if (dyC < 0.0 || dyC >= ` + t.outWidth + `.0 ||
                fract(dyC) > 0.0) {
              continue;
            }
            int idyC = int(dyC);

            int wCPerm = ` + n + ` - 1 - wC;

            for (int d2 = 0; d2 < ` + t.outChannels + `; d2++) {

              if (` + s + `) {
                float xValue = getDy(batch, idyR, idyC, d2);
                float wValue = getW(wRPerm, wCPerm, d1, d2);
                dotProd += xValue * wValue;
              } else {
                float xValue = getDy(batch, d2, idyR, idyC);
                float wValue = getW(wRPerm, wCPerm, d1, d2);
                dotProd += xValue * wValue;
              }

            }
          }
        }
        setOutput(dotProd);
      }
    `;
    }
    return e;
  }(), Yje = /* @__PURE__ */ function() {
    function e(t) {
      this.variableNames = ["x", "dy"], this.outputShape = t.filterShape;
      var r = t.strideDepth, n = t.strideHeight, a = t.strideWidth, o = t.padInfo.front, s = t.padInfo.top, i = t.padInfo.left;
      this.userCode = `
      void main() {
        ivec5 coords = getOutputCoords();
        int wF = coords.x;
        int wR = coords.y;
        int wC = coords.z;
        int d1 = coords.w;
        int d2 = coords.u;

        float dotProd = 0.0;

        for (int b = 0; b < ` + t.batchSize + `; b++) {
          for (int yF = 0; yF < ` + t.outDepth + `; yF++) {
            int xF = wF + yF * ` + r + " - " + o + `;

            if (xF < 0 || xF >= ` + t.inDepth + `) {
              continue;
            }

            for (int yR = 0; yR < ` + t.outHeight + `; yR++) {
              int xR = wR + yR * ` + n + " - " + s + `;

              if (xR < 0 || xR >= ` + t.inHeight + `) {
                continue;
              }

              for (int yC = 0; yC < ` + t.outWidth + `; yC++) {
                int xC = wC + yC * ` + a + " - " + i + `;

                if (xC < 0 || xC >= ` + t.inWidth + `) {
                  continue;
                }

                float dyValue = getDy(b, yF, yR, yC, d2);
                float xValue = getX(b, xF, xR, xC, d1);
                dotProd += (xValue * dyValue);
              }
            }
          }
        }
        setOutput(dotProd);
      }
    `;
    }
    return e;
  }(), Zje = /* @__PURE__ */ function() {
    function e(t) {
      this.variableNames = ["dy", "W"], this.outputShape = t.inShape;
      var r = t.filterDepth, n = t.filterHeight, a = t.filterWidth, o = t.strideDepth, s = t.strideHeight, i = t.strideWidth, l = r - 1 - t.padInfo.front, u2 = n - 1 - t.padInfo.top, c = a - 1 - t.padInfo.left;
      this.userCode = `
      const ivec3 pads = ivec3(` + l + ", " + u2 + ", " + c + `);

      void main() {
        ivec5 coords = getOutputCoords();
        int batch = coords.x;
        int d1 = coords.u;


        ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;
        int dyFCorner = dyCorner.x;
        int dyRCorner = dyCorner.y;
        int dyCCorner = dyCorner.z;

        float dotProd = 0.0;
        for (int wF = 0; wF < ` + r + `; wF++) {
          float dyF = float(dyFCorner + wF) / ` + o + `.0;

          if (dyF < 0.0 || dyF >= ` + t.outDepth + `.0 || fract(dyF) > 0.0) {
            continue;
          }
          int idyF = int(dyF);

          int wFPerm = ` + r + ` - 1 - wF;

          for (int wR = 0; wR < ` + n + `; wR++) {
            float dyR = float(dyRCorner + wR) / ` + s + `.0;

            if (dyR < 0.0 || dyR >= ` + t.outHeight + `.0 ||
              fract(dyR) > 0.0) {
              continue;
            }
            int idyR = int(dyR);

            int wRPerm = ` + n + ` - 1 - wR;

            for (int wC = 0; wC < ` + a + `; wC++) {
              float dyC = float(dyCCorner + wC) / ` + i + `.0;

              if (dyC < 0.0 || dyC >= ` + t.outWidth + `.0 ||
                  fract(dyC) > 0.0) {
                continue;
              }
              int idyC = int(dyC);

              int wCPerm = ` + a + ` - 1 - wC;

              for (int d2 = 0; d2 < ` + t.outChannels + `; d2++) {
                float xValue = getDy(batch, idyF, idyR, idyC, d2);
                float wValue = getW(wFPerm, wRPerm, wCPerm, d1, d2);
                dotProd += xValue * wValue;
              }
            }
          }
        }
        setOutput(dotProd);
      }
    `;
    }
    return e;
  }();
  function Jje(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = t.dy, s = n.strides, i = n.pad, l = n.dataFormat, u2 = n.dimRoundingMode, c = n.filterShape, f = gt.backend_util.convertConv2DDataFormat(l), h = gt.backend_util.computeConv2DInfo(a.shape, c, s, 1, i, u2, false, f), p = new Xje(h);
    return r.runWebGLProgram(p, [a, o], "float32");
  }
  var Qje = { kernelName: gt.Conv2DBackpropFilter, backendName: "webgl", kernelFunc: Jje };
  function eWe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.dy, o = t.filter, s = n.inputShape, i = n.strides, l = n.pad, u2 = n.dataFormat, c = n.dimRoundingMode, f = gt.backend_util.convertConv2DDataFormat(u2), h = gt.backend_util.computeConv2DInfo(s, o.shape, i, 1, l, c, false, f), p = new Kje(h);
    return r.runWebGLProgram(p, [a, o], "float32");
  }
  var tWe = { kernelName: gt.Conv2DBackpropInput, backendName: "webgl", kernelFunc: eWe };
  function rWe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = t.filter, s = n.strides, i = n.pad, l = n.dilations, u2 = gt.backend_util.computeConv3DInfo(a.shape, o.shape, s, l, i), c = new Gje(u2);
    return r.runWebGLProgram(c, [a, o], "float32");
  }
  var nWe = { kernelName: gt.Conv3D, backendName: "webgl", kernelFunc: rWe };
  function aWe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = t.dy, s = n.strides, i = n.pad, l = n.filterShape, u2 = gt.backend_util.computeConv3DInfo(a.shape, l, s, 1, i), c = new Yje(u2);
    return r.runWebGLProgram(c, [a, o], "float32");
  }
  var iWe = { kernelName: gt.Conv3DBackpropFilterV2, backendName: "webgl", kernelFunc: aWe };
  function oWe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.dy, o = t.filter, s = n.pad, i = n.strides, l = n.inputShape, u2 = gt.backend_util.computeConv3DInfo(l, o.shape, i, 1, s), c = new Zje(u2);
    return r.runWebGLProgram(c, [a, o], "float32");
  }
  var sWe = { kernelName: gt.Conv3DBackpropInputV2, backendName: "webgl", kernelFunc: oWe };
  var lWe = Jy + `
  return cos(x);
`, uWe = Xo({ opSnippet: lWe }), cWe = { kernelName: gt.Cos, backendName: "webgl", kernelFunc: uWe };
  var fWe = `
  float e2x = exp(-x);
  return (e2x + 1.0 / e2x) / 2.0;
`, hWe = Xo({ opSnippet: fWe }), pWe = { kernelName: gt.Cosh, backendName: "webgl", kernelFunc: hWe };
  var dWe = /* @__PURE__ */ function() {
    function e(t, r, n, a, o) {
      this.variableNames = ["Image", "Boxes", "BoxInd"], this.outputShape = [];
      var s = _i(t, 4), i = s[0], l = s[1], u2 = s[2], c = s[3], f = _i(r, 1), h = f[0], p = _i(n, 2), d = p[0], v = p[1];
      this.outputShape = [h, d, v, c];
      var m = a === "bilinear" ? 1 : 0, g = _i([l - 1 + ".0", u2 - 1 + ".0"], 2), x = g[0], b = g[1], y = _i(d > 1 ? ["" + (l - 1) / (d - 1), "(y2-y1) * height_ratio", "y1*" + x + " + float(y)*(height_scale)"] : ["0.0", "0.0", "0.5 * (y1+y2) * " + x], 3), w = y[0], _4 = y[1], k = y[2], T2 = _i(v > 1 ? ["" + (u2 - 1) / (v - 1), "(x2-x1) * width_ratio", "x1*" + b + " + float(x)*(width_scale)"] : ["0.0", "0.0", "0.5 * (x1+x2) * " + b], 3), A2 = T2[0], S2 = T2[1], C2 = T2[2];
      this.userCode = `
      const float height_ratio = float(` + w + `);
      const float width_ratio = float(` + A2 + `);
      void main() {
        ivec4 coords = getOutputCoords();
        int b = coords[0];
        int y = coords[1];
        int x = coords[2];
        int d = coords[3];

        // get box vals
        float y1 = getBoxes(b,0);
        float x1 = getBoxes(b,1);
        float y2 = getBoxes(b,2);
        float x2 = getBoxes(b,3);

        // get image in batch index
        int bInd = round(getBoxInd(b));
        if(bInd < 0 || bInd >= ` + i + `) {
          return;
        }

        float height_scale = ` + _4 + `;
        float width_scale = ` + S2 + `;

        float in_y = ` + k + `;
        if( in_y < 0.0 || in_y > ` + x + ` ) {
          setOutput(float(` + o + `));
          return;
        }
        float in_x = ` + C2 + `;
        if( in_x < 0.0 || in_x > ` + b + ` ) {
          setOutput(float(` + o + `));
          return;
        }

        vec2 sourceFracIndexCR = vec2(in_x,in_y);
        if(` + m + ` == 1) {
          // Compute the four integer indices.
          ivec2 sourceFloorCR = ivec2(sourceFracIndexCR);
          ivec2 sourceCeilCR = ivec2(ceil(sourceFracIndexCR));

          float topLeft = getImage(b, sourceFloorCR.y, sourceFloorCR.x, d);
          float bottomLeft = getImage(b, sourceCeilCR.y, sourceFloorCR.x, d);
          float topRight = getImage(b, sourceFloorCR.y, sourceCeilCR.x, d);
          float bottomRight = getImage(b, sourceCeilCR.y, sourceCeilCR.x, d);

          vec2 fracCR = sourceFracIndexCR - vec2(sourceFloorCR);

          float top = topLeft + (topRight - topLeft) * fracCR.x;
          float bottom = bottomLeft + (bottomRight - bottomLeft) * fracCR.x;
          float newValue = top + (bottom - top) * fracCR.y;
          setOutput(newValue);
        } else {
          // Compute the coordinators of nearest neighbor point.
          ivec2 sourceNearestCR = ivec2(floor(
            sourceFracIndexCR + vec2(0.5,0.5)));
          float newValue = getImage(b, sourceNearestCR.y, sourceNearestCR.x, d);
          setOutput(newValue);
        }
      }
    `;
    }
    return e;
  }();
  var vWe = function(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.image, o = t.boxes, s = t.boxInd, i = n.cropSize, l = n.method, u2 = n.extrapolationValue, c = new dWe(a.shape, o.shape, i, l, u2);
    return r.runWebGLProgram(c, [a, o, s], "float32");
  }, mWe = { kernelName: gt.CropAndResize, backendName: "webgl", kernelFunc: vWe }, YH = /* @__PURE__ */ function() {
    function e(t, r, n) {
      this.variableNames = ["x"], this.customUniforms = [{ name: "index", type: "float" }], this.outputShape = t;
      var a = t.length, o = r ? "0.0" : "getX(" + ZH(a, "coords") + ")", s = t[t.length - 1], i = "", l = "";
      r ? (i = n ? "end != " + (s - 1) : "end != 0", l = n ? "end + 1" : "end - 1") : (i = n ? "end + pow2 < " + s : "end >= pow2", l = n ? "end + pow2" : "end - pow2"), this.userCode = `
      void main() {
        ` + $s(a) + ` coords = getOutputCoords();
        int end = ` + JH(a, "coords") + `;
        float val = ` + o + `;
        int pow2 = int(pow(2.0, index));
        if (` + i + `) {
          int idx = ` + l + `;
          ` + JH(a, "coords") + ` = idx;
          val += getX(` + ZH(a, "coords") + `);
        }
        setOutput(val);
      }
    `;
    }
    return e;
  }();
  function ZH(e, t) {
    if (e === 1) return "" + t;
    if (e === 2) return t + ".x, " + t + ".y";
    if (e === 3) return t + ".x, " + t + ".y, " + t + ".z";
    if (e === 4) return t + ".x, " + t + ".y, " + t + ".z, " + t + ".w";
    throw Error("Cumulative sum for rank " + e + " is not yet supported");
  }
  function JH(e, t) {
    if (e === 1) return "" + t;
    if (e === 2) return t + ".y";
    if (e === 3) return t + ".z";
    if (e === 4) return t + ".w";
    throw Error("Cumulative sum for rank " + e + " is not yet supported");
  }
  function gWe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.axis, s = n.exclusive, i = n.reverse, l = a.shape.length, u2 = gt.backend_util.getAxesPermutation([o], l), c = a;
    u2 != null && (c = cf({ inputs: { x: a }, backend: r, attrs: { perm: u2 } }));
    var f = gt.backend_util.getInnerMostAxes(1, l)[0];
    if (f !== l - 1) throw new Error("WebGL cumsum shader expects an inner-most axis=" + (a.shape.length - 1) + " " + ("but got axis=" + o));
    for (var h = c.shape[f], p = hh({ inputs: { x: c }, backend: r }), d = 0; d <= Math.ceil(Math.log2(h)) - 1; d++) {
      var v = new YH(c.shape, false, i), m = [[d]], g = p;
      p = r.runWebGLProgram(v, [p], p.dtype, m), r.disposeIntermediateTensorInfo(g);
    }
    if (s) {
      var v = new YH(c.shape, s, i), g = p;
      p = r.runWebGLProgram(v, [p], p.dtype), r.disposeIntermediateTensorInfo(g);
    }
    if (u2 != null) {
      var x = gt.backend_util.getUndoAxesPermutation(u2), b = cf({ inputs: { x: p }, backend: r, attrs: { perm: x } });
      return r.disposeIntermediateTensorInfo(p), r.disposeIntermediateTensorInfo(c), b;
    }
    return p;
  }
  var yWe = { kernelName: gt.Cumsum, backendName: "webgl", kernelFunc: gWe };
  function xWe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = t.weights, s = n.size, i = n.binaryOutput;
    if (a.shape.length === 1) {
      var l = r.readSync(a.dataId), u2 = r.readSync(o.dataId), c = tX(l, u2, o.dtype, o.shape, s);
      return r.makeTensorInfo([s], o.dtype, c);
    } else if (a.shape.length === 2) {
      var f = r.bufferSync(a), h = r.bufferSync(o), p = OBe(f, h, s, i);
      return r.makeTensorInfo(p.shape, o.dtype, p.values);
    }
    throw new Error("Error in denseBincount: input must be at most rank 2, but got rank" + (a.shape.length + "."));
  }
  var bWe = { kernelName: gt.DenseBincount, backendName: "webgl", kernelFunc: xWe };
  var _We = function() {
    function e(t, r, n) {
      this.variableNames = ["x"], this.outputShape = [], this.outputShape = t, this.blockSize = r, this.dataFormat = n, this.userCode = `
    void main() {
      ivec4 coords = getOutputCoords();
      int b = coords[0];
      int h = ` + this.getHeightCoordString() + `;
      int w = ` + this.getWidthCoordString() + `;
      int d = ` + this.getDepthCoordString() + `;

      int in_h = h / ` + r + `;
      int offset_h = imod(h, ` + r + `);
      int in_w = w / ` + r + `;
      int offset_w = imod(w, ` + r + `);
      int offset_d = (offset_h * ` + r + ` + offset_w) *
        ` + this.getOutputDepthSize() + `;
      int in_d = d + offset_d;

      float result = ` + this.getInputSamplingString() + `;
      setOutput(result);
    }
  `;
    }
    return e.prototype.getHeightCoordString = function() {
      return this.dataFormat === "NHWC" ? "coords[1]" : "coords[2]";
    }, e.prototype.getWidthCoordString = function() {
      return this.dataFormat === "NHWC" ? "coords[2]" : "coords[3]";
    }, e.prototype.getDepthCoordString = function() {
      return this.dataFormat === "NHWC" ? "coords[3]" : "coords[1]";
    }, e.prototype.getOutputDepthSize = function() {
      return this.dataFormat === "NHWC" ? this.outputShape[3] : this.outputShape[1];
    }, e.prototype.getInputSamplingString = function() {
      return this.dataFormat === "NHWC" ? "getX(b, in_h, in_w, in_d)" : "getX(b, in_d, in_h, in_w)";
    }, e;
  }();
  function wWe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.blockSize, s = n.dataFormat, i = a.shape[0], l = s === "NHWC" ? a.shape[1] : a.shape[2], u2 = s === "NHWC" ? a.shape[2] : a.shape[3], c = s === "NHWC" ? a.shape[3] : a.shape[1], f = l * o, h = u2 * o, p = c / (o * o), d = s === "NHWC" ? [i, f, h, p] : [i, p, f, h], v = new _We(d, o, s);
    return r.runWebGLProgram(v, [a], a.dtype);
  }
  var kWe = { kernelName: gt.DepthToSpace, backendName: "webgl", kernelFunc: wWe };
  var wX = /* @__PURE__ */ function() {
    function e(t, r, n, a, o) {
      r === void 0 && (r = false), n === void 0 && (n = null), a === void 0 && (a = false), o === void 0 && (o = false), this.variableNames = ["x", "W"], this.customUniforms = [{ name: "pads", type: "ivec2" }, { name: "strides", type: "ivec2" }, { name: "dilations", type: "ivec2" }, { name: "inDims", type: "ivec2" }], this.outputShape = t.outShape, this.enableShapeUniforms = Bf(this.outputShape.length);
      var s = t.filterHeight, i = t.filterWidth, l = t.outChannels / t.inChannels, u2 = "", c = "";
      n && (a ? u2 = `float activation(float a) {
          float b = getPreluActivationWeightsAtOutCoords();
          ` + n + `
        }` : o ? u2 = `float activation(float a) {
          float b = getLeakyreluAlphaAtOutCoords();
          ` + n + `
        }` : u2 = `
          float activation(float x) {
            ` + n + `
          }
        `, c = "result = activation(result);");
      var f = r ? "result += getBiasAtOutCoords();" : "";
      r && this.variableNames.push("bias"), a && this.variableNames.push("preluActivationWeights"), o && this.variableNames.push("leakyreluAlpha"), this.userCode = `
      ` + u2 + `

      void main() {
        ivec4 coords = getOutputCoords();
        int batch = coords.x;
        ivec2 xRCCorner = coords.yz * strides - pads;
        int d2 = coords.w;
        int d1 = d2 / ` + l + `;
        int q = d2 - d1 * ` + l + `;

        int xRCorner = xRCCorner.x;
        int xCCorner = xRCCorner.y;

        // Convolve x(?, ?, d1) with w(:, :, d1, q) to get y(yR, yC, d2).
        // ? = to be determined. : = across all values in that axis.
        float dotProd = 0.0;
        // TO DO(dsmilkov): Flatten the two for loops and vec4 the operations.
        for (int wR = 0; wR < ` + s + `; wR++) {
          int xR = xRCorner + wR * dilations[0];

          if (xR < 0 || xR >= inDims[0]) {
            continue;
          }

          for (int wC = 0; wC < ` + i + `; wC++) {
            int xC = xCCorner + wC * dilations[1];

            if (xC < 0 || xC >= inDims[1]) {
              continue;
            }

            float xVal = getX(batch, xR, xC, d1);
            float wVal = getW(wR, wC, d1, q);
            dotProd += xVal * wVal;
          }
        }

        float result = dotProd;
        ` + f + `
        ` + c + `
        setOutput(result);
      }
    `;
    }
    return e;
  }();
  var kX = /* @__PURE__ */ function() {
    function e(t, r, n, a, o) {
      r === void 0 && (r = false), n === void 0 && (n = null), a === void 0 && (a = false), o === void 0 && (o = false), this.variableNames = ["x", "W"], this.packedInputs = true, this.packedOutput = true, this.customUniforms = [{ name: "pads", type: "ivec2" }, { name: "strides", type: "ivec2" }, { name: "dilations", type: "ivec2" }, { name: "inDims", type: "ivec2" }], this.outputShape = t.outShape, this.enableShapeUniforms = Bf(this.outputShape.length);
      for (var s = t.outChannels / t.inChannels, i = t.padInfo.left, l = t.strideWidth, u2 = t.dilationWidth, c = t.filterHeight, f = t.filterWidth, h = f, p = `
      int xR; int xC; int xCOffset;
      vec4 wTexel; vec4 previous; vec4 final;`, d = 0; d < f; d++) p += `
          vec4 xTexelC` + d * 2 + `;
          int xTexelC` + d * 2 + `Ready;
          vec4 xTexelC` + (d * 2 + 1) + `;
          int xTexelC` + (d * 2 + 1) + `Ready;
          vec4 xC` + d + ";";
      p += `
    for (int r = 0; r < ` + c + `; r++) {
      `;
      for (var d = 0; d < f; d++) p += `
          xTexelC` + d * 2 + ` = vec4(0.0);
          xTexelC` + d * 2 + `Ready = 0;
          xTexelC` + (d * 2 + 1) + ` = vec4(0.0);
          xTexelC` + (d * 2 + 1) + `Ready = 0;
          xC` + d + " = vec4(0.0);";
      p += `
        xR = xRCorner + r * dilations[0];
        if (xR >=0 && xR < inDims[0]) {
      `;
      for (var v = 0; v < (h + 1) / 2; v++) {
        var m = v * 2;
        if (p += `
          xC = xCCorner + ` + m * u2 + `;
          `, l === 1) {
          if (m < f && (i % 2 === 1 ? (p += `
                xCOffset = xC + 1;
                if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC` + m + `Ready == 0) {
                  xTexelC` + m + ` = getX(batch, xR, xCOffset, d1);

                  // Need to manually clear unused channels in case
                  // we're reading from recycled texture.
                  if (xCOffset + 1 >= inDims[1]) {
                    xTexelC` + m + `.zw = vec2(0.0);
                  }
                  xTexelC` + m + `Ready = 1;
                }
              `, u2 === 1 && m > 0 ? p += `
                xC` + m + " = vec4(xTexelC" + (m - 2) + ".zw, xTexelC" + m + `.xy);
                ` : p += `
                  xCOffset = xC + 1 - 2;

                  if (xCOffset >= 0 && xCOffset < inDims[1]) {
                    previous = getX(batch, xR, xCOffset, d1);

                    // Need to manually clear unused channels in case
                    // we're reading from recycled texture.
                    if (xCOffset + 1 >= inDims[1]) {
                      previous.zw = vec2(0.0);
                    }

                    xC` + m + " = vec4(previous.zw, xTexelC" + m + `.xy);
                  } else {
                    xC` + m + " = vec4(0.0, 0.0, xTexelC" + m + `.xy);
                  }
                  `) : p += `
                if (xC >= 0 && xC < inDims[1] && xTexelC` + m + `Ready == 0) {
                  xTexelC` + m + ` = getX(batch, xR, xC, d1);
                  if (xC + 1 >= inDims[1]) {
                    xTexelC` + m + `.zw = vec2(0.0);
                  }
                  xTexelC` + m + `Ready = 1;
                }

                xC` + m + " = xTexelC" + m + `;
                `, m + 1 < f)) {
            var g = i % 2 === 0 ? gt.util.nearestLargerEven(u2) : u2;
            u2 % 2 === 0 && i % 2 === 1 || u2 % 2 !== 0 && i % 2 !== 1 ? (p += `
                  xCOffset = xC + imod(pads[1], 2) + ` + g + `;

                  if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC` + (m + 1) + `Ready == 0) {
                    xTexelC` + (m + 1) + ` = getX(batch, xR, xCOffset, d1);

                    // Need to manually clear unused channels in case
                    // we're reading from recycled texture.
                    if (xCOffset + 1 >= inDims[1]) {
                      xTexelC` + (m + 1) + `.zw = vec2(0.0);
                    }
                    xTexelC` + (m + 1) + `Ready = 1;
                  }
                  `, u2 > 1 && (p += `
                    xCOffset -= 2;
                    if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC` + m + `Ready == 0) {
                      xTexelC` + m + ` = getX(batch, xR, xCOffset, d1);
                      xTexelC` + m + `Ready = 1;
                    }
                    `), p += `
                  xC` + (m + 1) + " = vec4(xTexelC" + m + ".zw, xTexelC" + (m + 1) + `.xy);
                  `) : g === 1 ? p += `
                    xC` + (m + 1) + " = xTexelC" + m + `;
                    ` : p += `
                    xCOffset = xC + ` + g + `;

                    if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC` + (m + 1) + `Ready == 0) {
                      xTexelC` + (m + 1) + ` = getX(batch, xR, xCOffset, d1);
                      if (xCOffset + 1 >= inDims[1]) {
                        xTexelC` + (m + 1) + `.zw = vec2(0.0);
                      }
                      xTexelC` + (m + 1) + `Ready = 1;
                    }

                    xC` + (m + 1) + " = xTexelC" + (m + 1) + `;
                    `;
          }
        } else m < f && (i % 2 === 1 ? (p += `
                xCOffset = xC + 1 - strides[1];
                if(xCOffset >= 0 && xCOffset < inDims[1] && xTexelC` + m + `Ready == 0) {
                  xTexelC` + m + ` = getX(batch, xR, xCOffset, d1);
                  // Need to manually clear unused channels in case
                  // we're reading from recycled texture.
                  if (xCOffset + 1 >= inDims[1]) {
                    xTexelC` + m + `.zw = vec2(0.0);
                  }
                  xTexelC` + m + `Ready = 1;
                }

                if(xC + 1 >= 0 && xC + 1 < inDims[1] && xTexelC` + (m + 1) + `Ready == 0) {
                  xTexelC` + (m + 1) + ` = getX(batch, xR, xC + 1, d1);
                  // Need to manually clear unused channels in case
                  // we're reading from recycled texture.
                  if (xC + 2 >= inDims[1]) {
                    xTexelC` + (m + 1) + `.zw = vec2(0.0);
                  }
                  xTexelC` + (m + 1) + `Ready = 1;
                }

                xC` + m + " = vec4(xTexelC" + m + ".zw, xTexelC" + (m + 1) + `.zw);
              `, m + 1 < f && (p += `
                  final = vec4(0.0);
                  xCOffset = xC + 1 + strides[1];
                  if(xCOffset >= 0 && xCOffset < inDims[1]) {
                    final = getX(batch, xR, xCOffset, d1);
                  }
                  xC` + (m + 1) + " = vec4(xTexelC" + (m + 1) + `.xy, final.xy);
                `)) : (p += `
                if(xC >= 0 && xC < inDims[1] && xTexelC` + m + `Ready == 0) {
                  xTexelC` + m + ` = getX(batch, xR, xC, d1);
                  if (xC + 1 >= inDims[1]) {
                    xTexelC` + m + `.zw = vec2(0.0);
                  }
                  xTexelC` + m + `Ready = 1;
                }

                xCOffset = xC + strides[1];
                if(xCOffset >= 0 && xCOffset < inDims[1] && xTexelC` + (m + 1) + `Ready == 0) {
                  xTexelC` + (m + 1) + ` = getX(batch, xR, xCOffset, d1);
                  if (xCOffset + 1 >= inDims[1]) {
                    xTexelC` + (m + 1) + `.zw = vec2(0.);
                  }
                  xTexelC` + (m + 1) + `Ready = 1;
                }

                xC` + m + ` = vec4(
                  xTexelC` + m + ".xy, xTexelC" + (m + 1) + `.xy);
              `, m + 1 < f && (p += `
                  xC` + (m + 1) + " = vec4(xTexelC" + m + ".zw, xTexelC" + (m + 1) + `.zw);
                `)));
        m < f && (p += `
            wTexel = getW(r, ` + m + `, d1, q);
            dotProd += xC` + m + ` * vec4(wTexel.xz, wTexel.xz);
          `, m + 1 < f && (p += `
              wTexel = getW(r, ` + (m + 1) + `, d1, q);
              dotProd += xC` + (m + 1) + ` * vec4(wTexel.xz, wTexel.xz);
            `));
      }
      p += `
    }
  `, p += `
      }
    `;
      var x = "", b = "";
      n && (a ? x = `vec4 activation(vec4 a) {
          vec4 b = getPreluActivationWeightsAtOutCoords();
          ` + n + `
        }` : o ? x = `vec4 activation(vec4 a) {
          vec4 b = getLeakyreluAlphaAtOutCoords();
          ` + n + `
        }` : x = `vec4 activation(vec4 x) {
          ` + n + `
        }`, b = "result = activation(result);");
      var y = r ? "result += getBiasAtOutCoords();" : "";
      r && this.variableNames.push("bias"), a && this.variableNames.push("preluActivationWeights"), o && this.variableNames.push("leakyreluAlpha"), this.userCode = `
      ` + x + `

      void main() {
        ivec4 coords = getOutputCoords();
        int batch = coords.x;
        ivec2 xRCCorner = coords.yz * strides - pads;
        int d2 = coords.w;
        int d1 = d2 / ` + s + `;
        int q = d2 - d1 * ` + s + `;
        int xRCorner = xRCCorner.x;
        int xCCorner = xRCCorner.y;

        //intialize dotProd with a small epsilon seems to reduce GPU accuracy loss.
        vec4 dotProd = vec4(0.000000000000001);

        ` + p + `

        vec4 result = dotProd - vec4(0.000000000000001);
        ` + y + `
        ` + b + `
        setOutput(result);
      }
    `;
    }
    return e;
  }();
  function TWe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = t.filter, s = n.strides, i = n.pad, l = n.dilations, u2 = n.dimRoundingMode, c = l;
    c == null && (c = [1, 1]), gt.util.assert(gt.backend_util.eitherStridesOrDilationsAreOne(s, c), function() {
      return "Error in depthwiseConv2d: Either strides or dilations must be " + ("1. Got strides " + s + " and dilations '" + c + "'");
    });
    var f = gt.backend_util.computeConv2DInfo(a.shape, o.shape, s, c, i, u2, true), h;
    gt.env().getBool("WEBGL_PACK_DEPTHWISECONV") && f.strideWidth <= 2 && f.outChannels / f.inChannels === 1 ? h = new kX(f) : h = new wX(f);
    var p = [[f.padInfo.top, f.padInfo.left], [f.strideHeight, f.strideWidth], [f.dilationHeight, f.dilationWidth], [f.inHeight, f.inWidth]];
    return r.runWebGLProgram(h, [a, o], "float32", p);
  }
  var AWe = { kernelName: gt.DepthwiseConv2dNative, backendName: "webgl", kernelFunc: TWe };
  var SWe = /* @__PURE__ */ function() {
    function e(t) {
      this.variableNames = ["x", "dy"], this.outputShape = t.filterShape;
      var r = t.strideHeight, n = t.strideWidth, a = t.padInfo.top, o = t.padInfo.left, s = t.outChannels / t.inChannels;
      this.userCode = `
      void main() {
        ivec4 coords = getOutputCoords();
        int wR = coords.x;
        int wC = coords.y;
        int d1 = coords.z;
        int dm = coords.w;
        int d2 = d1 * ` + s + ` + dm;

        float dotProd = 0.0;

        // TO DO: Vec4 over the batch size
        for (int b = 0; b < ` + t.batchSize + `; b++) {
          for (int yR = 0; yR < ` + t.outHeight + `; yR++) {
            int xR = wR + yR * ` + r + " - " + a + `;

            if (xR < 0 || xR >= ` + t.inHeight + `) {
              continue;
            }

            for (int yC = 0; yC < ` + t.outWidth + `; yC++) {
              int xC = wC + yC * ` + n + " - " + o + `;

              if (xC < 0 || xC >= ` + t.inWidth + `) {
                continue;
              }

              float dyValue = getDy(b, yR, yC, d2);
              float xValue = getX(b, xR, xC, d1);
              dotProd += (xValue * dyValue);
            }
          }
        }
        setOutput(dotProd);
      }
    `;
    }
    return e;
  }(), EWe = /* @__PURE__ */ function() {
    function e(t) {
      this.variableNames = ["dy", "W"], this.outputShape = t.inShape;
      var r = t.filterHeight, n = t.filterWidth, a = t.strideHeight, o = t.strideWidth, s = r - 1 - t.padInfo.top, i = n - 1 - t.padInfo.left, l = t.outChannels / t.inChannels;
      this.userCode = `
      const ivec2 pads = ivec2(` + s + ", " + i + `);

      void main() {
        ivec4 coords = getOutputCoords();
        int batch = coords[0];
        int d1 = coords[3];
        ivec2 dyCorner = coords.yz - pads;
        int dyRCorner = dyCorner.x;
        int dyCCorner = dyCorner.y;

        float dotProd = 0.0;

        for (int wR = 0; wR < ` + r + `; wR++) {
          float dyR = float(dyRCorner + wR) / ` + a + `.0;

          if (dyR < 0.0 || dyR >= ` + t.outHeight + `.0 || fract(dyR) > 0.0) {
            continue;
          }
          int idyR = int(dyR);

          int wRPerm = ` + r + ` - 1 - wR;

          for (int wC = 0; wC < ` + n + `; wC++) {
            float dyC = float(dyCCorner + wC) / ` + o + `.0;

            if (dyC < 0.0 || dyC >= ` + t.outWidth + `.0 ||
                fract(dyC) > 0.0) {
              continue;
            }
            int idyC = int(dyC);

            int wCPerm = ` + n + ` - 1 - wC;

            // TO DO: Vec4 over the channelMul
            for (int dm = 0; dm < ` + l + `; dm++) {
              int d2 = d1 * ` + l + ` + dm;
              float xValue = getDy(batch, idyR, idyC, d2);
              float wValue = getW(wRPerm, wCPerm, d1, dm);
              dotProd += xValue * wValue;
            }
          }
        }
        setOutput(dotProd);
      }
    `;
    }
    return e;
  }();
  function DWe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = t.dy, s = n.strides, i = n.dilations, l = n.pad, u2 = n.dimRoundingMode, c = n.filterShape, f = gt.backend_util.computeConv2DInfo(a.shape, c, s, i, l, u2, true), h = new SWe(f);
    return r.runWebGLProgram(h, [a, o], "float32");
  }
  var CWe = { kernelName: gt.DepthwiseConv2dNativeBackpropFilter, backendName: "webgl", kernelFunc: DWe };
  function MWe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.dy, o = t.filter, s = n.strides, i = n.dilations, l = n.pad, u2 = n.dimRoundingMode, c = n.inputShape, f = gt.backend_util.computeConv2DInfo(c, o.shape, s, i, l, u2, true), h = new EWe(f);
    return r.runWebGLProgram(h, [a, o], "float32");
  }
  var IWe = { kernelName: gt.DepthwiseConv2dNativeBackpropInput, backendName: "webgl", kernelFunc: MWe };
  var NWe = /* @__PURE__ */ function() {
    function e(t) {
      this.variableNames = ["X"], this.outputShape = [t, t], this.userCode = `
      void main() {
          ivec2 coords = getOutputCoords();
          float val = coords[0] == coords[1] ? getX(coords[0]) : 0.0;
          setOutput(val);
      }
    `;
    }
    return e;
  }();
  function FWe(e) {
    var t = e.inputs, r = e.backend, n = t.x, a = uf(n.shape, n.shape), o = gt.util.sizeFromShape(n.shape), s = ti({ inputs: { x: n }, backend: r, attrs: { shape: [o] } }), i = new NWe(o), l = r.runWebGLProgram(i, [s], s.dtype), u2 = ti({ inputs: { x: l }, backend: r, attrs: { shape: a } });
    return r.disposeIntermediateTensorInfo(s), r.disposeIntermediateTensorInfo(l), u2;
  }
  var OWe = { kernelName: gt.Diag, backendName: "webgl", kernelFunc: FWe };
  var PWe = /* @__PURE__ */ function() {
    function e(t) {
      this.variableNames = ["x", "W"], this.outputShape = t.outShape;
      var r = t.inHeight, n = t.inWidth, a = t.padInfo, o = t.strideHeight, s = t.strideWidth, i = t.filterHeight, l = t.filterWidth, u2 = t.dilationHeight, c = t.dilationWidth, f = a.top, h = a.left;
      this.userCode = `
      const ivec2 strides = ivec2(` + o + ", " + s + `);
      const ivec2 pads = ivec2(` + f + ", " + h + `);
      const float neg_infinity = -3.4e38;

      void main() {
        ivec4 coords = getOutputCoords();
        int batch = coords.x;
        int d1 = coords.w;
        ivec2 outTopLeftCorner =
            coords.yz * strides - pads;
        int hBeg = outTopLeftCorner.x;
        int wBeg = outTopLeftCorner.y;

        float curVal = neg_infinity;
        for (int h = 0; h < ` + i + `; h++) {
          int hIn = hBeg + h * ` + u2 + `;

          if (hIn >= 0 && hIn < ` + r + `) {
            for (int w = 0; w < ` + l + `; w++) {
              int wIn = wBeg + w * ` + c + `;

              if (wIn >= 0 && wIn < ` + n + `) {
                float xVal = getX(batch, hIn, wIn, d1);
                float wVal = getW(h, w, d1);

                float val = xVal + wVal;
                if (val > curVal) {
                  curVal = val;
                }
              }
            }
          }
        }

        float result = curVal;
        setOutput(result);
      }
    `;
    }
    return e;
  }();
  function LWe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = t.filter, s = n.strides, i = n.pad, l = n.dilations, u2 = gt.backend_util.computeDilation2DInfo(a.shape, o.shape, s, i, "NHWC", l), c, f = new PWe(u2);
    c = r.runWebGLProgram(f, [a, o], "float32");
    var h = ti({ inputs: { x: c }, backend: r, attrs: { shape: u2.outShape } });
    return r.disposeIntermediateTensorInfo(c), h;
  }
  var RWe = { kernelName: gt.Dilation2D, backendName: "webgl", kernelFunc: LWe };
  function zWe(e) {
    var t, r, n, a, o = e.inputs, s = e.backend, i = e.attrs, l = i.equation, u2 = o, c = gt.backend_util.decodeEinsumEquation(l, u2.length), f = c.allDims, h = c.summedDims, p = c.idDims;
    gt.backend_util.checkEinsumDimSizes(f.length, p, u2);
    for (var d = gt.backend_util.getEinsumComputePath(h, p), v = d.path, m = d.steps, g = m.length, x = null, b = f.length, y = [], w = 0; w < g; ++w) {
      try {
        for (var _4 = (t = void 0, Eg(m[w])), k = _4.next(); !k.done; k = _4.next()) {
          var T2 = k.value, A2 = gt.backend_util.getEinsumPermutation(b, p[T2]), S2 = A2.permutationIndices, C2 = A2.expandDims, E2 = void 0;
          gt.backend_util.isIdentityPermutation(S2) ? E2 = u2[T2] : (E2 = cf({ inputs: { x: u2[T2] }, backend: s, attrs: { perm: S2 } }), y.push(E2));
          for (var F13 = E2.shape.slice(), N2 = 0; N2 < C2.length; ++N2) F13.splice(C2[N2], 0, 1);
          gt.util.arraysEqual(E2.shape, F13) || (E2 = ti({ inputs: { x: E2 }, backend: s, attrs: { shape: F13 } }), y.push(E2)), x === null ? x = E2 : (x = V6({ inputs: { a: E2, b: x }, backend: s }), y.push(x));
        }
      } catch (L2) {
        t = { error: L2 };
      } finally {
        try {
          k && !k.done && (r = _4.return) && r.call(_4);
        } finally {
          if (t) throw t.error;
        }
      }
      w < g - 1 && (v[w] >= 0 && (x = zT({ inputs: { x }, backend: s, attrs: { axis: v[w] - (f.length - b), keepDims: false } }), y.push(x)), b--);
    }
    try {
      for (var D2 = Eg(y), I2 = D2.next(); !I2.done; I2 = D2.next()) {
        var O2 = I2.value;
        O2 !== x && s.disposeIntermediateTensorInfo(O2);
      }
    } catch (L2) {
      n = { error: L2 };
    } finally {
      try {
        I2 && !I2.done && (a = D2.return) && a.call(D2);
      } finally {
        if (n) throw n.error;
      }
    }
    return x;
  }
  var BWe = { kernelName: gt.Einsum, backendName: "webgl", kernelFunc: zWe };
  var UWe = "return (x >= 0.0) ? x : (exp(x) - 1.0);", VWe = `
  vec4 result;

  result.r = (x.r >= 0.0) ? x.r : (exp(x.r) - 1.0);
  result.g = (x.g >= 0.0) ? x.g : (exp(x.g) - 1.0);
  result.b = (x.b >= 0.0) ? x.b : (exp(x.b) - 1.0);
  result.a = (x.a >= 0.0) ? x.a : (exp(x.a) - 1.0);

  return result;
`, jWe = Xo({ opSnippet: UWe, packedOpSnippet: VWe }), WWe = { kernelName: gt.Elu, backendName: "webgl", kernelFunc: jWe };
  var GWe = "return (b >= 1.0) ? a : a * (b + 1.0);", $We = `
  vec4 bGTEZero = vec4(greaterThanEqual(b, vec4(0.)));
  return (bGTEZero * a) + ((vec4(1.0) - bGTEZero) * (a * (b + vec4(1.0))));
`, HWe = function(e) {
    var t = e.inputs, r = e.backend, n = t.dy, a = t.y, o = gt.env().getBool("WEBGL_PACK_BINARY_OPERATIONS") ? new Q2($We, n.shape, a.shape) : new $y(GWe, n.shape, a.shape);
    return r.runWebGLProgram(o, [n, a], n.dtype);
  }, qWe = { kernelName: gt.EluGrad, backendName: "webgl", kernelFunc: HWe };
  var XWe = `
  return vec4(equal(a, b));
`, KWe = "return float(a == b);", YWe = Cc({ opSnippet: KWe, packedOpSnippet: XWe, dtype: "bool", cpuKernelImpl: RBe }), ZWe = { kernelName: gt.Equal, backendName: "webgl", kernelFunc: YWe };
  var JWe = `
  // Error function is calculated approximately with elementary function.
  // See "Handbook of Mathematical Functions with Formulas,
  // Graphs, and Mathematical Tables", Abramowitz and Stegun.
  float p = ` + gt.backend_util.ERF_P + `;
  float a1 = ` + gt.backend_util.ERF_A1 + `;
  float a2 = ` + gt.backend_util.ERF_A2 + `;
  float a3 = ` + gt.backend_util.ERF_A3 + `;
  float a4 = ` + gt.backend_util.ERF_A4 + `;
  float a5 = ` + gt.backend_util.ERF_A5 + `;

  float sign = sign(x);
  x = abs(x);
  float t = 1.0 / (1.0 + p * x);
  return sign * (1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-x*x));
`, QWe = Xo({ opSnippet: JWe }), eGe = { kernelName: gt.Erf, backendName: "webgl", kernelFunc: QWe };
  var tGe = Jy + `
  return exp(x);
`, rGe = `
  vec4 result = exp(x);
  bvec4 isNaN = isnan(x);
  result.r = isNaN.r ? x.r : result.r;
  result.g = isNaN.g ? x.g : result.g;
  result.b = isNaN.b ? x.b : result.b;
  result.a = isNaN.a ? x.a : result.a;

  return result;
`, TX = Xo({ opSnippet: tGe, packedOpSnippet: rGe, cpuKernelImpl: zBe, dtype: "float32" }), nGe = { kernelName: gt.Exp, backendName: "webgl", kernelFunc: TX };
  function C6(e) {
    var t = e.inputs, r = e.attrs, n = e.backend, a = r.dim, o = t.input, s = o.shape.length, i = o.shape.slice(), l = a;
    return a < 0 && (gt.util.assert(-(s + 1) <= a, function() {
      return "Axis must be in the interval [" + -(s + 1) + ", " + s + "]";
    }), l = s + a + 1), i.splice(l, 0, 1), ti({ inputs: { x: o }, backend: n, attrs: { shape: i } });
  }
  var aGe = { kernelName: gt.ExpandDims, backendName: "webgl", kernelFunc: C6 };
  var QH = "return exp(x) - 1.0;", iGe = Xo({ opSnippet: QH, packedOpSnippet: QH, cpuKernelImpl: BBe }), oGe = { kernelName: gt.Expm1, backendName: "webgl", kernelFunc: iGe };
  var eq = /* @__PURE__ */ function() {
    function e(t, r, n) {
      this.variableNames = ["real", "imag"];
      var a = r[1];
      this.outputShape = r;
      var o = n ? "2.0 * " + Math.PI : "-2.0 * " + Math.PI, s = n ? a + ".0" : "1.0", i;
      if (t === "real") i = "return real * expR - imag * expI;";
      else if (t === "imag") i = "return real * expI + imag * expR;";
      else throw new Error('FFT component must be either "real" or "imag", got ' + t + ".");
      this.userCode = `
      const float exponentMultiplier = ` + o + `;

      float unaryOpComplex(float real, float expR, float imag, float expI) {
        ` + i + `
      }

      float mulMatDFT(int batch, int index) {
        float indexRatio = float(index) / float(` + a + `);
        float exponentMultiplierTimesIndexRatio =
            exponentMultiplier * indexRatio;

        float result = 0.0;

        for (int i = 0; i < ` + a + `; i++) {
          // x = (-2|2 * PI / N) * index * i;
          float x = exponentMultiplierTimesIndexRatio * float(i);
          float expR = cos(x);
          float expI = sin(x);
          float real = getReal(batch, i);
          float imag = getImag(batch, i);

          result +=
              unaryOpComplex(real, expR, imag, expI) / ` + s + `;
        }

        return result;
      }

      void main() {
        ivec2 coords = getOutputCoords();
        setOutput(mulMatDFT(coords[0], coords[1]));
      }
    `;
    }
    return e;
  }();
  function AX(e, t, r) {
    var n = r.texData.get(e.dataId), a = gt.util.sizeFromShape(e.shape), o = e.shape[e.shape.length - 1], s = a / o, i = ti({ inputs: { x: e }, backend: r, attrs: { shape: [s, o] } }), l = i.shape, u2 = new eq("real", l, t), c = new eq("imag", l, t), f = [{ dataId: n.complexTensorInfos.real.dataId, dtype: n.complexTensorInfos.real.dtype, shape: l }, { dataId: n.complexTensorInfos.imag.dataId, dtype: n.complexTensorInfos.imag.dtype, shape: l }], h = r.runWebGLProgram(u2, f, "float32"), p = r.runWebGLProgram(c, f, "float32"), d = Uv({ inputs: { real: h, imag: p }, backend: r });
    r.disposeIntermediateTensorInfo(h), r.disposeIntermediateTensorInfo(p);
    var v = ti({ inputs: { x: d }, backend: r, attrs: { shape: e.shape } });
    return r.disposeIntermediateTensorInfo(i), r.disposeIntermediateTensorInfo(d), v;
  }
  function sGe(e) {
    var t = e.inputs, r = e.backend, n = t.input;
    return AX(n, false, r);
  }
  var lGe = { kernelName: gt.FFT, backendName: "webgl", kernelFunc: sGe };
  var uGe = /* @__PURE__ */ function() {
    function e(t, r) {
      this.outputShape = [], this.customUniforms = [{ name: "value", type: "float" }], this.variableNames = ["x"], this.outputShape = t, this.userCode = `
      void main() {
        // Input can be obtained from uniform value.
        setOutput(value);
      }
    `;
    }
    return e;
  }();
  function t_(e) {
    var t = e.backend, r = e.attrs, n = r.shape, a = r.value, o = r.dtype;
    if (o = o || gt.util.inferDtype(a), o === "string") {
      var s = gt.util.getArrayFromDType(o, gt.util.sizeFromShape(n));
      return s.fill(a), t.makeTensorInfo(n, o, s);
    } else {
      var i = new uGe(n, a), l = [[a]];
      return t.runWebGLProgram(i, [], o, l);
    }
  }
  var cGe = { kernelName: gt.Fill, backendName: "webgl", kernelFunc: t_ };
  var fGe = /* @__PURE__ */ function() {
    function e(t) {
      this.variableNames = ["Image"], this.outputShape = [];
      var r = t[2];
      this.outputShape = t, this.userCode = `
        void main() {
          ivec4 coords = getOutputCoords();
          int x = coords[2];

          int coordX = ` + r + ` - x - 1;
          float outputValue;
          if(coordX >= 0 && coordX < ` + r + `) {
            outputValue = getImage(coords[0], coords[1], coordX, coords[3]);
          } else {
            outputValue = getImage(coords[0], coords[1], coords[2], coords[3]);
          }
          setOutput(outputValue);
        }
    `;
    }
    return e;
  }();
  var hGe = { kernelName: gt.FlipLeftRight, backendName: "webgl", kernelFunc: function(e) {
    var t = e.inputs, r = e.backend, n = t.image, a = r, o = new fGe(n.shape), s = a.runWebGLProgram(o, [n], n.dtype);
    return s;
  } };
  var tq = "return floor(x);", pGe = Xo({ opSnippet: tq, packedOpSnippet: tq, cpuKernelImpl: UBe }), dGe = { kernelName: gt.Floor, backendName: "webgl", kernelFunc: pGe };
  var vGe = `
  float s = sign(a) * sign(b);
  int ia = round(a);
  int ib = round(b);
  if (ib != 0) {
    // Windows (D3D) wants guaranteed non-zero int division at compile-time.
    return float(idiv(ia, ib, s));
  } else {
    return NAN;
  }
`, mGe = `
  ivec4 ia = round(a);
  ivec4 ib = round(b);
  bvec4 cond = notEqual(ib, ivec4(0));
  ivec4 result = ivec4(0);
  vec4 s = sign(a) * sign(b);

  // Windows (D3D) wants guaranteed non-zero int division at compile-time.
  if (cond[0]) {
    result[0] = idiv(ia[0], ib[0], s[0]);
  }
  if (cond[1]) {
    result[1] = idiv(ia[1], ib[1], s[1]);
  }
  if (cond[2]) {
    result[2] = idiv(ia[2], ib[2], s[2]);
  }
  if (cond[3]) {
    result[3] = idiv(ia[3], ib[3], s[3]);
  }
  return vec4(result);
`, gGe = Cc({ opSnippet: vGe, packedOpSnippet: mGe, dtype: "int32" }), yGe = { kernelName: gt.FloorDiv, backendName: "webgl", kernelFunc: gGe }, xGe = /* @__PURE__ */ function() {
    function e(t) {
      this.variableNames = ["A"];
      var r = ff(), n = _i(t, 2), a = n[0], o = n[1];
      this.outputShape = t, this.userCode = `
      void main() {
        ivec3 coords = getOutputCoords();
        int texR = coords[0];
        int texC = coords[1];
        int depth = coords[2];
        vec2 uv = (vec2(texC, texR) + halfCR) / vec2(` + o + ".0, " + a + `.0);

        vec4 values = ` + r.texture2D + `(A, uv);
        float value;
        if (depth == 0) {
          value = values.r;
        } else if (depth == 1) {
          value = values.g;
        } else if (depth == 2) {
          value = values.b;
        } else if (depth == 3) {
          value = values.a;
        }

        setOutput(floor(value * 255.0 + 0.5));
      }
    `;
    }
    return e;
  }(), bGe = /* @__PURE__ */ function() {
    function e(t) {
      this.variableNames = ["A"], this.packedInputs = false, this.packedOutput = true;
      var r = ff(), n = _i(t, 2), a = n[0], o = n[1];
      this.outputShape = t, this.userCode = `
      void main() {
        ivec3 coords = getOutputCoords();
        int texR = coords[0];
        int texC = coords[1];
        int depth = coords[2];

        vec4 result = vec4(0.);

        for(int row=0; row<=1; row++) {
          for(int col=0; col<=1; col++) {
            texC = coords[1] + row;
            depth = coords[2] + col;

            vec2 uv = (vec2(texC, texR) + halfCR) /
                       vec2(` + o + ".0, " + a + `.0);
            vec4 values = ` + r.texture2D + `(A, uv);
            float value;
            if (depth == 0) {
              value = values.r;
            } else if (depth == 1) {
              value = values.g;
            } else if (depth == 2) {
              value = values.b;
            } else if (depth == 3) {
              value = values.a;
            }

            result[row * 2 + col] = floor(value * 255.0 + 0.5);
          }
        }

        ` + r.output + ` = result;
      }
    `;
    }
    return e;
  }(), _Ge = { kernelName: gt.FromPixels, backendName: "webgl", kernelFunc: wGe }, jy;
  function wGe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.pixels, o = n.numChannels, s = typeof HTMLVideoElement < "u" && a instanceof HTMLVideoElement, i = typeof HTMLImageElement < "u" && a instanceof HTMLImageElement, l = _i(s ? [a.videoWidth, a.videoHeight] : [a.width, a.height], 2), u2 = l[0], c = l[1], f = [c, u2], h = [c, u2, o];
    (i || s) && (jy == null && (jy = document.createElement("canvas").getContext("2d")), jy.canvas.width = u2, jy.canvas.height = c, jy.drawImage(a, 0, 0, u2, c), a = jy.canvas);
    var p = r.makeTensorInfo(f, "int32");
    r.texData.get(p.dataId).usage = Rh.PIXELS, r.gpgpu.uploadPixelDataToTexture(r.getTexture(p.dataId), a);
    var d = gt.env().getBool("WEBGL_PACK") ? new bGe(h) : new xGe(h), v = r.runWebGLProgram(d, [p], "int32");
    return r.disposeData(p.dataId), v;
  }
  function kGe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = t.filter, s = t.bias, i = t.preluActivationWeights, l = n.strides, u2 = n.pad, c = n.dataFormat, f = n.dilations, h = n.dimRoundingMode, p = n.activation, d = n.leakyreluAlpha, v = gt.backend_util.convertConv2DDataFormat(c), m = gt.backend_util.computeConv2DInfo(a.shape, o.shape, l, f, u2, h, false, v), g, x = [];
    if (m.filterHeight === 1 && m.filterWidth === 1 && m.dilationHeight === 1 && m.dilationWidth === 1 && m.strideHeight === 1 && m.strideWidth === 1 && (m.padInfo.type === "SAME" || m.padInfo.type === "VALID")) g = bX({ x: a, filter: o, convInfo: m, backend: r, bias: s, activation: p, preluActivationWeights: i, leakyreluAlpha: d });
    else if (gt.env().getBool("WEBGL_CONV_IM2COL") && a.shape[0] === 1) g = _X({ x: a, filter: o, convInfo: m, backend: r, bias: s, activation: p, preluActivationWeights: i, leakyreluAlpha: d });
    else {
      var b = s != null, y = i != null, w = p === "leakyrelu", _4 = p ? LT(p, false) : null, k = new xX(m, b, _4, y, w), T2 = [a, o];
      if (s && T2.push(s), i && T2.push(i), w) {
        var A2 = r.makeTensorInfo([], "float32", gt.util.createScalarValue(d, "float32"));
        T2.push(A2), x.push(A2);
      }
      g = r.runWebGLProgram(k, T2, "float32");
    }
    var S2 = ti({ inputs: { x: g }, backend: r, attrs: { shape: m.outShape } });
    return x.push(g), x.forEach(function(C2) {
      return r.disposeIntermediateTensorInfo(C2);
    }), S2;
  }
  var TGe = { kernelName: gt.FusedConv2D, backendName: "webgl", kernelFunc: kGe };
  function AGe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = t.filter, s = t.bias, i = t.preluActivationWeights, l = n.strides, u2 = n.pad, c = n.dilations, f = n.dimRoundingMode, h = n.activation, p = n.leakyreluAlpha, d = [], v = c;
    v == null && (v = [1, 1]), gt.util.assert(gt.backend_util.eitherStridesOrDilationsAreOne(l, v), function() {
      return "Error in depthwiseConv2d: Either strides or dilations must be " + ("1. Got strides " + l + " and dilations '" + v + "'");
    });
    var m = gt.backend_util.computeConv2DInfo(a.shape, o.shape, l, v, u2, f, true), g = gt.env().getBool("WEBGL_PACK_DEPTHWISECONV") && m.strideWidth <= 2 && m.outChannels / m.inChannels === 1, x = h ? LT(h, g) : null, b = [a, o], y = s != null, w = i != null, _4 = h === "leakyrelu";
    if (y && b.push(s), w && b.push(i), _4) {
      var k = r.makeTensorInfo([], "float32", gt.util.createScalarValue(p, "float32"));
      b.push(k), d.push(k);
    }
    var T2;
    g ? T2 = new kX(m, y, x, w, _4) : T2 = new wX(m, y, x, w, _4);
    var A2 = [[m.padInfo.top, m.padInfo.left], [m.strideHeight, m.strideWidth], [m.dilationHeight, m.dilationWidth], [m.inHeight, m.inWidth]], S2 = r.runWebGLProgram(T2, b, "float32", A2);
    return d.forEach(function(C2) {
      return r.disposeIntermediateTensorInfo(C2);
    }), S2;
  }
  var SGe = { kernelName: gt.FusedDepthwiseConv2D, backendName: "webgl", kernelFunc: AGe }, EGe = /* @__PURE__ */ function() {
    function e(t, r, n) {
      this.sliceDim = t, this.strides = r, this.variableNames = ["x", "indices"], this.outputShape = n;
      var a = $s(r.length), o = $s(n.length), s = this.sliceDim > 1 ? "strides[j]" : "strides";
      this.userCode = `
        ` + a + " strides = " + a + "(" + this.strides + `);
         void main() {
          ` + o + ` coords = getOutputCoords();
          int flattenIndex = 0;
          for (int j = 0; j < ` + this.sliceDim + `; j++) {
            int index = round(getIndices(coords[0], j));
            flattenIndex += index * ` + s + `;
          }
          setOutput(getX(flattenIndex, coords[1]));
        }
      `;
    }
    return e;
  }();
  function DGe(e) {
    var t = e.inputs, r = e.backend, n = t.params, a = t.indices, o = a.shape, s = o[o.length - 1], i = gt.util.sizeFromShape(n.shape), l = _i(gt.backend_util.prepareAndValidate(n, a), 4), u2 = l[0], c = l[1], f = l[2], h = l[3], p = ti({ inputs: { x: a }, backend: r, attrs: { shape: [c, s] } }), d = ti({ inputs: { x: n }, backend: r, attrs: { shape: [gt.util.sizeFromShape(n.shape) / f, f] } });
    if (r.shouldExecuteOnCPU([n, a]) || n.dtype === "string") {
      var v = r.readSync(a.dataId), m = r.bufferSync(n), g = VBe(v, m, n.dtype, c, s, f, h, n.shape, i);
      return r.makeTensorInfo(u2, n.dtype, g.values);
    }
    var x = new EGe(s, h, [c, f]), b = r.runWebGLProgram(x, [d, p], d.dtype), y = ti({ inputs: { x: b }, backend: r, attrs: { shape: u2 } });
    return r.disposeIntermediateTensorInfo(p), r.disposeIntermediateTensorInfo(d), r.disposeIntermediateTensorInfo(b), y;
  }
  var CGe = { kernelName: gt.GatherNd, backendName: "webgl", kernelFunc: DGe };
  var MGe = /* @__PURE__ */ function() {
    function e(t, r) {
      this.variableNames = ["A", "indices"], this.outputShape = r, this.rank = r.length;
      var n = $s(this.rank), a = IGe(t);
      this.userCode = `
      void main() {
        ` + n + ` resRC = getOutputCoords();
        int index = int(getIndices(resRC.x, resRC.z));
        float inBounds = (index >= 0) && (index < ` + t[2] + `) ? 1.0 : 0.0;
        setOutput(inBounds * getA(` + a + `));
      }
    `;
    }
    return e;
  }();
  function IGe(e, t) {
    for (var r = ["resRC.x", "resRC.y", "resRC.z", "resRC.w"], n = [], a = 0; a < e.length; a++) a === 2 ? n.push("index") : n.push("" + r[a]);
    return n.join();
  }
  function SX(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = t.indices, s = n.axis, i = n.batchDims, l = gt.util.parseAxisParam(s, a.shape)[0];
    if (gt.env().get("DEBUG")) for (var u2 = r.readSync(o.dataId), c = a.shape[l], f = function(A2) {
      var S2 = u2[A2];
      gt.util.assert(S2 <= c - 1 && S2 >= 0, function() {
        return "GatherV2: the index value " + S2 + " is not in [0, " + (c - 1) + "]";
      });
    }, h = 0; h < u2.length; ++h) f(h);
    var p = gt.backend_util.segment_util.collectGatherOpShapeInfo(a, o, l, i), d = gt.util.sizeFromShape(o.shape), v = [], m = ti({ inputs: { x: a }, backend: r, attrs: { shape: [p.batchSize, p.outerSize, p.dimSize, p.sliceSize] } }), g = ti({ inputs: { x: o }, backend: r, attrs: { shape: [p.batchSize, d / p.batchSize] } });
    v.push(m), v.push(g);
    var x = [p.batchSize, p.outerSize, d / p.batchSize, p.sliceSize];
    if (r.shouldExecuteOnCPU([a, o]) || a.dtype === "string") {
      var b = r.bufferSync(g), y = r.bufferSync(m), w = jBe(y, b, x);
      return v.forEach(function(A2) {
        return r.disposeIntermediateTensorInfo(A2);
      }), r.makeTensorInfo(p.outputShape, w.dtype, w.values);
    }
    var _4 = new MGe(m.shape, x), k = r.runWebGLProgram(_4, [m, g], m.dtype);
    v.push(k);
    var T2 = ti({ inputs: { x: k }, backend: r, attrs: { shape: p.outputShape } });
    return v.forEach(function(A2) {
      return r.disposeIntermediateTensorInfo(A2);
    }), T2;
  }
  var NGe = { kernelName: gt.GatherV2, backendName: "webgl", kernelFunc: SX };
  var FGe = "return float(a > b);", OGe = `
  return vec4(greaterThan(a, b));
`, PGe = Cc({ opSnippet: FGe, packedOpSnippet: OGe, cpuKernelImpl: WBe, dtype: "bool" }), LGe = { kernelName: gt.Greater, backendName: "webgl", kernelFunc: PGe };
  var RGe = "return float(a >= b);", zGe = `
  return vec4(greaterThanEqual(a, b));
`, BGe = Cc({ opSnippet: RGe, packedOpSnippet: zGe, dtype: "bool", cpuKernelImpl: GBe }), UGe = { kernelName: gt.GreaterEqual, backendName: "webgl", kernelFunc: BGe };
  function VGe(e) {
    var t = e.inputs, r = e.backend, n = t.input;
    return AX(n, true, r);
  }
  var jGe = { kernelName: gt.IFFT, backendName: "webgl", kernelFunc: VGe };
  var WGe = "return float(!isnan(x) && !isinf(x));", GGe = Xo({ opSnippet: WGe, dtype: "bool" }), $Ge = { kernelName: gt.IsFinite, backendName: "webgl", kernelFunc: GGe };
  var HGe = "return float(isinf(x));", qGe = Xo({ opSnippet: HGe, dtype: "bool" }), XGe = { kernelName: gt.IsInf, backendName: "webgl", kernelFunc: qGe };
  var KGe = "return float(isnan(x));", YGe = Xo({ opSnippet: KGe, dtype: "bool" }), ZGe = { kernelName: gt.IsNan, backendName: "webgl", kernelFunc: YGe };
  var JGe = "return float(a < b);", QGe = `
  return vec4(lessThan(a, b));
`, e$e = Cc({ opSnippet: JGe, packedOpSnippet: QGe, cpuKernelImpl: $Be, dtype: "bool" }), t$e = { kernelName: gt.Less, backendName: "webgl", kernelFunc: e$e };
  var r$e = "return float(a <= b);", n$e = `
  return vec4(lessThanEqual(a, b));
`, a$e = Cc({ opSnippet: r$e, packedOpSnippet: n$e, cpuKernelImpl: HBe, dtype: "bool" }), i$e = { kernelName: gt.LessEqual, backendName: "webgl", kernelFunc: a$e };
  function o$e(e) {
    var t = e.backend, r = e.attrs, n = r.start, a = r.stop, o = r.num, s = qBe(n, a, o);
    return t.makeTensorInfo([s.length], "float32", s);
  }
  var s$e = { kernelName: gt.LinSpace, backendName: "webgl", kernelFunc: o$e };
  var l$e = Jy + `
  return x < 0.0 ? 0./0. : log(x);
`, u$e = `
  vec4 result = log(x);
  bvec4 isNaN = isnan(x);
  result.r = isNaN.r ? x.r : (x.r < 0.0 ? 0./0. : result.r);
  result.g = isNaN.g ? x.g : (x.g < 0.0 ? 0./0. : result.g);
  result.b = isNaN.b ? x.b : (x.b < 0.0 ? 0./0. : result.b);
  result.a = isNaN.a ? x.a : (x.a < 0.0 ? 0./0. : result.a);
  return result;
`, c$e = Xo({ opSnippet: l$e, packedOpSnippet: u$e, cpuKernelImpl: XBe }), f$e = { kernelName: gt.Log, backendName: "webgl", kernelFunc: c$e };
  var h$e = Jy + `
  return log(1.0 + x);
`, p$e = Xo({ opSnippet: h$e }), d$e = { kernelName: gt.Log1p, backendName: "webgl", kernelFunc: p$e };
  var v$e = "return float(a >= 1.0 && b >= 1.0);", m$e = `
  return vec4(
    vec4(greaterThanEqual(a, vec4(1.0))) *
    vec4(greaterThanEqual(b, vec4(1.0))));
`, g$e = Cc({ opSnippet: v$e, packedOpSnippet: m$e, dtype: "bool" }), y$e = { kernelName: gt.LogicalAnd, backendName: "webgl", kernelFunc: g$e };
  var x$e = "return float(!(x >= 1.0));", b$e = Xo({ opSnippet: x$e }), _$e = { kernelName: gt.LogicalNot, backendName: "webgl", kernelFunc: b$e };
  var w$e = "return float(a >= 1.0 || b >= 1.0);", k$e = `
  return min(
    vec4(greaterThanEqual(a, vec4(1.0))) +
    vec4(greaterThanEqual(b, vec4(1.0))),
    vec4(1.0));
`, T$e = Cc({ opSnippet: w$e, packedOpSnippet: k$e, dtype: "bool" }), A$e = { kernelName: gt.LogicalOr, backendName: "webgl", kernelFunc: T$e };
  var S$e = /* @__PURE__ */ function() {
    function e(t, r, n, a, o) {
      this.variableNames = ["x"], this.outputShape = [];
      var s = r, i = t[3] - 1;
      this.outputShape = t;
      var l, u2 = "float(" + n + ") + float(" + a + ") * sum";
      o === 0.5 ? l = "inversesqrt(" + u2 + ")" : o === 1 ? l = "1.0/(" + u2 + ")" : l = "exp(log(" + u2 + ") * float(-" + o + "));", this.userCode = `
      void main() {
        ivec4 coords = getOutputCoords();
        int b = coords[0];
        int r = coords[1];
        int c = coords[2];
        int d = coords[3];
        float x = getX(b, r, c, d);
        float sum = 0.0;
        for (int j = -` + s + "; j <= " + s + `; j++) {
          int idx = d + j;
          if (idx >= 0 && idx <=  ` + i + `) {
            float z = getX(b, r, c, idx);
            sum += z * z;
          }
        }
        float val = x * ` + l + `;
        setOutput(val);
      }
    `;
    }
    return e;
  }();
  var E$e = /* @__PURE__ */ function() {
    function e(t, r, n, a, o) {
      this.variableNames = ["x"], this.outputShape = [], this.packedInputs = true, this.packedOutput = true;
      var s = r, i = t[3] - 1;
      this.outputShape = t;
      var l, u2 = "float(" + n + ") + float(" + a + ") * sum";
      o === 0.5 ? l = "inversesqrt(" + u2 + ")" : o === 1 ? l = "1.0/(" + u2 + ")" : l = "exp(log(" + u2 + ") * float(-" + o + "));", this.userCode = `
      void main() {
        ivec4 coords = getOutputCoords();
        int b = coords.x;
        int r = coords.y;
        int c = coords.z;
        int d = coords.w;

        bool hasNextCol = d < ` + this.outputShape[3] + `;
        bool hasNextRow = c < ` + this.outputShape[2] + `;

        vec4 sum = vec4(0.);
        vec4 xFragAtOutputCoords = getX(b, r, c, d);

        vec4 xAtOutputCoords = vec4(
          getChannel(xFragAtOutputCoords, vec2(c, d)),
          hasNextCol ?
            getChannel(xFragAtOutputCoords, vec2(c, d + 1)) : 0.0,
          hasNextRow ?
            getChannel(xFragAtOutputCoords , vec2(c + 1, d)) : 0.0,
          (hasNextRow && hasNextCol) ?
            getChannel(xFragAtOutputCoords, vec2(c + 1, d + 1)) : 0.0
        );

        int firstChannel = d - ` + s + `;
        vec2 cache = vec2(0.);
        if(firstChannel >= 0){
          vec4 firstChannelFrag = getX(b, r, c, firstChannel);
          cache.x = getChannel(firstChannelFrag, vec2(c, firstChannel));
            if(hasNextRow){
              cache.y = getChannel(firstChannelFrag, vec2(c + 1, firstChannel));
            }
        }

        ivec2 depth = ivec2(d, d + 1);
        for (int j = - ` + s + "; j <= " + s + `; j++) {
          ivec2 idx = depth + j;
          bvec2 aboveLowerBound = greaterThanEqual(idx, ivec2(0));
          bvec2 belowUpperBound = lessThanEqual(idx, ivec2(` + i + `));

          bool depthInRange = aboveLowerBound.x && belowUpperBound.x;
          bool depthPlusOneInRange = aboveLowerBound.y && belowUpperBound.y;

          if(depthInRange || depthPlusOneInRange){
            vec4 z = vec4(0.);
            vec4 xFragAtCurrentDepth;
            z.xz = cache.xy;
            if(depthPlusOneInRange && hasNextCol){
              xFragAtCurrentDepth = idx.y != d ?
                getX(b, r, c, idx.y) : xFragAtOutputCoords;
              z.y = getChannel(xFragAtCurrentDepth, vec2(c, idx.y));
              if(hasNextRow){
                z.w = getChannel(xFragAtCurrentDepth, vec2(c + 1, idx.y));
              }
            }
            cache.xy = z.yw;
            sum += z * z;
          }
        }
        vec4 result = xAtOutputCoords * ` + l + `;
        setOutput(result);
      }
    `;
    }
    return e;
  }();
  var D$e = function(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.depthRadius, s = n.bias, i = n.alpha, l = n.beta, u2 = gt.env().getBool("WEBGL_PACK_NORMALIZATION") ? new E$e(a.shape, o, s, i, l) : new S$e(a.shape, o, s, i, l);
    return r.runWebGLProgram(u2, [a], a.dtype);
  }, C$e = { kernelName: gt.LRN, backendName: "webgl", kernelFunc: D$e };
  var M$e = /* @__PURE__ */ function() {
    function e(t, r, n, a, o) {
      this.variableNames = ["inputImage", "outputImage", "dy"], this.outputShape = [], this.outputShape = t, this.depth = t[3], this.depthRadius = r, this.bias = n, this.alpha = a, this.beta = o, this.userCode = `
      void main() {
        ivec4 coords = getOutputCoords();
        int b = coords[0];
        int r = coords[1];
        int c = coords[2];

        float result = 0.0;
        for (int d = 0; d < ` + this.depth + `; ++d) {
          int depthBegin = int(max(0.0, float(d - ` + r + `)));
          int depthEnd = int(min(float(` + this.depth + `),
              float(d + ` + r + ` + 1)));

          const int MIN_DEPTH_BEGIN = 0;
          const int MAX_DEPTH_END = ` + this.depth + `;

          float norm = 0.0;
          for (int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k) {
            if (k < depthBegin){
              continue;
            }
            else if (k >= depthBegin && k < depthEnd) {
              norm += getInputImage(b, r, c, k) * getInputImage(b, r, c, k);
            }
            else {
              break;
            }
          }

          norm = float(` + a + ") * norm + float(" + n + `);

          for(int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k){
            if (k < depthBegin){
              continue;
            }
            else if (k >= depthBegin && k < depthEnd){
              float dyi = -2.0 * float(` + a + `)
                * float(` + o + `)
                * getInputImage(b ,r ,c, k) * getOutputImage(b, r, c, d)
                / norm;
              if (k == d) {
                dyi += pow(norm, -1.0 * ` + o + `);
              }
              if (k == coords[3]) {
                dyi *= getDy(b, r, c, d);
                result += dyi;
              }
            }
            else {
              break;
            }
          }
      }
      setOutput(result);
      }
    `;
    }
    return e;
  }();
  var I$e = function(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = t.y, s = t.dy, i = n.depthRadius, l = n.bias, u2 = n.alpha, c = n.beta, f = new M$e(a.shape, i, l, u2, c);
    return r.runWebGLProgram(f, [a, o, s], a.dtype);
  }, N$e = { kernelName: gt.LRNGrad, backendName: "webgl", kernelFunc: I$e };
  function F$e(e, t, r, n) {
    var a = gt.util.sizeFromShape(t), o = gt.util.sizeFromShape(e.shape), s = o / a, i = ti({ inputs: { x: e }, attrs: { shape: [s, a] }, backend: n }), l = Ng(i, e.dtype, "max", n), u2 = ti({ inputs: { x: l }, attrs: { shape: r }, backend: n });
    return n.disposeIntermediateTensorInfo(i), n.disposeIntermediateTensorInfo(l), u2;
  }
  function EX(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.reductionIndices, s = n.keepDims, i = a.shape.length, l = gt.util.parseAxisParam(o, a.shape), u2 = l, c = gt.backend_util.getAxesPermutation(u2, i), f = c != null, h = r.shouldExecuteOnCPU([a]), p = a;
    if (f) {
      if (h) {
        for (var d = r.texData.get(p.dataId), v = d.values, m = new Array(i), g = 0; g < m.length; g++) m[g] = a.shape[c[g]];
        var x = B6(v, a.shape, a.dtype, c, m);
        p = r.makeTensorInfo(m, a.dtype);
        var b = r.texData.get(p.dataId);
        b.values = x;
      } else p = RT(a, c, r);
      u2 = gt.backend_util.getInnerMostAxes(u2.length, i);
    }
    gt.backend_util.assertAxesAreInnerMostDims("max", u2, i);
    var y = _i(gt.backend_util.computeOutAndReduceShapes(p.shape, u2), 2), w = y[0], _4 = y[1], k = w;
    s && (k = gt.backend_util.expandShapeToKeepDim(w, l));
    var T2;
    if (h) {
      var d = r.texData.get(p.dataId), v = d.values, A2 = KBe(v, gt.util.sizeFromShape(_4), k, a.dtype);
      T2 = r.makeTensorInfo(k, a.dtype);
      var S2 = r.texData.get(T2.dataId);
      S2.values = A2;
    } else T2 = F$e(p, _4, k, r);
    return f && r.disposeIntermediateTensorInfo(p), T2;
  }
  var O$e = { kernelName: gt.Max, backendName: "webgl", kernelFunc: EX };
  var P$e = sX + `
  return max(a, b);
`, L$e = `
  vec4 result = vec4(max(a, b));
  vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0));
  ` + PT + `
  return result;
`, R$e = Cc({ opSnippet: P$e, packedOpSnippet: L$e, cpuKernelImpl: YBe }), z$e = { kernelName: gt.Maximum, backendName: "webgl", kernelFunc: R$e };
  function B$e(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x;
    qy(a, "maxPool");
    var o = n.filterSize, s = n.strides, i = n.pad, l = n.dimRoundingMode, u2 = 1;
    gt.util.assert(gt.backend_util.eitherStridesOrDilationsAreOne(s, u2), function() {
      return "Error in maxPool: Either strides or dilations must be 1. " + ("Got strides " + s + " and dilations '" + u2 + "'");
    });
    var c = gt.backend_util.computePool2DInfo(a.shape, o, s, u2, i, l);
    if (c.filterWidth === 1 && c.filterHeight === 1 && gt.util.arraysEqual(c.inShape, c.outShape)) return hh({ inputs: { x: a }, backend: r });
    var f = new Y2(c, "max", false);
    return r.runWebGLProgram(f, [a], a.dtype);
  }
  var U$e = { kernelName: gt.MaxPool, backendName: "webgl", kernelFunc: B$e };
  function V$e(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.filterSize, s = n.strides, i = n.pad, l = n.dataFormat, u2 = n.dimRoundingMode, c = [1, 1, 1], f = gt.backend_util.computePool3DInfo(a.shape, o, s, c, i, u2, l), h = new j6(f, "max", false);
    return r.runWebGLProgram(h, [a], a.dtype);
  }
  var j$e = { kernelName: gt.MaxPool3D, backendName: "webgl", kernelFunc: V$e };
  var W$e = /* @__PURE__ */ function() {
    function e(t) {
      this.variableNames = ["dy", "maxPos"], this.outputShape = t.inShape;
      var r = t.strideHeight, n = t.strideWidth, a = t.dilationHeight, o = t.effectiveFilterHeight, s = t.effectiveFilterWidth, i = o - 1 - t.padInfo.top, l = s - 1 - t.padInfo.left, u2 = o * s - 1;
      this.userCode = `
      const ivec2 pads = ivec2(` + i + ", " + l + `);

      void main() {
        ivec4 coords = getOutputCoords();
        int b = coords[0];
        int d = coords[3];

        ivec2 dyRCCorner = coords.yz - pads;
        int dyRCorner = dyRCCorner.x;
        int dyCCorner = dyRCCorner.y;

        // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).
        // ? = to be determined. : = across all values in that axis.
        float dotProd = 0.0;
        for (int wR = 0; wR < ` + o + `;
          wR += ` + a + `) {
          float dyR = float(dyRCorner + wR) / ` + r + `.0;

          if (dyR < 0.0 || dyR >= ` + t.outHeight + `.0 || fract(dyR) > 0.0) {
            continue;
          }
          int idyR = int(dyR);

          for (int wC = 0; wC < ` + s + `; wC++) {
            float dyC = float(dyCCorner + wC) / ` + n + `.0;

            if (dyC < 0.0 || dyC >= ` + t.outWidth + `.0 ||
                fract(dyC) > 0.0) {
              continue;
            }
            int idyC = int(dyC);

            float dyValue = getDy(b, idyR, idyC, d);
            int maxPosValue = ` + u2 + ` - int(getMaxPos(b, idyR, idyC, d));

            // Get the current value, check it against the value from the
            // position matrix.
            int curPosValue = wR * ` + s + ` + wC;
            float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0);

            dotProd += dyValue * mask;
          }
        }
        setOutput(dotProd);
      }
    `;
    }
    return e;
  }(), G$e = /* @__PURE__ */ function() {
    function e(t) {
      this.variableNames = ["dy", "maxPos"], this.outputShape = t.inShape;
      var r = t.strideDepth, n = t.strideHeight, a = t.strideWidth, o = t.dilationDepth, s = t.dilationHeight, i = t.dilationWidth, l = t.effectiveFilterDepth, u2 = t.effectiveFilterHeight, c = t.effectiveFilterWidth, f = l - 1 - t.padInfo.front, h = u2 - 1 - t.padInfo.top, p = c - 1 - t.padInfo.left, d = l * u2 * c - 1;
      this.userCode = `
      const ivec3 pads = ivec3(` + f + ", " + h + ", " + p + `);

      void main() {
        ivec5 coords = getOutputCoords();
        int batch = coords.x;
        int ch = coords.u;

        ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;
        int dyDCorner = dyCorner.x;
        int dyRCorner = dyCorner.y;
        int dyCCorner = dyCorner.z;

        // Convolve dy(?, ?, ?, ch) with pos mask(:, :, :, d) to get
        // dx(xD, xR, xC, ch).
        // ? = to be determined. : = across all values in that axis.
        float dotProd = 0.0;

        for (int wD = 0; wD < ` + l + `;
           wD += ` + o + `) {
          float dyD = float(dyDCorner + wD) / ` + r + `.0;

          if (dyD < 0.0 || dyD >= ` + t.outDepth + `.0 || fract(dyD) > 0.0) {
            continue;
          }
          int idyD = int(dyD);

          for (int wR = 0; wR < ` + u2 + `;
              wR += ` + s + `) {
            float dyR = float(dyRCorner + wR) / ` + n + `.0;

            if (dyR < 0.0 || dyR >= ` + t.outHeight + `.0 ||
                fract(dyR) > 0.0) {
              continue;
            }
            int idyR = int(dyR);

            for (int wC = 0; wC < ` + c + `;
                wC += ` + i + `) {
              float dyC = float(dyCCorner + wC) / ` + a + `.0;

              if (dyC < 0.0 || dyC >= ` + t.outWidth + `.0 ||
                  fract(dyC) > 0.0) {
                continue;
              }
              int idyC = int(dyC);

              float dyValue = getDy(batch, idyD, idyR, idyC, ch);
              int maxPosValue = ` + d + ` -
                  int(getMaxPos(batch, idyD, idyR, idyC, ch));

              // Get the current value, check it against the value from the
              // position matrix.
              int curPosValue =
                  wD * ` + u2 + " * " + c + ` +
                  wR * ` + c + ` + wC;
              float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0);

              dotProd += dyValue * mask;
            }
          }
        }
        setOutput(dotProd);
      }
    `;
    }
    return e;
  }();
  function $$e(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.dy, o = t.input, s = o, i = n.filterSize, l = n.strides, u2 = n.pad, c = n.dimRoundingMode, f = [1, 1, 1], h = gt.backend_util.computePool3DInfo(s.shape, i, l, f, u2, c), p = new j6(h, "max", true), d = r.runWebGLProgram(p, [s], s.dtype), v = new G$e(h), m = r.runWebGLProgram(v, [a, d], s.dtype);
    return r.disposeIntermediateTensorInfo(d), m;
  }
  var H$e = { kernelName: gt.MaxPool3DGrad, backendName: "webgl", kernelFunc: $$e };
  function q$e(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.dy, o = t.input, s = t.output, i = o;
    qy([o, s], "maxPoolGrad");
    var l = n.filterSize, u2 = n.strides, c = n.pad, f = n.dimRoundingMode, h = gt.backend_util.computePool2DInfo(i.shape, l, u2, 1, c, f), p = true, d = new Y2(h, "max", p), v = r.runWebGLProgram(d, [i], i.dtype), m = new W$e(h), g = r.runWebGLProgram(m, [a, v], i.dtype);
    return r.disposeIntermediateTensorInfo(v), g;
  }
  var X$e = { kernelName: gt.MaxPoolGrad, backendName: "webgl", kernelFunc: q$e };
  function K$e(e, t, r, n) {
    var a = new Y2(r, "max", false), o = n.runWebGLProgram(a, [e], "float32");
    a = new Y2(r, "max", true, true, t);
    var s = n.runWebGLProgram(a, [e], "float32");
    return [o, s];
  }
  var Y$e = { kernelName: gt.MaxPoolWithArgmax, backendName: "webgl", kernelFunc: function(e) {
    var t = e.inputs, r = e.attrs, n = e.backend, a = t.x, o = r.filterSize, s = r.strides, i = r.pad, l = r.includeBatchInIndex, u2 = n;
    gt.util.assert(a.shape.length === 4, function() {
      return "Error in maxPool: input must be rank 4 but got rank " + a.shape.length + ".";
    });
    var c = [1, 1];
    gt.util.assert(gt.backend_util.eitherStridesOrDilationsAreOne(s, c), function() {
      return "Error in maxPool: Either strides or dilations must be 1. " + ("Got strides " + s + " and dilations '" + c + "'");
    });
    var f = gt.backend_util.computePool2DInfo(a.shape, o, s, c, i), h = _i(K$e(a, l, f, u2), 2), p = h[0], d = h[1];
    return [p, d];
  } };
  function Z$e(e, t, r, n) {
    var a = gt.util.sizeFromShape(t), o = gt.util.sizeFromShape(e.shape), s = o / a, i = ti({ inputs: { x: e }, attrs: { shape: [s, a] }, backend: n }), l = Ng(i, "float32", "mean", n), u2 = ti({ inputs: { x: l }, attrs: { shape: r }, backend: n });
    return n.disposeIntermediateTensorInfo(i), n.disposeIntermediateTensorInfo(l), u2;
  }
  var J$e = { kernelName: gt.Mean, backendName: "webgl", kernelFunc: function(e) {
    var t, r, n = e.inputs, a = e.attrs, o = e.backend, s = n.x, i = a.keepDims, l = a.axis, u2 = o, c = s.shape.length, f = gt.util.parseAxisParam(l, s.shape), h = f, p = gt.backend_util.getAxesPermutation(h, c), d = p != null, v = u2.shouldExecuteOnCPU([s]), m = [], g = s;
    if (d) {
      if (v) {
        for (var x = u2.texData.get(g.dataId), b = x.values, y = new Array(c), w = 0; w < y.length; w++) y[w] = s.shape[p[w]];
        var _4 = B6(b, s.shape, s.dtype, p, y);
        g = u2.makeTensorInfo(y, s.dtype);
        var k = u2.texData.get(g.dataId);
        k.values = _4;
      } else g = RT(s, p, u2);
      m.push(g), h = gt.backend_util.getInnerMostAxes(h.length, c);
    }
    gt.backend_util.assertAxesAreInnerMostDims("sum", h, c);
    var T2 = _i(gt.backend_util.computeOutAndReduceShapes(g.shape, h), 2), A2 = T2[0], S2 = T2[1], C2 = A2;
    i && (C2 = gt.backend_util.expandShapeToKeepDim(A2, f));
    var E2 = Z$e(g, S2, C2, u2);
    try {
      for (var F13 = Eg(m), N2 = F13.next(); !N2.done; N2 = F13.next()) {
        var w = N2.value;
        u2.disposeIntermediateTensorInfo(w);
      }
    } catch (D2) {
      t = { error: D2 };
    } finally {
      try {
        N2 && !N2.done && (r = F13.return) && r.call(F13);
      } finally {
        if (t) throw t.error;
      }
    }
    return E2;
  } };
  function Q$e(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.axis, s = n.keepDims, i = a.shape.length, l = gt.util.parseAxisParam(o, a.shape), u2 = l, c = gt.backend_util.getAxesPermutation(u2, i), f = a;
    c != null && (f = cf({ inputs: { x: a }, backend: r, attrs: { perm: c } }), u2 = gt.backend_util.getInnerMostAxes(u2.length, a.shape.length)), gt.backend_util.assertAxesAreInnerMostDims("min", u2, i);
    var h = _i(gt.backend_util.computeOutAndReduceShapes(f.shape, u2), 2), p = h[0], d = h[1], v = gt.util.sizeFromShape(d), m = ti({ inputs: { x: f }, backend: r, attrs: { shape: [-1, v] } }), g = Ng(m, m.dtype, "min", r), x;
    if (s) {
      var b = gt.backend_util.expandShapeToKeepDim(p, l);
      x = ti({ inputs: { x: g }, backend: r, attrs: { shape: b } });
    } else x = ti({ inputs: { x: g }, backend: r, attrs: { shape: p } });
    return r.disposeIntermediateTensorInfo(m), r.disposeIntermediateTensorInfo(g), c != null && r.disposeIntermediateTensorInfo(f), x;
  }
  var eHe = { kernelName: gt.Min, backendName: "webgl", kernelFunc: Q$e };
  var tHe = sX + `
  return min(a, b);
`, rHe = `
  vec4 result = vec4(min(a, b));
  vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0));
  ` + PT + `
  return result;
`, nHe = Cc({ opSnippet: tHe, packedOpSnippet: rHe, cpuKernelImpl: ZBe }), aHe = { kernelName: gt.Minimum, backendName: "webgl", kernelFunc: nHe };
  var iHe = /* @__PURE__ */ function() {
    function e(t, r, n) {
      this.variableNames = ["x"], this.outputShape = r.map(function(c, f) {
        return c[0] + t[f] + c[1];
      });
      var a = t.length, o = $s(a), s = r.map(function(c) {
        return c[0];
      }).join(","), i = r.map(function(c, f) {
        return c[0] + t[f];
      }).join(","), l = ["coords[0]", "coords[1]", "coords[2]", "coords[3]"].slice(0, a), u2 = n === "reflect" ? 0 : 1;
      if (a === 1) {
        this.userCode = `
        int start = ` + s + `;
        int end = ` + i + `;

        void main() {
          int outC = getOutputCoords();
          if (outC < start) {
            outC = start * 2 - outC - ` + u2 + `;
          } else if(outC >= end) {
            outC = (end - 1) * 2 - outC + ` + u2 + `;
          }
          setOutput(getX(outC - start));
        }
      `;
        return;
      }
      this.userCode = `
      ` + o + " start = " + o + "(" + s + `);
      ` + o + " end = " + o + "(" + i + `);

      void main() {
        ` + o + ` outC = getOutputCoords();
        for (int i = 0; i < ` + a + `; i++) {
          if (outC[i] < start[i]) {
            outC[i] = start[i] * 2 - outC[i] - ` + u2 + `;
          } else if(outC[i] >= end[i]) {
            outC[i] = (end[i] - 1) * 2 - outC[i] + ` + u2 + `;
          }
        }
        ` + o + ` coords = outC - start;
        setOutput(getX(` + l + `));
      }
    `;
    }
    return e;
  }();
  var oHe = /* @__PURE__ */ function() {
    function e(t, r, n) {
      this.variableNames = ["x"], this.packedInputs = true, this.packedOutput = true, this.outputShape = r.map(function(v, m) {
        return v[0] + t[m] + v[1];
      });
      var a = t.length, o = $s(a), s = r.map(function(v) {
        return v[0];
      }).join(","), i = r.map(function(v, m) {
        return v[0] + t[m];
      }).join(","), l = lf("rc", a), u2 = lf("source", a), c = l[a - 1] + " < " + this.outputShape[a - 1], f = a === 1 ? "source" : "vec2(" + u2.slice(-2).join() + ")", h = n === "reflect" ? 0 : 1, p = "";
      if (a === 1) {
        var d = `
        ` + o + ` source = rc;
        if (source < start) {
          source = start * 2 - source - ` + h + `;
        } else if (source >= end) {
          source = (end - 1) * 2 - source + ` + h + `;
        }
        source -= start;
      `;
        p = `
        ` + o + ` rc = outputLoc;
        ` + d + `
        result[0] = getChannel(getX(` + u2.join() + "), " + f + `);
        ` + l[a - 1] + ` += 1;
        if(` + c + `) {
          ` + d + `
          result[1] = getChannel(getX(` + u2.join() + "), " + f + `);
        }
      `;
      } else {
        var d = `
        ` + o + ` source = rc;
        ` + o + " lt = " + o + `(lessThan(source, start));
        ` + o + " gte = " + o + `(greaterThanEqual(source, end));
        ` + o + ` orig = 1 - (lt + gte);
        source = orig * source +
                lt * (start * 2 - source - ` + h + `) +
                gte * ((end - 1) * 2 - source + ` + h + `);
        source -= start;
      `;
        p = `
        ` + o + ` rc = outputLoc;
        ` + d + `
        result[0] = getChannel(getX(` + u2.join() + "), " + f + `);
        ` + l[a - 1] + ` += 1;
        if(` + c + `) {
          ` + d + `
          result[1] = getChannel(getX(` + u2.join() + "), " + f + `);
        }
        rc = outputLoc;
        ` + l[a - 2] + ` += 1;
        if(` + l[a - 2] + " < " + this.outputShape[a - 2] + `) {
          ` + d + `
          result[2] = getChannel(getX(` + u2.join() + "), " + f + `);
          ` + l[a - 1] + ` += 1;
          if(` + c + `) {
            ` + d + `
            result[3] = getChannel(getX(` + u2.join() + "), " + f + `);
          }
        }
      `;
      }
      this.userCode = `
      const ` + o + " start = " + o + "(" + s + `);
      const ` + o + " end = " + o + "(" + i + `);

      void main() {
        ` + o + ` outputLoc = getOutputCoords();
        vec4 result = vec4(0.);
        ` + p + `
        setOutput(result);
      }
    `;
    }
    return e;
  }();
  var sHe = function(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.paddings, s = n.mode, i = gt.env().getBool("WEBGL_PACK_ARRAY_OPERATIONS") ? new oHe(a.shape, o, s) : new iHe(a.shape, o, s), l = r.runWebGLProgram(i, [a], a.dtype);
    return l;
  }, lHe = { kernelName: gt.MirrorPad, backendName: "webgl", kernelFunc: sHe };
  var uHe = `if (b == 0.0) return NAN;
  return mod(a, b);`, cHe = `
  vec4 result = mod(a, b);
  vec4 isNaN = vec4(equal(b, vec4(0.0)));
  ` + PT + `
  return result;
`, fHe = Cc({ opSnippet: uHe, packedOpSnippet: cHe }), hHe = { kernelName: gt.Mod, backendName: "webgl", kernelFunc: fHe };
  var pHe = /* @__PURE__ */ function() {
    function e(t, r, n) {
      this.variableNames = ["probs"], this.customUniforms = [{ name: "seed", type: "float" }], this.outputShape = [t, n], this.userCode = `
      void main() {
        ivec2 coords = getOutputCoords();
        int batch = coords[0];

        float r = random(seed);
        float cdf = 0.0;

        for (int i = 0; i < ` + (r - 1) + `; i++) {
          cdf += getProbs(batch, i);

          if (r < cdf) {
            setOutput(float(i));
            return;
          }
        }

        // If no other event happened, last event happened.
        setOutput(float(` + (r - 1) + `));
      }
    `;
    }
    return e;
  }();
  var dHe = `
if (a == b) {
  return 1.0;
};
return a / b;`, vHe = `
  // vec4 one = vec4(equal(a, b));
  // return one + (vec4(1.0) - one) * a / b;
  vec4 result = a / b;
  if(a.x == b.x) {
    result.x = 1.;
  }
  if(a.y == b.y) {
    result.y = 1.;
  }
  if(a.z == b.z) {
    result.z = 1.;
  }
  if(a.w == b.w) {
    result.w = 1.;
  }

  return result;
`, DX = Cc({ opSnippet: dHe, packedOpSnippet: vHe, checkOutOfBounds: true }), mHe = { kernelName: gt.RealDiv, backendName: "webgl", kernelFunc: DX };
  var rq = "return a - b;", CX = Cc({ opSnippet: rq, packedOpSnippet: rq, supportsComplex: true, cpuKernelImpl: pUe }), gHe = { kernelName: gt.Sub, backendName: "webgl", kernelFunc: CX };
  function MX(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.logits, o = n.dim, s = gt.util.parseAxisParam([o], a.shape), i = EX({ inputs: { x: a }, backend: r, attrs: { reductionIndices: s, keepDims: false } }), l = gt.backend_util.expandShapeToKeepDim(i.shape, s), u2 = ti({ inputs: { x: i }, backend: r, attrs: { shape: l } }), c = CX({ inputs: { a, b: u2 }, backend: r }), f = TX({ inputs: { x: c }, backend: r }), h = zT({ inputs: { x: f }, backend: r, attrs: { axis: s, keepDims: false } }), p = ti({ inputs: { x: h }, backend: r, attrs: { shape: l } }), d = DX({ inputs: { a: f, b: p }, backend: r });
    return r.disposeIntermediateTensorInfo(i), r.disposeIntermediateTensorInfo(u2), r.disposeIntermediateTensorInfo(c), r.disposeIntermediateTensorInfo(f), r.disposeIntermediateTensorInfo(h), r.disposeIntermediateTensorInfo(p), d;
  }
  var yHe = { kernelName: gt.Softmax, backendName: "webgl", kernelFunc: MX };
  function xHe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.logits, o = n.numSamples, s = n.seed, i = n.normalized, l = i ? a : MX({ inputs: { logits: a }, backend: r, attrs: { dim: a.shape.length - 1 } }), u2 = l.shape[0], c = l.shape[1], f = new pHe(u2, c, o), h = [[s]], p = r.runWebGLProgram(f, [l], "int32", h);
    return i || r.disposeIntermediateTensorInfo(l), p;
  }
  var bHe = { kernelName: gt.Multinomial, backendName: "webgl", kernelFunc: xHe }, _He = bp + `
  return -x;
`, wHe = `
  vec4 result = -x;
  bvec4 isNaN = isnan(x);

  result.r = isNaN.r ? x.r : result.r;
  result.g = isNaN.g ? x.g : result.g;
  result.b = isNaN.b ? x.b : result.b;
  result.a = isNaN.a ? x.a : result.a;

  return result;
`;
  function kHe(e) {
    var t = e.inputs, r = e.backend, n = t.x;
    if (r.shouldExecuteOnCPU([n])) {
      var a = r.texData.get(n.dataId), o = _i(QBe(a.values, n.shape, n.dtype), 2), s = o[0], i = o[1];
      return r.makeTensorInfo(i, n.dtype, s);
    }
    var l;
    return gt.env().getBool("WEBGL_PACK_UNARY_OPERATIONS") ? l = new Sg(n.shape, wHe) : l = new C0(n.shape, _He), r.runWebGLProgram(l, [n], n.dtype);
  }
  var THe = { kernelName: gt.Neg, backendName: "webgl", kernelFunc: kHe };
  var AHe = gt.kernel_impls.nonMaxSuppressionV3Impl;
  function SHe(e) {
    gt.backend_util.warn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.boxes, o = t.scores, s = n.maxOutputSize, i = n.iouThreshold, l = n.scoreThreshold, u2 = r.readSync(a.dataId), c = r.readSync(o.dataId), f = AHe(u2, c, s, i, l).selectedIndices;
    return r.makeTensorInfo([f.length], "int32", new Int32Array(f));
  }
  var EHe = { kernelName: gt.NonMaxSuppressionV3, backendName: "webgl", kernelFunc: SHe };
  var DHe = gt.kernel_impls.nonMaxSuppressionV4Impl;
  function CHe(e) {
    gt.backend_util.warn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.boxes, o = t.scores, s = n.maxOutputSize, i = n.iouThreshold, l = n.scoreThreshold, u2 = n.padToMaxOutputSize, c = r.readSync(a.dataId), f = r.readSync(o.dataId), h = DHe(c, f, s, i, l, u2), p = h.selectedIndices, d = h.validOutputs;
    return [r.makeTensorInfo([p.length], "int32", new Int32Array(p)), r.makeTensorInfo([], "int32", new Int32Array([d]))];
  }
  var MHe = { kernelName: gt.NonMaxSuppressionV4, backendName: "webgl", kernelFunc: CHe };
  var IHe = gt.kernel_impls.nonMaxSuppressionV5Impl;
  function NHe(e) {
    gt.backend_util.warn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.boxes, o = t.scores, s = n.maxOutputSize, i = n.iouThreshold, l = n.scoreThreshold, u2 = n.softNmsSigma, c = r.readSync(a.dataId), f = r.readSync(o.dataId), h = s, p = i, d = l, v = u2, m = IHe(c, f, h, p, d, v), g = m.selectedIndices, x = m.selectedScores;
    return [r.makeTensorInfo([g.length], "int32", new Int32Array(g)), r.makeTensorInfo([x.length], "float32", new Float32Array(x))];
  }
  var FHe = { kernelName: gt.NonMaxSuppressionV5, backendName: "webgl", kernelFunc: NHe };
  var OHe = /* @__PURE__ */ function() {
    function e(t, r, n, a) {
      this.variableNames = ["indices"], this.outputShape = [t, r], this.userCode = `
      void main() {
        ivec2 coords = getOutputCoords();
        int index = round(getIndices(coords.x));
        setOutput(mix(float(` + a + "), float(" + n + `),
                      float(index == coords.y)));
      }
    `;
    }
    return e;
  }(), PHe = function(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.indices, o = n.depth, s = n.onValue, i = n.offValue, l = gt.util.sizeFromShape(a.shape), u2 = new OHe(l, o, s, i), c = ti({ inputs: { x: a }, backend: r, attrs: { shape: [l] } }), f = r.runWebGLProgram(u2, [c], a.dtype);
    r.disposeIntermediateTensorInfo(c);
    var h = uf(a.shape, [o]), p = ti({ inputs: { x: f }, backend: r, attrs: { shape: h } });
    return r.disposeIntermediateTensorInfo(f), p;
  }, LHe = { kernelName: gt.OneHot, backendName: "webgl", kernelFunc: PHe };
  function FT(e) {
    var t = e.inputs, r = e.backend, n = t.x;
    if (n.dtype === "complex64") {
      var a = e_({ inputs: { input: n }, backend: r }), o = FT({ inputs: { x: a }, backend: r }), s = BT({ inputs: { input: n }, backend: r }), i = FT({ inputs: { x: s }, backend: r }), l = Uv({ inputs: { real: o, imag: i }, backend: r });
      return r.disposeIntermediateTensorInfo(a), r.disposeIntermediateTensorInfo(o), r.disposeIntermediateTensorInfo(s), r.disposeIntermediateTensorInfo(i), l;
    } else return t_({ attrs: { shape: n.shape, dtype: n.dtype, value: n.dtype === "string" ? "" : 0 }, backend: r });
  }
  var RHe = { kernelName: gt.ZerosLike, backendName: "webgl", kernelFunc: FT };
  function IX(e) {
    var t = e.inputs, r = e.backend, n = t.x;
    if (n.dtype === "string") throw new Error("onesLike is not supported under string dtype");
    if (n.dtype === "complex64") {
      var a = e_({ inputs: { input: n }, backend: r }), o = IX({ inputs: { x: a }, backend: r }), s = BT({ inputs: { input: n }, backend: r }), i = FT({ inputs: { x: s }, backend: r }), l = Uv({ inputs: { real: o, imag: i }, backend: r });
      return r.disposeIntermediateTensorInfo(a), r.disposeIntermediateTensorInfo(o), r.disposeIntermediateTensorInfo(s), r.disposeIntermediateTensorInfo(i), l;
    } else return t_({ attrs: { shape: n.shape, dtype: n.dtype, value: 1 }, backend: r });
  }
  var zHe = { kernelName: gt.OnesLike, backendName: "webgl", kernelFunc: IX };
  function BHe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = n.axis;
    if (t.length === 1) return C6({ inputs: { input: t[0] }, backend: r, attrs: { dim: a } });
    var o = t[0].shape, s = t[0].dtype;
    t.forEach(function(c) {
      gt.util.assertShapesMatch(o, c.shape, "All tensors passed to stack must have matching shapes"), gt.util.assert(s === c.dtype, function() {
        return "All tensors passed to stack must have matching dtypes";
      });
    });
    var i = [], l = t.map(function(c) {
      var f = C6({ inputs: { input: c }, backend: r, attrs: { dim: a } });
      return i.push(f), f;
    }), u2 = yX({ inputs: l, backend: r, attrs: { axis: a } });
    return i.forEach(function(c) {
      return r.disposeIntermediateTensorInfo(c);
    }), u2;
  }
  var UHe = { kernelName: gt.Pack, backendName: "webgl", kernelFunc: BHe };
  var VHe = /* @__PURE__ */ function() {
    function e(t, r, n) {
      this.variableNames = ["x"], this.customUniforms = [{ name: "value", type: "float" }], this.outputShape = r.map(function(u2, c) {
        return u2[0] + t[c] + u2[1];
      });
      var a = t.length, o = $s(a), s = r.map(function(u2) {
        return u2[0];
      }).join(","), i = r.map(function(u2, c) {
        return u2[0] + t[c];
      }).join(","), l = ["coords[0]", "coords[1]", "coords[2]", "coords[3]"].slice(0, a);
      if (a === 1) {
        this.userCode = `
        int start = ` + s + `;
        int end = ` + i + `;

        void main() {
          int outC = getOutputCoords();
          if (outC < start || outC >= end) {
            setOutput(value);
          } else {
            setOutput(getX(outC - start));
          }
        }
      `;
        return;
      }
      this.userCode = `
      ` + o + " start = " + o + "(" + s + `);
      ` + o + " end = " + o + "(" + i + `);

      void main() {
        ` + o + ` outC = getOutputCoords();
        if (any(lessThan(outC, start)) || any(greaterThanEqual(outC, end))) {
          setOutput(value);
        } else {
          ` + o + ` coords = outC - start;
          setOutput(getX(` + l + `));
        }
      }
    `;
    }
    return e;
  }();
  var jHe = /* @__PURE__ */ function() {
    function e(t, r, n) {
      this.variableNames = ["x"], this.packedInputs = true, this.packedOutput = true, this.customUniforms = [{ name: "value", type: "float" }], this.outputShape = r.map(function(g, x) {
        return g[0] + t[x] + g[1];
      });
      for (var a = t.length, o = $s(a), s = r.map(function(g) {
        return g[0];
      }).join(","), i = r.map(function(g, x) {
        return g[0] + t[x];
      }).join(","), l = lf("rc", a), u2 = lf("source", a), c = l[a - 1] + " < " + this.outputShape[a - 1], f = a === 1 ? "source" : "vec2(" + u2.slice(-2).join() + ")", h = [o + " rc = outputLoc;", l[a - 1] + ` += 1;
       if(` + c + `) {
      `, a === 1 ? "" : `}
       rc = outputLoc;
       ` + l[a - 2] + ` += 1;
       if(` + l[a - 2] + " < " + this.outputShape[a - 2] + ") {", a === 1 ? "" : "  " + l[a - 1] + ` += 1;
         if(` + c + ") {"], p = a === 1 ? "rc < start || rc >= end" : "any(lessThan(rc, start)) || any(greaterThanEqual(rc, end))", d = "", v = 0, m = a === 1 ? 2 : 4; v < m; v++) d += `
        ` + h[v] + `
        if (` + p + `) {
          result[` + v + `] = float(value);
        } else {
          ` + o + ` source = rc - start;
          result[` + v + "] = getChannel(getX(" + u2.join() + "), " + f + `);
        }
      `;
      d += a === 1 ? "} " : "}}", this.userCode = `
      const ` + o + " start = " + o + "(" + s + `);
      const ` + o + " end = " + o + "(" + i + `);

      void main() {
        ` + o + ` outputLoc = getOutputCoords();
        vec4 result = vec4(0.);
        ` + d + `
        setOutput(result);
      }
    `;
    }
    return e;
  }();
  var NX = function(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.paddings, s = n.constantValue;
    if (gt.util.sizeFromShape(a.shape) === 0) {
      var i = o.map(function(c, f) {
        return c[0] + a.shape[f] + c[1];
      });
      return t_({ backend: r, attrs: { shape: i, value: s, dtype: a.dtype } });
    }
    var l = gt.env().getBool("WEBGL_PACK_ARRAY_OPERATIONS") ? new jHe(a.shape, o, s) : new VHe(a.shape, o, s), u2 = [[s]];
    return r.runWebGLProgram(l, [a], a.dtype, u2);
  }, WHe = { kernelName: gt.PadV2, backendName: "webgl", kernelFunc: NX };
  var GHe = `
  if(a < 0.0 && floor(b) < b){
    return NAN;
  }
  if (b == 0.0) {
    return 1.0;
  }
  return (round(mod(b, 2.0)) != 1) ?
      pow(abs(a), b) : sign(a) * pow(abs(a), b);
`, $He = `
  // isModRound1 has 1 for components with round(mod(b, 2.0)) == 1, 0 otherwise.
  vec4 isModRound1 = vec4(equal(round(mod(b, 2.0)), ivec4(1)));
  vec4 multiplier = sign(a) * isModRound1 + (vec4(1.0) - isModRound1);
  vec4 result = multiplier * pow(abs(a), b);

  // Ensure that a^0 = 1, including 0^0 = 1 as this correspond to TF and JS
  bvec4 isExpZero = equal(b, vec4(0.0));
  result.r = isExpZero.r ? 1.0 : result.r;
  result.g = isExpZero.g ? 1.0 : result.g;
  result.b = isExpZero.b ? 1.0 : result.b;
  result.a = isExpZero.a ? 1.0 : result.a;

  vec4 isNaN = vec4(lessThan(a, vec4(0.0))) * vec4(lessThan(floor(b), b));
  ` + PT + `
  return result;
`, HHe = Cc({ opSnippet: GHe, packedOpSnippet: $He }), qHe = { kernelName: gt.Pow, backendName: "webgl", kernelFunc: HHe };
  function XHe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.axis, s = n.keepDims, i = a.shape.length, l = [], u2 = gt.util.parseAxisParam(o, a.shape), c = u2, f = gt.backend_util.getAxesPermutation(c, i), h = a;
    f != null && (h = cf({ inputs: { x: a }, backend: r, attrs: { perm: f } }), c = gt.backend_util.getInnerMostAxes(c.length, i), l.push(h)), gt.backend_util.assertAxesAreInnerMostDims("prod", c, i);
    var p;
    if (r.shouldExecuteOnCPU([h])) {
      var d = r.texData.get(h.dataId).values, v = tUe(h.shape, h.dtype, d, c), m = v.outVals, g = v.outShape, x = v.outDtype;
      p = r.makeTensorInfo(g, x, m);
    } else {
      var b = _i(gt.backend_util.computeOutAndReduceShapes(h.shape, c), 2), g = b[0], y = b[1], w = gt.util.sizeFromShape(y), _4 = ti({ inputs: { x: h }, backend: r, attrs: { shape: [-1, w] } }), k = gt.sumOutType(a.dtype), T2 = Ng(_4, k, "prod", r);
      p = ti({ inputs: { x: T2 }, backend: r, attrs: { shape: g } }), l.push(_4), l.push(T2);
    }
    if (s) {
      l.push(p);
      var A2 = gt.backend_util.expandShapeToKeepDim(p.shape, u2);
      p = ti({ inputs: { x: p }, backend: r, attrs: { shape: A2 } });
    }
    return l.forEach(function(S2) {
      return r.disposeIntermediateTensorInfo(S2);
    }), p;
  }
  var KHe = { kernelName: gt.Prod, backendName: "webgl", kernelFunc: XHe };
  var FX = function(e) {
    var t = e.backend, r = e.attrs, n = r.start, a = r.stop, o = r.step, s = r.dtype, i = rUe(n, a, o, s);
    return t.makeTensorInfo([i.length], s, i);
  }, YHe = { kernelName: gt.Range, backendName: "webgl", kernelFunc: FX };
  var ZHe = "return 1.0 / x;", JHe = Xo({ opSnippet: ZHe }), QHe = { kernelName: gt.Reciprocal, backendName: "webgl", kernelFunc: JHe };
  var eqe = bp + `
  return (x < 0.0) ? 0.0 : x;
`, tqe = `
  vec4 result = x * vec4(greaterThanEqual(x, vec4(0.0)));
  bvec4 isNaN = isnan(x);

  result.r = isNaN.r ? x.r : result.r;
  result.g = isNaN.g ? x.g : result.g;
  result.b = isNaN.b ? x.b : result.b;
  result.a = isNaN.a ? x.a : result.a;

  return result;
`, rqe = Xo({ opSnippet: eqe, packedOpSnippet: tqe }), nqe = { kernelName: gt.Relu, backendName: "webgl", kernelFunc: rqe };
  var aqe = bp + `
  return (x < 0.0) ? 0.0 : min(6.0, x);
`, iqe = `
  vec4 result = min(x, vec4(6.)) * vec4(greaterThanEqual(x, vec4(0.0)));
  bvec4 isNaN = isnan(x);

  result.r = isNaN.r ? x.r : result.r;
  result.g = isNaN.g ? x.g : result.g;
  result.b = isNaN.b ? x.b : result.b;
  result.a = isNaN.a ? x.a : result.a;

  return result;
`, oqe = Xo({ opSnippet: aqe, packedOpSnippet: iqe }), sqe = { kernelName: gt.Relu6, backendName: "webgl", kernelFunc: oqe };
  var lqe = /* @__PURE__ */ function() {
    function e(t, r, n, a, o) {
      this.variableNames = ["A"], this.outputShape = [];
      var s = _i(t, 4), i = s[0], l = s[1], u2 = s[2], c = s[3];
      this.outputShape = [i, r, n, c];
      var f = [a && r > 1 ? l - 1 : l, a && n > 1 ? u2 - 1 : u2], h = [a && r > 1 ? r - 1 : r, a && n > 1 ? n - 1 : n], p;
      o ? p = "(vec2(yRC) + vec2(0.5)) * effectiveInputOverOutputRatioRC - vec2(0.5)" : p = "vec2(yRC) * effectiveInputOverOutputRatioRC", this.userCode = `
      const vec2 effectiveInputOverOutputRatioRC = vec2(
          ` + f[0] / h[0] + `,
          ` + f[1] / h[1] + `);
      const vec2 inputShapeRC = vec2(` + l + ".0, " + u2 + `.0);

      void main() {
        ivec4 coords = getOutputCoords();
        int b = coords[0];
        int d = coords[3];
        ivec2 yRC = coords.yz;

        // Fractional source index.
        vec2 sourceFracIndexRC = ` + p + `;

        // Compute the four integer indices.
        ivec2 sourceFloorRC = ivec2(max(sourceFracIndexRC, vec2(0.0)));
        ivec2 sourceCeilRC = ivec2(
          min(inputShapeRC - 1.0, ceil(sourceFracIndexRC)));

        float topLeft = getA(b, sourceFloorRC.x, sourceFloorRC.y, d);
        float bottomLeft = getA(b, sourceCeilRC.x, sourceFloorRC.y, d);
        float topRight = getA(b, sourceFloorRC.x, sourceCeilRC.y, d);
        float bottomRight = getA(b, sourceCeilRC.x, sourceCeilRC.y, d);

        vec2 fracRC = sourceFracIndexRC - vec2(sourceFloorRC);

        float top = topLeft + (topRight - topLeft) * fracRC.y;
        float bottom = bottomLeft + (bottomRight - bottomLeft) * fracRC.y;
        float newValue = top + (bottom - top) * fracRC.x;

        setOutput(newValue);
      }
    `;
    }
    return e;
  }();
  var uqe = /* @__PURE__ */ function() {
    function e(t, r, n, a, o) {
      this.variableNames = ["A"], this.packedInputs = true, this.packedOutput = true, this.outputShape = [];
      var s = _i(t, 4), i = s[0], l = s[1], u2 = s[2], c = s[3];
      this.outputShape = [i, r, n, c];
      var f = [a && r > 1 ? l - 1 : l, a && n > 1 ? u2 - 1 : u2], h = [a && r > 1 ? r - 1 : r, a && n > 1 ? n - 1 : n], p;
      o ? p = "(vec3(yRC) + vec3(0.5)) * effectiveInputOverOutputRatioRC - vec3(0.5)" : p = "vec3(yRC) * effectiveInputOverOutputRatioRC", this.userCode = `
      const vec3 effectiveInputOverOutputRatioRC = vec3(
          ` + f[0] / h[0] + `,
          ` + f[1] / h[1] + `,
          ` + f[1] / h[1] + `);
      const vec3 inputShapeRC = vec3(` + l + ".0, " + u2 + `.0,
                                     ` + u2 + `.0);

      float getAValue(int b, int r, int c, int d) {
        return getChannel(getA(b, r, c, d), vec2(c, d));
      }

      void main() {
        ivec4 coords = getOutputCoords();
        int b = coords[0];
        int d = coords[3];
        // Calculate values for next column in yRC.z.
        ivec3 yRC = coords.yzz + ivec3(0, 0, 1);

        // Fractional source index.
        vec3 sourceFracIndexRC = ` + p + `;

        // Compute the four integer indices.
        ivec3 sourceFloorRC = ivec3(max(sourceFracIndexRC, vec3(0.0)));
        ivec3 sourceCeilRC = ivec3(
          min(inputShapeRC - 1.0, ceil(sourceFracIndexRC)));

        // Should we calculate next column and row elements in 2x2 packed cell.
        bool hasNextCol = d < ` + (c - 1) + `;
        bool hasNextRow = coords.z < ` + (n - 1) + `;

        // In parallel, construct four corners for all four components in
        // packed 2x2 cell.
        vec4 topLeft = vec4(
          getAValue(b, sourceFloorRC.x, sourceFloorRC.y, d),
          hasNextCol ? getAValue(b, sourceFloorRC.x, sourceFloorRC.y, d + 1)
                     : 0.0,
          hasNextRow ? getAValue(b, sourceFloorRC.x, sourceFloorRC.z, d)
                     : 0.0,
          (hasNextRow && hasNextCol) ?
            getAValue(b, sourceFloorRC.x, sourceFloorRC.z, d + 1) : 0.0);

        vec4 bottomLeft = vec4(
          getAValue(b, sourceCeilRC.x, sourceFloorRC.y, d),
          hasNextCol ? getAValue(b, sourceCeilRC.x, sourceFloorRC.y, d + 1)
                     : 0.0,
          hasNextRow ? getAValue(b, sourceCeilRC.x, sourceFloorRC.z, d)
                     : 0.0,
          (hasNextRow && hasNextCol) ?
            getAValue(b, sourceCeilRC.x, sourceFloorRC.z, d + 1) : 0.0);

        vec4 topRight = vec4(
          getAValue(b, sourceFloorRC.x, sourceCeilRC.y, d),
          hasNextCol ? getAValue(b, sourceFloorRC.x, sourceCeilRC.y, d + 1)
                     : 0.0,
          hasNextRow ? getAValue(b, sourceFloorRC.x, sourceCeilRC.z, d)
                     : 0.0,
          (hasNextRow && hasNextCol) ?
            getAValue(b, sourceFloorRC.x, sourceCeilRC.z, d + 1) : 0.0);

        vec4 bottomRight = vec4(
          getAValue(b, sourceCeilRC.x, sourceCeilRC.y, d),
          hasNextCol ? getAValue(b, sourceCeilRC.x, sourceCeilRC.y, d + 1)
                     : 0.0,
          hasNextRow ? getAValue(b, sourceCeilRC.x, sourceCeilRC.z, d)
                     : 0.0,
          (hasNextRow && hasNextCol) ?
            getAValue(b, sourceCeilRC.x, sourceCeilRC.z, d + 1) : 0.0);

        vec3 fracRC = sourceFracIndexRC - vec3(sourceFloorRC);

        vec4 top = mix(topLeft, topRight, fracRC.yyzz);
        vec4 bottom = mix(bottomLeft, bottomRight, fracRC.yyzz);
        vec4 newValue = mix(top, bottom, fracRC.x);

        setOutput(newValue);
      }
    `;
    }
    return e;
  }();
  function cqe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.images, o = n.alignCorners, s = n.halfPixelCenters, i = n.size, l = _i(i, 2), u2 = l[0], c = l[1], f = gt.env().getBool("WEBGL_PACK_IMAGE_OPERATIONS") ? new uqe(a.shape, u2, c, o, s) : new lqe(a.shape, u2, c, o, s);
    return r.runWebGLProgram(f, [a], "float32");
  }
  var fqe = { kernelName: gt.ResizeBilinear, backendName: "webgl", kernelFunc: cqe };
  var hqe = /* @__PURE__ */ function() {
    function e(t, r, n) {
      this.variableNames = ["dy"], this.outputShape = [], this.outputShape = r;
      var a = _i(r, 3), o = a[1], s = a[2], i = _i(t, 3), l = i[1], u2 = i[2], c = [n && l > 1 ? o - 1 : o, n && u2 > 1 ? s - 1 : s], f = [n && l > 1 ? l - 1 : l, n && u2 > 1 ? u2 - 1 : u2], h = c[0] / f[0], p = c[1] / f[1], d = 1 / h, v = 1 / p, m = Math.ceil(d) * 2 + 2, g = Math.ceil(v) * 2 + 2;
      this.userCode = `
      void main() {
        ivec4 coords = getOutputCoords();
        int b = coords[0];
        int d = coords[3];
        int r = coords[1];
        int c = coords[2];

        float accumulator = 0.0;

        const float heightScale = float(` + h + `);
        const float widthScale = float(` + p + `);

        const float invHeightScale = float(` + d + `);
        const float invWidthScale = float(` + v + `);

        const int winHeight = int(` + m + `);
        const int winWidth = int(` + g + `);

        // Compute bounds for where in dy we will look
        float startRLerp = floor(float(r) * invHeightScale);
        int startDyR = int(startRLerp - float(winHeight / 2));

        float startCLerp = floor(float(c) * invWidthScale);
        int startDyC = int(startCLerp - float(winWidth / 2));

        // Loop over dy
        for (int dyROffset = 0; dyROffset < winHeight; dyROffset++) {
          int dyR = dyROffset + startDyR;

          // Guard against the window exceeding the bounds of dy
          if (dyR < 0 || dyR >= ` + l + `) {
            continue;
          }

          for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) {
            int dyC = dyCOffset + startDyC;

            // Guard against the window exceeding the bounds of dy
            if (dyC < 0 || dyC >= ` + u2 + `) {
              continue;
            }

            float dxR = float(dyR) * heightScale;
            int topDxRIndex = int(floor(dxR));
            int bottomDxRIndex = int(min(ceil(dxR), ` + (o - 1) + `.0));
            float dxRLerp = dxR - float(topDxRIndex);
            float inverseDxRLerp = 1.0 - dxRLerp;

            float dxC = float(dyC) * widthScale;
            int leftDxCIndex = int(floor(dxC));
            int rightDxCIndex = int(min(ceil(dxC), ` + (s - 1) + `.0));
            float dxCLerp = dxC - float(leftDxCIndex);
            float inverseDxCLerp = 1.0 - dxCLerp;

            if (r == topDxRIndex && c == leftDxCIndex) {
              // topLeft
              accumulator +=
                getDy(b, dyR, dyC, d) * inverseDxRLerp * inverseDxCLerp;
            }

            if (r == topDxRIndex && c == rightDxCIndex) {
              // topRight
              accumulator += getDy(b, dyR, dyC, d) * inverseDxRLerp * dxCLerp;
            }

            if (r == bottomDxRIndex && c == leftDxCIndex) {
              // bottomLeft
              accumulator += getDy(b, dyR, dyC, d) * dxRLerp * inverseDxCLerp;
            }

            if (r == bottomDxRIndex && c == rightDxCIndex) {
              // bottomRight
              accumulator += getDy(b, dyR, dyC, d) * dxRLerp * dxCLerp;
            }
          }
        }
        // End loop over dy

        setOutput(accumulator);
      }
    `;
    }
    return e;
  }();
  function pqe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.images, o = t.dy, s = n.alignCorners, i = new hqe(o.shape, a.shape, s);
    return r.runWebGLProgram(i, [o], o.dtype);
  }
  var dqe = { kernelName: gt.ResizeBilinearGrad, backendName: "webgl", kernelFunc: pqe };
  var vqe = /* @__PURE__ */ function() {
    function e(t, r, n, a, o) {
      this.variableNames = ["A"], this.outputShape = [];
      var s = _i(t, 4), i = s[0], l = s[1], u2 = s[2], c = s[3];
      this.outputShape = [i, r, n, c];
      var f = [a && r > 1 ? l - 1 : l, a && n > 1 ? u2 - 1 : u2], h = [a && r > 1 ? r - 1 : r, a && n > 1 ? n - 1 : n], p = a ? "0.5" : "0.0", d;
      o ? d = "max((vec2(yRC) + vec2(0.5)) * effectiveInputOverOutputRatioRC, vec2(0.0))" : d = "vec2(yRC) * effectiveInputOverOutputRatioRC", this.userCode = `
      const vec2 effectiveInputOverOutputRatioRC = vec2(
          ` + f[0] / h[0] + `,
          ` + f[1] / h[1] + `);
      const vec2 inputShapeRC = vec2(` + l + ".0, " + u2 + `.0);

      void main() {
        ivec4 coords = getOutputCoords();
        int b = coords[0];
        int d = coords[3];
        ivec2 yRC = coords.yz;

        // Fractional source index.
        vec2 sourceFracIndexRC = ` + d + `;

        // Compute the coordinators of nearest neighbor point.
        ivec2 sourceNearestRC = ivec2(
          min(inputShapeRC - 1.0, floor(sourceFracIndexRC + ` + p + `)));
        float newValue = getA(b, sourceNearestRC.x, sourceNearestRC.y, d);

        setOutput(newValue);
      }
    `;
    }
    return e;
  }();
  var mqe = /* @__PURE__ */ function() {
    function e(t, r, n, a, o) {
      this.variableNames = ["A"], this.packedInputs = true, this.packedOutput = true, this.outputShape = [];
      var s = _i(t, 4), i = s[0], l = s[1], u2 = s[2], c = s[3];
      this.outputShape = [i, r, n, c];
      var f = [a && r > 1 ? l - 1 : l, a && n > 1 ? u2 - 1 : u2], h = [a && r > 1 ? r - 1 : r, a && n > 1 ? n - 1 : n], p = a ? "0.5" : "0.0", d;
      o ? d = "max((vec3(yRC) + vec3(0.5)) * effectiveInputOverOutputRatioRC, vec3(0.0))" : d = "vec3(yRC) * effectiveInputOverOutputRatioRC", this.userCode = `
      const vec3 effectiveInputOverOutputRatioRC = vec3(
          ` + f[0] / h[0] + `,
          ` + f[1] / h[1] + `,
          ` + f[1] / h[1] + `);
      const vec3 inputShapeRC = vec3(` + l + ".0, " + u2 + `.0,
                                     ` + u2 + `.0);

      float getAValue(int b, int r, int c, int d) {
        return getChannel(getA(b, r, c, d), vec2(c, d));
      }

      void main() {
        ivec4 coords = getOutputCoords();
        int b = coords[0];
        int d = coords[3];
        // Calculate values for next column in yRC.z.
        ivec3 yRC = coords.yzz + ivec3(0, 0, 1);

        // Fractional source index.
        vec3 sourceFracIndexRC = ` + d + `;

        // Compute the coordinators of nearest neighbor point.
        ivec3 sourceNearestRC = ivec3(
          min(inputShapeRC - 1.0, floor(sourceFracIndexRC + ` + p + `)));

        // Should we calculate next column and row elements in 2x2 packed cell.
        bool hasNextCol = d < ` + (c - 1) + `;
        bool hasNextRow = coords.z < ` + (n - 1) + `;

        vec4 newValue = vec4(
          getAValue(b, sourceNearestRC.x, sourceNearestRC.y, d),
          hasNextCol ? getAValue(b, sourceNearestRC.x, sourceNearestRC.y, d + 1)
                     : 0.0,
          hasNextRow ? getAValue(b, sourceNearestRC.x, sourceNearestRC.z, d)
                     : 0.0,
          (hasNextRow && hasNextCol) ?
            getAValue(b, sourceNearestRC.x, sourceNearestRC.z, d + 1) : 0.0);

        setOutput(newValue);
      }
    `;
    }
    return e;
  }();
  function gqe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.images, o = n.alignCorners, s = n.halfPixelCenters, i = n.size, l = _i(i, 2), u2 = l[0], c = l[1], f = gt.env().getBool("WEBGL_PACK_IMAGE_OPERATIONS") ? new mqe(a.shape, u2, c, o, s) : new vqe(a.shape, u2, c, o, s);
    return r.runWebGLProgram(f, [a], a.dtype);
  }
  var yqe = { kernelName: gt.ResizeNearestNeighbor, backendName: "webgl", kernelFunc: gqe };
  var xqe = /* @__PURE__ */ function() {
    function e(t, r, n) {
      this.variableNames = ["dy"], this.outputShape = [], this.outputShape = r;
      var a = _i(r, 3), o = a[1], s = a[2], i = _i(t, 3), l = i[1], u2 = i[2], c = [n && l > 1 ? o - 1 : o, n && u2 > 1 ? s - 1 : s], f = [n && l > 1 ? l - 1 : l, n && u2 > 1 ? u2 - 1 : u2], h = c[0] / f[0], p = c[1] / f[1], d = 1 / h, v = 1 / p, m = Math.ceil(d) * 2 + 2, g = Math.ceil(v) * 2 + 2;
      this.userCode = `
      void main() {
        ivec4 coords = getOutputCoords();
        int b = coords[0];
        int d = coords[3];
        int r = coords[1];
        int c = coords[2];

        float accumulator = 0.0;

        const float heightScale = float(` + h + `);
        const float widthScale = float(` + p + `);

        const float invHeightScale = float(` + d + `);
        const float invWidthScale = float(` + v + `);

        const int winHeight = int(` + m + `);
        const int winWidth = int(` + g + `);

        // Compute bounds for where in dy we will look
        float startRLerp = floor(float(r) * invHeightScale);
        int startDyR = int(floor(startRLerp - float(winHeight / 2)));

        float startCLerp = floor(float(c) * invWidthScale);
        int startDyC = int(floor(startCLerp - float(winWidth / 2)));

        // Loop over dy
        for (int dyROffset = 0; dyROffset < winHeight; dyROffset++) {
          int dyR = dyROffset + startDyR;

          // Guard against the window exceeding the bounds of dy
          if (dyR < 0 || dyR >= ` + l + `) {
            continue;
          }

          for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) {
            int dyC = dyCOffset + startDyC;

            // Guard against the window exceeding the bounds of dy
            if (dyC < 0 || dyC >= ` + u2 + `) {
              continue;
            }

            float sourceFracRow =
              float(` + c[0] + `) *
                (float(dyR) / float(` + f[0] + `));

            float sourceFracCol =
                float(` + c[1] + `) *
                  (float(dyC) / float(` + f[1] + `));

            int sourceNearestRow = int(min(
                float(int(` + o + `) - 1),
                ` + n + ` ? float(round(sourceFracRow)) :
                                  float(floor(sourceFracRow))));

            int sourceNearestCol = int(min(
                float(int(` + s + `) - 1),
                ` + n + ` ? float(round(sourceFracCol)) :
                                  float(floor(sourceFracCol))));

            if (r == sourceNearestRow && c == sourceNearestCol) {
              accumulator += getDy(b, dyR, dyC, d);
            }
          }
        }
        // End loop over dy

        setOutput(accumulator);
      }
    `;
    }
    return e;
  }();
  function bqe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.images, o = t.dy, s = n.alignCorners, i = new xqe(o.shape, a.shape, s);
    return r.runWebGLProgram(i, [o], o.dtype);
  }
  var _qe = { kernelName: gt.ResizeNearestNeighborGrad, backendName: "webgl", kernelFunc: bqe };
  var wqe = /* @__PURE__ */ function() {
    function e(t, r) {
      this.variableNames = ["x"];
      var n = t.length;
      if (n > 4) throw new Error("WebGL backend: Reverse of rank-" + n + " tensor is not yet supported");
      if (this.outputShape = t, n === 1) {
        this.userCode = `
        void main() {
          int coord = getOutputCoords();
          setOutput(getX(` + t[0] + ` - coord - 1));
        }
      `;
        return;
      }
      var a = function(i) {
        return r.indexOf(i) !== -1 && t[i] !== 1 ? t[i] + " - coords[" + i + "] - 1" : "coords[" + i + "]";
      }, o = t.map(function(i, l) {
        return a(l);
      }).join(","), s = $s(n);
      this.userCode = `
      void main() {
        ` + s + ` coords = getOutputCoords();
        setOutput(getX(` + o + `));
      }
    `;
    }
    return e;
  }();
  var kqe = /* @__PURE__ */ function() {
    function e(t, r) {
      this.variableNames = ["x"], this.packedInputs = true, this.packedOutput = true;
      var n = t.length;
      if (n > 4) throw new Error("WebGL backend: Reverse of rank-" + n + " tensor is not yet supported");
      this.outputShape = t;
      var a = lf("rc", n), o = a[n - 1] + " + 1 < " + this.outputShape[n - 1], s = a[n - 2] + " + 1 < " + this.outputShape[n - 2], i = $s(n);
      n === 1 ? this.userCode = `
        void main(){
          int rc = getOutputCoords();
          vec4 result = vec4(0.);
          result.r = getChannel(getX(` + t[0] + ` - rc - 1),
            ` + t[0] + ` - rc - 1);
          if(` + o + `){
              result.g = getChannel(getX(` + t[0] + ` - (rc  + 1) - 1),
                ` + t[0] + ` - (rc  + 1) - 1);
          }
          setOutput(result);
        }
      ` : this.userCode = `
        void main() {
          ` + i + ` rc = getOutputCoords();
          vec4 result = vec4(0.);
          result.r = ` + l(a.slice()) + `;
          if(` + o + `){
            result.g = ` + u2(a.slice()) + `;
          }
          if(` + s + `) {
            result.b = ` + c(a.slice()) + `;
            if(` + o + `) {
              result.a = ` + f(a.slice()) + `;
            }
          }
          setOutput(result);
        }
    `;
      function l(d) {
        return h(d);
      }
      function u2(d) {
        return d[n - 1] = "(" + d[n - 1] + " + 1)", h(d);
      }
      function c(d) {
        return d[n - 2] = "(" + d[n - 2] + " + 1)", h(d);
      }
      function f(d) {
        return d[n - 1] = "(" + d[n - 1] + " + 1)", d[n - 2] = "(" + d[n - 2] + " + 1)", h(d);
      }
      function h(d) {
        var v = t.map(function(x, b) {
          return p(b, d);
        }), m = v.join(","), g = v.slice(-2).join(",");
        return "getChannel(getX(" + m + "), vec2(" + g + "))";
      }
      function p(d, v) {
        return r.indexOf(d) !== -1 && t[d] !== 1 ? t[d] + " - " + v[d] + " - 1" : "" + v[d];
      }
    }
    return e;
  }();
  function Tqe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.dims, s = a.shape.length, i = gt.util.parseAxisParam(o, a.shape);
    if (s === 0) return hh({ inputs: { x: a }, backend: r });
    var l = gt.env().getBool("WEBGL_PACK_ARRAY_OPERATIONS") ? new kqe(a.shape, i) : new wqe(a.shape, i);
    return r.runWebGLProgram(l, [a], a.dtype);
  }
  var Aqe = { kernelName: gt.Reverse, backendName: "webgl", kernelFunc: Tqe };
  var Sqe = /* @__PURE__ */ function() {
    function e(t, r) {
      this.variableNames = ["Image"], this.outputShape = [], this.customUniforms = [{ name: "params", type: "vec4" }];
      var n = t[1], a = t[2];
      this.outputShape = t;
      var o = "";
      typeof r == "number" ? o = "float outputValue = " + r.toFixed(2) + ";" : o = `
        vec3 fill = vec3(` + r.join(",") + `);
        float outputValue = fill[coords[3]];`, this.userCode = `
        void main() {
          ivec4 coords = getOutputCoords();
          int x = coords[2];
          int y = coords[1];
          float coordXFloat = (float(x) - params[0]) * params[3] -
            (float(y) - params[1]) * params[2];
          float coordYFloat = (float(x) - params[0]) * params[2] +
            (float(y) - params[1]) * params[3];
          int coordX = int(round(coordXFloat + params[0]));
          int coordY = int(round(coordYFloat + params[1]));
          ` + o + `
          if(coordX >= 0 && coordX < ` + a + " && coordY >= 0 && coordY < " + n + `) {
            outputValue = getImage(coords[0], coordY, coordX, coords[3]);
          }
          setOutput(outputValue);
        }
    `;
    }
    return e;
  }(), Eqe = { kernelName: gt.RotateWithOffset, backendName: "webgl", kernelFunc: function(e) {
    var t = e.inputs, r = e.attrs, n = e.backend, a = t.image, o = r.radians, s = r.fillValue, i = r.center, l = n, u2 = new Sqe(a.shape, s), c = _i(gt.backend_util.getImageCenter(i, a.shape[1], a.shape[2]), 2), f = c[0], h = c[1], p = [[f, h, Math.sin(o), Math.cos(o)]], d = l.runWebGLProgram(u2, [a], a.dtype, p);
    return d;
  } };
  var Dqe = `
  // OpenGL ES does not support round function.
  // The algorithm is based on banker's rounding.
  float base = floor(x);
  if ((x - base) < 0.5) {
    return floor(x);
  } else if ((x - base) > 0.5) {
    return ceil(x);
  } else {
    if (mod(base, 2.0) == 0.0) {
      return base;
    } else {
      return base + 1.0;
    }
  }
`, Cqe = Xo({ opSnippet: Dqe }), Mqe = { kernelName: gt.Round, backendName: "webgl", kernelFunc: Cqe };
  var Iqe = "return inversesqrt(x);", Nqe = Xo({ opSnippet: Iqe, cpuKernelImpl: nUe }), Fqe = { kernelName: gt.Rsqrt, backendName: "webgl", kernelFunc: Nqe };
  var OX = /* @__PURE__ */ function() {
    function e(t, r, n, a, o, s, i) {
      this.variableNames = ["updates", "indices", "defaultValue"], this.outputShape = s;
      var l = $s(o.length), u2 = $s(s.length), c = "";
      n === 1 ? c = "i" : n === 2 && (c = "i, j");
      var f = "getIndices(" + c + ")", h = "";
      a === 1 ? h = "i" : a === 2 && (h = "i, coords[1]");
      var p = "getUpdates(" + h + ")", d = r > 1 ? "strides[j]" : "strides";
      this.userCode = `
        ` + l + " strides = " + l + "(" + o + `);

        void main() {
          ` + u2 + ` coords = getOutputCoords();
          float sum = 0.0;
          bool found = false;
          for (int i = 0; i < ` + t + `; i++) {
            int flattenedIndex = 0;
            for (int j = 0; j < ` + r + `; j++) {
              int index = round(` + f + `);
              flattenedIndex += index * ` + d + `;
            }
            if (flattenedIndex == coords[0]) {
              sum += ` + p + `;
              found = true;
            }
          }
          setOutput(mix(getDefaultValue(), sum, float(found)));
        }
      `;
    }
    return e;
  }();
  function Oqe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.indices, o = t.updates, s = n.shape, i = gt.backend_util.calculateShapes(o, a, s), l = i.sliceRank, u2 = i.numUpdates, c = i.sliceSize, f = i.strides, h = i.outputSize, p = [h / c, c];
    if (h === 0) return r.makeTensorInfo(s, a.dtype);
    var d = ti({ inputs: { x: a }, backend: r, attrs: { shape: [u2, l] } }), v = ti({ inputs: { x: o }, backend: r, attrs: { shape: [u2, c] } }), m = r.makeTensorInfo([], "float32", new Float32Array([0])), g = new OX(u2, l, d.shape.length, v.shape.length, f, p), x = r.runWebGLProgram(g, [v, d, m], v.dtype), b = ti({ inputs: { x }, backend: r, attrs: { shape: s } });
    return r.disposeIntermediateTensorInfo(d), r.disposeIntermediateTensorInfo(v), r.disposeIntermediateTensorInfo(x), r.disposeIntermediateTensorInfo(m), b;
  }
  var Pqe = { kernelName: gt.ScatterNd, backendName: "webgl", kernelFunc: Oqe };
  var Lqe = /* @__PURE__ */ function() {
    function e(t, r, n) {
      this.variableNames = ["c", "a", "b"], this.outputShape = r;
      var a, o;
      if (n > 4) throw Error("Where for rank " + n + " is not yet supported");
      if (n === 1) o = "resRC", a = "resRC";
      else {
        for (var s = ["resRC.x", "resRC.y", "resRC.z", "resRC.w"], i = [], l = [], u2 = 0; u2 < r.length; u2++) l.push("" + s[u2]), u2 < t && i.push("" + s[u2]);
        a = i.join(), o = l.join();
      }
      var c = $s(n);
      this.userCode = `
      void main() {
        ` + c + ` resRC = getOutputCoords();
        float cVal = getC(` + a + `);
        if (cVal >= 1.0) {
          setOutput(getA(` + o + `));
        } else {
          setOutput(getB(` + o + `));
        }
      }
    `;
    }
    return e;
  }();
  function Rqe(e) {
    var t = e.inputs, r = e.backend, n = t.condition, a = t.t, o = t.e, s = new Lqe(n.shape.length, a.shape, a.shape.length);
    return r.runWebGLProgram(s, [n, a, o], gt.upcastType(a.dtype, o.dtype));
  }
  var zqe = { kernelName: gt.Select, backendName: "webgl", kernelFunc: Rqe };
  var Bqe = `
  // Stable and Attracting Fixed Point (0, 1) for Normalized Weights.
  // see: https://arxiv.org/abs/1706.02515
  float scaleAlpha = ` + gt.backend_util.SELU_SCALEALPHA + `;
  float scale = ` + gt.backend_util.SELU_SCALE + `;
  return (x >= 0.0) ? scale * x : scaleAlpha * (exp(x) - 1.0);
`, Uqe = Xo({ opSnippet: Bqe }), Vqe = { kernelName: gt.Selu, backendName: "webgl", kernelFunc: Uqe };
  var jqe = Jy + `
  return 1.0 / (1.0 + exp(-1.0 * x));
`, Wqe = `
  vec4 result = 1.0 / (1.0 + exp(-1.0 * x));
  bvec4 isNaN = isnan(x);

  result.r = isNaN.r ? x.r : result.r;
  result.g = isNaN.g ? x.g : result.g;
  result.b = isNaN.b ? x.b : result.b;
  result.a = isNaN.a ? x.a : result.a;

  return result;
`, Gqe = Xo({ opSnippet: jqe, packedOpSnippet: Wqe, cpuKernelImpl: aUe }), $qe = { kernelName: gt.Sigmoid, backendName: "webgl", kernelFunc: Gqe };
  var Hqe = `
  if (isnan(x)) { return 0.0; }
  return sign(x);
`, qqe = Xo({ opSnippet: Hqe }), Xqe = { kernelName: gt.Sign, backendName: "webgl", kernelFunc: qqe };
  var Kqe = Jy + `
  return sin(x);
`, Yqe = Xo({ opSnippet: Kqe }), Zqe = { kernelName: gt.Sin, backendName: "webgl", kernelFunc: Yqe };
  var Jqe = `
  float e2x = exp(x);
  return (e2x - 1.0 / e2x) / 2.0;
`, Qqe = Xo({ opSnippet: Jqe }), eXe = { kernelName: gt.Sinh, backendName: "webgl", kernelFunc: Qqe };
  var tXe = `
  float epsilon = 1.1920928955078125e-7;
  float threshold = log(epsilon) + 2.0;

  bool too_large = x > -threshold;
  bool too_small = x < threshold;

  float result;
  float exp_x = exp(x);

  if (too_large){
    result = x;
  }
  else if (too_small){
    result = exp_x;
  }
  else{
    result = log(exp_x + 1.0);
  }
  return result;
`, rXe = Xo({ opSnippet: tXe }), nXe = { kernelName: gt.Softplus, backendName: "webgl", kernelFunc: rXe }, aXe = function(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.blockShape, s = n.paddings;
    gt.util.assert(a.shape.length <= 4, function() {
      return "spaceToBatchND for rank > 4 with a WebGL backend not implemented yet";
    });
    var i = o.reduce(function(x, b) {
      return x * b;
    }), l = [[0, 0]];
    l.push.apply(l, uf(s));
    for (var u2 = 1 + o.length; u2 < a.shape.length; ++u2) l.push([0, 0]);
    var c = [], f = NX({ inputs: { x: a }, backend: r, attrs: { paddings: l, constantValue: 0 } }), h = gt.backend_util.getReshaped(f.shape, o, i, false), p = gt.backend_util.getPermuted(h.length, o.length, false), d = gt.backend_util.getReshapedPermuted(f.shape, o, i, false), v = ti({ inputs: { x: f }, backend: r, attrs: { shape: h } }), m = cf({ inputs: { x: v }, backend: r, attrs: { perm: p } }), g = ti({ inputs: { x: m }, backend: r, attrs: { shape: d } });
    return c.push(f), c.push(v), c.push(m), c.forEach(function(x) {
      return r.disposeIntermediateTensorInfo(x);
    }), g;
  }, iXe = { kernelName: gt.SpaceToBatchND, backendName: "webgl", kernelFunc: aXe };
  function oXe(e) {
    var t = e.inputs, r = e.backend, n = t.indices, a = t.values, o = t.denseShape, s = t.defaultValue;
    if (o.shape.length !== 1) throw new Error(`Dense shape must be a vector, saw:
         ` + o.shape);
    if (n.shape.length !== 2) throw new Error(`Indices must be a matrix, saw:
         ` + n.shape);
    if (a.shape.length !== 1) throw new Error(`Values must be a vector, saw:
         ` + a.shape);
    if (s.shape.length !== 0) throw new Error(`Default value must be a scalar, saw:
        ` + s.shape);
    var i = r.readSync(n.dataId), l = r.readSync(a.dataId), u2 = r.readSync(o.dataId), c = r.readSync(s.dataId)[0], f = _i(oUe(i, n.shape, n.dtype, l, a.dtype, u2, c), 5), h = f[0], p = f[1], d = f[2], v = f[3], m = f[4];
    return [r.makeTensorInfo(p, n.dtype, h), r.makeTensorInfo([p[0]], a.dtype, d), r.makeTensorInfo([v.length], "bool", new Uint8Array(v.map(function(g) {
      return Number(g);
    }))), r.makeTensorInfo([m.length], n.dtype, new Int32Array(m))];
  }
  var sXe = { kernelName: gt.SparseFillEmptyRows, backendName: "webgl", kernelFunc: oXe };
  function lXe(e) {
    var t = e.inputs, r = e.backend, n = t.inputIndices, a = t.inputShape, o = t.newShape;
    if (n.shape.length !== 2) throw new Error("Input indices should be a matrix but received shape " + n.shape);
    if (a.shape.length !== 1) throw new Error("Input shape should be a vector but received shape " + a.shape);
    if (o.shape.length !== 1) throw new Error("Target shape should be a vector but received shape " + o.shape);
    var s = Array.from(r.readSync(a.dataId)), i = r.readSync(n.dataId), l = Array.from(r.readSync(o.dataId)), u2 = _i(sUe(i, n.shape, n.dtype, s, l), 3), c = u2[0], f = u2[1], h = u2[2];
    return [r.makeTensorInfo(f, n.dtype, c), r.makeTensorInfo([h.length], o.dtype, new Int32Array(h))];
  }
  var uXe = { kernelName: gt.SparseReshape, backendName: "webgl", kernelFunc: lXe };
  function cXe(e) {
    var t = e.inputs, r = e.backend, n = t.data, a = t.indices, o = t.segmentIds;
    if (n.shape.length < 1) throw new Error("Data should be at least 1 dimensional but received scalar");
    if (a.shape.length !== 1) throw new Error(`Indices should be a vector but received shape
              ` + a.shape);
    if (o.shape.length !== 1) throw new Error(`Segment ids should be a vector but received shape
              ` + o.shape);
    var s = r.readSync(n.dataId), i = r.readSync(a.dataId), l = r.readSync(o.dataId), u2 = _i(nX(s, n.shape, n.dtype, i, l, true), 2), c = u2[0], f = u2[1];
    return r.makeTensorInfo(f, n.dtype, c);
  }
  var fXe = { kernelName: gt.SparseSegmentMean, backendName: "webgl", kernelFunc: cXe };
  function hXe(e) {
    var t = e.inputs, r = e.backend, n = t.data, a = t.indices, o = t.segmentIds;
    if (n.shape.length < 1) throw new Error("Data should be at least 1 dimensional but received scalar");
    if (a.shape.length !== 1) throw new Error(`Indices should be a vector but received shape
             ` + a.shape);
    if (o.shape.length !== 1) throw new Error(`Segment ids should be a vector but received shape
             ` + o.shape);
    var s = r.readSync(n.dataId), i = r.readSync(a.dataId), l = r.readSync(o.dataId), u2 = _i(nX(s, n.shape, n.dtype, i, l), 2), c = u2[0], f = u2[1];
    return r.makeTensorInfo(f, n.dtype, c);
  }
  var pXe = { kernelName: gt.SparseSegmentSum, backendName: "webgl", kernelFunc: hXe };
  function dXe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.sparseIndices, o = t.sparseValues, s = t.defaultValue, i = n.outputShape, l = gt.backend_util.calculateShapes(o, a, i), u2 = l.sliceRank, c = l.numUpdates, f = l.strides, h = l.outputSize, p = false, d = new OX(c, u2, a.shape.length, o.shape.length, f, [h, 1], p), v = r.runWebGLProgram(d, [o, a, s], o.dtype), m = ti({ inputs: { x: v }, backend: r, attrs: { shape: i } });
    return r.disposeIntermediateTensorInfo(v), m;
  }
  var vXe = { kernelName: gt.SparseToDense, backendName: "webgl", kernelFunc: dXe };
  function mXe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.numOrSizeSplits, s = n.axis, i = gt.util.parseAxisParam(s, a.shape)[0], l = gt.backend_util.prepareSplitSize(a, o, i), u2 = a.shape.length, c = new Array(u2).fill(0), f = a.shape.slice();
    return l.map(function(h) {
      var p = uf(f);
      p[i] = h;
      var d = Qy({ inputs: { x: a }, backend: r, attrs: { begin: c, size: p } });
      return c[i] += h, d;
    });
  }
  var gXe = { kernelName: gt.SplitV, backendName: "webgl", kernelFunc: mXe };
  var nq = "return sqrt(x);", yXe = Xo({ opSnippet: nq, packedOpSnippet: nq, cpuKernelImpl: lUe }), xXe = { kernelName: gt.Sqrt, backendName: "webgl", kernelFunc: yXe };
  var bXe = "return x * x;", _Xe = Xo({ opSnippet: bXe }), wXe = { kernelName: gt.Square, backendName: "webgl", kernelFunc: _Xe };
  var aq = "return (a - b) * (a - b);", kXe = Cc({ opSnippet: aq, packedOpSnippet: aq }), TXe = { kernelName: gt.SquaredDifference, backendName: "webgl", kernelFunc: kXe };
  function AXe(e) {
    var t = e.inputs, r = e.attrs, n = e.backend, a = t.x, o = bp + (`
    return x > 0.0 ? 1.0 : float(` + r.alpha + `);
  `), s = new C0(a.shape, o);
    return n.runWebGLProgram(s, [a], a.dtype);
  }
  var SXe = { kernelName: gt.Step, backendName: "webgl", kernelFunc: AXe };
  var EXe = /* @__PURE__ */ function() {
    function e(t, r, n) {
      this.variableNames = ["x"], this.outputShape = n;
      var a = n.length, o = $s(n.length), s = $s(n.length), i = "";
      if (a === 1) i = "coords * strides + begin";
      else {
        var l = 0;
        i = n.map(function(u2, c) {
          return l++, n.length === 1 ? "coords * strides[" + c + "] + begin[" + c + "]" : "coords[" + (l - 1) + "] * strides[" + c + "] + begin[" + c + "]";
        }).join(",");
      }
      this.userCode = `
      ` + o + " begin = " + o + "(" + t + `);
      ` + o + " strides = " + o + "(" + r + `);

      void main() {
        ` + s + ` coords = getOutputCoords();
        setOutput(getX(` + i + `));
      }
    `;
    }
    return e;
  }();
  function DXe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.begin, s = n.end, i = n.strides, l = n.beginMask, u2 = n.endMask, c = n.ellipsisMask, f = n.newAxisMask, h = n.shrinkAxisMask, p = gt.slice_util.sliceInfo(a.shape, o, s, i, l, u2, c, f, h), d = p.finalShapeSparse, v = p.finalShape, m = p.isIdentity, g = p.sliceDim0, x = p.isSimpleSlice, b = p.begin, y = p.end, w = p.strides, _4;
    if (m) _4 = ti({ inputs: { x: a }, backend: r, attrs: { shape: v } });
    else if (g || x) {
      gt.util.assert(a.shape.length >= 1, function() {
        return "Input must have rank at least 1, got: " + a.shape.length;
      });
      var k = gt.slice_util.computeOutShape(b, y, w), T2 = Qy({ inputs: { x: a }, backend: r, attrs: { begin: b, size: k } });
      _4 = ti({ inputs: { x: T2 }, backend: r, attrs: { shape: v } }), r.disposeIntermediateTensorInfo(T2);
    } else {
      var A2 = r.shouldExecuteOnCPU([a]);
      if (A2) {
        var S2 = r.readSync(a.dataId), C2 = gt.buffer(a.shape, a.dtype, S2), E2 = uUe(d, C2, w, b);
        _4 = r.makeTensorInfo(v, a.dtype, E2.values);
      } else {
        var F13 = new EXe(b, w, d);
        _4 = r.runWebGLProgram(F13, [a], a.dtype);
      }
    }
    var N2 = ti({ inputs: { x: _4 }, backend: r, attrs: { shape: v } });
    return r.disposeIntermediateTensorInfo(_4), N2;
  }
  var CXe = { kernelName: gt.StridedSlice, backendName: "webgl", kernelFunc: DXe };
  function MXe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = n.separator, o = n.nGramWidths, s = n.leftPad, i = n.rightPad, l = n.padWidth, u2 = n.preserveShortSequences, c = t.data, f = t.dataSplits, h = r.readSync(c.dataId), p = r.readSync(f.dataId), d = _i(cUe(h, p, a, o, s, i, l, u2), 2), v = d[0], m = d[1];
    return [r.makeTensorInfo([v.length], "string", v), r.makeTensorInfo(f.shape, "int32", m)];
  }
  var IXe = { kernelName: gt.StringNGrams, backendName: "webgl", kernelFunc: MXe };
  function NXe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = n.skipEmpty, o = t.input, s = t.delimiter;
    if (o.dtype !== "string") throw new Error("Input must be of datatype string");
    if (o.shape.length !== 1) throw new Error("Input must be a vector, got shape: " + o.shape);
    if (s.shape.length !== 0) throw new Error("Delimiter must be a scalar, got shape: " + s.shape);
    var i = r.readSync(o.dataId), l = r.readSync(s.dataId)[0], u2 = _i(fUe(i, l, a), 3), c = u2[0], f = u2[1], h = u2[2], p = f.length;
    return [r.makeTensorInfo([p, 2], "int32", c), r.makeTensorInfo([p], "string", f), r.makeTensorInfo([2], "int32", new Int32Array(h))];
  }
  var FXe = { kernelName: gt.StringSplit, backendName: "webgl", kernelFunc: NXe };
  function OXe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = n.numBuckets, o = t.input;
    if (o.dtype !== "string") throw new Error("Input must be of datatype string");
    if (a <= 0) throw new Error("Number of buckets must be at least 1");
    var s = r.readSync(o.dataId), i = hUe(s, a);
    return r.makeTensorInfo(o.shape, "int32", i);
  }
  var PXe = { kernelName: gt.StringToHashBucketFast, backendName: "webgl", kernelFunc: OXe };
  var LXe = "return tan(x);", RXe = Xo({ opSnippet: LXe }), zXe = { kernelName: gt.Tan, backendName: "webgl", kernelFunc: RXe };
  var BXe = `
  float e2x = exp(-2.0 * abs(x));
  return sign(x) * (1.0 - e2x) / (1.0 + e2x);
`, UXe = Xo({ opSnippet: BXe }), VXe = { kernelName: gt.Tanh, backendName: "webgl", kernelFunc: UXe };
  var jXe = /* @__PURE__ */ function() {
    function e(t, r) {
      this.variableNames = ["A"];
      for (var n = new Array(t.length), a = 0; a < n.length; a++) n[a] = t[a] * r[a];
      this.outputShape = n, this.rank = n.length;
      var o = $s(this.rank), s = WXe(t);
      this.userCode = `
      void main() {
        ` + o + ` resRC = getOutputCoords();
        setOutput(getA(` + s + `));
      }
    `;
    }
    return e;
  }();
  function WXe(e) {
    var t = e.length;
    if (t > 5) throw Error("Tile for rank " + t + " is not yet supported");
    if (t === 1) return "imod(resRC, " + e[0] + ")";
    for (var r = ["resRC.x", "resRC.y", "resRC.z", "resRC.w", "resRC.u"], n = [], a = 0; a < e.length; a++) n.push("imod(" + r[a] + ", " + e[a] + ")");
    return n.join();
  }
  function PX(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.reps;
    if (a.dtype === "string" || a.shape.length > 5) {
      var s = r.readSync(a.dataId), i = a.dtype === "string" ? s.map(function(h) {
        return gt.util.decodeString(h);
      }) : s, l = gt.buffer(a.shape, a.dtype, i), u2 = dUe(l, o);
      return r.makeTensorInfo(u2.shape, u2.dtype, u2.values);
    }
    var c = new jXe(a.shape, o), f = r.runWebGLProgram(c, [a], a.dtype);
    return f;
  }
  var GXe = { kernelName: gt.Tile, backendName: "webgl", kernelFunc: PX }, $Xe = /* @__PURE__ */ function() {
    function e(t) {
      this.variableNames = ["x", "indices"], this.customUniforms = [{ name: "n", type: "int" }, { name: "firstPass", type: "int" }, { name: "negativeInf", type: "float" }, { name: "dir", type: "int" }, { name: "inc", type: "int" }], this.outputShape = t, this.userCode = `
       void main() {
         ivec2 coords = getOutputCoords();
         int batch = coords[0];
         int elemIdx = coords[1];

         // We compare elements pair-wise within a group of size 2 * inc.
         // The comparing rule for each group alternates between ascending
         // and descending. Within each group, we compare each pair at
         // positions i and i+inc. To decide whether an element at position i
         // is x0 or x1, we mod it by 2 * inc, if the result is smaller than
         // inc, it is in the first half of the group, we denote it as x0,
         // otherwise we denote it as x1.
         // For example, as shown in the Bitonic top K paper referenced above,
         // Figure5(a) shows that element[1] is in the
         // second half of the group when group size is 2, but it is in the
         // first half of the group when group size is 4.

         bool isFirstInPair = imod(elemIdx, 2 * inc) < inc;
         int i = isFirstInPair ? elemIdx : elemIdx - inc;

         int i0 = firstPass == 1 ? i : int(getIndices(batch, i));
         int i1 = firstPass == 1 ? i + inc : int(getIndices(batch, i + inc));
         float x0 = i0 < n ? getX(batch, i0) : negativeInf;
         float x1 = i1 < n ? getX(batch, i1) : negativeInf;

         // Denotes which direction indices are in (ascending or descending).
         bool reverse = imod(elemIdx, 2 * dir) >= dir;
         bool isGreater = x0 > x1 || (x0 == x1 && i1 > i0);
         if (reverse == isGreater) { // Elements in opposite order of direction
           int iTemp = i0;
           i0 = i1;
           i1 = iTemp;
         }
         if (isFirstInPair) {
            setOutput(float(i0));
         } else {
            setOutput(float(i1));
         }
       }
     `;
    }
    return e;
  }(), HXe = /* @__PURE__ */ function() {
    function e(t) {
      this.variableNames = ["x", "indices"], this.customUniforms = [{ name: "n", type: "int" }, { name: "firstPass", type: "int" }, { name: "k", type: "int" }], this.outputShape = t, this.userCode = `
    void main() {
         // Takes max of indices (0, k), (1, k + 1), (2, k + 2) ...
         ivec2 coords = getOutputCoords();
         int batch = coords[0];
         int elemIdx = coords[1];

         // The output size is half of the previous size.
         // If the previous sequence is | | | | _ _ _ _  | | | |  _ _ _ _ (k=4),
         // we only need to output the indices at positions |, the indices at
         // positions _ can be thrown away, see Figure5(b) After Phase 2
         // (Merge phase) in the Bitonic Top K paper referenced above.
         // For example, the paper shows we only need to output the orange bars.
         // The output sequence should look like this | | | | | | | |.
         // Because the sequence is halved, to map the output index back
         // to the previous sequence to find the corresponding value,
         // we need to double the index. When we double the index,
         // we basically interpolate a position, so 2i looks like
         // | _ | _ | _ | _ | _ | _ | _. We move the | to the first k position
         // of each 2k positions by - elemIdx % k. E.g. for output at
         // index 4,5,6,7, we want to get the corresponding element at
         // original index 8,9,10,11, for output at index 8,9,10,11,
         // we want to get the corresponding element at original index
         // 16,17,18,19, so on and so forth.

         int i = elemIdx < k ? elemIdx : (elemIdx * 2 - imod(elemIdx, k));
         int i0 = firstPass == 1 ? i : int(getIndices(batch, i));
         int i1 = firstPass == 1 ? i + k : int(getIndices(batch, i + k));

         float x0 = getX(batch, i0);
         float x1 = i1 < n ? getX(batch, i1) : x0;

         setOutput(x0 >= x1 ? float(i0) : float(i1));
       }
     `;
    }
    return e;
  }();
  function Tg(e, t) {
    t !== null && e.disposeIntermediateTensorInfo(t);
  }
  function iq(e) {
    for (var t = 1; t < e; ) t *= 2;
    return t;
  }
  function qXe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = n.k, s = n.sorted, i = gt.env().getNumber("TOPK_LAST_DIM_CPU_HANDOFF_SIZE_THRESHOLD"), l = gt.env().getNumber("TOPK_K_CPU_HANDOFF_THRESHOLD"), u2 = a.shape, c = u2[u2.length - 1];
    if (r.shouldExecuteOnCPU([a]) || c < i || o > l) {
      var f = r.readSync(a.dataId), h = _i(vUe(f, u2, a.dtype, o, s), 2), p = h[0], d = h[1];
      return [r.makeTensorInfo(p.shape, p.dtype, p.values), r.makeTensorInfo(d.shape, d.dtype, d.values)];
    }
    if (o === 0) return u2[u2.length - 1] = 0, [r.makeTensorInfo(u2, a.dtype, []), r.makeTensorInfo(u2, "int32", [])];
    if (c === 1) return [a, t_({ attrs: { shape: u2, dtype: "int32", value: 0 }, backend: r })];
    var v = r.texData.get(a.dataId), m = v !== null && v.isPacked, g = m ? r.unpackTensor(a) : a, x = gt.util.sizeFromShape(u2), b = x / c, y = ti({ inputs: { x: g }, attrs: { shape: [b, c] }, backend: r });
    m && Tg(r, g);
    for (var w = iq(o), _4 = iq(c), k = null, T2 = function() {
      return k === null ? [y, y] : [y, k];
    }, A2 = function(K3, q, re) {
      var R2 = T2(), z = new $Xe(re), H3 = k === null ? 1 : 0, te = [[c], [H3], [Number.NEGATIVE_INFINITY], [K3], [q]], j = k;
      k = r.runWebGLProgram(z, R2, "int32", te), Tg(r, j);
    }, S2 = 1; S2 < w; S2 *= 2) for (var C2 = S2 * 2, E2 = S2; E2 >= 1; E2 /= 2) A2(C2, E2, [b, _4]);
    for (var F13 = _4; F13 > w; F13 /= 2) {
      var N2 = T2(), D2 = new HXe([b, F13 / 2]), I2 = k === null ? 1 : 0, O2 = [[c], [I2], [w]], L2 = k;
      k = r.runWebGLProgram(D2, N2, "int32", O2), Tg(r, L2);
      for (var S2 = w / 2, C2 = S2 * 2, E2 = S2; E2 >= 1; E2 /= 2) A2(C2, E2, k.shape);
    }
    var V2 = k;
    k = Qy({ inputs: { x: k }, backend: r, attrs: { begin: 0, size: [b, o] } }), Tg(r, V2);
    var W2 = SX({ inputs: { x: y, indices: k }, backend: r, attrs: { axis: 1, batchDims: 1 } });
    Tg(r, y);
    var X3 = u2.slice(0, -1);
    X3.push(o), V2 = k, k = ti({ inputs: { x: k }, attrs: { shape: X3 }, backend: r }), Tg(r, V2);
    var Y3 = W2;
    return W2 = ti({ inputs: { x: W2 }, attrs: { shape: X3 }, backend: r }), Tg(r, Y3), [W2, k];
  }
  var XXe = { kernelName: gt.TopK, backendName: "webgl", kernelFunc: qXe };
  var KXe = /* @__PURE__ */ function() {
    function e(t, r, n, a, o, s) {
      this.variableNames = ["Image", "Transforms"], this.outputShape = s;
      var i = n === "nearest" ? 1 : 2, l;
      switch (a) {
        case "constant":
          l = 1;
          break;
        case "reflect":
          l = 2;
          break;
        case "wrap":
          l = 3;
          break;
        case "nearest":
          l = 4;
          break;
        default:
          l = 1;
          break;
      }
      this.userCode = `
            float mapCoord(float outCoord, float len) {
              float inCoord = outCoord;
              if(` + l + ` == 2) {
                if (inCoord < 0.0) {
                  if (len <= 1.0) {
                    inCoord = 0.0;
                  } else {
                    float sz2 = 2.0 * len;
                    if (inCoord < sz2) {
                      inCoord = sz2 * float(int(float(-inCoord / sz2))) +
                      inCoord;
                    }
                    inCoord = inCoord < -len ? inCoord + sz2 : -inCoord - 1.0;
                  }
                } else if (inCoord > len - 1.0) {
                  if (len <= 1.0) {
                    inCoord = 0.0;
                  } else {
                    float sz2 = 2.0 * len;
                    inCoord -= sz2 * float(int(float(inCoord / sz2)));
                    if (inCoord >= len) {
                      inCoord = sz2 - inCoord - 1.0;
                    }
                  }
                }
                return clamp(inCoord, 0.0, len - 1.0);
              } else if (` + l + ` == 3) {
                if (inCoord < 0.0) {
                  if (len <= 1.0) {
                    inCoord = 0.0;
                  } else {
                    float sz = len - 1.0;
                    inCoord += len * (float(int(float(-inCoord / sz))) + 1.0);
                  }
                } else if (inCoord > len - 1.0) {
                  if (len <= 1.0) {
                    inCoord = 0.0;
                  } else {
                    float sz = len - 1.0;
                    inCoord -= len * float(int(float(inCoord / sz)));
                  }
                }
                return clamp(inCoord, 0.0, len - 1.0);
              } else if (` + l + ` == 4) {
                return clamp(outCoord, 0.0, len - 1.0);
              } else {
                return outCoord;
              }
            }

            float readWithFillValue(int batch, int coordY, int coordX,
              int channel) {
              float outputValue;
              if (0 <= coordY && coordY < ` + t + " && 0 <= coordX && coordX < " + r + `) {
                  outputValue = getImage(batch, coordY, coordX, channel);
              } else {
                outputValue = float(` + o + `);
              }
              return outputValue;
            }

            void main() {
              ivec4 coords = getOutputCoords();
              float outputValue;
              int batch = coords[0];
              int x = coords[2];
              int y = coords[1];
              int channel = coords[3];
              float xf = float(x);
              float yf = float(y);
              float a1 = getTransforms(batch, 0);
              float a2 = getTransforms(batch, 1);
              float a3 = getTransforms(batch, 2);
              float b1 = getTransforms(batch, 3);
              float b2 = getTransforms(batch, 4);
              float b3 = getTransforms(batch, 5);
              float c1 = getTransforms(batch, 6);
              float c2 = getTransforms(batch, 7);
              float projection = c1 * xf + c2 * yf + 1.0;
              if (projection == 0.0) {
                outputValue = float(` + o + `);
              } else {
                float inX = (a1 * xf + a2 * yf + a3) / projection;
                float inY = (b1 * xf + b2 * yf + b3) / projection;
                float mapX = mapCoord(inX, float(` + r + `));
                float mapY = mapCoord(inY, float(` + t + `));

                if (` + i + ` == 1) {
                  int coordY = int(round(mapY));
                  int coordX = int(round(mapX));
                  outputValue = readWithFillValue(batch, coordY, coordX,
                    channel);
                } else {
                  float yFloor = floor(mapY);
                  float xFloor = floor(mapX);
                  float yCeil = yFloor + 1.0;
                  float xCeil = xFloor + 1.0;
                  float valueYFloor = (xCeil - mapX) *
                  readWithFillValue(batch, int(yFloor), int(xFloor), channel) +
                  (mapX - xFloor) *
                  readWithFillValue(batch, int(yFloor), int(xCeil), channel);
                  float valueYCeil = (xCeil - mapX) *
                  readWithFillValue(batch, int(yCeil), int(xFloor), channel) +
                  (mapX - xFloor) *
                  readWithFillValue(batch, int(yCeil), int(xCeil), channel);
                  outputValue = (yCeil - mapY) * valueYFloor +
                  (mapY - yFloor) * valueYCeil;
                }
              }
              setOutput(outputValue);
            }
        `;
    }
    return e;
  }();
  function YXe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.image, o = t.transforms, s = n.interpolation, i = n.fillMode, l = n.fillValue, u2 = n.outputShape, c = _i(a.shape, 4), f = c[0], h = c[1], p = c[2], d = c[3], v = _i(u2 ?? [h, p], 2), m = v[0], g = v[1], x = [f, m, g, d], b = new KXe(h, p, s, i, l, x);
    return r.runWebGLProgram(b, [a, o], "float32");
  }
  var ZXe = { kernelName: gt.Transform, backendName: "webgl", kernelFunc: YXe };
  function JXe(e) {
    var t = e.inputs, r = e.attrs, n = e.backend, a = r.axis, o = t.x;
    qy(o, "unique"), console.warn("WARNING: ", "UI might be locked temporarily as data is being downloaded");
    var s = n.readSync(o.dataId), i = mUe(s, a, o.shape, o.dtype), l = i.outputValues, u2 = i.outputShape, c = i.indices;
    return [n.makeTensorInfo(u2, o.dtype, l), n.makeTensorInfo([c.length], "int32", c)];
  }
  var QXe = { kernelName: gt.Unique, backendName: "webgl", kernelFunc: JXe };
  function eKe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.value, o = n.axis;
    o < 0 && (o += a.shape.length);
    for (var s = a, i = s.shape.length, l = a.shape[o], u2 = new Array(i - 1), c = 0, f = 0; f < i; f++) f !== o && (u2[c++] = s.shape[f]);
    var h = [], p = new Array(i).fill(0), d = s.shape.slice();
    d[o] = 1;
    for (var v = new Array(l), f = 0; f < v.length; f++) {
      p[o] = f;
      var m = Qy({ inputs: { x: s }, backend: r, attrs: { begin: p, size: d } }), g = ti({ inputs: { x: m }, backend: r, attrs: { shape: u2 } });
      v[f] = g, h.push(m);
    }
    return h.forEach(function(x) {
      return r.disposeIntermediateTensorInfo(x);
    }), v;
  }
  var tKe = { kernelName: gt.Unpack, backendName: "webgl", kernelFunc: eKe };
  var rKe = /* @__PURE__ */ function() {
    function e(t, r) {
      this.variableNames = ["x", "segmentIds"];
      var n = t.windowSize, a = t.batchSize, o = t.inSize, s = t.numSegments, i = s * Math.ceil(o / n);
      this.outputShape = [a, i];
      var l = "0.0", u2 = "sumValue", c = Math.floor(n / 4) * 4, f = n % 4, h = `
        sumValue += dot(values, segFilter);
    `, p = "";
      o % n > 0 && (p = `
        if (inIdx < 0 || inIdx >= ` + o + `) {
          return initializationValue;
        }
      `);
      var d = "";
      o % n > 0 && (d = `
        if (inIdx < 0 || inIdx >= ` + o + `) {
          return -1.0;
        }
      `), this.userCode = `
      const float initializationValue = ` + l + `;

      float getValue(int batch, int inIdx) {
        ` + p + `
        return getX(batch, inIdx);
      }

      float getSegmentIdAtIndex(int inIdx) {
        ` + d + `
        return getSegmentIds(inIdx);
      }

      void main() {
        ivec2 coords = getOutputCoords();
        int batch = coords[0];
        int outIdx = coords[1];
        int inOffset = int(floor(float(outIdx) / float(
          ` + s + ")) * float(" + n + `));
        int currentSeg = int(mod(float(outIdx), float(` + s + `)));

        float sumValue = 0.0;

        for (int i = 0; i < ` + c + `; i += 4) {
          int inIdx = inOffset + i;
          vec4 values = vec4(
            getValue(batch, inIdx),
            getValue(batch, inIdx + 1),
            getValue(batch, inIdx + 2),
            getValue(batch, inIdx + 3)
          );

          vec4 segFilter = vec4(
            int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,
            int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,
            int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0,
            int(getSegmentIdAtIndex(inIdx + 3)) == currentSeg ? 1 : 0
          );

          ` + h + `
        }

        int inIdx = inOffset + ` + c + `;
        if (` + (f === 1) + `) {
          vec4 values = vec4(
            getValue(batch, inIdx),
            initializationValue,
            initializationValue,
            initializationValue
          );

          int inIdxSeg = int(getSegmentIdAtIndex(inIdx));

          vec4 segFilter = vec4(
            int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,
            0,
            0,
            0
          );

          ` + h + `
        } else if (` + (f === 2) + `) {
          vec4 values = vec4(
            getValue(batch, inIdx),
            getValue(batch, inIdx + 1),
            initializationValue,
            initializationValue
          );

          vec4 segFilter = vec4(
            int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,
            int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,
              0,
              0
          );

          ` + h + `
        } else if (` + (f === 3) + `) {
          vec4 values = vec4(
            getValue(batch, inIdx),
            getValue(batch, inIdx + 1),
            getValue(batch, inIdx + 2),
            initializationValue
          );

          vec4 segFilter = vec4(
            int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,
            int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,
            int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0,
            0
          );

          ` + h + `
        }
        setOutput(` + u2 + `);
      }
    `;
    }
    return e;
  }();
  function nKe(e) {
    var t = e.inputs, r = e.backend, n = e.attrs, a = t.x, o = t.segmentIds, s = n.numSegments, i = a.shape.length, l = [], u2 = 0, c = gt.backend_util.getAxesPermutation([u2], i), f = a;
    c != null && (f = cf({ inputs: { x: a }, backend: r, attrs: { perm: c } }), l.push(f), u2 = gt.backend_util.getInnerMostAxes(1, i)[0]);
    var h = gt.backend_util.segment_util.computeOutShape(f.shape, u2, s), p = gt.util.sizeFromShape([f.shape[u2]]), d = ti({ inputs: { x: f }, backend: r, attrs: { shape: [-1, p] } });
    l.push(d);
    var v = gt.sumOutType(a.dtype), m = function(w, _4, k, T2, A2) {
      var S2 = w.shape[0], C2 = w.shape[1], E2 = gt.backend_util.segment_util.segOpComputeOptimalWindowSize(C2, A2), F13 = { windowSize: E2, inSize: C2, batchSize: S2, numSegments: A2 }, N2 = new rKe(F13, _4), D2 = r.compileAndRun(N2, [w, k], T2);
      if (l.push(D2), D2.shape[1] === A2) return D2;
      var I2 = FX({ backend: r, attrs: { start: 0, stop: A2, step: 1, dtype: "float32" } }), O2 = PX({ inputs: { x: I2 }, backend: r, attrs: { reps: [C2 / E2] } });
      l.push(I2), l.push(O2);
      var L2 = m(D2, _4, O2, T2, A2);
      return L2;
    }, g = m(d, "unsortedSegmentSum", o, v, s), x = ti({ inputs: { x: g }, backend: r, attrs: { shape: h } }), b = x;
    if (c != null) {
      l.push(x);
      var y = gt.backend_util.getUndoAxesPermutation(c);
      b = cf({ inputs: { x: b }, backend: r, attrs: { perm: y } });
    }
    return l.forEach(function(w) {
      return r.disposeIntermediateTensorInfo(w);
    }), b;
  }
  var aKe = { kernelName: gt.UnsortedSegmentSum, backendName: "webgl", kernelFunc: nKe }, _6, oq, iKe = [fVe, pVe, mVe, xVe, _Ve, TVe, SVe, DVe, NVe, OVe, RVe, UVe, WVe, qVe, YVe, JVe, eje, aje, oje, lje, hje, xje, _je, kje, Cje, Ije, Pje, HUe, zje, Wje, qje, Qje, tWe, nWe, iWe, sWe, cWe, pWe, mWe, yWe, bWe, kWe, AWe, CWe, IWe, OWe, RWe, BWe, WWe, qWe, ZWe, eGe, nGe, aGe, oGe, lGe, cGe, hGe, dGe, yGe, _Ge, TGe, SGe, CGe, NGe, LGe, UGe, $Ue, jGe, Vje, $Ge, XGe, ZGe, XUe, t$e, i$e, s$e, f$e, d$e, y$e, _$e, A$e, C$e, N$e, O$e, z$e, U$e, j$e, H$e, X$e, Y$e, J$e, eHe, aHe, lHe, hHe, bHe, QUe, THe, EHe, MHe, FHe, Aje, LHe, zHe, UHe, WHe, qHe, YUe, KHe, YHe, Sje, mHe, QHe, nqe, sqe, tVe, fqe, dqe, yqe, _qe, Aqe, Eqe, Mqe, Fqe, Pqe, zqe, Vqe, $qe, Xqe, Zqe, eXe, gje, yHe, nXe, iXe, sXe, uXe, fXe, pXe, vXe, gXe, xXe, wXe, TXe, SXe, CXe, IXe, FXe, PXe, gHe, lVe, zXe, VXe, GXe, XXe, ZXe, uVe, QXe, tKe, aKe, RHe];
  try {
    for (G2 = Eg(iKe), Wy = G2.next(); !Wy.done; Wy = G2.next()) sq = Wy.value, gt.registerKernel(sq);
  } catch (e) {
    _6 = { error: e };
  } finally {
    try {
      Wy && !Wy.done && (oq = G2.return) && oq.call(G2);
    } finally {
      if (_6) throw _6.error;
    }
  }
  var sq, G2, Wy;
  Kd.GPGPUContext = MT;
  Kd.MathBackendWebGL = U6;
  Kd.forceHalfFloat = oX;
  Kd.gpgpu_util = jze;
  Kd.setWebGLContext = lq;
  Kd.version_webgl = WUe;
  Kd.webgl = GUe;
  Kd.webgl_util = X9e;
});
var VZ = ri((zg) => {
  "use strict";
  Object.defineProperty(zg, "__esModule", { value: true });
  function oKe(e) {
    return e && typeof e == "object" && "default" in e ? e.default : e;
  }
  var H6 = Gm(), aK = cB(), sKe = oKe(aK), q6 = Aj(), X6 = jG(), iK = c$(), lKe = LH(), uKe = LX(), oK = "Abs", sK = "Acos", lK = "Acosh", hI = "Add", uK = "AddN", cKe = "All", fKe = "Any", cK = "ArgMax", fK = "ArgMin", hK = "Asin", pK = "Asinh", dK = "Atan", vK = "Atanh", mK = "Atan2", gK = "AvgPool", hKe = "AvgPoolGrad", yK = "AvgPool3D", pKe = "AvgPool3DGrad", xK = "BatchMatMul", bK = "BatchToSpaceND", dKe = "Bincount", vKe = "BroadcastTo", mKe = "BroadcastArgs", pI = "Cast", _K = "Ceil", wK = "ClipByValue", gKe = "Complex", kK = "ComplexAbs", TK = "Concat", AK = "Conv2D", yKe = "Conv2DBackpropFilter", SK = "Conv2DBackpropInput", EK = "Conv3D", xKe = "Conv3DBackpropFilterV2", bKe = "Conv3DBackpropInputV2", DK = "Cos", CK = "Cosh", MK = "Cumsum", _Ke = "CropAndResize", wKe = "DenseBincount", kKe = "DepthToSpace", IK = "DepthwiseConv2dNative", TKe = "DepthwiseConv2dNativeBackpropFilter", AKe = "DepthwiseConv2dNativeBackpropInput", SKe = "Diag", NK = "Dilation2D", EKe = "Dilation2DBackpropInput", DKe = "Dilation2DBackpropFilter", FK = "RealDiv", CKe = "Einsum", OK = "Elu", MKe = "EluGrad", PK = "Erf", IKe = "Equal", LK = "Exp", RK = "ExpandDims", zK = "Expm1", NKe = "FFT", FKe = "Fill", OKe = "FlipLeftRight", BK = "Floor", UK = "FloorDiv", VK = "FusedBatchNorm", jK = "GatherV2", PKe = "GatherNd", LKe = "Greater", WK = "GreaterEqual", dI = "Identity", RKe = "IFFT", zKe = "Imag", GK = "IsFinite", $K = "IsInf", HK = "IsNan", qK = "LeakyRelu", BKe = "Less", UKe = "LessEqual", XK = "Log", KK = "Log1p", VKe = "LogicalAnd", jKe = "LogicalNot", WKe = "LogicalOr", GKe = "LogSoftmax", YK = "LRN", $Ke = "LRNGrad", ZK = "Max", JK = "Maximum", QK = "MaxPool", HKe = "MaxPoolGrad", eY = "MaxPool3D", qKe = "MaxPool3DGrad", XKe = "MaxPoolWithArgmax", tY = "Mean", rY = "Min", nY = "Minimum", aY = "MirrorPad", iY = "Mod", KKe = "Multinomial", oY = "Multiply", sY = "Neg", YKe = "NotEqual", ZKe = "NonMaxSuppressionV3", JKe = "NonMaxSuppressionV4", QKe = "NonMaxSuppressionV5", lY = "OnesLike", uY = "OneHot", cY = "Pack", fY = "PadV2", hY = "Pow", pY = "Prelu", eYe = "Prod", tYe = "Range", rYe = "Real", dY = "Reciprocal", vY = "Relu", mY = "Reshape", gY = "ResizeNearestNeighbor", nYe = "ResizeNearestNeighborGrad", yY = "ResizeBilinear", aYe = "ResizeBilinearGrad", xY = "Relu6", bY = "Reverse", _Y = "Round", wY = "Rsqrt", iYe = "ScatterNd", kY = "Select", TY = "Selu", AY = "Slice", SY = "Sin", EY = "Sinh", DY = "Sign", CY = "Sigmoid", MY = "Softplus", IY = "Sqrt", NY = "Sum", FY = "SpaceToBatchND", OY = "SplitV", PY = "Softmax", oYe = "SparseFillEmptyRows", sYe = "SparseReshape", lYe = "SparseSegmentMean", uYe = "SparseSegmentSum", cYe = "SparseToDense", LY = "SquaredDifference", fYe = "Square", hYe = "StridedSlice", pYe = "StringNGrams", dYe = "StringSplit", vYe = "StringToHashBucketFast", RY = "Sub", zY = "Tan", BY = "Tanh", vI = "Tile", mYe = "TopK", gYe = "Transform", UY = "Transpose", yYe = "Unique", VY = "Unpack", jY = "UnsortedSegmentSum", WY = "ZerosLike", GY = "Step", xYe = "RotateWithOffset", RX = "_FusedMatMul", zX = "FusedConv2D", BX = "FusedDepthwiseConv2D";
  var bYe = 1e-7, _Ye = 1e-4, K6 = class {
    refCount(t) {
      return Bh("refCount");
    }
    incRef(t) {
      return Bh("incRef");
    }
    timerAvailable() {
      return true;
    }
    time(t) {
      return Bh("time");
    }
    read(t) {
      return Bh("read");
    }
    readSync(t) {
      return Bh("readSync");
    }
    readToGPU(t, r) {
      return Bh("readToGPU");
    }
    numDataIds() {
      return Bh("numDataIds");
    }
    disposeData(t, r) {
      return Bh("disposeData");
    }
    write(t, r, n) {
      return Bh("write");
    }
    move(t, r, n, a, o) {
      return Bh("move");
    }
    memory() {
      return Bh("memory");
    }
    floatPrecision() {
      return Bh("floatPrecision");
    }
    epsilon() {
      return this.floatPrecision() === 32 ? bYe : _Ye;
    }
    dispose() {
      return Bh("dispose");
    }
  };
  function Bh(e) {
    throw new Error(`'${e}' not yet implemented or not found in the registry. This kernel may not be supported by the tfjs backend you have chosen`);
  }
  function zr(e, t) {
    if (!e) throw new Error(typeof t == "string" ? t : t());
  }
  function Zd(e, t, r = "") {
    zr(cx(e, t), () => r + ` Shapes ${e} and ${t} must match`);
  }
  function $Y(e) {
    zr(e != null, () => "The input to the tensor constructor must be a non-null value.");
  }
  function ZT(e, t = [], r = false) {
    if (t == null && (t = []), Array.isArray(e) || Yd(e) && !r) for (let n = 0; n < e.length; ++n) ZT(e[n], t, r);
    else t.push(e);
    return t;
  }
  function Uh(e) {
    if (e.length === 0) return 1;
    let t = e[0];
    for (let r = 1; r < e.length; r++) t *= e[r];
    return t;
  }
  function cx(e, t) {
    if (e === t) return true;
    if (e == null || t == null || e.length !== t.length) return false;
    for (let r = 0; r < e.length; r++) if (e[r] !== t[r]) return false;
    return true;
  }
  function s_(e) {
    return e % 1 === 0;
  }
  function UT(e, t) {
    return t <= e.length ? e : e + " ".repeat(t - e.length);
  }
  function yd(e, t) {
    let r = t.length;
    return e = e == null ? t.map((n, a) => a) : [].concat(e), zr(e.every((n) => n >= -r && n < r), () => `All values in axis param must be in range [-${r}, ${r}) but got axis ${e}`), zr(e.every((n) => s_(n)), () => `All values in axis param must be integers but got axis ${e}`), e.map((n) => n < 0 ? r + n : n);
  }
  function wYe(e, t) {
    let r = [], n = [], a = t != null && Array.isArray(t) && t.length === 0, o = t == null || a ? null : yd(t, e).sort(), s = 0;
    for (let i = 0; i < e.length; ++i) {
      if (o != null) {
        if (o[s] === i && e[i] !== 1) throw new Error(`Can't squeeze axis ${i} since its dim '${e[i]}' is not 1`);
        (o[s] == null || o[s] > i) && e[i] === 1 && (r.push(e[i]), n.push(i)), o[s] <= i && s++;
      }
      e[i] !== 1 && (r.push(e[i]), n.push(i));
    }
    return { newShape: r, keptDims: n };
  }
  function kYe(e, t) {
    let r = null;
    if (e == null || e === "float32") r = new Float32Array(t);
    else if (e === "int32") r = new Int32Array(t);
    else if (e === "bool") r = new Uint8Array(t);
    else if (e === "string") r = new Array(t);
    else throw new Error(`Unknown data type ${e}`);
    return r;
  }
  function TYe(e, t) {
    for (let r = 0; r < e.length; r++) {
      let n = e[r];
      if (isNaN(n) || !isFinite(n)) throw Error(`A tensor of type ${t} being uploaded contains ${n}.`);
    }
  }
  function AYe(e) {
    return e === "bool" || e === "complex64" || e === "float32" || e === "int32" || e === "string";
  }
  function Yd(e) {
    return e instanceof Float32Array || e instanceof Int32Array || e instanceof Uint8Array || e instanceof Uint8ClampedArray;
  }
  function UX(e) {
    if (e === "float32" || e === "int32") return 4;
    if (e === "complex64") return 8;
    if (e === "bool") return 1;
    throw new Error(`Unknown dtype ${e}`);
  }
  function SYe(e) {
    if (e == null) return 0;
    let t = 0;
    return e.forEach((r) => t += r.length), t;
  }
  function mI(e) {
    return typeof e == "string" || e instanceof String;
  }
  function EYe(e) {
    return typeof e == "boolean";
  }
  function DYe(e) {
    return typeof e == "number";
  }
  function gI(e) {
    return Array.isArray(e) ? gI(e[0]) : e instanceof Float32Array ? "float32" : e instanceof Int32Array || e instanceof Uint8Array || e instanceof Uint8ClampedArray ? "int32" : DYe(e) ? "float32" : mI(e) ? "string" : EYe(e) ? "bool" : "float32";
  }
  function VX(e) {
    return !!(e && e.constructor && e.call && e.apply);
  }
  function yI(e) {
    let t = e.length;
    if (t < 2) return [];
    let r = new Array(t - 1);
    r[t - 2] = e[t - 1];
    for (let n = t - 3; n >= 0; --n) r[n] = r[n + 1] * e[n + 1];
    return r;
  }
  function HY(e, t, r, n = false) {
    let a = new Array();
    if (t.length === 1) {
      let o = t[0] * (n ? 2 : 1);
      for (let s = 0; s < o; s++) a[s] = r[e + s];
    } else {
      let o = t[0], s = t.slice(1), i = s.reduce((l, u2) => l * u2) * (n ? 2 : 1);
      for (let l = 0; l < o; l++) a[l] = HY(e + l * i, s, r, n);
    }
    return a;
  }
  function jX(e, t, r = false) {
    if (e.length === 0) return t[0];
    let n = e.reduce((a, o) => a * o) * (r ? 2 : 1);
    if (n === 0) return [];
    if (n !== t.length) throw new Error(`[${e}] does not match the input size ${t.length}${r ? " for a complex tensor" : ""}.`);
    return HY(0, e, t, r);
  }
  function qY(e, t) {
    let r = xI(e, t);
    for (let n = 0; n < r.length; n++) r[n] = 1;
    return r;
  }
  function xI(e, t) {
    if (t == null || t === "float32" || t === "complex64") return new Float32Array(e);
    if (t === "int32") return new Int32Array(e);
    if (t === "bool") return new Uint8Array(e);
    throw new Error(`Unknown data type ${t}`);
  }
  function XY(e) {
    e.forEach((t) => {
      zr(Number.isInteger(t) && t >= 0, () => `Tensor must have a shape comprised of positive integers but got shape [${e}].`);
    });
  }
  function KY(e) {
    return e && e.then && typeof e.then == "function";
  }
  var WX = "tfjsflags", Y6 = class {
    constructor(t) {
      this.global = t, this.flags = {}, this.flagRegistry = {}, this.urlFlags = {}, this.getQueryParams = CYe, this.populateURLFlags();
    }
    setPlatform(t, r) {
      this.platform != null && (ph().getBool("IS_TEST") || ph().getBool("PROD") || console.warn(`Platform ${this.platformName} has already been set. Overwriting the platform with ${r}.`)), this.platformName = t, this.platform = r;
    }
    registerFlag(t, r, n) {
      if (this.flagRegistry[t] = { evaluationFn: r, setHook: n }, this.urlFlags[t] != null) {
        let a = this.urlFlags[t];
        ph().getBool("IS_TEST") || ph().getBool("PROD") || console.warn(`Setting feature override from URL ${t}: ${a}.`), this.set(t, a);
      }
    }
    async getAsync(t) {
      return t in this.flags ? this.flags[t] : (this.flags[t] = await this.evaluateFlag(t), this.flags[t]);
    }
    get(t) {
      if (t in this.flags) return this.flags[t];
      let r = this.evaluateFlag(t);
      if (KY(r)) throw new Error(`Flag ${t} cannot be synchronously evaluated. Please use getAsync() instead.`);
      return this.flags[t] = r, this.flags[t];
    }
    getNumber(t) {
      return this.get(t);
    }
    getBool(t) {
      return this.get(t);
    }
    getFlags() {
      return this.flags;
    }
    get features() {
      return this.flags;
    }
    set(t, r) {
      if (this.flagRegistry[t] == null) throw new Error(`Cannot set flag ${t} as it has not been registered.`);
      this.flags[t] = r, this.flagRegistry[t].setHook != null && this.flagRegistry[t].setHook(r);
    }
    evaluateFlag(t) {
      if (this.flagRegistry[t] == null) throw new Error(`Cannot evaluate flag '${t}': no evaluation function found.`);
      return this.flagRegistry[t].evaluationFn();
    }
    setFlags(t) {
      this.flags = Object.assign({}, t);
    }
    reset() {
      this.flags = {}, this.urlFlags = {}, this.populateURLFlags();
    }
    populateURLFlags() {
      if (typeof this.global > "u" || typeof this.global.location > "u" || typeof this.global.location.search > "u") return;
      let t = this.getQueryParams(this.global.location.search);
      WX in t && t[WX].split(",").forEach((n) => {
        let [a, o] = n.split(":");
        this.urlFlags[a] = IYe(a, o);
      });
    }
  };
  function CYe(e) {
    let t = {};
    return e.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g, (r, ...n) => (MYe(t, n[0], n[1]), n.join("="))), t;
  }
  function MYe(e, t, r) {
    e[decodeURIComponent(t)] = decodeURIComponent(r || "");
  }
  function IYe(e, t) {
    if (t = t.toLowerCase(), t === "true" || t === "false") return t === "true";
    if (`${+t}` === t) return +t;
    throw new Error(`Could not parse value flag value ${t} for flag ${e}.`);
  }
  function ph() {
    return YY;
  }
  var YY = null;
  function NYe(e) {
    YY = e;
  }
  var W6;
  function ZY() {
    if (W6 == null) {
      let e;
      if (typeof window < "u") e = window;
      else if (typeof global < "u") e = global;
      else if (typeof process < "u") e = process;
      else if (typeof self < "u") e = self;
      else throw new Error("Could not find a global object");
      W6 = e;
    }
    return W6;
  }
  function FYe() {
    let e = ZY();
    return e._tfGlobals == null && (e._tfGlobals = /* @__PURE__ */ new Map()), e._tfGlobals;
  }
  function bI(e, t) {
    let r = FYe();
    if (r.has(e)) return r.get(e);
    {
      let n = t();
      return r.set(e, n), r.get(e);
    }
  }
  function ex(...e) {
    ph().getBool("IS_TEST") || ph().getBool("PROD") || console.warn(...e);
  }
  var JY = bI("kernelRegistry", () => /* @__PURE__ */ new Map()), Z6 = bI("gradRegistry", () => /* @__PURE__ */ new Map());
  function GX(e, t) {
    let r = PYe(e, t);
    return JY.get(r);
  }
  function $X(e) {
    return Z6.get(e);
  }
  function HX(e) {
    let t = JY.entries(), r = [];
    for (; ; ) {
      let { done: n, value: a } = t.next();
      if (n) break;
      let [o, s] = a, [i] = o.split("_");
      i === e && r.push(s);
    }
    return r;
  }
  function OYe(e) {
    let { kernelName: t } = e;
    Z6.has(t) && ph().getBool("DEBUG") && ex(`Overriding the gradient for '${t}'`), Z6.set(t, e);
  }
  function PYe(e, t) {
    return `${t}_${e}`;
  }
  var LYe = sKe || aK;
  function _I(e) {
    return LYe.fromString(e, true, 16);
  }
  var iwt = _I("c3a5c85c97cb3127"), owt = _I("b492b66fbe98f273"), swt = _I("9ae16a3b2f90404f");
  function RYe(e, t) {
    return e instanceof Float32Array && t === "float32" || e instanceof Int32Array && t === "int32" || e instanceof Uint8Array && t === "bool";
  }
  function QY(e, t) {
    if (t === "string") throw new Error("Cannot convert a string[] to a TypedArray");
    if (Array.isArray(e) && (e = ZT(e)), ph().getBool("DEBUG") && TYe(e, t), RYe(e, t)) return e;
    if (t == null || t === "float32" || t === "complex64") return new Float32Array(e);
    if (t === "int32") return new Int32Array(e);
    if (t === "bool") {
      let r = new Uint8Array(e.length);
      for (let n = 0; n < r.length; ++n) Math.round(e[n]) !== 0 && (r[n] = 1);
      return r;
    } else throw new Error(`Unknown data type ${t}`);
  }
  function GT() {
    return ph().platform.now();
  }
  function zYe(e, t = "utf-8") {
    return t = t || "utf-8", ph().platform.encode(e, t);
  }
  function qX(e, t = "utf-8") {
    return t = t || "utf-8", ph().platform.decode(e, t);
  }
  var J6 = class {
    constructor(t, r) {
      this.backendTimer = t, this.logger = r, r == null && (this.logger = new Q6());
    }
    profileKernel(t, r, n) {
      let a, o = () => {
        a = n();
      }, s, i = GT();
      if (this.backendTimer.timerAvailable()) s = this.backendTimer.time(o);
      else {
        o();
        for (let u2 of a) u2.dataSync();
        s = Promise.resolve({ kernelMs: GT() - i });
      }
      if (ph().getBool("CHECK_COMPUTATION_FOR_ERRORS")) for (let u2 = 0; u2 < a.length; u2++) {
        let c = a[u2];
        c.data().then((f) => {
          BYe(f, c.dtype, t);
        });
      }
      return { kernelName: t, outputs: a, inputs: r, timeMs: s.then((u2) => u2.kernelMs), extraInfo: s.then((u2) => u2.getExtraProfileInfo != null ? u2.getExtraProfileInfo() : "") };
    }
    logKernelProfile(t) {
      let { kernelName: r, outputs: n, timeMs: a, inputs: o, extraInfo: s } = t;
      n.forEach((i) => {
        Promise.all([i.data(), a, s]).then((l) => {
          this.logger.logKernelProfile(r, i, l[0], l[1], o, l[2]);
        });
      });
    }
  };
  function BYe(e, t, r) {
    if (t !== "float32") return false;
    for (let n = 0; n < e.length; n++) {
      let a = e[n];
      if (isNaN(a) || !isFinite(a)) return console.warn(`Found ${a} in the result of '${r}'`), true;
    }
    return false;
  }
  var Q6 = class {
    logKernelProfile(t, r, n, a, o, s) {
      let i = typeof a == "number" ? UT(`${a}ms`, 9) : a.error, l = UT(t, 25), u2 = r.rank, c = r.size, f = UT(r.shape.toString(), 14), h = "";
      for (let p in o) {
        let d = o[p];
        if (d != null) {
          let v = d.shape || r.shape, m = v.length;
          h += `${p}: ${m}D ${m > 0 ? v : ""} `;
        }
      }
      console.log(`%c${l}	%c${i}	%c${u2}D ${f}	%c${c}	%c${h}	%c${s}`, "font-weight:bold", "color:red", "color:blue", "color: orange", "color: green", "color: steelblue");
    }
  };
  function UYe(e, t, r) {
    let n = {}, a = {};
    for (let l = 0; l < t.length; l++) n[t[l].id] = true;
    for (let l = 0; l < e.length; l++) {
      let u2 = e[l], c = u2.inputs;
      for (let f in c) {
        let h = c[f], p = false;
        for (let d = 0; d < t.length; d++) if (n[h.id]) {
          u2.outputs.forEach((v) => n[v.id] = true), p = true, a[u2.id] = true;
          break;
        }
        if (p) break;
      }
    }
    let o = {};
    o[r.id] = true;
    let s = {};
    for (let l = e.length - 1; l >= 0; l--) {
      let u2 = e[l], c = u2.inputs;
      for (let f = 0; f < u2.outputs.length; f++) if (o[u2.outputs[f].id]) {
        for (let h in c) o[c[h].id] = true, s[u2.id] = true;
        break;
      }
    }
    let i = [];
    for (let l = 0; l < e.length; l++) {
      let u2 = e[l];
      if (a[u2.id] && s[u2.id]) {
        let c = {};
        for (let h in u2.inputs) {
          let p = u2.inputs[h];
          n[p.id] && (c[h] = p);
        }
        let f = Object.assign({}, u2);
        f.inputs = c, f.outputs = u2.outputs, i.push(f);
      }
    }
    return i;
  }
  function VYe(e, t, r, n) {
    for (let a = t.length - 1; a >= 0; a--) {
      let o = t[a], s = [];
      if (o.outputs.forEach((l) => {
        let u2 = e[l.id];
        u2 != null ? s.push(u2) : s.push(null);
      }), o.gradient == null) throw new Error(`Cannot compute gradient: gradient function not found for ${o.kernelName}.`);
      let i = o.gradient(s);
      for (let l in o.inputs) {
        if (!(l in i)) throw new Error(`Cannot backprop through input ${l}. Available gradients found: ${Object.keys(i)}.`);
        let u2 = r(() => i[l]());
        if (u2.dtype !== "float32") throw new Error(`Error in gradient for op ${o.kernelName}. The gradient of input ${l} must have 'float32' dtype, but has '${u2.dtype}'`);
        let c = o.inputs[l];
        if (!cx(u2.shape, c.shape)) throw new Error(`Error in gradient for op ${o.kernelName}. The gradient of input '${l}' has shape '${u2.shape}', which does not match the shape of the input '${c.shape}'`);
        if (e[c.id] == null) e[c.id] = u2;
        else {
          let f = e[c.id];
          e[c.id] = n(f, u2), f.dispose();
        }
      }
    }
  }
  var XX = 20, r_ = 3, G6 = 7;
  function jYe(e, t, r, n) {
    let a = yI(t), o = WYe(e, t, r, a), s = t.length, i = VT(e, t, r, a, o), l = ["Tensor"];
    return n && (l.push(`  dtype: ${r}`), l.push(`  rank: ${s}`), l.push(`  shape: [${t}]`), l.push("  values:")), l.push(i.map((u2) => "    " + u2).join(`
`)), l.join(`
`);
  }
  function WYe(e, t, r, n) {
    let a = Uh(t), o = n[n.length - 1], s = new Array(o).fill(0), i = t.length, l = r === "complex64" ? i_(e) : e;
    if (i > 1) for (let u2 = 0; u2 < a / o; u2++) {
      let c = u2 * o;
      for (let f = 0; f < o; f++) s[f] = Math.max(s[f], a_(l[c + f], 0, r).length);
    }
    return s;
  }
  function a_(e, t, r) {
    let n;
    return Array.isArray(e) ? n = `${parseFloat(e[0].toFixed(G6))} + ${parseFloat(e[1].toFixed(G6))}j` : mI(e) ? n = `'${e}'` : r === "bool" ? n = eZ(e) : n = parseFloat(e.toFixed(G6)).toString(), UT(n, t);
  }
  function eZ(e) {
    return e === 0 ? "false" : "true";
  }
  function VT(e, t, r, n, a, o = true) {
    let s = r === "complex64" ? 2 : 1, i = t[0], l = t.length;
    if (l === 0) {
      if (r === "complex64") {
        let v = i_(e);
        return [a_(v[0], 0, r)];
      }
      return r === "bool" ? [eZ(e[0])] : [e[0].toString()];
    }
    if (l === 1) {
      if (i > XX) {
        let m = r_ * s, g = Array.from(e.slice(0, m)), x = Array.from(e.slice((i - r_) * s, i * s));
        return r === "complex64" && (g = i_(g), x = i_(x)), ["[" + g.map((b, y) => a_(b, a[y], r)).join(", ") + ", ..., " + x.map((b, y) => a_(b, a[i - r_ + y], r)).join(", ") + "]"];
      }
      let v = r === "complex64" ? i_(e) : Array.from(e);
      return ["[" + v.map((m, g) => a_(m, a[g], r)).join(", ") + "]"];
    }
    let u2 = t.slice(1), c = n.slice(1), f = n[0] * s, h = [];
    if (i > XX) {
      for (let v = 0; v < r_; v++) {
        let m = v * f, g = m + f;
        h.push(...VT(e.slice(m, g), u2, r, c, a, false));
      }
      h.push("...");
      for (let v = i - r_; v < i; v++) {
        let m = v * f, g = m + f;
        h.push(...VT(e.slice(m, g), u2, r, c, a, v === i - 1));
      }
    } else for (let v = 0; v < i; v++) {
      let m = v * f, g = m + f;
      h.push(...VT(e.slice(m, g), u2, r, c, a, v === i - 1));
    }
    let p = l === 2 ? "," : "";
    h[0] = "[" + h[0] + p;
    for (let v = 1; v < h.length - 1; v++) h[v] = " " + h[v] + p;
    let d = `,
`;
    for (let v = 2; v < l; v++) d += `
`;
    return h[h.length - 1] = " " + h[h.length - 1] + "]" + (o ? "" : d), h;
  }
  function i_(e) {
    let t = [];
    for (let r = 0; r < e.length; r += 2) t.push([e[r], e[r + 1]]);
    return t;
  }
  var eI = class {
    constructor(t, r, n) {
      if (this.dtype = r, this.shape = t.slice(), this.size = Uh(t), n != null) {
        let a = n.length;
        zr(a === this.size, () => `Length of values '${a}' does not match the size inferred by the shape '${this.size}'.`);
      }
      if (r === "complex64") throw new Error("complex64 dtype TensorBuffers are not supported. Please create a TensorBuffer for the real and imaginary parts separately and call tf.complex(real, imag).");
      this.values = n || kYe(r, this.size), this.strides = yI(t);
    }
    set(t, ...r) {
      r.length === 0 && (r = [0]), zr(r.length === this.rank, () => `The number of provided coordinates (${r.length}) must match the rank (${this.rank})`);
      let n = this.locToIndex(r);
      this.values[n] = t;
    }
    get(...t) {
      t.length === 0 && (t = [0]);
      let r = 0;
      for (let a of t) {
        if (a < 0 || a >= this.shape[r]) {
          let o = `Requested out of range element at ${t}.   Buffer shape=${this.shape}`;
          throw new Error(o);
        }
        r++;
      }
      let n = t[t.length - 1];
      for (let a = 0; a < t.length - 1; ++a) n += this.strides[a] * t[a];
      return this.values[n];
    }
    locToIndex(t) {
      if (this.rank === 0) return 0;
      if (this.rank === 1) return t[0];
      let r = t[t.length - 1];
      for (let n = 0; n < t.length - 1; ++n) r += this.strides[n] * t[n];
      return r;
    }
    indexToLoc(t) {
      if (this.rank === 0) return [];
      if (this.rank === 1) return [t];
      let r = new Array(this.shape.length);
      for (let n = 0; n < r.length - 1; ++n) r[n] = Math.floor(t / this.strides[n]), t -= r[n] * this.strides[n];
      return r[r.length - 1] = t, r;
    }
    get rank() {
      return this.shape.length;
    }
    toTensor() {
      return md().makeTensor(this.values, this.shape, this.dtype);
    }
  }, md = null, n_ = null, GYe = null;
  function $Ye(e) {
    md = e;
  }
  function HYe(e) {
    GYe = e;
  }
  var Xc = class {
    constructor(t, r, n, a) {
      this.kept = false, this.isDisposedInternal = false, this.shape = t.slice(), this.dtype = r || "float32", this.size = Uh(t), this.strides = yI(t), this.dataId = n, this.id = a, this.rankType = this.rank < 5 ? this.rank.toString() : "higher";
    }
    get rank() {
      return this.shape.length;
    }
    async buffer() {
      let t = await this.data();
      return n_.buffer(this.shape, this.dtype, t);
    }
    bufferSync() {
      return n_.buffer(this.shape, this.dtype, this.dataSync());
    }
    async array() {
      let t = await this.data();
      return jX(this.shape, t, this.dtype === "complex64");
    }
    arraySync() {
      return jX(this.shape, this.dataSync(), this.dtype === "complex64");
    }
    async data() {
      this.throwIfDisposed();
      let t = md().read(this.dataId);
      if (this.dtype === "string") {
        let r = await t;
        try {
          return r.map((n) => qX(n));
        } catch {
          throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().");
        }
      }
      return t;
    }
    dataToGPU(t) {
      return this.throwIfDisposed(), md().readToGPU(this.dataId, t);
    }
    dataSync() {
      this.throwIfDisposed();
      let t = md().readSync(this.dataId);
      if (this.dtype === "string") try {
        return t.map((r) => qX(r));
      } catch {
        throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().");
      }
      return t;
    }
    async bytes() {
      this.throwIfDisposed();
      let t = await md().read(this.dataId);
      return this.dtype === "string" ? t : new Uint8Array(t.buffer);
    }
    dispose() {
      this.isDisposed || (md().disposeTensor(this), this.isDisposedInternal = true);
    }
    get isDisposed() {
      return this.isDisposedInternal;
    }
    throwIfDisposed() {
      if (this.isDisposed) throw new Error("Tensor is disposed.");
    }
    print(t = false) {
      return n_.print(this, t);
    }
    clone() {
      return this.throwIfDisposed(), n_.clone(this);
    }
    toString(t = false) {
      let r = this.dataSync();
      return jYe(r, this.shape, this.dtype, t);
    }
    cast(t) {
      return this.throwIfDisposed(), n_.cast(this, t);
    }
    variable(t = true, r, n) {
      return this.throwIfDisposed(), md().makeVariable(this, t, r, n);
    }
  };
  Object.defineProperty(Xc, Symbol.hasInstance, { value: (e) => !!e && e.data != null && e.dataSync != null && e.throwIfDisposed != null });
  function Vn() {
    return bI("Tensor", () => Xc);
  }
  Vn();
  var l_ = class extends Xc {
    constructor(t, r, n, a) {
      super(t.shape, t.dtype, t.dataId, a), this.trainable = r, this.name = n;
    }
    assign(t) {
      if (t.dtype !== this.dtype) throw new Error(`dtype of the new value (${t.dtype}) and previous value (${this.dtype}) must match`);
      if (!cx(t.shape, this.shape)) throw new Error(`shape of the new value (${t.shape}) and previous value (${this.shape}) must match`);
      md().disposeTensor(this), this.dataId = t.dataId, md().incRef(this, null);
    }
    dispose() {
      md().disposeVariable(this), this.isDisposedInternal = true;
    }
  };
  Object.defineProperty(l_, Symbol.hasInstance, { value: (e) => e instanceof Xc && e.assign != null && e.assign instanceof Function });
  var KX;
  (function(e) {
    e.R0 = "R0", e.R1 = "R1", e.R2 = "R2", e.R3 = "R3", e.R4 = "R4", e.R5 = "R5", e.R6 = "R6";
  })(KX || (KX = {}));
  var tI;
  (function(e) {
    e.float32 = "float32", e.int32 = "int32", e.bool = "int32", e.complex64 = "complex64";
  })(tI || (tI = {}));
  var rI;
  (function(e) {
    e.float32 = "float32", e.int32 = "int32", e.bool = "bool", e.complex64 = "complex64";
  })(rI || (rI = {}));
  var nI;
  (function(e) {
    e.float32 = "float32", e.int32 = "float32", e.bool = "float32", e.complex64 = "complex64";
  })(nI || (nI = {}));
  var aI;
  (function(e) {
    e.float32 = "complex64", e.int32 = "complex64", e.bool = "complex64", e.complex64 = "complex64";
  })(aI || (aI = {}));
  var qYe = { float32: nI, int32: tI, bool: rI, complex64: aI };
  function XYe(e, t) {
    if (e === "string" || t === "string") {
      if (e === "string" && t === "string") return "string";
      throw new Error(`Can not upcast ${e} with ${t}`);
    }
    return qYe[e][t];
  }
  function lu(e, t) {
    if (e.dtype === t.dtype) return [e, t];
    let r = XYe(e.dtype, t.dtype);
    return [e.cast(r), t.cast(r)];
  }
  function KYe(e, t) {
    zr(e.dtype === t.dtype, () => `The dtypes of the first(${e.dtype}) and second(${t.dtype}) input must match`);
  }
  function tZ(e) {
    let t = [];
    return rZ(e, t, /* @__PURE__ */ new Set()), t;
  }
  function rZ(e, t, r) {
    if (e == null) return;
    if (e instanceof Xc) {
      t.push(e);
      return;
    }
    if (!YYe(e)) return;
    let n = e;
    for (let a in n) {
      let o = n[a];
      r.has(o) || (r.add(o), rZ(o, t, r));
    }
  }
  function YYe(e) {
    return Array.isArray(e) || typeof e == "object";
  }
  function $6(e) {
    return e.kernelName != null;
  }
  var $T = class {
    constructor() {
      this.registeredVariables = {}, this.nextTapeNodeId = 0, this.numBytes = 0, this.numTensors = 0, this.numStringTensors = 0, this.numDataBuffers = 0, this.gradientDepth = 0, this.kernelDepth = 0, this.scopeStack = [], this.numDataMovesStack = [], this.nextScopeId = 0, this.tensorInfo = /* @__PURE__ */ new WeakMap(), this.profiling = false, this.activeProfile = { newBytes: 0, newTensors: 0, peakBytes: 0, kernels: [], result: null, get kernelNames() {
        return Array.from(new Set(this.kernels.map((t) => t.name)));
      } };
    }
    dispose() {
      for (let t in this.registeredVariables) this.registeredVariables[t].dispose();
    }
  }, jv = class {
    constructor(t) {
      this.ENV = t, this.registry = {}, this.registryFactory = {}, this.pendingBackendInitId = 0, this.state = new $T();
    }
    async ready() {
      if (this.pendingBackendInit != null) return this.pendingBackendInit.then(() => {
      });
      if (this.backendInstance != null) return;
      let t = this.getSortedBackends();
      for (let r = 0; r < t.length; r++) {
        let n = t[r];
        if (await this.initializeBackend(n).success) {
          await this.setBackend(n);
          return;
        }
      }
      throw new Error("Could not initialize any backends, all backend initializations failed.");
    }
    get backend() {
      if (this.pendingBackendInit != null) throw new Error(`Backend '${this.backendName}' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods`);
      if (this.backendInstance == null) {
        let { name: t, asyncInit: r } = this.initializeBackendsAndReturnBest();
        if (r) throw new Error(`The highest priority backend '${t}' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods`);
        this.setBackend(t);
      }
      return this.backendInstance;
    }
    backendNames() {
      return Object.keys(this.registryFactory);
    }
    findBackend(t) {
      if (!(t in this.registry)) if (t in this.registryFactory) {
        let { asyncInit: r } = this.initializeBackend(t);
        if (r) return null;
      } else return null;
      return this.registry[t];
    }
    findBackendFactory(t) {
      return t in this.registryFactory ? this.registryFactory[t].factory : null;
    }
    registerBackend(t, r, n = 1) {
      return t in this.registryFactory ? (ex(`${t} backend was already registered. Reusing existing backend factory.`), false) : (this.registryFactory[t] = { factory: r, priority: n }, true);
    }
    async setBackend(t) {
      if (this.registryFactory[t] == null) throw new Error(`Backend name '${t}' not found in registry`);
      if (this.backendName = t, this.registry[t] == null) {
        this.backendInstance = null;
        let { success: r, asyncInit: n } = this.initializeBackend(t);
        if (!(n ? await r : r)) return false;
      }
      return this.backendInstance = this.registry[t], this.setupRegisteredKernels(), this.profiler = new J6(this.backendInstance), true;
    }
    setupRegisteredKernels() {
      HX(this.backendName).forEach((r) => {
        r.setupFunc != null && r.setupFunc(this.backendInstance);
      });
    }
    disposeRegisteredKernels(t) {
      HX(t).forEach((n) => {
        n.disposeFunc != null && n.disposeFunc(this.registry[t]);
      });
    }
    initializeBackend(t) {
      let r = this.registryFactory[t];
      if (r == null) throw new Error(`Cannot initialize backend ${t}, no registration found.`);
      try {
        let n = r.factory();
        if (n && !(n instanceof K6) && typeof n.then == "function") {
          let a = ++this.pendingBackendInitId, o = n.then((s) => a < this.pendingBackendInitId ? false : (this.registry[t] = s, this.pendingBackendInit = null, true)).catch((s) => (a < this.pendingBackendInitId || (this.pendingBackendInit = null, ex(`Initialization of backend ${t} failed`), ex(s.stack || s.message)), false));
          return this.pendingBackendInit = o, { success: o, asyncInit: true };
        } else return this.registry[t] = n, { success: true, asyncInit: false };
      } catch (n) {
        return ex(`Initialization of backend ${t} failed`), ex(n.stack || n.message), { success: false, asyncInit: false };
      }
    }
    removeBackend(t) {
      if (!(t in this.registryFactory)) throw new Error(`${t} backend not found in registry`);
      this.backendName === t && this.pendingBackendInit != null && this.pendingBackendInitId++, t in this.registry && (this.disposeRegisteredKernels(t), this.registry[t].dispose(), delete this.registry[t]), delete this.registryFactory[t], this.backendName === t && (this.pendingBackendInit = null, this.backendName = null, this.backendInstance = null);
    }
    getSortedBackends() {
      if (Object.keys(this.registryFactory).length === 0) throw new Error("No backend found in registry.");
      return Object.keys(this.registryFactory).sort((t, r) => this.registryFactory[r].priority - this.registryFactory[t].priority);
    }
    initializeBackendsAndReturnBest() {
      let t = this.getSortedBackends();
      for (let r = 0; r < t.length; r++) {
        let n = t[r], { success: a, asyncInit: o } = this.initializeBackend(n);
        if (o || a) return { name: n, asyncInit: o };
      }
      throw new Error("Could not initialize any backends, all backend initializations failed.");
    }
    moveData(t, r) {
      let n = this.state.tensorInfo.get(r), a = n.backend, o = this.readSync(r), s = a.refCount(r);
      a.disposeData(r, true), n.backend = t, t.move(r, o, n.shape, n.dtype, s), this.shouldCheckForMemLeaks() && this.state.numDataMovesStack[this.state.numDataMovesStack.length - 1]++;
    }
    tidy(t, r) {
      let n = null;
      if (r == null) {
        if (typeof t != "function") throw new Error("Please provide a function to tidy()");
        r = t;
      } else {
        if (typeof t != "string" && !(t instanceof String)) throw new Error("When calling with two arguments, the first argument to tidy() must be a string");
        if (typeof r != "function") throw new Error("When calling with two arguments, the 2nd argument to tidy() must be a function");
        n = t;
      }
      let a;
      return this.scopedRun(() => this.startScope(n), () => this.endScope(a), () => (a = r(), a instanceof Promise && console.error("Cannot return a Promise inside of tidy."), a));
    }
    scopedRun(t, r, n) {
      t();
      try {
        let a = n();
        return r(), a;
      } catch (a) {
        throw r(), a;
      }
    }
    nextTensorId() {
      return jv.nextTensorId++;
    }
    nextVariableId() {
      return jv.nextVariableId++;
    }
    clone(t) {
      let r = on.runKernel(dI, { x: t }), n = { x: t }, a = (s) => ({ x: () => {
        let i = "float32", l = { x: s }, u2 = { dtype: i };
        return on.runKernel(pI, l, u2);
      } }), o = [];
      return this.addTapeNode(this.state.activeScope.name, n, [r], a, o, {}), r;
    }
    runKernel(t, r, n) {
      if (this.backendName == null && this.backend, !(GX(t, this.backendName) != null)) throw new Error(`Kernel '${t}' not registered for backend '${this.backendName}'`);
      return this.runKernelFunc({ kernelName: t, inputs: r, attrs: n });
    }
    shouldCheckForMemLeaks() {
      return this.ENV.getBool("IS_TEST");
    }
    checkKernelForMemLeak(t, r, n) {
      let a = this.backend.numDataIds(), o = 0;
      n.forEach((l) => {
        o += l.dtype === "complex64" ? 3 : 1;
      });
      let s = this.state.numDataMovesStack[this.state.numDataMovesStack.length - 1], i = a - r - o - s;
      if (i > 0) throw new Error(`Backend '${this.backendName}' has an internal memory leak (${i} data ids) after running '${t}'`);
    }
    runKernelFunc(t) {
      let r, n = [], a = this.isTapeOn(), o = this.state.numBytes, s = this.state.numTensors;
      this.shouldCheckForMemLeaks() && this.state.numDataMovesStack.push(0);
      let i;
      this.backendName == null && this.backend;
      let l, u2 = $6(t) ? t.kernelName : this.state.activeScope != null ? this.state.activeScope.name : "";
      if ($6(t)) {
        let { kernelName: d, inputs: v, attrs: m } = t;
        this.backendName == null && this.backend;
        let g = GX(d, this.backendName);
        zr(g != null, () => `Cannot find registered kernel '${d}' for backend '${this.backendName}'`), i = () => {
          let x = this.backend.numDataIds();
          l = g.kernelFunc({ inputs: v, attrs: m, backend: this.backend });
          let b = Array.isArray(l) ? l : [l];
          this.shouldCheckForMemLeaks() && this.checkKernelForMemLeak(d, x, b);
          let y = b.map((w) => {
            if (w.rank != null) return w;
            let { dataId: _4, shape: k, dtype: T2 } = w;
            return this.makeTensorFromDataId(_4, k, T2);
          });
          if (a) {
            let w = this.getTensorsForGradient(d, v, y);
            n = this.saveTensorsForBackwardMode(w);
          }
          return y;
        };
      } else {
        let { forwardFunc: d } = t, v = (m) => {
          !a || (n = m.map((g) => this.keep(this.clone(g))));
        };
        i = () => {
          let m = this.backend.numDataIds();
          l = this.tidy(() => d(this.backend, v));
          let g = Array.isArray(l) ? l : [l];
          return this.shouldCheckForMemLeaks() && this.checkKernelForMemLeak(u2, m, g), g;
        };
      }
      let { inputs: c, attrs: f } = t, h = $6(t) ? null : t.backwardsFunc, p;
      return this.scopedRun(() => this.state.kernelDepth++, () => this.state.kernelDepth--, () => {
        !this.ENV.getBool("DEBUG") && !this.state.profiling ? r = i() : (p = this.profiler.profileKernel(u2, c, () => i()), this.ENV.getBool("DEBUG") && this.profiler.logKernelProfile(p), r = p.outputs);
      }), a && this.addTapeNode(u2, c, r, h, n, f), this.state.profiling && this.state.activeProfile.kernels.push({ name: u2, bytesAdded: this.state.numBytes - o, totalBytesSnapshot: this.state.numBytes, tensorsAdded: this.state.numTensors - s, totalTensorsSnapshot: this.state.numTensors, inputShapes: Object.keys(c).map((d) => c[d] != null ? c[d].shape : null), outputShapes: r.map((d) => d.shape), kernelTimeMs: p.timeMs, extraInfo: p.extraInfo }), Array.isArray(l) ? r : r[0];
    }
    saveTensorsForBackwardMode(t) {
      return t.map((n) => this.keep(this.clone(n)));
    }
    getTensorsForGradient(t, r, n) {
      let a = $X(t);
      if (a != null) {
        let o = a.inputsToSave || [], s = a.outputsToSave || [], i;
        a.saveAllInputs ? (zr(Array.isArray(r), () => "saveAllInputs is true, expected inputs to be an array."), i = Object.keys(r).map((u2) => r[u2])) : i = o.map((u2) => r[u2]);
        let l = n.filter((u2, c) => s[c]);
        return i.concat(l);
      }
      return [];
    }
    makeTensor(t, r, n, a) {
      if (t == null) throw new Error("Values passed to engine.makeTensor() are null");
      n = n || "float32", a = a || this.backend;
      let o = t;
      n === "string" && mI(t[0]) && (o = t.map((l) => zYe(l)));
      let s = a.write(o, r, n), i = new Xc(r, n, s, this.nextTensorId());
      if (this.trackTensor(i, a), n === "string") {
        let l = this.state.tensorInfo.get(s), u2 = SYe(o);
        this.state.numBytes += u2 - l.bytes, l.bytes = u2;
      }
      return i;
    }
    makeTensorFromDataId(t, r, n, a) {
      n = n || "float32";
      let o = new Xc(r, n, t, this.nextTensorId());
      return this.trackTensor(o, a), o;
    }
    makeVariable(t, r = true, n, a) {
      n = n || this.nextVariableId().toString(), a != null && a !== t.dtype && (t = t.cast(a));
      let o = new l_(t, r, n, this.nextTensorId());
      if (this.state.registeredVariables[o.name] != null) throw new Error(`Variable with name ${o.name} was already registered`);
      return this.state.registeredVariables[o.name] = o, this.incRef(o, this.backend), o;
    }
    trackTensor(t, r) {
      this.state.numTensors++, t.dtype === "string" && this.state.numStringTensors++;
      let n = 0;
      t.dtype !== "complex64" && t.dtype !== "string" && (n = t.size * UX(t.dtype)), this.state.numBytes += n, this.state.tensorInfo.has(t.dataId) || (this.state.numDataBuffers++, this.state.tensorInfo.set(t.dataId, { backend: r || this.backend, dtype: t.dtype, shape: t.shape, bytes: n })), t instanceof l_ || this.track(t);
    }
    incRef(t, r) {
      this.trackTensor(t, r), this.backend.incRef(t.dataId);
    }
    removeDataId(t, r) {
      this.state.tensorInfo.has(t) && this.state.tensorInfo.get(t).backend === r && (this.state.tensorInfo.delete(t), this.state.numDataBuffers--);
    }
    disposeTensor(t) {
      if (!this.state.tensorInfo.has(t.dataId)) return;
      let r = this.state.tensorInfo.get(t.dataId);
      if (this.state.numTensors--, t.dtype === "string" && (this.state.numStringTensors--, this.state.numBytes -= r.bytes), t.dtype !== "complex64" && t.dtype !== "string") {
        let n = t.size * UX(t.dtype);
        this.state.numBytes -= n;
      }
      r.backend.disposeData(t.dataId) && this.removeDataId(t.dataId, r.backend);
    }
    disposeVariables() {
      for (let t in this.state.registeredVariables) {
        let r = this.state.registeredVariables[t];
        this.disposeVariable(r);
      }
    }
    disposeVariable(t) {
      this.disposeTensor(t), this.state.registeredVariables[t.name] != null && delete this.state.registeredVariables[t.name];
    }
    memory() {
      let t = this.backend.memory();
      return t.numTensors = this.state.numTensors, t.numDataBuffers = this.state.numDataBuffers, t.numBytes = this.state.numBytes, this.state.numStringTensors > 0 && (t.unreliable = true, t.reasons == null && (t.reasons = []), t.reasons.push("Memory usage by string tensors is approximate (2 bytes per character)")), t;
    }
    async profile(t) {
      this.state.profiling = true;
      let r = this.state.numBytes, n = this.state.numTensors;
      this.state.activeProfile.kernels = [], this.state.activeProfile.result = await t(), this.state.profiling = false, this.state.activeProfile.peakBytes = Math.max(...this.state.activeProfile.kernels.map((a) => a.totalBytesSnapshot)), this.state.activeProfile.newBytes = this.state.numBytes - r, this.state.activeProfile.newTensors = this.state.numTensors - n;
      for (let a of this.state.activeProfile.kernels) a.kernelTimeMs = await a.kernelTimeMs, a.extraInfo = await a.extraInfo;
      return this.state.activeProfile;
    }
    isTapeOn() {
      return this.state.gradientDepth > 0 && this.state.kernelDepth === 0;
    }
    addTapeNode(t, r, n, a, o, s) {
      let i = { id: this.state.nextTapeNodeId++, kernelName: t, inputs: r, outputs: n, saved: o }, l = $X(t);
      l != null && (a = l.gradFunc), a != null && (i.gradient = (u2) => (u2 = u2.map((c, f) => {
        if (c == null) {
          let h = n[f], p = xI(h.size, h.dtype);
          return this.makeTensor(p, h.shape, h.dtype);
        }
        return c;
      }), a(u2.length > 1 ? u2 : u2[0], o, s))), this.state.activeTape.push(i);
    }
    keep(t) {
      return t.kept = true, t;
    }
    startTape() {
      this.state.gradientDepth === 0 && (this.state.activeTape = []), this.state.gradientDepth++;
    }
    endTape() {
      this.state.gradientDepth--;
    }
    startScope(t) {
      let r = { track: [], name: "unnamed scope", id: this.state.nextScopeId++ };
      t && (r.name = t), this.state.scopeStack.push(r), this.state.activeScope = r;
    }
    endScope(t) {
      let r = tZ(t), n = new Set(r.map((o) => o.id));
      for (let o = 0; o < this.state.activeScope.track.length; o++) {
        let s = this.state.activeScope.track[o];
        !s.kept && !n.has(s.id) && s.dispose();
      }
      let a = this.state.scopeStack.pop();
      this.state.activeScope = this.state.scopeStack.length === 0 ? null : this.state.scopeStack[this.state.scopeStack.length - 1], r.forEach((o) => {
        !o.kept && o.scopeId === a.id && this.track(o);
      });
    }
    gradients(t, r, n, a = false) {
      if (zr(r.length > 0, () => "gradients() received an empty list of xs."), n != null && n.dtype !== "float32") throw new Error(`dy must have 'float32' dtype, but has '${n.dtype}'`);
      let o = this.scopedRun(() => this.startTape(), () => this.endTape(), () => this.tidy("forward", t));
      zr(o instanceof Xc, () => "The result y returned by f() must be a tensor.");
      let s = UYe(this.state.activeTape, r, o);
      if (!a && s.length === 0 && r.length > 0) throw new Error("Cannot compute gradient of y=f(x) with respect to x. Make sure that the f you passed encloses all operations that lead from x to y.");
      return this.tidy("backward", () => {
        let i = {};
        i[o.id] = n ?? ZYe(o.shape), VYe(i, s, (u2) => this.tidy(u2), QYe);
        let l = r.map((u2) => i[u2.id]);
        return this.state.gradientDepth === 0 && (this.state.activeTape.forEach((u2) => {
          for (let c of u2.saved) c.dispose();
        }), this.state.activeTape = null), { value: o, grads: l };
      });
    }
    customGrad(t) {
      return zr(VX(t), () => "The f passed in customGrad(f) must be a function."), (...r) => {
        zr(r.every((i) => i instanceof Xc), () => "The args passed in customGrad(f)(x1, x2,...) must all be tensors");
        let n, a = {};
        r.forEach((i, l) => {
          a[l] = i;
        });
        let o = (i, l) => (n = t(...r, l), zr(n.value instanceof Xc, () => "The function f passed in customGrad(f) must return an object where `obj.value` is a tensor"), zr(VX(n.gradFunc), () => "The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function."), n.value), s = (i, l) => {
          let u2 = n.gradFunc(i, l), c = Array.isArray(u2) ? u2 : [u2];
          zr(c.length === r.length, () => "The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns the same number of tensors as inputs passed to f(...)."), zr(c.every((h) => h instanceof Xc), () => "The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns a list of only tensors.");
          let f = {};
          return c.forEach((h, p) => {
            f[p] = () => h;
          }), f;
        };
        return this.runKernelFunc({ forwardFunc: o, backwardsFunc: s, inputs: a });
      };
    }
    readSync(t) {
      return this.state.tensorInfo.get(t).backend.readSync(t);
    }
    read(t) {
      return this.state.tensorInfo.get(t).backend.read(t);
    }
    readToGPU(t, r) {
      return this.state.tensorInfo.get(t).backend.readToGPU(t, r);
    }
    async time(t) {
      let r = GT(), n = await this.backend.time(t);
      return n.wallMs = GT() - r, n;
    }
    track(t) {
      return this.state.activeScope != null && (t.scopeId = this.state.activeScope.id, this.state.activeScope.track.push(t)), t;
    }
    get registeredVariables() {
      return this.state.registeredVariables;
    }
    reset() {
      this.pendingBackendInitId++, this.state.dispose(), this.ENV.reset(), this.state = new $T();
      for (let t in this.registry) this.disposeRegisteredKernels(t), this.registry[t].dispose(), delete this.registry[t];
      this.backendName = null, this.backendInstance = null, this.pendingBackendInit = null;
    }
  };
  jv.nextTensorId = 0;
  jv.nextVariableId = 0;
  function ZYe(e) {
    let t = qY(Uh(e), "float32");
    return on.makeTensor(t, e, "float32");
  }
  function JYe() {
    let e = ZY();
    if (e._tfengine == null) {
      let t = new Y6(e);
      e._tfengine = new jv(t);
    }
    return NYe(e._tfengine.ENV), $Ye(() => e._tfengine), e._tfengine;
  }
  var on = JYe();
  function QYe(e, t) {
    let r = { a: e, b: t };
    return on.runKernel(hI, r);
  }
  function JT(e, t) {
    let r = e;
    if (Yd(e)) return t === "string" ? [] : [e.length];
    if (!Array.isArray(e)) return [];
    let n = [];
    for (; Array.isArray(r) || Yd(r) && t !== "string"; ) n.push(r.length), r = r[0];
    return Array.isArray(e) && ph().getBool("TENSORLIKE_CHECK_SHAPE_CONSISTENCY") && nZ(e, n, []), n;
  }
  function nZ(e, t, r) {
    if (r = r || [], !Array.isArray(e) && !Yd(e)) {
      zr(t.length === 0, () => `Element arr[${r.join("][")}] is a primitive, but should be an array/TypedArray of ${t[0]} elements`);
      return;
    }
    zr(t.length > 0, () => `Element arr[${r.join("][")}] should be a primitive, but is an array of ${e.length} elements`), zr(e.length === t[0], () => `Element arr[${r.join("][")}] should have ${t[0]} elements, but has ${e.length} elements`);
    let n = t.slice(1);
    for (let a = 0; a < e.length; ++a) nZ(e[a], n, r.concat(a));
  }
  function YX(e, t, r, n) {
    if (e !== "string_or_numeric") {
      if (e == null) throw new Error("Expected dtype cannot be null.");
      if (e !== "numeric" && e !== t || e === "numeric" && t === "string") throw new Error(`Argument '${r}' passed to '${n}' must be ${e} tensor, but got ${t} tensor`);
    }
  }
  function br(e, t, r, n = "numeric") {
    if (e instanceof Xc) return YX(n, e.dtype, t, r), e;
    let a = gI(e);
    if (a !== "string" && ["bool", "int32", "float32"].indexOf(n) >= 0 && (a = n), YX(n, a, t, r), e == null || !Yd(e) && !Array.isArray(e) && typeof e != "number" && typeof e != "boolean" && typeof e != "string") {
      let l = e == null ? "null" : e.constructor.name;
      throw new Error(`Argument '${t}' passed to '${r}' must be a Tensor or TensorLike, but got '${l}'`);
    }
    let o = JT(e, a);
    !Yd(e) && !Array.isArray(e) && (e = [e]);
    let i = a !== "string" ? QY(e, a) : ZT(e, [], true);
    return on.makeTensor(i, o, a);
  }
  function HT(e, t, r, n = "numeric") {
    if (!Array.isArray(e)) throw new Error(`Argument ${t} passed to ${r} must be a \`Tensor[]\` or \`TensorLike[]\``);
    return e.map((o, s) => br(o, `${t}[${s}]`, r, n));
  }
  var eZe = "__op";
  function Gr(e) {
    let t = Object.keys(e);
    if (t.length !== 1) throw new Error(`Please provide an object with a single key (operation name) mapping to a function. Got an object with ${t.length} keys.`);
    let r = t[0], n = e[r];
    r.endsWith("_") && (r = r.substring(0, r.length - 1)), r = r + eZe;
    let a = (...o) => {
      on.startScope(r);
      try {
        let s = n(...o);
        return KY(s) && console.error("Cannot return a Promise inside of tidy."), on.endScope(s), s;
      } catch (s) {
        throw on.endScope(null), s;
      }
    };
    return Object.defineProperty(a, "name", { value: r, configurable: true }), a;
  }
  function tZe(e, t) {
    let r = br(e, "x", "cast");
    if (!AYe(t)) throw new Error(`Failed to cast to unknown dtype ${t}`);
    if (t === "string" && r.dtype !== "string" || t !== "string" && r.dtype === "string") throw new Error("Only strings can be casted to strings");
    let n = { x: r }, a = { dtype: t };
    return on.runKernel(pI, n, a);
  }
  var Ii = Gr({ cast_: tZe });
  function rZe(e, t) {
    let r = br(e, "a", "mul"), n = br(t, "b", "mul");
    [r, n] = lu(r, n);
    let a = { a: r, b: n };
    return on.runKernel(oY, a);
  }
  var ua = Gr({ mul_: rZe });
  function nZe(e, t = 0) {
    let n = { x: br(e, "x", "step") }, a = { alpha: t };
    return on.runKernel(GY, n, a);
  }
  var f_ = Gr({ step_: nZe });
  var aZ = { kernelName: oK, inputsToSave: ["x"], gradFunc: (e, t) => {
    let [r] = t;
    return { x: () => ua(e, f_(Ii(r, "float32"), -1)) };
  } };
  function aZe(e, t) {
    let r = br(e, "a", "floorDiv"), n = br(t, "b", "floorDiv");
    [r, n] = lu(r, n);
    let a = { a: r, b: n };
    return on.runKernel(UK, a);
  }
  var iZ = Gr({ floorDiv_: aZe });
  function iZe(e, t) {
    let r = br(e, "a", "div"), n = br(t, "b", "div");
    if ([r, n] = lu(r, n), r.dtype === "int32" && n.dtype === "int32") return iZ(r, n);
    let a = { a: r, b: n }, o = {};
    return on.runKernel(FK, a, o);
  }
  var Go = Gr({ div_: iZe });
  function oZe(e) {
    let r = { x: br(e, "x", "neg") };
    return on.runKernel(sY, r);
  }
  var pc = Gr({ neg_: oZe });
  function QT(e, t, r, n) {
    if (n == null && (n = gI(e)), n === "complex64") throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");
    if (!Yd(e) && !Array.isArray(e) && typeof e != "number" && typeof e != "boolean" && typeof e != "string") throw new Error("values passed to tensor(values) must be a number/boolean/string or an array of numbers/booleans/strings, or a TypedArray");
    if (t != null) {
      XY(t);
      let a = Uh(t), o = Uh(r);
      zr(a === o, () => `Based on the provided shape, [${t}], the tensor should have ${a} values but has ${o}`);
      for (let s = 0; s < r.length; ++s) {
        let i = r[s], l = s === r.length - 1 ? i !== Uh(t.slice(s)) : true;
        zr(r[s] === t[s] || !l, () => `Error creating a new Tensor. Inferred shape (${r}) does not match the provided shape (${t}). `);
      }
    }
    return !Yd(e) && !Array.isArray(e) && (e = [e]), t = t || r, e = n !== "string" ? QY(e, n) : ZT(e, [], true), on.makeTensor(e, t, n);
  }
  function Ro(e, t) {
    if ((Yd(e) && t !== "string" || Array.isArray(e)) && t !== "complex64") throw new Error("Error creating a new Scalar: value must be a primitive (number|boolean|string)");
    if (t === "string" && Yd(e) && !(e instanceof Uint8Array)) throw new Error("When making a scalar from encoded string, the value must be `Uint8Array`.");
    return QT(e, [], [], t);
  }
  function sZe(e) {
    let r = { x: br(e, "x", "sqrt", "float32") };
    return on.runKernel(IY, r);
  }
  var Wv = Gr({ sqrt_: sZe });
  function lZe(e) {
    let t = br(e, "x", "square"), r = {};
    return on.runKernel("Square", { x: t }, r);
  }
  var Xu = Gr({ square_: lZe });
  function uZe(e, t) {
    let r = br(e, "a", "sub"), n = br(t, "b", "sub");
    [r, n] = lu(r, n);
    let a = { a: r, b: n };
    return on.runKernel(RY, a);
  }
  var Ji = Gr({ sub_: uZe });
  var cZe = { kernelName: sK, inputsToSave: ["x"], gradFunc: (e, t) => {
    let [r] = t;
    return { x: () => {
      let n = Xu(Ii(r, "float32")), a = Wv(Ji(Ro(1), n));
      return pc(Go(e, a));
    } };
  } };
  var fZe = { kernelName: lK, inputsToSave: ["x"], gradFunc: (e, t) => {
    let [r] = t;
    return { x: () => {
      let n = Wv(Ji(Xu(Ii(r, "float32")), 1));
      return Go(e, n);
    } };
  } };
  function dc(e, t) {
    let r = [];
    for (let n = 0; n < t.length; n++) {
      let a = e[e.length - n - 1], o = t.length - n - 1, s = t[o];
      (a == null || a === 1 && s > 1) && r.unshift(o);
    }
    return r;
  }
  function kl(e, t) {
    let r = [], n = Math.max(e.length, t.length);
    for (let a = 0; a < n; a++) {
      let o = e[e.length - a - 1];
      o == null && (o = 1);
      let s = t[t.length - a - 1];
      if (s == null && (s = 1), o === 1) r.unshift(s);
      else if (s === 1) r.unshift(o);
      else if (o !== s) {
        let i = `Operands could not be broadcast together with shapes ${e} and ${t}.`;
        throw Error(i);
      } else r.unshift(o);
    }
    return r;
  }
  function hZe(e, t) {
    let n = { x: br(e, "x", "reshape", "string_or_numeric") }, a = { shape: t };
    return on.runKernel(mY, n, a);
  }
  var Cn = Gr({ reshape_: hZe });
  function pZe(e, t = null, r = false) {
    let n = br(e, "x", "sum");
    n.dtype === "bool" && (n = Ii(n, "int32"));
    let a = { x: n }, o = { axis: t, keepDims: r };
    return on.runKernel(NY, a, o);
  }
  var Gi = Gr({ sum_: pZe });
  var dZe = { kernelName: hI, inputsToSave: ["a", "b"], gradFunc: (e, t) => {
    let [r, n] = t, a = kl(r.shape, n.shape);
    return { a: () => {
      let i = e, l = dc(r.shape, a);
      return l.length > 0 && (i = Gi(i, l)), Cn(i, r.shape);
    }, b: () => {
      let i = e, l = dc(n.shape, a);
      return l.length > 0 && (i = Gi(i, l)), Cn(i, n.shape);
    } };
  } };
  var vZe = { kernelName: uK, saveAllInputs: true, gradFunc: (e, t) => {
    let r = {};
    return t.forEach((n, a) => {
      r[a] = () => e.clone();
    }), r;
  } };
  function mZe(e) {
    let r = { x: br(e, "x", "zerosLike") };
    return on.runKernel(WY, r);
  }
  var Wl = Gr({ zerosLike_: mZe });
  var gZe = { kernelName: cK, inputsToSave: ["x"], gradFunc: (e, t) => {
    let [r] = t;
    return { x: () => Wl(r) };
  } };
  var yZe = { kernelName: fK, inputsToSave: ["x"], gradFunc: (e, t) => {
    let [r] = t;
    return { x: () => Wl(r) };
  } };
  var xZe = { kernelName: hK, inputsToSave: ["x"], gradFunc: (e, t) => {
    let [r] = t;
    return { x: () => Go(e, Wv(Ji(Ro(1), Xu(Ii(r, "float32"))))) };
  } };
  function bZe(e, t) {
    let r = br(e, "a", "add"), n = br(t, "b", "add");
    [r, n] = lu(r, n);
    let a = { a: r, b: n };
    return on.runKernel(hI, a);
  }
  var Ls = Gr({ add_: bZe });
  var _Ze = { kernelName: pK, inputsToSave: ["x"], gradFunc: (e, t) => {
    let [r] = t;
    return { x: () => {
      let n = Wv(Ls(Ro(1), Xu(Ii(r, "float32"))));
      return Go(e, n);
    } };
  } };
  var wZe = { kernelName: mK, inputsToSave: ["a", "b"], gradFunc: (e, t) => {
    let [r, n] = t, a = kl(r.shape, n.shape);
    return { a: () => {
      let i = Ls(Xu(r), Xu(n)), l = ua(e, Go(n, i)), u2 = dc(r.shape, a);
      return u2.length > 0 && (l = Gi(l, u2)), Cn(l, r.shape);
    }, b: () => {
      let i = Ls(Xu(r), Xu(n)), l = pc(ua(e, Go(r, i))), u2 = dc(n.shape, a);
      return u2.length > 0 && (l = Gi(l, u2)), Cn(l, n.shape);
    } };
  } };
  var kZe = { kernelName: dK, inputsToSave: ["x"], gradFunc: (e, t) => {
    let [r] = t;
    return { x: () => Go(e, Ls(Xu(Ii(r, "float32")), 1)) };
  } };
  var TZe = { kernelName: vK, inputsToSave: ["x"], gradFunc: (e, t) => {
    let [r] = t;
    return { x: () => Go(e, Ji(Ro(1), Xu(Ii(r, "float32")))) };
  } };
  function AZe(e, t, r, n, a, o, s = "channelsLast") {
    let [i, l] = qT(t), u2;
    if (s === "channelsLast") u2 = [i, l, e[3], e[3]];
    else if (s === "channelsFirst") u2 = [i, l, e[1], e[1]];
    else throw new Error(`Unknown dataFormat ${s}`);
    return wI(e, u2, r, n, a, o, false, s);
  }
  function wI(e, t, r, n, a, o, s = false, i = "channelsLast") {
    let [l, u2, c, f] = [-1, -1, -1, -1];
    if (i === "channelsLast") [l, u2, c, f] = e;
    else if (i === "channelsFirst") [l, f, u2, c] = e;
    else throw new Error(`Unknown dataFormat ${i}`);
    let [h, p, , d] = t, [v, m] = qT(r), [g, x] = qT(n), b = iI(h, g), y = iI(p, x), { padInfo: w, outHeight: _4, outWidth: k } = DZe(a, u2, c, v, m, b, y, o, i), T2 = s ? d * f : d, A2;
    return i === "channelsFirst" ? A2 = [l, T2, _4, k] : i === "channelsLast" && (A2 = [l, _4, k, T2]), { batchSize: l, dataFormat: i, inHeight: u2, inWidth: c, inChannels: f, outHeight: _4, outWidth: k, outChannels: T2, padInfo: w, strideHeight: v, strideWidth: m, filterHeight: h, filterWidth: p, effectiveFilterHeight: b, effectiveFilterWidth: y, dilationHeight: g, dilationWidth: x, inShape: e, outShape: A2, filterShape: t };
  }
  function SZe(e, t, r, n, a) {
    n == null && (n = EZe(e, t, r));
    let o = e[0], s = e[1], i = XT((o - t + 2 * n) / r + 1, a), l = XT((s - t + 2 * n) / r + 1, a);
    return [i, l];
  }
  function EZe(e, t, r, n = 1) {
    let a = iI(t, n);
    return Math.floor((e[0] * (r - 1) - r + a) / 2);
  }
  function qT(e) {
    return typeof e == "number" ? [e, e, e] : e.length === 2 ? [e[0], e[1], 1] : e;
  }
  function iI(e, t) {
    return t <= 1 ? e : e + (e - 1) * (t - 1);
  }
  function DZe(e, t, r, n, a, o, s, i, l) {
    let u2, c, f;
    if (typeof e == "number") {
      u2 = { top: e, bottom: e, left: e, right: e, type: e === 0 ? "VALID" : "NUMBER" };
      let p = SZe([t, r], o, n, e, i);
      c = p[0], f = p[1];
    } else if (e === "same") {
      c = Math.ceil(t / n), f = Math.ceil(r / a);
      let h = Math.max(0, (c - 1) * n + o - t), p = Math.max(0, (f - 1) * a + s - r), d = Math.floor(h / 2), v = h - d, m = Math.floor(p / 2), g = p - m;
      u2 = { top: d, bottom: v, left: m, right: g, type: "SAME" };
    } else if (e === "valid") u2 = { top: 0, bottom: 0, left: 0, right: 0, type: "VALID" }, c = Math.ceil((t - o + 1) / n), f = Math.ceil((r - s + 1) / a);
    else if (typeof e == "object") {
      let h = l === "channelsLast" ? e[1][0] : e[2][0], p = l === "channelsLast" ? e[1][1] : e[2][1], d = l === "channelsLast" ? e[2][0] : e[3][0], v = l === "channelsLast" ? e[2][1] : e[3][1];
      u2 = { top: h, bottom: p, left: d, right: v, type: h === 0 && p === 0 && d === 0 && v === 0 ? "VALID" : "EXPLICIT" }, c = XT((t - o + h + p) / n + 1, i), f = XT((r - s + d + v) / a + 1, i);
    } else throw Error(`Unknown padding parameter: ${e}`);
    return { padInfo: u2, outHeight: c, outWidth: f };
  }
  function XT(e, t) {
    if (!t) return Math.trunc(e);
    switch (t) {
      case "round":
        return Math.round(e);
      case "ceil":
        return Math.ceil(e);
      case "floor":
        return Math.floor(e);
      default:
        throw new Error(`Unknown roundingMode ${t}`);
    }
  }
  function Og(e) {
    let [t, r, n] = qT(e);
    return t === 1 && r === 1 && n === 1;
  }
  function N0(e, t) {
    return Og(e) || Og(t);
  }
  function jf(e, t, r) {
    if (r != null) {
      if (typeof t == "string") throw Error(`Error in ${e}: pad must be an integer when using dimRoundingMode ${r} but got pad ${t}.`);
      if (typeof t == "number") zr(s_(t), () => `Error in ${e}: pad must be an integer when using dimRoundingMode ${r} but got pad ${t}.`);
      else if (typeof t == "object") t.forEach((n) => {
        n.forEach((a) => {
          zr(s_(a), () => `Error in ${e}: pad must be an integer when using dimRoundingMode ${r} but got pad ${a}.`);
        });
      });
      else throw Error(`Error in ${e}: Unknown padding parameter: ${t}`);
    }
  }
  function CZe(e, t, r, n, a, o) {
    let s = br(e, "dy", "avgPool3dGrad"), i = br(t, "input", "avgPool3dGrad"), l = s, u2 = i, c = false;
    i.rank === 4 && (c = true, l = Cn(s, [1, s.shape[0], s.shape[1], s.shape[2], s.shape[3]]), u2 = Cn(i, [1, i.shape[0], i.shape[1], i.shape[2], i.shape[3]])), zr(l.rank === 5, () => `Error in avgPool3dGrad: dy must be rank 5 but got rank ${l.rank}.`), zr(u2.rank === 5, () => `Error in avgPool3dGrad: input must be rank 5 but got rank ${u2.rank}.`), jf("avgPool3dGrad", a, o);
    let f = { dy: l, input: u2 }, h = { filterSize: r, strides: n, pad: a, dimRoundingMode: o }, p = on.runKernel(pKe, f, h);
    return c ? Cn(p, [p.shape[1], p.shape[2], p.shape[3], p.shape[4]]) : p;
  }
  var MZe = Gr({ avgPool3dGrad_: CZe });
  var IZe = { kernelName: yK, inputsToSave: ["x"], gradFunc: (e, t, r) => {
    let [n] = t, { filterSize: a, strides: o, pad: s, dimRoundingMode: i } = r;
    return { x: () => MZe(e, n, a, o, s, i) };
  } };
  function NZe(e, t, r, n, a) {
    let o = br(e, "dy", "avgPoolGrad"), s = br(t, "input", "avgPoolGrad");
    zr(s.rank === o.rank, () => `Rank of input (${s.rank}) does not match rank of dy (${o.rank})`);
    let i = s, l = o, u2 = false;
    s.rank === 3 && (u2 = true, i = Cn(s, [1, s.shape[0], s.shape[1], s.shape[2]]), l = Cn(o, [1, o.shape[0], o.shape[1], o.shape[2]])), zr(l.rank === 4, () => `Error in avgPoolGrad: dy must be rank 4 but got rank ${l.rank}.`), zr(i.rank === 4, () => `Error in avgPoolGrad: input must be rank 4 but got rank ${i.rank}.`);
    let c = { dy: l, input: i }, f = { filterSize: r, strides: n, pad: a }, h = on.runKernel(hKe, c, f);
    return u2 ? Cn(h, [h.shape[1], h.shape[2], h.shape[3]]) : h;
  }
  var FZe = Gr({ avgPoolGrad_: NZe });
  var OZe = { kernelName: gK, inputsToSave: ["x"], gradFunc: (e, t, r) => {
    let [n] = t, { filterSize: a, strides: o, pad: s } = r;
    return { x: () => FZe(e, n, a, o, s) };
  } };
  function PZe(e, t, r = false, n = false) {
    let a = br(e, "a", "matMul"), o = br(t, "b", "matMul");
    [a, o] = lu(a, o);
    let s = { a, b: o }, i = { transposeA: r, transposeB: n };
    return on.runKernel(xK, s, i);
  }
  var es = Gr({ matMul_: PZe });
  var LZe = { kernelName: xK, inputsToSave: ["a", "b"], gradFunc: (e, t, r) => {
    let [n, a] = t, { transposeA: o, transposeB: s } = r;
    return !o && !s ? { a: () => es(e, a, false, true), b: () => es(n, e, true, false) } : !o && s ? { a: () => es(e, a, false, false), b: () => es(e, n, true, false) } : o && !s ? { a: () => es(a, e, false, true), b: () => es(n, e, false, false) } : { a: () => es(a, e, true, true), b: () => es(e, n, true, true) };
  } };
  function RZe(e, t, r) {
    let n = br(e, "x", "spaceToBatchND");
    zr(n.rank >= 1 + t.length, () => `input rank ${n.rank} should be > than [blockShape] ${t.length}`), zr(r.length === t.length, () => `paddings.shape[0] ${r.length} must be equal to [blockShape] ${t.length}`), zr(n.shape.reduce((s, i, l) => l > 0 && l <= t.length ? s && (i + r[l - 1][0] + r[l - 1][1]) % t[l - 1] === 0 : s, true), () => `input spatial dimensions ${n.shape.slice(1)} with paddings ${r.toString()} must be divisible by blockShapes ${t.toString()}`);
    let a = { x: n }, o = { blockShape: t, paddings: r };
    return on.runKernel(FY, a, o);
  }
  var kI = Gr({ spaceToBatchND_: RZe });
  var zZe = { kernelName: bK, gradFunc: (e, t, r) => {
    let { blockShape: n, crops: a } = r;
    return { x: () => kI(e, n, a) };
  } };
  var BZe = { kernelName: vKe, gradFunc: (e, t, r) => {
    let n = r, a = n.inputShape, o = n.shape, s = Array.from(o);
    for (let l = a.length - 1; l >= 0; l--) if (a[l] === o[l]) s[l] = 1;
    else if (a[l] !== 1) throw new Error(`broadcastTo(): [${a}] cannot be broadcast to [${o}].`);
    let i = [];
    for (let l = 0; l < s.length; l++) s[l] > 1 && i.push(l);
    return { x: () => Gi(e, i, true) };
  } };
  var UZe = { kernelName: pI, gradFunc: (e) => ({ x: () => e.clone() }) };
  var VZe = { kernelName: _K, gradFunc: (e) => ({ x: () => Wl(e) }) };
  function jZe(e, t) {
    let r = br(e, "a", "greaterEqual", "string_or_numeric"), n = br(t, "b", "greaterEqual", "string_or_numeric");
    [r, n] = lu(r, n), kl(r.shape, n.shape);
    let a = { a: r, b: n };
    return on.runKernel(WK, a);
  }
  var h_ = Gr({ greaterEqual_: jZe });
  function WZe(e, t) {
    let r = br(e, "a", "lessEqual", "string_or_numeric"), n = br(t, "b", "lessEqual", "string_or_numeric");
    [r, n] = lu(r, n), kl(r.shape, n.shape);
    let a = { a: r, b: n };
    return on.runKernel(UKe, a);
  }
  var fx = Gr({ lessEqual_: WZe });
  function GZe(e, t) {
    let r = br(e, "a", "logicalAnd", "bool"), n = br(t, "b", "logicalAnd", "bool");
    kl(r.shape, n.shape);
    let a = { a: r, b: n };
    return on.runKernel(VKe, a);
  }
  var ax = Gr({ logicalAnd_: GZe });
  function $Ze(e) {
    let r = { x: br(e, "x", "clone", "string_or_numeric") };
    return on.runKernel(dI, r);
  }
  var o_ = Gr({ clone_: $Ze });
  function HZe(e, t) {
    let r = br(e, "broadcastTo", "x"), n = r.shape;
    if (t.some((u2) => !(u2 > 0) || u2 % 1 !== 0)) throw new Error(`broadcastTo(): Invalid broadcast shape [${t}].`);
    if (t.length < r.rank) throw new Error(`broadcastTo(): shape.length=${t.length} < input.rank=${r.rank}.`);
    if (t.length > r.rank) {
      let u2 = r.shape.slice();
      for (; u2.length < t.length; ) u2.unshift(1);
      r = Cn(r, u2);
    }
    let a = r.shape, o = Array.from(t);
    for (let u2 = t.length - 1; u2 >= 0; u2--) if (a[u2] === t[u2]) o[u2] = 1;
    else if (r.shape[u2] !== 1) throw new Error(`broadcastTo(): [${n}] cannot be broadcast to [${t}].`);
    if (o.map((u2, c) => u2 > 1 ? c : -1).filter((u2) => u2 >= 0).length === 0) return o_(r);
    let i = { x: r }, l = { reps: o };
    return on.runKernel(vI, i, l);
  }
  var jT = Gr({ broadcastTo_: HZe });
  function qZe(e, t, r) {
    let n = br(t, "a", "where"), a = br(r, "b", "where"), o = br(e, "condition", "where", "bool"), s = kl(kl(o.shape, n.shape), a.shape), i = jT(o, s), l = jT(n, s), u2 = jT(a, s), c = { condition: i, t: l, e: u2 };
    return on.runKernel(kY, c);
  }
  var Vh = Gr({ where_: qZe });
  var XZe = { kernelName: wK, inputsToSave: ["x"], gradFunc: (e, t, r) => {
    let [n] = t, { clipValueMin: a, clipValueMax: o } = r;
    return { x: () => Vh(ax(h_(n, a), fx(n, o)), e, Wl(e)) };
  } };
  var KZe = { kernelName: kK, inputsToSave: ["x"], gradFunc: aZ.gradFunc };
  function YZe(e, t, r = 0) {
    let a = { x: br(e, "x", "split") }, o = { numOrSizeSplits: t, axis: r };
    return on.runKernel(OY, a, o);
  }
  var ix = Gr({ split_: YZe });
  var ZZe = { kernelName: TK, saveAllInputs: true, gradFunc: (e, t, r) => {
    let n = t.map((l) => l.shape), { axis: a } = r, o = yd(a, t[0].shape)[0], s = n.map((l) => l[o]);
    return ix(e, s, o).map((l) => () => l);
  } };
  function JZe(e, t, r, n, a, o = "NHWC", s) {
    let i = e;
    e.rank === 3 && (i = Cn(e, [1, e.shape[0], e.shape[1], e.shape[2]]));
    let l = t;
    l.rank === 3 && (l = Cn(t, [1, t.shape[0], t.shape[1], t.shape[2]])), zr(i.rank === 4, () => `Error in conv2dDerFilter: input must be rank 4, but got shape ${i.shape}.`), zr(l.rank === 4, () => `Error in conv2dDerFilter: dy must be rank 4, but got shape ${l.shape}.`), zr(r.length === 4, () => `Error in conv2dDerFilter: filterShape must be length 4, but got ${r}.`);
    let u2 = o === "NHWC" ? i.shape[3] : i.shape[1], c = o === "NHWC" ? l.shape[3] : l.shape[1];
    zr(u2 === r[2], () => `Error in conv2dDerFilter: depth of input ${u2}) must match input depth in filter (${r[2]}.`), zr(c === r[3], () => `Error in conv2dDerFilter: depth of dy (${c}) must match output depth for filter (${r[3]}).`), jf("conv2dDerFilter", a, s);
    let f = { x: i, dy: l }, h = { strides: n, pad: a, dataFormat: o, dimRoundingMode: s, filterShape: r };
    return on.runKernel(yKe, f, h);
  }
  var TI = Gr({ conv2DBackpropFilter_: JZe });
  function QZe(e, t, r, n, a, o = "NHWC", s) {
    zr(e.length === t.rank, () => `Length of inShape (${e.length}) and rank of dy (${t.rank}) must match`);
    let i = e, l = t, u2 = false;
    t.rank === 3 && (u2 = true, l = Cn(t, [1, t.shape[0], t.shape[1], t.shape[2]]), i = [1, e[0], e[1], e[2]]), zr(i.length === 4, () => `Error in conv2dDerInput: inShape must be length 4, but got length ${i.length}.`), zr(l.rank === 4, () => `Error in conv2dDerInput: dy must be rank 4, but got rank ${l.rank}`), zr(r.rank === 4, () => `Error in conv2dDerInput: filter must be rank 4, but got rank ${r.rank}`);
    let c = o === "NHWC" ? i[3] : i[1], f = o === "NHWC" ? l.shape[3] : l.shape[1];
    zr(c === r.shape[2], () => `Error in conv2dDerInput: depth of input (${c}) must match input depth for filter ${r.shape[2]}.`), zr(f === r.shape[3], () => `Error in conv2dDerInput: depth of output (${f}) must match output depth for filter ${r.shape[3]}.`), jf("conv2dDerInput", a, s);
    let h = { dy: l, filter: r }, p = { strides: n, pad: a, dataFormat: o, dimRoundingMode: s, inputShape: i }, d = on.runKernel(SK, h, p);
    return u2 ? Cn(d, [d.shape[1], d.shape[2], d.shape[3]]) : d;
  }
  var AI = Gr({ conv2DBackpropInput_: QZe });
  var eJe = { kernelName: AK, inputsToSave: ["x", "filter"], gradFunc: (e, t, r) => {
    let [n, a] = t, { dilations: o, strides: s, pad: i, dataFormat: l } = r;
    return zr(Og(o), () => `Error in gradient of conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${o}'`), { x: () => AI(n.shape, e, a, s, i, l), filter: () => TI(n, e, a.shape, s, i, l) };
  } };
  function tJe(e, t, r, n, a = "NHWC", o = [1, 1], s) {
    let i = br(e, "x", "conv2d", "float32"), l = br(t, "filter", "conv2d", "float32"), u2 = i, c = false;
    i.rank === 3 && (c = true, u2 = Cn(i, [1, i.shape[0], i.shape[1], i.shape[2]])), zr(u2.rank === 4, () => `Error in conv2d: input must be rank 4, but got rank ${u2.rank}.`), zr(l.rank === 4, () => `Error in conv2d: filter must be rank 4, but got rank ${l.rank}.`), jf("conv2d", n, s);
    let f = a === "NHWC" ? u2.shape[3] : u2.shape[1];
    zr(f === l.shape[2], () => `Error in conv2d: depth of input (${f}) must match input depth for filter ${l.shape[2]}.`), zr(N0(r, o), () => `Error in conv2D: Either strides or dilations must be 1. Got strides ${r} and dilations '${o}'`);
    let h = { x: u2, filter: l }, p = { strides: r, pad: n, dataFormat: a, dilations: o, dimRoundingMode: s }, d = on.runKernel(AK, h, p);
    return c ? Cn(d, [d.shape[1], d.shape[2], d.shape[3]]) : d;
  }
  var p_ = Gr({ conv2d_: tJe });
  var rJe = { kernelName: SK, inputsToSave: ["dy", "filter"], gradFunc: (e, t, r) => {
    let [n, a] = t, { strides: o, pad: s, dataFormat: i, dimRoundingMode: l } = r;
    return { dy: () => p_(e, a, o, s, i, 1, l), filter: () => TI(e, n, a.shape, o, s, i, l) };
  } };
  function nJe(e, t, r, n, a) {
    let o = e;
    e.rank === 4 && (o = Cn(e, [1, e.shape[0], e.shape[1], e.shape[2], e.shape[3]]));
    let s = t;
    s.rank === 4 && (s = Cn(t, [1, t.shape[0], t.shape[1], t.shape[2], t.shape[3]])), zr(o.rank === 5, () => `Error in conv3dDerFilter: input must be rank 5, but got shape ${o.shape}.`), zr(s.rank === 5, () => `Error in conv3dDerFilter: dy must be rank 5, but got shape ${s.shape}.`), zr(r.length === 5, () => `Error in conv3dDerFilter: filterShape must be length 5, but got ${r}.`), zr(o.shape[4] === r[3], () => `Error in conv3dDerFilter: depth of input ${o.shape[4]}) must match input depth in filter (${r[3]}.`), zr(s.shape[4] === r[4], () => `Error in conv3dDerFilter: depth of dy (${s.shape[4]}) must match output depth for filter (${r[4]}).`);
    let i = { x: o, dy: s }, l = { strides: n, pad: a, filterShape: r };
    return on.runKernel(xKe, i, l);
  }
  var aJe = Gr({ conv3DBackpropFilter_: nJe });
  function iJe(e, t, r, n, a) {
    zr(e.length === t.rank, () => `Length of inShape (${e.length}) and rank of dy (${t.rank}) must match`);
    let o = e, s = t, i = false;
    t.rank === 4 && (i = true, s = Cn(t, [1, t.shape[0], t.shape[1], t.shape[2], t.shape[3]]), o = [1, e[0], e[1], e[2], e[3]]);
    let l = o[4], u2 = s.shape[4];
    zr(o.length === 5, () => `Error in conv3dDerInput: inShape must be length 5, but got length ${o.length}.`), zr(s.rank === 5, () => `Error in conv3dDerInput: dy must be rank 5, but got rank ${s.rank}`), zr(r.rank === 5, () => `Error in conv3dDerInput: filter must be rank 5, but got rank ${r.rank}`), zr(l === r.shape[3], () => `Error in conv3dDerInput: depth of input (${l}) must match input depth for filter ${r.shape[3]}.`), zr(u2 === r.shape[4], () => `Error in conv3dDerInput: depth of output (${u2}) must match output depth for filter ${r.shape[4]}.`);
    let c = { dy: s, filter: r }, f = { pad: a, strides: n, inputShape: o }, h = on.runKernel(bKe, c, f);
    return i ? Cn(h, [h.shape[1], h.shape[2], h.shape[3], h.shape[4]]) : h;
  }
  var oZ = Gr({ conv3DBackpropInput_: iJe });
  var oJe = { kernelName: EK, inputsToSave: ["x", "filter"], gradFunc: (e, t, r) => {
    let { dilations: n, strides: a, pad: o } = r;
    zr(Og(n), () => `Error in gradient of conv3D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${n}'`);
    let [s, i] = t;
    return { x: () => oZ(s.shape, e, i, a, o), filter: () => aJe(s, e, i.shape, a, o) };
  } };
  function sJe(e) {
    let r = { x: br(e, "x", "sin", "float32") };
    return on.runKernel(SY, r);
  }
  var sZ = Gr({ sin_: sJe });
  var lJe = { kernelName: DK, inputsToSave: ["x"], gradFunc: (e, t) => {
    let [r] = t;
    return { x: () => ua(pc(sZ(Ii(r, "float32"))), e) };
  } };
  function uJe(e) {
    let r = { x: br(e, "x", "sinh") };
    return on.runKernel(EY, r);
  }
  var lZ = Gr({ sinh_: uJe });
  var cJe = { kernelName: CK, inputsToSave: ["x"], gradFunc: (e, t) => {
    let [r] = t;
    return { x: () => ua(lZ(Ii(r, "float32")), e) };
  } };
  function fJe(e, t) {
    for (let r = 0; r < e.length; ++r) if (e[e.length - r - 1] !== t - 1 - r) return false;
    return true;
  }
  function hJe(e, t, r) {
    let n = e.length + t.length, a = [], o = 0, s = 0;
    for (let i = 0; i < n; i++) r.indexOf(i) === -1 ? a.push(e[o++]) : a.push(t[s++]);
    return a;
  }
  function pJe(e, t) {
    let r = [], n = e.length;
    for (let o = 0; o < n; o++) t.indexOf(o) === -1 && r.push(e[o]);
    let a = t.map((o) => e[o]);
    return [r, a];
  }
  function ox(e, t) {
    let r = t.map((n) => 1);
    return hJe(e, r, t);
  }
  function dJe(e, t) {
    if (fJe(e, t)) return null;
    let r = [];
    for (let n = 0; n < t; ++n) e.indexOf(n) === -1 && r.push(n);
    return e.forEach((n) => r.push(n)), r;
  }
  function uZ(e) {
    return e.map((t, r) => [r, t]).sort((t, r) => t[1] - r[1]).map((t) => t[0]);
  }
  function vJe(e, t = 0, r = false, n = false) {
    let o = { x: br(e, "x", "cumsum") }, s = { axis: t, exclusive: r, reverse: n };
    return on.runKernel(MK, o, s);
  }
  var cZ = Gr({ cumsum_: vJe });
  function mJe(e, t) {
    let r = br(e, "x", "transpose");
    if (t == null && (t = r.shape.map((o, s) => s).reverse()), zr(r.rank === t.length, () => `Error in transpose: rank of input ${r.rank} must match length of perm ${t}.`), t.forEach((o) => {
      zr(o >= 0 && o < r.rank, () => `All entries in 'perm' must be between 0 and ${r.rank - 1} but got ${t}`);
    }), r.rank <= 1) return r.clone();
    let n = { x: r }, a = { perm: t };
    return on.runKernel(UY, n, a);
  }
  var Pg = Gr({ transpose_: mJe });
  var gJe = { kernelName: MK, inputsToSave: ["x"], gradFunc: (e, t, r) => {
    let [n] = t, { axis: a, exclusive: o, reverse: s } = r;
    return { x: () => {
      let i = dJe([a], n.rank), l = cZ(e, a, o, !s);
      return i != null && (l = Pg(l, i)), l;
    } };
  } };
  function yJe(e, t, r, n, a, o = [1, 1], s) {
    let i = e;
    e.rank === 3 && (i = Cn(e, [1, e.shape[0], e.shape[1], e.shape[2]]));
    let l = t;
    l.rank === 3 && (l = Cn(t, [1, t.shape[0], t.shape[1], t.shape[2]]));
    let u2 = { x: i, dy: l }, c = { strides: n, pad: a, dimRoundingMode: s, dilations: o, filterShape: r };
    return on.runKernel(TKe, u2, c);
  }
  var fZ = Gr({ depthwiseConv2dNativeBackpropFilter_: yJe });
  function xJe(e, t, r, n, a, o = [1, 1], s) {
    let i = t, l = false;
    t.rank === 3 && (l = true, i = Cn(t, [1, t.shape[0], t.shape[1], t.shape[2]]));
    let u2 = { dy: i, filter: r }, c = { strides: n, pad: a, dimRoundingMode: s, dilations: o, inputShape: e }, f = on.runKernel(AKe, u2, c);
    return l ? Cn(f, [f.shape[1], f.shape[2], f.shape[3]]) : f;
  }
  var hZ = Gr({ depthwiseConv2dNativeBackpropInput_: xJe });
  var bJe = { kernelName: IK, inputsToSave: ["x", "filter"], gradFunc: (e, t, r) => {
    let { dilations: n, strides: a, pad: o, dimRoundingMode: s } = r, i = n ?? [1, 1];
    zr(Og(i), () => `Error in gradient of depthwiseConv2dNative: dilation rates greater than 1 are not yet supported. Got dilations '${i}'`);
    let [l, u2] = t;
    return zr(l.rank === 4, () => `Error in gradient of depthwiseConv2dNative: input must be rank 4, but got rank ${l.rank}.`), zr(u2.rank === 4, () => `Error in gradient of depthwiseConv2dNative: filter must be rank 4, but got rank ${u2.rank}.`), zr(l.shape[3] === u2.shape[2], () => `Error in gradient of depthwiseConv2d: number of input channels (${l.shape[3]}) must match the inChannels dimension in filter ${u2.shape[2]}.`), zr(N0(a, i), () => `Error in gradient of depthwiseConv2d: Either strides or dilations must be  1. Got strides ${a} and dilations '${i}'.`), jf("depthwiseConv2d", o, s), { x: () => hZ(l.shape, e, u2, a, o, i, s), filter: () => fZ(l, e, u2.shape, a, o, i, s) };
  } };
  var _Je = { kernelName: NK, inputsToSave: ["x", "filter"], gradFunc: (e, t, r) => {
    let [n, a] = t, o = { x: n, filter: a, dy: e }, s = { x: n, filter: a, dy: e };
    return { x: () => on.runKernel(EKe, o, r), filter: () => on.runKernel(DKe, s, r) };
  } };
  var wJe = { kernelName: OK, outputsToSave: [true], gradFunc: (e, t) => {
    let [r] = t, n = { dy: e, y: r };
    return { x: () => on.runKernel(MKe, n) };
  } };
  function kJe(e) {
    let r = { x: br(e, "x", "exp") };
    return on.runKernel(LK, r);
  }
  var gd = Gr({ exp_: kJe });
  var TJe = { kernelName: PK, inputsToSave: ["x"], gradFunc: (e, t) => {
    let [r] = t, n = ua(gd(pc(Xu(r))), 2 / Math.sqrt(Math.PI));
    return { x: () => ua(e, n) };
  } };
  var AJe = { kernelName: LK, outputsToSave: [true], gradFunc: (e, t) => {
    let [r] = t;
    return { x: () => ua(e, r) };
  } };
  var SJe = { kernelName: RK, inputsToSave: ["input"], gradFunc: (e, t) => {
    let [r] = t;
    return { input: () => Cn(e, r.shape) };
  } };
  var EJe = { kernelName: zK, inputsToSave: ["x"], gradFunc: (e, t) => {
    let [r] = t;
    return { x: () => ua(e, gd(r)) };
  } };
  var DJe = { kernelName: BK, gradFunc: (e) => ({ x: () => Wl(e) }) };
  var CJe = { kernelName: UK, inputsToSave: ["a", "b"], gradFunc: (e, t) => {
    let [r, n] = t, a = kl(r.shape, n.shape);
    return { a: () => {
      let i = Go(e, Ii(n, "float32")), l = dc(r.shape, a);
      return l.length > 0 ? Cn(Gi(i, l), r.shape) : i;
    }, b: () => {
      let i = ua(e, Ii(r, "float32")), l = dc(n.shape, a);
      l.length > 0 && (i = Cn(Gi(i, l), n.shape));
      let u2 = Xu(n);
      return pc(Go(i, Ii(u2, "float32")));
    } };
  } };
  function MJe(e) {
    let r = { x: br(e, "x", "rsqrt", "float32") };
    return on.runKernel(wY, r);
  }
  var pZ = Gr({ rsqrt_: MJe });
  function IJe(e, t) {
    let r = br(e, "x", "tile", "string_or_numeric");
    zr(r.rank === t.length, () => `Error in transpose: rank of input ${r.rank} must match length of reps ${t}.`);
    let n = { x: r }, a = { reps: t };
    return on.runKernel(vI, n, a);
  }
  var rx = Gr({ tile_: IJe });
  var NJe = { kernelName: VK, inputsToSave: ["x", "mean", "variance", "scale"], gradFunc: (e, t, r) => {
    let { varianceEpsilon: n } = r, [a, o, s, i] = t, l = i ?? Ro(1), u2 = dc(o.shape, a.shape), c = [];
    if (o.rank === 1) {
      for (let y = 0; y < a.shape.length - 1; ++y) c.push(a.shape[y]);
      c.push(1);
    }
    let f = Ji(a, o), h = ua(e, l), p = pZ(Ls(s, Ro(n))), d = ua(ua(ua(p, p), p), Ro(-0.5));
    return { x: () => o.rank === 1 ? Cn(ua(ua(e, rx(Cn(p, [1, 1, 1, o.shape[0]]), c)), l), a.shape) : Cn(ua(ua(e, p), l), a.shape), mean: () => {
      let y = ua(ua(p, Ro(-1)), h);
      return o.rank === 1 && (y = Gi(y, u2)), Cn(y, o.shape);
    }, variance: () => {
      let y = ua(ua(d, f), h);
      return o.rank === 1 && (y = Gi(y, u2)), Cn(y, o.shape);
    }, scale: () => {
      let y = ua(f, p), w = ua(e, y);
      return o.rank === 1 && (w = Gi(w, u2)), Cn(w, o.shape);
    }, offset: () => {
      let y = e;
      return o.rank === 1 && (y = Gi(y, u2)), Cn(y, o.shape);
    } };
  } };
  function FJe(e, t, r) {
    let n = br(e, "x", "unsortedSegmentSum"), a = br(t, "segmentIds", "unsortedSegmentSum", "int32");
    zr(s_(r), () => "numSegments must be of dtype int");
    let o = { x: n, segmentIds: a }, s = { numSegments: r };
    return on.runKernel(jY, o, s);
  }
  var dZ = Gr({ unsortedSegmentSum_: FJe });
  var OJe = { kernelName: jK, inputsToSave: ["x", "indices"], gradFunc: (e, t, r) => {
    let [n, a] = t, { axis: o } = r, s = yd(o, n.shape)[0];
    return { x: () => {
      let l = n.shape, u2 = a.size, c = l.slice(0, s), f = c.length, h = l.slice(o, l.length).slice(1), p = h.length, d = ZX(0, f), v = ZX(f + 1, f + 1 + p), m = JX([c, [u2], h]), g = Cn(e, m), x = Cn(a, [u2]), b = JX([[f], d, v]), y = Pg(g, b), w = dZ(y, x, n.shape[s]), _4 = uZ(b);
      return w = Pg(w, _4), w;
    }, indices: () => a };
  } };
  function ZX(e, t) {
    let r = [];
    for (let n = e; n < t; ++n) r.push(n);
    return r;
  }
  function JX(e) {
    let t = [];
    for (let r = 0; r < e.length; ++r) for (let n = 0; n < e[r].length; ++n) t.push(e[r][n]);
    return t;
  }
  var PJe = { kernelName: WK, inputsToSave: ["a", "b"], gradFunc: (e, t) => {
    let [r, n] = t;
    return { a: () => Wl(r), b: () => Wl(n) };
  } };
  var LJe = { kernelName: dI, gradFunc: (e) => ({ x: () => Ii(e, "float32") }) };
  var RJe = { kernelName: GK, gradFunc: (e) => ({ x: () => Wl(e) }) };
  var zJe = { kernelName: $K, gradFunc: (e) => ({ x: () => Wl(e) }) };
  var BJe = { kernelName: HK, gradFunc: (e) => ({ x: () => Wl(e) }) };
  function UJe(e, t) {
    let r = br(e, "a", "greater", "string_or_numeric"), n = br(t, "b", "greater", "string_or_numeric");
    [r, n] = lu(r, n), kl(r.shape, n.shape);
    let a = { a: r, b: n };
    return on.runKernel(LKe, a);
  }
  var F0 = Gr({ greater_: UJe });
  var VJe = { kernelName: qK, inputsToSave: ["x"], gradFunc: (e, t, r) => {
    let [n] = t, { alpha: a } = r, o = F0(n, 0);
    return { x: () => Vh(o, e, ua(e, a)) };
  } };
  var jJe = { kernelName: KK, inputsToSave: ["x"], gradFunc: (e, t) => {
    let [r] = t;
    return { x: () => Go(e, Ls(r, 1)) };
  } };
  var WJe = { kernelName: XK, inputsToSave: ["x"], gradFunc: (e, t) => {
    let [r] = t;
    return { x: () => Go(e, Ii(r, "float32")) };
  } };
  var GJe = { kernelName: GKe, inputsToSave: [], outputsToSave: [true], gradFunc: (e, t, r) => {
    let [n] = t, { axis: a } = r;
    return { logits: () => {
      let s = gd(n);
      return Ji(e, ua(Gi(e, a, true), s));
    } };
  } };
  function $Je(e, t, r, n = 5, a = 1, o = 1, s = 0.5) {
    let i = { x: e, y: t, dy: r }, l = { depthRadius: n, bias: a, alpha: o, beta: s };
    return on.runKernel($Ke, i, l);
  }
  var HJe = Gr({ localResponseNormalizationBackprop_: $Je });
  var qJe = { kernelName: YK, inputsToSave: ["x"], outputsToSave: [true], gradFunc: (e, t, r) => {
    let [n, a] = t, { depthRadius: o, bias: s, alpha: i, beta: l } = r;
    return { x: () => HJe(n, a, e, o, s, i, l) };
  } };
  function XJe(e, t) {
    let r = br(e, "a", "equal", "string_or_numeric"), n = br(t, "b", "equal", "string_or_numeric");
    [r, n] = lu(r, n), kl(r.shape, n.shape);
    let a = { a: r, b: n };
    return on.runKernel(IKe, a);
  }
  var SI = Gr({ equal_: XJe });
  function vZ(e, t, r, n) {
    return t.rank < r.rank && (t = Cn(t, ox(t.shape, n))), e.rank < r.rank && (e = Cn(e, ox(e.shape, n))), { x: () => ua(e, Ii(SI(r, t), e.dtype)) };
  }
  var QX = { kernelName: ZK, inputsToSave: ["x"], outputsToSave: [true], gradFunc: (e, t, r) => {
    let n = r, { reductionIndices: a } = n, o = t[0], s = t[1], i = yd(a, o.shape), l = vZ(e, s, o, i);
    return { x: () => l.x() };
  } };
  function KJe(e, t) {
    let r = br(e, "a", "less", "string_or_numeric"), n = br(t, "b", "less", "string_or_numeric");
    [r, n] = lu(r, n), kl(r.shape, n.shape);
    let a = { a: r, b: n };
    return on.runKernel(BKe, a);
  }
  var mZ = Gr({ less_: KJe });
  var YJe = { kernelName: JK, inputsToSave: ["a", "b"], gradFunc: (e, t) => {
    let [r, n] = t;
    return { a: () => ua(e, Ii(h_(r, n), "float32")), b: () => ua(e, Ii(mZ(r, n), "float32")) };
  } };
  function ZJe(e, t, r, n, a, o, s) {
    let i = br(e, "dy", "maxPool3dGrad"), l = br(t, "input", "maxPool3dGrad"), u2 = br(r, "output", "maxPool3dGrad"), c = i, f = l, h = u2, p = false;
    l.rank === 4 && (p = true, c = Cn(i, [1, i.shape[0], i.shape[1], i.shape[2], i.shape[3]]), f = Cn(l, [1, l.shape[0], l.shape[1], l.shape[2], l.shape[3]]), h = Cn(u2, [1, u2.shape[0], u2.shape[1], u2.shape[2], u2.shape[3]])), zr(c.rank === 5, () => `Error in maxPool3dGrad: dy must be rank 5 but got rank ${c.rank}.`), zr(f.rank === 5, () => `Error in maxPool3dGrad: input must be rank 5 but got rank ${f.rank}.`), zr(h.rank === 5, () => `Error in maxPool3dGrad: output must be rank 5 but got rank ${h.rank}.`), jf("maxPool3dGrad", o, s);
    let d = { dy: c, input: f, output: h }, v = { filterSize: n, strides: a, pad: o, dimRoundingMode: s }, m = on.runKernel(qKe, d, v);
    return p ? Cn(m, [m.shape[1], m.shape[2], m.shape[3], m.shape[4]]) : m;
  }
  var JJe = Gr({ maxPool3dGrad_: ZJe });
  var QJe = { kernelName: eY, inputsToSave: ["x"], outputsToSave: [true], gradFunc: (e, t, r) => {
    let [n, a] = t, { filterSize: o, strides: s, pad: i, dimRoundingMode: l } = r;
    return { x: () => JJe(e, n, a, o, s, i, l) };
  } };
  function eQe(e, t, r, n, a, o, s) {
    let i = br(e, "dy", "maxPoolGrad"), l = br(t, "input", "maxPoolGrad"), u2 = br(r, "output", "maxPoolGrad");
    zr(l.rank === i.rank, () => `Rank of input (${l.rank}) does not match rank of dy (${i.rank})`), zr(i.rank === 4, () => `Error in maxPoolGrad: dy must be rank 4 but got rank ${i.rank}.`), zr(l.rank === 4, () => `Error in maxPoolGrad: input must be rank 4 but got rank ${l.rank}.`), jf("maxPoolGrad", o, s);
    let c = { dy: i, input: l, output: u2 }, f = { filterSize: n, strides: a, pad: o, dimRoundingMode: s };
    return on.runKernel(HKe, c, f);
  }
  var tQe = Gr({ maxPoolGrad_: eQe });
  var rQe = { kernelName: QK, inputsToSave: ["x"], outputsToSave: [true], gradFunc: (e, t, r) => {
    let [n, a] = t, { filterSize: o, strides: s, pad: i } = r;
    return { x: () => tQe(e, n, a, o, s, i) };
  } };
  function nQe(e, t) {
    let r = br(e, "real", "complex"), n = br(t, "imag", "complex");
    Zd(r.shape, n.shape, `real and imag shapes, ${r.shape} and ${n.shape}, must match in call to tf.complex().`);
    let a = { real: r, imag: n };
    return on.runKernel(gKe, a);
  }
  var u_ = Gr({ complex_: nQe });
  function sx(e, t = "float32") {
    if (t === "complex64") {
      let n = sx(e, "float32"), a = sx(e, "float32");
      return u_(n, a);
    }
    let r = xI(Uh(e), t);
    return on.makeTensor(r, e, t);
  }
  function d_(e, t = "float32") {
    if (t === "complex64") {
      let n = d_(e, "float32"), a = sx(e, "float32");
      return u_(n, a);
    }
    let r = qY(Uh(e), t);
    return on.makeTensor(r, e, t);
  }
  var aQe = { kernelName: tY, inputsToSave: ["x"], gradFunc: (e, t, r) => {
    let [n] = t, { axis: a } = r, o = yd(a, n.shape), i = pJe(n.shape, o)[1], l = Uh(i);
    return { x: () => {
      let c = n.shape.slice();
      o.forEach((p) => {
        c[p] = 1;
      });
      let f = Cn(e, c);
      return Go(ua(f, d_(n.shape, "float32")), l);
    } };
  } };
  var iQe = { kernelName: rY, inputsToSave: ["x"], outputsToSave: [true], gradFunc: (e, t, r) => {
    let n = r, { axis: a } = n, [o, s] = t, i = yd(a, o.shape), l = vZ(e, s, o, i);
    return { x: () => l.x() };
  } };
  var oQe = { kernelName: nY, inputsToSave: ["a", "b"], gradFunc: (e, t) => {
    let [r, n] = t;
    return { a: () => ua(e, Ii(fx(r, n), "float32")), b: () => ua(e, Ii(F0(r, n), "float32")) };
  } };
  function sQe(e, t, r) {
    let n = br(e, "x", "slice", "string_or_numeric");
    if (n.rank === 0) throw new Error("Slicing scalar is not possible");
    let a = { x: n }, o = { begin: t, size: r };
    return on.runKernel(AY, a, o);
  }
  var ds = Gr({ slice_: sQe });
  var lQe = { kernelName: aY, inputsToSave: ["x"], gradFunc: (e, t, r) => {
    let n = t[0], { paddings: a } = r, o = a.map((s) => s[0]);
    return { x: () => ds(e, o, n.shape) };
  } };
  function uQe(e) {
    let r = { x: br(e, "x", "floor", "float32") };
    return on.runKernel(BK, r);
  }
  var EI = Gr({ floor_: uQe });
  var cQe = { kernelName: iY, inputsToSave: ["a", "b"], gradFunc: (e, t) => {
    let [r, n] = t, a = kl(r.shape, n.shape);
    return { a: () => {
      let i = dc(r.shape, a);
      return i.length > 0 ? Cn(Gi(e, i), r.shape) : e;
    }, b: () => {
      let i = ua(e, pc(EI(Go(r, n)))), l = dc(n.shape, a);
      return l.length > 0 ? Cn(Gi(i, l), n.shape) : i;
    } };
  } };
  var fQe = { kernelName: oY, inputsToSave: ["a", "b"], gradFunc: (e, t) => {
    let [r, n] = t, a = kl(r.shape, n.shape);
    return { a: () => {
      let i = ua(e, Ii(n, "float32")), l = dc(r.shape, a);
      return l.length > 0 ? Cn(Gi(i, l), r.shape) : i;
    }, b: () => {
      let i = ua(e, Ii(r, "float32")), l = dc(n.shape, a);
      return l.length > 0 ? Cn(Gi(i, l), n.shape) : i;
    } };
  } };
  var hQe = { kernelName: sY, gradFunc: (e) => ({ x: () => pc(e) }) };
  var pQe = { kernelName: uY, inputsToSave: ["indices"], gradFunc: (e, t) => {
    let r = t[0];
    return { indices: () => sx(r.shape, "float32") };
  } };
  var dQe = { kernelName: lY, gradFunc: (e) => ({ x: () => Wl(e) }) };
  function vQe(e, t = 0) {
    let r = br(e, "x", "unstack", "string_or_numeric");
    zr(t >= -r.shape.length && t < r.shape.length, () => `Axis = ${t} is not in [-${r.shape.length}, ${r.shape.length})`);
    let n = { value: r }, a = { axis: t };
    return on.runKernel(VY, n, a);
  }
  var eA = Gr({ unstack_: vQe });
  var mQe = { kernelName: cY, saveAllInputs: true, gradFunc: (e, t, r) => {
    let { axis: n } = r;
    return eA(e, n).map((o) => () => o);
  } };
  var eK = { kernelName: fY, inputsToSave: ["x"], gradFunc: (e, t, r) => {
    let n = t[0], { paddings: a } = r, o = a.map((s) => s[0]);
    return { x: () => ds(e, o, n.shape) };
  } };
  function gQe(e) {
    let r = { x: br(e, "x", "log", "float32") };
    return on.runKernel(XK, r);
  }
  var lx = Gr({ log_: gQe });
  function yQe(e, t) {
    let r = br(e, "base", "pow"), n = br(t, "exp", "pow");
    [r, n] = lu(r, n);
    let a = { a: r, b: n };
    return on.runKernel(hY, a);
  }
  var v_ = Gr({ pow_: yQe });
  var xQe = { kernelName: hY, inputsToSave: ["a", "b"], outputsToSave: [true], gradFunc: (e, t) => {
    let [r, n, a] = t, o = r, s = n, i = kl(o.shape, s.shape);
    return { a: () => {
      let c = Ii(s, "float32"), f = ua(e, ua(c, v_(o, Ji(c, Ro(1))))), h = dc(o.shape, i);
      return h.length > 0 && (f = Gi(f, h)), Cn(f, o.shape);
    }, b: () => {
      let c = F0(o, 0), f = Vh(c, lx(o), Wl(o)), h = ua(e, ua(a, f)), p = dc(s.shape, i);
      return p.length > 0 && (h = Gi(h, p)), Cn(h, s.shape);
    } };
  } };
  var bQe = { kernelName: pY, inputsToSave: ["x", "alpha"], gradFunc: (e, t) => {
    let [r, n] = t, a = F0(r, 0);
    return { x: () => Vh(a, e, ua(e, n)), alpha: () => {
      let o = Vh(a, Wl(e), ua(e, r)), s = dc(n.shape, e.shape);
      return s.length > 0 && (o = Gi(o, s)), Cn(o, n.shape);
    } };
  } };
  var _Qe = { kernelName: FK, inputsToSave: ["a", "b"], gradFunc: (e, t) => {
    let [r, n] = t, a = kl(r.shape, n.shape);
    return { a: () => {
      let i = Go(e, Ii(n, "float32")), l = dc(r.shape, a);
      return l.length > 0 ? Cn(Gi(i, l), r.shape) : i;
    }, b: () => {
      let i = ua(e, Ii(r, "float32")), l = dc(n.shape, a);
      l.length > 0 && (i = Cn(Gi(i, l), n.shape));
      let u2 = Xu(n);
      return pc(Go(i, Ii(u2, "float32")));
    } };
  } };
  var wQe = { kernelName: dY, inputsToSave: ["x"], gradFunc: (e, t) => {
    let [r] = t;
    return { x: () => Go(e, pc(Xu(r))) };
  } };
  var kQe = { kernelName: xY, inputsToSave: ["x"], gradFunc: (e, t) => {
    let [r] = t, n = ua(fx(r, 6), f_(r));
    return { x: () => ua(e, Ii(n, "float32")) };
  } };
  var TQe = { kernelName: vY, inputsToSave: ["x"], gradFunc: (e, t) => {
    let [r] = t;
    return { x: () => ua(e, Ii(f_(r), "float32")) };
  } };
  var AQe = { kernelName: mY, inputsToSave: ["x"], gradFunc: (e, t) => {
    let [r] = t;
    return { x: () => Cn(e, r.shape) };
  } };
  var SQe = { kernelName: yY, inputsToSave: ["images"], gradFunc: (e, t, r) => {
    let [n] = t, a = { dy: e, images: n };
    return { images: () => on.runKernel(aYe, a, r) };
  } };
  var EQe = { kernelName: gY, inputsToSave: ["images"], gradFunc: (e, t, r) => {
    let [n] = t, a = { dy: e, images: n };
    return { images: () => on.runKernel(nYe, a, r) };
  } };
  function DQe(e, t) {
    let n = { x: br(e, "x", "reverse") }, a = { dims: t };
    return on.runKernel(bY, n, a);
  }
  var Gv = Gr({ reverse_: DQe });
  var CQe = { kernelName: bY, gradFunc: (e, t, r) => {
    let { dims: n } = r, a = yd(n, e.shape);
    return { x: () => Gv(e, a) };
  } };
  var MQe = { kernelName: _Y, gradFunc: (e) => ({ x: () => Wl(e) }) };
  var IQe = { kernelName: wY, inputsToSave: ["x"], gradFunc: (e, t) => {
    let [r] = t;
    return { x: () => pc(Go(e, ua(v_(r, 1.5), 2))) };
  } };
  function NQe(e) {
    let r = { x: br(e, "x", "logicalNot", "bool") };
    return on.runKernel(jKe, r);
  }
  var DI = Gr({ logicalNot_: NQe });
  var FQe = { kernelName: kY, inputsToSave: ["condition"], gradFunc: (e, t) => {
    let [r] = t;
    return { condition: () => Ii(Wl(r), "float32"), t: () => ua(e, Ii(r, e.dtype)), e: () => ua(e, Ii(DI(r), e.dtype)) };
  } };
  var OQe = 1.7580993408473768, PQe = 1.0507009873554805;
  var LQe = { kernelName: TY, inputsToSave: ["x"], gradFunc: (e, t) => {
    let [r] = t;
    return { x: () => {
      let n = F0(r, Ro(0)), a = Ro(OQe), o = Ro(PQe), s = ua(e, o), i = ua(ua(e, a), gd(Ii(r, "float32")));
      return Vh(n, s, i);
    } };
  } };
  var RQe = { kernelName: CY, outputsToSave: [true], gradFunc: (e, t) => {
    let [r] = t;
    return { x: () => ua(e, ua(r, Ji(Ro(1), r))) };
  } };
  var zQe = { kernelName: DY, gradFunc: (e) => ({ x: () => Wl(e) }) };
  function BQe(e) {
    let r = { x: br(e, "x", "cos", "float32") };
    return on.runKernel(DK, r);
  }
  var CI = Gr({ cos_: BQe });
  var UQe = { kernelName: SY, inputsToSave: ["x"], gradFunc: (e, t) => {
    let [r] = t;
    return { x: () => ua(CI(Ii(r, "float32")), e) };
  } };
  function VQe(e) {
    let r = { x: br(e, "x", "cosh", "float32") };
    return on.runKernel(CK, r);
  }
  var gZ = Gr({ cosh_: VQe });
  var jQe = { kernelName: EY, inputsToSave: ["x"], gradFunc: (e, t) => {
    let [r] = t;
    return { x: () => ua(gZ(Ii(r, "float32")), e) };
  } };
  function WQe(e, t, r = 0) {
    let n = br(e, "x", "pad");
    if (n.rank === 0) throw new Error("pad(scalar) is not defined. Pass non-scalar to pad");
    let a = { paddings: t, constantValue: r }, o = { x: n };
    return on.runKernel(fY, o, a);
  }
  var hx = Gr({ pad_: WQe });
  function GQe(e, t, r) {
    let n, a = e.shape.length;
    typeof t == "number" ? n = [t, ...new Array(a - 1).fill(0)] : t.length < a ? n = t.concat(new Array(a - t.length).fill(0)) : n = t.slice(), n.forEach((s) => {
      zr(s !== -1, () => "slice() does not support negative begin indexing.");
    });
    let o;
    return r == null ? o = new Array(a).fill(-1) : typeof r == "number" ? o = [r, ...new Array(a - 1).fill(-1)] : r.length < a ? o = r.concat(new Array(a - r.length).fill(-1)) : o = r, o = o.map((s, i) => s >= 0 ? s : (zr(s === -1, () => `Negative size values should be exactly -1 but got ${s} for the slice() size at index ${i}.`), e.shape[i] - n[i])), [n, o];
  }
  var $Qe = { kernelName: AY, inputsToSave: ["x"], gradFunc: (e, t, r) => {
    let [n] = t, { begin: a, size: o } = r, s = n.shape, [i, l] = GQe(n, a, o), u2 = [];
    for (let c = 0; c < e.rank; c++) u2.push([i[c], s[c] - i[c] - l[c]]);
    return { x: () => hx(e, u2) };
  } };
  var HQe = { kernelName: PY, outputsToSave: [true], gradFunc: (e, t, r) => {
    let [n] = t, { dim: a } = r, o = true, s = ua(e, n);
    return { logits: () => Ji(s, ua(Gi(s, [a], o), n)) };
  } };
  function qQe(e) {
    let r = { x: br(e, "x", "sigmoid", "float32") };
    return on.runKernel(CY, r);
  }
  var Fg = Gr({ sigmoid_: qQe });
  var XQe = { kernelName: MY, inputsToSave: ["x"], gradFunc: (e, t) => {
    let [r] = t;
    return { x: () => ua(e, Fg(r)) };
  } };
  function KQe(e, t, r) {
    let n = br(e, "x", "batchToSpaceND"), a = t.reduce((i, l) => i * l);
    zr(n.rank >= 1 + t.length, () => `input rank is ${n.rank} but should be > than blockShape.length ${t.length}`), zr(r.length === t.length, () => `crops.length is ${r.length} but should be equal to blockShape.length  ${t.length}`), zr(n.shape[0] % a === 0, () => `input tensor batch is ${n.shape[0]} but is not divisible by the product of the elements of blockShape ${t.join(" * ")} === ${a}`);
    let o = { x: n }, s = { blockShape: t, crops: r };
    return on.runKernel(bK, o, s);
  }
  var MI = Gr({ batchToSpaceND_: KQe });
  var tK = { kernelName: FY, gradFunc: (e, t, r) => {
    let { blockShape: n, paddings: a } = r;
    return { x: () => MI(e, n, a) };
  } };
  function YQe(e, t = 0) {
    zr(e.length >= 1, () => "Pass at least one tensor to concat");
    let r = HT(e, "tensors", "concat", "string_or_numeric");
    if (r[0].dtype === "complex64" && r.forEach((o) => {
      if (o.dtype !== "complex64") throw new Error(`Cannot concatenate complex64 tensors with a tensor
          with dtype ${o.dtype}. `);
    }), r.length === 1) return o_(r[0]);
    let n = r, a = { axis: t };
    return on.runKernel(TK, n, a);
  }
  var Vf = Gr({ concat_: YQe });
  var rK = { kernelName: OY, gradFunc: (e, t, r) => {
    let { axis: n } = r;
    return { x: () => Vf(e, n) };
  } };
  var ZQe = { kernelName: IY, inputsToSave: ["x"], gradFunc: (e, t) => {
    let [r] = t;
    return { x: () => Go(e, ua(Wv(Ii(r, "float32")), 2)) };
  } };
  var JQe = { kernelName: fYe, inputsToSave: ["x"], gradFunc: (e, t) => {
    let [r] = t;
    return { x: () => ua(e, ua(Ii(r, "float32"), 2)) };
  } };
  var QQe = { kernelName: LY, inputsToSave: ["a", "b"], gradFunc: (e, t) => {
    let [r, n] = t, a = Ro(2);
    return { a: () => ua(e, ua(a, Ji(r, n))), b: () => ua(e, ua(a, Ji(n, r))) };
  } };
  var eet = { kernelName: GY, gradFunc: (e) => ({ x: () => Wl(e) }) };
  var tet = { kernelName: RY, inputsToSave: ["a", "b"], gradFunc: (e, t) => {
    let [r, n] = t, a = kl(r.shape, n.shape);
    return { a: () => {
      let i = e, l = dc(r.shape, a);
      return l.length > 0 && (i = Gi(i, l)), Cn(i, r.shape);
    }, b: () => {
      let i = e, l = dc(n.shape, a);
      return l.length > 0 && (i = Gi(i, l)), Cn(pc(i), n.shape);
    } };
  } };
  var ret = { kernelName: NY, inputsToSave: ["x"], gradFunc: (e, t, r) => {
    let [n] = t, a = n.shape.slice(), { axis: o } = r;
    yd(o, n.shape).forEach((u2) => {
      a[u2] = 1;
    });
    let i = Cn(e, a), l = ua(i, d_(n.shape, "float32"));
    return { x: () => l };
  } };
  var net = { kernelName: zY, inputsToSave: ["x"], gradFunc: (e, t) => {
    let [r] = t;
    return { x: () => Go(e, Xu(CI(r))) };
  } };
  var aet = { kernelName: BY, outputsToSave: [true], gradFunc: (e, t) => {
    let [r] = t;
    return { x: () => ua(Ji(Ro(1), Xu(r)), e) };
  } };
  var iet = { kernelName: vI, inputsToSave: ["x"], gradFunc: (e, t, r) => {
    let [n] = t, { reps: a } = r;
    return { x: () => {
      let s = Wl(n);
      if (n.rank === 1) for (let i = 0; i < a[0]; ++i) s = Ls(s, ds(e, [i * n.shape[0]], [n.shape[0]]));
      else if (n.rank === 2) for (let i = 0; i < a[0]; ++i) for (let l = 0; l < a[1]; ++l) s = Ls(s, ds(e, [i * n.shape[0], l * n.shape[1]], [n.shape[0], n.shape[1]]));
      else if (n.rank === 3) for (let i = 0; i < a[0]; ++i) for (let l = 0; l < a[1]; ++l) for (let u2 = 0; u2 < a[2]; ++u2) s = Ls(s, ds(e, [i * n.shape[0], l * n.shape[1], u2 * n.shape[2]], [n.shape[0], n.shape[1], n.shape[2]]));
      else if (n.rank === 4) for (let i = 0; i < a[0]; ++i) for (let l = 0; l < a[1]; ++l) for (let u2 = 0; u2 < a[2]; ++u2) for (let c = 0; c < a[3]; ++c) s = Ls(s, ds(e, [i * n.shape[0], l * n.shape[1], u2 * n.shape[2], c * n.shape[3]], [n.shape[0], n.shape[1], n.shape[2], n.shape[3]]));
      else throw new Error(`Gradient for tile operation is not implemented for rank-${n.rank} tensors yet.`);
      return s;
    } };
  } };
  var oet = { kernelName: UY, gradFunc: (e, t, r) => {
    let n = r, { perm: a } = n, o = uZ(a);
    return { x: () => Pg(e, o) };
  } };
  function set2(e, t = 0) {
    let r = HT(e, "tensors", "stack", "string_or_numeric");
    zr(r.length >= 1, () => "Pass at least one tensor to tf.stack"), r.length > 0 && zr(t <= r[0].rank, () => "Axis must be <= rank of the tensor");
    let n = r, a = { axis: t };
    return on.runKernel(cY, n, a);
  }
  var ux = Gr({ stack_: set2 });
  var uet = { kernelName: VY, gradFunc: (e, t, r) => {
    let n = r, { axis: a } = n;
    return { value: () => ux(e, a) };
  } };
  function cet(e, t = 0) {
    let r = br(e, "x", "expandDims", "string_or_numeric");
    zr(t <= r.rank, () => "Axis must be <= rank of the tensor");
    let n = { input: r }, a = { dim: t };
    return on.runKernel(RK, n, a);
  }
  var Vv = Gr({ expandDims_: cet });
  function fet(e, t, r = 0, n = 0) {
    let a = br(e, "x", "gather"), o = br(t, "indices", "gather", "int32"), s = { x: a, indices: o }, i = { axis: r, batchDims: n };
    return on.runKernel(jK, s, i);
  }
  var yZ = Gr({ gather_: fet });
  function het(e, t) {
    let r = br(e, "a", "maximum"), n = br(t, "b", "maximum");
    [r, n] = lu(r, n), r.dtype === "bool" && (r = Ii(r, "int32"), n = Ii(n, "int32")), kl(r.shape, n.shape);
    let a = { a: r, b: n };
    return on.runKernel(JK, a);
  }
  var xZ = Gr({ maximum_: het });
  var pet = { kernelName: jY, inputsToSave: ["segmentIds"], gradFunc: (e, t) => {
    let [r] = t;
    return { x: () => det(e, r) };
  } };
  function det(e, t) {
    let r = xZ(t, Wl(t)), n = yZ(e, r), a = h_(t, Ro(0, "int32")), o = n.rank - a.rank;
    for (let i = 0; i < o; ++i) a = Vv(a, i + 1);
    a = ax(a, d_(n.shape, "bool"));
    let s = Wl(n);
    return Vh(a, n, s);
  }
  var vet = { kernelName: WY, gradFunc: (e) => ({ x: () => Wl(e) }) };
  var met = [aZ, cZe, fZe, dZe, vZe, gZe, yZe, xZe, _Ze, wZe, kZe, TZe, IZe, OZe, LZe, zZe, BZe, UZe, VZe, XZe, KZe, ZZe, rJe, eJe, oJe, lJe, cJe, gJe, bJe, _Je, _Qe, wJe, TJe, AJe, SJe, EJe, CJe, DJe, NJe, OJe, PJe, LJe, RJe, zJe, BJe, VJe, jJe, WJe, GJe, qJe, QX, QX, YJe, QJe, rQe, aQe, iQe, oQe, lQe, cQe, fQe, hQe, pQe, dQe, mQe, eK, eK, xQe, bQe, wQe, kQe, TQe, AQe, SQe, EQe, CQe, MQe, IQe, FQe, LQe, RQe, zQe, UQe, jQe, $Qe, HQe, XQe, tK, tK, rK, rK, ZQe, QQe, JQe, eet, tet, ret, net, aet, iet, oet, uet, pet, vet];
  for (let e of met) OYe(e);
  function get(e) {
    let t = br(e, "x", "abs");
    if (t.dtype === "complex64") {
      let r = { x: t };
      return on.runKernel(kK, r);
    } else {
      let r = { x: t };
      return on.runKernel(oK, r);
    }
  }
  var _p = Gr({ abs_: get });
  function yet(e) {
    let r = { x: br(e, "x", "acos") };
    return on.runKernel(sK, r);
  }
  var xet = Gr({ acos_: yet });
  function bet(e) {
    let r = { x: br(e, "x", "acosh") };
    return on.runKernel(lK, r);
  }
  var _et = Gr({ acosh_: bet });
  function wet(e) {
    zr(Array.isArray(e), () => "The argument passed to tf.addN() must be a list of tensors"), zr(e.length >= 1, () => `Must pass at least one tensor to tf.addN(), but got ${e.length}`);
    let t = e.map((a, o) => br(a, `tensors${o}`, "addN")), r = t[0];
    t.forEach((a) => {
      if (a.dtype !== r.dtype) throw new Error("All tensors passed to tf.addN() must have the same dtype");
    }), t.forEach((a) => {
      if (!cx(a.shape, r.shape)) throw new Error("All tensors passed to tf.addN() must have the same shape");
    });
    let n = t;
    return on.runKernel(uK, n);
  }
  var lwt = Gr({ addN_: wet });
  function ket(e, t = null, r = false) {
    let a = { x: br(e, "x", "all", "bool") }, o = { axis: t, keepDims: r };
    return on.runKernel(cKe, a, o);
  }
  var Tet = Gr({ all_: ket });
  function Aet(e, t = null, r = false) {
    let a = { x: br(e, "x", "any", "bool") }, o = { axis: t, keepDims: r };
    return on.runKernel(fKe, a, o);
  }
  var Eet = Gr({ any_: Aet });
  function Det(e, t = 0) {
    let n = { x: br(e, "x", "argMax") }, a = { axis: t };
    return on.runKernel(cK, n, a);
  }
  var Cet = Gr({ argMax_: Det });
  function Met(e, t = 0) {
    let n = { x: br(e, "x", "argMin") }, a = { axis: t };
    return on.runKernel(fK, n, a);
  }
  var Iet = Gr({ argMin_: Met });
  function Net(e) {
    let r = { x: br(e, "x", "asin") };
    return on.runKernel(hK, r);
  }
  var Fet = Gr({ asin_: Net });
  function Oet(e) {
    let r = { x: br(e, "x", "asinh") };
    return on.runKernel(pK, r);
  }
  var Pet = Gr({ asinh_: Oet });
  function Let(e) {
    let r = { x: br(e, "x", "atan") };
    return on.runKernel(dK, r);
  }
  var Ret = Gr({ atan_: Let });
  function zet(e, t) {
    let r = br(e, "a", "atan2"), n = br(t, "b", "atan2");
    [r, n] = lu(r, n);
    let a = { a: r, b: n };
    return on.runKernel(mK, a);
  }
  var Bet = Gr({ atan2_: zet });
  function Uet(e) {
    let r = { x: br(e, "x", "atanh") };
    return on.runKernel(vK, r);
  }
  var Vet = Gr({ atanh_: Uet });
  function jet(e, t, r, n, a) {
    let o = br(e, "x", "avgPool", "float32"), s = 1;
    zr(N0(r, s), () => `Error in avgPool: Either strides or dilations must be 1. Got strides ${r} and dilations '${s}'`);
    let i = o, l = false;
    o.rank === 3 && (l = true, i = Cn(o, [1, o.shape[0], o.shape[1], o.shape[2]])), zr(i.rank === 4, () => `Error in avgPool: x must be rank 4 but got rank ${i.rank}.`), jf("avgPool", n, a);
    let u2 = { x: i }, c = { filterSize: t, strides: r, pad: n, dimRoundingMode: a }, f = on.runKernel(gK, u2, c);
    return f = Ii(f, o.dtype), l ? Cn(f, [f.shape[1], f.shape[2], f.shape[3]]) : f;
  }
  var bZ = Gr({ avgPool_: jet });
  function Wet(e, t, r, n, a, o = "NDHWC") {
    let s = br(e, "x", "avgPool3d", "float32"), i = s, l = false;
    s.rank === 4 && (l = true, i = Cn(s, [1, s.shape[0], s.shape[1], s.shape[2], s.shape[3]])), zr(i.rank === 5, () => `Error in avgPool3d: x must be rank 5 but got rank ${i.rank}.`), zr(o === "NDHWC", () => `Error in avgPool3d: Only NDHWC is currently supported, but got dataFormat of ${o}`), jf("avgPool3d", n, a);
    let u2 = { x: i }, c = { filterSize: t, strides: r, pad: n, dimRoundingMode: a, dataFormat: o }, f = on.runKernel(yK, u2, c);
    return f = Ii(f, i.dtype), l ? Cn(f, [f.shape[1], f.shape[2], f.shape[3], f.shape[4]]) : f;
  }
  var uwt = Gr({ avgPool3d_: Wet });
  function Get(e) {
    let r = { x: br(e, "x", "tanh", "float32") };
    return on.runKernel(BY, r);
  }
  var oI = Gr({ tanh_: Get });
  function $et(e, t, r, n, a, o) {
    let s = br(e, "forgetBias", "basicLSTMCell"), i = br(t, "lstmKernel", "basicLSTMCell"), l = br(r, "lstmBias", "basicLSTMCell"), u2 = br(n, "data", "basicLSTMCell"), c = br(a, "c", "basicLSTMCell"), f = br(o, "h", "basicLSTMCell"), h = Vf([u2, f], 1), p = es(h, i), d = Ls(p, l), v = d.shape[0], m = d.shape[1] / 4, g = [v, m], x = ds(d, [0, 0], g), b = ds(d, [0, m], g), y = ds(d, [0, m * 2], g), w = ds(d, [0, m * 3], g), _4 = Ls(ua(Fg(x), oI(b)), ua(c, Fg(Ls(s, y)))), k = ua(oI(_4), Fg(w));
    return [_4, k];
  }
  var cwt = Gr({ basicLSTMCell_: $et });
  function Het(e) {
    let t;
    return e.rank === 0 || e.rank === 1 ? t = Cn(e, [1, 1, 1, e.size]) : e.rank === 2 ? t = Cn(e, [1, 1, e.shape[0], e.shape[1]]) : e.rank === 3 ? t = Cn(e, [1, e.shape[0], e.shape[1], e.shape[2]]) : t = e, t;
  }
  function qet(e, t, r, n, a, o) {
    o == null && (o = 1e-3);
    let s = br(e, "x", "batchNorm"), i = br(t, "mean", "batchNorm"), l = br(r, "variance", "batchNorm"), u2;
    a != null && (u2 = br(a, "scale", "batchNorm"));
    let c;
    n != null && (c = br(n, "offset", "batchNorm")), zr(i.rank === l.rank, () => "Batch normalization gradient requires mean and variance to have equal ranks."), zr(c == null || i.rank === c.rank, () => "Batch normalization gradient requires mean and offset to have equal ranks."), zr(u2 == null || i.rank === u2.rank, () => "Batch normalization gradient requires mean and scale to have equal ranks.");
    let h = { x: Het(s), scale: u2, offset: c, mean: i, variance: l }, p = { varianceEpsilon: o }, d = on.runKernel(VK, h, p);
    return Cn(d, s.shape);
  }
  var tA = Gr({ batchNorm_: qet });
  function Xet(e, t, r, n, a, o) {
    let s = br(e, "x", "batchNorm"), i = br(t, "mean", "batchNorm"), l = br(r, "variance", "batchNorm"), u2;
    a != null && (u2 = br(a, "scale", "batchNorm"));
    let c;
    return n != null && (c = br(n, "offset", "batchNorm")), zr(s.rank === 2, () => `Error in batchNorm2D: x must be rank 2 but got rank ${s.rank}.`), zr(i.rank === 2 || i.rank === 1, () => `Error in batchNorm2D: mean must be rank 2 or rank 1 but got rank ${i.rank}.`), zr(l.rank === 2 || l.rank === 1, () => `Error in batchNorm2D: variance must be rank 2 or rank 1 but got rank ${l.rank}.`), u2 != null && zr(u2.rank === 2 || u2.rank === 1, () => `Error in batchNorm2D: scale must be rank 2 or rank 1 but got rank ${u2.rank}.`), c != null && zr(c.rank === 2 || c.rank === 1, () => `Error in batchNorm2D: offset must be rank 2 or rank 1 but got rank ${c.rank}.`), tA(s, i, l, c, u2, o);
  }
  var fwt = Gr({ batchNorm2d_: Xet });
  function Ket(e, t, r, n, a, o) {
    let s = br(e, "x", "batchNorm"), i = br(t, "mean", "batchNorm"), l = br(r, "variance", "batchNorm"), u2;
    a != null && (u2 = br(a, "scale", "batchNorm"));
    let c;
    return n != null && (c = br(n, "offset", "batchNorm")), zr(s.rank === 3, () => `Error in batchNorm3D: x must be rank 3 but got rank ${s.rank}.`), zr(i.rank === 3 || i.rank === 1, () => `Error in batchNorm3D: mean must be rank 3 or rank 1 but got rank ${i.rank}.`), zr(l.rank === 3 || l.rank === 1, () => `Error in batchNorm3D: variance must be rank 3 or rank 1 but got rank ${l.rank}.`), u2 != null && zr(u2.rank === 3 || u2.rank === 1, () => `Error in batchNorm3D: scale must be rank 3 or rank 1 but got rank ${u2.rank}.`), c != null && zr(c.rank === 3 || c.rank === 1, () => `Error in batchNorm3D: offset must be rank 3 or rank 1 but got rank ${c.rank}.`), tA(s, i, l, c, u2, o);
  }
  var hwt = Gr({ batchNorm3d_: Ket });
  function Yet(e, t, r, n, a, o) {
    let s = br(e, "x", "batchNorm"), i = br(t, "mean", "batchNorm"), l = br(r, "variance", "batchNorm"), u2;
    a != null && (u2 = br(a, "scale", "batchNorm"));
    let c;
    return n != null && (c = br(n, "offset", "batchNorm")), zr(s.rank === 4, () => `Error in batchNorm4D: x must be rank 4 but got rank ${s.rank}.`), zr(i.rank === 4 || i.rank === 1, () => `Error in batchNorm4D: mean must be rank 4 or rank 1 but got rank ${i.rank}.`), zr(l.rank === 4 || l.rank === 1, () => `Error in batchNorm4D: variance must be rank 4 or rank 1 but got rank ${l.rank}.`), u2 != null && zr(u2.rank === 4 || u2.rank === 1, () => `Error in batchNorm4D: scale must be rank 4 or rank 1 but got rank ${u2.rank}.`), c != null && zr(c.rank === 4 || c.rank === 1, () => `Error in batchNorm4D: offset must be rank 4 or rank 1 but got rank ${c.rank}.`), tA(s, i, l, c, u2, o);
  }
  var pwt = Gr({ batchNorm4d_: Yet });
  function Zet(e, t, r) {
    let n = br(e, "x", "bincount"), a = br(t, "weights", "bincount");
    zr(n.dtype === "int32", () => `Error in bincount: input dtype must be int32, but got ${n.dtype}`), zr(r >= 0, () => `size must be non-negative, but got ${r}.`), zr(a.size === n.size || a.size === 0, () => `Error in bincount: weights must have the same size as input or0-length, but got input shape: ${n.shape}, weights shape: ${a.shape}.`);
    let o = { x: n, weights: a }, s = { size: r };
    return on.runKernel(dKe, o, s);
  }
  var Jet = Gr({ bincount_: Zet });
  function Qet(e, t) {
    let r = br(e, "s0", "broadcastArgs", "int32"), n = br(t, "s1", "broadcastArgs", "int32");
    if (r.rank !== 1) throw new Error(`broadcastArgs(): first input must be a vector (rank=1). Has rank ${r.rank}`);
    if (n.rank !== 1) throw new Error(`broadcastArgs(): second input must be a vector (rank=1). Has rank ${n.rank}`);
    let a = { s0: r, s1: n };
    return on.runKernel(mKe, a);
  }
  var dwt = Gr({ broadcastArgs_: Qet });
  function m_(e, t = "float32", r) {
    return t = t || "float32", XY(e), new eI(e, t, r);
  }
  function ett(e) {
    let r = { x: br(e, "x", "ceil", "float32") };
    return on.runKernel(_K, r);
  }
  var ttt = Gr({ ceil_: ett });
  function rtt(e, t, r) {
    let n = br(e, "x", "clipByValue");
    zr(t <= r, () => `Error in clip: min (${t}) must be less than or equal to max (${r}).`);
    let a = { x: n }, o = { clipValueMin: t, clipValueMax: r };
    return on.runKernel(wK, a, o);
  }
  var ntt = Gr({ clipByValue_: rtt });
  function att(e) {
    return Vf(e, 0);
  }
  var vwt = Gr({ concat1d_: att });
  function itt(e, t) {
    return Vf(e, t);
  }
  var mwt = Gr({ concat2d_: itt });
  function ott(e, t) {
    return Vf(e, t);
  }
  var gwt = Gr({ concat3d_: ott });
  function stt(e, t) {
    return Vf(e, t);
  }
  var ywt = Gr({ concat4d_: stt });
  function ltt(e, t, r, n, a = "NWC", o = 1, s) {
    let i = br(e, "x", "conv1d"), l = br(t, "filter", "conv1d"), u2 = i, c = false;
    i.rank === 2 && (c = true, u2 = Cn(i, [1, i.shape[0], i.shape[1]])), zr(u2.rank === 3, () => `Error in conv1d: input must be rank 3, but got rank ${u2.rank}.`), zr(l.rank === 3, () => `Error in conv1d: filter must be rank 3, but got rank ${l.rank}.`), jf("conv1d", n, s), zr(u2.shape[2] === l.shape[1], () => `Error in conv1d: depth of input (${u2.shape[2]}) must match input depth for filter ${l.shape[1]}.`), zr(N0(r, o), () => `Error in conv1D: Either stride or dilation must be 1. Got stride ${r} and dilation '${o}'`), zr(a === "NWC", () => `Error in conv1d: got dataFormat of ${a} but only NWC is currently supported.`);
    let f = Cn(l, [1, l.shape[0], l.shape[1], l.shape[2]]), h = Cn(u2, [u2.shape[0], 1, u2.shape[1], u2.shape[2]]), m = p_(h, f, [1, r], n, "NHWC", [1, o], s);
    return c ? Cn(m, [m.shape[2], m.shape[3]]) : Cn(m, [m.shape[0], m.shape[2], m.shape[3]]);
  }
  var utt = Gr({ conv1d_: ltt });
  function ctt(e, t, r, n, a, o) {
    let s = br(e, "x", "conv2dTranspose"), i = br(t, "filter", "conv2dTranspose");
    return AI(r, s, i, n, a, "NHWC", o);
  }
  var ftt = Gr({ conv2dTranspose_: ctt });
  function htt(e, t, r, n, a = "NDHWC", o = [1, 1, 1]) {
    let s = br(e, "x", "conv3d"), i = br(t, "filter", "conv3d"), l = s, u2 = false;
    s.rank === 4 && (u2 = true, l = Cn(s, [1, s.shape[0], s.shape[1], s.shape[2], s.shape[3]])), zr(l.rank === 5, () => `Error in conv3d: input must be rank 5, but got rank ${l.rank}.`), zr(i.rank === 5, () => `Error in conv3d: filter must be rank 5, but got rank ${i.rank}.`), zr(l.shape[4] === i.shape[3], () => `Error in conv3d: depth of input (${l.shape[4]}) must match input depth for filter ${i.shape[3]}.`), zr(N0(r, o), () => `Error in conv3D: Either strides or dilations must be 1. Got strides ${r} and dilations '${o}'`), zr(a === "NDHWC", () => `Error in conv3d: got dataFormat of ${a} but only NDHWC is currently supported.`);
    let c = { x: l, filter: i }, f = { strides: r, pad: n, dataFormat: a, dilations: o }, h = on.runKernel(EK, c, f);
    return u2 ? Cn(h, [h.shape[1], h.shape[2], h.shape[3], h.shape[4]]) : h;
  }
  var xwt = Gr({ conv3d_: htt });
  function ptt(e, t, r, n, a) {
    let o = br(e, "x", "conv3dTranspose"), s = br(t, "filter", "conv3dTranspose");
    return oZ(r, o, s, n, a);
  }
  var bwt = Gr({ conv3dTranspose_: ptt });
  function dtt(e, t, r, n = false) {
    let a = br(e, "x", "denseBincount"), o = br(t, "weights", "denseBincount");
    zr(a.dtype === "int32", () => `Error in denseBincount: input dtype must be int32, but got ${a.dtype}`), zr(a.rank <= 2, () => `Error in denseBincount: input must be at most rank 2, but got rank ${a.rank}.`), zr(r >= 0, () => `size must be non-negative, but got ${r}.`), zr(o.size === a.size || o.size === 0, () => `Error in denseBincount: weights must have the same shape as x or 0-length, but got x shape: ${a.shape}, weights shape: ${o.shape}.`);
    let s = { x: a, weights: o }, i = { size: r, binaryOutput: n };
    return on.runKernel(wKe, s, i);
  }
  var _wt = Gr({ denseBincount_: dtt });
  function vtt(e, t, r = "NHWC") {
    let n = br(e, "x", "depthToSpace", "float32"), a = r === "NHWC" ? n.shape[1] : n.shape[2], o = r === "NHWC" ? n.shape[2] : n.shape[3], s = r === "NHWC" ? n.shape[3] : n.shape[1];
    zr(t > 1, () => `blockSize should be > 1 for depthToSpace, but was: ${t}`), zr(a * t >= 0, () => `Negative dimension size caused by overflow when multiplying
    ${a} and ${t}  for depthToSpace with input shape
    ${n.shape}`), zr(o * t >= 0, () => `Negative dimension size caused by overflow when multiplying
    ${o} and ${t} for depthToSpace with input shape
        ${n.shape}`), zr(s % (t * t) === 0, () => `Dimension size must be evenly divisible by ${t * t} but is ${s} for depthToSpace with input shape ${n.shape}`);
    let i = { x: n }, l = { blockSize: t, dataFormat: r };
    return on.runKernel(kKe, i, l);
  }
  var mtt = Gr({ depthToSpace_: vtt });
  function gtt(e, t, r, n, a = "NHWC", o = [1, 1], s) {
    let i = br(e, "x", "depthwiseConv2d", "float32"), l = br(t, "filter", "depthwiseConv2d", "float32"), u2 = i, c = false;
    i.rank === 3 && (c = true, u2 = Cn(i, [1, i.shape[0], i.shape[1], i.shape[2]])), zr(u2.rank === 4, () => `Error in depthwiseConv2d: input must be rank 4, but got rank ${u2.rank}.`), zr(l.rank === 4, () => `Error in depthwiseConv2d: filter must be rank 4, but got rank ${l.rank}.`), zr(u2.shape[3] === l.shape[2], () => `Error in depthwiseConv2d: number of input channels (${u2.shape[3]}) must match the inChannels dimension in filter ${l.shape[2]}.`), jf("depthwiseConv2d", n, s);
    let f = { x: u2, filter: l }, h = { strides: r, pad: n, dataFormat: a, dilations: o, dimRoundingMode: s }, p = on.runKernel(IK, f, h);
    return c ? Cn(p, [p.shape[1], p.shape[2], p.shape[3]]) : p;
  }
  var II = Gr({ depthwiseConv2d_: gtt });
  function ytt(e) {
    let r = { x: br(e, "x", "diag") };
    return on.runKernel(SKe, r);
  }
  var wwt = Gr({ diag_: ytt });
  function xtt(e, t, r, n, a = [1, 1], o = "NHWC") {
    let s = br(e, "x", "dilation2d"), i = br(t, "filter", "dilation2d");
    zr(s.rank === 3 || s.rank === 4, () => `Error in dilation2d: input must be rank 3 or 4, but got rank ${s.rank}.`), zr(i.rank === 3, () => `Error in dilation2d: filter must be rank 3, but got rank ${i.rank}.`), zr(o === "NHWC", () => `Error in dilation2d: Only NHWC is currently supported, but got dataFormat of ${o}`);
    let l = s, u2 = false;
    s.rank === 3 && (l = Cn(s, [1, s.shape[0], s.shape[1], s.shape[2]]), u2 = true);
    let c = { x: l, filter: i }, f = { strides: r, pad: n, dilations: a }, h = on.runKernel(NK, c, f);
    return u2 ? Cn(h, [h.shape[1], h.shape[2], h.shape[3]]) : h;
  }
  var btt = Gr({ dilation2d_: xtt });
  function _tt(e, t) {
    let r = br(e, "a", "div"), n = br(t, "b", "div");
    [r, n] = lu(r, n);
    let a = Go(r, n), o = Wl(a), s = SI(n, o);
    return Vh(s, o, a);
  }
  var wtt = Gr({ divNoNan_: _tt });
  function ktt(e, t) {
    let r = br(e, "t1", "dot"), n = br(t, "t2", "dot");
    zr((r.rank === 1 || r.rank === 2) && (n.rank === 1 || n.rank === 2), () => `Error in dot: inputs must all be rank 1 or 2, but got ranks ${r.rank} and ${n.rank}.`);
    let a = r.rank === 1 ? r.size : r.shape[1], o = n.rank === 1 ? n.size : n.shape[0];
    if (zr(a === o, () => `Error in dot: inner dimensions of inputs must match, but got ${a} and ${o}.`), r.rank === 1 && n.rank === 1) {
      let s = Cn(r, [1, -1]), i = Cn(n, [-1, 1]), l = es(s, i);
      return Cn(l, []);
    } else if (r.rank === 1 && n.rank === 2) {
      let s = Cn(r, [1, -1]), i = Cn(n, [n.shape[0], n.shape[1]]), l = es(s, i);
      return Cn(l, [l.size]);
    } else if (r.rank === 2 && n.rank === 1) {
      let s = Cn(n, [-1, 1]), i = es(r, s);
      return Cn(i, [i.size]);
    } else {
      let s = Cn(n, [n.shape[0], n.shape[1]]);
      return es(r, s);
    }
  }
  var Ttt = Gr({ dot_: ktt });
  function Att(e, ...t) {
    let r = t.map((a, o) => br(a, `tensors${o}`, "einsum")), n = { equation: e };
    return on.runKernel(CKe, r, n);
  }
  var kwt = Gr({ einsum_: Att });
  function Stt(e) {
    let r = { x: br(e, "x", "elu", "float32") };
    return on.runKernel(OK, r);
  }
  var _Z = Gr({ elu_: Stt });
  function Ett(e) {
    let t = br(e, "x", "erf");
    zr(t.dtype === "int32" || t.dtype === "float32", () => "Input dtype must be `int32` or `float32`."), t.dtype === "int32" && (t = Ii(t, "float32"));
    let r = { x: t };
    return on.runKernel(PK, r);
  }
  var Dtt = Gr({ erf_: Ett });
  function Ctt(e) {
    let r = { x: br(e, "x", "expm1") };
    return on.runKernel(zK, r);
  }
  var Mtt = Gr({ expm1_: Ctt });
  function Itt(e, t, r, n = "float32") {
    t == null && (t = e);
    let a = m_([e, t], n), o = e <= t ? e : t;
    for (let i = 0; i < o; ++i) a.set(1, i, i);
    let s = Cn(a.toTensor(), [e, t]);
    if (r == null) return s;
    if (r.length === 1) return rx(Vv(s, 0), [r[0], 1, 1]);
    if (r.length === 2) return rx(Vv(Vv(s, 0), 0), [r[0], r[1], 1, 1]);
    if (r.length === 3) return rx(Vv(Vv(Vv(s, 0), 0), 0), [r[0], r[1], r[2], 1, 1]);
    throw new Error(`eye() currently supports only 1D and 2D batchShapes, but received ${r.length}D.`);
  }
  var Ntt = Gr({ eye_: Itt });
  function wZ(e, t, r) {
    let n = { shape: e, value: t, dtype: r };
    return on.runKernel(FKe, {}, n);
  }
  function Ftt(e) {
    let r = { input: br(e, "input", "imag") };
    return on.runKernel(zKe, r);
  }
  var kZ = Gr({ imag_: Ftt });
  function Ott(e) {
    let r = { x: br(e, "x", "isFinite") };
    return on.runKernel(GK, r);
  }
  var Ptt = Gr({ isFinite_: Ott });
  function Ltt(e) {
    let r = { x: br(e, "x", "isInf") };
    return on.runKernel($K, r);
  }
  var Rtt = Gr({ isInf_: Ltt });
  function ztt(e) {
    let r = { x: br(e, "x", "isNaN") };
    return on.runKernel(HK, r);
  }
  var Btt = Gr({ isNaN_: ztt });
  function Utt(e, t = 0.2) {
    let n = { x: br(e, "x", "leakyRelu") }, a = { alpha: t };
    return on.runKernel(qK, n, a);
  }
  var TZ = Gr({ leakyRelu_: Utt });
  function Vtt(e, t = 5, r = 1, n = 1, a = 0.5) {
    let o = br(e, "x", "localResponseNormalization");
    zr(o.rank === 4 || o.rank === 3, () => `Error in localResponseNormalization: x must be rank 3 or 4 but got
               rank ${o.rank}.`), zr(s_(t), () => `Error in localResponseNormalization: depthRadius must be an integer but got depthRadius ${t}.`);
    let s = o, i = false;
    o.rank === 3 && (i = true, s = Cn(o, [1, o.shape[0], o.shape[1], o.shape[2]]));
    let l = { x: s }, u2 = { depthRadius: t, bias: r, alpha: n, beta: a }, c = on.runKernel(YK, l, u2);
    return i ? Cn(c, [c.shape[1], c.shape[2], c.shape[3]]) : c;
  }
  var jtt = Gr({ localResponseNormalization_: Vtt });
  function Wtt(e) {
    let r = { x: br(e, "x", "log1p") };
    return on.runKernel(KK, r);
  }
  var AZ = Gr({ log1p_: Wtt });
  function I0(e) {
    return on.customGrad(e);
  }
  function Gtt(e) {
    let r = { x: br(e, "x", "softplus") };
    return on.runKernel(MY, r);
  }
  var SZ = Gr({ softplus_: Gtt });
  function $tt(e) {
    let t = br(e, "x", "logSigmoid");
    return I0((n) => ({ value: pc(SZ(pc(n))), gradFunc: (s) => ua(s, Fg(pc(n))) }))(t);
  }
  var Htt = Gr({ logSigmoid_: $tt });
  function qtt(e, t = null, r = false) {
    let a = { x: br(e, "x", "max") }, o = { reductionIndices: t, keepDims: r };
    return on.runKernel(ZK, a, o);
  }
  var nx = Gr({ max_: qtt });
  function Xtt(e, t = -1) {
    let r = br(e, "logits", "logSoftmax");
    if (t === -1 && (t = r.rank - 1), t !== r.rank - 1) throw Error(`Log Softmax along a non-last dimension is not yet supported. Logits was rank ${r.rank} and axis was ${t}`);
    return I0((a, o) => {
      let i = nx(a, t, true), l = Ji(a, i), u2 = Ji(Ii(l, "float32"), lx(Gi(gd(l), t, true)));
      return o([u2]), { value: u2, gradFunc: (f, h) => {
        let [p] = h, d = true, v = gd(p);
        return Ji(f, ua(Gi(f, t, d), v));
      } };
    })(r);
  }
  var Ktt = Gr({ logSoftmax_: Xtt });
  function Ytt(e, t = null, r = false) {
    let n = br(e, "x", "logSumExp"), a = yd(t, n.shape), o = nx(n, a, true), s = Ji(n, o), i = gd(s), l = Gi(i, a), u2 = lx(l), c = Ls(Cn(o, u2.shape), u2);
    if (r) {
      let f = ox(c.shape, a);
      return Cn(c, f);
    }
    return c;
  }
  var EZ = Gr({ logSumExp_: Ytt });
  function Ztt(e, t) {
    let r = br(e, "a", "logicalOr", "bool"), n = br(t, "b", "logicalOr", "bool");
    kl(r.shape, n.shape);
    let a = { a: r, b: n };
    return on.runKernel(WKe, a);
  }
  var DZ = Gr({ logicalOr_: Ztt });
  function Jtt(e, t) {
    let r = br(e, "a", "logicalXor", "bool"), n = br(t, "b", "logicalXor", "bool");
    return kl(r.shape, n.shape), ax(DZ(e, t), DI(ax(e, t)));
  }
  var Qtt = Gr({ logicalXor_: Jtt });
  function ert(e, t, r, n, a) {
    let o = br(e, "x", "maxPool"), s = 1, i = o, l = false;
    o.rank === 3 && (l = true, i = Cn(o, [1, o.shape[0], o.shape[1], o.shape[2]])), zr(i.rank === 4, () => `Error in maxPool: input must be rank 4 but got rank ${i.rank}.`), zr(N0(r, s), () => `Error in maxPool: Either strides or dilations must be 1. Got strides ${r} and dilations '${s}'`), jf("maxPool", n, a);
    let u2 = { x: i }, c = { filterSize: t, strides: r, pad: n, dimRoundingMode: a }, f = on.runKernel(QK, u2, c);
    return l ? Cn(f, [f.shape[1], f.shape[2], f.shape[3]]) : f;
  }
  var CZ = Gr({ maxPool_: ert });
  function trt(e, t = [1, 1, 1], r, n, a, o = "NDHWC") {
    let s = br(e, "x", "maxPool3d"), i = s, l = false;
    s.rank === 4 && (l = true, i = Cn(s, [1, s.shape[0], s.shape[1], s.shape[2], s.shape[3]])), zr(i.rank === 5, () => `Error in maxPool3d: x must be rank 5 but got rank ${i.rank}.`), zr(o === "NDHWC", () => `Error in maxPool3d: Only NDHWC is currently supported, but got dataFormat of ${o}`), jf("maxPool3d", n, a);
    let u2 = { x: i }, c = { filterSize: t, strides: r, pad: n, dimRoundingMode: a, dataFormat: o }, f = on.runKernel(eY, u2, c);
    return l ? Cn(f, [f.shape[1], f.shape[2], f.shape[3], f.shape[4]]) : f;
  }
  var Twt = Gr({ maxPool3d_: trt });
  function rrt(e, t, r, n, a = false) {
    let s = { x: br(e, "x", "maxPoolWithArgmax") }, i = { filterSize: t, strides: r, pad: n, includeBatchInIndex: a }, l = on.runKernel(XKe, s, i);
    return { result: l[0], indexes: l[1] };
  }
  var Awt = Gr({ maxPoolWithArgmax_: rrt });
  function nrt(e, t = null, r = false) {
    let a = { x: br(e, "x", "mean") }, o = { axis: t, keepDims: r };
    return on.runKernel(tY, a, o);
  }
  var KT = Gr({ mean_: nrt });
  function art(e, t = null, r = false) {
    let a = { x: br(e, "x", "min") }, o = { axis: t, keepDims: r };
    return on.runKernel(rY, a, o);
  }
  var sI = Gr({ min_: art });
  function irt(e, t) {
    let r = br(e, "a", "minimum"), n = br(t, "b", "minimum");
    [r, n] = lu(r, n), r.dtype === "bool" && (r = Ii(r, "int32"), n = Ii(n, "int32")), kl(r.shape, n.shape);
    let a = { a: r, b: n };
    return on.runKernel(nY, a);
  }
  var MZ = Gr({ minimum_: irt });
  function ort(e, t, r) {
    zr(r === "reflect" || r === "symmetric", () => `Invalid mode. Mode must be either reflect or symmetric. Got ${r}.`);
    let n = br(e, "x", "mirrorPad");
    if (n.rank === 0) throw new Error("mirrorPad(scalar) is not defined. Pass non-scalar to mirrorPad");
    zr(t.length === n.rank, () => `Padding doesn't match input. Must be ${n.rank}. Got ${t.length}.`);
    let a = r === "reflect" ? 1 : 0;
    for (let i = 0; i < n.rank; i++) zr(t[i].length === 2, () => "Invalid number of paddings. Must be length of 2 each."), zr(t[i][0] >= 0 && t[i][0] <= n.shape[i] - a && t[i][1] >= 0 && t[i][1] <= n.shape[i] - a, () => `Padding in dimension ${i} cannot be greater than or equal to ${n.shape[i] - a} or less than 0 for input of shape ${n.shape}`);
    let o = { paddings: t, mode: r }, s = { x: n };
    return on.runKernel(aY, s, o);
  }
  var srt = Gr({ mirrorPad_: ort });
  function lrt(e, t) {
    let r = br(e, "a", "mod"), n = br(t, "b", "mod");
    [r, n] = lu(r, n);
    let a = { a: r, b: n };
    return on.runKernel(iY, a);
  }
  var urt = Gr({ mod_: lrt });
  function crt(e, t = null, r = false) {
    e = br(e, "x", "moments");
    let n = yd(t, e.shape), a = KT(e, n, r), o = a.shape;
    r || (o = ox(a.shape, n));
    let s = Xu(Ji(Ii(e, "float32"), Cn(a, o))), i = KT(s, n, r);
    return { mean: a, variance: i };
  }
  var Swt = Gr({ moments_: crt });
  function frt(e, t, r, n) {
    let a = br(t, "data", "multiRNNCell"), o = HT(r, "c", "multiRNNCell"), s = HT(n, "h", "multiRNNCell"), i = a, l = [];
    for (let f = 0; f < e.length; f++) {
      let h = e[f](i, o[f], s[f]);
      l.push(h[0]), l.push(h[1]), i = h[1];
    }
    let u2 = [], c = [];
    for (let f = 0; f < l.length; f += 2) u2.push(l[f]), c.push(l[f + 1]);
    return [u2, c];
  }
  var Ewt = Gr({ multiRNNCell_: frt });
  function hrt(e, t, r, n = false) {
    let a = br(e, "logits", "multinomial"), o = a.size, s = a.rank;
    if (o < 2) throw new Error(`Error in multinomial: you need at least 2 outcomes, but got ${o}.`);
    if (s > 2) throw new Error(`Rank of probabilities must be 1 or 2, but is ${s}`);
    r = r || Math.random();
    let l = { logits: s === 1 ? Cn(a, [1, -1]) : a }, u2 = { numSamples: t, seed: r, normalized: n }, c = on.runKernel(KKe, l, u2);
    return s === 1 ? Cn(c, [c.size]) : c;
  }
  var Dwt = Gr({ multinomial_: hrt });
  function prt(e, t) {
    let r = br(e, "a", "notEqual", "string_or_numeric"), n = br(t, "b", "notEqual", "string_or_numeric");
    [r, n] = lu(r, n), kl(r.shape, n.shape);
    let a = { a: r, b: n };
    return on.runKernel(YKe, a);
  }
  var IZ = Gr({ notEqual_: prt });
  function drt(e, t, r = 1, n = 0) {
    if (t < 2) throw new Error(`Error in oneHot: depth must be >=2, but it is ${t}`);
    let o = { indices: br(e, "indices", "oneHot", "int32") }, s = { depth: t, onValue: r, offValue: n };
    return on.runKernel(uY, o, s);
  }
  var vrt = Gr({ oneHot_: drt });
  function mrt(e) {
    let r = { x: br(e, "x", "onesLike") };
    return on.runKernel(lY, r);
  }
  var grt = Gr({ onesLike_: mrt });
  function yrt(e, t) {
    let r = br(e, "v1", "outerProduct"), n = br(t, "v2", "outerProduct");
    zr(r.rank === 1 && n.rank === 1, () => `Error in outerProduct: inputs must be rank 1, but got ranks ${r.rank} and ${n.rank}.`);
    let a = Cn(r, [-1, 1]), o = Cn(n, [1, -1]);
    return es(a, o);
  }
  var Cwt = Gr({ outerProduct_: yrt });
  function xrt(e, t, r = 0) {
    return zr(t.length === 2, () => "Invalid number of paddings. Must be length of 2."), hx(e, [t], r);
  }
  var Mwt = Gr({ pad1d_: xrt });
  function brt(e, t, r = 0) {
    return zr(t.length === 2 && t[0].length === 2 && t[1].length === 2, () => "Invalid number of paddings. Must be length of 2 each."), hx(e, t, r);
  }
  var Iwt = Gr({ pad2d_: brt });
  function _rt(e, t, r = 0) {
    return zr(t.length === 3 && t[0].length === 2 && t[1].length === 2 && t[2].length === 2, () => "Invalid number of paddings. Must be length of 2 each."), hx(e, t, r);
  }
  var Nwt = Gr({ pad3d_: _rt });
  function wrt(e, t, r = 0) {
    return zr(t.length === 4 && t[0].length === 2 && t[1].length === 2 && t[2].length === 2 && t[3].length === 2, () => "Invalid number of paddings. Must be length of 2 each."), hx(e, t, r);
  }
  var Fwt = Gr({ pad4d_: wrt });
  function krt(e, t, r, n, a, o, s) {
    a == null && (a = [1, 1]), o == null && (o = 1), n === 0 && (n = "valid");
    let i = br(e, "x", "maxPool"), l = i, u2 = false;
    i.rank === 3 && (u2 = true, l = Cn(i, [1, i.shape[0], i.shape[1], i.shape[2]])), zr(N0(o, a), () => `Error in pool: Either strides or dilations must be 1. Got strides ${o} and dilations '${a}'`);
    let c = AZe(l.shape, t, o, a, n), f = [c.dilationHeight, c.dilationWidth], h;
    n === "same" ? h = Art([c.filterHeight, c.filterWidth], f) : h = [[0, 0], [0, 0]];
    let p = f[0] === 1 && f[1] === 1, [d, v] = Trt([c.inHeight, c.inWidth], f, h), m = p ? n : "valid", g = p ? l : kI(l, f, d), b = (r === "avg" ? () => bZ(g, t, o, m, s) : () => CZ(g, t, o, m, s))(), y = p ? b : MI(b, f, v);
    return u2 ? Cn(y, [y.shape[1], y.shape[2], y.shape[3]]) : y;
  }
  function Trt(e, t, r) {
    let n = r.map((c) => c[0]), a = r.map((c) => c[1]), o = e.concat(n, a), s = t.map((c, f) => (c - o[f] % c) % c), i = a.map((c, f) => c + s[f]), l = t.map((c, f) => [n[f], i[f]]), u2 = t.map((c, f) => [0, s[f]]);
    return [l, u2];
  }
  function Art(e, t) {
    let n = e.map((s, i) => s + (s - 1) * (t[i] - 1)).map((s) => s - 1), a = n.map((s) => Math.floor(s / 2)), o = n.map((s, i) => s - a[i]);
    return n.map((s, i) => [a[i], o[i]]);
  }
  var Srt = Gr({ pool_: krt });
  function Ert(e, t) {
    let r = br(e, "x", "prelu"), n = br(t, "alpha", "prelu"), a = { x: r, alpha: n };
    return on.runKernel(pY, a);
  }
  var NZ = Gr({ prelu_: Ert });
  function Drt(e, t = null, r = false) {
    let n = br(e, "x", "prod");
    n.dtype === "bool" && (n = Ii(n, "int32"));
    let a = { x: n }, o = { axis: t, keepDims: r };
    return on.runKernel(eYe, a, o);
  }
  var Crt = Gr({ prod_: Drt });
  function Mrt(e, t, r) {
    let n = Uh(e), a = null;
    if (r == null || r === "float32") a = new Float32Array(n);
    else if (r === "int32") a = new Int32Array(n);
    else if (r === "bool") a = new Uint8Array(n);
    else throw new Error(`Unknown data type ${r}`);
    for (let o = 0; o < n; o++) a[o] = t();
    return on.makeTensor(a, e, r);
  }
  var Owt = Gr({ rand_: Mrt }), px = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
  function Lg(e, t) {
    return t = { exports: {} }, e(t, t.exports), t.exports;
  }
  var Irt = Lg(function(e) {
    (function(t, r, n) {
      function a(l) {
        var u2 = this, c = i();
        u2.next = function() {
          var f = 2091639 * u2.s0 + u2.c * 23283064365386963e-26;
          return u2.s0 = u2.s1, u2.s1 = u2.s2, u2.s2 = f - (u2.c = f | 0);
        }, u2.c = 1, u2.s0 = c(" "), u2.s1 = c(" "), u2.s2 = c(" "), u2.s0 -= c(l), u2.s0 < 0 && (u2.s0 += 1), u2.s1 -= c(l), u2.s1 < 0 && (u2.s1 += 1), u2.s2 -= c(l), u2.s2 < 0 && (u2.s2 += 1), c = null;
      }
      function o(l, u2) {
        return u2.c = l.c, u2.s0 = l.s0, u2.s1 = l.s1, u2.s2 = l.s2, u2;
      }
      function s(l, u2) {
        var c = new a(l), f = u2 && u2.state, h = c.next;
        return h.int32 = function() {
          return c.next() * 4294967296 | 0;
        }, h.double = function() {
          return h() + (h() * 2097152 | 0) * 11102230246251565e-32;
        }, h.quick = h, f && (typeof f == "object" && o(f, c), h.state = function() {
          return o(c, {});
        }), h;
      }
      function i() {
        var l = 4022871197, u2 = function(c) {
          c = c.toString();
          for (var f = 0; f < c.length; f++) {
            l += c.charCodeAt(f);
            var h = 0.02519603282416938 * l;
            l = h >>> 0, h -= l, h *= l, l = h >>> 0, h -= l, l += h * 4294967296;
          }
          return (l >>> 0) * 23283064365386963e-26;
        };
        return u2;
      }
      r && r.exports ? r.exports = s : n && n.amd ? n(function() {
        return s;
      }) : this.alea = s;
    })(px, e, false);
  }), Nrt = Lg(function(e) {
    (function(t, r, n) {
      function a(i) {
        var l = this, u2 = "";
        l.x = 0, l.y = 0, l.z = 0, l.w = 0, l.next = function() {
          var f = l.x ^ l.x << 11;
          return l.x = l.y, l.y = l.z, l.z = l.w, l.w ^= l.w >>> 19 ^ f ^ f >>> 8;
        }, i === (i | 0) ? l.x = i : u2 += i;
        for (var c = 0; c < u2.length + 64; c++) l.x ^= u2.charCodeAt(c) | 0, l.next();
      }
      function o(i, l) {
        return l.x = i.x, l.y = i.y, l.z = i.z, l.w = i.w, l;
      }
      function s(i, l) {
        var u2 = new a(i), c = l && l.state, f = function() {
          return (u2.next() >>> 0) / 4294967296;
        };
        return f.double = function() {
          do
            var h = u2.next() >>> 11, p = (u2.next() >>> 0) / 4294967296, d = (h + p) / (1 << 21);
          while (d === 0);
          return d;
        }, f.int32 = u2.next, f.quick = f, c && (typeof c == "object" && o(c, u2), f.state = function() {
          return o(u2, {});
        }), f;
      }
      r && r.exports ? r.exports = s : n && n.amd ? n(function() {
        return s;
      }) : this.xor128 = s;
    })(px, e, false);
  }), Frt = Lg(function(e) {
    (function(t, r, n) {
      function a(i) {
        var l = this, u2 = "";
        l.next = function() {
          var f = l.x ^ l.x >>> 2;
          return l.x = l.y, l.y = l.z, l.z = l.w, l.w = l.v, (l.d = l.d + 362437 | 0) + (l.v = l.v ^ l.v << 4 ^ (f ^ f << 1)) | 0;
        }, l.x = 0, l.y = 0, l.z = 0, l.w = 0, l.v = 0, i === (i | 0) ? l.x = i : u2 += i;
        for (var c = 0; c < u2.length + 64; c++) l.x ^= u2.charCodeAt(c) | 0, c == u2.length && (l.d = l.x << 10 ^ l.x >>> 4), l.next();
      }
      function o(i, l) {
        return l.x = i.x, l.y = i.y, l.z = i.z, l.w = i.w, l.v = i.v, l.d = i.d, l;
      }
      function s(i, l) {
        var u2 = new a(i), c = l && l.state, f = function() {
          return (u2.next() >>> 0) / 4294967296;
        };
        return f.double = function() {
          do
            var h = u2.next() >>> 11, p = (u2.next() >>> 0) / 4294967296, d = (h + p) / (1 << 21);
          while (d === 0);
          return d;
        }, f.int32 = u2.next, f.quick = f, c && (typeof c == "object" && o(c, u2), f.state = function() {
          return o(u2, {});
        }), f;
      }
      r && r.exports ? r.exports = s : n && n.amd ? n(function() {
        return s;
      }) : this.xorwow = s;
    })(px, e, false);
  }), Ort = Lg(function(e) {
    (function(t, r, n) {
      function a(i) {
        var l = this;
        l.next = function() {
          var c = l.x, f = l.i, h, p, d;
          return h = c[f], h ^= h >>> 7, p = h ^ h << 24, h = c[f + 1 & 7], p ^= h ^ h >>> 10, h = c[f + 3 & 7], p ^= h ^ h >>> 3, h = c[f + 4 & 7], p ^= h ^ h << 7, h = c[f + 7 & 7], h = h ^ h << 13, p ^= h ^ h << 9, c[f] = p, l.i = f + 1 & 7, p;
        };
        function u2(c, f) {
          var h, p, d = [];
          if (f === (f | 0)) p = d[0] = f;
          else for (f = "" + f, h = 0; h < f.length; ++h) d[h & 7] = d[h & 7] << 15 ^ f.charCodeAt(h) + d[h + 1 & 7] << 13;
          for (; d.length < 8; ) d.push(0);
          for (h = 0; h < 8 && d[h] === 0; ++h) ;
          for (h == 8 ? p = d[7] = -1 : p = d[h], c.x = d, c.i = 0, h = 256; h > 0; --h) c.next();
        }
        u2(l, i);
      }
      function o(i, l) {
        return l.x = i.x.slice(), l.i = i.i, l;
      }
      function s(i, l) {
        i == null && (i = +/* @__PURE__ */ new Date());
        var u2 = new a(i), c = l && l.state, f = function() {
          return (u2.next() >>> 0) / 4294967296;
        };
        return f.double = function() {
          do
            var h = u2.next() >>> 11, p = (u2.next() >>> 0) / 4294967296, d = (h + p) / (1 << 21);
          while (d === 0);
          return d;
        }, f.int32 = u2.next, f.quick = f, c && (c.x && o(c, u2), f.state = function() {
          return o(u2, {});
        }), f;
      }
      r && r.exports ? r.exports = s : n && n.amd ? n(function() {
        return s;
      }) : this.xorshift7 = s;
    })(px, e, false);
  }), Prt = Lg(function(e) {
    (function(t, r, n) {
      function a(i) {
        var l = this;
        l.next = function() {
          var c = l.w, f = l.X, h = l.i, p, d;
          return l.w = c = c + 1640531527 | 0, d = f[h + 34 & 127], p = f[h = h + 1 & 127], d ^= d << 13, p ^= p << 17, d ^= d >>> 15, p ^= p >>> 12, d = f[h] = d ^ p, l.i = h, d + (c ^ c >>> 16) | 0;
        };
        function u2(c, f) {
          var h, p, d, v, m, g = [], x = 128;
          for (f === (f | 0) ? (p = f, f = null) : (f = f + "\0", p = 0, x = Math.max(x, f.length)), d = 0, v = -32; v < x; ++v) f && (p ^= f.charCodeAt((v + 32) % f.length)), v === 0 && (m = p), p ^= p << 10, p ^= p >>> 15, p ^= p << 4, p ^= p >>> 13, v >= 0 && (m = m + 1640531527 | 0, h = g[v & 127] ^= p + m, d = h == 0 ? d + 1 : 0);
          for (d >= 128 && (g[(f && f.length || 0) & 127] = -1), d = 127, v = 4 * 128; v > 0; --v) p = g[d + 34 & 127], h = g[d = d + 1 & 127], p ^= p << 13, h ^= h << 17, p ^= p >>> 15, h ^= h >>> 12, g[d] = p ^ h;
          c.w = m, c.X = g, c.i = d;
        }
        u2(l, i);
      }
      function o(i, l) {
        return l.i = i.i, l.w = i.w, l.X = i.X.slice(), l;
      }
      function s(i, l) {
        i == null && (i = +/* @__PURE__ */ new Date());
        var u2 = new a(i), c = l && l.state, f = function() {
          return (u2.next() >>> 0) / 4294967296;
        };
        return f.double = function() {
          do
            var h = u2.next() >>> 11, p = (u2.next() >>> 0) / 4294967296, d = (h + p) / (1 << 21);
          while (d === 0);
          return d;
        }, f.int32 = u2.next, f.quick = f, c && (c.X && o(c, u2), f.state = function() {
          return o(u2, {});
        }), f;
      }
      r && r.exports ? r.exports = s : n && n.amd ? n(function() {
        return s;
      }) : this.xor4096 = s;
    })(px, e, false);
  }), Lrt = Lg(function(e) {
    (function(t, r, n) {
      function a(i) {
        var l = this, u2 = "";
        l.next = function() {
          var f = l.b, h = l.c, p = l.d, d = l.a;
          return f = f << 25 ^ f >>> 7 ^ h, h = h - p | 0, p = p << 24 ^ p >>> 8 ^ d, d = d - f | 0, l.b = f = f << 20 ^ f >>> 12 ^ h, l.c = h = h - p | 0, l.d = p << 16 ^ h >>> 16 ^ d, l.a = d - f | 0;
        }, l.a = 0, l.b = 0, l.c = -1640531527, l.d = 1367130551, i === Math.floor(i) ? (l.a = i / 4294967296 | 0, l.b = i | 0) : u2 += i;
        for (var c = 0; c < u2.length + 20; c++) l.b ^= u2.charCodeAt(c) | 0, l.next();
      }
      function o(i, l) {
        return l.a = i.a, l.b = i.b, l.c = i.c, l.d = i.d, l;
      }
      function s(i, l) {
        var u2 = new a(i), c = l && l.state, f = function() {
          return (u2.next() >>> 0) / 4294967296;
        };
        return f.double = function() {
          do
            var h = u2.next() >>> 11, p = (u2.next() >>> 0) / 4294967296, d = (h + p) / (1 << 21);
          while (d === 0);
          return d;
        }, f.int32 = u2.next, f.quick = f, c && (typeof c == "object" && o(c, u2), f.state = function() {
          return o(u2, {});
        }), f;
      }
      r && r.exports ? r.exports = s : n && n.amd ? n(function() {
        return s;
      }) : this.tychei = s;
    })(px, e, false);
  }), Rg = Lg(function(e) {
    (function(t, r) {
      var n = this, a = 256, o = 6, s = 52, i = "random", l = r.pow(a, o), u2 = r.pow(2, s), c = u2 * 2, f = a - 1, h;
      function p(y, w, _4) {
        var k = [];
        w = w == true ? { entropy: true } : w || {};
        var T2 = g(m(w.entropy ? [y, b(t)] : y ?? x(), 3), k), A2 = new d(k), S2 = function() {
          for (var C2 = A2.g(o), E2 = l, F13 = 0; C2 < u2; ) C2 = (C2 + F13) * a, E2 *= a, F13 = A2.g(1);
          for (; C2 >= c; ) C2 /= 2, E2 /= 2, F13 >>>= 1;
          return (C2 + F13) / E2;
        };
        return S2.int32 = function() {
          return A2.g(4) | 0;
        }, S2.quick = function() {
          return A2.g(4) / 4294967296;
        }, S2.double = S2, g(b(A2.S), t), (w.pass || _4 || function(C2, E2, F13, N2) {
          return N2 && (N2.S && v(N2, A2), C2.state = function() {
            return v(A2, {});
          }), F13 ? (r[i] = C2, E2) : C2;
        })(S2, T2, "global" in w ? w.global : this == r, w.state);
      }
      r["seed" + i] = p;
      function d(y) {
        var w, _4 = y.length, k = this, T2 = 0, A2 = k.i = k.j = 0, S2 = k.S = [];
        for (_4 || (y = [_4++]); T2 < a; ) S2[T2] = T2++;
        for (T2 = 0; T2 < a; T2++) S2[T2] = S2[A2 = f & A2 + y[T2 % _4] + (w = S2[T2])], S2[A2] = w;
        (k.g = function(C2) {
          for (var E2, F13 = 0, N2 = k.i, D2 = k.j, I2 = k.S; C2--; ) E2 = I2[N2 = f & N2 + 1], F13 = F13 * a + I2[f & (I2[N2] = I2[D2 = f & D2 + E2]) + (I2[D2] = E2)];
          return k.i = N2, k.j = D2, F13;
        })(a);
      }
      function v(y, w) {
        return w.i = y.i, w.j = y.j, w.S = y.S.slice(), w;
      }
      function m(y, w) {
        var _4 = [], k = typeof y, T2;
        if (w && k == "object") for (T2 in y) try {
          _4.push(m(y[T2], w - 1));
        } catch {
        }
        return _4.length ? _4 : k == "string" ? y : y + "\0";
      }
      function g(y, w) {
        for (var _4 = y + "", k, T2 = 0; T2 < _4.length; ) w[f & T2] = f & (k ^= w[f & T2] * 19) + _4.charCodeAt(T2++);
        return b(w);
      }
      function x() {
        try {
          var y;
          return h && (y = h.randomBytes) ? y = y(a) : (y = new Uint8Array(a), (n.crypto || n.msCrypto).getRandomValues(y)), b(y);
        } catch {
          var w = n.navigator, _4 = w && w.plugins;
          return [+/* @__PURE__ */ new Date(), n, _4, n.screen, b(t)];
        }
      }
      function b(y) {
        return String.fromCharCode.apply(0, y);
      }
      if (g(r.random(), t), e.exports) {
        e.exports = p;
        try {
          h = r3();
        } catch {
        }
      }
    })([], Math);
  });
  Rg.alea = Irt;
  Rg.xor128 = Nrt;
  Rg.xorwow = Frt;
  Rg.xorshift7 = Ort;
  Rg.xor4096 = Prt;
  Rg.tychei = Lrt;
  var Rrt = Rg, NI = Rrt.alea;
  var c_ = class {
    constructor(t, r, n, a, o) {
      this.mean = t, this.stdDev = r, this.dtype = n, this.nextVal = NaN, this.truncated = a, this.truncated && (this.upper = this.mean + this.stdDev * 2, this.lower = this.mean - this.stdDev * 2);
      let s = o || Math.random();
      this.random = NI(s.toString());
    }
    nextValue() {
      if (!isNaN(this.nextVal)) {
        let a = this.nextVal;
        return this.nextVal = NaN, a;
      }
      let t, r, n = false;
      for (; !n; ) {
        let a, o, s;
        do
          a = 2 * this.random() - 1, o = 2 * this.random() - 1, s = a * a + o * o;
        while (s >= 1 || s === 0);
        let i = Math.sqrt(-2 * Math.log(s) / s);
        t = this.mean + this.stdDev * a * i, r = this.mean + this.stdDev * o * i, (!this.truncated || this.isValidTruncated(t)) && (n = true);
      }
      return (!this.truncated || this.isValidTruncated(r)) && (this.nextVal = this.convertValue(r)), this.convertValue(t);
    }
    convertValue(t) {
      return this.dtype == null || this.dtype === "float32" ? t : Math.round(t);
    }
    isValidTruncated(t) {
      return t <= this.upper && t >= this.lower;
    }
  }, lI = class {
    constructor(t, r, n, a) {
      this.alpha = t, this.beta = 1 / r, this.dtype = n;
      let o = a || Math.random();
      this.randu = NI(o.toString()), this.randn = new c_(0, 1, n, false, this.randu()), t < 1 ? this.d = t + 2 / 3 : this.d = t - 1 / 3, this.c = 1 / Math.sqrt(9 * this.d);
    }
    nextValue() {
      let t, r, n, a, o, s;
      for (; ; ) {
        do
          a = this.randn.nextValue(), s = 1 + this.c * a;
        while (s <= 0);
        if (s *= s * s, t = a * a, r = 1 - 0.331 * t * t, n = 0.5 * t + this.d * (1 - s + Math.log(s)), o = this.randu(), o < r || Math.log(o) < n) break;
      }
      return s = 1 / this.beta * this.d * s, this.alpha < 1 && (s *= Math.pow(this.randu(), 1 / this.alpha)), this.convertValue(s);
    }
    convertValue(t) {
      return this.dtype === "float32" ? t : Math.round(t);
    }
  }, uI = class {
    constructor(t = 0, r = 1, n, a) {
      if (this.canReturnFloat = () => this.dtype == null || this.dtype === "float32", this.min = t, this.range = r - t, this.dtype = n, a == null && (a = Math.random()), typeof a == "number" && (a = a.toString()), !this.canReturnFloat() && this.range <= 1) throw new Error(`The difference between ${t} - ${r} <= 1 and dtype is not float`);
      this.random = NI(a);
    }
    convertValue(t) {
      return this.canReturnFloat() ? t : Math.round(t);
    }
    nextValue() {
      return this.convertValue(this.min + this.range * this.random());
    }
  };
  function zrt(e, t, r = 1, n = "float32", a) {
    if (r == null && (r = 1), n == null && (n = "float32"), n !== "float32" && n !== "int32") throw new Error(`Unsupported data type ${n}`);
    let o = new lI(t, r, n, a), s = m_(e, n);
    for (let i = 0; i < s.values.length; i++) s.values[i] = o.nextValue();
    return s.toTensor();
  }
  var Pwt = Gr({ randomGamma_: zrt });
  function Brt(e, t = 0, r = 1, n, a) {
    if (n != null && n === "bool") throw new Error(`Unsupported data type ${n}`);
    let o = new c_(t, r, n, false, a), s = m_(e, n);
    for (let i = 0; i < s.values.length; i++) s.values[i] = o.nextValue();
    return s.toTensor();
  }
  var Lwt = Gr({ randomNormal_: Brt });
  function Urt(e, t = 0, r = 1, n = "float32", a) {
    let o = m_(e, n), s = new uI(t, r, null, a);
    for (let i = 0; i < o.values.length; i++) o.values[i] = s.nextValue();
    return o.toTensor();
  }
  var Vrt = Gr({ randomUniform_: Urt });
  function YT(e, t, r = 1, n = "float32") {
    if (r === 0) throw new Error("Cannot have a step of zero");
    let a = { start: e, stop: t, step: r, dtype: n };
    return on.runKernel(tYe, {}, a);
  }
  function jrt(e) {
    let r = { input: br(e, "input", "real") };
    return on.runKernel(rYe, r);
  }
  var cI = Gr({ real_: jrt });
  function Wrt(e) {
    let r = { x: br(e, "x", "reciprocal") };
    return on.runKernel(dY, r);
  }
  var Grt = Gr({ reciprocal_: Wrt });
  function $rt(e) {
    let r = { x: br(e, "x", "relu") };
    return on.runKernel(vY, r);
  }
  var rA = Gr({ relu_: $rt });
  function Hrt(e) {
    let r = { x: br(e, "x", "relu6") };
    return on.runKernel(xY, r);
  }
  var FZ = Gr({ relu6_: Hrt });
  function qrt(e) {
    let t = br(e, "x", "reverse");
    return zr(t.rank === 1, () => `Error in reverse1D: x must be rank 1 but got rank ${t.rank}.`), Gv(t, 0);
  }
  var Rwt = Gr({ reverse1d_: qrt });
  function Xrt(e, t) {
    let r = br(e, "x", "reverse");
    return zr(r.rank === 2, () => `Error in reverse2D: x must be rank 2 but got rank ${r.rank}.`), Gv(r, t);
  }
  var zwt = Gr({ reverse2d_: Xrt });
  function Krt(e, t) {
    let r = br(e, "x", "reverse");
    return zr(r.rank === 3, () => `Error in reverse3D: x must be rank 3 but got rank ${r.rank}.`), Gv(r, t);
  }
  var Bwt = Gr({ reverse3d_: Krt });
  function Yrt(e, t) {
    let r = br(e, "x", "reverse");
    return zr(r.rank === 4, () => `Error in reverse4D: x must be rank 4 but got rank ${r.rank}.`), Gv(r, t);
  }
  var Uwt = Gr({ reverse4d_: Yrt });
  function Zrt(e) {
    let r = { x: br(e, "x", "round") };
    return on.runKernel(_Y, r);
  }
  var OZ = Gr({ round_: Zrt });
  function Jrt(e) {
    let r = { x: br(e, "x", "selu") };
    return on.runKernel(TY, r);
  }
  var Qrt = Gr({ selu_: Jrt });
  function ent(e, t, r, n, a, o = [1, 1], s = "NHWC") {
    let i = br(e, "x", "separableConv2d"), l = br(t, "depthwiseFilter", "separableConv2d"), u2 = br(r, "pointwiseFilter", "separableConv2d"), c = i, f = false;
    if (i.rank === 3 && (f = true, c = Cn(i, [1, i.shape[0], i.shape[1], i.shape[2]])), s === "NCHW") throw new Error("separableConv2d currently does not support dataFormat NCHW; only NHWC is supported");
    zr(c.rank === 4, () => `Error in separableConv2d: input must be rank 4, but got rank ${c.rank}.`), zr(l.rank === 4, () => `Error in separableConv2d: depthwise filter must be rank 4, but got rank ${l.rank}.`), zr(u2.rank === 4, () => `Error in separableConv2d: pointwise filter must be rank 4, but got rank ${l.rank}.`), zr(u2.shape[0] === 1, () => `Error in separableConv2d: the first dimension of pointwise filter  must be 1, but got ${u2.shape[0]}.`), zr(u2.shape[1] === 1, () => `Error in separableConv2d: the second dimension of pointwise filter must be 1, but got ${u2.shape[1]}.`);
    let h = l.shape[2], p = l.shape[3];
    zr(u2.shape[2] === h * p, () => `Error in separableConv2d: the third dimension of pointwise filter must be ${h * p}, but got ${u2.shape[2]}.`);
    let d = II(c, l, n, a, s, o), m = p_(d, u2, 1, "valid", s);
    return f ? Cn(m, [m.shape[1], m.shape[2], m.shape[3]]) : m;
  }
  var tnt = Gr({ separableConv2d_: ent });
  function rnt(e) {
    let r = { x: br(e, "x", "sign") };
    return on.runKernel(DY, r);
  }
  var nnt = Gr({ sign_: rnt });
  function ant(e, t, r) {
    let n = br(e, "x", "slice1d");
    return zr(n.rank === 1, () => `slice1d expects a rank-1 tensor, but got a rank-${n.rank} tensor`), ds(n, [t], [r]);
  }
  var Vwt = Gr({ slice1d_: ant });
  function int3(e, t, r) {
    let n = br(e, "x", "slice2d");
    return zr(n.rank === 2, () => `slice2d expects a rank-2 tensor, but got a rank-${n.rank} tensor`), ds(n, t, r);
  }
  var jwt = Gr({ slice2d_: int3 });
  function ont(e, t, r) {
    let n = br(e, "x", "slice3d");
    return zr(n.rank === 3, () => `slice3d expects a rank-3 tensor, but got a rank-${n.rank} tensor`), ds(n, t, r);
  }
  var Wwt = Gr({ slice3d_: ont });
  function snt(e, t, r) {
    let n = br(e, "x", "slice4d");
    return zr(n.rank === 4, () => `slice4d expects a rank-4 tensor, but got a rank-${n.rank} tensor`), ds(n, t, r);
  }
  var Gwt = Gr({ slice4d_: snt });
  function lnt(e, t = -1) {
    let r = br(e, "logits", "softmax", "float32");
    if (t === -1 && (t = r.rank - 1), t !== r.rank - 1) throw Error(`Softmax along a non-last dimension is not yet supported. Logits was rank ${r.rank} and dim was ${t}`);
    let n = { logits: r }, a = { dim: t };
    return on.runKernel(PY, n, a);
  }
  var unt = Gr({ softmax_: lnt });
  function cnt(e) {
    zr(e.dtype === "complex64", () => `The dtype for tf.spectral.fft() must be complex64 but got ${e.dtype}.`);
    let t = { input: e };
    return on.runKernel(NKe, t);
  }
  var PZ = Gr({ fft_: cnt });
  function fnt(e) {
    zr(e.dtype === "complex64", () => `The dtype for tf.spectral.ifft() must be complex64 but got ${e.dtype}.`);
    let t = { input: e };
    return on.runKernel(RKe, t);
  }
  var fI = Gr({ ifft_: fnt });
  function hnt(e) {
    let t = e.shape[e.shape.length - 1], r = e.size / t, n;
    if (t <= 2) {
      let a = Cn(e, [r, t]);
      n = fI(a);
    } else {
      let a = [r, 2 * (t - 1)], o = Cn(cI(e), [r, t]), s = Cn(kZ(e), [r, t]), i = Gv(ds(o, [0, 1], [r, t - 2]), 1), l = ua(Gv(ds(s, [0, 1], [r, t - 2]), 1), Ro(-1)), u2 = Vf([o, i], 1), c = Vf([s, l], 1), f = Cn(u_(u2, c), [a[0], a[1]]);
      n = fI(f);
    }
    if (n = cI(n), e.rank === 3 && e.shape[0] !== 0) {
      let a = n, o = e.shape[0];
      n = Cn(n, [o, n.shape[0] / o, n.shape[1]]), a.dispose();
    }
    return n;
  }
  var pnt = Gr({ irfft_: hnt });
  function dnt(e, t) {
    zr(e.dtype === "float32", () => `The dtype for rfft() must be real value but got ${e.dtype}`);
    let r = e.shape[e.shape.length - 1], n = e.size / r, a;
    if (t != null && t < r) {
      let d = e.shape.map((m) => 0), v = e.shape.map((m) => m);
      v[e.shape.length - 1] = t, a = ds(e, d, v), r = t;
    } else if (t != null && t > r) {
      let d = e.shape.map((v) => v);
      d[e.shape.length - 1] = t - r, a = Vf([e, sx(d)], e.shape.length - 1), r = t;
    } else a = e;
    let o = Wl(a), s = Cn(u_(a, o), [n, r]), i = PZ(s), l = Math.floor(r / 2) + 1, u2 = cI(i), c = kZ(i), f = ix(u2, [l, r - l], u2.shape.length - 1), h = ix(c, [l, r - l], c.shape.length - 1), p = a.shape.slice();
    return p[a.shape.length - 1] = l, Cn(u_(f[0], h[0]), p);
  }
  var LZ = Gr({ rfft_: dnt });
  function vnt(e, t) {
    let r = br(e, "a", "squaredDifference"), n = br(t, "b", "squaredDifference");
    [r, n] = lu(r, n), kl(r.shape, n.shape);
    let a = { a: r, b: n }, o = {};
    return on.runKernel(LY, a, o);
  }
  var RZ = Gr({ squaredDifference_: vnt });
  function mnt(e, t) {
    let r = br(e, "x", "squeeze");
    return Cn(r, wYe(r.shape, t).newShape);
  }
  var zZ = Gr({ squeeze_: mnt });
  function gnt(e, t, r, n, a = 0, o = 0, s = 0, i = 0, l = 0) {
    let c = { x: br(e, "x", "stridedSlice", "string_or_numeric") }, f = { begin: t, end: r, strides: n, beginMask: a, endMask: o, ellipsisMask: s, newAxisMask: i, shrinkAxisMask: l };
    return on.runKernel(hYe, c, f);
  }
  var ynt = Gr({ stridedSlice_: gnt });
  function xnt(e) {
    let r = { x: br(e, "x", "tan", "float32") };
    return on.runKernel(zY, r);
  }
  var bnt = Gr({ tan_: xnt });
  function _nt(e, t, r) {
    let n = JT(e, r);
    return QT(e, t, n, r);
  }
  function tx(e, t) {
    $Y(e);
    let r = JT(e, t);
    if (r.length !== 1) throw new Error("tensor1d() requires values to be a flat/TypedArray");
    return QT(e, null, r, t);
  }
  function WT(e, t, r) {
    if ($Y(e), t != null && t.length !== 2) throw new Error("tensor2d() requires shape to have two numbers");
    let n = JT(e, r);
    if (n.length !== 2 && n.length !== 1) throw new Error("tensor2d() requires values to be number[][] or flat/TypedArray");
    if (n.length === 1 && t == null) throw new Error("tensor2d() requires shape to be provided when `values` are a flat/TypedArray");
    return QT(e, t, n, r);
  }
  function wnt(e, t = 1, r = true) {
    let n = br(e, "x", "topk");
    if (n.rank === 0) throw new Error("topk() expects the input to be of rank 1 or higher");
    let a = n.shape[n.shape.length - 1];
    if (t < 0) throw new Error(`'k' passed to topk() must be >= 0 but got ${t}`);
    if (t > a) throw new Error(`'k' passed to topk() must be <= the last dimension (${a}) but got ${t}`);
    let o = { x: n }, s = { k: t, sorted: r }, [i, l] = on.runKernel(mYe, o, s);
    return { values: i, indices: l };
  }
  var knt = Gr({ topk_: wnt });
  function Tnt(e, t = 0, r = 1, n, a) {
    if (n != null && n === "bool") throw new Error("Unsupported data type $ { dtype }");
    let o = new c_(t, r, n, true, a), s = m_(e, n);
    for (let i = 0; i < s.values.length; i++) s.values[i] = o.nextValue();
    return s.toTensor();
  }
  var $wt = Gr({ truncatedNormal_: Tnt });
  function Ant(e, t = 0) {
    let r = br(e, "x", "unique", "string_or_numeric");
    zr(r.rank > 0, () => "The input tensor must be at least 1D");
    let n = { x: r }, a = { axis: t }, [o, s] = on.runKernel(yYe, n, a);
    return { values: o, indices: s };
  }
  var Snt = Gr({ unique_: Ant });
  function Ent(e, t = "euclidean", r = null, n = false) {
    e = br(e, "x", "norm");
    let a = BZ(e, t, r), o = a.shape;
    if (n) {
      let s = yd(r, e.shape);
      o = ox(a.shape, s);
    }
    return Cn(a, o);
  }
  function BZ(e, t, r = null) {
    if (e.rank === 0) return _p(e);
    if (e.rank !== 1 && r === null) return BZ(Cn(e, [-1]), t, r);
    if (e.rank === 1 || typeof r == "number" || Array.isArray(r) && r.length === 1) {
      if (t === 1) return Gi(_p(e), r);
      if (t === 1 / 0) return nx(_p(e), r);
      if (t === -1 / 0) return sI(_p(e), r);
      if (t === "euclidean" || t === 2) return Wv(Gi(v_(_p(e), Ro(2, "int32")), r));
      throw new Error(`Error in norm: invalid ord value: ${t}`);
    }
    if (Array.isArray(r) && r.length === 2) {
      if (t === 1) return nx(Gi(_p(e), r[0]), r[1] - 1);
      if (t === 1 / 0) return nx(Gi(_p(e), r[1]), r[0]);
      if (t === -1 / 0) return sI(Gi(_p(e), r[1]), r[0]);
      if (t === "fro" || t === "euclidean") return Wv(Gi(Xu(e), r));
      throw new Error(`Error in norm: invalid ord value: ${t}`);
    }
    throw new Error(`Error in norm: invalid axis: ${r}`);
  }
  var FI = Gr({ norm_: Ent });
  function Dnt(e, t, r, n, a = true) {
    let o = br(e, "v", "movingAverage"), s = br(t, "x", "movingAverage"), i = br(r, "decay", "movingAverage");
    KYe(o, s), zr(cx(o.shape, s.shape), () => "Shape mismatch in v and x");
    let l = Ro(1), u2 = Ji(l, i), c = ua(Ji(s, o), u2);
    if (a) {
      zr(n != null, () => "When using zeroDebias: true, step is required.");
      let f = br(n, "step", "movingAverage");
      c = Go(c, Ji(l, v_(i, f)));
    }
    return Ls(o, c);
  }
  var Hwt = Gr({ movingAverage_: Dnt });
  function Cnt(e, t, r) {
    let n = t.rank > 1 ? t.shape[t.rank - 1] : 1, a = t.rank > 1 ? t.rank - 1 : 1, o = `Must have updates.shape = indices.shape[:batchDim] + shape[sliceDim:], got updates.shape: ${r.shape}, indices.shape: ${t.shape}, shape: ${e}, sliceDim: ${n}, and batchDim: ${a}.`;
    if (r.rank < a) throw new Error(o + ` update.rank < ${a}. `);
    if (e.length < n + (r.rank - a)) throw new Error(o + ` Output shape length < ${n + (r.rank - a)}`);
    if (r.rank !== a + e.length - n) throw new Error(o + ` update.rank != ${a + e.length - n}`);
    for (let s = 0; s < a; ++s) if (r.shape[s] !== t.shape[s]) throw new Error(o + ` updates.shape[${s}] (${r.shape[s]}) != indices.shape[${s}] (${t.shape[s]}).`);
    for (let s = 0; s < r.rank - a; ++s) if (r.shape[s + a] !== e[s + n]) throw new Error(o + ` updates.shape[${s + a}] (${r.shape[s + a]}) != shape[${s + a}] (${e[s + a]})`);
  }
  function Mnt(e, t, r) {
    if (t.rank < 1) throw new Error(`tf.scatterND() expects the indices to be rank 1 or higher, but the rank was ${t.rank}.`);
    if (e.rank < 1) throw new Error(`tf.scatterND() expects the updates to be rank 1 or higher, but the rank was ${e.rank}.`);
    if (t.dtype !== "int32") throw new Error(`The dtype of 'indices' should be int32, but got dtype: ${t.dtype}`);
    if (r.length < 1) throw new Error(`Output rank must be greater or equal to 1, but got shape: ${r}`);
    if (r.length === 0) {
      if (t.size === 0) throw new Error(`Indices specified for empty output. indices shape: ${t.shape}`);
      if (e.size === 0) throw new Error(`Updates specified for empty output. updates shape: ${e.shape}`);
    }
    Cnt(r, t, e);
  }
  function Int(e, t, r) {
    let n = br(e, "indices", "scatterND", "int32"), a = br(t, "updates", "scatterND");
    Mnt(a, n, r);
    let o = { indices: n, updates: a }, s = { shape: r };
    return on.runKernel(iYe, o, s);
  }
  var qwt = Gr({ scatterND_: Int });
  function Nnt(e, t, r, n) {
    if (e.dtype !== "int32") throw new Error(`tf.sparseToDense() expects the indices to be int32 type, but the dtype was ${e.dtype}.`);
    if (e.rank > 2) throw new Error(`sparseIndices should be a scalar, vector, or matrix, but got shape ${e.shape}.`);
    let a = e.rank > 0 ? e.shape[0] : 1, o = e.rank > 1 ? e.shape[1] : 1;
    if (r.length !== o) throw new Error(`outputShape has incorrect number of elements:, ${r.length}, should be: ${o}.`);
    let s = t.size;
    if (!(t.rank === 0 || t.rank === 1 && s === a)) throw new Error(`sparseValues has incorrect shape ${t.shape}, should be [] or [${a}]`);
    if (t.dtype !== n.dtype) throw new Error("sparseValues.dtype must match defaultValues.dtype");
  }
  function Fnt(e, t, r, n = 0) {
    let a = br(e, "sparseIndices", "sparseToDense", "int32"), o = br(t, "sparseValues", "sparseToDense"), s = br(n, "defaultValue", "sparseToDense", o.dtype);
    Nnt(a, o, r, s);
    let i = { sparseIndices: a, sparseValues: o, defaultValue: s }, l = { outputShape: r };
    return on.runKernel(cYe, i, l);
  }
  var Xwt = Gr({ sparseToDense_: Fnt });
  function Ont(e, t) {
    let r = br(t, "indices", "gatherND", "int32"), a = { params: br(e, "x", "gatherND", "string_or_numeric"), indices: r };
    return on.runKernel(PKe, a);
  }
  var Kwt = Gr({ gatherND_: Ont });
  function Pnt(e, t) {
    if (t == null) return e.shape.slice();
    if (cx(e.shape, t)) return t;
    if (e.shape.length === t.length) {
      let r = [];
      for (let n = 0; n < e.shape.length; n++) t[n] == null && e.shape[n] != null ? r.push(e.shape[n]) : r.push(t[n]);
      return r;
    }
    return t;
  }
  function Lnt(e, t, r, n) {
    let a = br(e, "x", "dropout");
    if (zr(a.dtype === "float32", () => `x has to be a floating point tensor since it's going to be scaled, but got a ${a.dtype} tensor instead.`), zr(t >= 0 && t < 1, () => `rate must be a float in the range [0, 1), but got ${t}.`), t === 0) return e instanceof Xc ? a.clone() : a;
    let o = Pnt(a, r), s = 1 - t, i = Go(EI(Ls(Vrt(o, 0, 1, "float32", n), s)), s);
    return ua(a, i);
  }
  var Ywt = Gr({ dropout_: Lnt });
  function Rnt(e) {
    return Math.floor(Math.pow(2, Math.ceil(Math.log(e) / Math.log(2))));
  }
  function UZ(e, t, r) {
    let n = 1 - e % 2, a = new Float32Array(e);
    for (let o = 0; o < e; ++o) {
      let s = 2 * Math.PI * o / (e + n - 1);
      a[o] = t - r * Math.cos(s);
    }
    return tx(a, "float32");
  }
  function OI(e, t, r) {
    if (r == null || r === "linear") return e;
    if (r === "relu") return ua(e, f_(t));
    throw new Error(`Cannot compute gradient for fused activation ${r}.`);
  }
  function PI(e, t) {
    let r = t, n = dc(e.shape, t.shape);
    return n.length > 0 && (r = Gi(r, n)), Cn(r, e.shape);
  }
  function LI(e, t, r, n) {
    if (t === "linear") return e;
    if (t === "relu") return rA(e);
    if (t === "elu") return _Z(e);
    if (t === "relu6") return FZ(e);
    if (t === "prelu") return NZ(e, r);
    if (t === "leakyrelu") return TZ(e, n);
    if (t === "sigmoid") return Fg(e);
    throw new Error(`Unknown fused activation ${t}.`);
  }
  var RI = (e, t) => !(e > 0) || t === "linear";
  function znt({ x: e, filter: t, strides: r, pad: n, dataFormat: a = "NHWC", dilations: o = [1, 1], dimRoundingMode: s, bias: i, activation: l = "linear", preluActivationWeights: u2, leakyreluAlpha: c }) {
    if (l = l || "linear", RI(on.state.gradientDepth, l) === false) {
      let w = p_(e, t, r, n, a, o, s);
      return i != null && (w = Ls(w, i)), LI(w, l, u2, c);
    }
    let f = br(e, "x", "conv2d", "float32"), h = br(t, "filter", "conv2d", "float32"), p = f, d = false;
    f.rank === 3 && (d = true, p = Cn(f, [1, f.shape[0], f.shape[1], f.shape[2]])), zr(p.rank === 4, () => `Error in fused conv2d: input must be rank 4, but got rank ${p.rank}.`), zr(h.rank === 4, () => `Error in fused conv2d: filter must be rank 4, but got rank ${h.rank}.`), jf("fused conv2d", n, s), zr(p.shape[3] === h.shape[2], () => `Error in conv2d: depth of input (${p.shape[3]}) must match input depth for filter ${h.shape[2]}.`), zr(N0(r, o), () => `Error in conv2D: Either strides or dilations must be 1. Got strides ${r} and dilations '${o}'`), zr(a === "NHWC", () => `Error in conv2d: got dataFormat of ${a} but only NHWC is currently supported.`);
    let v = wI(p.shape, h.shape, r, o, n, s), m;
    i != null && (m = br(i, "bias", "fused conv2d"), [m] = lu(m, f), kl(v.outShape, m.shape));
    let g;
    u2 != null && (g = br(u2, "prelu weights", "fused conv2d"));
    let x = (w, _4) => {
      let [k, T2, A2, S2] = _4, C2 = OI(w, A2, l);
      zr(Og(o), () => `Error in gradient of fused conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${o}'`);
      let E2 = AI(T2.shape, C2, k, r, n), F13 = TI(T2, C2, k.shape, r, n), N2 = [E2, F13];
      if (S2 != null) {
        let D2 = PI(S2, C2);
        N2.push(D2);
      }
      return N2;
    }, b = { x: p, filter: h, bias: m, preluActivationWeights: g }, y = { strides: r, pad: n, dataFormat: a, dilations: o, dimRoundingMode: s, activation: l, leakyreluAlpha: c };
    return i == null ? I0((_4, k, T2) => {
      let A2 = on.runKernel(zX, b, y);
      return T2([k, _4, A2]), d && (A2 = Cn(A2, [A2.shape[1], A2.shape[2], A2.shape[3]])), { value: A2, gradFunc: x };
    })(p, h) : I0((_4, k, T2, A2) => {
      let S2 = on.runKernel(zX, b, y);
      return A2([k, _4, S2, T2]), d && (S2 = Cn(S2, [S2.shape[1], S2.shape[2], S2.shape[3]])), { value: S2, gradFunc: x };
    })(p, h, m);
  }
  var Zwt = Gr({ fusedConv2d_: znt });
  function Bnt({ x: e, filter: t, strides: r, pad: n, dataFormat: a = "NHWC", dilations: o = [1, 1], dimRoundingMode: s, bias: i, activation: l = "linear", preluActivationWeights: u2, leakyreluAlpha: c }) {
    if (RI(on.state.gradientDepth, l) === false) {
      let w = II(e, t, r, n, a, o, s);
      return i != null && (w = Ls(w, i)), LI(w, l, u2, c);
    }
    let f = br(e, "x", "depthwiseConv2d", "float32"), h = br(t, "filter", "depthwiseConv2d", "float32"), p = f, d = false;
    f.rank === 3 && (d = true, p = Cn(f, [1, f.shape[0], f.shape[1], f.shape[2]])), zr(p.rank === 4, () => `Error in fused depthwiseConv2d: input must be rank 4, but got rank ${p.rank}.`), zr(h.rank === 4, () => `Error in fused depthwiseConv2d: filter must be rank 4, but got rank ${h.rank}.`), zr(p.shape[3] === h.shape[2], () => `Error in fused depthwiseConv2d: number of input channels (${p.shape[3]}) must match the inChannels dimension in filter ${h.shape[2]}.`), o == null && (o = [1, 1]), zr(N0(r, o), () => `Error in fused depthwiseConv2d: Either strides or dilations must be 1. Got strides ${r} and dilations '${o}'`), jf("fused depthwiseConv2d", n, s);
    let v = wI(p.shape, h.shape, r, o, n, s, true), m;
    i != null && (m = br(i, "bias", "fused conv2d"), [m] = lu(m, f), kl(v.outShape, m.shape));
    let g;
    u2 != null && (g = br(u2, "prelu weights", "fused depthwiseConv2d"));
    let x = (w, _4) => {
      zr(Og(o), () => `Error in gradient of fused depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations '${o}'`);
      let [k, T2, A2, S2] = _4, C2 = OI(w, A2, l), E2 = hZ(T2.shape, C2, k, r, n, o, s), F13 = fZ(T2, C2, k.shape, r, n, o, s);
      if (S2 != null) {
        let N2 = PI(m, C2);
        return [E2, F13, N2];
      }
      return [E2, F13];
    }, b = { x: p, filter: h, bias: m, preluActivationWeights: g }, y = { strides: r, pad: n, dataFormat: a, dilations: o, dimRoundingMode: s, activation: l, leakyreluAlpha: c };
    return i == null ? I0((_4, k, T2) => {
      let A2 = on.runKernel(BX, b, y);
      return T2([k, _4, A2]), d && (A2 = Cn(A2, [A2.shape[1], A2.shape[2], A2.shape[3]])), { value: A2, gradFunc: x };
    })(p, h) : I0((_4, k, T2, A2) => {
      let S2 = on.runKernel(BX, b, y);
      return A2([k, _4, S2, T2]), d && (S2 = Cn(S2, [S2.shape[1], S2.shape[2], S2.shape[3]])), { value: S2, gradFunc: x };
    })(p, h, m);
  }
  var Jwt = Gr({ fusedDepthwiseConv2d_: Bnt });
  function Unt({ a: e, b: t, transposeA: r = false, transposeB: n = false, bias: a, activation: o = "linear", preluActivationWeights: s, leakyreluAlpha: i }) {
    if (RI(on.state.gradientDepth, o) === false) {
      let C2 = es(e, t, r, n);
      return a != null && (C2 = Ls(C2, a)), LI(C2, o, s, i);
    }
    let l = br(e, "a", "fused matMul"), u2 = br(t, "b", "fused matMul");
    [l, u2] = lu(l, u2);
    let c = r ? l.shape[l.rank - 2] : l.shape[l.rank - 1], f = n ? u2.shape[u2.rank - 1] : u2.shape[u2.rank - 2], h = r ? l.shape[l.rank - 1] : l.shape[l.rank - 2], p = n ? u2.shape[u2.rank - 2] : u2.shape[u2.rank - 1], d = l.shape.slice(0, -2), v = u2.shape.slice(0, -2), m = Uh(d), g = Uh(v);
    zr(c === f, () => `Error in fused matMul: inner shapes (${c}) and (${f}) of Tensors with shapes ${l.shape} and ${u2.shape} and transposeA=${r} and transposeB=${n} must match.`);
    let b = kl(l.shape.slice(0, -2), u2.shape.slice(0, -2)).concat([h, p]), y = r ? Cn(l, [m, c, h]) : Cn(l, [m, h, c]), w = n ? Cn(u2, [g, p, f]) : Cn(u2, [g, f, p]), _4;
    a != null && (_4 = br(a, "bias", "fused matMul"), [_4] = lu(_4, l), kl(b, _4.shape));
    let k;
    s != null && (k = br(s, "prelu weights", "fused matMul"));
    let T2 = (C2, E2) => {
      let [F13, N2, D2, I2] = E2, O2 = OI(Cn(C2, D2.shape), D2, o), L2, V2;
      if (!r && !n ? (L2 = es(O2, N2, false, true), V2 = es(F13, O2, true, false)) : !r && n ? (L2 = es(O2, N2, false, false), V2 = es(O2, F13, true, false)) : r && !n ? (L2 = es(N2, O2, false, true), V2 = es(F13, O2, false, false)) : (L2 = es(N2, O2, true, true), V2 = es(O2, F13, true, true)), a != null) {
        let W2 = PI(I2, O2);
        return [L2, V2, W2];
      } else return [L2, V2];
    }, A2 = { a: y, b: w, bias: _4, preluActivationWeights: k }, S2 = { transposeA: r, transposeB: n, activation: o, leakyreluAlpha: i };
    return a == null ? I0((E2, F13, N2) => {
      let D2 = on.runKernel(RX, A2, S2);
      return N2([E2, F13, D2]), { value: Cn(D2, b), gradFunc: T2 };
    })(y, w) : I0((E2, F13, N2, D2) => {
      let I2 = on.runKernel(RX, A2, S2);
      return D2([E2, F13, I2, N2]), { value: Cn(I2, b), gradFunc: T2 };
    })(y, w, _4);
  }
  var Qwt = Gr({ fusedMatMul_: Unt });
  function Vnt(e) {
    return UZ(e, 0.54, 0.46);
  }
  var e3t = Gr({ hammingWindow_: Vnt });
  function jnt(e) {
    return UZ(e, 0.5, 0.5);
  }
  var Wnt = Gr({ hannWindow_: jnt });
  function Gnt(e, t, r, n = false, a = 0) {
    let o = 0, s = [];
    for (; o + t <= e.size; ) s.push(ds(e, o, t)), o += r;
    if (n) for (; o < e.size; ) {
      let i = o + t - e.size, l = Vf([ds(e, o, t - i), wZ([i], a)]);
      s.push(l), o += r;
    }
    return s.length === 0 ? WT([], [0, t]) : Cn(Vf(s), [s.length, t]);
  }
  var $nt = Gr({ frame_: Gnt });
  function Hnt(e, t, r, n, a = Wnt) {
    n == null && (n = Rnt(t));
    let o = $nt(e, t, r), s = ua(o, a(t));
    return LZ(s, n);
  }
  var t3t = Gr({ stft_: Hnt });
  function qnt(e, t, r, n, a = "bilinear", o = 0) {
    let s = br(e, "image", "cropAndResize"), i = br(t, "boxes", "cropAndResize", "float32"), l = br(r, "boxInd", "cropAndResize", "int32"), u2 = i.shape[0];
    zr(s.rank === 4, () => `Error in cropAndResize: image must be rank 4,but got rank ${s.rank}.`), zr(i.rank === 2 && i.shape[1] === 4, () => `Error in cropAndResize: boxes must be have size [${u2},4] but had shape ${i.shape}.`), zr(l.rank === 1 && l.shape[0] === u2, () => `Error in cropAndResize: boxInd must be have size [${u2}] but had shape ${i.shape}.`), zr(n.length === 2, () => `Error in cropAndResize: cropSize must be of length 2, but got length ${n.length}.`), zr(n[0] >= 1 && n[1] >= 1, () => `cropSize must be atleast [1,1], but was ${n}`), zr(a === "bilinear" || a === "nearest", () => `method must be bilinear or nearest, but was ${a}`);
    let c = { image: s, boxes: i, boxInd: l }, f = { method: a, extrapolationValue: o, cropSize: n };
    return on.runKernel(_Ke, c, f);
  }
  var r3t = Gr({ cropAndResize_: qnt });
  function Xnt(e) {
    let t = br(e, "image", "flipLeftRight", "float32");
    zr(t.rank === 4, () => `Error in flipLeftRight: image must be rank 4,but got rank ${t.rank}.`);
    let r = { image: t };
    return on.runKernel(OKe, r, {});
  }
  var n3t = Gr({ flipLeftRight_: Xnt });
  function Knt(e) {
    let t = br(e, "image", "grayscaleToRGB"), r = t.rank - 1, n = t.shape[r];
    zr(t.rank >= 2, () => `Error in grayscaleToRGB: images must be at least rank 2, but got rank ${t.rank}.`), zr(n === 1, () => `Error in grayscaleToRGB: last dimension of a grayscale image should be size 1, but got size ${n}.`);
    let a = new Array(t.rank);
    return a.fill(1, 0, r), a[r] = 3, rx(t, a);
  }
  var a3t = Gr({ grayscaleToRGB_: Knt });
  function Ynt(e, t, r = 0, n = 0.5) {
    let a = br(e, "image", "rotateWithOffset", "float32");
    zr(a.rank === 4, () => `Error in rotateWithOffset: image must be rank 4,but got rank ${a.rank}.`);
    let o = { image: a }, s = { radians: t, fillValue: r, center: n };
    return on.runKernel(xYe, o, s);
  }
  var i3t = Gr({ rotateWithOffset_: Ynt });
  function zI(e, t, r, n, a, o) {
    n == null && (n = 0.5), a == null && (a = Number.NEGATIVE_INFINITY), o == null && (o = 0);
    let s = e.shape[0];
    return r = Math.min(r, s), zr(0 <= n && n <= 1, () => `iouThreshold must be in [0, 1], but was '${n}'`), zr(e.rank === 2, () => `boxes must be a 2D tensor, but was of rank '${e.rank}'`), zr(e.shape[1] === 4, () => `boxes must have 4 columns, but 2nd dimension was ${e.shape[1]}`), zr(t.rank === 1, () => "scores must be a 1D tensor"), zr(t.shape[0] === s, () => `scores has incompatible shape with boxes. Expected ${s}, but was ${t.shape[0]}`), zr(0 <= o && o <= 1, () => `softNmsSigma must be in [0, 1], but was '${o}'`), { maxOutputSize: r, iouThreshold: n, scoreThreshold: a, softNmsSigma: o };
  }
  function Znt(e, t, r, n = 0.5, a = Number.NEGATIVE_INFINITY) {
    let o = br(e, "boxes", "nonMaxSuppression", "float32"), s = br(t, "scores", "nonMaxSuppression", "float32"), i = zI(o, s, r, n, a);
    r = i.maxOutputSize, n = i.iouThreshold, a = i.scoreThreshold;
    let l = { maxOutputSize: r, iouThreshold: n, scoreThreshold: a };
    return on.runKernel(ZKe, { boxes: o, scores: s }, l);
  }
  var o3t = Gr({ nonMaxSuppression_: Znt });
  function Jnt(e, t, r, n = 0.5, a = Number.NEGATIVE_INFINITY, o = 0) {
    let s = br(e, "boxes", "nonMaxSuppression"), i = br(t, "scores", "nonMaxSuppression"), l = zI(s, i, r, n, a, o);
    r = l.maxOutputSize, n = l.iouThreshold, a = l.scoreThreshold, o = l.softNmsSigma;
    let u2 = { boxes: s, scores: i }, c = { maxOutputSize: r, iouThreshold: n, scoreThreshold: a, softNmsSigma: o }, f = on.runKernel(QKe, u2, c);
    return { selectedIndices: f[0], selectedScores: f[1] };
  }
  var s3t = Gr({ nonMaxSuppressionWithScore_: Jnt });
  function Qnt(e, t, r, n = 0.5, a = Number.NEGATIVE_INFINITY, o = false) {
    let s = br(e, "boxes", "nonMaxSuppression"), i = br(t, "scores", "nonMaxSuppression"), l = zI(s, i, r, n, a, null), u2 = l.maxOutputSize, c = l.iouThreshold, f = l.scoreThreshold, h = { boxes: s, scores: i }, p = { maxOutputSize: u2, iouThreshold: c, scoreThreshold: f, padToMaxOutputSize: o }, d = on.runKernel(JKe, h, p);
    return { selectedIndices: d[0], validOutputs: d[1] };
  }
  var l3t = Gr({ nonMaxSuppressionPadded_: Qnt });
  function eat(e, t, r = false, n = false) {
    let a = br(e, "images", "resizeBilinear");
    zr(a.rank === 3 || a.rank === 4, () => `Error in resizeBilinear: x must be rank 3 or 4, but got rank ${a.rank}.`), zr(t.length === 2, () => `Error in resizeBilinear: new shape must 2D, but got shape ${t}.`), zr(n === false || r === false, () => "Error in resizeBilinear: If halfPixelCenters is true, alignCorners must be false.");
    let o = a, s = false;
    a.rank === 3 && (s = true, o = Cn(a, [1, a.shape[0], a.shape[1], a.shape[2]]));
    let [] = t, i = { images: o }, l = { alignCorners: r, halfPixelCenters: n, size: t }, u2 = on.runKernel(yY, i, l);
    return s ? Cn(u2, [u2.shape[1], u2.shape[2], u2.shape[3]]) : u2;
  }
  var tat = Gr({ resizeBilinear_: eat });
  function rat(e, t, r = false, n = false) {
    let a = br(e, "images", "resizeNearestNeighbor");
    zr(a.rank === 3 || a.rank === 4, () => `Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank ${a.rank}.`), zr(t.length === 2, () => `Error in resizeNearestNeighbor: new shape must 2D, but got shape ${t}.`), zr(a.dtype === "float32" || a.dtype === "int32", () => "`images` must have `int32` or `float32` as dtype"), zr(n === false || r === false, () => "Error in resizeNearestNeighbor: If halfPixelCenters is true, alignCorners must be false.");
    let o = a, s = false;
    a.rank === 3 && (s = true, o = Cn(a, [1, a.shape[0], a.shape[1], a.shape[2]]));
    let [] = t, i = { images: o }, l = { alignCorners: r, halfPixelCenters: n, size: t }, u2 = on.runKernel(gY, i, l);
    return s ? Cn(u2, [u2.shape[1], u2.shape[2], u2.shape[3]]) : u2;
  }
  var nat = Gr({ resizeNearestNeighbor_: rat });
  function aat(e, t = "binary", r = false, n = 0.5) {
    let a = br(e, "image", "threshold"), o = 0.2989, s = 0.587, i = 0.114, l = a.shape[0] * a.shape[1], u2 = ua(tx([n]), 255), c, f, h, p;
    if (zr(a.rank === 3, () => `Error in threshold: image must be rank 3,but got rank ${a.rank}.`), zr(a.shape[2] === 3 || a.shape[2] === 1, () => `Error in threshold: image color channel must be equal to 3 or 1but got ${a.shape[2]}.`), zr(a.dtype === "int32" || a.dtype === "float32", () => `Error in dtype: image dtype must be int32 or float32,but got dtype ${a.dtype}.`), zr(t === "otsu" || t === "binary", () => `Method must be binary or otsu, but was ${t}`), a.shape[2] === 3) {
      [c, f, h] = ix(a, [1, 1, 1], -1);
      let m = ua(c, o), g = ua(f, s), x = ua(h, i);
      p = Ls(Ls(m, g), x);
    } else p = e;
    if (t === "otsu") {
      let m = Jet(Ii(OZ(p), "int32"), _nt([]), 256);
      u2 = iat(m, l);
    }
    let d = r ? fx(p, u2) : F0(p, u2);
    return Ii(ua(d, 255), "int32");
  }
  function iat(e, t) {
    let r = tx([-1]), n = tx([0]), a = tx([0]), o, s, i, l, u2, c;
    for (let f = 0; f < e.size - 1; f++) {
      o = ds(e, 0, f + 1), s = ds(e, f + 1), u2 = Go(Gi(o), t), c = Go(Gi(s), t);
      let h = Gi(ua(o, YT(0, o.size)));
      i = Go(h, Gi(o));
      let p = wZ(s.shape, o.size), d = Ls(YT(0, s.size), p), v = ua(s, d);
      l = Go(Gi(v), Gi(s));
      let m = Ji(i, l), g = Ji(i, l), x = ua(u2, c);
      a = ua(ua(x, m), g);
      let b = F0(a, n);
      n = Vh(b, a, n), r = Vh(b, tx([f]), r);
    }
    return r;
  }
  var u3t = Gr({ threshold_: aat });
  function oat(e, t, r = "nearest", n = "constant", a = 0, o) {
    let s = br(e, "image", "transform", "float32"), i = br(t, "transforms", "transform", "float32");
    zr(s.rank === 4, () => `Error in transform: image must be rank 4,but got rank ${s.rank}.`), zr(i.rank === 2 && (i.shape[0] === s.shape[0] || i.shape[0] === 1) && i.shape[1] === 8, () => "Error in transform: Input transform should be batch x 8 or 1 x 8"), zr(o == null || o.length === 2, () => `Error in transform: outputShape must be [height, width] or null, but got ${o}.`);
    let l = { image: s, transforms: i }, u2 = { interpolation: r, fillMode: n, fillValue: a, outputShape: o };
    return on.runKernel(gYe, l, u2);
  }
  var c3t = Gr({ transform_: oat });
  function sat(e, t, r) {
    zr(t % 1 === 0, () => `bandPart(): numLower must be an integer, got ${t}.`), zr(r % 1 === 0, () => `bandPart(): numUpper must be an integer, got ${r}.`);
    let n = br(e, "a", "bandPart");
    zr(n.rank >= 2, () => `bandPart(): Rank must be at least 2, got ${n.rank}.`);
    let a = n.shape, [o, s] = n.shape.slice(-2);
    if (!(t <= o)) throw new Error(`bandPart(): numLower (${t}) must not be greater than the number of rows (${o}).`);
    if (!(r <= s)) throw new Error(`bandPart(): numUpper (${r}) must not be greater than the number of columns (${s}).`);
    t < 0 && (t = o), r < 0 && (r = s);
    let i = Cn(YT(0, o, 1, "int32"), [-1, 1]), l = YT(0, s, 1, "int32"), u2 = Ji(i, l), c = ax(fx(u2, Ro(+t, "int32")), h_(u2, Ro(-r, "int32"))), f = sx([o, s], n.dtype);
    return Cn(ux(eA(Cn(n, [-1, o, s])).map((h) => Vh(c, h, f))), a);
  }
  var f3t = Gr({ bandPart_: sat });
  function lat(e) {
    let t;
    if (Array.isArray(e)) {
      t = false, zr(e != null && e.length > 0, () => "Gram-Schmidt process: input must not be null, undefined, or empty");
      let a = e[0].shape[0];
      for (let o = 1; o < e.length; ++o) zr(e[o].shape[0] === a, () => `Gram-Schmidt: Non-unique lengths found in the input vectors: (${e[o].shape[0]} vs. ${a})`);
    } else t = true, e = ix(e, e.shape[0], 0).map((a) => zZ(a, [0]));
    zr(e.length <= e[0].shape[0], () => `Gram-Schmidt: Number of vectors (${e.length}) exceeds number of dimensions (${e[0].shape[0]}).`);
    let r = [], n = e;
    for (let a = 0; a < e.length; ++a) r.push(on.tidy(() => {
      let o = n[a];
      if (a > 0) for (let s = 0; s < a; ++s) {
        let i = ua(Gi(ua(r[s], o)), r[s]);
        o = Ji(o, i);
      }
      return Go(o, FI(o, "euclidean"));
    }));
    return t ? ux(r, 0) : r;
  }
  var h3t = Gr({ gramSchmidt_: lat });
  function uat(e) {
    ph().getBool("DEPRECATION_WARNINGS_ENABLED") && console.warn(e + " You can disable deprecation warnings with tf.disableDeprecationWarnings().");
  }
  HYe(uat);
  function cat(e) {
    tZ(e).forEach((r) => r.dispose());
  }
  function fat(e, t = false) {
    if (zr(e.rank >= 2, () => `qr() requires input tensor to have a rank >= 2, but got rank ${e.rank}`), e.rank === 2) return nK(e, t);
    {
      let r = e.shape.slice(0, e.shape.length - 2).reduce((l, u2) => l * u2), n = eA(Cn(e, [r, e.shape[e.shape.length - 2], e.shape[e.shape.length - 1]]), 0), a = [], o = [];
      n.forEach((l) => {
        let [u2, c] = nK(l, t);
        a.push(u2), o.push(c);
      });
      let s = Cn(ux(a, 0), e.shape), i = Cn(ux(o, 0), e.shape);
      return [s, i];
    }
  }
  function nK(e, t = false) {
    return on.tidy(() => {
      zr(e.shape.length === 2, () => `qr2d() requires a 2D Tensor, but got a ${e.shape.length}D Tensor.`);
      let r = e.shape[0], n = e.shape[1], a = Ntt(r), o = o_(e), s = WT([[1]], [1, 1]), i = o_(s), l = r >= n ? n : r;
      for (let u2 = 0; u2 < l; ++u2) {
        let c = o, f = i, h = a;
        [i, o, a] = on.tidy(() => {
          let p = ds(o, [u2, u2], [r - u2, 1]), d = FI(p), v = ds(o, [u2, u2], [1, 1]), m = Vh(F0(v, 0), WT([[-1]]), WT([[1]])), g = Ji(v, ua(m, d)), x = Go(p, g);
          x.shape[0] === 1 ? i = o_(s) : i = Vf([s, ds(x, [1, 0], [x.shape[0] - 1, x.shape[1]])], 0);
          let b = pc(Go(es(m, g), d)), y = ds(o, [u2, 0], [r - u2, n]), w = ua(b, i), _4 = Pg(i);
          if (u2 === 0) o = Ji(y, es(w, es(_4, y)));
          else {
            let A2 = Ji(y, es(w, es(_4, y)));
            o = Vf([ds(o, [0, 0], [u2, n]), A2], 0);
          }
          let k = Pg(w), T2 = ds(a, [0, u2], [r, a.shape[1] - u2]);
          if (u2 === 0) a = Ji(T2, es(es(T2, i), k));
          else {
            let A2 = Ji(T2, es(es(T2, i), k));
            a = Vf([ds(a, [0, 0], [r, u2]), A2], 1);
          }
          return [i, o, a];
        }), cat([c, f, h]);
      }
      return !t && r > n && (a = ds(a, [0, 0], [r, n]), o = ds(o, [0, 0], [n, n])), [a, o];
    });
  }
  var p3t = Gr({ qr_: fat });
  var Uf;
  (function(e) {
    e[e.NONE = 0] = "NONE", e[e.MEAN = 1] = "MEAN", e[e.SUM = 2] = "SUM", e[e.SUM_BY_NONZERO_WEIGHTS = 3] = "SUM_BY_NONZERO_WEIGHTS";
  })(Uf || (Uf = {}));
  function hat(e, t, r = Uf.SUM_BY_NONZERO_WEIGHTS) {
    let n = br(e, "losses", "computeWeightedLoss"), a = null;
    t != null && (a = br(t, "weights", "computeWeightedLoss"));
    let o = a == null ? n : ua(n, a);
    if (r === Uf.NONE) return o;
    if (r === Uf.SUM) return Gi(o);
    if (r === Uf.MEAN) {
      if (a == null) return KT(o);
      {
        let s = n.size / a.size, i = Go(Gi(o), Gi(a));
        return s > 1 ? Go(i, Ro(s)) : i;
      }
    }
    if (r === Uf.SUM_BY_NONZERO_WEIGHTS) {
      if (a == null) return Go(Gi(o), Ro(n.size));
      {
        let s = ua(a, d_(n.shape)), i = Ii(Gi(IZ(s, Ro(0))), "float32");
        return Go(Gi(o), i);
      }
    }
    throw Error(`Unknown reduction: ${r}`);
  }
  var $v = Gr({ computeWeightedLoss_: hat });
  function pat(e, t, r, n = Uf.SUM_BY_NONZERO_WEIGHTS) {
    let a = br(e, "labels", "absoluteDifference"), o = br(t, "predictions", "absoluteDifference"), s = null;
    r != null && (s = br(r, "weights", "absoluteDifference")), Zd(a.shape, o.shape, "Error in absoluteDifference: ");
    let i = _p(Ji(a, o));
    return $v(i, s, n);
  }
  var d3t = Gr({ absoluteDifference_: pat });
  function dat(e, t, r, n, a = Uf.SUM_BY_NONZERO_WEIGHTS) {
    let o = br(e, "labels", "cosineDistance"), s = br(t, "predictions", "cosineDistance"), i = null;
    n != null && (i = br(n, "weights", "cosineDistance")), Zd(o.shape, s.shape, "Error in cosineDistance: ");
    let l = Ro(1), u2 = Ji(l, Gi(ua(o, s), r, true));
    return $v(u2, i, a);
  }
  var v3t = Gr({ cosineDistance_: dat });
  function vat(e, t, r, n = Uf.SUM_BY_NONZERO_WEIGHTS) {
    let a = br(e, "labels", "hingeLoss"), o = br(t, "predictions", "hingeLoss"), s = null;
    r != null && (s = br(r, "weights", "hingeLoss")), Zd(a.shape, o.shape, "Error in hingeLoss: ");
    let i = Ro(1);
    a = Ji(ua(Ro(2), a), i);
    let l = rA(Ji(i, ua(a, o)));
    return $v(l, s, n);
  }
  var m3t = Gr({ hingeLoss_: vat });
  function mat(e, t, r, n = 1, a = Uf.SUM_BY_NONZERO_WEIGHTS) {
    let o = br(e, "labels", "huberLoss"), s = br(t, "predictions", "huberLoss"), i = null;
    r != null && (i = br(r, "weights", "huberLoss")), Zd(o.shape, s.shape, "Error in huberLoss: ");
    let l = Ro(n), u2 = _p(Ji(s, o)), c = MZ(u2, l), f = Ji(u2, c), h = Ls(ua(Ro(0.5), Xu(c)), ua(l, f));
    return $v(h, i, a);
  }
  var g3t = Gr({ huberLoss_: mat });
  function gat(e, t, r, n = 1e-7, a = Uf.SUM_BY_NONZERO_WEIGHTS) {
    let o = br(e, "labels", "logLoss"), s = br(t, "predictions", "logLoss"), i = null;
    r != null && (i = br(r, "weights", "logLoss")), Zd(o.shape, s.shape, "Error in logLoss: ");
    let l = Ro(1), u2 = Ro(n), c = pc(ua(o, lx(Ls(s, u2)))), f = ua(Ji(l, o), lx(Ls(Ji(l, s), u2))), h = Ji(c, f);
    return $v(h, i, a);
  }
  var y3t = Gr({ logLoss_: gat });
  function yat(e, t, r, n = Uf.SUM_BY_NONZERO_WEIGHTS) {
    let a = br(e, "labels", "meanSquaredError"), o = br(t, "predictions", "meanSquaredError"), s = null;
    r != null && (s = br(r, "weights", "meanSquaredError")), Zd(a.shape, o.shape, "Error in meanSquaredError: ");
    let i = RZ(a, o);
    return $v(i, s, n);
  }
  var x3t = Gr({ meanSquaredError_: yat });
  function xat(e, t) {
    let r = br(e, "labels", "sigmoidCrossEntropyWithLogits"), n = br(t, "logits", "sigmoidCrossEntropyWithLogits");
    Zd(r.shape, n.shape, "Error in sigmoidCrossEntropyWithLogits: ");
    let a = rA(n), o = ua(n, r), s = AZ(gd(pc(_p(n))));
    return Ls(Ji(a, o), s);
  }
  function bat(e, t, r, n = 0, a = Uf.SUM_BY_NONZERO_WEIGHTS) {
    let o = br(e, "multiClassLabels", "sigmoidCrossEntropy"), s = br(t, "logits", "sigmoidCrossEntropy"), i = null;
    if (r != null && (i = br(r, "weights", "sigmoidCrossEntropy")), Zd(o.shape, s.shape, "Error in sigmoidCrossEntropy: "), n > 0) {
      let u2 = Ro(n), c = Ro(1), f = Ro(0.5);
      o = Ls(ua(o, Ji(c, u2)), ua(f, u2));
    }
    let l = xat(o, s);
    return $v(l, i, a);
  }
  var b3t = Gr({ sigmoidCrossEntropy_: bat });
  function _at(e, t, r = -1) {
    if (r === -1 && (r = t.rank - 1), r !== t.rank - 1) throw Error(`Softmax cross entropy along a non-last dimension is not yet supported. Labels / logits was rank ${t.rank} and dim was ${r}`);
    return I0((a, o, s) => {
      let l = EZ(o, [r], true), u2 = Ji(Ii(o, "float32"), l);
      s([a, u2]);
      let c = pc(ua(u2, a));
      return { value: Gi(c, [r]), gradFunc: (p, d) => {
        let [v, m] = d, g = ox(p.shape, [r]);
        return [ua(Cn(p, g), Ji(Ii(v, "float32"), gd(m))), ua(Cn(p, g), Ji(gd(m), Ii(v, "float32")))];
      } };
    })(e, t);
  }
  function wat(e, t, r, n = 0, a = Uf.SUM_BY_NONZERO_WEIGHTS) {
    let o = br(e, "onehotLabels", "softmaxCrossEntropy"), s = br(t, "logits", "softmaxCrossEntropy"), i = null;
    if (r != null && (i = br(r, "weights", "softmaxCrossEntropy")), Zd(o.shape, s.shape, "Error in softmaxCrossEntropy: "), n > 0) {
      let u2 = Ro(n), c = Ro(1), f = Ro(o.shape[1]);
      o = Ls(ua(o, Ji(c, u2)), Go(u2, f));
    }
    let l = _at(o, s);
    return $v(l, i, a);
  }
  var _3t = Gr({ softmaxCrossEntropy_: wat });
  function kat(e, t, r, n) {
    let a = br(e, "indices", "sparseFillEmptyRows", "int32"), o = br(t, "values", "sparseFillEmptyRows"), s = br(r, "denseShape", "sparseFillEmptyRows", "int32"), i = br(n, "defaultValue", "sparseFillEmptyRows", o.dtype);
    if (a.rank !== 2) throw new Error(`Indices should be Tensor2D but received shape
        ${a.shape}`);
    if (o.rank !== 1) throw new Error(`Values should be Tensor1D but received shape ${o.shape}`);
    if (s.rank !== 1) throw new Error(`Dense shape should be Tensor1D but received shape ${s.shape}`);
    if (i.rank !== 0) throw new Error(`Default value should be a scalar but received shape ${i.shape}`);
    let l = { indices: a, values: o, denseShape: s, defaultValue: i }, u2 = on.runKernel(oYe, l);
    return { outputIndices: u2[0], outputValues: u2[1], emptyRowIndicator: u2[2], reverseIndexMap: u2[3] };
  }
  var w3t = Gr({ sparseFillEmptyRows_: kat });
  function Tat(e, t, r) {
    let n = br(e, "inputIndices", "sparseReshape", "int32"), a = br(t, "inputShape", "sparseReshape", "int32"), o = br(r, "newShape", "sparseReshape", "int32");
    if (n.rank !== 2) throw new Error(`Input indices should be Tensor2D but received shape
        ${n.shape}`);
    if (a.rank !== 1) throw new Error(`Input shape should be Tensor1D but received shape ${a.shape}`);
    if (o.rank !== 1) throw new Error(`New shape should be Tensor1D but received shape ${o.shape}`);
    let s = { inputIndices: n, inputShape: a, newShape: o }, i = on.runKernel(sYe, s);
    return { outputIndices: i[0], outputShape: i[1] };
  }
  var k3t = Gr({ sparseReshape_: Tat });
  function Aat(e, t, r) {
    let n = br(e, "data", "sparseSegmentMean"), a = br(t, "indices", "sparseSegmentMean", "int32"), o = br(r, "segmentIds", "sparseSegmentMean", "int32");
    if (n.rank < 1) throw new Error("Data should be at least 1 dimensional but received scalar");
    if (a.rank !== 1) throw new Error(`Indices should be Tensor1D but received shape
          ${a.shape}`);
    if (o.rank !== 1) throw new Error(`Segment ids should be Tensor1D but received shape
          ${o.shape}`);
    let s = { data: n, indices: a, segmentIds: o };
    return on.runKernel(lYe, s);
  }
  var T3t = Gr({ sparseSegmentMean_: Aat });
  function Sat(e, t, r) {
    let n = br(e, "data", "sparseSegmentSum"), a = br(t, "indices", "sparseSegmentSum", "int32"), o = br(r, "segmentIds", "sparseSegmentSum", "int32");
    if (n.rank < 1) throw new Error("Data should be at least 1 dimensional but received scalar");
    if (a.rank !== 1) throw new Error(`Indices should be Tensor1D but received shape
         ${a.shape}`);
    if (o.rank !== 1) throw new Error(`Segment ids should be Tensor1D but received shape
         ${o.shape}`);
    let s = { data: n, indices: a, segmentIds: o };
    return on.runKernel(uYe, s);
  }
  var A3t = Gr({ sparseSegmentSum_: Sat });
  function Eat(e, t, r, n, a, o, s, i) {
    let l = br(e, "data", "stringNGrams", "string");
    if (l.dtype !== "string") throw new Error("Data must be of datatype string");
    if (l.shape.length !== 1) throw new Error(`Data must be a vector, saw: ${l.shape}`);
    let u2 = br(t, "dataSplits", "stringNGrams");
    if (u2.dtype !== "int32") throw new Error("Data splits must be of datatype int32");
    let c = { separator: r, nGramWidths: n, leftPad: a, rightPad: o, padWidth: s, preserveShortSequences: i }, f = { data: l, dataSplits: u2 }, h = on.runKernel(pYe, f, c);
    return { nGrams: h[0], nGramsSplits: h[1] };
  }
  var S3t = Gr({ stringNGrams_: Eat });
  function Dat(e, t, r = true) {
    let n = br(e, "input", "stringSplit", "string"), a = br(t, "delimiter", "stringSplit", "string");
    if (n.rank !== 1) throw new Error(`Input should be Tensor1D but received shape ${n.shape}`);
    if (a.rank !== 0) throw new Error(`Delimiter should be a scalar but received shape ${a.shape}`);
    let o = { skipEmpty: r }, s = { input: n, delimiter: a }, i = on.runKernel(dYe, s, o);
    return { indices: i[0], values: i[1], shape: i[2] };
  }
  var E3t = Gr({ stringSplit_: Dat });
  function Cat(e, t) {
    let r = br(e, "input", "stringToHashBucketFast", "string"), n = { numBuckets: t };
    if (t <= 0) throw new Error("Number of buckets must be at least 1");
    let a = { input: r };
    return on.runKernel(vYe, a, n);
  }
  var D3t = Gr({ stringToHashBucketFast_: Cat });
  Vn().prototype.abs = function() {
    return this.throwIfDisposed(), _p(this);
  };
  Vn().prototype.acos = function() {
    return this.throwIfDisposed(), xet(this);
  };
  Vn().prototype.acosh = function() {
    return this.throwIfDisposed(), _et(this);
  };
  Vn().prototype.add = function(e) {
    return this.throwIfDisposed(), Ls(this, e);
  };
  Vn().prototype.all = function(e, t) {
    return this.throwIfDisposed(), Tet(this, e, t);
  };
  Vn().prototype.any = function(e, t) {
    return this.throwIfDisposed(), Eet(this, e, t);
  };
  Vn().prototype.argMax = function(e) {
    return this.throwIfDisposed(), Cet(this, e);
  };
  Vn().prototype.argMin = function(e) {
    return this.throwIfDisposed(), Iet(this, e);
  };
  Vn().prototype.asScalar = function() {
    return this.throwIfDisposed(), zr(this.size === 1, () => "The array must have only 1 element."), Cn(this, []);
  };
  Vn().prototype.asType = function(e) {
    return this.throwIfDisposed(), Ii(this, e);
  };
  Vn().prototype.as1D = function() {
    return this.throwIfDisposed(), Cn(this, [this.size]);
  };
  Vn().prototype.as2D = function(e, t) {
    return this.throwIfDisposed(), Cn(this, [e, t]);
  };
  Vn().prototype.as3D = function(e, t, r) {
    return this.throwIfDisposed(), Cn(this, [e, t, r]);
  };
  Vn().prototype.as4D = function(e, t, r, n) {
    return this.throwIfDisposed(), Cn(this, [e, t, r, n]);
  };
  Vn().prototype.as5D = function(e, t, r, n, a) {
    return this.throwIfDisposed(), Cn(this, [e, t, r, n, a]);
  };
  Vn().prototype.asin = function() {
    return this.throwIfDisposed(), Fet(this);
  };
  Vn().prototype.asinh = function() {
    return this.throwIfDisposed(), Pet(this);
  };
  Vn().prototype.atan = function() {
    return this.throwIfDisposed(), Ret(this);
  };
  Vn().prototype.atan2 = function(e) {
    return this.throwIfDisposed(), Bet(this, e);
  };
  Vn().prototype.atanh = function() {
    return this.throwIfDisposed(), Vet(this);
  };
  Vn().prototype.avgPool = function(e, t, r, n) {
    return this.throwIfDisposed(), bZ(this, e, t, r, n);
  };
  Vn().prototype.batchToSpaceND = function(e, t) {
    return this.throwIfDisposed(), MI(this, e, t);
  };
  Vn().prototype.batchNorm = function(e, t, r, n, a) {
    return this.throwIfDisposed(), tA(this, e, t, r, n, a);
  };
  Vn().prototype.broadcastTo = function(e) {
    return this.throwIfDisposed(), jT(this, e);
  };
  Vn().prototype.cast = function(e) {
    return this.throwIfDisposed(), Ii(this, e);
  };
  Vn().prototype.ceil = function() {
    return this.throwIfDisposed(), ttt(this);
  };
  Vn().prototype.clipByValue = function(e, t) {
    return this.throwIfDisposed(), ntt(this, e, t);
  };
  Vn().prototype.concat = function(e, t) {
    return this.throwIfDisposed(), e instanceof Xc && (e = [e]), Vf([this, ...e], t);
  };
  Vn().prototype.conv1d = function(e, t, r, n, a, o) {
    return this.throwIfDisposed(), utt(this, e, t, r, n, a, o);
  };
  Vn().prototype.conv2dTranspose = function(e, t, r, n, a) {
    return this.throwIfDisposed(), ftt(this, e, t, r, n, a);
  };
  Vn().prototype.conv2d = function(e, t, r, n, a, o) {
    return this.throwIfDisposed(), p_(this, e, t, r, n, a, o);
  };
  Vn().prototype.cos = function() {
    return this.throwIfDisposed(), CI(this);
  };
  Vn().prototype.cosh = function() {
    return this.throwIfDisposed(), gZ(this);
  };
  Vn().prototype.cumsum = function(e, t, r) {
    return this.throwIfDisposed(), cZ(this, e, t, r);
  };
  Vn().prototype.depthToSpace = function(e, t) {
    return this.throwIfDisposed(), mtt(this, e, t);
  };
  Vn().prototype.depthwiseConv2d = function(e, t, r, n, a, o) {
    return this.throwIfDisposed(), II(this, e, t, r, n, a, o);
  };
  Vn().prototype.dilation2d = function(e, t, r, n, a) {
    return this.throwIfDisposed(), btt(this, e, t, r, n, a);
  };
  Vn().prototype.divNoNan = function(e) {
    return this.throwIfDisposed(), wtt(this, e);
  };
  Vn().prototype.div = function(e) {
    return this.throwIfDisposed(), Go(this, e);
  };
  Vn().prototype.dot = function(e) {
    return this.throwIfDisposed(), Ttt(this, e);
  };
  Vn().prototype.elu = function() {
    return this.throwIfDisposed(), _Z(this);
  };
  Vn().prototype.equal = function(e) {
    return this.throwIfDisposed(), SI(this, e);
  };
  Vn().prototype.erf = function() {
    return this.throwIfDisposed(), Dtt(this);
  };
  Vn().prototype.exp = function() {
    return this.throwIfDisposed(), gd(this);
  };
  Vn().prototype.expandDims = function(e) {
    return this.throwIfDisposed(), Vv(this, e);
  };
  Vn().prototype.expm1 = function() {
    return this.throwIfDisposed(), Mtt(this);
  };
  Vn().prototype.fft = function() {
    return this.throwIfDisposed(), PZ(this);
  };
  Vn().prototype.flatten = function() {
    return this.throwIfDisposed(), Cn(this, [this.size]);
  };
  Vn().prototype.floor = function() {
    return this.throwIfDisposed(), EI(this);
  };
  Vn().prototype.floorDiv = function(e) {
    return this.throwIfDisposed(), iZ(this, e);
  };
  Vn().prototype.gather = function(e, t) {
    return this.throwIfDisposed(), yZ(this, e, t);
  };
  Vn().prototype.greaterEqual = function(e) {
    return this.throwIfDisposed(), h_(this, e);
  };
  Vn().prototype.greater = function(e) {
    return this.throwIfDisposed(), F0(this, e);
  };
  Vn().prototype.ifft = function() {
    return this.throwIfDisposed(), fI(this);
  };
  Vn().prototype.irfft = function() {
    return this.throwIfDisposed(), pnt(this);
  };
  Vn().prototype.isFinite = function() {
    return this.throwIfDisposed(), Ptt(this);
  };
  Vn().prototype.isInf = function() {
    return this.throwIfDisposed(), Rtt(this);
  };
  Vn().prototype.isNaN = function() {
    return this.throwIfDisposed(), Btt(this);
  };
  Vn().prototype.leakyRelu = function(e) {
    return this.throwIfDisposed(), TZ(this, e);
  };
  Vn().prototype.lessEqual = function(e) {
    return this.throwIfDisposed(), fx(this, e);
  };
  Vn().prototype.less = function(e) {
    return this.throwIfDisposed(), mZ(this, e);
  };
  Vn().prototype.localResponseNormalization = function(e, t, r, n) {
    return this.throwIfDisposed(), jtt(this, e, t, r, n);
  };
  Vn().prototype.logSigmoid = function() {
    return this.throwIfDisposed(), Htt(this);
  };
  Vn().prototype.logSoftmax = function(e) {
    return this.throwIfDisposed(), Ktt(this, e);
  };
  Vn().prototype.logSumExp = function(e, t) {
    return this.throwIfDisposed(), EZ(this, e, t);
  };
  Vn().prototype.log = function() {
    return this.throwIfDisposed(), lx(this);
  };
  Vn().prototype.log1p = function() {
    return this.throwIfDisposed(), AZ(this);
  };
  Vn().prototype.logicalAnd = function(e) {
    return this.throwIfDisposed(), ax(this, e);
  };
  Vn().prototype.logicalNot = function() {
    return this.throwIfDisposed(), DI(this);
  };
  Vn().prototype.logicalOr = function(e) {
    return this.throwIfDisposed(), DZ(this, e);
  };
  Vn().prototype.logicalXor = function(e) {
    return this.throwIfDisposed(), Qtt(this, e);
  };
  Vn().prototype.matMul = function(e, t, r) {
    return this.throwIfDisposed(), es(this, e, t, r);
  };
  Vn().prototype.maxPool = function(e, t, r, n) {
    return this.throwIfDisposed(), CZ(this, e, t, r, n);
  };
  Vn().prototype.max = function(e, t) {
    return this.throwIfDisposed(), nx(this, e, t);
  };
  Vn().prototype.maximum = function(e) {
    return this.throwIfDisposed(), xZ(this, e);
  };
  Vn().prototype.mean = function(e, t) {
    return this.throwIfDisposed(), KT(this, e, t);
  };
  Vn().prototype.min = function(e, t) {
    return this.throwIfDisposed(), sI(this, e, t);
  };
  Vn().prototype.minimum = function(e) {
    return this.throwIfDisposed(), MZ(this, e);
  };
  Vn().prototype.mirrorPad = function(e, t) {
    return this.throwIfDisposed(), srt(this, e, t);
  };
  Vn().prototype.mod = function(e) {
    return this.throwIfDisposed(), urt(this, e);
  };
  Vn().prototype.mul = function(e) {
    return this.throwIfDisposed(), ua(this, e);
  };
  Vn().prototype.neg = function() {
    return this.throwIfDisposed(), pc(this);
  };
  Vn().prototype.norm = function(e, t, r) {
    return this.throwIfDisposed(), FI(this, e, t, r);
  };
  Vn().prototype.notEqual = function(e) {
    return this.throwIfDisposed(), IZ(this, e);
  };
  Vn().prototype.oneHot = function(e, t = 1, r = 0) {
    return this.throwIfDisposed(), vrt(this, e, t, r);
  };
  Vn().prototype.onesLike = function() {
    return this.throwIfDisposed(), grt(this);
  };
  Vn().prototype.pad = function(e, t) {
    return this.throwIfDisposed(), hx(this, e, t);
  };
  Vn().prototype.pool = function(e, t, r, n, a, o) {
    return this.throwIfDisposed(), Srt(this, e, t, r, n, a, o);
  };
  Vn().prototype.pow = function(e) {
    return this.throwIfDisposed(), v_(this, e);
  };
  Vn().prototype.prelu = function(e) {
    return this.throwIfDisposed(), NZ(this, e);
  };
  Vn().prototype.prod = function(e, t) {
    return this.throwIfDisposed(), Crt(this, e, t);
  };
  Vn().prototype.reciprocal = function() {
    return this.throwIfDisposed(), Grt(this);
  };
  Vn().prototype.relu = function() {
    return this.throwIfDisposed(), rA(this);
  };
  Vn().prototype.relu6 = function() {
    return this.throwIfDisposed(), FZ(this);
  };
  Vn().prototype.reshapeAs = function(e) {
    return this.throwIfDisposed(), Cn(this, e.shape);
  };
  Vn().prototype.reshape = function(e) {
    return this.throwIfDisposed(), Cn(this, e);
  };
  Vn().prototype.resizeBilinear = function(e, t, r) {
    return this.throwIfDisposed(), tat(this, e, t, r);
  };
  Vn().prototype.resizeNearestNeighbor = function(e, t, r) {
    return this.throwIfDisposed(), nat(this, e, t, r);
  };
  Vn().prototype.reverse = function(e) {
    return this.throwIfDisposed(), Gv(this, e);
  };
  Vn().prototype.rfft = function() {
    return this.throwIfDisposed(), LZ(this);
  };
  Vn().prototype.round = function() {
    return this.throwIfDisposed(), OZ(this);
  };
  Vn().prototype.rsqrt = function() {
    return this.throwIfDisposed(), pZ(this);
  };
  Vn().prototype.selu = function() {
    return this.throwIfDisposed(), Qrt(this);
  };
  Vn().prototype.separableConv2d = function(e, t, r, n, a, o) {
    return this.throwIfDisposed(), tnt(this, e, t, r, n, a, o);
  };
  Vn().prototype.sigmoid = function() {
    return this.throwIfDisposed(), Fg(this);
  };
  Vn().prototype.sign = function() {
    return this.throwIfDisposed(), nnt(this);
  };
  Vn().prototype.sin = function() {
    return this.throwIfDisposed(), sZ(this);
  };
  Vn().prototype.sinh = function() {
    return this.throwIfDisposed(), lZ(this);
  };
  Vn().prototype.slice = function(e, t) {
    return this.throwIfDisposed(), ds(this, e, t);
  };
  Vn().prototype.softmax = function(e) {
    return this.throwIfDisposed(), unt(this, e);
  };
  Vn().prototype.softplus = function() {
    return this.throwIfDisposed(), SZ(this);
  };
  Vn().prototype.spaceToBatchND = function(e, t) {
    return this.throwIfDisposed(), kI(this, e, t);
  };
  Vn().prototype.split = function(e, t) {
    return this.throwIfDisposed(), ix(this, e, t);
  };
  Vn().prototype.sqrt = function() {
    return this.throwIfDisposed(), Wv(this);
  };
  Vn().prototype.square = function() {
    return this.throwIfDisposed(), Xu(this);
  };
  Vn().prototype.squaredDifference = function(e) {
    return this.throwIfDisposed(), RZ(this, e);
  };
  Vn().prototype.squeeze = function(e) {
    return this.throwIfDisposed(), zZ(this, e);
  };
  Vn().prototype.stack = function(e, t) {
    this.throwIfDisposed();
    let r = e instanceof Xc ? [this, e] : [this, ...e];
    return ux(r, t);
  };
  Vn().prototype.step = function(e) {
    return this.throwIfDisposed(), f_(this, e);
  };
  Vn().prototype.stridedSlice = function(e, t, r, n, a, o, s, i) {
    return this.throwIfDisposed(), ynt(this, e, t, r, n, a, o, s, i);
  };
  Vn().prototype.sub = function(e) {
    return this.throwIfDisposed(), Ji(this, e);
  };
  Vn().prototype.sum = function(e, t) {
    return this.throwIfDisposed(), Gi(this, e, t);
  };
  Vn().prototype.tan = function() {
    return this.throwIfDisposed(), bnt(this);
  };
  Vn().prototype.tanh = function() {
    return this.throwIfDisposed(), oI(this);
  };
  Vn().prototype.tile = function(e) {
    return this.throwIfDisposed(), rx(this, e);
  };
  Vn().prototype.toBool = function() {
    return this.throwIfDisposed(), Ii(this, "bool");
  };
  Vn().prototype.toFloat = function() {
    return this.throwIfDisposed(), Ii(this, "float32");
  };
  Vn().prototype.toInt = function() {
    return this.throwIfDisposed(), Ii(this, "int32");
  };
  Vn().prototype.topk = function(e, t) {
    return this.throwIfDisposed(), knt(this, e, t);
  };
  Vn().prototype.transpose = function(e) {
    return this.throwIfDisposed(), Pg(this, e);
  };
  Vn().prototype.unique = function(e) {
    return this.throwIfDisposed(), Snt(this, e);
  };
  Vn().prototype.unsortedSegmentSum = function(e, t) {
    return this.throwIfDisposed(), dZ(this, e, t);
  };
  Vn().prototype.unstack = function(e) {
    return this.throwIfDisposed(), eA(this, e);
  };
  Vn().prototype.where = function(e, t) {
    return this.throwIfDisposed(), Vh(e, this, t);
  };
  Vn().prototype.zerosLike = function() {
    return this.throwIfDisposed(), Wl(this);
  };
  var Mat = "3.13.0";
  var Iat = { "tfjs-core": H6.version_core, "tfjs-backend-cpu": lKe.version_cpu, "tfjs-backend-webgl": uKe.version_webgl, "tfjs-data": iK.version_data, "tfjs-layers": q6.version_layers, "tfjs-converter": X6.version_converter, tfjs: Mat };
  Object.keys(H6).forEach(function(e) {
    e !== "default" && Object.defineProperty(zg, e, { enumerable: true, get: function() {
      return H6[e];
    } });
  });
  Object.keys(q6).forEach(function(e) {
    e !== "default" && Object.defineProperty(zg, e, { enumerable: true, get: function() {
      return q6[e];
    } });
  });
  Object.keys(X6).forEach(function(e) {
    e !== "default" && Object.defineProperty(zg, e, { enumerable: true, get: function() {
      return X6[e];
    } });
  });
  zg.data = iK;
  zg.version = Iat;
});
var vJ = ri(($I, dJ) => {
  "use strict";
  (function(e, t) {
    typeof define == "function" && define.amd ? define([], t) : typeof $I == "object" ? dJ.exports = t() : e.typed = t();
  })($I, function() {
    function e() {
      return true;
    }
    function t() {
      return false;
    }
    function r() {
    }
    function n() {
      var a = [{ name: "number", test: function(ce) {
        return typeof ce == "number";
      } }, { name: "string", test: function(ce) {
        return typeof ce == "string";
      } }, { name: "boolean", test: function(ce) {
        return typeof ce == "boolean";
      } }, { name: "Function", test: function(ce) {
        return typeof ce == "function";
      } }, { name: "Array", test: Array.isArray }, { name: "Date", test: function(ce) {
        return ce instanceof Date;
      } }, { name: "RegExp", test: function(ce) {
        return ce instanceof RegExp;
      } }, { name: "Object", test: function(ce) {
        return typeof ce == "object" && ce !== null && ce.constructor === Object;
      } }, { name: "null", test: function(ce) {
        return ce === null;
      } }, { name: "undefined", test: function(ce) {
        return ce === void 0;
      } }], o = { name: "any", test: e }, s = [], i = [], l = { types: a, conversions: i, ignore: s };
      function u2(ce) {
        var se = Z2(l.types, function(me) {
          return me.name === ce;
        });
        if (se) return se;
        if (ce === "any") return o;
        var he = Z2(l.types, function(me) {
          return me.name.toLowerCase() === ce.toLowerCase();
        });
        throw new TypeError('Unknown type "' + ce + '"' + (he ? '. Did you mean "' + he.name + '"?' : ""));
      }
      function c(ce) {
        return ce === o ? 999 : l.types.indexOf(ce);
      }
      function f(ce) {
        var se = Z2(l.types, function(he) {
          return he.test(ce);
        });
        if (se) return se.name;
        throw new TypeError("Value has unknown type. Value: " + ce);
      }
      function h(ce, se) {
        if (!ce.signatures) throw new TypeError("Function is no typed-function");
        var he;
        if (typeof se == "string") {
          he = se.split(",");
          for (var me = 0; me < he.length; me++) he[me] = he[me].trim();
        } else if (Array.isArray(se)) he = se;
        else throw new TypeError("String array or a comma separated string expected");
        var we = he.join(","), be = ce.signatures[we];
        if (be) return be;
        throw new TypeError("Signature not found (signature: " + (ce.name || "unnamed") + "(" + he.join(", ") + "))");
      }
      function p(ce, se) {
        var he = f(ce);
        if (se === he) return ce;
        for (var me = 0; me < l.conversions.length; me++) {
          var we = l.conversions[me];
          if (we.from === he && we.to === se) return we.convert(ce);
        }
        throw new Error("Cannot convert from " + he + " to " + se);
      }
      function d(ce) {
        return ce.map(function(se) {
          var he = se.types.map(k);
          return (se.restParam ? "..." : "") + he.join("|");
        }).join(",");
      }
      function v(ce, se) {
        var he = ce.indexOf("...") === 0, me = he ? ce.length > 3 ? ce.slice(3) : "any" : ce, we = me.split("|").map(K2).filter(q).filter(Y2), be = D2(se, we), Ae = we.map(function(ve) {
          var Ee = u2(ve);
          return { name: ve, typeIndex: c(Ee), test: Ee.test, conversion: null, conversionIndex: -1 };
        }), pe = be.map(function(ve) {
          var Ee = u2(ve.from);
          return { name: ve.from, typeIndex: c(Ee), test: Ee.test, conversion: ve, conversionIndex: se.indexOf(ve) };
        });
        return { types: Ae.concat(pe), restParam: he };
      }
      function m(ce, se, he) {
        var me = [];
        return ce.trim() !== "" && (me = ce.split(",").map(K2).map(function(we, be, Ae) {
          var pe = v(we, he);
          if (pe.restParam && be !== Ae.length - 1) throw new SyntaxError('Unexpected rest parameter "' + we + '": only allowed for the last parameter');
          return pe;
        })), me.some(R2) ? null : { params: me, fn: se };
      }
      function g(ce) {
        var se = H2(ce);
        return se ? se.restParam : false;
      }
      function x(ce) {
        return ce.types.some(function(se) {
          return se.conversion != null;
        });
      }
      function b(ce) {
        if (!ce || ce.types.length === 0) return e;
        if (ce.types.length === 1) return u2(ce.types[0].name).test;
        if (ce.types.length === 2) {
          var se = u2(ce.types[0].name).test, he = u2(ce.types[1].name).test;
          return function(be) {
            return se(be) || he(be);
          };
        } else {
          var me = ce.types.map(function(we) {
            return u2(we.name).test;
          });
          return function(be) {
            for (var Ae = 0; Ae < me.length; Ae++) if (me[Ae](be)) return true;
            return false;
          };
        }
      }
      function y(ce) {
        var se, he, me;
        if (g(ce)) {
          se = z(ce).map(b);
          var we = se.length, be = b(H2(ce)), Ae = function(pe) {
            for (var ve = we; ve < pe.length; ve++) if (!be(pe[ve])) return false;
            return true;
          };
          return function(ve) {
            for (var Ee = 0; Ee < se.length; Ee++) if (!se[Ee](ve[Ee])) return false;
            return Ae(ve) && ve.length >= we + 1;
          };
        } else return ce.length === 0 ? function(ve) {
          return ve.length === 0;
        } : ce.length === 1 ? (he = b(ce[0]), function(ve) {
          return he(ve[0]) && ve.length === 1;
        }) : ce.length === 2 ? (he = b(ce[0]), me = b(ce[1]), function(ve) {
          return he(ve[0]) && me(ve[1]) && ve.length === 2;
        }) : (se = ce.map(b), function(ve) {
          for (var Ee = 0; Ee < se.length; Ee++) if (!se[Ee](ve[Ee])) return false;
          return ve.length === se.length;
        });
      }
      function w(ce, se) {
        return se < ce.params.length ? ce.params[se] : g(ce.params) ? H2(ce.params) : null;
      }
      function _4(ce, se, he) {
        var me = w(ce, se), we = me ? he ? me.types.filter(T2) : me.types : [];
        return we.map(k);
      }
      function k(ce) {
        return ce.name;
      }
      function T2(ce) {
        return ce.conversion === null || ce.conversion === void 0;
      }
      function A2(ce, se) {
        var he = ne(ae(ce, function(me) {
          return _4(me, se, false);
        }));
        return he.indexOf("any") !== -1 ? ["any"] : he;
      }
      function S2(ce, se, he) {
        var me, we, be = ce || "unnamed", Ae = he, pe;
        for (pe = 0; pe < se.length; pe++) {
          var ve = Ae.filter(function(Be) {
            var Ue = b(w(Be, pe));
            return (pe < Be.params.length || g(Be.params)) && Ue(se[pe]);
          });
          if (ve.length === 0) {
            if (we = A2(Ae, pe), we.length > 0) {
              var Ee = f(se[pe]);
              return me = new TypeError("Unexpected type of argument in function " + be + " (expected: " + we.join(" or ") + ", actual: " + Ee + ", index: " + pe + ")"), me.data = { category: "wrongType", fn: be, index: pe, actual: Ee, expected: we }, me;
            }
          } else Ae = ve;
        }
        var Se = Ae.map(function(Be) {
          return g(Be.params) ? 1 / 0 : Be.params.length;
        });
        if (se.length < Math.min.apply(null, Se)) return we = A2(Ae, pe), me = new TypeError("Too few arguments in function " + be + " (expected: " + we.join(" or ") + ", index: " + se.length + ")"), me.data = { category: "tooFewArgs", fn: be, index: se.length, expected: we }, me;
        var Ce = Math.max.apply(null, Se);
        return se.length > Ce ? (me = new TypeError("Too many arguments in function " + be + " (expected: " + Ce + ", actual: " + se.length + ")"), me.data = { category: "tooManyArgs", fn: be, index: se.length, expectedLength: Ce }, me) : (me = new TypeError('Arguments of type "' + se.join(", ") + '" do not match any of the defined signatures of function ' + be + "."), me.data = { category: "mismatch", actual: se.map(f) }, me);
      }
      function C2(ce) {
        for (var se = 999, he = 0; he < ce.types.length; he++) T2(ce.types[he]) && (se = Math.min(se, ce.types[he].typeIndex));
        return se;
      }
      function E2(ce) {
        for (var se = 999, he = 0; he < ce.types.length; he++) T2(ce.types[he]) || (se = Math.min(se, ce.types[he].conversionIndex));
        return se;
      }
      function F13(ce, se) {
        var he;
        return he = ce.restParam - se.restParam, he !== 0 || (he = x(ce) - x(se), he !== 0) || (he = C2(ce) - C2(se), he !== 0) ? he : E2(ce) - E2(se);
      }
      function N2(ce, se) {
        var he = Math.min(ce.params.length, se.params.length), me, we;
        if (we = ce.params.some(x) - se.params.some(x), we !== 0) return we;
        for (me = 0; me < he; me++) if (we = x(ce.params[me]) - x(se.params[me]), we !== 0) return we;
        for (me = 0; me < he; me++) if (we = F13(ce.params[me], se.params[me]), we !== 0) return we;
        return ce.params.length - se.params.length;
      }
      function D2(ce, se) {
        var he = {};
        return ce.forEach(function(me) {
          se.indexOf(me.from) === -1 && se.indexOf(me.to) !== -1 && !he[me.from] && (he[me.from] = me);
        }), Object.keys(he).map(function(me) {
          return he[me];
        });
      }
      function I2(ce, se) {
        var he = se;
        if (ce.some(x)) {
          var me = g(ce), we = ce.map(O2);
          he = function() {
            for (var ve = [], Ee = me ? arguments.length - 1 : arguments.length, Se = 0; Se < Ee; Se++) ve[Se] = we[Se](arguments[Se]);
            return me && (ve[Ee] = arguments[Ee].map(we[Ee])), se.apply(this, ve);
          };
        }
        var be = he;
        if (g(ce)) {
          var Ae = ce.length - 1;
          be = function() {
            return he.apply(this, te(arguments, 0, Ae).concat([te(arguments, Ae)]));
          };
        }
        return be;
      }
      function O2(ce) {
        var se, he, me, we, be = [], Ae = [];
        switch (ce.types.forEach(function(pe) {
          pe.conversion && (be.push(u2(pe.conversion.from).test), Ae.push(pe.conversion.convert));
        }), Ae.length) {
          case 0:
            return function(ve) {
              return ve;
            };
          case 1:
            return se = be[0], me = Ae[0], function(ve) {
              return se(ve) ? me(ve) : ve;
            };
          case 2:
            return se = be[0], he = be[1], me = Ae[0], we = Ae[1], function(ve) {
              return se(ve) ? me(ve) : he(ve) ? we(ve) : ve;
            };
          default:
            return function(ve) {
              for (var Ee = 0; Ee < Ae.length; Ee++) if (be[Ee](ve)) return Ae[Ee](ve);
              return ve;
            };
        }
      }
      function L2(ce) {
        var se = {};
        return ce.forEach(function(he) {
          he.params.some(x) || V2(he.params, true).forEach(function(me) {
            se[d(me)] = he.fn;
          });
        }), se;
      }
      function V2(ce, se) {
        function he(me, we, be) {
          if (we < me.length) {
            var Ae = me[we], pe = se ? Ae.types.filter(T2) : Ae.types, ve;
            if (Ae.restParam) {
              var Ee = pe.filter(T2);
              ve = Ee.length < pe.length ? [Ee, pe] : [pe];
            } else ve = pe.map(function(Ce) {
              return [Ce];
            });
            return ae(ve, function(Ce) {
              return he(me, we + 1, be.concat([Ce]));
            });
          } else {
            var Se = be.map(function(Ce, Be) {
              return { types: Ce, restParam: Be === me.length - 1 && g(me) };
            });
            return [Se];
          }
        }
        return he(ce, 0, []);
      }
      function W2(ce, se) {
        for (var he = Math.max(ce.params.length, se.params.length), me = 0; me < he; me++) {
          var we = _4(ce, me, true), be = _4(se, me, true);
          if (!Q2(we, be)) return false;
        }
        var Ae = ce.params.length, pe = se.params.length, ve = g(ce.params), Ee = g(se.params);
        return ve ? Ee ? Ae === pe : pe >= Ae : Ee ? Ae >= pe : Ae === pe;
      }
      function X2(ce, se) {
        if (Object.keys(se).length === 0) throw new SyntaxError("No signatures provided");
        var he = [];
        Object.keys(se).map(function(je) {
          return m(je, se[je], l.conversions);
        }).filter(re).forEach(function(je) {
          var rt = Z2(he, function(He) {
            return W2(He, je);
          });
          if (rt) throw new TypeError('Conflicting signatures "' + d(rt.params) + '" and "' + d(je.params) + '".');
          he.push(je);
        });
        var me = ae(he, function(je) {
          var rt = je ? V2(je.params, false) : [];
          return rt.map(function(He) {
            return { params: He, fn: je.fn };
          });
        }).filter(re);
        me.sort(N2);
        var we = me[0] && me[0].params.length <= 2 && !g(me[0].params), be = me[1] && me[1].params.length <= 2 && !g(me[1].params), Ae = me[2] && me[2].params.length <= 2 && !g(me[2].params), pe = me[3] && me[3].params.length <= 2 && !g(me[3].params), ve = me[4] && me[4].params.length <= 2 && !g(me[4].params), Ee = me[5] && me[5].params.length <= 2 && !g(me[5].params), Se = we && be && Ae && pe && ve && Ee, Ce = me.map(function(je) {
          return y(je.params);
        }), Be = we ? b(me[0].params[0]) : t, Ue = be ? b(me[1].params[0]) : t, Ke = Ae ? b(me[2].params[0]) : t, ct = pe ? b(me[3].params[0]) : t, We = ve ? b(me[4].params[0]) : t, Ze = Ee ? b(me[5].params[0]) : t, it = we ? b(me[0].params[1]) : t, ot = be ? b(me[1].params[1]) : t, mt = Ae ? b(me[2].params[1]) : t, wt = pe ? b(me[3].params[1]) : t, Et = ve ? b(me[4].params[1]) : t, zt = Ee ? b(me[5].params[1]) : t, Nt = me.map(function(je) {
          return I2(je.params, je.fn);
        }), yt = we ? Nt[0] : r, pt = be ? Nt[1] : r, Ot = Ae ? Nt[2] : r, Jt = pe ? Nt[3] : r, tr = ve ? Nt[4] : r, Ye = Ee ? Nt[5] : r, at = we ? me[0].params.length : -1, Ge = be ? me[1].params.length : -1, st = Ae ? me[2].params.length : -1, Ie = pe ? me[3].params.length : -1, Pe = ve ? me[4].params.length : -1, $e = Ee ? me[5].params.length : -1, Ve = Se ? 6 : 0, ut = me.length, Re = function() {
          "use strict";
          for (var rt = Ve; rt < ut; rt++) if (Ce[rt](arguments)) return Nt[rt].apply(this, arguments);
          throw S2(ce, arguments, me);
        }, qe = function je(rt, He) {
          "use strict";
          return arguments.length === at && Be(rt) && it(He) ? yt.apply(je, arguments) : arguments.length === Ge && Ue(rt) && ot(He) ? pt.apply(je, arguments) : arguments.length === st && Ke(rt) && mt(He) ? Ot.apply(je, arguments) : arguments.length === Ie && ct(rt) && wt(He) ? Jt.apply(je, arguments) : arguments.length === Pe && We(rt) && Et(He) ? tr.apply(je, arguments) : arguments.length === $e && Ze(rt) && zt(He) ? Ye.apply(je, arguments) : Re.apply(je, arguments);
        };
        try {
          Object.defineProperty(qe, "name", { value: ce });
        } catch {
        }
        return qe.signatures = L2(me), qe;
      }
      function Y2(ce) {
        return l.ignore.indexOf(ce) === -1;
      }
      function K2(ce) {
        return ce.trim();
      }
      function q(ce) {
        return !!ce;
      }
      function re(ce) {
        return ce !== null;
      }
      function R2(ce) {
        return ce.types.length === 0;
      }
      function z(ce) {
        return ce.slice(0, ce.length - 1);
      }
      function H2(ce) {
        return ce[ce.length - 1];
      }
      function te(ce, se, he) {
        return Array.prototype.slice.call(ce, se, he);
      }
      function j(ce, se) {
        return ce.indexOf(se) !== -1;
      }
      function Q2(ce, se) {
        for (var he = 0; he < ce.length; he++) if (j(se, ce[he])) return true;
        return false;
      }
      function Z2(ce, se) {
        for (var he = 0; he < ce.length; he++) if (se(ce[he])) return ce[he];
      }
      function ne(ce) {
        for (var se = {}, he = 0; he < ce.length; he++) se[ce[he]] = true;
        return Object.keys(se);
      }
      function ae(ce, se) {
        return Array.prototype.concat.apply([], ce.map(se));
      }
      function ue(ce) {
        for (var se = "", he = 0; he < ce.length; he++) {
          var me = ce[he];
          if ((typeof me.signatures == "object" || typeof me.signature == "string") && me.name !== "") {
            if (se === "") se = me.name;
            else if (se !== me.name) {
              var we = new Error("Function names do not match (expected: " + se + ", actual: " + me.name + ")");
              throw we.data = { actual: me.name, expected: se }, we;
            }
          }
        }
        return se;
      }
      function le(ce) {
        var se, he = {};
        function me(pe, ve) {
          if (he.hasOwnProperty(pe) && ve !== he[pe]) throw se = new Error('Signature "' + pe + '" is defined twice'), se.data = { signature: pe }, se;
        }
        for (var we = 0; we < ce.length; we++) {
          var be = ce[we];
          if (typeof be.signatures == "object") for (var Ae in be.signatures) be.signatures.hasOwnProperty(Ae) && (me(Ae, be.signatures[Ae]), he[Ae] = be.signatures[Ae]);
          else if (typeof be.signature == "string") me(be.signature, be), he[be.signature] = be;
          else throw se = new TypeError("Function is no typed-function (index: " + we + ")"), se.data = { index: we }, se;
        }
        return he;
      }
      return l = X2("typed", { "string, Object": X2, Object: function(ce) {
        var se = [];
        for (var he in ce) ce.hasOwnProperty(he) && se.push(ce[he]);
        var me = ue(se);
        return X2(me, ce);
      }, "...Function": function(ce) {
        return X2(ue(ce), le(ce));
      }, "string, ...Function": function(ce, se) {
        return X2(ce, le(se));
      } }), l.create = n, l.types = a, l.conversions = i, l.ignore = s, l.convert = p, l.find = h, l.addType = function(ce, se) {
        if (!ce || typeof ce.name != "string" || typeof ce.test != "function") throw new TypeError("Object with properties {name: string, test: function} expected");
        if (se !== false) {
          for (var he = 0; he < l.types.length; he++) if (l.types[he].name === "Object") {
            l.types.splice(he, 0, ce);
            return;
          }
        }
        l.types.push(ce);
      }, l.addConversion = function(ce) {
        if (!ce || typeof ce.from != "string" || typeof ce.to != "string" || typeof ce.convert != "function") throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");
        l.conversions.push(ce);
      }, l;
    }
    return n();
  });
});
var BJ = ri((zJ, uA) => {
  (function(e) {
    "use strict";
    var t = 9e15, r = 1e9, n = "0123456789abcdef", a = "2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058", o = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789", s = { precision: 20, rounding: 4, modulo: 1, toExpNeg: -7, toExpPos: 21, minE: -t, maxE: t, crypto: false }, i, l, u2, c, f = true, h = "[DecimalError] ", p = h + "Invalid argument: ", d = h + "Precision limit exceeded", v = h + "crypto unavailable", m = "[object Decimal]", g = Math.floor, x = Math.pow, b = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i, y = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i, w = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i, _4 = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, k = 1e7, T2 = 7, A2 = 9007199254740991, S2 = a.length - 1, C2 = o.length - 1, E2 = { toStringTag: m };
    E2.absoluteValue = E2.abs = function() {
      var xe = new this.constructor(this);
      return xe.s < 0 && (xe.s = 1), V2(xe);
    }, E2.ceil = function() {
      return V2(new this.constructor(this), this.e + 1, 2);
    }, E2.clampedTo = E2.clamp = function(xe, Ne) {
      var ke, Me = this, Le = Me.constructor;
      if (xe = new Le(xe), Ne = new Le(Ne), !xe.s || !Ne.s) return new Le(NaN);
      if (xe.gt(Ne)) throw Error(p + Ne);
      return ke = Me.cmp(xe), ke < 0 ? xe : Me.cmp(Ne) > 0 ? Ne : new Le(Me);
    }, E2.comparedTo = E2.cmp = function(xe) {
      var Ne, ke, Me, Le, ze = this, ft = ze.d, De = (xe = new ze.constructor(xe)).d, Je = ze.s, tt = xe.s;
      if (!ft || !De) return !Je || !tt ? NaN : Je !== tt ? Je : ft === De ? 0 : !ft ^ Je < 0 ? 1 : -1;
      if (!ft[0] || !De[0]) return ft[0] ? Je : De[0] ? -tt : 0;
      if (Je !== tt) return Je;
      if (ze.e !== xe.e) return ze.e > xe.e ^ Je < 0 ? 1 : -1;
      for (Me = ft.length, Le = De.length, Ne = 0, ke = Me < Le ? Me : Le; Ne < ke; ++Ne) if (ft[Ne] !== De[Ne]) return ft[Ne] > De[Ne] ^ Je < 0 ? 1 : -1;
      return Me === Le ? 0 : Me > Le ^ Je < 0 ? 1 : -1;
    }, E2.cosine = E2.cos = function() {
      var xe, Ne, ke = this, Me = ke.constructor;
      return ke.d ? ke.d[0] ? (xe = Me.precision, Ne = Me.rounding, Me.precision = xe + Math.max(ke.e, ke.sd()) + T2, Me.rounding = 1, ke = O2(Me, ce(Me, ke)), Me.precision = xe, Me.rounding = Ne, V2(c == 2 || c == 3 ? ke.neg() : ke, xe, Ne, true)) : new Me(1) : new Me(NaN);
    }, E2.cubeRoot = E2.cbrt = function() {
      var xe, Ne, ke, Me, Le, ze, ft, De, Je, tt, vt = this, kt = vt.constructor;
      if (!vt.isFinite() || vt.isZero()) return new kt(vt);
      for (f = false, ze = vt.s * x(vt.s * vt, 1 / 3), !ze || Math.abs(ze) == 1 / 0 ? (ke = F13(vt.d), xe = vt.e, (ze = (xe - ke.length + 1) % 3) && (ke += ze == 1 || ze == -2 ? "0" : "00"), ze = x(ke, 1 / 3), xe = g((xe + 1) / 3) - (xe % 3 == (xe < 0 ? -1 : 2)), ze == 1 / 0 ? ke = "5e" + xe : (ke = ze.toExponential(), ke = ke.slice(0, ke.indexOf("e") + 1) + xe), Me = new kt(ke), Me.s = vt.s) : Me = new kt(ze.toString()), ft = (xe = kt.precision) + 3; ; ) if (De = Me, Je = De.times(De).times(De), tt = Je.plus(vt), Me = L2(tt.plus(vt).times(De), tt.plus(Je), ft + 2, 1), F13(De.d).slice(0, ft) === (ke = F13(Me.d)).slice(0, ft)) if (ke = ke.slice(ft - 3, ft + 1), ke == "9999" || !Le && ke == "4999") {
        if (!Le && (V2(De, xe + 1, 0), De.times(De).times(De).eq(vt))) {
          Me = De;
          break;
        }
        ft += 4, Le = 1;
      } else {
        (!+ke || !+ke.slice(1) && ke.charAt(0) == "5") && (V2(Me, xe + 1, 1), Ne = !Me.times(Me).times(Me).eq(vt));
        break;
      }
      return f = true, V2(Me, xe, kt.rounding, Ne);
    }, E2.decimalPlaces = E2.dp = function() {
      var xe, Ne = this.d, ke = NaN;
      if (Ne) {
        if (xe = Ne.length - 1, ke = (xe - g(this.e / T2)) * T2, xe = Ne[xe], xe) for (; xe % 10 == 0; xe /= 10) ke--;
        ke < 0 && (ke = 0);
      }
      return ke;
    }, E2.dividedBy = E2.div = function(xe) {
      return L2(this, new this.constructor(xe));
    }, E2.dividedToIntegerBy = E2.divToInt = function(xe) {
      var Ne = this, ke = Ne.constructor;
      return V2(L2(Ne, new ke(xe), 0, 1, 1), ke.precision, ke.rounding);
    }, E2.equals = E2.eq = function(xe) {
      return this.cmp(xe) === 0;
    }, E2.floor = function() {
      return V2(new this.constructor(this), this.e + 1, 3);
    }, E2.greaterThan = E2.gt = function(xe) {
      return this.cmp(xe) > 0;
    }, E2.greaterThanOrEqualTo = E2.gte = function(xe) {
      var Ne = this.cmp(xe);
      return Ne == 1 || Ne === 0;
    }, E2.hyperbolicCosine = E2.cosh = function() {
      var xe, Ne, ke, Me, Le, ze = this, ft = ze.constructor, De = new ft(1);
      if (!ze.isFinite()) return new ft(ze.s ? 1 / 0 : NaN);
      if (ze.isZero()) return De;
      ke = ft.precision, Me = ft.rounding, ft.precision = ke + Math.max(ze.e, ze.sd()) + 4, ft.rounding = 1, Le = ze.d.length, Le < 32 ? (xe = Math.ceil(Le / 3), Ne = (1 / le(4, xe)).toString()) : (xe = 16, Ne = "2.3283064365386962890625e-10"), ze = ue(ft, 1, ze.times(Ne), new ft(1), true);
      for (var Je, tt = xe, vt = new ft(8); tt--; ) Je = ze.times(ze), ze = De.minus(Je.times(vt.minus(Je.times(vt))));
      return V2(ze, ft.precision = ke, ft.rounding = Me, true);
    }, E2.hyperbolicSine = E2.sinh = function() {
      var xe, Ne, ke, Me, Le = this, ze = Le.constructor;
      if (!Le.isFinite() || Le.isZero()) return new ze(Le);
      if (Ne = ze.precision, ke = ze.rounding, ze.precision = Ne + Math.max(Le.e, Le.sd()) + 4, ze.rounding = 1, Me = Le.d.length, Me < 3) Le = ue(ze, 2, Le, Le, true);
      else {
        xe = 1.4 * Math.sqrt(Me), xe = xe > 16 ? 16 : xe | 0, Le = Le.times(1 / le(5, xe)), Le = ue(ze, 2, Le, Le, true);
        for (var ft, De = new ze(5), Je = new ze(16), tt = new ze(20); xe--; ) ft = Le.times(Le), Le = Le.times(De.plus(ft.times(Je.times(ft).plus(tt))));
      }
      return ze.precision = Ne, ze.rounding = ke, V2(Le, Ne, ke, true);
    }, E2.hyperbolicTangent = E2.tanh = function() {
      var xe, Ne, ke = this, Me = ke.constructor;
      return ke.isFinite() ? ke.isZero() ? new Me(ke) : (xe = Me.precision, Ne = Me.rounding, Me.precision = xe + 7, Me.rounding = 1, L2(ke.sinh(), ke.cosh(), Me.precision = xe, Me.rounding = Ne)) : new Me(ke.s);
    }, E2.inverseCosine = E2.acos = function() {
      var xe, Ne = this, ke = Ne.constructor, Me = Ne.abs().cmp(1), Le = ke.precision, ze = ke.rounding;
      return Me !== -1 ? Me === 0 ? Ne.isNeg() ? K2(ke, Le, ze) : new ke(0) : new ke(NaN) : Ne.isZero() ? K2(ke, Le + 4, ze).times(0.5) : (ke.precision = Le + 6, ke.rounding = 1, Ne = Ne.asin(), xe = K2(ke, Le + 4, ze).times(0.5), ke.precision = Le, ke.rounding = ze, xe.minus(Ne));
    }, E2.inverseHyperbolicCosine = E2.acosh = function() {
      var xe, Ne, ke = this, Me = ke.constructor;
      return ke.lte(1) ? new Me(ke.eq(1) ? 0 : NaN) : ke.isFinite() ? (xe = Me.precision, Ne = Me.rounding, Me.precision = xe + Math.max(Math.abs(ke.e), ke.sd()) + 4, Me.rounding = 1, f = false, ke = ke.times(ke).minus(1).sqrt().plus(ke), f = true, Me.precision = xe, Me.rounding = Ne, ke.ln()) : new Me(ke);
    }, E2.inverseHyperbolicSine = E2.asinh = function() {
      var xe, Ne, ke = this, Me = ke.constructor;
      return !ke.isFinite() || ke.isZero() ? new Me(ke) : (xe = Me.precision, Ne = Me.rounding, Me.precision = xe + 2 * Math.max(Math.abs(ke.e), ke.sd()) + 6, Me.rounding = 1, f = false, ke = ke.times(ke).plus(1).sqrt().plus(ke), f = true, Me.precision = xe, Me.rounding = Ne, ke.ln());
    }, E2.inverseHyperbolicTangent = E2.atanh = function() {
      var xe, Ne, ke, Me, Le = this, ze = Le.constructor;
      return Le.isFinite() ? Le.e >= 0 ? new ze(Le.abs().eq(1) ? Le.s / 0 : Le.isZero() ? Le : NaN) : (xe = ze.precision, Ne = ze.rounding, Me = Le.sd(), Math.max(Me, xe) < 2 * -Le.e - 1 ? V2(new ze(Le), xe, Ne, true) : (ze.precision = ke = Me - Le.e, Le = L2(Le.plus(1), new ze(1).minus(Le), ke + xe, 1), ze.precision = xe + 4, ze.rounding = 1, Le = Le.ln(), ze.precision = xe, ze.rounding = Ne, Le.times(0.5))) : new ze(NaN);
    }, E2.inverseSine = E2.asin = function() {
      var xe, Ne, ke, Me, Le = this, ze = Le.constructor;
      return Le.isZero() ? new ze(Le) : (Ne = Le.abs().cmp(1), ke = ze.precision, Me = ze.rounding, Ne !== -1 ? Ne === 0 ? (xe = K2(ze, ke + 4, Me).times(0.5), xe.s = Le.s, xe) : new ze(NaN) : (ze.precision = ke + 6, ze.rounding = 1, Le = Le.div(new ze(1).minus(Le.times(Le)).sqrt().plus(1)).atan(), ze.precision = ke, ze.rounding = Me, Le.times(2)));
    }, E2.inverseTangent = E2.atan = function() {
      var xe, Ne, ke, Me, Le, ze, ft, De, Je, tt = this, vt = tt.constructor, kt = vt.precision, jt = vt.rounding;
      if (tt.isFinite()) {
        if (tt.isZero()) return new vt(tt);
        if (tt.abs().eq(1) && kt + 4 <= C2) return ft = K2(vt, kt + 4, jt).times(0.25), ft.s = tt.s, ft;
      } else {
        if (!tt.s) return new vt(NaN);
        if (kt + 4 <= C2) return ft = K2(vt, kt + 4, jt).times(0.5), ft.s = tt.s, ft;
      }
      for (vt.precision = De = kt + 10, vt.rounding = 1, ke = Math.min(28, De / T2 + 2 | 0), xe = ke; xe; --xe) tt = tt.div(tt.times(tt).plus(1).sqrt().plus(1));
      for (f = false, Ne = Math.ceil(De / T2), Me = 1, Je = tt.times(tt), ft = new vt(tt), Le = tt; xe !== -1; ) if (Le = Le.times(Je), ze = ft.minus(Le.div(Me += 2)), Le = Le.times(Je), ft = ze.plus(Le.div(Me += 2)), ft.d[Ne] !== void 0) for (xe = Ne; ft.d[xe] === ze.d[xe] && xe--; ) ;
      return ke && (ft = ft.times(2 << ke - 1)), f = true, V2(ft, vt.precision = kt, vt.rounding = jt, true);
    }, E2.isFinite = function() {
      return !!this.d;
    }, E2.isInteger = E2.isInt = function() {
      return !!this.d && g(this.e / T2) > this.d.length - 2;
    }, E2.isNaN = function() {
      return !this.s;
    }, E2.isNegative = E2.isNeg = function() {
      return this.s < 0;
    }, E2.isPositive = E2.isPos = function() {
      return this.s > 0;
    }, E2.isZero = function() {
      return !!this.d && this.d[0] === 0;
    }, E2.lessThan = E2.lt = function(xe) {
      return this.cmp(xe) < 0;
    }, E2.lessThanOrEqualTo = E2.lte = function(xe) {
      return this.cmp(xe) < 1;
    }, E2.logarithm = E2.log = function(xe) {
      var Ne, ke, Me, Le, ze, ft, De, Je, tt = this, vt = tt.constructor, kt = vt.precision, jt = vt.rounding, Vt = 5;
      if (xe == null) xe = new vt(10), Ne = true;
      else {
        if (xe = new vt(xe), ke = xe.d, xe.s < 0 || !ke || !ke[0] || xe.eq(1)) return new vt(NaN);
        Ne = xe.eq(10);
      }
      if (ke = tt.d, tt.s < 0 || !ke || !ke[0] || tt.eq(1)) return new vt(ke && !ke[0] ? -1 / 0 : tt.s != 1 ? NaN : ke ? 0 : 1 / 0);
      if (Ne) if (ke.length > 1) ze = true;
      else {
        for (Le = ke[0]; Le % 10 === 0; ) Le /= 10;
        ze = Le !== 1;
      }
      if (f = false, De = kt + Vt, ft = j(tt, De), Me = Ne ? Y2(vt, De + 10) : j(xe, De), Je = L2(ft, Me, De, 1), D2(Je.d, Le = kt, jt)) do
        if (De += 10, ft = j(tt, De), Me = Ne ? Y2(vt, De + 10) : j(xe, De), Je = L2(ft, Me, De, 1), !ze) {
          +F13(Je.d).slice(Le + 1, Le + 15) + 1 == 1e14 && (Je = V2(Je, kt + 1, 0));
          break;
        }
      while (D2(Je.d, Le += 10, jt));
      return f = true, V2(Je, kt, jt);
    }, E2.minus = E2.sub = function(xe) {
      var Ne, ke, Me, Le, ze, ft, De, Je, tt, vt, kt, jt, Vt = this, Kt = Vt.constructor;
      if (xe = new Kt(xe), !Vt.d || !xe.d) return !Vt.s || !xe.s ? xe = new Kt(NaN) : Vt.d ? xe.s = -xe.s : xe = new Kt(xe.d || Vt.s !== xe.s ? Vt : NaN), xe;
      if (Vt.s != xe.s) return xe.s = -xe.s, Vt.plus(xe);
      if (tt = Vt.d, jt = xe.d, De = Kt.precision, Je = Kt.rounding, !tt[0] || !jt[0]) {
        if (jt[0]) xe.s = -xe.s;
        else if (tt[0]) xe = new Kt(Vt);
        else return new Kt(Je === 3 ? -0 : 0);
        return f ? V2(xe, De, Je) : xe;
      }
      if (ke = g(xe.e / T2), vt = g(Vt.e / T2), tt = tt.slice(), ze = vt - ke, ze) {
        for (kt = ze < 0, kt ? (Ne = tt, ze = -ze, ft = jt.length) : (Ne = jt, ke = vt, ft = tt.length), Me = Math.max(Math.ceil(De / T2), ft) + 2, ze > Me && (ze = Me, Ne.length = 1), Ne.reverse(), Me = ze; Me--; ) Ne.push(0);
        Ne.reverse();
      } else {
        for (Me = tt.length, ft = jt.length, kt = Me < ft, kt && (ft = Me), Me = 0; Me < ft; Me++) if (tt[Me] != jt[Me]) {
          kt = tt[Me] < jt[Me];
          break;
        }
        ze = 0;
      }
      for (kt && (Ne = tt, tt = jt, jt = Ne, xe.s = -xe.s), ft = tt.length, Me = jt.length - ft; Me > 0; --Me) tt[ft++] = 0;
      for (Me = jt.length; Me > ze; ) {
        if (tt[--Me] < jt[Me]) {
          for (Le = Me; Le && tt[--Le] === 0; ) tt[Le] = k - 1;
          --tt[Le], tt[Me] += k;
        }
        tt[Me] -= jt[Me];
      }
      for (; tt[--ft] === 0; ) tt.pop();
      for (; tt[0] === 0; tt.shift()) --ke;
      return tt[0] ? (xe.d = tt, xe.e = X2(tt, ke), f ? V2(xe, De, Je) : xe) : new Kt(Je === 3 ? -0 : 0);
    }, E2.modulo = E2.mod = function(xe) {
      var Ne, ke = this, Me = ke.constructor;
      return xe = new Me(xe), !ke.d || !xe.s || xe.d && !xe.d[0] ? new Me(NaN) : !xe.d || ke.d && !ke.d[0] ? V2(new Me(ke), Me.precision, Me.rounding) : (f = false, Me.modulo == 9 ? (Ne = L2(ke, xe.abs(), 0, 3, 1), Ne.s *= xe.s) : Ne = L2(ke, xe, 0, Me.modulo, 1), Ne = Ne.times(xe), f = true, ke.minus(Ne));
    }, E2.naturalExponential = E2.exp = function() {
      return te(this);
    }, E2.naturalLogarithm = E2.ln = function() {
      return j(this);
    }, E2.negated = E2.neg = function() {
      var xe = new this.constructor(this);
      return xe.s = -xe.s, V2(xe);
    }, E2.plus = E2.add = function(xe) {
      var Ne, ke, Me, Le, ze, ft, De, Je, tt, vt, kt = this, jt = kt.constructor;
      if (xe = new jt(xe), !kt.d || !xe.d) return !kt.s || !xe.s ? xe = new jt(NaN) : kt.d || (xe = new jt(xe.d || kt.s === xe.s ? kt : NaN)), xe;
      if (kt.s != xe.s) return xe.s = -xe.s, kt.minus(xe);
      if (tt = kt.d, vt = xe.d, De = jt.precision, Je = jt.rounding, !tt[0] || !vt[0]) return vt[0] || (xe = new jt(kt)), f ? V2(xe, De, Je) : xe;
      if (ze = g(kt.e / T2), Me = g(xe.e / T2), tt = tt.slice(), Le = ze - Me, Le) {
        for (Le < 0 ? (ke = tt, Le = -Le, ft = vt.length) : (ke = vt, Me = ze, ft = tt.length), ze = Math.ceil(De / T2), ft = ze > ft ? ze + 1 : ft + 1, Le > ft && (Le = ft, ke.length = 1), ke.reverse(); Le--; ) ke.push(0);
        ke.reverse();
      }
      for (ft = tt.length, Le = vt.length, ft - Le < 0 && (Le = ft, ke = vt, vt = tt, tt = ke), Ne = 0; Le; ) Ne = (tt[--Le] = tt[Le] + vt[Le] + Ne) / k | 0, tt[Le] %= k;
      for (Ne && (tt.unshift(Ne), ++Me), ft = tt.length; tt[--ft] == 0; ) tt.pop();
      return xe.d = tt, xe.e = X2(tt, Me), f ? V2(xe, De, Je) : xe;
    }, E2.precision = E2.sd = function(xe) {
      var Ne, ke = this;
      if (xe !== void 0 && xe !== !!xe && xe !== 1 && xe !== 0) throw Error(p + xe);
      return ke.d ? (Ne = q(ke.d), xe && ke.e + 1 > Ne && (Ne = ke.e + 1)) : Ne = NaN, Ne;
    }, E2.round = function() {
      var xe = this, Ne = xe.constructor;
      return V2(new Ne(xe), xe.e + 1, Ne.rounding);
    }, E2.sine = E2.sin = function() {
      var xe, Ne, ke = this, Me = ke.constructor;
      return ke.isFinite() ? ke.isZero() ? new Me(ke) : (xe = Me.precision, Ne = Me.rounding, Me.precision = xe + Math.max(ke.e, ke.sd()) + T2, Me.rounding = 1, ke = ae(Me, ce(Me, ke)), Me.precision = xe, Me.rounding = Ne, V2(c > 2 ? ke.neg() : ke, xe, Ne, true)) : new Me(NaN);
    }, E2.squareRoot = E2.sqrt = function() {
      var xe, Ne, ke, Me, Le, ze, ft = this, De = ft.d, Je = ft.e, tt = ft.s, vt = ft.constructor;
      if (tt !== 1 || !De || !De[0]) return new vt(!tt || tt < 0 && (!De || De[0]) ? NaN : De ? ft : 1 / 0);
      for (f = false, tt = Math.sqrt(+ft), tt == 0 || tt == 1 / 0 ? (Ne = F13(De), (Ne.length + Je) % 2 == 0 && (Ne += "0"), tt = Math.sqrt(Ne), Je = g((Je + 1) / 2) - (Je < 0 || Je % 2), tt == 1 / 0 ? Ne = "5e" + Je : (Ne = tt.toExponential(), Ne = Ne.slice(0, Ne.indexOf("e") + 1) + Je), Me = new vt(Ne)) : Me = new vt(tt.toString()), ke = (Je = vt.precision) + 3; ; ) if (ze = Me, Me = ze.plus(L2(ft, ze, ke + 2, 1)).times(0.5), F13(ze.d).slice(0, ke) === (Ne = F13(Me.d)).slice(0, ke)) if (Ne = Ne.slice(ke - 3, ke + 1), Ne == "9999" || !Le && Ne == "4999") {
        if (!Le && (V2(ze, Je + 1, 0), ze.times(ze).eq(ft))) {
          Me = ze;
          break;
        }
        ke += 4, Le = 1;
      } else {
        (!+Ne || !+Ne.slice(1) && Ne.charAt(0) == "5") && (V2(Me, Je + 1, 1), xe = !Me.times(Me).eq(ft));
        break;
      }
      return f = true, V2(Me, Je, vt.rounding, xe);
    }, E2.tangent = E2.tan = function() {
      var xe, Ne, ke = this, Me = ke.constructor;
      return ke.isFinite() ? ke.isZero() ? new Me(ke) : (xe = Me.precision, Ne = Me.rounding, Me.precision = xe + 10, Me.rounding = 1, ke = ke.sin(), ke.s = 1, ke = L2(ke, new Me(1).minus(ke.times(ke)).sqrt(), xe + 10, 0), Me.precision = xe, Me.rounding = Ne, V2(c == 2 || c == 4 ? ke.neg() : ke, xe, Ne, true)) : new Me(NaN);
    }, E2.times = E2.mul = function(xe) {
      var Ne, ke, Me, Le, ze, ft, De, Je, tt, vt = this, kt = vt.constructor, jt = vt.d, Vt = (xe = new kt(xe)).d;
      if (xe.s *= vt.s, !jt || !jt[0] || !Vt || !Vt[0]) return new kt(!xe.s || jt && !jt[0] && !Vt || Vt && !Vt[0] && !jt ? NaN : !jt || !Vt ? xe.s / 0 : xe.s * 0);
      for (ke = g(vt.e / T2) + g(xe.e / T2), Je = jt.length, tt = Vt.length, Je < tt && (ze = jt, jt = Vt, Vt = ze, ft = Je, Je = tt, tt = ft), ze = [], ft = Je + tt, Me = ft; Me--; ) ze.push(0);
      for (Me = tt; --Me >= 0; ) {
        for (Ne = 0, Le = Je + Me; Le > Me; ) De = ze[Le] + Vt[Me] * jt[Le - Me - 1] + Ne, ze[Le--] = De % k | 0, Ne = De / k | 0;
        ze[Le] = (ze[Le] + Ne) % k | 0;
      }
      for (; !ze[--ft]; ) ze.pop();
      return Ne ? ++ke : ze.shift(), xe.d = ze, xe.e = X2(ze, ke), f ? V2(xe, kt.precision, kt.rounding) : xe;
    }, E2.toBinary = function(xe, Ne) {
      return se(this, 2, xe, Ne);
    }, E2.toDecimalPlaces = E2.toDP = function(xe, Ne) {
      var ke = this, Me = ke.constructor;
      return ke = new Me(ke), xe === void 0 ? ke : (N2(xe, 0, r), Ne === void 0 ? Ne = Me.rounding : N2(Ne, 0, 8), V2(ke, xe + ke.e + 1, Ne));
    }, E2.toExponential = function(xe, Ne) {
      var ke, Me = this, Le = Me.constructor;
      return xe === void 0 ? ke = W2(Me, true) : (N2(xe, 0, r), Ne === void 0 ? Ne = Le.rounding : N2(Ne, 0, 8), Me = V2(new Le(Me), xe + 1, Ne), ke = W2(Me, true, xe + 1)), Me.isNeg() && !Me.isZero() ? "-" + ke : ke;
    }, E2.toFixed = function(xe, Ne) {
      var ke, Me, Le = this, ze = Le.constructor;
      return xe === void 0 ? ke = W2(Le) : (N2(xe, 0, r), Ne === void 0 ? Ne = ze.rounding : N2(Ne, 0, 8), Me = V2(new ze(Le), xe + Le.e + 1, Ne), ke = W2(Me, false, xe + Me.e + 1)), Le.isNeg() && !Le.isZero() ? "-" + ke : ke;
    }, E2.toFraction = function(xe) {
      var Ne, ke, Me, Le, ze, ft, De, Je, tt, vt, kt, jt, Vt = this, Kt = Vt.d, rr = Vt.constructor;
      if (!Kt) return new rr(Vt);
      if (tt = ke = new rr(1), Me = Je = new rr(0), Ne = new rr(Me), ze = Ne.e = q(Kt) - Vt.e - 1, ft = ze % T2, Ne.d[0] = x(10, ft < 0 ? T2 + ft : ft), xe == null) xe = ze > 0 ? Ne : tt;
      else {
        if (De = new rr(xe), !De.isInt() || De.lt(tt)) throw Error(p + De);
        xe = De.gt(Ne) ? ze > 0 ? Ne : tt : De;
      }
      for (f = false, De = new rr(F13(Kt)), vt = rr.precision, rr.precision = ze = Kt.length * T2 * 2; kt = L2(De, Ne, 0, 1, 1), Le = ke.plus(kt.times(Me)), Le.cmp(xe) != 1; ) ke = Me, Me = Le, Le = tt, tt = Je.plus(kt.times(Le)), Je = Le, Le = Ne, Ne = De.minus(kt.times(Le)), De = Le;
      return Le = L2(xe.minus(ke), Me, 0, 1, 1), Je = Je.plus(Le.times(tt)), ke = ke.plus(Le.times(Me)), Je.s = tt.s = Vt.s, jt = L2(tt, Me, ze, 1).minus(Vt).abs().cmp(L2(Je, ke, ze, 1).minus(Vt).abs()) < 1 ? [tt, Me] : [Je, ke], rr.precision = vt, f = true, jt;
    }, E2.toHexadecimal = E2.toHex = function(xe, Ne) {
      return se(this, 16, xe, Ne);
    }, E2.toNearest = function(xe, Ne) {
      var ke = this, Me = ke.constructor;
      if (ke = new Me(ke), xe == null) {
        if (!ke.d) return ke;
        xe = new Me(1), Ne = Me.rounding;
      } else {
        if (xe = new Me(xe), Ne === void 0 ? Ne = Me.rounding : N2(Ne, 0, 8), !ke.d) return xe.s ? ke : xe;
        if (!xe.d) return xe.s && (xe.s = ke.s), xe;
      }
      return xe.d[0] ? (f = false, ke = L2(ke, xe, 0, Ne, 1).times(xe), f = true, V2(ke)) : (xe.s = ke.s, ke = xe), ke;
    }, E2.toNumber = function() {
      return +this;
    }, E2.toOctal = function(xe, Ne) {
      return se(this, 8, xe, Ne);
    }, E2.toPower = E2.pow = function(xe) {
      var Ne, ke, Me, Le, ze, ft, De = this, Je = De.constructor, tt = +(xe = new Je(xe));
      if (!De.d || !xe.d || !De.d[0] || !xe.d[0]) return new Je(x(+De, tt));
      if (De = new Je(De), De.eq(1)) return De;
      if (Me = Je.precision, ze = Je.rounding, xe.eq(1)) return V2(De, Me, ze);
      if (Ne = g(xe.e / T2), Ne >= xe.d.length - 1 && (ke = tt < 0 ? -tt : tt) <= A2) return Le = R2(Je, De, ke, Me), xe.s < 0 ? new Je(1).div(Le) : V2(Le, Me, ze);
      if (ft = De.s, ft < 0) {
        if (Ne < xe.d.length - 1) return new Je(NaN);
        if ((xe.d[Ne] & 1) == 0 && (ft = 1), De.e == 0 && De.d[0] == 1 && De.d.length == 1) return De.s = ft, De;
      }
      return ke = x(+De, tt), Ne = ke == 0 || !isFinite(ke) ? g(tt * (Math.log("0." + F13(De.d)) / Math.LN10 + De.e + 1)) : new Je(ke + "").e, Ne > Je.maxE + 1 || Ne < Je.minE - 1 ? new Je(Ne > 0 ? ft / 0 : 0) : (f = false, Je.rounding = De.s = 1, ke = Math.min(12, (Ne + "").length), Le = te(xe.times(j(De, Me + ke)), Me), Le.d && (Le = V2(Le, Me + 5, 1), D2(Le.d, Me, ze) && (Ne = Me + 10, Le = V2(te(xe.times(j(De, Ne + ke)), Ne), Ne + 5, 1), +F13(Le.d).slice(Me + 1, Me + 15) + 1 == 1e14 && (Le = V2(Le, Me + 1, 0)))), Le.s = ft, f = true, Je.rounding = ze, V2(Le, Me, ze));
    }, E2.toPrecision = function(xe, Ne) {
      var ke, Me = this, Le = Me.constructor;
      return xe === void 0 ? ke = W2(Me, Me.e <= Le.toExpNeg || Me.e >= Le.toExpPos) : (N2(xe, 1, r), Ne === void 0 ? Ne = Le.rounding : N2(Ne, 0, 8), Me = V2(new Le(Me), xe, Ne), ke = W2(Me, xe <= Me.e || Me.e <= Le.toExpNeg, xe)), Me.isNeg() && !Me.isZero() ? "-" + ke : ke;
    }, E2.toSignificantDigits = E2.toSD = function(xe, Ne) {
      var ke = this, Me = ke.constructor;
      return xe === void 0 ? (xe = Me.precision, Ne = Me.rounding) : (N2(xe, 1, r), Ne === void 0 ? Ne = Me.rounding : N2(Ne, 0, 8)), V2(new Me(ke), xe, Ne);
    }, E2.toString = function() {
      var xe = this, Ne = xe.constructor, ke = W2(xe, xe.e <= Ne.toExpNeg || xe.e >= Ne.toExpPos);
      return xe.isNeg() && !xe.isZero() ? "-" + ke : ke;
    }, E2.truncated = E2.trunc = function() {
      return V2(new this.constructor(this), this.e + 1, 1);
    }, E2.valueOf = E2.toJSON = function() {
      var xe = this, Ne = xe.constructor, ke = W2(xe, xe.e <= Ne.toExpNeg || xe.e >= Ne.toExpPos);
      return xe.isNeg() ? "-" + ke : ke;
    };
    function F13(xe) {
      var Ne, ke, Me, Le = xe.length - 1, ze = "", ft = xe[0];
      if (Le > 0) {
        for (ze += ft, Ne = 1; Ne < Le; Ne++) Me = xe[Ne] + "", ke = T2 - Me.length, ke && (ze += re(ke)), ze += Me;
        ft = xe[Ne], Me = ft + "", ke = T2 - Me.length, ke && (ze += re(ke));
      } else if (ft === 0) return "0";
      for (; ft % 10 === 0; ) ft /= 10;
      return ze + ft;
    }
    function N2(xe, Ne, ke) {
      if (xe !== ~~xe || xe < Ne || xe > ke) throw Error(p + xe);
    }
    function D2(xe, Ne, ke, Me) {
      var Le, ze, ft, De;
      for (ze = xe[0]; ze >= 10; ze /= 10) --Ne;
      return --Ne < 0 ? (Ne += T2, Le = 0) : (Le = Math.ceil((Ne + 1) / T2), Ne %= T2), ze = x(10, T2 - Ne), De = xe[Le] % ze | 0, Me == null ? Ne < 3 ? (Ne == 0 ? De = De / 100 | 0 : Ne == 1 && (De = De / 10 | 0), ft = ke < 4 && De == 99999 || ke > 3 && De == 49999 || De == 5e4 || De == 0) : ft = (ke < 4 && De + 1 == ze || ke > 3 && De + 1 == ze / 2) && (xe[Le + 1] / ze / 100 | 0) == x(10, Ne - 2) - 1 || (De == ze / 2 || De == 0) && (xe[Le + 1] / ze / 100 | 0) == 0 : Ne < 4 ? (Ne == 0 ? De = De / 1e3 | 0 : Ne == 1 ? De = De / 100 | 0 : Ne == 2 && (De = De / 10 | 0), ft = (Me || ke < 4) && De == 9999 || !Me && ke > 3 && De == 4999) : ft = ((Me || ke < 4) && De + 1 == ze || !Me && ke > 3 && De + 1 == ze / 2) && (xe[Le + 1] / ze / 1e3 | 0) == x(10, Ne - 3) - 1, ft;
    }
    function I2(xe, Ne, ke) {
      for (var Me, Le = [0], ze, ft = 0, De = xe.length; ft < De; ) {
        for (ze = Le.length; ze--; ) Le[ze] *= Ne;
        for (Le[0] += n.indexOf(xe.charAt(ft++)), Me = 0; Me < Le.length; Me++) Le[Me] > ke - 1 && (Le[Me + 1] === void 0 && (Le[Me + 1] = 0), Le[Me + 1] += Le[Me] / ke | 0, Le[Me] %= ke);
      }
      return Le.reverse();
    }
    function O2(xe, Ne) {
      var ke, Me, Le;
      if (Ne.isZero()) return Ne;
      Me = Ne.d.length, Me < 32 ? (ke = Math.ceil(Me / 3), Le = (1 / le(4, ke)).toString()) : (ke = 16, Le = "2.3283064365386962890625e-10"), xe.precision += ke, Ne = ue(xe, 1, Ne.times(Le), new xe(1));
      for (var ze = ke; ze--; ) {
        var ft = Ne.times(Ne);
        Ne = ft.times(ft).minus(ft).times(8).plus(1);
      }
      return xe.precision -= ke, Ne;
    }
    var L2 = /* @__PURE__ */ function() {
      function xe(Me, Le, ze) {
        var ft, De = 0, Je = Me.length;
        for (Me = Me.slice(); Je--; ) ft = Me[Je] * Le + De, Me[Je] = ft % ze | 0, De = ft / ze | 0;
        return De && Me.unshift(De), Me;
      }
      function Ne(Me, Le, ze, ft) {
        var De, Je;
        if (ze != ft) Je = ze > ft ? 1 : -1;
        else for (De = Je = 0; De < ze; De++) if (Me[De] != Le[De]) {
          Je = Me[De] > Le[De] ? 1 : -1;
          break;
        }
        return Je;
      }
      function ke(Me, Le, ze, ft) {
        for (var De = 0; ze--; ) Me[ze] -= De, De = Me[ze] < Le[ze] ? 1 : 0, Me[ze] = De * ft + Me[ze] - Le[ze];
        for (; !Me[0] && Me.length > 1; ) Me.shift();
      }
      return function(Me, Le, ze, ft, De, Je) {
        var tt, vt, kt, jt, Vt, Kt, rr, Tr, yr, pr, lr, _r, $r, Ar, Qr, hn, wn, Yn, Xn, Wn, _n = Me.constructor, qr = Me.s == Le.s ? 1 : -1, Nr = Me.d, Zr = Le.d;
        if (!Nr || !Nr[0] || !Zr || !Zr[0]) return new _n(!Me.s || !Le.s || (Nr ? Zr && Nr[0] == Zr[0] : !Zr) ? NaN : Nr && Nr[0] == 0 || !Zr ? qr * 0 : qr / 0);
        for (Je ? (Vt = 1, vt = Me.e - Le.e) : (Je = k, Vt = T2, vt = g(Me.e / Vt) - g(Le.e / Vt)), Xn = Zr.length, wn = Nr.length, yr = new _n(qr), pr = yr.d = [], kt = 0; Zr[kt] == (Nr[kt] || 0); kt++) ;
        if (Zr[kt] > (Nr[kt] || 0) && vt--, ze == null ? (Ar = ze = _n.precision, ft = _n.rounding) : De ? Ar = ze + (Me.e - Le.e) + 1 : Ar = ze, Ar < 0) pr.push(1), Kt = true;
        else {
          if (Ar = Ar / Vt + 2 | 0, kt = 0, Xn == 1) {
            for (jt = 0, Zr = Zr[0], Ar++; (kt < wn || jt) && Ar--; kt++) Qr = jt * Je + (Nr[kt] || 0), pr[kt] = Qr / Zr | 0, jt = Qr % Zr | 0;
            Kt = jt || kt < wn;
          } else {
            for (jt = Je / (Zr[0] + 1) | 0, jt > 1 && (Zr = xe(Zr, jt, Je), Nr = xe(Nr, jt, Je), Xn = Zr.length, wn = Nr.length), hn = Xn, lr = Nr.slice(0, Xn), _r = lr.length; _r < Xn; ) lr[_r++] = 0;
            Wn = Zr.slice(), Wn.unshift(0), Yn = Zr[0], Zr[1] >= Je / 2 && ++Yn;
            do
              jt = 0, tt = Ne(Zr, lr, Xn, _r), tt < 0 ? ($r = lr[0], Xn != _r && ($r = $r * Je + (lr[1] || 0)), jt = $r / Yn | 0, jt > 1 ? (jt >= Je && (jt = Je - 1), rr = xe(Zr, jt, Je), Tr = rr.length, _r = lr.length, tt = Ne(rr, lr, Tr, _r), tt == 1 && (jt--, ke(rr, Xn < Tr ? Wn : Zr, Tr, Je))) : (jt == 0 && (tt = jt = 1), rr = Zr.slice()), Tr = rr.length, Tr < _r && rr.unshift(0), ke(lr, rr, _r, Je), tt == -1 && (_r = lr.length, tt = Ne(Zr, lr, Xn, _r), tt < 1 && (jt++, ke(lr, Xn < _r ? Wn : Zr, _r, Je))), _r = lr.length) : tt === 0 && (jt++, lr = [0]), pr[kt++] = jt, tt && lr[0] ? lr[_r++] = Nr[hn] || 0 : (lr = [Nr[hn]], _r = 1);
            while ((hn++ < wn || lr[0] !== void 0) && Ar--);
            Kt = lr[0] !== void 0;
          }
          pr[0] || pr.shift();
        }
        if (Vt == 1) yr.e = vt, l = Kt;
        else {
          for (kt = 1, jt = pr[0]; jt >= 10; jt /= 10) kt++;
          yr.e = kt + vt * Vt - 1, V2(yr, De ? ze + yr.e + 1 : ze, ft, Kt);
        }
        return yr;
      };
    }();
    function V2(xe, Ne, ke, Me) {
      var Le, ze, ft, De, Je, tt, vt, kt, jt, Vt = xe.constructor;
      e: if (Ne != null) {
        if (kt = xe.d, !kt) return xe;
        for (Le = 1, De = kt[0]; De >= 10; De /= 10) Le++;
        if (ze = Ne - Le, ze < 0) ze += T2, ft = Ne, vt = kt[jt = 0], Je = vt / x(10, Le - ft - 1) % 10 | 0;
        else if (jt = Math.ceil((ze + 1) / T2), De = kt.length, jt >= De) if (Me) {
          for (; De++ <= jt; ) kt.push(0);
          vt = Je = 0, Le = 1, ze %= T2, ft = ze - T2 + 1;
        } else break e;
        else {
          for (vt = De = kt[jt], Le = 1; De >= 10; De /= 10) Le++;
          ze %= T2, ft = ze - T2 + Le, Je = ft < 0 ? 0 : vt / x(10, Le - ft - 1) % 10 | 0;
        }
        if (Me = Me || Ne < 0 || kt[jt + 1] !== void 0 || (ft < 0 ? vt : vt % x(10, Le - ft - 1)), tt = ke < 4 ? (Je || Me) && (ke == 0 || ke == (xe.s < 0 ? 3 : 2)) : Je > 5 || Je == 5 && (ke == 4 || Me || ke == 6 && (ze > 0 ? ft > 0 ? vt / x(10, Le - ft) : 0 : kt[jt - 1]) % 10 & 1 || ke == (xe.s < 0 ? 8 : 7)), Ne < 1 || !kt[0]) return kt.length = 0, tt ? (Ne -= xe.e + 1, kt[0] = x(10, (T2 - Ne % T2) % T2), xe.e = -Ne || 0) : kt[0] = xe.e = 0, xe;
        if (ze == 0 ? (kt.length = jt, De = 1, jt--) : (kt.length = jt + 1, De = x(10, T2 - ze), kt[jt] = ft > 0 ? (vt / x(10, Le - ft) % x(10, ft) | 0) * De : 0), tt) for (; ; ) if (jt == 0) {
          for (ze = 1, ft = kt[0]; ft >= 10; ft /= 10) ze++;
          for (ft = kt[0] += De, De = 1; ft >= 10; ft /= 10) De++;
          ze != De && (xe.e++, kt[0] == k && (kt[0] = 1));
          break;
        } else {
          if (kt[jt] += De, kt[jt] != k) break;
          kt[jt--] = 0, De = 1;
        }
        for (ze = kt.length; kt[--ze] === 0; ) kt.pop();
      }
      return f && (xe.e > Vt.maxE ? (xe.d = null, xe.e = NaN) : xe.e < Vt.minE && (xe.e = 0, xe.d = [0])), xe;
    }
    function W2(xe, Ne, ke) {
      if (!xe.isFinite()) return Q2(xe);
      var Me, Le = xe.e, ze = F13(xe.d), ft = ze.length;
      return Ne ? (ke && (Me = ke - ft) > 0 ? ze = ze.charAt(0) + "." + ze.slice(1) + re(Me) : ft > 1 && (ze = ze.charAt(0) + "." + ze.slice(1)), ze = ze + (xe.e < 0 ? "e" : "e+") + xe.e) : Le < 0 ? (ze = "0." + re(-Le - 1) + ze, ke && (Me = ke - ft) > 0 && (ze += re(Me))) : Le >= ft ? (ze += re(Le + 1 - ft), ke && (Me = ke - Le - 1) > 0 && (ze = ze + "." + re(Me))) : ((Me = Le + 1) < ft && (ze = ze.slice(0, Me) + "." + ze.slice(Me)), ke && (Me = ke - ft) > 0 && (Le + 1 === ft && (ze += "."), ze += re(Me))), ze;
    }
    function X2(xe, Ne) {
      var ke = xe[0];
      for (Ne *= T2; ke >= 10; ke /= 10) Ne++;
      return Ne;
    }
    function Y2(xe, Ne, ke) {
      if (Ne > S2) throw f = true, ke && (xe.precision = ke), Error(d);
      return V2(new xe(a), Ne, 1, true);
    }
    function K2(xe, Ne, ke) {
      if (Ne > C2) throw Error(d);
      return V2(new xe(o), Ne, ke, true);
    }
    function q(xe) {
      var Ne = xe.length - 1, ke = Ne * T2 + 1;
      if (Ne = xe[Ne], Ne) {
        for (; Ne % 10 == 0; Ne /= 10) ke--;
        for (Ne = xe[0]; Ne >= 10; Ne /= 10) ke++;
      }
      return ke;
    }
    function re(xe) {
      for (var Ne = ""; xe--; ) Ne += "0";
      return Ne;
    }
    function R2(xe, Ne, ke, Me) {
      var Le, ze = new xe(1), ft = Math.ceil(Me / T2 + 4);
      for (f = false; ; ) {
        if (ke % 2 && (ze = ze.times(Ne), he(ze.d, ft) && (Le = true)), ke = g(ke / 2), ke === 0) {
          ke = ze.d.length - 1, Le && ze.d[ke] === 0 && ++ze.d[ke];
          break;
        }
        Ne = Ne.times(Ne), he(Ne.d, ft);
      }
      return f = true, ze;
    }
    function z(xe) {
      return xe.d[xe.d.length - 1] & 1;
    }
    function H2(xe, Ne, ke) {
      for (var Me, Le = new xe(Ne[0]), ze = 0; ++ze < Ne.length; ) if (Me = new xe(Ne[ze]), Me.s) Le[ke](Me) && (Le = Me);
      else {
        Le = Me;
        break;
      }
      return Le;
    }
    function te(xe, Ne) {
      var ke, Me, Le, ze, ft, De, Je, tt = 0, vt = 0, kt = 0, jt = xe.constructor, Vt = jt.rounding, Kt = jt.precision;
      if (!xe.d || !xe.d[0] || xe.e > 17) return new jt(xe.d ? xe.d[0] ? xe.s < 0 ? 0 : 1 / 0 : 1 : xe.s ? xe.s < 0 ? 0 : xe : 0 / 0);
      for (Ne == null ? (f = false, Je = Kt) : Je = Ne, De = new jt(0.03125); xe.e > -2; ) xe = xe.times(De), kt += 5;
      for (Me = Math.log(x(2, kt)) / Math.LN10 * 2 + 5 | 0, Je += Me, ke = ze = ft = new jt(1), jt.precision = Je; ; ) {
        if (ze = V2(ze.times(xe), Je, 1), ke = ke.times(++vt), De = ft.plus(L2(ze, ke, Je, 1)), F13(De.d).slice(0, Je) === F13(ft.d).slice(0, Je)) {
          for (Le = kt; Le--; ) ft = V2(ft.times(ft), Je, 1);
          if (Ne == null) if (tt < 3 && D2(ft.d, Je - Me, Vt, tt)) jt.precision = Je += 10, ke = ze = De = new jt(1), vt = 0, tt++;
          else return V2(ft, jt.precision = Kt, Vt, f = true);
          else return jt.precision = Kt, ft;
        }
        ft = De;
      }
    }
    function j(xe, Ne) {
      var ke, Me, Le, ze, ft, De, Je, tt, vt, kt, jt, Vt = 1, Kt = 10, rr = xe, Tr = rr.d, yr = rr.constructor, pr = yr.rounding, lr = yr.precision;
      if (rr.s < 0 || !Tr || !Tr[0] || !rr.e && Tr[0] == 1 && Tr.length == 1) return new yr(Tr && !Tr[0] ? -1 / 0 : rr.s != 1 ? NaN : Tr ? 0 : rr);
      if (Ne == null ? (f = false, vt = lr) : vt = Ne, yr.precision = vt += Kt, ke = F13(Tr), Me = ke.charAt(0), Math.abs(ze = rr.e) < 15e14) {
        for (; Me < 7 && Me != 1 || Me == 1 && ke.charAt(1) > 3; ) rr = rr.times(xe), ke = F13(rr.d), Me = ke.charAt(0), Vt++;
        ze = rr.e, Me > 1 ? (rr = new yr("0." + ke), ze++) : rr = new yr(Me + "." + ke.slice(1));
      } else return tt = Y2(yr, vt + 2, lr).times(ze + ""), rr = j(new yr(Me + "." + ke.slice(1)), vt - Kt).plus(tt), yr.precision = lr, Ne == null ? V2(rr, lr, pr, f = true) : rr;
      for (kt = rr, Je = ft = rr = L2(rr.minus(1), rr.plus(1), vt, 1), jt = V2(rr.times(rr), vt, 1), Le = 3; ; ) {
        if (ft = V2(ft.times(jt), vt, 1), tt = Je.plus(L2(ft, new yr(Le), vt, 1)), F13(tt.d).slice(0, vt) === F13(Je.d).slice(0, vt)) if (Je = Je.times(2), ze !== 0 && (Je = Je.plus(Y2(yr, vt + 2, lr).times(ze + ""))), Je = L2(Je, new yr(Vt), vt, 1), Ne == null) if (D2(Je.d, vt - Kt, pr, De)) yr.precision = vt += Kt, tt = ft = rr = L2(kt.minus(1), kt.plus(1), vt, 1), jt = V2(rr.times(rr), vt, 1), Le = De = 1;
        else return V2(Je, yr.precision = lr, pr, f = true);
        else return yr.precision = lr, Je;
        Je = tt, Le += 2;
      }
    }
    function Q2(xe) {
      return String(xe.s * xe.s / 0);
    }
    function Z2(xe, Ne) {
      var ke, Me, Le;
      for ((ke = Ne.indexOf(".")) > -1 && (Ne = Ne.replace(".", "")), (Me = Ne.search(/e/i)) > 0 ? (ke < 0 && (ke = Me), ke += +Ne.slice(Me + 1), Ne = Ne.substring(0, Me)) : ke < 0 && (ke = Ne.length), Me = 0; Ne.charCodeAt(Me) === 48; Me++) ;
      for (Le = Ne.length; Ne.charCodeAt(Le - 1) === 48; --Le) ;
      if (Ne = Ne.slice(Me, Le), Ne) {
        if (Le -= Me, xe.e = ke = ke - Me - 1, xe.d = [], Me = (ke + 1) % T2, ke < 0 && (Me += T2), Me < Le) {
          for (Me && xe.d.push(+Ne.slice(0, Me)), Le -= T2; Me < Le; ) xe.d.push(+Ne.slice(Me, Me += T2));
          Ne = Ne.slice(Me), Me = T2 - Ne.length;
        } else Me -= Le;
        for (; Me--; ) Ne += "0";
        xe.d.push(+Ne), f && (xe.e > xe.constructor.maxE ? (xe.d = null, xe.e = NaN) : xe.e < xe.constructor.minE && (xe.e = 0, xe.d = [0]));
      } else xe.e = 0, xe.d = [0];
      return xe;
    }
    function ne(xe, Ne) {
      var ke, Me, Le, ze, ft, De, Je, tt, vt;
      if (Ne.indexOf("_") > -1) {
        if (Ne = Ne.replace(/(\d)_(?=\d)/g, "$1"), _4.test(Ne)) return Z2(xe, Ne);
      } else if (Ne === "Infinity" || Ne === "NaN") return +Ne || (xe.s = NaN), xe.e = NaN, xe.d = null, xe;
      if (y.test(Ne)) ke = 16, Ne = Ne.toLowerCase();
      else if (b.test(Ne)) ke = 2;
      else if (w.test(Ne)) ke = 8;
      else throw Error(p + Ne);
      for (ze = Ne.search(/p/i), ze > 0 ? (Je = +Ne.slice(ze + 1), Ne = Ne.substring(2, ze)) : Ne = Ne.slice(2), ze = Ne.indexOf("."), ft = ze >= 0, Me = xe.constructor, ft && (Ne = Ne.replace(".", ""), De = Ne.length, ze = De - ze, Le = R2(Me, new Me(ke), ze, ze * 2)), tt = I2(Ne, ke, k), vt = tt.length - 1, ze = vt; tt[ze] === 0; --ze) tt.pop();
      return ze < 0 ? new Me(xe.s * 0) : (xe.e = X2(tt, vt), xe.d = tt, f = false, ft && (xe = L2(xe, Le, De * 4)), Je && (xe = xe.times(Math.abs(Je) < 54 ? x(2, Je) : i.pow(2, Je))), f = true, xe);
    }
    function ae(xe, Ne) {
      var ke, Me = Ne.d.length;
      if (Me < 3) return Ne.isZero() ? Ne : ue(xe, 2, Ne, Ne);
      ke = 1.4 * Math.sqrt(Me), ke = ke > 16 ? 16 : ke | 0, Ne = Ne.times(1 / le(5, ke)), Ne = ue(xe, 2, Ne, Ne);
      for (var Le, ze = new xe(5), ft = new xe(16), De = new xe(20); ke--; ) Le = Ne.times(Ne), Ne = Ne.times(ze.plus(Le.times(ft.times(Le).minus(De))));
      return Ne;
    }
    function ue(xe, Ne, ke, Me, Le) {
      var ze, ft, De, Je, tt = 1, vt = xe.precision, kt = Math.ceil(vt / T2);
      for (f = false, Je = ke.times(ke), De = new xe(Me); ; ) {
        if (ft = L2(De.times(Je), new xe(Ne++ * Ne++), vt, 1), De = Le ? Me.plus(ft) : Me.minus(ft), Me = L2(ft.times(Je), new xe(Ne++ * Ne++), vt, 1), ft = De.plus(Me), ft.d[kt] !== void 0) {
          for (ze = kt; ft.d[ze] === De.d[ze] && ze--; ) ;
          if (ze == -1) break;
        }
        ze = De, De = Me, Me = ft, ft = ze, tt++;
      }
      return f = true, ft.d.length = kt + 1, ft;
    }
    function le(xe, Ne) {
      for (var ke = xe; --Ne; ) ke *= xe;
      return ke;
    }
    function ce(xe, Ne) {
      var ke, Me = Ne.s < 0, Le = K2(xe, xe.precision, 1), ze = Le.times(0.5);
      if (Ne = Ne.abs(), Ne.lte(ze)) return c = Me ? 4 : 1, Ne;
      if (ke = Ne.divToInt(Le), ke.isZero()) c = Me ? 3 : 2;
      else {
        if (Ne = Ne.minus(ke.times(Le)), Ne.lte(ze)) return c = z(ke) ? Me ? 2 : 3 : Me ? 4 : 1, Ne;
        c = z(ke) ? Me ? 1 : 4 : Me ? 3 : 2;
      }
      return Ne.minus(Le).abs();
    }
    function se(xe, Ne, ke, Me) {
      var Le, ze, ft, De, Je, tt, vt, kt, jt, Vt = xe.constructor, Kt = ke !== void 0;
      if (Kt ? (N2(ke, 1, r), Me === void 0 ? Me = Vt.rounding : N2(Me, 0, 8)) : (ke = Vt.precision, Me = Vt.rounding), !xe.isFinite()) vt = Q2(xe);
      else {
        for (vt = W2(xe), ft = vt.indexOf("."), Kt ? (Le = 2, Ne == 16 ? ke = ke * 4 - 3 : Ne == 8 && (ke = ke * 3 - 2)) : Le = Ne, ft >= 0 && (vt = vt.replace(".", ""), jt = new Vt(1), jt.e = vt.length - ft, jt.d = I2(W2(jt), 10, Le), jt.e = jt.d.length), kt = I2(vt, 10, Le), ze = Je = kt.length; kt[--Je] == 0; ) kt.pop();
        if (!kt[0]) vt = Kt ? "0p+0" : "0";
        else {
          if (ft < 0 ? ze-- : (xe = new Vt(xe), xe.d = kt, xe.e = ze, xe = L2(xe, jt, ke, Me, 0, Le), kt = xe.d, ze = xe.e, tt = l), ft = kt[ke], De = Le / 2, tt = tt || kt[ke + 1] !== void 0, tt = Me < 4 ? (ft !== void 0 || tt) && (Me === 0 || Me === (xe.s < 0 ? 3 : 2)) : ft > De || ft === De && (Me === 4 || tt || Me === 6 && kt[ke - 1] & 1 || Me === (xe.s < 0 ? 8 : 7)), kt.length = ke, tt) for (; ++kt[--ke] > Le - 1; ) kt[ke] = 0, ke || (++ze, kt.unshift(1));
          for (Je = kt.length; !kt[Je - 1]; --Je) ;
          for (ft = 0, vt = ""; ft < Je; ft++) vt += n.charAt(kt[ft]);
          if (Kt) {
            if (Je > 1) if (Ne == 16 || Ne == 8) {
              for (ft = Ne == 16 ? 4 : 3, --Je; Je % ft; Je++) vt += "0";
              for (kt = I2(vt, Le, Ne), Je = kt.length; !kt[Je - 1]; --Je) ;
              for (ft = 1, vt = "1."; ft < Je; ft++) vt += n.charAt(kt[ft]);
            } else vt = vt.charAt(0) + "." + vt.slice(1);
            vt = vt + (ze < 0 ? "p" : "p+") + ze;
          } else if (ze < 0) {
            for (; ++ze; ) vt = "0" + vt;
            vt = "0." + vt;
          } else if (++ze > Je) for (ze -= Je; ze--; ) vt += "0";
          else ze < Je && (vt = vt.slice(0, ze) + "." + vt.slice(ze));
        }
        vt = (Ne == 16 ? "0x" : Ne == 2 ? "0b" : Ne == 8 ? "0o" : "") + vt;
      }
      return xe.s < 0 ? "-" + vt : vt;
    }
    function he(xe, Ne) {
      if (xe.length > Ne) return xe.length = Ne, true;
    }
    function me(xe) {
      return new this(xe).abs();
    }
    function we(xe) {
      return new this(xe).acos();
    }
    function be(xe) {
      return new this(xe).acosh();
    }
    function Ae(xe, Ne) {
      return new this(xe).plus(Ne);
    }
    function pe(xe) {
      return new this(xe).asin();
    }
    function ve(xe) {
      return new this(xe).asinh();
    }
    function Ee(xe) {
      return new this(xe).atan();
    }
    function Se(xe) {
      return new this(xe).atanh();
    }
    function Ce(xe, Ne) {
      xe = new this(xe), Ne = new this(Ne);
      var ke, Me = this.precision, Le = this.rounding, ze = Me + 4;
      return !xe.s || !Ne.s ? ke = new this(NaN) : !xe.d && !Ne.d ? (ke = K2(this, ze, 1).times(Ne.s > 0 ? 0.25 : 0.75), ke.s = xe.s) : !Ne.d || xe.isZero() ? (ke = Ne.s < 0 ? K2(this, Me, Le) : new this(0), ke.s = xe.s) : !xe.d || Ne.isZero() ? (ke = K2(this, ze, 1).times(0.5), ke.s = xe.s) : Ne.s < 0 ? (this.precision = ze, this.rounding = 1, ke = this.atan(L2(xe, Ne, ze, 1)), Ne = K2(this, ze, 1), this.precision = Me, this.rounding = Le, ke = xe.s < 0 ? ke.minus(Ne) : ke.plus(Ne)) : ke = this.atan(L2(xe, Ne, ze, 1)), ke;
    }
    function Be(xe) {
      return new this(xe).cbrt();
    }
    function Ue(xe) {
      return V2(xe = new this(xe), xe.e + 1, 2);
    }
    function Ke(xe, Ne, ke) {
      return new this(xe).clamp(Ne, ke);
    }
    function ct(xe) {
      if (!xe || typeof xe != "object") throw Error(h + "Object expected");
      var Ne, ke, Me, Le = xe.defaults === true, ze = ["precision", 1, r, "rounding", 0, 8, "toExpNeg", -t, 0, "toExpPos", 0, t, "maxE", 0, t, "minE", -t, 0, "modulo", 0, 9];
      for (Ne = 0; Ne < ze.length; Ne += 3) if (ke = ze[Ne], Le && (this[ke] = s[ke]), (Me = xe[ke]) !== void 0) if (g(Me) === Me && Me >= ze[Ne + 1] && Me <= ze[Ne + 2]) this[ke] = Me;
      else throw Error(p + ke + ": " + Me);
      if (ke = "crypto", Le && (this[ke] = s[ke]), (Me = xe[ke]) !== void 0) if (Me === true || Me === false || Me === 0 || Me === 1) if (Me) if (typeof crypto < "u" && crypto && (crypto.getRandomValues || crypto.randomBytes)) this[ke] = true;
      else throw Error(v);
      else this[ke] = false;
      else throw Error(p + ke + ": " + Me);
      return this;
    }
    function We(xe) {
      return new this(xe).cos();
    }
    function Ze(xe) {
      return new this(xe).cosh();
    }
    function it(xe) {
      var Ne, ke, Me;
      function Le(ze) {
        var ft, De, Je, tt = this;
        if (!(tt instanceof Le)) return new Le(ze);
        if (tt.constructor = Le, zt(ze)) {
          tt.s = ze.s, f ? !ze.d || ze.e > Le.maxE ? (tt.e = NaN, tt.d = null) : ze.e < Le.minE ? (tt.e = 0, tt.d = [0]) : (tt.e = ze.e, tt.d = ze.d.slice()) : (tt.e = ze.e, tt.d = ze.d ? ze.d.slice() : ze.d);
          return;
        }
        if (Je = typeof ze, Je === "number") {
          if (ze === 0) {
            tt.s = 1 / ze < 0 ? -1 : 1, tt.e = 0, tt.d = [0];
            return;
          }
          if (ze < 0 ? (ze = -ze, tt.s = -1) : tt.s = 1, ze === ~~ze && ze < 1e7) {
            for (ft = 0, De = ze; De >= 10; De /= 10) ft++;
            f ? ft > Le.maxE ? (tt.e = NaN, tt.d = null) : ft < Le.minE ? (tt.e = 0, tt.d = [0]) : (tt.e = ft, tt.d = [ze]) : (tt.e = ft, tt.d = [ze]);
            return;
          } else if (ze * 0 !== 0) {
            ze || (tt.s = NaN), tt.e = NaN, tt.d = null;
            return;
          }
          return Z2(tt, ze.toString());
        } else if (Je !== "string") throw Error(p + ze);
        return (De = ze.charCodeAt(0)) === 45 ? (ze = ze.slice(1), tt.s = -1) : (De === 43 && (ze = ze.slice(1)), tt.s = 1), _4.test(ze) ? Z2(tt, ze) : ne(tt, ze);
      }
      if (Le.prototype = E2, Le.ROUND_UP = 0, Le.ROUND_DOWN = 1, Le.ROUND_CEIL = 2, Le.ROUND_FLOOR = 3, Le.ROUND_HALF_UP = 4, Le.ROUND_HALF_DOWN = 5, Le.ROUND_HALF_EVEN = 6, Le.ROUND_HALF_CEIL = 7, Le.ROUND_HALF_FLOOR = 8, Le.EUCLID = 9, Le.config = Le.set = ct, Le.clone = it, Le.isDecimal = zt, Le.abs = me, Le.acos = we, Le.acosh = be, Le.add = Ae, Le.asin = pe, Le.asinh = ve, Le.atan = Ee, Le.atanh = Se, Le.atan2 = Ce, Le.cbrt = Be, Le.ceil = Ue, Le.clamp = Ke, Le.cos = We, Le.cosh = Ze, Le.div = ot, Le.exp = mt, Le.floor = wt, Le.hypot = Et, Le.ln = Nt, Le.log = yt, Le.log10 = Ot, Le.log2 = pt, Le.max = Jt, Le.min = tr, Le.mod = Ye, Le.mul = at, Le.pow = Ge, Le.random = st, Le.round = Ie, Le.sign = Pe, Le.sin = $e, Le.sinh = Ve, Le.sqrt = ut, Le.sub = Re, Le.sum = qe, Le.tan = je, Le.tanh = rt, Le.trunc = He, xe === void 0 && (xe = {}), xe && xe.defaults !== true) for (Me = ["precision", "rounding", "toExpNeg", "toExpPos", "maxE", "minE", "modulo", "crypto"], Ne = 0; Ne < Me.length; ) xe.hasOwnProperty(ke = Me[Ne++]) || (xe[ke] = this[ke]);
      return Le.config(xe), Le;
    }
    function ot(xe, Ne) {
      return new this(xe).div(Ne);
    }
    function mt(xe) {
      return new this(xe).exp();
    }
    function wt(xe) {
      return V2(xe = new this(xe), xe.e + 1, 3);
    }
    function Et() {
      var xe, Ne, ke = new this(0);
      for (f = false, xe = 0; xe < arguments.length; ) if (Ne = new this(arguments[xe++]), Ne.d) ke.d && (ke = ke.plus(Ne.times(Ne)));
      else {
        if (Ne.s) return f = true, new this(1 / 0);
        ke = Ne;
      }
      return f = true, ke.sqrt();
    }
    function zt(xe) {
      return xe instanceof i || xe && xe.toStringTag === m || false;
    }
    function Nt(xe) {
      return new this(xe).ln();
    }
    function yt(xe, Ne) {
      return new this(xe).log(Ne);
    }
    function pt(xe) {
      return new this(xe).log(2);
    }
    function Ot(xe) {
      return new this(xe).log(10);
    }
    function Jt() {
      return H2(this, arguments, "lt");
    }
    function tr() {
      return H2(this, arguments, "gt");
    }
    function Ye(xe, Ne) {
      return new this(xe).mod(Ne);
    }
    function at(xe, Ne) {
      return new this(xe).mul(Ne);
    }
    function Ge(xe, Ne) {
      return new this(xe).pow(Ne);
    }
    function st(xe) {
      var Ne, ke, Me, Le, ze = 0, ft = new this(1), De = [];
      if (xe === void 0 ? xe = this.precision : N2(xe, 1, r), Me = Math.ceil(xe / T2), this.crypto) if (crypto.getRandomValues) for (Ne = crypto.getRandomValues(new Uint32Array(Me)); ze < Me; ) Le = Ne[ze], Le >= 429e7 ? Ne[ze] = crypto.getRandomValues(new Uint32Array(1))[0] : De[ze++] = Le % 1e7;
      else if (crypto.randomBytes) {
        for (Ne = crypto.randomBytes(Me *= 4); ze < Me; ) Le = Ne[ze] + (Ne[ze + 1] << 8) + (Ne[ze + 2] << 16) + ((Ne[ze + 3] & 127) << 24), Le >= 214e7 ? crypto.randomBytes(4).copy(Ne, ze) : (De.push(Le % 1e7), ze += 4);
        ze = Me / 4;
      } else throw Error(v);
      else for (; ze < Me; ) De[ze++] = Math.random() * 1e7 | 0;
      for (Me = De[--ze], xe %= T2, Me && xe && (Le = x(10, T2 - xe), De[ze] = (Me / Le | 0) * Le); De[ze] === 0; ze--) De.pop();
      if (ze < 0) ke = 0, De = [0];
      else {
        for (ke = -1; De[0] === 0; ke -= T2) De.shift();
        for (Me = 1, Le = De[0]; Le >= 10; Le /= 10) Me++;
        Me < T2 && (ke -= T2 - Me);
      }
      return ft.e = ke, ft.d = De, ft;
    }
    function Ie(xe) {
      return V2(xe = new this(xe), xe.e + 1, this.rounding);
    }
    function Pe(xe) {
      return xe = new this(xe), xe.d ? xe.d[0] ? xe.s : 0 * xe.s : xe.s || NaN;
    }
    function $e(xe) {
      return new this(xe).sin();
    }
    function Ve(xe) {
      return new this(xe).sinh();
    }
    function ut(xe) {
      return new this(xe).sqrt();
    }
    function Re(xe, Ne) {
      return new this(xe).sub(Ne);
    }
    function qe() {
      var xe = 0, Ne = arguments, ke = new this(Ne[xe]);
      for (f = false; ke.s && ++xe < Ne.length; ) ke = ke.plus(Ne[xe]);
      return f = true, V2(ke, this.precision, this.rounding);
    }
    function je(xe) {
      return new this(xe).tan();
    }
    function rt(xe) {
      return new this(xe).tanh();
    }
    function He(xe) {
      return V2(xe = new this(xe), xe.e + 1, 1);
    }
    i = it(s), i.prototype.constructor = i, i.default = i.Decimal = i, a = new i(a), o = new i(o), typeof define == "function" && define.amd ? define(function() {
      return i;
    }) : typeof uA < "u" && uA.exports ? (typeof Symbol == "function" && typeof Symbol.iterator == "symbol" && (E2[Symbol.for("nodejs.util.inspect.custom")] = E2.toString, E2[Symbol.toStringTag] = "Decimal"), uA.exports = i) : (e || (e = typeof self < "u" && self && self.self == self ? self : window), u2 = e.Decimal, i.noConflict = function() {
      return e.Decimal = u2, i;
    }, e.Decimal = i);
  })(zJ);
});
var VJ = ri((aN, UJ) => {
  (function(e) {
    "use strict";
    var t = function(u2) {
      return (Math.exp(u2) + Math.exp(-u2)) * 0.5;
    }, r = function(u2) {
      return (Math.exp(u2) - Math.exp(-u2)) * 0.5;
    }, n = function(u2) {
      var c = Math.PI / 4;
      if (-c > u2 || u2 > c) return Math.cos(u2) - 1;
      var f = u2 * u2;
      return f * (f * (f * (f * (f * (f * (f * (f / 20922789888e3 - 11470745597729725e-27) + 208767569878681e-23) - 2755731922398589e-22) + 248015873015873e-19) - 0.001388888888888889) + 0.041666666666666664) - 0.5);
    }, a = function(u2, c) {
      var f = Math.abs(u2), h = Math.abs(c);
      return f < 3e3 && h < 3e3 ? Math.sqrt(f * f + h * h) : (f < h ? (f = h, h = u2 / c) : h = c / u2, f * Math.sqrt(1 + h * h));
    }, o = function() {
      throw SyntaxError("Invalid Param");
    };
    function s(u2, c) {
      var f = Math.abs(u2), h = Math.abs(c);
      return u2 === 0 ? Math.log(h) : c === 0 ? Math.log(f) : f < 3e3 && h < 3e3 ? Math.log(u2 * u2 + c * c) * 0.5 : Math.log(u2 / Math.cos(Math.atan2(c, u2)));
    }
    var i = function(u2, c) {
      var f = { re: 0, im: 0 };
      if (u2 == null) f.re = f.im = 0;
      else if (c !== void 0) f.re = u2, f.im = c;
      else switch (typeof u2) {
        case "object":
          if ("im" in u2 && "re" in u2) f.re = u2.re, f.im = u2.im;
          else if ("abs" in u2 && "arg" in u2) {
            if (!Number.isFinite(u2.abs) && Number.isFinite(u2.arg)) return l.INFINITY;
            f.re = u2.abs * Math.cos(u2.arg), f.im = u2.abs * Math.sin(u2.arg);
          } else if ("r" in u2 && "phi" in u2) {
            if (!Number.isFinite(u2.r) && Number.isFinite(u2.phi)) return l.INFINITY;
            f.re = u2.r * Math.cos(u2.phi), f.im = u2.r * Math.sin(u2.phi);
          } else u2.length === 2 ? (f.re = u2[0], f.im = u2[1]) : o();
          break;
        case "string":
          f.im = f.re = 0;
          var h = u2.match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g), p = 1, d = 0;
          h === null && o();
          for (var v = 0; v < h.length; v++) {
            var m = h[v];
            m === " " || m === "	" || m === `
` || (m === "+" ? p++ : m === "-" ? d++ : m === "i" || m === "I" ? (p + d === 0 && o(), h[v + 1] !== " " && !isNaN(h[v + 1]) ? (f.im += parseFloat((d % 2 ? "-" : "") + h[v + 1]), v++) : f.im += parseFloat((d % 2 ? "-" : "") + "1"), p = d = 0) : ((p + d === 0 || isNaN(m)) && o(), h[v + 1] === "i" || h[v + 1] === "I" ? (f.im += parseFloat((d % 2 ? "-" : "") + m), v++) : f.re += parseFloat((d % 2 ? "-" : "") + m), p = d = 0));
          }
          p + d > 0 && o();
          break;
        case "number":
          f.im = 0, f.re = u2;
          break;
        default:
          o();
      }
      return isNaN(f.re) || isNaN(f.im), f;
    };
    function l(u2, c) {
      if (!(this instanceof l)) return new l(u2, c);
      var f = i(u2, c);
      this.re = f.re, this.im = f.im;
    }
    l.prototype = { re: 0, im: 0, sign: function() {
      var u2 = this.abs();
      return new l(this.re / u2, this.im / u2);
    }, add: function(u2, c) {
      var f = new l(u2, c);
      return this.isInfinite() && f.isInfinite() ? l.NAN : this.isInfinite() || f.isInfinite() ? l.INFINITY : new l(this.re + f.re, this.im + f.im);
    }, sub: function(u2, c) {
      var f = new l(u2, c);
      return this.isInfinite() && f.isInfinite() ? l.NAN : this.isInfinite() || f.isInfinite() ? l.INFINITY : new l(this.re - f.re, this.im - f.im);
    }, mul: function(u2, c) {
      var f = new l(u2, c);
      return this.isInfinite() && f.isZero() || this.isZero() && f.isInfinite() ? l.NAN : this.isInfinite() || f.isInfinite() ? l.INFINITY : f.im === 0 && this.im === 0 ? new l(this.re * f.re, 0) : new l(this.re * f.re - this.im * f.im, this.re * f.im + this.im * f.re);
    }, div: function(u2, c) {
      var f = new l(u2, c);
      if (this.isZero() && f.isZero() || this.isInfinite() && f.isInfinite()) return l.NAN;
      if (this.isInfinite() || f.isZero()) return l.INFINITY;
      if (this.isZero() || f.isInfinite()) return l.ZERO;
      u2 = this.re, c = this.im;
      var h = f.re, p = f.im, d, v;
      return p === 0 ? new l(u2 / h, c / h) : Math.abs(h) < Math.abs(p) ? (v = h / p, d = h * v + p, new l((u2 * v + c) / d, (c * v - u2) / d)) : (v = p / h, d = p * v + h, new l((u2 + c * v) / d, (c - u2 * v) / d));
    }, pow: function(u2, c) {
      var f = new l(u2, c);
      if (u2 = this.re, c = this.im, f.isZero()) return l.ONE;
      if (f.im === 0) {
        if (c === 0 && u2 > 0) return new l(Math.pow(u2, f.re), 0);
        if (u2 === 0) switch ((f.re % 4 + 4) % 4) {
          case 0:
            return new l(Math.pow(c, f.re), 0);
          case 1:
            return new l(0, Math.pow(c, f.re));
          case 2:
            return new l(-Math.pow(c, f.re), 0);
          case 3:
            return new l(0, -Math.pow(c, f.re));
        }
      }
      if (u2 === 0 && c === 0 && f.re > 0 && f.im >= 0) return l.ZERO;
      var h = Math.atan2(c, u2), p = s(u2, c);
      return u2 = Math.exp(f.re * p - f.im * h), c = f.im * p + f.re * h, new l(u2 * Math.cos(c), u2 * Math.sin(c));
    }, sqrt: function() {
      var u2 = this.re, c = this.im, f = this.abs(), h, p;
      if (u2 >= 0) {
        if (c === 0) return new l(Math.sqrt(u2), 0);
        h = 0.5 * Math.sqrt(2 * (f + u2));
      } else h = Math.abs(c) / Math.sqrt(2 * (f - u2));
      return u2 <= 0 ? p = 0.5 * Math.sqrt(2 * (f - u2)) : p = Math.abs(c) / Math.sqrt(2 * (f + u2)), new l(h, c < 0 ? -p : p);
    }, exp: function() {
      var u2 = Math.exp(this.re);
      return this.im, new l(u2 * Math.cos(this.im), u2 * Math.sin(this.im));
    }, expm1: function() {
      var u2 = this.re, c = this.im;
      return new l(Math.expm1(u2) * Math.cos(c) + n(c), Math.exp(u2) * Math.sin(c));
    }, log: function() {
      var u2 = this.re, c = this.im;
      return c === 0 && u2 > 0, new l(s(u2, c), Math.atan2(c, u2));
    }, abs: function() {
      return a(this.re, this.im);
    }, arg: function() {
      return Math.atan2(this.im, this.re);
    }, sin: function() {
      var u2 = this.re, c = this.im;
      return new l(Math.sin(u2) * t(c), Math.cos(u2) * r(c));
    }, cos: function() {
      var u2 = this.re, c = this.im;
      return new l(Math.cos(u2) * t(c), -Math.sin(u2) * r(c));
    }, tan: function() {
      var u2 = 2 * this.re, c = 2 * this.im, f = Math.cos(u2) + t(c);
      return new l(Math.sin(u2) / f, r(c) / f);
    }, cot: function() {
      var u2 = 2 * this.re, c = 2 * this.im, f = Math.cos(u2) - t(c);
      return new l(-Math.sin(u2) / f, r(c) / f);
    }, sec: function() {
      var u2 = this.re, c = this.im, f = 0.5 * t(2 * c) + 0.5 * Math.cos(2 * u2);
      return new l(Math.cos(u2) * t(c) / f, Math.sin(u2) * r(c) / f);
    }, csc: function() {
      var u2 = this.re, c = this.im, f = 0.5 * t(2 * c) - 0.5 * Math.cos(2 * u2);
      return new l(Math.sin(u2) * t(c) / f, -Math.cos(u2) * r(c) / f);
    }, asin: function() {
      var u2 = this.re, c = this.im, f = new l(c * c - u2 * u2 + 1, -2 * u2 * c).sqrt(), h = new l(f.re - c, f.im + u2).log();
      return new l(h.im, -h.re);
    }, acos: function() {
      var u2 = this.re, c = this.im, f = new l(c * c - u2 * u2 + 1, -2 * u2 * c).sqrt(), h = new l(f.re - c, f.im + u2).log();
      return new l(Math.PI / 2 - h.im, h.re);
    }, atan: function() {
      var u2 = this.re, c = this.im;
      if (u2 === 0) {
        if (c === 1) return new l(0, 1 / 0);
        if (c === -1) return new l(0, -1 / 0);
      }
      var f = u2 * u2 + (1 - c) * (1 - c), h = new l((1 - c * c - u2 * u2) / f, -2 * u2 / f).log();
      return new l(-0.5 * h.im, 0.5 * h.re);
    }, acot: function() {
      var u2 = this.re, c = this.im;
      if (c === 0) return new l(Math.atan2(1, u2), 0);
      var f = u2 * u2 + c * c;
      return f !== 0 ? new l(u2 / f, -c / f).atan() : new l(u2 !== 0 ? u2 / 0 : 0, c !== 0 ? -c / 0 : 0).atan();
    }, asec: function() {
      var u2 = this.re, c = this.im;
      if (u2 === 0 && c === 0) return new l(0, 1 / 0);
      var f = u2 * u2 + c * c;
      return f !== 0 ? new l(u2 / f, -c / f).acos() : new l(u2 !== 0 ? u2 / 0 : 0, c !== 0 ? -c / 0 : 0).acos();
    }, acsc: function() {
      var u2 = this.re, c = this.im;
      if (u2 === 0 && c === 0) return new l(Math.PI / 2, 1 / 0);
      var f = u2 * u2 + c * c;
      return f !== 0 ? new l(u2 / f, -c / f).asin() : new l(u2 !== 0 ? u2 / 0 : 0, c !== 0 ? -c / 0 : 0).asin();
    }, sinh: function() {
      var u2 = this.re, c = this.im;
      return new l(r(u2) * Math.cos(c), t(u2) * Math.sin(c));
    }, cosh: function() {
      var u2 = this.re, c = this.im;
      return new l(t(u2) * Math.cos(c), r(u2) * Math.sin(c));
    }, tanh: function() {
      var u2 = 2 * this.re, c = 2 * this.im, f = t(u2) + Math.cos(c);
      return new l(r(u2) / f, Math.sin(c) / f);
    }, coth: function() {
      var u2 = 2 * this.re, c = 2 * this.im, f = t(u2) - Math.cos(c);
      return new l(r(u2) / f, -Math.sin(c) / f);
    }, csch: function() {
      var u2 = this.re, c = this.im, f = Math.cos(2 * c) - t(2 * u2);
      return new l(-2 * r(u2) * Math.cos(c) / f, 2 * t(u2) * Math.sin(c) / f);
    }, sech: function() {
      var u2 = this.re, c = this.im, f = Math.cos(2 * c) + t(2 * u2);
      return new l(2 * t(u2) * Math.cos(c) / f, -2 * r(u2) * Math.sin(c) / f);
    }, asinh: function() {
      var u2 = this.im;
      this.im = -this.re, this.re = u2;
      var c = this.asin();
      return this.re = -this.im, this.im = u2, u2 = c.re, c.re = -c.im, c.im = u2, c;
    }, acosh: function() {
      var u2 = this.acos();
      if (u2.im <= 0) {
        var c = u2.re;
        u2.re = -u2.im, u2.im = c;
      } else {
        var c = u2.im;
        u2.im = -u2.re, u2.re = c;
      }
      return u2;
    }, atanh: function() {
      var u2 = this.re, c = this.im, f = u2 > 1 && c === 0, h = 1 - u2, p = 1 + u2, d = h * h + c * c, v = d !== 0 ? new l((p * h - c * c) / d, (c * h + p * c) / d) : new l(u2 !== -1 ? u2 / 0 : 0, c !== 0 ? c / 0 : 0), m = v.re;
      return v.re = s(v.re, v.im) / 2, v.im = Math.atan2(v.im, m) / 2, f && (v.im = -v.im), v;
    }, acoth: function() {
      var u2 = this.re, c = this.im;
      if (u2 === 0 && c === 0) return new l(0, Math.PI / 2);
      var f = u2 * u2 + c * c;
      return f !== 0 ? new l(u2 / f, -c / f).atanh() : new l(u2 !== 0 ? u2 / 0 : 0, c !== 0 ? -c / 0 : 0).atanh();
    }, acsch: function() {
      var u2 = this.re, c = this.im;
      if (c === 0) return new l(u2 !== 0 ? Math.log(u2 + Math.sqrt(u2 * u2 + 1)) : 1 / 0, 0);
      var f = u2 * u2 + c * c;
      return f !== 0 ? new l(u2 / f, -c / f).asinh() : new l(u2 !== 0 ? u2 / 0 : 0, c !== 0 ? -c / 0 : 0).asinh();
    }, asech: function() {
      var u2 = this.re, c = this.im;
      if (this.isZero()) return l.INFINITY;
      var f = u2 * u2 + c * c;
      return f !== 0 ? new l(u2 / f, -c / f).acosh() : new l(u2 !== 0 ? u2 / 0 : 0, c !== 0 ? -c / 0 : 0).acosh();
    }, inverse: function() {
      if (this.isZero()) return l.INFINITY;
      if (this.isInfinite()) return l.ZERO;
      var u2 = this.re, c = this.im, f = u2 * u2 + c * c;
      return new l(u2 / f, -c / f);
    }, conjugate: function() {
      return new l(this.re, -this.im);
    }, neg: function() {
      return new l(-this.re, -this.im);
    }, ceil: function(u2) {
      return u2 = Math.pow(10, u2 || 0), new l(Math.ceil(this.re * u2) / u2, Math.ceil(this.im * u2) / u2);
    }, floor: function(u2) {
      return u2 = Math.pow(10, u2 || 0), new l(Math.floor(this.re * u2) / u2, Math.floor(this.im * u2) / u2);
    }, round: function(u2) {
      return u2 = Math.pow(10, u2 || 0), new l(Math.round(this.re * u2) / u2, Math.round(this.im * u2) / u2);
    }, equals: function(u2, c) {
      var f = new l(u2, c);
      return Math.abs(f.re - this.re) <= l.EPSILON && Math.abs(f.im - this.im) <= l.EPSILON;
    }, clone: function() {
      return new l(this.re, this.im);
    }, toString: function() {
      var u2 = this.re, c = this.im, f = "";
      return this.isNaN() ? "NaN" : this.isInfinite() ? "Infinity" : (Math.abs(u2) < l.EPSILON && (u2 = 0), Math.abs(c) < l.EPSILON && (c = 0), c === 0 ? f + u2 : (u2 !== 0 ? (f += u2, f += " ", c < 0 ? (c = -c, f += "-") : f += "+", f += " ") : c < 0 && (c = -c, f += "-"), c !== 1 && (f += c), f + "i"));
    }, toVector: function() {
      return [this.re, this.im];
    }, valueOf: function() {
      return this.im === 0 ? this.re : null;
    }, isNaN: function() {
      return isNaN(this.re) || isNaN(this.im);
    }, isZero: function() {
      return this.im === 0 && this.re === 0;
    }, isFinite: function() {
      return isFinite(this.re) && isFinite(this.im);
    }, isInfinite: function() {
      return !(this.isNaN() || this.isFinite());
    } }, l.ZERO = new l(0, 0), l.ONE = new l(1, 0), l.I = new l(0, 1), l.PI = new l(Math.PI, 0), l.E = new l(Math.E, 0), l.INFINITY = new l(1 / 0, 1 / 0), l.NAN = new l(NaN, NaN), l.EPSILON = 1e-15, typeof define == "function" && define.amd ? define([], function() {
      return l;
    }) : typeof aN == "object" ? (Object.defineProperty(l, "__esModule", { value: true }), l.default = l, l.Complex = l, UJ.exports = l) : e.Complex = l;
  })(aN);
});
var WJ = ri((oN, jJ) => {
  (function(e) {
    "use strict";
    var t = 2e3, r = { s: 1, n: 0, d: 1 };
    function n(v) {
      function m() {
        var x = Error.apply(this, arguments);
        x.name = this.name = v, this.stack = x.stack, this.message = x.message;
      }
      function g() {
      }
      return g.prototype = Error.prototype, m.prototype = new g(), m;
    }
    var a = d.DivisionByZero = n("DivisionByZero"), o = d.InvalidParameter = n("InvalidParameter");
    function s(v, m) {
      return isNaN(v = parseInt(v, 10)) && i(), v * m;
    }
    function i() {
      throw new o();
    }
    function l(v) {
      for (var m = {}, g = v, x = 2, b = 4; b <= g; ) {
        for (; g % x === 0; ) g /= x, m[x] = (m[x] || 0) + 1;
        b += 1 + 2 * x++;
      }
      return g !== v ? g > 1 && (m[g] = (m[g] || 0) + 1) : m[v] = (m[v] || 0) + 1, m;
    }
    var u2 = function(v, m) {
      var g = 0, x = 1, b = 1, y = 0, w = 0, _4 = 0, k = 1, T2 = 1, A2 = 0, S2 = 1, C2 = 1, E2 = 1, F13 = 1e7, N2;
      if (v != null) if (m !== void 0) g = v, x = m, b = g * x;
      else switch (typeof v) {
        case "object": {
          "d" in v && "n" in v ? (g = v.n, x = v.d, "s" in v && (g *= v.s)) : 0 in v ? (g = v[0], 1 in v && (x = v[1])) : i(), b = g * x;
          break;
        }
        case "number": {
          if (v < 0 && (b = v, v = -v), v % 1 === 0) g = v;
          else if (v > 0) {
            for (v >= 1 && (T2 = Math.pow(10, Math.floor(1 + Math.log(v) / Math.LN10)), v /= T2); S2 <= F13 && E2 <= F13; ) if (N2 = (A2 + C2) / (S2 + E2), v === N2) {
              S2 + E2 <= F13 ? (g = A2 + C2, x = S2 + E2) : E2 > S2 ? (g = C2, x = E2) : (g = A2, x = S2);
              break;
            } else v > N2 ? (A2 += C2, S2 += E2) : (C2 += A2, E2 += S2), S2 > F13 ? (g = C2, x = E2) : (g = A2, x = S2);
            g *= T2;
          } else (isNaN(v) || isNaN(m)) && (x = g = NaN);
          break;
        }
        case "string":
          if (S2 = v.match(/\d+|./g), S2 === null && i(), S2[A2] === "-" ? (b = -1, A2++) : S2[A2] === "+" && A2++, S2.length === A2 + 1 ? w = s(S2[A2++], b) : S2[A2 + 1] === "." || S2[A2] === "." ? (S2[A2] !== "." && (y = s(S2[A2++], b)), A2++, (A2 + 1 === S2.length || S2[A2 + 1] === "(" && S2[A2 + 3] === ")" || S2[A2 + 1] === "'" && S2[A2 + 3] === "'") && (w = s(S2[A2], b), k = Math.pow(10, S2[A2].length), A2++), (S2[A2] === "(" && S2[A2 + 2] === ")" || S2[A2] === "'" && S2[A2 + 2] === "'") && (_4 = s(S2[A2 + 1], b), T2 = Math.pow(10, S2[A2 + 1].length) - 1, A2 += 3)) : S2[A2 + 1] === "/" || S2[A2 + 1] === ":" ? (w = s(S2[A2], b), k = s(S2[A2 + 2], 1), A2 += 3) : S2[A2 + 3] === "/" && S2[A2 + 1] === " " && (y = s(S2[A2], b), w = s(S2[A2 + 2], b), k = s(S2[A2 + 4], 1), A2 += 5), S2.length <= A2) {
            x = k * T2, b = g = _4 + x * y + T2 * w;
            break;
          }
        default:
          i();
      }
      if (x === 0) throw new a();
      r.s = b < 0 ? -1 : 1, r.n = Math.abs(g), r.d = Math.abs(x);
    };
    function c(v, m, g) {
      for (var x = 1; m > 0; v = v * v % g, m >>= 1) m & 1 && (x = x * v % g);
      return x;
    }
    function f(v, m) {
      for (; m % 2 === 0; m /= 2) ;
      for (; m % 5 === 0; m /= 5) ;
      if (m === 1) return 0;
      for (var g = 10 % m, x = 1; g !== 1; x++) if (g = g * 10 % m, x > t) return 0;
      return x;
    }
    function h(v, m, g) {
      for (var x = 1, b = c(10, g, m), y = 0; y < 300; y++) {
        if (x === b) return y;
        x = x * 10 % m, b = b * 10 % m;
      }
      return 0;
    }
    function p(v, m) {
      if (!v) return m;
      if (!m) return v;
      for (; ; ) {
        if (v %= m, !v) return m;
        if (m %= v, !m) return v;
      }
    }
    function d(v, m) {
      if (!(this instanceof d)) return new d(v, m);
      u2(v, m), v = p(r.d, r.n), this.s = r.s, this.n = r.n / v, this.d = r.d / v;
    }
    d.prototype = { s: 1, n: 0, d: 1, abs: function() {
      return new d(this.n, this.d);
    }, neg: function() {
      return new d(-this.s * this.n, this.d);
    }, add: function(v, m) {
      return u2(v, m), new d(this.s * this.n * r.d + r.s * this.d * r.n, this.d * r.d);
    }, sub: function(v, m) {
      return u2(v, m), new d(this.s * this.n * r.d - r.s * this.d * r.n, this.d * r.d);
    }, mul: function(v, m) {
      return u2(v, m), new d(this.s * r.s * this.n * r.n, this.d * r.d);
    }, div: function(v, m) {
      return u2(v, m), new d(this.s * r.s * this.n * r.d, this.d * r.n);
    }, clone: function() {
      return new d(this);
    }, mod: function(v, m) {
      return isNaN(this.n) || isNaN(this.d) ? new d(NaN) : v === void 0 ? new d(this.s * this.n % this.d, 1) : (u2(v, m), r.n === 0 && this.d === 0 && d(0, 0), new d(this.s * (r.d * this.n) % (r.n * this.d), r.d * this.d));
    }, gcd: function(v, m) {
      return u2(v, m), new d(p(r.n, this.n) * p(r.d, this.d), r.d * this.d);
    }, lcm: function(v, m) {
      return u2(v, m), r.n === 0 && this.n === 0 ? new d() : new d(r.n * this.n, p(r.n, this.n) * p(r.d, this.d));
    }, ceil: function(v) {
      return v = Math.pow(10, v || 0), isNaN(this.n) || isNaN(this.d) ? new d(NaN) : new d(Math.ceil(v * this.s * this.n / this.d), v);
    }, floor: function(v) {
      return v = Math.pow(10, v || 0), isNaN(this.n) || isNaN(this.d) ? new d(NaN) : new d(Math.floor(v * this.s * this.n / this.d), v);
    }, round: function(v) {
      return v = Math.pow(10, v || 0), isNaN(this.n) || isNaN(this.d) ? new d(NaN) : new d(Math.round(v * this.s * this.n / this.d), v);
    }, inverse: function() {
      return new d(this.s * this.d, this.n);
    }, pow: function(v, m) {
      if (u2(v, m), r.d === 1) return r.s < 0 ? new d(Math.pow(this.s * this.d, r.n), Math.pow(this.n, r.n)) : new d(Math.pow(this.s * this.n, r.n), Math.pow(this.d, r.n));
      if (this.s < 0) return null;
      var g = l(this.n), x = l(this.d), b = 1, y = 1;
      for (var w in g) if (w !== "1") {
        if (w === "0") {
          b = 0;
          break;
        }
        if (g[w] *= r.n, g[w] % r.d === 0) g[w] /= r.d;
        else return null;
        b *= Math.pow(w, g[w]);
      }
      for (var w in x) if (w !== "1") {
        if (x[w] *= r.n, x[w] % r.d === 0) x[w] /= r.d;
        else return null;
        y *= Math.pow(w, x[w]);
      }
      return r.s < 0 ? new d(y, b) : new d(b, y);
    }, equals: function(v, m) {
      return u2(v, m), this.s * this.n * r.d === r.s * r.n * this.d;
    }, compare: function(v, m) {
      u2(v, m);
      var g = this.s * this.n * r.d - r.s * r.n * this.d;
      return (0 < g) - (g < 0);
    }, simplify: function(v) {
      if (isNaN(this.n) || isNaN(this.d)) return this;
      var m = this.abs().toContinued();
      v = v || 1e-3;
      function g(y) {
        return y.length === 1 ? new d(y[0]) : g(y.slice(1)).inverse().add(y[0]);
      }
      for (var x = 0; x < m.length; x++) {
        var b = g(m.slice(0, x + 1));
        if (b.sub(this.abs()).abs().valueOf() < v) return b.mul(this.s);
      }
      return this;
    }, divisible: function(v, m) {
      return u2(v, m), !(!(r.n * this.d) || this.n * r.d % (r.n * this.d));
    }, valueOf: function() {
      return this.s * this.n / this.d;
    }, toFraction: function(v) {
      var m, g = "", x = this.n, b = this.d;
      return this.s < 0 && (g += "-"), b === 1 ? g += x : (v && (m = Math.floor(x / b)) > 0 && (g += m, g += " ", x %= b), g += x, g += "/", g += b), g;
    }, toLatex: function(v) {
      var m, g = "", x = this.n, b = this.d;
      return this.s < 0 && (g += "-"), b === 1 ? g += x : (v && (m = Math.floor(x / b)) > 0 && (g += m, x %= b), g += "\\frac{", g += x, g += "}{", g += b, g += "}"), g;
    }, toContinued: function() {
      var v, m = this.n, g = this.d, x = [];
      if (isNaN(m) || isNaN(g)) return x;
      do
        x.push(Math.floor(m / g)), v = m % g, m = g, g = v;
      while (m !== 1);
      return x;
    }, toString: function(v) {
      var m, g = this.n, x = this.d;
      if (isNaN(g) || isNaN(x)) return "NaN";
      v = v || 15;
      var b = f(g, x), y = h(g, x, b), w = this.s === -1 ? "-" : "";
      if (w += g / x | 0, g %= x, g *= 10, g && (w += "."), b) {
        for (var _4 = y; _4--; ) w += g / x | 0, g %= x, g *= 10;
        w += "(";
        for (var _4 = b; _4--; ) w += g / x | 0, g %= x, g *= 10;
        w += ")";
      } else for (var _4 = v; g && _4--; ) w += g / x | 0, g %= x, g *= 10;
      return w;
    } }, typeof define == "function" && define.amd ? define([], function() {
      return d;
    }) : typeof oN == "object" ? (Object.defineProperty(d, "__esModule", { value: true }), d.default = d, d.Fraction = d, jJ.exports = d) : e.Fraction = d;
  })(oN);
});
var IQ = ri((g6t, MQ) => {
  "use strict";
  MQ.exports = ({ onlyFirst: e = false } = {}) => {
    let t = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");
    return new RegExp(t, e ? void 0 : "g");
  };
});
var SA = ri((y6t, NQ) => {
  "use strict";
  var bst = IQ();
  NQ.exports = (e) => typeof e == "string" ? e.replace(bst(), "") : e;
});
var cF = ri((x6t, uF) => {
  "use strict";
  var FQ = (e) => Number.isNaN(e) ? false : e >= 4352 && (e <= 4447 || e === 9001 || e === 9002 || 11904 <= e && e <= 12871 && e !== 12351 || 12880 <= e && e <= 19903 || 19968 <= e && e <= 42182 || 43360 <= e && e <= 43388 || 44032 <= e && e <= 55203 || 63744 <= e && e <= 64255 || 65040 <= e && e <= 65049 || 65072 <= e && e <= 65131 || 65281 <= e && e <= 65376 || 65504 <= e && e <= 65510 || 110592 <= e && e <= 110593 || 127488 <= e && e <= 127569 || 131072 <= e && e <= 262141);
  uF.exports = FQ;
  uF.exports.default = FQ;
});
var PQ = ri((b6t, OQ) => {
  "use strict";
  OQ.exports = function() {
    return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
  };
});
var kx = ri((_6t, fF) => {
  "use strict";
  var _st = SA(), wst = cF(), kst = PQ(), LQ = (e) => {
    if (typeof e != "string" || e.length === 0 || (e = _st(e), e.length === 0)) return 0;
    e = e.replace(kst(), "  ");
    let t = 0;
    for (let r = 0; r < e.length; r++) {
      let n = e.codePointAt(r);
      n <= 31 || n >= 127 && n <= 159 || n >= 768 && n <= 879 || (n > 65535 && r++, t += wst(n) ? 2 : 1);
    }
    return t;
  };
  fF.exports = LQ;
  fF.exports.default = LQ;
});
var BQ = ri((w6t, zQ) => {
  "use strict";
  var RQ = "[\uD800-\uDBFF][\uDC00-\uDFFF]", Tst = (e) => e && e.exact ? new RegExp(`^${RQ}$`) : new RegExp(RQ, "g");
  zQ.exports = Tst;
});
var VQ = ri((k6t, UQ) => {
  "use strict";
  UQ.exports = { 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] };
});
var hF = ri((T6t, WQ) => {
  var S_ = VQ(), jQ = {};
  for (let e of Object.keys(S_)) jQ[S_[e]] = e;
  var Ai = { rgb: { channels: 3, labels: "rgb" }, hsl: { channels: 3, labels: "hsl" }, hsv: { channels: 3, labels: "hsv" }, hwb: { channels: 3, labels: "hwb" }, cmyk: { channels: 4, labels: "cmyk" }, xyz: { channels: 3, labels: "xyz" }, lab: { channels: 3, labels: "lab" }, lch: { channels: 3, labels: "lch" }, hex: { channels: 1, labels: ["hex"] }, keyword: { channels: 1, labels: ["keyword"] }, ansi16: { channels: 1, labels: ["ansi16"] }, ansi256: { channels: 1, labels: ["ansi256"] }, hcg: { channels: 3, labels: ["h", "c", "g"] }, apple: { channels: 3, labels: ["r16", "g16", "b16"] }, gray: { channels: 1, labels: ["gray"] } };
  WQ.exports = Ai;
  for (let e of Object.keys(Ai)) {
    if (!("channels" in Ai[e])) throw new Error("missing channels property: " + e);
    if (!("labels" in Ai[e])) throw new Error("missing channel labels property: " + e);
    if (Ai[e].labels.length !== Ai[e].channels) throw new Error("channel and label counts mismatch: " + e);
    let { channels: t, labels: r } = Ai[e];
    delete Ai[e].channels, delete Ai[e].labels, Object.defineProperty(Ai[e], "channels", { value: t }), Object.defineProperty(Ai[e], "labels", { value: r });
  }
  Ai.rgb.hsl = function(e) {
    let t = e[0] / 255, r = e[1] / 255, n = e[2] / 255, a = Math.min(t, r, n), o = Math.max(t, r, n), s = o - a, i, l;
    o === a ? i = 0 : t === o ? i = (r - n) / s : r === o ? i = 2 + (n - t) / s : n === o && (i = 4 + (t - r) / s), i = Math.min(i * 60, 360), i < 0 && (i += 360);
    let u2 = (a + o) / 2;
    return o === a ? l = 0 : u2 <= 0.5 ? l = s / (o + a) : l = s / (2 - o - a), [i, l * 100, u2 * 100];
  };
  Ai.rgb.hsv = function(e) {
    let t, r, n, a, o, s = e[0] / 255, i = e[1] / 255, l = e[2] / 255, u2 = Math.max(s, i, l), c = u2 - Math.min(s, i, l), f = function(h) {
      return (u2 - h) / 6 / c + 1 / 2;
    };
    return c === 0 ? (a = 0, o = 0) : (o = c / u2, t = f(s), r = f(i), n = f(l), s === u2 ? a = n - r : i === u2 ? a = 1 / 3 + t - n : l === u2 && (a = 2 / 3 + r - t), a < 0 ? a += 1 : a > 1 && (a -= 1)), [a * 360, o * 100, u2 * 100];
  };
  Ai.rgb.hwb = function(e) {
    let t = e[0], r = e[1], n = e[2], a = Ai.rgb.hsl(e)[0], o = 1 / 255 * Math.min(t, Math.min(r, n));
    return n = 1 - 1 / 255 * Math.max(t, Math.max(r, n)), [a, o * 100, n * 100];
  };
  Ai.rgb.cmyk = function(e) {
    let t = e[0] / 255, r = e[1] / 255, n = e[2] / 255, a = Math.min(1 - t, 1 - r, 1 - n), o = (1 - t - a) / (1 - a) || 0, s = (1 - r - a) / (1 - a) || 0, i = (1 - n - a) / (1 - a) || 0;
    return [o * 100, s * 100, i * 100, a * 100];
  };
  function Ast(e, t) {
    return (e[0] - t[0]) ** 2 + (e[1] - t[1]) ** 2 + (e[2] - t[2]) ** 2;
  }
  Ai.rgb.keyword = function(e) {
    let t = jQ[e];
    if (t) return t;
    let r = 1 / 0, n;
    for (let a of Object.keys(S_)) {
      let o = S_[a], s = Ast(e, o);
      s < r && (r = s, n = a);
    }
    return n;
  };
  Ai.keyword.rgb = function(e) {
    return S_[e];
  };
  Ai.rgb.xyz = function(e) {
    let t = e[0] / 255, r = e[1] / 255, n = e[2] / 255;
    t = t > 0.04045 ? ((t + 0.055) / 1.055) ** 2.4 : t / 12.92, r = r > 0.04045 ? ((r + 0.055) / 1.055) ** 2.4 : r / 12.92, n = n > 0.04045 ? ((n + 0.055) / 1.055) ** 2.4 : n / 12.92;
    let a = t * 0.4124 + r * 0.3576 + n * 0.1805, o = t * 0.2126 + r * 0.7152 + n * 0.0722, s = t * 0.0193 + r * 0.1192 + n * 0.9505;
    return [a * 100, o * 100, s * 100];
  };
  Ai.rgb.lab = function(e) {
    let t = Ai.rgb.xyz(e), r = t[0], n = t[1], a = t[2];
    r /= 95.047, n /= 100, a /= 108.883, r = r > 8856e-6 ? r ** (1 / 3) : 7.787 * r + 16 / 116, n = n > 8856e-6 ? n ** (1 / 3) : 7.787 * n + 16 / 116, a = a > 8856e-6 ? a ** (1 / 3) : 7.787 * a + 16 / 116;
    let o = 116 * n - 16, s = 500 * (r - n), i = 200 * (n - a);
    return [o, s, i];
  };
  Ai.hsl.rgb = function(e) {
    let t = e[0] / 360, r = e[1] / 100, n = e[2] / 100, a, o, s;
    if (r === 0) return s = n * 255, [s, s, s];
    n < 0.5 ? a = n * (1 + r) : a = n + r - n * r;
    let i = 2 * n - a, l = [0, 0, 0];
    for (let u2 = 0; u2 < 3; u2++) o = t + 1 / 3 * -(u2 - 1), o < 0 && o++, o > 1 && o--, 6 * o < 1 ? s = i + (a - i) * 6 * o : 2 * o < 1 ? s = a : 3 * o < 2 ? s = i + (a - i) * (2 / 3 - o) * 6 : s = i, l[u2] = s * 255;
    return l;
  };
  Ai.hsl.hsv = function(e) {
    let t = e[0], r = e[1] / 100, n = e[2] / 100, a = r, o = Math.max(n, 0.01);
    n *= 2, r *= n <= 1 ? n : 2 - n, a *= o <= 1 ? o : 2 - o;
    let s = (n + r) / 2, i = n === 0 ? 2 * a / (o + a) : 2 * r / (n + r);
    return [t, i * 100, s * 100];
  };
  Ai.hsv.rgb = function(e) {
    let t = e[0] / 60, r = e[1] / 100, n = e[2] / 100, a = Math.floor(t) % 6, o = t - Math.floor(t), s = 255 * n * (1 - r), i = 255 * n * (1 - r * o), l = 255 * n * (1 - r * (1 - o));
    switch (n *= 255, a) {
      case 0:
        return [n, l, s];
      case 1:
        return [i, n, s];
      case 2:
        return [s, n, l];
      case 3:
        return [s, i, n];
      case 4:
        return [l, s, n];
      case 5:
        return [n, s, i];
    }
  };
  Ai.hsv.hsl = function(e) {
    let t = e[0], r = e[1] / 100, n = e[2] / 100, a = Math.max(n, 0.01), o, s;
    s = (2 - r) * n;
    let i = (2 - r) * a;
    return o = r * a, o /= i <= 1 ? i : 2 - i, o = o || 0, s /= 2, [t, o * 100, s * 100];
  };
  Ai.hwb.rgb = function(e) {
    let t = e[0] / 360, r = e[1] / 100, n = e[2] / 100, a = r + n, o;
    a > 1 && (r /= a, n /= a);
    let s = Math.floor(6 * t), i = 1 - n;
    o = 6 * t - s, (s & 1) !== 0 && (o = 1 - o);
    let l = r + o * (i - r), u2, c, f;
    switch (s) {
      default:
      case 6:
      case 0:
        u2 = i, c = l, f = r;
        break;
      case 1:
        u2 = l, c = i, f = r;
        break;
      case 2:
        u2 = r, c = i, f = l;
        break;
      case 3:
        u2 = r, c = l, f = i;
        break;
      case 4:
        u2 = l, c = r, f = i;
        break;
      case 5:
        u2 = i, c = r, f = l;
        break;
    }
    return [u2 * 255, c * 255, f * 255];
  };
  Ai.cmyk.rgb = function(e) {
    let t = e[0] / 100, r = e[1] / 100, n = e[2] / 100, a = e[3] / 100, o = 1 - Math.min(1, t * (1 - a) + a), s = 1 - Math.min(1, r * (1 - a) + a), i = 1 - Math.min(1, n * (1 - a) + a);
    return [o * 255, s * 255, i * 255];
  };
  Ai.xyz.rgb = function(e) {
    let t = e[0] / 100, r = e[1] / 100, n = e[2] / 100, a, o, s;
    return a = t * 3.2406 + r * -1.5372 + n * -0.4986, o = t * -0.9689 + r * 1.8758 + n * 0.0415, s = t * 0.0557 + r * -0.204 + n * 1.057, a = a > 31308e-7 ? 1.055 * a ** (1 / 2.4) - 0.055 : a * 12.92, o = o > 31308e-7 ? 1.055 * o ** (1 / 2.4) - 0.055 : o * 12.92, s = s > 31308e-7 ? 1.055 * s ** (1 / 2.4) - 0.055 : s * 12.92, a = Math.min(Math.max(0, a), 1), o = Math.min(Math.max(0, o), 1), s = Math.min(Math.max(0, s), 1), [a * 255, o * 255, s * 255];
  };
  Ai.xyz.lab = function(e) {
    let t = e[0], r = e[1], n = e[2];
    t /= 95.047, r /= 100, n /= 108.883, t = t > 8856e-6 ? t ** (1 / 3) : 7.787 * t + 16 / 116, r = r > 8856e-6 ? r ** (1 / 3) : 7.787 * r + 16 / 116, n = n > 8856e-6 ? n ** (1 / 3) : 7.787 * n + 16 / 116;
    let a = 116 * r - 16, o = 500 * (t - r), s = 200 * (r - n);
    return [a, o, s];
  };
  Ai.lab.xyz = function(e) {
    let t = e[0], r = e[1], n = e[2], a, o, s;
    o = (t + 16) / 116, a = r / 500 + o, s = o - n / 200;
    let i = o ** 3, l = a ** 3, u2 = s ** 3;
    return o = i > 8856e-6 ? i : (o - 16 / 116) / 7.787, a = l > 8856e-6 ? l : (a - 16 / 116) / 7.787, s = u2 > 8856e-6 ? u2 : (s - 16 / 116) / 7.787, a *= 95.047, o *= 100, s *= 108.883, [a, o, s];
  };
  Ai.lab.lch = function(e) {
    let t = e[0], r = e[1], n = e[2], a;
    a = Math.atan2(n, r) * 360 / 2 / Math.PI, a < 0 && (a += 360);
    let s = Math.sqrt(r * r + n * n);
    return [t, s, a];
  };
  Ai.lch.lab = function(e) {
    let t = e[0], r = e[1], a = e[2] / 360 * 2 * Math.PI, o = r * Math.cos(a), s = r * Math.sin(a);
    return [t, o, s];
  };
  Ai.rgb.ansi16 = function(e, t = null) {
    let [r, n, a] = e, o = t === null ? Ai.rgb.hsv(e)[2] : t;
    if (o = Math.round(o / 50), o === 0) return 30;
    let s = 30 + (Math.round(a / 255) << 2 | Math.round(n / 255) << 1 | Math.round(r / 255));
    return o === 2 && (s += 60), s;
  };
  Ai.hsv.ansi16 = function(e) {
    return Ai.rgb.ansi16(Ai.hsv.rgb(e), e[2]);
  };
  Ai.rgb.ansi256 = function(e) {
    let t = e[0], r = e[1], n = e[2];
    return t === r && r === n ? t < 8 ? 16 : t > 248 ? 231 : Math.round((t - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(t / 255 * 5) + 6 * Math.round(r / 255 * 5) + Math.round(n / 255 * 5);
  };
  Ai.ansi16.rgb = function(e) {
    let t = e % 10;
    if (t === 0 || t === 7) return e > 50 && (t += 3.5), t = t / 10.5 * 255, [t, t, t];
    let r = (~~(e > 50) + 1) * 0.5, n = (t & 1) * r * 255, a = (t >> 1 & 1) * r * 255, o = (t >> 2 & 1) * r * 255;
    return [n, a, o];
  };
  Ai.ansi256.rgb = function(e) {
    if (e >= 232) {
      let o = (e - 232) * 10 + 8;
      return [o, o, o];
    }
    e -= 16;
    let t, r = Math.floor(e / 36) / 5 * 255, n = Math.floor((t = e % 36) / 6) / 5 * 255, a = t % 6 / 5 * 255;
    return [r, n, a];
  };
  Ai.rgb.hex = function(e) {
    let r = (((Math.round(e[0]) & 255) << 16) + ((Math.round(e[1]) & 255) << 8) + (Math.round(e[2]) & 255)).toString(16).toUpperCase();
    return "000000".substring(r.length) + r;
  };
  Ai.hex.rgb = function(e) {
    let t = e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
    if (!t) return [0, 0, 0];
    let r = t[0];
    t[0].length === 3 && (r = r.split("").map((i) => i + i).join(""));
    let n = parseInt(r, 16), a = n >> 16 & 255, o = n >> 8 & 255, s = n & 255;
    return [a, o, s];
  };
  Ai.rgb.hcg = function(e) {
    let t = e[0] / 255, r = e[1] / 255, n = e[2] / 255, a = Math.max(Math.max(t, r), n), o = Math.min(Math.min(t, r), n), s = a - o, i, l;
    return s < 1 ? i = o / (1 - s) : i = 0, s <= 0 ? l = 0 : a === t ? l = (r - n) / s % 6 : a === r ? l = 2 + (n - t) / s : l = 4 + (t - r) / s, l /= 6, l %= 1, [l * 360, s * 100, i * 100];
  };
  Ai.hsl.hcg = function(e) {
    let t = e[1] / 100, r = e[2] / 100, n = r < 0.5 ? 2 * t * r : 2 * t * (1 - r), a = 0;
    return n < 1 && (a = (r - 0.5 * n) / (1 - n)), [e[0], n * 100, a * 100];
  };
  Ai.hsv.hcg = function(e) {
    let t = e[1] / 100, r = e[2] / 100, n = t * r, a = 0;
    return n < 1 && (a = (r - n) / (1 - n)), [e[0], n * 100, a * 100];
  };
  Ai.hcg.rgb = function(e) {
    let t = e[0] / 360, r = e[1] / 100, n = e[2] / 100;
    if (r === 0) return [n * 255, n * 255, n * 255];
    let a = [0, 0, 0], o = t % 1 * 6, s = o % 1, i = 1 - s, l = 0;
    switch (Math.floor(o)) {
      case 0:
        a[0] = 1, a[1] = s, a[2] = 0;
        break;
      case 1:
        a[0] = i, a[1] = 1, a[2] = 0;
        break;
      case 2:
        a[0] = 0, a[1] = 1, a[2] = s;
        break;
      case 3:
        a[0] = 0, a[1] = i, a[2] = 1;
        break;
      case 4:
        a[0] = s, a[1] = 0, a[2] = 1;
        break;
      default:
        a[0] = 1, a[1] = 0, a[2] = i;
    }
    return l = (1 - r) * n, [(r * a[0] + l) * 255, (r * a[1] + l) * 255, (r * a[2] + l) * 255];
  };
  Ai.hcg.hsv = function(e) {
    let t = e[1] / 100, r = e[2] / 100, n = t + r * (1 - t), a = 0;
    return n > 0 && (a = t / n), [e[0], a * 100, n * 100];
  };
  Ai.hcg.hsl = function(e) {
    let t = e[1] / 100, n = e[2] / 100 * (1 - t) + 0.5 * t, a = 0;
    return n > 0 && n < 0.5 ? a = t / (2 * n) : n >= 0.5 && n < 1 && (a = t / (2 * (1 - n))), [e[0], a * 100, n * 100];
  };
  Ai.hcg.hwb = function(e) {
    let t = e[1] / 100, r = e[2] / 100, n = t + r * (1 - t);
    return [e[0], (n - t) * 100, (1 - n) * 100];
  };
  Ai.hwb.hcg = function(e) {
    let t = e[1] / 100, r = e[2] / 100, n = 1 - r, a = n - t, o = 0;
    return a < 1 && (o = (n - a) / (1 - a)), [e[0], a * 100, o * 100];
  };
  Ai.apple.rgb = function(e) {
    return [e[0] / 65535 * 255, e[1] / 65535 * 255, e[2] / 65535 * 255];
  };
  Ai.rgb.apple = function(e) {
    return [e[0] / 255 * 65535, e[1] / 255 * 65535, e[2] / 255 * 65535];
  };
  Ai.gray.rgb = function(e) {
    return [e[0] / 100 * 255, e[0] / 100 * 255, e[0] / 100 * 255];
  };
  Ai.gray.hsl = function(e) {
    return [0, 0, e[0]];
  };
  Ai.gray.hsv = Ai.gray.hsl;
  Ai.gray.hwb = function(e) {
    return [0, 100, e[0]];
  };
  Ai.gray.cmyk = function(e) {
    return [0, 0, 0, e[0]];
  };
  Ai.gray.lab = function(e) {
    return [e[0], 0, 0];
  };
  Ai.gray.hex = function(e) {
    let t = Math.round(e[0] / 100 * 255) & 255, n = ((t << 16) + (t << 8) + t).toString(16).toUpperCase();
    return "000000".substring(n.length) + n;
  };
  Ai.rgb.gray = function(e) {
    return [(e[0] + e[1] + e[2]) / 3 / 255 * 100];
  };
});
var $Q = ri((A6t, GQ) => {
  var EA = hF();
  function Sst() {
    let e = {}, t = Object.keys(EA);
    for (let r = t.length, n = 0; n < r; n++) e[t[n]] = { distance: -1, parent: null };
    return e;
  }
  function Est(e) {
    let t = Sst(), r = [e];
    for (t[e].distance = 0; r.length; ) {
      let n = r.pop(), a = Object.keys(EA[n]);
      for (let o = a.length, s = 0; s < o; s++) {
        let i = a[s], l = t[i];
        l.distance === -1 && (l.distance = t[n].distance + 1, l.parent = n, r.unshift(i));
      }
    }
    return t;
  }
  function Dst(e, t) {
    return function(r) {
      return t(e(r));
    };
  }
  function Cst(e, t) {
    let r = [t[e].parent, e], n = EA[t[e].parent][e], a = t[e].parent;
    for (; t[a].parent; ) r.unshift(t[a].parent), n = Dst(EA[t[a].parent][a], n), a = t[a].parent;
    return n.conversion = r, n;
  }
  GQ.exports = function(e) {
    let t = Est(e), r = {}, n = Object.keys(t);
    for (let a = n.length, o = 0; o < a; o++) {
      let s = n[o];
      t[s].parent !== null && (r[s] = Cst(s, t));
    }
    return r;
  };
});
var qQ = ri((S6t, HQ) => {
  var pF = hF(), Mst = $Q(), Tx = {}, Ist = Object.keys(pF);
  function Nst(e) {
    let t = function(...r) {
      let n = r[0];
      return n == null ? n : (n.length > 1 && (r = n), e(r));
    };
    return "conversion" in e && (t.conversion = e.conversion), t;
  }
  function Fst(e) {
    let t = function(...r) {
      let n = r[0];
      if (n == null) return n;
      n.length > 1 && (r = n);
      let a = e(r);
      if (typeof a == "object") for (let o = a.length, s = 0; s < o; s++) a[s] = Math.round(a[s]);
      return a;
    };
    return "conversion" in e && (t.conversion = e.conversion), t;
  }
  Ist.forEach((e) => {
    Tx[e] = {}, Object.defineProperty(Tx[e], "channels", { value: pF[e].channels }), Object.defineProperty(Tx[e], "labels", { value: pF[e].labels });
    let t = Mst(e);
    Object.keys(t).forEach((n) => {
      let a = t[n];
      Tx[e][n] = Fst(a), Tx[e][n].raw = Nst(a);
    });
  });
  HQ.exports = Tx;
});
var QQ = ri((E6t, JQ) => {
  "use strict";
  var XQ = (e, t) => (...r) => `\x1B[${e(...r) + t}m`, KQ = (e, t) => (...r) => {
    let n = e(...r);
    return `\x1B[${38 + t};5;${n}m`;
  }, YQ = (e, t) => (...r) => {
    let n = e(...r);
    return `\x1B[${38 + t};2;${n[0]};${n[1]};${n[2]}m`;
  }, DA = (e) => e, ZQ = (e, t, r) => [e, t, r], Ax = (e, t, r) => {
    Object.defineProperty(e, t, { get: () => {
      let n = r();
      return Object.defineProperty(e, t, { value: n, enumerable: true, configurable: true }), n;
    }, enumerable: true, configurable: true });
  }, dF, Sx = (e, t, r, n) => {
    dF === void 0 && (dF = qQ());
    let a = n ? 10 : 0, o = {};
    for (let [s, i] of Object.entries(dF)) {
      let l = s === "ansi16" ? "ansi" : s;
      s === t ? o[l] = e(r, a) : typeof i == "object" && (o[l] = e(i[t], a));
    }
    return o;
  };
  function Ost() {
    let e = /* @__PURE__ */ new Map(), t = { modifier: { reset: [0, 0], bold: [1, 22], dim: [2, 22], italic: [3, 23], underline: [4, 24], inverse: [7, 27], hidden: [8, 28], strikethrough: [9, 29] }, color: { black: [30, 39], red: [31, 39], green: [32, 39], yellow: [33, 39], blue: [34, 39], magenta: [35, 39], cyan: [36, 39], white: [37, 39], blackBright: [90, 39], redBright: [91, 39], greenBright: [92, 39], yellowBright: [93, 39], blueBright: [94, 39], magentaBright: [95, 39], cyanBright: [96, 39], whiteBright: [97, 39] }, bgColor: { bgBlack: [40, 49], bgRed: [41, 49], bgGreen: [42, 49], bgYellow: [43, 49], bgBlue: [44, 49], bgMagenta: [45, 49], bgCyan: [46, 49], bgWhite: [47, 49], bgBlackBright: [100, 49], bgRedBright: [101, 49], bgGreenBright: [102, 49], bgYellowBright: [103, 49], bgBlueBright: [104, 49], bgMagentaBright: [105, 49], bgCyanBright: [106, 49], bgWhiteBright: [107, 49] } };
    t.color.gray = t.color.blackBright, t.bgColor.bgGray = t.bgColor.bgBlackBright, t.color.grey = t.color.blackBright, t.bgColor.bgGrey = t.bgColor.bgBlackBright;
    for (let [r, n] of Object.entries(t)) {
      for (let [a, o] of Object.entries(n)) t[a] = { open: `\x1B[${o[0]}m`, close: `\x1B[${o[1]}m` }, n[a] = t[a], e.set(o[0], o[1]);
      Object.defineProperty(t, r, { value: n, enumerable: false });
    }
    return Object.defineProperty(t, "codes", { value: e, enumerable: false }), t.color.close = "\x1B[39m", t.bgColor.close = "\x1B[49m", Ax(t.color, "ansi", () => Sx(XQ, "ansi16", DA, false)), Ax(t.color, "ansi256", () => Sx(KQ, "ansi256", DA, false)), Ax(t.color, "ansi16m", () => Sx(YQ, "rgb", ZQ, false)), Ax(t.bgColor, "ansi", () => Sx(XQ, "ansi16", DA, true)), Ax(t.bgColor, "ansi256", () => Sx(KQ, "ansi256", DA, true)), Ax(t.bgColor, "ansi16m", () => Sx(YQ, "rgb", ZQ, true)), t;
  }
  Object.defineProperty(JQ, "exports", { enumerable: true, get: Ost });
});
var MA = ri((D6t, nee) => {
  "use strict";
  var Pst = cF(), Lst = BQ(), eee = QQ(), ree = ["\x1B", "\x9B"], CA = (e) => `${ree[0]}[${e}m`, tee = (e, t, r) => {
    let n = [];
    e = [...e];
    for (let a of e) {
      let o = a;
      a.includes(";") && (a = a.split(";")[0][0] + "0");
      let s = eee.codes.get(Number.parseInt(a, 10));
      if (s) {
        let i = e.indexOf(s.toString());
        i === -1 ? n.push(CA(t ? s : o)) : e.splice(i, 1);
      } else if (t) {
        n.push(CA(0));
        break;
      } else n.push(CA(o));
    }
    if (t && (n = n.filter((a, o) => n.indexOf(a) === o), r !== void 0)) {
      let a = CA(eee.codes.get(Number.parseInt(r, 10)));
      n = n.reduce((o, s) => s === a ? [s, ...o] : [...o, s], []);
    }
    return n.join("");
  };
  nee.exports = (e, t, r) => {
    let n = [...e], a = [], o = typeof r == "number" ? r : n.length, s = false, i, l = 0, u2 = "";
    for (let [c, f] of n.entries()) {
      let h = false;
      if (ree.includes(f)) {
        let p = /\d[^m]*/.exec(e.slice(c, c + 18));
        i = p && p.length > 0 ? p[0] : void 0, l < o && (s = true, i !== void 0 && a.push(i));
      } else s && f === "m" && (s = false, h = true);
      if (!s && !h && l++, !Lst({ exact: true }).test(f) && Pst(f.codePointAt()) && (l++, typeof r != "number" && o++), l > t && l <= o) u2 += f;
      else if (l === t && !s && i !== void 0) u2 = tee(a);
      else if (l >= o) {
        u2 += tee(a, true, i);
        break;
      }
    }
    return u2;
  };
});
var vF = ri((IA) => {
  "use strict";
  Object.defineProperty(IA, "__esModule", { value: true });
  IA.getBorderCharacters = void 0;
  var Rst = (e) => {
    if (e === "honeywell") return { topBody: "\u2550", topJoin: "\u2564", topLeft: "\u2554", topRight: "\u2557", bottomBody: "\u2550", bottomJoin: "\u2567", bottomLeft: "\u255A", bottomRight: "\u255D", bodyLeft: "\u2551", bodyRight: "\u2551", bodyJoin: "\u2502", headerJoin: "\u252C", joinBody: "\u2500", joinLeft: "\u255F", joinRight: "\u2562", joinJoin: "\u253C" };
    if (e === "norc") return { topBody: "\u2500", topJoin: "\u252C", topLeft: "\u250C", topRight: "\u2510", bottomBody: "\u2500", bottomJoin: "\u2534", bottomLeft: "\u2514", bottomRight: "\u2518", bodyLeft: "\u2502", bodyRight: "\u2502", bodyJoin: "\u2502", headerJoin: "\u252C", joinBody: "\u2500", joinLeft: "\u251C", joinRight: "\u2524", joinJoin: "\u253C" };
    if (e === "ramac") return { topBody: "-", topJoin: "+", topLeft: "+", topRight: "+", bottomBody: "-", bottomJoin: "+", bottomLeft: "+", bottomRight: "+", bodyLeft: "|", bodyRight: "|", bodyJoin: "|", headerJoin: "+", joinBody: "-", joinLeft: "|", joinRight: "|", joinJoin: "|" };
    if (e === "void") return { topBody: "", topJoin: "", topLeft: "", topRight: "", bottomBody: "", bottomJoin: "", bottomLeft: "", bottomRight: "", bodyLeft: "", bodyRight: "", bodyJoin: "", headerJoin: "", joinBody: "", joinLeft: "", joinRight: "", joinJoin: "" };
    throw new Error('Unknown border template "' + e + '".');
  };
  IA.getBorderCharacters = Rst;
});
var Zv = ri((pf) => {
  "use strict";
  var mF = pf && pf.__importDefault || function(e) {
    return e && e.__esModule ? e : { default: e };
  };
  Object.defineProperty(pf, "__esModule", { value: true });
  pf.distributeUnevenly = pf.countSpaceSequence = pf.groupBySizes = pf.makeBorderConfig = pf.splitAnsi = pf.normalizeString = void 0;
  var zst = mF(MA()), Bst = mF(kx()), Ust = mF(SA()), Vst = vF(), jst = (e) => e.replace(/\r\n/g, `
`);
  pf.normalizeString = jst;
  var Wst = (e) => {
    let t = Ust.default(e).split(`
`).map(Bst.default), r = [], n = 0;
    return t.forEach((a) => {
      r.push(a === 0 ? "" : zst.default(e, n, n + a)), n += a + 1;
    }), r;
  };
  pf.splitAnsi = Wst;
  var Gst = (e) => __spreadValues(__spreadValues({}, Vst.getBorderCharacters("honeywell")), e);
  pf.makeBorderConfig = Gst;
  var $st = (e, t) => {
    let r = 0;
    return t.map((n) => {
      let a = e.slice(r, r + n);
      return r += n, a;
    });
  };
  pf.groupBySizes = $st;
  var Hst = (e) => {
    var t, r;
    return (r = (t = e.match(/\s+/g)) === null || t === void 0 ? void 0 : t.length) !== null && r !== void 0 ? r : 0;
  };
  pf.countSpaceSequence = Hst;
  var qst = (e, t) => Array.from({ length: t }).fill(Math.floor(e / t)).map((n, a) => n + (a < e % t ? 1 : 0));
  pf.distributeUnevenly = qst;
});
var yF = ri((Ex) => {
  "use strict";
  var Xst = Ex && Ex.__importDefault || function(e) {
    return e && e.__esModule ? e : { default: e };
  };
  Object.defineProperty(Ex, "__esModule", { value: true });
  Ex.alignString = void 0;
  var Kst = Xst(kx()), aee = Zv(), gF = (e, t) => e + " ".repeat(t), Yst = (e, t) => " ".repeat(t) + e, Zst = (e, t) => " ".repeat(Math.floor(t / 2)) + e + " ".repeat(Math.ceil(t / 2)), Jst = (e, t) => {
    let r = aee.countSpaceSequence(e);
    if (r === 0) return gF(e, t);
    let n = aee.distributeUnevenly(t, r);
    if (Math.max(...n) > 3) return gF(e, t);
    let a = 0;
    return e.replace(/\s+/g, (o) => o + " ".repeat(n[a++]));
  }, Qst = (e, t, r) => {
    let n = Kst.default(e);
    if (n === t) return e;
    if (n > t) throw new Error("Subject parameter value width cannot be greater than the container width.");
    if (n === 0) return " ".repeat(t);
    let a = t - n;
    return r === "left" ? gF(e, a) : r === "right" ? Yst(e, a) : r === "justify" ? Jst(e, a) : Zst(e, a);
  };
  Ex.alignString = Qst;
});
var xF = ri((NA) => {
  "use strict";
  Object.defineProperty(NA, "__esModule", { value: true });
  NA.alignTableData = void 0;
  var elt = yF(), tlt = (e, t) => e.map((r) => r.map((n, a) => {
    let { width: o, alignment: s } = t.columns[a];
    return elt.alignString(n, o, s);
  }));
  NA.alignTableData = tlt;
});
var see = ri((Dx) => {
  "use strict";
  var oee = Dx && Dx.__importDefault || function(e) {
    return e && e.__esModule ? e : { default: e };
  };
  Object.defineProperty(Dx, "__esModule", { value: true });
  Dx.wrapString = void 0;
  var iee = oee(MA()), rlt = oee(kx()), nlt = (e, t) => {
    let r = e, n = [];
    do
      n.push(iee.default(r, 0, t)), r = iee.default(r, t).trim();
    while (rlt.default(r));
    return n;
  };
  Dx.wrapString = nlt;
});
var uee = ri((Cx) => {
  "use strict";
  var lee = Cx && Cx.__importDefault || function(e) {
    return e && e.__esModule ? e : { default: e };
  };
  Object.defineProperty(Cx, "__esModule", { value: true });
  Cx.wrapWord = void 0;
  var alt = lee(MA()), ilt = lee(SA()), olt = (e, t) => {
    let r = ilt.default(e), n = [], a = new RegExp("(^.{1," + String(t) + "}(\\s+|$))|(^.{1," + String(t - 1) + "}(\\\\|/|_|\\.|,|;|-))");
    do {
      let o, s = a.exec(r);
      if (s) {
        o = s[0], r = r.slice(o.length);
        let i = o.trim().length, l = o.length - i;
        n.push([i, l]);
      } else o = r.slice(0, t), r = r.slice(t), n.push([o.length, 0]);
    } while (r.length);
    return n;
  }, slt = (e, t) => {
    let r = [], n = 0;
    return olt(e, t).forEach(([a, o]) => {
      r.push(alt.default(e, n, n + a)), n += a + o;
    }), r;
  };
  Cx.wrapWord = slt;
});
var OA = ri((FA) => {
  "use strict";
  Object.defineProperty(FA, "__esModule", { value: true });
  FA.wrapCell = void 0;
  var llt = Zv(), ult = see(), clt = uee(), flt = (e, t, r) => {
    let n = llt.splitAnsi(e);
    for (let a = 0; a < n.length; ) {
      let o;
      r ? o = clt.wrapWord(n[a], t) : o = ult.wrapString(n[a], t), n.splice(a, 1, ...o), a += o.length;
    }
    return n;
  };
  FA.wrapCell = flt;
});
var cee = ri((PA) => {
  "use strict";
  Object.defineProperty(PA, "__esModule", { value: true });
  PA.calculateCellHeight = void 0;
  var hlt = OA(), plt = (e, t, r = false) => hlt.wrapCell(e, t, r).length;
  PA.calculateCellHeight = plt;
});
var bF = ri((LA) => {
  "use strict";
  Object.defineProperty(LA, "__esModule", { value: true });
  LA.calculateRowHeights = void 0;
  var dlt = cee(), vlt = (e, t) => e.map((r) => {
    let n = 1;
    return r.forEach((a, o) => {
      let s = dlt.calculateCellHeight(a, t.columns[o].width, t.columns[o].wrapWord);
      n = Math.max(n, s);
    }), n;
  });
  LA.calculateRowHeights = vlt;
});
var zA = ri((RA) => {
  "use strict";
  Object.defineProperty(RA, "__esModule", { value: true });
  RA.drawContent = void 0;
  var mlt = (e, t) => {
    let { separatorGetter: r, drawSeparator: n } = t, a = e.length, o = [];
    return n(0, a) && o.push(r(0, a)), e.forEach((s, i) => {
      o.push(s), i + 1 < a && n(i + 1, a) && o.push(r(i + 1, a));
    }), n(a, a) && o.push(r(a, a)), o.join("");
  };
  RA.drawContent = mlt;
});
var kF = ri((Tp) => {
  "use strict";
  Object.defineProperty(Tp, "__esModule", { value: true });
  Tp.drawBorderTop = Tp.drawBorderJoin = Tp.drawBorderBottom = Tp.drawBorder = Tp.createTableBorderGetter = void 0;
  var glt = zA(), UA = (e, t) => {
    let { separator: r, drawVerticalLine: n } = t, a = e.map((o) => t.separator.body.repeat(o));
    return glt.drawContent(a, { drawSeparator: n, separatorGetter: (o, s) => o === 0 ? r.left : o === s ? r.right : r.join }) + `
`;
  };
  Tp.drawBorder = UA;
  var _F = (e, t) => {
    let r = UA(e, __spreadProps(__spreadValues({}, t), { separator: { body: t.border.topBody, join: t.border.topJoin, left: t.border.topLeft, right: t.border.topRight } }));
    return r === `
` ? "" : r;
  };
  Tp.drawBorderTop = _F;
  var BA = (e, t) => UA(e, __spreadProps(__spreadValues({}, t), { separator: { body: t.border.joinBody, join: t.border.joinJoin, left: t.border.joinLeft, right: t.border.joinRight } }));
  Tp.drawBorderJoin = BA;
  var wF = (e, t) => UA(e, __spreadProps(__spreadValues({}, t), { separator: { body: t.border.bottomBody, join: t.border.bottomJoin, left: t.border.bottomLeft, right: t.border.bottomRight } }));
  Tp.drawBorderBottom = wF;
  var ylt = (e, t) => (r, n) => t.header ? r === 0 ? _F(e, __spreadProps(__spreadValues({}, t), { border: __spreadProps(__spreadValues({}, t.border), { topJoin: t.border.topBody }) })) : r === 1 ? BA(e, __spreadProps(__spreadValues({}, t), { border: __spreadProps(__spreadValues({}, t.border), { joinJoin: t.border.headerJoin }) })) : r === n ? wF(e, t) : BA(e, t) : r === 0 ? _F(e, t) : r === n ? wF(e, t) : BA(e, t);
  Tp.createTableBorderGetter = ylt;
});
var jA = ri((VA) => {
  "use strict";
  Object.defineProperty(VA, "__esModule", { value: true });
  VA.drawRow = void 0;
  var xlt = zA(), blt = (e, t) => {
    let { border: r, drawVerticalLine: n } = t;
    return xlt.drawContent(e, { drawSeparator: n, separatorGetter: (a, o) => a === 0 ? r.bodyLeft : a === o ? r.bodyRight : r.bodyJoin }) + `
`;
  };
  VA.drawRow = blt;
});
var zF = ri((E_, Mx) => {
  var _lt = 200, wee = "__lodash_hash_undefined__", kee = 9007199254740991, IF = "[object Arguments]", wlt = "[object Array]", Tee = "[object Boolean]", Aee = "[object Date]", klt = "[object Error]", NF = "[object Function]", See = "[object GeneratorFunction]", WA = "[object Map]", Eee = "[object Number]", FF = "[object Object]", fee = "[object Promise]", Dee = "[object RegExp]", GA = "[object Set]", Cee = "[object String]", Mee = "[object Symbol]", AF = "[object WeakMap]", Iee = "[object ArrayBuffer]", $A = "[object DataView]", Nee = "[object Float32Array]", Fee = "[object Float64Array]", Oee = "[object Int8Array]", Pee = "[object Int16Array]", Lee = "[object Int32Array]", Ree = "[object Uint8Array]", zee = "[object Uint8ClampedArray]", Bee = "[object Uint16Array]", Uee = "[object Uint32Array]", Tlt = /[\\^$.*+?()[\]{}|]/g, Alt = /\w*$/, Slt = /^\[object .+?Constructor\]$/, Elt = /^(?:0|[1-9]\d*)$/, Al = {};
  Al[IF] = Al[wlt] = Al[Iee] = Al[$A] = Al[Tee] = Al[Aee] = Al[Nee] = Al[Fee] = Al[Oee] = Al[Pee] = Al[Lee] = Al[WA] = Al[Eee] = Al[FF] = Al[Dee] = Al[GA] = Al[Cee] = Al[Mee] = Al[Ree] = Al[zee] = Al[Bee] = Al[Uee] = true;
  Al[klt] = Al[NF] = Al[AF] = false;
  var Dlt = typeof global == "object" && global && global.Object === Object && global, Clt = typeof self == "object" && self && self.Object === Object && self, L0 = Dlt || Clt || Function("return this")(), Vee = typeof E_ == "object" && E_ && !E_.nodeType && E_, hee = Vee && typeof Mx == "object" && Mx && !Mx.nodeType && Mx, Mlt = hee && hee.exports === Vee;
  function Ilt(e, t) {
    return e.set(t[0], t[1]), e;
  }
  function Nlt(e, t) {
    return e.add(t), e;
  }
  function Flt(e, t) {
    for (var r = -1, n = e ? e.length : 0; ++r < n && t(e[r], r, e) !== false; ) ;
    return e;
  }
  function Olt(e, t) {
    for (var r = -1, n = t.length, a = e.length; ++r < n; ) e[a + r] = t[r];
    return e;
  }
  function jee(e, t, r, n) {
    var a = -1, o = e ? e.length : 0;
    for (n && o && (r = e[++a]); ++a < o; ) r = t(r, e[a], a, e);
    return r;
  }
  function Plt(e, t) {
    for (var r = -1, n = Array(e); ++r < e; ) n[r] = t(r);
    return n;
  }
  function Llt(e, t) {
    return e?.[t];
  }
  function Wee(e) {
    var t = false;
    if (e != null && typeof e.toString != "function") try {
      t = !!(e + "");
    } catch {
    }
    return t;
  }
  function pee(e) {
    var t = -1, r = Array(e.size);
    return e.forEach(function(n, a) {
      r[++t] = [a, n];
    }), r;
  }
  function OF(e, t) {
    return function(r) {
      return e(t(r));
    };
  }
  function dee(e) {
    var t = -1, r = Array(e.size);
    return e.forEach(function(n) {
      r[++t] = n;
    }), r;
  }
  var Rlt = Array.prototype, zlt = Function.prototype, HA = Object.prototype, TF = L0["__core-js_shared__"], vee = function() {
    var e = /[^.]+$/.exec(TF && TF.keys && TF.keys.IE_PROTO || "");
    return e ? "Symbol(src)_1." + e : "";
  }(), Gee = zlt.toString, Jv = HA.hasOwnProperty, qA = HA.toString, Blt = RegExp("^" + Gee.call(Jv).replace(Tlt, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"), mee = Mlt ? L0.Buffer : void 0, gee = L0.Symbol, yee = L0.Uint8Array, Ult = OF(Object.getPrototypeOf, Object), Vlt = Object.create, jlt = HA.propertyIsEnumerable, Wlt = Rlt.splice, xee = Object.getOwnPropertySymbols, Glt = mee ? mee.isBuffer : void 0, $lt = OF(Object.keys, Object), SF = Fx(L0, "DataView"), D_ = Fx(L0, "Map"), EF = Fx(L0, "Promise"), DF = Fx(L0, "Set"), CF = Fx(L0, "WeakMap"), C_ = Fx(Object, "create"), Hlt = qg(SF), qlt = qg(D_), Xlt = qg(EF), Klt = qg(DF), Ylt = qg(CF), bee = gee ? gee.prototype : void 0, _ee = bee ? bee.valueOf : void 0;
  function Hg(e) {
    var t = -1, r = e ? e.length : 0;
    for (this.clear(); ++t < r; ) {
      var n = e[t];
      this.set(n[0], n[1]);
    }
  }
  function Zlt() {
    this.__data__ = C_ ? C_(null) : {};
  }
  function Jlt(e) {
    return this.has(e) && delete this.__data__[e];
  }
  function Qlt(e) {
    var t = this.__data__;
    if (C_) {
      var r = t[e];
      return r === wee ? void 0 : r;
    }
    return Jv.call(t, e) ? t[e] : void 0;
  }
  function eut(e) {
    var t = this.__data__;
    return C_ ? t[e] !== void 0 : Jv.call(t, e);
  }
  function tut(e, t) {
    var r = this.__data__;
    return r[e] = C_ && t === void 0 ? wee : t, this;
  }
  Hg.prototype.clear = Zlt;
  Hg.prototype.delete = Jlt;
  Hg.prototype.get = Qlt;
  Hg.prototype.has = eut;
  Hg.prototype.set = tut;
  function R0(e) {
    var t = -1, r = e ? e.length : 0;
    for (this.clear(); ++t < r; ) {
      var n = e[t];
      this.set(n[0], n[1]);
    }
  }
  function rut() {
    this.__data__ = [];
  }
  function nut(e) {
    var t = this.__data__, r = XA(t, e);
    if (r < 0) return false;
    var n = t.length - 1;
    return r == n ? t.pop() : Wlt.call(t, r, 1), true;
  }
  function aut(e) {
    var t = this.__data__, r = XA(t, e);
    return r < 0 ? void 0 : t[r][1];
  }
  function iut(e) {
    return XA(this.__data__, e) > -1;
  }
  function out(e, t) {
    var r = this.__data__, n = XA(r, e);
    return n < 0 ? r.push([e, t]) : r[n][1] = t, this;
  }
  R0.prototype.clear = rut;
  R0.prototype.delete = nut;
  R0.prototype.get = aut;
  R0.prototype.has = iut;
  R0.prototype.set = out;
  function Ix(e) {
    var t = -1, r = e ? e.length : 0;
    for (this.clear(); ++t < r; ) {
      var n = e[t];
      this.set(n[0], n[1]);
    }
  }
  function sut() {
    this.__data__ = { hash: new Hg(), map: new (D_ || R0)(), string: new Hg() };
  }
  function lut(e) {
    return KA(this, e).delete(e);
  }
  function uut(e) {
    return KA(this, e).get(e);
  }
  function cut(e) {
    return KA(this, e).has(e);
  }
  function fut(e, t) {
    return KA(this, e).set(e, t), this;
  }
  Ix.prototype.clear = sut;
  Ix.prototype.delete = lut;
  Ix.prototype.get = uut;
  Ix.prototype.has = cut;
  Ix.prototype.set = fut;
  function Nx(e) {
    this.__data__ = new R0(e);
  }
  function hut() {
    this.__data__ = new R0();
  }
  function put(e) {
    return this.__data__.delete(e);
  }
  function dut(e) {
    return this.__data__.get(e);
  }
  function vut(e) {
    return this.__data__.has(e);
  }
  function mut(e, t) {
    var r = this.__data__;
    if (r instanceof R0) {
      var n = r.__data__;
      if (!D_ || n.length < _lt - 1) return n.push([e, t]), this;
      r = this.__data__ = new Ix(n);
    }
    return r.set(e, t), this;
  }
  Nx.prototype.clear = hut;
  Nx.prototype.delete = put;
  Nx.prototype.get = dut;
  Nx.prototype.has = vut;
  Nx.prototype.set = mut;
  function gut(e, t) {
    var r = LF(e) || Vut(e) ? Plt(e.length, String) : [], n = r.length, a = !!n;
    for (var o in e) (t || Jv.call(e, o)) && !(a && (o == "length" || Rut(o, n))) && r.push(o);
    return r;
  }
  function $ee(e, t, r) {
    var n = e[t];
    (!(Jv.call(e, t) && Kee(n, r)) || r === void 0 && !(t in e)) && (e[t] = r);
  }
  function XA(e, t) {
    for (var r = e.length; r--; ) if (Kee(e[r][0], t)) return r;
    return -1;
  }
  function yut(e, t) {
    return e && Hee(t, RF(t), e);
  }
  function MF(e, t, r, n, a, o, s) {
    var i;
    if (n && (i = o ? n(e, a, o, s) : n(e)), i !== void 0) return i;
    if (!YA(e)) return e;
    var l = LF(e);
    if (l) {
      if (i = Out(e), !t) return Iut(e, i);
    } else {
      var u2 = $g(e), c = u2 == NF || u2 == See;
      if (Wut(e)) return Tut(e, t);
      if (u2 == FF || u2 == IF || c && !o) {
        if (Wee(e)) return o ? e : {};
        if (i = Put(c ? {} : e), !t) return Nut(e, yut(i, e));
      } else {
        if (!Al[u2]) return o ? e : {};
        i = Lut(e, u2, MF, t);
      }
    }
    s || (s = new Nx());
    var f = s.get(e);
    if (f) return f;
    if (s.set(e, i), !l) var h = r ? Fut(e) : RF(e);
    return Flt(h || e, function(p, d) {
      h && (d = p, p = e[d]), $ee(i, d, MF(p, t, r, n, d, e, s));
    }), i;
  }
  function xut(e) {
    return YA(e) ? Vlt(e) : {};
  }
  function but(e, t, r) {
    var n = t(e);
    return LF(e) ? n : Olt(n, r(e));
  }
  function _ut(e) {
    return qA.call(e);
  }
  function wut(e) {
    if (!YA(e) || But(e)) return false;
    var t = Zee(e) || Wee(e) ? Blt : Slt;
    return t.test(qg(e));
  }
  function kut(e) {
    if (!Xee(e)) return $lt(e);
    var t = [];
    for (var r in Object(e)) Jv.call(e, r) && r != "constructor" && t.push(r);
    return t;
  }
  function Tut(e, t) {
    if (t) return e.slice();
    var r = new e.constructor(e.length);
    return e.copy(r), r;
  }
  function PF(e) {
    var t = new e.constructor(e.byteLength);
    return new yee(t).set(new yee(e)), t;
  }
  function Aut(e, t) {
    var r = t ? PF(e.buffer) : e.buffer;
    return new e.constructor(r, e.byteOffset, e.byteLength);
  }
  function Sut(e, t, r) {
    var n = t ? r(pee(e), true) : pee(e);
    return jee(n, Ilt, new e.constructor());
  }
  function Eut(e) {
    var t = new e.constructor(e.source, Alt.exec(e));
    return t.lastIndex = e.lastIndex, t;
  }
  function Dut(e, t, r) {
    var n = t ? r(dee(e), true) : dee(e);
    return jee(n, Nlt, new e.constructor());
  }
  function Cut(e) {
    return _ee ? Object(_ee.call(e)) : {};
  }
  function Mut(e, t) {
    var r = t ? PF(e.buffer) : e.buffer;
    return new e.constructor(r, e.byteOffset, e.length);
  }
  function Iut(e, t) {
    var r = -1, n = e.length;
    for (t || (t = Array(n)); ++r < n; ) t[r] = e[r];
    return t;
  }
  function Hee(e, t, r, n) {
    r || (r = {});
    for (var a = -1, o = t.length; ++a < o; ) {
      var s = t[a], i = n ? n(r[s], e[s], s, r, e) : void 0;
      $ee(r, s, i === void 0 ? e[s] : i);
    }
    return r;
  }
  function Nut(e, t) {
    return Hee(e, qee(e), t);
  }
  function Fut(e) {
    return but(e, RF, qee);
  }
  function KA(e, t) {
    var r = e.__data__;
    return zut(t) ? r[typeof t == "string" ? "string" : "hash"] : r.map;
  }
  function Fx(e, t) {
    var r = Llt(e, t);
    return wut(r) ? r : void 0;
  }
  var qee = xee ? OF(xee, Object) : Hut, $g = _ut;
  (SF && $g(new SF(new ArrayBuffer(1))) != $A || D_ && $g(new D_()) != WA || EF && $g(EF.resolve()) != fee || DF && $g(new DF()) != GA || CF && $g(new CF()) != AF) && ($g = function(e) {
    var t = qA.call(e), r = t == FF ? e.constructor : void 0, n = r ? qg(r) : void 0;
    if (n) switch (n) {
      case Hlt:
        return $A;
      case qlt:
        return WA;
      case Xlt:
        return fee;
      case Klt:
        return GA;
      case Ylt:
        return AF;
    }
    return t;
  });
  function Out(e) {
    var t = e.length, r = e.constructor(t);
    return t && typeof e[0] == "string" && Jv.call(e, "index") && (r.index = e.index, r.input = e.input), r;
  }
  function Put(e) {
    return typeof e.constructor == "function" && !Xee(e) ? xut(Ult(e)) : {};
  }
  function Lut(e, t, r, n) {
    var a = e.constructor;
    switch (t) {
      case Iee:
        return PF(e);
      case Tee:
      case Aee:
        return new a(+e);
      case $A:
        return Aut(e, n);
      case Nee:
      case Fee:
      case Oee:
      case Pee:
      case Lee:
      case Ree:
      case zee:
      case Bee:
      case Uee:
        return Mut(e, n);
      case WA:
        return Sut(e, n, r);
      case Eee:
      case Cee:
        return new a(e);
      case Dee:
        return Eut(e);
      case GA:
        return Dut(e, n, r);
      case Mee:
        return Cut(e);
    }
  }
  function Rut(e, t) {
    return t = t ?? kee, !!t && (typeof e == "number" || Elt.test(e)) && e > -1 && e % 1 == 0 && e < t;
  }
  function zut(e) {
    var t = typeof e;
    return t == "string" || t == "number" || t == "symbol" || t == "boolean" ? e !== "__proto__" : e === null;
  }
  function But(e) {
    return !!vee && vee in e;
  }
  function Xee(e) {
    var t = e && e.constructor, r = typeof t == "function" && t.prototype || HA;
    return e === r;
  }
  function qg(e) {
    if (e != null) {
      try {
        return Gee.call(e);
      } catch {
      }
      try {
        return e + "";
      } catch {
      }
    }
    return "";
  }
  function Uut(e) {
    return MF(e, true, true);
  }
  function Kee(e, t) {
    return e === t || e !== e && t !== t;
  }
  function Vut(e) {
    return jut(e) && Jv.call(e, "callee") && (!jlt.call(e, "callee") || qA.call(e) == IF);
  }
  var LF = Array.isArray;
  function Yee(e) {
    return e != null && Gut(e.length) && !Zee(e);
  }
  function jut(e) {
    return $ut(e) && Yee(e);
  }
  var Wut = Glt || qut;
  function Zee(e) {
    var t = YA(e) ? qA.call(e) : "";
    return t == NF || t == See;
  }
  function Gut(e) {
    return typeof e == "number" && e > -1 && e % 1 == 0 && e <= kee;
  }
  function YA(e) {
    var t = typeof e;
    return !!e && (t == "object" || t == "function");
  }
  function $ut(e) {
    return !!e && typeof e == "object";
  }
  function RF(e) {
    return Yee(e) ? gut(e) : kut(e);
  }
  function Hut() {
    return [];
  }
  function qut() {
    return false;
  }
  Mx.exports = Uut;
});
var Qee = ri((V6t, Jee) => {
  "use strict";
  Jee.exports = function e(t, r) {
    if (t === r) return true;
    if (t && r && typeof t == "object" && typeof r == "object") {
      if (t.constructor !== r.constructor) return false;
      var n, a, o;
      if (Array.isArray(t)) {
        if (n = t.length, n != r.length) return false;
        for (a = n; a-- !== 0; ) if (!e(t[a], r[a])) return false;
        return true;
      }
      if (t.constructor === RegExp) return t.source === r.source && t.flags === r.flags;
      if (t.valueOf !== Object.prototype.valueOf) return t.valueOf() === r.valueOf();
      if (t.toString !== Object.prototype.toString) return t.toString() === r.toString();
      if (o = Object.keys(t), n = o.length, n !== Object.keys(r).length) return false;
      for (a = n; a-- !== 0; ) if (!Object.prototype.hasOwnProperty.call(r, o[a])) return false;
      for (a = n; a-- !== 0; ) {
        var s = o[a];
        if (!e(t[s], r[s])) return false;
      }
      return true;
    }
    return t !== t && r !== r;
  };
});
var tte = ri((BF) => {
  "use strict";
  Object.defineProperty(BF, "__esModule", { value: true });
  var ete = Qee();
  ete.code = 'require("ajv/dist/runtime/equal").default';
  BF.default = ete;
});
var ste = ri((VF) => {
  "use strict";
  VF["config.json"] = ite;
  var rte = { type: "object", properties: { topBody: { $ref: "#/definitions/border" }, topJoin: { $ref: "#/definitions/border" }, topLeft: { $ref: "#/definitions/border" }, topRight: { $ref: "#/definitions/border" }, bottomBody: { $ref: "#/definitions/border" }, bottomJoin: { $ref: "#/definitions/border" }, bottomLeft: { $ref: "#/definitions/border" }, bottomRight: { $ref: "#/definitions/border" }, bodyLeft: { $ref: "#/definitions/border" }, bodyRight: { $ref: "#/definitions/border" }, bodyJoin: { $ref: "#/definitions/border" }, headerJoin: { $ref: "#/definitions/border" }, joinBody: { $ref: "#/definitions/border" }, joinLeft: { $ref: "#/definitions/border" }, joinRight: { $ref: "#/definitions/border" }, joinJoin: { $ref: "#/definitions/border" } }, additionalProperties: false }, nte = Object.prototype.hasOwnProperty;
  function ba(e, { instancePath: t = "", parentData: r, parentDataProperty: n, rootData: a = e } = {}) {
    let o = null, s = 0;
    if (typeof e != "string") {
      let i = { instancePath: t, schemaPath: "#/type", keyword: "type", params: { type: "string" }, message: "must be string" };
      o === null ? o = [i] : o.push(i), s++;
    }
    return ba.errors = o, s === 0;
  }
  function ZA(e, { instancePath: t = "", parentData: r, parentDataProperty: n, rootData: a = e } = {}) {
    let o = null, s = 0;
    if (e && typeof e == "object" && !Array.isArray(e)) {
      for (let i in e) if (!nte.call(rte.properties, i)) {
        let l = { instancePath: t, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: i }, message: "must NOT have additional properties" };
        o === null ? o = [l] : o.push(l), s++;
      }
      e.topBody !== void 0 && (ba(e.topBody, { instancePath: t + "/topBody", parentData: e, parentDataProperty: "topBody", rootData: a }) || (o = o === null ? ba.errors : o.concat(ba.errors), s = o.length)), e.topJoin !== void 0 && (ba(e.topJoin, { instancePath: t + "/topJoin", parentData: e, parentDataProperty: "topJoin", rootData: a }) || (o = o === null ? ba.errors : o.concat(ba.errors), s = o.length)), e.topLeft !== void 0 && (ba(e.topLeft, { instancePath: t + "/topLeft", parentData: e, parentDataProperty: "topLeft", rootData: a }) || (o = o === null ? ba.errors : o.concat(ba.errors), s = o.length)), e.topRight !== void 0 && (ba(e.topRight, { instancePath: t + "/topRight", parentData: e, parentDataProperty: "topRight", rootData: a }) || (o = o === null ? ba.errors : o.concat(ba.errors), s = o.length)), e.bottomBody !== void 0 && (ba(e.bottomBody, { instancePath: t + "/bottomBody", parentData: e, parentDataProperty: "bottomBody", rootData: a }) || (o = o === null ? ba.errors : o.concat(ba.errors), s = o.length)), e.bottomJoin !== void 0 && (ba(e.bottomJoin, { instancePath: t + "/bottomJoin", parentData: e, parentDataProperty: "bottomJoin", rootData: a }) || (o = o === null ? ba.errors : o.concat(ba.errors), s = o.length)), e.bottomLeft !== void 0 && (ba(e.bottomLeft, { instancePath: t + "/bottomLeft", parentData: e, parentDataProperty: "bottomLeft", rootData: a }) || (o = o === null ? ba.errors : o.concat(ba.errors), s = o.length)), e.bottomRight !== void 0 && (ba(e.bottomRight, { instancePath: t + "/bottomRight", parentData: e, parentDataProperty: "bottomRight", rootData: a }) || (o = o === null ? ba.errors : o.concat(ba.errors), s = o.length)), e.bodyLeft !== void 0 && (ba(e.bodyLeft, { instancePath: t + "/bodyLeft", parentData: e, parentDataProperty: "bodyLeft", rootData: a }) || (o = o === null ? ba.errors : o.concat(ba.errors), s = o.length)), e.bodyRight !== void 0 && (ba(e.bodyRight, { instancePath: t + "/bodyRight", parentData: e, parentDataProperty: "bodyRight", rootData: a }) || (o = o === null ? ba.errors : o.concat(ba.errors), s = o.length)), e.bodyJoin !== void 0 && (ba(e.bodyJoin, { instancePath: t + "/bodyJoin", parentData: e, parentDataProperty: "bodyJoin", rootData: a }) || (o = o === null ? ba.errors : o.concat(ba.errors), s = o.length)), e.headerJoin !== void 0 && (ba(e.headerJoin, { instancePath: t + "/headerJoin", parentData: e, parentDataProperty: "headerJoin", rootData: a }) || (o = o === null ? ba.errors : o.concat(ba.errors), s = o.length)), e.joinBody !== void 0 && (ba(e.joinBody, { instancePath: t + "/joinBody", parentData: e, parentDataProperty: "joinBody", rootData: a }) || (o = o === null ? ba.errors : o.concat(ba.errors), s = o.length)), e.joinLeft !== void 0 && (ba(e.joinLeft, { instancePath: t + "/joinLeft", parentData: e, parentDataProperty: "joinLeft", rootData: a }) || (o = o === null ? ba.errors : o.concat(ba.errors), s = o.length)), e.joinRight !== void 0 && (ba(e.joinRight, { instancePath: t + "/joinRight", parentData: e, parentDataProperty: "joinRight", rootData: a }) || (o = o === null ? ba.errors : o.concat(ba.errors), s = o.length)), e.joinJoin !== void 0 && (ba(e.joinJoin, { instancePath: t + "/joinJoin", parentData: e, parentDataProperty: "joinJoin", rootData: a }) || (o = o === null ? ba.errors : o.concat(ba.errors), s = o.length));
    } else {
      let i = { instancePath: t, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
      o === null ? o = [i] : o.push(i), s++;
    }
    return ZA.errors = o, s === 0;
  }
  var ate = { type: "string", enum: ["left", "right", "center", "justify"] }, W6t = tte().default;
  function JA(e, { instancePath: t = "", parentData: r, parentDataProperty: n, rootData: a = e } = {}) {
    let o = null, s = 0;
    if (typeof e != "string") {
      let i = { instancePath: t, schemaPath: "#/type", keyword: "type", params: { type: "string" }, message: "must be string" };
      o === null ? o = [i] : o.push(i), s++;
    }
    if (!(e === "left" || e === "right" || e === "center" || e === "justify")) {
      let i = { instancePath: t, schemaPath: "#/enum", keyword: "enum", params: { allowedValues: ate.enum }, message: "must be equal to one of the allowed values" };
      o === null ? o = [i] : o.push(i), s++;
    }
    return JA.errors = o, s === 0;
  }
  var aS = new RegExp("^[0-9]+$", "u"), UF = { type: "object", properties: { alignment: { $ref: "#/definitions/alignment" }, verticalAlignment: { type: "string", enum: ["top", "middle", "bottom"] }, width: { type: "integer", minimum: 1 }, wrapWord: { type: "boolean" }, truncate: { type: "integer" }, paddingLeft: { type: "integer" }, paddingRight: { type: "integer" } }, additionalProperties: false };
  function e0(e, { instancePath: t = "", parentData: r, parentDataProperty: n, rootData: a = e } = {}) {
    let o = null, s = 0;
    if (typeof e != "string") {
      let i = { instancePath: t, schemaPath: "#/type", keyword: "type", params: { type: "string" }, message: "must be string" };
      o === null ? o = [i] : o.push(i), s++;
    }
    if (!(e === "left" || e === "right" || e === "center" || e === "justify")) {
      let i = { instancePath: t, schemaPath: "#/enum", keyword: "enum", params: { allowedValues: ate.enum }, message: "must be equal to one of the allowed values" };
      o === null ? o = [i] : o.push(i), s++;
    }
    return e0.errors = o, s === 0;
  }
  function Wh(e, { instancePath: t = "", parentData: r, parentDataProperty: n, rootData: a = e } = {}) {
    let o = null, s = 0;
    if (e && typeof e == "object" && !Array.isArray(e)) {
      for (let i in e) if (!(i === "alignment" || i === "verticalAlignment" || i === "width" || i === "wrapWord" || i === "truncate" || i === "paddingLeft" || i === "paddingRight")) {
        let l = { instancePath: t, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: i }, message: "must NOT have additional properties" };
        o === null ? o = [l] : o.push(l), s++;
      }
      if (e.alignment !== void 0 && (e0(e.alignment, { instancePath: t + "/alignment", parentData: e, parentDataProperty: "alignment", rootData: a }) || (o = o === null ? e0.errors : o.concat(e0.errors), s = o.length)), e.verticalAlignment !== void 0) {
        let i = e.verticalAlignment;
        if (typeof i != "string") {
          let l = { instancePath: t + "/verticalAlignment", schemaPath: "#/properties/verticalAlignment/type", keyword: "type", params: { type: "string" }, message: "must be string" };
          o === null ? o = [l] : o.push(l), s++;
        }
        if (!(i === "top" || i === "middle" || i === "bottom")) {
          let l = { instancePath: t + "/verticalAlignment", schemaPath: "#/properties/verticalAlignment/enum", keyword: "enum", params: { allowedValues: UF.properties.verticalAlignment.enum }, message: "must be equal to one of the allowed values" };
          o === null ? o = [l] : o.push(l), s++;
        }
      }
      if (e.width !== void 0) {
        let i = e.width;
        if (!(typeof i == "number" && !(i % 1) && !isNaN(i) && isFinite(i))) {
          let l = { instancePath: t + "/width", schemaPath: "#/properties/width/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
          o === null ? o = [l] : o.push(l), s++;
        }
        if (typeof i == "number" && isFinite(i) && (i < 1 || isNaN(i))) {
          let l = { instancePath: t + "/width", schemaPath: "#/properties/width/minimum", keyword: "minimum", params: { comparison: ">=", limit: 1 }, message: "must be >= 1" };
          o === null ? o = [l] : o.push(l), s++;
        }
      }
      if (e.wrapWord !== void 0 && typeof e.wrapWord != "boolean") {
        let i = { instancePath: t + "/wrapWord", schemaPath: "#/properties/wrapWord/type", keyword: "type", params: { type: "boolean" }, message: "must be boolean" };
        o === null ? o = [i] : o.push(i), s++;
      }
      if (e.truncate !== void 0) {
        let i = e.truncate;
        if (!(typeof i == "number" && !(i % 1) && !isNaN(i) && isFinite(i))) {
          let l = { instancePath: t + "/truncate", schemaPath: "#/properties/truncate/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
          o === null ? o = [l] : o.push(l), s++;
        }
      }
      if (e.paddingLeft !== void 0) {
        let i = e.paddingLeft;
        if (!(typeof i == "number" && !(i % 1) && !isNaN(i) && isFinite(i))) {
          let l = { instancePath: t + "/paddingLeft", schemaPath: "#/properties/paddingLeft/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
          o === null ? o = [l] : o.push(l), s++;
        }
      }
      if (e.paddingRight !== void 0) {
        let i = e.paddingRight;
        if (!(typeof i == "number" && !(i % 1) && !isNaN(i) && isFinite(i))) {
          let l = { instancePath: t + "/paddingRight", schemaPath: "#/properties/paddingRight/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
          o === null ? o = [l] : o.push(l), s++;
        }
      }
    } else {
      let i = { instancePath: t, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
      o === null ? o = [i] : o.push(i), s++;
    }
    return Wh.errors = o, s === 0;
  }
  function QA(e, { instancePath: t = "", parentData: r, parentDataProperty: n, rootData: a = e } = {}) {
    let o = null, s = 0, i = s, l = false, u2 = null, c = s;
    if (e && typeof e == "object" && !Array.isArray(e)) {
      for (let p in e) if (!aS.test(p)) {
        let d = { instancePath: t, schemaPath: "#/oneOf/0/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: p }, message: "must NOT have additional properties" };
        o === null ? o = [d] : o.push(d), s++;
      }
      for (let p in e) aS.test(p) && (Wh(e[p], { instancePath: t + "/" + p.replace(/~/g, "~0").replace(/\//g, "~1"), parentData: e, parentDataProperty: p, rootData: a }) || (o = o === null ? Wh.errors : o.concat(Wh.errors), s = o.length));
    } else {
      let p = { instancePath: t, schemaPath: "#/oneOf/0/type", keyword: "type", params: { type: "object" }, message: "must be object" };
      o === null ? o = [p] : o.push(p), s++;
    }
    var h = c === s;
    h && (l = true, u2 = 0);
    let f = s;
    if (Array.isArray(e)) {
      let p = e.length;
      for (let d = 0; d < p; d++) Wh(e[d], { instancePath: t + "/" + d, parentData: e, parentDataProperty: d, rootData: a }) || (o = o === null ? Wh.errors : o.concat(Wh.errors), s = o.length);
    } else {
      let p = { instancePath: t, schemaPath: "#/oneOf/1/type", keyword: "type", params: { type: "array" }, message: "must be array" };
      o === null ? o = [p] : o.push(p), s++;
    }
    var h = f === s;
    if (h && l ? (l = false, u2 = [u2, 1]) : h && (l = true, u2 = 1), l) s = i, o !== null && (i ? o.length = i : o = null);
    else {
      let p = { instancePath: t, schemaPath: "#/oneOf", keyword: "oneOf", params: { passingSchemas: u2 }, message: "must match exactly one schema in oneOf" };
      o === null ? o = [p] : o.push(p), s++;
    }
    return QA.errors = o, s === 0;
  }
  function eS(e, { instancePath: t = "", parentData: r, parentDataProperty: n, rootData: a = e } = {}) {
    let o = null, s = 0;
    if (e && typeof e == "object" && !Array.isArray(e)) {
      for (let i in e) if (!(i === "alignment" || i === "verticalAlignment" || i === "width" || i === "wrapWord" || i === "truncate" || i === "paddingLeft" || i === "paddingRight")) {
        let l = { instancePath: t, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: i }, message: "must NOT have additional properties" };
        o === null ? o = [l] : o.push(l), s++;
      }
      if (e.alignment !== void 0 && (e0(e.alignment, { instancePath: t + "/alignment", parentData: e, parentDataProperty: "alignment", rootData: a }) || (o = o === null ? e0.errors : o.concat(e0.errors), s = o.length)), e.verticalAlignment !== void 0) {
        let i = e.verticalAlignment;
        if (typeof i != "string") {
          let l = { instancePath: t + "/verticalAlignment", schemaPath: "#/properties/verticalAlignment/type", keyword: "type", params: { type: "string" }, message: "must be string" };
          o === null ? o = [l] : o.push(l), s++;
        }
        if (!(i === "top" || i === "middle" || i === "bottom")) {
          let l = { instancePath: t + "/verticalAlignment", schemaPath: "#/properties/verticalAlignment/enum", keyword: "enum", params: { allowedValues: UF.properties.verticalAlignment.enum }, message: "must be equal to one of the allowed values" };
          o === null ? o = [l] : o.push(l), s++;
        }
      }
      if (e.width !== void 0) {
        let i = e.width;
        if (!(typeof i == "number" && !(i % 1) && !isNaN(i) && isFinite(i))) {
          let l = { instancePath: t + "/width", schemaPath: "#/properties/width/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
          o === null ? o = [l] : o.push(l), s++;
        }
        if (typeof i == "number" && isFinite(i) && (i < 1 || isNaN(i))) {
          let l = { instancePath: t + "/width", schemaPath: "#/properties/width/minimum", keyword: "minimum", params: { comparison: ">=", limit: 1 }, message: "must be >= 1" };
          o === null ? o = [l] : o.push(l), s++;
        }
      }
      if (e.wrapWord !== void 0 && typeof e.wrapWord != "boolean") {
        let i = { instancePath: t + "/wrapWord", schemaPath: "#/properties/wrapWord/type", keyword: "type", params: { type: "boolean" }, message: "must be boolean" };
        o === null ? o = [i] : o.push(i), s++;
      }
      if (e.truncate !== void 0) {
        let i = e.truncate;
        if (!(typeof i == "number" && !(i % 1) && !isNaN(i) && isFinite(i))) {
          let l = { instancePath: t + "/truncate", schemaPath: "#/properties/truncate/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
          o === null ? o = [l] : o.push(l), s++;
        }
      }
      if (e.paddingLeft !== void 0) {
        let i = e.paddingLeft;
        if (!(typeof i == "number" && !(i % 1) && !isNaN(i) && isFinite(i))) {
          let l = { instancePath: t + "/paddingLeft", schemaPath: "#/properties/paddingLeft/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
          o === null ? o = [l] : o.push(l), s++;
        }
      }
      if (e.paddingRight !== void 0) {
        let i = e.paddingRight;
        if (!(typeof i == "number" && !(i % 1) && !isNaN(i) && isFinite(i))) {
          let l = { instancePath: t + "/paddingRight", schemaPath: "#/properties/paddingRight/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
          o === null ? o = [l] : o.push(l), s++;
        }
      }
    } else {
      let i = { instancePath: t, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
      o === null ? o = [i] : o.push(i), s++;
    }
    return eS.errors = o, s === 0;
  }
  function ite(e, { instancePath: t = "", parentData: r, parentDataProperty: n, rootData: a = e } = {}) {
    let o = null, s = 0;
    if (e && typeof e == "object" && !Array.isArray(e)) {
      for (let i in e) if (!(i === "border" || i === "header" || i === "columns" || i === "columnDefault" || i === "drawVerticalLine" || i === "drawHorizontalLine" || i === "singleLine")) {
        let l = { instancePath: t, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: i }, message: "must NOT have additional properties" };
        o === null ? o = [l] : o.push(l), s++;
      }
      if (e.border !== void 0 && (ZA(e.border, { instancePath: t + "/border", parentData: e, parentDataProperty: "border", rootData: a }) || (o = o === null ? ZA.errors : o.concat(ZA.errors), s = o.length)), e.header !== void 0) {
        let i = e.header;
        if (i && typeof i == "object" && !Array.isArray(i)) {
          if (i.content === void 0) {
            let l = { instancePath: t + "/header", schemaPath: "#/properties/header/required", keyword: "required", params: { missingProperty: "content" }, message: "must have required property 'content'" };
            o === null ? o = [l] : o.push(l), s++;
          }
          for (let l in i) if (!(l === "content" || l === "alignment" || l === "wrapWord" || l === "truncate" || l === "paddingLeft" || l === "paddingRight")) {
            let u2 = { instancePath: t + "/header", schemaPath: "#/properties/header/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: l }, message: "must NOT have additional properties" };
            o === null ? o = [u2] : o.push(u2), s++;
          }
          if (i.content !== void 0 && typeof i.content != "string") {
            let l = { instancePath: t + "/header/content", schemaPath: "#/properties/header/properties/content/type", keyword: "type", params: { type: "string" }, message: "must be string" };
            o === null ? o = [l] : o.push(l), s++;
          }
          if (i.alignment !== void 0 && (JA(i.alignment, { instancePath: t + "/header/alignment", parentData: i, parentDataProperty: "alignment", rootData: a }) || (o = o === null ? JA.errors : o.concat(JA.errors), s = o.length)), i.wrapWord !== void 0 && typeof i.wrapWord != "boolean") {
            let l = { instancePath: t + "/header/wrapWord", schemaPath: "#/properties/header/properties/wrapWord/type", keyword: "type", params: { type: "boolean" }, message: "must be boolean" };
            o === null ? o = [l] : o.push(l), s++;
          }
          if (i.truncate !== void 0) {
            let l = i.truncate;
            if (!(typeof l == "number" && !(l % 1) && !isNaN(l) && isFinite(l))) {
              let u2 = { instancePath: t + "/header/truncate", schemaPath: "#/properties/header/properties/truncate/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
              o === null ? o = [u2] : o.push(u2), s++;
            }
          }
          if (i.paddingLeft !== void 0) {
            let l = i.paddingLeft;
            if (!(typeof l == "number" && !(l % 1) && !isNaN(l) && isFinite(l))) {
              let u2 = { instancePath: t + "/header/paddingLeft", schemaPath: "#/properties/header/properties/paddingLeft/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
              o === null ? o = [u2] : o.push(u2), s++;
            }
          }
          if (i.paddingRight !== void 0) {
            let l = i.paddingRight;
            if (!(typeof l == "number" && !(l % 1) && !isNaN(l) && isFinite(l))) {
              let u2 = { instancePath: t + "/header/paddingRight", schemaPath: "#/properties/header/properties/paddingRight/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
              o === null ? o = [u2] : o.push(u2), s++;
            }
          }
        } else {
          let l = { instancePath: t + "/header", schemaPath: "#/properties/header/type", keyword: "type", params: { type: "object" }, message: "must be object" };
          o === null ? o = [l] : o.push(l), s++;
        }
      }
      if (e.columns !== void 0 && (QA(e.columns, { instancePath: t + "/columns", parentData: e, parentDataProperty: "columns", rootData: a }) || (o = o === null ? QA.errors : o.concat(QA.errors), s = o.length)), e.columnDefault !== void 0 && (eS(e.columnDefault, { instancePath: t + "/columnDefault", parentData: e, parentDataProperty: "columnDefault", rootData: a }) || (o = o === null ? eS.errors : o.concat(eS.errors), s = o.length)), e.drawVerticalLine !== void 0 && typeof e.drawVerticalLine != "function") {
        let i = { instancePath: t + "/drawVerticalLine", schemaPath: "#/properties/drawVerticalLine/typeof", keyword: "typeof", params: {}, message: 'should pass "typeof" keyword validation' };
        o === null ? o = [i] : o.push(i), s++;
      }
      if (e.drawHorizontalLine !== void 0 && typeof e.drawHorizontalLine != "function") {
        let i = { instancePath: t + "/drawHorizontalLine", schemaPath: "#/properties/drawHorizontalLine/typeof", keyword: "typeof", params: {}, message: 'should pass "typeof" keyword validation' };
        o === null ? o = [i] : o.push(i), s++;
      }
      if (e.singleLine !== void 0 && typeof e.singleLine != "boolean") {
        let i = { instancePath: t + "/singleLine", schemaPath: "#/properties/singleLine/typeof", keyword: "typeof", params: {}, message: 'should pass "typeof" keyword validation' };
        o === null ? o = [i] : o.push(i), s++;
      }
    } else {
      let i = { instancePath: t, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
      o === null ? o = [i] : o.push(i), s++;
    }
    return ite.errors = o, s === 0;
  }
  VF["streamConfig.json"] = ote;
  function tS(e, { instancePath: t = "", parentData: r, parentDataProperty: n, rootData: a = e } = {}) {
    let o = null, s = 0;
    if (e && typeof e == "object" && !Array.isArray(e)) {
      for (let i in e) if (!nte.call(rte.properties, i)) {
        let l = { instancePath: t, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: i }, message: "must NOT have additional properties" };
        o === null ? o = [l] : o.push(l), s++;
      }
      e.topBody !== void 0 && (ba(e.topBody, { instancePath: t + "/topBody", parentData: e, parentDataProperty: "topBody", rootData: a }) || (o = o === null ? ba.errors : o.concat(ba.errors), s = o.length)), e.topJoin !== void 0 && (ba(e.topJoin, { instancePath: t + "/topJoin", parentData: e, parentDataProperty: "topJoin", rootData: a }) || (o = o === null ? ba.errors : o.concat(ba.errors), s = o.length)), e.topLeft !== void 0 && (ba(e.topLeft, { instancePath: t + "/topLeft", parentData: e, parentDataProperty: "topLeft", rootData: a }) || (o = o === null ? ba.errors : o.concat(ba.errors), s = o.length)), e.topRight !== void 0 && (ba(e.topRight, { instancePath: t + "/topRight", parentData: e, parentDataProperty: "topRight", rootData: a }) || (o = o === null ? ba.errors : o.concat(ba.errors), s = o.length)), e.bottomBody !== void 0 && (ba(e.bottomBody, { instancePath: t + "/bottomBody", parentData: e, parentDataProperty: "bottomBody", rootData: a }) || (o = o === null ? ba.errors : o.concat(ba.errors), s = o.length)), e.bottomJoin !== void 0 && (ba(e.bottomJoin, { instancePath: t + "/bottomJoin", parentData: e, parentDataProperty: "bottomJoin", rootData: a }) || (o = o === null ? ba.errors : o.concat(ba.errors), s = o.length)), e.bottomLeft !== void 0 && (ba(e.bottomLeft, { instancePath: t + "/bottomLeft", parentData: e, parentDataProperty: "bottomLeft", rootData: a }) || (o = o === null ? ba.errors : o.concat(ba.errors), s = o.length)), e.bottomRight !== void 0 && (ba(e.bottomRight, { instancePath: t + "/bottomRight", parentData: e, parentDataProperty: "bottomRight", rootData: a }) || (o = o === null ? ba.errors : o.concat(ba.errors), s = o.length)), e.bodyLeft !== void 0 && (ba(e.bodyLeft, { instancePath: t + "/bodyLeft", parentData: e, parentDataProperty: "bodyLeft", rootData: a }) || (o = o === null ? ba.errors : o.concat(ba.errors), s = o.length)), e.bodyRight !== void 0 && (ba(e.bodyRight, { instancePath: t + "/bodyRight", parentData: e, parentDataProperty: "bodyRight", rootData: a }) || (o = o === null ? ba.errors : o.concat(ba.errors), s = o.length)), e.bodyJoin !== void 0 && (ba(e.bodyJoin, { instancePath: t + "/bodyJoin", parentData: e, parentDataProperty: "bodyJoin", rootData: a }) || (o = o === null ? ba.errors : o.concat(ba.errors), s = o.length)), e.headerJoin !== void 0 && (ba(e.headerJoin, { instancePath: t + "/headerJoin", parentData: e, parentDataProperty: "headerJoin", rootData: a }) || (o = o === null ? ba.errors : o.concat(ba.errors), s = o.length)), e.joinBody !== void 0 && (ba(e.joinBody, { instancePath: t + "/joinBody", parentData: e, parentDataProperty: "joinBody", rootData: a }) || (o = o === null ? ba.errors : o.concat(ba.errors), s = o.length)), e.joinLeft !== void 0 && (ba(e.joinLeft, { instancePath: t + "/joinLeft", parentData: e, parentDataProperty: "joinLeft", rootData: a }) || (o = o === null ? ba.errors : o.concat(ba.errors), s = o.length)), e.joinRight !== void 0 && (ba(e.joinRight, { instancePath: t + "/joinRight", parentData: e, parentDataProperty: "joinRight", rootData: a }) || (o = o === null ? ba.errors : o.concat(ba.errors), s = o.length)), e.joinJoin !== void 0 && (ba(e.joinJoin, { instancePath: t + "/joinJoin", parentData: e, parentDataProperty: "joinJoin", rootData: a }) || (o = o === null ? ba.errors : o.concat(ba.errors), s = o.length));
    } else {
      let i = { instancePath: t, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
      o === null ? o = [i] : o.push(i), s++;
    }
    return tS.errors = o, s === 0;
  }
  function rS(e, { instancePath: t = "", parentData: r, parentDataProperty: n, rootData: a = e } = {}) {
    let o = null, s = 0, i = s, l = false, u2 = null, c = s;
    if (e && typeof e == "object" && !Array.isArray(e)) {
      for (let p in e) if (!aS.test(p)) {
        let d = { instancePath: t, schemaPath: "#/oneOf/0/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: p }, message: "must NOT have additional properties" };
        o === null ? o = [d] : o.push(d), s++;
      }
      for (let p in e) aS.test(p) && (Wh(e[p], { instancePath: t + "/" + p.replace(/~/g, "~0").replace(/\//g, "~1"), parentData: e, parentDataProperty: p, rootData: a }) || (o = o === null ? Wh.errors : o.concat(Wh.errors), s = o.length));
    } else {
      let p = { instancePath: t, schemaPath: "#/oneOf/0/type", keyword: "type", params: { type: "object" }, message: "must be object" };
      o === null ? o = [p] : o.push(p), s++;
    }
    var h = c === s;
    h && (l = true, u2 = 0);
    let f = s;
    if (Array.isArray(e)) {
      let p = e.length;
      for (let d = 0; d < p; d++) Wh(e[d], { instancePath: t + "/" + d, parentData: e, parentDataProperty: d, rootData: a }) || (o = o === null ? Wh.errors : o.concat(Wh.errors), s = o.length);
    } else {
      let p = { instancePath: t, schemaPath: "#/oneOf/1/type", keyword: "type", params: { type: "array" }, message: "must be array" };
      o === null ? o = [p] : o.push(p), s++;
    }
    var h = f === s;
    if (h && l ? (l = false, u2 = [u2, 1]) : h && (l = true, u2 = 1), l) s = i, o !== null && (i ? o.length = i : o = null);
    else {
      let p = { instancePath: t, schemaPath: "#/oneOf", keyword: "oneOf", params: { passingSchemas: u2 }, message: "must match exactly one schema in oneOf" };
      o === null ? o = [p] : o.push(p), s++;
    }
    return rS.errors = o, s === 0;
  }
  function nS(e, { instancePath: t = "", parentData: r, parentDataProperty: n, rootData: a = e } = {}) {
    let o = null, s = 0;
    if (e && typeof e == "object" && !Array.isArray(e)) {
      for (let i in e) if (!(i === "alignment" || i === "verticalAlignment" || i === "width" || i === "wrapWord" || i === "truncate" || i === "paddingLeft" || i === "paddingRight")) {
        let l = { instancePath: t, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: i }, message: "must NOT have additional properties" };
        o === null ? o = [l] : o.push(l), s++;
      }
      if (e.alignment !== void 0 && (e0(e.alignment, { instancePath: t + "/alignment", parentData: e, parentDataProperty: "alignment", rootData: a }) || (o = o === null ? e0.errors : o.concat(e0.errors), s = o.length)), e.verticalAlignment !== void 0) {
        let i = e.verticalAlignment;
        if (typeof i != "string") {
          let l = { instancePath: t + "/verticalAlignment", schemaPath: "#/properties/verticalAlignment/type", keyword: "type", params: { type: "string" }, message: "must be string" };
          o === null ? o = [l] : o.push(l), s++;
        }
        if (!(i === "top" || i === "middle" || i === "bottom")) {
          let l = { instancePath: t + "/verticalAlignment", schemaPath: "#/properties/verticalAlignment/enum", keyword: "enum", params: { allowedValues: UF.properties.verticalAlignment.enum }, message: "must be equal to one of the allowed values" };
          o === null ? o = [l] : o.push(l), s++;
        }
      }
      if (e.width !== void 0) {
        let i = e.width;
        if (!(typeof i == "number" && !(i % 1) && !isNaN(i) && isFinite(i))) {
          let l = { instancePath: t + "/width", schemaPath: "#/properties/width/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
          o === null ? o = [l] : o.push(l), s++;
        }
        if (typeof i == "number" && isFinite(i) && (i < 1 || isNaN(i))) {
          let l = { instancePath: t + "/width", schemaPath: "#/properties/width/minimum", keyword: "minimum", params: { comparison: ">=", limit: 1 }, message: "must be >= 1" };
          o === null ? o = [l] : o.push(l), s++;
        }
      }
      if (e.wrapWord !== void 0 && typeof e.wrapWord != "boolean") {
        let i = { instancePath: t + "/wrapWord", schemaPath: "#/properties/wrapWord/type", keyword: "type", params: { type: "boolean" }, message: "must be boolean" };
        o === null ? o = [i] : o.push(i), s++;
      }
      if (e.truncate !== void 0) {
        let i = e.truncate;
        if (!(typeof i == "number" && !(i % 1) && !isNaN(i) && isFinite(i))) {
          let l = { instancePath: t + "/truncate", schemaPath: "#/properties/truncate/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
          o === null ? o = [l] : o.push(l), s++;
        }
      }
      if (e.paddingLeft !== void 0) {
        let i = e.paddingLeft;
        if (!(typeof i == "number" && !(i % 1) && !isNaN(i) && isFinite(i))) {
          let l = { instancePath: t + "/paddingLeft", schemaPath: "#/properties/paddingLeft/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
          o === null ? o = [l] : o.push(l), s++;
        }
      }
      if (e.paddingRight !== void 0) {
        let i = e.paddingRight;
        if (!(typeof i == "number" && !(i % 1) && !isNaN(i) && isFinite(i))) {
          let l = { instancePath: t + "/paddingRight", schemaPath: "#/properties/paddingRight/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
          o === null ? o = [l] : o.push(l), s++;
        }
      }
    } else {
      let i = { instancePath: t, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
      o === null ? o = [i] : o.push(i), s++;
    }
    return nS.errors = o, s === 0;
  }
  function ote(e, { instancePath: t = "", parentData: r, parentDataProperty: n, rootData: a = e } = {}) {
    let o = null, s = 0;
    if (e && typeof e == "object" && !Array.isArray(e)) {
      if (e.columnDefault === void 0) {
        let i = { instancePath: t, schemaPath: "#/required", keyword: "required", params: { missingProperty: "columnDefault" }, message: "must have required property 'columnDefault'" };
        o === null ? o = [i] : o.push(i), s++;
      }
      if (e.columnCount === void 0) {
        let i = { instancePath: t, schemaPath: "#/required", keyword: "required", params: { missingProperty: "columnCount" }, message: "must have required property 'columnCount'" };
        o === null ? o = [i] : o.push(i), s++;
      }
      for (let i in e) if (!(i === "border" || i === "columns" || i === "columnDefault" || i === "columnCount" || i === "drawVerticalLine")) {
        let l = { instancePath: t, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: i }, message: "must NOT have additional properties" };
        o === null ? o = [l] : o.push(l), s++;
      }
      if (e.border !== void 0 && (tS(e.border, { instancePath: t + "/border", parentData: e, parentDataProperty: "border", rootData: a }) || (o = o === null ? tS.errors : o.concat(tS.errors), s = o.length)), e.columns !== void 0 && (rS(e.columns, { instancePath: t + "/columns", parentData: e, parentDataProperty: "columns", rootData: a }) || (o = o === null ? rS.errors : o.concat(rS.errors), s = o.length)), e.columnDefault !== void 0 && (nS(e.columnDefault, { instancePath: t + "/columnDefault", parentData: e, parentDataProperty: "columnDefault", rootData: a }) || (o = o === null ? nS.errors : o.concat(nS.errors), s = o.length)), e.columnCount !== void 0) {
        let i = e.columnCount;
        if (!(typeof i == "number" && !(i % 1) && !isNaN(i) && isFinite(i))) {
          let l = { instancePath: t + "/columnCount", schemaPath: "#/properties/columnCount/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
          o === null ? o = [l] : o.push(l), s++;
        }
        if (typeof i == "number" && isFinite(i) && (i < 1 || isNaN(i))) {
          let l = { instancePath: t + "/columnCount", schemaPath: "#/properties/columnCount/minimum", keyword: "minimum", params: { comparison: ">=", limit: 1 }, message: "must be >= 1" };
          o === null ? o = [l] : o.push(l), s++;
        }
      }
      if (e.drawVerticalLine !== void 0 && typeof e.drawVerticalLine != "function") {
        let i = { instancePath: t + "/drawVerticalLine", schemaPath: "#/properties/drawVerticalLine/typeof", keyword: "typeof", params: {}, message: 'should pass "typeof" keyword validation' };
        o === null ? o = [i] : o.push(i), s++;
      }
    } else {
      let i = { instancePath: t, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
      o === null ? o = [i] : o.push(i), s++;
    }
    return ote.errors = o, s === 0;
  }
});
var jF = ri((Ox) => {
  "use strict";
  var Xut = Ox && Ox.__importDefault || function(e) {
    return e && e.__esModule ? e : { default: e };
  };
  Object.defineProperty(Ox, "__esModule", { value: true });
  Ox.validateConfig = void 0;
  var Kut = Xut(ste()), Yut = (e, t) => {
    let r = Kut.default[e];
    if (!r(t) && r.errors) {
      let n = r.errors.map((a) => ({ message: a.message, params: a.params, schemaPath: a.schemaPath }));
      throw console.log("config", t), console.log("errors", n), new Error("Invalid config.");
    }
  };
  Ox.validateConfig = Yut;
});
var lte = ri((Px) => {
  "use strict";
  var Zut = Px && Px.__importDefault || function(e) {
    return e && e.__esModule ? e : { default: e };
  };
  Object.defineProperty(Px, "__esModule", { value: true });
  Px.makeStreamConfig = void 0;
  var Jut = Zut(zF()), Qut = Zv(), ect = jF(), tct = (e, t = {}, r) => Array.from({ length: e }).map((n, a) => __spreadValues(__spreadValues({ alignment: "left", paddingLeft: 1, paddingRight: 1, truncate: Number.POSITIVE_INFINITY, verticalAlignment: "top", wrapWord: false }, r), t[a])), rct = (e) => {
    ect.validateConfig("streamConfig.json", e);
    let t = Jut.default(e);
    if (t.columnDefault.width === void 0) throw new Error("Must provide config.columnDefault.width when creating a stream.");
    return __spreadProps(__spreadValues({ drawVerticalLine: () => true }, t), { border: Qut.makeBorderConfig(t.border), columns: tct(t.columnCount, t.columns, t.columnDefault) });
  };
  Px.makeStreamConfig = rct;
});
var WF = ri((oS) => {
  "use strict";
  Object.defineProperty(oS, "__esModule", { value: true });
  oS.mapDataUsingRowHeights = void 0;
  var nct = OA(), iS = (e) => new Array(e).fill(""), act = (e, t, r) => {
    let { verticalAlignment: n } = r, a = t - e.length;
    return n === "top" ? [...e, ...iS(a)] : n === "bottom" ? [...iS(a), ...e] : [...iS(Math.floor(a / 2)), ...e, ...iS(Math.ceil(a / 2))];
  }, ict = (e) => [].concat(...e), oct = (e, t, r) => {
    let n = e[0].length, a = e.map((o, s) => {
      let i = t[s], l = Array.from({ length: i }, () => new Array(n).fill(""));
      return o.forEach((u2, c) => {
        let f = nct.wrapCell(u2, r.columns[c].width, r.columns[c].wrapWord);
        act(f, i, r.columns[c]).forEach((p, d) => {
          l[d][c] = p;
        });
      }), l;
    });
    return ict(a);
  };
  oS.mapDataUsingRowHeights = oct;
});
var sS = ri((Xg) => {
  "use strict";
  Object.defineProperty(Xg, "__esModule", { value: true });
  Xg.padTableData = Xg.padString = void 0;
  var sct = (e, t, r) => " ".repeat(t) + e + " ".repeat(r);
  Xg.padString = sct;
  var lct = (e, t) => e.map((r) => r.map((n, a) => {
    let { paddingLeft: o, paddingRight: s } = t.columns[a];
    return Xg.padString(n, o, s);
  }));
  Xg.padTableData = lct;
});
var GF = ri((lS) => {
  "use strict";
  Object.defineProperty(lS, "__esModule", { value: true });
  lS.stringifyTableData = void 0;
  var uct = Zv(), cct = (e) => e.map((t) => t.map((r) => uct.normalizeString(String(r))));
  lS.stringifyTableData = cct;
});
var Ite = ri((M_, Lx) => {
  var fct = 30, hct = "...", $F = 1 / 0, pct = 17976931348623157e292, ute = 0 / 0, dct = "[object RegExp]", vct = "[object Symbol]", mct = /^\s+|\s+$/g, gct = /\w*$/, yct = /^[-+]0x[0-9a-f]+$/i, xct = /^0b[01]+$/i, bct = /^0o[0-7]+$/i, YF = "\\ud800-\\udfff", yte = "\\u0300-\\u036f\\ufe20-\\ufe23", xte = "\\u20d0-\\u20f0", bte = "\\ufe0e\\ufe0f", _ct = "[" + YF + "]", HF = "[" + yte + xte + "]", qF = "\\ud83c[\\udffb-\\udfff]", wct = "(?:" + HF + "|" + qF + ")", _te = "[^" + YF + "]", wte = "(?:\\ud83c[\\udde6-\\uddff]){2}", kte = "[\\ud800-\\udbff][\\udc00-\\udfff]", Tte = "\\u200d", Ate = wct + "?", Ste = "[" + bte + "]?", kct = "(?:" + Tte + "(?:" + [_te, wte, kte].join("|") + ")" + Ste + Ate + ")*", Tct = Ste + Ate + kct, Act = "(?:" + [_te + HF + "?", HF, wte, kte, _ct].join("|") + ")", XF = RegExp(qF + "(?=" + qF + ")|" + Act + Tct, "g"), Sct = RegExp("[" + Tte + YF + yte + xte + bte + "]"), Ect = parseInt, Ete = typeof global == "object" && global && global.Object === Object && global, Dct = typeof self == "object" && self && self.Object === Object && self, Cct = Ete || Dct || Function("return this")(), Dte = typeof M_ == "object" && M_ && !M_.nodeType && M_, cte = Dte && typeof Lx == "object" && Lx && !Lx.nodeType && Lx, Mct = cte && cte.exports === Dte, fte = Mct && Ete.process, hte = function() {
    try {
      return fte && fte.binding("util");
    } catch {
    }
  }(), pte = hte && hte.isRegExp, Ict = Fct("length");
  function Nct(e) {
    return e.split("");
  }
  function Fct(e) {
    return function(t) {
      return t?.[e];
    };
  }
  function Oct(e) {
    return function(t) {
      return e(t);
    };
  }
  function ZF(e) {
    return Sct.test(e);
  }
  function Pct(e) {
    return ZF(e) ? Rct(e) : Ict(e);
  }
  function Lct(e) {
    return ZF(e) ? zct(e) : Nct(e);
  }
  function Rct(e) {
    for (var t = XF.lastIndex = 0; XF.test(e); ) t++;
    return t;
  }
  function zct(e) {
    return e.match(XF) || [];
  }
  var Bct = Object.prototype, Cte = Bct.toString, dte = Cct.Symbol, vte = dte ? dte.prototype : void 0, mte = vte ? vte.toString : void 0;
  function Uct(e) {
    return uS(e) && Cte.call(e) == dct;
  }
  function Vct(e, t, r) {
    var n = -1, a = e.length;
    t < 0 && (t = -t > a ? 0 : a + t), r = r > a ? a : r, r < 0 && (r += a), a = t > r ? 0 : r - t >>> 0, t >>>= 0;
    for (var o = Array(a); ++n < a; ) o[n] = e[n + t];
    return o;
  }
  function KF(e) {
    if (typeof e == "string") return e;
    if (Mte(e)) return mte ? mte.call(e) : "";
    var t = e + "";
    return t == "0" && 1 / e == -$F ? "-0" : t;
  }
  function jct(e, t, r) {
    var n = e.length;
    return r = r === void 0 ? n : r, !t && r >= n ? e : Vct(e, t, r);
  }
  function uS(e) {
    var t = typeof e;
    return !!e && (t == "object" || t == "function");
  }
  function Wct(e) {
    return !!e && typeof e == "object";
  }
  var Gct = pte ? Oct(pte) : Uct;
  function Mte(e) {
    return typeof e == "symbol" || Wct(e) && Cte.call(e) == vct;
  }
  function $ct(e) {
    if (!e) return e === 0 ? e : 0;
    if (e = qct(e), e === $F || e === -$F) {
      var t = e < 0 ? -1 : 1;
      return t * pct;
    }
    return e === e ? e : 0;
  }
  function Hct(e) {
    var t = $ct(e), r = t % 1;
    return t === t ? r ? t - r : t : 0;
  }
  function qct(e) {
    if (typeof e == "number") return e;
    if (Mte(e)) return ute;
    if (uS(e)) {
      var t = typeof e.valueOf == "function" ? e.valueOf() : e;
      e = uS(t) ? t + "" : t;
    }
    if (typeof e != "string") return e === 0 ? e : +e;
    e = e.replace(mct, "");
    var r = xct.test(e);
    return r || bct.test(e) ? Ect(e.slice(2), r ? 2 : 8) : yct.test(e) ? ute : +e;
  }
  function gte(e) {
    return e == null ? "" : KF(e);
  }
  function Xct(e, t) {
    var r = fct, n = hct;
    if (uS(t)) {
      var a = "separator" in t ? t.separator : a;
      r = "length" in t ? Hct(t.length) : r, n = "omission" in t ? KF(t.omission) : n;
    }
    e = gte(e);
    var o = e.length;
    if (ZF(e)) {
      var s = Lct(e);
      o = s.length;
    }
    if (r >= o) return e;
    var i = r - Pct(n);
    if (i < 1) return n;
    var l = s ? jct(s, 0, i).join("") : e.slice(0, i);
    if (a === void 0) return l + n;
    if (s && (i += l.length - i), Gct(a)) {
      if (e.slice(i).search(a)) {
        var u2, c = l;
        for (a.global || (a = RegExp(a.source, gte(gct.exec(a)) + "g")), a.lastIndex = 0; u2 = a.exec(c); ) var f = u2.index;
        l = l.slice(0, f === void 0 ? i : f);
      }
    } else if (e.indexOf(KF(a), i) != i) {
      var h = l.lastIndexOf(a);
      h > -1 && (l = l.slice(0, h));
    }
    return l + n;
  }
  Lx.exports = Xct;
});
var cS = ri((z0) => {
  "use strict";
  var Kct = z0 && z0.__importDefault || function(e) {
    return e && e.__esModule ? e : { default: e };
  };
  Object.defineProperty(z0, "__esModule", { value: true });
  z0.truncateTableData = z0.truncateString = void 0;
  var Yct = Kct(Ite()), Zct = (e, t) => Yct.default(e, { length: t, omission: "\u2026" });
  z0.truncateString = Zct;
  var Jct = (e, t) => e.map((r) => r.map((n, a) => z0.truncateString(n, t.columns[a].truncate)));
  z0.truncateTableData = Jct;
});
var Ote = ri((hS) => {
  "use strict";
  Object.defineProperty(hS, "__esModule", { value: true });
  hS.createStream = void 0;
  var Qct = xF(), eft = bF(), fS = kF(), Nte = jA(), tft = lte(), rft = WF(), nft = sS(), aft = GF(), ift = cS(), Fte = (e, t) => {
    let r = aft.stringifyTableData(e);
    r = ift.truncateTableData(r, t);
    let n = eft.calculateRowHeights(r, t);
    return r = rft.mapDataUsingRowHeights(r, n, t), r = Qct.alignTableData(r, t), r = nft.padTableData(r, t), r;
  }, oft = (e, t, r) => {
    let a = Fte([e], r).map((s) => Nte.drawRow(s, r)).join(""), o;
    o = "", o += fS.drawBorderTop(t, r), o += a, o += fS.drawBorderBottom(t, r), o = o.trimEnd(), process.stdout.write(o);
  }, sft = (e, t, r) => {
    let a = Fte([e], r).map((i) => Nte.drawRow(i, r)).join(""), o = "", s = fS.drawBorderBottom(t, r);
    s !== `
` && (o = "\r\x1B[K"), o += fS.drawBorderJoin(t, r), o += a, o += s, o = o.trimEnd(), process.stdout.write(o);
  }, lft = (e) => {
    let t = tft.makeStreamConfig(e), r = Object.values(t.columns).map((a) => a.width + a.paddingLeft + a.paddingRight), n = true;
    return { write: (a) => {
      if (a.length !== t.columnCount) throw new Error("Row cell count does not match the config.columnCount.");
      n ? (n = false, oft(a, r, t)) : sft(a, r, t);
    } };
  };
  hS.createStream = lft;
});
var JF = ri((Rx) => {
  "use strict";
  var uft = Rx && Rx.__importDefault || function(e) {
    return e && e.__esModule ? e : { default: e };
  };
  Object.defineProperty(Rx, "__esModule", { value: true });
  Rx.calculateCellWidths = void 0;
  var cft = uft(kx()), fft = (e) => e.map((t) => Math.max(...t.split(`
`).map(cft.default)));
  Rx.calculateCellWidths = fft;
});
var Pte = ri((pS) => {
  "use strict";
  Object.defineProperty(pS, "__esModule", { value: true });
  pS.drawHeader = void 0;
  var hft = yF(), pft = jA(), dft = sS(), vft = cS(), mft = OA(), gft = (e, t) => {
    if (!t.header) throw new Error("Can not draw header without header configuration");
    let { alignment: r, paddingRight: n, paddingLeft: a, wrapWord: o } = t.header, s = t.header.content;
    return s = vft.truncateString(s, t.header.truncate), mft.wrapCell(s, e, o).map((l) => {
      let u2 = hft.alignString(l, e, r);
      return u2 = dft.padString(u2, a, n), pft.drawRow([u2], __spreadProps(__spreadValues({}, t), { drawVerticalLine: (c) => {
        let f = t.columns.length;
        return t.drawVerticalLine(c === 0 ? 0 : f, f);
      } }));
    }).join("");
  };
  pS.drawHeader = gft;
});
var Rte = ri((zx) => {
  "use strict";
  var yft = zx && zx.__importDefault || function(e) {
    return e && e.__esModule ? e : { default: e };
  };
  Object.defineProperty(zx, "__esModule", { value: true });
  zx.drawTable = void 0;
  var xft = yft(kx()), bft = kF(), _ft = zA(), wft = Pte(), Lte = jA(), kft = Zv(), Tft = (e, t, r, n) => {
    let { drawHorizontalLine: a, singleLine: o } = n, s = kft.groupBySizes(e, r).map((i) => i.map((l) => Lte.drawRow(l, n)).join(""));
    if (n.header) {
      let i = xft.default(Lte.drawRow(e[0], n)) - 2 - n.header.paddingLeft - n.header.paddingRight, l = wft.drawHeader(i, n);
      s.unshift(l);
    }
    return _ft.drawContent(s, { drawSeparator: (i, l) => (i === 0 || i === l || !o) && a(i, l), separatorGetter: bft.createTableBorderGetter(t, n) });
  };
  zx.drawTable = Tft;
});
var zte = ri((QF) => {
  "use strict";
  Object.defineProperty(QF, "__esModule", { value: true });
  var Aft = JF();
  QF.default = (e) => {
    let t = new Array(e[0].length).fill(0);
    return e.forEach((r) => {
      Aft.calculateCellWidths(r).forEach((a, o) => {
        t[o] = Math.max(t[o], a);
      });
    }), t;
  };
});
var Ute = ri((Bx) => {
  "use strict";
  var Bte = Bx && Bx.__importDefault || function(e) {
    return e && e.__esModule ? e : { default: e };
  };
  Object.defineProperty(Bx, "__esModule", { value: true });
  Bx.makeTableConfig = void 0;
  var Sft = Bte(zF()), Eft = Bte(zte()), Dft = Zv(), Cft = jF(), Mft = (e, t, r) => {
    let n = Eft.default(e);
    return e[0].map((a, o) => __spreadValues(__spreadValues({ alignment: "left", paddingLeft: 1, paddingRight: 1, truncate: Number.POSITIVE_INFINITY, verticalAlignment: "top", width: n[o], wrapWord: false }, r), t?.[o]));
  }, Ift = (e) => {
    if (!!e.header) return __spreadValues({ alignment: "center", paddingLeft: 1, paddingRight: 1, truncate: Number.POSITIVE_INFINITY, wrapWord: false }, e.header);
  }, Nft = (e, t = {}) => {
    var r, n, a;
    Cft.validateConfig("config.json", t);
    let o = Sft.default(t);
    return __spreadProps(__spreadValues({}, o), { border: Dft.makeBorderConfig(o.border), columns: Mft(e, o.columns, o.columnDefault), drawHorizontalLine: (r = o.drawHorizontalLine) !== null && r !== void 0 ? r : () => true, drawVerticalLine: (n = o.drawVerticalLine) !== null && n !== void 0 ? n : () => true, header: Ift(o), singleLine: (a = o.singleLine) !== null && a !== void 0 ? a : false });
  };
  Bx.makeTableConfig = Nft;
});
var Vte = ri((dS) => {
  "use strict";
  Object.defineProperty(dS, "__esModule", { value: true });
  dS.validateTableData = void 0;
  var Fft = Zv(), Oft = (e) => {
    if (!Array.isArray(e)) throw new TypeError("Table data must be an array.");
    if (e.length === 0) throw new Error("Table must define at least one row.");
    if (e[0].length === 0) throw new Error("Table must define at least one column.");
    let t = e[0].length;
    for (let r of e) {
      if (!Array.isArray(r)) throw new TypeError("Table row data must be an array.");
      if (r.length !== t) throw new Error("Table must have a consistent number of cells.");
      for (let n of r) if (/[\u0001-\u0006\u0008\u0009\u000B-\u001A]/.test(Fft.normalizeString(String(n)))) throw new Error("Table data must not contain control characters.");
    }
  };
  dS.validateTableData = Oft;
});
var jte = ri((vS) => {
  "use strict";
  Object.defineProperty(vS, "__esModule", { value: true });
  vS.table = void 0;
  var Pft = xF(), Lft = JF(), Rft = bF(), zft = Rte(), Bft = Ute(), Uft = WF(), Vft = sS(), jft = GF(), Wft = cS(), Gft = Vte(), $ft = (e, t = {}) => {
    Gft.validateTableData(e);
    let r = jft.stringifyTableData(e), n = Bft.makeTableConfig(r, t);
    r = Wft.truncateTableData(r, n);
    let a = Rft.calculateRowHeights(r, n);
    r = Uft.mapDataUsingRowHeights(r, a, n), r = Pft.alignTableData(r, n), r = Vft.padTableData(r, n);
    let o = Lft.calculateCellWidths(r[0]);
    return zft.drawTable(r, o, a, n);
  };
  vS.table = $ft;
});
var Gte = ri((Wte) => {
  "use strict";
  Object.defineProperty(Wte, "__esModule", { value: true });
});
var e8 = ri((Gh) => {
  "use strict";
  var Hft = Gh && Gh.__createBinding || (Object.create ? function(e, t, r, n) {
    n === void 0 && (n = r), Object.defineProperty(e, n, { enumerable: true, get: function() {
      return t[r];
    } });
  } : function(e, t, r, n) {
    n === void 0 && (n = r), e[n] = t[r];
  }), qft = Gh && Gh.__exportStar || function(e, t) {
    for (var r in e) r !== "default" && !Object.prototype.hasOwnProperty.call(t, r) && Hft(t, e, r);
  };
  Object.defineProperty(Gh, "__esModule", { value: true });
  Gh.getBorderCharacters = Gh.createStream = Gh.table = void 0;
  var Xft = Ote();
  Object.defineProperty(Gh, "createStream", { enumerable: true, get: function() {
    return Xft.createStream;
  } });
  var Kft = vF();
  Object.defineProperty(Gh, "getBorderCharacters", { enumerable: true, get: function() {
    return Kft.getBorderCharacters;
  } });
  var Yft = jte();
  Object.defineProperty(Gh, "table", { enumerable: true, get: function() {
    return Yft.table;
  } });
  qft(Gte(), Gh);
});
var Hte = ri(($te, u8) => {
  (function(e) {
    typeof $te == "object" && typeof u8 < "u" ? u8.exports = e() : typeof define == "function" && define.amd ? define([], e) : (typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : this).Plotly = e();
  })(function() {
    return function e(t, r, n) {
      function a(i, l) {
        if (!r[i]) {
          if (!t[i]) {
            var u2 = typeof Tb == "function" && Tb;
            if (!l && u2) return u2(i, true);
            if (o) return o(i, true);
            var c = new Error("Cannot find module '" + i + "'");
            throw c.code = "MODULE_NOT_FOUND", c;
          }
          var f = r[i] = { exports: {} };
          t[i][0].call(f.exports, function(h) {
            return a(t[i][1][h] || h);
          }, f, f.exports, e, t, r, n);
        }
        return r[i].exports;
      }
      for (var o = typeof Tb == "function" && Tb, s = 0; s < n.length; s++) a(n[s]);
      return a;
    }({ 1: [function(e, t, r) {
      "use strict";
      var n = e("../src/lib"), a = { "X,X div": 'direction:ltr;font-family:"Open Sans",verdana,arial,sans-serif;margin:0;padding:0;', "X input,X button": 'font-family:"Open Sans",verdana,arial,sans-serif;', "X input:focus,X button:focus": "outline:none;", "X a": "text-decoration:none;", "X a:hover": "text-decoration:none;", "X .crisp": "shape-rendering:crispEdges;", "X .user-select-none": "-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;", "X svg": "overflow:hidden;", "X svg a": "fill:#447adb;", "X svg a:hover": "fill:#3c6dc5;", "X .main-svg": "position:absolute;top:0;left:0;pointer-events:none;", "X .main-svg .draglayer": "pointer-events:all;", "X .cursor-default": "cursor:default;", "X .cursor-pointer": "cursor:pointer;", "X .cursor-crosshair": "cursor:crosshair;", "X .cursor-move": "cursor:move;", "X .cursor-col-resize": "cursor:col-resize;", "X .cursor-row-resize": "cursor:row-resize;", "X .cursor-ns-resize": "cursor:ns-resize;", "X .cursor-ew-resize": "cursor:ew-resize;", "X .cursor-sw-resize": "cursor:sw-resize;", "X .cursor-s-resize": "cursor:s-resize;", "X .cursor-se-resize": "cursor:se-resize;", "X .cursor-w-resize": "cursor:w-resize;", "X .cursor-e-resize": "cursor:e-resize;", "X .cursor-nw-resize": "cursor:nw-resize;", "X .cursor-n-resize": "cursor:n-resize;", "X .cursor-ne-resize": "cursor:ne-resize;", "X .cursor-grab": "cursor:-webkit-grab;cursor:grab;", "X .modebar": "position:absolute;top:2px;right:2px;", "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;", "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;", "X:hover .modebar--hover .modebar-group": "opacity:1;", "X .modebar-group": "float:left;display:inline-block;box-sizing:border-box;padding-left:8px;position:relative;vertical-align:middle;white-space:nowrap;", "X .modebar-btn": "position:relative;font-size:16px;padding:3px 4px;height:22px;cursor:pointer;line-height:normal;box-sizing:border-box;", "X .modebar-btn svg": "position:relative;top:2px;", "X .modebar.vertical": "display:flex;flex-direction:column;flex-wrap:wrap;align-content:flex-end;max-height:100%;", "X .modebar.vertical svg": "top:-1px;", "X .modebar.vertical .modebar-group": "display:block;float:none;padding-left:0px;padding-bottom:8px;", "X .modebar.vertical .modebar-group .modebar-btn": "display:block;text-align:center;", "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%;", "X [data-title]:hover:before,X [data-title]:hover:after": "display:block;opacity:1;", "X [data-title]:before": 'content:"";position:absolute;background:transparent;border:6px solid transparent;z-index:1002;margin-top:-12px;border-bottom-color:#69738a;margin-right:-6px;', "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;", "X .vertical [data-title]:before,X .vertical [data-title]:after": "top:0%;right:200%;", "X .vertical [data-title]:before": "border:6px solid transparent;border-left-color:#69738a;margin-top:8px;margin-right:-30px;", "X .select-outline": "fill:none;stroke-width:1;shape-rendering:crispEdges;", "X .select-outline-1": "stroke:#fff;", "X .select-outline-2": "stroke:#000;stroke-dasharray:2px 2px;", Y: 'font-family:"Open Sans",verdana,arial,sans-serif;position:fixed;top:50px;right:20px;z-index:10000;font-size:10pt;max-width:180px;', "Y p": "margin:0;", "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;", "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;", "Y .notifier-close:hover": "color:#444;text-decoration:none;cursor:pointer;" };
      for (var o in a) {
        var s = o.replace(/^,/, " ,").replace(/X/g, ".js-plotly-plot .plotly").replace(/Y/g, ".plotly-notifier");
        n.addStyleRule(s, a[o]);
      }
    }, { "../src/lib": 503 }], 2: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/transforms/aggregate");
    }, { "../src/transforms/aggregate": 1114 }], 3: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/bar");
    }, { "../src/traces/bar": 656 }], 4: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/barpolar");
    }, { "../src/traces/barpolar": 669 }], 5: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/box");
    }, { "../src/traces/box": 679 }], 6: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/components/calendars");
    }, { "../src/components/calendars": 364 }], 7: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/candlestick");
    }, { "../src/traces/candlestick": 688 }], 8: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/carpet");
    }, { "../src/traces/carpet": 707 }], 9: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/choropleth");
    }, { "../src/traces/choropleth": 721 }], 10: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/choroplethmapbox");
    }, { "../src/traces/choroplethmapbox": 728 }], 11: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/cone");
    }, { "../src/traces/cone": 734 }], 12: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/contour");
    }, { "../src/traces/contour": 749 }], 13: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/contourcarpet");
    }, { "../src/traces/contourcarpet": 760 }], 14: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/core");
    }, { "../src/core": 481 }], 15: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/densitymapbox");
    }, { "../src/traces/densitymapbox": 768 }], 16: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/transforms/filter");
    }, { "../src/transforms/filter": 1115 }], 17: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/funnel");
    }, { "../src/traces/funnel": 778 }], 18: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/funnelarea");
    }, { "../src/traces/funnelarea": 787 }], 19: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/transforms/groupby");
    }, { "../src/transforms/groupby": 1116 }], 20: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/heatmap");
    }, { "../src/traces/heatmap": 800 }], 21: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/heatmapgl");
    }, { "../src/traces/heatmapgl": 811 }], 22: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/histogram");
    }, { "../src/traces/histogram": 823 }], 23: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/histogram2d");
    }, { "../src/traces/histogram2d": 829 }], 24: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/histogram2dcontour");
    }, { "../src/traces/histogram2dcontour": 833 }], 25: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/icicle");
    }, { "../src/traces/icicle": 839 }], 26: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/image");
    }, { "../src/traces/image": 852 }], 27: [function(e, t, r) {
      "use strict";
      var n = e("./core");
      n.register([e("./bar"), e("./box"), e("./heatmap"), e("./histogram"), e("./histogram2d"), e("./histogram2dcontour"), e("./contour"), e("./scatterternary"), e("./violin"), e("./funnel"), e("./waterfall"), e("./image"), e("./pie"), e("./sunburst"), e("./treemap"), e("./icicle"), e("./funnelarea"), e("./scatter3d"), e("./surface"), e("./isosurface"), e("./volume"), e("./mesh3d"), e("./cone"), e("./streamtube"), e("./scattergeo"), e("./choropleth"), e("./scattergl"), e("./splom"), e("./pointcloud"), e("./heatmapgl"), e("./parcoords"), e("./parcats"), e("./scattermapbox"), e("./choroplethmapbox"), e("./densitymapbox"), e("./sankey"), e("./indicator"), e("./table"), e("./carpet"), e("./scattercarpet"), e("./contourcarpet"), e("./ohlc"), e("./candlestick"), e("./scatterpolar"), e("./scatterpolargl"), e("./barpolar"), e("./scattersmith"), e("./aggregate"), e("./filter"), e("./groupby"), e("./sort"), e("./calendars")]), t.exports = n;
    }, { "./aggregate": 2, "./bar": 3, "./barpolar": 4, "./box": 5, "./calendars": 6, "./candlestick": 7, "./carpet": 8, "./choropleth": 9, "./choroplethmapbox": 10, "./cone": 11, "./contour": 12, "./contourcarpet": 13, "./core": 14, "./densitymapbox": 15, "./filter": 16, "./funnel": 17, "./funnelarea": 18, "./groupby": 19, "./heatmap": 20, "./heatmapgl": 21, "./histogram": 22, "./histogram2d": 23, "./histogram2dcontour": 24, "./icicle": 25, "./image": 26, "./indicator": 28, "./isosurface": 29, "./mesh3d": 30, "./ohlc": 31, "./parcats": 32, "./parcoords": 33, "./pie": 34, "./pointcloud": 35, "./sankey": 36, "./scatter3d": 37, "./scattercarpet": 38, "./scattergeo": 39, "./scattergl": 40, "./scattermapbox": 41, "./scatterpolar": 42, "./scatterpolargl": 43, "./scattersmith": 44, "./scatterternary": 45, "./sort": 46, "./splom": 47, "./streamtube": 48, "./sunburst": 49, "./surface": 50, "./table": 51, "./treemap": 52, "./violin": 53, "./volume": 54, "./waterfall": 55 }], 28: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/indicator");
    }, { "../src/traces/indicator": 860 }], 29: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/isosurface");
    }, { "../src/traces/isosurface": 866 }], 30: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/mesh3d");
    }, { "../src/traces/mesh3d": 871 }], 31: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/ohlc");
    }, { "../src/traces/ohlc": 876 }], 32: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/parcats");
    }, { "../src/traces/parcats": 885 }], 33: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/parcoords");
    }, { "../src/traces/parcoords": 895 }], 34: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/pie");
    }, { "../src/traces/pie": 906 }], 35: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/pointcloud");
    }, { "../src/traces/pointcloud": 915 }], 36: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/sankey");
    }, { "../src/traces/sankey": 921 }], 37: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/scatter3d");
    }, { "../src/traces/scatter3d": 959 }], 38: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/scattercarpet");
    }, { "../src/traces/scattercarpet": 966 }], 39: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/scattergeo");
    }, { "../src/traces/scattergeo": 974 }], 40: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/scattergl");
    }, { "../src/traces/scattergl": 987 }], 41: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/scattermapbox");
    }, { "../src/traces/scattermapbox": 997 }], 42: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/scatterpolar");
    }, { "../src/traces/scatterpolar": 1005 }], 43: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/scatterpolargl");
    }, { "../src/traces/scatterpolargl": 1012 }], 44: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/scattersmith");
    }, { "../src/traces/scattersmith": 1019 }], 45: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/scatterternary");
    }, { "../src/traces/scatterternary": 1027 }], 46: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/transforms/sort");
    }, { "../src/transforms/sort": 1118 }], 47: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/splom");
    }, { "../src/traces/splom": 1036 }], 48: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/streamtube");
    }, { "../src/traces/streamtube": 1044 }], 49: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/sunburst");
    }, { "../src/traces/sunburst": 1052 }], 50: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/surface");
    }, { "../src/traces/surface": 1061 }], 51: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/table");
    }, { "../src/traces/table": 1069 }], 52: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/treemap");
    }, { "../src/traces/treemap": 1080 }], 53: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/violin");
    }, { "../src/traces/violin": 1093 }], 54: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/volume");
    }, { "../src/traces/volume": 1101 }], 55: [function(e, t, r) {
      "use strict";
      t.exports = e("../src/traces/waterfall");
    }, { "../src/traces/waterfall": 1109 }], 56: [function(e, t, r) {
      (function(n, a) {
        typeof r == "object" && t !== void 0 ? a(r, e("d3-array"), e("d3-collection"), e("d3-shape"), e("elementary-circuits-directed-graph")) : a(n.d3 = n.d3 || {}, n.d3, n.d3, n.d3, null);
      })(this, function(n, a, o, s, i) {
        "use strict";
        function l(ne) {
          return ne.target.depth;
        }
        function u2(ne, ae) {
          return ne.sourceLinks.length ? ne.depth : ae - 1;
        }
        function c(ne) {
          return function() {
            return ne;
          };
        }
        i = i && i.hasOwnProperty("default") ? i.default : i;
        var f = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(ne) {
          return typeof ne;
        } : function(ne) {
          return ne && typeof Symbol == "function" && ne.constructor === Symbol && ne !== Symbol.prototype ? "symbol" : typeof ne;
        };
        function h(ne, ae) {
          return d(ne.source, ae.source) || ne.index - ae.index;
        }
        function p(ne, ae) {
          return d(ne.target, ae.target) || ne.index - ae.index;
        }
        function d(ne, ae) {
          return ne.partOfCycle === ae.partOfCycle ? ne.y0 - ae.y0 : ne.circularLinkType === "top" || ae.circularLinkType === "bottom" ? -1 : 1;
        }
        function v(ne) {
          return ne.value;
        }
        function m(ne) {
          return (ne.y0 + ne.y1) / 2;
        }
        function g(ne) {
          return m(ne.source);
        }
        function x(ne) {
          return m(ne.target);
        }
        function b(ne) {
          return ne.index;
        }
        function y(ne) {
          return ne.nodes;
        }
        function w(ne) {
          return ne.links;
        }
        function _4(ne, ae) {
          var ue = ne.get(ae);
          if (!ue) throw new Error("missing: " + ae);
          return ue;
        }
        function k(ne, ae) {
          return ae(ne);
        }
        function T2(ne, ae, ue) {
          var le = 0;
          if (ue === null) {
            for (var ce = [], se = 0; se < ne.links.length; se++) {
              var he = ne.links[se], me = he.source.index, we = he.target.index;
              ce[me] || (ce[me] = []), ce[we] || (ce[we] = []), ce[me].indexOf(we) === -1 && ce[me].push(we);
            }
            var be = i(ce);
            be.sort(function(ve, Ee) {
              return ve.length - Ee.length;
            });
            var Ae = {};
            for (se = 0; se < be.length; se++) {
              var pe = be[se].slice(-2);
              Ae[pe[0]] || (Ae[pe[0]] = {}), Ae[pe[0]][pe[1]] = true;
            }
            ne.links.forEach(function(ve) {
              var Ee = ve.target.index, Se = ve.source.index;
              Ee === Se || Ae[Se] && Ae[Se][Ee] ? (ve.circular = true, ve.circularLinkID = le, le += 1) : ve.circular = false;
            });
          } else ne.links.forEach(function(ve) {
            ve.source[ue] < ve.target[ue] ? ve.circular = false : (ve.circular = true, ve.circularLinkID = le, le += 1);
          });
        }
        function A2(ne, ae) {
          var ue = 0, le = 0;
          ne.links.forEach(function(ce) {
            ce.circular && (ce.source.circularLinkType || ce.target.circularLinkType ? ce.circularLinkType = ce.source.circularLinkType ? ce.source.circularLinkType : ce.target.circularLinkType : ce.circularLinkType = ue < le ? "top" : "bottom", ce.circularLinkType == "top" ? ue += 1 : le += 1, ne.nodes.forEach(function(se) {
              k(se, ae) != k(ce.source, ae) && k(se, ae) != k(ce.target, ae) || (se.circularLinkType = ce.circularLinkType);
            }));
          }), ne.links.forEach(function(ce) {
            ce.circular && (ce.source.circularLinkType == ce.target.circularLinkType && (ce.circularLinkType = ce.source.circularLinkType), Q2(ce, ae) && (ce.circularLinkType = ce.source.circularLinkType));
          });
        }
        function S2(ne) {
          var ae = Math.abs(ne.y1 - ne.y0), ue = Math.abs(ne.target.x0 - ne.source.x1);
          return Math.atan(ue / ae);
        }
        function C2(ne, ae) {
          var ue = 0;
          ne.sourceLinks.forEach(function(ce) {
            ue = ce.circular && !Q2(ce, ae) ? ue + 1 : ue;
          });
          var le = 0;
          return ne.targetLinks.forEach(function(ce) {
            le = ce.circular && !Q2(ce, ae) ? le + 1 : le;
          }), ue + le;
        }
        function E2(ne) {
          var ae = ne.source.sourceLinks, ue = 0;
          ae.forEach(function(se) {
            ue = se.circular ? ue + 1 : ue;
          });
          var le = ne.target.targetLinks, ce = 0;
          return le.forEach(function(se) {
            ce = se.circular ? ce + 1 : ce;
          }), !(ue > 1 || ce > 1);
        }
        function F13(ne, ae, ue) {
          return ne.sort(D2), ne.forEach(function(le, ce) {
            var se, he, me = 0;
            if (Q2(le, ue) && E2(le)) le.circularPathData.verticalBuffer = me + le.width / 2;
            else {
              for (var we = 0; we < ce; we++) if (se = ne[ce], he = ne[we], !(se.source.column < he.target.column || se.target.column > he.source.column)) {
                var be = ne[we].circularPathData.verticalBuffer + ne[we].width / 2 + ae;
                me = be > me ? be : me;
              }
              le.circularPathData.verticalBuffer = me + le.width / 2;
            }
          }), ne;
        }
        function N2(ne, ae, ue, le) {
          var ce = a.min(ne.links, function(se) {
            return se.source.y0;
          });
          ne.links.forEach(function(se) {
            se.circular && (se.circularPathData = {});
          }), F13(ne.links.filter(function(se) {
            return se.circularLinkType == "top";
          }), ae, le), F13(ne.links.filter(function(se) {
            return se.circularLinkType == "bottom";
          }), ae, le), ne.links.forEach(function(se) {
            if (se.circular) {
              if (se.circularPathData.arcRadius = se.width + 10, se.circularPathData.leftNodeBuffer = 5, se.circularPathData.rightNodeBuffer = 5, se.circularPathData.sourceWidth = se.source.x1 - se.source.x0, se.circularPathData.sourceX = se.source.x0 + se.circularPathData.sourceWidth, se.circularPathData.targetX = se.target.x0, se.circularPathData.sourceY = se.y0, se.circularPathData.targetY = se.y1, Q2(se, le) && E2(se)) se.circularPathData.leftSmallArcRadius = 10 + se.width / 2, se.circularPathData.leftLargeArcRadius = 10 + se.width / 2, se.circularPathData.rightSmallArcRadius = 10 + se.width / 2, se.circularPathData.rightLargeArcRadius = 10 + se.width / 2, se.circularLinkType == "bottom" ? (se.circularPathData.verticalFullExtent = se.source.y1 + 25 + se.circularPathData.verticalBuffer, se.circularPathData.verticalLeftInnerExtent = se.circularPathData.verticalFullExtent - se.circularPathData.leftLargeArcRadius, se.circularPathData.verticalRightInnerExtent = se.circularPathData.verticalFullExtent - se.circularPathData.rightLargeArcRadius) : (se.circularPathData.verticalFullExtent = se.source.y0 - 25 - se.circularPathData.verticalBuffer, se.circularPathData.verticalLeftInnerExtent = se.circularPathData.verticalFullExtent + se.circularPathData.leftLargeArcRadius, se.circularPathData.verticalRightInnerExtent = se.circularPathData.verticalFullExtent + se.circularPathData.rightLargeArcRadius);
              else {
                var he = se.source.column, me = se.circularLinkType, we = ne.links.filter(function(pe) {
                  return pe.source.column == he && pe.circularLinkType == me;
                });
                se.circularLinkType == "bottom" ? we.sort(O2) : we.sort(I2);
                var be = 0;
                we.forEach(function(pe, ve) {
                  pe.circularLinkID == se.circularLinkID && (se.circularPathData.leftSmallArcRadius = 10 + se.width / 2 + be, se.circularPathData.leftLargeArcRadius = 10 + se.width / 2 + ve * ae + be), be += pe.width;
                }), he = se.target.column, we = ne.links.filter(function(pe) {
                  return pe.target.column == he && pe.circularLinkType == me;
                }), se.circularLinkType == "bottom" ? we.sort(V2) : we.sort(L2), be = 0, we.forEach(function(pe, ve) {
                  pe.circularLinkID == se.circularLinkID && (se.circularPathData.rightSmallArcRadius = 10 + se.width / 2 + be, se.circularPathData.rightLargeArcRadius = 10 + se.width / 2 + ve * ae + be), be += pe.width;
                }), se.circularLinkType == "bottom" ? (se.circularPathData.verticalFullExtent = Math.max(ue, se.source.y1, se.target.y1) + 25 + se.circularPathData.verticalBuffer, se.circularPathData.verticalLeftInnerExtent = se.circularPathData.verticalFullExtent - se.circularPathData.leftLargeArcRadius, se.circularPathData.verticalRightInnerExtent = se.circularPathData.verticalFullExtent - se.circularPathData.rightLargeArcRadius) : (se.circularPathData.verticalFullExtent = ce - 25 - se.circularPathData.verticalBuffer, se.circularPathData.verticalLeftInnerExtent = se.circularPathData.verticalFullExtent + se.circularPathData.leftLargeArcRadius, se.circularPathData.verticalRightInnerExtent = se.circularPathData.verticalFullExtent + se.circularPathData.rightLargeArcRadius);
              }
              se.circularPathData.leftInnerExtent = se.circularPathData.sourceX + se.circularPathData.leftNodeBuffer, se.circularPathData.rightInnerExtent = se.circularPathData.targetX - se.circularPathData.rightNodeBuffer, se.circularPathData.leftFullExtent = se.circularPathData.sourceX + se.circularPathData.leftLargeArcRadius + se.circularPathData.leftNodeBuffer, se.circularPathData.rightFullExtent = se.circularPathData.targetX - se.circularPathData.rightLargeArcRadius - se.circularPathData.rightNodeBuffer;
            }
            if (se.circular) se.path = function(pe) {
              var ve = "";
              return ve = pe.circularLinkType == "top" ? "M" + pe.circularPathData.sourceX + " " + pe.circularPathData.sourceY + " L" + pe.circularPathData.leftInnerExtent + " " + pe.circularPathData.sourceY + " A" + pe.circularPathData.leftLargeArcRadius + " " + pe.circularPathData.leftSmallArcRadius + " 0 0 0 " + pe.circularPathData.leftFullExtent + " " + (pe.circularPathData.sourceY - pe.circularPathData.leftSmallArcRadius) + " L" + pe.circularPathData.leftFullExtent + " " + pe.circularPathData.verticalLeftInnerExtent + " A" + pe.circularPathData.leftLargeArcRadius + " " + pe.circularPathData.leftLargeArcRadius + " 0 0 0 " + pe.circularPathData.leftInnerExtent + " " + pe.circularPathData.verticalFullExtent + " L" + pe.circularPathData.rightInnerExtent + " " + pe.circularPathData.verticalFullExtent + " A" + pe.circularPathData.rightLargeArcRadius + " " + pe.circularPathData.rightLargeArcRadius + " 0 0 0 " + pe.circularPathData.rightFullExtent + " " + pe.circularPathData.verticalRightInnerExtent + " L" + pe.circularPathData.rightFullExtent + " " + (pe.circularPathData.targetY - pe.circularPathData.rightSmallArcRadius) + " A" + pe.circularPathData.rightLargeArcRadius + " " + pe.circularPathData.rightSmallArcRadius + " 0 0 0 " + pe.circularPathData.rightInnerExtent + " " + pe.circularPathData.targetY + " L" + pe.circularPathData.targetX + " " + pe.circularPathData.targetY : "M" + pe.circularPathData.sourceX + " " + pe.circularPathData.sourceY + " L" + pe.circularPathData.leftInnerExtent + " " + pe.circularPathData.sourceY + " A" + pe.circularPathData.leftLargeArcRadius + " " + pe.circularPathData.leftSmallArcRadius + " 0 0 1 " + pe.circularPathData.leftFullExtent + " " + (pe.circularPathData.sourceY + pe.circularPathData.leftSmallArcRadius) + " L" + pe.circularPathData.leftFullExtent + " " + pe.circularPathData.verticalLeftInnerExtent + " A" + pe.circularPathData.leftLargeArcRadius + " " + pe.circularPathData.leftLargeArcRadius + " 0 0 1 " + pe.circularPathData.leftInnerExtent + " " + pe.circularPathData.verticalFullExtent + " L" + pe.circularPathData.rightInnerExtent + " " + pe.circularPathData.verticalFullExtent + " A" + pe.circularPathData.rightLargeArcRadius + " " + pe.circularPathData.rightLargeArcRadius + " 0 0 1 " + pe.circularPathData.rightFullExtent + " " + pe.circularPathData.verticalRightInnerExtent + " L" + pe.circularPathData.rightFullExtent + " " + (pe.circularPathData.targetY + pe.circularPathData.rightSmallArcRadius) + " A" + pe.circularPathData.rightLargeArcRadius + " " + pe.circularPathData.rightSmallArcRadius + " 0 0 1 " + pe.circularPathData.rightInnerExtent + " " + pe.circularPathData.targetY + " L" + pe.circularPathData.targetX + " " + pe.circularPathData.targetY, ve;
            }(se);
            else {
              var Ae = s.linkHorizontal().source(function(pe) {
                return [pe.source.x0 + (pe.source.x1 - pe.source.x0), pe.y0];
              }).target(function(pe) {
                return [pe.target.x0, pe.y1];
              });
              se.path = Ae(se);
            }
          });
        }
        function D2(ne, ae) {
          return W2(ne) == W2(ae) ? ne.circularLinkType == "bottom" ? O2(ne, ae) : I2(ne, ae) : W2(ae) - W2(ne);
        }
        function I2(ne, ae) {
          return ne.y0 - ae.y0;
        }
        function O2(ne, ae) {
          return ae.y0 - ne.y0;
        }
        function L2(ne, ae) {
          return ne.y1 - ae.y1;
        }
        function V2(ne, ae) {
          return ae.y1 - ne.y1;
        }
        function W2(ne) {
          return ne.target.column - ne.source.column;
        }
        function X2(ne) {
          return ne.target.x0 - ne.source.x1;
        }
        function Y2(ne, ae) {
          var ue = S2(ne), le = X2(ae) / Math.tan(ue);
          return j(ne) == "up" ? ne.y1 + le : ne.y1 - le;
        }
        function K2(ne, ae) {
          var ue = S2(ne), le = X2(ae) / Math.tan(ue);
          return j(ne) == "up" ? ne.y1 - le : ne.y1 + le;
        }
        function q(ne, ae, ue, le) {
          ne.links.forEach(function(ce) {
            if (!ce.circular && ce.target.column - ce.source.column > 1) {
              var se = ce.source.column + 1, he = ce.target.column - 1, me = 1, we = he - se + 1;
              for (me = 1; se <= he; se++, me++) ne.nodes.forEach(function(be) {
                if (be.column == se) {
                  var Ae, pe = me / (we + 1), ve = Math.pow(1 - pe, 3), Ee = 3 * pe * Math.pow(1 - pe, 2), Se = 3 * Math.pow(pe, 2) * (1 - pe), Ce = Math.pow(pe, 3), Be = ve * ce.y0 + Ee * ce.y0 + Se * ce.y1 + Ce * ce.y1, Ue = Be - ce.width / 2, Ke = Be + ce.width / 2;
                  Ue > be.y0 && Ue < be.y1 ? (Ae = be.y1 - Ue + 10, Ae = be.circularLinkType == "bottom" ? Ae : -Ae, be = R2(be, Ae, ae, ue), ne.nodes.forEach(function(ct) {
                    k(ct, le) != k(be, le) && ct.column == be.column && re(be, ct) && R2(ct, Ae, ae, ue);
                  })) : (Ke > be.y0 && Ke < be.y1 || Ue < be.y0 && Ke > be.y1) && (Ae = Ke - be.y0 + 10, be = R2(be, Ae, ae, ue), ne.nodes.forEach(function(ct) {
                    k(ct, le) != k(be, le) && ct.column == be.column && ct.y0 < be.y1 && ct.y1 > be.y1 && R2(ct, Ae, ae, ue);
                  }));
                }
              });
            }
          });
        }
        function re(ne, ae) {
          return ne.y0 > ae.y0 && ne.y0 < ae.y1 || ne.y1 > ae.y0 && ne.y1 < ae.y1 || ne.y0 < ae.y0 && ne.y1 > ae.y1;
        }
        function R2(ne, ae, ue, le) {
          return ne.y0 + ae >= ue && ne.y1 + ae <= le && (ne.y0 = ne.y0 + ae, ne.y1 = ne.y1 + ae, ne.targetLinks.forEach(function(ce) {
            ce.y1 = ce.y1 + ae;
          }), ne.sourceLinks.forEach(function(ce) {
            ce.y0 = ce.y0 + ae;
          })), ne;
        }
        function z(ne, ae, ue, le) {
          ne.nodes.forEach(function(ce) {
            le && ce.y + (ce.y1 - ce.y0) > ae && (ce.y = ce.y - (ce.y + (ce.y1 - ce.y0) - ae));
            var se = ne.links.filter(function(we) {
              return k(we.source, ue) == k(ce, ue);
            }), he = se.length;
            he > 1 && se.sort(function(we, be) {
              if (!we.circular && !be.circular) {
                if (we.target.column == be.target.column || !te(we, be)) return we.y1 - be.y1;
                if (we.target.column > be.target.column) {
                  var Ae = K2(be, we);
                  return we.y1 - Ae;
                }
                if (be.target.column > we.target.column) return K2(we, be) - be.y1;
              }
              return we.circular && !be.circular ? we.circularLinkType == "top" ? -1 : 1 : be.circular && !we.circular ? be.circularLinkType == "top" ? 1 : -1 : we.circular && be.circular ? we.circularLinkType === be.circularLinkType && we.circularLinkType == "top" ? we.target.column === be.target.column ? we.target.y1 - be.target.y1 : be.target.column - we.target.column : we.circularLinkType === be.circularLinkType && we.circularLinkType == "bottom" ? we.target.column === be.target.column ? be.target.y1 - we.target.y1 : we.target.column - be.target.column : we.circularLinkType == "top" ? -1 : 1 : void 0;
            });
            var me = ce.y0;
            se.forEach(function(we) {
              we.y0 = me + we.width / 2, me += we.width;
            }), se.forEach(function(we, be) {
              if (we.circularLinkType == "bottom") {
                for (var Ae = be + 1, pe = 0; Ae < he; Ae++) pe += se[Ae].width;
                we.y0 = ce.y1 - pe - we.width / 2;
              }
            });
          });
        }
        function H2(ne, ae, ue) {
          ne.nodes.forEach(function(le) {
            var ce = ne.links.filter(function(me) {
              return k(me.target, ue) == k(le, ue);
            }), se = ce.length;
            se > 1 && ce.sort(function(me, we) {
              if (!me.circular && !we.circular) {
                if (me.source.column == we.source.column || !te(me, we)) return me.y0 - we.y0;
                if (we.source.column < me.source.column) {
                  var be = Y2(we, me);
                  return me.y0 - be;
                }
                if (me.source.column < we.source.column) return Y2(me, we) - we.y0;
              }
              return me.circular && !we.circular ? me.circularLinkType == "top" ? -1 : 1 : we.circular && !me.circular ? we.circularLinkType == "top" ? 1 : -1 : me.circular && we.circular ? me.circularLinkType === we.circularLinkType && me.circularLinkType == "top" ? me.source.column === we.source.column ? me.source.y1 - we.source.y1 : me.source.column - we.source.column : me.circularLinkType === we.circularLinkType && me.circularLinkType == "bottom" ? me.source.column === we.source.column ? me.source.y1 - we.source.y1 : we.source.column - me.source.column : me.circularLinkType == "top" ? -1 : 1 : void 0;
            });
            var he = le.y0;
            ce.forEach(function(me) {
              me.y1 = he + me.width / 2, he += me.width;
            }), ce.forEach(function(me, we) {
              if (me.circularLinkType == "bottom") {
                for (var be = we + 1, Ae = 0; be < se; be++) Ae += ce[be].width;
                me.y1 = le.y1 - Ae - me.width / 2;
              }
            });
          });
        }
        function te(ne, ae) {
          return j(ne) == j(ae);
        }
        function j(ne) {
          return ne.y0 - ne.y1 > 0 ? "up" : "down";
        }
        function Q2(ne, ae) {
          return k(ne.source, ae) == k(ne.target, ae);
        }
        function Z2(ne, ae, ue) {
          var le = ne.nodes, ce = ne.links, se = false, he = false;
          if (ce.forEach(function(be) {
            be.circularLinkType == "top" ? se = true : be.circularLinkType == "bottom" && (he = true);
          }), se == 0 || he == 0) {
            var me = a.min(le, function(be) {
              return be.y0;
            }), we = (ue - ae) / (a.max(le, function(be) {
              return be.y1;
            }) - me);
            le.forEach(function(be) {
              var Ae = (be.y1 - be.y0) * we;
              be.y0 = (be.y0 - me) * we, be.y1 = be.y0 + Ae;
            }), ce.forEach(function(be) {
              be.y0 = (be.y0 - me) * we, be.y1 = (be.y1 - me) * we, be.width = be.width * we;
            });
          }
        }
        n.sankeyCircular = function() {
          var ne, ae, ue = 0, le = 0, ce = 1, se = 1, he = 24, me = b, we = u2, be = y, Ae = w, pe = 32, ve = 2, Ee = null;
          function Se() {
            var We = { nodes: be.apply(null, arguments), links: Ae.apply(null, arguments) };
            Ce(We), T2(We, me, Ee), Be(We), Ue(We), A2(We, me), Ke(We, pe, me), ct(We);
            for (var Ze = 4, it = 0; it < Ze; it++) z(We, se, me), H2(We, se, me), q(We, le, se, me), z(We, se, me), H2(We, se, me);
            return Z2(We, le, se), N2(We, ve, se, me), We;
          }
          function Ce(We) {
            We.nodes.forEach(function(it, ot) {
              it.index = ot, it.sourceLinks = [], it.targetLinks = [];
            });
            var Ze = o.map(We.nodes, me);
            return We.links.forEach(function(it, ot) {
              it.index = ot;
              var mt = it.source, wt = it.target;
              (mt === void 0 ? "undefined" : f(mt)) !== "object" && (mt = it.source = _4(Ze, mt)), (wt === void 0 ? "undefined" : f(wt)) !== "object" && (wt = it.target = _4(Ze, wt)), mt.sourceLinks.push(it), wt.targetLinks.push(it);
            }), We;
          }
          function Be(We) {
            We.nodes.forEach(function(Ze) {
              Ze.partOfCycle = false, Ze.value = Math.max(a.sum(Ze.sourceLinks, v), a.sum(Ze.targetLinks, v)), Ze.sourceLinks.forEach(function(it) {
                it.circular && (Ze.partOfCycle = true, Ze.circularLinkType = it.circularLinkType);
              }), Ze.targetLinks.forEach(function(it) {
                it.circular && (Ze.partOfCycle = true, Ze.circularLinkType = it.circularLinkType);
              });
            });
          }
          function Ue(We) {
            var Ze, it, ot;
            for (Ze = We.nodes, it = [], ot = 0; Ze.length; ++ot, Ze = it, it = []) Ze.forEach(function(mt) {
              mt.depth = ot, mt.sourceLinks.forEach(function(wt) {
                it.indexOf(wt.target) < 0 && !wt.circular && it.push(wt.target);
              });
            });
            for (Ze = We.nodes, it = [], ot = 0; Ze.length; ++ot, Ze = it, it = []) Ze.forEach(function(mt) {
              mt.height = ot, mt.targetLinks.forEach(function(wt) {
                it.indexOf(wt.source) < 0 && !wt.circular && it.push(wt.source);
              });
            });
            We.nodes.forEach(function(mt) {
              mt.column = Math.floor(we.call(null, mt, ot));
            });
          }
          function Ke(We, Ze, it) {
            var ot = o.nest().key(function(Nt) {
              return Nt.column;
            }).sortKeys(a.ascending).entries(We.nodes).map(function(Nt) {
              return Nt.values;
            });
            (function(Nt) {
              if (ae) {
                var yt = 1 / 0;
                ot.forEach(function(tr) {
                  var Ye = se * ae / (tr.length + 1);
                  yt = Ye < yt ? Ye : yt;
                }), ne = yt;
              }
              var pt = a.min(ot, function(tr) {
                return (se - le - (tr.length - 1) * ne) / a.sum(tr, v);
              });
              pt *= 0.3, We.links.forEach(function(tr) {
                tr.width = tr.value * pt;
              });
              var Ot = function(tr) {
                var Ye = 0, at = 0, Ge = 0, st = 0, Ie = a.max(tr.nodes, function(Pe) {
                  return Pe.column;
                });
                return tr.links.forEach(function(Pe) {
                  Pe.circular && (Pe.circularLinkType == "top" ? Ye += Pe.width : at += Pe.width, Pe.target.column == 0 && (st += Pe.width), Pe.source.column == Ie && (Ge += Pe.width));
                }), { top: Ye = Ye > 0 ? Ye + 25 + 10 : Ye, bottom: at = at > 0 ? at + 25 + 10 : at, left: st = st > 0 ? st + 25 + 10 : st, right: Ge = Ge > 0 ? Ge + 25 + 10 : Ge };
              }(We), Jt = function(tr, Ye) {
                var at = a.max(tr.nodes, function($e) {
                  return $e.column;
                }), Ge = ce - ue, st = se - le, Ie = Ge / (Ge + Ye.right + Ye.left), Pe = st / (st + Ye.top + Ye.bottom);
                return ue = ue * Ie + Ye.left, ce = Ye.right == 0 ? ce : ce * Ie, le = le * Pe + Ye.top, se *= Pe, tr.nodes.forEach(function($e) {
                  $e.x0 = ue + $e.column * ((ce - ue - he) / at), $e.x1 = $e.x0 + he;
                }), Pe;
              }(We, Ot);
              pt *= Jt, We.links.forEach(function(tr) {
                tr.width = tr.value * pt;
              }), ot.forEach(function(tr) {
                var Ye = tr.length;
                tr.forEach(function(at, Ge) {
                  at.depth == ot.length - 1 && Ye == 1 || at.depth == 0 && Ye == 1 ? (at.y0 = se / 2 - at.value * pt, at.y1 = at.y0 + at.value * pt) : at.partOfCycle ? C2(at, Nt) == 0 ? (at.y0 = se / 2 + Ge, at.y1 = at.y0 + at.value * pt) : at.circularLinkType == "top" ? (at.y0 = le + Ge, at.y1 = at.y0 + at.value * pt) : (at.y0 = se - at.value * pt - Ge, at.y1 = at.y0 + at.value * pt) : Ot.top == 0 || Ot.bottom == 0 ? (at.y0 = (se - le) / Ye * Ge, at.y1 = at.y0 + at.value * pt) : (at.y0 = (se - le) / 2 - Ye / 2 + Ge, at.y1 = at.y0 + at.value * pt);
                });
              });
            })(it), zt();
            for (var mt = 1, wt = Ze; wt > 0; --wt) Et(mt *= 0.99, it), zt();
            function Et(Nt, yt) {
              var pt = ot.length;
              ot.forEach(function(Ot) {
                var Jt = Ot.length, tr = Ot[0].depth;
                Ot.forEach(function(Ye) {
                  var at;
                  if ((Ye.sourceLinks.length || Ye.targetLinks.length) && !(Ye.partOfCycle && C2(Ye, yt) > 0)) if (tr == 0 && Jt == 1) at = Ye.y1 - Ye.y0, Ye.y0 = se / 2 - at / 2, Ye.y1 = se / 2 + at / 2;
                  else if (tr == pt - 1 && Jt == 1) at = Ye.y1 - Ye.y0, Ye.y0 = se / 2 - at / 2, Ye.y1 = se / 2 + at / 2;
                  else {
                    var Ge = a.mean(Ye.sourceLinks, x), st = a.mean(Ye.targetLinks, g), Ie = ((Ge && st ? (Ge + st) / 2 : Ge || st) - m(Ye)) * Nt;
                    Ye.y0 += Ie, Ye.y1 += Ie;
                  }
                });
              });
            }
            function zt() {
              ot.forEach(function(Nt) {
                var yt, pt, Ot, Jt = le, tr = Nt.length;
                for (Nt.sort(d), Ot = 0; Ot < tr; ++Ot) (pt = Jt - (yt = Nt[Ot]).y0) > 0 && (yt.y0 += pt, yt.y1 += pt), Jt = yt.y1 + ne;
                if ((pt = Jt - ne - se) > 0) for (Jt = yt.y0 -= pt, yt.y1 -= pt, Ot = tr - 2; Ot >= 0; --Ot) (pt = (yt = Nt[Ot]).y1 + ne - Jt) > 0 && (yt.y0 -= pt, yt.y1 -= pt), Jt = yt.y0;
              });
            }
          }
          function ct(We) {
            We.nodes.forEach(function(Ze) {
              Ze.sourceLinks.sort(p), Ze.targetLinks.sort(h);
            }), We.nodes.forEach(function(Ze) {
              var it = Ze.y0, ot = it, mt = Ze.y1, wt = mt;
              Ze.sourceLinks.forEach(function(Et) {
                Et.circular ? (Et.y0 = mt - Et.width / 2, mt -= Et.width) : (Et.y0 = it + Et.width / 2, it += Et.width);
              }), Ze.targetLinks.forEach(function(Et) {
                Et.circular ? (Et.y1 = wt - Et.width / 2, wt -= Et.width) : (Et.y1 = ot + Et.width / 2, ot += Et.width);
              });
            });
          }
          return Se.nodeId = function(We) {
            return arguments.length ? (me = typeof We == "function" ? We : c(We), Se) : me;
          }, Se.nodeAlign = function(We) {
            return arguments.length ? (we = typeof We == "function" ? We : c(We), Se) : we;
          }, Se.nodeWidth = function(We) {
            return arguments.length ? (he = +We, Se) : he;
          }, Se.nodePadding = function(We) {
            return arguments.length ? (ne = +We, Se) : ne;
          }, Se.nodes = function(We) {
            return arguments.length ? (be = typeof We == "function" ? We : c(We), Se) : be;
          }, Se.links = function(We) {
            return arguments.length ? (Ae = typeof We == "function" ? We : c(We), Se) : Ae;
          }, Se.size = function(We) {
            return arguments.length ? (ue = le = 0, ce = +We[0], se = +We[1], Se) : [ce - ue, se - le];
          }, Se.extent = function(We) {
            return arguments.length ? (ue = +We[0][0], ce = +We[1][0], le = +We[0][1], se = +We[1][1], Se) : [[ue, le], [ce, se]];
          }, Se.iterations = function(We) {
            return arguments.length ? (pe = +We, Se) : pe;
          }, Se.circularLinkGap = function(We) {
            return arguments.length ? (ve = +We, Se) : ve;
          }, Se.nodePaddingRatio = function(We) {
            return arguments.length ? (ae = +We, Se) : ae;
          }, Se.sortNodes = function(We) {
            return arguments.length ? (Ee = We, Se) : Ee;
          }, Se.update = function(We) {
            return A2(We, me), ct(We), We.links.forEach(function(Ze) {
              Ze.circular && (Ze.circularLinkType = Ze.y0 + Ze.y1 < se ? "top" : "bottom", Ze.source.circularLinkType = Ze.circularLinkType, Ze.target.circularLinkType = Ze.circularLinkType);
            }), z(We, se, me, false), H2(We, se, me), N2(We, ve, se, me), We;
          }, Se;
        }, n.sankeyCenter = function(ne) {
          return ne.targetLinks.length ? ne.depth : ne.sourceLinks.length ? a.min(ne.sourceLinks, l) - 1 : 0;
        }, n.sankeyLeft = function(ne) {
          return ne.depth;
        }, n.sankeyRight = function(ne, ae) {
          return ae - 1 - ne.height;
        }, n.sankeyJustify = u2, Object.defineProperty(n, "__esModule", { value: true });
      });
    }, { "d3-array": 107, "d3-collection": 108, "d3-shape": 119, "elementary-circuits-directed-graph": 130 }], 57: [function(e, t, r) {
      (function(n, a) {
        typeof r == "object" && t !== void 0 ? a(r, e("d3-array"), e("d3-collection"), e("d3-shape")) : a(n.d3 = n.d3 || {}, n.d3, n.d3, n.d3);
      })(this, function(n, a, o, s) {
        "use strict";
        function i(k) {
          return k.target.depth;
        }
        function l(k, T2) {
          return k.sourceLinks.length ? k.depth : T2 - 1;
        }
        function u2(k) {
          return function() {
            return k;
          };
        }
        function c(k, T2) {
          return h(k.source, T2.source) || k.index - T2.index;
        }
        function f(k, T2) {
          return h(k.target, T2.target) || k.index - T2.index;
        }
        function h(k, T2) {
          return k.y0 - T2.y0;
        }
        function p(k) {
          return k.value;
        }
        function d(k) {
          return (k.y0 + k.y1) / 2;
        }
        function v(k) {
          return d(k.source) * k.value;
        }
        function m(k) {
          return d(k.target) * k.value;
        }
        function g(k) {
          return k.index;
        }
        function x(k) {
          return k.nodes;
        }
        function b(k) {
          return k.links;
        }
        function y(k, T2) {
          var A2 = k.get(T2);
          if (!A2) throw new Error("missing: " + T2);
          return A2;
        }
        function w(k) {
          return [k.source.x1, k.y0];
        }
        function _4(k) {
          return [k.target.x0, k.y1];
        }
        n.sankey = function() {
          var k = 0, T2 = 0, A2 = 1, S2 = 1, C2 = 24, E2 = 8, F13 = g, N2 = l, D2 = x, I2 = b, O2 = 32;
          function L2() {
            var q = { nodes: D2.apply(null, arguments), links: I2.apply(null, arguments) };
            return V2(q), W2(q), X2(q), Y2(q), K2(q), q;
          }
          function V2(q) {
            q.nodes.forEach(function(R2, z) {
              R2.index = z, R2.sourceLinks = [], R2.targetLinks = [];
            });
            var re = o.map(q.nodes, F13);
            q.links.forEach(function(R2, z) {
              R2.index = z;
              var H2 = R2.source, te = R2.target;
              typeof H2 != "object" && (H2 = R2.source = y(re, H2)), typeof te != "object" && (te = R2.target = y(re, te)), H2.sourceLinks.push(R2), te.targetLinks.push(R2);
            });
          }
          function W2(q) {
            q.nodes.forEach(function(re) {
              re.value = Math.max(a.sum(re.sourceLinks, p), a.sum(re.targetLinks, p));
            });
          }
          function X2(q) {
            var re, R2, z;
            for (re = q.nodes, R2 = [], z = 0; re.length; ++z, re = R2, R2 = []) re.forEach(function(te) {
              te.depth = z, te.sourceLinks.forEach(function(j) {
                R2.indexOf(j.target) < 0 && R2.push(j.target);
              });
            });
            for (re = q.nodes, R2 = [], z = 0; re.length; ++z, re = R2, R2 = []) re.forEach(function(te) {
              te.height = z, te.targetLinks.forEach(function(j) {
                R2.indexOf(j.source) < 0 && R2.push(j.source);
              });
            });
            var H2 = (A2 - k - C2) / (z - 1);
            q.nodes.forEach(function(te) {
              te.x1 = (te.x0 = k + Math.max(0, Math.min(z - 1, Math.floor(N2.call(null, te, z)))) * H2) + C2;
            });
          }
          function Y2(q) {
            var re = o.nest().key(function(Q2) {
              return Q2.x0;
            }).sortKeys(a.ascending).entries(q.nodes).map(function(Q2) {
              return Q2.values;
            });
            (function() {
              var Q2 = a.max(re, function(ae) {
                return ae.length;
              }), Z2 = 2 / 3 * (S2 - T2) / (Q2 - 1);
              E2 > Z2 && (E2 = Z2);
              var ne = a.min(re, function(ae) {
                return (S2 - T2 - (ae.length - 1) * E2) / a.sum(ae, p);
              });
              re.forEach(function(ae) {
                ae.forEach(function(ue, le) {
                  ue.y1 = (ue.y0 = le) + ue.value * ne;
                });
              }), q.links.forEach(function(ae) {
                ae.width = ae.value * ne;
              });
            })(), j();
            for (var R2 = 1, z = O2; z > 0; --z) te(R2 *= 0.99), j(), H2(R2), j();
            function H2(Q2) {
              re.forEach(function(Z2) {
                Z2.forEach(function(ne) {
                  if (ne.targetLinks.length) {
                    var ae = (a.sum(ne.targetLinks, v) / a.sum(ne.targetLinks, p) - d(ne)) * Q2;
                    ne.y0 += ae, ne.y1 += ae;
                  }
                });
              });
            }
            function te(Q2) {
              re.slice().reverse().forEach(function(Z2) {
                Z2.forEach(function(ne) {
                  if (ne.sourceLinks.length) {
                    var ae = (a.sum(ne.sourceLinks, m) / a.sum(ne.sourceLinks, p) - d(ne)) * Q2;
                    ne.y0 += ae, ne.y1 += ae;
                  }
                });
              });
            }
            function j() {
              re.forEach(function(Q2) {
                var Z2, ne, ae, ue = T2, le = Q2.length;
                for (Q2.sort(h), ae = 0; ae < le; ++ae) (ne = ue - (Z2 = Q2[ae]).y0) > 0 && (Z2.y0 += ne, Z2.y1 += ne), ue = Z2.y1 + E2;
                if ((ne = ue - E2 - S2) > 0) for (ue = Z2.y0 -= ne, Z2.y1 -= ne, ae = le - 2; ae >= 0; --ae) (ne = (Z2 = Q2[ae]).y1 + E2 - ue) > 0 && (Z2.y0 -= ne, Z2.y1 -= ne), ue = Z2.y0;
              });
            }
          }
          function K2(q) {
            q.nodes.forEach(function(re) {
              re.sourceLinks.sort(f), re.targetLinks.sort(c);
            }), q.nodes.forEach(function(re) {
              var R2 = re.y0, z = R2;
              re.sourceLinks.forEach(function(H2) {
                H2.y0 = R2 + H2.width / 2, R2 += H2.width;
              }), re.targetLinks.forEach(function(H2) {
                H2.y1 = z + H2.width / 2, z += H2.width;
              });
            });
          }
          return L2.update = function(q) {
            return K2(q), q;
          }, L2.nodeId = function(q) {
            return arguments.length ? (F13 = typeof q == "function" ? q : u2(q), L2) : F13;
          }, L2.nodeAlign = function(q) {
            return arguments.length ? (N2 = typeof q == "function" ? q : u2(q), L2) : N2;
          }, L2.nodeWidth = function(q) {
            return arguments.length ? (C2 = +q, L2) : C2;
          }, L2.nodePadding = function(q) {
            return arguments.length ? (E2 = +q, L2) : E2;
          }, L2.nodes = function(q) {
            return arguments.length ? (D2 = typeof q == "function" ? q : u2(q), L2) : D2;
          }, L2.links = function(q) {
            return arguments.length ? (I2 = typeof q == "function" ? q : u2(q), L2) : I2;
          }, L2.size = function(q) {
            return arguments.length ? (k = T2 = 0, A2 = +q[0], S2 = +q[1], L2) : [A2 - k, S2 - T2];
          }, L2.extent = function(q) {
            return arguments.length ? (k = +q[0][0], A2 = +q[1][0], T2 = +q[0][1], S2 = +q[1][1], L2) : [[k, T2], [A2, S2]];
          }, L2.iterations = function(q) {
            return arguments.length ? (O2 = +q, L2) : O2;
          }, L2;
        }, n.sankeyCenter = function(k) {
          return k.targetLinks.length ? k.depth : k.sourceLinks.length ? a.min(k.sourceLinks, i) - 1 : 0;
        }, n.sankeyLeft = function(k) {
          return k.depth;
        }, n.sankeyRight = function(k, T2) {
          return T2 - 1 - k.height;
        }, n.sankeyJustify = l, n.sankeyLinkHorizontal = function() {
          return s.linkHorizontal().source(w).target(_4);
        }, Object.defineProperty(n, "__esModule", { value: true });
      });
    }, { "d3-array": 107, "d3-collection": 108, "d3-shape": 119 }], 58: [function(e, t, r) {
      (function() {
        var n = { version: "3.8.0" }, a = [].slice, o = function(fe) {
          return a.call(fe);
        }, s = self.document;
        function i(fe) {
          return fe && (fe.ownerDocument || fe.document || fe).documentElement;
        }
        function l(fe) {
          return fe && (fe.ownerDocument && fe.ownerDocument.defaultView || fe.document && fe || fe.defaultView);
        }
        if (s) try {
          o(s.documentElement.childNodes)[0].nodeType;
        } catch {
          o = function(P2) {
            for (var U2 = P2.length, G2 = new Array(U2); U2--; ) G2[U2] = P2[U2];
            return G2;
          };
        }
        if (Date.now || (Date.now = function() {
          return +/* @__PURE__ */ new Date();
        }), s) try {
          s.createElement("DIV").style.setProperty("opacity", 0, "");
        } catch {
          var u2 = this.Element.prototype, c = u2.setAttribute, f = u2.setAttributeNS, h = this.CSSStyleDeclaration.prototype, p = h.setProperty;
          u2.setAttribute = function(P2, U2) {
            c.call(this, P2, U2 + "");
          }, u2.setAttributeNS = function(P2, U2, G2) {
            f.call(this, P2, U2, G2 + "");
          }, h.setProperty = function(P2, U2, G2) {
            p.call(this, P2, U2 + "", G2);
          };
        }
        function d(fe, P2) {
          return fe < P2 ? -1 : fe > P2 ? 1 : fe >= P2 ? 0 : NaN;
        }
        function v(fe) {
          return fe === null ? NaN : +fe;
        }
        function m(fe) {
          return !isNaN(fe);
        }
        function g(fe) {
          return { left: function(P2, U2, G2, J2) {
            for (arguments.length < 3 && (G2 = 0), arguments.length < 4 && (J2 = P2.length); G2 < J2; ) {
              var oe = G2 + J2 >>> 1;
              fe(P2[oe], U2) < 0 ? G2 = oe + 1 : J2 = oe;
            }
            return G2;
          }, right: function(P2, U2, G2, J2) {
            for (arguments.length < 3 && (G2 = 0), arguments.length < 4 && (J2 = P2.length); G2 < J2; ) {
              var oe = G2 + J2 >>> 1;
              fe(P2[oe], U2) > 0 ? J2 = oe : G2 = oe + 1;
            }
            return G2;
          } };
        }
        n.ascending = d, n.descending = function(fe, P2) {
          return P2 < fe ? -1 : P2 > fe ? 1 : P2 >= fe ? 0 : NaN;
        }, n.min = function(fe, P2) {
          var U2, G2, J2 = -1, oe = fe.length;
          if (arguments.length === 1) {
            for (; ++J2 < oe; ) if ((G2 = fe[J2]) != null && G2 >= G2) {
              U2 = G2;
              break;
            }
            for (; ++J2 < oe; ) (G2 = fe[J2]) != null && U2 > G2 && (U2 = G2);
          } else {
            for (; ++J2 < oe; ) if ((G2 = P2.call(fe, fe[J2], J2)) != null && G2 >= G2) {
              U2 = G2;
              break;
            }
            for (; ++J2 < oe; ) (G2 = P2.call(fe, fe[J2], J2)) != null && U2 > G2 && (U2 = G2);
          }
          return U2;
        }, n.max = function(fe, P2) {
          var U2, G2, J2 = -1, oe = fe.length;
          if (arguments.length === 1) {
            for (; ++J2 < oe; ) if ((G2 = fe[J2]) != null && G2 >= G2) {
              U2 = G2;
              break;
            }
            for (; ++J2 < oe; ) (G2 = fe[J2]) != null && G2 > U2 && (U2 = G2);
          } else {
            for (; ++J2 < oe; ) if ((G2 = P2.call(fe, fe[J2], J2)) != null && G2 >= G2) {
              U2 = G2;
              break;
            }
            for (; ++J2 < oe; ) (G2 = P2.call(fe, fe[J2], J2)) != null && G2 > U2 && (U2 = G2);
          }
          return U2;
        }, n.extent = function(fe, P2) {
          var U2, G2, J2, oe = -1, de = fe.length;
          if (arguments.length === 1) {
            for (; ++oe < de; ) if ((G2 = fe[oe]) != null && G2 >= G2) {
              U2 = J2 = G2;
              break;
            }
            for (; ++oe < de; ) (G2 = fe[oe]) != null && (U2 > G2 && (U2 = G2), J2 < G2 && (J2 = G2));
          } else {
            for (; ++oe < de; ) if ((G2 = P2.call(fe, fe[oe], oe)) != null && G2 >= G2) {
              U2 = J2 = G2;
              break;
            }
            for (; ++oe < de; ) (G2 = P2.call(fe, fe[oe], oe)) != null && (U2 > G2 && (U2 = G2), J2 < G2 && (J2 = G2));
          }
          return [U2, J2];
        }, n.sum = function(fe, P2) {
          var U2, G2 = 0, J2 = fe.length, oe = -1;
          if (arguments.length === 1) for (; ++oe < J2; ) m(U2 = +fe[oe]) && (G2 += U2);
          else for (; ++oe < J2; ) m(U2 = +P2.call(fe, fe[oe], oe)) && (G2 += U2);
          return G2;
        }, n.mean = function(fe, P2) {
          var U2, G2 = 0, J2 = fe.length, oe = -1, de = J2;
          if (arguments.length === 1) for (; ++oe < J2; ) m(U2 = v(fe[oe])) ? G2 += U2 : --de;
          else for (; ++oe < J2; ) m(U2 = v(P2.call(fe, fe[oe], oe))) ? G2 += U2 : --de;
          if (de) return G2 / de;
        }, n.quantile = function(fe, P2) {
          var U2 = (fe.length - 1) * P2 + 1, G2 = Math.floor(U2), J2 = +fe[G2 - 1], oe = U2 - G2;
          return oe ? J2 + oe * (fe[G2] - J2) : J2;
        }, n.median = function(fe, P2) {
          var U2, G2 = [], J2 = fe.length, oe = -1;
          if (arguments.length === 1) for (; ++oe < J2; ) m(U2 = v(fe[oe])) && G2.push(U2);
          else for (; ++oe < J2; ) m(U2 = v(P2.call(fe, fe[oe], oe))) && G2.push(U2);
          if (G2.length) return n.quantile(G2.sort(d), 0.5);
        }, n.variance = function(fe, P2) {
          var U2, G2, J2 = fe.length, oe = 0, de = 0, ye = -1, Te = 0;
          if (arguments.length === 1) for (; ++ye < J2; ) m(U2 = v(fe[ye])) && (de += (G2 = U2 - oe) * (U2 - (oe += G2 / ++Te)));
          else for (; ++ye < J2; ) m(U2 = v(P2.call(fe, fe[ye], ye))) && (de += (G2 = U2 - oe) * (U2 - (oe += G2 / ++Te)));
          if (Te > 1) return de / (Te - 1);
        }, n.deviation = function() {
          var fe = n.variance.apply(this, arguments);
          return fe && Math.sqrt(fe);
        };
        var x = g(d);
        function b(fe) {
          return fe.length;
        }
        n.bisectLeft = x.left, n.bisect = n.bisectRight = x.right, n.bisector = function(fe) {
          return g(fe.length === 1 ? function(P2, U2) {
            return d(fe(P2), U2);
          } : fe);
        }, n.shuffle = function(fe, P2, U2) {
          (oe = arguments.length) < 3 && (U2 = fe.length, oe < 2 && (P2 = 0));
          for (var G2, J2, oe = U2 - P2; oe; ) J2 = Math.random() * oe-- | 0, G2 = fe[oe + P2], fe[oe + P2] = fe[J2 + P2], fe[J2 + P2] = G2;
          return fe;
        }, n.permute = function(fe, P2) {
          for (var U2 = P2.length, G2 = new Array(U2); U2--; ) G2[U2] = fe[P2[U2]];
          return G2;
        }, n.pairs = function(fe) {
          for (var P2 = 0, U2 = fe.length - 1, G2 = fe[0], J2 = new Array(U2 < 0 ? 0 : U2); P2 < U2; ) J2[P2] = [G2, G2 = fe[++P2]];
          return J2;
        }, n.transpose = function(fe) {
          if (!(J2 = fe.length)) return [];
          for (var P2 = -1, U2 = n.min(fe, b), G2 = new Array(U2); ++P2 < U2; ) for (var J2, oe = -1, de = G2[P2] = new Array(J2); ++oe < J2; ) de[oe] = fe[oe][P2];
          return G2;
        }, n.zip = function() {
          return n.transpose(arguments);
        }, n.keys = function(fe) {
          var P2 = [];
          for (var U2 in fe) P2.push(U2);
          return P2;
        }, n.values = function(fe) {
          var P2 = [];
          for (var U2 in fe) P2.push(fe[U2]);
          return P2;
        }, n.entries = function(fe) {
          var P2 = [];
          for (var U2 in fe) P2.push({ key: U2, value: fe[U2] });
          return P2;
        }, n.merge = function(fe) {
          for (var P2, U2, G2, J2 = fe.length, oe = -1, de = 0; ++oe < J2; ) de += fe[oe].length;
          for (U2 = new Array(de); --J2 >= 0; ) for (P2 = (G2 = fe[J2]).length; --P2 >= 0; ) U2[--de] = G2[P2];
          return U2;
        };
        var y = Math.abs;
        function w(fe) {
          for (var P2 = 1; fe * P2 % 1; ) P2 *= 10;
          return P2;
        }
        function _4(fe, P2) {
          for (var U2 in P2) Object.defineProperty(fe.prototype, U2, { value: P2[U2], enumerable: false });
        }
        function k() {
          this._ = /* @__PURE__ */ Object.create(null);
        }
        n.range = function(fe, P2, U2) {
          if (arguments.length < 3 && (U2 = 1, arguments.length < 2 && (P2 = fe, fe = 0)), (P2 - fe) / U2 == 1 / 0) throw new Error("infinite range");
          var G2, J2 = [], oe = w(y(U2)), de = -1;
          if (fe *= oe, P2 *= oe, (U2 *= oe) < 0) for (; (G2 = fe + U2 * ++de) > P2; ) J2.push(G2 / oe);
          else for (; (G2 = fe + U2 * ++de) < P2; ) J2.push(G2 / oe);
          return J2;
        }, n.map = function(fe, P2) {
          var U2 = new k();
          if (fe instanceof k) fe.forEach(function(ye, Te) {
            U2.set(ye, Te);
          });
          else if (Array.isArray(fe)) {
            var G2, J2 = -1, oe = fe.length;
            if (arguments.length === 1) for (; ++J2 < oe; ) U2.set(J2, fe[J2]);
            else for (; ++J2 < oe; ) U2.set(P2.call(fe, G2 = fe[J2], J2), G2);
          } else for (var de in fe) U2.set(de, fe[de]);
          return U2;
        };
        function T2(fe) {
          return (fe += "") == "__proto__" || fe[0] === "\0" ? "\0" + fe : fe;
        }
        function A2(fe) {
          return (fe += "")[0] === "\0" ? fe.slice(1) : fe;
        }
        function S2(fe) {
          return T2(fe) in this._;
        }
        function C2(fe) {
          return (fe = T2(fe)) in this._ && delete this._[fe];
        }
        function E2() {
          var fe = [];
          for (var P2 in this._) fe.push(A2(P2));
          return fe;
        }
        function F13() {
          var fe = 0;
          for (var P2 in this._) ++fe;
          return fe;
        }
        function N2() {
          for (var fe in this._) return false;
          return true;
        }
        function D2() {
          this._ = /* @__PURE__ */ Object.create(null);
        }
        function I2(fe) {
          return fe;
        }
        function O2(fe, P2, U2) {
          return function() {
            var G2 = U2.apply(P2, arguments);
            return G2 === P2 ? fe : G2;
          };
        }
        function L2(fe, P2) {
          if (P2 in fe) return P2;
          P2 = P2.charAt(0).toUpperCase() + P2.slice(1);
          for (var U2 = 0, G2 = V2.length; U2 < G2; ++U2) {
            var J2 = V2[U2] + P2;
            if (J2 in fe) return J2;
          }
        }
        _4(k, { has: S2, get: function(fe) {
          return this._[T2(fe)];
        }, set: function(fe, P2) {
          return this._[T2(fe)] = P2;
        }, remove: C2, keys: E2, values: function() {
          var fe = [];
          for (var P2 in this._) fe.push(this._[P2]);
          return fe;
        }, entries: function() {
          var fe = [];
          for (var P2 in this._) fe.push({ key: A2(P2), value: this._[P2] });
          return fe;
        }, size: F13, empty: N2, forEach: function(fe) {
          for (var P2 in this._) fe.call(this, A2(P2), this._[P2]);
        } }), n.nest = function() {
          var fe, P2, U2 = {}, G2 = [], J2 = [];
          function oe(de, ye, Te) {
            if (Te >= G2.length) return P2 ? P2.call(U2, ye) : fe ? ye.sort(fe) : ye;
            for (var Fe, et, lt, bt, It = -1, Rt = ye.length, Ft = G2[Te++], Pt = new k(); ++It < Rt; ) (bt = Pt.get(Fe = Ft(et = ye[It]))) ? bt.push(et) : Pt.set(Fe, [et]);
            return de ? (et = de(), lt = function(Mt, qt) {
              et.set(Mt, oe(de, qt, Te));
            }) : (et = {}, lt = function(Mt, qt) {
              et[Mt] = oe(de, qt, Te);
            }), Pt.forEach(lt), et;
          }
          return U2.map = function(de, ye) {
            return oe(ye, de, 0);
          }, U2.entries = function(de) {
            return function ye(Te, Fe) {
              if (Fe >= G2.length) return Te;
              var et = [], lt = J2[Fe++];
              return Te.forEach(function(bt, It) {
                et.push({ key: bt, values: ye(It, Fe) });
              }), lt ? et.sort(function(bt, It) {
                return lt(bt.key, It.key);
              }) : et;
            }(oe(n.map, de, 0), 0);
          }, U2.key = function(de) {
            return G2.push(de), U2;
          }, U2.sortKeys = function(de) {
            return J2[G2.length - 1] = de, U2;
          }, U2.sortValues = function(de) {
            return fe = de, U2;
          }, U2.rollup = function(de) {
            return P2 = de, U2;
          }, U2;
        }, n.set = function(fe) {
          var P2 = new D2();
          if (fe) for (var U2 = 0, G2 = fe.length; U2 < G2; ++U2) P2.add(fe[U2]);
          return P2;
        }, _4(D2, { has: S2, add: function(fe) {
          return this._[T2(fe += "")] = true, fe;
        }, remove: C2, values: E2, size: F13, empty: N2, forEach: function(fe) {
          for (var P2 in this._) fe.call(this, A2(P2));
        } }), n.behavior = {}, n.rebind = function(fe, P2) {
          for (var U2, G2 = 1, J2 = arguments.length; ++G2 < J2; ) fe[U2 = arguments[G2]] = O2(fe, P2, P2[U2]);
          return fe;
        };
        var V2 = ["webkit", "ms", "moz", "Moz", "o", "O"];
        function W2() {
        }
        function X2() {
        }
        function Y2(fe) {
          var P2 = [], U2 = new k();
          function G2() {
            for (var J2, oe = P2, de = -1, ye = oe.length; ++de < ye; ) (J2 = oe[de].on) && J2.apply(this, arguments);
            return fe;
          }
          return G2.on = function(J2, oe) {
            var de, ye = U2.get(J2);
            return arguments.length < 2 ? ye && ye.on : (ye && (ye.on = null, P2 = P2.slice(0, de = P2.indexOf(ye)).concat(P2.slice(de + 1)), U2.remove(J2)), oe && P2.push(U2.set(J2, { on: oe })), fe);
          }, G2;
        }
        function K2() {
          n.event.preventDefault();
        }
        function q() {
          for (var fe, P2 = n.event; fe = P2.sourceEvent; ) P2 = fe;
          return P2;
        }
        function re(fe) {
          for (var P2 = new X2(), U2 = 0, G2 = arguments.length; ++U2 < G2; ) P2[arguments[U2]] = Y2(P2);
          return P2.of = function(J2, oe) {
            return function(de) {
              try {
                var ye = de.sourceEvent = n.event;
                de.target = fe, n.event = de, P2[de.type].apply(J2, oe);
              } finally {
                n.event = ye;
              }
            };
          }, P2;
        }
        n.dispatch = function() {
          for (var fe = new X2(), P2 = -1, U2 = arguments.length; ++P2 < U2; ) fe[arguments[P2]] = Y2(fe);
          return fe;
        }, X2.prototype.on = function(fe, P2) {
          var U2 = fe.indexOf("."), G2 = "";
          if (U2 >= 0 && (G2 = fe.slice(U2 + 1), fe = fe.slice(0, U2)), fe) return arguments.length < 2 ? this[fe].on(G2) : this[fe].on(G2, P2);
          if (arguments.length === 2) {
            if (P2 == null) for (fe in this) this.hasOwnProperty(fe) && this[fe].on(G2, null);
            return this;
          }
        }, n.event = null, n.requote = function(fe) {
          return fe.replace(R2, "\\$&");
        };
        var R2 = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g, z = {}.__proto__ ? function(fe, P2) {
          fe.__proto__ = P2;
        } : function(fe, P2) {
          for (var U2 in P2) fe[U2] = P2[U2];
        };
        function H2(fe) {
          return z(fe, Z2), fe;
        }
        var te = function(fe, P2) {
          return P2.querySelector(fe);
        }, j = function(fe, P2) {
          return P2.querySelectorAll(fe);
        }, Q2 = function(fe, P2) {
          var U2 = fe.matches || fe[L2(fe, "matchesSelector")];
          return (Q2 = function(G2, J2) {
            return U2.call(G2, J2);
          })(fe, P2);
        };
        typeof Sizzle == "function" && (te = function(fe, P2) {
          return Sizzle(fe, P2)[0] || null;
        }, j = Sizzle, Q2 = Sizzle.matchesSelector), n.selection = function() {
          return n.select(s.documentElement);
        };
        var Z2 = n.selection.prototype = [];
        function ne(fe) {
          return typeof fe == "function" ? fe : function() {
            return te(fe, this);
          };
        }
        function ae(fe) {
          return typeof fe == "function" ? fe : function() {
            return j(fe, this);
          };
        }
        Z2.select = function(fe) {
          var P2, U2, G2, J2, oe = [];
          fe = ne(fe);
          for (var de = -1, ye = this.length; ++de < ye; ) {
            oe.push(P2 = []), P2.parentNode = (G2 = this[de]).parentNode;
            for (var Te = -1, Fe = G2.length; ++Te < Fe; ) (J2 = G2[Te]) ? (P2.push(U2 = fe.call(J2, J2.__data__, Te, de)), U2 && "__data__" in J2 && (U2.__data__ = J2.__data__)) : P2.push(null);
          }
          return H2(oe);
        }, Z2.selectAll = function(fe) {
          var P2, U2, G2 = [];
          fe = ae(fe);
          for (var J2 = -1, oe = this.length; ++J2 < oe; ) for (var de = this[J2], ye = -1, Te = de.length; ++ye < Te; ) (U2 = de[ye]) && (G2.push(P2 = o(fe.call(U2, U2.__data__, ye, J2))), P2.parentNode = U2);
          return H2(G2);
        };
        var ue = "http://www.w3.org/1999/xhtml", le = { svg: "http://www.w3.org/2000/svg", xhtml: ue, xlink: "http://www.w3.org/1999/xlink", xml: "http://www.w3.org/XML/1998/namespace", xmlns: "http://www.w3.org/2000/xmlns/" };
        function ce(fe, P2) {
          return fe = n.ns.qualify(fe), P2 == null ? fe.local ? function() {
            this.removeAttributeNS(fe.space, fe.local);
          } : function() {
            this.removeAttribute(fe);
          } : typeof P2 == "function" ? fe.local ? function() {
            var U2 = P2.apply(this, arguments);
            U2 == null ? this.removeAttributeNS(fe.space, fe.local) : this.setAttributeNS(fe.space, fe.local, U2);
          } : function() {
            var U2 = P2.apply(this, arguments);
            U2 == null ? this.removeAttribute(fe) : this.setAttribute(fe, U2);
          } : fe.local ? function() {
            this.setAttributeNS(fe.space, fe.local, P2);
          } : function() {
            this.setAttribute(fe, P2);
          };
        }
        function se(fe) {
          return fe.trim().replace(/\s+/g, " ");
        }
        function he(fe) {
          return new RegExp("(?:^|\\s+)" + n.requote(fe) + "(?:\\s+|$)", "g");
        }
        function me(fe) {
          return (fe + "").trim().split(/^|\s+/);
        }
        function we(fe, P2) {
          var U2 = (fe = me(fe).map(be)).length;
          return typeof P2 == "function" ? function() {
            for (var G2 = -1, J2 = P2.apply(this, arguments); ++G2 < U2; ) fe[G2](this, J2);
          } : function() {
            for (var G2 = -1; ++G2 < U2; ) fe[G2](this, P2);
          };
        }
        function be(fe) {
          var P2 = he(fe);
          return function(U2, G2) {
            if (J2 = U2.classList) return G2 ? J2.add(fe) : J2.remove(fe);
            var J2 = U2.getAttribute("class") || "";
            G2 ? (P2.lastIndex = 0, P2.test(J2) || U2.setAttribute("class", se(J2 + " " + fe))) : U2.setAttribute("class", se(J2.replace(P2, " ")));
          };
        }
        function Ae(fe, P2, U2) {
          return P2 == null ? function() {
            this.style.removeProperty(fe);
          } : typeof P2 == "function" ? function() {
            var G2 = P2.apply(this, arguments);
            G2 == null ? this.style.removeProperty(fe) : this.style.setProperty(fe, G2, U2);
          } : function() {
            this.style.setProperty(fe, P2, U2);
          };
        }
        function pe(fe, P2) {
          return P2 == null ? function() {
            delete this[fe];
          } : typeof P2 == "function" ? function() {
            var U2 = P2.apply(this, arguments);
            U2 == null ? delete this[fe] : this[fe] = U2;
          } : function() {
            this[fe] = P2;
          };
        }
        function ve(fe) {
          return typeof fe == "function" ? fe : (fe = n.ns.qualify(fe)).local ? function() {
            return this.ownerDocument.createElementNS(fe.space, fe.local);
          } : function() {
            var P2 = this.ownerDocument, U2 = this.namespaceURI;
            return U2 === ue && P2.documentElement.namespaceURI === ue ? P2.createElement(fe) : P2.createElementNS(U2, fe);
          };
        }
        function Ee() {
          var fe = this.parentNode;
          fe && fe.removeChild(this);
        }
        function Se(fe) {
          return { __data__: fe };
        }
        function Ce(fe) {
          return function() {
            return Q2(this, fe);
          };
        }
        function Be(fe) {
          return arguments.length || (fe = d), function(P2, U2) {
            return P2 && U2 ? fe(P2.__data__, U2.__data__) : !P2 - !U2;
          };
        }
        function Ue(fe, P2) {
          for (var U2 = 0, G2 = fe.length; U2 < G2; U2++) for (var J2, oe = fe[U2], de = 0, ye = oe.length; de < ye; de++) (J2 = oe[de]) && P2(J2, de, U2);
          return fe;
        }
        function Ke(fe) {
          return z(fe, ct), fe;
        }
        n.ns = { prefix: le, qualify: function(fe) {
          var P2 = fe.indexOf(":"), U2 = fe;
          return P2 >= 0 && (U2 = fe.slice(0, P2)) !== "xmlns" && (fe = fe.slice(P2 + 1)), le.hasOwnProperty(U2) ? { space: le[U2], local: fe } : fe;
        } }, Z2.attr = function(fe, P2) {
          if (arguments.length < 2) {
            if (typeof fe == "string") {
              var U2 = this.node();
              return (fe = n.ns.qualify(fe)).local ? U2.getAttributeNS(fe.space, fe.local) : U2.getAttribute(fe);
            }
            for (P2 in fe) this.each(ce(P2, fe[P2]));
            return this;
          }
          return this.each(ce(fe, P2));
        }, Z2.classed = function(fe, P2) {
          if (arguments.length < 2) {
            if (typeof fe == "string") {
              var U2 = this.node(), G2 = (fe = me(fe)).length, J2 = -1;
              if (P2 = U2.classList) {
                for (; ++J2 < G2; ) if (!P2.contains(fe[J2])) return false;
              } else for (P2 = U2.getAttribute("class"); ++J2 < G2; ) if (!he(fe[J2]).test(P2)) return false;
              return true;
            }
            for (P2 in fe) this.each(we(P2, fe[P2]));
            return this;
          }
          return this.each(we(fe, P2));
        }, Z2.style = function(fe, P2, U2) {
          var G2 = arguments.length;
          if (G2 < 3) {
            if (typeof fe != "string") {
              for (U2 in G2 < 2 && (P2 = ""), fe) this.each(Ae(U2, fe[U2], P2));
              return this;
            }
            if (G2 < 2) {
              var J2 = this.node();
              return l(J2).getComputedStyle(J2, null).getPropertyValue(fe);
            }
            U2 = "";
          }
          return this.each(Ae(fe, P2, U2));
        }, Z2.property = function(fe, P2) {
          if (arguments.length < 2) {
            if (typeof fe == "string") return this.node()[fe];
            for (P2 in fe) this.each(pe(P2, fe[P2]));
            return this;
          }
          return this.each(pe(fe, P2));
        }, Z2.text = function(fe) {
          return arguments.length ? this.each(typeof fe == "function" ? function() {
            var P2 = fe.apply(this, arguments);
            this.textContent = P2 ?? "";
          } : fe == null ? function() {
            this.textContent = "";
          } : function() {
            this.textContent = fe;
          }) : this.node().textContent;
        }, Z2.html = function(fe) {
          return arguments.length ? this.each(typeof fe == "function" ? function() {
            var P2 = fe.apply(this, arguments);
            this.innerHTML = P2 ?? "";
          } : fe == null ? function() {
            this.innerHTML = "";
          } : function() {
            this.innerHTML = fe;
          }) : this.node().innerHTML;
        }, Z2.append = function(fe) {
          return fe = ve(fe), this.select(function() {
            return this.appendChild(fe.apply(this, arguments));
          });
        }, Z2.insert = function(fe, P2) {
          return fe = ve(fe), P2 = ne(P2), this.select(function() {
            return this.insertBefore(fe.apply(this, arguments), P2.apply(this, arguments) || null);
          });
        }, Z2.remove = function() {
          return this.each(Ee);
        }, Z2.data = function(fe, P2) {
          var U2, G2, J2 = -1, oe = this.length;
          if (!arguments.length) {
            for (fe = new Array(oe = (U2 = this[0]).length); ++J2 < oe; ) (G2 = U2[J2]) && (fe[J2] = G2.__data__);
            return fe;
          }
          function de(et, lt) {
            var bt, It, Rt, Ft = et.length, Pt = lt.length, Mt = Math.min(Ft, Pt), qt = new Array(Pt), $t = new Array(Pt), Yt = new Array(Ft);
            if (P2) {
              var cr, kr = new k(), Pr = new Array(Ft);
              for (bt = -1; ++bt < Ft; ) (It = et[bt]) && (kr.has(cr = P2.call(It, It.__data__, bt)) ? Yt[bt] = It : kr.set(cr, It), Pr[bt] = cr);
              for (bt = -1; ++bt < Pt; ) (It = kr.get(cr = P2.call(lt, Rt = lt[bt], bt))) ? It !== true && (qt[bt] = It, It.__data__ = Rt) : $t[bt] = Se(Rt), kr.set(cr, true);
              for (bt = -1; ++bt < Ft; ) bt in Pr && kr.get(Pr[bt]) !== true && (Yt[bt] = et[bt]);
            } else {
              for (bt = -1; ++bt < Mt; ) It = et[bt], Rt = lt[bt], It ? (It.__data__ = Rt, qt[bt] = It) : $t[bt] = Se(Rt);
              for (; bt < Pt; ++bt) $t[bt] = Se(lt[bt]);
              for (; bt < Ft; ++bt) Yt[bt] = et[bt];
            }
            $t.update = qt, $t.parentNode = qt.parentNode = Yt.parentNode = et.parentNode, ye.push($t), Te.push(qt), Fe.push(Yt);
          }
          var ye = Ke([]), Te = H2([]), Fe = H2([]);
          if (typeof fe == "function") for (; ++J2 < oe; ) de(U2 = this[J2], fe.call(U2, U2.parentNode.__data__, J2));
          else for (; ++J2 < oe; ) de(U2 = this[J2], fe);
          return Te.enter = function() {
            return ye;
          }, Te.exit = function() {
            return Fe;
          }, Te;
        }, Z2.datum = function(fe) {
          return arguments.length ? this.property("__data__", fe) : this.property("__data__");
        }, Z2.filter = function(fe) {
          var P2, U2, G2, J2 = [];
          typeof fe != "function" && (fe = Ce(fe));
          for (var oe = 0, de = this.length; oe < de; oe++) {
            J2.push(P2 = []), P2.parentNode = (U2 = this[oe]).parentNode;
            for (var ye = 0, Te = U2.length; ye < Te; ye++) (G2 = U2[ye]) && fe.call(G2, G2.__data__, ye, oe) && P2.push(G2);
          }
          return H2(J2);
        }, Z2.order = function() {
          for (var fe = -1, P2 = this.length; ++fe < P2; ) for (var U2, G2 = this[fe], J2 = G2.length - 1, oe = G2[J2]; --J2 >= 0; ) (U2 = G2[J2]) && (oe && oe !== U2.nextSibling && oe.parentNode.insertBefore(U2, oe), oe = U2);
          return this;
        }, Z2.sort = function(fe) {
          fe = Be.apply(this, arguments);
          for (var P2 = -1, U2 = this.length; ++P2 < U2; ) this[P2].sort(fe);
          return this.order();
        }, Z2.each = function(fe) {
          return Ue(this, function(P2, U2, G2) {
            fe.call(P2, P2.__data__, U2, G2);
          });
        }, Z2.call = function(fe) {
          var P2 = o(arguments);
          return fe.apply(P2[0] = this, P2), this;
        }, Z2.empty = function() {
          return !this.node();
        }, Z2.node = function() {
          for (var fe = 0, P2 = this.length; fe < P2; fe++) for (var U2 = this[fe], G2 = 0, J2 = U2.length; G2 < J2; G2++) {
            var oe = U2[G2];
            if (oe) return oe;
          }
          return null;
        }, Z2.size = function() {
          var fe = 0;
          return Ue(this, function() {
            ++fe;
          }), fe;
        };
        var ct = [];
        function We(fe) {
          var P2, U2;
          return function(G2, J2, oe) {
            var de, ye = fe[oe].update, Te = ye.length;
            for (oe != U2 && (U2 = oe, P2 = 0), J2 >= P2 && (P2 = J2 + 1); !(de = ye[P2]) && ++P2 < Te; ) ;
            return de;
          };
        }
        function Ze(fe, P2, U2) {
          var G2 = "__on" + fe, J2 = fe.indexOf("."), oe = ot;
          J2 > 0 && (fe = fe.slice(0, J2));
          var de = it.get(fe);
          function ye() {
            var Te = this[G2];
            Te && (this.removeEventListener(fe, Te, Te.$), delete this[G2]);
          }
          return de && (fe = de, oe = mt), J2 ? P2 ? function() {
            var Te = oe(P2, o(arguments));
            ye.call(this), this.addEventListener(fe, this[G2] = Te, Te.$ = U2), Te._ = P2;
          } : ye : P2 ? W2 : function() {
            var Te, Fe = new RegExp("^__on([^.]+)" + n.requote(fe) + "$");
            for (var et in this) if (Te = et.match(Fe)) {
              var lt = this[et];
              this.removeEventListener(Te[1], lt, lt.$), delete this[et];
            }
          };
        }
        n.selection.enter = Ke, n.selection.enter.prototype = ct, ct.append = Z2.append, ct.empty = Z2.empty, ct.node = Z2.node, ct.call = Z2.call, ct.size = Z2.size, ct.select = function(fe) {
          for (var P2, U2, G2, J2, oe, de = [], ye = -1, Te = this.length; ++ye < Te; ) {
            G2 = (J2 = this[ye]).update, de.push(P2 = []), P2.parentNode = J2.parentNode;
            for (var Fe = -1, et = J2.length; ++Fe < et; ) (oe = J2[Fe]) ? (P2.push(G2[Fe] = U2 = fe.call(J2.parentNode, oe.__data__, Fe, ye)), U2.__data__ = oe.__data__) : P2.push(null);
          }
          return H2(de);
        }, ct.insert = function(fe, P2) {
          return arguments.length < 2 && (P2 = We(this)), Z2.insert.call(this, fe, P2);
        }, n.select = function(fe) {
          var P2;
          return typeof fe == "string" ? (P2 = [te(fe, s)]).parentNode = s.documentElement : (P2 = [fe]).parentNode = i(fe), H2([P2]);
        }, n.selectAll = function(fe) {
          var P2;
          return typeof fe == "string" ? (P2 = o(j(fe, s))).parentNode = s.documentElement : (P2 = o(fe)).parentNode = null, H2([P2]);
        }, Z2.on = function(fe, P2, U2) {
          var G2 = arguments.length;
          if (G2 < 3) {
            if (typeof fe != "string") {
              for (U2 in G2 < 2 && (P2 = false), fe) this.each(Ze(U2, fe[U2], P2));
              return this;
            }
            if (G2 < 2) return (G2 = this.node()["__on" + fe]) && G2._;
            U2 = false;
          }
          return this.each(Ze(fe, P2, U2));
        };
        var it = n.map({ mouseenter: "mouseover", mouseleave: "mouseout" });
        function ot(fe, P2) {
          return function(U2) {
            var G2 = n.event;
            n.event = U2, P2[0] = this.__data__;
            try {
              fe.apply(this, P2);
            } finally {
              n.event = G2;
            }
          };
        }
        function mt(fe, P2) {
          var U2 = ot(fe, P2);
          return function(G2) {
            var J2 = G2.relatedTarget;
            J2 && (J2 === this || 8 & J2.compareDocumentPosition(this)) || U2.call(this, G2);
          };
        }
        s && it.forEach(function(fe) {
          "on" + fe in s && it.remove(fe);
        });
        var wt, Et = 0;
        function zt(fe) {
          var P2 = ".dragsuppress-" + ++Et, U2 = "click" + P2, G2 = n.select(l(fe)).on("touchmove" + P2, K2).on("dragstart" + P2, K2).on("selectstart" + P2, K2);
          if (wt == null && (wt = !("onselectstart" in fe) && L2(fe.style, "userSelect")), wt) {
            var J2 = i(fe).style, oe = J2[wt];
            J2[wt] = "none";
          }
          return function(de) {
            if (G2.on(P2, null), wt && (J2[wt] = oe), de) {
              var ye = function() {
                G2.on(U2, null);
              };
              G2.on(U2, function() {
                K2(), ye();
              }, true), setTimeout(ye, 0);
            }
          };
        }
        n.mouse = function(fe) {
          return yt(fe, q());
        };
        var Nt = this.navigator && /WebKit/.test(this.navigator.userAgent) ? -1 : 0;
        function yt(fe, P2) {
          P2.changedTouches && (P2 = P2.changedTouches[0]);
          var U2 = fe.ownerSVGElement || fe;
          if (U2.createSVGPoint) {
            var G2 = U2.createSVGPoint();
            if (Nt < 0) {
              var J2 = l(fe);
              if (J2.scrollX || J2.scrollY) {
                var oe = (U2 = n.select("body").append("svg").style({ position: "absolute", top: 0, left: 0, margin: 0, padding: 0, border: "none" }, "important"))[0][0].getScreenCTM();
                Nt = !(oe.f || oe.e), U2.remove();
              }
            }
            return Nt ? (G2.x = P2.pageX, G2.y = P2.pageY) : (G2.x = P2.clientX, G2.y = P2.clientY), [(G2 = G2.matrixTransform(fe.getScreenCTM().inverse())).x, G2.y];
          }
          var de = fe.getBoundingClientRect();
          return [P2.clientX - de.left - fe.clientLeft, P2.clientY - de.top - fe.clientTop];
        }
        function pt() {
          return n.event.changedTouches[0].identifier;
        }
        n.touch = function(fe, P2, U2) {
          if (arguments.length < 3 && (U2 = P2, P2 = q().changedTouches), P2) {
            for (var G2, J2 = 0, oe = P2.length; J2 < oe; ++J2) if ((G2 = P2[J2]).identifier === U2) return yt(fe, G2);
          }
        }, n.behavior.drag = function() {
          var fe = re(J2, "drag", "dragstart", "dragend"), P2 = null, U2 = oe(W2, n.mouse, l, "mousemove", "mouseup"), G2 = oe(pt, n.touch, I2, "touchmove", "touchend");
          function J2() {
            this.on("mousedown.drag", U2).on("touchstart.drag", G2);
          }
          function oe(de, ye, Te, Fe, et) {
            return function() {
              var lt, bt = this, It = n.event.target.correspondingElement || n.event.target, Rt = bt.parentNode, Ft = fe.of(bt, arguments), Pt = 0, Mt = de(), qt = ".drag" + (Mt == null ? "" : "-" + Mt), $t = n.select(Te(It)).on(Fe + qt, kr).on(et + qt, Pr), Yt = zt(It), cr = ye(Rt, Mt);
              function kr() {
                var Or, xn, yn = ye(Rt, Mt);
                yn && (Or = yn[0] - cr[0], xn = yn[1] - cr[1], Pt |= Or | xn, cr = yn, Ft({ type: "drag", x: yn[0] + lt[0], y: yn[1] + lt[1], dx: Or, dy: xn }));
              }
              function Pr() {
                ye(Rt, Mt) && ($t.on(Fe + qt, null).on(et + qt, null), Yt(Pt), Ft({ type: "dragend" }));
              }
              lt = P2 ? [(lt = P2.apply(bt, arguments)).x - cr[0], lt.y - cr[1]] : [0, 0], Ft({ type: "dragstart" });
            };
          }
          return J2.origin = function(de) {
            return arguments.length ? (P2 = de, J2) : P2;
          }, n.rebind(J2, fe, "on");
        }, n.touches = function(fe, P2) {
          return arguments.length < 2 && (P2 = q().touches), P2 ? o(P2).map(function(U2) {
            var G2 = yt(fe, U2);
            return G2.identifier = U2.identifier, G2;
          }) : [];
        };
        var Ot = 1e-6, Jt = Math.PI, tr = 2 * Jt, Ye = tr - Ot, at = Jt / 2, Ge = Jt / 180, st = 180 / Jt;
        function Ie(fe) {
          return fe > 1 ? at : fe < -1 ? -at : Math.asin(fe);
        }
        function Pe(fe) {
          return ((fe = Math.exp(fe)) + 1 / fe) / 2;
        }
        var $e = Math.SQRT2;
        n.interpolateZoom = function(fe, P2) {
          var U2, G2, J2 = fe[0], oe = fe[1], de = fe[2], ye = P2[0], Te = P2[1], Fe = P2[2], et = ye - J2, lt = Te - oe, bt = et * et + lt * lt;
          if (bt < 1e-12) G2 = Math.log(Fe / de) / $e, U2 = function(qt) {
            return [J2 + qt * et, oe + qt * lt, de * Math.exp($e * qt * G2)];
          };
          else {
            var It = Math.sqrt(bt), Rt = (Fe * Fe - de * de + 4 * bt) / (2 * de * 2 * It), Ft = (Fe * Fe - de * de - 4 * bt) / (2 * Fe * 2 * It), Pt = Math.log(Math.sqrt(Rt * Rt + 1) - Rt), Mt = Math.log(Math.sqrt(Ft * Ft + 1) - Ft);
            G2 = (Mt - Pt) / $e, U2 = function(qt) {
              var $t, Yt = qt * G2, cr = Pe(Pt), kr = de / (2 * It) * (cr * ($t = $e * Yt + Pt, (($t = Math.exp(2 * $t)) - 1) / ($t + 1)) - function(Pr) {
                return ((Pr = Math.exp(Pr)) - 1 / Pr) / 2;
              }(Pt));
              return [J2 + kr * et, oe + kr * lt, de * cr / Pe($e * Yt + Pt)];
            };
          }
          return U2.duration = 1e3 * G2, U2;
        }, n.behavior.zoom = function() {
          var fe, P2, U2, G2, J2, oe, de, ye, Te, Fe = { x: 0, y: 0, k: 1 }, et = [960, 500], lt = Re, bt = 250, It = 0, Rt = "mousedown.zoom", Ft = "mousemove.zoom", Pt = "mouseup.zoom", Mt = "touchstart.zoom", qt = re($t, "zoomstart", "zoom", "zoomend");
          function $t(ln) {
            ln.on(Rt, An).on(ut + ".zoom", Aa).on("dblclick.zoom", Qa).on(Mt, ma);
          }
          function Yt(ln) {
            return [(ln[0] - Fe.x) / Fe.k, (ln[1] - Fe.y) / Fe.k];
          }
          function cr(ln) {
            Fe.k = Math.max(lt[0], Math.min(lt[1], ln));
          }
          function kr(ln, qn) {
            qn = function(Sa) {
              return [Sa[0] * Fe.k + Fe.x, Sa[1] * Fe.k + Fe.y];
            }(qn), Fe.x += ln[0] - qn[0], Fe.y += ln[1] - qn[1];
          }
          function Pr(ln, qn, Sa, _a) {
            ln.__chart__ = { x: Fe.x, y: Fe.y, k: Fe.k }, cr(Math.pow(2, _a)), kr(P2 = qn, Sa), ln = n.select(ln), bt > 0 && (ln = ln.transition().duration(bt)), ln.call($t.event);
          }
          function Or() {
            de && de.domain(oe.range().map(function(ln) {
              return (ln - Fe.x) / Fe.k;
            }).map(oe.invert)), Te && Te.domain(ye.range().map(function(ln) {
              return (ln - Fe.y) / Fe.k;
            }).map(ye.invert));
          }
          function xn(ln) {
            It++ || ln({ type: "zoomstart" });
          }
          function yn(ln) {
            Or(), ln({ type: "zoom", scale: Fe.k, translate: [Fe.x, Fe.y] });
          }
          function Nn(ln) {
            --It || (ln({ type: "zoomend" }), P2 = null);
          }
          function An() {
            var ln = this, qn = qt.of(ln, arguments), Sa = 0, _a = n.select(l(ln)).on(Ft, Oi).on(Pt, Da), Pa = Yt(n.mouse(ln)), ii = zt(ln);
            function Oi() {
              Sa = 1, kr(n.mouse(ln), Pa), yn(qn);
            }
            function Da() {
              _a.on(Ft, null).on(Pt, null), ii(Sa), Nn(qn);
            }
            Lp.call(ln), xn(qn);
          }
          function ma() {
            var ln, qn = this, Sa = qt.of(qn, arguments), _a = {}, Pa = 0, ii = ".zoom-" + n.event.changedTouches[0].identifier, Oi = "touchmove" + ii, Da = "touchend" + ii, wi = [], di = n.select(qn), ji = zt(qn);
            function ki() {
              var js = n.touches(qn);
              return ln = Fe.k, js.forEach(function(Ws) {
                Ws.identifier in _a && (_a[Ws.identifier] = Yt(Ws));
              }), js;
            }
            function Wi() {
              var js = n.event.target;
              n.select(js).on(Oi, to).on(Da, as), wi.push(js);
              for (var Ws = n.event.changedTouches, Qo = 0, Cs = Ws.length; Qo < Cs; ++Qo) _a[Ws[Qo].identifier] = null;
              var us = ki(), ku = Date.now();
              if (us.length === 1) {
                if (ku - J2 < 500) {
                  var El = us[0];
                  Pr(qn, El, _a[El.identifier], Math.floor(Math.log(Fe.k) / Math.LN2) + 1), K2();
                }
                J2 = ku;
              } else if (us.length > 1) {
                El = us[0];
                var _c = us[1], Jh = El[0] - _c[0], Id = El[1] - _c[1];
                Pa = Jh * Jh + Id * Id;
              }
            }
            function to() {
              var js, Ws, Qo, Cs, us = n.touches(qn);
              Lp.call(qn);
              for (var ku = 0, El = us.length; ku < El; ++ku, Cs = null) if (Qo = us[ku], Cs = _a[Qo.identifier]) {
                if (Ws) break;
                js = Qo, Ws = Cs;
              }
              if (Cs) {
                var _c = (_c = Qo[0] - js[0]) * _c + (_c = Qo[1] - js[1]) * _c, Jh = Pa && Math.sqrt(_c / Pa);
                js = [(js[0] + Qo[0]) / 2, (js[1] + Qo[1]) / 2], Ws = [(Ws[0] + Cs[0]) / 2, (Ws[1] + Cs[1]) / 2], cr(Jh * ln);
              }
              J2 = null, kr(js, Ws), yn(Sa);
            }
            function as() {
              if (n.event.touches.length) {
                for (var js = n.event.changedTouches, Ws = 0, Qo = js.length; Ws < Qo; ++Ws) delete _a[js[Ws].identifier];
                for (var Cs in _a) return void ki();
              }
              n.selectAll(wi).on(ii, null), di.on(Rt, An).on(Mt, ma), ji(), Nn(Sa);
            }
            Wi(), xn(Sa), di.on(Rt, null).on(Mt, Wi);
          }
          function Aa() {
            var ln = qt.of(this, arguments);
            G2 ? clearTimeout(G2) : (Lp.call(this), fe = Yt(P2 = U2 || n.mouse(this)), xn(ln)), G2 = setTimeout(function() {
              G2 = null, Nn(ln);
            }, 50), K2(), cr(Math.pow(2, 2e-3 * Ve()) * Fe.k), kr(P2, fe), yn(ln);
          }
          function Qa() {
            var ln = n.mouse(this), qn = Math.log(Fe.k) / Math.LN2;
            Pr(this, ln, Yt(ln), n.event.shiftKey ? Math.ceil(qn) - 1 : Math.floor(qn) + 1);
          }
          return ut || (ut = "onwheel" in s ? (Ve = function() {
            return -n.event.deltaY * (n.event.deltaMode ? 120 : 1);
          }, "wheel") : "onmousewheel" in s ? (Ve = function() {
            return n.event.wheelDelta;
          }, "mousewheel") : (Ve = function() {
            return -n.event.detail;
          }, "MozMousePixelScroll")), $t.event = function(ln) {
            ln.each(function() {
              var qn = qt.of(this, arguments), Sa = Fe;
              wh ? n.select(this).transition().each("start.zoom", function() {
                Fe = this.__chart__ || { x: 0, y: 0, k: 1 }, xn(qn);
              }).tween("zoom:zoom", function() {
                var _a = et[0], Pa = et[1], ii = P2 ? P2[0] : _a / 2, Oi = P2 ? P2[1] : Pa / 2, Da = n.interpolateZoom([(ii - Fe.x) / Fe.k, (Oi - Fe.y) / Fe.k, _a / Fe.k], [(ii - Sa.x) / Sa.k, (Oi - Sa.y) / Sa.k, _a / Sa.k]);
                return function(wi) {
                  var di = Da(wi), ji = _a / di[2];
                  this.__chart__ = Fe = { x: ii - di[0] * ji, y: Oi - di[1] * ji, k: ji }, yn(qn);
                };
              }).each("interrupt.zoom", function() {
                Nn(qn);
              }).each("end.zoom", function() {
                Nn(qn);
              }) : (this.__chart__ = Fe, xn(qn), yn(qn), Nn(qn));
            });
          }, $t.translate = function(ln) {
            return arguments.length ? (Fe = { x: +ln[0], y: +ln[1], k: Fe.k }, Or(), $t) : [Fe.x, Fe.y];
          }, $t.scale = function(ln) {
            return arguments.length ? (Fe = { x: Fe.x, y: Fe.y, k: null }, cr(+ln), Or(), $t) : Fe.k;
          }, $t.scaleExtent = function(ln) {
            return arguments.length ? (lt = ln == null ? Re : [+ln[0], +ln[1]], $t) : lt;
          }, $t.center = function(ln) {
            return arguments.length ? (U2 = ln && [+ln[0], +ln[1]], $t) : U2;
          }, $t.size = function(ln) {
            return arguments.length ? (et = ln && [+ln[0], +ln[1]], $t) : et;
          }, $t.duration = function(ln) {
            return arguments.length ? (bt = +ln, $t) : bt;
          }, $t.x = function(ln) {
            return arguments.length ? (de = ln, oe = ln.copy(), Fe = { x: 0, y: 0, k: 1 }, $t) : de;
          }, $t.y = function(ln) {
            return arguments.length ? (Te = ln, ye = ln.copy(), Fe = { x: 0, y: 0, k: 1 }, $t) : Te;
          }, n.rebind($t, qt, "on");
        };
        var Ve, ut, Re = [0, 1 / 0];
        function qe() {
        }
        function je(fe, P2, U2) {
          return this instanceof je ? (this.h = +fe, this.s = +P2, void (this.l = +U2)) : arguments.length < 2 ? fe instanceof je ? new je(fe.h, fe.s, fe.l) : Tr("" + fe, yr, je) : new je(fe, P2, U2);
        }
        n.color = qe, qe.prototype.toString = function() {
          return this.rgb() + "";
        }, n.hsl = je;
        var rt = je.prototype = new qe();
        function He(fe, P2, U2) {
          var G2, J2;
          function oe(de) {
            return Math.round(255 * function(ye) {
              return ye > 360 ? ye -= 360 : ye < 0 && (ye += 360), ye < 60 ? G2 + (J2 - G2) * ye / 60 : ye < 180 ? J2 : ye < 240 ? G2 + (J2 - G2) * (240 - ye) / 60 : G2;
            }(de));
          }
          return fe = isNaN(fe) ? 0 : (fe %= 360) < 0 ? fe + 360 : fe, P2 = isNaN(P2) || P2 < 0 ? 0 : P2 > 1 ? 1 : P2, G2 = 2 * (U2 = U2 < 0 ? 0 : U2 > 1 ? 1 : U2) - (J2 = U2 <= 0.5 ? U2 * (1 + P2) : U2 + P2 - U2 * P2), new kt(oe(fe + 120), oe(fe), oe(fe - 120));
        }
        function xe(fe, P2, U2) {
          return this instanceof xe ? (this.h = +fe, this.c = +P2, void (this.l = +U2)) : arguments.length < 2 ? fe instanceof xe ? new xe(fe.h, fe.c, fe.l) : De(fe instanceof Me ? fe.l : (fe = pr((fe = n.rgb(fe)).r, fe.g, fe.b)).l, fe.a, fe.b) : new xe(fe, P2, U2);
        }
        rt.brighter = function(fe) {
          return fe = Math.pow(0.7, arguments.length ? fe : 1), new je(this.h, this.s, this.l / fe);
        }, rt.darker = function(fe) {
          return fe = Math.pow(0.7, arguments.length ? fe : 1), new je(this.h, this.s, fe * this.l);
        }, rt.rgb = function() {
          return He(this.h, this.s, this.l);
        }, n.hcl = xe;
        var Ne = xe.prototype = new qe();
        function ke(fe, P2, U2) {
          return isNaN(fe) && (fe = 0), isNaN(P2) && (P2 = 0), new Me(U2, Math.cos(fe *= Ge) * P2, Math.sin(fe) * P2);
        }
        function Me(fe, P2, U2) {
          return this instanceof Me ? (this.l = +fe, this.a = +P2, void (this.b = +U2)) : arguments.length < 2 ? fe instanceof Me ? new Me(fe.l, fe.a, fe.b) : fe instanceof xe ? ke(fe.h, fe.c, fe.l) : pr((fe = kt(fe)).r, fe.g, fe.b) : new Me(fe, P2, U2);
        }
        Ne.brighter = function(fe) {
          return new xe(this.h, this.c, Math.min(100, this.l + Le * (arguments.length ? fe : 1)));
        }, Ne.darker = function(fe) {
          return new xe(this.h, this.c, Math.max(0, this.l - Le * (arguments.length ? fe : 1)));
        }, Ne.rgb = function() {
          return ke(this.h, this.c, this.l).rgb();
        }, n.lab = Me;
        var Le = 18, ze = Me.prototype = new qe();
        function ft(fe, P2, U2) {
          var G2 = (fe + 16) / 116, J2 = G2 + P2 / 500, oe = G2 - U2 / 200;
          return new kt(vt(3.2404542 * (J2 = 0.95047 * Je(J2)) - 1.5371385 * (G2 = 1 * Je(G2)) - 0.4985314 * (oe = 1.08883 * Je(oe))), vt(-0.969266 * J2 + 1.8760108 * G2 + 0.041556 * oe), vt(0.0556434 * J2 - 0.2040259 * G2 + 1.0572252 * oe));
        }
        function De(fe, P2, U2) {
          return fe > 0 ? new xe(Math.atan2(U2, P2) * st, Math.sqrt(P2 * P2 + U2 * U2), fe) : new xe(NaN, NaN, fe);
        }
        function Je(fe) {
          return fe > 0.206893034 ? fe * fe * fe : (fe - 4 / 29) / 7.787037;
        }
        function tt(fe) {
          return fe > 8856e-6 ? Math.pow(fe, 1 / 3) : 7.787037 * fe + 4 / 29;
        }
        function vt(fe) {
          return Math.round(255 * (fe <= 304e-5 ? 12.92 * fe : 1.055 * Math.pow(fe, 1 / 2.4) - 0.055));
        }
        function kt(fe, P2, U2) {
          return this instanceof kt ? (this.r = ~~fe, this.g = ~~P2, void (this.b = ~~U2)) : arguments.length < 2 ? fe instanceof kt ? new kt(fe.r, fe.g, fe.b) : Tr("" + fe, kt, He) : new kt(fe, P2, U2);
        }
        function jt(fe) {
          return new kt(fe >> 16, fe >> 8 & 255, 255 & fe);
        }
        function Vt(fe) {
          return jt(fe) + "";
        }
        ze.brighter = function(fe) {
          return new Me(Math.min(100, this.l + Le * (arguments.length ? fe : 1)), this.a, this.b);
        }, ze.darker = function(fe) {
          return new Me(Math.max(0, this.l - Le * (arguments.length ? fe : 1)), this.a, this.b);
        }, ze.rgb = function() {
          return ft(this.l, this.a, this.b);
        }, n.rgb = kt;
        var Kt = kt.prototype = new qe();
        function rr(fe) {
          return fe < 16 ? "0" + Math.max(0, fe).toString(16) : Math.min(255, fe).toString(16);
        }
        function Tr(fe, P2, U2) {
          var G2, J2, oe, de = 0, ye = 0, Te = 0;
          if (G2 = /([a-z]+)\((.*)\)/.exec(fe = fe.toLowerCase())) switch (J2 = G2[2].split(","), G2[1]) {
            case "hsl":
              return U2(parseFloat(J2[0]), parseFloat(J2[1]) / 100, parseFloat(J2[2]) / 100);
            case "rgb":
              return P2(_r(J2[0]), _r(J2[1]), _r(J2[2]));
          }
          return (oe = $r.get(fe)) ? P2(oe.r, oe.g, oe.b) : (fe == null || fe.charAt(0) !== "#" || isNaN(oe = parseInt(fe.slice(1), 16)) || (fe.length === 4 ? (de = (3840 & oe) >> 4, de |= de >> 4, ye = 240 & oe, ye |= ye >> 4, Te = 15 & oe, Te |= Te << 4) : fe.length === 7 && (de = (16711680 & oe) >> 16, ye = (65280 & oe) >> 8, Te = 255 & oe)), P2(de, ye, Te));
        }
        function yr(fe, P2, U2) {
          var G2, J2, oe = Math.min(fe /= 255, P2 /= 255, U2 /= 255), de = Math.max(fe, P2, U2), ye = de - oe, Te = (de + oe) / 2;
          return ye ? (J2 = Te < 0.5 ? ye / (de + oe) : ye / (2 - de - oe), G2 = fe == de ? (P2 - U2) / ye + (P2 < U2 ? 6 : 0) : P2 == de ? (U2 - fe) / ye + 2 : (fe - P2) / ye + 4, G2 *= 60) : (G2 = NaN, J2 = Te > 0 && Te < 1 ? 0 : G2), new je(G2, J2, Te);
        }
        function pr(fe, P2, U2) {
          var G2 = tt((0.4124564 * (fe = lr(fe)) + 0.3575761 * (P2 = lr(P2)) + 0.1804375 * (U2 = lr(U2))) / 0.95047), J2 = tt((0.2126729 * fe + 0.7151522 * P2 + 0.072175 * U2) / 1);
          return Me(116 * J2 - 16, 500 * (G2 - J2), 200 * (J2 - tt((0.0193339 * fe + 0.119192 * P2 + 0.9503041 * U2) / 1.08883)));
        }
        function lr(fe) {
          return (fe /= 255) <= 0.04045 ? fe / 12.92 : Math.pow((fe + 0.055) / 1.055, 2.4);
        }
        function _r(fe) {
          var P2 = parseFloat(fe);
          return fe.charAt(fe.length - 1) === "%" ? Math.round(2.55 * P2) : P2;
        }
        Kt.brighter = function(fe) {
          fe = Math.pow(0.7, arguments.length ? fe : 1);
          var P2 = this.r, U2 = this.g, G2 = this.b, J2 = 30;
          return P2 || U2 || G2 ? (P2 && P2 < J2 && (P2 = J2), U2 && U2 < J2 && (U2 = J2), G2 && G2 < J2 && (G2 = J2), new kt(Math.min(255, P2 / fe), Math.min(255, U2 / fe), Math.min(255, G2 / fe))) : new kt(J2, J2, J2);
        }, Kt.darker = function(fe) {
          return new kt((fe = Math.pow(0.7, arguments.length ? fe : 1)) * this.r, fe * this.g, fe * this.b);
        }, Kt.hsl = function() {
          return yr(this.r, this.g, this.b);
        }, Kt.toString = function() {
          return "#" + rr(this.r) + rr(this.g) + rr(this.b);
        };
        var $r = n.map({ aliceblue: 15792383, antiquewhite: 16444375, aqua: 65535, aquamarine: 8388564, azure: 15794175, beige: 16119260, bisque: 16770244, black: 0, blanchedalmond: 16772045, blue: 255, blueviolet: 9055202, brown: 10824234, burlywood: 14596231, cadetblue: 6266528, chartreuse: 8388352, chocolate: 13789470, coral: 16744272, cornflowerblue: 6591981, cornsilk: 16775388, crimson: 14423100, cyan: 65535, darkblue: 139, darkcyan: 35723, darkgoldenrod: 12092939, darkgray: 11119017, darkgreen: 25600, darkgrey: 11119017, darkkhaki: 12433259, darkmagenta: 9109643, darkolivegreen: 5597999, darkorange: 16747520, darkorchid: 10040012, darkred: 9109504, darksalmon: 15308410, darkseagreen: 9419919, darkslateblue: 4734347, darkslategray: 3100495, darkslategrey: 3100495, darkturquoise: 52945, darkviolet: 9699539, deeppink: 16716947, deepskyblue: 49151, dimgray: 6908265, dimgrey: 6908265, dodgerblue: 2003199, firebrick: 11674146, floralwhite: 16775920, forestgreen: 2263842, fuchsia: 16711935, gainsboro: 14474460, ghostwhite: 16316671, gold: 16766720, goldenrod: 14329120, gray: 8421504, green: 32768, greenyellow: 11403055, grey: 8421504, honeydew: 15794160, hotpink: 16738740, indianred: 13458524, indigo: 4915330, ivory: 16777200, khaki: 15787660, lavender: 15132410, lavenderblush: 16773365, lawngreen: 8190976, lemonchiffon: 16775885, lightblue: 11393254, lightcoral: 15761536, lightcyan: 14745599, lightgoldenrodyellow: 16448210, lightgray: 13882323, lightgreen: 9498256, lightgrey: 13882323, lightpink: 16758465, lightsalmon: 16752762, lightseagreen: 2142890, lightskyblue: 8900346, lightslategray: 7833753, lightslategrey: 7833753, lightsteelblue: 11584734, lightyellow: 16777184, lime: 65280, limegreen: 3329330, linen: 16445670, magenta: 16711935, maroon: 8388608, mediumaquamarine: 6737322, mediumblue: 205, mediumorchid: 12211667, mediumpurple: 9662683, mediumseagreen: 3978097, mediumslateblue: 8087790, mediumspringgreen: 64154, mediumturquoise: 4772300, mediumvioletred: 13047173, midnightblue: 1644912, mintcream: 16121850, mistyrose: 16770273, moccasin: 16770229, navajowhite: 16768685, navy: 128, oldlace: 16643558, olive: 8421376, olivedrab: 7048739, orange: 16753920, orangered: 16729344, orchid: 14315734, palegoldenrod: 15657130, palegreen: 10025880, paleturquoise: 11529966, palevioletred: 14381203, papayawhip: 16773077, peachpuff: 16767673, peru: 13468991, pink: 16761035, plum: 14524637, powderblue: 11591910, purple: 8388736, rebeccapurple: 6697881, red: 16711680, rosybrown: 12357519, royalblue: 4286945, saddlebrown: 9127187, salmon: 16416882, sandybrown: 16032864, seagreen: 3050327, seashell: 16774638, sienna: 10506797, silver: 12632256, skyblue: 8900331, slateblue: 6970061, slategray: 7372944, slategrey: 7372944, snow: 16775930, springgreen: 65407, steelblue: 4620980, tan: 13808780, teal: 32896, thistle: 14204888, tomato: 16737095, turquoise: 4251856, violet: 15631086, wheat: 16113331, white: 16777215, whitesmoke: 16119285, yellow: 16776960, yellowgreen: 10145074 });
        function Ar(fe) {
          return typeof fe == "function" ? fe : function() {
            return fe;
          };
        }
        function Qr(fe) {
          return function(P2, U2, G2) {
            return arguments.length === 2 && typeof U2 == "function" && (G2 = U2, U2 = null), hn(P2, U2, fe, G2);
          };
        }
        function hn(fe, P2, U2, G2) {
          var J2 = {}, oe = n.dispatch("beforesend", "progress", "load", "error"), de = {}, ye = new XMLHttpRequest(), Te = null;
          function Fe() {
            var et, lt = ye.status;
            if (!lt && function(bt) {
              var It = bt.responseType;
              return It && It !== "text" ? bt.response : bt.responseText;
            }(ye) || lt >= 200 && lt < 300 || lt === 304) {
              try {
                et = U2.call(J2, ye);
              } catch (bt) {
                return void oe.error.call(J2, bt);
              }
              oe.load.call(J2, et);
            } else oe.error.call(J2, ye);
          }
          return self.XDomainRequest && !("withCredentials" in ye) && /^(http(s)?:)?\/\//.test(fe) && (ye = new XDomainRequest()), "onload" in ye ? ye.onload = ye.onerror = Fe : ye.onreadystatechange = function() {
            ye.readyState > 3 && Fe();
          }, ye.onprogress = function(et) {
            var lt = n.event;
            n.event = et;
            try {
              oe.progress.call(J2, ye);
            } finally {
              n.event = lt;
            }
          }, J2.header = function(et, lt) {
            return et = (et + "").toLowerCase(), arguments.length < 2 ? de[et] : (lt == null ? delete de[et] : de[et] = lt + "", J2);
          }, J2.mimeType = function(et) {
            return arguments.length ? (P2 = et == null ? null : et + "", J2) : P2;
          }, J2.responseType = function(et) {
            return arguments.length ? (Te = et, J2) : Te;
          }, J2.response = function(et) {
            return U2 = et, J2;
          }, ["get", "post"].forEach(function(et) {
            J2[et] = function() {
              return J2.send.apply(J2, [et].concat(o(arguments)));
            };
          }), J2.send = function(et, lt, bt) {
            if (arguments.length === 2 && typeof lt == "function" && (bt = lt, lt = null), ye.open(et, fe, true), P2 == null || "accept" in de || (de.accept = P2 + ",*/*"), ye.setRequestHeader) for (var It in de) ye.setRequestHeader(It, de[It]);
            return P2 != null && ye.overrideMimeType && ye.overrideMimeType(P2), Te != null && (ye.responseType = Te), bt != null && J2.on("error", bt).on("load", function(Rt) {
              bt(null, Rt);
            }), oe.beforesend.call(J2, ye), ye.send(lt ?? null), J2;
          }, J2.abort = function() {
            return ye.abort(), J2;
          }, n.rebind(J2, oe, "on"), G2 == null ? J2 : J2.get(function(et) {
            return et.length === 1 ? function(lt, bt) {
              et(lt == null ? bt : null);
            } : et;
          }(G2));
        }
        $r.forEach(function(fe, P2) {
          $r.set(fe, jt(P2));
        }), n.functor = Ar, n.xhr = Qr(I2), n.dsv = function(fe, P2) {
          var U2 = new RegExp('["' + fe + `
]`), G2 = fe.charCodeAt(0);
          function J2(Fe, et, lt) {
            arguments.length < 3 && (lt = et, et = null);
            var bt = hn(Fe, P2, et == null ? oe : de(et), lt);
            return bt.row = function(It) {
              return arguments.length ? bt.response((et = It) == null ? oe : de(It)) : et;
            }, bt;
          }
          function oe(Fe) {
            return J2.parse(Fe.responseText);
          }
          function de(Fe) {
            return function(et) {
              return J2.parse(et.responseText, Fe);
            };
          }
          function ye(Fe) {
            return Fe.map(Te).join(fe);
          }
          function Te(Fe) {
            return U2.test(Fe) ? '"' + Fe.replace(/\"/g, '""') + '"' : Fe;
          }
          return J2.parse = function(Fe, et) {
            var lt;
            return J2.parseRows(Fe, function(bt, It) {
              if (lt) return lt(bt, It - 1);
              var Rt = function(Ft) {
                for (var Pt = {}, Mt = bt.length, qt = 0; qt < Mt; ++qt) Pt[bt[qt]] = Ft[qt];
                return Pt;
              };
              lt = et ? function(Ft, Pt) {
                return et(Rt(Ft), Pt);
              } : Rt;
            });
          }, J2.parseRows = function(Fe, et) {
            var lt, bt, It = {}, Rt = {}, Ft = [], Pt = Fe.length, Mt = 0, qt = 0;
            function $t() {
              if (Mt >= Pt) return Rt;
              if (bt) return bt = false, It;
              var cr = Mt;
              if (Fe.charCodeAt(cr) === 34) {
                for (var kr = cr; kr++ < Pt; ) if (Fe.charCodeAt(kr) === 34) {
                  if (Fe.charCodeAt(kr + 1) !== 34) break;
                  ++kr;
                }
                return Mt = kr + 2, (Pr = Fe.charCodeAt(kr + 1)) === 13 ? (bt = true, Fe.charCodeAt(kr + 2) === 10 && ++Mt) : Pr === 10 && (bt = true), Fe.slice(cr + 1, kr).replace(/""/g, '"');
              }
              for (; Mt < Pt; ) {
                var Pr, Or = 1;
                if ((Pr = Fe.charCodeAt(Mt++)) === 10) bt = true;
                else if (Pr === 13) bt = true, Fe.charCodeAt(Mt) === 10 && (++Mt, ++Or);
                else if (Pr !== G2) continue;
                return Fe.slice(cr, Mt - Or);
              }
              return Fe.slice(cr);
            }
            for (; (lt = $t()) !== Rt; ) {
              for (var Yt = []; lt !== It && lt !== Rt; ) Yt.push(lt), lt = $t();
              et && (Yt = et(Yt, qt++)) == null || Ft.push(Yt);
            }
            return Ft;
          }, J2.format = function(Fe) {
            if (Array.isArray(Fe[0])) return J2.formatRows(Fe);
            var et = new D2(), lt = [];
            return Fe.forEach(function(bt) {
              for (var It in bt) et.has(It) || lt.push(et.add(It));
            }), [lt.map(Te).join(fe)].concat(Fe.map(function(bt) {
              return lt.map(function(It) {
                return Te(bt[It]);
              }).join(fe);
            })).join(`
`);
          }, J2.formatRows = function(Fe) {
            return Fe.map(ye).join(`
`);
          }, J2;
        }, n.csv = n.dsv(",", "text/csv"), n.tsv = n.dsv("	", "text/tab-separated-values");
        var wn, Yn, Xn, Wn, _n = this[L2(this, "requestAnimationFrame")] || function(fe) {
          setTimeout(fe, 17);
        };
        function qr(fe, P2, U2) {
          var G2 = arguments.length;
          G2 < 2 && (P2 = 0), G2 < 3 && (U2 = Date.now());
          var J2 = U2 + P2, oe = { c: fe, t: J2, n: null };
          return Yn ? Yn.n = oe : wn = oe, Yn = oe, Xn || (Wn = clearTimeout(Wn), Xn = 1, _n(Nr)), oe;
        }
        function Nr() {
          var fe = Zr(), P2 = oa() - fe;
          P2 > 24 ? (isFinite(P2) && (clearTimeout(Wn), Wn = setTimeout(Nr, P2)), Xn = 0) : (Xn = 1, _n(Nr));
        }
        function Zr() {
          for (var fe = Date.now(), P2 = wn; P2; ) fe >= P2.t && P2.c(fe - P2.t) && (P2.c = null), P2 = P2.n;
          return fe;
        }
        function oa() {
          for (var fe, P2 = wn, U2 = 1 / 0; P2; ) P2.c ? (P2.t < U2 && (U2 = P2.t), P2 = (fe = P2).n) : P2 = fe ? fe.n = P2.n : wn = P2.n;
          return Yn = fe, U2;
        }
        function tn(fe) {
          return fe[0];
        }
        function Zn(fe) {
          return fe[1];
        }
        function Ln(fe) {
          for (var P2, U2, G2, J2 = fe.length, oe = [0, 1], de = 2, ye = 2; ye < J2; ye++) {
            for (; de > 1 && (P2 = fe[oe[de - 2]], U2 = fe[oe[de - 1]], G2 = fe[ye], (U2[0] - P2[0]) * (G2[1] - P2[1]) - (U2[1] - P2[1]) * (G2[0] - P2[0]) <= 0); ) --de;
            oe[de++] = ye;
          }
          return oe.slice(0, de);
        }
        function gn(fe, P2) {
          return fe[0] - P2[0] || fe[1] - P2[1];
        }
        n.timer = function() {
          qr.apply(this, arguments);
        }, n.timer.flush = function() {
          Zr(), oa();
        }, n.round = function(fe, P2) {
          return P2 ? Math.round(fe * (P2 = Math.pow(10, P2))) / P2 : Math.round(fe);
        }, n.geom = {}, n.geom.hull = function(fe) {
          var P2 = tn, U2 = Zn;
          if (arguments.length) return G2(fe);
          function G2(J2) {
            if (J2.length < 3) return [];
            var oe, de = Ar(P2), ye = Ar(U2), Te = J2.length, Fe = [], et = [];
            for (oe = 0; oe < Te; oe++) Fe.push([+de.call(this, J2[oe], oe), +ye.call(this, J2[oe], oe), oe]);
            for (Fe.sort(gn), oe = 0; oe < Te; oe++) et.push([Fe[oe][0], -Fe[oe][1]]);
            var lt = Ln(Fe), bt = Ln(et), It = bt[0] === lt[0], Rt = bt[bt.length - 1] === lt[lt.length - 1], Ft = [];
            for (oe = lt.length - 1; oe >= 0; --oe) Ft.push(J2[Fe[lt[oe]][2]]);
            for (oe = +It; oe < bt.length - Rt; ++oe) Ft.push(J2[Fe[bt[oe]][2]]);
            return Ft;
          }
          return G2.x = function(J2) {
            return arguments.length ? (P2 = J2, G2) : P2;
          }, G2.y = function(J2) {
            return arguments.length ? (U2 = J2, G2) : U2;
          }, G2;
        }, n.geom.polygon = function(fe) {
          return z(fe, na), fe;
        };
        var na = n.geom.polygon.prototype = [];
        function sr(fe, P2, U2) {
          return (U2[0] - P2[0]) * (fe[1] - P2[1]) < (U2[1] - P2[1]) * (fe[0] - P2[0]);
        }
        function Ut(fe, P2, U2, G2) {
          var J2 = fe[0], oe = U2[0], de = P2[0] - J2, ye = G2[0] - oe, Te = fe[1], Fe = U2[1], et = P2[1] - Te, lt = G2[1] - Fe, bt = (ye * (Te - Fe) - lt * (J2 - oe)) / (lt * de - ye * et);
          return [J2 + bt * de, Te + bt * et];
        }
        function Zt(fe) {
          var P2 = fe[0], U2 = fe[fe.length - 1];
          return !(P2[0] - U2[0] || P2[1] - U2[1]);
        }
        na.area = function() {
          for (var fe, P2 = -1, U2 = this.length, G2 = this[U2 - 1], J2 = 0; ++P2 < U2; ) fe = G2, G2 = this[P2], J2 += fe[1] * G2[0] - fe[0] * G2[1];
          return 0.5 * J2;
        }, na.centroid = function(fe) {
          var P2, U2, G2 = -1, J2 = this.length, oe = 0, de = 0, ye = this[J2 - 1];
          for (arguments.length || (fe = -1 / (6 * this.area())); ++G2 < J2; ) P2 = ye, ye = this[G2], U2 = P2[0] * ye[1] - ye[0] * P2[1], oe += (P2[0] + ye[0]) * U2, de += (P2[1] + ye[1]) * U2;
          return [oe * fe, de * fe];
        }, na.clip = function(fe) {
          for (var P2, U2, G2, J2, oe, de, ye = Zt(fe), Te = -1, Fe = this.length - Zt(this), et = this[Fe - 1]; ++Te < Fe; ) {
            for (P2 = fe.slice(), fe.length = 0, J2 = this[Te], oe = P2[(G2 = P2.length - ye) - 1], U2 = -1; ++U2 < G2; ) sr(de = P2[U2], et, J2) ? (sr(oe, et, J2) || fe.push(Ut(oe, de, et, J2)), fe.push(de)) : sr(oe, et, J2) && fe.push(Ut(oe, de, et, J2)), oe = de;
            ye && fe.push(fe[0]), et = J2;
          }
          return fe;
        };
        var xr, Fr, pn, un, Ir, Cr = [], Lr = [];
        function jr() {
          Uo(this), this.edge = this.site = this.circle = null;
        }
        function Rr(fe) {
          var P2 = Cr.pop() || new jr();
          return P2.site = fe, P2;
        }
        function vn(fe) {
          Kn(fe), pn.remove(fe), Cr.push(fe), Uo(fe);
        }
        function Mn(fe) {
          var P2 = fe.circle, U2 = P2.x, G2 = P2.cy, J2 = { x: U2, y: G2 }, oe = fe.P, de = fe.N, ye = [fe];
          vn(fe);
          for (var Te = oe; Te.circle && y(U2 - Te.circle.x) < Ot && y(G2 - Te.circle.cy) < Ot; ) oe = Te.P, ye.unshift(Te), vn(Te), Te = oe;
          ye.unshift(Te), Kn(Te);
          for (var Fe = de; Fe.circle && y(U2 - Fe.circle.x) < Ot && y(G2 - Fe.circle.cy) < Ot; ) de = Fe.N, ye.push(Fe), vn(Fe), Fe = de;
          ye.push(Fe), Kn(Fe);
          var et, lt = ye.length;
          for (et = 1; et < lt; ++et) Fe = ye[et], Te = ye[et - 1], si(Fe.edge, Te.site, Fe.site, J2);
          Te = ye[0], (Fe = ye[lt - 1]).edge = zn(Te.site, Fe.site, null, J2), Rn(Te), Rn(Fe);
        }
        function jn(fe) {
          for (var P2, U2, G2, J2, oe = fe.x, de = fe.y, ye = pn._; ye; ) if ((G2 = bn(ye, de) - oe) > Ot) ye = ye.L;
          else {
            if (!((J2 = oe - Bn(ye, de)) > Ot)) {
              G2 > -Ot ? (P2 = ye.P, U2 = ye) : J2 > -Ot ? (P2 = ye, U2 = ye.N) : P2 = U2 = ye;
              break;
            }
            if (!ye.R) {
              P2 = ye;
              break;
            }
            ye = ye.R;
          }
          var Te = Rr(fe);
          if (pn.insert(P2, Te), P2 || U2) {
            if (P2 === U2) return Kn(P2), U2 = Rr(P2.site), pn.insert(Te, U2), Te.edge = U2.edge = zn(P2.site, Te.site), Rn(P2), void Rn(U2);
            if (U2) {
              Kn(P2), Kn(U2);
              var Fe = P2.site, et = Fe.x, lt = Fe.y, bt = fe.x - et, It = fe.y - lt, Rt = U2.site, Ft = Rt.x - et, Pt = Rt.y - lt, Mt = 2 * (bt * Pt - It * Ft), qt = bt * bt + It * It, $t = Ft * Ft + Pt * Pt, Yt = { x: (Pt * qt - It * $t) / Mt + et, y: (bt * $t - Ft * qt) / Mt + lt };
              si(U2.edge, Fe, Rt, Yt), Te.edge = zn(Fe, fe, null, Yt), U2.edge = zn(fe, Rt, null, Yt), Rn(P2), Rn(U2);
            } else Te.edge = zn(P2.site, Te.site);
          }
        }
        function bn(fe, P2) {
          var U2 = fe.site, G2 = U2.x, J2 = U2.y, oe = J2 - P2;
          if (!oe) return G2;
          var de = fe.P;
          if (!de) return -1 / 0;
          var ye = (U2 = de.site).x, Te = U2.y, Fe = Te - P2;
          if (!Fe) return ye;
          var et = ye - G2, lt = 1 / oe - 1 / Fe, bt = et / Fe;
          return lt ? (-bt + Math.sqrt(bt * bt - 2 * lt * (et * et / (-2 * Fe) - Te + Fe / 2 + J2 - oe / 2))) / lt + G2 : (G2 + ye) / 2;
        }
        function Bn(fe, P2) {
          var U2 = fe.N;
          if (U2) return bn(U2, P2);
          var G2 = fe.site;
          return G2.y === P2 ? G2.x : 1 / 0;
        }
        function sn(fe) {
          this.site = fe, this.edges = [];
        }
        function an(fe, P2) {
          return P2.angle - fe.angle;
        }
        function Sn() {
          Uo(this), this.x = this.y = this.arc = this.site = this.cy = null;
        }
        function Rn(fe) {
          var P2 = fe.P, U2 = fe.N;
          if (P2 && U2) {
            var G2 = P2.site, J2 = fe.site, oe = U2.site;
            if (G2 !== oe) {
              var de = J2.x, ye = J2.y, Te = G2.x - de, Fe = G2.y - ye, et = oe.x - de, lt = 2 * (Te * (Pt = oe.y - ye) - Fe * et);
              if (!(lt >= -1e-12)) {
                var bt = Te * Te + Fe * Fe, It = et * et + Pt * Pt, Rt = (Pt * bt - Fe * It) / lt, Ft = (Te * It - et * bt) / lt, Pt = Ft + ye, Mt = Lr.pop() || new Sn();
                Mt.arc = fe, Mt.site = J2, Mt.x = Rt + de, Mt.y = Pt + Math.sqrt(Rt * Rt + Ft * Ft), Mt.cy = Pt, fe.circle = Mt;
                for (var qt = null, $t = Ir._; $t; ) if (Mt.y < $t.y || Mt.y === $t.y && Mt.x <= $t.x) {
                  if (!$t.L) {
                    qt = $t.P;
                    break;
                  }
                  $t = $t.L;
                } else {
                  if (!$t.R) {
                    qt = $t;
                    break;
                  }
                  $t = $t.R;
                }
                Ir.insert(qt, Mt), qt || (un = Mt);
              }
            }
          }
        }
        function Kn(fe) {
          var P2 = fe.circle;
          P2 && (P2.P || (un = P2.N), Ir.remove(P2), Lr.push(P2), Uo(P2), fe.circle = null);
        }
        function qa(fe, P2) {
          var U2 = fe.b;
          if (U2) return true;
          var G2, J2, oe = fe.a, de = P2[0][0], ye = P2[1][0], Te = P2[0][1], Fe = P2[1][1], et = fe.l, lt = fe.r, bt = et.x, It = et.y, Rt = lt.x, Ft = lt.y, Pt = (bt + Rt) / 2, Mt = (It + Ft) / 2;
          if (Ft === It) {
            if (Pt < de || Pt >= ye) return;
            if (bt > Rt) {
              if (oe) {
                if (oe.y >= Fe) return;
              } else oe = { x: Pt, y: Te };
              U2 = { x: Pt, y: Fe };
            } else {
              if (oe) {
                if (oe.y < Te) return;
              } else oe = { x: Pt, y: Fe };
              U2 = { x: Pt, y: Te };
            }
          } else if (J2 = Mt - (G2 = (bt - Rt) / (Ft - It)) * Pt, G2 < -1 || G2 > 1) if (bt > Rt) {
            if (oe) {
              if (oe.y >= Fe) return;
            } else oe = { x: (Te - J2) / G2, y: Te };
            U2 = { x: (Fe - J2) / G2, y: Fe };
          } else {
            if (oe) {
              if (oe.y < Te) return;
            } else oe = { x: (Fe - J2) / G2, y: Fe };
            U2 = { x: (Te - J2) / G2, y: Te };
          }
          else if (It < Ft) {
            if (oe) {
              if (oe.x >= ye) return;
            } else oe = { x: de, y: G2 * de + J2 };
            U2 = { x: ye, y: G2 * ye + J2 };
          } else {
            if (oe) {
              if (oe.x < de) return;
            } else oe = { x: ye, y: G2 * ye + J2 };
            U2 = { x: de, y: G2 * de + J2 };
          }
          return fe.a = oe, fe.b = U2, true;
        }
        function ka(fe, P2) {
          this.l = fe, this.r = P2, this.a = this.b = null;
        }
        function zn(fe, P2, U2, G2) {
          var J2 = new ka(fe, P2);
          return xr.push(J2), U2 && si(J2, fe, P2, U2), G2 && si(J2, P2, fe, G2), Fr[fe.i].edges.push(new ko(J2, fe, P2)), Fr[P2.i].edges.push(new ko(J2, P2, fe)), J2;
        }
        function ja(fe, P2, U2) {
          var G2 = new ka(fe, null);
          return G2.a = P2, G2.b = U2, xr.push(G2), G2;
        }
        function si(fe, P2, U2, G2) {
          fe.a || fe.b ? fe.l === U2 ? fe.b = G2 : fe.a = G2 : (fe.a = G2, fe.l = P2, fe.r = U2);
        }
        function ko(fe, P2, U2) {
          var G2 = fe.a, J2 = fe.b;
          this.edge = fe, this.site = P2, this.angle = U2 ? Math.atan2(U2.y - P2.y, U2.x - P2.x) : fe.l === P2 ? Math.atan2(J2.x - G2.x, G2.y - J2.y) : Math.atan2(G2.x - J2.x, J2.y - G2.y);
        }
        function Xs() {
          this._ = null;
        }
        function Uo(fe) {
          fe.U = fe.C = fe.L = fe.R = fe.P = fe.N = null;
        }
        function As(fe, P2) {
          var U2 = P2, G2 = P2.R, J2 = U2.U;
          J2 ? J2.L === U2 ? J2.L = G2 : J2.R = G2 : fe._ = G2, G2.U = J2, U2.U = G2, U2.R = G2.L, U2.R && (U2.R.U = U2), G2.L = U2;
        }
        function Ui(fe, P2) {
          var U2 = P2, G2 = P2.L, J2 = U2.U;
          J2 ? J2.L === U2 ? J2.L = G2 : J2.R = G2 : fe._ = G2, G2.U = J2, U2.U = G2, U2.L = G2.R, U2.L && (U2.L.U = U2), G2.R = U2;
        }
        function so(fe) {
          for (; fe.L; ) fe = fe.L;
          return fe;
        }
        function gu(fe, P2) {
          var U2, G2, J2, oe = fe.sort(Pc).pop();
          for (xr = [], Fr = new Array(fe.length), pn = new Xs(), Ir = new Xs(); ; ) if (J2 = un, oe && (!J2 || oe.y < J2.y || oe.y === J2.y && oe.x < J2.x)) oe.x === U2 && oe.y === G2 || (Fr[oe.i] = new sn(oe), jn(oe), U2 = oe.x, G2 = oe.y), oe = fe.pop();
          else {
            if (!J2) break;
            Mn(J2.arc);
          }
          P2 && (function(ye) {
            for (var Te, Fe, et, lt, bt, It = xr, Rt = (Fe = ye[0][0], et = ye[0][1], lt = ye[1][0], bt = ye[1][1], function(Pt) {
              var Mt, qt = Pt.a, $t = Pt.b, Yt = qt.x, cr = qt.y, kr = 0, Pr = 1, Or = $t.x - Yt, xn = $t.y - cr;
              if (Mt = Fe - Yt, Or || !(Mt > 0)) {
                if (Mt /= Or, Or < 0) {
                  if (Mt < kr) return;
                  Mt < Pr && (Pr = Mt);
                } else if (Or > 0) {
                  if (Mt > Pr) return;
                  Mt > kr && (kr = Mt);
                }
                if (Mt = lt - Yt, Or || !(Mt < 0)) {
                  if (Mt /= Or, Or < 0) {
                    if (Mt > Pr) return;
                    Mt > kr && (kr = Mt);
                  } else if (Or > 0) {
                    if (Mt < kr) return;
                    Mt < Pr && (Pr = Mt);
                  }
                  if (Mt = et - cr, xn || !(Mt > 0)) {
                    if (Mt /= xn, xn < 0) {
                      if (Mt < kr) return;
                      Mt < Pr && (Pr = Mt);
                    } else if (xn > 0) {
                      if (Mt > Pr) return;
                      Mt > kr && (kr = Mt);
                    }
                    if (Mt = bt - cr, xn || !(Mt < 0)) {
                      if (Mt /= xn, xn < 0) {
                        if (Mt > Pr) return;
                        Mt > kr && (kr = Mt);
                      } else if (xn > 0) {
                        if (Mt < kr) return;
                        Mt < Pr && (Pr = Mt);
                      }
                      return kr > 0 && (Pt.a = { x: Yt + kr * Or, y: cr + kr * xn }), Pr < 1 && (Pt.b = { x: Yt + Pr * Or, y: cr + Pr * xn }), Pt;
                    }
                  }
                }
              }
            }), Ft = It.length; Ft--; ) (!qa(Te = It[Ft], ye) || !Rt(Te) || y(Te.a.x - Te.b.x) < Ot && y(Te.a.y - Te.b.y) < Ot) && (Te.a = Te.b = null, It.splice(Ft, 1));
          }(P2), function(ye) {
            for (var Te, Fe, et, lt, bt, It, Rt, Ft, Pt, Mt, qt = ye[0][0], $t = ye[1][0], Yt = ye[0][1], cr = ye[1][1], kr = Fr, Pr = kr.length; Pr--; ) if ((bt = kr[Pr]) && bt.prepare()) for (Ft = (Rt = bt.edges).length, It = 0; It < Ft; ) et = (Mt = Rt[It].end()).x, lt = Mt.y, Te = (Pt = Rt[++It % Ft].start()).x, Fe = Pt.y, (y(et - Te) > Ot || y(lt - Fe) > Ot) && (Rt.splice(It, 0, new ko(ja(bt.site, Mt, y(et - qt) < Ot && cr - lt > Ot ? { x: qt, y: y(Te - qt) < Ot ? Fe : cr } : y(lt - cr) < Ot && $t - et > Ot ? { x: y(Fe - cr) < Ot ? Te : $t, y: cr } : y(et - $t) < Ot && lt - Yt > Ot ? { x: $t, y: y(Te - $t) < Ot ? Fe : Yt } : y(lt - Yt) < Ot && et - qt > Ot ? { x: y(Fe - Yt) < Ot ? Te : qt, y: Yt } : null), bt.site, null)), ++Ft);
          }(P2));
          var de = { cells: Fr, edges: xr };
          return pn = Ir = xr = Fr = null, de;
        }
        function Pc(fe, P2) {
          return P2.y - fe.y || P2.x - fe.x;
        }
        sn.prototype.prepare = function() {
          for (var fe, P2 = this.edges, U2 = P2.length; U2--; ) (fe = P2[U2].edge).b && fe.a || P2.splice(U2, 1);
          return P2.sort(an), P2.length;
        }, ko.prototype = { start: function() {
          return this.edge.l === this.site ? this.edge.a : this.edge.b;
        }, end: function() {
          return this.edge.l === this.site ? this.edge.b : this.edge.a;
        } }, Xs.prototype = { insert: function(fe, P2) {
          var U2, G2, J2;
          if (fe) {
            if (P2.P = fe, P2.N = fe.N, fe.N && (fe.N.P = P2), fe.N = P2, fe.R) {
              for (fe = fe.R; fe.L; ) fe = fe.L;
              fe.L = P2;
            } else fe.R = P2;
            U2 = fe;
          } else this._ ? (fe = so(this._), P2.P = null, P2.N = fe, fe.P = fe.L = P2, U2 = fe) : (P2.P = P2.N = null, this._ = P2, U2 = null);
          for (P2.L = P2.R = null, P2.U = U2, P2.C = true, fe = P2; U2 && U2.C; ) U2 === (G2 = U2.U).L ? (J2 = G2.R) && J2.C ? (U2.C = J2.C = false, G2.C = true, fe = G2) : (fe === U2.R && (As(this, U2), U2 = (fe = U2).U), U2.C = false, G2.C = true, Ui(this, G2)) : (J2 = G2.L) && J2.C ? (U2.C = J2.C = false, G2.C = true, fe = G2) : (fe === U2.L && (Ui(this, U2), U2 = (fe = U2).U), U2.C = false, G2.C = true, As(this, G2)), U2 = fe.U;
          this._.C = false;
        }, remove: function(fe) {
          fe.N && (fe.N.P = fe.P), fe.P && (fe.P.N = fe.N), fe.N = fe.P = null;
          var P2, U2, G2, J2 = fe.U, oe = fe.L, de = fe.R;
          if (U2 = oe ? de ? so(de) : oe : de, J2 ? J2.L === fe ? J2.L = U2 : J2.R = U2 : this._ = U2, oe && de ? (G2 = U2.C, U2.C = fe.C, U2.L = oe, oe.U = U2, U2 !== de ? (J2 = U2.U, U2.U = fe.U, fe = U2.R, J2.L = fe, U2.R = de, de.U = U2) : (U2.U = J2, J2 = U2, fe = U2.R)) : (G2 = fe.C, fe = U2), fe && (fe.U = J2), !G2) if (fe && fe.C) fe.C = false;
          else {
            do {
              if (fe === this._) break;
              if (fe === J2.L) {
                if ((P2 = J2.R).C && (P2.C = false, J2.C = true, As(this, J2), P2 = J2.R), P2.L && P2.L.C || P2.R && P2.R.C) {
                  P2.R && P2.R.C || (P2.L.C = false, P2.C = true, Ui(this, P2), P2 = J2.R), P2.C = J2.C, J2.C = P2.R.C = false, As(this, J2), fe = this._;
                  break;
                }
              } else if ((P2 = J2.L).C && (P2.C = false, J2.C = true, Ui(this, J2), P2 = J2.L), P2.L && P2.L.C || P2.R && P2.R.C) {
                P2.L && P2.L.C || (P2.R.C = false, P2.C = true, As(this, P2), P2 = J2.L), P2.C = J2.C, J2.C = P2.L.C = false, Ui(this, J2), fe = this._;
                break;
              }
              P2.C = true, fe = J2, J2 = J2.U;
            } while (!fe.C);
            fe && (fe.C = false);
          }
        } }, n.geom.voronoi = function(fe) {
          var P2 = tn, U2 = Zn, G2 = P2, J2 = U2, oe = Zc;
          if (fe) return de(fe);
          function de(Te) {
            var Fe = new Array(Te.length), et = oe[0][0], lt = oe[0][1], bt = oe[1][0], It = oe[1][1];
            return gu(ye(Te), oe).cells.forEach(function(Rt, Ft) {
              var Pt = Rt.edges, Mt = Rt.site;
              (Fe[Ft] = Pt.length ? Pt.map(function(qt) {
                var $t = qt.start();
                return [$t.x, $t.y];
              }) : Mt.x >= et && Mt.x <= bt && Mt.y >= lt && Mt.y <= It ? [[et, It], [bt, It], [bt, lt], [et, lt]] : []).point = Te[Ft];
            }), Fe;
          }
          function ye(Te) {
            return Te.map(function(Fe, et) {
              return { x: Math.round(G2(Fe, et) / Ot) * Ot, y: Math.round(J2(Fe, et) / Ot) * Ot, i: et };
            });
          }
          return de.links = function(Te) {
            return gu(ye(Te)).edges.filter(function(Fe) {
              return Fe.l && Fe.r;
            }).map(function(Fe) {
              return { source: Te[Fe.l.i], target: Te[Fe.r.i] };
            });
          }, de.triangles = function(Te) {
            var Fe = [];
            return gu(ye(Te)).cells.forEach(function(et, lt) {
              for (var bt, It, Rt, Ft, Pt = et.site, Mt = et.edges.sort(an), qt = -1, $t = Mt.length, Yt = Mt[$t - 1].edge, cr = Yt.l === Pt ? Yt.r : Yt.l; ++qt < $t; ) bt = cr, cr = (Yt = Mt[qt].edge).l === Pt ? Yt.r : Yt.l, lt < bt.i && lt < cr.i && (Rt = bt, Ft = cr, ((It = Pt).x - Ft.x) * (Rt.y - It.y) - (It.x - Rt.x) * (Ft.y - It.y) < 0) && Fe.push([Te[lt], Te[bt.i], Te[cr.i]]);
            }), Fe;
          }, de.x = function(Te) {
            return arguments.length ? (G2 = Ar(P2 = Te), de) : P2;
          }, de.y = function(Te) {
            return arguments.length ? (J2 = Ar(U2 = Te), de) : U2;
          }, de.clipExtent = function(Te) {
            return arguments.length ? (oe = Te ?? Zc, de) : oe === Zc ? null : oe;
          }, de.size = function(Te) {
            return arguments.length ? de.clipExtent(Te && [[0, 0], Te]) : oe === Zc ? null : oe && oe[1];
          }, de;
        };
        var Zc = [[-1e6, -1e6], [1e6, 1e6]];
        function Ll(fe) {
          return fe.x;
        }
        function Hl(fe) {
          return fe.y;
        }
        function Lc(fe, P2, U2, G2, J2, oe) {
          if (!fe(P2, U2, G2, J2, oe)) {
            var de = 0.5 * (U2 + J2), ye = 0.5 * (G2 + oe), Te = P2.nodes;
            Te[0] && Lc(fe, Te[0], U2, G2, de, ye), Te[1] && Lc(fe, Te[1], de, G2, J2, ye), Te[2] && Lc(fe, Te[2], U2, ye, de, oe), Te[3] && Lc(fe, Te[3], de, ye, J2, oe);
          }
        }
        function po(fe, P2, U2, G2, J2, oe, de) {
          var ye, Te = 1 / 0;
          return function Fe(et, lt, bt, It, Rt) {
            if (!(lt > oe || bt > de || It < G2 || Rt < J2)) {
              if (Ft = et.point) {
                var Ft, Pt = P2 - et.x, Mt = U2 - et.y, qt = Pt * Pt + Mt * Mt;
                if (qt < Te) {
                  var $t = Math.sqrt(Te = qt);
                  G2 = P2 - $t, J2 = U2 - $t, oe = P2 + $t, de = U2 + $t, ye = Ft;
                }
              }
              for (var Yt = et.nodes, cr = 0.5 * (lt + It), kr = 0.5 * (bt + Rt), Pr = (U2 >= kr) << 1 | P2 >= cr, Or = Pr + 4; Pr < Or; ++Pr) if (et = Yt[3 & Pr]) switch (3 & Pr) {
                case 0:
                  Fe(et, lt, bt, cr, kr);
                  break;
                case 1:
                  Fe(et, cr, bt, It, kr);
                  break;
                case 2:
                  Fe(et, lt, kr, cr, Rt);
                  break;
                case 3:
                  Fe(et, cr, kr, It, Rt);
              }
            }
          }(fe, G2, J2, oe, de), ye;
        }
        function tc(fe, P2) {
          fe = n.rgb(fe), P2 = n.rgb(P2);
          var U2 = fe.r, G2 = fe.g, J2 = fe.b, oe = P2.r - U2, de = P2.g - G2, ye = P2.b - J2;
          return function(Te) {
            return "#" + rr(Math.round(U2 + oe * Te)) + rr(Math.round(G2 + de * Te)) + rr(Math.round(J2 + ye * Te));
          };
        }
        function yu(fe, P2) {
          var U2, G2 = {}, J2 = {};
          for (U2 in fe) U2 in P2 ? G2[U2] = nl(fe[U2], P2[U2]) : J2[U2] = fe[U2];
          for (U2 in P2) U2 in fe || (J2[U2] = P2[U2]);
          return function(oe) {
            for (U2 in G2) J2[U2] = G2[U2](oe);
            return J2;
          };
        }
        function Ss(fe, P2) {
          return fe = +fe, P2 = +P2, function(U2) {
            return fe * (1 - U2) + P2 * U2;
          };
        }
        function ql(fe, P2) {
          var U2, G2, J2, oe = xu.lastIndex = zu.lastIndex = 0, de = -1, ye = [], Te = [];
          for (fe += "", P2 += ""; (U2 = xu.exec(fe)) && (G2 = zu.exec(P2)); ) (J2 = G2.index) > oe && (J2 = P2.slice(oe, J2), ye[de] ? ye[de] += J2 : ye[++de] = J2), (U2 = U2[0]) === (G2 = G2[0]) ? ye[de] ? ye[de] += G2 : ye[++de] = G2 : (ye[++de] = null, Te.push({ i: de, x: Ss(U2, G2) })), oe = zu.lastIndex;
          return oe < P2.length && (J2 = P2.slice(oe), ye[de] ? ye[de] += J2 : ye[++de] = J2), ye.length < 2 ? Te[0] ? (P2 = Te[0].x, function(Fe) {
            return P2(Fe) + "";
          }) : function() {
            return P2;
          } : (P2 = Te.length, function(Fe) {
            for (var et, lt = 0; lt < P2; ++lt) ye[(et = Te[lt]).i] = et.x(Fe);
            return ye.join("");
          });
        }
        n.geom.delaunay = function(fe) {
          return n.geom.voronoi().triangles(fe);
        }, n.geom.quadtree = function(fe, P2, U2, G2, J2) {
          var oe, de = tn, ye = Zn;
          if (oe = arguments.length) return de = Ll, ye = Hl, oe === 3 && (J2 = U2, G2 = P2, U2 = P2 = 0), Te(fe);
          function Te(Fe) {
            var et, lt, bt, It, Rt, Ft, Pt, Mt, qt, $t = Ar(de), Yt = Ar(ye);
            if (P2 != null) Ft = P2, Pt = U2, Mt = G2, qt = J2;
            else if (Mt = qt = -(Ft = Pt = 1 / 0), lt = [], bt = [], Rt = Fe.length, oe) for (It = 0; It < Rt; ++It) (et = Fe[It]).x < Ft && (Ft = et.x), et.y < Pt && (Pt = et.y), et.x > Mt && (Mt = et.x), et.y > qt && (qt = et.y), lt.push(et.x), bt.push(et.y);
            else for (It = 0; It < Rt; ++It) {
              var cr = +$t(et = Fe[It], It), kr = +Yt(et, It);
              cr < Ft && (Ft = cr), kr < Pt && (Pt = kr), cr > Mt && (Mt = cr), kr > qt && (qt = kr), lt.push(cr), bt.push(kr);
            }
            var Pr = Mt - Ft, Or = qt - Pt;
            function xn(An, ma, Aa, Qa, ln, qn, Sa, _a) {
              if (!isNaN(Aa) && !isNaN(Qa)) if (An.leaf) {
                var Pa = An.x, ii = An.y;
                if (Pa != null) if (y(Pa - Aa) + y(ii - Qa) < 0.01) yn(An, ma, Aa, Qa, ln, qn, Sa, _a);
                else {
                  var Oi = An.point;
                  An.x = An.y = An.point = null, yn(An, Oi, Pa, ii, ln, qn, Sa, _a), yn(An, ma, Aa, Qa, ln, qn, Sa, _a);
                }
                else An.x = Aa, An.y = Qa, An.point = ma;
              } else yn(An, ma, Aa, Qa, ln, qn, Sa, _a);
            }
            function yn(An, ma, Aa, Qa, ln, qn, Sa, _a) {
              var Pa = 0.5 * (ln + Sa), ii = 0.5 * (qn + _a), Oi = Aa >= Pa, Da = Qa >= ii, wi = Da << 1 | Oi;
              An.leaf = false, Oi ? ln = Pa : Sa = Pa, Da ? qn = ii : _a = ii, xn(An = An.nodes[wi] || (An.nodes[wi] = { leaf: true, nodes: [], point: null, x: null, y: null }), ma, Aa, Qa, ln, qn, Sa, _a);
            }
            Pr > Or ? qt = Pt + Pr : Mt = Ft + Or;
            var Nn = { leaf: true, nodes: [], point: null, x: null, y: null, add: function(An) {
              xn(Nn, An, +$t(An, ++It), +Yt(An, It), Ft, Pt, Mt, qt);
            }, visit: function(An) {
              Lc(An, Nn, Ft, Pt, Mt, qt);
            }, find: function(An) {
              return po(Nn, An[0], An[1], Ft, Pt, Mt, qt);
            } };
            if (It = -1, P2 == null) {
              for (; ++It < Rt; ) xn(Nn, Fe[It], lt[It], bt[It], Ft, Pt, Mt, qt);
              --It;
            } else Fe.forEach(Nn.add);
            return lt = bt = Fe = et = null, Nn;
          }
          return Te.x = function(Fe) {
            return arguments.length ? (de = Fe, Te) : de;
          }, Te.y = function(Fe) {
            return arguments.length ? (ye = Fe, Te) : ye;
          }, Te.extent = function(Fe) {
            return arguments.length ? (Fe == null ? P2 = U2 = G2 = J2 = null : (P2 = +Fe[0][0], U2 = +Fe[0][1], G2 = +Fe[1][0], J2 = +Fe[1][1]), Te) : P2 == null ? null : [[P2, U2], [G2, J2]];
          }, Te.size = function(Fe) {
            return arguments.length ? (Fe == null ? P2 = U2 = G2 = J2 = null : (P2 = U2 = 0, G2 = +Fe[0], J2 = +Fe[1]), Te) : P2 == null ? null : [G2 - P2, J2 - U2];
          }, Te;
        }, n.interpolateRgb = tc, n.interpolateObject = yu, n.interpolateNumber = Ss, n.interpolateString = ql;
        var xu = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, zu = new RegExp(xu.source, "g");
        function nl(fe, P2) {
          for (var U2, G2 = n.interpolators.length; --G2 >= 0 && !(U2 = n.interpolators[G2](fe, P2)); ) ;
          return U2;
        }
        function ss(fe, P2) {
          var U2, G2 = [], J2 = [], oe = fe.length, de = P2.length, ye = Math.min(fe.length, P2.length);
          for (U2 = 0; U2 < ye; ++U2) G2.push(nl(fe[U2], P2[U2]));
          for (; U2 < oe; ++U2) J2[U2] = fe[U2];
          for (; U2 < de; ++U2) J2[U2] = P2[U2];
          return function(Te) {
            for (U2 = 0; U2 < ye; ++U2) J2[U2] = G2[U2](Te);
            return J2;
          };
        }
        n.interpolate = nl, n.interpolators = [function(fe, P2) {
          var U2 = typeof P2;
          return (U2 === "string" ? $r.has(P2.toLowerCase()) || /^(#|rgb\(|hsl\()/i.test(P2) ? tc : ql : P2 instanceof qe ? tc : Array.isArray(P2) ? ss : U2 === "object" && isNaN(P2) ? yu : Ss)(fe, P2);
        }], n.interpolateArray = ss;
        var Rl = function() {
          return I2;
        }, Kh = n.map({ linear: Rl, poly: function(fe) {
          return function(P2) {
            return Math.pow(P2, fe);
          };
        }, quad: function() {
          return Fp;
        }, cubic: function() {
          return Op;
        }, sin: function() {
          return Pp;
        }, exp: function() {
          return rc;
        }, circle: function() {
          return nc;
        }, elastic: function(fe, P2) {
          var U2;
          return arguments.length < 2 && (P2 = 0.45), arguments.length ? U2 = P2 / tr * Math.asin(1 / fe) : (fe = 1, U2 = P2 / 4), function(G2) {
            return 1 + fe * Math.pow(2, -10 * G2) * Math.sin((G2 - U2) * tr / P2);
          };
        }, back: function(fe) {
          return fe || (fe = 1.70158), function(P2) {
            return P2 * P2 * ((fe + 1) * P2 - fe);
          };
        }, bounce: function() {
          return Rc;
        } }), Np = n.map({ in: I2, out: xh, "in-out": kf, "out-in": function(fe) {
          return kf(xh(fe));
        } });
        function vo(fe) {
          return function(P2) {
            return P2 <= 0 ? 0 : P2 >= 1 ? 1 : fe(P2);
          };
        }
        function xh(fe) {
          return function(P2) {
            return 1 - fe(1 - P2);
          };
        }
        function kf(fe) {
          return function(P2) {
            return 0.5 * (P2 < 0.5 ? fe(2 * P2) : 2 - fe(2 - 2 * P2));
          };
        }
        function Fp(fe) {
          return fe * fe;
        }
        function Op(fe) {
          return fe * fe * fe;
        }
        function Yh(fe) {
          if (fe <= 0) return 0;
          if (fe >= 1) return 1;
          var P2 = fe * fe, U2 = P2 * fe;
          return 4 * (fe < 0.5 ? U2 : 3 * (fe - P2) + U2 - 0.75);
        }
        function Pp(fe) {
          return 1 - Math.cos(fe * at);
        }
        function rc(fe) {
          return Math.pow(2, 10 * (fe - 1));
        }
        function nc(fe) {
          return 1 - Math.sqrt(1 - fe * fe);
        }
        function Rc(fe) {
          return fe < 1 / 2.75 ? 7.5625 * fe * fe : fe < 2 / 2.75 ? 7.5625 * (fe -= 1.5 / 2.75) * fe + 0.75 : fe < 2.5 / 2.75 ? 7.5625 * (fe -= 2.25 / 2.75) * fe + 0.9375 : 7.5625 * (fe -= 2.625 / 2.75) * fe + 0.984375;
        }
        function zc(fe, P2) {
          return P2 -= fe, function(U2) {
            return Math.round(fe + P2 * U2);
          };
        }
        function Bc(fe) {
          var P2, U2, G2, J2 = [fe.a, fe.b], oe = [fe.c, fe.d], de = bu(J2), ye = Tf(J2, oe), Te = bu(((P2 = oe)[0] += (G2 = -ye) * (U2 = J2)[0], P2[1] += G2 * U2[1], P2)) || 0;
          J2[0] * oe[1] < oe[0] * J2[1] && (J2[0] *= -1, J2[1] *= -1, de *= -1, ye *= -1), this.rotate = (de ? Math.atan2(J2[1], J2[0]) : Math.atan2(-oe[0], oe[1])) * st, this.translate = [fe.e, fe.f], this.scale = [de, Te], this.skew = Te ? Math.atan2(ye, Te) * st : 0;
        }
        function Tf(fe, P2) {
          return fe[0] * P2[0] + fe[1] * P2[1];
        }
        function bu(fe) {
          var P2 = Math.sqrt(Tf(fe, fe));
          return P2 && (fe[0] /= P2, fe[1] /= P2), P2;
        }
        n.ease = function(fe) {
          var P2 = fe.indexOf("-"), U2 = P2 >= 0 ? fe.slice(0, P2) : fe, G2 = P2 >= 0 ? fe.slice(P2 + 1) : "in";
          return U2 = Kh.get(U2) || Rl, vo((G2 = Np.get(G2) || I2)(U2.apply(null, a.call(arguments, 1))));
        }, n.interpolateHcl = function(fe, P2) {
          fe = n.hcl(fe), P2 = n.hcl(P2);
          var U2 = fe.h, G2 = fe.c, J2 = fe.l, oe = P2.h - U2, de = P2.c - G2, ye = P2.l - J2;
          return isNaN(de) && (de = 0, G2 = isNaN(G2) ? P2.c : G2), isNaN(oe) ? (oe = 0, U2 = isNaN(U2) ? P2.h : U2) : oe > 180 ? oe -= 360 : oe < -180 && (oe += 360), function(Te) {
            return ke(U2 + oe * Te, G2 + de * Te, J2 + ye * Te) + "";
          };
        }, n.interpolateHsl = function(fe, P2) {
          fe = n.hsl(fe), P2 = n.hsl(P2);
          var U2 = fe.h, G2 = fe.s, J2 = fe.l, oe = P2.h - U2, de = P2.s - G2, ye = P2.l - J2;
          return isNaN(de) && (de = 0, G2 = isNaN(G2) ? P2.s : G2), isNaN(oe) ? (oe = 0, U2 = isNaN(U2) ? P2.h : U2) : oe > 180 ? oe -= 360 : oe < -180 && (oe += 360), function(Te) {
            return He(U2 + oe * Te, G2 + de * Te, J2 + ye * Te) + "";
          };
        }, n.interpolateLab = function(fe, P2) {
          fe = n.lab(fe), P2 = n.lab(P2);
          var U2 = fe.l, G2 = fe.a, J2 = fe.b, oe = P2.l - U2, de = P2.a - G2, ye = P2.b - J2;
          return function(Te) {
            return ft(U2 + oe * Te, G2 + de * Te, J2 + ye * Te) + "";
          };
        }, n.interpolateRound = zc, n.transform = function(fe) {
          var P2 = s.createElementNS(n.ns.prefix.svg, "g");
          return (n.transform = function(U2) {
            if (U2 != null) {
              P2.setAttribute("transform", U2);
              var G2 = P2.transform.baseVal.consolidate();
            }
            return new Bc(G2 ? G2.matrix : bh);
          })(fe);
        }, Bc.prototype.toString = function() {
          return "translate(" + this.translate + ")rotate(" + this.rotate + ")skewX(" + this.skew + ")scale(" + this.scale + ")";
        };
        var bh = { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 };
        function cu(fe) {
          return fe.length ? fe.pop() + "," : "";
        }
        function Uc(fe, P2) {
          var U2 = [], G2 = [];
          return fe = n.transform(fe), P2 = n.transform(P2), function(J2, oe, de, ye) {
            if (J2[0] !== oe[0] || J2[1] !== oe[1]) {
              var Te = de.push("translate(", null, ",", null, ")");
              ye.push({ i: Te - 4, x: Ss(J2[0], oe[0]) }, { i: Te - 2, x: Ss(J2[1], oe[1]) });
            } else (oe[0] || oe[1]) && de.push("translate(" + oe + ")");
          }(fe.translate, P2.translate, U2, G2), function(J2, oe, de, ye) {
            J2 !== oe ? (J2 - oe > 180 ? oe += 360 : oe - J2 > 180 && (J2 += 360), ye.push({ i: de.push(cu(de) + "rotate(", null, ")") - 2, x: Ss(J2, oe) })) : oe && de.push(cu(de) + "rotate(" + oe + ")");
          }(fe.rotate, P2.rotate, U2, G2), function(J2, oe, de, ye) {
            J2 !== oe ? ye.push({ i: de.push(cu(de) + "skewX(", null, ")") - 2, x: Ss(J2, oe) }) : oe && de.push(cu(de) + "skewX(" + oe + ")");
          }(fe.skew, P2.skew, U2, G2), function(J2, oe, de, ye) {
            if (J2[0] !== oe[0] || J2[1] !== oe[1]) {
              var Te = de.push(cu(de) + "scale(", null, ",", null, ")");
              ye.push({ i: Te - 4, x: Ss(J2[0], oe[0]) }, { i: Te - 2, x: Ss(J2[1], oe[1]) });
            } else oe[0] === 1 && oe[1] === 1 || de.push(cu(de) + "scale(" + oe + ")");
          }(fe.scale, P2.scale, U2, G2), fe = P2 = null, function(J2) {
            for (var oe, de = -1, ye = G2.length; ++de < ye; ) U2[(oe = G2[de]).i] = oe.x(J2);
            return U2.join("");
          };
        }
        function _h(fe, P2) {
          return P2 = (P2 -= fe = +fe) || 1 / P2, function(U2) {
            return (U2 - fe) / P2;
          };
        }
        function ac(fe, P2) {
          return P2 = (P2 -= fe = +fe) || 1 / P2, function(U2) {
            return Math.max(0, Math.min(1, (U2 - fe) / P2));
          };
        }
        function lo(fe) {
          for (var P2 = fe.source, U2 = fe.target, G2 = function(de, ye) {
            if (de === ye) return de;
            for (var Te = Qe(de), Fe = Qe(ye), et = Te.pop(), lt = Fe.pop(), bt = null; et === lt; ) bt = et, et = Te.pop(), lt = Fe.pop();
            return bt;
          }(P2, U2), J2 = [P2]; P2 !== G2; ) P2 = P2.parent, J2.push(P2);
          for (var oe = J2.length; U2 !== G2; ) J2.splice(oe, 0, U2), U2 = U2.parent;
          return J2;
        }
        function Qe(fe) {
          for (var P2 = [], U2 = fe.parent; U2 != null; ) P2.push(fe), fe = U2, U2 = U2.parent;
          return P2.push(fe), P2;
        }
        function nt(fe) {
          fe.fixed |= 2;
        }
        function dt(fe) {
          fe.fixed &= -7;
        }
        function _t(fe) {
          fe.fixed |= 4, fe.px = fe.x, fe.py = fe.y;
        }
        function Ct(fe) {
          fe.fixed &= -5;
        }
        n.interpolateTransform = Uc, n.layout = {}, n.layout.bundle = function() {
          return function(fe) {
            for (var P2 = [], U2 = -1, G2 = fe.length; ++U2 < G2; ) P2.push(lo(fe[U2]));
            return P2;
          };
        }, n.layout.chord = function() {
          var fe, P2, U2, G2, J2, oe, de, ye = {}, Te = 0;
          function Fe() {
            var lt, bt, It, Rt, Ft, Pt = {}, Mt = [], qt = n.range(G2), $t = [];
            for (fe = [], P2 = [], lt = 0, Rt = -1; ++Rt < G2; ) {
              for (bt = 0, Ft = -1; ++Ft < G2; ) bt += U2[Rt][Ft];
              Mt.push(bt), $t.push(n.range(G2)), lt += bt;
            }
            for (J2 && qt.sort(function(Nn, An) {
              return J2(Mt[Nn], Mt[An]);
            }), oe && $t.forEach(function(Nn, An) {
              Nn.sort(function(ma, Aa) {
                return oe(U2[An][ma], U2[An][Aa]);
              });
            }), lt = (tr - Te * G2) / lt, bt = 0, Rt = -1; ++Rt < G2; ) {
              for (It = bt, Ft = -1; ++Ft < G2; ) {
                var Yt = qt[Rt], cr = $t[Yt][Ft], kr = U2[Yt][cr], Pr = bt, Or = bt += kr * lt;
                Pt[Yt + "-" + cr] = { index: Yt, subindex: cr, startAngle: Pr, endAngle: Or, value: kr };
              }
              P2[Yt] = { index: Yt, startAngle: It, endAngle: bt, value: Mt[Yt] }, bt += Te;
            }
            for (Rt = -1; ++Rt < G2; ) for (Ft = Rt - 1; ++Ft < G2; ) {
              var xn = Pt[Rt + "-" + Ft], yn = Pt[Ft + "-" + Rt];
              (xn.value || yn.value) && fe.push(xn.value < yn.value ? { source: yn, target: xn } : { source: xn, target: yn });
            }
            de && et();
          }
          function et() {
            fe.sort(function(lt, bt) {
              return de((lt.source.value + lt.target.value) / 2, (bt.source.value + bt.target.value) / 2);
            });
          }
          return ye.matrix = function(lt) {
            return arguments.length ? (G2 = (U2 = lt) && U2.length, fe = P2 = null, ye) : U2;
          }, ye.padding = function(lt) {
            return arguments.length ? (Te = lt, fe = P2 = null, ye) : Te;
          }, ye.sortGroups = function(lt) {
            return arguments.length ? (J2 = lt, fe = P2 = null, ye) : J2;
          }, ye.sortSubgroups = function(lt) {
            return arguments.length ? (oe = lt, fe = null, ye) : oe;
          }, ye.sortChords = function(lt) {
            return arguments.length ? (de = lt, fe && et(), ye) : de;
          }, ye.chords = function() {
            return fe || Fe(), fe;
          }, ye.groups = function() {
            return P2 || Fe(), P2;
          }, ye;
        }, n.layout.force = function() {
          var fe, P2, U2, G2, J2, oe, de = {}, ye = n.dispatch("start", "tick", "end"), Te = [1, 1], Fe = 0.9, et = St, lt = Lt, bt = -30, It = ir, Rt = 0.1, Ft = 0.64, Pt = [], Mt = [];
          function qt(Yt) {
            return function(cr, kr, Pr, Or) {
              if (cr.point !== Yt) {
                var xn = cr.cx - Yt.x, yn = cr.cy - Yt.y, Nn = Or - kr, An = xn * xn + yn * yn;
                if (Nn * Nn / Ft < An) {
                  if (An < It) {
                    var ma = cr.charge / An;
                    Yt.px -= xn * ma, Yt.py -= yn * ma;
                  }
                  return true;
                }
                cr.point && An && An < It && (ma = cr.pointCharge / An, Yt.px -= xn * ma, Yt.py -= yn * ma);
              }
              return !cr.charge;
            };
          }
          function $t(Yt) {
            Yt.px = n.event.x, Yt.py = n.event.y, de.resume();
          }
          return de.tick = function() {
            if ((U2 *= 0.99) < 5e-3) return fe = null, ye.end({ type: "end", alpha: U2 = 0 }), true;
            var Yt, cr, kr, Pr, Or, xn, yn, Nn, An, ma = Pt.length, Aa = Mt.length;
            for (cr = 0; cr < Aa; ++cr) Pr = (kr = Mt[cr]).source, (xn = (Nn = (Or = kr.target).x - Pr.x) * Nn + (An = Or.y - Pr.y) * An) && (Nn *= xn = U2 * J2[cr] * ((xn = Math.sqrt(xn)) - G2[cr]) / xn, An *= xn, Or.x -= Nn * (yn = Pr.weight + Or.weight ? Pr.weight / (Pr.weight + Or.weight) : 0.5), Or.y -= An * yn, Pr.x += Nn * (yn = 1 - yn), Pr.y += An * yn);
            if ((yn = U2 * Rt) && (Nn = Te[0] / 2, An = Te[1] / 2, cr = -1, yn)) for (; ++cr < ma; ) (kr = Pt[cr]).x += (Nn - kr.x) * yn, kr.y += (An - kr.y) * yn;
            if (bt) for (function Qa(ln, qn, Sa) {
              var _a = 0, Pa = 0;
              if (ln.charge = 0, !ln.leaf) for (var ii, Oi = ln.nodes, Da = Oi.length, wi = -1; ++wi < Da; ) (ii = Oi[wi]) != null && (Qa(ii, qn, Sa), ln.charge += ii.charge, _a += ii.charge * ii.cx, Pa += ii.charge * ii.cy);
              if (ln.point) {
                ln.leaf || (ln.point.x += Math.random() - 0.5, ln.point.y += Math.random() - 0.5);
                var di = qn * Sa[ln.point.index];
                ln.charge += ln.pointCharge = di, _a += di * ln.point.x, Pa += di * ln.point.y;
              }
              ln.cx = _a / ln.charge, ln.cy = Pa / ln.charge;
            }(Yt = n.geom.quadtree(Pt), U2, oe), cr = -1; ++cr < ma; ) (kr = Pt[cr]).fixed || Yt.visit(qt(kr));
            for (cr = -1; ++cr < ma; ) (kr = Pt[cr]).fixed ? (kr.x = kr.px, kr.y = kr.py) : (kr.x -= (kr.px - (kr.px = kr.x)) * Fe, kr.y -= (kr.py - (kr.py = kr.y)) * Fe);
            ye.tick({ type: "tick", alpha: U2 });
          }, de.nodes = function(Yt) {
            return arguments.length ? (Pt = Yt, de) : Pt;
          }, de.links = function(Yt) {
            return arguments.length ? (Mt = Yt, de) : Mt;
          }, de.size = function(Yt) {
            return arguments.length ? (Te = Yt, de) : Te;
          }, de.linkDistance = function(Yt) {
            return arguments.length ? (et = typeof Yt == "function" ? Yt : +Yt, de) : et;
          }, de.distance = de.linkDistance, de.linkStrength = function(Yt) {
            return arguments.length ? (lt = typeof Yt == "function" ? Yt : +Yt, de) : lt;
          }, de.friction = function(Yt) {
            return arguments.length ? (Fe = +Yt, de) : Fe;
          }, de.charge = function(Yt) {
            return arguments.length ? (bt = typeof Yt == "function" ? Yt : +Yt, de) : bt;
          }, de.chargeDistance = function(Yt) {
            return arguments.length ? (It = Yt * Yt, de) : Math.sqrt(It);
          }, de.gravity = function(Yt) {
            return arguments.length ? (Rt = +Yt, de) : Rt;
          }, de.theta = function(Yt) {
            return arguments.length ? (Ft = Yt * Yt, de) : Math.sqrt(Ft);
          }, de.alpha = function(Yt) {
            return arguments.length ? (Yt = +Yt, U2 ? Yt > 0 ? U2 = Yt : (fe.c = null, fe.t = NaN, fe = null, ye.end({ type: "end", alpha: U2 = 0 })) : Yt > 0 && (ye.start({ type: "start", alpha: U2 = Yt }), fe = qr(de.tick)), de) : U2;
          }, de.start = function() {
            var Yt, cr, kr, Pr = Pt.length, Or = Mt.length, xn = Te[0], yn = Te[1];
            for (Yt = 0; Yt < Pr; ++Yt) (kr = Pt[Yt]).index = Yt, kr.weight = 0;
            for (Yt = 0; Yt < Or; ++Yt) typeof (kr = Mt[Yt]).source == "number" && (kr.source = Pt[kr.source]), typeof kr.target == "number" && (kr.target = Pt[kr.target]), ++kr.source.weight, ++kr.target.weight;
            for (Yt = 0; Yt < Pr; ++Yt) kr = Pt[Yt], isNaN(kr.x) && (kr.x = Nn("x", xn)), isNaN(kr.y) && (kr.y = Nn("y", yn)), isNaN(kr.px) && (kr.px = kr.x), isNaN(kr.py) && (kr.py = kr.y);
            if (G2 = [], typeof et == "function") for (Yt = 0; Yt < Or; ++Yt) G2[Yt] = +et.call(this, Mt[Yt], Yt);
            else for (Yt = 0; Yt < Or; ++Yt) G2[Yt] = et;
            if (J2 = [], typeof lt == "function") for (Yt = 0; Yt < Or; ++Yt) J2[Yt] = +lt.call(this, Mt[Yt], Yt);
            else for (Yt = 0; Yt < Or; ++Yt) J2[Yt] = lt;
            if (oe = [], typeof bt == "function") for (Yt = 0; Yt < Pr; ++Yt) oe[Yt] = +bt.call(this, Pt[Yt], Yt);
            else for (Yt = 0; Yt < Pr; ++Yt) oe[Yt] = bt;
            function Nn(An, ma) {
              if (!cr) {
                for (cr = new Array(Pr), qn = 0; qn < Pr; ++qn) cr[qn] = [];
                for (qn = 0; qn < Or; ++qn) {
                  var Aa = Mt[qn];
                  cr[Aa.source.index].push(Aa.target), cr[Aa.target.index].push(Aa.source);
                }
              }
              for (var Qa, ln = cr[Yt], qn = -1, Sa = ln.length; ++qn < Sa; ) if (!isNaN(Qa = ln[qn][An])) return Qa;
              return Math.random() * ma;
            }
            return de.resume();
          }, de.resume = function() {
            return de.alpha(0.1);
          }, de.stop = function() {
            return de.alpha(0);
          }, de.drag = function() {
            if (P2 || (P2 = n.behavior.drag().origin(I2).on("dragstart.force", nt).on("drag.force", $t).on("dragend.force", dt)), !arguments.length) return P2;
            this.on("mouseover.force", _t).on("mouseout.force", Ct).call(P2);
          }, n.rebind(de, ye, "on");
        };
        var St = 20, Lt = 1, ir = 1 / 0;
        function or(fe, P2) {
          return n.rebind(fe, P2, "sort", "children", "value"), fe.nodes = fe, fe.links = Wr, fe;
        }
        function nr(fe, P2) {
          for (var U2 = [fe]; (fe = U2.pop()) != null; ) if (P2(fe), (J2 = fe.children) && (G2 = J2.length)) for (var G2, J2; --G2 >= 0; ) U2.push(J2[G2]);
        }
        function fr(fe, P2) {
          for (var U2 = [fe], G2 = []; (fe = U2.pop()) != null; ) if (G2.push(fe), (oe = fe.children) && (J2 = oe.length)) for (var J2, oe, de = -1; ++de < J2; ) U2.push(oe[de]);
          for (; (fe = G2.pop()) != null; ) P2(fe);
        }
        function wr(fe) {
          return fe.children;
        }
        function Er(fe) {
          return fe.value;
        }
        function Mr(fe, P2) {
          return P2.value - fe.value;
        }
        function Wr(fe) {
          return n.merge(fe.map(function(P2) {
            return (P2.children || []).map(function(U2) {
              return { source: P2, target: U2 };
            });
          }));
        }
        n.layout.hierarchy = function() {
          var fe = Mr, P2 = wr, U2 = Er;
          function G2(J2) {
            var oe, de = [J2], ye = [];
            for (J2.depth = 0; (oe = de.pop()) != null; ) if (ye.push(oe), (Fe = P2.call(G2, oe, oe.depth)) && (Te = Fe.length)) {
              for (var Te, Fe, et; --Te >= 0; ) de.push(et = Fe[Te]), et.parent = oe, et.depth = oe.depth + 1;
              U2 && (oe.value = 0), oe.children = Fe;
            } else U2 && (oe.value = +U2.call(G2, oe, oe.depth) || 0), delete oe.children;
            return fr(J2, function(lt) {
              var bt, It;
              fe && (bt = lt.children) && bt.sort(fe), U2 && (It = lt.parent) && (It.value += lt.value);
            }), ye;
          }
          return G2.sort = function(J2) {
            return arguments.length ? (fe = J2, G2) : fe;
          }, G2.children = function(J2) {
            return arguments.length ? (P2 = J2, G2) : P2;
          }, G2.value = function(J2) {
            return arguments.length ? (U2 = J2, G2) : U2;
          }, G2.revalue = function(J2) {
            return U2 && (nr(J2, function(oe) {
              oe.children && (oe.value = 0);
            }), fr(J2, function(oe) {
              var de;
              oe.children || (oe.value = +U2.call(G2, oe, oe.depth) || 0), (de = oe.parent) && (de.value += oe.value);
            })), J2;
          }, G2;
        }, n.layout.partition = function() {
          var fe = n.layout.hierarchy(), P2 = [1, 1];
          function U2(G2, J2) {
            var oe = fe.call(this, G2, J2);
            return function de(ye, Te, Fe, et) {
              var lt = ye.children;
              if (ye.x = Te, ye.y = ye.depth * et, ye.dx = Fe, ye.dy = et, lt && (bt = lt.length)) {
                var bt, It, Rt, Ft = -1;
                for (Fe = ye.value ? Fe / ye.value : 0; ++Ft < bt; ) de(It = lt[Ft], Te, Rt = It.value * Fe, et), Te += Rt;
              }
            }(oe[0], 0, P2[0], P2[1] / function de(ye) {
              var Te = ye.children, Fe = 0;
              if (Te && (et = Te.length)) for (var et, lt = -1; ++lt < et; ) Fe = Math.max(Fe, de(Te[lt]));
              return 1 + Fe;
            }(oe[0])), oe;
          }
          return U2.size = function(G2) {
            return arguments.length ? (P2 = G2, U2) : P2;
          }, or(U2, fe);
        }, n.layout.pie = function() {
          var fe = Number, P2 = kn, U2 = 0, G2 = tr, J2 = 0;
          function oe(de) {
            var ye, Te = de.length, Fe = de.map(function(qt, $t) {
              return +fe.call(oe, qt, $t);
            }), et = +(typeof U2 == "function" ? U2.apply(this, arguments) : U2), lt = (typeof G2 == "function" ? G2.apply(this, arguments) : G2) - et, bt = Math.min(Math.abs(lt) / Te, +(typeof J2 == "function" ? J2.apply(this, arguments) : J2)), It = bt * (lt < 0 ? -1 : 1), Rt = n.sum(Fe), Ft = Rt ? (lt - Te * It) / Rt : 0, Pt = n.range(Te), Mt = [];
            return P2 != null && Pt.sort(P2 === kn ? function(qt, $t) {
              return Fe[$t] - Fe[qt];
            } : function(qt, $t) {
              return P2(de[qt], de[$t]);
            }), Pt.forEach(function(qt) {
              Mt[qt] = { data: de[qt], value: ye = Fe[qt], startAngle: et, endAngle: et += ye * Ft + It, padAngle: bt };
            }), Mt;
          }
          return oe.value = function(de) {
            return arguments.length ? (fe = de, oe) : fe;
          }, oe.sort = function(de) {
            return arguments.length ? (P2 = de, oe) : P2;
          }, oe.startAngle = function(de) {
            return arguments.length ? (U2 = de, oe) : U2;
          }, oe.endAngle = function(de) {
            return arguments.length ? (G2 = de, oe) : G2;
          }, oe.padAngle = function(de) {
            return arguments.length ? (J2 = de, oe) : J2;
          }, oe;
        };
        var kn = {};
        function On(fe) {
          return fe.x;
        }
        function ta(fe) {
          return fe.y;
        }
        function sa(fe, P2, U2) {
          fe.y0 = P2, fe.y = U2;
        }
        n.layout.stack = function() {
          var fe = I2, P2 = ci, U2 = Ci, G2 = sa, J2 = On, oe = ta;
          function de(ye, Te) {
            if (!(bt = ye.length)) return ye;
            var Fe = ye.map(function(qt, $t) {
              return fe.call(de, qt, $t);
            }), et = Fe.map(function(qt) {
              return qt.map(function($t, Yt) {
                return [J2.call(de, $t, Yt), oe.call(de, $t, Yt)];
              });
            }), lt = P2.call(de, et, Te);
            Fe = n.permute(Fe, lt), et = n.permute(et, lt);
            var bt, It, Rt, Ft, Pt = U2.call(de, et, Te), Mt = Fe[0].length;
            for (Rt = 0; Rt < Mt; ++Rt) for (G2.call(de, Fe[0][Rt], Ft = Pt[Rt], et[0][Rt][1]), It = 1; It < bt; ++It) G2.call(de, Fe[It][Rt], Ft += et[It - 1][Rt][1], et[It][Rt][1]);
            return ye;
          }
          return de.values = function(ye) {
            return arguments.length ? (fe = ye, de) : fe;
          }, de.order = function(ye) {
            return arguments.length ? (P2 = typeof ye == "function" ? ye : xa.get(ye) || ci, de) : P2;
          }, de.offset = function(ye) {
            return arguments.length ? (U2 = typeof ye == "function" ? ye : la.get(ye) || Ci, de) : U2;
          }, de.x = function(ye) {
            return arguments.length ? (J2 = ye, de) : J2;
          }, de.y = function(ye) {
            return arguments.length ? (oe = ye, de) : oe;
          }, de.out = function(ye) {
            return arguments.length ? (G2 = ye, de) : G2;
          }, de;
        };
        var xa = n.map({ "inside-out": function(fe) {
          var P2, U2, G2 = fe.length, J2 = fe.map(Qi), oe = fe.map(Zi), de = n.range(G2).sort(function(lt, bt) {
            return J2[lt] - J2[bt];
          }), ye = 0, Te = 0, Fe = [], et = [];
          for (P2 = 0; P2 < G2; ++P2) U2 = de[P2], ye < Te ? (ye += oe[U2], Fe.push(U2)) : (Te += oe[U2], et.push(U2));
          return et.reverse().concat(Fe);
        }, reverse: function(fe) {
          return n.range(fe.length).reverse();
        }, default: ci }), la = n.map({ silhouette: function(fe) {
          var P2, U2, G2, J2 = fe.length, oe = fe[0].length, de = [], ye = 0, Te = [];
          for (U2 = 0; U2 < oe; ++U2) {
            for (P2 = 0, G2 = 0; P2 < J2; P2++) G2 += fe[P2][U2][1];
            G2 > ye && (ye = G2), de.push(G2);
          }
          for (U2 = 0; U2 < oe; ++U2) Te[U2] = (ye - de[U2]) / 2;
          return Te;
        }, wiggle: function(fe) {
          var P2, U2, G2, J2, oe, de, ye, Te, Fe, et = fe.length, lt = fe[0], bt = lt.length, It = [];
          for (It[0] = Te = Fe = 0, U2 = 1; U2 < bt; ++U2) {
            for (P2 = 0, J2 = 0; P2 < et; ++P2) J2 += fe[P2][U2][1];
            for (P2 = 0, oe = 0, ye = lt[U2][0] - lt[U2 - 1][0]; P2 < et; ++P2) {
              for (G2 = 0, de = (fe[P2][U2][1] - fe[P2][U2 - 1][1]) / (2 * ye); G2 < P2; ++G2) de += (fe[G2][U2][1] - fe[G2][U2 - 1][1]) / ye;
              oe += de * fe[P2][U2][1];
            }
            It[U2] = Te -= J2 ? oe / J2 * ye : 0, Te < Fe && (Fe = Te);
          }
          for (U2 = 0; U2 < bt; ++U2) It[U2] -= Fe;
          return It;
        }, expand: function(fe) {
          var P2, U2, G2, J2 = fe.length, oe = fe[0].length, de = 1 / J2, ye = [];
          for (U2 = 0; U2 < oe; ++U2) {
            for (P2 = 0, G2 = 0; P2 < J2; P2++) G2 += fe[P2][U2][1];
            if (G2) for (P2 = 0; P2 < J2; P2++) fe[P2][U2][1] /= G2;
            else for (P2 = 0; P2 < J2; P2++) fe[P2][U2][1] = de;
          }
          for (U2 = 0; U2 < oe; ++U2) ye[U2] = 0;
          return ye;
        }, zero: Ci });
        function ci(fe) {
          return n.range(fe.length);
        }
        function Ci(fe) {
          for (var P2 = -1, U2 = fe[0].length, G2 = []; ++P2 < U2; ) G2[P2] = 0;
          return G2;
        }
        function Qi(fe) {
          for (var P2, U2 = 1, G2 = 0, J2 = fe[0][1], oe = fe.length; U2 < oe; ++U2) (P2 = fe[U2][1]) > J2 && (G2 = U2, J2 = P2);
          return G2;
        }
        function Zi(fe) {
          return fe.reduce(eo, 0);
        }
        function eo(fe, P2) {
          return fe + P2[1];
        }
        function Es(fe, P2) {
          return vs(fe, Math.ceil(Math.log(P2.length) / Math.LN2 + 1));
        }
        function vs(fe, P2) {
          for (var U2 = -1, G2 = +fe[0], J2 = (fe[1] - G2) / P2, oe = []; ++U2 <= P2; ) oe[U2] = J2 * U2 + G2;
          return oe;
        }
        function Vo(fe) {
          return [n.min(fe), n.max(fe)];
        }
        function jo(fe, P2) {
          return fe.value - P2.value;
        }
        function ms(fe, P2) {
          var U2 = fe._pack_next;
          fe._pack_next = P2, P2._pack_prev = fe, P2._pack_next = U2, U2._pack_prev = P2;
        }
        function al(fe, P2) {
          fe._pack_next = P2, P2._pack_prev = fe;
        }
        function Xl(fe, P2) {
          var U2 = P2.x - fe.x, G2 = P2.y - fe.y, J2 = fe.r + P2.r;
          return 0.999 * J2 * J2 > U2 * U2 + G2 * G2;
        }
        function Kl(fe) {
          if ((P2 = fe.children) && (Te = P2.length)) {
            var P2, U2, G2, J2, oe, de, ye, Te, Fe = 1 / 0, et = -1 / 0, lt = 1 / 0, bt = -1 / 0;
            if (P2.forEach(Yl), (U2 = P2[0]).x = -U2.r, U2.y = 0, $t(U2), Te > 1 && ((G2 = P2[1]).x = G2.r, G2.y = 0, $t(G2), Te > 2)) for (qi(U2, G2, J2 = P2[2]), $t(J2), ms(U2, J2), U2._pack_prev = J2, ms(J2, G2), G2 = U2._pack_next, oe = 3; oe < Te; oe++) {
              qi(U2, G2, J2 = P2[oe]);
              var It = 0, Rt = 1, Ft = 1;
              for (de = G2._pack_next; de !== G2; de = de._pack_next, Rt++) if (Xl(de, J2)) {
                It = 1;
                break;
              }
              if (It == 1) for (ye = U2._pack_prev; ye !== de._pack_prev && !Xl(ye, J2); ye = ye._pack_prev, Ft++) ;
              It ? (Rt < Ft || Rt == Ft && G2.r < U2.r ? al(U2, G2 = de) : al(U2 = ye, G2), oe--) : (ms(U2, J2), G2 = J2, $t(J2));
            }
            var Pt = (Fe + et) / 2, Mt = (lt + bt) / 2, qt = 0;
            for (oe = 0; oe < Te; oe++) (J2 = P2[oe]).x -= Pt, J2.y -= Mt, qt = Math.max(qt, J2.r + Math.sqrt(J2.x * J2.x + J2.y * J2.y));
            fe.r = qt, P2.forEach(Zl);
          }
          function $t(Yt) {
            Fe = Math.min(Yt.x - Yt.r, Fe), et = Math.max(Yt.x + Yt.r, et), lt = Math.min(Yt.y - Yt.r, lt), bt = Math.max(Yt.y + Yt.r, bt);
          }
        }
        function Yl(fe) {
          fe._pack_next = fe._pack_prev = fe;
        }
        function Zl(fe) {
          delete fe._pack_next, delete fe._pack_prev;
        }
        function qi(fe, P2, U2) {
          var G2 = fe.r + U2.r, J2 = P2.x - fe.x, oe = P2.y - fe.y;
          if (G2 && (J2 || oe)) {
            var de = P2.r + U2.r, ye = J2 * J2 + oe * oe, Te = 0.5 + ((G2 *= G2) - (de *= de)) / (2 * ye), Fe = Math.sqrt(Math.max(0, 2 * de * (G2 + ye) - (G2 -= ye) * G2 - de * de)) / (2 * ye);
            U2.x = fe.x + Te * J2 + Fe * oe, U2.y = fe.y + Te * oe - Fe * J2;
          } else U2.x = fe.x + G2, U2.y = fe.y;
        }
        function At(fe, P2) {
          return fe.parent == P2.parent ? 1 : 2;
        }
        function Ht(fe) {
          var P2 = fe.children;
          return P2.length ? P2[0] : fe.t;
        }
        function dr(fe) {
          var P2, U2 = fe.children;
          return (P2 = U2.length) ? U2[P2 - 1] : fe.t;
        }
        function Qt(fe, P2, U2) {
          var G2 = U2 / (P2.i - fe.i);
          P2.c -= G2, P2.s += U2, fe.c += G2, P2.z += U2, P2.m += U2;
        }
        function vr(fe, P2, U2) {
          return fe.a.parent === P2.parent ? fe.a : U2;
        }
        function Vr(fe) {
          return { x: fe.x, y: fe.y, dx: fe.dx, dy: fe.dy };
        }
        function Jr(fe, P2) {
          var U2 = fe.x + P2[3], G2 = fe.y + P2[0], J2 = fe.dx - P2[1] - P2[3], oe = fe.dy - P2[0] - P2[2];
          return J2 < 0 && (U2 += J2 / 2, J2 = 0), oe < 0 && (G2 += oe / 2, oe = 0), { x: U2, y: G2, dx: J2, dy: oe };
        }
        function dn(fe) {
          var P2 = fe[0], U2 = fe[fe.length - 1];
          return P2 < U2 ? [P2, U2] : [U2, P2];
        }
        function En(fe) {
          return fe.rangeExtent ? fe.rangeExtent() : dn(fe.range());
        }
        function Tn(fe, P2, U2, G2) {
          var J2 = U2(fe[0], fe[1]), oe = G2(P2[0], P2[1]);
          return function(de) {
            return oe(J2(de));
          };
        }
        function Pn(fe, P2) {
          var U2, G2 = 0, J2 = fe.length - 1, oe = fe[G2], de = fe[J2];
          return de < oe && (U2 = G2, G2 = J2, J2 = U2, U2 = oe, oe = de, de = U2), fe[G2] = P2.floor(oe), fe[J2] = P2.ceil(de), fe;
        }
        function Gn(fe) {
          return fe ? { floor: function(P2) {
            return Math.floor(P2 / fe) * fe;
          }, ceil: function(P2) {
            return Math.ceil(P2 / fe) * fe;
          } } : Dn;
        }
        n.layout.histogram = function() {
          var fe = true, P2 = Number, U2 = Vo, G2 = Es;
          function J2(oe, de) {
            for (var ye, Te, Fe = [], et = oe.map(P2, this), lt = U2.call(this, et, de), bt = G2.call(this, lt, et, de), It = (de = -1, et.length), Rt = bt.length - 1, Ft = fe ? 1 : 1 / It; ++de < Rt; ) (ye = Fe[de] = []).dx = bt[de + 1] - (ye.x = bt[de]), ye.y = 0;
            if (Rt > 0) for (de = -1; ++de < It; ) (Te = et[de]) >= lt[0] && Te <= lt[1] && ((ye = Fe[n.bisect(bt, Te, 1, Rt) - 1]).y += Ft, ye.push(oe[de]));
            return Fe;
          }
          return J2.value = function(oe) {
            return arguments.length ? (P2 = oe, J2) : P2;
          }, J2.range = function(oe) {
            return arguments.length ? (U2 = Ar(oe), J2) : U2;
          }, J2.bins = function(oe) {
            return arguments.length ? (G2 = typeof oe == "number" ? function(de) {
              return vs(de, oe);
            } : Ar(oe), J2) : G2;
          }, J2.frequency = function(oe) {
            return arguments.length ? (fe = !!oe, J2) : fe;
          }, J2;
        }, n.layout.pack = function() {
          var fe, P2 = n.layout.hierarchy().sort(jo), U2 = 0, G2 = [1, 1];
          function J2(oe, de) {
            var ye = P2.call(this, oe, de), Te = ye[0], Fe = G2[0], et = G2[1], lt = fe == null ? Math.sqrt : typeof fe == "function" ? fe : function() {
              return fe;
            };
            if (Te.x = Te.y = 0, fr(Te, function(It) {
              It.r = +lt(It.value);
            }), fr(Te, Kl), U2) {
              var bt = U2 * (fe ? 1 : Math.max(2 * Te.r / Fe, 2 * Te.r / et)) / 2;
              fr(Te, function(It) {
                It.r += bt;
              }), fr(Te, Kl), fr(Te, function(It) {
                It.r -= bt;
              });
            }
            return function It(Rt, Ft, Pt, Mt) {
              var qt = Rt.children;
              if (Rt.x = Ft += Mt * Rt.x, Rt.y = Pt += Mt * Rt.y, Rt.r *= Mt, qt) for (var $t = -1, Yt = qt.length; ++$t < Yt; ) It(qt[$t], Ft, Pt, Mt);
            }(Te, Fe / 2, et / 2, fe ? 1 : 1 / Math.max(2 * Te.r / Fe, 2 * Te.r / et)), ye;
          }
          return J2.size = function(oe) {
            return arguments.length ? (G2 = oe, J2) : G2;
          }, J2.radius = function(oe) {
            return arguments.length ? (fe = oe == null || typeof oe == "function" ? oe : +oe, J2) : fe;
          }, J2.padding = function(oe) {
            return arguments.length ? (U2 = +oe, J2) : U2;
          }, or(J2, P2);
        }, n.layout.tree = function() {
          var fe = n.layout.hierarchy().sort(null).value(null), P2 = At, U2 = [1, 1], G2 = null;
          function J2(Te, Fe) {
            var et = fe.call(this, Te, Fe), lt = et[0], bt = function($t) {
              for (var Yt, cr = { A: null, children: [$t] }, kr = [cr]; (Yt = kr.pop()) != null; ) for (var Pr, Or = Yt.children, xn = 0, yn = Or.length; xn < yn; ++xn) kr.push((Or[xn] = Pr = { _: Or[xn], parent: Yt, children: (Pr = Or[xn].children) && Pr.slice() || [], A: null, a: null, z: 0, m: 0, c: 0, s: 0, t: null, i: xn }).a = Pr);
              return cr.children[0];
            }(lt);
            if (fr(bt, oe), bt.parent.m = -bt.z, nr(bt, de), G2) nr(lt, ye);
            else {
              var It = lt, Rt = lt, Ft = lt;
              nr(lt, function($t) {
                $t.x < It.x && (It = $t), $t.x > Rt.x && (Rt = $t), $t.depth > Ft.depth && (Ft = $t);
              });
              var Pt = P2(It, Rt) / 2 - It.x, Mt = U2[0] / (Rt.x + P2(Rt, It) / 2 + Pt), qt = U2[1] / (Ft.depth || 1);
              nr(lt, function($t) {
                $t.x = ($t.x + Pt) * Mt, $t.y = $t.depth * qt;
              });
            }
            return et;
          }
          function oe(Te) {
            var Fe = Te.children, et = Te.parent.children, lt = Te.i ? et[Te.i - 1] : null;
            if (Fe.length) {
              (function(It) {
                for (var Rt, Ft = 0, Pt = 0, Mt = It.children, qt = Mt.length; --qt >= 0; ) (Rt = Mt[qt]).z += Ft, Rt.m += Ft, Ft += Rt.s + (Pt += Rt.c);
              })(Te);
              var bt = (Fe[0].z + Fe[Fe.length - 1].z) / 2;
              lt ? (Te.z = lt.z + P2(Te._, lt._), Te.m = Te.z - bt) : Te.z = bt;
            } else lt && (Te.z = lt.z + P2(Te._, lt._));
            Te.parent.A = function(It, Rt, Ft) {
              if (Rt) {
                for (var Pt, Mt = It, qt = It, $t = Rt, Yt = Mt.parent.children[0], cr = Mt.m, kr = qt.m, Pr = $t.m, Or = Yt.m; $t = dr($t), Mt = Ht(Mt), $t && Mt; ) Yt = Ht(Yt), (qt = dr(qt)).a = It, (Pt = $t.z + Pr - Mt.z - cr + P2($t._, Mt._)) > 0 && (Qt(vr($t, It, Ft), It, Pt), cr += Pt, kr += Pt), Pr += $t.m, cr += Mt.m, Or += Yt.m, kr += qt.m;
                $t && !dr(qt) && (qt.t = $t, qt.m += Pr - kr), Mt && !Ht(Yt) && (Yt.t = Mt, Yt.m += cr - Or, Ft = It);
              }
              return Ft;
            }(Te, lt, Te.parent.A || et[0]);
          }
          function de(Te) {
            Te._.x = Te.z + Te.parent.m, Te.m += Te.parent.m;
          }
          function ye(Te) {
            Te.x *= U2[0], Te.y = Te.depth * U2[1];
          }
          return J2.separation = function(Te) {
            return arguments.length ? (P2 = Te, J2) : P2;
          }, J2.size = function(Te) {
            return arguments.length ? (G2 = (U2 = Te) == null ? ye : null, J2) : G2 ? null : U2;
          }, J2.nodeSize = function(Te) {
            return arguments.length ? (G2 = (U2 = Te) == null ? null : ye, J2) : G2 ? U2 : null;
          }, or(J2, fe);
        }, n.layout.cluster = function() {
          var fe = n.layout.hierarchy().sort(null).value(null), P2 = At, U2 = [1, 1], G2 = false;
          function J2(oe, de) {
            var ye, Te = fe.call(this, oe, de), Fe = Te[0], et = 0;
            fr(Fe, function(Ft) {
              var Pt = Ft.children;
              Pt && Pt.length ? (Ft.x = function(Mt) {
                return Mt.reduce(function(qt, $t) {
                  return qt + $t.x;
                }, 0) / Mt.length;
              }(Pt), Ft.y = function(Mt) {
                return 1 + n.max(Mt, function(qt) {
                  return qt.y;
                });
              }(Pt)) : (Ft.x = ye ? et += P2(Ft, ye) : 0, Ft.y = 0, ye = Ft);
            });
            var lt = function Ft(Pt) {
              var Mt = Pt.children;
              return Mt && Mt.length ? Ft(Mt[0]) : Pt;
            }(Fe), bt = function Ft(Pt) {
              var Mt, qt = Pt.children;
              return qt && (Mt = qt.length) ? Ft(qt[Mt - 1]) : Pt;
            }(Fe), It = lt.x - P2(lt, bt) / 2, Rt = bt.x + P2(bt, lt) / 2;
            return fr(Fe, G2 ? function(Ft) {
              Ft.x = (Ft.x - Fe.x) * U2[0], Ft.y = (Fe.y - Ft.y) * U2[1];
            } : function(Ft) {
              Ft.x = (Ft.x - It) / (Rt - It) * U2[0], Ft.y = (1 - (Fe.y ? Ft.y / Fe.y : 1)) * U2[1];
            }), Te;
          }
          return J2.separation = function(oe) {
            return arguments.length ? (P2 = oe, J2) : P2;
          }, J2.size = function(oe) {
            return arguments.length ? (G2 = (U2 = oe) == null, J2) : G2 ? null : U2;
          }, J2.nodeSize = function(oe) {
            return arguments.length ? (G2 = (U2 = oe) != null, J2) : G2 ? U2 : null;
          }, or(J2, fe);
        }, n.layout.treemap = function() {
          var fe, P2 = n.layout.hierarchy(), U2 = Math.round, G2 = [1, 1], J2 = null, oe = Vr, de = false, ye = "squarify", Te = 0.5 * (1 + Math.sqrt(5));
          function Fe(Ft, Pt) {
            for (var Mt, qt, $t = -1, Yt = Ft.length; ++$t < Yt; ) qt = (Mt = Ft[$t]).value * (Pt < 0 ? 0 : Pt), Mt.area = isNaN(qt) || qt <= 0 ? 0 : qt;
          }
          function et(Ft) {
            var Pt = Ft.children;
            if (Pt && Pt.length) {
              var Mt, qt, $t, Yt = oe(Ft), cr = [], kr = Pt.slice(), Pr = 1 / 0, Or = ye === "slice" ? Yt.dx : ye === "dice" ? Yt.dy : ye === "slice-dice" ? 1 & Ft.depth ? Yt.dy : Yt.dx : Math.min(Yt.dx, Yt.dy);
              for (Fe(kr, Yt.dx * Yt.dy / Ft.value), cr.area = 0; ($t = kr.length) > 0; ) cr.push(Mt = kr[$t - 1]), cr.area += Mt.area, ye !== "squarify" || (qt = bt(cr, Or)) <= Pr ? (kr.pop(), Pr = qt) : (cr.area -= cr.pop().area, It(cr, Or, Yt, false), Or = Math.min(Yt.dx, Yt.dy), cr.length = cr.area = 0, Pr = 1 / 0);
              cr.length && (It(cr, Or, Yt, true), cr.length = cr.area = 0), Pt.forEach(et);
            }
          }
          function lt(Ft) {
            var Pt = Ft.children;
            if (Pt && Pt.length) {
              var Mt, qt = oe(Ft), $t = Pt.slice(), Yt = [];
              for (Fe($t, qt.dx * qt.dy / Ft.value), Yt.area = 0; Mt = $t.pop(); ) Yt.push(Mt), Yt.area += Mt.area, Mt.z != null && (It(Yt, Mt.z ? qt.dx : qt.dy, qt, !$t.length), Yt.length = Yt.area = 0);
              Pt.forEach(lt);
            }
          }
          function bt(Ft, Pt) {
            for (var Mt, qt = Ft.area, $t = 0, Yt = 1 / 0, cr = -1, kr = Ft.length; ++cr < kr; ) (Mt = Ft[cr].area) && (Mt < Yt && (Yt = Mt), Mt > $t && ($t = Mt));
            return Pt *= Pt, (qt *= qt) ? Math.max(Pt * $t * Te / qt, qt / (Pt * Yt * Te)) : 1 / 0;
          }
          function It(Ft, Pt, Mt, qt) {
            var $t, Yt = -1, cr = Ft.length, kr = Mt.x, Pr = Mt.y, Or = Pt ? U2(Ft.area / Pt) : 0;
            if (Pt == Mt.dx) {
              for ((qt || Or > Mt.dy) && (Or = Mt.dy); ++Yt < cr; ) ($t = Ft[Yt]).x = kr, $t.y = Pr, $t.dy = Or, kr += $t.dx = Math.min(Mt.x + Mt.dx - kr, Or ? U2($t.area / Or) : 0);
              $t.z = true, $t.dx += Mt.x + Mt.dx - kr, Mt.y += Or, Mt.dy -= Or;
            } else {
              for ((qt || Or > Mt.dx) && (Or = Mt.dx); ++Yt < cr; ) ($t = Ft[Yt]).x = kr, $t.y = Pr, $t.dx = Or, Pr += $t.dy = Math.min(Mt.y + Mt.dy - Pr, Or ? U2($t.area / Or) : 0);
              $t.z = false, $t.dy += Mt.y + Mt.dy - Pr, Mt.x += Or, Mt.dx -= Or;
            }
          }
          function Rt(Ft) {
            var Pt = fe || P2(Ft), Mt = Pt[0];
            return Mt.x = Mt.y = 0, Mt.value ? (Mt.dx = G2[0], Mt.dy = G2[1]) : Mt.dx = Mt.dy = 0, fe && P2.revalue(Mt), Fe([Mt], Mt.dx * Mt.dy / Mt.value), (fe ? lt : et)(Mt), de && (fe = Pt), Pt;
          }
          return Rt.size = function(Ft) {
            return arguments.length ? (G2 = Ft, Rt) : G2;
          }, Rt.padding = function(Ft) {
            if (!arguments.length) return J2;
            function Pt($t) {
              var Yt = Ft.call(Rt, $t, $t.depth);
              return Yt == null ? Vr($t) : Jr($t, typeof Yt == "number" ? [Yt, Yt, Yt, Yt] : Yt);
            }
            function Mt($t) {
              return Jr($t, Ft);
            }
            var qt;
            return oe = (J2 = Ft) == null ? Vr : (qt = typeof Ft) == "function" ? Pt : (qt === "number" && (Ft = [Ft, Ft, Ft, Ft]), Mt), Rt;
          }, Rt.round = function(Ft) {
            return arguments.length ? (U2 = Ft ? Math.round : Number, Rt) : U2 != Number;
          }, Rt.sticky = function(Ft) {
            return arguments.length ? (de = Ft, fe = null, Rt) : de;
          }, Rt.ratio = function(Ft) {
            return arguments.length ? (Te = Ft, Rt) : Te;
          }, Rt.mode = function(Ft) {
            return arguments.length ? (ye = Ft + "", Rt) : ye;
          }, or(Rt, P2);
        }, n.random = { normal: function(fe, P2) {
          var U2 = arguments.length;
          return U2 < 2 && (P2 = 1), U2 < 1 && (fe = 0), function() {
            var G2, J2, oe;
            do
              oe = (G2 = 2 * Math.random() - 1) * G2 + (J2 = 2 * Math.random() - 1) * J2;
            while (!oe || oe > 1);
            return fe + P2 * G2 * Math.sqrt(-2 * Math.log(oe) / oe);
          };
        }, logNormal: function() {
          var fe = n.random.normal.apply(n, arguments);
          return function() {
            return Math.exp(fe());
          };
        }, bates: function(fe) {
          var P2 = n.random.irwinHall(fe);
          return function() {
            return P2() / fe;
          };
        }, irwinHall: function(fe) {
          return function() {
            for (var P2 = 0, U2 = 0; U2 < fe; U2++) P2 += Math.random();
            return P2;
          };
        } }, n.scale = {};
        var Dn = { floor: I2, ceil: I2 };
        function $n(fe, P2, U2, G2) {
          var J2 = [], oe = [], de = 0, ye = Math.min(fe.length, P2.length) - 1;
          for (fe[ye] < fe[0] && (fe = fe.slice().reverse(), P2 = P2.slice().reverse()); ++de <= ye; ) J2.push(U2(fe[de - 1], fe[de])), oe.push(G2(P2[de - 1], P2[de]));
          return function(Te) {
            var Fe = n.bisect(fe, Te, 1, ye) - 1;
            return oe[Fe](J2[Fe](Te));
          };
        }
        function ca(fe, P2) {
          return n.rebind(fe, P2, "range", "rangeRound", "interpolate", "clamp");
        }
        function ya(fe, P2) {
          return Pn(fe, Gn(Ra(fe, P2)[2])), Pn(fe, Gn(Ra(fe, P2)[2])), fe;
        }
        function Ra(fe, P2) {
          P2 == null && (P2 = 10);
          var U2 = dn(fe), G2 = U2[1] - U2[0], J2 = Math.pow(10, Math.floor(Math.log(G2 / P2) / Math.LN10)), oe = P2 / G2 * J2;
          return oe <= 0.15 ? J2 *= 10 : oe <= 0.35 ? J2 *= 5 : oe <= 0.75 && (J2 *= 2), U2[0] = Math.ceil(U2[0] / J2) * J2, U2[1] = Math.floor(U2[1] / J2) * J2 + 0.5 * J2, U2[2] = J2, U2;
        }
        function mn(fe, P2) {
          return n.range.apply(n, Ra(fe, P2));
        }
        n.scale.linear = function() {
          return function fe(P2, U2, G2, J2) {
            var oe, de;
            function ye() {
              var Fe = Math.min(P2.length, U2.length) > 2 ? $n : Tn, et = J2 ? ac : _h;
              return oe = Fe(P2, U2, et, G2), de = Fe(U2, P2, et, nl), Te;
            }
            function Te(Fe) {
              return oe(Fe);
            }
            return Te.invert = function(Fe) {
              return de(Fe);
            }, Te.domain = function(Fe) {
              return arguments.length ? (P2 = Fe.map(Number), ye()) : P2;
            }, Te.range = function(Fe) {
              return arguments.length ? (U2 = Fe, ye()) : U2;
            }, Te.rangeRound = function(Fe) {
              return Te.range(Fe).interpolate(zc);
            }, Te.clamp = function(Fe) {
              return arguments.length ? (J2 = Fe, ye()) : J2;
            }, Te.interpolate = function(Fe) {
              return arguments.length ? (G2 = Fe, ye()) : G2;
            }, Te.ticks = function(Fe) {
              return mn(P2, Fe);
            }, Te.tickFormat = function(Fe, et) {
              return d3_scale_linearTickFormat(P2, Fe, et);
            }, Te.nice = function(Fe) {
              return ya(P2, Fe), ye();
            }, Te.copy = function() {
              return fe(P2, U2, G2, J2);
            }, ye();
          }([0, 1], [0, 1], nl, false);
        }, n.scale.log = function() {
          return function fe(P2, U2, G2, J2) {
            function oe(Te) {
              return (G2 ? Math.log(Te < 0 ? 0 : Te) : -Math.log(Te > 0 ? 0 : -Te)) / Math.log(U2);
            }
            function de(Te) {
              return G2 ? Math.pow(U2, Te) : -Math.pow(U2, -Te);
            }
            function ye(Te) {
              return P2(oe(Te));
            }
            return ye.invert = function(Te) {
              return de(P2.invert(Te));
            }, ye.domain = function(Te) {
              return arguments.length ? (G2 = Te[0] >= 0, P2.domain((J2 = Te.map(Number)).map(oe)), ye) : J2;
            }, ye.base = function(Te) {
              return arguments.length ? (U2 = +Te, P2.domain(J2.map(oe)), ye) : U2;
            }, ye.nice = function() {
              var Te = Pn(J2.map(oe), G2 ? Math : Fa);
              return P2.domain(Te), J2 = Te.map(de), ye;
            }, ye.ticks = function() {
              var Te = dn(J2), Fe = [], et = Te[0], lt = Te[1], bt = Math.floor(oe(et)), It = Math.ceil(oe(lt)), Rt = U2 % 1 ? 2 : U2;
              if (isFinite(It - bt)) {
                if (G2) {
                  for (; bt < It; bt++) for (var Ft = 1; Ft < Rt; Ft++) Fe.push(de(bt) * Ft);
                  Fe.push(de(bt));
                } else for (Fe.push(de(bt)); bt++ < It; ) for (Ft = Rt - 1; Ft > 0; Ft--) Fe.push(de(bt) * Ft);
                for (bt = 0; Fe[bt] < et; bt++) ;
                for (It = Fe.length; Fe[It - 1] > lt; It--) ;
                Fe = Fe.slice(bt, It);
              }
              return Fe;
            }, ye.copy = function() {
              return fe(P2.copy(), U2, G2, J2);
            }, ca(ye, P2);
          }(n.scale.linear().domain([0, 1]), 10, true, [1, 10]);
        };
        var Fa = { floor: function(fe) {
          return -Math.ceil(-fe);
        }, ceil: function(fe) {
          return -Math.floor(-fe);
        } };
        function ra(fe) {
          return function(P2) {
            return P2 < 0 ? -Math.pow(-P2, fe) : Math.pow(P2, fe);
          };
        }
        n.scale.pow = function() {
          return function fe(P2, U2, G2) {
            var J2 = ra(U2), oe = ra(1 / U2);
            function de(ye) {
              return P2(J2(ye));
            }
            return de.invert = function(ye) {
              return oe(P2.invert(ye));
            }, de.domain = function(ye) {
              return arguments.length ? (P2.domain((G2 = ye.map(Number)).map(J2)), de) : G2;
            }, de.ticks = function(ye) {
              return mn(G2, ye);
            }, de.tickFormat = function(ye, Te) {
              return d3_scale_linearTickFormat(G2, ye, Te);
            }, de.nice = function(ye) {
              return de.domain(ya(G2, ye));
            }, de.exponent = function(ye) {
              return arguments.length ? (J2 = ra(U2 = ye), oe = ra(1 / U2), P2.domain(G2.map(J2)), de) : U2;
            }, de.copy = function() {
              return fe(P2.copy(), U2, G2);
            }, ca(de, P2);
          }(n.scale.linear(), 1, [0, 1]);
        }, n.scale.sqrt = function() {
          return n.scale.pow().exponent(0.5);
        }, n.scale.ordinal = function() {
          return function fe(P2, U2) {
            var G2, J2, oe;
            function de(Te) {
              return J2[((G2.get(Te) || (U2.t === "range" ? G2.set(Te, P2.push(Te)) : NaN)) - 1) % J2.length];
            }
            function ye(Te, Fe) {
              return n.range(P2.length).map(function(et) {
                return Te + Fe * et;
              });
            }
            return de.domain = function(Te) {
              if (!arguments.length) return P2;
              P2 = [], G2 = new k();
              for (var Fe, et = -1, lt = Te.length; ++et < lt; ) G2.has(Fe = Te[et]) || G2.set(Fe, P2.push(Fe));
              return de[U2.t].apply(de, U2.a);
            }, de.range = function(Te) {
              return arguments.length ? (J2 = Te, oe = 0, U2 = { t: "range", a: arguments }, de) : J2;
            }, de.rangePoints = function(Te, Fe) {
              arguments.length < 2 && (Fe = 0);
              var et = Te[0], lt = Te[1], bt = P2.length < 2 ? (et = (et + lt) / 2, 0) : (lt - et) / (P2.length - 1 + Fe);
              return J2 = ye(et + bt * Fe / 2, bt), oe = 0, U2 = { t: "rangePoints", a: arguments }, de;
            }, de.rangeRoundPoints = function(Te, Fe) {
              arguments.length < 2 && (Fe = 0);
              var et = Te[0], lt = Te[1], bt = P2.length < 2 ? (et = lt = Math.round((et + lt) / 2), 0) : (lt - et) / (P2.length - 1 + Fe) | 0;
              return J2 = ye(et + Math.round(bt * Fe / 2 + (lt - et - (P2.length - 1 + Fe) * bt) / 2), bt), oe = 0, U2 = { t: "rangeRoundPoints", a: arguments }, de;
            }, de.rangeBands = function(Te, Fe, et) {
              arguments.length < 2 && (Fe = 0), arguments.length < 3 && (et = Fe);
              var lt = Te[1] < Te[0], bt = Te[lt - 0], It = Te[1 - lt], Rt = (It - bt) / (P2.length - Fe + 2 * et);
              return J2 = ye(bt + Rt * et, Rt), lt && J2.reverse(), oe = Rt * (1 - Fe), U2 = { t: "rangeBands", a: arguments }, de;
            }, de.rangeRoundBands = function(Te, Fe, et) {
              arguments.length < 2 && (Fe = 0), arguments.length < 3 && (et = Fe);
              var lt = Te[1] < Te[0], bt = Te[lt - 0], It = Te[1 - lt], Rt = Math.floor((It - bt) / (P2.length - Fe + 2 * et));
              return J2 = ye(bt + Math.round((It - bt - (P2.length - Fe) * Rt) / 2), Rt), lt && J2.reverse(), oe = Math.round(Rt * (1 - Fe)), U2 = { t: "rangeRoundBands", a: arguments }, de;
            }, de.rangeBand = function() {
              return oe;
            }, de.rangeExtent = function() {
              return dn(U2.a[0]);
            }, de.copy = function() {
              return fe(P2, U2);
            }, de.domain(P2);
          }([], { t: "range", a: [[]] });
        }, n.scale.category10 = function() {
          return n.scale.ordinal().range(va);
        }, n.scale.category20 = function() {
          return n.scale.ordinal().range(Ia);
        }, n.scale.category20b = function() {
          return n.scale.ordinal().range(Si);
        }, n.scale.category20c = function() {
          return n.scale.ordinal().range(Vi);
        };
        var va = [2062260, 16744206, 2924588, 14034728, 9725885, 9197131, 14907330, 8355711, 12369186, 1556175].map(Vt), Ia = [2062260, 11454440, 16744206, 16759672, 2924588, 10018698, 14034728, 16750742, 9725885, 12955861, 9197131, 12885140, 14907330, 16234194, 8355711, 13092807, 12369186, 14408589, 1556175, 10410725].map(Vt), Si = [3750777, 5395619, 7040719, 10264286, 6519097, 9216594, 11915115, 13556636, 9202993, 12426809, 15186514, 15190932, 8666169, 11356490, 14049643, 15177372, 8077683, 10834324, 13528509, 14589654].map(Vt), Vi = [3244733, 7057110, 10406625, 13032431, 15095053, 16616764, 16625259, 16634018, 3253076, 7652470, 10607003, 13101504, 7695281, 10394312, 12369372, 14342891, 6513507, 9868950, 12434877, 14277081].map(Vt);
        function Jn() {
          return 0;
        }
        n.scale.quantile = function() {
          return function fe(P2, U2) {
            var G2;
            function J2() {
              var de = 0, ye = U2.length;
              for (G2 = []; ++de < ye; ) G2[de - 1] = n.quantile(P2, de / ye);
              return oe;
            }
            function oe(de) {
              if (!isNaN(de = +de)) return U2[n.bisect(G2, de)];
            }
            return oe.domain = function(de) {
              return arguments.length ? (P2 = de.map(v).filter(m).sort(d), J2()) : P2;
            }, oe.range = function(de) {
              return arguments.length ? (U2 = de, J2()) : U2;
            }, oe.quantiles = function() {
              return G2;
            }, oe.invertExtent = function(de) {
              return (de = U2.indexOf(de)) < 0 ? [NaN, NaN] : [de > 0 ? G2[de - 1] : P2[0], de < G2.length ? G2[de] : P2[P2.length - 1]];
            }, oe.copy = function() {
              return fe(P2, U2);
            }, J2();
          }([], []);
        }, n.scale.quantize = function() {
          return function fe(P2, U2, G2) {
            var J2, oe;
            function de(Te) {
              return G2[Math.max(0, Math.min(oe, Math.floor(J2 * (Te - P2))))];
            }
            function ye() {
              return J2 = G2.length / (U2 - P2), oe = G2.length - 1, de;
            }
            return de.domain = function(Te) {
              return arguments.length ? (P2 = +Te[0], U2 = +Te[Te.length - 1], ye()) : [P2, U2];
            }, de.range = function(Te) {
              return arguments.length ? (G2 = Te, ye()) : G2;
            }, de.invertExtent = function(Te) {
              return [Te = (Te = G2.indexOf(Te)) < 0 ? NaN : Te / J2 + P2, Te + 1 / J2];
            }, de.copy = function() {
              return fe(P2, U2, G2);
            }, ye();
          }(0, 1, [0, 1]);
        }, n.scale.threshold = function() {
          return function fe(P2, U2) {
            function G2(J2) {
              if (J2 <= J2) return U2[n.bisect(P2, J2)];
            }
            return G2.domain = function(J2) {
              return arguments.length ? (P2 = J2, G2) : P2;
            }, G2.range = function(J2) {
              return arguments.length ? (U2 = J2, G2) : U2;
            }, G2.invertExtent = function(J2) {
              return J2 = U2.indexOf(J2), [P2[J2 - 1], P2[J2]];
            }, G2.copy = function() {
              return fe(P2, U2);
            }, G2;
          }([0.5], [0, 1]);
        }, n.scale.identity = function() {
          return function fe(P2) {
            function U2(G2) {
              return +G2;
            }
            return U2.invert = U2, U2.domain = U2.range = function(G2) {
              return arguments.length ? (P2 = G2.map(U2), U2) : P2;
            }, U2.ticks = function(G2) {
              return mn(P2, G2);
            }, U2.tickFormat = function(G2, J2) {
              return d3_scale_linearTickFormat(P2, G2, J2);
            }, U2.copy = function() {
              return fe(P2);
            }, U2;
          }([0, 1]);
        }, n.svg = {}, n.svg.arc = function() {
          var fe = Bi, P2 = li, U2 = Jn, G2 = Xi, J2 = Ki, oe = Fi, de = Do;
          function ye() {
            var Fe = Math.max(0, +fe.apply(this, arguments)), et = Math.max(0, +P2.apply(this, arguments)), lt = J2.apply(this, arguments) - at, bt = oe.apply(this, arguments) - at, It = Math.abs(bt - lt), Rt = lt > bt ? 0 : 1;
            if (et < Fe && (Ft = et, et = Fe, Fe = Ft), It >= Ye) return Te(et, Rt) + (Fe ? Te(Fe, 1 - Rt) : "") + "Z";
            var Ft, Pt, Mt, qt, $t, Yt, cr, kr, Pr, Or, xn, yn, Nn = 0, An = 0, ma = [];
            if ((qt = (+de.apply(this, arguments) || 0) / 2) && (Mt = G2 === Xi ? Math.sqrt(Fe * Fe + et * et) : +G2.apply(this, arguments), Rt || (An *= -1), et && (An = Ie(Mt / et * Math.sin(qt))), Fe && (Nn = Ie(Mt / Fe * Math.sin(qt)))), et) {
              $t = et * Math.cos(lt + An), Yt = et * Math.sin(lt + An), cr = et * Math.cos(bt - An), kr = et * Math.sin(bt - An);
              var Aa = Math.abs(bt - lt - 2 * An) <= Jt ? 0 : 1;
              if (An && Oa($t, Yt, cr, kr) === Rt ^ Aa) {
                var Qa = (lt + bt) / 2;
                $t = et * Math.cos(Qa), Yt = et * Math.sin(Qa), cr = kr = null;
              }
            } else $t = Yt = 0;
            if (Fe) {
              Pr = Fe * Math.cos(bt - Nn), Or = Fe * Math.sin(bt - Nn), xn = Fe * Math.cos(lt + Nn), yn = Fe * Math.sin(lt + Nn);
              var ln = Math.abs(lt - bt + 2 * Nn) <= Jt ? 0 : 1;
              if (Nn && Oa(Pr, Or, xn, yn) === 1 - Rt ^ ln) {
                var qn = (lt + bt) / 2;
                Pr = Fe * Math.cos(qn), Or = Fe * Math.sin(qn), xn = yn = null;
              }
            } else Pr = Or = 0;
            if (It > Ot && (Ft = Math.min(Math.abs(et - Fe) / 2, +U2.apply(this, arguments))) > 1e-3) {
              Pt = Fe < et ^ Rt ? 0 : 1;
              var Sa = Ft, _a = Ft;
              if (It < Jt) {
                var Pa = xn == null ? [Pr, Or] : cr == null ? [$t, Yt] : Ut([$t, Yt], [xn, yn], [cr, kr], [Pr, Or]), ii = $t - Pa[0], Oi = Yt - Pa[1], Da = cr - Pa[0], wi = kr - Pa[1], di = 1 / Math.sin(Math.acos((ii * Da + Oi * wi) / (Math.sqrt(ii * ii + Oi * Oi) * Math.sqrt(Da * Da + wi * wi))) / 2), ji = Math.sqrt(Pa[0] * Pa[0] + Pa[1] * Pa[1]);
                _a = Math.min(Ft, (Fe - ji) / (di - 1)), Sa = Math.min(Ft, (et - ji) / (di + 1));
              }
              if (cr != null) {
                var ki = mo(xn == null ? [Pr, Or] : [xn, yn], [$t, Yt], et, Sa, Rt), Wi = mo([cr, kr], [Pr, Or], et, Sa, Rt);
                Ft === Sa ? ma.push("M", ki[0], "A", Sa, ",", Sa, " 0 0,", Pt, " ", ki[1], "A", et, ",", et, " 0 ", 1 - Rt ^ Oa(ki[1][0], ki[1][1], Wi[1][0], Wi[1][1]), ",", Rt, " ", Wi[1], "A", Sa, ",", Sa, " 0 0,", Pt, " ", Wi[0]) : ma.push("M", ki[0], "A", Sa, ",", Sa, " 0 1,", Pt, " ", Wi[0]);
              } else ma.push("M", $t, ",", Yt);
              if (xn != null) {
                var to = mo([$t, Yt], [xn, yn], Fe, -_a, Rt), as = mo([Pr, Or], cr == null ? [$t, Yt] : [cr, kr], Fe, -_a, Rt);
                Ft === _a ? ma.push("L", as[0], "A", _a, ",", _a, " 0 0,", Pt, " ", as[1], "A", Fe, ",", Fe, " 0 ", Rt ^ Oa(as[1][0], as[1][1], to[1][0], to[1][1]), ",", 1 - Rt, " ", to[1], "A", _a, ",", _a, " 0 0,", Pt, " ", to[0]) : ma.push("L", as[0], "A", _a, ",", _a, " 0 0,", Pt, " ", to[0]);
              } else ma.push("L", Pr, ",", Or);
            } else ma.push("M", $t, ",", Yt), cr != null && ma.push("A", et, ",", et, " 0 ", Aa, ",", Rt, " ", cr, ",", kr), ma.push("L", Pr, ",", Or), xn != null && ma.push("A", Fe, ",", Fe, " 0 ", ln, ",", 1 - Rt, " ", xn, ",", yn);
            return ma.push("Z"), ma.join("");
          }
          function Te(Fe, et) {
            return "M0," + Fe + "A" + Fe + "," + Fe + " 0 1," + et + " 0," + -Fe + "A" + Fe + "," + Fe + " 0 1," + et + " 0," + Fe;
          }
          return ye.innerRadius = function(Fe) {
            return arguments.length ? (fe = Ar(Fe), ye) : fe;
          }, ye.outerRadius = function(Fe) {
            return arguments.length ? (P2 = Ar(Fe), ye) : P2;
          }, ye.cornerRadius = function(Fe) {
            return arguments.length ? (U2 = Ar(Fe), ye) : U2;
          }, ye.padRadius = function(Fe) {
            return arguments.length ? (G2 = Fe == Xi ? Xi : Ar(Fe), ye) : G2;
          }, ye.startAngle = function(Fe) {
            return arguments.length ? (J2 = Ar(Fe), ye) : J2;
          }, ye.endAngle = function(Fe) {
            return arguments.length ? (oe = Ar(Fe), ye) : oe;
          }, ye.padAngle = function(Fe) {
            return arguments.length ? (de = Ar(Fe), ye) : de;
          }, ye.centroid = function() {
            var Fe = (+fe.apply(this, arguments) + +P2.apply(this, arguments)) / 2, et = (+J2.apply(this, arguments) + +oe.apply(this, arguments)) / 2 - at;
            return [Math.cos(et) * Fe, Math.sin(et) * Fe];
          }, ye;
        };
        var Xi = "auto";
        function Bi(fe) {
          return fe.innerRadius;
        }
        function li(fe) {
          return fe.outerRadius;
        }
        function Ki(fe) {
          return fe.startAngle;
        }
        function Fi(fe) {
          return fe.endAngle;
        }
        function Do(fe) {
          return fe && fe.padAngle;
        }
        function Oa(fe, P2, U2, G2) {
          return (fe - U2) * P2 - (P2 - G2) * fe > 0 ? 0 : 1;
        }
        function mo(fe, P2, U2, G2, J2) {
          var oe = fe[0] - P2[0], de = fe[1] - P2[1], ye = (J2 ? G2 : -G2) / Math.sqrt(oe * oe + de * de), Te = ye * de, Fe = -ye * oe, et = fe[0] + Te, lt = fe[1] + Fe, bt = P2[0] + Te, It = P2[1] + Fe, Rt = (et + bt) / 2, Ft = (lt + It) / 2, Pt = bt - et, Mt = It - lt, qt = Pt * Pt + Mt * Mt, $t = U2 - G2, Yt = et * It - bt * lt, cr = (Mt < 0 ? -1 : 1) * Math.sqrt(Math.max(0, $t * $t * qt - Yt * Yt)), kr = (Yt * Mt - Pt * cr) / qt, Pr = (-Yt * Pt - Mt * cr) / qt, Or = (Yt * Mt + Pt * cr) / qt, xn = (-Yt * Pt + Mt * cr) / qt, yn = kr - Rt, Nn = Pr - Ft, An = Or - Rt, ma = xn - Ft;
          return yn * yn + Nn * Nn > An * An + ma * ma && (kr = Or, Pr = xn), [[kr - Te, Pr - Fe], [kr * U2 / $t, Pr * U2 / $t]];
        }
        function il() {
          return true;
        }
        function Jc(fe) {
          var P2 = tn, U2 = Zn, G2 = il, J2 = _u, oe = J2.key, de = 0.7;
          function ye(Te) {
            var Fe, et = [], lt = [], bt = -1, It = Te.length, Rt = Ar(P2), Ft = Ar(U2);
            function Pt() {
              et.push("M", J2(fe(lt), de));
            }
            for (; ++bt < It; ) G2.call(this, Fe = Te[bt], bt) ? lt.push([+Rt.call(this, Fe, bt), +Ft.call(this, Fe, bt)]) : lt.length && (Pt(), lt = []);
            return lt.length && Pt(), et.length ? et.join("") : null;
          }
          return ye.x = function(Te) {
            return arguments.length ? (P2 = Te, ye) : P2;
          }, ye.y = function(Te) {
            return arguments.length ? (U2 = Te, ye) : U2;
          }, ye.defined = function(Te) {
            return arguments.length ? (G2 = Te, ye) : G2;
          }, ye.interpolate = function(Te) {
            return arguments.length ? (oe = typeof Te == "function" ? J2 = Te : (J2 = bc.get(Te) || _u).key, ye) : oe;
          }, ye.tension = function(Te) {
            return arguments.length ? (de = Te, ye) : de;
          }, ye;
        }
        n.svg.line = function() {
          return Jc(I2);
        };
        var bc = n.map({ linear: _u, "linear-closed": gi, step: function(fe) {
          for (var P2 = 0, U2 = fe.length, G2 = fe[0], J2 = [G2[0], ",", G2[1]]; ++P2 < U2; ) J2.push("H", (G2[0] + (G2 = fe[P2])[0]) / 2, "V", G2[1]);
          return U2 > 1 && J2.push("H", G2[0]), J2.join("");
        }, "step-before": ls, "step-after": wu, basis: Sl, "basis-open": function(fe) {
          if (fe.length < 4) return _u(fe);
          for (var P2, U2 = [], G2 = -1, J2 = fe.length, oe = [0], de = [0]; ++G2 < 3; ) P2 = fe[G2], oe.push(P2[0]), de.push(P2[1]);
          for (U2.push(Fo(Jl, oe) + "," + Fo(Jl, de)), --G2; ++G2 < J2; ) P2 = fe[G2], oe.shift(), oe.push(P2[0]), de.shift(), de.push(P2[1]), qf(U2, oe, de);
          return U2.join("");
        }, "basis-closed": function(fe) {
          for (var P2, U2, G2 = -1, J2 = fe.length, oe = J2 + 4, de = [], ye = []; ++G2 < 4; ) U2 = fe[G2 % J2], de.push(U2[0]), ye.push(U2[1]);
          for (P2 = [Fo(Jl, de), ",", Fo(Jl, ye)], --G2; ++G2 < oe; ) U2 = fe[G2 % J2], de.shift(), de.push(U2[0]), ye.shift(), ye.push(U2[1]), qf(P2, de, ye);
          return P2.join("");
        }, bundle: function(fe, P2) {
          var U2 = fe.length - 1;
          if (U2) for (var G2, J2, oe = fe[0][0], de = fe[0][1], ye = fe[U2][0] - oe, Te = fe[U2][1] - de, Fe = -1; ++Fe <= U2; ) G2 = fe[Fe], J2 = Fe / U2, G2[0] = P2 * G2[0] + (1 - P2) * (oe + J2 * ye), G2[1] = P2 * G2[1] + (1 - P2) * (de + J2 * Te);
          return Sl(fe);
        }, cardinal: function(fe, P2) {
          return fe.length < 3 ? _u(fe) : fe[0] + go(fe, Ds(fe, P2));
        }, "cardinal-open": function(fe, P2) {
          return fe.length < 4 ? _u(fe) : fe[1] + go(fe.slice(1, -1), Ds(fe, P2));
        }, "cardinal-closed": function(fe, P2) {
          return fe.length < 3 ? gi(fe) : fe[0] + go((fe.push(fe[0]), fe), Ds([fe[fe.length - 2]].concat(fe, [fe[1]]), P2));
        }, monotone: function(fe) {
          return fe.length < 3 ? _u(fe) : fe[0] + go(fe, function(P2) {
            for (var U2, G2, J2, oe, de = [], ye = function(et) {
              for (var lt = 0, bt = et.length - 1, It = [], Rt = et[0], Ft = et[1], Pt = It[0] = Af(Rt, Ft); ++lt < bt; ) It[lt] = (Pt + (Pt = Af(Rt = Ft, Ft = et[lt + 1]))) / 2;
              return It[lt] = Pt, It;
            }(P2), Te = -1, Fe = P2.length - 1; ++Te < Fe; ) U2 = Af(P2[Te], P2[Te + 1]), y(U2) < Ot ? ye[Te] = ye[Te + 1] = 0 : (G2 = ye[Te] / U2, J2 = ye[Te + 1] / U2, (oe = G2 * G2 + J2 * J2) > 9 && (oe = 3 * U2 / Math.sqrt(oe), ye[Te] = oe * G2, ye[Te + 1] = oe * J2));
            for (Te = -1; ++Te <= Fe; ) oe = (P2[Math.min(Fe, Te + 1)][0] - P2[Math.max(0, Te - 1)][0]) / (6 * (1 + ye[Te] * ye[Te])), de.push([oe || 0, ye[Te] * oe || 0]);
            return de;
          }(fe));
        } });
        function _u(fe) {
          return fe.length > 1 ? fe.join("L") : fe + "Z";
        }
        function gi(fe) {
          return fe.join("L") + "Z";
        }
        function ls(fe) {
          for (var P2 = 0, U2 = fe.length, G2 = fe[0], J2 = [G2[0], ",", G2[1]]; ++P2 < U2; ) J2.push("V", (G2 = fe[P2])[1], "H", G2[0]);
          return J2.join("");
        }
        function wu(fe) {
          for (var P2 = 0, U2 = fe.length, G2 = fe[0], J2 = [G2[0], ",", G2[1]]; ++P2 < U2; ) J2.push("H", (G2 = fe[P2])[0], "V", G2[1]);
          return J2.join("");
        }
        function go(fe, P2) {
          if (P2.length < 1 || fe.length != P2.length && fe.length != P2.length + 2) return _u(fe);
          var U2 = fe.length != P2.length, G2 = "", J2 = fe[0], oe = fe[1], de = P2[0], ye = de, Te = 1;
          if (U2 && (G2 += "Q" + (oe[0] - 2 * de[0] / 3) + "," + (oe[1] - 2 * de[1] / 3) + "," + oe[0] + "," + oe[1], J2 = fe[1], Te = 2), P2.length > 1) {
            ye = P2[1], oe = fe[Te], Te++, G2 += "C" + (J2[0] + de[0]) + "," + (J2[1] + de[1]) + "," + (oe[0] - ye[0]) + "," + (oe[1] - ye[1]) + "," + oe[0] + "," + oe[1];
            for (var Fe = 2; Fe < P2.length; Fe++, Te++) oe = fe[Te], ye = P2[Fe], G2 += "S" + (oe[0] - ye[0]) + "," + (oe[1] - ye[1]) + "," + oe[0] + "," + oe[1];
          }
          if (U2) {
            var et = fe[Te];
            G2 += "Q" + (oe[0] + 2 * ye[0] / 3) + "," + (oe[1] + 2 * ye[1] / 3) + "," + et[0] + "," + et[1];
          }
          return G2;
        }
        function Ds(fe, P2) {
          for (var U2, G2 = [], J2 = (1 - P2) / 2, oe = fe[0], de = fe[1], ye = 1, Te = fe.length; ++ye < Te; ) U2 = oe, oe = de, de = fe[ye], G2.push([J2 * (de[0] - U2[0]), J2 * (de[1] - U2[1])]);
          return G2;
        }
        function Sl(fe) {
          if (fe.length < 3) return _u(fe);
          var P2 = 1, U2 = fe.length, G2 = fe[0], J2 = G2[0], oe = G2[1], de = [J2, J2, J2, (G2 = fe[1])[0]], ye = [oe, oe, oe, G2[1]], Te = [J2, ",", oe, "L", Fo(Jl, de), ",", Fo(Jl, ye)];
          for (fe.push(fe[U2 - 1]); ++P2 <= U2; ) G2 = fe[P2], de.shift(), de.push(G2[0]), ye.shift(), ye.push(G2[1]), qf(Te, de, ye);
          return fe.pop(), Te.push("L", G2), Te.join("");
        }
        function Fo(fe, P2) {
          return fe[0] * P2[0] + fe[1] * P2[1] + fe[2] * P2[2] + fe[3] * P2[3];
        }
        bc.forEach(function(fe, P2) {
          P2.key = fe, P2.closed = /-closed$/.test(fe);
        });
        var fu = [0, 2 / 3, 1 / 3, 0], Oo = [0, 1 / 3, 2 / 3, 0], Jl = [0, 1 / 6, 2 / 3, 1 / 6];
        function qf(fe, P2, U2) {
          fe.push("C", Fo(fu, P2), ",", Fo(fu, U2), ",", Fo(Oo, P2), ",", Fo(Oo, U2), ",", Fo(Jl, P2), ",", Fo(Jl, U2));
        }
        function Af(fe, P2) {
          return (P2[1] - fe[1]) / (P2[0] - fe[0]);
        }
        function Ed(fe) {
          for (var P2, U2, G2, J2 = -1, oe = fe.length; ++J2 < oe; ) U2 = (P2 = fe[J2])[0], G2 = P2[1] - at, P2[0] = U2 * Math.cos(G2), P2[1] = U2 * Math.sin(G2);
          return fe;
        }
        function Ks(fe) {
          var P2 = tn, U2 = tn, G2 = 0, J2 = Zn, oe = il, de = _u, ye = de.key, Te = de, Fe = "L", et = 0.7;
          function lt(bt) {
            var It, Rt, Ft, Pt = [], Mt = [], qt = [], $t = -1, Yt = bt.length, cr = Ar(P2), kr = Ar(G2), Pr = P2 === U2 ? function() {
              return Rt;
            } : Ar(U2), Or = G2 === J2 ? function() {
              return Ft;
            } : Ar(J2);
            function xn() {
              Pt.push("M", de(fe(qt), et), Fe, Te(fe(Mt.reverse()), et), "Z");
            }
            for (; ++$t < Yt; ) oe.call(this, It = bt[$t], $t) ? (Mt.push([Rt = +cr.call(this, It, $t), Ft = +kr.call(this, It, $t)]), qt.push([+Pr.call(this, It, $t), +Or.call(this, It, $t)])) : Mt.length && (xn(), Mt = [], qt = []);
            return Mt.length && xn(), Pt.length ? Pt.join("") : null;
          }
          return lt.x = function(bt) {
            return arguments.length ? (P2 = U2 = bt, lt) : U2;
          }, lt.x0 = function(bt) {
            return arguments.length ? (P2 = bt, lt) : P2;
          }, lt.x1 = function(bt) {
            return arguments.length ? (U2 = bt, lt) : U2;
          }, lt.y = function(bt) {
            return arguments.length ? (G2 = J2 = bt, lt) : J2;
          }, lt.y0 = function(bt) {
            return arguments.length ? (G2 = bt, lt) : G2;
          }, lt.y1 = function(bt) {
            return arguments.length ? (J2 = bt, lt) : J2;
          }, lt.defined = function(bt) {
            return arguments.length ? (oe = bt, lt) : oe;
          }, lt.interpolate = function(bt) {
            return arguments.length ? (ye = typeof bt == "function" ? de = bt : (de = bc.get(bt) || _u).key, Te = de.reverse || de, Fe = de.closed ? "M" : "L", lt) : ye;
          }, lt.tension = function(bt) {
            return arguments.length ? (et = bt, lt) : et;
          }, lt;
        }
        function Dd(fe) {
          return fe.source;
        }
        function Ys(fe) {
          return fe.target;
        }
        function Sf(fe) {
          return fe.radius;
        }
        function Ya(fe) {
          return [fe.x, fe.y];
        }
        function yi(fe) {
          return function() {
            var P2 = fe.apply(this, arguments), U2 = P2[0], G2 = P2[1] - at;
            return [U2 * Math.cos(G2), U2 * Math.sin(G2)];
          };
        }
        function Cd() {
          return 64;
        }
        function Md() {
          return "circle";
        }
        function Ef(fe) {
          var P2 = Math.sqrt(fe / Jt);
          return "M0," + P2 + "A" + P2 + "," + P2 + " 0 1,1 0," + -P2 + "A" + P2 + "," + P2 + " 0 1,1 0," + P2 + "Z";
        }
        n.svg.line.radial = function() {
          var fe = Jc(Ed);
          return fe.radius = fe.x, delete fe.x, fe.angle = fe.y, delete fe.y, fe;
        }, ls.reverse = wu, wu.reverse = ls, n.svg.area = function() {
          return Ks(I2);
        }, n.svg.area.radial = function() {
          var fe = Ks(Ed);
          return fe.radius = fe.x, delete fe.x, fe.innerRadius = fe.x0, delete fe.x0, fe.outerRadius = fe.x1, delete fe.x1, fe.angle = fe.y, delete fe.y, fe.startAngle = fe.y0, delete fe.y0, fe.endAngle = fe.y1, delete fe.y1, fe;
        }, n.svg.chord = function() {
          var fe = Dd, P2 = Ys, U2 = Sf, G2 = Ki, J2 = Fi;
          function oe(Fe, et) {
            var lt, bt, It = de(this, fe, Fe, et), Rt = de(this, P2, Fe, et);
            return "M" + It.p0 + ye(It.r, It.p1, It.a1 - It.a0) + (bt = Rt, ((lt = It).a0 == bt.a0 && lt.a1 == bt.a1 ? Te(It.r, It.p1, It.r, It.p0) : Te(It.r, It.p1, Rt.r, Rt.p0) + ye(Rt.r, Rt.p1, Rt.a1 - Rt.a0) + Te(Rt.r, Rt.p1, It.r, It.p0)) + "Z");
          }
          function de(Fe, et, lt, bt) {
            var It = et.call(Fe, lt, bt), Rt = U2.call(Fe, It, bt), Ft = G2.call(Fe, It, bt) - at, Pt = J2.call(Fe, It, bt) - at;
            return { r: Rt, a0: Ft, a1: Pt, p0: [Rt * Math.cos(Ft), Rt * Math.sin(Ft)], p1: [Rt * Math.cos(Pt), Rt * Math.sin(Pt)] };
          }
          function ye(Fe, et, lt) {
            return "A" + Fe + "," + Fe + " 0 " + +(lt > Jt) + ",1 " + et;
          }
          function Te(Fe, et, lt, bt) {
            return "Q 0,0 " + bt;
          }
          return oe.radius = function(Fe) {
            return arguments.length ? (U2 = Ar(Fe), oe) : U2;
          }, oe.source = function(Fe) {
            return arguments.length ? (fe = Ar(Fe), oe) : fe;
          }, oe.target = function(Fe) {
            return arguments.length ? (P2 = Ar(Fe), oe) : P2;
          }, oe.startAngle = function(Fe) {
            return arguments.length ? (G2 = Ar(Fe), oe) : G2;
          }, oe.endAngle = function(Fe) {
            return arguments.length ? (J2 = Ar(Fe), oe) : J2;
          }, oe;
        }, n.svg.diagonal = function() {
          var fe = Dd, P2 = Ys, U2 = Ya;
          function G2(J2, oe) {
            var de = fe.call(this, J2, oe), ye = P2.call(this, J2, oe), Te = (de.y + ye.y) / 2, Fe = [de, { x: de.x, y: Te }, { x: ye.x, y: Te }, ye];
            return "M" + (Fe = Fe.map(U2))[0] + "C" + Fe[1] + " " + Fe[2] + " " + Fe[3];
          }
          return G2.source = function(J2) {
            return arguments.length ? (fe = Ar(J2), G2) : fe;
          }, G2.target = function(J2) {
            return arguments.length ? (P2 = Ar(J2), G2) : P2;
          }, G2.projection = function(J2) {
            return arguments.length ? (U2 = J2, G2) : U2;
          }, G2;
        }, n.svg.diagonal.radial = function() {
          var fe = n.svg.diagonal(), P2 = Ya, U2 = fe.projection;
          return fe.projection = function(G2) {
            return arguments.length ? U2(yi(P2 = G2)) : P2;
          }, fe;
        }, n.svg.symbol = function() {
          var fe = Md, P2 = Cd;
          function U2(G2, J2) {
            return (ic.get(fe.call(this, G2, J2)) || Ef)(P2.call(this, G2, J2));
          }
          return U2.type = function(G2) {
            return arguments.length ? (fe = Ar(G2), U2) : fe;
          }, U2.size = function(G2) {
            return arguments.length ? (P2 = Ar(G2), U2) : P2;
          }, U2;
        };
        var ic = n.map({ circle: Ef, cross: function(fe) {
          var P2 = Math.sqrt(fe / 5) / 2;
          return "M" + -3 * P2 + "," + -P2 + "H" + -P2 + "V" + -3 * P2 + "H" + P2 + "V" + -P2 + "H" + 3 * P2 + "V" + P2 + "H" + P2 + "V" + 3 * P2 + "H" + -P2 + "V" + P2 + "H" + -3 * P2 + "Z";
        }, diamond: function(fe) {
          var P2 = Math.sqrt(fe / (2 * Z0)), U2 = P2 * Z0;
          return "M0," + -P2 + "L" + U2 + ",0 0," + P2 + " " + -U2 + ",0Z";
        }, square: function(fe) {
          var P2 = Math.sqrt(fe) / 2;
          return "M" + -P2 + "," + -P2 + "L" + P2 + "," + -P2 + " " + P2 + "," + P2 + " " + -P2 + "," + P2 + "Z";
        }, "triangle-down": function(fe) {
          var P2 = Math.sqrt(fe / Vc), U2 = P2 * Vc / 2;
          return "M0," + U2 + "L" + P2 + "," + -U2 + " " + -P2 + "," + -U2 + "Z";
        }, "triangle-up": function(fe) {
          var P2 = Math.sqrt(fe / Vc), U2 = P2 * Vc / 2;
          return "M0," + -U2 + "L" + P2 + "," + U2 + " " + -P2 + "," + U2 + "Z";
        } });
        n.svg.symbolTypes = ic.keys();
        var Vc = Math.sqrt(3), Z0 = Math.tan(30 * Ge);
        Z2.transition = function(fe) {
          for (var P2, U2, G2 = wh || ++kh, J2 = zp(fe), oe = [], de = Xf || { time: Date.now(), ease: Yh, delay: 0, duration: 250 }, ye = -1, Te = this.length; ++ye < Te; ) {
            oe.push(P2 = []);
            for (var Fe = this[ye], et = -1, lt = Fe.length; ++et < lt; ) (U2 = Fe[et]) && Kf(U2, et, J2, G2, de), P2.push(U2);
          }
          return Po(oe, J2, G2);
        }, Z2.interrupt = function(fe) {
          return this.each(fe == null ? Lp : yo(zp(fe)));
        };
        var Lp = yo(zp());
        function yo(fe) {
          return function() {
            var P2, U2, G2;
            (P2 = this[fe]) && (G2 = P2[U2 = P2.active]) && (G2.timer.c = null, G2.timer.t = NaN, --P2.count ? delete P2[U2] : delete this[fe], P2.active += 0.5, G2.event && G2.event.interrupt.call(this, this.__data__, G2.index));
          };
        }
        function Po(fe, P2, U2) {
          return z(fe, Vs), fe.namespace = P2, fe.id = U2, fe;
        }
        var wh, Xf, Vs = [], kh = 0;
        function Rp(fe, P2, U2, G2) {
          var J2 = fe.id, oe = fe.namespace;
          return Ue(fe, typeof U2 == "function" ? function(de, ye, Te) {
            de[oe][J2].tween.set(P2, G2(U2.call(de, de.__data__, ye, Te)));
          } : (U2 = G2(U2), function(de) {
            de[oe][J2].tween.set(P2, U2);
          }));
        }
        function Zh(fe) {
          return fe == null && (fe = ""), function() {
            this.textContent = fe;
          };
        }
        function zp(fe) {
          return fe == null ? "__transition__" : "__transition_" + fe + "__";
        }
        function Kf(fe, P2, U2, G2, J2) {
          var oe, de, ye, Te, Fe, et = fe[U2] || (fe[U2] = { active: 0, count: 0 }), lt = et[G2];
          function bt(Rt) {
            var Ft = et.active, Pt = et[Ft];
            for (var Mt in Pt && (Pt.timer.c = null, Pt.timer.t = NaN, --et.count, delete et[Ft], Pt.event && Pt.event.interrupt.call(fe, fe.__data__, Pt.index)), et) if (+Mt < G2) {
              var qt = et[Mt];
              qt.timer.c = null, qt.timer.t = NaN, --et.count, delete et[Mt];
            }
            de.c = It, qr(function() {
              return de.c && It(Rt || 1) && (de.c = null, de.t = NaN), 1;
            }, 0, oe), et.active = G2, lt.event && lt.event.start.call(fe, fe.__data__, P2), Fe = [], lt.tween.forEach(function($t, Yt) {
              (Yt = Yt.call(fe, fe.__data__, P2)) && Fe.push(Yt);
            }), Te = lt.ease, ye = lt.duration;
          }
          function It(Rt) {
            for (var Ft = Rt / ye, Pt = Te(Ft), Mt = Fe.length; Mt > 0; ) Fe[--Mt].call(fe, Pt);
            if (Ft >= 1) return lt.event && lt.event.end.call(fe, fe.__data__, P2), --et.count ? delete et[G2] : delete fe[U2], 1;
          }
          lt || (oe = J2.time, de = qr(function(Rt) {
            var Ft = lt.delay;
            if (de.t = Ft + oe, Ft <= Rt) return bt(Rt - Ft);
            de.c = bt;
          }, 0, oe), lt = et[G2] = { tween: new k(), time: oe, timer: de, delay: J2.delay, duration: J2.duration, ease: J2.ease, index: P2 }, J2 = null, ++et.count);
        }
        Vs.call = Z2.call, Vs.empty = Z2.empty, Vs.node = Z2.node, Vs.size = Z2.size, n.transition = function(fe, P2) {
          return fe && fe.transition ? wh ? fe.transition(P2) : fe : n.selection().transition(fe);
        }, n.transition.prototype = Vs, Vs.select = function(fe) {
          var P2, U2, G2, J2 = this.id, oe = this.namespace, de = [];
          fe = ne(fe);
          for (var ye = -1, Te = this.length; ++ye < Te; ) {
            de.push(P2 = []);
            for (var Fe = this[ye], et = -1, lt = Fe.length; ++et < lt; ) (G2 = Fe[et]) && (U2 = fe.call(G2, G2.__data__, et, ye)) ? ("__data__" in G2 && (U2.__data__ = G2.__data__), Kf(U2, et, oe, J2, G2[oe][J2]), P2.push(U2)) : P2.push(null);
          }
          return Po(de, oe, J2);
        }, Vs.selectAll = function(fe) {
          var P2, U2, G2, J2, oe, de = this.id, ye = this.namespace, Te = [];
          fe = ae(fe);
          for (var Fe = -1, et = this.length; ++Fe < et; ) for (var lt = this[Fe], bt = -1, It = lt.length; ++bt < It; ) if (G2 = lt[bt]) {
            oe = G2[ye][de], U2 = fe.call(G2, G2.__data__, bt, Fe), Te.push(P2 = []);
            for (var Rt = -1, Ft = U2.length; ++Rt < Ft; ) (J2 = U2[Rt]) && Kf(J2, Rt, ye, de, oe), P2.push(J2);
          }
          return Po(Te, ye, de);
        }, Vs.filter = function(fe) {
          var P2, U2, G2 = [];
          typeof fe != "function" && (fe = Ce(fe));
          for (var J2 = 0, oe = this.length; J2 < oe; J2++) {
            G2.push(P2 = []);
            for (var de, ye = 0, Te = (de = this[J2]).length; ye < Te; ye++) (U2 = de[ye]) && fe.call(U2, U2.__data__, ye, J2) && P2.push(U2);
          }
          return Po(G2, this.namespace, this.id);
        }, Vs.tween = function(fe, P2) {
          var U2 = this.id, G2 = this.namespace;
          return arguments.length < 2 ? this.node()[G2][U2].tween.get(fe) : Ue(this, P2 == null ? function(J2) {
            J2[G2][U2].tween.remove(fe);
          } : function(J2) {
            J2[G2][U2].tween.set(fe, P2);
          });
        }, Vs.attr = function(fe, P2) {
          if (arguments.length < 2) {
            for (P2 in fe) this.attr(P2, fe[P2]);
            return this;
          }
          var U2 = fe == "transform" ? Uc : nl, G2 = n.ns.qualify(fe);
          function J2() {
            this.removeAttribute(G2);
          }
          function oe() {
            this.removeAttributeNS(G2.space, G2.local);
          }
          function de(Te) {
            return Te == null ? J2 : (Te += "", function() {
              var Fe, et = this.getAttribute(G2);
              return et !== Te && (Fe = U2(et, Te), function(lt) {
                this.setAttribute(G2, Fe(lt));
              });
            });
          }
          function ye(Te) {
            return Te == null ? oe : (Te += "", function() {
              var Fe, et = this.getAttributeNS(G2.space, G2.local);
              return et !== Te && (Fe = U2(et, Te), function(lt) {
                this.setAttributeNS(G2.space, G2.local, Fe(lt));
              });
            });
          }
          return Rp(this, "attr." + fe, P2, G2.local ? ye : de);
        }, Vs.attrTween = function(fe, P2) {
          var U2 = n.ns.qualify(fe);
          return this.tween("attr." + fe, U2.local ? function(G2, J2) {
            var oe = P2.call(this, G2, J2, this.getAttributeNS(U2.space, U2.local));
            return oe && function(de) {
              this.setAttributeNS(U2.space, U2.local, oe(de));
            };
          } : function(G2, J2) {
            var oe = P2.call(this, G2, J2, this.getAttribute(U2));
            return oe && function(de) {
              this.setAttribute(U2, oe(de));
            };
          });
        }, Vs.style = function(fe, P2, U2) {
          var G2 = arguments.length;
          if (G2 < 3) {
            if (typeof fe != "string") {
              for (U2 in G2 < 2 && (P2 = ""), fe) this.style(U2, fe[U2], P2);
              return this;
            }
            U2 = "";
          }
          function J2() {
            this.style.removeProperty(fe);
          }
          function oe(de) {
            return de == null ? J2 : (de += "", function() {
              var ye, Te = l(this).getComputedStyle(this, null).getPropertyValue(fe);
              return Te !== de && (ye = nl(Te, de), function(Fe) {
                this.style.setProperty(fe, ye(Fe), U2);
              });
            });
          }
          return Rp(this, "style." + fe, P2, oe);
        }, Vs.styleTween = function(fe, P2, U2) {
          function G2(J2, oe) {
            var de = P2.call(this, J2, oe, l(this).getComputedStyle(this, null).getPropertyValue(fe));
            return de && function(ye) {
              this.style.setProperty(fe, de(ye), U2);
            };
          }
          return arguments.length < 3 && (U2 = ""), this.tween("style." + fe, G2);
        }, Vs.text = function(fe) {
          return Rp(this, "text", fe, Zh);
        }, Vs.remove = function() {
          var fe = this.namespace;
          return this.each("end.transition", function() {
            var P2;
            this[fe].count < 2 && (P2 = this.parentNode) && P2.removeChild(this);
          });
        }, Vs.ease = function(fe) {
          var P2 = this.id, U2 = this.namespace;
          return arguments.length < 1 ? this.node()[U2][P2].ease : (typeof fe != "function" && (fe = n.ease.apply(n, arguments)), Ue(this, function(G2) {
            G2[U2][P2].ease = fe;
          }));
        }, Vs.delay = function(fe) {
          var P2 = this.id, U2 = this.namespace;
          return arguments.length < 1 ? this.node()[U2][P2].delay : Ue(this, typeof fe == "function" ? function(G2, J2, oe) {
            G2[U2][P2].delay = +fe.call(G2, G2.__data__, J2, oe);
          } : (fe = +fe, function(G2) {
            G2[U2][P2].delay = fe;
          }));
        }, Vs.duration = function(fe) {
          var P2 = this.id, U2 = this.namespace;
          return arguments.length < 1 ? this.node()[U2][P2].duration : Ue(this, typeof fe == "function" ? function(G2, J2, oe) {
            G2[U2][P2].duration = Math.max(1, fe.call(G2, G2.__data__, J2, oe));
          } : (fe = Math.max(1, fe), function(G2) {
            G2[U2][P2].duration = fe;
          }));
        }, Vs.each = function(fe, P2) {
          var U2 = this.id, G2 = this.namespace;
          if (arguments.length < 2) {
            var J2 = Xf, oe = wh;
            try {
              wh = U2, Ue(this, function(de, ye, Te) {
                Xf = de[G2][U2], fe.call(de, de.__data__, ye, Te);
              });
            } finally {
              Xf = J2, wh = oe;
            }
          } else Ue(this, function(de) {
            var ye = de[G2][U2];
            (ye.event || (ye.event = n.dispatch("start", "end", "interrupt"))).on(fe, P2);
          });
          return this;
        }, Vs.transition = function() {
          for (var fe, P2, U2, G2 = this.id, J2 = ++kh, oe = this.namespace, de = [], ye = 0, Te = this.length; ye < Te; ye++) {
            de.push(fe = []);
            for (var Fe, et = 0, lt = (Fe = this[ye]).length; et < lt; et++) (P2 = Fe[et]) && Kf(P2, et, oe, J2, { time: (U2 = P2[oe][G2]).time, ease: U2.ease, delay: U2.delay + U2.duration, duration: U2.duration }), fe.push(P2);
          }
          return Po(de, oe, J2);
        }, n.svg.axis = function() {
          var fe, P2 = n.scale.linear(), U2 = J0, G2 = 6, J2 = 6, oe = 3, de = [10], ye = null;
          function Te(Fe) {
            Fe.each(function() {
              var et, lt = n.select(this), bt = this.__chart__ || P2, It = this.__chart__ = P2.copy(), Rt = ye ?? (It.ticks ? It.ticks.apply(It, de) : It.domain()), Ft = fe ?? (It.tickFormat ? It.tickFormat.apply(It, de) : I2), Pt = lt.selectAll(".tick").data(Rt, It), Mt = Pt.enter().insert("g", ".domain").attr("class", "tick").style("opacity", Ot), qt = n.transition(Pt.exit()).style("opacity", Ot).remove(), $t = n.transition(Pt.order()).style("opacity", 1), Yt = Math.max(G2, 0) + oe, cr = En(It), kr = lt.selectAll(".domain").data([0]), Pr = (kr.enter().append("path").attr("class", "domain"), n.transition(kr));
              Mt.append("line"), Mt.append("text");
              var Or, xn, yn, Nn, An = Mt.select("line"), ma = $t.select("line"), Aa = Pt.select("text").text(Ft), Qa = Mt.select("text"), ln = $t.select("text"), qn = U2 === "top" || U2 === "left" ? -1 : 1;
              if (U2 === "bottom" || U2 === "top" ? (et = Th, Or = "x", yn = "y", xn = "x2", Nn = "y2", Aa.attr("dy", qn < 0 ? "0em" : ".71em").style("text-anchor", "middle"), Pr.attr("d", "M" + cr[0] + "," + qn * J2 + "V0H" + cr[1] + "V" + qn * J2)) : (et = Q0, Or = "y", yn = "x", xn = "y2", Nn = "x2", Aa.attr("dy", ".32em").style("text-anchor", qn < 0 ? "end" : "start"), Pr.attr("d", "M" + qn * J2 + "," + cr[0] + "H0V" + cr[1] + "H" + qn * J2)), An.attr(Nn, qn * G2), Qa.attr(yn, qn * Yt), ma.attr(xn, 0).attr(Nn, qn * G2), ln.attr(Or, 0).attr(yn, qn * Yt), It.rangeBand) {
                var Sa = It, _a = Sa.rangeBand() / 2;
                bt = It = function(Pa) {
                  return Sa(Pa) + _a;
                };
              } else bt.rangeBand ? bt = It : qt.call(et, It, bt);
              Mt.call(et, bt, It), $t.call(et, It, It);
            });
          }
          return Te.scale = function(Fe) {
            return arguments.length ? (P2 = Fe, Te) : P2;
          }, Te.orient = function(Fe) {
            return arguments.length ? (U2 = Fe in cm ? Fe + "" : J0, Te) : U2;
          }, Te.ticks = function() {
            return arguments.length ? (de = o(arguments), Te) : de;
          }, Te.tickValues = function(Fe) {
            return arguments.length ? (ye = Fe, Te) : ye;
          }, Te.tickFormat = function(Fe) {
            return arguments.length ? (fe = Fe, Te) : fe;
          }, Te.tickSize = function(Fe) {
            var et = arguments.length;
            return et ? (G2 = +Fe, J2 = +arguments[et - 1], Te) : G2;
          }, Te.innerTickSize = function(Fe) {
            return arguments.length ? (G2 = +Fe, Te) : G2;
          }, Te.outerTickSize = function(Fe) {
            return arguments.length ? (J2 = +Fe, Te) : J2;
          }, Te.tickPadding = function(Fe) {
            return arguments.length ? (oe = +Fe, Te) : oe;
          }, Te.tickSubdivide = function() {
            return arguments.length && Te;
          }, Te;
        };
        var J0 = "bottom", cm = { top: 1, right: 1, bottom: 1, left: 1 };
        function Th(fe, P2, U2) {
          fe.attr("transform", function(G2) {
            var J2 = P2(G2);
            return "translate(" + (isFinite(J2) ? J2 : U2(G2)) + ",0)";
          });
        }
        function Q0(fe, P2, U2) {
          fe.attr("transform", function(G2) {
            var J2 = P2(G2);
            return "translate(0," + (isFinite(J2) ? J2 : U2(G2)) + ")";
          });
        }
        n.svg.brush = function() {
          var fe, P2, U2 = re(et, "brushstart", "brush", "brushend"), G2 = null, J2 = null, oe = [0, 0], de = [0, 0], ye = true, Te = true, Fe = Ql[0];
          function et(Ft) {
            Ft.each(function() {
              var Pt = n.select(this).style("pointer-events", "all").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)").on("mousedown.brush", Rt).on("touchstart.brush", Rt), Mt = Pt.selectAll(".background").data([0]);
              Mt.enter().append("rect").attr("class", "background").style("visibility", "hidden").style("cursor", "crosshair"), Pt.selectAll(".extent").data([0]).enter().append("rect").attr("class", "extent").style("cursor", "move");
              var qt = Pt.selectAll(".resize").data(Fe, I2);
              qt.exit().remove(), qt.enter().append("g").attr("class", function(kr) {
                return "resize " + kr;
              }).style("cursor", function(kr) {
                return Bp[kr];
              }).append("rect").attr("x", function(kr) {
                return /[ew]$/.test(kr) ? -3 : null;
              }).attr("y", function(kr) {
                return /^[ns]/.test(kr) ? -3 : null;
              }).attr("width", 6).attr("height", 6).style("visibility", "hidden"), qt.style("display", et.empty() ? "none" : null);
              var $t, Yt = n.transition(Pt), cr = n.transition(Mt);
              G2 && ($t = En(G2), cr.attr("x", $t[0]).attr("width", $t[1] - $t[0]), bt(Yt)), J2 && ($t = En(J2), cr.attr("y", $t[0]).attr("height", $t[1] - $t[0]), It(Yt)), lt(Yt);
            });
          }
          function lt(Ft) {
            Ft.selectAll(".resize").attr("transform", function(Pt) {
              return "translate(" + oe[+/e$/.test(Pt)] + "," + de[+/^s/.test(Pt)] + ")";
            });
          }
          function bt(Ft) {
            Ft.select(".extent").attr("x", oe[0]), Ft.selectAll(".extent,.n>rect,.s>rect").attr("width", oe[1] - oe[0]);
          }
          function It(Ft) {
            Ft.select(".extent").attr("y", de[0]), Ft.selectAll(".extent,.e>rect,.w>rect").attr("height", de[1] - de[0]);
          }
          function Rt() {
            var Ft, Pt, Mt = this, qt = n.select(n.event.target), $t = U2.of(Mt, arguments), Yt = n.select(Mt), cr = qt.datum(), kr = !/^(n|s)$/.test(cr) && G2, Pr = !/^(e|w)$/.test(cr) && J2, Or = qt.classed("extent"), xn = zt(Mt), yn = n.mouse(Mt), Nn = n.select(l(Mt)).on("keydown.brush", Aa).on("keyup.brush", Qa);
            if (n.event.changedTouches ? Nn.on("touchmove.brush", ln).on("touchend.brush", Sa) : Nn.on("mousemove.brush", ln).on("mouseup.brush", Sa), Yt.interrupt().selectAll("*").interrupt(), Or) yn[0] = oe[0] - yn[0], yn[1] = de[0] - yn[1];
            else if (cr) {
              var An = +/w$/.test(cr), ma = +/^n/.test(cr);
              Pt = [oe[1 - An] - yn[0], de[1 - ma] - yn[1]], yn[0] = oe[An], yn[1] = de[ma];
            } else n.event.altKey && (Ft = yn.slice());
            function Aa() {
              n.event.keyCode == 32 && (Or || (Ft = null, yn[0] -= oe[1], yn[1] -= de[1], Or = 2), K2());
            }
            function Qa() {
              n.event.keyCode == 32 && Or == 2 && (yn[0] += oe[1], yn[1] += de[1], Or = 0, K2());
            }
            function ln() {
              var _a = n.mouse(Mt), Pa = false;
              Pt && (_a[0] += Pt[0], _a[1] += Pt[1]), Or || (n.event.altKey ? (Ft || (Ft = [(oe[0] + oe[1]) / 2, (de[0] + de[1]) / 2]), yn[0] = oe[+(_a[0] < Ft[0])], yn[1] = de[+(_a[1] < Ft[1])]) : Ft = null), kr && qn(_a, G2, 0) && (bt(Yt), Pa = true), Pr && qn(_a, J2, 1) && (It(Yt), Pa = true), Pa && (lt(Yt), $t({ type: "brush", mode: Or ? "move" : "resize" }));
            }
            function qn(_a, Pa, ii) {
              var Oi, Da, wi = En(Pa), di = wi[0], ji = wi[1], ki = yn[ii], Wi = ii ? de : oe, to = Wi[1] - Wi[0];
              if (Or && (di -= ki, ji -= to + ki), Oi = (ii ? Te : ye) ? Math.max(di, Math.min(ji, _a[ii])) : _a[ii], Or ? Da = (Oi += ki) + to : (Ft && (ki = Math.max(di, Math.min(ji, 2 * Ft[ii] - Oi))), ki < Oi ? (Da = Oi, Oi = ki) : Da = ki), Wi[0] != Oi || Wi[1] != Da) return ii ? P2 = null : fe = null, Wi[0] = Oi, Wi[1] = Da, true;
            }
            function Sa() {
              ln(), Yt.style("pointer-events", "all").selectAll(".resize").style("display", et.empty() ? "none" : null), n.select("body").style("cursor", null), Nn.on("mousemove.brush", null).on("mouseup.brush", null).on("touchmove.brush", null).on("touchend.brush", null).on("keydown.brush", null).on("keyup.brush", null), xn(), $t({ type: "brushend" });
            }
            Yt.style("pointer-events", "none").selectAll(".resize").style("display", null), n.select("body").style("cursor", qt.style("cursor")), $t({ type: "brushstart" }), ln();
          }
          return et.event = function(Ft) {
            Ft.each(function() {
              var Pt = U2.of(this, arguments), Mt = { x: oe, y: de, i: fe, j: P2 }, qt = this.__chart__ || Mt;
              this.__chart__ = Mt, wh ? n.select(this).transition().each("start.brush", function() {
                fe = qt.i, P2 = qt.j, oe = qt.x, de = qt.y, Pt({ type: "brushstart" });
              }).tween("brush:brush", function() {
                var $t = ss(oe, Mt.x), Yt = ss(de, Mt.y);
                return fe = P2 = null, function(cr) {
                  oe = Mt.x = $t(cr), de = Mt.y = Yt(cr), Pt({ type: "brush", mode: "resize" });
                };
              }).each("end.brush", function() {
                fe = Mt.i, P2 = Mt.j, Pt({ type: "brush", mode: "resize" }), Pt({ type: "brushend" });
              }) : (Pt({ type: "brushstart" }), Pt({ type: "brush", mode: "resize" }), Pt({ type: "brushend" }));
            });
          }, et.x = function(Ft) {
            return arguments.length ? (Fe = Ql[!(G2 = Ft) << 1 | !J2], et) : G2;
          }, et.y = function(Ft) {
            return arguments.length ? (Fe = Ql[!G2 << 1 | !(J2 = Ft)], et) : J2;
          }, et.clamp = function(Ft) {
            return arguments.length ? (G2 && J2 ? (ye = !!Ft[0], Te = !!Ft[1]) : G2 ? ye = !!Ft : J2 && (Te = !!Ft), et) : G2 && J2 ? [ye, Te] : G2 ? ye : J2 ? Te : null;
          }, et.extent = function(Ft) {
            var Pt, Mt, qt, $t, Yt;
            return arguments.length ? (G2 && (Pt = Ft[0], Mt = Ft[1], J2 && (Pt = Pt[0], Mt = Mt[0]), fe = [Pt, Mt], G2.invert && (Pt = G2(Pt), Mt = G2(Mt)), Mt < Pt && (Yt = Pt, Pt = Mt, Mt = Yt), Pt == oe[0] && Mt == oe[1] || (oe = [Pt, Mt])), J2 && (qt = Ft[0], $t = Ft[1], G2 && (qt = qt[1], $t = $t[1]), P2 = [qt, $t], J2.invert && (qt = J2(qt), $t = J2($t)), $t < qt && (Yt = qt, qt = $t, $t = Yt), qt == de[0] && $t == de[1] || (de = [qt, $t])), et) : (G2 && (fe ? (Pt = fe[0], Mt = fe[1]) : (Pt = oe[0], Mt = oe[1], G2.invert && (Pt = G2.invert(Pt), Mt = G2.invert(Mt)), Mt < Pt && (Yt = Pt, Pt = Mt, Mt = Yt))), J2 && (P2 ? (qt = P2[0], $t = P2[1]) : (qt = de[0], $t = de[1], J2.invert && (qt = J2.invert(qt), $t = J2.invert($t)), $t < qt && (Yt = qt, qt = $t, $t = Yt))), G2 && J2 ? [[Pt, qt], [Mt, $t]] : G2 ? [Pt, Mt] : J2 && [qt, $t]);
          }, et.clear = function() {
            return et.empty() || (oe = [0, 0], de = [0, 0], fe = P2 = null), et;
          }, et.empty = function() {
            return !!G2 && oe[0] == oe[1] || !!J2 && de[0] == de[1];
          }, n.rebind(et, U2, "on");
        };
        var Bp = { n: "ns-resize", e: "ew-resize", s: "ns-resize", w: "ew-resize", nw: "nwse-resize", ne: "nesw-resize", se: "nwse-resize", sw: "nesw-resize" }, Ql = [["n", "e", "s", "w", "nw", "ne", "se", "sw"], ["e", "w"], ["n", "s"], []];
        function fm(fe) {
          return JSON.parse(fe.responseText);
        }
        function hm(fe) {
          var P2 = s.createRange();
          return P2.selectNode(s.body), P2.createContextualFragment(fe.responseText);
        }
        n.text = Qr(function(fe) {
          return fe.responseText;
        }), n.json = function(fe, P2) {
          return hn(fe, "application/json", fm, P2);
        }, n.html = function(fe, P2) {
          return hn(fe, "text/html", hm, P2);
        }, n.xml = Qr(function(fe) {
          return fe.responseXML;
        }), typeof t == "object" && t.exports ? t.exports = n : this.d3 = n;
      }).apply(self);
    }, {}], 59: [function(e, t, r) {
      "use strict";
      t.exports = e("./quad");
    }, { "./quad": 60 }], 60: [function(e, t, r) {
      "use strict";
      var n = e("binary-search-bounds"), a = e("clamp"), o = e("parse-rect"), s = e("array-bounds"), i = e("pick-by-alias"), l = e("defined"), u2 = e("flatten-vertex-data"), c = e("is-obj"), f = e("dtype"), h = e("math-log2");
      function p(d, v) {
        for (var m = v[0], g = v[1], x = 1 / (v[2] - m), b = 1 / (v[3] - g), y = new Array(d.length), w = 0, _4 = d.length / 2; w < _4; w++) y[2 * w] = a((d[2 * w] - m) * x, 0, 1), y[2 * w + 1] = a((d[2 * w + 1] - g) * b, 0, 1);
        return y;
      }
      t.exports = function(d, v) {
        v || (v = {}), d = u2(d, "float64"), v = i(v, { bounds: "range bounds dataBox databox", maxDepth: "depth maxDepth maxdepth level maxLevel maxlevel levels", dtype: "type dtype format out dst output destination" });
        var m = l(v.maxDepth, 255), g = l(v.bounds, s(d, 2));
        g[0] === g[2] && g[2]++, g[1] === g[3] && g[3]++;
        var x, b = p(d, g), y = d.length >>> 1;
        v.dtype || (v.dtype = "array"), typeof v.dtype == "string" ? x = new (f(v.dtype))(y) : v.dtype && (x = v.dtype, Array.isArray(x) && (x.length = y));
        for (var w = 0; w < y; ++w) x[w] = w;
        var _4 = [], k = [], T2 = [], A2 = [];
        (function L2(V2, W2, X2, Y2, K2, q) {
          if (!Y2.length) return null;
          var re = _4[K2] || (_4[K2] = []), R2 = T2[K2] || (T2[K2] = []), z = k[K2] || (k[K2] = []), H2 = re.length;
          if (++K2 > m || q > 1073741824) {
            for (var te = 0; te < Y2.length; te++) re.push(Y2[te]), R2.push(q), z.push(null, null, null, null);
            return H2;
          }
          if (re.push(Y2[0]), R2.push(q), Y2.length <= 1) return z.push(null, null, null, null), H2;
          for (var j = 0.5 * X2, Q2 = V2 + j, Z2 = W2 + j, ne = [], ae = [], ue = [], le = [], ce = 1, se = Y2.length; ce < se; ce++) {
            var he = Y2[ce], me = b[2 * he], we = b[2 * he + 1];
            me < Q2 ? we < Z2 ? ne.push(he) : ae.push(he) : we < Z2 ? ue.push(he) : le.push(he);
          }
          return q <<= 2, z.push(L2(V2, W2, j, ne, K2, q), L2(V2, Z2, j, ae, K2, q + 1), L2(Q2, W2, j, ue, K2, q + 2), L2(Q2, Z2, j, le, K2, q + 3)), H2;
        })(0, 0, 1, x, 0, 1);
        for (var S2 = 0, C2 = 0; C2 < _4.length; C2++) {
          var E2 = _4[C2];
          if (x.set) x.set(E2, S2);
          else for (var F13 = 0, N2 = E2.length; F13 < N2; F13++) x[F13 + S2] = E2[F13];
          var D2 = S2 + _4[C2].length;
          A2[C2] = [S2, D2], S2 = D2;
        }
        return x.range = function() {
          for (var L2, V2 = [], W2 = arguments.length; W2--; ) V2[W2] = arguments[W2];
          if (c(V2[V2.length - 1])) {
            var X2 = V2.pop();
            V2.length || X2.x == null && X2.l == null && X2.left == null || (V2 = [X2], L2 = {}), L2 = i(X2, { level: "level maxLevel", d: "d diam diameter r radius px pxSize pixel pixelSize maxD size minSize", lod: "lod details ranges offsets" });
          } else L2 = {};
          V2.length || (V2 = g);
          var Y2 = o.apply(void 0, V2), K2 = [Math.min(Y2.x, Y2.x + Y2.width), Math.min(Y2.y, Y2.y + Y2.height), Math.max(Y2.x, Y2.x + Y2.width), Math.max(Y2.y, Y2.y + Y2.height)], q = K2[0], re = K2[1], R2 = K2[2], z = K2[3], H2 = p([q, re, R2, z], g), te = H2[0], j = H2[1], Q2 = H2[2], Z2 = H2[3], ne = l(L2.level, _4.length);
          if (L2.d != null) {
            var ae;
            typeof L2.d == "number" ? ae = [L2.d, L2.d] : L2.d.length && (ae = L2.d), ne = Math.min(Math.max(Math.ceil(-h(Math.abs(ae[0]) / (g[2] - g[0]))), Math.ceil(-h(Math.abs(ae[1]) / (g[3] - g[1])))), ne);
          }
          if (ne = Math.min(ne, _4.length), L2.lod) return I2(te, j, Q2, Z2, ne);
          var ue = [];
          function le(se, he, me, we, be, Ae) {
            if (be !== null && Ae !== null && !(te > se + me || j > he + me || Q2 < se || Z2 < he || we >= ne || be === Ae)) {
              var pe = _4[we];
              Ae === void 0 && (Ae = pe.length);
              for (var ve = be; ve < Ae; ve++) {
                var Ee = pe[ve], Se = d[2 * Ee], Ce = d[2 * Ee + 1];
                Se >= q && Se <= R2 && Ce >= re && Ce <= z && ue.push(Ee);
              }
              var Be = k[we], Ue = Be[4 * be + 0], Ke = Be[4 * be + 1], ct = Be[4 * be + 2], We = Be[4 * be + 3], Ze = ce(Be, be + 1), it = 0.5 * me, ot = we + 1;
              le(se, he, it, ot, Ue, Ke || ct || We || Ze), le(se, he + it, it, ot, Ke, ct || We || Ze), le(se + it, he, it, ot, ct, We || Ze), le(se + it, he + it, it, ot, We, Ze);
            }
          }
          function ce(se, he) {
            for (var me = null, we = 0; me === null; ) if (me = se[4 * he + we], ++we > se.length) return null;
            return me;
          }
          return le(0, 0, 1, 0, 0, 1), ue;
        }, x;
        function I2(L2, V2, W2, X2, Y2) {
          for (var K2 = [], q = 0; q < Y2; q++) {
            var re = T2[q], R2 = A2[q][0], z = O2(L2, V2, q), H2 = O2(W2, X2, q), te = n.ge(re, z), j = n.gt(re, H2, te, re.length - 1);
            K2[q] = [te + R2, j + R2];
          }
          return K2;
        }
        function O2(L2, V2, W2) {
          for (var X2 = 1, Y2 = 0.5, K2 = 0.5, q = 0.5, re = 0; re < W2; re++) X2 <<= 2, X2 += L2 < Y2 ? V2 < K2 ? 0 : 1 : V2 < K2 ? 2 : 3, q *= 0.5, Y2 += L2 < Y2 ? -q : q, K2 += V2 < K2 ? -q : q;
          return X2;
        }
      };
    }, { "array-bounds": 71, "binary-search-bounds": 80, clamp: 86, defined: 124, dtype: 127, "flatten-vertex-data": 191, "is-obj": 235, "math-log2": 240, "parse-rect": 249, "pick-by-alias": 253 }], 61: [function(e, t, r) {
      "use strict";
      Object.defineProperty(r, "__esModule", { value: true });
      var n = e("@turf/meta");
      function a(i) {
        var l = 0;
        if (i && i.length > 0) {
          l += Math.abs(o(i[0]));
          for (var u2 = 1; u2 < i.length; u2++) l -= Math.abs(o(i[u2]));
        }
        return l;
      }
      function o(i) {
        var l, u2, c, f, h, p, d = 0, v = i.length;
        if (v > 2) {
          for (p = 0; p < v; p++) p === v - 2 ? (c = v - 2, f = v - 1, h = 0) : p === v - 1 ? (c = v - 1, f = 0, h = 1) : (c = p, f = p + 1, h = p + 2), l = i[c], u2 = i[f], d += (s(i[h][0]) - s(l[0])) * Math.sin(s(u2[1]));
          d = 6378137 * d * 6378137 / 2;
        }
        return d;
      }
      function s(i) {
        return i * Math.PI / 180;
      }
      r.default = function(i) {
        return n.geomReduce(i, function(l, u2) {
          return l + function(c) {
            var f, h = 0;
            switch (c.type) {
              case "Polygon":
                return a(c.coordinates);
              case "MultiPolygon":
                for (f = 0; f < c.coordinates.length; f++) h += a(c.coordinates[f]);
                return h;
              case "Point":
              case "MultiPoint":
              case "LineString":
              case "MultiLineString":
                return 0;
            }
            return 0;
          }(u2);
        }, 0);
      };
    }, { "@turf/meta": 63 }], 62: [function(e, t, r) {
      "use strict";
      function n(v, m, g) {
        g === void 0 && (g = {});
        var x = { type: "Feature" };
        return (g.id === 0 || g.id) && (x.id = g.id), g.bbox && (x.bbox = g.bbox), x.properties = m || {}, x.geometry = v, x;
      }
      function a(v, m, g) {
        if (g === void 0 && (g = {}), !v) throw new Error("coordinates is required");
        if (!Array.isArray(v)) throw new Error("coordinates must be an Array");
        if (v.length < 2) throw new Error("coordinates must be at least 2 numbers long");
        if (!d(v[0]) || !d(v[1])) throw new Error("coordinates must contain numbers");
        return n({ type: "Point", coordinates: v }, m, g);
      }
      function o(v, m, g) {
        g === void 0 && (g = {});
        for (var x = 0, b = v; x < b.length; x++) {
          var y = b[x];
          if (y.length < 4) throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");
          for (var w = 0; w < y[y.length - 1].length; w++) if (y[y.length - 1][w] !== y[0][w]) throw new Error("First and last Position are not equivalent.");
        }
        return n({ type: "Polygon", coordinates: v }, m, g);
      }
      function s(v, m, g) {
        if (g === void 0 && (g = {}), v.length < 2) throw new Error("coordinates must be an array of two or more positions");
        return n({ type: "LineString", coordinates: v }, m, g);
      }
      function i(v, m) {
        m === void 0 && (m = {});
        var g = { type: "FeatureCollection" };
        return m.id && (g.id = m.id), m.bbox && (g.bbox = m.bbox), g.features = v, g;
      }
      function l(v, m, g) {
        return g === void 0 && (g = {}), n({ type: "MultiLineString", coordinates: v }, m, g);
      }
      function u2(v, m, g) {
        return g === void 0 && (g = {}), n({ type: "MultiPoint", coordinates: v }, m, g);
      }
      function c(v, m, g) {
        return g === void 0 && (g = {}), n({ type: "MultiPolygon", coordinates: v }, m, g);
      }
      function f(v, m) {
        m === void 0 && (m = "kilometers");
        var g = r.factors[m];
        if (!g) throw new Error(m + " units is invalid");
        return v * g;
      }
      function h(v, m) {
        m === void 0 && (m = "kilometers");
        var g = r.factors[m];
        if (!g) throw new Error(m + " units is invalid");
        return v / g;
      }
      function p(v) {
        return 180 * (v % (2 * Math.PI)) / Math.PI;
      }
      function d(v) {
        return !isNaN(v) && v !== null && !Array.isArray(v);
      }
      Object.defineProperty(r, "__esModule", { value: true }), r.earthRadius = 63710088e-1, r.factors = { centimeters: 100 * r.earthRadius, centimetres: 100 * r.earthRadius, degrees: r.earthRadius / 111325, feet: 3.28084 * r.earthRadius, inches: 39.37 * r.earthRadius, kilometers: r.earthRadius / 1e3, kilometres: r.earthRadius / 1e3, meters: r.earthRadius, metres: r.earthRadius, miles: r.earthRadius / 1609.344, millimeters: 1e3 * r.earthRadius, millimetres: 1e3 * r.earthRadius, nauticalmiles: r.earthRadius / 1852, radians: 1, yards: 1.0936 * r.earthRadius }, r.unitsFactors = { centimeters: 100, centimetres: 100, degrees: 1 / 111325, feet: 3.28084, inches: 39.37, kilometers: 1e-3, kilometres: 1e-3, meters: 1, metres: 1, miles: 1 / 1609.344, millimeters: 1e3, millimetres: 1e3, nauticalmiles: 1 / 1852, radians: 1 / r.earthRadius, yards: 1.0936133 }, r.areaFactors = { acres: 247105e-9, centimeters: 1e4, centimetres: 1e4, feet: 10.763910417, hectares: 1e-4, inches: 1550.003100006, kilometers: 1e-6, kilometres: 1e-6, meters: 1, metres: 1, miles: 386e-9, millimeters: 1e6, millimetres: 1e6, yards: 1.195990046 }, r.feature = n, r.geometry = function(v, m, g) {
        switch (g === void 0 && (g = {}), v) {
          case "Point":
            return a(m).geometry;
          case "LineString":
            return s(m).geometry;
          case "Polygon":
            return o(m).geometry;
          case "MultiPoint":
            return u2(m).geometry;
          case "MultiLineString":
            return l(m).geometry;
          case "MultiPolygon":
            return c(m).geometry;
          default:
            throw new Error(v + " is invalid");
        }
      }, r.point = a, r.points = function(v, m, g) {
        return g === void 0 && (g = {}), i(v.map(function(x) {
          return a(x, m);
        }), g);
      }, r.polygon = o, r.polygons = function(v, m, g) {
        return g === void 0 && (g = {}), i(v.map(function(x) {
          return o(x, m);
        }), g);
      }, r.lineString = s, r.lineStrings = function(v, m, g) {
        return g === void 0 && (g = {}), i(v.map(function(x) {
          return s(x, m);
        }), g);
      }, r.featureCollection = i, r.multiLineString = l, r.multiPoint = u2, r.multiPolygon = c, r.geometryCollection = function(v, m, g) {
        return g === void 0 && (g = {}), n({ type: "GeometryCollection", geometries: v }, m, g);
      }, r.round = function(v, m) {
        if (m === void 0 && (m = 0), m && !(m >= 0)) throw new Error("precision must be a positive number");
        var g = Math.pow(10, m || 0);
        return Math.round(v * g) / g;
      }, r.radiansToLength = f, r.lengthToRadians = h, r.lengthToDegrees = function(v, m) {
        return p(h(v, m));
      }, r.bearingToAzimuth = function(v) {
        var m = v % 360;
        return m < 0 && (m += 360), m;
      }, r.radiansToDegrees = p, r.degreesToRadians = function(v) {
        return v % 360 * Math.PI / 180;
      }, r.convertLength = function(v, m, g) {
        if (m === void 0 && (m = "kilometers"), g === void 0 && (g = "kilometers"), !(v >= 0)) throw new Error("length must be a positive number");
        return f(h(v, m), g);
      }, r.convertArea = function(v, m, g) {
        if (m === void 0 && (m = "meters"), g === void 0 && (g = "kilometers"), !(v >= 0)) throw new Error("area must be a positive number");
        var x = r.areaFactors[m];
        if (!x) throw new Error("invalid original units");
        var b = r.areaFactors[g];
        if (!b) throw new Error("invalid final units");
        return v / x * b;
      }, r.isNumber = d, r.isObject = function(v) {
        return !!v && v.constructor === Object;
      }, r.validateBBox = function(v) {
        if (!v) throw new Error("bbox is required");
        if (!Array.isArray(v)) throw new Error("bbox must be an Array");
        if (v.length !== 4 && v.length !== 6) throw new Error("bbox must be an Array of 4 or 6 numbers");
        v.forEach(function(m) {
          if (!d(m)) throw new Error("bbox must only contain numbers");
        });
      }, r.validateId = function(v) {
        if (!v) throw new Error("id is required");
        if (["string", "number"].indexOf(typeof v) === -1) throw new Error("id must be a number or a string");
      };
    }, {}], 63: [function(e, t, r) {
      "use strict";
      Object.defineProperty(r, "__esModule", { value: true });
      var n = e("@turf/helpers");
      function a(f, h, p) {
        if (f !== null) for (var d, v, m, g, x, b, y, w, _4 = 0, k = 0, T2 = f.type, A2 = T2 === "FeatureCollection", S2 = T2 === "Feature", C2 = A2 ? f.features.length : 1, E2 = 0; E2 < C2; E2++) {
          x = (w = !!(y = A2 ? f.features[E2].geometry : S2 ? f.geometry : f) && y.type === "GeometryCollection") ? y.geometries.length : 1;
          for (var F13 = 0; F13 < x; F13++) {
            var N2 = 0, D2 = 0;
            if ((g = w ? y.geometries[F13] : y) !== null) {
              b = g.coordinates;
              var I2 = g.type;
              switch (_4 = !p || I2 !== "Polygon" && I2 !== "MultiPolygon" ? 0 : 1, I2) {
                case null:
                  break;
                case "Point":
                  if (h(b, k, E2, N2, D2) === false) return false;
                  k++, N2++;
                  break;
                case "LineString":
                case "MultiPoint":
                  for (d = 0; d < b.length; d++) {
                    if (h(b[d], k, E2, N2, D2) === false) return false;
                    k++, I2 === "MultiPoint" && N2++;
                  }
                  I2 === "LineString" && N2++;
                  break;
                case "Polygon":
                case "MultiLineString":
                  for (d = 0; d < b.length; d++) {
                    for (v = 0; v < b[d].length - _4; v++) {
                      if (h(b[d][v], k, E2, N2, D2) === false) return false;
                      k++;
                    }
                    I2 === "MultiLineString" && N2++, I2 === "Polygon" && D2++;
                  }
                  I2 === "Polygon" && N2++;
                  break;
                case "MultiPolygon":
                  for (d = 0; d < b.length; d++) {
                    for (D2 = 0, v = 0; v < b[d].length; v++) {
                      for (m = 0; m < b[d][v].length - _4; m++) {
                        if (h(b[d][v][m], k, E2, N2, D2) === false) return false;
                        k++;
                      }
                      D2++;
                    }
                    N2++;
                  }
                  break;
                case "GeometryCollection":
                  for (d = 0; d < g.geometries.length; d++) if (a(g.geometries[d], h, p) === false) return false;
                  break;
                default:
                  throw new Error("Unknown Geometry Type");
              }
            }
          }
        }
      }
      function o(f, h) {
        var p;
        switch (f.type) {
          case "FeatureCollection":
            for (p = 0; p < f.features.length && h(f.features[p].properties, p) !== false; p++) ;
            break;
          case "Feature":
            h(f.properties, 0);
        }
      }
      function s(f, h) {
        if (f.type === "Feature") h(f, 0);
        else if (f.type === "FeatureCollection") for (var p = 0; p < f.features.length && h(f.features[p], p) !== false; p++) ;
      }
      function i(f, h) {
        var p, d, v, m, g, x, b, y, w, _4, k = 0, T2 = f.type === "FeatureCollection", A2 = f.type === "Feature", S2 = T2 ? f.features.length : 1;
        for (p = 0; p < S2; p++) {
          for (x = T2 ? f.features[p].geometry : A2 ? f.geometry : f, y = T2 ? f.features[p].properties : A2 ? f.properties : {}, w = T2 ? f.features[p].bbox : A2 ? f.bbox : void 0, _4 = T2 ? f.features[p].id : A2 ? f.id : void 0, g = (b = !!x && x.type === "GeometryCollection") ? x.geometries.length : 1, v = 0; v < g; v++) if ((m = b ? x.geometries[v] : x) !== null) switch (m.type) {
            case "Point":
            case "LineString":
            case "MultiPoint":
            case "Polygon":
            case "MultiLineString":
            case "MultiPolygon":
              if (h(m, k, y, w, _4) === false) return false;
              break;
            case "GeometryCollection":
              for (d = 0; d < m.geometries.length; d++) if (h(m.geometries[d], k, y, w, _4) === false) return false;
              break;
            default:
              throw new Error("Unknown Geometry Type");
          }
          else if (h(null, k, y, w, _4) === false) return false;
          k++;
        }
      }
      function l(f, h) {
        i(f, function(p, d, v, m, g) {
          var x, b = p === null ? null : p.type;
          switch (b) {
            case null:
            case "Point":
            case "LineString":
            case "Polygon":
              return h(n.feature(p, v, { bbox: m, id: g }), d, 0) !== false && void 0;
          }
          switch (b) {
            case "MultiPoint":
              x = "Point";
              break;
            case "MultiLineString":
              x = "LineString";
              break;
            case "MultiPolygon":
              x = "Polygon";
          }
          for (var y = 0; y < p.coordinates.length; y++) {
            var w = { type: x, coordinates: p.coordinates[y] };
            if (h(n.feature(w, v), d, y) === false) return false;
          }
        });
      }
      function u2(f, h) {
        l(f, function(p, d, v) {
          var m = 0;
          if (p.geometry) {
            var g = p.geometry.type;
            if (g !== "Point" && g !== "MultiPoint") {
              var x, b = 0, y = 0, w = 0;
              return a(p, function(_4, k, T2, A2, S2) {
                if (x === void 0 || d > b || A2 > y || S2 > w) return x = _4, b = d, y = A2, w = S2, void (m = 0);
                var C2 = n.lineString([x, _4], p.properties);
                if (h(C2, d, v, S2, m) === false) return false;
                m++, x = _4;
              }) !== false && void 0;
            }
          }
        });
      }
      function c(f, h) {
        if (!f) throw new Error("geojson is required");
        l(f, function(p, d, v) {
          if (p.geometry !== null) {
            var m = p.geometry.type, g = p.geometry.coordinates;
            switch (m) {
              case "LineString":
                if (h(p, d, v, 0, 0) === false) return false;
                break;
              case "Polygon":
                for (var x = 0; x < g.length; x++) if (h(n.lineString(g[x], p.properties), d, v, x) === false) return false;
            }
          }
        });
      }
      r.coordEach = a, r.coordReduce = function(f, h, p, d) {
        var v = p;
        return a(f, function(m, g, x, b, y) {
          v = g === 0 && p === void 0 ? m : h(v, m, g, x, b, y);
        }, d), v;
      }, r.propEach = o, r.propReduce = function(f, h, p) {
        var d = p;
        return o(f, function(v, m) {
          d = m === 0 && p === void 0 ? v : h(d, v, m);
        }), d;
      }, r.featureEach = s, r.featureReduce = function(f, h, p) {
        var d = p;
        return s(f, function(v, m) {
          d = m === 0 && p === void 0 ? v : h(d, v, m);
        }), d;
      }, r.coordAll = function(f) {
        var h = [];
        return a(f, function(p) {
          h.push(p);
        }), h;
      }, r.geomEach = i, r.geomReduce = function(f, h, p) {
        var d = p;
        return i(f, function(v, m, g, x, b) {
          d = m === 0 && p === void 0 ? v : h(d, v, m, g, x, b);
        }), d;
      }, r.flattenEach = l, r.flattenReduce = function(f, h, p) {
        var d = p;
        return l(f, function(v, m, g) {
          d = m === 0 && g === 0 && p === void 0 ? v : h(d, v, m, g);
        }), d;
      }, r.segmentEach = u2, r.segmentReduce = function(f, h, p) {
        var d = p, v = false;
        return u2(f, function(m, g, x, b, y) {
          d = v === false && p === void 0 ? m : h(d, m, g, x, b, y), v = true;
        }), d;
      }, r.lineEach = c, r.lineReduce = function(f, h, p) {
        var d = p;
        return c(f, function(v, m, g, x) {
          d = m === 0 && p === void 0 ? v : h(d, v, m, g, x);
        }), d;
      }, r.findSegment = function(f, h) {
        if (h = h || {}, !n.isObject(h)) throw new Error("options is invalid");
        var p, d = h.featureIndex || 0, v = h.multiFeatureIndex || 0, m = h.geometryIndex || 0, g = h.segmentIndex || 0, x = h.properties;
        switch (f.type) {
          case "FeatureCollection":
            d < 0 && (d = f.features.length + d), x = x || f.features[d].properties, p = f.features[d].geometry;
            break;
          case "Feature":
            x = x || f.properties, p = f.geometry;
            break;
          case "Point":
          case "MultiPoint":
            return null;
          case "LineString":
          case "Polygon":
          case "MultiLineString":
          case "MultiPolygon":
            p = f;
            break;
          default:
            throw new Error("geojson is invalid");
        }
        if (p === null) return null;
        var b = p.coordinates;
        switch (p.type) {
          case "Point":
          case "MultiPoint":
            return null;
          case "LineString":
            return g < 0 && (g = b.length + g - 1), n.lineString([b[g], b[g + 1]], x, h);
          case "Polygon":
            return m < 0 && (m = b.length + m), g < 0 && (g = b[m].length + g - 1), n.lineString([b[m][g], b[m][g + 1]], x, h);
          case "MultiLineString":
            return v < 0 && (v = b.length + v), g < 0 && (g = b[v].length + g - 1), n.lineString([b[v][g], b[v][g + 1]], x, h);
          case "MultiPolygon":
            return v < 0 && (v = b.length + v), m < 0 && (m = b[v].length + m), g < 0 && (g = b[v][m].length - g - 1), n.lineString([b[v][m][g], b[v][m][g + 1]], x, h);
        }
        throw new Error("geojson is invalid");
      }, r.findPoint = function(f, h) {
        if (h = h || {}, !n.isObject(h)) throw new Error("options is invalid");
        var p, d = h.featureIndex || 0, v = h.multiFeatureIndex || 0, m = h.geometryIndex || 0, g = h.coordIndex || 0, x = h.properties;
        switch (f.type) {
          case "FeatureCollection":
            d < 0 && (d = f.features.length + d), x = x || f.features[d].properties, p = f.features[d].geometry;
            break;
          case "Feature":
            x = x || f.properties, p = f.geometry;
            break;
          case "Point":
          case "MultiPoint":
            return null;
          case "LineString":
          case "Polygon":
          case "MultiLineString":
          case "MultiPolygon":
            p = f;
            break;
          default:
            throw new Error("geojson is invalid");
        }
        if (p === null) return null;
        var b = p.coordinates;
        switch (p.type) {
          case "Point":
            return n.point(b, x, h);
          case "MultiPoint":
            return v < 0 && (v = b.length + v), n.point(b[v], x, h);
          case "LineString":
            return g < 0 && (g = b.length + g), n.point(b[g], x, h);
          case "Polygon":
            return m < 0 && (m = b.length + m), g < 0 && (g = b[m].length + g), n.point(b[m][g], x, h);
          case "MultiLineString":
            return v < 0 && (v = b.length + v), g < 0 && (g = b[v].length + g), n.point(b[v][g], x, h);
          case "MultiPolygon":
            return v < 0 && (v = b.length + v), m < 0 && (m = b[v].length + m), g < 0 && (g = b[v][m].length - g), n.point(b[v][m][g], x, h);
        }
        throw new Error("geojson is invalid");
      };
    }, { "@turf/helpers": 62 }], 64: [function(e, t, r) {
      "use strict";
      Object.defineProperty(r, "__esModule", { value: true });
      var n = e("@turf/meta");
      function a(o) {
        var s = [1 / 0, 1 / 0, -1 / 0, -1 / 0];
        return n.coordEach(o, function(i) {
          s[0] > i[0] && (s[0] = i[0]), s[1] > i[1] && (s[1] = i[1]), s[2] < i[0] && (s[2] = i[0]), s[3] < i[1] && (s[3] = i[1]);
        }), s;
      }
      a.default = a, r.default = a;
    }, { "@turf/meta": 66 }], 65: [function(e, t, r) {
      arguments[4][62][0].apply(r, arguments);
    }, { dup: 62 }], 66: [function(e, t, r) {
      arguments[4][63][0].apply(r, arguments);
    }, { "@turf/helpers": 65, dup: 63 }], 67: [function(e, t, r) {
      "use strict";
      Object.defineProperty(r, "__esModule", { value: true });
      var n = e("@turf/meta"), a = e("@turf/helpers");
      r.default = function(o, s) {
        s === void 0 && (s = {});
        var i = 0, l = 0, u2 = 0;
        return n.coordEach(o, function(c) {
          i += c[0], l += c[1], u2++;
        }), a.point([i / u2, l / u2], s.properties);
      };
    }, { "@turf/helpers": 68, "@turf/meta": 69 }], 68: [function(e, t, r) {
      "use strict";
      function n(v, m, g) {
        g === void 0 && (g = {});
        var x = { type: "Feature" };
        return (g.id === 0 || g.id) && (x.id = g.id), g.bbox && (x.bbox = g.bbox), x.properties = m || {}, x.geometry = v, x;
      }
      function a(v, m, g) {
        return g === void 0 && (g = {}), n({ type: "Point", coordinates: v }, m, g);
      }
      function o(v, m, g) {
        g === void 0 && (g = {});
        for (var x = 0, b = v; x < b.length; x++) {
          var y = b[x];
          if (y.length < 4) throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");
          for (var w = 0; w < y[y.length - 1].length; w++) if (y[y.length - 1][w] !== y[0][w]) throw new Error("First and last Position are not equivalent.");
        }
        return n({ type: "Polygon", coordinates: v }, m, g);
      }
      function s(v, m, g) {
        if (g === void 0 && (g = {}), v.length < 2) throw new Error("coordinates must be an array of two or more positions");
        return n({ type: "LineString", coordinates: v }, m, g);
      }
      function i(v, m) {
        m === void 0 && (m = {});
        var g = { type: "FeatureCollection" };
        return m.id && (g.id = m.id), m.bbox && (g.bbox = m.bbox), g.features = v, g;
      }
      function l(v, m, g) {
        return g === void 0 && (g = {}), n({ type: "MultiLineString", coordinates: v }, m, g);
      }
      function u2(v, m, g) {
        return g === void 0 && (g = {}), n({ type: "MultiPoint", coordinates: v }, m, g);
      }
      function c(v, m, g) {
        return g === void 0 && (g = {}), n({ type: "MultiPolygon", coordinates: v }, m, g);
      }
      function f(v, m) {
        m === void 0 && (m = "kilometers");
        var g = r.factors[m];
        if (!g) throw new Error(m + " units is invalid");
        return v * g;
      }
      function h(v, m) {
        m === void 0 && (m = "kilometers");
        var g = r.factors[m];
        if (!g) throw new Error(m + " units is invalid");
        return v / g;
      }
      function p(v) {
        return 180 * (v % (2 * Math.PI)) / Math.PI;
      }
      function d(v) {
        return !isNaN(v) && v !== null && !Array.isArray(v) && !/^\s*$/.test(v);
      }
      Object.defineProperty(r, "__esModule", { value: true }), r.earthRadius = 63710088e-1, r.factors = { centimeters: 100 * r.earthRadius, centimetres: 100 * r.earthRadius, degrees: r.earthRadius / 111325, feet: 3.28084 * r.earthRadius, inches: 39.37 * r.earthRadius, kilometers: r.earthRadius / 1e3, kilometres: r.earthRadius / 1e3, meters: r.earthRadius, metres: r.earthRadius, miles: r.earthRadius / 1609.344, millimeters: 1e3 * r.earthRadius, millimetres: 1e3 * r.earthRadius, nauticalmiles: r.earthRadius / 1852, radians: 1, yards: r.earthRadius / 1.0936 }, r.unitsFactors = { centimeters: 100, centimetres: 100, degrees: 1 / 111325, feet: 3.28084, inches: 39.37, kilometers: 1e-3, kilometres: 1e-3, meters: 1, metres: 1, miles: 1 / 1609.344, millimeters: 1e3, millimetres: 1e3, nauticalmiles: 1 / 1852, radians: 1 / r.earthRadius, yards: 1 / 1.0936 }, r.areaFactors = { acres: 247105e-9, centimeters: 1e4, centimetres: 1e4, feet: 10.763910417, inches: 1550.003100006, kilometers: 1e-6, kilometres: 1e-6, meters: 1, metres: 1, miles: 386e-9, millimeters: 1e6, millimetres: 1e6, yards: 1.195990046 }, r.feature = n, r.geometry = function(v, m, g) {
        switch (g === void 0 && (g = {}), v) {
          case "Point":
            return a(m).geometry;
          case "LineString":
            return s(m).geometry;
          case "Polygon":
            return o(m).geometry;
          case "MultiPoint":
            return u2(m).geometry;
          case "MultiLineString":
            return l(m).geometry;
          case "MultiPolygon":
            return c(m).geometry;
          default:
            throw new Error(v + " is invalid");
        }
      }, r.point = a, r.points = function(v, m, g) {
        return g === void 0 && (g = {}), i(v.map(function(x) {
          return a(x, m);
        }), g);
      }, r.polygon = o, r.polygons = function(v, m, g) {
        return g === void 0 && (g = {}), i(v.map(function(x) {
          return o(x, m);
        }), g);
      }, r.lineString = s, r.lineStrings = function(v, m, g) {
        return g === void 0 && (g = {}), i(v.map(function(x) {
          return s(x, m);
        }), g);
      }, r.featureCollection = i, r.multiLineString = l, r.multiPoint = u2, r.multiPolygon = c, r.geometryCollection = function(v, m, g) {
        return g === void 0 && (g = {}), n({ type: "GeometryCollection", geometries: v }, m, g);
      }, r.round = function(v, m) {
        if (m === void 0 && (m = 0), m && !(m >= 0)) throw new Error("precision must be a positive number");
        var g = Math.pow(10, m || 0);
        return Math.round(v * g) / g;
      }, r.radiansToLength = f, r.lengthToRadians = h, r.lengthToDegrees = function(v, m) {
        return p(h(v, m));
      }, r.bearingToAzimuth = function(v) {
        var m = v % 360;
        return m < 0 && (m += 360), m;
      }, r.radiansToDegrees = p, r.degreesToRadians = function(v) {
        return v % 360 * Math.PI / 180;
      }, r.convertLength = function(v, m, g) {
        if (m === void 0 && (m = "kilometers"), g === void 0 && (g = "kilometers"), !(v >= 0)) throw new Error("length must be a positive number");
        return f(h(v, m), g);
      }, r.convertArea = function(v, m, g) {
        if (m === void 0 && (m = "meters"), g === void 0 && (g = "kilometers"), !(v >= 0)) throw new Error("area must be a positive number");
        var x = r.areaFactors[m];
        if (!x) throw new Error("invalid original units");
        var b = r.areaFactors[g];
        if (!b) throw new Error("invalid final units");
        return v / x * b;
      }, r.isNumber = d, r.isObject = function(v) {
        return !!v && v.constructor === Object;
      }, r.validateBBox = function(v) {
        if (!v) throw new Error("bbox is required");
        if (!Array.isArray(v)) throw new Error("bbox must be an Array");
        if (v.length !== 4 && v.length !== 6) throw new Error("bbox must be an Array of 4 or 6 numbers");
        v.forEach(function(m) {
          if (!d(m)) throw new Error("bbox must only contain numbers");
        });
      }, r.validateId = function(v) {
        if (!v) throw new Error("id is required");
        if (["string", "number"].indexOf(typeof v) === -1) throw new Error("id must be a number or a string");
      }, r.radians2degrees = function() {
        throw new Error("method has been renamed to `radiansToDegrees`");
      }, r.degrees2radians = function() {
        throw new Error("method has been renamed to `degreesToRadians`");
      }, r.distanceToDegrees = function() {
        throw new Error("method has been renamed to `lengthToDegrees`");
      }, r.distanceToRadians = function() {
        throw new Error("method has been renamed to `lengthToRadians`");
      }, r.radiansToDistance = function() {
        throw new Error("method has been renamed to `radiansToLength`");
      }, r.bearingToAngle = function() {
        throw new Error("method has been renamed to `bearingToAzimuth`");
      }, r.convertDistance = function() {
        throw new Error("method has been renamed to `convertLength`");
      };
    }, {}], 69: [function(e, t, r) {
      "use strict";
      Object.defineProperty(r, "__esModule", { value: true });
      var n = e("@turf/helpers");
      function a(f, h, p) {
        if (f !== null) for (var d, v, m, g, x, b, y, w, _4 = 0, k = 0, T2 = f.type, A2 = T2 === "FeatureCollection", S2 = T2 === "Feature", C2 = A2 ? f.features.length : 1, E2 = 0; E2 < C2; E2++) {
          x = (w = !!(y = A2 ? f.features[E2].geometry : S2 ? f.geometry : f) && y.type === "GeometryCollection") ? y.geometries.length : 1;
          for (var F13 = 0; F13 < x; F13++) {
            var N2 = 0, D2 = 0;
            if ((g = w ? y.geometries[F13] : y) !== null) {
              b = g.coordinates;
              var I2 = g.type;
              switch (_4 = !p || I2 !== "Polygon" && I2 !== "MultiPolygon" ? 0 : 1, I2) {
                case null:
                  break;
                case "Point":
                  if (h(b, k, E2, N2, D2) === false) return false;
                  k++, N2++;
                  break;
                case "LineString":
                case "MultiPoint":
                  for (d = 0; d < b.length; d++) {
                    if (h(b[d], k, E2, N2, D2) === false) return false;
                    k++, I2 === "MultiPoint" && N2++;
                  }
                  I2 === "LineString" && N2++;
                  break;
                case "Polygon":
                case "MultiLineString":
                  for (d = 0; d < b.length; d++) {
                    for (v = 0; v < b[d].length - _4; v++) {
                      if (h(b[d][v], k, E2, N2, D2) === false) return false;
                      k++;
                    }
                    I2 === "MultiLineString" && N2++, I2 === "Polygon" && D2++;
                  }
                  I2 === "Polygon" && N2++;
                  break;
                case "MultiPolygon":
                  for (d = 0; d < b.length; d++) {
                    for (D2 = 0, v = 0; v < b[d].length; v++) {
                      for (m = 0; m < b[d][v].length - _4; m++) {
                        if (h(b[d][v][m], k, E2, N2, D2) === false) return false;
                        k++;
                      }
                      D2++;
                    }
                    N2++;
                  }
                  break;
                case "GeometryCollection":
                  for (d = 0; d < g.geometries.length; d++) if (a(g.geometries[d], h, p) === false) return false;
                  break;
                default:
                  throw new Error("Unknown Geometry Type");
              }
            }
          }
        }
      }
      function o(f, h) {
        var p;
        switch (f.type) {
          case "FeatureCollection":
            for (p = 0; p < f.features.length && h(f.features[p].properties, p) !== false; p++) ;
            break;
          case "Feature":
            h(f.properties, 0);
        }
      }
      function s(f, h) {
        if (f.type === "Feature") h(f, 0);
        else if (f.type === "FeatureCollection") for (var p = 0; p < f.features.length && h(f.features[p], p) !== false; p++) ;
      }
      function i(f, h) {
        var p, d, v, m, g, x, b, y, w, _4, k = 0, T2 = f.type === "FeatureCollection", A2 = f.type === "Feature", S2 = T2 ? f.features.length : 1;
        for (p = 0; p < S2; p++) {
          for (x = T2 ? f.features[p].geometry : A2 ? f.geometry : f, y = T2 ? f.features[p].properties : A2 ? f.properties : {}, w = T2 ? f.features[p].bbox : A2 ? f.bbox : void 0, _4 = T2 ? f.features[p].id : A2 ? f.id : void 0, g = (b = !!x && x.type === "GeometryCollection") ? x.geometries.length : 1, v = 0; v < g; v++) if ((m = b ? x.geometries[v] : x) !== null) switch (m.type) {
            case "Point":
            case "LineString":
            case "MultiPoint":
            case "Polygon":
            case "MultiLineString":
            case "MultiPolygon":
              if (h(m, k, y, w, _4) === false) return false;
              break;
            case "GeometryCollection":
              for (d = 0; d < m.geometries.length; d++) if (h(m.geometries[d], k, y, w, _4) === false) return false;
              break;
            default:
              throw new Error("Unknown Geometry Type");
          }
          else if (h(null, k, y, w, _4) === false) return false;
          k++;
        }
      }
      function l(f, h) {
        i(f, function(p, d, v, m, g) {
          var x, b = p === null ? null : p.type;
          switch (b) {
            case null:
            case "Point":
            case "LineString":
            case "Polygon":
              return h(n.feature(p, v, { bbox: m, id: g }), d, 0) !== false && void 0;
          }
          switch (b) {
            case "MultiPoint":
              x = "Point";
              break;
            case "MultiLineString":
              x = "LineString";
              break;
            case "MultiPolygon":
              x = "Polygon";
          }
          for (var y = 0; y < p.coordinates.length; y++) {
            var w = { type: x, coordinates: p.coordinates[y] };
            if (h(n.feature(w, v), d, y) === false) return false;
          }
        });
      }
      function u2(f, h) {
        l(f, function(p, d, v) {
          var m = 0;
          if (p.geometry) {
            var g = p.geometry.type;
            if (g !== "Point" && g !== "MultiPoint") {
              var x, b = 0, y = 0, w = 0;
              return a(p, function(_4, k, T2, A2, S2) {
                if (x === void 0 || d > b || A2 > y || S2 > w) return x = _4, b = d, y = A2, w = S2, void (m = 0);
                var C2 = n.lineString([x, _4], p.properties);
                if (h(C2, d, v, S2, m) === false) return false;
                m++, x = _4;
              }) !== false && void 0;
            }
          }
        });
      }
      function c(f, h) {
        if (!f) throw new Error("geojson is required");
        l(f, function(p, d, v) {
          if (p.geometry !== null) {
            var m = p.geometry.type, g = p.geometry.coordinates;
            switch (m) {
              case "LineString":
                if (h(p, d, v, 0, 0) === false) return false;
                break;
              case "Polygon":
                for (var x = 0; x < g.length; x++) if (h(n.lineString(g[x], p.properties), d, v, x) === false) return false;
            }
          }
        });
      }
      r.coordEach = a, r.coordReduce = function(f, h, p, d) {
        var v = p;
        return a(f, function(m, g, x, b, y) {
          v = g === 0 && p === void 0 ? m : h(v, m, g, x, b, y);
        }, d), v;
      }, r.propEach = o, r.propReduce = function(f, h, p) {
        var d = p;
        return o(f, function(v, m) {
          d = m === 0 && p === void 0 ? v : h(d, v, m);
        }), d;
      }, r.featureEach = s, r.featureReduce = function(f, h, p) {
        var d = p;
        return s(f, function(v, m) {
          d = m === 0 && p === void 0 ? v : h(d, v, m);
        }), d;
      }, r.coordAll = function(f) {
        var h = [];
        return a(f, function(p) {
          h.push(p);
        }), h;
      }, r.geomEach = i, r.geomReduce = function(f, h, p) {
        var d = p;
        return i(f, function(v, m, g, x, b) {
          d = m === 0 && p === void 0 ? v : h(d, v, m, g, x, b);
        }), d;
      }, r.flattenEach = l, r.flattenReduce = function(f, h, p) {
        var d = p;
        return l(f, function(v, m, g) {
          d = m === 0 && g === 0 && p === void 0 ? v : h(d, v, m, g);
        }), d;
      }, r.segmentEach = u2, r.segmentReduce = function(f, h, p) {
        var d = p, v = false;
        return u2(f, function(m, g, x, b, y) {
          d = v === false && p === void 0 ? m : h(d, m, g, x, b, y), v = true;
        }), d;
      }, r.lineEach = c, r.lineReduce = function(f, h, p) {
        var d = p;
        return c(f, function(v, m, g, x) {
          d = m === 0 && p === void 0 ? v : h(d, v, m, g, x);
        }), d;
      }, r.findSegment = function(f, h) {
        if (h = h || {}, !n.isObject(h)) throw new Error("options is invalid");
        var p, d = h.featureIndex || 0, v = h.multiFeatureIndex || 0, m = h.geometryIndex || 0, g = h.segmentIndex || 0, x = h.properties;
        switch (f.type) {
          case "FeatureCollection":
            d < 0 && (d = f.features.length + d), x = x || f.features[d].properties, p = f.features[d].geometry;
            break;
          case "Feature":
            x = x || f.properties, p = f.geometry;
            break;
          case "Point":
          case "MultiPoint":
            return null;
          case "LineString":
          case "Polygon":
          case "MultiLineString":
          case "MultiPolygon":
            p = f;
            break;
          default:
            throw new Error("geojson is invalid");
        }
        if (p === null) return null;
        var b = p.coordinates;
        switch (p.type) {
          case "Point":
          case "MultiPoint":
            return null;
          case "LineString":
            return g < 0 && (g = b.length + g - 1), n.lineString([b[g], b[g + 1]], x, h);
          case "Polygon":
            return m < 0 && (m = b.length + m), g < 0 && (g = b[m].length + g - 1), n.lineString([b[m][g], b[m][g + 1]], x, h);
          case "MultiLineString":
            return v < 0 && (v = b.length + v), g < 0 && (g = b[v].length + g - 1), n.lineString([b[v][g], b[v][g + 1]], x, h);
          case "MultiPolygon":
            return v < 0 && (v = b.length + v), m < 0 && (m = b[v].length + m), g < 0 && (g = b[v][m].length - g - 1), n.lineString([b[v][m][g], b[v][m][g + 1]], x, h);
        }
        throw new Error("geojson is invalid");
      }, r.findPoint = function(f, h) {
        if (h = h || {}, !n.isObject(h)) throw new Error("options is invalid");
        var p, d = h.featureIndex || 0, v = h.multiFeatureIndex || 0, m = h.geometryIndex || 0, g = h.coordIndex || 0, x = h.properties;
        switch (f.type) {
          case "FeatureCollection":
            d < 0 && (d = f.features.length + d), x = x || f.features[d].properties, p = f.features[d].geometry;
            break;
          case "Feature":
            x = x || f.properties, p = f.geometry;
            break;
          case "Point":
          case "MultiPoint":
            return null;
          case "LineString":
          case "Polygon":
          case "MultiLineString":
          case "MultiPolygon":
            p = f;
            break;
          default:
            throw new Error("geojson is invalid");
        }
        if (p === null) return null;
        var b = p.coordinates;
        switch (p.type) {
          case "Point":
            return n.point(b, x, h);
          case "MultiPoint":
            return v < 0 && (v = b.length + v), n.point(b[v], x, h);
          case "LineString":
            return g < 0 && (g = b.length + g), n.point(b[g], x, h);
          case "Polygon":
            return m < 0 && (m = b.length + m), g < 0 && (g = b[m].length + g), n.point(b[m][g], x, h);
          case "MultiLineString":
            return v < 0 && (v = b.length + v), g < 0 && (g = b[v].length + g), n.point(b[v][g], x, h);
          case "MultiPolygon":
            return v < 0 && (v = b.length + v), m < 0 && (m = b[v].length + m), g < 0 && (g = b[v][m].length - g), n.point(b[v][m][g], x, h);
        }
        throw new Error("geojson is invalid");
      };
    }, { "@turf/helpers": 68 }], 70: [function(e, t, r) {
      t.exports = function(n) {
        var a = 0, o = 0, s = 0, i = 0;
        return n.map(function(l) {
          var u2 = (l = l.slice())[0], c = u2.toUpperCase();
          if (u2 != c) switch (l[0] = c, u2) {
            case "a":
              l[6] += s, l[7] += i;
              break;
            case "v":
              l[1] += i;
              break;
            case "h":
              l[1] += s;
              break;
            default:
              for (var f = 1; f < l.length; ) l[f++] += s, l[f++] += i;
          }
          switch (c) {
            case "Z":
              s = a, i = o;
              break;
            case "H":
              s = l[1];
              break;
            case "V":
              i = l[1];
              break;
            case "M":
              s = a = l[1], i = o = l[2];
              break;
            default:
              s = l[l.length - 2], i = l[l.length - 1];
          }
          return l;
        });
      };
    }, {}], 71: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a) {
        if (!n || n.length == null) throw Error("Argument should be an array");
        a = a == null ? 1 : Math.floor(a);
        for (var o = Array(2 * a), s = 0; s < a; s++) {
          for (var i = -1 / 0, l = 1 / 0, u2 = s, c = n.length; u2 < c; u2 += a) n[u2] > i && (i = n[u2]), n[u2] < l && (l = n[u2]);
          o[s] = l, o[a + s] = i;
        }
        return o;
      };
    }, {}], 72: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a, o) {
        if (typeof Array.prototype.findIndex == "function") return n.findIndex(a, o);
        if (typeof a != "function") throw new TypeError("predicate must be a function");
        var s = Object(n), i = s.length;
        if (i === 0) return -1;
        for (var l = 0; l < i; l++) if (a.call(o, s[l], l, s)) return l;
        return -1;
      };
    }, {}], 73: [function(e, t, r) {
      "use strict";
      var n = e("array-bounds");
      t.exports = function(a, o, s) {
        if (!a || a.length == null) throw Error("Argument should be an array");
        o == null && (o = 1), s == null && (s = n(a, o));
        for (var i = 0; i < o; i++) {
          var l = s[o + i], u2 = s[i], c = i, f = a.length;
          if (l === 1 / 0 && u2 === -1 / 0) for (c = i; c < f; c += o) a[c] = a[c] === l ? 1 : a[c] === u2 ? 0 : 0.5;
          else if (l === 1 / 0) for (c = i; c < f; c += o) a[c] = a[c] === l ? 1 : 0;
          else if (u2 === -1 / 0) for (c = i; c < f; c += o) a[c] = a[c] === u2 ? 0 : 1;
          else {
            var h = l - u2;
            for (c = i; c < f; c += o) isNaN(a[c]) || (a[c] = h === 0 ? 0.5 : (a[c] - u2) / h);
          }
        }
        return a;
      };
    }, { "array-bounds": 71 }], 74: [function(e, t, r) {
      t.exports = function(n, a) {
        var o = typeof n == "number", s = typeof a == "number";
        o && !s ? (a = n, n = 0) : o || s || (n = 0, a = 0);
        var i = (a |= 0) - (n |= 0);
        if (i < 0) throw new Error("array length must be positive");
        for (var l = new Array(i), u2 = 0, c = n; u2 < i; u2++, c++) l[u2] = c;
        return l;
      };
    }, {}], 75: [function(e, t, r) {
      (function(n) {
        (function() {
          "use strict";
          var a = e("object-assign");
          function o(A2, S2) {
            if (A2 === S2) return 0;
            for (var C2 = A2.length, E2 = S2.length, F13 = 0, N2 = Math.min(C2, E2); F13 < N2; ++F13) if (A2[F13] !== S2[F13]) {
              C2 = A2[F13], E2 = S2[F13];
              break;
            }
            return C2 < E2 ? -1 : E2 < C2 ? 1 : 0;
          }
          function s(A2) {
            return n.Buffer && typeof n.Buffer.isBuffer == "function" ? n.Buffer.isBuffer(A2) : !(A2 == null || !A2._isBuffer);
          }
          var i = e("util/"), l = Object.prototype.hasOwnProperty, u2 = Array.prototype.slice, c = (function() {
          }).name === "foo";
          function f(A2) {
            return Object.prototype.toString.call(A2);
          }
          function h(A2) {
            return !s(A2) && typeof n.ArrayBuffer == "function" && (typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(A2) : !!A2 && (A2 instanceof DataView || !!(A2.buffer && A2.buffer instanceof ArrayBuffer)));
          }
          var p = t.exports = b, d = /\s*function\s+([^\(\s]*)\s*/;
          function v(A2) {
            if (i.isFunction(A2)) {
              if (c) return A2.name;
              var S2 = A2.toString().match(d);
              return S2 && S2[1];
            }
          }
          function m(A2, S2) {
            return typeof A2 == "string" ? A2.length < S2 ? A2 : A2.slice(0, S2) : A2;
          }
          function g(A2) {
            if (c || !i.isFunction(A2)) return i.inspect(A2);
            var S2 = v(A2);
            return "[Function" + (S2 ? ": " + S2 : "") + "]";
          }
          function x(A2, S2, C2, E2, F13) {
            throw new p.AssertionError({ message: C2, actual: A2, expected: S2, operator: E2, stackStartFunction: F13 });
          }
          function b(A2, S2) {
            A2 || x(A2, true, S2, "==", p.ok);
          }
          function y(A2, S2, C2, E2) {
            if (A2 === S2) return true;
            if (s(A2) && s(S2)) return o(A2, S2) === 0;
            if (i.isDate(A2) && i.isDate(S2)) return A2.getTime() === S2.getTime();
            if (i.isRegExp(A2) && i.isRegExp(S2)) return A2.source === S2.source && A2.global === S2.global && A2.multiline === S2.multiline && A2.lastIndex === S2.lastIndex && A2.ignoreCase === S2.ignoreCase;
            if (A2 !== null && typeof A2 == "object" || S2 !== null && typeof S2 == "object") {
              if (h(A2) && h(S2) && f(A2) === f(S2) && !(A2 instanceof Float32Array || A2 instanceof Float64Array)) return o(new Uint8Array(A2.buffer), new Uint8Array(S2.buffer)) === 0;
              if (s(A2) !== s(S2)) return false;
              var F13 = (E2 = E2 || { actual: [], expected: [] }).actual.indexOf(A2);
              return F13 !== -1 && F13 === E2.expected.indexOf(S2) || (E2.actual.push(A2), E2.expected.push(S2), function(N2, D2, I2, O2) {
                if (N2 == null || D2 == null) return false;
                if (i.isPrimitive(N2) || i.isPrimitive(D2)) return N2 === D2;
                if (I2 && Object.getPrototypeOf(N2) !== Object.getPrototypeOf(D2)) return false;
                var L2 = w(N2), V2 = w(D2);
                if (L2 && !V2 || !L2 && V2) return false;
                if (L2) return N2 = u2.call(N2), D2 = u2.call(D2), y(N2, D2, I2);
                var W2, X2, Y2 = T2(N2), K2 = T2(D2);
                if (Y2.length !== K2.length) return false;
                for (Y2.sort(), K2.sort(), X2 = Y2.length - 1; X2 >= 0; X2--) if (Y2[X2] !== K2[X2]) return false;
                for (X2 = Y2.length - 1; X2 >= 0; X2--) if (W2 = Y2[X2], !y(N2[W2], D2[W2], I2, O2)) return false;
                return true;
              }(A2, S2, C2, E2));
            }
            return C2 ? A2 === S2 : A2 == S2;
          }
          function w(A2) {
            return Object.prototype.toString.call(A2) == "[object Arguments]";
          }
          function _4(A2, S2) {
            if (!A2 || !S2) return false;
            if (Object.prototype.toString.call(S2) == "[object RegExp]") return S2.test(A2);
            try {
              if (A2 instanceof S2) return true;
            } catch {
            }
            return !Error.isPrototypeOf(S2) && S2.call({}, A2) === true;
          }
          function k(A2, S2, C2, E2) {
            var F13;
            if (typeof S2 != "function") throw new TypeError('"block" argument must be a function');
            typeof C2 == "string" && (E2 = C2, C2 = null), F13 = function(I2) {
              var O2;
              try {
                I2();
              } catch (L2) {
                O2 = L2;
              }
              return O2;
            }(S2), E2 = (C2 && C2.name ? " (" + C2.name + ")." : ".") + (E2 ? " " + E2 : "."), A2 && !F13 && x(F13, C2, "Missing expected exception" + E2);
            var N2 = typeof E2 == "string", D2 = !A2 && F13 && !C2;
            if ((!A2 && i.isError(F13) && N2 && _4(F13, C2) || D2) && x(F13, C2, "Got unwanted exception" + E2), A2 && F13 && C2 && !_4(F13, C2) || !A2 && F13) throw F13;
          }
          p.AssertionError = function(A2) {
            this.name = "AssertionError", this.actual = A2.actual, this.expected = A2.expected, this.operator = A2.operator, A2.message ? (this.message = A2.message, this.generatedMessage = false) : (this.message = function(I2) {
              return m(g(I2.actual), 128) + " " + I2.operator + " " + m(g(I2.expected), 128);
            }(this), this.generatedMessage = true);
            var S2 = A2.stackStartFunction || x;
            if (Error.captureStackTrace) Error.captureStackTrace(this, S2);
            else {
              var C2 = new Error();
              if (C2.stack) {
                var E2 = C2.stack, F13 = v(S2), N2 = E2.indexOf(`
` + F13);
                if (N2 >= 0) {
                  var D2 = E2.indexOf(`
`, N2 + 1);
                  E2 = E2.substring(D2 + 1);
                }
                this.stack = E2;
              }
            }
          }, i.inherits(p.AssertionError, Error), p.fail = x, p.ok = b, p.equal = function(A2, S2, C2) {
            A2 != S2 && x(A2, S2, C2, "==", p.equal);
          }, p.notEqual = function(A2, S2, C2) {
            A2 == S2 && x(A2, S2, C2, "!=", p.notEqual);
          }, p.deepEqual = function(A2, S2, C2) {
            y(A2, S2, false) || x(A2, S2, C2, "deepEqual", p.deepEqual);
          }, p.deepStrictEqual = function(A2, S2, C2) {
            y(A2, S2, true) || x(A2, S2, C2, "deepStrictEqual", p.deepStrictEqual);
          }, p.notDeepEqual = function(A2, S2, C2) {
            y(A2, S2, false) && x(A2, S2, C2, "notDeepEqual", p.notDeepEqual);
          }, p.notDeepStrictEqual = function A2(S2, C2, E2) {
            y(S2, C2, true) && x(S2, C2, E2, "notDeepStrictEqual", A2);
          }, p.strictEqual = function(A2, S2, C2) {
            A2 !== S2 && x(A2, S2, C2, "===", p.strictEqual);
          }, p.notStrictEqual = function(A2, S2, C2) {
            A2 === S2 && x(A2, S2, C2, "!==", p.notStrictEqual);
          }, p.throws = function(A2, S2, C2) {
            k(true, A2, S2, C2);
          }, p.doesNotThrow = function(A2, S2, C2) {
            k(false, A2, S2, C2);
          }, p.ifError = function(A2) {
            if (A2) throw A2;
          }, p.strict = a(function A2(S2, C2) {
            S2 || x(S2, true, C2, "==", A2);
          }, p, { equal: p.strictEqual, deepEqual: p.deepStrictEqual, notEqual: p.notStrictEqual, notDeepEqual: p.notDeepStrictEqual }), p.strict.strict = p.strict;
          var T2 = Object.keys || function(A2) {
            var S2 = [];
            for (var C2 in A2) l.call(A2, C2) && S2.push(C2);
            return S2;
          };
        }).call(this);
      }).call(this, typeof global < "u" ? global : typeof self < "u" ? self : typeof window < "u" ? window : {});
    }, { "object-assign": 247, "util/": 78 }], 76: [function(e, t, r) {
      typeof Object.create == "function" ? t.exports = function(n, a) {
        n.super_ = a, n.prototype = Object.create(a.prototype, { constructor: { value: n, enumerable: false, writable: true, configurable: true } });
      } : t.exports = function(n, a) {
        n.super_ = a;
        var o = function() {
        };
        o.prototype = a.prototype, n.prototype = new o(), n.prototype.constructor = n;
      };
    }, {}], 77: [function(e, t, r) {
      t.exports = function(n) {
        return n && typeof n == "object" && typeof n.copy == "function" && typeof n.fill == "function" && typeof n.readUInt8 == "function";
      };
    }, {}], 78: [function(e, t, r) {
      (function(n, a) {
        (function() {
          var o = /%[sdj%]/g;
          r.format = function(N2) {
            if (!x(N2)) {
              for (var D2 = [], I2 = 0; I2 < arguments.length; I2++) D2.push(l(arguments[I2]));
              return D2.join(" ");
            }
            I2 = 1;
            for (var O2 = arguments, L2 = O2.length, V2 = String(N2).replace(o, function(X2) {
              if (X2 === "%%") return "%";
              if (I2 >= L2) return X2;
              switch (X2) {
                case "%s":
                  return String(O2[I2++]);
                case "%d":
                  return Number(O2[I2++]);
                case "%j":
                  try {
                    return JSON.stringify(O2[I2++]);
                  } catch {
                    return "[Circular]";
                  }
                default:
                  return X2;
              }
            }), W2 = O2[I2]; I2 < L2; W2 = O2[++I2]) m(W2) || !w(W2) ? V2 += " " + W2 : V2 += " " + l(W2);
            return V2;
          }, r.deprecate = function(N2, D2) {
            if (b(a.process)) return function() {
              return r.deprecate(N2, D2).apply(this, arguments);
            };
            if (n.noDeprecation === true) return N2;
            var I2 = false;
            return function() {
              if (!I2) {
                if (n.throwDeprecation) throw new Error(D2);
                n.traceDeprecation ? console.trace(D2) : console.error(D2), I2 = true;
              }
              return N2.apply(this, arguments);
            };
          };
          var s, i = {};
          function l(N2, D2) {
            var I2 = { seen: [], stylize: c };
            return arguments.length >= 3 && (I2.depth = arguments[2]), arguments.length >= 4 && (I2.colors = arguments[3]), v(D2) ? I2.showHidden = D2 : D2 && r._extend(I2, D2), b(I2.showHidden) && (I2.showHidden = false), b(I2.depth) && (I2.depth = 2), b(I2.colors) && (I2.colors = false), b(I2.customInspect) && (I2.customInspect = true), I2.colors && (I2.stylize = u2), f(I2, N2, I2.depth);
          }
          function u2(N2, D2) {
            var I2 = l.styles[D2];
            return I2 ? "\x1B[" + l.colors[I2][0] + "m" + N2 + "\x1B[" + l.colors[I2][1] + "m" : N2;
          }
          function c(N2, D2) {
            return N2;
          }
          function f(N2, D2, I2) {
            if (N2.customInspect && D2 && T2(D2.inspect) && D2.inspect !== r.inspect && (!D2.constructor || D2.constructor.prototype !== D2)) {
              var O2 = D2.inspect(I2, N2);
              return x(O2) || (O2 = f(N2, O2, I2)), O2;
            }
            var L2 = function(R2, z) {
              if (b(z)) return R2.stylize("undefined", "undefined");
              if (x(z)) {
                var H2 = "'" + JSON.stringify(z).replace(/^"|"$/g, "").replace(/'/g, "\\'").replace(/\\"/g, '"') + "'";
                return R2.stylize(H2, "string");
              }
              if (g(z)) return R2.stylize("" + z, "number");
              if (v(z)) return R2.stylize("" + z, "boolean");
              if (m(z)) return R2.stylize("null", "null");
            }(N2, D2);
            if (L2) return L2;
            var V2 = Object.keys(D2), W2 = function(R2) {
              var z = {};
              return R2.forEach(function(H2, te) {
                z[H2] = true;
              }), z;
            }(V2);
            if (N2.showHidden && (V2 = Object.getOwnPropertyNames(D2)), k(D2) && (V2.indexOf("message") >= 0 || V2.indexOf("description") >= 0)) return h(D2);
            if (V2.length === 0) {
              if (T2(D2)) {
                var X2 = D2.name ? ": " + D2.name : "";
                return N2.stylize("[Function" + X2 + "]", "special");
              }
              if (y(D2)) return N2.stylize(RegExp.prototype.toString.call(D2), "regexp");
              if (_4(D2)) return N2.stylize(Date.prototype.toString.call(D2), "date");
              if (k(D2)) return h(D2);
            }
            var Y2, K2 = "", q = false, re = ["{", "}"];
            return d(D2) && (q = true, re = ["[", "]"]), T2(D2) && (K2 = " [Function" + (D2.name ? ": " + D2.name : "") + "]"), y(D2) && (K2 = " " + RegExp.prototype.toString.call(D2)), _4(D2) && (K2 = " " + Date.prototype.toUTCString.call(D2)), k(D2) && (K2 = " " + h(D2)), V2.length !== 0 || q && D2.length != 0 ? I2 < 0 ? y(D2) ? N2.stylize(RegExp.prototype.toString.call(D2), "regexp") : N2.stylize("[Object]", "special") : (N2.seen.push(D2), Y2 = q ? function(R2, z, H2, te, j) {
              for (var Q2 = [], Z2 = 0, ne = z.length; Z2 < ne; ++Z2) F13(z, String(Z2)) ? Q2.push(p(R2, z, H2, te, String(Z2), true)) : Q2.push("");
              return j.forEach(function(ae) {
                ae.match(/^\d+$/) || Q2.push(p(R2, z, H2, te, ae, true));
              }), Q2;
            }(N2, D2, I2, W2, V2) : V2.map(function(R2) {
              return p(N2, D2, I2, W2, R2, q);
            }), N2.seen.pop(), function(R2, z, H2) {
              return R2.reduce(function(te, j) {
                return j.indexOf(`
`) >= 0, te + j.replace(/\u001b\[\d\d?m/g, "").length + 1;
              }, 0) > 60 ? H2[0] + (z === "" ? "" : z + `
 `) + " " + R2.join(`,
  `) + " " + H2[1] : H2[0] + z + " " + R2.join(", ") + " " + H2[1];
            }(Y2, K2, re)) : re[0] + K2 + re[1];
          }
          function h(N2) {
            return "[" + Error.prototype.toString.call(N2) + "]";
          }
          function p(N2, D2, I2, O2, L2, V2) {
            var W2, X2, Y2;
            if ((Y2 = Object.getOwnPropertyDescriptor(D2, L2) || { value: D2[L2] }).get ? X2 = Y2.set ? N2.stylize("[Getter/Setter]", "special") : N2.stylize("[Getter]", "special") : Y2.set && (X2 = N2.stylize("[Setter]", "special")), F13(O2, L2) || (W2 = "[" + L2 + "]"), X2 || (N2.seen.indexOf(Y2.value) < 0 ? (X2 = m(I2) ? f(N2, Y2.value, null) : f(N2, Y2.value, I2 - 1)).indexOf(`
`) > -1 && (X2 = V2 ? X2.split(`
`).map(function(K2) {
              return "  " + K2;
            }).join(`
`).substr(2) : `
` + X2.split(`
`).map(function(K2) {
              return "   " + K2;
            }).join(`
`)) : X2 = N2.stylize("[Circular]", "special")), b(W2)) {
              if (V2 && L2.match(/^\d+$/)) return X2;
              (W2 = JSON.stringify("" + L2)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/) ? (W2 = W2.substr(1, W2.length - 2), W2 = N2.stylize(W2, "name")) : (W2 = W2.replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'"), W2 = N2.stylize(W2, "string"));
            }
            return W2 + ": " + X2;
          }
          function d(N2) {
            return Array.isArray(N2);
          }
          function v(N2) {
            return typeof N2 == "boolean";
          }
          function m(N2) {
            return N2 === null;
          }
          function g(N2) {
            return typeof N2 == "number";
          }
          function x(N2) {
            return typeof N2 == "string";
          }
          function b(N2) {
            return N2 === void 0;
          }
          function y(N2) {
            return w(N2) && A2(N2) === "[object RegExp]";
          }
          function w(N2) {
            return typeof N2 == "object" && N2 !== null;
          }
          function _4(N2) {
            return w(N2) && A2(N2) === "[object Date]";
          }
          function k(N2) {
            return w(N2) && (A2(N2) === "[object Error]" || N2 instanceof Error);
          }
          function T2(N2) {
            return typeof N2 == "function";
          }
          function A2(N2) {
            return Object.prototype.toString.call(N2);
          }
          function S2(N2) {
            return N2 < 10 ? "0" + N2.toString(10) : N2.toString(10);
          }
          r.debuglog = function(N2) {
            if (b(s) && (s = n.env.NODE_DEBUG || ""), N2 = N2.toUpperCase(), !i[N2]) if (new RegExp("\\b" + N2 + "\\b", "i").test(s)) {
              var D2 = n.pid;
              i[N2] = function() {
                var I2 = r.format.apply(r, arguments);
                console.error("%s %d: %s", N2, D2, I2);
              };
            } else i[N2] = function() {
            };
            return i[N2];
          }, r.inspect = l, l.colors = { bold: [1, 22], italic: [3, 23], underline: [4, 24], inverse: [7, 27], white: [37, 39], grey: [90, 39], black: [30, 39], blue: [34, 39], cyan: [36, 39], green: [32, 39], magenta: [35, 39], red: [31, 39], yellow: [33, 39] }, l.styles = { special: "cyan", number: "yellow", boolean: "yellow", undefined: "grey", null: "bold", string: "green", date: "magenta", regexp: "red" }, r.isArray = d, r.isBoolean = v, r.isNull = m, r.isNullOrUndefined = function(N2) {
            return N2 == null;
          }, r.isNumber = g, r.isString = x, r.isSymbol = function(N2) {
            return typeof N2 == "symbol";
          }, r.isUndefined = b, r.isRegExp = y, r.isObject = w, r.isDate = _4, r.isError = k, r.isFunction = T2, r.isPrimitive = function(N2) {
            return N2 === null || typeof N2 == "boolean" || typeof N2 == "number" || typeof N2 == "string" || typeof N2 == "symbol" || N2 === void 0;
          }, r.isBuffer = e("./support/isBuffer");
          var C2 = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
          function E2() {
            var N2 = /* @__PURE__ */ new Date(), D2 = [S2(N2.getHours()), S2(N2.getMinutes()), S2(N2.getSeconds())].join(":");
            return [N2.getDate(), C2[N2.getMonth()], D2].join(" ");
          }
          function F13(N2, D2) {
            return Object.prototype.hasOwnProperty.call(N2, D2);
          }
          r.log = function() {
            console.log("%s - %s", E2(), r.format.apply(r, arguments));
          }, r.inherits = e("inherits"), r._extend = function(N2, D2) {
            if (!D2 || !w(D2)) return N2;
            for (var I2 = Object.keys(D2), O2 = I2.length; O2--; ) N2[I2[O2]] = D2[I2[O2]];
            return N2;
          };
        }).call(this);
      }).call(this, e("_process"), typeof global < "u" ? global : typeof self < "u" ? self : typeof window < "u" ? window : {});
    }, { "./support/isBuffer": 77, _process: 277, inherits: 76 }], 79: [function(e, t, r) {
      "use strict";
      r.byteLength = function(f) {
        var h = u2(f), p = h[0], d = h[1];
        return 3 * (p + d) / 4 - d;
      }, r.toByteArray = function(f) {
        var h, p, d = u2(f), v = d[0], m = d[1], g = new o(function(y, w, _4) {
          return 3 * (w + _4) / 4 - _4;
        }(0, v, m)), x = 0, b = m > 0 ? v - 4 : v;
        for (p = 0; p < b; p += 4) h = a[f.charCodeAt(p)] << 18 | a[f.charCodeAt(p + 1)] << 12 | a[f.charCodeAt(p + 2)] << 6 | a[f.charCodeAt(p + 3)], g[x++] = h >> 16 & 255, g[x++] = h >> 8 & 255, g[x++] = 255 & h;
        return m === 2 && (h = a[f.charCodeAt(p)] << 2 | a[f.charCodeAt(p + 1)] >> 4, g[x++] = 255 & h), m === 1 && (h = a[f.charCodeAt(p)] << 10 | a[f.charCodeAt(p + 1)] << 4 | a[f.charCodeAt(p + 2)] >> 2, g[x++] = h >> 8 & 255, g[x++] = 255 & h), g;
      }, r.fromByteArray = function(f) {
        for (var h, p = f.length, d = p % 3, v = [], m = 0, g = p - d; m < g; m += 16383) v.push(c(f, m, m + 16383 > g ? g : m + 16383));
        return d === 1 ? (h = f[p - 1], v.push(n[h >> 2] + n[h << 4 & 63] + "==")) : d === 2 && (h = (f[p - 2] << 8) + f[p - 1], v.push(n[h >> 10] + n[h >> 4 & 63] + n[h << 2 & 63] + "=")), v.join("");
      };
      for (var n = [], a = [], o = typeof Uint8Array < "u" ? Uint8Array : Array, s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", i = 0, l = s.length; i < l; ++i) n[i] = s[i], a[s.charCodeAt(i)] = i;
      function u2(f) {
        var h = f.length;
        if (h % 4 > 0) throw new Error("Invalid string. Length must be a multiple of 4");
        var p = f.indexOf("=");
        return p === -1 && (p = h), [p, p === h ? 0 : 4 - p % 4];
      }
      function c(f, h, p) {
        for (var d, v, m = [], g = h; g < p; g += 3) d = (f[g] << 16 & 16711680) + (f[g + 1] << 8 & 65280) + (255 & f[g + 2]), m.push(n[(v = d) >> 18 & 63] + n[v >> 12 & 63] + n[v >> 6 & 63] + n[63 & v]);
        return m.join("");
      }
      a["-".charCodeAt(0)] = 62, a["_".charCodeAt(0)] = 63;
    }, {}], 80: [function(e, t, r) {
      "use strict";
      function n(u2, c, f, h, p) {
        for (var d = p + 1; h <= p; ) {
          var v = h + p >>> 1, m = u2[v];
          (f !== void 0 ? f(m, c) : m - c) >= 0 ? (d = v, p = v - 1) : h = v + 1;
        }
        return d;
      }
      function a(u2, c, f, h, p) {
        for (var d = p + 1; h <= p; ) {
          var v = h + p >>> 1, m = u2[v];
          (f !== void 0 ? f(m, c) : m - c) > 0 ? (d = v, p = v - 1) : h = v + 1;
        }
        return d;
      }
      function o(u2, c, f, h, p) {
        for (var d = h - 1; h <= p; ) {
          var v = h + p >>> 1, m = u2[v];
          (f !== void 0 ? f(m, c) : m - c) < 0 ? (d = v, h = v + 1) : p = v - 1;
        }
        return d;
      }
      function s(u2, c, f, h, p) {
        for (var d = h - 1; h <= p; ) {
          var v = h + p >>> 1, m = u2[v];
          (f !== void 0 ? f(m, c) : m - c) <= 0 ? (d = v, h = v + 1) : p = v - 1;
        }
        return d;
      }
      function i(u2, c, f, h, p) {
        for (; h <= p; ) {
          var d = h + p >>> 1, v = u2[d], m = f !== void 0 ? f(v, c) : v - c;
          if (m === 0) return d;
          m <= 0 ? h = d + 1 : p = d - 1;
        }
        return -1;
      }
      function l(u2, c, f, h, p, d) {
        return typeof f == "function" ? d(u2, c, f, h === void 0 ? 0 : 0 | h, p === void 0 ? u2.length - 1 : 0 | p) : d(u2, c, void 0, f === void 0 ? 0 : 0 | f, h === void 0 ? u2.length - 1 : 0 | h);
      }
      t.exports = { ge: function(u2, c, f, h, p) {
        return l(u2, c, f, h, p, n);
      }, gt: function(u2, c, f, h, p) {
        return l(u2, c, f, h, p, a);
      }, lt: function(u2, c, f, h, p) {
        return l(u2, c, f, h, p, o);
      }, le: function(u2, c, f, h, p) {
        return l(u2, c, f, h, p, s);
      }, eq: function(u2, c, f, h, p) {
        return l(u2, c, f, h, p, i);
      } };
    }, {}], 81: [function(e, t, r) {
      "use strict";
      function n(o) {
        var s = 32;
        return (o &= -o) && s--, 65535 & o && (s -= 16), 16711935 & o && (s -= 8), 252645135 & o && (s -= 4), 858993459 & o && (s -= 2), 1431655765 & o && (s -= 1), s;
      }
      r.INT_BITS = 32, r.INT_MAX = 2147483647, r.INT_MIN = -1 << 31, r.sign = function(o) {
        return (o > 0) - (o < 0);
      }, r.abs = function(o) {
        var s = o >> 31;
        return (o ^ s) - s;
      }, r.min = function(o, s) {
        return s ^ (o ^ s) & -(o < s);
      }, r.max = function(o, s) {
        return o ^ (o ^ s) & -(o < s);
      }, r.isPow2 = function(o) {
        return !(o & o - 1 || !o);
      }, r.log2 = function(o) {
        var s, i;
        return s = (o > 65535) << 4, s |= i = ((o >>>= s) > 255) << 3, s |= i = ((o >>>= i) > 15) << 2, (s |= i = ((o >>>= i) > 3) << 1) | (o >>>= i) >> 1;
      }, r.log10 = function(o) {
        return o >= 1e9 ? 9 : o >= 1e8 ? 8 : o >= 1e7 ? 7 : o >= 1e6 ? 6 : o >= 1e5 ? 5 : o >= 1e4 ? 4 : o >= 1e3 ? 3 : o >= 100 ? 2 : o >= 10 ? 1 : 0;
      }, r.popCount = function(o) {
        return 16843009 * ((o = (858993459 & (o -= o >>> 1 & 1431655765)) + (o >>> 2 & 858993459)) + (o >>> 4) & 252645135) >>> 24;
      }, r.countTrailingZeros = n, r.nextPow2 = function(o) {
        return o += o === 0, --o, o |= o >>> 1, o |= o >>> 2, o |= o >>> 4, o |= o >>> 8, (o |= o >>> 16) + 1;
      }, r.prevPow2 = function(o) {
        return o |= o >>> 1, o |= o >>> 2, o |= o >>> 4, o |= o >>> 8, (o |= o >>> 16) - (o >>> 1);
      }, r.parity = function(o) {
        return o ^= o >>> 16, o ^= o >>> 8, o ^= o >>> 4, 27030 >>> (o &= 15) & 1;
      };
      var a = new Array(256);
      (function(o) {
        for (var s = 0; s < 256; ++s) {
          var i = s, l = s, u2 = 7;
          for (i >>>= 1; i; i >>>= 1) l <<= 1, l |= 1 & i, --u2;
          o[s] = l << u2 & 255;
        }
      })(a), r.reverse = function(o) {
        return a[255 & o] << 24 | a[o >>> 8 & 255] << 16 | a[o >>> 16 & 255] << 8 | a[o >>> 24 & 255];
      }, r.interleave2 = function(o, s) {
        return (o = 1431655765 & ((o = 858993459 & ((o = 252645135 & ((o = 16711935 & ((o &= 65535) | o << 8)) | o << 4)) | o << 2)) | o << 1)) | (s = 1431655765 & ((s = 858993459 & ((s = 252645135 & ((s = 16711935 & ((s &= 65535) | s << 8)) | s << 4)) | s << 2)) | s << 1)) << 1;
      }, r.deinterleave2 = function(o, s) {
        return (o = 65535 & ((o = 16711935 & ((o = 252645135 & ((o = 858993459 & ((o = o >>> s & 1431655765) | o >>> 1)) | o >>> 2)) | o >>> 4)) | o >>> 16)) << 16 >> 16;
      }, r.interleave3 = function(o, s, i) {
        return o = 1227133513 & ((o = 3272356035 & ((o = 251719695 & ((o = 4278190335 & ((o &= 1023) | o << 16)) | o << 8)) | o << 4)) | o << 2), (o |= (s = 1227133513 & ((s = 3272356035 & ((s = 251719695 & ((s = 4278190335 & ((s &= 1023) | s << 16)) | s << 8)) | s << 4)) | s << 2)) << 1) | (i = 1227133513 & ((i = 3272356035 & ((i = 251719695 & ((i = 4278190335 & ((i &= 1023) | i << 16)) | i << 8)) | i << 4)) | i << 2)) << 2;
      }, r.deinterleave3 = function(o, s) {
        return (o = 1023 & ((o = 4278190335 & ((o = 251719695 & ((o = 3272356035 & ((o = o >>> s & 1227133513) | o >>> 2)) | o >>> 4)) | o >>> 8)) | o >>> 16)) << 22 >> 22;
      }, r.nextCombination = function(o) {
        var s = o | o - 1;
        return s + 1 | (~s & -~s) - 1 >>> n(o) + 1;
      };
    }, {}], 82: [function(e, t, r) {
      "use strict";
      var n = e("clamp");
      t.exports = function(i, l) {
        l || (l = {});
        var u2, c, f, h, p, d, v, m, g, x, b, y = l.cutoff == null ? 0.25 : l.cutoff, w = l.radius == null ? 8 : l.radius, _4 = l.channel || 0;
        if (ArrayBuffer.isView(i) || Array.isArray(i)) {
          if (!l.width || !l.height) throw Error("For raw data width and height should be provided by options");
          u2 = l.width, c = l.height, h = i, d = l.stride ? l.stride : Math.floor(i.length / u2 / c);
        } else window.HTMLCanvasElement && i instanceof window.HTMLCanvasElement ? (v = (m = i).getContext("2d"), u2 = m.width, c = m.height, g = v.getImageData(0, 0, u2, c), h = g.data, d = 4) : window.CanvasRenderingContext2D && i instanceof window.CanvasRenderingContext2D ? (m = i.canvas, v = i, u2 = m.width, c = m.height, g = v.getImageData(0, 0, u2, c), h = g.data, d = 4) : window.ImageData && i instanceof window.ImageData && (g = i, u2 = i.width, c = i.height, h = g.data, d = 4);
        if (f = Math.max(u2, c), window.Uint8ClampedArray && h instanceof window.Uint8ClampedArray || window.Uint8Array && h instanceof window.Uint8Array) for (p = h, h = Array(u2 * c), x = 0, b = p.length; x < b; x++) h[x] = p[x * d + _4] / 255;
        else if (d !== 1) throw Error("Raw data can have only 1 value per pixel");
        var k = Array(u2 * c), T2 = Array(u2 * c), A2 = Array(f), S2 = Array(f), C2 = Array(f + 1), E2 = Array(f);
        for (x = 0, b = u2 * c; x < b; x++) {
          var F13 = h[x];
          k[x] = F13 === 1 ? 0 : F13 === 0 ? a : Math.pow(Math.max(0, 0.5 - F13), 2), T2[x] = F13 === 1 ? a : F13 === 0 ? 0 : Math.pow(Math.max(0, F13 - 0.5), 2);
        }
        o(k, u2, c, A2, S2, E2, C2), o(T2, u2, c, A2, S2, E2, C2);
        var N2 = window.Float32Array ? new Float32Array(u2 * c) : new Array(u2 * c);
        for (x = 0, b = u2 * c; x < b; x++) N2[x] = n(1 - ((k[x] - T2[x]) / w + y), 0, 1);
        return N2;
      };
      var a = 1e20;
      function o(i, l, u2, c, f, h, p) {
        for (var d = 0; d < l; d++) {
          for (var v = 0; v < u2; v++) c[v] = i[v * l + d];
          for (s(c, f, h, p, u2), v = 0; v < u2; v++) i[v * l + d] = f[v];
        }
        for (v = 0; v < u2; v++) {
          for (d = 0; d < l; d++) c[d] = i[v * l + d];
          for (s(c, f, h, p, l), d = 0; d < l; d++) i[v * l + d] = Math.sqrt(f[d]);
        }
      }
      function s(i, l, u2, c, f) {
        u2[0] = 0, c[0] = -a, c[1] = +a;
        for (var h = 1, p = 0; h < f; h++) {
          for (var d = (i[h] + h * h - (i[u2[p]] + u2[p] * u2[p])) / (2 * h - 2 * u2[p]); d <= c[p]; ) p--, d = (i[h] + h * h - (i[u2[p]] + u2[p] * u2[p])) / (2 * h - 2 * u2[p]);
          u2[++p] = h, c[p] = d, c[p + 1] = +a;
        }
        for (h = 0, p = 0; h < f; h++) {
          for (; c[p + 1] < h; ) p++;
          l[h] = (h - u2[p]) * (h - u2[p]) + i[u2[p]];
        }
      }
    }, { clamp: 86 }], 83: [function(e, t, r) {
    }, {}], 84: [function(e, t, r) {
      "use strict";
      var n, a = typeof Reflect == "object" ? Reflect : null, o = a && typeof a.apply == "function" ? a.apply : function(g, x, b) {
        return Function.prototype.apply.call(g, x, b);
      };
      n = a && typeof a.ownKeys == "function" ? a.ownKeys : Object.getOwnPropertySymbols ? function(g) {
        return Object.getOwnPropertyNames(g).concat(Object.getOwnPropertySymbols(g));
      } : function(g) {
        return Object.getOwnPropertyNames(g);
      };
      var s = Number.isNaN || function(g) {
        return g != g;
      };
      function i() {
        i.init.call(this);
      }
      t.exports = i, t.exports.once = function(g, x) {
        return new Promise(function(b, y) {
          function w() {
            _4 !== void 0 && g.removeListener("error", _4), b([].slice.call(arguments));
          }
          var _4;
          x !== "error" && (_4 = function(k) {
            g.removeListener(x, w), y(k);
          }, g.once("error", _4)), g.once(x, w);
        });
      }, i.EventEmitter = i, i.prototype._events = void 0, i.prototype._eventsCount = 0, i.prototype._maxListeners = void 0;
      var l = 10;
      function u2(g) {
        if (typeof g != "function") throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof g);
      }
      function c(g) {
        return g._maxListeners === void 0 ? i.defaultMaxListeners : g._maxListeners;
      }
      function f(g, x, b, y) {
        var w, _4, k, T2;
        if (u2(b), (_4 = g._events) === void 0 ? (_4 = g._events = /* @__PURE__ */ Object.create(null), g._eventsCount = 0) : (_4.newListener !== void 0 && (g.emit("newListener", x, b.listener ? b.listener : b), _4 = g._events), k = _4[x]), k === void 0) k = _4[x] = b, ++g._eventsCount;
        else if (typeof k == "function" ? k = _4[x] = y ? [b, k] : [k, b] : y ? k.unshift(b) : k.push(b), (w = c(g)) > 0 && k.length > w && !k.warned) {
          k.warned = true;
          var A2 = new Error("Possible EventEmitter memory leak detected. " + k.length + " " + String(x) + " listeners added. Use emitter.setMaxListeners() to increase limit");
          A2.name = "MaxListenersExceededWarning", A2.emitter = g, A2.type = x, A2.count = k.length, T2 = A2, console && console.warn && console.warn(T2);
        }
        return g;
      }
      function h() {
        if (!this.fired) return this.target.removeListener(this.type, this.wrapFn), this.fired = true, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments);
      }
      function p(g, x, b) {
        var y = { fired: false, wrapFn: void 0, target: g, type: x, listener: b }, w = h.bind(y);
        return w.listener = b, y.wrapFn = w, w;
      }
      function d(g, x, b) {
        var y = g._events;
        if (y === void 0) return [];
        var w = y[x];
        return w === void 0 ? [] : typeof w == "function" ? b ? [w.listener || w] : [w] : b ? function(_4) {
          for (var k = new Array(_4.length), T2 = 0; T2 < k.length; ++T2) k[T2] = _4[T2].listener || _4[T2];
          return k;
        }(w) : m(w, w.length);
      }
      function v(g) {
        var x = this._events;
        if (x !== void 0) {
          var b = x[g];
          if (typeof b == "function") return 1;
          if (b !== void 0) return b.length;
        }
        return 0;
      }
      function m(g, x) {
        for (var b = new Array(x), y = 0; y < x; ++y) b[y] = g[y];
        return b;
      }
      Object.defineProperty(i, "defaultMaxListeners", { enumerable: true, get: function() {
        return l;
      }, set: function(g) {
        if (typeof g != "number" || g < 0 || s(g)) throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + g + ".");
        l = g;
      } }), i.init = function() {
        this._events !== void 0 && this._events !== Object.getPrototypeOf(this)._events || (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
      }, i.prototype.setMaxListeners = function(g) {
        if (typeof g != "number" || g < 0 || s(g)) throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + g + ".");
        return this._maxListeners = g, this;
      }, i.prototype.getMaxListeners = function() {
        return c(this);
      }, i.prototype.emit = function(g) {
        for (var x = [], b = 1; b < arguments.length; b++) x.push(arguments[b]);
        var y = g === "error", w = this._events;
        if (w !== void 0) y = y && w.error === void 0;
        else if (!y) return false;
        if (y) {
          var _4;
          if (x.length > 0 && (_4 = x[0]), _4 instanceof Error) throw _4;
          var k = new Error("Unhandled error." + (_4 ? " (" + _4.message + ")" : ""));
          throw k.context = _4, k;
        }
        var T2 = w[g];
        if (T2 === void 0) return false;
        if (typeof T2 == "function") o(T2, this, x);
        else {
          var A2 = T2.length, S2 = m(T2, A2);
          for (b = 0; b < A2; ++b) o(S2[b], this, x);
        }
        return true;
      }, i.prototype.addListener = function(g, x) {
        return f(this, g, x, false);
      }, i.prototype.on = i.prototype.addListener, i.prototype.prependListener = function(g, x) {
        return f(this, g, x, true);
      }, i.prototype.once = function(g, x) {
        return u2(x), this.on(g, p(this, g, x)), this;
      }, i.prototype.prependOnceListener = function(g, x) {
        return u2(x), this.prependListener(g, p(this, g, x)), this;
      }, i.prototype.removeListener = function(g, x) {
        var b, y, w, _4, k;
        if (u2(x), (y = this._events) === void 0) return this;
        if ((b = y[g]) === void 0) return this;
        if (b === x || b.listener === x) --this._eventsCount == 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete y[g], y.removeListener && this.emit("removeListener", g, b.listener || x));
        else if (typeof b != "function") {
          for (w = -1, _4 = b.length - 1; _4 >= 0; _4--) if (b[_4] === x || b[_4].listener === x) {
            k = b[_4].listener, w = _4;
            break;
          }
          if (w < 0) return this;
          w === 0 ? b.shift() : function(T2, A2) {
            for (; A2 + 1 < T2.length; A2++) T2[A2] = T2[A2 + 1];
            T2.pop();
          }(b, w), b.length === 1 && (y[g] = b[0]), y.removeListener !== void 0 && this.emit("removeListener", g, k || x);
        }
        return this;
      }, i.prototype.off = i.prototype.removeListener, i.prototype.removeAllListeners = function(g) {
        var x, b, y;
        if ((b = this._events) === void 0) return this;
        if (b.removeListener === void 0) return arguments.length === 0 ? (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0) : b[g] !== void 0 && (--this._eventsCount == 0 ? this._events = /* @__PURE__ */ Object.create(null) : delete b[g]), this;
        if (arguments.length === 0) {
          var w, _4 = Object.keys(b);
          for (y = 0; y < _4.length; ++y) (w = _4[y]) !== "removeListener" && this.removeAllListeners(w);
          return this.removeAllListeners("removeListener"), this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0, this;
        }
        if (typeof (x = b[g]) == "function") this.removeListener(g, x);
        else if (x !== void 0) for (y = x.length - 1; y >= 0; y--) this.removeListener(g, x[y]);
        return this;
      }, i.prototype.listeners = function(g) {
        return d(this, g, true);
      }, i.prototype.rawListeners = function(g) {
        return d(this, g, false);
      }, i.listenerCount = function(g, x) {
        return typeof g.listenerCount == "function" ? g.listenerCount(x) : v.call(g, x);
      }, i.prototype.listenerCount = v, i.prototype.eventNames = function() {
        return this._eventsCount > 0 ? n(this._events) : [];
      };
    }, {}], 85: [function(e, t, r) {
      (function(n) {
        (function() {
          "use strict";
          var a = e("base64-js"), o = e("ieee754");
          r.Buffer = i, r.SlowBuffer = function(R2) {
            return +R2 != R2 && (R2 = 0), i.alloc(+R2);
          }, r.INSPECT_MAX_BYTES = 50;
          function s(R2) {
            if (R2 > 2147483647) throw new RangeError('The value "' + R2 + '" is invalid for option "size"');
            var z = new Uint8Array(R2);
            return z.__proto__ = i.prototype, z;
          }
          function i(R2, z, H2) {
            if (typeof R2 == "number") {
              if (typeof z == "string") throw new TypeError('The "string" argument must be of type string. Received type number');
              return c(R2);
            }
            return l(R2, z, H2);
          }
          function l(R2, z, H2) {
            if (typeof R2 == "string") return function(Q2, Z2) {
              if (typeof Z2 == "string" && Z2 !== "" || (Z2 = "utf8"), !i.isEncoding(Z2)) throw new TypeError("Unknown encoding: " + Z2);
              var ne = 0 | p(Q2, Z2), ae = s(ne), ue = ae.write(Q2, Z2);
              return ue !== ne && (ae = ae.slice(0, ue)), ae;
            }(R2, z);
            if (ArrayBuffer.isView(R2)) return f(R2);
            if (R2 == null) throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof R2);
            if (q(R2, ArrayBuffer) || R2 && q(R2.buffer, ArrayBuffer)) return function(Q2, Z2, ne) {
              if (Z2 < 0 || Q2.byteLength < Z2) throw new RangeError('"offset" is outside of buffer bounds');
              if (Q2.byteLength < Z2 + (ne || 0)) throw new RangeError('"length" is outside of buffer bounds');
              var ae;
              return ae = Z2 === void 0 && ne === void 0 ? new Uint8Array(Q2) : ne === void 0 ? new Uint8Array(Q2, Z2) : new Uint8Array(Q2, Z2, ne), ae.__proto__ = i.prototype, ae;
            }(R2, z, H2);
            if (typeof R2 == "number") throw new TypeError('The "value" argument must not be of type number. Received type number');
            var te = R2.valueOf && R2.valueOf();
            if (te != null && te !== R2) return i.from(te, z, H2);
            var j = function(Q2) {
              if (i.isBuffer(Q2)) {
                var Z2 = 0 | h(Q2.length), ne = s(Z2);
                return ne.length === 0 || Q2.copy(ne, 0, 0, Z2), ne;
              }
              if (Q2.length !== void 0) return typeof Q2.length != "number" || re(Q2.length) ? s(0) : f(Q2);
              if (Q2.type === "Buffer" && Array.isArray(Q2.data)) return f(Q2.data);
            }(R2);
            if (j) return j;
            if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof R2[Symbol.toPrimitive] == "function") return i.from(R2[Symbol.toPrimitive]("string"), z, H2);
            throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof R2);
          }
          function u2(R2) {
            if (typeof R2 != "number") throw new TypeError('"size" argument must be of type number');
            if (R2 < 0) throw new RangeError('The value "' + R2 + '" is invalid for option "size"');
          }
          function c(R2) {
            return u2(R2), s(R2 < 0 ? 0 : 0 | h(R2));
          }
          function f(R2) {
            for (var z = R2.length < 0 ? 0 : 0 | h(R2.length), H2 = s(z), te = 0; te < z; te += 1) H2[te] = 255 & R2[te];
            return H2;
          }
          function h(R2) {
            if (R2 >= 2147483647) throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + 2147483647 .toString(16) + " bytes");
            return 0 | R2;
          }
          function p(R2, z) {
            if (i.isBuffer(R2)) return R2.length;
            if (ArrayBuffer.isView(R2) || q(R2, ArrayBuffer)) return R2.byteLength;
            if (typeof R2 != "string") throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof R2);
            var H2 = R2.length, te = arguments.length > 2 && arguments[2] === true;
            if (!te && H2 === 0) return 0;
            for (var j = false; ; ) switch (z) {
              case "ascii":
              case "latin1":
              case "binary":
                return H2;
              case "utf8":
              case "utf-8":
                return X2(R2).length;
              case "ucs2":
              case "ucs-2":
              case "utf16le":
              case "utf-16le":
                return 2 * H2;
              case "hex":
                return H2 >>> 1;
              case "base64":
                return Y2(R2).length;
              default:
                if (j) return te ? -1 : X2(R2).length;
                z = ("" + z).toLowerCase(), j = true;
            }
          }
          function d(R2, z, H2) {
            var te = false;
            if ((z === void 0 || z < 0) && (z = 0), z > this.length || ((H2 === void 0 || H2 > this.length) && (H2 = this.length), H2 <= 0) || (H2 >>>= 0) <= (z >>>= 0)) return "";
            for (R2 || (R2 = "utf8"); ; ) switch (R2) {
              case "hex":
                return E2(this, z, H2);
              case "utf8":
              case "utf-8":
                return A2(this, z, H2);
              case "ascii":
                return S2(this, z, H2);
              case "latin1":
              case "binary":
                return C2(this, z, H2);
              case "base64":
                return T2(this, z, H2);
              case "ucs2":
              case "ucs-2":
              case "utf16le":
              case "utf-16le":
                return F13(this, z, H2);
              default:
                if (te) throw new TypeError("Unknown encoding: " + R2);
                R2 = (R2 + "").toLowerCase(), te = true;
            }
          }
          function v(R2, z, H2) {
            var te = R2[z];
            R2[z] = R2[H2], R2[H2] = te;
          }
          function m(R2, z, H2, te, j) {
            if (R2.length === 0) return -1;
            if (typeof H2 == "string" ? (te = H2, H2 = 0) : H2 > 2147483647 ? H2 = 2147483647 : H2 < -2147483648 && (H2 = -2147483648), re(H2 = +H2) && (H2 = j ? 0 : R2.length - 1), H2 < 0 && (H2 = R2.length + H2), H2 >= R2.length) {
              if (j) return -1;
              H2 = R2.length - 1;
            } else if (H2 < 0) {
              if (!j) return -1;
              H2 = 0;
            }
            if (typeof z == "string" && (z = i.from(z, te)), i.isBuffer(z)) return z.length === 0 ? -1 : g(R2, z, H2, te, j);
            if (typeof z == "number") return z &= 255, typeof Uint8Array.prototype.indexOf == "function" ? j ? Uint8Array.prototype.indexOf.call(R2, z, H2) : Uint8Array.prototype.lastIndexOf.call(R2, z, H2) : g(R2, [z], H2, te, j);
            throw new TypeError("val must be string, number or Buffer");
          }
          function g(R2, z, H2, te, j) {
            var Q2, Z2 = 1, ne = R2.length, ae = z.length;
            if (te !== void 0 && ((te = String(te).toLowerCase()) === "ucs2" || te === "ucs-2" || te === "utf16le" || te === "utf-16le")) {
              if (R2.length < 2 || z.length < 2) return -1;
              Z2 = 2, ne /= 2, ae /= 2, H2 /= 2;
            }
            function ue(he, me) {
              return Z2 === 1 ? he[me] : he.readUInt16BE(me * Z2);
            }
            if (j) {
              var le = -1;
              for (Q2 = H2; Q2 < ne; Q2++) if (ue(R2, Q2) === ue(z, le === -1 ? 0 : Q2 - le)) {
                if (le === -1 && (le = Q2), Q2 - le + 1 === ae) return le * Z2;
              } else le !== -1 && (Q2 -= Q2 - le), le = -1;
            } else for (H2 + ae > ne && (H2 = ne - ae), Q2 = H2; Q2 >= 0; Q2--) {
              for (var ce = true, se = 0; se < ae; se++) if (ue(R2, Q2 + se) !== ue(z, se)) {
                ce = false;
                break;
              }
              if (ce) return Q2;
            }
            return -1;
          }
          function x(R2, z, H2, te) {
            H2 = Number(H2) || 0;
            var j = R2.length - H2;
            te ? (te = Number(te)) > j && (te = j) : te = j;
            var Q2 = z.length;
            te > Q2 / 2 && (te = Q2 / 2);
            for (var Z2 = 0; Z2 < te; ++Z2) {
              var ne = parseInt(z.substr(2 * Z2, 2), 16);
              if (re(ne)) return Z2;
              R2[H2 + Z2] = ne;
            }
            return Z2;
          }
          function b(R2, z, H2, te) {
            return K2(X2(z, R2.length - H2), R2, H2, te);
          }
          function y(R2, z, H2, te) {
            return K2(function(j) {
              for (var Q2 = [], Z2 = 0; Z2 < j.length; ++Z2) Q2.push(255 & j.charCodeAt(Z2));
              return Q2;
            }(z), R2, H2, te);
          }
          function w(R2, z, H2, te) {
            return y(R2, z, H2, te);
          }
          function _4(R2, z, H2, te) {
            return K2(Y2(z), R2, H2, te);
          }
          function k(R2, z, H2, te) {
            return K2(function(j, Q2) {
              for (var Z2, ne, ae, ue = [], le = 0; le < j.length && !((Q2 -= 2) < 0); ++le) Z2 = j.charCodeAt(le), ne = Z2 >> 8, ae = Z2 % 256, ue.push(ae), ue.push(ne);
              return ue;
            }(z, R2.length - H2), R2, H2, te);
          }
          function T2(R2, z, H2) {
            return z === 0 && H2 === R2.length ? a.fromByteArray(R2) : a.fromByteArray(R2.slice(z, H2));
          }
          function A2(R2, z, H2) {
            H2 = Math.min(R2.length, H2);
            for (var te = [], j = z; j < H2; ) {
              var Q2, Z2, ne, ae, ue = R2[j], le = null, ce = ue > 239 ? 4 : ue > 223 ? 3 : ue > 191 ? 2 : 1;
              if (j + ce <= H2) switch (ce) {
                case 1:
                  ue < 128 && (le = ue);
                  break;
                case 2:
                  (192 & (Q2 = R2[j + 1])) == 128 && (ae = (31 & ue) << 6 | 63 & Q2) > 127 && (le = ae);
                  break;
                case 3:
                  Q2 = R2[j + 1], Z2 = R2[j + 2], (192 & Q2) == 128 && (192 & Z2) == 128 && (ae = (15 & ue) << 12 | (63 & Q2) << 6 | 63 & Z2) > 2047 && (ae < 55296 || ae > 57343) && (le = ae);
                  break;
                case 4:
                  Q2 = R2[j + 1], Z2 = R2[j + 2], ne = R2[j + 3], (192 & Q2) == 128 && (192 & Z2) == 128 && (192 & ne) == 128 && (ae = (15 & ue) << 18 | (63 & Q2) << 12 | (63 & Z2) << 6 | 63 & ne) > 65535 && ae < 1114112 && (le = ae);
              }
              le === null ? (le = 65533, ce = 1) : le > 65535 && (le -= 65536, te.push(le >>> 10 & 1023 | 55296), le = 56320 | 1023 & le), te.push(le), j += ce;
            }
            return function(se) {
              var he = se.length;
              if (he <= 4096) return String.fromCharCode.apply(String, se);
              for (var me = "", we = 0; we < he; ) me += String.fromCharCode.apply(String, se.slice(we, we += 4096));
              return me;
            }(te);
          }
          r.kMaxLength = 2147483647, i.TYPED_ARRAY_SUPPORT = function() {
            try {
              var R2 = new Uint8Array(1);
              return R2.__proto__ = { __proto__: Uint8Array.prototype, foo: function() {
                return 42;
              } }, R2.foo() === 42;
            } catch {
              return false;
            }
          }(), i.TYPED_ARRAY_SUPPORT || typeof console > "u" || typeof console.error != "function" || 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."), Object.defineProperty(i.prototype, "parent", { enumerable: true, get: function() {
            if (i.isBuffer(this)) return this.buffer;
          } }), Object.defineProperty(i.prototype, "offset", { enumerable: true, get: function() {
            if (i.isBuffer(this)) return this.byteOffset;
          } }), typeof Symbol < "u" && Symbol.species != null && i[Symbol.species] === i && Object.defineProperty(i, Symbol.species, { value: null, configurable: true, enumerable: false, writable: false }), i.poolSize = 8192, i.from = function(R2, z, H2) {
            return l(R2, z, H2);
          }, i.prototype.__proto__ = Uint8Array.prototype, i.__proto__ = Uint8Array, i.alloc = function(R2, z, H2) {
            return function(te, j, Q2) {
              return u2(te), te <= 0 ? s(te) : j !== void 0 ? typeof Q2 == "string" ? s(te).fill(j, Q2) : s(te).fill(j) : s(te);
            }(R2, z, H2);
          }, i.allocUnsafe = function(R2) {
            return c(R2);
          }, i.allocUnsafeSlow = function(R2) {
            return c(R2);
          }, i.isBuffer = function(R2) {
            return R2 != null && R2._isBuffer === true && R2 !== i.prototype;
          }, i.compare = function(R2, z) {
            if (q(R2, Uint8Array) && (R2 = i.from(R2, R2.offset, R2.byteLength)), q(z, Uint8Array) && (z = i.from(z, z.offset, z.byteLength)), !i.isBuffer(R2) || !i.isBuffer(z)) throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');
            if (R2 === z) return 0;
            for (var H2 = R2.length, te = z.length, j = 0, Q2 = Math.min(H2, te); j < Q2; ++j) if (R2[j] !== z[j]) {
              H2 = R2[j], te = z[j];
              break;
            }
            return H2 < te ? -1 : te < H2 ? 1 : 0;
          }, i.isEncoding = function(R2) {
            switch (String(R2).toLowerCase()) {
              case "hex":
              case "utf8":
              case "utf-8":
              case "ascii":
              case "latin1":
              case "binary":
              case "base64":
              case "ucs2":
              case "ucs-2":
              case "utf16le":
              case "utf-16le":
                return true;
              default:
                return false;
            }
          }, i.concat = function(R2, z) {
            if (!Array.isArray(R2)) throw new TypeError('"list" argument must be an Array of Buffers');
            if (R2.length === 0) return i.alloc(0);
            var H2;
            if (z === void 0) for (z = 0, H2 = 0; H2 < R2.length; ++H2) z += R2[H2].length;
            var te = i.allocUnsafe(z), j = 0;
            for (H2 = 0; H2 < R2.length; ++H2) {
              var Q2 = R2[H2];
              if (q(Q2, Uint8Array) && (Q2 = i.from(Q2)), !i.isBuffer(Q2)) throw new TypeError('"list" argument must be an Array of Buffers');
              Q2.copy(te, j), j += Q2.length;
            }
            return te;
          }, i.byteLength = p, i.prototype._isBuffer = true, i.prototype.swap16 = function() {
            var R2 = this.length;
            if (R2 % 2 != 0) throw new RangeError("Buffer size must be a multiple of 16-bits");
            for (var z = 0; z < R2; z += 2) v(this, z, z + 1);
            return this;
          }, i.prototype.swap32 = function() {
            var R2 = this.length;
            if (R2 % 4 != 0) throw new RangeError("Buffer size must be a multiple of 32-bits");
            for (var z = 0; z < R2; z += 4) v(this, z, z + 3), v(this, z + 1, z + 2);
            return this;
          }, i.prototype.swap64 = function() {
            var R2 = this.length;
            if (R2 % 8 != 0) throw new RangeError("Buffer size must be a multiple of 64-bits");
            for (var z = 0; z < R2; z += 8) v(this, z, z + 7), v(this, z + 1, z + 6), v(this, z + 2, z + 5), v(this, z + 3, z + 4);
            return this;
          }, i.prototype.toString = function() {
            var R2 = this.length;
            return R2 === 0 ? "" : arguments.length === 0 ? A2(this, 0, R2) : d.apply(this, arguments);
          }, i.prototype.toLocaleString = i.prototype.toString, i.prototype.equals = function(R2) {
            if (!i.isBuffer(R2)) throw new TypeError("Argument must be a Buffer");
            return this === R2 || i.compare(this, R2) === 0;
          }, i.prototype.inspect = function() {
            var R2 = "", z = r.INSPECT_MAX_BYTES;
            return R2 = this.toString("hex", 0, z).replace(/(.{2})/g, "$1 ").trim(), this.length > z && (R2 += " ... "), "<Buffer " + R2 + ">";
          }, i.prototype.compare = function(R2, z, H2, te, j) {
            if (q(R2, Uint8Array) && (R2 = i.from(R2, R2.offset, R2.byteLength)), !i.isBuffer(R2)) throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof R2);
            if (z === void 0 && (z = 0), H2 === void 0 && (H2 = R2 ? R2.length : 0), te === void 0 && (te = 0), j === void 0 && (j = this.length), z < 0 || H2 > R2.length || te < 0 || j > this.length) throw new RangeError("out of range index");
            if (te >= j && z >= H2) return 0;
            if (te >= j) return -1;
            if (z >= H2) return 1;
            if (this === R2) return 0;
            for (var Q2 = (j >>>= 0) - (te >>>= 0), Z2 = (H2 >>>= 0) - (z >>>= 0), ne = Math.min(Q2, Z2), ae = this.slice(te, j), ue = R2.slice(z, H2), le = 0; le < ne; ++le) if (ae[le] !== ue[le]) {
              Q2 = ae[le], Z2 = ue[le];
              break;
            }
            return Q2 < Z2 ? -1 : Z2 < Q2 ? 1 : 0;
          }, i.prototype.includes = function(R2, z, H2) {
            return this.indexOf(R2, z, H2) !== -1;
          }, i.prototype.indexOf = function(R2, z, H2) {
            return m(this, R2, z, H2, true);
          }, i.prototype.lastIndexOf = function(R2, z, H2) {
            return m(this, R2, z, H2, false);
          }, i.prototype.write = function(R2, z, H2, te) {
            if (z === void 0) te = "utf8", H2 = this.length, z = 0;
            else if (H2 === void 0 && typeof z == "string") te = z, H2 = this.length, z = 0;
            else {
              if (!isFinite(z)) throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");
              z >>>= 0, isFinite(H2) ? (H2 >>>= 0, te === void 0 && (te = "utf8")) : (te = H2, H2 = void 0);
            }
            var j = this.length - z;
            if ((H2 === void 0 || H2 > j) && (H2 = j), R2.length > 0 && (H2 < 0 || z < 0) || z > this.length) throw new RangeError("Attempt to write outside buffer bounds");
            te || (te = "utf8");
            for (var Q2 = false; ; ) switch (te) {
              case "hex":
                return x(this, R2, z, H2);
              case "utf8":
              case "utf-8":
                return b(this, R2, z, H2);
              case "ascii":
                return y(this, R2, z, H2);
              case "latin1":
              case "binary":
                return w(this, R2, z, H2);
              case "base64":
                return _4(this, R2, z, H2);
              case "ucs2":
              case "ucs-2":
              case "utf16le":
              case "utf-16le":
                return k(this, R2, z, H2);
              default:
                if (Q2) throw new TypeError("Unknown encoding: " + te);
                te = ("" + te).toLowerCase(), Q2 = true;
            }
          }, i.prototype.toJSON = function() {
            return { type: "Buffer", data: Array.prototype.slice.call(this._arr || this, 0) };
          };
          function S2(R2, z, H2) {
            var te = "";
            H2 = Math.min(R2.length, H2);
            for (var j = z; j < H2; ++j) te += String.fromCharCode(127 & R2[j]);
            return te;
          }
          function C2(R2, z, H2) {
            var te = "";
            H2 = Math.min(R2.length, H2);
            for (var j = z; j < H2; ++j) te += String.fromCharCode(R2[j]);
            return te;
          }
          function E2(R2, z, H2) {
            var te = R2.length;
            (!z || z < 0) && (z = 0), (!H2 || H2 < 0 || H2 > te) && (H2 = te);
            for (var j = "", Q2 = z; Q2 < H2; ++Q2) j += W2(R2[Q2]);
            return j;
          }
          function F13(R2, z, H2) {
            for (var te = R2.slice(z, H2), j = "", Q2 = 0; Q2 < te.length; Q2 += 2) j += String.fromCharCode(te[Q2] + 256 * te[Q2 + 1]);
            return j;
          }
          function N2(R2, z, H2) {
            if (R2 % 1 != 0 || R2 < 0) throw new RangeError("offset is not uint");
            if (R2 + z > H2) throw new RangeError("Trying to access beyond buffer length");
          }
          function D2(R2, z, H2, te, j, Q2) {
            if (!i.isBuffer(R2)) throw new TypeError('"buffer" argument must be a Buffer instance');
            if (z > j || z < Q2) throw new RangeError('"value" argument is out of bounds');
            if (H2 + te > R2.length) throw new RangeError("Index out of range");
          }
          function I2(R2, z, H2, te, j, Q2) {
            if (H2 + te > R2.length) throw new RangeError("Index out of range");
            if (H2 < 0) throw new RangeError("Index out of range");
          }
          function O2(R2, z, H2, te, j) {
            return z = +z, H2 >>>= 0, j || I2(R2, 0, H2, 4), o.write(R2, z, H2, te, 23, 4), H2 + 4;
          }
          function L2(R2, z, H2, te, j) {
            return z = +z, H2 >>>= 0, j || I2(R2, 0, H2, 8), o.write(R2, z, H2, te, 52, 8), H2 + 8;
          }
          i.prototype.slice = function(R2, z) {
            var H2 = this.length;
            (R2 = ~~R2) < 0 ? (R2 += H2) < 0 && (R2 = 0) : R2 > H2 && (R2 = H2), (z = z === void 0 ? H2 : ~~z) < 0 ? (z += H2) < 0 && (z = 0) : z > H2 && (z = H2), z < R2 && (z = R2);
            var te = this.subarray(R2, z);
            return te.__proto__ = i.prototype, te;
          }, i.prototype.readUIntLE = function(R2, z, H2) {
            R2 >>>= 0, z >>>= 0, H2 || N2(R2, z, this.length);
            for (var te = this[R2], j = 1, Q2 = 0; ++Q2 < z && (j *= 256); ) te += this[R2 + Q2] * j;
            return te;
          }, i.prototype.readUIntBE = function(R2, z, H2) {
            R2 >>>= 0, z >>>= 0, H2 || N2(R2, z, this.length);
            for (var te = this[R2 + --z], j = 1; z > 0 && (j *= 256); ) te += this[R2 + --z] * j;
            return te;
          }, i.prototype.readUInt8 = function(R2, z) {
            return R2 >>>= 0, z || N2(R2, 1, this.length), this[R2];
          }, i.prototype.readUInt16LE = function(R2, z) {
            return R2 >>>= 0, z || N2(R2, 2, this.length), this[R2] | this[R2 + 1] << 8;
          }, i.prototype.readUInt16BE = function(R2, z) {
            return R2 >>>= 0, z || N2(R2, 2, this.length), this[R2] << 8 | this[R2 + 1];
          }, i.prototype.readUInt32LE = function(R2, z) {
            return R2 >>>= 0, z || N2(R2, 4, this.length), (this[R2] | this[R2 + 1] << 8 | this[R2 + 2] << 16) + 16777216 * this[R2 + 3];
          }, i.prototype.readUInt32BE = function(R2, z) {
            return R2 >>>= 0, z || N2(R2, 4, this.length), 16777216 * this[R2] + (this[R2 + 1] << 16 | this[R2 + 2] << 8 | this[R2 + 3]);
          }, i.prototype.readIntLE = function(R2, z, H2) {
            R2 >>>= 0, z >>>= 0, H2 || N2(R2, z, this.length);
            for (var te = this[R2], j = 1, Q2 = 0; ++Q2 < z && (j *= 256); ) te += this[R2 + Q2] * j;
            return te >= (j *= 128) && (te -= Math.pow(2, 8 * z)), te;
          }, i.prototype.readIntBE = function(R2, z, H2) {
            R2 >>>= 0, z >>>= 0, H2 || N2(R2, z, this.length);
            for (var te = z, j = 1, Q2 = this[R2 + --te]; te > 0 && (j *= 256); ) Q2 += this[R2 + --te] * j;
            return Q2 >= (j *= 128) && (Q2 -= Math.pow(2, 8 * z)), Q2;
          }, i.prototype.readInt8 = function(R2, z) {
            return R2 >>>= 0, z || N2(R2, 1, this.length), 128 & this[R2] ? -1 * (255 - this[R2] + 1) : this[R2];
          }, i.prototype.readInt16LE = function(R2, z) {
            R2 >>>= 0, z || N2(R2, 2, this.length);
            var H2 = this[R2] | this[R2 + 1] << 8;
            return 32768 & H2 ? 4294901760 | H2 : H2;
          }, i.prototype.readInt16BE = function(R2, z) {
            R2 >>>= 0, z || N2(R2, 2, this.length);
            var H2 = this[R2 + 1] | this[R2] << 8;
            return 32768 & H2 ? 4294901760 | H2 : H2;
          }, i.prototype.readInt32LE = function(R2, z) {
            return R2 >>>= 0, z || N2(R2, 4, this.length), this[R2] | this[R2 + 1] << 8 | this[R2 + 2] << 16 | this[R2 + 3] << 24;
          }, i.prototype.readInt32BE = function(R2, z) {
            return R2 >>>= 0, z || N2(R2, 4, this.length), this[R2] << 24 | this[R2 + 1] << 16 | this[R2 + 2] << 8 | this[R2 + 3];
          }, i.prototype.readFloatLE = function(R2, z) {
            return R2 >>>= 0, z || N2(R2, 4, this.length), o.read(this, R2, true, 23, 4);
          }, i.prototype.readFloatBE = function(R2, z) {
            return R2 >>>= 0, z || N2(R2, 4, this.length), o.read(this, R2, false, 23, 4);
          }, i.prototype.readDoubleLE = function(R2, z) {
            return R2 >>>= 0, z || N2(R2, 8, this.length), o.read(this, R2, true, 52, 8);
          }, i.prototype.readDoubleBE = function(R2, z) {
            return R2 >>>= 0, z || N2(R2, 8, this.length), o.read(this, R2, false, 52, 8);
          }, i.prototype.writeUIntLE = function(R2, z, H2, te) {
            R2 = +R2, z >>>= 0, H2 >>>= 0, te || D2(this, R2, z, H2, Math.pow(2, 8 * H2) - 1, 0);
            var j = 1, Q2 = 0;
            for (this[z] = 255 & R2; ++Q2 < H2 && (j *= 256); ) this[z + Q2] = R2 / j & 255;
            return z + H2;
          }, i.prototype.writeUIntBE = function(R2, z, H2, te) {
            R2 = +R2, z >>>= 0, H2 >>>= 0, te || D2(this, R2, z, H2, Math.pow(2, 8 * H2) - 1, 0);
            var j = H2 - 1, Q2 = 1;
            for (this[z + j] = 255 & R2; --j >= 0 && (Q2 *= 256); ) this[z + j] = R2 / Q2 & 255;
            return z + H2;
          }, i.prototype.writeUInt8 = function(R2, z, H2) {
            return R2 = +R2, z >>>= 0, H2 || D2(this, R2, z, 1, 255, 0), this[z] = 255 & R2, z + 1;
          }, i.prototype.writeUInt16LE = function(R2, z, H2) {
            return R2 = +R2, z >>>= 0, H2 || D2(this, R2, z, 2, 65535, 0), this[z] = 255 & R2, this[z + 1] = R2 >>> 8, z + 2;
          }, i.prototype.writeUInt16BE = function(R2, z, H2) {
            return R2 = +R2, z >>>= 0, H2 || D2(this, R2, z, 2, 65535, 0), this[z] = R2 >>> 8, this[z + 1] = 255 & R2, z + 2;
          }, i.prototype.writeUInt32LE = function(R2, z, H2) {
            return R2 = +R2, z >>>= 0, H2 || D2(this, R2, z, 4, 4294967295, 0), this[z + 3] = R2 >>> 24, this[z + 2] = R2 >>> 16, this[z + 1] = R2 >>> 8, this[z] = 255 & R2, z + 4;
          }, i.prototype.writeUInt32BE = function(R2, z, H2) {
            return R2 = +R2, z >>>= 0, H2 || D2(this, R2, z, 4, 4294967295, 0), this[z] = R2 >>> 24, this[z + 1] = R2 >>> 16, this[z + 2] = R2 >>> 8, this[z + 3] = 255 & R2, z + 4;
          }, i.prototype.writeIntLE = function(R2, z, H2, te) {
            if (R2 = +R2, z >>>= 0, !te) {
              var j = Math.pow(2, 8 * H2 - 1);
              D2(this, R2, z, H2, j - 1, -j);
            }
            var Q2 = 0, Z2 = 1, ne = 0;
            for (this[z] = 255 & R2; ++Q2 < H2 && (Z2 *= 256); ) R2 < 0 && ne === 0 && this[z + Q2 - 1] !== 0 && (ne = 1), this[z + Q2] = (R2 / Z2 >> 0) - ne & 255;
            return z + H2;
          }, i.prototype.writeIntBE = function(R2, z, H2, te) {
            if (R2 = +R2, z >>>= 0, !te) {
              var j = Math.pow(2, 8 * H2 - 1);
              D2(this, R2, z, H2, j - 1, -j);
            }
            var Q2 = H2 - 1, Z2 = 1, ne = 0;
            for (this[z + Q2] = 255 & R2; --Q2 >= 0 && (Z2 *= 256); ) R2 < 0 && ne === 0 && this[z + Q2 + 1] !== 0 && (ne = 1), this[z + Q2] = (R2 / Z2 >> 0) - ne & 255;
            return z + H2;
          }, i.prototype.writeInt8 = function(R2, z, H2) {
            return R2 = +R2, z >>>= 0, H2 || D2(this, R2, z, 1, 127, -128), R2 < 0 && (R2 = 255 + R2 + 1), this[z] = 255 & R2, z + 1;
          }, i.prototype.writeInt16LE = function(R2, z, H2) {
            return R2 = +R2, z >>>= 0, H2 || D2(this, R2, z, 2, 32767, -32768), this[z] = 255 & R2, this[z + 1] = R2 >>> 8, z + 2;
          }, i.prototype.writeInt16BE = function(R2, z, H2) {
            return R2 = +R2, z >>>= 0, H2 || D2(this, R2, z, 2, 32767, -32768), this[z] = R2 >>> 8, this[z + 1] = 255 & R2, z + 2;
          }, i.prototype.writeInt32LE = function(R2, z, H2) {
            return R2 = +R2, z >>>= 0, H2 || D2(this, R2, z, 4, 2147483647, -2147483648), this[z] = 255 & R2, this[z + 1] = R2 >>> 8, this[z + 2] = R2 >>> 16, this[z + 3] = R2 >>> 24, z + 4;
          }, i.prototype.writeInt32BE = function(R2, z, H2) {
            return R2 = +R2, z >>>= 0, H2 || D2(this, R2, z, 4, 2147483647, -2147483648), R2 < 0 && (R2 = 4294967295 + R2 + 1), this[z] = R2 >>> 24, this[z + 1] = R2 >>> 16, this[z + 2] = R2 >>> 8, this[z + 3] = 255 & R2, z + 4;
          }, i.prototype.writeFloatLE = function(R2, z, H2) {
            return O2(this, R2, z, true, H2);
          }, i.prototype.writeFloatBE = function(R2, z, H2) {
            return O2(this, R2, z, false, H2);
          }, i.prototype.writeDoubleLE = function(R2, z, H2) {
            return L2(this, R2, z, true, H2);
          }, i.prototype.writeDoubleBE = function(R2, z, H2) {
            return L2(this, R2, z, false, H2);
          }, i.prototype.copy = function(R2, z, H2, te) {
            if (!i.isBuffer(R2)) throw new TypeError("argument should be a Buffer");
            if (H2 || (H2 = 0), te || te === 0 || (te = this.length), z >= R2.length && (z = R2.length), z || (z = 0), te > 0 && te < H2 && (te = H2), te === H2 || R2.length === 0 || this.length === 0) return 0;
            if (z < 0) throw new RangeError("targetStart out of bounds");
            if (H2 < 0 || H2 >= this.length) throw new RangeError("Index out of range");
            if (te < 0) throw new RangeError("sourceEnd out of bounds");
            te > this.length && (te = this.length), R2.length - z < te - H2 && (te = R2.length - z + H2);
            var j = te - H2;
            if (this === R2 && typeof Uint8Array.prototype.copyWithin == "function") this.copyWithin(z, H2, te);
            else if (this === R2 && H2 < z && z < te) for (var Q2 = j - 1; Q2 >= 0; --Q2) R2[Q2 + z] = this[Q2 + H2];
            else Uint8Array.prototype.set.call(R2, this.subarray(H2, te), z);
            return j;
          }, i.prototype.fill = function(R2, z, H2, te) {
            if (typeof R2 == "string") {
              if (typeof z == "string" ? (te = z, z = 0, H2 = this.length) : typeof H2 == "string" && (te = H2, H2 = this.length), te !== void 0 && typeof te != "string") throw new TypeError("encoding must be a string");
              if (typeof te == "string" && !i.isEncoding(te)) throw new TypeError("Unknown encoding: " + te);
              if (R2.length === 1) {
                var j = R2.charCodeAt(0);
                (te === "utf8" && j < 128 || te === "latin1") && (R2 = j);
              }
            } else typeof R2 == "number" && (R2 &= 255);
            if (z < 0 || this.length < z || this.length < H2) throw new RangeError("Out of range index");
            if (H2 <= z) return this;
            var Q2;
            if (z >>>= 0, H2 = H2 === void 0 ? this.length : H2 >>> 0, R2 || (R2 = 0), typeof R2 == "number") for (Q2 = z; Q2 < H2; ++Q2) this[Q2] = R2;
            else {
              var Z2 = i.isBuffer(R2) ? R2 : i.from(R2, te), ne = Z2.length;
              if (ne === 0) throw new TypeError('The value "' + R2 + '" is invalid for argument "value"');
              for (Q2 = 0; Q2 < H2 - z; ++Q2) this[Q2 + z] = Z2[Q2 % ne];
            }
            return this;
          };
          var V2 = /[^+/0-9A-Za-z-_]/g;
          function W2(R2) {
            return R2 < 16 ? "0" + R2.toString(16) : R2.toString(16);
          }
          function X2(R2, z) {
            var H2;
            z = z || 1 / 0;
            for (var te = R2.length, j = null, Q2 = [], Z2 = 0; Z2 < te; ++Z2) {
              if ((H2 = R2.charCodeAt(Z2)) > 55295 && H2 < 57344) {
                if (!j) {
                  if (H2 > 56319) {
                    (z -= 3) > -1 && Q2.push(239, 191, 189);
                    continue;
                  }
                  if (Z2 + 1 === te) {
                    (z -= 3) > -1 && Q2.push(239, 191, 189);
                    continue;
                  }
                  j = H2;
                  continue;
                }
                if (H2 < 56320) {
                  (z -= 3) > -1 && Q2.push(239, 191, 189), j = H2;
                  continue;
                }
                H2 = 65536 + (j - 55296 << 10 | H2 - 56320);
              } else j && (z -= 3) > -1 && Q2.push(239, 191, 189);
              if (j = null, H2 < 128) {
                if ((z -= 1) < 0) break;
                Q2.push(H2);
              } else if (H2 < 2048) {
                if ((z -= 2) < 0) break;
                Q2.push(H2 >> 6 | 192, 63 & H2 | 128);
              } else if (H2 < 65536) {
                if ((z -= 3) < 0) break;
                Q2.push(H2 >> 12 | 224, H2 >> 6 & 63 | 128, 63 & H2 | 128);
              } else {
                if (!(H2 < 1114112)) throw new Error("Invalid code point");
                if ((z -= 4) < 0) break;
                Q2.push(H2 >> 18 | 240, H2 >> 12 & 63 | 128, H2 >> 6 & 63 | 128, 63 & H2 | 128);
              }
            }
            return Q2;
          }
          function Y2(R2) {
            return a.toByteArray(function(z) {
              if ((z = (z = z.split("=")[0]).trim().replace(V2, "")).length < 2) return "";
              for (; z.length % 4 != 0; ) z += "=";
              return z;
            }(R2));
          }
          function K2(R2, z, H2, te) {
            for (var j = 0; j < te && !(j + H2 >= z.length || j >= R2.length); ++j) z[j + H2] = R2[j];
            return j;
          }
          function q(R2, z) {
            return R2 instanceof z || R2 != null && R2.constructor != null && R2.constructor.name != null && R2.constructor.name === z.name;
          }
          function re(R2) {
            return R2 != R2;
          }
        }).call(this);
      }).call(this, e("buffer").Buffer);
    }, { "base64-js": 79, buffer: 85, ieee754: 230 }], 86: [function(e, t, r) {
      t.exports = function(n, a, o) {
        return a < o ? n < a ? a : n > o ? o : n : n < o ? o : n > a ? a : n;
      };
    }, {}], 87: [function(e, t, r) {
      "use strict";
      var n = e("clamp");
      function a(o, s) {
        s == null && (s = true);
        var i = o[0], l = o[1], u2 = o[2], c = o[3];
        return c == null && (c = s ? 1 : 255), s && (i *= 255, l *= 255, u2 *= 255, c *= 255), 16777216 * (i = 255 & n(i, 0, 255)) + ((l = 255 & n(l, 0, 255)) << 16) + ((u2 = 255 & n(u2, 0, 255)) << 8) + (c = 255 & n(c, 0, 255));
      }
      t.exports = a, t.exports.to = a, t.exports.from = function(o, s) {
        var i = (o = +o) >>> 24, l = (16711680 & o) >>> 16, u2 = (65280 & o) >>> 8, c = 255 & o;
        return s === false ? [i, l, u2, c] : [i / 255, l / 255, u2 / 255, c / 255];
      };
    }, { clamp: 86 }], 88: [function(e, t, r) {
      "use strict";
      t.exports = { 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] };
    }, {}], 89: [function(e, t, r) {
      "use strict";
      var n = e("color-rgba"), a = e("clamp"), o = e("dtype");
      t.exports = function(s, i) {
        i !== "float" && i || (i = "array"), i === "uint" && (i = "uint8"), i === "uint_clamped" && (i = "uint8_clamped");
        var l = new (o(i))(4), u2 = i !== "uint8" && i !== "uint8_clamped";
        return s.length && typeof s != "string" || ((s = n(s))[0] /= 255, s[1] /= 255, s[2] /= 255), function(c) {
          return c instanceof Uint8Array || c instanceof Uint8ClampedArray || !!(Array.isArray(c) && (c[0] > 1 || c[0] === 0) && (c[1] > 1 || c[1] === 0) && (c[2] > 1 || c[2] === 0) && (!c[3] || c[3] > 1));
        }(s) ? (l[0] = s[0], l[1] = s[1], l[2] = s[2], l[3] = s[3] != null ? s[3] : 255, u2 && (l[0] /= 255, l[1] /= 255, l[2] /= 255, l[3] /= 255), l) : (u2 ? (l[0] = s[0], l[1] = s[1], l[2] = s[2], l[3] = s[3] != null ? s[3] : 1) : (l[0] = a(Math.floor(255 * s[0]), 0, 255), l[1] = a(Math.floor(255 * s[1]), 0, 255), l[2] = a(Math.floor(255 * s[2]), 0, 255), l[3] = s[3] == null ? 255 : a(Math.floor(255 * s[3]), 0, 255)), l);
      };
    }, { clamp: 86, "color-rgba": 91, dtype: 127 }], 90: [function(e, t, r) {
      (function(n) {
        (function() {
          "use strict";
          var a = e("color-name"), o = e("is-plain-obj"), s = e("defined");
          t.exports = function(l) {
            var u2, c, f = [], h = 1;
            if (typeof l == "string") if (a[l]) f = a[l].slice(), c = "rgb";
            else if (l === "transparent") h = 0, c = "rgb", f = [0, 0, 0];
            else if (/^#[A-Fa-f0-9]+$/.test(l)) {
              var p = (m = l.slice(1)).length;
              h = 1, p <= 4 ? (f = [parseInt(m[0] + m[0], 16), parseInt(m[1] + m[1], 16), parseInt(m[2] + m[2], 16)], p === 4 && (h = parseInt(m[3] + m[3], 16) / 255)) : (f = [parseInt(m[0] + m[1], 16), parseInt(m[2] + m[3], 16), parseInt(m[4] + m[5], 16)], p === 8 && (h = parseInt(m[6] + m[7], 16) / 255)), f[0] || (f[0] = 0), f[1] || (f[1] = 0), f[2] || (f[2] = 0), c = "rgb";
            } else if (u2 = /^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(l)) {
              var d = u2[1], v = d === "rgb", m = d.replace(/a$/, "");
              c = m, p = m === "cmyk" ? 4 : m === "gray" ? 1 : 3, f = u2[2].trim().split(/\s*,\s*/).map(function(x, b) {
                if (/%$/.test(x)) return b === p ? parseFloat(x) / 100 : m === "rgb" ? 255 * parseFloat(x) / 100 : parseFloat(x);
                if (m[b] === "h") {
                  if (/deg$/.test(x)) return parseFloat(x);
                  if (i[x] !== void 0) return i[x];
                }
                return parseFloat(x);
              }), d === m && f.push(1), h = v || f[p] === void 0 ? 1 : f[p], f = f.slice(0, p);
            } else l.length > 10 && /[0-9](?:\s|\/)/.test(l) && (f = l.match(/([0-9]+)/g).map(function(x) {
              return parseFloat(x);
            }), c = l.match(/([a-z])/gi).join("").toLowerCase());
            else if (isNaN(l)) if (o(l)) {
              var g = s(l.r, l.red, l.R, null);
              g !== null ? (c = "rgb", f = [g, s(l.g, l.green, l.G), s(l.b, l.blue, l.B)]) : (c = "hsl", f = [s(l.h, l.hue, l.H), s(l.s, l.saturation, l.S), s(l.l, l.lightness, l.L, l.b, l.brightness)]), h = s(l.a, l.alpha, l.opacity, 1), l.opacity != null && (h /= 100);
            } else (Array.isArray(l) || n.ArrayBuffer && ArrayBuffer.isView && ArrayBuffer.isView(l)) && (f = [l[0], l[1], l[2]], c = "rgb", h = l.length === 4 ? l[3] : 1);
            else c = "rgb", f = [l >>> 16, (65280 & l) >>> 8, 255 & l];
            return { space: c, values: f, alpha: h };
          };
          var i = { red: 0, orange: 60, yellow: 120, green: 180, blue: 240, purple: 300 };
        }).call(this);
      }).call(this, typeof global < "u" ? global : typeof self < "u" ? self : typeof window < "u" ? window : {});
    }, { "color-name": 88, defined: 124, "is-plain-obj": 236 }], 91: [function(e, t, r) {
      "use strict";
      var n = e("color-parse"), a = e("color-space/hsl"), o = e("clamp");
      t.exports = function(s) {
        var i, l = n(s);
        return l.space ? ((i = Array(3))[0] = o(l.values[0], 0, 255), i[1] = o(l.values[1], 0, 255), i[2] = o(l.values[2], 0, 255), l.space[0] === "h" && (i = a.rgb(i)), i.push(o(l.alpha, 0, 1)), i) : [];
      };
    }, { clamp: 86, "color-parse": 90, "color-space/hsl": 92 }], 92: [function(e, t, r) {
      "use strict";
      var n = e("./rgb");
      t.exports = { name: "hsl", min: [0, 0, 0], max: [360, 100, 100], channel: ["hue", "saturation", "lightness"], alias: ["HSL"], rgb: function(a) {
        var o, s, i, l, u2, c = a[0] / 360, f = a[1] / 100, h = a[2] / 100;
        if (f === 0) return [u2 = 255 * h, u2, u2];
        o = 2 * h - (s = h < 0.5 ? h * (1 + f) : h + f - h * f), l = [0, 0, 0];
        for (var p = 0; p < 3; p++) (i = c + 1 / 3 * -(p - 1)) < 0 ? i++ : i > 1 && i--, u2 = 6 * i < 1 ? o + 6 * (s - o) * i : 2 * i < 1 ? s : 3 * i < 2 ? o + (s - o) * (2 / 3 - i) * 6 : o, l[p] = 255 * u2;
        return l;
      } }, n.hsl = function(a) {
        var o, s, i = a[0] / 255, l = a[1] / 255, u2 = a[2] / 255, c = Math.min(i, l, u2), f = Math.max(i, l, u2), h = f - c;
        return f === c ? o = 0 : i === f ? o = (l - u2) / h : l === f ? o = 2 + (u2 - i) / h : u2 === f && (o = 4 + (i - l) / h), (o = Math.min(60 * o, 360)) < 0 && (o += 360), s = (c + f) / 2, [o, 100 * (f === c ? 0 : s <= 0.5 ? h / (f + c) : h / (2 - f - c)), 100 * s];
      };
    }, { "./rgb": 93 }], 93: [function(e, t, r) {
      "use strict";
      t.exports = { name: "rgb", min: [0, 0, 0], max: [255, 255, 255], channel: ["red", "green", "blue"], alias: ["RGB"] };
    }, {}], 94: [function(e, t, r) {
      t.exports = { AFG: "afghan", ALA: "\\b\\wland", ALB: "albania", DZA: "algeria", ASM: "^(?=.*americ).*samoa", AND: "andorra", AGO: "angola", AIA: "anguill?a", ATA: "antarctica", ATG: "antigua", ARG: "argentin", ARM: "armenia", ABW: "^(?!.*bonaire).*\\baruba", AUS: "australia", AUT: "^(?!.*hungary).*austria|\\baustri.*\\bemp", AZE: "azerbaijan", BHS: "bahamas", BHR: "bahrain", BGD: "bangladesh|^(?=.*east).*paki?stan", BRB: "barbados", BLR: "belarus|byelo", BEL: "^(?!.*luxem).*belgium", BLZ: "belize|^(?=.*british).*honduras", BEN: "benin|dahome", BMU: "bermuda", BTN: "bhutan", BOL: "bolivia", BES: "^(?=.*bonaire).*eustatius|^(?=.*carib).*netherlands|\\bbes.?islands", BIH: "herzegovina|bosnia", BWA: "botswana|bechuana", BVT: "bouvet", BRA: "brazil", IOT: "british.?indian.?ocean", BRN: "brunei", BGR: "bulgaria", BFA: "burkina|\\bfaso|upper.?volta", BDI: "burundi", CPV: "verde", KHM: "cambodia|kampuchea|khmer", CMR: "cameroon", CAN: "canada", CYM: "cayman", CAF: "\\bcentral.african.republic", TCD: "\\bchad", CHL: "\\bchile", CHN: "^(?!.*\\bmac)(?!.*\\bhong)(?!.*\\btai)(?!.*\\brep).*china|^(?=.*peo)(?=.*rep).*china", CXR: "christmas", CCK: "\\bcocos|keeling", COL: "colombia", COM: "comoro", COG: "^(?!.*\\bdem)(?!.*\\bd[\\.]?r)(?!.*kinshasa)(?!.*zaire)(?!.*belg)(?!.*l.opoldville)(?!.*free).*\\bcongo", COK: "\\bcook", CRI: "costa.?rica", CIV: "ivoire|ivory", HRV: "croatia", CUB: "\\bcuba", CUW: "^(?!.*bonaire).*\\bcura(c|\xE7)ao", CYP: "cyprus", CSK: "czechoslovakia", CZE: "^(?=.*rep).*czech|czechia|bohemia", COD: "\\bdem.*congo|congo.*\\bdem|congo.*\\bd[\\.]?r|\\bd[\\.]?r.*congo|belgian.?congo|congo.?free.?state|kinshasa|zaire|l.opoldville|drc|droc|rdc", DNK: "denmark", DJI: "djibouti", DMA: "dominica(?!n)", DOM: "dominican.rep", ECU: "ecuador", EGY: "egypt", SLV: "el.?salvador", GNQ: "guine.*eq|eq.*guine|^(?=.*span).*guinea", ERI: "eritrea", EST: "estonia", ETH: "ethiopia|abyssinia", FLK: "falkland|malvinas", FRO: "faroe|faeroe", FJI: "fiji", FIN: "finland", FRA: "^(?!.*\\bdep)(?!.*martinique).*france|french.?republic|\\bgaul", GUF: "^(?=.*french).*guiana", PYF: "french.?polynesia|tahiti", ATF: "french.?southern", GAB: "gabon", GMB: "gambia", GEO: "^(?!.*south).*georgia", DDR: "german.?democratic.?republic|democratic.?republic.*germany|east.germany", DEU: "^(?!.*east).*germany|^(?=.*\\bfed.*\\brep).*german", GHA: "ghana|gold.?coast", GIB: "gibraltar", GRC: "greece|hellenic|hellas", GRL: "greenland", GRD: "grenada", GLP: "guadeloupe", GUM: "\\bguam", GTM: "guatemala", GGY: "guernsey", GIN: "^(?!.*eq)(?!.*span)(?!.*bissau)(?!.*portu)(?!.*new).*guinea", GNB: "bissau|^(?=.*portu).*guinea", GUY: "guyana|british.?guiana", HTI: "haiti", HMD: "heard.*mcdonald", VAT: "holy.?see|vatican|papal.?st", HND: "^(?!.*brit).*honduras", HKG: "hong.?kong", HUN: "^(?!.*austr).*hungary", ISL: "iceland", IND: "india(?!.*ocea)", IDN: "indonesia", IRN: "\\biran|persia", IRQ: "\\biraq|mesopotamia", IRL: "(^ireland)|(^republic.*ireland)", IMN: "^(?=.*isle).*\\bman", ISR: "israel", ITA: "italy", JAM: "jamaica", JPN: "japan", JEY: "jersey", JOR: "jordan", KAZ: "kazak", KEN: "kenya|british.?east.?africa|east.?africa.?prot", KIR: "kiribati", PRK: "^(?=.*democrat|people|north|d.*p.*.r).*\\bkorea|dprk|korea.*(d.*p.*r)", KWT: "kuwait", KGZ: "kyrgyz|kirghiz", LAO: "\\blaos?\\b", LVA: "latvia", LBN: "lebanon", LSO: "lesotho|basuto", LBR: "liberia", LBY: "libya", LIE: "liechtenstein", LTU: "lithuania", LUX: "^(?!.*belg).*luxem", MAC: "maca(o|u)", MDG: "madagascar|malagasy", MWI: "malawi|nyasa", MYS: "malaysia", MDV: "maldive", MLI: "\\bmali\\b", MLT: "\\bmalta", MHL: "marshall", MTQ: "martinique", MRT: "mauritania", MUS: "mauritius", MYT: "\\bmayotte", MEX: "\\bmexic", FSM: "fed.*micronesia|micronesia.*fed", MCO: "monaco", MNG: "mongolia", MNE: "^(?!.*serbia).*montenegro", MSR: "montserrat", MAR: "morocco|\\bmaroc", MOZ: "mozambique", MMR: "myanmar|burma", NAM: "namibia", NRU: "nauru", NPL: "nepal", NLD: "^(?!.*\\bant)(?!.*\\bcarib).*netherlands", ANT: "^(?=.*\\bant).*(nether|dutch)", NCL: "new.?caledonia", NZL: "new.?zealand", NIC: "nicaragua", NER: "\\bniger(?!ia)", NGA: "nigeria", NIU: "niue", NFK: "norfolk", MNP: "mariana", NOR: "norway", OMN: "\\boman|trucial", PAK: "^(?!.*east).*paki?stan", PLW: "palau", PSE: "palestin|\\bgaza|west.?bank", PAN: "panama", PNG: "papua|new.?guinea", PRY: "paraguay", PER: "peru", PHL: "philippines", PCN: "pitcairn", POL: "poland", PRT: "portugal", PRI: "puerto.?rico", QAT: "qatar", KOR: "^(?!.*d.*p.*r)(?!.*democrat)(?!.*people)(?!.*north).*\\bkorea(?!.*d.*p.*r)", MDA: "moldov|b(a|e)ssarabia", REU: "r(e|\xE9)union", ROU: "r(o|u|ou)mania", RUS: "\\brussia|soviet.?union|u\\.?s\\.?s\\.?r|socialist.?republics", RWA: "rwanda", BLM: "barth(e|\xE9)lemy", SHN: "helena", KNA: "kitts|\\bnevis", LCA: "\\blucia", MAF: "^(?=.*collectivity).*martin|^(?=.*france).*martin(?!ique)|^(?=.*french).*martin(?!ique)", SPM: "miquelon", VCT: "vincent", WSM: "^(?!.*amer).*samoa", SMR: "san.?marino", STP: "\\bs(a|\xE3)o.?tom(e|\xE9)", SAU: "\\bsa\\w*.?arabia", SEN: "senegal", SRB: "^(?!.*monte).*serbia", SYC: "seychell", SLE: "sierra", SGP: "singapore", SXM: "^(?!.*martin)(?!.*saba).*maarten", SVK: "^(?!.*cze).*slovak", SVN: "slovenia", SLB: "solomon", SOM: "somali", ZAF: "south.africa|s\\\\..?africa", SGS: "south.?georgia|sandwich", SSD: "\\bs\\w*.?sudan", ESP: "spain", LKA: "sri.?lanka|ceylon", SDN: "^(?!.*\\bs(?!u)).*sudan", SUR: "surinam|dutch.?guiana", SJM: "svalbard", SWZ: "swaziland", SWE: "sweden", CHE: "switz|swiss", SYR: "syria", TWN: "taiwan|taipei|formosa|^(?!.*peo)(?=.*rep).*china", TJK: "tajik", THA: "thailand|\\bsiam", MKD: "macedonia|fyrom", TLS: "^(?=.*leste).*timor|^(?=.*east).*timor", TGO: "togo", TKL: "tokelau", TON: "tonga", TTO: "trinidad|tobago", TUN: "tunisia", TUR: "turkey", TKM: "turkmen", TCA: "turks", TUV: "tuvalu", UGA: "uganda", UKR: "ukrain", ARE: "emirates|^u\\.?a\\.?e\\.?$|united.?arab.?em", GBR: "united.?kingdom|britain|^u\\.?k\\.?$", TZA: "tanzania", USA: "united.?states\\b(?!.*islands)|\\bu\\.?s\\.?a\\.?\\b|^\\s*u\\.?s\\.?\\b(?!.*islands)", UMI: "minor.?outlying.?is", URY: "uruguay", UZB: "uzbek", VUT: "vanuatu|new.?hebrides", VEN: "venezuela", VNM: "^(?!.*republic).*viet.?nam|^(?=.*socialist).*viet.?nam", VGB: "^(?=.*\\bu\\.?\\s?k).*virgin|^(?=.*brit).*virgin|^(?=.*kingdom).*virgin", VIR: "^(?=.*\\bu\\.?\\s?s).*virgin|^(?=.*states).*virgin", WLF: "futuna|wallis", ESH: "western.sahara", YEM: "^(?!.*arab)(?!.*north)(?!.*sana)(?!.*peo)(?!.*dem)(?!.*south)(?!.*aden)(?!.*\\bp\\.?d\\.?r).*yemen", YMD: "^(?=.*peo).*yemen|^(?!.*rep)(?=.*dem).*yemen|^(?=.*south).*yemen|^(?=.*aden).*yemen|^(?=.*\\bp\\.?d\\.?r).*yemen", YUG: "yugoslavia", ZMB: "zambia|northern.?rhodesia", EAZ: "zanzibar", ZWE: "zimbabwe|^(?!.*northern).*rhodesia" };
    }, {}], 95: [function(e, t, r) {
      t.exports = ["xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "larger", "smaller"];
    }, {}], 96: [function(e, t, r) {
      t.exports = ["normal", "condensed", "semi-condensed", "extra-condensed", "ultra-condensed", "expanded", "semi-expanded", "extra-expanded", "ultra-expanded"];
    }, {}], 97: [function(e, t, r) {
      t.exports = ["normal", "italic", "oblique"];
    }, {}], 98: [function(e, t, r) {
      t.exports = ["normal", "bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900"];
    }, {}], 99: [function(e, t, r) {
      "use strict";
      t.exports = { parse: e("./parse"), stringify: e("./stringify") };
    }, { "./parse": 101, "./stringify": 102 }], 100: [function(e, t, r) {
      "use strict";
      var n = e("css-font-size-keywords");
      t.exports = { isSize: function(a) {
        return /^[\d\.]/.test(a) || a.indexOf("/") !== -1 || n.indexOf(a) !== -1;
      } };
    }, { "css-font-size-keywords": 95 }], 101: [function(e, t, r) {
      "use strict";
      var n = e("unquote"), a = e("css-global-keywords"), o = e("css-system-font-keywords"), s = e("css-font-weight-keywords"), i = e("css-font-style-keywords"), l = e("css-font-stretch-keywords"), u2 = e("string-split-by"), c = e("./lib/util").isSize;
      t.exports = h;
      var f = h.cache = {};
      function h(d) {
        if (typeof d != "string") throw new Error("Font argument must be a string.");
        if (f[d]) return f[d];
        if (d === "") throw new Error("Cannot parse an empty string.");
        if (o.indexOf(d) !== -1) return f[d] = { system: d };
        for (var v, m = { style: "normal", variant: "normal", weight: "normal", stretch: "normal", lineHeight: "normal", size: "1rem", family: ["serif"] }, g = u2(d, /\s+/); v = g.shift(); ) {
          if (a.indexOf(v) !== -1) return ["style", "variant", "weight", "stretch"].forEach(function(b) {
            m[b] = v;
          }), f[d] = m;
          if (i.indexOf(v) === -1) if (v !== "normal" && v !== "small-caps") if (l.indexOf(v) === -1) {
            if (s.indexOf(v) === -1) {
              if (c(v)) {
                var x = u2(v, "/");
                if (m.size = x[0], x[1] != null ? m.lineHeight = p(x[1]) : g[0] === "/" && (g.shift(), m.lineHeight = p(g.shift())), !g.length) throw new Error("Missing required font-family.");
                return m.family = u2(g.join(" "), /\s*,\s*/).map(n), f[d] = m;
              }
              throw new Error("Unknown or unsupported font token: " + v);
            }
            m.weight = v;
          } else m.stretch = v;
          else m.variant = v;
          else m.style = v;
        }
        throw new Error("Missing required font-size.");
      }
      function p(d) {
        var v = parseFloat(d);
        return v.toString() === d ? v : d;
      }
    }, { "./lib/util": 100, "css-font-stretch-keywords": 96, "css-font-style-keywords": 97, "css-font-weight-keywords": 98, "css-global-keywords": 103, "css-system-font-keywords": 104, "string-split-by": 305, unquote: 328 }], 102: [function(e, t, r) {
      "use strict";
      var n = e("pick-by-alias"), a = e("./lib/util").isSize, o = v(e("css-global-keywords")), s = v(e("css-system-font-keywords")), i = v(e("css-font-weight-keywords")), l = v(e("css-font-style-keywords")), u2 = v(e("css-font-stretch-keywords")), c = { normal: 1, "small-caps": 1 }, f = { serif: 1, "sans-serif": 1, monospace: 1, cursive: 1, fantasy: 1, "system-ui": 1 }, h = "1rem", p = "serif";
      function d(m, g) {
        if (m && !g[m] && !o[m]) throw Error("Unknown keyword `" + m + "`");
        return m;
      }
      function v(m) {
        for (var g = {}, x = 0; x < m.length; x++) g[m[x]] = 1;
        return g;
      }
      t.exports = function(m) {
        if ((m = n(m, { style: "style fontstyle fontStyle font-style slope distinction", variant: "variant font-variant fontVariant fontvariant var capitalization", weight: "weight w font-weight fontWeight fontweight", stretch: "stretch font-stretch fontStretch fontstretch width", size: "size s font-size fontSize fontsize height em emSize", lineHeight: "lh line-height lineHeight lineheight leading", family: "font family fontFamily font-family fontfamily type typeface face", system: "system reserved default global" })).system) return m.system && d(m.system, s), m.system;
        if (d(m.style, l), d(m.variant, c), d(m.weight, i), d(m.stretch, u2), m.size == null && (m.size = h), typeof m.size == "number" && (m.size += "px"), !a) throw Error("Bad size value `" + m.size + "`");
        m.family || (m.family = p), Array.isArray(m.family) && (m.family.length || (m.family = [p]), m.family = m.family.map(function(x) {
          return f[x] ? x : '"' + x + '"';
        }).join(", "));
        var g = [];
        return g.push(m.style), m.variant !== m.style && g.push(m.variant), m.weight !== m.variant && m.weight !== m.style && g.push(m.weight), m.stretch !== m.weight && m.stretch !== m.variant && m.stretch !== m.style && g.push(m.stretch), g.push(m.size + (m.lineHeight == null || m.lineHeight === "normal" || m.lineHeight + "" == "1" ? "" : "/" + m.lineHeight)), g.push(m.family), g.filter(Boolean).join(" ");
      };
    }, { "./lib/util": 100, "css-font-stretch-keywords": 96, "css-font-style-keywords": 97, "css-font-weight-keywords": 98, "css-global-keywords": 103, "css-system-font-keywords": 104, "pick-by-alias": 253 }], 103: [function(e, t, r) {
      t.exports = ["inherit", "initial", "unset"];
    }, {}], 104: [function(e, t, r) {
      t.exports = ["caption", "icon", "menu", "message-box", "small-caption", "status-bar"];
    }, {}], 105: [function(e, t, r) {
      "use strict";
      var n, a = e("type/value/is"), o = e("type/value/ensure"), s = e("type/plain-function/ensure"), i = e("es5-ext/object/copy"), l = e("es5-ext/object/normalize-options"), u2 = e("es5-ext/object/map"), c = Function.prototype.bind, f = Object.defineProperty, h = Object.prototype.hasOwnProperty;
      n = function(p, d, v) {
        var m, g = o(d) && s(d.value);
        return delete (m = i(d)).writable, delete m.value, m.get = function() {
          return !v.overwriteDefinition && h.call(this, p) ? g : (d.value = c.call(g, v.resolveContext ? v.resolveContext(this) : this), f(this, p, d), this[p]);
        }, m;
      }, t.exports = function(p) {
        var d = l(arguments[1]);
        return a(d.resolveContext) && s(d.resolveContext), u2(p, function(v, m) {
          return n(m, v, d);
        });
      };
    }, { "es5-ext/object/copy": 147, "es5-ext/object/map": 155, "es5-ext/object/normalize-options": 156, "type/plain-function/ensure": 321, "type/value/ensure": 325, "type/value/is": 326 }], 106: [function(e, t, r) {
      "use strict";
      var n = e("type/value/is"), a = e("type/plain-function/is"), o = e("es5-ext/object/assign"), s = e("es5-ext/object/normalize-options"), i = e("es5-ext/string/#/contains");
      (t.exports = function(l, u2) {
        var c, f, h, p, d;
        return arguments.length < 2 || typeof l != "string" ? (p = u2, u2 = l, l = null) : p = arguments[2], n(l) ? (c = i.call(l, "c"), f = i.call(l, "e"), h = i.call(l, "w")) : (c = h = true, f = false), d = { value: u2, configurable: c, enumerable: f, writable: h }, p ? o(s(p), d) : d;
      }).gs = function(l, u2, c) {
        var f, h, p, d;
        return typeof l != "string" ? (p = c, c = u2, u2 = l, l = null) : p = arguments[3], n(u2) ? a(u2) ? n(c) ? a(c) || (p = c, c = void 0) : c = void 0 : (p = u2, u2 = c = void 0) : u2 = void 0, n(l) ? (f = i.call(l, "c"), h = i.call(l, "e")) : (f = true, h = false), d = { get: u2, set: c, configurable: f, enumerable: h }, p ? o(s(p), d) : d;
      };
    }, { "es5-ext/object/assign": 144, "es5-ext/object/normalize-options": 156, "es5-ext/string/#/contains": 163, "type/plain-function/is": 322, "type/value/is": 326 }], 107: [function(e, t, r) {
      (function(n, a) {
        a(typeof r == "object" && t !== void 0 ? r : n.d3 = n.d3 || {});
      })(this, function(n) {
        "use strict";
        function a(N2, D2) {
          return N2 < D2 ? -1 : N2 > D2 ? 1 : N2 >= D2 ? 0 : NaN;
        }
        function o(N2) {
          var D2;
          return N2.length === 1 && (D2 = N2, N2 = function(I2, O2) {
            return a(D2(I2), O2);
          }), { left: function(I2, O2, L2, V2) {
            for (L2 == null && (L2 = 0), V2 == null && (V2 = I2.length); L2 < V2; ) {
              var W2 = L2 + V2 >>> 1;
              N2(I2[W2], O2) < 0 ? L2 = W2 + 1 : V2 = W2;
            }
            return L2;
          }, right: function(I2, O2, L2, V2) {
            for (L2 == null && (L2 = 0), V2 == null && (V2 = I2.length); L2 < V2; ) {
              var W2 = L2 + V2 >>> 1;
              N2(I2[W2], O2) > 0 ? V2 = W2 : L2 = W2 + 1;
            }
            return L2;
          } };
        }
        var s = o(a), i = s.right, l = s.left;
        function u2(N2, D2) {
          return [N2, D2];
        }
        function c(N2) {
          return N2 === null ? NaN : +N2;
        }
        function f(N2, D2) {
          var I2, O2, L2 = N2.length, V2 = 0, W2 = -1, X2 = 0, Y2 = 0;
          if (D2 == null) for (; ++W2 < L2; ) isNaN(I2 = c(N2[W2])) || (Y2 += (O2 = I2 - X2) * (I2 - (X2 += O2 / ++V2)));
          else for (; ++W2 < L2; ) isNaN(I2 = c(D2(N2[W2], W2, N2))) || (Y2 += (O2 = I2 - X2) * (I2 - (X2 += O2 / ++V2)));
          if (V2 > 1) return Y2 / (V2 - 1);
        }
        function h(N2, D2) {
          var I2 = f(N2, D2);
          return I2 && Math.sqrt(I2);
        }
        function p(N2, D2) {
          var I2, O2, L2, V2 = N2.length, W2 = -1;
          if (D2 == null) {
            for (; ++W2 < V2; ) if ((I2 = N2[W2]) != null && I2 >= I2) for (O2 = L2 = I2; ++W2 < V2; ) (I2 = N2[W2]) != null && (O2 > I2 && (O2 = I2), L2 < I2 && (L2 = I2));
          } else for (; ++W2 < V2; ) if ((I2 = D2(N2[W2], W2, N2)) != null && I2 >= I2) for (O2 = L2 = I2; ++W2 < V2; ) (I2 = D2(N2[W2], W2, N2)) != null && (O2 > I2 && (O2 = I2), L2 < I2 && (L2 = I2));
          return [O2, L2];
        }
        var d = Array.prototype, v = d.slice, m = d.map;
        function g(N2) {
          return function() {
            return N2;
          };
        }
        function x(N2) {
          return N2;
        }
        function b(N2, D2, I2) {
          N2 = +N2, D2 = +D2, I2 = (L2 = arguments.length) < 2 ? (D2 = N2, N2 = 0, 1) : L2 < 3 ? 1 : +I2;
          for (var O2 = -1, L2 = 0 | Math.max(0, Math.ceil((D2 - N2) / I2)), V2 = new Array(L2); ++O2 < L2; ) V2[O2] = N2 + O2 * I2;
          return V2;
        }
        var y = Math.sqrt(50), w = Math.sqrt(10), _4 = Math.sqrt(2);
        function k(N2, D2, I2) {
          var O2 = (D2 - N2) / Math.max(0, I2), L2 = Math.floor(Math.log(O2) / Math.LN10), V2 = O2 / Math.pow(10, L2);
          return L2 >= 0 ? (V2 >= y ? 10 : V2 >= w ? 5 : V2 >= _4 ? 2 : 1) * Math.pow(10, L2) : -Math.pow(10, -L2) / (V2 >= y ? 10 : V2 >= w ? 5 : V2 >= _4 ? 2 : 1);
        }
        function T2(N2, D2, I2) {
          var O2 = Math.abs(D2 - N2) / Math.max(0, I2), L2 = Math.pow(10, Math.floor(Math.log(O2) / Math.LN10)), V2 = O2 / L2;
          return V2 >= y ? L2 *= 10 : V2 >= w ? L2 *= 5 : V2 >= _4 && (L2 *= 2), D2 < N2 ? -L2 : L2;
        }
        function A2(N2) {
          return Math.ceil(Math.log(N2.length) / Math.LN2) + 1;
        }
        function S2(N2, D2, I2) {
          if (I2 == null && (I2 = c), O2 = N2.length) {
            if ((D2 = +D2) <= 0 || O2 < 2) return +I2(N2[0], 0, N2);
            if (D2 >= 1) return +I2(N2[O2 - 1], O2 - 1, N2);
            var O2, L2 = (O2 - 1) * D2, V2 = Math.floor(L2), W2 = +I2(N2[V2], V2, N2);
            return W2 + (+I2(N2[V2 + 1], V2 + 1, N2) - W2) * (L2 - V2);
          }
        }
        function C2(N2, D2) {
          var I2, O2, L2 = N2.length, V2 = -1;
          if (D2 == null) {
            for (; ++V2 < L2; ) if ((I2 = N2[V2]) != null && I2 >= I2) for (O2 = I2; ++V2 < L2; ) (I2 = N2[V2]) != null && O2 > I2 && (O2 = I2);
          } else for (; ++V2 < L2; ) if ((I2 = D2(N2[V2], V2, N2)) != null && I2 >= I2) for (O2 = I2; ++V2 < L2; ) (I2 = D2(N2[V2], V2, N2)) != null && O2 > I2 && (O2 = I2);
          return O2;
        }
        function E2(N2) {
          if (!(L2 = N2.length)) return [];
          for (var D2 = -1, I2 = C2(N2, F13), O2 = new Array(I2); ++D2 < I2; ) for (var L2, V2 = -1, W2 = O2[D2] = new Array(L2); ++V2 < L2; ) W2[V2] = N2[V2][D2];
          return O2;
        }
        function F13(N2) {
          return N2.length;
        }
        n.bisect = i, n.bisectRight = i, n.bisectLeft = l, n.ascending = a, n.bisector = o, n.cross = function(N2, D2, I2) {
          var O2, L2, V2, W2, X2 = N2.length, Y2 = D2.length, K2 = new Array(X2 * Y2);
          for (I2 == null && (I2 = u2), O2 = V2 = 0; O2 < X2; ++O2) for (W2 = N2[O2], L2 = 0; L2 < Y2; ++L2, ++V2) K2[V2] = I2(W2, D2[L2]);
          return K2;
        }, n.descending = function(N2, D2) {
          return D2 < N2 ? -1 : D2 > N2 ? 1 : D2 >= N2 ? 0 : NaN;
        }, n.deviation = h, n.extent = p, n.histogram = function() {
          var N2 = x, D2 = p, I2 = A2;
          function O2(L2) {
            var V2, W2, X2 = L2.length, Y2 = new Array(X2);
            for (V2 = 0; V2 < X2; ++V2) Y2[V2] = N2(L2[V2], V2, L2);
            var K2 = D2(Y2), q = K2[0], re = K2[1], R2 = I2(Y2, q, re);
            Array.isArray(R2) || (R2 = T2(q, re, R2), R2 = b(Math.ceil(q / R2) * R2, re, R2));
            for (var z = R2.length; R2[0] <= q; ) R2.shift(), --z;
            for (; R2[z - 1] > re; ) R2.pop(), --z;
            var H2, te = new Array(z + 1);
            for (V2 = 0; V2 <= z; ++V2) (H2 = te[V2] = []).x0 = V2 > 0 ? R2[V2 - 1] : q, H2.x1 = V2 < z ? R2[V2] : re;
            for (V2 = 0; V2 < X2; ++V2) q <= (W2 = Y2[V2]) && W2 <= re && te[i(R2, W2, 0, z)].push(L2[V2]);
            return te;
          }
          return O2.value = function(L2) {
            return arguments.length ? (N2 = typeof L2 == "function" ? L2 : g(L2), O2) : N2;
          }, O2.domain = function(L2) {
            return arguments.length ? (D2 = typeof L2 == "function" ? L2 : g([L2[0], L2[1]]), O2) : D2;
          }, O2.thresholds = function(L2) {
            return arguments.length ? (I2 = typeof L2 == "function" ? L2 : Array.isArray(L2) ? g(v.call(L2)) : g(L2), O2) : I2;
          }, O2;
        }, n.thresholdFreedmanDiaconis = function(N2, D2, I2) {
          return N2 = m.call(N2, c).sort(a), Math.ceil((I2 - D2) / (2 * (S2(N2, 0.75) - S2(N2, 0.25)) * Math.pow(N2.length, -1 / 3)));
        }, n.thresholdScott = function(N2, D2, I2) {
          return Math.ceil((I2 - D2) / (3.5 * h(N2) * Math.pow(N2.length, -1 / 3)));
        }, n.thresholdSturges = A2, n.max = function(N2, D2) {
          var I2, O2, L2 = N2.length, V2 = -1;
          if (D2 == null) {
            for (; ++V2 < L2; ) if ((I2 = N2[V2]) != null && I2 >= I2) for (O2 = I2; ++V2 < L2; ) (I2 = N2[V2]) != null && I2 > O2 && (O2 = I2);
          } else for (; ++V2 < L2; ) if ((I2 = D2(N2[V2], V2, N2)) != null && I2 >= I2) for (O2 = I2; ++V2 < L2; ) (I2 = D2(N2[V2], V2, N2)) != null && I2 > O2 && (O2 = I2);
          return O2;
        }, n.mean = function(N2, D2) {
          var I2, O2 = N2.length, L2 = O2, V2 = -1, W2 = 0;
          if (D2 == null) for (; ++V2 < O2; ) isNaN(I2 = c(N2[V2])) ? --L2 : W2 += I2;
          else for (; ++V2 < O2; ) isNaN(I2 = c(D2(N2[V2], V2, N2))) ? --L2 : W2 += I2;
          if (L2) return W2 / L2;
        }, n.median = function(N2, D2) {
          var I2, O2 = N2.length, L2 = -1, V2 = [];
          if (D2 == null) for (; ++L2 < O2; ) isNaN(I2 = c(N2[L2])) || V2.push(I2);
          else for (; ++L2 < O2; ) isNaN(I2 = c(D2(N2[L2], L2, N2))) || V2.push(I2);
          return S2(V2.sort(a), 0.5);
        }, n.merge = function(N2) {
          for (var D2, I2, O2, L2 = N2.length, V2 = -1, W2 = 0; ++V2 < L2; ) W2 += N2[V2].length;
          for (I2 = new Array(W2); --L2 >= 0; ) for (D2 = (O2 = N2[L2]).length; --D2 >= 0; ) I2[--W2] = O2[D2];
          return I2;
        }, n.min = C2, n.pairs = function(N2, D2) {
          D2 == null && (D2 = u2);
          for (var I2 = 0, O2 = N2.length - 1, L2 = N2[0], V2 = new Array(O2 < 0 ? 0 : O2); I2 < O2; ) V2[I2] = D2(L2, L2 = N2[++I2]);
          return V2;
        }, n.permute = function(N2, D2) {
          for (var I2 = D2.length, O2 = new Array(I2); I2--; ) O2[I2] = N2[D2[I2]];
          return O2;
        }, n.quantile = S2, n.range = b, n.scan = function(N2, D2) {
          if (I2 = N2.length) {
            var I2, O2, L2 = 0, V2 = 0, W2 = N2[V2];
            for (D2 == null && (D2 = a); ++L2 < I2; ) (D2(O2 = N2[L2], W2) < 0 || D2(W2, W2) !== 0) && (W2 = O2, V2 = L2);
            return D2(W2, W2) === 0 ? V2 : void 0;
          }
        }, n.shuffle = function(N2, D2, I2) {
          for (var O2, L2, V2 = (I2 ?? N2.length) - (D2 = D2 == null ? 0 : +D2); V2; ) L2 = Math.random() * V2-- | 0, O2 = N2[V2 + D2], N2[V2 + D2] = N2[L2 + D2], N2[L2 + D2] = O2;
          return N2;
        }, n.sum = function(N2, D2) {
          var I2, O2 = N2.length, L2 = -1, V2 = 0;
          if (D2 == null) for (; ++L2 < O2; ) (I2 = +N2[L2]) && (V2 += I2);
          else for (; ++L2 < O2; ) (I2 = +D2(N2[L2], L2, N2)) && (V2 += I2);
          return V2;
        }, n.ticks = function(N2, D2, I2) {
          var O2, L2, V2, W2, X2 = -1;
          if (I2 = +I2, (N2 = +N2) == (D2 = +D2) && I2 > 0) return [N2];
          if ((O2 = D2 < N2) && (L2 = N2, N2 = D2, D2 = L2), (W2 = k(N2, D2, I2)) === 0 || !isFinite(W2)) return [];
          if (W2 > 0) for (N2 = Math.ceil(N2 / W2), D2 = Math.floor(D2 / W2), V2 = new Array(L2 = Math.ceil(D2 - N2 + 1)); ++X2 < L2; ) V2[X2] = (N2 + X2) * W2;
          else for (N2 = Math.floor(N2 * W2), D2 = Math.ceil(D2 * W2), V2 = new Array(L2 = Math.ceil(N2 - D2 + 1)); ++X2 < L2; ) V2[X2] = (N2 - X2) / W2;
          return O2 && V2.reverse(), V2;
        }, n.tickIncrement = k, n.tickStep = T2, n.transpose = E2, n.variance = f, n.zip = function() {
          return E2(arguments);
        }, Object.defineProperty(n, "__esModule", { value: true });
      });
    }, {}], 108: [function(e, t, r) {
      (function(n, a) {
        a(typeof r == "object" && t !== void 0 ? r : n.d3 = n.d3 || {});
      })(this, function(n) {
        "use strict";
        function a() {
        }
        function o(p, d) {
          var v = new a();
          if (p instanceof a) p.each(function(y, w) {
            v.set(w, y);
          });
          else if (Array.isArray(p)) {
            var m, g = -1, x = p.length;
            if (d == null) for (; ++g < x; ) v.set(g, p[g]);
            else for (; ++g < x; ) v.set(d(m = p[g], g, p), m);
          } else if (p) for (var b in p) v.set(b, p[b]);
          return v;
        }
        function s() {
          return {};
        }
        function i(p, d, v) {
          p[d] = v;
        }
        function l() {
          return o();
        }
        function u2(p, d, v) {
          p.set(d, v);
        }
        function c() {
        }
        a.prototype = o.prototype = { constructor: a, has: function(p) {
          return "$" + p in this;
        }, get: function(p) {
          return this["$" + p];
        }, set: function(p, d) {
          return this["$" + p] = d, this;
        }, remove: function(p) {
          var d = "$" + p;
          return d in this && delete this[d];
        }, clear: function() {
          for (var p in this) p[0] === "$" && delete this[p];
        }, keys: function() {
          var p = [];
          for (var d in this) d[0] === "$" && p.push(d.slice(1));
          return p;
        }, values: function() {
          var p = [];
          for (var d in this) d[0] === "$" && p.push(this[d]);
          return p;
        }, entries: function() {
          var p = [];
          for (var d in this) d[0] === "$" && p.push({ key: d.slice(1), value: this[d] });
          return p;
        }, size: function() {
          var p = 0;
          for (var d in this) d[0] === "$" && ++p;
          return p;
        }, empty: function() {
          for (var p in this) if (p[0] === "$") return false;
          return true;
        }, each: function(p) {
          for (var d in this) d[0] === "$" && p(this[d], d.slice(1), this);
        } };
        var f = o.prototype;
        function h(p, d) {
          var v = new c();
          if (p instanceof c) p.each(function(x) {
            v.add(x);
          });
          else if (p) {
            var m = -1, g = p.length;
            if (d == null) for (; ++m < g; ) v.add(p[m]);
            else for (; ++m < g; ) v.add(d(p[m], m, p));
          }
          return v;
        }
        c.prototype = h.prototype = { constructor: c, has: f.has, add: function(p) {
          return this["$" + (p += "")] = p, this;
        }, remove: f.remove, clear: f.clear, values: f.keys, size: f.size, empty: f.empty, each: f.each }, n.nest = function() {
          var p, d, v, m = [], g = [];
          function x(b, y, w, _4) {
            if (y >= m.length) return p != null && b.sort(p), d != null ? d(b) : b;
            for (var k, T2, A2, S2 = -1, C2 = b.length, E2 = m[y++], F13 = o(), N2 = w(); ++S2 < C2; ) (A2 = F13.get(k = E2(T2 = b[S2]) + "")) ? A2.push(T2) : F13.set(k, [T2]);
            return F13.each(function(D2, I2) {
              _4(N2, I2, x(D2, y, w, _4));
            }), N2;
          }
          return v = { object: function(b) {
            return x(b, 0, s, i);
          }, map: function(b) {
            return x(b, 0, l, u2);
          }, entries: function(b) {
            return function y(w, _4) {
              if (++_4 > m.length) return w;
              var k, T2 = g[_4 - 1];
              return d != null && _4 >= m.length ? k = w.entries() : (k = [], w.each(function(A2, S2) {
                k.push({ key: S2, values: y(A2, _4) });
              })), T2 != null ? k.sort(function(A2, S2) {
                return T2(A2.key, S2.key);
              }) : k;
            }(x(b, 0, l, u2), 0);
          }, key: function(b) {
            return m.push(b), v;
          }, sortKeys: function(b) {
            return g[m.length - 1] = b, v;
          }, sortValues: function(b) {
            return p = b, v;
          }, rollup: function(b) {
            return d = b, v;
          } };
        }, n.set = h, n.map = o, n.keys = function(p) {
          var d = [];
          for (var v in p) d.push(v);
          return d;
        }, n.values = function(p) {
          var d = [];
          for (var v in p) d.push(p[v]);
          return d;
        }, n.entries = function(p) {
          var d = [];
          for (var v in p) d.push({ key: v, value: p[v] });
          return d;
        }, Object.defineProperty(n, "__esModule", { value: true });
      });
    }, {}], 109: [function(e, t, r) {
      (function(n, a) {
        a(typeof r == "object" && t !== void 0 ? r : (n = n || self).d3 = n.d3 || {});
      })(this, function(n) {
        "use strict";
        function a(pe, ve, Ee) {
          pe.prototype = ve.prototype = Ee, Ee.constructor = pe;
        }
        function o(pe, ve) {
          var Ee = Object.create(pe.prototype);
          for (var Se in ve) Ee[Se] = ve[Se];
          return Ee;
        }
        function s() {
        }
        var i = "\\s*([+-]?\\d+)\\s*", l = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*", u2 = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*", c = /^#([0-9a-f]{3,8})$/, f = new RegExp("^rgb\\(" + [i, i, i] + "\\)$"), h = new RegExp("^rgb\\(" + [u2, u2, u2] + "\\)$"), p = new RegExp("^rgba\\(" + [i, i, i, l] + "\\)$"), d = new RegExp("^rgba\\(" + [u2, u2, u2, l] + "\\)$"), v = new RegExp("^hsl\\(" + [l, u2, u2] + "\\)$"), m = new RegExp("^hsla\\(" + [l, u2, u2, l] + "\\)$"), g = { aliceblue: 15792383, antiquewhite: 16444375, aqua: 65535, aquamarine: 8388564, azure: 15794175, beige: 16119260, bisque: 16770244, black: 0, blanchedalmond: 16772045, blue: 255, blueviolet: 9055202, brown: 10824234, burlywood: 14596231, cadetblue: 6266528, chartreuse: 8388352, chocolate: 13789470, coral: 16744272, cornflowerblue: 6591981, cornsilk: 16775388, crimson: 14423100, cyan: 65535, darkblue: 139, darkcyan: 35723, darkgoldenrod: 12092939, darkgray: 11119017, darkgreen: 25600, darkgrey: 11119017, darkkhaki: 12433259, darkmagenta: 9109643, darkolivegreen: 5597999, darkorange: 16747520, darkorchid: 10040012, darkred: 9109504, darksalmon: 15308410, darkseagreen: 9419919, darkslateblue: 4734347, darkslategray: 3100495, darkslategrey: 3100495, darkturquoise: 52945, darkviolet: 9699539, deeppink: 16716947, deepskyblue: 49151, dimgray: 6908265, dimgrey: 6908265, dodgerblue: 2003199, firebrick: 11674146, floralwhite: 16775920, forestgreen: 2263842, fuchsia: 16711935, gainsboro: 14474460, ghostwhite: 16316671, gold: 16766720, goldenrod: 14329120, gray: 8421504, green: 32768, greenyellow: 11403055, grey: 8421504, honeydew: 15794160, hotpink: 16738740, indianred: 13458524, indigo: 4915330, ivory: 16777200, khaki: 15787660, lavender: 15132410, lavenderblush: 16773365, lawngreen: 8190976, lemonchiffon: 16775885, lightblue: 11393254, lightcoral: 15761536, lightcyan: 14745599, lightgoldenrodyellow: 16448210, lightgray: 13882323, lightgreen: 9498256, lightgrey: 13882323, lightpink: 16758465, lightsalmon: 16752762, lightseagreen: 2142890, lightskyblue: 8900346, lightslategray: 7833753, lightslategrey: 7833753, lightsteelblue: 11584734, lightyellow: 16777184, lime: 65280, limegreen: 3329330, linen: 16445670, magenta: 16711935, maroon: 8388608, mediumaquamarine: 6737322, mediumblue: 205, mediumorchid: 12211667, mediumpurple: 9662683, mediumseagreen: 3978097, mediumslateblue: 8087790, mediumspringgreen: 64154, mediumturquoise: 4772300, mediumvioletred: 13047173, midnightblue: 1644912, mintcream: 16121850, mistyrose: 16770273, moccasin: 16770229, navajowhite: 16768685, navy: 128, oldlace: 16643558, olive: 8421376, olivedrab: 7048739, orange: 16753920, orangered: 16729344, orchid: 14315734, palegoldenrod: 15657130, palegreen: 10025880, paleturquoise: 11529966, palevioletred: 14381203, papayawhip: 16773077, peachpuff: 16767673, peru: 13468991, pink: 16761035, plum: 14524637, powderblue: 11591910, purple: 8388736, rebeccapurple: 6697881, red: 16711680, rosybrown: 12357519, royalblue: 4286945, saddlebrown: 9127187, salmon: 16416882, sandybrown: 16032864, seagreen: 3050327, seashell: 16774638, sienna: 10506797, silver: 12632256, skyblue: 8900331, slateblue: 6970061, slategray: 7372944, slategrey: 7372944, snow: 16775930, springgreen: 65407, steelblue: 4620980, tan: 13808780, teal: 32896, thistle: 14204888, tomato: 16737095, turquoise: 4251856, violet: 15631086, wheat: 16113331, white: 16777215, whitesmoke: 16119285, yellow: 16776960, yellowgreen: 10145074 };
        function x() {
          return this.rgb().formatHex();
        }
        function b() {
          return this.rgb().formatRgb();
        }
        function y(pe) {
          var ve, Ee;
          return pe = (pe + "").trim().toLowerCase(), (ve = c.exec(pe)) ? (Ee = ve[1].length, ve = parseInt(ve[1], 16), Ee === 6 ? w(ve) : Ee === 3 ? new A2(ve >> 8 & 15 | ve >> 4 & 240, ve >> 4 & 15 | 240 & ve, (15 & ve) << 4 | 15 & ve, 1) : Ee === 8 ? _4(ve >> 24 & 255, ve >> 16 & 255, ve >> 8 & 255, (255 & ve) / 255) : Ee === 4 ? _4(ve >> 12 & 15 | ve >> 8 & 240, ve >> 8 & 15 | ve >> 4 & 240, ve >> 4 & 15 | 240 & ve, ((15 & ve) << 4 | 15 & ve) / 255) : null) : (ve = f.exec(pe)) ? new A2(ve[1], ve[2], ve[3], 1) : (ve = h.exec(pe)) ? new A2(255 * ve[1] / 100, 255 * ve[2] / 100, 255 * ve[3] / 100, 1) : (ve = p.exec(pe)) ? _4(ve[1], ve[2], ve[3], ve[4]) : (ve = d.exec(pe)) ? _4(255 * ve[1] / 100, 255 * ve[2] / 100, 255 * ve[3] / 100, ve[4]) : (ve = v.exec(pe)) ? F13(ve[1], ve[2] / 100, ve[3] / 100, 1) : (ve = m.exec(pe)) ? F13(ve[1], ve[2] / 100, ve[3] / 100, ve[4]) : g.hasOwnProperty(pe) ? w(g[pe]) : pe === "transparent" ? new A2(NaN, NaN, NaN, 0) : null;
        }
        function w(pe) {
          return new A2(pe >> 16 & 255, pe >> 8 & 255, 255 & pe, 1);
        }
        function _4(pe, ve, Ee, Se) {
          return Se <= 0 && (pe = ve = Ee = NaN), new A2(pe, ve, Ee, Se);
        }
        function k(pe) {
          return pe instanceof s || (pe = y(pe)), pe ? new A2((pe = pe.rgb()).r, pe.g, pe.b, pe.opacity) : new A2();
        }
        function T2(pe, ve, Ee, Se) {
          return arguments.length === 1 ? k(pe) : new A2(pe, ve, Ee, Se ?? 1);
        }
        function A2(pe, ve, Ee, Se) {
          this.r = +pe, this.g = +ve, this.b = +Ee, this.opacity = +Se;
        }
        function S2() {
          return "#" + E2(this.r) + E2(this.g) + E2(this.b);
        }
        function C2() {
          var pe = this.opacity;
          return ((pe = isNaN(pe) ? 1 : Math.max(0, Math.min(1, pe))) === 1 ? "rgb(" : "rgba(") + Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", " + Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", " + Math.max(0, Math.min(255, Math.round(this.b) || 0)) + (pe === 1 ? ")" : ", " + pe + ")");
        }
        function E2(pe) {
          return ((pe = Math.max(0, Math.min(255, Math.round(pe) || 0))) < 16 ? "0" : "") + pe.toString(16);
        }
        function F13(pe, ve, Ee, Se) {
          return Se <= 0 ? pe = ve = Ee = NaN : Ee <= 0 || Ee >= 1 ? pe = ve = NaN : ve <= 0 && (pe = NaN), new I2(pe, ve, Ee, Se);
        }
        function N2(pe) {
          if (pe instanceof I2) return new I2(pe.h, pe.s, pe.l, pe.opacity);
          if (pe instanceof s || (pe = y(pe)), !pe) return new I2();
          if (pe instanceof I2) return pe;
          var ve = (pe = pe.rgb()).r / 255, Ee = pe.g / 255, Se = pe.b / 255, Ce = Math.min(ve, Ee, Se), Be = Math.max(ve, Ee, Se), Ue = NaN, Ke = Be - Ce, ct = (Be + Ce) / 2;
          return Ke ? (Ue = ve === Be ? (Ee - Se) / Ke + 6 * (Ee < Se) : Ee === Be ? (Se - ve) / Ke + 2 : (ve - Ee) / Ke + 4, Ke /= ct < 0.5 ? Be + Ce : 2 - Be - Ce, Ue *= 60) : Ke = ct > 0 && ct < 1 ? 0 : Ue, new I2(Ue, Ke, ct, pe.opacity);
        }
        function D2(pe, ve, Ee, Se) {
          return arguments.length === 1 ? N2(pe) : new I2(pe, ve, Ee, Se ?? 1);
        }
        function I2(pe, ve, Ee, Se) {
          this.h = +pe, this.s = +ve, this.l = +Ee, this.opacity = +Se;
        }
        function O2(pe, ve, Ee) {
          return 255 * (pe < 60 ? ve + (Ee - ve) * pe / 60 : pe < 180 ? Ee : pe < 240 ? ve + (Ee - ve) * (240 - pe) / 60 : ve);
        }
        a(s, y, { copy: function(pe) {
          return Object.assign(new this.constructor(), this, pe);
        }, displayable: function() {
          return this.rgb().displayable();
        }, hex: x, formatHex: x, formatHsl: function() {
          return N2(this).formatHsl();
        }, formatRgb: b, toString: b }), a(A2, T2, o(s, { brighter: function(pe) {
          return pe = pe == null ? 1 / 0.7 : Math.pow(1 / 0.7, pe), new A2(this.r * pe, this.g * pe, this.b * pe, this.opacity);
        }, darker: function(pe) {
          return pe = pe == null ? 0.7 : Math.pow(0.7, pe), new A2(this.r * pe, this.g * pe, this.b * pe, this.opacity);
        }, rgb: function() {
          return this;
        }, displayable: function() {
          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;
        }, hex: S2, formatHex: S2, formatRgb: C2, toString: C2 })), a(I2, D2, o(s, { brighter: function(pe) {
          return pe = pe == null ? 1 / 0.7 : Math.pow(1 / 0.7, pe), new I2(this.h, this.s, this.l * pe, this.opacity);
        }, darker: function(pe) {
          return pe = pe == null ? 0.7 : Math.pow(0.7, pe), new I2(this.h, this.s, this.l * pe, this.opacity);
        }, rgb: function() {
          var pe = this.h % 360 + 360 * (this.h < 0), ve = isNaN(pe) || isNaN(this.s) ? 0 : this.s, Ee = this.l, Se = Ee + (Ee < 0.5 ? Ee : 1 - Ee) * ve, Ce = 2 * Ee - Se;
          return new A2(O2(pe >= 240 ? pe - 240 : pe + 120, Ce, Se), O2(pe, Ce, Se), O2(pe < 120 ? pe + 240 : pe - 120, Ce, Se), this.opacity);
        }, displayable: function() {
          return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && 0 <= this.l && this.l <= 1 && 0 <= this.opacity && this.opacity <= 1;
        }, formatHsl: function() {
          var pe = this.opacity;
          return ((pe = isNaN(pe) ? 1 : Math.max(0, Math.min(1, pe))) === 1 ? "hsl(" : "hsla(") + (this.h || 0) + ", " + 100 * (this.s || 0) + "%, " + 100 * (this.l || 0) + "%" + (pe === 1 ? ")" : ", " + pe + ")");
        } }));
        var L2 = Math.PI / 180, V2 = 180 / Math.PI, W2 = 6 / 29, X2 = 3 * W2 * W2;
        function Y2(pe) {
          if (pe instanceof q) return new q(pe.l, pe.a, pe.b, pe.opacity);
          if (pe instanceof Q2) return Z2(pe);
          pe instanceof A2 || (pe = k(pe));
          var ve, Ee, Se = H2(pe.r), Ce = H2(pe.g), Be = H2(pe.b), Ue = re((0.2225045 * Se + 0.7168786 * Ce + 0.0606169 * Be) / 1);
          return Se === Ce && Ce === Be ? ve = Ee = Ue : (ve = re((0.4360747 * Se + 0.3850649 * Ce + 0.1430804 * Be) / 0.96422), Ee = re((0.0139322 * Se + 0.0971045 * Ce + 0.7141733 * Be) / 0.82521)), new q(116 * Ue - 16, 500 * (ve - Ue), 200 * (Ue - Ee), pe.opacity);
        }
        function K2(pe, ve, Ee, Se) {
          return arguments.length === 1 ? Y2(pe) : new q(pe, ve, Ee, Se ?? 1);
        }
        function q(pe, ve, Ee, Se) {
          this.l = +pe, this.a = +ve, this.b = +Ee, this.opacity = +Se;
        }
        function re(pe) {
          return pe > 0.008856451679035631 ? Math.pow(pe, 1 / 3) : pe / X2 + 4 / 29;
        }
        function R2(pe) {
          return pe > W2 ? pe * pe * pe : X2 * (pe - 4 / 29);
        }
        function z(pe) {
          return 255 * (pe <= 31308e-7 ? 12.92 * pe : 1.055 * Math.pow(pe, 1 / 2.4) - 0.055);
        }
        function H2(pe) {
          return (pe /= 255) <= 0.04045 ? pe / 12.92 : Math.pow((pe + 0.055) / 1.055, 2.4);
        }
        function te(pe) {
          if (pe instanceof Q2) return new Q2(pe.h, pe.c, pe.l, pe.opacity);
          if (pe instanceof q || (pe = Y2(pe)), pe.a === 0 && pe.b === 0) return new Q2(NaN, 0 < pe.l && pe.l < 100 ? 0 : NaN, pe.l, pe.opacity);
          var ve = Math.atan2(pe.b, pe.a) * V2;
          return new Q2(ve < 0 ? ve + 360 : ve, Math.sqrt(pe.a * pe.a + pe.b * pe.b), pe.l, pe.opacity);
        }
        function j(pe, ve, Ee, Se) {
          return arguments.length === 1 ? te(pe) : new Q2(pe, ve, Ee, Se ?? 1);
        }
        function Q2(pe, ve, Ee, Se) {
          this.h = +pe, this.c = +ve, this.l = +Ee, this.opacity = +Se;
        }
        function Z2(pe) {
          if (isNaN(pe.h)) return new q(pe.l, 0, 0, pe.opacity);
          var ve = pe.h * L2;
          return new q(pe.l, Math.cos(ve) * pe.c, Math.sin(ve) * pe.c, pe.opacity);
        }
        a(q, K2, o(s, { brighter: function(pe) {
          return new q(this.l + 18 * (pe ?? 1), this.a, this.b, this.opacity);
        }, darker: function(pe) {
          return new q(this.l - 18 * (pe ?? 1), this.a, this.b, this.opacity);
        }, rgb: function() {
          var pe = (this.l + 16) / 116, ve = isNaN(this.a) ? pe : pe + this.a / 500, Ee = isNaN(this.b) ? pe : pe - this.b / 200;
          return new A2(z(3.1338561 * (ve = 0.96422 * R2(ve)) - 1.6168667 * (pe = 1 * R2(pe)) - 0.4906146 * (Ee = 0.82521 * R2(Ee))), z(-0.9787684 * ve + 1.9161415 * pe + 0.033454 * Ee), z(0.0719453 * ve - 0.2289914 * pe + 1.4052427 * Ee), this.opacity);
        } })), a(Q2, j, o(s, { brighter: function(pe) {
          return new Q2(this.h, this.c, this.l + 18 * (pe ?? 1), this.opacity);
        }, darker: function(pe) {
          return new Q2(this.h, this.c, this.l - 18 * (pe ?? 1), this.opacity);
        }, rgb: function() {
          return Z2(this).rgb();
        } }));
        var ne = -0.14861, ae = 1.78277, ue = -0.29227, le = -0.90649, ce = 1.97294, se = ce * le, he = ce * ae, me = ae * ue - le * ne;
        function we(pe) {
          if (pe instanceof Ae) return new Ae(pe.h, pe.s, pe.l, pe.opacity);
          pe instanceof A2 || (pe = k(pe));
          var ve = pe.r / 255, Ee = pe.g / 255, Se = pe.b / 255, Ce = (me * Se + se * ve - he * Ee) / (me + se - he), Be = Se - Ce, Ue = (ce * (Ee - Ce) - ue * Be) / le, Ke = Math.sqrt(Ue * Ue + Be * Be) / (ce * Ce * (1 - Ce)), ct = Ke ? Math.atan2(Ue, Be) * V2 - 120 : NaN;
          return new Ae(ct < 0 ? ct + 360 : ct, Ke, Ce, pe.opacity);
        }
        function be(pe, ve, Ee, Se) {
          return arguments.length === 1 ? we(pe) : new Ae(pe, ve, Ee, Se ?? 1);
        }
        function Ae(pe, ve, Ee, Se) {
          this.h = +pe, this.s = +ve, this.l = +Ee, this.opacity = +Se;
        }
        a(Ae, be, o(s, { brighter: function(pe) {
          return pe = pe == null ? 1 / 0.7 : Math.pow(1 / 0.7, pe), new Ae(this.h, this.s, this.l * pe, this.opacity);
        }, darker: function(pe) {
          return pe = pe == null ? 0.7 : Math.pow(0.7, pe), new Ae(this.h, this.s, this.l * pe, this.opacity);
        }, rgb: function() {
          var pe = isNaN(this.h) ? 0 : (this.h + 120) * L2, ve = +this.l, Ee = isNaN(this.s) ? 0 : this.s * ve * (1 - ve), Se = Math.cos(pe), Ce = Math.sin(pe);
          return new A2(255 * (ve + Ee * (ne * Se + ae * Ce)), 255 * (ve + Ee * (ue * Se + le * Ce)), 255 * (ve + Ee * (ce * Se)), this.opacity);
        } })), n.color = y, n.cubehelix = be, n.gray = function(pe, ve) {
          return new q(pe, 0, 0, ve ?? 1);
        }, n.hcl = j, n.hsl = D2, n.lab = K2, n.lch = function(pe, ve, Ee, Se) {
          return arguments.length === 1 ? te(pe) : new Q2(Ee, ve, pe, Se ?? 1);
        }, n.rgb = T2, Object.defineProperty(n, "__esModule", { value: true });
      });
    }, {}], 110: [function(e, t, r) {
      (function(n, a) {
        a(typeof r == "object" && t !== void 0 ? r : (n = n || self).d3 = n.d3 || {});
      })(this, function(n) {
        "use strict";
        var a = { value: function() {
        } };
        function o() {
          for (var c, f = 0, h = arguments.length, p = {}; f < h; ++f) {
            if (!(c = arguments[f] + "") || c in p || /[\s.]/.test(c)) throw new Error("illegal type: " + c);
            p[c] = [];
          }
          return new s(p);
        }
        function s(c) {
          this._ = c;
        }
        function i(c, f) {
          return c.trim().split(/^|\s+/).map(function(h) {
            var p = "", d = h.indexOf(".");
            if (d >= 0 && (p = h.slice(d + 1), h = h.slice(0, d)), h && !f.hasOwnProperty(h)) throw new Error("unknown type: " + h);
            return { type: h, name: p };
          });
        }
        function l(c, f) {
          for (var h, p = 0, d = c.length; p < d; ++p) if ((h = c[p]).name === f) return h.value;
        }
        function u2(c, f, h) {
          for (var p = 0, d = c.length; p < d; ++p) if (c[p].name === f) {
            c[p] = a, c = c.slice(0, p).concat(c.slice(p + 1));
            break;
          }
          return h != null && c.push({ name: f, value: h }), c;
        }
        s.prototype = o.prototype = { constructor: s, on: function(c, f) {
          var h, p = this._, d = i(c + "", p), v = -1, m = d.length;
          if (!(arguments.length < 2)) {
            if (f != null && typeof f != "function") throw new Error("invalid callback: " + f);
            for (; ++v < m; ) if (h = (c = d[v]).type) p[h] = u2(p[h], c.name, f);
            else if (f == null) for (h in p) p[h] = u2(p[h], c.name, null);
            return this;
          }
          for (; ++v < m; ) if ((h = (c = d[v]).type) && (h = l(p[h], c.name))) return h;
        }, copy: function() {
          var c = {}, f = this._;
          for (var h in f) c[h] = f[h].slice();
          return new s(c);
        }, call: function(c, f) {
          if ((h = arguments.length - 2) > 0) for (var h, p, d = new Array(h), v = 0; v < h; ++v) d[v] = arguments[v + 2];
          if (!this._.hasOwnProperty(c)) throw new Error("unknown type: " + c);
          for (v = 0, h = (p = this._[c]).length; v < h; ++v) p[v].value.apply(f, d);
        }, apply: function(c, f, h) {
          if (!this._.hasOwnProperty(c)) throw new Error("unknown type: " + c);
          for (var p = this._[c], d = 0, v = p.length; d < v; ++d) p[d].value.apply(f, h);
        } }, n.dispatch = o, Object.defineProperty(n, "__esModule", { value: true });
      });
    }, {}], 111: [function(e, t, r) {
      (function(n, a) {
        typeof r == "object" && t !== void 0 ? a(r, e("d3-quadtree"), e("d3-collection"), e("d3-dispatch"), e("d3-timer")) : a(n.d3 = n.d3 || {}, n.d3, n.d3, n.d3, n.d3);
      })(this, function(n, a, o, s, i) {
        "use strict";
        function l(g) {
          return function() {
            return g;
          };
        }
        function u2() {
          return 1e-6 * (Math.random() - 0.5);
        }
        function c(g) {
          return g.x + g.vx;
        }
        function f(g) {
          return g.y + g.vy;
        }
        function h(g) {
          return g.index;
        }
        function p(g, x) {
          var b = g.get(x);
          if (!b) throw new Error("missing: " + x);
          return b;
        }
        function d(g) {
          return g.x;
        }
        function v(g) {
          return g.y;
        }
        var m = Math.PI * (3 - Math.sqrt(5));
        n.forceCenter = function(g, x) {
          var b;
          function y() {
            var w, _4, k = b.length, T2 = 0, A2 = 0;
            for (w = 0; w < k; ++w) T2 += (_4 = b[w]).x, A2 += _4.y;
            for (T2 = T2 / k - g, A2 = A2 / k - x, w = 0; w < k; ++w) (_4 = b[w]).x -= T2, _4.y -= A2;
          }
          return g == null && (g = 0), x == null && (x = 0), y.initialize = function(w) {
            b = w;
          }, y.x = function(w) {
            return arguments.length ? (g = +w, y) : g;
          }, y.y = function(w) {
            return arguments.length ? (x = +w, y) : x;
          }, y;
        }, n.forceCollide = function(g) {
          var x, b, y = 1, w = 1;
          function _4() {
            for (var A2, S2, C2, E2, F13, N2, D2, I2 = x.length, O2 = 0; O2 < w; ++O2) for (S2 = a.quadtree(x, c, f).visitAfter(k), A2 = 0; A2 < I2; ++A2) C2 = x[A2], N2 = b[C2.index], D2 = N2 * N2, E2 = C2.x + C2.vx, F13 = C2.y + C2.vy, S2.visit(L2);
            function L2(V2, W2, X2, Y2, K2) {
              var q = V2.data, re = V2.r, R2 = N2 + re;
              if (!q) return W2 > E2 + R2 || Y2 < E2 - R2 || X2 > F13 + R2 || K2 < F13 - R2;
              if (q.index > C2.index) {
                var z = E2 - q.x - q.vx, H2 = F13 - q.y - q.vy, te = z * z + H2 * H2;
                te < R2 * R2 && (z === 0 && (te += (z = u2()) * z), H2 === 0 && (te += (H2 = u2()) * H2), te = (R2 - (te = Math.sqrt(te))) / te * y, C2.vx += (z *= te) * (R2 = (re *= re) / (D2 + re)), C2.vy += (H2 *= te) * R2, q.vx -= z * (R2 = 1 - R2), q.vy -= H2 * R2);
              }
            }
          }
          function k(A2) {
            if (A2.data) return A2.r = b[A2.data.index];
            for (var S2 = A2.r = 0; S2 < 4; ++S2) A2[S2] && A2[S2].r > A2.r && (A2.r = A2[S2].r);
          }
          function T2() {
            if (x) {
              var A2, S2, C2 = x.length;
              for (b = new Array(C2), A2 = 0; A2 < C2; ++A2) S2 = x[A2], b[S2.index] = +g(S2, A2, x);
            }
          }
          return typeof g != "function" && (g = l(g == null ? 1 : +g)), _4.initialize = function(A2) {
            x = A2, T2();
          }, _4.iterations = function(A2) {
            return arguments.length ? (w = +A2, _4) : w;
          }, _4.strength = function(A2) {
            return arguments.length ? (y = +A2, _4) : y;
          }, _4.radius = function(A2) {
            return arguments.length ? (g = typeof A2 == "function" ? A2 : l(+A2), T2(), _4) : g;
          }, _4;
        }, n.forceLink = function(g) {
          var x, b, y, w, _4, k = h, T2 = function(D2) {
            return 1 / Math.min(w[D2.source.index], w[D2.target.index]);
          }, A2 = l(30), S2 = 1;
          function C2(D2) {
            for (var I2 = 0, O2 = g.length; I2 < S2; ++I2) for (var L2, V2, W2, X2, Y2, K2, q, re = 0; re < O2; ++re) V2 = (L2 = g[re]).source, X2 = (W2 = L2.target).x + W2.vx - V2.x - V2.vx || u2(), Y2 = W2.y + W2.vy - V2.y - V2.vy || u2(), X2 *= K2 = ((K2 = Math.sqrt(X2 * X2 + Y2 * Y2)) - b[re]) / K2 * D2 * x[re], Y2 *= K2, W2.vx -= X2 * (q = _4[re]), W2.vy -= Y2 * q, V2.vx += X2 * (q = 1 - q), V2.vy += Y2 * q;
          }
          function E2() {
            if (y) {
              var D2, I2, O2 = y.length, L2 = g.length, V2 = o.map(y, k);
              for (D2 = 0, w = new Array(O2); D2 < L2; ++D2) (I2 = g[D2]).index = D2, typeof I2.source != "object" && (I2.source = p(V2, I2.source)), typeof I2.target != "object" && (I2.target = p(V2, I2.target)), w[I2.source.index] = (w[I2.source.index] || 0) + 1, w[I2.target.index] = (w[I2.target.index] || 0) + 1;
              for (D2 = 0, _4 = new Array(L2); D2 < L2; ++D2) I2 = g[D2], _4[D2] = w[I2.source.index] / (w[I2.source.index] + w[I2.target.index]);
              x = new Array(L2), F13(), b = new Array(L2), N2();
            }
          }
          function F13() {
            if (y) for (var D2 = 0, I2 = g.length; D2 < I2; ++D2) x[D2] = +T2(g[D2], D2, g);
          }
          function N2() {
            if (y) for (var D2 = 0, I2 = g.length; D2 < I2; ++D2) b[D2] = +A2(g[D2], D2, g);
          }
          return g == null && (g = []), C2.initialize = function(D2) {
            y = D2, E2();
          }, C2.links = function(D2) {
            return arguments.length ? (g = D2, E2(), C2) : g;
          }, C2.id = function(D2) {
            return arguments.length ? (k = D2, C2) : k;
          }, C2.iterations = function(D2) {
            return arguments.length ? (S2 = +D2, C2) : S2;
          }, C2.strength = function(D2) {
            return arguments.length ? (T2 = typeof D2 == "function" ? D2 : l(+D2), F13(), C2) : T2;
          }, C2.distance = function(D2) {
            return arguments.length ? (A2 = typeof D2 == "function" ? D2 : l(+D2), N2(), C2) : A2;
          }, C2;
        }, n.forceManyBody = function() {
          var g, x, b, y, w = l(-30), _4 = 1, k = 1 / 0, T2 = 0.81;
          function A2(F13) {
            var N2, D2 = g.length, I2 = a.quadtree(g, d, v).visitAfter(C2);
            for (b = F13, N2 = 0; N2 < D2; ++N2) x = g[N2], I2.visit(E2);
          }
          function S2() {
            if (g) {
              var F13, N2, D2 = g.length;
              for (y = new Array(D2), F13 = 0; F13 < D2; ++F13) N2 = g[F13], y[N2.index] = +w(N2, F13, g);
            }
          }
          function C2(F13) {
            var N2, D2, I2, O2, L2, V2 = 0, W2 = 0;
            if (F13.length) {
              for (I2 = O2 = L2 = 0; L2 < 4; ++L2) (N2 = F13[L2]) && (D2 = Math.abs(N2.value)) && (V2 += N2.value, W2 += D2, I2 += D2 * N2.x, O2 += D2 * N2.y);
              F13.x = I2 / W2, F13.y = O2 / W2;
            } else {
              (N2 = F13).x = N2.data.x, N2.y = N2.data.y;
              do
                V2 += y[N2.data.index];
              while (N2 = N2.next);
            }
            F13.value = V2;
          }
          function E2(F13, N2, D2, I2) {
            if (!F13.value) return true;
            var O2 = F13.x - x.x, L2 = F13.y - x.y, V2 = I2 - N2, W2 = O2 * O2 + L2 * L2;
            if (V2 * V2 / T2 < W2) return W2 < k && (O2 === 0 && (W2 += (O2 = u2()) * O2), L2 === 0 && (W2 += (L2 = u2()) * L2), W2 < _4 && (W2 = Math.sqrt(_4 * W2)), x.vx += O2 * F13.value * b / W2, x.vy += L2 * F13.value * b / W2), true;
            if (!(F13.length || W2 >= k)) {
              (F13.data !== x || F13.next) && (O2 === 0 && (W2 += (O2 = u2()) * O2), L2 === 0 && (W2 += (L2 = u2()) * L2), W2 < _4 && (W2 = Math.sqrt(_4 * W2)));
              do
                F13.data !== x && (V2 = y[F13.data.index] * b / W2, x.vx += O2 * V2, x.vy += L2 * V2);
              while (F13 = F13.next);
            }
          }
          return A2.initialize = function(F13) {
            g = F13, S2();
          }, A2.strength = function(F13) {
            return arguments.length ? (w = typeof F13 == "function" ? F13 : l(+F13), S2(), A2) : w;
          }, A2.distanceMin = function(F13) {
            return arguments.length ? (_4 = F13 * F13, A2) : Math.sqrt(_4);
          }, A2.distanceMax = function(F13) {
            return arguments.length ? (k = F13 * F13, A2) : Math.sqrt(k);
          }, A2.theta = function(F13) {
            return arguments.length ? (T2 = F13 * F13, A2) : Math.sqrt(T2);
          }, A2;
        }, n.forceRadial = function(g, x, b) {
          var y, w, _4, k = l(0.1);
          function T2(S2) {
            for (var C2 = 0, E2 = y.length; C2 < E2; ++C2) {
              var F13 = y[C2], N2 = F13.x - x || 1e-6, D2 = F13.y - b || 1e-6, I2 = Math.sqrt(N2 * N2 + D2 * D2), O2 = (_4[C2] - I2) * w[C2] * S2 / I2;
              F13.vx += N2 * O2, F13.vy += D2 * O2;
            }
          }
          function A2() {
            if (y) {
              var S2, C2 = y.length;
              for (w = new Array(C2), _4 = new Array(C2), S2 = 0; S2 < C2; ++S2) _4[S2] = +g(y[S2], S2, y), w[S2] = isNaN(_4[S2]) ? 0 : +k(y[S2], S2, y);
            }
          }
          return typeof g != "function" && (g = l(+g)), x == null && (x = 0), b == null && (b = 0), T2.initialize = function(S2) {
            y = S2, A2();
          }, T2.strength = function(S2) {
            return arguments.length ? (k = typeof S2 == "function" ? S2 : l(+S2), A2(), T2) : k;
          }, T2.radius = function(S2) {
            return arguments.length ? (g = typeof S2 == "function" ? S2 : l(+S2), A2(), T2) : g;
          }, T2.x = function(S2) {
            return arguments.length ? (x = +S2, T2) : x;
          }, T2.y = function(S2) {
            return arguments.length ? (b = +S2, T2) : b;
          }, T2;
        }, n.forceSimulation = function(g) {
          var x, b = 1, y = 1e-3, w = 1 - Math.pow(y, 1 / 300), _4 = 0, k = 0.6, T2 = o.map(), A2 = i.timer(C2), S2 = s.dispatch("tick", "end");
          function C2() {
            E2(), S2.call("tick", x), b < y && (A2.stop(), S2.call("end", x));
          }
          function E2(D2) {
            var I2, O2, L2 = g.length;
            D2 === void 0 && (D2 = 1);
            for (var V2 = 0; V2 < D2; ++V2) for (b += (_4 - b) * w, T2.each(function(W2) {
              W2(b);
            }), I2 = 0; I2 < L2; ++I2) (O2 = g[I2]).fx == null ? O2.x += O2.vx *= k : (O2.x = O2.fx, O2.vx = 0), O2.fy == null ? O2.y += O2.vy *= k : (O2.y = O2.fy, O2.vy = 0);
            return x;
          }
          function F13() {
            for (var D2, I2 = 0, O2 = g.length; I2 < O2; ++I2) {
              if ((D2 = g[I2]).index = I2, D2.fx != null && (D2.x = D2.fx), D2.fy != null && (D2.y = D2.fy), isNaN(D2.x) || isNaN(D2.y)) {
                var L2 = 10 * Math.sqrt(I2), V2 = I2 * m;
                D2.x = L2 * Math.cos(V2), D2.y = L2 * Math.sin(V2);
              }
              (isNaN(D2.vx) || isNaN(D2.vy)) && (D2.vx = D2.vy = 0);
            }
          }
          function N2(D2) {
            return D2.initialize && D2.initialize(g), D2;
          }
          return g == null && (g = []), F13(), x = { tick: E2, restart: function() {
            return A2.restart(C2), x;
          }, stop: function() {
            return A2.stop(), x;
          }, nodes: function(D2) {
            return arguments.length ? (g = D2, F13(), T2.each(N2), x) : g;
          }, alpha: function(D2) {
            return arguments.length ? (b = +D2, x) : b;
          }, alphaMin: function(D2) {
            return arguments.length ? (y = +D2, x) : y;
          }, alphaDecay: function(D2) {
            return arguments.length ? (w = +D2, x) : +w;
          }, alphaTarget: function(D2) {
            return arguments.length ? (_4 = +D2, x) : _4;
          }, velocityDecay: function(D2) {
            return arguments.length ? (k = 1 - D2, x) : 1 - k;
          }, force: function(D2, I2) {
            return arguments.length > 1 ? (I2 == null ? T2.remove(D2) : T2.set(D2, N2(I2)), x) : T2.get(D2);
          }, find: function(D2, I2, O2) {
            var L2, V2, W2, X2, Y2, K2 = 0, q = g.length;
            for (O2 == null ? O2 = 1 / 0 : O2 *= O2, K2 = 0; K2 < q; ++K2) (W2 = (L2 = D2 - (X2 = g[K2]).x) * L2 + (V2 = I2 - X2.y) * V2) < O2 && (Y2 = X2, O2 = W2);
            return Y2;
          }, on: function(D2, I2) {
            return arguments.length > 1 ? (S2.on(D2, I2), x) : S2.on(D2);
          } };
        }, n.forceX = function(g) {
          var x, b, y, w = l(0.1);
          function _4(T2) {
            for (var A2, S2 = 0, C2 = x.length; S2 < C2; ++S2) (A2 = x[S2]).vx += (y[S2] - A2.x) * b[S2] * T2;
          }
          function k() {
            if (x) {
              var T2, A2 = x.length;
              for (b = new Array(A2), y = new Array(A2), T2 = 0; T2 < A2; ++T2) b[T2] = isNaN(y[T2] = +g(x[T2], T2, x)) ? 0 : +w(x[T2], T2, x);
            }
          }
          return typeof g != "function" && (g = l(g == null ? 0 : +g)), _4.initialize = function(T2) {
            x = T2, k();
          }, _4.strength = function(T2) {
            return arguments.length ? (w = typeof T2 == "function" ? T2 : l(+T2), k(), _4) : w;
          }, _4.x = function(T2) {
            return arguments.length ? (g = typeof T2 == "function" ? T2 : l(+T2), k(), _4) : g;
          }, _4;
        }, n.forceY = function(g) {
          var x, b, y, w = l(0.1);
          function _4(T2) {
            for (var A2, S2 = 0, C2 = x.length; S2 < C2; ++S2) (A2 = x[S2]).vy += (y[S2] - A2.y) * b[S2] * T2;
          }
          function k() {
            if (x) {
              var T2, A2 = x.length;
              for (b = new Array(A2), y = new Array(A2), T2 = 0; T2 < A2; ++T2) b[T2] = isNaN(y[T2] = +g(x[T2], T2, x)) ? 0 : +w(x[T2], T2, x);
            }
          }
          return typeof g != "function" && (g = l(g == null ? 0 : +g)), _4.initialize = function(T2) {
            x = T2, k();
          }, _4.strength = function(T2) {
            return arguments.length ? (w = typeof T2 == "function" ? T2 : l(+T2), k(), _4) : w;
          }, _4.y = function(T2) {
            return arguments.length ? (g = typeof T2 == "function" ? T2 : l(+T2), k(), _4) : g;
          }, _4;
        }, Object.defineProperty(n, "__esModule", { value: true });
      });
    }, { "d3-collection": 108, "d3-dispatch": 110, "d3-quadtree": 118, "d3-timer": 123 }], 112: [function(e, t, r) {
      (function(n, a) {
        a(typeof r == "object" && t !== void 0 ? r : (n = typeof globalThis < "u" ? globalThis : n || self).d3 = n.d3 || {});
      })(this, function(n) {
        "use strict";
        function a(x, b) {
          if ((y = (x = b ? x.toExponential(b - 1) : x.toExponential()).indexOf("e")) < 0) return null;
          var y, w = x.slice(0, y);
          return [w.length > 1 ? w[0] + w.slice(2) : w, +x.slice(y + 1)];
        }
        function o(x) {
          return (x = a(Math.abs(x))) ? x[1] : NaN;
        }
        var s, i = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
        function l(x) {
          if (!(b = i.exec(x))) throw new Error("invalid format: " + x);
          var b;
          return new u2({ fill: b[1], align: b[2], sign: b[3], symbol: b[4], zero: b[5], width: b[6], comma: b[7], precision: b[8] && b[8].slice(1), trim: b[9], type: b[10] });
        }
        function u2(x) {
          this.fill = x.fill === void 0 ? " " : x.fill + "", this.align = x.align === void 0 ? ">" : x.align + "", this.sign = x.sign === void 0 ? "-" : x.sign + "", this.symbol = x.symbol === void 0 ? "" : x.symbol + "", this.zero = !!x.zero, this.width = x.width === void 0 ? void 0 : +x.width, this.comma = !!x.comma, this.precision = x.precision === void 0 ? void 0 : +x.precision, this.trim = !!x.trim, this.type = x.type === void 0 ? "" : x.type + "";
        }
        function c(x, b) {
          var y = a(x, b);
          if (!y) return x + "";
          var w = y[0], _4 = y[1];
          return _4 < 0 ? "0." + new Array(-_4).join("0") + w : w.length > _4 + 1 ? w.slice(0, _4 + 1) + "." + w.slice(_4 + 1) : w + new Array(_4 - w.length + 2).join("0");
        }
        l.prototype = u2.prototype, u2.prototype.toString = function() {
          return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, 0 | this.width)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, 0 | this.precision)) + (this.trim ? "~" : "") + this.type;
        };
        var f = { "%": function(x, b) {
          return (100 * x).toFixed(b);
        }, b: function(x) {
          return Math.round(x).toString(2);
        }, c: function(x) {
          return x + "";
        }, d: function(x) {
          return Math.abs(x = Math.round(x)) >= 1e21 ? x.toLocaleString("en").replace(/,/g, "") : x.toString(10);
        }, e: function(x, b) {
          return x.toExponential(b);
        }, f: function(x, b) {
          return x.toFixed(b);
        }, g: function(x, b) {
          return x.toPrecision(b);
        }, o: function(x) {
          return Math.round(x).toString(8);
        }, p: function(x, b) {
          return c(100 * x, b);
        }, r: c, s: function(x, b) {
          var y = a(x, b);
          if (!y) return x + "";
          var w = y[0], _4 = y[1], k = _4 - (s = 3 * Math.max(-8, Math.min(8, Math.floor(_4 / 3)))) + 1, T2 = w.length;
          return k === T2 ? w : k > T2 ? w + new Array(k - T2 + 1).join("0") : k > 0 ? w.slice(0, k) + "." + w.slice(k) : "0." + new Array(1 - k).join("0") + a(x, Math.max(0, b + k - 1))[0];
        }, X: function(x) {
          return Math.round(x).toString(16).toUpperCase();
        }, x: function(x) {
          return Math.round(x).toString(16);
        } };
        function h(x) {
          return x;
        }
        var p, d = Array.prototype.map, v = ["y", "z", "a", "f", "p", "n", "\xB5", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
        function m(x) {
          var b, y, w = x.grouping === void 0 || x.thousands === void 0 ? h : (b = d.call(x.grouping, Number), y = x.thousands + "", function(N2, D2) {
            for (var I2 = N2.length, O2 = [], L2 = 0, V2 = b[0], W2 = 0; I2 > 0 && V2 > 0 && (W2 + V2 + 1 > D2 && (V2 = Math.max(1, D2 - W2)), O2.push(N2.substring(I2 -= V2, I2 + V2)), !((W2 += V2 + 1) > D2)); ) V2 = b[L2 = (L2 + 1) % b.length];
            return O2.reverse().join(y);
          }), _4 = x.currency === void 0 ? "" : x.currency[0] + "", k = x.currency === void 0 ? "" : x.currency[1] + "", T2 = x.decimal === void 0 ? "." : x.decimal + "", A2 = x.numerals === void 0 ? h : /* @__PURE__ */ function(N2) {
            return function(D2) {
              return D2.replace(/[0-9]/g, function(I2) {
                return N2[+I2];
              });
            };
          }(d.call(x.numerals, String)), S2 = x.percent === void 0 ? "%" : x.percent + "", C2 = x.minus === void 0 ? "-" : x.minus + "", E2 = x.nan === void 0 ? "NaN" : x.nan + "";
          function F13(N2) {
            var D2 = (N2 = l(N2)).fill, I2 = N2.align, O2 = N2.sign, L2 = N2.symbol, V2 = N2.zero, W2 = N2.width, X2 = N2.comma, Y2 = N2.precision, K2 = N2.trim, q = N2.type;
            q === "n" ? (X2 = true, q = "g") : f[q] || (Y2 === void 0 && (Y2 = 12), K2 = true, q = "g"), (V2 || D2 === "0" && I2 === "=") && (V2 = true, D2 = "0", I2 = "=");
            var re = L2 === "$" ? _4 : L2 === "#" && /[boxX]/.test(q) ? "0" + q.toLowerCase() : "", R2 = L2 === "$" ? k : /[%p]/.test(q) ? S2 : "", z = f[q], H2 = /[defgprs%]/.test(q);
            function te(j) {
              var Q2, Z2, ne, ae = re, ue = R2;
              if (q === "c") ue = z(j) + ue, j = "";
              else {
                var le = (j = +j) < 0 || 1 / j < 0;
                if (j = isNaN(j) ? E2 : z(Math.abs(j), Y2), K2 && (j = function(he) {
                  e: for (var me, we = he.length, be = 1, Ae = -1; be < we; ++be) switch (he[be]) {
                    case ".":
                      Ae = me = be;
                      break;
                    case "0":
                      Ae === 0 && (Ae = be), me = be;
                      break;
                    default:
                      if (!+he[be]) break e;
                      Ae > 0 && (Ae = 0);
                  }
                  return Ae > 0 ? he.slice(0, Ae) + he.slice(me + 1) : he;
                }(j)), le && +j == 0 && O2 !== "+" && (le = false), ae = (le ? O2 === "(" ? O2 : C2 : O2 === "-" || O2 === "(" ? "" : O2) + ae, ue = (q === "s" ? v[8 + s / 3] : "") + ue + (le && O2 === "(" ? ")" : ""), H2) {
                  for (Q2 = -1, Z2 = j.length; ++Q2 < Z2; ) if (48 > (ne = j.charCodeAt(Q2)) || ne > 57) {
                    ue = (ne === 46 ? T2 + j.slice(Q2 + 1) : j.slice(Q2)) + ue, j = j.slice(0, Q2);
                    break;
                  }
                }
              }
              X2 && !V2 && (j = w(j, 1 / 0));
              var ce = ae.length + j.length + ue.length, se = ce < W2 ? new Array(W2 - ce + 1).join(D2) : "";
              switch (X2 && V2 && (j = w(se + j, se.length ? W2 - ue.length : 1 / 0), se = ""), I2) {
                case "<":
                  j = ae + j + ue + se;
                  break;
                case "=":
                  j = ae + se + j + ue;
                  break;
                case "^":
                  j = se.slice(0, ce = se.length >> 1) + ae + j + ue + se.slice(ce);
                  break;
                default:
                  j = se + ae + j + ue;
              }
              return A2(j);
            }
            return Y2 = Y2 === void 0 ? 6 : /[gprs]/.test(q) ? Math.max(1, Math.min(21, Y2)) : Math.max(0, Math.min(20, Y2)), te.toString = function() {
              return N2 + "";
            }, te;
          }
          return { format: F13, formatPrefix: function(N2, D2) {
            var I2 = F13(((N2 = l(N2)).type = "f", N2)), O2 = 3 * Math.max(-8, Math.min(8, Math.floor(o(D2) / 3))), L2 = Math.pow(10, -O2), V2 = v[8 + O2 / 3];
            return function(W2) {
              return I2(L2 * W2) + V2;
            };
          } };
        }
        function g(x) {
          return p = m(x), n.format = p.format, n.formatPrefix = p.formatPrefix, p;
        }
        g({ decimal: ".", thousands: ",", grouping: [3], currency: ["$", ""], minus: "-" }), n.FormatSpecifier = u2, n.formatDefaultLocale = g, n.formatLocale = m, n.formatSpecifier = l, n.precisionFixed = function(x) {
          return Math.max(0, -o(Math.abs(x)));
        }, n.precisionPrefix = function(x, b) {
          return Math.max(0, 3 * Math.max(-8, Math.min(8, Math.floor(o(b) / 3))) - o(Math.abs(x)));
        }, n.precisionRound = function(x, b) {
          return x = Math.abs(x), b = Math.abs(b) - x, Math.max(0, o(b) - o(x)) + 1;
        }, Object.defineProperty(n, "__esModule", { value: true });
      });
    }, {}], 113: [function(e, t, r) {
      (function(n, a) {
        typeof r == "object" && t !== void 0 ? a(r, e("d3-geo"), e("d3-array")) : a(n.d3 = n.d3 || {}, n.d3, n.d3);
      })(this, function(n, a, o) {
        "use strict";
        var s = Math.abs, i = Math.atan, l = Math.atan2, u2 = Math.cos, c = Math.exp, f = Math.floor, h = Math.log, p = Math.max, d = Math.min, v = Math.pow, m = Math.round, g = Math.sign || function(Qe) {
          return Qe > 0 ? 1 : Qe < 0 ? -1 : 0;
        }, x = Math.sin, b = Math.tan, y = 1e-6, w = Math.PI, _4 = w / 2, k = w / 4, T2 = Math.SQRT1_2, A2 = I2(2), S2 = I2(w), C2 = 2 * w, E2 = 180 / w, F13 = w / 180;
        function N2(Qe) {
          return Qe > 1 ? _4 : Qe < -1 ? -_4 : Math.asin(Qe);
        }
        function D2(Qe) {
          return Qe > 1 ? 0 : Qe < -1 ? w : Math.acos(Qe);
        }
        function I2(Qe) {
          return Qe > 0 ? Math.sqrt(Qe) : 0;
        }
        function O2(Qe) {
          return (c(Qe) - c(-Qe)) / 2;
        }
        function L2(Qe) {
          return (c(Qe) + c(-Qe)) / 2;
        }
        function V2(Qe) {
          var nt = b(Qe / 2), dt = 2 * h(u2(Qe / 2)) / (nt * nt);
          function _t(Ct, St) {
            var Lt = u2(Ct), ir = u2(St), or = x(St), nr = ir * Lt, fr = -((1 - nr ? h((1 + nr) / 2) / (1 - nr) : -0.5) + dt / (1 + nr));
            return [fr * ir * x(Ct), fr * or];
          }
          return _t.invert = function(Ct, St) {
            var Lt, ir = I2(Ct * Ct + St * St), or = -Qe / 2, nr = 50;
            if (!ir) return [0, 0];
            do {
              var fr = or / 2, wr = u2(fr), Er = x(fr), Mr = Er / wr, Wr = -h(s(wr));
              or -= Lt = (2 / Mr * Wr - dt * Mr - ir) / (-Wr / (Er * Er) + 1 - dt / (2 * wr * wr)) * (wr < 0 ? 0.7 : 1);
            } while (s(Lt) > y && --nr > 0);
            var kn = x(or);
            return [l(Ct * kn, ir * u2(or)), N2(St * kn / ir)];
          }, _t;
        }
        function W2(Qe, nt) {
          var dt = u2(nt), _t = function(Ct) {
            return Ct ? Ct / Math.sin(Ct) : 1;
          }(D2(dt * u2(Qe /= 2)));
          return [2 * dt * x(Qe) * _t, x(nt) * _t];
        }
        function X2(Qe) {
          var nt = x(Qe), dt = u2(Qe), _t = Qe >= 0 ? 1 : -1, Ct = b(_t * Qe), St = (1 + nt - dt) / 2;
          function Lt(ir, or) {
            var nr = u2(or), fr = u2(ir /= 2);
            return [(1 + nr) * x(ir), (_t * or > -l(fr, Ct) - 1e-3 ? 0 : 10 * -_t) + St + x(or) * dt - (1 + nr) * nt * fr];
          }
          return Lt.invert = function(ir, or) {
            var nr = 0, fr = 0, wr = 50;
            do {
              var Er = u2(nr), Mr = x(nr), Wr = u2(fr), kn = x(fr), On = 1 + Wr, ta = On * Mr - ir, sa = St + kn * dt - On * nt * Er - or, xa = On * Er / 2, la = -Mr * kn, ci = nt * On * Mr / 2, Ci = dt * Wr + nt * Er * kn, Qi = la * ci - Ci * xa, Zi = (sa * la - ta * Ci) / Qi / 2, eo = (ta * ci - sa * xa) / Qi;
              s(eo) > 2 && (eo /= 2), nr -= Zi, fr -= eo;
            } while ((s(Zi) > y || s(eo) > y) && --wr > 0);
            return _t * fr > -l(u2(nr), Ct) - 1e-3 ? [2 * nr, fr] : null;
          }, Lt;
        }
        function Y2(Qe, nt) {
          var dt = b(nt / 2), _t = I2(1 - dt * dt), Ct = 1 + _t * u2(Qe /= 2), St = x(Qe) * _t / Ct, Lt = dt / Ct, ir = St * St, or = Lt * Lt;
          return [4 / 3 * St * (3 + ir - 3 * or), 4 / 3 * Lt * (3 + 3 * ir - or)];
        }
        W2.invert = function(Qe, nt) {
          if (!(Qe * Qe + 4 * nt * nt > w * w + y)) {
            var dt = Qe, _t = nt, Ct = 25;
            do {
              var St, Lt = x(dt), ir = x(dt / 2), or = u2(dt / 2), nr = x(_t), fr = u2(_t), wr = x(2 * _t), Er = nr * nr, Mr = fr * fr, Wr = ir * ir, kn = 1 - Mr * or * or, On = kn ? D2(fr * or) * I2(St = 1 / kn) : St = 0, ta = 2 * On * fr * ir - Qe, sa = On * nr - nt, xa = St * (Mr * Wr + On * fr * or * Er), la = St * (0.5 * Lt * wr - 2 * On * nr * ir), ci = 0.25 * St * (wr * ir - On * nr * Mr * Lt), Ci = St * (Er * or + On * Wr * fr), Qi = la * ci - Ci * xa;
              if (!Qi) break;
              var Zi = (sa * la - ta * Ci) / Qi, eo = (ta * ci - sa * xa) / Qi;
              dt -= Zi, _t -= eo;
            } while ((s(Zi) > y || s(eo) > y) && --Ct > 0);
            return [dt, _t];
          }
        }, Y2.invert = function(Qe, nt) {
          if (nt *= 3 / 8, !(Qe *= 3 / 8) && s(nt) > 1) return null;
          var dt = 1 + Qe * Qe + nt * nt, _t = I2((dt - I2(dt * dt - 4 * nt * nt)) / 2), Ct = N2(_t) / 3, St = _t ? function(nr) {
            return h(nr + I2(nr * nr - 1));
          }(s(nt / _t)) / 3 : function(nr) {
            return h(nr + I2(nr * nr + 1));
          }(s(Qe)) / 3, Lt = u2(Ct), ir = L2(St), or = ir * ir - Lt * Lt;
          return [2 * g(Qe) * l(O2(St) * Lt, 0.25 - or), 2 * g(nt) * l(ir * x(Ct), 0.25 + or)];
        };
        var K2 = I2(8), q = h(1 + A2);
        function re(Qe, nt) {
          var dt = s(nt);
          return dt < k ? [Qe, h(b(k + nt / 2))] : [Qe * u2(dt) * (2 * A2 - 1 / x(dt)), g(nt) * (2 * A2 * (dt - k) - h(b(dt / 2)))];
        }
        function R2(Qe) {
          var nt = 2 * w / Qe;
          function dt(_t, Ct) {
            var St = a.geoAzimuthalEquidistantRaw(_t, Ct);
            if (s(_t) > _4) {
              var Lt = l(St[1], St[0]), ir = I2(St[0] * St[0] + St[1] * St[1]), or = nt * m((Lt - _4) / nt) + _4, nr = l(x(Lt -= or), 2 - u2(Lt));
              Lt = or + N2(w / ir * x(nr)) - nr, St[0] = ir * u2(Lt), St[1] = ir * x(Lt);
            }
            return St;
          }
          return dt.invert = function(_t, Ct) {
            var St = I2(_t * _t + Ct * Ct);
            if (St > _4) {
              var Lt = l(Ct, _t), ir = nt * m((Lt - _4) / nt) + _4, or = Lt > ir ? -1 : 1, nr = St * u2(ir - Lt), fr = 1 / b(or * D2((nr - w) / I2(w * (w - 2 * nr) + St * St)));
              Lt = ir + 2 * i((fr + or * I2(fr * fr - 3)) / 3), _t = St * u2(Lt), Ct = St * x(Lt);
            }
            return a.geoAzimuthalEquidistantRaw.invert(_t, Ct);
          }, dt;
        }
        function z(Qe, nt) {
          if (arguments.length < 2 && (nt = Qe), nt === 1) return a.geoAzimuthalEqualAreaRaw;
          if (nt === 1 / 0) return H2;
          function dt(_t, Ct) {
            var St = a.geoAzimuthalEqualAreaRaw(_t / nt, Ct);
            return St[0] *= Qe, St;
          }
          return dt.invert = function(_t, Ct) {
            var St = a.geoAzimuthalEqualAreaRaw.invert(_t / Qe, Ct);
            return St[0] *= nt, St;
          }, dt;
        }
        function H2(Qe, nt) {
          return [Qe * u2(nt) / u2(nt /= 2), 2 * x(nt)];
        }
        function te(Qe, nt, dt) {
          var _t, Ct, St, Lt = 100;
          dt = dt === void 0 ? 0 : +dt, nt = +nt;
          do
            (Ct = Qe(dt)) === (St = Qe(dt + y)) && (St = Ct + y), dt -= _t = -1 * y * (Ct - nt) / (Ct - St);
          while (Lt-- > 0 && s(_t) > y);
          return Lt < 0 ? NaN : dt;
        }
        function j(Qe, nt, dt) {
          return nt === void 0 && (nt = 40), dt === void 0 && (dt = 1e-12), function(_t, Ct, St, Lt) {
            var ir, or, nr;
            St = St === void 0 ? 0 : +St, Lt = Lt === void 0 ? 0 : +Lt;
            for (var fr = 0; fr < nt; fr++) {
              var wr = Qe(St, Lt), Er = wr[0] - _t, Mr = wr[1] - Ct;
              if (s(Er) < dt && s(Mr) < dt) break;
              var Wr = Er * Er + Mr * Mr;
              if (Wr > ir) St -= or /= 2, Lt -= nr /= 2;
              else {
                ir = Wr;
                var kn = (St > 0 ? -1 : 1) * dt, On = (Lt > 0 ? -1 : 1) * dt, ta = Qe(St + kn, Lt), sa = Qe(St, Lt + On), xa = (ta[0] - wr[0]) / kn, la = (ta[1] - wr[1]) / kn, ci = (sa[0] - wr[0]) / On, Ci = (sa[1] - wr[1]) / On, Qi = Ci * xa - la * ci, Zi = (s(Qi) < 0.5 ? 0.5 : 1) / Qi;
                if (St += or = (Mr * ci - Er * Ci) * Zi, Lt += nr = (Er * la - Mr * xa) * Zi, s(or) < dt && s(nr) < dt) break;
              }
            }
            return [St, Lt];
          };
        }
        function Q2() {
          var Qe = z(1.68, 2);
          function nt(dt, _t) {
            if (dt + _t < -1.4) {
              var Ct = (dt - _t + 1.6) * (dt + _t + 1.4) / 8;
              dt += Ct, _t -= 0.8 * Ct * x(_t + w / 2);
            }
            var St = Qe(dt, _t), Lt = (1 - u2(dt * _t)) / 12;
            return St[1] < 0 && (St[0] *= 1 + Lt), St[1] > 0 && (St[1] *= 1 + Lt / 1.5 * St[0] * St[0]), St;
          }
          return nt.invert = j(nt), nt;
        }
        function Z2(Qe, nt) {
          var dt, _t = Qe * x(nt), Ct = 30;
          do
            nt -= dt = (nt + x(nt) - _t) / (1 + u2(nt));
          while (s(dt) > y && --Ct > 0);
          return nt / 2;
        }
        function ne(Qe, nt, dt) {
          function _t(Ct, St) {
            return [Qe * Ct * u2(St = Z2(dt, St)), nt * x(St)];
          }
          return _t.invert = function(Ct, St) {
            return St = N2(St / nt), [Ct / (Qe * u2(St)), N2((2 * St + x(2 * St)) / dt)];
          }, _t;
        }
        re.invert = function(Qe, nt) {
          if ((_t = s(nt)) < q) return [Qe, 2 * i(c(nt)) - _4];
          var dt, _t, Ct = k, St = 25;
          do {
            var Lt = u2(Ct / 2), ir = b(Ct / 2);
            Ct -= dt = (K2 * (Ct - k) - h(ir) - _t) / (K2 - Lt * Lt / (2 * ir));
          } while (s(dt) > 1e-12 && --St > 0);
          return [Qe / (u2(Ct) * (K2 - 1 / x(Ct))), g(nt) * Ct];
        }, H2.invert = function(Qe, nt) {
          var dt = 2 * N2(nt / 2);
          return [Qe * u2(dt / 2) / u2(dt), dt];
        };
        var ae = ne(A2 / _4, A2, w), ue = 2.00276, le = 1.11072;
        function ce(Qe, nt) {
          var dt = Z2(w, nt);
          return [ue * Qe / (1 / u2(nt) + le / u2(dt)), (nt + A2 * x(dt)) / ue];
        }
        function se(Qe) {
          var nt = 0, dt = a.geoProjectionMutator(Qe), _t = dt(nt);
          return _t.parallel = function(Ct) {
            return arguments.length ? dt(nt = Ct * F13) : nt * E2;
          }, _t;
        }
        function he(Qe, nt) {
          return [Qe * u2(nt), nt];
        }
        function me(Qe) {
          if (!Qe) return he;
          var nt = 1 / b(Qe);
          function dt(_t, Ct) {
            var St = nt + Qe - Ct, Lt = St && _t * u2(Ct) / St;
            return [St * x(Lt), nt - St * u2(Lt)];
          }
          return dt.invert = function(_t, Ct) {
            var St = I2(_t * _t + (Ct = nt - Ct) * Ct), Lt = nt + Qe - St;
            return [St / u2(Lt) * l(_t, Ct), Lt];
          }, dt;
        }
        function we(Qe) {
          function nt(dt, _t) {
            var Ct = _4 - _t, St = Ct && dt * Qe * x(Ct) / Ct;
            return [Ct * x(St) / Qe, _4 - Ct * u2(St)];
          }
          return nt.invert = function(dt, _t) {
            var Ct = dt * Qe, St = _4 - _t, Lt = I2(Ct * Ct + St * St), ir = l(Ct, St);
            return [(Lt ? Lt / x(Lt) : 1) * ir / Qe, _4 - Lt];
          }, nt;
        }
        ce.invert = function(Qe, nt) {
          var dt, _t, Ct = ue * nt, St = nt < 0 ? -k : k, Lt = 25;
          do
            _t = Ct - A2 * x(St), St -= dt = (x(2 * St) + 2 * St - w * x(_t)) / (2 * u2(2 * St) + 2 + w * u2(_t) * A2 * u2(St));
          while (s(dt) > y && --Lt > 0);
          return _t = Ct - A2 * x(St), [Qe * (1 / u2(_t) + le / u2(St)) / ue, _t];
        }, he.invert = function(Qe, nt) {
          return [Qe / u2(nt), nt];
        };
        var be = ne(1, 4 / w, w);
        function Ae(Qe, nt, dt, _t, Ct, St) {
          var Lt, ir = u2(St);
          if (s(Qe) > 1 || s(St) > 1) Lt = D2(dt * Ct + nt * _t * ir);
          else {
            var or = x(Qe / 2), nr = x(St / 2);
            Lt = 2 * N2(I2(or * or + nt * _t * nr * nr));
          }
          return s(Lt) > y ? [Lt, l(_t * x(St), nt * Ct - dt * _t * ir)] : [0, 0];
        }
        function pe(Qe, nt, dt) {
          return D2((Qe * Qe + nt * nt - dt * dt) / (2 * Qe * nt));
        }
        function ve(Qe) {
          return Qe - 2 * w * f((Qe + w) / (2 * w));
        }
        function Ee(Qe, nt, dt) {
          for (var _t, Ct = [[Qe[0], Qe[1], x(Qe[1]), u2(Qe[1])], [nt[0], nt[1], x(nt[1]), u2(nt[1])], [dt[0], dt[1], x(dt[1]), u2(dt[1])]], St = Ct[2], Lt = 0; Lt < 3; ++Lt, St = _t) _t = Ct[Lt], St.v = Ae(_t[1] - St[1], St[3], St[2], _t[3], _t[2], _t[0] - St[0]), St.point = [0, 0];
          var ir = pe(Ct[0].v[0], Ct[2].v[0], Ct[1].v[0]), or = pe(Ct[0].v[0], Ct[1].v[0], Ct[2].v[0]), nr = w - ir;
          Ct[2].point[1] = 0, Ct[0].point[0] = -(Ct[1].point[0] = Ct[0].v[0] / 2);
          var fr = [Ct[2].point[0] = Ct[0].point[0] + Ct[2].v[0] * u2(ir), 2 * (Ct[0].point[1] = Ct[1].point[1] = Ct[2].v[0] * x(ir))];
          return function(wr, Er) {
            var Mr, Wr = x(Er), kn = u2(Er), On = new Array(3);
            for (Mr = 0; Mr < 3; ++Mr) {
              var ta = Ct[Mr];
              if (On[Mr] = Ae(Er - ta[1], ta[3], ta[2], kn, Wr, wr - ta[0]), !On[Mr][0]) return ta.point;
              On[Mr][1] = ve(On[Mr][1] - ta.v[1]);
            }
            var sa = fr.slice();
            for (Mr = 0; Mr < 3; ++Mr) {
              var xa = Mr == 2 ? 0 : Mr + 1, la = pe(Ct[Mr].v[0], On[Mr][0], On[xa][0]);
              On[Mr][1] < 0 && (la = -la), Mr ? Mr == 1 ? (la = or - la, sa[0] -= On[Mr][0] * u2(la), sa[1] -= On[Mr][0] * x(la)) : (la = nr - la, sa[0] += On[Mr][0] * u2(la), sa[1] += On[Mr][0] * x(la)) : (sa[0] += On[Mr][0] * u2(la), sa[1] -= On[Mr][0] * x(la));
            }
            return sa[0] /= 3, sa[1] /= 3, sa;
          };
        }
        function Se(Qe) {
          return Qe[0] *= F13, Qe[1] *= F13, Qe;
        }
        function Ce(Qe, nt, dt) {
          var _t = a.geoCentroid({ type: "MultiPoint", coordinates: [Qe, nt, dt] }), Ct = [-_t[0], -_t[1]], St = a.geoRotation(Ct), Lt = Ee(Se(St(Qe)), Se(St(nt)), Se(St(dt)));
          Lt.invert = j(Lt);
          var ir = a.geoProjection(Lt).rotate(Ct), or = ir.center;
          return delete ir.rotate, ir.center = function(nr) {
            return arguments.length ? or(St(nr)) : St.invert(or());
          }, ir.clipAngle(90);
        }
        function Be(Qe, nt) {
          var dt = I2(1 - x(nt));
          return [2 / S2 * Qe * dt, S2 * (1 - dt)];
        }
        function Ue(Qe) {
          var nt = b(Qe);
          function dt(_t, Ct) {
            return [_t, (_t ? _t / x(_t) : 1) * (x(Ct) * u2(_t) - nt * u2(Ct))];
          }
          return dt.invert = nt ? function(_t, Ct) {
            _t && (Ct *= x(_t) / _t);
            var St = u2(_t);
            return [_t, 2 * l(I2(St * St + nt * nt - Ct * Ct) - St, nt - Ct)];
          } : function(_t, Ct) {
            return [_t, N2(_t ? Ct * b(_t) / _t : Ct)];
          }, dt;
        }
        Be.invert = function(Qe, nt) {
          var dt = (dt = nt / S2 - 1) * dt;
          return [dt > 0 ? Qe * I2(w / dt) / 2 : 0, N2(1 - dt)];
        };
        var Ke = I2(3);
        function ct(Qe, nt) {
          return [Ke * Qe * (2 * u2(2 * nt / 3) - 1) / S2, Ke * S2 * x(nt / 3)];
        }
        function We(Qe) {
          var nt = u2(Qe);
          function dt(_t, Ct) {
            return [_t * nt, x(Ct) / nt];
          }
          return dt.invert = function(_t, Ct) {
            return [_t / nt, N2(Ct * nt)];
          }, dt;
        }
        function Ze(Qe) {
          var nt = u2(Qe);
          function dt(_t, Ct) {
            return [_t * nt, (1 + nt) * b(Ct / 2)];
          }
          return dt.invert = function(_t, Ct) {
            return [_t / nt, 2 * i(Ct / (1 + nt))];
          }, dt;
        }
        function it(Qe, nt) {
          var dt = I2(8 / (3 * w));
          return [dt * Qe * (1 - s(nt) / w), dt * nt];
        }
        function ot(Qe, nt) {
          var dt = I2(4 - 3 * x(s(nt)));
          return [2 / I2(6 * w) * Qe * dt, g(nt) * I2(2 * w / 3) * (2 - dt)];
        }
        function mt(Qe, nt) {
          var dt = I2(w * (4 + w));
          return [2 / dt * Qe * (1 + I2(1 - 4 * nt * nt / (w * w))), 4 / dt * nt];
        }
        function wt(Qe, nt) {
          var dt = (2 + _4) * x(nt);
          nt /= 2;
          for (var _t = 0, Ct = 1 / 0; _t < 10 && s(Ct) > y; _t++) {
            var St = u2(nt);
            nt -= Ct = (nt + x(nt) * (St + 2) - dt) / (2 * St * (1 + St));
          }
          return [2 / I2(w * (4 + w)) * Qe * (1 + u2(nt)), 2 * I2(w / (4 + w)) * x(nt)];
        }
        function Et(Qe, nt) {
          return [Qe * (1 + u2(nt)) / I2(2 + w), 2 * nt / I2(2 + w)];
        }
        function zt(Qe, nt) {
          for (var dt = (1 + _4) * x(nt), _t = 0, Ct = 1 / 0; _t < 10 && s(Ct) > y; _t++) nt -= Ct = (nt + x(nt) - dt) / (1 + u2(nt));
          return dt = I2(2 + w), [Qe * (1 + u2(nt)) / dt, 2 * nt / dt];
        }
        ct.invert = function(Qe, nt) {
          var dt = 3 * N2(nt / (Ke * S2));
          return [S2 * Qe / (Ke * (2 * u2(2 * dt / 3) - 1)), dt];
        }, it.invert = function(Qe, nt) {
          var dt = I2(8 / (3 * w)), _t = nt / dt;
          return [Qe / (dt * (1 - s(_t) / w)), _t];
        }, ot.invert = function(Qe, nt) {
          var dt = 2 - s(nt) / I2(2 * w / 3);
          return [Qe * I2(6 * w) / (2 * dt), g(nt) * N2((4 - dt * dt) / 3)];
        }, mt.invert = function(Qe, nt) {
          var dt = I2(w * (4 + w)) / 2;
          return [Qe * dt / (1 + I2(1 - nt * nt * (4 + w) / (4 * w))), nt * dt / 2];
        }, wt.invert = function(Qe, nt) {
          var dt = nt * I2((4 + w) / w) / 2, _t = N2(dt), Ct = u2(_t);
          return [Qe / (2 / I2(w * (4 + w)) * (1 + Ct)), N2((_t + dt * (Ct + 2)) / (2 + _4))];
        }, Et.invert = function(Qe, nt) {
          var dt = I2(2 + w), _t = nt * dt / 2;
          return [dt * Qe / (1 + u2(_t)), _t];
        }, zt.invert = function(Qe, nt) {
          var dt = 1 + _4, _t = I2(dt / 2);
          return [2 * Qe * _t / (1 + u2(nt *= _t)), N2((nt + x(nt)) / dt)];
        };
        var Nt = 3 + 2 * A2;
        function yt(Qe, nt) {
          var dt = x(Qe /= 2), _t = u2(Qe), Ct = I2(u2(nt)), St = u2(nt /= 2), Lt = x(nt) / (St + A2 * _t * Ct), ir = I2(2 / (1 + Lt * Lt)), or = I2((A2 * St + (_t + dt) * Ct) / (A2 * St + (_t - dt) * Ct));
          return [Nt * (ir * (or - 1 / or) - 2 * h(or)), Nt * (ir * Lt * (or + 1 / or) - 2 * i(Lt))];
        }
        yt.invert = function(Qe, nt) {
          if (!(dt = Y2.invert(Qe / 1.2, 1.065 * nt))) return null;
          var dt, _t = dt[0], Ct = dt[1], St = 20;
          Qe /= Nt, nt /= Nt;
          do {
            var Lt = _t / 2, ir = Ct / 2, or = x(Lt), nr = u2(Lt), fr = x(ir), wr = u2(ir), Er = u2(Ct), Mr = I2(Er), Wr = fr / (wr + A2 * nr * Mr), kn = Wr * Wr, On = I2(2 / (1 + kn)), ta = (A2 * wr + (nr + or) * Mr) / (A2 * wr + (nr - or) * Mr), sa = I2(ta), xa = sa - 1 / sa, la = sa + 1 / sa, ci = On * xa - 2 * h(sa) - Qe, Ci = On * Wr * la - 2 * i(Wr) - nt, Qi = fr && T2 * Mr * or * kn / fr, Zi = (A2 * nr * wr + Mr) / (2 * (wr + A2 * nr * Mr) * (wr + A2 * nr * Mr) * Mr), eo = -0.5 * Wr * On * On * On, Es = eo * Qi, vs = eo * Zi, Vo = (Vo = 2 * wr + A2 * Mr * (nr - or)) * Vo * sa, jo = (A2 * nr * wr * Mr + Er) / Vo, ms = -A2 * or * fr / (Mr * Vo), al = xa * Es - 2 * jo / sa + On * (jo + jo / ta), Xl = xa * vs - 2 * ms / sa + On * (ms + ms / ta), Kl = Wr * la * Es - 2 * Qi / (1 + kn) + On * la * Qi + On * Wr * (jo - jo / ta), Yl = Wr * la * vs - 2 * Zi / (1 + kn) + On * la * Zi + On * Wr * (ms - ms / ta), Zl = Xl * Kl - Yl * al;
            if (!Zl) break;
            var qi = (Ci * Xl - ci * Yl) / Zl, At = (ci * Kl - Ci * al) / Zl;
            _t -= qi, Ct = p(-_4, d(_4, Ct - At));
          } while ((s(qi) > y || s(At) > y) && --St > 0);
          return s(s(Ct) - _4) < y ? [0, Ct] : St && [_t, Ct];
        };
        var pt = u2(35 * F13);
        function Ot(Qe, nt) {
          var dt = b(nt / 2);
          return [Qe * pt * I2(1 - dt * dt), (1 + pt) * dt];
        }
        function Jt(Qe, nt) {
          var dt = nt / 2, _t = u2(dt);
          return [2 * Qe / S2 * u2(nt) * _t * _t, S2 * b(dt)];
        }
        function tr(Qe) {
          var nt = 1 - Qe, dt = Ct(w, 0)[0] - Ct(-w, 0)[0], _t = I2(2 * (Ct(0, _4)[1] - Ct(0, -_4)[1]) / dt);
          function Ct(ir, or) {
            var nr = u2(or), fr = x(or);
            return [nr / (nt + Qe * nr) * ir, nt * or + Qe * fr];
          }
          function St(ir, or) {
            var nr = Ct(ir, or);
            return [nr[0] * _t, nr[1] / _t];
          }
          function Lt(ir) {
            return St(0, ir)[1];
          }
          return St.invert = function(ir, or) {
            var nr = te(Lt, or);
            return [ir / _t * (Qe + nt / u2(nr)), nr];
          }, St;
        }
        function Ye(Qe) {
          return [Qe[0] / 2, N2(b(Qe[1] / 2 * F13)) * E2];
        }
        function at(Qe) {
          return [2 * Qe[0], 2 * i(x(Qe[1] * F13)) * E2];
        }
        function Ge(Qe, nt) {
          var dt = 2 * w / nt, _t = Qe * Qe;
          function Ct(St, Lt) {
            var ir = a.geoAzimuthalEquidistantRaw(St, Lt), or = ir[0], nr = ir[1], fr = or * or + nr * nr;
            if (fr > _t) {
              var wr = I2(fr), Er = l(nr, or), Mr = dt * m(Er / dt), Wr = Er - Mr, kn = Qe * u2(Wr), On = (Qe * x(Wr) - Wr * x(kn)) / (_4 - kn), ta = st(Wr, On), sa = (w - Qe) / Ie(ta, kn, w);
              or = wr;
              var xa, la = 50;
              do
                or -= xa = (Qe + Ie(ta, kn, or) * sa - wr) / (ta(or) * sa);
              while (s(xa) > y && --la > 0);
              nr = Wr * x(or), or < _4 && (nr -= On * (or - _4));
              var ci = x(Mr), Ci = u2(Mr);
              ir[0] = or * Ci - nr * ci, ir[1] = or * ci + nr * Ci;
            }
            return ir;
          }
          return Ct.invert = function(St, Lt) {
            var ir = St * St + Lt * Lt;
            if (ir > _t) {
              var or = I2(ir), nr = l(Lt, St), fr = dt * m(nr / dt), wr = nr - fr;
              St = or * u2(wr), Lt = or * x(wr);
              for (var Er = St - _4, Mr = x(St), Wr = Lt / Mr, kn = St < _4 ? 1 / 0 : 0, On = 10; ; ) {
                var ta = Qe * x(Wr), sa = Qe * u2(Wr), xa = x(sa), la = _4 - sa, ci = (ta - Wr * xa) / la, Ci = st(Wr, ci);
                if (s(kn) < 1e-12 || !--On) break;
                Wr -= kn = (Wr * Mr - ci * Er - Lt) / (Mr - 2 * Er * (la * (sa + Wr * ta * u2(sa) - xa) - ta * (ta - Wr * xa)) / (la * la));
              }
              St = (or = Qe + Ie(Ci, sa, St) * (w - Qe) / Ie(Ci, sa, w)) * u2(nr = fr + Wr), Lt = or * x(nr);
            }
            return a.geoAzimuthalEquidistantRaw.invert(St, Lt);
          }, Ct;
        }
        function st(Qe, nt) {
          return function(dt) {
            var _t = Qe * u2(dt);
            return dt < _4 && (_t -= nt), I2(1 + _t * _t);
          };
        }
        function Ie(Qe, nt, dt) {
          for (var _t = (dt - nt) / 50, Ct = Qe(nt) + Qe(dt), St = 1, Lt = nt; St < 50; ++St) Ct += 2 * Qe(Lt += _t);
          return 0.5 * Ct * _t;
        }
        function Pe(Qe, nt, dt, _t, Ct, St, Lt, ir) {
          function or(nr, fr) {
            if (!fr) return [Qe * nr / w, 0];
            var wr = fr * fr, Er = Qe + wr * (nt + wr * (dt + wr * _t)), Mr = fr * (Ct - 1 + wr * (St - ir + wr * Lt)), Wr = (Er * Er + Mr * Mr) / (2 * Mr), kn = nr * N2(Er / Wr) / w;
            return [Wr * x(kn), fr * (1 + wr * ir) + Wr * (1 - u2(kn))];
          }
          return arguments.length < 8 && (ir = 0), or.invert = function(nr, fr) {
            var wr, Er, Mr = w * nr / Qe, Wr = fr, kn = 50;
            do {
              var On = Wr * Wr, ta = Qe + On * (nt + On * (dt + On * _t)), sa = Wr * (Ct - 1 + On * (St - ir + On * Lt)), xa = ta * ta + sa * sa, la = 2 * sa, ci = xa / la, Ci = ci * ci, Qi = N2(ta / ci) / w, Zi = Mr * Qi, eo = ta * ta, Es = (2 * nt + On * (4 * dt + 6 * On * _t)) * Wr, vs = Ct + On * (3 * St + 5 * On * Lt), Vo = (2 * (ta * Es + sa * (vs - 1)) * la - xa * (2 * (vs - 1))) / (la * la), jo = u2(Zi), ms = x(Zi), al = ci * jo, Xl = ci * ms, Kl = Mr / w * (1 / I2(1 - eo / Ci)) * (Es * ci - ta * Vo) / Ci, Yl = Xl - nr, Zl = Wr * (1 + On * ir) + ci - al - fr, qi = Vo * ms + al * Kl, At = al * Qi, Ht = 1 + Vo - (Vo * jo - Xl * Kl), dr = Xl * Qi, Qt = qi * dr - Ht * At;
              if (!Qt) break;
              Mr -= wr = (Zl * qi - Yl * Ht) / Qt, Wr -= Er = (Yl * dr - Zl * At) / Qt;
            } while ((s(wr) > y || s(Er) > y) && --kn > 0);
            return [Mr, Wr];
          }, or;
        }
        Ot.invert = function(Qe, nt) {
          var dt = nt / (1 + pt);
          return [Qe && Qe / (pt * I2(1 - dt * dt)), 2 * i(dt)];
        }, Jt.invert = function(Qe, nt) {
          var dt = i(nt / S2), _t = u2(dt), Ct = 2 * dt;
          return [Qe * S2 / 2 / (u2(Ct) * _t * _t), Ct];
        };
        var $e = Pe(2.8284, -1.6988, 0.75432, -0.18071, 1.76003, -0.38914, 0.042555), Ve = Pe(2.583819, -0.835827, 0.170354, -0.038094, 1.543313, -0.411435, 0.082742), ut = Pe(5 / 6 * w, -0.62636, -0.0344, 0, 1.3493, -0.05524, 0, 0.045);
        function Re(Qe, nt) {
          var dt = Qe * Qe, _t = nt * nt;
          return [Qe * (1 - 0.162388 * _t) * (0.87 - 952426e-9 * dt * dt), nt * (1 + _t / 12)];
        }
        Re.invert = function(Qe, nt) {
          var dt, _t = Qe, Ct = nt, St = 50;
          do {
            var Lt = Ct * Ct;
            Ct -= dt = (Ct * (1 + Lt / 12) - nt) / (1 + Lt / 4);
          } while (s(dt) > y && --St > 0);
          St = 50, Qe /= 1 - 0.162388 * Lt;
          do {
            var ir = (ir = _t * _t) * ir;
            _t -= dt = (_t * (0.87 - 952426e-9 * ir) - Qe) / (0.87 - 476213e-8 * ir);
          } while (s(dt) > y && --St > 0);
          return [_t, Ct];
        };
        var qe = Pe(2.6516, -0.76534, 0.19123, -0.047094, 1.36289, -0.13965, 0.031762);
        function je(Qe) {
          var nt = Qe(_4, 0)[0] - Qe(-_4, 0)[0];
          function dt(_t, Ct) {
            var St = _t > 0 ? -0.5 : 0.5, Lt = Qe(_t + St * w, Ct);
            return Lt[0] -= St * nt, Lt;
          }
          return Qe.invert && (dt.invert = function(_t, Ct) {
            var St = _t > 0 ? -0.5 : 0.5, Lt = Qe.invert(_t + St * nt, Ct), ir = Lt[0] - St * w;
            return ir < -w ? ir += 2 * w : ir > w && (ir -= 2 * w), Lt[0] = ir, Lt;
          }), dt;
        }
        function rt(Qe, nt) {
          var dt = g(Qe), _t = g(nt), Ct = u2(nt), St = u2(Qe) * Ct, Lt = x(Qe) * Ct, ir = x(_t * nt);
          Qe = s(l(Lt, ir)), nt = N2(St), s(Qe - _4) > y && (Qe %= _4);
          var or = function(nr, fr) {
            if (fr === _4) return [0, 0];
            var wr, Er, Mr = x(fr), Wr = Mr * Mr, kn = Wr * Wr, On = 1 + kn, ta = 1 + 3 * kn, sa = 1 - kn, xa = N2(1 / I2(On)), la = sa + Wr * On * xa, ci = (1 - Mr) / la, Ci = I2(ci), Qi = ci * On, Zi = I2(Qi), eo = Ci * sa;
            if (nr === 0) return [0, -(eo + Wr * Zi)];
            var Es, vs = u2(fr), Vo = 1 / vs, jo = 2 * Mr * vs, ms = (-la * vs - (-3 * Wr + xa * ta) * jo * (1 - Mr)) / (la * la), al = -Vo * jo, Xl = -Vo * (Wr * On * ms + ci * ta * jo), Kl = -2 * Vo * (sa * (0.5 * ms / Ci) - 2 * Wr * Ci * jo), Yl = 4 * nr / w;
            if (nr > 0.222 * w || fr < w / 4 && nr > 0.175 * w) {
              if (wr = (eo + Wr * I2(Qi * (1 + kn) - eo * eo)) / (1 + kn), nr > w / 4) return [wr, wr];
              var Zl = wr, qi = 0.5 * wr;
              wr = 0.5 * (qi + Zl), Er = 50;
              do {
                var At = I2(Qi - wr * wr), Ht = wr * (Kl + al * At) + Xl * N2(wr / Zi) - Yl;
                if (!Ht) break;
                Ht < 0 ? qi = wr : Zl = wr, wr = 0.5 * (qi + Zl);
              } while (s(Zl - qi) > y && --Er > 0);
            } else {
              wr = y, Er = 25;
              do {
                var dr = wr * wr, Qt = I2(Qi - dr), vr = Kl + al * Qt, Vr = wr * vr + Xl * N2(wr / Zi) - Yl, Jr = vr + (Xl - al * dr) / Qt;
                wr -= Es = Qt ? Vr / Jr : 0;
              } while (s(Es) > y && --Er > 0);
            }
            return [wr, -eo - Wr * I2(Qi - wr * wr)];
          }(Qe > w / 4 ? _4 - Qe : Qe, nt);
          return Qe > w / 4 && (ir = or[0], or[0] = -or[1], or[1] = -ir), or[0] *= dt, or[1] *= -_t, or;
        }
        function He(Qe, nt) {
          var dt, _t, Ct, St, Lt, ir;
          if (nt < y) return [(St = x(Qe)) - (dt = nt * (Qe - St * (_t = u2(Qe))) / 4) * _t, _t + dt * St, 1 - nt * St * St / 2, Qe - dt];
          if (nt >= 1 - y) return dt = (1 - nt) / 4, Ct = 1 / (_t = L2(Qe)), [(St = ((ir = c(2 * (ir = Qe))) - 1) / (ir + 1)) + dt * ((Lt = _t * O2(Qe)) - Qe) / (_t * _t), Ct - dt * St * Ct * (Lt - Qe), Ct + dt * St * Ct * (Lt + Qe), 2 * i(c(Qe)) - _4 + dt * (Lt - Qe) / _t];
          var or = [1, 0, 0, 0, 0, 0, 0, 0, 0], nr = [I2(nt), 0, 0, 0, 0, 0, 0, 0, 0], fr = 0;
          for (_t = I2(1 - nt), Lt = 1; s(nr[fr] / or[fr]) > y && fr < 8; ) dt = or[fr++], nr[fr] = (dt - _t) / 2, or[fr] = (dt + _t) / 2, _t = I2(dt * _t), Lt *= 2;
          Ct = Lt * or[fr] * Qe;
          do
            Ct = (N2(St = nr[fr] * x(_t = Ct) / or[fr]) + Ct) / 2;
          while (--fr);
          return [x(Ct), St = u2(Ct), St / u2(Ct - _t), Ct];
        }
        function xe(Qe, nt) {
          if (!nt) return Qe;
          if (nt === 1) return h(b(Qe / 2 + k));
          for (var dt = 1, _t = I2(1 - nt), Ct = I2(nt), St = 0; s(Ct) > y; St++) {
            if (Qe % w) {
              var Lt = i(_t * b(Qe) / dt);
              Lt < 0 && (Lt += w), Qe += Lt + ~~(Qe / w) * w;
            } else Qe += Qe;
            Ct = (dt + _t) / 2, _t = I2(dt * _t), Ct = ((dt = Ct) - _t) / 2;
          }
          return Qe / (v(2, St) * dt);
        }
        function Ne(Qe, nt) {
          var dt = (A2 - 1) / (A2 + 1), _t = I2(1 - dt * dt), Ct = xe(_4, _t * _t), St = h(b(w / 4 + s(nt) / 2)), Lt = c(-1 * St) / I2(dt), ir = function(nr, fr) {
            var wr = nr * nr, Er = fr + 1, Mr = 1 - wr - fr * fr;
            return [0.5 * ((nr >= 0 ? _4 : -_4) - l(Mr, 2 * nr)), -0.25 * h(Mr * Mr + 4 * wr) + 0.5 * h(Er * Er + wr)];
          }(Lt * u2(-1 * Qe), Lt * x(-1 * Qe)), or = function(nr, fr, wr) {
            var Er = s(nr), Mr = O2(s(fr));
            if (Er) {
              var Wr = 1 / x(Er), kn = 1 / (b(Er) * b(Er)), On = -(kn + wr * (Mr * Mr * Wr * Wr) - 1 + wr), ta = (-On + I2(On * On - 4 * ((wr - 1) * kn))) / 2;
              return [xe(i(1 / I2(ta)), wr) * g(nr), xe(i(I2((ta / kn - 1) / wr)), 1 - wr) * g(fr)];
            }
            return [0, xe(i(Mr), 1 - wr) * g(fr)];
          }(ir[0], ir[1], _t * _t);
          return [-or[1], (nt >= 0 ? 1 : -1) * (0.5 * Ct - or[0])];
        }
        function ke(Qe) {
          var nt = x(Qe), dt = u2(Qe), _t = Me(Qe);
          function Ct(St, Lt) {
            var ir = _t(St, Lt);
            St = ir[0], Lt = ir[1];
            var or = x(Lt), nr = u2(Lt), fr = u2(St), wr = D2(nt * or + dt * nr * fr), Er = x(wr), Mr = s(Er) > y ? wr / Er : 1;
            return [Mr * dt * x(St), (s(St) > _4 ? Mr : -Mr) * (nt * nr - dt * or * fr)];
          }
          return _t.invert = Me(-Qe), Ct.invert = function(St, Lt) {
            var ir = I2(St * St + Lt * Lt), or = -x(ir), nr = u2(ir), fr = ir * nr, wr = -Lt * or, Er = ir * nt, Mr = I2(fr * fr + wr * wr - Er * Er), Wr = l(fr * Er + wr * Mr, wr * Er - fr * Mr), kn = (ir > _4 ? -1 : 1) * l(St * or, ir * u2(Wr) * nr + Lt * x(Wr) * or);
            return _t.invert(kn, Wr);
          }, Ct;
        }
        function Me(Qe) {
          var nt = x(Qe), dt = u2(Qe);
          return function(_t, Ct) {
            var St = u2(Ct), Lt = u2(_t) * St, ir = x(_t) * St, or = x(Ct);
            return [l(ir, Lt * dt - or * nt), N2(or * dt + Lt * nt)];
          };
        }
        rt.invert = function(Qe, nt) {
          s(Qe) > 1 && (Qe = 2 * g(Qe) - Qe), s(nt) > 1 && (nt = 2 * g(nt) - nt);
          var dt = g(Qe), _t = g(nt), Ct = -dt * Qe, St = -_t * nt, Lt = St / Ct < 1, ir = function(wr, Er) {
            for (var Mr = 0, Wr = 1, kn = 0.5, On = 50; ; ) {
              var ta = kn * kn, sa = I2(kn), xa = N2(1 / I2(1 + ta)), la = 1 - ta + kn * (1 + ta) * xa, ci = (1 - sa) / la, Ci = I2(ci), Qi = ci * (1 + ta), Zi = Ci * (1 - ta), eo = I2(Qi - wr * wr), Es = Er + Zi + kn * eo;
              if (s(Wr - Mr) < 1e-12 || --On == 0 || Es === 0) break;
              Es > 0 ? Mr = kn : Wr = kn, kn = 0.5 * (Mr + Wr);
            }
            if (!On) return null;
            var vs = N2(sa), Vo = u2(vs), jo = 1 / Vo, ms = 2 * sa * Vo, al = (-la * Vo - (-3 * kn + xa * (1 + 3 * ta)) * ms * (1 - sa)) / (la * la);
            return [w / 4 * (wr * (-2 * jo * (0.5 * al / Ci * (1 - ta) - 2 * kn * Ci * ms) + -jo * ms * eo) + -jo * (kn * (1 + ta) * al + ci * (1 + 3 * ta) * ms) * N2(wr / I2(Qi))), vs];
          }(Lt ? St : Ct, Lt ? Ct : St), or = ir[0], nr = ir[1], fr = u2(nr);
          return Lt && (or = -_4 - or), [dt * (l(x(or) * fr, -x(nr)) + w), _t * N2(u2(or) * fr)];
        }, Ne.invert = function(Qe, nt) {
          var dt, _t, Ct, St, Lt, ir, or = (A2 - 1) / (A2 + 1), nr = I2(1 - or * or), fr = xe(_4, nr * nr), wr = (_t = -Qe, Ct = nr * nr, (dt = 0.5 * fr - nt) ? (St = He(dt, Ct), _t ? (ir = (Lt = He(_t, 1 - Ct))[1] * Lt[1] + Ct * St[0] * St[0] * Lt[0] * Lt[0], [[St[0] * Lt[2] / ir, St[1] * St[2] * Lt[0] * Lt[1] / ir], [St[1] * Lt[1] / ir, -St[0] * St[2] * Lt[0] * Lt[2] / ir], [St[2] * Lt[1] * Lt[2] / ir, -Ct * St[0] * St[1] * Lt[0] / ir]]) : [[St[0], 0], [St[1], 0], [St[2], 0]]) : [[0, (Lt = He(_t, 1 - Ct))[0] / Lt[1]], [1 / Lt[1], 0], [Lt[2] / Lt[1], 0]]), Er = function(Mr, Wr) {
            var kn = Wr[0] * Wr[0] + Wr[1] * Wr[1];
            return [(Mr[0] * Wr[0] + Mr[1] * Wr[1]) / kn, (Mr[1] * Wr[0] - Mr[0] * Wr[1]) / kn];
          }(wr[0], wr[1]);
          return [l(Er[1], Er[0]) / -1, 2 * i(c(-0.5 * h(or * Er[0] * Er[0] + or * Er[1] * Er[1]))) - _4];
        };
        var Le = N2(1 - 1 / 3) * E2, ze = We(0);
        function ft(Qe) {
          var nt = Le * F13, dt = Be(w, nt)[0] - Be(-w, nt)[0], _t = ze(0, nt)[1], Ct = Be(0, nt)[1], St = S2 - Ct, Lt = C2 / Qe, ir = 4 / C2, or = _t + St * St * 4 / C2;
          function nr(fr, wr) {
            var Er, Mr = s(wr);
            if (Mr > nt) {
              var Wr = d(Qe - 1, p(0, f((fr + w) / Lt)));
              (Er = Be(fr += w * (Qe - 1) / Qe - Wr * Lt, Mr))[0] = Er[0] * C2 / dt - C2 * (Qe - 1) / (2 * Qe) + Wr * C2 / Qe, Er[1] = _t + 4 * (Er[1] - Ct) * St / C2, wr < 0 && (Er[1] = -Er[1]);
            } else Er = ze(fr, wr);
            return Er[0] *= ir, Er[1] /= or, Er;
          }
          return nr.invert = function(fr, wr) {
            fr /= ir;
            var Er = s(wr *= or);
            if (Er > _t) {
              var Mr = d(Qe - 1, p(0, f((fr + w) / Lt)));
              fr = (fr + w * (Qe - 1) / Qe - Mr * Lt) * dt / C2;
              var Wr = Be.invert(fr, 0.25 * (Er - _t) * C2 / St + Ct);
              return Wr[0] -= w * (Qe - 1) / Qe - Mr * Lt, wr < 0 && (Wr[1] = -Wr[1]), Wr;
            }
            return ze.invert(fr, wr);
          }, nr;
        }
        function De(Qe, nt) {
          return [Qe, 1 & nt ? 90 - y : Le];
        }
        function Je(Qe, nt) {
          return [Qe, 1 & nt ? -90 + y : -Le];
        }
        function tt(Qe) {
          return [Qe[0] * (1 - y), Qe[1]];
        }
        function vt(Qe) {
          var nt, dt = 1 + Qe, _t = N2(x(1 / dt)), Ct = 2 * I2(w / (nt = w + 4 * _t * dt)), St = 0.5 * Ct * (dt + I2(Qe * (2 + Qe))), Lt = Qe * Qe, ir = dt * dt;
          function or(nr, fr) {
            var wr, Er, Mr = 1 - x(fr);
            if (Mr && Mr < 2) {
              var Wr, kn = _4 - fr, On = 25;
              do {
                var ta = x(kn), sa = u2(kn), xa = _t + l(ta, dt - sa), la = 1 + ir - 2 * dt * sa;
                kn -= Wr = (kn - Lt * _t - dt * ta + la * xa - 0.5 * Mr * nt) / (2 * dt * ta * xa);
              } while (s(Wr) > 1e-12 && --On > 0);
              wr = Ct * I2(la), Er = nr * xa / w;
            } else wr = Ct * (Qe + Mr), Er = nr * _t / w;
            return [wr * x(Er), St - wr * u2(Er)];
          }
          return or.invert = function(nr, fr) {
            var wr = nr * nr + (fr -= St) * fr, Er = (1 + ir - wr / (Ct * Ct)) / (2 * dt), Mr = D2(Er), Wr = x(Mr), kn = _t + l(Wr, dt - Er);
            return [N2(nr / I2(wr)) * w / kn, N2(1 - 2 * (Mr - Lt * _t - dt * Wr + (1 + ir - 2 * dt * Er) * kn) / nt)];
          }, or;
        }
        function kt(Qe, nt) {
          return nt > -0.7109889596207567 ? ((Qe = ae(Qe, nt))[1] += 0.0528035274542, Qe) : he(Qe, nt);
        }
        function jt(Qe, nt) {
          return s(nt) > 0.7109889596207567 ? ((Qe = ae(Qe, nt))[1] -= nt > 0 ? 0.0528035274542 : -0.0528035274542, Qe) : he(Qe, nt);
        }
        function Vt(Qe, nt, dt, _t) {
          var Ct = I2(4 * w / (2 * dt + (1 + Qe - nt / 2) * x(2 * dt) + (Qe + nt) / 2 * x(4 * dt) + nt / 2 * x(6 * dt))), St = I2(_t * x(dt) * I2((1 + Qe * u2(2 * dt) + nt * u2(4 * dt)) / (1 + Qe + nt))), Lt = dt * or(1);
          function ir(wr) {
            return I2(1 + Qe * u2(2 * wr) + nt * u2(4 * wr));
          }
          function or(wr) {
            var Er = wr * dt;
            return (2 * Er + (1 + Qe - nt / 2) * x(2 * Er) + (Qe + nt) / 2 * x(4 * Er) + nt / 2 * x(6 * Er)) / dt;
          }
          function nr(wr) {
            return ir(wr) * x(wr);
          }
          var fr = function(wr, Er) {
            var Mr = dt * te(or, Lt * x(Er) / dt, Er / w);
            isNaN(Mr) && (Mr = dt * g(Er));
            var Wr = Ct * ir(Mr);
            return [Wr * St * wr / w * u2(Mr), Wr / St * x(Mr)];
          };
          return fr.invert = function(wr, Er) {
            var Mr = te(nr, Er * St / Ct);
            return [wr * w / (u2(Mr) * Ct * St * ir(Mr)), N2(dt * or(Mr / dt) / Lt)];
          }, dt === 0 && (Ct = I2(_t / w), (fr = function(wr, Er) {
            return [wr * Ct, x(Er) / Ct];
          }).invert = function(wr, Er) {
            return [wr / Ct, N2(Er * Ct)];
          }), fr;
        }
        function Kt(Qe, nt, dt, _t, Ct) {
          _t === void 0 && (_t = 1e-8), Ct === void 0 && (Ct = 20);
          var St = Qe(nt), Lt = Qe(0.5 * (nt + dt)), ir = Qe(dt);
          return function or(nr, fr, wr, Er, Mr, Wr, kn, On, ta, sa, xa) {
            if (xa.nanEncountered) return NaN;
            var la, ci, Ci, Qi, Zi, eo, Es, vs, Vo, jo;
            if (ci = nr(fr + 0.25 * (la = wr - fr)), Ci = nr(wr - 0.25 * la), isNaN(ci)) xa.nanEncountered = true;
            else {
              if (!isNaN(Ci)) return jo = ((eo = (Qi = la * (Er + 4 * ci + Mr) / 12) + (Zi = la * (Mr + 4 * Ci + Wr) / 12)) - kn) / 15, sa > ta ? (xa.maxDepthCount++, eo + jo) : Math.abs(jo) < On ? eo + jo : (vs = or(nr, fr, Es = fr + 0.5 * la, Er, ci, Mr, Qi, 0.5 * On, ta, sa + 1, xa), isNaN(vs) ? (xa.nanEncountered = true, NaN) : (Vo = or(nr, Es, wr, Mr, Ci, Wr, Zi, 0.5 * On, ta, sa + 1, xa), isNaN(Vo) ? (xa.nanEncountered = true, NaN) : vs + Vo));
              xa.nanEncountered = true;
            }
          }(Qe, nt, dt, St, Lt, ir, (St + 4 * Lt + ir) * (dt - nt) / 6, _t, Ct, 1, { maxDepthCount: 0, nanEncountered: false });
        }
        function rr(Qe, nt, dt) {
          function _t(Mr) {
            return Qe + (1 - Qe) * v(1 - v(Mr, nt), 1 / nt);
          }
          function Ct(Mr) {
            return Kt(_t, 0, Mr, 1e-4);
          }
          for (var St = 1 / Ct(1), Lt = 1e3, ir = (1 + 1e-8) * St, or = [], nr = 0; nr <= Lt; nr++) or.push(Ct(nr / Lt) * ir);
          function fr(Mr) {
            var Wr = 0, kn = Lt, On = 500;
            do
              or[On] > Mr ? kn = On : Wr = On, On = Wr + kn >> 1;
            while (On > Wr);
            var ta = or[On + 1] - or[On];
            return ta && (ta = (Mr - or[On + 1]) / ta), (On + 1 + ta) / Lt;
          }
          var wr = 2 * fr(1) / w * St / dt, Er = function(Mr, Wr) {
            var kn = fr(s(x(Wr))), On = _t(kn) * Mr;
            return kn /= wr, [On, Wr >= 0 ? kn : -kn];
          };
          return Er.invert = function(Mr, Wr) {
            var kn;
            return s(Wr *= wr) < 1 && (kn = g(Wr) * N2(Ct(s(Wr)) * St)), [Mr / _t(s(Wr)), kn];
          }, Er;
        }
        function Tr(Qe, nt) {
          return s(Qe[0] - nt[0]) < y && s(Qe[1] - nt[1]) < y;
        }
        function yr(Qe, nt) {
          for (var dt, _t, Ct, St = -1, Lt = Qe.length, ir = Qe[0], or = []; ++St < Lt; ) {
            _t = ((dt = Qe[St])[0] - ir[0]) / nt, Ct = (dt[1] - ir[1]) / nt;
            for (var nr = 0; nr < nt; ++nr) or.push([ir[0] + nr * _t, ir[1] + nr * Ct]);
            ir = dt;
          }
          return or.push(dt), or;
        }
        function pr(Qe) {
          var nt, dt, _t, Ct, St, Lt, ir, or = [], nr = Qe[0].length;
          for (ir = 0; ir < nr; ++ir) dt = (nt = Qe[0][ir])[0][0], _t = nt[0][1], Ct = nt[1][1], St = nt[2][0], Lt = nt[2][1], or.push(yr([[dt + y, _t + y], [dt + y, Ct - y], [St - y, Ct - y], [St - y, Lt + y]], 30));
          for (ir = Qe[1].length - 1; ir >= 0; --ir) dt = (nt = Qe[1][ir])[0][0], _t = nt[0][1], Ct = nt[1][1], St = nt[2][0], Lt = nt[2][1], or.push(yr([[St - y, Lt - y], [St - y, Ct + y], [dt + y, Ct + y], [dt + y, _t - y]], 30));
          return { type: "Polygon", coordinates: [o.merge(or)] };
        }
        function lr(Qe, nt, dt) {
          var _t, Ct;
          function St(or, nr) {
            for (var fr = nr < 0 ? -1 : 1, wr = nt[+(nr < 0)], Er = 0, Mr = wr.length - 1; Er < Mr && or > wr[Er][2][0]; ++Er) ;
            var Wr = Qe(or - wr[Er][1][0], nr);
            return Wr[0] += Qe(wr[Er][1][0], fr * nr > fr * wr[Er][0][1] ? wr[Er][0][1] : nr)[0], Wr;
          }
          dt ? St.invert = dt(St) : Qe.invert && (St.invert = function(or, nr) {
            for (var fr = Ct[+(nr < 0)], wr = nt[+(nr < 0)], Er = 0, Mr = fr.length; Er < Mr; ++Er) {
              var Wr = fr[Er];
              if (Wr[0][0] <= or && or < Wr[1][0] && Wr[0][1] <= nr && nr < Wr[1][1]) {
                var kn = Qe.invert(or - Qe(wr[Er][1][0], 0)[0], nr);
                return kn[0] += wr[Er][1][0], Tr(St(kn[0], kn[1]), [or, nr]) ? kn : null;
              }
            }
          });
          var Lt = a.geoProjection(St), ir = Lt.stream;
          return Lt.stream = function(or) {
            var nr = Lt.rotate(), fr = ir(or), wr = (Lt.rotate([0, 0]), ir(or));
            return Lt.rotate(nr), fr.sphere = function() {
              a.geoStream(_t, wr);
            }, fr;
          }, Lt.lobes = function(or) {
            return arguments.length ? (_t = pr(or), nt = or.map(function(nr) {
              return nr.map(function(fr) {
                return [[fr[0][0] * F13, fr[0][1] * F13], [fr[1][0] * F13, fr[1][1] * F13], [fr[2][0] * F13, fr[2][1] * F13]];
              });
            }), Ct = nt.map(function(nr) {
              return nr.map(function(fr) {
                var wr, Er = Qe(fr[0][0], fr[0][1])[0], Mr = Qe(fr[2][0], fr[2][1])[0], Wr = Qe(fr[1][0], fr[0][1])[1], kn = Qe(fr[1][0], fr[1][1])[1];
                return Wr > kn && (wr = Wr, Wr = kn, kn = wr), [[Er, Wr], [Mr, kn]];
              });
            }), Lt) : nt.map(function(nr) {
              return nr.map(function(fr) {
                return [[fr[0][0] * E2, fr[0][1] * E2], [fr[1][0] * E2, fr[1][1] * E2], [fr[2][0] * E2, fr[2][1] * E2]];
              });
            });
          }, nt != null && Lt.lobes(nt), Lt;
        }
        kt.invert = function(Qe, nt) {
          return nt > -0.7109889596207567 ? ae.invert(Qe, nt - 0.0528035274542) : he.invert(Qe, nt);
        }, jt.invert = function(Qe, nt) {
          return s(nt) > 0.7109889596207567 ? ae.invert(Qe, nt + (nt > 0 ? 0.0528035274542 : -0.0528035274542)) : he.invert(Qe, nt);
        };
        var _r = [[[[-180, 0], [-100, 90], [-40, 0]], [[-40, 0], [30, 90], [180, 0]]], [[[-180, 0], [-160, -90], [-100, 0]], [[-100, 0], [-60, -90], [-20, 0]], [[-20, 0], [20, -90], [80, 0]], [[80, 0], [140, -90], [180, 0]]]], $r = [[[[-180, 0], [-100, 90], [-40, 0]], [[-40, 0], [30, 90], [180, 0]]], [[[-180, 0], [-160, -90], [-100, 0]], [[-100, 0], [-60, -90], [-20, 0]], [[-20, 0], [20, -90], [80, 0]], [[80, 0], [140, -90], [180, 0]]]], Ar = [[[[-180, 0], [-100, 90], [-40, 0]], [[-40, 0], [30, 90], [180, 0]]], [[[-180, 0], [-160, -90], [-100, 0]], [[-100, 0], [-60, -90], [-20, 0]], [[-20, 0], [20, -90], [80, 0]], [[80, 0], [140, -90], [180, 0]]]], Qr = [[[[-180, 0], [-90, 90], [0, 0]], [[0, 0], [90, 90], [180, 0]]], [[[-180, 0], [-90, -90], [0, 0]], [[0, 0], [90, -90], [180, 0]]]], hn = [[[[-180, 35], [-30, 90], [0, 35]], [[0, 35], [30, 90], [180, 35]]], [[[-180, -10], [-102, -90], [-65, -10]], [[-65, -10], [5, -90], [77, -10]], [[77, -10], [103, -90], [180, -10]]]], wn = [[[[-180, 0], [-110, 90], [-40, 0]], [[-40, 0], [0, 90], [40, 0]], [[40, 0], [110, 90], [180, 0]]], [[[-180, 0], [-110, -90], [-40, 0]], [[-40, 0], [0, -90], [40, 0]], [[40, 0], [110, -90], [180, 0]]]];
        function Yn(Qe, nt) {
          return [3 / C2 * Qe * I2(w * w / 3 - nt * nt), nt];
        }
        function Xn(Qe) {
          function nt(dt, _t) {
            if (s(s(_t) - _4) < y) return [0, _t < 0 ? -2 : 2];
            var Ct = x(_t), St = v((1 + Ct) / (1 - Ct), Qe / 2), Lt = 0.5 * (St + 1 / St) + u2(dt *= Qe);
            return [2 * x(dt) / Lt, (St - 1 / St) / Lt];
          }
          return nt.invert = function(dt, _t) {
            var Ct = s(_t);
            if (s(Ct - 2) < y) return dt ? null : [0, g(_t) * _4];
            if (Ct > 2) return null;
            var St = (dt /= 2) * dt, Lt = (_t /= 2) * _t, ir = 2 * _t / (1 + St + Lt);
            return ir = v((1 + ir) / (1 - ir), 1 / Qe), [l(2 * dt, 1 - St - Lt) / Qe, N2((ir - 1) / (ir + 1))];
          }, nt;
        }
        Yn.invert = function(Qe, nt) {
          return [C2 / 3 * Qe / I2(w * w / 3 - nt * nt), nt];
        };
        var Wn = w / A2;
        function _n(Qe, nt) {
          return [Qe * (1 + I2(u2(nt))) / 2, nt / (u2(nt / 2) * u2(Qe / 6))];
        }
        function qr(Qe, nt) {
          var dt = Qe * Qe, _t = nt * nt;
          return [Qe * (0.975534 + _t * (-0.0143059 * dt - 0.119161 + -0.0547009 * _t)), nt * (1.00384 + dt * (0.0802894 + -0.02855 * _t + 199025e-9 * dt) + _t * (0.0998909 + -0.0491032 * _t))];
        }
        function Nr(Qe, nt) {
          return [x(Qe) / u2(nt), b(nt) * u2(Qe)];
        }
        function Zr(Qe) {
          var nt = u2(Qe), dt = b(k + Qe / 2);
          function _t(Ct, St) {
            var Lt = St - Qe, ir = s(Lt) < y ? Ct * nt : s(ir = k + St / 2) < y || s(s(ir) - _4) < y ? 0 : Ct * Lt / h(b(ir) / dt);
            return [ir, Lt];
          }
          return _t.invert = function(Ct, St) {
            var Lt, ir = St + Qe;
            return [s(St) < y ? Ct / nt : s(Lt = k + ir / 2) < y || s(s(Lt) - _4) < y ? 0 : Ct * h(b(Lt) / dt) / St, ir];
          }, _t;
        }
        function oa(Qe, nt) {
          return [Qe, 1.25 * h(b(k + 0.4 * nt))];
        }
        function tn(Qe) {
          var nt = Qe.length - 1;
          function dt(_t, Ct) {
            for (var St, Lt = u2(Ct), ir = 2 / (1 + Lt * u2(_t)), or = ir * Lt * x(_t), nr = ir * x(Ct), fr = nt, wr = Qe[fr], Er = wr[0], Mr = wr[1]; --fr >= 0; ) Er = (wr = Qe[fr])[0] + or * (St = Er) - nr * Mr, Mr = wr[1] + or * Mr + nr * St;
            return [Er = or * (St = Er) - nr * Mr, Mr = or * Mr + nr * St];
          }
          return dt.invert = function(_t, Ct) {
            var St = 20, Lt = _t, ir = Ct;
            do {
              for (var or, nr = nt, fr = Qe[nr], wr = fr[0], Er = fr[1], Mr = 0, Wr = 0; --nr >= 0; ) Mr = wr + Lt * (or = Mr) - ir * Wr, Wr = Er + Lt * Wr + ir * or, wr = (fr = Qe[nr])[0] + Lt * (or = wr) - ir * Er, Er = fr[1] + Lt * Er + ir * or;
              var kn, On, ta = (Mr = wr + Lt * (or = Mr) - ir * Wr) * Mr + (Wr = Er + Lt * Wr + ir * or) * Wr;
              Lt -= kn = ((wr = Lt * (or = wr) - ir * Er - _t) * Mr + (Er = Lt * Er + ir * or - Ct) * Wr) / ta, ir -= On = (Er * Mr - wr * Wr) / ta;
            } while (s(kn) + s(On) > 1e-12 && --St > 0);
            if (St) {
              var sa = I2(Lt * Lt + ir * ir), xa = 2 * i(0.5 * sa), la = x(xa);
              return [l(Lt * la, sa * u2(xa)), sa ? N2(ir * la / sa) : 0];
            }
          }, dt;
        }
        _n.invert = function(Qe, nt) {
          var dt = s(Qe), _t = s(nt), Ct = y, St = _4;
          _t < Wn ? St *= _t / Wn : Ct += 6 * D2(Wn / _t);
          for (var Lt = 0; Lt < 25; Lt++) {
            var ir = x(St), or = I2(u2(St)), nr = x(St / 2), fr = u2(St / 2), wr = x(Ct / 6), Er = u2(Ct / 6), Mr = 0.5 * Ct * (1 + or) - dt, Wr = St / (fr * Er) - _t, kn = or ? -0.25 * Ct * ir / or : 0, On = 0.5 * (1 + or), ta = (1 + 0.5 * St * nr / fr) / (fr * Er), sa = St / fr * (wr / 6) / (Er * Er), xa = kn * sa - ta * On, la = (Mr * sa - Wr * On) / xa, ci = (Wr * kn - Mr * ta) / xa;
            if (St -= la, Ct -= ci, s(la) < y && s(ci) < y) break;
          }
          return [Qe < 0 ? -Ct : Ct, nt < 0 ? -St : St];
        }, qr.invert = function(Qe, nt) {
          var dt = g(Qe) * w, _t = nt / 2, Ct = 50;
          do {
            var St = dt * dt, Lt = _t * _t, ir = dt * _t, or = dt * (0.975534 + Lt * (-0.0143059 * St - 0.119161 + -0.0547009 * Lt)) - Qe, nr = _t * (1.00384 + St * (0.0802894 + -0.02855 * Lt + 199025e-9 * St) + Lt * (0.0998909 + -0.0491032 * Lt)) - nt, fr = 0.975534 - Lt * (0.119161 + 3 * St * 0.0143059 + 0.0547009 * Lt), wr = -ir * (0.238322 + 0.2188036 * Lt + 0.0286118 * St), Er = ir * (0.1605788 + 7961e-7 * St + -0.0571 * Lt), Mr = 1.00384 + St * (0.0802894 + 199025e-9 * St) + Lt * (3 * (0.0998909 - 0.02855 * St) - 0.245516 * Lt), Wr = wr * Er - Mr * fr, kn = (nr * wr - or * Mr) / Wr, On = (or * Er - nr * fr) / Wr;
            dt -= kn, _t -= On;
          } while ((s(kn) > y || s(On) > y) && --Ct > 0);
          return Ct && [dt, _t];
        }, Nr.invert = function(Qe, nt) {
          var dt = Qe * Qe, _t = nt * nt + 1, Ct = dt + _t, St = Qe ? T2 * I2((Ct - I2(Ct * Ct - 4 * dt)) / dt) : 1 / I2(_t);
          return [N2(Qe * St), g(nt) * D2(St)];
        }, oa.invert = function(Qe, nt) {
          return [Qe, 2.5 * i(c(0.8 * nt)) - 0.625 * w];
        };
        var Zn = [[0.9972523, 0], [52513e-7, -41175e-7], [74606e-7, 48125e-7], [-0.0153783, -0.1968253], [0.0636871, -0.1408027], [0.3660976, -0.2937382]], Ln = [[0.98879, 0], [0, 0], [-0.050909, 0], [0, 0], [0.075528, 0]], gn = [[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]], na = [[0.9245, 0], [0, 0], [0.01943, 0]], sr = [[0.721316, 0], [0, 0], [-881625e-8, -617325e-8]];
        function Ut(Qe, nt) {
          var dt = a.geoProjection(tn(Qe)).rotate(nt).clipAngle(90), _t = a.geoRotation(nt), Ct = dt.center;
          return delete dt.rotate, dt.center = function(St) {
            return arguments.length ? Ct(_t(St)) : _t.invert(Ct());
          }, dt;
        }
        var Zt = I2(6), xr = I2(7);
        function Fr(Qe, nt) {
          var dt = N2(7 * x(nt) / (3 * Zt));
          return [Zt * Qe * (2 * u2(2 * dt / 3) - 1) / xr, 9 * x(dt / 3) / xr];
        }
        function pn(Qe, nt) {
          for (var dt, _t = (1 + T2) * x(nt), Ct = nt, St = 0; St < 25 && (Ct -= dt = (x(Ct / 2) + x(Ct) - _t) / (0.5 * u2(Ct / 2) + u2(Ct)), !(s(dt) < y)); St++) ;
          return [Qe * (1 + 2 * u2(Ct) / u2(Ct / 2)) / (3 * A2), 2 * I2(3) * x(Ct / 2) / I2(2 + A2)];
        }
        function un(Qe, nt) {
          for (var dt, _t = I2(6 / (4 + w)), Ct = (1 + w / 4) * x(nt), St = nt / 2, Lt = 0; Lt < 25 && (St -= dt = (St / 2 + x(St) - Ct) / (0.5 + u2(St)), !(s(dt) < y)); Lt++) ;
          return [_t * (0.5 + u2(St)) * Qe / 1.5, _t * St];
        }
        function Ir(Qe, nt) {
          var dt = nt * nt, _t = dt * dt, Ct = dt * _t;
          return [Qe * (0.84719 - 0.13063 * dt + Ct * Ct * (0.05494 * dt - 0.04515 - 0.02326 * _t + 331e-5 * Ct)), nt * (1.01183 + _t * _t * (0.01926 * dt - 0.02625 - 396e-5 * _t))];
        }
        function Cr(Qe, nt) {
          return [Qe * (1 + u2(nt)) / 2, 2 * (nt - b(nt / 2))];
        }
        Fr.invert = function(Qe, nt) {
          var dt = 3 * N2(nt * xr / 9);
          return [Qe * xr / (Zt * (2 * u2(2 * dt / 3) - 1)), N2(3 * x(dt) * Zt / 7)];
        }, pn.invert = function(Qe, nt) {
          var dt = nt * I2(2 + A2) / (2 * I2(3)), _t = 2 * N2(dt);
          return [3 * A2 * Qe / (1 + 2 * u2(_t) / u2(_t / 2)), N2((dt + x(_t)) / (1 + T2))];
        }, un.invert = function(Qe, nt) {
          var dt = I2(6 / (4 + w)), _t = nt / dt;
          return s(s(_t) - _4) < y && (_t = _t < 0 ? -_4 : _4), [1.5 * Qe / (dt * (0.5 + u2(_t))), N2((_t / 2 + x(_t)) / (1 + w / 4))];
        }, Ir.invert = function(Qe, nt) {
          var dt, _t, Ct, St, Lt = nt, ir = 25;
          do
            Lt -= dt = (Lt * (1.01183 + (Ct = (_t = Lt * Lt) * _t) * Ct * (0.01926 * _t - 0.02625 - 396e-5 * Ct)) - nt) / (1.01183 + Ct * Ct * (0.21186 * _t - 0.23625 + -0.05148 * Ct));
          while (s(dt) > 1e-12 && --ir > 0);
          return [Qe / (0.84719 - 0.13063 * (_t = Lt * Lt) + (St = _t * (Ct = _t * _t)) * St * (0.05494 * _t - 0.04515 - 0.02326 * Ct + 331e-5 * St)), Lt];
        }, Cr.invert = function(Qe, nt) {
          for (var dt = nt / 2, _t = 0, Ct = 1 / 0; _t < 10 && s(Ct) > y; ++_t) {
            var St = u2(nt / 2);
            nt -= Ct = (nt - b(nt / 2) - dt) / (1 - 0.5 / (St * St));
          }
          return [2 * Qe / (1 + u2(nt)), nt];
        };
        var Lr = [[[[-180, 0], [-90, 90], [0, 0]], [[0, 0], [90, 90], [180, 0]]], [[[-180, 0], [-90, -90], [0, 0]], [[0, 0], [90, -90], [180, 0]]]];
        function jr(Qe, nt) {
          var dt = x(nt), _t = u2(nt), Ct = g(Qe);
          if (Qe === 0 || s(nt) === _4) return [0, nt];
          if (nt === 0) return [Qe, 0];
          if (s(Qe) === _4) return [Qe * _t, _4 * dt];
          var St = w / (2 * Qe) - 2 * Qe / w, Lt = 2 * nt / w, ir = (1 - Lt * Lt) / (dt - Lt), or = St * St, nr = ir * ir, fr = 1 + or / nr, wr = 1 + nr / or, Er = (St * dt / ir - St / 2) / fr, Mr = (nr * dt / or + ir / 2) / wr, Wr = Mr * Mr - (nr * dt * dt / or + ir * dt - 1) / wr;
          return [_4 * (Er + I2(Er * Er + _t * _t / fr) * Ct), _4 * (Mr + I2(Wr < 0 ? 0 : Wr) * g(-nt * St) * Ct)];
        }
        jr.invert = function(Qe, nt) {
          var dt = (Qe /= _4) * Qe, _t = dt + (nt /= _4) * nt, Ct = w * w;
          return [Qe ? (_t - 1 + I2((1 - _t) * (1 - _t) + 4 * dt)) / (2 * Qe) * _4 : 0, te(function(St) {
            return _t * (w * x(St) - 2 * St) * w + 4 * St * St * (nt - x(St)) + 2 * w * St - Ct * nt;
          }, 0)];
        };
        function Rr(Qe, nt) {
          var dt = nt * nt;
          return [Qe, nt * (1.0148 + dt * dt * (0.23185 + dt * (0.02406 * dt - 0.14499)))];
        }
        function vn(Qe, nt) {
          if (s(nt) < y) return [Qe, 0];
          var dt = b(nt), _t = Qe * x(nt);
          return [x(_t) / dt, nt + (1 - u2(_t)) / dt];
        }
        function Mn(Qe, nt) {
          var dt = bn(Qe[1], Qe[0]), _t = bn(nt[1], nt[0]), Ct = function(Lt, ir) {
            return l(Lt[0] * ir[1] - Lt[1] * ir[0], Lt[0] * ir[0] + Lt[1] * ir[1]);
          }(dt, _t), St = Bn(dt) / Bn(_t);
          return jn([1, 0, Qe[0][0], 0, 1, Qe[0][1]], jn([St, 0, 0, 0, St, 0], jn([u2(Ct), x(Ct), 0, -x(Ct), u2(Ct), 0], [1, 0, -nt[0][0], 0, 1, -nt[0][1]])));
        }
        function jn(Qe, nt) {
          return [Qe[0] * nt[0] + Qe[1] * nt[3], Qe[0] * nt[1] + Qe[1] * nt[4], Qe[0] * nt[2] + Qe[1] * nt[5] + Qe[2], Qe[3] * nt[0] + Qe[4] * nt[3], Qe[3] * nt[1] + Qe[4] * nt[4], Qe[3] * nt[2] + Qe[4] * nt[5] + Qe[5]];
        }
        function bn(Qe, nt) {
          return [Qe[0] - nt[0], Qe[1] - nt[1]];
        }
        function Bn(Qe) {
          return I2(Qe[0] * Qe[0] + Qe[1] * Qe[1]);
        }
        function sn(Qe, nt, dt) {
          function _t(Lt, ir) {
            var or, nr = nt(Lt, ir), fr = nr.project([Lt * E2, ir * E2]);
            return (or = nr.transform) ? [or[0] * fr[0] + or[1] * fr[1] + or[2], -(or[3] * fr[0] + or[4] * fr[1] + or[5])] : (fr[1] = -fr[1], fr);
          }
          (function Lt(ir, or) {
            if (ir.edges = function(Wr) {
              for (var kn = Wr.length, On = [], ta = Wr[kn - 1], sa = 0; sa < kn; ++sa) On.push([ta, ta = Wr[sa]]);
              return On;
            }(ir.face), or.face) {
              var nr = ir.shared = function(Wr, kn) {
                for (var On, ta, sa = Wr.length, xa = null, la = 0; la < sa; ++la) {
                  On = Wr[la];
                  for (var ci = kn.length; --ci >= 0; ) if (ta = kn[ci], On[0] === ta[0] && On[1] === ta[1]) {
                    if (xa) return [xa, On];
                    xa = On;
                  }
                }
              }(ir.face, or.face), fr = Mn(nr.map(or.project), nr.map(ir.project));
              ir.transform = or.transform ? jn(or.transform, fr) : fr;
              for (var wr = or.edges, Er = 0, Mr = wr.length; Er < Mr; ++Er) an(nr[0], wr[Er][1]) && an(nr[1], wr[Er][0]) && (wr[Er] = ir), an(nr[0], wr[Er][0]) && an(nr[1], wr[Er][1]) && (wr[Er] = ir);
              for (wr = ir.edges, Er = 0, Mr = wr.length; Er < Mr; ++Er) an(nr[0], wr[Er][0]) && an(nr[1], wr[Er][1]) && (wr[Er] = or), an(nr[0], wr[Er][1]) && an(nr[1], wr[Er][0]) && (wr[Er] = or);
            } else ir.transform = or.transform;
            return ir.children && ir.children.forEach(function(Wr) {
              Lt(Wr, ir);
            }), ir;
          })(Qe, { transform: null }), Sn(Qe) && (_t.invert = function(Lt, ir) {
            var or = function nr(fr, wr) {
              var Er = fr.project.invert, Mr = fr.transform, Wr = wr;
              if (Mr && (Mr = function(xa) {
                var la = 1 / (xa[0] * xa[4] - xa[1] * xa[3]);
                return [la * xa[4], -la * xa[1], la * (xa[1] * xa[5] - xa[2] * xa[4]), -la * xa[3], la * xa[0], la * (xa[2] * xa[3] - xa[0] * xa[5])];
              }(Mr), Wr = [Mr[0] * Wr[0] + Mr[1] * Wr[1] + Mr[2], Mr[3] * Wr[0] + Mr[4] * Wr[1] + Mr[5]]), Er && fr === function(xa) {
                return nt(xa[0] * F13, xa[1] * F13);
              }(kn = Er(Wr))) return kn;
              for (var kn, On = fr.children, ta = 0, sa = On && On.length; ta < sa; ++ta) if (kn = nr(On[ta], wr)) return kn;
            }(Qe, [Lt, -ir]);
            return or && (or[0] *= F13, or[1] *= F13, or);
          });
          var Ct = a.geoProjection(_t), St = Ct.stream;
          return Ct.stream = function(Lt) {
            var ir = Ct.rotate(), or = St(Lt), nr = (Ct.rotate([0, 0]), St(Lt));
            return Ct.rotate(ir), or.sphere = function() {
              nr.polygonStart(), nr.lineStart(), function fr(wr, Er, Mr) {
                var Wr, kn, On = Er.edges, ta = On.length, sa = { type: "MultiPoint", coordinates: Er.face }, xa = Er.face.filter(function(Es) {
                  return s(Es[1]) !== 90;
                }), la = a.geoBounds({ type: "MultiPoint", coordinates: xa }), ci = false, Ci = -1, Qi = la[1][0] - la[0][0], Zi = Qi === 180 || Qi === 360 ? [(la[0][0] + la[1][0]) / 2, (la[0][1] + la[1][1]) / 2] : a.geoCentroid(sa);
                if (Mr) for (; ++Ci < ta && On[Ci] !== Mr; ) ;
                ++Ci;
                for (var eo = 0; eo < ta; ++eo) kn = On[(eo + Ci) % ta], Array.isArray(kn) ? (ci || (wr.point((Wr = a.geoInterpolate(kn[0], Zi)(y))[0], Wr[1]), ci = true), wr.point((Wr = a.geoInterpolate(kn[1], Zi)(y))[0], Wr[1])) : (ci = false, kn !== Mr && fr(wr, kn, Er));
              }(nr, Qe), nr.lineEnd(), nr.polygonEnd();
            }, or;
          }, Ct.angle(dt == null ? -30 : dt * E2);
        }
        function an(Qe, nt) {
          return Qe && nt && Qe[0] === nt[0] && Qe[1] === nt[1];
        }
        function Sn(Qe) {
          return Qe.project.invert || Qe.children && Qe.children.some(Sn);
        }
        Rr.invert = function(Qe, nt) {
          nt > 1.790857183 ? nt = 1.790857183 : nt < -1.790857183 && (nt = -1.790857183);
          var dt, _t = nt;
          do {
            var Ct = _t * _t;
            _t -= dt = (_t * (1.0148 + Ct * Ct * (0.23185 + Ct * (0.02406 * Ct - 0.14499))) - nt) / (1.0148 + Ct * Ct * (5 * 0.23185 + Ct * (0.21654 * Ct - 1.01493)));
          } while (s(dt) > y);
          return [Qe, _t];
        }, vn.invert = function(Qe, nt) {
          if (s(nt) < y) return [Qe, 0];
          var dt, _t = Qe * Qe + nt * nt, Ct = 0.5 * nt, St = 10;
          do {
            var Lt = b(Ct), ir = 1 / u2(Ct), or = _t - 2 * nt * Ct + Ct * Ct;
            Ct -= dt = (Lt * or + 2 * (Ct - nt)) / (2 + or * ir * ir + 2 * (Ct - nt) * Lt);
          } while (s(dt) > y && --St > 0);
          return Lt = b(Ct), [(s(nt) < s(Ct + 1 / Lt) ? N2(Qe * Lt) : g(nt) * g(Qe) * (D2(s(Qe * Lt)) + _4)) / x(Ct), Ct];
        };
        var Rn = [[0, 90], [-90, 0], [0, 0], [90, 0], [180, 0], [0, -90]], Kn = [[0, 2, 1], [0, 3, 2], [5, 1, 2], [5, 2, 3], [0, 1, 4], [0, 4, 3], [5, 4, 1], [5, 3, 4]].map(function(Qe) {
          return Qe.map(function(nt) {
            return Rn[nt];
          });
        }), qa = 2 / I2(3);
        function ka(Qe, nt) {
          var dt = Be(Qe, nt);
          return [dt[0] * qa, dt[1]];
        }
        function zn(Qe, nt) {
          for (var dt = 0, _t = Qe.length, Ct = 0; dt < _t; ++dt) Ct += Qe[dt] * nt[dt];
          return Ct;
        }
        function ja(Qe) {
          return [l(Qe[1], Qe[0]) * E2, N2(p(-1, d(1, Qe[2]))) * E2];
        }
        function si(Qe) {
          var nt = Qe[0] * F13, dt = Qe[1] * F13, _t = u2(dt);
          return [_t * u2(nt), _t * x(nt), x(dt)];
        }
        function ko() {
        }
        function Xs(Qe, nt) {
          return { type: "FeatureCollection", features: Qe.features.map(function(dt) {
            return Uo(dt, nt);
          }) };
        }
        function Uo(Qe, nt) {
          return { type: "Feature", id: Qe.id, properties: Qe.properties, geometry: As(Qe.geometry, nt) };
        }
        function As(Qe, nt) {
          if (!Qe) return null;
          if (Qe.type === "GeometryCollection") return function(_t, Ct) {
            return { type: "GeometryCollection", geometries: _t.geometries.map(function(St) {
              return As(St, Ct);
            }) };
          }(Qe, nt);
          var dt;
          switch (Qe.type) {
            case "Point":
            case "MultiPoint":
              dt = gu;
              break;
            case "LineString":
            case "MultiLineString":
              dt = Pc;
              break;
            case "Polygon":
            case "MultiPolygon":
            case "Sphere":
              dt = Zc;
              break;
            default:
              return null;
          }
          return a.geoStream(Qe, nt(dt)), dt.result();
        }
        ka.invert = function(Qe, nt) {
          return Be.invert(Qe / qa, nt);
        };
        var Ui = [], so = [], gu = { point: function(Qe, nt) {
          Ui.push([Qe, nt]);
        }, result: function() {
          var Qe = Ui.length ? Ui.length < 2 ? { type: "Point", coordinates: Ui[0] } : { type: "MultiPoint", coordinates: Ui } : null;
          return Ui = [], Qe;
        } }, Pc = { lineStart: ko, point: function(Qe, nt) {
          Ui.push([Qe, nt]);
        }, lineEnd: function() {
          Ui.length && (so.push(Ui), Ui = []);
        }, result: function() {
          var Qe = so.length ? so.length < 2 ? { type: "LineString", coordinates: so[0] } : { type: "MultiLineString", coordinates: so } : null;
          return so = [], Qe;
        } }, Zc = { polygonStart: ko, lineStart: ko, point: function(Qe, nt) {
          Ui.push([Qe, nt]);
        }, lineEnd: function() {
          var Qe = Ui.length;
          if (Qe) {
            do
              Ui.push(Ui[0].slice());
            while (++Qe < 4);
            so.push(Ui), Ui = [];
          }
        }, polygonEnd: ko, result: function() {
          if (!so.length) return null;
          var Qe = [], nt = [];
          return so.forEach(function(dt) {
            (function(_t) {
              if ((Ct = _t.length) < 4) return false;
              for (var Ct, St = 0, Lt = _t[Ct - 1][1] * _t[0][0] - _t[Ct - 1][0] * _t[0][1]; ++St < Ct; ) Lt += _t[St - 1][1] * _t[St][0] - _t[St - 1][0] * _t[St][1];
              return Lt <= 0;
            })(dt) ? Qe.push([dt]) : nt.push(dt);
          }), nt.forEach(function(dt) {
            var _t = dt[0];
            Qe.some(function(Ct) {
              if (function(St, Lt) {
                for (var ir = Lt[0], or = Lt[1], nr = false, fr = 0, wr = St.length, Er = wr - 1; fr < wr; Er = fr++) {
                  var Mr = St[fr], Wr = Mr[0], kn = Mr[1], On = St[Er], ta = On[0], sa = On[1];
                  kn > or ^ sa > or && ir < (ta - Wr) * (or - kn) / (sa - kn) + Wr && (nr = !nr);
                }
                return nr;
              }(Ct[0], _t)) return Ct.push(dt), true;
            }) || Qe.push([dt]);
          }), so = [], Qe.length ? Qe.length > 1 ? { type: "MultiPolygon", coordinates: Qe } : { type: "Polygon", coordinates: Qe[0] } : null;
        } };
        function Ll(Qe) {
          var nt = Qe(_4, 0)[0] - Qe(-_4, 0)[0];
          function dt(_t, Ct) {
            var St = s(_t) < _4, Lt = Qe(St ? _t : _t > 0 ? _t - w : _t + w, Ct), ir = (Lt[0] - Lt[1]) * T2, or = (Lt[0] + Lt[1]) * T2;
            if (St) return [ir, or];
            var nr = nt * T2, fr = ir > 0 ^ or > 0 ? -1 : 1;
            return [fr * ir - g(or) * nr, fr * or - g(ir) * nr];
          }
          return Qe.invert && (dt.invert = function(_t, Ct) {
            var St = (_t + Ct) * T2, Lt = (Ct - _t) * T2, ir = s(St) < 0.5 * nt && s(Lt) < 0.5 * nt;
            if (!ir) {
              var or = nt * T2, nr = St > 0 ^ Lt > 0 ? -1 : 1, fr = -nr * _t + (Lt > 0 ? 1 : -1) * or, wr = -nr * Ct + (St > 0 ? 1 : -1) * or;
              St = (-fr - wr) * T2, Lt = (fr - wr) * T2;
            }
            var Er = Qe.invert(St, Lt);
            return ir || (Er[0] += St > 0 ? w : -w), Er;
          }), a.geoProjection(dt).rotate([-90, -90, 45]).clipAngle(179.999);
        }
        function Hl() {
          return Ll(Ne).scale(111.48);
        }
        function Lc(Qe) {
          var nt = x(Qe);
          function dt(_t, Ct) {
            var St = nt ? b(_t * nt / 2) / nt : _t / 2;
            if (!Ct) return [2 * St, -Qe];
            var Lt = 2 * i(St * x(Ct)), ir = 1 / b(Ct);
            return [x(Lt) * ir, Ct + (1 - u2(Lt)) * ir - Qe];
          }
          return dt.invert = function(_t, Ct) {
            if (s(Ct += Qe) < y) return [nt ? 2 * i(nt * _t / 2) / nt : _t, 0];
            var St, Lt = _t * _t + Ct * Ct, ir = 0, or = 10;
            do {
              var nr = b(ir), fr = 1 / u2(ir), wr = Lt - 2 * Ct * ir + ir * ir;
              ir -= St = (nr * wr + 2 * (ir - Ct)) / (2 + wr * fr * fr + 2 * (ir - Ct) * nr);
            } while (s(St) > y && --or > 0);
            var Er = _t * (nr = b(ir)), Mr = b(s(Ct) < s(ir + 1 / nr) ? 0.5 * N2(Er) : 0.5 * D2(Er) + w / 4) / x(ir);
            return [nt ? 2 * i(nt * Mr) / nt : 2 * Mr, ir];
          }, dt;
        }
        var po = [[0.9986, -0.062], [1, 0], [0.9986, 0.062], [0.9954, 0.124], [0.99, 0.186], [0.9822, 0.248], [0.973, 0.31], [0.96, 0.372], [0.9427, 0.434], [0.9216, 0.4958], [0.8962, 0.5571], [0.8679, 0.6176], [0.835, 0.6769], [0.7986, 0.7346], [0.7597, 0.7903], [0.7186, 0.8435], [0.6732, 0.8936], [0.6213, 0.9394], [0.5722, 0.9761], [0.5322, 1]];
        function tc(Qe, nt) {
          var dt, _t = d(18, 36 * s(nt) / w), Ct = f(_t), St = _t - Ct, Lt = (dt = po[Ct])[0], ir = dt[1], or = (dt = po[++Ct])[0], nr = dt[1], fr = (dt = po[d(19, ++Ct)])[0], wr = dt[1];
          return [Qe * (or + St * (fr - Lt) / 2 + St * St * (fr - 2 * or + Lt) / 2), (nt > 0 ? _4 : -_4) * (nr + St * (wr - ir) / 2 + St * St * (wr - 2 * nr + ir) / 2)];
        }
        function yu(Qe, nt) {
          var dt = function(Lt) {
            function ir(or, nr) {
              var fr = u2(nr), wr = (Lt - 1) / (Lt - fr * u2(or));
              return [wr * fr * x(or), wr * x(nr)];
            }
            return ir.invert = function(or, nr) {
              var fr = or * or + nr * nr, wr = I2(fr), Er = (Lt - I2(1 - fr * (Lt + 1) / (Lt - 1))) / ((Lt - 1) / wr + wr / (Lt - 1));
              return [l(or * Er, wr * I2(1 - Er * Er)), wr ? N2(nr * Er / wr) : 0];
            }, ir;
          }(Qe);
          if (!nt) return dt;
          var _t = u2(nt), Ct = x(nt);
          function St(Lt, ir) {
            var or = dt(Lt, ir), nr = or[1], fr = nr * Ct / (Qe - 1) + _t;
            return [or[0] * _t / fr, nr / fr];
          }
          return St.invert = function(Lt, ir) {
            var or = (Qe - 1) / (Qe - 1 - ir * Ct);
            return dt.invert(or * Lt, or * ir * _t);
          }, St;
        }
        po.forEach(function(Qe) {
          Qe[1] *= 1.0144;
        }), tc.invert = function(Qe, nt) {
          var dt = nt / _4, _t = 90 * dt, Ct = d(18, s(_t / 5)), St = p(0, f(Ct));
          do {
            var Lt = po[St][1], ir = po[St + 1][1], or = po[d(19, St + 2)][1], nr = or - Lt, fr = or - 2 * ir + Lt, wr = 2 * (s(dt) - ir) / nr, Er = fr / nr, Mr = wr * (1 - Er * wr * (1 - 2 * Er * wr));
            if (Mr >= 0 || St === 1) {
              _t = (nt >= 0 ? 5 : -5) * (Mr + Ct);
              var Wr, kn = 50;
              do
                Mr = (Ct = d(18, s(_t) / 5)) - (St = f(Ct)), Lt = po[St][1], ir = po[St + 1][1], or = po[d(19, St + 2)][1], _t -= (Wr = (nt >= 0 ? _4 : -_4) * (ir + Mr * (or - Lt) / 2 + Mr * Mr * (or - 2 * ir + Lt) / 2) - nt) * E2;
              while (s(Wr) > 1e-12 && --kn > 0);
              break;
            }
          } while (--St >= 0);
          var On = po[St][0], ta = po[St + 1][0], sa = po[d(19, St + 2)][0];
          return [Qe / (ta + Mr * (sa - On) / 2 + Mr * Mr * (sa - 2 * ta + On) / 2), _t * F13];
        };
        var Ss = -179.9999, ql = 179.9999, xu = -89.9999;
        function zu(Qe) {
          return Qe.length > 0;
        }
        function nl(Qe) {
          return Qe === -90 || Qe === 90 ? [0, Qe] : [-180, (nt = Qe, Math.floor(1e4 * nt) / 1e4)];
          var nt;
        }
        function ss(Qe) {
          var nt = Qe[0], dt = Qe[1], _t = false;
          return nt <= Ss ? (nt = -180, _t = true) : nt >= ql && (nt = 180, _t = true), dt <= xu ? (dt = -90, _t = true) : dt >= 89.9999 && (dt = 90, _t = true), _t ? [nt, dt] : Qe;
        }
        function Rl(Qe) {
          return Qe.map(ss);
        }
        function Kh(Qe, nt, dt) {
          for (var _t = 0, Ct = Qe.length; _t < Ct; ++_t) {
            var St = Qe[_t].slice();
            dt.push({ index: -1, polygon: nt, ring: St });
            for (var Lt = 0, ir = St.length; Lt < ir; ++Lt) {
              var or = St[Lt], nr = or[0], fr = or[1];
              if (nr <= Ss || nr >= ql || fr <= xu || fr >= 89.9999) {
                St[Lt] = ss(or);
                for (var wr = Lt + 1; wr < ir; ++wr) {
                  var Er = St[wr], Mr = Er[0], Wr = Er[1];
                  if (Mr > Ss && Mr < ql && Wr > xu && Wr < 89.9999) break;
                }
                if (wr === Lt + 1) continue;
                if (Lt) {
                  var kn = { index: -1, polygon: nt, ring: St.slice(0, Lt + 1) };
                  kn.ring[kn.ring.length - 1] = nl(fr), dt[dt.length - 1] = kn;
                } else dt.pop();
                if (wr >= ir) break;
                dt.push({ index: -1, polygon: nt, ring: St = St.slice(wr - 1) }), St[0] = nl(St[0][1]), Lt = -1, ir = St.length;
              }
            }
          }
        }
        function Np(Qe) {
          var nt, dt, _t, Ct, St, Lt, ir = Qe.length, or = {}, nr = {};
          for (nt = 0; nt < ir; ++nt) _t = (dt = Qe[nt]).ring[0], St = dt.ring[dt.ring.length - 1], _t[0] !== St[0] || _t[1] !== St[1] ? (dt.index = nt, or[_t] = nr[St] = dt) : (dt.polygon.push(dt.ring), Qe[nt] = null);
          for (nt = 0; nt < ir; ++nt) if (dt = Qe[nt]) {
            if (_t = dt.ring[0], St = dt.ring[dt.ring.length - 1], Ct = nr[_t], Lt = or[St], delete or[_t], delete nr[St], _t[0] === St[0] && _t[1] === St[1]) {
              dt.polygon.push(dt.ring);
              continue;
            }
            Ct ? (delete nr[_t], delete or[Ct.ring[0]], Ct.ring.pop(), Qe[Ct.index] = null, dt = { index: -1, polygon: Ct.polygon, ring: Ct.ring.concat(dt.ring) }, Ct === Lt ? dt.polygon.push(dt.ring) : (dt.index = ir++, Qe.push(or[dt.ring[0]] = nr[dt.ring[dt.ring.length - 1]] = dt))) : Lt ? (delete or[St], delete nr[Lt.ring[Lt.ring.length - 1]], dt.ring.pop(), dt = { index: ir++, polygon: Lt.polygon, ring: dt.ring.concat(Lt.ring) }, Qe[Lt.index] = null, Qe.push(or[dt.ring[0]] = nr[dt.ring[dt.ring.length - 1]] = dt)) : (dt.ring.push(dt.ring[0]), dt.polygon.push(dt.ring));
          }
        }
        function vo(Qe) {
          var nt = { type: "Feature", geometry: xh(Qe.geometry) };
          return Qe.id != null && (nt.id = Qe.id), Qe.bbox != null && (nt.bbox = Qe.bbox), Qe.properties != null && (nt.properties = Qe.properties), nt;
        }
        function xh(Qe) {
          if (Qe == null) return Qe;
          var nt, dt, _t, Ct;
          switch (Qe.type) {
            case "GeometryCollection":
              nt = { type: "GeometryCollection", geometries: Qe.geometries.map(xh) };
              break;
            case "Point":
              nt = { type: "Point", coordinates: ss(Qe.coordinates) };
              break;
            case "MultiPoint":
            case "LineString":
              nt = { type: Qe.type, coordinates: Rl(Qe.coordinates) };
              break;
            case "MultiLineString":
              nt = { type: "MultiLineString", coordinates: Qe.coordinates.map(Rl) };
              break;
            case "Polygon":
              var St = [];
              Kh(Qe.coordinates, St, dt = []), Np(dt), nt = { type: "Polygon", coordinates: St };
              break;
            case "MultiPolygon":
              dt = [], _t = -1, Ct = Qe.coordinates.length;
              for (var Lt = new Array(Ct); ++_t < Ct; ) Kh(Qe.coordinates[_t], Lt[_t] = [], dt);
              Np(dt), nt = { type: "MultiPolygon", coordinates: Lt.filter(zu) };
              break;
            default:
              return Qe;
          }
          return Qe.bbox != null && (nt.bbox = Qe.bbox), nt;
        }
        function kf(Qe, nt) {
          var dt = b(nt / 2), _t = x(k * dt);
          return [Qe * (0.74482 - 0.34588 * _t * _t), 1.70711 * dt];
        }
        function Fp(Qe, nt, dt) {
          var _t = a.geoInterpolate(nt, dt), Ct = _t(0.5), St = a.geoRotation([-Ct[0], -Ct[1]])(nt), Lt = _t.distance / 2, ir = -N2(x(St[1] * F13) / x(Lt)), or = [-Ct[0], -Ct[1], -(St[0] > 0 ? w - ir : ir) * E2], nr = a.geoProjection(Qe(Lt)).rotate(or), fr = a.geoRotation(or), wr = nr.center;
          return delete nr.rotate, nr.center = function(Er) {
            return arguments.length ? wr(fr(Er)) : fr.invert(wr());
          }, nr.clipAngle(90);
        }
        function Op(Qe) {
          var nt = u2(Qe);
          function dt(_t, Ct) {
            var St = a.geoGnomonicRaw(_t, Ct);
            return St[0] *= nt, St;
          }
          return dt.invert = function(_t, Ct) {
            return a.geoGnomonicRaw.invert(_t / nt, Ct);
          }, dt;
        }
        function Yh(Qe, nt) {
          return Fp(Op, Qe, nt);
        }
        function Pp(Qe) {
          if (!(Qe *= 2)) return a.geoAzimuthalEquidistantRaw;
          var nt = -Qe / 2, dt = -nt, _t = Qe * Qe, Ct = b(dt), St = 0.5 / x(dt);
          function Lt(ir, or) {
            var nr = D2(u2(or) * u2(ir - nt)), fr = D2(u2(or) * u2(ir - dt));
            return [((nr *= nr) - (fr *= fr)) / (2 * Qe), (or < 0 ? -1 : 1) * I2(4 * _t * fr - (_t - nr + fr) * (_t - nr + fr)) / (2 * Qe)];
          }
          return Lt.invert = function(ir, or) {
            var nr, fr, wr = or * or, Er = u2(I2(wr + (nr = ir + nt) * nr)), Mr = u2(I2(wr + (nr = ir + dt) * nr));
            return [l(fr = Er - Mr, nr = (Er + Mr) * Ct), (or < 0 ? -1 : 1) * D2(I2(nr * nr + fr * fr) * St)];
          }, Lt;
        }
        function rc(Qe, nt) {
          return Fp(Pp, Qe, nt);
        }
        function nc(Qe, nt) {
          if (s(nt) < y) return [Qe, 0];
          var dt = s(nt / _4), _t = N2(dt);
          if (s(Qe) < y || s(s(nt) - _4) < y) return [0, g(nt) * w * b(_t / 2)];
          var Ct = u2(_t), St = s(w / Qe - Qe / w) / 2, Lt = St * St, ir = Ct / (dt + Ct - 1), or = ir * (2 / dt - 1), nr = or * or, fr = nr + Lt, wr = ir - nr, Er = Lt + ir;
          return [g(Qe) * w * (St * wr + I2(Lt * wr * wr - fr * (ir * ir - nr))) / fr, g(nt) * w * (or * Er - St * I2((Lt + 1) * fr - Er * Er)) / fr];
        }
        function Rc(Qe, nt) {
          if (s(nt) < y) return [Qe, 0];
          var dt = s(nt / _4), _t = N2(dt);
          if (s(Qe) < y || s(s(nt) - _4) < y) return [0, g(nt) * w * b(_t / 2)];
          var Ct = u2(_t), St = s(w / Qe - Qe / w) / 2, Lt = St * St, ir = Ct * (I2(1 + Lt) - St * Ct) / (1 + Lt * dt * dt);
          return [g(Qe) * w * ir, g(nt) * w * I2(1 - ir * (2 * St + ir))];
        }
        function zc(Qe, nt) {
          if (s(nt) < y) return [Qe, 0];
          var dt = nt / _4, _t = N2(dt);
          if (s(Qe) < y || s(s(nt) - _4) < y) return [0, w * b(_t / 2)];
          var Ct = (w / Qe - Qe / w) / 2, St = dt / (1 + u2(_t));
          return [w * (g(Qe) * I2(Ct * Ct + 1 - St * St) - Ct), w * St];
        }
        function Bc(Qe, nt) {
          if (!nt) return [Qe, 0];
          var dt = s(nt);
          if (!Qe || dt === _4) return [0, nt];
          var _t = dt / _4, Ct = _t * _t, St = (8 * _t - Ct * (Ct + 2) - 5) / (2 * Ct * (_t - 1)), Lt = St * St, ir = _t * St, or = Ct + Lt + 2 * ir, nr = _t + 3 * St, fr = Qe / _4, wr = fr + 1 / fr, Er = g(s(Qe) - _4) * I2(wr * wr - 4), Mr = Er * Er, Wr = (Er * (or + Lt - 1) + 2 * I2(or * (Ct + Lt * Mr - 1) + (1 - Ct) * (Ct * (nr * nr + 4 * Lt) + 12 * ir * Lt + 4 * Lt * Lt))) / (4 * or + Mr);
          return [g(Qe) * _4 * Wr, g(nt) * _4 * I2(1 + Er * s(Wr) - Wr * Wr)];
        }
        function Tf(Qe, nt, dt, _t) {
          var Ct = w / 3;
          Qe = p(Qe, y), nt = p(nt, y), Qe = d(Qe, _4), nt = d(nt, w - y), dt = p(dt, 0), dt = d(dt, 100 - y);
          var St = (_t = p(_t, y)) / 100, Lt = D2((dt / 100 + 1) * u2(Ct)) / Ct, ir = x(Qe) / x(Lt * _4), or = nt / w, nr = I2(St * x(Qe / 2) / x(nt / 2));
          return function(fr, wr, Er, Mr, Wr) {
            function kn(On, ta) {
              var sa = Er * x(Mr * ta), xa = I2(1 - sa * sa), la = I2(2 / (1 + xa * u2(On *= Wr)));
              return [fr * xa * la * x(On), wr * sa * la];
            }
            return kn.invert = function(On, ta) {
              var sa = On / fr, xa = ta / wr, la = I2(sa * sa + xa * xa), ci = 2 * N2(la / 2);
              return [l(On * b(ci), fr * la) / Wr, la && N2(ta * x(ci) / (wr * Er * la)) / Mr];
            }, kn;
          }(nr / I2(or * ir * Lt), 1 / (nr * I2(or * ir * Lt)), ir, Lt, or);
        }
        function bu() {
          var Qe = 65 * F13, nt = 60 * F13, dt = 20, _t = 200, Ct = a.geoProjectionMutator(Tf), St = Ct(Qe, nt, dt, _t);
          return St.poleline = function(Lt) {
            return arguments.length ? Ct(Qe = +Lt * F13, nt, dt, _t) : Qe * E2;
          }, St.parallels = function(Lt) {
            return arguments.length ? Ct(Qe, nt = +Lt * F13, dt, _t) : nt * E2;
          }, St.inflation = function(Lt) {
            return arguments.length ? Ct(Qe, nt, dt = +Lt, _t) : dt;
          }, St.ratio = function(Lt) {
            return arguments.length ? Ct(Qe, nt, dt, _t = +Lt) : _t;
          }, St.scale(163.775);
        }
        kf.invert = function(Qe, nt) {
          var dt = nt / 1.70711, _t = x(k * dt);
          return [Qe / (0.74482 - 0.34588 * _t * _t), 2 * i(dt)];
        }, nc.invert = function(Qe, nt) {
          if (s(nt) < y) return [Qe, 0];
          if (s(Qe) < y) return [0, _4 * x(2 * i(nt / w))];
          var dt = (Qe /= w) * Qe, _t = (nt /= w) * nt, Ct = dt + _t, St = Ct * Ct, Lt = -s(nt) * (1 + Ct), ir = Lt - 2 * _t + dt, or = -2 * Lt + 1 + 2 * _t + St, nr = _t / or + (2 * ir * ir * ir / (or * or * or) - 9 * Lt * ir / (or * or)) / 27, fr = (Lt - ir * ir / (3 * or)) / or, wr = 2 * I2(-fr / 3), Er = D2(3 * nr / (fr * wr)) / 3;
          return [w * (Ct - 1 + I2(1 + 2 * (dt - _t) + St)) / (2 * Qe), g(nt) * w * (-wr * u2(Er + w / 3) - ir / (3 * or))];
        }, Rc.invert = function(Qe, nt) {
          if (!Qe) return [0, _4 * x(2 * i(nt / w))];
          var dt = s(Qe / w), _t = (1 - dt * dt - (nt /= w) * nt) / (2 * dt), Ct = I2(_t * _t + 1);
          return [g(Qe) * w * (Ct - _t), g(nt) * _4 * x(2 * l(I2((1 - 2 * _t * dt) * (_t + Ct) - dt), I2(Ct + _t + dt)))];
        }, zc.invert = function(Qe, nt) {
          if (!nt) return [Qe, 0];
          var dt = nt / w, _t = (w * w * (1 - dt * dt) - Qe * Qe) / (2 * w * Qe);
          return [Qe ? w * (g(Qe) * I2(_t * _t + 1) - _t) : 0, _4 * x(2 * i(dt))];
        }, Bc.invert = function(Qe, nt) {
          var dt;
          if (!Qe || !nt) return [Qe, nt];
          nt /= w;
          var _t = g(Qe) * Qe / _4, Ct = (_t * _t - 1 + 4 * nt * nt) / s(_t), St = Ct * Ct, Lt = 2 * nt, ir = 50;
          do {
            var or = Lt * Lt, nr = (8 * Lt - or * (or + 2) - 5) / (2 * or * (Lt - 1)), fr = (3 * Lt - or * Lt - 10) / (2 * or * Lt), wr = nr * nr, Er = Lt * nr, Mr = Lt + nr, Wr = Mr * Mr, kn = Lt + 3 * nr, On = -2 * Mr * (4 * Er * wr + (1 - 4 * or + 3 * or * or) * (1 + fr) + wr * (14 * or - 6 - St + (8 * or - 8 - 2 * St) * fr) + Er * (12 * or - 8 + (10 * or - 10 - St) * fr)), ta = I2(Wr * (or + wr * St - 1) + (1 - or) * (or * (kn * kn + 4 * wr) + wr * (12 * Er + 4 * wr)));
            Lt -= dt = (Ct * (Wr + wr - 1) + 2 * ta - _t * (4 * Wr + St)) / (Ct * (2 * nr * fr + 2 * Mr * (1 + fr)) + On / ta - 8 * Mr * (Ct * (-1 + wr + Wr) + 2 * ta) * (1 + fr) / (St + 4 * Wr));
          } while (dt > y && --ir > 0);
          return [g(Qe) * (I2(Ct * Ct + 4) + Ct) * w / 4, _4 * Lt];
        };
        var bh = 4 * w + 3 * I2(3), cu = 2 * I2(2 * w * I2(3) / bh), Uc = ne(cu * I2(3) / w, cu, bh / 6);
        function _h(Qe, nt) {
          return [Qe * I2(1 - 3 * nt * nt / (w * w)), nt];
        }
        function ac(Qe, nt) {
          var dt = u2(nt), _t = u2(Qe) * dt, Ct = 1 - _t, St = u2(Qe = l(x(Qe) * dt, -x(nt))), Lt = x(Qe);
          return [Lt * (dt = I2(1 - _t * _t)) - St * Ct, -St * dt - Lt * Ct];
        }
        function lo(Qe, nt) {
          var dt = W2(Qe, nt);
          return [(dt[0] + Qe / _4) / 2, (dt[1] + nt) / 2];
        }
        _h.invert = function(Qe, nt) {
          return [Qe / I2(1 - 3 * nt * nt / (w * w)), nt];
        }, ac.invert = function(Qe, nt) {
          var dt = (Qe * Qe + nt * nt) / -2, _t = I2(-dt * (2 + dt)), Ct = nt * dt + Qe * _t, St = Qe * dt - nt * _t, Lt = I2(St * St + Ct * Ct);
          return [l(_t * Ct, Lt * (1 + dt)), Lt ? -N2(_t * St / Lt) : 0];
        }, lo.invert = function(Qe, nt) {
          var dt = Qe, _t = nt, Ct = 25;
          do {
            var St, Lt = u2(_t), ir = x(_t), or = x(2 * _t), nr = ir * ir, fr = Lt * Lt, wr = x(dt), Er = u2(dt / 2), Mr = x(dt / 2), Wr = Mr * Mr, kn = 1 - fr * Er * Er, On = kn ? D2(Lt * Er) * I2(St = 1 / kn) : St = 0, ta = 0.5 * (2 * On * Lt * Mr + dt / _4) - Qe, sa = 0.5 * (On * ir + _t) - nt, xa = 0.5 * St * (fr * Wr + On * Lt * Er * nr) + 0.5 / _4, la = St * (wr * or / 4 - On * ir * Mr), ci = 0.125 * St * (or * Mr - On * ir * fr * wr), Ci = 0.5 * St * (nr * Er + On * Wr * Lt) + 0.5, Qi = la * ci - Ci * xa, Zi = (sa * la - ta * Ci) / Qi, eo = (ta * ci - sa * xa) / Qi;
            dt -= Zi, _t -= eo;
          } while ((s(Zi) > y || s(eo) > y) && --Ct > 0);
          return [dt, _t];
        }, n.geoNaturalEarth = a.geoNaturalEarth1, n.geoNaturalEarthRaw = a.geoNaturalEarth1Raw, n.geoAiry = function() {
          var Qe = _4, nt = a.geoProjectionMutator(V2), dt = nt(Qe);
          return dt.radius = function(_t) {
            return arguments.length ? nt(Qe = _t * F13) : Qe * E2;
          }, dt.scale(179.976).clipAngle(147);
        }, n.geoAiryRaw = V2, n.geoAitoff = function() {
          return a.geoProjection(W2).scale(152.63);
        }, n.geoAitoffRaw = W2, n.geoArmadillo = function() {
          var Qe = 20 * F13, nt = Qe >= 0 ? 1 : -1, dt = b(nt * Qe), _t = a.geoProjectionMutator(X2), Ct = _t(Qe), St = Ct.stream;
          return Ct.parallel = function(Lt) {
            return arguments.length ? (dt = b((nt = (Qe = Lt * F13) >= 0 ? 1 : -1) * Qe), _t(Qe)) : Qe * E2;
          }, Ct.stream = function(Lt) {
            var ir = Ct.rotate(), or = St(Lt), nr = (Ct.rotate([0, 0]), St(Lt)), fr = Ct.precision();
            return Ct.rotate(ir), or.sphere = function() {
              nr.polygonStart(), nr.lineStart();
              for (var wr = -180 * nt; nt * wr < 180; wr += 90 * nt) nr.point(wr, 90 * nt);
              if (Qe) for (; nt * (wr -= 3 * nt * fr) >= -180; ) nr.point(wr, nt * -l(u2(wr * F13 / 2), dt) * E2);
              nr.lineEnd(), nr.polygonEnd();
            }, or;
          }, Ct.scale(218.695).center([0, 28.0974]);
        }, n.geoArmadilloRaw = X2, n.geoAugust = function() {
          return a.geoProjection(Y2).scale(66.1603);
        }, n.geoAugustRaw = Y2, n.geoBaker = function() {
          return a.geoProjection(re).scale(112.314);
        }, n.geoBakerRaw = re, n.geoBerghaus = function() {
          var Qe = 5, nt = a.geoProjectionMutator(R2), dt = nt(Qe), _t = dt.stream, Ct = -u2(0.01 * F13), St = x(0.01 * F13);
          return dt.lobes = function(Lt) {
            return arguments.length ? nt(Qe = +Lt) : Qe;
          }, dt.stream = function(Lt) {
            var ir = dt.rotate(), or = _t(Lt), nr = (dt.rotate([0, 0]), _t(Lt));
            return dt.rotate(ir), or.sphere = function() {
              nr.polygonStart(), nr.lineStart();
              for (var fr = 0, wr = 360 / Qe, Er = 2 * w / Qe, Mr = 90 - 180 / Qe, Wr = _4; fr < Qe; ++fr, Mr -= wr, Wr -= Er) nr.point(l(St * u2(Wr), Ct) * E2, N2(St * x(Wr)) * E2), Mr < -90 ? (nr.point(-90, -180 - Mr - 0.01), nr.point(-90, -180 - Mr + 0.01)) : (nr.point(90, Mr + 0.01), nr.point(90, Mr - 0.01));
              nr.lineEnd(), nr.polygonEnd();
            }, or;
          }, dt.scale(87.8076).center([0, 17.1875]).clipAngle(179.999);
        }, n.geoBerghausRaw = R2, n.geoBertin1953 = function() {
          return a.geoProjection(Q2()).rotate([-16.5, -42]).scale(176.57).center([7.93, 0.09]);
        }, n.geoBertin1953Raw = Q2, n.geoBoggs = function() {
          return a.geoProjection(ce).scale(160.857);
        }, n.geoBoggsRaw = ce, n.geoBonne = function() {
          return se(me).scale(123.082).center([0, 26.1441]).parallel(45);
        }, n.geoBonneRaw = me, n.geoBottomley = function() {
          var Qe = 0.5, nt = a.geoProjectionMutator(we), dt = nt(Qe);
          return dt.fraction = function(_t) {
            return arguments.length ? nt(Qe = +_t) : Qe;
          }, dt.scale(158.837);
        }, n.geoBottomleyRaw = we, n.geoBromley = function() {
          return a.geoProjection(be).scale(152.63);
        }, n.geoBromleyRaw = be, n.geoChamberlin = Ce, n.geoChamberlinRaw = Ee, n.geoChamberlinAfrica = function() {
          return Ce([0, 22], [45, 22], [22.5, -22]).scale(380).center([22.5, 2]);
        }, n.geoCollignon = function() {
          return a.geoProjection(Be).scale(95.6464).center([0, 30]);
        }, n.geoCollignonRaw = Be, n.geoCraig = function() {
          return se(Ue).scale(249.828).clipAngle(90);
        }, n.geoCraigRaw = Ue, n.geoCraster = function() {
          return a.geoProjection(ct).scale(156.19);
        }, n.geoCrasterRaw = ct, n.geoCylindricalEqualArea = function() {
          return se(We).parallel(38.58).scale(195.044);
        }, n.geoCylindricalEqualAreaRaw = We, n.geoCylindricalStereographic = function() {
          return se(Ze).scale(124.75);
        }, n.geoCylindricalStereographicRaw = Ze, n.geoEckert1 = function() {
          return a.geoProjection(it).scale(165.664);
        }, n.geoEckert1Raw = it, n.geoEckert2 = function() {
          return a.geoProjection(ot).scale(165.664);
        }, n.geoEckert2Raw = ot, n.geoEckert3 = function() {
          return a.geoProjection(mt).scale(180.739);
        }, n.geoEckert3Raw = mt, n.geoEckert4 = function() {
          return a.geoProjection(wt).scale(180.739);
        }, n.geoEckert4Raw = wt, n.geoEckert5 = function() {
          return a.geoProjection(Et).scale(173.044);
        }, n.geoEckert5Raw = Et, n.geoEckert6 = function() {
          return a.geoProjection(zt).scale(173.044);
        }, n.geoEckert6Raw = zt, n.geoEisenlohr = function() {
          return a.geoProjection(yt).scale(62.5271);
        }, n.geoEisenlohrRaw = yt, n.geoFahey = function() {
          return a.geoProjection(Ot).scale(137.152);
        }, n.geoFaheyRaw = Ot, n.geoFoucaut = function() {
          return a.geoProjection(Jt).scale(135.264);
        }, n.geoFoucautRaw = Jt, n.geoFoucautSinusoidal = function() {
          var Qe = 0.5, nt = a.geoProjectionMutator(tr), dt = nt(Qe);
          return dt.alpha = function(_t) {
            return arguments.length ? nt(Qe = +_t) : Qe;
          }, dt.scale(168.725);
        }, n.geoFoucautSinusoidalRaw = tr, n.geoGilbert = function(Qe) {
          Qe == null && (Qe = a.geoOrthographic);
          var nt = Qe(), dt = a.geoEquirectangular().scale(E2).precision(0).clipAngle(null).translate([0, 0]);
          function _t(St) {
            return nt(Ye(St));
          }
          function Ct(St) {
            _t[St] = function() {
              return arguments.length ? (nt[St].apply(nt, arguments), _t) : nt[St]();
            };
          }
          return nt.invert && (_t.invert = function(St) {
            return at(nt.invert(St));
          }), _t.stream = function(St) {
            var Lt = nt.stream(St), ir = dt.stream({ point: function(or, nr) {
              Lt.point(or / 2, N2(b(-nr / 2 * F13)) * E2);
            }, lineStart: function() {
              Lt.lineStart();
            }, lineEnd: function() {
              Lt.lineEnd();
            }, polygonStart: function() {
              Lt.polygonStart();
            }, polygonEnd: function() {
              Lt.polygonEnd();
            } });
            return ir.sphere = Lt.sphere, ir;
          }, _t.rotate = function(St) {
            return arguments.length ? (dt.rotate(St), _t) : dt.rotate();
          }, _t.center = function(St) {
            return arguments.length ? (nt.center(Ye(St)), _t) : at(nt.center());
          }, Ct("angle"), Ct("clipAngle"), Ct("clipExtent"), Ct("fitExtent"), Ct("fitHeight"), Ct("fitSize"), Ct("fitWidth"), Ct("scale"), Ct("translate"), Ct("precision"), _t.scale(249.5);
        }, n.geoGingery = function() {
          var Qe = 6, nt = 30 * F13, dt = u2(nt), _t = x(nt), Ct = a.geoProjectionMutator(Ge), St = Ct(nt, Qe), Lt = St.stream, ir = -u2(0.01 * F13), or = x(0.01 * F13);
          return St.radius = function(nr) {
            return arguments.length ? (dt = u2(nt = nr * F13), _t = x(nt), Ct(nt, Qe)) : nt * E2;
          }, St.lobes = function(nr) {
            return arguments.length ? Ct(nt, Qe = +nr) : Qe;
          }, St.stream = function(nr) {
            var fr = St.rotate(), wr = Lt(nr), Er = (St.rotate([0, 0]), Lt(nr));
            return St.rotate(fr), wr.sphere = function() {
              Er.polygonStart(), Er.lineStart();
              for (var Mr = 0, Wr = 2 * w / Qe, kn = 0; Mr < Qe; ++Mr, kn -= Wr) Er.point(l(or * u2(kn), ir) * E2, N2(or * x(kn)) * E2), Er.point(l(_t * u2(kn - Wr / 2), dt) * E2, N2(_t * x(kn - Wr / 2)) * E2);
              Er.lineEnd(), Er.polygonEnd();
            }, wr;
          }, St.rotate([90, -40]).scale(91.7095).clipAngle(179.999);
        }, n.geoGingeryRaw = Ge, n.geoGinzburg4 = function() {
          return a.geoProjection($e).scale(149.995);
        }, n.geoGinzburg4Raw = $e, n.geoGinzburg5 = function() {
          return a.geoProjection(Ve).scale(153.93);
        }, n.geoGinzburg5Raw = Ve, n.geoGinzburg6 = function() {
          return a.geoProjection(ut).scale(130.945);
        }, n.geoGinzburg6Raw = ut, n.geoGinzburg8 = function() {
          return a.geoProjection(Re).scale(131.747);
        }, n.geoGinzburg8Raw = Re, n.geoGinzburg9 = function() {
          return a.geoProjection(qe).scale(131.087);
        }, n.geoGinzburg9Raw = qe, n.geoGringorten = function() {
          return a.geoProjection(je(rt)).scale(239.75);
        }, n.geoGringortenRaw = rt, n.geoGuyou = function() {
          return a.geoProjection(je(Ne)).scale(151.496);
        }, n.geoGuyouRaw = Ne, n.geoHammer = function() {
          var Qe = 2, nt = a.geoProjectionMutator(z), dt = nt(Qe);
          return dt.coefficient = function(_t) {
            return arguments.length ? nt(Qe = +_t) : Qe;
          }, dt.scale(169.529);
        }, n.geoHammerRaw = z, n.geoHammerRetroazimuthal = function() {
          var Qe = 0, nt = a.geoProjectionMutator(ke), dt = nt(Qe), _t = dt.rotate, Ct = dt.stream, St = a.geoCircle();
          return dt.parallel = function(Lt) {
            if (!arguments.length) return Qe * E2;
            var ir = dt.rotate();
            return nt(Qe = Lt * F13).rotate(ir);
          }, dt.rotate = function(Lt) {
            return arguments.length ? (_t.call(dt, [Lt[0], Lt[1] - Qe * E2]), St.center([-Lt[0], -Lt[1]]), dt) : ((Lt = _t.call(dt))[1] += Qe * E2, Lt);
          }, dt.stream = function(Lt) {
            return (Lt = Ct(Lt)).sphere = function() {
              Lt.polygonStart();
              var ir, or = St.radius(89.99)().coordinates[0], nr = or.length - 1, fr = -1;
              for (Lt.lineStart(); ++fr < nr; ) Lt.point((ir = or[fr])[0], ir[1]);
              for (Lt.lineEnd(), nr = (or = St.radius(90.01)().coordinates[0]).length - 1, Lt.lineStart(); --fr >= 0; ) Lt.point((ir = or[fr])[0], ir[1]);
              Lt.lineEnd(), Lt.polygonEnd();
            }, Lt;
          }, dt.scale(79.4187).parallel(45).clipAngle(179.999);
        }, n.geoHammerRetroazimuthalRaw = ke, n.geoHealpix = function() {
          var Qe = 4, nt = a.geoProjectionMutator(ft), dt = nt(Qe), _t = dt.stream;
          return dt.lobes = function(Ct) {
            return arguments.length ? nt(Qe = +Ct) : Qe;
          }, dt.stream = function(Ct) {
            var St = dt.rotate(), Lt = _t(Ct), ir = (dt.rotate([0, 0]), _t(Ct));
            return dt.rotate(St), Lt.sphere = function() {
              var or, nr;
              a.geoStream((or = 180 / Qe, nr = [].concat(o.range(-180, 180 + or / 2, or).map(De), o.range(180, -180 - or / 2, -or).map(Je)), { type: "Polygon", coordinates: [or === 180 ? nr.map(tt) : nr] }), ir);
            }, Lt;
          }, dt.scale(239.75);
        }, n.geoHealpixRaw = ft, n.geoHill = function() {
          var Qe = 1, nt = a.geoProjectionMutator(vt), dt = nt(Qe);
          return dt.ratio = function(_t) {
            return arguments.length ? nt(Qe = +_t) : Qe;
          }, dt.scale(167.774).center([0, 18.67]);
        }, n.geoHillRaw = vt, n.geoHomolosine = function() {
          return a.geoProjection(jt).scale(152.63);
        }, n.geoHomolosineRaw = jt, n.geoHufnagel = function() {
          var Qe = 1, nt = 0, dt = 45 * F13, _t = 2, Ct = a.geoProjectionMutator(Vt), St = Ct(Qe, nt, dt, _t);
          return St.a = function(Lt) {
            return arguments.length ? Ct(Qe = +Lt, nt, dt, _t) : Qe;
          }, St.b = function(Lt) {
            return arguments.length ? Ct(Qe, nt = +Lt, dt, _t) : nt;
          }, St.psiMax = function(Lt) {
            return arguments.length ? Ct(Qe, nt, dt = +Lt * F13, _t) : dt * E2;
          }, St.ratio = function(Lt) {
            return arguments.length ? Ct(Qe, nt, dt, _t = +Lt) : _t;
          }, St.scale(180.739);
        }, n.geoHufnagelRaw = Vt, n.geoHyperelliptical = function() {
          var Qe = 0, nt = 2.5, dt = 1.183136, _t = a.geoProjectionMutator(rr), Ct = _t(Qe, nt, dt);
          return Ct.alpha = function(St) {
            return arguments.length ? _t(Qe = +St, nt, dt) : Qe;
          }, Ct.k = function(St) {
            return arguments.length ? _t(Qe, nt = +St, dt) : nt;
          }, Ct.gamma = function(St) {
            return arguments.length ? _t(Qe, nt, dt = +St) : dt;
          }, Ct.scale(152.63);
        }, n.geoHyperellipticalRaw = rr, n.geoInterrupt = lr, n.geoInterruptedBoggs = function() {
          return lr(ce, _r).scale(160.857);
        }, n.geoInterruptedHomolosine = function() {
          return lr(jt, $r).scale(152.63);
        }, n.geoInterruptedMollweide = function() {
          return lr(ae, Ar).scale(169.529);
        }, n.geoInterruptedMollweideHemispheres = function() {
          return lr(ae, Qr).scale(169.529).rotate([20, 0]);
        }, n.geoInterruptedSinuMollweide = function() {
          return lr(kt, hn, j).rotate([-20, -55]).scale(164.263).center([0, -5.4036]);
        }, n.geoInterruptedSinusoidal = function() {
          return lr(he, wn).scale(152.63).rotate([-20, 0]);
        }, n.geoKavrayskiy7 = function() {
          return a.geoProjection(Yn).scale(158.837);
        }, n.geoKavrayskiy7Raw = Yn, n.geoLagrange = function() {
          var Qe = 0.5, nt = a.geoProjectionMutator(Xn), dt = nt(Qe);
          return dt.spacing = function(_t) {
            return arguments.length ? nt(Qe = +_t) : Qe;
          }, dt.scale(124.75);
        }, n.geoLagrangeRaw = Xn, n.geoLarrivee = function() {
          return a.geoProjection(_n).scale(97.2672);
        }, n.geoLarriveeRaw = _n, n.geoLaskowski = function() {
          return a.geoProjection(qr).scale(139.98);
        }, n.geoLaskowskiRaw = qr, n.geoLittrow = function() {
          return a.geoProjection(Nr).scale(144.049).clipAngle(89.999);
        }, n.geoLittrowRaw = Nr, n.geoLoximuthal = function() {
          return se(Zr).parallel(40).scale(158.837);
        }, n.geoLoximuthalRaw = Zr, n.geoMiller = function() {
          return a.geoProjection(oa).scale(108.318);
        }, n.geoMillerRaw = oa, n.geoModifiedStereographic = Ut, n.geoModifiedStereographicRaw = tn, n.geoModifiedStereographicAlaska = function() {
          return Ut(Zn, [152, -64]).scale(1400).center([-160.908, 62.4864]).clipAngle(30).angle(7.8);
        }, n.geoModifiedStereographicGs48 = function() {
          return Ut(Ln, [95, -38]).scale(1e3).clipAngle(55).center([-96.5563, 38.8675]);
        }, n.geoModifiedStereographicGs50 = function() {
          return Ut(gn, [120, -45]).scale(359.513).clipAngle(55).center([-117.474, 53.0628]);
        }, n.geoModifiedStereographicMiller = function() {
          return Ut(na, [-20, -18]).scale(209.091).center([20, 16.7214]).clipAngle(82);
        }, n.geoModifiedStereographicLee = function() {
          return Ut(sr, [165, 10]).scale(250).clipAngle(130).center([-165, -10]);
        }, n.geoMollweide = function() {
          return a.geoProjection(ae).scale(169.529);
        }, n.geoMollweideRaw = ae, n.geoMtFlatPolarParabolic = function() {
          return a.geoProjection(Fr).scale(164.859);
        }, n.geoMtFlatPolarParabolicRaw = Fr, n.geoMtFlatPolarQuartic = function() {
          return a.geoProjection(pn).scale(188.209);
        }, n.geoMtFlatPolarQuarticRaw = pn, n.geoMtFlatPolarSinusoidal = function() {
          return a.geoProjection(un).scale(166.518);
        }, n.geoMtFlatPolarSinusoidalRaw = un, n.geoNaturalEarth2 = function() {
          return a.geoProjection(Ir).scale(175.295);
        }, n.geoNaturalEarth2Raw = Ir, n.geoNellHammer = function() {
          return a.geoProjection(Cr).scale(152.63);
        }, n.geoNellHammerRaw = Cr, n.geoInterruptedQuarticAuthalic = function() {
          return lr(z(1 / 0), Lr).rotate([20, 0]).scale(152.63);
        }, n.geoNicolosi = function() {
          return a.geoProjection(jr).scale(127.267);
        }, n.geoNicolosiRaw = jr, n.geoPatterson = function() {
          return a.geoProjection(Rr).scale(139.319);
        }, n.geoPattersonRaw = Rr, n.geoPolyconic = function() {
          return a.geoProjection(vn).scale(103.74);
        }, n.geoPolyconicRaw = vn, n.geoPolyhedral = sn, n.geoPolyhedralButterfly = function(Qe) {
          Qe = Qe || function(dt) {
            var _t = a.geoCentroid({ type: "MultiPoint", coordinates: dt });
            return a.geoGnomonic().scale(1).translate([0, 0]).rotate([-_t[0], -_t[1]]);
          };
          var nt = Kn.map(function(dt) {
            return { face: dt, project: Qe(dt) };
          });
          return [-1, 0, 0, 1, 0, 1, 4, 5].forEach(function(dt, _t) {
            var Ct = nt[dt];
            Ct && (Ct.children || (Ct.children = [])).push(nt[_t]);
          }), sn(nt[0], function(dt, _t) {
            return nt[dt < -w / 2 ? _t < 0 ? 6 : 4 : dt < 0 ? _t < 0 ? 2 : 0 : dt < w / 2 ? _t < 0 ? 3 : 1 : _t < 0 ? 7 : 5];
          }).angle(-30).scale(101.858).center([0, 45]);
        }, n.geoPolyhedralCollignon = function(Qe) {
          Qe = Qe || function(dt) {
            var _t = a.geoCentroid({ type: "MultiPoint", coordinates: dt });
            return a.geoProjection(ka).translate([0, 0]).scale(1).rotate(_t[1] > 0 ? [-_t[0], 0] : [180 - _t[0], 180]);
          };
          var nt = Kn.map(function(dt) {
            return { face: dt, project: Qe(dt) };
          });
          return [-1, 0, 0, 1, 0, 1, 4, 5].forEach(function(dt, _t) {
            var Ct = nt[dt];
            Ct && (Ct.children || (Ct.children = [])).push(nt[_t]);
          }), sn(nt[0], function(dt, _t) {
            return nt[dt < -w / 2 ? _t < 0 ? 6 : 4 : dt < 0 ? _t < 0 ? 2 : 0 : dt < w / 2 ? _t < 0 ? 3 : 1 : _t < 0 ? 7 : 5];
          }).angle(-30).scale(121.906).center([0, 48.5904]);
        }, n.geoPolyhedralWaterman = function(Qe) {
          Qe = Qe || function(St) {
            var Lt = St.length === 6 ? a.geoCentroid({ type: "MultiPoint", coordinates: St }) : St[0];
            return a.geoGnomonic().scale(1).translate([0, 0]).rotate([-Lt[0], -Lt[1]]);
          };
          var nt = Kn.map(function(St) {
            for (var Lt, ir = St.map(si), or = ir.length, nr = ir[or - 1], fr = [], wr = 0; wr < or; ++wr) Lt = ir[wr], fr.push(ja([0.9486832980505138 * nr[0] + 0.31622776601683794 * Lt[0], 0.9486832980505138 * nr[1] + 0.31622776601683794 * Lt[1], 0.9486832980505138 * nr[2] + 0.31622776601683794 * Lt[2]]), ja([0.9486832980505138 * Lt[0] + 0.31622776601683794 * nr[0], 0.9486832980505138 * Lt[1] + 0.31622776601683794 * nr[1], 0.9486832980505138 * Lt[2] + 0.31622776601683794 * nr[2]])), nr = Lt;
            return fr;
          }), dt = [], _t = [-1, 0, 0, 1, 0, 1, 4, 5];
          nt.forEach(function(St, Lt) {
            for (var ir, or, nr = Kn[Lt], fr = nr.length, wr = dt[Lt] = [], Er = 0; Er < fr; ++Er) nt.push([nr[Er], St[(2 * Er + 2) % (2 * fr)], St[(2 * Er + 1) % (2 * fr)]]), _t.push(Lt), wr.push((ir = si(St[(2 * Er + 2) % (2 * fr)]), or = si(St[(2 * Er + 1) % (2 * fr)]), [ir[1] * or[2] - ir[2] * or[1], ir[2] * or[0] - ir[0] * or[2], ir[0] * or[1] - ir[1] * or[0]]));
          });
          var Ct = nt.map(function(St) {
            return { project: Qe(St), face: St };
          });
          return _t.forEach(function(St, Lt) {
            var ir = Ct[St];
            ir && (ir.children || (ir.children = [])).push(Ct[Lt]);
          }), sn(Ct[0], function(St, Lt) {
            var ir = u2(Lt), or = [ir * u2(St), ir * x(St), x(Lt)], nr = St < -w / 2 ? Lt < 0 ? 6 : 4 : St < 0 ? Lt < 0 ? 2 : 0 : St < w / 2 ? Lt < 0 ? 3 : 1 : Lt < 0 ? 7 : 5, fr = dt[nr];
            return Ct[zn(fr[0], or) < 0 ? 8 + 3 * nr : zn(fr[1], or) < 0 ? 8 + 3 * nr + 1 : zn(fr[2], or) < 0 ? 8 + 3 * nr + 2 : nr];
          }).angle(-30).scale(110.625).center([0, 45]);
        }, n.geoProject = function(Qe, nt) {
          var dt, _t = nt.stream;
          if (!_t) throw new Error("invalid projection");
          switch (Qe && Qe.type) {
            case "Feature":
              dt = Uo;
              break;
            case "FeatureCollection":
              dt = Xs;
              break;
            default:
              dt = As;
          }
          return dt(Qe, _t);
        }, n.geoGringortenQuincuncial = function() {
          return Ll(rt).scale(176.423);
        }, n.geoPeirceQuincuncial = Hl, n.geoPierceQuincuncial = Hl, n.geoQuantize = function(Qe, nt) {
          if (!(0 <= (nt = +nt) && nt <= 20)) throw new Error("invalid digits");
          function dt(nr) {
            var fr = nr.length, wr = 2, Er = new Array(fr);
            for (Er[0] = +nr[0].toFixed(nt), Er[1] = +nr[1].toFixed(nt); wr < fr; ) Er[wr] = nr[wr], ++wr;
            return Er;
          }
          function _t(nr) {
            return nr.map(dt);
          }
          function Ct(nr) {
            for (var fr = dt(nr[0]), wr = [fr], Er = 1; Er < nr.length; Er++) {
              var Mr = dt(nr[Er]);
              (Mr.length > 2 || Mr[0] != fr[0] || Mr[1] != fr[1]) && (wr.push(Mr), fr = Mr);
            }
            return wr.length === 1 && nr.length > 1 && wr.push(dt(nr[nr.length - 1])), wr;
          }
          function St(nr) {
            return nr.map(Ct);
          }
          function Lt(nr) {
            if (nr == null) return nr;
            var fr;
            switch (nr.type) {
              case "GeometryCollection":
                fr = { type: "GeometryCollection", geometries: nr.geometries.map(Lt) };
                break;
              case "Point":
                fr = { type: "Point", coordinates: dt(nr.coordinates) };
                break;
              case "MultiPoint":
                fr = { type: nr.type, coordinates: _t(nr.coordinates) };
                break;
              case "LineString":
                fr = { type: nr.type, coordinates: Ct(nr.coordinates) };
                break;
              case "MultiLineString":
              case "Polygon":
                fr = { type: nr.type, coordinates: St(nr.coordinates) };
                break;
              case "MultiPolygon":
                fr = { type: "MultiPolygon", coordinates: nr.coordinates.map(St) };
                break;
              default:
                return nr;
            }
            return nr.bbox != null && (fr.bbox = nr.bbox), fr;
          }
          function ir(nr) {
            var fr = { type: "Feature", properties: nr.properties, geometry: Lt(nr.geometry) };
            return nr.id != null && (fr.id = nr.id), nr.bbox != null && (fr.bbox = nr.bbox), fr;
          }
          if (Qe != null) switch (Qe.type) {
            case "Feature":
              return ir(Qe);
            case "FeatureCollection":
              var or = { type: "FeatureCollection", features: Qe.features.map(ir) };
              return Qe.bbox != null && (or.bbox = Qe.bbox), or;
            default:
              return Lt(Qe);
          }
          return Qe;
        }, n.geoQuincuncial = Ll, n.geoRectangularPolyconic = function() {
          return se(Lc).scale(131.215);
        }, n.geoRectangularPolyconicRaw = Lc, n.geoRobinson = function() {
          return a.geoProjection(tc).scale(152.63);
        }, n.geoRobinsonRaw = tc, n.geoSatellite = function() {
          var Qe = 2, nt = 0, dt = a.geoProjectionMutator(yu), _t = dt(Qe, nt);
          return _t.distance = function(Ct) {
            return arguments.length ? dt(Qe = +Ct, nt) : Qe;
          }, _t.tilt = function(Ct) {
            return arguments.length ? dt(Qe, nt = Ct * F13) : nt * E2;
          }, _t.scale(432.147).clipAngle(D2(1 / Qe) * E2 - 1e-6);
        }, n.geoSatelliteRaw = yu, n.geoSinuMollweide = function() {
          return a.geoProjection(kt).rotate([-20, -55]).scale(164.263).center([0, -5.4036]);
        }, n.geoSinuMollweideRaw = kt, n.geoSinusoidal = function() {
          return a.geoProjection(he).scale(152.63);
        }, n.geoSinusoidalRaw = he, n.geoStitch = function(Qe) {
          if (Qe == null) return Qe;
          switch (Qe.type) {
            case "Feature":
              return vo(Qe);
            case "FeatureCollection":
              var nt = { type: "FeatureCollection", features: Qe.features.map(vo) };
              return Qe.bbox != null && (nt.bbox = Qe.bbox), nt;
            default:
              return xh(Qe);
          }
        }, n.geoTimes = function() {
          return a.geoProjection(kf).scale(146.153);
        }, n.geoTimesRaw = kf, n.geoTwoPointAzimuthal = Yh, n.geoTwoPointAzimuthalRaw = Op, n.geoTwoPointAzimuthalUsa = function() {
          return Yh([-158, 21.5], [-77, 39]).clipAngle(60).scale(400);
        }, n.geoTwoPointEquidistant = rc, n.geoTwoPointEquidistantRaw = Pp, n.geoTwoPointEquidistantUsa = function() {
          return rc([-158, 21.5], [-77, 39]).clipAngle(130).scale(122.571);
        }, n.geoVanDerGrinten = function() {
          return a.geoProjection(nc).scale(79.4183);
        }, n.geoVanDerGrintenRaw = nc, n.geoVanDerGrinten2 = function() {
          return a.geoProjection(Rc).scale(79.4183);
        }, n.geoVanDerGrinten2Raw = Rc, n.geoVanDerGrinten3 = function() {
          return a.geoProjection(zc).scale(79.4183);
        }, n.geoVanDerGrinten3Raw = zc, n.geoVanDerGrinten4 = function() {
          return a.geoProjection(Bc).scale(127.16);
        }, n.geoVanDerGrinten4Raw = Bc, n.geoWagner = bu, n.geoWagner7 = function() {
          return bu().poleline(65).parallels(60).inflation(0).ratio(200).scale(172.633);
        }, n.geoWagnerRaw = Tf, n.geoWagner4 = function() {
          return a.geoProjection(Uc).scale(176.84);
        }, n.geoWagner4Raw = Uc, n.geoWagner6 = function() {
          return a.geoProjection(_h).scale(152.63);
        }, n.geoWagner6Raw = _h, n.geoWiechel = function() {
          return a.geoProjection(ac).rotate([0, -90, 45]).scale(124.75).clipAngle(179.999);
        }, n.geoWiechelRaw = ac, n.geoWinkel3 = function() {
          return a.geoProjection(lo).scale(158.837);
        }, n.geoWinkel3Raw = lo, Object.defineProperty(n, "__esModule", { value: true });
      });
    }, { "d3-array": 107, "d3-geo": 114 }], 114: [function(e, t, r) {
      (function(n, a) {
        typeof r == "object" && t !== void 0 ? a(r, e("d3-array")) : a((n = n || self).d3 = n.d3 || {}, n.d3);
      })(this, function(n, a) {
        "use strict";
        function o() {
          return new s();
        }
        function s() {
          this.reset();
        }
        s.prototype = { constructor: s, reset: function() {
          this.s = this.t = 0;
        }, add: function(At) {
          l(i, At, this.t), l(this, i.s, this.s), this.s ? this.t += i.t : this.s = i.t;
        }, valueOf: function() {
          return this.s;
        } };
        var i = new s();
        function l(At, Ht, dr) {
          var Qt = At.s = Ht + dr, vr = Qt - Ht, Vr = Qt - vr;
          At.t = Ht - Vr + (dr - vr);
        }
        var u2 = 1e-6, c = Math.PI, f = c / 2, h = c / 4, p = 2 * c, d = 180 / c, v = c / 180, m = Math.abs, g = Math.atan, x = Math.atan2, b = Math.cos, y = Math.ceil, w = Math.exp, _4 = Math.log, k = Math.pow, T2 = Math.sin, A2 = Math.sign || function(At) {
          return At > 0 ? 1 : At < 0 ? -1 : 0;
        }, S2 = Math.sqrt, C2 = Math.tan;
        function E2(At) {
          return At > 1 ? 0 : At < -1 ? c : Math.acos(At);
        }
        function F13(At) {
          return At > 1 ? f : At < -1 ? -f : Math.asin(At);
        }
        function N2(At) {
          return (At = T2(At / 2)) * At;
        }
        function D2() {
        }
        function I2(At, Ht) {
          At && L2.hasOwnProperty(At.type) && L2[At.type](At, Ht);
        }
        var O2 = { Feature: function(At, Ht) {
          I2(At.geometry, Ht);
        }, FeatureCollection: function(At, Ht) {
          for (var dr = At.features, Qt = -1, vr = dr.length; ++Qt < vr; ) I2(dr[Qt].geometry, Ht);
        } }, L2 = { Sphere: function(At, Ht) {
          Ht.sphere();
        }, Point: function(At, Ht) {
          At = At.coordinates, Ht.point(At[0], At[1], At[2]);
        }, MultiPoint: function(At, Ht) {
          for (var dr = At.coordinates, Qt = -1, vr = dr.length; ++Qt < vr; ) At = dr[Qt], Ht.point(At[0], At[1], At[2]);
        }, LineString: function(At, Ht) {
          V2(At.coordinates, Ht, 0);
        }, MultiLineString: function(At, Ht) {
          for (var dr = At.coordinates, Qt = -1, vr = dr.length; ++Qt < vr; ) V2(dr[Qt], Ht, 0);
        }, Polygon: function(At, Ht) {
          W2(At.coordinates, Ht);
        }, MultiPolygon: function(At, Ht) {
          for (var dr = At.coordinates, Qt = -1, vr = dr.length; ++Qt < vr; ) W2(dr[Qt], Ht);
        }, GeometryCollection: function(At, Ht) {
          for (var dr = At.geometries, Qt = -1, vr = dr.length; ++Qt < vr; ) I2(dr[Qt], Ht);
        } };
        function V2(At, Ht, dr) {
          var Qt, vr = -1, Vr = At.length - dr;
          for (Ht.lineStart(); ++vr < Vr; ) Qt = At[vr], Ht.point(Qt[0], Qt[1], Qt[2]);
          Ht.lineEnd();
        }
        function W2(At, Ht) {
          var dr = -1, Qt = At.length;
          for (Ht.polygonStart(); ++dr < Qt; ) V2(At[dr], Ht, 1);
          Ht.polygonEnd();
        }
        function X2(At, Ht) {
          At && O2.hasOwnProperty(At.type) ? O2[At.type](At, Ht) : I2(At, Ht);
        }
        var Y2, K2, q, re, R2, z = o(), H2 = o(), te = { point: D2, lineStart: D2, lineEnd: D2, polygonStart: function() {
          z.reset(), te.lineStart = j, te.lineEnd = Q2;
        }, polygonEnd: function() {
          var At = +z;
          H2.add(At < 0 ? p + At : At), this.lineStart = this.lineEnd = this.point = D2;
        }, sphere: function() {
          H2.add(p);
        } };
        function j() {
          te.point = Z2;
        }
        function Q2() {
          ne(Y2, K2);
        }
        function Z2(At, Ht) {
          te.point = ne, Y2 = At, K2 = Ht, q = At *= v, re = b(Ht = (Ht *= v) / 2 + h), R2 = T2(Ht);
        }
        function ne(At, Ht) {
          var dr = (At *= v) - q, Qt = dr >= 0 ? 1 : -1, vr = Qt * dr, Vr = b(Ht = (Ht *= v) / 2 + h), Jr = T2(Ht), dn = R2 * Jr, En = re * Vr + dn * b(vr), Tn = dn * Qt * T2(vr);
          z.add(x(Tn, En)), q = At, re = Vr, R2 = Jr;
        }
        function ae(At) {
          return [x(At[1], At[0]), F13(At[2])];
        }
        function ue(At) {
          var Ht = At[0], dr = At[1], Qt = b(dr);
          return [Qt * b(Ht), Qt * T2(Ht), T2(dr)];
        }
        function le(At, Ht) {
          return At[0] * Ht[0] + At[1] * Ht[1] + At[2] * Ht[2];
        }
        function ce(At, Ht) {
          return [At[1] * Ht[2] - At[2] * Ht[1], At[2] * Ht[0] - At[0] * Ht[2], At[0] * Ht[1] - At[1] * Ht[0]];
        }
        function se(At, Ht) {
          At[0] += Ht[0], At[1] += Ht[1], At[2] += Ht[2];
        }
        function he(At, Ht) {
          return [At[0] * Ht, At[1] * Ht, At[2] * Ht];
        }
        function me(At) {
          var Ht = S2(At[0] * At[0] + At[1] * At[1] + At[2] * At[2]);
          At[0] /= Ht, At[1] /= Ht, At[2] /= Ht;
        }
        var we, be, Ae, pe, ve, Ee, Se, Ce, Be, Ue, Ke, ct, We, Ze, it, ot, mt, wt, Et, zt, Nt, yt, pt, Ot, Jt, tr, Ye = o(), at = { point: Ge, lineStart: Ie, lineEnd: Pe, polygonStart: function() {
          at.point = $e, at.lineStart = Ve, at.lineEnd = ut, Ye.reset(), te.polygonStart();
        }, polygonEnd: function() {
          te.polygonEnd(), at.point = Ge, at.lineStart = Ie, at.lineEnd = Pe, z < 0 ? (we = -(Ae = 180), be = -(pe = 90)) : Ye > u2 ? pe = 90 : Ye < -u2 && (be = -90), Ue[0] = we, Ue[1] = Ae;
        }, sphere: function() {
          we = -(Ae = 180), be = -(pe = 90);
        } };
        function Ge(At, Ht) {
          Be.push(Ue = [we = At, Ae = At]), Ht < be && (be = Ht), Ht > pe && (pe = Ht);
        }
        function st(At, Ht) {
          var dr = ue([At * v, Ht * v]);
          if (Ce) {
            var Qt = ce(Ce, dr), vr = ce([Qt[1], -Qt[0], 0], Qt);
            me(vr), vr = ae(vr);
            var Vr, Jr = At - ve, dn = Jr > 0 ? 1 : -1, En = vr[0] * d * dn, Tn = m(Jr) > 180;
            Tn ^ (dn * ve < En && En < dn * At) ? (Vr = vr[1] * d) > pe && (pe = Vr) : Tn ^ (dn * ve < (En = (En + 360) % 360 - 180) && En < dn * At) ? (Vr = -vr[1] * d) < be && (be = Vr) : (Ht < be && (be = Ht), Ht > pe && (pe = Ht)), Tn ? At < ve ? Re(we, At) > Re(we, Ae) && (Ae = At) : Re(At, Ae) > Re(we, Ae) && (we = At) : Ae >= we ? (At < we && (we = At), At > Ae && (Ae = At)) : At > ve ? Re(we, At) > Re(we, Ae) && (Ae = At) : Re(At, Ae) > Re(we, Ae) && (we = At);
          } else Be.push(Ue = [we = At, Ae = At]);
          Ht < be && (be = Ht), Ht > pe && (pe = Ht), Ce = dr, ve = At;
        }
        function Ie() {
          at.point = st;
        }
        function Pe() {
          Ue[0] = we, Ue[1] = Ae, at.point = Ge, Ce = null;
        }
        function $e(At, Ht) {
          if (Ce) {
            var dr = At - ve;
            Ye.add(m(dr) > 180 ? dr + (dr > 0 ? 360 : -360) : dr);
          } else Ee = At, Se = Ht;
          te.point(At, Ht), st(At, Ht);
        }
        function Ve() {
          te.lineStart();
        }
        function ut() {
          $e(Ee, Se), te.lineEnd(), m(Ye) > u2 && (we = -(Ae = 180)), Ue[0] = we, Ue[1] = Ae, Ce = null;
        }
        function Re(At, Ht) {
          return (Ht -= At) < 0 ? Ht + 360 : Ht;
        }
        function qe(At, Ht) {
          return At[0] - Ht[0];
        }
        function je(At, Ht) {
          return At[0] <= At[1] ? At[0] <= Ht && Ht <= At[1] : Ht < At[0] || At[1] < Ht;
        }
        var rt = { sphere: D2, point: He, lineStart: Ne, lineEnd: Le, polygonStart: function() {
          rt.lineStart = ze, rt.lineEnd = ft;
        }, polygonEnd: function() {
          rt.lineStart = Ne, rt.lineEnd = Le;
        } };
        function He(At, Ht) {
          At *= v;
          var dr = b(Ht *= v);
          xe(dr * b(At), dr * T2(At), T2(Ht));
        }
        function xe(At, Ht, dr) {
          ++Ke, We += (At - We) / Ke, Ze += (Ht - Ze) / Ke, it += (dr - it) / Ke;
        }
        function Ne() {
          rt.point = ke;
        }
        function ke(At, Ht) {
          At *= v;
          var dr = b(Ht *= v);
          Ot = dr * b(At), Jt = dr * T2(At), tr = T2(Ht), rt.point = Me, xe(Ot, Jt, tr);
        }
        function Me(At, Ht) {
          At *= v;
          var dr = b(Ht *= v), Qt = dr * b(At), vr = dr * T2(At), Vr = T2(Ht), Jr = x(S2((Jr = Jt * Vr - tr * vr) * Jr + (Jr = tr * Qt - Ot * Vr) * Jr + (Jr = Ot * vr - Jt * Qt) * Jr), Ot * Qt + Jt * vr + tr * Vr);
          ct += Jr, ot += Jr * (Ot + (Ot = Qt)), mt += Jr * (Jt + (Jt = vr)), wt += Jr * (tr + (tr = Vr)), xe(Ot, Jt, tr);
        }
        function Le() {
          rt.point = He;
        }
        function ze() {
          rt.point = De;
        }
        function ft() {
          Je(yt, pt), rt.point = He;
        }
        function De(At, Ht) {
          yt = At, pt = Ht, At *= v, Ht *= v, rt.point = Je;
          var dr = b(Ht);
          Ot = dr * b(At), Jt = dr * T2(At), tr = T2(Ht), xe(Ot, Jt, tr);
        }
        function Je(At, Ht) {
          At *= v;
          var dr = b(Ht *= v), Qt = dr * b(At), vr = dr * T2(At), Vr = T2(Ht), Jr = Jt * Vr - tr * vr, dn = tr * Qt - Ot * Vr, En = Ot * vr - Jt * Qt, Tn = S2(Jr * Jr + dn * dn + En * En), Pn = F13(Tn), Gn = Tn && -Pn / Tn;
          Et += Gn * Jr, zt += Gn * dn, Nt += Gn * En, ct += Pn, ot += Pn * (Ot + (Ot = Qt)), mt += Pn * (Jt + (Jt = vr)), wt += Pn * (tr + (tr = Vr)), xe(Ot, Jt, tr);
        }
        function tt(At) {
          return function() {
            return At;
          };
        }
        function vt(At, Ht) {
          function dr(Qt, vr) {
            return Qt = At(Qt, vr), Ht(Qt[0], Qt[1]);
          }
          return At.invert && Ht.invert && (dr.invert = function(Qt, vr) {
            return (Qt = Ht.invert(Qt, vr)) && At.invert(Qt[0], Qt[1]);
          }), dr;
        }
        function kt(At, Ht) {
          return [m(At) > c ? At + Math.round(-At / p) * p : At, Ht];
        }
        function jt(At, Ht, dr) {
          return (At %= p) ? Ht || dr ? vt(Kt(At), rr(Ht, dr)) : Kt(At) : Ht || dr ? rr(Ht, dr) : kt;
        }
        function Vt(At) {
          return function(Ht, dr) {
            return [(Ht += At) > c ? Ht - p : Ht < -c ? Ht + p : Ht, dr];
          };
        }
        function Kt(At) {
          var Ht = Vt(At);
          return Ht.invert = Vt(-At), Ht;
        }
        function rr(At, Ht) {
          var dr = b(At), Qt = T2(At), vr = b(Ht), Vr = T2(Ht);
          function Jr(dn, En) {
            var Tn = b(En), Pn = b(dn) * Tn, Gn = T2(dn) * Tn, Dn = T2(En), $n = Dn * dr + Pn * Qt;
            return [x(Gn * vr - $n * Vr, Pn * dr - Dn * Qt), F13($n * vr + Gn * Vr)];
          }
          return Jr.invert = function(dn, En) {
            var Tn = b(En), Pn = b(dn) * Tn, Gn = T2(dn) * Tn, Dn = T2(En), $n = Dn * vr - Gn * Vr;
            return [x(Gn * vr + Dn * Vr, Pn * dr + $n * Qt), F13($n * dr - Pn * Qt)];
          }, Jr;
        }
        function Tr(At) {
          function Ht(dr) {
            return (dr = At(dr[0] * v, dr[1] * v))[0] *= d, dr[1] *= d, dr;
          }
          return At = jt(At[0] * v, At[1] * v, At.length > 2 ? At[2] * v : 0), Ht.invert = function(dr) {
            return (dr = At.invert(dr[0] * v, dr[1] * v))[0] *= d, dr[1] *= d, dr;
          }, Ht;
        }
        function yr(At, Ht, dr, Qt, vr, Vr) {
          if (dr) {
            var Jr = b(Ht), dn = T2(Ht), En = Qt * dr;
            vr == null ? (vr = Ht + Qt * p, Vr = Ht - En / 2) : (vr = pr(Jr, vr), Vr = pr(Jr, Vr), (Qt > 0 ? vr < Vr : vr > Vr) && (vr += Qt * p));
            for (var Tn, Pn = vr; Qt > 0 ? Pn > Vr : Pn < Vr; Pn -= En) Tn = ae([Jr, -dn * b(Pn), -dn * T2(Pn)]), At.point(Tn[0], Tn[1]);
          }
        }
        function pr(At, Ht) {
          (Ht = ue(Ht))[0] -= At, me(Ht);
          var dr = E2(-Ht[1]);
          return ((-Ht[2] < 0 ? -dr : dr) + p - u2) % p;
        }
        function lr() {
          var At, Ht = [];
          return { point: function(dr, Qt, vr) {
            At.push([dr, Qt, vr]);
          }, lineStart: function() {
            Ht.push(At = []);
          }, lineEnd: D2, rejoin: function() {
            Ht.length > 1 && Ht.push(Ht.pop().concat(Ht.shift()));
          }, result: function() {
            var dr = Ht;
            return Ht = [], At = null, dr;
          } };
        }
        function _r(At, Ht) {
          return m(At[0] - Ht[0]) < u2 && m(At[1] - Ht[1]) < u2;
        }
        function $r(At, Ht, dr, Qt) {
          this.x = At, this.z = Ht, this.o = dr, this.e = Qt, this.v = false, this.n = this.p = null;
        }
        function Ar(At, Ht, dr, Qt, vr) {
          var Vr, Jr, dn = [], En = [];
          if (At.forEach(function(ca) {
            if (!((ya = ca.length - 1) <= 0)) {
              var ya, Ra, mn = ca[0], Fa = ca[ya];
              if (_r(mn, Fa)) {
                if (!mn[2] && !Fa[2]) {
                  for (vr.lineStart(), Vr = 0; Vr < ya; ++Vr) vr.point((mn = ca[Vr])[0], mn[1]);
                  return void vr.lineEnd();
                }
                Fa[0] += 2 * u2;
              }
              dn.push(Ra = new $r(mn, ca, null, true)), En.push(Ra.o = new $r(mn, null, Ra, false)), dn.push(Ra = new $r(Fa, ca, null, false)), En.push(Ra.o = new $r(Fa, null, Ra, true));
            }
          }), dn.length) {
            for (En.sort(Ht), Qr(dn), Qr(En), Vr = 0, Jr = En.length; Vr < Jr; ++Vr) En[Vr].e = dr = !dr;
            for (var Tn, Pn, Gn = dn[0]; ; ) {
              for (var Dn = Gn, $n = true; Dn.v; ) if ((Dn = Dn.n) === Gn) return;
              Tn = Dn.z, vr.lineStart();
              do {
                if (Dn.v = Dn.o.v = true, Dn.e) {
                  if ($n) for (Vr = 0, Jr = Tn.length; Vr < Jr; ++Vr) vr.point((Pn = Tn[Vr])[0], Pn[1]);
                  else Qt(Dn.x, Dn.n.x, 1, vr);
                  Dn = Dn.n;
                } else {
                  if ($n) for (Tn = Dn.p.z, Vr = Tn.length - 1; Vr >= 0; --Vr) vr.point((Pn = Tn[Vr])[0], Pn[1]);
                  else Qt(Dn.x, Dn.p.x, -1, vr);
                  Dn = Dn.p;
                }
                Tn = (Dn = Dn.o).z, $n = !$n;
              } while (!Dn.v);
              vr.lineEnd();
            }
          }
        }
        function Qr(At) {
          if (Ht = At.length) {
            for (var Ht, dr, Qt = 0, vr = At[0]; ++Qt < Ht; ) vr.n = dr = At[Qt], dr.p = vr, vr = dr;
            vr.n = dr = At[0], dr.p = vr;
          }
        }
        kt.invert = kt;
        var hn = o();
        function wn(At) {
          return m(At[0]) <= c ? At[0] : A2(At[0]) * ((m(At[0]) + c) % p - c);
        }
        function Yn(At, Ht) {
          var dr = wn(Ht), Qt = Ht[1], vr = T2(Qt), Vr = [T2(dr), -b(dr), 0], Jr = 0, dn = 0;
          hn.reset(), vr === 1 ? Qt = f + u2 : vr === -1 && (Qt = -f - u2);
          for (var En = 0, Tn = At.length; En < Tn; ++En) if (Gn = (Pn = At[En]).length) for (var Pn, Gn, Dn = Pn[Gn - 1], $n = wn(Dn), ca = Dn[1] / 2 + h, ya = T2(ca), Ra = b(ca), mn = 0; mn < Gn; ++mn, $n = ra, ya = Ia, Ra = Si, Dn = Fa) {
            var Fa = Pn[mn], ra = wn(Fa), va = Fa[1] / 2 + h, Ia = T2(va), Si = b(va), Vi = ra - $n, Jn = Vi >= 0 ? 1 : -1, Xi = Jn * Vi, Bi = Xi > c, li = ya * Ia;
            if (hn.add(x(li * Jn * T2(Xi), Ra * Si + li * b(Xi))), Jr += Bi ? Vi + Jn * p : Vi, Bi ^ $n >= dr ^ ra >= dr) {
              var Ki = ce(ue(Dn), ue(Fa));
              me(Ki);
              var Fi = ce(Vr, Ki);
              me(Fi);
              var Do = (Bi ^ Vi >= 0 ? -1 : 1) * F13(Fi[2]);
              (Qt > Do || Qt === Do && (Ki[0] || Ki[1])) && (dn += Bi ^ Vi >= 0 ? 1 : -1);
            }
          }
          return (Jr < -u2 || Jr < u2 && hn < -u2) ^ 1 & dn;
        }
        function Xn(At, Ht, dr, Qt) {
          return function(vr) {
            var Vr, Jr, dn, En = Ht(vr), Tn = lr(), Pn = Ht(Tn), Gn = false, Dn = { point: $n, lineStart: ya, lineEnd: Ra, polygonStart: function() {
              Dn.point = mn, Dn.lineStart = Fa, Dn.lineEnd = ra, Jr = [], Vr = [];
            }, polygonEnd: function() {
              Dn.point = $n, Dn.lineStart = ya, Dn.lineEnd = Ra, Jr = a.merge(Jr);
              var va = Yn(Vr, Qt);
              Jr.length ? (Gn || (vr.polygonStart(), Gn = true), Ar(Jr, _n, va, dr, vr)) : va && (Gn || (vr.polygonStart(), Gn = true), vr.lineStart(), dr(null, null, 1, vr), vr.lineEnd()), Gn && (vr.polygonEnd(), Gn = false), Jr = Vr = null;
            }, sphere: function() {
              vr.polygonStart(), vr.lineStart(), dr(null, null, 1, vr), vr.lineEnd(), vr.polygonEnd();
            } };
            function $n(va, Ia) {
              At(va, Ia) && vr.point(va, Ia);
            }
            function ca(va, Ia) {
              En.point(va, Ia);
            }
            function ya() {
              Dn.point = ca, En.lineStart();
            }
            function Ra() {
              Dn.point = $n, En.lineEnd();
            }
            function mn(va, Ia) {
              dn.push([va, Ia]), Pn.point(va, Ia);
            }
            function Fa() {
              Pn.lineStart(), dn = [];
            }
            function ra() {
              mn(dn[0][0], dn[0][1]), Pn.lineEnd();
              var va, Ia, Si, Vi, Jn = Pn.clean(), Xi = Tn.result(), Bi = Xi.length;
              if (dn.pop(), Vr.push(dn), dn = null, Bi) if (1 & Jn) {
                if ((Ia = (Si = Xi[0]).length - 1) > 0) {
                  for (Gn || (vr.polygonStart(), Gn = true), vr.lineStart(), va = 0; va < Ia; ++va) vr.point((Vi = Si[va])[0], Vi[1]);
                  vr.lineEnd();
                }
              } else Bi > 1 && 2 & Jn && Xi.push(Xi.pop().concat(Xi.shift())), Jr.push(Xi.filter(Wn));
            }
            return Dn;
          };
        }
        function Wn(At) {
          return At.length > 1;
        }
        function _n(At, Ht) {
          return ((At = At.x)[0] < 0 ? At[1] - f - u2 : f - At[1]) - ((Ht = Ht.x)[0] < 0 ? Ht[1] - f - u2 : f - Ht[1]);
        }
        var qr = Xn(function() {
          return true;
        }, function(At) {
          var Ht, dr = NaN, Qt = NaN, vr = NaN;
          return { lineStart: function() {
            At.lineStart(), Ht = 1;
          }, point: function(Vr, Jr) {
            var dn = Vr > 0 ? c : -c, En = m(Vr - dr);
            m(En - c) < u2 ? (At.point(dr, Qt = (Qt + Jr) / 2 > 0 ? f : -f), At.point(vr, Qt), At.lineEnd(), At.lineStart(), At.point(dn, Qt), At.point(Vr, Qt), Ht = 0) : vr !== dn && En >= c && (m(dr - vr) < u2 && (dr -= vr * u2), m(Vr - dn) < u2 && (Vr -= dn * u2), Qt = function(Tn, Pn, Gn, Dn) {
              var $n, ca, ya = T2(Tn - Gn);
              return m(ya) > u2 ? g((T2(Pn) * (ca = b(Dn)) * T2(Gn) - T2(Dn) * ($n = b(Pn)) * T2(Tn)) / ($n * ca * ya)) : (Pn + Dn) / 2;
            }(dr, Qt, Vr, Jr), At.point(vr, Qt), At.lineEnd(), At.lineStart(), At.point(dn, Qt), Ht = 0), At.point(dr = Vr, Qt = Jr), vr = dn;
          }, lineEnd: function() {
            At.lineEnd(), dr = Qt = NaN;
          }, clean: function() {
            return 2 - Ht;
          } };
        }, function(At, Ht, dr, Qt) {
          var vr;
          if (At == null) vr = dr * f, Qt.point(-c, vr), Qt.point(0, vr), Qt.point(c, vr), Qt.point(c, 0), Qt.point(c, -vr), Qt.point(0, -vr), Qt.point(-c, -vr), Qt.point(-c, 0), Qt.point(-c, vr);
          else if (m(At[0] - Ht[0]) > u2) {
            var Vr = At[0] < Ht[0] ? c : -c;
            vr = dr * Vr / 2, Qt.point(-Vr, vr), Qt.point(0, vr), Qt.point(Vr, vr);
          } else Qt.point(Ht[0], Ht[1]);
        }, [-c, -f]);
        function Nr(At) {
          var Ht = b(At), dr = 6 * v, Qt = Ht > 0, vr = m(Ht) > u2;
          function Vr(En, Tn) {
            return b(En) * b(Tn) > Ht;
          }
          function Jr(En, Tn, Pn) {
            var Gn = [1, 0, 0], Dn = ce(ue(En), ue(Tn)), $n = le(Dn, Dn), ca = Dn[0], ya = $n - ca * ca;
            if (!ya) return !Pn && En;
            var Ra = Ht * $n / ya, mn = -Ht * ca / ya, Fa = ce(Gn, Dn), ra = he(Gn, Ra);
            se(ra, he(Dn, mn));
            var va = Fa, Ia = le(ra, va), Si = le(va, va), Vi = Ia * Ia - Si * (le(ra, ra) - 1);
            if (!(Vi < 0)) {
              var Jn = S2(Vi), Xi = he(va, (-Ia - Jn) / Si);
              if (se(Xi, ra), Xi = ae(Xi), !Pn) return Xi;
              var Bi, li = En[0], Ki = Tn[0], Fi = En[1], Do = Tn[1];
              Ki < li && (Bi = li, li = Ki, Ki = Bi);
              var Oa = Ki - li, mo = m(Oa - c) < u2;
              if (!mo && Do < Fi && (Bi = Fi, Fi = Do, Do = Bi), mo || Oa < u2 ? mo ? Fi + Do > 0 ^ Xi[1] < (m(Xi[0] - li) < u2 ? Fi : Do) : Fi <= Xi[1] && Xi[1] <= Do : Oa > c ^ (li <= Xi[0] && Xi[0] <= Ki)) {
                var il = he(va, (-Ia + Jn) / Si);
                return se(il, ra), [Xi, ae(il)];
              }
            }
          }
          function dn(En, Tn) {
            var Pn = Qt ? At : c - At, Gn = 0;
            return En < -Pn ? Gn |= 1 : En > Pn && (Gn |= 2), Tn < -Pn ? Gn |= 4 : Tn > Pn && (Gn |= 8), Gn;
          }
          return Xn(Vr, function(En) {
            var Tn, Pn, Gn, Dn, $n;
            return { lineStart: function() {
              Dn = Gn = false, $n = 1;
            }, point: function(ca, ya) {
              var Ra, mn = [ca, ya], Fa = Vr(ca, ya), ra = Qt ? Fa ? 0 : dn(ca, ya) : Fa ? dn(ca + (ca < 0 ? c : -c), ya) : 0;
              if (!Tn && (Dn = Gn = Fa) && En.lineStart(), Fa !== Gn && (!(Ra = Jr(Tn, mn)) || _r(Tn, Ra) || _r(mn, Ra)) && (mn[2] = 1), Fa !== Gn) $n = 0, Fa ? (En.lineStart(), Ra = Jr(mn, Tn), En.point(Ra[0], Ra[1])) : (Ra = Jr(Tn, mn), En.point(Ra[0], Ra[1], 2), En.lineEnd()), Tn = Ra;
              else if (vr && Tn && Qt ^ Fa) {
                var va;
                ra & Pn || !(va = Jr(mn, Tn, true)) || ($n = 0, Qt ? (En.lineStart(), En.point(va[0][0], va[0][1]), En.point(va[1][0], va[1][1]), En.lineEnd()) : (En.point(va[1][0], va[1][1]), En.lineEnd(), En.lineStart(), En.point(va[0][0], va[0][1], 3)));
              }
              !Fa || Tn && _r(Tn, mn) || En.point(mn[0], mn[1]), Tn = mn, Gn = Fa, Pn = ra;
            }, lineEnd: function() {
              Gn && En.lineEnd(), Tn = null;
            }, clean: function() {
              return $n | (Dn && Gn) << 1;
            } };
          }, function(En, Tn, Pn, Gn) {
            yr(Gn, At, dr, Pn, En, Tn);
          }, Qt ? [0, -At] : [-c, At - c]);
        }
        function Zr(At, Ht, dr, Qt) {
          function vr(Tn, Pn) {
            return At <= Tn && Tn <= dr && Ht <= Pn && Pn <= Qt;
          }
          function Vr(Tn, Pn, Gn, Dn) {
            var $n = 0, ca = 0;
            if (Tn == null || ($n = Jr(Tn, Gn)) !== (ca = Jr(Pn, Gn)) || En(Tn, Pn) < 0 ^ Gn > 0) do
              Dn.point($n === 0 || $n === 3 ? At : dr, $n > 1 ? Qt : Ht);
            while (($n = ($n + Gn + 4) % 4) !== ca);
            else Dn.point(Pn[0], Pn[1]);
          }
          function Jr(Tn, Pn) {
            return m(Tn[0] - At) < u2 ? Pn > 0 ? 0 : 3 : m(Tn[0] - dr) < u2 ? Pn > 0 ? 2 : 1 : m(Tn[1] - Ht) < u2 ? Pn > 0 ? 1 : 0 : Pn > 0 ? 3 : 2;
          }
          function dn(Tn, Pn) {
            return En(Tn.x, Pn.x);
          }
          function En(Tn, Pn) {
            var Gn = Jr(Tn, 1), Dn = Jr(Pn, 1);
            return Gn !== Dn ? Gn - Dn : Gn === 0 ? Pn[1] - Tn[1] : Gn === 1 ? Tn[0] - Pn[0] : Gn === 2 ? Tn[1] - Pn[1] : Pn[0] - Tn[0];
          }
          return function(Tn) {
            var Pn, Gn, Dn, $n, ca, ya, Ra, mn, Fa, ra, va, Ia = Tn, Si = lr(), Vi = { point: Jn, lineStart: function() {
              Vi.point = Xi, Gn && Gn.push(Dn = []), ra = true, Fa = false, Ra = mn = NaN;
            }, lineEnd: function() {
              Pn && (Xi($n, ca), ya && Fa && Si.rejoin(), Pn.push(Si.result())), Vi.point = Jn, Fa && Ia.lineEnd();
            }, polygonStart: function() {
              Ia = Si, Pn = [], Gn = [], va = true;
            }, polygonEnd: function() {
              var Bi = function() {
                for (var Fi = 0, Do = 0, Oa = Gn.length; Do < Oa; ++Do) for (var mo, il, Jc = Gn[Do], bc = 1, _u = Jc.length, gi = Jc[0], ls = gi[0], wu = gi[1]; bc < _u; ++bc) mo = ls, il = wu, gi = Jc[bc], ls = gi[0], wu = gi[1], il <= Qt ? wu > Qt && (ls - mo) * (Qt - il) > (wu - il) * (At - mo) && ++Fi : wu <= Qt && (ls - mo) * (Qt - il) < (wu - il) * (At - mo) && --Fi;
                return Fi;
              }(), li = va && Bi, Ki = (Pn = a.merge(Pn)).length;
              (li || Ki) && (Tn.polygonStart(), li && (Tn.lineStart(), Vr(null, null, 1, Tn), Tn.lineEnd()), Ki && Ar(Pn, dn, Bi, Vr, Tn), Tn.polygonEnd()), Ia = Tn, Pn = Gn = Dn = null;
            } };
            function Jn(Bi, li) {
              vr(Bi, li) && Ia.point(Bi, li);
            }
            function Xi(Bi, li) {
              var Ki = vr(Bi, li);
              if (Gn && Dn.push([Bi, li]), ra) $n = Bi, ca = li, ya = Ki, ra = false, Ki && (Ia.lineStart(), Ia.point(Bi, li));
              else if (Ki && Fa) Ia.point(Bi, li);
              else {
                var Fi = [Ra = Math.max(-1e9, Math.min(1e9, Ra)), mn = Math.max(-1e9, Math.min(1e9, mn))], Do = [Bi = Math.max(-1e9, Math.min(1e9, Bi)), li = Math.max(-1e9, Math.min(1e9, li))];
                (function(Oa, mo, il, Jc, bc, _u) {
                  var gi, ls = Oa[0], wu = Oa[1], go = 0, Ds = 1, Sl = mo[0] - ls, Fo = mo[1] - wu;
                  if (gi = il - ls, Sl || !(gi > 0)) {
                    if (gi /= Sl, Sl < 0) {
                      if (gi < go) return;
                      gi < Ds && (Ds = gi);
                    } else if (Sl > 0) {
                      if (gi > Ds) return;
                      gi > go && (go = gi);
                    }
                    if (gi = bc - ls, Sl || !(gi < 0)) {
                      if (gi /= Sl, Sl < 0) {
                        if (gi > Ds) return;
                        gi > go && (go = gi);
                      } else if (Sl > 0) {
                        if (gi < go) return;
                        gi < Ds && (Ds = gi);
                      }
                      if (gi = Jc - wu, Fo || !(gi > 0)) {
                        if (gi /= Fo, Fo < 0) {
                          if (gi < go) return;
                          gi < Ds && (Ds = gi);
                        } else if (Fo > 0) {
                          if (gi > Ds) return;
                          gi > go && (go = gi);
                        }
                        if (gi = _u - wu, Fo || !(gi < 0)) {
                          if (gi /= Fo, Fo < 0) {
                            if (gi > Ds) return;
                            gi > go && (go = gi);
                          } else if (Fo > 0) {
                            if (gi < go) return;
                            gi < Ds && (Ds = gi);
                          }
                          return go > 0 && (Oa[0] = ls + go * Sl, Oa[1] = wu + go * Fo), Ds < 1 && (mo[0] = ls + Ds * Sl, mo[1] = wu + Ds * Fo), true;
                        }
                      }
                    }
                  }
                })(Fi, Do, At, Ht, dr, Qt) ? (Fa || (Ia.lineStart(), Ia.point(Fi[0], Fi[1])), Ia.point(Do[0], Do[1]), Ki || Ia.lineEnd(), va = false) : Ki && (Ia.lineStart(), Ia.point(Bi, li), va = false);
              }
              Ra = Bi, mn = li, Fa = Ki;
            }
            return Vi;
          };
        }
        var oa, tn, Zn, Ln = o(), gn = { sphere: D2, point: D2, lineStart: function() {
          gn.point = sr, gn.lineEnd = na;
        }, lineEnd: D2, polygonStart: D2, polygonEnd: D2 };
        function na() {
          gn.point = gn.lineEnd = D2;
        }
        function sr(At, Ht) {
          oa = At *= v, tn = T2(Ht *= v), Zn = b(Ht), gn.point = Ut;
        }
        function Ut(At, Ht) {
          At *= v;
          var dr = T2(Ht *= v), Qt = b(Ht), vr = m(At - oa), Vr = b(vr), Jr = Qt * T2(vr), dn = Zn * dr - tn * Qt * Vr, En = tn * dr + Zn * Qt * Vr;
          Ln.add(x(S2(Jr * Jr + dn * dn), En)), oa = At, tn = dr, Zn = Qt;
        }
        function Zt(At) {
          return Ln.reset(), X2(At, gn), +Ln;
        }
        var xr = [null, null], Fr = { type: "LineString", coordinates: xr };
        function pn(At, Ht) {
          return xr[0] = At, xr[1] = Ht, Zt(Fr);
        }
        var un = { Feature: function(At, Ht) {
          return Cr(At.geometry, Ht);
        }, FeatureCollection: function(At, Ht) {
          for (var dr = At.features, Qt = -1, vr = dr.length; ++Qt < vr; ) if (Cr(dr[Qt].geometry, Ht)) return true;
          return false;
        } }, Ir = { Sphere: function() {
          return true;
        }, Point: function(At, Ht) {
          return Lr(At.coordinates, Ht);
        }, MultiPoint: function(At, Ht) {
          for (var dr = At.coordinates, Qt = -1, vr = dr.length; ++Qt < vr; ) if (Lr(dr[Qt], Ht)) return true;
          return false;
        }, LineString: function(At, Ht) {
          return jr(At.coordinates, Ht);
        }, MultiLineString: function(At, Ht) {
          for (var dr = At.coordinates, Qt = -1, vr = dr.length; ++Qt < vr; ) if (jr(dr[Qt], Ht)) return true;
          return false;
        }, Polygon: function(At, Ht) {
          return Rr(At.coordinates, Ht);
        }, MultiPolygon: function(At, Ht) {
          for (var dr = At.coordinates, Qt = -1, vr = dr.length; ++Qt < vr; ) if (Rr(dr[Qt], Ht)) return true;
          return false;
        }, GeometryCollection: function(At, Ht) {
          for (var dr = At.geometries, Qt = -1, vr = dr.length; ++Qt < vr; ) if (Cr(dr[Qt], Ht)) return true;
          return false;
        } };
        function Cr(At, Ht) {
          return !(!At || !Ir.hasOwnProperty(At.type)) && Ir[At.type](At, Ht);
        }
        function Lr(At, Ht) {
          return pn(At, Ht) === 0;
        }
        function jr(At, Ht) {
          for (var dr, Qt, vr, Vr = 0, Jr = At.length; Vr < Jr; Vr++) {
            if ((Qt = pn(At[Vr], Ht)) === 0 || Vr > 0 && (vr = pn(At[Vr], At[Vr - 1])) > 0 && dr <= vr && Qt <= vr && (dr + Qt - vr) * (1 - Math.pow((dr - Qt) / vr, 2)) < 1e-12 * vr) return true;
            dr = Qt;
          }
          return false;
        }
        function Rr(At, Ht) {
          return !!Yn(At.map(vn), Mn(Ht));
        }
        function vn(At) {
          return (At = At.map(Mn)).pop(), At;
        }
        function Mn(At) {
          return [At[0] * v, At[1] * v];
        }
        function jn(At, Ht, dr) {
          var Qt = a.range(At, Ht - u2, dr).concat(Ht);
          return function(vr) {
            return Qt.map(function(Vr) {
              return [vr, Vr];
            });
          };
        }
        function bn(At, Ht, dr) {
          var Qt = a.range(At, Ht - u2, dr).concat(Ht);
          return function(vr) {
            return Qt.map(function(Vr) {
              return [Vr, vr];
            });
          };
        }
        function Bn() {
          var At, Ht, dr, Qt, vr, Vr, Jr, dn, En, Tn, Pn, Gn, Dn = 10, $n = Dn, ca = 90, ya = 360, Ra = 2.5;
          function mn() {
            return { type: "MultiLineString", coordinates: Fa() };
          }
          function Fa() {
            return a.range(y(Qt / ca) * ca, dr, ca).map(Pn).concat(a.range(y(dn / ya) * ya, Jr, ya).map(Gn)).concat(a.range(y(Ht / Dn) * Dn, At, Dn).filter(function(ra) {
              return m(ra % ca) > u2;
            }).map(En)).concat(a.range(y(Vr / $n) * $n, vr, $n).filter(function(ra) {
              return m(ra % ya) > u2;
            }).map(Tn));
          }
          return mn.lines = function() {
            return Fa().map(function(ra) {
              return { type: "LineString", coordinates: ra };
            });
          }, mn.outline = function() {
            return { type: "Polygon", coordinates: [Pn(Qt).concat(Gn(Jr).slice(1), Pn(dr).reverse().slice(1), Gn(dn).reverse().slice(1))] };
          }, mn.extent = function(ra) {
            return arguments.length ? mn.extentMajor(ra).extentMinor(ra) : mn.extentMinor();
          }, mn.extentMajor = function(ra) {
            return arguments.length ? (Qt = +ra[0][0], dr = +ra[1][0], dn = +ra[0][1], Jr = +ra[1][1], Qt > dr && (ra = Qt, Qt = dr, dr = ra), dn > Jr && (ra = dn, dn = Jr, Jr = ra), mn.precision(Ra)) : [[Qt, dn], [dr, Jr]];
          }, mn.extentMinor = function(ra) {
            return arguments.length ? (Ht = +ra[0][0], At = +ra[1][0], Vr = +ra[0][1], vr = +ra[1][1], Ht > At && (ra = Ht, Ht = At, At = ra), Vr > vr && (ra = Vr, Vr = vr, vr = ra), mn.precision(Ra)) : [[Ht, Vr], [At, vr]];
          }, mn.step = function(ra) {
            return arguments.length ? mn.stepMajor(ra).stepMinor(ra) : mn.stepMinor();
          }, mn.stepMajor = function(ra) {
            return arguments.length ? (ca = +ra[0], ya = +ra[1], mn) : [ca, ya];
          }, mn.stepMinor = function(ra) {
            return arguments.length ? (Dn = +ra[0], $n = +ra[1], mn) : [Dn, $n];
          }, mn.precision = function(ra) {
            return arguments.length ? (Ra = +ra, En = jn(Vr, vr, 90), Tn = bn(Ht, At, Ra), Pn = jn(dn, Jr, 90), Gn = bn(Qt, dr, Ra), mn) : Ra;
          }, mn.extentMajor([[-180, -90 + u2], [180, 90 - u2]]).extentMinor([[-180, -80 - u2], [180, 80 + u2]]);
        }
        function sn(At) {
          return At;
        }
        var an, Sn, Rn, Kn, qa = o(), ka = o(), zn = { point: D2, lineStart: D2, lineEnd: D2, polygonStart: function() {
          zn.lineStart = ja, zn.lineEnd = Xs;
        }, polygonEnd: function() {
          zn.lineStart = zn.lineEnd = zn.point = D2, qa.add(m(ka)), ka.reset();
        }, result: function() {
          var At = qa / 2;
          return qa.reset(), At;
        } };
        function ja() {
          zn.point = si;
        }
        function si(At, Ht) {
          zn.point = ko, an = Rn = At, Sn = Kn = Ht;
        }
        function ko(At, Ht) {
          ka.add(Kn * At - Rn * Ht), Rn = At, Kn = Ht;
        }
        function Xs() {
          ko(an, Sn);
        }
        var Uo = 1 / 0, As = Uo, Ui = -Uo, so = Ui, gu = { point: function(At, Ht) {
          At < Uo && (Uo = At), At > Ui && (Ui = At), Ht < As && (As = Ht), Ht > so && (so = Ht);
        }, lineStart: D2, lineEnd: D2, polygonStart: D2, polygonEnd: D2, result: function() {
          var At = [[Uo, As], [Ui, so]];
          return Ui = so = -(As = Uo = 1 / 0), At;
        } }, Pc, Zc, Ll, Hl, Lc = 0, po = 0, tc = 0, yu = 0, Ss = 0, ql = 0, xu = 0, zu = 0, nl = 0, ss = { point: Rl, lineStart: Kh, lineEnd: xh, polygonStart: function() {
          ss.lineStart = kf, ss.lineEnd = Fp;
        }, polygonEnd: function() {
          ss.point = Rl, ss.lineStart = Kh, ss.lineEnd = xh;
        }, result: function() {
          var At = nl ? [xu / nl, zu / nl] : ql ? [yu / ql, Ss / ql] : tc ? [Lc / tc, po / tc] : [NaN, NaN];
          return Lc = po = tc = yu = Ss = ql = xu = zu = nl = 0, At;
        } };
        function Rl(At, Ht) {
          Lc += At, po += Ht, ++tc;
        }
        function Kh() {
          ss.point = Np;
        }
        function Np(At, Ht) {
          ss.point = vo, Rl(Ll = At, Hl = Ht);
        }
        function vo(At, Ht) {
          var dr = At - Ll, Qt = Ht - Hl, vr = S2(dr * dr + Qt * Qt);
          yu += vr * (Ll + At) / 2, Ss += vr * (Hl + Ht) / 2, ql += vr, Rl(Ll = At, Hl = Ht);
        }
        function xh() {
          ss.point = Rl;
        }
        function kf() {
          ss.point = Op;
        }
        function Fp() {
          Yh(Pc, Zc);
        }
        function Op(At, Ht) {
          ss.point = Yh, Rl(Pc = Ll = At, Zc = Hl = Ht);
        }
        function Yh(At, Ht) {
          var dr = At - Ll, Qt = Ht - Hl, vr = S2(dr * dr + Qt * Qt);
          yu += vr * (Ll + At) / 2, Ss += vr * (Hl + Ht) / 2, ql += vr, xu += (vr = Hl * At - Ll * Ht) * (Ll + At), zu += vr * (Hl + Ht), nl += 3 * vr, Rl(Ll = At, Hl = Ht);
        }
        function Pp(At) {
          this._context = At;
        }
        Pp.prototype = { _radius: 4.5, pointRadius: function(At) {
          return this._radius = At, this;
        }, polygonStart: function() {
          this._line = 0;
        }, polygonEnd: function() {
          this._line = NaN;
        }, lineStart: function() {
          this._point = 0;
        }, lineEnd: function() {
          this._line === 0 && this._context.closePath(), this._point = NaN;
        }, point: function(At, Ht) {
          switch (this._point) {
            case 0:
              this._context.moveTo(At, Ht), this._point = 1;
              break;
            case 1:
              this._context.lineTo(At, Ht);
              break;
            default:
              this._context.moveTo(At + this._radius, Ht), this._context.arc(At, Ht, this._radius, 0, p);
          }
        }, result: D2 };
        var rc, nc, Rc, zc, Bc, Tf = o(), bu = { point: D2, lineStart: function() {
          bu.point = bh;
        }, lineEnd: function() {
          rc && cu(nc, Rc), bu.point = D2;
        }, polygonStart: function() {
          rc = true;
        }, polygonEnd: function() {
          rc = null;
        }, result: function() {
          var At = +Tf;
          return Tf.reset(), At;
        } };
        function bh(At, Ht) {
          bu.point = cu, nc = zc = At, Rc = Bc = Ht;
        }
        function cu(At, Ht) {
          zc -= At, Bc -= Ht, Tf.add(S2(zc * zc + Bc * Bc)), zc = At, Bc = Ht;
        }
        function Uc() {
          this._string = [];
        }
        function _h(At) {
          return "m0," + At + "a" + At + "," + At + " 0 1,1 0," + -2 * At + "a" + At + "," + At + " 0 1,1 0," + 2 * At + "z";
        }
        function ac(At) {
          return function(Ht) {
            var dr = new lo();
            for (var Qt in At) dr[Qt] = At[Qt];
            return dr.stream = Ht, dr;
          };
        }
        function lo() {
        }
        function Qe(At, Ht, dr) {
          var Qt = At.clipExtent && At.clipExtent();
          return At.scale(150).translate([0, 0]), Qt != null && At.clipExtent(null), X2(dr, At.stream(gu)), Ht(gu.result()), Qt != null && At.clipExtent(Qt), At;
        }
        function nt(At, Ht, dr) {
          return Qe(At, function(Qt) {
            var vr = Ht[1][0] - Ht[0][0], Vr = Ht[1][1] - Ht[0][1], Jr = Math.min(vr / (Qt[1][0] - Qt[0][0]), Vr / (Qt[1][1] - Qt[0][1])), dn = +Ht[0][0] + (vr - Jr * (Qt[1][0] + Qt[0][0])) / 2, En = +Ht[0][1] + (Vr - Jr * (Qt[1][1] + Qt[0][1])) / 2;
            At.scale(150 * Jr).translate([dn, En]);
          }, dr);
        }
        function dt(At, Ht, dr) {
          return nt(At, [[0, 0], Ht], dr);
        }
        function _t(At, Ht, dr) {
          return Qe(At, function(Qt) {
            var vr = +Ht, Vr = vr / (Qt[1][0] - Qt[0][0]), Jr = (vr - Vr * (Qt[1][0] + Qt[0][0])) / 2, dn = -Vr * Qt[0][1];
            At.scale(150 * Vr).translate([Jr, dn]);
          }, dr);
        }
        function Ct(At, Ht, dr) {
          return Qe(At, function(Qt) {
            var vr = +Ht, Vr = vr / (Qt[1][1] - Qt[0][1]), Jr = -Vr * Qt[0][0], dn = (vr - Vr * (Qt[1][1] + Qt[0][1])) / 2;
            At.scale(150 * Vr).translate([Jr, dn]);
          }, dr);
        }
        Uc.prototype = { _radius: 4.5, _circle: _h(4.5), pointRadius: function(At) {
          return (At = +At) !== this._radius && (this._radius = At, this._circle = null), this;
        }, polygonStart: function() {
          this._line = 0;
        }, polygonEnd: function() {
          this._line = NaN;
        }, lineStart: function() {
          this._point = 0;
        }, lineEnd: function() {
          this._line === 0 && this._string.push("Z"), this._point = NaN;
        }, point: function(At, Ht) {
          switch (this._point) {
            case 0:
              this._string.push("M", At, ",", Ht), this._point = 1;
              break;
            case 1:
              this._string.push("L", At, ",", Ht);
              break;
            default:
              this._circle == null && (this._circle = _h(this._radius)), this._string.push("M", At, ",", Ht, this._circle);
          }
        }, result: function() {
          if (this._string.length) {
            var At = this._string.join("");
            return this._string = [], At;
          }
          return null;
        } }, lo.prototype = { constructor: lo, point: function(At, Ht) {
          this.stream.point(At, Ht);
        }, sphere: function() {
          this.stream.sphere();
        }, lineStart: function() {
          this.stream.lineStart();
        }, lineEnd: function() {
          this.stream.lineEnd();
        }, polygonStart: function() {
          this.stream.polygonStart();
        }, polygonEnd: function() {
          this.stream.polygonEnd();
        } };
        var St = b(30 * v);
        function Lt(At, Ht) {
          return +Ht ? /* @__PURE__ */ function(dr, Qt) {
            function vr(Vr, Jr, dn, En, Tn, Pn, Gn, Dn, $n, ca, ya, Ra, mn, Fa) {
              var ra = Gn - Vr, va = Dn - Jr, Ia = ra * ra + va * va;
              if (Ia > 4 * Qt && mn--) {
                var Si = En + ca, Vi = Tn + ya, Jn = Pn + Ra, Xi = S2(Si * Si + Vi * Vi + Jn * Jn), Bi = F13(Jn /= Xi), li = m(m(Jn) - 1) < u2 || m(dn - $n) < u2 ? (dn + $n) / 2 : x(Vi, Si), Ki = dr(li, Bi), Fi = Ki[0], Do = Ki[1], Oa = Fi - Vr, mo = Do - Jr, il = va * Oa - ra * mo;
                (il * il / Ia > Qt || m((ra * Oa + va * mo) / Ia - 0.5) > 0.3 || En * ca + Tn * ya + Pn * Ra < St) && (vr(Vr, Jr, dn, En, Tn, Pn, Fi, Do, li, Si /= Xi, Vi /= Xi, Jn, mn, Fa), Fa.point(Fi, Do), vr(Fi, Do, li, Si, Vi, Jn, Gn, Dn, $n, ca, ya, Ra, mn, Fa));
              }
            }
            return function(Vr) {
              var Jr, dn, En, Tn, Pn, Gn, Dn, $n, ca, ya, Ra, mn, Fa = { point: ra, lineStart: va, lineEnd: Si, polygonStart: function() {
                Vr.polygonStart(), Fa.lineStart = Vi;
              }, polygonEnd: function() {
                Vr.polygonEnd(), Fa.lineStart = va;
              } };
              function ra(Bi, li) {
                Bi = dr(Bi, li), Vr.point(Bi[0], Bi[1]);
              }
              function va() {
                $n = NaN, Fa.point = Ia, Vr.lineStart();
              }
              function Ia(Bi, li) {
                var Ki = ue([Bi, li]), Fi = dr(Bi, li);
                vr($n, ca, Dn, ya, Ra, mn, $n = Fi[0], ca = Fi[1], Dn = Bi, ya = Ki[0], Ra = Ki[1], mn = Ki[2], 16, Vr), Vr.point($n, ca);
              }
              function Si() {
                Fa.point = ra, Vr.lineEnd();
              }
              function Vi() {
                va(), Fa.point = Jn, Fa.lineEnd = Xi;
              }
              function Jn(Bi, li) {
                Ia(Jr = Bi, li), dn = $n, En = ca, Tn = ya, Pn = Ra, Gn = mn, Fa.point = Ia;
              }
              function Xi() {
                vr($n, ca, Dn, ya, Ra, mn, dn, En, Jr, Tn, Pn, Gn, 16, Vr), Fa.lineEnd = Si, Si();
              }
              return Fa;
            };
          }(At, Ht) : function(dr) {
            return ac({ point: function(Qt, vr) {
              Qt = dr(Qt, vr), this.stream.point(Qt[0], Qt[1]);
            } });
          }(At);
        }
        var ir = ac({ point: function(At, Ht) {
          this.stream.point(At * v, Ht * v);
        } });
        function or(At, Ht, dr, Qt, vr) {
          function Vr(Jr, dn) {
            return [Ht + At * (Jr *= Qt), dr - At * (dn *= vr)];
          }
          return Vr.invert = function(Jr, dn) {
            return [(Jr - Ht) / At * Qt, (dr - dn) / At * vr];
          }, Vr;
        }
        function nr(At, Ht, dr, Qt, vr, Vr) {
          var Jr = b(Vr), dn = T2(Vr), En = Jr * At, Tn = dn * At, Pn = Jr / At, Gn = dn / At, Dn = (dn * dr - Jr * Ht) / At, $n = (dn * Ht + Jr * dr) / At;
          function ca(ya, Ra) {
            return [En * (ya *= Qt) - Tn * (Ra *= vr) + Ht, dr - Tn * ya - En * Ra];
          }
          return ca.invert = function(ya, Ra) {
            return [Qt * (Pn * ya - Gn * Ra + Dn), vr * ($n - Gn * ya - Pn * Ra)];
          }, ca;
        }
        function fr(At) {
          return wr(function() {
            return At;
          })();
        }
        function wr(At) {
          var Ht, dr, Qt, vr, Vr, Jr, dn, En, Tn, Pn, Gn = 150, Dn = 480, $n = 250, ca = 0, ya = 0, Ra = 0, mn = 0, Fa = 0, ra = 0, va = 1, Ia = 1, Si = null, Vi = qr, Jn = null, Xi = sn, Bi = 0.5;
          function li(Oa) {
            return En(Oa[0] * v, Oa[1] * v);
          }
          function Ki(Oa) {
            return (Oa = En.invert(Oa[0], Oa[1])) && [Oa[0] * d, Oa[1] * d];
          }
          function Fi() {
            var Oa = nr(Gn, 0, 0, va, Ia, ra).apply(null, Ht(ca, ya)), mo = (ra ? nr : or)(Gn, Dn - Oa[0], $n - Oa[1], va, Ia, ra);
            return dr = jt(Ra, mn, Fa), dn = vt(Ht, mo), En = vt(dr, dn), Jr = Lt(dn, Bi), Do();
          }
          function Do() {
            return Tn = Pn = null, li;
          }
          return li.stream = function(Oa) {
            return Tn && Pn === Oa ? Tn : Tn = ir(function(mo) {
              return ac({ point: function(il, Jc) {
                var bc = mo(il, Jc);
                return this.stream.point(bc[0], bc[1]);
              } });
            }(dr)(Vi(Jr(Xi(Pn = Oa)))));
          }, li.preclip = function(Oa) {
            return arguments.length ? (Vi = Oa, Si = void 0, Do()) : Vi;
          }, li.postclip = function(Oa) {
            return arguments.length ? (Xi = Oa, Jn = Qt = vr = Vr = null, Do()) : Xi;
          }, li.clipAngle = function(Oa) {
            return arguments.length ? (Vi = +Oa ? Nr(Si = Oa * v) : (Si = null, qr), Do()) : Si * d;
          }, li.clipExtent = function(Oa) {
            return arguments.length ? (Xi = Oa == null ? (Jn = Qt = vr = Vr = null, sn) : Zr(Jn = +Oa[0][0], Qt = +Oa[0][1], vr = +Oa[1][0], Vr = +Oa[1][1]), Do()) : Jn == null ? null : [[Jn, Qt], [vr, Vr]];
          }, li.scale = function(Oa) {
            return arguments.length ? (Gn = +Oa, Fi()) : Gn;
          }, li.translate = function(Oa) {
            return arguments.length ? (Dn = +Oa[0], $n = +Oa[1], Fi()) : [Dn, $n];
          }, li.center = function(Oa) {
            return arguments.length ? (ca = Oa[0] % 360 * v, ya = Oa[1] % 360 * v, Fi()) : [ca * d, ya * d];
          }, li.rotate = function(Oa) {
            return arguments.length ? (Ra = Oa[0] % 360 * v, mn = Oa[1] % 360 * v, Fa = Oa.length > 2 ? Oa[2] % 360 * v : 0, Fi()) : [Ra * d, mn * d, Fa * d];
          }, li.angle = function(Oa) {
            return arguments.length ? (ra = Oa % 360 * v, Fi()) : ra * d;
          }, li.reflectX = function(Oa) {
            return arguments.length ? (va = Oa ? -1 : 1, Fi()) : va < 0;
          }, li.reflectY = function(Oa) {
            return arguments.length ? (Ia = Oa ? -1 : 1, Fi()) : Ia < 0;
          }, li.precision = function(Oa) {
            return arguments.length ? (Jr = Lt(dn, Bi = Oa * Oa), Do()) : S2(Bi);
          }, li.fitExtent = function(Oa, mo) {
            return nt(li, Oa, mo);
          }, li.fitSize = function(Oa, mo) {
            return dt(li, Oa, mo);
          }, li.fitWidth = function(Oa, mo) {
            return _t(li, Oa, mo);
          }, li.fitHeight = function(Oa, mo) {
            return Ct(li, Oa, mo);
          }, function() {
            return Ht = At.apply(this, arguments), li.invert = Ht.invert && Ki, Fi();
          };
        }
        function Er(At) {
          var Ht = 0, dr = c / 3, Qt = wr(At), vr = Qt(Ht, dr);
          return vr.parallels = function(Vr) {
            return arguments.length ? Qt(Ht = Vr[0] * v, dr = Vr[1] * v) : [Ht * d, dr * d];
          }, vr;
        }
        function Mr(At, Ht) {
          var dr = T2(At), Qt = (dr + T2(Ht)) / 2;
          if (m(Qt) < u2) return function(dn) {
            var En = b(dn);
            function Tn(Pn, Gn) {
              return [Pn * En, T2(Gn) / En];
            }
            return Tn.invert = function(Pn, Gn) {
              return [Pn / En, F13(Gn * En)];
            }, Tn;
          }(At);
          var vr = 1 + dr * (2 * Qt - dr), Vr = S2(vr) / Qt;
          function Jr(dn, En) {
            var Tn = S2(vr - 2 * Qt * T2(En)) / Qt;
            return [Tn * T2(dn *= Qt), Vr - Tn * b(dn)];
          }
          return Jr.invert = function(dn, En) {
            var Tn = Vr - En, Pn = x(dn, m(Tn)) * A2(Tn);
            return Tn * Qt < 0 && (Pn -= c * A2(dn) * A2(Tn)), [Pn / Qt, F13((vr - (dn * dn + Tn * Tn) * Qt * Qt) / (2 * Qt))];
          }, Jr;
        }
        function Wr() {
          return Er(Mr).scale(155.424).center([0, 33.6442]);
        }
        function kn() {
          return Wr().parallels([29.5, 45.5]).scale(1070).translate([480, 250]).rotate([96, 0]).center([-0.6, 38.7]);
        }
        function On(At) {
          return function(Ht, dr) {
            var Qt = b(Ht), vr = b(dr), Vr = At(Qt * vr);
            return [Vr * vr * T2(Ht), Vr * T2(dr)];
          };
        }
        function ta(At) {
          return function(Ht, dr) {
            var Qt = S2(Ht * Ht + dr * dr), vr = At(Qt), Vr = T2(vr), Jr = b(vr);
            return [x(Ht * Vr, Qt * Jr), F13(Qt && dr * Vr / Qt)];
          };
        }
        var sa = On(function(At) {
          return S2(2 / (1 + At));
        });
        sa.invert = ta(function(At) {
          return 2 * F13(At / 2);
        });
        var xa = On(function(At) {
          return (At = E2(At)) && At / T2(At);
        });
        function la(At, Ht) {
          return [At, _4(C2((f + Ht) / 2))];
        }
        function ci(At) {
          var Ht, dr, Qt, vr = fr(At), Vr = vr.center, Jr = vr.scale, dn = vr.translate, En = vr.clipExtent, Tn = null;
          function Pn() {
            var Gn = c * Jr(), Dn = vr(Tr(vr.rotate()).invert([0, 0]));
            return En(Tn == null ? [[Dn[0] - Gn, Dn[1] - Gn], [Dn[0] + Gn, Dn[1] + Gn]] : At === la ? [[Math.max(Dn[0] - Gn, Tn), Ht], [Math.min(Dn[0] + Gn, dr), Qt]] : [[Tn, Math.max(Dn[1] - Gn, Ht)], [dr, Math.min(Dn[1] + Gn, Qt)]]);
          }
          return vr.scale = function(Gn) {
            return arguments.length ? (Jr(Gn), Pn()) : Jr();
          }, vr.translate = function(Gn) {
            return arguments.length ? (dn(Gn), Pn()) : dn();
          }, vr.center = function(Gn) {
            return arguments.length ? (Vr(Gn), Pn()) : Vr();
          }, vr.clipExtent = function(Gn) {
            return arguments.length ? (Gn == null ? Tn = Ht = dr = Qt = null : (Tn = +Gn[0][0], Ht = +Gn[0][1], dr = +Gn[1][0], Qt = +Gn[1][1]), Pn()) : Tn == null ? null : [[Tn, Ht], [dr, Qt]];
          }, Pn();
        }
        function Ci(At) {
          return C2((f + At) / 2);
        }
        function Qi(At, Ht) {
          var dr = b(At), Qt = At === Ht ? T2(At) : _4(dr / b(Ht)) / _4(Ci(Ht) / Ci(At)), vr = dr * k(Ci(At), Qt) / Qt;
          if (!Qt) return la;
          function Vr(Jr, dn) {
            vr > 0 ? dn < -f + u2 && (dn = -f + u2) : dn > f - u2 && (dn = f - u2);
            var En = vr / k(Ci(dn), Qt);
            return [En * T2(Qt * Jr), vr - En * b(Qt * Jr)];
          }
          return Vr.invert = function(Jr, dn) {
            var En = vr - dn, Tn = A2(Qt) * S2(Jr * Jr + En * En), Pn = x(Jr, m(En)) * A2(En);
            return En * Qt < 0 && (Pn -= c * A2(Jr) * A2(En)), [Pn / Qt, 2 * g(k(vr / Tn, 1 / Qt)) - f];
          }, Vr;
        }
        function Zi(At, Ht) {
          return [At, Ht];
        }
        function eo(At, Ht) {
          var dr = b(At), Qt = At === Ht ? T2(At) : (dr - b(Ht)) / (Ht - At), vr = dr / Qt + At;
          if (m(Qt) < u2) return Zi;
          function Vr(Jr, dn) {
            var En = vr - dn, Tn = Qt * Jr;
            return [En * T2(Tn), vr - En * b(Tn)];
          }
          return Vr.invert = function(Jr, dn) {
            var En = vr - dn, Tn = x(Jr, m(En)) * A2(En);
            return En * Qt < 0 && (Tn -= c * A2(Jr) * A2(En)), [Tn / Qt, vr - A2(Qt) * S2(Jr * Jr + En * En)];
          }, Vr;
        }
        xa.invert = ta(function(At) {
          return At;
        }), la.invert = function(At, Ht) {
          return [At, 2 * g(w(Ht)) - f];
        }, Zi.invert = Zi;
        var Es = 1.340264, vs = -0.081106, Vo = 893e-6, jo = 3796e-6, ms = S2(3) / 2;
        function al(At, Ht) {
          var dr = F13(ms * T2(Ht)), Qt = dr * dr, vr = Qt * Qt * Qt;
          return [At * b(dr) / (ms * (Es + 3 * vs * Qt + vr * (7 * Vo + 9 * jo * Qt))), dr * (Es + vs * Qt + vr * (Vo + jo * Qt))];
        }
        function Xl(At, Ht) {
          var dr = b(Ht), Qt = b(At) * dr;
          return [dr * T2(At) / Qt, T2(Ht) / Qt];
        }
        function Kl(At, Ht) {
          var dr = Ht * Ht, Qt = dr * dr;
          return [At * (0.8707 - 0.131979 * dr + Qt * (Qt * (3971e-6 * dr - 1529e-6 * Qt) - 0.013791)), Ht * (1.007226 + dr * (0.015085 + Qt * (0.028874 * dr - 0.044475 - 5916e-6 * Qt)))];
        }
        function Yl(At, Ht) {
          return [b(Ht) * T2(At), T2(Ht)];
        }
        function Zl(At, Ht) {
          var dr = b(Ht), Qt = 1 + b(At) * dr;
          return [dr * T2(At) / Qt, T2(Ht) / Qt];
        }
        function qi(At, Ht) {
          return [_4(C2((f + Ht) / 2)), -At];
        }
        al.invert = function(At, Ht) {
          for (var dr, Qt = Ht, vr = Qt * Qt, Vr = vr * vr * vr, Jr = 0; Jr < 12 && (Vr = (vr = (Qt -= dr = (Qt * (Es + vs * vr + Vr * (Vo + jo * vr)) - Ht) / (Es + 3 * vs * vr + Vr * (7 * Vo + 9 * jo * vr))) * Qt) * vr * vr, !(m(dr) < 1e-12)); ++Jr) ;
          return [ms * At * (Es + 3 * vs * vr + Vr * (7 * Vo + 9 * jo * vr)) / b(Qt), F13(T2(Qt) / ms)];
        }, Xl.invert = ta(g), Kl.invert = function(At, Ht) {
          var dr, Qt = Ht, vr = 25;
          do {
            var Vr = Qt * Qt, Jr = Vr * Vr;
            Qt -= dr = (Qt * (1.007226 + Vr * (0.015085 + Jr * (0.028874 * Vr - 0.044475 - 5916e-6 * Jr))) - Ht) / (1.007226 + Vr * (0.045255 + Jr * (0.259866 * Vr - 0.311325 - 5916e-6 * 11 * Jr)));
          } while (m(dr) > u2 && --vr > 0);
          return [At / (0.8707 + (Vr = Qt * Qt) * (Vr * (Vr * Vr * Vr * (3971e-6 - 1529e-6 * Vr) - 0.013791) - 0.131979)), Qt];
        }, Yl.invert = ta(F13), Zl.invert = ta(function(At) {
          return 2 * g(At);
        }), qi.invert = function(At, Ht) {
          return [-Ht, 2 * g(w(At)) - f];
        }, n.geoAlbers = kn, n.geoAlbersUsa = function() {
          var At, Ht, dr, Qt, vr, Vr, Jr = kn(), dn = Wr().rotate([154, 0]).center([-2, 58.5]).parallels([55, 65]), En = Wr().rotate([157, 0]).center([-3, 19.9]).parallels([8, 18]), Tn = { point: function(Dn, $n) {
            Vr = [Dn, $n];
          } };
          function Pn(Dn) {
            var $n = Dn[0], ca = Dn[1];
            return Vr = null, dr.point($n, ca), Vr || (Qt.point($n, ca), Vr) || (vr.point($n, ca), Vr);
          }
          function Gn() {
            return At = Ht = null, Pn;
          }
          return Pn.invert = function(Dn) {
            var $n = Jr.scale(), ca = Jr.translate(), ya = (Dn[0] - ca[0]) / $n, Ra = (Dn[1] - ca[1]) / $n;
            return (Ra >= 0.12 && Ra < 0.234 && ya >= -0.425 && ya < -0.214 ? dn : Ra >= 0.166 && Ra < 0.234 && ya >= -0.214 && ya < -0.115 ? En : Jr).invert(Dn);
          }, Pn.stream = function(Dn) {
            return At && Ht === Dn ? At : ($n = [Jr.stream(Ht = Dn), dn.stream(Dn), En.stream(Dn)], ca = $n.length, At = { point: function(ya, Ra) {
              for (var mn = -1; ++mn < ca; ) $n[mn].point(ya, Ra);
            }, sphere: function() {
              for (var ya = -1; ++ya < ca; ) $n[ya].sphere();
            }, lineStart: function() {
              for (var ya = -1; ++ya < ca; ) $n[ya].lineStart();
            }, lineEnd: function() {
              for (var ya = -1; ++ya < ca; ) $n[ya].lineEnd();
            }, polygonStart: function() {
              for (var ya = -1; ++ya < ca; ) $n[ya].polygonStart();
            }, polygonEnd: function() {
              for (var ya = -1; ++ya < ca; ) $n[ya].polygonEnd();
            } });
            var $n, ca;
          }, Pn.precision = function(Dn) {
            return arguments.length ? (Jr.precision(Dn), dn.precision(Dn), En.precision(Dn), Gn()) : Jr.precision();
          }, Pn.scale = function(Dn) {
            return arguments.length ? (Jr.scale(Dn), dn.scale(0.35 * Dn), En.scale(Dn), Pn.translate(Jr.translate())) : Jr.scale();
          }, Pn.translate = function(Dn) {
            if (!arguments.length) return Jr.translate();
            var $n = Jr.scale(), ca = +Dn[0], ya = +Dn[1];
            return dr = Jr.translate(Dn).clipExtent([[ca - 0.455 * $n, ya - 0.238 * $n], [ca + 0.455 * $n, ya + 0.238 * $n]]).stream(Tn), Qt = dn.translate([ca - 0.307 * $n, ya + 0.201 * $n]).clipExtent([[ca - 0.425 * $n + u2, ya + 0.12 * $n + u2], [ca - 0.214 * $n - u2, ya + 0.234 * $n - u2]]).stream(Tn), vr = En.translate([ca - 0.205 * $n, ya + 0.212 * $n]).clipExtent([[ca - 0.214 * $n + u2, ya + 0.166 * $n + u2], [ca - 0.115 * $n - u2, ya + 0.234 * $n - u2]]).stream(Tn), Gn();
          }, Pn.fitExtent = function(Dn, $n) {
            return nt(Pn, Dn, $n);
          }, Pn.fitSize = function(Dn, $n) {
            return dt(Pn, Dn, $n);
          }, Pn.fitWidth = function(Dn, $n) {
            return _t(Pn, Dn, $n);
          }, Pn.fitHeight = function(Dn, $n) {
            return Ct(Pn, Dn, $n);
          }, Pn.scale(1070);
        }, n.geoArea = function(At) {
          return H2.reset(), X2(At, te), 2 * H2;
        }, n.geoAzimuthalEqualArea = function() {
          return fr(sa).scale(124.75).clipAngle(179.999);
        }, n.geoAzimuthalEqualAreaRaw = sa, n.geoAzimuthalEquidistant = function() {
          return fr(xa).scale(79.4188).clipAngle(179.999);
        }, n.geoAzimuthalEquidistantRaw = xa, n.geoBounds = function(At) {
          var Ht, dr, Qt, vr, Vr, Jr, dn;
          if (pe = Ae = -(we = be = 1 / 0), Be = [], X2(At, at), dr = Be.length) {
            for (Be.sort(qe), Ht = 1, Vr = [Qt = Be[0]]; Ht < dr; ++Ht) je(Qt, (vr = Be[Ht])[0]) || je(Qt, vr[1]) ? (Re(Qt[0], vr[1]) > Re(Qt[0], Qt[1]) && (Qt[1] = vr[1]), Re(vr[0], Qt[1]) > Re(Qt[0], Qt[1]) && (Qt[0] = vr[0])) : Vr.push(Qt = vr);
            for (Jr = -1 / 0, Ht = 0, Qt = Vr[dr = Vr.length - 1]; Ht <= dr; Qt = vr, ++Ht) vr = Vr[Ht], (dn = Re(Qt[1], vr[0])) > Jr && (Jr = dn, we = vr[0], Ae = Qt[1]);
          }
          return Be = Ue = null, we === 1 / 0 || be === 1 / 0 ? [[NaN, NaN], [NaN, NaN]] : [[we, be], [Ae, pe]];
        }, n.geoCentroid = function(At) {
          Ke = ct = We = Ze = it = ot = mt = wt = Et = zt = Nt = 0, X2(At, rt);
          var Ht = Et, dr = zt, Qt = Nt, vr = Ht * Ht + dr * dr + Qt * Qt;
          return vr < 1e-12 && (Ht = ot, dr = mt, Qt = wt, ct < u2 && (Ht = We, dr = Ze, Qt = it), (vr = Ht * Ht + dr * dr + Qt * Qt) < 1e-12) ? [NaN, NaN] : [x(dr, Ht) * d, F13(Qt / S2(vr)) * d];
        }, n.geoCircle = function() {
          var At, Ht, dr = tt([0, 0]), Qt = tt(90), vr = tt(6), Vr = { point: function(dn, En) {
            At.push(dn = Ht(dn, En)), dn[0] *= d, dn[1] *= d;
          } };
          function Jr() {
            var dn = dr.apply(this, arguments), En = Qt.apply(this, arguments) * v, Tn = vr.apply(this, arguments) * v;
            return At = [], Ht = jt(-dn[0] * v, -dn[1] * v, 0).invert, yr(Vr, En, Tn, 1), dn = { type: "Polygon", coordinates: [At] }, At = Ht = null, dn;
          }
          return Jr.center = function(dn) {
            return arguments.length ? (dr = typeof dn == "function" ? dn : tt([+dn[0], +dn[1]]), Jr) : dr;
          }, Jr.radius = function(dn) {
            return arguments.length ? (Qt = typeof dn == "function" ? dn : tt(+dn), Jr) : Qt;
          }, Jr.precision = function(dn) {
            return arguments.length ? (vr = typeof dn == "function" ? dn : tt(+dn), Jr) : vr;
          }, Jr;
        }, n.geoClipAntimeridian = qr, n.geoClipCircle = Nr, n.geoClipExtent = function() {
          var At, Ht, dr, Qt = 0, vr = 0, Vr = 960, Jr = 500;
          return dr = { stream: function(dn) {
            return At && Ht === dn ? At : At = Zr(Qt, vr, Vr, Jr)(Ht = dn);
          }, extent: function(dn) {
            return arguments.length ? (Qt = +dn[0][0], vr = +dn[0][1], Vr = +dn[1][0], Jr = +dn[1][1], At = Ht = null, dr) : [[Qt, vr], [Vr, Jr]];
          } };
        }, n.geoClipRectangle = Zr, n.geoConicConformal = function() {
          return Er(Qi).scale(109.5).parallels([30, 30]);
        }, n.geoConicConformalRaw = Qi, n.geoConicEqualArea = Wr, n.geoConicEqualAreaRaw = Mr, n.geoConicEquidistant = function() {
          return Er(eo).scale(131.154).center([0, 13.9389]);
        }, n.geoConicEquidistantRaw = eo, n.geoContains = function(At, Ht) {
          return (At && un.hasOwnProperty(At.type) ? un[At.type] : Cr)(At, Ht);
        }, n.geoDistance = pn, n.geoEqualEarth = function() {
          return fr(al).scale(177.158);
        }, n.geoEqualEarthRaw = al, n.geoEquirectangular = function() {
          return fr(Zi).scale(152.63);
        }, n.geoEquirectangularRaw = Zi, n.geoGnomonic = function() {
          return fr(Xl).scale(144.049).clipAngle(60);
        }, n.geoGnomonicRaw = Xl, n.geoGraticule = Bn, n.geoGraticule10 = function() {
          return Bn()();
        }, n.geoIdentity = function() {
          var At, Ht, dr, Qt, vr, Vr, Jr, dn = 1, En = 0, Tn = 0, Pn = 1, Gn = 1, Dn = 0, $n = null, ca = 1, ya = 1, Ra = ac({ point: function(va, Ia) {
            var Si = ra([va, Ia]);
            this.stream.point(Si[0], Si[1]);
          } }), mn = sn;
          function Fa() {
            return ca = dn * Pn, ya = dn * Gn, Vr = Jr = null, ra;
          }
          function ra(va) {
            var Ia = va[0] * ca, Si = va[1] * ya;
            if (Dn) {
              var Vi = Si * At - Ia * Ht;
              Ia = Ia * At + Si * Ht, Si = Vi;
            }
            return [Ia + En, Si + Tn];
          }
          return ra.invert = function(va) {
            var Ia = va[0] - En, Si = va[1] - Tn;
            if (Dn) {
              var Vi = Si * At + Ia * Ht;
              Ia = Ia * At - Si * Ht, Si = Vi;
            }
            return [Ia / ca, Si / ya];
          }, ra.stream = function(va) {
            return Vr && Jr === va ? Vr : Vr = Ra(mn(Jr = va));
          }, ra.postclip = function(va) {
            return arguments.length ? (mn = va, $n = dr = Qt = vr = null, Fa()) : mn;
          }, ra.clipExtent = function(va) {
            return arguments.length ? (mn = va == null ? ($n = dr = Qt = vr = null, sn) : Zr($n = +va[0][0], dr = +va[0][1], Qt = +va[1][0], vr = +va[1][1]), Fa()) : $n == null ? null : [[$n, dr], [Qt, vr]];
          }, ra.scale = function(va) {
            return arguments.length ? (dn = +va, Fa()) : dn;
          }, ra.translate = function(va) {
            return arguments.length ? (En = +va[0], Tn = +va[1], Fa()) : [En, Tn];
          }, ra.angle = function(va) {
            return arguments.length ? (Ht = T2(Dn = va % 360 * v), At = b(Dn), Fa()) : Dn * d;
          }, ra.reflectX = function(va) {
            return arguments.length ? (Pn = va ? -1 : 1, Fa()) : Pn < 0;
          }, ra.reflectY = function(va) {
            return arguments.length ? (Gn = va ? -1 : 1, Fa()) : Gn < 0;
          }, ra.fitExtent = function(va, Ia) {
            return nt(ra, va, Ia);
          }, ra.fitSize = function(va, Ia) {
            return dt(ra, va, Ia);
          }, ra.fitWidth = function(va, Ia) {
            return _t(ra, va, Ia);
          }, ra.fitHeight = function(va, Ia) {
            return Ct(ra, va, Ia);
          }, ra;
        }, n.geoInterpolate = function(At, Ht) {
          var dr = At[0] * v, Qt = At[1] * v, vr = Ht[0] * v, Vr = Ht[1] * v, Jr = b(Qt), dn = T2(Qt), En = b(Vr), Tn = T2(Vr), Pn = Jr * b(dr), Gn = Jr * T2(dr), Dn = En * b(vr), $n = En * T2(vr), ca = 2 * F13(S2(N2(Vr - Qt) + Jr * En * N2(vr - dr))), ya = T2(ca), Ra = ca ? function(mn) {
            var Fa = T2(mn *= ca) / ya, ra = T2(ca - mn) / ya, va = ra * Pn + Fa * Dn, Ia = ra * Gn + Fa * $n, Si = ra * dn + Fa * Tn;
            return [x(Ia, va) * d, x(Si, S2(va * va + Ia * Ia)) * d];
          } : function() {
            return [dr * d, Qt * d];
          };
          return Ra.distance = ca, Ra;
        }, n.geoLength = Zt, n.geoMercator = function() {
          return ci(la).scale(961 / p);
        }, n.geoMercatorRaw = la, n.geoNaturalEarth1 = function() {
          return fr(Kl).scale(175.295);
        }, n.geoNaturalEarth1Raw = Kl, n.geoOrthographic = function() {
          return fr(Yl).scale(249.5).clipAngle(90 + u2);
        }, n.geoOrthographicRaw = Yl, n.geoPath = function(At, Ht) {
          var dr, Qt, vr = 4.5;
          function Vr(Jr) {
            return Jr && (typeof vr == "function" && Qt.pointRadius(+vr.apply(this, arguments)), X2(Jr, dr(Qt))), Qt.result();
          }
          return Vr.area = function(Jr) {
            return X2(Jr, dr(zn)), zn.result();
          }, Vr.measure = function(Jr) {
            return X2(Jr, dr(bu)), bu.result();
          }, Vr.bounds = function(Jr) {
            return X2(Jr, dr(gu)), gu.result();
          }, Vr.centroid = function(Jr) {
            return X2(Jr, dr(ss)), ss.result();
          }, Vr.projection = function(Jr) {
            return arguments.length ? (dr = Jr == null ? (At = null, sn) : (At = Jr).stream, Vr) : At;
          }, Vr.context = function(Jr) {
            return arguments.length ? (Qt = Jr == null ? (Ht = null, new Uc()) : new Pp(Ht = Jr), typeof vr != "function" && Qt.pointRadius(vr), Vr) : Ht;
          }, Vr.pointRadius = function(Jr) {
            return arguments.length ? (vr = typeof Jr == "function" ? Jr : (Qt.pointRadius(+Jr), +Jr), Vr) : vr;
          }, Vr.projection(At).context(Ht);
        }, n.geoProjection = fr, n.geoProjectionMutator = wr, n.geoRotation = Tr, n.geoStereographic = function() {
          return fr(Zl).scale(250).clipAngle(142);
        }, n.geoStereographicRaw = Zl, n.geoStream = X2, n.geoTransform = function(At) {
          return { stream: ac(At) };
        }, n.geoTransverseMercator = function() {
          var At = ci(qi), Ht = At.center, dr = At.rotate;
          return At.center = function(Qt) {
            return arguments.length ? Ht([-Qt[1], Qt[0]]) : [(Qt = Ht())[1], -Qt[0]];
          }, At.rotate = function(Qt) {
            return arguments.length ? dr([Qt[0], Qt[1], Qt.length > 2 ? Qt[2] + 90 : 90]) : [(Qt = dr())[0], Qt[1], Qt[2] - 90];
          }, dr([0, 0, 90]).scale(159.155);
        }, n.geoTransverseMercatorRaw = qi, Object.defineProperty(n, "__esModule", { value: true });
      });
    }, { "d3-array": 107 }], 115: [function(e, t, r) {
      (function(n, a) {
        a(typeof r == "object" && t !== void 0 ? r : (n = n || self).d3 = n.d3 || {});
      })(this, function(n) {
        "use strict";
        function a(le, ce) {
          return le.parent === ce.parent ? 1 : 2;
        }
        function o(le, ce) {
          return le + ce.x;
        }
        function s(le, ce) {
          return Math.max(le, ce.y);
        }
        function i(le) {
          var ce = 0, se = le.children, he = se && se.length;
          if (he) for (; --he >= 0; ) ce += se[he].value;
          else ce = 1;
          le.value = ce;
        }
        function l(le, ce) {
          var se, he, me, we, be, Ae = new h(le), pe = +le.value && (Ae.value = le.value), ve = [Ae];
          for (ce == null && (ce = u2); se = ve.pop(); ) if (pe && (se.value = +se.data.value), (me = ce(se.data)) && (be = me.length)) for (se.children = new Array(be), we = be - 1; we >= 0; --we) ve.push(he = se.children[we] = new h(me[we])), he.parent = se, he.depth = se.depth + 1;
          return Ae.eachBefore(f);
        }
        function u2(le) {
          return le.children;
        }
        function c(le) {
          le.data = le.data.data;
        }
        function f(le) {
          var ce = 0;
          do
            le.height = ce;
          while ((le = le.parent) && le.height < ++ce);
        }
        function h(le) {
          this.data = le, this.depth = this.height = 0, this.parent = null;
        }
        h.prototype = l.prototype = { constructor: h, count: function() {
          return this.eachAfter(i);
        }, each: function(le) {
          var ce, se, he, me, we = this, be = [we];
          do
            for (ce = be.reverse(), be = []; we = ce.pop(); ) if (le(we), se = we.children) for (he = 0, me = se.length; he < me; ++he) be.push(se[he]);
          while (be.length);
          return this;
        }, eachAfter: function(le) {
          for (var ce, se, he, me = this, we = [me], be = []; me = we.pop(); ) if (be.push(me), ce = me.children) for (se = 0, he = ce.length; se < he; ++se) we.push(ce[se]);
          for (; me = be.pop(); ) le(me);
          return this;
        }, eachBefore: function(le) {
          for (var ce, se, he = this, me = [he]; he = me.pop(); ) if (le(he), ce = he.children) for (se = ce.length - 1; se >= 0; --se) me.push(ce[se]);
          return this;
        }, sum: function(le) {
          return this.eachAfter(function(ce) {
            for (var se = +le(ce.data) || 0, he = ce.children, me = he && he.length; --me >= 0; ) se += he[me].value;
            ce.value = se;
          });
        }, sort: function(le) {
          return this.eachBefore(function(ce) {
            ce.children && ce.children.sort(le);
          });
        }, path: function(le) {
          for (var ce = this, se = function(we, be) {
            if (we === be) return we;
            var Ae = we.ancestors(), pe = be.ancestors(), ve = null;
            for (we = Ae.pop(), be = pe.pop(); we === be; ) ve = we, we = Ae.pop(), be = pe.pop();
            return ve;
          }(ce, le), he = [ce]; ce !== se; ) ce = ce.parent, he.push(ce);
          for (var me = he.length; le !== se; ) he.splice(me, 0, le), le = le.parent;
          return he;
        }, ancestors: function() {
          for (var le = this, ce = [le]; le = le.parent; ) ce.push(le);
          return ce;
        }, descendants: function() {
          var le = [];
          return this.each(function(ce) {
            le.push(ce);
          }), le;
        }, leaves: function() {
          var le = [];
          return this.eachBefore(function(ce) {
            ce.children || le.push(ce);
          }), le;
        }, links: function() {
          var le = this, ce = [];
          return le.each(function(se) {
            se !== le && ce.push({ source: se.parent, target: se });
          }), ce;
        }, copy: function() {
          return l(this).eachBefore(c);
        } };
        var p = Array.prototype.slice;
        function d(le) {
          for (var ce, se, he = 0, me = (le = function(be) {
            for (var Ae, pe, ve = be.length; ve; ) pe = Math.random() * ve-- | 0, Ae = be[ve], be[ve] = be[pe], be[pe] = Ae;
            return be;
          }(p.call(le))).length, we = []; he < me; ) ce = le[he], se && g(se, ce) ? ++he : (se = b(we = v(we, ce)), he = 0);
          return se;
        }
        function v(le, ce) {
          var se, he;
          if (x(ce, le)) return [ce];
          for (se = 0; se < le.length; ++se) if (m(ce, le[se]) && x(y(le[se], ce), le)) return [le[se], ce];
          for (se = 0; se < le.length - 1; ++se) for (he = se + 1; he < le.length; ++he) if (m(y(le[se], le[he]), ce) && m(y(le[se], ce), le[he]) && m(y(le[he], ce), le[se]) && x(w(le[se], le[he], ce), le)) return [le[se], le[he], ce];
          throw new Error();
        }
        function m(le, ce) {
          var se = le.r - ce.r, he = ce.x - le.x, me = ce.y - le.y;
          return se < 0 || se * se < he * he + me * me;
        }
        function g(le, ce) {
          var se = le.r - ce.r + 1e-6, he = ce.x - le.x, me = ce.y - le.y;
          return se > 0 && se * se > he * he + me * me;
        }
        function x(le, ce) {
          for (var se = 0; se < ce.length; ++se) if (!g(le, ce[se])) return false;
          return true;
        }
        function b(le) {
          switch (le.length) {
            case 1:
              return { x: (ce = le[0]).x, y: ce.y, r: ce.r };
            case 2:
              return y(le[0], le[1]);
            case 3:
              return w(le[0], le[1], le[2]);
          }
          var ce;
        }
        function y(le, ce) {
          var se = le.x, he = le.y, me = le.r, we = ce.x, be = ce.y, Ae = ce.r, pe = we - se, ve = be - he, Ee = Ae - me, Se = Math.sqrt(pe * pe + ve * ve);
          return { x: (se + we + pe / Se * Ee) / 2, y: (he + be + ve / Se * Ee) / 2, r: (Se + me + Ae) / 2 };
        }
        function w(le, ce, se) {
          var he = le.x, me = le.y, we = le.r, be = ce.x, Ae = ce.y, pe = ce.r, ve = se.x, Ee = se.y, Se = se.r, Ce = he - be, Be = he - ve, Ue = me - Ae, Ke = me - Ee, ct = pe - we, We = Se - we, Ze = he * he + me * me - we * we, it = Ze - be * be - Ae * Ae + pe * pe, ot = Ze - ve * ve - Ee * Ee + Se * Se, mt = Be * Ue - Ce * Ke, wt = (Ue * ot - Ke * it) / (2 * mt) - he, Et = (Ke * ct - Ue * We) / mt, zt = (Be * it - Ce * ot) / (2 * mt) - me, Nt = (Ce * We - Be * ct) / mt, yt = Et * Et + Nt * Nt - 1, pt = 2 * (we + wt * Et + zt * Nt), Ot = wt * wt + zt * zt - we * we, Jt = -(yt ? (pt + Math.sqrt(pt * pt - 4 * yt * Ot)) / (2 * yt) : Ot / pt);
          return { x: he + wt + Et * Jt, y: me + zt + Nt * Jt, r: Jt };
        }
        function _4(le, ce, se) {
          var he, me, we, be, Ae = le.x - ce.x, pe = le.y - ce.y, ve = Ae * Ae + pe * pe;
          ve ? (me = ce.r + se.r, me *= me, be = le.r + se.r, me > (be *= be) ? (he = (ve + be - me) / (2 * ve), we = Math.sqrt(Math.max(0, be / ve - he * he)), se.x = le.x - he * Ae - we * pe, se.y = le.y - he * pe + we * Ae) : (he = (ve + me - be) / (2 * ve), we = Math.sqrt(Math.max(0, me / ve - he * he)), se.x = ce.x + he * Ae - we * pe, se.y = ce.y + he * pe + we * Ae)) : (se.x = ce.x + se.r, se.y = ce.y);
        }
        function k(le, ce) {
          var se = le.r + ce.r - 1e-6, he = ce.x - le.x, me = ce.y - le.y;
          return se > 0 && se * se > he * he + me * me;
        }
        function T2(le) {
          var ce = le._, se = le.next._, he = ce.r + se.r, me = (ce.x * se.r + se.x * ce.r) / he, we = (ce.y * se.r + se.y * ce.r) / he;
          return me * me + we * we;
        }
        function A2(le) {
          this._ = le, this.next = null, this.previous = null;
        }
        function S2(le) {
          if (!(me = le.length)) return 0;
          var ce, se, he, me, we, be, Ae, pe, ve, Ee, Se;
          if ((ce = le[0]).x = 0, ce.y = 0, !(me > 1)) return ce.r;
          if (se = le[1], ce.x = -se.r, se.x = ce.r, se.y = 0, !(me > 2)) return ce.r + se.r;
          _4(se, ce, he = le[2]), ce = new A2(ce), se = new A2(se), he = new A2(he), ce.next = he.previous = se, se.next = ce.previous = he, he.next = se.previous = ce;
          e: for (Ae = 3; Ae < me; ++Ae) {
            _4(ce._, se._, he = le[Ae]), he = new A2(he), pe = se.next, ve = ce.previous, Ee = se._.r, Se = ce._.r;
            do
              if (Ee <= Se) {
                if (k(pe._, he._)) {
                  se = pe, ce.next = se, se.previous = ce, --Ae;
                  continue e;
                }
                Ee += pe._.r, pe = pe.next;
              } else {
                if (k(ve._, he._)) {
                  (ce = ve).next = se, se.previous = ce, --Ae;
                  continue e;
                }
                Se += ve._.r, ve = ve.previous;
              }
            while (pe !== ve.next);
            for (he.previous = ce, he.next = se, ce.next = se.previous = se = he, we = T2(ce); (he = he.next) !== se; ) (be = T2(he)) < we && (ce = he, we = be);
            se = ce.next;
          }
          for (ce = [se._], he = se; (he = he.next) !== se; ) ce.push(he._);
          for (he = d(ce), Ae = 0; Ae < me; ++Ae) (ce = le[Ae]).x -= he.x, ce.y -= he.y;
          return he.r;
        }
        function C2(le) {
          return le == null ? null : E2(le);
        }
        function E2(le) {
          if (typeof le != "function") throw new Error();
          return le;
        }
        function F13() {
          return 0;
        }
        function N2(le) {
          return function() {
            return le;
          };
        }
        function D2(le) {
          return Math.sqrt(le.value);
        }
        function I2(le) {
          return function(ce) {
            ce.children || (ce.r = Math.max(0, +le(ce) || 0));
          };
        }
        function O2(le, ce) {
          return function(se) {
            if (he = se.children) {
              var he, me, we, be = he.length, Ae = le(se) * ce || 0;
              if (Ae) for (me = 0; me < be; ++me) he[me].r += Ae;
              if (we = S2(he), Ae) for (me = 0; me < be; ++me) he[me].r -= Ae;
              se.r = we + Ae;
            }
          };
        }
        function L2(le) {
          return function(ce) {
            var se = ce.parent;
            ce.r *= le, se && (ce.x = se.x + le * ce.x, ce.y = se.y + le * ce.y);
          };
        }
        function V2(le) {
          le.x0 = Math.round(le.x0), le.y0 = Math.round(le.y0), le.x1 = Math.round(le.x1), le.y1 = Math.round(le.y1);
        }
        function W2(le, ce, se, he, me) {
          for (var we, be = le.children, Ae = -1, pe = be.length, ve = le.value && (he - ce) / le.value; ++Ae < pe; ) (we = be[Ae]).y0 = se, we.y1 = me, we.x0 = ce, we.x1 = ce += we.value * ve;
        }
        var X2 = { depth: -1 }, Y2 = {};
        function K2(le) {
          return le.id;
        }
        function q(le) {
          return le.parentId;
        }
        function re(le, ce) {
          return le.parent === ce.parent ? 1 : 2;
        }
        function R2(le) {
          var ce = le.children;
          return ce ? ce[0] : le.t;
        }
        function z(le) {
          var ce = le.children;
          return ce ? ce[ce.length - 1] : le.t;
        }
        function H2(le, ce, se) {
          var he = se / (ce.i - le.i);
          ce.c -= he, ce.s += se, le.c += he, ce.z += se, ce.m += se;
        }
        function te(le, ce, se) {
          return le.a.parent === ce.parent ? le.a : se;
        }
        function j(le, ce) {
          this._ = le, this.parent = null, this.children = null, this.A = null, this.a = this, this.z = 0, this.m = 0, this.c = 0, this.s = 0, this.t = null, this.i = ce;
        }
        function Q2(le, ce, se, he, me) {
          for (var we, be = le.children, Ae = -1, pe = be.length, ve = le.value && (me - se) / le.value; ++Ae < pe; ) (we = be[Ae]).x0 = ce, we.x1 = he, we.y0 = se, we.y1 = se += we.value * ve;
        }
        j.prototype = Object.create(h.prototype);
        var Z2 = (1 + Math.sqrt(5)) / 2;
        function ne(le, ce, se, he, me, we) {
          for (var be, Ae, pe, ve, Ee, Se, Ce, Be, Ue, Ke, ct, We = [], Ze = ce.children, it = 0, ot = 0, mt = Ze.length, wt = ce.value; it < mt; ) {
            pe = me - se, ve = we - he;
            do
              Ee = Ze[ot++].value;
            while (!Ee && ot < mt);
            for (Se = Ce = Ee, ct = Ee * Ee * (Ke = Math.max(ve / pe, pe / ve) / (wt * le)), Ue = Math.max(Ce / ct, ct / Se); ot < mt; ++ot) {
              if (Ee += Ae = Ze[ot].value, Ae < Se && (Se = Ae), Ae > Ce && (Ce = Ae), ct = Ee * Ee * Ke, (Be = Math.max(Ce / ct, ct / Se)) > Ue) {
                Ee -= Ae;
                break;
              }
              Ue = Be;
            }
            We.push(be = { value: Ee, dice: pe < ve, children: Ze.slice(it, ot) }), be.dice ? W2(be, se, he, me, wt ? he += ve * Ee / wt : we) : Q2(be, se, he, wt ? se += pe * Ee / wt : me, we), wt -= Ee, it = ot;
          }
          return We;
        }
        var ae = function le(ce) {
          function se(he, me, we, be, Ae) {
            ne(ce, he, me, we, be, Ae);
          }
          return se.ratio = function(he) {
            return le((he = +he) > 1 ? he : 1);
          }, se;
        }(Z2), ue = function le(ce) {
          function se(he, me, we, be, Ae) {
            if ((pe = he._squarify) && pe.ratio === ce) for (var pe, ve, Ee, Se, Ce, Be = -1, Ue = pe.length, Ke = he.value; ++Be < Ue; ) {
              for (Ee = (ve = pe[Be]).children, Se = ve.value = 0, Ce = Ee.length; Se < Ce; ++Se) ve.value += Ee[Se].value;
              ve.dice ? W2(ve, me, we, be, we += (Ae - we) * ve.value / Ke) : Q2(ve, me, we, me += (be - me) * ve.value / Ke, Ae), Ke -= ve.value;
            }
            else he._squarify = pe = ne(ce, he, me, we, be, Ae), pe.ratio = ce;
          }
          return se.ratio = function(he) {
            return le((he = +he) > 1 ? he : 1);
          }, se;
        }(Z2);
        n.cluster = function() {
          var le = a, ce = 1, se = 1, he = false;
          function me(we) {
            var be, Ae = 0;
            we.eachAfter(function(Ce) {
              var Be = Ce.children;
              Be ? (Ce.x = function(Ue) {
                return Ue.reduce(o, 0) / Ue.length;
              }(Be), Ce.y = function(Ue) {
                return 1 + Ue.reduce(s, 0);
              }(Be)) : (Ce.x = be ? Ae += le(Ce, be) : 0, Ce.y = 0, be = Ce);
            });
            var pe = function(Ce) {
              for (var Be; Be = Ce.children; ) Ce = Be[0];
              return Ce;
            }(we), ve = function(Ce) {
              for (var Be; Be = Ce.children; ) Ce = Be[Be.length - 1];
              return Ce;
            }(we), Ee = pe.x - le(pe, ve) / 2, Se = ve.x + le(ve, pe) / 2;
            return we.eachAfter(he ? function(Ce) {
              Ce.x = (Ce.x - we.x) * ce, Ce.y = (we.y - Ce.y) * se;
            } : function(Ce) {
              Ce.x = (Ce.x - Ee) / (Se - Ee) * ce, Ce.y = (1 - (we.y ? Ce.y / we.y : 1)) * se;
            });
          }
          return me.separation = function(we) {
            return arguments.length ? (le = we, me) : le;
          }, me.size = function(we) {
            return arguments.length ? (he = false, ce = +we[0], se = +we[1], me) : he ? null : [ce, se];
          }, me.nodeSize = function(we) {
            return arguments.length ? (he = true, ce = +we[0], se = +we[1], me) : he ? [ce, se] : null;
          }, me;
        }, n.hierarchy = l, n.pack = function() {
          var le = null, ce = 1, se = 1, he = F13;
          function me(we) {
            return we.x = ce / 2, we.y = se / 2, le ? we.eachBefore(I2(le)).eachAfter(O2(he, 0.5)).eachBefore(L2(1)) : we.eachBefore(I2(D2)).eachAfter(O2(F13, 1)).eachAfter(O2(he, we.r / Math.min(ce, se))).eachBefore(L2(Math.min(ce, se) / (2 * we.r))), we;
          }
          return me.radius = function(we) {
            return arguments.length ? (le = C2(we), me) : le;
          }, me.size = function(we) {
            return arguments.length ? (ce = +we[0], se = +we[1], me) : [ce, se];
          }, me.padding = function(we) {
            return arguments.length ? (he = typeof we == "function" ? we : N2(+we), me) : he;
          }, me;
        }, n.packEnclose = d, n.packSiblings = function(le) {
          return S2(le), le;
        }, n.partition = function() {
          var le = 1, ce = 1, se = 0, he = false;
          function me(we) {
            var be = we.height + 1;
            return we.x0 = we.y0 = se, we.x1 = le, we.y1 = ce / be, we.eachBefore(/* @__PURE__ */ function(Ae, pe) {
              return function(ve) {
                ve.children && W2(ve, ve.x0, Ae * (ve.depth + 1) / pe, ve.x1, Ae * (ve.depth + 2) / pe);
                var Ee = ve.x0, Se = ve.y0, Ce = ve.x1 - se, Be = ve.y1 - se;
                Ce < Ee && (Ee = Ce = (Ee + Ce) / 2), Be < Se && (Se = Be = (Se + Be) / 2), ve.x0 = Ee, ve.y0 = Se, ve.x1 = Ce, ve.y1 = Be;
              };
            }(ce, be)), he && we.eachBefore(V2), we;
          }
          return me.round = function(we) {
            return arguments.length ? (he = !!we, me) : he;
          }, me.size = function(we) {
            return arguments.length ? (le = +we[0], ce = +we[1], me) : [le, ce];
          }, me.padding = function(we) {
            return arguments.length ? (se = +we, me) : se;
          }, me;
        }, n.stratify = function() {
          var le = K2, ce = q;
          function se(he) {
            var me, we, be, Ae, pe, ve, Ee, Se = he.length, Ce = new Array(Se), Be = {};
            for (we = 0; we < Se; ++we) me = he[we], pe = Ce[we] = new h(me), (ve = le(me, we, he)) != null && (ve += "") && (Be[Ee = "$" + (pe.id = ve)] = Ee in Be ? Y2 : pe);
            for (we = 0; we < Se; ++we) if (pe = Ce[we], (ve = ce(he[we], we, he)) != null && (ve += "")) {
              if (!(Ae = Be["$" + ve])) throw new Error("missing: " + ve);
              if (Ae === Y2) throw new Error("ambiguous: " + ve);
              Ae.children ? Ae.children.push(pe) : Ae.children = [pe], pe.parent = Ae;
            } else {
              if (be) throw new Error("multiple roots");
              be = pe;
            }
            if (!be) throw new Error("no root");
            if (be.parent = X2, be.eachBefore(function(Ue) {
              Ue.depth = Ue.parent.depth + 1, --Se;
            }).eachBefore(f), be.parent = null, Se > 0) throw new Error("cycle");
            return be;
          }
          return se.id = function(he) {
            return arguments.length ? (le = E2(he), se) : le;
          }, se.parentId = function(he) {
            return arguments.length ? (ce = E2(he), se) : ce;
          }, se;
        }, n.tree = function() {
          var le = re, ce = 1, se = 1, he = null;
          function me(pe) {
            var ve = function(We) {
              for (var Ze, it, ot, mt, wt, Et = new j(We, 0), zt = [Et]; Ze = zt.pop(); ) if (ot = Ze._.children) for (Ze.children = new Array(wt = ot.length), mt = wt - 1; mt >= 0; --mt) zt.push(it = Ze.children[mt] = new j(ot[mt], mt)), it.parent = Ze;
              return (Et.parent = new j(null, 0)).children = [Et], Et;
            }(pe);
            if (ve.eachAfter(we), ve.parent.m = -ve.z, ve.eachBefore(be), he) pe.eachBefore(Ae);
            else {
              var Ee = pe, Se = pe, Ce = pe;
              pe.eachBefore(function(We) {
                We.x < Ee.x && (Ee = We), We.x > Se.x && (Se = We), We.depth > Ce.depth && (Ce = We);
              });
              var Be = Ee === Se ? 1 : le(Ee, Se) / 2, Ue = Be - Ee.x, Ke = ce / (Se.x + Be + Ue), ct = se / (Ce.depth || 1);
              pe.eachBefore(function(We) {
                We.x = (We.x + Ue) * Ke, We.y = We.depth * ct;
              });
            }
            return pe;
          }
          function we(pe) {
            var ve = pe.children, Ee = pe.parent.children, Se = pe.i ? Ee[pe.i - 1] : null;
            if (ve) {
              (function(Be) {
                for (var Ue, Ke = 0, ct = 0, We = Be.children, Ze = We.length; --Ze >= 0; ) (Ue = We[Ze]).z += Ke, Ue.m += Ke, Ke += Ue.s + (ct += Ue.c);
              })(pe);
              var Ce = (ve[0].z + ve[ve.length - 1].z) / 2;
              Se ? (pe.z = Se.z + le(pe._, Se._), pe.m = pe.z - Ce) : pe.z = Ce;
            } else Se && (pe.z = Se.z + le(pe._, Se._));
            pe.parent.A = function(Be, Ue, Ke) {
              if (Ue) {
                for (var ct, We = Be, Ze = Be, it = Ue, ot = We.parent.children[0], mt = We.m, wt = Ze.m, Et = it.m, zt = ot.m; it = z(it), We = R2(We), it && We; ) ot = R2(ot), (Ze = z(Ze)).a = Be, (ct = it.z + Et - We.z - mt + le(it._, We._)) > 0 && (H2(te(it, Be, Ke), Be, ct), mt += ct, wt += ct), Et += it.m, mt += We.m, zt += ot.m, wt += Ze.m;
                it && !z(Ze) && (Ze.t = it, Ze.m += Et - wt), We && !R2(ot) && (ot.t = We, ot.m += mt - zt, Ke = Be);
              }
              return Ke;
            }(pe, Se, pe.parent.A || Ee[0]);
          }
          function be(pe) {
            pe._.x = pe.z + pe.parent.m, pe.m += pe.parent.m;
          }
          function Ae(pe) {
            pe.x *= ce, pe.y = pe.depth * se;
          }
          return me.separation = function(pe) {
            return arguments.length ? (le = pe, me) : le;
          }, me.size = function(pe) {
            return arguments.length ? (he = false, ce = +pe[0], se = +pe[1], me) : he ? null : [ce, se];
          }, me.nodeSize = function(pe) {
            return arguments.length ? (he = true, ce = +pe[0], se = +pe[1], me) : he ? [ce, se] : null;
          }, me;
        }, n.treemap = function() {
          var le = ae, ce = false, se = 1, he = 1, me = [0], we = F13, be = F13, Ae = F13, pe = F13, ve = F13;
          function Ee(Ce) {
            return Ce.x0 = Ce.y0 = 0, Ce.x1 = se, Ce.y1 = he, Ce.eachBefore(Se), me = [0], ce && Ce.eachBefore(V2), Ce;
          }
          function Se(Ce) {
            var Be = me[Ce.depth], Ue = Ce.x0 + Be, Ke = Ce.y0 + Be, ct = Ce.x1 - Be, We = Ce.y1 - Be;
            ct < Ue && (Ue = ct = (Ue + ct) / 2), We < Ke && (Ke = We = (Ke + We) / 2), Ce.x0 = Ue, Ce.y0 = Ke, Ce.x1 = ct, Ce.y1 = We, Ce.children && (Be = me[Ce.depth + 1] = we(Ce) / 2, Ue += ve(Ce) - Be, Ke += be(Ce) - Be, (ct -= Ae(Ce) - Be) < Ue && (Ue = ct = (Ue + ct) / 2), (We -= pe(Ce) - Be) < Ke && (Ke = We = (Ke + We) / 2), le(Ce, Ue, Ke, ct, We));
          }
          return Ee.round = function(Ce) {
            return arguments.length ? (ce = !!Ce, Ee) : ce;
          }, Ee.size = function(Ce) {
            return arguments.length ? (se = +Ce[0], he = +Ce[1], Ee) : [se, he];
          }, Ee.tile = function(Ce) {
            return arguments.length ? (le = E2(Ce), Ee) : le;
          }, Ee.padding = function(Ce) {
            return arguments.length ? Ee.paddingInner(Ce).paddingOuter(Ce) : Ee.paddingInner();
          }, Ee.paddingInner = function(Ce) {
            return arguments.length ? (we = typeof Ce == "function" ? Ce : N2(+Ce), Ee) : we;
          }, Ee.paddingOuter = function(Ce) {
            return arguments.length ? Ee.paddingTop(Ce).paddingRight(Ce).paddingBottom(Ce).paddingLeft(Ce) : Ee.paddingTop();
          }, Ee.paddingTop = function(Ce) {
            return arguments.length ? (be = typeof Ce == "function" ? Ce : N2(+Ce), Ee) : be;
          }, Ee.paddingRight = function(Ce) {
            return arguments.length ? (Ae = typeof Ce == "function" ? Ce : N2(+Ce), Ee) : Ae;
          }, Ee.paddingBottom = function(Ce) {
            return arguments.length ? (pe = typeof Ce == "function" ? Ce : N2(+Ce), Ee) : pe;
          }, Ee.paddingLeft = function(Ce) {
            return arguments.length ? (ve = typeof Ce == "function" ? Ce : N2(+Ce), Ee) : ve;
          }, Ee;
        }, n.treemapBinary = function(le, ce, se, he, me) {
          var we, be, Ae = le.children, pe = Ae.length, ve = new Array(pe + 1);
          for (ve[0] = be = we = 0; we < pe; ++we) ve[we + 1] = be += Ae[we].value;
          (function Ee(Se, Ce, Be, Ue, Ke, ct, We) {
            if (Se >= Ce - 1) {
              var Ze = Ae[Se];
              return Ze.x0 = Ue, Ze.y0 = Ke, Ze.x1 = ct, void (Ze.y1 = We);
            }
            for (var it = ve[Se], ot = Be / 2 + it, mt = Se + 1, wt = Ce - 1; mt < wt; ) {
              var Et = mt + wt >>> 1;
              ve[Et] < ot ? mt = Et + 1 : wt = Et;
            }
            ot - ve[mt - 1] < ve[mt] - ot && Se + 1 < mt && --mt;
            var zt = ve[mt] - it, Nt = Be - zt;
            if (ct - Ue > We - Ke) {
              var yt = (Ue * Nt + ct * zt) / Be;
              Ee(Se, mt, zt, Ue, Ke, yt, We), Ee(mt, Ce, Nt, yt, Ke, ct, We);
            } else {
              var pt = (Ke * Nt + We * zt) / Be;
              Ee(Se, mt, zt, Ue, Ke, ct, pt), Ee(mt, Ce, Nt, Ue, pt, ct, We);
            }
          })(0, pe, le.value, ce, se, he, me);
        }, n.treemapDice = W2, n.treemapResquarify = ue, n.treemapSlice = Q2, n.treemapSliceDice = function(le, ce, se, he, me) {
          (1 & le.depth ? Q2 : W2)(le, ce, se, he, me);
        }, n.treemapSquarify = ae, Object.defineProperty(n, "__esModule", { value: true });
      });
    }, {}], 116: [function(e, t, r) {
      (function(n, a) {
        typeof r == "object" && t !== void 0 ? a(r, e("d3-color")) : a((n = n || self).d3 = n.d3 || {}, n.d3);
      })(this, function(n, a) {
        "use strict";
        function o(Z2, ne, ae, ue, le) {
          var ce = Z2 * Z2, se = ce * Z2;
          return ((1 - 3 * Z2 + 3 * ce - se) * ne + (4 - 6 * ce + 3 * se) * ae + (1 + 3 * Z2 + 3 * ce - 3 * se) * ue + se * le) / 6;
        }
        function s(Z2) {
          var ne = Z2.length - 1;
          return function(ae) {
            var ue = ae <= 0 ? ae = 0 : ae >= 1 ? (ae = 1, ne - 1) : Math.floor(ae * ne), le = Z2[ue], ce = Z2[ue + 1], se = ue > 0 ? Z2[ue - 1] : 2 * le - ce, he = ue < ne - 1 ? Z2[ue + 2] : 2 * ce - le;
            return o((ae - ue / ne) * ne, se, le, ce, he);
          };
        }
        function i(Z2) {
          var ne = Z2.length;
          return function(ae) {
            var ue = Math.floor(((ae %= 1) < 0 ? ++ae : ae) * ne), le = Z2[(ue + ne - 1) % ne], ce = Z2[ue % ne], se = Z2[(ue + 1) % ne], he = Z2[(ue + 2) % ne];
            return o((ae - ue / ne) * ne, le, ce, se, he);
          };
        }
        function l(Z2) {
          return function() {
            return Z2;
          };
        }
        function u2(Z2, ne) {
          return function(ae) {
            return Z2 + ae * ne;
          };
        }
        function c(Z2, ne) {
          var ae = ne - Z2;
          return ae ? u2(Z2, ae > 180 || ae < -180 ? ae - 360 * Math.round(ae / 360) : ae) : l(isNaN(Z2) ? ne : Z2);
        }
        function f(Z2) {
          return (Z2 = +Z2) == 1 ? h : function(ne, ae) {
            return ae - ne ? function(ue, le, ce) {
              return ue = Math.pow(ue, ce), le = Math.pow(le, ce) - ue, ce = 1 / ce, function(se) {
                return Math.pow(ue + se * le, ce);
              };
            }(ne, ae, Z2) : l(isNaN(ne) ? ae : ne);
          };
        }
        function h(Z2, ne) {
          var ae = ne - Z2;
          return ae ? u2(Z2, ae) : l(isNaN(Z2) ? ne : Z2);
        }
        var p = function Z2(ne) {
          var ae = f(ne);
          function ue(le, ce) {
            var se = ae((le = a.rgb(le)).r, (ce = a.rgb(ce)).r), he = ae(le.g, ce.g), me = ae(le.b, ce.b), we = h(le.opacity, ce.opacity);
            return function(be) {
              return le.r = se(be), le.g = he(be), le.b = me(be), le.opacity = we(be), le + "";
            };
          }
          return ue.gamma = Z2, ue;
        }(1);
        function d(Z2) {
          return function(ne) {
            var ae, ue, le = ne.length, ce = new Array(le), se = new Array(le), he = new Array(le);
            for (ae = 0; ae < le; ++ae) ue = a.rgb(ne[ae]), ce[ae] = ue.r || 0, se[ae] = ue.g || 0, he[ae] = ue.b || 0;
            return ce = Z2(ce), se = Z2(se), he = Z2(he), ue.opacity = 1, function(me) {
              return ue.r = ce(me), ue.g = se(me), ue.b = he(me), ue + "";
            };
          };
        }
        var v = d(s), m = d(i);
        function g(Z2, ne) {
          ne || (ne = []);
          var ae, ue = Z2 ? Math.min(ne.length, Z2.length) : 0, le = ne.slice();
          return function(ce) {
            for (ae = 0; ae < ue; ++ae) le[ae] = Z2[ae] * (1 - ce) + ne[ae] * ce;
            return le;
          };
        }
        function x(Z2) {
          return ArrayBuffer.isView(Z2) && !(Z2 instanceof DataView);
        }
        function b(Z2, ne) {
          var ae, ue = ne ? ne.length : 0, le = Z2 ? Math.min(ue, Z2.length) : 0, ce = new Array(le), se = new Array(ue);
          for (ae = 0; ae < le; ++ae) ce[ae] = S2(Z2[ae], ne[ae]);
          for (; ae < ue; ++ae) se[ae] = ne[ae];
          return function(he) {
            for (ae = 0; ae < le; ++ae) se[ae] = ce[ae](he);
            return se;
          };
        }
        function y(Z2, ne) {
          var ae = /* @__PURE__ */ new Date();
          return Z2 = +Z2, ne = +ne, function(ue) {
            return ae.setTime(Z2 * (1 - ue) + ne * ue), ae;
          };
        }
        function w(Z2, ne) {
          return Z2 = +Z2, ne = +ne, function(ae) {
            return Z2 * (1 - ae) + ne * ae;
          };
        }
        function _4(Z2, ne) {
          var ae, ue = {}, le = {};
          for (ae in Z2 !== null && typeof Z2 == "object" || (Z2 = {}), ne !== null && typeof ne == "object" || (ne = {}), ne) ae in Z2 ? ue[ae] = S2(Z2[ae], ne[ae]) : le[ae] = ne[ae];
          return function(ce) {
            for (ae in ue) le[ae] = ue[ae](ce);
            return le;
          };
        }
        var k = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, T2 = new RegExp(k.source, "g");
        function A2(Z2, ne) {
          var ae, ue, le, ce = k.lastIndex = T2.lastIndex = 0, se = -1, he = [], me = [];
          for (Z2 += "", ne += ""; (ae = k.exec(Z2)) && (ue = T2.exec(ne)); ) (le = ue.index) > ce && (le = ne.slice(ce, le), he[se] ? he[se] += le : he[++se] = le), (ae = ae[0]) === (ue = ue[0]) ? he[se] ? he[se] += ue : he[++se] = ue : (he[++se] = null, me.push({ i: se, x: w(ae, ue) })), ce = T2.lastIndex;
          return ce < ne.length && (le = ne.slice(ce), he[se] ? he[se] += le : he[++se] = le), he.length < 2 ? me[0] ? /* @__PURE__ */ function(we) {
            return function(be) {
              return we(be) + "";
            };
          }(me[0].x) : /* @__PURE__ */ function(we) {
            return function() {
              return we;
            };
          }(ne) : (ne = me.length, function(we) {
            for (var be, Ae = 0; Ae < ne; ++Ae) he[(be = me[Ae]).i] = be.x(we);
            return he.join("");
          });
        }
        function S2(Z2, ne) {
          var ae, ue = typeof ne;
          return ne == null || ue === "boolean" ? l(ne) : (ue === "number" ? w : ue === "string" ? (ae = a.color(ne)) ? (ne = ae, p) : A2 : ne instanceof a.color ? p : ne instanceof Date ? y : x(ne) ? g : Array.isArray(ne) ? b : typeof ne.valueOf != "function" && typeof ne.toString != "function" || isNaN(ne) ? _4 : w)(Z2, ne);
        }
        var C2, E2, F13, N2, D2 = 180 / Math.PI, I2 = { translateX: 0, translateY: 0, rotate: 0, skewX: 0, scaleX: 1, scaleY: 1 };
        function O2(Z2, ne, ae, ue, le, ce) {
          var se, he, me;
          return (se = Math.sqrt(Z2 * Z2 + ne * ne)) && (Z2 /= se, ne /= se), (me = Z2 * ae + ne * ue) && (ae -= Z2 * me, ue -= ne * me), (he = Math.sqrt(ae * ae + ue * ue)) && (ae /= he, ue /= he, me /= he), Z2 * ue < ne * ae && (Z2 = -Z2, ne = -ne, me = -me, se = -se), { translateX: le, translateY: ce, rotate: Math.atan2(ne, Z2) * D2, skewX: Math.atan(me) * D2, scaleX: se, scaleY: he };
        }
        function L2(Z2, ne, ae, ue) {
          function le(ce) {
            return ce.length ? ce.pop() + " " : "";
          }
          return function(ce, se) {
            var he = [], me = [];
            return ce = Z2(ce), se = Z2(se), function(we, be, Ae, pe, ve, Ee) {
              if (we !== Ae || be !== pe) {
                var Se = ve.push("translate(", null, ne, null, ae);
                Ee.push({ i: Se - 4, x: w(we, Ae) }, { i: Se - 2, x: w(be, pe) });
              } else (Ae || pe) && ve.push("translate(" + Ae + ne + pe + ae);
            }(ce.translateX, ce.translateY, se.translateX, se.translateY, he, me), function(we, be, Ae, pe) {
              we !== be ? (we - be > 180 ? be += 360 : be - we > 180 && (we += 360), pe.push({ i: Ae.push(le(Ae) + "rotate(", null, ue) - 2, x: w(we, be) })) : be && Ae.push(le(Ae) + "rotate(" + be + ue);
            }(ce.rotate, se.rotate, he, me), function(we, be, Ae, pe) {
              we !== be ? pe.push({ i: Ae.push(le(Ae) + "skewX(", null, ue) - 2, x: w(we, be) }) : be && Ae.push(le(Ae) + "skewX(" + be + ue);
            }(ce.skewX, se.skewX, he, me), function(we, be, Ae, pe, ve, Ee) {
              if (we !== Ae || be !== pe) {
                var Se = ve.push(le(ve) + "scale(", null, ",", null, ")");
                Ee.push({ i: Se - 4, x: w(we, Ae) }, { i: Se - 2, x: w(be, pe) });
              } else Ae === 1 && pe === 1 || ve.push(le(ve) + "scale(" + Ae + "," + pe + ")");
            }(ce.scaleX, ce.scaleY, se.scaleX, se.scaleY, he, me), ce = se = null, function(we) {
              for (var be, Ae = -1, pe = me.length; ++Ae < pe; ) he[(be = me[Ae]).i] = be.x(we);
              return he.join("");
            };
          };
        }
        var V2 = L2(function(Z2) {
          return Z2 === "none" ? I2 : (C2 || (C2 = document.createElement("DIV"), E2 = document.documentElement, F13 = document.defaultView), C2.style.transform = Z2, Z2 = F13.getComputedStyle(E2.appendChild(C2), null).getPropertyValue("transform"), E2.removeChild(C2), O2(+(Z2 = Z2.slice(7, -1).split(","))[0], +Z2[1], +Z2[2], +Z2[3], +Z2[4], +Z2[5]));
        }, "px, ", "px)", "deg)"), W2 = L2(function(Z2) {
          return Z2 == null ? I2 : (N2 || (N2 = document.createElementNS("http://www.w3.org/2000/svg", "g")), N2.setAttribute("transform", Z2), (Z2 = N2.transform.baseVal.consolidate()) ? O2((Z2 = Z2.matrix).a, Z2.b, Z2.c, Z2.d, Z2.e, Z2.f) : I2);
        }, ", ", ")", ")"), X2 = Math.SQRT2;
        function Y2(Z2) {
          return ((Z2 = Math.exp(Z2)) + 1 / Z2) / 2;
        }
        function K2(Z2) {
          return function(ne, ae) {
            var ue = Z2((ne = a.hsl(ne)).h, (ae = a.hsl(ae)).h), le = h(ne.s, ae.s), ce = h(ne.l, ae.l), se = h(ne.opacity, ae.opacity);
            return function(he) {
              return ne.h = ue(he), ne.s = le(he), ne.l = ce(he), ne.opacity = se(he), ne + "";
            };
          };
        }
        var q = K2(c), re = K2(h);
        function R2(Z2) {
          return function(ne, ae) {
            var ue = Z2((ne = a.hcl(ne)).h, (ae = a.hcl(ae)).h), le = h(ne.c, ae.c), ce = h(ne.l, ae.l), se = h(ne.opacity, ae.opacity);
            return function(he) {
              return ne.h = ue(he), ne.c = le(he), ne.l = ce(he), ne.opacity = se(he), ne + "";
            };
          };
        }
        var z = R2(c), H2 = R2(h);
        function te(Z2) {
          return function ne(ae) {
            function ue(le, ce) {
              var se = Z2((le = a.cubehelix(le)).h, (ce = a.cubehelix(ce)).h), he = h(le.s, ce.s), me = h(le.l, ce.l), we = h(le.opacity, ce.opacity);
              return function(be) {
                return le.h = se(be), le.s = he(be), le.l = me(Math.pow(be, ae)), le.opacity = we(be), le + "";
              };
            }
            return ae = +ae, ue.gamma = ne, ue;
          }(1);
        }
        var j = te(c), Q2 = te(h);
        n.interpolate = S2, n.interpolateArray = function(Z2, ne) {
          return (x(ne) ? g : b)(Z2, ne);
        }, n.interpolateBasis = s, n.interpolateBasisClosed = i, n.interpolateCubehelix = j, n.interpolateCubehelixLong = Q2, n.interpolateDate = y, n.interpolateDiscrete = function(Z2) {
          var ne = Z2.length;
          return function(ae) {
            return Z2[Math.max(0, Math.min(ne - 1, Math.floor(ae * ne)))];
          };
        }, n.interpolateHcl = z, n.interpolateHclLong = H2, n.interpolateHsl = q, n.interpolateHslLong = re, n.interpolateHue = function(Z2, ne) {
          var ae = c(+Z2, +ne);
          return function(ue) {
            var le = ae(ue);
            return le - 360 * Math.floor(le / 360);
          };
        }, n.interpolateLab = function(Z2, ne) {
          var ae = h((Z2 = a.lab(Z2)).l, (ne = a.lab(ne)).l), ue = h(Z2.a, ne.a), le = h(Z2.b, ne.b), ce = h(Z2.opacity, ne.opacity);
          return function(se) {
            return Z2.l = ae(se), Z2.a = ue(se), Z2.b = le(se), Z2.opacity = ce(se), Z2 + "";
          };
        }, n.interpolateNumber = w, n.interpolateNumberArray = g, n.interpolateObject = _4, n.interpolateRgb = p, n.interpolateRgbBasis = v, n.interpolateRgbBasisClosed = m, n.interpolateRound = function(Z2, ne) {
          return Z2 = +Z2, ne = +ne, function(ae) {
            return Math.round(Z2 * (1 - ae) + ne * ae);
          };
        }, n.interpolateString = A2, n.interpolateTransformCss = V2, n.interpolateTransformSvg = W2, n.interpolateZoom = function(Z2, ne) {
          var ae, ue, le = Z2[0], ce = Z2[1], se = Z2[2], he = ne[0], me = ne[1], we = ne[2], be = he - le, Ae = me - ce, pe = be * be + Ae * Ae;
          if (pe < 1e-12) ue = Math.log(we / se) / X2, ae = function(Ue) {
            return [le + Ue * be, ce + Ue * Ae, se * Math.exp(X2 * Ue * ue)];
          };
          else {
            var ve = Math.sqrt(pe), Ee = (we * we - se * se + 4 * pe) / (2 * se * 2 * ve), Se = (we * we - se * se - 4 * pe) / (2 * we * 2 * ve), Ce = Math.log(Math.sqrt(Ee * Ee + 1) - Ee), Be = Math.log(Math.sqrt(Se * Se + 1) - Se);
            ue = (Be - Ce) / X2, ae = function(Ue) {
              var Ke, ct = Ue * ue, We = Y2(Ce), Ze = se / (2 * ve) * (We * (Ke = X2 * ct + Ce, ((Ke = Math.exp(2 * Ke)) - 1) / (Ke + 1)) - function(it) {
                return ((it = Math.exp(it)) - 1 / it) / 2;
              }(Ce));
              return [le + Ze * be, ce + Ze * Ae, se * We / Y2(X2 * ct + Ce)];
            };
          }
          return ae.duration = 1e3 * ue, ae;
        }, n.piecewise = function(Z2, ne) {
          for (var ae = 0, ue = ne.length - 1, le = ne[0], ce = new Array(ue < 0 ? 0 : ue); ae < ue; ) ce[ae] = Z2(le, le = ne[++ae]);
          return function(se) {
            var he = Math.max(0, Math.min(ue - 1, Math.floor(se *= ue)));
            return ce[he](se - he);
          };
        }, n.quantize = function(Z2, ne) {
          for (var ae = new Array(ne), ue = 0; ue < ne; ++ue) ae[ue] = Z2(ue / (ne - 1));
          return ae;
        }, Object.defineProperty(n, "__esModule", { value: true });
      });
    }, { "d3-color": 109 }], 117: [function(e, t, r) {
      (function(n, a) {
        a(typeof r == "object" && t !== void 0 ? r : (n = n || self).d3 = n.d3 || {});
      })(this, function(n) {
        "use strict";
        var a = Math.PI, o = 2 * a, s = o - 1e-6;
        function i() {
          this._x0 = this._y0 = this._x1 = this._y1 = null, this._ = "";
        }
        function l() {
          return new i();
        }
        i.prototype = l.prototype = { constructor: i, moveTo: function(u2, c) {
          this._ += "M" + (this._x0 = this._x1 = +u2) + "," + (this._y0 = this._y1 = +c);
        }, closePath: function() {
          this._x1 !== null && (this._x1 = this._x0, this._y1 = this._y0, this._ += "Z");
        }, lineTo: function(u2, c) {
          this._ += "L" + (this._x1 = +u2) + "," + (this._y1 = +c);
        }, quadraticCurveTo: function(u2, c, f, h) {
          this._ += "Q" + +u2 + "," + +c + "," + (this._x1 = +f) + "," + (this._y1 = +h);
        }, bezierCurveTo: function(u2, c, f, h, p, d) {
          this._ += "C" + +u2 + "," + +c + "," + +f + "," + +h + "," + (this._x1 = +p) + "," + (this._y1 = +d);
        }, arcTo: function(u2, c, f, h, p) {
          u2 = +u2, c = +c, f = +f, h = +h, p = +p;
          var d = this._x1, v = this._y1, m = f - u2, g = h - c, x = d - u2, b = v - c, y = x * x + b * b;
          if (p < 0) throw new Error("negative radius: " + p);
          if (this._x1 === null) this._ += "M" + (this._x1 = u2) + "," + (this._y1 = c);
          else if (y > 1e-6) if (Math.abs(b * m - g * x) > 1e-6 && p) {
            var w = f - d, _4 = h - v, k = m * m + g * g, T2 = w * w + _4 * _4, A2 = Math.sqrt(k), S2 = Math.sqrt(y), C2 = p * Math.tan((a - Math.acos((k + y - T2) / (2 * A2 * S2))) / 2), E2 = C2 / S2, F13 = C2 / A2;
            Math.abs(E2 - 1) > 1e-6 && (this._ += "L" + (u2 + E2 * x) + "," + (c + E2 * b)), this._ += "A" + p + "," + p + ",0,0," + +(b * w > x * _4) + "," + (this._x1 = u2 + F13 * m) + "," + (this._y1 = c + F13 * g);
          } else this._ += "L" + (this._x1 = u2) + "," + (this._y1 = c);
        }, arc: function(u2, c, f, h, p, d) {
          u2 = +u2, c = +c, d = !!d;
          var v = (f = +f) * Math.cos(h), m = f * Math.sin(h), g = u2 + v, x = c + m, b = 1 ^ d, y = d ? h - p : p - h;
          if (f < 0) throw new Error("negative radius: " + f);
          this._x1 === null ? this._ += "M" + g + "," + x : (Math.abs(this._x1 - g) > 1e-6 || Math.abs(this._y1 - x) > 1e-6) && (this._ += "L" + g + "," + x), f && (y < 0 && (y = y % o + o), y > s ? this._ += "A" + f + "," + f + ",0,1," + b + "," + (u2 - v) + "," + (c - m) + "A" + f + "," + f + ",0,1," + b + "," + (this._x1 = g) + "," + (this._y1 = x) : y > 1e-6 && (this._ += "A" + f + "," + f + ",0," + +(y >= a) + "," + b + "," + (this._x1 = u2 + f * Math.cos(p)) + "," + (this._y1 = c + f * Math.sin(p))));
        }, rect: function(u2, c, f, h) {
          this._ += "M" + (this._x0 = this._x1 = +u2) + "," + (this._y0 = this._y1 = +c) + "h" + +f + "v" + +h + "h" + -f + "Z";
        }, toString: function() {
          return this._;
        } }, n.path = l, Object.defineProperty(n, "__esModule", { value: true });
      });
    }, {}], 118: [function(e, t, r) {
      (function(n, a) {
        a(typeof r == "object" && t !== void 0 ? r : (n = n || self).d3 = n.d3 || {});
      })(this, function(n) {
        "use strict";
        function a(h, p, d, v) {
          if (isNaN(p) || isNaN(d)) return h;
          var m, g, x, b, y, w, _4, k, T2, A2 = h._root, S2 = { data: v }, C2 = h._x0, E2 = h._y0, F13 = h._x1, N2 = h._y1;
          if (!A2) return h._root = S2, h;
          for (; A2.length; ) if ((w = p >= (g = (C2 + F13) / 2)) ? C2 = g : F13 = g, (_4 = d >= (x = (E2 + N2) / 2)) ? E2 = x : N2 = x, m = A2, !(A2 = A2[k = _4 << 1 | w])) return m[k] = S2, h;
          if (b = +h._x.call(null, A2.data), y = +h._y.call(null, A2.data), p === b && d === y) return S2.next = A2, m ? m[k] = S2 : h._root = S2, h;
          do
            m = m ? m[k] = new Array(4) : h._root = new Array(4), (w = p >= (g = (C2 + F13) / 2)) ? C2 = g : F13 = g, (_4 = d >= (x = (E2 + N2) / 2)) ? E2 = x : N2 = x;
          while ((k = _4 << 1 | w) == (T2 = (y >= x) << 1 | b >= g));
          return m[T2] = A2, m[k] = S2, h;
        }
        function o(h, p, d, v, m) {
          this.node = h, this.x0 = p, this.y0 = d, this.x1 = v, this.y1 = m;
        }
        function s(h) {
          return h[0];
        }
        function i(h) {
          return h[1];
        }
        function l(h, p, d) {
          var v = new u2(p ?? s, d ?? i, NaN, NaN, NaN, NaN);
          return h == null ? v : v.addAll(h);
        }
        function u2(h, p, d, v, m, g) {
          this._x = h, this._y = p, this._x0 = d, this._y0 = v, this._x1 = m, this._y1 = g, this._root = void 0;
        }
        function c(h) {
          for (var p = { data: h.data }, d = p; h = h.next; ) d = d.next = { data: h.data };
          return p;
        }
        var f = l.prototype = u2.prototype;
        f.copy = function() {
          var h, p, d = new u2(this._x, this._y, this._x0, this._y0, this._x1, this._y1), v = this._root;
          if (!v) return d;
          if (!v.length) return d._root = c(v), d;
          for (h = [{ source: v, target: d._root = new Array(4) }]; v = h.pop(); ) for (var m = 0; m < 4; ++m) (p = v.source[m]) && (p.length ? h.push({ source: p, target: v.target[m] = new Array(4) }) : v.target[m] = c(p));
          return d;
        }, f.add = function(h) {
          var p = +this._x.call(null, h), d = +this._y.call(null, h);
          return a(this.cover(p, d), p, d, h);
        }, f.addAll = function(h) {
          var p, d, v, m, g = h.length, x = new Array(g), b = new Array(g), y = 1 / 0, w = 1 / 0, _4 = -1 / 0, k = -1 / 0;
          for (d = 0; d < g; ++d) isNaN(v = +this._x.call(null, p = h[d])) || isNaN(m = +this._y.call(null, p)) || (x[d] = v, b[d] = m, v < y && (y = v), v > _4 && (_4 = v), m < w && (w = m), m > k && (k = m));
          if (y > _4 || w > k) return this;
          for (this.cover(y, w).cover(_4, k), d = 0; d < g; ++d) a(this, x[d], b[d], h[d]);
          return this;
        }, f.cover = function(h, p) {
          if (isNaN(h = +h) || isNaN(p = +p)) return this;
          var d = this._x0, v = this._y0, m = this._x1, g = this._y1;
          if (isNaN(d)) m = (d = Math.floor(h)) + 1, g = (v = Math.floor(p)) + 1;
          else {
            for (var x, b, y = m - d, w = this._root; d > h || h >= m || v > p || p >= g; ) switch (b = (p < v) << 1 | h < d, (x = new Array(4))[b] = w, w = x, y *= 2, b) {
              case 0:
                m = d + y, g = v + y;
                break;
              case 1:
                d = m - y, g = v + y;
                break;
              case 2:
                m = d + y, v = g - y;
                break;
              case 3:
                d = m - y, v = g - y;
            }
            this._root && this._root.length && (this._root = w);
          }
          return this._x0 = d, this._y0 = v, this._x1 = m, this._y1 = g, this;
        }, f.data = function() {
          var h = [];
          return this.visit(function(p) {
            if (!p.length) do
              h.push(p.data);
            while (p = p.next);
          }), h;
        }, f.extent = function(h) {
          return arguments.length ? this.cover(+h[0][0], +h[0][1]).cover(+h[1][0], +h[1][1]) : isNaN(this._x0) ? void 0 : [[this._x0, this._y0], [this._x1, this._y1]];
        }, f.find = function(h, p, d) {
          var v, m, g, x, b, y, w, _4 = this._x0, k = this._y0, T2 = this._x1, A2 = this._y1, S2 = [], C2 = this._root;
          for (C2 && S2.push(new o(C2, _4, k, T2, A2)), d == null ? d = 1 / 0 : (_4 = h - d, k = p - d, T2 = h + d, A2 = p + d, d *= d); y = S2.pop(); ) if (!(!(C2 = y.node) || (m = y.x0) > T2 || (g = y.y0) > A2 || (x = y.x1) < _4 || (b = y.y1) < k)) if (C2.length) {
            var E2 = (m + x) / 2, F13 = (g + b) / 2;
            S2.push(new o(C2[3], E2, F13, x, b), new o(C2[2], m, F13, E2, b), new o(C2[1], E2, g, x, F13), new o(C2[0], m, g, E2, F13)), (w = (p >= F13) << 1 | h >= E2) && (y = S2[S2.length - 1], S2[S2.length - 1] = S2[S2.length - 1 - w], S2[S2.length - 1 - w] = y);
          } else {
            var N2 = h - +this._x.call(null, C2.data), D2 = p - +this._y.call(null, C2.data), I2 = N2 * N2 + D2 * D2;
            if (I2 < d) {
              var O2 = Math.sqrt(d = I2);
              _4 = h - O2, k = p - O2, T2 = h + O2, A2 = p + O2, v = C2.data;
            }
          }
          return v;
        }, f.remove = function(h) {
          if (isNaN(g = +this._x.call(null, h)) || isNaN(x = +this._y.call(null, h))) return this;
          var p, d, v, m, g, x, b, y, w, _4, k, T2, A2 = this._root, S2 = this._x0, C2 = this._y0, E2 = this._x1, F13 = this._y1;
          if (!A2) return this;
          if (A2.length) for (; ; ) {
            if ((w = g >= (b = (S2 + E2) / 2)) ? S2 = b : E2 = b, (_4 = x >= (y = (C2 + F13) / 2)) ? C2 = y : F13 = y, p = A2, !(A2 = A2[k = _4 << 1 | w])) return this;
            if (!A2.length) break;
            (p[k + 1 & 3] || p[k + 2 & 3] || p[k + 3 & 3]) && (d = p, T2 = k);
          }
          for (; A2.data !== h; ) if (v = A2, !(A2 = A2.next)) return this;
          return (m = A2.next) && delete A2.next, v ? (m ? v.next = m : delete v.next, this) : p ? (m ? p[k] = m : delete p[k], (A2 = p[0] || p[1] || p[2] || p[3]) && A2 === (p[3] || p[2] || p[1] || p[0]) && !A2.length && (d ? d[T2] = A2 : this._root = A2), this) : (this._root = m, this);
        }, f.removeAll = function(h) {
          for (var p = 0, d = h.length; p < d; ++p) this.remove(h[p]);
          return this;
        }, f.root = function() {
          return this._root;
        }, f.size = function() {
          var h = 0;
          return this.visit(function(p) {
            if (!p.length) do
              ++h;
            while (p = p.next);
          }), h;
        }, f.visit = function(h) {
          var p, d, v, m, g, x, b = [], y = this._root;
          for (y && b.push(new o(y, this._x0, this._y0, this._x1, this._y1)); p = b.pop(); ) if (!h(y = p.node, v = p.x0, m = p.y0, g = p.x1, x = p.y1) && y.length) {
            var w = (v + g) / 2, _4 = (m + x) / 2;
            (d = y[3]) && b.push(new o(d, w, _4, g, x)), (d = y[2]) && b.push(new o(d, v, _4, w, x)), (d = y[1]) && b.push(new o(d, w, m, g, _4)), (d = y[0]) && b.push(new o(d, v, m, w, _4));
          }
          return this;
        }, f.visitAfter = function(h) {
          var p, d = [], v = [];
          for (this._root && d.push(new o(this._root, this._x0, this._y0, this._x1, this._y1)); p = d.pop(); ) {
            var m = p.node;
            if (m.length) {
              var g, x = p.x0, b = p.y0, y = p.x1, w = p.y1, _4 = (x + y) / 2, k = (b + w) / 2;
              (g = m[0]) && d.push(new o(g, x, b, _4, k)), (g = m[1]) && d.push(new o(g, _4, b, y, k)), (g = m[2]) && d.push(new o(g, x, k, _4, w)), (g = m[3]) && d.push(new o(g, _4, k, y, w));
            }
            v.push(p);
          }
          for (; p = v.pop(); ) h(p.node, p.x0, p.y0, p.x1, p.y1);
          return this;
        }, f.x = function(h) {
          return arguments.length ? (this._x = h, this) : this._x;
        }, f.y = function(h) {
          return arguments.length ? (this._y = h, this) : this._y;
        }, n.quadtree = l, Object.defineProperty(n, "__esModule", { value: true });
      });
    }, {}], 119: [function(e, t, r) {
      (function(n, a) {
        typeof r == "object" && t !== void 0 ? a(r, e("d3-path")) : a((n = n || self).d3 = n.d3 || {}, n.d3);
      })(this, function(n, a) {
        "use strict";
        function o(De) {
          return function() {
            return De;
          };
        }
        var s = Math.abs, i = Math.atan2, l = Math.cos, u2 = Math.max, c = Math.min, f = Math.sin, h = Math.sqrt, p = Math.PI, d = p / 2, v = 2 * p;
        function m(De) {
          return De > 1 ? 0 : De < -1 ? p : Math.acos(De);
        }
        function g(De) {
          return De >= 1 ? d : De <= -1 ? -d : Math.asin(De);
        }
        function x(De) {
          return De.innerRadius;
        }
        function b(De) {
          return De.outerRadius;
        }
        function y(De) {
          return De.startAngle;
        }
        function w(De) {
          return De.endAngle;
        }
        function _4(De) {
          return De && De.padAngle;
        }
        function k(De, Je, tt, vt, kt, jt, Vt, Kt) {
          var rr = tt - De, Tr = vt - Je, yr = Vt - kt, pr = Kt - jt, lr = pr * rr - yr * Tr;
          if (!(lr * lr < 1e-12)) return [De + (lr = (yr * (Je - jt) - pr * (De - kt)) / lr) * rr, Je + lr * Tr];
        }
        function T2(De, Je, tt, vt, kt, jt, Vt) {
          var Kt = De - tt, rr = Je - vt, Tr = (Vt ? jt : -jt) / h(Kt * Kt + rr * rr), yr = Tr * rr, pr = -Tr * Kt, lr = De + yr, _r = Je + pr, $r = tt + yr, Ar = vt + pr, Qr = (lr + $r) / 2, hn = (_r + Ar) / 2, wn = $r - lr, Yn = Ar - _r, Xn = wn * wn + Yn * Yn, Wn = kt - jt, _n = lr * Ar - $r * _r, qr = (Yn < 0 ? -1 : 1) * h(u2(0, Wn * Wn * Xn - _n * _n)), Nr = (_n * Yn - wn * qr) / Xn, Zr = (-_n * wn - Yn * qr) / Xn, oa = (_n * Yn + wn * qr) / Xn, tn = (-_n * wn + Yn * qr) / Xn, Zn = Nr - Qr, Ln = Zr - hn, gn = oa - Qr, na = tn - hn;
          return Zn * Zn + Ln * Ln > gn * gn + na * na && (Nr = oa, Zr = tn), { cx: Nr, cy: Zr, x01: -yr, y01: -pr, x11: Nr * (kt / Wn - 1), y11: Zr * (kt / Wn - 1) };
        }
        function A2(De) {
          this._context = De;
        }
        function S2(De) {
          return new A2(De);
        }
        function C2(De) {
          return De[0];
        }
        function E2(De) {
          return De[1];
        }
        function F13() {
          var De = C2, Je = E2, tt = o(true), vt = null, kt = S2, jt = null;
          function Vt(Kt) {
            var rr, Tr, yr, pr = Kt.length, lr = false;
            for (vt == null && (jt = kt(yr = a.path())), rr = 0; rr <= pr; ++rr) !(rr < pr && tt(Tr = Kt[rr], rr, Kt)) === lr && ((lr = !lr) ? jt.lineStart() : jt.lineEnd()), lr && jt.point(+De(Tr, rr, Kt), +Je(Tr, rr, Kt));
            if (yr) return jt = null, yr + "" || null;
          }
          return Vt.x = function(Kt) {
            return arguments.length ? (De = typeof Kt == "function" ? Kt : o(+Kt), Vt) : De;
          }, Vt.y = function(Kt) {
            return arguments.length ? (Je = typeof Kt == "function" ? Kt : o(+Kt), Vt) : Je;
          }, Vt.defined = function(Kt) {
            return arguments.length ? (tt = typeof Kt == "function" ? Kt : o(!!Kt), Vt) : tt;
          }, Vt.curve = function(Kt) {
            return arguments.length ? (kt = Kt, vt != null && (jt = kt(vt)), Vt) : kt;
          }, Vt.context = function(Kt) {
            return arguments.length ? (Kt == null ? vt = jt = null : jt = kt(vt = Kt), Vt) : vt;
          }, Vt;
        }
        function N2() {
          var De = C2, Je = null, tt = o(0), vt = E2, kt = o(true), jt = null, Vt = S2, Kt = null;
          function rr(yr) {
            var pr, lr, _r, $r, Ar, Qr = yr.length, hn = false, wn = new Array(Qr), Yn = new Array(Qr);
            for (jt == null && (Kt = Vt(Ar = a.path())), pr = 0; pr <= Qr; ++pr) {
              if (!(pr < Qr && kt($r = yr[pr], pr, yr)) === hn) if (hn = !hn) lr = pr, Kt.areaStart(), Kt.lineStart();
              else {
                for (Kt.lineEnd(), Kt.lineStart(), _r = pr - 1; _r >= lr; --_r) Kt.point(wn[_r], Yn[_r]);
                Kt.lineEnd(), Kt.areaEnd();
              }
              hn && (wn[pr] = +De($r, pr, yr), Yn[pr] = +tt($r, pr, yr), Kt.point(Je ? +Je($r, pr, yr) : wn[pr], vt ? +vt($r, pr, yr) : Yn[pr]));
            }
            if (Ar) return Kt = null, Ar + "" || null;
          }
          function Tr() {
            return F13().defined(kt).curve(Vt).context(jt);
          }
          return rr.x = function(yr) {
            return arguments.length ? (De = typeof yr == "function" ? yr : o(+yr), Je = null, rr) : De;
          }, rr.x0 = function(yr) {
            return arguments.length ? (De = typeof yr == "function" ? yr : o(+yr), rr) : De;
          }, rr.x1 = function(yr) {
            return arguments.length ? (Je = yr == null ? null : typeof yr == "function" ? yr : o(+yr), rr) : Je;
          }, rr.y = function(yr) {
            return arguments.length ? (tt = typeof yr == "function" ? yr : o(+yr), vt = null, rr) : tt;
          }, rr.y0 = function(yr) {
            return arguments.length ? (tt = typeof yr == "function" ? yr : o(+yr), rr) : tt;
          }, rr.y1 = function(yr) {
            return arguments.length ? (vt = yr == null ? null : typeof yr == "function" ? yr : o(+yr), rr) : vt;
          }, rr.lineX0 = rr.lineY0 = function() {
            return Tr().x(De).y(tt);
          }, rr.lineY1 = function() {
            return Tr().x(De).y(vt);
          }, rr.lineX1 = function() {
            return Tr().x(Je).y(tt);
          }, rr.defined = function(yr) {
            return arguments.length ? (kt = typeof yr == "function" ? yr : o(!!yr), rr) : kt;
          }, rr.curve = function(yr) {
            return arguments.length ? (Vt = yr, jt != null && (Kt = Vt(jt)), rr) : Vt;
          }, rr.context = function(yr) {
            return arguments.length ? (yr == null ? jt = Kt = null : Kt = Vt(jt = yr), rr) : jt;
          }, rr;
        }
        function D2(De, Je) {
          return Je < De ? -1 : Je > De ? 1 : Je >= De ? 0 : NaN;
        }
        function I2(De) {
          return De;
        }
        A2.prototype = { areaStart: function() {
          this._line = 0;
        }, areaEnd: function() {
          this._line = NaN;
        }, lineStart: function() {
          this._point = 0;
        }, lineEnd: function() {
          (this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
        }, point: function(De, Je) {
          switch (De = +De, Je = +Je, this._point) {
            case 0:
              this._point = 1, this._line ? this._context.lineTo(De, Je) : this._context.moveTo(De, Je);
              break;
            case 1:
              this._point = 2;
            default:
              this._context.lineTo(De, Je);
          }
        } };
        var O2 = V2(S2);
        function L2(De) {
          this._curve = De;
        }
        function V2(De) {
          function Je(tt) {
            return new L2(De(tt));
          }
          return Je._curve = De, Je;
        }
        function W2(De) {
          var Je = De.curve;
          return De.angle = De.x, delete De.x, De.radius = De.y, delete De.y, De.curve = function(tt) {
            return arguments.length ? Je(V2(tt)) : Je()._curve;
          }, De;
        }
        function X2() {
          return W2(F13().curve(O2));
        }
        function Y2() {
          var De = N2().curve(O2), Je = De.curve, tt = De.lineX0, vt = De.lineX1, kt = De.lineY0, jt = De.lineY1;
          return De.angle = De.x, delete De.x, De.startAngle = De.x0, delete De.x0, De.endAngle = De.x1, delete De.x1, De.radius = De.y, delete De.y, De.innerRadius = De.y0, delete De.y0, De.outerRadius = De.y1, delete De.y1, De.lineStartAngle = function() {
            return W2(tt());
          }, delete De.lineX0, De.lineEndAngle = function() {
            return W2(vt());
          }, delete De.lineX1, De.lineInnerRadius = function() {
            return W2(kt());
          }, delete De.lineY0, De.lineOuterRadius = function() {
            return W2(jt());
          }, delete De.lineY1, De.curve = function(Vt) {
            return arguments.length ? Je(V2(Vt)) : Je()._curve;
          }, De;
        }
        function K2(De, Je) {
          return [(Je = +Je) * Math.cos(De -= Math.PI / 2), Je * Math.sin(De)];
        }
        L2.prototype = { areaStart: function() {
          this._curve.areaStart();
        }, areaEnd: function() {
          this._curve.areaEnd();
        }, lineStart: function() {
          this._curve.lineStart();
        }, lineEnd: function() {
          this._curve.lineEnd();
        }, point: function(De, Je) {
          this._curve.point(Je * Math.sin(De), Je * -Math.cos(De));
        } };
        var q = Array.prototype.slice;
        function re(De) {
          return De.source;
        }
        function R2(De) {
          return De.target;
        }
        function z(De) {
          var Je = re, tt = R2, vt = C2, kt = E2, jt = null;
          function Vt() {
            var Kt, rr = q.call(arguments), Tr = Je.apply(this, rr), yr = tt.apply(this, rr);
            if (jt || (jt = Kt = a.path()), De(jt, +vt.apply(this, (rr[0] = Tr, rr)), +kt.apply(this, rr), +vt.apply(this, (rr[0] = yr, rr)), +kt.apply(this, rr)), Kt) return jt = null, Kt + "" || null;
          }
          return Vt.source = function(Kt) {
            return arguments.length ? (Je = Kt, Vt) : Je;
          }, Vt.target = function(Kt) {
            return arguments.length ? (tt = Kt, Vt) : tt;
          }, Vt.x = function(Kt) {
            return arguments.length ? (vt = typeof Kt == "function" ? Kt : o(+Kt), Vt) : vt;
          }, Vt.y = function(Kt) {
            return arguments.length ? (kt = typeof Kt == "function" ? Kt : o(+Kt), Vt) : kt;
          }, Vt.context = function(Kt) {
            return arguments.length ? (jt = Kt ?? null, Vt) : jt;
          }, Vt;
        }
        function H2(De, Je, tt, vt, kt) {
          De.moveTo(Je, tt), De.bezierCurveTo(Je = (Je + vt) / 2, tt, Je, kt, vt, kt);
        }
        function te(De, Je, tt, vt, kt) {
          De.moveTo(Je, tt), De.bezierCurveTo(Je, tt = (tt + kt) / 2, vt, tt, vt, kt);
        }
        function j(De, Je, tt, vt, kt) {
          var jt = K2(Je, tt), Vt = K2(Je, tt = (tt + kt) / 2), Kt = K2(vt, tt), rr = K2(vt, kt);
          De.moveTo(jt[0], jt[1]), De.bezierCurveTo(Vt[0], Vt[1], Kt[0], Kt[1], rr[0], rr[1]);
        }
        var Q2 = { draw: function(De, Je) {
          var tt = Math.sqrt(Je / p);
          De.moveTo(tt, 0), De.arc(0, 0, tt, 0, v);
        } }, Z2 = { draw: function(De, Je) {
          var tt = Math.sqrt(Je / 5) / 2;
          De.moveTo(-3 * tt, -tt), De.lineTo(-tt, -tt), De.lineTo(-tt, -3 * tt), De.lineTo(tt, -3 * tt), De.lineTo(tt, -tt), De.lineTo(3 * tt, -tt), De.lineTo(3 * tt, tt), De.lineTo(tt, tt), De.lineTo(tt, 3 * tt), De.lineTo(-tt, 3 * tt), De.lineTo(-tt, tt), De.lineTo(-3 * tt, tt), De.closePath();
        } }, ne = Math.sqrt(1 / 3), ae = 2 * ne, ue = { draw: function(De, Je) {
          var tt = Math.sqrt(Je / ae), vt = tt * ne;
          De.moveTo(0, -tt), De.lineTo(vt, 0), De.lineTo(0, tt), De.lineTo(-vt, 0), De.closePath();
        } }, le = Math.sin(p / 10) / Math.sin(7 * p / 10), ce = Math.sin(v / 10) * le, se = -Math.cos(v / 10) * le, he = { draw: function(De, Je) {
          var tt = Math.sqrt(0.8908130915292852 * Je), vt = ce * tt, kt = se * tt;
          De.moveTo(0, -tt), De.lineTo(vt, kt);
          for (var jt = 1; jt < 5; ++jt) {
            var Vt = v * jt / 5, Kt = Math.cos(Vt), rr = Math.sin(Vt);
            De.lineTo(rr * tt, -Kt * tt), De.lineTo(Kt * vt - rr * kt, rr * vt + Kt * kt);
          }
          De.closePath();
        } }, me = { draw: function(De, Je) {
          var tt = Math.sqrt(Je), vt = -tt / 2;
          De.rect(vt, vt, tt, tt);
        } }, we = Math.sqrt(3), be = { draw: function(De, Je) {
          var tt = -Math.sqrt(Je / (3 * we));
          De.moveTo(0, 2 * tt), De.lineTo(-we * tt, -tt), De.lineTo(we * tt, -tt), De.closePath();
        } }, Ae = -0.5, pe = Math.sqrt(3) / 2, ve = 1 / Math.sqrt(12), Ee = 3 * (ve / 2 + 1), Se = { draw: function(De, Je) {
          var tt = Math.sqrt(Je / Ee), vt = tt / 2, kt = tt * ve, jt = vt, Vt = tt * ve + tt, Kt = -jt, rr = Vt;
          De.moveTo(vt, kt), De.lineTo(jt, Vt), De.lineTo(Kt, rr), De.lineTo(Ae * vt - pe * kt, pe * vt + Ae * kt), De.lineTo(Ae * jt - pe * Vt, pe * jt + Ae * Vt), De.lineTo(Ae * Kt - pe * rr, pe * Kt + Ae * rr), De.lineTo(Ae * vt + pe * kt, Ae * kt - pe * vt), De.lineTo(Ae * jt + pe * Vt, Ae * Vt - pe * jt), De.lineTo(Ae * Kt + pe * rr, Ae * rr - pe * Kt), De.closePath();
        } }, Ce = [Q2, Z2, ue, me, he, be, Se];
        function Be() {
        }
        function Ue(De, Je, tt) {
          De._context.bezierCurveTo((2 * De._x0 + De._x1) / 3, (2 * De._y0 + De._y1) / 3, (De._x0 + 2 * De._x1) / 3, (De._y0 + 2 * De._y1) / 3, (De._x0 + 4 * De._x1 + Je) / 6, (De._y0 + 4 * De._y1 + tt) / 6);
        }
        function Ke(De) {
          this._context = De;
        }
        function ct(De) {
          this._context = De;
        }
        function We(De) {
          this._context = De;
        }
        function Ze(De, Je) {
          this._basis = new Ke(De), this._beta = Je;
        }
        Ke.prototype = { areaStart: function() {
          this._line = 0;
        }, areaEnd: function() {
          this._line = NaN;
        }, lineStart: function() {
          this._x0 = this._x1 = this._y0 = this._y1 = NaN, this._point = 0;
        }, lineEnd: function() {
          switch (this._point) {
            case 3:
              Ue(this, this._x1, this._y1);
            case 2:
              this._context.lineTo(this._x1, this._y1);
          }
          (this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
        }, point: function(De, Je) {
          switch (De = +De, Je = +Je, this._point) {
            case 0:
              this._point = 1, this._line ? this._context.lineTo(De, Je) : this._context.moveTo(De, Je);
              break;
            case 1:
              this._point = 2;
              break;
            case 2:
              this._point = 3, this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6);
            default:
              Ue(this, De, Je);
          }
          this._x0 = this._x1, this._x1 = De, this._y0 = this._y1, this._y1 = Je;
        } }, ct.prototype = { areaStart: Be, areaEnd: Be, lineStart: function() {
          this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN, this._point = 0;
        }, lineEnd: function() {
          switch (this._point) {
            case 1:
              this._context.moveTo(this._x2, this._y2), this._context.closePath();
              break;
            case 2:
              this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3), this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3), this._context.closePath();
              break;
            case 3:
              this.point(this._x2, this._y2), this.point(this._x3, this._y3), this.point(this._x4, this._y4);
          }
        }, point: function(De, Je) {
          switch (De = +De, Je = +Je, this._point) {
            case 0:
              this._point = 1, this._x2 = De, this._y2 = Je;
              break;
            case 1:
              this._point = 2, this._x3 = De, this._y3 = Je;
              break;
            case 2:
              this._point = 3, this._x4 = De, this._y4 = Je, this._context.moveTo((this._x0 + 4 * this._x1 + De) / 6, (this._y0 + 4 * this._y1 + Je) / 6);
              break;
            default:
              Ue(this, De, Je);
          }
          this._x0 = this._x1, this._x1 = De, this._y0 = this._y1, this._y1 = Je;
        } }, We.prototype = { areaStart: function() {
          this._line = 0;
        }, areaEnd: function() {
          this._line = NaN;
        }, lineStart: function() {
          this._x0 = this._x1 = this._y0 = this._y1 = NaN, this._point = 0;
        }, lineEnd: function() {
          (this._line || this._line !== 0 && this._point === 3) && this._context.closePath(), this._line = 1 - this._line;
        }, point: function(De, Je) {
          switch (De = +De, Je = +Je, this._point) {
            case 0:
              this._point = 1;
              break;
            case 1:
              this._point = 2;
              break;
            case 2:
              this._point = 3;
              var tt = (this._x0 + 4 * this._x1 + De) / 6, vt = (this._y0 + 4 * this._y1 + Je) / 6;
              this._line ? this._context.lineTo(tt, vt) : this._context.moveTo(tt, vt);
              break;
            case 3:
              this._point = 4;
            default:
              Ue(this, De, Je);
          }
          this._x0 = this._x1, this._x1 = De, this._y0 = this._y1, this._y1 = Je;
        } }, Ze.prototype = { lineStart: function() {
          this._x = [], this._y = [], this._basis.lineStart();
        }, lineEnd: function() {
          var De = this._x, Je = this._y, tt = De.length - 1;
          if (tt > 0) for (var vt, kt = De[0], jt = Je[0], Vt = De[tt] - kt, Kt = Je[tt] - jt, rr = -1; ++rr <= tt; ) vt = rr / tt, this._basis.point(this._beta * De[rr] + (1 - this._beta) * (kt + vt * Vt), this._beta * Je[rr] + (1 - this._beta) * (jt + vt * Kt));
          this._x = this._y = null, this._basis.lineEnd();
        }, point: function(De, Je) {
          this._x.push(+De), this._y.push(+Je);
        } };
        var it = function De(Je) {
          function tt(vt) {
            return Je === 1 ? new Ke(vt) : new Ze(vt, Je);
          }
          return tt.beta = function(vt) {
            return De(+vt);
          }, tt;
        }(0.85);
        function ot(De, Je, tt) {
          De._context.bezierCurveTo(De._x1 + De._k * (De._x2 - De._x0), De._y1 + De._k * (De._y2 - De._y0), De._x2 + De._k * (De._x1 - Je), De._y2 + De._k * (De._y1 - tt), De._x2, De._y2);
        }
        function mt(De, Je) {
          this._context = De, this._k = (1 - Je) / 6;
        }
        mt.prototype = { areaStart: function() {
          this._line = 0;
        }, areaEnd: function() {
          this._line = NaN;
        }, lineStart: function() {
          this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN, this._point = 0;
        }, lineEnd: function() {
          switch (this._point) {
            case 2:
              this._context.lineTo(this._x2, this._y2);
              break;
            case 3:
              ot(this, this._x1, this._y1);
          }
          (this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
        }, point: function(De, Je) {
          switch (De = +De, Je = +Je, this._point) {
            case 0:
              this._point = 1, this._line ? this._context.lineTo(De, Je) : this._context.moveTo(De, Je);
              break;
            case 1:
              this._point = 2, this._x1 = De, this._y1 = Je;
              break;
            case 2:
              this._point = 3;
            default:
              ot(this, De, Je);
          }
          this._x0 = this._x1, this._x1 = this._x2, this._x2 = De, this._y0 = this._y1, this._y1 = this._y2, this._y2 = Je;
        } };
        var wt = function De(Je) {
          function tt(vt) {
            return new mt(vt, Je);
          }
          return tt.tension = function(vt) {
            return De(+vt);
          }, tt;
        }(0);
        function Et(De, Je) {
          this._context = De, this._k = (1 - Je) / 6;
        }
        Et.prototype = { areaStart: Be, areaEnd: Be, lineStart: function() {
          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, this._point = 0;
        }, lineEnd: function() {
          switch (this._point) {
            case 1:
              this._context.moveTo(this._x3, this._y3), this._context.closePath();
              break;
            case 2:
              this._context.lineTo(this._x3, this._y3), this._context.closePath();
              break;
            case 3:
              this.point(this._x3, this._y3), this.point(this._x4, this._y4), this.point(this._x5, this._y5);
          }
        }, point: function(De, Je) {
          switch (De = +De, Je = +Je, this._point) {
            case 0:
              this._point = 1, this._x3 = De, this._y3 = Je;
              break;
            case 1:
              this._point = 2, this._context.moveTo(this._x4 = De, this._y4 = Je);
              break;
            case 2:
              this._point = 3, this._x5 = De, this._y5 = Je;
              break;
            default:
              ot(this, De, Je);
          }
          this._x0 = this._x1, this._x1 = this._x2, this._x2 = De, this._y0 = this._y1, this._y1 = this._y2, this._y2 = Je;
        } };
        var zt = function De(Je) {
          function tt(vt) {
            return new Et(vt, Je);
          }
          return tt.tension = function(vt) {
            return De(+vt);
          }, tt;
        }(0);
        function Nt(De, Je) {
          this._context = De, this._k = (1 - Je) / 6;
        }
        Nt.prototype = { areaStart: function() {
          this._line = 0;
        }, areaEnd: function() {
          this._line = NaN;
        }, lineStart: function() {
          this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN, this._point = 0;
        }, lineEnd: function() {
          (this._line || this._line !== 0 && this._point === 3) && this._context.closePath(), this._line = 1 - this._line;
        }, point: function(De, Je) {
          switch (De = +De, Je = +Je, this._point) {
            case 0:
              this._point = 1;
              break;
            case 1:
              this._point = 2;
              break;
            case 2:
              this._point = 3, this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2);
              break;
            case 3:
              this._point = 4;
            default:
              ot(this, De, Je);
          }
          this._x0 = this._x1, this._x1 = this._x2, this._x2 = De, this._y0 = this._y1, this._y1 = this._y2, this._y2 = Je;
        } };
        var yt = function De(Je) {
          function tt(vt) {
            return new Nt(vt, Je);
          }
          return tt.tension = function(vt) {
            return De(+vt);
          }, tt;
        }(0);
        function pt(De, Je, tt) {
          var vt = De._x1, kt = De._y1, jt = De._x2, Vt = De._y2;
          if (De._l01_a > 1e-12) {
            var Kt = 2 * De._l01_2a + 3 * De._l01_a * De._l12_a + De._l12_2a, rr = 3 * De._l01_a * (De._l01_a + De._l12_a);
            vt = (vt * Kt - De._x0 * De._l12_2a + De._x2 * De._l01_2a) / rr, kt = (kt * Kt - De._y0 * De._l12_2a + De._y2 * De._l01_2a) / rr;
          }
          if (De._l23_a > 1e-12) {
            var Tr = 2 * De._l23_2a + 3 * De._l23_a * De._l12_a + De._l12_2a, yr = 3 * De._l23_a * (De._l23_a + De._l12_a);
            jt = (jt * Tr + De._x1 * De._l23_2a - Je * De._l12_2a) / yr, Vt = (Vt * Tr + De._y1 * De._l23_2a - tt * De._l12_2a) / yr;
          }
          De._context.bezierCurveTo(vt, kt, jt, Vt, De._x2, De._y2);
        }
        function Ot(De, Je) {
          this._context = De, this._alpha = Je;
        }
        Ot.prototype = { areaStart: function() {
          this._line = 0;
        }, areaEnd: function() {
          this._line = NaN;
        }, lineStart: function() {
          this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN, this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
        }, lineEnd: function() {
          switch (this._point) {
            case 2:
              this._context.lineTo(this._x2, this._y2);
              break;
            case 3:
              this.point(this._x2, this._y2);
          }
          (this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
        }, point: function(De, Je) {
          if (De = +De, Je = +Je, this._point) {
            var tt = this._x2 - De, vt = this._y2 - Je;
            this._l23_a = Math.sqrt(this._l23_2a = Math.pow(tt * tt + vt * vt, this._alpha));
          }
          switch (this._point) {
            case 0:
              this._point = 1, this._line ? this._context.lineTo(De, Je) : this._context.moveTo(De, Je);
              break;
            case 1:
              this._point = 2;
              break;
            case 2:
              this._point = 3;
            default:
              pt(this, De, Je);
          }
          this._l01_a = this._l12_a, this._l12_a = this._l23_a, this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a, this._x0 = this._x1, this._x1 = this._x2, this._x2 = De, this._y0 = this._y1, this._y1 = this._y2, this._y2 = Je;
        } };
        var Jt = function De(Je) {
          function tt(vt) {
            return Je ? new Ot(vt, Je) : new mt(vt, 0);
          }
          return tt.alpha = function(vt) {
            return De(+vt);
          }, tt;
        }(0.5);
        function tr(De, Je) {
          this._context = De, this._alpha = Je;
        }
        tr.prototype = { areaStart: Be, areaEnd: Be, lineStart: function() {
          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, this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
        }, lineEnd: function() {
          switch (this._point) {
            case 1:
              this._context.moveTo(this._x3, this._y3), this._context.closePath();
              break;
            case 2:
              this._context.lineTo(this._x3, this._y3), this._context.closePath();
              break;
            case 3:
              this.point(this._x3, this._y3), this.point(this._x4, this._y4), this.point(this._x5, this._y5);
          }
        }, point: function(De, Je) {
          if (De = +De, Je = +Je, this._point) {
            var tt = this._x2 - De, vt = this._y2 - Je;
            this._l23_a = Math.sqrt(this._l23_2a = Math.pow(tt * tt + vt * vt, this._alpha));
          }
          switch (this._point) {
            case 0:
              this._point = 1, this._x3 = De, this._y3 = Je;
              break;
            case 1:
              this._point = 2, this._context.moveTo(this._x4 = De, this._y4 = Je);
              break;
            case 2:
              this._point = 3, this._x5 = De, this._y5 = Je;
              break;
            default:
              pt(this, De, Je);
          }
          this._l01_a = this._l12_a, this._l12_a = this._l23_a, this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a, this._x0 = this._x1, this._x1 = this._x2, this._x2 = De, this._y0 = this._y1, this._y1 = this._y2, this._y2 = Je;
        } };
        var Ye = function De(Je) {
          function tt(vt) {
            return Je ? new tr(vt, Je) : new Et(vt, 0);
          }
          return tt.alpha = function(vt) {
            return De(+vt);
          }, tt;
        }(0.5);
        function at(De, Je) {
          this._context = De, this._alpha = Je;
        }
        at.prototype = { areaStart: function() {
          this._line = 0;
        }, areaEnd: function() {
          this._line = NaN;
        }, lineStart: function() {
          this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN, this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
        }, lineEnd: function() {
          (this._line || this._line !== 0 && this._point === 3) && this._context.closePath(), this._line = 1 - this._line;
        }, point: function(De, Je) {
          if (De = +De, Je = +Je, this._point) {
            var tt = this._x2 - De, vt = this._y2 - Je;
            this._l23_a = Math.sqrt(this._l23_2a = Math.pow(tt * tt + vt * vt, this._alpha));
          }
          switch (this._point) {
            case 0:
              this._point = 1;
              break;
            case 1:
              this._point = 2;
              break;
            case 2:
              this._point = 3, this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2);
              break;
            case 3:
              this._point = 4;
            default:
              pt(this, De, Je);
          }
          this._l01_a = this._l12_a, this._l12_a = this._l23_a, this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a, this._x0 = this._x1, this._x1 = this._x2, this._x2 = De, this._y0 = this._y1, this._y1 = this._y2, this._y2 = Je;
        } };
        var Ge = function De(Je) {
          function tt(vt) {
            return Je ? new at(vt, Je) : new Nt(vt, 0);
          }
          return tt.alpha = function(vt) {
            return De(+vt);
          }, tt;
        }(0.5);
        function st(De) {
          this._context = De;
        }
        function Ie(De) {
          return De < 0 ? -1 : 1;
        }
        function Pe(De, Je, tt) {
          var vt = De._x1 - De._x0, kt = Je - De._x1, jt = (De._y1 - De._y0) / (vt || kt < 0 && -0), Vt = (tt - De._y1) / (kt || vt < 0 && -0), Kt = (jt * kt + Vt * vt) / (vt + kt);
          return (Ie(jt) + Ie(Vt)) * Math.min(Math.abs(jt), Math.abs(Vt), 0.5 * Math.abs(Kt)) || 0;
        }
        function $e(De, Je) {
          var tt = De._x1 - De._x0;
          return tt ? (3 * (De._y1 - De._y0) / tt - Je) / 2 : Je;
        }
        function Ve(De, Je, tt) {
          var vt = De._x0, kt = De._y0, jt = De._x1, Vt = De._y1, Kt = (jt - vt) / 3;
          De._context.bezierCurveTo(vt + Kt, kt + Kt * Je, jt - Kt, Vt - Kt * tt, jt, Vt);
        }
        function ut(De) {
          this._context = De;
        }
        function Re(De) {
          this._context = new qe(De);
        }
        function qe(De) {
          this._context = De;
        }
        function je(De) {
          this._context = De;
        }
        function rt(De) {
          var Je, tt, vt = De.length - 1, kt = new Array(vt), jt = new Array(vt), Vt = new Array(vt);
          for (kt[0] = 0, jt[0] = 2, Vt[0] = De[0] + 2 * De[1], Je = 1; Je < vt - 1; ++Je) kt[Je] = 1, jt[Je] = 4, Vt[Je] = 4 * De[Je] + 2 * De[Je + 1];
          for (kt[vt - 1] = 2, jt[vt - 1] = 7, Vt[vt - 1] = 8 * De[vt - 1] + De[vt], Je = 1; Je < vt; ++Je) tt = kt[Je] / jt[Je - 1], jt[Je] -= tt, Vt[Je] -= tt * Vt[Je - 1];
          for (kt[vt - 1] = Vt[vt - 1] / jt[vt - 1], Je = vt - 2; Je >= 0; --Je) kt[Je] = (Vt[Je] - kt[Je + 1]) / jt[Je];
          for (jt[vt - 1] = (De[vt] + kt[vt - 1]) / 2, Je = 0; Je < vt - 1; ++Je) jt[Je] = 2 * De[Je + 1] - kt[Je + 1];
          return [kt, jt];
        }
        function He(De, Je) {
          this._context = De, this._t = Je;
        }
        function xe(De, Je) {
          if ((kt = De.length) > 1) for (var tt, vt, kt, jt = 1, Vt = De[Je[0]], Kt = Vt.length; jt < kt; ++jt) for (vt = Vt, Vt = De[Je[jt]], tt = 0; tt < Kt; ++tt) Vt[tt][1] += Vt[tt][0] = isNaN(vt[tt][1]) ? vt[tt][0] : vt[tt][1];
        }
        function Ne(De) {
          for (var Je = De.length, tt = new Array(Je); --Je >= 0; ) tt[Je] = Je;
          return tt;
        }
        function ke(De, Je) {
          return De[Je];
        }
        function Me(De) {
          var Je = De.map(Le);
          return Ne(De).sort(function(tt, vt) {
            return Je[tt] - Je[vt];
          });
        }
        function Le(De) {
          for (var Je, tt = -1, vt = 0, kt = De.length, jt = -1 / 0; ++tt < kt; ) (Je = +De[tt][1]) > jt && (jt = Je, vt = tt);
          return vt;
        }
        function ze(De) {
          var Je = De.map(ft);
          return Ne(De).sort(function(tt, vt) {
            return Je[tt] - Je[vt];
          });
        }
        function ft(De) {
          for (var Je, tt = 0, vt = -1, kt = De.length; ++vt < kt; ) (Je = +De[vt][1]) && (tt += Je);
          return tt;
        }
        st.prototype = { areaStart: Be, areaEnd: Be, lineStart: function() {
          this._point = 0;
        }, lineEnd: function() {
          this._point && this._context.closePath();
        }, point: function(De, Je) {
          De = +De, Je = +Je, this._point ? this._context.lineTo(De, Je) : (this._point = 1, this._context.moveTo(De, Je));
        } }, ut.prototype = { areaStart: function() {
          this._line = 0;
        }, areaEnd: function() {
          this._line = NaN;
        }, lineStart: function() {
          this._x0 = this._x1 = this._y0 = this._y1 = this._t0 = NaN, this._point = 0;
        }, lineEnd: function() {
          switch (this._point) {
            case 2:
              this._context.lineTo(this._x1, this._y1);
              break;
            case 3:
              Ve(this, this._t0, $e(this, this._t0));
          }
          (this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
        }, point: function(De, Je) {
          var tt = NaN;
          if (Je = +Je, (De = +De) !== this._x1 || Je !== this._y1) {
            switch (this._point) {
              case 0:
                this._point = 1, this._line ? this._context.lineTo(De, Je) : this._context.moveTo(De, Je);
                break;
              case 1:
                this._point = 2;
                break;
              case 2:
                this._point = 3, Ve(this, $e(this, tt = Pe(this, De, Je)), tt);
                break;
              default:
                Ve(this, this._t0, tt = Pe(this, De, Je));
            }
            this._x0 = this._x1, this._x1 = De, this._y0 = this._y1, this._y1 = Je, this._t0 = tt;
          }
        } }, (Re.prototype = Object.create(ut.prototype)).point = function(De, Je) {
          ut.prototype.point.call(this, Je, De);
        }, qe.prototype = { moveTo: function(De, Je) {
          this._context.moveTo(Je, De);
        }, closePath: function() {
          this._context.closePath();
        }, lineTo: function(De, Je) {
          this._context.lineTo(Je, De);
        }, bezierCurveTo: function(De, Je, tt, vt, kt, jt) {
          this._context.bezierCurveTo(Je, De, vt, tt, jt, kt);
        } }, je.prototype = { areaStart: function() {
          this._line = 0;
        }, areaEnd: function() {
          this._line = NaN;
        }, lineStart: function() {
          this._x = [], this._y = [];
        }, lineEnd: function() {
          var De = this._x, Je = this._y, tt = De.length;
          if (tt) if (this._line ? this._context.lineTo(De[0], Je[0]) : this._context.moveTo(De[0], Je[0]), tt === 2) this._context.lineTo(De[1], Je[1]);
          else for (var vt = rt(De), kt = rt(Je), jt = 0, Vt = 1; Vt < tt; ++jt, ++Vt) this._context.bezierCurveTo(vt[0][jt], kt[0][jt], vt[1][jt], kt[1][jt], De[Vt], Je[Vt]);
          (this._line || this._line !== 0 && tt === 1) && this._context.closePath(), this._line = 1 - this._line, this._x = this._y = null;
        }, point: function(De, Je) {
          this._x.push(+De), this._y.push(+Je);
        } }, He.prototype = { areaStart: function() {
          this._line = 0;
        }, areaEnd: function() {
          this._line = NaN;
        }, lineStart: function() {
          this._x = this._y = NaN, this._point = 0;
        }, lineEnd: function() {
          0 < this._t && this._t < 1 && this._point === 2 && this._context.lineTo(this._x, this._y), (this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line >= 0 && (this._t = 1 - this._t, this._line = 1 - this._line);
        }, point: function(De, Je) {
          switch (De = +De, Je = +Je, this._point) {
            case 0:
              this._point = 1, this._line ? this._context.lineTo(De, Je) : this._context.moveTo(De, Je);
              break;
            case 1:
              this._point = 2;
            default:
              if (this._t <= 0) this._context.lineTo(this._x, Je), this._context.lineTo(De, Je);
              else {
                var tt = this._x * (1 - this._t) + De * this._t;
                this._context.lineTo(tt, this._y), this._context.lineTo(tt, Je);
              }
          }
          this._x = De, this._y = Je;
        } }, n.arc = function() {
          var De = x, Je = b, tt = o(0), vt = null, kt = y, jt = w, Vt = _4, Kt = null;
          function rr() {
            var Tr, yr, pr = +De.apply(this, arguments), lr = +Je.apply(this, arguments), _r = kt.apply(this, arguments) - d, $r = jt.apply(this, arguments) - d, Ar = s($r - _r), Qr = $r > _r;
            if (Kt || (Kt = Tr = a.path()), lr < pr && (yr = lr, lr = pr, pr = yr), lr > 1e-12) if (Ar > v - 1e-12) Kt.moveTo(lr * l(_r), lr * f(_r)), Kt.arc(0, 0, lr, _r, $r, !Qr), pr > 1e-12 && (Kt.moveTo(pr * l($r), pr * f($r)), Kt.arc(0, 0, pr, $r, _r, Qr));
            else {
              var hn, wn, Yn = _r, Xn = $r, Wn = _r, _n = $r, qr = Ar, Nr = Ar, Zr = Vt.apply(this, arguments) / 2, oa = Zr > 1e-12 && (vt ? +vt.apply(this, arguments) : h(pr * pr + lr * lr)), tn = c(s(lr - pr) / 2, +tt.apply(this, arguments)), Zn = tn, Ln = tn;
              if (oa > 1e-12) {
                var gn = g(oa / pr * f(Zr)), na = g(oa / lr * f(Zr));
                (qr -= 2 * gn) > 1e-12 ? (Wn += gn *= Qr ? 1 : -1, _n -= gn) : (qr = 0, Wn = _n = (_r + $r) / 2), (Nr -= 2 * na) > 1e-12 ? (Yn += na *= Qr ? 1 : -1, Xn -= na) : (Nr = 0, Yn = Xn = (_r + $r) / 2);
              }
              var sr = lr * l(Yn), Ut = lr * f(Yn), Zt = pr * l(_n), xr = pr * f(_n);
              if (tn > 1e-12) {
                var Fr, pn = lr * l(Xn), un = lr * f(Xn), Ir = pr * l(Wn), Cr = pr * f(Wn);
                if (Ar < p && (Fr = k(sr, Ut, Ir, Cr, pn, un, Zt, xr))) {
                  var Lr = sr - Fr[0], jr = Ut - Fr[1], Rr = pn - Fr[0], vn = un - Fr[1], Mn = 1 / f(m((Lr * Rr + jr * vn) / (h(Lr * Lr + jr * jr) * h(Rr * Rr + vn * vn))) / 2), jn = h(Fr[0] * Fr[0] + Fr[1] * Fr[1]);
                  Zn = c(tn, (pr - jn) / (Mn - 1)), Ln = c(tn, (lr - jn) / (Mn + 1));
                }
              }
              Nr > 1e-12 ? Ln > 1e-12 ? (hn = T2(Ir, Cr, sr, Ut, lr, Ln, Qr), wn = T2(pn, un, Zt, xr, lr, Ln, Qr), Kt.moveTo(hn.cx + hn.x01, hn.cy + hn.y01), Ln < tn ? Kt.arc(hn.cx, hn.cy, Ln, i(hn.y01, hn.x01), i(wn.y01, wn.x01), !Qr) : (Kt.arc(hn.cx, hn.cy, Ln, i(hn.y01, hn.x01), i(hn.y11, hn.x11), !Qr), Kt.arc(0, 0, lr, i(hn.cy + hn.y11, hn.cx + hn.x11), i(wn.cy + wn.y11, wn.cx + wn.x11), !Qr), Kt.arc(wn.cx, wn.cy, Ln, i(wn.y11, wn.x11), i(wn.y01, wn.x01), !Qr))) : (Kt.moveTo(sr, Ut), Kt.arc(0, 0, lr, Yn, Xn, !Qr)) : Kt.moveTo(sr, Ut), pr > 1e-12 && qr > 1e-12 ? Zn > 1e-12 ? (hn = T2(Zt, xr, pn, un, pr, -Zn, Qr), wn = T2(sr, Ut, Ir, Cr, pr, -Zn, Qr), Kt.lineTo(hn.cx + hn.x01, hn.cy + hn.y01), Zn < tn ? Kt.arc(hn.cx, hn.cy, Zn, i(hn.y01, hn.x01), i(wn.y01, wn.x01), !Qr) : (Kt.arc(hn.cx, hn.cy, Zn, i(hn.y01, hn.x01), i(hn.y11, hn.x11), !Qr), Kt.arc(0, 0, pr, i(hn.cy + hn.y11, hn.cx + hn.x11), i(wn.cy + wn.y11, wn.cx + wn.x11), Qr), Kt.arc(wn.cx, wn.cy, Zn, i(wn.y11, wn.x11), i(wn.y01, wn.x01), !Qr))) : Kt.arc(0, 0, pr, _n, Wn, Qr) : Kt.lineTo(Zt, xr);
            }
            else Kt.moveTo(0, 0);
            if (Kt.closePath(), Tr) return Kt = null, Tr + "" || null;
          }
          return rr.centroid = function() {
            var Tr = (+De.apply(this, arguments) + +Je.apply(this, arguments)) / 2, yr = (+kt.apply(this, arguments) + +jt.apply(this, arguments)) / 2 - p / 2;
            return [l(yr) * Tr, f(yr) * Tr];
          }, rr.innerRadius = function(Tr) {
            return arguments.length ? (De = typeof Tr == "function" ? Tr : o(+Tr), rr) : De;
          }, rr.outerRadius = function(Tr) {
            return arguments.length ? (Je = typeof Tr == "function" ? Tr : o(+Tr), rr) : Je;
          }, rr.cornerRadius = function(Tr) {
            return arguments.length ? (tt = typeof Tr == "function" ? Tr : o(+Tr), rr) : tt;
          }, rr.padRadius = function(Tr) {
            return arguments.length ? (vt = Tr == null ? null : typeof Tr == "function" ? Tr : o(+Tr), rr) : vt;
          }, rr.startAngle = function(Tr) {
            return arguments.length ? (kt = typeof Tr == "function" ? Tr : o(+Tr), rr) : kt;
          }, rr.endAngle = function(Tr) {
            return arguments.length ? (jt = typeof Tr == "function" ? Tr : o(+Tr), rr) : jt;
          }, rr.padAngle = function(Tr) {
            return arguments.length ? (Vt = typeof Tr == "function" ? Tr : o(+Tr), rr) : Vt;
          }, rr.context = function(Tr) {
            return arguments.length ? (Kt = Tr ?? null, rr) : Kt;
          }, rr;
        }, n.area = N2, n.areaRadial = Y2, n.curveBasis = function(De) {
          return new Ke(De);
        }, n.curveBasisClosed = function(De) {
          return new ct(De);
        }, n.curveBasisOpen = function(De) {
          return new We(De);
        }, n.curveBundle = it, n.curveCardinal = wt, n.curveCardinalClosed = zt, n.curveCardinalOpen = yt, n.curveCatmullRom = Jt, n.curveCatmullRomClosed = Ye, n.curveCatmullRomOpen = Ge, n.curveLinear = S2, n.curveLinearClosed = function(De) {
          return new st(De);
        }, n.curveMonotoneX = function(De) {
          return new ut(De);
        }, n.curveMonotoneY = function(De) {
          return new Re(De);
        }, n.curveNatural = function(De) {
          return new je(De);
        }, n.curveStep = function(De) {
          return new He(De, 0.5);
        }, n.curveStepAfter = function(De) {
          return new He(De, 1);
        }, n.curveStepBefore = function(De) {
          return new He(De, 0);
        }, n.line = F13, n.lineRadial = X2, n.linkHorizontal = function() {
          return z(H2);
        }, n.linkRadial = function() {
          var De = z(j);
          return De.angle = De.x, delete De.x, De.radius = De.y, delete De.y, De;
        }, n.linkVertical = function() {
          return z(te);
        }, n.pie = function() {
          var De = I2, Je = D2, tt = null, vt = o(0), kt = o(v), jt = o(0);
          function Vt(Kt) {
            var rr, Tr, yr, pr, lr, _r = Kt.length, $r = 0, Ar = new Array(_r), Qr = new Array(_r), hn = +vt.apply(this, arguments), wn = Math.min(v, Math.max(-v, kt.apply(this, arguments) - hn)), Yn = Math.min(Math.abs(wn) / _r, jt.apply(this, arguments)), Xn = Yn * (wn < 0 ? -1 : 1);
            for (rr = 0; rr < _r; ++rr) (lr = Qr[Ar[rr] = rr] = +De(Kt[rr], rr, Kt)) > 0 && ($r += lr);
            for (Je != null ? Ar.sort(function(Wn, _n) {
              return Je(Qr[Wn], Qr[_n]);
            }) : tt != null && Ar.sort(function(Wn, _n) {
              return tt(Kt[Wn], Kt[_n]);
            }), rr = 0, yr = $r ? (wn - _r * Xn) / $r : 0; rr < _r; ++rr, hn = pr) Tr = Ar[rr], pr = hn + ((lr = Qr[Tr]) > 0 ? lr * yr : 0) + Xn, Qr[Tr] = { data: Kt[Tr], index: rr, value: lr, startAngle: hn, endAngle: pr, padAngle: Yn };
            return Qr;
          }
          return Vt.value = function(Kt) {
            return arguments.length ? (De = typeof Kt == "function" ? Kt : o(+Kt), Vt) : De;
          }, Vt.sortValues = function(Kt) {
            return arguments.length ? (Je = Kt, tt = null, Vt) : Je;
          }, Vt.sort = function(Kt) {
            return arguments.length ? (tt = Kt, Je = null, Vt) : tt;
          }, Vt.startAngle = function(Kt) {
            return arguments.length ? (vt = typeof Kt == "function" ? Kt : o(+Kt), Vt) : vt;
          }, Vt.endAngle = function(Kt) {
            return arguments.length ? (kt = typeof Kt == "function" ? Kt : o(+Kt), Vt) : kt;
          }, Vt.padAngle = function(Kt) {
            return arguments.length ? (jt = typeof Kt == "function" ? Kt : o(+Kt), Vt) : jt;
          }, Vt;
        }, n.pointRadial = K2, n.radialArea = Y2, n.radialLine = X2, n.stack = function() {
          var De = o([]), Je = Ne, tt = xe, vt = ke;
          function kt(jt) {
            var Vt, Kt, rr = De.apply(this, arguments), Tr = jt.length, yr = rr.length, pr = new Array(yr);
            for (Vt = 0; Vt < yr; ++Vt) {
              for (var lr, _r = rr[Vt], $r = pr[Vt] = new Array(Tr), Ar = 0; Ar < Tr; ++Ar) $r[Ar] = lr = [0, +vt(jt[Ar], _r, Ar, jt)], lr.data = jt[Ar];
              $r.key = _r;
            }
            for (Vt = 0, Kt = Je(pr); Vt < yr; ++Vt) pr[Kt[Vt]].index = Vt;
            return tt(pr, Kt), pr;
          }
          return kt.keys = function(jt) {
            return arguments.length ? (De = typeof jt == "function" ? jt : o(q.call(jt)), kt) : De;
          }, kt.value = function(jt) {
            return arguments.length ? (vt = typeof jt == "function" ? jt : o(+jt), kt) : vt;
          }, kt.order = function(jt) {
            return arguments.length ? (Je = jt == null ? Ne : typeof jt == "function" ? jt : o(q.call(jt)), kt) : Je;
          }, kt.offset = function(jt) {
            return arguments.length ? (tt = jt ?? xe, kt) : tt;
          }, kt;
        }, n.stackOffsetDiverging = function(De, Je) {
          if ((Kt = De.length) > 0) for (var tt, vt, kt, jt, Vt, Kt, rr = 0, Tr = De[Je[0]].length; rr < Tr; ++rr) for (jt = Vt = 0, tt = 0; tt < Kt; ++tt) (kt = (vt = De[Je[tt]][rr])[1] - vt[0]) > 0 ? (vt[0] = jt, vt[1] = jt += kt) : kt < 0 ? (vt[1] = Vt, vt[0] = Vt += kt) : (vt[0] = 0, vt[1] = kt);
        }, n.stackOffsetExpand = function(De, Je) {
          if ((vt = De.length) > 0) {
            for (var tt, vt, kt, jt = 0, Vt = De[0].length; jt < Vt; ++jt) {
              for (kt = tt = 0; tt < vt; ++tt) kt += De[tt][jt][1] || 0;
              if (kt) for (tt = 0; tt < vt; ++tt) De[tt][jt][1] /= kt;
            }
            xe(De, Je);
          }
        }, n.stackOffsetNone = xe, n.stackOffsetSilhouette = function(De, Je) {
          if ((tt = De.length) > 0) {
            for (var tt, vt = 0, kt = De[Je[0]], jt = kt.length; vt < jt; ++vt) {
              for (var Vt = 0, Kt = 0; Vt < tt; ++Vt) Kt += De[Vt][vt][1] || 0;
              kt[vt][1] += kt[vt][0] = -Kt / 2;
            }
            xe(De, Je);
          }
        }, n.stackOffsetWiggle = function(De, Je) {
          if ((kt = De.length) > 0 && (vt = (tt = De[Je[0]]).length) > 0) {
            for (var tt, vt, kt, jt = 0, Vt = 1; Vt < vt; ++Vt) {
              for (var Kt = 0, rr = 0, Tr = 0; Kt < kt; ++Kt) {
                for (var yr = De[Je[Kt]], pr = yr[Vt][1] || 0, lr = (pr - (yr[Vt - 1][1] || 0)) / 2, _r = 0; _r < Kt; ++_r) {
                  var $r = De[Je[_r]];
                  lr += ($r[Vt][1] || 0) - ($r[Vt - 1][1] || 0);
                }
                rr += pr, Tr += lr * pr;
              }
              tt[Vt - 1][1] += tt[Vt - 1][0] = jt, rr && (jt -= Tr / rr);
            }
            tt[Vt - 1][1] += tt[Vt - 1][0] = jt, xe(De, Je);
          }
        }, n.stackOrderAppearance = Me, n.stackOrderAscending = ze, n.stackOrderDescending = function(De) {
          return ze(De).reverse();
        }, n.stackOrderInsideOut = function(De) {
          var Je, tt, vt = De.length, kt = De.map(ft), jt = Me(De), Vt = 0, Kt = 0, rr = [], Tr = [];
          for (Je = 0; Je < vt; ++Je) tt = jt[Je], Vt < Kt ? (Vt += kt[tt], rr.push(tt)) : (Kt += kt[tt], Tr.push(tt));
          return Tr.reverse().concat(rr);
        }, n.stackOrderNone = Ne, n.stackOrderReverse = function(De) {
          return Ne(De).reverse();
        }, n.symbol = function() {
          var De = o(Q2), Je = o(64), tt = null;
          function vt() {
            var kt;
            if (tt || (tt = kt = a.path()), De.apply(this, arguments).draw(tt, +Je.apply(this, arguments)), kt) return tt = null, kt + "" || null;
          }
          return vt.type = function(kt) {
            return arguments.length ? (De = typeof kt == "function" ? kt : o(kt), vt) : De;
          }, vt.size = function(kt) {
            return arguments.length ? (Je = typeof kt == "function" ? kt : o(+kt), vt) : Je;
          }, vt.context = function(kt) {
            return arguments.length ? (tt = kt ?? null, vt) : tt;
          }, vt;
        }, n.symbolCircle = Q2, n.symbolCross = Z2, n.symbolDiamond = ue, n.symbolSquare = me, n.symbolStar = he, n.symbolTriangle = be, n.symbolWye = Se, n.symbols = Ce, Object.defineProperty(n, "__esModule", { value: true });
      });
    }, { "d3-path": 117 }], 120: [function(e, t, r) {
      (function(n, a) {
        typeof r == "object" && t !== void 0 ? a(r, e("d3-time")) : a((n = n || self).d3 = n.d3 || {}, n.d3);
      })(this, function(n, a) {
        "use strict";
        function o(yt) {
          if (0 <= yt.y && yt.y < 100) {
            var pt = new Date(-1, yt.m, yt.d, yt.H, yt.M, yt.S, yt.L);
            return pt.setFullYear(yt.y), pt;
          }
          return new Date(yt.y, yt.m, yt.d, yt.H, yt.M, yt.S, yt.L);
        }
        function s(yt) {
          if (0 <= yt.y && yt.y < 100) {
            var pt = new Date(Date.UTC(-1, yt.m, yt.d, yt.H, yt.M, yt.S, yt.L));
            return pt.setUTCFullYear(yt.y), pt;
          }
          return new Date(Date.UTC(yt.y, yt.m, yt.d, yt.H, yt.M, yt.S, yt.L));
        }
        function i(yt, pt, Ot) {
          return { y: yt, m: pt, d: Ot, H: 0, M: 0, S: 0, L: 0 };
        }
        function l(yt) {
          var pt = yt.dateTime, Ot = yt.date, Jt = yt.time, tr = yt.periods, Ye = yt.days, at = yt.shortDays, Ge = yt.months, st = yt.shortMonths, Ie = m(tr), Pe = g(tr), $e = m(Ye), Ve = g(Ye), ut = m(at), Re = g(at), qe = m(Ge), je = g(Ge), rt = m(st), He = g(st), xe = { a: function(ft) {
            return at[ft.getDay()];
          }, A: function(ft) {
            return Ye[ft.getDay()];
          }, b: function(ft) {
            return st[ft.getMonth()];
          }, B: function(ft) {
            return Ge[ft.getMonth()];
          }, c: null, d: Y2, e: Y2, f: z, H: K2, I: q, j: re, L: R2, m: H2, M: te, p: function(ft) {
            return tr[+(ft.getHours() >= 12)];
          }, q: function(ft) {
            return 1 + ~~(ft.getMonth() / 3);
          }, Q: mt, s: wt, S: j, u: Q2, U: Z2, V: ne, w: ae, W: ue, x: null, X: null, y: le, Y: ce, Z: se, "%": ot }, Ne = { a: function(ft) {
            return at[ft.getUTCDay()];
          }, A: function(ft) {
            return Ye[ft.getUTCDay()];
          }, b: function(ft) {
            return st[ft.getUTCMonth()];
          }, B: function(ft) {
            return Ge[ft.getUTCMonth()];
          }, c: null, d: he, e: he, f: pe, H: me, I: we, j: be, L: Ae, m: ve, M: Ee, p: function(ft) {
            return tr[+(ft.getUTCHours() >= 12)];
          }, q: function(ft) {
            return 1 + ~~(ft.getUTCMonth() / 3);
          }, Q: mt, s: wt, S: Se, u: Ce, U: Be, V: Ue, w: Ke, W: ct, x: null, X: null, y: We, Y: Ze, Z: it, "%": ot }, ke = { a: function(ft, De, Je) {
            var tt = ut.exec(De.slice(Je));
            return tt ? (ft.w = Re[tt[0].toLowerCase()], Je + tt[0].length) : -1;
          }, A: function(ft, De, Je) {
            var tt = $e.exec(De.slice(Je));
            return tt ? (ft.w = Ve[tt[0].toLowerCase()], Je + tt[0].length) : -1;
          }, b: function(ft, De, Je) {
            var tt = rt.exec(De.slice(Je));
            return tt ? (ft.m = He[tt[0].toLowerCase()], Je + tt[0].length) : -1;
          }, B: function(ft, De, Je) {
            var tt = qe.exec(De.slice(Je));
            return tt ? (ft.m = je[tt[0].toLowerCase()], Je + tt[0].length) : -1;
          }, c: function(ft, De, Je) {
            return ze(ft, pt, De, Je);
          }, d: E2, e: E2, f: L2, H: N2, I: N2, j: F13, L: O2, m: C2, M: D2, p: function(ft, De, Je) {
            var tt = Ie.exec(De.slice(Je));
            return tt ? (ft.p = Pe[tt[0].toLowerCase()], Je + tt[0].length) : -1;
          }, q: S2, Q: W2, s: X2, S: I2, u: b, U: y, V: w, w: x, W: _4, x: function(ft, De, Je) {
            return ze(ft, Ot, De, Je);
          }, X: function(ft, De, Je) {
            return ze(ft, Jt, De, Je);
          }, y: T2, Y: k, Z: A2, "%": V2 };
          function Me(ft, De) {
            return function(Je) {
              var tt, vt, kt, jt = [], Vt = -1, Kt = 0, rr = ft.length;
              for (Je instanceof Date || (Je = /* @__PURE__ */ new Date(+Je)); ++Vt < rr; ) ft.charCodeAt(Vt) === 37 && (jt.push(ft.slice(Kt, Vt)), (vt = c[tt = ft.charAt(++Vt)]) != null ? tt = ft.charAt(++Vt) : vt = tt === "e" ? " " : "0", (kt = De[tt]) && (tt = kt(Je, vt)), jt.push(tt), Kt = Vt + 1);
              return jt.push(ft.slice(Kt, Vt)), jt.join("");
            };
          }
          function Le(ft, De) {
            return function(Je) {
              var tt, vt, kt = i(1900, void 0, 1);
              if (ze(kt, ft, Je += "", 0) != Je.length) return null;
              if ("Q" in kt) return new Date(kt.Q);
              if ("s" in kt) return new Date(1e3 * kt.s + ("L" in kt ? kt.L : 0));
              if (De && !("Z" in kt) && (kt.Z = 0), "p" in kt && (kt.H = kt.H % 12 + 12 * kt.p), kt.m === void 0 && (kt.m = "q" in kt ? kt.q : 0), "V" in kt) {
                if (kt.V < 1 || kt.V > 53) return null;
                "w" in kt || (kt.w = 1), "Z" in kt ? (vt = (tt = s(i(kt.y, 0, 1))).getUTCDay(), tt = vt > 4 || vt === 0 ? a.utcMonday.ceil(tt) : a.utcMonday(tt), tt = a.utcDay.offset(tt, 7 * (kt.V - 1)), kt.y = tt.getUTCFullYear(), kt.m = tt.getUTCMonth(), kt.d = tt.getUTCDate() + (kt.w + 6) % 7) : (vt = (tt = o(i(kt.y, 0, 1))).getDay(), tt = vt > 4 || vt === 0 ? a.timeMonday.ceil(tt) : a.timeMonday(tt), tt = a.timeDay.offset(tt, 7 * (kt.V - 1)), kt.y = tt.getFullYear(), kt.m = tt.getMonth(), kt.d = tt.getDate() + (kt.w + 6) % 7);
              } else ("W" in kt || "U" in kt) && ("w" in kt || (kt.w = "u" in kt ? kt.u % 7 : "W" in kt ? 1 : 0), vt = "Z" in kt ? s(i(kt.y, 0, 1)).getUTCDay() : o(i(kt.y, 0, 1)).getDay(), kt.m = 0, kt.d = "W" in kt ? (kt.w + 6) % 7 + 7 * kt.W - (vt + 5) % 7 : kt.w + 7 * kt.U - (vt + 6) % 7);
              return "Z" in kt ? (kt.H += kt.Z / 100 | 0, kt.M += kt.Z % 100, s(kt)) : o(kt);
            };
          }
          function ze(ft, De, Je, tt) {
            for (var vt, kt, jt = 0, Vt = De.length, Kt = Je.length; jt < Vt; ) {
              if (tt >= Kt) return -1;
              if ((vt = De.charCodeAt(jt++)) === 37) {
                if (vt = De.charAt(jt++), !(kt = ke[vt in c ? De.charAt(jt++) : vt]) || (tt = kt(ft, Je, tt)) < 0) return -1;
              } else if (vt != Je.charCodeAt(tt++)) return -1;
            }
            return tt;
          }
          return xe.x = Me(Ot, xe), xe.X = Me(Jt, xe), xe.c = Me(pt, xe), Ne.x = Me(Ot, Ne), Ne.X = Me(Jt, Ne), Ne.c = Me(pt, Ne), { format: function(ft) {
            var De = Me(ft += "", xe);
            return De.toString = function() {
              return ft;
            }, De;
          }, parse: function(ft) {
            var De = Le(ft += "", false);
            return De.toString = function() {
              return ft;
            }, De;
          }, utcFormat: function(ft) {
            var De = Me(ft += "", Ne);
            return De.toString = function() {
              return ft;
            }, De;
          }, utcParse: function(ft) {
            var De = Le(ft += "", true);
            return De.toString = function() {
              return ft;
            }, De;
          } };
        }
        var u2, c = { "-": "", _: " ", 0: "0" }, f = /^\s*\d+/, h = /^%/, p = /[\\^$*+?|[\]().{}]/g;
        function d(yt, pt, Ot) {
          var Jt = yt < 0 ? "-" : "", tr = (Jt ? -yt : yt) + "", Ye = tr.length;
          return Jt + (Ye < Ot ? new Array(Ot - Ye + 1).join(pt) + tr : tr);
        }
        function v(yt) {
          return yt.replace(p, "\\$&");
        }
        function m(yt) {
          return new RegExp("^(?:" + yt.map(v).join("|") + ")", "i");
        }
        function g(yt) {
          for (var pt = {}, Ot = -1, Jt = yt.length; ++Ot < Jt; ) pt[yt[Ot].toLowerCase()] = Ot;
          return pt;
        }
        function x(yt, pt, Ot) {
          var Jt = f.exec(pt.slice(Ot, Ot + 1));
          return Jt ? (yt.w = +Jt[0], Ot + Jt[0].length) : -1;
        }
        function b(yt, pt, Ot) {
          var Jt = f.exec(pt.slice(Ot, Ot + 1));
          return Jt ? (yt.u = +Jt[0], Ot + Jt[0].length) : -1;
        }
        function y(yt, pt, Ot) {
          var Jt = f.exec(pt.slice(Ot, Ot + 2));
          return Jt ? (yt.U = +Jt[0], Ot + Jt[0].length) : -1;
        }
        function w(yt, pt, Ot) {
          var Jt = f.exec(pt.slice(Ot, Ot + 2));
          return Jt ? (yt.V = +Jt[0], Ot + Jt[0].length) : -1;
        }
        function _4(yt, pt, Ot) {
          var Jt = f.exec(pt.slice(Ot, Ot + 2));
          return Jt ? (yt.W = +Jt[0], Ot + Jt[0].length) : -1;
        }
        function k(yt, pt, Ot) {
          var Jt = f.exec(pt.slice(Ot, Ot + 4));
          return Jt ? (yt.y = +Jt[0], Ot + Jt[0].length) : -1;
        }
        function T2(yt, pt, Ot) {
          var Jt = f.exec(pt.slice(Ot, Ot + 2));
          return Jt ? (yt.y = +Jt[0] + (+Jt[0] > 68 ? 1900 : 2e3), Ot + Jt[0].length) : -1;
        }
        function A2(yt, pt, Ot) {
          var Jt = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(pt.slice(Ot, Ot + 6));
          return Jt ? (yt.Z = Jt[1] ? 0 : -(Jt[2] + (Jt[3] || "00")), Ot + Jt[0].length) : -1;
        }
        function S2(yt, pt, Ot) {
          var Jt = f.exec(pt.slice(Ot, Ot + 1));
          return Jt ? (yt.q = 3 * Jt[0] - 3, Ot + Jt[0].length) : -1;
        }
        function C2(yt, pt, Ot) {
          var Jt = f.exec(pt.slice(Ot, Ot + 2));
          return Jt ? (yt.m = Jt[0] - 1, Ot + Jt[0].length) : -1;
        }
        function E2(yt, pt, Ot) {
          var Jt = f.exec(pt.slice(Ot, Ot + 2));
          return Jt ? (yt.d = +Jt[0], Ot + Jt[0].length) : -1;
        }
        function F13(yt, pt, Ot) {
          var Jt = f.exec(pt.slice(Ot, Ot + 3));
          return Jt ? (yt.m = 0, yt.d = +Jt[0], Ot + Jt[0].length) : -1;
        }
        function N2(yt, pt, Ot) {
          var Jt = f.exec(pt.slice(Ot, Ot + 2));
          return Jt ? (yt.H = +Jt[0], Ot + Jt[0].length) : -1;
        }
        function D2(yt, pt, Ot) {
          var Jt = f.exec(pt.slice(Ot, Ot + 2));
          return Jt ? (yt.M = +Jt[0], Ot + Jt[0].length) : -1;
        }
        function I2(yt, pt, Ot) {
          var Jt = f.exec(pt.slice(Ot, Ot + 2));
          return Jt ? (yt.S = +Jt[0], Ot + Jt[0].length) : -1;
        }
        function O2(yt, pt, Ot) {
          var Jt = f.exec(pt.slice(Ot, Ot + 3));
          return Jt ? (yt.L = +Jt[0], Ot + Jt[0].length) : -1;
        }
        function L2(yt, pt, Ot) {
          var Jt = f.exec(pt.slice(Ot, Ot + 6));
          return Jt ? (yt.L = Math.floor(Jt[0] / 1e3), Ot + Jt[0].length) : -1;
        }
        function V2(yt, pt, Ot) {
          var Jt = h.exec(pt.slice(Ot, Ot + 1));
          return Jt ? Ot + Jt[0].length : -1;
        }
        function W2(yt, pt, Ot) {
          var Jt = f.exec(pt.slice(Ot));
          return Jt ? (yt.Q = +Jt[0], Ot + Jt[0].length) : -1;
        }
        function X2(yt, pt, Ot) {
          var Jt = f.exec(pt.slice(Ot));
          return Jt ? (yt.s = +Jt[0], Ot + Jt[0].length) : -1;
        }
        function Y2(yt, pt) {
          return d(yt.getDate(), pt, 2);
        }
        function K2(yt, pt) {
          return d(yt.getHours(), pt, 2);
        }
        function q(yt, pt) {
          return d(yt.getHours() % 12 || 12, pt, 2);
        }
        function re(yt, pt) {
          return d(1 + a.timeDay.count(a.timeYear(yt), yt), pt, 3);
        }
        function R2(yt, pt) {
          return d(yt.getMilliseconds(), pt, 3);
        }
        function z(yt, pt) {
          return R2(yt, pt) + "000";
        }
        function H2(yt, pt) {
          return d(yt.getMonth() + 1, pt, 2);
        }
        function te(yt, pt) {
          return d(yt.getMinutes(), pt, 2);
        }
        function j(yt, pt) {
          return d(yt.getSeconds(), pt, 2);
        }
        function Q2(yt) {
          var pt = yt.getDay();
          return pt === 0 ? 7 : pt;
        }
        function Z2(yt, pt) {
          return d(a.timeSunday.count(a.timeYear(yt) - 1, yt), pt, 2);
        }
        function ne(yt, pt) {
          var Ot = yt.getDay();
          return yt = Ot >= 4 || Ot === 0 ? a.timeThursday(yt) : a.timeThursday.ceil(yt), d(a.timeThursday.count(a.timeYear(yt), yt) + (a.timeYear(yt).getDay() === 4), pt, 2);
        }
        function ae(yt) {
          return yt.getDay();
        }
        function ue(yt, pt) {
          return d(a.timeMonday.count(a.timeYear(yt) - 1, yt), pt, 2);
        }
        function le(yt, pt) {
          return d(yt.getFullYear() % 100, pt, 2);
        }
        function ce(yt, pt) {
          return d(yt.getFullYear() % 1e4, pt, 4);
        }
        function se(yt) {
          var pt = yt.getTimezoneOffset();
          return (pt > 0 ? "-" : (pt *= -1, "+")) + d(pt / 60 | 0, "0", 2) + d(pt % 60, "0", 2);
        }
        function he(yt, pt) {
          return d(yt.getUTCDate(), pt, 2);
        }
        function me(yt, pt) {
          return d(yt.getUTCHours(), pt, 2);
        }
        function we(yt, pt) {
          return d(yt.getUTCHours() % 12 || 12, pt, 2);
        }
        function be(yt, pt) {
          return d(1 + a.utcDay.count(a.utcYear(yt), yt), pt, 3);
        }
        function Ae(yt, pt) {
          return d(yt.getUTCMilliseconds(), pt, 3);
        }
        function pe(yt, pt) {
          return Ae(yt, pt) + "000";
        }
        function ve(yt, pt) {
          return d(yt.getUTCMonth() + 1, pt, 2);
        }
        function Ee(yt, pt) {
          return d(yt.getUTCMinutes(), pt, 2);
        }
        function Se(yt, pt) {
          return d(yt.getUTCSeconds(), pt, 2);
        }
        function Ce(yt) {
          var pt = yt.getUTCDay();
          return pt === 0 ? 7 : pt;
        }
        function Be(yt, pt) {
          return d(a.utcSunday.count(a.utcYear(yt) - 1, yt), pt, 2);
        }
        function Ue(yt, pt) {
          var Ot = yt.getUTCDay();
          return yt = Ot >= 4 || Ot === 0 ? a.utcThursday(yt) : a.utcThursday.ceil(yt), d(a.utcThursday.count(a.utcYear(yt), yt) + (a.utcYear(yt).getUTCDay() === 4), pt, 2);
        }
        function Ke(yt) {
          return yt.getUTCDay();
        }
        function ct(yt, pt) {
          return d(a.utcMonday.count(a.utcYear(yt) - 1, yt), pt, 2);
        }
        function We(yt, pt) {
          return d(yt.getUTCFullYear() % 100, pt, 2);
        }
        function Ze(yt, pt) {
          return d(yt.getUTCFullYear() % 1e4, pt, 4);
        }
        function it() {
          return "+0000";
        }
        function ot() {
          return "%";
        }
        function mt(yt) {
          return +yt;
        }
        function wt(yt) {
          return Math.floor(+yt / 1e3);
        }
        function Et(yt) {
          return u2 = l(yt), n.timeFormat = u2.format, n.timeParse = u2.parse, n.utcFormat = u2.utcFormat, n.utcParse = u2.utcParse, u2;
        }
        Et({ dateTime: "%x, %X", date: "%-m/%-d/%Y", time: "%-I:%M:%S %p", periods: ["AM", "PM"], days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] });
        var zt = Date.prototype.toISOString ? function(yt) {
          return yt.toISOString();
        } : n.utcFormat("%Y-%m-%dT%H:%M:%S.%LZ"), Nt = +/* @__PURE__ */ new Date("2000-01-01T00:00:00.000Z") ? function(yt) {
          var pt = new Date(yt);
          return isNaN(pt) ? null : pt;
        } : n.utcParse("%Y-%m-%dT%H:%M:%S.%LZ");
        n.isoFormat = zt, n.isoParse = Nt, n.timeFormatDefaultLocale = Et, n.timeFormatLocale = l, Object.defineProperty(n, "__esModule", { value: true });
      });
    }, { "d3-time": 121 }], 121: [function(e, t, r) {
      (function(n, a) {
        a(typeof r == "object" && t !== void 0 ? r : (n = n || self).d3 = n.d3 || {});
      })(this, function(n) {
        "use strict";
        var a = /* @__PURE__ */ new Date(), o = /* @__PURE__ */ new Date();
        function s(ve, Ee, Se, Ce) {
          function Be(Ue) {
            return ve(Ue = arguments.length === 0 ? /* @__PURE__ */ new Date() : /* @__PURE__ */ new Date(+Ue)), Ue;
          }
          return Be.floor = function(Ue) {
            return ve(Ue = /* @__PURE__ */ new Date(+Ue)), Ue;
          }, Be.ceil = function(Ue) {
            return ve(Ue = new Date(Ue - 1)), Ee(Ue, 1), ve(Ue), Ue;
          }, Be.round = function(Ue) {
            var Ke = Be(Ue), ct = Be.ceil(Ue);
            return Ue - Ke < ct - Ue ? Ke : ct;
          }, Be.offset = function(Ue, Ke) {
            return Ee(Ue = /* @__PURE__ */ new Date(+Ue), Ke == null ? 1 : Math.floor(Ke)), Ue;
          }, Be.range = function(Ue, Ke, ct) {
            var We, Ze = [];
            if (Ue = Be.ceil(Ue), ct = ct == null ? 1 : Math.floor(ct), !(Ue < Ke && ct > 0)) return Ze;
            do
              Ze.push(We = /* @__PURE__ */ new Date(+Ue)), Ee(Ue, ct), ve(Ue);
            while (We < Ue && Ue < Ke);
            return Ze;
          }, Be.filter = function(Ue) {
            return s(function(Ke) {
              if (Ke >= Ke) for (; ve(Ke), !Ue(Ke); ) Ke.setTime(Ke - 1);
            }, function(Ke, ct) {
              if (Ke >= Ke) if (ct < 0) for (; ++ct <= 0; ) for (; Ee(Ke, -1), !Ue(Ke); ) ;
              else for (; --ct >= 0; ) for (; Ee(Ke, 1), !Ue(Ke); ) ;
            });
          }, Se && (Be.count = function(Ue, Ke) {
            return a.setTime(+Ue), o.setTime(+Ke), ve(a), ve(o), Math.floor(Se(a, o));
          }, Be.every = function(Ue) {
            return Ue = Math.floor(Ue), isFinite(Ue) && Ue > 0 ? Ue > 1 ? Be.filter(Ce ? function(Ke) {
              return Ce(Ke) % Ue == 0;
            } : function(Ke) {
              return Be.count(0, Ke) % Ue == 0;
            }) : Be : null;
          }), Be;
        }
        var i = s(function() {
        }, function(ve, Ee) {
          ve.setTime(+ve + Ee);
        }, function(ve, Ee) {
          return Ee - ve;
        });
        i.every = function(ve) {
          return ve = Math.floor(ve), isFinite(ve) && ve > 0 ? ve > 1 ? s(function(Ee) {
            Ee.setTime(Math.floor(Ee / ve) * ve);
          }, function(Ee, Se) {
            Ee.setTime(+Ee + Se * ve);
          }, function(Ee, Se) {
            return (Se - Ee) / ve;
          }) : i : null;
        };
        var l = i.range, u2 = s(function(ve) {
          ve.setTime(ve - ve.getMilliseconds());
        }, function(ve, Ee) {
          ve.setTime(+ve + 1e3 * Ee);
        }, function(ve, Ee) {
          return (Ee - ve) / 1e3;
        }, function(ve) {
          return ve.getUTCSeconds();
        }), c = u2.range, f = s(function(ve) {
          ve.setTime(ve - ve.getMilliseconds() - 1e3 * ve.getSeconds());
        }, function(ve, Ee) {
          ve.setTime(+ve + 6e4 * Ee);
        }, function(ve, Ee) {
          return (Ee - ve) / 6e4;
        }, function(ve) {
          return ve.getMinutes();
        }), h = f.range, p = s(function(ve) {
          ve.setTime(ve - ve.getMilliseconds() - 1e3 * ve.getSeconds() - 6e4 * ve.getMinutes());
        }, function(ve, Ee) {
          ve.setTime(+ve + 36e5 * Ee);
        }, function(ve, Ee) {
          return (Ee - ve) / 36e5;
        }, function(ve) {
          return ve.getHours();
        }), d = p.range, v = s(function(ve) {
          ve.setHours(0, 0, 0, 0);
        }, function(ve, Ee) {
          ve.setDate(ve.getDate() + Ee);
        }, function(ve, Ee) {
          return (Ee - ve - 6e4 * (Ee.getTimezoneOffset() - ve.getTimezoneOffset())) / 864e5;
        }, function(ve) {
          return ve.getDate() - 1;
        }), m = v.range;
        function g(ve) {
          return s(function(Ee) {
            Ee.setDate(Ee.getDate() - (Ee.getDay() + 7 - ve) % 7), Ee.setHours(0, 0, 0, 0);
          }, function(Ee, Se) {
            Ee.setDate(Ee.getDate() + 7 * Se);
          }, function(Ee, Se) {
            return (Se - Ee - 6e4 * (Se.getTimezoneOffset() - Ee.getTimezoneOffset())) / 6048e5;
          });
        }
        var x = g(0), b = g(1), y = g(2), w = g(3), _4 = g(4), k = g(5), T2 = g(6), A2 = x.range, S2 = b.range, C2 = y.range, E2 = w.range, F13 = _4.range, N2 = k.range, D2 = T2.range, I2 = s(function(ve) {
          ve.setDate(1), ve.setHours(0, 0, 0, 0);
        }, function(ve, Ee) {
          ve.setMonth(ve.getMonth() + Ee);
        }, function(ve, Ee) {
          return Ee.getMonth() - ve.getMonth() + 12 * (Ee.getFullYear() - ve.getFullYear());
        }, function(ve) {
          return ve.getMonth();
        }), O2 = I2.range, L2 = s(function(ve) {
          ve.setMonth(0, 1), ve.setHours(0, 0, 0, 0);
        }, function(ve, Ee) {
          ve.setFullYear(ve.getFullYear() + Ee);
        }, function(ve, Ee) {
          return Ee.getFullYear() - ve.getFullYear();
        }, function(ve) {
          return ve.getFullYear();
        });
        L2.every = function(ve) {
          return isFinite(ve = Math.floor(ve)) && ve > 0 ? s(function(Ee) {
            Ee.setFullYear(Math.floor(Ee.getFullYear() / ve) * ve), Ee.setMonth(0, 1), Ee.setHours(0, 0, 0, 0);
          }, function(Ee, Se) {
            Ee.setFullYear(Ee.getFullYear() + Se * ve);
          }) : null;
        };
        var V2 = L2.range, W2 = s(function(ve) {
          ve.setUTCSeconds(0, 0);
        }, function(ve, Ee) {
          ve.setTime(+ve + 6e4 * Ee);
        }, function(ve, Ee) {
          return (Ee - ve) / 6e4;
        }, function(ve) {
          return ve.getUTCMinutes();
        }), X2 = W2.range, Y2 = s(function(ve) {
          ve.setUTCMinutes(0, 0, 0);
        }, function(ve, Ee) {
          ve.setTime(+ve + 36e5 * Ee);
        }, function(ve, Ee) {
          return (Ee - ve) / 36e5;
        }, function(ve) {
          return ve.getUTCHours();
        }), K2 = Y2.range, q = s(function(ve) {
          ve.setUTCHours(0, 0, 0, 0);
        }, function(ve, Ee) {
          ve.setUTCDate(ve.getUTCDate() + Ee);
        }, function(ve, Ee) {
          return (Ee - ve) / 864e5;
        }, function(ve) {
          return ve.getUTCDate() - 1;
        }), re = q.range;
        function R2(ve) {
          return s(function(Ee) {
            Ee.setUTCDate(Ee.getUTCDate() - (Ee.getUTCDay() + 7 - ve) % 7), Ee.setUTCHours(0, 0, 0, 0);
          }, function(Ee, Se) {
            Ee.setUTCDate(Ee.getUTCDate() + 7 * Se);
          }, function(Ee, Se) {
            return (Se - Ee) / 6048e5;
          });
        }
        var z = R2(0), H2 = R2(1), te = R2(2), j = R2(3), Q2 = R2(4), Z2 = R2(5), ne = R2(6), ae = z.range, ue = H2.range, le = te.range, ce = j.range, se = Q2.range, he = Z2.range, me = ne.range, we = s(function(ve) {
          ve.setUTCDate(1), ve.setUTCHours(0, 0, 0, 0);
        }, function(ve, Ee) {
          ve.setUTCMonth(ve.getUTCMonth() + Ee);
        }, function(ve, Ee) {
          return Ee.getUTCMonth() - ve.getUTCMonth() + 12 * (Ee.getUTCFullYear() - ve.getUTCFullYear());
        }, function(ve) {
          return ve.getUTCMonth();
        }), be = we.range, Ae = s(function(ve) {
          ve.setUTCMonth(0, 1), ve.setUTCHours(0, 0, 0, 0);
        }, function(ve, Ee) {
          ve.setUTCFullYear(ve.getUTCFullYear() + Ee);
        }, function(ve, Ee) {
          return Ee.getUTCFullYear() - ve.getUTCFullYear();
        }, function(ve) {
          return ve.getUTCFullYear();
        });
        Ae.every = function(ve) {
          return isFinite(ve = Math.floor(ve)) && ve > 0 ? s(function(Ee) {
            Ee.setUTCFullYear(Math.floor(Ee.getUTCFullYear() / ve) * ve), Ee.setUTCMonth(0, 1), Ee.setUTCHours(0, 0, 0, 0);
          }, function(Ee, Se) {
            Ee.setUTCFullYear(Ee.getUTCFullYear() + Se * ve);
          }) : null;
        };
        var pe = Ae.range;
        n.timeDay = v, n.timeDays = m, n.timeFriday = k, n.timeFridays = N2, n.timeHour = p, n.timeHours = d, n.timeInterval = s, n.timeMillisecond = i, n.timeMilliseconds = l, n.timeMinute = f, n.timeMinutes = h, n.timeMonday = b, n.timeMondays = S2, n.timeMonth = I2, n.timeMonths = O2, n.timeSaturday = T2, n.timeSaturdays = D2, n.timeSecond = u2, n.timeSeconds = c, n.timeSunday = x, n.timeSundays = A2, n.timeThursday = _4, n.timeThursdays = F13, n.timeTuesday = y, n.timeTuesdays = C2, n.timeWednesday = w, n.timeWednesdays = E2, n.timeWeek = x, n.timeWeeks = A2, n.timeYear = L2, n.timeYears = V2, n.utcDay = q, n.utcDays = re, n.utcFriday = Z2, n.utcFridays = he, n.utcHour = Y2, n.utcHours = K2, n.utcMillisecond = i, n.utcMilliseconds = l, n.utcMinute = W2, n.utcMinutes = X2, n.utcMonday = H2, n.utcMondays = ue, n.utcMonth = we, n.utcMonths = be, n.utcSaturday = ne, n.utcSaturdays = me, n.utcSecond = u2, n.utcSeconds = c, n.utcSunday = z, n.utcSundays = ae, n.utcThursday = Q2, n.utcThursdays = se, n.utcTuesday = te, n.utcTuesdays = le, n.utcWednesday = j, n.utcWednesdays = ce, n.utcWeek = z, n.utcWeeks = ae, n.utcYear = Ae, n.utcYears = pe, Object.defineProperty(n, "__esModule", { value: true });
      });
    }, {}], 122: [function(e, t, r) {
      arguments[4][121][0].apply(r, arguments);
    }, { dup: 121 }], 123: [function(e, t, r) {
      (function(n, a) {
        a(typeof r == "object" && t !== void 0 ? r : (n = n || self).d3 = n.d3 || {});
      })(this, function(n) {
        "use strict";
        var a, o, s = 0, i = 0, l = 0, u2 = 0, c = 0, f = 0, h = typeof performance == "object" && performance.now ? performance : Date, p = typeof window == "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(_4) {
          setTimeout(_4, 17);
        };
        function d() {
          return c || (p(v), c = h.now() + f);
        }
        function v() {
          c = 0;
        }
        function m() {
          this._call = this._time = this._next = null;
        }
        function g(_4, k, T2) {
          var A2 = new m();
          return A2.restart(_4, k, T2), A2;
        }
        function x() {
          d(), ++s;
          for (var _4, k = a; k; ) (_4 = c - k._time) >= 0 && k._call.call(null, _4), k = k._next;
          --s;
        }
        function b() {
          c = (u2 = h.now()) + f, s = i = 0;
          try {
            x();
          } finally {
            s = 0, function() {
              for (var _4, k, T2 = a, A2 = 1 / 0; T2; ) T2._call ? (A2 > T2._time && (A2 = T2._time), _4 = T2, T2 = T2._next) : (k = T2._next, T2._next = null, T2 = _4 ? _4._next = k : a = k);
              o = _4, w(A2);
            }(), c = 0;
          }
        }
        function y() {
          var _4 = h.now(), k = _4 - u2;
          k > 1e3 && (f -= k, u2 = _4);
        }
        function w(_4) {
          s || (i && (i = clearTimeout(i)), _4 - c > 24 ? (_4 < 1 / 0 && (i = setTimeout(b, _4 - h.now() - f)), l && (l = clearInterval(l))) : (l || (u2 = h.now(), l = setInterval(y, 1e3)), s = 1, p(b)));
        }
        m.prototype = g.prototype = { constructor: m, restart: function(_4, k, T2) {
          if (typeof _4 != "function") throw new TypeError("callback is not a function");
          T2 = (T2 == null ? d() : +T2) + (k == null ? 0 : +k), this._next || o === this || (o ? o._next = this : a = this, o = this), this._call = _4, this._time = T2, w();
        }, stop: function() {
          this._call && (this._call = null, this._time = 1 / 0, w());
        } }, n.interval = function(_4, k, T2) {
          var A2 = new m(), S2 = k;
          return k == null ? (A2.restart(_4, k, T2), A2) : (k = +k, T2 = T2 == null ? d() : +T2, A2.restart(function C2(E2) {
            E2 += S2, A2.restart(C2, S2 += k, T2), _4(E2);
          }, k, T2), A2);
        }, n.now = d, n.timeout = function(_4, k, T2) {
          var A2 = new m();
          return k = k == null ? 0 : +k, A2.restart(function(S2) {
            A2.stop(), _4(S2 + k);
          }, k, T2), A2;
        }, n.timer = g, n.timerFlush = x, Object.defineProperty(n, "__esModule", { value: true });
      });
    }, {}], 124: [function(e, t, r) {
      t.exports = function() {
        for (var n = 0; n < arguments.length; n++) if (arguments[n] !== void 0) return arguments[n];
      };
    }, {}], 125: [function(e, t, r) {
      "use strict";
      t.exports = o;
      var n = (o.canvas = document.createElement("canvas")).getContext("2d"), a = s([32, 126]);
      function o(i, l) {
        Array.isArray(i) && (i = i.join(", "));
        var u2, c = {}, f = 16, h = 0.05;
        l && (l.length === 2 && typeof l[0] == "number" ? u2 = s(l) : Array.isArray(l) ? u2 = l : (l.o ? u2 = s(l.o) : l.pairs && (u2 = l.pairs), l.fontSize && (f = l.fontSize), l.threshold != null && (h = l.threshold))), u2 || (u2 = a), n.font = f + "px " + i;
        for (var p = 0; p < u2.length; p++) {
          var d = u2[p], v = n.measureText(d[0]).width + n.measureText(d[1]).width, m = n.measureText(d).width;
          if (Math.abs(v - m) > f * h) {
            var g = (m - v) / f;
            c[d] = 1e3 * g;
          }
        }
        return c;
      }
      function s(i) {
        for (var l = [], u2 = i[0]; u2 <= i[1]; u2++) for (var c = String.fromCharCode(u2), f = i[0]; f < i[1]; f++) {
          var h = c + String.fromCharCode(f);
          l.push(h);
        }
        return l;
      }
      o.createPairs = s, o.ascii = a;
    }, {}], 126: [function(e, t, r) {
      var n = e("abs-svg-path"), a = e("normalize-svg-path"), o = { M: "moveTo", C: "bezierCurveTo" };
      t.exports = function(s, i) {
        s.beginPath(), a(n(i)).forEach(function(l) {
          var u2 = l[0], c = l.slice(1);
          s[o[u2]].apply(s, c);
        }), s.closePath();
      };
    }, { "abs-svg-path": 70, "normalize-svg-path": 246 }], 127: [function(e, t, r) {
      t.exports = function(n) {
        switch (n) {
          case "int8":
            return Int8Array;
          case "int16":
            return Int16Array;
          case "int32":
            return Int32Array;
          case "uint8":
            return Uint8Array;
          case "uint16":
            return Uint16Array;
          case "uint32":
            return Uint32Array;
          case "float32":
            return Float32Array;
          case "float64":
            return Float64Array;
          case "array":
            return Array;
          case "uint8_clamped":
            return Uint8ClampedArray;
        }
      };
    }, {}], 128: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a) {
        switch (a === void 0 && (a = 0), typeof n) {
          case "number":
            if (n > 0) return function(o, s) {
              var i, l;
              for (i = new Array(o), l = 0; l < o; ++l) i[l] = s;
              return i;
            }(0 | n, a);
            break;
          case "object":
            if (typeof n.length == "number") return function o(s, i, l) {
              var u2 = 0 | s[l];
              if (u2 <= 0) return [];
              var c, f = new Array(u2);
              if (l === s.length - 1) for (c = 0; c < u2; ++c) f[c] = i;
              else for (c = 0; c < u2; ++c) f[c] = o(s, i, l + 1);
              return f;
            }(n, a, 0);
        }
        return [];
      };
    }, {}], 129: [function(e, t, r) {
      "use strict";
      function n(F13, N2, D2) {
        D2 = D2 || 2;
        var I2, O2, L2, V2, W2, X2, Y2, K2 = N2 && N2.length, q = K2 ? N2[0] * D2 : F13.length, re = a(F13, 0, q, D2, true), R2 = [];
        if (!re || re.next === re.prev) return R2;
        if (K2 && (re = function(H2, te, j, Q2) {
          var Z2, ne, ae, ue, le, ce = [];
          for (Z2 = 0, ne = te.length; Z2 < ne; Z2++) ae = te[Z2] * Q2, ue = Z2 < ne - 1 ? te[Z2 + 1] * Q2 : H2.length, (le = a(H2, ae, ue, Q2, false)) === le.next && (le.steiner = true), ce.push(v(le));
          for (ce.sort(f), Z2 = 0; Z2 < ce.length; Z2++) h(ce[Z2], j), j = o(j, j.next);
          return j;
        }(F13, N2, re, D2)), F13.length > 80 * D2) {
          I2 = L2 = F13[0], O2 = V2 = F13[1];
          for (var z = D2; z < q; z += D2) (W2 = F13[z]) < I2 && (I2 = W2), (X2 = F13[z + 1]) < O2 && (O2 = X2), W2 > L2 && (L2 = W2), X2 > V2 && (V2 = X2);
          Y2 = (Y2 = Math.max(L2 - I2, V2 - O2)) !== 0 ? 1 / Y2 : 0;
        }
        return s(re, R2, D2, I2, O2, Y2), R2;
      }
      function a(F13, N2, D2, I2, O2) {
        var L2, V2;
        if (O2 === E2(F13, N2, D2, I2) > 0) for (L2 = N2; L2 < D2; L2 += I2) V2 = A2(L2, F13[L2], F13[L2 + 1], V2);
        else for (L2 = D2 - I2; L2 >= N2; L2 -= I2) V2 = A2(L2, F13[L2], F13[L2 + 1], V2);
        return V2 && b(V2, V2.next) && (S2(V2), V2 = V2.next), V2;
      }
      function o(F13, N2) {
        if (!F13) return F13;
        N2 || (N2 = F13);
        var D2, I2 = F13;
        do
          if (D2 = false, I2.steiner || !b(I2, I2.next) && x(I2.prev, I2, I2.next) !== 0) I2 = I2.next;
          else {
            if (S2(I2), (I2 = N2 = I2.prev) === I2.next) break;
            D2 = true;
          }
        while (D2 || I2 !== N2);
        return N2;
      }
      function s(F13, N2, D2, I2, O2, L2, V2) {
        if (F13) {
          !V2 && L2 && function(K2, q, re, R2) {
            var z = K2;
            do
              z.z === null && (z.z = d(z.x, z.y, q, re, R2)), z.prevZ = z.prev, z.nextZ = z.next, z = z.next;
            while (z !== K2);
            z.prevZ.nextZ = null, z.prevZ = null, function(H2) {
              var te, j, Q2, Z2, ne, ae, ue, le, ce = 1;
              do {
                for (j = H2, H2 = null, ne = null, ae = 0; j; ) {
                  for (ae++, Q2 = j, ue = 0, te = 0; te < ce && (ue++, Q2 = Q2.nextZ); te++) ;
                  for (le = ce; ue > 0 || le > 0 && Q2; ) ue !== 0 && (le === 0 || !Q2 || j.z <= Q2.z) ? (Z2 = j, j = j.nextZ, ue--) : (Z2 = Q2, Q2 = Q2.nextZ, le--), ne ? ne.nextZ = Z2 : H2 = Z2, Z2.prevZ = ne, ne = Z2;
                  j = Q2;
                }
                ne.nextZ = null, ce *= 2;
              } while (ae > 1);
            }(z);
          }(F13, I2, O2, L2);
          for (var W2, X2, Y2 = F13; F13.prev !== F13.next; ) if (W2 = F13.prev, X2 = F13.next, L2 ? l(F13, I2, O2, L2) : i(F13)) N2.push(W2.i / D2), N2.push(F13.i / D2), N2.push(X2.i / D2), S2(F13), F13 = X2.next, Y2 = X2.next;
          else if ((F13 = X2) === Y2) {
            V2 ? V2 === 1 ? s(F13 = u2(o(F13), N2, D2), N2, D2, I2, O2, L2, 2) : V2 === 2 && c(F13, N2, D2, I2, O2, L2) : s(o(F13), N2, D2, I2, O2, L2, 1);
            break;
          }
        }
      }
      function i(F13) {
        var N2 = F13.prev, D2 = F13, I2 = F13.next;
        if (x(N2, D2, I2) >= 0) return false;
        for (var O2 = F13.next.next; O2 !== F13.prev; ) {
          if (m(N2.x, N2.y, D2.x, D2.y, I2.x, I2.y, O2.x, O2.y) && x(O2.prev, O2, O2.next) >= 0) return false;
          O2 = O2.next;
        }
        return true;
      }
      function l(F13, N2, D2, I2) {
        var O2 = F13.prev, L2 = F13, V2 = F13.next;
        if (x(O2, L2, V2) >= 0) return false;
        for (var W2 = O2.x < L2.x ? O2.x < V2.x ? O2.x : V2.x : L2.x < V2.x ? L2.x : V2.x, X2 = O2.y < L2.y ? O2.y < V2.y ? O2.y : V2.y : L2.y < V2.y ? L2.y : V2.y, Y2 = O2.x > L2.x ? O2.x > V2.x ? O2.x : V2.x : L2.x > V2.x ? L2.x : V2.x, K2 = O2.y > L2.y ? O2.y > V2.y ? O2.y : V2.y : L2.y > V2.y ? L2.y : V2.y, q = d(W2, X2, N2, D2, I2), re = d(Y2, K2, N2, D2, I2), R2 = F13.prevZ, z = F13.nextZ; R2 && R2.z >= q && z && z.z <= re; ) {
          if (R2 !== F13.prev && R2 !== F13.next && m(O2.x, O2.y, L2.x, L2.y, V2.x, V2.y, R2.x, R2.y) && x(R2.prev, R2, R2.next) >= 0 || (R2 = R2.prevZ, z !== F13.prev && z !== F13.next && m(O2.x, O2.y, L2.x, L2.y, V2.x, V2.y, z.x, z.y) && x(z.prev, z, z.next) >= 0)) return false;
          z = z.nextZ;
        }
        for (; R2 && R2.z >= q; ) {
          if (R2 !== F13.prev && R2 !== F13.next && m(O2.x, O2.y, L2.x, L2.y, V2.x, V2.y, R2.x, R2.y) && x(R2.prev, R2, R2.next) >= 0) return false;
          R2 = R2.prevZ;
        }
        for (; z && z.z <= re; ) {
          if (z !== F13.prev && z !== F13.next && m(O2.x, O2.y, L2.x, L2.y, V2.x, V2.y, z.x, z.y) && x(z.prev, z, z.next) >= 0) return false;
          z = z.nextZ;
        }
        return true;
      }
      function u2(F13, N2, D2) {
        var I2 = F13;
        do {
          var O2 = I2.prev, L2 = I2.next.next;
          !b(O2, L2) && y(O2, I2, I2.next, L2) && k(O2, L2) && k(L2, O2) && (N2.push(O2.i / D2), N2.push(I2.i / D2), N2.push(L2.i / D2), S2(I2), S2(I2.next), I2 = F13 = L2), I2 = I2.next;
        } while (I2 !== F13);
        return o(I2);
      }
      function c(F13, N2, D2, I2, O2, L2) {
        var V2 = F13;
        do {
          for (var W2 = V2.next.next; W2 !== V2.prev; ) {
            if (V2.i !== W2.i && g(V2, W2)) {
              var X2 = T2(V2, W2);
              return V2 = o(V2, V2.next), X2 = o(X2, X2.next), s(V2, N2, D2, I2, O2, L2), void s(X2, N2, D2, I2, O2, L2);
            }
            W2 = W2.next;
          }
          V2 = V2.next;
        } while (V2 !== F13);
      }
      function f(F13, N2) {
        return F13.x - N2.x;
      }
      function h(F13, N2) {
        if (N2 = function(I2, O2) {
          var L2, V2 = O2, W2 = I2.x, X2 = I2.y, Y2 = -1 / 0;
          do {
            if (X2 <= V2.y && X2 >= V2.next.y && V2.next.y !== V2.y) {
              var K2 = V2.x + (X2 - V2.y) * (V2.next.x - V2.x) / (V2.next.y - V2.y);
              if (K2 <= W2 && K2 > Y2) {
                if (Y2 = K2, K2 === W2) {
                  if (X2 === V2.y) return V2;
                  if (X2 === V2.next.y) return V2.next;
                }
                L2 = V2.x < V2.next.x ? V2 : V2.next;
              }
            }
            V2 = V2.next;
          } while (V2 !== O2);
          if (!L2) return null;
          if (W2 === Y2) return L2;
          var q, re = L2, R2 = L2.x, z = L2.y, H2 = 1 / 0;
          V2 = L2;
          do
            W2 >= V2.x && V2.x >= R2 && W2 !== V2.x && m(X2 < z ? W2 : Y2, X2, R2, z, X2 < z ? Y2 : W2, X2, V2.x, V2.y) && (q = Math.abs(X2 - V2.y) / (W2 - V2.x), k(V2, I2) && (q < H2 || q === H2 && (V2.x > L2.x || V2.x === L2.x && p(L2, V2))) && (L2 = V2, H2 = q)), V2 = V2.next;
          while (V2 !== re);
          return L2;
        }(F13, N2)) {
          var D2 = T2(N2, F13);
          o(N2, N2.next), o(D2, D2.next);
        }
      }
      function p(F13, N2) {
        return x(F13.prev, F13, N2.prev) < 0 && x(N2.next, F13, F13.next) < 0;
      }
      function d(F13, N2, D2, I2, O2) {
        return (F13 = 1431655765 & ((F13 = 858993459 & ((F13 = 252645135 & ((F13 = 16711935 & ((F13 = 32767 * (F13 - D2) * O2) | F13 << 8)) | F13 << 4)) | F13 << 2)) | F13 << 1)) | (N2 = 1431655765 & ((N2 = 858993459 & ((N2 = 252645135 & ((N2 = 16711935 & ((N2 = 32767 * (N2 - I2) * O2) | N2 << 8)) | N2 << 4)) | N2 << 2)) | N2 << 1)) << 1;
      }
      function v(F13) {
        var N2 = F13, D2 = F13;
        do
          (N2.x < D2.x || N2.x === D2.x && N2.y < D2.y) && (D2 = N2), N2 = N2.next;
        while (N2 !== F13);
        return D2;
      }
      function m(F13, N2, D2, I2, O2, L2, V2, W2) {
        return (O2 - V2) * (N2 - W2) - (F13 - V2) * (L2 - W2) >= 0 && (F13 - V2) * (I2 - W2) - (D2 - V2) * (N2 - W2) >= 0 && (D2 - V2) * (L2 - W2) - (O2 - V2) * (I2 - W2) >= 0;
      }
      function g(F13, N2) {
        return F13.next.i !== N2.i && F13.prev.i !== N2.i && !function(D2, I2) {
          var O2 = D2;
          do {
            if (O2.i !== D2.i && O2.next.i !== D2.i && O2.i !== I2.i && O2.next.i !== I2.i && y(O2, O2.next, D2, I2)) return true;
            O2 = O2.next;
          } while (O2 !== D2);
          return false;
        }(F13, N2) && (k(F13, N2) && k(N2, F13) && function(D2, I2) {
          var O2 = D2, L2 = false, V2 = (D2.x + I2.x) / 2, W2 = (D2.y + I2.y) / 2;
          do
            O2.y > W2 != O2.next.y > W2 && O2.next.y !== O2.y && V2 < (O2.next.x - O2.x) * (W2 - O2.y) / (O2.next.y - O2.y) + O2.x && (L2 = !L2), O2 = O2.next;
          while (O2 !== D2);
          return L2;
        }(F13, N2) && (x(F13.prev, F13, N2.prev) || x(F13, N2.prev, N2)) || b(F13, N2) && x(F13.prev, F13, F13.next) > 0 && x(N2.prev, N2, N2.next) > 0);
      }
      function x(F13, N2, D2) {
        return (N2.y - F13.y) * (D2.x - N2.x) - (N2.x - F13.x) * (D2.y - N2.y);
      }
      function b(F13, N2) {
        return F13.x === N2.x && F13.y === N2.y;
      }
      function y(F13, N2, D2, I2) {
        var O2 = _4(x(F13, N2, D2)), L2 = _4(x(F13, N2, I2)), V2 = _4(x(D2, I2, F13)), W2 = _4(x(D2, I2, N2));
        return O2 !== L2 && V2 !== W2 || !(O2 !== 0 || !w(F13, D2, N2)) || !(L2 !== 0 || !w(F13, I2, N2)) || !(V2 !== 0 || !w(D2, F13, I2)) || !(W2 !== 0 || !w(D2, N2, I2));
      }
      function w(F13, N2, D2) {
        return N2.x <= Math.max(F13.x, D2.x) && N2.x >= Math.min(F13.x, D2.x) && N2.y <= Math.max(F13.y, D2.y) && N2.y >= Math.min(F13.y, D2.y);
      }
      function _4(F13) {
        return F13 > 0 ? 1 : F13 < 0 ? -1 : 0;
      }
      function k(F13, N2) {
        return x(F13.prev, F13, F13.next) < 0 ? x(F13, N2, F13.next) >= 0 && x(F13, F13.prev, N2) >= 0 : x(F13, N2, F13.prev) < 0 || x(F13, F13.next, N2) < 0;
      }
      function T2(F13, N2) {
        var D2 = new C2(F13.i, F13.x, F13.y), I2 = new C2(N2.i, N2.x, N2.y), O2 = F13.next, L2 = N2.prev;
        return F13.next = N2, N2.prev = F13, D2.next = O2, O2.prev = D2, I2.next = D2, D2.prev = I2, L2.next = I2, I2.prev = L2, I2;
      }
      function A2(F13, N2, D2, I2) {
        var O2 = new C2(F13, N2, D2);
        return I2 ? (O2.next = I2.next, O2.prev = I2, I2.next.prev = O2, I2.next = O2) : (O2.prev = O2, O2.next = O2), O2;
      }
      function S2(F13) {
        F13.next.prev = F13.prev, F13.prev.next = F13.next, F13.prevZ && (F13.prevZ.nextZ = F13.nextZ), F13.nextZ && (F13.nextZ.prevZ = F13.prevZ);
      }
      function C2(F13, N2, D2) {
        this.i = F13, this.x = N2, this.y = D2, this.prev = null, this.next = null, this.z = null, this.prevZ = null, this.nextZ = null, this.steiner = false;
      }
      function E2(F13, N2, D2, I2) {
        for (var O2 = 0, L2 = N2, V2 = D2 - I2; L2 < D2; L2 += I2) O2 += (F13[V2] - F13[L2]) * (F13[L2 + 1] + F13[V2 + 1]), V2 = L2;
        return O2;
      }
      t.exports = n, t.exports.default = n, n.deviation = function(F13, N2, D2, I2) {
        var O2 = N2 && N2.length, L2 = O2 ? N2[0] * D2 : F13.length, V2 = Math.abs(E2(F13, 0, L2, D2));
        if (O2) for (var W2 = 0, X2 = N2.length; W2 < X2; W2++) {
          var Y2 = N2[W2] * D2, K2 = W2 < X2 - 1 ? N2[W2 + 1] * D2 : F13.length;
          V2 -= Math.abs(E2(F13, Y2, K2, D2));
        }
        var q = 0;
        for (W2 = 0; W2 < I2.length; W2 += 3) {
          var re = I2[W2] * D2, R2 = I2[W2 + 1] * D2, z = I2[W2 + 2] * D2;
          q += Math.abs((F13[re] - F13[z]) * (F13[R2 + 1] - F13[re + 1]) - (F13[re] - F13[R2]) * (F13[z + 1] - F13[re + 1]));
        }
        return V2 === 0 && q === 0 ? 0 : Math.abs((q - V2) / V2);
      }, n.flatten = function(F13) {
        for (var N2 = F13[0][0].length, D2 = { vertices: [], holes: [], dimensions: N2 }, I2 = 0, O2 = 0; O2 < F13.length; O2++) {
          for (var L2 = 0; L2 < F13[O2].length; L2++) for (var V2 = 0; V2 < N2; V2++) D2.vertices.push(F13[O2][L2][V2]);
          O2 > 0 && (I2 += F13[O2 - 1].length, D2.holes.push(I2));
        }
        return D2;
      };
    }, {}], 130: [function(e, t, r) {
      var n = e("strongly-connected-components");
      t.exports = function(a, o) {
        var s, i = [], l = [], u2 = [], c = {}, f = [];
        function h(y) {
          var w, _4, k = false;
          for (l.push(y), u2[y] = true, w = 0; w < f[y].length; w++) (_4 = f[y][w]) === s ? (p(s, l), k = true) : u2[_4] || (k = h(_4));
          if (k) (function A2(S2) {
            u2[S2] = false, c.hasOwnProperty(S2) && Object.keys(c[S2]).forEach(function(C2) {
              delete c[S2][C2], u2[C2] && A2(C2);
            });
          })(y);
          else for (w = 0; w < f[y].length; w++) {
            _4 = f[y][w];
            var T2 = c[_4];
            T2 || (T2 = {}, c[_4] = T2), T2[_4] = true;
          }
          return l.pop(), k;
        }
        function p(y, w) {
          var _4 = [].concat(w).concat(y);
          o ? o(h) : i.push(_4);
        }
        function d(y) {
          (function(C2) {
            for (var E2 = 0; E2 < a.length; E2++) E2 < C2 && (a[E2] = []), a[E2] = a[E2].filter(function(F13) {
              return F13 >= C2;
            });
          })(y);
          for (var w, _4 = n(a).components.filter(function(C2) {
            return C2.length > 1;
          }), k = 1 / 0, T2 = 0; T2 < _4.length; T2++) for (var A2 = 0; A2 < _4[T2].length; A2++) _4[T2][A2] < k && (k = _4[T2][A2], w = T2);
          var S2 = _4[w];
          return !!S2 && { leastVertex: k, adjList: a.map(function(C2, E2) {
            return S2.indexOf(E2) === -1 ? [] : C2.filter(function(F13) {
              return S2.indexOf(F13) !== -1;
            });
          }) };
        }
        s = 0;
        for (var v = a.length; s < v; ) {
          var m = d(s);
          if (s = m.leastVertex, f = m.adjList) {
            for (var g = 0; g < f.length; g++) for (var x = 0; x < f[g].length; x++) {
              var b = f[g][x];
              u2[+b] = false, c[b] = {};
            }
            h(s), s += 1;
          } else s = v;
        }
        return o ? void 0 : i;
      };
    }, { "strongly-connected-components": 306 }], 131: [function(e, t, r) {
      "use strict";
      var n = e("../../object/valid-value");
      t.exports = function() {
        return n(this).length = 0, this;
      };
    }, { "../../object/valid-value": 162 }], 132: [function(e, t, r) {
      "use strict";
      t.exports = e("./is-implemented")() ? Array.from : e("./shim");
    }, { "./is-implemented": 133, "./shim": 134 }], 133: [function(e, t, r) {
      "use strict";
      t.exports = function() {
        var n, a, o = Array.from;
        return typeof o == "function" && (a = o(n = ["raz", "dwa"]), Boolean(a && a !== n && a[1] === "dwa"));
      };
    }, {}], 134: [function(e, t, r) {
      "use strict";
      var n = e("es6-symbol").iterator, a = e("../../function/is-arguments"), o = e("../../function/is-function"), s = e("../../number/to-pos-integer"), i = e("../../object/valid-callable"), l = e("../../object/valid-value"), u2 = e("../../object/is-value"), c = e("../../string/is-string"), f = Array.isArray, h = Function.prototype.call, p = { configurable: true, enumerable: true, writable: true, value: null }, d = Object.defineProperty;
      t.exports = function(v) {
        var m, g, x, b, y, w, _4, k, T2, A2, S2 = arguments[1], C2 = arguments[2];
        if (v = Object(l(v)), u2(S2) && i(S2), this && this !== Array && o(this)) m = this;
        else {
          if (!S2) {
            if (a(v)) return (y = v.length) !== 1 ? Array.apply(null, v) : ((b = new Array(1))[0] = v[0], b);
            if (f(v)) {
              for (b = new Array(y = v.length), g = 0; g < y; ++g) b[g] = v[g];
              return b;
            }
          }
          b = [];
        }
        if (!f(v)) {
          if ((T2 = v[n]) !== void 0) {
            for (_4 = i(T2).call(v), m && (b = new m()), k = _4.next(), g = 0; !k.done; ) A2 = S2 ? h.call(S2, C2, k.value, g) : k.value, m ? (p.value = A2, d(b, g, p)) : b[g] = A2, k = _4.next(), ++g;
            y = g;
          } else if (c(v)) {
            for (y = v.length, m && (b = new m()), g = 0, x = 0; g < y; ++g) A2 = v[g], g + 1 < y && (w = A2.charCodeAt(0)) >= 55296 && w <= 56319 && (A2 += v[++g]), A2 = S2 ? h.call(S2, C2, A2, x) : A2, m ? (p.value = A2, d(b, x, p)) : b[x] = A2, ++x;
            y = x;
          }
        }
        if (y === void 0) for (y = s(v.length), m && (b = new m(y)), g = 0; g < y; ++g) A2 = S2 ? h.call(S2, C2, v[g], g) : v[g], m ? (p.value = A2, d(b, g, p)) : b[g] = A2;
        return m && (p.value = null, b.length = y), b;
      };
    }, { "../../function/is-arguments": 135, "../../function/is-function": 136, "../../number/to-pos-integer": 142, "../../object/is-value": 151, "../../object/valid-callable": 160, "../../object/valid-value": 162, "../../string/is-string": 166, "es6-symbol": 175 }], 135: [function(e, t, r) {
      "use strict";
      var n = Object.prototype.toString, a = n.call(/* @__PURE__ */ function() {
        return arguments;
      }());
      t.exports = function(o) {
        return n.call(o) === a;
      };
    }, {}], 136: [function(e, t, r) {
      "use strict";
      var n = Object.prototype.toString, a = RegExp.prototype.test.bind(/^[object [A-Za-z0-9]*Function]$/);
      t.exports = function(o) {
        return typeof o == "function" && a(n.call(o));
      };
    }, {}], 137: [function(e, t, r) {
      "use strict";
      t.exports = function() {
      };
    }, {}], 138: [function(e, t, r) {
      "use strict";
      t.exports = e("./is-implemented")() ? Math.sign : e("./shim");
    }, { "./is-implemented": 139, "./shim": 140 }], 139: [function(e, t, r) {
      "use strict";
      t.exports = function() {
        var n = Math.sign;
        return typeof n == "function" && n(10) === 1 && n(-20) === -1;
      };
    }, {}], 140: [function(e, t, r) {
      "use strict";
      t.exports = function(n) {
        return n = Number(n), isNaN(n) || n === 0 ? n : n > 0 ? 1 : -1;
      };
    }, {}], 141: [function(e, t, r) {
      "use strict";
      var n = e("../math/sign"), a = Math.abs, o = Math.floor;
      t.exports = function(s) {
        return isNaN(s) ? 0 : (s = Number(s)) !== 0 && isFinite(s) ? n(s) * o(a(s)) : s;
      };
    }, { "../math/sign": 138 }], 142: [function(e, t, r) {
      "use strict";
      var n = e("./to-integer"), a = Math.max;
      t.exports = function(o) {
        return a(0, n(o));
      };
    }, { "./to-integer": 141 }], 143: [function(e, t, r) {
      "use strict";
      var n = e("./valid-callable"), a = e("./valid-value"), o = Function.prototype.bind, s = Function.prototype.call, i = Object.keys, l = Object.prototype.propertyIsEnumerable;
      t.exports = function(u2, c) {
        return function(f, h) {
          var p, d = arguments[2], v = arguments[3];
          return f = Object(a(f)), n(h), p = i(f), v && p.sort(typeof v == "function" ? o.call(v, f) : void 0), typeof u2 != "function" && (u2 = p[u2]), s.call(u2, p, function(m, g) {
            return l.call(f, m) ? s.call(h, d, f[m], m, f, g) : c;
          });
        };
      };
    }, { "./valid-callable": 160, "./valid-value": 162 }], 144: [function(e, t, r) {
      "use strict";
      t.exports = e("./is-implemented")() ? Object.assign : e("./shim");
    }, { "./is-implemented": 145, "./shim": 146 }], 145: [function(e, t, r) {
      "use strict";
      t.exports = function() {
        var n, a = Object.assign;
        return typeof a == "function" && (a(n = { foo: "raz" }, { bar: "dwa" }, { trzy: "trzy" }), n.foo + n.bar + n.trzy === "razdwatrzy");
      };
    }, {}], 146: [function(e, t, r) {
      "use strict";
      var n = e("../keys"), a = e("../valid-value"), o = Math.max;
      t.exports = function(s, i) {
        var l, u2, c, f = o(arguments.length, 2);
        for (s = Object(a(s)), c = function(h) {
          try {
            s[h] = i[h];
          } catch (p) {
            l || (l = p);
          }
        }, u2 = 1; u2 < f; ++u2) n(i = arguments[u2]).forEach(c);
        if (l !== void 0) throw l;
        return s;
      };
    }, { "../keys": 152, "../valid-value": 162 }], 147: [function(e, t, r) {
      "use strict";
      var n = e("../array/from"), a = e("./assign"), o = e("./valid-value");
      t.exports = function(s) {
        var i = Object(o(s)), l = arguments[1], u2 = Object(arguments[2]);
        if (i !== s && !l) return i;
        var c = {};
        return l ? n(l, function(f) {
          (u2.ensure || f in s) && (c[f] = s[f]);
        }) : a(c, s), c;
      };
    }, { "../array/from": 132, "./assign": 144, "./valid-value": 162 }], 148: [function(e, t, r) {
      "use strict";
      var n, a, o, s, i = Object.create;
      e("./set-prototype-of/is-implemented")() || (n = e("./set-prototype-of/shim")), t.exports = n ? n.level !== 1 ? i : (a = {}, o = {}, s = { configurable: false, enumerable: false, writable: true, value: void 0 }, Object.getOwnPropertyNames(Object.prototype).forEach(function(l) {
        o[l] = l !== "__proto__" ? s : { configurable: true, enumerable: false, writable: true, value: void 0 };
      }), Object.defineProperties(a, o), Object.defineProperty(n, "nullPolyfill", { configurable: false, enumerable: false, writable: false, value: a }), function(l, u2) {
        return i(l === null ? a : l, u2);
      }) : i;
    }, { "./set-prototype-of/is-implemented": 158, "./set-prototype-of/shim": 159 }], 149: [function(e, t, r) {
      "use strict";
      t.exports = e("./_iterate")("forEach");
    }, { "./_iterate": 143 }], 150: [function(e, t, r) {
      "use strict";
      var n = e("./is-value"), a = { function: true, object: true };
      t.exports = function(o) {
        return n(o) && a[typeof o] || false;
      };
    }, { "./is-value": 151 }], 151: [function(e, t, r) {
      "use strict";
      var n = e("../function/noop")();
      t.exports = function(a) {
        return a !== n && a !== null;
      };
    }, { "../function/noop": 137 }], 152: [function(e, t, r) {
      "use strict";
      t.exports = e("./is-implemented")() ? Object.keys : e("./shim");
    }, { "./is-implemented": 153, "./shim": 154 }], 153: [function(e, t, r) {
      "use strict";
      t.exports = function() {
        try {
          return Object.keys("primitive"), true;
        } catch {
          return false;
        }
      };
    }, {}], 154: [function(e, t, r) {
      "use strict";
      var n = e("../is-value"), a = Object.keys;
      t.exports = function(o) {
        return a(n(o) ? Object(o) : o);
      };
    }, { "../is-value": 151 }], 155: [function(e, t, r) {
      "use strict";
      var n = e("./valid-callable"), a = e("./for-each"), o = Function.prototype.call;
      t.exports = function(s, i) {
        var l = {}, u2 = arguments[2];
        return n(i), a(s, function(c, f, h, p) {
          l[f] = o.call(i, u2, c, f, h, p);
        }), l;
      };
    }, { "./for-each": 149, "./valid-callable": 160 }], 156: [function(e, t, r) {
      "use strict";
      var n = e("./is-value"), a = Array.prototype.forEach, o = Object.create, s = function(i, l) {
        var u2;
        for (u2 in i) l[u2] = i[u2];
      };
      t.exports = function(i) {
        var l = o(null);
        return a.call(arguments, function(u2) {
          n(u2) && s(Object(u2), l);
        }), l;
      };
    }, { "./is-value": 151 }], 157: [function(e, t, r) {
      "use strict";
      t.exports = e("./is-implemented")() ? Object.setPrototypeOf : e("./shim");
    }, { "./is-implemented": 158, "./shim": 159 }], 158: [function(e, t, r) {
      "use strict";
      var n = Object.create, a = Object.getPrototypeOf, o = {};
      t.exports = function() {
        var s = Object.setPrototypeOf, i = arguments[0] || n;
        return typeof s == "function" && a(s(i(null), o)) === o;
      };
    }, {}], 159: [function(e, t, r) {
      "use strict";
      var n, a = e("../is-object"), o = e("../valid-value"), s = Object.prototype.isPrototypeOf, i = Object.defineProperty, l = { configurable: true, enumerable: false, writable: true, value: void 0 };
      n = function(u2, c) {
        if (o(u2), c === null || a(c)) return u2;
        throw new TypeError("Prototype must be null or an object");
      }, t.exports = function(u2) {
        var c, f;
        return u2 ? (u2.level === 2 ? u2.set ? (f = u2.set, c = function(h, p) {
          return f.call(n(h, p), p), h;
        }) : c = function(h, p) {
          return n(h, p).__proto__ = p, h;
        } : c = function h(p, d) {
          var v;
          return n(p, d), (v = s.call(h.nullPolyfill, p)) && delete h.nullPolyfill.__proto__, d === null && (d = h.nullPolyfill), p.__proto__ = d, v && i(h.nullPolyfill, "__proto__", l), p;
        }, Object.defineProperty(c, "level", { configurable: false, enumerable: false, writable: false, value: u2.level })) : null;
      }(function() {
        var u2, c = /* @__PURE__ */ Object.create(null), f = {}, h = Object.getOwnPropertyDescriptor(Object.prototype, "__proto__");
        if (h) {
          try {
            (u2 = h.set).call(c, f);
          } catch {
          }
          if (Object.getPrototypeOf(c) === f) return { set: u2, level: 2 };
        }
        return c.__proto__ = f, Object.getPrototypeOf(c) === f ? { level: 2 } : ((c = {}).__proto__ = f, Object.getPrototypeOf(c) === f && { level: 1 });
      }()), e("../create");
    }, { "../create": 148, "../is-object": 150, "../valid-value": 162 }], 160: [function(e, t, r) {
      "use strict";
      t.exports = function(n) {
        if (typeof n != "function") throw new TypeError(n + " is not a function");
        return n;
      };
    }, {}], 161: [function(e, t, r) {
      "use strict";
      var n = e("./is-object");
      t.exports = function(a) {
        if (!n(a)) throw new TypeError(a + " is not an Object");
        return a;
      };
    }, { "./is-object": 150 }], 162: [function(e, t, r) {
      "use strict";
      var n = e("./is-value");
      t.exports = function(a) {
        if (!n(a)) throw new TypeError("Cannot use null or undefined");
        return a;
      };
    }, { "./is-value": 151 }], 163: [function(e, t, r) {
      "use strict";
      t.exports = e("./is-implemented")() ? String.prototype.contains : e("./shim");
    }, { "./is-implemented": 164, "./shim": 165 }], 164: [function(e, t, r) {
      "use strict";
      var n = "razdwatrzy";
      t.exports = function() {
        return typeof n.contains == "function" && n.contains("dwa") === true && n.contains("foo") === false;
      };
    }, {}], 165: [function(e, t, r) {
      "use strict";
      var n = String.prototype.indexOf;
      t.exports = function(a) {
        return n.call(this, a, arguments[1]) > -1;
      };
    }, {}], 166: [function(e, t, r) {
      "use strict";
      var n = Object.prototype.toString, a = n.call("");
      t.exports = function(o) {
        return typeof o == "string" || o && typeof o == "object" && (o instanceof String || n.call(o) === a) || false;
      };
    }, {}], 167: [function(e, t, r) {
      "use strict";
      var n = /* @__PURE__ */ Object.create(null), a = Math.random;
      t.exports = function() {
        var o;
        do
          o = a().toString(36).slice(2);
        while (n[o]);
        return o;
      };
    }, {}], 168: [function(e, t, r) {
      "use strict";
      var n, a = e("es5-ext/object/set-prototype-of"), o = e("es5-ext/string/#/contains"), s = e("d"), i = e("es6-symbol"), l = e("./"), u2 = Object.defineProperty;
      n = t.exports = function(c, f) {
        if (!(this instanceof n)) throw new TypeError("Constructor requires 'new'");
        l.call(this, c), f = f ? o.call(f, "key+value") ? "key+value" : o.call(f, "key") ? "key" : "value" : "value", u2(this, "__kind__", s("", f));
      }, a && a(n, l), delete n.prototype.constructor, n.prototype = Object.create(l.prototype, { _resolve: s(function(c) {
        return this.__kind__ === "value" ? this.__list__[c] : this.__kind__ === "key+value" ? [c, this.__list__[c]] : c;
      }) }), u2(n.prototype, i.toStringTag, s("c", "Array Iterator"));
    }, { "./": 171, d: 106, "es5-ext/object/set-prototype-of": 157, "es5-ext/string/#/contains": 163, "es6-symbol": 175 }], 169: [function(e, t, r) {
      "use strict";
      var n = e("es5-ext/function/is-arguments"), a = e("es5-ext/object/valid-callable"), o = e("es5-ext/string/is-string"), s = e("./get"), i = Array.isArray, l = Function.prototype.call, u2 = Array.prototype.some;
      t.exports = function(c, f) {
        var h, p, d, v, m, g, x, b, y = arguments[2];
        if (i(c) || n(c) ? h = "array" : o(c) ? h = "string" : c = s(c), a(f), d = function() {
          v = true;
        }, h !== "array") if (h !== "string") for (p = c.next(); !p.done; ) {
          if (l.call(f, y, p.value, d), v) return;
          p = c.next();
        }
        else for (g = c.length, m = 0; m < g && (x = c[m], m + 1 < g && (b = x.charCodeAt(0)) >= 55296 && b <= 56319 && (x += c[++m]), l.call(f, y, x, d), !v); ++m) ;
        else u2.call(c, function(w) {
          return l.call(f, y, w, d), v;
        });
      };
    }, { "./get": 170, "es5-ext/function/is-arguments": 135, "es5-ext/object/valid-callable": 160, "es5-ext/string/is-string": 166 }], 170: [function(e, t, r) {
      "use strict";
      var n = e("es5-ext/function/is-arguments"), a = e("es5-ext/string/is-string"), o = e("./array"), s = e("./string"), i = e("./valid-iterable"), l = e("es6-symbol").iterator;
      t.exports = function(u2) {
        return typeof i(u2)[l] == "function" ? u2[l]() : n(u2) ? new o(u2) : a(u2) ? new s(u2) : new o(u2);
      };
    }, { "./array": 168, "./string": 173, "./valid-iterable": 174, "es5-ext/function/is-arguments": 135, "es5-ext/string/is-string": 166, "es6-symbol": 175 }], 171: [function(e, t, r) {
      "use strict";
      var n, a = e("es5-ext/array/#/clear"), o = e("es5-ext/object/assign"), s = e("es5-ext/object/valid-callable"), i = e("es5-ext/object/valid-value"), l = e("d"), u2 = e("d/auto-bind"), c = e("es6-symbol"), f = Object.defineProperty, h = Object.defineProperties;
      t.exports = n = function(p, d) {
        if (!(this instanceof n)) throw new TypeError("Constructor requires 'new'");
        h(this, { __list__: l("w", i(p)), __context__: l("w", d), __nextIndex__: l("w", 0) }), d && (s(d.on), d.on("_add", this._onAdd), d.on("_delete", this._onDelete), d.on("_clear", this._onClear));
      }, delete n.prototype.constructor, h(n.prototype, o({ _next: l(function() {
        var p;
        if (this.__list__) return this.__redo__ && (p = this.__redo__.shift()) !== void 0 ? p : this.__nextIndex__ < this.__list__.length ? this.__nextIndex__++ : void this._unBind();
      }), next: l(function() {
        return this._createResult(this._next());
      }), _createResult: l(function(p) {
        return p === void 0 ? { done: true, value: void 0 } : { done: false, value: this._resolve(p) };
      }), _resolve: l(function(p) {
        return this.__list__[p];
      }), _unBind: l(function() {
        this.__list__ = null, delete this.__redo__, this.__context__ && (this.__context__.off("_add", this._onAdd), this.__context__.off("_delete", this._onDelete), this.__context__.off("_clear", this._onClear), this.__context__ = null);
      }), toString: l(function() {
        return "[object " + (this[c.toStringTag] || "Object") + "]";
      }) }, u2({ _onAdd: l(function(p) {
        p >= this.__nextIndex__ || (++this.__nextIndex__, this.__redo__ ? (this.__redo__.forEach(function(d, v) {
          d >= p && (this.__redo__[v] = ++d);
        }, this), this.__redo__.push(p)) : f(this, "__redo__", l("c", [p])));
      }), _onDelete: l(function(p) {
        var d;
        p >= this.__nextIndex__ || (--this.__nextIndex__, this.__redo__ && ((d = this.__redo__.indexOf(p)) !== -1 && this.__redo__.splice(d, 1), this.__redo__.forEach(function(v, m) {
          v > p && (this.__redo__[m] = --v);
        }, this)));
      }), _onClear: l(function() {
        this.__redo__ && a.call(this.__redo__), this.__nextIndex__ = 0;
      }) }))), f(n.prototype, c.iterator, l(function() {
        return this;
      }));
    }, { d: 106, "d/auto-bind": 105, "es5-ext/array/#/clear": 131, "es5-ext/object/assign": 144, "es5-ext/object/valid-callable": 160, "es5-ext/object/valid-value": 162, "es6-symbol": 175 }], 172: [function(e, t, r) {
      "use strict";
      var n = e("es5-ext/function/is-arguments"), a = e("es5-ext/object/is-value"), o = e("es5-ext/string/is-string"), s = e("es6-symbol").iterator, i = Array.isArray;
      t.exports = function(l) {
        return !!a(l) && (!!i(l) || !!o(l) || !!n(l) || typeof l[s] == "function");
      };
    }, { "es5-ext/function/is-arguments": 135, "es5-ext/object/is-value": 151, "es5-ext/string/is-string": 166, "es6-symbol": 175 }], 173: [function(e, t, r) {
      "use strict";
      var n, a = e("es5-ext/object/set-prototype-of"), o = e("d"), s = e("es6-symbol"), i = e("./"), l = Object.defineProperty;
      n = t.exports = function(u2) {
        if (!(this instanceof n)) throw new TypeError("Constructor requires 'new'");
        u2 = String(u2), i.call(this, u2), l(this, "__length__", o("", u2.length));
      }, a && a(n, i), delete n.prototype.constructor, n.prototype = Object.create(i.prototype, { _next: o(function() {
        if (this.__list__) return this.__nextIndex__ < this.__length__ ? this.__nextIndex__++ : void this._unBind();
      }), _resolve: o(function(u2) {
        var c, f = this.__list__[u2];
        return this.__nextIndex__ === this.__length__ ? f : (c = f.charCodeAt(0)) >= 55296 && c <= 56319 ? f + this.__list__[this.__nextIndex__++] : f;
      }) }), l(n.prototype, s.toStringTag, o("c", "String Iterator"));
    }, { "./": 171, d: 106, "es5-ext/object/set-prototype-of": 157, "es6-symbol": 175 }], 174: [function(e, t, r) {
      "use strict";
      var n = e("./is-iterable");
      t.exports = function(a) {
        if (!n(a)) throw new TypeError(a + " is not iterable");
        return a;
      };
    }, { "./is-iterable": 172 }], 175: [function(e, t, r) {
      "use strict";
      t.exports = e("./is-implemented")() ? e("ext/global-this").Symbol : e("./polyfill");
    }, { "./is-implemented": 176, "./polyfill": 181, "ext/global-this": 188 }], 176: [function(e, t, r) {
      "use strict";
      var n = e("ext/global-this"), a = { object: true, symbol: true };
      t.exports = function() {
        var o, s = n.Symbol;
        if (typeof s != "function") return false;
        o = s("test symbol");
        try {
          String(o);
        } catch {
          return false;
        }
        return !!a[typeof s.iterator] && !!a[typeof s.toPrimitive] && !!a[typeof s.toStringTag];
      };
    }, { "ext/global-this": 188 }], 177: [function(e, t, r) {
      "use strict";
      t.exports = function(n) {
        return !!n && (typeof n == "symbol" || !!n.constructor && n.constructor.name === "Symbol" && n[n.constructor.toStringTag] === "Symbol");
      };
    }, {}], 178: [function(e, t, r) {
      "use strict";
      var n = e("d"), a = Object.create, o = Object.defineProperty, s = Object.prototype, i = a(null);
      t.exports = function(l) {
        for (var u2, c, f = 0; i[l + (f || "")]; ) ++f;
        return i[l += f || ""] = true, o(s, u2 = "@@" + l, n.gs(null, function(h) {
          c || (c = true, o(this, u2, n(h)), c = false);
        })), u2;
      };
    }, { d: 106 }], 179: [function(e, t, r) {
      "use strict";
      var n = e("d"), a = e("ext/global-this").Symbol;
      t.exports = function(o) {
        return Object.defineProperties(o, { hasInstance: n("", a && a.hasInstance || o("hasInstance")), isConcatSpreadable: n("", a && a.isConcatSpreadable || o("isConcatSpreadable")), iterator: n("", a && a.iterator || o("iterator")), match: n("", a && a.match || o("match")), replace: n("", a && a.replace || o("replace")), search: n("", a && a.search || o("search")), species: n("", a && a.species || o("species")), split: n("", a && a.split || o("split")), toPrimitive: n("", a && a.toPrimitive || o("toPrimitive")), toStringTag: n("", a && a.toStringTag || o("toStringTag")), unscopables: n("", a && a.unscopables || o("unscopables")) });
      };
    }, { d: 106, "ext/global-this": 188 }], 180: [function(e, t, r) {
      "use strict";
      var n = e("d"), a = e("../../../validate-symbol"), o = /* @__PURE__ */ Object.create(null);
      t.exports = function(s) {
        return Object.defineProperties(s, { for: n(function(i) {
          return o[i] ? o[i] : o[i] = s(String(i));
        }), keyFor: n(function(i) {
          var l;
          for (l in a(i), o) if (o[l] === i) return l;
        }) });
      };
    }, { "../../../validate-symbol": 182, d: 106 }], 181: [function(e, t, r) {
      "use strict";
      var n, a, o, s = e("d"), i = e("./validate-symbol"), l = e("ext/global-this").Symbol, u2 = e("./lib/private/generate-name"), c = e("./lib/private/setup/standard-symbols"), f = e("./lib/private/setup/symbol-registry"), h = Object.create, p = Object.defineProperties, d = Object.defineProperty;
      if (typeof l == "function") try {
        String(l()), o = true;
      } catch {
      }
      else l = null;
      a = function(v) {
        if (this instanceof a) throw new TypeError("Symbol is not a constructor");
        return n(v);
      }, t.exports = n = function v(m) {
        var g;
        if (this instanceof v) throw new TypeError("Symbol is not a constructor");
        return o ? l(m) : (g = h(a.prototype), m = m === void 0 ? "" : String(m), p(g, { __description__: s("", m), __name__: s("", u2(m)) }));
      }, c(n), f(n), p(a.prototype, { constructor: s(n), toString: s("", function() {
        return this.__name__;
      }) }), p(n.prototype, { toString: s(function() {
        return "Symbol (" + i(this).__description__ + ")";
      }), valueOf: s(function() {
        return i(this);
      }) }), d(n.prototype, n.toPrimitive, s("", function() {
        var v = i(this);
        return typeof v == "symbol" ? v : v.toString();
      })), d(n.prototype, n.toStringTag, s("c", "Symbol")), d(a.prototype, n.toStringTag, s("c", n.prototype[n.toStringTag])), d(a.prototype, n.toPrimitive, s("c", n.prototype[n.toPrimitive]));
    }, { "./lib/private/generate-name": 178, "./lib/private/setup/standard-symbols": 179, "./lib/private/setup/symbol-registry": 180, "./validate-symbol": 182, d: 106, "ext/global-this": 188 }], 182: [function(e, t, r) {
      "use strict";
      var n = e("./is-symbol");
      t.exports = function(a) {
        if (!n(a)) throw new TypeError(a + " is not a symbol");
        return a;
      };
    }, { "./is-symbol": 177 }], 183: [function(e, t, r) {
      "use strict";
      t.exports = e("./is-implemented")() ? WeakMap : e("./polyfill");
    }, { "./is-implemented": 184, "./polyfill": 186 }], 184: [function(e, t, r) {
      "use strict";
      t.exports = function() {
        var n, a;
        if (typeof WeakMap != "function") return false;
        try {
          n = new WeakMap([[a = {}, "one"], [{}, "two"], [{}, "three"]]);
        } catch {
          return false;
        }
        return String(n) === "[object WeakMap]" && typeof n.set == "function" && n.set({}, 1) === n && typeof n.delete == "function" && typeof n.has == "function" && n.get(a) === "one";
      };
    }, {}], 185: [function(e, t, r) {
      "use strict";
      t.exports = typeof WeakMap == "function" && Object.prototype.toString.call(/* @__PURE__ */ new WeakMap()) === "[object WeakMap]";
    }, {}], 186: [function(e, t, r) {
      "use strict";
      var n, a = e("es5-ext/object/is-value"), o = e("es5-ext/object/set-prototype-of"), s = e("es5-ext/object/valid-object"), i = e("es5-ext/object/valid-value"), l = e("es5-ext/string/random-uniq"), u2 = e("d"), c = e("es6-iterator/get"), f = e("es6-iterator/for-of"), h = e("es6-symbol").toStringTag, p = e("./is-native-implemented"), d = Array.isArray, v = Object.defineProperty, m = Object.prototype.hasOwnProperty, g = Object.getPrototypeOf;
      t.exports = n = function() {
        var x, b = arguments[0];
        if (!(this instanceof n)) throw new TypeError("Constructor requires 'new'");
        return x = p && o && WeakMap !== n ? o(/* @__PURE__ */ new WeakMap(), g(this)) : this, a(b) && (d(b) || (b = c(b))), v(x, "__weakMapData__", u2("c", "$weakMap$" + l())), b && f(b, function(y) {
          i(y), x.set(y[0], y[1]);
        }), x;
      }, p && (o && o(n, WeakMap), n.prototype = Object.create(WeakMap.prototype, { constructor: u2(n) })), Object.defineProperties(n.prototype, { delete: u2(function(x) {
        return !!m.call(s(x), this.__weakMapData__) && (delete x[this.__weakMapData__], true);
      }), get: u2(function(x) {
        if (m.call(s(x), this.__weakMapData__)) return x[this.__weakMapData__];
      }), has: u2(function(x) {
        return m.call(s(x), this.__weakMapData__);
      }), set: u2(function(x, b) {
        return v(s(x), this.__weakMapData__, u2("c", b)), this;
      }), toString: u2(function() {
        return "[object WeakMap]";
      }) }), v(n.prototype, h, u2("c", "WeakMap"));
    }, { "./is-native-implemented": 185, d: 106, "es5-ext/object/is-value": 151, "es5-ext/object/set-prototype-of": 157, "es5-ext/object/valid-object": 161, "es5-ext/object/valid-value": 162, "es5-ext/string/random-uniq": 167, "es6-iterator/for-of": 169, "es6-iterator/get": 170, "es6-symbol": 175 }], 187: [function(e, t, r) {
      var n = function() {
        if (typeof self == "object" && self) return self;
        if (typeof window == "object" && window) return window;
        throw new Error("Unable to resolve global `this`");
      };
      t.exports = function() {
        if (this) return this;
        try {
          Object.defineProperty(Object.prototype, "__global__", { get: function() {
            return this;
          }, configurable: true });
        } catch {
          return n();
        }
        try {
          return __global__ || n();
        } finally {
          delete Object.prototype.__global__;
        }
      }();
    }, {}], 188: [function(e, t, r) {
      "use strict";
      t.exports = e("./is-implemented")() ? globalThis : e("./implementation");
    }, { "./implementation": 187, "./is-implemented": 189 }], 189: [function(e, t, r) {
      "use strict";
      t.exports = function() {
        return typeof globalThis == "object" && !!globalThis && globalThis.Array === Array;
      };
    }, {}], 190: [function(e, t, r) {
      "use strict";
      var n = e("is-string-blank");
      t.exports = function(a) {
        var o = typeof a;
        if (o === "string") {
          var s = a;
          if ((a = +a) == 0 && n(s)) return false;
        } else if (o !== "number") return false;
        return a - a < 1;
      };
    }, { "is-string-blank": 237 }], 191: [function(e, t, r) {
      var n = e("dtype");
      t.exports = function(a, o, s) {
        if (!a) throw new TypeError("must specify data as first parameter");
        if (s = 0 | +(s || 0), Array.isArray(a) && a[0] && typeof a[0][0] == "number") {
          var i, l, u2, c, f = a[0].length, h = a.length * f;
          o && typeof o != "string" || (o = new (n(o || "float32"))(h + s));
          var p = o.length - s;
          if (h !== p) throw new Error("source length " + h + " (" + f + "x" + a.length + ") does not match destination length " + p);
          for (i = 0, u2 = s; i < a.length; i++) for (l = 0; l < f; l++) o[u2++] = a[i][l] === null ? NaN : a[i][l];
        } else if (o && typeof o != "string") o.set(a, s);
        else {
          var d = n(o || "float32");
          if (Array.isArray(a) || o === "array") for (o = new d(a.length + s), i = 0, u2 = s, c = o.length; u2 < c; u2++, i++) o[u2] = a[i] === null ? NaN : a[i];
          else s === 0 ? o = new d(a) : (o = new d(a.length + s)).set(a, s);
        }
        return o;
      };
    }, { dtype: 127 }], 192: [function(e, t, r) {
      "use strict";
      var n = e("css-font/stringify"), a = [32, 126];
      t.exports = function(o) {
        var s = (o = o || {}).shape ? o.shape : o.canvas ? [o.canvas.width, o.canvas.height] : [512, 512], i = o.canvas || document.createElement("canvas"), l = o.font, u2 = typeof o.step == "number" ? [o.step, o.step] : o.step || [32, 32], c = o.chars || a;
        if (l && typeof l != "string" && (l = n(l)), Array.isArray(c)) {
          if (c.length === 2 && typeof c[0] == "number" && typeof c[1] == "number") {
            for (var f = [], h = c[0], p = 0; h <= c[1]; h++) f[p++] = String.fromCharCode(h);
            c = f;
          }
        } else c = String(c).split("");
        s = s.slice(), i.width = s[0], i.height = s[1];
        var d = i.getContext("2d");
        d.fillStyle = "#000", d.fillRect(0, 0, i.width, i.height), d.font = l, d.textAlign = "center", d.textBaseline = "middle", d.fillStyle = "#fff";
        var v = u2[0] / 2, m = u2[1] / 2;
        for (h = 0; h < c.length; h++) d.fillText(c[h], v, m), (v += u2[0]) > s[0] - u2[0] / 2 && (v = u2[0] / 2, m += u2[1]);
        return i;
      };
    }, { "css-font/stringify": 102 }], 193: [function(e, t, r) {
      "use strict";
      function n(i, l) {
        l || (l = {}), (typeof i == "string" || Array.isArray(i)) && (l.family = i);
        var u2 = Array.isArray(l.family) ? l.family.join(", ") : l.family;
        if (!u2) throw Error("`family` must be defined");
        var c = l.size || l.fontSize || l.em || 48, f = l.weight || l.fontWeight || "", h = (i = [l.style || l.fontStyle || "", f, c].join(" ") + "px " + u2, l.origin || "top");
        if (n.cache[u2] && c <= n.cache[u2].em) return a(n.cache[u2], h);
        var p = l.canvas || n.canvas, d = p.getContext("2d"), v = { upper: l.upper !== void 0 ? l.upper : "H", lower: l.lower !== void 0 ? l.lower : "x", descent: l.descent !== void 0 ? l.descent : "p", ascent: l.ascent !== void 0 ? l.ascent : "h", tittle: l.tittle !== void 0 ? l.tittle : "i", overshoot: l.overshoot !== void 0 ? l.overshoot : "O" }, m = Math.ceil(1.5 * c);
        p.height = m, p.width = 0.5 * m, d.font = i;
        var g = { top: 0 };
        d.clearRect(0, 0, m, m), d.textBaseline = "top", d.fillStyle = "black", d.fillText("H", 0, 0);
        var x = o(d.getImageData(0, 0, m, m));
        d.clearRect(0, 0, m, m), d.textBaseline = "bottom", d.fillText("H", 0, m);
        var b = o(d.getImageData(0, 0, m, m));
        g.lineHeight = g.bottom = m - b + x, d.clearRect(0, 0, m, m), d.textBaseline = "alphabetic", d.fillText("H", 0, m);
        var y = m - o(d.getImageData(0, 0, m, m)) - 1 + x;
        g.baseline = g.alphabetic = y, d.clearRect(0, 0, m, m), d.textBaseline = "middle", d.fillText("H", 0, 0.5 * m);
        var w = o(d.getImageData(0, 0, m, m));
        g.median = g.middle = m - w - 1 + x - 0.5 * m, d.clearRect(0, 0, m, m), d.textBaseline = "hanging", d.fillText("H", 0, 0.5 * m);
        var _4 = o(d.getImageData(0, 0, m, m));
        g.hanging = m - _4 - 1 + x - 0.5 * m, d.clearRect(0, 0, m, m), d.textBaseline = "ideographic", d.fillText("H", 0, m);
        var k = o(d.getImageData(0, 0, m, m));
        if (g.ideographic = m - k - 1 + x, v.upper && (d.clearRect(0, 0, m, m), d.textBaseline = "top", d.fillText(v.upper, 0, 0), g.upper = o(d.getImageData(0, 0, m, m)), g.capHeight = g.baseline - g.upper), v.lower && (d.clearRect(0, 0, m, m), d.textBaseline = "top", d.fillText(v.lower, 0, 0), g.lower = o(d.getImageData(0, 0, m, m)), g.xHeight = g.baseline - g.lower), v.tittle && (d.clearRect(0, 0, m, m), d.textBaseline = "top", d.fillText(v.tittle, 0, 0), g.tittle = o(d.getImageData(0, 0, m, m))), v.ascent && (d.clearRect(0, 0, m, m), d.textBaseline = "top", d.fillText(v.ascent, 0, 0), g.ascent = o(d.getImageData(0, 0, m, m))), v.descent && (d.clearRect(0, 0, m, m), d.textBaseline = "top", d.fillText(v.descent, 0, 0), g.descent = s(d.getImageData(0, 0, m, m))), v.overshoot) {
          d.clearRect(0, 0, m, m), d.textBaseline = "top", d.fillText(v.overshoot, 0, 0);
          var T2 = s(d.getImageData(0, 0, m, m));
          g.overshoot = T2 - y;
        }
        for (var A2 in g) g[A2] /= c;
        return g.em = c, n.cache[u2] = g, a(g, h);
      }
      function a(i, l) {
        var u2 = {};
        for (var c in typeof l == "string" && (l = i[l]), i) c !== "em" && (u2[c] = i[c] - l);
        return u2;
      }
      function o(i) {
        for (var l = i.height, u2 = i.data, c = 3; c < u2.length; c += 4) if (u2[c] !== 0) return Math.floor(0.25 * (c - 3) / l);
      }
      function s(i) {
        for (var l = i.height, u2 = i.data, c = u2.length - 1; c > 0; c -= 4) if (u2[c] !== 0) return Math.floor(0.25 * (c - 3) / l);
      }
      t.exports = n, n.canvas = document.createElement("canvas"), n.cache = {};
    }, {}], 194: [function(e, t, r) {
      t.exports = function(n, a) {
        if (typeof n != "string") throw new TypeError("must specify type string");
        if (a = a || {}, typeof document > "u" && !a.canvas) return null;
        var o = a.canvas || document.createElement("canvas");
        typeof a.width == "number" && (o.width = a.width), typeof a.height == "number" && (o.height = a.height);
        var s, i = a;
        try {
          var l = [n];
          n.indexOf("webgl") === 0 && l.push("experimental-" + n);
          for (var u2 = 0; u2 < l.length; u2++) if (s = o.getContext(l[u2], i)) return s;
        } catch {
          s = null;
        }
        return s || null;
      };
    }, {}], 195: [function(e, t, r) {
      t.exports = function(n, a) {
        var o = a[0], s = a[1], i = a[2], l = a[3], u2 = a[4], c = a[5], f = a[6], h = a[7], p = a[8], d = a[9], v = a[10], m = a[11], g = a[12], x = a[13], b = a[14], y = a[15];
        return n[0] = c * (v * y - m * b) - d * (f * y - h * b) + x * (f * m - h * v), n[1] = -(s * (v * y - m * b) - d * (i * y - l * b) + x * (i * m - l * v)), n[2] = s * (f * y - h * b) - c * (i * y - l * b) + x * (i * h - l * f), n[3] = -(s * (f * m - h * v) - c * (i * m - l * v) + d * (i * h - l * f)), n[4] = -(u2 * (v * y - m * b) - p * (f * y - h * b) + g * (f * m - h * v)), n[5] = o * (v * y - m * b) - p * (i * y - l * b) + g * (i * m - l * v), n[6] = -(o * (f * y - h * b) - u2 * (i * y - l * b) + g * (i * h - l * f)), n[7] = o * (f * m - h * v) - u2 * (i * m - l * v) + p * (i * h - l * f), n[8] = u2 * (d * y - m * x) - p * (c * y - h * x) + g * (c * m - h * d), n[9] = -(o * (d * y - m * x) - p * (s * y - l * x) + g * (s * m - l * d)), n[10] = o * (c * y - h * x) - u2 * (s * y - l * x) + g * (s * h - l * c), n[11] = -(o * (c * m - h * d) - u2 * (s * m - l * d) + p * (s * h - l * c)), n[12] = -(u2 * (d * b - v * x) - p * (c * b - f * x) + g * (c * v - f * d)), n[13] = o * (d * b - v * x) - p * (s * b - i * x) + g * (s * v - i * d), n[14] = -(o * (c * b - f * x) - u2 * (s * b - i * x) + g * (s * f - i * c)), n[15] = o * (c * v - f * d) - u2 * (s * v - i * d) + p * (s * f - i * c), n;
      };
    }, {}], 196: [function(e, t, r) {
      t.exports = function(n) {
        var a = new Float32Array(16);
        return a[0] = n[0], a[1] = n[1], a[2] = n[2], a[3] = n[3], a[4] = n[4], a[5] = n[5], a[6] = n[6], a[7] = n[7], a[8] = n[8], a[9] = n[9], a[10] = n[10], a[11] = n[11], a[12] = n[12], a[13] = n[13], a[14] = n[14], a[15] = n[15], a;
      };
    }, {}], 197: [function(e, t, r) {
      t.exports = function(n, a) {
        return n[0] = a[0], n[1] = a[1], n[2] = a[2], n[3] = a[3], n[4] = a[4], n[5] = a[5], n[6] = a[6], n[7] = a[7], n[8] = a[8], n[9] = a[9], n[10] = a[10], n[11] = a[11], n[12] = a[12], n[13] = a[13], n[14] = a[14], n[15] = a[15], n;
      };
    }, {}], 198: [function(e, t, r) {
      t.exports = function() {
        var n = new Float32Array(16);
        return n[0] = 1, n[1] = 0, n[2] = 0, n[3] = 0, n[4] = 0, n[5] = 1, n[6] = 0, n[7] = 0, n[8] = 0, n[9] = 0, n[10] = 1, n[11] = 0, n[12] = 0, n[13] = 0, n[14] = 0, n[15] = 1, n;
      };
    }, {}], 199: [function(e, t, r) {
      t.exports = function(n) {
        var a = n[0], o = n[1], s = n[2], i = n[3], l = n[4], u2 = n[5], c = n[6], f = n[7], h = n[8], p = n[9], d = n[10], v = n[11], m = n[12], g = n[13], x = n[14], b = n[15];
        return (a * u2 - o * l) * (d * b - v * x) - (a * c - s * l) * (p * b - v * g) + (a * f - i * l) * (p * x - d * g) + (o * c - s * u2) * (h * b - v * m) - (o * f - i * u2) * (h * x - d * m) + (s * f - i * c) * (h * g - p * m);
      };
    }, {}], 200: [function(e, t, r) {
      t.exports = function(n, a) {
        var o = a[0], s = a[1], i = a[2], l = a[3], u2 = o + o, c = s + s, f = i + i, h = o * u2, p = s * u2, d = s * c, v = i * u2, m = i * c, g = i * f, x = l * u2, b = l * c, y = l * f;
        return n[0] = 1 - d - g, n[1] = p + y, n[2] = v - b, n[3] = 0, n[4] = p - y, n[5] = 1 - h - g, n[6] = m + x, n[7] = 0, n[8] = v + b, n[9] = m - x, n[10] = 1 - h - d, n[11] = 0, n[12] = 0, n[13] = 0, n[14] = 0, n[15] = 1, n;
      };
    }, {}], 201: [function(e, t, r) {
      t.exports = function(n, a, o) {
        var s, i, l, u2 = o[0], c = o[1], f = o[2], h = Math.sqrt(u2 * u2 + c * c + f * f);
        return Math.abs(h) < 1e-6 ? null : (u2 *= h = 1 / h, c *= h, f *= h, s = Math.sin(a), i = Math.cos(a), l = 1 - i, n[0] = u2 * u2 * l + i, n[1] = c * u2 * l + f * s, n[2] = f * u2 * l - c * s, n[3] = 0, n[4] = u2 * c * l - f * s, n[5] = c * c * l + i, n[6] = f * c * l + u2 * s, n[7] = 0, n[8] = u2 * f * l + c * s, n[9] = c * f * l - u2 * s, n[10] = f * f * l + i, n[11] = 0, n[12] = 0, n[13] = 0, n[14] = 0, n[15] = 1, n);
      };
    }, {}], 202: [function(e, t, r) {
      t.exports = function(n, a, o) {
        var s = a[0], i = a[1], l = a[2], u2 = a[3], c = s + s, f = i + i, h = l + l, p = s * c, d = s * f, v = s * h, m = i * f, g = i * h, x = l * h, b = u2 * c, y = u2 * f, w = u2 * h;
        return n[0] = 1 - (m + x), n[1] = d + w, n[2] = v - y, n[3] = 0, n[4] = d - w, n[5] = 1 - (p + x), n[6] = g + b, n[7] = 0, n[8] = v + y, n[9] = g - b, n[10] = 1 - (p + m), n[11] = 0, n[12] = o[0], n[13] = o[1], n[14] = o[2], n[15] = 1, n;
      };
    }, {}], 203: [function(e, t, r) {
      t.exports = function(n, a) {
        return n[0] = a[0], n[1] = 0, n[2] = 0, n[3] = 0, n[4] = 0, n[5] = a[1], n[6] = 0, n[7] = 0, n[8] = 0, n[9] = 0, n[10] = a[2], n[11] = 0, n[12] = 0, n[13] = 0, n[14] = 0, n[15] = 1, n;
      };
    }, {}], 204: [function(e, t, r) {
      t.exports = function(n, a) {
        return n[0] = 1, n[1] = 0, n[2] = 0, n[3] = 0, n[4] = 0, n[5] = 1, n[6] = 0, n[7] = 0, n[8] = 0, n[9] = 0, n[10] = 1, n[11] = 0, n[12] = a[0], n[13] = a[1], n[14] = a[2], n[15] = 1, n;
      };
    }, {}], 205: [function(e, t, r) {
      t.exports = function(n, a) {
        var o = Math.sin(a), s = Math.cos(a);
        return n[0] = 1, n[1] = 0, n[2] = 0, n[3] = 0, n[4] = 0, n[5] = s, n[6] = o, n[7] = 0, n[8] = 0, n[9] = -o, n[10] = s, n[11] = 0, n[12] = 0, n[13] = 0, n[14] = 0, n[15] = 1, n;
      };
    }, {}], 206: [function(e, t, r) {
      t.exports = function(n, a) {
        var o = Math.sin(a), s = Math.cos(a);
        return n[0] = s, n[1] = 0, n[2] = -o, n[3] = 0, n[4] = 0, n[5] = 1, n[6] = 0, n[7] = 0, n[8] = o, n[9] = 0, n[10] = s, n[11] = 0, n[12] = 0, n[13] = 0, n[14] = 0, n[15] = 1, n;
      };
    }, {}], 207: [function(e, t, r) {
      t.exports = function(n, a) {
        var o = Math.sin(a), s = Math.cos(a);
        return n[0] = s, n[1] = o, n[2] = 0, n[3] = 0, n[4] = -o, n[5] = s, n[6] = 0, n[7] = 0, n[8] = 0, n[9] = 0, n[10] = 1, n[11] = 0, n[12] = 0, n[13] = 0, n[14] = 0, n[15] = 1, n;
      };
    }, {}], 208: [function(e, t, r) {
      t.exports = function(n, a, o, s, i, l, u2) {
        var c = 1 / (o - a), f = 1 / (i - s), h = 1 / (l - u2);
        return n[0] = 2 * l * c, n[1] = 0, n[2] = 0, n[3] = 0, n[4] = 0, n[5] = 2 * l * f, n[6] = 0, n[7] = 0, n[8] = (o + a) * c, n[9] = (i + s) * f, n[10] = (u2 + l) * h, n[11] = -1, n[12] = 0, n[13] = 0, n[14] = u2 * l * 2 * h, n[15] = 0, n;
      };
    }, {}], 209: [function(e, t, r) {
      t.exports = function(n) {
        return n[0] = 1, n[1] = 0, n[2] = 0, n[3] = 0, n[4] = 0, n[5] = 1, n[6] = 0, n[7] = 0, n[8] = 0, n[9] = 0, n[10] = 1, n[11] = 0, n[12] = 0, n[13] = 0, n[14] = 0, n[15] = 1, n;
      };
    }, {}], 210: [function(e, t, r) {
      t.exports = { create: e("./create"), clone: e("./clone"), copy: e("./copy"), identity: e("./identity"), transpose: e("./transpose"), invert: e("./invert"), adjoint: e("./adjoint"), determinant: e("./determinant"), multiply: e("./multiply"), translate: e("./translate"), scale: e("./scale"), rotate: e("./rotate"), rotateX: e("./rotateX"), rotateY: e("./rotateY"), rotateZ: e("./rotateZ"), fromRotation: e("./fromRotation"), fromRotationTranslation: e("./fromRotationTranslation"), fromScaling: e("./fromScaling"), fromTranslation: e("./fromTranslation"), fromXRotation: e("./fromXRotation"), fromYRotation: e("./fromYRotation"), fromZRotation: e("./fromZRotation"), fromQuat: e("./fromQuat"), frustum: e("./frustum"), perspective: e("./perspective"), perspectiveFromFieldOfView: e("./perspectiveFromFieldOfView"), ortho: e("./ortho"), lookAt: e("./lookAt"), str: e("./str") };
    }, { "./adjoint": 195, "./clone": 196, "./copy": 197, "./create": 198, "./determinant": 199, "./fromQuat": 200, "./fromRotation": 201, "./fromRotationTranslation": 202, "./fromScaling": 203, "./fromTranslation": 204, "./fromXRotation": 205, "./fromYRotation": 206, "./fromZRotation": 207, "./frustum": 208, "./identity": 209, "./invert": 211, "./lookAt": 212, "./multiply": 213, "./ortho": 214, "./perspective": 215, "./perspectiveFromFieldOfView": 216, "./rotate": 217, "./rotateX": 218, "./rotateY": 219, "./rotateZ": 220, "./scale": 221, "./str": 222, "./translate": 223, "./transpose": 224 }], 211: [function(e, t, r) {
      t.exports = function(n, a) {
        var o = a[0], s = a[1], i = a[2], l = a[3], u2 = a[4], c = a[5], f = a[6], h = a[7], p = a[8], d = a[9], v = a[10], m = a[11], g = a[12], x = a[13], b = a[14], y = a[15], w = o * c - s * u2, _4 = o * f - i * u2, k = o * h - l * u2, T2 = s * f - i * c, A2 = s * h - l * c, S2 = i * h - l * f, C2 = p * x - d * g, E2 = p * b - v * g, F13 = p * y - m * g, N2 = d * b - v * x, D2 = d * y - m * x, I2 = v * y - m * b, O2 = w * I2 - _4 * D2 + k * N2 + T2 * F13 - A2 * E2 + S2 * C2;
        return O2 ? (O2 = 1 / O2, n[0] = (c * I2 - f * D2 + h * N2) * O2, n[1] = (i * D2 - s * I2 - l * N2) * O2, n[2] = (x * S2 - b * A2 + y * T2) * O2, n[3] = (v * A2 - d * S2 - m * T2) * O2, n[4] = (f * F13 - u2 * I2 - h * E2) * O2, n[5] = (o * I2 - i * F13 + l * E2) * O2, n[6] = (b * k - g * S2 - y * _4) * O2, n[7] = (p * S2 - v * k + m * _4) * O2, n[8] = (u2 * D2 - c * F13 + h * C2) * O2, n[9] = (s * F13 - o * D2 - l * C2) * O2, n[10] = (g * A2 - x * k + y * w) * O2, n[11] = (d * k - p * A2 - m * w) * O2, n[12] = (c * E2 - u2 * N2 - f * C2) * O2, n[13] = (o * N2 - s * E2 + i * C2) * O2, n[14] = (x * _4 - g * T2 - b * w) * O2, n[15] = (p * T2 - d * _4 + v * w) * O2, n) : null;
      };
    }, {}], 212: [function(e, t, r) {
      var n = e("./identity");
      t.exports = function(a, o, s, i) {
        var l, u2, c, f, h, p, d, v, m, g, x = o[0], b = o[1], y = o[2], w = i[0], _4 = i[1], k = i[2], T2 = s[0], A2 = s[1], S2 = s[2];
        return Math.abs(x - T2) < 1e-6 && Math.abs(b - A2) < 1e-6 && Math.abs(y - S2) < 1e-6 ? n(a) : (d = x - T2, v = b - A2, m = y - S2, g = 1 / Math.sqrt(d * d + v * v + m * m), l = _4 * (m *= g) - k * (v *= g), u2 = k * (d *= g) - w * m, c = w * v - _4 * d, (g = Math.sqrt(l * l + u2 * u2 + c * c)) ? (l *= g = 1 / g, u2 *= g, c *= g) : (l = 0, u2 = 0, c = 0), f = v * c - m * u2, h = m * l - d * c, p = d * u2 - v * l, (g = Math.sqrt(f * f + h * h + p * p)) ? (f *= g = 1 / g, h *= g, p *= g) : (f = 0, h = 0, p = 0), a[0] = l, a[1] = f, a[2] = d, a[3] = 0, a[4] = u2, a[5] = h, a[6] = v, a[7] = 0, a[8] = c, a[9] = p, a[10] = m, a[11] = 0, a[12] = -(l * x + u2 * b + c * y), a[13] = -(f * x + h * b + p * y), a[14] = -(d * x + v * b + m * y), a[15] = 1, a);
      };
    }, { "./identity": 209 }], 213: [function(e, t, r) {
      t.exports = function(n, a, o) {
        var s = a[0], i = a[1], l = a[2], u2 = a[3], c = a[4], f = a[5], h = a[6], p = a[7], d = a[8], v = a[9], m = a[10], g = a[11], x = a[12], b = a[13], y = a[14], w = a[15], _4 = o[0], k = o[1], T2 = o[2], A2 = o[3];
        return n[0] = _4 * s + k * c + T2 * d + A2 * x, n[1] = _4 * i + k * f + T2 * v + A2 * b, n[2] = _4 * l + k * h + T2 * m + A2 * y, n[3] = _4 * u2 + k * p + T2 * g + A2 * w, _4 = o[4], k = o[5], T2 = o[6], A2 = o[7], n[4] = _4 * s + k * c + T2 * d + A2 * x, n[5] = _4 * i + k * f + T2 * v + A2 * b, n[6] = _4 * l + k * h + T2 * m + A2 * y, n[7] = _4 * u2 + k * p + T2 * g + A2 * w, _4 = o[8], k = o[9], T2 = o[10], A2 = o[11], n[8] = _4 * s + k * c + T2 * d + A2 * x, n[9] = _4 * i + k * f + T2 * v + A2 * b, n[10] = _4 * l + k * h + T2 * m + A2 * y, n[11] = _4 * u2 + k * p + T2 * g + A2 * w, _4 = o[12], k = o[13], T2 = o[14], A2 = o[15], n[12] = _4 * s + k * c + T2 * d + A2 * x, n[13] = _4 * i + k * f + T2 * v + A2 * b, n[14] = _4 * l + k * h + T2 * m + A2 * y, n[15] = _4 * u2 + k * p + T2 * g + A2 * w, n;
      };
    }, {}], 214: [function(e, t, r) {
      t.exports = function(n, a, o, s, i, l, u2) {
        var c = 1 / (a - o), f = 1 / (s - i), h = 1 / (l - u2);
        return n[0] = -2 * c, n[1] = 0, n[2] = 0, n[3] = 0, n[4] = 0, n[5] = -2 * f, n[6] = 0, n[7] = 0, n[8] = 0, n[9] = 0, n[10] = 2 * h, n[11] = 0, n[12] = (a + o) * c, n[13] = (i + s) * f, n[14] = (u2 + l) * h, n[15] = 1, n;
      };
    }, {}], 215: [function(e, t, r) {
      t.exports = function(n, a, o, s, i) {
        var l = 1 / Math.tan(a / 2), u2 = 1 / (s - i);
        return n[0] = l / o, n[1] = 0, n[2] = 0, n[3] = 0, n[4] = 0, n[5] = l, n[6] = 0, n[7] = 0, n[8] = 0, n[9] = 0, n[10] = (i + s) * u2, n[11] = -1, n[12] = 0, n[13] = 0, n[14] = 2 * i * s * u2, n[15] = 0, n;
      };
    }, {}], 216: [function(e, t, r) {
      t.exports = function(n, a, o, s) {
        var i = Math.tan(a.upDegrees * Math.PI / 180), l = Math.tan(a.downDegrees * Math.PI / 180), u2 = Math.tan(a.leftDegrees * Math.PI / 180), c = Math.tan(a.rightDegrees * Math.PI / 180), f = 2 / (u2 + c), h = 2 / (i + l);
        return n[0] = f, n[1] = 0, n[2] = 0, n[3] = 0, n[4] = 0, n[5] = h, n[6] = 0, n[7] = 0, n[8] = -(u2 - c) * f * 0.5, n[9] = (i - l) * h * 0.5, n[10] = s / (o - s), n[11] = -1, n[12] = 0, n[13] = 0, n[14] = s * o / (o - s), n[15] = 0, n;
      };
    }, {}], 217: [function(e, t, r) {
      t.exports = function(n, a, o, s) {
        var i, l, u2, c, f, h, p, d, v, m, g, x, b, y, w, _4, k, T2, A2, S2, C2, E2, F13, N2, D2 = s[0], I2 = s[1], O2 = s[2], L2 = Math.sqrt(D2 * D2 + I2 * I2 + O2 * O2);
        return Math.abs(L2) < 1e-6 ? null : (D2 *= L2 = 1 / L2, I2 *= L2, O2 *= L2, i = Math.sin(o), l = Math.cos(o), u2 = 1 - l, c = a[0], f = a[1], h = a[2], p = a[3], d = a[4], v = a[5], m = a[6], g = a[7], x = a[8], b = a[9], y = a[10], w = a[11], _4 = D2 * D2 * u2 + l, k = I2 * D2 * u2 + O2 * i, T2 = O2 * D2 * u2 - I2 * i, A2 = D2 * I2 * u2 - O2 * i, S2 = I2 * I2 * u2 + l, C2 = O2 * I2 * u2 + D2 * i, E2 = D2 * O2 * u2 + I2 * i, F13 = I2 * O2 * u2 - D2 * i, N2 = O2 * O2 * u2 + l, n[0] = c * _4 + d * k + x * T2, n[1] = f * _4 + v * k + b * T2, n[2] = h * _4 + m * k + y * T2, n[3] = p * _4 + g * k + w * T2, n[4] = c * A2 + d * S2 + x * C2, n[5] = f * A2 + v * S2 + b * C2, n[6] = h * A2 + m * S2 + y * C2, n[7] = p * A2 + g * S2 + w * C2, n[8] = c * E2 + d * F13 + x * N2, n[9] = f * E2 + v * F13 + b * N2, n[10] = h * E2 + m * F13 + y * N2, n[11] = p * E2 + g * F13 + w * N2, a !== n && (n[12] = a[12], n[13] = a[13], n[14] = a[14], n[15] = a[15]), n);
      };
    }, {}], 218: [function(e, t, r) {
      t.exports = function(n, a, o) {
        var s = Math.sin(o), i = Math.cos(o), l = a[4], u2 = a[5], c = a[6], f = a[7], h = a[8], p = a[9], d = a[10], v = a[11];
        return a !== n && (n[0] = a[0], n[1] = a[1], n[2] = a[2], n[3] = a[3], n[12] = a[12], n[13] = a[13], n[14] = a[14], n[15] = a[15]), n[4] = l * i + h * s, n[5] = u2 * i + p * s, n[6] = c * i + d * s, n[7] = f * i + v * s, n[8] = h * i - l * s, n[9] = p * i - u2 * s, n[10] = d * i - c * s, n[11] = v * i - f * s, n;
      };
    }, {}], 219: [function(e, t, r) {
      t.exports = function(n, a, o) {
        var s = Math.sin(o), i = Math.cos(o), l = a[0], u2 = a[1], c = a[2], f = a[3], h = a[8], p = a[9], d = a[10], v = a[11];
        return a !== n && (n[4] = a[4], n[5] = a[5], n[6] = a[6], n[7] = a[7], n[12] = a[12], n[13] = a[13], n[14] = a[14], n[15] = a[15]), n[0] = l * i - h * s, n[1] = u2 * i - p * s, n[2] = c * i - d * s, n[3] = f * i - v * s, n[8] = l * s + h * i, n[9] = u2 * s + p * i, n[10] = c * s + d * i, n[11] = f * s + v * i, n;
      };
    }, {}], 220: [function(e, t, r) {
      t.exports = function(n, a, o) {
        var s = Math.sin(o), i = Math.cos(o), l = a[0], u2 = a[1], c = a[2], f = a[3], h = a[4], p = a[5], d = a[6], v = a[7];
        return a !== n && (n[8] = a[8], n[9] = a[9], n[10] = a[10], n[11] = a[11], n[12] = a[12], n[13] = a[13], n[14] = a[14], n[15] = a[15]), n[0] = l * i + h * s, n[1] = u2 * i + p * s, n[2] = c * i + d * s, n[3] = f * i + v * s, n[4] = h * i - l * s, n[5] = p * i - u2 * s, n[6] = d * i - c * s, n[7] = v * i - f * s, n;
      };
    }, {}], 221: [function(e, t, r) {
      t.exports = function(n, a, o) {
        var s = o[0], i = o[1], l = o[2];
        return n[0] = a[0] * s, n[1] = a[1] * s, n[2] = a[2] * s, n[3] = a[3] * s, n[4] = a[4] * i, n[5] = a[5] * i, n[6] = a[6] * i, n[7] = a[7] * i, n[8] = a[8] * l, n[9] = a[9] * l, n[10] = a[10] * l, n[11] = a[11] * l, n[12] = a[12], n[13] = a[13], n[14] = a[14], n[15] = a[15], n;
      };
    }, {}], 222: [function(e, t, r) {
      t.exports = function(n) {
        return "mat4(" + 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] + ")";
      };
    }, {}], 223: [function(e, t, r) {
      t.exports = function(n, a, o) {
        var s, i, l, u2, c, f, h, p, d, v, m, g, x = o[0], b = o[1], y = o[2];
        return a === n ? (n[12] = a[0] * x + a[4] * b + a[8] * y + a[12], n[13] = a[1] * x + a[5] * b + a[9] * y + a[13], n[14] = a[2] * x + a[6] * b + a[10] * y + a[14], n[15] = a[3] * x + a[7] * b + a[11] * y + a[15]) : (s = a[0], i = a[1], l = a[2], u2 = a[3], c = a[4], f = a[5], h = a[6], p = a[7], d = a[8], v = a[9], m = a[10], g = a[11], n[0] = s, n[1] = i, n[2] = l, n[3] = u2, n[4] = c, n[5] = f, n[6] = h, n[7] = p, n[8] = d, n[9] = v, n[10] = m, n[11] = g, n[12] = s * x + c * b + d * y + a[12], n[13] = i * x + f * b + v * y + a[13], n[14] = l * x + h * b + m * y + a[14], n[15] = u2 * x + p * b + g * y + a[15]), n;
      };
    }, {}], 224: [function(e, t, r) {
      t.exports = function(n, a) {
        if (n === a) {
          var o = a[1], s = a[2], i = a[3], l = a[6], u2 = a[7], c = a[11];
          n[1] = a[4], n[2] = a[8], n[3] = a[12], n[4] = o, n[6] = a[9], n[7] = a[13], n[8] = s, n[9] = l, n[11] = a[14], n[12] = i, n[13] = u2, n[14] = c;
        } else n[0] = a[0], n[1] = a[4], n[2] = a[8], n[3] = a[12], n[4] = a[1], n[5] = a[5], n[6] = a[9], n[7] = a[13], n[8] = a[2], n[9] = a[6], n[10] = a[10], n[11] = a[14], n[12] = a[3], n[13] = a[7], n[14] = a[11], n[15] = a[15];
        return n;
      };
    }, {}], 225: [function(e, t, r) {
      "use strict";
      var n = e("css-font"), a = e("pick-by-alias"), o = e("regl"), s = e("gl-util/context"), i = e("es6-weak-map"), l = e("color-normalize"), u2 = e("font-atlas"), c = e("typedarray-pool"), f = e("parse-rect"), h = e("is-plain-obj"), p = e("parse-unit"), d = e("to-px"), v = e("detect-kerning"), m = e("object-assign"), g = e("font-measure"), x = e("flatten-vertex-data"), b = e("bit-twiddle").nextPow2, y = new i(), w = false;
      if (document.body) {
        var _4 = document.body.appendChild(document.createElement("div"));
        _4.style.font = "italic small-caps bold condensed 16px/2 cursive", getComputedStyle(_4).fontStretch && (w = true), document.body.removeChild(_4);
      }
      var k = function(T2) {
        (function(A2) {
          return typeof A2 == "function" && A2._gl && A2.prop && A2.texture && A2.buffer;
        })(T2) ? (T2 = { regl: T2 }, this.gl = T2.regl._gl) : this.gl = s(T2), this.shader = y.get(this.gl), this.shader ? this.regl = this.shader.regl : this.regl = T2.regl || o({ gl: this.gl }), this.charBuffer = this.regl.buffer({ type: "uint8", usage: "stream" }), this.sizeBuffer = this.regl.buffer({ type: "float", usage: "stream" }), this.shader || (this.shader = this.createShader(), y.set(this.gl, this.shader)), this.batch = [], this.fontSize = [], this.font = [], this.fontAtlas = [], this.draw = this.shader.draw.bind(this), this.render = function() {
          this.regl._refresh(), this.draw(this.batch);
        }, this.canvas = this.gl.canvas, this.update(h(T2) ? T2 : {});
      };
      k.prototype.createShader = function() {
        var T2 = this.regl, A2 = T2({ blend: { enable: true, color: [0, 0, 0, 1], func: { srcRGB: "src alpha", dstRGB: "one minus src alpha", srcAlpha: "one minus dst alpha", dstAlpha: "one" } }, stencil: { enable: false }, depth: { enable: false }, count: T2.prop("count"), offset: T2.prop("offset"), attributes: { charOffset: { offset: 4, stride: 8, buffer: T2.this("sizeBuffer") }, width: { offset: 0, stride: 8, buffer: T2.this("sizeBuffer") }, char: T2.this("charBuffer"), position: T2.this("position") }, uniforms: { atlasSize: function(S2, C2) {
          return [C2.atlas.width, C2.atlas.height];
        }, atlasDim: function(S2, C2) {
          return [C2.atlas.cols, C2.atlas.rows];
        }, atlas: function(S2, C2) {
          return C2.atlas.texture;
        }, charStep: function(S2, C2) {
          return C2.atlas.step;
        }, em: function(S2, C2) {
          return C2.atlas.em;
        }, color: T2.prop("color"), opacity: T2.prop("opacity"), viewport: T2.this("viewportArray"), scale: T2.this("scale"), align: T2.prop("align"), baseline: T2.prop("baseline"), translate: T2.this("translate"), positionOffset: T2.prop("positionOffset") }, primitive: "points", viewport: T2.this("viewport"), vert: `
			precision highp float;
			attribute float width, charOffset, char;
			attribute vec2 position;
			uniform float fontSize, charStep, em, align, baseline;
			uniform vec4 viewport;
			uniform vec4 color;
			uniform vec2 atlasSize, atlasDim, scale, translate, positionOffset;
			varying vec2 charCoord, charId;
			varying float charWidth;
			varying vec4 fontColor;
			void main () {
				vec2 offset = floor(em * (vec2(align + charOffset, baseline)
					+ vec2(positionOffset.x, -positionOffset.y)))
					/ (viewport.zw * scale.xy);

				vec2 position = (position + translate) * scale;
				position += offset * scale;

				charCoord = position * viewport.zw + viewport.xy;

				gl_Position = vec4(position * 2. - 1., 0, 1);

				gl_PointSize = charStep;

				charId.x = mod(char, atlasDim.x);
				charId.y = floor(char / atlasDim.x);

				charWidth = width * em;

				fontColor = color / 255.;
			}`, frag: `
			precision highp float;
			uniform float fontSize, charStep, opacity;
			uniform vec2 atlasSize;
			uniform vec4 viewport;
			uniform sampler2D atlas;
			varying vec4 fontColor;
			varying vec2 charCoord, charId;
			varying float charWidth;

			float lightness(vec4 color) {
				return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
			}

			void main () {
				vec2 uv = gl_FragCoord.xy - charCoord + charStep * .5;
				float halfCharStep = floor(charStep * .5 + .5);

				// invert y and shift by 1px (FF expecially needs that)
				uv.y = charStep - uv.y;

				// ignore points outside of character bounding box
				float halfCharWidth = ceil(charWidth * .5);
				if (floor(uv.x) > halfCharStep + halfCharWidth ||
					floor(uv.x) < halfCharStep - halfCharWidth) return;

				uv += charId * charStep;
				uv = uv / atlasSize;

				vec4 color = fontColor;
				vec4 mask = texture2D(atlas, uv);

				float maskY = lightness(mask);
				// float colorY = lightness(color);
				color.a *= maskY;
				color.a *= opacity;

				// color.a += .1;

				// antialiasing, see yiq color space y-channel formula
				// color.rgb += (1. - color.rgb) * (1. - mask.rgb);

				gl_FragColor = color;
			}` });
        return { regl: T2, draw: A2, atlas: {} };
      }, k.prototype.update = function(T2) {
        var A2 = this;
        if (typeof T2 == "string") T2 = { text: T2 };
        else if (!T2) return;
        (T2 = a(T2, { position: "position positions coord coords coordinates", font: "font fontFace fontface typeface cssFont css-font family fontFamily", fontSize: "fontSize fontsize size font-size", text: "text texts chars characters value values symbols", align: "align alignment textAlign textbaseline", baseline: "baseline textBaseline textbaseline", direction: "dir direction textDirection", color: "color colour fill fill-color fillColor textColor textcolor", kerning: "kerning kern", range: "range dataBox", viewport: "vp viewport viewBox viewbox viewPort", opacity: "opacity alpha transparency visible visibility opaque", offset: "offset positionOffset padding shift indent indentation" }, true)).opacity != null && (Array.isArray(T2.opacity) ? this.opacity = T2.opacity.map(function(ve) {
          return parseFloat(ve);
        }) : this.opacity = parseFloat(T2.opacity)), T2.viewport != null && (this.viewport = f(T2.viewport), this.viewportArray = [this.viewport.x, this.viewport.y, this.viewport.width, this.viewport.height]), this.viewport == null && (this.viewport = { x: 0, y: 0, width: this.gl.drawingBufferWidth, height: this.gl.drawingBufferHeight }, this.viewportArray = [this.viewport.x, this.viewport.y, this.viewport.width, this.viewport.height]), T2.kerning != null && (this.kerning = T2.kerning), T2.offset != null && (typeof T2.offset == "number" && (T2.offset = [T2.offset, 0]), this.positionOffset = x(T2.offset)), T2.direction && (this.direction = T2.direction), T2.range && (this.range = T2.range, this.scale = [1 / (T2.range[2] - T2.range[0]), 1 / (T2.range[3] - T2.range[1])], this.translate = [-T2.range[0], -T2.range[1]]), T2.scale && (this.scale = T2.scale), T2.translate && (this.translate = T2.translate), this.scale || (this.scale = [1 / this.viewport.width, 1 / this.viewport.height]), this.translate || (this.translate = [0, 0]), this.font.length || T2.font || (T2.font = k.baseFontSize + "px sans-serif");
        var S2, C2 = false, E2 = false;
        if (T2.font && (Array.isArray(T2.font) ? T2.font : [T2.font]).forEach(function(ve, Ee) {
          if (typeof ve == "string") try {
            ve = n.parse(ve);
          } catch {
            ve = n.parse(k.baseFontSize + "px " + ve);
          }
          else ve = n.parse(n.stringify(ve));
          var Se = n.stringify({ size: k.baseFontSize, family: ve.family, stretch: w ? ve.stretch : void 0, variant: ve.variant, weight: ve.weight, style: ve.style }), Ce = p(ve.size), Be = Math.round(Ce[0] * d(Ce[1]));
          if (Be !== A2.fontSize[Ee] && (E2 = true, A2.fontSize[Ee] = Be), !(A2.font[Ee] && Se == A2.font[Ee].baseString || (C2 = true, A2.font[Ee] = k.fonts[Se], A2.font[Ee]))) {
            var Ue = ve.family.join(", "), Ke = [ve.style];
            ve.style != ve.variant && Ke.push(ve.variant), ve.variant != ve.weight && Ke.push(ve.weight), w && ve.weight != ve.stretch && Ke.push(ve.stretch), A2.font[Ee] = { baseString: Se, family: Ue, weight: ve.weight, stretch: ve.stretch, style: ve.style, variant: ve.variant, width: {}, kerning: {}, metrics: g(Ue, { origin: "top", fontSize: k.baseFontSize, fontStyle: Ke.join(" ") }) }, k.fonts[Se] = A2.font[Ee];
          }
        }), (C2 || E2) && this.font.forEach(function(ve, Ee) {
          var Se = n.stringify({ size: A2.fontSize[Ee], family: ve.family, stretch: w ? ve.stretch : void 0, variant: ve.variant, weight: ve.weight, style: ve.style });
          if (A2.fontAtlas[Ee] = A2.shader.atlas[Se], !A2.fontAtlas[Ee]) {
            var Ce = ve.metrics;
            A2.shader.atlas[Se] = A2.fontAtlas[Ee] = { fontString: Se, step: 2 * Math.ceil(A2.fontSize[Ee] * Ce.bottom * 0.5), em: A2.fontSize[Ee], cols: 0, rows: 0, height: 0, width: 0, chars: [], ids: {}, texture: A2.regl.texture() };
          }
          T2.text == null && (T2.text = A2.text);
        }), typeof T2.text == "string" && T2.position && T2.position.length > 2) {
          for (var F13 = Array(0.5 * T2.position.length), N2 = 0; N2 < F13.length; N2++) F13[N2] = T2.text;
          T2.text = F13;
        }
        if (T2.text != null || C2) {
          if (this.textOffsets = [0], Array.isArray(T2.text)) {
            this.count = T2.text[0].length, this.counts = [this.count];
            for (var D2 = 1; D2 < T2.text.length; D2++) this.textOffsets[D2] = this.textOffsets[D2 - 1] + T2.text[D2 - 1].length, this.count += T2.text[D2].length, this.counts.push(T2.text[D2].length);
            this.text = T2.text.join("");
          } else this.text = T2.text, this.count = this.text.length, this.counts = [this.count];
          S2 = [], this.font.forEach(function(ve, Ee) {
            k.atlasContext.font = ve.baseString;
            for (var Se = A2.fontAtlas[Ee], Ce = 0; Ce < A2.text.length; Ce++) {
              var Be = A2.text.charAt(Ce);
              if (Se.ids[Be] == null && (Se.ids[Be] = Se.chars.length, Se.chars.push(Be), S2.push(Be)), ve.width[Be] == null && (ve.width[Be] = k.atlasContext.measureText(Be).width / k.baseFontSize, A2.kerning)) {
                var Ue = [];
                for (var Ke in ve.width) Ue.push(Ke + Be, Be + Ke);
                m(ve.kerning, v(ve.family, { pairs: Ue }));
              }
            }
          });
        }
        if (T2.position) if (T2.position.length > 2) {
          for (var I2 = !T2.position[0].length, O2 = c.mallocFloat(2 * this.count), L2 = 0, V2 = 0; L2 < this.counts.length; L2++) {
            var W2 = this.counts[L2];
            if (I2) for (var X2 = 0; X2 < W2; X2++) O2[V2++] = T2.position[2 * L2], O2[V2++] = T2.position[2 * L2 + 1];
            else for (var Y2 = 0; Y2 < W2; Y2++) O2[V2++] = T2.position[L2][0], O2[V2++] = T2.position[L2][1];
          }
          this.position.call ? this.position({ type: "float", data: O2 }) : this.position = this.regl.buffer({ type: "float", data: O2 }), c.freeFloat(O2);
        } else this.position.destroy && this.position.destroy(), this.position = { constant: T2.position };
        if (T2.text || C2) {
          var K2 = c.mallocUint8(this.count), q = c.mallocFloat(2 * this.count);
          this.textWidth = [];
          for (var re = 0, R2 = 0; re < this.counts.length; re++) {
            for (var z = this.counts[re], H2 = this.font[re] || this.font[0], te = this.fontAtlas[re] || this.fontAtlas[0], j = 0; j < z; j++) {
              var Q2 = this.text.charAt(R2), Z2 = this.text.charAt(R2 - 1);
              if (K2[R2] = te.ids[Q2], q[2 * R2] = H2.width[Q2], j) {
                var ne = q[2 * R2 - 2], ae = q[2 * R2], ue = q[2 * R2 - 1] + 0.5 * ne + 0.5 * ae;
                if (this.kerning) {
                  var le = H2.kerning[Z2 + Q2];
                  le && (ue += 1e-3 * le);
                }
                q[2 * R2 + 1] = ue;
              } else q[2 * R2 + 1] = 0.5 * q[2 * R2];
              R2++;
            }
            this.textWidth.push(q.length ? 0.5 * q[2 * R2 - 2] + q[2 * R2 - 1] : 0);
          }
          T2.align || (T2.align = this.align), this.charBuffer({ data: K2, type: "uint8", usage: "stream" }), this.sizeBuffer({ data: q, type: "float", usage: "stream" }), c.freeUint8(K2), c.freeFloat(q), S2.length && this.font.forEach(function(ve, Ee) {
            var Se = A2.fontAtlas[Ee], Ce = Se.step, Be = Math.floor(k.maxAtlasSize / Ce), Ue = Math.min(Be, Se.chars.length), Ke = Math.ceil(Se.chars.length / Ue), ct = b(Ue * Ce), We = b(Ke * Ce);
            Se.width = ct, Se.height = We, Se.rows = Ke, Se.cols = Ue, Se.em && Se.texture({ data: u2({ canvas: k.atlasCanvas, font: Se.fontString, chars: Se.chars, shape: [ct, We], step: [Ce, Ce] }) });
          });
        }
        if (T2.align && (this.align = T2.align, this.alignOffset = this.textWidth.map(function(ve, Ee) {
          var Se = Array.isArray(A2.align) ? A2.align.length > 1 ? A2.align[Ee] : A2.align[0] : A2.align;
          if (typeof Se == "number") return Se;
          switch (Se) {
            case "right":
            case "end":
              return -ve;
            case "center":
            case "centre":
            case "middle":
              return 0.5 * -ve;
          }
          return 0;
        })), this.baseline == null && T2.baseline == null && (T2.baseline = 0), T2.baseline != null && (this.baseline = T2.baseline, Array.isArray(this.baseline) || (this.baseline = [this.baseline]), this.baselineOffset = this.baseline.map(function(ve, Ee) {
          var Se = (A2.font[Ee] || A2.font[0]).metrics, Ce = 0;
          return Ce += 0.5 * Se.bottom, Ce += typeof ve == "number" ? ve - Se.baseline : -Se[ve], Ce *= -1;
        })), T2.color != null) if (T2.color || (T2.color = "transparent"), typeof T2.color != "string" && isNaN(T2.color)) {
          var ce;
          if (typeof T2.color[0] == "number" && T2.color.length > this.counts.length) {
            var se = T2.color.length;
            ce = c.mallocUint8(se);
            for (var he = (T2.color.subarray || T2.color.slice).bind(T2.color), me = 0; me < se; me += 4) ce.set(l(he(me, me + 4), "uint8"), me);
          } else {
            var we = T2.color.length;
            ce = c.mallocUint8(4 * we);
            for (var be = 0; be < we; be++) ce.set(l(T2.color[be] || 0, "uint8"), 4 * be);
          }
          this.color = ce;
        } else this.color = l(T2.color, "uint8");
        if (T2.position || T2.text || T2.color || T2.baseline || T2.align || T2.font || T2.offset || T2.opacity) if (this.color.length > 4 || this.baselineOffset.length > 1 || this.align && this.align.length > 1 || this.fontAtlas.length > 1 || this.positionOffset.length > 2) {
          var Ae = Math.max(0.5 * this.position.length || 0, 0.25 * this.color.length || 0, this.baselineOffset.length || 0, this.alignOffset.length || 0, this.font.length || 0, this.opacity.length || 0, 0.5 * this.positionOffset.length || 0);
          this.batch = Array(Ae);
          for (var pe = 0; pe < this.batch.length; pe++) this.batch[pe] = { count: this.counts.length > 1 ? this.counts[pe] : this.counts[0], offset: this.textOffsets.length > 1 ? this.textOffsets[pe] : this.textOffsets[0], color: this.color ? this.color.length <= 4 ? this.color : this.color.subarray(4 * pe, 4 * pe + 4) : [0, 0, 0, 255], opacity: Array.isArray(this.opacity) ? this.opacity[pe] : this.opacity, baseline: this.baselineOffset[pe] != null ? this.baselineOffset[pe] : this.baselineOffset[0], align: this.align ? this.alignOffset[pe] != null ? this.alignOffset[pe] : this.alignOffset[0] : 0, atlas: this.fontAtlas[pe] || this.fontAtlas[0], positionOffset: this.positionOffset.length > 2 ? this.positionOffset.subarray(2 * pe, 2 * pe + 2) : this.positionOffset };
        } else this.count ? this.batch = [{ count: this.count, offset: 0, color: this.color || [0, 0, 0, 255], opacity: Array.isArray(this.opacity) ? this.opacity[0] : this.opacity, baseline: this.baselineOffset[0], align: this.alignOffset ? this.alignOffset[0] : 0, atlas: this.fontAtlas[0], positionOffset: this.positionOffset }] : this.batch = [];
      }, k.prototype.destroy = function() {
      }, k.prototype.kerning = true, k.prototype.position = { constant: new Float32Array(2) }, k.prototype.translate = null, k.prototype.scale = null, k.prototype.font = null, k.prototype.text = "", k.prototype.positionOffset = [0, 0], k.prototype.opacity = 1, k.prototype.color = new Uint8Array([0, 0, 0, 255]), k.prototype.alignOffset = [0, 0], k.maxAtlasSize = 1024, k.atlasCanvas = document.createElement("canvas"), k.atlasContext = k.atlasCanvas.getContext("2d", { alpha: false }), k.baseFontSize = 64, k.fonts = {}, t.exports = k;
    }, { "bit-twiddle": 81, "color-normalize": 89, "css-font": 99, "detect-kerning": 125, "es6-weak-map": 183, "flatten-vertex-data": 191, "font-atlas": 192, "font-measure": 193, "gl-util/context": 226, "is-plain-obj": 236, "object-assign": 247, "parse-rect": 249, "parse-unit": 251, "pick-by-alias": 253, regl: 283, "to-px": 314, "typedarray-pool": 327 }], 226: [function(e, t, r) {
      (function(n) {
        (function() {
          "use strict";
          var a = e("pick-by-alias");
          function o(l) {
            if (l.container) if (l.container == document.body) document.body.style.width || (l.canvas.width = l.width || l.pixelRatio * n.innerWidth), document.body.style.height || (l.canvas.height = l.height || l.pixelRatio * n.innerHeight);
            else {
              var u2 = l.container.getBoundingClientRect();
              l.canvas.width = l.width || u2.right - u2.left, l.canvas.height = l.height || u2.bottom - u2.top;
            }
          }
          function s(l) {
            return typeof l.getContext == "function" && "width" in l && "height" in l;
          }
          function i() {
            var l = document.createElement("canvas");
            return l.style.position = "absolute", l.style.top = 0, l.style.left = 0, l;
          }
          t.exports = function(l) {
            var u2;
            if (l ? typeof l == "string" && (l = { container: l }) : l = {}, s(l) ? l = { container: l } : l = typeof (u2 = l).nodeName == "string" && typeof u2.appendChild == "function" && typeof u2.getBoundingClientRect == "function" ? { container: l } : function(f) {
              return typeof f.drawArrays == "function" || typeof f.drawElements == "function";
            }(l) ? { gl: l } : a(l, { container: "container target element el canvas holder parent parentNode wrapper use ref root node", gl: "gl context webgl glContext", attrs: "attributes attrs contextAttributes", pixelRatio: "pixelRatio pxRatio px ratio pxratio pixelratio", width: "w width", height: "h height" }, true), l.pixelRatio || (l.pixelRatio = n.pixelRatio || 1), l.gl) return l.gl;
            if (l.canvas && (l.container = l.canvas.parentNode), l.container) {
              if (typeof l.container == "string") {
                var c = document.querySelector(l.container);
                if (!c) throw Error("Element " + l.container + " is not found");
                l.container = c;
              }
              s(l.container) ? (l.canvas = l.container, l.container = l.canvas.parentNode) : l.canvas || (l.canvas = i(), l.container.appendChild(l.canvas), o(l));
            } else if (!l.canvas) {
              if (typeof document > "u") throw Error("Not DOM environment. Use headless-gl.");
              l.container = document.body || document.documentElement, l.canvas = i(), l.container.appendChild(l.canvas), o(l);
            }
            return l.gl || ["webgl", "experimental-webgl", "webgl-experimental"].some(function(f) {
              try {
                l.gl = l.canvas.getContext(f, l.attrs);
              } catch {
              }
              return l.gl;
            }), l.gl;
          };
        }).call(this);
      }).call(this, typeof global < "u" ? global : typeof self < "u" ? self : typeof window < "u" ? window : {});
    }, { "pick-by-alias": 253 }], 227: [function(e, t, r) {
      t.exports = function(n) {
        typeof n == "string" && (n = [n]);
        for (var a = [].slice.call(arguments, 1), o = [], s = 0; s < n.length - 1; s++) o.push(n[s], a[s] || "");
        return o.push(n[s]), o.join("");
      };
    }, {}], 228: [function(e, t, r) {
      (function(n) {
        (function() {
          "use strict";
          var a, o = e("is-browser");
          a = typeof n.matchMedia == "function" ? !n.matchMedia("(hover: none)").matches : o, t.exports = a;
        }).call(this);
      }).call(this, typeof global < "u" ? global : typeof self < "u" ? self : typeof window < "u" ? window : {});
    }, { "is-browser": 232 }], 229: [function(e, t, r) {
      "use strict";
      var n = e("is-browser");
      t.exports = n && function() {
        var a = false;
        try {
          var o = Object.defineProperty({}, "passive", { get: function() {
            a = true;
          } });
          window.addEventListener("test", null, o), window.removeEventListener("test", null, o);
        } catch {
          a = false;
        }
        return a;
      }();
    }, { "is-browser": 232 }], 230: [function(e, t, r) {
      r.read = function(n, a, o, s, i) {
        var l, u2, c = 8 * i - s - 1, f = (1 << c) - 1, h = f >> 1, p = -7, d = o ? i - 1 : 0, v = o ? -1 : 1, m = n[a + d];
        for (d += v, l = m & (1 << -p) - 1, m >>= -p, p += c; p > 0; l = 256 * l + n[a + d], d += v, p -= 8) ;
        for (u2 = l & (1 << -p) - 1, l >>= -p, p += s; p > 0; u2 = 256 * u2 + n[a + d], d += v, p -= 8) ;
        if (l === 0) l = 1 - h;
        else {
          if (l === f) return u2 ? NaN : 1 / 0 * (m ? -1 : 1);
          u2 += Math.pow(2, s), l -= h;
        }
        return (m ? -1 : 1) * u2 * Math.pow(2, l - s);
      }, r.write = function(n, a, o, s, i, l) {
        var u2, c, f, h = 8 * l - i - 1, p = (1 << h) - 1, d = p >> 1, v = i === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, m = s ? 0 : l - 1, g = s ? 1 : -1, x = a < 0 || a === 0 && 1 / a < 0 ? 1 : 0;
        for (a = Math.abs(a), isNaN(a) || a === 1 / 0 ? (c = isNaN(a) ? 1 : 0, u2 = p) : (u2 = Math.floor(Math.log(a) / Math.LN2), a * (f = Math.pow(2, -u2)) < 1 && (u2--, f *= 2), (a += u2 + d >= 1 ? v / f : v * Math.pow(2, 1 - d)) * f >= 2 && (u2++, f /= 2), u2 + d >= p ? (c = 0, u2 = p) : u2 + d >= 1 ? (c = (a * f - 1) * Math.pow(2, i), u2 += d) : (c = a * Math.pow(2, d - 1) * Math.pow(2, i), u2 = 0)); i >= 8; n[o + m] = 255 & c, m += g, c /= 256, i -= 8) ;
        for (u2 = u2 << i | c, h += i; h > 0; n[o + m] = 255 & u2, m += g, u2 /= 256, h -= 8) ;
        n[o + m - g] |= 128 * x;
      };
    }, {}], 231: [function(e, t, r) {
      typeof Object.create == "function" ? t.exports = function(n, a) {
        a && (n.super_ = a, n.prototype = Object.create(a.prototype, { constructor: { value: n, enumerable: false, writable: true, configurable: true } }));
      } : t.exports = function(n, a) {
        if (a) {
          n.super_ = a;
          var o = function() {
          };
          o.prototype = a.prototype, n.prototype = new o(), n.prototype.constructor = n;
        }
      };
    }, {}], 232: [function(e, t, r) {
      t.exports = true;
    }, {}], 233: [function(e, t, r) {
      "use strict";
      t.exports = typeof navigator < "u" && (/MSIE/.test(navigator.userAgent) || /Trident\//.test(navigator.appVersion));
    }, {}], 234: [function(e, t, r) {
      "use strict";
      t.exports = o, t.exports.isMobile = o, t.exports.default = o;
      var n = /(android|bb\d+|meego).+mobile|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|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i, a = /(android|bb\d+|meego).+mobile|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|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino|android|ipad|playbook|silk/i;
      function o(s) {
        s || (s = {});
        var i = s.ua;
        if (i || typeof navigator > "u" || (i = navigator.userAgent), i && i.headers && typeof i.headers["user-agent"] == "string" && (i = i.headers["user-agent"]), typeof i != "string") return false;
        var l = s.tablet ? a.test(i) : n.test(i);
        return !l && s.tablet && s.featureDetect && navigator && navigator.maxTouchPoints > 1 && i.indexOf("Macintosh") !== -1 && i.indexOf("Safari") !== -1 && (l = true), l;
      }
    }, {}], 235: [function(e, t, r) {
      "use strict";
      t.exports = function(n) {
        var a = typeof n;
        return n !== null && (a === "object" || a === "function");
      };
    }, {}], 236: [function(e, t, r) {
      "use strict";
      var n = Object.prototype.toString;
      t.exports = function(a) {
        var o;
        return n.call(a) === "[object Object]" && ((o = Object.getPrototypeOf(a)) === null || o === Object.getPrototypeOf({}));
      };
    }, {}], 237: [function(e, t, r) {
      "use strict";
      t.exports = function(n) {
        for (var a, o = n.length, s = 0; s < o; s++) if (((a = n.charCodeAt(s)) < 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) return false;
        return true;
      };
    }, {}], 238: [function(e, t, r) {
      "use strict";
      t.exports = function(n) {
        return typeof n == "string" && (n = n.trim(), !!(/^[mzlhvcsqta]\s*[-+.0-9][^mlhvzcsqta]+/i.test(n) && /[\dz]$/i.test(n) && n.length > 4));
      };
    }, {}], 239: [function(e, t, r) {
      (function(n, a) {
        typeof r == "object" && t !== void 0 ? t.exports = a() : (n = n || self).mapboxgl = a();
      })(this, function() {
        "use strict";
        var n, a, o;
        function s(i, l) {
          if (n) if (a) {
            var u2 = "var sharedChunk = {}; (" + n + ")(sharedChunk); (" + a + ")(sharedChunk);", c = {};
            n(c), (o = l(c)).workerUrl = window.URL.createObjectURL(new Blob([u2], { type: "text/javascript" }));
          } else a = l;
          else n = l;
        }
        return s(0, function(i) {
          function l(M2, B2) {
            return M2(B2 = { exports: {} }, B2.exports), B2.exports;
          }
          var u2 = c;
          function c(M2, B2, ee, ie) {
            this.cx = 3 * M2, this.bx = 3 * (ee - M2) - this.cx, this.ax = 1 - this.cx - this.bx, this.cy = 3 * B2, this.by = 3 * (ie - B2) - this.cy, this.ay = 1 - this.cy - this.by, this.p1x = M2, this.p1y = ie, this.p2x = ee, this.p2y = ie;
          }
          c.prototype.sampleCurveX = function(M2) {
            return ((this.ax * M2 + this.bx) * M2 + this.cx) * M2;
          }, c.prototype.sampleCurveY = function(M2) {
            return ((this.ay * M2 + this.by) * M2 + this.cy) * M2;
          }, c.prototype.sampleCurveDerivativeX = function(M2) {
            return (3 * this.ax * M2 + 2 * this.bx) * M2 + this.cx;
          }, c.prototype.solveCurveX = function(M2, B2) {
            var ee, ie, ge, _e, Oe;
            for (B2 === void 0 && (B2 = 1e-6), ge = M2, Oe = 0; Oe < 8; Oe++) {
              if (_e = this.sampleCurveX(ge) - M2, Math.abs(_e) < B2) return ge;
              var Xe = this.sampleCurveDerivativeX(ge);
              if (Math.abs(Xe) < 1e-6) break;
              ge -= _e / Xe;
            }
            if ((ge = M2) < (ee = 0)) return ee;
            if (ge > (ie = 1)) return ie;
            for (; ee < ie; ) {
              if (_e = this.sampleCurveX(ge), Math.abs(_e - M2) < B2) return ge;
              M2 > _e ? ee = ge : ie = ge, ge = 0.5 * (ie - ee) + ee;
            }
            return ge;
          }, c.prototype.solve = function(M2, B2) {
            return this.sampleCurveY(this.solveCurveX(M2, B2));
          };
          var f = h;
          function h(M2, B2) {
            this.x = M2, this.y = B2;
          }
          function p(M2, B2, ee, ie) {
            var ge = new u2(M2, B2, ee, ie);
            return function(_e) {
              return ge.solve(_e);
            };
          }
          h.prototype = { clone: function() {
            return new h(this.x, this.y);
          }, add: function(M2) {
            return this.clone()._add(M2);
          }, sub: function(M2) {
            return this.clone()._sub(M2);
          }, multByPoint: function(M2) {
            return this.clone()._multByPoint(M2);
          }, divByPoint: function(M2) {
            return this.clone()._divByPoint(M2);
          }, mult: function(M2) {
            return this.clone()._mult(M2);
          }, div: function(M2) {
            return this.clone()._div(M2);
          }, rotate: function(M2) {
            return this.clone()._rotate(M2);
          }, rotateAround: function(M2, B2) {
            return this.clone()._rotateAround(M2, B2);
          }, matMult: function(M2) {
            return this.clone()._matMult(M2);
          }, unit: function() {
            return this.clone()._unit();
          }, perp: function() {
            return this.clone()._perp();
          }, round: function() {
            return this.clone()._round();
          }, mag: function() {
            return Math.sqrt(this.x * this.x + this.y * this.y);
          }, equals: function(M2) {
            return this.x === M2.x && this.y === M2.y;
          }, dist: function(M2) {
            return Math.sqrt(this.distSqr(M2));
          }, distSqr: function(M2) {
            var B2 = M2.x - this.x, ee = M2.y - this.y;
            return B2 * B2 + ee * ee;
          }, angle: function() {
            return Math.atan2(this.y, this.x);
          }, angleTo: function(M2) {
            return Math.atan2(this.y - M2.y, this.x - M2.x);
          }, angleWith: function(M2) {
            return this.angleWithSep(M2.x, M2.y);
          }, angleWithSep: function(M2, B2) {
            return Math.atan2(this.x * B2 - this.y * M2, this.x * M2 + this.y * B2);
          }, _matMult: function(M2) {
            var B2 = M2[0] * this.x + M2[1] * this.y, ee = M2[2] * this.x + M2[3] * this.y;
            return this.x = B2, this.y = ee, this;
          }, _add: function(M2) {
            return this.x += M2.x, this.y += M2.y, this;
          }, _sub: function(M2) {
            return this.x -= M2.x, this.y -= M2.y, this;
          }, _mult: function(M2) {
            return this.x *= M2, this.y *= M2, this;
          }, _div: function(M2) {
            return this.x /= M2, this.y /= M2, this;
          }, _multByPoint: function(M2) {
            return this.x *= M2.x, this.y *= M2.y, this;
          }, _divByPoint: function(M2) {
            return this.x /= M2.x, this.y /= M2.y, this;
          }, _unit: function() {
            return this._div(this.mag()), this;
          }, _perp: function() {
            var M2 = this.y;
            return this.y = this.x, this.x = -M2, this;
          }, _rotate: function(M2) {
            var B2 = Math.cos(M2), ee = Math.sin(M2), ie = B2 * this.x - ee * this.y, ge = ee * this.x + B2 * this.y;
            return this.x = ie, this.y = ge, this;
          }, _rotateAround: function(M2, B2) {
            var ee = Math.cos(M2), ie = Math.sin(M2), ge = B2.x + ee * (this.x - B2.x) - ie * (this.y - B2.y), _e = B2.y + ie * (this.x - B2.x) + ee * (this.y - B2.y);
            return this.x = ge, this.y = _e, this;
          }, _round: function() {
            return this.x = Math.round(this.x), this.y = Math.round(this.y), this;
          } }, h.convert = function(M2) {
            return M2 instanceof h ? M2 : Array.isArray(M2) ? new h(M2[0], M2[1]) : M2;
          };
          var d = p(0.25, 0.1, 0.25, 1);
          function v(M2, B2, ee) {
            return Math.min(ee, Math.max(B2, M2));
          }
          function m(M2, B2, ee) {
            var ie = ee - B2, ge = ((M2 - B2) % ie + ie) % ie + B2;
            return ge === B2 ? ee : ge;
          }
          function g(M2) {
            for (var B2 = [], ee = arguments.length - 1; ee-- > 0; ) B2[ee] = arguments[ee + 1];
            for (var ie = 0, ge = B2; ie < ge.length; ie += 1) {
              var _e = ge[ie];
              for (var Oe in _e) M2[Oe] = _e[Oe];
            }
            return M2;
          }
          var x = 1;
          function b() {
            return x++;
          }
          function y() {
            return function M2(B2) {
              return B2 ? (B2 ^ 16 * Math.random() >> B2 / 4).toString(16) : ([1e7] + -[1e3] + -4e3 + -8e3 + -1e11).replace(/[018]/g, M2);
            }();
          }
          function w(M2) {
            return !!M2 && /^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(M2);
          }
          function _4(M2, B2) {
            M2.forEach(function(ee) {
              B2[ee] && (B2[ee] = B2[ee].bind(B2));
            });
          }
          function k(M2, B2) {
            return M2.indexOf(B2, M2.length - B2.length) !== -1;
          }
          function T2(M2, B2, ee) {
            var ie = {};
            for (var ge in M2) ie[ge] = B2.call(ee || this, M2[ge], ge, M2);
            return ie;
          }
          function A2(M2, B2, ee) {
            var ie = {};
            for (var ge in M2) B2.call(ee || this, M2[ge], ge, M2) && (ie[ge] = M2[ge]);
            return ie;
          }
          function S2(M2) {
            return Array.isArray(M2) ? M2.map(S2) : typeof M2 == "object" && M2 ? T2(M2, S2) : M2;
          }
          var C2 = {};
          function E2(M2) {
            C2[M2] || (typeof console < "u" && console.warn(M2), C2[M2] = true);
          }
          function F13(M2, B2, ee) {
            return (ee.y - M2.y) * (B2.x - M2.x) > (B2.y - M2.y) * (ee.x - M2.x);
          }
          function N2(M2) {
            for (var B2 = 0, ee = 0, ie = M2.length, ge = ie - 1, _e = void 0, Oe = void 0; ee < ie; ge = ee++) _e = M2[ee], B2 += ((Oe = M2[ge]).x - _e.x) * (_e.y + Oe.y);
            return B2;
          }
          function D2() {
            return typeof WorkerGlobalScope < "u" && typeof self < "u" && self instanceof WorkerGlobalScope;
          }
          function I2(M2) {
            var B2 = {};
            if (M2.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g, function(ie, ge, _e, Oe) {
              var Xe = _e || Oe;
              return B2[ge] = !Xe || Xe.toLowerCase(), "";
            }), B2["max-age"]) {
              var ee = parseInt(B2["max-age"], 10);
              isNaN(ee) ? delete B2["max-age"] : B2["max-age"] = ee;
            }
            return B2;
          }
          var O2 = null;
          function L2(M2) {
            if (O2 == null) {
              var B2 = M2.navigator ? M2.navigator.userAgent : null;
              O2 = !!M2.safari || !(!B2 || !(/\b(iPad|iPhone|iPod)\b/.test(B2) || B2.match("Safari") && !B2.match("Chrome")));
            }
            return O2;
          }
          function V2(M2) {
            try {
              var B2 = self[M2];
              return B2.setItem("_mapbox_test_", 1), B2.removeItem("_mapbox_test_"), true;
            } catch {
              return false;
            }
          }
          var W2, X2, Y2, K2, q = self.performance && self.performance.now ? self.performance.now.bind(self.performance) : Date.now.bind(Date), re = self.requestAnimationFrame || self.mozRequestAnimationFrame || self.webkitRequestAnimationFrame || self.msRequestAnimationFrame, R2 = self.cancelAnimationFrame || self.mozCancelAnimationFrame || self.webkitCancelAnimationFrame || self.msCancelAnimationFrame, z = { now: q, frame: function(M2) {
            var B2 = re(M2);
            return { cancel: function() {
              return R2(B2);
            } };
          }, getImageData: function(M2, B2) {
            B2 === void 0 && (B2 = 0);
            var ee = self.document.createElement("canvas"), ie = ee.getContext("2d");
            if (!ie) throw new Error("failed to create canvas 2d context");
            return ee.width = M2.width, ee.height = M2.height, ie.drawImage(M2, 0, 0, M2.width, M2.height), ie.getImageData(-B2, -B2, M2.width + 2 * B2, M2.height + 2 * B2);
          }, resolveURL: function(M2) {
            return W2 || (W2 = self.document.createElement("a")), W2.href = M2, W2.href;
          }, hardwareConcurrency: self.navigator.hardwareConcurrency || 4, get devicePixelRatio() {
            return self.devicePixelRatio;
          }, get prefersReducedMotion() {
            return !!self.matchMedia && (X2 == null && (X2 = self.matchMedia("(prefers-reduced-motion: reduce)")), X2.matches);
          } }, H2 = { API_URL: "https://api.mapbox.com", get EVENTS_URL() {
            return this.API_URL ? this.API_URL.indexOf("https://api.mapbox.cn") === 0 ? "https://events.mapbox.cn/events/v2" : this.API_URL.indexOf("https://api.mapbox.com") === 0 ? "https://events.mapbox.com/events/v2" : null : null;
          }, FEEDBACK_URL: "https://apps.mapbox.com/feedback", REQUIRE_ACCESS_TOKEN: true, ACCESS_TOKEN: null, MAX_PARALLEL_IMAGE_REQUESTS: 16 }, te = { supported: false, testSupport: function(M2) {
            j || !K2 || (Q2 ? Z2(M2) : Y2 = M2);
          } }, j = false, Q2 = false;
          function Z2(M2) {
            var B2 = M2.createTexture();
            M2.bindTexture(M2.TEXTURE_2D, B2);
            try {
              if (M2.texImage2D(M2.TEXTURE_2D, 0, M2.RGBA, M2.RGBA, M2.UNSIGNED_BYTE, K2), M2.isContextLost()) return;
              te.supported = true;
            } catch {
            }
            M2.deleteTexture(B2), j = true;
          }
          self.document && ((K2 = self.document.createElement("img")).onload = function() {
            Y2 && Z2(Y2), Y2 = null, Q2 = true;
          }, K2.onerror = function() {
            j = true, Y2 = null;
          }, K2.src = "data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");
          var ne = "01", ae = function(M2, B2) {
            this._transformRequestFn = M2, this._customAccessToken = B2, this._createSkuToken();
          };
          function ue(M2) {
            return M2.indexOf("mapbox:") === 0;
          }
          ae.prototype._createSkuToken = function() {
            var M2 = function() {
              for (var B2 = "", ee = 0; ee < 10; ee++) B2 += "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62 * Math.random())];
              return { token: ["1", ne, B2].join(""), tokenExpiresAt: Date.now() + 432e5 };
            }();
            this._skuToken = M2.token, this._skuTokenExpiresAt = M2.tokenExpiresAt;
          }, ae.prototype._isSkuTokenExpired = function() {
            return Date.now() > this._skuTokenExpiresAt;
          }, ae.prototype.transformRequest = function(M2, B2) {
            return this._transformRequestFn && this._transformRequestFn(M2, B2) || { url: M2 };
          }, ae.prototype.normalizeStyleURL = function(M2, B2) {
            if (!ue(M2)) return M2;
            var ee = he(M2);
            return ee.path = "/styles/v1" + ee.path, this._makeAPIURL(ee, this._customAccessToken || B2);
          }, ae.prototype.normalizeGlyphsURL = function(M2, B2) {
            if (!ue(M2)) return M2;
            var ee = he(M2);
            return ee.path = "/fonts/v1" + ee.path, this._makeAPIURL(ee, this._customAccessToken || B2);
          }, ae.prototype.normalizeSourceURL = function(M2, B2) {
            if (!ue(M2)) return M2;
            var ee = he(M2);
            return ee.path = "/v4/" + ee.authority + ".json", ee.params.push("secure"), this._makeAPIURL(ee, this._customAccessToken || B2);
          }, ae.prototype.normalizeSpriteURL = function(M2, B2, ee, ie) {
            var ge = he(M2);
            return ue(M2) ? (ge.path = "/styles/v1" + ge.path + "/sprite" + B2 + ee, this._makeAPIURL(ge, this._customAccessToken || ie)) : (ge.path += "" + B2 + ee, me(ge));
          }, ae.prototype.normalizeTileURL = function(M2, B2) {
            if (this._isSkuTokenExpired() && this._createSkuToken(), M2 && !ue(M2)) return M2;
            var ee = he(M2), ie = z.devicePixelRatio >= 2 || B2 === 512 ? "@2x" : "", ge = te.supported ? ".webp" : "$1";
            ee.path = ee.path.replace(/(\.(png|jpg)\d*)(?=$)/, "" + ie + ge), ee.path = ee.path.replace(/^.+\/v4\//, "/"), ee.path = "/v4" + ee.path;
            var _e = this._customAccessToken || function(Oe) {
              for (var Xe = 0, ht = Oe; Xe < ht.length; Xe += 1) {
                var Tt = ht[Xe].match(/^access_token=(.*)$/);
                if (Tt) return Tt[1];
              }
              return null;
            }(ee.params) || H2.ACCESS_TOKEN;
            return H2.REQUIRE_ACCESS_TOKEN && _e && this._skuToken && ee.params.push("sku=" + this._skuToken), this._makeAPIURL(ee, _e);
          }, ae.prototype.canonicalizeTileURL = function(M2, B2) {
            var ee = he(M2);
            if (!ee.path.match(/(^\/v4\/)/) || !ee.path.match(/\.[\w]+$/)) return M2;
            var ie = "mapbox://tiles/";
            ie += ee.path.replace("/v4/", "");
            var ge = ee.params;
            return B2 && (ge = ge.filter(function(_e) {
              return !_e.match(/^access_token=/);
            })), ge.length && (ie += "?" + ge.join("&")), ie;
          }, ae.prototype.canonicalizeTileset = function(M2, B2) {
            for (var ee = !!B2 && ue(B2), ie = [], ge = 0, _e = M2.tiles || []; ge < _e.length; ge += 1) {
              var Oe = _e[ge];
              ce(Oe) ? ie.push(this.canonicalizeTileURL(Oe, ee)) : ie.push(Oe);
            }
            return ie;
          }, ae.prototype._makeAPIURL = function(M2, B2) {
            var ee = "See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes", ie = he(H2.API_URL);
            if (M2.protocol = ie.protocol, M2.authority = ie.authority, ie.path !== "/" && (M2.path = "" + ie.path + M2.path), !H2.REQUIRE_ACCESS_TOKEN) return me(M2);
            if (!(B2 = B2 || H2.ACCESS_TOKEN)) throw new Error("An API access token is required to use Mapbox GL. " + ee);
            if (B2[0] === "s") throw new Error("Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). " + ee);
            return M2.params = M2.params.filter(function(ge) {
              return ge.indexOf("access_token") === -1;
            }), M2.params.push("access_token=" + B2), me(M2);
          };
          var le = /^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;
          function ce(M2) {
            return le.test(M2);
          }
          var se = /^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;
          function he(M2) {
            var B2 = M2.match(se);
            if (!B2) throw new Error("Unable to parse URL object");
            return { protocol: B2[1], authority: B2[2], path: B2[3] || "/", params: B2[4] ? B2[4].split("&") : [] };
          }
          function me(M2) {
            var B2 = M2.params.length ? "?" + M2.params.join("&") : "";
            return M2.protocol + "://" + M2.authority + M2.path + B2;
          }
          function we(M2) {
            if (!M2) return null;
            var B2, ee = M2.split(".");
            if (!ee || ee.length !== 3) return null;
            try {
              return JSON.parse((B2 = ee[1], decodeURIComponent(self.atob(B2).split("").map(function(ie) {
                return "%" + ("00" + ie.charCodeAt(0).toString(16)).slice(-2);
              }).join(""))));
            } catch {
              return null;
            }
          }
          var be = function(M2) {
            this.type = M2, this.anonId = null, this.eventData = {}, this.queue = [], this.pendingRequest = null;
          };
          be.prototype.getStorageKey = function(M2) {
            var B2, ee = we(H2.ACCESS_TOKEN), ie = "";
            return ee && ee.u ? (B2 = ee.u, ie = self.btoa(encodeURIComponent(B2).replace(/%([0-9A-F]{2})/g, function(ge, _e) {
              return String.fromCharCode(Number("0x" + _e));
            }))) : ie = H2.ACCESS_TOKEN || "", M2 ? "mapbox.eventData." + M2 + ":" + ie : "mapbox.eventData:" + ie;
          }, be.prototype.fetchEventData = function() {
            var M2 = V2("localStorage"), B2 = this.getStorageKey(), ee = this.getStorageKey("uuid");
            if (M2) try {
              var ie = self.localStorage.getItem(B2);
              ie && (this.eventData = JSON.parse(ie));
              var ge = self.localStorage.getItem(ee);
              ge && (this.anonId = ge);
            } catch {
              E2("Unable to read from LocalStorage");
            }
          }, be.prototype.saveEventData = function() {
            var M2 = V2("localStorage"), B2 = this.getStorageKey(), ee = this.getStorageKey("uuid");
            if (M2) try {
              self.localStorage.setItem(ee, this.anonId), Object.keys(this.eventData).length >= 1 && self.localStorage.setItem(B2, JSON.stringify(this.eventData));
            } catch {
              E2("Unable to write to LocalStorage");
            }
          }, be.prototype.processRequests = function(M2) {
          }, be.prototype.postEvent = function(M2, B2, ee, ie) {
            var ge = this;
            if (H2.EVENTS_URL) {
              var _e = he(H2.EVENTS_URL);
              _e.params.push("access_token=" + (ie || H2.ACCESS_TOKEN || ""));
              var Oe = { event: this.type, created: new Date(M2).toISOString(), sdkIdentifier: "mapbox-gl-js", sdkVersion: "1.10.1", skuId: ne, userId: this.anonId }, Xe = B2 ? g(Oe, B2) : Oe, ht = { url: me(_e), headers: { "Content-Type": "text/plain" }, body: JSON.stringify([Xe]) };
              this.pendingRequest = Jt(ht, function(Tt) {
                ge.pendingRequest = null, ee(Tt), ge.saveEventData(), ge.processRequests(ie);
              });
            }
          }, be.prototype.queueRequest = function(M2, B2) {
            this.queue.push(M2), this.processRequests(B2);
          };
          var Ae, pe, ve = function(M2) {
            function B2() {
              M2.call(this, "map.load"), this.success = {}, this.skuToken = "";
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype.postMapLoadEvent = function(ee, ie, ge, _e) {
              this.skuToken = ge, (H2.EVENTS_URL && _e || H2.ACCESS_TOKEN && Array.isArray(ee) && ee.some(function(Oe) {
                return ue(Oe) || ce(Oe);
              })) && this.queueRequest({ id: ie, timestamp: Date.now() }, _e);
            }, B2.prototype.processRequests = function(ee) {
              var ie = this;
              if (!this.pendingRequest && this.queue.length !== 0) {
                var ge = this.queue.shift(), _e = ge.id, Oe = ge.timestamp;
                _e && this.success[_e] || (this.anonId || this.fetchEventData(), w(this.anonId) || (this.anonId = y()), this.postEvent(Oe, { skuToken: this.skuToken }, function(Xe) {
                  Xe || _e && (ie.success[_e] = true);
                }, ee));
              }
            }, B2;
          }(be), Ee = new (function(M2) {
            function B2(ee) {
              M2.call(this, "appUserTurnstile"), this._customAccessToken = ee;
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype.postTurnstileEvent = function(ee, ie) {
              H2.EVENTS_URL && H2.ACCESS_TOKEN && Array.isArray(ee) && ee.some(function(ge) {
                return ue(ge) || ce(ge);
              }) && this.queueRequest(Date.now(), ie);
            }, B2.prototype.processRequests = function(ee) {
              var ie = this;
              if (!this.pendingRequest && this.queue.length !== 0) {
                this.anonId && this.eventData.lastSuccess && this.eventData.tokenU || this.fetchEventData();
                var ge = we(H2.ACCESS_TOKEN), _e = ge ? ge.u : H2.ACCESS_TOKEN, Oe = _e !== this.eventData.tokenU;
                w(this.anonId) || (this.anonId = y(), Oe = true);
                var Xe = this.queue.shift();
                if (this.eventData.lastSuccess) {
                  var ht = new Date(this.eventData.lastSuccess), Tt = new Date(Xe), Dt = (Xe - this.eventData.lastSuccess) / 864e5;
                  Oe = Oe || Dt >= 1 || Dt < -1 || ht.getDate() !== Tt.getDate();
                } else Oe = true;
                if (!Oe) return this.processRequests();
                this.postEvent(Xe, { "enabled.telemetry": false }, function(Xt) {
                  Xt || (ie.eventData.lastSuccess = Xe, ie.eventData.tokenU = _e);
                }, ee);
              }
            }, B2;
          }(be))(), Se = Ee.postTurnstileEvent.bind(Ee), Ce = new ve(), Be = Ce.postMapLoadEvent.bind(Ce), Ue = 500, Ke = 50;
          function ct() {
            self.caches && !Ae && (Ae = self.caches.open("mapbox-tiles"));
          }
          function We(M2, B2, ee) {
            if (ct(), Ae) {
              var ie = { status: B2.status, statusText: B2.statusText, headers: new self.Headers() };
              B2.headers.forEach(function(_e, Oe) {
                return ie.headers.set(Oe, _e);
              });
              var ge = I2(B2.headers.get("Cache-Control") || "");
              ge["no-store"] || (ge["max-age"] && ie.headers.set("Expires", new Date(ee + 1e3 * ge["max-age"]).toUTCString()), new Date(ie.headers.get("Expires")).getTime() - ee < 42e4 || function(_e, Oe) {
                if (pe === void 0) try {
                  new Response(new ReadableStream()), pe = true;
                } catch {
                  pe = false;
                }
                pe ? Oe(_e.body) : _e.blob().then(Oe);
              }(B2, function(_e) {
                var Oe = new self.Response(_e, ie);
                ct(), Ae && Ae.then(function(Xe) {
                  return Xe.put(Ze(M2.url), Oe);
                }).catch(function(Xe) {
                  return E2(Xe.message);
                });
              }));
            }
          }
          function Ze(M2) {
            var B2 = M2.indexOf("?");
            return B2 < 0 ? M2 : M2.slice(0, B2);
          }
          function it(M2, B2) {
            if (ct(), !Ae) return B2(null);
            var ee = Ze(M2.url);
            Ae.then(function(ie) {
              ie.match(ee).then(function(ge) {
                var _e = function(Oe) {
                  if (!Oe) return false;
                  var Xe = new Date(Oe.headers.get("Expires") || 0), ht = I2(Oe.headers.get("Cache-Control") || "");
                  return Xe > Date.now() && !ht["no-cache"];
                }(ge);
                ie.delete(ee), _e && ie.put(ee, ge.clone()), B2(null, ge, _e);
              }).catch(B2);
            }).catch(B2);
          }
          var ot, mt = 1 / 0;
          function wt() {
            return ot == null && (ot = self.OffscreenCanvas && new self.OffscreenCanvas(1, 1).getContext("2d") && typeof self.createImageBitmap == "function"), ot;
          }
          var Et = { Unknown: "Unknown", Style: "Style", Source: "Source", Tile: "Tile", Glyphs: "Glyphs", SpriteImage: "SpriteImage", SpriteJSON: "SpriteJSON", Image: "Image" };
          typeof Object.freeze == "function" && Object.freeze(Et);
          var zt = function(M2) {
            function B2(ee, ie, ge) {
              ie === 401 && ce(ge) && (ee += ": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes"), M2.call(this, ee), this.status = ie, this.url = ge, this.name = this.constructor.name, this.message = ee;
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype.toString = function() {
              return this.name + ": " + this.message + " (" + this.status + "): " + this.url;
            }, B2;
          }(Error), Nt = D2() ? function() {
            return self.worker && self.worker.referrer;
          } : function() {
            return (self.location.protocol === "blob:" ? self.parent : self).location.href;
          };
          function yt(M2, B2) {
            var ee, ie = new self.AbortController(), ge = new self.Request(M2.url, { method: M2.method || "GET", body: M2.body, credentials: M2.credentials, headers: M2.headers, referrer: Nt(), signal: ie.signal }), _e = false, Oe = false, Xe = (ee = ge.url).indexOf("sku=") > 0 && ce(ee);
            M2.type === "json" && ge.headers.set("Accept", "application/json");
            var ht = function(Dt, Xt, ar) {
              if (!Oe) {
                if (Dt && Dt.message !== "SecurityError" && E2(Dt), Xt && ar) return Tt(Xt);
                var er = Date.now();
                self.fetch(ge).then(function(hr) {
                  if (hr.ok) {
                    var Sr = Xe ? hr.clone() : null;
                    return Tt(hr, Sr, er);
                  }
                  return B2(new zt(hr.statusText, hr.status, M2.url));
                }).catch(function(hr) {
                  hr.code !== 20 && B2(new Error(hr.message));
                });
              }
            }, Tt = function(Dt, Xt, ar) {
              (M2.type === "arrayBuffer" ? Dt.arrayBuffer() : M2.type === "json" ? Dt.json() : Dt.text()).then(function(er) {
                Oe || (Xt && ar && We(ge, Xt, ar), _e = true, B2(null, er, Dt.headers.get("Cache-Control"), Dt.headers.get("Expires")));
              }).catch(function(er) {
                Oe || B2(new Error(er.message));
              });
            };
            return Xe ? it(ge, ht) : ht(null, null), { cancel: function() {
              Oe = true, _e || ie.abort();
            } };
          }
          var pt = function(M2, B2) {
            if (ee = M2.url, !(/^file:/.test(ee) || /^file:/.test(Nt()) && !/^\w+:/.test(ee))) {
              if (self.fetch && self.Request && self.AbortController && self.Request.prototype.hasOwnProperty("signal")) return yt(M2, B2);
              if (D2() && self.worker && self.worker.actor) return self.worker.actor.send("getResource", M2, B2, void 0, true);
            }
            var ee;
            return function(ie, ge) {
              var _e = new self.XMLHttpRequest();
              for (var Oe in _e.open(ie.method || "GET", ie.url, true), ie.type === "arrayBuffer" && (_e.responseType = "arraybuffer"), ie.headers) _e.setRequestHeader(Oe, ie.headers[Oe]);
              return ie.type === "json" && (_e.responseType = "text", _e.setRequestHeader("Accept", "application/json")), _e.withCredentials = ie.credentials === "include", _e.onerror = function() {
                ge(new Error(_e.statusText));
              }, _e.onload = function() {
                if ((_e.status >= 200 && _e.status < 300 || _e.status === 0) && _e.response !== null) {
                  var Xe = _e.response;
                  if (ie.type === "json") try {
                    Xe = JSON.parse(_e.response);
                  } catch (ht) {
                    return ge(ht);
                  }
                  ge(null, Xe, _e.getResponseHeader("Cache-Control"), _e.getResponseHeader("Expires"));
                } else ge(new zt(_e.statusText, _e.status, ie.url));
              }, _e.send(ie.body), { cancel: function() {
                return _e.abort();
              } };
            }(M2, B2);
          }, Ot = function(M2, B2) {
            return pt(g(M2, { type: "arrayBuffer" }), B2);
          }, Jt = function(M2, B2) {
            return pt(g(M2, { method: "POST" }), B2);
          }, tr, Ye;
          tr = [], Ye = 0;
          var at = function(M2, B2) {
            if (te.supported && (M2.headers || (M2.headers = {}), M2.headers.accept = "image/webp,*/*"), Ye >= H2.MAX_PARALLEL_IMAGE_REQUESTS) {
              var ee = { requestParameters: M2, callback: B2, cancelled: false, cancel: function() {
                this.cancelled = true;
              } };
              return tr.push(ee), ee;
            }
            Ye++;
            var ie = false, ge = function() {
              if (!ie) for (ie = true, Ye--; tr.length && Ye < H2.MAX_PARALLEL_IMAGE_REQUESTS; ) {
                var Oe = tr.shift(), Xe = Oe.requestParameters, ht = Oe.callback;
                Oe.cancelled || (Oe.cancel = at(Xe, ht).cancel);
              }
            }, _e = Ot(M2, function(Oe, Xe, ht, Tt) {
              ge(), Oe ? B2(Oe) : Xe && (wt() ? function(Dt, Xt) {
                var ar = new self.Blob([new Uint8Array(Dt)], { type: "image/png" });
                self.createImageBitmap(ar).then(function(er) {
                  Xt(null, er);
                }).catch(function(er) {
                  Xt(new Error("Could not load image because of " + er.message + ". Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));
                });
              }(Xe, B2) : function(Dt, Xt, ar, er) {
                var hr = new self.Image(), Sr = self.URL;
                hr.onload = function() {
                  Xt(null, hr), Sr.revokeObjectURL(hr.src);
                }, hr.onerror = function() {
                  return Xt(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."));
                };
                var Ur = new self.Blob([new Uint8Array(Dt)], { type: "image/png" });
                hr.cacheControl = ar, hr.expires = er, hr.src = Dt.byteLength ? Sr.createObjectURL(Ur) : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";
              }(Xe, B2, ht, Tt));
            });
            return { cancel: function() {
              _e.cancel(), ge();
            } };
          };
          function Ge(M2, B2, ee) {
            ee[M2] && ee[M2].indexOf(B2) !== -1 || (ee[M2] = ee[M2] || [], ee[M2].push(B2));
          }
          function st(M2, B2, ee) {
            if (ee && ee[M2]) {
              var ie = ee[M2].indexOf(B2);
              ie !== -1 && ee[M2].splice(ie, 1);
            }
          }
          var Ie = function(M2, B2) {
            B2 === void 0 && (B2 = {}), g(this, B2), this.type = M2;
          }, Pe = function(M2) {
            function B2(ee, ie) {
              ie === void 0 && (ie = {}), M2.call(this, "error", g({ error: ee }, ie));
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2;
          }(Ie), $e = function() {
          };
          $e.prototype.on = function(M2, B2) {
            return this._listeners = this._listeners || {}, Ge(M2, B2, this._listeners), this;
          }, $e.prototype.off = function(M2, B2) {
            return st(M2, B2, this._listeners), st(M2, B2, this._oneTimeListeners), this;
          }, $e.prototype.once = function(M2, B2) {
            return this._oneTimeListeners = this._oneTimeListeners || {}, Ge(M2, B2, this._oneTimeListeners), this;
          }, $e.prototype.fire = function(M2, B2) {
            typeof M2 == "string" && (M2 = new Ie(M2, B2 || {}));
            var ee = M2.type;
            if (this.listens(ee)) {
              M2.target = this;
              for (var ie = 0, ge = this._listeners && this._listeners[ee] ? this._listeners[ee].slice() : []; ie < ge.length; ie += 1) ge[ie].call(this, M2);
              for (var _e = 0, Oe = this._oneTimeListeners && this._oneTimeListeners[ee] ? this._oneTimeListeners[ee].slice() : []; _e < Oe.length; _e += 1) {
                var Xe = Oe[_e];
                st(ee, Xe, this._oneTimeListeners), Xe.call(this, M2);
              }
              var ht = this._eventedParent;
              ht && (g(M2, typeof this._eventedParentData == "function" ? this._eventedParentData() : this._eventedParentData), ht.fire(M2));
            } else M2 instanceof Pe && console.error(M2.error);
            return this;
          }, $e.prototype.listens = function(M2) {
            return this._listeners && this._listeners[M2] && this._listeners[M2].length > 0 || this._oneTimeListeners && this._oneTimeListeners[M2] && this._oneTimeListeners[M2].length > 0 || this._eventedParent && this._eventedParent.listens(M2);
          }, $e.prototype.setEventedParent = function(M2, B2) {
            return this._eventedParent = M2, this._eventedParentData = B2, this;
          };
          var Ve = { $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" }, sources: { required: true, type: "sources" }, sprite: { type: "string" }, 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" }, "*": { 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" }, "*": { 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: {} }, default: "mapbox" }, "*": { type: "*" } }, source_geojson: { type: { required: true, type: "enum", values: { geojson: {} } }, data: { type: "*" }, maxzoom: { type: "number", default: 18 }, attribution: { type: "string" }, buffer: { type: "number", default: 128, maximum: 512, minimum: 0 }, tolerance: { type: "number", default: 0.375 }, cluster: { type: "boolean", default: false }, clusterRadius: { type: "number", default: 50, minimum: 0 }, clusterMaxZoom: { 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"], 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: "number", default: 2, minimum: 0, units: "pixels", requires: ["icon-image"], expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "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: {}, 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-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"], 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": {}, within: {} } }, geometry_type: { type: "enum", values: { Point: {}, LineString: {}, Polygon: {} } }, function: { expression: { type: "expression" }, stops: { type: "array", value: "function_stop" }, base: { type: "number", default: 1, minimum: 0 }, property: { type: "string", default: "$zoom" }, type: { type: "enum", values: { identity: {}, exponential: {}, interval: {}, categorical: {} }, default: "exponential" }, colorSpace: { type: "enum", values: { rgb: {}, lab: {}, hcl: {} }, default: "rgb" }, default: { type: "*", required: false } }, function_stop: { type: "array", minimum: 0, maximum: 24, value: ["number", "color"], length: 2 }, expression: { type: "array", value: "*", minimum: 1 }, expression_name: { type: "enum", values: { let: { group: "Variable binding" }, var: { group: "Variable binding" }, literal: { group: "Types" }, array: { group: "Types" }, at: { group: "Lookup" }, in: { group: "Lookup" }, "index-of": { group: "Lookup" }, slice: { group: "Lookup" }, case: { group: "Decision" }, match: { group: "Decision" }, coalesce: { group: "Decision" }, step: { group: "Ramps, scales, curves" }, interpolate: { group: "Ramps, scales, curves" }, "interpolate-hcl": { group: "Ramps, scales, curves" }, "interpolate-lab": { group: "Ramps, scales, curves" }, ln2: { group: "Math" }, pi: { group: "Math" }, e: { group: "Math" }, typeof: { group: "Types" }, string: { group: "Types" }, number: { group: "Types" }, boolean: { group: "Types" }, object: { group: "Types" }, collator: { group: "Types" }, format: { group: "Types" }, image: { group: "Types" }, "number-format": { group: "Types" }, "to-string": { group: "Types" }, "to-number": { group: "Types" }, "to-boolean": { group: "Types" }, "to-rgba": { group: "Color" }, "to-color": { group: "Types" }, rgb: { group: "Color" }, rgba: { group: "Color" }, get: { group: "Lookup" }, has: { group: "Lookup" }, length: { group: "Lookup" }, properties: { group: "Feature data" }, "feature-state": { group: "Feature data" }, "geometry-type": { group: "Feature data" }, id: { group: "Feature data" }, zoom: { group: "Zoom" }, "heatmap-density": { group: "Heatmap" }, "line-progress": { group: "Feature data" }, accumulated: { group: "Feature data" }, "+": { group: "Math" }, "*": { group: "Math" }, "-": { group: "Math" }, "/": { group: "Math" }, "%": { group: "Math" }, "^": { group: "Math" }, sqrt: { group: "Math" }, log10: { group: "Math" }, ln: { group: "Math" }, log2: { group: "Math" }, sin: { group: "Math" }, cos: { group: "Math" }, tan: { group: "Math" }, asin: { group: "Math" }, acos: { group: "Math" }, atan: { group: "Math" }, min: { group: "Math" }, max: { group: "Math" }, round: { group: "Math" }, abs: { group: "Math" }, ceil: { group: "Math" }, floor: { group: "Math" }, distance: { group: "Math" }, "==": { group: "Decision" }, "!=": { group: "Decision" }, ">": { group: "Decision" }, "<": { group: "Decision" }, ">=": { group: "Decision" }, "<=": { group: "Decision" }, all: { group: "Decision" }, any: { group: "Decision" }, "!": { group: "Decision" }, within: { group: "Decision" }, "is-supported-script": { group: "String" }, upcase: { group: "String" }, downcase: { group: "String" }, concat: { group: "String" }, "resolved-locale": { group: "String" } } }, 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 } }, 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" } } }, ut = function(M2, B2, ee, ie) {
            this.message = (M2 ? M2 + ": " : "") + ee, ie && (this.identifier = ie), B2 != null && B2.__line__ && (this.line = B2.__line__);
          };
          function Re(M2) {
            var B2 = M2.key, ee = M2.value;
            return ee ? [new ut(B2, ee, "constants have been deprecated as of v8")] : [];
          }
          function qe(M2) {
            for (var B2 = [], ee = arguments.length - 1; ee-- > 0; ) B2[ee] = arguments[ee + 1];
            for (var ie = 0, ge = B2; ie < ge.length; ie += 1) {
              var _e = ge[ie];
              for (var Oe in _e) M2[Oe] = _e[Oe];
            }
            return M2;
          }
          function je(M2) {
            return M2 instanceof Number || M2 instanceof String || M2 instanceof Boolean ? M2.valueOf() : M2;
          }
          function rt(M2) {
            if (Array.isArray(M2)) return M2.map(rt);
            if (M2 instanceof Object && !(M2 instanceof Number || M2 instanceof String || M2 instanceof Boolean)) {
              var B2 = {};
              for (var ee in M2) B2[ee] = rt(M2[ee]);
              return B2;
            }
            return je(M2);
          }
          var He = function(M2) {
            function B2(ee, ie) {
              M2.call(this, ie), this.message = ie, this.key = ee;
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2;
          }(Error), xe = function(M2, B2) {
            B2 === void 0 && (B2 = []), this.parent = M2, this.bindings = {};
            for (var ee = 0, ie = B2; ee < ie.length; ee += 1) {
              var ge = ie[ee], _e = ge[0], Oe = ge[1];
              this.bindings[_e] = Oe;
            }
          };
          xe.prototype.concat = function(M2) {
            return new xe(this, M2);
          }, xe.prototype.get = function(M2) {
            if (this.bindings[M2]) return this.bindings[M2];
            if (this.parent) return this.parent.get(M2);
            throw new Error(M2 + " not found in scope.");
          }, xe.prototype.has = function(M2) {
            return !!this.bindings[M2] || !!this.parent && this.parent.has(M2);
          };
          var Ne = { kind: "null" }, ke = { kind: "number" }, Me = { kind: "string" }, Le = { kind: "boolean" }, ze = { kind: "color" }, ft = { kind: "object" }, De = { kind: "value" }, Je = { kind: "collator" }, tt = { kind: "formatted" }, vt = { kind: "resolvedImage" };
          function kt(M2, B2) {
            return { kind: "array", itemType: M2, N: B2 };
          }
          function jt(M2) {
            if (M2.kind === "array") {
              var B2 = jt(M2.itemType);
              return typeof M2.N == "number" ? "array<" + B2 + ", " + M2.N + ">" : M2.itemType.kind === "value" ? "array" : "array<" + B2 + ">";
            }
            return M2.kind;
          }
          var Vt = [Ne, ke, Me, Le, ze, tt, ft, kt(De), vt];
          function Kt(M2, B2) {
            if (B2.kind === "error") return null;
            if (M2.kind === "array") {
              if (B2.kind === "array" && (B2.N === 0 && B2.itemType.kind === "value" || !Kt(M2.itemType, B2.itemType)) && (typeof M2.N != "number" || M2.N === B2.N)) return null;
            } else {
              if (M2.kind === B2.kind) return null;
              if (M2.kind === "value") {
                for (var ee = 0, ie = Vt; ee < ie.length; ee += 1) if (!Kt(ie[ee], B2)) return null;
              }
            }
            return "Expected " + jt(M2) + " but found " + jt(B2) + " instead.";
          }
          function rr(M2, B2) {
            return B2.some(function(ee) {
              return ee.kind === M2.kind;
            });
          }
          function Tr(M2, B2) {
            return B2.some(function(ee) {
              return ee === "null" ? M2 === null : ee === "array" ? Array.isArray(M2) : ee === "object" ? M2 && !Array.isArray(M2) && typeof M2 == "object" : ee === typeof M2;
            });
          }
          var yr = l(function(M2, B2) {
            var ee = { transparent: [0, 0, 0, 0], aliceblue: [240, 248, 255, 1], antiquewhite: [250, 235, 215, 1], aqua: [0, 255, 255, 1], aquamarine: [127, 255, 212, 1], azure: [240, 255, 255, 1], beige: [245, 245, 220, 1], bisque: [255, 228, 196, 1], black: [0, 0, 0, 1], blanchedalmond: [255, 235, 205, 1], blue: [0, 0, 255, 1], blueviolet: [138, 43, 226, 1], brown: [165, 42, 42, 1], burlywood: [222, 184, 135, 1], cadetblue: [95, 158, 160, 1], chartreuse: [127, 255, 0, 1], chocolate: [210, 105, 30, 1], coral: [255, 127, 80, 1], cornflowerblue: [100, 149, 237, 1], cornsilk: [255, 248, 220, 1], crimson: [220, 20, 60, 1], cyan: [0, 255, 255, 1], darkblue: [0, 0, 139, 1], darkcyan: [0, 139, 139, 1], darkgoldenrod: [184, 134, 11, 1], darkgray: [169, 169, 169, 1], darkgreen: [0, 100, 0, 1], darkgrey: [169, 169, 169, 1], darkkhaki: [189, 183, 107, 1], darkmagenta: [139, 0, 139, 1], darkolivegreen: [85, 107, 47, 1], darkorange: [255, 140, 0, 1], darkorchid: [153, 50, 204, 1], darkred: [139, 0, 0, 1], darksalmon: [233, 150, 122, 1], darkseagreen: [143, 188, 143, 1], darkslateblue: [72, 61, 139, 1], darkslategray: [47, 79, 79, 1], darkslategrey: [47, 79, 79, 1], darkturquoise: [0, 206, 209, 1], darkviolet: [148, 0, 211, 1], deeppink: [255, 20, 147, 1], deepskyblue: [0, 191, 255, 1], dimgray: [105, 105, 105, 1], dimgrey: [105, 105, 105, 1], dodgerblue: [30, 144, 255, 1], firebrick: [178, 34, 34, 1], floralwhite: [255, 250, 240, 1], forestgreen: [34, 139, 34, 1], fuchsia: [255, 0, 255, 1], gainsboro: [220, 220, 220, 1], ghostwhite: [248, 248, 255, 1], gold: [255, 215, 0, 1], goldenrod: [218, 165, 32, 1], gray: [128, 128, 128, 1], green: [0, 128, 0, 1], greenyellow: [173, 255, 47, 1], grey: [128, 128, 128, 1], honeydew: [240, 255, 240, 1], hotpink: [255, 105, 180, 1], indianred: [205, 92, 92, 1], indigo: [75, 0, 130, 1], ivory: [255, 255, 240, 1], khaki: [240, 230, 140, 1], lavender: [230, 230, 250, 1], lavenderblush: [255, 240, 245, 1], lawngreen: [124, 252, 0, 1], lemonchiffon: [255, 250, 205, 1], lightblue: [173, 216, 230, 1], lightcoral: [240, 128, 128, 1], lightcyan: [224, 255, 255, 1], lightgoldenrodyellow: [250, 250, 210, 1], lightgray: [211, 211, 211, 1], lightgreen: [144, 238, 144, 1], lightgrey: [211, 211, 211, 1], lightpink: [255, 182, 193, 1], lightsalmon: [255, 160, 122, 1], lightseagreen: [32, 178, 170, 1], lightskyblue: [135, 206, 250, 1], lightslategray: [119, 136, 153, 1], lightslategrey: [119, 136, 153, 1], lightsteelblue: [176, 196, 222, 1], lightyellow: [255, 255, 224, 1], lime: [0, 255, 0, 1], limegreen: [50, 205, 50, 1], linen: [250, 240, 230, 1], magenta: [255, 0, 255, 1], maroon: [128, 0, 0, 1], mediumaquamarine: [102, 205, 170, 1], mediumblue: [0, 0, 205, 1], mediumorchid: [186, 85, 211, 1], mediumpurple: [147, 112, 219, 1], mediumseagreen: [60, 179, 113, 1], mediumslateblue: [123, 104, 238, 1], mediumspringgreen: [0, 250, 154, 1], mediumturquoise: [72, 209, 204, 1], mediumvioletred: [199, 21, 133, 1], midnightblue: [25, 25, 112, 1], mintcream: [245, 255, 250, 1], mistyrose: [255, 228, 225, 1], moccasin: [255, 228, 181, 1], navajowhite: [255, 222, 173, 1], navy: [0, 0, 128, 1], oldlace: [253, 245, 230, 1], olive: [128, 128, 0, 1], olivedrab: [107, 142, 35, 1], orange: [255, 165, 0, 1], orangered: [255, 69, 0, 1], orchid: [218, 112, 214, 1], palegoldenrod: [238, 232, 170, 1], palegreen: [152, 251, 152, 1], paleturquoise: [175, 238, 238, 1], palevioletred: [219, 112, 147, 1], papayawhip: [255, 239, 213, 1], peachpuff: [255, 218, 185, 1], peru: [205, 133, 63, 1], pink: [255, 192, 203, 1], plum: [221, 160, 221, 1], powderblue: [176, 224, 230, 1], purple: [128, 0, 128, 1], rebeccapurple: [102, 51, 153, 1], red: [255, 0, 0, 1], rosybrown: [188, 143, 143, 1], royalblue: [65, 105, 225, 1], saddlebrown: [139, 69, 19, 1], salmon: [250, 128, 114, 1], sandybrown: [244, 164, 96, 1], seagreen: [46, 139, 87, 1], seashell: [255, 245, 238, 1], sienna: [160, 82, 45, 1], silver: [192, 192, 192, 1], skyblue: [135, 206, 235, 1], slateblue: [106, 90, 205, 1], slategray: [112, 128, 144, 1], slategrey: [112, 128, 144, 1], snow: [255, 250, 250, 1], springgreen: [0, 255, 127, 1], steelblue: [70, 130, 180, 1], tan: [210, 180, 140, 1], teal: [0, 128, 128, 1], thistle: [216, 191, 216, 1], tomato: [255, 99, 71, 1], turquoise: [64, 224, 208, 1], violet: [238, 130, 238, 1], wheat: [245, 222, 179, 1], white: [255, 255, 255, 1], whitesmoke: [245, 245, 245, 1], yellow: [255, 255, 0, 1], yellowgreen: [154, 205, 50, 1] };
            function ie(ht) {
              return (ht = Math.round(ht)) < 0 ? 0 : ht > 255 ? 255 : ht;
            }
            function ge(ht) {
              return ht < 0 ? 0 : ht > 1 ? 1 : ht;
            }
            function _e(ht) {
              return ht[ht.length - 1] === "%" ? ie(parseFloat(ht) / 100 * 255) : ie(parseInt(ht));
            }
            function Oe(ht) {
              return ht[ht.length - 1] === "%" ? ge(parseFloat(ht) / 100) : ge(parseFloat(ht));
            }
            function Xe(ht, Tt, Dt) {
              return Dt < 0 ? Dt += 1 : Dt > 1 && (Dt -= 1), 6 * Dt < 1 ? ht + (Tt - ht) * Dt * 6 : 2 * Dt < 1 ? Tt : 3 * Dt < 2 ? ht + (Tt - ht) * (2 / 3 - Dt) * 6 : ht;
            }
            try {
              B2.parseCSSColor = function(ht) {
                var Tt, Dt = ht.replace(/ /g, "").toLowerCase();
                if (Dt in ee) return ee[Dt].slice();
                if (Dt[0] === "#") return Dt.length === 4 ? (Tt = parseInt(Dt.substr(1), 16)) >= 0 && Tt <= 4095 ? [(3840 & Tt) >> 4 | (3840 & Tt) >> 8, 240 & Tt | (240 & Tt) >> 4, 15 & Tt | (15 & Tt) << 4, 1] : null : Dt.length === 7 && (Tt = parseInt(Dt.substr(1), 16)) >= 0 && Tt <= 16777215 ? [(16711680 & Tt) >> 16, (65280 & Tt) >> 8, 255 & Tt, 1] : null;
                var Xt = Dt.indexOf("("), ar = Dt.indexOf(")");
                if (Xt !== -1 && ar + 1 === Dt.length) {
                  var er = Dt.substr(0, Xt), hr = Dt.substr(Xt + 1, ar - (Xt + 1)).split(","), Sr = 1;
                  switch (er) {
                    case "rgba":
                      if (hr.length !== 4) return null;
                      Sr = Oe(hr.pop());
                    case "rgb":
                      return hr.length !== 3 ? null : [_e(hr[0]), _e(hr[1]), _e(hr[2]), Sr];
                    case "hsla":
                      if (hr.length !== 4) return null;
                      Sr = Oe(hr.pop());
                    case "hsl":
                      if (hr.length !== 3) return null;
                      var Ur = (parseFloat(hr[0]) % 360 + 360) % 360 / 360, Br = Oe(hr[1]), rn = Oe(hr[2]), nn = rn <= 0.5 ? rn * (Br + 1) : rn + Br - rn * Br, cn = 2 * rn - nn;
                      return [ie(255 * Xe(cn, nn, Ur + 1 / 3)), ie(255 * Xe(cn, nn, Ur)), ie(255 * Xe(cn, nn, Ur - 1 / 3)), Sr];
                    default:
                      return null;
                  }
                }
                return null;
              };
            } catch {
            }
          }).parseCSSColor, pr = function(M2, B2, ee, ie) {
            ie === void 0 && (ie = 1), this.r = M2, this.g = B2, this.b = ee, this.a = ie;
          };
          pr.parse = function(M2) {
            if (M2) {
              if (M2 instanceof pr) return M2;
              if (typeof M2 == "string") {
                var B2 = yr(M2);
                if (B2) return new pr(B2[0] / 255 * B2[3], B2[1] / 255 * B2[3], B2[2] / 255 * B2[3], B2[3]);
              }
            }
          }, pr.prototype.toString = function() {
            var M2 = this.toArray(), B2 = M2[0], ee = M2[1], ie = M2[2], ge = M2[3];
            return "rgba(" + Math.round(B2) + "," + Math.round(ee) + "," + Math.round(ie) + "," + ge + ")";
          }, pr.prototype.toArray = function() {
            var M2 = this.r, B2 = this.g, ee = this.b, ie = this.a;
            return ie === 0 ? [0, 0, 0, 0] : [255 * M2 / ie, 255 * B2 / ie, 255 * ee / ie, ie];
          }, pr.black = new pr(0, 0, 0, 1), pr.white = new pr(1, 1, 1, 1), pr.transparent = new pr(0, 0, 0, 0), pr.red = new pr(1, 0, 0, 1);
          var lr = function(M2, B2, ee) {
            this.sensitivity = M2 ? B2 ? "variant" : "case" : B2 ? "accent" : "base", this.locale = ee, this.collator = new Intl.Collator(this.locale ? this.locale : [], { sensitivity: this.sensitivity, usage: "search" });
          };
          lr.prototype.compare = function(M2, B2) {
            return this.collator.compare(M2, B2);
          }, lr.prototype.resolvedLocale = function() {
            return new Intl.Collator(this.locale ? this.locale : []).resolvedOptions().locale;
          };
          var _r = function(M2, B2, ee, ie, ge) {
            this.text = M2, this.image = B2, this.scale = ee, this.fontStack = ie, this.textColor = ge;
          }, $r = function(M2) {
            this.sections = M2;
          };
          $r.fromString = function(M2) {
            return new $r([new _r(M2, null, null, null, null)]);
          }, $r.prototype.isEmpty = function() {
            return this.sections.length === 0 || !this.sections.some(function(M2) {
              return M2.text.length !== 0 || M2.image && M2.image.name.length !== 0;
            });
          }, $r.factory = function(M2) {
            return M2 instanceof $r ? M2 : $r.fromString(M2);
          }, $r.prototype.toString = function() {
            return this.sections.length === 0 ? "" : this.sections.map(function(M2) {
              return M2.text;
            }).join("");
          }, $r.prototype.serialize = function() {
            for (var M2 = ["format"], B2 = 0, ee = this.sections; B2 < ee.length; B2 += 1) {
              var ie = ee[B2];
              if (ie.image) M2.push(["image", ie.image.name]);
              else {
                M2.push(ie.text);
                var ge = {};
                ie.fontStack && (ge["text-font"] = ["literal", ie.fontStack.split(",")]), ie.scale && (ge["font-scale"] = ie.scale), ie.textColor && (ge["text-color"] = ["rgba"].concat(ie.textColor.toArray())), M2.push(ge);
              }
            }
            return M2;
          };
          var Ar = function(M2) {
            this.name = M2.name, this.available = M2.available;
          };
          function Qr(M2, B2, ee, ie) {
            return typeof M2 == "number" && M2 >= 0 && M2 <= 255 && typeof B2 == "number" && B2 >= 0 && B2 <= 255 && typeof ee == "number" && ee >= 0 && ee <= 255 ? ie === void 0 || typeof ie == "number" && ie >= 0 && ie <= 1 ? null : "Invalid rgba value [" + [M2, B2, ee, ie].join(", ") + "]: 'a' must be between 0 and 1." : "Invalid rgba value [" + (typeof ie == "number" ? [M2, B2, ee, ie] : [M2, B2, ee]).join(", ") + "]: 'r', 'g', and 'b' must be between 0 and 255.";
          }
          function hn(M2) {
            if (M2 === null || typeof M2 == "string" || typeof M2 == "boolean" || typeof M2 == "number" || M2 instanceof pr || M2 instanceof lr || M2 instanceof $r || M2 instanceof Ar) return true;
            if (Array.isArray(M2)) {
              for (var B2 = 0, ee = M2; B2 < ee.length; B2 += 1) if (!hn(ee[B2])) return false;
              return true;
            }
            if (typeof M2 == "object") {
              for (var ie in M2) if (!hn(M2[ie])) return false;
              return true;
            }
            return false;
          }
          function wn(M2) {
            if (M2 === null) return Ne;
            if (typeof M2 == "string") return Me;
            if (typeof M2 == "boolean") return Le;
            if (typeof M2 == "number") return ke;
            if (M2 instanceof pr) return ze;
            if (M2 instanceof lr) return Je;
            if (M2 instanceof $r) return tt;
            if (M2 instanceof Ar) return vt;
            if (Array.isArray(M2)) {
              for (var B2, ee = M2.length, ie = 0, ge = M2; ie < ge.length; ie += 1) {
                var _e = wn(ge[ie]);
                if (B2) {
                  if (B2 === _e) continue;
                  B2 = De;
                  break;
                }
                B2 = _e;
              }
              return kt(B2 || De, ee);
            }
            return ft;
          }
          function Yn(M2) {
            var B2 = typeof M2;
            return M2 === null ? "" : B2 === "string" || B2 === "number" || B2 === "boolean" ? String(M2) : M2 instanceof pr || M2 instanceof $r || M2 instanceof Ar ? M2.toString() : JSON.stringify(M2);
          }
          Ar.prototype.toString = function() {
            return this.name;
          }, Ar.fromString = function(M2) {
            return M2 ? new Ar({ name: M2, available: false }) : null;
          }, Ar.prototype.serialize = function() {
            return ["image", this.name];
          };
          var Xn = function(M2, B2) {
            this.type = M2, this.value = B2;
          };
          Xn.parse = function(M2, B2) {
            if (M2.length !== 2) return B2.error("'literal' expression requires exactly one argument, but found " + (M2.length - 1) + " instead.");
            if (!hn(M2[1])) return B2.error("invalid value");
            var ee = M2[1], ie = wn(ee), ge = B2.expectedType;
            return ie.kind !== "array" || ie.N !== 0 || !ge || ge.kind !== "array" || typeof ge.N == "number" && ge.N !== 0 || (ie = ge), new Xn(ie, ee);
          }, Xn.prototype.evaluate = function() {
            return this.value;
          }, Xn.prototype.eachChild = function() {
          }, Xn.prototype.outputDefined = function() {
            return true;
          }, Xn.prototype.serialize = function() {
            return this.type.kind === "array" || this.type.kind === "object" ? ["literal", this.value] : this.value instanceof pr ? ["rgba"].concat(this.value.toArray()) : this.value instanceof $r ? this.value.serialize() : this.value;
          };
          var Wn = function(M2) {
            this.name = "ExpressionEvaluationError", this.message = M2;
          };
          Wn.prototype.toJSON = function() {
            return this.message;
          };
          var _n = { string: Me, number: ke, boolean: Le, object: ft }, qr = function(M2, B2) {
            this.type = M2, this.args = B2;
          };
          qr.parse = function(M2, B2) {
            if (M2.length < 2) return B2.error("Expected at least one argument.");
            var ee, ie = 1, ge = M2[0];
            if (ge === "array") {
              var _e, Oe;
              if (M2.length > 2) {
                var Xe = M2[1];
                if (typeof Xe != "string" || !(Xe in _n) || Xe === "object") return B2.error('The item type argument of "array" must be one of string, number, boolean', 1);
                _e = _n[Xe], ie++;
              } else _e = De;
              if (M2.length > 3) {
                if (M2[2] !== null && (typeof M2[2] != "number" || M2[2] < 0 || M2[2] !== Math.floor(M2[2]))) return B2.error('The length argument to "array" must be a positive integer literal', 2);
                Oe = M2[2], ie++;
              }
              ee = kt(_e, Oe);
            } else ee = _n[ge];
            for (var ht = []; ie < M2.length; ie++) {
              var Tt = B2.parse(M2[ie], ie, De);
              if (!Tt) return null;
              ht.push(Tt);
            }
            return new qr(ee, ht);
          }, qr.prototype.evaluate = function(M2) {
            for (var B2 = 0; B2 < this.args.length; B2++) {
              var ee = this.args[B2].evaluate(M2);
              if (!Kt(this.type, wn(ee))) return ee;
              if (B2 === this.args.length - 1) throw new Wn("Expected value to be of type " + jt(this.type) + ", but found " + jt(wn(ee)) + " instead.");
            }
            return null;
          }, qr.prototype.eachChild = function(M2) {
            this.args.forEach(M2);
          }, qr.prototype.outputDefined = function() {
            return this.args.every(function(M2) {
              return M2.outputDefined();
            });
          }, qr.prototype.serialize = function() {
            var M2 = this.type, B2 = [M2.kind];
            if (M2.kind === "array") {
              var ee = M2.itemType;
              if (ee.kind === "string" || ee.kind === "number" || ee.kind === "boolean") {
                B2.push(ee.kind);
                var ie = M2.N;
                (typeof ie == "number" || this.args.length > 1) && B2.push(ie);
              }
            }
            return B2.concat(this.args.map(function(ge) {
              return ge.serialize();
            }));
          };
          var Nr = function(M2) {
            this.type = tt, this.sections = M2;
          };
          Nr.parse = function(M2, B2) {
            if (M2.length < 2) return B2.error("Expected at least one argument.");
            var ee = M2[1];
            if (!Array.isArray(ee) && typeof ee == "object") return B2.error("First argument must be an image or text section.");
            for (var ie = [], ge = false, _e = 1; _e <= M2.length - 1; ++_e) {
              var Oe = M2[_e];
              if (ge && typeof Oe == "object" && !Array.isArray(Oe)) {
                ge = false;
                var Xe = null;
                if (Oe["font-scale"] && !(Xe = B2.parse(Oe["font-scale"], 1, ke))) return null;
                var ht = null;
                if (Oe["text-font"] && !(ht = B2.parse(Oe["text-font"], 1, kt(Me)))) return null;
                var Tt = null;
                if (Oe["text-color"] && !(Tt = B2.parse(Oe["text-color"], 1, ze))) return null;
                var Dt = ie[ie.length - 1];
                Dt.scale = Xe, Dt.font = ht, Dt.textColor = Tt;
              } else {
                var Xt = B2.parse(M2[_e], 1, De);
                if (!Xt) return null;
                var ar = Xt.type.kind;
                if (ar !== "string" && ar !== "value" && ar !== "null" && ar !== "resolvedImage") return B2.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");
                ge = true, ie.push({ content: Xt, scale: null, font: null, textColor: null });
              }
            }
            return new Nr(ie);
          }, Nr.prototype.evaluate = function(M2) {
            return new $r(this.sections.map(function(B2) {
              var ee = B2.content.evaluate(M2);
              return wn(ee) === vt ? new _r("", ee, null, null, null) : new _r(Yn(ee), null, B2.scale ? B2.scale.evaluate(M2) : null, B2.font ? B2.font.evaluate(M2).join(",") : null, B2.textColor ? B2.textColor.evaluate(M2) : null);
            }));
          }, Nr.prototype.eachChild = function(M2) {
            for (var B2 = 0, ee = this.sections; B2 < ee.length; B2 += 1) {
              var ie = ee[B2];
              M2(ie.content), ie.scale && M2(ie.scale), ie.font && M2(ie.font), ie.textColor && M2(ie.textColor);
            }
          }, Nr.prototype.outputDefined = function() {
            return false;
          }, Nr.prototype.serialize = function() {
            for (var M2 = ["format"], B2 = 0, ee = this.sections; B2 < ee.length; B2 += 1) {
              var ie = ee[B2];
              M2.push(ie.content.serialize());
              var ge = {};
              ie.scale && (ge["font-scale"] = ie.scale.serialize()), ie.font && (ge["text-font"] = ie.font.serialize()), ie.textColor && (ge["text-color"] = ie.textColor.serialize()), M2.push(ge);
            }
            return M2;
          };
          var Zr = function(M2) {
            this.type = vt, this.input = M2;
          };
          Zr.parse = function(M2, B2) {
            if (M2.length !== 2) return B2.error("Expected two arguments.");
            var ee = B2.parse(M2[1], 1, Me);
            return ee ? new Zr(ee) : B2.error("No image name provided.");
          }, Zr.prototype.evaluate = function(M2) {
            var B2 = this.input.evaluate(M2), ee = Ar.fromString(B2);
            return ee && M2.availableImages && (ee.available = M2.availableImages.indexOf(B2) > -1), ee;
          }, Zr.prototype.eachChild = function(M2) {
            M2(this.input);
          }, Zr.prototype.outputDefined = function() {
            return false;
          }, Zr.prototype.serialize = function() {
            return ["image", this.input.serialize()];
          };
          var oa = { "to-boolean": Le, "to-color": ze, "to-number": ke, "to-string": Me }, tn = function(M2, B2) {
            this.type = M2, this.args = B2;
          };
          tn.parse = function(M2, B2) {
            if (M2.length < 2) return B2.error("Expected at least one argument.");
            var ee = M2[0];
            if ((ee === "to-boolean" || ee === "to-string") && M2.length !== 2) return B2.error("Expected one argument.");
            for (var ie = oa[ee], ge = [], _e = 1; _e < M2.length; _e++) {
              var Oe = B2.parse(M2[_e], _e, De);
              if (!Oe) return null;
              ge.push(Oe);
            }
            return new tn(ie, ge);
          }, tn.prototype.evaluate = function(M2) {
            if (this.type.kind === "boolean") return Boolean(this.args[0].evaluate(M2));
            if (this.type.kind === "color") {
              for (var B2, ee, ie = 0, ge = this.args; ie < ge.length; ie += 1) {
                if (ee = null, (B2 = ge[ie].evaluate(M2)) instanceof pr) return B2;
                if (typeof B2 == "string") {
                  var _e = M2.parseColor(B2);
                  if (_e) return _e;
                } else if (Array.isArray(B2) && !(ee = B2.length < 3 || B2.length > 4 ? "Invalid rbga value " + JSON.stringify(B2) + ": expected an array containing either three or four numeric values." : Qr(B2[0], B2[1], B2[2], B2[3]))) return new pr(B2[0] / 255, B2[1] / 255, B2[2] / 255, B2[3]);
              }
              throw new Wn(ee || "Could not parse color from value '" + (typeof B2 == "string" ? B2 : String(JSON.stringify(B2))) + "'");
            }
            if (this.type.kind === "number") {
              for (var Oe = null, Xe = 0, ht = this.args; Xe < ht.length; Xe += 1) {
                if ((Oe = ht[Xe].evaluate(M2)) === null) return 0;
                var Tt = Number(Oe);
                if (!isNaN(Tt)) return Tt;
              }
              throw new Wn("Could not convert " + JSON.stringify(Oe) + " to number.");
            }
            return this.type.kind === "formatted" ? $r.fromString(Yn(this.args[0].evaluate(M2))) : this.type.kind === "resolvedImage" ? Ar.fromString(Yn(this.args[0].evaluate(M2))) : Yn(this.args[0].evaluate(M2));
          }, tn.prototype.eachChild = function(M2) {
            this.args.forEach(M2);
          }, tn.prototype.outputDefined = function() {
            return this.args.every(function(M2) {
              return M2.outputDefined();
            });
          }, tn.prototype.serialize = function() {
            if (this.type.kind === "formatted") return new Nr([{ content: this.args[0], scale: null, font: null, textColor: null }]).serialize();
            if (this.type.kind === "resolvedImage") return new Zr(this.args[0]).serialize();
            var M2 = ["to-" + this.type.kind];
            return this.eachChild(function(B2) {
              M2.push(B2.serialize());
            }), M2;
          };
          var Zn = ["Unknown", "Point", "LineString", "Polygon"], Ln = function() {
            this.globals = null, this.feature = null, this.featureState = null, this.formattedSection = null, this._parseColorCache = {}, this.availableImages = null, this.canonical = null;
          };
          Ln.prototype.id = function() {
            return this.feature && "id" in this.feature ? this.feature.id : null;
          }, Ln.prototype.geometryType = function() {
            return this.feature ? typeof this.feature.type == "number" ? Zn[this.feature.type] : this.feature.type : null;
          }, Ln.prototype.geometry = function() {
            return this.feature && "geometry" in this.feature ? this.feature.geometry : null;
          }, Ln.prototype.canonicalID = function() {
            return this.canonical;
          }, Ln.prototype.properties = function() {
            return this.feature && this.feature.properties || {};
          }, Ln.prototype.parseColor = function(M2) {
            var B2 = this._parseColorCache[M2];
            return B2 || (B2 = this._parseColorCache[M2] = pr.parse(M2)), B2;
          };
          var gn = function(M2, B2, ee, ie) {
            this.name = M2, this.type = B2, this._evaluate = ee, this.args = ie;
          };
          gn.prototype.evaluate = function(M2) {
            return this._evaluate(M2, this.args);
          }, gn.prototype.eachChild = function(M2) {
            this.args.forEach(M2);
          }, gn.prototype.outputDefined = function() {
            return false;
          }, gn.prototype.serialize = function() {
            return [this.name].concat(this.args.map(function(M2) {
              return M2.serialize();
            }));
          }, gn.parse = function(M2, B2) {
            var ee, ie = M2[0], ge = gn.definitions[ie];
            if (!ge) return B2.error('Unknown expression "' + ie + '". If you wanted a literal array, use ["literal", [...]].', 0);
            for (var _e = Array.isArray(ge) ? ge[0] : ge.type, Oe = Array.isArray(ge) ? [[ge[1], ge[2]]] : ge.overloads, Xe = Oe.filter(function($a) {
              var Ea = $a[0];
              return !Array.isArray(Ea) || Ea.length === M2.length - 1;
            }), ht = null, Tt = 0, Dt = Xe; Tt < Dt.length; Tt += 1) {
              var Xt = Dt[Tt], ar = Xt[0], er = Xt[1];
              ht = new Rn(B2.registry, B2.path, null, B2.scope);
              for (var hr = [], Sr = false, Ur = 1; Ur < M2.length; Ur++) {
                var Br = M2[Ur], rn = Array.isArray(ar) ? ar[Ur - 1] : ar.type, nn = ht.parse(Br, 1 + hr.length, rn);
                if (!nn) {
                  Sr = true;
                  break;
                }
                hr.push(nn);
              }
              if (!Sr) if (Array.isArray(ar) && ar.length !== hr.length) ht.error("Expected " + ar.length + " arguments, but found " + hr.length + " instead.");
              else {
                for (var cn = 0; cn < hr.length; cn++) {
                  var In = Array.isArray(ar) ? ar[cn] : ar.type, Un = hr[cn];
                  ht.concat(cn + 1).checkSubtype(In, Un.type);
                }
                if (ht.errors.length === 0) return new gn(ie, _e, er, hr);
              }
            }
            if (Xe.length === 1) (ee = B2.errors).push.apply(ee, ht.errors);
            else {
              for (var ha = (Xe.length ? Xe : Oe).map(function($a) {
                var Ea, oi = $a[0];
                return Ea = oi, Array.isArray(Ea) ? "(" + Ea.map(jt).join(", ") + ")" : "(" + jt(Ea.type) + "...)";
              }).join(" | "), fa = [], wa = 1; wa < M2.length; wa++) {
                var Wa = B2.parse(M2[wa], 1 + fa.length);
                if (!Wa) return null;
                fa.push(jt(Wa.type));
              }
              B2.error("Expected arguments of type " + ha + ", but found (" + fa.join(", ") + ") instead.");
            }
            return null;
          }, gn.register = function(M2, B2) {
            for (var ee in gn.definitions = B2, B2) M2[ee] = gn;
          };
          var na = function(M2, B2, ee) {
            this.type = Je, this.locale = ee, this.caseSensitive = M2, this.diacriticSensitive = B2;
          };
          na.parse = function(M2, B2) {
            if (M2.length !== 2) return B2.error("Expected one argument.");
            var ee = M2[1];
            if (typeof ee != "object" || Array.isArray(ee)) return B2.error("Collator options argument must be an object.");
            var ie = B2.parse(ee["case-sensitive"] !== void 0 && ee["case-sensitive"], 1, Le);
            if (!ie) return null;
            var ge = B2.parse(ee["diacritic-sensitive"] !== void 0 && ee["diacritic-sensitive"], 1, Le);
            if (!ge) return null;
            var _e = null;
            return ee.locale && !(_e = B2.parse(ee.locale, 1, Me)) ? null : new na(ie, ge, _e);
          }, na.prototype.evaluate = function(M2) {
            return new lr(this.caseSensitive.evaluate(M2), this.diacriticSensitive.evaluate(M2), this.locale ? this.locale.evaluate(M2) : null);
          }, na.prototype.eachChild = function(M2) {
            M2(this.caseSensitive), M2(this.diacriticSensitive), this.locale && M2(this.locale);
          }, na.prototype.outputDefined = function() {
            return false;
          }, na.prototype.serialize = function() {
            var M2 = {};
            return M2["case-sensitive"] = this.caseSensitive.serialize(), M2["diacritic-sensitive"] = this.diacriticSensitive.serialize(), this.locale && (M2.locale = this.locale.serialize()), ["collator", M2];
          };
          function sr(M2, B2) {
            M2[0] = Math.min(M2[0], B2[0]), M2[1] = Math.min(M2[1], B2[1]), M2[2] = Math.max(M2[2], B2[0]), M2[3] = Math.max(M2[3], B2[1]);
          }
          function Ut(M2, B2) {
            return !(M2[0] <= B2[0]) && !(M2[2] >= B2[2]) && !(M2[1] <= B2[1]) && !(M2[3] >= B2[3]);
          }
          function Zt(M2, B2) {
            var ee, ie = (180 + M2[0]) / 360, ge = (ee = M2[1], (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + ee * Math.PI / 360))) / 360), _e = Math.pow(2, B2.z);
            return [Math.round(ie * _e * 8192), Math.round(ge * _e * 8192)];
          }
          function xr(M2, B2, ee) {
            return B2[1] > M2[1] != ee[1] > M2[1] && M2[0] < (ee[0] - B2[0]) * (M2[1] - B2[1]) / (ee[1] - B2[1]) + B2[0];
          }
          function Fr(M2, B2) {
            for (var ee, ie, ge, _e, Oe, Xe, ht, Tt = false, Dt = 0, Xt = B2.length; Dt < Xt; Dt++) for (var ar = B2[Dt], er = 0, hr = ar.length; er < hr - 1; er++) {
              if (ee = M2, ie = ar[er], ge = ar[er + 1], _e = void 0, Oe = void 0, Xe = void 0, ht = void 0, _e = ee[0] - ie[0], Oe = ee[1] - ie[1], Xe = ee[0] - ge[0], ht = ee[1] - ge[1], _e * ht - Xe * Oe == 0 && _e * Xe <= 0 && Oe * ht <= 0) return false;
              xr(M2, ar[er], ar[er + 1]) && (Tt = !Tt);
            }
            return Tt;
          }
          function pn(M2, B2) {
            for (var ee = 0; ee < B2.length; ee++) if (Fr(M2, B2[ee])) return true;
            return false;
          }
          function un(M2, B2, ee, ie) {
            var ge = M2[0] - ee[0], _e = M2[1] - ee[1], Oe = B2[0] - ee[0], Xe = B2[1] - ee[1], ht = ie[0] - ee[0], Tt = ie[1] - ee[1], Dt = ge * Tt - ht * _e, Xt = Oe * Tt - ht * Xe;
            return Dt > 0 && Xt < 0 || Dt < 0 && Xt > 0;
          }
          function Ir(M2, B2, ee) {
            for (var ie = 0, ge = ee; ie < ge.length; ie += 1) for (var _e = ge[ie], Oe = 0; Oe < _e.length - 1; ++Oe) if (Xe = M2, ht = B2, Tt = _e[Oe], Dt = _e[Oe + 1], Xt = void 0, ar = void 0, er = void 0, hr = void 0, er = [ht[0] - Xe[0], ht[1] - Xe[1]], hr = [Dt[0] - Tt[0], Dt[1] - Tt[1]], (Xt = hr)[0] * (ar = er)[1] - Xt[1] * ar[0] != 0 && un(Xe, ht, Tt, Dt) && un(Tt, Dt, Xe, ht)) return true;
            var Xe, ht, Tt, Dt, Xt, ar, er, hr;
            return false;
          }
          function Cr(M2, B2) {
            for (var ee = 0; ee < M2.length; ++ee) if (!Fr(M2[ee], B2)) return false;
            for (var ie = 0; ie < M2.length - 1; ++ie) if (Ir(M2[ie], M2[ie + 1], B2)) return false;
            return true;
          }
          function Lr(M2, B2) {
            for (var ee = 0; ee < B2.length; ee++) if (Cr(M2, B2[ee])) return true;
            return false;
          }
          function jr(M2, B2, ee) {
            for (var ie = [], ge = 0; ge < M2.length; ge++) {
              for (var _e = [], Oe = 0; Oe < M2[ge].length; Oe++) {
                var Xe = Zt(M2[ge][Oe], ee);
                sr(B2, Xe), _e.push(Xe);
              }
              ie.push(_e);
            }
            return ie;
          }
          function Rr(M2, B2, ee) {
            for (var ie = [], ge = 0; ge < M2.length; ge++) {
              var _e = jr(M2[ge], B2, ee);
              ie.push(_e);
            }
            return ie;
          }
          function vn(M2, B2, ee, ie) {
            if (M2[0] < ee[0] || M2[0] > ee[2]) {
              var ge = 0.5 * ie, _e = M2[0] - ee[0] > ge ? -ie : ee[0] - M2[0] > ge ? ie : 0;
              _e === 0 && (_e = M2[0] - ee[2] > ge ? -ie : ee[2] - M2[0] > ge ? ie : 0), M2[0] += _e;
            }
            sr(B2, M2);
          }
          function Mn(M2, B2, ee, ie) {
            for (var ge = 8192 * Math.pow(2, ie.z), _e = [8192 * ie.x, 8192 * ie.y], Oe = [], Xe = 0, ht = M2; Xe < ht.length; Xe += 1) for (var Tt = 0, Dt = ht[Xe]; Tt < Dt.length; Tt += 1) {
              var Xt = Dt[Tt], ar = [Xt.x + _e[0], Xt.y + _e[1]];
              vn(ar, B2, ee, ge), Oe.push(ar);
            }
            return Oe;
          }
          function jn(M2, B2, ee, ie) {
            for (var ge, _e = 8192 * Math.pow(2, ie.z), Oe = [8192 * ie.x, 8192 * ie.y], Xe = [], ht = 0, Tt = M2; ht < Tt.length; ht += 1) {
              for (var Dt = [], Xt = 0, ar = Tt[ht]; Xt < ar.length; Xt += 1) {
                var er = ar[Xt], hr = [er.x + Oe[0], er.y + Oe[1]];
                sr(B2, hr), Dt.push(hr);
              }
              Xe.push(Dt);
            }
            if (B2[2] - B2[0] <= _e / 2) {
              (ge = B2)[0] = ge[1] = 1 / 0, ge[2] = ge[3] = -1 / 0;
              for (var Sr = 0, Ur = Xe; Sr < Ur.length; Sr += 1) for (var Br = 0, rn = Ur[Sr]; Br < rn.length; Br += 1) vn(rn[Br], B2, ee, _e);
            }
            return Xe;
          }
          var bn = function(M2, B2) {
            this.type = Le, this.geojson = M2, this.geometries = B2;
          };
          function Bn(M2) {
            if (M2 instanceof gn && (M2.name === "get" && M2.args.length === 1 || M2.name === "feature-state" || M2.name === "has" && M2.args.length === 1 || M2.name === "properties" || M2.name === "geometry-type" || M2.name === "id" || /^filter-/.test(M2.name)) || M2 instanceof bn) return false;
            var B2 = true;
            return M2.eachChild(function(ee) {
              B2 && !Bn(ee) && (B2 = false);
            }), B2;
          }
          function sn(M2) {
            if (M2 instanceof gn && M2.name === "feature-state") return false;
            var B2 = true;
            return M2.eachChild(function(ee) {
              B2 && !sn(ee) && (B2 = false);
            }), B2;
          }
          function an(M2, B2) {
            if (M2 instanceof gn && B2.indexOf(M2.name) >= 0) return false;
            var ee = true;
            return M2.eachChild(function(ie) {
              ee && !an(ie, B2) && (ee = false);
            }), ee;
          }
          bn.parse = function(M2, B2) {
            if (M2.length !== 2) return B2.error("'within' expression requires exactly one argument, but found " + (M2.length - 1) + " instead.");
            if (hn(M2[1])) {
              var ee = M2[1];
              if (ee.type === "FeatureCollection") for (var ie = 0; ie < ee.features.length; ++ie) {
                var ge = ee.features[ie].geometry.type;
                if (ge === "Polygon" || ge === "MultiPolygon") return new bn(ee, ee.features[ie].geometry);
              }
              else if (ee.type === "Feature") {
                var _e = ee.geometry.type;
                if (_e === "Polygon" || _e === "MultiPolygon") return new bn(ee, ee.geometry);
              } else if (ee.type === "Polygon" || ee.type === "MultiPolygon") return new bn(ee, ee);
            }
            return B2.error("'within' expression requires valid geojson object that contains polygon geometry type.");
          }, bn.prototype.evaluate = function(M2) {
            if (M2.geometry() != null && M2.canonicalID() != null) {
              if (M2.geometryType() === "Point") return function(B2, ee) {
                var ie = [1 / 0, 1 / 0, -1 / 0, -1 / 0], ge = [1 / 0, 1 / 0, -1 / 0, -1 / 0], _e = B2.canonicalID();
                if (ee.type === "Polygon") {
                  var Oe = jr(ee.coordinates, ge, _e), Xe = Mn(B2.geometry(), ie, ge, _e);
                  if (!Ut(ie, ge)) return false;
                  for (var ht = 0, Tt = Xe; ht < Tt.length; ht += 1) if (!Fr(Tt[ht], Oe)) return false;
                }
                if (ee.type === "MultiPolygon") {
                  var Dt = Rr(ee.coordinates, ge, _e), Xt = Mn(B2.geometry(), ie, ge, _e);
                  if (!Ut(ie, ge)) return false;
                  for (var ar = 0, er = Xt; ar < er.length; ar += 1) if (!pn(er[ar], Dt)) return false;
                }
                return true;
              }(M2, this.geometries);
              if (M2.geometryType() === "LineString") return function(B2, ee) {
                var ie = [1 / 0, 1 / 0, -1 / 0, -1 / 0], ge = [1 / 0, 1 / 0, -1 / 0, -1 / 0], _e = B2.canonicalID();
                if (ee.type === "Polygon") {
                  var Oe = jr(ee.coordinates, ge, _e), Xe = jn(B2.geometry(), ie, ge, _e);
                  if (!Ut(ie, ge)) return false;
                  for (var ht = 0, Tt = Xe; ht < Tt.length; ht += 1) if (!Cr(Tt[ht], Oe)) return false;
                }
                if (ee.type === "MultiPolygon") {
                  var Dt = Rr(ee.coordinates, ge, _e), Xt = jn(B2.geometry(), ie, ge, _e);
                  if (!Ut(ie, ge)) return false;
                  for (var ar = 0, er = Xt; ar < er.length; ar += 1) if (!Lr(er[ar], Dt)) return false;
                }
                return true;
              }(M2, this.geometries);
            }
            return false;
          }, bn.prototype.eachChild = function() {
          }, bn.prototype.outputDefined = function() {
            return true;
          }, bn.prototype.serialize = function() {
            return ["within", this.geojson];
          };
          var Sn = function(M2, B2) {
            this.type = B2.type, this.name = M2, this.boundExpression = B2;
          };
          Sn.parse = function(M2, B2) {
            if (M2.length !== 2 || typeof M2[1] != "string") return B2.error("'var' expression requires exactly one string literal argument.");
            var ee = M2[1];
            return B2.scope.has(ee) ? new Sn(ee, B2.scope.get(ee)) : B2.error('Unknown variable "' + ee + '". Make sure "' + ee + '" has been bound in an enclosing "let" expression before using it.', 1);
          }, Sn.prototype.evaluate = function(M2) {
            return this.boundExpression.evaluate(M2);
          }, Sn.prototype.eachChild = function() {
          }, Sn.prototype.outputDefined = function() {
            return false;
          }, Sn.prototype.serialize = function() {
            return ["var", this.name];
          };
          var Rn = function(M2, B2, ee, ie, ge) {
            B2 === void 0 && (B2 = []), ie === void 0 && (ie = new xe()), ge === void 0 && (ge = []), this.registry = M2, this.path = B2, this.key = B2.map(function(_e) {
              return "[" + _e + "]";
            }).join(""), this.scope = ie, this.errors = ge, this.expectedType = ee;
          };
          function Kn(M2, B2) {
            for (var ee, ie, ge = M2.length - 1, _e = 0, Oe = ge, Xe = 0; _e <= Oe; ) if (ee = M2[Xe = Math.floor((_e + Oe) / 2)], ie = M2[Xe + 1], ee <= B2) {
              if (Xe === ge || B2 < ie) return Xe;
              _e = Xe + 1;
            } else {
              if (!(ee > B2)) throw new Wn("Input is not a number.");
              Oe = Xe - 1;
            }
            return 0;
          }
          Rn.prototype.parse = function(M2, B2, ee, ie, ge) {
            return ge === void 0 && (ge = {}), B2 ? this.concat(B2, ee, ie)._parse(M2, ge) : this._parse(M2, ge);
          }, Rn.prototype._parse = function(M2, B2) {
            function ee(Tt, Dt, Xt) {
              return Xt === "assert" ? new qr(Dt, [Tt]) : Xt === "coerce" ? new tn(Dt, [Tt]) : Tt;
            }
            if (M2 !== null && typeof M2 != "string" && typeof M2 != "boolean" && typeof M2 != "number" || (M2 = ["literal", M2]), Array.isArray(M2)) {
              if (M2.length === 0) return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');
              var ie = M2[0];
              if (typeof ie != "string") return this.error("Expression name must be a string, but found " + typeof ie + ' instead. If you wanted a literal array, use ["literal", [...]].', 0), null;
              var ge = this.registry[ie];
              if (ge) {
                var _e = ge.parse(M2, this);
                if (!_e) return null;
                if (this.expectedType) {
                  var Oe = this.expectedType, Xe = _e.type;
                  if (Oe.kind !== "string" && Oe.kind !== "number" && Oe.kind !== "boolean" && Oe.kind !== "object" && Oe.kind !== "array" || Xe.kind !== "value") if (Oe.kind !== "color" && Oe.kind !== "formatted" && Oe.kind !== "resolvedImage" || Xe.kind !== "value" && Xe.kind !== "string") {
                    if (this.checkSubtype(Oe, Xe)) return null;
                  } else _e = ee(_e, Oe, B2.typeAnnotation || "coerce");
                  else _e = ee(_e, Oe, B2.typeAnnotation || "assert");
                }
                if (!(_e instanceof Xn) && _e.type.kind !== "resolvedImage" && function Tt(Dt) {
                  if (Dt instanceof Sn) return Tt(Dt.boundExpression);
                  if (Dt instanceof gn && Dt.name === "error" || Dt instanceof na || Dt instanceof bn) return false;
                  var Xt = Dt instanceof tn || Dt instanceof qr, ar = true;
                  return Dt.eachChild(function(er) {
                    ar = Xt ? ar && Tt(er) : ar && er instanceof Xn;
                  }), ar ? Bn(Dt) && an(Dt, ["zoom", "heatmap-density", "line-progress", "accumulated", "is-supported-script"]) : false;
                }(_e)) {
                  var ht = new Ln();
                  try {
                    _e = new Xn(_e.type, _e.evaluate(ht));
                  } catch (Tt) {
                    return this.error(Tt.message), null;
                  }
                }
                return _e;
              }
              return this.error('Unknown expression "' + ie + '". If you wanted a literal array, use ["literal", [...]].', 0);
            }
            return M2 === void 0 ? this.error("'undefined' value invalid. Use null instead.") : typeof M2 == "object" ? this.error('Bare objects invalid. Use ["literal", {...}] instead.') : this.error("Expected an array, but found " + typeof M2 + " instead.");
          }, Rn.prototype.concat = function(M2, B2, ee) {
            var ie = typeof M2 == "number" ? this.path.concat(M2) : this.path, ge = ee ? this.scope.concat(ee) : this.scope;
            return new Rn(this.registry, ie, B2 || null, ge, this.errors);
          }, Rn.prototype.error = function(M2) {
            for (var B2 = [], ee = arguments.length - 1; ee-- > 0; ) B2[ee] = arguments[ee + 1];
            var ie = "" + this.key + B2.map(function(ge) {
              return "[" + ge + "]";
            }).join("");
            this.errors.push(new He(ie, M2));
          }, Rn.prototype.checkSubtype = function(M2, B2) {
            var ee = Kt(M2, B2);
            return ee && this.error(ee), ee;
          };
          var qa = function(M2, B2, ee) {
            this.type = M2, this.input = B2, this.labels = [], this.outputs = [];
            for (var ie = 0, ge = ee; ie < ge.length; ie += 1) {
              var _e = ge[ie], Oe = _e[0], Xe = _e[1];
              this.labels.push(Oe), this.outputs.push(Xe);
            }
          };
          function ka(M2, B2, ee) {
            return M2 * (1 - ee) + B2 * ee;
          }
          qa.parse = function(M2, B2) {
            if (M2.length - 1 < 4) return B2.error("Expected at least 4 arguments, but found only " + (M2.length - 1) + ".");
            if ((M2.length - 1) % 2 != 0) return B2.error("Expected an even number of arguments.");
            var ee = B2.parse(M2[1], 1, ke);
            if (!ee) return null;
            var ie = [], ge = null;
            B2.expectedType && B2.expectedType.kind !== "value" && (ge = B2.expectedType);
            for (var _e = 1; _e < M2.length; _e += 2) {
              var Oe = _e === 1 ? -1 / 0 : M2[_e], Xe = M2[_e + 1], ht = _e, Tt = _e + 1;
              if (typeof Oe != "number") return B2.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.', ht);
              if (ie.length && ie[ie.length - 1][0] >= Oe) return B2.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.', ht);
              var Dt = B2.parse(Xe, Tt, ge);
              if (!Dt) return null;
              ge = ge || Dt.type, ie.push([Oe, Dt]);
            }
            return new qa(ge, ee, ie);
          }, qa.prototype.evaluate = function(M2) {
            var B2 = this.labels, ee = this.outputs;
            if (B2.length === 1) return ee[0].evaluate(M2);
            var ie = this.input.evaluate(M2);
            if (ie <= B2[0]) return ee[0].evaluate(M2);
            var ge = B2.length;
            return ie >= B2[ge - 1] ? ee[ge - 1].evaluate(M2) : ee[Kn(B2, ie)].evaluate(M2);
          }, qa.prototype.eachChild = function(M2) {
            M2(this.input);
            for (var B2 = 0, ee = this.outputs; B2 < ee.length; B2 += 1) M2(ee[B2]);
          }, qa.prototype.outputDefined = function() {
            return this.outputs.every(function(M2) {
              return M2.outputDefined();
            });
          }, qa.prototype.serialize = function() {
            for (var M2 = ["step", this.input.serialize()], B2 = 0; B2 < this.labels.length; B2++) B2 > 0 && M2.push(this.labels[B2]), M2.push(this.outputs[B2].serialize());
            return M2;
          };
          var zn = Object.freeze({ __proto__: null, number: ka, color: function(M2, B2, ee) {
            return new pr(ka(M2.r, B2.r, ee), ka(M2.g, B2.g, ee), ka(M2.b, B2.b, ee), ka(M2.a, B2.a, ee));
          }, array: function(M2, B2, ee) {
            return M2.map(function(ie, ge) {
              return ka(ie, B2[ge], ee);
            });
          } }), ja = 6 / 29, si = 3 * ja * ja, ko = Math.PI / 180, Xs = 180 / Math.PI;
          function Uo(M2) {
            return M2 > 0.008856451679035631 ? Math.pow(M2, 1 / 3) : M2 / si + 4 / 29;
          }
          function As(M2) {
            return M2 > ja ? M2 * M2 * M2 : si * (M2 - 4 / 29);
          }
          function Ui(M2) {
            return 255 * (M2 <= 31308e-7 ? 12.92 * M2 : 1.055 * Math.pow(M2, 1 / 2.4) - 0.055);
          }
          function so(M2) {
            return (M2 /= 255) <= 0.04045 ? M2 / 12.92 : Math.pow((M2 + 0.055) / 1.055, 2.4);
          }
          function gu(M2) {
            var B2 = so(M2.r), ee = so(M2.g), ie = so(M2.b), ge = Uo((0.4124564 * B2 + 0.3575761 * ee + 0.1804375 * ie) / 0.95047), _e = Uo((0.2126729 * B2 + 0.7151522 * ee + 0.072175 * ie) / 1);
            return { l: 116 * _e - 16, a: 500 * (ge - _e), b: 200 * (_e - Uo((0.0193339 * B2 + 0.119192 * ee + 0.9503041 * ie) / 1.08883)), alpha: M2.a };
          }
          function Pc(M2) {
            var B2 = (M2.l + 16) / 116, ee = isNaN(M2.a) ? B2 : B2 + M2.a / 500, ie = isNaN(M2.b) ? B2 : B2 - M2.b / 200;
            return B2 = 1 * As(B2), ee = 0.95047 * As(ee), ie = 1.08883 * As(ie), new pr(Ui(3.2404542 * ee - 1.5371385 * B2 - 0.4985314 * ie), Ui(-0.969266 * ee + 1.8760108 * B2 + 0.041556 * ie), Ui(0.0556434 * ee - 0.2040259 * B2 + 1.0572252 * ie), M2.alpha);
          }
          function Zc(M2, B2, ee) {
            var ie = B2 - M2;
            return M2 + ee * (ie > 180 || ie < -180 ? ie - 360 * Math.round(ie / 360) : ie);
          }
          var Ll = { forward: gu, reverse: Pc, interpolate: function(M2, B2, ee) {
            return { l: ka(M2.l, B2.l, ee), a: ka(M2.a, B2.a, ee), b: ka(M2.b, B2.b, ee), alpha: ka(M2.alpha, B2.alpha, ee) };
          } }, Hl = { forward: function(M2) {
            var B2 = gu(M2), ee = B2.l, ie = B2.a, ge = B2.b, _e = Math.atan2(ge, ie) * Xs;
            return { h: _e < 0 ? _e + 360 : _e, c: Math.sqrt(ie * ie + ge * ge), l: ee, alpha: M2.a };
          }, reverse: function(M2) {
            var B2 = M2.h * ko, ee = M2.c;
            return Pc({ l: M2.l, a: Math.cos(B2) * ee, b: Math.sin(B2) * ee, alpha: M2.alpha });
          }, interpolate: function(M2, B2, ee) {
            return { h: Zc(M2.h, B2.h, ee), c: ka(M2.c, B2.c, ee), l: ka(M2.l, B2.l, ee), alpha: ka(M2.alpha, B2.alpha, ee) };
          } }, Lc = Object.freeze({ __proto__: null, lab: Ll, hcl: Hl }), po = function(M2, B2, ee, ie, ge) {
            this.type = M2, this.operator = B2, this.interpolation = ee, this.input = ie, this.labels = [], this.outputs = [];
            for (var _e = 0, Oe = ge; _e < Oe.length; _e += 1) {
              var Xe = Oe[_e], ht = Xe[0], Tt = Xe[1];
              this.labels.push(ht), this.outputs.push(Tt);
            }
          };
          function tc(M2, B2, ee, ie) {
            var ge = ie - ee, _e = M2 - ee;
            return ge === 0 ? 0 : B2 === 1 ? _e / ge : (Math.pow(B2, _e) - 1) / (Math.pow(B2, ge) - 1);
          }
          po.interpolationFactor = function(M2, B2, ee, ie) {
            var ge = 0;
            if (M2.name === "exponential") ge = tc(B2, M2.base, ee, ie);
            else if (M2.name === "linear") ge = tc(B2, 1, ee, ie);
            else if (M2.name === "cubic-bezier") {
              var _e = M2.controlPoints;
              ge = new u2(_e[0], _e[1], _e[2], _e[3]).solve(tc(B2, 1, ee, ie));
            }
            return ge;
          }, po.parse = function(M2, B2) {
            var ee = M2[0], ie = M2[1], ge = M2[2], _e = M2.slice(3);
            if (!Array.isArray(ie) || ie.length === 0) return B2.error("Expected an interpolation type expression.", 1);
            if (ie[0] === "linear") ie = { name: "linear" };
            else if (ie[0] === "exponential") {
              var Oe = ie[1];
              if (typeof Oe != "number") return B2.error("Exponential interpolation requires a numeric base.", 1, 1);
              ie = { name: "exponential", base: Oe };
            } else {
              if (ie[0] !== "cubic-bezier") return B2.error("Unknown interpolation type " + String(ie[0]), 1, 0);
              var Xe = ie.slice(1);
              if (Xe.length !== 4 || Xe.some(function(Ur) {
                return typeof Ur != "number" || Ur < 0 || Ur > 1;
              })) return B2.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.", 1);
              ie = { name: "cubic-bezier", controlPoints: Xe };
            }
            if (M2.length - 1 < 4) return B2.error("Expected at least 4 arguments, but found only " + (M2.length - 1) + ".");
            if ((M2.length - 1) % 2 != 0) return B2.error("Expected an even number of arguments.");
            if (!(ge = B2.parse(ge, 2, ke))) return null;
            var ht = [], Tt = null;
            ee === "interpolate-hcl" || ee === "interpolate-lab" ? Tt = ze : B2.expectedType && B2.expectedType.kind !== "value" && (Tt = B2.expectedType);
            for (var Dt = 0; Dt < _e.length; Dt += 2) {
              var Xt = _e[Dt], ar = _e[Dt + 1], er = Dt + 3, hr = Dt + 4;
              if (typeof Xt != "number") return B2.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.', er);
              if (ht.length && ht[ht.length - 1][0] >= Xt) return B2.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.', er);
              var Sr = B2.parse(ar, hr, Tt);
              if (!Sr) return null;
              Tt = Tt || Sr.type, ht.push([Xt, Sr]);
            }
            return Tt.kind === "number" || Tt.kind === "color" || Tt.kind === "array" && Tt.itemType.kind === "number" && typeof Tt.N == "number" ? new po(Tt, ee, ie, ge, ht) : B2.error("Type " + jt(Tt) + " is not interpolatable.");
          }, po.prototype.evaluate = function(M2) {
            var B2 = this.labels, ee = this.outputs;
            if (B2.length === 1) return ee[0].evaluate(M2);
            var ie = this.input.evaluate(M2);
            if (ie <= B2[0]) return ee[0].evaluate(M2);
            var ge = B2.length;
            if (ie >= B2[ge - 1]) return ee[ge - 1].evaluate(M2);
            var _e = Kn(B2, ie), Oe = B2[_e], Xe = B2[_e + 1], ht = po.interpolationFactor(this.interpolation, ie, Oe, Xe), Tt = ee[_e].evaluate(M2), Dt = ee[_e + 1].evaluate(M2);
            return this.operator === "interpolate" ? zn[this.type.kind.toLowerCase()](Tt, Dt, ht) : this.operator === "interpolate-hcl" ? Hl.reverse(Hl.interpolate(Hl.forward(Tt), Hl.forward(Dt), ht)) : Ll.reverse(Ll.interpolate(Ll.forward(Tt), Ll.forward(Dt), ht));
          }, po.prototype.eachChild = function(M2) {
            M2(this.input);
            for (var B2 = 0, ee = this.outputs; B2 < ee.length; B2 += 1) M2(ee[B2]);
          }, po.prototype.outputDefined = function() {
            return this.outputs.every(function(M2) {
              return M2.outputDefined();
            });
          }, po.prototype.serialize = function() {
            var M2;
            M2 = this.interpolation.name === "linear" ? ["linear"] : this.interpolation.name === "exponential" ? this.interpolation.base === 1 ? ["linear"] : ["exponential", this.interpolation.base] : ["cubic-bezier"].concat(this.interpolation.controlPoints);
            for (var B2 = [this.operator, M2, this.input.serialize()], ee = 0; ee < this.labels.length; ee++) B2.push(this.labels[ee], this.outputs[ee].serialize());
            return B2;
          };
          var yu = function(M2, B2) {
            this.type = M2, this.args = B2;
          };
          yu.parse = function(M2, B2) {
            if (M2.length < 2) return B2.error("Expectected at least one argument.");
            var ee = null, ie = B2.expectedType;
            ie && ie.kind !== "value" && (ee = ie);
            for (var ge = [], _e = 0, Oe = M2.slice(1); _e < Oe.length; _e += 1) {
              var Xe = Oe[_e], ht = B2.parse(Xe, 1 + ge.length, ee, void 0, { typeAnnotation: "omit" });
              if (!ht) return null;
              ee = ee || ht.type, ge.push(ht);
            }
            var Tt = ie && ge.some(function(Dt) {
              return Kt(ie, Dt.type);
            });
            return new yu(Tt ? De : ee, ge);
          }, yu.prototype.evaluate = function(M2) {
            for (var B2, ee = null, ie = 0, ge = 0, _e = this.args; ge < _e.length && (ie++, (ee = _e[ge].evaluate(M2)) && ee instanceof Ar && !ee.available && (B2 || (B2 = ee.name), ee = null, ie === this.args.length && (ee = B2)), ee === null); ge += 1) ;
            return ee;
          }, yu.prototype.eachChild = function(M2) {
            this.args.forEach(M2);
          }, yu.prototype.outputDefined = function() {
            return this.args.every(function(M2) {
              return M2.outputDefined();
            });
          }, yu.prototype.serialize = function() {
            var M2 = ["coalesce"];
            return this.eachChild(function(B2) {
              M2.push(B2.serialize());
            }), M2;
          };
          var Ss = function(M2, B2) {
            this.type = B2.type, this.bindings = [].concat(M2), this.result = B2;
          };
          Ss.prototype.evaluate = function(M2) {
            return this.result.evaluate(M2);
          }, Ss.prototype.eachChild = function(M2) {
            for (var B2 = 0, ee = this.bindings; B2 < ee.length; B2 += 1) M2(ee[B2][1]);
            M2(this.result);
          }, Ss.parse = function(M2, B2) {
            if (M2.length < 4) return B2.error("Expected at least 3 arguments, but found " + (M2.length - 1) + " instead.");
            for (var ee = [], ie = 1; ie < M2.length - 1; ie += 2) {
              var ge = M2[ie];
              if (typeof ge != "string") return B2.error("Expected string, but found " + typeof ge + " instead.", ie);
              if (/[^a-zA-Z0-9_]/.test(ge)) return B2.error("Variable names must contain only alphanumeric characters or '_'.", ie);
              var _e = B2.parse(M2[ie + 1], ie + 1);
              if (!_e) return null;
              ee.push([ge, _e]);
            }
            var Oe = B2.parse(M2[M2.length - 1], M2.length - 1, B2.expectedType, ee);
            return Oe ? new Ss(ee, Oe) : null;
          }, Ss.prototype.outputDefined = function() {
            return this.result.outputDefined();
          }, Ss.prototype.serialize = function() {
            for (var M2 = ["let"], B2 = 0, ee = this.bindings; B2 < ee.length; B2 += 1) {
              var ie = ee[B2], ge = ie[0], _e = ie[1];
              M2.push(ge, _e.serialize());
            }
            return M2.push(this.result.serialize()), M2;
          };
          var ql = function(M2, B2, ee) {
            this.type = M2, this.index = B2, this.input = ee;
          };
          ql.parse = function(M2, B2) {
            if (M2.length !== 3) return B2.error("Expected 2 arguments, but found " + (M2.length - 1) + " instead.");
            var ee = B2.parse(M2[1], 1, ke), ie = B2.parse(M2[2], 2, kt(B2.expectedType || De));
            if (!ee || !ie) return null;
            var ge = ie.type;
            return new ql(ge.itemType, ee, ie);
          }, ql.prototype.evaluate = function(M2) {
            var B2 = this.index.evaluate(M2), ee = this.input.evaluate(M2);
            if (B2 < 0) throw new Wn("Array index out of bounds: " + B2 + " < 0.");
            if (B2 >= ee.length) throw new Wn("Array index out of bounds: " + B2 + " > " + (ee.length - 1) + ".");
            if (B2 !== Math.floor(B2)) throw new Wn("Array index must be an integer, but found " + B2 + " instead.");
            return ee[B2];
          }, ql.prototype.eachChild = function(M2) {
            M2(this.index), M2(this.input);
          }, ql.prototype.outputDefined = function() {
            return false;
          }, ql.prototype.serialize = function() {
            return ["at", this.index.serialize(), this.input.serialize()];
          };
          var xu = function(M2, B2) {
            this.type = Le, this.needle = M2, this.haystack = B2;
          };
          xu.parse = function(M2, B2) {
            if (M2.length !== 3) return B2.error("Expected 2 arguments, but found " + (M2.length - 1) + " instead.");
            var ee = B2.parse(M2[1], 1, De), ie = B2.parse(M2[2], 2, De);
            return ee && ie ? rr(ee.type, [Le, Me, ke, Ne, De]) ? new xu(ee, ie) : B2.error("Expected first argument to be of type boolean, string, number or null, but found " + jt(ee.type) + " instead") : null;
          }, xu.prototype.evaluate = function(M2) {
            var B2 = this.needle.evaluate(M2), ee = this.haystack.evaluate(M2);
            if (!ee) return false;
            if (!Tr(B2, ["boolean", "string", "number", "null"])) throw new Wn("Expected first argument to be of type boolean, string, number or null, but found " + jt(wn(B2)) + " instead.");
            if (!Tr(ee, ["string", "array"])) throw new Wn("Expected second argument to be of type array or string, but found " + jt(wn(ee)) + " instead.");
            return ee.indexOf(B2) >= 0;
          }, xu.prototype.eachChild = function(M2) {
            M2(this.needle), M2(this.haystack);
          }, xu.prototype.outputDefined = function() {
            return true;
          }, xu.prototype.serialize = function() {
            return ["in", this.needle.serialize(), this.haystack.serialize()];
          };
          var zu = function(M2, B2, ee) {
            this.type = ke, this.needle = M2, this.haystack = B2, this.fromIndex = ee;
          };
          zu.parse = function(M2, B2) {
            if (M2.length <= 2 || M2.length >= 5) return B2.error("Expected 3 or 4 arguments, but found " + (M2.length - 1) + " instead.");
            var ee = B2.parse(M2[1], 1, De), ie = B2.parse(M2[2], 2, De);
            if (!ee || !ie) return null;
            if (!rr(ee.type, [Le, Me, ke, Ne, De])) return B2.error("Expected first argument to be of type boolean, string, number or null, but found " + jt(ee.type) + " instead");
            if (M2.length === 4) {
              var ge = B2.parse(M2[3], 3, ke);
              return ge ? new zu(ee, ie, ge) : null;
            }
            return new zu(ee, ie);
          }, zu.prototype.evaluate = function(M2) {
            var B2 = this.needle.evaluate(M2), ee = this.haystack.evaluate(M2);
            if (!Tr(B2, ["boolean", "string", "number", "null"])) throw new Wn("Expected first argument to be of type boolean, string, number or null, but found " + jt(wn(B2)) + " instead.");
            if (!Tr(ee, ["string", "array"])) throw new Wn("Expected second argument to be of type array or string, but found " + jt(wn(ee)) + " instead.");
            if (this.fromIndex) {
              var ie = this.fromIndex.evaluate(M2);
              return ee.indexOf(B2, ie);
            }
            return ee.indexOf(B2);
          }, zu.prototype.eachChild = function(M2) {
            M2(this.needle), M2(this.haystack), this.fromIndex && M2(this.fromIndex);
          }, zu.prototype.outputDefined = function() {
            return false;
          }, zu.prototype.serialize = function() {
            if (this.fromIndex != null && this.fromIndex !== void 0) {
              var M2 = this.fromIndex.serialize();
              return ["index-of", this.needle.serialize(), this.haystack.serialize(), M2];
            }
            return ["index-of", this.needle.serialize(), this.haystack.serialize()];
          };
          var nl = function(M2, B2, ee, ie, ge, _e) {
            this.inputType = M2, this.type = B2, this.input = ee, this.cases = ie, this.outputs = ge, this.otherwise = _e;
          };
          nl.parse = function(M2, B2) {
            if (M2.length < 5) return B2.error("Expected at least 4 arguments, but found only " + (M2.length - 1) + ".");
            if (M2.length % 2 != 1) return B2.error("Expected an even number of arguments.");
            var ee, ie;
            B2.expectedType && B2.expectedType.kind !== "value" && (ie = B2.expectedType);
            for (var ge = {}, _e = [], Oe = 2; Oe < M2.length - 1; Oe += 2) {
              var Xe = M2[Oe], ht = M2[Oe + 1];
              Array.isArray(Xe) || (Xe = [Xe]);
              var Tt = B2.concat(Oe);
              if (Xe.length === 0) return Tt.error("Expected at least one branch label.");
              for (var Dt = 0, Xt = Xe; Dt < Xt.length; Dt += 1) {
                var ar = Xt[Dt];
                if (typeof ar != "number" && typeof ar != "string") return Tt.error("Branch labels must be numbers or strings.");
                if (typeof ar == "number" && Math.abs(ar) > Number.MAX_SAFE_INTEGER) return Tt.error("Branch labels must be integers no larger than " + Number.MAX_SAFE_INTEGER + ".");
                if (typeof ar == "number" && Math.floor(ar) !== ar) return Tt.error("Numeric branch labels must be integer values.");
                if (ee) {
                  if (Tt.checkSubtype(ee, wn(ar))) return null;
                } else ee = wn(ar);
                if (ge[String(ar)] !== void 0) return Tt.error("Branch labels must be unique.");
                ge[String(ar)] = _e.length;
              }
              var er = B2.parse(ht, Oe, ie);
              if (!er) return null;
              ie = ie || er.type, _e.push(er);
            }
            var hr = B2.parse(M2[1], 1, De);
            if (!hr) return null;
            var Sr = B2.parse(M2[M2.length - 1], M2.length - 1, ie);
            return Sr ? hr.type.kind !== "value" && B2.concat(1).checkSubtype(ee, hr.type) ? null : new nl(ee, ie, hr, ge, _e, Sr) : null;
          }, nl.prototype.evaluate = function(M2) {
            var B2 = this.input.evaluate(M2);
            return (wn(B2) === this.inputType && this.outputs[this.cases[B2]] || this.otherwise).evaluate(M2);
          }, nl.prototype.eachChild = function(M2) {
            M2(this.input), this.outputs.forEach(M2), M2(this.otherwise);
          }, nl.prototype.outputDefined = function() {
            return this.outputs.every(function(M2) {
              return M2.outputDefined();
            }) && this.otherwise.outputDefined();
          }, nl.prototype.serialize = function() {
            for (var M2 = this, B2 = ["match", this.input.serialize()], ee = [], ie = {}, ge = 0, _e = Object.keys(this.cases).sort(); ge < _e.length; ge += 1) {
              var Oe = _e[ge];
              (Xt = ie[this.cases[Oe]]) === void 0 ? (ie[this.cases[Oe]] = ee.length, ee.push([this.cases[Oe], [Oe]])) : ee[Xt][1].push(Oe);
            }
            for (var Xe = function(er) {
              return M2.inputType.kind === "number" ? Number(er) : er;
            }, ht = 0, Tt = ee; ht < Tt.length; ht += 1) {
              var Dt = Tt[ht], Xt = Dt[0], ar = Dt[1];
              ar.length === 1 ? B2.push(Xe(ar[0])) : B2.push(ar.map(Xe)), B2.push(this.outputs[outputIndex$1].serialize());
            }
            return B2.push(this.otherwise.serialize()), B2;
          };
          var ss = function(M2, B2, ee) {
            this.type = M2, this.branches = B2, this.otherwise = ee;
          };
          ss.parse = function(M2, B2) {
            if (M2.length < 4) return B2.error("Expected at least 3 arguments, but found only " + (M2.length - 1) + ".");
            if (M2.length % 2 != 0) return B2.error("Expected an odd number of arguments.");
            var ee;
            B2.expectedType && B2.expectedType.kind !== "value" && (ee = B2.expectedType);
            for (var ie = [], ge = 1; ge < M2.length - 1; ge += 2) {
              var _e = B2.parse(M2[ge], ge, Le);
              if (!_e) return null;
              var Oe = B2.parse(M2[ge + 1], ge + 1, ee);
              if (!Oe) return null;
              ie.push([_e, Oe]), ee = ee || Oe.type;
            }
            var Xe = B2.parse(M2[M2.length - 1], M2.length - 1, ee);
            return Xe ? new ss(ee, ie, Xe) : null;
          }, ss.prototype.evaluate = function(M2) {
            for (var B2 = 0, ee = this.branches; B2 < ee.length; B2 += 1) {
              var ie = ee[B2], ge = ie[0], _e = ie[1];
              if (ge.evaluate(M2)) return _e.evaluate(M2);
            }
            return this.otherwise.evaluate(M2);
          }, ss.prototype.eachChild = function(M2) {
            for (var B2 = 0, ee = this.branches; B2 < ee.length; B2 += 1) {
              var ie = ee[B2], ge = ie[0], _e = ie[1];
              M2(ge), M2(_e);
            }
            M2(this.otherwise);
          }, ss.prototype.outputDefined = function() {
            return this.branches.every(function(M2) {
              return M2[0], M2[1].outputDefined();
            }) && this.otherwise.outputDefined();
          }, ss.prototype.serialize = function() {
            var M2 = ["case"];
            return this.eachChild(function(B2) {
              M2.push(B2.serialize());
            }), M2;
          };
          var Rl = function(M2, B2, ee, ie) {
            this.type = M2, this.input = B2, this.beginIndex = ee, this.endIndex = ie;
          };
          function Kh(M2, B2) {
            return M2 === "==" || M2 === "!=" ? B2.kind === "boolean" || B2.kind === "string" || B2.kind === "number" || B2.kind === "null" || B2.kind === "value" : B2.kind === "string" || B2.kind === "number" || B2.kind === "value";
          }
          function Np(M2, B2, ee, ie) {
            return ie.compare(B2, ee) === 0;
          }
          function vo(M2, B2, ee) {
            var ie = M2 !== "==" && M2 !== "!=";
            return function() {
              function ge(_e, Oe, Xe) {
                this.type = Le, this.lhs = _e, this.rhs = Oe, this.collator = Xe, this.hasUntypedArgument = _e.type.kind === "value" || Oe.type.kind === "value";
              }
              return ge.parse = function(_e, Oe) {
                if (_e.length !== 3 && _e.length !== 4) return Oe.error("Expected two or three arguments.");
                var Xe = _e[0], ht = Oe.parse(_e[1], 1, De);
                if (!ht) return null;
                if (!Kh(Xe, ht.type)) return Oe.concat(1).error('"' + Xe + `" comparisons are not supported for type '` + jt(ht.type) + "'.");
                var Tt = Oe.parse(_e[2], 2, De);
                if (!Tt) return null;
                if (!Kh(Xe, Tt.type)) return Oe.concat(2).error('"' + Xe + `" comparisons are not supported for type '` + jt(Tt.type) + "'.");
                if (ht.type.kind !== Tt.type.kind && ht.type.kind !== "value" && Tt.type.kind !== "value") return Oe.error("Cannot compare types '" + jt(ht.type) + "' and '" + jt(Tt.type) + "'.");
                ie && (ht.type.kind === "value" && Tt.type.kind !== "value" ? ht = new qr(Tt.type, [ht]) : ht.type.kind !== "value" && Tt.type.kind === "value" && (Tt = new qr(ht.type, [Tt])));
                var Dt = null;
                if (_e.length === 4) {
                  if (ht.type.kind !== "string" && Tt.type.kind !== "string" && ht.type.kind !== "value" && Tt.type.kind !== "value") return Oe.error("Cannot use collator to compare non-string types.");
                  if (!(Dt = Oe.parse(_e[3], 3, Je))) return null;
                }
                return new ge(ht, Tt, Dt);
              }, ge.prototype.evaluate = function(_e) {
                var Oe = this.lhs.evaluate(_e), Xe = this.rhs.evaluate(_e);
                if (ie && this.hasUntypedArgument) {
                  var ht = wn(Oe), Tt = wn(Xe);
                  if (ht.kind !== Tt.kind || ht.kind !== "string" && ht.kind !== "number") throw new Wn('Expected arguments for "' + M2 + '" to be (string, string) or (number, number), but found (' + ht.kind + ", " + Tt.kind + ") instead.");
                }
                if (this.collator && !ie && this.hasUntypedArgument) {
                  var Dt = wn(Oe), Xt = wn(Xe);
                  if (Dt.kind !== "string" || Xt.kind !== "string") return B2(_e, Oe, Xe);
                }
                return this.collator ? ee(_e, Oe, Xe, this.collator.evaluate(_e)) : B2(_e, Oe, Xe);
              }, ge.prototype.eachChild = function(_e) {
                _e(this.lhs), _e(this.rhs), this.collator && _e(this.collator);
              }, ge.prototype.outputDefined = function() {
                return true;
              }, ge.prototype.serialize = function() {
                var _e = [M2];
                return this.eachChild(function(Oe) {
                  _e.push(Oe.serialize());
                }), _e;
              }, ge;
            }();
          }
          Rl.parse = function(M2, B2) {
            if (M2.length <= 2 || M2.length >= 5) return B2.error("Expected 3 or 4 arguments, but found " + (M2.length - 1) + " instead.");
            var ee = B2.parse(M2[1], 1, De), ie = B2.parse(M2[2], 2, ke);
            if (!ee || !ie) return null;
            if (!rr(ee.type, [kt(De), Me, De])) return B2.error("Expected first argument to be of type array or string, but found " + jt(ee.type) + " instead");
            if (M2.length === 4) {
              var ge = B2.parse(M2[3], 3, ke);
              return ge ? new Rl(ee.type, ee, ie, ge) : null;
            }
            return new Rl(ee.type, ee, ie);
          }, Rl.prototype.evaluate = function(M2) {
            var B2 = this.input.evaluate(M2), ee = this.beginIndex.evaluate(M2);
            if (!Tr(B2, ["string", "array"])) throw new Wn("Expected first argument to be of type array or string, but found " + jt(wn(B2)) + " instead.");
            if (this.endIndex) {
              var ie = this.endIndex.evaluate(M2);
              return B2.slice(ee, ie);
            }
            return B2.slice(ee);
          }, Rl.prototype.eachChild = function(M2) {
            M2(this.input), M2(this.beginIndex), this.endIndex && M2(this.endIndex);
          }, Rl.prototype.outputDefined = function() {
            return false;
          }, Rl.prototype.serialize = function() {
            if (this.endIndex != null && this.endIndex !== void 0) {
              var M2 = this.endIndex.serialize();
              return ["slice", this.input.serialize(), this.beginIndex.serialize(), M2];
            }
            return ["slice", this.input.serialize(), this.beginIndex.serialize()];
          };
          var xh = vo("==", function(M2, B2, ee) {
            return B2 === ee;
          }, Np), kf = vo("!=", function(M2, B2, ee) {
            return B2 !== ee;
          }, function(M2, B2, ee, ie) {
            return !Np(0, B2, ee, ie);
          }), Fp = vo("<", function(M2, B2, ee) {
            return B2 < ee;
          }, function(M2, B2, ee, ie) {
            return ie.compare(B2, ee) < 0;
          }), Op = vo(">", function(M2, B2, ee) {
            return B2 > ee;
          }, function(M2, B2, ee, ie) {
            return ie.compare(B2, ee) > 0;
          }), Yh = vo("<=", function(M2, B2, ee) {
            return B2 <= ee;
          }, function(M2, B2, ee, ie) {
            return ie.compare(B2, ee) <= 0;
          }), Pp = vo(">=", function(M2, B2, ee) {
            return B2 >= ee;
          }, function(M2, B2, ee, ie) {
            return ie.compare(B2, ee) >= 0;
          }), rc = function(M2, B2, ee, ie, ge) {
            this.type = Me, this.number = M2, this.locale = B2, this.currency = ee, this.minFractionDigits = ie, this.maxFractionDigits = ge;
          };
          rc.parse = function(M2, B2) {
            if (M2.length !== 3) return B2.error("Expected two arguments.");
            var ee = B2.parse(M2[1], 1, ke);
            if (!ee) return null;
            var ie = M2[2];
            if (typeof ie != "object" || Array.isArray(ie)) return B2.error("NumberFormat options argument must be an object.");
            var ge = null;
            if (ie.locale && !(ge = B2.parse(ie.locale, 1, Me))) return null;
            var _e = null;
            if (ie.currency && !(_e = B2.parse(ie.currency, 1, Me))) return null;
            var Oe = null;
            if (ie["min-fraction-digits"] && !(Oe = B2.parse(ie["min-fraction-digits"], 1, ke))) return null;
            var Xe = null;
            return ie["max-fraction-digits"] && !(Xe = B2.parse(ie["max-fraction-digits"], 1, ke)) ? null : new rc(ee, ge, _e, Oe, Xe);
          }, rc.prototype.evaluate = function(M2) {
            return new Intl.NumberFormat(this.locale ? this.locale.evaluate(M2) : [], { style: this.currency ? "currency" : "decimal", currency: this.currency ? this.currency.evaluate(M2) : void 0, minimumFractionDigits: this.minFractionDigits ? this.minFractionDigits.evaluate(M2) : void 0, maximumFractionDigits: this.maxFractionDigits ? this.maxFractionDigits.evaluate(M2) : void 0 }).format(this.number.evaluate(M2));
          }, rc.prototype.eachChild = function(M2) {
            M2(this.number), this.locale && M2(this.locale), this.currency && M2(this.currency), this.minFractionDigits && M2(this.minFractionDigits), this.maxFractionDigits && M2(this.maxFractionDigits);
          }, rc.prototype.outputDefined = function() {
            return false;
          }, rc.prototype.serialize = function() {
            var M2 = {};
            return this.locale && (M2.locale = this.locale.serialize()), this.currency && (M2.currency = this.currency.serialize()), this.minFractionDigits && (M2["min-fraction-digits"] = this.minFractionDigits.serialize()), this.maxFractionDigits && (M2["max-fraction-digits"] = this.maxFractionDigits.serialize()), ["number-format", this.number.serialize(), M2];
          };
          var nc = function(M2) {
            this.type = ke, this.input = M2;
          };
          nc.parse = function(M2, B2) {
            if (M2.length !== 2) return B2.error("Expected 1 argument, but found " + (M2.length - 1) + " instead.");
            var ee = B2.parse(M2[1], 1);
            return ee ? ee.type.kind !== "array" && ee.type.kind !== "string" && ee.type.kind !== "value" ? B2.error("Expected argument of type string or array, but found " + jt(ee.type) + " instead.") : new nc(ee) : null;
          }, nc.prototype.evaluate = function(M2) {
            var B2 = this.input.evaluate(M2);
            if (typeof B2 == "string" || Array.isArray(B2)) return B2.length;
            throw new Wn("Expected value to be of type string or array, but found " + jt(wn(B2)) + " instead.");
          }, nc.prototype.eachChild = function(M2) {
            M2(this.input);
          }, nc.prototype.outputDefined = function() {
            return false;
          }, nc.prototype.serialize = function() {
            var M2 = ["length"];
            return this.eachChild(function(B2) {
              M2.push(B2.serialize());
            }), M2;
          };
          var Rc = { "==": xh, "!=": kf, ">": Op, "<": Fp, ">=": Pp, "<=": Yh, array: qr, at: ql, boolean: qr, case: ss, coalesce: yu, collator: na, format: Nr, image: Zr, in: xu, "index-of": zu, interpolate: po, "interpolate-hcl": po, "interpolate-lab": po, length: nc, let: Ss, literal: Xn, match: nl, number: qr, "number-format": rc, object: qr, slice: Rl, step: qa, string: qr, "to-boolean": tn, "to-color": tn, "to-number": tn, "to-string": tn, var: Sn, within: bn };
          function zc(M2, B2) {
            var ee = B2[0], ie = B2[1], ge = B2[2], _e = B2[3];
            ee = ee.evaluate(M2), ie = ie.evaluate(M2), ge = ge.evaluate(M2);
            var Oe = _e ? _e.evaluate(M2) : 1, Xe = Qr(ee, ie, ge, Oe);
            if (Xe) throw new Wn(Xe);
            return new pr(ee / 255 * Oe, ie / 255 * Oe, ge / 255 * Oe, Oe);
          }
          function Bc(M2, B2) {
            return M2 in B2;
          }
          function Tf(M2, B2) {
            var ee = B2[M2];
            return ee === void 0 ? null : ee;
          }
          function bu(M2) {
            return { type: M2 };
          }
          function bh(M2) {
            return { result: "success", value: M2 };
          }
          function cu(M2) {
            return { result: "error", value: M2 };
          }
          function Uc(M2) {
            return M2["property-type"] === "data-driven" || M2["property-type"] === "cross-faded-data-driven";
          }
          function _h(M2) {
            return !!M2.expression && M2.expression.parameters.indexOf("zoom") > -1;
          }
          function ac(M2) {
            return !!M2.expression && M2.expression.interpolated;
          }
          function lo(M2) {
            return M2 instanceof Number ? "number" : M2 instanceof String ? "string" : M2 instanceof Boolean ? "boolean" : Array.isArray(M2) ? "array" : M2 === null ? "null" : typeof M2;
          }
          function Qe(M2) {
            return typeof M2 == "object" && M2 !== null && !Array.isArray(M2);
          }
          function nt(M2) {
            return M2;
          }
          function dt(M2, B2, ee) {
            return M2 !== void 0 ? M2 : B2 !== void 0 ? B2 : ee !== void 0 ? ee : void 0;
          }
          function _t(M2, B2, ee, ie, ge) {
            return dt(typeof ee === ge ? ie[ee] : void 0, M2.default, B2.default);
          }
          function Ct(M2, B2, ee) {
            if (lo(ee) !== "number") return dt(M2.default, B2.default);
            var ie = M2.stops.length;
            if (ie === 1 || ee <= M2.stops[0][0]) return M2.stops[0][1];
            if (ee >= M2.stops[ie - 1][0]) return M2.stops[ie - 1][1];
            var ge = Kn(M2.stops.map(function(_e) {
              return _e[0];
            }), ee);
            return M2.stops[ge][1];
          }
          function St(M2, B2, ee) {
            var ie = M2.base !== void 0 ? M2.base : 1;
            if (lo(ee) !== "number") return dt(M2.default, B2.default);
            var ge = M2.stops.length;
            if (ge === 1 || ee <= M2.stops[0][0]) return M2.stops[0][1];
            if (ee >= M2.stops[ge - 1][0]) return M2.stops[ge - 1][1];
            var _e = Kn(M2.stops.map(function(Xt) {
              return Xt[0];
            }), ee), Oe = function(Xt, ar, er, hr) {
              var Sr = hr - er, Ur = Xt - er;
              return Sr === 0 ? 0 : ar === 1 ? Ur / Sr : (Math.pow(ar, Ur) - 1) / (Math.pow(ar, Sr) - 1);
            }(ee, ie, M2.stops[_e][0], M2.stops[_e + 1][0]), Xe = M2.stops[_e][1], ht = M2.stops[_e + 1][1], Tt = zn[B2.type] || nt;
            if (M2.colorSpace && M2.colorSpace !== "rgb") {
              var Dt = Lc[M2.colorSpace];
              Tt = function(Xt, ar) {
                return Dt.reverse(Dt.interpolate(Dt.forward(Xt), Dt.forward(ar), Oe));
              };
            }
            return typeof Xe.evaluate == "function" ? { evaluate: function() {
              for (var Xt = [], ar = arguments.length; ar--; ) Xt[ar] = arguments[ar];
              var er = Xe.evaluate.apply(void 0, Xt), hr = ht.evaluate.apply(void 0, Xt);
              if (er !== void 0 && hr !== void 0) return Tt(er, hr, Oe);
            } } : Tt(Xe, ht, Oe);
          }
          function Lt(M2, B2, ee) {
            return B2.type === "color" ? ee = pr.parse(ee) : B2.type === "formatted" ? ee = $r.fromString(ee.toString()) : B2.type === "resolvedImage" ? ee = Ar.fromString(ee.toString()) : lo(ee) === B2.type || B2.type === "enum" && B2.values[ee] || (ee = void 0), dt(ee, M2.default, B2.default);
          }
          gn.register(Rc, { error: [{ kind: "error" }, [Me], function(M2, B2) {
            var ee = B2[0];
            throw new Wn(ee.evaluate(M2));
          }], typeof: [Me, [De], function(M2, B2) {
            return jt(wn(B2[0].evaluate(M2)));
          }], "to-rgba": [kt(ke, 4), [ze], function(M2, B2) {
            return B2[0].evaluate(M2).toArray();
          }], rgb: [ze, [ke, ke, ke], zc], rgba: [ze, [ke, ke, ke, ke], zc], has: { type: Le, overloads: [[[Me], function(M2, B2) {
            return Bc(B2[0].evaluate(M2), M2.properties());
          }], [[Me, ft], function(M2, B2) {
            var ee = B2[0], ie = B2[1];
            return Bc(ee.evaluate(M2), ie.evaluate(M2));
          }]] }, get: { type: De, overloads: [[[Me], function(M2, B2) {
            return Tf(B2[0].evaluate(M2), M2.properties());
          }], [[Me, ft], function(M2, B2) {
            var ee = B2[0], ie = B2[1];
            return Tf(ee.evaluate(M2), ie.evaluate(M2));
          }]] }, "feature-state": [De, [Me], function(M2, B2) {
            return Tf(B2[0].evaluate(M2), M2.featureState || {});
          }], properties: [ft, [], function(M2) {
            return M2.properties();
          }], "geometry-type": [Me, [], function(M2) {
            return M2.geometryType();
          }], id: [De, [], function(M2) {
            return M2.id();
          }], zoom: [ke, [], function(M2) {
            return M2.globals.zoom;
          }], "heatmap-density": [ke, [], function(M2) {
            return M2.globals.heatmapDensity || 0;
          }], "line-progress": [ke, [], function(M2) {
            return M2.globals.lineProgress || 0;
          }], accumulated: [De, [], function(M2) {
            return M2.globals.accumulated === void 0 ? null : M2.globals.accumulated;
          }], "+": [ke, bu(ke), function(M2, B2) {
            for (var ee = 0, ie = 0, ge = B2; ie < ge.length; ie += 1) ee += ge[ie].evaluate(M2);
            return ee;
          }], "*": [ke, bu(ke), function(M2, B2) {
            for (var ee = 1, ie = 0, ge = B2; ie < ge.length; ie += 1) ee *= ge[ie].evaluate(M2);
            return ee;
          }], "-": { type: ke, overloads: [[[ke, ke], function(M2, B2) {
            var ee = B2[0], ie = B2[1];
            return ee.evaluate(M2) - ie.evaluate(M2);
          }], [[ke], function(M2, B2) {
            return -B2[0].evaluate(M2);
          }]] }, "/": [ke, [ke, ke], function(M2, B2) {
            var ee = B2[0], ie = B2[1];
            return ee.evaluate(M2) / ie.evaluate(M2);
          }], "%": [ke, [ke, ke], function(M2, B2) {
            var ee = B2[0], ie = B2[1];
            return ee.evaluate(M2) % ie.evaluate(M2);
          }], ln2: [ke, [], function() {
            return Math.LN2;
          }], pi: [ke, [], function() {
            return Math.PI;
          }], e: [ke, [], function() {
            return Math.E;
          }], "^": [ke, [ke, ke], function(M2, B2) {
            var ee = B2[0], ie = B2[1];
            return Math.pow(ee.evaluate(M2), ie.evaluate(M2));
          }], sqrt: [ke, [ke], function(M2, B2) {
            var ee = B2[0];
            return Math.sqrt(ee.evaluate(M2));
          }], log10: [ke, [ke], function(M2, B2) {
            var ee = B2[0];
            return Math.log(ee.evaluate(M2)) / Math.LN10;
          }], ln: [ke, [ke], function(M2, B2) {
            var ee = B2[0];
            return Math.log(ee.evaluate(M2));
          }], log2: [ke, [ke], function(M2, B2) {
            var ee = B2[0];
            return Math.log(ee.evaluate(M2)) / Math.LN2;
          }], sin: [ke, [ke], function(M2, B2) {
            var ee = B2[0];
            return Math.sin(ee.evaluate(M2));
          }], cos: [ke, [ke], function(M2, B2) {
            var ee = B2[0];
            return Math.cos(ee.evaluate(M2));
          }], tan: [ke, [ke], function(M2, B2) {
            var ee = B2[0];
            return Math.tan(ee.evaluate(M2));
          }], asin: [ke, [ke], function(M2, B2) {
            var ee = B2[0];
            return Math.asin(ee.evaluate(M2));
          }], acos: [ke, [ke], function(M2, B2) {
            var ee = B2[0];
            return Math.acos(ee.evaluate(M2));
          }], atan: [ke, [ke], function(M2, B2) {
            var ee = B2[0];
            return Math.atan(ee.evaluate(M2));
          }], min: [ke, bu(ke), function(M2, B2) {
            return Math.min.apply(Math, B2.map(function(ee) {
              return ee.evaluate(M2);
            }));
          }], max: [ke, bu(ke), function(M2, B2) {
            return Math.max.apply(Math, B2.map(function(ee) {
              return ee.evaluate(M2);
            }));
          }], abs: [ke, [ke], function(M2, B2) {
            var ee = B2[0];
            return Math.abs(ee.evaluate(M2));
          }], round: [ke, [ke], function(M2, B2) {
            var ee = B2[0].evaluate(M2);
            return ee < 0 ? -Math.round(-ee) : Math.round(ee);
          }], floor: [ke, [ke], function(M2, B2) {
            var ee = B2[0];
            return Math.floor(ee.evaluate(M2));
          }], ceil: [ke, [ke], function(M2, B2) {
            var ee = B2[0];
            return Math.ceil(ee.evaluate(M2));
          }], "filter-==": [Le, [Me, De], function(M2, B2) {
            var ee = B2[0], ie = B2[1];
            return M2.properties()[ee.value] === ie.value;
          }], "filter-id-==": [Le, [De], function(M2, B2) {
            var ee = B2[0];
            return M2.id() === ee.value;
          }], "filter-type-==": [Le, [Me], function(M2, B2) {
            var ee = B2[0];
            return M2.geometryType() === ee.value;
          }], "filter-<": [Le, [Me, De], function(M2, B2) {
            var ee = B2[0], ie = B2[1], ge = M2.properties()[ee.value], _e = ie.value;
            return typeof ge == typeof _e && ge < _e;
          }], "filter-id-<": [Le, [De], function(M2, B2) {
            var ee = B2[0], ie = M2.id(), ge = ee.value;
            return typeof ie == typeof ge && ie < ge;
          }], "filter->": [Le, [Me, De], function(M2, B2) {
            var ee = B2[0], ie = B2[1], ge = M2.properties()[ee.value], _e = ie.value;
            return typeof ge == typeof _e && ge > _e;
          }], "filter-id->": [Le, [De], function(M2, B2) {
            var ee = B2[0], ie = M2.id(), ge = ee.value;
            return typeof ie == typeof ge && ie > ge;
          }], "filter-<=": [Le, [Me, De], function(M2, B2) {
            var ee = B2[0], ie = B2[1], ge = M2.properties()[ee.value], _e = ie.value;
            return typeof ge == typeof _e && ge <= _e;
          }], "filter-id-<=": [Le, [De], function(M2, B2) {
            var ee = B2[0], ie = M2.id(), ge = ee.value;
            return typeof ie == typeof ge && ie <= ge;
          }], "filter->=": [Le, [Me, De], function(M2, B2) {
            var ee = B2[0], ie = B2[1], ge = M2.properties()[ee.value], _e = ie.value;
            return typeof ge == typeof _e && ge >= _e;
          }], "filter-id->=": [Le, [De], function(M2, B2) {
            var ee = B2[0], ie = M2.id(), ge = ee.value;
            return typeof ie == typeof ge && ie >= ge;
          }], "filter-has": [Le, [De], function(M2, B2) {
            return B2[0].value in M2.properties();
          }], "filter-has-id": [Le, [], function(M2) {
            return M2.id() !== null && M2.id() !== void 0;
          }], "filter-type-in": [Le, [kt(Me)], function(M2, B2) {
            return B2[0].value.indexOf(M2.geometryType()) >= 0;
          }], "filter-id-in": [Le, [kt(De)], function(M2, B2) {
            return B2[0].value.indexOf(M2.id()) >= 0;
          }], "filter-in-small": [Le, [Me, kt(De)], function(M2, B2) {
            var ee = B2[0];
            return B2[1].value.indexOf(M2.properties()[ee.value]) >= 0;
          }], "filter-in-large": [Le, [Me, kt(De)], function(M2, B2) {
            var ee = B2[0], ie = B2[1];
            return function(ge, _e, Oe, Xe) {
              for (; Oe <= Xe; ) {
                var ht = Oe + Xe >> 1;
                if (_e[ht] === ge) return true;
                _e[ht] > ge ? Xe = ht - 1 : Oe = ht + 1;
              }
              return false;
            }(M2.properties()[ee.value], ie.value, 0, ie.value.length - 1);
          }], all: { type: Le, overloads: [[[Le, Le], function(M2, B2) {
            var ee = B2[0], ie = B2[1];
            return ee.evaluate(M2) && ie.evaluate(M2);
          }], [bu(Le), function(M2, B2) {
            for (var ee = 0, ie = B2; ee < ie.length; ee += 1) if (!ie[ee].evaluate(M2)) return false;
            return true;
          }]] }, any: { type: Le, overloads: [[[Le, Le], function(M2, B2) {
            var ee = B2[0], ie = B2[1];
            return ee.evaluate(M2) || ie.evaluate(M2);
          }], [bu(Le), function(M2, B2) {
            for (var ee = 0, ie = B2; ee < ie.length; ee += 1) if (ie[ee].evaluate(M2)) return true;
            return false;
          }]] }, "!": [Le, [Le], function(M2, B2) {
            return !B2[0].evaluate(M2);
          }], "is-supported-script": [Le, [Me], function(M2, B2) {
            var ee = B2[0], ie = M2.globals && M2.globals.isSupportedScript;
            return !ie || ie(ee.evaluate(M2));
          }], upcase: [Me, [Me], function(M2, B2) {
            return B2[0].evaluate(M2).toUpperCase();
          }], downcase: [Me, [Me], function(M2, B2) {
            return B2[0].evaluate(M2).toLowerCase();
          }], concat: [Me, bu(De), function(M2, B2) {
            return B2.map(function(ee) {
              return Yn(ee.evaluate(M2));
            }).join("");
          }], "resolved-locale": [Me, [Je], function(M2, B2) {
            return B2[0].evaluate(M2).resolvedLocale();
          }] });
          var ir = function(M2, B2) {
            this.expression = M2, this._warningHistory = {}, this._evaluator = new Ln(), this._defaultValue = B2 ? function(ee) {
              return ee.type === "color" && Qe(ee.default) ? new pr(0, 0, 0, 0) : ee.type === "color" ? pr.parse(ee.default) || null : ee.default === void 0 ? null : ee.default;
            }(B2) : null, this._enumValues = B2 && B2.type === "enum" ? B2.values : null;
          };
          function or(M2) {
            return Array.isArray(M2) && M2.length > 0 && typeof M2[0] == "string" && M2[0] in Rc;
          }
          function nr(M2, B2) {
            var ee = new Rn(Rc, [], B2 ? function(ge) {
              var _e = { color: ze, string: Me, number: ke, enum: Me, boolean: Le, formatted: tt, resolvedImage: vt };
              return ge.type === "array" ? kt(_e[ge.value] || De, ge.length) : _e[ge.type];
            }(B2) : void 0), ie = ee.parse(M2, void 0, void 0, void 0, B2 && B2.type === "string" ? { typeAnnotation: "coerce" } : void 0);
            return ie ? bh(new ir(ie, B2)) : cu(ee.errors);
          }
          ir.prototype.evaluateWithoutErrorHandling = function(M2, B2, ee, ie, ge, _e) {
            return this._evaluator.globals = M2, this._evaluator.feature = B2, this._evaluator.featureState = ee, this._evaluator.canonical = ie, this._evaluator.availableImages = ge || null, this._evaluator.formattedSection = _e, this.expression.evaluate(this._evaluator);
          }, ir.prototype.evaluate = function(M2, B2, ee, ie, ge, _e) {
            this._evaluator.globals = M2, this._evaluator.feature = B2 || null, this._evaluator.featureState = ee || null, this._evaluator.canonical = ie, this._evaluator.availableImages = ge || null, this._evaluator.formattedSection = _e || null;
            try {
              var Oe = this.expression.evaluate(this._evaluator);
              if (Oe == null || typeof Oe == "number" && Oe != Oe) return this._defaultValue;
              if (this._enumValues && !(Oe in this._enumValues)) throw new Wn("Expected value to be one of " + Object.keys(this._enumValues).map(function(Xe) {
                return JSON.stringify(Xe);
              }).join(", ") + ", but found " + JSON.stringify(Oe) + " instead.");
              return Oe;
            } catch (Xe) {
              return this._warningHistory[Xe.message] || (this._warningHistory[Xe.message] = true, typeof console < "u" && console.warn(Xe.message)), this._defaultValue;
            }
          };
          var fr = function(M2, B2) {
            this.kind = M2, this._styleExpression = B2, this.isStateDependent = M2 !== "constant" && !sn(B2.expression);
          };
          fr.prototype.evaluateWithoutErrorHandling = function(M2, B2, ee, ie, ge, _e) {
            return this._styleExpression.evaluateWithoutErrorHandling(M2, B2, ee, ie, ge, _e);
          }, fr.prototype.evaluate = function(M2, B2, ee, ie, ge, _e) {
            return this._styleExpression.evaluate(M2, B2, ee, ie, ge, _e);
          };
          var wr = function(M2, B2, ee, ie) {
            this.kind = M2, this.zoomStops = ee, this._styleExpression = B2, this.isStateDependent = M2 !== "camera" && !sn(B2.expression), this.interpolationType = ie;
          };
          function Er(M2, B2) {
            if ((M2 = nr(M2, B2)).result === "error") return M2;
            var ee = M2.value.expression, ie = Bn(ee);
            if (!ie && !Uc(B2)) return cu([new He("", "data expressions not supported")]);
            var ge = an(ee, ["zoom"]);
            if (!ge && !_h(B2)) return cu([new He("", "zoom expressions not supported")]);
            var _e = function Xe(ht) {
              var Tt = null;
              if (ht instanceof Ss) Tt = Xe(ht.result);
              else if (ht instanceof yu) for (var Dt = 0, Xt = ht.args; Dt < Xt.length; Dt += 1) {
                var ar = Xt[Dt];
                if (Tt = Xe(ar)) break;
              }
              else (ht instanceof qa || ht instanceof po) && ht.input instanceof gn && ht.input.name === "zoom" && (Tt = ht);
              return Tt instanceof He || ht.eachChild(function(er) {
                var hr = Xe(er);
                hr instanceof He ? Tt = hr : !Tt && hr ? Tt = new He("", '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.') : Tt && hr && Tt !== hr && (Tt = new He("", 'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'));
              }), Tt;
            }(ee);
            if (!_e && !ge) return cu([new He("", '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);
            if (_e instanceof He) return cu([_e]);
            if (_e instanceof po && !ac(B2)) return cu([new He("", '"interpolate" expressions cannot be used with this property')]);
            if (!_e) return bh(new fr(ie ? "constant" : "source", M2.value));
            var Oe = _e instanceof po ? _e.interpolation : void 0;
            return bh(new wr(ie ? "camera" : "composite", M2.value, _e.labels, Oe));
          }
          wr.prototype.evaluateWithoutErrorHandling = function(M2, B2, ee, ie, ge, _e) {
            return this._styleExpression.evaluateWithoutErrorHandling(M2, B2, ee, ie, ge, _e);
          }, wr.prototype.evaluate = function(M2, B2, ee, ie, ge, _e) {
            return this._styleExpression.evaluate(M2, B2, ee, ie, ge, _e);
          }, wr.prototype.interpolationFactor = function(M2, B2, ee) {
            return this.interpolationType ? po.interpolationFactor(this.interpolationType, M2, B2, ee) : 0;
          };
          var Mr = function(M2, B2) {
            this._parameters = M2, this._specification = B2, qe(this, function ee(ie, ge) {
              var _e, Oe, Xe, ht = ge.type === "color", Tt = ie.stops && typeof ie.stops[0][0] == "object", Dt = Tt || ie.property !== void 0, Xt = Tt || !Dt, ar = ie.type || (ac(ge) ? "exponential" : "interval");
              if (ht && ((ie = qe({}, ie)).stops && (ie.stops = ie.stops.map(function($a) {
                return [$a[0], pr.parse($a[1])];
              })), ie.default ? ie.default = pr.parse(ie.default) : ie.default = pr.parse(ge.default)), ie.colorSpace && ie.colorSpace !== "rgb" && !Lc[ie.colorSpace]) throw new Error("Unknown color space: " + ie.colorSpace);
              if (ar === "exponential") _e = St;
              else if (ar === "interval") _e = Ct;
              else if (ar === "categorical") {
                _e = _t, Oe = /* @__PURE__ */ Object.create(null);
                for (var er = 0, hr = ie.stops; er < hr.length; er += 1) {
                  var Sr = hr[er];
                  Oe[Sr[0]] = Sr[1];
                }
                Xe = typeof ie.stops[0][0];
              } else {
                if (ar !== "identity") throw new Error('Unknown function type "' + ar + '"');
                _e = Lt;
              }
              if (Tt) {
                for (var Ur = {}, Br = [], rn = 0; rn < ie.stops.length; rn++) {
                  var nn = ie.stops[rn], cn = nn[0].zoom;
                  Ur[cn] === void 0 && (Ur[cn] = { zoom: cn, type: ie.type, property: ie.property, default: ie.default, stops: [] }, Br.push(cn)), Ur[cn].stops.push([nn[0].value, nn[1]]);
                }
                for (var In = [], Un = 0, ha = Br; Un < ha.length; Un += 1) {
                  var fa = ha[Un];
                  In.push([Ur[fa].zoom, ee(Ur[fa], ge)]);
                }
                var wa = { name: "linear" };
                return { kind: "composite", interpolationType: wa, interpolationFactor: po.interpolationFactor.bind(void 0, wa), zoomStops: In.map(function($a) {
                  return $a[0];
                }), evaluate: function($a, Ea) {
                  var oi = $a.zoom;
                  return St({ stops: In, base: ie.base }, ge, oi).evaluate(oi, Ea);
                } };
              }
              if (Xt) {
                var Wa = ar === "exponential" ? { name: "exponential", base: ie.base !== void 0 ? ie.base : 1 } : null;
                return { kind: "camera", interpolationType: Wa, interpolationFactor: po.interpolationFactor.bind(void 0, Wa), zoomStops: ie.stops.map(function($a) {
                  return $a[0];
                }), evaluate: function($a) {
                  var Ea = $a.zoom;
                  return _e(ie, ge, Ea, Oe, Xe);
                } };
              }
              return { kind: "source", evaluate: function($a, Ea) {
                var oi = Ea && Ea.properties ? Ea.properties[ie.property] : void 0;
                return oi === void 0 ? dt(ie.default, ge.default) : _e(ie, ge, oi, Oe, Xe);
              } };
            }(this._parameters, this._specification));
          };
          function Wr(M2) {
            var B2 = M2.key, ee = M2.value, ie = M2.valueSpec || {}, ge = M2.objectElementValidators || {}, _e = M2.style, Oe = M2.styleSpec, Xe = [], ht = lo(ee);
            if (ht !== "object") return [new ut(B2, ee, "object expected, " + ht + " found")];
            for (var Tt in ee) {
              var Dt = Tt.split(".")[0], Xt = ie[Dt] || ie["*"], ar = void 0;
              if (ge[Dt]) ar = ge[Dt];
              else if (ie[Dt]) ar = dr;
              else if (ge["*"]) ar = ge["*"];
              else {
                if (!ie["*"]) {
                  Xe.push(new ut(B2, ee[Tt], 'unknown property "' + Tt + '"'));
                  continue;
                }
                ar = dr;
              }
              Xe = Xe.concat(ar({ key: (B2 && B2 + ".") + Tt, value: ee[Tt], valueSpec: Xt, style: _e, styleSpec: Oe, object: ee, objectKey: Tt }, ee));
            }
            for (var er in ie) ge[er] || ie[er].required && ie[er].default === void 0 && ee[er] === void 0 && Xe.push(new ut(B2, ee, 'missing required property "' + er + '"'));
            return Xe;
          }
          function kn(M2) {
            var B2 = M2.value, ee = M2.valueSpec, ie = M2.style, ge = M2.styleSpec, _e = M2.key, Oe = M2.arrayElementValidator || dr;
            if (lo(B2) !== "array") return [new ut(_e, B2, "array expected, " + lo(B2) + " found")];
            if (ee.length && B2.length !== ee.length) return [new ut(_e, B2, "array length " + ee.length + " expected, length " + B2.length + " found")];
            if (ee["min-length"] && B2.length < ee["min-length"]) return [new ut(_e, B2, "array length at least " + ee["min-length"] + " expected, length " + B2.length + " found")];
            var Xe = { type: ee.value, values: ee.values };
            ge.$version < 7 && (Xe.function = ee.function), lo(ee.value) === "object" && (Xe = ee.value);
            for (var ht = [], Tt = 0; Tt < B2.length; Tt++) ht = ht.concat(Oe({ array: B2, arrayIndex: Tt, value: B2[Tt], valueSpec: Xe, style: ie, styleSpec: ge, key: _e + "[" + Tt + "]" }));
            return ht;
          }
          function On(M2) {
            var B2 = M2.key, ee = M2.value, ie = M2.valueSpec, ge = lo(ee);
            return ge === "number" && ee != ee && (ge = "NaN"), ge !== "number" ? [new ut(B2, ee, "number expected, " + ge + " found")] : "minimum" in ie && ee < ie.minimum ? [new ut(B2, ee, ee + " is less than the minimum value " + ie.minimum)] : "maximum" in ie && ee > ie.maximum ? [new ut(B2, ee, ee + " is greater than the maximum value " + ie.maximum)] : [];
          }
          function ta(M2) {
            var B2, ee, ie, ge = M2.valueSpec, _e = je(M2.value.type), Oe = {}, Xe = _e !== "categorical" && M2.value.property === void 0, ht = !Xe, Tt = lo(M2.value.stops) === "array" && lo(M2.value.stops[0]) === "array" && lo(M2.value.stops[0][0]) === "object", Dt = Wr({ key: M2.key, value: M2.value, valueSpec: M2.styleSpec.function, style: M2.style, styleSpec: M2.styleSpec, objectElementValidators: { stops: function(er) {
              if (_e === "identity") return [new ut(er.key, er.value, 'identity function may not have a "stops" property')];
              var hr = [], Sr = er.value;
              return hr = hr.concat(kn({ key: er.key, value: Sr, valueSpec: er.valueSpec, style: er.style, styleSpec: er.styleSpec, arrayElementValidator: Xt })), lo(Sr) === "array" && Sr.length === 0 && hr.push(new ut(er.key, Sr, "array must have at least one stop")), hr;
            }, default: function(er) {
              return dr({ key: er.key, value: er.value, valueSpec: ge, style: er.style, styleSpec: er.styleSpec });
            } } });
            return _e === "identity" && Xe && Dt.push(new ut(M2.key, M2.value, 'missing required property "property"')), _e === "identity" || M2.value.stops || Dt.push(new ut(M2.key, M2.value, 'missing required property "stops"')), _e === "exponential" && M2.valueSpec.expression && !ac(M2.valueSpec) && Dt.push(new ut(M2.key, M2.value, "exponential functions not supported")), M2.styleSpec.$version >= 8 && (ht && !Uc(M2.valueSpec) ? Dt.push(new ut(M2.key, M2.value, "property functions not supported")) : Xe && !_h(M2.valueSpec) && Dt.push(new ut(M2.key, M2.value, "zoom functions not supported"))), _e !== "categorical" && !Tt || M2.value.property !== void 0 || Dt.push(new ut(M2.key, M2.value, '"property" property is required')), Dt;
            function Xt(er) {
              var hr = [], Sr = er.value, Ur = er.key;
              if (lo(Sr) !== "array") return [new ut(Ur, Sr, "array expected, " + lo(Sr) + " found")];
              if (Sr.length !== 2) return [new ut(Ur, Sr, "array length 2 expected, length " + Sr.length + " found")];
              if (Tt) {
                if (lo(Sr[0]) !== "object") return [new ut(Ur, Sr, "object expected, " + lo(Sr[0]) + " found")];
                if (Sr[0].zoom === void 0) return [new ut(Ur, Sr, "object stop key must have zoom")];
                if (Sr[0].value === void 0) return [new ut(Ur, Sr, "object stop key must have value")];
                if (ie && ie > je(Sr[0].zoom)) return [new ut(Ur, Sr[0].zoom, "stop zoom values must appear in ascending order")];
                je(Sr[0].zoom) !== ie && (ie = je(Sr[0].zoom), ee = void 0, Oe = {}), hr = hr.concat(Wr({ key: Ur + "[0]", value: Sr[0], valueSpec: { zoom: {} }, style: er.style, styleSpec: er.styleSpec, objectElementValidators: { zoom: On, value: ar } }));
              } else hr = hr.concat(ar({ key: Ur + "[0]", value: Sr[0], valueSpec: {}, style: er.style, styleSpec: er.styleSpec }, Sr));
              return or(rt(Sr[1])) ? hr.concat([new ut(Ur + "[1]", Sr[1], "expressions are not allowed in function stops.")]) : hr.concat(dr({ key: Ur + "[1]", value: Sr[1], valueSpec: ge, style: er.style, styleSpec: er.styleSpec }));
            }
            function ar(er, hr) {
              var Sr = lo(er.value), Ur = je(er.value), Br = er.value !== null ? er.value : hr;
              if (B2) {
                if (Sr !== B2) return [new ut(er.key, Br, Sr + " stop domain type must match previous stop domain type " + B2)];
              } else B2 = Sr;
              if (Sr !== "number" && Sr !== "string" && Sr !== "boolean") return [new ut(er.key, Br, "stop domain value must be a number, string, or boolean")];
              if (Sr !== "number" && _e !== "categorical") {
                var rn = "number expected, " + Sr + " found";
                return Uc(ge) && _e === void 0 && (rn += '\nIf you intended to use a categorical function, specify `"type": "categorical"`.'), [new ut(er.key, Br, rn)];
              }
              return _e !== "categorical" || Sr !== "number" || isFinite(Ur) && Math.floor(Ur) === Ur ? _e !== "categorical" && Sr === "number" && ee !== void 0 && Ur < ee ? [new ut(er.key, Br, "stop domain values must appear in ascending order")] : (ee = Ur, _e === "categorical" && Ur in Oe ? [new ut(er.key, Br, "stop domain values must be unique")] : (Oe[Ur] = true, [])) : [new ut(er.key, Br, "integer expected, found " + Ur)];
            }
          }
          function sa(M2) {
            var B2 = (M2.expressionContext === "property" ? Er : nr)(rt(M2.value), M2.valueSpec);
            if (B2.result === "error") return B2.value.map(function(ie) {
              return new ut("" + M2.key + ie.key, M2.value, ie.message);
            });
            var ee = B2.value.expression || B2.value._styleExpression.expression;
            if (M2.expressionContext === "property" && M2.propertyKey === "text-font" && !ee.outputDefined()) return [new ut(M2.key, M2.value, 'Invalid data expression for "' + M2.propertyKey + '". Output values must be contained as literals within the expression.')];
            if (M2.expressionContext === "property" && M2.propertyType === "layout" && !sn(ee)) return [new ut(M2.key, M2.value, '"feature-state" data expressions are not supported with layout properties.')];
            if (M2.expressionContext === "filter" && !sn(ee)) return [new ut(M2.key, M2.value, '"feature-state" data expressions are not supported with filters.')];
            if (M2.expressionContext && M2.expressionContext.indexOf("cluster") === 0) {
              if (!an(ee, ["zoom", "feature-state"])) return [new ut(M2.key, M2.value, '"zoom" and "feature-state" expressions are not supported with cluster properties.')];
              if (M2.expressionContext === "cluster-initial" && !Bn(ee)) return [new ut(M2.key, M2.value, "Feature data expressions are not supported with initial expression part of cluster properties.")];
            }
            return [];
          }
          function xa(M2) {
            var B2 = M2.key, ee = M2.value, ie = M2.valueSpec, ge = [];
            return Array.isArray(ie.values) ? ie.values.indexOf(je(ee)) === -1 && ge.push(new ut(B2, ee, "expected one of [" + ie.values.join(", ") + "], " + JSON.stringify(ee) + " found")) : Object.keys(ie.values).indexOf(je(ee)) === -1 && ge.push(new ut(B2, ee, "expected one of [" + Object.keys(ie.values).join(", ") + "], " + JSON.stringify(ee) + " found")), ge;
          }
          function la(M2) {
            if (M2 === true || M2 === false) return true;
            if (!Array.isArray(M2) || M2.length === 0) return false;
            switch (M2[0]) {
              case "has":
                return M2.length >= 2 && M2[1] !== "$id" && M2[1] !== "$type";
              case "in":
                return M2.length >= 3 && (typeof M2[1] != "string" || Array.isArray(M2[2]));
              case "!in":
              case "!has":
              case "none":
                return false;
              case "==":
              case "!=":
              case ">":
              case ">=":
              case "<":
              case "<=":
                return M2.length !== 3 || Array.isArray(M2[1]) || Array.isArray(M2[2]);
              case "any":
              case "all":
                for (var B2 = 0, ee = M2.slice(1); B2 < ee.length; B2 += 1) {
                  var ie = ee[B2];
                  if (!la(ie) && typeof ie != "boolean") return false;
                }
                return true;
              default:
                return true;
            }
          }
          Mr.deserialize = function(M2) {
            return new Mr(M2._parameters, M2._specification);
          }, Mr.serialize = function(M2) {
            return { _parameters: M2._parameters, _specification: M2._specification };
          };
          var ci = { type: "boolean", default: false, transition: false, "property-type": "data-driven", expression: { interpolated: false, parameters: ["zoom", "feature"] } };
          function Ci(M2) {
            if (M2 == null) return { filter: function() {
              return true;
            }, needGeometry: false };
            la(M2) || (M2 = Zi(M2));
            var B2 = nr(M2, ci);
            if (B2.result === "error") throw new Error(B2.value.map(function(ee) {
              return ee.key + ": " + ee.message;
            }).join(", "));
            return { filter: function(ee, ie, ge) {
              return B2.value.evaluate(ee, ie, {}, ge);
            }, needGeometry: function ee(ie) {
              if (!Array.isArray(ie)) return false;
              if (ie[0] === "within") return true;
              for (var ge = 1; ge < ie.length; ge++) if (ee(ie[ge])) return true;
              return false;
            }(M2) };
          }
          function Qi(M2, B2) {
            return M2 < B2 ? -1 : M2 > B2 ? 1 : 0;
          }
          function Zi(M2) {
            if (!M2) return true;
            var B2, ee = M2[0];
            return M2.length <= 1 ? ee !== "any" : ee === "==" ? eo(M2[1], M2[2], "==") : ee === "!=" ? Vo(eo(M2[1], M2[2], "==")) : ee === "<" || ee === ">" || ee === "<=" || ee === ">=" ? eo(M2[1], M2[2], ee) : ee === "any" ? (B2 = M2.slice(1), ["any"].concat(B2.map(Zi))) : ee === "all" ? ["all"].concat(M2.slice(1).map(Zi)) : ee === "none" ? ["all"].concat(M2.slice(1).map(Zi).map(Vo)) : ee === "in" ? Es(M2[1], M2.slice(2)) : ee === "!in" ? Vo(Es(M2[1], M2.slice(2))) : ee === "has" ? vs(M2[1]) : ee === "!has" ? Vo(vs(M2[1])) : ee !== "within" || M2;
          }
          function eo(M2, B2, ee) {
            switch (M2) {
              case "$type":
                return ["filter-type-" + ee, B2];
              case "$id":
                return ["filter-id-" + ee, B2];
              default:
                return ["filter-" + ee, M2, B2];
            }
          }
          function Es(M2, B2) {
            if (B2.length === 0) return false;
            switch (M2) {
              case "$type":
                return ["filter-type-in", ["literal", B2]];
              case "$id":
                return ["filter-id-in", ["literal", B2]];
              default:
                return B2.length > 200 && !B2.some(function(ee) {
                  return typeof ee != typeof B2[0];
                }) ? ["filter-in-large", M2, ["literal", B2.sort(Qi)]] : ["filter-in-small", M2, ["literal", B2]];
            }
          }
          function vs(M2) {
            switch (M2) {
              case "$type":
                return true;
              case "$id":
                return ["filter-has-id"];
              default:
                return ["filter-has", M2];
            }
          }
          function Vo(M2) {
            return ["!", M2];
          }
          function jo(M2) {
            return la(rt(M2.value)) ? sa(qe({}, M2, { expressionContext: "filter", valueSpec: { value: "boolean" } })) : function B2(ee) {
              var ie = ee.value, ge = ee.key;
              if (lo(ie) !== "array") return [new ut(ge, ie, "array expected, " + lo(ie) + " found")];
              var _e, Oe = ee.styleSpec, Xe = [];
              if (ie.length < 1) return [new ut(ge, ie, "filter array must have at least 1 element")];
              switch (Xe = Xe.concat(xa({ key: ge + "[0]", value: ie[0], valueSpec: Oe.filter_operator, style: ee.style, styleSpec: ee.styleSpec })), je(ie[0])) {
                case "<":
                case "<=":
                case ">":
                case ">=":
                  ie.length >= 2 && je(ie[1]) === "$type" && Xe.push(new ut(ge, ie, '"$type" cannot be use with operator "' + ie[0] + '"'));
                case "==":
                case "!=":
                  ie.length !== 3 && Xe.push(new ut(ge, ie, 'filter array for operator "' + ie[0] + '" must have 3 elements'));
                case "in":
                case "!in":
                  ie.length >= 2 && (_e = lo(ie[1])) !== "string" && Xe.push(new ut(ge + "[1]", ie[1], "string expected, " + _e + " found"));
                  for (var ht = 2; ht < ie.length; ht++) _e = lo(ie[ht]), je(ie[1]) === "$type" ? Xe = Xe.concat(xa({ key: ge + "[" + ht + "]", value: ie[ht], valueSpec: Oe.geometry_type, style: ee.style, styleSpec: ee.styleSpec })) : _e !== "string" && _e !== "number" && _e !== "boolean" && Xe.push(new ut(ge + "[" + ht + "]", ie[ht], "string, number, or boolean expected, " + _e + " found"));
                  break;
                case "any":
                case "all":
                case "none":
                  for (var Tt = 1; Tt < ie.length; Tt++) Xe = Xe.concat(B2({ key: ge + "[" + Tt + "]", value: ie[Tt], style: ee.style, styleSpec: ee.styleSpec }));
                  break;
                case "has":
                case "!has":
                  _e = lo(ie[1]), ie.length !== 2 ? Xe.push(new ut(ge, ie, 'filter array for "' + ie[0] + '" operator must have 2 elements')) : _e !== "string" && Xe.push(new ut(ge + "[1]", ie[1], "string expected, " + _e + " found"));
                  break;
                case "within":
                  _e = lo(ie[1]), ie.length !== 2 ? Xe.push(new ut(ge, ie, 'filter array for "' + ie[0] + '" operator must have 2 elements')) : _e !== "object" && Xe.push(new ut(ge + "[1]", ie[1], "object expected, " + _e + " found"));
              }
              return Xe;
            }(M2);
          }
          function ms(M2, B2) {
            var ee = M2.key, ie = M2.style, ge = M2.styleSpec, _e = M2.value, Oe = M2.objectKey, Xe = ge[B2 + "_" + M2.layerType];
            if (!Xe) return [];
            var ht = Oe.match(/^(.*)-transition$/);
            if (B2 === "paint" && ht && Xe[ht[1]] && Xe[ht[1]].transition) return dr({ key: ee, value: _e, valueSpec: ge.transition, style: ie, styleSpec: ge });
            var Tt, Dt = M2.valueSpec || Xe[Oe];
            if (!Dt) return [new ut(ee, _e, 'unknown property "' + Oe + '"')];
            if (lo(_e) === "string" && Uc(Dt) && !Dt.tokens && (Tt = /^{([^}]+)}$/.exec(_e))) return [new ut(ee, _e, '"' + Oe + '" does not support interpolation syntax\nUse an identity property function instead: `{ "type": "identity", "property": ' + JSON.stringify(Tt[1]) + " }`.")];
            var Xt = [];
            return M2.layerType === "symbol" && (Oe === "text-field" && ie && !ie.glyphs && Xt.push(new ut(ee, _e, 'use of "text-field" requires a style "glyphs" property')), Oe === "text-font" && Qe(rt(_e)) && je(_e.type) === "identity" && Xt.push(new ut(ee, _e, '"text-font" does not support identity functions'))), Xt.concat(dr({ key: M2.key, value: _e, valueSpec: Dt, style: ie, styleSpec: ge, expressionContext: "property", propertyType: B2, propertyKey: Oe }));
          }
          function al(M2) {
            return ms(M2, "paint");
          }
          function Xl(M2) {
            return ms(M2, "layout");
          }
          function Kl(M2) {
            var B2 = [], ee = M2.value, ie = M2.key, ge = M2.style, _e = M2.styleSpec;
            ee.type || ee.ref || B2.push(new ut(ie, ee, 'either "type" or "ref" is required'));
            var Oe, Xe = je(ee.type), ht = je(ee.ref);
            if (ee.id) for (var Tt = je(ee.id), Dt = 0; Dt < M2.arrayIndex; Dt++) {
              var Xt = ge.layers[Dt];
              je(Xt.id) === Tt && B2.push(new ut(ie, ee.id, 'duplicate layer id "' + ee.id + '", previously used at line ' + Xt.id.__line__));
            }
            if ("ref" in ee) ["type", "source", "source-layer", "filter", "layout"].forEach(function(hr) {
              hr in ee && B2.push(new ut(ie, ee[hr], '"' + hr + '" is prohibited for ref layers'));
            }), ge.layers.forEach(function(hr) {
              je(hr.id) === ht && (Oe = hr);
            }), Oe ? Oe.ref ? B2.push(new ut(ie, ee.ref, "ref cannot reference another ref layer")) : Xe = je(Oe.type) : B2.push(new ut(ie, ee.ref, 'ref layer "' + ht + '" not found'));
            else if (Xe !== "background") if (ee.source) {
              var ar = ge.sources && ge.sources[ee.source], er = ar && je(ar.type);
              ar ? er === "vector" && Xe === "raster" ? B2.push(new ut(ie, ee.source, 'layer "' + ee.id + '" requires a raster source')) : er === "raster" && Xe !== "raster" ? B2.push(new ut(ie, ee.source, 'layer "' + ee.id + '" requires a vector source')) : er !== "vector" || ee["source-layer"] ? er === "raster-dem" && Xe !== "hillshade" ? B2.push(new ut(ie, ee.source, "raster-dem source can only be used with layer type 'hillshade'.")) : Xe !== "line" || !ee.paint || !ee.paint["line-gradient"] || er === "geojson" && ar.lineMetrics || B2.push(new ut(ie, ee, 'layer "' + ee.id + '" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.')) : B2.push(new ut(ie, ee, 'layer "' + ee.id + '" must specify a "source-layer"')) : B2.push(new ut(ie, ee.source, 'source "' + ee.source + '" not found'));
            } else B2.push(new ut(ie, ee, 'missing required property "source"'));
            return B2 = B2.concat(Wr({ key: ie, value: ee, valueSpec: _e.layer, style: M2.style, styleSpec: M2.styleSpec, objectElementValidators: { "*": function() {
              return [];
            }, type: function() {
              return dr({ key: ie + ".type", value: ee.type, valueSpec: _e.layer.type, style: M2.style, styleSpec: M2.styleSpec, object: ee, objectKey: "type" });
            }, filter: jo, layout: function(hr) {
              return Wr({ layer: ee, key: hr.key, value: hr.value, style: hr.style, styleSpec: hr.styleSpec, objectElementValidators: { "*": function(Sr) {
                return Xl(qe({ layerType: Xe }, Sr));
              } } });
            }, paint: function(hr) {
              return Wr({ layer: ee, key: hr.key, value: hr.value, style: hr.style, styleSpec: hr.styleSpec, objectElementValidators: { "*": function(Sr) {
                return al(qe({ layerType: Xe }, Sr));
              } } });
            } } }));
          }
          function Yl(M2) {
            var B2 = M2.value, ee = M2.key, ie = lo(B2);
            return ie !== "string" ? [new ut(ee, B2, "string expected, " + ie + " found")] : [];
          }
          var Zl = { promoteId: function(M2) {
            var B2 = M2.key, ee = M2.value;
            if (lo(ee) === "string") return Yl({ key: B2, value: ee });
            var ie = [];
            for (var ge in ee) ie.push.apply(ie, Yl({ key: B2 + "." + ge, value: ee[ge] }));
            return ie;
          } };
          function qi(M2) {
            var B2 = M2.value, ee = M2.key, ie = M2.styleSpec, ge = M2.style;
            if (!B2.type) return [new ut(ee, B2, '"type" is required')];
            var _e, Oe = je(B2.type);
            switch (Oe) {
              case "vector":
              case "raster":
              case "raster-dem":
                return _e = Wr({ key: ee, value: B2, valueSpec: ie["source_" + Oe.replace("-", "_")], style: M2.style, styleSpec: ie, objectElementValidators: Zl });
              case "geojson":
                if (_e = Wr({ key: ee, value: B2, valueSpec: ie.source_geojson, style: ge, styleSpec: ie, objectElementValidators: Zl }), B2.cluster) for (var Xe in B2.clusterProperties) {
                  var ht = B2.clusterProperties[Xe], Tt = ht[0], Dt = ht[1], Xt = typeof Tt == "string" ? [Tt, ["accumulated"], ["get", Xe]] : Tt;
                  _e.push.apply(_e, sa({ key: ee + "." + Xe + ".map", value: Dt, expressionContext: "cluster-map" })), _e.push.apply(_e, sa({ key: ee + "." + Xe + ".reduce", value: Xt, expressionContext: "cluster-reduce" }));
                }
                return _e;
              case "video":
                return Wr({ key: ee, value: B2, valueSpec: ie.source_video, style: ge, styleSpec: ie });
              case "image":
                return Wr({ key: ee, value: B2, valueSpec: ie.source_image, style: ge, styleSpec: ie });
              case "canvas":
                return [new ut(ee, null, "Please use runtime APIs to add canvas sources, rather than including them in stylesheets.", "source.canvas")];
              default:
                return xa({ key: ee + ".type", value: B2.type, valueSpec: { values: ["vector", "raster", "raster-dem", "geojson", "video", "image"] }, style: ge, styleSpec: ie });
            }
          }
          function At(M2) {
            var B2 = M2.value, ee = M2.styleSpec, ie = ee.light, ge = M2.style, _e = [], Oe = lo(B2);
            if (B2 === void 0) return _e;
            if (Oe !== "object") return _e = _e.concat([new ut("light", B2, "object expected, " + Oe + " found")]);
            for (var Xe in B2) {
              var ht = Xe.match(/^(.*)-transition$/);
              _e = ht && ie[ht[1]] && ie[ht[1]].transition ? _e.concat(dr({ key: Xe, value: B2[Xe], valueSpec: ee.transition, style: ge, styleSpec: ee })) : ie[Xe] ? _e.concat(dr({ key: Xe, value: B2[Xe], valueSpec: ie[Xe], style: ge, styleSpec: ee })) : _e.concat([new ut(Xe, B2[Xe], 'unknown property "' + Xe + '"')]);
            }
            return _e;
          }
          var Ht = { "*": function() {
            return [];
          }, array: kn, boolean: function(M2) {
            var B2 = M2.value, ee = M2.key, ie = lo(B2);
            return ie !== "boolean" ? [new ut(ee, B2, "boolean expected, " + ie + " found")] : [];
          }, number: On, color: function(M2) {
            var B2 = M2.key, ee = M2.value, ie = lo(ee);
            return ie !== "string" ? [new ut(B2, ee, "color expected, " + ie + " found")] : yr(ee) === null ? [new ut(B2, ee, 'color expected, "' + ee + '" found')] : [];
          }, constants: Re, enum: xa, filter: jo, function: ta, layer: Kl, object: Wr, source: qi, light: At, string: Yl, formatted: function(M2) {
            return Yl(M2).length === 0 ? [] : sa(M2);
          }, resolvedImage: function(M2) {
            return Yl(M2).length === 0 ? [] : sa(M2);
          } };
          function dr(M2) {
            var B2 = M2.value, ee = M2.valueSpec, ie = M2.styleSpec;
            return ee.expression && Qe(je(B2)) ? ta(M2) : ee.expression && or(rt(B2)) ? sa(M2) : ee.type && Ht[ee.type] ? Ht[ee.type](M2) : Wr(qe({}, M2, { valueSpec: ee.type ? ie[ee.type] : ee }));
          }
          function Qt(M2) {
            var B2 = M2.value, ee = M2.key, ie = Yl(M2);
            return ie.length || (B2.indexOf("{fontstack}") === -1 && ie.push(new ut(ee, B2, '"glyphs" url must include a "{fontstack}" token')), B2.indexOf("{range}") === -1 && ie.push(new ut(ee, B2, '"glyphs" url must include a "{range}" token'))), ie;
          }
          function vr(M2, B2) {
            B2 === void 0 && (B2 = Ve);
            var ee = [];
            return ee = ee.concat(dr({ key: "", value: M2, valueSpec: B2.$root, styleSpec: B2, style: M2, objectElementValidators: { glyphs: Qt, "*": function() {
              return [];
            } } })), M2.constants && (ee = ee.concat(Re({ key: "constants", value: M2.constants, style: M2, styleSpec: B2 }))), Vr(ee);
          }
          function Vr(M2) {
            return [].concat(M2).sort(function(B2, ee) {
              return B2.line - ee.line;
            });
          }
          function Jr(M2) {
            return function() {
              for (var B2 = [], ee = arguments.length; ee--; ) B2[ee] = arguments[ee];
              return Vr(M2.apply(this, B2));
            };
          }
          vr.source = Jr(qi), vr.light = Jr(At), vr.layer = Jr(Kl), vr.filter = Jr(jo), vr.paintProperty = Jr(al), vr.layoutProperty = Jr(Xl);
          var dn = vr, En = dn.light, Tn = dn.paintProperty, Pn = dn.layoutProperty;
          function Gn(M2, B2) {
            var ee = false;
            if (B2 && B2.length) for (var ie = 0, ge = B2; ie < ge.length; ie += 1) {
              var _e = ge[ie];
              M2.fire(new Pe(new Error(_e.message))), ee = true;
            }
            return ee;
          }
          var Dn = $n;
          function $n(M2, B2, ee) {
            var ie = this.cells = [];
            if (M2 instanceof ArrayBuffer) {
              this.arrayBuffer = M2;
              var ge = new Int32Array(this.arrayBuffer);
              M2 = ge[0], B2 = ge[1], ee = ge[2], this.d = B2 + 2 * ee;
              for (var _e = 0; _e < this.d * this.d; _e++) {
                var Oe = ge[3 + _e], Xe = ge[3 + _e + 1];
                ie.push(Oe === Xe ? null : ge.subarray(Oe, Xe));
              }
              var ht = ge[3 + ie.length], Tt = ge[3 + ie.length + 1];
              this.keys = ge.subarray(ht, Tt), this.bboxes = ge.subarray(Tt), this.insert = this._insertReadonly;
            } else {
              this.d = B2 + 2 * ee;
              for (var Dt = 0; Dt < this.d * this.d; Dt++) ie.push([]);
              this.keys = [], this.bboxes = [];
            }
            this.n = B2, this.extent = M2, this.padding = ee, this.scale = B2 / M2, this.uid = 0;
            var Xt = ee / B2 * M2;
            this.min = -Xt, this.max = M2 + Xt;
          }
          $n.prototype.insert = function(M2, B2, ee, ie, ge) {
            this._forEachCell(B2, ee, ie, ge, this._insertCell, this.uid++), this.keys.push(M2), this.bboxes.push(B2), this.bboxes.push(ee), this.bboxes.push(ie), this.bboxes.push(ge);
          }, $n.prototype._insertReadonly = function() {
            throw "Cannot insert into a GridIndex created from an ArrayBuffer.";
          }, $n.prototype._insertCell = function(M2, B2, ee, ie, ge, _e) {
            this.cells[ge].push(_e);
          }, $n.prototype.query = function(M2, B2, ee, ie, ge) {
            var _e = this.min, Oe = this.max;
            if (M2 <= _e && B2 <= _e && Oe <= ee && Oe <= ie && !ge) return Array.prototype.slice.call(this.keys);
            var Xe = [];
            return this._forEachCell(M2, B2, ee, ie, this._queryCell, Xe, {}, ge), Xe;
          }, $n.prototype._queryCell = function(M2, B2, ee, ie, ge, _e, Oe, Xe) {
            var ht = this.cells[ge];
            if (ht !== null) for (var Tt = this.keys, Dt = this.bboxes, Xt = 0; Xt < ht.length; Xt++) {
              var ar = ht[Xt];
              if (Oe[ar] === void 0) {
                var er = 4 * ar;
                (Xe ? Xe(Dt[er + 0], Dt[er + 1], Dt[er + 2], Dt[er + 3]) : M2 <= Dt[er + 2] && B2 <= Dt[er + 3] && ee >= Dt[er + 0] && ie >= Dt[er + 1]) ? (Oe[ar] = true, _e.push(Tt[ar])) : Oe[ar] = false;
              }
            }
          }, $n.prototype._forEachCell = function(M2, B2, ee, ie, ge, _e, Oe, Xe) {
            for (var ht = this._convertToCellCoord(M2), Tt = this._convertToCellCoord(B2), Dt = this._convertToCellCoord(ee), Xt = this._convertToCellCoord(ie), ar = ht; ar <= Dt; ar++) for (var er = Tt; er <= Xt; er++) {
              var hr = this.d * er + ar;
              if ((!Xe || Xe(this._convertFromCellCoord(ar), this._convertFromCellCoord(er), this._convertFromCellCoord(ar + 1), this._convertFromCellCoord(er + 1))) && ge.call(this, M2, B2, ee, ie, hr, _e, Oe, Xe)) return;
            }
          }, $n.prototype._convertFromCellCoord = function(M2) {
            return (M2 - this.padding) / this.scale;
          }, $n.prototype._convertToCellCoord = function(M2) {
            return Math.max(0, Math.min(this.d - 1, Math.floor(M2 * this.scale) + this.padding));
          }, $n.prototype.toArrayBuffer = function() {
            if (this.arrayBuffer) return this.arrayBuffer;
            for (var M2 = this.cells, B2 = 3 + this.cells.length + 1 + 1, ee = 0, ie = 0; ie < this.cells.length; ie++) ee += this.cells[ie].length;
            var ge = new Int32Array(B2 + ee + this.keys.length + this.bboxes.length);
            ge[0] = this.extent, ge[1] = this.n, ge[2] = this.padding;
            for (var _e = B2, Oe = 0; Oe < M2.length; Oe++) {
              var Xe = M2[Oe];
              ge[3 + Oe] = _e, ge.set(Xe, _e), _e += Xe.length;
            }
            return ge[3 + M2.length] = _e, ge.set(this.keys, _e), _e += this.keys.length, ge[3 + M2.length + 1] = _e, ge.set(this.bboxes, _e), _e += this.bboxes.length, ge.buffer;
          };
          var ca = self.ImageData, ya = self.ImageBitmap, Ra = {};
          function mn(M2, B2, ee) {
            ee === void 0 && (ee = {}), Object.defineProperty(B2, "_classRegistryKey", { value: M2, writeable: false }), Ra[M2] = { klass: B2, omit: ee.omit || [], shallow: ee.shallow || [] };
          }
          for (var Fa in mn("Object", Object), Dn.serialize = function(M2, B2) {
            var ee = M2.toArrayBuffer();
            return B2 && B2.push(ee), { buffer: ee };
          }, Dn.deserialize = function(M2) {
            return new Dn(M2.buffer);
          }, mn("Grid", Dn), mn("Color", pr), mn("Error", Error), mn("ResolvedImage", Ar), mn("StylePropertyFunction", Mr), mn("StyleExpression", ir, { omit: ["_evaluator"] }), mn("ZoomDependentExpression", wr), mn("ZoomConstantExpression", fr), mn("CompoundExpression", gn, { omit: ["_evaluate"] }), Rc) Rc[Fa]._classRegistryKey || mn("Expression_" + Fa, Rc[Fa]);
          function ra(M2) {
            return M2 && typeof ArrayBuffer < "u" && (M2 instanceof ArrayBuffer || M2.constructor && M2.constructor.name === "ArrayBuffer");
          }
          function va(M2) {
            return ya && M2 instanceof ya;
          }
          function Ia(M2, B2) {
            if (M2 == null || typeof M2 == "boolean" || typeof M2 == "number" || typeof M2 == "string" || M2 instanceof Boolean || M2 instanceof Number || M2 instanceof String || M2 instanceof Date || M2 instanceof RegExp) return M2;
            if (ra(M2) || va(M2)) return B2 && B2.push(M2), M2;
            if (ArrayBuffer.isView(M2)) {
              var ee = M2;
              return B2 && B2.push(ee.buffer), ee;
            }
            if (M2 instanceof ca) return B2 && B2.push(M2.data.buffer), M2;
            if (Array.isArray(M2)) {
              for (var ie = [], ge = 0, _e = M2; ge < _e.length; ge += 1) {
                var Oe = _e[ge];
                ie.push(Ia(Oe, B2));
              }
              return ie;
            }
            if (typeof M2 == "object") {
              var Xe = M2.constructor, ht = Xe._classRegistryKey;
              if (!ht) throw new Error("can't serialize object of unregistered class");
              var Tt = Xe.serialize ? Xe.serialize(M2, B2) : {};
              if (!Xe.serialize) {
                for (var Dt in M2) if (M2.hasOwnProperty(Dt) && !(Ra[ht].omit.indexOf(Dt) >= 0)) {
                  var Xt = M2[Dt];
                  Tt[Dt] = Ra[ht].shallow.indexOf(Dt) >= 0 ? Xt : Ia(Xt, B2);
                }
                M2 instanceof Error && (Tt.message = M2.message);
              }
              if (Tt.$name) throw new Error("$name property is reserved for worker serialization logic.");
              return ht !== "Object" && (Tt.$name = ht), Tt;
            }
            throw new Error("can't serialize object of type " + typeof M2);
          }
          function Si(M2) {
            if (M2 == null || typeof M2 == "boolean" || typeof M2 == "number" || typeof M2 == "string" || M2 instanceof Boolean || M2 instanceof Number || M2 instanceof String || M2 instanceof Date || M2 instanceof RegExp || ra(M2) || va(M2) || ArrayBuffer.isView(M2) || M2 instanceof ca) return M2;
            if (Array.isArray(M2)) return M2.map(Si);
            if (typeof M2 == "object") {
              var B2 = M2.$name || "Object", ee = Ra[B2].klass;
              if (!ee) throw new Error("can't deserialize unregistered class " + B2);
              if (ee.deserialize) return ee.deserialize(M2);
              for (var ie = Object.create(ee.prototype), ge = 0, _e = Object.keys(M2); ge < _e.length; ge += 1) {
                var Oe = _e[ge];
                if (Oe !== "$name") {
                  var Xe = M2[Oe];
                  ie[Oe] = Ra[B2].shallow.indexOf(Oe) >= 0 ? Xe : Si(Xe);
                }
              }
              return ie;
            }
            throw new Error("can't deserialize object of type " + typeof M2);
          }
          var Vi = function() {
            this.first = true;
          };
          Vi.prototype.update = function(M2, B2) {
            var ee = Math.floor(M2);
            return this.first ? (this.first = false, this.lastIntegerZoom = ee, this.lastIntegerZoomTime = 0, this.lastZoom = M2, this.lastFloorZoom = ee, true) : (this.lastFloorZoom > ee ? (this.lastIntegerZoom = ee + 1, this.lastIntegerZoomTime = B2) : this.lastFloorZoom < ee && (this.lastIntegerZoom = ee, this.lastIntegerZoomTime = B2), M2 !== this.lastZoom && (this.lastZoom = M2, this.lastFloorZoom = ee, true));
          };
          var Jn = { "Latin-1 Supplement": function(M2) {
            return M2 >= 128 && M2 <= 255;
          }, Arabic: function(M2) {
            return M2 >= 1536 && M2 <= 1791;
          }, "Arabic Supplement": function(M2) {
            return M2 >= 1872 && M2 <= 1919;
          }, "Arabic Extended-A": function(M2) {
            return M2 >= 2208 && M2 <= 2303;
          }, "Hangul Jamo": function(M2) {
            return M2 >= 4352 && M2 <= 4607;
          }, "Unified Canadian Aboriginal Syllabics": function(M2) {
            return M2 >= 5120 && M2 <= 5759;
          }, Khmer: function(M2) {
            return M2 >= 6016 && M2 <= 6143;
          }, "Unified Canadian Aboriginal Syllabics Extended": function(M2) {
            return M2 >= 6320 && M2 <= 6399;
          }, "General Punctuation": function(M2) {
            return M2 >= 8192 && M2 <= 8303;
          }, "Letterlike Symbols": function(M2) {
            return M2 >= 8448 && M2 <= 8527;
          }, "Number Forms": function(M2) {
            return M2 >= 8528 && M2 <= 8591;
          }, "Miscellaneous Technical": function(M2) {
            return M2 >= 8960 && M2 <= 9215;
          }, "Control Pictures": function(M2) {
            return M2 >= 9216 && M2 <= 9279;
          }, "Optical Character Recognition": function(M2) {
            return M2 >= 9280 && M2 <= 9311;
          }, "Enclosed Alphanumerics": function(M2) {
            return M2 >= 9312 && M2 <= 9471;
          }, "Geometric Shapes": function(M2) {
            return M2 >= 9632 && M2 <= 9727;
          }, "Miscellaneous Symbols": function(M2) {
            return M2 >= 9728 && M2 <= 9983;
          }, "Miscellaneous Symbols and Arrows": function(M2) {
            return M2 >= 11008 && M2 <= 11263;
          }, "CJK Radicals Supplement": function(M2) {
            return M2 >= 11904 && M2 <= 12031;
          }, "Kangxi Radicals": function(M2) {
            return M2 >= 12032 && M2 <= 12255;
          }, "Ideographic Description Characters": function(M2) {
            return M2 >= 12272 && M2 <= 12287;
          }, "CJK Symbols and Punctuation": function(M2) {
            return M2 >= 12288 && M2 <= 12351;
          }, Hiragana: function(M2) {
            return M2 >= 12352 && M2 <= 12447;
          }, Katakana: function(M2) {
            return M2 >= 12448 && M2 <= 12543;
          }, Bopomofo: function(M2) {
            return M2 >= 12544 && M2 <= 12591;
          }, "Hangul Compatibility Jamo": function(M2) {
            return M2 >= 12592 && M2 <= 12687;
          }, Kanbun: function(M2) {
            return M2 >= 12688 && M2 <= 12703;
          }, "Bopomofo Extended": function(M2) {
            return M2 >= 12704 && M2 <= 12735;
          }, "CJK Strokes": function(M2) {
            return M2 >= 12736 && M2 <= 12783;
          }, "Katakana Phonetic Extensions": function(M2) {
            return M2 >= 12784 && M2 <= 12799;
          }, "Enclosed CJK Letters and Months": function(M2) {
            return M2 >= 12800 && M2 <= 13055;
          }, "CJK Compatibility": function(M2) {
            return M2 >= 13056 && M2 <= 13311;
          }, "CJK Unified Ideographs Extension A": function(M2) {
            return M2 >= 13312 && M2 <= 19903;
          }, "Yijing Hexagram Symbols": function(M2) {
            return M2 >= 19904 && M2 <= 19967;
          }, "CJK Unified Ideographs": function(M2) {
            return M2 >= 19968 && M2 <= 40959;
          }, "Yi Syllables": function(M2) {
            return M2 >= 40960 && M2 <= 42127;
          }, "Yi Radicals": function(M2) {
            return M2 >= 42128 && M2 <= 42191;
          }, "Hangul Jamo Extended-A": function(M2) {
            return M2 >= 43360 && M2 <= 43391;
          }, "Hangul Syllables": function(M2) {
            return M2 >= 44032 && M2 <= 55215;
          }, "Hangul Jamo Extended-B": function(M2) {
            return M2 >= 55216 && M2 <= 55295;
          }, "Private Use Area": function(M2) {
            return M2 >= 57344 && M2 <= 63743;
          }, "CJK Compatibility Ideographs": function(M2) {
            return M2 >= 63744 && M2 <= 64255;
          }, "Arabic Presentation Forms-A": function(M2) {
            return M2 >= 64336 && M2 <= 65023;
          }, "Vertical Forms": function(M2) {
            return M2 >= 65040 && M2 <= 65055;
          }, "CJK Compatibility Forms": function(M2) {
            return M2 >= 65072 && M2 <= 65103;
          }, "Small Form Variants": function(M2) {
            return M2 >= 65104 && M2 <= 65135;
          }, "Arabic Presentation Forms-B": function(M2) {
            return M2 >= 65136 && M2 <= 65279;
          }, "Halfwidth and Fullwidth Forms": function(M2) {
            return M2 >= 65280 && M2 <= 65519;
          } };
          function Xi(M2) {
            for (var B2 = 0, ee = M2; B2 < ee.length; B2 += 1) if (li(ee[B2].charCodeAt(0))) return true;
            return false;
          }
          function Bi(M2) {
            return !Jn.Arabic(M2) && !Jn["Arabic Supplement"](M2) && !Jn["Arabic Extended-A"](M2) && !Jn["Arabic Presentation Forms-A"](M2) && !Jn["Arabic Presentation Forms-B"](M2);
          }
          function li(M2) {
            return M2 === 746 || M2 === 747 || !(M2 < 4352) && (!!Jn["Bopomofo Extended"](M2) || !!Jn.Bopomofo(M2) || !(!Jn["CJK Compatibility Forms"](M2) || M2 >= 65097 && M2 <= 65103) || !!Jn["CJK Compatibility Ideographs"](M2) || !!Jn["CJK Compatibility"](M2) || !!Jn["CJK Radicals Supplement"](M2) || !!Jn["CJK Strokes"](M2) || !(!Jn["CJK Symbols and Punctuation"](M2) || M2 >= 12296 && M2 <= 12305 || M2 >= 12308 && M2 <= 12319 || M2 === 12336) || !!Jn["CJK Unified Ideographs Extension A"](M2) || !!Jn["CJK Unified Ideographs"](M2) || !!Jn["Enclosed CJK Letters and Months"](M2) || !!Jn["Hangul Compatibility Jamo"](M2) || !!Jn["Hangul Jamo Extended-A"](M2) || !!Jn["Hangul Jamo Extended-B"](M2) || !!Jn["Hangul Jamo"](M2) || !!Jn["Hangul Syllables"](M2) || !!Jn.Hiragana(M2) || !!Jn["Ideographic Description Characters"](M2) || !!Jn.Kanbun(M2) || !!Jn["Kangxi Radicals"](M2) || !!Jn["Katakana Phonetic Extensions"](M2) || !(!Jn.Katakana(M2) || M2 === 12540) || !(!Jn["Halfwidth and Fullwidth Forms"](M2) || M2 === 65288 || M2 === 65289 || M2 === 65293 || M2 >= 65306 && M2 <= 65310 || M2 === 65339 || M2 === 65341 || M2 === 65343 || M2 >= 65371 && M2 <= 65503 || M2 === 65507 || M2 >= 65512 && M2 <= 65519) || !(!Jn["Small Form Variants"](M2) || M2 >= 65112 && M2 <= 65118 || M2 >= 65123 && M2 <= 65126) || !!Jn["Unified Canadian Aboriginal Syllabics"](M2) || !!Jn["Unified Canadian Aboriginal Syllabics Extended"](M2) || !!Jn["Vertical Forms"](M2) || !!Jn["Yijing Hexagram Symbols"](M2) || !!Jn["Yi Syllables"](M2) || !!Jn["Yi Radicals"](M2));
          }
          function Ki(M2) {
            return !(li(M2) || function(B2) {
              return !(!Jn["Latin-1 Supplement"](B2) || B2 !== 167 && B2 !== 169 && B2 !== 174 && B2 !== 177 && B2 !== 188 && B2 !== 189 && B2 !== 190 && B2 !== 215 && B2 !== 247) || !(!Jn["General Punctuation"](B2) || B2 !== 8214 && B2 !== 8224 && B2 !== 8225 && B2 !== 8240 && B2 !== 8241 && B2 !== 8251 && B2 !== 8252 && B2 !== 8258 && B2 !== 8263 && B2 !== 8264 && B2 !== 8265 && B2 !== 8273) || !!Jn["Letterlike Symbols"](B2) || !!Jn["Number Forms"](B2) || !(!Jn["Miscellaneous Technical"](B2) || !(B2 >= 8960 && B2 <= 8967 || B2 >= 8972 && B2 <= 8991 || B2 >= 8996 && B2 <= 9e3 || B2 === 9003 || B2 >= 9085 && B2 <= 9114 || B2 >= 9150 && B2 <= 9165 || B2 === 9167 || B2 >= 9169 && B2 <= 9179 || B2 >= 9186 && B2 <= 9215)) || !(!Jn["Control Pictures"](B2) || B2 === 9251) || !!Jn["Optical Character Recognition"](B2) || !!Jn["Enclosed Alphanumerics"](B2) || !!Jn["Geometric Shapes"](B2) || !(!Jn["Miscellaneous Symbols"](B2) || B2 >= 9754 && B2 <= 9759) || !(!Jn["Miscellaneous Symbols and Arrows"](B2) || !(B2 >= 11026 && B2 <= 11055 || B2 >= 11088 && B2 <= 11097 || B2 >= 11192 && B2 <= 11243)) || !!Jn["CJK Symbols and Punctuation"](B2) || !!Jn.Katakana(B2) || !!Jn["Private Use Area"](B2) || !!Jn["CJK Compatibility Forms"](B2) || !!Jn["Small Form Variants"](B2) || !!Jn["Halfwidth and Fullwidth Forms"](B2) || B2 === 8734 || B2 === 8756 || B2 === 8757 || B2 >= 9984 && B2 <= 10087 || B2 >= 10102 && B2 <= 10131 || B2 === 65532 || B2 === 65533;
            }(M2));
          }
          function Fi(M2) {
            return M2 >= 1424 && M2 <= 2303 || Jn["Arabic Presentation Forms-A"](M2) || Jn["Arabic Presentation Forms-B"](M2);
          }
          function Do(M2, B2) {
            return !(!B2 && Fi(M2)) && !(M2 >= 2304 && M2 <= 3583 || M2 >= 3840 && M2 <= 4255 || Jn.Khmer(M2));
          }
          function Oa(M2) {
            for (var B2 = 0, ee = M2; B2 < ee.length; B2 += 1) if (Fi(ee[B2].charCodeAt(0))) return true;
            return false;
          }
          var mo = "deferred", il = "loading", Jc = "loaded", bc = "error", _u = null, gi = "unavailable", ls = null, wu = function(M2) {
            M2 && typeof M2 == "string" && M2.indexOf("NetworkError") > -1 && (gi = bc), _u && _u(M2);
          };
          function go() {
            Ds.fire(new Ie("pluginStateChange", { pluginStatus: gi, pluginURL: ls }));
          }
          var Ds = new $e(), Sl = function() {
            return gi;
          }, Fo = function() {
            if (gi !== mo || !ls) throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");
            gi = il, go(), ls && Ot({ url: ls }, function(M2) {
              M2 ? wu(M2) : (gi = Jc, go());
            });
          }, fu = { applyArabicShaping: null, processBidirectionalText: null, processStyledBidirectionalText: null, isLoaded: function() {
            return gi === Jc || fu.applyArabicShaping != null;
          }, isLoading: function() {
            return gi === il;
          }, setState: function(M2) {
            gi = M2.pluginStatus, ls = M2.pluginURL;
          }, isParsed: function() {
            return fu.applyArabicShaping != null && fu.processBidirectionalText != null && fu.processStyledBidirectionalText != null;
          }, getPluginURL: function() {
            return ls;
          } }, Oo = function(M2, B2) {
            this.zoom = M2, B2 ? (this.now = B2.now, this.fadeDuration = B2.fadeDuration, this.zoomHistory = B2.zoomHistory, this.transition = B2.transition) : (this.now = 0, this.fadeDuration = 0, this.zoomHistory = new Vi(), this.transition = {});
          };
          Oo.prototype.isSupportedScript = function(M2) {
            return function(B2, ee) {
              for (var ie = 0, ge = B2; ie < ge.length; ie += 1) if (!Do(ge[ie].charCodeAt(0), ee)) return false;
              return true;
            }(M2, fu.isLoaded());
          }, Oo.prototype.crossFadingFactor = function() {
            return this.fadeDuration === 0 ? 1 : Math.min((this.now - this.zoomHistory.lastIntegerZoomTime) / this.fadeDuration, 1);
          }, Oo.prototype.getCrossfadeParameters = function() {
            var M2 = this.zoom, B2 = M2 - Math.floor(M2), ee = this.crossFadingFactor();
            return M2 > this.zoomHistory.lastIntegerZoom ? { fromScale: 2, toScale: 1, t: B2 + (1 - B2) * ee } : { fromScale: 0.5, toScale: 1, t: 1 - (1 - ee) * B2 };
          };
          var Jl = function(M2, B2) {
            this.property = M2, this.value = B2, this.expression = function(ee, ie) {
              if (Qe(ee)) return new Mr(ee, ie);
              if (or(ee)) {
                var ge = Er(ee, ie);
                if (ge.result === "error") throw new Error(ge.value.map(function(Oe) {
                  return Oe.key + ": " + Oe.message;
                }).join(", "));
                return ge.value;
              }
              var _e = ee;
              return typeof ee == "string" && ie.type === "color" && (_e = pr.parse(ee)), { kind: "constant", evaluate: function() {
                return _e;
              } };
            }(B2 === void 0 ? M2.specification.default : B2, M2.specification);
          };
          Jl.prototype.isDataDriven = function() {
            return this.expression.kind === "source" || this.expression.kind === "composite";
          }, Jl.prototype.possiblyEvaluate = function(M2, B2, ee) {
            return this.property.possiblyEvaluate(this, M2, B2, ee);
          };
          var qf = function(M2) {
            this.property = M2, this.value = new Jl(M2, void 0);
          };
          qf.prototype.transitioned = function(M2, B2) {
            return new Ed(this.property, this.value, B2, g({}, M2.transition, this.transition), M2.now);
          }, qf.prototype.untransitioned = function() {
            return new Ed(this.property, this.value, null, {}, 0);
          };
          var Af = function(M2) {
            this._properties = M2, this._values = Object.create(M2.defaultTransitionablePropertyValues);
          };
          Af.prototype.getValue = function(M2) {
            return S2(this._values[M2].value.value);
          }, Af.prototype.setValue = function(M2, B2) {
            this._values.hasOwnProperty(M2) || (this._values[M2] = new qf(this._values[M2].property)), this._values[M2].value = new Jl(this._values[M2].property, B2 === null ? void 0 : S2(B2));
          }, Af.prototype.getTransition = function(M2) {
            return S2(this._values[M2].transition);
          }, Af.prototype.setTransition = function(M2, B2) {
            this._values.hasOwnProperty(M2) || (this._values[M2] = new qf(this._values[M2].property)), this._values[M2].transition = S2(B2) || void 0;
          }, Af.prototype.serialize = function() {
            for (var M2 = {}, B2 = 0, ee = Object.keys(this._values); B2 < ee.length; B2 += 1) {
              var ie = ee[B2], ge = this.getValue(ie);
              ge !== void 0 && (M2[ie] = ge);
              var _e = this.getTransition(ie);
              _e !== void 0 && (M2[ie + "-transition"] = _e);
            }
            return M2;
          }, Af.prototype.transitioned = function(M2, B2) {
            for (var ee = new Ks(this._properties), ie = 0, ge = Object.keys(this._values); ie < ge.length; ie += 1) {
              var _e = ge[ie];
              ee._values[_e] = this._values[_e].transitioned(M2, B2._values[_e]);
            }
            return ee;
          }, Af.prototype.untransitioned = function() {
            for (var M2 = new Ks(this._properties), B2 = 0, ee = Object.keys(this._values); B2 < ee.length; B2 += 1) {
              var ie = ee[B2];
              M2._values[ie] = this._values[ie].untransitioned();
            }
            return M2;
          };
          var Ed = function(M2, B2, ee, ie, ge) {
            this.property = M2, this.value = B2, this.begin = ge + ie.delay || 0, this.end = this.begin + ie.duration || 0, M2.specification.transition && (ie.delay || ie.duration) && (this.prior = ee);
          };
          Ed.prototype.possiblyEvaluate = function(M2, B2, ee) {
            var ie = M2.now || 0, ge = this.value.possiblyEvaluate(M2, B2, ee), _e = this.prior;
            if (_e) {
              if (ie > this.end) return this.prior = null, ge;
              if (this.value.isDataDriven()) return this.prior = null, ge;
              if (ie < this.begin) return _e.possiblyEvaluate(M2, B2, ee);
              var Oe = (ie - this.begin) / (this.end - this.begin);
              return this.property.interpolate(_e.possiblyEvaluate(M2, B2, ee), ge, function(Xe) {
                if (Xe <= 0) return 0;
                if (Xe >= 1) return 1;
                var ht = Xe * Xe, Tt = ht * Xe;
                return 4 * (Xe < 0.5 ? Tt : 3 * (Xe - ht) + Tt - 0.75);
              }(Oe));
            }
            return ge;
          };
          var Ks = function(M2) {
            this._properties = M2, this._values = Object.create(M2.defaultTransitioningPropertyValues);
          };
          Ks.prototype.possiblyEvaluate = function(M2, B2, ee) {
            for (var ie = new Sf(this._properties), ge = 0, _e = Object.keys(this._values); ge < _e.length; ge += 1) {
              var Oe = _e[ge];
              ie._values[Oe] = this._values[Oe].possiblyEvaluate(M2, B2, ee);
            }
            return ie;
          }, Ks.prototype.hasTransition = function() {
            for (var M2 = 0, B2 = Object.keys(this._values); M2 < B2.length; M2 += 1) {
              var ee = B2[M2];
              if (this._values[ee].prior) return true;
            }
            return false;
          };
          var Dd = function(M2) {
            this._properties = M2, this._values = Object.create(M2.defaultPropertyValues);
          };
          Dd.prototype.getValue = function(M2) {
            return S2(this._values[M2].value);
          }, Dd.prototype.setValue = function(M2, B2) {
            this._values[M2] = new Jl(this._values[M2].property, B2 === null ? void 0 : S2(B2));
          }, Dd.prototype.serialize = function() {
            for (var M2 = {}, B2 = 0, ee = Object.keys(this._values); B2 < ee.length; B2 += 1) {
              var ie = ee[B2], ge = this.getValue(ie);
              ge !== void 0 && (M2[ie] = ge);
            }
            return M2;
          }, Dd.prototype.possiblyEvaluate = function(M2, B2, ee) {
            for (var ie = new Sf(this._properties), ge = 0, _e = Object.keys(this._values); ge < _e.length; ge += 1) {
              var Oe = _e[ge];
              ie._values[Oe] = this._values[Oe].possiblyEvaluate(M2, B2, ee);
            }
            return ie;
          };
          var Ys = function(M2, B2, ee) {
            this.property = M2, this.value = B2, this.parameters = ee;
          };
          Ys.prototype.isConstant = function() {
            return this.value.kind === "constant";
          }, Ys.prototype.constantOr = function(M2) {
            return this.value.kind === "constant" ? this.value.value : M2;
          }, Ys.prototype.evaluate = function(M2, B2, ee, ie) {
            return this.property.evaluate(this.value, this.parameters, M2, B2, ee, ie);
          };
          var Sf = function(M2) {
            this._properties = M2, this._values = Object.create(M2.defaultPossiblyEvaluatedValues);
          };
          Sf.prototype.get = function(M2) {
            return this._values[M2];
          };
          var Ya = function(M2) {
            this.specification = M2;
          };
          Ya.prototype.possiblyEvaluate = function(M2, B2) {
            return M2.expression.evaluate(B2);
          }, Ya.prototype.interpolate = function(M2, B2, ee) {
            var ie = zn[this.specification.type];
            return ie ? ie(M2, B2, ee) : M2;
          };
          var yi = function(M2, B2) {
            this.specification = M2, this.overrides = B2;
          };
          yi.prototype.possiblyEvaluate = function(M2, B2, ee, ie) {
            return M2.expression.kind === "constant" || M2.expression.kind === "camera" ? new Ys(this, { kind: "constant", value: M2.expression.evaluate(B2, null, {}, ee, ie) }, B2) : new Ys(this, M2.expression, B2);
          }, yi.prototype.interpolate = function(M2, B2, ee) {
            if (M2.value.kind !== "constant" || B2.value.kind !== "constant") return M2;
            if (M2.value.value === void 0 || B2.value.value === void 0) return new Ys(this, { kind: "constant", value: void 0 }, M2.parameters);
            var ie = zn[this.specification.type];
            return ie ? new Ys(this, { kind: "constant", value: ie(M2.value.value, B2.value.value, ee) }, M2.parameters) : M2;
          }, yi.prototype.evaluate = function(M2, B2, ee, ie, ge, _e) {
            return M2.kind === "constant" ? M2.value : M2.evaluate(B2, ee, ie, ge, _e);
          };
          var Cd = function(M2) {
            function B2() {
              M2.apply(this, arguments);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype.possiblyEvaluate = function(ee, ie, ge, _e) {
              if (ee.value === void 0) return new Ys(this, { kind: "constant", value: void 0 }, ie);
              if (ee.expression.kind === "constant") {
                var Oe = ee.expression.evaluate(ie, null, {}, ge, _e), Xe = ee.property.specification.type === "resolvedImage" && typeof Oe != "string" ? Oe.name : Oe, ht = this._calculate(Xe, Xe, Xe, ie);
                return new Ys(this, { kind: "constant", value: ht }, ie);
              }
              if (ee.expression.kind === "camera") {
                var Tt = this._calculate(ee.expression.evaluate({ zoom: ie.zoom - 1 }), ee.expression.evaluate({ zoom: ie.zoom }), ee.expression.evaluate({ zoom: ie.zoom + 1 }), ie);
                return new Ys(this, { kind: "constant", value: Tt }, ie);
              }
              return new Ys(this, ee.expression, ie);
            }, B2.prototype.evaluate = function(ee, ie, ge, _e, Oe, Xe) {
              if (ee.kind === "source") {
                var ht = ee.evaluate(ie, ge, _e, Oe, Xe);
                return this._calculate(ht, ht, ht, ie);
              }
              return ee.kind === "composite" ? this._calculate(ee.evaluate({ zoom: Math.floor(ie.zoom) - 1 }, ge, _e), ee.evaluate({ zoom: Math.floor(ie.zoom) }, ge, _e), ee.evaluate({ zoom: Math.floor(ie.zoom) + 1 }, ge, _e), ie) : ee.value;
            }, B2.prototype._calculate = function(ee, ie, ge, _e) {
              return _e.zoom > _e.zoomHistory.lastIntegerZoom ? { from: ee, to: ie } : { from: ge, to: ie };
            }, B2.prototype.interpolate = function(ee) {
              return ee;
            }, B2;
          }(yi), Md = function(M2) {
            this.specification = M2;
          };
          Md.prototype.possiblyEvaluate = function(M2, B2, ee, ie) {
            if (M2.value !== void 0) {
              if (M2.expression.kind === "constant") {
                var ge = M2.expression.evaluate(B2, null, {}, ee, ie);
                return this._calculate(ge, ge, ge, B2);
              }
              return this._calculate(M2.expression.evaluate(new Oo(Math.floor(B2.zoom - 1), B2)), M2.expression.evaluate(new Oo(Math.floor(B2.zoom), B2)), M2.expression.evaluate(new Oo(Math.floor(B2.zoom + 1), B2)), B2);
            }
          }, Md.prototype._calculate = function(M2, B2, ee, ie) {
            return ie.zoom > ie.zoomHistory.lastIntegerZoom ? { from: M2, to: B2 } : { from: ee, to: B2 };
          }, Md.prototype.interpolate = function(M2) {
            return M2;
          };
          var Ef = function(M2) {
            this.specification = M2;
          };
          Ef.prototype.possiblyEvaluate = function(M2, B2, ee, ie) {
            return !!M2.expression.evaluate(B2, null, {}, ee, ie);
          }, Ef.prototype.interpolate = function() {
            return false;
          };
          var ic = function(M2) {
            for (var B2 in this.properties = M2, this.defaultPropertyValues = {}, this.defaultTransitionablePropertyValues = {}, this.defaultTransitioningPropertyValues = {}, this.defaultPossiblyEvaluatedValues = {}, this.overridableProperties = [], M2) {
              var ee = M2[B2];
              ee.specification.overridable && this.overridableProperties.push(B2);
              var ie = this.defaultPropertyValues[B2] = new Jl(ee, void 0), ge = this.defaultTransitionablePropertyValues[B2] = new qf(ee);
              this.defaultTransitioningPropertyValues[B2] = ge.untransitioned(), this.defaultPossiblyEvaluatedValues[B2] = ie.possiblyEvaluate({});
            }
          };
          mn("DataDrivenProperty", yi), mn("DataConstantProperty", Ya), mn("CrossFadedDataDrivenProperty", Cd), mn("CrossFadedProperty", Md), mn("ColorRampProperty", Ef);
          var Vc = function(M2) {
            function B2(ee, ie) {
              if (M2.call(this), this.id = ee.id, this.type = ee.type, this._featureFilter = { filter: function() {
                return true;
              }, needGeometry: false }, ee.type !== "custom" && (ee = ee, this.metadata = ee.metadata, this.minzoom = ee.minzoom, this.maxzoom = ee.maxzoom, ee.type !== "background" && (this.source = ee.source, this.sourceLayer = ee["source-layer"], this.filter = ee.filter), ie.layout && (this._unevaluatedLayout = new Dd(ie.layout)), ie.paint)) {
                for (var ge in this._transitionablePaint = new Af(ie.paint), ee.paint) this.setPaintProperty(ge, ee.paint[ge], { validate: false });
                for (var _e in ee.layout) this.setLayoutProperty(_e, ee.layout[_e], { validate: false });
                this._transitioningPaint = this._transitionablePaint.untransitioned(), this.paint = new Sf(ie.paint);
              }
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype.getCrossfadeParameters = function() {
              return this._crossfadeParameters;
            }, B2.prototype.getLayoutProperty = function(ee) {
              return ee === "visibility" ? this.visibility : this._unevaluatedLayout.getValue(ee);
            }, B2.prototype.setLayoutProperty = function(ee, ie, ge) {
              if (ge === void 0 && (ge = {}), ie != null) {
                var _e = "layers." + this.id + ".layout." + ee;
                if (this._validate(Pn, _e, ee, ie, ge)) return;
              }
              ee !== "visibility" ? this._unevaluatedLayout.setValue(ee, ie) : this.visibility = ie;
            }, B2.prototype.getPaintProperty = function(ee) {
              return k(ee, "-transition") ? this._transitionablePaint.getTransition(ee.slice(0, -11)) : this._transitionablePaint.getValue(ee);
            }, B2.prototype.setPaintProperty = function(ee, ie, ge) {
              if (ge === void 0 && (ge = {}), ie != null) {
                var _e = "layers." + this.id + ".paint." + ee;
                if (this._validate(Tn, _e, ee, ie, ge)) return false;
              }
              if (k(ee, "-transition")) return this._transitionablePaint.setTransition(ee.slice(0, -11), ie || void 0), false;
              var Oe = this._transitionablePaint._values[ee], Xe = Oe.property.specification["property-type"] === "cross-faded-data-driven", ht = Oe.value.isDataDriven(), Tt = Oe.value;
              this._transitionablePaint.setValue(ee, ie), this._handleSpecialPaintPropertyUpdate(ee);
              var Dt = this._transitionablePaint._values[ee].value;
              return Dt.isDataDriven() || ht || Xe || this._handleOverridablePaintPropertyUpdate(ee, Tt, Dt);
            }, B2.prototype._handleSpecialPaintPropertyUpdate = function(ee) {
            }, B2.prototype._handleOverridablePaintPropertyUpdate = function(ee, ie, ge) {
              return false;
            }, B2.prototype.isHidden = function(ee) {
              return !!(this.minzoom && ee < this.minzoom) || !!(this.maxzoom && ee >= this.maxzoom) || this.visibility === "none";
            }, B2.prototype.updateTransitions = function(ee) {
              this._transitioningPaint = this._transitionablePaint.transitioned(ee, this._transitioningPaint);
            }, B2.prototype.hasTransition = function() {
              return this._transitioningPaint.hasTransition();
            }, B2.prototype.recalculate = function(ee, ie) {
              ee.getCrossfadeParameters && (this._crossfadeParameters = ee.getCrossfadeParameters()), this._unevaluatedLayout && (this.layout = this._unevaluatedLayout.possiblyEvaluate(ee, void 0, ie)), this.paint = this._transitioningPaint.possiblyEvaluate(ee, void 0, ie);
            }, B2.prototype.serialize = function() {
              var ee = { 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() };
              return this.visibility && (ee.layout = ee.layout || {}, ee.layout.visibility = this.visibility), A2(ee, function(ie, ge) {
                return !(ie === void 0 || ge === "layout" && !Object.keys(ie).length || ge === "paint" && !Object.keys(ie).length);
              });
            }, B2.prototype._validate = function(ee, ie, ge, _e, Oe) {
              return Oe === void 0 && (Oe = {}), (!Oe || Oe.validate !== false) && Gn(this, ee.call(dn, { key: ie, layerType: this.type, objectKey: ge, value: _e, styleSpec: Ve, style: { glyphs: true, sprite: true } }));
            }, B2.prototype.is3D = function() {
              return false;
            }, B2.prototype.isTileClipped = function() {
              return false;
            }, B2.prototype.hasOffscreenPass = function() {
              return false;
            }, B2.prototype.resize = function() {
            }, B2.prototype.isStateDependent = function() {
              for (var ee in this.paint._values) {
                var ie = this.paint.get(ee);
                if (ie instanceof Ys && Uc(ie.property.specification) && (ie.value.kind === "source" || ie.value.kind === "composite") && ie.value.isStateDependent) return true;
              }
              return false;
            }, B2;
          }($e), Z0 = { Int8: Int8Array, Uint8: Uint8Array, Int16: Int16Array, Uint16: Uint16Array, Int32: Int32Array, Uint32: Uint32Array, Float32: Float32Array }, Lp = function(M2, B2) {
            this._structArray = M2, this._pos1 = B2 * this.size, this._pos2 = this._pos1 / 2, this._pos4 = this._pos1 / 4, this._pos8 = this._pos1 / 8;
          }, yo = function() {
            this.isTransferred = false, this.capacity = -1, this.resize(0);
          };
          function Po(M2, B2) {
            B2 === void 0 && (B2 = 1);
            var ee = 0, ie = 0;
            return { members: M2.map(function(ge) {
              var _e, Oe = (_e = ge.type, Z0[_e].BYTES_PER_ELEMENT), Xe = ee = wh(ee, Math.max(B2, Oe)), ht = ge.components || 1;
              return ie = Math.max(ie, Oe), ee += Oe * ht, { name: ge.name, type: ge.type, components: ht, offset: Xe };
            }), size: wh(ee, Math.max(ie, B2)), alignment: B2 };
          }
          function wh(M2, B2) {
            return Math.ceil(M2 / B2) * B2;
          }
          yo.serialize = function(M2, B2) {
            return M2._trim(), B2 && (M2.isTransferred = true, B2.push(M2.arrayBuffer)), { length: M2.length, arrayBuffer: M2.arrayBuffer };
          }, yo.deserialize = function(M2) {
            var B2 = Object.create(this.prototype);
            return B2.arrayBuffer = M2.arrayBuffer, B2.length = M2.length, B2.capacity = M2.arrayBuffer.byteLength / B2.bytesPerElement, B2._refreshViews(), B2;
          }, yo.prototype._trim = function() {
            this.length !== this.capacity && (this.capacity = this.length, this.arrayBuffer = this.arrayBuffer.slice(0, this.length * this.bytesPerElement), this._refreshViews());
          }, yo.prototype.clear = function() {
            this.length = 0;
          }, yo.prototype.resize = function(M2) {
            this.reserve(M2), this.length = M2;
          }, yo.prototype.reserve = function(M2) {
            if (M2 > this.capacity) {
              this.capacity = Math.max(M2, Math.floor(5 * this.capacity), 128), this.arrayBuffer = new ArrayBuffer(this.capacity * this.bytesPerElement);
              var B2 = this.uint8;
              this._refreshViews(), B2 && this.uint8.set(B2);
            }
          }, yo.prototype._refreshViews = function() {
            throw new Error("_refreshViews() must be implemented by each concrete StructArray layout");
          };
          var Xf = function(M2) {
            function B2() {
              M2.apply(this, arguments);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype._refreshViews = function() {
              this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
            }, B2.prototype.emplaceBack = function(ee, ie) {
              var ge = this.length;
              return this.resize(ge + 1), this.emplace(ge, ee, ie);
            }, B2.prototype.emplace = function(ee, ie, ge) {
              var _e = 2 * ee;
              return this.int16[_e + 0] = ie, this.int16[_e + 1] = ge, ee;
            }, B2;
          }(yo);
          Xf.prototype.bytesPerElement = 4, mn("StructArrayLayout2i4", Xf);
          var Vs = function(M2) {
            function B2() {
              M2.apply(this, arguments);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype._refreshViews = function() {
              this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
            }, B2.prototype.emplaceBack = function(ee, ie, ge, _e) {
              var Oe = this.length;
              return this.resize(Oe + 1), this.emplace(Oe, ee, ie, ge, _e);
            }, B2.prototype.emplace = function(ee, ie, ge, _e, Oe) {
              var Xe = 4 * ee;
              return this.int16[Xe + 0] = ie, this.int16[Xe + 1] = ge, this.int16[Xe + 2] = _e, this.int16[Xe + 3] = Oe, ee;
            }, B2;
          }(yo);
          Vs.prototype.bytesPerElement = 8, mn("StructArrayLayout4i8", Vs);
          var kh = function(M2) {
            function B2() {
              M2.apply(this, arguments);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype._refreshViews = function() {
              this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
            }, B2.prototype.emplaceBack = function(ee, ie, ge, _e, Oe, Xe) {
              var ht = this.length;
              return this.resize(ht + 1), this.emplace(ht, ee, ie, ge, _e, Oe, Xe);
            }, B2.prototype.emplace = function(ee, ie, ge, _e, Oe, Xe, ht) {
              var Tt = 6 * ee;
              return this.int16[Tt + 0] = ie, this.int16[Tt + 1] = ge, this.int16[Tt + 2] = _e, this.int16[Tt + 3] = Oe, this.int16[Tt + 4] = Xe, this.int16[Tt + 5] = ht, ee;
            }, B2;
          }(yo);
          kh.prototype.bytesPerElement = 12, mn("StructArrayLayout2i4i12", kh);
          var Rp = function(M2) {
            function B2() {
              M2.apply(this, arguments);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype._refreshViews = function() {
              this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
            }, B2.prototype.emplaceBack = function(ee, ie, ge, _e, Oe, Xe) {
              var ht = this.length;
              return this.resize(ht + 1), this.emplace(ht, ee, ie, ge, _e, Oe, Xe);
            }, B2.prototype.emplace = function(ee, ie, ge, _e, Oe, Xe, ht) {
              var Tt = 4 * ee, Dt = 8 * ee;
              return this.int16[Tt + 0] = ie, this.int16[Tt + 1] = ge, this.uint8[Dt + 4] = _e, this.uint8[Dt + 5] = Oe, this.uint8[Dt + 6] = Xe, this.uint8[Dt + 7] = ht, ee;
            }, B2;
          }(yo);
          Rp.prototype.bytesPerElement = 8, mn("StructArrayLayout2i4ub8", Rp);
          var Zh = function(M2) {
            function B2() {
              M2.apply(this, arguments);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype._refreshViews = function() {
              this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);
            }, B2.prototype.emplaceBack = function(ee, ie, ge, _e, Oe, Xe, ht, Tt, Dt, Xt) {
              var ar = this.length;
              return this.resize(ar + 1), this.emplace(ar, ee, ie, ge, _e, Oe, Xe, ht, Tt, Dt, Xt);
            }, B2.prototype.emplace = function(ee, ie, ge, _e, Oe, Xe, ht, Tt, Dt, Xt, ar) {
              var er = 9 * ee, hr = 18 * ee;
              return this.uint16[er + 0] = ie, this.uint16[er + 1] = ge, this.uint16[er + 2] = _e, this.uint16[er + 3] = Oe, this.uint16[er + 4] = Xe, this.uint16[er + 5] = ht, this.uint16[er + 6] = Tt, this.uint16[er + 7] = Dt, this.uint8[hr + 16] = Xt, this.uint8[hr + 17] = ar, ee;
            }, B2;
          }(yo);
          Zh.prototype.bytesPerElement = 18, mn("StructArrayLayout8ui2ub18", Zh);
          var zp = function(M2) {
            function B2() {
              M2.apply(this, arguments);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype._refreshViews = function() {
              this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);
            }, B2.prototype.emplaceBack = function(ee, ie, ge, _e, Oe, Xe, ht, Tt, Dt, Xt, ar, er) {
              var hr = this.length;
              return this.resize(hr + 1), this.emplace(hr, ee, ie, ge, _e, Oe, Xe, ht, Tt, Dt, Xt, ar, er);
            }, B2.prototype.emplace = function(ee, ie, ge, _e, Oe, Xe, ht, Tt, Dt, Xt, ar, er, hr) {
              var Sr = 12 * ee;
              return this.int16[Sr + 0] = ie, this.int16[Sr + 1] = ge, this.int16[Sr + 2] = _e, this.int16[Sr + 3] = Oe, this.uint16[Sr + 4] = Xe, this.uint16[Sr + 5] = ht, this.uint16[Sr + 6] = Tt, this.uint16[Sr + 7] = Dt, this.int16[Sr + 8] = Xt, this.int16[Sr + 9] = ar, this.int16[Sr + 10] = er, this.int16[Sr + 11] = hr, ee;
            }, B2;
          }(yo);
          zp.prototype.bytesPerElement = 24, mn("StructArrayLayout4i4ui4i24", zp);
          var Kf = function(M2) {
            function B2() {
              M2.apply(this, arguments);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype._refreshViews = function() {
              this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer);
            }, B2.prototype.emplaceBack = function(ee, ie, ge) {
              var _e = this.length;
              return this.resize(_e + 1), this.emplace(_e, ee, ie, ge);
            }, B2.prototype.emplace = function(ee, ie, ge, _e) {
              var Oe = 3 * ee;
              return this.float32[Oe + 0] = ie, this.float32[Oe + 1] = ge, this.float32[Oe + 2] = _e, ee;
            }, B2;
          }(yo);
          Kf.prototype.bytesPerElement = 12, mn("StructArrayLayout3f12", Kf);
          var J0 = function(M2) {
            function B2() {
              M2.apply(this, arguments);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype._refreshViews = function() {
              this.uint8 = new Uint8Array(this.arrayBuffer), this.uint32 = new Uint32Array(this.arrayBuffer);
            }, B2.prototype.emplaceBack = function(ee) {
              var ie = this.length;
              return this.resize(ie + 1), this.emplace(ie, ee);
            }, B2.prototype.emplace = function(ee, ie) {
              var ge = 1 * ee;
              return this.uint32[ge + 0] = ie, ee;
            }, B2;
          }(yo);
          J0.prototype.bytesPerElement = 4, mn("StructArrayLayout1ul4", J0);
          var cm = function(M2) {
            function B2() {
              M2.apply(this, arguments);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype._refreshViews = function() {
              this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer), this.uint32 = new Uint32Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);
            }, B2.prototype.emplaceBack = function(ee, ie, ge, _e, Oe, Xe, ht, Tt, Dt) {
              var Xt = this.length;
              return this.resize(Xt + 1), this.emplace(Xt, ee, ie, ge, _e, Oe, Xe, ht, Tt, Dt);
            }, B2.prototype.emplace = function(ee, ie, ge, _e, Oe, Xe, ht, Tt, Dt, Xt) {
              var ar = 10 * ee, er = 5 * ee;
              return this.int16[ar + 0] = ie, this.int16[ar + 1] = ge, this.int16[ar + 2] = _e, this.int16[ar + 3] = Oe, this.int16[ar + 4] = Xe, this.int16[ar + 5] = ht, this.uint32[er + 3] = Tt, this.uint16[ar + 8] = Dt, this.uint16[ar + 9] = Xt, ee;
            }, B2;
          }(yo);
          cm.prototype.bytesPerElement = 20, mn("StructArrayLayout6i1ul2ui20", cm);
          var Th = function(M2) {
            function B2() {
              M2.apply(this, arguments);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype._refreshViews = function() {
              this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
            }, B2.prototype.emplaceBack = function(ee, ie, ge, _e, Oe, Xe) {
              var ht = this.length;
              return this.resize(ht + 1), this.emplace(ht, ee, ie, ge, _e, Oe, Xe);
            }, B2.prototype.emplace = function(ee, ie, ge, _e, Oe, Xe, ht) {
              var Tt = 6 * ee;
              return this.int16[Tt + 0] = ie, this.int16[Tt + 1] = ge, this.int16[Tt + 2] = _e, this.int16[Tt + 3] = Oe, this.int16[Tt + 4] = Xe, this.int16[Tt + 5] = ht, ee;
            }, B2;
          }(yo);
          Th.prototype.bytesPerElement = 12, mn("StructArrayLayout2i2i2i12", Th);
          var Q0 = function(M2) {
            function B2() {
              M2.apply(this, arguments);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype._refreshViews = function() {
              this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
            }, B2.prototype.emplaceBack = function(ee, ie, ge, _e, Oe) {
              var Xe = this.length;
              return this.resize(Xe + 1), this.emplace(Xe, ee, ie, ge, _e, Oe);
            }, B2.prototype.emplace = function(ee, ie, ge, _e, Oe, Xe) {
              var ht = 4 * ee, Tt = 8 * ee;
              return this.float32[ht + 0] = ie, this.float32[ht + 1] = ge, this.float32[ht + 2] = _e, this.int16[Tt + 6] = Oe, this.int16[Tt + 7] = Xe, ee;
            }, B2;
          }(yo);
          Q0.prototype.bytesPerElement = 16, mn("StructArrayLayout2f1f2i16", Q0);
          var Bp = function(M2) {
            function B2() {
              M2.apply(this, arguments);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype._refreshViews = function() {
              this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer);
            }, B2.prototype.emplaceBack = function(ee, ie, ge, _e) {
              var Oe = this.length;
              return this.resize(Oe + 1), this.emplace(Oe, ee, ie, ge, _e);
            }, B2.prototype.emplace = function(ee, ie, ge, _e, Oe) {
              var Xe = 12 * ee, ht = 3 * ee;
              return this.uint8[Xe + 0] = ie, this.uint8[Xe + 1] = ge, this.float32[ht + 1] = _e, this.float32[ht + 2] = Oe, ee;
            }, B2;
          }(yo);
          Bp.prototype.bytesPerElement = 12, mn("StructArrayLayout2ub2f12", Bp);
          var Ql = function(M2) {
            function B2() {
              M2.apply(this, arguments);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype._refreshViews = function() {
              this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);
            }, B2.prototype.emplaceBack = function(ee, ie, ge) {
              var _e = this.length;
              return this.resize(_e + 1), this.emplace(_e, ee, ie, ge);
            }, B2.prototype.emplace = function(ee, ie, ge, _e) {
              var Oe = 3 * ee;
              return this.uint16[Oe + 0] = ie, this.uint16[Oe + 1] = ge, this.uint16[Oe + 2] = _e, ee;
            }, B2;
          }(yo);
          Ql.prototype.bytesPerElement = 6, mn("StructArrayLayout3ui6", Ql);
          var fm = function(M2) {
            function B2() {
              M2.apply(this, arguments);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype._refreshViews = function() {
              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);
            }, B2.prototype.emplaceBack = function(ee, ie, ge, _e, Oe, Xe, ht, Tt, Dt, Xt, ar, er, hr, Sr, Ur, Br, rn) {
              var nn = this.length;
              return this.resize(nn + 1), this.emplace(nn, ee, ie, ge, _e, Oe, Xe, ht, Tt, Dt, Xt, ar, er, hr, Sr, Ur, Br, rn);
            }, B2.prototype.emplace = function(ee, ie, ge, _e, Oe, Xe, ht, Tt, Dt, Xt, ar, er, hr, Sr, Ur, Br, rn, nn) {
              var cn = 24 * ee, In = 12 * ee, Un = 48 * ee;
              return this.int16[cn + 0] = ie, this.int16[cn + 1] = ge, this.uint16[cn + 2] = _e, this.uint16[cn + 3] = Oe, this.uint32[In + 2] = Xe, this.uint32[In + 3] = ht, this.uint32[In + 4] = Tt, this.uint16[cn + 10] = Dt, this.uint16[cn + 11] = Xt, this.uint16[cn + 12] = ar, this.float32[In + 7] = er, this.float32[In + 8] = hr, this.uint8[Un + 36] = Sr, this.uint8[Un + 37] = Ur, this.uint8[Un + 38] = Br, this.uint32[In + 10] = rn, this.int16[cn + 22] = nn, ee;
            }, B2;
          }(yo);
          fm.prototype.bytesPerElement = 48, mn("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48", fm);
          var hm = function(M2) {
            function B2() {
              M2.apply(this, arguments);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype._refreshViews = function() {
              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);
            }, B2.prototype.emplaceBack = function(ee, ie, ge, _e, Oe, Xe, ht, Tt, Dt, Xt, ar, er, hr, Sr, Ur, Br, rn, nn, cn, In, Un, ha, fa, wa, Wa, $a, Ea, oi) {
              var ei = this.length;
              return this.resize(ei + 1), this.emplace(ei, ee, ie, ge, _e, Oe, Xe, ht, Tt, Dt, Xt, ar, er, hr, Sr, Ur, Br, rn, nn, cn, In, Un, ha, fa, wa, Wa, $a, Ea, oi);
            }, B2.prototype.emplace = function(ee, ie, ge, _e, Oe, Xe, ht, Tt, Dt, Xt, ar, er, hr, Sr, Ur, Br, rn, nn, cn, In, Un, ha, fa, wa, Wa, $a, Ea, oi, ei) {
              var Ha = 34 * ee, xo = 17 * ee;
              return this.int16[Ha + 0] = ie, this.int16[Ha + 1] = ge, this.int16[Ha + 2] = _e, this.int16[Ha + 3] = Oe, this.int16[Ha + 4] = Xe, this.int16[Ha + 5] = ht, this.int16[Ha + 6] = Tt, this.int16[Ha + 7] = Dt, this.uint16[Ha + 8] = Xt, this.uint16[Ha + 9] = ar, this.uint16[Ha + 10] = er, this.uint16[Ha + 11] = hr, this.uint16[Ha + 12] = Sr, this.uint16[Ha + 13] = Ur, this.uint16[Ha + 14] = Br, this.uint16[Ha + 15] = rn, this.uint16[Ha + 16] = nn, this.uint16[Ha + 17] = cn, this.uint16[Ha + 18] = In, this.uint16[Ha + 19] = Un, this.uint16[Ha + 20] = ha, this.uint16[Ha + 21] = fa, this.uint16[Ha + 22] = wa, this.uint32[xo + 12] = Wa, this.float32[xo + 13] = $a, this.float32[xo + 14] = Ea, this.float32[xo + 15] = oi, this.float32[xo + 16] = ei, ee;
            }, B2;
          }(yo);
          hm.prototype.bytesPerElement = 68, mn("StructArrayLayout8i15ui1ul4f68", hm);
          var fe = function(M2) {
            function B2() {
              M2.apply(this, arguments);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype._refreshViews = function() {
              this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer);
            }, B2.prototype.emplaceBack = function(ee) {
              var ie = this.length;
              return this.resize(ie + 1), this.emplace(ie, ee);
            }, B2.prototype.emplace = function(ee, ie) {
              var ge = 1 * ee;
              return this.float32[ge + 0] = ie, ee;
            }, B2;
          }(yo);
          fe.prototype.bytesPerElement = 4, mn("StructArrayLayout1f4", fe);
          var P2 = function(M2) {
            function B2() {
              M2.apply(this, arguments);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype._refreshViews = function() {
              this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
            }, B2.prototype.emplaceBack = function(ee, ie, ge) {
              var _e = this.length;
              return this.resize(_e + 1), this.emplace(_e, ee, ie, ge);
            }, B2.prototype.emplace = function(ee, ie, ge, _e) {
              var Oe = 3 * ee;
              return this.int16[Oe + 0] = ie, this.int16[Oe + 1] = ge, this.int16[Oe + 2] = _e, ee;
            }, B2;
          }(yo);
          P2.prototype.bytesPerElement = 6, mn("StructArrayLayout3i6", P2);
          var U2 = function(M2) {
            function B2() {
              M2.apply(this, arguments);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype._refreshViews = function() {
              this.uint8 = new Uint8Array(this.arrayBuffer), this.uint32 = new Uint32Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);
            }, B2.prototype.emplaceBack = function(ee, ie, ge) {
              var _e = this.length;
              return this.resize(_e + 1), this.emplace(_e, ee, ie, ge);
            }, B2.prototype.emplace = function(ee, ie, ge, _e) {
              var Oe = 2 * ee, Xe = 4 * ee;
              return this.uint32[Oe + 0] = ie, this.uint16[Xe + 2] = ge, this.uint16[Xe + 3] = _e, ee;
            }, B2;
          }(yo);
          U2.prototype.bytesPerElement = 8, mn("StructArrayLayout1ul2ui8", U2);
          var G2 = function(M2) {
            function B2() {
              M2.apply(this, arguments);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype._refreshViews = function() {
              this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);
            }, B2.prototype.emplaceBack = function(ee, ie) {
              var ge = this.length;
              return this.resize(ge + 1), this.emplace(ge, ee, ie);
            }, B2.prototype.emplace = function(ee, ie, ge) {
              var _e = 2 * ee;
              return this.uint16[_e + 0] = ie, this.uint16[_e + 1] = ge, ee;
            }, B2;
          }(yo);
          G2.prototype.bytesPerElement = 4, mn("StructArrayLayout2ui4", G2);
          var J2 = function(M2) {
            function B2() {
              M2.apply(this, arguments);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype._refreshViews = function() {
              this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);
            }, B2.prototype.emplaceBack = function(ee) {
              var ie = this.length;
              return this.resize(ie + 1), this.emplace(ie, ee);
            }, B2.prototype.emplace = function(ee, ie) {
              var ge = 1 * ee;
              return this.uint16[ge + 0] = ie, ee;
            }, B2;
          }(yo);
          J2.prototype.bytesPerElement = 2, mn("StructArrayLayout1ui2", J2);
          var oe = function(M2) {
            function B2() {
              M2.apply(this, arguments);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype._refreshViews = function() {
              this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer);
            }, B2.prototype.emplaceBack = function(ee, ie) {
              var ge = this.length;
              return this.resize(ge + 1), this.emplace(ge, ee, ie);
            }, B2.prototype.emplace = function(ee, ie, ge) {
              var _e = 2 * ee;
              return this.float32[_e + 0] = ie, this.float32[_e + 1] = ge, ee;
            }, B2;
          }(yo);
          oe.prototype.bytesPerElement = 8, mn("StructArrayLayout2f8", oe);
          var de = function(M2) {
            function B2() {
              M2.apply(this, arguments);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype._refreshViews = function() {
              this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer);
            }, B2.prototype.emplaceBack = function(ee, ie, ge, _e) {
              var Oe = this.length;
              return this.resize(Oe + 1), this.emplace(Oe, ee, ie, ge, _e);
            }, B2.prototype.emplace = function(ee, ie, ge, _e, Oe) {
              var Xe = 4 * ee;
              return this.float32[Xe + 0] = ie, this.float32[Xe + 1] = ge, this.float32[Xe + 2] = _e, this.float32[Xe + 3] = Oe, ee;
            }, B2;
          }(yo);
          de.prototype.bytesPerElement = 16, mn("StructArrayLayout4f16", de);
          var ye = function(M2) {
            function B2() {
              M2.apply(this, arguments);
            }
            M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2;
            var ee = { anchorPointX: { configurable: true }, anchorPointY: { configurable: true }, x1: { configurable: true }, y1: { configurable: true }, x2: { configurable: true }, y2: { configurable: true }, featureIndex: { configurable: true }, sourceLayerIndex: { configurable: true }, bucketIndex: { configurable: true }, anchorPoint: { configurable: true } };
            return ee.anchorPointX.get = function() {
              return this._structArray.int16[this._pos2 + 0];
            }, ee.anchorPointY.get = function() {
              return this._structArray.int16[this._pos2 + 1];
            }, ee.x1.get = function() {
              return this._structArray.int16[this._pos2 + 2];
            }, ee.y1.get = function() {
              return this._structArray.int16[this._pos2 + 3];
            }, ee.x2.get = function() {
              return this._structArray.int16[this._pos2 + 4];
            }, ee.y2.get = function() {
              return this._structArray.int16[this._pos2 + 5];
            }, ee.featureIndex.get = function() {
              return this._structArray.uint32[this._pos4 + 3];
            }, ee.sourceLayerIndex.get = function() {
              return this._structArray.uint16[this._pos2 + 8];
            }, ee.bucketIndex.get = function() {
              return this._structArray.uint16[this._pos2 + 9];
            }, ee.anchorPoint.get = function() {
              return new f(this.anchorPointX, this.anchorPointY);
            }, Object.defineProperties(B2.prototype, ee), B2;
          }(Lp);
          ye.prototype.size = 20;
          var Te = function(M2) {
            function B2() {
              M2.apply(this, arguments);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype.get = function(ee) {
              return new ye(this, ee);
            }, B2;
          }(cm);
          mn("CollisionBoxArray", Te);
          var Fe = function(M2) {
            function B2() {
              M2.apply(this, arguments);
            }
            M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2;
            var ee = { anchorX: { configurable: true }, anchorY: { configurable: true }, glyphStartIndex: { configurable: true }, numGlyphs: { configurable: true }, vertexStartIndex: { configurable: true }, lineStartIndex: { configurable: true }, lineLength: { configurable: true }, segment: { configurable: true }, lowerSize: { configurable: true }, upperSize: { configurable: true }, lineOffsetX: { configurable: true }, lineOffsetY: { configurable: true }, writingMode: { configurable: true }, placedOrientation: { configurable: true }, hidden: { configurable: true }, crossTileID: { configurable: true }, associatedIconIndex: { configurable: true } };
            return ee.anchorX.get = function() {
              return this._structArray.int16[this._pos2 + 0];
            }, ee.anchorY.get = function() {
              return this._structArray.int16[this._pos2 + 1];
            }, ee.glyphStartIndex.get = function() {
              return this._structArray.uint16[this._pos2 + 2];
            }, ee.numGlyphs.get = function() {
              return this._structArray.uint16[this._pos2 + 3];
            }, ee.vertexStartIndex.get = function() {
              return this._structArray.uint32[this._pos4 + 2];
            }, ee.lineStartIndex.get = function() {
              return this._structArray.uint32[this._pos4 + 3];
            }, ee.lineLength.get = function() {
              return this._structArray.uint32[this._pos4 + 4];
            }, ee.segment.get = function() {
              return this._structArray.uint16[this._pos2 + 10];
            }, ee.lowerSize.get = function() {
              return this._structArray.uint16[this._pos2 + 11];
            }, ee.upperSize.get = function() {
              return this._structArray.uint16[this._pos2 + 12];
            }, ee.lineOffsetX.get = function() {
              return this._structArray.float32[this._pos4 + 7];
            }, ee.lineOffsetY.get = function() {
              return this._structArray.float32[this._pos4 + 8];
            }, ee.writingMode.get = function() {
              return this._structArray.uint8[this._pos1 + 36];
            }, ee.placedOrientation.get = function() {
              return this._structArray.uint8[this._pos1 + 37];
            }, ee.placedOrientation.set = function(ie) {
              this._structArray.uint8[this._pos1 + 37] = ie;
            }, ee.hidden.get = function() {
              return this._structArray.uint8[this._pos1 + 38];
            }, ee.hidden.set = function(ie) {
              this._structArray.uint8[this._pos1 + 38] = ie;
            }, ee.crossTileID.get = function() {
              return this._structArray.uint32[this._pos4 + 10];
            }, ee.crossTileID.set = function(ie) {
              this._structArray.uint32[this._pos4 + 10] = ie;
            }, ee.associatedIconIndex.get = function() {
              return this._structArray.int16[this._pos2 + 22];
            }, Object.defineProperties(B2.prototype, ee), B2;
          }(Lp);
          Fe.prototype.size = 48;
          var et = function(M2) {
            function B2() {
              M2.apply(this, arguments);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype.get = function(ee) {
              return new Fe(this, ee);
            }, B2;
          }(fm);
          mn("PlacedSymbolArray", et);
          var lt = function(M2) {
            function B2() {
              M2.apply(this, arguments);
            }
            M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2;
            var ee = { anchorX: { configurable: true }, anchorY: { configurable: true }, rightJustifiedTextSymbolIndex: { configurable: true }, centerJustifiedTextSymbolIndex: { configurable: true }, leftJustifiedTextSymbolIndex: { configurable: true }, verticalPlacedTextSymbolIndex: { configurable: true }, placedIconSymbolIndex: { configurable: true }, verticalPlacedIconSymbolIndex: { configurable: true }, key: { configurable: true }, textBoxStartIndex: { configurable: true }, textBoxEndIndex: { configurable: true }, verticalTextBoxStartIndex: { configurable: true }, verticalTextBoxEndIndex: { configurable: true }, iconBoxStartIndex: { configurable: true }, iconBoxEndIndex: { configurable: true }, verticalIconBoxStartIndex: { configurable: true }, verticalIconBoxEndIndex: { configurable: true }, featureIndex: { configurable: true }, numHorizontalGlyphVertices: { configurable: true }, numVerticalGlyphVertices: { configurable: true }, numIconVertices: { configurable: true }, numVerticalIconVertices: { configurable: true }, useRuntimeCollisionCircles: { configurable: true }, crossTileID: { configurable: true }, textBoxScale: { configurable: true }, textOffset0: { configurable: true }, textOffset1: { configurable: true }, collisionCircleDiameter: { configurable: true } };
            return ee.anchorX.get = function() {
              return this._structArray.int16[this._pos2 + 0];
            }, ee.anchorY.get = function() {
              return this._structArray.int16[this._pos2 + 1];
            }, ee.rightJustifiedTextSymbolIndex.get = function() {
              return this._structArray.int16[this._pos2 + 2];
            }, ee.centerJustifiedTextSymbolIndex.get = function() {
              return this._structArray.int16[this._pos2 + 3];
            }, ee.leftJustifiedTextSymbolIndex.get = function() {
              return this._structArray.int16[this._pos2 + 4];
            }, ee.verticalPlacedTextSymbolIndex.get = function() {
              return this._structArray.int16[this._pos2 + 5];
            }, ee.placedIconSymbolIndex.get = function() {
              return this._structArray.int16[this._pos2 + 6];
            }, ee.verticalPlacedIconSymbolIndex.get = function() {
              return this._structArray.int16[this._pos2 + 7];
            }, ee.key.get = function() {
              return this._structArray.uint16[this._pos2 + 8];
            }, ee.textBoxStartIndex.get = function() {
              return this._structArray.uint16[this._pos2 + 9];
            }, ee.textBoxEndIndex.get = function() {
              return this._structArray.uint16[this._pos2 + 10];
            }, ee.verticalTextBoxStartIndex.get = function() {
              return this._structArray.uint16[this._pos2 + 11];
            }, ee.verticalTextBoxEndIndex.get = function() {
              return this._structArray.uint16[this._pos2 + 12];
            }, ee.iconBoxStartIndex.get = function() {
              return this._structArray.uint16[this._pos2 + 13];
            }, ee.iconBoxEndIndex.get = function() {
              return this._structArray.uint16[this._pos2 + 14];
            }, ee.verticalIconBoxStartIndex.get = function() {
              return this._structArray.uint16[this._pos2 + 15];
            }, ee.verticalIconBoxEndIndex.get = function() {
              return this._structArray.uint16[this._pos2 + 16];
            }, ee.featureIndex.get = function() {
              return this._structArray.uint16[this._pos2 + 17];
            }, ee.numHorizontalGlyphVertices.get = function() {
              return this._structArray.uint16[this._pos2 + 18];
            }, ee.numVerticalGlyphVertices.get = function() {
              return this._structArray.uint16[this._pos2 + 19];
            }, ee.numIconVertices.get = function() {
              return this._structArray.uint16[this._pos2 + 20];
            }, ee.numVerticalIconVertices.get = function() {
              return this._structArray.uint16[this._pos2 + 21];
            }, ee.useRuntimeCollisionCircles.get = function() {
              return this._structArray.uint16[this._pos2 + 22];
            }, ee.crossTileID.get = function() {
              return this._structArray.uint32[this._pos4 + 12];
            }, ee.crossTileID.set = function(ie) {
              this._structArray.uint32[this._pos4 + 12] = ie;
            }, ee.textBoxScale.get = function() {
              return this._structArray.float32[this._pos4 + 13];
            }, ee.textOffset0.get = function() {
              return this._structArray.float32[this._pos4 + 14];
            }, ee.textOffset1.get = function() {
              return this._structArray.float32[this._pos4 + 15];
            }, ee.collisionCircleDiameter.get = function() {
              return this._structArray.float32[this._pos4 + 16];
            }, Object.defineProperties(B2.prototype, ee), B2;
          }(Lp);
          lt.prototype.size = 68;
          var bt = function(M2) {
            function B2() {
              M2.apply(this, arguments);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype.get = function(ee) {
              return new lt(this, ee);
            }, B2;
          }(hm);
          mn("SymbolInstanceArray", bt);
          var It = function(M2) {
            function B2() {
              M2.apply(this, arguments);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype.getoffsetX = function(ee) {
              return this.float32[1 * ee + 0];
            }, B2;
          }(fe);
          mn("GlyphOffsetArray", It);
          var Rt = function(M2) {
            function B2() {
              M2.apply(this, arguments);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype.getx = function(ee) {
              return this.int16[3 * ee + 0];
            }, B2.prototype.gety = function(ee) {
              return this.int16[3 * ee + 1];
            }, B2.prototype.gettileUnitDistanceFromAnchor = function(ee) {
              return this.int16[3 * ee + 2];
            }, B2;
          }(P2);
          mn("SymbolLineVertexArray", Rt);
          var Ft = function(M2) {
            function B2() {
              M2.apply(this, arguments);
            }
            M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2;
            var ee = { featureIndex: { configurable: true }, sourceLayerIndex: { configurable: true }, bucketIndex: { configurable: true } };
            return ee.featureIndex.get = function() {
              return this._structArray.uint32[this._pos4 + 0];
            }, ee.sourceLayerIndex.get = function() {
              return this._structArray.uint16[this._pos2 + 2];
            }, ee.bucketIndex.get = function() {
              return this._structArray.uint16[this._pos2 + 3];
            }, Object.defineProperties(B2.prototype, ee), B2;
          }(Lp);
          Ft.prototype.size = 8;
          var Pt = function(M2) {
            function B2() {
              M2.apply(this, arguments);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype.get = function(ee) {
              return new Ft(this, ee);
            }, B2;
          }(U2);
          mn("FeatureIndexArray", Pt);
          var Mt = Po([{ name: "a_pos", components: 2, type: "Int16" }], 4).members, qt = function(M2) {
            M2 === void 0 && (M2 = []), this.segments = M2;
          };
          function $t(M2, B2) {
            return 256 * (M2 = v(Math.floor(M2), 0, 255)) + (B2 = v(Math.floor(B2), 0, 255));
          }
          qt.prototype.prepareSegment = function(M2, B2, ee, ie) {
            var ge = this.segments[this.segments.length - 1];
            return M2 > qt.MAX_VERTEX_ARRAY_LENGTH && E2("Max vertices per segment is " + qt.MAX_VERTEX_ARRAY_LENGTH + ": bucket requested " + M2), (!ge || ge.vertexLength + M2 > qt.MAX_VERTEX_ARRAY_LENGTH || ge.sortKey !== ie) && (ge = { vertexOffset: B2.length, primitiveOffset: ee.length, vertexLength: 0, primitiveLength: 0 }, ie !== void 0 && (ge.sortKey = ie), this.segments.push(ge)), ge;
          }, qt.prototype.get = function() {
            return this.segments;
          }, qt.prototype.destroy = function() {
            for (var M2 = 0, B2 = this.segments; M2 < B2.length; M2 += 1) {
              var ee = B2[M2];
              for (var ie in ee.vaos) ee.vaos[ie].destroy();
            }
          }, qt.simpleSegment = function(M2, B2, ee, ie) {
            return new qt([{ vertexOffset: M2, primitiveOffset: B2, vertexLength: ee, primitiveLength: ie, vaos: {}, sortKey: 0 }]);
          }, qt.MAX_VERTEX_ARRAY_LENGTH = Math.pow(2, 16) - 1, mn("SegmentVector", qt);
          var Yt = Po([{ name: "a_pattern_from", components: 4, type: "Uint16" }, { name: "a_pattern_to", components: 4, type: "Uint16" }, { name: "a_pixel_ratio_from", components: 1, type: "Uint8" }, { name: "a_pixel_ratio_to", components: 1, type: "Uint8" }]), cr = l(function(M2) {
            M2.exports = function(B2, ee) {
              var ie, ge, _e, Oe, Xe, ht, Tt, Dt;
              for (ie = 3 & B2.length, ge = B2.length - ie, _e = ee, Xe = 3432918353, ht = 461845907, Dt = 0; Dt < ge; ) Tt = 255 & B2.charCodeAt(Dt) | (255 & B2.charCodeAt(++Dt)) << 8 | (255 & B2.charCodeAt(++Dt)) << 16 | (255 & B2.charCodeAt(++Dt)) << 24, ++Dt, _e = 27492 + (65535 & (Oe = 5 * (65535 & (_e = (_e ^= Tt = (65535 & (Tt = (Tt = (65535 & Tt) * Xe + (((Tt >>> 16) * Xe & 65535) << 16) & 4294967295) << 15 | Tt >>> 17)) * ht + (((Tt >>> 16) * ht & 65535) << 16) & 4294967295) << 13 | _e >>> 19)) + ((5 * (_e >>> 16) & 65535) << 16) & 4294967295)) + ((58964 + (Oe >>> 16) & 65535) << 16);
              switch (Tt = 0, ie) {
                case 3:
                  Tt ^= (255 & B2.charCodeAt(Dt + 2)) << 16;
                case 2:
                  Tt ^= (255 & B2.charCodeAt(Dt + 1)) << 8;
                case 1:
                  _e ^= Tt = (65535 & (Tt = (Tt = (65535 & (Tt ^= 255 & B2.charCodeAt(Dt))) * Xe + (((Tt >>> 16) * Xe & 65535) << 16) & 4294967295) << 15 | Tt >>> 17)) * ht + (((Tt >>> 16) * ht & 65535) << 16) & 4294967295;
              }
              return _e ^= B2.length, _e = 2246822507 * (65535 & (_e ^= _e >>> 16)) + ((2246822507 * (_e >>> 16) & 65535) << 16) & 4294967295, _e = 3266489909 * (65535 & (_e ^= _e >>> 13)) + ((3266489909 * (_e >>> 16) & 65535) << 16) & 4294967295, (_e ^= _e >>> 16) >>> 0;
            };
          }), kr = l(function(M2) {
            M2.exports = function(B2, ee) {
              for (var ie, ge = B2.length, _e = ee ^ ge, Oe = 0; ge >= 4; ) ie = 1540483477 * (65535 & (ie = 255 & B2.charCodeAt(Oe) | (255 & B2.charCodeAt(++Oe)) << 8 | (255 & B2.charCodeAt(++Oe)) << 16 | (255 & B2.charCodeAt(++Oe)) << 24)) + ((1540483477 * (ie >>> 16) & 65535) << 16), _e = 1540483477 * (65535 & _e) + ((1540483477 * (_e >>> 16) & 65535) << 16) ^ (ie = 1540483477 * (65535 & (ie ^= ie >>> 24)) + ((1540483477 * (ie >>> 16) & 65535) << 16)), ge -= 4, ++Oe;
              switch (ge) {
                case 3:
                  _e ^= (255 & B2.charCodeAt(Oe + 2)) << 16;
                case 2:
                  _e ^= (255 & B2.charCodeAt(Oe + 1)) << 8;
                case 1:
                  _e = 1540483477 * (65535 & (_e ^= 255 & B2.charCodeAt(Oe))) + ((1540483477 * (_e >>> 16) & 65535) << 16);
              }
              return _e = 1540483477 * (65535 & (_e ^= _e >>> 13)) + ((1540483477 * (_e >>> 16) & 65535) << 16), (_e ^= _e >>> 15) >>> 0;
            };
          }), Pr = cr, Or = cr, xn = kr;
          Pr.murmur3 = Or, Pr.murmur2 = xn;
          var yn = function() {
            this.ids = [], this.positions = [], this.indexed = false;
          };
          yn.prototype.add = function(M2, B2, ee, ie) {
            this.ids.push(An(M2)), this.positions.push(B2, ee, ie);
          }, yn.prototype.getPositions = function(M2) {
            for (var B2 = An(M2), ee = 0, ie = this.ids.length - 1; ee < ie; ) {
              var ge = ee + ie >> 1;
              this.ids[ge] >= B2 ? ie = ge : ee = ge + 1;
            }
            for (var _e = []; this.ids[ee] === B2; ) {
              var Oe = this.positions[3 * ee], Xe = this.positions[3 * ee + 1], ht = this.positions[3 * ee + 2];
              _e.push({ index: Oe, start: Xe, end: ht }), ee++;
            }
            return _e;
          }, yn.serialize = function(M2, B2) {
            var ee = new Float64Array(M2.ids), ie = new Uint32Array(M2.positions);
            return function ge(_e, Oe, Xe, ht) {
              for (; Xe < ht; ) {
                for (var Tt = _e[Xe + ht >> 1], Dt = Xe - 1, Xt = ht + 1; ; ) {
                  do
                    Dt++;
                  while (_e[Dt] < Tt);
                  do
                    Xt--;
                  while (_e[Xt] > Tt);
                  if (Dt >= Xt) break;
                  ma(_e, Dt, Xt), ma(Oe, 3 * Dt, 3 * Xt), ma(Oe, 3 * Dt + 1, 3 * Xt + 1), ma(Oe, 3 * Dt + 2, 3 * Xt + 2);
                }
                Xt - Xe < ht - Xt ? (ge(_e, Oe, Xe, Xt), Xe = Xt + 1) : (ge(_e, Oe, Xt + 1, ht), ht = Xt);
              }
            }(ee, ie, 0, ee.length - 1), B2 && B2.push(ee.buffer, ie.buffer), { ids: ee, positions: ie };
          }, yn.deserialize = function(M2) {
            var B2 = new yn();
            return B2.ids = M2.ids, B2.positions = M2.positions, B2.indexed = true, B2;
          };
          var Nn = Math.pow(2, 53) - 1;
          function An(M2) {
            var B2 = +M2;
            return !isNaN(B2) && B2 <= Nn ? B2 : Pr(String(M2));
          }
          function ma(M2, B2, ee) {
            var ie = M2[B2];
            M2[B2] = M2[ee], M2[ee] = ie;
          }
          mn("FeaturePositionMap", yn);
          var Aa = function(M2, B2) {
            this.gl = M2.gl, this.location = B2;
          }, Qa = function(M2) {
            function B2(ee, ie) {
              M2.call(this, ee, ie), this.current = 0;
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype.set = function(ee) {
              this.current !== ee && (this.current = ee, this.gl.uniform1i(this.location, ee));
            }, B2;
          }(Aa), ln = function(M2) {
            function B2(ee, ie) {
              M2.call(this, ee, ie), this.current = 0;
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype.set = function(ee) {
              this.current !== ee && (this.current = ee, this.gl.uniform1f(this.location, ee));
            }, B2;
          }(Aa), qn = function(M2) {
            function B2(ee, ie) {
              M2.call(this, ee, ie), this.current = [0, 0];
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype.set = function(ee) {
              ee[0] === this.current[0] && ee[1] === this.current[1] || (this.current = ee, this.gl.uniform2f(this.location, ee[0], ee[1]));
            }, B2;
          }(Aa), Sa = function(M2) {
            function B2(ee, ie) {
              M2.call(this, ee, ie), this.current = [0, 0, 0];
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype.set = function(ee) {
              ee[0] === this.current[0] && ee[1] === this.current[1] && ee[2] === this.current[2] || (this.current = ee, this.gl.uniform3f(this.location, ee[0], ee[1], ee[2]));
            }, B2;
          }(Aa), _a = function(M2) {
            function B2(ee, ie) {
              M2.call(this, ee, ie), this.current = [0, 0, 0, 0];
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype.set = function(ee) {
              ee[0] === this.current[0] && ee[1] === this.current[1] && ee[2] === this.current[2] && ee[3] === this.current[3] || (this.current = ee, this.gl.uniform4f(this.location, ee[0], ee[1], ee[2], ee[3]));
            }, B2;
          }(Aa), Pa = function(M2) {
            function B2(ee, ie) {
              M2.call(this, ee, ie), this.current = pr.transparent;
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype.set = function(ee) {
              ee.r === this.current.r && ee.g === this.current.g && ee.b === this.current.b && ee.a === this.current.a || (this.current = ee, this.gl.uniform4f(this.location, ee.r, ee.g, ee.b, ee.a));
            }, B2;
          }(Aa), ii = new Float32Array(16), Oi = function(M2) {
            function B2(ee, ie) {
              M2.call(this, ee, ie), this.current = ii;
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype.set = function(ee) {
              if (ee[12] !== this.current[12] || ee[0] !== this.current[0]) return this.current = ee, void this.gl.uniformMatrix4fv(this.location, false, ee);
              for (var ie = 1; ie < 16; ie++) if (ee[ie] !== this.current[ie]) {
                this.current = ee, this.gl.uniformMatrix4fv(this.location, false, ee);
                break;
              }
            }, B2;
          }(Aa);
          function Da(M2) {
            return [$t(255 * M2.r, 255 * M2.g), $t(255 * M2.b, 255 * M2.a)];
          }
          var wi = function(M2, B2, ee) {
            this.value = M2, this.uniformNames = B2.map(function(ie) {
              return "u_" + ie;
            }), this.type = ee;
          };
          wi.prototype.setUniform = function(M2, B2, ee) {
            M2.set(ee.constantOr(this.value));
          }, wi.prototype.getBinding = function(M2, B2, ee) {
            return this.type === "color" ? new Pa(M2, B2) : new ln(M2, B2);
          };
          var di = function(M2, B2) {
            this.uniformNames = B2.map(function(ee) {
              return "u_" + ee;
            }), this.patternFrom = null, this.patternTo = null, this.pixelRatioFrom = 1, this.pixelRatioTo = 1;
          };
          di.prototype.setConstantPatternPositions = function(M2, B2) {
            this.pixelRatioFrom = B2.pixelRatio, this.pixelRatioTo = M2.pixelRatio, this.patternFrom = B2.tlbr, this.patternTo = M2.tlbr;
          }, di.prototype.setUniform = function(M2, B2, ee, ie) {
            var ge = ie === "u_pattern_to" ? this.patternTo : ie === "u_pattern_from" ? this.patternFrom : ie === "u_pixel_ratio_to" ? this.pixelRatioTo : ie === "u_pixel_ratio_from" ? this.pixelRatioFrom : null;
            ge && M2.set(ge);
          }, di.prototype.getBinding = function(M2, B2, ee) {
            return ee.substr(0, 9) === "u_pattern" ? new _a(M2, B2) : new ln(M2, B2);
          };
          var ji = function(M2, B2, ee, ie) {
            this.expression = M2, this.type = ee, this.maxValue = 0, this.paintVertexAttributes = B2.map(function(ge) {
              return { name: "a_" + ge, type: "Float32", components: ee === "color" ? 2 : 1, offset: 0 };
            }), this.paintVertexArray = new ie();
          };
          ji.prototype.populatePaintArray = function(M2, B2, ee, ie, ge) {
            var _e = this.paintVertexArray.length, Oe = this.expression.evaluate(new Oo(0), B2, {}, ie, [], ge);
            this.paintVertexArray.resize(M2), this._setPaintValue(_e, M2, Oe);
          }, ji.prototype.updatePaintArray = function(M2, B2, ee, ie) {
            var ge = this.expression.evaluate({ zoom: 0 }, ee, ie);
            this._setPaintValue(M2, B2, ge);
          }, ji.prototype._setPaintValue = function(M2, B2, ee) {
            if (this.type === "color") for (var ie = Da(ee), ge = M2; ge < B2; ge++) this.paintVertexArray.emplace(ge, ie[0], ie[1]);
            else {
              for (var _e = M2; _e < B2; _e++) this.paintVertexArray.emplace(_e, ee);
              this.maxValue = Math.max(this.maxValue, Math.abs(ee));
            }
          }, ji.prototype.upload = function(M2) {
            this.paintVertexArray && this.paintVertexArray.arrayBuffer && (this.paintVertexBuffer && this.paintVertexBuffer.buffer ? this.paintVertexBuffer.updateData(this.paintVertexArray) : this.paintVertexBuffer = M2.createVertexBuffer(this.paintVertexArray, this.paintVertexAttributes, this.expression.isStateDependent));
          }, ji.prototype.destroy = function() {
            this.paintVertexBuffer && this.paintVertexBuffer.destroy();
          };
          var ki = function(M2, B2, ee, ie, ge, _e) {
            this.expression = M2, this.uniformNames = B2.map(function(Oe) {
              return "u_" + Oe + "_t";
            }), this.type = ee, this.useIntegerZoom = ie, this.zoom = ge, this.maxValue = 0, this.paintVertexAttributes = B2.map(function(Oe) {
              return { name: "a_" + Oe, type: "Float32", components: ee === "color" ? 4 : 2, offset: 0 };
            }), this.paintVertexArray = new _e();
          };
          ki.prototype.populatePaintArray = function(M2, B2, ee, ie, ge) {
            var _e = this.expression.evaluate(new Oo(this.zoom), B2, {}, ie, [], ge), Oe = this.expression.evaluate(new Oo(this.zoom + 1), B2, {}, ie, [], ge), Xe = this.paintVertexArray.length;
            this.paintVertexArray.resize(M2), this._setPaintValue(Xe, M2, _e, Oe);
          }, ki.prototype.updatePaintArray = function(M2, B2, ee, ie) {
            var ge = this.expression.evaluate({ zoom: this.zoom }, ee, ie), _e = this.expression.evaluate({ zoom: this.zoom + 1 }, ee, ie);
            this._setPaintValue(M2, B2, ge, _e);
          }, ki.prototype._setPaintValue = function(M2, B2, ee, ie) {
            if (this.type === "color") for (var ge = Da(ee), _e = Da(ie), Oe = M2; Oe < B2; Oe++) this.paintVertexArray.emplace(Oe, ge[0], ge[1], _e[0], _e[1]);
            else {
              for (var Xe = M2; Xe < B2; Xe++) this.paintVertexArray.emplace(Xe, ee, ie);
              this.maxValue = Math.max(this.maxValue, Math.abs(ee), Math.abs(ie));
            }
          }, ki.prototype.upload = function(M2) {
            this.paintVertexArray && this.paintVertexArray.arrayBuffer && (this.paintVertexBuffer && this.paintVertexBuffer.buffer ? this.paintVertexBuffer.updateData(this.paintVertexArray) : this.paintVertexBuffer = M2.createVertexBuffer(this.paintVertexArray, this.paintVertexAttributes, this.expression.isStateDependent));
          }, ki.prototype.destroy = function() {
            this.paintVertexBuffer && this.paintVertexBuffer.destroy();
          }, ki.prototype.setUniform = function(M2, B2) {
            var ee = this.useIntegerZoom ? Math.floor(B2.zoom) : B2.zoom, ie = v(this.expression.interpolationFactor(ee, this.zoom, this.zoom + 1), 0, 1);
            M2.set(ie);
          }, ki.prototype.getBinding = function(M2, B2, ee) {
            return new ln(M2, B2);
          };
          var Wi = function(M2, B2, ee, ie, ge, _e) {
            this.expression = M2, this.type = B2, this.useIntegerZoom = ee, this.zoom = ie, this.layerId = _e, this.zoomInPaintVertexArray = new ge(), this.zoomOutPaintVertexArray = new ge();
          };
          Wi.prototype.populatePaintArray = function(M2, B2, ee) {
            var ie = this.zoomInPaintVertexArray.length;
            this.zoomInPaintVertexArray.resize(M2), this.zoomOutPaintVertexArray.resize(M2), this._setPaintValues(ie, M2, B2.patterns && B2.patterns[this.layerId], ee);
          }, Wi.prototype.updatePaintArray = function(M2, B2, ee, ie, ge) {
            this._setPaintValues(M2, B2, ee.patterns && ee.patterns[this.layerId], ge);
          }, Wi.prototype._setPaintValues = function(M2, B2, ee, ie) {
            if (ie && ee) {
              var ge = ee.min, _e = ee.mid, Oe = ee.max, Xe = ie[ge], ht = ie[_e], Tt = ie[Oe];
              if (Xe && ht && Tt) for (var Dt = M2; Dt < B2; Dt++) this.zoomInPaintVertexArray.emplace(Dt, ht.tl[0], ht.tl[1], ht.br[0], ht.br[1], Xe.tl[0], Xe.tl[1], Xe.br[0], Xe.br[1], ht.pixelRatio, Xe.pixelRatio), this.zoomOutPaintVertexArray.emplace(Dt, ht.tl[0], ht.tl[1], ht.br[0], ht.br[1], Tt.tl[0], Tt.tl[1], Tt.br[0], Tt.br[1], ht.pixelRatio, Tt.pixelRatio);
            }
          }, Wi.prototype.upload = function(M2) {
            this.zoomInPaintVertexArray && this.zoomInPaintVertexArray.arrayBuffer && this.zoomOutPaintVertexArray && this.zoomOutPaintVertexArray.arrayBuffer && (this.zoomInPaintVertexBuffer = M2.createVertexBuffer(this.zoomInPaintVertexArray, Yt.members, this.expression.isStateDependent), this.zoomOutPaintVertexBuffer = M2.createVertexBuffer(this.zoomOutPaintVertexArray, Yt.members, this.expression.isStateDependent));
          }, Wi.prototype.destroy = function() {
            this.zoomOutPaintVertexBuffer && this.zoomOutPaintVertexBuffer.destroy(), this.zoomInPaintVertexBuffer && this.zoomInPaintVertexBuffer.destroy();
          };
          var to = function(M2, B2, ee, ie) {
            this.binders = {}, this.layoutAttributes = ie, this._buffers = [];
            var ge = [];
            for (var _e in M2.paint._values) if (ee(_e)) {
              var Oe = M2.paint.get(_e);
              if (Oe instanceof Ys && Uc(Oe.property.specification)) {
                var Xe = js(_e, M2.type), ht = Oe.value, Tt = Oe.property.specification.type, Dt = Oe.property.useIntegerZoom, Xt = Oe.property.specification["property-type"], ar = Xt === "cross-faded" || Xt === "cross-faded-data-driven";
                if (ht.kind === "constant") this.binders[_e] = ar ? new di(ht.value, Xe) : new wi(ht.value, Xe, Tt), ge.push("/u_" + _e);
                else if (ht.kind === "source" || ar) {
                  var er = Ws(_e, Tt, "source");
                  this.binders[_e] = ar ? new Wi(ht, Tt, Dt, B2, er, M2.id) : new ji(ht, Xe, Tt, er), ge.push("/a_" + _e);
                } else {
                  var hr = Ws(_e, Tt, "composite");
                  this.binders[_e] = new ki(ht, Xe, Tt, Dt, B2, hr), ge.push("/z_" + _e);
                }
              }
            }
            this.cacheKey = ge.sort().join("");
          };
          to.prototype.getMaxValue = function(M2) {
            var B2 = this.binders[M2];
            return B2 instanceof ji || B2 instanceof ki ? B2.maxValue : 0;
          }, to.prototype.populatePaintArrays = function(M2, B2, ee, ie, ge) {
            for (var _e in this.binders) {
              var Oe = this.binders[_e];
              (Oe instanceof ji || Oe instanceof ki || Oe instanceof Wi) && Oe.populatePaintArray(M2, B2, ee, ie, ge);
            }
          }, to.prototype.setConstantPatternPositions = function(M2, B2) {
            for (var ee in this.binders) {
              var ie = this.binders[ee];
              ie instanceof di && ie.setConstantPatternPositions(M2, B2);
            }
          }, to.prototype.updatePaintArrays = function(M2, B2, ee, ie, ge) {
            var _e = false;
            for (var Oe in M2) for (var Xe = 0, ht = B2.getPositions(Oe); Xe < ht.length; Xe += 1) {
              var Tt = ht[Xe], Dt = ee.feature(Tt.index);
              for (var Xt in this.binders) {
                var ar = this.binders[Xt];
                if ((ar instanceof ji || ar instanceof ki || ar instanceof Wi) && ar.expression.isStateDependent === true) {
                  var er = ie.paint.get(Xt);
                  ar.expression = er.value, ar.updatePaintArray(Tt.start, Tt.end, Dt, M2[Oe], ge), _e = true;
                }
              }
            }
            return _e;
          }, to.prototype.defines = function() {
            var M2 = [];
            for (var B2 in this.binders) {
              var ee = this.binders[B2];
              (ee instanceof wi || ee instanceof di) && M2.push.apply(M2, ee.uniformNames.map(function(ie) {
                return "#define HAS_UNIFORM_" + ie;
              }));
            }
            return M2;
          }, to.prototype.getPaintVertexBuffers = function() {
            return this._buffers;
          }, to.prototype.getUniforms = function(M2, B2) {
            var ee = [];
            for (var ie in this.binders) {
              var ge = this.binders[ie];
              if (ge instanceof wi || ge instanceof di || ge instanceof ki) for (var _e = 0, Oe = ge.uniformNames; _e < Oe.length; _e += 1) {
                var Xe = Oe[_e];
                if (B2[Xe]) {
                  var ht = ge.getBinding(M2, B2[Xe], Xe);
                  ee.push({ name: Xe, property: ie, binding: ht });
                }
              }
            }
            return ee;
          }, to.prototype.setUniforms = function(M2, B2, ee, ie) {
            for (var ge = 0, _e = B2; ge < _e.length; ge += 1) {
              var Oe = _e[ge], Xe = Oe.name, ht = Oe.property, Tt = Oe.binding;
              this.binders[ht].setUniform(Tt, ie, ee.get(ht), Xe);
            }
          }, to.prototype.updatePaintBuffers = function(M2) {
            for (var B2 in this._buffers = [], this.binders) {
              var ee = this.binders[B2];
              if (M2 && ee instanceof Wi) {
                var ie = M2.fromScale === 2 ? ee.zoomInPaintVertexBuffer : ee.zoomOutPaintVertexBuffer;
                ie && this._buffers.push(ie);
              } else (ee instanceof ji || ee instanceof ki) && ee.paintVertexBuffer && this._buffers.push(ee.paintVertexBuffer);
            }
          }, to.prototype.upload = function(M2) {
            for (var B2 in this.binders) {
              var ee = this.binders[B2];
              (ee instanceof ji || ee instanceof ki || ee instanceof Wi) && ee.upload(M2);
            }
            this.updatePaintBuffers();
          }, to.prototype.destroy = function() {
            for (var M2 in this.binders) {
              var B2 = this.binders[M2];
              (B2 instanceof ji || B2 instanceof ki || B2 instanceof Wi) && B2.destroy();
            }
          };
          var as = function(M2, B2, ee, ie) {
            ie === void 0 && (ie = function() {
              return true;
            }), this.programConfigurations = {};
            for (var ge = 0, _e = B2; ge < _e.length; ge += 1) {
              var Oe = _e[ge];
              this.programConfigurations[Oe.id] = new to(Oe, ee, ie, M2);
            }
            this.needsUpload = false, this._featureMap = new yn(), this._bufferOffset = 0;
          };
          function js(M2, B2) {
            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"] }[M2] || [M2.replace(B2 + "-", "").replace(/-/g, "_")];
          }
          function Ws(M2, B2, ee) {
            var ie = { color: { source: oe, composite: de }, number: { source: fe, composite: oe } }, ge = function(_e) {
              return { "line-pattern": { source: Zh, composite: Zh }, "fill-pattern": { source: Zh, composite: Zh }, "fill-extrusion-pattern": { source: Zh, composite: Zh } }[_e];
            }(M2);
            return ge && ge[ee] || ie[B2][ee];
          }
          as.prototype.populatePaintArrays = function(M2, B2, ee, ie, ge, _e) {
            for (var Oe in this.programConfigurations) this.programConfigurations[Oe].populatePaintArrays(M2, B2, ie, ge, _e);
            B2.id !== void 0 && this._featureMap.add(B2.id, ee, this._bufferOffset, M2), this._bufferOffset = M2, this.needsUpload = true;
          }, as.prototype.updatePaintArrays = function(M2, B2, ee, ie) {
            for (var ge = 0, _e = ee; ge < _e.length; ge += 1) {
              var Oe = _e[ge];
              this.needsUpload = this.programConfigurations[Oe.id].updatePaintArrays(M2, this._featureMap, B2, Oe, ie) || this.needsUpload;
            }
          }, as.prototype.get = function(M2) {
            return this.programConfigurations[M2];
          }, as.prototype.upload = function(M2) {
            if (this.needsUpload) {
              for (var B2 in this.programConfigurations) this.programConfigurations[B2].upload(M2);
              this.needsUpload = false;
            }
          }, as.prototype.destroy = function() {
            for (var M2 in this.programConfigurations) this.programConfigurations[M2].destroy();
          }, mn("ConstantBinder", wi), mn("CrossFadedConstantBinder", di), mn("SourceExpressionBinder", ji), mn("CrossFadedCompositeBinder", Wi), mn("CompositeExpressionBinder", ki), mn("ProgramConfiguration", to, { omit: ["_buffers"] }), mn("ProgramConfigurationSet", as);
          var Qo, Cs = (Qo = 15, { min: -1 * Math.pow(2, Qo - 1), max: Math.pow(2, Qo - 1) - 1 });
          function us(M2) {
            for (var B2 = 8192 / M2.extent, ee = M2.loadGeometry(), ie = 0; ie < ee.length; ie++) for (var ge = ee[ie], _e = 0; _e < ge.length; _e++) {
              var Oe = ge[_e];
              Oe.x = Math.round(Oe.x * B2), Oe.y = Math.round(Oe.y * B2), (Oe.x < Cs.min || Oe.x > Cs.max || Oe.y < Cs.min || Oe.y > Cs.max) && (E2("Geometry exceeds allowed extent, reduce your vector tile buffer size"), Oe.x = v(Oe.x, Cs.min, Cs.max), Oe.y = v(Oe.y, Cs.min, Cs.max));
            }
            return ee;
          }
          function ku(M2, B2, ee, ie, ge) {
            M2.emplaceBack(2 * B2 + (ie + 1) / 2, 2 * ee + (ge + 1) / 2);
          }
          var El = function(M2) {
            this.zoom = M2.zoom, this.overscaling = M2.overscaling, this.layers = M2.layers, this.layerIds = this.layers.map(function(B2) {
              return B2.id;
            }), this.index = M2.index, this.hasPattern = false, this.layoutVertexArray = new Xf(), this.indexArray = new Ql(), this.segments = new qt(), this.programConfigurations = new as(Mt, M2.layers, M2.zoom), this.stateDependentLayerIds = this.layers.filter(function(B2) {
              return B2.isStateDependent();
            }).map(function(B2) {
              return B2.id;
            });
          };
          function _c(M2, B2) {
            for (var ee = 0; ee < M2.length; ee++) if (Df(B2, M2[ee])) return true;
            for (var ie = 0; ie < B2.length; ie++) if (Df(M2, B2[ie])) return true;
            return !!ev(M2, B2);
          }
          function Jh(M2, B2, ee) {
            return !!Df(M2, B2) || !!Tu(B2, M2, ee);
          }
          function Id(M2, B2) {
            if (M2.length === 1) return dm(B2, M2[0]);
            for (var ee = 0; ee < B2.length; ee++) for (var ie = B2[ee], ge = 0; ge < ie.length; ge++) if (Df(M2, ie[ge])) return true;
            for (var _e = 0; _e < M2.length; _e++) if (dm(B2, M2[_e])) return true;
            for (var Oe = 0; Oe < B2.length; Oe++) if (ev(M2, B2[Oe])) return true;
            return false;
          }
          function pm(M2, B2, ee) {
            if (M2.length > 1) {
              if (ev(M2, B2)) return true;
              for (var ie = 0; ie < B2.length; ie++) if (Tu(B2[ie], M2, ee)) return true;
            }
            for (var ge = 0; ge < M2.length; ge++) if (Tu(M2[ge], B2, ee)) return true;
            return false;
          }
          function ev(M2, B2) {
            if (M2.length === 0 || B2.length === 0) return false;
            for (var ee = 0; ee < M2.length - 1; ee++) for (var ie = M2[ee], ge = M2[ee + 1], _e = 0; _e < B2.length - 1; _e++) if (tv(ie, ge, B2[_e], B2[_e + 1])) return true;
            return false;
          }
          function tv(M2, B2, ee, ie) {
            return F13(M2, ee, ie) !== F13(B2, ee, ie) && F13(M2, B2, ee) !== F13(M2, B2, ie);
          }
          function Tu(M2, B2, ee) {
            var ie = ee * ee;
            if (B2.length === 1) return M2.distSqr(B2[0]) < ie;
            for (var ge = 1; ge < B2.length; ge++) if (u0(M2, B2[ge - 1], B2[ge]) < ie) return true;
            return false;
          }
          function u0(M2, B2, ee) {
            var ie = B2.distSqr(ee);
            if (ie === 0) return M2.distSqr(B2);
            var ge = ((M2.x - B2.x) * (ee.x - B2.x) + (M2.y - B2.y) * (ee.y - B2.y)) / ie;
            return ge < 0 ? M2.distSqr(B2) : ge > 1 ? M2.distSqr(ee) : M2.distSqr(ee.sub(B2)._mult(ge)._add(B2));
          }
          function dm(M2, B2) {
            for (var ee, ie, ge, _e = false, Oe = 0; Oe < M2.length; Oe++) for (var Xe = 0, ht = (ee = M2[Oe]).length - 1; Xe < ee.length; ht = Xe++) ie = ee[Xe], ge = ee[ht], ie.y > B2.y != ge.y > B2.y && B2.x < (ge.x - ie.x) * (B2.y - ie.y) / (ge.y - ie.y) + ie.x && (_e = !_e);
            return _e;
          }
          function Df(M2, B2) {
            for (var ee = false, ie = 0, ge = M2.length - 1; ie < M2.length; ge = ie++) {
              var _e = M2[ie], Oe = M2[ge];
              _e.y > B2.y != Oe.y > B2.y && B2.x < (Oe.x - _e.x) * (B2.y - _e.y) / (Oe.y - _e.y) + _e.x && (ee = !ee);
            }
            return ee;
          }
          function vm(M2, B2, ee) {
            var ie = ee[0], ge = ee[2];
            if (M2.x < ie.x && B2.x < ie.x || M2.x > ge.x && B2.x > ge.x || M2.y < ie.y && B2.y < ie.y || M2.y > ge.y && B2.y > ge.y) return false;
            var _e = F13(M2, B2, ee[0]);
            return _e !== F13(M2, B2, ee[1]) || _e !== F13(M2, B2, ee[2]) || _e !== F13(M2, B2, ee[3]);
          }
          function Ms(M2, B2, ee) {
            var ie = B2.paint.get(M2).value;
            return ie.kind === "constant" ? ie.value : ee.programConfigurations.get(B2.id).getMaxValue(M2);
          }
          function oc(M2) {
            return Math.sqrt(M2[0] * M2[0] + M2[1] * M2[1]);
          }
          function sc(M2, B2, ee, ie, ge) {
            if (!B2[0] && !B2[1]) return M2;
            var _e = f.convert(B2)._mult(ge);
            ee === "viewport" && _e._rotate(-ie);
            for (var Oe = [], Xe = 0; Xe < M2.length; Xe++) {
              var ht = M2[Xe];
              Oe.push(ht.sub(_e));
            }
            return Oe;
          }
          El.prototype.populate = function(M2, B2, ee) {
            var ie = this.layers[0], ge = [], _e = null;
            ie.type === "circle" && (_e = ie.layout.get("circle-sort-key"));
            for (var Oe = 0, Xe = M2; Oe < Xe.length; Oe += 1) {
              var ht = Xe[Oe], Tt = ht.feature, Dt = ht.id, Xt = ht.index, ar = ht.sourceLayerIndex, er = this.layers[0]._featureFilter.needGeometry, hr = { type: Tt.type, id: Dt, properties: Tt.properties, geometry: er ? us(Tt) : [] };
              if (this.layers[0]._featureFilter.filter(new Oo(this.zoom), hr, ee)) {
                er || (hr.geometry = us(Tt));
                var Sr = _e ? _e.evaluate(hr, {}, ee) : void 0, Ur = { id: Dt, properties: Tt.properties, type: Tt.type, sourceLayerIndex: ar, index: Xt, geometry: hr.geometry, patterns: {}, sortKey: Sr };
                ge.push(Ur);
              }
            }
            _e && ge.sort(function(wa, Wa) {
              return wa.sortKey - Wa.sortKey;
            });
            for (var Br = 0, rn = ge; Br < rn.length; Br += 1) {
              var nn = rn[Br], cn = nn, In = cn.geometry, Un = cn.index, ha = cn.sourceLayerIndex, fa = M2[Un].feature;
              this.addFeature(nn, In, Un, ee), B2.featureIndex.insert(fa, In, Un, ha, this.index);
            }
          }, El.prototype.update = function(M2, B2, ee) {
            this.stateDependentLayers.length && this.programConfigurations.updatePaintArrays(M2, B2, this.stateDependentLayers, ee);
          }, El.prototype.isEmpty = function() {
            return this.layoutVertexArray.length === 0;
          }, El.prototype.uploadPending = function() {
            return !this.uploaded || this.programConfigurations.needsUpload;
          }, El.prototype.upload = function(M2) {
            this.uploaded || (this.layoutVertexBuffer = M2.createVertexBuffer(this.layoutVertexArray, Mt), this.indexBuffer = M2.createIndexBuffer(this.indexArray)), this.programConfigurations.upload(M2), this.uploaded = true;
          }, El.prototype.destroy = function() {
            this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy());
          }, El.prototype.addFeature = function(M2, B2, ee, ie) {
            for (var ge = 0, _e = B2; ge < _e.length; ge += 1) for (var Oe = 0, Xe = _e[ge]; Oe < Xe.length; Oe += 1) {
              var ht = Xe[Oe], Tt = ht.x, Dt = ht.y;
              if (!(Tt < 0 || Tt >= 8192 || Dt < 0 || Dt >= 8192)) {
                var Xt = this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray, M2.sortKey), ar = Xt.vertexLength;
                ku(this.layoutVertexArray, Tt, Dt, -1, -1), ku(this.layoutVertexArray, Tt, Dt, 1, -1), ku(this.layoutVertexArray, Tt, Dt, 1, 1), ku(this.layoutVertexArray, Tt, Dt, -1, 1), this.indexArray.emplaceBack(ar, ar + 1, ar + 2), this.indexArray.emplaceBack(ar, ar + 3, ar + 2), Xt.vertexLength += 4, Xt.primitiveLength += 2;
              }
            }
            this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, M2, ee, {}, ie);
          }, mn("CircleBucket", El, { omit: ["layers"] });
          var y1 = new ic({ "circle-sort-key": new yi(Ve.layout_circle["circle-sort-key"]) }), lE = { paint: new ic({ "circle-radius": new yi(Ve.paint_circle["circle-radius"]), "circle-color": new yi(Ve.paint_circle["circle-color"]), "circle-blur": new yi(Ve.paint_circle["circle-blur"]), "circle-opacity": new yi(Ve.paint_circle["circle-opacity"]), "circle-translate": new Ya(Ve.paint_circle["circle-translate"]), "circle-translate-anchor": new Ya(Ve.paint_circle["circle-translate-anchor"]), "circle-pitch-scale": new Ya(Ve.paint_circle["circle-pitch-scale"]), "circle-pitch-alignment": new Ya(Ve.paint_circle["circle-pitch-alignment"]), "circle-stroke-width": new yi(Ve.paint_circle["circle-stroke-width"]), "circle-stroke-color": new yi(Ve.paint_circle["circle-stroke-color"]), "circle-stroke-opacity": new yi(Ve.paint_circle["circle-stroke-opacity"]) }), layout: y1 }, Qc = typeof Float32Array < "u" ? Float32Array : Array;
          function rb(M2) {
            return M2[0] = 1, M2[1] = 0, M2[2] = 0, M2[3] = 0, M2[4] = 0, M2[5] = 1, M2[6] = 0, M2[7] = 0, M2[8] = 0, M2[9] = 0, M2[10] = 1, M2[11] = 0, M2[12] = 0, M2[13] = 0, M2[14] = 0, M2[15] = 1, M2;
          }
          function mm(M2, B2, ee) {
            var ie = B2[0], ge = B2[1], _e = B2[2], Oe = B2[3], Xe = B2[4], ht = B2[5], Tt = B2[6], Dt = B2[7], Xt = B2[8], ar = B2[9], er = B2[10], hr = B2[11], Sr = B2[12], Ur = B2[13], Br = B2[14], rn = B2[15], nn = ee[0], cn = ee[1], In = ee[2], Un = ee[3];
            return M2[0] = nn * ie + cn * Xe + In * Xt + Un * Sr, M2[1] = nn * ge + cn * ht + In * ar + Un * Ur, M2[2] = nn * _e + cn * Tt + In * er + Un * Br, M2[3] = nn * Oe + cn * Dt + In * hr + Un * rn, nn = ee[4], cn = ee[5], In = ee[6], Un = ee[7], M2[4] = nn * ie + cn * Xe + In * Xt + Un * Sr, M2[5] = nn * ge + cn * ht + In * ar + Un * Ur, M2[6] = nn * _e + cn * Tt + In * er + Un * Br, M2[7] = nn * Oe + cn * Dt + In * hr + Un * rn, nn = ee[8], cn = ee[9], In = ee[10], Un = ee[11], M2[8] = nn * ie + cn * Xe + In * Xt + Un * Sr, M2[9] = nn * ge + cn * ht + In * ar + Un * Ur, M2[10] = nn * _e + cn * Tt + In * er + Un * Br, M2[11] = nn * Oe + cn * Dt + In * hr + Un * rn, nn = ee[12], cn = ee[13], In = ee[14], Un = ee[15], M2[12] = nn * ie + cn * Xe + In * Xt + Un * Sr, M2[13] = nn * ge + cn * ht + In * ar + Un * Ur, M2[14] = nn * _e + cn * Tt + In * er + Un * Br, M2[15] = nn * Oe + cn * Dt + In * hr + Un * rn, M2;
          }
          Math.hypot || (Math.hypot = function() {
            for (var M2 = arguments, B2 = 0, ee = arguments.length; ee--; ) B2 += M2[ee] * M2[ee];
            return Math.sqrt(B2);
          });
          var uE = mm, Nd, cE, fE = function(M2, B2, ee) {
            return M2[0] = B2[0] - ee[0], M2[1] = B2[1] - ee[1], M2[2] = B2[2] - ee[2], M2;
          };
          Nd = new Qc(3), Qc != Float32Array && (Nd[0] = 0, Nd[1] = 0, Nd[2] = 0), cE = Nd;
          function rv(M2, B2, ee) {
            var ie = B2[0], ge = B2[1], _e = B2[2], Oe = B2[3];
            return M2[0] = ee[0] * ie + ee[4] * ge + ee[8] * _e + ee[12] * Oe, M2[1] = ee[1] * ie + ee[5] * ge + ee[9] * _e + ee[13] * Oe, M2[2] = ee[2] * ie + ee[6] * ge + ee[10] * _e + ee[14] * Oe, M2[3] = ee[3] * ie + ee[7] * ge + ee[11] * _e + ee[15] * Oe, M2;
          }
          (function() {
            var M2 = function() {
              var B2 = new Qc(4);
              return Qc != Float32Array && (B2[0] = 0, B2[1] = 0, B2[2] = 0, B2[3] = 0), B2;
            }();
          })();
          var wie = function(M2) {
            var B2 = M2[0], ee = M2[1];
            return B2 * B2 + ee * ee;
          }, kie = (function() {
            var M2 = function() {
              var B2 = new Qc(2);
              return Qc != Float32Array && (B2[0] = 0, B2[1] = 0), B2;
            }();
          }(), function(M2) {
            function B2(ee) {
              M2.call(this, ee, lE);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype.createBucket = function(ee) {
              return new El(ee);
            }, B2.prototype.queryRadius = function(ee) {
              var ie = ee;
              return Ms("circle-radius", this, ie) + Ms("circle-stroke-width", this, ie) + oc(this.paint.get("circle-translate"));
            }, B2.prototype.queryIntersectsFeature = function(ee, ie, ge, _e, Oe, Xe, ht, Tt) {
              for (var Dt = sc(ee, this.paint.get("circle-translate"), this.paint.get("circle-translate-anchor"), Xe.angle, ht), Xt = this.paint.get("circle-radius").evaluate(ie, ge) + this.paint.get("circle-stroke-width").evaluate(ie, ge), ar = this.paint.get("circle-pitch-alignment") === "map", er = ar ? Dt : function(ha, fa) {
                return ha.map(function(wa) {
                  return MO(wa, fa);
                });
              }(Dt, Tt), hr = ar ? Xt * ht : Xt, Sr = 0, Ur = _e; Sr < Ur.length; Sr += 1) for (var Br = 0, rn = Ur[Sr]; Br < rn.length; Br += 1) {
                var nn = rn[Br], cn = ar ? nn : MO(nn, Tt), In = hr, Un = rv([], [nn.x, nn.y, 0, 1], Tt);
                if (this.paint.get("circle-pitch-scale") === "viewport" && this.paint.get("circle-pitch-alignment") === "map" ? In *= Un[3] / Xe.cameraToCenterDistance : this.paint.get("circle-pitch-scale") === "map" && this.paint.get("circle-pitch-alignment") === "viewport" && (In *= Xe.cameraToCenterDistance / Un[3]), Jh(er, cn, In)) return true;
              }
              return false;
            }, B2;
          }(Vc));
          function MO(M2, B2) {
            var ee = rv([], [M2.x, M2.y, 0, 1], B2);
            return new f(ee[0] / ee[3], ee[1] / ee[3]);
          }
          var IO = function(M2) {
            function B2() {
              M2.apply(this, arguments);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2;
          }(El);
          function hE(M2, B2, ee, ie) {
            var ge = B2.width, _e = B2.height;
            if (ie) {
              if (ie instanceof Uint8ClampedArray) ie = new Uint8Array(ie.buffer);
              else if (ie.length !== ge * _e * ee) throw new RangeError("mismatched image size");
            } else ie = new Uint8Array(ge * _e * ee);
            return M2.width = ge, M2.height = _e, M2.data = ie, M2;
          }
          function NO(M2, B2, ee) {
            var ie = B2.width, ge = B2.height;
            if (ie !== M2.width || ge !== M2.height) {
              var _e = hE({}, { width: ie, height: ge }, ee);
              pE(M2, _e, { x: 0, y: 0 }, { x: 0, y: 0 }, { width: Math.min(M2.width, ie), height: Math.min(M2.height, ge) }, ee), M2.width = ie, M2.height = ge, M2.data = _e.data;
            }
          }
          function pE(M2, B2, ee, ie, ge, _e) {
            if (ge.width === 0 || ge.height === 0) return B2;
            if (ge.width > M2.width || ge.height > M2.height || ee.x > M2.width - ge.width || ee.y > M2.height - ge.height) throw new RangeError("out of range source coordinates for image copy");
            if (ge.width > B2.width || ge.height > B2.height || ie.x > B2.width - ge.width || ie.y > B2.height - ge.height) throw new RangeError("out of range destination coordinates for image copy");
            for (var Oe = M2.data, Xe = B2.data, ht = 0; ht < ge.height; ht++) for (var Tt = ((ee.y + ht) * M2.width + ee.x) * _e, Dt = ((ie.y + ht) * B2.width + ie.x) * _e, Xt = 0; Xt < ge.width * _e; Xt++) Xe[Dt + Xt] = Oe[Tt + Xt];
            return B2;
          }
          mn("HeatmapBucket", IO, { omit: ["layers"] });
          var gm = function(M2, B2) {
            hE(this, M2, 1, B2);
          };
          gm.prototype.resize = function(M2) {
            NO(this, M2, 1);
          }, gm.prototype.clone = function() {
            return new gm({ width: this.width, height: this.height }, new Uint8Array(this.data));
          }, gm.copy = function(M2, B2, ee, ie, ge) {
            pE(M2, B2, ee, ie, ge, 1);
          };
          var ef = function(M2, B2) {
            hE(this, M2, 4, B2);
          };
          ef.prototype.resize = function(M2) {
            NO(this, M2, 4);
          }, ef.prototype.replace = function(M2, B2) {
            B2 ? this.data.set(M2) : M2 instanceof Uint8ClampedArray ? this.data = new Uint8Array(M2.buffer) : this.data = M2;
          }, ef.prototype.clone = function() {
            return new ef({ width: this.width, height: this.height }, new Uint8Array(this.data));
          }, ef.copy = function(M2, B2, ee, ie, ge) {
            pE(M2, B2, ee, ie, ge, 4);
          }, mn("AlphaImage", gm), mn("RGBAImage", ef);
          var Tie = { paint: new ic({ "heatmap-radius": new yi(Ve.paint_heatmap["heatmap-radius"]), "heatmap-weight": new yi(Ve.paint_heatmap["heatmap-weight"]), "heatmap-intensity": new Ya(Ve.paint_heatmap["heatmap-intensity"]), "heatmap-color": new Ef(Ve.paint_heatmap["heatmap-color"]), "heatmap-opacity": new Ya(Ve.paint_heatmap["heatmap-opacity"]) }) };
          function FO(M2, B2) {
            for (var ee = new Uint8Array(1024), ie = {}, ge = 0, _e = 0; ge < 256; ge++, _e += 4) {
              ie[B2] = ge / 255;
              var Oe = M2.evaluate(ie);
              ee[_e + 0] = Math.floor(255 * Oe.r / Oe.a), ee[_e + 1] = Math.floor(255 * Oe.g / Oe.a), ee[_e + 2] = Math.floor(255 * Oe.b / Oe.a), ee[_e + 3] = Math.floor(255 * Oe.a);
            }
            return new ef({ width: 256, height: 1 }, ee);
          }
          var Aie = function(M2) {
            function B2(ee) {
              M2.call(this, ee, Tie), this._updateColorRamp();
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype.createBucket = function(ee) {
              return new IO(ee);
            }, B2.prototype._handleSpecialPaintPropertyUpdate = function(ee) {
              ee === "heatmap-color" && this._updateColorRamp();
            }, B2.prototype._updateColorRamp = function() {
              var ee = this._transitionablePaint._values["heatmap-color"].value.expression;
              this.colorRamp = FO(ee, "heatmapDensity"), this.colorRampTexture = null;
            }, B2.prototype.resize = function() {
              this.heatmapFbo && (this.heatmapFbo.destroy(), this.heatmapFbo = null);
            }, B2.prototype.queryRadius = function() {
              return 0;
            }, B2.prototype.queryIntersectsFeature = function() {
              return false;
            }, B2.prototype.hasOffscreenPass = function() {
              return this.paint.get("heatmap-opacity") !== 0 && this.visibility !== "none";
            }, B2;
          }(Vc), Sie = { paint: new ic({ "hillshade-illumination-direction": new Ya(Ve.paint_hillshade["hillshade-illumination-direction"]), "hillshade-illumination-anchor": new Ya(Ve.paint_hillshade["hillshade-illumination-anchor"]), "hillshade-exaggeration": new Ya(Ve.paint_hillshade["hillshade-exaggeration"]), "hillshade-shadow-color": new Ya(Ve.paint_hillshade["hillshade-shadow-color"]), "hillshade-highlight-color": new Ya(Ve.paint_hillshade["hillshade-highlight-color"]), "hillshade-accent-color": new Ya(Ve.paint_hillshade["hillshade-accent-color"]) }) }, Eie = function(M2) {
            function B2(ee) {
              M2.call(this, ee, Sie);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype.hasOffscreenPass = function() {
              return this.paint.get("hillshade-exaggeration") !== 0 && this.visibility !== "none";
            }, B2;
          }(Vc), OO = Po([{ name: "a_pos", components: 2, type: "Int16" }], 4).members, dE = xw, Die = xw;
          function xw(M2, B2, ee) {
            ee = ee || 2;
            var ie, ge, _e, Oe, Xe, ht, Tt, Dt = B2 && B2.length, Xt = Dt ? B2[0] * ee : M2.length, ar = PO(M2, 0, Xt, ee, true), er = [];
            if (!ar || ar.next === ar.prev) return er;
            if (Dt && (ar = function(Sr, Ur, Br, rn) {
              var nn, cn, In, Un, ha, fa = [];
              for (nn = 0, cn = Ur.length; nn < cn; nn++) In = Ur[nn] * rn, Un = nn < cn - 1 ? Ur[nn + 1] * rn : Sr.length, (ha = PO(Sr, In, Un, rn, false)) === ha.next && (ha.steiner = true), fa.push(Lie(ha));
              for (fa.sort(Fie), nn = 0; nn < fa.length; nn++) Oie(fa[nn], Br), Br = nv(Br, Br.next);
              return Br;
            }(M2, B2, ar, ee)), M2.length > 80 * ee) {
              ie = _e = M2[0], ge = Oe = M2[1];
              for (var hr = ee; hr < Xt; hr += ee) (Xe = M2[hr]) < ie && (ie = Xe), (ht = M2[hr + 1]) < ge && (ge = ht), Xe > _e && (_e = Xe), ht > Oe && (Oe = ht);
              Tt = (Tt = Math.max(_e - ie, Oe - ge)) !== 0 ? 1 / Tt : 0;
            }
            return nb(ar, er, ee, ie, ge, Tt), er;
          }
          function PO(M2, B2, ee, ie, ge) {
            var _e, Oe;
            if (ge === gE(M2, B2, ee, ie) > 0) for (_e = B2; _e < ee; _e += ie) Oe = zO(_e, M2[_e], M2[_e + 1], Oe);
            else for (_e = ee - ie; _e >= B2; _e -= ie) Oe = zO(_e, M2[_e], M2[_e + 1], Oe);
            return Oe && bw(Oe, Oe.next) && (ib(Oe), Oe = Oe.next), Oe;
          }
          function nv(M2, B2) {
            if (!M2) return M2;
            B2 || (B2 = M2);
            var ee, ie = M2;
            do
              if (ee = false, ie.steiner || !bw(ie, ie.next) && eu(ie.prev, ie, ie.next) !== 0) ie = ie.next;
              else {
                if (ib(ie), (ie = B2 = ie.prev) === ie.next) break;
                ee = true;
              }
            while (ee || ie !== B2);
            return B2;
          }
          function nb(M2, B2, ee, ie, ge, _e, Oe) {
            if (M2) {
              !Oe && _e && function(Dt, Xt, ar, er) {
                var hr = Dt;
                do
                  hr.z === null && (hr.z = vE(hr.x, hr.y, Xt, ar, er)), hr.prevZ = hr.prev, hr.nextZ = hr.next, hr = hr.next;
                while (hr !== Dt);
                hr.prevZ.nextZ = null, hr.prevZ = null, function(Sr) {
                  var Ur, Br, rn, nn, cn, In, Un, ha, fa = 1;
                  do {
                    for (Br = Sr, Sr = null, cn = null, In = 0; Br; ) {
                      for (In++, rn = Br, Un = 0, Ur = 0; Ur < fa && (Un++, rn = rn.nextZ); Ur++) ;
                      for (ha = fa; Un > 0 || ha > 0 && rn; ) Un !== 0 && (ha === 0 || !rn || Br.z <= rn.z) ? (nn = Br, Br = Br.nextZ, Un--) : (nn = rn, rn = rn.nextZ, ha--), cn ? cn.nextZ = nn : Sr = nn, nn.prevZ = cn, cn = nn;
                      Br = rn;
                    }
                    cn.nextZ = null, fa *= 2;
                  } while (In > 1);
                }(hr);
              }(M2, ie, ge, _e);
              for (var Xe, ht, Tt = M2; M2.prev !== M2.next; ) if (Xe = M2.prev, ht = M2.next, _e ? Mie(M2, ie, ge, _e) : Cie(M2)) B2.push(Xe.i / ee), B2.push(M2.i / ee), B2.push(ht.i / ee), ib(M2), M2 = ht.next, Tt = ht.next;
              else if ((M2 = ht) === Tt) {
                Oe ? Oe === 1 ? nb(M2 = Iie(nv(M2), B2, ee), B2, ee, ie, ge, _e, 2) : Oe === 2 && Nie(M2, B2, ee, ie, ge, _e) : nb(nv(M2), B2, ee, ie, ge, _e, 1);
                break;
              }
            }
          }
          function Cie(M2) {
            var B2 = M2.prev, ee = M2, ie = M2.next;
            if (eu(B2, ee, ie) >= 0) return false;
            for (var ge = M2.next.next; ge !== M2.prev; ) {
              if (x1(B2.x, B2.y, ee.x, ee.y, ie.x, ie.y, ge.x, ge.y) && eu(ge.prev, ge, ge.next) >= 0) return false;
              ge = ge.next;
            }
            return true;
          }
          function Mie(M2, B2, ee, ie) {
            var ge = M2.prev, _e = M2, Oe = M2.next;
            if (eu(ge, _e, Oe) >= 0) return false;
            for (var Xe = ge.x < _e.x ? ge.x < Oe.x ? ge.x : Oe.x : _e.x < Oe.x ? _e.x : Oe.x, ht = ge.y < _e.y ? ge.y < Oe.y ? ge.y : Oe.y : _e.y < Oe.y ? _e.y : Oe.y, Tt = ge.x > _e.x ? ge.x > Oe.x ? ge.x : Oe.x : _e.x > Oe.x ? _e.x : Oe.x, Dt = ge.y > _e.y ? ge.y > Oe.y ? ge.y : Oe.y : _e.y > Oe.y ? _e.y : Oe.y, Xt = vE(Xe, ht, B2, ee, ie), ar = vE(Tt, Dt, B2, ee, ie), er = M2.prevZ, hr = M2.nextZ; er && er.z >= Xt && hr && hr.z <= ar; ) {
              if (er !== M2.prev && er !== M2.next && x1(ge.x, ge.y, _e.x, _e.y, Oe.x, Oe.y, er.x, er.y) && eu(er.prev, er, er.next) >= 0 || (er = er.prevZ, hr !== M2.prev && hr !== M2.next && x1(ge.x, ge.y, _e.x, _e.y, Oe.x, Oe.y, hr.x, hr.y) && eu(hr.prev, hr, hr.next) >= 0)) return false;
              hr = hr.nextZ;
            }
            for (; er && er.z >= Xt; ) {
              if (er !== M2.prev && er !== M2.next && x1(ge.x, ge.y, _e.x, _e.y, Oe.x, Oe.y, er.x, er.y) && eu(er.prev, er, er.next) >= 0) return false;
              er = er.prevZ;
            }
            for (; hr && hr.z <= ar; ) {
              if (hr !== M2.prev && hr !== M2.next && x1(ge.x, ge.y, _e.x, _e.y, Oe.x, Oe.y, hr.x, hr.y) && eu(hr.prev, hr, hr.next) >= 0) return false;
              hr = hr.nextZ;
            }
            return true;
          }
          function Iie(M2, B2, ee) {
            var ie = M2;
            do {
              var ge = ie.prev, _e = ie.next.next;
              !bw(ge, _e) && LO(ge, ie, ie.next, _e) && ab(ge, _e) && ab(_e, ge) && (B2.push(ge.i / ee), B2.push(ie.i / ee), B2.push(_e.i / ee), ib(ie), ib(ie.next), ie = M2 = _e), ie = ie.next;
            } while (ie !== M2);
            return nv(ie);
          }
          function Nie(M2, B2, ee, ie, ge, _e) {
            var Oe = M2;
            do {
              for (var Xe = Oe.next.next; Xe !== Oe.prev; ) {
                if (Oe.i !== Xe.i && Rie(Oe, Xe)) {
                  var ht = RO(Oe, Xe);
                  return Oe = nv(Oe, Oe.next), ht = nv(ht, ht.next), nb(Oe, B2, ee, ie, ge, _e), void nb(ht, B2, ee, ie, ge, _e);
                }
                Xe = Xe.next;
              }
              Oe = Oe.next;
            } while (Oe !== M2);
          }
          function Fie(M2, B2) {
            return M2.x - B2.x;
          }
          function Oie(M2, B2) {
            if (B2 = function(ie, ge) {
              var _e, Oe = ge, Xe = ie.x, ht = ie.y, Tt = -1 / 0;
              do {
                if (ht <= Oe.y && ht >= Oe.next.y && Oe.next.y !== Oe.y) {
                  var Dt = Oe.x + (ht - Oe.y) * (Oe.next.x - Oe.x) / (Oe.next.y - Oe.y);
                  if (Dt <= Xe && Dt > Tt) {
                    if (Tt = Dt, Dt === Xe) {
                      if (ht === Oe.y) return Oe;
                      if (ht === Oe.next.y) return Oe.next;
                    }
                    _e = Oe.x < Oe.next.x ? Oe : Oe.next;
                  }
                }
                Oe = Oe.next;
              } while (Oe !== ge);
              if (!_e) return null;
              if (Xe === Tt) return _e;
              var Xt, ar = _e, er = _e.x, hr = _e.y, Sr = 1 / 0;
              Oe = _e;
              do
                Xe >= Oe.x && Oe.x >= er && Xe !== Oe.x && x1(ht < hr ? Xe : Tt, ht, er, hr, ht < hr ? Tt : Xe, ht, Oe.x, Oe.y) && (Xt = Math.abs(ht - Oe.y) / (Xe - Oe.x), ab(Oe, ie) && (Xt < Sr || Xt === Sr && (Oe.x > _e.x || Oe.x === _e.x && Pie(_e, Oe))) && (_e = Oe, Sr = Xt)), Oe = Oe.next;
              while (Oe !== ar);
              return _e;
            }(M2, B2)) {
              var ee = RO(B2, M2);
              nv(B2, B2.next), nv(ee, ee.next);
            }
          }
          function Pie(M2, B2) {
            return eu(M2.prev, M2, B2.prev) < 0 && eu(B2.next, M2, M2.next) < 0;
          }
          function vE(M2, B2, ee, ie, ge) {
            return (M2 = 1431655765 & ((M2 = 858993459 & ((M2 = 252645135 & ((M2 = 16711935 & ((M2 = 32767 * (M2 - ee) * ge) | M2 << 8)) | M2 << 4)) | M2 << 2)) | M2 << 1)) | (B2 = 1431655765 & ((B2 = 858993459 & ((B2 = 252645135 & ((B2 = 16711935 & ((B2 = 32767 * (B2 - ie) * ge) | B2 << 8)) | B2 << 4)) | B2 << 2)) | B2 << 1)) << 1;
          }
          function Lie(M2) {
            var B2 = M2, ee = M2;
            do
              (B2.x < ee.x || B2.x === ee.x && B2.y < ee.y) && (ee = B2), B2 = B2.next;
            while (B2 !== M2);
            return ee;
          }
          function x1(M2, B2, ee, ie, ge, _e, Oe, Xe) {
            return (ge - Oe) * (B2 - Xe) - (M2 - Oe) * (_e - Xe) >= 0 && (M2 - Oe) * (ie - Xe) - (ee - Oe) * (B2 - Xe) >= 0 && (ee - Oe) * (_e - Xe) - (ge - Oe) * (ie - Xe) >= 0;
          }
          function Rie(M2, B2) {
            return M2.next.i !== B2.i && M2.prev.i !== B2.i && !function(ee, ie) {
              var ge = ee;
              do {
                if (ge.i !== ee.i && ge.next.i !== ee.i && ge.i !== ie.i && ge.next.i !== ie.i && LO(ge, ge.next, ee, ie)) return true;
                ge = ge.next;
              } while (ge !== ee);
              return false;
            }(M2, B2) && (ab(M2, B2) && ab(B2, M2) && function(ee, ie) {
              var ge = ee, _e = false, Oe = (ee.x + ie.x) / 2, Xe = (ee.y + ie.y) / 2;
              do
                ge.y > Xe != ge.next.y > Xe && ge.next.y !== ge.y && Oe < (ge.next.x - ge.x) * (Xe - ge.y) / (ge.next.y - ge.y) + ge.x && (_e = !_e), ge = ge.next;
              while (ge !== ee);
              return _e;
            }(M2, B2) && (eu(M2.prev, M2, B2.prev) || eu(M2, B2.prev, B2)) || bw(M2, B2) && eu(M2.prev, M2, M2.next) > 0 && eu(B2.prev, B2, B2.next) > 0);
          }
          function eu(M2, B2, ee) {
            return (B2.y - M2.y) * (ee.x - B2.x) - (B2.x - M2.x) * (ee.y - B2.y);
          }
          function bw(M2, B2) {
            return M2.x === B2.x && M2.y === B2.y;
          }
          function LO(M2, B2, ee, ie) {
            var ge = ww(eu(M2, B2, ee)), _e = ww(eu(M2, B2, ie)), Oe = ww(eu(ee, ie, M2)), Xe = ww(eu(ee, ie, B2));
            return ge !== _e && Oe !== Xe || !(ge !== 0 || !_w(M2, ee, B2)) || !(_e !== 0 || !_w(M2, ie, B2)) || !(Oe !== 0 || !_w(ee, M2, ie)) || !(Xe !== 0 || !_w(ee, B2, ie));
          }
          function _w(M2, B2, ee) {
            return B2.x <= Math.max(M2.x, ee.x) && B2.x >= Math.min(M2.x, ee.x) && B2.y <= Math.max(M2.y, ee.y) && B2.y >= Math.min(M2.y, ee.y);
          }
          function ww(M2) {
            return M2 > 0 ? 1 : M2 < 0 ? -1 : 0;
          }
          function ab(M2, B2) {
            return eu(M2.prev, M2, M2.next) < 0 ? eu(M2, B2, M2.next) >= 0 && eu(M2, M2.prev, B2) >= 0 : eu(M2, B2, M2.prev) < 0 || eu(M2, M2.next, B2) < 0;
          }
          function RO(M2, B2) {
            var ee = new mE(M2.i, M2.x, M2.y), ie = new mE(B2.i, B2.x, B2.y), ge = M2.next, _e = B2.prev;
            return M2.next = B2, B2.prev = M2, ee.next = ge, ge.prev = ee, ie.next = ee, ee.prev = ie, _e.next = ie, ie.prev = _e, ie;
          }
          function zO(M2, B2, ee, ie) {
            var ge = new mE(M2, B2, ee);
            return ie ? (ge.next = ie.next, ge.prev = ie, ie.next.prev = ge, ie.next = ge) : (ge.prev = ge, ge.next = ge), ge;
          }
          function ib(M2) {
            M2.next.prev = M2.prev, M2.prev.next = M2.next, M2.prevZ && (M2.prevZ.nextZ = M2.nextZ), M2.nextZ && (M2.nextZ.prevZ = M2.prevZ);
          }
          function mE(M2, B2, ee) {
            this.i = M2, this.x = B2, this.y = ee, this.prev = null, this.next = null, this.z = null, this.prevZ = null, this.nextZ = null, this.steiner = false;
          }
          function gE(M2, B2, ee, ie) {
            for (var ge = 0, _e = B2, Oe = ee - ie; _e < ee; _e += ie) ge += (M2[Oe] - M2[_e]) * (M2[_e + 1] + M2[Oe + 1]), Oe = _e;
            return ge;
          }
          function zie(M2, B2, ee, ie, ge) {
            (function _e(Oe, Xe, ht, Tt, Dt) {
              for (; Tt > ht; ) {
                if (Tt - ht > 600) {
                  var Xt = Tt - ht + 1, ar = Xe - ht + 1, er = Math.log(Xt), hr = 0.5 * Math.exp(2 * er / 3), Sr = 0.5 * Math.sqrt(er * hr * (Xt - hr) / Xt) * (ar - Xt / 2 < 0 ? -1 : 1), Ur = Math.max(ht, Math.floor(Xe - ar * hr / Xt + Sr)), Br = Math.min(Tt, Math.floor(Xe + (Xt - ar) * hr / Xt + Sr));
                  _e(Oe, Xe, Ur, Br, Dt);
                }
                var rn = Oe[Xe], nn = ht, cn = Tt;
                for (ob(Oe, ht, Xe), Dt(Oe[Tt], rn) > 0 && ob(Oe, ht, Tt); nn < cn; ) {
                  for (ob(Oe, nn, cn), nn++, cn--; Dt(Oe[nn], rn) < 0; ) nn++;
                  for (; Dt(Oe[cn], rn) > 0; ) cn--;
                }
                Dt(Oe[ht], rn) === 0 ? ob(Oe, ht, cn) : (cn++, ob(Oe, cn, Tt)), cn <= Xe && (ht = cn + 1), Xe <= cn && (Tt = cn - 1);
              }
            })(M2, B2, ee || 0, ie || M2.length - 1, ge || Bie);
          }
          function ob(M2, B2, ee) {
            var ie = M2[B2];
            M2[B2] = M2[ee], M2[ee] = ie;
          }
          function Bie(M2, B2) {
            return M2 < B2 ? -1 : M2 > B2 ? 1 : 0;
          }
          function yE(M2, B2) {
            var ee = M2.length;
            if (ee <= 1) return [M2];
            for (var ie, ge, _e = [], Oe = 0; Oe < ee; Oe++) {
              var Xe = N2(M2[Oe]);
              Xe !== 0 && (M2[Oe].area = Math.abs(Xe), ge === void 0 && (ge = Xe < 0), ge === Xe < 0 ? (ie && _e.push(ie), ie = [M2[Oe]]) : ie.push(M2[Oe]));
            }
            if (ie && _e.push(ie), B2 > 1) for (var ht = 0; ht < _e.length; ht++) _e[ht].length <= B2 || (zie(_e[ht], B2, 1, _e[ht].length - 1, Uie), _e[ht] = _e[ht].slice(0, B2));
            return _e;
          }
          function Uie(M2, B2) {
            return B2.area - M2.area;
          }
          function xE(M2, B2, ee) {
            for (var ie = ee.patternDependencies, ge = false, _e = 0, Oe = B2; _e < Oe.length; _e += 1) {
              var Xe = Oe[_e].paint.get(M2 + "-pattern");
              Xe.isConstant() || (ge = true);
              var ht = Xe.constantOr(null);
              ht && (ge = true, ie[ht.to] = true, ie[ht.from] = true);
            }
            return ge;
          }
          function bE(M2, B2, ee, ie, ge) {
            for (var _e = ge.patternDependencies, Oe = 0, Xe = B2; Oe < Xe.length; Oe += 1) {
              var ht = Xe[Oe], Tt = ht.paint.get(M2 + "-pattern").value;
              if (Tt.kind !== "constant") {
                var Dt = Tt.evaluate({ zoom: ie - 1 }, ee, {}, ge.availableImages), Xt = Tt.evaluate({ zoom: ie }, ee, {}, ge.availableImages), ar = Tt.evaluate({ zoom: ie + 1 }, ee, {}, ge.availableImages);
                Dt = Dt && Dt.name ? Dt.name : Dt, Xt = Xt && Xt.name ? Xt.name : Xt, ar = ar && ar.name ? ar.name : ar, _e[Dt] = true, _e[Xt] = true, _e[ar] = true, ee.patterns[ht.id] = { min: Dt, mid: Xt, max: ar };
              }
            }
            return ee;
          }
          xw.deviation = function(M2, B2, ee, ie) {
            var ge = B2 && B2.length, _e = ge ? B2[0] * ee : M2.length, Oe = Math.abs(gE(M2, 0, _e, ee));
            if (ge) for (var Xe = 0, ht = B2.length; Xe < ht; Xe++) {
              var Tt = B2[Xe] * ee, Dt = Xe < ht - 1 ? B2[Xe + 1] * ee : M2.length;
              Oe -= Math.abs(gE(M2, Tt, Dt, ee));
            }
            var Xt = 0;
            for (Xe = 0; Xe < ie.length; Xe += 3) {
              var ar = ie[Xe] * ee, er = ie[Xe + 1] * ee, hr = ie[Xe + 2] * ee;
              Xt += Math.abs((M2[ar] - M2[hr]) * (M2[er + 1] - M2[ar + 1]) - (M2[ar] - M2[er]) * (M2[hr + 1] - M2[ar + 1]));
            }
            return Oe === 0 && Xt === 0 ? 0 : Math.abs((Xt - Oe) / Oe);
          }, xw.flatten = function(M2) {
            for (var B2 = M2[0][0].length, ee = { vertices: [], holes: [], dimensions: B2 }, ie = 0, ge = 0; ge < M2.length; ge++) {
              for (var _e = 0; _e < M2[ge].length; _e++) for (var Oe = 0; Oe < B2; Oe++) ee.vertices.push(M2[ge][_e][Oe]);
              ge > 0 && (ie += M2[ge - 1].length, ee.holes.push(ie));
            }
            return ee;
          }, dE.default = Die;
          var Up = function(M2) {
            this.zoom = M2.zoom, this.overscaling = M2.overscaling, this.layers = M2.layers, this.layerIds = this.layers.map(function(B2) {
              return B2.id;
            }), this.index = M2.index, this.hasPattern = false, this.patternFeatures = [], this.layoutVertexArray = new Xf(), this.indexArray = new Ql(), this.indexArray2 = new G2(), this.programConfigurations = new as(OO, M2.layers, M2.zoom), this.segments = new qt(), this.segments2 = new qt(), this.stateDependentLayerIds = this.layers.filter(function(B2) {
              return B2.isStateDependent();
            }).map(function(B2) {
              return B2.id;
            });
          };
          Up.prototype.populate = function(M2, B2, ee) {
            this.hasPattern = xE("fill", this.layers, B2);
            for (var ie = this.layers[0].layout.get("fill-sort-key"), ge = [], _e = 0, Oe = M2; _e < Oe.length; _e += 1) {
              var Xe = Oe[_e], ht = Xe.feature, Tt = Xe.id, Dt = Xe.index, Xt = Xe.sourceLayerIndex, ar = this.layers[0]._featureFilter.needGeometry, er = { type: ht.type, id: Tt, properties: ht.properties, geometry: ar ? us(ht) : [] };
              if (this.layers[0]._featureFilter.filter(new Oo(this.zoom), er, ee)) {
                ar || (er.geometry = us(ht));
                var hr = ie ? ie.evaluate(er, {}, ee, B2.availableImages) : void 0, Sr = { id: Tt, properties: ht.properties, type: ht.type, sourceLayerIndex: Xt, index: Dt, geometry: er.geometry, patterns: {}, sortKey: hr };
                ge.push(Sr);
              }
            }
            ie && ge.sort(function(wa, Wa) {
              return wa.sortKey - Wa.sortKey;
            });
            for (var Ur = 0, Br = ge; Ur < Br.length; Ur += 1) {
              var rn = Br[Ur], nn = rn, cn = nn.geometry, In = nn.index, Un = nn.sourceLayerIndex;
              if (this.hasPattern) {
                var ha = bE("fill", this.layers, rn, this.zoom, B2);
                this.patternFeatures.push(ha);
              } else this.addFeature(rn, cn, In, ee, {});
              var fa = M2[In].feature;
              B2.featureIndex.insert(fa, cn, In, Un, this.index);
            }
          }, Up.prototype.update = function(M2, B2, ee) {
            this.stateDependentLayers.length && this.programConfigurations.updatePaintArrays(M2, B2, this.stateDependentLayers, ee);
          }, Up.prototype.addFeatures = function(M2, B2, ee) {
            for (var ie = 0, ge = this.patternFeatures; ie < ge.length; ie += 1) {
              var _e = ge[ie];
              this.addFeature(_e, _e.geometry, _e.index, B2, ee);
            }
          }, Up.prototype.isEmpty = function() {
            return this.layoutVertexArray.length === 0;
          }, Up.prototype.uploadPending = function() {
            return !this.uploaded || this.programConfigurations.needsUpload;
          }, Up.prototype.upload = function(M2) {
            this.uploaded || (this.layoutVertexBuffer = M2.createVertexBuffer(this.layoutVertexArray, OO), this.indexBuffer = M2.createIndexBuffer(this.indexArray), this.indexBuffer2 = M2.createIndexBuffer(this.indexArray2)), this.programConfigurations.upload(M2), this.uploaded = true;
          }, Up.prototype.destroy = function() {
            this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.indexBuffer2.destroy(), this.programConfigurations.destroy(), this.segments.destroy(), this.segments2.destroy());
          }, Up.prototype.addFeature = function(M2, B2, ee, ie, ge) {
            for (var _e = 0, Oe = yE(B2, 500); _e < Oe.length; _e += 1) {
              for (var Xe = Oe[_e], ht = 0, Tt = 0, Dt = Xe; Tt < Dt.length; Tt += 1) ht += Dt[Tt].length;
              for (var Xt = this.segments.prepareSegment(ht, this.layoutVertexArray, this.indexArray), ar = Xt.vertexLength, er = [], hr = [], Sr = 0, Ur = Xe; Sr < Ur.length; Sr += 1) {
                var Br = Ur[Sr];
                if (Br.length !== 0) {
                  Br !== Xe[0] && hr.push(er.length / 2);
                  var rn = this.segments2.prepareSegment(Br.length, this.layoutVertexArray, this.indexArray2), nn = rn.vertexLength;
                  this.layoutVertexArray.emplaceBack(Br[0].x, Br[0].y), this.indexArray2.emplaceBack(nn + Br.length - 1, nn), er.push(Br[0].x), er.push(Br[0].y);
                  for (var cn = 1; cn < Br.length; cn++) this.layoutVertexArray.emplaceBack(Br[cn].x, Br[cn].y), this.indexArray2.emplaceBack(nn + cn - 1, nn + cn), er.push(Br[cn].x), er.push(Br[cn].y);
                  rn.vertexLength += Br.length, rn.primitiveLength += Br.length;
                }
              }
              for (var In = dE(er, hr), Un = 0; Un < In.length; Un += 3) this.indexArray.emplaceBack(ar + In[Un], ar + In[Un + 1], ar + In[Un + 2]);
              Xt.vertexLength += ht, Xt.primitiveLength += In.length / 3;
            }
            this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, M2, ee, ge, ie);
          }, mn("FillBucket", Up, { omit: ["layers", "patternFeatures"] });
          var Vie = new ic({ "fill-sort-key": new yi(Ve.layout_fill["fill-sort-key"]) }), jie = { paint: new ic({ "fill-antialias": new Ya(Ve.paint_fill["fill-antialias"]), "fill-opacity": new yi(Ve.paint_fill["fill-opacity"]), "fill-color": new yi(Ve.paint_fill["fill-color"]), "fill-outline-color": new yi(Ve.paint_fill["fill-outline-color"]), "fill-translate": new Ya(Ve.paint_fill["fill-translate"]), "fill-translate-anchor": new Ya(Ve.paint_fill["fill-translate-anchor"]), "fill-pattern": new Cd(Ve.paint_fill["fill-pattern"]) }), layout: Vie }, Wie = function(M2) {
            function B2(ee) {
              M2.call(this, ee, jie);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype.recalculate = function(ee, ie) {
              M2.prototype.recalculate.call(this, ee, ie);
              var ge = this.paint._values["fill-outline-color"];
              ge.value.kind === "constant" && ge.value.value === void 0 && (this.paint._values["fill-outline-color"] = this.paint._values["fill-color"]);
            }, B2.prototype.createBucket = function(ee) {
              return new Up(ee);
            }, B2.prototype.queryRadius = function() {
              return oc(this.paint.get("fill-translate"));
            }, B2.prototype.queryIntersectsFeature = function(ee, ie, ge, _e, Oe, Xe, ht) {
              return Id(sc(ee, this.paint.get("fill-translate"), this.paint.get("fill-translate-anchor"), Xe.angle, ht), _e);
            }, B2.prototype.isTileClipped = function() {
              return true;
            }, B2;
          }(Vc), BO = Po([{ name: "a_pos", components: 2, type: "Int16" }, { name: "a_normal_ed", components: 4, type: "Int16" }], 4).members, UO = b1;
          function b1(M2, B2, ee, ie, ge) {
            this.properties = {}, this.extent = ee, this.type = 0, this._pbf = M2, this._geometry = -1, this._keys = ie, this._values = ge, M2.readFields(Gie, this, B2);
          }
          function Gie(M2, B2, ee) {
            M2 == 1 ? B2.id = ee.readVarint() : M2 == 2 ? function(ie, ge) {
              for (var _e = ie.readVarint() + ie.pos; ie.pos < _e; ) {
                var Oe = ge._keys[ie.readVarint()], Xe = ge._values[ie.readVarint()];
                ge.properties[Oe] = Xe;
              }
            }(ee, B2) : M2 == 3 ? B2.type = ee.readVarint() : M2 == 4 && (B2._geometry = ee.pos);
          }
          function $ie(M2) {
            for (var B2, ee, ie = 0, ge = 0, _e = M2.length, Oe = _e - 1; ge < _e; Oe = ge++) B2 = M2[ge], ie += ((ee = M2[Oe]).x - B2.x) * (B2.y + ee.y);
            return ie;
          }
          b1.types = ["Unknown", "Point", "LineString", "Polygon"], b1.prototype.loadGeometry = function() {
            var M2 = this._pbf;
            M2.pos = this._geometry;
            for (var B2, ee = M2.readVarint() + M2.pos, ie = 1, ge = 0, _e = 0, Oe = 0, Xe = []; M2.pos < ee; ) {
              if (ge <= 0) {
                var ht = M2.readVarint();
                ie = 7 & ht, ge = ht >> 3;
              }
              if (ge--, ie === 1 || ie === 2) _e += M2.readSVarint(), Oe += M2.readSVarint(), ie === 1 && (B2 && Xe.push(B2), B2 = []), B2.push(new f(_e, Oe));
              else {
                if (ie !== 7) throw new Error("unknown command " + ie);
                B2 && B2.push(B2[0].clone());
              }
            }
            return B2 && Xe.push(B2), Xe;
          }, b1.prototype.bbox = function() {
            var M2 = this._pbf;
            M2.pos = this._geometry;
            for (var B2 = M2.readVarint() + M2.pos, ee = 1, ie = 0, ge = 0, _e = 0, Oe = 1 / 0, Xe = -1 / 0, ht = 1 / 0, Tt = -1 / 0; M2.pos < B2; ) {
              if (ie <= 0) {
                var Dt = M2.readVarint();
                ee = 7 & Dt, ie = Dt >> 3;
              }
              if (ie--, ee === 1 || ee === 2) (ge += M2.readSVarint()) < Oe && (Oe = ge), ge > Xe && (Xe = ge), (_e += M2.readSVarint()) < ht && (ht = _e), _e > Tt && (Tt = _e);
              else if (ee !== 7) throw new Error("unknown command " + ee);
            }
            return [Oe, ht, Xe, Tt];
          }, b1.prototype.toGeoJSON = function(M2, B2, ee) {
            var ie, ge, _e = this.extent * Math.pow(2, ee), Oe = this.extent * M2, Xe = this.extent * B2, ht = this.loadGeometry(), Tt = b1.types[this.type];
            function Dt(er) {
              for (var hr = 0; hr < er.length; hr++) {
                var Sr = er[hr], Ur = 180 - 360 * (Sr.y + Xe) / _e;
                er[hr] = [360 * (Sr.x + Oe) / _e - 180, 360 / Math.PI * Math.atan(Math.exp(Ur * Math.PI / 180)) - 90];
              }
            }
            switch (this.type) {
              case 1:
                var Xt = [];
                for (ie = 0; ie < ht.length; ie++) Xt[ie] = ht[ie][0];
                Dt(ht = Xt);
                break;
              case 2:
                for (ie = 0; ie < ht.length; ie++) Dt(ht[ie]);
                break;
              case 3:
                for (ht = function(er) {
                  var hr = er.length;
                  if (hr <= 1) return [er];
                  for (var Sr, Ur, Br = [], rn = 0; rn < hr; rn++) {
                    var nn = $ie(er[rn]);
                    nn !== 0 && (Ur === void 0 && (Ur = nn < 0), Ur === nn < 0 ? (Sr && Br.push(Sr), Sr = [er[rn]]) : Sr.push(er[rn]));
                  }
                  return Sr && Br.push(Sr), Br;
                }(ht), ie = 0; ie < ht.length; ie++) for (ge = 0; ge < ht[ie].length; ge++) Dt(ht[ie][ge]);
            }
            ht.length === 1 ? ht = ht[0] : Tt = "Multi" + Tt;
            var ar = { type: "Feature", geometry: { type: Tt, coordinates: ht }, properties: this.properties };
            return "id" in this && (ar.id = this.id), ar;
          };
          var VO = jO;
          function jO(M2, B2) {
            this.version = 1, this.name = null, this.extent = 4096, this.length = 0, this._pbf = M2, this._keys = [], this._values = [], this._features = [], M2.readFields(Hie, this, B2), this.length = this._features.length;
          }
          function Hie(M2, B2, ee) {
            M2 === 15 ? B2.version = ee.readVarint() : M2 === 1 ? B2.name = ee.readString() : M2 === 5 ? B2.extent = ee.readVarint() : M2 === 2 ? B2._features.push(ee.pos) : M2 === 3 ? B2._keys.push(ee.readString()) : M2 === 4 && B2._values.push(function(ie) {
              for (var ge = null, _e = ie.readVarint() + ie.pos; ie.pos < _e; ) {
                var Oe = ie.readVarint() >> 3;
                ge = Oe === 1 ? ie.readString() : Oe === 2 ? ie.readFloat() : Oe === 3 ? ie.readDouble() : Oe === 4 ? ie.readVarint64() : Oe === 5 ? ie.readVarint() : Oe === 6 ? ie.readSVarint() : Oe === 7 ? ie.readBoolean() : null;
              }
              return ge;
            }(ee));
          }
          function qie(M2, B2, ee) {
            if (M2 === 3) {
              var ie = new VO(ee, ee.readVarint() + ee.pos);
              ie.length && (B2[ie.name] = ie);
            }
          }
          jO.prototype.feature = function(M2) {
            if (M2 < 0 || M2 >= this._features.length) throw new Error("feature index out of bounds");
            this._pbf.pos = this._features[M2];
            var B2 = this._pbf.readVarint() + this._pbf.pos;
            return new UO(this._pbf, B2, this.extent, this._keys, this._values);
          };
          var _1 = { VectorTile: function(M2, B2) {
            this.layers = M2.readFields(qie, {}, B2);
          }, VectorTileFeature: UO, VectorTileLayer: VO }, Xie = _1.VectorTileFeature.types, _E = Math.pow(2, 13);
          function sb(M2, B2, ee, ie, ge, _e, Oe, Xe) {
            M2.emplaceBack(B2, ee, 2 * Math.floor(ie * _E) + Oe, ge * _E * 2, _e * _E * 2, Math.round(Xe));
          }
          var Vp = function(M2) {
            this.zoom = M2.zoom, this.overscaling = M2.overscaling, this.layers = M2.layers, this.layerIds = this.layers.map(function(B2) {
              return B2.id;
            }), this.index = M2.index, this.hasPattern = false, this.layoutVertexArray = new kh(), this.indexArray = new Ql(), this.programConfigurations = new as(BO, M2.layers, M2.zoom), this.segments = new qt(), this.stateDependentLayerIds = this.layers.filter(function(B2) {
              return B2.isStateDependent();
            }).map(function(B2) {
              return B2.id;
            });
          };
          function Kie(M2, B2) {
            return M2.x === B2.x && (M2.x < 0 || M2.x > 8192) || M2.y === B2.y && (M2.y < 0 || M2.y > 8192);
          }
          function Yie(M2) {
            return M2.every(function(B2) {
              return B2.x < 0;
            }) || M2.every(function(B2) {
              return B2.x > 8192;
            }) || M2.every(function(B2) {
              return B2.y < 0;
            }) || M2.every(function(B2) {
              return B2.y > 8192;
            });
          }
          Vp.prototype.populate = function(M2, B2, ee) {
            this.features = [], this.hasPattern = xE("fill-extrusion", this.layers, B2);
            for (var ie = 0, ge = M2; ie < ge.length; ie += 1) {
              var _e = ge[ie], Oe = _e.feature, Xe = _e.id, ht = _e.index, Tt = _e.sourceLayerIndex, Dt = this.layers[0]._featureFilter.needGeometry, Xt = { type: Oe.type, id: Xe, properties: Oe.properties, geometry: Dt ? us(Oe) : [] };
              if (this.layers[0]._featureFilter.filter(new Oo(this.zoom), Xt, ee)) {
                var ar = { id: Xe, sourceLayerIndex: Tt, index: ht, geometry: Dt ? Xt.geometry : us(Oe), properties: Oe.properties, type: Oe.type, patterns: {} };
                Oe.id !== void 0 && (ar.id = Oe.id), this.hasPattern ? this.features.push(bE("fill-extrusion", this.layers, ar, this.zoom, B2)) : this.addFeature(ar, ar.geometry, ht, ee, {}), B2.featureIndex.insert(Oe, ar.geometry, ht, Tt, this.index, true);
              }
            }
          }, Vp.prototype.addFeatures = function(M2, B2, ee) {
            for (var ie = 0, ge = this.features; ie < ge.length; ie += 1) {
              var _e = ge[ie], Oe = _e.geometry;
              this.addFeature(_e, Oe, _e.index, B2, ee);
            }
          }, Vp.prototype.update = function(M2, B2, ee) {
            this.stateDependentLayers.length && this.programConfigurations.updatePaintArrays(M2, B2, this.stateDependentLayers, ee);
          }, Vp.prototype.isEmpty = function() {
            return this.layoutVertexArray.length === 0;
          }, Vp.prototype.uploadPending = function() {
            return !this.uploaded || this.programConfigurations.needsUpload;
          }, Vp.prototype.upload = function(M2) {
            this.uploaded || (this.layoutVertexBuffer = M2.createVertexBuffer(this.layoutVertexArray, BO), this.indexBuffer = M2.createIndexBuffer(this.indexArray)), this.programConfigurations.upload(M2), this.uploaded = true;
          }, Vp.prototype.destroy = function() {
            this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy());
          }, Vp.prototype.addFeature = function(M2, B2, ee, ie, ge) {
            for (var _e = 0, Oe = yE(B2, 500); _e < Oe.length; _e += 1) {
              for (var Xe = Oe[_e], ht = 0, Tt = 0, Dt = Xe; Tt < Dt.length; Tt += 1) ht += Dt[Tt].length;
              for (var Xt = this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray), ar = 0, er = Xe; ar < er.length; ar += 1) {
                var hr = er[ar];
                if (hr.length !== 0 && !Yie(hr)) for (var Sr = 0, Ur = 0; Ur < hr.length; Ur++) {
                  var Br = hr[Ur];
                  if (Ur >= 1) {
                    var rn = hr[Ur - 1];
                    if (!Kie(Br, rn)) {
                      Xt.vertexLength + 4 > qt.MAX_VERTEX_ARRAY_LENGTH && (Xt = this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray));
                      var nn = Br.sub(rn)._perp()._unit(), cn = rn.dist(Br);
                      Sr + cn > 32768 && (Sr = 0), sb(this.layoutVertexArray, Br.x, Br.y, nn.x, nn.y, 0, 0, Sr), sb(this.layoutVertexArray, Br.x, Br.y, nn.x, nn.y, 0, 1, Sr), Sr += cn, sb(this.layoutVertexArray, rn.x, rn.y, nn.x, nn.y, 0, 0, Sr), sb(this.layoutVertexArray, rn.x, rn.y, nn.x, nn.y, 0, 1, Sr);
                      var In = Xt.vertexLength;
                      this.indexArray.emplaceBack(In, In + 2, In + 1), this.indexArray.emplaceBack(In + 1, In + 2, In + 3), Xt.vertexLength += 4, Xt.primitiveLength += 2;
                    }
                  }
                }
              }
              if (Xt.vertexLength + ht > qt.MAX_VERTEX_ARRAY_LENGTH && (Xt = this.segments.prepareSegment(ht, this.layoutVertexArray, this.indexArray)), Xie[M2.type] === "Polygon") {
                for (var Un = [], ha = [], fa = Xt.vertexLength, wa = 0, Wa = Xe; wa < Wa.length; wa += 1) {
                  var $a = Wa[wa];
                  if ($a.length !== 0) {
                    $a !== Xe[0] && ha.push(Un.length / 2);
                    for (var Ea = 0; Ea < $a.length; Ea++) {
                      var oi = $a[Ea];
                      sb(this.layoutVertexArray, oi.x, oi.y, 0, 0, 1, 1, 0), Un.push(oi.x), Un.push(oi.y);
                    }
                  }
                }
                for (var ei = dE(Un, ha), Ha = 0; Ha < ei.length; Ha += 3) this.indexArray.emplaceBack(fa + ei[Ha], fa + ei[Ha + 2], fa + ei[Ha + 1]);
                Xt.primitiveLength += ei.length / 3, Xt.vertexLength += ht;
              }
            }
            this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, M2, ee, ge, ie);
          }, mn("FillExtrusionBucket", Vp, { omit: ["layers", "features"] });
          var Zie = { paint: new ic({ "fill-extrusion-opacity": new Ya(Ve["paint_fill-extrusion"]["fill-extrusion-opacity"]), "fill-extrusion-color": new yi(Ve["paint_fill-extrusion"]["fill-extrusion-color"]), "fill-extrusion-translate": new Ya(Ve["paint_fill-extrusion"]["fill-extrusion-translate"]), "fill-extrusion-translate-anchor": new Ya(Ve["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]), "fill-extrusion-pattern": new Cd(Ve["paint_fill-extrusion"]["fill-extrusion-pattern"]), "fill-extrusion-height": new yi(Ve["paint_fill-extrusion"]["fill-extrusion-height"]), "fill-extrusion-base": new yi(Ve["paint_fill-extrusion"]["fill-extrusion-base"]), "fill-extrusion-vertical-gradient": new Ya(Ve["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]) }) }, Jie = function(M2) {
            function B2(ee) {
              M2.call(this, ee, Zie);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype.createBucket = function(ee) {
              return new Vp(ee);
            }, B2.prototype.queryRadius = function() {
              return oc(this.paint.get("fill-extrusion-translate"));
            }, B2.prototype.is3D = function() {
              return true;
            }, B2.prototype.queryIntersectsFeature = function(ee, ie, ge, _e, Oe, Xe, ht, Tt) {
              var Dt = sc(ee, this.paint.get("fill-extrusion-translate"), this.paint.get("fill-extrusion-translate-anchor"), Xe.angle, ht), Xt = this.paint.get("fill-extrusion-height").evaluate(ie, ge), ar = this.paint.get("fill-extrusion-base").evaluate(ie, ge), er = function(Sr, Ur, Br, rn) {
                for (var nn = [], cn = 0, In = Sr; cn < In.length; cn += 1) {
                  var Un = In[cn], ha = [Un.x, Un.y, rn, 1];
                  rv(ha, ha, Ur), nn.push(new f(ha[0] / ha[3], ha[1] / ha[3]));
                }
                return nn;
              }(Dt, Tt, 0, 0), hr = function(Sr, Ur, Br, rn) {
                for (var nn = [], cn = [], In = rn[8] * Ur, Un = rn[9] * Ur, ha = rn[10] * Ur, fa = rn[11] * Ur, wa = rn[8] * Br, Wa = rn[9] * Br, $a = rn[10] * Br, Ea = rn[11] * Br, oi = 0, ei = Sr; oi < ei.length; oi += 1) {
                  for (var Ha = ei[oi], xo = [], io = [], Co = 0, Ti = Ha; Co < Ti.length; Co += 1) {
                    var uo = Ti[Co], fs = uo.x, is = uo.y, Ns = rn[0] * fs + rn[4] * is + rn[12], os = rn[1] * fs + rn[5] * is + rn[13], nu = rn[2] * fs + rn[6] * is + rn[14], Fs = rn[3] * fs + rn[7] * is + rn[15], lc = nu + ha, Su = Fs + fa, Bu = Ns + wa, jc = os + Wa, kc = nu + $a, au = Fs + Ea, Uu = new f((Ns + In) / Su, (os + Un) / Su);
                    Uu.z = lc / Su, xo.push(Uu);
                    var zl = new f(Bu / au, jc / au);
                    zl.z = kc / au, io.push(zl);
                  }
                  nn.push(xo), cn.push(io);
                }
                return [nn, cn];
              }(_e, ar, Xt, Tt);
              return function(Sr, Ur, Br) {
                var rn = 1 / 0;
                Id(Br, Ur) && (rn = WO(Br, Ur[0]));
                for (var nn = 0; nn < Ur.length; nn++) for (var cn = Ur[nn], In = Sr[nn], Un = 0; Un < cn.length - 1; Un++) {
                  var ha = cn[Un], fa = cn[Un + 1], wa = In[Un], Wa = In[Un + 1], $a = [ha, fa, Wa, wa, ha];
                  _c(Br, $a) && (rn = Math.min(rn, WO(Br, $a)));
                }
                return rn !== 1 / 0 && rn;
              }(hr[0], hr[1], er);
            }, B2;
          }(Vc);
          function lb(M2, B2) {
            return M2.x * B2.x + M2.y * B2.y;
          }
          function WO(M2, B2) {
            if (M2.length === 1) {
              for (var ee, ie = 0, ge = B2[ie++]; !ee || ge.equals(ee); ) if (!(ee = B2[ie++])) return 1 / 0;
              for (; ie < B2.length; ie++) {
                var _e = B2[ie], Oe = M2[0], Xe = ee.sub(ge), ht = _e.sub(ge), Tt = Oe.sub(ge), Dt = lb(Xe, Xe), Xt = lb(Xe, ht), ar = lb(ht, ht), er = lb(Tt, Xe), hr = lb(Tt, ht), Sr = Dt * ar - Xt * Xt, Ur = (ar * er - Xt * hr) / Sr, Br = (Dt * hr - Xt * er) / Sr, rn = 1 - Ur - Br, nn = ge.z * rn + ee.z * Ur + _e.z * Br;
                if (isFinite(nn)) return nn;
              }
              return 1 / 0;
            }
            for (var cn = 1 / 0, In = 0, Un = B2; In < Un.length; In += 1) {
              var ha = Un[In];
              cn = Math.min(cn, ha.z);
            }
            return cn;
          }
          var GO = Po([{ name: "a_pos_normal", components: 2, type: "Int16" }, { name: "a_data", components: 4, type: "Uint8" }], 4).members, Qie = _1.VectorTileFeature.types, eoe = Math.cos(Math.PI / 180 * 37.5), $O = Math.pow(2, 14) / 0.5, tf = function(M2) {
            this.zoom = M2.zoom, this.overscaling = M2.overscaling, this.layers = M2.layers, this.layerIds = this.layers.map(function(B2) {
              return B2.id;
            }), this.index = M2.index, this.hasPattern = false, this.patternFeatures = [], this.layoutVertexArray = new Rp(), this.indexArray = new Ql(), this.programConfigurations = new as(GO, M2.layers, M2.zoom), this.segments = new qt(), this.stateDependentLayerIds = this.layers.filter(function(B2) {
              return B2.isStateDependent();
            }).map(function(B2) {
              return B2.id;
            });
          };
          tf.prototype.populate = function(M2, B2, ee) {
            this.hasPattern = xE("line", this.layers, B2);
            for (var ie = this.layers[0].layout.get("line-sort-key"), ge = [], _e = 0, Oe = M2; _e < Oe.length; _e += 1) {
              var Xe = Oe[_e], ht = Xe.feature, Tt = Xe.id, Dt = Xe.index, Xt = Xe.sourceLayerIndex, ar = this.layers[0]._featureFilter.needGeometry, er = { type: ht.type, id: Tt, properties: ht.properties, geometry: ar ? us(ht) : [] };
              if (this.layers[0]._featureFilter.filter(new Oo(this.zoom), er, ee)) {
                ar || (er.geometry = us(ht));
                var hr = ie ? ie.evaluate(er, {}, ee) : void 0, Sr = { id: Tt, properties: ht.properties, type: ht.type, sourceLayerIndex: Xt, index: Dt, geometry: er.geometry, patterns: {}, sortKey: hr };
                ge.push(Sr);
              }
            }
            ie && ge.sort(function(wa, Wa) {
              return wa.sortKey - Wa.sortKey;
            });
            for (var Ur = 0, Br = ge; Ur < Br.length; Ur += 1) {
              var rn = Br[Ur], nn = rn, cn = nn.geometry, In = nn.index, Un = nn.sourceLayerIndex;
              if (this.hasPattern) {
                var ha = bE("line", this.layers, rn, this.zoom, B2);
                this.patternFeatures.push(ha);
              } else this.addFeature(rn, cn, In, ee, {});
              var fa = M2[In].feature;
              B2.featureIndex.insert(fa, cn, In, Un, this.index);
            }
          }, tf.prototype.update = function(M2, B2, ee) {
            this.stateDependentLayers.length && this.programConfigurations.updatePaintArrays(M2, B2, this.stateDependentLayers, ee);
          }, tf.prototype.addFeatures = function(M2, B2, ee) {
            for (var ie = 0, ge = this.patternFeatures; ie < ge.length; ie += 1) {
              var _e = ge[ie];
              this.addFeature(_e, _e.geometry, _e.index, B2, ee);
            }
          }, tf.prototype.isEmpty = function() {
            return this.layoutVertexArray.length === 0;
          }, tf.prototype.uploadPending = function() {
            return !this.uploaded || this.programConfigurations.needsUpload;
          }, tf.prototype.upload = function(M2) {
            this.uploaded || (this.layoutVertexBuffer = M2.createVertexBuffer(this.layoutVertexArray, GO), this.indexBuffer = M2.createIndexBuffer(this.indexArray)), this.programConfigurations.upload(M2), this.uploaded = true;
          }, tf.prototype.destroy = function() {
            this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy());
          }, tf.prototype.addFeature = function(M2, B2, ee, ie, ge) {
            for (var _e = this.layers[0].layout, Oe = _e.get("line-join").evaluate(M2, {}), Xe = _e.get("line-cap"), ht = _e.get("line-miter-limit"), Tt = _e.get("line-round-limit"), Dt = 0, Xt = B2; Dt < Xt.length; Dt += 1) {
              var ar = Xt[Dt];
              this.addLine(ar, M2, Oe, Xe, ht, Tt);
            }
            this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, M2, ee, ge, ie);
          }, tf.prototype.addLine = function(M2, B2, ee, ie, ge, _e) {
            if (this.distance = 0, this.scaledDistance = 0, this.totalDistance = 0, B2.properties && B2.properties.hasOwnProperty("mapbox_clip_start") && B2.properties.hasOwnProperty("mapbox_clip_end")) {
              this.clipStart = +B2.properties.mapbox_clip_start, this.clipEnd = +B2.properties.mapbox_clip_end;
              for (var Oe = 0; Oe < M2.length - 1; Oe++) this.totalDistance += M2[Oe].dist(M2[Oe + 1]);
              this.updateScaledDistance();
            }
            for (var Xe = Qie[B2.type] === "Polygon", ht = M2.length; ht >= 2 && M2[ht - 1].equals(M2[ht - 2]); ) ht--;
            for (var Tt = 0; Tt < ht - 1 && M2[Tt].equals(M2[Tt + 1]); ) Tt++;
            if (!(ht < (Xe ? 3 : 2))) {
              ee === "bevel" && (ge = 1.05);
              var Dt, Xt = this.overscaling <= 16 ? 122880 / (512 * this.overscaling) : 0, ar = this.segments.prepareSegment(10 * ht, this.layoutVertexArray, this.indexArray), er = void 0, hr = void 0, Sr = void 0, Ur = void 0;
              this.e1 = this.e2 = -1, Xe && (Dt = M2[ht - 2], Ur = M2[Tt].sub(Dt)._unit()._perp());
              for (var Br = Tt; Br < ht; Br++) if (!(hr = Br === ht - 1 ? Xe ? M2[Tt + 1] : void 0 : M2[Br + 1]) || !M2[Br].equals(hr)) {
                Ur && (Sr = Ur), Dt && (er = Dt), Dt = M2[Br], Ur = hr ? hr.sub(Dt)._unit()._perp() : Sr;
                var rn = (Sr = Sr || Ur).add(Ur);
                rn.x === 0 && rn.y === 0 || rn._unit();
                var nn = Sr.x * Ur.x + Sr.y * Ur.y, cn = rn.x * Ur.x + rn.y * Ur.y, In = cn !== 0 ? 1 / cn : 1 / 0, Un = 2 * Math.sqrt(2 - 2 * cn), ha = cn < eoe && er && hr, fa = Sr.x * Ur.y - Sr.y * Ur.x > 0;
                if (ha && Br > Tt) {
                  var wa = Dt.dist(er);
                  if (wa > 2 * Xt) {
                    var Wa = Dt.sub(Dt.sub(er)._mult(Xt / wa)._round());
                    this.updateDistance(er, Wa), this.addCurrentVertex(Wa, Sr, 0, 0, ar), er = Wa;
                  }
                }
                var $a = er && hr, Ea = $a ? ee : Xe ? "butt" : ie;
                if ($a && Ea === "round" && (In < _e ? Ea = "miter" : In <= 2 && (Ea = "fakeround")), Ea === "miter" && In > ge && (Ea = "bevel"), Ea === "bevel" && (In > 2 && (Ea = "flipbevel"), In < ge && (Ea = "miter")), er && this.updateDistance(er, Dt), Ea === "miter") rn._mult(In), this.addCurrentVertex(Dt, rn, 0, 0, ar);
                else if (Ea === "flipbevel") {
                  if (In > 100) rn = Ur.mult(-1);
                  else {
                    var oi = In * Sr.add(Ur).mag() / Sr.sub(Ur).mag();
                    rn._perp()._mult(oi * (fa ? -1 : 1));
                  }
                  this.addCurrentVertex(Dt, rn, 0, 0, ar), this.addCurrentVertex(Dt, rn.mult(-1), 0, 0, ar);
                } else if (Ea === "bevel" || Ea === "fakeround") {
                  var ei = -Math.sqrt(In * In - 1), Ha = fa ? ei : 0, xo = fa ? 0 : ei;
                  if (er && this.addCurrentVertex(Dt, Sr, Ha, xo, ar), Ea === "fakeround") for (var io = Math.round(180 * Un / Math.PI / 20), Co = 1; Co < io; Co++) {
                    var Ti = Co / io;
                    if (Ti !== 0.5) {
                      var uo = Ti - 0.5;
                      Ti += Ti * uo * (Ti - 1) * ((1.0904 + nn * (nn * (3.55645 - 1.43519 * nn) - 3.2452)) * uo * uo + (0.848013 + nn * (0.215638 * nn - 1.06021)));
                    }
                    var fs = Ur.sub(Sr)._mult(Ti)._add(Sr)._unit()._mult(fa ? -1 : 1);
                    this.addHalfVertex(Dt, fs.x, fs.y, false, fa, 0, ar);
                  }
                  hr && this.addCurrentVertex(Dt, Ur, -Ha, -xo, ar);
                } else if (Ea === "butt") this.addCurrentVertex(Dt, rn, 0, 0, ar);
                else if (Ea === "square") {
                  var is = er ? 1 : -1;
                  this.addCurrentVertex(Dt, rn, is, is, ar);
                } else Ea === "round" && (er && (this.addCurrentVertex(Dt, Sr, 0, 0, ar), this.addCurrentVertex(Dt, Sr, 1, 1, ar, true)), hr && (this.addCurrentVertex(Dt, Ur, -1, -1, ar, true), this.addCurrentVertex(Dt, Ur, 0, 0, ar)));
                if (ha && Br < ht - 1) {
                  var Ns = Dt.dist(hr);
                  if (Ns > 2 * Xt) {
                    var os = Dt.add(hr.sub(Dt)._mult(Xt / Ns)._round());
                    this.updateDistance(Dt, os), this.addCurrentVertex(os, Ur, 0, 0, ar), Dt = os;
                  }
                }
              }
            }
          }, tf.prototype.addCurrentVertex = function(M2, B2, ee, ie, ge, _e) {
            _e === void 0 && (_e = false);
            var Oe = B2.x + B2.y * ee, Xe = B2.y - B2.x * ee, ht = -B2.x + B2.y * ie, Tt = -B2.y - B2.x * ie;
            this.addHalfVertex(M2, Oe, Xe, _e, false, ee, ge), this.addHalfVertex(M2, ht, Tt, _e, true, -ie, ge), this.distance > $O / 2 && this.totalDistance === 0 && (this.distance = 0, this.addCurrentVertex(M2, B2, ee, ie, ge, _e));
          }, tf.prototype.addHalfVertex = function(M2, B2, ee, ie, ge, _e, Oe) {
            var Xe = M2.x, ht = M2.y, Tt = 0.5 * this.scaledDistance;
            this.layoutVertexArray.emplaceBack((Xe << 1) + (ie ? 1 : 0), (ht << 1) + (ge ? 1 : 0), Math.round(63 * B2) + 128, Math.round(63 * ee) + 128, 1 + (_e === 0 ? 0 : _e < 0 ? -1 : 1) | (63 & Tt) << 2, Tt >> 6);
            var Dt = Oe.vertexLength++;
            this.e1 >= 0 && this.e2 >= 0 && (this.indexArray.emplaceBack(this.e1, this.e2, Dt), Oe.primitiveLength++), ge ? this.e2 = Dt : this.e1 = Dt;
          }, tf.prototype.updateScaledDistance = function() {
            this.scaledDistance = this.totalDistance > 0 ? (this.clipStart + (this.clipEnd - this.clipStart) * this.distance / this.totalDistance) * ($O - 1) : this.distance;
          }, tf.prototype.updateDistance = function(M2, B2) {
            this.distance += M2.dist(B2), this.updateScaledDistance();
          }, mn("LineBucket", tf, { omit: ["layers", "patternFeatures"] });
          var toe = new ic({ "line-cap": new Ya(Ve.layout_line["line-cap"]), "line-join": new yi(Ve.layout_line["line-join"]), "line-miter-limit": new Ya(Ve.layout_line["line-miter-limit"]), "line-round-limit": new Ya(Ve.layout_line["line-round-limit"]), "line-sort-key": new yi(Ve.layout_line["line-sort-key"]) }), HO = { paint: new ic({ "line-opacity": new yi(Ve.paint_line["line-opacity"]), "line-color": new yi(Ve.paint_line["line-color"]), "line-translate": new Ya(Ve.paint_line["line-translate"]), "line-translate-anchor": new Ya(Ve.paint_line["line-translate-anchor"]), "line-width": new yi(Ve.paint_line["line-width"]), "line-gap-width": new yi(Ve.paint_line["line-gap-width"]), "line-offset": new yi(Ve.paint_line["line-offset"]), "line-blur": new yi(Ve.paint_line["line-blur"]), "line-dasharray": new Md(Ve.paint_line["line-dasharray"]), "line-pattern": new Cd(Ve.paint_line["line-pattern"]), "line-gradient": new Ef(Ve.paint_line["line-gradient"]) }), layout: toe }, qO = new (function(M2) {
            function B2() {
              M2.apply(this, arguments);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype.possiblyEvaluate = function(ee, ie) {
              return ie = new Oo(Math.floor(ie.zoom), { now: ie.now, fadeDuration: ie.fadeDuration, zoomHistory: ie.zoomHistory, transition: ie.transition }), M2.prototype.possiblyEvaluate.call(this, ee, ie);
            }, B2.prototype.evaluate = function(ee, ie, ge, _e) {
              return ie = g({}, ie, { zoom: Math.floor(ie.zoom) }), M2.prototype.evaluate.call(this, ee, ie, ge, _e);
            }, B2;
          }(yi))(HO.paint.properties["line-width"].specification);
          qO.useIntegerZoom = true;
          var roe = function(M2) {
            function B2(ee) {
              M2.call(this, ee, HO);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype._handleSpecialPaintPropertyUpdate = function(ee) {
              ee === "line-gradient" && this._updateGradient();
            }, B2.prototype._updateGradient = function() {
              var ee = this._transitionablePaint._values["line-gradient"].value.expression;
              this.gradient = FO(ee, "lineProgress"), this.gradientTexture = null;
            }, B2.prototype.recalculate = function(ee, ie) {
              M2.prototype.recalculate.call(this, ee, ie), this.paint._values["line-floorwidth"] = qO.possiblyEvaluate(this._transitioningPaint._values["line-width"].value, ee);
            }, B2.prototype.createBucket = function(ee) {
              return new tf(ee);
            }, B2.prototype.queryRadius = function(ee) {
              var ie = ee, ge = XO(Ms("line-width", this, ie), Ms("line-gap-width", this, ie)), _e = Ms("line-offset", this, ie);
              return ge / 2 + Math.abs(_e) + oc(this.paint.get("line-translate"));
            }, B2.prototype.queryIntersectsFeature = function(ee, ie, ge, _e, Oe, Xe, ht) {
              var Tt = sc(ee, this.paint.get("line-translate"), this.paint.get("line-translate-anchor"), Xe.angle, ht), Dt = ht / 2 * XO(this.paint.get("line-width").evaluate(ie, ge), this.paint.get("line-gap-width").evaluate(ie, ge)), Xt = this.paint.get("line-offset").evaluate(ie, ge);
              return Xt && (_e = function(ar, er) {
                for (var hr = [], Sr = new f(0, 0), Ur = 0; Ur < ar.length; Ur++) {
                  for (var Br = ar[Ur], rn = [], nn = 0; nn < Br.length; nn++) {
                    var cn = Br[nn - 1], In = Br[nn], Un = Br[nn + 1], ha = nn === 0 ? Sr : In.sub(cn)._unit()._perp(), fa = nn === Br.length - 1 ? Sr : Un.sub(In)._unit()._perp(), wa = ha._add(fa)._unit(), Wa = wa.x * fa.x + wa.y * fa.y;
                    wa._mult(1 / Wa), rn.push(wa._mult(er)._add(In));
                  }
                  hr.push(rn);
                }
                return hr;
              }(_e, Xt * ht)), function(ar, er, hr) {
                for (var Sr = 0; Sr < er.length; Sr++) {
                  var Ur = er[Sr];
                  if (ar.length >= 3) {
                    for (var Br = 0; Br < Ur.length; Br++) if (Df(ar, Ur[Br])) return true;
                  }
                  if (pm(ar, Ur, hr)) return true;
                }
                return false;
              }(Tt, _e, Dt);
            }, B2.prototype.isTileClipped = function() {
              return true;
            }, B2;
          }(Vc);
          function XO(M2, B2) {
            return B2 > 0 ? B2 + 2 * M2 : M2;
          }
          var wE = Po([{ name: "a_pos_offset", components: 4, type: "Int16" }, { name: "a_data", components: 4, type: "Uint16" }, { name: "a_pixeloffset", components: 4, type: "Int16" }], 4), noe = Po([{ name: "a_projected_pos", components: 3, type: "Float32" }], 4), aoe = (Po([{ name: "a_fade_opacity", components: 1, type: "Uint32" }], 4), Po([{ name: "a_placed", components: 2, type: "Uint8" }, { name: "a_shift", components: 2, type: "Float32" }])), KO = (Po([{ 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" }]), Po([{ name: "a_pos", components: 2, type: "Int16" }, { name: "a_anchor_pos", components: 2, type: "Int16" }, { name: "a_extrude", components: 2, type: "Int16" }], 4)), ioe = Po([{ name: "a_pos", components: 2, type: "Float32" }, { name: "a_radius", components: 1, type: "Float32" }, { name: "a_flags", components: 2, type: "Int16" }], 4);
          Po([{ name: "triangle", components: 3, type: "Uint16" }]), Po([{ 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" }]), Po([{ 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", components: 2, name: "textOffset" }, { type: "Float32", name: "collisionCircleDiameter" }]), Po([{ type: "Float32", name: "offsetX" }]), Po([{ type: "Int16", name: "x" }, { type: "Int16", name: "y" }, { type: "Int16", name: "tileUnitDistanceFromAnchor" }]);
          function ooe(M2, B2, ee) {
            return M2.sections.forEach(function(ie) {
              ie.text = function(ge, _e, Oe) {
                var Xe = _e.layout.get("text-transform").evaluate(Oe, {});
                return Xe === "uppercase" ? ge = ge.toLocaleUpperCase() : Xe === "lowercase" && (ge = ge.toLocaleLowerCase()), fu.applyArabicShaping && (ge = fu.applyArabicShaping(ge)), ge;
              }(ie.text, B2, ee);
            }), M2;
          }
          var ub = { "!": "\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" }, YO = function(M2, B2, ee, ie, ge) {
            var _e, Oe, Xe = 8 * ge - ie - 1, ht = (1 << Xe) - 1, Tt = ht >> 1, Dt = -7, Xt = ee ? ge - 1 : 0, ar = ee ? -1 : 1, er = M2[B2 + Xt];
            for (Xt += ar, _e = er & (1 << -Dt) - 1, er >>= -Dt, Dt += Xe; Dt > 0; _e = 256 * _e + M2[B2 + Xt], Xt += ar, Dt -= 8) ;
            for (Oe = _e & (1 << -Dt) - 1, _e >>= -Dt, Dt += ie; Dt > 0; Oe = 256 * Oe + M2[B2 + Xt], Xt += ar, Dt -= 8) ;
            if (_e === 0) _e = 1 - Tt;
            else {
              if (_e === ht) return Oe ? NaN : 1 / 0 * (er ? -1 : 1);
              Oe += Math.pow(2, ie), _e -= Tt;
            }
            return (er ? -1 : 1) * Oe * Math.pow(2, _e - ie);
          }, ZO = function(M2, B2, ee, ie, ge, _e) {
            var Oe, Xe, ht, Tt = 8 * _e - ge - 1, Dt = (1 << Tt) - 1, Xt = Dt >> 1, ar = ge === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, er = ie ? 0 : _e - 1, hr = ie ? 1 : -1, Sr = B2 < 0 || B2 === 0 && 1 / B2 < 0 ? 1 : 0;
            for (B2 = Math.abs(B2), isNaN(B2) || B2 === 1 / 0 ? (Xe = isNaN(B2) ? 1 : 0, Oe = Dt) : (Oe = Math.floor(Math.log(B2) / Math.LN2), B2 * (ht = Math.pow(2, -Oe)) < 1 && (Oe--, ht *= 2), (B2 += Oe + Xt >= 1 ? ar / ht : ar * Math.pow(2, 1 - Xt)) * ht >= 2 && (Oe++, ht /= 2), Oe + Xt >= Dt ? (Xe = 0, Oe = Dt) : Oe + Xt >= 1 ? (Xe = (B2 * ht - 1) * Math.pow(2, ge), Oe += Xt) : (Xe = B2 * Math.pow(2, Xt - 1) * Math.pow(2, ge), Oe = 0)); ge >= 8; M2[ee + er] = 255 & Xe, er += hr, Xe /= 256, ge -= 8) ;
            for (Oe = Oe << ge | Xe, Tt += ge; Tt > 0; M2[ee + er] = 255 & Oe, er += hr, Oe /= 256, Tt -= 8) ;
            M2[ee + er - hr] |= 128 * Sr;
          }, kw = cs;
          function cs(M2) {
            this.buf = ArrayBuffer.isView && ArrayBuffer.isView(M2) ? M2 : new Uint8Array(M2 || 0), this.pos = 0, this.type = 0, this.length = this.buf.length;
          }
          cs.Varint = 0, cs.Fixed64 = 1, cs.Bytes = 2, cs.Fixed32 = 5;
          var JO = typeof TextDecoder > "u" ? null : new TextDecoder("utf8");
          function c0(M2) {
            return M2.type === cs.Bytes ? M2.readVarint() + M2.pos : M2.pos + 1;
          }
          function w1(M2, B2, ee) {
            return ee ? 4294967296 * B2 + (M2 >>> 0) : 4294967296 * (B2 >>> 0) + (M2 >>> 0);
          }
          function QO(M2, B2, ee) {
            var ie = B2 <= 16383 ? 1 : B2 <= 2097151 ? 2 : B2 <= 268435455 ? 3 : Math.floor(Math.log(B2) / (7 * Math.LN2));
            ee.realloc(ie);
            for (var ge = ee.pos - 1; ge >= M2; ge--) ee.buf[ge + ie] = ee.buf[ge];
          }
          function soe(M2, B2) {
            for (var ee = 0; ee < M2.length; ee++) B2.writeVarint(M2[ee]);
          }
          function loe(M2, B2) {
            for (var ee = 0; ee < M2.length; ee++) B2.writeSVarint(M2[ee]);
          }
          function uoe(M2, B2) {
            for (var ee = 0; ee < M2.length; ee++) B2.writeFloat(M2[ee]);
          }
          function coe(M2, B2) {
            for (var ee = 0; ee < M2.length; ee++) B2.writeDouble(M2[ee]);
          }
          function foe(M2, B2) {
            for (var ee = 0; ee < M2.length; ee++) B2.writeBoolean(M2[ee]);
          }
          function hoe(M2, B2) {
            for (var ee = 0; ee < M2.length; ee++) B2.writeFixed32(M2[ee]);
          }
          function poe(M2, B2) {
            for (var ee = 0; ee < M2.length; ee++) B2.writeSFixed32(M2[ee]);
          }
          function doe(M2, B2) {
            for (var ee = 0; ee < M2.length; ee++) B2.writeFixed64(M2[ee]);
          }
          function voe(M2, B2) {
            for (var ee = 0; ee < M2.length; ee++) B2.writeSFixed64(M2[ee]);
          }
          function Tw(M2, B2) {
            return (M2[B2] | M2[B2 + 1] << 8 | M2[B2 + 2] << 16) + 16777216 * M2[B2 + 3];
          }
          function k1(M2, B2, ee) {
            M2[ee] = B2, M2[ee + 1] = B2 >>> 8, M2[ee + 2] = B2 >>> 16, M2[ee + 3] = B2 >>> 24;
          }
          function eP(M2, B2) {
            return (M2[B2] | M2[B2 + 1] << 8 | M2[B2 + 2] << 16) + (M2[B2 + 3] << 24);
          }
          cs.prototype = { destroy: function() {
            this.buf = null;
          }, readFields: function(M2, B2, ee) {
            for (ee = ee || this.length; this.pos < ee; ) {
              var ie = this.readVarint(), ge = ie >> 3, _e = this.pos;
              this.type = 7 & ie, M2(ge, B2, this), this.pos === _e && this.skip(ie);
            }
            return B2;
          }, readMessage: function(M2, B2) {
            return this.readFields(M2, B2, this.readVarint() + this.pos);
          }, readFixed32: function() {
            var M2 = Tw(this.buf, this.pos);
            return this.pos += 4, M2;
          }, readSFixed32: function() {
            var M2 = eP(this.buf, this.pos);
            return this.pos += 4, M2;
          }, readFixed64: function() {
            var M2 = Tw(this.buf, this.pos) + 4294967296 * Tw(this.buf, this.pos + 4);
            return this.pos += 8, M2;
          }, readSFixed64: function() {
            var M2 = Tw(this.buf, this.pos) + 4294967296 * eP(this.buf, this.pos + 4);
            return this.pos += 8, M2;
          }, readFloat: function() {
            var M2 = YO(this.buf, this.pos, true, 23, 4);
            return this.pos += 4, M2;
          }, readDouble: function() {
            var M2 = YO(this.buf, this.pos, true, 52, 8);
            return this.pos += 8, M2;
          }, readVarint: function(M2) {
            var B2, ee, ie = this.buf;
            return B2 = 127 & (ee = ie[this.pos++]), ee < 128 ? B2 : (B2 |= (127 & (ee = ie[this.pos++])) << 7, ee < 128 ? B2 : (B2 |= (127 & (ee = ie[this.pos++])) << 14, ee < 128 ? B2 : (B2 |= (127 & (ee = ie[this.pos++])) << 21, ee < 128 ? B2 : function(ge, _e, Oe) {
              var Xe, ht, Tt = Oe.buf;
              if (ht = Tt[Oe.pos++], Xe = (112 & ht) >> 4, ht < 128 || (ht = Tt[Oe.pos++], Xe |= (127 & ht) << 3, ht < 128) || (ht = Tt[Oe.pos++], Xe |= (127 & ht) << 10, ht < 128) || (ht = Tt[Oe.pos++], Xe |= (127 & ht) << 17, ht < 128) || (ht = Tt[Oe.pos++], Xe |= (127 & ht) << 24, ht < 128) || (ht = Tt[Oe.pos++], Xe |= (1 & ht) << 31, ht < 128)) return w1(ge, Xe, _e);
              throw new Error("Expected varint not more than 10 bytes");
            }(B2 |= (15 & (ee = ie[this.pos])) << 28, M2, this))));
          }, readVarint64: function() {
            return this.readVarint(true);
          }, readSVarint: function() {
            var M2 = this.readVarint();
            return M2 % 2 == 1 ? (M2 + 1) / -2 : M2 / 2;
          }, readBoolean: function() {
            return Boolean(this.readVarint());
          }, readString: function() {
            var M2 = this.readVarint() + this.pos, B2 = this.pos;
            return this.pos = M2, M2 - B2 >= 12 && JO ? function(ee, ie, ge) {
              return JO.decode(ee.subarray(ie, ge));
            }(this.buf, B2, M2) : function(ee, ie, ge) {
              for (var _e = "", Oe = ie; Oe < ge; ) {
                var Xe, ht, Tt, Dt = ee[Oe], Xt = null, ar = Dt > 239 ? 4 : Dt > 223 ? 3 : Dt > 191 ? 2 : 1;
                if (Oe + ar > ge) break;
                ar === 1 ? Dt < 128 && (Xt = Dt) : ar === 2 ? (192 & (Xe = ee[Oe + 1])) == 128 && (Xt = (31 & Dt) << 6 | 63 & Xe) <= 127 && (Xt = null) : ar === 3 ? (Xe = ee[Oe + 1], ht = ee[Oe + 2], (192 & Xe) == 128 && (192 & ht) == 128 && ((Xt = (15 & Dt) << 12 | (63 & Xe) << 6 | 63 & ht) <= 2047 || Xt >= 55296 && Xt <= 57343) && (Xt = null)) : ar === 4 && (Xe = ee[Oe + 1], ht = ee[Oe + 2], Tt = ee[Oe + 3], (192 & Xe) == 128 && (192 & ht) == 128 && (192 & Tt) == 128 && ((Xt = (15 & Dt) << 18 | (63 & Xe) << 12 | (63 & ht) << 6 | 63 & Tt) <= 65535 || Xt >= 1114112) && (Xt = null)), Xt === null ? (Xt = 65533, ar = 1) : Xt > 65535 && (Xt -= 65536, _e += String.fromCharCode(Xt >>> 10 & 1023 | 55296), Xt = 56320 | 1023 & Xt), _e += String.fromCharCode(Xt), Oe += ar;
              }
              return _e;
            }(this.buf, B2, M2);
          }, readBytes: function() {
            var M2 = this.readVarint() + this.pos, B2 = this.buf.subarray(this.pos, M2);
            return this.pos = M2, B2;
          }, readPackedVarint: function(M2, B2) {
            if (this.type !== cs.Bytes) return M2.push(this.readVarint(B2));
            var ee = c0(this);
            for (M2 = M2 || []; this.pos < ee; ) M2.push(this.readVarint(B2));
            return M2;
          }, readPackedSVarint: function(M2) {
            if (this.type !== cs.Bytes) return M2.push(this.readSVarint());
            var B2 = c0(this);
            for (M2 = M2 || []; this.pos < B2; ) M2.push(this.readSVarint());
            return M2;
          }, readPackedBoolean: function(M2) {
            if (this.type !== cs.Bytes) return M2.push(this.readBoolean());
            var B2 = c0(this);
            for (M2 = M2 || []; this.pos < B2; ) M2.push(this.readBoolean());
            return M2;
          }, readPackedFloat: function(M2) {
            if (this.type !== cs.Bytes) return M2.push(this.readFloat());
            var B2 = c0(this);
            for (M2 = M2 || []; this.pos < B2; ) M2.push(this.readFloat());
            return M2;
          }, readPackedDouble: function(M2) {
            if (this.type !== cs.Bytes) return M2.push(this.readDouble());
            var B2 = c0(this);
            for (M2 = M2 || []; this.pos < B2; ) M2.push(this.readDouble());
            return M2;
          }, readPackedFixed32: function(M2) {
            if (this.type !== cs.Bytes) return M2.push(this.readFixed32());
            var B2 = c0(this);
            for (M2 = M2 || []; this.pos < B2; ) M2.push(this.readFixed32());
            return M2;
          }, readPackedSFixed32: function(M2) {
            if (this.type !== cs.Bytes) return M2.push(this.readSFixed32());
            var B2 = c0(this);
            for (M2 = M2 || []; this.pos < B2; ) M2.push(this.readSFixed32());
            return M2;
          }, readPackedFixed64: function(M2) {
            if (this.type !== cs.Bytes) return M2.push(this.readFixed64());
            var B2 = c0(this);
            for (M2 = M2 || []; this.pos < B2; ) M2.push(this.readFixed64());
            return M2;
          }, readPackedSFixed64: function(M2) {
            if (this.type !== cs.Bytes) return M2.push(this.readSFixed64());
            var B2 = c0(this);
            for (M2 = M2 || []; this.pos < B2; ) M2.push(this.readSFixed64());
            return M2;
          }, skip: function(M2) {
            var B2 = 7 & M2;
            if (B2 === cs.Varint) for (; this.buf[this.pos++] > 127; ) ;
            else if (B2 === cs.Bytes) this.pos = this.readVarint() + this.pos;
            else if (B2 === cs.Fixed32) this.pos += 4;
            else {
              if (B2 !== cs.Fixed64) throw new Error("Unimplemented type: " + B2);
              this.pos += 8;
            }
          }, writeTag: function(M2, B2) {
            this.writeVarint(M2 << 3 | B2);
          }, realloc: function(M2) {
            for (var B2 = this.length || 16; B2 < this.pos + M2; ) B2 *= 2;
            if (B2 !== this.length) {
              var ee = new Uint8Array(B2);
              ee.set(this.buf), this.buf = ee, this.length = B2;
            }
          }, finish: function() {
            return this.length = this.pos, this.pos = 0, this.buf.subarray(0, this.length);
          }, writeFixed32: function(M2) {
            this.realloc(4), k1(this.buf, M2, this.pos), this.pos += 4;
          }, writeSFixed32: function(M2) {
            this.realloc(4), k1(this.buf, M2, this.pos), this.pos += 4;
          }, writeFixed64: function(M2) {
            this.realloc(8), k1(this.buf, -1 & M2, this.pos), k1(this.buf, Math.floor(M2 * (1 / 4294967296)), this.pos + 4), this.pos += 8;
          }, writeSFixed64: function(M2) {
            this.realloc(8), k1(this.buf, -1 & M2, this.pos), k1(this.buf, Math.floor(M2 * (1 / 4294967296)), this.pos + 4), this.pos += 8;
          }, writeVarint: function(M2) {
            (M2 = +M2 || 0) > 268435455 || M2 < 0 ? function(B2, ee) {
              var ie, ge;
              if (B2 >= 0 ? (ie = B2 % 4294967296 | 0, ge = B2 / 4294967296 | 0) : (ge = ~(-B2 / 4294967296), 4294967295 ^ (ie = ~(-B2 % 4294967296)) ? ie = ie + 1 | 0 : (ie = 0, ge = ge + 1 | 0)), B2 >= 18446744073709552e3 || B2 < -18446744073709552e3) throw new Error("Given varint doesn't fit into 10 bytes");
              ee.realloc(10), function(_e, Oe, Xe) {
                Xe.buf[Xe.pos++] = 127 & _e | 128, _e >>>= 7, Xe.buf[Xe.pos++] = 127 & _e | 128, _e >>>= 7, Xe.buf[Xe.pos++] = 127 & _e | 128, _e >>>= 7, Xe.buf[Xe.pos++] = 127 & _e | 128, _e >>>= 7, Xe.buf[Xe.pos] = 127 & _e;
              }(ie, 0, ee), function(_e, Oe) {
                var Xe = (7 & _e) << 4;
                Oe.buf[Oe.pos++] |= Xe | ((_e >>>= 3) ? 128 : 0), _e && (Oe.buf[Oe.pos++] = 127 & _e | ((_e >>>= 7) ? 128 : 0), _e && (Oe.buf[Oe.pos++] = 127 & _e | ((_e >>>= 7) ? 128 : 0), _e && (Oe.buf[Oe.pos++] = 127 & _e | ((_e >>>= 7) ? 128 : 0), _e && (Oe.buf[Oe.pos++] = 127 & _e | ((_e >>>= 7) ? 128 : 0), _e && (Oe.buf[Oe.pos++] = 127 & _e)))));
              }(ge, ee);
            }(M2, this) : (this.realloc(4), this.buf[this.pos++] = 127 & M2 | (M2 > 127 ? 128 : 0), M2 <= 127 || (this.buf[this.pos++] = 127 & (M2 >>>= 7) | (M2 > 127 ? 128 : 0), M2 <= 127 || (this.buf[this.pos++] = 127 & (M2 >>>= 7) | (M2 > 127 ? 128 : 0), M2 <= 127 || (this.buf[this.pos++] = M2 >>> 7 & 127))));
          }, writeSVarint: function(M2) {
            this.writeVarint(M2 < 0 ? 2 * -M2 - 1 : 2 * M2);
          }, writeBoolean: function(M2) {
            this.writeVarint(Boolean(M2));
          }, writeString: function(M2) {
            M2 = String(M2), this.realloc(4 * M2.length), this.pos++;
            var B2 = this.pos;
            this.pos = function(ie, ge, _e) {
              for (var Oe, Xe, ht = 0; ht < ge.length; ht++) {
                if ((Oe = ge.charCodeAt(ht)) > 55295 && Oe < 57344) {
                  if (!Xe) {
                    Oe > 56319 || ht + 1 === ge.length ? (ie[_e++] = 239, ie[_e++] = 191, ie[_e++] = 189) : Xe = Oe;
                    continue;
                  }
                  if (Oe < 56320) {
                    ie[_e++] = 239, ie[_e++] = 191, ie[_e++] = 189, Xe = Oe;
                    continue;
                  }
                  Oe = Xe - 55296 << 10 | Oe - 56320 | 65536, Xe = null;
                } else Xe && (ie[_e++] = 239, ie[_e++] = 191, ie[_e++] = 189, Xe = null);
                Oe < 128 ? ie[_e++] = Oe : (Oe < 2048 ? ie[_e++] = Oe >> 6 | 192 : (Oe < 65536 ? ie[_e++] = Oe >> 12 | 224 : (ie[_e++] = Oe >> 18 | 240, ie[_e++] = Oe >> 12 & 63 | 128), ie[_e++] = Oe >> 6 & 63 | 128), ie[_e++] = 63 & Oe | 128);
              }
              return _e;
            }(this.buf, M2, this.pos);
            var ee = this.pos - B2;
            ee >= 128 && QO(B2, ee, this), this.pos = B2 - 1, this.writeVarint(ee), this.pos += ee;
          }, writeFloat: function(M2) {
            this.realloc(4), ZO(this.buf, M2, this.pos, true, 23, 4), this.pos += 4;
          }, writeDouble: function(M2) {
            this.realloc(8), ZO(this.buf, M2, this.pos, true, 52, 8), this.pos += 8;
          }, writeBytes: function(M2) {
            var B2 = M2.length;
            this.writeVarint(B2), this.realloc(B2);
            for (var ee = 0; ee < B2; ee++) this.buf[this.pos++] = M2[ee];
          }, writeRawMessage: function(M2, B2) {
            this.pos++;
            var ee = this.pos;
            M2(B2, this);
            var ie = this.pos - ee;
            ie >= 128 && QO(ee, ie, this), this.pos = ee - 1, this.writeVarint(ie), this.pos += ie;
          }, writeMessage: function(M2, B2, ee) {
            this.writeTag(M2, cs.Bytes), this.writeRawMessage(B2, ee);
          }, writePackedVarint: function(M2, B2) {
            B2.length && this.writeMessage(M2, soe, B2);
          }, writePackedSVarint: function(M2, B2) {
            B2.length && this.writeMessage(M2, loe, B2);
          }, writePackedBoolean: function(M2, B2) {
            B2.length && this.writeMessage(M2, foe, B2);
          }, writePackedFloat: function(M2, B2) {
            B2.length && this.writeMessage(M2, uoe, B2);
          }, writePackedDouble: function(M2, B2) {
            B2.length && this.writeMessage(M2, coe, B2);
          }, writePackedFixed32: function(M2, B2) {
            B2.length && this.writeMessage(M2, hoe, B2);
          }, writePackedSFixed32: function(M2, B2) {
            B2.length && this.writeMessage(M2, poe, B2);
          }, writePackedFixed64: function(M2, B2) {
            B2.length && this.writeMessage(M2, doe, B2);
          }, writePackedSFixed64: function(M2, B2) {
            B2.length && this.writeMessage(M2, voe, B2);
          }, writeBytesField: function(M2, B2) {
            this.writeTag(M2, cs.Bytes), this.writeBytes(B2);
          }, writeFixed32Field: function(M2, B2) {
            this.writeTag(M2, cs.Fixed32), this.writeFixed32(B2);
          }, writeSFixed32Field: function(M2, B2) {
            this.writeTag(M2, cs.Fixed32), this.writeSFixed32(B2);
          }, writeFixed64Field: function(M2, B2) {
            this.writeTag(M2, cs.Fixed64), this.writeFixed64(B2);
          }, writeSFixed64Field: function(M2, B2) {
            this.writeTag(M2, cs.Fixed64), this.writeSFixed64(B2);
          }, writeVarintField: function(M2, B2) {
            this.writeTag(M2, cs.Varint), this.writeVarint(B2);
          }, writeSVarintField: function(M2, B2) {
            this.writeTag(M2, cs.Varint), this.writeSVarint(B2);
          }, writeStringField: function(M2, B2) {
            this.writeTag(M2, cs.Bytes), this.writeString(B2);
          }, writeFloatField: function(M2, B2) {
            this.writeTag(M2, cs.Fixed32), this.writeFloat(B2);
          }, writeDoubleField: function(M2, B2) {
            this.writeTag(M2, cs.Fixed64), this.writeDouble(B2);
          }, writeBooleanField: function(M2, B2) {
            this.writeVarintField(M2, Boolean(B2));
          } };
          function moe(M2, B2, ee) {
            M2 === 1 && ee.readMessage(goe, B2);
          }
          function goe(M2, B2, ee) {
            if (M2 === 3) {
              var ie = ee.readMessage(yoe, {}), ge = ie.id, _e = ie.bitmap, Oe = ie.width, Xe = ie.height, ht = ie.left, Tt = ie.top, Dt = ie.advance;
              B2.push({ id: ge, bitmap: new gm({ width: Oe + 6, height: Xe + 6 }, _e), metrics: { width: Oe, height: Xe, left: ht, top: Tt, advance: Dt } });
            }
          }
          function yoe(M2, B2, ee) {
            M2 === 1 ? B2.id = ee.readVarint() : M2 === 2 ? B2.bitmap = ee.readBytes() : M2 === 3 ? B2.width = ee.readVarint() : M2 === 4 ? B2.height = ee.readVarint() : M2 === 5 ? B2.left = ee.readSVarint() : M2 === 6 ? B2.top = ee.readSVarint() : M2 === 7 && (B2.advance = ee.readVarint());
          }
          function tP(M2) {
            for (var B2 = 0, ee = 0, ie = 0, ge = M2; ie < ge.length; ie += 1) {
              var _e = ge[ie];
              B2 += _e.w * _e.h, ee = Math.max(ee, _e.w);
            }
            M2.sort(function(Sr, Ur) {
              return Ur.h - Sr.h;
            });
            for (var Oe = [{ x: 0, y: 0, w: Math.max(Math.ceil(Math.sqrt(B2 / 0.95)), ee), h: 1 / 0 }], Xe = 0, ht = 0, Tt = 0, Dt = M2; Tt < Dt.length; Tt += 1) for (var Xt = Dt[Tt], ar = Oe.length - 1; ar >= 0; ar--) {
              var er = Oe[ar];
              if (!(Xt.w > er.w || Xt.h > er.h)) {
                if (Xt.x = er.x, Xt.y = er.y, ht = Math.max(ht, Xt.y + Xt.h), Xe = Math.max(Xe, Xt.x + Xt.w), Xt.w === er.w && Xt.h === er.h) {
                  var hr = Oe.pop();
                  ar < Oe.length && (Oe[ar] = hr);
                } else Xt.h === er.h ? (er.x += Xt.w, er.w -= Xt.w) : Xt.w === er.w ? (er.y += Xt.h, er.h -= Xt.h) : (Oe.push({ x: er.x + Xt.w, y: er.y, w: er.w - Xt.w, h: Xt.h }), er.y += Xt.h, er.h -= Xt.h);
                break;
              }
            }
            return { w: Xe, h: ht, fill: B2 / (Xe * ht) || 0 };
          }
          var Aw = function(M2, B2) {
            var ee = B2.pixelRatio, ie = B2.version, ge = B2.stretchX, _e = B2.stretchY, Oe = B2.content;
            this.paddedRect = M2, this.pixelRatio = ee, this.stretchX = ge, this.stretchY = _e, this.content = Oe, this.version = ie;
          }, cb = { tl: { configurable: true }, br: { configurable: true }, tlbr: { configurable: true }, displaySize: { configurable: true } };
          cb.tl.get = function() {
            return [this.paddedRect.x + 1, this.paddedRect.y + 1];
          }, cb.br.get = function() {
            return [this.paddedRect.x + this.paddedRect.w - 1, this.paddedRect.y + this.paddedRect.h - 1];
          }, cb.tlbr.get = function() {
            return this.tl.concat(this.br);
          }, cb.displaySize.get = function() {
            return [(this.paddedRect.w - 2) / this.pixelRatio, (this.paddedRect.h - 2) / this.pixelRatio];
          }, Object.defineProperties(Aw.prototype, cb);
          var fb = function(M2, B2) {
            var ee = {}, ie = {};
            this.haveRenderCallbacks = [];
            var ge = [];
            this.addImages(M2, ee, ge), this.addImages(B2, ie, ge);
            var _e = tP(ge), Oe = _e.w, Xe = _e.h, ht = new ef({ width: Oe || 1, height: Xe || 1 });
            for (var Tt in M2) {
              var Dt = M2[Tt], Xt = ee[Tt].paddedRect;
              ef.copy(Dt.data, ht, { x: 0, y: 0 }, { x: Xt.x + 1, y: Xt.y + 1 }, Dt.data);
            }
            for (var ar in B2) {
              var er = B2[ar], hr = ie[ar].paddedRect, Sr = hr.x + 1, Ur = hr.y + 1, Br = er.data.width, rn = er.data.height;
              ef.copy(er.data, ht, { x: 0, y: 0 }, { x: Sr, y: Ur }, er.data), ef.copy(er.data, ht, { x: 0, y: rn - 1 }, { x: Sr, y: Ur - 1 }, { width: Br, height: 1 }), ef.copy(er.data, ht, { x: 0, y: 0 }, { x: Sr, y: Ur + rn }, { width: Br, height: 1 }), ef.copy(er.data, ht, { x: Br - 1, y: 0 }, { x: Sr - 1, y: Ur }, { width: 1, height: rn }), ef.copy(er.data, ht, { x: 0, y: 0 }, { x: Sr + Br, y: Ur }, { width: 1, height: rn });
            }
            this.image = ht, this.iconPositions = ee, this.patternPositions = ie;
          };
          fb.prototype.addImages = function(M2, B2, ee) {
            for (var ie in M2) {
              var ge = M2[ie], _e = { x: 0, y: 0, w: ge.data.width + 2, h: ge.data.height + 2 };
              ee.push(_e), B2[ie] = new Aw(_e, ge), ge.hasRenderCallback && this.haveRenderCallbacks.push(ie);
            }
          }, fb.prototype.patchUpdatedImages = function(M2, B2) {
            for (var ee in M2.dispatchRenderCallbacks(this.haveRenderCallbacks), M2.updatedImages) this.patchUpdatedImage(this.iconPositions[ee], M2.getImage(ee), B2), this.patchUpdatedImage(this.patternPositions[ee], M2.getImage(ee), B2);
          }, fb.prototype.patchUpdatedImage = function(M2, B2, ee) {
            if (M2 && B2 && M2.version !== B2.version) {
              M2.version = B2.version;
              var ie = M2.tl, ge = ie[0], _e = ie[1];
              ee.update(B2.data, void 0, { x: ge, y: _e });
            }
          }, mn("ImagePosition", Aw), mn("ImageAtlas", fb);
          var Yf = { horizontal: 1, vertical: 2, horizontalOnly: 3 }, T1 = function() {
            this.scale = 1, this.fontStack = "", this.imageName = null;
          };
          T1.forText = function(M2, B2) {
            var ee = new T1();
            return ee.scale = M2 || 1, ee.fontStack = B2, ee;
          }, T1.forImage = function(M2) {
            var B2 = new T1();
            return B2.imageName = M2, B2;
          };
          var wc = function() {
            this.text = "", this.sectionIndex = [], this.sections = [], this.imageSectionID = null;
          };
          function Sw(M2, B2, ee, ie, ge, _e, Oe, Xe, ht, Tt, Dt, Xt, ar, er, hr, Sr) {
            var Ur, Br = wc.fromFeature(M2, ge);
            Xt === Yf.vertical && Br.verticalizePunctuation();
            var rn = fu.processBidirectionalText, nn = fu.processStyledBidirectionalText;
            if (rn && Br.sections.length === 1) {
              Ur = [];
              for (var cn = 0, In = rn(Br.toString(), kE(Br, Tt, _e, B2, ie, er, hr)); cn < In.length; cn += 1) {
                var Un = In[cn], ha = new wc();
                ha.text = Un, ha.sections = Br.sections;
                for (var fa = 0; fa < Un.length; fa++) ha.sectionIndex.push(0);
                Ur.push(ha);
              }
            } else if (nn) {
              Ur = [];
              for (var wa = 0, Wa = nn(Br.text, Br.sectionIndex, kE(Br, Tt, _e, B2, ie, er, hr)); wa < Wa.length; wa += 1) {
                var $a = Wa[wa], Ea = new wc();
                Ea.text = $a[0], Ea.sectionIndex = $a[1], Ea.sections = Br.sections, Ur.push(Ea);
              }
            } else Ur = function(Ha, xo) {
              for (var io = [], Co = Ha.text, Ti = 0, uo = 0, fs = xo; uo < fs.length; uo += 1) {
                var is = fs[uo];
                io.push(Ha.substring(Ti, is)), Ti = is;
              }
              return Ti < Co.length && io.push(Ha.substring(Ti, Co.length)), io;
            }(Br, kE(Br, Tt, _e, B2, ie, er, hr));
            var oi = [], ei = { positionedLines: oi, text: Br.toString(), top: Dt[1], bottom: Dt[1], left: Dt[0], right: Dt[0], writingMode: Xt, iconsInText: false, verticalizable: false };
            return function(Ha, xo, io, Co, Ti, uo, fs, is, Ns, os, nu, Fs) {
              for (var lc = 0, Su = -17, Bu = 0, jc = 0, kc = is === "right" ? 1 : is === "left" ? 0 : 0.5, au = 0, Uu = 0, zl = Ti; Uu < zl.length; Uu += 1) {
                var hu = zl[Uu];
                hu.trim();
                var Yi = hu.getMaxScale(), To = 24 * (Yi - 1), ol = { positionedGlyphs: [], lineOffset: 0 };
                Ha.positionedLines[au] = ol;
                var sl = ol.positionedGlyphs, Zs = 0;
                if (hu.length()) {
                  for (var Os = 0; Os < hu.length(); Os++) {
                    var Lo = hu.getSection(Os), ll = hu.getSectionIndex(Os), Wc = hu.getCharCode(Os), Mf = 0, Tc = null, jp = null, p0 = null, Eu = 24, Wp = !(Ns === Yf.horizontal || !nu && !li(Wc) || nu && (Ew[Wc] || (iv = Wc, Jn.Arabic(iv) || Jn["Arabic Supplement"](iv) || Jn["Arabic Extended-A"](iv) || Jn["Arabic Presentation Forms-A"](iv) || Jn["Arabic Presentation Forms-B"](iv))));
                    if (Lo.imageName) {
                      var Gp = Co[Lo.imageName];
                      if (!Gp) continue;
                      p0 = Lo.imageName, Ha.iconsInText = Ha.iconsInText || true, jp = Gp.paddedRect;
                      var $p = Gp.displaySize;
                      Lo.scale = 24 * Lo.scale / Fs, Tc = { width: $p[0], height: $p[1], left: 1, top: -3, advance: Wp ? $p[1] : $p[0] };
                      var FE = 24 - $p[1] * Lo.scale;
                      Mf = To + FE, Eu = Tc.advance;
                      var N1 = Wp ? $p[0] * Lo.scale - 24 * Yi : $p[1] * Lo.scale - 24 * Yi;
                      N1 > 0 && N1 > Zs && (Zs = N1);
                    } else {
                      var Lw = io[Lo.fontStack], _m = Lw && Lw[Wc];
                      if (_m && _m.rect) jp = _m.rect, Tc = _m.metrics;
                      else {
                        var Rw = xo[Lo.fontStack], zw = Rw && Rw[Wc];
                        if (!zw) continue;
                        Tc = zw.metrics;
                      }
                      Mf = 24 * (Yi - Lo.scale);
                    }
                    Wp ? (Ha.verticalizable = true, sl.push({ glyph: Wc, imageName: p0, x: lc, y: Su + Mf, vertical: Wp, scale: Lo.scale, fontStack: Lo.fontStack, sectionIndex: ll, metrics: Tc, rect: jp }), lc += Eu * Lo.scale + os) : (sl.push({ glyph: Wc, imageName: p0, x: lc, y: Su + Mf, vertical: Wp, scale: Lo.scale, fontStack: Lo.fontStack, sectionIndex: ll, metrics: Tc, rect: jp }), lc += Tc.advance * Lo.scale + os);
                  }
                  if (sl.length !== 0) {
                    var Bw = lc - os;
                    Bu = Math.max(Bw, Bu), boe(sl, 0, sl.length - 1, kc, Zs);
                  }
                  lc = 0;
                  var Uw = uo * Yi + Zs;
                  ol.lineOffset = Math.max(Zs, To), Su += Uw, jc = Math.max(Uw, jc), ++au;
                } else Su += uo, ++au;
              }
              var iv, F14 = Su - -17, Vw = TE(fs), O1 = Vw.horizontalAlign, ov = Vw.verticalAlign;
              (function(db, jw, Ww, Gw, vb, $w, mb, Hw, gb) {
                var qw = (jw - Ww) * vb, P1 = 0;
                P1 = $w !== mb ? -Hw * Gw - -17 : (-Gw * gb + 0.5) * mb;
                for (var L1 = 0, R1 = db; L1 < R1.length; L1 += 1) for (var Xw = R1[L1], z1 = 0, yb = Xw.positionedGlyphs; z1 < yb.length; z1 += 1) {
                  var B1 = yb[z1];
                  B1.x += qw, B1.y += P1;
                }
              })(Ha.positionedLines, kc, O1, ov, Bu, jc, uo, F14, Ti.length), Ha.top += -ov * F14, Ha.bottom = Ha.top + F14, Ha.left += -O1 * Bu, Ha.right = Ha.left + Bu;
            }(ei, B2, ee, ie, Ur, Oe, Xe, ht, Xt, Tt, ar, Sr), !function(Ha) {
              for (var xo = 0, io = Ha; xo < io.length; xo += 1) if (io[xo].positionedGlyphs.length !== 0) return false;
              return true;
            }(oi) && ei;
          }
          wc.fromFeature = function(M2, B2) {
            for (var ee = new wc(), ie = 0; ie < M2.sections.length; ie++) {
              var ge = M2.sections[ie];
              ge.image ? ee.addImageSection(ge) : ee.addTextSection(ge, B2);
            }
            return ee;
          }, wc.prototype.length = function() {
            return this.text.length;
          }, wc.prototype.getSection = function(M2) {
            return this.sections[this.sectionIndex[M2]];
          }, wc.prototype.getSectionIndex = function(M2) {
            return this.sectionIndex[M2];
          }, wc.prototype.getCharCode = function(M2) {
            return this.text.charCodeAt(M2);
          }, wc.prototype.verticalizePunctuation = function() {
            this.text = function(M2) {
              for (var B2 = "", ee = 0; ee < M2.length; ee++) {
                var ie = M2.charCodeAt(ee + 1) || null, ge = M2.charCodeAt(ee - 1) || null;
                (!ie || !Ki(ie) || ub[M2[ee + 1]]) && (!ge || !Ki(ge) || ub[M2[ee - 1]]) && ub[M2[ee]] ? B2 += ub[M2[ee]] : B2 += M2[ee];
              }
              return B2;
            }(this.text);
          }, wc.prototype.trim = function() {
            for (var M2 = 0, B2 = 0; B2 < this.text.length && Ew[this.text.charCodeAt(B2)]; B2++) M2++;
            for (var ee = this.text.length, ie = this.text.length - 1; ie >= 0 && ie >= M2 && Ew[this.text.charCodeAt(ie)]; ie--) ee--;
            this.text = this.text.substring(M2, ee), this.sectionIndex = this.sectionIndex.slice(M2, ee);
          }, wc.prototype.substring = function(M2, B2) {
            var ee = new wc();
            return ee.text = this.text.substring(M2, B2), ee.sectionIndex = this.sectionIndex.slice(M2, B2), ee.sections = this.sections, ee;
          }, wc.prototype.toString = function() {
            return this.text;
          }, wc.prototype.getMaxScale = function() {
            var M2 = this;
            return this.sectionIndex.reduce(function(B2, ee) {
              return Math.max(B2, M2.sections[ee].scale);
            }, 0);
          }, wc.prototype.addTextSection = function(M2, B2) {
            this.text += M2.text, this.sections.push(T1.forText(M2.scale, M2.fontStack || B2));
            for (var ee = this.sections.length - 1, ie = 0; ie < M2.text.length; ++ie) this.sectionIndex.push(ee);
          }, wc.prototype.addImageSection = function(M2) {
            var B2 = M2.image ? M2.image.name : "";
            if (B2.length !== 0) {
              var ee = this.getNextImageSectionCharCode();
              ee ? (this.text += String.fromCharCode(ee), this.sections.push(T1.forImage(B2)), this.sectionIndex.push(this.sections.length - 1)) : E2("Reached maximum number of images 6401");
            } else E2("Can't add FormattedSection with an empty image.");
          }, wc.prototype.getNextImageSectionCharCode = function() {
            return this.imageSectionID ? this.imageSectionID >= 63743 ? null : ++this.imageSectionID : (this.imageSectionID = 57344, this.imageSectionID);
          };
          var Ew = { 9: true, 10: true, 11: true, 12: true, 13: true, 32: true }, Cf = {};
          function rP(M2, B2, ee, ie, ge, _e) {
            if (B2.imageName) {
              var Oe = ie[B2.imageName];
              return Oe ? Oe.displaySize[0] * B2.scale * 24 / _e + ge : 0;
            }
            var Xe = ee[B2.fontStack], ht = Xe && Xe[M2];
            return ht ? ht.metrics.advance * B2.scale + ge : 0;
          }
          function nP(M2, B2, ee, ie) {
            var ge = Math.pow(M2 - B2, 2);
            return ie ? M2 < B2 ? ge / 2 : 2 * ge : ge + Math.abs(ee) * ee;
          }
          function xoe(M2, B2, ee) {
            var ie = 0;
            return M2 === 10 && (ie -= 1e4), ee && (ie += 150), M2 !== 40 && M2 !== 65288 || (ie += 50), B2 !== 41 && B2 !== 65289 || (ie += 50), ie;
          }
          function aP(M2, B2, ee, ie, ge, _e) {
            for (var Oe = null, Xe = nP(B2, ee, ge, _e), ht = 0, Tt = ie; ht < Tt.length; ht += 1) {
              var Dt = Tt[ht], Xt = nP(B2 - Dt.x, ee, ge, _e) + Dt.badness;
              Xt <= Xe && (Oe = Dt, Xe = Xt);
            }
            return { index: M2, x: B2, priorBreak: Oe, badness: Xe };
          }
          function kE(M2, B2, ee, ie, ge, _e, Oe) {
            if (_e !== "point") return [];
            if (!M2) return [];
            for (var Xe, ht = [], Tt = function(Ur, Br, rn, nn, cn, In) {
              for (var Un = 0, ha = 0; ha < Ur.length(); ha++) {
                var fa = Ur.getSection(ha);
                Un += rP(Ur.getCharCode(ha), fa, nn, cn, Br, In);
              }
              return Un / Math.max(1, Math.ceil(Un / rn));
            }(M2, B2, ee, ie, ge, Oe), Dt = M2.text.indexOf("\u200B") >= 0, Xt = 0, ar = 0; ar < M2.length(); ar++) {
              var er = M2.getSection(ar), hr = M2.getCharCode(ar);
              if (Ew[hr] || (Xt += rP(hr, er, ie, ge, B2, Oe)), ar < M2.length() - 1) {
                var Sr = !!(!((Xe = hr) < 11904) && (Jn["Bopomofo Extended"](Xe) || Jn.Bopomofo(Xe) || Jn["CJK Compatibility Forms"](Xe) || Jn["CJK Compatibility Ideographs"](Xe) || Jn["CJK Compatibility"](Xe) || Jn["CJK Radicals Supplement"](Xe) || Jn["CJK Strokes"](Xe) || Jn["CJK Symbols and Punctuation"](Xe) || Jn["CJK Unified Ideographs Extension A"](Xe) || Jn["CJK Unified Ideographs"](Xe) || Jn["Enclosed CJK Letters and Months"](Xe) || Jn["Halfwidth and Fullwidth Forms"](Xe) || Jn.Hiragana(Xe) || Jn["Ideographic Description Characters"](Xe) || Jn["Kangxi Radicals"](Xe) || Jn["Katakana Phonetic Extensions"](Xe) || Jn.Katakana(Xe) || Jn["Vertical Forms"](Xe) || Jn["Yi Radicals"](Xe) || Jn["Yi Syllables"](Xe)));
                (Cf[hr] || Sr || er.imageName) && ht.push(aP(ar + 1, Xt, Tt, ht, xoe(hr, M2.getCharCode(ar + 1), Sr && Dt), false));
              }
            }
            return function Ur(Br) {
              return Br ? Ur(Br.priorBreak).concat(Br.index) : [];
            }(aP(M2.length(), Xt, Tt, ht, 0, true));
          }
          function TE(M2) {
            var B2 = 0.5, ee = 0.5;
            switch (M2) {
              case "right":
              case "top-right":
              case "bottom-right":
                B2 = 1;
                break;
              case "left":
              case "top-left":
              case "bottom-left":
                B2 = 0;
            }
            switch (M2) {
              case "bottom":
              case "bottom-right":
              case "bottom-left":
                ee = 1;
                break;
              case "top":
              case "top-right":
              case "top-left":
                ee = 0;
            }
            return { horizontalAlign: B2, verticalAlign: ee };
          }
          function boe(M2, B2, ee, ie, ge) {
            if (ie || ge) for (var _e = M2[ee], Oe = _e.metrics.advance * _e.scale, Xe = (M2[ee].x + Oe) * ie, ht = B2; ht <= ee; ht++) M2[ht].x -= Xe, M2[ht].y += ge;
          }
          function iP(M2, B2, ee, ie, ge, _e) {
            var Oe, Xe = M2.image;
            if (Xe.content) {
              var ht = Xe.content, Tt = Xe.pixelRatio || 1;
              Oe = [ht[0] / Tt, ht[1] / Tt, Xe.displaySize[0] - ht[2] / Tt, Xe.displaySize[1] - ht[3] / Tt];
            }
            var Dt, Xt, ar, er, hr = B2.left * _e, Sr = B2.right * _e;
            ee === "width" || ee === "both" ? (er = ge[0] + hr - ie[3], Xt = ge[0] + Sr + ie[1]) : Xt = (er = ge[0] + (hr + Sr - Xe.displaySize[0]) / 2) + Xe.displaySize[0];
            var Ur = B2.top * _e, Br = B2.bottom * _e;
            return ee === "height" || ee === "both" ? (Dt = ge[1] + Ur - ie[0], ar = ge[1] + Br + ie[2]) : ar = (Dt = ge[1] + (Ur + Br - Xe.displaySize[1]) / 2) + Xe.displaySize[1], { image: Xe, top: Dt, right: Xt, bottom: ar, left: er, collisionPadding: Oe };
          }
          Cf[10] = true, Cf[32] = true, Cf[38] = true, Cf[40] = true, Cf[41] = true, Cf[43] = true, Cf[45] = true, Cf[47] = true, Cf[173] = true, Cf[183] = true, Cf[8203] = true, Cf[8208] = true, Cf[8211] = true, Cf[8231] = true;
          var A1 = function(M2) {
            function B2(ee, ie, ge, _e) {
              M2.call(this, ee, ie), this.angle = ge, _e !== void 0 && (this.segment = _e);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype.clone = function() {
              return new B2(this.x, this.y, this.angle, this.segment);
            }, B2;
          }(f);
          mn("Anchor", A1);
          function AE(M2, B2) {
            var ee = B2.expression;
            if (ee.kind === "constant") return { kind: "constant", layoutSize: ee.evaluate(new Oo(M2 + 1)) };
            if (ee.kind === "source") return { kind: "source" };
            for (var ie = ee.zoomStops, ge = ee.interpolationType, _e = 0; _e < ie.length && ie[_e] <= M2; ) _e++;
            for (var Oe = _e = Math.max(0, _e - 1); Oe < ie.length && ie[Oe] < M2 + 1; ) Oe++;
            Oe = Math.min(ie.length - 1, Oe);
            var Xe = ie[_e], ht = ie[Oe];
            return ee.kind === "composite" ? { kind: "composite", minZoom: Xe, maxZoom: ht, interpolationType: ge } : { kind: "camera", minZoom: Xe, maxZoom: ht, minSize: ee.evaluate(new Oo(Xe)), maxSize: ee.evaluate(new Oo(ht)), interpolationType: ge };
          }
          function oP(M2, B2, ee) {
            var ie = B2.uSize, ge = B2.uSizeT, _e = ee.lowerSize, Oe = ee.upperSize;
            return M2.kind === "source" ? _e / 128 : M2.kind === "composite" ? ka(_e / 128, Oe / 128, ge) : ie;
          }
          function sP(M2, B2) {
            var ee = 0, ie = 0;
            if (M2.kind === "constant") ie = M2.layoutSize;
            else if (M2.kind !== "source") {
              var ge = M2.interpolationType, _e = M2.minZoom, Oe = M2.maxZoom, Xe = ge ? v(po.interpolationFactor(ge, B2, _e, Oe), 0, 1) : 0;
              M2.kind === "camera" ? ie = ka(M2.minSize, M2.maxSize, Xe) : ee = Xe;
            }
            return { uSizeT: ee, uSize: ie };
          }
          var _oe = Object.freeze({ __proto__: null, getSizeData: AE, evaluateSizeForFeature: oP, evaluateSizeForZoom: sP, SIZE_PACK_FACTOR: 128 });
          function lP(M2, B2, ee, ie, ge) {
            if (B2.segment === void 0) return true;
            for (var _e = B2, Oe = B2.segment + 1, Xe = 0; Xe > -ee / 2; ) {
              if (--Oe < 0) return false;
              Xe -= M2[Oe].dist(_e), _e = M2[Oe];
            }
            Xe += M2[Oe].dist(M2[Oe + 1]), Oe++;
            for (var ht = [], Tt = 0; Xe < ee / 2; ) {
              var Dt = M2[Oe - 1], Xt = M2[Oe], ar = M2[Oe + 1];
              if (!ar) return false;
              var er = Dt.angleTo(Xt) - Xt.angleTo(ar);
              for (er = Math.abs((er + 3 * Math.PI) % (2 * Math.PI) - Math.PI), ht.push({ distance: Xe, angleDelta: er }), Tt += er; Xe - ht[0].distance > ie; ) Tt -= ht.shift().angleDelta;
              if (Tt > ge) return false;
              Oe++, Xe += Xt.dist(ar);
            }
            return true;
          }
          function uP(M2) {
            for (var B2 = 0, ee = 0; ee < M2.length - 1; ee++) B2 += M2[ee].dist(M2[ee + 1]);
            return B2;
          }
          function cP(M2, B2, ee) {
            return M2 ? 0.6 * B2 * ee : 0;
          }
          function fP(M2, B2) {
            return Math.max(M2 ? M2.right - M2.left : 0, B2 ? B2.right - B2.left : 0);
          }
          function woe(M2, B2, ee, ie, ge, _e) {
            for (var Oe = cP(ee, ge, _e), Xe = fP(ee, ie) * _e, ht = 0, Tt = uP(M2) / 2, Dt = 0; Dt < M2.length - 1; Dt++) {
              var Xt = M2[Dt], ar = M2[Dt + 1], er = Xt.dist(ar);
              if (ht + er > Tt) {
                var hr = (Tt - ht) / er, Sr = ka(Xt.x, ar.x, hr), Ur = ka(Xt.y, ar.y, hr), Br = new A1(Sr, Ur, ar.angleTo(Xt), Dt);
                return Br._round(), !Oe || lP(M2, Br, Xe, Oe, B2) ? Br : void 0;
              }
              ht += er;
            }
          }
          function koe(M2, B2, ee, ie, ge, _e, Oe, Xe, ht) {
            var Tt = cP(ie, _e, Oe), Dt = fP(ie, ge), Xt = Dt * Oe, ar = M2[0].x === 0 || M2[0].x === ht || M2[0].y === 0 || M2[0].y === ht;
            return B2 - Xt < B2 / 4 && (B2 = Xt + B2 / 4), function er(hr, Sr, Ur, Br, rn, nn, cn, In, Un) {
              for (var ha = nn / 2, fa = uP(hr), wa = 0, Wa = Sr - Ur, $a = [], Ea = 0; Ea < hr.length - 1; Ea++) {
                for (var oi = hr[Ea], ei = hr[Ea + 1], Ha = oi.dist(ei), xo = ei.angleTo(oi); Wa + Ur < wa + Ha; ) {
                  var io = ((Wa += Ur) - wa) / Ha, Co = ka(oi.x, ei.x, io), Ti = ka(oi.y, ei.y, io);
                  if (Co >= 0 && Co < Un && Ti >= 0 && Ti < Un && Wa - ha >= 0 && Wa + ha <= fa) {
                    var uo = new A1(Co, Ti, xo, Ea);
                    uo._round(), Br && !lP(hr, uo, nn, Br, rn) || $a.push(uo);
                  }
                }
                wa += Ha;
              }
              return In || $a.length || cn || ($a = er(hr, wa / 2, Ur, Br, rn, nn, cn, true, Un)), $a;
            }(M2, ar ? B2 / 2 * Xe % B2 : (Dt / 2 + 2 * _e) * Oe * Xe % B2, B2, Tt, ee, Xt, ar, false, ht);
          }
          function hP(M2, B2, ee, ie, ge) {
            for (var _e = [], Oe = 0; Oe < M2.length; Oe++) for (var Xe = M2[Oe], ht = void 0, Tt = 0; Tt < Xe.length - 1; Tt++) {
              var Dt = Xe[Tt], Xt = Xe[Tt + 1];
              Dt.x < B2 && Xt.x < B2 || (Dt.x < B2 ? Dt = new f(B2, Dt.y + (Xt.y - Dt.y) * ((B2 - Dt.x) / (Xt.x - Dt.x)))._round() : Xt.x < B2 && (Xt = new f(B2, Dt.y + (Xt.y - Dt.y) * ((B2 - Dt.x) / (Xt.x - Dt.x)))._round()), Dt.y < ee && Xt.y < ee || (Dt.y < ee ? Dt = new f(Dt.x + (Xt.x - Dt.x) * ((ee - Dt.y) / (Xt.y - Dt.y)), ee)._round() : Xt.y < ee && (Xt = new f(Dt.x + (Xt.x - Dt.x) * ((ee - Dt.y) / (Xt.y - Dt.y)), ee)._round()), Dt.x >= ie && Xt.x >= ie || (Dt.x >= ie ? Dt = new f(ie, Dt.y + (Xt.y - Dt.y) * ((ie - Dt.x) / (Xt.x - Dt.x)))._round() : Xt.x >= ie && (Xt = new f(ie, Dt.y + (Xt.y - Dt.y) * ((ie - Dt.x) / (Xt.x - Dt.x)))._round()), Dt.y >= ge && Xt.y >= ge || (Dt.y >= ge ? Dt = new f(Dt.x + (Xt.x - Dt.x) * ((ge - Dt.y) / (Xt.y - Dt.y)), ge)._round() : Xt.y >= ge && (Xt = new f(Dt.x + (Xt.x - Dt.x) * ((ge - Dt.y) / (Xt.y - Dt.y)), ge)._round()), ht && Dt.equals(ht[ht.length - 1]) || (ht = [Dt], _e.push(ht)), ht.push(Xt)))));
            }
            return _e;
          }
          function pP(M2, B2, ee, ie) {
            var ge = [], _e = M2.image, Oe = _e.pixelRatio, Xe = _e.paddedRect.w - 2, ht = _e.paddedRect.h - 2, Tt = M2.right - M2.left, Dt = M2.bottom - M2.top, Xt = _e.stretchX || [[0, Xe]], ar = _e.stretchY || [[0, ht]], er = function(uo, fs) {
              return uo + fs[1] - fs[0];
            }, hr = Xt.reduce(er, 0), Sr = ar.reduce(er, 0), Ur = Xe - hr, Br = ht - Sr, rn = 0, nn = hr, cn = 0, In = Sr, Un = 0, ha = Ur, fa = 0, wa = Br;
            if (_e.content && ie) {
              var Wa = _e.content;
              rn = Dw(Xt, 0, Wa[0]), cn = Dw(ar, 0, Wa[1]), nn = Dw(Xt, Wa[0], Wa[2]), In = Dw(ar, Wa[1], Wa[3]), Un = Wa[0] - rn, fa = Wa[1] - cn, ha = Wa[2] - Wa[0] - nn, wa = Wa[3] - Wa[1] - In;
            }
            var $a = function(uo, fs, is, Ns) {
              var os = Cw(uo.stretch - rn, nn, Tt, M2.left), nu = Mw(uo.fixed - Un, ha, uo.stretch, hr), Fs = Cw(fs.stretch - cn, In, Dt, M2.top), lc = Mw(fs.fixed - fa, wa, fs.stretch, Sr), Su = Cw(is.stretch - rn, nn, Tt, M2.left), Bu = Mw(is.fixed - Un, ha, is.stretch, hr), jc = Cw(Ns.stretch - cn, In, Dt, M2.top), kc = Mw(Ns.fixed - fa, wa, Ns.stretch, Sr), au = new f(os, Fs), Uu = new f(Su, Fs), zl = new f(Su, jc), hu = new f(os, jc), Yi = new f(nu / Oe, lc / Oe), To = new f(Bu / Oe, kc / Oe), ol = B2 * Math.PI / 180;
              if (ol) {
                var sl = Math.sin(ol), Zs = Math.cos(ol), Os = [Zs, -sl, sl, Zs];
                au._matMult(Os), Uu._matMult(Os), hu._matMult(Os), zl._matMult(Os);
              }
              var Lo = uo.stretch + uo.fixed, ll = is.stretch + is.fixed, Wc = fs.stretch + fs.fixed, Mf = Ns.stretch + Ns.fixed;
              return { tl: au, tr: Uu, bl: hu, br: zl, tex: { x: _e.paddedRect.x + 1 + Lo, y: _e.paddedRect.y + 1 + Wc, w: ll - Lo, h: Mf - Wc }, writingMode: void 0, glyphOffset: [0, 0], sectionIndex: 0, pixelOffsetTL: Yi, pixelOffsetBR: To, minFontScaleX: ha / Oe / Tt, minFontScaleY: wa / Oe / Dt, isSDF: ee };
            };
            if (ie && (_e.stretchX || _e.stretchY)) for (var Ea = dP(Xt, Ur, hr), oi = dP(ar, Br, Sr), ei = 0; ei < Ea.length - 1; ei++) for (var Ha = Ea[ei], xo = Ea[ei + 1], io = 0; io < oi.length - 1; io++) {
              var Co = oi[io], Ti = oi[io + 1];
              ge.push($a(Ha, Co, xo, Ti));
            }
            else ge.push($a({ fixed: 0, stretch: -1 }, { fixed: 0, stretch: -1 }, { fixed: 0, stretch: Xe + 1 }, { fixed: 0, stretch: ht + 1 }));
            return ge;
          }
          function Dw(M2, B2, ee) {
            for (var ie = 0, ge = 0, _e = M2; ge < _e.length; ge += 1) {
              var Oe = _e[ge];
              ie += Math.max(B2, Math.min(ee, Oe[1])) - Math.max(B2, Math.min(ee, Oe[0]));
            }
            return ie;
          }
          function dP(M2, B2, ee) {
            for (var ie = [{ fixed: -1, stretch: 0 }], ge = 0, _e = M2; ge < _e.length; ge += 1) {
              var Oe = _e[ge], Xe = Oe[0], ht = Oe[1], Tt = ie[ie.length - 1];
              ie.push({ fixed: Xe - Tt.stretch, stretch: Tt.stretch }), ie.push({ fixed: Xe - Tt.stretch, stretch: Tt.stretch + (ht - Xe) });
            }
            return ie.push({ fixed: B2 + 1, stretch: ee }), ie;
          }
          function Cw(M2, B2, ee, ie) {
            return M2 / B2 * ee + ie;
          }
          function Mw(M2, B2, ee, ie) {
            return M2 - B2 * ee / ie;
          }
          var Iw = function(M2, B2, ee, ie, ge, _e, Oe, Xe, ht, Tt) {
            if (this.boxStartIndex = M2.length, ht) {
              var Dt = _e.top, Xt = _e.bottom, ar = _e.collisionPadding;
              ar && (Dt -= ar[1], Xt += ar[3]);
              var er = Xt - Dt;
              er > 0 && (er = Math.max(10, er), this.circleDiameter = er);
            } else {
              var hr = _e.top * Oe - Xe, Sr = _e.bottom * Oe + Xe, Ur = _e.left * Oe - Xe, Br = _e.right * Oe + Xe, rn = _e.collisionPadding;
              if (rn && (Ur -= rn[0] * Oe, hr -= rn[1] * Oe, Br += rn[2] * Oe, Sr += rn[3] * Oe), Tt) {
                var nn = new f(Ur, hr), cn = new f(Br, hr), In = new f(Ur, Sr), Un = new f(Br, Sr), ha = Tt * Math.PI / 180;
                nn._rotate(ha), cn._rotate(ha), In._rotate(ha), Un._rotate(ha), Ur = Math.min(nn.x, cn.x, In.x, Un.x), Br = Math.max(nn.x, cn.x, In.x, Un.x), hr = Math.min(nn.y, cn.y, In.y, Un.y), Sr = Math.max(nn.y, cn.y, In.y, Un.y);
              }
              M2.emplaceBack(B2.x, B2.y, Ur, hr, Br, Sr, ee, ie, ge);
            }
            this.boxEndIndex = M2.length;
          }, S1 = function(M2, B2) {
            if (M2 === void 0 && (M2 = []), B2 === void 0 && (B2 = Toe), this.data = M2, this.length = this.data.length, this.compare = B2, this.length > 0) for (var ee = (this.length >> 1) - 1; ee >= 0; ee--) this._down(ee);
          };
          function Toe(M2, B2) {
            return M2 < B2 ? -1 : M2 > B2 ? 1 : 0;
          }
          function Aoe(M2, B2, ee) {
            B2 === void 0 && (B2 = 1), ee === void 0 && (ee = false);
            for (var ie = 1 / 0, ge = 1 / 0, _e = -1 / 0, Oe = -1 / 0, Xe = M2[0], ht = 0; ht < Xe.length; ht++) {
              var Tt = Xe[ht];
              (!ht || Tt.x < ie) && (ie = Tt.x), (!ht || Tt.y < ge) && (ge = Tt.y), (!ht || Tt.x > _e) && (_e = Tt.x), (!ht || Tt.y > Oe) && (Oe = Tt.y);
            }
            var Dt = _e - ie, Xt = Oe - ge, ar = Math.min(Dt, Xt), er = ar / 2, hr = new S1([], Soe);
            if (ar === 0) return new f(ie, ge);
            for (var Sr = ie; Sr < _e; Sr += ar) for (var Ur = ge; Ur < Oe; Ur += ar) hr.push(new E1(Sr + er, Ur + er, er, M2));
            for (var Br = function(cn) {
              for (var In = 0, Un = 0, ha = 0, fa = cn[0], wa = 0, Wa = fa.length, $a = Wa - 1; wa < Wa; $a = wa++) {
                var Ea = fa[wa], oi = fa[$a], ei = Ea.x * oi.y - oi.x * Ea.y;
                Un += (Ea.x + oi.x) * ei, ha += (Ea.y + oi.y) * ei, In += 3 * ei;
              }
              return new E1(Un / In, ha / In, 0, cn);
            }(M2), rn = hr.length; hr.length; ) {
              var nn = hr.pop();
              (nn.d > Br.d || !Br.d) && (Br = nn, ee && console.log("found best %d after %d probes", Math.round(1e4 * nn.d) / 1e4, rn)), nn.max - Br.d <= B2 || (er = nn.h / 2, hr.push(new E1(nn.p.x - er, nn.p.y - er, er, M2)), hr.push(new E1(nn.p.x + er, nn.p.y - er, er, M2)), hr.push(new E1(nn.p.x - er, nn.p.y + er, er, M2)), hr.push(new E1(nn.p.x + er, nn.p.y + er, er, M2)), rn += 4);
            }
            return ee && (console.log("num probes: " + rn), console.log("best distance: " + Br.d)), Br.p;
          }
          function Soe(M2, B2) {
            return B2.max - M2.max;
          }
          function E1(M2, B2, ee, ie) {
            this.p = new f(M2, B2), this.h = ee, this.d = function(ge, _e) {
              for (var Oe = false, Xe = 1 / 0, ht = 0; ht < _e.length; ht++) for (var Tt = _e[ht], Dt = 0, Xt = Tt.length, ar = Xt - 1; Dt < Xt; ar = Dt++) {
                var er = Tt[Dt], hr = Tt[ar];
                er.y > ge.y != hr.y > ge.y && ge.x < (hr.x - er.x) * (ge.y - er.y) / (hr.y - er.y) + er.x && (Oe = !Oe), Xe = Math.min(Xe, u0(ge, er, hr));
              }
              return (Oe ? 1 : -1) * Math.sqrt(Xe);
            }(this.p, ie), this.max = this.d + this.h * Math.SQRT2;
          }
          S1.prototype.push = function(M2) {
            this.data.push(M2), this.length++, this._up(this.length - 1);
          }, S1.prototype.pop = function() {
            if (this.length !== 0) {
              var M2 = this.data[0], B2 = this.data.pop();
              return this.length--, this.length > 0 && (this.data[0] = B2, this._down(0)), M2;
            }
          }, S1.prototype.peek = function() {
            return this.data[0];
          }, S1.prototype._up = function(M2) {
            for (var B2 = this.data, ee = this.compare, ie = B2[M2]; M2 > 0; ) {
              var ge = M2 - 1 >> 1, _e = B2[ge];
              if (ee(ie, _e) >= 0) break;
              B2[M2] = _e, M2 = ge;
            }
            B2[M2] = ie;
          }, S1.prototype._down = function(M2) {
            for (var B2 = this.data, ee = this.compare, ie = this.length >> 1, ge = B2[M2]; M2 < ie; ) {
              var _e = 1 + (M2 << 1), Oe = B2[_e], Xe = _e + 1;
              if (Xe < this.length && ee(B2[Xe], Oe) < 0 && (_e = Xe, Oe = B2[Xe]), ee(Oe, ge) >= 0) break;
              B2[M2] = Oe, M2 = _e;
            }
            B2[M2] = ge;
          };
          var SE = Number.POSITIVE_INFINITY;
          function vP(M2, B2) {
            return B2[1] !== SE ? function(ee, ie, ge) {
              var _e = 0, Oe = 0;
              switch (ie = Math.abs(ie), ge = Math.abs(ge), ee) {
                case "top-right":
                case "top-left":
                case "top":
                  Oe = ge - 7;
                  break;
                case "bottom-right":
                case "bottom-left":
                case "bottom":
                  Oe = 7 - ge;
              }
              switch (ee) {
                case "top-right":
                case "bottom-right":
                case "right":
                  _e = -ie;
                  break;
                case "top-left":
                case "bottom-left":
                case "left":
                  _e = ie;
              }
              return [_e, Oe];
            }(M2, B2[0], B2[1]) : function(ee, ie) {
              var ge = 0, _e = 0;
              ie < 0 && (ie = 0);
              var Oe = ie / Math.sqrt(2);
              switch (ee) {
                case "top-right":
                case "top-left":
                  _e = Oe - 7;
                  break;
                case "bottom-right":
                case "bottom-left":
                  _e = 7 - Oe;
                  break;
                case "bottom":
                  _e = 7 - ie;
                  break;
                case "top":
                  _e = ie - 7;
              }
              switch (ee) {
                case "top-right":
                case "bottom-right":
                  ge = -Oe;
                  break;
                case "top-left":
                case "bottom-left":
                  ge = Oe;
                  break;
                case "left":
                  ge = ie;
                  break;
                case "right":
                  ge = -ie;
              }
              return [ge, _e];
            }(M2, B2[0]);
          }
          function EE(M2) {
            switch (M2) {
              case "right":
              case "top-right":
              case "bottom-right":
                return "right";
              case "left":
              case "top-left":
              case "bottom-left":
                return "left";
            }
            return "center";
          }
          function mP(M2, B2, ee, ie, ge, _e, Oe, Xe, ht, Tt, Dt, Xt, ar, er, hr) {
            var Sr = function(cn, In, Un, ha, fa, wa, Wa, $a) {
              for (var Ea = ha.layout.get("text-rotate").evaluate(wa, {}) * Math.PI / 180, oi = [], ei = 0, Ha = In.positionedLines; ei < Ha.length; ei += 1) for (var xo = Ha[ei], io = 0, Co = xo.positionedGlyphs; io < Co.length; io += 1) {
                var Ti = Co[io];
                if (Ti.rect) {
                  var uo = Ti.rect || {}, fs = 4, is = true, Ns = 1, os = 0, nu = (fa || $a) && Ti.vertical, Fs = Ti.metrics.advance * Ti.scale / 2;
                  if ($a && In.verticalizable) {
                    var lc = 24 * (Ti.scale - 1), Su = (24 - Ti.metrics.width * Ti.scale) / 2;
                    os = xo.lineOffset / 2 - (Ti.imageName ? -Su : lc);
                  }
                  if (Ti.imageName) {
                    var Bu = Wa[Ti.imageName];
                    is = Bu.sdf, fs = 1 / (Ns = Bu.pixelRatio);
                  }
                  var jc = fa ? [Ti.x + Fs, Ti.y] : [0, 0], kc = fa ? [0, 0] : [Ti.x + Fs + Un[0], Ti.y + Un[1] - os], au = [0, 0];
                  nu && (au = kc, kc = [0, 0]);
                  var Uu = (Ti.metrics.left - fs) * Ti.scale - Fs + kc[0], zl = (-Ti.metrics.top - fs) * Ti.scale + kc[1], hu = Uu + uo.w * Ti.scale / Ns, Yi = zl + uo.h * Ti.scale / Ns, To = new f(Uu, zl), ol = new f(hu, zl), sl = new f(Uu, Yi), Zs = new f(hu, Yi);
                  if (nu) {
                    var Os = new f(-Fs, Fs - -17), Lo = -Math.PI / 2, ll = 12 - Fs, Wc = Ti.imageName ? ll : 0, Mf = new f(22 - ll, -Wc), Tc = new (Function.prototype.bind.apply(f, [null].concat(au)))();
                    To._rotateAround(Lo, Os)._add(Mf)._add(Tc), ol._rotateAround(Lo, Os)._add(Mf)._add(Tc), sl._rotateAround(Lo, Os)._add(Mf)._add(Tc), Zs._rotateAround(Lo, Os)._add(Mf)._add(Tc);
                  }
                  if (Ea) {
                    var jp = Math.sin(Ea), p0 = Math.cos(Ea), Eu = [p0, -jp, jp, p0];
                    To._matMult(Eu), ol._matMult(Eu), sl._matMult(Eu), Zs._matMult(Eu);
                  }
                  var Wp = new f(0, 0), Gp = new f(0, 0);
                  oi.push({ tl: To, tr: ol, bl: sl, br: Zs, tex: uo, writingMode: In.writingMode, glyphOffset: jc, sectionIndex: Ti.sectionIndex, isSDF: is, pixelOffsetTL: Wp, pixelOffsetBR: Gp, minFontScaleX: 0, minFontScaleY: 0 });
                }
              }
              return oi;
            }(0, ee, Xe, ge, _e, Oe, ie, M2.allowVerticalPlacement), Ur = M2.textSizeData, Br = null;
            Ur.kind === "source" ? (Br = [128 * ge.layout.get("text-size").evaluate(Oe, {})])[0] > 32640 && E2(M2.layerIds[0] + ': Value for "text-size" is >= 255. Reduce your "text-size".') : Ur.kind === "composite" && ((Br = [128 * er.compositeTextSizes[0].evaluate(Oe, {}, hr), 128 * er.compositeTextSizes[1].evaluate(Oe, {}, hr)])[0] > 32640 || Br[1] > 32640) && E2(M2.layerIds[0] + ': Value for "text-size" is >= 255. Reduce your "text-size".'), M2.addSymbols(M2.text, Sr, Br, Xe, _e, Oe, Tt, B2, ht.lineStartIndex, ht.lineLength, ar, hr);
            for (var rn = 0, nn = Dt; rn < nn.length; rn += 1) Xt[nn[rn]] = M2.text.placedSymbolArray.length - 1;
            return 4 * Sr.length;
          }
          function gP(M2) {
            for (var B2 in M2) return M2[B2];
            return null;
          }
          function Eoe(M2, B2, ee, ie) {
            var ge = M2.compareText;
            if (B2 in ge) {
              for (var _e = ge[B2], Oe = _e.length - 1; Oe >= 0; Oe--) if (ie.dist(_e[Oe]) < ee) return true;
            } else ge[B2] = [];
            return ge[B2].push(ie), false;
          }
          var Doe = _1.VectorTileFeature.types, Coe = [{ name: "a_fade_opacity", components: 1, type: "Uint8", offset: 0 }];
          function Nw(M2, B2, ee, ie, ge, _e, Oe, Xe, ht, Tt, Dt, Xt, ar) {
            var er = Xe ? Math.min(32640, Math.round(Xe[0])) : 0, hr = Xe ? Math.min(32640, Math.round(Xe[1])) : 0;
            M2.emplaceBack(B2, ee, Math.round(32 * ie), Math.round(32 * ge), _e, Oe, (er << 1) + (ht ? 1 : 0), hr, 16 * Tt, 16 * Dt, 256 * Xt, 256 * ar);
          }
          function DE(M2, B2, ee) {
            M2.emplaceBack(B2.x, B2.y, ee), M2.emplaceBack(B2.x, B2.y, ee), M2.emplaceBack(B2.x, B2.y, ee), M2.emplaceBack(B2.x, B2.y, ee);
          }
          function Moe(M2) {
            for (var B2 = 0, ee = M2.sections; B2 < ee.length; B2 += 1) if (Oa(ee[B2].text)) return true;
            return false;
          }
          var D1 = function(M2) {
            this.layoutVertexArray = new zp(), this.indexArray = new Ql(), this.programConfigurations = M2, this.segments = new qt(), this.dynamicLayoutVertexArray = new Kf(), this.opacityVertexArray = new J0(), this.placedSymbolArray = new et();
          };
          D1.prototype.isEmpty = function() {
            return this.layoutVertexArray.length === 0 && this.indexArray.length === 0 && this.dynamicLayoutVertexArray.length === 0 && this.opacityVertexArray.length === 0;
          }, D1.prototype.upload = function(M2, B2, ee, ie) {
            this.isEmpty() || (ee && (this.layoutVertexBuffer = M2.createVertexBuffer(this.layoutVertexArray, wE.members), this.indexBuffer = M2.createIndexBuffer(this.indexArray, B2), this.dynamicLayoutVertexBuffer = M2.createVertexBuffer(this.dynamicLayoutVertexArray, noe.members, true), this.opacityVertexBuffer = M2.createVertexBuffer(this.opacityVertexArray, Coe, true), this.opacityVertexBuffer.itemSize = 1), (ee || ie) && this.programConfigurations.upload(M2));
          }, D1.prototype.destroy = function() {
            this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy(), this.dynamicLayoutVertexBuffer.destroy(), this.opacityVertexBuffer.destroy());
          }, mn("SymbolBuffers", D1);
          var hb = function(M2, B2, ee) {
            this.layoutVertexArray = new M2(), this.layoutAttributes = B2, this.indexArray = new ee(), this.segments = new qt(), this.collisionVertexArray = new Bp();
          };
          hb.prototype.upload = function(M2) {
            this.layoutVertexBuffer = M2.createVertexBuffer(this.layoutVertexArray, this.layoutAttributes), this.indexBuffer = M2.createIndexBuffer(this.indexArray), this.collisionVertexBuffer = M2.createVertexBuffer(this.collisionVertexArray, aoe.members, true);
          }, hb.prototype.destroy = function() {
            this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.segments.destroy(), this.collisionVertexBuffer.destroy());
          }, mn("CollisionBuffers", hb);
          var Yo = function(M2) {
            this.collisionBoxArray = M2.collisionBoxArray, this.zoom = M2.zoom, this.overscaling = M2.overscaling, this.layers = M2.layers, this.layerIds = this.layers.map(function(Oe) {
              return Oe.id;
            }), this.index = M2.index, this.pixelRatio = M2.pixelRatio, this.sourceLayerIndex = M2.sourceLayerIndex, this.hasPattern = false, this.hasRTLText = false, this.sortKeyRanges = [], this.collisionCircleArray = [], this.placementInvProjMatrix = rb([]), this.placementViewportMatrix = rb([]);
            var B2 = this.layers[0]._unevaluatedLayout._values;
            this.textSizeData = AE(this.zoom, B2["text-size"]), this.iconSizeData = AE(this.zoom, B2["icon-size"]);
            var ee = this.layers[0].layout, ie = ee.get("symbol-sort-key"), ge = ee.get("symbol-z-order");
            this.sortFeaturesByKey = ge !== "viewport-y" && ie.constantOr(1) !== void 0;
            var _e = ge === "viewport-y" || ge === "auto" && !this.sortFeaturesByKey;
            this.sortFeaturesByY = _e && (ee.get("text-allow-overlap") || ee.get("icon-allow-overlap") || ee.get("text-ignore-placement") || ee.get("icon-ignore-placement")), ee.get("symbol-placement") === "point" && (this.writingModes = ee.get("text-writing-mode").map(function(Oe) {
              return Yf[Oe];
            })), this.stateDependentLayerIds = this.layers.filter(function(Oe) {
              return Oe.isStateDependent();
            }).map(function(Oe) {
              return Oe.id;
            }), this.sourceID = M2.sourceID;
          };
          Yo.prototype.createArrays = function() {
            this.text = new D1(new as(wE.members, this.layers, this.zoom, function(M2) {
              return /^text/.test(M2);
            })), this.icon = new D1(new as(wE.members, this.layers, this.zoom, function(M2) {
              return /^icon/.test(M2);
            })), this.glyphOffsetArray = new It(), this.lineVertexArray = new Rt(), this.symbolInstances = new bt();
          }, Yo.prototype.calculateGlyphDependencies = function(M2, B2, ee, ie, ge) {
            for (var _e = 0; _e < M2.length; _e++) if (B2[M2.charCodeAt(_e)] = true, (ee || ie) && ge) {
              var Oe = ub[M2.charAt(_e)];
              Oe && (B2[Oe.charCodeAt(0)] = true);
            }
          }, Yo.prototype.populate = function(M2, B2, ee) {
            var ie = this.layers[0], ge = ie.layout, _e = ge.get("text-font"), Oe = ge.get("text-field"), Xe = ge.get("icon-image"), ht = (Oe.value.kind !== "constant" || Oe.value.value instanceof $r && !Oe.value.value.isEmpty() || Oe.value.value.toString().length > 0) && (_e.value.kind !== "constant" || _e.value.value.length > 0), Tt = Xe.value.kind !== "constant" || !!Xe.value.value || Object.keys(Xe.parameters).length > 0, Dt = ge.get("symbol-sort-key");
            if (this.features = [], ht || Tt) {
              for (var Xt = B2.iconDependencies, ar = B2.glyphDependencies, er = B2.availableImages, hr = new Oo(this.zoom), Sr = 0, Ur = M2; Sr < Ur.length; Sr += 1) {
                var Br = Ur[Sr], rn = Br.feature, nn = Br.id, cn = Br.index, In = Br.sourceLayerIndex, Un = ie._featureFilter.needGeometry, ha = { type: rn.type, id: nn, properties: rn.properties, geometry: Un ? us(rn) : [] };
                if (ie._featureFilter.filter(hr, ha, ee)) {
                  Un || (ha.geometry = us(rn));
                  var fa = void 0;
                  if (ht) {
                    var wa = ie.getValueAndResolveTokens("text-field", ha, ee, er), Wa = $r.factory(wa);
                    Moe(Wa) && (this.hasRTLText = true), (!this.hasRTLText || Sl() === "unavailable" || this.hasRTLText && fu.isParsed()) && (fa = ooe(Wa, ie, ha));
                  }
                  var $a = void 0;
                  if (Tt) {
                    var Ea = ie.getValueAndResolveTokens("icon-image", ha, ee, er);
                    $a = Ea instanceof Ar ? Ea : Ar.fromString(Ea);
                  }
                  if (fa || $a) {
                    var oi = this.sortFeaturesByKey ? Dt.evaluate(ha, {}, ee) : void 0, ei = { id: nn, text: fa, icon: $a, index: cn, sourceLayerIndex: In, geometry: us(rn), properties: rn.properties, type: Doe[rn.type], sortKey: oi };
                    if (this.features.push(ei), $a && (Xt[$a.name] = true), fa) {
                      var Ha = _e.evaluate(ha, {}, ee).join(","), xo = ge.get("text-rotation-alignment") === "map" && ge.get("symbol-placement") !== "point";
                      this.allowVerticalPlacement = this.writingModes && this.writingModes.indexOf(Yf.vertical) >= 0;
                      for (var io = 0, Co = fa.sections; io < Co.length; io += 1) {
                        var Ti = Co[io];
                        if (Ti.image) Xt[Ti.image.name] = true;
                        else {
                          var uo = Xi(fa.toString()), fs = Ti.fontStack || Ha, is = ar[fs] = ar[fs] || {};
                          this.calculateGlyphDependencies(Ti.text, is, xo, this.allowVerticalPlacement, uo);
                        }
                      }
                    }
                  }
                }
              }
              ge.get("symbol-placement") === "line" && (this.features = function(Ns) {
                var os = {}, nu = {}, Fs = [], lc = 0;
                function Su(Zs) {
                  Fs.push(Ns[Zs]), lc++;
                }
                function Bu(Zs, Os, Lo) {
                  var ll = nu[Zs];
                  return delete nu[Zs], nu[Os] = ll, Fs[ll].geometry[0].pop(), Fs[ll].geometry[0] = Fs[ll].geometry[0].concat(Lo[0]), ll;
                }
                function jc(Zs, Os, Lo) {
                  var ll = os[Os];
                  return delete os[Os], os[Zs] = ll, Fs[ll].geometry[0].shift(), Fs[ll].geometry[0] = Lo[0].concat(Fs[ll].geometry[0]), ll;
                }
                function kc(Zs, Os, Lo) {
                  var ll = Lo ? Os[0][Os[0].length - 1] : Os[0][0];
                  return Zs + ":" + ll.x + ":" + ll.y;
                }
                for (var au = 0; au < Ns.length; au++) {
                  var Uu = Ns[au], zl = Uu.geometry, hu = Uu.text ? Uu.text.toString() : null;
                  if (hu) {
                    var Yi = kc(hu, zl), To = kc(hu, zl, true);
                    if (Yi in nu && To in os && nu[Yi] !== os[To]) {
                      var ol = jc(Yi, To, zl), sl = Bu(Yi, To, Fs[ol].geometry);
                      delete os[Yi], delete nu[To], nu[kc(hu, Fs[sl].geometry, true)] = sl, Fs[ol].geometry = null;
                    } else Yi in nu ? Bu(Yi, To, zl) : To in os ? jc(Yi, To, zl) : (Su(au), os[Yi] = lc - 1, nu[To] = lc - 1);
                  } else Su(au);
                }
                return Fs.filter(function(Zs) {
                  return Zs.geometry;
                });
              }(this.features)), this.sortFeaturesByKey && this.features.sort(function(Ns, os) {
                return Ns.sortKey - os.sortKey;
              });
            }
          }, Yo.prototype.update = function(M2, B2, ee) {
            this.stateDependentLayers.length && (this.text.programConfigurations.updatePaintArrays(M2, B2, this.layers, ee), this.icon.programConfigurations.updatePaintArrays(M2, B2, this.layers, ee));
          }, Yo.prototype.isEmpty = function() {
            return this.symbolInstances.length === 0 && !this.hasRTLText;
          }, Yo.prototype.uploadPending = function() {
            return !this.uploaded || this.text.programConfigurations.needsUpload || this.icon.programConfigurations.needsUpload;
          }, Yo.prototype.upload = function(M2) {
            !this.uploaded && this.hasDebugData() && (this.textCollisionBox.upload(M2), this.iconCollisionBox.upload(M2)), this.text.upload(M2, this.sortFeaturesByY, !this.uploaded, this.text.programConfigurations.needsUpload), this.icon.upload(M2, this.sortFeaturesByY, !this.uploaded, this.icon.programConfigurations.needsUpload), this.uploaded = true;
          }, Yo.prototype.destroyDebugData = function() {
            this.textCollisionBox.destroy(), this.iconCollisionBox.destroy();
          }, Yo.prototype.destroy = function() {
            this.text.destroy(), this.icon.destroy(), this.hasDebugData() && this.destroyDebugData();
          }, Yo.prototype.addToLineVertexArray = function(M2, B2) {
            var ee = this.lineVertexArray.length;
            if (M2.segment !== void 0) {
              for (var ie = M2.dist(B2[M2.segment + 1]), ge = M2.dist(B2[M2.segment]), _e = {}, Oe = M2.segment + 1; Oe < B2.length; Oe++) _e[Oe] = { x: B2[Oe].x, y: B2[Oe].y, tileUnitDistanceFromAnchor: ie }, Oe < B2.length - 1 && (ie += B2[Oe + 1].dist(B2[Oe]));
              for (var Xe = M2.segment || 0; Xe >= 0; Xe--) _e[Xe] = { x: B2[Xe].x, y: B2[Xe].y, tileUnitDistanceFromAnchor: ge }, Xe > 0 && (ge += B2[Xe - 1].dist(B2[Xe]));
              for (var ht = 0; ht < B2.length; ht++) {
                var Tt = _e[ht];
                this.lineVertexArray.emplaceBack(Tt.x, Tt.y, Tt.tileUnitDistanceFromAnchor);
              }
            }
            return { lineStartIndex: ee, lineLength: this.lineVertexArray.length - ee };
          }, Yo.prototype.addSymbols = function(M2, B2, ee, ie, ge, _e, Oe, Xe, ht, Tt, Dt, Xt) {
            for (var ar = M2.indexArray, er = M2.layoutVertexArray, hr = M2.segments.prepareSegment(4 * B2.length, er, ar, _e.sortKey), Sr = this.glyphOffsetArray.length, Ur = hr.vertexLength, Br = this.allowVerticalPlacement && Oe === Yf.vertical ? Math.PI / 2 : 0, rn = _e.text && _e.text.sections, nn = 0; nn < B2.length; nn++) {
              var cn = B2[nn], In = cn.tl, Un = cn.tr, ha = cn.bl, fa = cn.br, wa = cn.tex, Wa = cn.pixelOffsetTL, $a = cn.pixelOffsetBR, Ea = cn.minFontScaleX, oi = cn.minFontScaleY, ei = cn.glyphOffset, Ha = cn.isSDF, xo = cn.sectionIndex, io = hr.vertexLength, Co = ei[1];
              Nw(er, Xe.x, Xe.y, In.x, Co + In.y, wa.x, wa.y, ee, Ha, Wa.x, Wa.y, Ea, oi), Nw(er, Xe.x, Xe.y, Un.x, Co + Un.y, wa.x + wa.w, wa.y, ee, Ha, $a.x, Wa.y, Ea, oi), Nw(er, Xe.x, Xe.y, ha.x, Co + ha.y, wa.x, wa.y + wa.h, ee, Ha, Wa.x, $a.y, Ea, oi), Nw(er, Xe.x, Xe.y, fa.x, Co + fa.y, wa.x + wa.w, wa.y + wa.h, ee, Ha, $a.x, $a.y, Ea, oi), DE(M2.dynamicLayoutVertexArray, Xe, Br), ar.emplaceBack(io, io + 1, io + 2), ar.emplaceBack(io + 1, io + 2, io + 3), hr.vertexLength += 4, hr.primitiveLength += 2, this.glyphOffsetArray.emplaceBack(ei[0]), nn !== B2.length - 1 && xo === B2[nn + 1].sectionIndex || M2.programConfigurations.populatePaintArrays(er.length, _e, _e.index, {}, Xt, rn && rn[xo]);
            }
            M2.placedSymbolArray.emplaceBack(Xe.x, Xe.y, Sr, this.glyphOffsetArray.length - Sr, Ur, ht, Tt, Xe.segment, ee ? ee[0] : 0, ee ? ee[1] : 0, ie[0], ie[1], Oe, 0, false, 0, Dt);
          }, Yo.prototype._addCollisionDebugVertex = function(M2, B2, ee, ie, ge, _e) {
            return B2.emplaceBack(0, 0), M2.emplaceBack(ee.x, ee.y, ie, ge, Math.round(_e.x), Math.round(_e.y));
          }, Yo.prototype.addCollisionDebugVertices = function(M2, B2, ee, ie, ge, _e, Oe) {
            var Xe = ge.segments.prepareSegment(4, ge.layoutVertexArray, ge.indexArray), ht = Xe.vertexLength, Tt = ge.layoutVertexArray, Dt = ge.collisionVertexArray, Xt = Oe.anchorX, ar = Oe.anchorY;
            this._addCollisionDebugVertex(Tt, Dt, _e, Xt, ar, new f(M2, B2)), this._addCollisionDebugVertex(Tt, Dt, _e, Xt, ar, new f(ee, B2)), this._addCollisionDebugVertex(Tt, Dt, _e, Xt, ar, new f(ee, ie)), this._addCollisionDebugVertex(Tt, Dt, _e, Xt, ar, new f(M2, ie)), Xe.vertexLength += 4;
            var er = ge.indexArray;
            er.emplaceBack(ht, ht + 1), er.emplaceBack(ht + 1, ht + 2), er.emplaceBack(ht + 2, ht + 3), er.emplaceBack(ht + 3, ht), Xe.primitiveLength += 4;
          }, Yo.prototype.addDebugCollisionBoxes = function(M2, B2, ee, ie) {
            for (var ge = M2; ge < B2; ge++) {
              var _e = this.collisionBoxArray.get(ge), Oe = _e.x1, Xe = _e.y1, ht = _e.x2, Tt = _e.y2;
              this.addCollisionDebugVertices(Oe, Xe, ht, Tt, ie ? this.textCollisionBox : this.iconCollisionBox, _e.anchorPoint, ee);
            }
          }, Yo.prototype.generateCollisionDebugBuffers = function() {
            this.hasDebugData() && this.destroyDebugData(), this.textCollisionBox = new hb(Th, KO.members, G2), this.iconCollisionBox = new hb(Th, KO.members, G2);
            for (var M2 = 0; M2 < this.symbolInstances.length; M2++) {
              var B2 = this.symbolInstances.get(M2);
              this.addDebugCollisionBoxes(B2.textBoxStartIndex, B2.textBoxEndIndex, B2, true), this.addDebugCollisionBoxes(B2.verticalTextBoxStartIndex, B2.verticalTextBoxEndIndex, B2, true), this.addDebugCollisionBoxes(B2.iconBoxStartIndex, B2.iconBoxEndIndex, B2, false), this.addDebugCollisionBoxes(B2.verticalIconBoxStartIndex, B2.verticalIconBoxEndIndex, B2, false);
            }
          }, Yo.prototype._deserializeCollisionBoxesForSymbol = function(M2, B2, ee, ie, ge, _e, Oe, Xe, ht) {
            for (var Tt = {}, Dt = B2; Dt < ee; Dt++) {
              var Xt = M2.get(Dt);
              Tt.textBox = { x1: Xt.x1, y1: Xt.y1, x2: Xt.x2, y2: Xt.y2, anchorPointX: Xt.anchorPointX, anchorPointY: Xt.anchorPointY }, Tt.textFeatureIndex = Xt.featureIndex;
              break;
            }
            for (var ar = ie; ar < ge; ar++) {
              var er = M2.get(ar);
              Tt.verticalTextBox = { x1: er.x1, y1: er.y1, x2: er.x2, y2: er.y2, anchorPointX: er.anchorPointX, anchorPointY: er.anchorPointY }, Tt.verticalTextFeatureIndex = er.featureIndex;
              break;
            }
            for (var hr = _e; hr < Oe; hr++) {
              var Sr = M2.get(hr);
              Tt.iconBox = { x1: Sr.x1, y1: Sr.y1, x2: Sr.x2, y2: Sr.y2, anchorPointX: Sr.anchorPointX, anchorPointY: Sr.anchorPointY }, Tt.iconFeatureIndex = Sr.featureIndex;
              break;
            }
            for (var Ur = Xe; Ur < ht; Ur++) {
              var Br = M2.get(Ur);
              Tt.verticalIconBox = { x1: Br.x1, y1: Br.y1, x2: Br.x2, y2: Br.y2, anchorPointX: Br.anchorPointX, anchorPointY: Br.anchorPointY }, Tt.verticalIconFeatureIndex = Br.featureIndex;
              break;
            }
            return Tt;
          }, Yo.prototype.deserializeCollisionBoxes = function(M2) {
            this.collisionArrays = [];
            for (var B2 = 0; B2 < this.symbolInstances.length; B2++) {
              var ee = this.symbolInstances.get(B2);
              this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(M2, ee.textBoxStartIndex, ee.textBoxEndIndex, ee.verticalTextBoxStartIndex, ee.verticalTextBoxEndIndex, ee.iconBoxStartIndex, ee.iconBoxEndIndex, ee.verticalIconBoxStartIndex, ee.verticalIconBoxEndIndex));
            }
          }, Yo.prototype.hasTextData = function() {
            return this.text.segments.get().length > 0;
          }, Yo.prototype.hasIconData = function() {
            return this.icon.segments.get().length > 0;
          }, Yo.prototype.hasDebugData = function() {
            return this.textCollisionBox && this.iconCollisionBox;
          }, Yo.prototype.hasTextCollisionBoxData = function() {
            return this.hasDebugData() && this.textCollisionBox.segments.get().length > 0;
          }, Yo.prototype.hasIconCollisionBoxData = function() {
            return this.hasDebugData() && this.iconCollisionBox.segments.get().length > 0;
          }, Yo.prototype.addIndicesForPlacedSymbol = function(M2, B2) {
            for (var ee = M2.placedSymbolArray.get(B2), ie = ee.vertexStartIndex + 4 * ee.numGlyphs, ge = ee.vertexStartIndex; ge < ie; ge += 4) M2.indexArray.emplaceBack(ge, ge + 1, ge + 2), M2.indexArray.emplaceBack(ge + 1, ge + 2, ge + 3);
          }, Yo.prototype.getSortedSymbolIndexes = function(M2) {
            if (this.sortedAngle === M2 && this.symbolInstanceIndexes !== void 0) return this.symbolInstanceIndexes;
            for (var B2 = Math.sin(M2), ee = Math.cos(M2), ie = [], ge = [], _e = [], Oe = 0; Oe < this.symbolInstances.length; ++Oe) {
              _e.push(Oe);
              var Xe = this.symbolInstances.get(Oe);
              ie.push(0 | Math.round(B2 * Xe.anchorX + ee * Xe.anchorY)), ge.push(Xe.featureIndex);
            }
            return _e.sort(function(ht, Tt) {
              return ie[ht] - ie[Tt] || ge[Tt] - ge[ht];
            }), _e;
          }, Yo.prototype.addToSortKeyRanges = function(M2, B2) {
            var ee = this.sortKeyRanges[this.sortKeyRanges.length - 1];
            ee && ee.sortKey === B2 ? ee.symbolInstanceEnd = M2 + 1 : this.sortKeyRanges.push({ sortKey: B2, symbolInstanceStart: M2, symbolInstanceEnd: M2 + 1 });
          }, Yo.prototype.sortFeatures = function(M2) {
            var B2 = this;
            if (this.sortFeaturesByY && this.sortedAngle !== M2 && !(this.text.segments.get().length > 1 || this.icon.segments.get().length > 1)) {
              this.symbolInstanceIndexes = this.getSortedSymbolIndexes(M2), this.sortedAngle = M2, this.text.indexArray.clear(), this.icon.indexArray.clear(), this.featureSortOrder = [];
              for (var ee = 0, ie = this.symbolInstanceIndexes; ee < ie.length; ee += 1) {
                var ge = ie[ee], _e = this.symbolInstances.get(ge);
                this.featureSortOrder.push(_e.featureIndex), [_e.rightJustifiedTextSymbolIndex, _e.centerJustifiedTextSymbolIndex, _e.leftJustifiedTextSymbolIndex].forEach(function(Oe, Xe, ht) {
                  Oe >= 0 && ht.indexOf(Oe) === Xe && B2.addIndicesForPlacedSymbol(B2.text, Oe);
                }), _e.verticalPlacedTextSymbolIndex >= 0 && this.addIndicesForPlacedSymbol(this.text, _e.verticalPlacedTextSymbolIndex), _e.placedIconSymbolIndex >= 0 && this.addIndicesForPlacedSymbol(this.icon, _e.placedIconSymbolIndex), _e.verticalPlacedIconSymbolIndex >= 0 && this.addIndicesForPlacedSymbol(this.icon, _e.verticalPlacedIconSymbolIndex);
              }
              this.text.indexBuffer && this.text.indexBuffer.updateData(this.text.indexArray), this.icon.indexBuffer && this.icon.indexBuffer.updateData(this.icon.indexArray);
            }
          }, mn("SymbolBucket", Yo, { omit: ["layers", "collisionBoxArray", "features", "compareText"] }), Yo.MAX_GLYPHS = 65535, Yo.addDynamicAttributes = DE;
          var Ioe = new ic({ "symbol-placement": new Ya(Ve.layout_symbol["symbol-placement"]), "symbol-spacing": new Ya(Ve.layout_symbol["symbol-spacing"]), "symbol-avoid-edges": new Ya(Ve.layout_symbol["symbol-avoid-edges"]), "symbol-sort-key": new yi(Ve.layout_symbol["symbol-sort-key"]), "symbol-z-order": new Ya(Ve.layout_symbol["symbol-z-order"]), "icon-allow-overlap": new Ya(Ve.layout_symbol["icon-allow-overlap"]), "icon-ignore-placement": new Ya(Ve.layout_symbol["icon-ignore-placement"]), "icon-optional": new Ya(Ve.layout_symbol["icon-optional"]), "icon-rotation-alignment": new Ya(Ve.layout_symbol["icon-rotation-alignment"]), "icon-size": new yi(Ve.layout_symbol["icon-size"]), "icon-text-fit": new Ya(Ve.layout_symbol["icon-text-fit"]), "icon-text-fit-padding": new Ya(Ve.layout_symbol["icon-text-fit-padding"]), "icon-image": new yi(Ve.layout_symbol["icon-image"]), "icon-rotate": new yi(Ve.layout_symbol["icon-rotate"]), "icon-padding": new Ya(Ve.layout_symbol["icon-padding"]), "icon-keep-upright": new Ya(Ve.layout_symbol["icon-keep-upright"]), "icon-offset": new yi(Ve.layout_symbol["icon-offset"]), "icon-anchor": new yi(Ve.layout_symbol["icon-anchor"]), "icon-pitch-alignment": new Ya(Ve.layout_symbol["icon-pitch-alignment"]), "text-pitch-alignment": new Ya(Ve.layout_symbol["text-pitch-alignment"]), "text-rotation-alignment": new Ya(Ve.layout_symbol["text-rotation-alignment"]), "text-field": new yi(Ve.layout_symbol["text-field"]), "text-font": new yi(Ve.layout_symbol["text-font"]), "text-size": new yi(Ve.layout_symbol["text-size"]), "text-max-width": new yi(Ve.layout_symbol["text-max-width"]), "text-line-height": new Ya(Ve.layout_symbol["text-line-height"]), "text-letter-spacing": new yi(Ve.layout_symbol["text-letter-spacing"]), "text-justify": new yi(Ve.layout_symbol["text-justify"]), "text-radial-offset": new yi(Ve.layout_symbol["text-radial-offset"]), "text-variable-anchor": new Ya(Ve.layout_symbol["text-variable-anchor"]), "text-anchor": new yi(Ve.layout_symbol["text-anchor"]), "text-max-angle": new Ya(Ve.layout_symbol["text-max-angle"]), "text-writing-mode": new Ya(Ve.layout_symbol["text-writing-mode"]), "text-rotate": new yi(Ve.layout_symbol["text-rotate"]), "text-padding": new Ya(Ve.layout_symbol["text-padding"]), "text-keep-upright": new Ya(Ve.layout_symbol["text-keep-upright"]), "text-transform": new yi(Ve.layout_symbol["text-transform"]), "text-offset": new yi(Ve.layout_symbol["text-offset"]), "text-allow-overlap": new Ya(Ve.layout_symbol["text-allow-overlap"]), "text-ignore-placement": new Ya(Ve.layout_symbol["text-ignore-placement"]), "text-optional": new Ya(Ve.layout_symbol["text-optional"]) }), CE = { paint: new ic({ "icon-opacity": new yi(Ve.paint_symbol["icon-opacity"]), "icon-color": new yi(Ve.paint_symbol["icon-color"]), "icon-halo-color": new yi(Ve.paint_symbol["icon-halo-color"]), "icon-halo-width": new yi(Ve.paint_symbol["icon-halo-width"]), "icon-halo-blur": new yi(Ve.paint_symbol["icon-halo-blur"]), "icon-translate": new Ya(Ve.paint_symbol["icon-translate"]), "icon-translate-anchor": new Ya(Ve.paint_symbol["icon-translate-anchor"]), "text-opacity": new yi(Ve.paint_symbol["text-opacity"]), "text-color": new yi(Ve.paint_symbol["text-color"], { runtimeType: ze, getOverride: function(M2) {
            return M2.textColor;
          }, hasOverride: function(M2) {
            return !!M2.textColor;
          } }), "text-halo-color": new yi(Ve.paint_symbol["text-halo-color"]), "text-halo-width": new yi(Ve.paint_symbol["text-halo-width"]), "text-halo-blur": new yi(Ve.paint_symbol["text-halo-blur"]), "text-translate": new Ya(Ve.paint_symbol["text-translate"]), "text-translate-anchor": new Ya(Ve.paint_symbol["text-translate-anchor"]) }), layout: Ioe }, C1 = function(M2) {
            this.type = M2.property.overrides ? M2.property.overrides.runtimeType : Ne, this.defaultValue = M2;
          };
          C1.prototype.evaluate = function(M2) {
            if (M2.formattedSection) {
              var B2 = this.defaultValue.property.overrides;
              if (B2 && B2.hasOverride(M2.formattedSection)) return B2.getOverride(M2.formattedSection);
            }
            return M2.feature && M2.featureState ? this.defaultValue.evaluate(M2.feature, M2.featureState) : this.defaultValue.property.specification.default;
          }, C1.prototype.eachChild = function(M2) {
            this.defaultValue.isConstant() || M2(this.defaultValue.value._styleExpression.expression);
          }, C1.prototype.outputDefined = function() {
            return false;
          }, C1.prototype.serialize = function() {
            return null;
          }, mn("FormatSectionOverride", C1, { omit: ["defaultValue"] });
          var Noe = function(M2) {
            function B2(ee) {
              M2.call(this, ee, CE);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype.recalculate = function(ee, ie) {
              if (M2.prototype.recalculate.call(this, ee, ie), this.layout.get("icon-rotation-alignment") === "auto" && (this.layout.get("symbol-placement") !== "point" ? this.layout._values["icon-rotation-alignment"] = "map" : this.layout._values["icon-rotation-alignment"] = "viewport"), this.layout.get("text-rotation-alignment") === "auto" && (this.layout.get("symbol-placement") !== "point" ? this.layout._values["text-rotation-alignment"] = "map" : this.layout._values["text-rotation-alignment"] = "viewport"), this.layout.get("text-pitch-alignment") === "auto" && (this.layout._values["text-pitch-alignment"] = this.layout.get("text-rotation-alignment")), this.layout.get("icon-pitch-alignment") === "auto" && (this.layout._values["icon-pitch-alignment"] = this.layout.get("icon-rotation-alignment")), this.layout.get("symbol-placement") === "point") {
                var ge = this.layout.get("text-writing-mode");
                if (ge) {
                  for (var _e = [], Oe = 0, Xe = ge; Oe < Xe.length; Oe += 1) {
                    var ht = Xe[Oe];
                    _e.indexOf(ht) < 0 && _e.push(ht);
                  }
                  this.layout._values["text-writing-mode"] = _e;
                } else this.layout._values["text-writing-mode"] = ["horizontal"];
              }
              this._setPaintOverrides();
            }, B2.prototype.getValueAndResolveTokens = function(ee, ie, ge, _e) {
              var Oe = this.layout.get(ee).evaluate(ie, {}, ge, _e), Xe = this._unevaluatedLayout._values[ee];
              return Xe.isDataDriven() || or(Xe.value) || !Oe ? Oe : function(ht, Tt) {
                return Tt.replace(/{([^{}]+)}/g, function(Dt, Xt) {
                  return Xt in ht ? String(ht[Xt]) : "";
                });
              }(ie.properties, Oe);
            }, B2.prototype.createBucket = function(ee) {
              return new Yo(ee);
            }, B2.prototype.queryRadius = function() {
              return 0;
            }, B2.prototype.queryIntersectsFeature = function() {
              return false;
            }, B2.prototype._setPaintOverrides = function() {
              for (var ee = 0, ie = CE.paint.overridableProperties; ee < ie.length; ee += 1) {
                var ge = ie[ee];
                if (B2.hasPaintOverride(this.layout, ge)) {
                  var _e = this.paint.get(ge), Oe = new C1(_e), Xe = new ir(Oe, _e.property.specification), ht = null;
                  ht = _e.value.kind === "constant" || _e.value.kind === "source" ? new fr("source", Xe) : new wr("composite", Xe, _e.value.zoomStops, _e.value._interpolationType), this.paint._values[ge] = new Ys(_e.property, ht, _e.parameters);
                }
              }
            }, B2.prototype._handleOverridablePaintPropertyUpdate = function(ee, ie, ge) {
              return !(!this.layout || ie.isDataDriven() || ge.isDataDriven()) && B2.hasPaintOverride(this.layout, ee);
            }, B2.hasPaintOverride = function(ee, ie) {
              var ge = ee.get("text-field"), _e = CE.paint.properties[ie], Oe = false, Xe = function(Dt) {
                for (var Xt = 0, ar = Dt; Xt < ar.length; Xt += 1) {
                  var er = ar[Xt];
                  if (_e.overrides && _e.overrides.hasOverride(er)) return void (Oe = true);
                }
              };
              if (ge.value.kind === "constant" && ge.value.value instanceof $r) Xe(ge.value.value.sections);
              else if (ge.value.kind === "source") {
                var ht = function(Dt) {
                  if (!Oe) if (Dt instanceof Xn && wn(Dt.value) === tt) {
                    var Xt = Dt.value;
                    Xe(Xt.sections);
                  } else Dt instanceof Nr ? Xe(Dt.sections) : Dt.eachChild(ht);
                }, Tt = ge.value;
                Tt._styleExpression && ht(Tt._styleExpression.expression);
              }
              return Oe;
            }, B2;
          }(Vc), Foe = { paint: new ic({ "background-color": new Ya(Ve.paint_background["background-color"]), "background-pattern": new Md(Ve.paint_background["background-pattern"]), "background-opacity": new Ya(Ve.paint_background["background-opacity"]) }) }, Ooe = function(M2) {
            function B2(ee) {
              M2.call(this, ee, Foe);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2;
          }(Vc), Poe = { paint: new ic({ "raster-opacity": new Ya(Ve.paint_raster["raster-opacity"]), "raster-hue-rotate": new Ya(Ve.paint_raster["raster-hue-rotate"]), "raster-brightness-min": new Ya(Ve.paint_raster["raster-brightness-min"]), "raster-brightness-max": new Ya(Ve.paint_raster["raster-brightness-max"]), "raster-saturation": new Ya(Ve.paint_raster["raster-saturation"]), "raster-contrast": new Ya(Ve.paint_raster["raster-contrast"]), "raster-resampling": new Ya(Ve.paint_raster["raster-resampling"]), "raster-fade-duration": new Ya(Ve.paint_raster["raster-fade-duration"]) }) }, Loe = function(M2) {
            function B2(ee) {
              M2.call(this, ee, Poe);
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2;
          }(Vc), Roe = function(M2) {
            function B2(ee) {
              M2.call(this, ee, {}), this.implementation = ee;
            }
            return M2 && (B2.__proto__ = M2), B2.prototype = Object.create(M2 && M2.prototype), B2.prototype.constructor = B2, B2.prototype.is3D = function() {
              return this.implementation.renderingMode === "3d";
            }, B2.prototype.hasOffscreenPass = function() {
              return this.implementation.prerender !== void 0;
            }, B2.prototype.recalculate = function() {
            }, B2.prototype.updateTransitions = function() {
            }, B2.prototype.hasTransition = function() {
            }, B2.prototype.serialize = function() {
            }, B2.prototype.onAdd = function(ee) {
              this.implementation.onAdd && this.implementation.onAdd(ee, ee.painter.context.gl);
            }, B2.prototype.onRemove = function(ee) {
              this.implementation.onRemove && this.implementation.onRemove(ee, ee.painter.context.gl);
            }, B2;
          }(Vc), zoe = { circle: kie, heatmap: Aie, hillshade: Eie, fill: Wie, "fill-extrusion": Jie, line: roe, symbol: Noe, background: Ooe, raster: Loe }, yP = self.HTMLImageElement, xP = self.HTMLCanvasElement, bP = self.HTMLVideoElement, _P = self.ImageData, Fw = self.ImageBitmap, ym = function(M2, B2, ee, ie) {
            this.context = M2, this.format = ee, this.texture = M2.gl.createTexture(), this.update(B2, ie);
          };
          ym.prototype.update = function(M2, B2, ee) {
            var ie = M2.width, ge = M2.height, _e = !(this.size && this.size[0] === ie && this.size[1] === ge || ee), Oe = this.context, Xe = Oe.gl;
            if (this.useMipmap = Boolean(B2 && B2.useMipmap), Xe.bindTexture(Xe.TEXTURE_2D, this.texture), Oe.pixelStoreUnpackFlipY.set(false), Oe.pixelStoreUnpack.set(1), Oe.pixelStoreUnpackPremultiplyAlpha.set(this.format === Xe.RGBA && (!B2 || B2.premultiply !== false)), _e) this.size = [ie, ge], M2 instanceof yP || M2 instanceof xP || M2 instanceof bP || M2 instanceof _P || Fw && M2 instanceof Fw ? Xe.texImage2D(Xe.TEXTURE_2D, 0, this.format, this.format, Xe.UNSIGNED_BYTE, M2) : Xe.texImage2D(Xe.TEXTURE_2D, 0, this.format, ie, ge, 0, this.format, Xe.UNSIGNED_BYTE, M2.data);
            else {
              var ht = ee || { x: 0, y: 0 }, Tt = ht.x, Dt = ht.y;
              M2 instanceof yP || M2 instanceof xP || M2 instanceof bP || M2 instanceof _P || Fw && M2 instanceof Fw ? Xe.texSubImage2D(Xe.TEXTURE_2D, 0, Tt, Dt, Xe.RGBA, Xe.UNSIGNED_BYTE, M2) : Xe.texSubImage2D(Xe.TEXTURE_2D, 0, Tt, Dt, ie, ge, Xe.RGBA, Xe.UNSIGNED_BYTE, M2.data);
            }
            this.useMipmap && this.isSizePowerOfTwo() && Xe.generateMipmap(Xe.TEXTURE_2D);
          }, ym.prototype.bind = function(M2, B2, ee) {
            var ie = this.context.gl;
            ie.bindTexture(ie.TEXTURE_2D, this.texture), ee !== ie.LINEAR_MIPMAP_NEAREST || this.isSizePowerOfTwo() || (ee = ie.LINEAR), M2 !== this.filter && (ie.texParameteri(ie.TEXTURE_2D, ie.TEXTURE_MAG_FILTER, M2), ie.texParameteri(ie.TEXTURE_2D, ie.TEXTURE_MIN_FILTER, ee || M2), this.filter = M2), B2 !== this.wrap && (ie.texParameteri(ie.TEXTURE_2D, ie.TEXTURE_WRAP_S, B2), ie.texParameteri(ie.TEXTURE_2D, ie.TEXTURE_WRAP_T, B2), this.wrap = B2);
          }, ym.prototype.isSizePowerOfTwo = function() {
            return this.size[0] === this.size[1] && Math.log(this.size[0]) / Math.LN2 % 1 == 0;
          }, ym.prototype.destroy = function() {
            this.context.gl.deleteTexture(this.texture), this.texture = null;
          };
          var ME = function(M2) {
            var B2 = this;
            this._callback = M2, this._triggered = false, typeof MessageChannel < "u" && (this._channel = new MessageChannel(), this._channel.port2.onmessage = function() {
              B2._triggered = false, B2._callback();
            });
          };
          ME.prototype.trigger = function() {
            var M2 = this;
            this._triggered || (this._triggered = true, this._channel ? this._channel.port1.postMessage(true) : setTimeout(function() {
              M2._triggered = false, M2._callback();
            }, 0));
          }, ME.prototype.remove = function() {
            delete this._channel, this._callback = function() {
            };
          };
          var M1 = function(M2, B2, ee) {
            this.target = M2, this.parent = B2, this.mapId = ee, this.callbacks = {}, this.tasks = {}, this.taskQueue = [], this.cancelCallbacks = {}, _4(["receive", "process"], this), this.invoker = new ME(this.process), this.target.addEventListener("message", this.receive, false), this.globalScope = D2() ? M2 : self;
          };
          function wP(M2, B2, ee) {
            var ie = 2 * Math.PI * 6378137 / 256 / Math.pow(2, ee);
            return [M2 * ie - 2 * Math.PI * 6378137 / 2, B2 * ie - 2 * Math.PI * 6378137 / 2];
          }
          M1.prototype.send = function(M2, B2, ee, ie, ge) {
            var _e = this;
            ge === void 0 && (ge = false);
            var Oe = Math.round(1e18 * Math.random()).toString(36).substring(0, 10);
            ee && (this.callbacks[Oe] = ee);
            var Xe = L2(this.globalScope) ? void 0 : [];
            return this.target.postMessage({ id: Oe, type: M2, hasCallback: !!ee, targetMapId: ie, mustQueue: ge, sourceMapId: this.mapId, data: Ia(B2, Xe) }, Xe), { cancel: function() {
              ee && delete _e.callbacks[Oe], _e.target.postMessage({ id: Oe, type: "<cancel>", targetMapId: ie, sourceMapId: _e.mapId });
            } };
          }, M1.prototype.receive = function(M2) {
            var B2 = M2.data, ee = B2.id;
            if (ee && (!B2.targetMapId || this.mapId === B2.targetMapId)) if (B2.type === "<cancel>") {
              delete this.tasks[ee];
              var ie = this.cancelCallbacks[ee];
              delete this.cancelCallbacks[ee], ie && ie();
            } else D2() || B2.mustQueue ? (this.tasks[ee] = B2, this.taskQueue.push(ee), this.invoker.trigger()) : this.processTask(ee, B2);
          }, M1.prototype.process = function() {
            if (this.taskQueue.length) {
              var M2 = this.taskQueue.shift(), B2 = this.tasks[M2];
              delete this.tasks[M2], this.taskQueue.length && this.invoker.trigger(), B2 && this.processTask(M2, B2);
            }
          }, M1.prototype.processTask = function(M2, B2) {
            var ee = this;
            if (B2.type === "<response>") {
              var ie = this.callbacks[M2];
              delete this.callbacks[M2], ie && (B2.error ? ie(Si(B2.error)) : ie(null, Si(B2.data)));
            } else {
              var ge = false, _e = L2(this.globalScope) ? void 0 : [], Oe = B2.hasCallback ? function(Dt, Xt) {
                ge = true, delete ee.cancelCallbacks[M2], ee.target.postMessage({ id: M2, type: "<response>", sourceMapId: ee.mapId, error: Dt ? Ia(Dt) : null, data: Ia(Xt, _e) }, _e);
              } : function(Dt) {
                ge = true;
              }, Xe = null, ht = Si(B2.data);
              if (this.parent[B2.type]) Xe = this.parent[B2.type](B2.sourceMapId, ht, Oe);
              else if (this.parent.getWorkerSource) {
                var Tt = B2.type.split(".");
                Xe = this.parent.getWorkerSource(B2.sourceMapId, Tt[0], ht.source)[Tt[1]](ht, Oe);
              } else Oe(new Error("Could not find function " + B2.type));
              !ge && Xe && Xe.cancel && (this.cancelCallbacks[M2] = Xe.cancel);
            }
          }, M1.prototype.remove = function() {
            this.invoker.remove(), this.target.removeEventListener("message", this.receive, false);
          };
          var tu = function(M2, B2) {
            M2 && (B2 ? this.setSouthWest(M2).setNorthEast(B2) : M2.length === 4 ? this.setSouthWest([M2[0], M2[1]]).setNorthEast([M2[2], M2[3]]) : this.setSouthWest(M2[0]).setNorthEast(M2[1]));
          };
          tu.prototype.setNorthEast = function(M2) {
            return this._ne = M2 instanceof Is ? new Is(M2.lng, M2.lat) : Is.convert(M2), this;
          }, tu.prototype.setSouthWest = function(M2) {
            return this._sw = M2 instanceof Is ? new Is(M2.lng, M2.lat) : Is.convert(M2), this;
          }, tu.prototype.extend = function(M2) {
            var B2, ee, ie = this._sw, ge = this._ne;
            if (M2 instanceof Is) B2 = M2, ee = M2;
            else {
              if (!(M2 instanceof tu)) {
                if (Array.isArray(M2)) {
                  if (M2.length === 4 || M2.every(Array.isArray)) {
                    var _e = M2;
                    return this.extend(tu.convert(_e));
                  }
                  var Oe = M2;
                  return this.extend(Is.convert(Oe));
                }
                return this;
              }
              if (B2 = M2._sw, ee = M2._ne, !B2 || !ee) return this;
            }
            return ie || ge ? (ie.lng = Math.min(B2.lng, ie.lng), ie.lat = Math.min(B2.lat, ie.lat), ge.lng = Math.max(ee.lng, ge.lng), ge.lat = Math.max(ee.lat, ge.lat)) : (this._sw = new Is(B2.lng, B2.lat), this._ne = new Is(ee.lng, ee.lat)), this;
          }, tu.prototype.getCenter = function() {
            return new Is((this._sw.lng + this._ne.lng) / 2, (this._sw.lat + this._ne.lat) / 2);
          }, tu.prototype.getSouthWest = function() {
            return this._sw;
          }, tu.prototype.getNorthEast = function() {
            return this._ne;
          }, tu.prototype.getNorthWest = function() {
            return new Is(this.getWest(), this.getNorth());
          }, tu.prototype.getSouthEast = function() {
            return new Is(this.getEast(), this.getSouth());
          }, tu.prototype.getWest = function() {
            return this._sw.lng;
          }, tu.prototype.getSouth = function() {
            return this._sw.lat;
          }, tu.prototype.getEast = function() {
            return this._ne.lng;
          }, tu.prototype.getNorth = function() {
            return this._ne.lat;
          }, tu.prototype.toArray = function() {
            return [this._sw.toArray(), this._ne.toArray()];
          }, tu.prototype.toString = function() {
            return "LngLatBounds(" + this._sw.toString() + ", " + this._ne.toString() + ")";
          }, tu.prototype.isEmpty = function() {
            return !(this._sw && this._ne);
          }, tu.prototype.contains = function(M2) {
            var B2 = Is.convert(M2), ee = B2.lng, ie = B2.lat, ge = this._sw.lat <= ie && ie <= this._ne.lat, _e = this._sw.lng <= ee && ee <= this._ne.lng;
            return this._sw.lng > this._ne.lng && (_e = this._sw.lng >= ee && ee >= this._ne.lng), ge && _e;
          }, tu.convert = function(M2) {
            return !M2 || M2 instanceof tu ? M2 : new tu(M2);
          };
          var Is = function(M2, B2) {
            if (isNaN(M2) || isNaN(B2)) throw new Error("Invalid LngLat object: (" + M2 + ", " + B2 + ")");
            if (this.lng = +M2, this.lat = +B2, this.lat > 90 || this.lat < -90) throw new Error("Invalid LngLat latitude value: must be between -90 and 90");
          };
          Is.prototype.wrap = function() {
            return new Is(m(this.lng, -180, 180), this.lat);
          }, Is.prototype.toArray = function() {
            return [this.lng, this.lat];
          }, Is.prototype.toString = function() {
            return "LngLat(" + this.lng + ", " + this.lat + ")";
          }, Is.prototype.distanceTo = function(M2) {
            var B2 = Math.PI / 180, ee = this.lat * B2, ie = M2.lat * B2, ge = Math.sin(ee) * Math.sin(ie) + Math.cos(ee) * Math.cos(ie) * Math.cos((M2.lng - this.lng) * B2);
            return 63710088e-1 * Math.acos(Math.min(ge, 1));
          }, Is.prototype.toBounds = function(M2) {
            M2 === void 0 && (M2 = 0);
            var B2 = 360 * M2 / 40075017, ee = B2 / Math.cos(Math.PI / 180 * this.lat);
            return new tu(new Is(this.lng - ee, this.lat - B2), new Is(this.lng + ee, this.lat + B2));
          }, Is.convert = function(M2) {
            if (M2 instanceof Is) return M2;
            if (Array.isArray(M2) && (M2.length === 2 || M2.length === 3)) return new Is(Number(M2[0]), Number(M2[1]));
            if (!Array.isArray(M2) && typeof M2 == "object" && M2 !== null) return new Is(Number("lng" in M2 ? M2.lng : M2.lon), Number(M2.lat));
            throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]");
          };
          var kP = 2 * Math.PI * 63710088e-1;
          function TP(M2) {
            return kP * Math.cos(M2 * Math.PI / 180);
          }
          function AP(M2) {
            return (180 + M2) / 360;
          }
          function SP(M2) {
            return (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + M2 * Math.PI / 360))) / 360;
          }
          function EP(M2, B2) {
            return M2 / TP(B2);
          }
          function IE(M2) {
            var B2 = 180 - 360 * M2;
            return 360 / Math.PI * Math.atan(Math.exp(B2 * Math.PI / 180)) - 90;
          }
          var xm = function(M2, B2, ee) {
            ee === void 0 && (ee = 0), this.x = +M2, this.y = +B2, this.z = +ee;
          };
          xm.fromLngLat = function(M2, B2) {
            B2 === void 0 && (B2 = 0);
            var ee = Is.convert(M2);
            return new xm(AP(ee.lng), SP(ee.lat), EP(B2, ee.lat));
          }, xm.prototype.toLngLat = function() {
            return new Is(360 * this.x - 180, IE(this.y));
          }, xm.prototype.toAltitude = function() {
            return M2 = this.z, B2 = this.y, M2 * TP(IE(B2));
            var M2, B2;
          }, xm.prototype.meterInMercatorCoordinateUnits = function() {
            return 1 / kP * (M2 = IE(this.y), 1 / Math.cos(M2 * Math.PI / 180));
            var M2;
          };
          var bm = function(M2, B2, ee) {
            this.z = M2, this.x = B2, this.y = ee, this.key = pb(0, M2, M2, B2, ee);
          };
          bm.prototype.equals = function(M2) {
            return this.z === M2.z && this.x === M2.x && this.y === M2.y;
          }, bm.prototype.url = function(M2, B2) {
            var ee, ie, ge, _e, Oe, Xe = (ee = this.x, ie = this.y, ge = this.z, _e = wP(256 * ee, 256 * (ie = Math.pow(2, ge) - ie - 1), ge), Oe = wP(256 * (ee + 1), 256 * (ie + 1), ge), _e[0] + "," + _e[1] + "," + Oe[0] + "," + Oe[1]), ht = function(Tt, Dt, Xt) {
              for (var ar, er = "", hr = Tt; hr > 0; hr--) er += (Dt & (ar = 1 << hr - 1) ? 1 : 0) + (Xt & ar ? 2 : 0);
              return er;
            }(this.z, this.x, this.y);
            return M2[(this.x + this.y) % M2.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(B2 === "tms" ? Math.pow(2, this.z) - this.y - 1 : this.y)).replace("{quadkey}", ht).replace("{bbox-epsg-3857}", Xe);
          }, bm.prototype.getTilePoint = function(M2) {
            var B2 = Math.pow(2, this.z);
            return new f(8192 * (M2.x * B2 - this.x), 8192 * (M2.y * B2 - this.y));
          }, bm.prototype.toString = function() {
            return this.z + "/" + this.x + "/" + this.y;
          };
          var DP = function(M2, B2) {
            this.wrap = M2, this.canonical = B2, this.key = pb(M2, B2.z, B2.z, B2.x, B2.y);
          }, ru = function(M2, B2, ee, ie, ge) {
            this.overscaledZ = M2, this.wrap = B2, this.canonical = new bm(ee, +ie, +ge), this.key = pb(B2, M2, ee, ie, ge);
          };
          function pb(M2, B2, ee, ie, ge) {
            (M2 *= 2) < 0 && (M2 = -1 * M2 - 1);
            var _e = 1 << ee;
            return (_e * _e * M2 + _e * ge + ie).toString(36) + ee.toString(36) + B2.toString(36);
          }
          ru.prototype.equals = function(M2) {
            return this.overscaledZ === M2.overscaledZ && this.wrap === M2.wrap && this.canonical.equals(M2.canonical);
          }, ru.prototype.scaledTo = function(M2) {
            var B2 = this.canonical.z - M2;
            return M2 > this.canonical.z ? new ru(M2, this.wrap, this.canonical.z, this.canonical.x, this.canonical.y) : new ru(M2, this.wrap, M2, this.canonical.x >> B2, this.canonical.y >> B2);
          }, ru.prototype.calculateScaledKey = function(M2, B2) {
            var ee = this.canonical.z - M2;
            return M2 > this.canonical.z ? pb(this.wrap * +B2, M2, this.canonical.z, this.canonical.x, this.canonical.y) : pb(this.wrap * +B2, M2, M2, this.canonical.x >> ee, this.canonical.y >> ee);
          }, ru.prototype.isChildOf = function(M2) {
            if (M2.wrap !== this.wrap) return false;
            var B2 = this.canonical.z - M2.canonical.z;
            return M2.overscaledZ === 0 || M2.overscaledZ < this.overscaledZ && M2.canonical.x === this.canonical.x >> B2 && M2.canonical.y === this.canonical.y >> B2;
          }, ru.prototype.children = function(M2) {
            if (this.overscaledZ >= M2) return [new ru(this.overscaledZ + 1, this.wrap, this.canonical.z, this.canonical.x, this.canonical.y)];
            var B2 = this.canonical.z + 1, ee = 2 * this.canonical.x, ie = 2 * this.canonical.y;
            return [new ru(B2, this.wrap, B2, ee, ie), new ru(B2, this.wrap, B2, ee + 1, ie), new ru(B2, this.wrap, B2, ee, ie + 1), new ru(B2, this.wrap, B2, ee + 1, ie + 1)];
          }, ru.prototype.isLessThan = function(M2) {
            return this.wrap < M2.wrap || !(this.wrap > M2.wrap) && (this.overscaledZ < M2.overscaledZ || !(this.overscaledZ > M2.overscaledZ) && (this.canonical.x < M2.canonical.x || !(this.canonical.x > M2.canonical.x) && this.canonical.y < M2.canonical.y));
          }, ru.prototype.wrapped = function() {
            return new ru(this.overscaledZ, 0, this.canonical.z, this.canonical.x, this.canonical.y);
          }, ru.prototype.unwrapTo = function(M2) {
            return new ru(this.overscaledZ, M2, this.canonical.z, this.canonical.x, this.canonical.y);
          }, ru.prototype.overscaleFactor = function() {
            return Math.pow(2, this.overscaledZ - this.canonical.z);
          }, ru.prototype.toUnwrapped = function() {
            return new DP(this.wrap, this.canonical);
          }, ru.prototype.toString = function() {
            return this.overscaledZ + "/" + this.canonical.x + "/" + this.canonical.y;
          }, ru.prototype.getTilePoint = function(M2) {
            return this.canonical.getTilePoint(new xm(M2.x - this.wrap, M2.y));
          }, mn("CanonicalTileID", bm), mn("OverscaledTileID", ru, { omit: ["posMatrix"] });
          var f0 = function(M2, B2, ee) {
            if (this.uid = M2, B2.height !== B2.width) throw new RangeError("DEM tiles must be square");
            if (ee && ee !== "mapbox" && ee !== "terrarium") return E2('"' + ee + '" is not a valid encoding type. Valid types include "mapbox" and "terrarium".');
            this.stride = B2.height;
            var ie = this.dim = B2.height - 2;
            this.data = new Uint32Array(B2.data.buffer), this.encoding = ee || "mapbox";
            for (var ge = 0; ge < ie; ge++) this.data[this._idx(-1, ge)] = this.data[this._idx(0, ge)], this.data[this._idx(ie, ge)] = this.data[this._idx(ie - 1, ge)], this.data[this._idx(ge, -1)] = this.data[this._idx(ge, 0)], this.data[this._idx(ge, ie)] = this.data[this._idx(ge, ie - 1)];
            this.data[this._idx(-1, -1)] = this.data[this._idx(0, 0)], this.data[this._idx(ie, -1)] = this.data[this._idx(ie - 1, 0)], this.data[this._idx(-1, ie)] = this.data[this._idx(0, ie - 1)], this.data[this._idx(ie, ie)] = this.data[this._idx(ie - 1, ie - 1)];
          };
          f0.prototype.get = function(M2, B2) {
            var ee = new Uint8Array(this.data.buffer), ie = 4 * this._idx(M2, B2);
            return (this.encoding === "terrarium" ? this._unpackTerrarium : this._unpackMapbox)(ee[ie], ee[ie + 1], ee[ie + 2]);
          }, f0.prototype.getUnpackVector = function() {
            return this.encoding === "terrarium" ? [256, 1, 1 / 256, 32768] : [6553.6, 25.6, 0.1, 1e4];
          }, f0.prototype._idx = function(M2, B2) {
            if (M2 < -1 || M2 >= this.dim + 1 || B2 < -1 || B2 >= this.dim + 1) throw new RangeError("out of range source coordinates for DEM data");
            return (B2 + 1) * this.stride + (M2 + 1);
          }, f0.prototype._unpackMapbox = function(M2, B2, ee) {
            return (256 * M2 * 256 + 256 * B2 + ee) / 10 - 1e4;
          }, f0.prototype._unpackTerrarium = function(M2, B2, ee) {
            return 256 * M2 + B2 + ee / 256 - 32768;
          }, f0.prototype.getPixels = function() {
            return new ef({ width: this.stride, height: this.stride }, new Uint8Array(this.data.buffer));
          }, f0.prototype.backfillBorder = function(M2, B2, ee) {
            if (this.dim !== M2.dim) throw new Error("dem dimension mismatch");
            var ie = B2 * this.dim, ge = B2 * this.dim + this.dim, _e = ee * this.dim, Oe = ee * this.dim + this.dim;
            switch (B2) {
              case -1:
                ie = ge - 1;
                break;
              case 1:
                ge = ie + 1;
            }
            switch (ee) {
              case -1:
                _e = Oe - 1;
                break;
              case 1:
                Oe = _e + 1;
            }
            for (var Xe = -B2 * this.dim, ht = -ee * this.dim, Tt = _e; Tt < Oe; Tt++) for (var Dt = ie; Dt < ge; Dt++) this.data[this._idx(Dt, Tt)] = M2.data[this._idx(Dt + Xe, Tt + ht)];
          }, mn("DEMData", f0);
          var Ow = function(M2) {
            this._stringToNumber = {}, this._numberToString = [];
            for (var B2 = 0; B2 < M2.length; B2++) {
              var ee = M2[B2];
              this._stringToNumber[ee] = B2, this._numberToString[B2] = ee;
            }
          };
          Ow.prototype.encode = function(M2) {
            return this._stringToNumber[M2];
          }, Ow.prototype.decode = function(M2) {
            return this._numberToString[M2];
          };
          var Pw = function(M2, B2, ee, ie, ge) {
            this.type = "Feature", this._vectorTileFeature = M2, M2._z = B2, M2._x = ee, M2._y = ie, this.properties = M2.properties, this.id = ge;
          }, NE = { geometry: { configurable: true } };
          NE.geometry.get = function() {
            return this._geometry === void 0 && (this._geometry = this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x, this._vectorTileFeature._y, this._vectorTileFeature._z).geometry), this._geometry;
          }, NE.geometry.set = function(M2) {
            this._geometry = M2;
          }, Pw.prototype.toJSON = function() {
            var M2 = { geometry: this.geometry };
            for (var B2 in this) B2 !== "_geometry" && B2 !== "_vectorTileFeature" && (M2[B2] = this[B2]);
            return M2;
          }, Object.defineProperties(Pw.prototype, NE);
          var I1 = function() {
            this.state = {}, this.stateChanges = {}, this.deletedStates = {};
          };
          I1.prototype.updateState = function(M2, B2, ee) {
            var ie = String(B2);
            if (this.stateChanges[M2] = this.stateChanges[M2] || {}, this.stateChanges[M2][ie] = this.stateChanges[M2][ie] || {}, g(this.stateChanges[M2][ie], ee), this.deletedStates[M2] === null) for (var ge in this.deletedStates[M2] = {}, this.state[M2]) ge !== ie && (this.deletedStates[M2][ge] = null);
            else if (this.deletedStates[M2] && this.deletedStates[M2][ie] === null) for (var _e in this.deletedStates[M2][ie] = {}, this.state[M2][ie]) ee[_e] || (this.deletedStates[M2][ie][_e] = null);
            else for (var Oe in ee) this.deletedStates[M2] && this.deletedStates[M2][ie] && this.deletedStates[M2][ie][Oe] === null && delete this.deletedStates[M2][ie][Oe];
          }, I1.prototype.removeFeatureState = function(M2, B2, ee) {
            if (this.deletedStates[M2] !== null) {
              var ie = String(B2);
              if (this.deletedStates[M2] = this.deletedStates[M2] || {}, ee && B2 !== void 0) this.deletedStates[M2][ie] !== null && (this.deletedStates[M2][ie] = this.deletedStates[M2][ie] || {}, this.deletedStates[M2][ie][ee] = null);
              else if (B2 !== void 0) if (this.stateChanges[M2] && this.stateChanges[M2][ie]) for (ee in this.deletedStates[M2][ie] = {}, this.stateChanges[M2][ie]) this.deletedStates[M2][ie][ee] = null;
              else this.deletedStates[M2][ie] = null;
              else this.deletedStates[M2] = null;
            }
          }, I1.prototype.getState = function(M2, B2) {
            var ee = String(B2), ie = this.state[M2] || {}, ge = this.stateChanges[M2] || {}, _e = g({}, ie[ee], ge[ee]);
            if (this.deletedStates[M2] === null) return {};
            if (this.deletedStates[M2]) {
              var Oe = this.deletedStates[M2][B2];
              if (Oe === null) return {};
              for (var Xe in Oe) delete _e[Xe];
            }
            return _e;
          }, I1.prototype.initializeTileState = function(M2, B2) {
            M2.setFeatureState(this.state, B2);
          }, I1.prototype.coalesceChanges = function(M2, B2) {
            var ee = {};
            for (var ie in this.stateChanges) {
              this.state[ie] = this.state[ie] || {};
              var ge = {};
              for (var _e in this.stateChanges[ie]) this.state[ie][_e] || (this.state[ie][_e] = {}), g(this.state[ie][_e], this.stateChanges[ie][_e]), ge[_e] = this.state[ie][_e];
              ee[ie] = ge;
            }
            for (var Oe in this.deletedStates) {
              this.state[Oe] = this.state[Oe] || {};
              var Xe = {};
              if (this.deletedStates[Oe] === null) for (var ht in this.state[Oe]) Xe[ht] = {}, this.state[Oe][ht] = {};
              else for (var Tt in this.deletedStates[Oe]) {
                if (this.deletedStates[Oe][Tt] === null) this.state[Oe][Tt] = {};
                else for (var Dt = 0, Xt = Object.keys(this.deletedStates[Oe][Tt]); Dt < Xt.length; Dt += 1) {
                  var ar = Xt[Dt];
                  delete this.state[Oe][Tt][ar];
                }
                Xe[Tt] = this.state[Oe][Tt];
              }
              ee[Oe] = ee[Oe] || {}, g(ee[Oe], Xe);
            }
            if (this.stateChanges = {}, this.deletedStates = {}, Object.keys(ee).length !== 0) for (var er in M2) M2[er].setFeatureState(ee, B2);
          };
          var h0 = function(M2, B2) {
            this.tileID = M2, this.x = M2.canonical.x, this.y = M2.canonical.y, this.z = M2.canonical.z, this.grid = new Dn(8192, 16, 0), this.grid3D = new Dn(8192, 16, 0), this.featureIndexArray = new Pt(), this.promoteId = B2;
          };
          function CP(M2, B2, ee, ie, ge) {
            return T2(M2, function(_e, Oe) {
              var Xe = B2 instanceof Sf ? B2.get(Oe) : null;
              return Xe && Xe.evaluate ? Xe.evaluate(ee, ie, ge) : Xe;
            });
          }
          function MP(M2) {
            for (var B2 = 1 / 0, ee = 1 / 0, ie = -1 / 0, ge = -1 / 0, _e = 0, Oe = M2; _e < Oe.length; _e += 1) {
              var Xe = Oe[_e];
              B2 = Math.min(B2, Xe.x), ee = Math.min(ee, Xe.y), ie = Math.max(ie, Xe.x), ge = Math.max(ge, Xe.y);
            }
            return { minX: B2, minY: ee, maxX: ie, maxY: ge };
          }
          function Boe(M2, B2) {
            return B2 - M2;
          }
          h0.prototype.insert = function(M2, B2, ee, ie, ge, _e) {
            var Oe = this.featureIndexArray.length;
            this.featureIndexArray.emplaceBack(ee, ie, ge);
            for (var Xe = _e ? this.grid3D : this.grid, ht = 0; ht < B2.length; ht++) {
              for (var Tt = B2[ht], Dt = [1 / 0, 1 / 0, -1 / 0, -1 / 0], Xt = 0; Xt < Tt.length; Xt++) {
                var ar = Tt[Xt];
                Dt[0] = Math.min(Dt[0], ar.x), Dt[1] = Math.min(Dt[1], ar.y), Dt[2] = Math.max(Dt[2], ar.x), Dt[3] = Math.max(Dt[3], ar.y);
              }
              Dt[0] < 8192 && Dt[1] < 8192 && Dt[2] >= 0 && Dt[3] >= 0 && Xe.insert(Oe, Dt[0], Dt[1], Dt[2], Dt[3]);
            }
          }, h0.prototype.loadVTLayers = function() {
            return this.vtLayers || (this.vtLayers = new _1.VectorTile(new kw(this.rawTileData)).layers, this.sourceLayerCoder = new Ow(this.vtLayers ? Object.keys(this.vtLayers).sort() : ["_geojsonTileLayer"])), this.vtLayers;
          }, h0.prototype.query = function(M2, B2, ee, ie) {
            var ge = this;
            this.loadVTLayers();
            for (var _e = M2.params || {}, Oe = 8192 / M2.tileSize / M2.scale, Xe = Ci(_e.filter), ht = M2.queryGeometry, Tt = M2.queryPadding * Oe, Dt = MP(ht), Xt = this.grid.query(Dt.minX - Tt, Dt.minY - Tt, Dt.maxX + Tt, Dt.maxY + Tt), ar = MP(M2.cameraQueryGeometry), er = this.grid3D.query(ar.minX - Tt, ar.minY - Tt, ar.maxX + Tt, ar.maxY + Tt, function(In, Un, ha, fa) {
              return function(wa, Wa, $a, Ea, oi) {
                for (var ei = 0, Ha = wa; ei < Ha.length; ei += 1) {
                  var xo = Ha[ei];
                  if (Wa <= xo.x && $a <= xo.y && Ea >= xo.x && oi >= xo.y) return true;
                }
                var io = [new f(Wa, $a), new f(Wa, oi), new f(Ea, oi), new f(Ea, $a)];
                if (wa.length > 2) {
                  for (var Co = 0, Ti = io; Co < Ti.length; Co += 1) if (Df(wa, Ti[Co])) return true;
                }
                for (var uo = 0; uo < wa.length - 1; uo++) if (vm(wa[uo], wa[uo + 1], io)) return true;
                return false;
              }(M2.cameraQueryGeometry, In - Tt, Un - Tt, ha + Tt, fa + Tt);
            }), hr = 0, Sr = er; hr < Sr.length; hr += 1) {
              var Ur = Sr[hr];
              Xt.push(Ur);
            }
            Xt.sort(Boe);
            for (var Br, rn = {}, nn = function(In) {
              var Un = Xt[In];
              if (Un !== Br) {
                Br = Un;
                var ha = ge.featureIndexArray.get(Un), fa = null;
                ge.loadMatchingFeature(rn, ha.bucketIndex, ha.sourceLayerIndex, ha.featureIndex, Xe, _e.layers, _e.availableImages, B2, ee, ie, function(wa, Wa, $a) {
                  return fa || (fa = us(wa)), Wa.queryIntersectsFeature(ht, wa, $a, fa, ge.z, M2.transform, Oe, M2.pixelPosMatrix);
                });
              }
            }, cn = 0; cn < Xt.length; cn++) nn(cn);
            return rn;
          }, h0.prototype.loadMatchingFeature = function(M2, B2, ee, ie, ge, _e, Oe, Xe, ht, Tt, Dt) {
            var Xt = this.bucketLayerIDs[B2];
            if (!_e || function(ha, fa) {
              for (var wa = 0; wa < ha.length; wa++) if (fa.indexOf(ha[wa]) >= 0) return true;
              return false;
            }(_e, Xt)) {
              var ar = this.sourceLayerCoder.decode(ee), er = this.vtLayers[ar].feature(ie);
              if (ge.filter(new Oo(this.tileID.overscaledZ), er)) for (var hr = this.getId(er, ar), Sr = 0; Sr < Xt.length; Sr++) {
                var Ur = Xt[Sr];
                if (!(_e && _e.indexOf(Ur) < 0)) {
                  var Br = Xe[Ur];
                  if (Br) {
                    var rn = {};
                    hr !== void 0 && Tt && (rn = Tt.getState(Br.sourceLayer || "_geojsonTileLayer", hr));
                    var nn = ht[Ur];
                    nn.paint = CP(nn.paint, Br.paint, er, rn, Oe), nn.layout = CP(nn.layout, Br.layout, er, rn, Oe);
                    var cn = !Dt || Dt(er, Br, rn);
                    if (cn) {
                      var In = new Pw(er, this.z, this.x, this.y, hr);
                      In.layer = nn;
                      var Un = M2[Ur];
                      Un === void 0 && (Un = M2[Ur] = []), Un.push({ featureIndex: ie, feature: In, intersectionZ: cn });
                    }
                  }
                }
              }
            }
          }, h0.prototype.lookupSymbolFeatures = function(M2, B2, ee, ie, ge, _e, Oe, Xe) {
            var ht = {};
            this.loadVTLayers();
            for (var Tt = Ci(ge), Dt = 0, Xt = M2; Dt < Xt.length; Dt += 1) {
              var ar = Xt[Dt];
              this.loadMatchingFeature(ht, ee, ie, ar, Tt, _e, Oe, Xe, B2);
            }
            return ht;
          }, h0.prototype.hasLayer = function(M2) {
            for (var B2 = 0, ee = this.bucketLayerIDs; B2 < ee.length; B2 += 1) for (var ie = 0, ge = ee[B2]; ie < ge.length; ie += 1) if (M2 === ge[ie]) return true;
            return false;
          }, h0.prototype.getId = function(M2, B2) {
            var ee = M2.id;
            if (this.promoteId) {
              var ie = typeof this.promoteId == "string" ? this.promoteId : this.promoteId[B2];
              typeof (ee = M2.properties[ie]) == "boolean" && (ee = Number(ee));
            }
            return ee;
          }, mn("FeatureIndex", h0, { omit: ["rawTileData", "sourceLayerCoder"] });
          var Au = function(M2, B2) {
            this.tileID = M2, this.uid = b(), this.uses = 0, this.tileSize = B2, this.buckets = {}, this.expirationTime = null, this.queryPadding = 0, this.hasSymbolBuckets = false, this.hasRTLText = false, this.dependencies = {}, this.expiredRequestCount = 0, this.state = "loading";
          };
          Au.prototype.registerFadeDuration = function(M2) {
            var B2 = M2 + this.timeAdded;
            B2 < z.now() || this.fadeEndTime && B2 < this.fadeEndTime || (this.fadeEndTime = B2);
          }, Au.prototype.wasRequested = function() {
            return this.state === "errored" || this.state === "loaded" || this.state === "reloading";
          }, Au.prototype.loadVectorData = function(M2, B2, ee) {
            if (this.hasData() && this.unloadVectorData(), this.state = "loaded", M2) {
              for (var ie in M2.featureIndex && (this.latestFeatureIndex = M2.featureIndex, M2.rawTileData ? (this.latestRawTileData = M2.rawTileData, this.latestFeatureIndex.rawTileData = M2.rawTileData) : this.latestRawTileData && (this.latestFeatureIndex.rawTileData = this.latestRawTileData)), this.collisionBoxArray = M2.collisionBoxArray, this.buckets = function(Tt, Dt) {
                var Xt = {};
                if (!Dt) return Xt;
                for (var ar = function() {
                  var Sr = hr[er], Ur = Sr.layerIds.map(function(cn) {
                    return Dt.getLayer(cn);
                  }).filter(Boolean);
                  if (Ur.length !== 0) {
                    Sr.layers = Ur, Sr.stateDependentLayerIds && (Sr.stateDependentLayers = Sr.stateDependentLayerIds.map(function(cn) {
                      return Ur.filter(function(In) {
                        return In.id === cn;
                      })[0];
                    }));
                    for (var Br = 0, rn = Ur; Br < rn.length; Br += 1) {
                      var nn = rn[Br];
                      Xt[nn.id] = Sr;
                    }
                  }
                }, er = 0, hr = Tt; er < hr.length; er += 1) ar();
                return Xt;
              }(M2.buckets, B2.style), this.hasSymbolBuckets = false, this.buckets) {
                var ge = this.buckets[ie];
                if (ge instanceof Yo) {
                  if (this.hasSymbolBuckets = true, !ee) break;
                  ge.justReloaded = true;
                }
              }
              if (this.hasRTLText = false, this.hasSymbolBuckets) for (var _e in this.buckets) {
                var Oe = this.buckets[_e];
                if (Oe instanceof Yo && Oe.hasRTLText) {
                  this.hasRTLText = true, fu.isLoading() || fu.isLoaded() || Sl() !== "deferred" || Fo();
                  break;
                }
              }
              for (var Xe in this.queryPadding = 0, this.buckets) {
                var ht = this.buckets[Xe];
                this.queryPadding = Math.max(this.queryPadding, B2.style.getLayer(Xe).queryRadius(ht));
              }
              M2.imageAtlas && (this.imageAtlas = M2.imageAtlas), M2.glyphAtlasImage && (this.glyphAtlasImage = M2.glyphAtlasImage);
            } else this.collisionBoxArray = new Te();
          }, Au.prototype.unloadVectorData = function() {
            for (var M2 in this.buckets) this.buckets[M2].destroy();
            this.buckets = {}, this.imageAtlasTexture && this.imageAtlasTexture.destroy(), this.imageAtlas && (this.imageAtlas = null), this.glyphAtlasTexture && this.glyphAtlasTexture.destroy(), this.latestFeatureIndex = null, this.state = "unloaded";
          }, Au.prototype.getBucket = function(M2) {
            return this.buckets[M2.id];
          }, Au.prototype.upload = function(M2) {
            for (var B2 in this.buckets) {
              var ee = this.buckets[B2];
              ee.uploadPending() && ee.upload(M2);
            }
            var ie = M2.gl;
            this.imageAtlas && !this.imageAtlas.uploaded && (this.imageAtlasTexture = new ym(M2, this.imageAtlas.image, ie.RGBA), this.imageAtlas.uploaded = true), this.glyphAtlasImage && (this.glyphAtlasTexture = new ym(M2, this.glyphAtlasImage, ie.ALPHA), this.glyphAtlasImage = null);
          }, Au.prototype.prepare = function(M2) {
            this.imageAtlas && this.imageAtlas.patchUpdatedImages(M2, this.imageAtlasTexture);
          }, Au.prototype.queryRenderedFeatures = function(M2, B2, ee, ie, ge, _e, Oe, Xe, ht, Tt) {
            return this.latestFeatureIndex && this.latestFeatureIndex.rawTileData ? this.latestFeatureIndex.query({ queryGeometry: ie, cameraQueryGeometry: ge, scale: _e, tileSize: this.tileSize, pixelPosMatrix: Tt, transform: Xe, params: Oe, queryPadding: this.queryPadding * ht }, M2, B2, ee) : {};
          }, Au.prototype.querySourceFeatures = function(M2, B2) {
            var ee = this.latestFeatureIndex;
            if (ee && ee.rawTileData) {
              var ie = ee.loadVTLayers(), ge = B2 ? B2.sourceLayer : "", _e = ie._geojsonTileLayer || ie[ge];
              if (_e) for (var Oe = Ci(B2 && B2.filter), Xe = this.tileID.canonical, ht = Xe.z, Tt = Xe.x, Dt = Xe.y, Xt = { z: ht, x: Tt, y: Dt }, ar = 0; ar < _e.length; ar++) {
                var er = _e.feature(ar);
                if (Oe.filter(new Oo(this.tileID.overscaledZ), er)) {
                  var hr = ee.getId(er, ge), Sr = new Pw(er, ht, Tt, Dt, hr);
                  Sr.tile = Xt, M2.push(Sr);
                }
              }
            }
          }, Au.prototype.hasData = function() {
            return this.state === "loaded" || this.state === "reloading" || this.state === "expired";
          }, Au.prototype.patternsLoaded = function() {
            return this.imageAtlas && !!Object.keys(this.imageAtlas.patternPositions).length;
          }, Au.prototype.setExpiryData = function(M2) {
            var B2 = this.expirationTime;
            if (M2.cacheControl) {
              var ee = I2(M2.cacheControl);
              ee["max-age"] && (this.expirationTime = Date.now() + 1e3 * ee["max-age"]);
            } else M2.expires && (this.expirationTime = new Date(M2.expires).getTime());
            if (this.expirationTime) {
              var ie = Date.now(), ge = false;
              if (this.expirationTime > ie) ge = false;
              else if (B2) if (this.expirationTime < B2) ge = true;
              else {
                var _e = this.expirationTime - B2;
                _e ? this.expirationTime = ie + Math.max(_e, 3e4) : ge = true;
              }
              else ge = true;
              ge ? (this.expiredRequestCount++, this.state = "expired") : this.expiredRequestCount = 0;
            }
          }, Au.prototype.getExpiryTimeout = function() {
            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);
          }, Au.prototype.setFeatureState = function(M2, B2) {
            if (this.latestFeatureIndex && this.latestFeatureIndex.rawTileData && Object.keys(M2).length !== 0) {
              var ee = this.latestFeatureIndex.loadVTLayers();
              for (var ie in this.buckets) if (B2.style.hasLayer(ie)) {
                var ge = this.buckets[ie], _e = ge.layers[0].sourceLayer || "_geojsonTileLayer", Oe = ee[_e], Xe = M2[_e];
                if (Oe && Xe && Object.keys(Xe).length !== 0) {
                  ge.update(Xe, Oe, this.imageAtlas && this.imageAtlas.patternPositions || {});
                  var ht = B2 && B2.style && B2.style.getLayer(ie);
                  ht && (this.queryPadding = Math.max(this.queryPadding, ht.queryRadius(ge)));
                }
              }
            }
          }, Au.prototype.holdingForFade = function() {
            return this.symbolFadeHoldUntil !== void 0;
          }, Au.prototype.symbolFadeFinished = function() {
            return !this.symbolFadeHoldUntil || this.symbolFadeHoldUntil < z.now();
          }, Au.prototype.clearFadeHold = function() {
            this.symbolFadeHoldUntil = void 0;
          }, Au.prototype.setHoldDuration = function(M2) {
            this.symbolFadeHoldUntil = z.now() + M2;
          }, Au.prototype.setDependencies = function(M2, B2) {
            for (var ee = {}, ie = 0, ge = B2; ie < ge.length; ie += 1) ee[ge[ie]] = true;
            this.dependencies[M2] = ee;
          }, Au.prototype.hasDependency = function(M2, B2) {
            for (var ee = 0, ie = M2; ee < ie.length; ee += 1) {
              var ge = ie[ee], _e = this.dependencies[ge];
              if (_e) {
                for (var Oe = 0, Xe = B2; Oe < Xe.length; Oe += 1) if (_e[Xe[Oe]]) return true;
              }
            }
            return false;
          };
          var av = self.performance, IP = function(M2) {
            this._marks = { start: [M2.url, "start"].join("#"), end: [M2.url, "end"].join("#"), measure: M2.url.toString() }, av.mark(this._marks.start);
          };
          IP.prototype.finish = function() {
            av.mark(this._marks.end);
            var M2 = av.getEntriesByName(this._marks.measure);
            return M2.length === 0 && (av.measure(this._marks.measure, this._marks.start, this._marks.end), M2 = av.getEntriesByName(this._marks.measure), av.clearMarks(this._marks.start), av.clearMarks(this._marks.end), av.clearMeasures(this._marks.measure)), M2;
          }, i.Actor = M1, i.AlphaImage = gm, i.CanonicalTileID = bm, i.CollisionBoxArray = Te, i.Color = pr, i.DEMData = f0, i.DataConstantProperty = Ya, i.DictionaryCoder = Ow, i.EXTENT = 8192, i.ErrorEvent = Pe, i.EvaluationParameters = Oo, i.Event = Ie, i.Evented = $e, i.FeatureIndex = h0, i.FillBucket = Up, i.FillExtrusionBucket = Vp, i.ImageAtlas = fb, i.ImagePosition = Aw, i.LineBucket = tf, i.LngLat = Is, i.LngLatBounds = tu, i.MercatorCoordinate = xm, i.ONE_EM = 24, i.OverscaledTileID = ru, i.Point = f, i.Point$1 = f, i.Properties = ic, i.Protobuf = kw, i.RGBAImage = ef, i.RequestManager = ae, i.RequestPerformance = IP, i.ResourceType = Et, i.SegmentVector = qt, i.SourceFeatureState = I1, i.StructArrayLayout1ui2 = J2, i.StructArrayLayout2f1f2i16 = Q0, i.StructArrayLayout2i4 = Xf, i.StructArrayLayout3ui6 = Ql, i.StructArrayLayout4i8 = Vs, i.SymbolBucket = Yo, i.Texture = ym, i.Tile = Au, i.Transitionable = Af, i.Uniform1f = ln, i.Uniform1i = Qa, i.Uniform2f = qn, i.Uniform3f = Sa, i.Uniform4f = _a, i.UniformColor = Pa, i.UniformMatrix4f = Oi, i.UnwrappedTileID = DP, i.ValidationError = ut, i.WritingMode = Yf, i.ZoomHistory = Vi, i.add = function(M2, B2, ee) {
            return M2[0] = B2[0] + ee[0], M2[1] = B2[1] + ee[1], M2[2] = B2[2] + ee[2], M2;
          }, i.addDynamicAttributes = DE, i.asyncAll = function(M2, B2, ee) {
            if (!M2.length) return ee(null, []);
            var ie = M2.length, ge = new Array(M2.length), _e = null;
            M2.forEach(function(Oe, Xe) {
              B2(Oe, function(ht, Tt) {
                ht && (_e = ht), ge[Xe] = Tt, --ie == 0 && ee(_e, ge);
              });
            });
          }, i.bezier = p, i.bindAll = _4, i.browser = z, i.cacheEntryPossiblyAdded = function(M2) {
            ++mt > Ke && (M2.getActor().send("enforceCacheSizeLimit", Ue), mt = 0);
          }, i.clamp = v, i.clearTileCache = function(M2) {
            var B2 = self.caches.delete("mapbox-tiles");
            M2 && B2.catch(M2).then(function() {
              return M2();
            });
          }, i.clipLine = hP, i.clone = function(M2) {
            var B2 = new Qc(16);
            return B2[0] = M2[0], B2[1] = M2[1], B2[2] = M2[2], B2[3] = M2[3], B2[4] = M2[4], B2[5] = M2[5], B2[6] = M2[6], B2[7] = M2[7], B2[8] = M2[8], B2[9] = M2[9], B2[10] = M2[10], B2[11] = M2[11], B2[12] = M2[12], B2[13] = M2[13], B2[14] = M2[14], B2[15] = M2[15], B2;
          }, i.clone$1 = S2, i.clone$2 = function(M2) {
            var B2 = new Qc(3);
            return B2[0] = M2[0], B2[1] = M2[1], B2[2] = M2[2], B2;
          }, i.collisionCircleLayout = ioe, i.config = H2, i.create = function() {
            var M2 = new Qc(16);
            return Qc != Float32Array && (M2[1] = 0, M2[2] = 0, M2[3] = 0, M2[4] = 0, M2[6] = 0, M2[7] = 0, M2[8] = 0, M2[9] = 0, M2[11] = 0, M2[12] = 0, M2[13] = 0, M2[14] = 0), M2[0] = 1, M2[5] = 1, M2[10] = 1, M2[15] = 1, M2;
          }, i.create$1 = function() {
            var M2 = new Qc(9);
            return Qc != Float32Array && (M2[1] = 0, M2[2] = 0, M2[3] = 0, M2[5] = 0, M2[6] = 0, M2[7] = 0), M2[0] = 1, M2[4] = 1, M2[8] = 1, M2;
          }, i.create$2 = function() {
            var M2 = new Qc(4);
            return Qc != Float32Array && (M2[1] = 0, M2[2] = 0), M2[0] = 1, M2[3] = 1, M2;
          }, i.createCommonjsModule = l, i.createExpression = nr, i.createLayout = Po, i.createStyleLayer = function(M2) {
            return M2.type === "custom" ? new Roe(M2) : new zoe[M2.type](M2);
          }, i.cross = function(M2, B2, ee) {
            var ie = B2[0], ge = B2[1], _e = B2[2], Oe = ee[0], Xe = ee[1], ht = ee[2];
            return M2[0] = ge * ht - _e * Xe, M2[1] = _e * Oe - ie * ht, M2[2] = ie * Xe - ge * Oe, M2;
          }, i.deepEqual = function M2(B2, ee) {
            if (Array.isArray(B2)) {
              if (!Array.isArray(ee) || B2.length !== ee.length) return false;
              for (var ie = 0; ie < B2.length; ie++) if (!M2(B2[ie], ee[ie])) return false;
              return true;
            }
            if (typeof B2 == "object" && B2 !== null && ee !== null) {
              if (typeof ee != "object" || Object.keys(B2).length !== Object.keys(ee).length) return false;
              for (var ge in B2) if (!M2(B2[ge], ee[ge])) return false;
              return true;
            }
            return B2 === ee;
          }, i.dot = function(M2, B2) {
            return M2[0] * B2[0] + M2[1] * B2[1] + M2[2] * B2[2];
          }, i.dot$1 = function(M2, B2) {
            return M2[0] * B2[0] + M2[1] * B2[1] + M2[2] * B2[2] + M2[3] * B2[3];
          }, i.ease = d, i.emitValidationErrors = Gn, i.endsWith = k, i.enforceCacheSizeLimit = function(M2) {
            ct(), Ae && Ae.then(function(B2) {
              B2.keys().then(function(ee) {
                for (var ie = 0; ie < ee.length - M2; ie++) B2.delete(ee[ie]);
              });
            });
          }, i.evaluateSizeForFeature = oP, i.evaluateSizeForZoom = sP, i.evaluateVariableOffset = vP, i.evented = Ds, i.extend = g, i.featureFilter = Ci, i.filterObject = A2, i.fromRotation = function(M2, B2) {
            var ee = Math.sin(B2), ie = Math.cos(B2);
            return M2[0] = ie, M2[1] = ee, M2[2] = 0, M2[3] = -ee, M2[4] = ie, M2[5] = 0, M2[6] = 0, M2[7] = 0, M2[8] = 1, M2;
          }, i.getAnchorAlignment = TE, i.getAnchorJustification = EE, i.getArrayBuffer = Ot, i.getImage = at, i.getJSON = function(M2, B2) {
            return pt(g(M2, { type: "json" }), B2);
          }, i.getRTLTextPluginStatus = Sl, i.getReferrer = Nt, i.getVideo = function(M2, B2) {
            var ee, ie, ge = self.document.createElement("video");
            ge.muted = true, ge.onloadstart = function() {
              B2(null, ge);
            };
            for (var _e = 0; _e < M2.length; _e++) {
              var Oe = self.document.createElement("source");
              ee = M2[_e], ie = void 0, (ie = self.document.createElement("a")).href = ee, (ie.protocol !== self.document.location.protocol || ie.host !== self.document.location.host) && (ge.crossOrigin = "Anonymous"), Oe.src = M2[_e], ge.appendChild(Oe);
            }
            return { cancel: function() {
            } };
          }, i.identity = rb, i.invert = function(M2, B2) {
            var ee = B2[0], ie = B2[1], ge = B2[2], _e = B2[3], Oe = B2[4], Xe = B2[5], ht = B2[6], Tt = B2[7], Dt = B2[8], Xt = B2[9], ar = B2[10], er = B2[11], hr = B2[12], Sr = B2[13], Ur = B2[14], Br = B2[15], rn = ee * Xe - ie * Oe, nn = ee * ht - ge * Oe, cn = ee * Tt - _e * Oe, In = ie * ht - ge * Xe, Un = ie * Tt - _e * Xe, ha = ge * Tt - _e * ht, fa = Dt * Sr - Xt * hr, wa = Dt * Ur - ar * hr, Wa = Dt * Br - er * hr, $a = Xt * Ur - ar * Sr, Ea = Xt * Br - er * Sr, oi = ar * Br - er * Ur, ei = rn * oi - nn * Ea + cn * $a + In * Wa - Un * wa + ha * fa;
            return ei ? (ei = 1 / ei, M2[0] = (Xe * oi - ht * Ea + Tt * $a) * ei, M2[1] = (ge * Ea - ie * oi - _e * $a) * ei, M2[2] = (Sr * ha - Ur * Un + Br * In) * ei, M2[3] = (ar * Un - Xt * ha - er * In) * ei, M2[4] = (ht * Wa - Oe * oi - Tt * wa) * ei, M2[5] = (ee * oi - ge * Wa + _e * wa) * ei, M2[6] = (Ur * cn - hr * ha - Br * nn) * ei, M2[7] = (Dt * ha - ar * cn + er * nn) * ei, M2[8] = (Oe * Ea - Xe * Wa + Tt * fa) * ei, M2[9] = (ie * Wa - ee * Ea - _e * fa) * ei, M2[10] = (hr * Un - Sr * cn + Br * rn) * ei, M2[11] = (Xt * cn - Dt * Un - er * rn) * ei, M2[12] = (Xe * wa - Oe * $a - ht * fa) * ei, M2[13] = (ee * $a - ie * wa + ge * fa) * ei, M2[14] = (Sr * nn - hr * In - Ur * rn) * ei, M2[15] = (Dt * In - Xt * nn + ar * rn) * ei, M2) : null;
          }, i.isChar = Jn, i.isMapboxURL = ue, i.keysDifference = function(M2, B2) {
            var ee = [];
            for (var ie in M2) ie in B2 || ee.push(ie);
            return ee;
          }, i.makeRequest = pt, i.mapObject = T2, i.mercatorXfromLng = AP, i.mercatorYfromLat = SP, i.mercatorZfromAltitude = EP, i.mul = uE, i.multiply = mm, i.mvt = _1, i.normalize = function(M2, B2) {
            var ee = B2[0], ie = B2[1], ge = B2[2], _e = ee * ee + ie * ie + ge * ge;
            return _e > 0 && (_e = 1 / Math.sqrt(_e)), M2[0] = B2[0] * _e, M2[1] = B2[1] * _e, M2[2] = B2[2] * _e, M2;
          }, i.number = ka, i.offscreenCanvasSupported = wt, i.ortho = function(M2, B2, ee, ie, ge, _e, Oe) {
            var Xe = 1 / (B2 - ee), ht = 1 / (ie - ge), Tt = 1 / (_e - Oe);
            return M2[0] = -2 * Xe, M2[1] = 0, M2[2] = 0, M2[3] = 0, M2[4] = 0, M2[5] = -2 * ht, M2[6] = 0, M2[7] = 0, M2[8] = 0, M2[9] = 0, M2[10] = 2 * Tt, M2[11] = 0, M2[12] = (B2 + ee) * Xe, M2[13] = (ge + ie) * ht, M2[14] = (Oe + _e) * Tt, M2[15] = 1, M2;
          }, i.parseGlyphPBF = function(M2) {
            return new kw(M2).readFields(moe, []);
          }, i.pbf = kw, i.performSymbolLayout = function(M2, B2, ee, ie, ge, _e, Oe) {
            M2.createArrays();
            var Xe = 512 * M2.overscaling;
            M2.tilePixelRatio = 8192 / Xe, M2.compareText = {}, M2.iconsNeedLinear = false;
            var ht = M2.layers[0].layout, Tt = M2.layers[0]._unevaluatedLayout._values, Dt = {};
            if (M2.textSizeData.kind === "composite") {
              var Xt = M2.textSizeData, ar = Xt.minZoom, er = Xt.maxZoom;
              Dt.compositeTextSizes = [Tt["text-size"].possiblyEvaluate(new Oo(ar), Oe), Tt["text-size"].possiblyEvaluate(new Oo(er), Oe)];
            }
            if (M2.iconSizeData.kind === "composite") {
              var hr = M2.iconSizeData, Sr = hr.minZoom, Ur = hr.maxZoom;
              Dt.compositeIconSizes = [Tt["icon-size"].possiblyEvaluate(new Oo(Sr), Oe), Tt["icon-size"].possiblyEvaluate(new Oo(Ur), Oe)];
            }
            Dt.layoutTextSize = Tt["text-size"].possiblyEvaluate(new Oo(M2.zoom + 1), Oe), Dt.layoutIconSize = Tt["icon-size"].possiblyEvaluate(new Oo(M2.zoom + 1), Oe), Dt.textMaxSize = Tt["text-size"].possiblyEvaluate(new Oo(18));
            for (var Br = 24 * ht.get("text-line-height"), rn = ht.get("text-rotation-alignment") === "map" && ht.get("symbol-placement") !== "point", nn = ht.get("text-keep-upright"), cn = ht.get("text-size"), In = function() {
              var fa = ha[Un], wa = ht.get("text-font").evaluate(fa, {}, Oe).join(","), Wa = cn.evaluate(fa, {}, Oe), $a = Dt.layoutTextSize.evaluate(fa, {}, Oe), Ea = Dt.layoutIconSize.evaluate(fa, {}, Oe), oi = { horizontal: {}, vertical: void 0 }, ei = fa.text, Ha = [0, 0];
              if (ei) {
                var xo = ei.toString(), io = 24 * ht.get("text-letter-spacing").evaluate(fa, {}, Oe), Co = function(Yi) {
                  for (var To = 0, ol = Yi; To < ol.length; To += 1) if (!Bi(ol[To].charCodeAt(0))) return false;
                  return true;
                }(xo) ? io : 0, Ti = ht.get("text-anchor").evaluate(fa, {}, Oe), uo = ht.get("text-variable-anchor");
                if (!uo) {
                  var fs = ht.get("text-radial-offset").evaluate(fa, {}, Oe);
                  Ha = fs ? vP(Ti, [24 * fs, SE]) : ht.get("text-offset").evaluate(fa, {}, Oe).map(function(Yi) {
                    return 24 * Yi;
                  });
                }
                var is = rn ? "center" : ht.get("text-justify").evaluate(fa, {}, Oe), Ns = ht.get("symbol-placement"), os = Ns === "point" ? 24 * ht.get("text-max-width").evaluate(fa, {}, Oe) : 0, nu = function() {
                  M2.allowVerticalPlacement && Xi(xo) && (oi.vertical = Sw(ei, B2, ee, ge, wa, os, Br, Ti, "left", Co, Ha, Yf.vertical, true, Ns, $a, Wa));
                };
                if (!rn && uo) {
                  for (var Fs = is === "auto" ? uo.map(function(Yi) {
                    return EE(Yi);
                  }) : [is], lc = false, Su = 0; Su < Fs.length; Su++) {
                    var Bu = Fs[Su];
                    if (!oi.horizontal[Bu]) if (lc) oi.horizontal[Bu] = oi.horizontal[0];
                    else {
                      var jc = Sw(ei, B2, ee, ge, wa, os, Br, "center", Bu, Co, Ha, Yf.horizontal, false, Ns, $a, Wa);
                      jc && (oi.horizontal[Bu] = jc, lc = jc.positionedLines.length === 1);
                    }
                  }
                  nu();
                } else {
                  is === "auto" && (is = EE(Ti));
                  var kc = Sw(ei, B2, ee, ge, wa, os, Br, Ti, is, Co, Ha, Yf.horizontal, false, Ns, $a, Wa);
                  kc && (oi.horizontal[is] = kc), nu(), Xi(xo) && rn && nn && (oi.vertical = Sw(ei, B2, ee, ge, wa, os, Br, Ti, is, Co, Ha, Yf.vertical, false, Ns, $a, Wa));
                }
              }
              var au = void 0, Uu = false;
              if (fa.icon && fa.icon.name) {
                var zl = ie[fa.icon.name];
                zl && (au = function(Yi, To, ol) {
                  var sl = TE(ol), Zs = sl.horizontalAlign, Os = sl.verticalAlign, Lo = To[0], ll = To[1], Wc = Lo - Yi.displaySize[0] * Zs, Mf = Wc + Yi.displaySize[0], Tc = ll - Yi.displaySize[1] * Os;
                  return { image: Yi, top: Tc, bottom: Tc + Yi.displaySize[1], left: Wc, right: Mf };
                }(ge[fa.icon.name], ht.get("icon-offset").evaluate(fa, {}, Oe), ht.get("icon-anchor").evaluate(fa, {}, Oe)), Uu = zl.sdf, M2.sdfIcons === void 0 ? M2.sdfIcons = zl.sdf : M2.sdfIcons !== zl.sdf && E2("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"), (zl.pixelRatio !== M2.pixelRatio || ht.get("icon-rotate").constantOr(1) !== 0) && (M2.iconsNeedLinear = true));
              }
              var hu = gP(oi.horizontal) || oi.vertical;
              M2.iconsInText = !!hu && hu.iconsInText, (hu || au) && function(Yi, To, ol, sl, Zs, Os, Lo, ll, Wc, Mf, Tc) {
                var jp = Os.textMaxSize.evaluate(To, {});
                jp === void 0 && (jp = Lo);
                var p0, Eu = Yi.layers[0].layout, Wp = Eu.get("icon-offset").evaluate(To, {}, Tc), Gp = gP(ol.horizontal), $p = Lo / 24, FE = Yi.tilePixelRatio * $p, N1 = Yi.tilePixelRatio * jp / 24, Lw = Yi.tilePixelRatio * ll, _m = Yi.tilePixelRatio * Eu.get("symbol-spacing"), Rw = Eu.get("text-padding") * Yi.tilePixelRatio, zw = Eu.get("icon-padding") * Yi.tilePixelRatio, Bw = Eu.get("text-max-angle") / 180 * Math.PI, Uw = Eu.get("text-rotation-alignment") === "map" && Eu.get("symbol-placement") !== "point", iv = Eu.get("icon-rotation-alignment") === "map" && Eu.get("symbol-placement") !== "point", F14 = Eu.get("symbol-placement"), Vw = _m / 2, O1 = Eu.get("icon-text-fit");
                sl && O1 !== "none" && (Yi.allowVerticalPlacement && ol.vertical && (p0 = iP(sl, ol.vertical, O1, Eu.get("icon-text-fit-padding"), Wp, $p)), Gp && (sl = iP(sl, Gp, O1, Eu.get("icon-text-fit-padding"), Wp, $p)));
                var ov = function(Voe, xb) {
                  xb.x < 0 || xb.x >= 8192 || xb.y < 0 || xb.y >= 8192 || function(Dl, Hp, joe, sv, zE, PP, Kw, Fd, Yw, bb, Zw, Jw, BE, LP, _b, RP, zP, BP, UP, VP, Zf, Qw, jP, Od, Woe) {
                    var UE, wm, U1, V1, j1, W1 = Dl.addToLineVertexArray(Hp, joe), WP = 0, GP = 0, $P = 0, HP = 0, VE = -1, jE = -1, d0 = {}, qP = Pr(""), WE = 0, GE = 0;
                    if (Fd._unevaluatedLayout.getValue("text-radial-offset") === void 0 ? (UE = Fd.layout.get("text-offset").evaluate(Zf, {}, Od).map(function(kb) {
                      return 24 * kb;
                    }), WE = UE[0], GE = UE[1]) : (WE = 24 * Fd.layout.get("text-radial-offset").evaluate(Zf, {}, Od), GE = SE), Dl.allowVerticalPlacement && sv.vertical) {
                      var XP = Fd.layout.get("text-rotate").evaluate(Zf, {}, Od) + 90, Goe = sv.vertical;
                      V1 = new Iw(Yw, Hp, bb, Zw, Jw, Goe, BE, LP, _b, XP), Kw && (j1 = new Iw(Yw, Hp, bb, Zw, Jw, Kw, zP, BP, _b, XP));
                    }
                    if (zE) {
                      var $E = Fd.layout.get("icon-rotate").evaluate(Zf, {}), KP = Fd.layout.get("icon-text-fit") !== "none", YP = pP(zE, $E, jP, KP), HE = Kw ? pP(Kw, $E, jP, KP) : void 0;
                      U1 = new Iw(Yw, Hp, bb, Zw, Jw, zE, zP, BP, false, $E), WP = 4 * YP.length;
                      var ZP = Dl.iconSizeData, wb = null;
                      ZP.kind === "source" ? (wb = [128 * Fd.layout.get("icon-size").evaluate(Zf, {})])[0] > 32640 && E2(Dl.layerIds[0] + ': Value for "icon-size" is >= 255. Reduce your "icon-size".') : ZP.kind === "composite" && ((wb = [128 * Qw.compositeIconSizes[0].evaluate(Zf, {}, Od), 128 * Qw.compositeIconSizes[1].evaluate(Zf, {}, Od)])[0] > 32640 || wb[1] > 32640) && E2(Dl.layerIds[0] + ': Value for "icon-size" is >= 255. Reduce your "icon-size".'), Dl.addSymbols(Dl.icon, YP, wb, VP, UP, Zf, false, Hp, W1.lineStartIndex, W1.lineLength, -1, Od), VE = Dl.icon.placedSymbolArray.length - 1, HE && (GP = 4 * HE.length, Dl.addSymbols(Dl.icon, HE, wb, VP, UP, Zf, Yf.vertical, Hp, W1.lineStartIndex, W1.lineLength, -1, Od), jE = Dl.icon.placedSymbolArray.length - 1);
                    }
                    for (var JP in sv.horizontal) {
                      var e3 = sv.horizontal[JP];
                      if (!wm) {
                        qP = Pr(e3.text);
                        var $oe = Fd.layout.get("text-rotate").evaluate(Zf, {}, Od);
                        wm = new Iw(Yw, Hp, bb, Zw, Jw, e3, BE, LP, _b, $oe);
                      }
                      var QP = e3.positionedLines.length === 1;
                      if ($P += mP(Dl, Hp, e3, PP, Fd, _b, Zf, RP, W1, sv.vertical ? Yf.horizontal : Yf.horizontalOnly, QP ? Object.keys(sv.horizontal) : [JP], d0, VE, Qw, Od), QP) break;
                    }
                    sv.vertical && (HP += mP(Dl, Hp, sv.vertical, PP, Fd, _b, Zf, RP, W1, Yf.vertical, ["vertical"], d0, jE, Qw, Od));
                    var Hoe = wm ? wm.boxStartIndex : Dl.collisionBoxArray.length, qoe = wm ? wm.boxEndIndex : Dl.collisionBoxArray.length, Xoe = V1 ? V1.boxStartIndex : Dl.collisionBoxArray.length, Koe = V1 ? V1.boxEndIndex : Dl.collisionBoxArray.length, Yoe = U1 ? U1.boxStartIndex : Dl.collisionBoxArray.length, Zoe = U1 ? U1.boxEndIndex : Dl.collisionBoxArray.length, Joe = j1 ? j1.boxStartIndex : Dl.collisionBoxArray.length, Qoe = j1 ? j1.boxEndIndex : Dl.collisionBoxArray.length, Pd = -1, t3 = function(kb, tL) {
                      return kb && kb.circleDiameter ? Math.max(kb.circleDiameter, tL) : tL;
                    };
                    Pd = t3(wm, Pd), Pd = t3(V1, Pd), Pd = t3(U1, Pd);
                    var eL = (Pd = t3(j1, Pd)) > -1 ? 1 : 0;
                    eL && (Pd *= Woe / 24), Dl.glyphOffsetArray.length >= Yo.MAX_GLYPHS && E2("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"), Zf.sortKey !== void 0 && Dl.addToSortKeyRanges(Dl.symbolInstances.length, Zf.sortKey), Dl.symbolInstances.emplaceBack(Hp.x, Hp.y, d0.right >= 0 ? d0.right : -1, d0.center >= 0 ? d0.center : -1, d0.left >= 0 ? d0.left : -1, d0.vertical || -1, VE, jE, qP, Hoe, qoe, Xoe, Koe, Yoe, Zoe, Joe, Qoe, bb, $P, HP, WP, GP, eL, 0, BE, WE, GE, Pd);
                  }(Yi, xb, Voe, ol, sl, Zs, p0, Yi.layers[0], Yi.collisionBoxArray, To.index, To.sourceLayerIndex, Yi.index, FE, Rw, Uw, Wc, Lw, zw, iv, Wp, To, Os, Mf, Tc, Lo);
                };
                if (F14 === "line") for (var db = 0, jw = hP(To.geometry, 0, 0, 8192, 8192); db < jw.length; db += 1) for (var Ww = jw[db], Gw = koe(Ww, _m, Bw, ol.vertical || Gp, sl, 24, N1, Yi.overscaling, 8192), vb = 0, $w = Gw; vb < $w.length; vb += 1) {
                  var mb = $w[vb], Hw = Gp;
                  Hw && Eoe(Yi, Hw.text, Vw, mb) || ov(Ww, mb);
                }
                else if (F14 === "line-center") for (var gb = 0, qw = To.geometry; gb < qw.length; gb += 1) {
                  var P1 = qw[gb];
                  if (P1.length > 1) {
                    var L1 = woe(P1, Bw, ol.vertical || Gp, sl, 24, N1);
                    L1 && ov(P1, L1);
                  }
                }
                else if (To.type === "Polygon") for (var R1 = 0, Xw = yE(To.geometry, 0); R1 < Xw.length; R1 += 1) {
                  var z1 = Xw[R1], yb = Aoe(z1, 16);
                  ov(z1[0], new A1(yb.x, yb.y, 0));
                }
                else if (To.type === "LineString") for (var B1 = 0, NP = To.geometry; B1 < NP.length; B1 += 1) {
                  var OE = NP[B1];
                  ov(OE, new A1(OE[0].x, OE[0].y, 0));
                }
                else if (To.type === "Point") for (var PE = 0, FP = To.geometry; PE < FP.length; PE += 1) for (var Uoe = FP[PE], LE = 0, OP = Uoe; LE < OP.length; LE += 1) {
                  var RE = OP[LE];
                  ov([RE], new A1(RE.x, RE.y, 0));
                }
              }(M2, fa, oi, au, ie, Dt, $a, Ea, Ha, Uu, Oe);
            }, Un = 0, ha = M2.features; Un < ha.length; Un += 1) In();
            _e && M2.generateCollisionDebugBuffers();
          }, i.perspective = function(M2, B2, ee, ie, ge) {
            var _e, Oe = 1 / Math.tan(B2 / 2);
            return M2[0] = Oe / ee, M2[1] = 0, M2[2] = 0, M2[3] = 0, M2[4] = 0, M2[5] = Oe, M2[6] = 0, M2[7] = 0, M2[8] = 0, M2[9] = 0, M2[11] = -1, M2[12] = 0, M2[13] = 0, M2[15] = 0, ge != null && ge !== 1 / 0 ? (_e = 1 / (ie - ge), M2[10] = (ge + ie) * _e, M2[14] = 2 * ge * ie * _e) : (M2[10] = -1, M2[14] = -2 * ie), M2;
          }, i.pick = function(M2, B2) {
            for (var ee = {}, ie = 0; ie < B2.length; ie++) {
              var ge = B2[ie];
              ge in M2 && (ee[ge] = M2[ge]);
            }
            return ee;
          }, i.plugin = fu, i.polygonIntersectsPolygon = _c, i.postMapLoadEvent = Be, i.postTurnstileEvent = Se, i.potpack = tP, i.refProperties = ["type", "source", "source-layer", "minzoom", "maxzoom", "filter", "layout"], i.register = mn, i.registerForPluginStateChange = function(M2) {
            return M2({ pluginStatus: gi, pluginURL: ls }), Ds.on("pluginStateChange", M2), M2;
          }, i.rotate = function(M2, B2, ee) {
            var ie = B2[0], ge = B2[1], _e = B2[2], Oe = B2[3], Xe = Math.sin(ee), ht = Math.cos(ee);
            return M2[0] = ie * ht + _e * Xe, M2[1] = ge * ht + Oe * Xe, M2[2] = ie * -Xe + _e * ht, M2[3] = ge * -Xe + Oe * ht, M2;
          }, i.rotateX = function(M2, B2, ee) {
            var ie = Math.sin(ee), ge = Math.cos(ee), _e = B2[4], Oe = B2[5], Xe = B2[6], ht = B2[7], Tt = B2[8], Dt = B2[9], Xt = B2[10], ar = B2[11];
            return B2 !== M2 && (M2[0] = B2[0], M2[1] = B2[1], M2[2] = B2[2], M2[3] = B2[3], M2[12] = B2[12], M2[13] = B2[13], M2[14] = B2[14], M2[15] = B2[15]), M2[4] = _e * ge + Tt * ie, M2[5] = Oe * ge + Dt * ie, M2[6] = Xe * ge + Xt * ie, M2[7] = ht * ge + ar * ie, M2[8] = Tt * ge - _e * ie, M2[9] = Dt * ge - Oe * ie, M2[10] = Xt * ge - Xe * ie, M2[11] = ar * ge - ht * ie, M2;
          }, i.rotateZ = function(M2, B2, ee) {
            var ie = Math.sin(ee), ge = Math.cos(ee), _e = B2[0], Oe = B2[1], Xe = B2[2], ht = B2[3], Tt = B2[4], Dt = B2[5], Xt = B2[6], ar = B2[7];
            return B2 !== M2 && (M2[8] = B2[8], M2[9] = B2[9], M2[10] = B2[10], M2[11] = B2[11], M2[12] = B2[12], M2[13] = B2[13], M2[14] = B2[14], M2[15] = B2[15]), M2[0] = _e * ge + Tt * ie, M2[1] = Oe * ge + Dt * ie, M2[2] = Xe * ge + Xt * ie, M2[3] = ht * ge + ar * ie, M2[4] = Tt * ge - _e * ie, M2[5] = Dt * ge - Oe * ie, M2[6] = Xt * ge - Xe * ie, M2[7] = ar * ge - ht * ie, M2;
          }, i.scale = function(M2, B2, ee) {
            var ie = ee[0], ge = ee[1], _e = ee[2];
            return M2[0] = B2[0] * ie, M2[1] = B2[1] * ie, M2[2] = B2[2] * ie, M2[3] = B2[3] * ie, M2[4] = B2[4] * ge, M2[5] = B2[5] * ge, M2[6] = B2[6] * ge, M2[7] = B2[7] * ge, M2[8] = B2[8] * _e, M2[9] = B2[9] * _e, M2[10] = B2[10] * _e, M2[11] = B2[11] * _e, M2[12] = B2[12], M2[13] = B2[13], M2[14] = B2[14], M2[15] = B2[15], M2;
          }, i.scale$1 = function(M2, B2, ee) {
            return M2[0] = B2[0] * ee, M2[1] = B2[1] * ee, M2[2] = B2[2] * ee, M2[3] = B2[3] * ee, M2;
          }, i.scale$2 = function(M2, B2, ee) {
            return M2[0] = B2[0] * ee, M2[1] = B2[1] * ee, M2[2] = B2[2] * ee, M2;
          }, i.setCacheLimits = function(M2, B2) {
            Ue = M2, Ke = B2;
          }, i.setRTLTextPlugin = function(M2, B2, ee) {
            if (ee === void 0 && (ee = false), gi === mo || gi === il || gi === Jc) throw new Error("setRTLTextPlugin cannot be called multiple times.");
            ls = z.resolveURL(M2), gi = mo, _u = B2, go(), ee || Fo();
          }, i.sphericalToCartesian = function(M2) {
            var B2 = M2[0], ee = M2[1], ie = M2[2];
            return ee += 90, ee *= Math.PI / 180, ie *= Math.PI / 180, { x: B2 * Math.cos(ee) * Math.sin(ie), y: B2 * Math.sin(ee) * Math.sin(ie), z: B2 * Math.cos(ie) };
          }, i.sqrLen = wie, i.styleSpec = Ve, i.sub = fE, i.symbolSize = _oe, i.transformMat3 = function(M2, B2, ee) {
            var ie = B2[0], ge = B2[1], _e = B2[2];
            return M2[0] = ie * ee[0] + ge * ee[3] + _e * ee[6], M2[1] = ie * ee[1] + ge * ee[4] + _e * ee[7], M2[2] = ie * ee[2] + ge * ee[5] + _e * ee[8], M2;
          }, i.transformMat4 = rv, i.translate = function(M2, B2, ee) {
            var ie, ge, _e, Oe, Xe, ht, Tt, Dt, Xt, ar, er, hr, Sr = ee[0], Ur = ee[1], Br = ee[2];
            return B2 === M2 ? (M2[12] = B2[0] * Sr + B2[4] * Ur + B2[8] * Br + B2[12], M2[13] = B2[1] * Sr + B2[5] * Ur + B2[9] * Br + B2[13], M2[14] = B2[2] * Sr + B2[6] * Ur + B2[10] * Br + B2[14], M2[15] = B2[3] * Sr + B2[7] * Ur + B2[11] * Br + B2[15]) : (ie = B2[0], ge = B2[1], _e = B2[2], Oe = B2[3], Xe = B2[4], ht = B2[5], Tt = B2[6], Dt = B2[7], Xt = B2[8], ar = B2[9], er = B2[10], hr = B2[11], M2[0] = ie, M2[1] = ge, M2[2] = _e, M2[3] = Oe, M2[4] = Xe, M2[5] = ht, M2[6] = Tt, M2[7] = Dt, M2[8] = Xt, M2[9] = ar, M2[10] = er, M2[11] = hr, M2[12] = ie * Sr + Xe * Ur + Xt * Br + B2[12], M2[13] = ge * Sr + ht * Ur + ar * Br + B2[13], M2[14] = _e * Sr + Tt * Ur + er * Br + B2[14], M2[15] = Oe * Sr + Dt * Ur + hr * Br + B2[15]), M2;
          }, i.triggerPluginCompletionEvent = wu, i.uniqueId = b, i.validateCustomStyleLayer = function(M2) {
            var B2 = [], ee = M2.id;
            return ee === void 0 && B2.push({ message: "layers." + ee + ': missing required property "id"' }), M2.render === void 0 && B2.push({ message: "layers." + ee + ': missing required method "render"' }), M2.renderingMode && M2.renderingMode !== "2d" && M2.renderingMode !== "3d" && B2.push({ message: "layers." + ee + ': property "renderingMode" must be either "2d" or "3d"' }), B2;
          }, i.validateLight = En, i.validateStyle = dn, i.values = function(M2) {
            var B2 = [];
            for (var ee in M2) B2.push(M2[ee]);
            return B2;
          }, i.vectorTile = _1, i.version = "1.10.1", i.warnOnce = E2, i.webpSupported = te, i.window = self, i.wrap = m;
        }), s(0, function(i) {
          function l(Ie) {
            var Pe = typeof Ie;
            if (Pe === "number" || Pe === "boolean" || Pe === "string" || Ie == null) return JSON.stringify(Ie);
            if (Array.isArray(Ie)) {
              for (var $e = "[", Ve = 0, ut = Ie; Ve < ut.length; Ve += 1) $e += l(ut[Ve]) + ",";
              return $e + "]";
            }
            for (var Re = Object.keys(Ie).sort(), qe = "{", je = 0; je < Re.length; je++) qe += JSON.stringify(Re[je]) + ":" + l(Ie[Re[je]]) + ",";
            return qe + "}";
          }
          function u2(Ie) {
            for (var Pe = "", $e = 0, Ve = i.refProperties; $e < Ve.length; $e += 1) Pe += "/" + l(Ie[Ve[$e]]);
            return Pe;
          }
          var c = function(Ie) {
            this.keyCache = {}, Ie && this.replace(Ie);
          };
          c.prototype.replace = function(Ie) {
            this._layerConfigs = {}, this._layers = {}, this.update(Ie, []);
          }, c.prototype.update = function(Ie, Pe) {
            for (var $e = this, Ve = 0, ut = Ie; Ve < ut.length; Ve += 1) {
              var Re = ut[Ve];
              this._layerConfigs[Re.id] = Re;
              var qe = this._layers[Re.id] = i.createStyleLayer(Re);
              qe._featureFilter = i.featureFilter(qe.filter), this.keyCache[Re.id] && delete this.keyCache[Re.id];
            }
            for (var je = 0, rt = Pe; je < rt.length; je += 1) {
              var He = rt[je];
              delete this.keyCache[He], delete this._layerConfigs[He], delete this._layers[He];
            }
            this.familiesBySource = {};
            for (var xe = 0, Ne = function(Je, tt) {
              for (var vt = {}, kt = 0; kt < Je.length; kt++) {
                var jt = tt && tt[Je[kt].id] || u2(Je[kt]);
                tt && (tt[Je[kt].id] = jt);
                var Vt = vt[jt];
                Vt || (Vt = vt[jt] = []), Vt.push(Je[kt]);
              }
              var Kt = [];
              for (var rr in vt) Kt.push(vt[rr]);
              return Kt;
            }(i.values(this._layerConfigs), this.keyCache); xe < Ne.length; xe += 1) {
              var ke = Ne[xe].map(function(Je) {
                return $e._layers[Je.id];
              }), Me = ke[0];
              if (Me.visibility !== "none") {
                var Le = Me.source || "", ze = this.familiesBySource[Le];
                ze || (ze = this.familiesBySource[Le] = {});
                var ft = Me.sourceLayer || "_geojsonTileLayer", De = ze[ft];
                De || (De = ze[ft] = []), De.push(ke);
              }
            }
          };
          var f = function(Ie) {
            var Pe = {}, $e = [];
            for (var Ve in Ie) {
              var ut = Ie[Ve], Re = Pe[Ve] = {};
              for (var qe in ut) {
                var je = ut[+qe];
                if (je && je.bitmap.width !== 0 && je.bitmap.height !== 0) {
                  var rt = { x: 0, y: 0, w: je.bitmap.width + 2, h: je.bitmap.height + 2 };
                  $e.push(rt), Re[qe] = { rect: rt, metrics: je.metrics };
                }
              }
            }
            var He = i.potpack($e), xe = He.w, Ne = He.h, ke = new i.AlphaImage({ width: xe || 1, height: Ne || 1 });
            for (var Me in Ie) {
              var Le = Ie[Me];
              for (var ze in Le) {
                var ft = Le[+ze];
                if (ft && ft.bitmap.width !== 0 && ft.bitmap.height !== 0) {
                  var De = Pe[Me][ze].rect;
                  i.AlphaImage.copy(ft.bitmap, ke, { x: 0, y: 0 }, { x: De.x + 1, y: De.y + 1 }, ft.bitmap);
                }
              }
            }
            this.image = ke, this.positions = Pe;
          };
          i.register("GlyphAtlas", f);
          var h = function(Ie) {
            this.tileID = new i.OverscaledTileID(Ie.tileID.overscaledZ, Ie.tileID.wrap, Ie.tileID.canonical.z, Ie.tileID.canonical.x, Ie.tileID.canonical.y), this.uid = Ie.uid, this.zoom = Ie.zoom, this.pixelRatio = Ie.pixelRatio, this.tileSize = Ie.tileSize, this.source = Ie.source, this.overscaling = this.tileID.overscaleFactor(), this.showCollisionBoxes = Ie.showCollisionBoxes, this.collectResourceTiming = !!Ie.collectResourceTiming, this.returnDependencies = !!Ie.returnDependencies, this.promoteId = Ie.promoteId;
          };
          function p(Ie, Pe, $e) {
            for (var Ve = new i.EvaluationParameters(Pe), ut = 0, Re = Ie; ut < Re.length; ut += 1) Re[ut].recalculate(Ve, $e);
          }
          function d(Ie, Pe) {
            var $e = i.getArrayBuffer(Ie.request, function(Ve, ut, Re, qe) {
              Ve ? Pe(Ve) : ut && Pe(null, { vectorTile: new i.vectorTile.VectorTile(new i.pbf(ut)), rawData: ut, cacheControl: Re, expires: qe });
            });
            return function() {
              $e.cancel(), Pe();
            };
          }
          h.prototype.parse = function(Ie, Pe, $e, Ve, ut) {
            var Re = this;
            this.status = "parsing", this.data = Ie, this.collisionBoxArray = new i.CollisionBoxArray();
            var qe = new i.DictionaryCoder(Object.keys(Ie.layers).sort()), je = new i.FeatureIndex(this.tileID, this.promoteId);
            je.bucketLayerIDs = [];
            var rt, He, xe, Ne, ke = {}, Me = { featureIndex: je, iconDependencies: {}, patternDependencies: {}, glyphDependencies: {}, availableImages: $e }, Le = Pe.familiesBySource[this.source];
            for (var ze in Le) {
              var ft = Ie.layers[ze];
              if (ft) {
                ft.version === 1 && i.warnOnce('Vector tile source "' + this.source + '" layer "' + ze + '" does not use vector tile spec v2 and therefore may have some rendering errors.');
                for (var De = qe.encode(ze), Je = [], tt = 0; tt < ft.length; tt++) {
                  var vt = ft.feature(tt), kt = je.getId(vt, ze);
                  Je.push({ feature: vt, id: kt, index: tt, sourceLayerIndex: De });
                }
                for (var jt = 0, Vt = Le[ze]; jt < Vt.length; jt += 1) {
                  var Kt = Vt[jt], rr = Kt[0];
                  rr.minzoom && this.zoom < Math.floor(rr.minzoom) || rr.maxzoom && this.zoom >= rr.maxzoom || rr.visibility !== "none" && (p(Kt, this.zoom, $e), (ke[rr.id] = rr.createBucket({ index: je.bucketLayerIDs.length, layers: Kt, zoom: this.zoom, pixelRatio: this.pixelRatio, overscaling: this.overscaling, collisionBoxArray: this.collisionBoxArray, sourceLayerIndex: De, sourceID: this.source })).populate(Je, Me, this.tileID.canonical), je.bucketLayerIDs.push(Kt.map(function(_r) {
                    return _r.id;
                  })));
                }
              }
            }
            var Tr = i.mapObject(Me.glyphDependencies, function(_r) {
              return Object.keys(_r).map(Number);
            });
            Object.keys(Tr).length ? Ve.send("getGlyphs", { uid: this.uid, stacks: Tr }, function(_r, $r) {
              rt || (rt = _r, He = $r, lr.call(Re));
            }) : He = {};
            var yr = Object.keys(Me.iconDependencies);
            yr.length ? Ve.send("getImages", { icons: yr, source: this.source, tileID: this.tileID, type: "icons" }, function(_r, $r) {
              rt || (rt = _r, xe = $r, lr.call(Re));
            }) : xe = {};
            var pr = Object.keys(Me.patternDependencies);
            function lr() {
              if (rt) return ut(rt);
              if (He && xe && Ne) {
                var _r = new f(He), $r = new i.ImageAtlas(xe, Ne);
                for (var Ar in ke) {
                  var Qr = ke[Ar];
                  Qr instanceof i.SymbolBucket ? (p(Qr.layers, this.zoom, $e), i.performSymbolLayout(Qr, He, _r.positions, xe, $r.iconPositions, this.showCollisionBoxes, this.tileID.canonical)) : Qr.hasPattern && (Qr instanceof i.LineBucket || Qr instanceof i.FillBucket || Qr instanceof i.FillExtrusionBucket) && (p(Qr.layers, this.zoom, $e), Qr.addFeatures(Me, this.tileID.canonical, $r.patternPositions));
                }
                this.status = "done", ut(null, { buckets: i.values(ke).filter(function(hn) {
                  return !hn.isEmpty();
                }), featureIndex: je, collisionBoxArray: this.collisionBoxArray, glyphAtlasImage: _r.image, imageAtlas: $r, glyphMap: this.returnDependencies ? He : null, iconMap: this.returnDependencies ? xe : null, glyphPositions: this.returnDependencies ? _r.positions : null });
              }
            }
            pr.length ? Ve.send("getImages", { icons: pr, source: this.source, tileID: this.tileID, type: "patterns" }, function(_r, $r) {
              rt || (rt = _r, Ne = $r, lr.call(Re));
            }) : Ne = {}, lr.call(this);
          };
          var v = function(Ie, Pe, $e, Ve) {
            this.actor = Ie, this.layerIndex = Pe, this.availableImages = $e, this.loadVectorData = Ve || d, this.loading = {}, this.loaded = {};
          };
          v.prototype.loadTile = function(Ie, Pe) {
            var $e = this, Ve = Ie.uid;
            this.loading || (this.loading = {});
            var ut = !!(Ie && Ie.request && Ie.request.collectResourceTiming) && new i.RequestPerformance(Ie.request), Re = this.loading[Ve] = new h(Ie);
            Re.abort = this.loadVectorData(Ie, function(qe, je) {
              if (delete $e.loading[Ve], qe || !je) return Re.status = "done", $e.loaded[Ve] = Re, Pe(qe);
              var rt = je.rawData, He = {};
              je.expires && (He.expires = je.expires), je.cacheControl && (He.cacheControl = je.cacheControl);
              var xe = {};
              if (ut) {
                var Ne = ut.finish();
                Ne && (xe.resourceTiming = JSON.parse(JSON.stringify(Ne)));
              }
              Re.vectorTile = je.vectorTile, Re.parse(je.vectorTile, $e.layerIndex, $e.availableImages, $e.actor, function(ke, Me) {
                if (ke || !Me) return Pe(ke);
                Pe(null, i.extend({ rawTileData: rt.slice(0) }, Me, He, xe));
              }), $e.loaded = $e.loaded || {}, $e.loaded[Ve] = Re;
            });
          }, v.prototype.reloadTile = function(Ie, Pe) {
            var $e = this, Ve = this.loaded, ut = Ie.uid, Re = this;
            if (Ve && Ve[ut]) {
              var qe = Ve[ut];
              qe.showCollisionBoxes = Ie.showCollisionBoxes;
              var je = function(rt, He) {
                var xe = qe.reloadCallback;
                xe && (delete qe.reloadCallback, qe.parse(qe.vectorTile, Re.layerIndex, $e.availableImages, Re.actor, xe)), Pe(rt, He);
              };
              qe.status === "parsing" ? qe.reloadCallback = je : qe.status === "done" && (qe.vectorTile ? qe.parse(qe.vectorTile, this.layerIndex, this.availableImages, this.actor, je) : je());
            }
          }, v.prototype.abortTile = function(Ie, Pe) {
            var $e = this.loading, Ve = Ie.uid;
            $e && $e[Ve] && $e[Ve].abort && ($e[Ve].abort(), delete $e[Ve]), Pe();
          }, v.prototype.removeTile = function(Ie, Pe) {
            var $e = this.loaded, Ve = Ie.uid;
            $e && $e[Ve] && delete $e[Ve], Pe();
          };
          var m = i.window.ImageBitmap, g = function() {
            this.loaded = {};
          };
          g.prototype.loadTile = function(Ie, Pe) {
            var $e = Ie.uid, Ve = Ie.encoding, ut = Ie.rawImageData, Re = m && ut instanceof m ? this.getImageData(ut) : ut, qe = new i.DEMData($e, Re, Ve);
            this.loaded = this.loaded || {}, this.loaded[$e] = qe, Pe(null, qe);
          }, g.prototype.getImageData = function(Ie) {
            this.offscreenCanvas && this.offscreenCanvasContext || (this.offscreenCanvas = new OffscreenCanvas(Ie.width, Ie.height), this.offscreenCanvasContext = this.offscreenCanvas.getContext("2d")), this.offscreenCanvas.width = Ie.width, this.offscreenCanvas.height = Ie.height, this.offscreenCanvasContext.drawImage(Ie, 0, 0, Ie.width, Ie.height);
            var Pe = this.offscreenCanvasContext.getImageData(-1, -1, Ie.width + 2, Ie.height + 2);
            return this.offscreenCanvasContext.clearRect(0, 0, this.offscreenCanvas.width, this.offscreenCanvas.height), new i.RGBAImage({ width: Pe.width, height: Pe.height }, Pe.data);
          }, g.prototype.removeTile = function(Ie) {
            var Pe = this.loaded, $e = Ie.uid;
            Pe && Pe[$e] && delete Pe[$e];
          };
          var x = function Ie(Pe, $e) {
            var Ve, ut = Pe && Pe.type;
            if (ut === "FeatureCollection") for (Ve = 0; Ve < Pe.features.length; Ve++) Ie(Pe.features[Ve], $e);
            else if (ut === "GeometryCollection") for (Ve = 0; Ve < Pe.geometries.length; Ve++) Ie(Pe.geometries[Ve], $e);
            else if (ut === "Feature") Ie(Pe.geometry, $e);
            else if (ut === "Polygon") b(Pe.coordinates, $e);
            else if (ut === "MultiPolygon") for (Ve = 0; Ve < Pe.coordinates.length; Ve++) b(Pe.coordinates[Ve], $e);
            return Pe;
          };
          function b(Ie, Pe) {
            if (Ie.length !== 0) {
              y(Ie[0], Pe);
              for (var $e = 1; $e < Ie.length; $e++) y(Ie[$e], !Pe);
            }
          }
          function y(Ie, Pe) {
            for (var $e = 0, Ve = 0, ut = Ie.length, Re = ut - 1; Ve < ut; Re = Ve++) $e += (Ie[Ve][0] - Ie[Re][0]) * (Ie[Re][1] + Ie[Ve][1]);
            $e >= 0 != !!Pe && Ie.reverse();
          }
          var w = i.vectorTile.VectorTileFeature.prototype.toGeoJSON, _4 = function(Ie) {
            this._feature = Ie, this.extent = i.EXTENT, this.type = Ie.type, this.properties = Ie.tags, "id" in Ie && !isNaN(Ie.id) && (this.id = parseInt(Ie.id, 10));
          };
          _4.prototype.loadGeometry = function() {
            if (this._feature.type === 1) {
              for (var Ie = [], Pe = 0, $e = this._feature.geometry; Pe < $e.length; Pe += 1) {
                var Ve = $e[Pe];
                Ie.push([new i.Point$1(Ve[0], Ve[1])]);
              }
              return Ie;
            }
            for (var ut = [], Re = 0, qe = this._feature.geometry; Re < qe.length; Re += 1) {
              for (var je = [], rt = 0, He = qe[Re]; rt < He.length; rt += 1) {
                var xe = He[rt];
                je.push(new i.Point$1(xe[0], xe[1]));
              }
              ut.push(je);
            }
            return ut;
          }, _4.prototype.toGeoJSON = function(Ie, Pe, $e) {
            return w.call(this, Ie, Pe, $e);
          };
          var k = function(Ie) {
            this.layers = { _geojsonTileLayer: this }, this.name = "_geojsonTileLayer", this.extent = i.EXTENT, this.length = Ie.length, this._features = Ie;
          };
          k.prototype.feature = function(Ie) {
            return new _4(this._features[Ie]);
          };
          var T2 = i.vectorTile.VectorTileFeature, A2 = S2;
          function S2(Ie, Pe) {
            this.options = Pe || {}, this.features = Ie, this.length = Ie.length;
          }
          function C2(Ie, Pe) {
            this.id = typeof Ie.id == "number" ? Ie.id : void 0, this.type = Ie.type, this.rawGeometry = Ie.type === 1 ? [Ie.geometry] : Ie.geometry, this.properties = Ie.tags, this.extent = Pe || 4096;
          }
          S2.prototype.feature = function(Ie) {
            return new C2(this.features[Ie], this.options.extent);
          }, C2.prototype.loadGeometry = function() {
            var Ie = this.rawGeometry;
            this.geometry = [];
            for (var Pe = 0; Pe < Ie.length; Pe++) {
              for (var $e = Ie[Pe], Ve = [], ut = 0; ut < $e.length; ut++) Ve.push(new i.Point$1($e[ut][0], $e[ut][1]));
              this.geometry.push(Ve);
            }
            return this.geometry;
          }, C2.prototype.bbox = function() {
            this.geometry || this.loadGeometry();
            for (var Ie = this.geometry, Pe = 1 / 0, $e = -1 / 0, Ve = 1 / 0, ut = -1 / 0, Re = 0; Re < Ie.length; Re++) for (var qe = Ie[Re], je = 0; je < qe.length; je++) {
              var rt = qe[je];
              Pe = Math.min(Pe, rt.x), $e = Math.max($e, rt.x), Ve = Math.min(Ve, rt.y), ut = Math.max(ut, rt.y);
            }
            return [Pe, Ve, $e, ut];
          }, C2.prototype.toGeoJSON = T2.prototype.toGeoJSON;
          var E2 = I2, F13 = I2, N2 = function(Ie, Pe) {
            Pe = Pe || {};
            var $e = {};
            for (var Ve in Ie) $e[Ve] = new A2(Ie[Ve].features, Pe), $e[Ve].name = Ve, $e[Ve].version = Pe.version, $e[Ve].extent = Pe.extent;
            return I2({ layers: $e });
          }, D2 = A2;
          function I2(Ie) {
            var Pe = new i.pbf();
            return function($e, Ve) {
              for (var ut in $e.layers) Ve.writeMessage(3, O2, $e.layers[ut]);
            }(Ie, Pe), Pe.finish();
          }
          function O2(Ie, Pe) {
            var $e;
            Pe.writeVarintField(15, Ie.version || 1), Pe.writeStringField(1, Ie.name || ""), Pe.writeVarintField(5, Ie.extent || 4096);
            var Ve = { keys: [], values: [], keycache: {}, valuecache: {} };
            for ($e = 0; $e < Ie.length; $e++) Ve.feature = Ie.feature($e), Pe.writeMessage(2, L2, Ve);
            var ut = Ve.keys;
            for ($e = 0; $e < ut.length; $e++) Pe.writeStringField(3, ut[$e]);
            var Re = Ve.values;
            for ($e = 0; $e < Re.length; $e++) Pe.writeMessage(4, K2, Re[$e]);
          }
          function L2(Ie, Pe) {
            var $e = Ie.feature;
            $e.id !== void 0 && Pe.writeVarintField(1, $e.id), Pe.writeMessage(2, V2, Ie), Pe.writeVarintField(3, $e.type), Pe.writeMessage(4, Y2, $e);
          }
          function V2(Ie, Pe) {
            var $e = Ie.feature, Ve = Ie.keys, ut = Ie.values, Re = Ie.keycache, qe = Ie.valuecache;
            for (var je in $e.properties) {
              var rt = Re[je];
              rt === void 0 && (Ve.push(je), rt = Ve.length - 1, Re[je] = rt), Pe.writeVarint(rt);
              var He = $e.properties[je], xe = typeof He;
              xe !== "string" && xe !== "boolean" && xe !== "number" && (He = JSON.stringify(He));
              var Ne = xe + ":" + He, ke = qe[Ne];
              ke === void 0 && (ut.push(He), ke = ut.length - 1, qe[Ne] = ke), Pe.writeVarint(ke);
            }
          }
          function W2(Ie, Pe) {
            return (Pe << 3) + (7 & Ie);
          }
          function X2(Ie) {
            return Ie << 1 ^ Ie >> 31;
          }
          function Y2(Ie, Pe) {
            for (var $e = Ie.loadGeometry(), Ve = Ie.type, ut = 0, Re = 0, qe = $e.length, je = 0; je < qe; je++) {
              var rt = $e[je], He = 1;
              Ve === 1 && (He = rt.length), Pe.writeVarint(W2(1, He));
              for (var xe = Ve === 3 ? rt.length - 1 : rt.length, Ne = 0; Ne < xe; Ne++) {
                Ne === 1 && Ve !== 1 && Pe.writeVarint(W2(2, xe - 1));
                var ke = rt[Ne].x - ut, Me = rt[Ne].y - Re;
                Pe.writeVarint(X2(ke)), Pe.writeVarint(X2(Me)), ut += ke, Re += Me;
              }
              Ve === 3 && Pe.writeVarint(W2(7, 1));
            }
          }
          function K2(Ie, Pe) {
            var $e = typeof Ie;
            $e === "string" ? Pe.writeStringField(1, Ie) : $e === "boolean" ? Pe.writeBooleanField(7, Ie) : $e === "number" && (Ie % 1 != 0 ? Pe.writeDoubleField(3, Ie) : Ie < 0 ? Pe.writeSVarintField(6, Ie) : Pe.writeVarintField(5, Ie));
          }
          function q(Ie, Pe, $e, Ve, ut, Re) {
            if (!(ut - Ve <= $e)) {
              var qe = Ve + ut >> 1;
              (function je(rt, He, xe, Ne, ke, Me) {
                for (; ke > Ne; ) {
                  if (ke - Ne > 600) {
                    var Le = ke - Ne + 1, ze = xe - Ne + 1, ft = Math.log(Le), De = 0.5 * Math.exp(2 * ft / 3), Je = 0.5 * Math.sqrt(ft * De * (Le - De) / Le) * (ze - Le / 2 < 0 ? -1 : 1), tt = Math.max(Ne, Math.floor(xe - ze * De / Le + Je)), vt = Math.min(ke, Math.floor(xe + (Le - ze) * De / Le + Je));
                    je(rt, He, xe, tt, vt, Me);
                  }
                  var kt = He[2 * xe + Me], jt = Ne, Vt = ke;
                  for (re(rt, He, Ne, xe), He[2 * ke + Me] > kt && re(rt, He, Ne, ke); jt < Vt; ) {
                    for (re(rt, He, jt, Vt), jt++, Vt--; He[2 * jt + Me] < kt; ) jt++;
                    for (; He[2 * Vt + Me] > kt; ) Vt--;
                  }
                  He[2 * Ne + Me] === kt ? re(rt, He, Ne, Vt) : (Vt++, re(rt, He, Vt, ke)), Vt <= xe && (Ne = Vt + 1), xe <= Vt && (ke = Vt - 1);
                }
              })(Ie, Pe, qe, Ve, ut, Re % 2), q(Ie, Pe, $e, Ve, qe - 1, Re + 1), q(Ie, Pe, $e, qe + 1, ut, Re + 1);
            }
          }
          function re(Ie, Pe, $e, Ve) {
            R2(Ie, $e, Ve), R2(Pe, 2 * $e, 2 * Ve), R2(Pe, 2 * $e + 1, 2 * Ve + 1);
          }
          function R2(Ie, Pe, $e) {
            var Ve = Ie[Pe];
            Ie[Pe] = Ie[$e], Ie[$e] = Ve;
          }
          function z(Ie, Pe, $e, Ve) {
            var ut = Ie - $e, Re = Pe - Ve;
            return ut * ut + Re * Re;
          }
          E2.fromVectorTileJs = F13, E2.fromGeojsonVt = N2, E2.GeoJSONWrapper = D2;
          var H2 = function(Ie) {
            return Ie[0];
          }, te = function(Ie) {
            return Ie[1];
          }, j = function(Ie, Pe, $e, Ve, ut) {
            Pe === void 0 && (Pe = H2), $e === void 0 && ($e = te), Ve === void 0 && (Ve = 64), ut === void 0 && (ut = Float64Array), this.nodeSize = Ve, this.points = Ie;
            for (var Re = Ie.length < 65536 ? Uint16Array : Uint32Array, qe = this.ids = new Re(Ie.length), je = this.coords = new ut(2 * Ie.length), rt = 0; rt < Ie.length; rt++) qe[rt] = rt, je[2 * rt] = Pe(Ie[rt]), je[2 * rt + 1] = $e(Ie[rt]);
            q(qe, je, Ve, 0, qe.length - 1, 0);
          };
          j.prototype.range = function(Ie, Pe, $e, Ve) {
            return function(ut, Re, qe, je, rt, He, xe) {
              for (var Ne, ke, Me = [0, ut.length - 1, 0], Le = []; Me.length; ) {
                var ze = Me.pop(), ft = Me.pop(), De = Me.pop();
                if (ft - De <= xe) for (var Je = De; Je <= ft; Je++) Ne = Re[2 * Je], ke = Re[2 * Je + 1], Ne >= qe && Ne <= rt && ke >= je && ke <= He && Le.push(ut[Je]);
                else {
                  var tt = Math.floor((De + ft) / 2);
                  Ne = Re[2 * tt], ke = Re[2 * tt + 1], Ne >= qe && Ne <= rt && ke >= je && ke <= He && Le.push(ut[tt]);
                  var vt = (ze + 1) % 2;
                  (ze === 0 ? qe <= Ne : je <= ke) && (Me.push(De), Me.push(tt - 1), Me.push(vt)), (ze === 0 ? rt >= Ne : He >= ke) && (Me.push(tt + 1), Me.push(ft), Me.push(vt));
                }
              }
              return Le;
            }(this.ids, this.coords, Ie, Pe, $e, Ve, this.nodeSize);
          }, j.prototype.within = function(Ie, Pe, $e) {
            return function(Ve, ut, Re, qe, je, rt) {
              for (var He = [0, Ve.length - 1, 0], xe = [], Ne = je * je; He.length; ) {
                var ke = He.pop(), Me = He.pop(), Le = He.pop();
                if (Me - Le <= rt) for (var ze = Le; ze <= Me; ze++) z(ut[2 * ze], ut[2 * ze + 1], Re, qe) <= Ne && xe.push(Ve[ze]);
                else {
                  var ft = Math.floor((Le + Me) / 2), De = ut[2 * ft], Je = ut[2 * ft + 1];
                  z(De, Je, Re, qe) <= Ne && xe.push(Ve[ft]);
                  var tt = (ke + 1) % 2;
                  (ke === 0 ? Re - je <= De : qe - je <= Je) && (He.push(Le), He.push(ft - 1), He.push(tt)), (ke === 0 ? Re + je >= De : qe + je >= Je) && (He.push(ft + 1), He.push(Me), He.push(tt));
                }
              }
              return xe;
            }(this.ids, this.coords, Ie, Pe, $e, this.nodeSize);
          };
          var Q2 = { minZoom: 0, maxZoom: 16, radius: 40, extent: 512, nodeSize: 64, log: false, generateId: false, reduce: null, map: function(Ie) {
            return Ie;
          } }, Z2 = function(Ie) {
            this.options = he(Object.create(Q2), Ie), this.trees = new Array(this.options.maxZoom + 1);
          };
          function ne(Ie, Pe, $e, Ve, ut) {
            return { x: Ie, y: Pe, zoom: 1 / 0, id: $e, parentId: -1, numPoints: Ve, properties: ut };
          }
          function ae(Ie, Pe) {
            var $e = Ie.geometry.coordinates, Ve = $e[0], ut = $e[1];
            return { x: ce(Ve), y: se(ut), zoom: 1 / 0, index: Pe, parentId: -1 };
          }
          function ue(Ie) {
            return { type: "Feature", id: Ie.id, properties: le(Ie), geometry: { type: "Point", coordinates: [(Ve = Ie.x, 360 * (Ve - 0.5)), (Pe = Ie.y, $e = (180 - 360 * Pe) * Math.PI / 180, 360 * Math.atan(Math.exp($e)) / Math.PI - 90)] } };
            var Pe, $e, Ve;
          }
          function le(Ie) {
            var Pe = Ie.numPoints, $e = Pe >= 1e4 ? Math.round(Pe / 1e3) + "k" : Pe >= 1e3 ? Math.round(Pe / 100) / 10 + "k" : Pe;
            return he(he({}, Ie.properties), { cluster: true, cluster_id: Ie.id, point_count: Pe, point_count_abbreviated: $e });
          }
          function ce(Ie) {
            return Ie / 360 + 0.5;
          }
          function se(Ie) {
            var Pe = Math.sin(Ie * Math.PI / 180), $e = 0.5 - 0.25 * Math.log((1 + Pe) / (1 - Pe)) / Math.PI;
            return $e < 0 ? 0 : $e > 1 ? 1 : $e;
          }
          function he(Ie, Pe) {
            for (var $e in Pe) Ie[$e] = Pe[$e];
            return Ie;
          }
          function me(Ie) {
            return Ie.x;
          }
          function we(Ie) {
            return Ie.y;
          }
          function be(Ie, Pe, $e, Ve, ut, Re) {
            var qe = ut - $e, je = Re - Ve;
            if (qe !== 0 || je !== 0) {
              var rt = ((Ie - $e) * qe + (Pe - Ve) * je) / (qe * qe + je * je);
              rt > 1 ? ($e = ut, Ve = Re) : rt > 0 && ($e += qe * rt, Ve += je * rt);
            }
            return (qe = Ie - $e) * qe + (je = Pe - Ve) * je;
          }
          function Ae(Ie, Pe, $e, Ve) {
            var ut = { id: Ie === void 0 ? null : Ie, type: Pe, geometry: $e, tags: Ve, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
            return function(Re) {
              var qe = Re.geometry, je = Re.type;
              if (je === "Point" || je === "MultiPoint" || je === "LineString") pe(Re, qe);
              else if (je === "Polygon" || je === "MultiLineString") for (var rt = 0; rt < qe.length; rt++) pe(Re, qe[rt]);
              else if (je === "MultiPolygon") for (rt = 0; rt < qe.length; rt++) for (var He = 0; He < qe[rt].length; He++) pe(Re, qe[rt][He]);
            }(ut), ut;
          }
          function pe(Ie, Pe) {
            for (var $e = 0; $e < Pe.length; $e += 3) Ie.minX = Math.min(Ie.minX, Pe[$e]), Ie.minY = Math.min(Ie.minY, Pe[$e + 1]), Ie.maxX = Math.max(Ie.maxX, Pe[$e]), Ie.maxY = Math.max(Ie.maxY, Pe[$e + 1]);
          }
          function ve(Ie, Pe, $e, Ve) {
            if (Pe.geometry) {
              var ut = Pe.geometry.coordinates, Re = Pe.geometry.type, qe = Math.pow($e.tolerance / ((1 << $e.maxZoom) * $e.extent), 2), je = [], rt = Pe.id;
              if ($e.promoteId ? rt = Pe.properties[$e.promoteId] : $e.generateId && (rt = Ve || 0), Re === "Point") Ee(ut, je);
              else if (Re === "MultiPoint") for (var He = 0; He < ut.length; He++) Ee(ut[He], je);
              else if (Re === "LineString") Se(ut, je, qe, false);
              else if (Re === "MultiLineString") {
                if ($e.lineMetrics) {
                  for (He = 0; He < ut.length; He++) je = [], Se(ut[He], je, qe, false), Ie.push(Ae(rt, "LineString", je, Pe.properties));
                  return;
                }
                Ce(ut, je, qe, false);
              } else if (Re === "Polygon") Ce(ut, je, qe, true);
              else {
                if (Re !== "MultiPolygon") {
                  if (Re === "GeometryCollection") {
                    for (He = 0; He < Pe.geometry.geometries.length; He++) ve(Ie, { id: rt, geometry: Pe.geometry.geometries[He], properties: Pe.properties }, $e, Ve);
                    return;
                  }
                  throw new Error("Input data is not a valid GeoJSON object.");
                }
                for (He = 0; He < ut.length; He++) {
                  var xe = [];
                  Ce(ut[He], xe, qe, true), je.push(xe);
                }
              }
              Ie.push(Ae(rt, Re, je, Pe.properties));
            }
          }
          function Ee(Ie, Pe) {
            Pe.push(Be(Ie[0])), Pe.push(Ue(Ie[1])), Pe.push(0);
          }
          function Se(Ie, Pe, $e, Ve) {
            for (var ut, Re, qe = 0, je = 0; je < Ie.length; je++) {
              var rt = Be(Ie[je][0]), He = Ue(Ie[je][1]);
              Pe.push(rt), Pe.push(He), Pe.push(0), je > 0 && (qe += Ve ? (ut * He - rt * Re) / 2 : Math.sqrt(Math.pow(rt - ut, 2) + Math.pow(He - Re, 2))), ut = rt, Re = He;
            }
            var xe = Pe.length - 3;
            Pe[2] = 1, function Ne(ke, Me, Le, ze) {
              for (var ft, De = ze, Je = Le - Me >> 1, tt = Le - Me, vt = ke[Me], kt = ke[Me + 1], jt = ke[Le], Vt = ke[Le + 1], Kt = Me + 3; Kt < Le; Kt += 3) {
                var rr = be(ke[Kt], ke[Kt + 1], vt, kt, jt, Vt);
                if (rr > De) ft = Kt, De = rr;
                else if (rr === De) {
                  var Tr = Math.abs(Kt - Je);
                  Tr < tt && (ft = Kt, tt = Tr);
                }
              }
              De > ze && (ft - Me > 3 && Ne(ke, Me, ft, ze), ke[ft + 2] = De, Le - ft > 3 && Ne(ke, ft, Le, ze));
            }(Pe, 0, xe, $e), Pe[xe + 2] = 1, Pe.size = Math.abs(qe), Pe.start = 0, Pe.end = Pe.size;
          }
          function Ce(Ie, Pe, $e, Ve) {
            for (var ut = 0; ut < Ie.length; ut++) {
              var Re = [];
              Se(Ie[ut], Re, $e, Ve), Pe.push(Re);
            }
          }
          function Be(Ie) {
            return Ie / 360 + 0.5;
          }
          function Ue(Ie) {
            var Pe = Math.sin(Ie * Math.PI / 180), $e = 0.5 - 0.25 * Math.log((1 + Pe) / (1 - Pe)) / Math.PI;
            return $e < 0 ? 0 : $e > 1 ? 1 : $e;
          }
          function Ke(Ie, Pe, $e, Ve, ut, Re, qe, je) {
            if (Ve /= Pe, Re >= ($e /= Pe) && qe < Ve) return Ie;
            if (qe < $e || Re >= Ve) return null;
            for (var rt = [], He = 0; He < Ie.length; He++) {
              var xe = Ie[He], Ne = xe.geometry, ke = xe.type, Me = ut === 0 ? xe.minX : xe.minY, Le = ut === 0 ? xe.maxX : xe.maxY;
              if (Me >= $e && Le < Ve) rt.push(xe);
              else if (!(Le < $e || Me >= Ve)) {
                var ze = [];
                if (ke === "Point" || ke === "MultiPoint") ct(Ne, ze, $e, Ve, ut);
                else if (ke === "LineString") We(Ne, ze, $e, Ve, ut, false, je.lineMetrics);
                else if (ke === "MultiLineString") it(Ne, ze, $e, Ve, ut, false);
                else if (ke === "Polygon") it(Ne, ze, $e, Ve, ut, true);
                else if (ke === "MultiPolygon") for (var ft = 0; ft < Ne.length; ft++) {
                  var De = [];
                  it(Ne[ft], De, $e, Ve, ut, true), De.length && ze.push(De);
                }
                if (ze.length) {
                  if (je.lineMetrics && ke === "LineString") {
                    for (ft = 0; ft < ze.length; ft++) rt.push(Ae(xe.id, ke, ze[ft], xe.tags));
                    continue;
                  }
                  ke !== "LineString" && ke !== "MultiLineString" || (ze.length === 1 ? (ke = "LineString", ze = ze[0]) : ke = "MultiLineString"), ke !== "Point" && ke !== "MultiPoint" || (ke = ze.length === 3 ? "Point" : "MultiPoint"), rt.push(Ae(xe.id, ke, ze, xe.tags));
                }
              }
            }
            return rt.length ? rt : null;
          }
          function ct(Ie, Pe, $e, Ve, ut) {
            for (var Re = 0; Re < Ie.length; Re += 3) {
              var qe = Ie[Re + ut];
              qe >= $e && qe <= Ve && (Pe.push(Ie[Re]), Pe.push(Ie[Re + 1]), Pe.push(Ie[Re + 2]));
            }
          }
          function We(Ie, Pe, $e, Ve, ut, Re, qe) {
            for (var je, rt, He = Ze(Ie), xe = ut === 0 ? mt : wt, Ne = Ie.start, ke = 0; ke < Ie.length - 3; ke += 3) {
              var Me = Ie[ke], Le = Ie[ke + 1], ze = Ie[ke + 2], ft = Ie[ke + 3], De = Ie[ke + 4], Je = ut === 0 ? Me : Le, tt = ut === 0 ? ft : De, vt = false;
              qe && (je = Math.sqrt(Math.pow(Me - ft, 2) + Math.pow(Le - De, 2))), Je < $e ? tt > $e && (rt = xe(He, Me, Le, ft, De, $e), qe && (He.start = Ne + je * rt)) : Je > Ve ? tt < Ve && (rt = xe(He, Me, Le, ft, De, Ve), qe && (He.start = Ne + je * rt)) : ot(He, Me, Le, ze), tt < $e && Je >= $e && (rt = xe(He, Me, Le, ft, De, $e), vt = true), tt > Ve && Je <= Ve && (rt = xe(He, Me, Le, ft, De, Ve), vt = true), !Re && vt && (qe && (He.end = Ne + je * rt), Pe.push(He), He = Ze(Ie)), qe && (Ne += je);
            }
            var kt = Ie.length - 3;
            Me = Ie[kt], Le = Ie[kt + 1], ze = Ie[kt + 2], (Je = ut === 0 ? Me : Le) >= $e && Je <= Ve && ot(He, Me, Le, ze), kt = He.length - 3, Re && kt >= 3 && (He[kt] !== He[0] || He[kt + 1] !== He[1]) && ot(He, He[0], He[1], He[2]), He.length && Pe.push(He);
          }
          function Ze(Ie) {
            var Pe = [];
            return Pe.size = Ie.size, Pe.start = Ie.start, Pe.end = Ie.end, Pe;
          }
          function it(Ie, Pe, $e, Ve, ut, Re) {
            for (var qe = 0; qe < Ie.length; qe++) We(Ie[qe], Pe, $e, Ve, ut, Re, false);
          }
          function ot(Ie, Pe, $e, Ve) {
            Ie.push(Pe), Ie.push($e), Ie.push(Ve);
          }
          function mt(Ie, Pe, $e, Ve, ut, Re) {
            var qe = (Re - Pe) / (Ve - Pe);
            return Ie.push(Re), Ie.push($e + (ut - $e) * qe), Ie.push(1), qe;
          }
          function wt(Ie, Pe, $e, Ve, ut, Re) {
            var qe = (Re - $e) / (ut - $e);
            return Ie.push(Pe + (Ve - Pe) * qe), Ie.push(Re), Ie.push(1), qe;
          }
          function Et(Ie, Pe) {
            for (var $e = [], Ve = 0; Ve < Ie.length; Ve++) {
              var ut, Re = Ie[Ve], qe = Re.type;
              if (qe === "Point" || qe === "MultiPoint" || qe === "LineString") ut = zt(Re.geometry, Pe);
              else if (qe === "MultiLineString" || qe === "Polygon") {
                ut = [];
                for (var je = 0; je < Re.geometry.length; je++) ut.push(zt(Re.geometry[je], Pe));
              } else if (qe === "MultiPolygon") for (ut = [], je = 0; je < Re.geometry.length; je++) {
                for (var rt = [], He = 0; He < Re.geometry[je].length; He++) rt.push(zt(Re.geometry[je][He], Pe));
                ut.push(rt);
              }
              $e.push(Ae(Re.id, qe, ut, Re.tags));
            }
            return $e;
          }
          function zt(Ie, Pe) {
            var $e = [];
            $e.size = Ie.size, Ie.start !== void 0 && ($e.start = Ie.start, $e.end = Ie.end);
            for (var Ve = 0; Ve < Ie.length; Ve += 3) $e.push(Ie[Ve] + Pe, Ie[Ve + 1], Ie[Ve + 2]);
            return $e;
          }
          function Nt(Ie, Pe) {
            if (Ie.transformed) return Ie;
            var $e, Ve, ut, Re = 1 << Ie.z, qe = Ie.x, je = Ie.y;
            for ($e = 0; $e < Ie.features.length; $e++) {
              var rt = Ie.features[$e], He = rt.geometry, xe = rt.type;
              if (rt.geometry = [], xe === 1) for (Ve = 0; Ve < He.length; Ve += 2) rt.geometry.push(yt(He[Ve], He[Ve + 1], Pe, Re, qe, je));
              else for (Ve = 0; Ve < He.length; Ve++) {
                var Ne = [];
                for (ut = 0; ut < He[Ve].length; ut += 2) Ne.push(yt(He[Ve][ut], He[Ve][ut + 1], Pe, Re, qe, je));
                rt.geometry.push(Ne);
              }
            }
            return Ie.transformed = true, Ie;
          }
          function yt(Ie, Pe, $e, Ve, ut, Re) {
            return [Math.round($e * (Ie * Ve - ut)), Math.round($e * (Pe * Ve - Re))];
          }
          function pt(Ie, Pe, $e, Ve, ut) {
            for (var Re = Pe === ut.maxZoom ? 0 : ut.tolerance / ((1 << Pe) * ut.extent), qe = { features: [], numPoints: 0, numSimplified: 0, numFeatures: 0, source: null, x: $e, y: Ve, z: Pe, transformed: false, minX: 2, minY: 1, maxX: -1, maxY: 0 }, je = 0; je < Ie.length; je++) {
              qe.numFeatures++, Ot(qe, Ie[je], Re, ut);
              var rt = Ie[je].minX, He = Ie[je].minY, xe = Ie[je].maxX, Ne = Ie[je].maxY;
              rt < qe.minX && (qe.minX = rt), He < qe.minY && (qe.minY = He), xe > qe.maxX && (qe.maxX = xe), Ne > qe.maxY && (qe.maxY = Ne);
            }
            return qe;
          }
          function Ot(Ie, Pe, $e, Ve) {
            var ut = Pe.geometry, Re = Pe.type, qe = [];
            if (Re === "Point" || Re === "MultiPoint") for (var je = 0; je < ut.length; je += 3) qe.push(ut[je]), qe.push(ut[je + 1]), Ie.numPoints++, Ie.numSimplified++;
            else if (Re === "LineString") Jt(qe, ut, Ie, $e, false, false);
            else if (Re === "MultiLineString" || Re === "Polygon") for (je = 0; je < ut.length; je++) Jt(qe, ut[je], Ie, $e, Re === "Polygon", je === 0);
            else if (Re === "MultiPolygon") for (var rt = 0; rt < ut.length; rt++) {
              var He = ut[rt];
              for (je = 0; je < He.length; je++) Jt(qe, He[je], Ie, $e, true, je === 0);
            }
            if (qe.length) {
              var xe = Pe.tags || null;
              if (Re === "LineString" && Ve.lineMetrics) {
                for (var Ne in xe = {}, Pe.tags) xe[Ne] = Pe.tags[Ne];
                xe.mapbox_clip_start = ut.start / ut.size, xe.mapbox_clip_end = ut.end / ut.size;
              }
              var ke = { geometry: qe, type: Re === "Polygon" || Re === "MultiPolygon" ? 3 : Re === "LineString" || Re === "MultiLineString" ? 2 : 1, tags: xe };
              Pe.id !== null && (ke.id = Pe.id), Ie.features.push(ke);
            }
          }
          function Jt(Ie, Pe, $e, Ve, ut, Re) {
            var qe = Ve * Ve;
            if (Ve > 0 && Pe.size < (ut ? qe : Ve)) $e.numPoints += Pe.length / 3;
            else {
              for (var je = [], rt = 0; rt < Pe.length; rt += 3) (Ve === 0 || Pe[rt + 2] > qe) && ($e.numSimplified++, je.push(Pe[rt]), je.push(Pe[rt + 1])), $e.numPoints++;
              ut && function(He, xe) {
                for (var Ne = 0, ke = 0, Me = He.length, Le = Me - 2; ke < Me; Le = ke, ke += 2) Ne += (He[ke] - He[Le]) * (He[ke + 1] + He[Le + 1]);
                if (Ne > 0 === xe) for (ke = 0, Me = He.length; ke < Me / 2; ke += 2) {
                  var ze = He[ke], ft = He[ke + 1];
                  He[ke] = He[Me - 2 - ke], He[ke + 1] = He[Me - 1 - ke], He[Me - 2 - ke] = ze, He[Me - 1 - ke] = ft;
                }
              }(je, Re), Ie.push(je);
            }
          }
          function tr(Ie, Pe) {
            var $e = (Pe = this.options = function(ut, Re) {
              for (var qe in Re) ut[qe] = Re[qe];
              return ut;
            }(Object.create(this.options), Pe)).debug;
            if ($e && console.time("preprocess data"), Pe.maxZoom < 0 || Pe.maxZoom > 24) throw new Error("maxZoom should be in the 0-24 range");
            if (Pe.promoteId && Pe.generateId) throw new Error("promoteId and generateId cannot be used together.");
            var Ve = function(ut, Re) {
              var qe = [];
              if (ut.type === "FeatureCollection") for (var je = 0; je < ut.features.length; je++) ve(qe, ut.features[je], Re, je);
              else ut.type === "Feature" ? ve(qe, ut, Re) : ve(qe, { geometry: ut }, Re);
              return qe;
            }(Ie, Pe);
            this.tiles = {}, this.tileCoords = [], $e && (console.timeEnd("preprocess data"), console.log("index: maxZoom: %d, maxPoints: %d", Pe.indexMaxZoom, Pe.indexMaxPoints), console.time("generate tiles"), this.stats = {}, this.total = 0), (Ve = function(ut, Re) {
              var qe = Re.buffer / Re.extent, je = ut, rt = Ke(ut, 1, -1 - qe, qe, 0, -1, 2, Re), He = Ke(ut, 1, 1 - qe, 2 + qe, 0, -1, 2, Re);
              return (rt || He) && (je = Ke(ut, 1, -qe, 1 + qe, 0, -1, 2, Re) || [], rt && (je = Et(rt, 1).concat(je)), He && (je = je.concat(Et(He, -1)))), je;
            }(Ve, Pe)).length && this.splitTile(Ve, 0, 0, 0), $e && (Ve.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)));
          }
          function Ye(Ie, Pe, $e) {
            return 32 * ((1 << Ie) * $e + Pe) + Ie;
          }
          function at(Ie, Pe) {
            var $e = Ie.tileID.canonical;
            if (!this._geoJSONIndex) return Pe(null, null);
            var Ve = this._geoJSONIndex.getTile($e.z, $e.x, $e.y);
            if (!Ve) return Pe(null, null);
            var ut = new k(Ve.features), Re = E2(ut);
            Re.byteOffset === 0 && Re.byteLength === Re.buffer.byteLength || (Re = new Uint8Array(Re)), Pe(null, { vectorTile: ut, rawData: Re.buffer });
          }
          Z2.prototype.load = function(Ie) {
            var Pe = this.options, $e = Pe.log, Ve = Pe.minZoom, ut = Pe.maxZoom, Re = Pe.nodeSize;
            $e && console.time("total time");
            var qe = "prepare " + Ie.length + " points";
            $e && console.time(qe), this.points = Ie;
            for (var je = [], rt = 0; rt < Ie.length; rt++) Ie[rt].geometry && je.push(ae(Ie[rt], rt));
            this.trees[ut + 1] = new j(je, me, we, Re, Float32Array), $e && console.timeEnd(qe);
            for (var He = ut; He >= Ve; He--) {
              var xe = +Date.now();
              je = this._cluster(je, He), this.trees[He] = new j(je, me, we, Re, Float32Array), $e && console.log("z%d: %d clusters in %dms", He, je.length, +Date.now() - xe);
            }
            return $e && console.timeEnd("total time"), this;
          }, Z2.prototype.getClusters = function(Ie, Pe) {
            var $e = ((Ie[0] + 180) % 360 + 360) % 360 - 180, Ve = Math.max(-90, Math.min(90, Ie[1])), ut = Ie[2] === 180 ? 180 : ((Ie[2] + 180) % 360 + 360) % 360 - 180, Re = Math.max(-90, Math.min(90, Ie[3]));
            if (Ie[2] - Ie[0] >= 360) $e = -180, ut = 180;
            else if ($e > ut) {
              var qe = this.getClusters([$e, Ve, 180, Re], Pe), je = this.getClusters([-180, Ve, ut, Re], Pe);
              return qe.concat(je);
            }
            for (var rt = this.trees[this._limitZoom(Pe)], He = [], xe = 0, Ne = rt.range(ce($e), se(Re), ce(ut), se(Ve)); xe < Ne.length; xe += 1) {
              var ke = Ne[xe], Me = rt.points[ke];
              He.push(Me.numPoints ? ue(Me) : this.points[Me.index]);
            }
            return He;
          }, Z2.prototype.getChildren = function(Ie) {
            var Pe = this._getOriginId(Ie), $e = this._getOriginZoom(Ie), Ve = "No cluster with the specified id.", ut = this.trees[$e];
            if (!ut) throw new Error(Ve);
            var Re = ut.points[Pe];
            if (!Re) throw new Error(Ve);
            for (var qe = this.options.radius / (this.options.extent * Math.pow(2, $e - 1)), je = [], rt = 0, He = ut.within(Re.x, Re.y, qe); rt < He.length; rt += 1) {
              var xe = He[rt], Ne = ut.points[xe];
              Ne.parentId === Ie && je.push(Ne.numPoints ? ue(Ne) : this.points[Ne.index]);
            }
            if (je.length === 0) throw new Error(Ve);
            return je;
          }, Z2.prototype.getLeaves = function(Ie, Pe, $e) {
            Pe = Pe || 10, $e = $e || 0;
            var Ve = [];
            return this._appendLeaves(Ve, Ie, Pe, $e, 0), Ve;
          }, Z2.prototype.getTile = function(Ie, Pe, $e) {
            var Ve = this.trees[this._limitZoom(Ie)], ut = Math.pow(2, Ie), Re = this.options, qe = Re.extent, je = Re.radius / qe, rt = ($e - je) / ut, He = ($e + 1 + je) / ut, xe = { features: [] };
            return this._addTileFeatures(Ve.range((Pe - je) / ut, rt, (Pe + 1 + je) / ut, He), Ve.points, Pe, $e, ut, xe), Pe === 0 && this._addTileFeatures(Ve.range(1 - je / ut, rt, 1, He), Ve.points, ut, $e, ut, xe), Pe === ut - 1 && this._addTileFeatures(Ve.range(0, rt, je / ut, He), Ve.points, -1, $e, ut, xe), xe.features.length ? xe : null;
          }, Z2.prototype.getClusterExpansionZoom = function(Ie) {
            for (var Pe = this._getOriginZoom(Ie) - 1; Pe <= this.options.maxZoom; ) {
              var $e = this.getChildren(Ie);
              if (Pe++, $e.length !== 1) break;
              Ie = $e[0].properties.cluster_id;
            }
            return Pe;
          }, Z2.prototype._appendLeaves = function(Ie, Pe, $e, Ve, ut) {
            for (var Re = 0, qe = this.getChildren(Pe); Re < qe.length; Re += 1) {
              var je = qe[Re], rt = je.properties;
              if (rt && rt.cluster ? ut + rt.point_count <= Ve ? ut += rt.point_count : ut = this._appendLeaves(Ie, rt.cluster_id, $e, Ve, ut) : ut < Ve ? ut++ : Ie.push(je), Ie.length === $e) break;
            }
            return ut;
          }, Z2.prototype._addTileFeatures = function(Ie, Pe, $e, Ve, ut, Re) {
            for (var qe = 0, je = Ie; qe < je.length; qe += 1) {
              var rt = Pe[je[qe]], He = rt.numPoints, xe = { type: 1, geometry: [[Math.round(this.options.extent * (rt.x * ut - $e)), Math.round(this.options.extent * (rt.y * ut - Ve))]], tags: He ? le(rt) : this.points[rt.index].properties }, Ne = void 0;
              He ? Ne = rt.id : this.options.generateId ? Ne = rt.index : this.points[rt.index].id && (Ne = this.points[rt.index].id), Ne !== void 0 && (xe.id = Ne), Re.features.push(xe);
            }
          }, Z2.prototype._limitZoom = function(Ie) {
            return Math.max(this.options.minZoom, Math.min(Ie, this.options.maxZoom + 1));
          }, Z2.prototype._cluster = function(Ie, Pe) {
            for (var $e = [], Ve = this.options, ut = Ve.radius, Re = Ve.extent, qe = Ve.reduce, je = ut / (Re * Math.pow(2, Pe)), rt = 0; rt < Ie.length; rt++) {
              var He = Ie[rt];
              if (!(He.zoom <= Pe)) {
                He.zoom = Pe;
                for (var xe = this.trees[Pe + 1], Ne = xe.within(He.x, He.y, je), ke = He.numPoints || 1, Me = He.x * ke, Le = He.y * ke, ze = qe && ke > 1 ? this._map(He, true) : null, ft = (rt << 5) + (Pe + 1) + this.points.length, De = 0, Je = Ne; De < Je.length; De += 1) {
                  var tt = Je[De], vt = xe.points[tt];
                  if (!(vt.zoom <= Pe)) {
                    vt.zoom = Pe;
                    var kt = vt.numPoints || 1;
                    Me += vt.x * kt, Le += vt.y * kt, ke += kt, vt.parentId = ft, qe && (ze || (ze = this._map(He, true)), qe(ze, this._map(vt)));
                  }
                }
                ke === 1 ? $e.push(He) : (He.parentId = ft, $e.push(ne(Me / ke, Le / ke, ft, ke, ze)));
              }
            }
            return $e;
          }, Z2.prototype._getOriginId = function(Ie) {
            return Ie - this.points.length >> 5;
          }, Z2.prototype._getOriginZoom = function(Ie) {
            return (Ie - this.points.length) % 32;
          }, Z2.prototype._map = function(Ie, Pe) {
            if (Ie.numPoints) return Pe ? he({}, Ie.properties) : Ie.properties;
            var $e = this.points[Ie.index].properties, Ve = this.options.map($e);
            return Pe && Ve === $e ? he({}, Ve) : Ve;
          }, tr.prototype.options = { maxZoom: 14, indexMaxZoom: 5, indexMaxPoints: 1e5, tolerance: 3, extent: 4096, buffer: 64, lineMetrics: false, promoteId: null, generateId: false, debug: 0 }, tr.prototype.splitTile = function(Ie, Pe, $e, Ve, ut, Re, qe) {
            for (var je = [Ie, Pe, $e, Ve], rt = this.options, He = rt.debug; je.length; ) {
              Ve = je.pop(), $e = je.pop(), Pe = je.pop(), Ie = je.pop();
              var xe = 1 << Pe, Ne = Ye(Pe, $e, Ve), ke = this.tiles[Ne];
              if (!ke && (He > 1 && console.time("creation"), ke = this.tiles[Ne] = pt(Ie, Pe, $e, Ve, rt), this.tileCoords.push({ z: Pe, x: $e, y: Ve }), He)) {
                He > 1 && (console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)", Pe, $e, Ve, ke.numFeatures, ke.numPoints, ke.numSimplified), console.timeEnd("creation"));
                var Me = "z" + Pe;
                this.stats[Me] = (this.stats[Me] || 0) + 1, this.total++;
              }
              if (ke.source = Ie, ut) {
                if (Pe === rt.maxZoom || Pe === ut) continue;
                var Le = 1 << ut - Pe;
                if ($e !== Math.floor(Re / Le) || Ve !== Math.floor(qe / Le)) continue;
              } else if (Pe === rt.indexMaxZoom || ke.numPoints <= rt.indexMaxPoints) continue;
              if (ke.source = null, Ie.length !== 0) {
                He > 1 && console.time("clipping");
                var ze, ft, De, Je, tt, vt, kt = 0.5 * rt.buffer / rt.extent, jt = 0.5 - kt, Vt = 0.5 + kt, Kt = 1 + kt;
                ze = ft = De = Je = null, tt = Ke(Ie, xe, $e - kt, $e + Vt, 0, ke.minX, ke.maxX, rt), vt = Ke(Ie, xe, $e + jt, $e + Kt, 0, ke.minX, ke.maxX, rt), Ie = null, tt && (ze = Ke(tt, xe, Ve - kt, Ve + Vt, 1, ke.minY, ke.maxY, rt), ft = Ke(tt, xe, Ve + jt, Ve + Kt, 1, ke.minY, ke.maxY, rt), tt = null), vt && (De = Ke(vt, xe, Ve - kt, Ve + Vt, 1, ke.minY, ke.maxY, rt), Je = Ke(vt, xe, Ve + jt, Ve + Kt, 1, ke.minY, ke.maxY, rt), vt = null), He > 1 && console.timeEnd("clipping"), je.push(ze || [], Pe + 1, 2 * $e, 2 * Ve), je.push(ft || [], Pe + 1, 2 * $e, 2 * Ve + 1), je.push(De || [], Pe + 1, 2 * $e + 1, 2 * Ve), je.push(Je || [], Pe + 1, 2 * $e + 1, 2 * Ve + 1);
              }
            }
          }, tr.prototype.getTile = function(Ie, Pe, $e) {
            var Ve = this.options, ut = Ve.extent, Re = Ve.debug;
            if (Ie < 0 || Ie > 24) return null;
            var qe = 1 << Ie, je = Ye(Ie, Pe = (Pe % qe + qe) % qe, $e);
            if (this.tiles[je]) return Nt(this.tiles[je], ut);
            Re > 1 && console.log("drilling down to z%d-%d-%d", Ie, Pe, $e);
            for (var rt, He = Ie, xe = Pe, Ne = $e; !rt && He > 0; ) He--, xe = Math.floor(xe / 2), Ne = Math.floor(Ne / 2), rt = this.tiles[Ye(He, xe, Ne)];
            return rt && rt.source ? (Re > 1 && console.log("found parent tile z%d-%d-%d", He, xe, Ne), Re > 1 && console.time("drilling down"), this.splitTile(rt.source, He, xe, Ne, Ie, Pe, $e), Re > 1 && console.timeEnd("drilling down"), this.tiles[je] ? Nt(this.tiles[je], ut) : null) : null;
          };
          var Ge = function(Ie) {
            function Pe($e, Ve, ut, Re) {
              Ie.call(this, $e, Ve, ut, at), Re && (this.loadGeoJSON = Re);
            }
            return Ie && (Pe.__proto__ = Ie), Pe.prototype = Object.create(Ie && Ie.prototype), Pe.prototype.constructor = Pe, Pe.prototype.loadData = function($e, Ve) {
              this._pendingCallback && this._pendingCallback(null, { abandoned: true }), this._pendingCallback = Ve, this._pendingLoadDataParams = $e, this._state && this._state !== "Idle" ? this._state = "NeedsLoadData" : (this._state = "Coalescing", this._loadData());
            }, Pe.prototype._loadData = function() {
              var $e = this;
              if (this._pendingCallback && this._pendingLoadDataParams) {
                var Ve = this._pendingCallback, ut = this._pendingLoadDataParams;
                delete this._pendingCallback, delete this._pendingLoadDataParams;
                var Re = !!(ut && ut.request && ut.request.collectResourceTiming) && new i.RequestPerformance(ut.request);
                this.loadGeoJSON(ut, function(qe, je) {
                  if (qe || !je) return Ve(qe);
                  if (typeof je != "object") return Ve(new Error("Input data given to '" + ut.source + "' is not a valid GeoJSON object."));
                  x(je, true);
                  try {
                    $e._geoJSONIndex = ut.cluster ? new Z2(function(xe) {
                      var Ne = xe.superclusterOptions, ke = xe.clusterProperties;
                      if (!ke || !Ne) return Ne;
                      for (var Me = {}, Le = {}, ze = { accumulated: null, zoom: 0 }, ft = { properties: null }, De = Object.keys(ke), Je = 0, tt = De; Je < tt.length; Je += 1) {
                        var vt = tt[Je], kt = ke[vt], jt = kt[0], Vt = kt[1], Kt = i.createExpression(Vt), rr = i.createExpression(typeof jt == "string" ? [jt, ["accumulated"], ["get", vt]] : jt);
                        Me[vt] = Kt.value, Le[vt] = rr.value;
                      }
                      return Ne.map = function(Tr) {
                        ft.properties = Tr;
                        for (var yr = {}, pr = 0, lr = De; pr < lr.length; pr += 1) {
                          var _r = lr[pr];
                          yr[_r] = Me[_r].evaluate(ze, ft);
                        }
                        return yr;
                      }, Ne.reduce = function(Tr, yr) {
                        ft.properties = yr;
                        for (var pr = 0, lr = De; pr < lr.length; pr += 1) {
                          var _r = lr[pr];
                          ze.accumulated = Tr[_r], Tr[_r] = Le[_r].evaluate(ze, ft);
                        }
                      }, Ne;
                    }(ut)).load(je.features) : function(xe, Ne) {
                      return new tr(xe, Ne);
                    }(je, ut.geojsonVtOptions);
                  } catch (xe) {
                    return Ve(xe);
                  }
                  $e.loaded = {};
                  var rt = {};
                  if (Re) {
                    var He = Re.finish();
                    He && (rt.resourceTiming = {}, rt.resourceTiming[ut.source] = JSON.parse(JSON.stringify(He)));
                  }
                  Ve(null, rt);
                });
              }
            }, Pe.prototype.coalesce = function() {
              this._state === "Coalescing" ? this._state = "Idle" : this._state === "NeedsLoadData" && (this._state = "Coalescing", this._loadData());
            }, Pe.prototype.reloadTile = function($e, Ve) {
              var ut = this.loaded, Re = $e.uid;
              return ut && ut[Re] ? Ie.prototype.reloadTile.call(this, $e, Ve) : this.loadTile($e, Ve);
            }, Pe.prototype.loadGeoJSON = function($e, Ve) {
              if ($e.request) i.getJSON($e.request, Ve);
              else {
                if (typeof $e.data != "string") return Ve(new Error("Input data given to '" + $e.source + "' is not a valid GeoJSON object."));
                try {
                  return Ve(null, JSON.parse($e.data));
                } catch {
                  return Ve(new Error("Input data given to '" + $e.source + "' is not a valid GeoJSON object."));
                }
              }
            }, Pe.prototype.removeSource = function($e, Ve) {
              this._pendingCallback && this._pendingCallback(null, { abandoned: true }), Ve();
            }, Pe.prototype.getClusterExpansionZoom = function($e, Ve) {
              try {
                Ve(null, this._geoJSONIndex.getClusterExpansionZoom($e.clusterId));
              } catch (ut) {
                Ve(ut);
              }
            }, Pe.prototype.getClusterChildren = function($e, Ve) {
              try {
                Ve(null, this._geoJSONIndex.getChildren($e.clusterId));
              } catch (ut) {
                Ve(ut);
              }
            }, Pe.prototype.getClusterLeaves = function($e, Ve) {
              try {
                Ve(null, this._geoJSONIndex.getLeaves($e.clusterId, $e.limit, $e.offset));
              } catch (ut) {
                Ve(ut);
              }
            }, Pe;
          }(v), st = function(Ie) {
            var Pe = this;
            this.self = Ie, this.actor = new i.Actor(Ie, this), this.layerIndexes = {}, this.availableImages = {}, this.workerSourceTypes = { vector: v, geojson: Ge }, this.workerSources = {}, this.demWorkerSources = {}, this.self.registerWorkerSource = function($e, Ve) {
              if (Pe.workerSourceTypes[$e]) throw new Error('Worker source with name "' + $e + '" already registered.');
              Pe.workerSourceTypes[$e] = Ve;
            }, this.self.registerRTLTextPlugin = function($e) {
              if (i.plugin.isParsed()) throw new Error("RTL text plugin already registered.");
              i.plugin.applyArabicShaping = $e.applyArabicShaping, i.plugin.processBidirectionalText = $e.processBidirectionalText, i.plugin.processStyledBidirectionalText = $e.processStyledBidirectionalText;
            };
          };
          return st.prototype.setReferrer = function(Ie, Pe) {
            this.referrer = Pe;
          }, st.prototype.setImages = function(Ie, Pe, $e) {
            for (var Ve in this.availableImages[Ie] = Pe, this.workerSources[Ie]) {
              var ut = this.workerSources[Ie][Ve];
              for (var Re in ut) ut[Re].availableImages = Pe;
            }
            $e();
          }, st.prototype.setLayers = function(Ie, Pe, $e) {
            this.getLayerIndex(Ie).replace(Pe), $e();
          }, st.prototype.updateLayers = function(Ie, Pe, $e) {
            this.getLayerIndex(Ie).update(Pe.layers, Pe.removedIds), $e();
          }, st.prototype.loadTile = function(Ie, Pe, $e) {
            this.getWorkerSource(Ie, Pe.type, Pe.source).loadTile(Pe, $e);
          }, st.prototype.loadDEMTile = function(Ie, Pe, $e) {
            this.getDEMWorkerSource(Ie, Pe.source).loadTile(Pe, $e);
          }, st.prototype.reloadTile = function(Ie, Pe, $e) {
            this.getWorkerSource(Ie, Pe.type, Pe.source).reloadTile(Pe, $e);
          }, st.prototype.abortTile = function(Ie, Pe, $e) {
            this.getWorkerSource(Ie, Pe.type, Pe.source).abortTile(Pe, $e);
          }, st.prototype.removeTile = function(Ie, Pe, $e) {
            this.getWorkerSource(Ie, Pe.type, Pe.source).removeTile(Pe, $e);
          }, st.prototype.removeDEMTile = function(Ie, Pe) {
            this.getDEMWorkerSource(Ie, Pe.source).removeTile(Pe);
          }, st.prototype.removeSource = function(Ie, Pe, $e) {
            if (this.workerSources[Ie] && this.workerSources[Ie][Pe.type] && this.workerSources[Ie][Pe.type][Pe.source]) {
              var Ve = this.workerSources[Ie][Pe.type][Pe.source];
              delete this.workerSources[Ie][Pe.type][Pe.source], Ve.removeSource !== void 0 ? Ve.removeSource(Pe, $e) : $e();
            }
          }, st.prototype.loadWorkerSource = function(Ie, Pe, $e) {
            try {
              this.self.importScripts(Pe.url), $e();
            } catch (Ve) {
              $e(Ve.toString());
            }
          }, st.prototype.syncRTLPluginState = function(Ie, Pe, $e) {
            try {
              i.plugin.setState(Pe);
              var Ve = i.plugin.getPluginURL();
              if (i.plugin.isLoaded() && !i.plugin.isParsed() && Ve != null) {
                this.self.importScripts(Ve);
                var ut = i.plugin.isParsed();
                $e(ut ? void 0 : new Error("RTL Text Plugin failed to import scripts from " + Ve), ut);
              }
            } catch (Re) {
              $e(Re.toString());
            }
          }, st.prototype.getAvailableImages = function(Ie) {
            var Pe = this.availableImages[Ie];
            return Pe || (Pe = []), Pe;
          }, st.prototype.getLayerIndex = function(Ie) {
            var Pe = this.layerIndexes[Ie];
            return Pe || (Pe = this.layerIndexes[Ie] = new c()), Pe;
          }, st.prototype.getWorkerSource = function(Ie, Pe, $e) {
            var Ve = this;
            if (this.workerSources[Ie] || (this.workerSources[Ie] = {}), this.workerSources[Ie][Pe] || (this.workerSources[Ie][Pe] = {}), !this.workerSources[Ie][Pe][$e]) {
              var ut = { send: function(Re, qe, je) {
                Ve.actor.send(Re, qe, je, Ie);
              } };
              this.workerSources[Ie][Pe][$e] = new this.workerSourceTypes[Pe](ut, this.getLayerIndex(Ie), this.getAvailableImages(Ie));
            }
            return this.workerSources[Ie][Pe][$e];
          }, st.prototype.getDEMWorkerSource = function(Ie, Pe) {
            return this.demWorkerSources[Ie] || (this.demWorkerSources[Ie] = {}), this.demWorkerSources[Ie][Pe] || (this.demWorkerSources[Ie][Pe] = new g()), this.demWorkerSources[Ie][Pe];
          }, st.prototype.enforceCacheSizeLimit = function(Ie, Pe) {
            i.enforceCacheSizeLimit(Pe);
          }, typeof WorkerGlobalScope < "u" && i.window !== void 0 && i.window instanceof WorkerGlobalScope && (i.window.worker = new st(i.window)), st;
        }), s(0, function(i) {
          var l = i.createCommonjsModule(function(P2) {
            function U2(oe) {
              return !G2(oe);
            }
            function G2(oe) {
              return typeof window > "u" || typeof document > "u" ? "not a browser" : 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 ? Function.prototype && Function.prototype.bind ? 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 ? "JSON" in window && "parse" in JSON && "stringify" in JSON ? function() {
                if (!("Worker" in window && "Blob" in window && "URL" in window)) return false;
                var de, ye, Te = new Blob([""], { type: "text/javascript" }), Fe = URL.createObjectURL(Te);
                try {
                  ye = new Worker(Fe), de = true;
                } catch {
                  de = false;
                }
                return ye && ye.terminate(), URL.revokeObjectURL(Fe), de;
              }() ? "Uint8ClampedArray" in window ? ArrayBuffer.isView ? function() {
                var de = document.createElement("canvas");
                de.width = de.height = 1;
                var ye = de.getContext("2d");
                if (!ye) return false;
                var Te = ye.getImageData(0, 0, 1, 1);
                return Te && Te.width === de.width;
              }() ? function(de) {
                return J2[de] === void 0 && (J2[de] = function(ye) {
                  var Te = function(et) {
                    var lt = document.createElement("canvas"), bt = Object.create(U2.webGLContextAttributes);
                    return bt.failIfMajorPerformanceCaveat = et, lt.probablySupportsContext ? lt.probablySupportsContext("webgl", bt) || lt.probablySupportsContext("experimental-webgl", bt) : lt.supportsContext ? lt.supportsContext("webgl", bt) || lt.supportsContext("experimental-webgl", bt) : lt.getContext("webgl", bt) || lt.getContext("experimental-webgl", bt);
                  }(ye);
                  if (!Te) return false;
                  var Fe = Te.createShader(Te.VERTEX_SHADER);
                  return !Fe || Te.isContextLost() ? false : (Te.shaderSource(Fe, "void main() {}"), Te.compileShader(Fe), Te.getShaderParameter(Fe, Te.COMPILE_STATUS) === true);
                }(de)), J2[de];
              }(oe && oe.failIfMajorPerformanceCaveat) ? void 0 : "insufficient WebGL support" : "insufficient Canvas/getImageData support" : "insufficient ArrayBuffer support" : "insufficient Uint8ClampedArray support" : "insufficient worker support" : "insufficient JSON support" : "insufficient Object support" : "insufficient Function support" : "insufficent Array support";
            }
            P2.exports ? P2.exports = U2 : window && (window.mapboxgl = window.mapboxgl || {}, window.mapboxgl.supported = U2, window.mapboxgl.notSupportedReason = G2);
            var J2 = {};
            U2.webGLContextAttributes = { antialias: false, alpha: true, stencil: true, depth: true };
          }), u2 = { create: function(P2, U2, G2) {
            var J2 = i.window.document.createElement(P2);
            return U2 !== void 0 && (J2.className = U2), G2 && G2.appendChild(J2), J2;
          }, createNS: function(P2, U2) {
            return i.window.document.createElementNS(P2, U2);
          } }, c = i.window.document.documentElement.style;
          function f(P2) {
            if (!c) return P2[0];
            for (var U2 = 0; U2 < P2.length; U2++) if (P2[U2] in c) return P2[U2];
            return P2[0];
          }
          var h, p = f(["userSelect", "MozUserSelect", "WebkitUserSelect", "msUserSelect"]);
          u2.disableDrag = function() {
            c && p && (h = c[p], c[p] = "none");
          }, u2.enableDrag = function() {
            c && p && (c[p] = h);
          };
          var d = f(["transform", "WebkitTransform"]);
          u2.setTransform = function(P2, U2) {
            P2.style[d] = U2;
          };
          var v = false;
          try {
            var m = Object.defineProperty({}, "passive", { get: function() {
              v = true;
            } });
            i.window.addEventListener("test", m, m), i.window.removeEventListener("test", m, m);
          } catch {
            v = false;
          }
          u2.addEventListener = function(P2, U2, G2, J2) {
            J2 === void 0 && (J2 = {}), "passive" in J2 && v ? P2.addEventListener(U2, G2, J2) : P2.addEventListener(U2, G2, J2.capture);
          }, u2.removeEventListener = function(P2, U2, G2, J2) {
            J2 === void 0 && (J2 = {}), "passive" in J2 && v ? P2.removeEventListener(U2, G2, J2) : P2.removeEventListener(U2, G2, J2.capture);
          };
          var g = function(P2) {
            P2.preventDefault(), P2.stopPropagation(), i.window.removeEventListener("click", g, true);
          };
          function x(P2) {
            var U2 = P2.userImage;
            return U2 && U2.render && U2.render() ? (P2.data.replace(new Uint8Array(U2.data.buffer)), true) : false;
          }
          u2.suppressClick = function() {
            i.window.addEventListener("click", g, true), i.window.setTimeout(function() {
              i.window.removeEventListener("click", g, true);
            }, 0);
          }, u2.mousePos = function(P2, U2) {
            var G2 = P2.getBoundingClientRect();
            return new i.Point(U2.clientX - G2.left - P2.clientLeft, U2.clientY - G2.top - P2.clientTop);
          }, u2.touchPos = function(P2, U2) {
            for (var G2 = P2.getBoundingClientRect(), J2 = [], oe = 0; oe < U2.length; oe++) J2.push(new i.Point(U2[oe].clientX - G2.left - P2.clientLeft, U2[oe].clientY - G2.top - P2.clientTop));
            return J2;
          }, u2.mouseButton = function(P2) {
            return i.window.InstallTrigger !== void 0 && P2.button === 2 && P2.ctrlKey && i.window.navigator.platform.toUpperCase().indexOf("MAC") >= 0 ? 0 : P2.button;
          }, u2.remove = function(P2) {
            P2.parentNode && P2.parentNode.removeChild(P2);
          };
          var b = function(P2) {
            function U2() {
              P2.call(this), this.images = {}, this.updatedImages = {}, this.callbackDispatchedThisFrame = {}, this.loaded = false, this.requestors = [], this.patterns = {}, this.atlasImage = new i.RGBAImage({ width: 1, height: 1 }), this.dirty = true;
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.isLoaded = function() {
              return this.loaded;
            }, U2.prototype.setLoaded = function(G2) {
              if (this.loaded !== G2 && (this.loaded = G2, G2)) {
                for (var J2 = 0, oe = this.requestors; J2 < oe.length; J2 += 1) {
                  var de = oe[J2], ye = de.ids, Te = de.callback;
                  this._notify(ye, Te);
                }
                this.requestors = [];
              }
            }, U2.prototype.getImage = function(G2) {
              return this.images[G2];
            }, U2.prototype.addImage = function(G2, J2) {
              this._validate(G2, J2) && (this.images[G2] = J2);
            }, U2.prototype._validate = function(G2, J2) {
              var oe = true;
              return this._validateStretch(J2.stretchX, J2.data && J2.data.width) || (this.fire(new i.ErrorEvent(new Error('Image "' + G2 + '" has invalid "stretchX" value'))), oe = false), this._validateStretch(J2.stretchY, J2.data && J2.data.height) || (this.fire(new i.ErrorEvent(new Error('Image "' + G2 + '" has invalid "stretchY" value'))), oe = false), this._validateContent(J2.content, J2) || (this.fire(new i.ErrorEvent(new Error('Image "' + G2 + '" has invalid "content" value'))), oe = false), oe;
            }, U2.prototype._validateStretch = function(G2, J2) {
              if (!G2) return true;
              for (var oe = 0, de = 0, ye = G2; de < ye.length; de += 1) {
                var Te = ye[de];
                if (Te[0] < oe || Te[1] < Te[0] || J2 < Te[1]) return false;
                oe = Te[1];
              }
              return true;
            }, U2.prototype._validateContent = function(G2, J2) {
              return !G2 || G2.length === 4 && !(G2[0] < 0 || J2.data.width < G2[0]) && !(G2[1] < 0 || J2.data.height < G2[1]) && !(G2[2] < 0 || J2.data.width < G2[2]) && !(G2[3] < 0 || J2.data.height < G2[3]) && !(G2[2] < G2[0]) && !(G2[3] < G2[1]);
            }, U2.prototype.updateImage = function(G2, J2) {
              var oe = this.images[G2];
              J2.version = oe.version + 1, this.images[G2] = J2, this.updatedImages[G2] = true;
            }, U2.prototype.removeImage = function(G2) {
              var J2 = this.images[G2];
              delete this.images[G2], delete this.patterns[G2], J2.userImage && J2.userImage.onRemove && J2.userImage.onRemove();
            }, U2.prototype.listImages = function() {
              return Object.keys(this.images);
            }, U2.prototype.getImages = function(G2, J2) {
              var oe = true;
              if (!this.isLoaded()) for (var de = 0, ye = G2; de < ye.length; de += 1) {
                var Te = ye[de];
                this.images[Te] || (oe = false);
              }
              this.isLoaded() || oe ? this._notify(G2, J2) : this.requestors.push({ ids: G2, callback: J2 });
            }, U2.prototype._notify = function(G2, J2) {
              for (var oe = {}, de = 0, ye = G2; de < ye.length; de += 1) {
                var Te = ye[de];
                this.images[Te] || this.fire(new i.Event("styleimagemissing", { id: Te }));
                var Fe = this.images[Te];
                Fe ? oe[Te] = { data: Fe.data.clone(), pixelRatio: Fe.pixelRatio, sdf: Fe.sdf, version: Fe.version, stretchX: Fe.stretchX, stretchY: Fe.stretchY, content: Fe.content, hasRenderCallback: Boolean(Fe.userImage && Fe.userImage.render) } : i.warnOnce('Image "' + Te + '" 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.');
              }
              J2(null, oe);
            }, U2.prototype.getPixelSize = function() {
              var G2 = this.atlasImage;
              return { width: G2.width, height: G2.height };
            }, U2.prototype.getPattern = function(G2) {
              var J2 = this.patterns[G2], oe = this.getImage(G2);
              if (!oe) return null;
              if (J2 && J2.position.version === oe.version) return J2.position;
              if (J2) J2.position.version = oe.version;
              else {
                var de = { w: oe.data.width + 2, h: oe.data.height + 2, x: 0, y: 0 }, ye = new i.ImagePosition(de, oe);
                this.patterns[G2] = { bin: de, position: ye };
              }
              return this._updatePatternAtlas(), this.patterns[G2].position;
            }, U2.prototype.bind = function(G2) {
              var J2 = G2.gl;
              this.atlasTexture ? this.dirty && (this.atlasTexture.update(this.atlasImage), this.dirty = false) : this.atlasTexture = new i.Texture(G2, this.atlasImage, J2.RGBA), this.atlasTexture.bind(J2.LINEAR, J2.CLAMP_TO_EDGE);
            }, U2.prototype._updatePatternAtlas = function() {
              var G2 = [];
              for (var J2 in this.patterns) G2.push(this.patterns[J2].bin);
              var oe = i.potpack(G2), de = oe.w, ye = oe.h, Te = this.atlasImage;
              for (var Fe in Te.resize({ width: de || 1, height: ye || 1 }), this.patterns) {
                var et = this.patterns[Fe].bin, lt = et.x + 1, bt = et.y + 1, It = this.images[Fe].data, Rt = It.width, Ft = It.height;
                i.RGBAImage.copy(It, Te, { x: 0, y: 0 }, { x: lt, y: bt }, { width: Rt, height: Ft }), i.RGBAImage.copy(It, Te, { x: 0, y: Ft - 1 }, { x: lt, y: bt - 1 }, { width: Rt, height: 1 }), i.RGBAImage.copy(It, Te, { x: 0, y: 0 }, { x: lt, y: bt + Ft }, { width: Rt, height: 1 }), i.RGBAImage.copy(It, Te, { x: Rt - 1, y: 0 }, { x: lt - 1, y: bt }, { width: 1, height: Ft }), i.RGBAImage.copy(It, Te, { x: 0, y: 0 }, { x: lt + Rt, y: bt }, { width: 1, height: Ft });
              }
              this.dirty = true;
            }, U2.prototype.beginFrame = function() {
              this.callbackDispatchedThisFrame = {};
            }, U2.prototype.dispatchRenderCallbacks = function(G2) {
              for (var J2 = 0, oe = G2; J2 < oe.length; J2 += 1) {
                var de = oe[J2];
                if (!this.callbackDispatchedThisFrame[de]) {
                  this.callbackDispatchedThisFrame[de] = true;
                  var ye = this.images[de];
                  x(ye) && this.updateImage(de, ye);
                }
              }
            }, U2;
          }(i.Evented), y = k, w = k, _4 = 1e20;
          function k(P2, U2, G2, J2, oe, de) {
            this.fontSize = P2 || 24, this.buffer = U2 === void 0 ? 3 : U2, this.cutoff = J2 || 0.25, this.fontFamily = oe || "sans-serif", this.fontWeight = de || "normal", this.radius = G2 || 8;
            var ye = this.size = this.fontSize + 2 * this.buffer;
            this.canvas = document.createElement("canvas"), this.canvas.width = this.canvas.height = ye, this.ctx = this.canvas.getContext("2d"), this.ctx.font = this.fontWeight + " " + this.fontSize + "px " + this.fontFamily, this.ctx.textBaseline = "middle", this.ctx.fillStyle = "black", this.gridOuter = new Float64Array(ye * ye), this.gridInner = new Float64Array(ye * ye), this.f = new Float64Array(ye), this.d = new Float64Array(ye), this.z = new Float64Array(ye + 1), this.v = new Int16Array(ye), this.middle = Math.round(ye / 2 * (navigator.userAgent.indexOf("Gecko/") >= 0 ? 1.2 : 1));
          }
          function T2(P2, U2, G2, J2, oe, de, ye) {
            for (var Te = 0; Te < U2; Te++) {
              for (var Fe = 0; Fe < G2; Fe++) J2[Fe] = P2[Fe * U2 + Te];
              for (A2(J2, oe, de, ye, G2), Fe = 0; Fe < G2; Fe++) P2[Fe * U2 + Te] = oe[Fe];
            }
            for (Fe = 0; Fe < G2; Fe++) {
              for (Te = 0; Te < U2; Te++) J2[Te] = P2[Fe * U2 + Te];
              for (A2(J2, oe, de, ye, U2), Te = 0; Te < U2; Te++) P2[Fe * U2 + Te] = Math.sqrt(oe[Te]);
            }
          }
          function A2(P2, U2, G2, J2, oe) {
            G2[0] = 0, J2[0] = -_4, J2[1] = +_4;
            for (var de = 1, ye = 0; de < oe; de++) {
              for (var Te = (P2[de] + de * de - (P2[G2[ye]] + G2[ye] * G2[ye])) / (2 * de - 2 * G2[ye]); Te <= J2[ye]; ) ye--, Te = (P2[de] + de * de - (P2[G2[ye]] + G2[ye] * G2[ye])) / (2 * de - 2 * G2[ye]);
              G2[++ye] = de, J2[ye] = Te, J2[ye + 1] = +_4;
            }
            for (de = 0, ye = 0; de < oe; de++) {
              for (; J2[ye + 1] < de; ) ye++;
              U2[de] = (de - G2[ye]) * (de - G2[ye]) + P2[G2[ye]];
            }
          }
          k.prototype.draw = function(P2) {
            this.ctx.clearRect(0, 0, this.size, this.size), this.ctx.fillText(P2, this.buffer, this.middle);
            for (var U2 = this.ctx.getImageData(0, 0, this.size, this.size), G2 = new Uint8ClampedArray(this.size * this.size), J2 = 0; J2 < this.size * this.size; J2++) {
              var oe = U2.data[4 * J2 + 3] / 255;
              this.gridOuter[J2] = oe === 1 ? 0 : oe === 0 ? _4 : Math.pow(Math.max(0, 0.5 - oe), 2), this.gridInner[J2] = oe === 1 ? _4 : oe === 0 ? 0 : Math.pow(Math.max(0, oe - 0.5), 2);
            }
            for (T2(this.gridOuter, this.size, this.size, this.f, this.d, this.v, this.z), T2(this.gridInner, this.size, this.size, this.f, this.d, this.v, this.z), J2 = 0; J2 < this.size * this.size; J2++) {
              var de = this.gridOuter[J2] - this.gridInner[J2];
              G2[J2] = Math.max(0, Math.min(255, Math.round(255 - 255 * (de / this.radius + this.cutoff))));
            }
            return G2;
          }, y.default = w;
          var S2 = function(P2, U2) {
            this.requestManager = P2, this.localIdeographFontFamily = U2, this.entries = {};
          };
          S2.prototype.setURL = function(P2) {
            this.url = P2;
          }, S2.prototype.getGlyphs = function(P2, U2) {
            var G2 = this, J2 = [];
            for (var oe in P2) for (var de = 0, ye = P2[oe]; de < ye.length; de += 1) {
              var Te = ye[de];
              J2.push({ stack: oe, id: Te });
            }
            i.asyncAll(J2, function(Fe, et) {
              var lt = Fe.stack, bt = Fe.id, It = G2.entries[lt];
              It || (It = G2.entries[lt] = { glyphs: {}, requests: {}, ranges: {} });
              var Rt = It.glyphs[bt];
              if (Rt === void 0) {
                if (Rt = G2._tinySDF(It, lt, bt)) return It.glyphs[bt] = Rt, void et(null, { stack: lt, id: bt, glyph: Rt });
                var Ft = Math.floor(bt / 256);
                if (256 * Ft > 65535) et(new Error("glyphs > 65535 not supported"));
                else if (It.ranges[Ft]) et(null, { stack: lt, id: bt, glyph: Rt });
                else {
                  var Pt = It.requests[Ft];
                  Pt || (Pt = It.requests[Ft] = [], S2.loadGlyphRange(lt, Ft, G2.url, G2.requestManager, function(Mt, qt) {
                    if (qt) {
                      for (var $t in qt) G2._doesCharSupportLocalGlyph(+$t) || (It.glyphs[+$t] = qt[+$t]);
                      It.ranges[Ft] = true;
                    }
                    for (var Yt = 0, cr = Pt; Yt < cr.length; Yt += 1) (0, cr[Yt])(Mt, qt);
                    delete It.requests[Ft];
                  })), Pt.push(function(Mt, qt) {
                    Mt ? et(Mt) : qt && et(null, { stack: lt, id: bt, glyph: qt[bt] || null });
                  });
                }
              } else et(null, { stack: lt, id: bt, glyph: Rt });
            }, function(Fe, et) {
              if (Fe) U2(Fe);
              else if (et) {
                for (var lt = {}, bt = 0, It = et; bt < It.length; bt += 1) {
                  var Rt = It[bt], Ft = Rt.stack, Pt = Rt.id, Mt = Rt.glyph;
                  (lt[Ft] || (lt[Ft] = {}))[Pt] = Mt && { id: Mt.id, bitmap: Mt.bitmap.clone(), metrics: Mt.metrics };
                }
                U2(null, lt);
              }
            });
          }, S2.prototype._doesCharSupportLocalGlyph = function(P2) {
            return !!this.localIdeographFontFamily && (i.isChar["CJK Unified Ideographs"](P2) || i.isChar["Hangul Syllables"](P2) || i.isChar.Hiragana(P2) || i.isChar.Katakana(P2));
          }, S2.prototype._tinySDF = function(P2, U2, G2) {
            var J2 = this.localIdeographFontFamily;
            if (J2 && this._doesCharSupportLocalGlyph(G2)) {
              var oe = P2.tinySDF;
              if (!oe) {
                var de = "400";
                /bold/i.test(U2) ? de = "900" : /medium/i.test(U2) ? de = "500" : /light/i.test(U2) && (de = "200"), oe = P2.tinySDF = new S2.TinySDF(24, 3, 8, 0.25, J2, de);
              }
              return { id: G2, bitmap: new i.AlphaImage({ width: 30, height: 30 }, oe.draw(String.fromCharCode(G2))), metrics: { width: 24, height: 24, left: 0, top: -8, advance: 24 } };
            }
          }, S2.loadGlyphRange = function(P2, U2, G2, J2, oe) {
            var de = 256 * U2, ye = de + 255, Te = J2.transformRequest(J2.normalizeGlyphsURL(G2).replace("{fontstack}", P2).replace("{range}", de + "-" + ye), i.ResourceType.Glyphs);
            i.getArrayBuffer(Te, function(Fe, et) {
              if (Fe) oe(Fe);
              else if (et) {
                for (var lt = {}, bt = 0, It = i.parseGlyphPBF(et); bt < It.length; bt += 1) {
                  var Rt = It[bt];
                  lt[Rt.id] = Rt;
                }
                oe(null, lt);
              }
            });
          }, S2.TinySDF = y;
          var C2 = function() {
            this.specification = i.styleSpec.light.position;
          };
          C2.prototype.possiblyEvaluate = function(P2, U2) {
            return i.sphericalToCartesian(P2.expression.evaluate(U2));
          }, C2.prototype.interpolate = function(P2, U2, G2) {
            return { x: i.number(P2.x, U2.x, G2), y: i.number(P2.y, U2.y, G2), z: i.number(P2.z, U2.z, G2) };
          };
          var E2 = new i.Properties({ anchor: new i.DataConstantProperty(i.styleSpec.light.anchor), position: new C2(), color: new i.DataConstantProperty(i.styleSpec.light.color), intensity: new i.DataConstantProperty(i.styleSpec.light.intensity) }), F13 = function(P2) {
            function U2(G2) {
              P2.call(this), this._transitionable = new i.Transitionable(E2), this.setLight(G2), this._transitioning = this._transitionable.untransitioned();
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.getLight = function() {
              return this._transitionable.serialize();
            }, U2.prototype.setLight = function(G2, J2) {
              if (J2 === void 0 && (J2 = {}), !this._validate(i.validateLight, G2, J2)) for (var oe in G2) {
                var de = G2[oe];
                i.endsWith(oe, "-transition") ? this._transitionable.setTransition(oe.slice(0, -11), de) : this._transitionable.setValue(oe, de);
              }
            }, U2.prototype.updateTransitions = function(G2) {
              this._transitioning = this._transitionable.transitioned(G2, this._transitioning);
            }, U2.prototype.hasTransition = function() {
              return this._transitioning.hasTransition();
            }, U2.prototype.recalculate = function(G2) {
              this.properties = this._transitioning.possiblyEvaluate(G2);
            }, U2.prototype._validate = function(G2, J2, oe) {
              return (!oe || oe.validate !== false) && i.emitValidationErrors(this, G2.call(i.validateStyle, i.extend({ value: J2, style: { glyphs: true, sprite: true }, styleSpec: i.styleSpec })));
            }, U2;
          }(i.Evented), N2 = function(P2, U2) {
            this.width = P2, this.height = U2, this.nextRow = 0, this.data = new Uint8Array(this.width * this.height), this.dashEntry = {};
          };
          N2.prototype.getDash = function(P2, U2) {
            var G2 = P2.join(",") + String(U2);
            return this.dashEntry[G2] || (this.dashEntry[G2] = this.addDash(P2, U2)), this.dashEntry[G2];
          }, N2.prototype.getDashRanges = function(P2, U2, G2) {
            var J2 = [], oe = P2.length % 2 == 1 ? -P2[P2.length - 1] * G2 : 0, de = P2[0] * G2, ye = true;
            J2.push({ left: oe, right: de, isDash: ye, zeroLength: P2[0] === 0 });
            for (var Te = P2[0], Fe = 1; Fe < P2.length; Fe++) {
              ye = !ye;
              var et = P2[Fe];
              oe = Te * G2, de = (Te += et) * G2, J2.push({ left: oe, right: de, isDash: ye, zeroLength: et === 0 });
            }
            return J2;
          }, N2.prototype.addRoundDash = function(P2, U2, G2) {
            for (var J2 = U2 / 2, oe = -G2; oe <= G2; oe++) for (var de = this.nextRow + G2 + oe, ye = this.width * de, Te = 0, Fe = P2[Te], et = 0; et < this.width; et++) {
              et / Fe.right > 1 && (Fe = P2[++Te]);
              var lt = Math.abs(et - Fe.left), bt = Math.abs(et - Fe.right), It = Math.min(lt, bt), Rt = void 0, Ft = oe / G2 * (J2 + 1);
              if (Fe.isDash) {
                var Pt = J2 - Math.abs(Ft);
                Rt = Math.sqrt(It * It + Pt * Pt);
              } else Rt = J2 - Math.sqrt(It * It + Ft * Ft);
              this.data[ye + et] = Math.max(0, Math.min(255, Rt + 128));
            }
          }, N2.prototype.addRegularDash = function(P2) {
            for (var U2 = P2.length - 1; U2 >= 0; --U2) {
              var G2 = P2[U2], J2 = P2[U2 + 1];
              G2.zeroLength ? P2.splice(U2, 1) : J2 && J2.isDash === G2.isDash && (J2.left = G2.left, P2.splice(U2, 1));
            }
            var oe = P2[0], de = P2[P2.length - 1];
            oe.isDash === de.isDash && (oe.left = de.left - this.width, de.right = oe.right + this.width);
            for (var ye = this.width * this.nextRow, Te = 0, Fe = P2[Te], et = 0; et < this.width; et++) {
              et / Fe.right > 1 && (Fe = P2[++Te]);
              var lt = Math.abs(et - Fe.left), bt = Math.abs(et - Fe.right), It = Math.min(lt, bt), Rt = Fe.isDash ? It : -It;
              this.data[ye + et] = Math.max(0, Math.min(255, Rt + 128));
            }
          }, N2.prototype.addDash = function(P2, U2) {
            var G2 = U2 ? 7 : 0, J2 = 2 * G2 + 1;
            if (this.nextRow + J2 > this.height) return i.warnOnce("LineAtlas out of space"), null;
            for (var oe = 0, de = 0; de < P2.length; de++) oe += P2[de];
            if (oe !== 0) {
              var ye = this.width / oe, Te = this.getDashRanges(P2, this.width, ye);
              U2 ? this.addRoundDash(Te, ye, G2) : this.addRegularDash(Te);
            }
            var Fe = { y: (this.nextRow + G2 + 0.5) / this.height, height: 2 * G2 / this.height, width: oe };
            return this.nextRow += J2, this.dirty = true, Fe;
          }, N2.prototype.bind = function(P2) {
            var U2 = P2.gl;
            this.texture ? (U2.bindTexture(U2.TEXTURE_2D, this.texture), this.dirty && (this.dirty = false, U2.texSubImage2D(U2.TEXTURE_2D, 0, 0, 0, this.width, this.height, U2.ALPHA, U2.UNSIGNED_BYTE, this.data))) : (this.texture = U2.createTexture(), U2.bindTexture(U2.TEXTURE_2D, this.texture), U2.texParameteri(U2.TEXTURE_2D, U2.TEXTURE_WRAP_S, U2.REPEAT), U2.texParameteri(U2.TEXTURE_2D, U2.TEXTURE_WRAP_T, U2.REPEAT), U2.texParameteri(U2.TEXTURE_2D, U2.TEXTURE_MIN_FILTER, U2.LINEAR), U2.texParameteri(U2.TEXTURE_2D, U2.TEXTURE_MAG_FILTER, U2.LINEAR), U2.texImage2D(U2.TEXTURE_2D, 0, U2.ALPHA, this.width, this.height, 0, U2.ALPHA, U2.UNSIGNED_BYTE, this.data));
          };
          var D2 = function P2(U2, G2) {
            this.workerPool = U2, this.actors = [], this.currentActor = 0, this.id = i.uniqueId();
            for (var J2 = this.workerPool.acquire(this.id), oe = 0; oe < J2.length; oe++) {
              var de = J2[oe], ye = new P2.Actor(de, G2, this.id);
              ye.name = "Worker " + oe, this.actors.push(ye);
            }
          };
          function I2(P2, U2, G2) {
            var J2 = function(oe, de) {
              if (oe) return G2(oe);
              if (de) {
                var ye = i.pick(i.extend(de, P2), ["tiles", "minzoom", "maxzoom", "attribution", "mapbox_logo", "bounds", "scheme", "tileSize", "encoding"]);
                de.vector_layers && (ye.vectorLayers = de.vector_layers, ye.vectorLayerIds = ye.vectorLayers.map(function(Te) {
                  return Te.id;
                })), ye.tiles = U2.canonicalizeTileset(ye, P2.url), G2(null, ye);
              }
            };
            return P2.url ? i.getJSON(U2.transformRequest(U2.normalizeSourceURL(P2.url), i.ResourceType.Source), J2) : i.browser.frame(function() {
              return J2(null, P2);
            });
          }
          D2.prototype.broadcast = function(P2, U2, G2) {
            G2 = G2 || function() {
            }, i.asyncAll(this.actors, function(J2, oe) {
              J2.send(P2, U2, oe);
            }, G2);
          }, D2.prototype.getActor = function() {
            return this.currentActor = (this.currentActor + 1) % this.actors.length, this.actors[this.currentActor];
          }, D2.prototype.remove = function() {
            this.actors.forEach(function(P2) {
              P2.remove();
            }), this.actors = [], this.workerPool.release(this.id);
          }, D2.Actor = i.Actor;
          var O2 = function(P2, U2, G2) {
            this.bounds = i.LngLatBounds.convert(this.validateBounds(P2)), this.minzoom = U2 || 0, this.maxzoom = G2 || 24;
          };
          O2.prototype.validateBounds = function(P2) {
            return Array.isArray(P2) && P2.length === 4 ? [Math.max(-180, P2[0]), Math.max(-90, P2[1]), Math.min(180, P2[2]), Math.min(90, P2[3])] : [-180, -90, 180, 90];
          }, O2.prototype.contains = function(P2) {
            var U2 = Math.pow(2, P2.z), G2 = Math.floor(i.mercatorXfromLng(this.bounds.getWest()) * U2), J2 = Math.floor(i.mercatorYfromLat(this.bounds.getNorth()) * U2), oe = Math.ceil(i.mercatorXfromLng(this.bounds.getEast()) * U2), de = Math.ceil(i.mercatorYfromLat(this.bounds.getSouth()) * U2);
            return P2.x >= G2 && P2.x < oe && P2.y >= J2 && P2.y < de;
          };
          var L2 = function(P2) {
            function U2(G2, J2, oe, de) {
              if (P2.call(this), this.id = G2, this.dispatcher = oe, this.type = "vector", this.minzoom = 0, this.maxzoom = 22, this.scheme = "xyz", this.tileSize = 512, this.reparseOverscaled = true, this.isTileClipped = true, this._loaded = false, i.extend(this, i.pick(J2, ["url", "scheme", "tileSize", "promoteId"])), this._options = i.extend({ type: "vector" }, J2), this._collectResourceTiming = J2.collectResourceTiming, this.tileSize !== 512) throw new Error("vector tile sources must have a tileSize of 512");
              this.setEventedParent(de);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.load = function() {
              var G2 = this;
              this._loaded = false, this.fire(new i.Event("dataloading", { dataType: "source" })), this._tileJSONRequest = I2(this._options, this.map._requestManager, function(J2, oe) {
                G2._tileJSONRequest = null, G2._loaded = true, J2 ? G2.fire(new i.ErrorEvent(J2)) : oe && (i.extend(G2, oe), oe.bounds && (G2.tileBounds = new O2(oe.bounds, G2.minzoom, G2.maxzoom)), i.postTurnstileEvent(oe.tiles, G2.map._requestManager._customAccessToken), i.postMapLoadEvent(oe.tiles, G2.map._getMapId(), G2.map._requestManager._skuToken, G2.map._requestManager._customAccessToken), G2.fire(new i.Event("data", { dataType: "source", sourceDataType: "metadata" })), G2.fire(new i.Event("data", { dataType: "source", sourceDataType: "content" })));
              });
            }, U2.prototype.loaded = function() {
              return this._loaded;
            }, U2.prototype.hasTile = function(G2) {
              return !this.tileBounds || this.tileBounds.contains(G2.canonical);
            }, U2.prototype.onAdd = function(G2) {
              this.map = G2, this.load();
            }, U2.prototype.onRemove = function() {
              this._tileJSONRequest && (this._tileJSONRequest.cancel(), this._tileJSONRequest = null);
            }, U2.prototype.serialize = function() {
              return i.extend({}, this._options);
            }, U2.prototype.loadTile = function(G2, J2) {
              var oe = this.map._requestManager.normalizeTileURL(G2.tileID.canonical.url(this.tiles, this.scheme)), de = { request: this.map._requestManager.transformRequest(oe, i.ResourceType.Tile), uid: G2.uid, tileID: G2.tileID, zoom: G2.tileID.overscaledZ, tileSize: this.tileSize * G2.tileID.overscaleFactor(), type: this.type, source: this.id, pixelRatio: i.browser.devicePixelRatio, showCollisionBoxes: this.map.showCollisionBoxes, promoteId: this.promoteId };
              function ye(Te, Fe) {
                return delete G2.request, G2.aborted ? J2(null) : Te && Te.status !== 404 ? J2(Te) : (Fe && Fe.resourceTiming && (G2.resourceTiming = Fe.resourceTiming), this.map._refreshExpiredTiles && Fe && G2.setExpiryData(Fe), G2.loadVectorData(Fe, this.map.painter), i.cacheEntryPossiblyAdded(this.dispatcher), J2(null), void (G2.reloadCallback && (this.loadTile(G2, G2.reloadCallback), G2.reloadCallback = null)));
              }
              de.request.collectResourceTiming = this._collectResourceTiming, G2.actor && G2.state !== "expired" ? G2.state === "loading" ? G2.reloadCallback = J2 : G2.request = G2.actor.send("reloadTile", de, ye.bind(this)) : (G2.actor = this.dispatcher.getActor(), G2.request = G2.actor.send("loadTile", de, ye.bind(this)));
            }, U2.prototype.abortTile = function(G2) {
              G2.request && (G2.request.cancel(), delete G2.request), G2.actor && G2.actor.send("abortTile", { uid: G2.uid, type: this.type, source: this.id }, void 0);
            }, U2.prototype.unloadTile = function(G2) {
              G2.unloadVectorData(), G2.actor && G2.actor.send("removeTile", { uid: G2.uid, type: this.type, source: this.id }, void 0);
            }, U2.prototype.hasTransition = function() {
              return false;
            }, U2;
          }(i.Evented), V2 = function(P2) {
            function U2(G2, J2, oe, de) {
              P2.call(this), this.id = G2, this.dispatcher = oe, this.setEventedParent(de), this.type = "raster", this.minzoom = 0, this.maxzoom = 22, this.roundZoom = true, this.scheme = "xyz", this.tileSize = 512, this._loaded = false, this._options = i.extend({ type: "raster" }, J2), i.extend(this, i.pick(J2, ["url", "scheme", "tileSize"]));
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.load = function() {
              var G2 = this;
              this._loaded = false, this.fire(new i.Event("dataloading", { dataType: "source" })), this._tileJSONRequest = I2(this._options, this.map._requestManager, function(J2, oe) {
                G2._tileJSONRequest = null, G2._loaded = true, J2 ? G2.fire(new i.ErrorEvent(J2)) : oe && (i.extend(G2, oe), oe.bounds && (G2.tileBounds = new O2(oe.bounds, G2.minzoom, G2.maxzoom)), i.postTurnstileEvent(oe.tiles), i.postMapLoadEvent(oe.tiles, G2.map._getMapId(), G2.map._requestManager._skuToken), G2.fire(new i.Event("data", { dataType: "source", sourceDataType: "metadata" })), G2.fire(new i.Event("data", { dataType: "source", sourceDataType: "content" })));
              });
            }, U2.prototype.loaded = function() {
              return this._loaded;
            }, U2.prototype.onAdd = function(G2) {
              this.map = G2, this.load();
            }, U2.prototype.onRemove = function() {
              this._tileJSONRequest && (this._tileJSONRequest.cancel(), this._tileJSONRequest = null);
            }, U2.prototype.serialize = function() {
              return i.extend({}, this._options);
            }, U2.prototype.hasTile = function(G2) {
              return !this.tileBounds || this.tileBounds.contains(G2.canonical);
            }, U2.prototype.loadTile = function(G2, J2) {
              var oe = this, de = this.map._requestManager.normalizeTileURL(G2.tileID.canonical.url(this.tiles, this.scheme), this.tileSize);
              G2.request = i.getImage(this.map._requestManager.transformRequest(de, i.ResourceType.Tile), function(ye, Te) {
                if (delete G2.request, G2.aborted) G2.state = "unloaded", J2(null);
                else if (ye) G2.state = "errored", J2(ye);
                else if (Te) {
                  oe.map._refreshExpiredTiles && G2.setExpiryData(Te), delete Te.cacheControl, delete Te.expires;
                  var Fe = oe.map.painter.context, et = Fe.gl;
                  G2.texture = oe.map.painter.getTileTexture(Te.width), G2.texture ? G2.texture.update(Te, { useMipmap: true }) : (G2.texture = new i.Texture(Fe, Te, et.RGBA, { useMipmap: true }), G2.texture.bind(et.LINEAR, et.CLAMP_TO_EDGE, et.LINEAR_MIPMAP_NEAREST), Fe.extTextureFilterAnisotropic && et.texParameterf(et.TEXTURE_2D, Fe.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT, Fe.extTextureFilterAnisotropicMax)), G2.state = "loaded", i.cacheEntryPossiblyAdded(oe.dispatcher), J2(null);
                }
              });
            }, U2.prototype.abortTile = function(G2, J2) {
              G2.request && (G2.request.cancel(), delete G2.request), J2();
            }, U2.prototype.unloadTile = function(G2, J2) {
              G2.texture && this.map.painter.saveTileTexture(G2.texture), J2();
            }, U2.prototype.hasTransition = function() {
              return false;
            }, U2;
          }(i.Evented), W2 = function(P2) {
            function U2(G2, J2, oe, de) {
              P2.call(this, G2, J2, oe, de), this.type = "raster-dem", this.maxzoom = 22, this._options = i.extend({ type: "raster-dem" }, J2), this.encoding = J2.encoding || "mapbox";
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.serialize = function() {
              return { type: "raster-dem", url: this.url, tileSize: this.tileSize, tiles: this.tiles, bounds: this.bounds, encoding: this.encoding };
            }, U2.prototype.loadTile = function(G2, J2) {
              var oe = this.map._requestManager.normalizeTileURL(G2.tileID.canonical.url(this.tiles, this.scheme), this.tileSize);
              function de(ye, Te) {
                ye && (G2.state = "errored", J2(ye)), Te && (G2.dem = Te, G2.needsHillshadePrepare = true, G2.state = "loaded", J2(null));
              }
              G2.request = i.getImage(this.map._requestManager.transformRequest(oe, i.ResourceType.Tile), (function(ye, Te) {
                if (delete G2.request, G2.aborted) G2.state = "unloaded", J2(null);
                else if (ye) G2.state = "errored", J2(ye);
                else if (Te) {
                  this.map._refreshExpiredTiles && G2.setExpiryData(Te), delete Te.cacheControl, delete Te.expires;
                  var Fe = i.window.ImageBitmap && Te instanceof i.window.ImageBitmap && i.offscreenCanvasSupported() ? Te : i.browser.getImageData(Te, 1), et = { uid: G2.uid, coord: G2.tileID, source: this.id, rawImageData: Fe, encoding: this.encoding };
                  G2.actor && G2.state !== "expired" || (G2.actor = this.dispatcher.getActor(), G2.actor.send("loadDEMTile", et, de.bind(this)));
                }
              }).bind(this)), G2.neighboringTiles = this._getNeighboringTiles(G2.tileID);
            }, U2.prototype._getNeighboringTiles = function(G2) {
              var J2 = G2.canonical, oe = Math.pow(2, J2.z), de = (J2.x - 1 + oe) % oe, ye = J2.x === 0 ? G2.wrap - 1 : G2.wrap, Te = (J2.x + 1 + oe) % oe, Fe = J2.x + 1 === oe ? G2.wrap + 1 : G2.wrap, et = {};
              return et[new i.OverscaledTileID(G2.overscaledZ, ye, J2.z, de, J2.y).key] = { backfilled: false }, et[new i.OverscaledTileID(G2.overscaledZ, Fe, J2.z, Te, J2.y).key] = { backfilled: false }, J2.y > 0 && (et[new i.OverscaledTileID(G2.overscaledZ, ye, J2.z, de, J2.y - 1).key] = { backfilled: false }, et[new i.OverscaledTileID(G2.overscaledZ, G2.wrap, J2.z, J2.x, J2.y - 1).key] = { backfilled: false }, et[new i.OverscaledTileID(G2.overscaledZ, Fe, J2.z, Te, J2.y - 1).key] = { backfilled: false }), J2.y + 1 < oe && (et[new i.OverscaledTileID(G2.overscaledZ, ye, J2.z, de, J2.y + 1).key] = { backfilled: false }, et[new i.OverscaledTileID(G2.overscaledZ, G2.wrap, J2.z, J2.x, J2.y + 1).key] = { backfilled: false }, et[new i.OverscaledTileID(G2.overscaledZ, Fe, J2.z, Te, J2.y + 1).key] = { backfilled: false }), et;
            }, U2.prototype.unloadTile = function(G2) {
              G2.demTexture && this.map.painter.saveTileTexture(G2.demTexture), G2.fbo && (G2.fbo.destroy(), delete G2.fbo), G2.dem && delete G2.dem, delete G2.neighboringTiles, G2.state = "unloaded", G2.actor && G2.actor.send("removeDEMTile", { uid: G2.uid, source: this.id });
            }, U2;
          }(V2), X2 = function(P2) {
            function U2(G2, J2, oe, de) {
              P2.call(this), this.id = G2, this.type = "geojson", this.minzoom = 0, this.maxzoom = 18, this.tileSize = 512, this.isTileClipped = true, this.reparseOverscaled = true, this._removed = false, this._loaded = false, this.actor = oe.getActor(), this.setEventedParent(de), this._data = J2.data, this._options = i.extend({}, J2), this._collectResourceTiming = J2.collectResourceTiming, this._resourceTiming = [], J2.maxzoom !== void 0 && (this.maxzoom = J2.maxzoom), J2.type && (this.type = J2.type), J2.attribution && (this.attribution = J2.attribution), this.promoteId = J2.promoteId;
              var ye = i.EXTENT / this.tileSize;
              this.workerOptions = i.extend({ source: this.id, cluster: J2.cluster || false, geojsonVtOptions: { buffer: (J2.buffer !== void 0 ? J2.buffer : 128) * ye, tolerance: (J2.tolerance !== void 0 ? J2.tolerance : 0.375) * ye, extent: i.EXTENT, maxZoom: this.maxzoom, lineMetrics: J2.lineMetrics || false, generateId: J2.generateId || false }, superclusterOptions: { maxZoom: J2.clusterMaxZoom !== void 0 ? Math.min(J2.clusterMaxZoom, this.maxzoom - 1) : this.maxzoom - 1, extent: i.EXTENT, radius: (J2.clusterRadius || 50) * ye, log: false, generateId: J2.generateId || false }, clusterProperties: J2.clusterProperties }, J2.workerOptions);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.load = function() {
              var G2 = this;
              this.fire(new i.Event("dataloading", { dataType: "source" })), this._updateWorkerData(function(J2) {
                if (J2) G2.fire(new i.ErrorEvent(J2));
                else {
                  var oe = { dataType: "source", sourceDataType: "metadata" };
                  G2._collectResourceTiming && G2._resourceTiming && G2._resourceTiming.length > 0 && (oe.resourceTiming = G2._resourceTiming, G2._resourceTiming = []), G2.fire(new i.Event("data", oe));
                }
              });
            }, U2.prototype.onAdd = function(G2) {
              this.map = G2, this.load();
            }, U2.prototype.setData = function(G2) {
              var J2 = this;
              return this._data = G2, this.fire(new i.Event("dataloading", { dataType: "source" })), this._updateWorkerData(function(oe) {
                if (oe) J2.fire(new i.ErrorEvent(oe));
                else {
                  var de = { dataType: "source", sourceDataType: "content" };
                  J2._collectResourceTiming && J2._resourceTiming && J2._resourceTiming.length > 0 && (de.resourceTiming = J2._resourceTiming, J2._resourceTiming = []), J2.fire(new i.Event("data", de));
                }
              }), this;
            }, U2.prototype.getClusterExpansionZoom = function(G2, J2) {
              return this.actor.send("geojson.getClusterExpansionZoom", { clusterId: G2, source: this.id }, J2), this;
            }, U2.prototype.getClusterChildren = function(G2, J2) {
              return this.actor.send("geojson.getClusterChildren", { clusterId: G2, source: this.id }, J2), this;
            }, U2.prototype.getClusterLeaves = function(G2, J2, oe, de) {
              return this.actor.send("geojson.getClusterLeaves", { source: this.id, clusterId: G2, limit: J2, offset: oe }, de), this;
            }, U2.prototype._updateWorkerData = function(G2) {
              var J2 = this;
              this._loaded = false;
              var oe = i.extend({}, this.workerOptions), de = this._data;
              typeof de == "string" ? (oe.request = this.map._requestManager.transformRequest(i.browser.resolveURL(de), i.ResourceType.Source), oe.request.collectResourceTiming = this._collectResourceTiming) : oe.data = JSON.stringify(de), this.actor.send(this.type + ".loadData", oe, function(ye, Te) {
                J2._removed || Te && Te.abandoned || (J2._loaded = true, Te && Te.resourceTiming && Te.resourceTiming[J2.id] && (J2._resourceTiming = Te.resourceTiming[J2.id].slice(0)), J2.actor.send(J2.type + ".coalesce", { source: oe.source }, null), G2(ye));
              });
            }, U2.prototype.loaded = function() {
              return this._loaded;
            }, U2.prototype.loadTile = function(G2, J2) {
              var oe = this, de = G2.actor ? "reloadTile" : "loadTile";
              G2.actor = this.actor;
              var ye = { type: this.type, uid: G2.uid, tileID: G2.tileID, zoom: G2.tileID.overscaledZ, maxZoom: this.maxzoom, tileSize: this.tileSize, source: this.id, pixelRatio: i.browser.devicePixelRatio, showCollisionBoxes: this.map.showCollisionBoxes, promoteId: this.promoteId };
              G2.request = this.actor.send(de, ye, function(Te, Fe) {
                return delete G2.request, G2.unloadVectorData(), G2.aborted ? J2(null) : Te ? J2(Te) : (G2.loadVectorData(Fe, oe.map.painter, de === "reloadTile"), J2(null));
              });
            }, U2.prototype.abortTile = function(G2) {
              G2.request && (G2.request.cancel(), delete G2.request), G2.aborted = true;
            }, U2.prototype.unloadTile = function(G2) {
              G2.unloadVectorData(), this.actor.send("removeTile", { uid: G2.uid, type: this.type, source: this.id });
            }, U2.prototype.onRemove = function() {
              this._removed = true, this.actor.send("removeSource", { type: this.type, source: this.id });
            }, U2.prototype.serialize = function() {
              return i.extend({}, this._options, { type: this.type, data: this._data });
            }, U2.prototype.hasTransition = function() {
              return false;
            }, U2;
          }(i.Evented), Y2 = i.createLayout([{ name: "a_pos", type: "Int16", components: 2 }, { name: "a_texture_pos", type: "Int16", components: 2 }]), K2 = function(P2) {
            function U2(G2, J2, oe, de) {
              P2.call(this), this.id = G2, this.dispatcher = oe, this.coordinates = J2.coordinates, this.type = "image", this.minzoom = 0, this.maxzoom = 22, this.tileSize = 512, this.tiles = {}, this._loaded = false, this.setEventedParent(de), this.options = J2;
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.load = function(G2, J2) {
              var oe = this;
              this._loaded = false, this.fire(new i.Event("dataloading", { dataType: "source" })), this.url = this.options.url, i.getImage(this.map._requestManager.transformRequest(this.url, i.ResourceType.Image), function(de, ye) {
                oe._loaded = true, de ? oe.fire(new i.ErrorEvent(de)) : ye && (oe.image = ye, G2 && (oe.coordinates = G2), J2 && J2(), oe._finishLoading());
              });
            }, U2.prototype.loaded = function() {
              return this._loaded;
            }, U2.prototype.updateImage = function(G2) {
              var J2 = this;
              return this.image && G2.url ? (this.options.url = G2.url, this.load(G2.coordinates, function() {
                J2.texture = null;
              }), this) : this;
            }, U2.prototype._finishLoading = function() {
              this.map && (this.setCoordinates(this.coordinates), this.fire(new i.Event("data", { dataType: "source", sourceDataType: "metadata" })));
            }, U2.prototype.onAdd = function(G2) {
              this.map = G2, this.load();
            }, U2.prototype.setCoordinates = function(G2) {
              var J2 = this;
              this.coordinates = G2;
              var oe = G2.map(i.MercatorCoordinate.fromLngLat);
              this.tileID = function(ye) {
                for (var Te = 1 / 0, Fe = 1 / 0, et = -1 / 0, lt = -1 / 0, bt = 0, It = ye; bt < It.length; bt += 1) {
                  var Rt = It[bt];
                  Te = Math.min(Te, Rt.x), Fe = Math.min(Fe, Rt.y), et = Math.max(et, Rt.x), lt = Math.max(lt, Rt.y);
                }
                var Ft = et - Te, Pt = lt - Fe, Mt = Math.max(Ft, Pt), qt = Math.max(0, Math.floor(-Math.log(Mt) / Math.LN2)), $t = Math.pow(2, qt);
                return new i.CanonicalTileID(qt, Math.floor((Te + et) / 2 * $t), Math.floor((Fe + lt) / 2 * $t));
              }(oe), this.minzoom = this.maxzoom = this.tileID.z;
              var de = oe.map(function(ye) {
                return J2.tileID.getTilePoint(ye)._round();
              });
              return this._boundsArray = new i.StructArrayLayout4i8(), this._boundsArray.emplaceBack(de[0].x, de[0].y, 0, 0), this._boundsArray.emplaceBack(de[1].x, de[1].y, i.EXTENT, 0), this._boundsArray.emplaceBack(de[3].x, de[3].y, 0, i.EXTENT), this._boundsArray.emplaceBack(de[2].x, de[2].y, i.EXTENT, i.EXTENT), this.boundsBuffer && (this.boundsBuffer.destroy(), delete this.boundsBuffer), this.fire(new i.Event("data", { dataType: "source", sourceDataType: "content" })), this;
            }, U2.prototype.prepare = function() {
              if (Object.keys(this.tiles).length !== 0 && this.image) {
                var G2 = this.map.painter.context, J2 = G2.gl;
                for (var oe in this.boundsBuffer || (this.boundsBuffer = G2.createVertexBuffer(this._boundsArray, Y2.members)), this.boundsSegments || (this.boundsSegments = i.SegmentVector.simpleSegment(0, 0, 4, 2)), this.texture || (this.texture = new i.Texture(G2, this.image, J2.RGBA), this.texture.bind(J2.LINEAR, J2.CLAMP_TO_EDGE)), this.tiles) {
                  var de = this.tiles[oe];
                  de.state !== "loaded" && (de.state = "loaded", de.texture = this.texture);
                }
              }
            }, U2.prototype.loadTile = function(G2, J2) {
              this.tileID && this.tileID.equals(G2.tileID.canonical) ? (this.tiles[String(G2.tileID.wrap)] = G2, G2.buckets = {}, J2(null)) : (G2.state = "errored", J2(null));
            }, U2.prototype.serialize = function() {
              return { type: "image", url: this.options.url, coordinates: this.coordinates };
            }, U2.prototype.hasTransition = function() {
              return false;
            }, U2;
          }(i.Evented), q = function(P2) {
            function U2(G2, J2, oe, de) {
              P2.call(this, G2, J2, oe, de), this.roundZoom = true, this.type = "video", this.options = J2;
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.load = function() {
              var G2 = this;
              this._loaded = false;
              var J2 = this.options;
              this.urls = [];
              for (var oe = 0, de = J2.urls; oe < de.length; oe += 1) {
                var ye = de[oe];
                this.urls.push(this.map._requestManager.transformRequest(ye, i.ResourceType.Source).url);
              }
              i.getVideo(this.urls, function(Te, Fe) {
                G2._loaded = true, Te ? G2.fire(new i.ErrorEvent(Te)) : Fe && (G2.video = Fe, G2.video.loop = true, G2.video.addEventListener("playing", function() {
                  G2.map.triggerRepaint();
                }), G2.map && G2.video.play(), G2._finishLoading());
              });
            }, U2.prototype.pause = function() {
              this.video && this.video.pause();
            }, U2.prototype.play = function() {
              this.video && this.video.play();
            }, U2.prototype.seek = function(G2) {
              if (this.video) {
                var J2 = this.video.seekable;
                G2 < J2.start(0) || G2 > J2.end(0) ? this.fire(new i.ErrorEvent(new i.ValidationError("sources." + this.id, null, "Playback for this video can be set only between the " + J2.start(0) + " and " + J2.end(0) + "-second mark."))) : this.video.currentTime = G2;
              }
            }, U2.prototype.getVideo = function() {
              return this.video;
            }, U2.prototype.onAdd = function(G2) {
              this.map || (this.map = G2, this.load(), this.video && (this.video.play(), this.setCoordinates(this.coordinates)));
            }, U2.prototype.prepare = function() {
              if (!(Object.keys(this.tiles).length === 0 || this.video.readyState < 2)) {
                var G2 = this.map.painter.context, J2 = G2.gl;
                for (var oe in this.boundsBuffer || (this.boundsBuffer = G2.createVertexBuffer(this._boundsArray, Y2.members)), this.boundsSegments || (this.boundsSegments = i.SegmentVector.simpleSegment(0, 0, 4, 2)), this.texture ? this.video.paused || (this.texture.bind(J2.LINEAR, J2.CLAMP_TO_EDGE), J2.texSubImage2D(J2.TEXTURE_2D, 0, 0, 0, J2.RGBA, J2.UNSIGNED_BYTE, this.video)) : (this.texture = new i.Texture(G2, this.video, J2.RGBA), this.texture.bind(J2.LINEAR, J2.CLAMP_TO_EDGE)), this.tiles) {
                  var de = this.tiles[oe];
                  de.state !== "loaded" && (de.state = "loaded", de.texture = this.texture);
                }
              }
            }, U2.prototype.serialize = function() {
              return { type: "video", urls: this.urls, coordinates: this.coordinates };
            }, U2.prototype.hasTransition = function() {
              return this.video && !this.video.paused;
            }, U2;
          }(K2), re = function(P2) {
            function U2(G2, J2, oe, de) {
              P2.call(this, G2, J2, oe, de), J2.coordinates ? Array.isArray(J2.coordinates) && J2.coordinates.length === 4 && !J2.coordinates.some(function(ye) {
                return !Array.isArray(ye) || ye.length !== 2 || ye.some(function(Te) {
                  return typeof Te != "number";
                });
              }) || this.fire(new i.ErrorEvent(new i.ValidationError("sources." + G2, null, '"coordinates" property must be an array of 4 longitude/latitude array pairs'))) : this.fire(new i.ErrorEvent(new i.ValidationError("sources." + G2, null, 'missing required property "coordinates"'))), J2.animate && typeof J2.animate != "boolean" && this.fire(new i.ErrorEvent(new i.ValidationError("sources." + G2, null, 'optional "animate" property must be a boolean value'))), J2.canvas ? typeof J2.canvas == "string" || J2.canvas instanceof i.window.HTMLCanvasElement || this.fire(new i.ErrorEvent(new i.ValidationError("sources." + G2, 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 i.ErrorEvent(new i.ValidationError("sources." + G2, null, 'missing required property "canvas"'))), this.options = J2, this.animate = J2.animate === void 0 || J2.animate;
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.load = function() {
              this._loaded = true, this.canvas || (this.canvas = this.options.canvas instanceof i.window.HTMLCanvasElement ? this.options.canvas : i.window.document.getElementById(this.options.canvas)), this.width = this.canvas.width, this.height = this.canvas.height, this._hasInvalidDimensions() ? this.fire(new i.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))) : (this.play = function() {
                this._playing = true, this.map.triggerRepaint();
              }, this.pause = function() {
                this._playing && (this.prepare(), this._playing = false);
              }, this._finishLoading());
            }, U2.prototype.getCanvas = function() {
              return this.canvas;
            }, U2.prototype.onAdd = function(G2) {
              this.map = G2, this.load(), this.canvas && this.animate && this.play();
            }, U2.prototype.onRemove = function() {
              this.pause();
            }, U2.prototype.prepare = function() {
              var G2 = false;
              if (this.canvas.width !== this.width && (this.width = this.canvas.width, G2 = true), this.canvas.height !== this.height && (this.height = this.canvas.height, G2 = true), !this._hasInvalidDimensions() && Object.keys(this.tiles).length !== 0) {
                var J2 = this.map.painter.context, oe = J2.gl;
                for (var de in this.boundsBuffer || (this.boundsBuffer = J2.createVertexBuffer(this._boundsArray, Y2.members)), this.boundsSegments || (this.boundsSegments = i.SegmentVector.simpleSegment(0, 0, 4, 2)), this.texture ? (G2 || this._playing) && this.texture.update(this.canvas, { premultiply: true }) : this.texture = new i.Texture(J2, this.canvas, oe.RGBA, { premultiply: true }), this.tiles) {
                  var ye = this.tiles[de];
                  ye.state !== "loaded" && (ye.state = "loaded", ye.texture = this.texture);
                }
              }
            }, U2.prototype.serialize = function() {
              return { type: "canvas", coordinates: this.coordinates };
            }, U2.prototype.hasTransition = function() {
              return this._playing;
            }, U2.prototype._hasInvalidDimensions = function() {
              for (var G2 = 0, J2 = [this.canvas.width, this.canvas.height]; G2 < J2.length; G2 += 1) {
                var oe = J2[G2];
                if (isNaN(oe) || oe <= 0) return true;
              }
              return false;
            }, U2;
          }(K2), R2 = { vector: L2, raster: V2, "raster-dem": W2, geojson: X2, video: q, image: K2, canvas: re };
          function z(P2, U2) {
            var G2 = i.identity([]);
            return i.translate(G2, G2, [1, 1, 0]), i.scale(G2, G2, [0.5 * P2.width, 0.5 * P2.height, 1]), i.multiply(G2, G2, P2.calculatePosMatrix(U2.toUnwrapped()));
          }
          function H2(P2, U2, G2, J2, oe, de) {
            var ye = function(Pt, Mt, qt) {
              if (Pt) for (var $t = 0, Yt = Pt; $t < Yt.length; $t += 1) {
                var cr = Mt[Yt[$t]];
                if (cr && cr.source === qt && cr.type === "fill-extrusion") return true;
              }
              else for (var kr in Mt) {
                var Pr = Mt[kr];
                if (Pr.source === qt && Pr.type === "fill-extrusion") return true;
              }
              return false;
            }(oe && oe.layers, U2, P2.id), Te = de.maxPitchScaleFactor(), Fe = P2.tilesIn(J2, Te, ye);
            Fe.sort(te);
            for (var et = [], lt = 0, bt = Fe; lt < bt.length; lt += 1) {
              var It = bt[lt];
              et.push({ wrappedTileID: It.tileID.wrapped().key, queryResults: It.tile.queryRenderedFeatures(U2, G2, P2._state, It.queryGeometry, It.cameraQueryGeometry, It.scale, oe, de, Te, z(P2.transform, It.tileID)) });
            }
            var Rt = function(Pt) {
              for (var Mt = {}, qt = {}, $t = 0, Yt = Pt; $t < Yt.length; $t += 1) {
                var cr = Yt[$t], kr = cr.queryResults, Pr = cr.wrappedTileID, Or = qt[Pr] = qt[Pr] || {};
                for (var xn in kr) for (var yn = kr[xn], Nn = Or[xn] = Or[xn] || {}, An = Mt[xn] = Mt[xn] || [], ma = 0, Aa = yn; ma < Aa.length; ma += 1) {
                  var Qa = Aa[ma];
                  Nn[Qa.featureIndex] || (Nn[Qa.featureIndex] = true, An.push(Qa));
                }
              }
              return Mt;
            }(et);
            for (var Ft in Rt) Rt[Ft].forEach(function(Pt) {
              var Mt = Pt.feature, qt = P2.getFeatureState(Mt.layer["source-layer"], Mt.id);
              Mt.source = Mt.layer.source, Mt.layer["source-layer"] && (Mt.sourceLayer = Mt.layer["source-layer"]), Mt.state = qt;
            });
            return Rt;
          }
          function te(P2, U2) {
            var G2 = P2.tileID, J2 = U2.tileID;
            return G2.overscaledZ - J2.overscaledZ || G2.canonical.y - J2.canonical.y || G2.wrap - J2.wrap || G2.canonical.x - J2.canonical.x;
          }
          var j = function(P2, U2) {
            this.max = P2, this.onRemove = U2, this.reset();
          };
          j.prototype.reset = function() {
            for (var P2 in this.data) for (var U2 = 0, G2 = this.data[P2]; U2 < G2.length; U2 += 1) {
              var J2 = G2[U2];
              J2.timeout && clearTimeout(J2.timeout), this.onRemove(J2.value);
            }
            return this.data = {}, this.order = [], this;
          }, j.prototype.add = function(P2, U2, G2) {
            var J2 = this, oe = P2.wrapped().key;
            this.data[oe] === void 0 && (this.data[oe] = []);
            var de = { value: U2, timeout: void 0 };
            if (G2 !== void 0 && (de.timeout = setTimeout(function() {
              J2.remove(P2, de);
            }, G2)), this.data[oe].push(de), this.order.push(oe), this.order.length > this.max) {
              var ye = this._getAndRemoveByKey(this.order[0]);
              ye && this.onRemove(ye);
            }
            return this;
          }, j.prototype.has = function(P2) {
            return P2.wrapped().key in this.data;
          }, j.prototype.getAndRemove = function(P2) {
            return this.has(P2) ? this._getAndRemoveByKey(P2.wrapped().key) : null;
          }, j.prototype._getAndRemoveByKey = function(P2) {
            var U2 = this.data[P2].shift();
            return U2.timeout && clearTimeout(U2.timeout), this.data[P2].length === 0 && delete this.data[P2], this.order.splice(this.order.indexOf(P2), 1), U2.value;
          }, j.prototype.getByKey = function(P2) {
            var U2 = this.data[P2];
            return U2 ? U2[0].value : null;
          }, j.prototype.get = function(P2) {
            return this.has(P2) ? this.data[P2.wrapped().key][0].value : null;
          }, j.prototype.remove = function(P2, U2) {
            if (!this.has(P2)) return this;
            var G2 = P2.wrapped().key, J2 = U2 === void 0 ? 0 : this.data[G2].indexOf(U2), oe = this.data[G2][J2];
            return this.data[G2].splice(J2, 1), oe.timeout && clearTimeout(oe.timeout), this.data[G2].length === 0 && delete this.data[G2], this.onRemove(oe.value), this.order.splice(this.order.indexOf(G2), 1), this;
          }, j.prototype.setMaxSize = function(P2) {
            for (this.max = P2; this.order.length > this.max; ) {
              var U2 = this._getAndRemoveByKey(this.order[0]);
              U2 && this.onRemove(U2);
            }
            return this;
          }, j.prototype.filter = function(P2) {
            var U2 = [];
            for (var G2 in this.data) for (var J2 = 0, oe = this.data[G2]; J2 < oe.length; J2 += 1) {
              var de = oe[J2];
              P2(de.value) || U2.push(de);
            }
            for (var ye = 0, Te = U2; ye < Te.length; ye += 1) {
              var Fe = Te[ye];
              this.remove(Fe.value.tileID, Fe);
            }
          };
          var Q2 = function(P2, U2, G2) {
            this.context = P2;
            var J2 = P2.gl;
            this.buffer = J2.createBuffer(), this.dynamicDraw = Boolean(G2), this.context.unbindVAO(), P2.bindElementBuffer.set(this.buffer), J2.bufferData(J2.ELEMENT_ARRAY_BUFFER, U2.arrayBuffer, this.dynamicDraw ? J2.DYNAMIC_DRAW : J2.STATIC_DRAW), this.dynamicDraw || delete U2.arrayBuffer;
          };
          Q2.prototype.bind = function() {
            this.context.bindElementBuffer.set(this.buffer);
          }, Q2.prototype.updateData = function(P2) {
            var U2 = this.context.gl;
            this.context.unbindVAO(), this.bind(), U2.bufferSubData(U2.ELEMENT_ARRAY_BUFFER, 0, P2.arrayBuffer);
          }, Q2.prototype.destroy = function() {
            var P2 = this.context.gl;
            this.buffer && (P2.deleteBuffer(this.buffer), delete this.buffer);
          };
          var Z2 = { Int8: "BYTE", Uint8: "UNSIGNED_BYTE", Int16: "SHORT", Uint16: "UNSIGNED_SHORT", Int32: "INT", Uint32: "UNSIGNED_INT", Float32: "FLOAT" }, ne = function(P2, U2, G2, J2) {
            this.length = U2.length, this.attributes = G2, this.itemSize = U2.bytesPerElement, this.dynamicDraw = J2, this.context = P2;
            var oe = P2.gl;
            this.buffer = oe.createBuffer(), P2.bindVertexBuffer.set(this.buffer), oe.bufferData(oe.ARRAY_BUFFER, U2.arrayBuffer, this.dynamicDraw ? oe.DYNAMIC_DRAW : oe.STATIC_DRAW), this.dynamicDraw || delete U2.arrayBuffer;
          };
          ne.prototype.bind = function() {
            this.context.bindVertexBuffer.set(this.buffer);
          }, ne.prototype.updateData = function(P2) {
            var U2 = this.context.gl;
            this.bind(), U2.bufferSubData(U2.ARRAY_BUFFER, 0, P2.arrayBuffer);
          }, ne.prototype.enableAttributes = function(P2, U2) {
            for (var G2 = 0; G2 < this.attributes.length; G2++) {
              var J2 = this.attributes[G2], oe = U2.attributes[J2.name];
              oe !== void 0 && P2.enableVertexAttribArray(oe);
            }
          }, ne.prototype.setVertexAttribPointers = function(P2, U2, G2) {
            for (var J2 = 0; J2 < this.attributes.length; J2++) {
              var oe = this.attributes[J2], de = U2.attributes[oe.name];
              de !== void 0 && P2.vertexAttribPointer(de, oe.components, P2[Z2[oe.type]], false, this.itemSize, oe.offset + this.itemSize * (G2 || 0));
            }
          }, ne.prototype.destroy = function() {
            var P2 = this.context.gl;
            this.buffer && (P2.deleteBuffer(this.buffer), delete this.buffer);
          };
          var ae = function(P2) {
            this.gl = P2.gl, this.default = this.getDefault(), this.current = this.default, this.dirty = false;
          };
          ae.prototype.get = function() {
            return this.current;
          }, ae.prototype.set = function(P2) {
          }, ae.prototype.getDefault = function() {
            return this.default;
          }, ae.prototype.setDefault = function() {
            this.set(this.default);
          };
          var ue = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.getDefault = function() {
              return i.Color.transparent;
            }, U2.prototype.set = function(G2) {
              var J2 = this.current;
              (G2.r !== J2.r || G2.g !== J2.g || G2.b !== J2.b || G2.a !== J2.a || this.dirty) && (this.gl.clearColor(G2.r, G2.g, G2.b, G2.a), this.current = G2, this.dirty = false);
            }, U2;
          }(ae), le = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.getDefault = function() {
              return 1;
            }, U2.prototype.set = function(G2) {
              (G2 !== this.current || this.dirty) && (this.gl.clearDepth(G2), this.current = G2, this.dirty = false);
            }, U2;
          }(ae), ce = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.getDefault = function() {
              return 0;
            }, U2.prototype.set = function(G2) {
              (G2 !== this.current || this.dirty) && (this.gl.clearStencil(G2), this.current = G2, this.dirty = false);
            }, U2;
          }(ae), se = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.getDefault = function() {
              return [true, true, true, true];
            }, U2.prototype.set = function(G2) {
              var J2 = this.current;
              (G2[0] !== J2[0] || G2[1] !== J2[1] || G2[2] !== J2[2] || G2[3] !== J2[3] || this.dirty) && (this.gl.colorMask(G2[0], G2[1], G2[2], G2[3]), this.current = G2, this.dirty = false);
            }, U2;
          }(ae), he = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.getDefault = function() {
              return true;
            }, U2.prototype.set = function(G2) {
              (G2 !== this.current || this.dirty) && (this.gl.depthMask(G2), this.current = G2, this.dirty = false);
            }, U2;
          }(ae), me = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.getDefault = function() {
              return 255;
            }, U2.prototype.set = function(G2) {
              (G2 !== this.current || this.dirty) && (this.gl.stencilMask(G2), this.current = G2, this.dirty = false);
            }, U2;
          }(ae), we = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.getDefault = function() {
              return { func: this.gl.ALWAYS, ref: 0, mask: 255 };
            }, U2.prototype.set = function(G2) {
              var J2 = this.current;
              (G2.func !== J2.func || G2.ref !== J2.ref || G2.mask !== J2.mask || this.dirty) && (this.gl.stencilFunc(G2.func, G2.ref, G2.mask), this.current = G2, this.dirty = false);
            }, U2;
          }(ae), be = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.getDefault = function() {
              var G2 = this.gl;
              return [G2.KEEP, G2.KEEP, G2.KEEP];
            }, U2.prototype.set = function(G2) {
              var J2 = this.current;
              (G2[0] !== J2[0] || G2[1] !== J2[1] || G2[2] !== J2[2] || this.dirty) && (this.gl.stencilOp(G2[0], G2[1], G2[2]), this.current = G2, this.dirty = false);
            }, U2;
          }(ae), Ae = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.getDefault = function() {
              return false;
            }, U2.prototype.set = function(G2) {
              if (G2 !== this.current || this.dirty) {
                var J2 = this.gl;
                G2 ? J2.enable(J2.STENCIL_TEST) : J2.disable(J2.STENCIL_TEST), this.current = G2, this.dirty = false;
              }
            }, U2;
          }(ae), pe = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.getDefault = function() {
              return [0, 1];
            }, U2.prototype.set = function(G2) {
              var J2 = this.current;
              (G2[0] !== J2[0] || G2[1] !== J2[1] || this.dirty) && (this.gl.depthRange(G2[0], G2[1]), this.current = G2, this.dirty = false);
            }, U2;
          }(ae), ve = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.getDefault = function() {
              return false;
            }, U2.prototype.set = function(G2) {
              if (G2 !== this.current || this.dirty) {
                var J2 = this.gl;
                G2 ? J2.enable(J2.DEPTH_TEST) : J2.disable(J2.DEPTH_TEST), this.current = G2, this.dirty = false;
              }
            }, U2;
          }(ae), Ee = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.getDefault = function() {
              return this.gl.LESS;
            }, U2.prototype.set = function(G2) {
              (G2 !== this.current || this.dirty) && (this.gl.depthFunc(G2), this.current = G2, this.dirty = false);
            }, U2;
          }(ae), Se = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.getDefault = function() {
              return false;
            }, U2.prototype.set = function(G2) {
              if (G2 !== this.current || this.dirty) {
                var J2 = this.gl;
                G2 ? J2.enable(J2.BLEND) : J2.disable(J2.BLEND), this.current = G2, this.dirty = false;
              }
            }, U2;
          }(ae), Ce = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.getDefault = function() {
              var G2 = this.gl;
              return [G2.ONE, G2.ZERO];
            }, U2.prototype.set = function(G2) {
              var J2 = this.current;
              (G2[0] !== J2[0] || G2[1] !== J2[1] || this.dirty) && (this.gl.blendFunc(G2[0], G2[1]), this.current = G2, this.dirty = false);
            }, U2;
          }(ae), Be = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.getDefault = function() {
              return i.Color.transparent;
            }, U2.prototype.set = function(G2) {
              var J2 = this.current;
              (G2.r !== J2.r || G2.g !== J2.g || G2.b !== J2.b || G2.a !== J2.a || this.dirty) && (this.gl.blendColor(G2.r, G2.g, G2.b, G2.a), this.current = G2, this.dirty = false);
            }, U2;
          }(ae), Ue = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.getDefault = function() {
              return this.gl.FUNC_ADD;
            }, U2.prototype.set = function(G2) {
              (G2 !== this.current || this.dirty) && (this.gl.blendEquation(G2), this.current = G2, this.dirty = false);
            }, U2;
          }(ae), Ke = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.getDefault = function() {
              return false;
            }, U2.prototype.set = function(G2) {
              if (G2 !== this.current || this.dirty) {
                var J2 = this.gl;
                G2 ? J2.enable(J2.CULL_FACE) : J2.disable(J2.CULL_FACE), this.current = G2, this.dirty = false;
              }
            }, U2;
          }(ae), ct = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.getDefault = function() {
              return this.gl.BACK;
            }, U2.prototype.set = function(G2) {
              (G2 !== this.current || this.dirty) && (this.gl.cullFace(G2), this.current = G2, this.dirty = false);
            }, U2;
          }(ae), We = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.getDefault = function() {
              return this.gl.CCW;
            }, U2.prototype.set = function(G2) {
              (G2 !== this.current || this.dirty) && (this.gl.frontFace(G2), this.current = G2, this.dirty = false);
            }, U2;
          }(ae), Ze = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.getDefault = function() {
              return null;
            }, U2.prototype.set = function(G2) {
              (G2 !== this.current || this.dirty) && (this.gl.useProgram(G2), this.current = G2, this.dirty = false);
            }, U2;
          }(ae), it = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.getDefault = function() {
              return this.gl.TEXTURE0;
            }, U2.prototype.set = function(G2) {
              (G2 !== this.current || this.dirty) && (this.gl.activeTexture(G2), this.current = G2, this.dirty = false);
            }, U2;
          }(ae), ot = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.getDefault = function() {
              var G2 = this.gl;
              return [0, 0, G2.drawingBufferWidth, G2.drawingBufferHeight];
            }, U2.prototype.set = function(G2) {
              var J2 = this.current;
              (G2[0] !== J2[0] || G2[1] !== J2[1] || G2[2] !== J2[2] || G2[3] !== J2[3] || this.dirty) && (this.gl.viewport(G2[0], G2[1], G2[2], G2[3]), this.current = G2, this.dirty = false);
            }, U2;
          }(ae), mt = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.getDefault = function() {
              return null;
            }, U2.prototype.set = function(G2) {
              if (G2 !== this.current || this.dirty) {
                var J2 = this.gl;
                J2.bindFramebuffer(J2.FRAMEBUFFER, G2), this.current = G2, this.dirty = false;
              }
            }, U2;
          }(ae), wt = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.getDefault = function() {
              return null;
            }, U2.prototype.set = function(G2) {
              if (G2 !== this.current || this.dirty) {
                var J2 = this.gl;
                J2.bindRenderbuffer(J2.RENDERBUFFER, G2), this.current = G2, this.dirty = false;
              }
            }, U2;
          }(ae), Et = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.getDefault = function() {
              return null;
            }, U2.prototype.set = function(G2) {
              if (G2 !== this.current || this.dirty) {
                var J2 = this.gl;
                J2.bindTexture(J2.TEXTURE_2D, G2), this.current = G2, this.dirty = false;
              }
            }, U2;
          }(ae), zt = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.getDefault = function() {
              return null;
            }, U2.prototype.set = function(G2) {
              if (G2 !== this.current || this.dirty) {
                var J2 = this.gl;
                J2.bindBuffer(J2.ARRAY_BUFFER, G2), this.current = G2, this.dirty = false;
              }
            }, U2;
          }(ae), Nt = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.getDefault = function() {
              return null;
            }, U2.prototype.set = function(G2) {
              var J2 = this.gl;
              J2.bindBuffer(J2.ELEMENT_ARRAY_BUFFER, G2), this.current = G2, this.dirty = false;
            }, U2;
          }(ae), yt = function(P2) {
            function U2(G2) {
              P2.call(this, G2), this.vao = G2.extVertexArrayObject;
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.getDefault = function() {
              return null;
            }, U2.prototype.set = function(G2) {
              this.vao && (G2 !== this.current || this.dirty) && (this.vao.bindVertexArrayOES(G2), this.current = G2, this.dirty = false);
            }, U2;
          }(ae), pt = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.getDefault = function() {
              return 4;
            }, U2.prototype.set = function(G2) {
              if (G2 !== this.current || this.dirty) {
                var J2 = this.gl;
                J2.pixelStorei(J2.UNPACK_ALIGNMENT, G2), this.current = G2, this.dirty = false;
              }
            }, U2;
          }(ae), Ot = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.getDefault = function() {
              return false;
            }, U2.prototype.set = function(G2) {
              if (G2 !== this.current || this.dirty) {
                var J2 = this.gl;
                J2.pixelStorei(J2.UNPACK_PREMULTIPLY_ALPHA_WEBGL, G2), this.current = G2, this.dirty = false;
              }
            }, U2;
          }(ae), Jt = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.getDefault = function() {
              return false;
            }, U2.prototype.set = function(G2) {
              if (G2 !== this.current || this.dirty) {
                var J2 = this.gl;
                J2.pixelStorei(J2.UNPACK_FLIP_Y_WEBGL, G2), this.current = G2, this.dirty = false;
              }
            }, U2;
          }(ae), tr = function(P2) {
            function U2(G2, J2) {
              P2.call(this, G2), this.context = G2, this.parent = J2;
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.getDefault = function() {
              return null;
            }, U2;
          }(ae), Ye = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.setDirty = function() {
              this.dirty = true;
            }, U2.prototype.set = function(G2) {
              if (G2 !== this.current || this.dirty) {
                this.context.bindFramebuffer.set(this.parent);
                var J2 = this.gl;
                J2.framebufferTexture2D(J2.FRAMEBUFFER, J2.COLOR_ATTACHMENT0, J2.TEXTURE_2D, G2, 0), this.current = G2, this.dirty = false;
              }
            }, U2;
          }(tr), at = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.set = function(G2) {
              if (G2 !== this.current || this.dirty) {
                this.context.bindFramebuffer.set(this.parent);
                var J2 = this.gl;
                J2.framebufferRenderbuffer(J2.FRAMEBUFFER, J2.DEPTH_ATTACHMENT, J2.RENDERBUFFER, G2), this.current = G2, this.dirty = false;
              }
            }, U2;
          }(tr), Ge = function(P2, U2, G2, J2) {
            this.context = P2, this.width = U2, this.height = G2;
            var oe = P2.gl, de = this.framebuffer = oe.createFramebuffer();
            this.colorAttachment = new Ye(P2, de), J2 && (this.depthAttachment = new at(P2, de));
          };
          Ge.prototype.destroy = function() {
            var P2 = this.context.gl, U2 = this.colorAttachment.get();
            if (U2 && P2.deleteTexture(U2), this.depthAttachment) {
              var G2 = this.depthAttachment.get();
              G2 && P2.deleteRenderbuffer(G2);
            }
            P2.deleteFramebuffer(this.framebuffer);
          };
          var st = function(P2, U2, G2) {
            this.func = P2, this.mask = U2, this.range = G2;
          };
          st.ReadOnly = false, st.ReadWrite = true, st.disabled = new st(519, st.ReadOnly, [0, 1]);
          var Ie = function(P2, U2, G2, J2, oe, de) {
            this.test = P2, this.ref = U2, this.mask = G2, this.fail = J2, this.depthFail = oe, this.pass = de;
          };
          Ie.disabled = new Ie({ func: 519, mask: 0 }, 0, 0, 7680, 7680, 7680);
          var Pe = function(P2, U2, G2) {
            this.blendFunction = P2, this.blendColor = U2, this.mask = G2;
          };
          Pe.disabled = new Pe(Pe.Replace = [1, 0], i.Color.transparent, [false, false, false, false]), Pe.unblended = new Pe(Pe.Replace, i.Color.transparent, [true, true, true, true]), Pe.alphaBlended = new Pe([1, 771], i.Color.transparent, [true, true, true, true]);
          var $e = function(P2, U2, G2) {
            this.enable = P2, this.mode = U2, this.frontFace = G2;
          };
          $e.disabled = new $e(false, 1029, 2305), $e.backCCW = new $e(true, 1029, 2305);
          var Ve = function(P2) {
            this.gl = P2, this.extVertexArrayObject = this.gl.getExtension("OES_vertex_array_object"), this.clearColor = new ue(this), this.clearDepth = new le(this), this.clearStencil = new ce(this), this.colorMask = new se(this), this.depthMask = new he(this), this.stencilMask = new me(this), this.stencilFunc = new we(this), this.stencilOp = new be(this), this.stencilTest = new Ae(this), this.depthRange = new pe(this), this.depthTest = new ve(this), this.depthFunc = new Ee(this), this.blend = new Se(this), this.blendFunc = new Ce(this), this.blendColor = new Be(this), this.blendEquation = new Ue(this), this.cullFace = new Ke(this), this.cullFaceSide = new ct(this), this.frontFace = new We(this), this.program = new Ze(this), this.activeTexture = new it(this), this.viewport = new ot(this), this.bindFramebuffer = new mt(this), this.bindRenderbuffer = new wt(this), this.bindTexture = new Et(this), this.bindVertexBuffer = new zt(this), this.bindElementBuffer = new Nt(this), this.bindVertexArrayOES = this.extVertexArrayObject && new yt(this), this.pixelStoreUnpack = new pt(this), this.pixelStoreUnpackPremultiplyAlpha = new Ot(this), this.pixelStoreUnpackFlipY = new Jt(this), this.extTextureFilterAnisotropic = P2.getExtension("EXT_texture_filter_anisotropic") || P2.getExtension("MOZ_EXT_texture_filter_anisotropic") || P2.getExtension("WEBKIT_EXT_texture_filter_anisotropic"), this.extTextureFilterAnisotropic && (this.extTextureFilterAnisotropicMax = P2.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)), this.extTextureHalfFloat = P2.getExtension("OES_texture_half_float"), this.extTextureHalfFloat && (P2.getExtension("OES_texture_half_float_linear"), this.extRenderToTextureHalfFloat = P2.getExtension("EXT_color_buffer_half_float")), this.extTimerQuery = P2.getExtension("EXT_disjoint_timer_query");
          };
          Ve.prototype.setDefault = function() {
            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();
          }, Ve.prototype.setDirty = function() {
            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.extVertexArrayObject && (this.bindVertexArrayOES.dirty = true), this.pixelStoreUnpack.dirty = true, this.pixelStoreUnpackPremultiplyAlpha.dirty = true, this.pixelStoreUnpackFlipY.dirty = true;
          }, Ve.prototype.createIndexBuffer = function(P2, U2) {
            return new Q2(this, P2, U2);
          }, Ve.prototype.createVertexBuffer = function(P2, U2, G2) {
            return new ne(this, P2, U2, G2);
          }, Ve.prototype.createRenderbuffer = function(P2, U2, G2) {
            var J2 = this.gl, oe = J2.createRenderbuffer();
            return this.bindRenderbuffer.set(oe), J2.renderbufferStorage(J2.RENDERBUFFER, P2, U2, G2), this.bindRenderbuffer.set(null), oe;
          }, Ve.prototype.createFramebuffer = function(P2, U2, G2) {
            return new Ge(this, P2, U2, G2);
          }, Ve.prototype.clear = function(P2) {
            var U2 = P2.color, G2 = P2.depth, J2 = this.gl, oe = 0;
            U2 && (oe |= J2.COLOR_BUFFER_BIT, this.clearColor.set(U2), this.colorMask.set([true, true, true, true])), G2 !== void 0 && (oe |= J2.DEPTH_BUFFER_BIT, this.depthRange.set([0, 1]), this.clearDepth.set(G2), this.depthMask.set(true)), J2.clear(oe);
          }, Ve.prototype.setCullFace = function(P2) {
            P2.enable === false ? this.cullFace.set(false) : (this.cullFace.set(true), this.cullFaceSide.set(P2.mode), this.frontFace.set(P2.frontFace));
          }, Ve.prototype.setDepthMode = function(P2) {
            P2.func !== this.gl.ALWAYS || P2.mask ? (this.depthTest.set(true), this.depthFunc.set(P2.func), this.depthMask.set(P2.mask), this.depthRange.set(P2.range)) : this.depthTest.set(false);
          }, Ve.prototype.setStencilMode = function(P2) {
            P2.test.func !== this.gl.ALWAYS || P2.mask ? (this.stencilTest.set(true), this.stencilMask.set(P2.mask), this.stencilOp.set([P2.fail, P2.depthFail, P2.pass]), this.stencilFunc.set({ func: P2.test.func, ref: P2.ref, mask: P2.test.mask })) : this.stencilTest.set(false);
          }, Ve.prototype.setColorMode = function(P2) {
            i.deepEqual(P2.blendFunction, Pe.Replace) ? this.blend.set(false) : (this.blend.set(true), this.blendFunc.set(P2.blendFunction), this.blendColor.set(P2.blendColor)), this.colorMask.set(P2.mask);
          }, Ve.prototype.unbindVAO = function() {
            this.extVertexArrayObject && this.bindVertexArrayOES.set(null);
          };
          var ut = function(P2) {
            function U2(G2, J2, oe) {
              var de = this;
              P2.call(this), this.id = G2, this.dispatcher = oe, this.on("data", function(ye) {
                ye.dataType === "source" && ye.sourceDataType === "metadata" && (de._sourceLoaded = true), de._sourceLoaded && !de._paused && ye.dataType === "source" && ye.sourceDataType === "content" && (de.reload(), de.transform && de.update(de.transform));
              }), this.on("error", function() {
                de._sourceErrored = true;
              }), this._source = function(ye, Te, Fe, et) {
                var lt = new R2[Te.type](ye, Te, Fe, et);
                if (lt.id !== ye) throw new Error("Expected Source id to be " + ye + " instead of " + lt.id);
                return i.bindAll(["load", "abort", "unload", "serialize", "prepare"], lt), lt;
              }(G2, J2, oe, this), this._tiles = {}, this._cache = new j(0, this._unloadTile.bind(this)), this._timers = {}, this._cacheTimers = {}, this._maxTileCacheSize = null, this._loadedParentTiles = {}, this._coveredTiles = {}, this._state = new i.SourceFeatureState();
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.onAdd = function(G2) {
              this.map = G2, this._maxTileCacheSize = G2 ? G2._maxTileCacheSize : null, this._source && this._source.onAdd && this._source.onAdd(G2);
            }, U2.prototype.onRemove = function(G2) {
              this._source && this._source.onRemove && this._source.onRemove(G2);
            }, U2.prototype.loaded = function() {
              if (this._sourceErrored) return true;
              if (!this._sourceLoaded || !this._source.loaded()) return false;
              for (var G2 in this._tiles) {
                var J2 = this._tiles[G2];
                if (J2.state !== "loaded" && J2.state !== "errored") return false;
              }
              return true;
            }, U2.prototype.getSource = function() {
              return this._source;
            }, U2.prototype.pause = function() {
              this._paused = true;
            }, U2.prototype.resume = function() {
              if (this._paused) {
                var G2 = this._shouldReloadOnResume;
                this._paused = false, this._shouldReloadOnResume = false, G2 && this.reload(), this.transform && this.update(this.transform);
              }
            }, U2.prototype._loadTile = function(G2, J2) {
              return this._source.loadTile(G2, J2);
            }, U2.prototype._unloadTile = function(G2) {
              if (this._source.unloadTile) return this._source.unloadTile(G2, function() {
              });
            }, U2.prototype._abortTile = function(G2) {
              if (this._source.abortTile) return this._source.abortTile(G2, function() {
              });
            }, U2.prototype.serialize = function() {
              return this._source.serialize();
            }, U2.prototype.prepare = function(G2) {
              for (var J2 in this._source.prepare && this._source.prepare(), this._state.coalesceChanges(this._tiles, this.map ? this.map.painter : null), this._tiles) {
                var oe = this._tiles[J2];
                oe.upload(G2), oe.prepare(this.map.style.imageManager);
              }
            }, U2.prototype.getIds = function() {
              return i.values(this._tiles).map(function(G2) {
                return G2.tileID;
              }).sort(Re).map(function(G2) {
                return G2.key;
              });
            }, U2.prototype.getRenderableIds = function(G2) {
              var J2 = this, oe = [];
              for (var de in this._tiles) this._isIdRenderable(de, G2) && oe.push(this._tiles[de]);
              return G2 ? oe.sort(function(ye, Te) {
                var Fe = ye.tileID, et = Te.tileID, lt = new i.Point(Fe.canonical.x, Fe.canonical.y)._rotate(J2.transform.angle), bt = new i.Point(et.canonical.x, et.canonical.y)._rotate(J2.transform.angle);
                return Fe.overscaledZ - et.overscaledZ || bt.y - lt.y || bt.x - lt.x;
              }).map(function(ye) {
                return ye.tileID.key;
              }) : oe.map(function(ye) {
                return ye.tileID;
              }).sort(Re).map(function(ye) {
                return ye.key;
              });
            }, U2.prototype.hasRenderableParent = function(G2) {
              var J2 = this.findLoadedParent(G2, 0);
              return !!J2 && this._isIdRenderable(J2.tileID.key);
            }, U2.prototype._isIdRenderable = function(G2, J2) {
              return this._tiles[G2] && this._tiles[G2].hasData() && !this._coveredTiles[G2] && (J2 || !this._tiles[G2].holdingForFade());
            }, U2.prototype.reload = function() {
              if (this._paused) this._shouldReloadOnResume = true;
              else for (var G2 in this._cache.reset(), this._tiles) this._tiles[G2].state !== "errored" && this._reloadTile(G2, "reloading");
            }, U2.prototype._reloadTile = function(G2, J2) {
              var oe = this._tiles[G2];
              oe && (oe.state !== "loading" && (oe.state = J2), this._loadTile(oe, this._tileLoaded.bind(this, oe, G2, J2)));
            }, U2.prototype._tileLoaded = function(G2, J2, oe, de) {
              if (de) return G2.state = "errored", void (de.status !== 404 ? this._source.fire(new i.ErrorEvent(de, { tile: G2 })) : this.update(this.transform));
              G2.timeAdded = i.browser.now(), oe === "expired" && (G2.refreshedUponExpiration = true), this._setTileReloadTimer(J2, G2), this.getSource().type === "raster-dem" && G2.dem && this._backfillDEM(G2), this._state.initializeTileState(G2, this.map ? this.map.painter : null), this._source.fire(new i.Event("data", { dataType: "source", tile: G2, coord: G2.tileID }));
            }, U2.prototype._backfillDEM = function(G2) {
              for (var J2 = this.getRenderableIds(), oe = 0; oe < J2.length; oe++) {
                var de = J2[oe];
                if (G2.neighboringTiles && G2.neighboringTiles[de]) {
                  var ye = this.getTileByID(de);
                  Te(G2, ye), Te(ye, G2);
                }
              }
              function Te(Fe, et) {
                Fe.needsHillshadePrepare = true;
                var lt = et.tileID.canonical.x - Fe.tileID.canonical.x, bt = et.tileID.canonical.y - Fe.tileID.canonical.y, It = Math.pow(2, Fe.tileID.canonical.z), Rt = et.tileID.key;
                lt === 0 && bt === 0 || Math.abs(bt) > 1 || (Math.abs(lt) > 1 && (Math.abs(lt + It) === 1 ? lt += It : Math.abs(lt - It) === 1 && (lt -= It)), et.dem && Fe.dem && (Fe.dem.backfillBorder(et.dem, lt, bt), Fe.neighboringTiles && Fe.neighboringTiles[Rt] && (Fe.neighboringTiles[Rt].backfilled = true)));
              }
            }, U2.prototype.getTile = function(G2) {
              return this.getTileByID(G2.key);
            }, U2.prototype.getTileByID = function(G2) {
              return this._tiles[G2];
            }, U2.prototype._retainLoadedChildren = function(G2, J2, oe, de) {
              for (var ye in this._tiles) {
                var Te = this._tiles[ye];
                if (!(de[ye] || !Te.hasData() || Te.tileID.overscaledZ <= J2 || Te.tileID.overscaledZ > oe)) {
                  for (var Fe = Te.tileID; Te && Te.tileID.overscaledZ > J2 + 1; ) {
                    var et = Te.tileID.scaledTo(Te.tileID.overscaledZ - 1);
                    (Te = this._tiles[et.key]) && Te.hasData() && (Fe = et);
                  }
                  for (var lt = Fe; lt.overscaledZ > J2; ) if (G2[(lt = lt.scaledTo(lt.overscaledZ - 1)).key]) {
                    de[Fe.key] = Fe;
                    break;
                  }
                }
              }
            }, U2.prototype.findLoadedParent = function(G2, J2) {
              if (G2.key in this._loadedParentTiles) {
                var oe = this._loadedParentTiles[G2.key];
                return oe && oe.tileID.overscaledZ >= J2 ? oe : null;
              }
              for (var de = G2.overscaledZ - 1; de >= J2; de--) {
                var ye = G2.scaledTo(de), Te = this._getLoadedTile(ye);
                if (Te) return Te;
              }
            }, U2.prototype._getLoadedTile = function(G2) {
              var J2 = this._tiles[G2.key];
              return J2 && J2.hasData() ? J2 : this._cache.getByKey(G2.wrapped().key);
            }, U2.prototype.updateCacheSize = function(G2) {
              var J2 = (Math.ceil(G2.width / this._source.tileSize) + 1) * (Math.ceil(G2.height / this._source.tileSize) + 1), oe = Math.floor(5 * J2), de = typeof this._maxTileCacheSize == "number" ? Math.min(this._maxTileCacheSize, oe) : oe;
              this._cache.setMaxSize(de);
            }, U2.prototype.handleWrapJump = function(G2) {
              var J2 = (G2 - (this._prevLng === void 0 ? G2 : this._prevLng)) / 360, oe = Math.round(J2);
              if (this._prevLng = G2, oe) {
                var de = {};
                for (var ye in this._tiles) {
                  var Te = this._tiles[ye];
                  Te.tileID = Te.tileID.unwrapTo(Te.tileID.wrap + oe), de[Te.tileID.key] = Te;
                }
                for (var Fe in this._tiles = de, this._timers) clearTimeout(this._timers[Fe]), delete this._timers[Fe];
                for (var et in this._tiles) {
                  var lt = this._tiles[et];
                  this._setTileReloadTimer(et, lt);
                }
              }
            }, U2.prototype.update = function(G2) {
              var J2 = this;
              if (this.transform = G2, this._sourceLoaded && !this._paused) {
                var oe;
                this.updateCacheSize(G2), this.handleWrapJump(this.transform.center.lng), this._coveredTiles = {}, this.used ? this._source.tileID ? oe = G2.getVisibleUnwrappedCoordinates(this._source.tileID).map(function(Or) {
                  return new i.OverscaledTileID(Or.canonical.z, Or.wrap, Or.canonical.z, Or.canonical.x, Or.canonical.y);
                }) : (oe = G2.coveringTiles({ tileSize: this._source.tileSize, minzoom: this._source.minzoom, maxzoom: this._source.maxzoom, roundZoom: this._source.roundZoom, reparseOverscaled: this._source.reparseOverscaled }), this._source.hasTile && (oe = oe.filter(function(Or) {
                  return J2._source.hasTile(Or);
                }))) : oe = [];
                var de = G2.coveringZoomLevel(this._source), ye = Math.max(de - U2.maxOverzooming, this._source.minzoom), Te = Math.max(de + U2.maxUnderzooming, this._source.minzoom), Fe = this._updateRetainedTiles(oe, de);
                if (qe(this._source.type)) {
                  for (var et = {}, lt = {}, bt = 0, It = Object.keys(Fe); bt < It.length; bt += 1) {
                    var Rt = It[bt], Ft = Fe[Rt], Pt = this._tiles[Rt];
                    if (Pt && !(Pt.fadeEndTime && Pt.fadeEndTime <= i.browser.now())) {
                      var Mt = this.findLoadedParent(Ft, ye);
                      Mt && (this._addTile(Mt.tileID), et[Mt.tileID.key] = Mt.tileID), lt[Rt] = Ft;
                    }
                  }
                  for (var qt in this._retainLoadedChildren(lt, de, Te, Fe), et) Fe[qt] || (this._coveredTiles[qt] = true, Fe[qt] = et[qt]);
                }
                for (var $t in Fe) this._tiles[$t].clearFadeHold();
                for (var Yt = 0, cr = i.keysDifference(this._tiles, Fe); Yt < cr.length; Yt += 1) {
                  var kr = cr[Yt], Pr = this._tiles[kr];
                  Pr.hasSymbolBuckets && !Pr.holdingForFade() ? Pr.setHoldDuration(this.map._fadeDuration) : Pr.hasSymbolBuckets && !Pr.symbolFadeFinished() || this._removeTile(kr);
                }
                this._updateLoadedParentTileCache();
              }
            }, U2.prototype.releaseSymbolFadeTiles = function() {
              for (var G2 in this._tiles) this._tiles[G2].holdingForFade() && this._removeTile(G2);
            }, U2.prototype._updateRetainedTiles = function(G2, J2) {
              for (var oe = {}, de = {}, ye = Math.max(J2 - U2.maxOverzooming, this._source.minzoom), Te = Math.max(J2 + U2.maxUnderzooming, this._source.minzoom), Fe = {}, et = 0, lt = G2; et < lt.length; et += 1) {
                var bt = lt[et], It = this._addTile(bt);
                oe[bt.key] = bt, It.hasData() || J2 < this._source.maxzoom && (Fe[bt.key] = bt);
              }
              this._retainLoadedChildren(Fe, J2, Te, oe);
              for (var Rt = 0, Ft = G2; Rt < Ft.length; Rt += 1) {
                var Pt = Ft[Rt], Mt = this._tiles[Pt.key];
                if (!Mt.hasData()) {
                  if (J2 + 1 > this._source.maxzoom) {
                    var qt = Pt.children(this._source.maxzoom)[0], $t = this.getTile(qt);
                    if ($t && $t.hasData()) {
                      oe[qt.key] = qt;
                      continue;
                    }
                  } else {
                    var Yt = Pt.children(this._source.maxzoom);
                    if (oe[Yt[0].key] && oe[Yt[1].key] && oe[Yt[2].key] && oe[Yt[3].key]) continue;
                  }
                  for (var cr = Mt.wasRequested(), kr = Pt.overscaledZ - 1; kr >= ye; --kr) {
                    var Pr = Pt.scaledTo(kr);
                    if (de[Pr.key] || (de[Pr.key] = true, !(Mt = this.getTile(Pr)) && cr && (Mt = this._addTile(Pr)), Mt && (oe[Pr.key] = Pr, cr = Mt.wasRequested(), Mt.hasData()))) break;
                  }
                }
              }
              return oe;
            }, U2.prototype._updateLoadedParentTileCache = function() {
              for (var G2 in this._loadedParentTiles = {}, this._tiles) {
                for (var J2 = [], oe = void 0, de = this._tiles[G2].tileID; de.overscaledZ > 0; ) {
                  if (de.key in this._loadedParentTiles) {
                    oe = this._loadedParentTiles[de.key];
                    break;
                  }
                  J2.push(de.key);
                  var ye = de.scaledTo(de.overscaledZ - 1);
                  if (oe = this._getLoadedTile(ye)) break;
                  de = ye;
                }
                for (var Te = 0, Fe = J2; Te < Fe.length; Te += 1) {
                  var et = Fe[Te];
                  this._loadedParentTiles[et] = oe;
                }
              }
            }, U2.prototype._addTile = function(G2) {
              var J2 = this._tiles[G2.key];
              if (J2) return J2;
              (J2 = this._cache.getAndRemove(G2)) && (this._setTileReloadTimer(G2.key, J2), J2.tileID = G2, this._state.initializeTileState(J2, this.map ? this.map.painter : null), this._cacheTimers[G2.key] && (clearTimeout(this._cacheTimers[G2.key]), delete this._cacheTimers[G2.key], this._setTileReloadTimer(G2.key, J2)));
              var oe = Boolean(J2);
              return oe || (J2 = new i.Tile(G2, this._source.tileSize * G2.overscaleFactor()), this._loadTile(J2, this._tileLoaded.bind(this, J2, G2.key, J2.state))), J2 ? (J2.uses++, this._tiles[G2.key] = J2, oe || this._source.fire(new i.Event("dataloading", { tile: J2, coord: J2.tileID, dataType: "source" })), J2) : null;
            }, U2.prototype._setTileReloadTimer = function(G2, J2) {
              var oe = this;
              G2 in this._timers && (clearTimeout(this._timers[G2]), delete this._timers[G2]);
              var de = J2.getExpiryTimeout();
              de && (this._timers[G2] = setTimeout(function() {
                oe._reloadTile(G2, "expired"), delete oe._timers[G2];
              }, de));
            }, U2.prototype._removeTile = function(G2) {
              var J2 = this._tiles[G2];
              J2 && (J2.uses--, delete this._tiles[G2], this._timers[G2] && (clearTimeout(this._timers[G2]), delete this._timers[G2]), J2.uses > 0 || (J2.hasData() && J2.state !== "reloading" ? this._cache.add(J2.tileID, J2, J2.getExpiryTimeout()) : (J2.aborted = true, this._abortTile(J2), this._unloadTile(J2))));
            }, U2.prototype.clearTiles = function() {
              for (var G2 in this._shouldReloadOnResume = false, this._paused = false, this._tiles) this._removeTile(G2);
              this._cache.reset();
            }, U2.prototype.tilesIn = function(G2, J2, oe) {
              var de = this, ye = [], Te = this.transform;
              if (!Te) return ye;
              for (var Fe = oe ? Te.getCameraQueryGeometry(G2) : G2, et = G2.map(function(kr) {
                return Te.pointCoordinate(kr);
              }), lt = Fe.map(function(kr) {
                return Te.pointCoordinate(kr);
              }), bt = this.getIds(), It = 1 / 0, Rt = 1 / 0, Ft = -1 / 0, Pt = -1 / 0, Mt = 0, qt = lt; Mt < qt.length; Mt += 1) {
                var $t = qt[Mt];
                It = Math.min(It, $t.x), Rt = Math.min(Rt, $t.y), Ft = Math.max(Ft, $t.x), Pt = Math.max(Pt, $t.y);
              }
              for (var Yt = function(kr) {
                var Pr = de._tiles[bt[kr]];
                if (!Pr.holdingForFade()) {
                  var Or = Pr.tileID, xn = Math.pow(2, Te.zoom - Pr.tileID.overscaledZ), yn = J2 * Pr.queryPadding * i.EXTENT / Pr.tileSize / xn, Nn = [Or.getTilePoint(new i.MercatorCoordinate(It, Rt)), Or.getTilePoint(new i.MercatorCoordinate(Ft, Pt))];
                  if (Nn[0].x - yn < i.EXTENT && Nn[0].y - yn < i.EXTENT && Nn[1].x + yn >= 0 && Nn[1].y + yn >= 0) {
                    var An = et.map(function(Aa) {
                      return Or.getTilePoint(Aa);
                    }), ma = lt.map(function(Aa) {
                      return Or.getTilePoint(Aa);
                    });
                    ye.push({ tile: Pr, tileID: Or, queryGeometry: An, cameraQueryGeometry: ma, scale: xn });
                  }
                }
              }, cr = 0; cr < bt.length; cr++) Yt(cr);
              return ye;
            }, U2.prototype.getVisibleCoordinates = function(G2) {
              for (var J2 = this, oe = this.getRenderableIds(G2).map(function(Fe) {
                return J2._tiles[Fe].tileID;
              }), de = 0, ye = oe; de < ye.length; de += 1) {
                var Te = ye[de];
                Te.posMatrix = this.transform.calculatePosMatrix(Te.toUnwrapped());
              }
              return oe;
            }, U2.prototype.hasTransition = function() {
              if (this._source.hasTransition()) return true;
              if (qe(this._source.type)) for (var G2 in this._tiles) {
                var J2 = this._tiles[G2];
                if (J2.fadeEndTime !== void 0 && J2.fadeEndTime >= i.browser.now()) return true;
              }
              return false;
            }, U2.prototype.setFeatureState = function(G2, J2, oe) {
              G2 = G2 || "_geojsonTileLayer", this._state.updateState(G2, J2, oe);
            }, U2.prototype.removeFeatureState = function(G2, J2, oe) {
              G2 = G2 || "_geojsonTileLayer", this._state.removeFeatureState(G2, J2, oe);
            }, U2.prototype.getFeatureState = function(G2, J2) {
              return G2 = G2 || "_geojsonTileLayer", this._state.getState(G2, J2);
            }, U2.prototype.setDependencies = function(G2, J2, oe) {
              var de = this._tiles[G2];
              de && de.setDependencies(J2, oe);
            }, U2.prototype.reloadTilesForDependencies = function(G2, J2) {
              for (var oe in this._tiles) this._tiles[oe].hasDependency(G2, J2) && this._reloadTile(oe, "reloading");
              this._cache.filter(function(de) {
                return !de.hasDependency(G2, J2);
              });
            }, U2;
          }(i.Evented);
          function Re(P2, U2) {
            var G2 = Math.abs(2 * P2.wrap) - +(P2.wrap < 0), J2 = Math.abs(2 * U2.wrap) - +(U2.wrap < 0);
            return P2.overscaledZ - U2.overscaledZ || J2 - G2 || U2.canonical.y - P2.canonical.y || U2.canonical.x - P2.canonical.x;
          }
          function qe(P2) {
            return P2 === "raster" || P2 === "image" || P2 === "video";
          }
          function je() {
            return new i.window.Worker(fe.workerUrl);
          }
          ut.maxOverzooming = 10, ut.maxUnderzooming = 3;
          var rt = "mapboxgl_preloaded_worker_pool", He = function() {
            this.active = {};
          };
          He.prototype.acquire = function(P2) {
            if (!this.workers) for (this.workers = []; this.workers.length < He.workerCount; ) this.workers.push(new je());
            return this.active[P2] = true, this.workers.slice();
          }, He.prototype.release = function(P2) {
            delete this.active[P2], this.numActive() === 0 && (this.workers.forEach(function(U2) {
              U2.terminate();
            }), this.workers = null);
          }, He.prototype.isPreloaded = function() {
            return !!this.active[rt];
          }, He.prototype.numActive = function() {
            return Object.keys(this.active).length;
          };
          var xe, Ne = Math.floor(i.browser.hardwareConcurrency / 2);
          function ke() {
            return xe || (xe = new He()), xe;
          }
          function Me(P2, U2) {
            var G2 = {};
            for (var J2 in P2) J2 !== "ref" && (G2[J2] = P2[J2]);
            return i.refProperties.forEach(function(oe) {
              oe in U2 && (G2[oe] = U2[oe]);
            }), G2;
          }
          function Le(P2) {
            P2 = P2.slice();
            for (var U2 = /* @__PURE__ */ Object.create(null), G2 = 0; G2 < P2.length; G2++) U2[P2[G2].id] = P2[G2];
            for (var J2 = 0; J2 < P2.length; J2++) "ref" in P2[J2] && (P2[J2] = Me(P2[J2], U2[P2[J2].ref]));
            return P2;
          }
          He.workerCount = Math.max(Math.min(Ne, 6), 1);
          var ze = { setStyle: "setStyle", addLayer: "addLayer", removeLayer: "removeLayer", setPaintProperty: "setPaintProperty", setLayoutProperty: "setLayoutProperty", setFilter: "setFilter", addSource: "addSource", removeSource: "removeSource", setGeoJSONSourceData: "setGeoJSONSourceData", setLayerZoomRange: "setLayerZoomRange", setLayerProperty: "setLayerProperty", setCenter: "setCenter", setZoom: "setZoom", setBearing: "setBearing", setPitch: "setPitch", setSprite: "setSprite", setGlyphs: "setGlyphs", setTransition: "setTransition", setLight: "setLight" };
          function ft(P2, U2, G2) {
            G2.push({ command: ze.addSource, args: [P2, U2[P2]] });
          }
          function De(P2, U2, G2) {
            U2.push({ command: ze.removeSource, args: [P2] }), G2[P2] = true;
          }
          function Je(P2, U2, G2, J2) {
            De(P2, G2, J2), ft(P2, U2, G2);
          }
          function tt(P2, U2, G2) {
            var J2;
            for (J2 in P2[G2]) if (P2[G2].hasOwnProperty(J2) && J2 !== "data" && !i.deepEqual(P2[G2][J2], U2[G2][J2])) return false;
            for (J2 in U2[G2]) if (U2[G2].hasOwnProperty(J2) && J2 !== "data" && !i.deepEqual(P2[G2][J2], U2[G2][J2])) return false;
            return true;
          }
          function vt(P2, U2, G2, J2, oe, de) {
            var ye;
            for (ye in U2 = U2 || {}, P2 = P2 || {}) P2.hasOwnProperty(ye) && (i.deepEqual(P2[ye], U2[ye]) || G2.push({ command: de, args: [J2, ye, U2[ye], oe] }));
            for (ye in U2) U2.hasOwnProperty(ye) && !P2.hasOwnProperty(ye) && (i.deepEqual(P2[ye], U2[ye]) || G2.push({ command: de, args: [J2, ye, U2[ye], oe] }));
          }
          function kt(P2) {
            return P2.id;
          }
          function jt(P2, U2) {
            return P2[U2.id] = U2, P2;
          }
          function Vt(P2, U2) {
            if (!P2) return [{ command: ze.setStyle, args: [U2] }];
            var G2 = [];
            try {
              if (!i.deepEqual(P2.version, U2.version)) return [{ command: ze.setStyle, args: [U2] }];
              i.deepEqual(P2.center, U2.center) || G2.push({ command: ze.setCenter, args: [U2.center] }), i.deepEqual(P2.zoom, U2.zoom) || G2.push({ command: ze.setZoom, args: [U2.zoom] }), i.deepEqual(P2.bearing, U2.bearing) || G2.push({ command: ze.setBearing, args: [U2.bearing] }), i.deepEqual(P2.pitch, U2.pitch) || G2.push({ command: ze.setPitch, args: [U2.pitch] }), i.deepEqual(P2.sprite, U2.sprite) || G2.push({ command: ze.setSprite, args: [U2.sprite] }), i.deepEqual(P2.glyphs, U2.glyphs) || G2.push({ command: ze.setGlyphs, args: [U2.glyphs] }), i.deepEqual(P2.transition, U2.transition) || G2.push({ command: ze.setTransition, args: [U2.transition] }), i.deepEqual(P2.light, U2.light) || G2.push({ command: ze.setLight, args: [U2.light] });
              var J2 = {}, oe = [];
              (function(ye, Te, Fe, et) {
                var lt;
                for (lt in Te = Te || {}, ye = ye || {}) ye.hasOwnProperty(lt) && (Te.hasOwnProperty(lt) || De(lt, Fe, et));
                for (lt in Te) Te.hasOwnProperty(lt) && (ye.hasOwnProperty(lt) ? i.deepEqual(ye[lt], Te[lt]) || (ye[lt].type === "geojson" && Te[lt].type === "geojson" && tt(ye, Te, lt) ? Fe.push({ command: ze.setGeoJSONSourceData, args: [lt, Te[lt].data] }) : Je(lt, Te, Fe, et)) : ft(lt, Te, Fe));
              })(P2.sources, U2.sources, oe, J2);
              var de = [];
              P2.layers && P2.layers.forEach(function(ye) {
                J2[ye.source] ? G2.push({ command: ze.removeLayer, args: [ye.id] }) : de.push(ye);
              }), G2 = G2.concat(oe), function(ye, Te, Fe) {
                Te = Te || [];
                var et, lt, bt, It, Rt, Ft, Pt, Mt = (ye = ye || []).map(kt), qt = Te.map(kt), $t = ye.reduce(jt, {}), Yt = Te.reduce(jt, {}), cr = Mt.slice(), kr = /* @__PURE__ */ Object.create(null);
                for (et = 0, lt = 0; et < Mt.length; et++) bt = Mt[et], Yt.hasOwnProperty(bt) ? lt++ : (Fe.push({ command: ze.removeLayer, args: [bt] }), cr.splice(cr.indexOf(bt, lt), 1));
                for (et = 0, lt = 0; et < qt.length; et++) bt = qt[qt.length - 1 - et], cr[cr.length - 1 - et] !== bt && ($t.hasOwnProperty(bt) ? (Fe.push({ command: ze.removeLayer, args: [bt] }), cr.splice(cr.lastIndexOf(bt, cr.length - lt), 1)) : lt++, Ft = cr[cr.length - et], Fe.push({ command: ze.addLayer, args: [Yt[bt], Ft] }), cr.splice(cr.length - et, 0, bt), kr[bt] = true);
                for (et = 0; et < qt.length; et++) if (It = $t[bt = qt[et]], Rt = Yt[bt], !kr[bt] && !i.deepEqual(It, Rt)) if (i.deepEqual(It.source, Rt.source) && i.deepEqual(It["source-layer"], Rt["source-layer"]) && i.deepEqual(It.type, Rt.type)) {
                  for (Pt in vt(It.layout, Rt.layout, Fe, bt, null, ze.setLayoutProperty), vt(It.paint, Rt.paint, Fe, bt, null, ze.setPaintProperty), i.deepEqual(It.filter, Rt.filter) || Fe.push({ command: ze.setFilter, args: [bt, Rt.filter] }), i.deepEqual(It.minzoom, Rt.minzoom) && i.deepEqual(It.maxzoom, Rt.maxzoom) || Fe.push({ command: ze.setLayerZoomRange, args: [bt, Rt.minzoom, Rt.maxzoom] }), It) It.hasOwnProperty(Pt) && Pt !== "layout" && Pt !== "paint" && Pt !== "filter" && Pt !== "metadata" && Pt !== "minzoom" && Pt !== "maxzoom" && (Pt.indexOf("paint.") === 0 ? vt(It[Pt], Rt[Pt], Fe, bt, Pt.slice(6), ze.setPaintProperty) : i.deepEqual(It[Pt], Rt[Pt]) || Fe.push({ command: ze.setLayerProperty, args: [bt, Pt, Rt[Pt]] }));
                  for (Pt in Rt) Rt.hasOwnProperty(Pt) && !It.hasOwnProperty(Pt) && Pt !== "layout" && Pt !== "paint" && Pt !== "filter" && Pt !== "metadata" && Pt !== "minzoom" && Pt !== "maxzoom" && (Pt.indexOf("paint.") === 0 ? vt(It[Pt], Rt[Pt], Fe, bt, Pt.slice(6), ze.setPaintProperty) : i.deepEqual(It[Pt], Rt[Pt]) || Fe.push({ command: ze.setLayerProperty, args: [bt, Pt, Rt[Pt]] }));
                } else Fe.push({ command: ze.removeLayer, args: [bt] }), Ft = cr[cr.lastIndexOf(bt) + 1], Fe.push({ command: ze.addLayer, args: [Rt, Ft] });
              }(de, U2.layers, G2);
            } catch (ye) {
              console.warn("Unable to compute style diff:", ye), G2 = [{ command: ze.setStyle, args: [U2] }];
            }
            return G2;
          }
          var Kt = function(P2, U2) {
            this.reset(P2, U2);
          };
          Kt.prototype.reset = function(P2, U2) {
            this.points = P2 || [], this._distances = [0];
            for (var G2 = 1; G2 < this.points.length; G2++) this._distances[G2] = this._distances[G2 - 1] + this.points[G2].dist(this.points[G2 - 1]);
            this.length = this._distances[this._distances.length - 1], this.padding = Math.min(U2 || 0, 0.5 * this.length), this.paddedLength = this.length - 2 * this.padding;
          }, Kt.prototype.lerp = function(P2) {
            if (this.points.length === 1) return this.points[0];
            P2 = i.clamp(P2, 0, 1);
            for (var U2 = 1, G2 = this._distances[U2], J2 = P2 * this.paddedLength + this.padding; G2 < J2 && U2 < this._distances.length; ) G2 = this._distances[++U2];
            var oe = U2 - 1, de = this._distances[oe], ye = G2 - de, Te = ye > 0 ? (J2 - de) / ye : 0;
            return this.points[oe].mult(1 - Te).add(this.points[U2].mult(Te));
          };
          var rr = function(P2, U2, G2) {
            var J2 = this.boxCells = [], oe = this.circleCells = [];
            this.xCellCount = Math.ceil(P2 / G2), this.yCellCount = Math.ceil(U2 / G2);
            for (var de = 0; de < this.xCellCount * this.yCellCount; de++) J2.push([]), oe.push([]);
            this.circleKeys = [], this.boxKeys = [], this.bboxes = [], this.circles = [], this.width = P2, this.height = U2, this.xScale = this.xCellCount / P2, this.yScale = this.yCellCount / U2, this.boxUid = 0, this.circleUid = 0;
          };
          function Tr(P2, U2, G2, J2, oe) {
            var de = i.create();
            return U2 ? (i.scale(de, de, [1 / oe, 1 / oe, 1]), G2 || i.rotateZ(de, de, J2.angle)) : i.multiply(de, J2.labelPlaneMatrix, P2), de;
          }
          function yr(P2, U2, G2, J2, oe) {
            if (U2) {
              var de = i.clone(P2);
              return i.scale(de, de, [oe, oe, 1]), G2 || i.rotateZ(de, de, -J2.angle), de;
            }
            return J2.glCoordMatrix;
          }
          function pr(P2, U2) {
            var G2 = [P2.x, P2.y, 0, 1];
            _n(G2, G2, U2);
            var J2 = G2[3];
            return { point: new i.Point(G2[0] / J2, G2[1] / J2), signedDistanceFromCamera: J2 };
          }
          function lr(P2, U2) {
            return 0.5 + P2 / U2 * 0.5;
          }
          function _r(P2, U2) {
            var G2 = P2[0] / P2[3], J2 = P2[1] / P2[3];
            return G2 >= -U2[0] && G2 <= U2[0] && J2 >= -U2[1] && J2 <= U2[1];
          }
          function $r(P2, U2, G2, J2, oe, de, ye, Te) {
            var Fe = J2 ? P2.textSizeData : P2.iconSizeData, et = i.evaluateSizeForZoom(Fe, G2.transform.zoom), lt = [256 / G2.width * 2 + 1, 256 / G2.height * 2 + 1], bt = J2 ? P2.text.dynamicLayoutVertexArray : P2.icon.dynamicLayoutVertexArray;
            bt.clear();
            for (var It = P2.lineVertexArray, Rt = J2 ? P2.text.placedSymbolArray : P2.icon.placedSymbolArray, Ft = G2.transform.width / G2.transform.height, Pt = false, Mt = 0; Mt < Rt.length; Mt++) {
              var qt = Rt.get(Mt);
              if (qt.hidden || qt.writingMode === i.WritingMode.vertical && !Pt) Wn(qt.numGlyphs, bt);
              else {
                Pt = false;
                var $t = [qt.anchorX, qt.anchorY, 0, 1];
                if (i.transformMat4($t, $t, U2), _r($t, lt)) {
                  var Yt = $t[3], cr = lr(G2.transform.cameraToCenterDistance, Yt), kr = i.evaluateSizeForFeature(Fe, et, qt), Pr = ye ? kr / cr : kr * cr, Or = new i.Point(qt.anchorX, qt.anchorY), xn = pr(Or, oe).point, yn = {}, Nn = hn(qt, Pr, false, Te, U2, oe, de, P2.glyphOffsetArray, It, bt, xn, Or, yn, Ft);
                  Pt = Nn.useVertical, (Nn.notEnoughRoom || Pt || Nn.needsFlipping && hn(qt, Pr, true, Te, U2, oe, de, P2.glyphOffsetArray, It, bt, xn, Or, yn, Ft).notEnoughRoom) && Wn(qt.numGlyphs, bt);
                } else Wn(qt.numGlyphs, bt);
              }
            }
            J2 ? P2.text.dynamicLayoutVertexBuffer.updateData(bt) : P2.icon.dynamicLayoutVertexBuffer.updateData(bt);
          }
          function Ar(P2, U2, G2, J2, oe, de, ye, Te, Fe, et, lt) {
            var bt = Te.glyphStartIndex + Te.numGlyphs, It = Te.lineStartIndex, Rt = Te.lineStartIndex + Te.lineLength, Ft = U2.getoffsetX(Te.glyphStartIndex), Pt = U2.getoffsetX(bt - 1), Mt = Yn(P2 * Ft, G2, J2, oe, de, ye, Te.segment, It, Rt, Fe, et, lt);
            if (!Mt) return null;
            var qt = Yn(P2 * Pt, G2, J2, oe, de, ye, Te.segment, It, Rt, Fe, et, lt);
            return qt ? { first: Mt, last: qt } : null;
          }
          function Qr(P2, U2, G2, J2) {
            return P2 === i.WritingMode.horizontal && Math.abs(G2.y - U2.y) > Math.abs(G2.x - U2.x) * J2 ? { useVertical: true } : (P2 === i.WritingMode.vertical ? U2.y < G2.y : U2.x > G2.x) ? { needsFlipping: true } : null;
          }
          function hn(P2, U2, G2, J2, oe, de, ye, Te, Fe, et, lt, bt, It, Rt) {
            var Ft, Pt = U2 / 24, Mt = P2.lineOffsetX * Pt, qt = P2.lineOffsetY * Pt;
            if (P2.numGlyphs > 1) {
              var $t = P2.glyphStartIndex + P2.numGlyphs, Yt = P2.lineStartIndex, cr = P2.lineStartIndex + P2.lineLength, kr = Ar(Pt, Te, Mt, qt, G2, lt, bt, P2, Fe, de, It);
              if (!kr) return { notEnoughRoom: true };
              var Pr = pr(kr.first.point, ye).point, Or = pr(kr.last.point, ye).point;
              if (J2 && !G2) {
                var xn = Qr(P2.writingMode, Pr, Or, Rt);
                if (xn) return xn;
              }
              Ft = [kr.first];
              for (var yn = P2.glyphStartIndex + 1; yn < $t - 1; yn++) Ft.push(Yn(Pt * Te.getoffsetX(yn), Mt, qt, G2, lt, bt, P2.segment, Yt, cr, Fe, de, It));
              Ft.push(kr.last);
            } else {
              if (J2 && !G2) {
                var Nn = pr(bt, oe).point, An = P2.lineStartIndex + P2.segment + 1, ma = new i.Point(Fe.getx(An), Fe.gety(An)), Aa = pr(ma, oe), Qa = Aa.signedDistanceFromCamera > 0 ? Aa.point : wn(bt, ma, Nn, 1, oe), ln = Qr(P2.writingMode, Nn, Qa, Rt);
                if (ln) return ln;
              }
              var qn = Yn(Pt * Te.getoffsetX(P2.glyphStartIndex), Mt, qt, G2, lt, bt, P2.segment, P2.lineStartIndex, P2.lineStartIndex + P2.lineLength, Fe, de, It);
              if (!qn) return { notEnoughRoom: true };
              Ft = [qn];
            }
            for (var Sa = 0, _a = Ft; Sa < _a.length; Sa += 1) {
              var Pa = _a[Sa];
              i.addDynamicAttributes(et, Pa.point, Pa.angle);
            }
            return {};
          }
          function wn(P2, U2, G2, J2, oe) {
            var de = pr(P2.add(P2.sub(U2)._unit()), oe).point, ye = G2.sub(de);
            return G2.add(ye._mult(J2 / ye.mag()));
          }
          function Yn(P2, U2, G2, J2, oe, de, ye, Te, Fe, et, lt, bt) {
            var It = J2 ? P2 - U2 : P2 + U2, Rt = It > 0 ? 1 : -1, Ft = 0;
            J2 && (Rt *= -1, Ft = Math.PI), Rt < 0 && (Ft += Math.PI);
            for (var Pt = Rt > 0 ? Te + ye : Te + ye + 1, Mt = oe, qt = oe, $t = 0, Yt = 0, cr = Math.abs(It), kr = []; $t + Yt <= cr; ) {
              if ((Pt += Rt) < Te || Pt >= Fe) return null;
              if (qt = Mt, kr.push(Mt), (Mt = bt[Pt]) === void 0) {
                var Pr = new i.Point(et.getx(Pt), et.gety(Pt)), Or = pr(Pr, lt);
                if (Or.signedDistanceFromCamera > 0) Mt = bt[Pt] = Or.point;
                else {
                  var xn = Pt - Rt;
                  Mt = wn($t === 0 ? de : new i.Point(et.getx(xn), et.gety(xn)), Pr, qt, cr - $t + 1, lt);
                }
              }
              $t += Yt, Yt = qt.dist(Mt);
            }
            var yn = (cr - $t) / Yt, Nn = Mt.sub(qt), An = Nn.mult(yn)._add(qt);
            An._add(Nn._unit()._perp()._mult(G2 * Rt));
            var ma = Ft + Math.atan2(Mt.y - qt.y, Mt.x - qt.x);
            return kr.push(An), { point: An, angle: ma, path: kr };
          }
          rr.prototype.keysLength = function() {
            return this.boxKeys.length + this.circleKeys.length;
          }, rr.prototype.insert = function(P2, U2, G2, J2, oe) {
            this._forEachCell(U2, G2, J2, oe, this._insertBoxCell, this.boxUid++), this.boxKeys.push(P2), this.bboxes.push(U2), this.bboxes.push(G2), this.bboxes.push(J2), this.bboxes.push(oe);
          }, rr.prototype.insertCircle = function(P2, U2, G2, J2) {
            this._forEachCell(U2 - J2, G2 - J2, U2 + J2, G2 + J2, this._insertCircleCell, this.circleUid++), this.circleKeys.push(P2), this.circles.push(U2), this.circles.push(G2), this.circles.push(J2);
          }, rr.prototype._insertBoxCell = function(P2, U2, G2, J2, oe, de) {
            this.boxCells[oe].push(de);
          }, rr.prototype._insertCircleCell = function(P2, U2, G2, J2, oe, de) {
            this.circleCells[oe].push(de);
          }, rr.prototype._query = function(P2, U2, G2, J2, oe, de) {
            if (G2 < 0 || P2 > this.width || J2 < 0 || U2 > this.height) return !oe && [];
            var ye = [];
            if (P2 <= 0 && U2 <= 0 && this.width <= G2 && this.height <= J2) {
              if (oe) return true;
              for (var Te = 0; Te < this.boxKeys.length; Te++) ye.push({ key: this.boxKeys[Te], x1: this.bboxes[4 * Te], y1: this.bboxes[4 * Te + 1], x2: this.bboxes[4 * Te + 2], y2: this.bboxes[4 * Te + 3] });
              for (var Fe = 0; Fe < this.circleKeys.length; Fe++) {
                var et = this.circles[3 * Fe], lt = this.circles[3 * Fe + 1], bt = this.circles[3 * Fe + 2];
                ye.push({ key: this.circleKeys[Fe], x1: et - bt, y1: lt - bt, x2: et + bt, y2: lt + bt });
              }
              return de ? ye.filter(de) : ye;
            }
            var It = { hitTest: oe, seenUids: { box: {}, circle: {} } };
            return this._forEachCell(P2, U2, G2, J2, this._queryCell, ye, It, de), oe ? ye.length > 0 : ye;
          }, rr.prototype._queryCircle = function(P2, U2, G2, J2, oe) {
            var de = P2 - G2, ye = P2 + G2, Te = U2 - G2, Fe = U2 + G2;
            if (ye < 0 || de > this.width || Fe < 0 || Te > this.height) return !J2 && [];
            var et = [], lt = { hitTest: J2, circle: { x: P2, y: U2, radius: G2 }, seenUids: { box: {}, circle: {} } };
            return this._forEachCell(de, Te, ye, Fe, this._queryCellCircle, et, lt, oe), J2 ? et.length > 0 : et;
          }, rr.prototype.query = function(P2, U2, G2, J2, oe) {
            return this._query(P2, U2, G2, J2, false, oe);
          }, rr.prototype.hitTest = function(P2, U2, G2, J2, oe) {
            return this._query(P2, U2, G2, J2, true, oe);
          }, rr.prototype.hitTestCircle = function(P2, U2, G2, J2) {
            return this._queryCircle(P2, U2, G2, true, J2);
          }, rr.prototype._queryCell = function(P2, U2, G2, J2, oe, de, ye, Te) {
            var Fe = ye.seenUids, et = this.boxCells[oe];
            if (et !== null) for (var lt = this.bboxes, bt = 0, It = et; bt < It.length; bt += 1) {
              var Rt = It[bt];
              if (!Fe.box[Rt]) {
                Fe.box[Rt] = true;
                var Ft = 4 * Rt;
                if (P2 <= lt[Ft + 2] && U2 <= lt[Ft + 3] && G2 >= lt[Ft + 0] && J2 >= lt[Ft + 1] && (!Te || Te(this.boxKeys[Rt]))) {
                  if (ye.hitTest) return de.push(true), true;
                  de.push({ key: this.boxKeys[Rt], x1: lt[Ft], y1: lt[Ft + 1], x2: lt[Ft + 2], y2: lt[Ft + 3] });
                }
              }
            }
            var Pt = this.circleCells[oe];
            if (Pt !== null) for (var Mt = this.circles, qt = 0, $t = Pt; qt < $t.length; qt += 1) {
              var Yt = $t[qt];
              if (!Fe.circle[Yt]) {
                Fe.circle[Yt] = true;
                var cr = 3 * Yt;
                if (this._circleAndRectCollide(Mt[cr], Mt[cr + 1], Mt[cr + 2], P2, U2, G2, J2) && (!Te || Te(this.circleKeys[Yt]))) {
                  if (ye.hitTest) return de.push(true), true;
                  var kr = Mt[cr], Pr = Mt[cr + 1], Or = Mt[cr + 2];
                  de.push({ key: this.circleKeys[Yt], x1: kr - Or, y1: Pr - Or, x2: kr + Or, y2: Pr + Or });
                }
              }
            }
          }, rr.prototype._queryCellCircle = function(P2, U2, G2, J2, oe, de, ye, Te) {
            var Fe = ye.circle, et = ye.seenUids, lt = this.boxCells[oe];
            if (lt !== null) for (var bt = this.bboxes, It = 0, Rt = lt; It < Rt.length; It += 1) {
              var Ft = Rt[It];
              if (!et.box[Ft]) {
                et.box[Ft] = true;
                var Pt = 4 * Ft;
                if (this._circleAndRectCollide(Fe.x, Fe.y, Fe.radius, bt[Pt + 0], bt[Pt + 1], bt[Pt + 2], bt[Pt + 3]) && (!Te || Te(this.boxKeys[Ft]))) return de.push(true), true;
              }
            }
            var Mt = this.circleCells[oe];
            if (Mt !== null) for (var qt = this.circles, $t = 0, Yt = Mt; $t < Yt.length; $t += 1) {
              var cr = Yt[$t];
              if (!et.circle[cr]) {
                et.circle[cr] = true;
                var kr = 3 * cr;
                if (this._circlesCollide(qt[kr], qt[kr + 1], qt[kr + 2], Fe.x, Fe.y, Fe.radius) && (!Te || Te(this.circleKeys[cr]))) return de.push(true), true;
              }
            }
          }, rr.prototype._forEachCell = function(P2, U2, G2, J2, oe, de, ye, Te) {
            for (var Fe = this._convertToXCellCoord(P2), et = this._convertToYCellCoord(U2), lt = this._convertToXCellCoord(G2), bt = this._convertToYCellCoord(J2), It = Fe; It <= lt; It++) for (var Rt = et; Rt <= bt; Rt++) {
              var Ft = this.xCellCount * Rt + It;
              if (oe.call(this, P2, U2, G2, J2, Ft, de, ye, Te)) return;
            }
          }, rr.prototype._convertToXCellCoord = function(P2) {
            return Math.max(0, Math.min(this.xCellCount - 1, Math.floor(P2 * this.xScale)));
          }, rr.prototype._convertToYCellCoord = function(P2) {
            return Math.max(0, Math.min(this.yCellCount - 1, Math.floor(P2 * this.yScale)));
          }, rr.prototype._circlesCollide = function(P2, U2, G2, J2, oe, de) {
            var ye = J2 - P2, Te = oe - U2, Fe = G2 + de;
            return Fe * Fe > ye * ye + Te * Te;
          }, rr.prototype._circleAndRectCollide = function(P2, U2, G2, J2, oe, de, ye) {
            var Te = (de - J2) / 2, Fe = Math.abs(P2 - (J2 + Te));
            if (Fe > Te + G2) return false;
            var et = (ye - oe) / 2, lt = Math.abs(U2 - (oe + et));
            if (lt > et + G2) return false;
            if (Fe <= Te || lt <= et) return true;
            var bt = Fe - Te, It = lt - et;
            return bt * bt + It * It <= G2 * G2;
          };
          var Xn = new Float32Array([-1 / 0, -1 / 0, 0, -1 / 0, -1 / 0, 0, -1 / 0, -1 / 0, 0, -1 / 0, -1 / 0, 0]);
          function Wn(P2, U2) {
            for (var G2 = 0; G2 < P2; G2++) {
              var J2 = U2.length;
              U2.resize(J2 + 4), U2.float32.set(Xn, 3 * J2);
            }
          }
          function _n(P2, U2, G2) {
            var J2 = U2[0], oe = U2[1];
            return P2[0] = G2[0] * J2 + G2[4] * oe + G2[12], P2[1] = G2[1] * J2 + G2[5] * oe + G2[13], P2[3] = G2[3] * J2 + G2[7] * oe + G2[15], P2;
          }
          var qr = function(P2, U2, G2) {
            U2 === void 0 && (U2 = new rr(P2.width + 200, P2.height + 200, 25)), G2 === void 0 && (G2 = new rr(P2.width + 200, P2.height + 200, 25)), this.transform = P2, this.grid = U2, this.ignoredGrid = G2, this.pitchfactor = Math.cos(P2._pitch) * P2.cameraToCenterDistance, this.screenRightBoundary = P2.width + 100, this.screenBottomBoundary = P2.height + 100, this.gridRightBoundary = P2.width + 200, this.gridBottomBoundary = P2.height + 200;
          };
          function Nr(P2, U2, G2) {
            return U2 * (i.EXTENT / (P2.tileSize * Math.pow(2, G2 - P2.tileID.overscaledZ)));
          }
          qr.prototype.placeCollisionBox = function(P2, U2, G2, J2, oe) {
            var de = this.projectAndGetPerspectiveRatio(J2, P2.anchorPointX, P2.anchorPointY), ye = G2 * de.perspectiveRatio, Te = P2.x1 * ye + de.point.x, Fe = P2.y1 * ye + de.point.y, et = P2.x2 * ye + de.point.x, lt = P2.y2 * ye + de.point.y;
            return !this.isInsideGrid(Te, Fe, et, lt) || !U2 && this.grid.hitTest(Te, Fe, et, lt, oe) ? { box: [], offscreen: false } : { box: [Te, Fe, et, lt], offscreen: this.isOffscreen(Te, Fe, et, lt) };
          }, qr.prototype.placeCollisionCircles = function(P2, U2, G2, J2, oe, de, ye, Te, Fe, et, lt, bt, It) {
            var Rt = [], Ft = new i.Point(U2.anchorX, U2.anchorY), Pt = pr(Ft, de), Mt = lr(this.transform.cameraToCenterDistance, Pt.signedDistanceFromCamera), qt = (et ? oe / Mt : oe * Mt) / i.ONE_EM, $t = pr(Ft, ye).point, Yt = Ar(qt, J2, U2.lineOffsetX * qt, U2.lineOffsetY * qt, false, $t, Ft, U2, G2, ye, {}), cr = false, kr = false, Pr = true;
            if (Yt) {
              for (var Or = 0.5 * bt * Mt + It, xn = new i.Point(-100, -100), yn = new i.Point(this.screenRightBoundary, this.screenBottomBoundary), Nn = new Kt(), An = Yt.first, ma = Yt.last, Aa = [], Qa = An.path.length - 1; Qa >= 1; Qa--) Aa.push(An.path[Qa]);
              for (var ln = 1; ln < ma.path.length; ln++) Aa.push(ma.path[ln]);
              var qn = 2.5 * Or;
              if (Te) {
                var Sa = Aa.map(function(ku) {
                  return pr(ku, Te);
                });
                Aa = Sa.some(function(ku) {
                  return ku.signedDistanceFromCamera <= 0;
                }) ? [] : Sa.map(function(ku) {
                  return ku.point;
                });
              }
              var _a = [];
              if (Aa.length > 0) {
                for (var Pa = Aa[0].clone(), ii = Aa[0].clone(), Oi = 1; Oi < Aa.length; Oi++) Pa.x = Math.min(Pa.x, Aa[Oi].x), Pa.y = Math.min(Pa.y, Aa[Oi].y), ii.x = Math.max(ii.x, Aa[Oi].x), ii.y = Math.max(ii.y, Aa[Oi].y);
                _a = Pa.x >= xn.x && ii.x <= yn.x && Pa.y >= xn.y && ii.y <= yn.y ? [Aa] : ii.x < xn.x || Pa.x > yn.x || ii.y < xn.y || Pa.y > yn.y ? [] : i.clipLine([Aa], xn.x, xn.y, yn.x, yn.y);
              }
              for (var Da = 0, wi = _a; Da < wi.length; Da += 1) {
                var di = wi[Da];
                Nn.reset(di, 0.25 * Or);
                var ji = 0;
                ji = Nn.length <= 0.5 * Or ? 1 : Math.ceil(Nn.paddedLength / qn) + 1;
                for (var ki = 0; ki < ji; ki++) {
                  var Wi = ki / Math.max(ji - 1, 1), to = Nn.lerp(Wi), as = to.x + 100, js = to.y + 100;
                  Rt.push(as, js, Or, 0);
                  var Ws = as - Or, Qo = js - Or, Cs = as + Or, us = js + Or;
                  if (Pr = Pr && this.isOffscreen(Ws, Qo, Cs, us), kr = kr || this.isInsideGrid(Ws, Qo, Cs, us), !P2 && this.grid.hitTestCircle(as, js, Or, lt) && (cr = true, !Fe)) return { circles: [], offscreen: false, collisionDetected: cr };
                }
              }
            }
            return { circles: !Fe && cr || !kr ? [] : Rt, offscreen: Pr, collisionDetected: cr };
          }, qr.prototype.queryRenderedSymbols = function(P2) {
            if (P2.length === 0 || this.grid.keysLength() === 0 && this.ignoredGrid.keysLength() === 0) return {};
            for (var U2 = [], G2 = 1 / 0, J2 = 1 / 0, oe = -1 / 0, de = -1 / 0, ye = 0, Te = P2; ye < Te.length; ye += 1) {
              var Fe = Te[ye], et = new i.Point(Fe.x + 100, Fe.y + 100);
              G2 = Math.min(G2, et.x), J2 = Math.min(J2, et.y), oe = Math.max(oe, et.x), de = Math.max(de, et.y), U2.push(et);
            }
            for (var lt = {}, bt = {}, It = 0, Rt = this.grid.query(G2, J2, oe, de).concat(this.ignoredGrid.query(G2, J2, oe, de)); It < Rt.length; It += 1) {
              var Ft = Rt[It], Pt = Ft.key;
              if (lt[Pt.bucketInstanceId] === void 0 && (lt[Pt.bucketInstanceId] = {}), !lt[Pt.bucketInstanceId][Pt.featureIndex]) {
                var Mt = [new i.Point(Ft.x1, Ft.y1), new i.Point(Ft.x2, Ft.y1), new i.Point(Ft.x2, Ft.y2), new i.Point(Ft.x1, Ft.y2)];
                i.polygonIntersectsPolygon(U2, Mt) && (lt[Pt.bucketInstanceId][Pt.featureIndex] = true, bt[Pt.bucketInstanceId] === void 0 && (bt[Pt.bucketInstanceId] = []), bt[Pt.bucketInstanceId].push(Pt.featureIndex));
              }
            }
            return bt;
          }, qr.prototype.insertCollisionBox = function(P2, U2, G2, J2, oe) {
            var de = { bucketInstanceId: G2, featureIndex: J2, collisionGroupID: oe };
            (U2 ? this.ignoredGrid : this.grid).insert(de, P2[0], P2[1], P2[2], P2[3]);
          }, qr.prototype.insertCollisionCircles = function(P2, U2, G2, J2, oe) {
            for (var de = U2 ? this.ignoredGrid : this.grid, ye = { bucketInstanceId: G2, featureIndex: J2, collisionGroupID: oe }, Te = 0; Te < P2.length; Te += 4) de.insertCircle(ye, P2[Te], P2[Te + 1], P2[Te + 2]);
          }, qr.prototype.projectAndGetPerspectiveRatio = function(P2, U2, G2) {
            var J2 = [U2, G2, 0, 1];
            return _n(J2, J2, P2), { point: new i.Point((J2[0] / J2[3] + 1) / 2 * this.transform.width + 100, (-J2[1] / J2[3] + 1) / 2 * this.transform.height + 100), perspectiveRatio: 0.5 + this.transform.cameraToCenterDistance / J2[3] * 0.5 };
          }, qr.prototype.isOffscreen = function(P2, U2, G2, J2) {
            return G2 < 100 || P2 >= this.screenRightBoundary || J2 < 100 || U2 > this.screenBottomBoundary;
          }, qr.prototype.isInsideGrid = function(P2, U2, G2, J2) {
            return G2 >= 0 && P2 < this.gridRightBoundary && J2 >= 0 && U2 < this.gridBottomBoundary;
          }, qr.prototype.getViewportMatrix = function() {
            var P2 = i.identity([]);
            return i.translate(P2, P2, [-100, -100, 0]), P2;
          };
          var Zr = function(P2, U2, G2, J2) {
            this.opacity = P2 ? Math.max(0, Math.min(1, P2.opacity + (P2.placed ? U2 : -U2))) : J2 && G2 ? 1 : 0, this.placed = G2;
          };
          Zr.prototype.isHidden = function() {
            return this.opacity === 0 && !this.placed;
          };
          var oa = function(P2, U2, G2, J2, oe) {
            this.text = new Zr(P2 ? P2.text : null, U2, G2, oe), this.icon = new Zr(P2 ? P2.icon : null, U2, J2, oe);
          };
          oa.prototype.isHidden = function() {
            return this.text.isHidden() && this.icon.isHidden();
          };
          var tn = function(P2, U2, G2) {
            this.text = P2, this.icon = U2, this.skipFade = G2;
          }, Zn = function() {
            this.invProjMatrix = i.create(), this.viewportMatrix = i.create(), this.circles = [];
          }, Ln = function(P2, U2, G2, J2, oe) {
            this.bucketInstanceId = P2, this.featureIndex = U2, this.sourceLayerIndex = G2, this.bucketIndex = J2, this.tileID = oe;
          }, gn = function(P2) {
            this.crossSourceCollisions = P2, this.maxGroupID = 0, this.collisionGroups = {};
          };
          function na(P2, U2, G2, J2, oe) {
            var de = i.getAnchorAlignment(P2), ye = -(de.horizontalAlign - 0.5) * U2, Te = -(de.verticalAlign - 0.5) * G2, Fe = i.evaluateVariableOffset(P2, J2);
            return new i.Point(ye + Fe[0] * oe, Te + Fe[1] * oe);
          }
          function sr(P2, U2, G2, J2, oe, de) {
            var ye = P2.x1, Te = P2.x2, Fe = P2.y1, et = P2.y2, lt = P2.anchorPointX, bt = P2.anchorPointY, It = new i.Point(U2, G2);
            return J2 && It._rotate(oe ? de : -de), { x1: ye + It.x, y1: Fe + It.y, x2: Te + It.x, y2: et + It.y, anchorPointX: lt, anchorPointY: bt };
          }
          gn.prototype.get = function(P2) {
            if (this.crossSourceCollisions) return { ID: 0, predicate: null };
            if (!this.collisionGroups[P2]) {
              var U2 = ++this.maxGroupID;
              this.collisionGroups[P2] = { ID: U2, predicate: function(G2) {
                return G2.collisionGroupID === U2;
              } };
            }
            return this.collisionGroups[P2];
          };
          var Ut = function(P2, U2, G2, J2) {
            this.transform = P2.clone(), this.collisionIndex = new qr(this.transform), this.placements = {}, this.opacities = {}, this.variableOffsets = {}, this.stale = false, this.commitTime = 0, this.fadeDuration = U2, this.retainedQueryData = {}, this.collisionGroups = new gn(G2), this.collisionCircleArrays = {}, this.prevPlacement = J2, J2 && (J2.prevPlacement = void 0), this.placedOrientations = {};
          };
          function Zt(P2, U2, G2, J2, oe) {
            P2.emplaceBack(U2 ? 1 : 0, G2 ? 1 : 0, J2 || 0, oe || 0), P2.emplaceBack(U2 ? 1 : 0, G2 ? 1 : 0, J2 || 0, oe || 0), P2.emplaceBack(U2 ? 1 : 0, G2 ? 1 : 0, J2 || 0, oe || 0), P2.emplaceBack(U2 ? 1 : 0, G2 ? 1 : 0, J2 || 0, oe || 0);
          }
          Ut.prototype.getBucketParts = function(P2, U2, G2, J2) {
            var oe = G2.getBucket(U2), de = G2.latestFeatureIndex;
            if (oe && de && U2.id === oe.layerIds[0]) {
              var ye = G2.collisionBoxArray, Te = oe.layers[0].layout, Fe = Math.pow(2, this.transform.zoom - G2.tileID.overscaledZ), et = G2.tileSize / i.EXTENT, lt = this.transform.calculatePosMatrix(G2.tileID.toUnwrapped()), bt = Te.get("text-pitch-alignment") === "map", It = Te.get("text-rotation-alignment") === "map", Rt = Nr(G2, 1, this.transform.zoom), Ft = Tr(lt, bt, It, this.transform, Rt), Pt = null;
              if (bt) {
                var Mt = yr(lt, bt, It, this.transform, Rt);
                Pt = i.multiply([], this.transform.labelPlaneMatrix, Mt);
              }
              this.retainedQueryData[oe.bucketInstanceId] = new Ln(oe.bucketInstanceId, de, oe.sourceLayerIndex, oe.index, G2.tileID);
              var qt = { bucket: oe, layout: Te, posMatrix: lt, textLabelPlaneMatrix: Ft, labelToScreenMatrix: Pt, scale: Fe, textPixelRatio: et, holdingForFade: G2.holdingForFade(), collisionBoxArray: ye, partiallyEvaluatedTextSize: i.evaluateSizeForZoom(oe.textSizeData, this.transform.zoom), collisionGroup: this.collisionGroups.get(oe.sourceID) };
              if (J2) for (var $t = 0, Yt = oe.sortKeyRanges; $t < Yt.length; $t += 1) {
                var cr = Yt[$t], kr = cr.sortKey, Pr = cr.symbolInstanceStart, Or = cr.symbolInstanceEnd;
                P2.push({ sortKey: kr, symbolInstanceStart: Pr, symbolInstanceEnd: Or, parameters: qt });
              }
              else P2.push({ symbolInstanceStart: 0, symbolInstanceEnd: oe.symbolInstances.length, parameters: qt });
            }
          }, Ut.prototype.attemptAnchorPlacement = function(P2, U2, G2, J2, oe, de, ye, Te, Fe, et, lt, bt, It, Rt, Ft) {
            var Pt, Mt = [bt.textOffset0, bt.textOffset1], qt = na(P2, G2, J2, Mt, oe), $t = this.collisionIndex.placeCollisionBox(sr(U2, qt.x, qt.y, de, ye, this.transform.angle), lt, Te, Fe, et.predicate);
            if (!(Ft && this.collisionIndex.placeCollisionBox(sr(Ft, qt.x, qt.y, de, ye, this.transform.angle), lt, Te, Fe, et.predicate).box.length === 0) && $t.box.length > 0) return this.prevPlacement && this.prevPlacement.variableOffsets[bt.crossTileID] && this.prevPlacement.placements[bt.crossTileID] && this.prevPlacement.placements[bt.crossTileID].text && (Pt = this.prevPlacement.variableOffsets[bt.crossTileID].anchor), this.variableOffsets[bt.crossTileID] = { textOffset: Mt, width: G2, height: J2, anchor: P2, textBoxScale: oe, prevAnchor: Pt }, this.markUsedJustification(It, P2, bt, Rt), It.allowVerticalPlacement && (this.markUsedOrientation(It, Rt, bt), this.placedOrientations[bt.crossTileID] = Rt), { shift: qt, placedGlyphBoxes: $t };
          }, Ut.prototype.placeLayerBucketPart = function(P2, U2, G2) {
            var J2 = this, oe = P2.parameters, de = oe.bucket, ye = oe.layout, Te = oe.posMatrix, Fe = oe.textLabelPlaneMatrix, et = oe.labelToScreenMatrix, lt = oe.textPixelRatio, bt = oe.holdingForFade, It = oe.collisionBoxArray, Rt = oe.partiallyEvaluatedTextSize, Ft = oe.collisionGroup, Pt = ye.get("text-optional"), Mt = ye.get("icon-optional"), qt = ye.get("text-allow-overlap"), $t = ye.get("icon-allow-overlap"), Yt = ye.get("text-rotation-alignment") === "map", cr = ye.get("text-pitch-alignment") === "map", kr = ye.get("icon-text-fit") !== "none", Pr = ye.get("symbol-z-order") === "viewport-y", Or = qt && ($t || !de.hasIconData() || Mt), xn = $t && (qt || !de.hasTextData() || Pt);
            !de.collisionArrays && It && de.deserializeCollisionBoxes(It);
            var yn = function(ln, qn) {
              if (!U2[ln.crossTileID]) if (bt) J2.placements[ln.crossTileID] = new tn(false, false, false);
              else {
                var Sa, _a = false, Pa = false, ii = true, Oi = null, Da = { box: null, offscreen: null }, wi = { box: null, offscreen: null }, di = null, ji = null, ki = 0, Wi = 0, to = 0;
                qn.textFeatureIndex ? ki = qn.textFeatureIndex : ln.useRuntimeCollisionCircles && (ki = ln.featureIndex), qn.verticalTextFeatureIndex && (Wi = qn.verticalTextFeatureIndex);
                var as = qn.textBox;
                if (as) {
                  var js = function(Ms) {
                    var oc = i.WritingMode.horizontal;
                    if (de.allowVerticalPlacement && !Ms && J2.prevPlacement) {
                      var sc = J2.prevPlacement.placedOrientations[ln.crossTileID];
                      sc && (J2.placedOrientations[ln.crossTileID] = sc, oc = sc, J2.markUsedOrientation(de, oc, ln));
                    }
                    return oc;
                  }, Ws = function(Ms, oc) {
                    if (de.allowVerticalPlacement && ln.numVerticalGlyphVertices > 0 && qn.verticalTextBox) for (var sc = 0, y1 = de.writingModes; sc < y1.length && (y1[sc] === i.WritingMode.vertical ? (Da = oc(), wi = Da) : Da = Ms(), !(Da && Da.box && Da.box.length)); sc += 1) ;
                    else Da = Ms();
                  };
                  if (ye.get("text-variable-anchor")) {
                    var Qo = ye.get("text-variable-anchor");
                    if (J2.prevPlacement && J2.prevPlacement.variableOffsets[ln.crossTileID]) {
                      var Cs = J2.prevPlacement.variableOffsets[ln.crossTileID];
                      Qo.indexOf(Cs.anchor) > 0 && (Qo = Qo.filter(function(Ms) {
                        return Ms !== Cs.anchor;
                      })).unshift(Cs.anchor);
                    }
                    var us = function(Ms, oc, sc) {
                      for (var y1 = Ms.x2 - Ms.x1, lE = Ms.y2 - Ms.y1, Qc = ln.textBoxScale, rb = kr && !$t ? oc : null, mm = { box: [], offscreen: false }, uE = qt ? 2 * Qo.length : Qo.length, Nd = 0; Nd < uE; ++Nd) {
                        var cE = Qo[Nd % Qo.length], fE = Nd >= Qo.length, rv = J2.attemptAnchorPlacement(cE, Ms, y1, lE, Qc, Yt, cr, lt, Te, Ft, fE, ln, de, sc, rb);
                        if (rv && (mm = rv.placedGlyphBoxes) && mm.box && mm.box.length) {
                          _a = true, Oi = rv.shift;
                          break;
                        }
                      }
                      return mm;
                    };
                    Ws(function() {
                      return us(as, qn.iconBox, i.WritingMode.horizontal);
                    }, function() {
                      var Ms = qn.verticalTextBox, oc = Da && Da.box && Da.box.length;
                      return de.allowVerticalPlacement && !oc && ln.numVerticalGlyphVertices > 0 && Ms ? us(Ms, qn.verticalIconBox, i.WritingMode.vertical) : { box: null, offscreen: null };
                    }), Da && (_a = Da.box, ii = Da.offscreen);
                    var ku = js(Da && Da.box);
                    if (!_a && J2.prevPlacement) {
                      var El = J2.prevPlacement.variableOffsets[ln.crossTileID];
                      El && (J2.variableOffsets[ln.crossTileID] = El, J2.markUsedJustification(de, El.anchor, ln, ku));
                    }
                  } else {
                    var _c = function(Ms, oc) {
                      var sc = J2.collisionIndex.placeCollisionBox(Ms, qt, lt, Te, Ft.predicate);
                      return sc && sc.box && sc.box.length && (J2.markUsedOrientation(de, oc, ln), J2.placedOrientations[ln.crossTileID] = oc), sc;
                    };
                    Ws(function() {
                      return _c(as, i.WritingMode.horizontal);
                    }, function() {
                      var Ms = qn.verticalTextBox;
                      return de.allowVerticalPlacement && ln.numVerticalGlyphVertices > 0 && Ms ? _c(Ms, i.WritingMode.vertical) : { box: null, offscreen: null };
                    }), js(Da && Da.box && Da.box.length);
                  }
                }
                if (_a = (Sa = Da) && Sa.box && Sa.box.length > 0, ii = Sa && Sa.offscreen, ln.useRuntimeCollisionCircles) {
                  var Jh = de.text.placedSymbolArray.get(ln.centerJustifiedTextSymbolIndex), Id = i.evaluateSizeForFeature(de.textSizeData, Rt, Jh), pm = ye.get("text-padding"), ev = ln.collisionCircleDiameter;
                  di = J2.collisionIndex.placeCollisionCircles(qt, Jh, de.lineVertexArray, de.glyphOffsetArray, Id, Te, Fe, et, G2, cr, Ft.predicate, ev, pm), _a = qt || di.circles.length > 0 && !di.collisionDetected, ii = ii && di.offscreen;
                }
                if (qn.iconFeatureIndex && (to = qn.iconFeatureIndex), qn.iconBox) {
                  var tv = function(Ms) {
                    var oc = kr && Oi ? sr(Ms, Oi.x, Oi.y, Yt, cr, J2.transform.angle) : Ms;
                    return J2.collisionIndex.placeCollisionBox(oc, $t, lt, Te, Ft.predicate);
                  };
                  Pa = wi && wi.box && wi.box.length && qn.verticalIconBox ? (ji = tv(qn.verticalIconBox)).box.length > 0 : (ji = tv(qn.iconBox)).box.length > 0, ii = ii && ji.offscreen;
                }
                var Tu = Pt || ln.numHorizontalGlyphVertices === 0 && ln.numVerticalGlyphVertices === 0, u0 = Mt || ln.numIconVertices === 0;
                if (Tu || u0 ? u0 ? Tu || (Pa = Pa && _a) : _a = Pa && _a : Pa = _a = Pa && _a, _a && Sa && Sa.box && (wi && wi.box && Wi ? J2.collisionIndex.insertCollisionBox(Sa.box, ye.get("text-ignore-placement"), de.bucketInstanceId, Wi, Ft.ID) : J2.collisionIndex.insertCollisionBox(Sa.box, ye.get("text-ignore-placement"), de.bucketInstanceId, ki, Ft.ID)), Pa && ji && J2.collisionIndex.insertCollisionBox(ji.box, ye.get("icon-ignore-placement"), de.bucketInstanceId, to, Ft.ID), di && (_a && J2.collisionIndex.insertCollisionCircles(di.circles, ye.get("text-ignore-placement"), de.bucketInstanceId, ki, Ft.ID), G2)) {
                  var dm = de.bucketInstanceId, Df = J2.collisionCircleArrays[dm];
                  Df === void 0 && (Df = J2.collisionCircleArrays[dm] = new Zn());
                  for (var vm = 0; vm < di.circles.length; vm += 4) Df.circles.push(di.circles[vm + 0]), Df.circles.push(di.circles[vm + 1]), Df.circles.push(di.circles[vm + 2]), Df.circles.push(di.collisionDetected ? 1 : 0);
                }
                J2.placements[ln.crossTileID] = new tn(_a || Or, Pa || xn, ii || de.justReloaded), U2[ln.crossTileID] = true;
              }
            };
            if (Pr) for (var Nn = de.getSortedSymbolIndexes(this.transform.angle), An = Nn.length - 1; An >= 0; --An) {
              var ma = Nn[An];
              yn(de.symbolInstances.get(ma), de.collisionArrays[ma]);
            }
            else for (var Aa = P2.symbolInstanceStart; Aa < P2.symbolInstanceEnd; Aa++) yn(de.symbolInstances.get(Aa), de.collisionArrays[Aa]);
            if (G2 && de.bucketInstanceId in this.collisionCircleArrays) {
              var Qa = this.collisionCircleArrays[de.bucketInstanceId];
              i.invert(Qa.invProjMatrix, Te), Qa.viewportMatrix = this.collisionIndex.getViewportMatrix();
            }
            de.justReloaded = false;
          }, Ut.prototype.markUsedJustification = function(P2, U2, G2, J2) {
            var oe, de = { left: G2.leftJustifiedTextSymbolIndex, center: G2.centerJustifiedTextSymbolIndex, right: G2.rightJustifiedTextSymbolIndex };
            oe = J2 === i.WritingMode.vertical ? G2.verticalPlacedTextSymbolIndex : de[i.getAnchorJustification(U2)];
            for (var ye = 0, Te = [G2.leftJustifiedTextSymbolIndex, G2.centerJustifiedTextSymbolIndex, G2.rightJustifiedTextSymbolIndex, G2.verticalPlacedTextSymbolIndex]; ye < Te.length; ye += 1) {
              var Fe = Te[ye];
              Fe >= 0 && (P2.text.placedSymbolArray.get(Fe).crossTileID = oe >= 0 && Fe !== oe ? 0 : G2.crossTileID);
            }
          }, Ut.prototype.markUsedOrientation = function(P2, U2, G2) {
            for (var J2 = U2 === i.WritingMode.horizontal || U2 === i.WritingMode.horizontalOnly ? U2 : 0, oe = U2 === i.WritingMode.vertical ? U2 : 0, de = 0, ye = [G2.leftJustifiedTextSymbolIndex, G2.centerJustifiedTextSymbolIndex, G2.rightJustifiedTextSymbolIndex]; de < ye.length; de += 1) {
              var Te = ye[de];
              P2.text.placedSymbolArray.get(Te).placedOrientation = J2;
            }
            G2.verticalPlacedTextSymbolIndex && (P2.text.placedSymbolArray.get(G2.verticalPlacedTextSymbolIndex).placedOrientation = oe);
          }, Ut.prototype.commit = function(P2) {
            this.commitTime = P2, this.zoomAtLastRecencyCheck = this.transform.zoom;
            var U2 = this.prevPlacement, G2 = false;
            this.prevZoomAdjustment = U2 ? U2.zoomAdjustment(this.transform.zoom) : 0;
            var J2 = U2 ? U2.symbolFadeChange(P2) : 1, oe = U2 ? U2.opacities : {}, de = U2 ? U2.variableOffsets : {}, ye = U2 ? U2.placedOrientations : {};
            for (var Te in this.placements) {
              var Fe = this.placements[Te], et = oe[Te];
              et ? (this.opacities[Te] = new oa(et, J2, Fe.text, Fe.icon), G2 = G2 || Fe.text !== et.text.placed || Fe.icon !== et.icon.placed) : (this.opacities[Te] = new oa(null, J2, Fe.text, Fe.icon, Fe.skipFade), G2 = G2 || Fe.text || Fe.icon);
            }
            for (var lt in oe) {
              var bt = oe[lt];
              if (!this.opacities[lt]) {
                var It = new oa(bt, J2, false, false);
                It.isHidden() || (this.opacities[lt] = It, G2 = G2 || bt.text.placed || bt.icon.placed);
              }
            }
            for (var Rt in de) this.variableOffsets[Rt] || !this.opacities[Rt] || this.opacities[Rt].isHidden() || (this.variableOffsets[Rt] = de[Rt]);
            for (var Ft in ye) this.placedOrientations[Ft] || !this.opacities[Ft] || this.opacities[Ft].isHidden() || (this.placedOrientations[Ft] = ye[Ft]);
            G2 ? this.lastPlacementChangeTime = P2 : typeof this.lastPlacementChangeTime != "number" && (this.lastPlacementChangeTime = U2 ? U2.lastPlacementChangeTime : P2);
          }, Ut.prototype.updateLayerOpacities = function(P2, U2) {
            for (var G2 = {}, J2 = 0, oe = U2; J2 < oe.length; J2 += 1) {
              var de = oe[J2], ye = de.getBucket(P2);
              ye && de.latestFeatureIndex && P2.id === ye.layerIds[0] && this.updateBucketOpacities(ye, G2, de.collisionBoxArray);
            }
          }, Ut.prototype.updateBucketOpacities = function(P2, U2, G2) {
            var J2 = this;
            P2.hasTextData() && P2.text.opacityVertexArray.clear(), P2.hasIconData() && P2.icon.opacityVertexArray.clear(), P2.hasIconCollisionBoxData() && P2.iconCollisionBox.collisionVertexArray.clear(), P2.hasTextCollisionBoxData() && P2.textCollisionBox.collisionVertexArray.clear();
            var oe = P2.layers[0].layout, de = new oa(null, 0, false, false, true), ye = oe.get("text-allow-overlap"), Te = oe.get("icon-allow-overlap"), Fe = oe.get("text-variable-anchor"), et = oe.get("text-rotation-alignment") === "map", lt = oe.get("text-pitch-alignment") === "map", bt = oe.get("icon-text-fit") !== "none", It = new oa(null, 0, ye && (Te || !P2.hasIconData() || oe.get("icon-optional")), Te && (ye || !P2.hasTextData() || oe.get("text-optional")), true);
            !P2.collisionArrays && G2 && (P2.hasIconCollisionBoxData() || P2.hasTextCollisionBoxData()) && P2.deserializeCollisionBoxes(G2);
            for (var Rt = function(qt, $t, Yt) {
              for (var cr = 0; cr < $t / 4; cr++) qt.opacityVertexArray.emplaceBack(Yt);
            }, Ft = function(qt) {
              var $t = P2.symbolInstances.get(qt), Yt = $t.numHorizontalGlyphVertices, cr = $t.numVerticalGlyphVertices, kr = $t.crossTileID, Pr = U2[kr], Or = J2.opacities[kr];
              Pr ? Or = de : Or || (Or = It, J2.opacities[kr] = Or), U2[kr] = true;
              var xn = Yt > 0 || cr > 0, yn = $t.numIconVertices > 0, Nn = J2.placedOrientations[$t.crossTileID], An = Nn === i.WritingMode.vertical, ma = Nn === i.WritingMode.horizontal || Nn === i.WritingMode.horizontalOnly;
              if (xn) {
                var Aa = jr(Or.text), Qa = An ? Rr : Aa;
                Rt(P2.text, Yt, Qa);
                var ln = ma ? Rr : Aa;
                Rt(P2.text, cr, ln);
                var qn = Or.text.isHidden();
                [$t.rightJustifiedTextSymbolIndex, $t.centerJustifiedTextSymbolIndex, $t.leftJustifiedTextSymbolIndex].forEach(function(to) {
                  to >= 0 && (P2.text.placedSymbolArray.get(to).hidden = qn || An ? 1 : 0);
                }), $t.verticalPlacedTextSymbolIndex >= 0 && (P2.text.placedSymbolArray.get($t.verticalPlacedTextSymbolIndex).hidden = qn || ma ? 1 : 0);
                var Sa = J2.variableOffsets[$t.crossTileID];
                Sa && J2.markUsedJustification(P2, Sa.anchor, $t, Nn);
                var _a = J2.placedOrientations[$t.crossTileID];
                _a && (J2.markUsedJustification(P2, "left", $t, _a), J2.markUsedOrientation(P2, _a, $t));
              }
              if (yn) {
                var Pa = jr(Or.icon), ii = !(bt && $t.verticalPlacedIconSymbolIndex && An);
                if ($t.placedIconSymbolIndex >= 0) {
                  var Oi = ii ? Pa : Rr;
                  Rt(P2.icon, $t.numIconVertices, Oi), P2.icon.placedSymbolArray.get($t.placedIconSymbolIndex).hidden = Or.icon.isHidden();
                }
                if ($t.verticalPlacedIconSymbolIndex >= 0) {
                  var Da = ii ? Rr : Pa;
                  Rt(P2.icon, $t.numVerticalIconVertices, Da), P2.icon.placedSymbolArray.get($t.verticalPlacedIconSymbolIndex).hidden = Or.icon.isHidden();
                }
              }
              if (P2.hasIconCollisionBoxData() || P2.hasTextCollisionBoxData()) {
                var wi = P2.collisionArrays[qt];
                if (wi) {
                  var di = new i.Point(0, 0);
                  if (wi.textBox || wi.verticalTextBox) {
                    var ji = true;
                    if (Fe) {
                      var ki = J2.variableOffsets[kr];
                      ki ? (di = na(ki.anchor, ki.width, ki.height, ki.textOffset, ki.textBoxScale), et && di._rotate(lt ? J2.transform.angle : -J2.transform.angle)) : ji = false;
                    }
                    wi.textBox && Zt(P2.textCollisionBox.collisionVertexArray, Or.text.placed, !ji || An, di.x, di.y), wi.verticalTextBox && Zt(P2.textCollisionBox.collisionVertexArray, Or.text.placed, !ji || ma, di.x, di.y);
                  }
                  var Wi = Boolean(!ma && wi.verticalIconBox);
                  wi.iconBox && Zt(P2.iconCollisionBox.collisionVertexArray, Or.icon.placed, Wi, bt ? di.x : 0, bt ? di.y : 0), wi.verticalIconBox && Zt(P2.iconCollisionBox.collisionVertexArray, Or.icon.placed, !Wi, bt ? di.x : 0, bt ? di.y : 0);
                }
              }
            }, Pt = 0; Pt < P2.symbolInstances.length; Pt++) Ft(Pt);
            if (P2.sortFeatures(this.transform.angle), this.retainedQueryData[P2.bucketInstanceId] && (this.retainedQueryData[P2.bucketInstanceId].featureSortOrder = P2.featureSortOrder), P2.hasTextData() && P2.text.opacityVertexBuffer && P2.text.opacityVertexBuffer.updateData(P2.text.opacityVertexArray), P2.hasIconData() && P2.icon.opacityVertexBuffer && P2.icon.opacityVertexBuffer.updateData(P2.icon.opacityVertexArray), P2.hasIconCollisionBoxData() && P2.iconCollisionBox.collisionVertexBuffer && P2.iconCollisionBox.collisionVertexBuffer.updateData(P2.iconCollisionBox.collisionVertexArray), P2.hasTextCollisionBoxData() && P2.textCollisionBox.collisionVertexBuffer && P2.textCollisionBox.collisionVertexBuffer.updateData(P2.textCollisionBox.collisionVertexArray), P2.bucketInstanceId in this.collisionCircleArrays) {
              var Mt = this.collisionCircleArrays[P2.bucketInstanceId];
              P2.placementInvProjMatrix = Mt.invProjMatrix, P2.placementViewportMatrix = Mt.viewportMatrix, P2.collisionCircleArray = Mt.circles, delete this.collisionCircleArrays[P2.bucketInstanceId];
            }
          }, Ut.prototype.symbolFadeChange = function(P2) {
            return this.fadeDuration === 0 ? 1 : (P2 - this.commitTime) / this.fadeDuration + this.prevZoomAdjustment;
          }, Ut.prototype.zoomAdjustment = function(P2) {
            return Math.max(0, (this.transform.zoom - P2) / 1.5);
          }, Ut.prototype.hasTransitions = function(P2) {
            return this.stale || P2 - this.lastPlacementChangeTime < this.fadeDuration;
          }, Ut.prototype.stillRecent = function(P2, U2) {
            var G2 = this.zoomAtLastRecencyCheck === U2 ? 1 - this.zoomAdjustment(U2) : 1;
            return this.zoomAtLastRecencyCheck = U2, this.commitTime + this.fadeDuration * G2 > P2;
          }, Ut.prototype.setStale = function() {
            this.stale = true;
          };
          var xr = Math.pow(2, 25), Fr = Math.pow(2, 24), pn = Math.pow(2, 17), un = Math.pow(2, 16), Ir = Math.pow(2, 9), Cr = Math.pow(2, 8), Lr = Math.pow(2, 1);
          function jr(P2) {
            if (P2.opacity === 0 && !P2.placed) return 0;
            if (P2.opacity === 1 && P2.placed) return 4294967295;
            var U2 = P2.placed ? 1 : 0, G2 = Math.floor(127 * P2.opacity);
            return G2 * xr + U2 * Fr + G2 * pn + U2 * un + G2 * Ir + U2 * Cr + G2 * Lr + U2;
          }
          var Rr = 0, vn = function(P2) {
            this._sortAcrossTiles = P2.layout.get("symbol-z-order") !== "viewport-y" && P2.layout.get("symbol-sort-key").constantOr(1) !== void 0, this._currentTileIndex = 0, this._currentPartIndex = 0, this._seenCrossTileIDs = {}, this._bucketParts = [];
          };
          vn.prototype.continuePlacement = function(P2, U2, G2, J2, oe) {
            for (var de = this._bucketParts; this._currentTileIndex < P2.length; ) {
              var ye = P2[this._currentTileIndex];
              if (U2.getBucketParts(de, J2, ye, this._sortAcrossTiles), this._currentTileIndex++, oe()) return true;
            }
            for (this._sortAcrossTiles && (this._sortAcrossTiles = false, de.sort(function(Fe, et) {
              return Fe.sortKey - et.sortKey;
            })); this._currentPartIndex < de.length; ) {
              var Te = de[this._currentPartIndex];
              if (U2.placeLayerBucketPart(Te, this._seenCrossTileIDs, G2), this._currentPartIndex++, oe()) return true;
            }
            return false;
          };
          var Mn = function(P2, U2, G2, J2, oe, de, ye) {
            this.placement = new Ut(P2, oe, de, ye), this._currentPlacementIndex = U2.length - 1, this._forceFullPlacement = G2, this._showCollisionBoxes = J2, this._done = false;
          };
          Mn.prototype.isDone = function() {
            return this._done;
          }, Mn.prototype.continuePlacement = function(P2, U2, G2) {
            for (var J2 = this, oe = i.browser.now(), de = function() {
              var Fe = i.browser.now() - oe;
              return !J2._forceFullPlacement && Fe > 2;
            }; this._currentPlacementIndex >= 0; ) {
              var ye = U2[P2[this._currentPlacementIndex]], Te = this.placement.collisionIndex.transform.zoom;
              if (ye.type === "symbol" && (!ye.minzoom || ye.minzoom <= Te) && (!ye.maxzoom || ye.maxzoom > Te)) {
                if (this._inProgressLayer || (this._inProgressLayer = new vn(ye)), this._inProgressLayer.continuePlacement(G2[ye.source], this.placement, this._showCollisionBoxes, ye, de)) return;
                delete this._inProgressLayer;
              }
              this._currentPlacementIndex--;
            }
            this._done = true;
          }, Mn.prototype.commit = function(P2) {
            return this.placement.commit(P2), this.placement;
          };
          var jn = 512 / i.EXTENT / 2, bn = function(P2, U2, G2) {
            this.tileID = P2, this.indexedSymbolInstances = {}, this.bucketInstanceId = G2;
            for (var J2 = 0; J2 < U2.length; J2++) {
              var oe = U2.get(J2), de = oe.key;
              this.indexedSymbolInstances[de] || (this.indexedSymbolInstances[de] = []), this.indexedSymbolInstances[de].push({ crossTileID: oe.crossTileID, coord: this.getScaledCoordinates(oe, P2) });
            }
          };
          bn.prototype.getScaledCoordinates = function(P2, U2) {
            var G2 = U2.canonical.z - this.tileID.canonical.z, J2 = jn / Math.pow(2, G2);
            return { x: Math.floor((U2.canonical.x * i.EXTENT + P2.anchorX) * J2), y: Math.floor((U2.canonical.y * i.EXTENT + P2.anchorY) * J2) };
          }, bn.prototype.findMatches = function(P2, U2, G2) {
            for (var J2 = this.tileID.canonical.z < U2.canonical.z ? 1 : Math.pow(2, this.tileID.canonical.z - U2.canonical.z), oe = 0; oe < P2.length; oe++) {
              var de = P2.get(oe);
              if (!de.crossTileID) {
                var ye = this.indexedSymbolInstances[de.key];
                if (ye) for (var Te = this.getScaledCoordinates(de, U2), Fe = 0, et = ye; Fe < et.length; Fe += 1) {
                  var lt = et[Fe];
                  if (Math.abs(lt.coord.x - Te.x) <= J2 && Math.abs(lt.coord.y - Te.y) <= J2 && !G2[lt.crossTileID]) {
                    G2[lt.crossTileID] = true, de.crossTileID = lt.crossTileID;
                    break;
                  }
                }
              }
            }
          };
          var Bn = function() {
            this.maxCrossTileID = 0;
          };
          Bn.prototype.generate = function() {
            return ++this.maxCrossTileID;
          };
          var sn = function() {
            this.indexes = {}, this.usedCrossTileIDs = {}, this.lng = 0;
          };
          sn.prototype.handleWrapJump = function(P2) {
            var U2 = Math.round((P2 - this.lng) / 360);
            if (U2 !== 0) for (var G2 in this.indexes) {
              var J2 = this.indexes[G2], oe = {};
              for (var de in J2) {
                var ye = J2[de];
                ye.tileID = ye.tileID.unwrapTo(ye.tileID.wrap + U2), oe[ye.tileID.key] = ye;
              }
              this.indexes[G2] = oe;
            }
            this.lng = P2;
          }, sn.prototype.addBucket = function(P2, U2, G2) {
            if (this.indexes[P2.overscaledZ] && this.indexes[P2.overscaledZ][P2.key]) {
              if (this.indexes[P2.overscaledZ][P2.key].bucketInstanceId === U2.bucketInstanceId) return false;
              this.removeBucketCrossTileIDs(P2.overscaledZ, this.indexes[P2.overscaledZ][P2.key]);
            }
            for (var J2 = 0; J2 < U2.symbolInstances.length; J2++) U2.symbolInstances.get(J2).crossTileID = 0;
            this.usedCrossTileIDs[P2.overscaledZ] || (this.usedCrossTileIDs[P2.overscaledZ] = {});
            var oe = this.usedCrossTileIDs[P2.overscaledZ];
            for (var de in this.indexes) {
              var ye = this.indexes[de];
              if (Number(de) > P2.overscaledZ) for (var Te in ye) {
                var Fe = ye[Te];
                Fe.tileID.isChildOf(P2) && Fe.findMatches(U2.symbolInstances, P2, oe);
              }
              else {
                var et = ye[P2.scaledTo(Number(de)).key];
                et && et.findMatches(U2.symbolInstances, P2, oe);
              }
            }
            for (var lt = 0; lt < U2.symbolInstances.length; lt++) {
              var bt = U2.symbolInstances.get(lt);
              bt.crossTileID || (bt.crossTileID = G2.generate(), oe[bt.crossTileID] = true);
            }
            return this.indexes[P2.overscaledZ] === void 0 && (this.indexes[P2.overscaledZ] = {}), this.indexes[P2.overscaledZ][P2.key] = new bn(P2, U2.symbolInstances, U2.bucketInstanceId), true;
          }, sn.prototype.removeBucketCrossTileIDs = function(P2, U2) {
            for (var G2 in U2.indexedSymbolInstances) for (var J2 = 0, oe = U2.indexedSymbolInstances[G2]; J2 < oe.length; J2 += 1) {
              var de = oe[J2];
              delete this.usedCrossTileIDs[P2][de.crossTileID];
            }
          }, sn.prototype.removeStaleBuckets = function(P2) {
            var U2 = false;
            for (var G2 in this.indexes) {
              var J2 = this.indexes[G2];
              for (var oe in J2) P2[J2[oe].bucketInstanceId] || (this.removeBucketCrossTileIDs(G2, J2[oe]), delete J2[oe], U2 = true);
            }
            return U2;
          };
          var an = function() {
            this.layerIndexes = {}, this.crossTileIDs = new Bn(), this.maxBucketInstanceId = 0, this.bucketsInCurrentPlacement = {};
          };
          an.prototype.addLayer = function(P2, U2, G2) {
            var J2 = this.layerIndexes[P2.id];
            J2 === void 0 && (J2 = this.layerIndexes[P2.id] = new sn());
            var oe = false, de = {};
            J2.handleWrapJump(G2);
            for (var ye = 0, Te = U2; ye < Te.length; ye += 1) {
              var Fe = Te[ye], et = Fe.getBucket(P2);
              et && P2.id === et.layerIds[0] && (et.bucketInstanceId || (et.bucketInstanceId = ++this.maxBucketInstanceId), J2.addBucket(Fe.tileID, et, this.crossTileIDs) && (oe = true), de[et.bucketInstanceId] = true);
            }
            return J2.removeStaleBuckets(de) && (oe = true), oe;
          }, an.prototype.pruneUnusedLayers = function(P2) {
            var U2 = {};
            for (var G2 in P2.forEach(function(J2) {
              U2[J2] = true;
            }), this.layerIndexes) U2[G2] || delete this.layerIndexes[G2];
          };
          var Sn = function(P2, U2) {
            return i.emitValidationErrors(P2, U2 && U2.filter(function(G2) {
              return G2.identifier !== "source.canvas";
            }));
          }, Rn = i.pick(ze, ["addLayer", "removeLayer", "setPaintProperty", "setLayoutProperty", "setFilter", "addSource", "removeSource", "setLayerZoomRange", "setLight", "setTransition", "setGeoJSONSourceData"]), Kn = i.pick(ze, ["setCenter", "setZoom", "setBearing", "setPitch"]), qa = function() {
            var P2 = {}, U2 = i.styleSpec.$version;
            for (var G2 in i.styleSpec.$root) {
              var J2 = i.styleSpec.$root[G2];
              if (J2.required) {
                var oe = null;
                (oe = G2 === "version" ? U2 : J2.type === "array" ? [] : {}) != null && (P2[G2] = oe);
              }
            }
            return P2;
          }(), ka = function(P2) {
            function U2(G2, J2) {
              var oe = this;
              J2 === void 0 && (J2 = {}), P2.call(this), this.map = G2, this.dispatcher = new D2(ke(), this), this.imageManager = new b(), this.imageManager.setEventedParent(this), this.glyphManager = new S2(G2._requestManager, J2.localIdeographFontFamily), this.lineAtlas = new N2(256, 512), this.crossTileSymbolIndex = new an(), this._layers = {}, this._serializedLayers = {}, this._order = [], this.sourceCaches = {}, this.zoomHistory = new i.ZoomHistory(), this._loaded = false, this._availableImages = [], this._resetUpdates(), this.dispatcher.broadcast("setReferrer", i.getReferrer());
              var de = this;
              this._rtlTextPluginCallback = U2.registerForPluginStateChange(function(ye) {
                var Te = { pluginStatus: ye.pluginStatus, pluginURL: ye.pluginURL };
                de.dispatcher.broadcast("syncRTLPluginState", Te, function(Fe, et) {
                  if (i.triggerPluginCompletionEvent(Fe), et && et.every(function(bt) {
                    return bt;
                  })) for (var lt in de.sourceCaches) de.sourceCaches[lt].reload();
                });
              }), this.on("data", function(ye) {
                if (ye.dataType === "source" && ye.sourceDataType === "metadata") {
                  var Te = oe.sourceCaches[ye.sourceId];
                  if (Te) {
                    var Fe = Te.getSource();
                    if (Fe && Fe.vectorLayerIds) for (var et in oe._layers) {
                      var lt = oe._layers[et];
                      lt.source === Fe.id && oe._validateLayer(lt);
                    }
                  }
                }
              });
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.loadURL = function(G2, J2) {
              var oe = this;
              J2 === void 0 && (J2 = {}), this.fire(new i.Event("dataloading", { dataType: "style" }));
              var de = typeof J2.validate == "boolean" ? J2.validate : !i.isMapboxURL(G2);
              G2 = this.map._requestManager.normalizeStyleURL(G2, J2.accessToken);
              var ye = this.map._requestManager.transformRequest(G2, i.ResourceType.Style);
              this._request = i.getJSON(ye, function(Te, Fe) {
                oe._request = null, Te ? oe.fire(new i.ErrorEvent(Te)) : Fe && oe._load(Fe, de);
              });
            }, U2.prototype.loadJSON = function(G2, J2) {
              var oe = this;
              J2 === void 0 && (J2 = {}), this.fire(new i.Event("dataloading", { dataType: "style" })), this._request = i.browser.frame(function() {
                oe._request = null, oe._load(G2, J2.validate !== false);
              });
            }, U2.prototype.loadEmpty = function() {
              this.fire(new i.Event("dataloading", { dataType: "style" })), this._load(qa, false);
            }, U2.prototype._load = function(G2, J2) {
              if (!J2 || !Sn(this, i.validateStyle(G2))) {
                for (var oe in this._loaded = true, this.stylesheet = G2, G2.sources) this.addSource(oe, G2.sources[oe], { validate: false });
                G2.sprite ? this._loadSprite(G2.sprite) : this.imageManager.setLoaded(true), this.glyphManager.setURL(G2.glyphs);
                var de = Le(this.stylesheet.layers);
                this._order = de.map(function(et) {
                  return et.id;
                }), this._layers = {}, this._serializedLayers = {};
                for (var ye = 0, Te = de; ye < Te.length; ye += 1) {
                  var Fe = Te[ye];
                  (Fe = i.createStyleLayer(Fe)).setEventedParent(this, { layer: { id: Fe.id } }), this._layers[Fe.id] = Fe, this._serializedLayers[Fe.id] = Fe.serialize();
                }
                this.dispatcher.broadcast("setLayers", this._serializeLayers(this._order)), this.light = new F13(this.stylesheet.light), this.fire(new i.Event("data", { dataType: "style" })), this.fire(new i.Event("style.load"));
              }
            }, U2.prototype._loadSprite = function(G2) {
              var J2 = this;
              this._spriteRequest = function(oe, de, ye) {
                var Te, Fe, et, lt = i.browser.devicePixelRatio > 1 ? "@2x" : "", bt = i.getJSON(de.transformRequest(de.normalizeSpriteURL(oe, lt, ".json"), i.ResourceType.SpriteJSON), function(Ft, Pt) {
                  bt = null, et || (et = Ft, Te = Pt, Rt());
                }), It = i.getImage(de.transformRequest(de.normalizeSpriteURL(oe, lt, ".png"), i.ResourceType.SpriteImage), function(Ft, Pt) {
                  It = null, et || (et = Ft, Fe = Pt, Rt());
                });
                function Rt() {
                  if (et) ye(et);
                  else if (Te && Fe) {
                    var Ft = i.browser.getImageData(Fe), Pt = {};
                    for (var Mt in Te) {
                      var qt = Te[Mt], $t = qt.width, Yt = qt.height, cr = qt.x, kr = qt.y, Pr = qt.sdf, Or = qt.pixelRatio, xn = qt.stretchX, yn = qt.stretchY, Nn = qt.content, An = new i.RGBAImage({ width: $t, height: Yt });
                      i.RGBAImage.copy(Ft, An, { x: cr, y: kr }, { x: 0, y: 0 }, { width: $t, height: Yt }), Pt[Mt] = { data: An, pixelRatio: Or, sdf: Pr, stretchX: xn, stretchY: yn, content: Nn };
                    }
                    ye(null, Pt);
                  }
                }
                return { cancel: function() {
                  bt && (bt.cancel(), bt = null), It && (It.cancel(), It = null);
                } };
              }(G2, this.map._requestManager, function(oe, de) {
                if (J2._spriteRequest = null, oe) J2.fire(new i.ErrorEvent(oe));
                else if (de) for (var ye in de) J2.imageManager.addImage(ye, de[ye]);
                J2.imageManager.setLoaded(true), J2._availableImages = J2.imageManager.listImages(), J2.dispatcher.broadcast("setImages", J2._availableImages), J2.fire(new i.Event("data", { dataType: "style" }));
              });
            }, U2.prototype._validateLayer = function(G2) {
              var J2 = this.sourceCaches[G2.source];
              if (J2) {
                var oe = G2.sourceLayer;
                if (oe) {
                  var de = J2.getSource();
                  (de.type === "geojson" || de.vectorLayerIds && de.vectorLayerIds.indexOf(oe) === -1) && this.fire(new i.ErrorEvent(new Error('Source layer "' + oe + '" does not exist on source "' + de.id + '" as specified by style layer "' + G2.id + '"')));
                }
              }
            }, U2.prototype.loaded = function() {
              if (!this._loaded || Object.keys(this._updatedSources).length) return false;
              for (var G2 in this.sourceCaches) if (!this.sourceCaches[G2].loaded()) return false;
              return !!this.imageManager.isLoaded();
            }, U2.prototype._serializeLayers = function(G2) {
              for (var J2 = [], oe = 0, de = G2; oe < de.length; oe += 1) {
                var ye = de[oe], Te = this._layers[ye];
                Te.type !== "custom" && J2.push(Te.serialize());
              }
              return J2;
            }, U2.prototype.hasTransitions = function() {
              if (this.light && this.light.hasTransition()) return true;
              for (var G2 in this.sourceCaches) if (this.sourceCaches[G2].hasTransition()) return true;
              for (var J2 in this._layers) if (this._layers[J2].hasTransition()) return true;
              return false;
            }, U2.prototype._checkLoaded = function() {
              if (!this._loaded) throw new Error("Style is not done loading");
            }, U2.prototype.update = function(G2) {
              if (this._loaded) {
                var J2 = this._changed;
                if (this._changed) {
                  var oe = Object.keys(this._updatedLayers), de = Object.keys(this._removedLayers);
                  for (var ye in (oe.length || de.length) && this._updateWorkerLayers(oe, de), this._updatedSources) {
                    var Te = this._updatedSources[ye];
                    Te === "reload" ? this._reloadSource(ye) : Te === "clear" && this._clearSource(ye);
                  }
                  for (var Fe in this._updateTilesForChangedImages(), this._updatedPaintProps) this._layers[Fe].updateTransitions(G2);
                  this.light.updateTransitions(G2), this._resetUpdates();
                }
                for (var et in this.sourceCaches) this.sourceCaches[et].used = false;
                for (var lt = 0, bt = this._order; lt < bt.length; lt += 1) {
                  var It = bt[lt], Rt = this._layers[It];
                  Rt.recalculate(G2, this._availableImages), !Rt.isHidden(G2.zoom) && Rt.source && (this.sourceCaches[Rt.source].used = true);
                }
                this.light.recalculate(G2), this.z = G2.zoom, J2 && this.fire(new i.Event("data", { dataType: "style" }));
              }
            }, U2.prototype._updateTilesForChangedImages = function() {
              var G2 = Object.keys(this._changedImages);
              if (G2.length) {
                for (var J2 in this.sourceCaches) this.sourceCaches[J2].reloadTilesForDependencies(["icons", "patterns"], G2);
                this._changedImages = {};
              }
            }, U2.prototype._updateWorkerLayers = function(G2, J2) {
              this.dispatcher.broadcast("updateLayers", { layers: this._serializeLayers(G2), removedIds: J2 });
            }, U2.prototype._resetUpdates = function() {
              this._changed = false, this._updatedLayers = {}, this._removedLayers = {}, this._updatedSources = {}, this._updatedPaintProps = {}, this._changedImages = {};
            }, U2.prototype.setState = function(G2) {
              var J2 = this;
              if (this._checkLoaded(), Sn(this, i.validateStyle(G2))) return false;
              (G2 = i.clone$1(G2)).layers = Le(G2.layers);
              var oe = Vt(this.serialize(), G2).filter(function(ye) {
                return !(ye.command in Kn);
              });
              if (oe.length === 0) return false;
              var de = oe.filter(function(ye) {
                return !(ye.command in Rn);
              });
              if (de.length > 0) throw new Error("Unimplemented: " + de.map(function(ye) {
                return ye.command;
              }).join(", ") + ".");
              return oe.forEach(function(ye) {
                ye.command !== "setTransition" && J2[ye.command].apply(J2, ye.args);
              }), this.stylesheet = G2, true;
            }, U2.prototype.addImage = function(G2, J2) {
              if (this.getImage(G2)) return this.fire(new i.ErrorEvent(new Error("An image with this name already exists.")));
              this.imageManager.addImage(G2, J2), this._availableImages = this.imageManager.listImages(), this._changedImages[G2] = true, this._changed = true, this.fire(new i.Event("data", { dataType: "style" }));
            }, U2.prototype.updateImage = function(G2, J2) {
              this.imageManager.updateImage(G2, J2);
            }, U2.prototype.getImage = function(G2) {
              return this.imageManager.getImage(G2);
            }, U2.prototype.removeImage = function(G2) {
              if (!this.getImage(G2)) return this.fire(new i.ErrorEvent(new Error("No image with this name exists.")));
              this.imageManager.removeImage(G2), this._availableImages = this.imageManager.listImages(), this._changedImages[G2] = true, this._changed = true, this.fire(new i.Event("data", { dataType: "style" }));
            }, U2.prototype.listImages = function() {
              return this._checkLoaded(), this.imageManager.listImages();
            }, U2.prototype.addSource = function(G2, J2, oe) {
              var de = this;
              if (oe === void 0 && (oe = {}), this._checkLoaded(), this.sourceCaches[G2] !== void 0) throw new Error("There is already a source with this ID");
              if (!J2.type) throw new Error("The type property must be defined, but the only the following properties were given: " + Object.keys(J2).join(", ") + ".");
              if (!(["vector", "raster", "geojson", "video", "image"].indexOf(J2.type) >= 0) || !this._validate(i.validateStyle.source, "sources." + G2, J2, null, oe)) {
                this.map && this.map._collectResourceTiming && (J2.collectResourceTiming = true);
                var ye = this.sourceCaches[G2] = new ut(G2, J2, this.dispatcher);
                ye.style = this, ye.setEventedParent(this, function() {
                  return { isSourceLoaded: de.loaded(), source: ye.serialize(), sourceId: G2 };
                }), ye.onAdd(this.map), this._changed = true;
              }
            }, U2.prototype.removeSource = function(G2) {
              if (this._checkLoaded(), this.sourceCaches[G2] === void 0) throw new Error("There is no source with this ID");
              for (var J2 in this._layers) if (this._layers[J2].source === G2) return this.fire(new i.ErrorEvent(new Error('Source "' + G2 + '" cannot be removed while layer "' + J2 + '" is using it.')));
              var oe = this.sourceCaches[G2];
              delete this.sourceCaches[G2], delete this._updatedSources[G2], oe.fire(new i.Event("data", { sourceDataType: "metadata", dataType: "source", sourceId: G2 })), oe.setEventedParent(null), oe.clearTiles(), oe.onRemove && oe.onRemove(this.map), this._changed = true;
            }, U2.prototype.setGeoJSONSourceData = function(G2, J2) {
              this._checkLoaded(), this.sourceCaches[G2].getSource().setData(J2), this._changed = true;
            }, U2.prototype.getSource = function(G2) {
              return this.sourceCaches[G2] && this.sourceCaches[G2].getSource();
            }, U2.prototype.addLayer = function(G2, J2, oe) {
              oe === void 0 && (oe = {}), this._checkLoaded();
              var de = G2.id;
              if (this.getLayer(de)) this.fire(new i.ErrorEvent(new Error('Layer with id "' + de + '" already exists on this map')));
              else {
                var ye;
                if (G2.type === "custom") {
                  if (Sn(this, i.validateCustomStyleLayer(G2))) return;
                  ye = i.createStyleLayer(G2);
                } else {
                  if (typeof G2.source == "object" && (this.addSource(de, G2.source), G2 = i.clone$1(G2), G2 = i.extend(G2, { source: de })), this._validate(i.validateStyle.layer, "layers." + de, G2, { arrayIndex: -1 }, oe)) return;
                  ye = i.createStyleLayer(G2), this._validateLayer(ye), ye.setEventedParent(this, { layer: { id: de } }), this._serializedLayers[ye.id] = ye.serialize();
                }
                var Te = J2 ? this._order.indexOf(J2) : this._order.length;
                if (J2 && Te === -1) this.fire(new i.ErrorEvent(new Error('Layer with id "' + J2 + '" does not exist on this map.')));
                else {
                  if (this._order.splice(Te, 0, de), this._layerOrderChanged = true, this._layers[de] = ye, this._removedLayers[de] && ye.source && ye.type !== "custom") {
                    var Fe = this._removedLayers[de];
                    delete this._removedLayers[de], Fe.type !== ye.type ? this._updatedSources[ye.source] = "clear" : (this._updatedSources[ye.source] = "reload", this.sourceCaches[ye.source].pause());
                  }
                  this._updateLayer(ye), ye.onAdd && ye.onAdd(this.map);
                }
              }
            }, U2.prototype.moveLayer = function(G2, J2) {
              if (this._checkLoaded(), this._changed = true, this._layers[G2]) {
                if (G2 !== J2) {
                  var oe = this._order.indexOf(G2);
                  this._order.splice(oe, 1);
                  var de = J2 ? this._order.indexOf(J2) : this._order.length;
                  J2 && de === -1 ? this.fire(new i.ErrorEvent(new Error('Layer with id "' + J2 + '" does not exist on this map.'))) : (this._order.splice(de, 0, G2), this._layerOrderChanged = true);
                }
              } else this.fire(new i.ErrorEvent(new Error("The layer '" + G2 + "' does not exist in the map's style and cannot be moved.")));
            }, U2.prototype.removeLayer = function(G2) {
              this._checkLoaded();
              var J2 = this._layers[G2];
              if (J2) {
                J2.setEventedParent(null);
                var oe = this._order.indexOf(G2);
                this._order.splice(oe, 1), this._layerOrderChanged = true, this._changed = true, this._removedLayers[G2] = J2, delete this._layers[G2], delete this._serializedLayers[G2], delete this._updatedLayers[G2], delete this._updatedPaintProps[G2], J2.onRemove && J2.onRemove(this.map);
              } else this.fire(new i.ErrorEvent(new Error("The layer '" + G2 + "' does not exist in the map's style and cannot be removed.")));
            }, U2.prototype.getLayer = function(G2) {
              return this._layers[G2];
            }, U2.prototype.hasLayer = function(G2) {
              return G2 in this._layers;
            }, U2.prototype.setLayerZoomRange = function(G2, J2, oe) {
              this._checkLoaded();
              var de = this.getLayer(G2);
              de ? de.minzoom === J2 && de.maxzoom === oe || (J2 != null && (de.minzoom = J2), oe != null && (de.maxzoom = oe), this._updateLayer(de)) : this.fire(new i.ErrorEvent(new Error("The layer '" + G2 + "' does not exist in the map's style and cannot have zoom extent.")));
            }, U2.prototype.setFilter = function(G2, J2, oe) {
              oe === void 0 && (oe = {}), this._checkLoaded();
              var de = this.getLayer(G2);
              if (de) {
                if (!i.deepEqual(de.filter, J2)) return J2 == null ? (de.filter = void 0, void this._updateLayer(de)) : void (this._validate(i.validateStyle.filter, "layers." + de.id + ".filter", J2, null, oe) || (de.filter = i.clone$1(J2), this._updateLayer(de)));
              } else this.fire(new i.ErrorEvent(new Error("The layer '" + G2 + "' does not exist in the map's style and cannot be filtered.")));
            }, U2.prototype.getFilter = function(G2) {
              return i.clone$1(this.getLayer(G2).filter);
            }, U2.prototype.setLayoutProperty = function(G2, J2, oe, de) {
              de === void 0 && (de = {}), this._checkLoaded();
              var ye = this.getLayer(G2);
              ye ? i.deepEqual(ye.getLayoutProperty(J2), oe) || (ye.setLayoutProperty(J2, oe, de), this._updateLayer(ye)) : this.fire(new i.ErrorEvent(new Error("The layer '" + G2 + "' does not exist in the map's style and cannot be styled.")));
            }, U2.prototype.getLayoutProperty = function(G2, J2) {
              var oe = this.getLayer(G2);
              if (oe) return oe.getLayoutProperty(J2);
              this.fire(new i.ErrorEvent(new Error("The layer '" + G2 + "' does not exist in the map's style.")));
            }, U2.prototype.setPaintProperty = function(G2, J2, oe, de) {
              de === void 0 && (de = {}), this._checkLoaded();
              var ye = this.getLayer(G2);
              ye ? i.deepEqual(ye.getPaintProperty(J2), oe) || (ye.setPaintProperty(J2, oe, de) && this._updateLayer(ye), this._changed = true, this._updatedPaintProps[G2] = true) : this.fire(new i.ErrorEvent(new Error("The layer '" + G2 + "' does not exist in the map's style and cannot be styled.")));
            }, U2.prototype.getPaintProperty = function(G2, J2) {
              return this.getLayer(G2).getPaintProperty(J2);
            }, U2.prototype.setFeatureState = function(G2, J2) {
              this._checkLoaded();
              var oe = G2.source, de = G2.sourceLayer, ye = this.sourceCaches[oe];
              if (ye !== void 0) {
                var Te = ye.getSource().type;
                Te === "geojson" && de ? this.fire(new i.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))) : Te !== "vector" || de ? (G2.id === void 0 && this.fire(new i.ErrorEvent(new Error("The feature id parameter must be provided."))), ye.setFeatureState(de, G2.id, J2)) : this.fire(new i.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));
              } else this.fire(new i.ErrorEvent(new Error("The source '" + oe + "' does not exist in the map's style.")));
            }, U2.prototype.removeFeatureState = function(G2, J2) {
              this._checkLoaded();
              var oe = G2.source, de = this.sourceCaches[oe];
              if (de !== void 0) {
                var ye = de.getSource().type, Te = ye === "vector" ? G2.sourceLayer : void 0;
                ye !== "vector" || Te ? J2 && typeof G2.id != "string" && typeof G2.id != "number" ? this.fire(new i.ErrorEvent(new Error("A feature id is requred to remove its specific state property."))) : de.removeFeatureState(Te, G2.id, J2) : this.fire(new i.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));
              } else this.fire(new i.ErrorEvent(new Error("The source '" + oe + "' does not exist in the map's style.")));
            }, U2.prototype.getFeatureState = function(G2) {
              this._checkLoaded();
              var J2 = G2.source, oe = G2.sourceLayer, de = this.sourceCaches[J2];
              if (de !== void 0) {
                if (de.getSource().type !== "vector" || oe) return G2.id === void 0 && this.fire(new i.ErrorEvent(new Error("The feature id parameter must be provided."))), de.getFeatureState(oe, G2.id);
                this.fire(new i.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));
              } else this.fire(new i.ErrorEvent(new Error("The source '" + J2 + "' does not exist in the map's style.")));
            }, U2.prototype.getTransition = function() {
              return i.extend({ duration: 300, delay: 0 }, this.stylesheet && this.stylesheet.transition);
            }, U2.prototype.serialize = function() {
              return i.filterObject({ version: this.stylesheet.version, name: this.stylesheet.name, metadata: this.stylesheet.metadata, light: this.stylesheet.light, center: this.stylesheet.center, zoom: this.stylesheet.zoom, bearing: this.stylesheet.bearing, pitch: this.stylesheet.pitch, sprite: this.stylesheet.sprite, glyphs: this.stylesheet.glyphs, transition: this.stylesheet.transition, sources: i.mapObject(this.sourceCaches, function(G2) {
                return G2.serialize();
              }), layers: this._serializeLayers(this._order) }, function(G2) {
                return G2 !== void 0;
              });
            }, U2.prototype._updateLayer = function(G2) {
              this._updatedLayers[G2.id] = true, G2.source && !this._updatedSources[G2.source] && this.sourceCaches[G2.source].getSource().type !== "raster" && (this._updatedSources[G2.source] = "reload", this.sourceCaches[G2.source].pause()), this._changed = true;
            }, U2.prototype._flattenAndSortRenderedFeatures = function(G2) {
              for (var J2 = this, oe = function(Nn) {
                return J2._layers[Nn].type === "fill-extrusion";
              }, de = {}, ye = [], Te = this._order.length - 1; Te >= 0; Te--) {
                var Fe = this._order[Te];
                if (oe(Fe)) {
                  de[Fe] = Te;
                  for (var et = 0, lt = G2; et < lt.length; et += 1) {
                    var bt = lt[et][Fe];
                    if (bt) for (var It = 0, Rt = bt; It < Rt.length; It += 1) {
                      var Ft = Rt[It];
                      ye.push(Ft);
                    }
                  }
                }
              }
              ye.sort(function(Nn, An) {
                return An.intersectionZ - Nn.intersectionZ;
              });
              for (var Pt = [], Mt = this._order.length - 1; Mt >= 0; Mt--) {
                var qt = this._order[Mt];
                if (oe(qt)) for (var $t = ye.length - 1; $t >= 0; $t--) {
                  var Yt = ye[$t].feature;
                  if (de[Yt.layer.id] < Mt) break;
                  Pt.push(Yt), ye.pop();
                }
                else for (var cr = 0, kr = G2; cr < kr.length; cr += 1) {
                  var Pr = kr[cr][qt];
                  if (Pr) for (var Or = 0, xn = Pr; Or < xn.length; Or += 1) {
                    var yn = xn[Or];
                    Pt.push(yn.feature);
                  }
                }
              }
              return Pt;
            }, U2.prototype.queryRenderedFeatures = function(G2, J2, oe) {
              J2 && J2.filter && this._validate(i.validateStyle.filter, "queryRenderedFeatures.filter", J2.filter, null, J2);
              var de = {};
              if (J2 && J2.layers) {
                if (!Array.isArray(J2.layers)) return this.fire(new i.ErrorEvent(new Error("parameters.layers must be an Array."))), [];
                for (var ye = 0, Te = J2.layers; ye < Te.length; ye += 1) {
                  var Fe = Te[ye], et = this._layers[Fe];
                  if (!et) return this.fire(new i.ErrorEvent(new Error("The layer '" + Fe + "' does not exist in the map's style and cannot be queried for features."))), [];
                  de[et.source] = true;
                }
              }
              var lt = [];
              for (var bt in J2.availableImages = this._availableImages, this.sourceCaches) J2.layers && !de[bt] || lt.push(H2(this.sourceCaches[bt], this._layers, this._serializedLayers, G2, J2, oe));
              return this.placement && lt.push(function(It, Rt, Ft, Pt, Mt, qt, $t) {
                for (var Yt = {}, cr = qt.queryRenderedSymbols(Pt), kr = [], Pr = 0, Or = Object.keys(cr).map(Number); Pr < Or.length; Pr += 1) {
                  var xn = Or[Pr];
                  kr.push($t[xn]);
                }
                kr.sort(te);
                for (var yn = function() {
                  var Qa = An[Nn], ln = Qa.featureIndex.lookupSymbolFeatures(cr[Qa.bucketInstanceId], Rt, Qa.bucketIndex, Qa.sourceLayerIndex, Mt.filter, Mt.layers, Mt.availableImages, It);
                  for (var qn in ln) {
                    var Sa = Yt[qn] = Yt[qn] || [], _a = ln[qn];
                    _a.sort(function(Da, wi) {
                      var di = Qa.featureSortOrder;
                      if (di) {
                        var ji = di.indexOf(Da.featureIndex);
                        return di.indexOf(wi.featureIndex) - ji;
                      }
                      return wi.featureIndex - Da.featureIndex;
                    });
                    for (var Pa = 0, ii = _a; Pa < ii.length; Pa += 1) {
                      var Oi = ii[Pa];
                      Sa.push(Oi);
                    }
                  }
                }, Nn = 0, An = kr; Nn < An.length; Nn += 1) yn();
                var ma = function(Qa) {
                  Yt[Qa].forEach(function(ln) {
                    var qn = ln.feature, Sa = It[Qa], _a = Ft[Sa.source].getFeatureState(qn.layer["source-layer"], qn.id);
                    qn.source = qn.layer.source, qn.layer["source-layer"] && (qn.sourceLayer = qn.layer["source-layer"]), qn.state = _a;
                  });
                };
                for (var Aa in Yt) ma(Aa);
                return Yt;
              }(this._layers, this._serializedLayers, this.sourceCaches, G2, J2, this.placement.collisionIndex, this.placement.retainedQueryData)), this._flattenAndSortRenderedFeatures(lt);
            }, U2.prototype.querySourceFeatures = function(G2, J2) {
              J2 && J2.filter && this._validate(i.validateStyle.filter, "querySourceFeatures.filter", J2.filter, null, J2);
              var oe = this.sourceCaches[G2];
              return oe ? function(de, ye) {
                for (var Te = de.getRenderableIds().map(function(Rt) {
                  return de.getTileByID(Rt);
                }), Fe = [], et = {}, lt = 0; lt < Te.length; lt++) {
                  var bt = Te[lt], It = bt.tileID.canonical.key;
                  et[It] || (et[It] = true, bt.querySourceFeatures(Fe, ye));
                }
                return Fe;
              }(oe, J2) : [];
            }, U2.prototype.addSourceType = function(G2, J2, oe) {
              return U2.getSourceType(G2) ? oe(new Error('A source type called "' + G2 + '" already exists.')) : (U2.setSourceType(G2, J2), J2.workerSourceURL ? void this.dispatcher.broadcast("loadWorkerSource", { name: G2, url: J2.workerSourceURL }, oe) : oe(null, null));
            }, U2.prototype.getLight = function() {
              return this.light.getLight();
            }, U2.prototype.setLight = function(G2, J2) {
              J2 === void 0 && (J2 = {}), this._checkLoaded();
              var oe = this.light.getLight(), de = false;
              for (var ye in G2) if (!i.deepEqual(G2[ye], oe[ye])) {
                de = true;
                break;
              }
              if (de) {
                var Te = { now: i.browser.now(), transition: i.extend({ duration: 300, delay: 0 }, this.stylesheet.transition) };
                this.light.setLight(G2, J2), this.light.updateTransitions(Te);
              }
            }, U2.prototype._validate = function(G2, J2, oe, de, ye) {
              return ye === void 0 && (ye = {}), (!ye || ye.validate !== false) && Sn(this, G2.call(i.validateStyle, i.extend({ key: J2, style: this.serialize(), value: oe, styleSpec: i.styleSpec }, de)));
            }, U2.prototype._remove = function() {
              for (var G2 in this._request && (this._request.cancel(), this._request = null), this._spriteRequest && (this._spriteRequest.cancel(), this._spriteRequest = null), i.evented.off("pluginStateChange", this._rtlTextPluginCallback), this._layers) this._layers[G2].setEventedParent(null);
              for (var J2 in this.sourceCaches) this.sourceCaches[J2].clearTiles(), this.sourceCaches[J2].setEventedParent(null);
              this.imageManager.setEventedParent(null), this.setEventedParent(null), this.dispatcher.remove();
            }, U2.prototype._clearSource = function(G2) {
              this.sourceCaches[G2].clearTiles();
            }, U2.prototype._reloadSource = function(G2) {
              this.sourceCaches[G2].resume(), this.sourceCaches[G2].reload();
            }, U2.prototype._updateSources = function(G2) {
              for (var J2 in this.sourceCaches) this.sourceCaches[J2].update(G2);
            }, U2.prototype._generateCollisionBoxes = function() {
              for (var G2 in this.sourceCaches) this._reloadSource(G2);
            }, U2.prototype._updatePlacement = function(G2, J2, oe, de, ye) {
              ye === void 0 && (ye = false);
              for (var Te = false, Fe = false, et = {}, lt = 0, bt = this._order; lt < bt.length; lt += 1) {
                var It = bt[lt], Rt = this._layers[It];
                if (Rt.type === "symbol") {
                  if (!et[Rt.source]) {
                    var Ft = this.sourceCaches[Rt.source];
                    et[Rt.source] = Ft.getRenderableIds(true).map(function(cr) {
                      return Ft.getTileByID(cr);
                    }).sort(function(cr, kr) {
                      return kr.tileID.overscaledZ - cr.tileID.overscaledZ || (cr.tileID.isLessThan(kr.tileID) ? -1 : 1);
                    });
                  }
                  var Pt = this.crossTileSymbolIndex.addLayer(Rt, et[Rt.source], G2.center.lng);
                  Te = Te || Pt;
                }
              }
              if (this.crossTileSymbolIndex.pruneUnusedLayers(this._order), ((ye = ye || this._layerOrderChanged || oe === 0) || !this.pauseablePlacement || this.pauseablePlacement.isDone() && !this.placement.stillRecent(i.browser.now(), G2.zoom)) && (this.pauseablePlacement = new Mn(G2, this._order, ye, J2, oe, de, this.placement), this._layerOrderChanged = false), this.pauseablePlacement.isDone() ? this.placement.setStale() : (this.pauseablePlacement.continuePlacement(this._order, this._layers, et), this.pauseablePlacement.isDone() && (this.placement = this.pauseablePlacement.commit(i.browser.now()), Fe = true), Te && this.pauseablePlacement.placement.setStale()), Fe || Te) for (var Mt = 0, qt = this._order; Mt < qt.length; Mt += 1) {
                var $t = qt[Mt], Yt = this._layers[$t];
                Yt.type === "symbol" && this.placement.updateLayerOpacities(Yt, et[Yt.source]);
              }
              return !this.pauseablePlacement.isDone() || this.placement.hasTransitions(i.browser.now());
            }, U2.prototype._releaseSymbolFadeTiles = function() {
              for (var G2 in this.sourceCaches) this.sourceCaches[G2].releaseSymbolFadeTiles();
            }, U2.prototype.getImages = function(G2, J2, oe) {
              this.imageManager.getImages(J2.icons, oe), this._updateTilesForChangedImages();
              var de = this.sourceCaches[J2.source];
              de && de.setDependencies(J2.tileID.key, J2.type, J2.icons);
            }, U2.prototype.getGlyphs = function(G2, J2, oe) {
              this.glyphManager.getGlyphs(J2.stacks, oe);
            }, U2.prototype.getResource = function(G2, J2, oe) {
              return i.makeRequest(J2, oe);
            }, U2;
          }(i.Evented);
          ka.getSourceType = function(P2) {
            return R2[P2];
          }, ka.setSourceType = function(P2, U2) {
            R2[P2] = U2;
          }, ka.registerForPluginStateChange = i.registerForPluginStateChange;
          var zn = i.createLayout([{ name: "a_pos", type: "Int16", components: 2 }]), ja = vo(`#ifdef GL_ES
precision mediump float;
#else
#if !defined(lowp)
#define lowp
#endif
#if !defined(mediump)
#define mediump
#endif
#if !defined(highp)
#define highp
#endif
#endif`, `#ifdef GL_ES
precision highp float;
#else
#if !defined(lowp)
#define lowp
#endif
#if !defined(mediump)
#define mediump
#endif
#if !defined(highp)
#define highp
#endif
#endif
vec2 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
);}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;}`), si = vo(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, "attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"), ko = vo(`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;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, "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);}"), Xs = vo(`varying vec3 v_data;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define mediump float radius
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define highp vec4 stroke_color
#pragma mapbox: define mediump float stroke_width
#pragma mapbox: define lowp float stroke_opacity
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize mediump float radius
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize highp vec4 stroke_color
#pragma mapbox: initialize mediump float stroke_width
#pragma mapbox: initialize lowp float stroke_opacity
vec2 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);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `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;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define mediump float radius
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define highp vec4 stroke_color
#pragma mapbox: define mediump float stroke_width
#pragma mapbox: define lowp float stroke_opacity
void main(void) {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize mediump float radius
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize highp vec4 stroke_color
#pragma mapbox: initialize mediump float stroke_width
#pragma mapbox: initialize lowp float stroke_opacity
vec2 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);}`), Uo = vo("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);}"), As = vo(`uniform highp float u_intensity;varying vec2 v_extrude;
#pragma mapbox: define highp float weight
#define GAUSS_COEF 0.3989422804014327
void main() {
#pragma mapbox: initialize highp float weight
float 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);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `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;
#pragma mapbox: define highp float weight
#pragma mapbox: define mediump float radius
const highp float ZERO=1.0/255.0/16.0;
#define GAUSS_COEF 0.3989422804014327
void main(void) {
#pragma mapbox: initialize highp float weight
#pragma mapbox: initialize mediump float radius
vec2 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;}`), Ui = vo(`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;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(0.0);
#endif
}`, "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;}"), so = vo("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_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;}"), gu = vo("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);}"), Pc = vo("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,0,1);}"), Zc = vo(`#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float opacity
gl_FragColor=color*opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `attribute vec2 a_pos;uniform mat4 u_matrix;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float opacity
gl_Position=u_matrix*vec4(a_pos,0,1);}`), Ll = vo(`varying vec2 v_pos;
#pragma mapbox: define highp vec4 outline_color
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 outline_color
#pragma mapbox: initialize lowp float opacity
float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;
#pragma mapbox: define highp vec4 outline_color
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 outline_color
#pragma mapbox: initialize lowp float opacity
gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`), Hl = vo(`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;
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
void main() {
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
vec2 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;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `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;
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
void main() {
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
vec2 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;}`), Lc = vo(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
void main() {
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
vec2 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;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `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;
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
void main() {
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
vec2 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);}`), po = vo(`varying vec4 v_color;void main() {gl_FragColor=v_color;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `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;
#pragma mapbox: define highp float base
#pragma mapbox: define highp float height
#pragma mapbox: define highp vec4 color
void main() {
#pragma mapbox: initialize highp float base
#pragma mapbox: initialize highp float height
#pragma mapbox: initialize highp vec4 color
vec3 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;}`), tc = vo(`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;
#pragma mapbox: define lowp float base
#pragma mapbox: define lowp float height
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
void main() {
#pragma mapbox: initialize lowp float base
#pragma mapbox: initialize lowp float height
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
vec2 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;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `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;
#pragma mapbox: define lowp float base
#pragma mapbox: define lowp float height
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
void main() {
#pragma mapbox: initialize lowp float base
#pragma mapbox: initialize lowp float height
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
vec2 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
? a_pos
: 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;}`), yu = vo(`#ifdef GL_ES
precision highp float;
#endif
uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform float u_maxzoom;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 exaggeration=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/ pow(2.0,(u_zoom-u_maxzoom)*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);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, "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;}"), Ss = vo(`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;
#define PI 3.141592653589793
void 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;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, "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;}"), ql = vo(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
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);gl_FragColor=color*(alpha*opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `
#define scale 0.015873016
attribute 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;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define mediump float gapwidth
#pragma mapbox: define lowp float offset
#pragma mapbox: define mediump float width
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump float gapwidth
#pragma mapbox: initialize lowp float offset
#pragma mapbox: initialize mediump float width
float 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);}`), xu = vo(`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 float v_lineprogress;
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
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);vec4 color=texture2D(u_image,vec2(v_lineprogress,0.5));gl_FragColor=color*(alpha*opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `
#define MAX_LINE_DISTANCE 32767.0
#define scale 0.015873016
attribute 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_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_lineprogress;
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define mediump float gapwidth
#pragma mapbox: define lowp float offset
#pragma mapbox: define mediump float width
void main() {
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump float gapwidth
#pragma mapbox: initialize lowp float offset
#pragma mapbox: initialize mediump float width
float 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_lineprogress=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0/MAX_LINE_DISTANCE;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);}`), zu = vo(`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;
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
vec2 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;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `
#define scale 0.015873016
#define LINE_DISTANCE_SCALE 2.0
attribute 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;
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float offset
#pragma mapbox: define mediump float gapwidth
#pragma mapbox: define mediump float width
#pragma mapbox: define lowp float floorwidth
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
void main() {
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float offset
#pragma mapbox: initialize mediump float gapwidth
#pragma mapbox: initialize mediump float width
#pragma mapbox: initialize lowp float floorwidth
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
float 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;}`), nl = vo(`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;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define mediump float width
#pragma mapbox: define lowp float floorwidth
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump float width
#pragma mapbox: initialize lowp float floorwidth
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 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);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `
#define scale 0.015873016
#define LINE_DISTANCE_SCALE 2.0
attribute 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;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define mediump float gapwidth
#pragma mapbox: define lowp float offset
#pragma mapbox: define mediump float width
#pragma mapbox: define lowp float floorwidth
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump float gapwidth
#pragma mapbox: initialize lowp float offset
#pragma mapbox: initialize mediump float width
#pragma mapbox: initialize lowp float floorwidth
float 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);}`), ss = vo(`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);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, "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;}"), Rl = vo(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize lowp float opacity
lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `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;
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize lowp float opacity
vec2 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 ?
camera_to_anchor_distance/u_camera_to_center_distance :
u_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));}`), Kh = vo(`#define SDF_PX 8.0
uniform 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;
#pragma mapbox: define highp vec4 fill_color
#pragma mapbox: define highp vec4 halo_color
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float halo_width
#pragma mapbox: define lowp float halo_blur
void main() {
#pragma mapbox: initialize highp vec4 fill_color
#pragma mapbox: initialize highp vec4 halo_color
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float halo_width
#pragma mapbox: initialize lowp float halo_blur
float 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);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `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;
#pragma mapbox: define highp vec4 fill_color
#pragma mapbox: define highp vec4 halo_color
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float halo_width
#pragma mapbox: define lowp float halo_blur
void main() {
#pragma mapbox: initialize highp vec4 fill_color
#pragma mapbox: initialize highp vec4 halo_color
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float halo_width
#pragma mapbox: initialize lowp float halo_blur
vec2 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 ?
camera_to_anchor_distance/u_camera_to_center_distance :
u_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);}`), Np = vo(`#define SDF_PX 8.0
#define SDF 1.0
#define ICON 0.0
uniform 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;
#pragma mapbox: define highp vec4 fill_color
#pragma mapbox: define highp vec4 halo_color
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float halo_width
#pragma mapbox: define lowp float halo_blur
void main() {
#pragma mapbox: initialize highp vec4 fill_color
#pragma mapbox: initialize highp vec4 halo_color
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float halo_width
#pragma mapbox: initialize lowp float halo_blur
float 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;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
return;}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);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `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;
#pragma mapbox: define highp vec4 fill_color
#pragma mapbox: define highp vec4 halo_color
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float halo_width
#pragma mapbox: define lowp float halo_blur
void main() {
#pragma mapbox: initialize highp vec4 fill_color
#pragma mapbox: initialize highp vec4 halo_color
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float halo_width
#pragma mapbox: initialize lowp float halo_blur
vec2 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 ?
camera_to_anchor_distance/u_camera_to_center_distance :
u_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);}`);
          function vo(P2, U2) {
            var G2 = /#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g, J2 = {};
            return { fragmentSource: P2 = P2.replace(G2, function(oe, de, ye, Te, Fe) {
              return J2[Fe] = true, de === "define" ? `
#ifndef HAS_UNIFORM_u_` + Fe + `
varying ` + ye + " " + Te + " " + Fe + `;
#else
uniform ` + ye + " " + Te + " u_" + Fe + `;
#endif
` : `
#ifdef HAS_UNIFORM_u_` + Fe + `
    ` + ye + " " + Te + " " + Fe + " = u_" + Fe + `;
#endif
`;
            }), vertexSource: U2 = U2.replace(G2, function(oe, de, ye, Te, Fe) {
              var et = Te === "float" ? "vec2" : "vec4", lt = Fe.match(/color/) ? "color" : et;
              return J2[Fe] ? de === "define" ? `
#ifndef HAS_UNIFORM_u_` + Fe + `
uniform lowp float u_` + Fe + `_t;
attribute ` + ye + " " + et + " a_" + Fe + `;
varying ` + ye + " " + Te + " " + Fe + `;
#else
uniform ` + ye + " " + Te + " u_" + Fe + `;
#endif
` : lt === "vec4" ? `
#ifndef HAS_UNIFORM_u_` + Fe + `
    ` + Fe + " = a_" + Fe + `;
#else
    ` + ye + " " + Te + " " + Fe + " = u_" + Fe + `;
#endif
` : `
#ifndef HAS_UNIFORM_u_` + Fe + `
    ` + Fe + " = unpack_mix_" + lt + "(a_" + Fe + ", u_" + Fe + `_t);
#else
    ` + ye + " " + Te + " " + Fe + " = u_" + Fe + `;
#endif
` : de === "define" ? `
#ifndef HAS_UNIFORM_u_` + Fe + `
uniform lowp float u_` + Fe + `_t;
attribute ` + ye + " " + et + " a_" + Fe + `;
#else
uniform ` + ye + " " + Te + " u_" + Fe + `;
#endif
` : lt === "vec4" ? `
#ifndef HAS_UNIFORM_u_` + Fe + `
    ` + ye + " " + Te + " " + Fe + " = a_" + Fe + `;
#else
    ` + ye + " " + Te + " " + Fe + " = u_" + Fe + `;
#endif
` : `
#ifndef HAS_UNIFORM_u_` + Fe + `
    ` + ye + " " + Te + " " + Fe + " = unpack_mix_" + lt + "(a_" + Fe + ", u_" + Fe + `_t);
#else
    ` + ye + " " + Te + " " + Fe + " = u_" + Fe + `;
#endif
`;
            }) };
          }
          var xh = Object.freeze({ __proto__: null, prelude: ja, background: si, backgroundPattern: ko, circle: Xs, clippingMask: Uo, heatmap: As, heatmapTexture: Ui, collisionBox: so, collisionCircle: gu, debug: Pc, fill: Zc, fillOutline: Ll, fillOutlinePattern: Hl, fillPattern: Lc, fillExtrusion: po, fillExtrusionPattern: tc, hillshadePrepare: yu, hillshade: Ss, line: ql, lineGradient: xu, linePattern: zu, lineSDF: nl, raster: ss, symbolIcon: Rl, symbolSDF: Kh, symbolTextAndIcon: Np }), kf = function() {
            this.boundProgram = null, this.boundLayoutVertexBuffer = null, this.boundPaintVertexBuffers = [], this.boundIndexBuffer = null, this.boundVertexOffset = null, this.boundDynamicVertexBuffer = null, this.vao = null;
          };
          kf.prototype.bind = function(P2, U2, G2, J2, oe, de, ye, Te) {
            this.context = P2;
            for (var Fe = this.boundPaintVertexBuffers.length !== J2.length, et = 0; !Fe && et < J2.length; et++) this.boundPaintVertexBuffers[et] !== J2[et] && (Fe = true);
            var lt = !this.vao || this.boundProgram !== U2 || this.boundLayoutVertexBuffer !== G2 || Fe || this.boundIndexBuffer !== oe || this.boundVertexOffset !== de || this.boundDynamicVertexBuffer !== ye || this.boundDynamicVertexBuffer2 !== Te;
            !P2.extVertexArrayObject || lt ? this.freshBind(U2, G2, J2, oe, de, ye, Te) : (P2.bindVertexArrayOES.set(this.vao), ye && ye.bind(), oe && oe.dynamicDraw && oe.bind(), Te && Te.bind());
          }, kf.prototype.freshBind = function(P2, U2, G2, J2, oe, de, ye) {
            var Te, Fe = P2.numAttributes, et = this.context, lt = et.gl;
            if (et.extVertexArrayObject) this.vao && this.destroy(), this.vao = et.extVertexArrayObject.createVertexArrayOES(), et.bindVertexArrayOES.set(this.vao), Te = 0, this.boundProgram = P2, this.boundLayoutVertexBuffer = U2, this.boundPaintVertexBuffers = G2, this.boundIndexBuffer = J2, this.boundVertexOffset = oe, this.boundDynamicVertexBuffer = de, this.boundDynamicVertexBuffer2 = ye;
            else {
              Te = et.currentNumAttributes || 0;
              for (var bt = Fe; bt < Te; bt++) lt.disableVertexAttribArray(bt);
            }
            U2.enableAttributes(lt, P2);
            for (var It = 0, Rt = G2; It < Rt.length; It += 1) Rt[It].enableAttributes(lt, P2);
            de && de.enableAttributes(lt, P2), ye && ye.enableAttributes(lt, P2), U2.bind(), U2.setVertexAttribPointers(lt, P2, oe);
            for (var Ft = 0, Pt = G2; Ft < Pt.length; Ft += 1) {
              var Mt = Pt[Ft];
              Mt.bind(), Mt.setVertexAttribPointers(lt, P2, oe);
            }
            de && (de.bind(), de.setVertexAttribPointers(lt, P2, oe)), J2 && J2.bind(), ye && (ye.bind(), ye.setVertexAttribPointers(lt, P2, oe)), et.currentNumAttributes = Fe;
          }, kf.prototype.destroy = function() {
            this.vao && (this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao), this.vao = null);
          };
          var Fp = function(P2, U2, G2, J2, oe) {
            var de = P2.gl;
            this.program = de.createProgram();
            var ye = G2 ? G2.defines() : [];
            oe && ye.push("#define OVERDRAW_INSPECTOR;");
            var Te = ye.concat(ja.fragmentSource, U2.fragmentSource).join(`
`), Fe = ye.concat(ja.vertexSource, U2.vertexSource).join(`
`), et = de.createShader(de.FRAGMENT_SHADER);
            if (de.isContextLost()) this.failedToCreate = true;
            else {
              de.shaderSource(et, Te), de.compileShader(et), de.attachShader(this.program, et);
              var lt = de.createShader(de.VERTEX_SHADER);
              if (de.isContextLost()) this.failedToCreate = true;
              else {
                de.shaderSource(lt, Fe), de.compileShader(lt), de.attachShader(this.program, lt);
                for (var bt = G2 ? G2.layoutAttributes : [], It = 0; It < bt.length; It++) de.bindAttribLocation(this.program, It, bt[It].name);
                de.linkProgram(this.program), de.deleteShader(lt), de.deleteShader(et), this.numAttributes = de.getProgramParameter(this.program, de.ACTIVE_ATTRIBUTES), this.attributes = {};
                for (var Rt = {}, Ft = 0; Ft < this.numAttributes; Ft++) {
                  var Pt = de.getActiveAttrib(this.program, Ft);
                  Pt && (this.attributes[Pt.name] = de.getAttribLocation(this.program, Pt.name));
                }
                for (var Mt = de.getProgramParameter(this.program, de.ACTIVE_UNIFORMS), qt = 0; qt < Mt; qt++) {
                  var $t = de.getActiveUniform(this.program, qt);
                  $t && (Rt[$t.name] = de.getUniformLocation(this.program, $t.name));
                }
                this.fixedUniforms = J2(P2, Rt), this.binderUniforms = G2 ? G2.getUniforms(P2, Rt) : [];
              }
            }
          };
          function Op(P2, U2, G2) {
            var J2 = 1 / Nr(G2, 1, U2.transform.tileZoom), oe = Math.pow(2, G2.tileID.overscaledZ), de = G2.tileSize * Math.pow(2, U2.transform.tileZoom) / oe, ye = de * (G2.tileID.canonical.x + G2.tileID.wrap * oe), Te = de * G2.tileID.canonical.y;
            return { u_image: 0, u_texsize: G2.imageAtlasTexture.size, u_scale: [J2, P2.fromScale, P2.toScale], u_fade: P2.t, u_pixel_coord_upper: [ye >> 16, Te >> 16], u_pixel_coord_lower: [65535 & ye, 65535 & Te] };
          }
          Fp.prototype.draw = function(P2, U2, G2, J2, oe, de, ye, Te, Fe, et, lt, bt, It, Rt, Ft, Pt) {
            var Mt, qt = P2.gl;
            if (!this.failedToCreate) {
              for (var $t in P2.program.set(this.program), P2.setDepthMode(G2), P2.setStencilMode(J2), P2.setColorMode(oe), P2.setCullFace(de), this.fixedUniforms) this.fixedUniforms[$t].set(ye[$t]);
              Rt && Rt.setUniforms(P2, this.binderUniforms, bt, { zoom: It });
              for (var Yt = (Mt = {}, Mt[qt.LINES] = 2, Mt[qt.TRIANGLES] = 3, Mt[qt.LINE_STRIP] = 1, Mt)[U2], cr = 0, kr = lt.get(); cr < kr.length; cr += 1) {
                var Pr = kr[cr], Or = Pr.vaos || (Pr.vaos = {});
                (Or[Te] || (Or[Te] = new kf())).bind(P2, this, Fe, Rt ? Rt.getPaintVertexBuffers() : [], et, Pr.vertexOffset, Ft, Pt), qt.drawElements(U2, Pr.primitiveLength * Yt, qt.UNSIGNED_SHORT, Pr.primitiveOffset * Yt * 2);
              }
            }
          };
          var Yh = function(P2, U2, G2, J2) {
            var oe = U2.style.light, de = oe.properties.get("position"), ye = [de.x, de.y, de.z], Te = i.create$1();
            oe.properties.get("anchor") === "viewport" && i.fromRotation(Te, -U2.transform.angle), i.transformMat3(ye, ye, Te);
            var Fe = oe.properties.get("color");
            return { u_matrix: P2, u_lightpos: ye, u_lightintensity: oe.properties.get("intensity"), u_lightcolor: [Fe.r, Fe.g, Fe.b], u_vertical_gradient: +G2, u_opacity: J2 };
          }, Pp = function(P2, U2, G2, J2, oe, de, ye) {
            return i.extend(Yh(P2, U2, G2, J2), Op(de, U2, ye), { u_height_factor: -Math.pow(2, oe.overscaledZ) / ye.tileSize / 8 });
          }, rc = function(P2) {
            return { u_matrix: P2 };
          }, nc = function(P2, U2, G2, J2) {
            return i.extend(rc(P2), Op(G2, U2, J2));
          }, Rc = function(P2, U2) {
            return { u_matrix: P2, u_world: U2 };
          }, zc = function(P2, U2, G2, J2, oe) {
            return i.extend(nc(P2, U2, G2, J2), { u_world: oe });
          }, Bc = function(P2, U2, G2, J2) {
            var oe, de, ye = P2.transform;
            if (J2.paint.get("circle-pitch-alignment") === "map") {
              var Te = Nr(G2, 1, ye.zoom);
              oe = true, de = [Te, Te];
            } else oe = false, de = ye.pixelsToGLUnits;
            return { u_camera_to_center_distance: ye.cameraToCenterDistance, u_scale_with_map: +(J2.paint.get("circle-pitch-scale") === "map"), u_matrix: P2.translatePosMatrix(U2.posMatrix, G2, J2.paint.get("circle-translate"), J2.paint.get("circle-translate-anchor")), u_pitch_with_map: +oe, u_device_pixel_ratio: i.browser.devicePixelRatio, u_extrude_scale: de };
          }, Tf = function(P2, U2, G2) {
            var J2 = Nr(G2, 1, U2.zoom), oe = Math.pow(2, U2.zoom - G2.tileID.overscaledZ), de = G2.tileID.overscaleFactor();
            return { u_matrix: P2, u_camera_to_center_distance: U2.cameraToCenterDistance, u_pixels_to_tile_units: J2, u_extrude_scale: [U2.pixelsToGLUnits[0] / (J2 * oe), U2.pixelsToGLUnits[1] / (J2 * oe)], u_overscale_factor: de };
          }, bu = function(P2, U2, G2) {
            return { u_matrix: P2, u_inv_matrix: U2, u_camera_to_center_distance: G2.cameraToCenterDistance, u_viewport_size: [G2.width, G2.height] };
          }, bh = function(P2, U2, G2) {
            return G2 === void 0 && (G2 = 1), { u_matrix: P2, u_color: U2, u_overlay: 0, u_overlay_scale: G2 };
          }, cu = function(P2) {
            return { u_matrix: P2 };
          }, Uc = function(P2, U2, G2, J2) {
            return { u_matrix: P2, u_extrude_scale: Nr(U2, 1, G2), u_intensity: J2 };
          };
          function _h(P2, U2) {
            var G2 = Math.pow(2, U2.canonical.z), J2 = U2.canonical.y;
            return [new i.MercatorCoordinate(0, J2 / G2).toLngLat().lat, new i.MercatorCoordinate(0, (J2 + 1) / G2).toLngLat().lat];
          }
          var ac = function(P2, U2, G2) {
            var J2 = P2.transform;
            return { u_matrix: _t(P2, U2, G2), u_ratio: 1 / Nr(U2, 1, J2.zoom), u_device_pixel_ratio: i.browser.devicePixelRatio, u_units_to_pixels: [1 / J2.pixelsToGLUnits[0], 1 / J2.pixelsToGLUnits[1]] };
          }, lo = function(P2, U2, G2) {
            return i.extend(ac(P2, U2, G2), { u_image: 0 });
          }, Qe = function(P2, U2, G2, J2) {
            var oe = P2.transform, de = dt(U2, oe);
            return { u_matrix: _t(P2, U2, G2), u_texsize: U2.imageAtlasTexture.size, u_ratio: 1 / Nr(U2, 1, oe.zoom), u_device_pixel_ratio: i.browser.devicePixelRatio, u_image: 0, u_scale: [de, J2.fromScale, J2.toScale], u_fade: J2.t, u_units_to_pixels: [1 / oe.pixelsToGLUnits[0], 1 / oe.pixelsToGLUnits[1]] };
          }, nt = function(P2, U2, G2, J2, oe) {
            var de = P2.transform, ye = P2.lineAtlas, Te = dt(U2, de), Fe = G2.layout.get("line-cap") === "round", et = ye.getDash(J2.from, Fe), lt = ye.getDash(J2.to, Fe), bt = et.width * oe.fromScale, It = lt.width * oe.toScale;
            return i.extend(ac(P2, U2, G2), { u_patternscale_a: [Te / bt, -et.height / 2], u_patternscale_b: [Te / It, -lt.height / 2], u_sdfgamma: ye.width / (256 * Math.min(bt, It) * i.browser.devicePixelRatio) / 2, u_image: 0, u_tex_y_a: et.y, u_tex_y_b: lt.y, u_mix: oe.t });
          };
          function dt(P2, U2) {
            return 1 / Nr(P2, 1, U2.tileZoom);
          }
          function _t(P2, U2, G2) {
            return P2.translatePosMatrix(U2.tileID.posMatrix, U2, G2.paint.get("line-translate"), G2.paint.get("line-translate-anchor"));
          }
          var Ct = function(P2, U2, G2, J2, oe) {
            return { u_matrix: P2, u_tl_parent: U2, u_scale_parent: G2, u_buffer_scale: 1, u_fade_t: J2.mix, u_opacity: J2.opacity * oe.paint.get("raster-opacity"), u_image0: 0, u_image1: 1, u_brightness_low: oe.paint.get("raster-brightness-min"), u_brightness_high: oe.paint.get("raster-brightness-max"), u_saturation_factor: (ye = oe.paint.get("raster-saturation"), ye > 0 ? 1 - 1 / (1.001 - ye) : -ye), u_contrast_factor: (de = oe.paint.get("raster-contrast"), de > 0 ? 1 / (1 - de) : 1 + de), u_spin_weights: St(oe.paint.get("raster-hue-rotate")) };
            var de, ye;
          };
          function St(P2) {
            P2 *= Math.PI / 180;
            var U2 = Math.sin(P2), G2 = Math.cos(P2);
            return [(2 * G2 + 1) / 3, (-Math.sqrt(3) * U2 - G2 + 1) / 3, (Math.sqrt(3) * U2 - G2 + 1) / 3];
          }
          var Lt, ir = function(P2, U2, G2, J2, oe, de, ye, Te, Fe, et) {
            var lt = oe.transform;
            return { u_is_size_zoom_constant: +(P2 === "constant" || P2 === "source"), u_is_size_feature_constant: +(P2 === "constant" || P2 === "camera"), u_size_t: U2 ? U2.uSizeT : 0, u_size: U2 ? U2.uSize : 0, u_camera_to_center_distance: lt.cameraToCenterDistance, u_pitch: lt.pitch / 360 * 2 * Math.PI, u_rotate_symbol: +G2, u_aspect_ratio: lt.width / lt.height, u_fade_change: oe.options.fadeDuration ? oe.symbolFadeChange : 1, u_matrix: de, u_label_plane_matrix: ye, u_coord_matrix: Te, u_is_text: +Fe, u_pitch_with_map: +J2, u_texsize: et, u_texture: 0 };
          }, or = function(P2, U2, G2, J2, oe, de, ye, Te, Fe, et, lt) {
            var bt = oe.transform;
            return i.extend(ir(P2, U2, G2, J2, oe, de, ye, Te, Fe, et), { u_gamma_scale: J2 ? Math.cos(bt._pitch) * bt.cameraToCenterDistance : 1, u_device_pixel_ratio: i.browser.devicePixelRatio, u_is_halo: +lt });
          }, nr = function(P2, U2, G2, J2, oe, de, ye, Te, Fe, et) {
            return i.extend(or(P2, U2, G2, J2, oe, de, ye, Te, true, Fe, true), { u_texsize_icon: et, u_texture_icon: 1 });
          }, fr = function(P2, U2, G2) {
            return { u_matrix: P2, u_opacity: U2, u_color: G2 };
          }, wr = function(P2, U2, G2, J2, oe, de) {
            return i.extend(function(ye, Te, Fe, et) {
              var lt = Fe.imageManager.getPattern(ye.from.toString()), bt = Fe.imageManager.getPattern(ye.to.toString()), It = Fe.imageManager.getPixelSize(), Rt = It.width, Ft = It.height, Pt = Math.pow(2, et.tileID.overscaledZ), Mt = et.tileSize * Math.pow(2, Fe.transform.tileZoom) / Pt, qt = Mt * (et.tileID.canonical.x + et.tileID.wrap * Pt), $t = Mt * et.tileID.canonical.y;
              return { u_image: 0, u_pattern_tl_a: lt.tl, u_pattern_br_a: lt.br, u_pattern_tl_b: bt.tl, u_pattern_br_b: bt.br, u_texsize: [Rt, Ft], u_mix: Te.t, u_pattern_size_a: lt.displaySize, u_pattern_size_b: bt.displaySize, u_scale_a: Te.fromScale, u_scale_b: Te.toScale, u_tile_units_to_pixels: 1 / Nr(et, 1, Fe.transform.tileZoom), u_pixel_coord_upper: [qt >> 16, $t >> 16], u_pixel_coord_lower: [65535 & qt, 65535 & $t] };
            }(J2, de, G2, oe), { u_matrix: P2, u_opacity: U2 });
          }, Er = { fillExtrusion: function(P2, U2) {
            return { u_matrix: new i.UniformMatrix4f(P2, U2.u_matrix), u_lightpos: new i.Uniform3f(P2, U2.u_lightpos), u_lightintensity: new i.Uniform1f(P2, U2.u_lightintensity), u_lightcolor: new i.Uniform3f(P2, U2.u_lightcolor), u_vertical_gradient: new i.Uniform1f(P2, U2.u_vertical_gradient), u_opacity: new i.Uniform1f(P2, U2.u_opacity) };
          }, fillExtrusionPattern: function(P2, U2) {
            return { u_matrix: new i.UniformMatrix4f(P2, U2.u_matrix), u_lightpos: new i.Uniform3f(P2, U2.u_lightpos), u_lightintensity: new i.Uniform1f(P2, U2.u_lightintensity), u_lightcolor: new i.Uniform3f(P2, U2.u_lightcolor), u_vertical_gradient: new i.Uniform1f(P2, U2.u_vertical_gradient), u_height_factor: new i.Uniform1f(P2, U2.u_height_factor), u_image: new i.Uniform1i(P2, U2.u_image), u_texsize: new i.Uniform2f(P2, U2.u_texsize), u_pixel_coord_upper: new i.Uniform2f(P2, U2.u_pixel_coord_upper), u_pixel_coord_lower: new i.Uniform2f(P2, U2.u_pixel_coord_lower), u_scale: new i.Uniform3f(P2, U2.u_scale), u_fade: new i.Uniform1f(P2, U2.u_fade), u_opacity: new i.Uniform1f(P2, U2.u_opacity) };
          }, fill: function(P2, U2) {
            return { u_matrix: new i.UniformMatrix4f(P2, U2.u_matrix) };
          }, fillPattern: function(P2, U2) {
            return { u_matrix: new i.UniformMatrix4f(P2, U2.u_matrix), u_image: new i.Uniform1i(P2, U2.u_image), u_texsize: new i.Uniform2f(P2, U2.u_texsize), u_pixel_coord_upper: new i.Uniform2f(P2, U2.u_pixel_coord_upper), u_pixel_coord_lower: new i.Uniform2f(P2, U2.u_pixel_coord_lower), u_scale: new i.Uniform3f(P2, U2.u_scale), u_fade: new i.Uniform1f(P2, U2.u_fade) };
          }, fillOutline: function(P2, U2) {
            return { u_matrix: new i.UniformMatrix4f(P2, U2.u_matrix), u_world: new i.Uniform2f(P2, U2.u_world) };
          }, fillOutlinePattern: function(P2, U2) {
            return { u_matrix: new i.UniformMatrix4f(P2, U2.u_matrix), u_world: new i.Uniform2f(P2, U2.u_world), u_image: new i.Uniform1i(P2, U2.u_image), u_texsize: new i.Uniform2f(P2, U2.u_texsize), u_pixel_coord_upper: new i.Uniform2f(P2, U2.u_pixel_coord_upper), u_pixel_coord_lower: new i.Uniform2f(P2, U2.u_pixel_coord_lower), u_scale: new i.Uniform3f(P2, U2.u_scale), u_fade: new i.Uniform1f(P2, U2.u_fade) };
          }, circle: function(P2, U2) {
            return { u_camera_to_center_distance: new i.Uniform1f(P2, U2.u_camera_to_center_distance), u_scale_with_map: new i.Uniform1i(P2, U2.u_scale_with_map), u_pitch_with_map: new i.Uniform1i(P2, U2.u_pitch_with_map), u_extrude_scale: new i.Uniform2f(P2, U2.u_extrude_scale), u_device_pixel_ratio: new i.Uniform1f(P2, U2.u_device_pixel_ratio), u_matrix: new i.UniformMatrix4f(P2, U2.u_matrix) };
          }, collisionBox: function(P2, U2) {
            return { u_matrix: new i.UniformMatrix4f(P2, U2.u_matrix), u_camera_to_center_distance: new i.Uniform1f(P2, U2.u_camera_to_center_distance), u_pixels_to_tile_units: new i.Uniform1f(P2, U2.u_pixels_to_tile_units), u_extrude_scale: new i.Uniform2f(P2, U2.u_extrude_scale), u_overscale_factor: new i.Uniform1f(P2, U2.u_overscale_factor) };
          }, collisionCircle: function(P2, U2) {
            return { u_matrix: new i.UniformMatrix4f(P2, U2.u_matrix), u_inv_matrix: new i.UniformMatrix4f(P2, U2.u_inv_matrix), u_camera_to_center_distance: new i.Uniform1f(P2, U2.u_camera_to_center_distance), u_viewport_size: new i.Uniform2f(P2, U2.u_viewport_size) };
          }, debug: function(P2, U2) {
            return { u_color: new i.UniformColor(P2, U2.u_color), u_matrix: new i.UniformMatrix4f(P2, U2.u_matrix), u_overlay: new i.Uniform1i(P2, U2.u_overlay), u_overlay_scale: new i.Uniform1f(P2, U2.u_overlay_scale) };
          }, clippingMask: function(P2, U2) {
            return { u_matrix: new i.UniformMatrix4f(P2, U2.u_matrix) };
          }, heatmap: function(P2, U2) {
            return { u_extrude_scale: new i.Uniform1f(P2, U2.u_extrude_scale), u_intensity: new i.Uniform1f(P2, U2.u_intensity), u_matrix: new i.UniformMatrix4f(P2, U2.u_matrix) };
          }, heatmapTexture: function(P2, U2) {
            return { u_matrix: new i.UniformMatrix4f(P2, U2.u_matrix), u_world: new i.Uniform2f(P2, U2.u_world), u_image: new i.Uniform1i(P2, U2.u_image), u_color_ramp: new i.Uniform1i(P2, U2.u_color_ramp), u_opacity: new i.Uniform1f(P2, U2.u_opacity) };
          }, hillshade: function(P2, U2) {
            return { u_matrix: new i.UniformMatrix4f(P2, U2.u_matrix), u_image: new i.Uniform1i(P2, U2.u_image), u_latrange: new i.Uniform2f(P2, U2.u_latrange), u_light: new i.Uniform2f(P2, U2.u_light), u_shadow: new i.UniformColor(P2, U2.u_shadow), u_highlight: new i.UniformColor(P2, U2.u_highlight), u_accent: new i.UniformColor(P2, U2.u_accent) };
          }, hillshadePrepare: function(P2, U2) {
            return { u_matrix: new i.UniformMatrix4f(P2, U2.u_matrix), u_image: new i.Uniform1i(P2, U2.u_image), u_dimension: new i.Uniform2f(P2, U2.u_dimension), u_zoom: new i.Uniform1f(P2, U2.u_zoom), u_maxzoom: new i.Uniform1f(P2, U2.u_maxzoom), u_unpack: new i.Uniform4f(P2, U2.u_unpack) };
          }, line: function(P2, U2) {
            return { u_matrix: new i.UniformMatrix4f(P2, U2.u_matrix), u_ratio: new i.Uniform1f(P2, U2.u_ratio), u_device_pixel_ratio: new i.Uniform1f(P2, U2.u_device_pixel_ratio), u_units_to_pixels: new i.Uniform2f(P2, U2.u_units_to_pixels) };
          }, lineGradient: function(P2, U2) {
            return { u_matrix: new i.UniformMatrix4f(P2, U2.u_matrix), u_ratio: new i.Uniform1f(P2, U2.u_ratio), u_device_pixel_ratio: new i.Uniform1f(P2, U2.u_device_pixel_ratio), u_units_to_pixels: new i.Uniform2f(P2, U2.u_units_to_pixels), u_image: new i.Uniform1i(P2, U2.u_image) };
          }, linePattern: function(P2, U2) {
            return { u_matrix: new i.UniformMatrix4f(P2, U2.u_matrix), u_texsize: new i.Uniform2f(P2, U2.u_texsize), u_ratio: new i.Uniform1f(P2, U2.u_ratio), u_device_pixel_ratio: new i.Uniform1f(P2, U2.u_device_pixel_ratio), u_image: new i.Uniform1i(P2, U2.u_image), u_units_to_pixels: new i.Uniform2f(P2, U2.u_units_to_pixels), u_scale: new i.Uniform3f(P2, U2.u_scale), u_fade: new i.Uniform1f(P2, U2.u_fade) };
          }, lineSDF: function(P2, U2) {
            return { u_matrix: new i.UniformMatrix4f(P2, U2.u_matrix), u_ratio: new i.Uniform1f(P2, U2.u_ratio), u_device_pixel_ratio: new i.Uniform1f(P2, U2.u_device_pixel_ratio), u_units_to_pixels: new i.Uniform2f(P2, U2.u_units_to_pixels), u_patternscale_a: new i.Uniform2f(P2, U2.u_patternscale_a), u_patternscale_b: new i.Uniform2f(P2, U2.u_patternscale_b), u_sdfgamma: new i.Uniform1f(P2, U2.u_sdfgamma), u_image: new i.Uniform1i(P2, U2.u_image), u_tex_y_a: new i.Uniform1f(P2, U2.u_tex_y_a), u_tex_y_b: new i.Uniform1f(P2, U2.u_tex_y_b), u_mix: new i.Uniform1f(P2, U2.u_mix) };
          }, raster: function(P2, U2) {
            return { u_matrix: new i.UniformMatrix4f(P2, U2.u_matrix), u_tl_parent: new i.Uniform2f(P2, U2.u_tl_parent), u_scale_parent: new i.Uniform1f(P2, U2.u_scale_parent), u_buffer_scale: new i.Uniform1f(P2, U2.u_buffer_scale), u_fade_t: new i.Uniform1f(P2, U2.u_fade_t), u_opacity: new i.Uniform1f(P2, U2.u_opacity), u_image0: new i.Uniform1i(P2, U2.u_image0), u_image1: new i.Uniform1i(P2, U2.u_image1), u_brightness_low: new i.Uniform1f(P2, U2.u_brightness_low), u_brightness_high: new i.Uniform1f(P2, U2.u_brightness_high), u_saturation_factor: new i.Uniform1f(P2, U2.u_saturation_factor), u_contrast_factor: new i.Uniform1f(P2, U2.u_contrast_factor), u_spin_weights: new i.Uniform3f(P2, U2.u_spin_weights) };
          }, symbolIcon: function(P2, U2) {
            return { u_is_size_zoom_constant: new i.Uniform1i(P2, U2.u_is_size_zoom_constant), u_is_size_feature_constant: new i.Uniform1i(P2, U2.u_is_size_feature_constant), u_size_t: new i.Uniform1f(P2, U2.u_size_t), u_size: new i.Uniform1f(P2, U2.u_size), u_camera_to_center_distance: new i.Uniform1f(P2, U2.u_camera_to_center_distance), u_pitch: new i.Uniform1f(P2, U2.u_pitch), u_rotate_symbol: new i.Uniform1i(P2, U2.u_rotate_symbol), u_aspect_ratio: new i.Uniform1f(P2, U2.u_aspect_ratio), u_fade_change: new i.Uniform1f(P2, U2.u_fade_change), u_matrix: new i.UniformMatrix4f(P2, U2.u_matrix), u_label_plane_matrix: new i.UniformMatrix4f(P2, U2.u_label_plane_matrix), u_coord_matrix: new i.UniformMatrix4f(P2, U2.u_coord_matrix), u_is_text: new i.Uniform1i(P2, U2.u_is_text), u_pitch_with_map: new i.Uniform1i(P2, U2.u_pitch_with_map), u_texsize: new i.Uniform2f(P2, U2.u_texsize), u_texture: new i.Uniform1i(P2, U2.u_texture) };
          }, symbolSDF: function(P2, U2) {
            return { u_is_size_zoom_constant: new i.Uniform1i(P2, U2.u_is_size_zoom_constant), u_is_size_feature_constant: new i.Uniform1i(P2, U2.u_is_size_feature_constant), u_size_t: new i.Uniform1f(P2, U2.u_size_t), u_size: new i.Uniform1f(P2, U2.u_size), u_camera_to_center_distance: new i.Uniform1f(P2, U2.u_camera_to_center_distance), u_pitch: new i.Uniform1f(P2, U2.u_pitch), u_rotate_symbol: new i.Uniform1i(P2, U2.u_rotate_symbol), u_aspect_ratio: new i.Uniform1f(P2, U2.u_aspect_ratio), u_fade_change: new i.Uniform1f(P2, U2.u_fade_change), u_matrix: new i.UniformMatrix4f(P2, U2.u_matrix), u_label_plane_matrix: new i.UniformMatrix4f(P2, U2.u_label_plane_matrix), u_coord_matrix: new i.UniformMatrix4f(P2, U2.u_coord_matrix), u_is_text: new i.Uniform1i(P2, U2.u_is_text), u_pitch_with_map: new i.Uniform1i(P2, U2.u_pitch_with_map), u_texsize: new i.Uniform2f(P2, U2.u_texsize), u_texture: new i.Uniform1i(P2, U2.u_texture), u_gamma_scale: new i.Uniform1f(P2, U2.u_gamma_scale), u_device_pixel_ratio: new i.Uniform1f(P2, U2.u_device_pixel_ratio), u_is_halo: new i.Uniform1i(P2, U2.u_is_halo) };
          }, symbolTextAndIcon: function(P2, U2) {
            return { u_is_size_zoom_constant: new i.Uniform1i(P2, U2.u_is_size_zoom_constant), u_is_size_feature_constant: new i.Uniform1i(P2, U2.u_is_size_feature_constant), u_size_t: new i.Uniform1f(P2, U2.u_size_t), u_size: new i.Uniform1f(P2, U2.u_size), u_camera_to_center_distance: new i.Uniform1f(P2, U2.u_camera_to_center_distance), u_pitch: new i.Uniform1f(P2, U2.u_pitch), u_rotate_symbol: new i.Uniform1i(P2, U2.u_rotate_symbol), u_aspect_ratio: new i.Uniform1f(P2, U2.u_aspect_ratio), u_fade_change: new i.Uniform1f(P2, U2.u_fade_change), u_matrix: new i.UniformMatrix4f(P2, U2.u_matrix), u_label_plane_matrix: new i.UniformMatrix4f(P2, U2.u_label_plane_matrix), u_coord_matrix: new i.UniformMatrix4f(P2, U2.u_coord_matrix), u_is_text: new i.Uniform1i(P2, U2.u_is_text), u_pitch_with_map: new i.Uniform1i(P2, U2.u_pitch_with_map), u_texsize: new i.Uniform2f(P2, U2.u_texsize), u_texsize_icon: new i.Uniform2f(P2, U2.u_texsize_icon), u_texture: new i.Uniform1i(P2, U2.u_texture), u_texture_icon: new i.Uniform1i(P2, U2.u_texture_icon), u_gamma_scale: new i.Uniform1f(P2, U2.u_gamma_scale), u_device_pixel_ratio: new i.Uniform1f(P2, U2.u_device_pixel_ratio), u_is_halo: new i.Uniform1i(P2, U2.u_is_halo) };
          }, background: function(P2, U2) {
            return { u_matrix: new i.UniformMatrix4f(P2, U2.u_matrix), u_opacity: new i.Uniform1f(P2, U2.u_opacity), u_color: new i.UniformColor(P2, U2.u_color) };
          }, backgroundPattern: function(P2, U2) {
            return { u_matrix: new i.UniformMatrix4f(P2, U2.u_matrix), u_opacity: new i.Uniform1f(P2, U2.u_opacity), u_image: new i.Uniform1i(P2, U2.u_image), u_pattern_tl_a: new i.Uniform2f(P2, U2.u_pattern_tl_a), u_pattern_br_a: new i.Uniform2f(P2, U2.u_pattern_br_a), u_pattern_tl_b: new i.Uniform2f(P2, U2.u_pattern_tl_b), u_pattern_br_b: new i.Uniform2f(P2, U2.u_pattern_br_b), u_texsize: new i.Uniform2f(P2, U2.u_texsize), u_mix: new i.Uniform1f(P2, U2.u_mix), u_pattern_size_a: new i.Uniform2f(P2, U2.u_pattern_size_a), u_pattern_size_b: new i.Uniform2f(P2, U2.u_pattern_size_b), u_scale_a: new i.Uniform1f(P2, U2.u_scale_a), u_scale_b: new i.Uniform1f(P2, U2.u_scale_b), u_pixel_coord_upper: new i.Uniform2f(P2, U2.u_pixel_coord_upper), u_pixel_coord_lower: new i.Uniform2f(P2, U2.u_pixel_coord_lower), u_tile_units_to_pixels: new i.Uniform1f(P2, U2.u_tile_units_to_pixels) };
          } };
          function Mr(P2, U2, G2, J2, oe, de, ye) {
            for (var Te = P2.context, Fe = Te.gl, et = P2.useProgram("collisionBox"), lt = [], bt = 0, It = 0, Rt = 0; Rt < J2.length; Rt++) {
              var Ft = J2[Rt], Pt = U2.getTile(Ft), Mt = Pt.getBucket(G2);
              if (Mt) {
                var qt = Ft.posMatrix;
                oe[0] === 0 && oe[1] === 0 || (qt = P2.translatePosMatrix(Ft.posMatrix, Pt, oe, de));
                var $t = ye ? Mt.textCollisionBox : Mt.iconCollisionBox, Yt = Mt.collisionCircleArray;
                if (Yt.length > 0) {
                  var cr = i.create(), kr = qt;
                  i.mul(cr, Mt.placementInvProjMatrix, P2.transform.glCoordMatrix), i.mul(cr, cr, Mt.placementViewportMatrix), lt.push({ circleArray: Yt, circleOffset: It, transform: kr, invTransform: cr }), It = bt += Yt.length / 4;
                }
                $t && et.draw(Te, Fe.LINES, st.disabled, Ie.disabled, P2.colorModeForRenderPass(), $e.disabled, Tf(qt, P2.transform, Pt), G2.id, $t.layoutVertexBuffer, $t.indexBuffer, $t.segments, null, P2.transform.zoom, null, null, $t.collisionVertexBuffer);
              }
            }
            if (ye && lt.length) {
              var Pr = P2.useProgram("collisionCircle"), Or = new i.StructArrayLayout2f1f2i16();
              Or.resize(4 * bt), Or._trim();
              for (var xn = 0, yn = 0, Nn = lt; yn < Nn.length; yn += 1) for (var An = Nn[yn], ma = 0; ma < An.circleArray.length / 4; ma++) {
                var Aa = 4 * ma, Qa = An.circleArray[Aa + 0], ln = An.circleArray[Aa + 1], qn = An.circleArray[Aa + 2], Sa = An.circleArray[Aa + 3];
                Or.emplace(xn++, Qa, ln, qn, Sa, 0), Or.emplace(xn++, Qa, ln, qn, Sa, 1), Or.emplace(xn++, Qa, ln, qn, Sa, 2), Or.emplace(xn++, Qa, ln, qn, Sa, 3);
              }
              (!Lt || Lt.length < 2 * bt) && (Lt = function(di) {
                var ji = 2 * di, ki = new i.StructArrayLayout3ui6();
                ki.resize(ji), ki._trim();
                for (var Wi = 0; Wi < ji; Wi++) {
                  var to = 6 * Wi;
                  ki.uint16[to + 0] = 4 * Wi + 0, ki.uint16[to + 1] = 4 * Wi + 1, ki.uint16[to + 2] = 4 * Wi + 2, ki.uint16[to + 3] = 4 * Wi + 2, ki.uint16[to + 4] = 4 * Wi + 3, ki.uint16[to + 5] = 4 * Wi + 0;
                }
                return ki;
              }(bt));
              for (var _a = Te.createIndexBuffer(Lt, true), Pa = Te.createVertexBuffer(Or, i.collisionCircleLayout.members, true), ii = 0, Oi = lt; ii < Oi.length; ii += 1) {
                var Da = Oi[ii], wi = bu(Da.transform, Da.invTransform, P2.transform);
                Pr.draw(Te, Fe.TRIANGLES, st.disabled, Ie.disabled, P2.colorModeForRenderPass(), $e.disabled, wi, G2.id, Pa, _a, i.SegmentVector.simpleSegment(0, 2 * Da.circleOffset, Da.circleArray.length, Da.circleArray.length / 2), null, P2.transform.zoom, null, null, null);
              }
              Pa.destroy(), _a.destroy();
            }
          }
          var Wr = i.identity(new Float32Array(16));
          function kn(P2, U2, G2, J2, oe, de) {
            var ye = i.getAnchorAlignment(P2), Te = -(ye.horizontalAlign - 0.5) * U2, Fe = -(ye.verticalAlign - 0.5) * G2, et = i.evaluateVariableOffset(P2, J2);
            return new i.Point((Te / oe + et[0]) * de, (Fe / oe + et[1]) * de);
          }
          function On(P2, U2, G2, J2, oe, de, ye, Te, Fe, et, lt) {
            var bt = P2.text.placedSymbolArray, It = P2.text.dynamicLayoutVertexArray, Rt = P2.icon.dynamicLayoutVertexArray, Ft = {};
            It.clear();
            for (var Pt = 0; Pt < bt.length; Pt++) {
              var Mt = bt.get(Pt), qt = P2.allowVerticalPlacement && !Mt.placedOrientation, $t = Mt.hidden || !Mt.crossTileID || qt ? null : J2[Mt.crossTileID];
              if ($t) {
                var Yt = new i.Point(Mt.anchorX, Mt.anchorY), cr = pr(Yt, G2 ? Te : ye), kr = lr(de.cameraToCenterDistance, cr.signedDistanceFromCamera), Pr = oe.evaluateSizeForFeature(P2.textSizeData, et, Mt) * kr / i.ONE_EM;
                G2 && (Pr *= P2.tilePixelRatio / Fe);
                for (var Or = $t.width, xn = $t.height, yn = kn($t.anchor, Or, xn, $t.textOffset, $t.textBoxScale, Pr), Nn = G2 ? pr(Yt.add(yn), ye).point : cr.point.add(U2 ? yn.rotate(-de.angle) : yn), An = P2.allowVerticalPlacement && Mt.placedOrientation === i.WritingMode.vertical ? Math.PI / 2 : 0, ma = 0; ma < Mt.numGlyphs; ma++) i.addDynamicAttributes(It, Nn, An);
                lt && Mt.associatedIconIndex >= 0 && (Ft[Mt.associatedIconIndex] = { shiftedAnchor: Nn, angle: An });
              } else Wn(Mt.numGlyphs, It);
            }
            if (lt) {
              Rt.clear();
              for (var Aa = P2.icon.placedSymbolArray, Qa = 0; Qa < Aa.length; Qa++) {
                var ln = Aa.get(Qa);
                if (ln.hidden) Wn(ln.numGlyphs, Rt);
                else {
                  var qn = Ft[Qa];
                  if (qn) for (var Sa = 0; Sa < ln.numGlyphs; Sa++) i.addDynamicAttributes(Rt, qn.shiftedAnchor, qn.angle);
                  else Wn(ln.numGlyphs, Rt);
                }
              }
              P2.icon.dynamicLayoutVertexBuffer.updateData(Rt);
            }
            P2.text.dynamicLayoutVertexBuffer.updateData(It);
          }
          function ta(P2, U2, G2) {
            return G2.iconsInText && U2 ? "symbolTextAndIcon" : P2 ? "symbolSDF" : "symbolIcon";
          }
          function sa(P2, U2, G2, J2, oe, de, ye, Te, Fe, et, lt, bt) {
            for (var It = P2.context, Rt = It.gl, Ft = P2.transform, Pt = Te === "map", Mt = Fe === "map", qt = Pt && G2.layout.get("symbol-placement") !== "point", $t = Pt && !Mt && !qt, Yt = G2.layout.get("symbol-sort-key").constantOr(1) !== void 0, cr = P2.depthModeForSublayer(0, st.ReadOnly), kr = G2.layout.get("text-variable-anchor"), Pr = [], Or = 0, xn = J2; Or < xn.length; Or += 1) {
              var yn = xn[Or], Nn = U2.getTile(yn), An = Nn.getBucket(G2);
              if (An) {
                var ma = oe ? An.text : An.icon;
                if (ma && ma.segments.get().length) {
                  var Aa = ma.programConfigurations.get(G2.id), Qa = oe || An.sdfIcons, ln = oe ? An.textSizeData : An.iconSizeData, qn = Mt || Ft.pitch !== 0, Sa = P2.useProgram(ta(Qa, oe, An), Aa), _a = i.evaluateSizeForZoom(ln, Ft.zoom), Pa = void 0, ii = [0, 0], Oi = void 0, Da = void 0, wi = null, di = void 0;
                  if (oe) {
                    if (Oi = Nn.glyphAtlasTexture, Da = Rt.LINEAR, Pa = Nn.glyphAtlasTexture.size, An.iconsInText) {
                      ii = Nn.imageAtlasTexture.size, wi = Nn.imageAtlasTexture;
                      var ji = ln.kind === "composite" || ln.kind === "camera";
                      di = qn || P2.options.rotating || P2.options.zooming || ji ? Rt.LINEAR : Rt.NEAREST;
                    }
                  } else {
                    var ki = G2.layout.get("icon-size").constantOr(0) !== 1 || An.iconsNeedLinear;
                    Oi = Nn.imageAtlasTexture, Da = Qa || P2.options.rotating || P2.options.zooming || ki || qn ? Rt.LINEAR : Rt.NEAREST, Pa = Nn.imageAtlasTexture.size;
                  }
                  var Wi = Nr(Nn, 1, P2.transform.zoom), to = Tr(yn.posMatrix, Mt, Pt, P2.transform, Wi), as = yr(yn.posMatrix, Mt, Pt, P2.transform, Wi), js = kr && An.hasTextData(), Ws = G2.layout.get("icon-text-fit") !== "none" && js && An.hasIconData();
                  qt && $r(An, yn.posMatrix, P2, oe, to, as, Mt, et);
                  var Qo = P2.translatePosMatrix(yn.posMatrix, Nn, de, ye), Cs = qt || oe && kr || Ws ? Wr : to, us = P2.translatePosMatrix(as, Nn, de, ye, true), ku = Qa && G2.paint.get(oe ? "text-halo-width" : "icon-halo-width").constantOr(1) !== 0, El = { program: Sa, buffers: ma, uniformValues: Qa ? An.iconsInText ? nr(ln.kind, _a, $t, Mt, P2, Qo, Cs, us, Pa, ii) : or(ln.kind, _a, $t, Mt, P2, Qo, Cs, us, oe, Pa, true) : ir(ln.kind, _a, $t, Mt, P2, Qo, Cs, us, oe, Pa), atlasTexture: Oi, atlasTextureIcon: wi, atlasInterpolation: Da, atlasInterpolationIcon: di, isSDF: Qa, hasHalo: ku };
                  if (Yt) for (var _c = 0, Jh = ma.segments.get(); _c < Jh.length; _c += 1) {
                    var Id = Jh[_c];
                    Pr.push({ segments: new i.SegmentVector([Id]), sortKey: Id.sortKey, state: El });
                  }
                  else Pr.push({ segments: ma.segments, sortKey: 0, state: El });
                }
              }
            }
            Yt && Pr.sort(function(dm, Df) {
              return dm.sortKey - Df.sortKey;
            });
            for (var pm = 0, ev = Pr; pm < ev.length; pm += 1) {
              var tv = ev[pm], Tu = tv.state;
              if (It.activeTexture.set(Rt.TEXTURE0), Tu.atlasTexture.bind(Tu.atlasInterpolation, Rt.CLAMP_TO_EDGE), Tu.atlasTextureIcon && (It.activeTexture.set(Rt.TEXTURE1), Tu.atlasTextureIcon && Tu.atlasTextureIcon.bind(Tu.atlasInterpolationIcon, Rt.CLAMP_TO_EDGE)), Tu.isSDF) {
                var u0 = Tu.uniformValues;
                Tu.hasHalo && (u0.u_is_halo = 1, xa(Tu.buffers, tv.segments, G2, P2, Tu.program, cr, lt, bt, u0)), u0.u_is_halo = 0;
              }
              xa(Tu.buffers, tv.segments, G2, P2, Tu.program, cr, lt, bt, Tu.uniformValues);
            }
          }
          function xa(P2, U2, G2, J2, oe, de, ye, Te, Fe) {
            var et = J2.context, lt = et.gl;
            oe.draw(et, lt.TRIANGLES, de, ye, Te, $e.disabled, Fe, G2.id, P2.layoutVertexBuffer, P2.indexBuffer, U2, G2.paint, J2.transform.zoom, P2.programConfigurations.get(G2.id), P2.dynamicLayoutVertexBuffer, P2.opacityVertexBuffer);
          }
          function la(P2, U2, G2, J2, oe, de, ye) {
            var Te, Fe, et, lt, bt, It = P2.context.gl, Rt = G2.paint.get("fill-pattern"), Ft = Rt && Rt.constantOr(1), Pt = G2.getCrossfadeParameters();
            ye ? (Fe = Ft && !G2.getPaintProperty("fill-outline-color") ? "fillOutlinePattern" : "fillOutline", Te = It.LINES) : (Fe = Ft ? "fillPattern" : "fill", Te = It.TRIANGLES);
            for (var Mt = 0, qt = J2; Mt < qt.length; Mt += 1) {
              var $t = qt[Mt], Yt = U2.getTile($t);
              if (!Ft || Yt.patternsLoaded()) {
                var cr = Yt.getBucket(G2);
                if (cr) {
                  var kr = cr.programConfigurations.get(G2.id), Pr = P2.useProgram(Fe, kr);
                  Ft && (P2.context.activeTexture.set(It.TEXTURE0), Yt.imageAtlasTexture.bind(It.LINEAR, It.CLAMP_TO_EDGE), kr.updatePaintBuffers(Pt));
                  var Or = Rt.constantOr(null);
                  if (Or && Yt.imageAtlas) {
                    var xn = Yt.imageAtlas, yn = xn.patternPositions[Or.to.toString()], Nn = xn.patternPositions[Or.from.toString()];
                    yn && Nn && kr.setConstantPatternPositions(yn, Nn);
                  }
                  var An = P2.translatePosMatrix($t.posMatrix, Yt, G2.paint.get("fill-translate"), G2.paint.get("fill-translate-anchor"));
                  if (ye) {
                    lt = cr.indexBuffer2, bt = cr.segments2;
                    var ma = [It.drawingBufferWidth, It.drawingBufferHeight];
                    et = Fe === "fillOutlinePattern" && Ft ? zc(An, P2, Pt, Yt, ma) : Rc(An, ma);
                  } else lt = cr.indexBuffer, bt = cr.segments, et = Ft ? nc(An, P2, Pt, Yt) : rc(An);
                  Pr.draw(P2.context, Te, oe, P2.stencilModeForClipping($t), de, $e.disabled, et, G2.id, cr.layoutVertexBuffer, lt, bt, G2.paint, P2.transform.zoom, kr);
                }
              }
            }
          }
          function ci(P2, U2, G2, J2, oe, de, ye) {
            for (var Te = P2.context, Fe = Te.gl, et = G2.paint.get("fill-extrusion-pattern"), lt = et.constantOr(1), bt = G2.getCrossfadeParameters(), It = G2.paint.get("fill-extrusion-opacity"), Rt = 0, Ft = J2; Rt < Ft.length; Rt += 1) {
              var Pt = Ft[Rt], Mt = U2.getTile(Pt), qt = Mt.getBucket(G2);
              if (qt) {
                var $t = qt.programConfigurations.get(G2.id), Yt = P2.useProgram(lt ? "fillExtrusionPattern" : "fillExtrusion", $t);
                lt && (P2.context.activeTexture.set(Fe.TEXTURE0), Mt.imageAtlasTexture.bind(Fe.LINEAR, Fe.CLAMP_TO_EDGE), $t.updatePaintBuffers(bt));
                var cr = et.constantOr(null);
                if (cr && Mt.imageAtlas) {
                  var kr = Mt.imageAtlas, Pr = kr.patternPositions[cr.to.toString()], Or = kr.patternPositions[cr.from.toString()];
                  Pr && Or && $t.setConstantPatternPositions(Pr, Or);
                }
                var xn = P2.translatePosMatrix(Pt.posMatrix, Mt, G2.paint.get("fill-extrusion-translate"), G2.paint.get("fill-extrusion-translate-anchor")), yn = G2.paint.get("fill-extrusion-vertical-gradient"), Nn = lt ? Pp(xn, P2, yn, It, Pt, bt, Mt) : Yh(xn, P2, yn, It);
                Yt.draw(Te, Te.gl.TRIANGLES, oe, de, ye, $e.backCCW, Nn, G2.id, qt.layoutVertexBuffer, qt.indexBuffer, qt.segments, G2.paint, P2.transform.zoom, $t);
              }
            }
          }
          function Ci(P2, U2, G2, J2, oe, de) {
            var ye = P2.context, Te = ye.gl, Fe = U2.fbo;
            if (Fe) {
              var et = P2.useProgram("hillshade");
              ye.activeTexture.set(Te.TEXTURE0), Te.bindTexture(Te.TEXTURE_2D, Fe.colorAttachment.get());
              var lt = function(bt, It, Rt) {
                var Ft = Rt.paint.get("hillshade-shadow-color"), Pt = Rt.paint.get("hillshade-highlight-color"), Mt = Rt.paint.get("hillshade-accent-color"), qt = Rt.paint.get("hillshade-illumination-direction") * (Math.PI / 180);
                Rt.paint.get("hillshade-illumination-anchor") === "viewport" && (qt -= bt.transform.angle);
                var $t = !bt.options.moving;
                return { u_matrix: bt.transform.calculatePosMatrix(It.tileID.toUnwrapped(), $t), u_image: 0, u_latrange: _h(bt, It.tileID), u_light: [Rt.paint.get("hillshade-exaggeration"), qt], u_shadow: Ft, u_highlight: Pt, u_accent: Mt };
              }(P2, U2, G2);
              et.draw(ye, Te.TRIANGLES, J2, oe, de, $e.disabled, lt, G2.id, P2.rasterBoundsBuffer, P2.quadTriangleIndexBuffer, P2.rasterBoundsSegments);
            }
          }
          function Qi(P2, U2, G2, J2, oe, de, ye) {
            var Te = P2.context, Fe = Te.gl, et = U2.dem;
            if (et && et.data) {
              var lt = et.dim, bt = et.stride, It = et.getPixels();
              if (Te.activeTexture.set(Fe.TEXTURE1), Te.pixelStoreUnpackPremultiplyAlpha.set(false), U2.demTexture = U2.demTexture || P2.getTileTexture(bt), U2.demTexture) {
                var Rt = U2.demTexture;
                Rt.update(It, { premultiply: false }), Rt.bind(Fe.NEAREST, Fe.CLAMP_TO_EDGE);
              } else U2.demTexture = new i.Texture(Te, It, Fe.RGBA, { premultiply: false }), U2.demTexture.bind(Fe.NEAREST, Fe.CLAMP_TO_EDGE);
              Te.activeTexture.set(Fe.TEXTURE0);
              var Ft = U2.fbo;
              if (!Ft) {
                var Pt = new i.Texture(Te, { width: lt, height: lt, data: null }, Fe.RGBA);
                Pt.bind(Fe.LINEAR, Fe.CLAMP_TO_EDGE), (Ft = U2.fbo = Te.createFramebuffer(lt, lt, true)).colorAttachment.set(Pt.texture);
              }
              Te.bindFramebuffer.set(Ft.framebuffer), Te.viewport.set([0, 0, lt, lt]), P2.useProgram("hillshadePrepare").draw(Te, Fe.TRIANGLES, oe, de, ye, $e.disabled, function(Mt, qt, $t) {
                var Yt = qt.stride, cr = i.create();
                return i.ortho(cr, 0, i.EXTENT, -i.EXTENT, 0, 0, 1), i.translate(cr, cr, [0, -i.EXTENT, 0]), { u_matrix: cr, u_image: 1, u_dimension: [Yt, Yt], u_zoom: Mt.overscaledZ, u_maxzoom: $t, u_unpack: qt.getUnpackVector() };
              }(U2.tileID, et, J2), G2.id, P2.rasterBoundsBuffer, P2.quadTriangleIndexBuffer, P2.rasterBoundsSegments), U2.needsHillshadePrepare = false;
            }
          }
          function Zi(P2, U2, G2, J2, oe) {
            var de = J2.paint.get("raster-fade-duration");
            if (de > 0) {
              var ye = i.browser.now(), Te = (ye - P2.timeAdded) / de, Fe = U2 ? (ye - U2.timeAdded) / de : -1, et = G2.getSource(), lt = oe.coveringZoomLevel({ tileSize: et.tileSize, roundZoom: et.roundZoom }), bt = !U2 || Math.abs(U2.tileID.overscaledZ - lt) > Math.abs(P2.tileID.overscaledZ - lt), It = bt && P2.refreshedUponExpiration ? 1 : i.clamp(bt ? Te : 1 - Fe, 0, 1);
              return P2.refreshedUponExpiration && Te >= 1 && (P2.refreshedUponExpiration = false), U2 ? { opacity: 1, mix: 1 - It } : { opacity: It, mix: 0 };
            }
            return { opacity: 1, mix: 0 };
          }
          var eo = new i.Color(1, 0, 0, 1), Es = new i.Color(0, 1, 0, 1), vs = new i.Color(0, 0, 1, 1), Vo = new i.Color(1, 0, 1, 1), jo = new i.Color(0, 1, 1, 1);
          function ms(P2) {
            var U2 = P2.transform.padding;
            al(P2, P2.transform.height - (U2.top || 0), 3, eo), al(P2, U2.bottom || 0, 3, Es), Xl(P2, U2.left || 0, 3, vs), Xl(P2, P2.transform.width - (U2.right || 0), 3, Vo);
            var G2 = P2.transform.centerPoint;
            (function(J2, oe, de, ye) {
              Kl(J2, oe - 1, de - 10, 2, 20, ye), Kl(J2, oe - 10, de - 1, 20, 2, ye);
            })(P2, G2.x, P2.transform.height - G2.y, jo);
          }
          function al(P2, U2, G2, J2) {
            Kl(P2, 0, U2 + G2 / 2, P2.transform.width, G2, J2);
          }
          function Xl(P2, U2, G2, J2) {
            Kl(P2, U2 - G2 / 2, 0, G2, P2.transform.height, J2);
          }
          function Kl(P2, U2, G2, J2, oe, de) {
            var ye = P2.context, Te = ye.gl;
            Te.enable(Te.SCISSOR_TEST), Te.scissor(U2 * i.browser.devicePixelRatio, G2 * i.browser.devicePixelRatio, J2 * i.browser.devicePixelRatio, oe * i.browser.devicePixelRatio), ye.clear({ color: de }), Te.disable(Te.SCISSOR_TEST);
          }
          function Yl(P2, U2, G2) {
            var J2 = P2.context, oe = J2.gl, de = G2.posMatrix, ye = P2.useProgram("debug"), Te = st.disabled, Fe = Ie.disabled, et = P2.colorModeForRenderPass();
            J2.activeTexture.set(oe.TEXTURE0), P2.emptyTexture.bind(oe.LINEAR, oe.CLAMP_TO_EDGE), ye.draw(J2, oe.LINE_STRIP, Te, Fe, et, $e.disabled, bh(de, i.Color.red), "$debug", P2.debugBuffer, P2.tileBorderIndexBuffer, P2.debugSegments);
            var lt = U2.getTileByID(G2.key).latestRawTileData, bt = lt && lt.byteLength || 0, It = Math.floor(bt / 1024), Rt = U2.getTile(G2).tileSize, Ft = 512 / Math.min(Rt, 512) * (G2.overscaledZ / P2.transform.zoom) * 0.5, Pt = G2.canonical.toString();
            G2.overscaledZ !== G2.canonical.z && (Pt += " => " + G2.overscaledZ), function(Mt, qt) {
              Mt.initDebugOverlayCanvas();
              var $t = Mt.debugOverlayCanvas, Yt = Mt.context.gl, cr = Mt.debugOverlayCanvas.getContext("2d");
              cr.clearRect(0, 0, $t.width, $t.height), cr.shadowColor = "white", cr.shadowBlur = 2, cr.lineWidth = 1.5, cr.strokeStyle = "white", cr.textBaseline = "top", cr.font = "bold 36px Open Sans, sans-serif", cr.fillText(qt, 5, 5), cr.strokeText(qt, 5, 5), Mt.debugOverlayTexture.update($t), Mt.debugOverlayTexture.bind(Yt.LINEAR, Yt.CLAMP_TO_EDGE);
            }(P2, Pt + " " + It + "kb"), ye.draw(J2, oe.TRIANGLES, Te, Fe, Pe.alphaBlended, $e.disabled, bh(de, i.Color.transparent, Ft), "$debug", P2.debugBuffer, P2.quadTriangleIndexBuffer, P2.debugSegments);
          }
          var Zl = { symbol: function(P2, U2, G2, J2, oe) {
            if (P2.renderPass === "translucent") {
              var de = Ie.disabled, ye = P2.colorModeForRenderPass();
              G2.layout.get("text-variable-anchor") && function(Te, Fe, et, lt, bt, It, Rt) {
                for (var Ft = Fe.transform, Pt = bt === "map", Mt = It === "map", qt = 0, $t = Te; qt < $t.length; qt += 1) {
                  var Yt = $t[qt], cr = lt.getTile(Yt), kr = cr.getBucket(et);
                  if (kr && kr.text && kr.text.segments.get().length) {
                    var Pr = kr.textSizeData, Or = i.evaluateSizeForZoom(Pr, Ft.zoom), xn = Nr(cr, 1, Fe.transform.zoom), yn = Tr(Yt.posMatrix, Mt, Pt, Fe.transform, xn), Nn = et.layout.get("icon-text-fit") !== "none" && kr.hasIconData();
                    if (Or) {
                      var An = Math.pow(2, Ft.zoom - cr.tileID.overscaledZ);
                      On(kr, Pt, Mt, Rt, i.symbolSize, Ft, yn, Yt.posMatrix, An, Or, Nn);
                    }
                  }
                }
              }(J2, P2, G2, U2, G2.layout.get("text-rotation-alignment"), G2.layout.get("text-pitch-alignment"), oe), G2.paint.get("icon-opacity").constantOr(1) !== 0 && sa(P2, U2, G2, J2, false, G2.paint.get("icon-translate"), G2.paint.get("icon-translate-anchor"), G2.layout.get("icon-rotation-alignment"), G2.layout.get("icon-pitch-alignment"), G2.layout.get("icon-keep-upright"), de, ye), G2.paint.get("text-opacity").constantOr(1) !== 0 && sa(P2, U2, G2, J2, true, G2.paint.get("text-translate"), G2.paint.get("text-translate-anchor"), G2.layout.get("text-rotation-alignment"), G2.layout.get("text-pitch-alignment"), G2.layout.get("text-keep-upright"), de, ye), U2.map.showCollisionBoxes && (Mr(P2, U2, G2, J2, G2.paint.get("text-translate"), G2.paint.get("text-translate-anchor"), true), Mr(P2, U2, G2, J2, G2.paint.get("icon-translate"), G2.paint.get("icon-translate-anchor"), false));
            }
          }, circle: function(P2, U2, G2, J2) {
            if (P2.renderPass === "translucent") {
              var oe = G2.paint.get("circle-opacity"), de = G2.paint.get("circle-stroke-width"), ye = G2.paint.get("circle-stroke-opacity"), Te = G2.layout.get("circle-sort-key").constantOr(1) !== void 0;
              if (oe.constantOr(1) !== 0 || de.constantOr(1) !== 0 && ye.constantOr(1) !== 0) {
                for (var Fe = P2.context, et = Fe.gl, lt = P2.depthModeForSublayer(0, st.ReadOnly), bt = Ie.disabled, It = P2.colorModeForRenderPass(), Rt = [], Ft = 0; Ft < J2.length; Ft++) {
                  var Pt = J2[Ft], Mt = U2.getTile(Pt), qt = Mt.getBucket(G2);
                  if (qt) {
                    var $t = qt.programConfigurations.get(G2.id), Yt = { programConfiguration: $t, program: P2.useProgram("circle", $t), layoutVertexBuffer: qt.layoutVertexBuffer, indexBuffer: qt.indexBuffer, uniformValues: Bc(P2, Pt, Mt, G2) };
                    if (Te) for (var cr = 0, kr = qt.segments.get(); cr < kr.length; cr += 1) {
                      var Pr = kr[cr];
                      Rt.push({ segments: new i.SegmentVector([Pr]), sortKey: Pr.sortKey, state: Yt });
                    }
                    else Rt.push({ segments: qt.segments, sortKey: 0, state: Yt });
                  }
                }
                Te && Rt.sort(function(Sa, _a) {
                  return Sa.sortKey - _a.sortKey;
                });
                for (var Or = 0, xn = Rt; Or < xn.length; Or += 1) {
                  var yn = xn[Or], Nn = yn.state, An = Nn.programConfiguration, ma = Nn.program, Aa = Nn.layoutVertexBuffer, Qa = Nn.indexBuffer, ln = Nn.uniformValues, qn = yn.segments;
                  ma.draw(Fe, et.TRIANGLES, lt, bt, It, $e.disabled, ln, G2.id, Aa, Qa, qn, G2.paint, P2.transform.zoom, An);
                }
              }
            }
          }, heatmap: function(P2, U2, G2, J2) {
            if (G2.paint.get("heatmap-opacity") !== 0) if (P2.renderPass === "offscreen") {
              var oe = P2.context, de = oe.gl, ye = Ie.disabled, Te = new Pe([de.ONE, de.ONE], i.Color.transparent, [true, true, true, true]);
              (function(Pt, Mt, qt) {
                var $t = Pt.gl;
                Pt.activeTexture.set($t.TEXTURE1), Pt.viewport.set([0, 0, Mt.width / 4, Mt.height / 4]);
                var Yt = qt.heatmapFbo;
                if (Yt) $t.bindTexture($t.TEXTURE_2D, Yt.colorAttachment.get()), Pt.bindFramebuffer.set(Yt.framebuffer);
                else {
                  var cr = $t.createTexture();
                  $t.bindTexture($t.TEXTURE_2D, cr), $t.texParameteri($t.TEXTURE_2D, $t.TEXTURE_WRAP_S, $t.CLAMP_TO_EDGE), $t.texParameteri($t.TEXTURE_2D, $t.TEXTURE_WRAP_T, $t.CLAMP_TO_EDGE), $t.texParameteri($t.TEXTURE_2D, $t.TEXTURE_MIN_FILTER, $t.LINEAR), $t.texParameteri($t.TEXTURE_2D, $t.TEXTURE_MAG_FILTER, $t.LINEAR), Yt = qt.heatmapFbo = Pt.createFramebuffer(Mt.width / 4, Mt.height / 4, false), function(kr, Pr, Or, xn) {
                    var yn = kr.gl, Nn = kr.extRenderToTextureHalfFloat ? kr.extTextureHalfFloat.HALF_FLOAT_OES : yn.UNSIGNED_BYTE;
                    yn.texImage2D(yn.TEXTURE_2D, 0, yn.RGBA, Pr.width / 4, Pr.height / 4, 0, yn.RGBA, Nn, null), xn.colorAttachment.set(Or);
                  }(Pt, Mt, cr, Yt);
                }
              })(oe, P2, G2), oe.clear({ color: i.Color.transparent });
              for (var Fe = 0; Fe < J2.length; Fe++) {
                var et = J2[Fe];
                if (!U2.hasRenderableParent(et)) {
                  var lt = U2.getTile(et), bt = lt.getBucket(G2);
                  if (bt) {
                    var It = bt.programConfigurations.get(G2.id), Rt = P2.useProgram("heatmap", It), Ft = P2.transform.zoom;
                    Rt.draw(oe, de.TRIANGLES, st.disabled, ye, Te, $e.disabled, Uc(et.posMatrix, lt, Ft, G2.paint.get("heatmap-intensity")), G2.id, bt.layoutVertexBuffer, bt.indexBuffer, bt.segments, G2.paint, P2.transform.zoom, It);
                  }
                }
              }
              oe.viewport.set([0, 0, P2.width, P2.height]);
            } else P2.renderPass === "translucent" && (P2.context.setColorMode(P2.colorModeForRenderPass()), function(Pt, Mt) {
              var qt = Pt.context, $t = qt.gl, Yt = Mt.heatmapFbo;
              if (!!Yt) {
                qt.activeTexture.set($t.TEXTURE0), $t.bindTexture($t.TEXTURE_2D, Yt.colorAttachment.get()), qt.activeTexture.set($t.TEXTURE1);
                var cr = Mt.colorRampTexture;
                cr || (cr = Mt.colorRampTexture = new i.Texture(qt, Mt.colorRamp, $t.RGBA)), cr.bind($t.LINEAR, $t.CLAMP_TO_EDGE), Pt.useProgram("heatmapTexture").draw(qt, $t.TRIANGLES, st.disabled, Ie.disabled, Pt.colorModeForRenderPass(), $e.disabled, function(kr, Pr, Or, xn) {
                  var yn = i.create();
                  i.ortho(yn, 0, kr.width, kr.height, 0, 0, 1);
                  var Nn = kr.context.gl;
                  return { u_matrix: yn, u_world: [Nn.drawingBufferWidth, Nn.drawingBufferHeight], u_image: Or, u_color_ramp: xn, u_opacity: Pr.paint.get("heatmap-opacity") };
                }(Pt, Mt, 0, 1), Mt.id, Pt.viewportBuffer, Pt.quadTriangleIndexBuffer, Pt.viewportSegments, Mt.paint, Pt.transform.zoom);
              }
            }(P2, G2));
          }, line: function(P2, U2, G2, J2) {
            if (P2.renderPass === "translucent") {
              var oe = G2.paint.get("line-opacity"), de = G2.paint.get("line-width");
              if (oe.constantOr(1) !== 0 && de.constantOr(1) !== 0) {
                var ye = P2.depthModeForSublayer(0, st.ReadOnly), Te = P2.colorModeForRenderPass(), Fe = G2.paint.get("line-dasharray"), et = G2.paint.get("line-pattern"), lt = et.constantOr(1), bt = G2.paint.get("line-gradient"), It = G2.getCrossfadeParameters(), Rt = lt ? "linePattern" : Fe ? "lineSDF" : bt ? "lineGradient" : "line", Ft = P2.context, Pt = Ft.gl, Mt = true;
                if (bt) {
                  Ft.activeTexture.set(Pt.TEXTURE0);
                  var qt = G2.gradientTexture;
                  if (!G2.gradient) return;
                  qt || (qt = G2.gradientTexture = new i.Texture(Ft, G2.gradient, Pt.RGBA)), qt.bind(Pt.LINEAR, Pt.CLAMP_TO_EDGE);
                }
                for (var $t = 0, Yt = J2; $t < Yt.length; $t += 1) {
                  var cr = Yt[$t], kr = U2.getTile(cr);
                  if (!lt || kr.patternsLoaded()) {
                    var Pr = kr.getBucket(G2);
                    if (Pr) {
                      var Or = Pr.programConfigurations.get(G2.id), xn = P2.context.program.get(), yn = P2.useProgram(Rt, Or), Nn = Mt || yn.program !== xn, An = et.constantOr(null);
                      if (An && kr.imageAtlas) {
                        var ma = kr.imageAtlas, Aa = ma.patternPositions[An.to.toString()], Qa = ma.patternPositions[An.from.toString()];
                        Aa && Qa && Or.setConstantPatternPositions(Aa, Qa);
                      }
                      var ln = lt ? Qe(P2, kr, G2, It) : Fe ? nt(P2, kr, G2, Fe, It) : bt ? lo(P2, kr, G2) : ac(P2, kr, G2);
                      lt ? (Ft.activeTexture.set(Pt.TEXTURE0), kr.imageAtlasTexture.bind(Pt.LINEAR, Pt.CLAMP_TO_EDGE), Or.updatePaintBuffers(It)) : Fe && (Nn || P2.lineAtlas.dirty) && (Ft.activeTexture.set(Pt.TEXTURE0), P2.lineAtlas.bind(Ft)), yn.draw(Ft, Pt.TRIANGLES, ye, P2.stencilModeForClipping(cr), Te, $e.disabled, ln, G2.id, Pr.layoutVertexBuffer, Pr.indexBuffer, Pr.segments, G2.paint, P2.transform.zoom, Or), Mt = false;
                    }
                  }
                }
              }
            }
          }, fill: function(P2, U2, G2, J2) {
            var oe = G2.paint.get("fill-color"), de = G2.paint.get("fill-opacity");
            if (de.constantOr(1) !== 0) {
              var ye = P2.colorModeForRenderPass(), Te = G2.paint.get("fill-pattern"), Fe = P2.opaquePassEnabledForLayer() && !Te.constantOr(1) && oe.constantOr(i.Color.transparent).a === 1 && de.constantOr(0) === 1 ? "opaque" : "translucent";
              if (P2.renderPass === Fe) {
                var et = P2.depthModeForSublayer(1, P2.renderPass === "opaque" ? st.ReadWrite : st.ReadOnly);
                la(P2, U2, G2, J2, et, ye, false);
              }
              if (P2.renderPass === "translucent" && G2.paint.get("fill-antialias")) {
                var lt = P2.depthModeForSublayer(G2.getPaintProperty("fill-outline-color") ? 2 : 0, st.ReadOnly);
                la(P2, U2, G2, J2, lt, ye, true);
              }
            }
          }, "fill-extrusion": function(P2, U2, G2, J2) {
            var oe = G2.paint.get("fill-extrusion-opacity");
            if (oe !== 0 && P2.renderPass === "translucent") {
              var de = new st(P2.context.gl.LEQUAL, st.ReadWrite, P2.depthRangeFor3D);
              if (oe !== 1 || G2.paint.get("fill-extrusion-pattern").constantOr(1)) ci(P2, U2, G2, J2, de, Ie.disabled, Pe.disabled), ci(P2, U2, G2, J2, de, P2.stencilModeFor3D(), P2.colorModeForRenderPass());
              else {
                var ye = P2.colorModeForRenderPass();
                ci(P2, U2, G2, J2, de, Ie.disabled, ye);
              }
            }
          }, hillshade: function(P2, U2, G2, J2) {
            if (P2.renderPass === "offscreen" || P2.renderPass === "translucent") {
              for (var oe = P2.context, de = U2.getSource().maxzoom, ye = P2.depthModeForSublayer(0, st.ReadOnly), Te = P2.colorModeForRenderPass(), Fe = P2.renderPass === "translucent" ? P2.stencilConfigForOverlap(J2) : [{}, J2], et = Fe[0], lt = 0, bt = Fe[1]; lt < bt.length; lt += 1) {
                var It = bt[lt], Rt = U2.getTile(It);
                Rt.needsHillshadePrepare && P2.renderPass === "offscreen" ? Qi(P2, Rt, G2, de, ye, Ie.disabled, Te) : P2.renderPass === "translucent" && Ci(P2, Rt, G2, ye, et[It.overscaledZ], Te);
              }
              oe.viewport.set([0, 0, P2.width, P2.height]);
            }
          }, raster: function(P2, U2, G2, J2) {
            if (P2.renderPass === "translucent" && G2.paint.get("raster-opacity") !== 0 && J2.length) for (var oe = P2.context, de = oe.gl, ye = U2.getSource(), Te = P2.useProgram("raster"), Fe = P2.colorModeForRenderPass(), et = ye instanceof K2 ? [{}, J2] : P2.stencilConfigForOverlap(J2), lt = et[0], bt = et[1], It = bt[bt.length - 1].overscaledZ, Rt = !P2.options.moving, Ft = 0, Pt = bt; Ft < Pt.length; Ft += 1) {
              var Mt = Pt[Ft], qt = P2.depthModeForSublayer(Mt.overscaledZ - It, G2.paint.get("raster-opacity") === 1 ? st.ReadWrite : st.ReadOnly, de.LESS), $t = U2.getTile(Mt), Yt = P2.transform.calculatePosMatrix(Mt.toUnwrapped(), Rt);
              $t.registerFadeDuration(G2.paint.get("raster-fade-duration"));
              var cr = U2.findLoadedParent(Mt, 0), kr = Zi($t, cr, U2, G2, P2.transform), Pr = void 0, Or = void 0, xn = G2.paint.get("raster-resampling") === "nearest" ? de.NEAREST : de.LINEAR;
              oe.activeTexture.set(de.TEXTURE0), $t.texture.bind(xn, de.CLAMP_TO_EDGE, de.LINEAR_MIPMAP_NEAREST), oe.activeTexture.set(de.TEXTURE1), cr ? (cr.texture.bind(xn, de.CLAMP_TO_EDGE, de.LINEAR_MIPMAP_NEAREST), Pr = Math.pow(2, cr.tileID.overscaledZ - $t.tileID.overscaledZ), Or = [$t.tileID.canonical.x * Pr % 1, $t.tileID.canonical.y * Pr % 1]) : $t.texture.bind(xn, de.CLAMP_TO_EDGE, de.LINEAR_MIPMAP_NEAREST);
              var yn = Ct(Yt, Or || [0, 0], Pr || 1, kr, G2);
              ye instanceof K2 ? Te.draw(oe, de.TRIANGLES, qt, Ie.disabled, Fe, $e.disabled, yn, G2.id, ye.boundsBuffer, P2.quadTriangleIndexBuffer, ye.boundsSegments) : Te.draw(oe, de.TRIANGLES, qt, lt[Mt.overscaledZ], Fe, $e.disabled, yn, G2.id, P2.rasterBoundsBuffer, P2.quadTriangleIndexBuffer, P2.rasterBoundsSegments);
            }
          }, background: function(P2, U2, G2) {
            var J2 = G2.paint.get("background-color"), oe = G2.paint.get("background-opacity");
            if (oe !== 0) {
              var de = P2.context, ye = de.gl, Te = P2.transform, Fe = Te.tileSize, et = G2.paint.get("background-pattern");
              if (!P2.isPatternMissing(et)) {
                var lt = !et && J2.a === 1 && oe === 1 && P2.opaquePassEnabledForLayer() ? "opaque" : "translucent";
                if (P2.renderPass === lt) {
                  var bt = Ie.disabled, It = P2.depthModeForSublayer(0, lt === "opaque" ? st.ReadWrite : st.ReadOnly), Rt = P2.colorModeForRenderPass(), Ft = P2.useProgram(et ? "backgroundPattern" : "background"), Pt = Te.coveringTiles({ tileSize: Fe });
                  et && (de.activeTexture.set(ye.TEXTURE0), P2.imageManager.bind(P2.context));
                  for (var Mt = G2.getCrossfadeParameters(), qt = 0, $t = Pt; qt < $t.length; qt += 1) {
                    var Yt = $t[qt], cr = P2.transform.calculatePosMatrix(Yt.toUnwrapped()), kr = et ? wr(cr, oe, P2, et, { tileID: Yt, tileSize: Fe }, Mt) : fr(cr, oe, J2);
                    Ft.draw(de, ye.TRIANGLES, It, bt, Rt, $e.disabled, kr, G2.id, P2.tileExtentBuffer, P2.quadTriangleIndexBuffer, P2.tileExtentSegments);
                  }
                }
              }
            }
          }, debug: function(P2, U2, G2) {
            for (var J2 = 0; J2 < G2.length; J2++) Yl(P2, U2, G2[J2]);
          }, custom: function(P2, U2, G2) {
            var J2 = P2.context, oe = G2.implementation;
            if (P2.renderPass === "offscreen") {
              var de = oe.prerender;
              de && (P2.setCustomLayerDefaults(), J2.setColorMode(P2.colorModeForRenderPass()), de.call(oe, J2.gl, P2.transform.customLayerMatrix()), J2.setDirty(), P2.setBaseState());
            } else if (P2.renderPass === "translucent") {
              P2.setCustomLayerDefaults(), J2.setColorMode(P2.colorModeForRenderPass()), J2.setStencilMode(Ie.disabled);
              var ye = oe.renderingMode === "3d" ? new st(P2.context.gl.LEQUAL, st.ReadWrite, P2.depthRangeFor3D) : P2.depthModeForSublayer(0, st.ReadOnly);
              J2.setDepthMode(ye), oe.render(J2.gl, P2.transform.customLayerMatrix()), J2.setDirty(), P2.setBaseState(), J2.bindFramebuffer.set(null);
            }
          } }, qi = function(P2, U2) {
            this.context = new Ve(P2), this.transform = U2, this._tileTextures = {}, this.setup(), this.numSublayers = ut.maxUnderzooming + ut.maxOverzooming + 1, this.depthEpsilon = 1 / Math.pow(2, 16), this.crossTileSymbolIndex = new an(), this.gpuTimers = {};
          };
          qi.prototype.resize = function(P2, U2) {
            if (this.width = P2 * i.browser.devicePixelRatio, this.height = U2 * i.browser.devicePixelRatio, this.context.viewport.set([0, 0, this.width, this.height]), this.style) for (var G2 = 0, J2 = this.style._order; G2 < J2.length; G2 += 1) {
              var oe = J2[G2];
              this.style._layers[oe].resize();
            }
          }, qi.prototype.setup = function() {
            var P2 = this.context, U2 = new i.StructArrayLayout2i4();
            U2.emplaceBack(0, 0), U2.emplaceBack(i.EXTENT, 0), U2.emplaceBack(0, i.EXTENT), U2.emplaceBack(i.EXTENT, i.EXTENT), this.tileExtentBuffer = P2.createVertexBuffer(U2, zn.members), this.tileExtentSegments = i.SegmentVector.simpleSegment(0, 0, 4, 2);
            var G2 = new i.StructArrayLayout2i4();
            G2.emplaceBack(0, 0), G2.emplaceBack(i.EXTENT, 0), G2.emplaceBack(0, i.EXTENT), G2.emplaceBack(i.EXTENT, i.EXTENT), this.debugBuffer = P2.createVertexBuffer(G2, zn.members), this.debugSegments = i.SegmentVector.simpleSegment(0, 0, 4, 5);
            var J2 = new i.StructArrayLayout4i8();
            J2.emplaceBack(0, 0, 0, 0), J2.emplaceBack(i.EXTENT, 0, i.EXTENT, 0), J2.emplaceBack(0, i.EXTENT, 0, i.EXTENT), J2.emplaceBack(i.EXTENT, i.EXTENT, i.EXTENT, i.EXTENT), this.rasterBoundsBuffer = P2.createVertexBuffer(J2, Y2.members), this.rasterBoundsSegments = i.SegmentVector.simpleSegment(0, 0, 4, 2);
            var oe = new i.StructArrayLayout2i4();
            oe.emplaceBack(0, 0), oe.emplaceBack(1, 0), oe.emplaceBack(0, 1), oe.emplaceBack(1, 1), this.viewportBuffer = P2.createVertexBuffer(oe, zn.members), this.viewportSegments = i.SegmentVector.simpleSegment(0, 0, 4, 2);
            var de = new i.StructArrayLayout1ui2();
            de.emplaceBack(0), de.emplaceBack(1), de.emplaceBack(3), de.emplaceBack(2), de.emplaceBack(0), this.tileBorderIndexBuffer = P2.createIndexBuffer(de);
            var ye = new i.StructArrayLayout3ui6();
            ye.emplaceBack(0, 1, 2), ye.emplaceBack(2, 1, 3), this.quadTriangleIndexBuffer = P2.createIndexBuffer(ye), this.emptyTexture = new i.Texture(P2, { width: 1, height: 1, data: new Uint8Array([0, 0, 0, 0]) }, P2.gl.RGBA);
            var Te = this.context.gl;
            this.stencilClearMode = new Ie({ func: Te.ALWAYS, mask: 0 }, 0, 255, Te.ZERO, Te.ZERO, Te.ZERO);
          }, qi.prototype.clearStencil = function() {
            var P2 = this.context, U2 = P2.gl;
            this.nextStencilID = 1, this.currentStencilSource = void 0;
            var G2 = i.create();
            i.ortho(G2, 0, this.width, this.height, 0, 0, 1), i.scale(G2, G2, [U2.drawingBufferWidth, U2.drawingBufferHeight, 0]), this.useProgram("clippingMask").draw(P2, U2.TRIANGLES, st.disabled, this.stencilClearMode, Pe.disabled, $e.disabled, cu(G2), "$clipping", this.viewportBuffer, this.quadTriangleIndexBuffer, this.viewportSegments);
          }, qi.prototype._renderTileClippingMasks = function(P2, U2) {
            if (this.currentStencilSource !== P2.source && P2.isTileClipped() && U2 && U2.length) {
              this.currentStencilSource = P2.source;
              var G2 = this.context, J2 = G2.gl;
              this.nextStencilID + U2.length > 256 && this.clearStencil(), G2.setColorMode(Pe.disabled), G2.setDepthMode(st.disabled);
              var oe = this.useProgram("clippingMask");
              this._tileClippingMaskIDs = {};
              for (var de = 0, ye = U2; de < ye.length; de += 1) {
                var Te = ye[de], Fe = this._tileClippingMaskIDs[Te.key] = this.nextStencilID++;
                oe.draw(G2, J2.TRIANGLES, st.disabled, new Ie({ func: J2.ALWAYS, mask: 0 }, Fe, 255, J2.KEEP, J2.KEEP, J2.REPLACE), Pe.disabled, $e.disabled, cu(Te.posMatrix), "$clipping", this.tileExtentBuffer, this.quadTriangleIndexBuffer, this.tileExtentSegments);
              }
            }
          }, qi.prototype.stencilModeFor3D = function() {
            this.currentStencilSource = void 0, this.nextStencilID + 1 > 256 && this.clearStencil();
            var P2 = this.nextStencilID++, U2 = this.context.gl;
            return new Ie({ func: U2.NOTEQUAL, mask: 255 }, P2, 255, U2.KEEP, U2.KEEP, U2.REPLACE);
          }, qi.prototype.stencilModeForClipping = function(P2) {
            var U2 = this.context.gl;
            return new Ie({ func: U2.EQUAL, mask: 255 }, this._tileClippingMaskIDs[P2.key], 0, U2.KEEP, U2.KEEP, U2.REPLACE);
          }, qi.prototype.stencilConfigForOverlap = function(P2) {
            var U2, G2 = this.context.gl, J2 = P2.sort(function(Fe, et) {
              return et.overscaledZ - Fe.overscaledZ;
            }), oe = J2[J2.length - 1].overscaledZ, de = J2[0].overscaledZ - oe + 1;
            if (de > 1) {
              this.currentStencilSource = void 0, this.nextStencilID + de > 256 && this.clearStencil();
              for (var ye = {}, Te = 0; Te < de; Te++) ye[Te + oe] = new Ie({ func: G2.GEQUAL, mask: 255 }, Te + this.nextStencilID, 255, G2.KEEP, G2.KEEP, G2.REPLACE);
              return this.nextStencilID += de, [ye, J2];
            }
            return [(U2 = {}, U2[oe] = Ie.disabled, U2), J2];
          }, qi.prototype.colorModeForRenderPass = function() {
            var P2 = this.context.gl;
            return this._showOverdrawInspector ? new Pe([P2.CONSTANT_COLOR, P2.ONE], new i.Color(1 / 8, 1 / 8, 1 / 8, 0), [true, true, true, true]) : this.renderPass === "opaque" ? Pe.unblended : Pe.alphaBlended;
          }, qi.prototype.depthModeForSublayer = function(P2, U2, G2) {
            if (!this.opaquePassEnabledForLayer()) return st.disabled;
            var J2 = 1 - ((1 + this.currentLayer) * this.numSublayers + P2) * this.depthEpsilon;
            return new st(G2 || this.context.gl.LEQUAL, U2, [J2, J2]);
          }, qi.prototype.opaquePassEnabledForLayer = function() {
            return this.currentLayer < this.opaquePassCutoff;
          }, qi.prototype.render = function(P2, U2) {
            var G2 = this;
            this.style = P2, this.options = U2, this.lineAtlas = P2.lineAtlas, this.imageManager = P2.imageManager, this.glyphManager = P2.glyphManager, this.symbolFadeChange = P2.placement.symbolFadeChange(i.browser.now()), this.imageManager.beginFrame();
            var J2 = this.style._order, oe = this.style.sourceCaches;
            for (var de in oe) {
              var ye = oe[de];
              ye.used && ye.prepare(this.context);
            }
            var Te, Fe, et = {}, lt = {}, bt = {};
            for (var It in oe) {
              var Rt = oe[It];
              et[It] = Rt.getVisibleCoordinates(), lt[It] = et[It].slice().reverse(), bt[It] = Rt.getVisibleCoordinates(true).reverse();
            }
            this.opaquePassCutoff = 1 / 0;
            for (var Ft = 0; Ft < J2.length; Ft++) {
              var Pt = J2[Ft];
              if (this.style._layers[Pt].is3D()) {
                this.opaquePassCutoff = Ft;
                break;
              }
            }
            this.renderPass = "offscreen";
            for (var Mt = 0, qt = J2; Mt < qt.length; Mt += 1) {
              var $t = qt[Mt], Yt = this.style._layers[$t];
              if (Yt.hasOffscreenPass() && !Yt.isHidden(this.transform.zoom)) {
                var cr = lt[Yt.source];
                (Yt.type === "custom" || cr.length) && this.renderLayer(this, oe[Yt.source], Yt, cr);
              }
            }
            for (this.context.bindFramebuffer.set(null), this.context.clear({ color: U2.showOverdrawInspector ? i.Color.black : i.Color.transparent, depth: 1 }), this.clearStencil(), this._showOverdrawInspector = U2.showOverdrawInspector, this.depthRangeFor3D = [0, 1 - (P2._order.length + 2) * this.numSublayers * this.depthEpsilon], this.renderPass = "opaque", this.currentLayer = J2.length - 1; this.currentLayer >= 0; this.currentLayer--) {
              var kr = this.style._layers[J2[this.currentLayer]], Pr = oe[kr.source], Or = et[kr.source];
              this._renderTileClippingMasks(kr, Or), this.renderLayer(this, Pr, kr, Or);
            }
            for (this.renderPass = "translucent", this.currentLayer = 0; this.currentLayer < J2.length; this.currentLayer++) {
              var xn = this.style._layers[J2[this.currentLayer]], yn = oe[xn.source], Nn = (xn.type === "symbol" ? bt : lt)[xn.source];
              this._renderTileClippingMasks(xn, et[xn.source]), this.renderLayer(this, yn, xn, Nn);
            }
            this.options.showTileBoundaries && (i.values(this.style._layers).forEach(function(An) {
              An.source && !An.isHidden(G2.transform.zoom) && (An.source !== (Fe && Fe.id) && (Fe = G2.style.sourceCaches[An.source]), (!Te || Te.getSource().maxzoom < Fe.getSource().maxzoom) && (Te = Fe));
            }), Te && Zl.debug(this, Te, Te.getVisibleCoordinates())), this.options.showPadding && ms(this), this.context.setDefault();
          }, qi.prototype.renderLayer = function(P2, U2, G2, J2) {
            G2.isHidden(this.transform.zoom) || (G2.type === "background" || G2.type === "custom" || J2.length) && (this.id = G2.id, this.gpuTimingStart(G2), Zl[G2.type](P2, U2, G2, J2, this.style.placement.variableOffsets), this.gpuTimingEnd());
          }, qi.prototype.gpuTimingStart = function(P2) {
            if (this.options.gpuTiming) {
              var U2 = this.context.extTimerQuery, G2 = this.gpuTimers[P2.id];
              G2 || (G2 = this.gpuTimers[P2.id] = { calls: 0, cpuTime: 0, query: U2.createQueryEXT() }), G2.calls++, U2.beginQueryEXT(U2.TIME_ELAPSED_EXT, G2.query);
            }
          }, qi.prototype.gpuTimingEnd = function() {
            if (this.options.gpuTiming) {
              var P2 = this.context.extTimerQuery;
              P2.endQueryEXT(P2.TIME_ELAPSED_EXT);
            }
          }, qi.prototype.collectGpuTimers = function() {
            var P2 = this.gpuTimers;
            return this.gpuTimers = {}, P2;
          }, qi.prototype.queryGpuTimers = function(P2) {
            var U2 = {};
            for (var G2 in P2) {
              var J2 = P2[G2], oe = this.context.extTimerQuery, de = oe.getQueryObjectEXT(J2.query, oe.QUERY_RESULT_EXT) / 1e6;
              oe.deleteQueryEXT(J2.query), U2[G2] = de;
            }
            return U2;
          }, qi.prototype.translatePosMatrix = function(P2, U2, G2, J2, oe) {
            if (!G2[0] && !G2[1]) return P2;
            var de = oe ? J2 === "map" ? this.transform.angle : 0 : J2 === "viewport" ? -this.transform.angle : 0;
            if (de) {
              var ye = Math.sin(de), Te = Math.cos(de);
              G2 = [G2[0] * Te - G2[1] * ye, G2[0] * ye + G2[1] * Te];
            }
            var Fe = [oe ? G2[0] : Nr(U2, G2[0], this.transform.zoom), oe ? G2[1] : Nr(U2, G2[1], this.transform.zoom), 0], et = new Float32Array(16);
            return i.translate(et, P2, Fe), et;
          }, qi.prototype.saveTileTexture = function(P2) {
            var U2 = this._tileTextures[P2.size[0]];
            U2 ? U2.push(P2) : this._tileTextures[P2.size[0]] = [P2];
          }, qi.prototype.getTileTexture = function(P2) {
            var U2 = this._tileTextures[P2];
            return U2 && U2.length > 0 ? U2.pop() : null;
          }, qi.prototype.isPatternMissing = function(P2) {
            if (!P2) return false;
            if (!P2.from || !P2.to) return true;
            var U2 = this.imageManager.getPattern(P2.from.toString()), G2 = this.imageManager.getPattern(P2.to.toString());
            return !U2 || !G2;
          }, qi.prototype.useProgram = function(P2, U2) {
            this.cache = this.cache || {};
            var G2 = "" + P2 + (U2 ? U2.cacheKey : "") + (this._showOverdrawInspector ? "/overdraw" : "");
            return this.cache[G2] || (this.cache[G2] = new Fp(this.context, xh[P2], U2, Er[P2], this._showOverdrawInspector)), this.cache[G2];
          }, qi.prototype.setCustomLayerDefaults = function() {
            this.context.unbindVAO(), this.context.cullFace.setDefault(), this.context.activeTexture.setDefault(), this.context.pixelStoreUnpack.setDefault(), this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(), this.context.pixelStoreUnpackFlipY.setDefault();
          }, qi.prototype.setBaseState = function() {
            var P2 = this.context.gl;
            this.context.cullFace.set(false), this.context.viewport.set([0, 0, this.width, this.height]), this.context.blendEquation.set(P2.FUNC_ADD);
          }, qi.prototype.initDebugOverlayCanvas = function() {
            if (this.debugOverlayCanvas == null) {
              this.debugOverlayCanvas = i.window.document.createElement("canvas"), this.debugOverlayCanvas.width = 512, this.debugOverlayCanvas.height = 512;
              var P2 = this.context.gl;
              this.debugOverlayTexture = new i.Texture(this.context, this.debugOverlayCanvas, P2.RGBA);
            }
          }, qi.prototype.destroy = function() {
            this.emptyTexture.destroy(), this.debugOverlayTexture && this.debugOverlayTexture.destroy();
          };
          var At = function(P2, U2) {
            this.points = P2, this.planes = U2;
          };
          At.fromInvProjectionMatrix = function(P2, U2, G2) {
            var J2 = Math.pow(2, G2), oe = [[-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(function(ye) {
              return i.transformMat4([], ye, P2);
            }).map(function(ye) {
              return i.scale$1([], ye, 1 / ye[3] / U2 * J2);
            }), de = [[0, 1, 2], [6, 5, 4], [0, 3, 7], [2, 1, 5], [3, 2, 6], [0, 4, 5]].map(function(ye) {
              var Te = i.sub([], oe[ye[0]], oe[ye[1]]), Fe = i.sub([], oe[ye[2]], oe[ye[1]]), et = i.normalize([], i.cross([], Te, Fe)), lt = -i.dot(et, oe[ye[1]]);
              return et.concat(lt);
            });
            return new At(oe, de);
          };
          var Ht = function(P2, U2) {
            this.min = P2, this.max = U2, this.center = i.scale$2([], i.add([], this.min, this.max), 0.5);
          };
          Ht.prototype.quadrant = function(P2) {
            for (var U2 = [P2 % 2 == 0, P2 < 2], G2 = i.clone$2(this.min), J2 = i.clone$2(this.max), oe = 0; oe < U2.length; oe++) G2[oe] = U2[oe] ? this.min[oe] : this.center[oe], J2[oe] = U2[oe] ? this.center[oe] : this.max[oe];
            return J2[2] = this.max[2], new Ht(G2, J2);
          }, Ht.prototype.distanceX = function(P2) {
            return Math.max(Math.min(this.max[0], P2[0]), this.min[0]) - P2[0];
          }, Ht.prototype.distanceY = function(P2) {
            return Math.max(Math.min(this.max[1], P2[1]), this.min[1]) - P2[1];
          }, Ht.prototype.intersects = function(P2) {
            for (var U2 = [[this.min[0], this.min[1], 0, 1], [this.max[0], this.min[1], 0, 1], [this.max[0], this.max[1], 0, 1], [this.min[0], this.max[1], 0, 1]], G2 = true, J2 = 0; J2 < P2.planes.length; J2++) {
              for (var oe = P2.planes[J2], de = 0, ye = 0; ye < U2.length; ye++) de += i.dot$1(oe, U2[ye]) >= 0;
              if (de === 0) return 0;
              de !== U2.length && (G2 = false);
            }
            if (G2) return 2;
            for (var Te = 0; Te < 3; Te++) {
              for (var Fe = Number.MAX_VALUE, et = -Number.MAX_VALUE, lt = 0; lt < P2.points.length; lt++) {
                var bt = P2.points[lt][Te] - this.min[Te];
                Fe = Math.min(Fe, bt), et = Math.max(et, bt);
              }
              if (et < 0 || Fe > this.max[Te] - this.min[Te]) return 0;
            }
            return 1;
          };
          var dr = function(P2, U2, G2, J2) {
            if (P2 === void 0 && (P2 = 0), U2 === void 0 && (U2 = 0), G2 === void 0 && (G2 = 0), J2 === void 0 && (J2 = 0), isNaN(P2) || P2 < 0 || isNaN(U2) || U2 < 0 || isNaN(G2) || G2 < 0 || isNaN(J2) || J2 < 0) throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");
            this.top = P2, this.bottom = U2, this.left = G2, this.right = J2;
          };
          dr.prototype.interpolate = function(P2, U2, G2) {
            return U2.top != null && P2.top != null && (this.top = i.number(P2.top, U2.top, G2)), U2.bottom != null && P2.bottom != null && (this.bottom = i.number(P2.bottom, U2.bottom, G2)), U2.left != null && P2.left != null && (this.left = i.number(P2.left, U2.left, G2)), U2.right != null && P2.right != null && (this.right = i.number(P2.right, U2.right, G2)), this;
          }, dr.prototype.getCenter = function(P2, U2) {
            var G2 = i.clamp((this.left + P2 - this.right) / 2, 0, P2), J2 = i.clamp((this.top + U2 - this.bottom) / 2, 0, U2);
            return new i.Point(G2, J2);
          }, dr.prototype.equals = function(P2) {
            return this.top === P2.top && this.bottom === P2.bottom && this.left === P2.left && this.right === P2.right;
          }, dr.prototype.clone = function() {
            return new dr(this.top, this.bottom, this.left, this.right);
          }, dr.prototype.toJSON = function() {
            return { top: this.top, bottom: this.bottom, left: this.left, right: this.right };
          };
          var Qt = function(P2, U2, G2, J2, oe) {
            this.tileSize = 512, this.maxValidLatitude = 85.051129, this._renderWorldCopies = oe === void 0 || oe, this._minZoom = P2 || 0, this._maxZoom = U2 || 22, this._minPitch = G2 ?? 0, this._maxPitch = J2 ?? 60, this.setMaxBounds(), this.width = 0, this.height = 0, this._center = new i.LngLat(0, 0), this.zoom = 0, this.angle = 0, this._fov = 0.6435011087932844, this._pitch = 0, this._unmodified = true, this._edgeInsets = new dr(), this._posMatrixCache = {}, this._alignedPosMatrixCache = {};
          }, vr = { minZoom: { configurable: true }, maxZoom: { configurable: true }, minPitch: { configurable: true }, maxPitch: { configurable: true }, renderWorldCopies: { configurable: true }, worldSize: { configurable: true }, centerOffset: { configurable: true }, size: { configurable: true }, bearing: { configurable: true }, pitch: { configurable: true }, fov: { configurable: true }, zoom: { configurable: true }, center: { configurable: true }, padding: { configurable: true }, centerPoint: { configurable: true }, unmodified: { configurable: true }, point: { configurable: true } };
          Qt.prototype.clone = function() {
            var P2 = new Qt(this._minZoom, this._maxZoom, this._minPitch, this.maxPitch, this._renderWorldCopies);
            return P2.tileSize = this.tileSize, P2.latRange = this.latRange, P2.width = this.width, P2.height = this.height, P2._center = this._center, P2.zoom = this.zoom, P2.angle = this.angle, P2._fov = this._fov, P2._pitch = this._pitch, P2._unmodified = this._unmodified, P2._edgeInsets = this._edgeInsets.clone(), P2._calcMatrices(), P2;
          }, vr.minZoom.get = function() {
            return this._minZoom;
          }, vr.minZoom.set = function(P2) {
            this._minZoom !== P2 && (this._minZoom = P2, this.zoom = Math.max(this.zoom, P2));
          }, vr.maxZoom.get = function() {
            return this._maxZoom;
          }, vr.maxZoom.set = function(P2) {
            this._maxZoom !== P2 && (this._maxZoom = P2, this.zoom = Math.min(this.zoom, P2));
          }, vr.minPitch.get = function() {
            return this._minPitch;
          }, vr.minPitch.set = function(P2) {
            this._minPitch !== P2 && (this._minPitch = P2, this.pitch = Math.max(this.pitch, P2));
          }, vr.maxPitch.get = function() {
            return this._maxPitch;
          }, vr.maxPitch.set = function(P2) {
            this._maxPitch !== P2 && (this._maxPitch = P2, this.pitch = Math.min(this.pitch, P2));
          }, vr.renderWorldCopies.get = function() {
            return this._renderWorldCopies;
          }, vr.renderWorldCopies.set = function(P2) {
            P2 === void 0 ? P2 = true : P2 === null && (P2 = false), this._renderWorldCopies = P2;
          }, vr.worldSize.get = function() {
            return this.tileSize * this.scale;
          }, vr.centerOffset.get = function() {
            return this.centerPoint._sub(this.size._div(2));
          }, vr.size.get = function() {
            return new i.Point(this.width, this.height);
          }, vr.bearing.get = function() {
            return -this.angle / Math.PI * 180;
          }, vr.bearing.set = function(P2) {
            var U2 = -i.wrap(P2, -180, 180) * Math.PI / 180;
            this.angle !== U2 && (this._unmodified = false, this.angle = U2, this._calcMatrices(), this.rotationMatrix = i.create$2(), i.rotate(this.rotationMatrix, this.rotationMatrix, this.angle));
          }, vr.pitch.get = function() {
            return this._pitch / Math.PI * 180;
          }, vr.pitch.set = function(P2) {
            var U2 = i.clamp(P2, this.minPitch, this.maxPitch) / 180 * Math.PI;
            this._pitch !== U2 && (this._unmodified = false, this._pitch = U2, this._calcMatrices());
          }, vr.fov.get = function() {
            return this._fov / Math.PI * 180;
          }, vr.fov.set = function(P2) {
            P2 = Math.max(0.01, Math.min(60, P2)), this._fov !== P2 && (this._unmodified = false, this._fov = P2 / 180 * Math.PI, this._calcMatrices());
          }, vr.zoom.get = function() {
            return this._zoom;
          }, vr.zoom.set = function(P2) {
            var U2 = Math.min(Math.max(P2, this.minZoom), this.maxZoom);
            this._zoom !== U2 && (this._unmodified = false, this._zoom = U2, this.scale = this.zoomScale(U2), this.tileZoom = Math.floor(U2), this.zoomFraction = U2 - this.tileZoom, this._constrain(), this._calcMatrices());
          }, vr.center.get = function() {
            return this._center;
          }, vr.center.set = function(P2) {
            P2.lat === this._center.lat && P2.lng === this._center.lng || (this._unmodified = false, this._center = P2, this._constrain(), this._calcMatrices());
          }, vr.padding.get = function() {
            return this._edgeInsets.toJSON();
          }, vr.padding.set = function(P2) {
            this._edgeInsets.equals(P2) || (this._unmodified = false, this._edgeInsets.interpolate(this._edgeInsets, P2, 1), this._calcMatrices());
          }, vr.centerPoint.get = function() {
            return this._edgeInsets.getCenter(this.width, this.height);
          }, Qt.prototype.isPaddingEqual = function(P2) {
            return this._edgeInsets.equals(P2);
          }, Qt.prototype.interpolatePadding = function(P2, U2, G2) {
            this._unmodified = false, this._edgeInsets.interpolate(P2, U2, G2), this._constrain(), this._calcMatrices();
          }, Qt.prototype.coveringZoomLevel = function(P2) {
            var U2 = (P2.roundZoom ? Math.round : Math.floor)(this.zoom + this.scaleZoom(this.tileSize / P2.tileSize));
            return Math.max(0, U2);
          }, Qt.prototype.getVisibleUnwrappedCoordinates = function(P2) {
            var U2 = [new i.UnwrappedTileID(0, P2)];
            if (this._renderWorldCopies) for (var G2 = this.pointCoordinate(new i.Point(0, 0)), J2 = this.pointCoordinate(new i.Point(this.width, 0)), oe = this.pointCoordinate(new i.Point(this.width, this.height)), de = this.pointCoordinate(new i.Point(0, this.height)), ye = Math.floor(Math.min(G2.x, J2.x, oe.x, de.x)), Te = Math.floor(Math.max(G2.x, J2.x, oe.x, de.x)), Fe = ye - 1; Fe <= Te + 1; Fe++) Fe !== 0 && U2.push(new i.UnwrappedTileID(Fe, P2));
            return U2;
          }, Qt.prototype.coveringTiles = function(P2) {
            var U2 = this.coveringZoomLevel(P2), G2 = U2;
            if (P2.minzoom !== void 0 && U2 < P2.minzoom) return [];
            P2.maxzoom !== void 0 && U2 > P2.maxzoom && (U2 = P2.maxzoom);
            var J2 = i.MercatorCoordinate.fromLngLat(this.center), oe = Math.pow(2, U2), de = [oe * J2.x, oe * J2.y, 0], ye = At.fromInvProjectionMatrix(this.invProjMatrix, this.worldSize, U2), Te = P2.minzoom || 0;
            this.pitch <= 60 && this._edgeInsets.top < 0.1 && (Te = U2);
            var Fe = function(Nn) {
              return { aabb: new Ht([Nn * oe, 0, 0], [(Nn + 1) * oe, oe, 0]), zoom: 0, x: 0, y: 0, wrap: Nn, fullyVisible: false };
            }, et = [], lt = [], bt = U2, It = P2.reparseOverscaled ? G2 : U2;
            if (this._renderWorldCopies) for (var Rt = 1; Rt <= 3; Rt++) et.push(Fe(-Rt)), et.push(Fe(Rt));
            for (et.push(Fe(0)); et.length > 0; ) {
              var Ft = et.pop(), Pt = Ft.x, Mt = Ft.y, qt = Ft.fullyVisible;
              if (!qt) {
                var $t = Ft.aabb.intersects(ye);
                if ($t === 0) continue;
                qt = $t === 2;
              }
              var Yt = Ft.aabb.distanceX(de), cr = Ft.aabb.distanceY(de), kr = Math.max(Math.abs(Yt), Math.abs(cr)), Pr = 3 + (1 << bt - Ft.zoom) - 2;
              if (Ft.zoom === bt || kr > Pr && Ft.zoom >= Te) lt.push({ tileID: new i.OverscaledTileID(Ft.zoom === bt ? It : Ft.zoom, Ft.wrap, Ft.zoom, Pt, Mt), distanceSq: i.sqrLen([de[0] - 0.5 - Pt, de[1] - 0.5 - Mt]) });
              else for (var Or = 0; Or < 4; Or++) {
                var xn = (Pt << 1) + Or % 2, yn = (Mt << 1) + (Or >> 1);
                et.push({ aabb: Ft.aabb.quadrant(Or), zoom: Ft.zoom + 1, x: xn, y: yn, wrap: Ft.wrap, fullyVisible: qt });
              }
            }
            return lt.sort(function(Nn, An) {
              return Nn.distanceSq - An.distanceSq;
            }).map(function(Nn) {
              return Nn.tileID;
            });
          }, Qt.prototype.resize = function(P2, U2) {
            this.width = P2, this.height = U2, this.pixelsToGLUnits = [2 / P2, -2 / U2], this._constrain(), this._calcMatrices();
          }, vr.unmodified.get = function() {
            return this._unmodified;
          }, Qt.prototype.zoomScale = function(P2) {
            return Math.pow(2, P2);
          }, Qt.prototype.scaleZoom = function(P2) {
            return Math.log(P2) / Math.LN2;
          }, Qt.prototype.project = function(P2) {
            var U2 = i.clamp(P2.lat, -this.maxValidLatitude, this.maxValidLatitude);
            return new i.Point(i.mercatorXfromLng(P2.lng) * this.worldSize, i.mercatorYfromLat(U2) * this.worldSize);
          }, Qt.prototype.unproject = function(P2) {
            return new i.MercatorCoordinate(P2.x / this.worldSize, P2.y / this.worldSize).toLngLat();
          }, vr.point.get = function() {
            return this.project(this.center);
          }, Qt.prototype.setLocationAtPoint = function(P2, U2) {
            var G2 = this.pointCoordinate(U2), J2 = this.pointCoordinate(this.centerPoint), oe = this.locationCoordinate(P2), de = new i.MercatorCoordinate(oe.x - (G2.x - J2.x), oe.y - (G2.y - J2.y));
            this.center = this.coordinateLocation(de), this._renderWorldCopies && (this.center = this.center.wrap());
          }, Qt.prototype.locationPoint = function(P2) {
            return this.coordinatePoint(this.locationCoordinate(P2));
          }, Qt.prototype.pointLocation = function(P2) {
            return this.coordinateLocation(this.pointCoordinate(P2));
          }, Qt.prototype.locationCoordinate = function(P2) {
            return i.MercatorCoordinate.fromLngLat(P2);
          }, Qt.prototype.coordinateLocation = function(P2) {
            return P2.toLngLat();
          }, Qt.prototype.pointCoordinate = function(P2) {
            var U2 = [P2.x, P2.y, 0, 1], G2 = [P2.x, P2.y, 1, 1];
            i.transformMat4(U2, U2, this.pixelMatrixInverse), i.transformMat4(G2, G2, this.pixelMatrixInverse);
            var J2 = U2[3], oe = G2[3], de = U2[0] / J2, ye = G2[0] / oe, Te = U2[1] / J2, Fe = G2[1] / oe, et = U2[2] / J2, lt = G2[2] / oe, bt = et === lt ? 0 : (0 - et) / (lt - et);
            return new i.MercatorCoordinate(i.number(de, ye, bt) / this.worldSize, i.number(Te, Fe, bt) / this.worldSize);
          }, Qt.prototype.coordinatePoint = function(P2) {
            var U2 = [P2.x * this.worldSize, P2.y * this.worldSize, 0, 1];
            return i.transformMat4(U2, U2, this.pixelMatrix), new i.Point(U2[0] / U2[3], U2[1] / U2[3]);
          }, Qt.prototype.getBounds = function() {
            return new i.LngLatBounds().extend(this.pointLocation(new i.Point(0, 0))).extend(this.pointLocation(new i.Point(this.width, 0))).extend(this.pointLocation(new i.Point(this.width, this.height))).extend(this.pointLocation(new i.Point(0, this.height)));
          }, Qt.prototype.getMaxBounds = function() {
            return this.latRange && this.latRange.length === 2 && this.lngRange && this.lngRange.length === 2 ? new i.LngLatBounds([this.lngRange[0], this.latRange[0]], [this.lngRange[1], this.latRange[1]]) : null;
          }, Qt.prototype.setMaxBounds = function(P2) {
            P2 ? (this.lngRange = [P2.getWest(), P2.getEast()], this.latRange = [P2.getSouth(), P2.getNorth()], this._constrain()) : (this.lngRange = null, this.latRange = [-this.maxValidLatitude, this.maxValidLatitude]);
          }, Qt.prototype.calculatePosMatrix = function(P2, U2) {
            U2 === void 0 && (U2 = false);
            var G2 = P2.key, J2 = U2 ? this._alignedPosMatrixCache : this._posMatrixCache;
            if (J2[G2]) return J2[G2];
            var oe = P2.canonical, de = this.worldSize / this.zoomScale(oe.z), ye = oe.x + Math.pow(2, oe.z) * P2.wrap, Te = i.identity(new Float64Array(16));
            return i.translate(Te, Te, [ye * de, oe.y * de, 0]), i.scale(Te, Te, [de / i.EXTENT, de / i.EXTENT, 1]), i.multiply(Te, U2 ? this.alignedProjMatrix : this.projMatrix, Te), J2[G2] = new Float32Array(Te), J2[G2];
          }, Qt.prototype.customLayerMatrix = function() {
            return this.mercatorMatrix.slice();
          }, Qt.prototype._constrain = function() {
            if (this.center && this.width && this.height && !this._constraining) {
              this._constraining = true;
              var P2, U2, G2, J2, oe = -90, de = 90, ye = -180, Te = 180, Fe = this.size, et = this._unmodified;
              if (this.latRange) {
                var lt = this.latRange;
                oe = i.mercatorYfromLat(lt[1]) * this.worldSize, P2 = (de = i.mercatorYfromLat(lt[0]) * this.worldSize) - oe < Fe.y ? Fe.y / (de - oe) : 0;
              }
              if (this.lngRange) {
                var bt = this.lngRange;
                ye = i.mercatorXfromLng(bt[0]) * this.worldSize, U2 = (Te = i.mercatorXfromLng(bt[1]) * this.worldSize) - ye < Fe.x ? Fe.x / (Te - ye) : 0;
              }
              var It = this.point, Rt = Math.max(U2 || 0, P2 || 0);
              if (Rt) return this.center = this.unproject(new i.Point(U2 ? (Te + ye) / 2 : It.x, P2 ? (de + oe) / 2 : It.y)), this.zoom += this.scaleZoom(Rt), this._unmodified = et, void (this._constraining = false);
              if (this.latRange) {
                var Ft = It.y, Pt = Fe.y / 2;
                Ft - Pt < oe && (J2 = oe + Pt), Ft + Pt > de && (J2 = de - Pt);
              }
              if (this.lngRange) {
                var Mt = It.x, qt = Fe.x / 2;
                Mt - qt < ye && (G2 = ye + qt), Mt + qt > Te && (G2 = Te - qt);
              }
              G2 === void 0 && J2 === void 0 || (this.center = this.unproject(new i.Point(G2 !== void 0 ? G2 : It.x, J2 !== void 0 ? J2 : It.y))), this._unmodified = et, this._constraining = false;
            }
          }, Qt.prototype._calcMatrices = function() {
            if (this.height) {
              var P2 = this._fov / 2, U2 = this.centerOffset;
              this.cameraToCenterDistance = 0.5 / Math.tan(P2) * this.height;
              var G2 = Math.PI / 2 + this._pitch, J2 = this._fov * (0.5 + U2.y / this.height), oe = Math.sin(J2) * this.cameraToCenterDistance / Math.sin(i.clamp(Math.PI - G2 - J2, 0.01, Math.PI - 0.01)), de = this.point, ye = de.x, Te = de.y, Fe = 1.01 * (Math.cos(Math.PI / 2 - this._pitch) * oe + this.cameraToCenterDistance), et = this.height / 50, lt = new Float64Array(16);
              i.perspective(lt, this._fov, this.width / this.height, et, Fe), lt[8] = 2 * -U2.x / this.width, lt[9] = 2 * U2.y / this.height, i.scale(lt, lt, [1, -1, 1]), i.translate(lt, lt, [0, 0, -this.cameraToCenterDistance]), i.rotateX(lt, lt, this._pitch), i.rotateZ(lt, lt, this.angle), i.translate(lt, lt, [-ye, -Te, 0]), this.mercatorMatrix = i.scale([], lt, [this.worldSize, this.worldSize, this.worldSize]), i.scale(lt, lt, [1, 1, i.mercatorZfromAltitude(1, this.center.lat) * this.worldSize, 1]), this.projMatrix = lt, this.invProjMatrix = i.invert([], this.projMatrix);
              var bt = this.width % 2 / 2, It = this.height % 2 / 2, Rt = Math.cos(this.angle), Ft = Math.sin(this.angle), Pt = ye - Math.round(ye) + Rt * bt + Ft * It, Mt = Te - Math.round(Te) + Rt * It + Ft * bt, qt = new Float64Array(lt);
              if (i.translate(qt, qt, [Pt > 0.5 ? Pt - 1 : Pt, Mt > 0.5 ? Mt - 1 : Mt, 0]), this.alignedProjMatrix = qt, lt = i.create(), i.scale(lt, lt, [this.width / 2, -this.height / 2, 1]), i.translate(lt, lt, [1, -1, 0]), this.labelPlaneMatrix = lt, lt = i.create(), i.scale(lt, lt, [1, -1, 1]), i.translate(lt, lt, [-1, -1, 0]), i.scale(lt, lt, [2 / this.width, 2 / this.height, 1]), this.glCoordMatrix = lt, this.pixelMatrix = i.multiply(new Float64Array(16), this.labelPlaneMatrix, this.projMatrix), !(lt = i.invert(new Float64Array(16), this.pixelMatrix))) throw new Error("failed to invert matrix");
              this.pixelMatrixInverse = lt, this._posMatrixCache = {}, this._alignedPosMatrixCache = {};
            }
          }, Qt.prototype.maxPitchScaleFactor = function() {
            if (!this.pixelMatrixInverse) return 1;
            var P2 = this.pointCoordinate(new i.Point(0, 0)), U2 = [P2.x * this.worldSize, P2.y * this.worldSize, 0, 1];
            return i.transformMat4(U2, U2, this.pixelMatrix)[3] / this.cameraToCenterDistance;
          }, Qt.prototype.getCameraPoint = function() {
            var P2 = this._pitch, U2 = Math.tan(P2) * (this.cameraToCenterDistance || 1);
            return this.centerPoint.add(new i.Point(0, U2));
          }, Qt.prototype.getCameraQueryGeometry = function(P2) {
            var U2 = this.getCameraPoint();
            if (P2.length === 1) return [P2[0], U2];
            for (var G2 = U2.x, J2 = U2.y, oe = U2.x, de = U2.y, ye = 0, Te = P2; ye < Te.length; ye += 1) {
              var Fe = Te[ye];
              G2 = Math.min(G2, Fe.x), J2 = Math.min(J2, Fe.y), oe = Math.max(oe, Fe.x), de = Math.max(de, Fe.y);
            }
            return [new i.Point(G2, J2), new i.Point(oe, J2), new i.Point(oe, de), new i.Point(G2, de), new i.Point(G2, J2)];
          }, Object.defineProperties(Qt.prototype, vr);
          var Vr = function(P2) {
            var U2, G2, J2, oe, de;
            this._hashName = P2 && encodeURIComponent(P2), i.bindAll(["_getCurrentHash", "_onHashChange", "_updateHash"], this), this._updateHash = (U2 = this._updateHashUnthrottled.bind(this), G2 = 300, J2 = false, oe = null, de = function() {
              oe = null, J2 && (U2(), oe = setTimeout(de, G2), J2 = false);
            }, function() {
              return J2 = true, oe || de(), oe;
            });
          };
          Vr.prototype.addTo = function(P2) {
            return this._map = P2, i.window.addEventListener("hashchange", this._onHashChange, false), this._map.on("moveend", this._updateHash), this;
          }, Vr.prototype.remove = function() {
            return i.window.removeEventListener("hashchange", this._onHashChange, false), this._map.off("moveend", this._updateHash), clearTimeout(this._updateHash()), delete this._map, this;
          }, Vr.prototype.getHashString = function(P2) {
            var U2 = this._map.getCenter(), G2 = Math.round(100 * this._map.getZoom()) / 100, J2 = Math.ceil((G2 * Math.LN2 + Math.log(512 / 360 / 0.5)) / Math.LN10), oe = Math.pow(10, J2), de = Math.round(U2.lng * oe) / oe, ye = Math.round(U2.lat * oe) / oe, Te = this._map.getBearing(), Fe = this._map.getPitch(), et = "";
            if (et += P2 ? "/" + de + "/" + ye + "/" + G2 : G2 + "/" + ye + "/" + de, (Te || Fe) && (et += "/" + Math.round(10 * Te) / 10), Fe && (et += "/" + Math.round(Fe)), this._hashName) {
              var lt = this._hashName, bt = false, It = i.window.location.hash.slice(1).split("&").map(function(Rt) {
                var Ft = Rt.split("=")[0];
                return Ft === lt ? (bt = true, Ft + "=" + et) : Rt;
              }).filter(function(Rt) {
                return Rt;
              });
              return bt || It.push(lt + "=" + et), "#" + It.join("&");
            }
            return "#" + et;
          }, Vr.prototype._getCurrentHash = function() {
            var P2, U2 = this, G2 = i.window.location.hash.replace("#", "");
            return this._hashName ? (G2.split("&").map(function(J2) {
              return J2.split("=");
            }).forEach(function(J2) {
              J2[0] === U2._hashName && (P2 = J2);
            }), (P2 && P2[1] || "").split("/")) : G2.split("/");
          }, Vr.prototype._onHashChange = function() {
            var P2 = this._getCurrentHash();
            if (P2.length >= 3 && !P2.some(function(G2) {
              return isNaN(G2);
            })) {
              var U2 = this._map.dragRotate.isEnabled() && this._map.touchZoomRotate.isEnabled() ? +(P2[3] || 0) : this._map.getBearing();
              return this._map.jumpTo({ center: [+P2[2], +P2[1]], zoom: +P2[0], bearing: U2, pitch: +(P2[4] || 0) }), true;
            }
            return false;
          }, Vr.prototype._updateHashUnthrottled = function() {
            var P2 = this.getHashString();
            try {
              i.window.history.replaceState(i.window.history.state, "", P2);
            } catch {
            }
          };
          var Jr = { linearity: 0.3, easing: i.bezier(0, 0, 0.3, 1) }, dn = i.extend({ deceleration: 2500, maxSpeed: 1400 }, Jr), En = i.extend({ deceleration: 20, maxSpeed: 1400 }, Jr), Tn = i.extend({ deceleration: 1e3, maxSpeed: 360 }, Jr), Pn = i.extend({ deceleration: 1e3, maxSpeed: 90 }, Jr), Gn = function(P2) {
            this._map = P2, this.clear();
          };
          function Dn(P2, U2) {
            (!P2.duration || P2.duration < U2.duration) && (P2.duration = U2.duration, P2.easing = U2.easing);
          }
          function $n(P2, U2, G2) {
            var J2 = G2.maxSpeed, oe = G2.linearity, de = G2.deceleration, ye = i.clamp(P2 * oe / (U2 / 1e3), -J2, J2), Te = Math.abs(ye) / (de * oe);
            return { easing: G2.easing, duration: 1e3 * Te, amount: ye * (Te / 2) };
          }
          Gn.prototype.clear = function() {
            this._inertiaBuffer = [];
          }, Gn.prototype.record = function(P2) {
            this._drainInertiaBuffer(), this._inertiaBuffer.push({ time: i.browser.now(), settings: P2 });
          }, Gn.prototype._drainInertiaBuffer = function() {
            for (var P2 = this._inertiaBuffer, U2 = i.browser.now(); P2.length > 0 && U2 - P2[0].time > 160; ) P2.shift();
          }, Gn.prototype._onMoveEnd = function(P2) {
            if (this._drainInertiaBuffer(), !(this._inertiaBuffer.length < 2)) {
              for (var U2 = { zoom: 0, bearing: 0, pitch: 0, pan: new i.Point(0, 0), pinchAround: void 0, around: void 0 }, G2 = 0, J2 = this._inertiaBuffer; G2 < J2.length; G2 += 1) {
                var oe = J2[G2].settings;
                U2.zoom += oe.zoomDelta || 0, U2.bearing += oe.bearingDelta || 0, U2.pitch += oe.pitchDelta || 0, oe.panDelta && U2.pan._add(oe.panDelta), oe.around && (U2.around = oe.around), oe.pinchAround && (U2.pinchAround = oe.pinchAround);
              }
              var de = this._inertiaBuffer[this._inertiaBuffer.length - 1].time - this._inertiaBuffer[0].time, ye = {};
              if (U2.pan.mag()) {
                var Te = $n(U2.pan.mag(), de, i.extend({}, dn, P2 || {}));
                ye.offset = U2.pan.mult(Te.amount / U2.pan.mag()), ye.center = this._map.transform.center, Dn(ye, Te);
              }
              if (U2.zoom) {
                var Fe = $n(U2.zoom, de, En);
                ye.zoom = this._map.transform.zoom + Fe.amount, Dn(ye, Fe);
              }
              if (U2.bearing) {
                var et = $n(U2.bearing, de, Tn);
                ye.bearing = this._map.transform.bearing + i.clamp(et.amount, -179, 179), Dn(ye, et);
              }
              if (U2.pitch) {
                var lt = $n(U2.pitch, de, Pn);
                ye.pitch = this._map.transform.pitch + lt.amount, Dn(ye, lt);
              }
              if (ye.zoom || ye.bearing) {
                var bt = U2.pinchAround === void 0 ? U2.around : U2.pinchAround;
                ye.around = bt ? this._map.unproject(bt) : this._map.getCenter();
              }
              return this.clear(), i.extend(ye, { noMoveStart: true });
            }
          };
          var ca = function(P2) {
            function U2(J2, oe, de, ye) {
              ye === void 0 && (ye = {});
              var Te = u2.mousePos(oe.getCanvasContainer(), de), Fe = oe.unproject(Te);
              P2.call(this, J2, i.extend({ point: Te, lngLat: Fe, originalEvent: de }, ye)), this._defaultPrevented = false, this.target = oe;
            }
            P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2;
            var G2 = { defaultPrevented: { configurable: true } };
            return U2.prototype.preventDefault = function() {
              this._defaultPrevented = true;
            }, G2.defaultPrevented.get = function() {
              return this._defaultPrevented;
            }, Object.defineProperties(U2.prototype, G2), U2;
          }(i.Event), ya = function(P2) {
            function U2(J2, oe, de) {
              var ye = J2 === "touchend" ? de.changedTouches : de.touches, Te = u2.touchPos(oe.getCanvasContainer(), ye), Fe = Te.map(function(bt) {
                return oe.unproject(bt);
              }), et = Te.reduce(function(bt, It, Rt, Ft) {
                return bt.add(It.div(Ft.length));
              }, new i.Point(0, 0)), lt = oe.unproject(et);
              P2.call(this, J2, { points: Te, point: et, lngLats: Fe, lngLat: lt, originalEvent: de }), this._defaultPrevented = false;
            }
            P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2;
            var G2 = { defaultPrevented: { configurable: true } };
            return U2.prototype.preventDefault = function() {
              this._defaultPrevented = true;
            }, G2.defaultPrevented.get = function() {
              return this._defaultPrevented;
            }, Object.defineProperties(U2.prototype, G2), U2;
          }(i.Event), Ra = function(P2) {
            function U2(J2, oe, de) {
              P2.call(this, J2, { originalEvent: de }), this._defaultPrevented = false;
            }
            P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2;
            var G2 = { defaultPrevented: { configurable: true } };
            return U2.prototype.preventDefault = function() {
              this._defaultPrevented = true;
            }, G2.defaultPrevented.get = function() {
              return this._defaultPrevented;
            }, Object.defineProperties(U2.prototype, G2), U2;
          }(i.Event), mn = function(P2, U2) {
            this._map = P2, this._clickTolerance = U2.clickTolerance;
          };
          mn.prototype.reset = function() {
            delete this._mousedownPos;
          }, mn.prototype.wheel = function(P2) {
            return this._firePreventable(new Ra(P2.type, this._map, P2));
          }, mn.prototype.mousedown = function(P2, U2) {
            return this._mousedownPos = U2, this._firePreventable(new ca(P2.type, this._map, P2));
          }, mn.prototype.mouseup = function(P2) {
            this._map.fire(new ca(P2.type, this._map, P2));
          }, mn.prototype.click = function(P2, U2) {
            this._mousedownPos && this._mousedownPos.dist(U2) >= this._clickTolerance || this._map.fire(new ca(P2.type, this._map, P2));
          }, mn.prototype.dblclick = function(P2) {
            return this._firePreventable(new ca(P2.type, this._map, P2));
          }, mn.prototype.mouseover = function(P2) {
            this._map.fire(new ca(P2.type, this._map, P2));
          }, mn.prototype.mouseout = function(P2) {
            this._map.fire(new ca(P2.type, this._map, P2));
          }, mn.prototype.touchstart = function(P2) {
            return this._firePreventable(new ya(P2.type, this._map, P2));
          }, mn.prototype.touchmove = function(P2) {
            this._map.fire(new ya(P2.type, this._map, P2));
          }, mn.prototype.touchend = function(P2) {
            this._map.fire(new ya(P2.type, this._map, P2));
          }, mn.prototype.touchcancel = function(P2) {
            this._map.fire(new ya(P2.type, this._map, P2));
          }, mn.prototype._firePreventable = function(P2) {
            if (this._map.fire(P2), P2.defaultPrevented) return {};
          }, mn.prototype.isEnabled = function() {
            return true;
          }, mn.prototype.isActive = function() {
            return false;
          }, mn.prototype.enable = function() {
          }, mn.prototype.disable = function() {
          };
          var Fa = function(P2) {
            this._map = P2;
          };
          Fa.prototype.reset = function() {
            this._delayContextMenu = false, delete this._contextMenuEvent;
          }, Fa.prototype.mousemove = function(P2) {
            this._map.fire(new ca(P2.type, this._map, P2));
          }, Fa.prototype.mousedown = function() {
            this._delayContextMenu = true;
          }, Fa.prototype.mouseup = function() {
            this._delayContextMenu = false, this._contextMenuEvent && (this._map.fire(new ca("contextmenu", this._map, this._contextMenuEvent)), delete this._contextMenuEvent);
          }, Fa.prototype.contextmenu = function(P2) {
            this._delayContextMenu ? this._contextMenuEvent = P2 : this._map.fire(new ca(P2.type, this._map, P2)), this._map.listens("contextmenu") && P2.preventDefault();
          }, Fa.prototype.isEnabled = function() {
            return true;
          }, Fa.prototype.isActive = function() {
            return false;
          }, Fa.prototype.enable = function() {
          }, Fa.prototype.disable = function() {
          };
          var ra = function(P2, U2) {
            this._map = P2, this._el = P2.getCanvasContainer(), this._container = P2.getContainer(), this._clickTolerance = U2.clickTolerance || 1;
          };
          function va(P2, U2) {
            for (var G2 = {}, J2 = 0; J2 < P2.length; J2++) G2[P2[J2].identifier] = U2[J2];
            return G2;
          }
          ra.prototype.isEnabled = function() {
            return !!this._enabled;
          }, ra.prototype.isActive = function() {
            return !!this._active;
          }, ra.prototype.enable = function() {
            this.isEnabled() || (this._enabled = true);
          }, ra.prototype.disable = function() {
            this.isEnabled() && (this._enabled = false);
          }, ra.prototype.mousedown = function(P2, U2) {
            this.isEnabled() && P2.shiftKey && P2.button === 0 && (u2.disableDrag(), this._startPos = this._lastPos = U2, this._active = true);
          }, ra.prototype.mousemoveWindow = function(P2, U2) {
            if (this._active) {
              var G2 = U2;
              if (!(this._lastPos.equals(G2) || !this._box && G2.dist(this._startPos) < this._clickTolerance)) {
                var J2 = this._startPos;
                this._lastPos = G2, this._box || (this._box = u2.create("div", "mapboxgl-boxzoom", this._container), this._container.classList.add("mapboxgl-crosshair"), this._fireEvent("boxzoomstart", P2));
                var oe = Math.min(J2.x, G2.x), de = Math.max(J2.x, G2.x), ye = Math.min(J2.y, G2.y), Te = Math.max(J2.y, G2.y);
                u2.setTransform(this._box, "translate(" + oe + "px," + ye + "px)"), this._box.style.width = de - oe + "px", this._box.style.height = Te - ye + "px";
              }
            }
          }, ra.prototype.mouseupWindow = function(P2, U2) {
            var G2 = this;
            if (this._active && P2.button === 0) {
              var J2 = this._startPos, oe = U2;
              if (this.reset(), u2.suppressClick(), J2.x !== oe.x || J2.y !== oe.y) return this._map.fire(new i.Event("boxzoomend", { originalEvent: P2 })), { cameraAnimation: function(de) {
                return de.fitScreenCoordinates(J2, oe, G2._map.getBearing(), { linear: true });
              } };
              this._fireEvent("boxzoomcancel", P2);
            }
          }, ra.prototype.keydown = function(P2) {
            this._active && P2.keyCode === 27 && (this.reset(), this._fireEvent("boxzoomcancel", P2));
          }, ra.prototype.reset = function() {
            this._active = false, this._container.classList.remove("mapboxgl-crosshair"), this._box && (u2.remove(this._box), this._box = null), u2.enableDrag(), delete this._startPos, delete this._lastPos;
          }, ra.prototype._fireEvent = function(P2, U2) {
            return this._map.fire(new i.Event(P2, { originalEvent: U2 }));
          };
          var Ia = function(P2) {
            this.reset(), this.numTouches = P2.numTouches;
          };
          Ia.prototype.reset = function() {
            delete this.centroid, delete this.startTime, delete this.touches, this.aborted = false;
          }, Ia.prototype.touchstart = function(P2, U2, G2) {
            (this.centroid || G2.length > this.numTouches) && (this.aborted = true), this.aborted || (this.startTime === void 0 && (this.startTime = P2.timeStamp), G2.length === this.numTouches && (this.centroid = function(J2) {
              for (var oe = new i.Point(0, 0), de = 0, ye = J2; de < ye.length; de += 1) {
                var Te = ye[de];
                oe._add(Te);
              }
              return oe.div(J2.length);
            }(U2), this.touches = va(G2, U2)));
          }, Ia.prototype.touchmove = function(P2, U2, G2) {
            if (!this.aborted && this.centroid) {
              var J2 = va(G2, U2);
              for (var oe in this.touches) {
                var de = this.touches[oe], ye = J2[oe];
                (!ye || ye.dist(de) > 30) && (this.aborted = true);
              }
            }
          }, Ia.prototype.touchend = function(P2, U2, G2) {
            if ((!this.centroid || P2.timeStamp - this.startTime > 500) && (this.aborted = true), G2.length === 0) {
              var J2 = !this.aborted && this.centroid;
              if (this.reset(), J2) return J2;
            }
          };
          var Si = function(P2) {
            this.singleTap = new Ia(P2), this.numTaps = P2.numTaps, this.reset();
          };
          Si.prototype.reset = function() {
            this.lastTime = 1 / 0, delete this.lastTap, this.count = 0, this.singleTap.reset();
          }, Si.prototype.touchstart = function(P2, U2, G2) {
            this.singleTap.touchstart(P2, U2, G2);
          }, Si.prototype.touchmove = function(P2, U2, G2) {
            this.singleTap.touchmove(P2, U2, G2);
          }, Si.prototype.touchend = function(P2, U2, G2) {
            var J2 = this.singleTap.touchend(P2, U2, G2);
            if (J2) {
              var oe = P2.timeStamp - this.lastTime < 500, de = !this.lastTap || this.lastTap.dist(J2) < 30;
              if (oe && de || this.reset(), this.count++, this.lastTime = P2.timeStamp, this.lastTap = J2, this.count === this.numTaps) return this.reset(), J2;
            }
          };
          var Vi = function() {
            this._zoomIn = new Si({ numTouches: 1, numTaps: 2 }), this._zoomOut = new Si({ numTouches: 2, numTaps: 1 }), this.reset();
          };
          Vi.prototype.reset = function() {
            this._active = false, this._zoomIn.reset(), this._zoomOut.reset();
          }, Vi.prototype.touchstart = function(P2, U2, G2) {
            this._zoomIn.touchstart(P2, U2, G2), this._zoomOut.touchstart(P2, U2, G2);
          }, Vi.prototype.touchmove = function(P2, U2, G2) {
            this._zoomIn.touchmove(P2, U2, G2), this._zoomOut.touchmove(P2, U2, G2);
          }, Vi.prototype.touchend = function(P2, U2, G2) {
            var J2 = this, oe = this._zoomIn.touchend(P2, U2, G2), de = this._zoomOut.touchend(P2, U2, G2);
            return oe ? (this._active = true, P2.preventDefault(), setTimeout(function() {
              return J2.reset();
            }, 0), { cameraAnimation: function(ye) {
              return ye.easeTo({ duration: 300, zoom: ye.getZoom() + 1, around: ye.unproject(oe) }, { originalEvent: P2 });
            } }) : de ? (this._active = true, P2.preventDefault(), setTimeout(function() {
              return J2.reset();
            }, 0), { cameraAnimation: function(ye) {
              return ye.easeTo({ duration: 300, zoom: ye.getZoom() - 1, around: ye.unproject(de) }, { originalEvent: P2 });
            } }) : void 0;
          }, Vi.prototype.touchcancel = function() {
            this.reset();
          }, Vi.prototype.enable = function() {
            this._enabled = true;
          }, Vi.prototype.disable = function() {
            this._enabled = false, this.reset();
          }, Vi.prototype.isEnabled = function() {
            return this._enabled;
          }, Vi.prototype.isActive = function() {
            return this._active;
          };
          var Jn = function(P2) {
            this.reset(), this._clickTolerance = P2.clickTolerance || 1;
          };
          Jn.prototype.reset = function() {
            this._active = false, this._moved = false, delete this._lastPoint, delete this._eventButton;
          }, Jn.prototype._correctButton = function(P2, U2) {
            return false;
          }, Jn.prototype._move = function(P2, U2) {
            return {};
          }, Jn.prototype.mousedown = function(P2, U2) {
            if (!this._lastPoint) {
              var G2 = u2.mouseButton(P2);
              this._correctButton(P2, G2) && (this._lastPoint = U2, this._eventButton = G2);
            }
          }, Jn.prototype.mousemoveWindow = function(P2, U2) {
            var G2 = this._lastPoint;
            if (G2 && (P2.preventDefault(), this._moved || !(U2.dist(G2) < this._clickTolerance))) return this._moved = true, this._lastPoint = U2, this._move(G2, U2);
          }, Jn.prototype.mouseupWindow = function(P2) {
            u2.mouseButton(P2) === this._eventButton && (this._moved && u2.suppressClick(), this.reset());
          }, Jn.prototype.enable = function() {
            this._enabled = true;
          }, Jn.prototype.disable = function() {
            this._enabled = false, this.reset();
          }, Jn.prototype.isEnabled = function() {
            return this._enabled;
          }, Jn.prototype.isActive = function() {
            return this._active;
          };
          var Xi = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.mousedown = function(G2, J2) {
              P2.prototype.mousedown.call(this, G2, J2), this._lastPoint && (this._active = true);
            }, U2.prototype._correctButton = function(G2, J2) {
              return J2 === 0 && !G2.ctrlKey;
            }, U2.prototype._move = function(G2, J2) {
              return { around: J2, panDelta: J2.sub(G2) };
            }, U2;
          }(Jn), Bi = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype._correctButton = function(G2, J2) {
              return J2 === 0 && G2.ctrlKey || J2 === 2;
            }, U2.prototype._move = function(G2, J2) {
              var oe = 0.8 * (J2.x - G2.x);
              if (oe) return this._active = true, { bearingDelta: oe };
            }, U2.prototype.contextmenu = function(G2) {
              G2.preventDefault();
            }, U2;
          }(Jn), li = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype._correctButton = function(G2, J2) {
              return J2 === 0 && G2.ctrlKey || J2 === 2;
            }, U2.prototype._move = function(G2, J2) {
              var oe = -0.5 * (J2.y - G2.y);
              if (oe) return this._active = true, { pitchDelta: oe };
            }, U2.prototype.contextmenu = function(G2) {
              G2.preventDefault();
            }, U2;
          }(Jn), Ki = function(P2) {
            this._minTouches = 1, this._clickTolerance = P2.clickTolerance || 1, this.reset();
          };
          Ki.prototype.reset = function() {
            this._active = false, this._touches = {}, this._sum = new i.Point(0, 0);
          }, Ki.prototype.touchstart = function(P2, U2, G2) {
            return this._calculateTransform(P2, U2, G2);
          }, Ki.prototype.touchmove = function(P2, U2, G2) {
            if (this._active) return P2.preventDefault(), this._calculateTransform(P2, U2, G2);
          }, Ki.prototype.touchend = function(P2, U2, G2) {
            this._calculateTransform(P2, U2, G2), this._active && G2.length < this._minTouches && this.reset();
          }, Ki.prototype.touchcancel = function() {
            this.reset();
          }, Ki.prototype._calculateTransform = function(P2, U2, G2) {
            G2.length > 0 && (this._active = true);
            var J2 = va(G2, U2), oe = new i.Point(0, 0), de = new i.Point(0, 0), ye = 0;
            for (var Te in J2) {
              var Fe = J2[Te], et = this._touches[Te];
              et && (oe._add(Fe), de._add(Fe.sub(et)), ye++, J2[Te] = Fe);
            }
            if (this._touches = J2, !(ye < this._minTouches) && de.mag()) {
              var lt = de.div(ye);
              if (this._sum._add(lt), !(this._sum.mag() < this._clickTolerance)) return { around: oe.div(ye), panDelta: lt };
            }
          }, Ki.prototype.enable = function() {
            this._enabled = true;
          }, Ki.prototype.disable = function() {
            this._enabled = false, this.reset();
          }, Ki.prototype.isEnabled = function() {
            return this._enabled;
          }, Ki.prototype.isActive = function() {
            return this._active;
          };
          var Fi = function() {
            this.reset();
          };
          function Do(P2, U2, G2) {
            for (var J2 = 0; J2 < P2.length; J2++) if (P2[J2].identifier === G2) return U2[J2];
          }
          Fi.prototype.reset = function() {
            this._active = false, delete this._firstTwoTouches;
          }, Fi.prototype._start = function(P2) {
          }, Fi.prototype._move = function(P2, U2, G2) {
            return {};
          }, Fi.prototype.touchstart = function(P2, U2, G2) {
            this._firstTwoTouches || G2.length < 2 || (this._firstTwoTouches = [G2[0].identifier, G2[1].identifier], this._start([U2[0], U2[1]]));
          }, Fi.prototype.touchmove = function(P2, U2, G2) {
            if (this._firstTwoTouches) {
              P2.preventDefault();
              var J2 = this._firstTwoTouches, oe = J2[0], de = J2[1], ye = Do(G2, U2, oe), Te = Do(G2, U2, de);
              if (ye && Te) {
                var Fe = this._aroundCenter ? null : ye.add(Te).div(2);
                return this._move([ye, Te], Fe, P2);
              }
            }
          }, Fi.prototype.touchend = function(P2, U2, G2) {
            if (this._firstTwoTouches) {
              var J2 = this._firstTwoTouches, oe = J2[0], de = J2[1], ye = Do(G2, U2, oe), Te = Do(G2, U2, de);
              ye && Te || (this._active && u2.suppressClick(), this.reset());
            }
          }, Fi.prototype.touchcancel = function() {
            this.reset();
          }, Fi.prototype.enable = function(P2) {
            this._enabled = true, this._aroundCenter = !!P2 && P2.around === "center";
          }, Fi.prototype.disable = function() {
            this._enabled = false, this.reset();
          }, Fi.prototype.isEnabled = function() {
            return this._enabled;
          }, Fi.prototype.isActive = function() {
            return this._active;
          };
          function Oa(P2, U2) {
            return Math.log(P2 / U2) / Math.LN2;
          }
          var mo = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.reset = function() {
              P2.prototype.reset.call(this), delete this._distance, delete this._startDistance;
            }, U2.prototype._start = function(G2) {
              this._startDistance = this._distance = G2[0].dist(G2[1]);
            }, U2.prototype._move = function(G2, J2) {
              var oe = this._distance;
              if (this._distance = G2[0].dist(G2[1]), this._active || !(Math.abs(Oa(this._distance, this._startDistance)) < 0.1)) return this._active = true, { zoomDelta: Oa(this._distance, oe), pinchAround: J2 };
            }, U2;
          }(Fi);
          function il(P2, U2) {
            return 180 * P2.angleWith(U2) / Math.PI;
          }
          var Jc = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.reset = function() {
              P2.prototype.reset.call(this), delete this._minDiameter, delete this._startVector, delete this._vector;
            }, U2.prototype._start = function(G2) {
              this._startVector = this._vector = G2[0].sub(G2[1]), this._minDiameter = G2[0].dist(G2[1]);
            }, U2.prototype._move = function(G2, J2) {
              var oe = this._vector;
              if (this._vector = G2[0].sub(G2[1]), this._active || !this._isBelowThreshold(this._vector)) return this._active = true, { bearingDelta: il(this._vector, oe), pinchAround: J2 };
            }, U2.prototype._isBelowThreshold = function(G2) {
              this._minDiameter = Math.min(this._minDiameter, G2.mag());
              var J2 = 25 / (Math.PI * this._minDiameter) * 360, oe = il(G2, this._startVector);
              return Math.abs(oe) < J2;
            }, U2;
          }(Fi);
          function bc(P2) {
            return Math.abs(P2.y) > Math.abs(P2.x);
          }
          var _u = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.reset = function() {
              P2.prototype.reset.call(this), this._valid = void 0, delete this._firstMove, delete this._lastPoints;
            }, U2.prototype._start = function(G2) {
              this._lastPoints = G2, bc(G2[0].sub(G2[1])) && (this._valid = false);
            }, U2.prototype._move = function(G2, J2, oe) {
              var de = G2[0].sub(this._lastPoints[0]), ye = G2[1].sub(this._lastPoints[1]);
              if (this._valid = this.gestureBeginsVertically(de, ye, oe.timeStamp), this._valid) return this._lastPoints = G2, this._active = true, { pitchDelta: -0.5 * ((de.y + ye.y) / 2) };
            }, U2.prototype.gestureBeginsVertically = function(G2, J2, oe) {
              if (this._valid !== void 0) return this._valid;
              var de = G2.mag() >= 2, ye = J2.mag() >= 2;
              if (de || ye) {
                if (!de || !ye) return this._firstMove === void 0 && (this._firstMove = oe), oe - this._firstMove < 100 && void 0;
                var Te = G2.y > 0 == J2.y > 0;
                return bc(G2) && bc(J2) && Te;
              }
            }, U2;
          }(Fi), gi = { panStep: 100, bearingStep: 15, pitchStep: 10 }, ls = function() {
            var P2 = gi;
            this._panStep = P2.panStep, this._bearingStep = P2.bearingStep, this._pitchStep = P2.pitchStep;
          };
          function wu(P2) {
            return P2 * (2 - P2);
          }
          ls.prototype.reset = function() {
            this._active = false;
          }, ls.prototype.keydown = function(P2) {
            var U2 = this;
            if (!(P2.altKey || P2.ctrlKey || P2.metaKey)) {
              var G2 = 0, J2 = 0, oe = 0, de = 0, ye = 0;
              switch (P2.keyCode) {
                case 61:
                case 107:
                case 171:
                case 187:
                  G2 = 1;
                  break;
                case 189:
                case 109:
                case 173:
                  G2 = -1;
                  break;
                case 37:
                  P2.shiftKey ? J2 = -1 : (P2.preventDefault(), de = -1);
                  break;
                case 39:
                  P2.shiftKey ? J2 = 1 : (P2.preventDefault(), de = 1);
                  break;
                case 38:
                  P2.shiftKey ? oe = 1 : (P2.preventDefault(), ye = -1);
                  break;
                case 40:
                  P2.shiftKey ? oe = -1 : (P2.preventDefault(), ye = 1);
                  break;
                default:
                  return;
              }
              return { cameraAnimation: function(Te) {
                var Fe = Te.getZoom();
                Te.easeTo({ duration: 300, easeId: "keyboardHandler", easing: wu, zoom: G2 ? Math.round(Fe) + G2 * (P2.shiftKey ? 2 : 1) : Fe, bearing: Te.getBearing() + J2 * U2._bearingStep, pitch: Te.getPitch() + oe * U2._pitchStep, offset: [-de * U2._panStep, -ye * U2._panStep], center: Te.getCenter() }, { originalEvent: P2 });
              } };
            }
          }, ls.prototype.enable = function() {
            this._enabled = true;
          }, ls.prototype.disable = function() {
            this._enabled = false, this.reset();
          }, ls.prototype.isEnabled = function() {
            return this._enabled;
          }, ls.prototype.isActive = function() {
            return this._active;
          };
          var go = function(P2, U2) {
            this._map = P2, this._el = P2.getCanvasContainer(), this._handler = U2, this._delta = 0, this._defaultZoomRate = 0.01, this._wheelZoomRate = 1 / 450, i.bindAll(["_onWheel", "_onTimeout", "_onScrollFrame", "_onScrollFinished"], this);
          };
          go.prototype.setZoomRate = function(P2) {
            this._defaultZoomRate = P2;
          }, go.prototype.setWheelZoomRate = function(P2) {
            this._wheelZoomRate = P2;
          }, go.prototype.isEnabled = function() {
            return !!this._enabled;
          }, go.prototype.isActive = function() {
            return !!this._active || this._finishTimeout !== void 0;
          }, go.prototype.isZooming = function() {
            return !!this._zooming;
          }, go.prototype.enable = function(P2) {
            this.isEnabled() || (this._enabled = true, this._aroundCenter = P2 && P2.around === "center");
          }, go.prototype.disable = function() {
            this.isEnabled() && (this._enabled = false);
          }, go.prototype.wheel = function(P2) {
            if (this.isEnabled()) {
              var U2 = P2.deltaMode === i.window.WheelEvent.DOM_DELTA_LINE ? 40 * P2.deltaY : P2.deltaY, G2 = i.browser.now(), J2 = G2 - (this._lastWheelEventTime || 0);
              this._lastWheelEventTime = G2, U2 !== 0 && U2 % 4.000244140625 == 0 ? this._type = "wheel" : U2 !== 0 && Math.abs(U2) < 4 ? this._type = "trackpad" : J2 > 400 ? (this._type = null, this._lastValue = U2, this._timeout = setTimeout(this._onTimeout, 40, P2)) : this._type || (this._type = Math.abs(J2 * U2) < 200 ? "trackpad" : "wheel", this._timeout && (clearTimeout(this._timeout), this._timeout = null, U2 += this._lastValue)), P2.shiftKey && U2 && (U2 /= 4), this._type && (this._lastWheelEvent = P2, this._delta -= U2, this._active || this._start(P2)), P2.preventDefault();
            }
          }, go.prototype._onTimeout = function(P2) {
            this._type = "wheel", this._delta -= this._lastValue, this._active || this._start(P2);
          }, go.prototype._start = function(P2) {
            if (this._delta) {
              this._frameId && (this._frameId = null), this._active = true, this.isZooming() || (this._zooming = true), this._finishTimeout && (clearTimeout(this._finishTimeout), delete this._finishTimeout);
              var U2 = u2.mousePos(this._el, P2);
              this._around = i.LngLat.convert(this._aroundCenter ? this._map.getCenter() : this._map.unproject(U2)), this._aroundPoint = this._map.transform.locationPoint(this._around), this._frameId || (this._frameId = true, this._handler._triggerRenderFrame());
            }
          }, go.prototype.renderFrame = function() {
            return this._onScrollFrame();
          }, go.prototype._onScrollFrame = function() {
            var P2 = this;
            if (this._frameId && (this._frameId = null, this.isActive())) {
              var U2 = this._map.transform;
              if (this._delta !== 0) {
                var G2 = this._type === "wheel" && Math.abs(this._delta) > 4.000244140625 ? this._wheelZoomRate : this._defaultZoomRate, J2 = 2 / (1 + Math.exp(-Math.abs(this._delta * G2)));
                this._delta < 0 && J2 !== 0 && (J2 = 1 / J2);
                var oe = typeof this._targetZoom == "number" ? U2.zoomScale(this._targetZoom) : U2.scale;
                this._targetZoom = Math.min(U2.maxZoom, Math.max(U2.minZoom, U2.scaleZoom(oe * J2))), this._type === "wheel" && (this._startZoom = U2.zoom, this._easing = this._smoothOutEasing(200)), this._delta = 0;
              }
              var de, ye = typeof this._targetZoom == "number" ? this._targetZoom : U2.zoom, Te = this._startZoom, Fe = this._easing, et = false;
              if (this._type === "wheel" && Te && Fe) {
                var lt = Math.min((i.browser.now() - this._lastWheelEventTime) / 200, 1), bt = Fe(lt);
                de = i.number(Te, ye, bt), lt < 1 ? this._frameId || (this._frameId = true) : et = true;
              } else de = ye, et = true;
              return this._active = true, et && (this._active = false, this._finishTimeout = setTimeout(function() {
                P2._zooming = false, P2._handler._triggerRenderFrame(), delete P2._targetZoom, delete P2._finishTimeout;
              }, 200)), { noInertia: true, needsRenderFrame: !et, zoomDelta: de - U2.zoom, around: this._aroundPoint, originalEvent: this._lastWheelEvent };
            }
          }, go.prototype._smoothOutEasing = function(P2) {
            var U2 = i.ease;
            if (this._prevEase) {
              var G2 = this._prevEase, J2 = (i.browser.now() - G2.start) / G2.duration, oe = G2.easing(J2 + 0.01) - G2.easing(J2), de = 0.27 / Math.sqrt(oe * oe + 1e-4) * 0.01, ye = Math.sqrt(0.0729 - de * de);
              U2 = i.bezier(de, ye, 0.25, 1);
            }
            return this._prevEase = { start: i.browser.now(), duration: P2, easing: U2 }, U2;
          }, go.prototype.reset = function() {
            this._active = false;
          };
          var Ds = function(P2, U2) {
            this._clickZoom = P2, this._tapZoom = U2;
          };
          Ds.prototype.enable = function() {
            this._clickZoom.enable(), this._tapZoom.enable();
          }, Ds.prototype.disable = function() {
            this._clickZoom.disable(), this._tapZoom.disable();
          }, Ds.prototype.isEnabled = function() {
            return this._clickZoom.isEnabled() && this._tapZoom.isEnabled();
          }, Ds.prototype.isActive = function() {
            return this._clickZoom.isActive() || this._tapZoom.isActive();
          };
          var Sl = function() {
            this.reset();
          };
          Sl.prototype.reset = function() {
            this._active = false;
          }, Sl.prototype.dblclick = function(P2, U2) {
            return P2.preventDefault(), { cameraAnimation: function(G2) {
              G2.easeTo({ duration: 300, zoom: G2.getZoom() + (P2.shiftKey ? -1 : 1), around: G2.unproject(U2) }, { originalEvent: P2 });
            } };
          }, Sl.prototype.enable = function() {
            this._enabled = true;
          }, Sl.prototype.disable = function() {
            this._enabled = false, this.reset();
          }, Sl.prototype.isEnabled = function() {
            return this._enabled;
          }, Sl.prototype.isActive = function() {
            return this._active;
          };
          var Fo = function() {
            this._tap = new Si({ numTouches: 1, numTaps: 1 }), this.reset();
          };
          Fo.prototype.reset = function() {
            this._active = false, delete this._swipePoint, delete this._swipeTouch, delete this._tapTime, this._tap.reset();
          }, Fo.prototype.touchstart = function(P2, U2, G2) {
            this._swipePoint || (this._tapTime && P2.timeStamp - this._tapTime > 500 && this.reset(), this._tapTime ? G2.length > 0 && (this._swipePoint = U2[0], this._swipeTouch = G2[0].identifier) : this._tap.touchstart(P2, U2, G2));
          }, Fo.prototype.touchmove = function(P2, U2, G2) {
            if (this._tapTime) {
              if (this._swipePoint) {
                if (G2[0].identifier !== this._swipeTouch) return;
                var J2 = U2[0], oe = J2.y - this._swipePoint.y;
                return this._swipePoint = J2, P2.preventDefault(), this._active = true, { zoomDelta: oe / 128 };
              }
            } else this._tap.touchmove(P2, U2, G2);
          }, Fo.prototype.touchend = function(P2, U2, G2) {
            this._tapTime ? this._swipePoint && G2.length === 0 && this.reset() : this._tap.touchend(P2, U2, G2) && (this._tapTime = P2.timeStamp);
          }, Fo.prototype.touchcancel = function() {
            this.reset();
          }, Fo.prototype.enable = function() {
            this._enabled = true;
          }, Fo.prototype.disable = function() {
            this._enabled = false, this.reset();
          }, Fo.prototype.isEnabled = function() {
            return this._enabled;
          }, Fo.prototype.isActive = function() {
            return this._active;
          };
          var fu = function(P2, U2, G2) {
            this._el = P2, this._mousePan = U2, this._touchPan = G2;
          };
          fu.prototype.enable = function(P2) {
            this._inertiaOptions = P2 || {}, this._mousePan.enable(), this._touchPan.enable(), this._el.classList.add("mapboxgl-touch-drag-pan");
          }, fu.prototype.disable = function() {
            this._mousePan.disable(), this._touchPan.disable(), this._el.classList.remove("mapboxgl-touch-drag-pan");
          }, fu.prototype.isEnabled = function() {
            return this._mousePan.isEnabled() && this._touchPan.isEnabled();
          }, fu.prototype.isActive = function() {
            return this._mousePan.isActive() || this._touchPan.isActive();
          };
          var Oo = function(P2, U2, G2) {
            this._pitchWithRotate = P2.pitchWithRotate, this._mouseRotate = U2, this._mousePitch = G2;
          };
          Oo.prototype.enable = function() {
            this._mouseRotate.enable(), this._pitchWithRotate && this._mousePitch.enable();
          }, Oo.prototype.disable = function() {
            this._mouseRotate.disable(), this._mousePitch.disable();
          }, Oo.prototype.isEnabled = function() {
            return this._mouseRotate.isEnabled() && (!this._pitchWithRotate || this._mousePitch.isEnabled());
          }, Oo.prototype.isActive = function() {
            return this._mouseRotate.isActive() || this._mousePitch.isActive();
          };
          var Jl = function(P2, U2, G2, J2) {
            this._el = P2, this._touchZoom = U2, this._touchRotate = G2, this._tapDragZoom = J2, this._rotationDisabled = false, this._enabled = true;
          };
          Jl.prototype.enable = function(P2) {
            this._touchZoom.enable(P2), this._rotationDisabled || this._touchRotate.enable(P2), this._tapDragZoom.enable(), this._el.classList.add("mapboxgl-touch-zoom-rotate");
          }, Jl.prototype.disable = function() {
            this._touchZoom.disable(), this._touchRotate.disable(), this._tapDragZoom.disable(), this._el.classList.remove("mapboxgl-touch-zoom-rotate");
          }, Jl.prototype.isEnabled = function() {
            return this._touchZoom.isEnabled() && (this._rotationDisabled || this._touchRotate.isEnabled()) && this._tapDragZoom.isEnabled();
          }, Jl.prototype.isActive = function() {
            return this._touchZoom.isActive() || this._touchRotate.isActive() || this._tapDragZoom.isActive();
          }, Jl.prototype.disableRotation = function() {
            this._rotationDisabled = true, this._touchRotate.disable();
          }, Jl.prototype.enableRotation = function() {
            this._rotationDisabled = false, this._touchZoom.isEnabled() && this._touchRotate.enable();
          };
          var qf = function(P2) {
            return P2.zoom || P2.drag || P2.pitch || P2.rotate;
          }, Af = function(P2) {
            function U2() {
              P2.apply(this, arguments);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2;
          }(i.Event);
          function Ed(P2) {
            return P2.panDelta && P2.panDelta.mag() || P2.zoomDelta || P2.bearingDelta || P2.pitchDelta;
          }
          var Ks = function(P2, U2) {
            this._map = P2, this._el = this._map.getCanvasContainer(), this._handlers = [], this._handlersById = {}, this._changes = [], this._inertia = new Gn(P2), this._bearingSnap = U2.bearingSnap, this._previousActiveHandlers = {}, this._eventsInProgress = {}, this._addDefaultHandlers(U2), i.bindAll(["handleEvent", "handleWindowEvent"], this);
            var G2 = this._el;
            this._listeners = [[G2, "touchstart", { passive: false }], [G2, "touchmove", { passive: false }], [G2, "touchend", void 0], [G2, "touchcancel", void 0], [G2, "mousedown", void 0], [G2, "mousemove", void 0], [G2, "mouseup", void 0], [i.window.document, "mousemove", { capture: true }], [i.window.document, "mouseup", void 0], [G2, "mouseover", void 0], [G2, "mouseout", void 0], [G2, "dblclick", void 0], [G2, "click", void 0], [G2, "keydown", { capture: false }], [G2, "keyup", void 0], [G2, "wheel", { passive: false }], [G2, "contextmenu", void 0], [i.window, "blur", void 0]];
            for (var J2 = 0, oe = this._listeners; J2 < oe.length; J2 += 1) {
              var de = oe[J2], ye = de[0], Te = de[1], Fe = de[2];
              u2.addEventListener(ye, Te, ye === i.window.document ? this.handleWindowEvent : this.handleEvent, Fe);
            }
          };
          Ks.prototype.destroy = function() {
            for (var P2 = 0, U2 = this._listeners; P2 < U2.length; P2 += 1) {
              var G2 = U2[P2], J2 = G2[0], oe = G2[1], de = G2[2];
              u2.removeEventListener(J2, oe, J2 === i.window.document ? this.handleWindowEvent : this.handleEvent, de);
            }
          }, Ks.prototype._addDefaultHandlers = function(P2) {
            var U2 = this._map, G2 = U2.getCanvasContainer();
            this._add("mapEvent", new mn(U2, P2));
            var J2 = U2.boxZoom = new ra(U2, P2);
            this._add("boxZoom", J2);
            var oe = new Vi(), de = new Sl();
            U2.doubleClickZoom = new Ds(de, oe), this._add("tapZoom", oe), this._add("clickZoom", de);
            var ye = new Fo();
            this._add("tapDragZoom", ye);
            var Te = U2.touchPitch = new _u();
            this._add("touchPitch", Te);
            var Fe = new Bi(P2), et = new li(P2);
            U2.dragRotate = new Oo(P2, Fe, et), this._add("mouseRotate", Fe, ["mousePitch"]), this._add("mousePitch", et, ["mouseRotate"]);
            var lt = new Xi(P2), bt = new Ki(P2);
            U2.dragPan = new fu(G2, lt, bt), this._add("mousePan", lt), this._add("touchPan", bt, ["touchZoom", "touchRotate"]);
            var It = new Jc(), Rt = new mo();
            U2.touchZoomRotate = new Jl(G2, Rt, It, ye), this._add("touchRotate", It, ["touchPan", "touchZoom"]), this._add("touchZoom", Rt, ["touchPan", "touchRotate"]);
            var Ft = U2.scrollZoom = new go(U2, this);
            this._add("scrollZoom", Ft, ["mousePan"]);
            var Pt = U2.keyboard = new ls();
            this._add("keyboard", Pt), this._add("blockableMapEvent", new Fa(U2));
            for (var Mt = 0, qt = ["boxZoom", "doubleClickZoom", "tapDragZoom", "touchPitch", "dragRotate", "dragPan", "touchZoomRotate", "scrollZoom", "keyboard"]; Mt < qt.length; Mt += 1) {
              var $t = qt[Mt];
              P2.interactive && P2[$t] && U2[$t].enable(P2[$t]);
            }
          }, Ks.prototype._add = function(P2, U2, G2) {
            this._handlers.push({ handlerName: P2, handler: U2, allowed: G2 }), this._handlersById[P2] = U2;
          }, Ks.prototype.stop = function() {
            if (!this._updatingCamera) {
              for (var P2 = 0, U2 = this._handlers; P2 < U2.length; P2 += 1) U2[P2].handler.reset();
              this._inertia.clear(), this._fireEvents({}, {}), this._changes = [];
            }
          }, Ks.prototype.isActive = function() {
            for (var P2 = 0, U2 = this._handlers; P2 < U2.length; P2 += 1) if (U2[P2].handler.isActive()) return true;
            return false;
          }, Ks.prototype.isZooming = function() {
            return !!this._eventsInProgress.zoom || this._map.scrollZoom.isZooming();
          }, Ks.prototype.isRotating = function() {
            return !!this._eventsInProgress.rotate;
          }, Ks.prototype.isMoving = function() {
            return Boolean(qf(this._eventsInProgress)) || this.isZooming();
          }, Ks.prototype._blockedByActive = function(P2, U2, G2) {
            for (var J2 in P2) if (J2 !== G2 && (!U2 || U2.indexOf(J2) < 0)) return true;
            return false;
          }, Ks.prototype.handleWindowEvent = function(P2) {
            this.handleEvent(P2, P2.type + "Window");
          }, Ks.prototype._getMapTouches = function(P2) {
            for (var U2 = [], G2 = 0, J2 = P2; G2 < J2.length; G2 += 1) {
              var oe = J2[G2], de = oe.target;
              this._el.contains(de) && U2.push(oe);
            }
            return U2;
          }, Ks.prototype.handleEvent = function(P2, U2) {
            if (P2.type !== "blur") {
              this._updatingCamera = true;
              for (var G2 = P2.type === "renderFrame" ? void 0 : P2, J2 = { needsRenderFrame: false }, oe = {}, de = {}, ye = P2.touches ? this._getMapTouches(P2.touches) : void 0, Te = ye ? u2.touchPos(this._el, ye) : u2.mousePos(this._el, P2), Fe = 0, et = this._handlers; Fe < et.length; Fe += 1) {
                var lt = et[Fe], bt = lt.handlerName, It = lt.handler, Rt = lt.allowed;
                if (It.isEnabled()) {
                  var Ft = void 0;
                  this._blockedByActive(de, Rt, bt) ? It.reset() : It[U2 || P2.type] && (Ft = It[U2 || P2.type](P2, Te, ye), this.mergeHandlerResult(J2, oe, Ft, bt, G2), Ft && Ft.needsRenderFrame && this._triggerRenderFrame()), (Ft || It.isActive()) && (de[bt] = It);
                }
              }
              var Pt = {};
              for (var Mt in this._previousActiveHandlers) de[Mt] || (Pt[Mt] = G2);
              this._previousActiveHandlers = de, (Object.keys(Pt).length || Ed(J2)) && (this._changes.push([J2, oe, Pt]), this._triggerRenderFrame()), (Object.keys(de).length || Ed(J2)) && this._map._stop(true), this._updatingCamera = false;
              var qt = J2.cameraAnimation;
              qt && (this._inertia.clear(), this._fireEvents({}, {}), this._changes = [], qt(this._map));
            } else this.stop();
          }, Ks.prototype.mergeHandlerResult = function(P2, U2, G2, J2, oe) {
            if (G2) {
              i.extend(P2, G2);
              var de = { handlerName: J2, originalEvent: G2.originalEvent || oe };
              G2.zoomDelta !== void 0 && (U2.zoom = de), G2.panDelta !== void 0 && (U2.drag = de), G2.pitchDelta !== void 0 && (U2.pitch = de), G2.bearingDelta !== void 0 && (U2.rotate = de);
            }
          }, Ks.prototype._applyChanges = function() {
            for (var P2 = {}, U2 = {}, G2 = {}, J2 = 0, oe = this._changes; J2 < oe.length; J2 += 1) {
              var de = oe[J2], ye = de[0], Te = de[1], Fe = de[2];
              ye.panDelta && (P2.panDelta = (P2.panDelta || new i.Point(0, 0))._add(ye.panDelta)), ye.zoomDelta && (P2.zoomDelta = (P2.zoomDelta || 0) + ye.zoomDelta), ye.bearingDelta && (P2.bearingDelta = (P2.bearingDelta || 0) + ye.bearingDelta), ye.pitchDelta && (P2.pitchDelta = (P2.pitchDelta || 0) + ye.pitchDelta), ye.around !== void 0 && (P2.around = ye.around), ye.pinchAround !== void 0 && (P2.pinchAround = ye.pinchAround), ye.noInertia && (P2.noInertia = ye.noInertia), i.extend(U2, Te), i.extend(G2, Fe);
            }
            this._updateMapTransform(P2, U2, G2), this._changes = [];
          }, Ks.prototype._updateMapTransform = function(P2, U2, G2) {
            var J2 = this._map, oe = J2.transform;
            if (!Ed(P2)) return this._fireEvents(U2, G2);
            var de = P2.panDelta, ye = P2.zoomDelta, Te = P2.bearingDelta, Fe = P2.pitchDelta, et = P2.around, lt = P2.pinchAround;
            lt !== void 0 && (et = lt), J2._stop(true), et = et || J2.transform.centerPoint;
            var bt = oe.pointLocation(de ? et.sub(de) : et);
            Te && (oe.bearing += Te), Fe && (oe.pitch += Fe), ye && (oe.zoom += ye), oe.setLocationAtPoint(bt, et), this._map._update(), P2.noInertia || this._inertia.record(P2), this._fireEvents(U2, G2);
          }, Ks.prototype._fireEvents = function(P2, U2) {
            var G2 = this, J2 = qf(this._eventsInProgress), oe = qf(P2), de = {};
            for (var ye in P2) {
              var Te = P2[ye].originalEvent;
              this._eventsInProgress[ye] || (de[ye + "start"] = Te), this._eventsInProgress[ye] = P2[ye];
            }
            for (var Fe in !J2 && oe && this._fireEvent("movestart", oe.originalEvent), de) this._fireEvent(Fe, de[Fe]);
            for (var et in P2.rotate && (this._bearingChanged = true), oe && this._fireEvent("move", oe.originalEvent), P2) {
              var lt = P2[et].originalEvent;
              this._fireEvent(et, lt);
            }
            var bt, It = {};
            for (var Rt in this._eventsInProgress) {
              var Ft = this._eventsInProgress[Rt], Pt = Ft.handlerName, Mt = Ft.originalEvent;
              this._handlersById[Pt].isActive() || (delete this._eventsInProgress[Rt], bt = U2[Pt] || Mt, It[Rt + "end"] = bt);
            }
            for (var qt in It) this._fireEvent(qt, It[qt]);
            var $t = qf(this._eventsInProgress);
            if ((J2 || oe) && !$t) {
              this._updatingCamera = true;
              var Yt = this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions), cr = function(kr) {
                return kr !== 0 && -G2._bearingSnap < kr && kr < G2._bearingSnap;
              };
              Yt ? (cr(Yt.bearing || this._map.getBearing()) && (Yt.bearing = 0), this._map.easeTo(Yt, { originalEvent: bt })) : (this._map.fire(new i.Event("moveend", { originalEvent: bt })), cr(this._map.getBearing()) && this._map.resetNorth()), this._bearingChanged = false, this._updatingCamera = false;
            }
          }, Ks.prototype._fireEvent = function(P2, U2) {
            this._map.fire(new i.Event(P2, U2 ? { originalEvent: U2 } : {}));
          }, Ks.prototype._triggerRenderFrame = function() {
            var P2 = this;
            this._frameId === void 0 && (this._frameId = this._map._requestRenderFrame(function(U2) {
              delete P2._frameId, P2.handleEvent(new Af("renderFrame", { timeStamp: U2 })), P2._applyChanges();
            }));
          };
          var Dd = function(P2) {
            function U2(G2, J2) {
              P2.call(this), this._moving = false, this._zooming = false, this.transform = G2, this._bearingSnap = J2.bearingSnap, i.bindAll(["_renderFrameCallback"], this);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.getCenter = function() {
              return new i.LngLat(this.transform.center.lng, this.transform.center.lat);
            }, U2.prototype.setCenter = function(G2, J2) {
              return this.jumpTo({ center: G2 }, J2);
            }, U2.prototype.panBy = function(G2, J2, oe) {
              return G2 = i.Point.convert(G2).mult(-1), this.panTo(this.transform.center, i.extend({ offset: G2 }, J2), oe);
            }, U2.prototype.panTo = function(G2, J2, oe) {
              return this.easeTo(i.extend({ center: G2 }, J2), oe);
            }, U2.prototype.getZoom = function() {
              return this.transform.zoom;
            }, U2.prototype.setZoom = function(G2, J2) {
              return this.jumpTo({ zoom: G2 }, J2), this;
            }, U2.prototype.zoomTo = function(G2, J2, oe) {
              return this.easeTo(i.extend({ zoom: G2 }, J2), oe);
            }, U2.prototype.zoomIn = function(G2, J2) {
              return this.zoomTo(this.getZoom() + 1, G2, J2), this;
            }, U2.prototype.zoomOut = function(G2, J2) {
              return this.zoomTo(this.getZoom() - 1, G2, J2), this;
            }, U2.prototype.getBearing = function() {
              return this.transform.bearing;
            }, U2.prototype.setBearing = function(G2, J2) {
              return this.jumpTo({ bearing: G2 }, J2), this;
            }, U2.prototype.getPadding = function() {
              return this.transform.padding;
            }, U2.prototype.setPadding = function(G2, J2) {
              return this.jumpTo({ padding: G2 }, J2), this;
            }, U2.prototype.rotateTo = function(G2, J2, oe) {
              return this.easeTo(i.extend({ bearing: G2 }, J2), oe);
            }, U2.prototype.resetNorth = function(G2, J2) {
              return this.rotateTo(0, i.extend({ duration: 1e3 }, G2), J2), this;
            }, U2.prototype.resetNorthPitch = function(G2, J2) {
              return this.easeTo(i.extend({ bearing: 0, pitch: 0, duration: 1e3 }, G2), J2), this;
            }, U2.prototype.snapToNorth = function(G2, J2) {
              return Math.abs(this.getBearing()) < this._bearingSnap ? this.resetNorth(G2, J2) : this;
            }, U2.prototype.getPitch = function() {
              return this.transform.pitch;
            }, U2.prototype.setPitch = function(G2, J2) {
              return this.jumpTo({ pitch: G2 }, J2), this;
            }, U2.prototype.cameraForBounds = function(G2, J2) {
              return G2 = i.LngLatBounds.convert(G2), this._cameraForBoxAndBearing(G2.getNorthWest(), G2.getSouthEast(), 0, J2);
            }, U2.prototype._cameraForBoxAndBearing = function(G2, J2, oe, de) {
              var ye = { top: 0, bottom: 0, right: 0, left: 0 };
              if (typeof (de = i.extend({ padding: ye, offset: [0, 0], maxZoom: this.transform.maxZoom }, de)).padding == "number") {
                var Te = de.padding;
                de.padding = { top: Te, bottom: Te, right: Te, left: Te };
              }
              de.padding = i.extend(ye, de.padding);
              var Fe = this.transform, et = Fe.padding, lt = Fe.project(i.LngLat.convert(G2)), bt = Fe.project(i.LngLat.convert(J2)), It = lt.rotate(-oe * Math.PI / 180), Rt = bt.rotate(-oe * Math.PI / 180), Ft = new i.Point(Math.max(It.x, Rt.x), Math.max(It.y, Rt.y)), Pt = new i.Point(Math.min(It.x, Rt.x), Math.min(It.y, Rt.y)), Mt = Ft.sub(Pt), qt = (Fe.width - (et.left + et.right + de.padding.left + de.padding.right)) / Mt.x, $t = (Fe.height - (et.top + et.bottom + de.padding.top + de.padding.bottom)) / Mt.y;
              if (!($t < 0 || qt < 0)) {
                var Yt = Math.min(Fe.scaleZoom(Fe.scale * Math.min(qt, $t)), de.maxZoom), cr = i.Point.convert(de.offset), kr = (de.padding.left - de.padding.right) / 2, Pr = (de.padding.top - de.padding.bottom) / 2, Or = new i.Point(cr.x + kr, cr.y + Pr).mult(Fe.scale / Fe.zoomScale(Yt));
                return { center: Fe.unproject(lt.add(bt).div(2).sub(Or)), zoom: Yt, bearing: oe };
              }
              i.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");
            }, U2.prototype.fitBounds = function(G2, J2, oe) {
              return this._fitInternal(this.cameraForBounds(G2, J2), J2, oe);
            }, U2.prototype.fitScreenCoordinates = function(G2, J2, oe, de, ye) {
              return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(i.Point.convert(G2)), this.transform.pointLocation(i.Point.convert(J2)), oe, de), de, ye);
            }, U2.prototype._fitInternal = function(G2, J2, oe) {
              return G2 ? (delete (J2 = i.extend(G2, J2)).padding, J2.linear ? this.easeTo(J2, oe) : this.flyTo(J2, oe)) : this;
            }, U2.prototype.jumpTo = function(G2, J2) {
              this.stop();
              var oe = this.transform, de = false, ye = false, Te = false;
              return "zoom" in G2 && oe.zoom !== +G2.zoom && (de = true, oe.zoom = +G2.zoom), G2.center !== void 0 && (oe.center = i.LngLat.convert(G2.center)), "bearing" in G2 && oe.bearing !== +G2.bearing && (ye = true, oe.bearing = +G2.bearing), "pitch" in G2 && oe.pitch !== +G2.pitch && (Te = true, oe.pitch = +G2.pitch), G2.padding == null || oe.isPaddingEqual(G2.padding) || (oe.padding = G2.padding), this.fire(new i.Event("movestart", J2)).fire(new i.Event("move", J2)), de && this.fire(new i.Event("zoomstart", J2)).fire(new i.Event("zoom", J2)).fire(new i.Event("zoomend", J2)), ye && this.fire(new i.Event("rotatestart", J2)).fire(new i.Event("rotate", J2)).fire(new i.Event("rotateend", J2)), Te && this.fire(new i.Event("pitchstart", J2)).fire(new i.Event("pitch", J2)).fire(new i.Event("pitchend", J2)), this.fire(new i.Event("moveend", J2));
            }, U2.prototype.easeTo = function(G2, J2) {
              var oe = this;
              this._stop(false, G2.easeId), ((G2 = i.extend({ offset: [0, 0], duration: 500, easing: i.ease }, G2)).animate === false || !G2.essential && i.browser.prefersReducedMotion) && (G2.duration = 0);
              var de = this.transform, ye = this.getZoom(), Te = this.getBearing(), Fe = this.getPitch(), et = this.getPadding(), lt = "zoom" in G2 ? +G2.zoom : ye, bt = "bearing" in G2 ? this._normalizeBearing(G2.bearing, Te) : Te, It = "pitch" in G2 ? +G2.pitch : Fe, Rt = "padding" in G2 ? G2.padding : de.padding, Ft = i.Point.convert(G2.offset), Pt = de.centerPoint.add(Ft), Mt = de.pointLocation(Pt), qt = i.LngLat.convert(G2.center || Mt);
              this._normalizeCenter(qt);
              var $t, Yt, cr = de.project(Mt), kr = de.project(qt).sub(cr), Pr = de.zoomScale(lt - ye);
              G2.around && ($t = i.LngLat.convert(G2.around), Yt = de.locationPoint($t));
              var Or = { moving: this._moving, zooming: this._zooming, rotating: this._rotating, pitching: this._pitching };
              return this._zooming = this._zooming || lt !== ye, this._rotating = this._rotating || Te !== bt, this._pitching = this._pitching || It !== Fe, this._padding = !de.isPaddingEqual(Rt), this._easeId = G2.easeId, this._prepareEase(J2, G2.noMoveStart, Or), clearTimeout(this._easeEndTimeoutID), this._ease(function(xn) {
                if (oe._zooming && (de.zoom = i.number(ye, lt, xn)), oe._rotating && (de.bearing = i.number(Te, bt, xn)), oe._pitching && (de.pitch = i.number(Fe, It, xn)), oe._padding && (de.interpolatePadding(et, Rt, xn), Pt = de.centerPoint.add(Ft)), $t) de.setLocationAtPoint($t, Yt);
                else {
                  var yn = de.zoomScale(de.zoom - ye), Nn = lt > ye ? Math.min(2, Pr) : Math.max(0.5, Pr), An = Math.pow(Nn, 1 - xn), ma = de.unproject(cr.add(kr.mult(xn * An)).mult(yn));
                  de.setLocationAtPoint(de.renderWorldCopies ? ma.wrap() : ma, Pt);
                }
                oe._fireMoveEvents(J2);
              }, function(xn) {
                oe._afterEase(J2, xn);
              }, G2), this;
            }, U2.prototype._prepareEase = function(G2, J2, oe) {
              oe === void 0 && (oe = {}), this._moving = true, J2 || oe.moving || this.fire(new i.Event("movestart", G2)), this._zooming && !oe.zooming && this.fire(new i.Event("zoomstart", G2)), this._rotating && !oe.rotating && this.fire(new i.Event("rotatestart", G2)), this._pitching && !oe.pitching && this.fire(new i.Event("pitchstart", G2));
            }, U2.prototype._fireMoveEvents = function(G2) {
              this.fire(new i.Event("move", G2)), this._zooming && this.fire(new i.Event("zoom", G2)), this._rotating && this.fire(new i.Event("rotate", G2)), this._pitching && this.fire(new i.Event("pitch", G2));
            }, U2.prototype._afterEase = function(G2, J2) {
              if (!this._easeId || !J2 || this._easeId !== J2) {
                delete this._easeId;
                var oe = this._zooming, de = this._rotating, ye = this._pitching;
                this._moving = false, this._zooming = false, this._rotating = false, this._pitching = false, this._padding = false, oe && this.fire(new i.Event("zoomend", G2)), de && this.fire(new i.Event("rotateend", G2)), ye && this.fire(new i.Event("pitchend", G2)), this.fire(new i.Event("moveend", G2));
              }
            }, U2.prototype.flyTo = function(G2, J2) {
              var oe = this;
              if (!G2.essential && i.browser.prefersReducedMotion) {
                var de = i.pick(G2, ["center", "zoom", "bearing", "pitch", "around"]);
                return this.jumpTo(de, J2);
              }
              this.stop(), G2 = i.extend({ offset: [0, 0], speed: 1.2, curve: 1.42, easing: i.ease }, G2);
              var ye = this.transform, Te = this.getZoom(), Fe = this.getBearing(), et = this.getPitch(), lt = this.getPadding(), bt = "zoom" in G2 ? i.clamp(+G2.zoom, ye.minZoom, ye.maxZoom) : Te, It = "bearing" in G2 ? this._normalizeBearing(G2.bearing, Fe) : Fe, Rt = "pitch" in G2 ? +G2.pitch : et, Ft = "padding" in G2 ? G2.padding : ye.padding, Pt = ye.zoomScale(bt - Te), Mt = i.Point.convert(G2.offset), qt = ye.centerPoint.add(Mt), $t = ye.pointLocation(qt), Yt = i.LngLat.convert(G2.center || $t);
              this._normalizeCenter(Yt);
              var cr = ye.project($t), kr = ye.project(Yt).sub(cr), Pr = G2.curve, Or = Math.max(ye.width, ye.height), xn = Or / Pt, yn = kr.mag();
              if ("minZoom" in G2) {
                var Nn = i.clamp(Math.min(G2.minZoom, Te, bt), ye.minZoom, ye.maxZoom), An = Or / ye.zoomScale(Nn - Te);
                Pr = Math.sqrt(An / yn * 2);
              }
              var ma = Pr * Pr;
              function Aa(Da) {
                var wi = (xn * xn - Or * Or + (Da ? -1 : 1) * ma * ma * yn * yn) / (2 * (Da ? xn : Or) * ma * yn);
                return Math.log(Math.sqrt(wi * wi + 1) - wi);
              }
              function Qa(Da) {
                return (Math.exp(Da) - Math.exp(-Da)) / 2;
              }
              function ln(Da) {
                return (Math.exp(Da) + Math.exp(-Da)) / 2;
              }
              var qn = Aa(0), Sa = function(Da) {
                return ln(qn) / ln(qn + Pr * Da);
              }, _a = function(Da) {
                return Or * ((ln(qn) * (Qa(wi = qn + Pr * Da) / ln(wi)) - Qa(qn)) / ma) / yn;
                var wi;
              }, Pa = (Aa(1) - qn) / Pr;
              if (Math.abs(yn) < 1e-6 || !isFinite(Pa)) {
                if (Math.abs(Or - xn) < 1e-6) return this.easeTo(G2, J2);
                var ii = xn < Or ? -1 : 1;
                Pa = Math.abs(Math.log(xn / Or)) / Pr, _a = function() {
                  return 0;
                }, Sa = function(Da) {
                  return Math.exp(ii * Pr * Da);
                };
              }
              if ("duration" in G2) G2.duration = +G2.duration;
              else {
                var Oi = "screenSpeed" in G2 ? +G2.screenSpeed / Pr : +G2.speed;
                G2.duration = 1e3 * Pa / Oi;
              }
              return G2.maxDuration && G2.duration > G2.maxDuration && (G2.duration = 0), this._zooming = true, this._rotating = Fe !== It, this._pitching = Rt !== et, this._padding = !ye.isPaddingEqual(Ft), this._prepareEase(J2, false), this._ease(function(Da) {
                var wi = Da * Pa, di = 1 / Sa(wi);
                ye.zoom = Da === 1 ? bt : Te + ye.scaleZoom(di), oe._rotating && (ye.bearing = i.number(Fe, It, Da)), oe._pitching && (ye.pitch = i.number(et, Rt, Da)), oe._padding && (ye.interpolatePadding(lt, Ft, Da), qt = ye.centerPoint.add(Mt));
                var ji = Da === 1 ? Yt : ye.unproject(cr.add(kr.mult(_a(wi))).mult(di));
                ye.setLocationAtPoint(ye.renderWorldCopies ? ji.wrap() : ji, qt), oe._fireMoveEvents(J2);
              }, function() {
                return oe._afterEase(J2);
              }, G2), this;
            }, U2.prototype.isEasing = function() {
              return !!this._easeFrameId;
            }, U2.prototype.stop = function() {
              return this._stop();
            }, U2.prototype._stop = function(G2, J2) {
              if (this._easeFrameId && (this._cancelRenderFrame(this._easeFrameId), delete this._easeFrameId, delete this._onEaseFrame), this._onEaseEnd) {
                var oe = this._onEaseEnd;
                delete this._onEaseEnd, oe.call(this, J2);
              }
              if (!G2) {
                var de = this.handlers;
                de && de.stop();
              }
              return this;
            }, U2.prototype._ease = function(G2, J2, oe) {
              oe.animate === false || oe.duration === 0 ? (G2(1), J2()) : (this._easeStart = i.browser.now(), this._easeOptions = oe, this._onEaseFrame = G2, this._onEaseEnd = J2, this._easeFrameId = this._requestRenderFrame(this._renderFrameCallback));
            }, U2.prototype._renderFrameCallback = function() {
              var G2 = Math.min((i.browser.now() - this._easeStart) / this._easeOptions.duration, 1);
              this._onEaseFrame(this._easeOptions.easing(G2)), G2 < 1 ? this._easeFrameId = this._requestRenderFrame(this._renderFrameCallback) : this.stop();
            }, U2.prototype._normalizeBearing = function(G2, J2) {
              G2 = i.wrap(G2, -180, 180);
              var oe = Math.abs(G2 - J2);
              return Math.abs(G2 - 360 - J2) < oe && (G2 -= 360), Math.abs(G2 + 360 - J2) < oe && (G2 += 360), G2;
            }, U2.prototype._normalizeCenter = function(G2) {
              var J2 = this.transform;
              if (J2.renderWorldCopies && !J2.lngRange) {
                var oe = G2.lng - J2.center.lng;
                G2.lng += oe > 180 ? -360 : oe < -180 ? 360 : 0;
              }
            }, U2;
          }(i.Evented), Ys = function(P2) {
            P2 === void 0 && (P2 = {}), this.options = P2, i.bindAll(["_updateEditLink", "_updateData", "_updateCompact"], this);
          };
          Ys.prototype.getDefaultPosition = function() {
            return "bottom-right";
          }, Ys.prototype.onAdd = function(P2) {
            var U2 = this.options && this.options.compact;
            return this._map = P2, this._container = u2.create("div", "mapboxgl-ctrl mapboxgl-ctrl-attrib"), this._innerContainer = u2.create("div", "mapboxgl-ctrl-attrib-inner", this._container), U2 && this._container.classList.add("mapboxgl-compact"), this._updateAttributions(), this._updateEditLink(), this._map.on("styledata", this._updateData), this._map.on("sourcedata", this._updateData), this._map.on("moveend", this._updateEditLink), U2 === void 0 && (this._map.on("resize", this._updateCompact), this._updateCompact()), this._container;
          }, Ys.prototype.onRemove = function() {
            u2.remove(this._container), this._map.off("styledata", this._updateData), this._map.off("sourcedata", this._updateData), this._map.off("moveend", this._updateEditLink), this._map.off("resize", this._updateCompact), this._map = void 0, this._attribHTML = void 0;
          }, Ys.prototype._updateEditLink = function() {
            var P2 = this._editLink;
            P2 || (P2 = this._editLink = this._container.querySelector(".mapbox-improve-map"));
            var U2 = [{ key: "owner", value: this.styleOwner }, { key: "id", value: this.styleId }, { key: "access_token", value: this._map._requestManager._customAccessToken || i.config.ACCESS_TOKEN }];
            if (P2) {
              var G2 = U2.reduce(function(J2, oe, de) {
                return oe.value && (J2 += oe.key + "=" + oe.value + (de < U2.length - 1 ? "&" : "")), J2;
              }, "?");
              P2.href = i.config.FEEDBACK_URL + "/" + G2 + (this._map._hash ? this._map._hash.getHashString(true) : ""), P2.rel = "noopener nofollow";
            }
          }, Ys.prototype._updateData = function(P2) {
            !P2 || P2.sourceDataType !== "metadata" && P2.dataType !== "style" || (this._updateAttributions(), this._updateEditLink());
          }, Ys.prototype._updateAttributions = function() {
            if (this._map.style) {
              var P2 = [];
              if (this.options.customAttribution && (Array.isArray(this.options.customAttribution) ? P2 = P2.concat(this.options.customAttribution.map(function(Te) {
                return typeof Te != "string" ? "" : Te;
              })) : typeof this.options.customAttribution == "string" && P2.push(this.options.customAttribution)), this._map.style.stylesheet) {
                var U2 = this._map.style.stylesheet;
                this.styleOwner = U2.owner, this.styleId = U2.id;
              }
              var G2 = this._map.style.sourceCaches;
              for (var J2 in G2) {
                var oe = G2[J2];
                if (oe.used) {
                  var de = oe.getSource();
                  de.attribution && P2.indexOf(de.attribution) < 0 && P2.push(de.attribution);
                }
              }
              P2.sort(function(Te, Fe) {
                return Te.length - Fe.length;
              });
              var ye = (P2 = P2.filter(function(Te, Fe) {
                for (var et = Fe + 1; et < P2.length; et++) if (P2[et].indexOf(Te) >= 0) return false;
                return true;
              })).join(" | ");
              ye !== this._attribHTML && (this._attribHTML = ye, P2.length ? (this._innerContainer.innerHTML = ye, this._container.classList.remove("mapboxgl-attrib-empty")) : this._container.classList.add("mapboxgl-attrib-empty"), this._editLink = null);
            }
          }, Ys.prototype._updateCompact = function() {
            this._map.getCanvasContainer().offsetWidth <= 640 ? this._container.classList.add("mapboxgl-compact") : this._container.classList.remove("mapboxgl-compact");
          };
          var Sf = function() {
            i.bindAll(["_updateLogo"], this), i.bindAll(["_updateCompact"], this);
          };
          Sf.prototype.onAdd = function(P2) {
            this._map = P2, this._container = u2.create("div", "mapboxgl-ctrl");
            var U2 = u2.create("a", "mapboxgl-ctrl-logo");
            return U2.target = "_blank", U2.rel = "noopener nofollow", U2.href = "https://www.mapbox.com/", U2.setAttribute("aria-label", this._map._getUIString("LogoControl.Title")), U2.setAttribute("rel", "noopener nofollow"), this._container.appendChild(U2), this._container.style.display = "none", this._map.on("sourcedata", this._updateLogo), this._updateLogo(), this._map.on("resize", this._updateCompact), this._updateCompact(), this._container;
          }, Sf.prototype.onRemove = function() {
            u2.remove(this._container), this._map.off("sourcedata", this._updateLogo), this._map.off("resize", this._updateCompact);
          }, Sf.prototype.getDefaultPosition = function() {
            return "bottom-left";
          }, Sf.prototype._updateLogo = function(P2) {
            P2 && P2.sourceDataType !== "metadata" || (this._container.style.display = this._logoRequired() ? "block" : "none");
          }, Sf.prototype._logoRequired = function() {
            if (this._map.style) {
              var P2 = this._map.style.sourceCaches;
              for (var U2 in P2) if (P2[U2].getSource().mapbox_logo) return true;
              return false;
            }
          }, Sf.prototype._updateCompact = function() {
            var P2 = this._container.children;
            if (P2.length) {
              var U2 = P2[0];
              this._map.getCanvasContainer().offsetWidth < 250 ? U2.classList.add("mapboxgl-compact") : U2.classList.remove("mapboxgl-compact");
            }
          };
          var Ya = function() {
            this._queue = [], this._id = 0, this._cleared = false, this._currentlyRunning = false;
          };
          Ya.prototype.add = function(P2) {
            var U2 = ++this._id;
            return this._queue.push({ callback: P2, id: U2, cancelled: false }), U2;
          }, Ya.prototype.remove = function(P2) {
            for (var U2 = this._currentlyRunning, G2 = 0, J2 = U2 ? this._queue.concat(U2) : this._queue; G2 < J2.length; G2 += 1) {
              var oe = J2[G2];
              if (oe.id === P2) return void (oe.cancelled = true);
            }
          }, Ya.prototype.run = function(P2) {
            P2 === void 0 && (P2 = 0);
            var U2 = this._currentlyRunning = this._queue;
            this._queue = [];
            for (var G2 = 0, J2 = U2; G2 < J2.length; G2 += 1) {
              var oe = J2[G2];
              if (!oe.cancelled && (oe.callback(P2), this._cleared)) break;
            }
            this._cleared = false, this._currentlyRunning = false;
          }, Ya.prototype.clear = function() {
            this._currentlyRunning && (this._cleared = true), this._queue = [];
          };
          var yi = { "FullscreenControl.Enter": "Enter fullscreen", "FullscreenControl.Exit": "Exit fullscreen", "GeolocateControl.FindMyLocation": "Find my location", "GeolocateControl.LocationNotAvailable": "Location not available", "LogoControl.Title": "Mapbox logo", "NavigationControl.ResetBearing": "Reset bearing to north", "NavigationControl.ZoomIn": "Zoom in", "NavigationControl.ZoomOut": "Zoom out", "ScaleControl.Feet": "ft", "ScaleControl.Meters": "m", "ScaleControl.Kilometers": "km", "ScaleControl.Miles": "mi", "ScaleControl.NauticalMiles": "nm" }, Cd = i.window.HTMLImageElement, Md = i.window.HTMLElement, Ef = i.window.ImageBitmap, ic = { center: [0, 0], zoom: 0, bearing: 0, pitch: 0, minZoom: -2, maxZoom: 22, minPitch: 0, maxPitch: 60, interactive: true, scrollZoom: true, boxZoom: true, dragRotate: true, dragPan: true, keyboard: true, doubleClickZoom: true, touchZoomRotate: true, touchPitch: true, bearingSnap: 7, clickTolerance: 3, pitchWithRotate: true, hash: false, attributionControl: true, failIfMajorPerformanceCaveat: false, preserveDrawingBuffer: false, trackResize: true, renderWorldCopies: true, refreshExpiredTiles: true, maxTileCacheSize: null, localIdeographFontFamily: "sans-serif", transformRequest: null, accessToken: null, fadeDuration: 300, crossSourceCollisions: true }, Vc = function(P2) {
            function U2(J2) {
              var oe = this;
              if ((J2 = i.extend({}, ic, J2)).minZoom != null && J2.maxZoom != null && J2.minZoom > J2.maxZoom) throw new Error("maxZoom must be greater than or equal to minZoom");
              if (J2.minPitch != null && J2.maxPitch != null && J2.minPitch > J2.maxPitch) throw new Error("maxPitch must be greater than or equal to minPitch");
              if (J2.minPitch != null && J2.minPitch < 0) throw new Error("minPitch must be greater than or equal to 0");
              if (J2.maxPitch != null && J2.maxPitch > 60) throw new Error("maxPitch must be less than or equal to 60");
              var de = new Qt(J2.minZoom, J2.maxZoom, J2.minPitch, J2.maxPitch, J2.renderWorldCopies);
              if (P2.call(this, de, J2), this._interactive = J2.interactive, this._maxTileCacheSize = J2.maxTileCacheSize, this._failIfMajorPerformanceCaveat = J2.failIfMajorPerformanceCaveat, this._preserveDrawingBuffer = J2.preserveDrawingBuffer, this._antialias = J2.antialias, this._trackResize = J2.trackResize, this._bearingSnap = J2.bearingSnap, this._refreshExpiredTiles = J2.refreshExpiredTiles, this._fadeDuration = J2.fadeDuration, this._crossSourceCollisions = J2.crossSourceCollisions, this._crossFadingFactor = 1, this._collectResourceTiming = J2.collectResourceTiming, this._renderTaskQueue = new Ya(), this._controls = [], this._mapId = i.uniqueId(), this._locale = i.extend({}, yi, J2.locale), this._requestManager = new i.RequestManager(J2.transformRequest, J2.accessToken), typeof J2.container == "string") {
                if (this._container = i.window.document.getElementById(J2.container), !this._container) throw new Error("Container '" + J2.container + "' not found.");
              } else {
                if (!(J2.container instanceof Md)) throw new Error("Invalid type: 'container' must be a String or HTMLElement.");
                this._container = J2.container;
              }
              if (J2.maxBounds && this.setMaxBounds(J2.maxBounds), i.bindAll(["_onWindowOnline", "_onWindowResize", "_contextLost", "_contextRestored"], this), this._setupContainer(), this._setupPainter(), this.painter === void 0) throw new Error("Failed to initialize WebGL.");
              this.on("move", function() {
                return oe._update(false);
              }), this.on("moveend", function() {
                return oe._update(false);
              }), this.on("zoom", function() {
                return oe._update(true);
              }), i.window !== void 0 && (i.window.addEventListener("online", this._onWindowOnline, false), i.window.addEventListener("resize", this._onWindowResize, false)), this.handlers = new Ks(this, J2);
              var ye = typeof J2.hash == "string" && J2.hash || void 0;
              this._hash = J2.hash && new Vr(ye).addTo(this), this._hash && this._hash._onHashChange() || (this.jumpTo({ center: J2.center, zoom: J2.zoom, bearing: J2.bearing, pitch: J2.pitch }), J2.bounds && (this.resize(), this.fitBounds(J2.bounds, i.extend({}, J2.fitBoundsOptions, { duration: 0 })))), this.resize(), this._localIdeographFontFamily = J2.localIdeographFontFamily, J2.style && this.setStyle(J2.style, { localIdeographFontFamily: J2.localIdeographFontFamily }), J2.attributionControl && this.addControl(new Ys({ customAttribution: J2.customAttribution })), this.addControl(new Sf(), J2.logoPosition), this.on("style.load", function() {
                oe.transform.unmodified && oe.jumpTo(oe.style.stylesheet);
              }), this.on("data", function(Te) {
                oe._update(Te.dataType === "style"), oe.fire(new i.Event(Te.dataType + "data", Te));
              }), this.on("dataloading", function(Te) {
                oe.fire(new i.Event(Te.dataType + "dataloading", Te));
              });
            }
            P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2;
            var G2 = { showTileBoundaries: { configurable: true }, showPadding: { configurable: true }, showCollisionBoxes: { configurable: true }, showOverdrawInspector: { configurable: true }, repaint: { configurable: true }, vertices: { configurable: true }, version: { configurable: true } };
            return U2.prototype._getMapId = function() {
              return this._mapId;
            }, U2.prototype.addControl = function(J2, oe) {
              if (oe === void 0 && J2.getDefaultPosition && (oe = J2.getDefaultPosition()), oe === void 0 && (oe = "top-right"), !J2 || !J2.onAdd) return this.fire(new i.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));
              var de = J2.onAdd(this);
              this._controls.push(J2);
              var ye = this._controlPositions[oe];
              return oe.indexOf("bottom") !== -1 ? ye.insertBefore(de, ye.firstChild) : ye.appendChild(de), this;
            }, U2.prototype.removeControl = function(J2) {
              if (!J2 || !J2.onRemove) return this.fire(new i.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));
              var oe = this._controls.indexOf(J2);
              return oe > -1 && this._controls.splice(oe, 1), J2.onRemove(this), this;
            }, U2.prototype.resize = function(J2) {
              var oe = this._containerDimensions(), de = oe[0], ye = oe[1];
              this._resizeCanvas(de, ye), this.transform.resize(de, ye), this.painter.resize(de, ye);
              var Te = !this._moving;
              return Te && (this.stop(), this.fire(new i.Event("movestart", J2)).fire(new i.Event("move", J2))), this.fire(new i.Event("resize", J2)), Te && this.fire(new i.Event("moveend", J2)), this;
            }, U2.prototype.getBounds = function() {
              return this.transform.getBounds();
            }, U2.prototype.getMaxBounds = function() {
              return this.transform.getMaxBounds();
            }, U2.prototype.setMaxBounds = function(J2) {
              return this.transform.setMaxBounds(i.LngLatBounds.convert(J2)), this._update();
            }, U2.prototype.setMinZoom = function(J2) {
              if ((J2 = J2 ?? -2) >= -2 && J2 <= this.transform.maxZoom) return this.transform.minZoom = J2, this._update(), this.getZoom() < J2 && this.setZoom(J2), this;
              throw new Error("minZoom must be between -2 and the current maxZoom, inclusive");
            }, U2.prototype.getMinZoom = function() {
              return this.transform.minZoom;
            }, U2.prototype.setMaxZoom = function(J2) {
              if ((J2 = J2 ?? 22) >= this.transform.minZoom) return this.transform.maxZoom = J2, this._update(), this.getZoom() > J2 && this.setZoom(J2), this;
              throw new Error("maxZoom must be greater than the current minZoom");
            }, U2.prototype.getMaxZoom = function() {
              return this.transform.maxZoom;
            }, U2.prototype.setMinPitch = function(J2) {
              if ((J2 = J2 ?? 0) < 0) throw new Error("minPitch must be greater than or equal to 0");
              if (J2 >= 0 && J2 <= this.transform.maxPitch) return this.transform.minPitch = J2, this._update(), this.getPitch() < J2 && this.setPitch(J2), this;
              throw new Error("minPitch must be between 0 and the current maxPitch, inclusive");
            }, U2.prototype.getMinPitch = function() {
              return this.transform.minPitch;
            }, U2.prototype.setMaxPitch = function(J2) {
              if ((J2 = J2 ?? 60) > 60) throw new Error("maxPitch must be less than or equal to 60");
              if (J2 >= this.transform.minPitch) return this.transform.maxPitch = J2, this._update(), this.getPitch() > J2 && this.setPitch(J2), this;
              throw new Error("maxPitch must be greater than the current minPitch");
            }, U2.prototype.getMaxPitch = function() {
              return this.transform.maxPitch;
            }, U2.prototype.getRenderWorldCopies = function() {
              return this.transform.renderWorldCopies;
            }, U2.prototype.setRenderWorldCopies = function(J2) {
              return this.transform.renderWorldCopies = J2, this._update();
            }, U2.prototype.project = function(J2) {
              return this.transform.locationPoint(i.LngLat.convert(J2));
            }, U2.prototype.unproject = function(J2) {
              return this.transform.pointLocation(i.Point.convert(J2));
            }, U2.prototype.isMoving = function() {
              return this._moving || this.handlers.isMoving();
            }, U2.prototype.isZooming = function() {
              return this._zooming || this.handlers.isZooming();
            }, U2.prototype.isRotating = function() {
              return this._rotating || this.handlers.isRotating();
            }, U2.prototype._createDelegatedListener = function(J2, oe, de) {
              var ye, Te = this;
              if (J2 === "mouseenter" || J2 === "mouseover") {
                var Fe = false;
                return { layer: oe, listener: de, delegates: { mousemove: function(lt) {
                  var bt = Te.getLayer(oe) ? Te.queryRenderedFeatures(lt.point, { layers: [oe] }) : [];
                  bt.length ? Fe || (Fe = true, de.call(Te, new ca(J2, Te, lt.originalEvent, { features: bt }))) : Fe = false;
                }, mouseout: function() {
                  Fe = false;
                } } };
              }
              if (J2 === "mouseleave" || J2 === "mouseout") {
                var et = false;
                return { layer: oe, listener: de, delegates: { mousemove: function(lt) {
                  (Te.getLayer(oe) ? Te.queryRenderedFeatures(lt.point, { layers: [oe] }) : []).length ? et = true : et && (et = false, de.call(Te, new ca(J2, Te, lt.originalEvent)));
                }, mouseout: function(lt) {
                  et && (et = false, de.call(Te, new ca(J2, Te, lt.originalEvent)));
                } } };
              }
              return { layer: oe, listener: de, delegates: (ye = {}, ye[J2] = function(lt) {
                var bt = Te.getLayer(oe) ? Te.queryRenderedFeatures(lt.point, { layers: [oe] }) : [];
                bt.length && (lt.features = bt, de.call(Te, lt), delete lt.features);
              }, ye) };
            }, U2.prototype.on = function(J2, oe, de) {
              if (de === void 0) return P2.prototype.on.call(this, J2, oe);
              var ye = this._createDelegatedListener(J2, oe, de);
              for (var Te in this._delegatedListeners = this._delegatedListeners || {}, this._delegatedListeners[J2] = this._delegatedListeners[J2] || [], this._delegatedListeners[J2].push(ye), ye.delegates) this.on(Te, ye.delegates[Te]);
              return this;
            }, U2.prototype.once = function(J2, oe, de) {
              if (de === void 0) return P2.prototype.once.call(this, J2, oe);
              var ye = this._createDelegatedListener(J2, oe, de);
              for (var Te in ye.delegates) this.once(Te, ye.delegates[Te]);
              return this;
            }, U2.prototype.off = function(J2, oe, de) {
              var ye = this;
              return de === void 0 ? P2.prototype.off.call(this, J2, oe) : (this._delegatedListeners && this._delegatedListeners[J2] && function(Te) {
                for (var Fe = Te[J2], et = 0; et < Fe.length; et++) {
                  var lt = Fe[et];
                  if (lt.layer === oe && lt.listener === de) {
                    for (var bt in lt.delegates) ye.off(bt, lt.delegates[bt]);
                    return Fe.splice(et, 1), ye;
                  }
                }
              }(this._delegatedListeners), this);
            }, U2.prototype.queryRenderedFeatures = function(J2, oe) {
              if (!this.style) return [];
              var de;
              if (oe !== void 0 || J2 === void 0 || J2 instanceof i.Point || Array.isArray(J2) || (oe = J2, J2 = void 0), oe = oe || {}, (J2 = J2 || [[0, 0], [this.transform.width, this.transform.height]]) instanceof i.Point || typeof J2[0] == "number") de = [i.Point.convert(J2)];
              else {
                var ye = i.Point.convert(J2[0]), Te = i.Point.convert(J2[1]);
                de = [ye, new i.Point(Te.x, ye.y), Te, new i.Point(ye.x, Te.y), ye];
              }
              return this.style.queryRenderedFeatures(de, oe, this.transform);
            }, U2.prototype.querySourceFeatures = function(J2, oe) {
              return this.style.querySourceFeatures(J2, oe);
            }, U2.prototype.setStyle = function(J2, oe) {
              return (oe = i.extend({}, { localIdeographFontFamily: this._localIdeographFontFamily }, oe)).diff !== false && oe.localIdeographFontFamily === this._localIdeographFontFamily && this.style && J2 ? (this._diffStyle(J2, oe), this) : (this._localIdeographFontFamily = oe.localIdeographFontFamily, this._updateStyle(J2, oe));
            }, U2.prototype._getUIString = function(J2) {
              var oe = this._locale[J2];
              if (oe == null) throw new Error("Missing UI string '" + J2 + "'");
              return oe;
            }, U2.prototype._updateStyle = function(J2, oe) {
              return this.style && (this.style.setEventedParent(null), this.style._remove()), J2 ? (this.style = new ka(this, oe || {}), this.style.setEventedParent(this, { style: this.style }), typeof J2 == "string" ? this.style.loadURL(J2) : this.style.loadJSON(J2), this) : (delete this.style, this);
            }, U2.prototype._lazyInitEmptyStyle = function() {
              this.style || (this.style = new ka(this, {}), this.style.setEventedParent(this, { style: this.style }), this.style.loadEmpty());
            }, U2.prototype._diffStyle = function(J2, oe) {
              var de = this;
              if (typeof J2 == "string") {
                var ye = this._requestManager.normalizeStyleURL(J2), Te = this._requestManager.transformRequest(ye, i.ResourceType.Style);
                i.getJSON(Te, function(Fe, et) {
                  Fe ? de.fire(new i.ErrorEvent(Fe)) : et && de._updateDiff(et, oe);
                });
              } else typeof J2 == "object" && this._updateDiff(J2, oe);
            }, U2.prototype._updateDiff = function(J2, oe) {
              try {
                this.style.setState(J2) && this._update(true);
              } catch (de) {
                i.warnOnce("Unable to perform style diff: " + (de.message || de.error || de) + ".  Rebuilding the style from scratch."), this._updateStyle(J2, oe);
              }
            }, U2.prototype.getStyle = function() {
              if (this.style) return this.style.serialize();
            }, U2.prototype.isStyleLoaded = function() {
              return this.style ? this.style.loaded() : i.warnOnce("There is no style added to the map.");
            }, U2.prototype.addSource = function(J2, oe) {
              return this._lazyInitEmptyStyle(), this.style.addSource(J2, oe), this._update(true);
            }, U2.prototype.isSourceLoaded = function(J2) {
              var oe = this.style && this.style.sourceCaches[J2];
              if (oe !== void 0) return oe.loaded();
              this.fire(new i.ErrorEvent(new Error("There is no source with ID '" + J2 + "'")));
            }, U2.prototype.areTilesLoaded = function() {
              var J2 = this.style && this.style.sourceCaches;
              for (var oe in J2) {
                var de = J2[oe]._tiles;
                for (var ye in de) {
                  var Te = de[ye];
                  if (Te.state !== "loaded" && Te.state !== "errored") return false;
                }
              }
              return true;
            }, U2.prototype.addSourceType = function(J2, oe, de) {
              return this._lazyInitEmptyStyle(), this.style.addSourceType(J2, oe, de);
            }, U2.prototype.removeSource = function(J2) {
              return this.style.removeSource(J2), this._update(true);
            }, U2.prototype.getSource = function(J2) {
              return this.style.getSource(J2);
            }, U2.prototype.addImage = function(J2, oe, de) {
              de === void 0 && (de = {});
              var ye = de.pixelRatio;
              ye === void 0 && (ye = 1);
              var Te = de.sdf;
              Te === void 0 && (Te = false);
              var Fe = de.stretchX, et = de.stretchY, lt = de.content;
              if (this._lazyInitEmptyStyle(), oe instanceof Cd || Ef && oe instanceof Ef) {
                var bt = i.browser.getImageData(oe), It = bt.width, Rt = bt.height, Ft = bt.data;
                this.style.addImage(J2, { data: new i.RGBAImage({ width: It, height: Rt }, Ft), pixelRatio: ye, stretchX: Fe, stretchY: et, content: lt, sdf: Te, version: 0 });
              } else {
                if (oe.width === void 0 || oe.height === void 0) return this.fire(new i.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`")));
                var Pt = oe.width, Mt = oe.height, qt = oe.data, $t = oe;
                this.style.addImage(J2, { data: new i.RGBAImage({ width: Pt, height: Mt }, new Uint8Array(qt)), pixelRatio: ye, stretchX: Fe, stretchY: et, content: lt, sdf: Te, version: 0, userImage: $t }), $t.onAdd && $t.onAdd(this, J2);
              }
            }, U2.prototype.updateImage = function(J2, oe) {
              var de = this.style.getImage(J2);
              if (!de) return this.fire(new i.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));
              var ye = oe instanceof Cd || Ef && oe instanceof Ef ? i.browser.getImageData(oe) : oe, Te = ye.width, Fe = ye.height, et = ye.data;
              if (Te === void 0 || Fe === void 0) return this.fire(new i.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`")));
              if (Te !== de.data.width || Fe !== de.data.height) return this.fire(new i.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));
              var lt = !(oe instanceof Cd || Ef && oe instanceof Ef);
              de.data.replace(et, lt), this.style.updateImage(J2, de);
            }, U2.prototype.hasImage = function(J2) {
              return J2 ? !!this.style.getImage(J2) : (this.fire(new i.ErrorEvent(new Error("Missing required image id"))), false);
            }, U2.prototype.removeImage = function(J2) {
              this.style.removeImage(J2);
            }, U2.prototype.loadImage = function(J2, oe) {
              i.getImage(this._requestManager.transformRequest(J2, i.ResourceType.Image), oe);
            }, U2.prototype.listImages = function() {
              return this.style.listImages();
            }, U2.prototype.addLayer = function(J2, oe) {
              return this._lazyInitEmptyStyle(), this.style.addLayer(J2, oe), this._update(true);
            }, U2.prototype.moveLayer = function(J2, oe) {
              return this.style.moveLayer(J2, oe), this._update(true);
            }, U2.prototype.removeLayer = function(J2) {
              return this.style.removeLayer(J2), this._update(true);
            }, U2.prototype.getLayer = function(J2) {
              return this.style.getLayer(J2);
            }, U2.prototype.setLayerZoomRange = function(J2, oe, de) {
              return this.style.setLayerZoomRange(J2, oe, de), this._update(true);
            }, U2.prototype.setFilter = function(J2, oe, de) {
              return de === void 0 && (de = {}), this.style.setFilter(J2, oe, de), this._update(true);
            }, U2.prototype.getFilter = function(J2) {
              return this.style.getFilter(J2);
            }, U2.prototype.setPaintProperty = function(J2, oe, de, ye) {
              return ye === void 0 && (ye = {}), this.style.setPaintProperty(J2, oe, de, ye), this._update(true);
            }, U2.prototype.getPaintProperty = function(J2, oe) {
              return this.style.getPaintProperty(J2, oe);
            }, U2.prototype.setLayoutProperty = function(J2, oe, de, ye) {
              return ye === void 0 && (ye = {}), this.style.setLayoutProperty(J2, oe, de, ye), this._update(true);
            }, U2.prototype.getLayoutProperty = function(J2, oe) {
              return this.style.getLayoutProperty(J2, oe);
            }, U2.prototype.setLight = function(J2, oe) {
              return oe === void 0 && (oe = {}), this._lazyInitEmptyStyle(), this.style.setLight(J2, oe), this._update(true);
            }, U2.prototype.getLight = function() {
              return this.style.getLight();
            }, U2.prototype.setFeatureState = function(J2, oe) {
              return this.style.setFeatureState(J2, oe), this._update();
            }, U2.prototype.removeFeatureState = function(J2, oe) {
              return this.style.removeFeatureState(J2, oe), this._update();
            }, U2.prototype.getFeatureState = function(J2) {
              return this.style.getFeatureState(J2);
            }, U2.prototype.getContainer = function() {
              return this._container;
            }, U2.prototype.getCanvasContainer = function() {
              return this._canvasContainer;
            }, U2.prototype.getCanvas = function() {
              return this._canvas;
            }, U2.prototype._containerDimensions = function() {
              var J2 = 0, oe = 0;
              return this._container && (J2 = this._container.clientWidth || 400, oe = this._container.clientHeight || 300), [J2, oe];
            }, U2.prototype._detectMissingCSS = function() {
              i.window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color") !== "rgb(250, 128, 114)" && i.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/.");
            }, U2.prototype._setupContainer = function() {
              var J2 = this._container;
              J2.classList.add("mapboxgl-map"), (this._missingCSSCanary = u2.create("div", "mapboxgl-canary", J2)).style.visibility = "hidden", this._detectMissingCSS();
              var oe = this._canvasContainer = u2.create("div", "mapboxgl-canvas-container", J2);
              this._interactive && oe.classList.add("mapboxgl-interactive"), this._canvas = u2.create("canvas", "mapboxgl-canvas", oe), this._canvas.addEventListener("webglcontextlost", this._contextLost, false), this._canvas.addEventListener("webglcontextrestored", this._contextRestored, false), this._canvas.setAttribute("tabindex", "0"), this._canvas.setAttribute("aria-label", "Map");
              var de = this._containerDimensions();
              this._resizeCanvas(de[0], de[1]);
              var ye = this._controlContainer = u2.create("div", "mapboxgl-control-container", J2), Te = this._controlPositions = {};
              ["top-left", "top-right", "bottom-left", "bottom-right"].forEach(function(Fe) {
                Te[Fe] = u2.create("div", "mapboxgl-ctrl-" + Fe, ye);
              });
            }, U2.prototype._resizeCanvas = function(J2, oe) {
              var de = i.browser.devicePixelRatio || 1;
              this._canvas.width = de * J2, this._canvas.height = de * oe, this._canvas.style.width = J2 + "px", this._canvas.style.height = oe + "px";
            }, U2.prototype._setupPainter = function() {
              var J2 = i.extend({}, l.webGLContextAttributes, { failIfMajorPerformanceCaveat: this._failIfMajorPerformanceCaveat, preserveDrawingBuffer: this._preserveDrawingBuffer, antialias: this._antialias || false }), oe = this._canvas.getContext("webgl", J2) || this._canvas.getContext("experimental-webgl", J2);
              oe ? (this.painter = new qi(oe, this.transform), i.webpSupported.testSupport(oe)) : this.fire(new i.ErrorEvent(new Error("Failed to initialize WebGL")));
            }, U2.prototype._contextLost = function(J2) {
              J2.preventDefault(), this._frame && (this._frame.cancel(), this._frame = null), this.fire(new i.Event("webglcontextlost", { originalEvent: J2 }));
            }, U2.prototype._contextRestored = function(J2) {
              this._setupPainter(), this.resize(), this._update(), this.fire(new i.Event("webglcontextrestored", { originalEvent: J2 }));
            }, U2.prototype.loaded = function() {
              return !this._styleDirty && !this._sourcesDirty && !!this.style && this.style.loaded();
            }, U2.prototype._update = function(J2) {
              return this.style ? (this._styleDirty = this._styleDirty || J2, this._sourcesDirty = true, this.triggerRepaint(), this) : this;
            }, U2.prototype._requestRenderFrame = function(J2) {
              return this._update(), this._renderTaskQueue.add(J2);
            }, U2.prototype._cancelRenderFrame = function(J2) {
              this._renderTaskQueue.remove(J2);
            }, U2.prototype._render = function(J2) {
              var oe, de = this, ye = 0, Te = this.painter.context.extTimerQuery;
              if (this.listens("gpu-timing-frame") && (oe = Te.createQueryEXT(), Te.beginQueryEXT(Te.TIME_ELAPSED_EXT, oe), ye = i.browser.now()), this.painter.context.setDirty(), this.painter.setBaseState(), this._renderTaskQueue.run(J2), !this._removed) {
                var Fe = false;
                if (this.style && this._styleDirty) {
                  this._styleDirty = false;
                  var et = this.transform.zoom, lt = i.browser.now();
                  this.style.zoomHistory.update(et, lt);
                  var bt = new i.EvaluationParameters(et, { now: lt, fadeDuration: this._fadeDuration, zoomHistory: this.style.zoomHistory, transition: this.style.getTransition() }), It = bt.crossFadingFactor();
                  It === 1 && It === this._crossFadingFactor || (Fe = true, this._crossFadingFactor = It), this.style.update(bt);
                }
                if (this.style && this._sourcesDirty && (this._sourcesDirty = false, this.style._updateSources(this.transform)), this._placementDirty = this.style && this.style._updatePlacement(this.painter.transform, this.showCollisionBoxes, this._fadeDuration, this._crossSourceCollisions), this.painter.render(this.style, { showTileBoundaries: this.showTileBoundaries, showOverdrawInspector: this._showOverdrawInspector, rotating: this.isRotating(), zooming: this.isZooming(), moving: this.isMoving(), fadeDuration: this._fadeDuration, showPadding: this.showPadding, gpuTiming: !!this.listens("gpu-timing-layer") }), this.fire(new i.Event("render")), this.loaded() && !this._loaded && (this._loaded = true, this.fire(new i.Event("load"))), this.style && (this.style.hasTransitions() || Fe) && (this._styleDirty = true), this.style && !this._placementDirty && this.style._releaseSymbolFadeTiles(), this.listens("gpu-timing-frame")) {
                  var Rt = i.browser.now() - ye;
                  Te.endQueryEXT(Te.TIME_ELAPSED_EXT, oe), setTimeout(function() {
                    var Pt = Te.getQueryObjectEXT(oe, Te.QUERY_RESULT_EXT) / 1e6;
                    Te.deleteQueryEXT(oe), de.fire(new i.Event("gpu-timing-frame", { cpuTime: Rt, gpuTime: Pt }));
                  }, 50);
                }
                if (this.listens("gpu-timing-layer")) {
                  var Ft = this.painter.collectGpuTimers();
                  setTimeout(function() {
                    var Pt = de.painter.queryGpuTimers(Ft);
                    de.fire(new i.Event("gpu-timing-layer", { layerTimes: Pt }));
                  }, 50);
                }
                return this._sourcesDirty || this._styleDirty || this._placementDirty || this._repaint ? this.triggerRepaint() : !this.isMoving() && this.loaded() && (this._fullyLoaded || (this._fullyLoaded = true), this.fire(new i.Event("idle"))), this;
              }
            }, U2.prototype.remove = function() {
              this._hash && this._hash.remove();
              for (var J2 = 0, oe = this._controls; J2 < oe.length; J2 += 1) oe[J2].onRemove(this);
              this._controls = [], this._frame && (this._frame.cancel(), this._frame = null), this._renderTaskQueue.clear(), this.painter.destroy(), this.handlers.destroy(), delete this.handlers, this.setStyle(null), i.window !== void 0 && (i.window.removeEventListener("resize", this._onWindowResize, false), i.window.removeEventListener("online", this._onWindowOnline, false));
              var de = this.painter.context.gl.getExtension("WEBGL_lose_context");
              de && de.loseContext(), Z0(this._canvasContainer), Z0(this._controlContainer), Z0(this._missingCSSCanary), this._container.classList.remove("mapboxgl-map"), this._removed = true, this.fire(new i.Event("remove"));
            }, U2.prototype.triggerRepaint = function() {
              var J2 = this;
              this.style && !this._frame && (this._frame = i.browser.frame(function(oe) {
                J2._frame = null, J2._render(oe);
              }));
            }, U2.prototype._onWindowOnline = function() {
              this._update();
            }, U2.prototype._onWindowResize = function(J2) {
              this._trackResize && this.resize({ originalEvent: J2 })._update();
            }, G2.showTileBoundaries.get = function() {
              return !!this._showTileBoundaries;
            }, G2.showTileBoundaries.set = function(J2) {
              this._showTileBoundaries !== J2 && (this._showTileBoundaries = J2, this._update());
            }, G2.showPadding.get = function() {
              return !!this._showPadding;
            }, G2.showPadding.set = function(J2) {
              this._showPadding !== J2 && (this._showPadding = J2, this._update());
            }, G2.showCollisionBoxes.get = function() {
              return !!this._showCollisionBoxes;
            }, G2.showCollisionBoxes.set = function(J2) {
              this._showCollisionBoxes !== J2 && (this._showCollisionBoxes = J2, J2 ? this.style._generateCollisionBoxes() : this._update());
            }, G2.showOverdrawInspector.get = function() {
              return !!this._showOverdrawInspector;
            }, G2.showOverdrawInspector.set = function(J2) {
              this._showOverdrawInspector !== J2 && (this._showOverdrawInspector = J2, this._update());
            }, G2.repaint.get = function() {
              return !!this._repaint;
            }, G2.repaint.set = function(J2) {
              this._repaint !== J2 && (this._repaint = J2, this.triggerRepaint());
            }, G2.vertices.get = function() {
              return !!this._vertices;
            }, G2.vertices.set = function(J2) {
              this._vertices = J2, this._update();
            }, U2.prototype._setCacheLimits = function(J2, oe) {
              i.setCacheLimits(J2, oe);
            }, G2.version.get = function() {
              return i.version;
            }, Object.defineProperties(U2.prototype, G2), U2;
          }(Dd);
          function Z0(P2) {
            P2.parentNode && P2.parentNode.removeChild(P2);
          }
          var Lp = { showCompass: true, showZoom: true, visualizePitch: false }, yo = function(P2) {
            var U2 = this;
            this.options = i.extend({}, Lp, P2), this._container = u2.create("div", "mapboxgl-ctrl mapboxgl-ctrl-group"), this._container.addEventListener("contextmenu", function(G2) {
              return G2.preventDefault();
            }), this.options.showZoom && (i.bindAll(["_setButtonTitle", "_updateZoomButtons"], this), this._zoomInButton = this._createButton("mapboxgl-ctrl-zoom-in", function(G2) {
              return U2._map.zoomIn({}, { originalEvent: G2 });
            }), u2.create("span", "mapboxgl-ctrl-icon", this._zoomInButton).setAttribute("aria-hidden", true), this._zoomOutButton = this._createButton("mapboxgl-ctrl-zoom-out", function(G2) {
              return U2._map.zoomOut({}, { originalEvent: G2 });
            }), u2.create("span", "mapboxgl-ctrl-icon", this._zoomOutButton).setAttribute("aria-hidden", true)), this.options.showCompass && (i.bindAll(["_rotateCompassArrow"], this), this._compass = this._createButton("mapboxgl-ctrl-compass", function(G2) {
              U2.options.visualizePitch ? U2._map.resetNorthPitch({}, { originalEvent: G2 }) : U2._map.resetNorth({}, { originalEvent: G2 });
            }), this._compassIcon = u2.create("span", "mapboxgl-ctrl-icon", this._compass), this._compassIcon.setAttribute("aria-hidden", true));
          };
          yo.prototype._updateZoomButtons = function() {
            var P2 = this._map.getZoom();
            this._zoomInButton.disabled = P2 === this._map.getMaxZoom(), this._zoomOutButton.disabled = P2 === this._map.getMinZoom();
          }, yo.prototype._rotateCompassArrow = function() {
            var P2 = 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)";
            this._compassIcon.style.transform = P2;
          }, yo.prototype.onAdd = function(P2) {
            return this._map = P2, 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 Po(this._map, this._compass, this.options.visualizePitch)), this._container;
          }, yo.prototype.onRemove = function() {
            u2.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;
          }, yo.prototype._createButton = function(P2, U2) {
            var G2 = u2.create("button", P2, this._container);
            return G2.type = "button", G2.addEventListener("click", U2), G2;
          }, yo.prototype._setButtonTitle = function(P2, U2) {
            var G2 = this._map._getUIString("NavigationControl." + U2);
            P2.title = G2, P2.setAttribute("aria-label", G2);
          };
          var Po = function(P2, U2, G2) {
            G2 === void 0 && (G2 = false), this._clickTolerance = 10, this.element = U2, this.mouseRotate = new Bi({ clickTolerance: P2.dragRotate._mouseRotate._clickTolerance }), this.map = P2, G2 && (this.mousePitch = new li({ clickTolerance: P2.dragRotate._mousePitch._clickTolerance })), i.bindAll(["mousedown", "mousemove", "mouseup", "touchstart", "touchmove", "touchend", "reset"], this), u2.addEventListener(U2, "mousedown", this.mousedown), u2.addEventListener(U2, "touchstart", this.touchstart, { passive: false }), u2.addEventListener(U2, "touchmove", this.touchmove), u2.addEventListener(U2, "touchend", this.touchend), u2.addEventListener(U2, "touchcancel", this.reset);
          };
          function wh(P2, U2, G2) {
            if (P2 = new i.LngLat(P2.lng, P2.lat), U2) {
              var J2 = new i.LngLat(P2.lng - 360, P2.lat), oe = new i.LngLat(P2.lng + 360, P2.lat), de = G2.locationPoint(P2).distSqr(U2);
              G2.locationPoint(J2).distSqr(U2) < de ? P2 = J2 : G2.locationPoint(oe).distSqr(U2) < de && (P2 = oe);
            }
            for (; Math.abs(P2.lng - G2.center.lng) > 180; ) {
              var ye = G2.locationPoint(P2);
              if (ye.x >= 0 && ye.y >= 0 && ye.x <= G2.width && ye.y <= G2.height) break;
              P2.lng > G2.center.lng ? P2.lng -= 360 : P2.lng += 360;
            }
            return P2;
          }
          Po.prototype.down = function(P2, U2) {
            this.mouseRotate.mousedown(P2, U2), this.mousePitch && this.mousePitch.mousedown(P2, U2), u2.disableDrag();
          }, Po.prototype.move = function(P2, U2) {
            var G2 = this.map, J2 = this.mouseRotate.mousemoveWindow(P2, U2);
            if (J2 && J2.bearingDelta && G2.setBearing(G2.getBearing() + J2.bearingDelta), this.mousePitch) {
              var oe = this.mousePitch.mousemoveWindow(P2, U2);
              oe && oe.pitchDelta && G2.setPitch(G2.getPitch() + oe.pitchDelta);
            }
          }, Po.prototype.off = function() {
            var P2 = this.element;
            u2.removeEventListener(P2, "mousedown", this.mousedown), u2.removeEventListener(P2, "touchstart", this.touchstart, { passive: false }), u2.removeEventListener(P2, "touchmove", this.touchmove), u2.removeEventListener(P2, "touchend", this.touchend), u2.removeEventListener(P2, "touchcancel", this.reset), this.offTemp();
          }, Po.prototype.offTemp = function() {
            u2.enableDrag(), u2.removeEventListener(i.window, "mousemove", this.mousemove), u2.removeEventListener(i.window, "mouseup", this.mouseup);
          }, Po.prototype.mousedown = function(P2) {
            this.down(i.extend({}, P2, { ctrlKey: true, preventDefault: function() {
              return P2.preventDefault();
            } }), u2.mousePos(this.element, P2)), u2.addEventListener(i.window, "mousemove", this.mousemove), u2.addEventListener(i.window, "mouseup", this.mouseup);
          }, Po.prototype.mousemove = function(P2) {
            this.move(P2, u2.mousePos(this.element, P2));
          }, Po.prototype.mouseup = function(P2) {
            this.mouseRotate.mouseupWindow(P2), this.mousePitch && this.mousePitch.mouseupWindow(P2), this.offTemp();
          }, Po.prototype.touchstart = function(P2) {
            P2.targetTouches.length !== 1 ? this.reset() : (this._startPos = this._lastPos = u2.touchPos(this.element, P2.targetTouches)[0], this.down({ type: "mousedown", button: 0, ctrlKey: true, preventDefault: function() {
              return P2.preventDefault();
            } }, this._startPos));
          }, Po.prototype.touchmove = function(P2) {
            P2.targetTouches.length !== 1 ? this.reset() : (this._lastPos = u2.touchPos(this.element, P2.targetTouches)[0], this.move({ preventDefault: function() {
              return P2.preventDefault();
            } }, this._lastPos));
          }, Po.prototype.touchend = function(P2) {
            P2.targetTouches.length === 0 && this._startPos && this._lastPos && this._startPos.dist(this._lastPos) < this._clickTolerance && this.element.click(), this.reset();
          }, Po.prototype.reset = function() {
            this.mouseRotate.reset(), this.mousePitch && this.mousePitch.reset(), delete this._startPos, delete this._lastPos, this.offTemp();
          };
          var Xf = { 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%)" };
          function Vs(P2, U2, G2) {
            var J2 = P2.classList;
            for (var oe in Xf) J2.remove("mapboxgl-" + G2 + "-anchor-" + oe);
            J2.add("mapboxgl-" + G2 + "-anchor-" + U2);
          }
          var kh, Rp = function(P2) {
            function U2(G2, J2) {
              var oe = this;
              if (P2.call(this), (G2 instanceof i.window.HTMLElement || J2) && (G2 = i.extend({ element: G2 }, J2)), i.bindAll(["_update", "_onMove", "_onUp", "_addDragHandler", "_onMapClick", "_onKeyPress"], this), this._anchor = G2 && G2.anchor || "center", this._color = G2 && G2.color || "#3FB1CE", this._draggable = G2 && G2.draggable || false, this._state = "inactive", this._rotation = G2 && G2.rotation || 0, this._rotationAlignment = G2 && G2.rotationAlignment || "auto", this._pitchAlignment = G2 && G2.pitchAlignment && G2.pitchAlignment !== "auto" ? G2.pitchAlignment : this._rotationAlignment, G2 && G2.element) this._element = G2.element, this._offset = i.Point.convert(G2 && G2.offset || [0, 0]);
              else {
                this._defaultMarker = true, this._element = u2.create("div"), this._element.setAttribute("aria-label", "Map marker");
                var de = u2.createNS("http://www.w3.org/2000/svg", "svg");
                de.setAttributeNS(null, "display", "block"), de.setAttributeNS(null, "height", "41px"), de.setAttributeNS(null, "width", "27px"), de.setAttributeNS(null, "viewBox", "0 0 27 41");
                var ye = u2.createNS("http://www.w3.org/2000/svg", "g");
                ye.setAttributeNS(null, "stroke", "none"), ye.setAttributeNS(null, "stroke-width", "1"), ye.setAttributeNS(null, "fill", "none"), ye.setAttributeNS(null, "fill-rule", "evenodd");
                var Te = u2.createNS("http://www.w3.org/2000/svg", "g");
                Te.setAttributeNS(null, "fill-rule", "nonzero");
                var Fe = u2.createNS("http://www.w3.org/2000/svg", "g");
                Fe.setAttributeNS(null, "transform", "translate(3.0, 29.0)"), Fe.setAttributeNS(null, "fill", "#000000");
                for (var et = 0, lt = [{ 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" }]; et < lt.length; et += 1) {
                  var bt = lt[et], It = u2.createNS("http://www.w3.org/2000/svg", "ellipse");
                  It.setAttributeNS(null, "opacity", "0.04"), It.setAttributeNS(null, "cx", "10.5"), It.setAttributeNS(null, "cy", "5.80029008"), It.setAttributeNS(null, "rx", bt.rx), It.setAttributeNS(null, "ry", bt.ry), Fe.appendChild(It);
                }
                var Rt = u2.createNS("http://www.w3.org/2000/svg", "g");
                Rt.setAttributeNS(null, "fill", this._color);
                var Ft = u2.createNS("http://www.w3.org/2000/svg", "path");
                Ft.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"), Rt.appendChild(Ft);
                var Pt = u2.createNS("http://www.w3.org/2000/svg", "g");
                Pt.setAttributeNS(null, "opacity", "0.25"), Pt.setAttributeNS(null, "fill", "#000000");
                var Mt = u2.createNS("http://www.w3.org/2000/svg", "path");
                Mt.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"), Pt.appendChild(Mt);
                var qt = u2.createNS("http://www.w3.org/2000/svg", "g");
                qt.setAttributeNS(null, "transform", "translate(6.0, 7.0)"), qt.setAttributeNS(null, "fill", "#FFFFFF");
                var $t = u2.createNS("http://www.w3.org/2000/svg", "g");
                $t.setAttributeNS(null, "transform", "translate(8.0, 8.0)");
                var Yt = u2.createNS("http://www.w3.org/2000/svg", "circle");
                Yt.setAttributeNS(null, "fill", "#000000"), Yt.setAttributeNS(null, "opacity", "0.25"), Yt.setAttributeNS(null, "cx", "5.5"), Yt.setAttributeNS(null, "cy", "5.5"), Yt.setAttributeNS(null, "r", "5.4999962");
                var cr = u2.createNS("http://www.w3.org/2000/svg", "circle");
                cr.setAttributeNS(null, "fill", "#FFFFFF"), cr.setAttributeNS(null, "cx", "5.5"), cr.setAttributeNS(null, "cy", "5.5"), cr.setAttributeNS(null, "r", "5.4999962"), $t.appendChild(Yt), $t.appendChild(cr), Te.appendChild(Fe), Te.appendChild(Rt), Te.appendChild(Pt), Te.appendChild(qt), Te.appendChild($t), de.appendChild(Te), this._element.appendChild(de), this._offset = i.Point.convert(G2 && G2.offset || [0, -14]);
              }
              this._element.classList.add("mapboxgl-marker"), this._element.addEventListener("dragstart", function(kr) {
                kr.preventDefault();
              }), this._element.addEventListener("mousedown", function(kr) {
                kr.preventDefault();
              }), this._element.addEventListener("focus", function() {
                var kr = oe._map.getContainer();
                kr.scrollTop = 0, kr.scrollLeft = 0;
              }), Vs(this._element, this._anchor, "marker"), this._popup = null;
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.addTo = function(G2) {
              return this.remove(), this._map = G2, G2.getCanvasContainer().appendChild(this._element), G2.on("move", this._update), G2.on("moveend", this._update), this.setDraggable(this._draggable), this._update(), this._map.on("click", this._onMapClick), this;
            }, U2.prototype.remove = function() {
              return this._map && (this._map.off("click", this._onMapClick), this._map.off("move", this._update), this._map.off("moveend", 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), u2.remove(this._element), this._popup && this._popup.remove(), this;
            }, U2.prototype.getLngLat = function() {
              return this._lngLat;
            }, U2.prototype.setLngLat = function(G2) {
              return this._lngLat = i.LngLat.convert(G2), this._pos = null, this._popup && this._popup.setLngLat(this._lngLat), this._update(), this;
            }, U2.prototype.getElement = function() {
              return this._element;
            }, U2.prototype.setPopup = function(G2) {
              if (this._popup && (this._popup.remove(), this._popup = null, this._element.removeEventListener("keypress", this._onKeyPress), this._originalTabIndex || this._element.removeAttribute("tabindex")), G2) {
                if (!("offset" in G2.options)) {
                  var J2 = Math.sqrt(Math.pow(13.5, 2) / 2);
                  G2.options.offset = this._defaultMarker ? { top: [0, 0], "top-left": [0, 0], "top-right": [0, 0], bottom: [0, -38.1], "bottom-left": [J2, -1 * (24.6 + J2)], "bottom-right": [-J2, -1 * (24.6 + J2)], left: [13.5, -24.6], right: [-13.5, -24.6] } : this._offset;
                }
                this._popup = G2, this._lngLat && this._popup.setLngLat(this._lngLat), this._originalTabIndex = this._element.getAttribute("tabindex"), this._originalTabIndex || this._element.setAttribute("tabindex", "0"), this._element.addEventListener("keypress", this._onKeyPress);
              }
              return this;
            }, U2.prototype._onKeyPress = function(G2) {
              var J2 = G2.code, oe = G2.charCode || G2.keyCode;
              J2 !== "Space" && J2 !== "Enter" && oe !== 32 && oe !== 13 || this.togglePopup();
            }, U2.prototype._onMapClick = function(G2) {
              var J2 = G2.originalEvent.target, oe = this._element;
              this._popup && (J2 === oe || oe.contains(J2)) && this.togglePopup();
            }, U2.prototype.getPopup = function() {
              return this._popup;
            }, U2.prototype.togglePopup = function() {
              var G2 = this._popup;
              return G2 ? (G2.isOpen() ? G2.remove() : G2.addTo(this._map), this) : this;
            }, U2.prototype._update = function(G2) {
              if (this._map) {
                this._map.transform.renderWorldCopies && (this._lngLat = wh(this._lngLat, this._pos, this._map.transform)), this._pos = this._map.project(this._lngLat)._add(this._offset);
                var J2 = "";
                this._rotationAlignment === "viewport" || this._rotationAlignment === "auto" ? J2 = "rotateZ(" + this._rotation + "deg)" : this._rotationAlignment === "map" && (J2 = "rotateZ(" + (this._rotation - this._map.getBearing()) + "deg)");
                var oe = "";
                this._pitchAlignment === "viewport" || this._pitchAlignment === "auto" ? oe = "rotateX(0deg)" : this._pitchAlignment === "map" && (oe = "rotateX(" + this._map.getPitch() + "deg)"), G2 && G2.type !== "moveend" || (this._pos = this._pos.round()), u2.setTransform(this._element, Xf[this._anchor] + " translate(" + this._pos.x + "px, " + this._pos.y + "px) " + oe + " " + J2);
              }
            }, U2.prototype.getOffset = function() {
              return this._offset;
            }, U2.prototype.setOffset = function(G2) {
              return this._offset = i.Point.convert(G2), this._update(), this;
            }, U2.prototype._onMove = function(G2) {
              this._pos = G2.point.sub(this._positionDelta), this._lngLat = this._map.unproject(this._pos), this.setLngLat(this._lngLat), this._element.style.pointerEvents = "none", this._state === "pending" && (this._state = "active", this.fire(new i.Event("dragstart"))), this.fire(new i.Event("drag"));
            }, U2.prototype._onUp = function() {
              this._element.style.pointerEvents = "auto", this._positionDelta = null, this._map.off("mousemove", this._onMove), this._map.off("touchmove", this._onMove), this._state === "active" && this.fire(new i.Event("dragend")), this._state = "inactive";
            }, U2.prototype._addDragHandler = function(G2) {
              this._element.contains(G2.originalEvent.target) && (G2.preventDefault(), this._positionDelta = G2.point.sub(this._pos).add(this._offset), 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));
            }, U2.prototype.setDraggable = function(G2) {
              return this._draggable = !!G2, this._map && (G2 ? (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;
            }, U2.prototype.isDraggable = function() {
              return this._draggable;
            }, U2.prototype.setRotation = function(G2) {
              return this._rotation = G2 || 0, this._update(), this;
            }, U2.prototype.getRotation = function() {
              return this._rotation;
            }, U2.prototype.setRotationAlignment = function(G2) {
              return this._rotationAlignment = G2 || "auto", this._update(), this;
            }, U2.prototype.getRotationAlignment = function() {
              return this._rotationAlignment;
            }, U2.prototype.setPitchAlignment = function(G2) {
              return this._pitchAlignment = G2 && G2 !== "auto" ? G2 : this._rotationAlignment, this._update(), this;
            }, U2.prototype.getPitchAlignment = function() {
              return this._pitchAlignment;
            }, U2;
          }(i.Evented), Zh = { positionOptions: { enableHighAccuracy: false, maximumAge: 0, timeout: 6e3 }, fitBoundsOptions: { maxZoom: 15 }, trackUserLocation: false, showAccuracyCircle: true, showUserLocation: true }, zp = 0, Kf = false, J0 = function(P2) {
            function U2(G2) {
              P2.call(this), this.options = i.extend({}, Zh, G2), i.bindAll(["_onSuccess", "_onError", "_onZoom", "_finish", "_setupUI", "_updateCamera", "_updateMarker"], this);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.onAdd = function(G2) {
              var J2;
              return this._map = G2, this._container = u2.create("div", "mapboxgl-ctrl mapboxgl-ctrl-group"), J2 = this._setupUI, kh !== void 0 ? J2(kh) : i.window.navigator.permissions !== void 0 ? i.window.navigator.permissions.query({ name: "geolocation" }).then(function(oe) {
                kh = oe.state !== "denied", J2(kh);
              }) : (kh = !!i.window.navigator.geolocation, J2(kh)), this._container;
            }, U2.prototype.onRemove = function() {
              this._geolocationWatchID !== void 0 && (i.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(), u2.remove(this._container), this._map.off("zoom", this._onZoom), this._map = void 0, zp = 0, Kf = false;
            }, U2.prototype._isOutOfMapMaxBounds = function(G2) {
              var J2 = this._map.getMaxBounds(), oe = G2.coords;
              return J2 && (oe.longitude < J2.getWest() || oe.longitude > J2.getEast() || oe.latitude < J2.getSouth() || oe.latitude > J2.getNorth());
            }, U2.prototype._setErrorState = function() {
              switch (this._watchState) {
                case "WAITING_ACTIVE":
                  this._watchState = "ACTIVE_ERROR", this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"), this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");
                  break;
                case "ACTIVE_LOCK":
                  this._watchState = "ACTIVE_ERROR", this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"), this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"), this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");
                  break;
                case "BACKGROUND":
                  this._watchState = "BACKGROUND_ERROR", this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"), this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"), this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");
              }
            }, U2.prototype._onSuccess = function(G2) {
              if (this._map) {
                if (this._isOutOfMapMaxBounds(G2)) return this._setErrorState(), this.fire(new i.Event("outofmaxbounds", G2)), this._updateMarker(), void this._finish();
                if (this.options.trackUserLocation) switch (this._lastKnownPosition = G2, this._watchState) {
                  case "WAITING_ACTIVE":
                  case "ACTIVE_LOCK":
                  case "ACTIVE_ERROR":
                    this._watchState = "ACTIVE_LOCK", this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"), this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"), this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");
                    break;
                  case "BACKGROUND":
                  case "BACKGROUND_ERROR":
                    this._watchState = "BACKGROUND", this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"), this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"), this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");
                }
                this.options.showUserLocation && this._watchState !== "OFF" && this._updateMarker(G2), this.options.trackUserLocation && this._watchState !== "ACTIVE_LOCK" || this._updateCamera(G2), this.options.showUserLocation && this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"), this.fire(new i.Event("geolocate", G2)), this._finish();
              }
            }, U2.prototype._updateCamera = function(G2) {
              var J2 = new i.LngLat(G2.coords.longitude, G2.coords.latitude), oe = G2.coords.accuracy, de = this._map.getBearing(), ye = i.extend({ bearing: de }, this.options.fitBoundsOptions);
              this._map.fitBounds(J2.toBounds(oe), ye, { geolocateSource: true });
            }, U2.prototype._updateMarker = function(G2) {
              if (G2) {
                var J2 = new i.LngLat(G2.coords.longitude, G2.coords.latitude);
                this._accuracyCircleMarker.setLngLat(J2).addTo(this._map), this._userLocationDotMarker.setLngLat(J2).addTo(this._map), this._accuracy = G2.coords.accuracy, this.options.showUserLocation && this.options.showAccuracyCircle && this._updateCircleRadius();
              } else this._userLocationDotMarker.remove(), this._accuracyCircleMarker.remove();
            }, U2.prototype._updateCircleRadius = function() {
              var G2 = this._map._container.clientHeight / 2, J2 = this._map.unproject([0, G2]), oe = this._map.unproject([1, G2]), de = J2.distanceTo(oe), ye = Math.ceil(2 * this._accuracy / de);
              this._circleElement.style.width = ye + "px", this._circleElement.style.height = ye + "px";
            }, U2.prototype._onZoom = function() {
              this.options.showUserLocation && this.options.showAccuracyCircle && this._updateCircleRadius();
            }, U2.prototype._onError = function(G2) {
              if (this._map) {
                if (this.options.trackUserLocation) if (G2.code === 1) {
                  this._watchState = "OFF", this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"), this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"), this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"), this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"), this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"), this._geolocateButton.disabled = true;
                  var J2 = this._map._getUIString("GeolocateControl.LocationNotAvailable");
                  this._geolocateButton.title = J2, this._geolocateButton.setAttribute("aria-label", J2), this._geolocationWatchID !== void 0 && this._clearWatch();
                } else {
                  if (G2.code === 3 && Kf) return;
                  this._setErrorState();
                }
                this._watchState !== "OFF" && this.options.showUserLocation && this._dotElement.classList.add("mapboxgl-user-location-dot-stale"), this.fire(new i.Event("error", G2)), this._finish();
              }
            }, U2.prototype._finish = function() {
              this._timeoutId && clearTimeout(this._timeoutId), this._timeoutId = void 0;
            }, U2.prototype._setupUI = function(G2) {
              var J2 = this;
              if (this._container.addEventListener("contextmenu", function(ye) {
                return ye.preventDefault();
              }), this._geolocateButton = u2.create("button", "mapboxgl-ctrl-geolocate", this._container), u2.create("span", "mapboxgl-ctrl-icon", this._geolocateButton).setAttribute("aria-hidden", true), this._geolocateButton.type = "button", G2 === false) {
                i.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");
                var oe = this._map._getUIString("GeolocateControl.LocationNotAvailable");
                this._geolocateButton.disabled = true, this._geolocateButton.title = oe, this._geolocateButton.setAttribute("aria-label", oe);
              } else {
                var de = this._map._getUIString("GeolocateControl.FindMyLocation");
                this._geolocateButton.title = de, this._geolocateButton.setAttribute("aria-label", de);
              }
              this.options.trackUserLocation && (this._geolocateButton.setAttribute("aria-pressed", "false"), this._watchState = "OFF"), this.options.showUserLocation && (this._dotElement = u2.create("div", "mapboxgl-user-location-dot"), this._userLocationDotMarker = new Rp(this._dotElement), this._circleElement = u2.create("div", "mapboxgl-user-location-accuracy-circle"), this._accuracyCircleMarker = new Rp({ element: this._circleElement, pitchAlignment: "map" }), this.options.trackUserLocation && (this._watchState = "OFF"), this._map.on("zoom", this._onZoom)), this._geolocateButton.addEventListener("click", this.trigger.bind(this)), this._setup = true, this.options.trackUserLocation && this._map.on("movestart", function(ye) {
                var Te = ye.originalEvent && ye.originalEvent.type === "resize";
                ye.geolocateSource || J2._watchState !== "ACTIVE_LOCK" || Te || (J2._watchState = "BACKGROUND", J2._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"), J2._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"), J2.fire(new i.Event("trackuserlocationend")));
              });
            }, U2.prototype.trigger = function() {
              if (!this._setup) return i.warnOnce("Geolocate control triggered before added to a map"), false;
              if (this.options.trackUserLocation) {
                switch (this._watchState) {
                  case "OFF":
                    this._watchState = "WAITING_ACTIVE", this.fire(new i.Event("trackuserlocationstart"));
                    break;
                  case "WAITING_ACTIVE":
                  case "ACTIVE_LOCK":
                  case "ACTIVE_ERROR":
                  case "BACKGROUND_ERROR":
                    zp--, Kf = false, this._watchState = "OFF", this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"), this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"), this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"), this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"), this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"), this.fire(new i.Event("trackuserlocationend"));
                    break;
                  case "BACKGROUND":
                    this._watchState = "ACTIVE_LOCK", this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"), this._lastKnownPosition && this._updateCamera(this._lastKnownPosition), this.fire(new i.Event("trackuserlocationstart"));
                }
                switch (this._watchState) {
                  case "WAITING_ACTIVE":
                    this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"), this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");
                    break;
                  case "ACTIVE_LOCK":
                    this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");
                    break;
                  case "ACTIVE_ERROR":
                    this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"), this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");
                    break;
                  case "BACKGROUND":
                    this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");
                    break;
                  case "BACKGROUND_ERROR":
                    this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"), this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error");
                }
                if (this._watchState === "OFF" && this._geolocationWatchID !== void 0) this._clearWatch();
                else if (this._geolocationWatchID === void 0) {
                  var G2;
                  this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"), this._geolocateButton.setAttribute("aria-pressed", "true"), ++zp > 1 ? (G2 = { maximumAge: 6e5, timeout: 0 }, Kf = true) : (G2 = this.options.positionOptions, Kf = false), this._geolocationWatchID = i.window.navigator.geolocation.watchPosition(this._onSuccess, this._onError, G2);
                }
              } else i.window.navigator.geolocation.getCurrentPosition(this._onSuccess, this._onError, this.options.positionOptions), this._timeoutId = setTimeout(this._finish, 1e4);
              return true;
            }, U2.prototype._clearWatch = function() {
              i.window.navigator.geolocation.clearWatch(this._geolocationWatchID), this._geolocationWatchID = void 0, this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"), this._geolocateButton.setAttribute("aria-pressed", "false"), this.options.showUserLocation && this._updateMarker(null);
            }, U2;
          }(i.Evented), cm = { maxWidth: 100, unit: "metric" }, Th = function(P2) {
            this.options = i.extend({}, cm, P2), i.bindAll(["_onMove", "setUnit"], this);
          };
          function Q0(P2, U2, G2) {
            var J2 = G2 && G2.maxWidth || 100, oe = P2._container.clientHeight / 2, de = P2.unproject([0, oe]), ye = P2.unproject([J2, oe]), Te = de.distanceTo(ye);
            if (G2 && G2.unit === "imperial") {
              var Fe = 3.2808 * Te;
              Fe > 5280 ? Bp(U2, J2, Fe / 5280, P2._getUIString("ScaleControl.Miles")) : Bp(U2, J2, Fe, P2._getUIString("ScaleControl.Feet"));
            } else G2 && G2.unit === "nautical" ? Bp(U2, J2, Te / 1852, P2._getUIString("ScaleControl.NauticalMiles")) : Te >= 1e3 ? Bp(U2, J2, Te / 1e3, P2._getUIString("ScaleControl.Kilometers")) : Bp(U2, J2, Te, P2._getUIString("ScaleControl.Meters"));
          }
          function Bp(P2, U2, G2, J2) {
            var oe, de, ye, Te = (oe = G2, de = Math.pow(10, ("" + Math.floor(oe)).length - 1), ye = (ye = oe / de) >= 10 ? 10 : ye >= 5 ? 5 : ye >= 3 ? 3 : ye >= 2 ? 2 : ye >= 1 ? 1 : function(et) {
              var lt = Math.pow(10, Math.ceil(-Math.log(et) / Math.LN10));
              return Math.round(et * lt) / lt;
            }(ye), de * ye), Fe = Te / G2;
            P2.style.width = U2 * Fe + "px", P2.innerHTML = Te + "&nbsp;" + J2;
          }
          Th.prototype.getDefaultPosition = function() {
            return "bottom-left";
          }, Th.prototype._onMove = function() {
            Q0(this._map, this._container, this.options);
          }, Th.prototype.onAdd = function(P2) {
            return this._map = P2, this._container = u2.create("div", "mapboxgl-ctrl mapboxgl-ctrl-scale", P2.getContainer()), this._map.on("move", this._onMove), this._onMove(), this._container;
          }, Th.prototype.onRemove = function() {
            u2.remove(this._container), this._map.off("move", this._onMove), this._map = void 0;
          }, Th.prototype.setUnit = function(P2) {
            this.options.unit = P2, Q0(this._map, this._container, this.options);
          };
          var Ql = function(P2) {
            this._fullscreen = false, P2 && P2.container && (P2.container instanceof i.window.HTMLElement ? this._container = P2.container : i.warnOnce("Full screen control 'container' must be a DOM element.")), i.bindAll(["_onClickFullscreen", "_changeIcon"], this), "onfullscreenchange" in i.window.document ? this._fullscreenchange = "fullscreenchange" : "onmozfullscreenchange" in i.window.document ? this._fullscreenchange = "mozfullscreenchange" : "onwebkitfullscreenchange" in i.window.document ? this._fullscreenchange = "webkitfullscreenchange" : "onmsfullscreenchange" in i.window.document && (this._fullscreenchange = "MSFullscreenChange");
          };
          Ql.prototype.onAdd = function(P2) {
            return this._map = P2, this._container || (this._container = this._map.getContainer()), this._controlContainer = u2.create("div", "mapboxgl-ctrl mapboxgl-ctrl-group"), this._checkFullscreenSupport() ? this._setupUI() : (this._controlContainer.style.display = "none", i.warnOnce("This device does not support fullscreen mode.")), this._controlContainer;
          }, Ql.prototype.onRemove = function() {
            u2.remove(this._controlContainer), this._map = null, i.window.document.removeEventListener(this._fullscreenchange, this._changeIcon);
          }, Ql.prototype._checkFullscreenSupport = function() {
            return !!(i.window.document.fullscreenEnabled || i.window.document.mozFullScreenEnabled || i.window.document.msFullscreenEnabled || i.window.document.webkitFullscreenEnabled);
          }, Ql.prototype._setupUI = function() {
            var P2 = this._fullscreenButton = u2.create("button", "mapboxgl-ctrl-fullscreen", this._controlContainer);
            u2.create("span", "mapboxgl-ctrl-icon", P2).setAttribute("aria-hidden", true), P2.type = "button", this._updateTitle(), this._fullscreenButton.addEventListener("click", this._onClickFullscreen), i.window.document.addEventListener(this._fullscreenchange, this._changeIcon);
          }, Ql.prototype._updateTitle = function() {
            var P2 = this._getTitle();
            this._fullscreenButton.setAttribute("aria-label", P2), this._fullscreenButton.title = P2;
          }, Ql.prototype._getTitle = function() {
            return this._map._getUIString(this._isFullscreen() ? "FullscreenControl.Exit" : "FullscreenControl.Enter");
          }, Ql.prototype._isFullscreen = function() {
            return this._fullscreen;
          }, Ql.prototype._changeIcon = function() {
            (i.window.document.fullscreenElement || i.window.document.mozFullScreenElement || i.window.document.webkitFullscreenElement || i.window.document.msFullscreenElement) === this._container !== this._fullscreen && (this._fullscreen = !this._fullscreen, this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"), this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"), this._updateTitle());
          }, Ql.prototype._onClickFullscreen = function() {
            this._isFullscreen() ? i.window.document.exitFullscreen ? i.window.document.exitFullscreen() : i.window.document.mozCancelFullScreen ? i.window.document.mozCancelFullScreen() : i.window.document.msExitFullscreen ? i.window.document.msExitFullscreen() : i.window.document.webkitCancelFullScreen && i.window.document.webkitCancelFullScreen() : this._container.requestFullscreen ? this._container.requestFullscreen() : this._container.mozRequestFullScreen ? this._container.mozRequestFullScreen() : this._container.msRequestFullscreen ? this._container.msRequestFullscreen() : this._container.webkitRequestFullscreen && this._container.webkitRequestFullscreen();
          };
          var fm = { closeButton: true, closeOnClick: true, className: "", maxWidth: "240px" }, hm = function(P2) {
            function U2(G2) {
              P2.call(this), this.options = i.extend(Object.create(fm), G2), i.bindAll(["_update", "_onClose", "remove", "_onMouseMove", "_onMouseUp", "_onDrag"], this);
            }
            return P2 && (U2.__proto__ = P2), U2.prototype = Object.create(P2 && P2.prototype), U2.prototype.constructor = U2, U2.prototype.addTo = function(G2) {
              return this._map && this.remove(), this._map = G2, 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._trackPointer ? (this._map.on("mousemove", this._onMouseMove), this._map.on("mouseup", this._onMouseUp), this._container && this._container.classList.add("mapboxgl-popup-track-pointer"), this._map._canvasContainer.classList.add("mapboxgl-track-pointer")) : this._map.on("move", this._update), this.fire(new i.Event("open")), this;
            }, U2.prototype.isOpen = function() {
              return !!this._map;
            }, U2.prototype.remove = function() {
              return this._content && u2.remove(this._content), this._container && (u2.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), delete this._map), this.fire(new i.Event("close")), this;
            }, U2.prototype.getLngLat = function() {
              return this._lngLat;
            }, U2.prototype.setLngLat = function(G2) {
              return this._lngLat = i.LngLat.convert(G2), this._pos = 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("mapboxgl-popup-track-pointer"), this._map._canvasContainer.classList.remove("mapboxgl-track-pointer")), this;
            }, U2.prototype.trackPointer = function() {
              return this._trackPointer = true, this._pos = 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("mapboxgl-popup-track-pointer"), this._map._canvasContainer.classList.add("mapboxgl-track-pointer")), this;
            }, U2.prototype.getElement = function() {
              return this._container;
            }, U2.prototype.setText = function(G2) {
              return this.setDOMContent(i.window.document.createTextNode(G2));
            }, U2.prototype.setHTML = function(G2) {
              var J2, oe = i.window.document.createDocumentFragment(), de = i.window.document.createElement("body");
              for (de.innerHTML = G2; J2 = de.firstChild; ) oe.appendChild(J2);
              return this.setDOMContent(oe);
            }, U2.prototype.getMaxWidth = function() {
              return this._container && this._container.style.maxWidth;
            }, U2.prototype.setMaxWidth = function(G2) {
              return this.options.maxWidth = G2, this._update(), this;
            }, U2.prototype.setDOMContent = function(G2) {
              return this._createContent(), this._content.appendChild(G2), this._update(), this;
            }, U2.prototype.addClassName = function(G2) {
              this._container && this._container.classList.add(G2);
            }, U2.prototype.removeClassName = function(G2) {
              this._container && this._container.classList.remove(G2);
            }, U2.prototype.toggleClassName = function(G2) {
              if (this._container) return this._container.classList.toggle(G2);
            }, U2.prototype._createContent = function() {
              this._content && u2.remove(this._content), this._content = u2.create("div", "mapboxgl-popup-content", this._container), this.options.closeButton && (this._closeButton = u2.create("button", "mapboxgl-popup-close-button", this._content), this._closeButton.type = "button", this._closeButton.setAttribute("aria-label", "Close popup"), this._closeButton.innerHTML = "&#215;", this._closeButton.addEventListener("click", this._onClose));
            }, U2.prototype._onMouseUp = function(G2) {
              this._update(G2.point);
            }, U2.prototype._onMouseMove = function(G2) {
              this._update(G2.point);
            }, U2.prototype._onDrag = function(G2) {
              this._update(G2.point);
            }, U2.prototype._update = function(G2) {
              var J2 = this, oe = this._lngLat || this._trackPointer;
              if (this._map && oe && this._content && (this._container || (this._container = u2.create("div", "mapboxgl-popup", this._map.getContainer()), this._tip = u2.create("div", "mapboxgl-popup-tip", this._container), this._container.appendChild(this._content), this.options.className && this.options.className.split(" ").forEach(function(It) {
                return J2._container.classList.add(It);
              }), this._trackPointer && this._container.classList.add("mapboxgl-popup-track-pointer")), this.options.maxWidth && this._container.style.maxWidth !== this.options.maxWidth && (this._container.style.maxWidth = this.options.maxWidth), this._map.transform.renderWorldCopies && !this._trackPointer && (this._lngLat = wh(this._lngLat, this._pos, this._map.transform)), !this._trackPointer || G2)) {
                var de = this._pos = this._trackPointer && G2 ? G2 : this._map.project(this._lngLat), ye = this.options.anchor, Te = function It(Rt) {
                  if (Rt) {
                    if (typeof Rt == "number") {
                      var Ft = Math.round(Math.sqrt(0.5 * Math.pow(Rt, 2)));
                      return { center: new i.Point(0, 0), top: new i.Point(0, Rt), "top-left": new i.Point(Ft, Ft), "top-right": new i.Point(-Ft, Ft), bottom: new i.Point(0, -Rt), "bottom-left": new i.Point(Ft, -Ft), "bottom-right": new i.Point(-Ft, -Ft), left: new i.Point(Rt, 0), right: new i.Point(-Rt, 0) };
                    }
                    if (Rt instanceof i.Point || Array.isArray(Rt)) {
                      var Pt = i.Point.convert(Rt);
                      return { center: Pt, top: Pt, "top-left": Pt, "top-right": Pt, bottom: Pt, "bottom-left": Pt, "bottom-right": Pt, left: Pt, right: Pt };
                    }
                    return { center: i.Point.convert(Rt.center || [0, 0]), top: i.Point.convert(Rt.top || [0, 0]), "top-left": i.Point.convert(Rt["top-left"] || [0, 0]), "top-right": i.Point.convert(Rt["top-right"] || [0, 0]), bottom: i.Point.convert(Rt.bottom || [0, 0]), "bottom-left": i.Point.convert(Rt["bottom-left"] || [0, 0]), "bottom-right": i.Point.convert(Rt["bottom-right"] || [0, 0]), left: i.Point.convert(Rt.left || [0, 0]), right: i.Point.convert(Rt.right || [0, 0]) };
                  }
                  return It(new i.Point(0, 0));
                }(this.options.offset);
                if (!ye) {
                  var Fe, et = this._container.offsetWidth, lt = this._container.offsetHeight;
                  Fe = de.y + Te.bottom.y < lt ? ["top"] : de.y > this._map.transform.height - lt ? ["bottom"] : [], de.x < et / 2 ? Fe.push("left") : de.x > this._map.transform.width - et / 2 && Fe.push("right"), ye = Fe.length === 0 ? "bottom" : Fe.join("-");
                }
                var bt = de.add(Te[ye]).round();
                u2.setTransform(this._container, Xf[ye] + " translate(" + bt.x + "px," + bt.y + "px)"), Vs(this._container, ye, "popup");
              }
            }, U2.prototype._onClose = function() {
              this.remove();
            }, U2;
          }(i.Evented), fe = { version: i.version, supported: l, setRTLTextPlugin: i.setRTLTextPlugin, getRTLTextPluginStatus: i.getRTLTextPluginStatus, Map: Vc, NavigationControl: yo, GeolocateControl: J0, AttributionControl: Ys, ScaleControl: Th, FullscreenControl: Ql, Popup: hm, Marker: Rp, Style: ka, LngLat: i.LngLat, LngLatBounds: i.LngLatBounds, Point: i.Point, MercatorCoordinate: i.MercatorCoordinate, Evented: i.Evented, config: i.config, prewarm: function() {
            ke().acquire(rt);
          }, clearPrewarmedResources: function() {
            var P2 = xe;
            P2 && (P2.isPreloaded() && P2.numActive() === 1 ? (P2.release(rt), xe = 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()"));
          }, get accessToken() {
            return i.config.ACCESS_TOKEN;
          }, set accessToken(P2) {
            i.config.ACCESS_TOKEN = P2;
          }, get baseApiUrl() {
            return i.config.API_URL;
          }, set baseApiUrl(P2) {
            i.config.API_URL = P2;
          }, get workerCount() {
            return He.workerCount;
          }, set workerCount(P2) {
            He.workerCount = P2;
          }, get maxParallelImageRequests() {
            return i.config.MAX_PARALLEL_IMAGE_REQUESTS;
          }, set maxParallelImageRequests(P2) {
            i.config.MAX_PARALLEL_IMAGE_REQUESTS = P2;
          }, clearStorage: function(P2) {
            i.clearTileCache(P2);
          }, workerUrl: "" };
          return fe;
        }), o;
      });
    }, {}], 240: [function(e, t, r) {
      "use strict";
      t.exports = Math.log2 || function(n) {
        return Math.log(n) * Math.LOG2E;
      };
    }, {}], 241: [function(e, t, r) {
      "use strict";
      t.exports = function(a, o) {
        o || (o = a, a = window);
        var s = 0, i = 0, l = 0, u2 = { shift: false, alt: false, control: false, meta: false }, c = false;
        function f(w) {
          var _4 = false;
          return "altKey" in w && (_4 = _4 || w.altKey !== u2.alt, u2.alt = !!w.altKey), "shiftKey" in w && (_4 = _4 || w.shiftKey !== u2.shift, u2.shift = !!w.shiftKey), "ctrlKey" in w && (_4 = _4 || w.ctrlKey !== u2.control, u2.control = !!w.ctrlKey), "metaKey" in w && (_4 = _4 || w.metaKey !== u2.meta, u2.meta = !!w.metaKey), _4;
        }
        function h(w, _4) {
          var k = n.x(_4), T2 = n.y(_4);
          "buttons" in _4 && (w = 0 | _4.buttons), (w !== s || k !== i || T2 !== l || f(_4)) && (s = 0 | w, i = k || 0, l = T2 || 0, o && o(s, i, l, u2));
        }
        function p(w) {
          h(0, w);
        }
        function d() {
          (s || i || l || u2.shift || u2.alt || u2.meta || u2.control) && (i = l = 0, s = 0, u2.shift = u2.alt = u2.control = u2.meta = false, o && o(0, 0, 0, u2));
        }
        function v(w) {
          f(w) && o && o(s, i, l, u2);
        }
        function m(w) {
          n.buttons(w) === 0 ? h(0, w) : h(s, w);
        }
        function g(w) {
          h(s | n.buttons(w), w);
        }
        function x(w) {
          h(s & ~n.buttons(w), w);
        }
        function b() {
          c || (c = true, a.addEventListener("mousemove", m), a.addEventListener("mousedown", g), a.addEventListener("mouseup", x), a.addEventListener("mouseleave", p), a.addEventListener("mouseenter", p), a.addEventListener("mouseout", p), a.addEventListener("mouseover", p), a.addEventListener("blur", d), a.addEventListener("keyup", v), a.addEventListener("keydown", v), a.addEventListener("keypress", v), a !== window && (window.addEventListener("blur", d), window.addEventListener("keyup", v), window.addEventListener("keydown", v), window.addEventListener("keypress", v)));
        }
        b();
        var y = { element: a };
        return Object.defineProperties(y, { enabled: { get: function() {
          return c;
        }, set: function(w) {
          w ? b() : function() {
            !c || (c = false, a.removeEventListener("mousemove", m), a.removeEventListener("mousedown", g), a.removeEventListener("mouseup", x), a.removeEventListener("mouseleave", p), a.removeEventListener("mouseenter", p), a.removeEventListener("mouseout", p), a.removeEventListener("mouseover", p), a.removeEventListener("blur", d), a.removeEventListener("keyup", v), a.removeEventListener("keydown", v), a.removeEventListener("keypress", v), a !== window && (window.removeEventListener("blur", d), window.removeEventListener("keyup", v), window.removeEventListener("keydown", v), window.removeEventListener("keypress", v)));
          }();
        }, enumerable: true }, buttons: { get: function() {
          return s;
        }, enumerable: true }, x: { get: function() {
          return i;
        }, enumerable: true }, y: { get: function() {
          return l;
        }, enumerable: true }, mods: { get: function() {
          return u2;
        }, enumerable: true } }), y;
      };
      var n = e("mouse-event");
    }, { "mouse-event": 243 }], 242: [function(e, t, r) {
      var n = { left: 0, top: 0 };
      t.exports = function(a, o, s) {
        o = o || a.currentTarget || a.srcElement, Array.isArray(s) || (s = [0, 0]);
        var i = a.clientX || 0, l = a.clientY || 0, u2 = (c = o, c === window || c === document || c === document.body ? n : c.getBoundingClientRect()), c;
        return s[0] = i - u2.left, s[1] = l - u2.top, s;
      };
    }, {}], 243: [function(e, t, r) {
      "use strict";
      function n(a) {
        return a.target || a.srcElement || window;
      }
      r.buttons = function(a) {
        if (typeof a == "object") {
          if ("buttons" in a) return a.buttons;
          if ("which" in a) {
            if ((o = a.which) === 2) return 4;
            if (o === 3) return 2;
            if (o > 0) return 1 << o - 1;
          } else if ("button" in a) {
            var o;
            if ((o = a.button) === 1) return 4;
            if (o === 2) return 2;
            if (o >= 0) return 1 << o;
          }
        }
        return 0;
      }, r.element = n, r.x = function(a) {
        if (typeof a == "object") {
          if ("offsetX" in a) return a.offsetX;
          var o = n(a).getBoundingClientRect();
          return a.clientX - o.left;
        }
        return 0;
      }, r.y = function(a) {
        if (typeof a == "object") {
          if ("offsetY" in a) return a.offsetY;
          var o = n(a).getBoundingClientRect();
          return a.clientY - o.top;
        }
        return 0;
      };
    }, {}], 244: [function(e, t, r) {
      "use strict";
      var n = e("to-px");
      t.exports = function(a, o, s) {
        typeof a == "function" && (s = !!o, o = a, a = window);
        var i = n("ex", a), l = function(u2) {
          s && u2.preventDefault();
          var c = u2.deltaX || 0, f = u2.deltaY || 0, h = u2.deltaZ || 0, p = 1;
          switch (u2.deltaMode) {
            case 1:
              p = i;
              break;
            case 2:
              p = window.innerHeight;
          }
          if (f *= p, h *= p, (c *= p) || f || h) return o(c, f, h, u2);
        };
        return a.addEventListener("wheel", l), l;
      };
    }, { "to-px": 314 }], 245: [function(e, t, r) {
      (function(n, a) {
        (function() {
          (function(o, s, i) {
            s[o] = s[o] || i(), t !== void 0 && t.exports && (t.exports = s[o]);
          })("Promise", n !== void 0 ? n : this, function() {
            "use strict";
            var o, s, i, l = Object.prototype.toString, u2 = a !== void 0 ? function(w) {
              return a(w);
            } : setTimeout;
            try {
              Object.defineProperty({}, "x", {}), o = function(w, _4, k, T2) {
                return Object.defineProperty(w, _4, { value: k, writable: true, configurable: T2 !== false });
              };
            } catch {
              o = function(_4, k, T2) {
                return _4[k] = T2, _4;
              };
            }
            function c(w, _4) {
              i.add(w, _4), s || (s = u2(i.drain));
            }
            function f(w) {
              var _4, k = typeof w;
              return w == null || k != "object" && k != "function" || (_4 = w.then), typeof _4 == "function" && _4;
            }
            function h() {
              for (var w = 0; w < this.chain.length; w++) p(this, this.state === 1 ? this.chain[w].success : this.chain[w].failure, this.chain[w]);
              this.chain.length = 0;
            }
            function p(w, _4, k) {
              var T2, A2;
              try {
                _4 === false ? k.reject(w.msg) : (T2 = _4 === true ? w.msg : _4.call(void 0, w.msg)) === k.promise ? k.reject(TypeError("Promise-chain cycle")) : (A2 = f(T2)) ? A2.call(T2, k.resolve, k.reject) : k.resolve(T2);
              } catch (S2) {
                k.reject(S2);
              }
            }
            function d(w) {
              var _4, k = this;
              if (!k.triggered) {
                k.triggered = true, k.def && (k = k.def);
                try {
                  (_4 = f(w)) ? c(function() {
                    var T2 = new g(k);
                    try {
                      _4.call(w, function() {
                        d.apply(T2, arguments);
                      }, function() {
                        v.apply(T2, arguments);
                      });
                    } catch (A2) {
                      v.call(T2, A2);
                    }
                  }) : (k.msg = w, k.state = 1, k.chain.length > 0 && c(h, k));
                } catch (T2) {
                  v.call(new g(k), T2);
                }
              }
            }
            function v(w) {
              var _4 = this;
              _4.triggered || (_4.triggered = true, _4.def && (_4 = _4.def), _4.msg = w, _4.state = 2, _4.chain.length > 0 && c(h, _4));
            }
            function m(w, _4, k, T2) {
              for (var A2 = 0; A2 < _4.length; A2++) (function(S2) {
                w.resolve(_4[S2]).then(function(C2) {
                  k(S2, C2);
                }, T2);
              })(A2);
            }
            function g(w) {
              this.def = w, this.triggered = false;
            }
            function x(w) {
              this.promise = w, this.state = 0, this.triggered = false, this.chain = [], this.msg = void 0;
            }
            function b(w) {
              if (typeof w != "function") throw TypeError("Not a function");
              if (this.__NPO__ !== 0) throw TypeError("Not a promise");
              this.__NPO__ = 1;
              var _4 = new x(this);
              this.then = function(k, T2) {
                var A2 = { success: typeof k != "function" || k, failure: typeof T2 == "function" && T2 };
                return A2.promise = new this.constructor(function(S2, C2) {
                  if (typeof S2 != "function" || typeof C2 != "function") throw TypeError("Not a function");
                  A2.resolve = S2, A2.reject = C2;
                }), _4.chain.push(A2), _4.state !== 0 && c(h, _4), A2.promise;
              }, this.catch = function(k) {
                return this.then(void 0, k);
              };
              try {
                w.call(void 0, function(k) {
                  d.call(_4, k);
                }, function(k) {
                  v.call(_4, k);
                });
              } catch (k) {
                v.call(_4, k);
              }
            }
            i = /* @__PURE__ */ function() {
              var w, _4, k;
              function T2(A2, S2) {
                this.fn = A2, this.self = S2, this.next = void 0;
              }
              return { add: function(A2, S2) {
                k = new T2(A2, S2), _4 ? _4.next = k : w = k, _4 = k, k = void 0;
              }, drain: function() {
                var A2 = w;
                for (w = _4 = s = void 0; A2; ) A2.fn.call(A2.self), A2 = A2.next;
              } };
            }();
            var y = o({}, "constructor", b, false);
            return b.prototype = y, o(y, "__NPO__", 0, false), o(b, "resolve", function(w) {
              return w && typeof w == "object" && w.__NPO__ === 1 ? w : new this(function(_4, k) {
                if (typeof _4 != "function" || typeof k != "function") throw TypeError("Not a function");
                _4(w);
              });
            }), o(b, "reject", function(w) {
              return new this(function(_4, k) {
                if (typeof _4 != "function" || typeof k != "function") throw TypeError("Not a function");
                k(w);
              });
            }), o(b, "all", function(w) {
              var _4 = this;
              return l.call(w) != "[object Array]" ? _4.reject(TypeError("Not an array")) : w.length === 0 ? _4.resolve([]) : new _4(function(k, T2) {
                if (typeof k != "function" || typeof T2 != "function") throw TypeError("Not a function");
                var A2 = w.length, S2 = Array(A2), C2 = 0;
                m(_4, w, function(E2, F13) {
                  S2[E2] = F13, ++C2 === A2 && k(S2);
                }, T2);
              });
            }), o(b, "race", function(w) {
              var _4 = this;
              return l.call(w) != "[object Array]" ? _4.reject(TypeError("Not an array")) : new _4(function(k, T2) {
                if (typeof k != "function" || typeof T2 != "function") throw TypeError("Not a function");
                m(_4, w, function(A2, S2) {
                  k(S2);
                }, T2);
              });
            }), b;
          });
        }).call(this);
      }).call(this, typeof global < "u" ? global : typeof self < "u" ? self : typeof window < "u" ? window : {}, e("timers").setImmediate);
    }, { timers: 311 }], 246: [function(e, t, r) {
      var n = Math.PI, a = u2(120);
      function o(c, f, h, p) {
        return ["C", c, f, h, p, h, p];
      }
      function s(c, f, h, p, d, v) {
        return ["C", c / 3 + 2 / 3 * h, f / 3 + 2 / 3 * p, d / 3 + 2 / 3 * h, v / 3 + 2 / 3 * p, d, v];
      }
      function i(c, f, h, p, d, v, m, g, x, b) {
        if (b) F13 = b[0], N2 = b[1], C2 = b[2], E2 = b[3];
        else {
          var y = l(c, f, -d);
          c = y.x, f = y.y;
          var w = (c - (g = (y = l(g, x, -d)).x)) / 2, _4 = (f - (x = y.y)) / 2, k = w * w / (h * h) + _4 * _4 / (p * p);
          k > 1 && (h *= k = Math.sqrt(k), p *= k);
          var T2 = h * h, A2 = p * p, S2 = (v == m ? -1 : 1) * Math.sqrt(Math.abs((T2 * A2 - T2 * _4 * _4 - A2 * w * w) / (T2 * _4 * _4 + A2 * w * w)));
          S2 == 1 / 0 && (S2 = 1);
          var C2 = S2 * h * _4 / p + (c + g) / 2, E2 = S2 * -p * w / h + (f + x) / 2, F13 = Math.asin(((f - E2) / p).toFixed(9)), N2 = Math.asin(((x - E2) / p).toFixed(9));
          (F13 = c < C2 ? n - F13 : F13) < 0 && (F13 = 2 * n + F13), (N2 = g < C2 ? n - N2 : N2) < 0 && (N2 = 2 * n + N2), m && F13 > N2 && (F13 -= 2 * n), !m && N2 > F13 && (N2 -= 2 * n);
        }
        if (Math.abs(N2 - F13) > a) {
          var D2 = N2, I2 = g, O2 = x;
          N2 = F13 + a * (m && N2 > F13 ? 1 : -1);
          var L2 = i(g = C2 + h * Math.cos(N2), x = E2 + p * Math.sin(N2), h, p, d, 0, m, I2, O2, [N2, D2, C2, E2]);
        }
        var V2 = Math.tan((N2 - F13) / 4), W2 = 4 / 3 * h * V2, X2 = 4 / 3 * p * V2, Y2 = [2 * c - (c + W2 * Math.sin(F13)), 2 * f - (f - X2 * Math.cos(F13)), g + W2 * Math.sin(N2), x - X2 * Math.cos(N2), g, x];
        if (b) return Y2;
        L2 && (Y2 = Y2.concat(L2));
        for (var K2 = 0; K2 < Y2.length; ) {
          var q = l(Y2[K2], Y2[K2 + 1], d);
          Y2[K2++] = q.x, Y2[K2++] = q.y;
        }
        return Y2;
      }
      function l(c, f, h) {
        return { x: c * Math.cos(h) - f * Math.sin(h), y: c * Math.sin(h) + f * Math.cos(h) };
      }
      function u2(c) {
        return c * (n / 180);
      }
      t.exports = function(c) {
        for (var f, h = [], p = 0, d = 0, v = 0, m = 0, g = null, x = null, b = 0, y = 0, w = 0, _4 = c.length; w < _4; w++) {
          var k = c[w], T2 = k[0];
          switch (T2) {
            case "M":
              v = k[1], m = k[2];
              break;
            case "A":
              (k = i(b, y, k[1], k[2], u2(k[3]), k[4], k[5], k[6], k[7])).unshift("C"), k.length > 7 && (h.push(k.splice(0, 7)), k.unshift("C"));
              break;
            case "S":
              var A2 = b, S2 = y;
              f != "C" && f != "S" || (A2 += A2 - p, S2 += S2 - d), k = ["C", A2, S2, k[1], k[2], k[3], k[4]];
              break;
            case "T":
              f == "Q" || f == "T" ? (g = 2 * b - g, x = 2 * y - x) : (g = b, x = y), k = s(b, y, g, x, k[1], k[2]);
              break;
            case "Q":
              g = k[1], x = k[2], k = s(b, y, k[1], k[2], k[3], k[4]);
              break;
            case "L":
              k = o(b, y, k[1], k[2]);
              break;
            case "H":
              k = o(b, y, k[1], y);
              break;
            case "V":
              k = o(b, y, b, k[1]);
              break;
            case "Z":
              k = o(b, y, v, m);
          }
          f = T2, b = k[k.length - 2], y = k[k.length - 1], k.length > 4 ? (p = k[k.length - 4], d = k[k.length - 3]) : (p = b, d = y), h.push(k);
        }
        return h;
      };
    }, {}], 247: [function(e, t, r) {
      "use strict";
      var n = Object.getOwnPropertySymbols, a = Object.prototype.hasOwnProperty, o = Object.prototype.propertyIsEnumerable;
      function s(i) {
        if (i == null) throw new TypeError("Object.assign cannot be called with null or undefined");
        return Object(i);
      }
      t.exports = function() {
        try {
          if (!Object.assign) return false;
          var i = new String("abc");
          if (i[5] = "de", Object.getOwnPropertyNames(i)[0] === "5") return false;
          for (var l = {}, u2 = 0; u2 < 10; u2++) l["_" + String.fromCharCode(u2)] = u2;
          if (Object.getOwnPropertyNames(l).map(function(f) {
            return l[f];
          }).join("") !== "0123456789") return false;
          var c = {};
          return "abcdefghijklmnopqrst".split("").forEach(function(f) {
            c[f] = f;
          }), Object.keys(Object.assign({}, c)).join("") === "abcdefghijklmnopqrst";
        } catch {
          return false;
        }
      }() ? Object.assign : function(i, l) {
        for (var u2, c, f = s(i), h = 1; h < arguments.length; h++) {
          for (var p in u2 = Object(arguments[h])) a.call(u2, p) && (f[p] = u2[p]);
          if (n) {
            c = n(u2);
            for (var d = 0; d < c.length; d++) o.call(u2, c[d]) && (f[c[d]] = u2[c[d]]);
          }
        }
        return f;
      };
    }, {}], 248: [function(e, t, r) {
      "use strict";
      function n(s, i) {
        if (typeof s != "string") return [s];
        var l = [s];
        typeof i == "string" || Array.isArray(i) ? i = { brackets: i } : i || (i = {});
        var u2 = i.brackets ? Array.isArray(i.brackets) ? i.brackets : [i.brackets] : ["{}", "[]", "()"], c = i.escape || "___", f = !!i.flat;
        u2.forEach(function(p) {
          var d = new RegExp(["\\", p[0], "[^\\", p[0], "\\", p[1], "]*\\", p[1]].join("")), v = [];
          function m(g, x, b) {
            var y = l.push(g.slice(p[0].length, -p[1].length)) - 1;
            return v.push(y), c + y + c;
          }
          l.forEach(function(g, x) {
            for (var b, y = 0; g != b; ) if (b = g, g = g.replace(d, m), y++ > 1e4) throw Error("References have circular dependency. Please, check them.");
            l[x] = g;
          }), v = v.reverse(), l = l.map(function(g) {
            return v.forEach(function(x) {
              g = g.replace(new RegExp("(\\" + c + x + "\\" + c + ")", "g"), p[0] + "$1" + p[1]);
            }), g;
          });
        });
        var h = new RegExp("\\" + c + "([0-9]+)\\" + c);
        return f ? l : function p(d, v, m) {
          for (var g, x = [], b = 0; g = h.exec(d); ) {
            if (b++ > 1e4) throw Error("Circular references in parenthesis");
            x.push(d.slice(0, g.index)), x.push(p(v[g[1]], v)), d = d.slice(g.index + g[0].length);
          }
          return x.push(d), x;
        }(l[0], l);
      }
      function a(s, i) {
        if (i && i.flat) {
          var l, u2 = i && i.escape || "___", c = s[0];
          if (!c) return "";
          for (var f = new RegExp("\\" + u2 + "([0-9]+)\\" + u2), h = 0; c != l; ) {
            if (h++ > 1e4) throw Error("Circular references in " + s);
            l = c, c = c.replace(f, p);
          }
          return c;
        }
        return s.reduce(function d(v, m) {
          return Array.isArray(m) && (m = m.reduce(d, "")), v + m;
        }, "");
        function p(d, v) {
          if (s[v] == null) throw Error("Reference " + v + "is undefined");
          return s[v];
        }
      }
      function o(s, i) {
        return Array.isArray(s) ? a(s, i) : n(s, i);
      }
      o.parse = n, o.stringify = a, t.exports = o;
    }, {}], 249: [function(e, t, r) {
      "use strict";
      var n = e("pick-by-alias");
      t.exports = function(a) {
        var o;
        return arguments.length > 1 && (a = arguments), typeof a == "string" ? a = a.split(/\s/).map(parseFloat) : typeof a == "number" && (a = [a]), a.length && typeof a[0] == "number" ? o = a.length === 1 ? { width: a[0], height: a[0], x: 0, y: 0 } : a.length === 2 ? { width: a[0], height: a[1], x: 0, y: 0 } : { x: a[0], y: a[1], width: a[2] - a[0] || 0, height: a[3] - a[1] || 0 } : a && (a = n(a, { left: "x l left Left", top: "y t top Top", width: "w width W Width", height: "h height W Width", bottom: "b bottom Bottom", right: "r right Right" }), o = { x: a.left || 0, y: a.top || 0 }, a.width == null ? a.right ? o.width = a.right - o.x : o.width = 0 : o.width = a.width, a.height == null ? a.bottom ? o.height = a.bottom - o.y : o.height = 0 : o.height = a.height), o;
      };
    }, { "pick-by-alias": 253 }], 250: [function(e, t, r) {
      t.exports = function(s) {
        var i = [];
        return s.replace(a, function(l, u2, c) {
          var f = u2.toLowerCase();
          for (c = function(h) {
            var p = h.match(o);
            return p ? p.map(Number) : [];
          }(c), f == "m" && c.length > 2 && (i.push([u2].concat(c.splice(0, 2))), f = "l", u2 = u2 == "m" ? "l" : "L"); ; ) {
            if (c.length == n[f]) return c.unshift(u2), i.push(c);
            if (c.length < n[f]) throw new Error("malformed path data");
            i.push([u2].concat(c.splice(0, n[f])));
          }
        }), i;
      };
      var n = { a: 7, c: 6, h: 1, l: 2, m: 2, q: 4, s: 4, t: 2, v: 1, z: 0 }, a = /([astvzqmhlc])([^astvzqmhlc]*)/gi, o = /-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;
    }, {}], 251: [function(e, t, r) {
      t.exports = function(n, a) {
        a || (a = [0, ""]), n = String(n);
        var o = parseFloat(n, 10);
        return a[0] = o, a[1] = n.match(/[\d.\-\+]*\s*(.*)/)[1] || "", a;
      };
    }, {}], 252: [function(e, t, r) {
      (function(n) {
        (function() {
          (function() {
            var a, o, s, i, l, u2;
            typeof performance < "u" && performance !== null && performance.now ? t.exports = function() {
              return performance.now();
            } : n != null && n.hrtime ? (t.exports = function() {
              return (a() - l) / 1e6;
            }, o = n.hrtime, i = (a = function() {
              var c;
              return 1e9 * (c = o())[0] + c[1];
            })(), u2 = 1e9 * n.uptime(), l = i - u2) : Date.now ? (t.exports = function() {
              return Date.now() - s;
            }, s = Date.now()) : (t.exports = function() {
              return (/* @__PURE__ */ new Date()).getTime() - s;
            }, s = (/* @__PURE__ */ new Date()).getTime());
          }).call(this);
        }).call(this);
      }).call(this, e("_process"));
    }, { _process: 277 }], 253: [function(e, t, r) {
      "use strict";
      t.exports = function(o, s, i) {
        var l, u2, c = {};
        if (typeof s == "string" && (s = a(s)), Array.isArray(s)) {
          var f = {};
          for (u2 = 0; u2 < s.length; u2++) f[s[u2]] = true;
          s = f;
        }
        for (l in s) s[l] = a(s[l]);
        var h = {};
        for (l in s) {
          var p = s[l];
          if (Array.isArray(p)) for (u2 = 0; u2 < p.length; u2++) {
            var d = p[u2];
            if (i && (h[d] = true), d in o) {
              if (c[l] = o[d], i) for (var v = u2; v < p.length; v++) h[p[v]] = true;
              break;
            }
          }
          else l in o && (s[l] && (c[l] = o[l]), i && (h[l] = true));
        }
        if (i) for (l in o) h[l] || (c[l] = o[l]);
        return c;
      };
      var n = {};
      function a(o) {
        return n[o] ? n[o] : (typeof o == "string" && (o = n[o] = o.split(/\s*,\s*|\s+/)), o);
      }
    }, {}], 254: [function(e, t, r) {
      var n, a = e("./lib/build-log"), o = e("./lib/epsilon"), s = e("./lib/intersecter"), i = e("./lib/segment-chainer"), l = e("./lib/segment-selector"), u2 = e("./lib/geojson"), c = false, f = o();
      function h(p, d, v) {
        var m = n.segments(p), g = n.segments(d), x = v(n.combine(m, g));
        return n.polygon(x);
      }
      n = { buildLog: function(p) {
        return p === true ? c = a() : p === false && (c = false), c !== false && c.list;
      }, epsilon: function(p) {
        return f.epsilon(p);
      }, segments: function(p) {
        var d = s(true, f, c);
        return p.regions.forEach(d.addRegion), { segments: d.calculate(p.inverted), inverted: p.inverted };
      }, combine: function(p, d) {
        return { combined: s(false, f, c).calculate(p.segments, p.inverted, d.segments, d.inverted), inverted1: p.inverted, inverted2: d.inverted };
      }, selectUnion: function(p) {
        return { segments: l.union(p.combined, c), inverted: p.inverted1 || p.inverted2 };
      }, selectIntersect: function(p) {
        return { segments: l.intersect(p.combined, c), inverted: p.inverted1 && p.inverted2 };
      }, selectDifference: function(p) {
        return { segments: l.difference(p.combined, c), inverted: p.inverted1 && !p.inverted2 };
      }, selectDifferenceRev: function(p) {
        return { segments: l.differenceRev(p.combined, c), inverted: !p.inverted1 && p.inverted2 };
      }, selectXor: function(p) {
        return { segments: l.xor(p.combined, c), inverted: p.inverted1 !== p.inverted2 };
      }, polygon: function(p) {
        return { regions: i(p.segments, f, c), inverted: p.inverted };
      }, polygonFromGeoJSON: function(p) {
        return u2.toPolygon(n, p);
      }, polygonToGeoJSON: function(p) {
        return u2.fromPolygon(n, f, p);
      }, union: function(p, d) {
        return h(p, d, n.selectUnion);
      }, intersect: function(p, d) {
        return h(p, d, n.selectIntersect);
      }, difference: function(p, d) {
        return h(p, d, n.selectDifference);
      }, differenceRev: function(p, d) {
        return h(p, d, n.selectDifferenceRev);
      }, xor: function(p, d) {
        return h(p, d, n.selectXor);
      } }, typeof window == "object" && (window.PolyBool = n), t.exports = n;
    }, { "./lib/build-log": 255, "./lib/epsilon": 256, "./lib/geojson": 257, "./lib/intersecter": 258, "./lib/segment-chainer": 260, "./lib/segment-selector": 261 }], 255: [function(e, t, r) {
      t.exports = function() {
        var n, a = 0, o = false;
        function s(i, l) {
          return n.list.push({ type: i, data: l ? JSON.parse(JSON.stringify(l)) : void 0 }), n;
        }
        return n = { list: [], segmentId: function() {
          return a++;
        }, checkIntersection: function(i, l) {
          return s("check", { seg1: i, seg2: l });
        }, segmentChop: function(i, l) {
          return s("div_seg", { seg: i, pt: l }), s("chop", { seg: i, pt: l });
        }, statusRemove: function(i) {
          return s("pop_seg", { seg: i });
        }, segmentUpdate: function(i) {
          return s("seg_update", { seg: i });
        }, segmentNew: function(i, l) {
          return s("new_seg", { seg: i, primary: l });
        }, segmentRemove: function(i) {
          return s("rem_seg", { seg: i });
        }, tempStatus: function(i, l, u2) {
          return s("temp_status", { seg: i, above: l, below: u2 });
        }, rewind: function(i) {
          return s("rewind", { seg: i });
        }, status: function(i, l, u2) {
          return s("status", { seg: i, above: l, below: u2 });
        }, vert: function(i) {
          return i === o ? n : (o = i, s("vert", { x: i }));
        }, log: function(i) {
          return typeof i != "string" && (i = JSON.stringify(i, false, "  ")), s("log", { txt: i });
        }, reset: function() {
          return s("reset");
        }, selected: function(i) {
          return s("selected", { segs: i });
        }, chainStart: function(i) {
          return s("chain_start", { seg: i });
        }, chainRemoveHead: function(i, l) {
          return s("chain_rem_head", { index: i, pt: l });
        }, chainRemoveTail: function(i, l) {
          return s("chain_rem_tail", { index: i, pt: l });
        }, chainNew: function(i, l) {
          return s("chain_new", { pt1: i, pt2: l });
        }, chainMatch: function(i) {
          return s("chain_match", { index: i });
        }, chainClose: function(i) {
          return s("chain_close", { index: i });
        }, chainAddHead: function(i, l) {
          return s("chain_add_head", { index: i, pt: l });
        }, chainAddTail: function(i, l) {
          return s("chain_add_tail", { index: i, pt: l });
        }, chainConnect: function(i, l) {
          return s("chain_con", { index1: i, index2: l });
        }, chainReverse: function(i) {
          return s("chain_rev", { index: i });
        }, chainJoin: function(i, l) {
          return s("chain_join", { index1: i, index2: l });
        }, done: function() {
          return s("done");
        } };
      };
    }, {}], 256: [function(e, t, r) {
      t.exports = function(n) {
        typeof n != "number" && (n = 1e-10);
        var a = { epsilon: function(o) {
          return typeof o == "number" && (n = o), n;
        }, pointAboveOrOnLine: function(o, s, i) {
          var l = s[0], u2 = s[1], c = i[0], f = i[1], h = o[0];
          return (c - l) * (o[1] - u2) - (f - u2) * (h - l) >= -n;
        }, pointBetween: function(o, s, i) {
          var l = o[1] - s[1], u2 = i[0] - s[0], c = o[0] - s[0], f = i[1] - s[1], h = c * u2 + l * f;
          return !(h < n) && !(h - (u2 * u2 + f * f) > -n);
        }, pointsSameX: function(o, s) {
          return Math.abs(o[0] - s[0]) < n;
        }, pointsSameY: function(o, s) {
          return Math.abs(o[1] - s[1]) < n;
        }, pointsSame: function(o, s) {
          return a.pointsSameX(o, s) && a.pointsSameY(o, s);
        }, pointsCompare: function(o, s) {
          return a.pointsSameX(o, s) ? a.pointsSameY(o, s) ? 0 : o[1] < s[1] ? -1 : 1 : o[0] < s[0] ? -1 : 1;
        }, pointsCollinear: function(o, s, i) {
          var l = o[0] - s[0], u2 = o[1] - s[1], c = s[0] - i[0], f = s[1] - i[1];
          return Math.abs(l * f - c * u2) < n;
        }, linesIntersect: function(o, s, i, l) {
          var u2 = s[0] - o[0], c = s[1] - o[1], f = l[0] - i[0], h = l[1] - i[1], p = u2 * h - c * f;
          if (Math.abs(p) < n) return false;
          var d = o[0] - i[0], v = o[1] - i[1], m = (f * v - h * d) / p, g = (u2 * v - c * d) / p, x = { alongA: 0, alongB: 0, pt: [o[0] + m * u2, o[1] + m * c] };
          return x.alongA = m <= -n ? -2 : m < n ? -1 : m - 1 <= -n ? 0 : m - 1 < n ? 1 : 2, x.alongB = g <= -n ? -2 : g < n ? -1 : g - 1 <= -n ? 0 : g - 1 < n ? 1 : 2, x;
        }, pointInsideRegion: function(o, s) {
          for (var i = o[0], l = o[1], u2 = s[s.length - 1][0], c = s[s.length - 1][1], f = false, h = 0; h < s.length; h++) {
            var p = s[h][0], d = s[h][1];
            d - l > n != c - l > n && (u2 - p) * (l - d) / (c - d) + p - i > n && (f = !f), u2 = p, c = d;
          }
          return f;
        } };
        return a;
      };
    }, {}], 257: [function(e, t, r) {
      var n = { toPolygon: function(a, o) {
        function s(u2) {
          if (u2.length <= 0) return a.segments({ inverted: false, regions: [] });
          function c(p) {
            var d = p.slice(0, p.length - 1);
            return a.segments({ inverted: false, regions: [d] });
          }
          for (var f = c(u2[0]), h = 1; h < u2.length; h++) f = a.selectDifference(a.combine(f, c(u2[h])));
          return f;
        }
        if (o.type === "Polygon") return a.polygon(s(o.coordinates));
        if (o.type === "MultiPolygon") {
          for (var i = a.segments({ inverted: false, regions: [] }), l = 0; l < o.coordinates.length; l++) i = a.selectUnion(a.combine(i, s(o.coordinates[l])));
          return a.polygon(i);
        }
        throw new Error("PolyBool: Cannot convert GeoJSON object to PolyBool polygon");
      }, fromPolygon: function(a, o, s) {
        function i(g, x) {
          return o.pointInsideRegion([0.5 * (g[0][0] + g[1][0]), 0.5 * (g[0][1] + g[1][1])], x);
        }
        function l(g) {
          return { region: g, children: [] };
        }
        s = a.polygon(a.segments(s));
        var u2 = l(null);
        function c(g, x) {
          for (var b = 0; b < g.children.length; b++) if (i(x, (w = g.children[b]).region)) return void c(w, x);
          var y = l(x);
          for (b = 0; b < g.children.length; b++) {
            var w;
            i((w = g.children[b]).region, x) && (y.children.push(w), g.children.splice(b, 1), b--);
          }
          g.children.push(y);
        }
        for (var f = 0; f < s.regions.length; f++) {
          var h = s.regions[f];
          h.length < 3 || c(u2, h);
        }
        function p(g, x) {
          for (var b = 0, y = g[g.length - 1][0], w = g[g.length - 1][1], _4 = [], k = 0; k < g.length; k++) {
            var T2 = g[k][0], A2 = g[k][1];
            _4.push([T2, A2]), b += A2 * y - T2 * w, y = T2, w = A2;
          }
          return b < 0 !== x && _4.reverse(), _4.push([_4[0][0], _4[0][1]]), _4;
        }
        var d = [];
        function v(g) {
          var x = [p(g.region, false)];
          d.push(x);
          for (var b = 0; b < g.children.length; b++) x.push(m(g.children[b]));
        }
        function m(g) {
          for (var x = 0; x < g.children.length; x++) v(g.children[x]);
          return p(g.region, true);
        }
        for (f = 0; f < u2.children.length; f++) v(u2.children[f]);
        return d.length <= 0 ? { type: "Polygon", coordinates: [] } : d.length == 1 ? { type: "Polygon", coordinates: d[0] } : { type: "MultiPolygon", coordinates: d };
      } };
      t.exports = n;
    }, {}], 258: [function(e, t, r) {
      var n = e("./linked-list");
      t.exports = function(a, o, s) {
        function i(p, d, v) {
          return { id: s ? s.segmentId() : -1, start: p, end: d, myFill: { above: v.myFill.above, below: v.myFill.below }, otherFill: null };
        }
        var l = n.create();
        function u2(p, d) {
          l.insertBefore(p, function(v) {
            return function(m, g, x, b, y, w) {
              var _4 = o.pointsCompare(g, y);
              return _4 !== 0 ? _4 : o.pointsSame(x, w) ? 0 : m !== b ? m ? 1 : -1 : o.pointAboveOrOnLine(x, b ? y : w, b ? w : y) ? 1 : -1;
            }(p.isStart, p.pt, d, v.isStart, v.pt, v.other.pt) < 0;
          });
        }
        function c(p, d) {
          var v = function(m, g) {
            var x = n.node({ isStart: true, pt: m.start, seg: m, primary: g, other: null, status: null });
            return u2(x, m.end), x;
          }(p, d);
          return function(m, g, x) {
            var b = n.node({ isStart: false, pt: g.end, seg: g, primary: x, other: m, status: null });
            m.other = b, u2(b, m.pt);
          }(v, p, d), v;
        }
        function f(p, d) {
          var v = i(d, p.seg.end, p.seg);
          return function(m, g) {
            s && s.segmentChop(m.seg, g), m.other.remove(), m.seg.end = g, m.other.pt = g, u2(m.other, m.pt);
          }(p, d), c(v, p.primary);
        }
        function h(p, d) {
          var v = n.create();
          function m(F13) {
            return v.findTransition(function(N2) {
              var D2, I2, O2, L2, V2, W2;
              return D2 = F13, I2 = N2.ev, O2 = D2.seg.start, L2 = D2.seg.end, V2 = I2.seg.start, W2 = I2.seg.end, (o.pointsCollinear(O2, V2, W2) ? o.pointsCollinear(L2, V2, W2) || o.pointAboveOrOnLine(L2, V2, W2) ? 1 : -1 : o.pointAboveOrOnLine(O2, V2, W2) ? 1 : -1) > 0;
            });
          }
          function g(F13, N2) {
            var D2 = F13.seg, I2 = N2.seg, O2 = D2.start, L2 = D2.end, V2 = I2.start, W2 = I2.end;
            s && s.checkIntersection(D2, I2);
            var X2 = o.linesIntersect(O2, L2, V2, W2);
            if (X2 === false) {
              if (!o.pointsCollinear(O2, L2, V2) || o.pointsSame(O2, W2) || o.pointsSame(L2, V2)) return false;
              var Y2 = o.pointsSame(O2, V2), K2 = o.pointsSame(L2, W2);
              if (Y2 && K2) return N2;
              var q = !Y2 && o.pointBetween(O2, V2, W2), re = !K2 && o.pointBetween(L2, V2, W2);
              if (Y2) return re ? f(N2, L2) : f(F13, W2), N2;
              q && (K2 || (re ? f(N2, L2) : f(F13, W2)), f(N2, O2));
            } else X2.alongA === 0 && (X2.alongB === -1 ? f(F13, V2) : X2.alongB === 0 ? f(F13, X2.pt) : X2.alongB === 1 && f(F13, W2)), X2.alongB === 0 && (X2.alongA === -1 ? f(N2, O2) : X2.alongA === 0 ? f(N2, X2.pt) : X2.alongA === 1 && f(N2, L2));
            return false;
          }
          for (var x = []; !l.isEmpty(); ) {
            var b = l.getHead();
            if (s && s.vert(b.pt[0]), b.isStart) {
              let F13 = function() {
                if (w) {
                  var N2 = g(b, w);
                  if (N2) return N2;
                }
                return !!_4 && g(b, _4);
              };
              var E2 = F13;
              s && s.segmentNew(b.seg, b.primary);
              var y = m(b), w = y.before ? y.before.ev : null, _4 = y.after ? y.after.ev : null;
              s && s.tempStatus(b.seg, !!w && w.seg, !!_4 && _4.seg);
              var k, T2 = F13();
              if (T2) {
                var A2;
                a ? (A2 = b.seg.myFill.below === null || b.seg.myFill.above !== b.seg.myFill.below) && (T2.seg.myFill.above = !T2.seg.myFill.above) : T2.seg.otherFill = b.seg.myFill, s && s.segmentUpdate(T2.seg), b.other.remove(), b.remove();
              }
              if (l.getHead() !== b) {
                s && s.rewind(b.seg);
                continue;
              }
              a ? (A2 = b.seg.myFill.below === null || b.seg.myFill.above !== b.seg.myFill.below, b.seg.myFill.below = _4 ? _4.seg.myFill.above : p, b.seg.myFill.above = A2 ? !b.seg.myFill.below : b.seg.myFill.below) : b.seg.otherFill === null && (k = _4 ? b.primary === _4.primary ? _4.seg.otherFill.above : _4.seg.myFill.above : b.primary ? d : p, b.seg.otherFill = { above: k, below: k }), s && s.status(b.seg, !!w && w.seg, !!_4 && _4.seg), b.other.status = y.insert(n.node({ ev: b }));
            } else {
              var S2 = b.status;
              if (S2 === null) throw new Error("PolyBool: Zero-length segment detected; your epsilon is probably too small or too large");
              if (v.exists(S2.prev) && v.exists(S2.next) && g(S2.prev.ev, S2.next.ev), s && s.statusRemove(S2.ev.seg), S2.remove(), !b.primary) {
                var C2 = b.seg.myFill;
                b.seg.myFill = b.seg.otherFill, b.seg.otherFill = C2;
              }
              x.push(b.seg);
            }
            l.getHead().remove();
          }
          return s && s.done(), x;
        }
        return a ? { addRegion: function(p) {
          for (var d, v, m, g = p[p.length - 1], x = 0; x < p.length; x++) {
            d = g, g = p[x];
            var b = o.pointsCompare(d, g);
            b !== 0 && c((v = b < 0 ? d : g, m = b < 0 ? g : d, { id: s ? s.segmentId() : -1, start: v, end: m, myFill: { above: null, below: null }, otherFill: null }), true);
          }
        }, calculate: function(p) {
          return h(p, false);
        } } : { calculate: function(p, d, v, m) {
          return p.forEach(function(g) {
            c(i(g.start, g.end, g), true);
          }), v.forEach(function(g) {
            c(i(g.start, g.end, g), false);
          }), h(d, m);
        } };
      };
    }, { "./linked-list": 259 }], 259: [function(e, t, r) {
      t.exports = { create: function() {
        var n = { root: { root: true, next: null }, exists: function(a) {
          return a !== null && a !== n.root;
        }, isEmpty: function() {
          return n.root.next === null;
        }, getHead: function() {
          return n.root.next;
        }, insertBefore: function(a, o) {
          for (var s = n.root, i = n.root.next; i !== null; ) {
            if (o(i)) return a.prev = i.prev, a.next = i, i.prev.next = a, void (i.prev = a);
            s = i, i = i.next;
          }
          s.next = a, a.prev = s, a.next = null;
        }, findTransition: function(a) {
          for (var o = n.root, s = n.root.next; s !== null && !a(s); ) o = s, s = s.next;
          return { before: o === n.root ? null : o, after: s, insert: function(i) {
            return i.prev = o, i.next = s, o.next = i, s !== null && (s.prev = i), i;
          } };
        } };
        return n;
      }, node: function(n) {
        return n.prev = null, n.next = null, n.remove = function() {
          n.prev.next = n.next, n.next && (n.next.prev = n.prev), n.prev = null, n.next = null;
        }, n;
      } };
    }, {}], 260: [function(e, t, r) {
      t.exports = function(n, a, o) {
        var s = [], i = [];
        return n.forEach(function(l) {
          var u2 = l.start, c = l.end;
          if (a.pointsSame(u2, c)) console.warn("PolyBool: Warning: Zero-length segment detected; your epsilon is probably too small or too large");
          else {
            o && o.chainStart(l);
            for (var f = { index: 0, matches_head: false, matches_pt1: false }, h = { index: 0, matches_head: false, matches_pt1: false }, p = f, d = 0; d < s.length; d++) {
              var v = (y = s[d])[0], m = (y[1], y[y.length - 1]);
              if (y[y.length - 2], a.pointsSame(v, u2)) {
                if (E2(d, true, true)) break;
              } else if (a.pointsSame(v, c)) {
                if (E2(d, true, false)) break;
              } else if (a.pointsSame(m, u2)) {
                if (E2(d, false, true)) break;
              } else if (a.pointsSame(m, c) && E2(d, false, false)) break;
            }
            if (p === f) return s.push([u2, c]), void (o && o.chainNew(u2, c));
            if (p === h) {
              o && o.chainMatch(f.index);
              var g = f.index, x = f.matches_pt1 ? c : u2, b = f.matches_head, y = s[g], w = b ? y[0] : y[y.length - 1], _4 = b ? y[1] : y[y.length - 2], k = b ? y[y.length - 1] : y[0], T2 = b ? y[y.length - 2] : y[1];
              return a.pointsCollinear(_4, w, x) && (b ? (o && o.chainRemoveHead(f.index, x), y.shift()) : (o && o.chainRemoveTail(f.index, x), y.pop()), w = _4), a.pointsSame(k, x) ? (s.splice(g, 1), a.pointsCollinear(T2, k, w) && (b ? (o && o.chainRemoveTail(f.index, w), y.pop()) : (o && o.chainRemoveHead(f.index, w), y.shift())), o && o.chainClose(f.index), void i.push(y)) : void (b ? (o && o.chainAddHead(f.index, x), y.unshift(x)) : (o && o.chainAddTail(f.index, x), y.push(x)));
            }
            var A2 = f.index, S2 = h.index;
            o && o.chainConnect(A2, S2);
            var C2 = s[A2].length < s[S2].length;
            f.matches_head ? h.matches_head ? C2 ? (F13(A2), N2(A2, S2)) : (F13(S2), N2(S2, A2)) : N2(S2, A2) : h.matches_head ? N2(A2, S2) : C2 ? (F13(A2), N2(S2, A2)) : (F13(S2), N2(A2, S2));
          }
          function E2(D2, I2, O2) {
            return p.index = D2, p.matches_head = I2, p.matches_pt1 = O2, p === f ? (p = h, false) : (p = null, true);
          }
          function F13(D2) {
            o && o.chainReverse(D2), s[D2].reverse();
          }
          function N2(D2, I2) {
            var O2 = s[D2], L2 = s[I2], V2 = O2[O2.length - 1], W2 = O2[O2.length - 2], X2 = L2[0], Y2 = L2[1];
            a.pointsCollinear(W2, V2, X2) && (o && o.chainRemoveTail(D2, V2), O2.pop(), V2 = W2), a.pointsCollinear(V2, X2, Y2) && (o && o.chainRemoveHead(I2, X2), L2.shift()), o && o.chainJoin(D2, I2), s[D2] = O2.concat(L2), s.splice(I2, 1);
          }
        }), i;
      };
    }, {}], 261: [function(e, t, r) {
      function n(o, s, i) {
        var l = [];
        return o.forEach(function(u2) {
          var c = (u2.myFill.above ? 8 : 0) + (u2.myFill.below ? 4 : 0) + (u2.otherFill && u2.otherFill.above ? 2 : 0) + (u2.otherFill && u2.otherFill.below ? 1 : 0);
          s[c] !== 0 && l.push({ id: i ? i.segmentId() : -1, start: u2.start, end: u2.end, myFill: { above: s[c] === 1, below: s[c] === 2 }, otherFill: null });
        }), i && i.selected(l), l;
      }
      var a = { union: function(o, s) {
        return n(o, [0, 2, 1, 0, 2, 2, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0], s);
      }, intersect: function(o, s) {
        return n(o, [0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 1, 1, 0, 2, 1, 0], s);
      }, difference: function(o, s) {
        return n(o, [0, 0, 0, 0, 2, 0, 2, 0, 1, 1, 0, 0, 0, 1, 2, 0], s);
      }, differenceRev: function(o, s) {
        return n(o, [0, 2, 1, 0, 0, 0, 1, 1, 0, 2, 0, 2, 0, 0, 0, 0], s);
      }, xor: function(o, s) {
        return n(o, [0, 2, 1, 0, 2, 0, 0, 1, 1, 0, 0, 2, 0, 1, 2, 0], s);
      } };
      t.exports = a;
    }, {}], 262: [function(e, t, r) {
      "use strict";
      var n = e("stream").Transform, a = e("stream-parser");
      function o() {
        n.call(this, { readableObjectMode: true });
      }
      function s(i, l, u2) {
        Error.call(this), Error.captureStackTrace(this, this.constructor), this.name = this.constructor.name, this.message = i, l && (this.code = l), u2 && (this.statusCode = u2);
      }
      o.prototype = Object.create(n.prototype), o.prototype.constructor = o, a(o.prototype), r.ParserStream = o, r.sliceEq = function(i, l, u2) {
        for (var c = l, f = 0; f < u2.length; ) if (i[c++] !== u2[f++]) return false;
        return true;
      }, r.str2arr = function(i, l) {
        var u2 = [], c = 0;
        if (l && l === "hex") for (; c < i.length; ) u2.push(parseInt(i.slice(c, c + 2), 16)), c += 2;
        else for (; c < i.length; c++) u2.push(255 & i.charCodeAt(c));
        return u2;
      }, r.readUInt16LE = function(i, l) {
        return i[l] | i[l + 1] << 8;
      }, r.readUInt16BE = function(i, l) {
        return i[l + 1] | i[l] << 8;
      }, r.readUInt32LE = function(i, l) {
        return i[l] | i[l + 1] << 8 | i[l + 2] << 16 | 16777216 * i[l + 3];
      }, r.readUInt32BE = function(i, l) {
        return i[l + 3] | i[l + 2] << 8 | i[l + 1] << 16 | 16777216 * i[l];
      }, s.prototype = Object.create(Error.prototype), s.prototype.constructor = s, r.ProbeError = s;
    }, { stream: 285, "stream-parser": 301 }], 263: [function(e, t, r) {
      "use strict";
      function n(s, i) {
        var l = new Error(s);
        return l.code = i, l;
      }
      function a(s) {
        try {
          return decodeURIComponent(escape(s));
        } catch {
          return s;
        }
      }
      function o(s, i, l) {
        this.input = s.subarray(i, l), this.start = i;
        var u2 = String.fromCharCode.apply(null, this.input.subarray(0, 4));
        if (u2 !== "II*\0" && u2 !== "MM\0*") throw n("invalid TIFF signature", "EBADDATA");
        this.big_endian = u2[0] === "M";
      }
      o.prototype.each = function(s) {
        this.aborted = false;
        var i = this.read_uint32(4);
        for (this.ifds_to_read = [{ id: 0, offset: i }]; this.ifds_to_read.length > 0 && !this.aborted; ) {
          var l = this.ifds_to_read.shift();
          l.offset && this.scan_ifd(l.id, l.offset, s);
        }
      }, o.prototype.read_uint16 = function(s) {
        var i = this.input;
        if (s + 2 > i.length) throw n("unexpected EOF", "EBADDATA");
        return this.big_endian ? 256 * i[s] + i[s + 1] : i[s] + 256 * i[s + 1];
      }, o.prototype.read_uint32 = function(s) {
        var i = this.input;
        if (s + 4 > i.length) throw n("unexpected EOF", "EBADDATA");
        return this.big_endian ? 16777216 * i[s] + 65536 * i[s + 1] + 256 * i[s + 2] + i[s + 3] : i[s] + 256 * i[s + 1] + 65536 * i[s + 2] + 16777216 * i[s + 3];
      }, o.prototype.is_subifd_link = function(s, i) {
        return s === 0 && i === 34665 || s === 0 && i === 34853 || s === 34665 && i === 40965;
      }, o.prototype.exif_format_length = function(s) {
        switch (s) {
          case 1:
          case 2:
          case 6:
          case 7:
            return 1;
          case 3:
          case 8:
            return 2;
          case 4:
          case 9:
          case 11:
            return 4;
          case 5:
          case 10:
          case 12:
            return 8;
          default:
            return 0;
        }
      }, o.prototype.exif_format_read = function(s, i) {
        var l;
        switch (s) {
          case 1:
          case 2:
            return l = this.input[i];
          case 6:
            return (l = this.input[i]) | 33554430 * (128 & l);
          case 3:
            return l = this.read_uint16(i);
          case 8:
            return (l = this.read_uint16(i)) | 131070 * (32768 & l);
          case 4:
            return l = this.read_uint32(i);
          case 9:
            return 0 | (l = this.read_uint32(i));
          case 5:
          case 10:
          case 11:
          case 12:
          case 7:
          default:
            return null;
        }
      }, o.prototype.scan_ifd = function(s, i, l) {
        var u2 = this.read_uint16(i);
        i += 2;
        for (var c = 0; c < u2; c++) {
          var f = this.read_uint16(i), h = this.read_uint16(i + 2), p = this.read_uint32(i + 4), d = this.exif_format_length(h), v = p * d, m = v <= 4 ? i + 8 : this.read_uint32(i + 8), g = false;
          if (m + v > this.input.length) throw n("unexpected EOF", "EBADDATA");
          for (var x = [], b = m, y = 0; y < p; y++, b += d) {
            var w = this.exif_format_read(h, b);
            if (w === null) {
              x = null;
              break;
            }
            x.push(w);
          }
          if (Array.isArray(x) && h === 2 && (x = a(String.fromCharCode.apply(null, x))) && x[x.length - 1] === "\0" && (x = x.slice(0, -1)), this.is_subifd_link(s, f) && Array.isArray(x) && Number.isInteger(x[0]) && x[0] > 0 && (this.ifds_to_read.push({ id: f, offset: x[0] }), g = true), l({ is_big_endian: this.big_endian, ifd: s, tag: f, format: h, count: p, entry_offset: i + this.start, data_length: v, data_offset: m + this.start, value: x, is_subifd_link: g }) === false) return void (this.aborted = true);
          i += 12;
        }
        s === 0 && this.ifds_to_read.push({ id: 1, offset: this.read_uint32(i) });
      }, t.exports.ExifParser = o, t.exports.get_orientation = function(s) {
        var i = 0;
        try {
          return new o(s, 0, s.length).each(function(l) {
            if (l.ifd === 0 && l.tag === 274 && Array.isArray(l.value)) return i = l.value[0], false;
          }), i;
        } catch {
          return -1;
        }
      };
    }, {}], 264: [function(e, t, r) {
      "use strict";
      var n = e("./common").readUInt16BE, a = e("./common").readUInt32BE;
      function o(f, h) {
        if (f.length < 4 + h) return null;
        var p = a(f, h);
        return f.length < p + h || p < 8 ? null : { boxtype: String.fromCharCode.apply(null, f.slice(h + 4, h + 8)), data: f.slice(h + 8, h + p), end: h + p };
      }
      function s(f, h) {
        for (var p = 0; ; ) {
          var d = o(f, p);
          if (!d) break;
          switch (d.boxtype) {
            case "ispe":
              h.sizes.push({ width: a(d.data, 4), height: a(d.data, 8) });
              break;
            case "irot":
              h.transforms.push({ type: "irot", value: 3 & d.data[0] });
              break;
            case "imir":
              h.transforms.push({ type: "imir", value: 1 & d.data[0] });
          }
          p = d.end;
        }
      }
      function i(f, h, p) {
        for (var d = 0, v = 0; v < p; v++) d = 256 * d + (f[h + v] || 0);
        return d;
      }
      function l(f, h) {
        for (var p = f[4] >> 4 & 15, d = 15 & f[4], v = f[5] >> 4 & 15, m = n(f, 6), g = 8, x = 0; x < m; x++) {
          var b = n(f, g), y = n(f, g += 2), w = i(f, g += 2, v), _4 = n(f, g += v);
          if (g += 2, y === 0 && _4 === 1) {
            var k = i(f, g, p), T2 = i(f, g + p, d);
            h.item_loc[b] = { length: T2, offset: k + w };
          }
          g += _4 * (p + d);
        }
      }
      function u2(f, h) {
        for (var p = n(f, 4), d = 6, v = 0; v < p; v++) {
          var m = o(f, d);
          if (!m) break;
          if (m.boxtype === "infe") {
            for (var g = n(m.data, 4), x = "", b = 8; b < m.data.length && m.data[b]; b++) x += String.fromCharCode(m.data[b]);
            h.item_inf[x] = g;
          }
          d = m.end;
        }
      }
      function c(f, h) {
        for (var p = 0; ; ) {
          var d = o(f, p);
          if (!d) break;
          d.boxtype === "ipco" && s(d.data, h), p = d.end;
        }
      }
      t.exports.unbox = o, t.exports.readSizeFromMeta = function(f) {
        var h = { sizes: [], transforms: [], item_inf: {}, item_loc: {} };
        if (function(b, y) {
          for (var w = 4; ; ) {
            var _4 = o(b, w);
            if (!_4) break;
            _4.boxtype === "iprp" && c(_4.data, y), _4.boxtype === "iloc" && l(_4.data, y), _4.boxtype === "iinf" && u2(_4.data, y), w = _4.end;
          }
        }(f, h), h.sizes.length) {
          var p, d, v, m = (p = h.sizes, d = p.reduce(function(b, y) {
            return b.width > y.width || b.width === y.width && b.height > y.height ? b : y;
          }), v = p.reduce(function(b, y) {
            return b.height > y.height || b.height === y.height && b.width > y.width ? b : y;
          }), d.width > v.height || d.width === v.height && d.height > v.width ? d : v), g = 1;
          h.transforms.forEach(function(b) {
            var y = { 1: 6, 2: 5, 3: 8, 4: 7, 5: 4, 6: 3, 7: 2, 8: 1 }, w = { 1: 4, 2: 3, 3: 2, 4: 1, 5: 6, 6: 5, 7: 8, 8: 7 };
            if (b.type === "imir" && (g = b.value === 0 ? w[g] : y[g = y[g = w[g]]]), b.type === "irot") for (var _4 = 0; _4 < b.value; _4++) g = y[g];
          });
          var x = null;
          return h.item_inf.Exif && (x = h.item_loc[h.item_inf.Exif]), { width: m.width, height: m.height, orientation: h.transforms.length ? g : null, variants: h.sizes, exif_location: x };
        }
      }, t.exports.getMimeType = function(f) {
        var h = String.fromCharCode.apply(null, f.slice(0, 4)), p = {};
        p[h] = true;
        for (var d = 8; d < f.length; d += 4) p[String.fromCharCode.apply(null, f.slice(d, d + 4))] = true;
        if (p.mif1 || p.msf1 || p.miaf) return h === "avif" || h === "avis" || h === "avio" ? { type: "avif", mime: "image/avif" } : h === "heic" || h === "heix" ? { type: "heic", mime: "image/heic" } : h === "hevc" || h === "hevx" ? { type: "heic", mime: "image/heic-sequence" } : p.avif || p.avis ? { type: "avif", mime: "image/avif" } : p.heic || p.heix || p.hevc || p.hevx || p.heis ? p.msf1 ? { type: "heif", mime: "image/heif-sequence" } : { type: "heif", mime: "image/heif" } : { type: "avif", mime: "image/avif" };
      };
    }, { "./common": 262 }], 265: [function(e, t, r) {
      "use strict";
      var n = e("../common").str2arr, a = e("../common").sliceEq, o = e("../common").readUInt32BE, s = e("../miaf_utils"), i = e("../exif_utils"), l = n("ftyp");
      t.exports = function(u2) {
        if (a(u2, 4, l)) {
          var c = s.unbox(u2, 0);
          if (c) {
            var f = s.getMimeType(c.data);
            if (f) {
              for (var h, p = c.end; ; ) {
                var d = s.unbox(u2, p);
                if (!d) break;
                if (p = d.end, d.boxtype === "mdat") return;
                if (d.boxtype === "meta") {
                  h = d.data;
                  break;
                }
              }
              if (h) {
                var v = s.readSizeFromMeta(h);
                if (v) {
                  var m = { width: v.width, height: v.height, type: f.type, mime: f.mime, wUnits: "px", hUnits: "px" };
                  if (v.variants.length > 1 && (m.variants = v.variants), v.orientation && (m.orientation = v.orientation), v.exif_location && v.exif_location.offset + v.exif_location.length <= u2.length) {
                    var g = o(u2, v.exif_location.offset), x = u2.slice(v.exif_location.offset + g + 4, v.exif_location.offset + v.exif_location.length), b = i.get_orientation(x);
                    b > 0 && (m.orientation = b);
                  }
                  return m;
                }
              }
            }
          }
        }
      };
    }, { "../common": 262, "../exif_utils": 263, "../miaf_utils": 264 }], 266: [function(e, t, r) {
      "use strict";
      var n = e("../common").str2arr, a = e("../common").sliceEq, o = e("../common").readUInt16LE, s = n("BM");
      t.exports = function(i) {
        if (!(i.length < 26) && a(i, 0, s)) return { width: o(i, 18), height: o(i, 22), type: "bmp", mime: "image/bmp", wUnits: "px", hUnits: "px" };
      };
    }, { "../common": 262 }], 267: [function(e, t, r) {
      "use strict";
      var n = e("../common").str2arr, a = e("../common").sliceEq, o = e("../common").readUInt16LE, s = n("GIF87a"), i = n("GIF89a");
      t.exports = function(l) {
        if (!(l.length < 10) && (a(l, 0, s) || a(l, 0, i))) return { width: o(l, 6), height: o(l, 8), type: "gif", mime: "image/gif", wUnits: "px", hUnits: "px" };
      };
    }, { "../common": 262 }], 268: [function(e, t, r) {
      "use strict";
      var n = e("../common").readUInt16LE;
      t.exports = function(a) {
        var o = n(a, 0), s = n(a, 2), i = n(a, 4);
        if (o === 0 && s === 1 && i) {
          for (var l = [], u2 = { width: 0, height: 0 }, c = 0; c < i; c++) {
            var f = a[6 + 16 * c] || 256, h = a[6 + 16 * c + 1] || 256, p = { width: f, height: h };
            l.push(p), (f > u2.width || h > u2.height) && (u2 = p);
          }
          return { width: u2.width, height: u2.height, variants: l, type: "ico", mime: "image/x-icon", wUnits: "px", hUnits: "px" };
        }
      };
    }, { "../common": 262 }], 269: [function(e, t, r) {
      "use strict";
      var n = e("../common").readUInt16BE, a = e("../common").str2arr, o = e("../common").sliceEq, s = e("../exif_utils"), i = a("Exif\0\0");
      t.exports = function(l) {
        if (!(l.length < 2) && l[0] === 255 && l[1] === 216 && l[2] === 255) for (var u2 = 2; ; ) {
          for (; ; ) {
            if (l.length - u2 < 2) return;
            if (l[u2++] === 255) break;
          }
          for (var c, f, h = l[u2++]; h === 255; ) h = l[u2++];
          if (208 <= h && h <= 217 || h === 1) c = 0;
          else {
            if (!(192 <= h && h <= 254) || l.length - u2 < 2) return;
            c = n(l, u2) - 2, u2 += 2;
          }
          if (h === 217 || h === 218) return;
          if (h === 225 && c >= 10 && o(l, u2, i) && (f = s.get_orientation(l.slice(u2 + 6, u2 + c))), c >= 5 && 192 <= h && h <= 207 && h !== 196 && h !== 200 && h !== 204) {
            if (l.length - u2 < c) return;
            var p = { width: n(l, u2 + 3), height: n(l, u2 + 1), type: "jpg", mime: "image/jpeg", wUnits: "px", hUnits: "px" };
            return f > 0 && (p.orientation = f), p;
          }
          u2 += c;
        }
      };
    }, { "../common": 262, "../exif_utils": 263 }], 270: [function(e, t, r) {
      "use strict";
      var n = e("../common").str2arr, a = e("../common").sliceEq, o = e("../common").readUInt32BE, s = n(`\x89PNG\r

`), i = n("IHDR");
      t.exports = function(l) {
        if (!(l.length < 24) && a(l, 0, s) && a(l, 12, i)) return { width: o(l, 16), height: o(l, 20), type: "png", mime: "image/png", wUnits: "px", hUnits: "px" };
      };
    }, { "../common": 262 }], 271: [function(e, t, r) {
      "use strict";
      var n = e("../common").str2arr, a = e("../common").sliceEq, o = e("../common").readUInt32BE, s = n("8BPS\0");
      t.exports = function(i) {
        if (!(i.length < 22) && a(i, 0, s)) return { width: o(i, 18), height: o(i, 14), type: "psd", mime: "image/vnd.adobe.photoshop", wUnits: "px", hUnits: "px" };
      };
    }, { "../common": 262 }], 272: [function(e, t, r) {
      "use strict";
      function n(f) {
        return typeof f == "number" && isFinite(f) && f > 0;
      }
      var a = /<[-_.:a-zA-Z0-9][^>]*>/, o = /^<([-_.:a-zA-Z0-9]+:)?svg\s/, s = /[^-]\bwidth="([^%]+?)"|[^-]\bwidth='([^%]+?)'/, i = /\bheight="([^%]+?)"|\bheight='([^%]+?)'/, l = /\bview[bB]ox="(.+?)"|\bview[bB]ox='(.+?)'/, u2 = /in$|mm$|cm$|pt$|pc$|px$|em$|ex$/;
      function c(f) {
        return u2.test(f) ? f.match(u2)[0] : "px";
      }
      t.exports = function(f) {
        if (function(k) {
          var T2, A2 = 0, S2 = k.length;
          for (k[0] === 239 && k[1] === 187 && k[2] === 191 && (A2 = 3); A2 < S2 && ((T2 = k[A2]) === 32 || T2 === 9 || T2 === 13 || T2 === 10); ) A2++;
          return A2 !== S2 && k[A2] === 60;
        }(f)) {
          for (var h = "", p = 0; p < f.length; p++) h += String.fromCharCode(f[p]);
          var d = (h.match(a) || [""])[0];
          if (o.test(d)) {
            var v = function(k) {
              var T2 = k.match(s), A2 = k.match(i), S2 = k.match(l);
              return { width: T2 && (T2[1] || T2[2]), height: A2 && (A2[1] || A2[2]), viewbox: S2 && (S2[1] || S2[2]) };
            }(d), m = parseFloat(v.width), g = parseFloat(v.height);
            if (v.width && v.height) return !n(m) || !n(g) ? void 0 : { width: m, height: g, type: "svg", mime: "image/svg+xml", wUnits: c(v.width), hUnits: c(v.height) };
            var x = (v.viewbox || "").split(" "), b = { width: x[2], height: x[3] }, y = parseFloat(b.width), w = parseFloat(b.height);
            if (n(y) && n(w) && c(b.width) === c(b.height)) {
              var _4 = y / w;
              return v.width ? n(m) ? { width: m, height: m / _4, type: "svg", mime: "image/svg+xml", wUnits: c(v.width), hUnits: c(v.width) } : void 0 : v.height ? n(g) ? { width: g * _4, height: g, type: "svg", mime: "image/svg+xml", wUnits: c(v.height), hUnits: c(v.height) } : void 0 : { width: y, height: w, type: "svg", mime: "image/svg+xml", wUnits: c(b.width), hUnits: c(b.height) };
            }
          }
        }
      };
    }, {}], 273: [function(e, t, r) {
      "use strict";
      var n = e("../common").str2arr, a = e("../common").sliceEq, o = e("../common").readUInt16LE, s = e("../common").readUInt16BE, i = e("../common").readUInt32LE, l = e("../common").readUInt32BE, u2 = n("II*\0"), c = n("MM\0*");
      function f(d, v, m) {
        return m ? s(d, v) : o(d, v);
      }
      function h(d, v, m) {
        return m ? l(d, v) : i(d, v);
      }
      function p(d, v, m) {
        var g = f(d, v + 2, m);
        return h(d, v + 4, m) !== 1 || g !== 3 && g !== 4 ? null : g === 3 ? f(d, v + 8, m) : h(d, v + 8, m);
      }
      t.exports = function(d) {
        if (!(d.length < 8) && (a(d, 0, u2) || a(d, 0, c))) {
          var v = d[0] === 77, m = h(d, 4, v) - 8;
          if (!(m < 0)) {
            var g = m + 8;
            if (!(d.length - g < 2)) {
              var x = 12 * f(d, g + 0, v);
              if (!(x <= 0 || (g += 2, d.length - g < x))) {
                var b, y, w, _4;
                for (b = 0; b < x; b += 12) (_4 = f(d, g + b, v)) === 256 ? y = p(d, g + b, v) : _4 === 257 && (w = p(d, g + b, v));
                return y && w ? { width: y, height: w, type: "tiff", mime: "image/tiff", wUnits: "px", hUnits: "px" } : void 0;
              }
            }
          }
        }
      };
    }, { "../common": 262 }], 274: [function(e, t, r) {
      "use strict";
      var n = e("../common").str2arr, a = e("../common").sliceEq, o = e("../common").readUInt16LE, s = e("../common").readUInt32LE, i = e("../exif_utils"), l = n("RIFF"), u2 = n("WEBP");
      function c(p, d) {
        if (p[d + 3] === 157 && p[d + 4] === 1 && p[d + 5] === 42) return { width: 16383 & o(p, d + 6), height: 16383 & o(p, d + 8), type: "webp", mime: "image/webp", wUnits: "px", hUnits: "px" };
      }
      function f(p, d) {
        if (p[d] === 47) {
          var v = s(p, d + 1);
          return { width: 1 + (16383 & v), height: 1 + (v >> 14 & 16383), type: "webp", mime: "image/webp", wUnits: "px", hUnits: "px" };
        }
      }
      function h(p, d) {
        return { width: 1 + (p[d + 6] << 16 | p[d + 5] << 8 | p[d + 4]), height: 1 + (p[d + 9] << d | p[d + 8] << 8 | p[d + 7]), type: "webp", mime: "image/webp", wUnits: "px", hUnits: "px" };
      }
      t.exports = function(p) {
        if (!(p.length < 16) && (a(p, 0, l) || a(p, 8, u2))) {
          var d = 12, v = null, m = 0, g = s(p, 4) + 8;
          if (!(g > p.length)) {
            for (; d + 8 < g; ) if (p[d] !== 0) {
              var x = String.fromCharCode.apply(null, p.slice(d, d + 4)), b = s(p, d + 4);
              x === "VP8 " && b >= 10 ? v = v || c(p, d + 8) : x === "VP8L" && b >= 9 ? v = v || f(p, d + 8) : x === "VP8X" && b >= 10 ? v = v || h(p, d + 8) : x === "EXIF" && (m = i.get_orientation(p.slice(d + 8, d + 8 + b)), d = 1 / 0), d += 8 + b;
            } else d++;
            if (v) return m > 0 && (v.orientation = m), v;
          }
        }
      };
    }, { "../common": 262, "../exif_utils": 263 }], 275: [function(e, t, r) {
      "use strict";
      t.exports = { avif: e("./parse_sync/avif"), bmp: e("./parse_sync/bmp"), gif: e("./parse_sync/gif"), ico: e("./parse_sync/ico"), jpeg: e("./parse_sync/jpeg"), png: e("./parse_sync/png"), psd: e("./parse_sync/psd"), svg: e("./parse_sync/svg"), tiff: e("./parse_sync/tiff"), webp: e("./parse_sync/webp") };
    }, { "./parse_sync/avif": 265, "./parse_sync/bmp": 266, "./parse_sync/gif": 267, "./parse_sync/ico": 268, "./parse_sync/jpeg": 269, "./parse_sync/png": 270, "./parse_sync/psd": 271, "./parse_sync/svg": 272, "./parse_sync/tiff": 273, "./parse_sync/webp": 274 }], 276: [function(e, t, r) {
      "use strict";
      var n = e("./lib/parsers_sync");
      t.exports = function(a) {
        return function(o) {
          for (var s = Object.keys(n), i = 0; i < s.length; i++) {
            var l = n[s[i]](o);
            if (l) return l;
          }
          return null;
        }(a);
      }, t.exports.parsers = n;
    }, { "./lib/parsers_sync": 275 }], 277: [function(e, t, r) {
      var n, a, o = t.exports = {};
      function s() {
        throw new Error("setTimeout has not been defined");
      }
      function i() {
        throw new Error("clearTimeout has not been defined");
      }
      function l(g) {
        if (n === setTimeout) return setTimeout(g, 0);
        if ((n === s || !n) && setTimeout) return n = setTimeout, setTimeout(g, 0);
        try {
          return n(g, 0);
        } catch {
          try {
            return n.call(null, g, 0);
          } catch {
            return n.call(this, g, 0);
          }
        }
      }
      (function() {
        try {
          n = typeof setTimeout == "function" ? setTimeout : s;
        } catch {
          n = s;
        }
        try {
          a = typeof clearTimeout == "function" ? clearTimeout : i;
        } catch {
          a = i;
        }
      })();
      var u2, c = [], f = false, h = -1;
      function p() {
        f && u2 && (f = false, u2.length ? c = u2.concat(c) : h = -1, c.length && d());
      }
      function d() {
        if (!f) {
          var g = l(p);
          f = true;
          for (var x = c.length; x; ) {
            for (u2 = c, c = []; ++h < x; ) u2 && u2[h].run();
            h = -1, x = c.length;
          }
          u2 = null, f = false, function(b) {
            if (a === clearTimeout) return clearTimeout(b);
            if ((a === i || !a) && clearTimeout) return a = clearTimeout, clearTimeout(b);
            try {
              a(b);
            } catch {
              try {
                return a.call(null, b);
              } catch {
                return a.call(this, b);
              }
            }
          }(g);
        }
      }
      function v(g, x) {
        this.fun = g, this.array = x;
      }
      function m() {
      }
      o.nextTick = function(g) {
        var x = new Array(arguments.length - 1);
        if (arguments.length > 1) for (var b = 1; b < arguments.length; b++) x[b - 1] = arguments[b];
        c.push(new v(g, x)), c.length !== 1 || f || l(d);
      }, v.prototype.run = function() {
        this.fun.apply(null, this.array);
      }, o.title = "browser", o.browser = true, o.env = {}, o.argv = [], o.version = "", o.versions = {}, o.on = m, o.addListener = m, o.once = m, o.off = m, o.removeListener = m, o.removeAllListeners = m, o.emit = m, o.prependListener = m, o.prependOnceListener = m, o.listeners = function(g) {
        return [];
      }, o.binding = function(g) {
        throw new Error("process.binding is not supported");
      }, o.cwd = function() {
        return "/";
      }, o.chdir = function(g) {
        throw new Error("process.chdir is not supported");
      }, o.umask = function() {
        return 0;
      };
    }, {}], 278: [function(e, t, r) {
      (function(n) {
        (function() {
          for (var a = e("performance-now"), o = typeof window > "u" ? n : window, s = ["moz", "webkit"], i = "AnimationFrame", l = o["request" + i], u2 = o["cancel" + i] || o["cancelRequest" + i], c = 0; !l && c < s.length; c++) l = o[s[c] + "Request" + i], u2 = o[s[c] + "Cancel" + i] || o[s[c] + "CancelRequest" + i];
          if (!l || !u2) {
            var f = 0, h = 0, p = [];
            l = function(d) {
              if (p.length === 0) {
                var v = a(), m = Math.max(0, 1e3 / 60 - (v - f));
                f = m + v, setTimeout(function() {
                  var g = p.slice(0);
                  p.length = 0;
                  for (var x = 0; x < g.length; x++) if (!g[x].cancelled) try {
                    g[x].callback(f);
                  } catch (b) {
                    setTimeout(function() {
                      throw b;
                    }, 0);
                  }
                }, Math.round(m));
              }
              return p.push({ handle: ++h, callback: d, cancelled: false }), h;
            }, u2 = function(d) {
              for (var v = 0; v < p.length; v++) p[v].handle === d && (p[v].cancelled = true);
            };
          }
          t.exports = function(d) {
            return l.call(o, d);
          }, t.exports.cancel = function() {
            u2.apply(o, arguments);
          }, t.exports.polyfill = function(d) {
            d || (d = o), d.requestAnimationFrame = l, d.cancelAnimationFrame = u2;
          };
        }).call(this);
      }).call(this, typeof global < "u" ? global : typeof self < "u" ? self : typeof window < "u" ? window : {});
    }, { "performance-now": 252 }], 279: [function(e, t, r) {
      "use strict";
      var n = e("array-bounds"), a = e("color-normalize"), o = e("update-diff"), s = e("pick-by-alias"), i = e("object-assign"), l = e("flatten-vertex-data"), u2 = e("to-float32"), c = u2.float32, f = u2.fract32;
      t.exports = function(p, d) {
        if (typeof p == "function" ? (d || (d = {}), d.regl = p) : d = p, d.length && (d.positions = d), !(p = d.regl).hasExtension("ANGLE_instanced_arrays")) throw Error("regl-error2d: `ANGLE_instanced_arrays` extension should be enabled");
        var v, m, g, x, b, y, w = p._gl, _4 = { color: "black", capSize: 5, lineWidth: 1, opacity: 1, viewport: null, range: null, offset: 0, count: 0, bounds: null, positions: [], errors: [] }, k = [];
        return x = p.buffer({ usage: "dynamic", type: "uint8", data: new Uint8Array(0) }), m = p.buffer({ usage: "dynamic", type: "float", data: new Uint8Array(0) }), g = p.buffer({ usage: "dynamic", type: "float", data: new Uint8Array(0) }), b = p.buffer({ usage: "dynamic", type: "float", data: new Uint8Array(0) }), y = p.buffer({ usage: "static", type: "float", data: h }), C2(d), v = p({ vert: `
		precision highp float;

		attribute vec2 position, positionFract;
		attribute vec4 error;
		attribute vec4 color;

		attribute vec2 direction, lineOffset, capOffset;

		uniform vec4 viewport;
		uniform float lineWidth, capSize;
		uniform vec2 scale, scaleFract, translate, translateFract;

		varying vec4 fragColor;

		void main() {
			fragColor = color / 255.;

			vec2 pixelOffset = lineWidth * lineOffset + (capSize + lineWidth) * capOffset;

			vec2 dxy = -step(.5, direction.xy) * error.xz + step(direction.xy, vec2(-.5)) * error.yw;

			vec2 position = position + dxy;

			vec2 pos = (position + translate) * scale
				+ (positionFract + translateFract) * scale
				+ (position + translate) * scaleFract
				+ (positionFract + translateFract) * scaleFract;

			pos += pixelOffset / viewport.zw;

			gl_Position = vec4(pos * 2. - 1., 0, 1);
		}
		`, frag: `
		precision highp float;

		varying vec4 fragColor;

		uniform float opacity;

		void main() {
			gl_FragColor = fragColor;
			gl_FragColor.a *= opacity;
		}
		`, uniforms: { range: p.prop("range"), lineWidth: p.prop("lineWidth"), capSize: p.prop("capSize"), opacity: p.prop("opacity"), scale: p.prop("scale"), translate: p.prop("translate"), scaleFract: p.prop("scaleFract"), translateFract: p.prop("translateFract"), viewport: function(F13, N2) {
          return [N2.viewport.x, N2.viewport.y, F13.viewportWidth, F13.viewportHeight];
        } }, attributes: { color: { buffer: x, offset: function(F13, N2) {
          return 4 * N2.offset;
        }, divisor: 1 }, position: { buffer: m, offset: function(F13, N2) {
          return 8 * N2.offset;
        }, divisor: 1 }, positionFract: { buffer: g, offset: function(F13, N2) {
          return 8 * N2.offset;
        }, divisor: 1 }, error: { buffer: b, offset: function(F13, N2) {
          return 16 * N2.offset;
        }, divisor: 1 }, direction: { buffer: y, stride: 24, offset: 0 }, lineOffset: { buffer: y, stride: 24, offset: 8 }, capOffset: { buffer: y, stride: 24, offset: 16 } }, primitive: "triangles", blend: { enable: true, color: [0, 0, 0, 0], equation: { rgb: "add", alpha: "add" }, func: { srcRGB: "src alpha", dstRGB: "one minus src alpha", srcAlpha: "one minus dst alpha", dstAlpha: "one" } }, depth: { enable: false }, scissor: { enable: true, box: p.prop("viewport") }, viewport: p.prop("viewport"), stencil: false, instances: p.prop("count"), count: h.length }), i(T2, { update: C2, draw: A2, destroy: E2, regl: p, gl: w, canvas: w.canvas, groups: k }), T2;
        function T2(F13) {
          F13 ? C2(F13) : F13 === null && E2(), A2();
        }
        function A2(F13) {
          if (typeof F13 == "number") return S2(F13);
          F13 && !Array.isArray(F13) && (F13 = [F13]), p._refresh(), k.forEach(function(N2, D2) {
            N2 && (F13 && (F13[D2] ? N2.draw = true : N2.draw = false), N2.draw ? S2(D2) : N2.draw = true);
          });
        }
        function S2(F13) {
          typeof F13 == "number" && (F13 = k[F13]), F13 != null && F13 && F13.count && F13.color && F13.opacity && F13.positions && F13.positions.length > 1 && (F13.scaleRatio = [F13.scale[0] * F13.viewport.width, F13.scale[1] * F13.viewport.height], v(F13), F13.after && F13.after(F13));
        }
        function C2(F13) {
          if (F13) {
            F13.length != null ? typeof F13[0] == "number" && (F13 = [{ positions: F13 }]) : Array.isArray(F13) || (F13 = [F13]);
            var N2 = 0, D2 = 0;
            if (T2.groups = k = F13.map(function(Y2, K2) {
              var q = k[K2];
              return Y2 && (typeof Y2 == "function" ? Y2 = { after: Y2 } : typeof Y2[0] == "number" && (Y2 = { positions: Y2 }), Y2 = s(Y2, { color: "color colors fill", capSize: "capSize cap capsize cap-size", lineWidth: "lineWidth line-width width line thickness", opacity: "opacity alpha", range: "range dataBox", viewport: "viewport viewBox", errors: "errors error", positions: "positions position data points" }), q || (k[K2] = q = { id: K2, scale: null, translate: null, scaleFract: null, translateFract: null, draw: true }, Y2 = i({}, _4, Y2)), o(q, Y2, [{ lineWidth: function(re) {
                return 0.5 * +re;
              }, capSize: function(re) {
                return 0.5 * +re;
              }, opacity: parseFloat, errors: function(re) {
                return re = l(re), D2 += re.length, re;
              }, positions: function(re, R2) {
                return re = l(re, "float64"), R2.count = Math.floor(re.length / 2), R2.bounds = n(re, 2), R2.offset = N2, N2 += R2.count, re;
              } }, { color: function(re, R2) {
                var z = R2.count;
                if (re || (re = "transparent"), !Array.isArray(re) || typeof re[0] == "number") {
                  var H2 = re;
                  re = Array(z);
                  for (var te = 0; te < z; te++) re[te] = H2;
                }
                if (re.length < z) throw Error("Not enough colors");
                for (var j = new Uint8Array(4 * z), Q2 = 0; Q2 < z; Q2++) {
                  var Z2 = a(re[Q2], "uint8");
                  j.set(Z2, 4 * Q2);
                }
                return j;
              }, range: function(re, R2, z) {
                var H2 = R2.bounds;
                return re || (re = H2), R2.scale = [1 / (re[2] - re[0]), 1 / (re[3] - re[1])], R2.translate = [-re[0], -re[1]], R2.scaleFract = f(R2.scale), R2.translateFract = f(R2.translate), re;
              }, viewport: function(re) {
                var R2;
                return Array.isArray(re) ? R2 = { x: re[0], y: re[1], width: re[2] - re[0], height: re[3] - re[1] } : re ? (R2 = { x: re.x || re.left || 0, y: re.y || re.top || 0 }, re.right ? R2.width = re.right - R2.x : R2.width = re.w || re.width || 0, re.bottom ? R2.height = re.bottom - R2.y : R2.height = re.h || re.height || 0) : R2 = { x: 0, y: 0, width: w.drawingBufferWidth, height: w.drawingBufferHeight }, R2;
              } }])), q;
            }), N2 || D2) {
              var I2 = k.reduce(function(Y2, K2, q) {
                return Y2 + (K2 ? K2.count : 0);
              }, 0), O2 = new Float64Array(2 * I2), L2 = new Uint8Array(4 * I2), V2 = new Float32Array(4 * I2);
              k.forEach(function(Y2, K2) {
                if (Y2) {
                  var q = Y2.positions, re = Y2.count, R2 = Y2.offset, z = Y2.color, H2 = Y2.errors;
                  re && (L2.set(z, 4 * R2), V2.set(H2, 4 * R2), O2.set(q, 2 * R2));
                }
              });
              var W2 = c(O2);
              m(W2);
              var X2 = f(O2, W2);
              g(X2), x(L2), b(V2);
            }
          }
        }
        function E2() {
          m.destroy(), g.destroy(), x.destroy(), b.destroy(), y.destroy();
        }
      };
      var h = [[1, 0, 0, 1, 0, 0], [1, 0, 0, -1, 0, 0], [-1, 0, 0, -1, 0, 0], [-1, 0, 0, -1, 0, 0], [-1, 0, 0, 1, 0, 0], [1, 0, 0, 1, 0, 0], [1, 0, -1, 0, 0, 1], [1, 0, -1, 0, 0, -1], [1, 0, 1, 0, 0, -1], [1, 0, 1, 0, 0, -1], [1, 0, 1, 0, 0, 1], [1, 0, -1, 0, 0, 1], [-1, 0, -1, 0, 0, 1], [-1, 0, -1, 0, 0, -1], [-1, 0, 1, 0, 0, -1], [-1, 0, 1, 0, 0, -1], [-1, 0, 1, 0, 0, 1], [-1, 0, -1, 0, 0, 1], [0, 1, 1, 0, 0, 0], [0, 1, -1, 0, 0, 0], [0, -1, -1, 0, 0, 0], [0, -1, -1, 0, 0, 0], [0, 1, 1, 0, 0, 0], [0, -1, 1, 0, 0, 0], [0, 1, 0, -1, 1, 0], [0, 1, 0, -1, -1, 0], [0, 1, 0, 1, -1, 0], [0, 1, 0, 1, 1, 0], [0, 1, 0, -1, 1, 0], [0, 1, 0, 1, -1, 0], [0, -1, 0, -1, 1, 0], [0, -1, 0, -1, -1, 0], [0, -1, 0, 1, -1, 0], [0, -1, 0, 1, 1, 0], [0, -1, 0, -1, 1, 0], [0, -1, 0, 1, -1, 0]];
    }, { "array-bounds": 71, "color-normalize": 89, "flatten-vertex-data": 191, "object-assign": 247, "pick-by-alias": 253, "to-float32": 313, "update-diff": 329 }], 280: [function(e, t, r) {
      "use strict";
      var n = e("color-normalize"), a = e("array-bounds"), o = e("object-assign"), s = e("glslify"), i = e("pick-by-alias"), l = e("flatten-vertex-data"), u2 = e("earcut"), c = e("array-normalize"), f = e("to-float32"), h = f.float32, p = f.fract32, d = e("es6-weak-map"), v = e("parse-rect"), m = e("array-find-index");
      function g(x, b) {
        if (!(this instanceof g)) return new g(x, b);
        if (typeof x == "function" ? (b || (b = {}), b.regl = x) : b = x, b.length && (b.positions = b), !(x = b.regl).hasExtension("ANGLE_instanced_arrays")) throw Error("regl-error2d: `ANGLE_instanced_arrays` extension should be enabled");
        this.gl = x._gl, this.regl = x, this.passes = [], this.shaders = g.shaders.has(x) ? g.shaders.get(x) : g.shaders.set(x, g.createShaders(x)).get(x), this.update(b);
      }
      t.exports = g, g.dashMult = 2, g.maxPatternLength = 256, g.precisionThreshold = 3e6, g.maxPoints = 1e4, g.maxLines = 2048, g.shaders = new d(), g.createShaders = function(x) {
        var b, y = x.buffer({ usage: "static", type: "float", data: [0, 1, 0, 0, 1, 1, 1, 0] }), w = { primitive: "triangle strip", instances: x.prop("count"), count: 4, offset: 0, uniforms: { miterMode: function(k, T2) {
          return T2.join === "round" ? 2 : 1;
        }, miterLimit: x.prop("miterLimit"), scale: x.prop("scale"), scaleFract: x.prop("scaleFract"), translateFract: x.prop("translateFract"), translate: x.prop("translate"), thickness: x.prop("thickness"), dashTexture: x.prop("dashTexture"), opacity: x.prop("opacity"), pixelRatio: x.context("pixelRatio"), id: x.prop("id"), dashLength: x.prop("dashLength"), viewport: function(k, T2) {
          return [T2.viewport.x, T2.viewport.y, k.viewportWidth, k.viewportHeight];
        }, depth: x.prop("depth") }, blend: { enable: true, color: [0, 0, 0, 0], equation: { rgb: "add", alpha: "add" }, func: { srcRGB: "src alpha", dstRGB: "one minus src alpha", srcAlpha: "one minus dst alpha", dstAlpha: "one" } }, depth: { enable: function(k, T2) {
          return !T2.overlay;
        } }, stencil: { enable: false }, scissor: { enable: true, box: x.prop("viewport") }, viewport: x.prop("viewport") }, _4 = x(o({ vert: s([`precision highp float;
#define GLSLIFY 1

attribute vec2 aCoord, bCoord, aCoordFract, bCoordFract;
attribute vec4 color;
attribute float lineEnd, lineTop;

uniform vec2 scale, scaleFract, translate, translateFract;
uniform float thickness, pixelRatio, id, depth;
uniform vec4 viewport;

varying vec4 fragColor;
varying vec2 tangent;

vec2 project(vec2 position, vec2 positionFract, vec2 scale, vec2 scaleFract, vec2 translate, vec2 translateFract) {
	// the order is important
	return position * scale + translate
       + positionFract * scale + translateFract
       + position * scaleFract
       + positionFract * scaleFract;
}

void main() {
	float lineStart = 1. - lineEnd;
	float lineOffset = lineTop * 2. - 1.;

	vec2 diff = (bCoord + bCoordFract - aCoord - aCoordFract);
	tangent = normalize(diff * scale * viewport.zw);
	vec2 normal = vec2(-tangent.y, tangent.x);

	vec2 position = project(aCoord, aCoordFract, scale, scaleFract, translate, translateFract) * lineStart
		+ project(bCoord, bCoordFract, scale, scaleFract, translate, translateFract) * lineEnd

		+ thickness * normal * .5 * lineOffset / viewport.zw;

	gl_Position = vec4(position * 2.0 - 1.0, depth, 1);

	fragColor = color / 255.;
}
`]), frag: s([`precision highp float;
#define GLSLIFY 1

uniform float dashLength, pixelRatio, thickness, opacity, id;
uniform sampler2D dashTexture;

varying vec4 fragColor;
varying vec2 tangent;

void main() {
	float alpha = 1.;

	float t = fract(dot(tangent, gl_FragCoord.xy) / dashLength) * .5 + .25;
	float dash = texture2D(dashTexture, vec2(t, .5)).r;

	gl_FragColor = fragColor;
	gl_FragColor.a *= alpha * opacity * dash;
}
`]), attributes: { lineEnd: { buffer: y, divisor: 0, stride: 8, offset: 0 }, lineTop: { buffer: y, divisor: 0, stride: 8, offset: 4 }, aCoord: { buffer: x.prop("positionBuffer"), stride: 8, offset: 8, divisor: 1 }, bCoord: { buffer: x.prop("positionBuffer"), stride: 8, offset: 16, divisor: 1 }, aCoordFract: { buffer: x.prop("positionFractBuffer"), stride: 8, offset: 8, divisor: 1 }, bCoordFract: { buffer: x.prop("positionFractBuffer"), stride: 8, offset: 16, divisor: 1 }, color: { buffer: x.prop("colorBuffer"), stride: 4, offset: 0, divisor: 1 } } }, w));
        try {
          b = x(o({ cull: { enable: true, face: "back" }, vert: s([`precision highp float;
#define GLSLIFY 1

attribute vec2 aCoord, bCoord, nextCoord, prevCoord;
attribute vec4 aColor, bColor;
attribute float lineEnd, lineTop;

uniform vec2 scale, translate;
uniform float thickness, pixelRatio, id, depth;
uniform vec4 viewport;
uniform float miterLimit, miterMode;

varying vec4 fragColor;
varying vec4 startCutoff, endCutoff;
varying vec2 tangent;
varying vec2 startCoord, endCoord;
varying float enableStartMiter, enableEndMiter;

const float REVERSE_THRESHOLD = -.875;
const float MIN_DIFF = 1e-6;

// TODO: possible optimizations: avoid overcalculating all for vertices and calc just one instead
// TODO: precalculate dot products, normalize things beforehead etc.
// TODO: refactor to rectangular algorithm

float distToLine(vec2 p, vec2 a, vec2 b) {
	vec2 diff = b - a;
	vec2 perp = normalize(vec2(-diff.y, diff.x));
	return dot(p - a, perp);
}

bool isNaN( float val ){
  return ( val < 0.0 || 0.0 < val || val == 0.0 ) ? false : true;
}

void main() {
	vec2 aCoord = aCoord, bCoord = bCoord, prevCoord = prevCoord, nextCoord = nextCoord;

  vec2 adjustedScale;
  adjustedScale.x = (abs(scale.x) < MIN_DIFF) ? MIN_DIFF : scale.x;
  adjustedScale.y = (abs(scale.y) < MIN_DIFF) ? MIN_DIFF : scale.y;

  vec2 scaleRatio = adjustedScale * viewport.zw;
	vec2 normalWidth = thickness / scaleRatio;

	float lineStart = 1. - lineEnd;
	float lineBot = 1. - lineTop;

	fragColor = (lineStart * aColor + lineEnd * bColor) / 255.;

	if (isNaN(aCoord.x) || isNaN(aCoord.y) || isNaN(bCoord.x) || isNaN(bCoord.y)) return;

	if (aCoord == prevCoord) prevCoord = aCoord + normalize(bCoord - aCoord);
	if (bCoord == nextCoord) nextCoord = bCoord - normalize(bCoord - aCoord);

	vec2 prevDiff = aCoord - prevCoord;
	vec2 currDiff = bCoord - aCoord;
	vec2 nextDiff = nextCoord - bCoord;

	vec2 prevTangent = normalize(prevDiff * scaleRatio);
	vec2 currTangent = normalize(currDiff * scaleRatio);
	vec2 nextTangent = normalize(nextDiff * scaleRatio);

	vec2 prevNormal = vec2(-prevTangent.y, prevTangent.x);
	vec2 currNormal = vec2(-currTangent.y, currTangent.x);
	vec2 nextNormal = vec2(-nextTangent.y, nextTangent.x);

	vec2 startJoinDirection = normalize(prevTangent - currTangent);
	vec2 endJoinDirection = normalize(currTangent - nextTangent);

	// collapsed/unidirectional segment cases
	// FIXME: there should be more elegant solution
	vec2 prevTanDiff = abs(prevTangent - currTangent);
	vec2 nextTanDiff = abs(nextTangent - currTangent);
	if (max(prevTanDiff.x, prevTanDiff.y) < MIN_DIFF) {
		startJoinDirection = currNormal;
	}
	if (max(nextTanDiff.x, nextTanDiff.y) < MIN_DIFF) {
		endJoinDirection = currNormal;
	}
	if (aCoord == bCoord) {
		endJoinDirection = startJoinDirection;
		currNormal = prevNormal;
		currTangent = prevTangent;
	}

	tangent = currTangent;

	//calculate join shifts relative to normals
	float startJoinShift = dot(currNormal, startJoinDirection);
	float endJoinShift = dot(currNormal, endJoinDirection);

	float startMiterRatio = abs(1. / startJoinShift);
	float endMiterRatio = abs(1. / endJoinShift);

	vec2 startJoin = startJoinDirection * startMiterRatio;
	vec2 endJoin = endJoinDirection * endMiterRatio;

	vec2 startTopJoin, startBotJoin, endTopJoin, endBotJoin;
	startTopJoin = sign(startJoinShift) * startJoin * .5;
	startBotJoin = -startTopJoin;

	endTopJoin = sign(endJoinShift) * endJoin * .5;
	endBotJoin = -endTopJoin;

	vec2 aTopCoord = aCoord + normalWidth * startTopJoin;
	vec2 bTopCoord = bCoord + normalWidth * endTopJoin;
	vec2 aBotCoord = aCoord + normalWidth * startBotJoin;
	vec2 bBotCoord = bCoord + normalWidth * endBotJoin;

	//miter anti-clipping
	float baClipping = distToLine(bCoord, aCoord, aBotCoord) / dot(normalize(normalWidth * endBotJoin), normalize(normalWidth.yx * vec2(-startBotJoin.y, startBotJoin.x)));
	float abClipping = distToLine(aCoord, bCoord, bTopCoord) / dot(normalize(normalWidth * startBotJoin), normalize(normalWidth.yx * vec2(-endBotJoin.y, endBotJoin.x)));

	//prevent close to reverse direction switch
	bool prevReverse = dot(currTangent, prevTangent) <= REVERSE_THRESHOLD && abs(dot(currTangent, prevNormal)) * min(length(prevDiff), length(currDiff)) <  length(normalWidth * currNormal);
	bool nextReverse = dot(currTangent, nextTangent) <= REVERSE_THRESHOLD && abs(dot(currTangent, nextNormal)) * min(length(nextDiff), length(currDiff)) <  length(normalWidth * currNormal);

	if (prevReverse) {
		//make join rectangular
		vec2 miterShift = normalWidth * startJoinDirection * miterLimit * .5;
		float normalAdjust = 1. - min(miterLimit / startMiterRatio, 1.);
		aBotCoord = aCoord + miterShift - normalAdjust * normalWidth * currNormal * .5;
		aTopCoord = aCoord + miterShift + normalAdjust * normalWidth * currNormal * .5;
	}
	else if (!nextReverse && baClipping > 0. && baClipping < length(normalWidth * endBotJoin)) {
		//handle miter clipping
		bTopCoord -= normalWidth * endTopJoin;
		bTopCoord += normalize(endTopJoin * normalWidth) * baClipping;
	}

	if (nextReverse) {
		//make join rectangular
		vec2 miterShift = normalWidth * endJoinDirection * miterLimit * .5;
		float normalAdjust = 1. - min(miterLimit / endMiterRatio, 1.);
		bBotCoord = bCoord + miterShift - normalAdjust * normalWidth * currNormal * .5;
		bTopCoord = bCoord + miterShift + normalAdjust * normalWidth * currNormal * .5;
	}
	else if (!prevReverse && abClipping > 0. && abClipping < length(normalWidth * startBotJoin)) {
		//handle miter clipping
		aBotCoord -= normalWidth * startBotJoin;
		aBotCoord += normalize(startBotJoin * normalWidth) * abClipping;
	}

	vec2 aTopPosition = (aTopCoord) * adjustedScale + translate;
	vec2 aBotPosition = (aBotCoord) * adjustedScale + translate;

	vec2 bTopPosition = (bTopCoord) * adjustedScale + translate;
	vec2 bBotPosition = (bBotCoord) * adjustedScale + translate;

	//position is normalized 0..1 coord on the screen
	vec2 position = (aTopPosition * lineTop + aBotPosition * lineBot) * lineStart + (bTopPosition * lineTop + bBotPosition * lineBot) * lineEnd;

	startCoord = aCoord * scaleRatio + translate * viewport.zw + viewport.xy;
	endCoord = bCoord * scaleRatio + translate * viewport.zw + viewport.xy;

	gl_Position = vec4(position  * 2.0 - 1.0, depth, 1);

	enableStartMiter = step(dot(currTangent, prevTangent), .5);
	enableEndMiter = step(dot(currTangent, nextTangent), .5);

	//bevel miter cutoffs
	if (miterMode == 1.) {
		if (enableStartMiter == 1.) {
			vec2 startMiterWidth = vec2(startJoinDirection) * thickness * miterLimit * .5;
			startCutoff = vec4(aCoord, aCoord);
			startCutoff.zw += vec2(-startJoinDirection.y, startJoinDirection.x) / scaleRatio;
			startCutoff = startCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;
			startCutoff += viewport.xyxy;
			startCutoff += startMiterWidth.xyxy;
		}

		if (enableEndMiter == 1.) {
			vec2 endMiterWidth = vec2(endJoinDirection) * thickness * miterLimit * .5;
			endCutoff = vec4(bCoord, bCoord);
			endCutoff.zw += vec2(-endJoinDirection.y, endJoinDirection.x)  / scaleRatio;
			endCutoff = endCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;
			endCutoff += viewport.xyxy;
			endCutoff += endMiterWidth.xyxy;
		}
	}

	//round miter cutoffs
	else if (miterMode == 2.) {
		if (enableStartMiter == 1.) {
			vec2 startMiterWidth = vec2(startJoinDirection) * thickness * abs(dot(startJoinDirection, currNormal)) * .5;
			startCutoff = vec4(aCoord, aCoord);
			startCutoff.zw += vec2(-startJoinDirection.y, startJoinDirection.x) / scaleRatio;
			startCutoff = startCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;
			startCutoff += viewport.xyxy;
			startCutoff += startMiterWidth.xyxy;
		}

		if (enableEndMiter == 1.) {
			vec2 endMiterWidth = vec2(endJoinDirection) * thickness * abs(dot(endJoinDirection, currNormal)) * .5;
			endCutoff = vec4(bCoord, bCoord);
			endCutoff.zw += vec2(-endJoinDirection.y, endJoinDirection.x)  / scaleRatio;
			endCutoff = endCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;
			endCutoff += viewport.xyxy;
			endCutoff += endMiterWidth.xyxy;
		}
	}
}
`]), frag: s([`precision highp float;
#define GLSLIFY 1

uniform float dashLength, pixelRatio, thickness, opacity, id, miterMode;
uniform sampler2D dashTexture;

varying vec4 fragColor;
varying vec2 tangent;
varying vec4 startCutoff, endCutoff;
varying vec2 startCoord, endCoord;
varying float enableStartMiter, enableEndMiter;

float distToLine(vec2 p, vec2 a, vec2 b) {
	vec2 diff = b - a;
	vec2 perp = normalize(vec2(-diff.y, diff.x));
	return dot(p - a, perp);
}

void main() {
	float alpha = 1., distToStart, distToEnd;
	float cutoff = thickness * .5;

	//bevel miter
	if (miterMode == 1.) {
		if (enableStartMiter == 1.) {
			distToStart = distToLine(gl_FragCoord.xy, startCutoff.xy, startCutoff.zw);
			if (distToStart < -1.) {
				discard;
				return;
			}
			alpha *= min(max(distToStart + 1., 0.), 1.);
		}

		if (enableEndMiter == 1.) {
			distToEnd = distToLine(gl_FragCoord.xy, endCutoff.xy, endCutoff.zw);
			if (distToEnd < -1.) {
				discard;
				return;
			}
			alpha *= min(max(distToEnd + 1., 0.), 1.);
		}
	}

	// round miter
	else if (miterMode == 2.) {
		if (enableStartMiter == 1.) {
			distToStart = distToLine(gl_FragCoord.xy, startCutoff.xy, startCutoff.zw);
			if (distToStart < 0.) {
				float radius = length(gl_FragCoord.xy - startCoord);

				if(radius > cutoff + .5) {
					discard;
					return;
				}

				alpha -= smoothstep(cutoff - .5, cutoff + .5, radius);
			}
		}

		if (enableEndMiter == 1.) {
			distToEnd = distToLine(gl_FragCoord.xy, endCutoff.xy, endCutoff.zw);
			if (distToEnd < 0.) {
				float radius = length(gl_FragCoord.xy - endCoord);

				if(radius > cutoff + .5) {
					discard;
					return;
				}

				alpha -= smoothstep(cutoff - .5, cutoff + .5, radius);
			}
		}
	}

	float t = fract(dot(tangent, gl_FragCoord.xy) / dashLength) * .5 + .25;
	float dash = texture2D(dashTexture, vec2(t, .5)).r;

	gl_FragColor = fragColor;
	gl_FragColor.a *= alpha * opacity * dash;
}
`]), attributes: { lineEnd: { buffer: y, divisor: 0, stride: 8, offset: 0 }, lineTop: { buffer: y, divisor: 0, stride: 8, offset: 4 }, aColor: { buffer: x.prop("colorBuffer"), stride: 4, offset: 0, divisor: 1 }, bColor: { buffer: x.prop("colorBuffer"), stride: 4, offset: 4, divisor: 1 }, prevCoord: { buffer: x.prop("positionBuffer"), stride: 8, offset: 0, divisor: 1 }, aCoord: { buffer: x.prop("positionBuffer"), stride: 8, offset: 8, divisor: 1 }, bCoord: { buffer: x.prop("positionBuffer"), stride: 8, offset: 16, divisor: 1 }, nextCoord: { buffer: x.prop("positionBuffer"), stride: 8, offset: 24, divisor: 1 } } }, w));
        } catch {
          b = _4;
        }
        return { fill: x({ primitive: "triangle", elements: function(k, T2) {
          return T2.triangles;
        }, offset: 0, vert: s([`precision highp float;
#define GLSLIFY 1

attribute vec2 position, positionFract;

uniform vec4 color;
uniform vec2 scale, scaleFract, translate, translateFract;
uniform float pixelRatio, id;
uniform vec4 viewport;
uniform float opacity;

varying vec4 fragColor;

const float MAX_LINES = 256.;

void main() {
	float depth = (MAX_LINES - 4. - id) / (MAX_LINES);

	vec2 position = position * scale + translate
       + positionFract * scale + translateFract
       + position * scaleFract
       + positionFract * scaleFract;

	gl_Position = vec4(position * 2.0 - 1.0, depth, 1);

	fragColor = color / 255.;
	fragColor.a *= opacity;
}
`]), frag: s([`precision highp float;
#define GLSLIFY 1

varying vec4 fragColor;

void main() {
	gl_FragColor = fragColor;
}
`]), uniforms: { scale: x.prop("scale"), color: x.prop("fill"), scaleFract: x.prop("scaleFract"), translateFract: x.prop("translateFract"), translate: x.prop("translate"), opacity: x.prop("opacity"), pixelRatio: x.context("pixelRatio"), id: x.prop("id"), viewport: function(k, T2) {
          return [T2.viewport.x, T2.viewport.y, k.viewportWidth, k.viewportHeight];
        } }, attributes: { position: { buffer: x.prop("positionBuffer"), stride: 8, offset: 8 }, positionFract: { buffer: x.prop("positionFractBuffer"), stride: 8, offset: 8 } }, blend: w.blend, depth: { enable: false }, scissor: w.scissor, stencil: w.stencil, viewport: w.viewport }), rect: _4, miter: b };
      }, g.defaults = { dashes: null, join: "miter", miterLimit: 1, thickness: 10, cap: "square", color: "black", opacity: 1, overlay: false, viewport: null, range: null, close: false, fill: null }, g.prototype.render = function() {
        for (var x, b = [], y = arguments.length; y--; ) b[y] = arguments[y];
        b.length && (x = this).update.apply(x, b), this.draw();
      }, g.prototype.draw = function() {
        for (var x = this, b = [], y = arguments.length; y--; ) b[y] = arguments[y];
        return (b.length ? b : this.passes).forEach(function(w, _4) {
          var k;
          if (w && Array.isArray(w)) return (k = x).draw.apply(k, w);
          typeof w == "number" && (w = x.passes[w]), w && w.count > 1 && w.opacity && (x.regl._refresh(), w.fill && w.triangles && w.triangles.length > 2 && x.shaders.fill(w), w.thickness && (w.scale[0] * w.viewport.width > g.precisionThreshold || w.scale[1] * w.viewport.height > g.precisionThreshold || w.join === "rect" || !w.join && (w.thickness <= 2 || w.count >= g.maxPoints) ? x.shaders.rect(w) : x.shaders.miter(w)));
        }), this;
      }, g.prototype.update = function(x) {
        var b = this;
        if (x) {
          x.length != null ? typeof x[0] == "number" && (x = [{ positions: x }]) : Array.isArray(x) || (x = [x]);
          var y = this.regl, w = this.gl;
          if (x.forEach(function(S2, C2) {
            var E2 = b.passes[C2];
            if (S2 !== void 0) if (S2 !== null) {
              if (typeof S2[0] == "number" && (S2 = { positions: S2 }), S2 = i(S2, { positions: "positions points data coords", thickness: "thickness lineWidth lineWidths line-width linewidth width stroke-width strokewidth strokeWidth", join: "lineJoin linejoin join type mode", miterLimit: "miterlimit miterLimit", dashes: "dash dashes dasharray dash-array dashArray", color: "color colour stroke colors colours stroke-color strokeColor", fill: "fill fill-color fillColor", opacity: "alpha opacity", overlay: "overlay crease overlap intersect", close: "closed close closed-path closePath", range: "range dataBox", viewport: "viewport viewBox", hole: "holes hole hollow", splitNull: "splitNull" }), E2 || (b.passes[C2] = E2 = { id: C2, scale: null, scaleFract: null, translate: null, translateFract: null, count: 0, hole: [], depth: 0, dashLength: 1, dashTexture: y.texture({ channels: 1, data: new Uint8Array([255]), width: 1, height: 1, mag: "linear", min: "linear" }), colorBuffer: y.buffer({ usage: "dynamic", type: "uint8", data: new Uint8Array() }), positionBuffer: y.buffer({ usage: "dynamic", type: "float", data: new Uint8Array() }), positionFractBuffer: y.buffer({ usage: "dynamic", type: "float", data: new Uint8Array() }) }, S2 = o({}, g.defaults, S2)), S2.thickness != null && (E2.thickness = parseFloat(S2.thickness)), S2.opacity != null && (E2.opacity = parseFloat(S2.opacity)), S2.miterLimit != null && (E2.miterLimit = parseFloat(S2.miterLimit)), S2.overlay != null && (E2.overlay = !!S2.overlay, C2 < g.maxLines && (E2.depth = 2 * (g.maxLines - 1 - C2 % g.maxLines) / g.maxLines - 1)), S2.join != null && (E2.join = S2.join), S2.hole != null && (E2.hole = S2.hole), S2.fill != null && (E2.fill = S2.fill ? n(S2.fill, "uint8") : null), S2.viewport != null && (E2.viewport = v(S2.viewport)), E2.viewport || (E2.viewport = v([w.drawingBufferWidth, w.drawingBufferHeight])), S2.close != null && (E2.close = S2.close), S2.positions === null && (S2.positions = []), S2.positions) {
                var F13, N2;
                if (S2.positions.x && S2.positions.y) {
                  var D2 = S2.positions.x, I2 = S2.positions.y;
                  N2 = E2.count = Math.max(D2.length, I2.length), F13 = new Float64Array(2 * N2);
                  for (var O2 = 0; O2 < N2; O2++) F13[2 * O2] = D2[O2], F13[2 * O2 + 1] = I2[O2];
                } else F13 = l(S2.positions, "float64"), N2 = E2.count = Math.floor(F13.length / 2);
                var L2 = E2.bounds = a(F13, 2);
                if (E2.fill) {
                  for (var V2 = [], W2 = {}, X2 = 0, Y2 = 0, K2 = 0, q = E2.count; Y2 < q; Y2++) {
                    var re = F13[2 * Y2], R2 = F13[2 * Y2 + 1];
                    isNaN(re) || isNaN(R2) || re == null || R2 == null ? (re = F13[2 * X2], R2 = F13[2 * X2 + 1], W2[Y2] = X2) : X2 = Y2, V2[K2++] = re, V2[K2++] = R2;
                  }
                  if (S2.splitNull) {
                    E2.count - 1 in W2 || (W2[E2.count] = E2.count - 1);
                    var z = Object.keys(W2).map(Number).sort(function(Ot, Jt) {
                      return Ot - Jt;
                    }), H2 = [], te = 0, j = E2.hole != null ? E2.hole[0] : null;
                    if (j != null) {
                      var Q2 = m(z, function(Ot) {
                        return Ot >= j;
                      });
                      (z = z.slice(0, Q2)).push(j);
                    }
                    for (var Z2 = function(Ot) {
                      var Jt = V2.slice(2 * te, 2 * z[Ot]).concat(j ? V2.slice(2 * j) : []), tr = (E2.hole || []).map(function(at) {
                        return at - j + (z[Ot] - te);
                      }), Ye = u2(Jt, tr);
                      Ye = Ye.map(function(at) {
                        return at + te + (at + te < z[Ot] ? 0 : j - z[Ot]);
                      }), H2.push.apply(H2, Ye), te = z[Ot] + 1;
                    }, ne = 0; ne < z.length; ne++) Z2(ne);
                    for (var ae = 0, ue = H2.length; ae < ue; ae++) W2[H2[ae]] != null && (H2[ae] = W2[H2[ae]]);
                    E2.triangles = H2;
                  } else {
                    for (var le = u2(V2, E2.hole || []), ce = 0, se = le.length; ce < se; ce++) W2[le[ce]] != null && (le[ce] = W2[le[ce]]);
                    E2.triangles = le;
                  }
                }
                var he = new Float64Array(F13);
                c(he, 2, L2);
                var me = new Float64Array(2 * N2 + 6);
                E2.close ? F13[0] === F13[2 * N2 - 2] && F13[1] === F13[2 * N2 - 1] ? (me[0] = he[2 * N2 - 4], me[1] = he[2 * N2 - 3]) : (me[0] = he[2 * N2 - 2], me[1] = he[2 * N2 - 1]) : (me[0] = he[0], me[1] = he[1]), me.set(he, 2), E2.close ? F13[0] === F13[2 * N2 - 2] && F13[1] === F13[2 * N2 - 1] ? (me[2 * N2 + 2] = he[2], me[2 * N2 + 3] = he[3], E2.count -= 1) : (me[2 * N2 + 2] = he[0], me[2 * N2 + 3] = he[1], me[2 * N2 + 4] = he[2], me[2 * N2 + 5] = he[3]) : (me[2 * N2 + 2] = he[2 * N2 - 2], me[2 * N2 + 3] = he[2 * N2 - 1], me[2 * N2 + 4] = he[2 * N2 - 2], me[2 * N2 + 5] = he[2 * N2 - 1]);
                var we = h(me);
                E2.positionBuffer(we);
                var be = p(me, we);
                E2.positionFractBuffer(be);
              }
              if (S2.range ? E2.range = S2.range : E2.range || (E2.range = E2.bounds), (S2.range || S2.positions) && E2.count) {
                var Ae = E2.bounds, pe = Ae[2] - Ae[0], ve = Ae[3] - Ae[1], Ee = E2.range[2] - E2.range[0], Se = E2.range[3] - E2.range[1];
                E2.scale = [pe / Ee, ve / Se], E2.translate = [-E2.range[0] / Ee + Ae[0] / Ee || 0, -E2.range[1] / Se + Ae[1] / Se || 0], E2.scaleFract = p(E2.scale), E2.translateFract = p(E2.translate);
              }
              if (S2.dashes) {
                var Ce, Be = 0;
                if (!S2.dashes || S2.dashes.length < 2) Be = 1, Ce = new Uint8Array([255, 255, 255, 255, 255, 255, 255, 255]);
                else {
                  Be = 0;
                  for (var Ue = 0; Ue < S2.dashes.length; ++Ue) Be += S2.dashes[Ue];
                  Ce = new Uint8Array(Be * g.dashMult);
                  for (var Ke = 0, ct = 255, We = 0; We < 2; We++) for (var Ze = 0; Ze < S2.dashes.length; ++Ze) {
                    for (var it = 0, ot = S2.dashes[Ze] * g.dashMult * 0.5; it < ot; ++it) Ce[Ke++] = ct;
                    ct ^= 255;
                  }
                }
                E2.dashLength = Be, E2.dashTexture({ channels: 1, data: Ce, width: Ce.length, height: 1, mag: "linear", min: "linear" }, 0, 0);
              }
              if (S2.color) {
                var mt = E2.count, wt = S2.color;
                wt || (wt = "transparent");
                var Et = new Uint8Array(4 * mt + 4);
                if (Array.isArray(wt) && typeof wt[0] != "number") {
                  for (var zt = 0; zt < mt; zt++) {
                    var Nt = n(wt[zt], "uint8");
                    Et.set(Nt, 4 * zt);
                  }
                  Et.set(n(wt[0], "uint8"), 4 * mt);
                } else for (var yt = n(wt, "uint8"), pt = 0; pt < mt + 1; pt++) Et.set(yt, 4 * pt);
                E2.colorBuffer({ usage: "dynamic", type: "uint8", data: Et });
              }
            } else b.passes[C2] = null;
          }), x.length < this.passes.length) {
            for (var _4 = x.length; _4 < this.passes.length; _4++) {
              var k = this.passes[_4];
              k && (k.colorBuffer.destroy(), k.positionBuffer.destroy(), k.dashTexture.destroy());
            }
            this.passes.length = x.length;
          }
          for (var T2 = [], A2 = 0; A2 < this.passes.length; A2++) this.passes[A2] !== null && T2.push(this.passes[A2]);
          return this.passes = T2, this;
        }
      }, g.prototype.destroy = function() {
        return this.passes.forEach(function(x) {
          x.colorBuffer.destroy(), x.positionBuffer.destroy(), x.dashTexture.destroy();
        }), this.passes.length = 0, this;
      };
    }, { "array-bounds": 71, "array-find-index": 72, "array-normalize": 73, "color-normalize": 89, earcut: 129, "es6-weak-map": 183, "flatten-vertex-data": 191, glslify: 227, "object-assign": 247, "parse-rect": 249, "pick-by-alias": 253, "to-float32": 313 }], 281: [function(e, t, r) {
      "use strict";
      function n(_4, k) {
        return function(T2) {
          if (Array.isArray(T2)) return T2;
        }(_4) || function(T2, A2) {
          var S2 = T2 == null ? null : typeof Symbol < "u" && T2[Symbol.iterator] || T2["@@iterator"];
          if (S2 != null) {
            var C2, E2, F13 = [], N2 = true, D2 = false;
            try {
              for (S2 = S2.call(T2); !(N2 = (C2 = S2.next()).done) && (F13.push(C2.value), !A2 || F13.length !== A2); N2 = true) ;
            } catch (I2) {
              D2 = true, E2 = I2;
            } finally {
              try {
                N2 || S2.return == null || S2.return();
              } finally {
                if (D2) throw E2;
              }
            }
            return F13;
          }
        }(_4, k) || o(_4, k) || function() {
          throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
        }();
      }
      function a(_4) {
        return function(k) {
          if (Array.isArray(k)) return s(k);
        }(_4) || function(k) {
          if (typeof Symbol < "u" && k[Symbol.iterator] != null || k["@@iterator"] != null) return Array.from(k);
        }(_4) || o(_4) || function() {
          throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
        }();
      }
      function o(_4, k) {
        if (_4) {
          if (typeof _4 == "string") return s(_4, k);
          var T2 = Object.prototype.toString.call(_4).slice(8, -1);
          return T2 === "Object" && _4.constructor && (T2 = _4.constructor.name), T2 === "Map" || T2 === "Set" ? Array.from(_4) : T2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(T2) ? s(_4, k) : void 0;
        }
      }
      function s(_4, k) {
        (k == null || k > _4.length) && (k = _4.length);
        for (var T2 = 0, A2 = new Array(k); T2 < k; T2++) A2[T2] = _4[T2];
        return A2;
      }
      var i = e("color-normalize"), l = e("array-bounds"), u2 = e("color-id"), c = e("@plotly/point-cluster"), f = e("object-assign"), h = e("glslify"), p = e("pick-by-alias"), d = e("update-diff"), v = e("flatten-vertex-data"), m = e("is-iexplorer"), g = e("to-float32"), x = e("parse-rect"), b = y;
      function y(_4, k) {
        var T2 = this;
        if (!(this instanceof y)) return new y(_4, k);
        typeof _4 == "function" ? (k || (k = {}), k.regl = _4) : (k = _4, _4 = null), k && k.length && (k.positions = k);
        var A2, S2 = (_4 = k.regl)._gl, C2 = [];
        this.tooManyColors = m, A2 = _4.texture({ data: new Uint8Array(1020), width: 255, height: 1, type: "uint8", format: "rgba", wrapS: "clamp", wrapT: "clamp", mag: "nearest", min: "nearest" }), f(this, { regl: _4, gl: S2, groups: [], markerCache: [null], markerTextures: [null], palette: C2, paletteIds: {}, paletteTexture: A2, maxColors: 255, maxSize: 100, canvas: S2.canvas }), this.update(k);
        var E2 = { uniforms: { constPointSize: !!k.constPointSize, opacity: _4.prop("opacity"), paletteSize: function(D2, I2) {
          return [T2.tooManyColors ? 0 : 255, A2.height];
        }, pixelRatio: _4.context("pixelRatio"), scale: _4.prop("scale"), scaleFract: _4.prop("scaleFract"), translate: _4.prop("translate"), translateFract: _4.prop("translateFract"), markerTexture: _4.prop("markerTexture"), paletteTexture: A2 }, attributes: { x: function(D2, I2) {
          return I2.xAttr || { buffer: I2.positionBuffer, stride: 8, offset: 0 };
        }, y: function(D2, I2) {
          return I2.yAttr || { buffer: I2.positionBuffer, stride: 8, offset: 4 };
        }, xFract: function(D2, I2) {
          return I2.xAttr ? { constant: [0, 0] } : { buffer: I2.positionFractBuffer, stride: 8, offset: 0 };
        }, yFract: function(D2, I2) {
          return I2.yAttr ? { constant: [0, 0] } : { buffer: I2.positionFractBuffer, stride: 8, offset: 4 };
        }, size: function(D2, I2) {
          return I2.size.length ? { buffer: I2.sizeBuffer, stride: 2, offset: 0 } : { constant: [Math.round(255 * I2.size / T2.maxSize)] };
        }, borderSize: function(D2, I2) {
          return I2.borderSize.length ? { buffer: I2.sizeBuffer, stride: 2, offset: 1 } : { constant: [Math.round(255 * I2.borderSize / T2.maxSize)] };
        }, colorId: function(D2, I2) {
          return I2.color.length ? { buffer: I2.colorBuffer, stride: T2.tooManyColors ? 8 : 4, offset: 0 } : { constant: T2.tooManyColors ? C2.slice(4 * I2.color, 4 * I2.color + 4) : [I2.color] };
        }, borderColorId: function(D2, I2) {
          return I2.borderColor.length ? { buffer: I2.colorBuffer, stride: T2.tooManyColors ? 8 : 4, offset: T2.tooManyColors ? 4 : 2 } : { constant: T2.tooManyColors ? C2.slice(4 * I2.borderColor, 4 * I2.borderColor + 4) : [I2.borderColor] };
        }, isActive: function(D2, I2) {
          return I2.activation === true ? { constant: [1] } : I2.activation ? I2.activation : { constant: [0] };
        } }, blend: { enable: true, color: [0, 0, 0, 1], func: { srcRGB: "src alpha", dstRGB: "one minus src alpha", srcAlpha: "one minus dst alpha", dstAlpha: "one" } }, scissor: { enable: true, box: _4.prop("viewport") }, viewport: _4.prop("viewport"), stencil: { enable: false }, depth: { enable: false }, elements: _4.prop("elements"), count: _4.prop("count"), offset: _4.prop("offset"), primitive: "points" }, F13 = f({}, E2);
        F13.frag = h([`precision highp float;
#define GLSLIFY 1

uniform float opacity;
uniform sampler2D markerTexture;

varying vec4 fragColor, fragBorderColor;
varying float fragWidth, fragBorderColorLevel, fragColorLevel;

float smoothStep(float x, float y) {
  return 1.0 / (1.0 + exp(50.0*(x - y)));
}

void main() {
  float dist = texture2D(markerTexture, gl_PointCoord).r, delta = fragWidth;

  // max-distance alpha
  if (dist < 0.003) discard;

  // null-border case
  if (fragBorderColorLevel == fragColorLevel || fragBorderColor.a == 0.) {
    float colorAmt = smoothstep(.5 - delta, .5 + delta, dist);
    gl_FragColor = vec4(fragColor.rgb, colorAmt * fragColor.a * opacity);
  }
  else {
    float borderColorAmt = smoothstep(fragBorderColorLevel - delta, fragBorderColorLevel + delta, dist);
    float colorAmt = smoothstep(fragColorLevel - delta, fragColorLevel + delta, dist);

    vec4 color = fragBorderColor;
    color.a *= borderColorAmt;
    color = mix(color, fragColor, colorAmt);
    color.a *= opacity;

    gl_FragColor = color;
  }

}
`]), F13.vert = h([`precision highp float;
#define GLSLIFY 1

attribute float x, y, xFract, yFract;
attribute float size, borderSize;
attribute vec4 colorId, borderColorId;
attribute float isActive;

uniform bool constPointSize;
uniform float pixelRatio;
uniform vec2 scale, scaleFract, translate, translateFract, paletteSize;
uniform sampler2D paletteTexture;

const float maxSize = 100.;
const float borderLevel = .5;

varying vec4 fragColor, fragBorderColor;
varying float fragPointSize, fragBorderRadius, fragWidth, fragBorderColorLevel, fragColorLevel;

float pointSizeScale = (constPointSize) ? 2. : pixelRatio;

bool isDirect = (paletteSize.x < 1.);

vec4 getColor(vec4 id) {
  return isDirect ? id / 255. : texture2D(paletteTexture,
    vec2(
      (id.x + .5) / paletteSize.x,
      (id.y + .5) / paletteSize.y
    )
  );
}

void main() {
  // ignore inactive points
  if (isActive == 0.) return;

  vec2 position = vec2(x, y);
  vec2 positionFract = vec2(xFract, yFract);

  vec4 color = getColor(colorId);
  vec4 borderColor = getColor(borderColorId);

  float size = size * maxSize / 255.;
  float borderSize = borderSize * maxSize / 255.;

  gl_PointSize = 2. * size * pointSizeScale;
  fragPointSize = size * pixelRatio;

  vec2 pos = (position + translate) * scale
      + (positionFract + translateFract) * scale
      + (position + translate) * scaleFract
      + (positionFract + translateFract) * scaleFract;

  gl_Position = vec4(pos * 2. - 1., 0., 1.);

  fragColor = color;
  fragBorderColor = borderColor;
  fragWidth = 1. / gl_PointSize;

  fragBorderColorLevel = clamp(borderLevel - borderLevel * borderSize / size, 0., 1.);
  fragColorLevel = clamp(borderLevel + (1. - borderLevel) * borderSize / size, 0., 1.);
}`]), this.drawMarker = _4(F13);
        var N2 = f({}, E2);
        N2.frag = h([`precision highp float;
#define GLSLIFY 1

varying vec4 fragColor, fragBorderColor;
varying float fragBorderRadius, fragWidth;

uniform float opacity;

float smoothStep(float edge0, float edge1, float x) {
	float t;
	t = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);
	return t * t * (3.0 - 2.0 * t);
}

void main() {
	float radius, alpha = 1.0, delta = fragWidth;

	radius = length(2.0 * gl_PointCoord.xy - 1.0);

	if (radius > 1.0 + delta) {
		discard;
	}

	alpha -= smoothstep(1.0 - delta, 1.0 + delta, radius);

	float borderRadius = fragBorderRadius;
	float ratio = smoothstep(borderRadius - delta, borderRadius + delta, radius);
	vec4 color = mix(fragColor, fragBorderColor, ratio);
	color.a *= alpha * opacity;
	gl_FragColor = color;
}
`]), N2.vert = h([`precision highp float;
#define GLSLIFY 1

attribute float x, y, xFract, yFract;
attribute float size, borderSize;
attribute vec4 colorId, borderColorId;
attribute float isActive;

uniform bool constPointSize;
uniform float pixelRatio;
uniform vec2 paletteSize, scale, scaleFract, translate, translateFract;
uniform sampler2D paletteTexture;

const float maxSize = 100.;

varying vec4 fragColor, fragBorderColor;
varying float fragBorderRadius, fragWidth;

float pointSizeScale = (constPointSize) ? 2. : pixelRatio;

bool isDirect = (paletteSize.x < 1.);

vec4 getColor(vec4 id) {
  return isDirect ? id / 255. : texture2D(paletteTexture,
    vec2(
      (id.x + .5) / paletteSize.x,
      (id.y + .5) / paletteSize.y
    )
  );
}

void main() {
  // ignore inactive points
  if (isActive == 0.) return;

  vec2 position = vec2(x, y);
  vec2 positionFract = vec2(xFract, yFract);

  vec4 color = getColor(colorId);
  vec4 borderColor = getColor(borderColorId);

  float size = size * maxSize / 255.;
  float borderSize = borderSize * maxSize / 255.;

  gl_PointSize = (size + borderSize) * pointSizeScale;

  vec2 pos = (position + translate) * scale
      + (positionFract + translateFract) * scale
      + (position + translate) * scaleFract
      + (positionFract + translateFract) * scaleFract;

  gl_Position = vec4(pos * 2. - 1., 0., 1.);

  fragBorderRadius = 1. - 2. * borderSize / (size + borderSize);
  fragColor = color;
  fragBorderColor = borderColor.a == 0. || borderSize == 0. ? vec4(color.rgb, 0.) : borderColor;
  fragWidth = 1. / gl_PointSize;
}
`]), m && (N2.frag = N2.frag.replace("smoothstep", "smoothStep"), F13.frag = F13.frag.replace("smoothstep", "smoothStep")), this.drawCircle = _4(N2);
      }
      y.defaults = { color: "black", borderColor: "transparent", borderSize: 0, size: 12, opacity: 1, marker: void 0, viewport: null, range: null, pixelSize: null, count: 0, offset: 0, bounds: null, positions: [], snap: 1e4 }, y.prototype.render = function() {
        return arguments.length && this.update.apply(this, arguments), this.draw(), this;
      }, y.prototype.draw = function() {
        for (var _4 = this, k = arguments.length, T2 = new Array(k), A2 = 0; A2 < k; A2++) T2[A2] = arguments[A2];
        var S2 = this.groups;
        if (T2.length === 1 && Array.isArray(T2[0]) && (T2[0][0] === null || Array.isArray(T2[0][0])) && (T2 = T2[0]), this.regl._refresh(), T2.length) for (var C2 = 0; C2 < T2.length; C2++) this.drawItem(C2, T2[C2]);
        else S2.forEach(function(E2, F13) {
          _4.drawItem(F13);
        });
        return this;
      }, y.prototype.drawItem = function(_4, k) {
        var T2 = this.groups, A2 = T2[_4];
        if (typeof k == "number" && (_4 = k, A2 = T2[k], k = null), A2 && A2.count && A2.opacity) {
          A2.activation[0] && this.drawCircle(this.getMarkerDrawOptions(0, A2, k));
          for (var S2 = [], C2 = 1; C2 < A2.activation.length; C2++) A2.activation[C2] && (A2.activation[C2] === true || A2.activation[C2].data.length) && S2.push.apply(S2, a(this.getMarkerDrawOptions(C2, A2, k)));
          S2.length && this.drawMarker(S2);
        }
      }, y.prototype.getMarkerDrawOptions = function(_4, k, T2) {
        var A2 = k.range, S2 = k.tree, C2 = k.viewport, E2 = k.activation, F13 = k.selectionBuffer, N2 = k.count;
        if (this.regl, !S2) return T2 ? [f({}, k, { markerTexture: this.markerTextures[_4], activation: E2[_4], count: T2.length, elements: T2, offset: 0 })] : [f({}, k, { markerTexture: this.markerTextures[_4], activation: E2[_4], offset: 0 })];
        var D2 = [], I2 = S2.range(A2, { lod: true, px: [(A2[2] - A2[0]) / C2.width, (A2[3] - A2[1]) / C2.height] });
        if (T2) {
          for (var O2 = E2[_4].data, L2 = new Uint8Array(N2), V2 = 0; V2 < T2.length; V2++) {
            var W2 = T2[V2];
            L2[W2] = O2 ? O2[W2] : 1;
          }
          F13.subdata(L2);
        }
        for (var X2 = I2.length; X2--; ) {
          var Y2 = n(I2[X2], 2), K2 = Y2[0], q = Y2[1];
          D2.push(f({}, k, { markerTexture: this.markerTextures[_4], activation: T2 ? F13 : E2[_4], offset: K2, count: q - K2 }));
        }
        return D2;
      }, y.prototype.update = function() {
        for (var _4 = this, k = arguments.length, T2 = new Array(k), A2 = 0; A2 < k; A2++) T2[A2] = arguments[A2];
        if (T2.length) {
          T2.length === 1 && Array.isArray(T2[0]) && (T2 = T2[0]);
          var S2 = this.groups, C2 = this.gl, E2 = this.regl, F13 = this.maxSize, N2 = this.maxColors, D2 = this.palette;
          this.groups = S2 = T2.map(function(I2, O2) {
            var L2 = S2[O2];
            if (I2 === void 0) return L2;
            I2 === null ? I2 = { positions: null } : typeof I2 == "function" ? I2 = { ondraw: I2 } : typeof I2[0] == "number" && (I2 = { positions: I2 }), (I2 = p(I2, { positions: "positions data points", snap: "snap cluster lod tree", size: "sizes size radius", borderSize: "borderSizes borderSize border-size bordersize borderWidth borderWidths border-width borderwidth stroke-width strokeWidth strokewidth outline", color: "colors color fill fill-color fillColor", borderColor: "borderColors borderColor stroke stroke-color strokeColor", marker: "markers marker shape", range: "range dataBox databox", viewport: "viewport viewPort viewBox viewbox", opacity: "opacity alpha transparency", bounds: "bound bounds boundaries limits", tooManyColors: "tooManyColors palette paletteMode optimizePalette enablePalette" })).positions === null && (I2.positions = []), I2.tooManyColors != null && (_4.tooManyColors = I2.tooManyColors), L2 || (S2[O2] = L2 = { id: O2, scale: null, translate: null, scaleFract: null, translateFract: null, activation: [], selectionBuffer: E2.buffer({ data: new Uint8Array(0), usage: "stream", type: "uint8" }), sizeBuffer: E2.buffer({ data: new Uint8Array(0), usage: "dynamic", type: "uint8" }), colorBuffer: E2.buffer({ data: new Uint8Array(0), usage: "dynamic", type: "uint8" }), positionBuffer: E2.buffer({ data: new Uint8Array(0), usage: "dynamic", type: "float" }), positionFractBuffer: E2.buffer({ data: new Uint8Array(0), usage: "dynamic", type: "float" }) }, I2 = f({}, y.defaults, I2)), I2.positions && !("marker" in I2) && (I2.marker = L2.marker, delete L2.marker), I2.marker && !("positions" in I2) && (I2.positions = L2.positions, delete L2.positions);
            var V2 = 0, W2 = 0;
            if (d(L2, I2, [{ snap: true, size: function(se, he) {
              return se == null && (se = y.defaults.size), V2 += se && se.length ? 1 : 0, se;
            }, borderSize: function(se, he) {
              return se == null && (se = y.defaults.borderSize), V2 += se && se.length ? 1 : 0, se;
            }, opacity: parseFloat, color: function(se, he) {
              return se == null && (se = y.defaults.color), se = _4.updateColor(se), W2++, se;
            }, borderColor: function(se, he) {
              return se == null && (se = y.defaults.borderColor), se = _4.updateColor(se), W2++, se;
            }, bounds: function(se, he, me) {
              return "range" in me || (me.range = null), se;
            }, positions: function(se, he, me) {
              var we = he.snap, be = he.positionBuffer, Ae = he.positionFractBuffer, pe = he.selectionBuffer;
              if (se.x || se.y) return se.x.length ? he.xAttr = { buffer: E2.buffer(se.x), offset: 0, stride: 4, count: se.x.length } : he.xAttr = { buffer: se.x.buffer, offset: 4 * se.x.offset || 0, stride: 4 * (se.x.stride || 1), count: se.x.count }, se.y.length ? he.yAttr = { buffer: E2.buffer(se.y), offset: 0, stride: 4, count: se.y.length } : he.yAttr = { buffer: se.y.buffer, offset: 4 * se.y.offset || 0, stride: 4 * (se.y.stride || 1), count: se.y.count }, he.count = Math.max(he.xAttr.count, he.yAttr.count), se;
              se = v(se, "float64");
              var ve = he.count = Math.floor(se.length / 2), Ee = he.bounds = ve ? l(se, 2) : null;
              if (me.range || he.range || (delete he.range, me.range = Ee), me.marker || he.marker || (delete he.marker, me.marker = null), we && (we === true || ve > we) ? he.tree = c(se, { bounds: Ee }) : we && we.length && (he.tree = we), he.tree) {
                var Se = { primitive: "points", usage: "static", data: he.tree, type: "uint32" };
                he.elements ? he.elements(Se) : he.elements = E2.elements(Se);
              }
              var Ce = g.float32(se);
              return be({ data: Ce, usage: "dynamic" }), Ae({ data: g.fract32(se, Ce), usage: "dynamic" }), pe({ data: new Uint8Array(ve), type: "uint8", usage: "stream" }), se;
            } }, { marker: function(se, he, me) {
              var we = he.activation;
              if (we.forEach(function(Ce) {
                return Ce && Ce.destroy && Ce.destroy();
              }), we.length = 0, se && typeof se[0] != "number") {
                for (var be = [], Ae = 0, pe = Math.min(se.length, he.count); Ae < pe; Ae++) {
                  var ve = _4.addMarker(se[Ae]);
                  be[ve] || (be[ve] = new Uint8Array(he.count)), be[ve][Ae] = 1;
                }
                for (var Ee = 0; Ee < be.length; Ee++) if (be[Ee]) {
                  var Se = { data: be[Ee], type: "uint8", usage: "static" };
                  we[Ee] ? we[Ee](Se) : we[Ee] = E2.buffer(Se), we[Ee].data = be[Ee];
                }
              } else we[_4.addMarker(se)] = true;
              return se;
            }, range: function(se, he, me) {
              var we = he.bounds;
              if (we) return se || (se = we), he.scale = [1 / (se[2] - se[0]), 1 / (se[3] - se[1])], he.translate = [-se[0], -se[1]], he.scaleFract = g.fract(he.scale), he.translateFract = g.fract(he.translate), se;
            }, viewport: function(se) {
              return x(se || [C2.drawingBufferWidth, C2.drawingBufferHeight]);
            } }]), V2) {
              var X2 = L2, Y2 = X2.count, K2 = X2.size, q = X2.borderSize, re = X2.sizeBuffer, R2 = new Uint8Array(2 * Y2);
              if (K2.length || q.length) for (var z = 0; z < Y2; z++) R2[2 * z] = Math.round(255 * (K2[z] == null ? K2 : K2[z]) / F13), R2[2 * z + 1] = Math.round(255 * (q[z] == null ? q : q[z]) / F13);
              re({ data: R2, usage: "dynamic" });
            }
            if (W2) {
              var H2, te = L2, j = te.count, Q2 = te.color, Z2 = te.borderColor, ne = te.colorBuffer;
              if (_4.tooManyColors) {
                if (Q2.length || Z2.length) {
                  H2 = new Uint8Array(8 * j);
                  for (var ae = 0; ae < j; ae++) {
                    var ue = Q2[ae];
                    H2[8 * ae] = D2[4 * ue], H2[8 * ae + 1] = D2[4 * ue + 1], H2[8 * ae + 2] = D2[4 * ue + 2], H2[8 * ae + 3] = D2[4 * ue + 3];
                    var le = Z2[ae];
                    H2[8 * ae + 4] = D2[4 * le], H2[8 * ae + 5] = D2[4 * le + 1], H2[8 * ae + 6] = D2[4 * le + 2], H2[8 * ae + 7] = D2[4 * le + 3];
                  }
                }
              } else if (Q2.length || Z2.length) {
                H2 = new Uint8Array(4 * j + 2);
                for (var ce = 0; ce < j; ce++) Q2[ce] != null && (H2[4 * ce] = Q2[ce] % N2, H2[4 * ce + 1] = Math.floor(Q2[ce] / N2)), Z2[ce] != null && (H2[4 * ce + 2] = Z2[ce] % N2, H2[4 * ce + 3] = Math.floor(Z2[ce] / N2));
              }
              ne({ data: H2 || new Uint8Array(0), type: "uint8", usage: "dynamic" });
            }
            return L2;
          });
        }
      }, y.prototype.addMarker = function(_4) {
        var k, T2 = this.markerTextures, A2 = this.regl, S2 = this.markerCache, C2 = _4 == null ? 0 : S2.indexOf(_4);
        if (C2 >= 0) return C2;
        if (_4 instanceof Uint8Array || _4 instanceof Uint8ClampedArray) k = _4;
        else {
          k = new Uint8Array(_4.length);
          for (var E2 = 0, F13 = _4.length; E2 < F13; E2++) k[E2] = 255 * _4[E2];
        }
        var N2 = Math.floor(Math.sqrt(k.length));
        return C2 = T2.length, S2.push(_4), T2.push(A2.texture({ channels: 1, data: k, radius: N2, mag: "linear", min: "linear" })), C2;
      }, y.prototype.updateColor = function(_4) {
        var k = this.paletteIds, T2 = this.palette, A2 = this.maxColors;
        Array.isArray(_4) || (_4 = [_4]);
        var S2 = [];
        if (typeof _4[0] == "number") {
          var C2 = [];
          if (Array.isArray(_4)) for (var E2 = 0; E2 < _4.length; E2 += 4) C2.push(_4.slice(E2, E2 + 4));
          else for (var F13 = 0; F13 < _4.length; F13 += 4) C2.push(_4.subarray(F13, F13 + 4));
          _4 = C2;
        }
        for (var N2 = 0; N2 < _4.length; N2++) {
          var D2 = _4[N2];
          D2 = i(D2, "uint8");
          var I2 = u2(D2, false);
          if (k[I2] == null) {
            var O2 = T2.length;
            k[I2] = Math.floor(O2 / 4), T2[O2] = D2[0], T2[O2 + 1] = D2[1], T2[O2 + 2] = D2[2], T2[O2 + 3] = D2[3];
          }
          S2[N2] = k[I2];
        }
        return !this.tooManyColors && T2.length > 4 * A2 && (this.tooManyColors = true), this.updatePalette(T2), S2.length === 1 ? S2[0] : S2;
      }, y.prototype.updatePalette = function(_4) {
        if (!this.tooManyColors) {
          var k = this.maxColors, T2 = this.paletteTexture, A2 = Math.ceil(0.25 * _4.length / k);
          if (A2 > 1) for (var S2 = 0.25 * (_4 = _4.slice()).length % k; S2 < A2 * k; S2++) _4.push(0, 0, 0, 0);
          T2.height < A2 && T2.resize(k, A2), T2.subimage({ width: Math.min(0.25 * _4.length, k), height: A2, data: _4 }, 0, 0);
        }
      }, y.prototype.destroy = function() {
        return this.groups.forEach(function(_4) {
          _4.sizeBuffer.destroy(), _4.positionBuffer.destroy(), _4.positionFractBuffer.destroy(), _4.colorBuffer.destroy(), _4.activation.forEach(function(k) {
            return k && k.destroy && k.destroy();
          }), _4.selectionBuffer.destroy(), _4.elements && _4.elements.destroy();
        }), this.groups.length = 0, this.paletteTexture.destroy(), this.markerTextures.forEach(function(_4) {
          return _4 && _4.destroy && _4.destroy();
        }), this;
      };
      var w = e("object-assign");
      t.exports = function(_4, k) {
        var T2 = new b(_4, k), A2 = T2.render.bind(T2);
        return w(A2, { render: A2, update: T2.update.bind(T2), draw: T2.draw.bind(T2), destroy: T2.destroy.bind(T2), regl: T2.regl, gl: T2.gl, canvas: T2.gl.canvas, groups: T2.groups, markers: T2.markerCache, palette: T2.palette }), A2;
      };
    }, { "@plotly/point-cluster": 59, "array-bounds": 71, "color-id": 87, "color-normalize": 89, "flatten-vertex-data": 191, glslify: 227, "is-iexplorer": 233, "object-assign": 247, "parse-rect": 249, "pick-by-alias": 253, "to-float32": 313, "update-diff": 329 }], 282: [function(e, t, r) {
      "use strict";
      var n = e("regl-scatter2d"), a = e("pick-by-alias"), o = e("array-bounds"), s = e("raf"), i = e("array-range"), l = e("parse-rect"), u2 = e("flatten-vertex-data");
      function c(d, v) {
        if (!(this instanceof c)) return new c(d, v);
        this.traces = [], this.passes = {}, this.regl = d, this.scatter = n(d), this.canvas = this.scatter.canvas;
      }
      function f(d, v, m) {
        return (d.id != null ? d.id : d) << 16 | (255 & v) << 8 | 255 & m;
      }
      function h(d, v, m) {
        var g, x, b, y, w = d[v], _4 = d[m];
        return w.length > 2 ? (w[0], w[2], g = w[1], x = w[3]) : w.length ? (g = w[0], x = w[1]) : (w.x, g = w.y, w.x + w.width, x = w.y + w.height), _4.length > 2 ? (b = _4[0], y = _4[2], _4[1], _4[3]) : _4.length ? (b = _4[0], y = _4[1]) : (b = _4.x, _4.y, y = _4.x + _4.width, _4.y + _4.height), [b, g, y, x];
      }
      function p(d) {
        if (typeof d == "number") return [d, d, d, d];
        if (d.length === 2) return [d[0], d[1], d[0], d[1]];
        var v = l(d);
        return [v.x, v.y, v.x + v.width, v.y + v.height];
      }
      t.exports = c, c.prototype.render = function() {
        for (var d, v = this, m = [], g = arguments.length; g--; ) m[g] = arguments[g];
        return m.length && (d = this).update.apply(d, m), this.regl.attributes.preserveDrawingBuffer ? this.draw() : (this.dirty ? this.planned == null && (this.planned = s(function() {
          v.draw(), v.dirty = true, v.planned = null;
        })) : (this.draw(), this.dirty = true, s(function() {
          v.dirty = false;
        })), this);
      }, c.prototype.update = function() {
        for (var d, v = [], m = arguments.length; m--; ) v[m] = arguments[m];
        if (v.length) {
          for (var g = 0; g < v.length; g++) this.updateItem(g, v[g]);
          this.traces = this.traces.filter(Boolean);
          for (var x = [], b = 0, y = 0; y < this.traces.length; y++) {
            for (var w = this.traces[y], _4 = this.traces[y].passes, k = 0; k < _4.length; k++) x.push(this.passes[_4[k]]);
            w.passOffset = b, b += w.passes.length;
          }
          return (d = this.scatter).update.apply(d, x), this;
        }
      }, c.prototype.updateItem = function(d, v) {
        var m = this.regl;
        if (v === null) return this.traces[d] = null, this;
        if (!v) return this;
        var g, x = a(v, { data: "data items columns rows values dimensions samples x", snap: "snap cluster", size: "sizes size radius", color: "colors color fill fill-color fillColor", opacity: "opacity alpha transparency opaque", borderSize: "borderSizes borderSize border-size bordersize borderWidth borderWidths border-width borderwidth stroke-width strokeWidth strokewidth outline", borderColor: "borderColors borderColor bordercolor stroke stroke-color strokeColor", marker: "markers marker shape", range: "range ranges databox dataBox", viewport: "viewport viewBox viewbox", domain: "domain domains area areas", padding: "pad padding paddings pads margin margins", transpose: "transpose transposed", diagonal: "diagonal diag showDiagonal", upper: "upper up top upperhalf upperHalf showupperhalf showUpper showUpperHalf", lower: "lower low bottom lowerhalf lowerHalf showlowerhalf showLowerHalf showLower" }), b = this.traces[d] || (this.traces[d] = { id: d, buffer: m.buffer({ usage: "dynamic", type: "float", data: new Uint8Array() }), color: "black", marker: null, size: 12, borderColor: "transparent", borderSize: 1, viewport: l([m._gl.drawingBufferWidth, m._gl.drawingBufferHeight]), padding: [0, 0, 0, 0], opacity: 1, diagonal: true, upper: true, lower: true });
        if (x.color != null && (b.color = x.color), x.size != null && (b.size = x.size), x.marker != null && (b.marker = x.marker), x.borderColor != null && (b.borderColor = x.borderColor), x.borderSize != null && (b.borderSize = x.borderSize), x.opacity != null && (b.opacity = x.opacity), x.viewport && (b.viewport = l(x.viewport)), x.diagonal != null && (b.diagonal = x.diagonal), x.upper != null && (b.upper = x.upper), x.lower != null && (b.lower = x.lower), x.data) {
          b.buffer(u2(x.data)), b.columns = x.data.length, b.count = x.data[0].length, b.bounds = [];
          for (var y = 0; y < b.columns; y++) b.bounds[y] = o(x.data[y], 1);
        }
        x.range && (b.range = x.range, g = b.range && typeof b.range[0] != "number"), x.domain && (b.domain = x.domain);
        var w = false;
        x.padding != null && (Array.isArray(x.padding) && x.padding.length === b.columns && typeof x.padding[x.padding.length - 1] == "number" ? (b.padding = x.padding.map(p), w = true) : b.padding = p(x.padding));
        var _4 = b.columns, k = b.count, T2 = b.viewport.width, A2 = b.viewport.height, S2 = b.viewport.x, C2 = b.viewport.y, E2 = T2 / _4, F13 = A2 / _4;
        b.passes = [];
        for (var N2 = 0; N2 < _4; N2++) for (var D2 = 0; D2 < _4; D2++) if ((b.diagonal || D2 !== N2) && (b.upper || !(N2 > D2)) && (b.lower || !(N2 < D2))) {
          var I2 = f(b.id, N2, D2), O2 = this.passes[I2] || (this.passes[I2] = {});
          if (x.data && (x.transpose ? O2.positions = { x: { buffer: b.buffer, offset: D2, count: k, stride: _4 }, y: { buffer: b.buffer, offset: N2, count: k, stride: _4 } } : O2.positions = { x: { buffer: b.buffer, offset: D2 * k, count: k }, y: { buffer: b.buffer, offset: N2 * k, count: k } }, O2.bounds = h(b.bounds, N2, D2)), x.domain || x.viewport || x.data) {
            var L2 = w ? h(b.padding, N2, D2) : b.padding;
            if (b.domain) {
              var V2 = h(b.domain, N2, D2), W2 = V2[0], X2 = V2[1], Y2 = V2[2], K2 = V2[3];
              O2.viewport = [S2 + W2 * T2 + L2[0], C2 + X2 * A2 + L2[1], S2 + Y2 * T2 - L2[2], C2 + K2 * A2 - L2[3]];
            } else O2.viewport = [S2 + D2 * E2 + E2 * L2[0], C2 + N2 * F13 + F13 * L2[1], S2 + (D2 + 1) * E2 - E2 * L2[2], C2 + (N2 + 1) * F13 - F13 * L2[3]];
          }
          x.color && (O2.color = b.color), x.size && (O2.size = b.size), x.marker && (O2.marker = b.marker), x.borderSize && (O2.borderSize = b.borderSize), x.borderColor && (O2.borderColor = b.borderColor), x.opacity && (O2.opacity = b.opacity), x.range && (O2.range = g ? h(b.range, N2, D2) : b.range || O2.bounds), b.passes.push(I2);
        }
        return this;
      }, c.prototype.draw = function() {
        for (var d, v = [], m = arguments.length; m--; ) v[m] = arguments[m];
        if (v.length) {
          for (var g = [], x = 0; x < v.length; x++) if (typeof v[x] == "number") {
            var b = this.traces[v[x]], y = b.passes, w = b.passOffset;
            g.push.apply(g, i(w, w + y.length));
          } else if (v[x].length) {
            var _4 = v[x], k = this.traces[x], T2 = k.passes, A2 = k.passOffset;
            T2 = T2.map(function(S2, C2) {
              g[A2 + C2] = _4;
            });
          }
          (d = this.scatter).draw.apply(d, g);
        } else this.scatter.draw();
        return this;
      }, c.prototype.destroy = function() {
        return this.traces.forEach(function(d) {
          d.buffer && d.buffer.destroy && d.buffer.destroy();
        }), this.traces = null, this.passes = null, this.scatter.destroy(), this;
      };
    }, { "array-bounds": 71, "array-range": 74, "flatten-vertex-data": 191, "parse-rect": 249, "pick-by-alias": 253, raf: 278, "regl-scatter2d": 281 }], 283: [function(e, t, r) {
      (function(n, a) {
        typeof r == "object" && t !== void 0 ? t.exports = a() : n.createREGL = a();
      })(this, function() {
        function n(Ge, st) {
          this.id = H2++, this.type = Ge, this.data = st;
        }
        function a(Ge) {
          return "[" + function st(Ie) {
            if (Ie.length === 0) return [];
            var Pe = Ie.charAt(0), $e = Ie.charAt(Ie.length - 1);
            if (1 < Ie.length && Pe === $e && (Pe === '"' || Pe === "'")) return ['"' + Ie.substr(1, Ie.length - 2).replace(/\\/g, "\\\\").replace(/"/g, '\\"') + '"'];
            if (Pe = /\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(Ie)) return st(Ie.substr(0, Pe.index)).concat(st(Pe[1])).concat(st(Ie.substr(Pe.index + Pe[0].length)));
            if ((Pe = Ie.split(".")).length === 1) return ['"' + Ie.replace(/\\/g, "\\\\").replace(/"/g, '\\"') + '"'];
            for (Ie = [], $e = 0; $e < Pe.length; ++$e) Ie = Ie.concat(st(Pe[$e]));
            return Ie;
          }(Ge).join("][") + "]";
        }
        function o(Ge) {
          return typeof Ge == "string" ? Ge.split() : Ge;
        }
        function s(Ge) {
          return typeof Ge == "string" ? document.querySelector(Ge) : Ge;
        }
        function i(Ge) {
          var st, Ie, Pe, $e, Ve = Ge || {};
          Ge = {};
          var ut = [], Re = [], qe = typeof window > "u" ? 1 : window.devicePixelRatio, je = false, rt = function(xe) {
          }, He = function() {
          };
          if (typeof Ve == "string" ? st = document.querySelector(Ve) : typeof Ve == "object" && (typeof Ve.nodeName == "string" && typeof Ve.appendChild == "function" && typeof Ve.getBoundingClientRect == "function" ? st = Ve : typeof Ve.drawArrays == "function" || typeof Ve.drawElements == "function" ? Pe = ($e = Ve).canvas : ("gl" in Ve ? $e = Ve.gl : "canvas" in Ve ? Pe = s(Ve.canvas) : "container" in Ve && (Ie = s(Ve.container)), "attributes" in Ve && (Ge = Ve.attributes), "extensions" in Ve && (ut = o(Ve.extensions)), "optionalExtensions" in Ve && (Re = o(Ve.optionalExtensions)), "onDone" in Ve && (rt = Ve.onDone), "profile" in Ve && (je = !!Ve.profile), "pixelRatio" in Ve && (qe = +Ve.pixelRatio))), st && (st.nodeName.toLowerCase() === "canvas" ? Pe = st : Ie = st), !$e) {
            if (!Pe) {
              if (!(st = function(xe, Ne, ke) {
                function Me() {
                  var ft = window.innerWidth, De = window.innerHeight;
                  xe !== document.body && (ft = (De = ze.getBoundingClientRect()).right - De.left, De = De.bottom - De.top), ze.width = ke * ft, ze.height = ke * De;
                }
                var Le, ze = document.createElement("canvas");
                return z(ze.style, { border: 0, margin: 0, padding: 0, top: 0, left: 0, width: "100%", height: "100%" }), xe.appendChild(ze), xe === document.body && (ze.style.position = "absolute", z(xe.style, { margin: 0, padding: 0 })), xe !== document.body && typeof ResizeObserver == "function" ? (Le = new ResizeObserver(function() {
                  setTimeout(Me);
                })).observe(xe) : window.addEventListener("resize", Me, false), Me(), { canvas: ze, onDestroy: function() {
                  Le ? Le.disconnect() : window.removeEventListener("resize", Me), xe.removeChild(ze);
                } };
              }(Ie || document.body, 0, qe))) return null;
              Pe = st.canvas, He = st.onDestroy;
            }
            Ge.premultipliedAlpha === void 0 && (Ge.premultipliedAlpha = true), $e = function(xe, Ne) {
              function ke(Me) {
                try {
                  return xe.getContext(Me, Ne);
                } catch {
                  return null;
                }
              }
              return ke("webgl") || ke("experimental-webgl") || ke("webgl-experimental");
            }(Pe, Ge);
          }
          return $e ? { gl: $e, canvas: Pe, container: Ie, extensions: ut, optionalExtensions: Re, pixelRatio: qe, profile: je, onDone: rt, onDestroy: He } : (He(), rt("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"), null);
        }
        function l(Ge, st) {
          for (var Ie = Array(Ge), Pe = 0; Pe < Ge; ++Pe) Ie[Pe] = st(Pe);
          return Ie;
        }
        function u2(Ge) {
          var st, Ie;
          return st = (65535 < Ge) << 4, st |= Ie = (255 < (Ge >>>= st)) << 3, (st |= Ie = (15 < (Ge >>>= Ie)) << 2) | (Ie = (3 < (Ge >>>= Ie)) << 1) | Ge >>> Ie >> 1;
        }
        function c() {
          function Ge(Pe) {
            e: {
              for (var $e = 16; 268435456 >= $e; $e *= 16) if (Pe <= $e) {
                Pe = $e;
                break e;
              }
              Pe = 0;
            }
            return 0 < ($e = Ie[u2(Pe) >> 2]).length ? $e.pop() : new ArrayBuffer(Pe);
          }
          function st(Pe) {
            Ie[u2(Pe.byteLength) >> 2].push(Pe);
          }
          var Ie = l(8, function() {
            return [];
          });
          return { alloc: Ge, free: st, allocType: function(Pe, $e) {
            var Ve = null;
            switch (Pe) {
              case 5120:
                Ve = new Int8Array(Ge($e), 0, $e);
                break;
              case 5121:
                Ve = new Uint8Array(Ge($e), 0, $e);
                break;
              case 5122:
                Ve = new Int16Array(Ge(2 * $e), 0, $e);
                break;
              case 5123:
                Ve = new Uint16Array(Ge(2 * $e), 0, $e);
                break;
              case 5124:
                Ve = new Int32Array(Ge(4 * $e), 0, $e);
                break;
              case 5125:
                Ve = new Uint32Array(Ge(4 * $e), 0, $e);
                break;
              case 5126:
                Ve = new Float32Array(Ge(4 * $e), 0, $e);
                break;
              default:
                return null;
            }
            return Ve.length !== $e ? Ve.subarray(0, $e) : Ve;
          }, freeType: function(Pe) {
            st(Pe.buffer);
          } };
        }
        function f(Ge) {
          return !!Ge && typeof Ge == "object" && Array.isArray(Ge.shape) && Array.isArray(Ge.stride) && typeof Ge.offset == "number" && Ge.shape.length === Ge.stride.length && (Array.isArray(Ge.data) || ae(Ge.data));
        }
        function h(Ge, st, Ie, Pe, $e, Ve) {
          for (var ut = 0; ut < st; ++ut) for (var Re = Ge[ut], qe = 0; qe < Ie; ++qe) for (var je = Re[qe], rt = 0; rt < Pe; ++rt) $e[Ve++] = je[rt];
        }
        function p(Ge) {
          return 0 | ce[Object.prototype.toString.call(Ge)];
        }
        function d(Ge, st) {
          for (var Ie = 0; Ie < st.length; ++Ie) Ge[Ie] = st[Ie];
        }
        function v(Ge, st, Ie, Pe, $e, Ve, ut) {
          for (var Re = 0, qe = 0; qe < Ie; ++qe) for (var je = 0; je < Pe; ++je) Ge[Re++] = st[$e * qe + Ve * je + ut];
        }
        function m(Ge, st, Ie, Pe) {
          function $e(He) {
            this.id = qe++, this.buffer = Ge.createBuffer(), this.type = He, this.usage = 35044, this.byteLength = 0, this.dimension = 1, this.dtype = 5121, this.persistentData = null, Ie.profile && (this.stats = { size: 0 });
          }
          function Ve(He, xe, Ne) {
            He.byteLength = xe.byteLength, Ge.bufferData(He.type, xe, Ne);
          }
          function ut(He, xe, Ne, ke, Me, Le) {
            if (He.usage = Ne, Array.isArray(xe)) {
              if (He.dtype = ke || 5126, 0 < xe.length) if (Array.isArray(xe[0])) {
                Me = we(xe);
                for (var ze = ke = 1; ze < Me.length; ++ze) ke *= Me[ze];
                He.dimension = ke, Ve(He, xe = me(xe, Me, He.dtype), Ne), Le ? He.persistentData = xe : Z2.freeType(xe);
              } else typeof xe[0] == "number" ? (He.dimension = Me, d(Me = Z2.allocType(He.dtype, xe.length), xe), Ve(He, Me, Ne), Le ? He.persistentData = Me : Z2.freeType(Me)) : ae(xe[0]) && (He.dimension = xe[0].length, He.dtype = ke || p(xe[0]) || 5126, Ve(He, xe = me(xe, [xe.length, xe[0].length], He.dtype), Ne), Le ? He.persistentData = xe : Z2.freeType(xe));
            } else if (ae(xe)) He.dtype = ke || p(xe), He.dimension = Me, Ve(He, xe, Ne), Le && (He.persistentData = new Uint8Array(new Uint8Array(xe.buffer)));
            else if (f(xe)) {
              Me = xe.shape;
              var ft = xe.stride, De = (ze = xe.offset, 0), Je = 0, tt = 0, vt = 0;
              Me.length === 1 ? (De = Me[0], Je = 1, tt = ft[0], vt = 0) : Me.length === 2 && (De = Me[0], Je = Me[1], tt = ft[0], vt = ft[1]), He.dtype = ke || p(xe.data) || 5126, He.dimension = Je, v(Me = Z2.allocType(He.dtype, De * Je), xe.data, De, Je, tt, vt, ze), Ve(He, Me, Ne), Le ? He.persistentData = Me : Z2.freeType(Me);
            } else xe instanceof ArrayBuffer && (He.dtype = 5121, He.dimension = Me, Ve(He, xe, Ne), Le && (He.persistentData = new Uint8Array(new Uint8Array(xe))));
          }
          function Re(He) {
            st.bufferCount--, Pe(He), Ge.deleteBuffer(He.buffer), He.buffer = null, delete je[He.id];
          }
          var qe = 0, je = {};
          $e.prototype.bind = function() {
            Ge.bindBuffer(this.type, this.buffer);
          }, $e.prototype.destroy = function() {
            Re(this);
          };
          var rt = [];
          return Ie.profile && (st.getTotalBufferSize = function() {
            var He = 0;
            return Object.keys(je).forEach(function(xe) {
              He += je[xe].stats.size;
            }), He;
          }), { create: function(He, xe, Ne, ke) {
            function Me(ze) {
              var ft = 35044, De = null, Je = 0, tt = 0, vt = 1;
              return Array.isArray(ze) || ae(ze) || f(ze) || ze instanceof ArrayBuffer ? De = ze : typeof ze == "number" ? Je = 0 | ze : ze && ("data" in ze && (De = ze.data), "usage" in ze && (ft = he[ze.usage]), "type" in ze && (tt = se[ze.type]), "dimension" in ze && (vt = 0 | ze.dimension), "length" in ze && (Je = 0 | ze.length)), Le.bind(), De ? ut(Le, De, ft, tt, vt, ke) : (Je && Ge.bufferData(Le.type, Je, ft), Le.dtype = tt || 5121, Le.usage = ft, Le.dimension = vt, Le.byteLength = Je), Ie.profile && (Le.stats.size = Le.byteLength * be[Le.dtype]), Me;
            }
            st.bufferCount++;
            var Le = new $e(xe);
            return je[Le.id] = Le, Ne || Me(He), Me._reglType = "buffer", Me._buffer = Le, Me.subdata = function(ze, ft) {
              var De, Je = 0 | (ft || 0);
              if (Le.bind(), ae(ze) || ze instanceof ArrayBuffer) Ge.bufferSubData(Le.type, Je, ze);
              else if (Array.isArray(ze)) {
                if (0 < ze.length) if (typeof ze[0] == "number") {
                  var tt = Z2.allocType(Le.dtype, ze.length);
                  d(tt, ze), Ge.bufferSubData(Le.type, Je, tt), Z2.freeType(tt);
                } else (Array.isArray(ze[0]) || ae(ze[0])) && (De = we(ze), tt = me(ze, De, Le.dtype), Ge.bufferSubData(Le.type, Je, tt), Z2.freeType(tt));
              } else if (f(ze)) {
                De = ze.shape;
                var vt = ze.stride, kt = tt = 0, jt = 0, Vt = 0;
                De.length === 1 ? (tt = De[0], kt = 1, jt = vt[0], Vt = 0) : De.length === 2 && (tt = De[0], kt = De[1], jt = vt[0], Vt = vt[1]), De = Array.isArray(ze.data) ? Le.dtype : p(ze.data), v(De = Z2.allocType(De, tt * kt), ze.data, tt, kt, jt, Vt, ze.offset), Ge.bufferSubData(Le.type, Je, De), Z2.freeType(De);
              }
              return Me;
            }, Ie.profile && (Me.stats = Le.stats), Me.destroy = function() {
              Re(Le);
            }, Me;
          }, createStream: function(He, xe) {
            var Ne = rt.pop();
            return Ne || (Ne = new $e(He)), Ne.bind(), ut(Ne, xe, 35040, 0, 1, false), Ne;
          }, destroyStream: function(He) {
            rt.push(He);
          }, clear: function() {
            ue(je).forEach(Re), rt.forEach(Re);
          }, getBuffer: function(He) {
            return He && He._buffer instanceof $e ? He._buffer : null;
          }, restore: function() {
            ue(je).forEach(function(He) {
              He.buffer = Ge.createBuffer(), Ge.bindBuffer(He.type, He.buffer), Ge.bufferData(He.type, He.persistentData || He.byteLength, He.usage);
            });
          }, _initBuffer: ut };
        }
        function g(Ge, st, Ie, Pe) {
          function $e(He) {
            this.id = qe++, Re[this.id] = this, this.buffer = He, this.primType = 4, this.type = this.vertCount = 0;
          }
          function Ve(He, xe, Ne, ke, Me, Le, ze) {
            var ft;
            if (He.buffer.bind(), xe ? ((ft = ze) || ae(xe) && (!f(xe) || ae(xe.data)) || (ft = st.oes_element_index_uint ? 5125 : 5123), Ie._initBuffer(He.buffer, xe, Ne, ft, 3)) : (Ge.bufferData(34963, Le, Ne), He.buffer.dtype = ft || 5121, He.buffer.usage = Ne, He.buffer.dimension = 3, He.buffer.byteLength = Le), ft = ze, !ze) {
              switch (He.buffer.dtype) {
                case 5121:
                case 5120:
                  ft = 5121;
                  break;
                case 5123:
                case 5122:
                  ft = 5123;
                  break;
                case 5125:
                case 5124:
                  ft = 5125;
              }
              He.buffer.dtype = ft;
            }
            He.type = ft, 0 > (xe = Me) && (xe = He.buffer.byteLength, ft === 5123 ? xe >>= 1 : ft === 5125 && (xe >>= 2)), He.vertCount = xe, xe = ke, 0 > ke && (xe = 4, (ke = He.buffer.dimension) === 1 && (xe = 0), ke === 2 && (xe = 1), ke === 3 && (xe = 4)), He.primType = xe;
          }
          function ut(He) {
            Pe.elementsCount--, delete Re[He.id], He.buffer.destroy(), He.buffer = null;
          }
          var Re = {}, qe = 0, je = { uint8: 5121, uint16: 5123 };
          st.oes_element_index_uint && (je.uint32 = 5125), $e.prototype.bind = function() {
            this.buffer.bind();
          };
          var rt = [];
          return { create: function(He, xe) {
            function Ne(Le) {
              if (Le) if (typeof Le == "number") ke(Le), Me.primType = 4, Me.vertCount = 0 | Le, Me.type = 5121;
              else {
                var ze = null, ft = 35044, De = -1, Je = -1, tt = 0, vt = 0;
                Array.isArray(Le) || ae(Le) || f(Le) ? ze = Le : ("data" in Le && (ze = Le.data), "usage" in Le && (ft = he[Le.usage]), "primitive" in Le && (De = Ae[Le.primitive]), "count" in Le && (Je = 0 | Le.count), "type" in Le && (vt = je[Le.type]), "length" in Le ? tt = 0 | Le.length : (tt = Je, vt === 5123 || vt === 5122 ? tt *= 2 : vt !== 5125 && vt !== 5124 || (tt *= 4))), Ve(Me, ze, ft, De, Je, tt, vt);
              }
              else ke(), Me.primType = 4, Me.vertCount = 0, Me.type = 5121;
              return Ne;
            }
            var ke = Ie.create(null, 34963, true), Me = new $e(ke._buffer);
            return Pe.elementsCount++, Ne(He), Ne._reglType = "elements", Ne._elements = Me, Ne.subdata = function(Le, ze) {
              return ke.subdata(Le, ze), Ne;
            }, Ne.destroy = function() {
              ut(Me);
            }, Ne;
          }, createStream: function(He) {
            var xe = rt.pop();
            return xe || (xe = new $e(Ie.create(null, 34963, true, false)._buffer)), Ve(xe, He, 35040, -1, -1, 0, 0), xe;
          }, destroyStream: function(He) {
            rt.push(He);
          }, getElements: function(He) {
            return typeof He == "function" && He._elements instanceof $e ? He._elements : null;
          }, clear: function() {
            ue(Re).forEach(ut);
          } };
        }
        function x(Ge) {
          for (var st = Z2.allocType(5123, Ge.length), Ie = 0; Ie < Ge.length; ++Ie) if (isNaN(Ge[Ie])) st[Ie] = 65535;
          else if (1 / 0 === Ge[Ie]) st[Ie] = 31744;
          else if (-1 / 0 === Ge[Ie]) st[Ie] = 64512;
          else {
            pe[0] = Ge[Ie];
            var Pe = (Ve = ve[0]) >>> 31 << 15, $e = (Ve << 1 >>> 24) - 127, Ve = Ve >> 13 & 1023;
            st[Ie] = -24 > $e ? Pe : -14 > $e ? Pe + (Ve + 1024 >> -14 - $e) : 15 < $e ? Pe + 31744 : Pe + ($e + 15 << 10) + Ve;
          }
          return st;
        }
        function b(Ge) {
          return Array.isArray(Ge) || ae(Ge);
        }
        function y(Ge) {
          return "[object " + Ge + "]";
        }
        function w(Ge) {
          return Array.isArray(Ge) && (Ge.length === 0 || typeof Ge[0] == "number");
        }
        function _4(Ge) {
          return !(!Array.isArray(Ge) || Ge.length === 0 || !b(Ge[0]));
        }
        function k(Ge) {
          return Object.prototype.toString.call(Ge);
        }
        function T2(Ge) {
          if (!Ge) return false;
          var st = k(Ge);
          return 0 <= it.indexOf(st) || w(Ge) || _4(Ge) || f(Ge);
        }
        function A2(Ge, st) {
          Ge.type === 36193 ? (Ge.data = x(st), Z2.freeType(st)) : Ge.data = st;
        }
        function S2(Ge, st, Ie, Pe, $e, Ve) {
          if (Ge = mt[Ge] !== void 0 ? mt[Ge] : Ce[Ge] * ot[st], Ve && (Ge *= 6), $e) {
            for (Pe = 0; 1 <= Ie; ) Pe += Ge * Ie * Ie, Ie /= 2;
            return Pe;
          }
          return Ge * Ie * Pe;
        }
        function C2(Ge, st, Ie, Pe, $e, Ve, ut) {
          function Re() {
            this.format = this.internalformat = 6408, this.type = 5121, this.flipY = this.premultiplyAlpha = this.compressed = false, this.unpackAlignment = 1, this.colorSpace = 37444, this.channels = this.height = this.width = 0;
          }
          function qe(sr, Ut) {
            sr.internalformat = Ut.internalformat, sr.format = Ut.format, sr.type = Ut.type, sr.compressed = Ut.compressed, sr.premultiplyAlpha = Ut.premultiplyAlpha, sr.flipY = Ut.flipY, sr.unpackAlignment = Ut.unpackAlignment, sr.colorSpace = Ut.colorSpace, sr.width = Ut.width, sr.height = Ut.height, sr.channels = Ut.channels;
          }
          function je(sr, Ut) {
            if (typeof Ut == "object" && Ut) {
              "premultiplyAlpha" in Ut && (sr.premultiplyAlpha = Ut.premultiplyAlpha), "flipY" in Ut && (sr.flipY = Ut.flipY), "alignment" in Ut && (sr.unpackAlignment = Ut.alignment), "colorSpace" in Ut && (sr.colorSpace = $r[Ut.colorSpace]), "type" in Ut && (sr.type = Ar[Ut.type]);
              var Zt = sr.width, xr = sr.height, Fr = sr.channels, pn = false;
              "shape" in Ut ? (Zt = Ut.shape[0], xr = Ut.shape[1], Ut.shape.length === 3 && (Fr = Ut.shape[2], pn = true)) : ("radius" in Ut && (Zt = xr = Ut.radius), "width" in Ut && (Zt = Ut.width), "height" in Ut && (xr = Ut.height), "channels" in Ut && (Fr = Ut.channels, pn = true)), sr.width = 0 | Zt, sr.height = 0 | xr, sr.channels = 0 | Fr, Zt = false, "format" in Ut && (Zt = Ut.format, xr = sr.internalformat = Qr[Zt], sr.format = Zr[xr], Zt in Ar && !("type" in Ut) && (sr.type = Ar[Zt]), Zt in hn && (sr.compressed = true), Zt = true), !pn && Zt ? sr.channels = Ce[sr.format] : pn && !Zt && sr.channels !== Se[sr.format] && (sr.format = sr.internalformat = Se[sr.channels]);
            }
          }
          function rt(sr) {
            Ge.pixelStorei(37440, sr.flipY), Ge.pixelStorei(37441, sr.premultiplyAlpha), Ge.pixelStorei(37443, sr.colorSpace), Ge.pixelStorei(3317, sr.unpackAlignment);
          }
          function He() {
            Re.call(this), this.yOffset = this.xOffset = 0, this.data = null, this.needsFree = false, this.element = null, this.needsCopy = false;
          }
          function xe(sr, Ut) {
            var Zt = null;
            if (T2(Ut) ? Zt = Ut : Ut && (je(sr, Ut), "x" in Ut && (sr.xOffset = 0 | Ut.x), "y" in Ut && (sr.yOffset = 0 | Ut.y), T2(Ut.data) && (Zt = Ut.data)), Ut.copy) {
              var xr = $e.viewportWidth, Fr = $e.viewportHeight;
              sr.width = sr.width || xr - sr.xOffset, sr.height = sr.height || Fr - sr.yOffset, sr.needsCopy = true;
            } else if (Zt) {
              if (ae(Zt)) sr.channels = sr.channels || 4, sr.data = Zt, "type" in Ut || sr.type !== 5121 || (sr.type = 0 | ce[Object.prototype.toString.call(Zt)]);
              else if (w(Zt)) {
                switch (sr.channels = sr.channels || 4, Fr = (xr = Zt).length, sr.type) {
                  case 5121:
                  case 5123:
                  case 5125:
                  case 5126:
                    (Fr = Z2.allocType(sr.type, Fr)).set(xr), sr.data = Fr;
                    break;
                  case 36193:
                    sr.data = x(xr);
                }
                sr.alignment = 1, sr.needsFree = true;
              } else if (f(Zt)) {
                xr = Zt.data, Array.isArray(xr) || sr.type !== 5121 || (sr.type = 0 | ce[Object.prototype.toString.call(xr)]), Fr = Zt.shape;
                var pn, un, Ir, Cr, Lr = Zt.stride;
                Fr.length === 3 ? (Ir = Fr[2], Cr = Lr[2]) : Cr = Ir = 1, pn = Fr[0], un = Fr[1], Fr = Lr[0], Lr = Lr[1], sr.alignment = 1, sr.width = pn, sr.height = un, sr.channels = Ir, sr.format = sr.internalformat = Se[Ir], sr.needsFree = true, pn = Cr, Zt = Zt.offset, Ir = sr.width, Cr = sr.height, un = sr.channels;
                for (var jr = Z2.allocType(sr.type === 36193 ? 5126 : sr.type, Ir * Cr * un), Rr = 0, vn = 0; vn < Cr; ++vn) for (var Mn = 0; Mn < Ir; ++Mn) for (var jn = 0; jn < un; ++jn) jr[Rr++] = xr[Fr * Mn + Lr * vn + pn * jn + Zt];
                A2(sr, jr);
              } else if (k(Zt) === Be || k(Zt) === Ue || k(Zt) === Ke) k(Zt) === Be || k(Zt) === Ue ? sr.element = Zt : sr.element = Zt.canvas, sr.width = sr.element.width, sr.height = sr.element.height, sr.channels = 4;
              else if (k(Zt) === ct) sr.element = Zt, sr.width = Zt.width, sr.height = Zt.height, sr.channels = 4;
              else if (k(Zt) === We) sr.element = Zt, sr.width = Zt.naturalWidth, sr.height = Zt.naturalHeight, sr.channels = 4;
              else if (k(Zt) === Ze) sr.element = Zt, sr.width = Zt.videoWidth, sr.height = Zt.videoHeight, sr.channels = 4;
              else if (_4(Zt)) {
                for (xr = sr.width || Zt[0].length, Fr = sr.height || Zt.length, Lr = sr.channels, Lr = b(Zt[0][0]) ? Lr || Zt[0][0].length : Lr || 1, pn = le.shape(Zt), Ir = 1, Cr = 0; Cr < pn.length; ++Cr) Ir *= pn[Cr];
                Ir = Z2.allocType(sr.type === 36193 ? 5126 : sr.type, Ir), le.flatten(Zt, pn, "", Ir), A2(sr, Ir), sr.alignment = 1, sr.width = xr, sr.height = Fr, sr.channels = Lr, sr.format = sr.internalformat = Se[Lr], sr.needsFree = true;
              }
            } else sr.width = sr.width || 1, sr.height = sr.height || 1, sr.channels = sr.channels || 4;
          }
          function Ne(sr, Ut, Zt, xr, Fr) {
            var pn = sr.element, un = sr.data, Ir = sr.internalformat, Cr = sr.format, Lr = sr.type, jr = sr.width, Rr = sr.height;
            rt(sr), pn ? Ge.texSubImage2D(Ut, Fr, Zt, xr, Cr, Lr, pn) : sr.compressed ? Ge.compressedTexSubImage2D(Ut, Fr, Zt, xr, Ir, jr, Rr, un) : sr.needsCopy ? (Pe(), Ge.copyTexSubImage2D(Ut, Fr, Zt, xr, sr.xOffset, sr.yOffset, jr, Rr)) : Ge.texSubImage2D(Ut, Fr, Zt, xr, jr, Rr, Cr, Lr, un);
          }
          function ke() {
            return oa.pop() || new He();
          }
          function Me(sr) {
            sr.needsFree && Z2.freeType(sr.data), He.call(sr), oa.push(sr);
          }
          function Le() {
            Re.call(this), this.genMipmaps = false, this.mipmapHint = 4352, this.mipmask = 0, this.images = Array(16);
          }
          function ze(sr, Ut, Zt) {
            var xr = sr.images[0] = ke();
            sr.mipmask = 1, xr.width = sr.width = Ut, xr.height = sr.height = Zt, xr.channels = sr.channels = 4;
          }
          function ft(sr, Ut) {
            var Zt = null;
            if (T2(Ut)) qe(Zt = sr.images[0] = ke(), sr), xe(Zt, Ut), sr.mipmask = 1;
            else if (je(sr, Ut), Array.isArray(Ut.mipmap)) for (var xr = Ut.mipmap, Fr = 0; Fr < xr.length; ++Fr) qe(Zt = sr.images[Fr] = ke(), sr), Zt.width >>= Fr, Zt.height >>= Fr, xe(Zt, xr[Fr]), sr.mipmask |= 1 << Fr;
            else qe(Zt = sr.images[0] = ke(), sr), xe(Zt, Ut), sr.mipmask = 1;
            qe(sr, sr.images[0]);
          }
          function De(sr, Ut) {
            for (var Zt = sr.images, xr = 0; xr < Zt.length && Zt[xr]; ++xr) {
              var Fr = Zt[xr], pn = Ut, un = xr, Ir = Fr.element, Cr = Fr.data, Lr = Fr.internalformat, jr = Fr.format, Rr = Fr.type, vn = Fr.width, Mn = Fr.height;
              rt(Fr), Ir ? Ge.texImage2D(pn, un, jr, jr, Rr, Ir) : Fr.compressed ? Ge.compressedTexImage2D(pn, un, Lr, vn, Mn, 0, Cr) : Fr.needsCopy ? (Pe(), Ge.copyTexImage2D(pn, un, jr, Fr.xOffset, Fr.yOffset, vn, Mn, 0)) : Ge.texImage2D(pn, un, jr, vn, Mn, 0, jr, Rr, Cr || null);
            }
          }
          function Je() {
            var sr = tn.pop() || new Le();
            Re.call(sr);
            for (var Ut = sr.mipmask = 0; 16 > Ut; ++Ut) sr.images[Ut] = null;
            return sr;
          }
          function tt(sr) {
            for (var Ut = sr.images, Zt = 0; Zt < Ut.length; ++Zt) Ut[Zt] && Me(Ut[Zt]), Ut[Zt] = null;
            tn.push(sr);
          }
          function vt() {
            this.magFilter = this.minFilter = 9728, this.wrapT = this.wrapS = 33071, this.anisotropic = 1, this.genMipmaps = false, this.mipmapHint = 4352;
          }
          function kt(sr, Ut) {
            "min" in Ut && (sr.minFilter = _r[Ut.min], 0 <= Ee.indexOf(sr.minFilter) && !("faces" in Ut) && (sr.genMipmaps = true)), "mag" in Ut && (sr.magFilter = lr[Ut.mag]);
            var Zt = sr.wrapS, xr = sr.wrapT;
            if ("wrap" in Ut) {
              var Fr = Ut.wrap;
              typeof Fr == "string" ? Zt = xr = pr[Fr] : Array.isArray(Fr) && (Zt = pr[Fr[0]], xr = pr[Fr[1]]);
            } else "wrapS" in Ut && (Zt = pr[Ut.wrapS]), "wrapT" in Ut && (xr = pr[Ut.wrapT]);
            if (sr.wrapS = Zt, sr.wrapT = xr, "anisotropic" in Ut && (sr.anisotropic = Ut.anisotropic), "mipmap" in Ut) {
              switch (Zt = false, typeof Ut.mipmap) {
                case "string":
                  sr.mipmapHint = yr[Ut.mipmap], Zt = sr.genMipmaps = true;
                  break;
                case "boolean":
                  Zt = sr.genMipmaps = Ut.mipmap;
                  break;
                case "object":
                  sr.genMipmaps = false, Zt = true;
              }
              !Zt || "min" in Ut || (sr.minFilter = 9984);
            }
          }
          function jt(sr, Ut) {
            Ge.texParameteri(Ut, 10241, sr.minFilter), Ge.texParameteri(Ut, 10240, sr.magFilter), Ge.texParameteri(Ut, 10242, sr.wrapS), Ge.texParameteri(Ut, 10243, sr.wrapT), st.ext_texture_filter_anisotropic && Ge.texParameteri(Ut, 34046, sr.anisotropic), sr.genMipmaps && (Ge.hint(33170, sr.mipmapHint), Ge.generateMipmap(Ut));
          }
          function Vt(sr) {
            Re.call(this), this.mipmask = 0, this.internalformat = 6408, this.id = Zn++, this.refCount = 1, this.target = sr, this.texture = Ge.createTexture(), this.unit = -1, this.bindCount = 0, this.texInfo = new vt(), ut.profile && (this.stats = { size: 0 });
          }
          function Kt(sr) {
            Ge.activeTexture(33984), Ge.bindTexture(sr.target, sr.texture);
          }
          function rr() {
            var sr = na[0];
            sr ? Ge.bindTexture(sr.target, sr.texture) : Ge.bindTexture(3553, null);
          }
          function Tr(sr) {
            var Ut = sr.texture, Zt = sr.unit, xr = sr.target;
            0 <= Zt && (Ge.activeTexture(33984 + Zt), Ge.bindTexture(xr, null), na[Zt] = null), Ge.deleteTexture(Ut), sr.texture = null, sr.params = null, sr.pixels = null, sr.refCount = 0, delete Ln[sr.id], Ve.textureCount--;
          }
          var yr = { "don't care": 4352, "dont care": 4352, nice: 4354, fast: 4353 }, pr = { repeat: 10497, clamp: 33071, mirror: 33648 }, lr = { nearest: 9728, linear: 9729 }, _r = z({ mipmap: 9987, "nearest mipmap nearest": 9984, "linear mipmap nearest": 9985, "nearest mipmap linear": 9986, "linear mipmap linear": 9987 }, lr), $r = { none: 0, browser: 37444 }, Ar = { uint8: 5121, rgba4: 32819, rgb565: 33635, "rgb5 a1": 32820 }, Qr = { alpha: 6406, luminance: 6409, "luminance alpha": 6410, rgb: 6407, rgba: 6408, rgba4: 32854, "rgb5 a1": 32855, rgb565: 36194 }, hn = {};
          st.ext_srgb && (Qr.srgb = 35904, Qr.srgba = 35906), st.oes_texture_float && (Ar.float32 = Ar.float = 5126), st.oes_texture_half_float && (Ar.float16 = Ar["half float"] = 36193), st.webgl_depth_texture && (z(Qr, { depth: 6402, "depth stencil": 34041 }), z(Ar, { uint16: 5123, uint32: 5125, "depth stencil": 34042 })), st.webgl_compressed_texture_s3tc && z(hn, { "rgb s3tc dxt1": 33776, "rgba s3tc dxt1": 33777, "rgba s3tc dxt3": 33778, "rgba s3tc dxt5": 33779 }), st.webgl_compressed_texture_atc && z(hn, { "rgb atc": 35986, "rgba atc explicit alpha": 35987, "rgba atc interpolated alpha": 34798 }), st.webgl_compressed_texture_pvrtc && z(hn, { "rgb pvrtc 4bppv1": 35840, "rgb pvrtc 2bppv1": 35841, "rgba pvrtc 4bppv1": 35842, "rgba pvrtc 2bppv1": 35843 }), st.webgl_compressed_texture_etc1 && (hn["rgb etc1"] = 36196);
          var wn = Array.prototype.slice.call(Ge.getParameter(34467));
          Object.keys(hn).forEach(function(sr) {
            var Ut = hn[sr];
            0 <= wn.indexOf(Ut) && (Qr[sr] = Ut);
          });
          var Yn = Object.keys(Qr);
          Ie.textureFormats = Yn;
          var Xn = [];
          Object.keys(Qr).forEach(function(sr) {
            Xn[Qr[sr]] = sr;
          });
          var Wn = [];
          Object.keys(Ar).forEach(function(sr) {
            Wn[Ar[sr]] = sr;
          });
          var _n = [];
          Object.keys(lr).forEach(function(sr) {
            _n[lr[sr]] = sr;
          });
          var qr = [];
          Object.keys(_r).forEach(function(sr) {
            qr[_r[sr]] = sr;
          });
          var Nr = [];
          Object.keys(pr).forEach(function(sr) {
            Nr[pr[sr]] = sr;
          });
          var Zr = Yn.reduce(function(sr, Ut) {
            var Zt = Qr[Ut];
            return Zt === 6409 || Zt === 6406 || Zt === 6409 || Zt === 6410 || Zt === 6402 || Zt === 34041 || st.ext_srgb && (Zt === 35904 || Zt === 35906) ? sr[Zt] = Zt : Zt === 32855 || 0 <= Ut.indexOf("rgba") ? sr[Zt] = 6408 : sr[Zt] = 6407, sr;
          }, {}), oa = [], tn = [], Zn = 0, Ln = {}, gn = Ie.maxTextureUnits, na = Array(gn).map(function() {
            return null;
          });
          return z(Vt.prototype, { bind: function() {
            this.bindCount += 1;
            var sr = this.unit;
            if (0 > sr) {
              for (var Ut = 0; Ut < gn; ++Ut) {
                var Zt = na[Ut];
                if (Zt) {
                  if (0 < Zt.bindCount) continue;
                  Zt.unit = -1;
                }
                na[Ut] = this, sr = Ut;
                break;
              }
              ut.profile && Ve.maxTextureUnits < sr + 1 && (Ve.maxTextureUnits = sr + 1), this.unit = sr, Ge.activeTexture(33984 + sr), Ge.bindTexture(this.target, this.texture);
            }
            return sr;
          }, unbind: function() {
            --this.bindCount;
          }, decRef: function() {
            0 >= --this.refCount && Tr(this);
          } }), ut.profile && (Ve.getTotalTextureSize = function() {
            var sr = 0;
            return Object.keys(Ln).forEach(function(Ut) {
              sr += Ln[Ut].stats.size;
            }), sr;
          }), { create2D: function(sr, Ut) {
            function Zt(Fr, pn) {
              var un = xr.texInfo;
              vt.call(un);
              var Ir = Je();
              return typeof Fr == "number" ? ze(Ir, 0 | Fr, typeof pn == "number" ? 0 | pn : 0 | Fr) : Fr ? (kt(un, Fr), ft(Ir, Fr)) : ze(Ir, 1, 1), un.genMipmaps && (Ir.mipmask = (Ir.width << 1) - 1), xr.mipmask = Ir.mipmask, qe(xr, Ir), xr.internalformat = Ir.internalformat, Zt.width = Ir.width, Zt.height = Ir.height, Kt(xr), De(Ir, 3553), jt(un, 3553), rr(), tt(Ir), ut.profile && (xr.stats.size = S2(xr.internalformat, xr.type, Ir.width, Ir.height, un.genMipmaps, false)), Zt.format = Xn[xr.internalformat], Zt.type = Wn[xr.type], Zt.mag = _n[un.magFilter], Zt.min = qr[un.minFilter], Zt.wrapS = Nr[un.wrapS], Zt.wrapT = Nr[un.wrapT], Zt;
            }
            var xr = new Vt(3553);
            return Ln[xr.id] = xr, Ve.textureCount++, Zt(sr, Ut), Zt.subimage = function(Fr, pn, un, Ir) {
              pn |= 0, un |= 0, Ir |= 0;
              var Cr = ke();
              return qe(Cr, xr), Cr.width = 0, Cr.height = 0, xe(Cr, Fr), Cr.width = Cr.width || (xr.width >> Ir) - pn, Cr.height = Cr.height || (xr.height >> Ir) - un, Kt(xr), Ne(Cr, 3553, pn, un, Ir), rr(), Me(Cr), Zt;
            }, Zt.resize = function(Fr, pn) {
              var un = 0 | Fr, Ir = 0 | pn || un;
              if (un === xr.width && Ir === xr.height) return Zt;
              Zt.width = xr.width = un, Zt.height = xr.height = Ir, Kt(xr);
              for (var Cr = 0; xr.mipmask >> Cr; ++Cr) {
                var Lr = un >> Cr, jr = Ir >> Cr;
                if (!Lr || !jr) break;
                Ge.texImage2D(3553, Cr, xr.format, Lr, jr, 0, xr.format, xr.type, null);
              }
              return rr(), ut.profile && (xr.stats.size = S2(xr.internalformat, xr.type, un, Ir, false, false)), Zt;
            }, Zt._reglType = "texture2d", Zt._texture = xr, ut.profile && (Zt.stats = xr.stats), Zt.destroy = function() {
              xr.decRef();
            }, Zt;
          }, createCube: function(sr, Ut, Zt, xr, Fr, pn) {
            function un(Lr, jr, Rr, vn, Mn, jn) {
              var bn, Bn = Ir.texInfo;
              for (vt.call(Bn), bn = 0; 6 > bn; ++bn) Cr[bn] = Je();
              if (typeof Lr != "number" && Lr) {
                if (typeof Lr == "object") if (jr) ft(Cr[0], Lr), ft(Cr[1], jr), ft(Cr[2], Rr), ft(Cr[3], vn), ft(Cr[4], Mn), ft(Cr[5], jn);
                else if (kt(Bn, Lr), je(Ir, Lr), "faces" in Lr) for (Lr = Lr.faces, bn = 0; 6 > bn; ++bn) qe(Cr[bn], Ir), ft(Cr[bn], Lr[bn]);
                else for (bn = 0; 6 > bn; ++bn) ft(Cr[bn], Lr);
              } else for (Lr = 0 | Lr || 1, bn = 0; 6 > bn; ++bn) ze(Cr[bn], Lr, Lr);
              for (qe(Ir, Cr[0]), Ir.mipmask = Bn.genMipmaps ? (Cr[0].width << 1) - 1 : Cr[0].mipmask, Ir.internalformat = Cr[0].internalformat, un.width = Cr[0].width, un.height = Cr[0].height, Kt(Ir), bn = 0; 6 > bn; ++bn) De(Cr[bn], 34069 + bn);
              for (jt(Bn, 34067), rr(), ut.profile && (Ir.stats.size = S2(Ir.internalformat, Ir.type, un.width, un.height, Bn.genMipmaps, true)), un.format = Xn[Ir.internalformat], un.type = Wn[Ir.type], un.mag = _n[Bn.magFilter], un.min = qr[Bn.minFilter], un.wrapS = Nr[Bn.wrapS], un.wrapT = Nr[Bn.wrapT], bn = 0; 6 > bn; ++bn) tt(Cr[bn]);
              return un;
            }
            var Ir = new Vt(34067);
            Ln[Ir.id] = Ir, Ve.cubeCount++;
            var Cr = Array(6);
            return un(sr, Ut, Zt, xr, Fr, pn), un.subimage = function(Lr, jr, Rr, vn, Mn) {
              Rr |= 0, vn |= 0, Mn |= 0;
              var jn = ke();
              return qe(jn, Ir), jn.width = 0, jn.height = 0, xe(jn, jr), jn.width = jn.width || (Ir.width >> Mn) - Rr, jn.height = jn.height || (Ir.height >> Mn) - vn, Kt(Ir), Ne(jn, 34069 + Lr, Rr, vn, Mn), rr(), Me(jn), un;
            }, un.resize = function(Lr) {
              if ((Lr |= 0) !== Ir.width) {
                un.width = Ir.width = Lr, un.height = Ir.height = Lr, Kt(Ir);
                for (var jr = 0; 6 > jr; ++jr) for (var Rr = 0; Ir.mipmask >> Rr; ++Rr) Ge.texImage2D(34069 + jr, Rr, Ir.format, Lr >> Rr, Lr >> Rr, 0, Ir.format, Ir.type, null);
                return rr(), ut.profile && (Ir.stats.size = S2(Ir.internalformat, Ir.type, un.width, un.height, false, true)), un;
              }
            }, un._reglType = "textureCube", un._texture = Ir, ut.profile && (un.stats = Ir.stats), un.destroy = function() {
              Ir.decRef();
            }, un;
          }, clear: function() {
            for (var sr = 0; sr < gn; ++sr) Ge.activeTexture(33984 + sr), Ge.bindTexture(3553, null), na[sr] = null;
            ue(Ln).forEach(Tr), Ve.cubeCount = 0, Ve.textureCount = 0;
          }, getTexture: function(sr) {
            return null;
          }, restore: function() {
            for (var sr = 0; sr < gn; ++sr) {
              var Ut = na[sr];
              Ut && (Ut.bindCount = 0, Ut.unit = -1, na[sr] = null);
            }
            ue(Ln).forEach(function(Zt) {
              Zt.texture = Ge.createTexture(), Ge.bindTexture(Zt.target, Zt.texture);
              for (var xr = 0; 32 > xr; ++xr) if ((Zt.mipmask & 1 << xr) != 0) if (Zt.target === 3553) Ge.texImage2D(3553, xr, Zt.internalformat, Zt.width >> xr, Zt.height >> xr, 0, Zt.internalformat, Zt.type, null);
              else for (var Fr = 0; 6 > Fr; ++Fr) Ge.texImage2D(34069 + Fr, xr, Zt.internalformat, Zt.width >> xr, Zt.height >> xr, 0, Zt.internalformat, Zt.type, null);
              jt(Zt.texInfo, Zt.target);
            });
          }, refresh: function() {
            for (var sr = 0; sr < gn; ++sr) {
              var Ut = na[sr];
              Ut && (Ut.bindCount = 0, Ut.unit = -1, na[sr] = null), Ge.activeTexture(33984 + sr), Ge.bindTexture(3553, null), Ge.bindTexture(34067, null);
            }
          } };
        }
        function E2(Ge, st, Ie, Pe, $e, Ve) {
          function ut(Vt, Kt, rr) {
            this.target = Vt, this.texture = Kt, this.renderbuffer = rr;
            var Tr = Vt = 0;
            Kt ? (Vt = Kt.width, Tr = Kt.height) : rr && (Vt = rr.width, Tr = rr.height), this.width = Vt, this.height = Tr;
          }
          function Re(Vt) {
            Vt && (Vt.texture && Vt.texture._texture.decRef(), Vt.renderbuffer && Vt.renderbuffer._renderbuffer.decRef());
          }
          function qe(Vt, Kt, rr) {
            Vt && (Vt.texture ? Vt.texture._texture.refCount += 1 : Vt.renderbuffer._renderbuffer.refCount += 1);
          }
          function je(Vt, Kt) {
            Kt && (Kt.texture ? Ge.framebufferTexture2D(36160, Vt, Kt.target, Kt.texture._texture.texture, 0) : Ge.framebufferRenderbuffer(36160, Vt, 36161, Kt.renderbuffer._renderbuffer.renderbuffer));
          }
          function rt(Vt) {
            var Kt = 3553, rr = null, Tr = null, yr = Vt;
            return typeof Vt == "object" && (yr = Vt.data, "target" in Vt && (Kt = 0 | Vt.target)), (Vt = yr._reglType) === "texture2d" || Vt === "textureCube" ? rr = yr : Vt === "renderbuffer" && (Tr = yr, Kt = 36161), new ut(Kt, rr, Tr);
          }
          function He(Vt, Kt, rr, Tr, yr) {
            return rr ? ((Vt = Pe.create2D({ width: Vt, height: Kt, format: Tr, type: yr }))._texture.refCount = 0, new ut(3553, Vt, null)) : ((Vt = $e.create({ width: Vt, height: Kt, format: Tr }))._renderbuffer.refCount = 0, new ut(36161, null, Vt));
          }
          function xe(Vt) {
            return Vt && (Vt.texture || Vt.renderbuffer);
          }
          function Ne(Vt, Kt, rr) {
            Vt && (Vt.texture ? Vt.texture.resize(Kt, rr) : Vt.renderbuffer && Vt.renderbuffer.resize(Kt, rr), Vt.width = Kt, Vt.height = rr);
          }
          function ke() {
            this.id = kt++, jt[this.id] = this, this.framebuffer = Ge.createFramebuffer(), this.height = this.width = 0, this.colorAttachments = [], this.depthStencilAttachment = this.stencilAttachment = this.depthAttachment = null;
          }
          function Me(Vt) {
            Vt.colorAttachments.forEach(Re), Re(Vt.depthAttachment), Re(Vt.stencilAttachment), Re(Vt.depthStencilAttachment);
          }
          function Le(Vt) {
            Ge.deleteFramebuffer(Vt.framebuffer), Vt.framebuffer = null, Ve.framebufferCount--, delete jt[Vt.id];
          }
          function ze(Vt) {
            var Kt;
            Ge.bindFramebuffer(36160, Vt.framebuffer);
            var rr = Vt.colorAttachments;
            for (Kt = 0; Kt < rr.length; ++Kt) je(36064 + Kt, rr[Kt]);
            for (Kt = rr.length; Kt < Ie.maxColorAttachments; ++Kt) Ge.framebufferTexture2D(36160, 36064 + Kt, 3553, null, 0);
            Ge.framebufferTexture2D(36160, 33306, 3553, null, 0), Ge.framebufferTexture2D(36160, 36096, 3553, null, 0), Ge.framebufferTexture2D(36160, 36128, 3553, null, 0), je(36096, Vt.depthAttachment), je(36128, Vt.stencilAttachment), je(33306, Vt.depthStencilAttachment), Ge.checkFramebufferStatus(36160), Ge.isContextLost(), Ge.bindFramebuffer(36160, De.next ? De.next.framebuffer : null), De.cur = De.next, Ge.getError();
          }
          function ft(Vt, Kt) {
            function rr(yr, pr) {
              var lr, _r = 0, $r = 0, Ar = true, Qr = true;
              lr = null;
              var hn = true, wn = "rgba", Yn = "uint8", Xn = 1, Wn = null, _n = null, qr = null, Nr = false;
              typeof yr == "number" ? (_r = 0 | yr, $r = 0 | pr || _r) : yr ? ("shape" in yr ? (_r = ($r = yr.shape)[0], $r = $r[1]) : ("radius" in yr && (_r = $r = yr.radius), "width" in yr && (_r = yr.width), "height" in yr && ($r = yr.height)), ("color" in yr || "colors" in yr) && (lr = yr.color || yr.colors, Array.isArray(lr)), lr || ("colorCount" in yr && (Xn = 0 | yr.colorCount), "colorTexture" in yr && (hn = !!yr.colorTexture, wn = "rgba4"), "colorType" in yr && (Yn = yr.colorType, !hn) && (Yn === "half float" || Yn === "float16" ? wn = "rgba16f" : Yn !== "float" && Yn !== "float32" || (wn = "rgba32f")), "colorFormat" in yr && (wn = yr.colorFormat, 0 <= Je.indexOf(wn) ? hn = true : 0 <= tt.indexOf(wn) && (hn = false))), ("depthTexture" in yr || "depthStencilTexture" in yr) && (Nr = !(!yr.depthTexture && !yr.depthStencilTexture)), "depth" in yr && (typeof yr.depth == "boolean" ? Ar = yr.depth : (Wn = yr.depth, Qr = false)), "stencil" in yr && (typeof yr.stencil == "boolean" ? Qr = yr.stencil : (_n = yr.stencil, Ar = false)), "depthStencil" in yr && (typeof yr.depthStencil == "boolean" ? Ar = Qr = yr.depthStencil : (qr = yr.depthStencil, Qr = Ar = false))) : _r = $r = 1;
              var Zr = null, oa = null, tn = null, Zn = null;
              if (Array.isArray(lr)) Zr = lr.map(rt);
              else if (lr) Zr = [rt(lr)];
              else for (Zr = Array(Xn), lr = 0; lr < Xn; ++lr) Zr[lr] = He(_r, $r, hn, wn, Yn);
              for (_r = _r || Zr[0].width, $r = $r || Zr[0].height, Wn ? oa = rt(Wn) : Ar && !Qr && (oa = He(_r, $r, Nr, "depth", "uint32")), _n ? tn = rt(_n) : Qr && !Ar && (tn = He(_r, $r, false, "stencil", "uint8")), qr ? Zn = rt(qr) : !Wn && !_n && Qr && Ar && (Zn = He(_r, $r, Nr, "depth stencil", "depth stencil")), Ar = null, lr = 0; lr < Zr.length; ++lr) qe(Zr[lr]), Zr[lr] && Zr[lr].texture && (Qr = zt[Zr[lr].texture._texture.format] * Nt[Zr[lr].texture._texture.type], Ar === null && (Ar = Qr));
              return qe(oa), qe(tn), qe(Zn), Me(Tr), Tr.width = _r, Tr.height = $r, Tr.colorAttachments = Zr, Tr.depthAttachment = oa, Tr.stencilAttachment = tn, Tr.depthStencilAttachment = Zn, rr.color = Zr.map(xe), rr.depth = xe(oa), rr.stencil = xe(tn), rr.depthStencil = xe(Zn), rr.width = Tr.width, rr.height = Tr.height, ze(Tr), rr;
            }
            var Tr = new ke();
            return Ve.framebufferCount++, rr(Vt, Kt), z(rr, { resize: function(yr, pr) {
              var lr = Math.max(0 | yr, 1), _r = Math.max(0 | pr || lr, 1);
              if (lr === Tr.width && _r === Tr.height) return rr;
              for (var $r = Tr.colorAttachments, Ar = 0; Ar < $r.length; ++Ar) Ne($r[Ar], lr, _r);
              return Ne(Tr.depthAttachment, lr, _r), Ne(Tr.stencilAttachment, lr, _r), Ne(Tr.depthStencilAttachment, lr, _r), Tr.width = rr.width = lr, Tr.height = rr.height = _r, ze(Tr), rr;
            }, _reglType: "framebuffer", _framebuffer: Tr, destroy: function() {
              Le(Tr), Me(Tr);
            }, use: function(yr) {
              De.setFBO({ framebuffer: rr }, yr);
            } });
          }
          var De = { cur: null, next: null, dirty: false, setFBO: null }, Je = ["rgba"], tt = ["rgba4", "rgb565", "rgb5 a1"];
          st.ext_srgb && tt.push("srgba"), st.ext_color_buffer_half_float && tt.push("rgba16f", "rgb16f"), st.webgl_color_buffer_float && tt.push("rgba32f");
          var vt = ["uint8"];
          st.oes_texture_half_float && vt.push("half float", "float16"), st.oes_texture_float && vt.push("float", "float32");
          var kt = 0, jt = {};
          return z(De, { getFramebuffer: function(Vt) {
            return typeof Vt == "function" && Vt._reglType === "framebuffer" && (Vt = Vt._framebuffer) instanceof ke ? Vt : null;
          }, create: ft, createCube: function(Vt) {
            function Kt(Tr) {
              var yr, pr = { color: null }, lr = 0, _r = null;
              yr = "rgba";
              var $r = "uint8", Ar = 1;
              if (typeof Tr == "number" ? lr = 0 | Tr : Tr ? ("shape" in Tr ? lr = Tr.shape[0] : ("radius" in Tr && (lr = 0 | Tr.radius), "width" in Tr ? lr = 0 | Tr.width : "height" in Tr && (lr = 0 | Tr.height)), ("color" in Tr || "colors" in Tr) && (_r = Tr.color || Tr.colors, Array.isArray(_r)), _r || ("colorCount" in Tr && (Ar = 0 | Tr.colorCount), "colorType" in Tr && ($r = Tr.colorType), "colorFormat" in Tr && (yr = Tr.colorFormat)), "depth" in Tr && (pr.depth = Tr.depth), "stencil" in Tr && (pr.stencil = Tr.stencil), "depthStencil" in Tr && (pr.depthStencil = Tr.depthStencil)) : lr = 1, _r) if (Array.isArray(_r)) for (Tr = [], yr = 0; yr < _r.length; ++yr) Tr[yr] = _r[yr];
              else Tr = [_r];
              else for (Tr = Array(Ar), _r = { radius: lr, format: yr, type: $r }, yr = 0; yr < Ar; ++yr) Tr[yr] = Pe.createCube(_r);
              for (pr.color = Array(Tr.length), yr = 0; yr < Tr.length; ++yr) Ar = Tr[yr], lr = lr || Ar.width, pr.color[yr] = { target: 34069, data: Tr[yr] };
              for (yr = 0; 6 > yr; ++yr) {
                for (Ar = 0; Ar < Tr.length; ++Ar) pr.color[Ar].target = 34069 + yr;
                0 < yr && (pr.depth = rr[0].depth, pr.stencil = rr[0].stencil, pr.depthStencil = rr[0].depthStencil), rr[yr] ? rr[yr](pr) : rr[yr] = ft(pr);
              }
              return z(Kt, { width: lr, height: lr, color: Tr });
            }
            var rr = Array(6);
            return Kt(Vt), z(Kt, { faces: rr, resize: function(Tr) {
              var yr = 0 | Tr;
              if (yr === Kt.width) return Kt;
              var pr = Kt.color;
              for (Tr = 0; Tr < pr.length; ++Tr) pr[Tr].resize(yr);
              for (Tr = 0; 6 > Tr; ++Tr) rr[Tr].resize(yr);
              return Kt.width = Kt.height = yr, Kt;
            }, _reglType: "framebufferCube", destroy: function() {
              rr.forEach(function(Tr) {
                Tr.destroy();
              });
            } });
          }, clear: function() {
            ue(jt).forEach(Le);
          }, restore: function() {
            De.cur = null, De.next = null, De.dirty = true, ue(jt).forEach(function(Vt) {
              Vt.framebuffer = Ge.createFramebuffer(), ze(Vt);
            });
          } });
        }
        function F13() {
          this.w = this.z = this.y = this.x = this.state = 0, this.buffer = null, this.size = 0, this.normalized = false, this.type = 5126, this.divisor = this.stride = this.offset = 0;
        }
        function N2(Ge, st, Ie, Pe, $e, Ve, ut) {
          function Re() {
            this.id = ++rt, this.attributes = [], this.elements = null, this.ownsElements = false, this.offset = this.count = 0, this.instances = -1, this.primitive = 4;
            var Ne = st.oes_vertex_array_object;
            this.vao = Ne ? Ne.createVertexArrayOES() : null, He[this.id] = this, this.buffers = [];
          }
          var qe = Ie.maxAttributes, je = Array(qe);
          for (Ie = 0; Ie < qe; ++Ie) je[Ie] = new F13();
          var rt = 0, He = {}, xe = { Record: F13, scope: {}, state: je, currentVAO: null, targetVAO: null, restore: st.oes_vertex_array_object ? function() {
            st.oes_vertex_array_object && ue(He).forEach(function(Ne) {
              Ne.refresh();
            });
          } : function() {
          }, createVAO: function(Ne) {
            function ke(Le) {
              var ze;
              Array.isArray(Le) ? (ze = Le, Me.elements && Me.ownsElements && Me.elements.destroy(), Me.elements = null, Me.ownsElements = false, Me.offset = 0, Me.count = 0, Me.instances = -1, Me.primitive = 4) : (Le.elements ? (ze = Le.elements, Me.ownsElements ? (typeof ze == "function" && ze._reglType === "elements" ? Me.elements.destroy() : Me.elements(ze), Me.ownsElements = false) : Ve.getElements(Le.elements) ? (Me.elements = Le.elements, Me.ownsElements = false) : (Me.elements = Ve.create(Le.elements), Me.ownsElements = true)) : (Me.elements = null, Me.ownsElements = false), ze = Le.attributes, Me.offset = 0, Me.count = -1, Me.instances = -1, Me.primitive = 4, Me.elements && (Me.count = Me.elements._elements.vertCount, Me.primitive = Me.elements._elements.primType), "offset" in Le && (Me.offset = 0 | Le.offset), "count" in Le && (Me.count = 0 | Le.count), "instances" in Le && (Me.instances = 0 | Le.instances), "primitive" in Le && (Me.primitive = Ae[Le.primitive])), Le = {};
              var ft = Me.attributes;
              ft.length = ze.length;
              for (var De = 0; De < ze.length; ++De) {
                var Je, tt = ze[De], vt = ft[De] = new F13(), kt = tt.data || tt;
                Array.isArray(kt) || ae(kt) || f(kt) ? (Me.buffers[De] && (Je = Me.buffers[De], ae(kt) && Je._buffer.byteLength >= kt.byteLength ? Je.subdata(kt) : (Je.destroy(), Me.buffers[De] = null)), Me.buffers[De] || (Je = Me.buffers[De] = $e.create(tt, 34962, false, true)), vt.buffer = $e.getBuffer(Je), vt.size = 0 | vt.buffer.dimension, vt.normalized = false, vt.type = vt.buffer.dtype, vt.offset = 0, vt.stride = 0, vt.divisor = 0, vt.state = 1, Le[De] = 1) : $e.getBuffer(tt) ? (vt.buffer = $e.getBuffer(tt), vt.size = 0 | vt.buffer.dimension, vt.normalized = false, vt.type = vt.buffer.dtype, vt.offset = 0, vt.stride = 0, vt.divisor = 0, vt.state = 1) : $e.getBuffer(tt.buffer) ? (vt.buffer = $e.getBuffer(tt.buffer), vt.size = 0 | (+tt.size || vt.buffer.dimension), vt.normalized = !!tt.normalized || false, vt.type = "type" in tt ? se[tt.type] : vt.buffer.dtype, vt.offset = 0 | (tt.offset || 0), vt.stride = 0 | (tt.stride || 0), vt.divisor = 0 | (tt.divisor || 0), vt.state = 1) : "x" in tt && (vt.x = +tt.x || 0, vt.y = +tt.y || 0, vt.z = +tt.z || 0, vt.w = +tt.w || 0, vt.state = 2);
              }
              for (Je = 0; Je < Me.buffers.length; ++Je) !Le[Je] && Me.buffers[Je] && (Me.buffers[Je].destroy(), Me.buffers[Je] = null);
              return Me.refresh(), ke;
            }
            var Me = new Re();
            return Pe.vaoCount += 1, ke.destroy = function() {
              for (var Le = 0; Le < Me.buffers.length; ++Le) Me.buffers[Le] && Me.buffers[Le].destroy();
              Me.buffers.length = 0, Me.ownsElements && (Me.elements.destroy(), Me.elements = null, Me.ownsElements = false), Me.destroy();
            }, ke._vao = Me, ke._reglType = "vao", ke(Ne);
          }, getVAO: function(Ne) {
            return typeof Ne == "function" && Ne._vao ? Ne._vao : null;
          }, destroyBuffer: function(Ne) {
            for (var ke = 0; ke < je.length; ++ke) {
              var Me = je[ke];
              Me.buffer === Ne && (Ge.disableVertexAttribArray(ke), Me.buffer = null);
            }
          }, setVAO: st.oes_vertex_array_object ? function(Ne) {
            if (Ne !== xe.currentVAO) {
              var ke = st.oes_vertex_array_object;
              Ne ? ke.bindVertexArrayOES(Ne.vao) : ke.bindVertexArrayOES(null), xe.currentVAO = Ne;
            }
          } : function(Ne) {
            if (Ne !== xe.currentVAO) {
              if (Ne) Ne.bindAttrs();
              else {
                for (var ke = st.angle_instanced_arrays, Me = 0; Me < je.length; ++Me) {
                  var Le = je[Me];
                  Le.buffer ? (Ge.enableVertexAttribArray(Me), Le.buffer.bind(), Ge.vertexAttribPointer(Me, Le.size, Le.type, Le.normalized, Le.stride, Le.offfset), ke && Le.divisor && ke.vertexAttribDivisorANGLE(Me, Le.divisor)) : (Ge.disableVertexAttribArray(Me), Ge.vertexAttrib4f(Me, Le.x, Le.y, Le.z, Le.w));
                }
                ut.elements ? Ge.bindBuffer(34963, ut.elements.buffer.buffer) : Ge.bindBuffer(34963, null);
              }
              xe.currentVAO = Ne;
            }
          }, clear: st.oes_vertex_array_object ? function() {
            ue(He).forEach(function(Ne) {
              Ne.destroy();
            });
          } : function() {
          } };
          return Re.prototype.bindAttrs = function() {
            for (var Ne = st.angle_instanced_arrays, ke = this.attributes, Me = 0; Me < ke.length; ++Me) {
              var Le = ke[Me];
              Le.buffer ? (Ge.enableVertexAttribArray(Me), Ge.bindBuffer(34962, Le.buffer.buffer), Ge.vertexAttribPointer(Me, Le.size, Le.type, Le.normalized, Le.stride, Le.offset), Ne && Le.divisor && Ne.vertexAttribDivisorANGLE(Me, Le.divisor)) : (Ge.disableVertexAttribArray(Me), Ge.vertexAttrib4f(Me, Le.x, Le.y, Le.z, Le.w));
            }
            for (Ne = ke.length; Ne < qe; ++Ne) Ge.disableVertexAttribArray(Ne);
            (Ne = Ve.getElements(this.elements)) ? Ge.bindBuffer(34963, Ne.buffer.buffer) : Ge.bindBuffer(34963, null);
          }, Re.prototype.refresh = function() {
            var Ne = st.oes_vertex_array_object;
            Ne && (Ne.bindVertexArrayOES(this.vao), this.bindAttrs(), xe.currentVAO = null, Ne.bindVertexArrayOES(null));
          }, Re.prototype.destroy = function() {
            if (this.vao) {
              var Ne = st.oes_vertex_array_object;
              this === xe.currentVAO && (xe.currentVAO = null, Ne.bindVertexArrayOES(null)), Ne.deleteVertexArrayOES(this.vao), this.vao = null;
            }
            this.ownsElements && (this.elements.destroy(), this.elements = null, this.ownsElements = false), He[this.id] && (delete He[this.id], --Pe.vaoCount);
          }, xe;
        }
        function D2(Ge, st, Ie, Pe) {
          function $e(ke, Me, Le, ze) {
            this.name = ke, this.id = Me, this.location = Le, this.info = ze;
          }
          function Ve(ke, Me) {
            for (var Le = 0; Le < ke.length; ++Le) if (ke[Le].id === Me.id) return void (ke[Le].location = Me.location);
            ke.push(Me);
          }
          function ut(ke, Me, Le) {
            if (!(ft = (Le = ke === 35632 ? je : rt)[Me])) {
              var ze = st.str(Me), ft = Ge.createShader(ke);
              Ge.shaderSource(ft, ze), Ge.compileShader(ft), Le[Me] = ft;
            }
            return ft;
          }
          function Re(ke, Me) {
            this.id = Ne++, this.fragId = ke, this.vertId = Me, this.program = null, this.uniforms = [], this.attributes = [], this.refCount = 1, Pe.profile && (this.stats = { uniformsCount: 0, attributesCount: 0 });
          }
          function qe(ke, Me, Le) {
            var ze;
            ze = ut(35632, ke.fragId);
            var ft = ut(35633, ke.vertId);
            if (Me = ke.program = Ge.createProgram(), Ge.attachShader(Me, ze), Ge.attachShader(Me, ft), Le) for (ze = 0; ze < Le.length; ++ze) ft = Le[ze], Ge.bindAttribLocation(Me, ft[0], ft[1]);
            Ge.linkProgram(Me), ft = Ge.getProgramParameter(Me, 35718), Pe.profile && (ke.stats.uniformsCount = ft);
            var De = ke.uniforms;
            for (ze = 0; ze < ft; ++ze) if (Le = Ge.getActiveUniform(Me, ze)) {
              if (1 < Le.size) for (var Je = 0; Je < Le.size; ++Je) {
                var tt = Le.name.replace("[0]", "[" + Je + "]");
                Ve(De, new $e(tt, st.id(tt), Ge.getUniformLocation(Me, tt), Le));
              }
              Je = Le.name, 1 < Le.size && (Je = Je.replace("[0]", "")), Ve(De, new $e(Je, st.id(Je), Ge.getUniformLocation(Me, Je), Le));
            }
            for (ft = Ge.getProgramParameter(Me, 35721), Pe.profile && (ke.stats.attributesCount = ft), ke = ke.attributes, ze = 0; ze < ft; ++ze) (Le = Ge.getActiveAttrib(Me, ze)) && Ve(ke, new $e(Le.name, st.id(Le.name), Ge.getAttribLocation(Me, Le.name), Le));
          }
          var je = {}, rt = {}, He = {}, xe = [], Ne = 0;
          return Pe.profile && (Ie.getMaxUniformsCount = function() {
            var ke = 0;
            return xe.forEach(function(Me) {
              Me.stats.uniformsCount > ke && (ke = Me.stats.uniformsCount);
            }), ke;
          }, Ie.getMaxAttributesCount = function() {
            var ke = 0;
            return xe.forEach(function(Me) {
              Me.stats.attributesCount > ke && (ke = Me.stats.attributesCount);
            }), ke;
          }), { clear: function() {
            var ke = Ge.deleteShader.bind(Ge);
            ue(je).forEach(ke), je = {}, ue(rt).forEach(ke), rt = {}, xe.forEach(function(Me) {
              Ge.deleteProgram(Me.program);
            }), xe.length = 0, He = {}, Ie.shaderCount = 0;
          }, program: function(ke, Me, Le, ze) {
            var ft = He[Me];
            ft || (ft = He[Me] = {});
            var De = ft[ke];
            if (De && (De.refCount++, !ze)) return De;
            var Je = new Re(Me, ke);
            return Ie.shaderCount++, qe(Je, Le, ze), De || (ft[ke] = Je), xe.push(Je), z(Je, { destroy: function() {
              if (Je.refCount--, 0 >= Je.refCount) {
                Ge.deleteProgram(Je.program);
                var tt = xe.indexOf(Je);
                xe.splice(tt, 1), Ie.shaderCount--;
              }
              0 >= ft[Je.vertId].refCount && (Ge.deleteShader(rt[Je.vertId]), delete rt[Je.vertId], delete He[Je.fragId][Je.vertId]), Object.keys(He[Je.fragId]).length || (Ge.deleteShader(je[Je.fragId]), delete je[Je.fragId], delete He[Je.fragId]);
            } });
          }, restore: function() {
            je = {}, rt = {};
            for (var ke = 0; ke < xe.length; ++ke) qe(xe[ke], null, xe[ke].attributes.map(function(Me) {
              return [Me.location, Me.name];
            }));
          }, shader: ut, frag: -1, vert: -1 };
        }
        function I2(Ge, st, Ie, Pe, $e, Ve, ut) {
          function Re(qe) {
            var je;
            je = st.next === null ? 5121 : st.next.colorAttachments[0].texture._texture.type;
            var rt = 0, He = 0, xe = Pe.framebufferWidth, Ne = Pe.framebufferHeight, ke = null;
            return ae(qe) ? ke = qe : qe && (rt = 0 | qe.x, He = 0 | qe.y, xe = 0 | (qe.width || Pe.framebufferWidth - rt), Ne = 0 | (qe.height || Pe.framebufferHeight - He), ke = qe.data || null), Ie(), qe = xe * Ne * 4, ke || (je === 5121 ? ke = new Uint8Array(qe) : je === 5126 && (ke = ke || new Float32Array(qe))), Ge.pixelStorei(3333, 4), Ge.readPixels(rt, He, xe, Ne, 6408, je, ke), ke;
          }
          return function(qe) {
            return qe && "framebuffer" in qe ? function(je) {
              var rt;
              return st.setFBO({ framebuffer: je.framebuffer }, function() {
                rt = Re(je);
              }), rt;
            }(qe) : Re(qe);
          };
        }
        function O2(Ge) {
          return Array.prototype.slice.call(Ge);
        }
        function L2(Ge) {
          return O2(Ge).join("");
        }
        function V2(Ge) {
          return Array.isArray(Ge) || ae(Ge) || f(Ge);
        }
        function W2(Ge) {
          return Ge.sort(function(st, Ie) {
            return st === "viewport" ? -1 : Ie === "viewport" ? 1 : st < Ie ? -1 : 1;
          });
        }
        function X2(Ge, st, Ie, Pe) {
          this.thisDep = Ge, this.contextDep = st, this.propDep = Ie, this.append = Pe;
        }
        function Y2(Ge) {
          return Ge && !(Ge.thisDep || Ge.contextDep || Ge.propDep);
        }
        function K2(Ge) {
          return new X2(false, false, false, Ge);
        }
        function q(Ge, st) {
          var Ie = Ge.type;
          if (Ie === 0) return new X2(true, 1 <= (Ie = Ge.data.length), 2 <= Ie, st);
          if (Ie === 4) return new X2((Ie = Ge.data).thisDep, Ie.contextDep, Ie.propDep, st);
          if (Ie === 5) return new X2(false, false, false, st);
          if (Ie === 6) {
            for (var Pe = Ie = false, $e = false, Ve = 0; Ve < Ge.data.length; ++Ve) {
              var ut = Ge.data[Ve];
              ut.type === 1 ? $e = true : ut.type === 2 ? Pe = true : ut.type === 3 ? Ie = true : ut.type === 0 ? (Ie = true, 1 <= (ut = ut.data) && (Pe = true), 2 <= ut && ($e = true)) : ut.type === 4 && (Ie = Ie || ut.data.thisDep, Pe = Pe || ut.data.contextDep, $e = $e || ut.data.propDep);
            }
            return new X2(Ie, Pe, $e, st);
          }
          return new X2(Ie === 3, Ie === 2, Ie === 1, st);
        }
        function re(Ge, st, Ie, Pe, $e, Ve, ut, Re, qe, je, rt, He, xe, Ne, ke) {
          function Me(Ut) {
            return Ut.replace(".", "_");
          }
          function Le(Ut, Zt, xr) {
            var Fr = Me(Ut);
            tn.push(Ut), oa[Fr] = Zr[Fr] = !!xr, Zn[Fr] = Zt;
          }
          function ze(Ut, Zt, xr) {
            var Fr = Me(Ut);
            tn.push(Ut), Array.isArray(xr) ? (Zr[Fr] = xr.slice(), oa[Fr] = xr.slice()) : Zr[Fr] = oa[Fr] = xr, Ln[Fr] = Zt;
          }
          function ft() {
            var Ut = function() {
              function jr() {
                var sn = [], an = [];
                return z(function() {
                  sn.push.apply(sn, O2(arguments));
                }, { def: function() {
                  var Sn = "v" + vn++;
                  return an.push(Sn), 0 < arguments.length && (sn.push(Sn, "="), sn.push.apply(sn, O2(arguments)), sn.push(";")), Sn;
                }, toString: function() {
                  return L2([0 < an.length ? "var " + an.join(",") + ";" : "", L2(sn)]);
                } });
              }
              function Rr() {
                function sn(qa, ka) {
                  Sn(qa, ka, "=", an.def(qa, ka), ";");
                }
                var an = jr(), Sn = jr(), Rn = an.toString, Kn = Sn.toString;
                return z(function() {
                  an.apply(an, O2(arguments));
                }, { def: an.def, entry: an, exit: Sn, save: sn, set: function(qa, ka, zn) {
                  sn(qa, ka), an(qa, ka, "=", zn, ";");
                }, toString: function() {
                  return Rn() + Kn();
                } });
              }
              var vn = 0, Mn = [], jn = [], bn = jr(), Bn = {};
              return { global: bn, link: function(sn) {
                for (var an = 0; an < jn.length; ++an) if (jn[an] === sn) return Mn[an];
                return an = "g" + vn++, Mn.push(an), jn.push(sn), an;
              }, block: jr, proc: function(sn, an) {
                function Sn() {
                  var ka = "a" + Rn.length;
                  return Rn.push(ka), ka;
                }
                var Rn = [];
                an = an || 0;
                for (var Kn = 0; Kn < an; ++Kn) Sn();
                var qa = (Kn = Rr()).toString;
                return Bn[sn] = z(Kn, { arg: Sn, toString: function() {
                  return L2(["function(", Rn.join(), "){", qa(), "}"]);
                } });
              }, scope: Rr, cond: function() {
                var sn = L2(arguments), an = Rr(), Sn = Rr(), Rn = an.toString, Kn = Sn.toString;
                return z(an, { then: function() {
                  return an.apply(an, O2(arguments)), this;
                }, else: function() {
                  return Sn.apply(Sn, O2(arguments)), this;
                }, toString: function() {
                  var qa = Kn();
                  return qa && (qa = "else{" + qa + "}"), L2(["if(", sn, "){", Rn(), "}", qa]);
                } });
              }, compile: function() {
                var sn = ['"use strict";', bn, "return {"];
                Object.keys(Bn).forEach(function(Sn) {
                  sn.push('"', Sn, '":', Bn[Sn].toString(), ",");
                }), sn.push("}");
                var an = L2(sn).replace(/;/g, `;
`).replace(/}/g, `}
`).replace(/{/g, `{
`);
                return Function.apply(null, Mn.concat(an)).apply(null, jn);
              } };
            }(), Zt = Ut.link, xr = Ut.global;
            Ut.id = sr++, Ut.batchId = "0";
            var Fr = Zt(gn), pn = Ut.shared = { props: "a0" };
            Object.keys(gn).forEach(function(jr) {
              pn[jr] = xr.def(Fr, ".", jr);
            });
            var un = Ut.next = {}, Ir = Ut.current = {};
            Object.keys(Ln).forEach(function(jr) {
              Array.isArray(Zr[jr]) && (un[jr] = xr.def(pn.next, ".", jr), Ir[jr] = xr.def(pn.current, ".", jr));
            });
            var Cr = Ut.constants = {};
            Object.keys(na).forEach(function(jr) {
              Cr[jr] = xr.def(JSON.stringify(na[jr]));
            }), Ut.invoke = function(jr, Rr) {
              switch (Rr.type) {
                case 0:
                  var vn = ["this", pn.context, pn.props, Ut.batchId];
                  return jr.def(Zt(Rr.data), ".call(", vn.slice(0, Math.max(Rr.data.length + 1, 4)), ")");
                case 1:
                  return jr.def(pn.props, Rr.data);
                case 2:
                  return jr.def(pn.context, Rr.data);
                case 3:
                  return jr.def("this", Rr.data);
                case 4:
                  return Rr.data.append(Ut, jr), Rr.data.ref;
                case 5:
                  return Rr.data.toString();
                case 6:
                  return Rr.data.map(function(Mn) {
                    return Ut.invoke(jr, Mn);
                  });
              }
            }, Ut.attribCache = {};
            var Lr = {};
            return Ut.scopeAttrib = function(jr) {
              if ((jr = st.id(jr)) in Lr) return Lr[jr];
              var Rr = je.scope[jr];
              return Rr || (Rr = je.scope[jr] = new Xn()), Lr[jr] = Zt(Rr);
            }, Ut;
          }
          function De(Ut, Zt) {
            var xr = Ut.static, Fr = Ut.dynamic;
            if ("framebuffer" in xr) {
              var pn = xr.framebuffer;
              return pn ? (pn = Re.getFramebuffer(pn), K2(function(Ir, Cr) {
                var Lr = Ir.link(pn), jr = Ir.shared;
                return Cr.set(jr.framebuffer, ".next", Lr), jr = jr.context, Cr.set(jr, ".framebufferWidth", Lr + ".width"), Cr.set(jr, ".framebufferHeight", Lr + ".height"), Lr;
              })) : K2(function(Ir, Cr) {
                var Lr = Ir.shared;
                return Cr.set(Lr.framebuffer, ".next", "null"), Lr = Lr.context, Cr.set(Lr, ".framebufferWidth", Lr + ".drawingBufferWidth"), Cr.set(Lr, ".framebufferHeight", Lr + ".drawingBufferHeight"), "null";
              });
            }
            if ("framebuffer" in Fr) {
              var un = Fr.framebuffer;
              return q(un, function(Ir, Cr) {
                var Lr = Ir.invoke(Cr, un), jr = Ir.shared, Rr = jr.framebuffer;
                return Lr = Cr.def(Rr, ".getFramebuffer(", Lr, ")"), Cr.set(Rr, ".next", Lr), jr = jr.context, Cr.set(jr, ".framebufferWidth", Lr + "?" + Lr + ".width:" + jr + ".drawingBufferWidth"), Cr.set(jr, ".framebufferHeight", Lr + "?" + Lr + ".height:" + jr + ".drawingBufferHeight"), Lr;
              });
            }
            return null;
          }
          function Je(Ut, Zt, xr) {
            function Fr(jr) {
              if (jr in pn) {
                var Rr = st.id(pn[jr]);
                return (jr = K2(function() {
                  return Rr;
                })).id = Rr, jr;
              }
              if (jr in un) {
                var vn = un[jr];
                return q(vn, function(Mn, jn) {
                  var bn = Mn.invoke(jn, vn);
                  return jn.def(Mn.shared.strings, ".id(", bn, ")");
                });
              }
              return null;
            }
            var pn = Ut.static, un = Ut.dynamic, Ir = Fr("frag"), Cr = Fr("vert"), Lr = null;
            return Y2(Ir) && Y2(Cr) ? (Lr = rt.program(Cr.id, Ir.id, null, xr), Ut = K2(function(jr, Rr) {
              return jr.link(Lr);
            })) : Ut = new X2(Ir && Ir.thisDep || Cr && Cr.thisDep, Ir && Ir.contextDep || Cr && Cr.contextDep, Ir && Ir.propDep || Cr && Cr.propDep, function(jr, Rr) {
              var vn, Mn, jn = jr.shared.shader;
              return vn = Ir ? Ir.append(jr, Rr) : Rr.def(jn, ".", "frag"), Mn = Cr ? Cr.append(jr, Rr) : Rr.def(jn, ".", "vert"), Rr.def(jn + ".program(" + Mn + "," + vn + ")");
            }), { frag: Ir, vert: Cr, progVar: Ut, program: Lr };
          }
          function tt(Ut, Zt) {
            function xr(bn, Bn) {
              if (bn in Fr) {
                var sn = 0 | Fr[bn];
                return Bn ? un.offset = sn : un.instances = sn, K2(function(Sn, Rn) {
                  return Bn && (Sn.OFFSET = sn), sn;
                });
              }
              if (bn in pn) {
                var an = pn[bn];
                return q(an, function(Sn, Rn) {
                  var Kn = Sn.invoke(Rn, an);
                  return Bn && (Sn.OFFSET = Kn), Kn;
                });
              }
              if (Bn) {
                if (Lr) return K2(function(Sn, Rn) {
                  return Sn.OFFSET = 0;
                });
                if (Ir) return new X2(Cr.thisDep, Cr.contextDep, Cr.propDep, function(Sn, Rn) {
                  return Rn.def(Sn.shared.vao + ".currentVAO?" + Sn.shared.vao + ".currentVAO.offset:0");
                });
              } else if (Ir) return new X2(Cr.thisDep, Cr.contextDep, Cr.propDep, function(Sn, Rn) {
                return Rn.def(Sn.shared.vao + ".currentVAO?" + Sn.shared.vao + ".currentVAO.instances:-1");
              });
              return null;
            }
            var Fr = Ut.static, pn = Ut.dynamic, un = {}, Ir = false, Cr = function() {
              if ("vao" in Fr) {
                var bn = Fr.vao;
                return bn !== null && je.getVAO(bn) === null && (bn = je.createVAO(bn)), Ir = true, un.vao = bn, K2(function(sn) {
                  var an = je.getVAO(bn);
                  return an ? sn.link(an) : "null";
                });
              }
              if ("vao" in pn) {
                Ir = true;
                var Bn = pn.vao;
                return q(Bn, function(sn, an) {
                  var Sn = sn.invoke(an, Bn);
                  return an.def(sn.shared.vao + ".getVAO(" + Sn + ")");
                });
              }
              return null;
            }(), Lr = false, jr = function() {
              if ("elements" in Fr) {
                var bn = Fr.elements;
                if (un.elements = bn, V2(bn)) {
                  var Bn = un.elements = Ve.create(bn, true);
                  bn = Ve.getElements(Bn), Lr = true;
                } else bn && (bn = Ve.getElements(bn), Lr = true);
                return (Bn = K2(function(an, Sn) {
                  if (bn) {
                    var Rn = an.link(bn);
                    return an.ELEMENTS = Rn;
                  }
                  return an.ELEMENTS = null;
                })).value = bn, Bn;
              }
              if ("elements" in pn) {
                Lr = true;
                var sn = pn.elements;
                return q(sn, function(an, Sn) {
                  var Rn = (Kn = an.shared).isBufferArgs, Kn = Kn.elements, qa = an.invoke(Sn, sn), ka = Sn.def("null");
                  return Rn = Sn.def(Rn, "(", qa, ")"), qa = an.cond(Rn).then(ka, "=", Kn, ".createStream(", qa, ");").else(ka, "=", Kn, ".getElements(", qa, ");"), Sn.entry(qa), Sn.exit(an.cond(Rn).then(Kn, ".destroyStream(", ka, ");")), an.ELEMENTS = ka;
                });
              }
              return Ir ? new X2(Cr.thisDep, Cr.contextDep, Cr.propDep, function(an, Sn) {
                return Sn.def(an.shared.vao + ".currentVAO?" + an.shared.elements + ".getElements(" + an.shared.vao + ".currentVAO.elements):null");
              }) : null;
            }(), Rr = xr("offset", true), vn = function() {
              if ("primitive" in Fr) {
                var bn = Fr.primitive;
                return un.primitive = bn, K2(function(sn, an) {
                  return Ae[bn];
                });
              }
              if ("primitive" in pn) {
                var Bn = pn.primitive;
                return q(Bn, function(sn, an) {
                  var Sn = sn.constants.primTypes, Rn = sn.invoke(an, Bn);
                  return an.def(Sn, "[", Rn, "]");
                });
              }
              return Lr ? Y2(jr) ? jr.value ? K2(function(sn, an) {
                return an.def(sn.ELEMENTS, ".primType");
              }) : K2(function() {
                return 4;
              }) : new X2(jr.thisDep, jr.contextDep, jr.propDep, function(sn, an) {
                var Sn = sn.ELEMENTS;
                return an.def(Sn, "?", Sn, ".primType:", 4);
              }) : Ir ? new X2(Cr.thisDep, Cr.contextDep, Cr.propDep, function(sn, an) {
                return an.def(sn.shared.vao + ".currentVAO?" + sn.shared.vao + ".currentVAO.primitive:4");
              }) : null;
            }(), Mn = function() {
              if ("count" in Fr) {
                var bn = 0 | Fr.count;
                return un.count = bn, K2(function() {
                  return bn;
                });
              }
              if ("count" in pn) {
                var Bn = pn.count;
                return q(Bn, function(sn, an) {
                  return sn.invoke(an, Bn);
                });
              }
              return Lr ? Y2(jr) ? jr ? Rr ? new X2(Rr.thisDep, Rr.contextDep, Rr.propDep, function(sn, an) {
                return an.def(sn.ELEMENTS, ".vertCount-", sn.OFFSET);
              }) : K2(function(sn, an) {
                return an.def(sn.ELEMENTS, ".vertCount");
              }) : K2(function() {
                return -1;
              }) : new X2(jr.thisDep || Rr.thisDep, jr.contextDep || Rr.contextDep, jr.propDep || Rr.propDep, function(sn, an) {
                var Sn = sn.ELEMENTS;
                return sn.OFFSET ? an.def(Sn, "?", Sn, ".vertCount-", sn.OFFSET, ":-1") : an.def(Sn, "?", Sn, ".vertCount:-1");
              }) : Ir ? new X2(Cr.thisDep, Cr.contextDep, Cr.propDep, function(sn, an) {
                return an.def(sn.shared.vao, ".currentVAO?", sn.shared.vao, ".currentVAO.count:-1");
              }) : null;
            }(), jn = xr("instances", false);
            return { elements: jr, primitive: vn, count: Mn, instances: jn, offset: Rr, vao: Cr, vaoActive: Ir, elementsActive: Lr, static: un };
          }
          function vt(Ut, Zt) {
            var xr = Ut.static, Fr = Ut.dynamic, pn = {};
            return Object.keys(xr).forEach(function(un) {
              var Ir = xr[un], Cr = st.id(un), Lr = new Xn();
              if (V2(Ir)) Lr.state = 1, Lr.buffer = $e.getBuffer($e.create(Ir, 34962, false, true)), Lr.type = 0;
              else if (Rr = $e.getBuffer(Ir)) Lr.state = 1, Lr.buffer = Rr, Lr.type = 0;
              else if ("constant" in Ir) {
                var jr = Ir.constant;
                Lr.buffer = "null", Lr.state = 2, typeof jr == "number" ? Lr.x = jr : yt.forEach(function(sn, an) {
                  an < jr.length && (Lr[sn] = jr[an]);
                });
              } else {
                var Rr = V2(Ir.buffer) ? $e.getBuffer($e.create(Ir.buffer, 34962, false, true)) : $e.getBuffer(Ir.buffer), vn = 0 | Ir.offset, Mn = 0 | Ir.stride, jn = 0 | Ir.size, bn = !!Ir.normalized, Bn = 0;
                "type" in Ir && (Bn = se[Ir.type]), Ir = 0 | Ir.divisor, Lr.buffer = Rr, Lr.state = 1, Lr.size = jn, Lr.normalized = bn, Lr.type = Bn || Rr.dtype, Lr.offset = vn, Lr.stride = Mn, Lr.divisor = Ir;
              }
              pn[un] = K2(function(sn, an) {
                var Sn = sn.attribCache;
                if (Cr in Sn) return Sn[Cr];
                var Rn = { isStream: false };
                return Object.keys(Lr).forEach(function(Kn) {
                  Rn[Kn] = Lr[Kn];
                }), Lr.buffer && (Rn.buffer = sn.link(Lr.buffer), Rn.type = Rn.type || Rn.buffer + ".dtype"), Sn[Cr] = Rn;
              });
            }), Object.keys(Fr).forEach(function(un) {
              var Ir = Fr[un];
              pn[un] = q(Ir, function(Cr, Lr) {
                function jr(Sn) {
                  Lr(bn[Sn], "=", Rr, ".", Sn, "|0;");
                }
                var Rr = Cr.invoke(Lr, Ir), vn = Cr.shared, Mn = Cr.constants, jn = vn.isBufferArgs, bn = (vn = vn.buffer, { isStream: Lr.def(false) }), Bn = new Xn();
                Bn.state = 1, Object.keys(Bn).forEach(function(Sn) {
                  bn[Sn] = Lr.def("" + Bn[Sn]);
                });
                var sn = bn.buffer, an = bn.type;
                return Lr("if(", jn, "(", Rr, ")){", bn.isStream, "=true;", sn, "=", vn, ".createStream(", 34962, ",", Rr, ");", an, "=", sn, ".dtype;", "}else{", sn, "=", vn, ".getBuffer(", Rr, ");", "if(", sn, "){", an, "=", sn, ".dtype;", '}else if("constant" in ', Rr, "){", bn.state, "=", 2, ";", "if(typeof " + Rr + '.constant === "number"){', bn[yt[0]], "=", Rr, ".constant;", yt.slice(1).map(function(Sn) {
                  return bn[Sn];
                }).join("="), "=0;", "}else{", yt.map(function(Sn, Rn) {
                  return bn[Sn] + "=" + Rr + ".constant.length>" + Rn + "?" + Rr + ".constant[" + Rn + "]:0;";
                }).join(""), "}}else{", "if(", jn, "(", Rr, ".buffer)){", sn, "=", vn, ".createStream(", 34962, ",", Rr, ".buffer);", "}else{", sn, "=", vn, ".getBuffer(", Rr, ".buffer);", "}", an, '="type" in ', Rr, "?", Mn.glTypes, "[", Rr, ".type]:", sn, ".dtype;", bn.normalized, "=!!", Rr, ".normalized;"), jr("size"), jr("offset"), jr("stride"), jr("divisor"), Lr("}}"), Lr.exit("if(", bn.isStream, "){", vn, ".destroyStream(", sn, ");", "}"), bn;
              });
            }), pn;
          }
          function kt(Ut, Zt, xr, Fr, pn) {
            function un(Bn) {
              var sn = Cr[Bn];
              sn && (jr[Bn] = sn);
            }
            var Ir = function(Bn, sn) {
              if (typeof (an = Bn.static).frag == "string" && typeof an.vert == "string") {
                if (0 < Object.keys(sn.dynamic).length) return null;
                var an = sn.static, Sn = Object.keys(an);
                if (0 < Sn.length && typeof an[Sn[0]] == "number") {
                  for (var Rn = [], Kn = 0; Kn < Sn.length; ++Kn) Rn.push([0 | an[Sn[Kn]], Sn[Kn]]);
                  return Rn;
                }
              }
              return null;
            }(Ut, Zt), Cr = function(Bn, sn, an) {
              function Sn(ka) {
                if (ka in Rn) {
                  var zn = Rn[ka];
                  ka = true;
                  var ja, si, ko = 0 | zn.x, Xs = 0 | zn.y;
                  return "width" in zn ? ja = 0 | zn.width : ka = false, "height" in zn ? si = 0 | zn.height : ka = false, new X2(!ka && sn && sn.thisDep, !ka && sn && sn.contextDep, !ka && sn && sn.propDep, function(As, Ui) {
                    var so = As.shared.context, gu = ja;
                    "width" in zn || (gu = Ui.def(so, ".", "framebufferWidth", "-", ko));
                    var Pc = si;
                    return "height" in zn || (Pc = Ui.def(so, ".", "framebufferHeight", "-", Xs)), [ko, Xs, gu, Pc];
                  });
                }
                if (ka in Kn) {
                  var Uo = Kn[ka];
                  return ka = q(Uo, function(As, Ui) {
                    var so = As.invoke(Ui, Uo), gu = As.shared.context, Pc = Ui.def(so, ".x|0"), Zc = Ui.def(so, ".y|0");
                    return [Pc, Zc, Ui.def('"width" in ', so, "?", so, ".width|0:", "(", gu, ".", "framebufferWidth", "-", Pc, ")"), so = Ui.def('"height" in ', so, "?", so, ".height|0:", "(", gu, ".", "framebufferHeight", "-", Zc, ")")];
                  }), sn && (ka.thisDep = ka.thisDep || sn.thisDep, ka.contextDep = ka.contextDep || sn.contextDep, ka.propDep = ka.propDep || sn.propDep), ka;
                }
                return sn ? new X2(sn.thisDep, sn.contextDep, sn.propDep, function(As, Ui) {
                  var so = As.shared.context;
                  return [0, 0, Ui.def(so, ".", "framebufferWidth"), Ui.def(so, ".", "framebufferHeight")];
                }) : null;
              }
              var Rn = Bn.static, Kn = Bn.dynamic;
              if (Bn = Sn("viewport")) {
                var qa = Bn;
                Bn = new X2(Bn.thisDep, Bn.contextDep, Bn.propDep, function(ka, zn) {
                  var ja = qa.append(ka, zn), si = ka.shared.context;
                  return zn.set(si, ".viewportWidth", ja[2]), zn.set(si, ".viewportHeight", ja[3]), ja;
                });
              }
              return { viewport: Bn, scissor_box: Sn("scissor.box") };
            }(Ut, vn = De(Ut)), Lr = tt(Ut), jr = function(Bn, sn) {
              var an = Bn.static, Sn = Bn.dynamic, Rn = {};
              return tn.forEach(function(Kn) {
                function qa(zn, ja) {
                  if (Kn in an) {
                    var si = zn(an[Kn]);
                    Rn[ka] = K2(function() {
                      return si;
                    });
                  } else if (Kn in Sn) {
                    var ko = Sn[Kn];
                    Rn[ka] = q(ko, function(Xs, Uo) {
                      return ja(Xs, Uo, Xs.invoke(Uo, ko));
                    });
                  }
                }
                var ka = Me(Kn);
                switch (Kn) {
                  case "cull.enable":
                  case "blend.enable":
                  case "dither":
                  case "stencil.enable":
                  case "depth.enable":
                  case "scissor.enable":
                  case "polygonOffset.enable":
                  case "sample.alpha":
                  case "sample.enable":
                  case "depth.mask":
                    return qa(function(zn) {
                      return zn;
                    }, function(zn, ja, si) {
                      return si;
                    });
                  case "depth.func":
                    return qa(function(zn) {
                      return Jt[zn];
                    }, function(zn, ja, si) {
                      return ja.def(zn.constants.compareFuncs, "[", si, "]");
                    });
                  case "depth.range":
                    return qa(function(zn) {
                      return zn;
                    }, function(zn, ja, si) {
                      return [ja.def("+", si, "[0]"), ja = ja.def("+", si, "[1]")];
                    });
                  case "blend.func":
                    return qa(function(zn) {
                      return [Ot["srcRGB" in zn ? zn.srcRGB : zn.src], Ot["dstRGB" in zn ? zn.dstRGB : zn.dst], Ot["srcAlpha" in zn ? zn.srcAlpha : zn.src], Ot["dstAlpha" in zn ? zn.dstAlpha : zn.dst]];
                    }, function(zn, ja, si) {
                      function ko(Ui, so) {
                        return ja.def('"', Ui, so, '" in ', si, "?", si, ".", Ui, so, ":", si, ".", Ui);
                      }
                      zn = zn.constants.blendFuncs;
                      var Xs = ko("src", "RGB"), Uo = ko("dst", "RGB"), As = (Xs = ja.def(zn, "[", Xs, "]"), ja.def(zn, "[", ko("src", "Alpha"), "]"));
                      return [Xs, Uo = ja.def(zn, "[", Uo, "]"), As, zn = ja.def(zn, "[", ko("dst", "Alpha"), "]")];
                    });
                  case "blend.equation":
                    return qa(function(zn) {
                      return typeof zn == "string" ? [Wn[zn], Wn[zn]] : typeof zn == "object" ? [Wn[zn.rgb], Wn[zn.alpha]] : void 0;
                    }, function(zn, ja, si) {
                      var ko = zn.constants.blendEquations, Xs = ja.def(), Uo = ja.def();
                      return (zn = zn.cond("typeof ", si, '==="string"')).then(Xs, "=", Uo, "=", ko, "[", si, "];"), zn.else(Xs, "=", ko, "[", si, ".rgb];", Uo, "=", ko, "[", si, ".alpha];"), ja(zn), [Xs, Uo];
                    });
                  case "blend.color":
                    return qa(function(zn) {
                      return l(4, function(ja) {
                        return +zn[ja];
                      });
                    }, function(zn, ja, si) {
                      return l(4, function(ko) {
                        return ja.def("+", si, "[", ko, "]");
                      });
                    });
                  case "stencil.mask":
                    return qa(function(zn) {
                      return 0 | zn;
                    }, function(zn, ja, si) {
                      return ja.def(si, "|0");
                    });
                  case "stencil.func":
                    return qa(function(zn) {
                      return [Jt[zn.cmp || "keep"], zn.ref || 0, "mask" in zn ? zn.mask : -1];
                    }, function(zn, ja, si) {
                      return [zn = ja.def('"cmp" in ', si, "?", zn.constants.compareFuncs, "[", si, ".cmp]", ":", 7680), ja.def(si, ".ref|0"), ja = ja.def('"mask" in ', si, "?", si, ".mask|0:-1")];
                    });
                  case "stencil.opFront":
                  case "stencil.opBack":
                    return qa(function(zn) {
                      return [Kn === "stencil.opBack" ? 1029 : 1028, tr[zn.fail || "keep"], tr[zn.zfail || "keep"], tr[zn.zpass || "keep"]];
                    }, function(zn, ja, si) {
                      function ko(Uo) {
                        return ja.def('"', Uo, '" in ', si, "?", Xs, "[", si, ".", Uo, "]:", 7680);
                      }
                      var Xs = zn.constants.stencilOps;
                      return [Kn === "stencil.opBack" ? 1029 : 1028, ko("fail"), ko("zfail"), ko("zpass")];
                    });
                  case "polygonOffset.offset":
                    return qa(function(zn) {
                      return [0 | zn.factor, 0 | zn.units];
                    }, function(zn, ja, si) {
                      return [ja.def(si, ".factor|0"), ja = ja.def(si, ".units|0")];
                    });
                  case "cull.face":
                    return qa(function(zn) {
                      var ja = 0;
                      return zn === "front" ? ja = 1028 : zn === "back" && (ja = 1029), ja;
                    }, function(zn, ja, si) {
                      return ja.def(si, '==="front"?', 1028, ":", 1029);
                    });
                  case "lineWidth":
                    return qa(function(zn) {
                      return zn;
                    }, function(zn, ja, si) {
                      return si;
                    });
                  case "frontFace":
                    return qa(function(zn) {
                      return Ye[zn];
                    }, function(zn, ja, si) {
                      return ja.def(si + '==="cw"?2304:2305');
                    });
                  case "colorMask":
                    return qa(function(zn) {
                      return zn.map(function(ja) {
                        return !!ja;
                      });
                    }, function(zn, ja, si) {
                      return l(4, function(ko) {
                        return "!!" + si + "[" + ko + "]";
                      });
                    });
                  case "sample.coverage":
                    return qa(function(zn) {
                      return ["value" in zn ? zn.value : 1, !!zn.invert];
                    }, function(zn, ja, si) {
                      return [ja.def('"value" in ', si, "?+", si, ".value:1"), ja = ja.def("!!", si, ".invert")];
                    });
                }
              }), Rn;
            }(Ut), Rr = Je(Ut, 0, Ir);
            un("viewport"), un(Me("scissor.box"));
            var vn, Mn = 0 < Object.keys(jr).length;
            if ((vn = { framebuffer: vn, draw: Lr, shader: Rr, state: jr, dirty: Mn, scopeVAO: null, drawVAO: null, useVAO: false, attributes: {} }).profile = function(Bn) {
              var sn, an = Bn.static;
              if (Bn = Bn.dynamic, "profile" in an) {
                var Sn = !!an.profile;
                (sn = K2(function(Kn, qa) {
                  return Sn;
                })).enable = Sn;
              } else if ("profile" in Bn) {
                var Rn = Bn.profile;
                sn = q(Rn, function(Kn, qa) {
                  return Kn.invoke(qa, Rn);
                });
              }
              return sn;
            }(Ut), vn.uniforms = function(Bn, sn) {
              var an = Bn.static, Sn = Bn.dynamic, Rn = {};
              return Object.keys(an).forEach(function(Kn) {
                var qa, ka = an[Kn];
                if (typeof ka == "number" || typeof ka == "boolean") qa = K2(function() {
                  return ka;
                });
                else if (typeof ka == "function") {
                  var zn = ka._reglType;
                  zn === "texture2d" || zn === "textureCube" ? qa = K2(function(ja) {
                    return ja.link(ka);
                  }) : zn !== "framebuffer" && zn !== "framebufferCube" || (qa = K2(function(ja) {
                    return ja.link(ka.color[0]);
                  }));
                } else b(ka) && (qa = K2(function(ja) {
                  return ja.global.def("[", l(ka.length, function(si) {
                    return ka[si];
                  }), "]");
                }));
                qa.value = ka, Rn[Kn] = qa;
              }), Object.keys(Sn).forEach(function(Kn) {
                var qa = Sn[Kn];
                Rn[Kn] = q(qa, function(ka, zn) {
                  return ka.invoke(zn, qa);
                });
              }), Rn;
            }(xr), vn.drawVAO = vn.scopeVAO = Lr.vao, !vn.drawVAO && Rr.program && !Ir && Ie.angle_instanced_arrays && Lr.static.elements) {
              var jn = true;
              if (Ut = Rr.program.attributes.map(function(Bn) {
                return Bn = Zt.static[Bn], jn = jn && !!Bn, Bn;
              }), jn && 0 < Ut.length) {
                var bn = je.getVAO(je.createVAO({ attributes: Ut, elements: Lr.static.elements }));
                vn.drawVAO = new X2(null, null, null, function(Bn, sn) {
                  return Bn.link(bn);
                }), vn.useVAO = true;
              }
            }
            return Ir ? vn.useVAO = true : vn.attributes = vt(Zt), vn.context = function(Bn) {
              var sn = Bn.static, an = Bn.dynamic, Sn = {};
              return Object.keys(sn).forEach(function(Rn) {
                var Kn = sn[Rn];
                Sn[Rn] = K2(function(qa, ka) {
                  return typeof Kn == "number" || typeof Kn == "boolean" ? "" + Kn : qa.link(Kn);
                });
              }), Object.keys(an).forEach(function(Rn) {
                var Kn = an[Rn];
                Sn[Rn] = q(Kn, function(qa, ka) {
                  return qa.invoke(ka, Kn);
                });
              }), Sn;
            }(Fr), vn;
          }
          function jt(Ut, Zt, xr) {
            var Fr = Ut.shared.context, pn = Ut.scope();
            Object.keys(xr).forEach(function(un) {
              Zt.save(Fr, "." + un);
              var Ir = xr[un].append(Ut, Zt);
              Array.isArray(Ir) ? pn(Fr, ".", un, "=[", Ir.join(), "];") : pn(Fr, ".", un, "=", Ir, ";");
            }), Zt(pn);
          }
          function Vt(Ut, Zt, xr, Fr) {
            var pn, un = (Cr = Ut.shared).gl, Ir = Cr.framebuffer;
            qr && (pn = Zt.def(Cr.extensions, ".webgl_draw_buffers"));
            var Cr = (Lr = Ut.constants).drawBuffer, Lr = Lr.backBuffer;
            Ut = xr ? xr.append(Ut, Zt) : Zt.def(Ir, ".next"), Fr || Zt("if(", Ut, "!==", Ir, ".cur){"), Zt("if(", Ut, "){", un, ".bindFramebuffer(", 36160, ",", Ut, ".framebuffer);"), qr && Zt(pn, ".drawBuffersWEBGL(", Cr, "[", Ut, ".colorAttachments.length]);"), Zt("}else{", un, ".bindFramebuffer(", 36160, ",null);"), qr && Zt(pn, ".drawBuffersWEBGL(", Lr, ");"), Zt("}", Ir, ".cur=", Ut, ";"), Fr || Zt("}");
          }
          function Kt(Ut, Zt, xr) {
            var Fr = Ut.shared, pn = Fr.gl, un = Ut.current, Ir = Ut.next, Cr = Fr.current, Lr = Fr.next, jr = Ut.cond(Cr, ".dirty");
            tn.forEach(function(Rr) {
              var vn, Mn;
              if (!((Rr = Me(Rr)) in xr.state)) if (Rr in Ir) {
                vn = Ir[Rr], Mn = un[Rr];
                var jn = l(Zr[Rr].length, function(bn) {
                  return jr.def(vn, "[", bn, "]");
                });
                jr(Ut.cond(jn.map(function(bn, Bn) {
                  return bn + "!==" + Mn + "[" + Bn + "]";
                }).join("||")).then(pn, ".", Ln[Rr], "(", jn, ");", jn.map(function(bn, Bn) {
                  return Mn + "[" + Bn + "]=" + bn;
                }).join(";"), ";"));
              } else vn = jr.def(Lr, ".", Rr), jn = Ut.cond(vn, "!==", Cr, ".", Rr), jr(jn), Rr in Zn ? jn(Ut.cond(vn).then(pn, ".enable(", Zn[Rr], ");").else(pn, ".disable(", Zn[Rr], ");"), Cr, ".", Rr, "=", vn, ";") : jn(pn, ".", Ln[Rr], "(", vn, ");", Cr, ".", Rr, "=", vn, ";");
            }), Object.keys(xr.state).length === 0 && jr(Cr, ".dirty=false;"), Zt(jr);
          }
          function rr(Ut, Zt, xr, Fr) {
            var pn = Ut.shared, un = Ut.current, Ir = pn.current, Cr = pn.gl;
            W2(Object.keys(xr)).forEach(function(Lr) {
              var jr = xr[Lr];
              if (!Fr || Fr(jr)) {
                var Rr = jr.append(Ut, Zt);
                if (Zn[Lr]) {
                  var vn = Zn[Lr];
                  Y2(jr) ? Zt(Cr, Rr ? ".enable(" : ".disable(", vn, ");") : Zt(Ut.cond(Rr).then(Cr, ".enable(", vn, ");").else(Cr, ".disable(", vn, ");")), Zt(Ir, ".", Lr, "=", Rr, ";");
                } else if (b(Rr)) {
                  var Mn = un[Lr];
                  Zt(Cr, ".", Ln[Lr], "(", Rr, ");", Rr.map(function(jn, bn) {
                    return Mn + "[" + bn + "]=" + jn;
                  }).join(";"), ";");
                } else Zt(Cr, ".", Ln[Lr], "(", Rr, ");", Ir, ".", Lr, "=", Rr, ";");
              }
            });
          }
          function Tr(Ut, Zt) {
            _n && (Ut.instancing = Zt.def(Ut.shared.extensions, ".angle_instanced_arrays"));
          }
          function yr(Ut, Zt, xr, Fr, pn) {
            function un() {
              return typeof performance > "u" ? "Date.now()" : "performance.now()";
            }
            function Ir(Bn) {
              Bn(jr = Zt.def(), "=", un(), ";"), typeof pn == "string" ? Bn(Mn, ".count+=", pn, ";") : Bn(Mn, ".count++;"), Ne && (Fr ? Bn(Rr = Zt.def(), "=", bn, ".getNumPendingQueries();") : Bn(bn, ".beginQuery(", Mn, ");"));
            }
            function Cr(Bn) {
              Bn(Mn, ".cpuTime+=", un(), "-", jr, ";"), Ne && (Fr ? Bn(bn, ".pushScopeStats(", Rr, ",", bn, ".getNumPendingQueries(),", Mn, ");") : Bn(bn, ".endQuery();"));
            }
            function Lr(Bn) {
              var sn = Zt.def(jn, ".profile");
              Zt(jn, ".profile=", Bn, ";"), Zt.exit(jn, ".profile=", sn, ";");
            }
            var jr, Rr, vn = Ut.shared, Mn = Ut.stats, jn = vn.current, bn = vn.timer;
            if (xr = xr.profile) {
              if (Y2(xr)) return void (xr.enable ? (Ir(Zt), Cr(Zt.exit), Lr("true")) : Lr("false"));
              Lr(xr = xr.append(Ut, Zt));
            } else xr = Zt.def(jn, ".profile");
            Ir(vn = Ut.block()), Zt("if(", xr, "){", vn, "}"), Cr(Ut = Ut.block()), Zt.exit("if(", xr, "){", Ut, "}");
          }
          function pr(Ut, Zt, xr, Fr, pn) {
            function un(Cr, Lr, jr) {
              function Rr() {
                Zt("if(!", bn, ".buffer){", Mn, ".enableVertexAttribArray(", jn, ");}");
                var Sn, Rn = jr.type;
                Sn = jr.size ? Zt.def(jr.size, "||", Lr) : Lr, Zt("if(", bn, ".type!==", Rn, "||", bn, ".size!==", Sn, "||", an.map(function(Kn) {
                  return bn + "." + Kn + "!==" + jr[Kn];
                }).join("||"), "){", Mn, ".bindBuffer(", 34962, ",", Bn, ".buffer);", Mn, ".vertexAttribPointer(", [jn, Sn, Rn, jr.normalized, jr.stride, jr.offset], ");", bn, ".type=", Rn, ";", bn, ".size=", Sn, ";", an.map(function(Kn) {
                  return bn + "." + Kn + "=" + jr[Kn] + ";";
                }).join(""), "}"), _n && (Rn = jr.divisor, Zt("if(", bn, ".divisor!==", Rn, "){", Ut.instancing, ".vertexAttribDivisorANGLE(", [jn, Rn], ");", bn, ".divisor=", Rn, ";}"));
              }
              function vn() {
                Zt("if(", bn, ".buffer){", Mn, ".disableVertexAttribArray(", jn, ");", bn, ".buffer=null;", "}if(", yt.map(function(Sn, Rn) {
                  return bn + "." + Sn + "!==" + sn[Rn];
                }).join("||"), "){", Mn, ".vertexAttrib4f(", jn, ",", sn, ");", yt.map(function(Sn, Rn) {
                  return bn + "." + Sn + "=" + sn[Rn] + ";";
                }).join(""), "}");
              }
              var Mn = Ir.gl, jn = Zt.def(Cr, ".location"), bn = Zt.def(Ir.attributes, "[", jn, "]");
              Cr = jr.state;
              var Bn = jr.buffer, sn = [jr.x, jr.y, jr.z, jr.w], an = ["buffer", "normalized", "offset", "stride"];
              Cr === 1 ? Rr() : Cr === 2 ? vn() : (Zt("if(", Cr, "===", 1, "){"), Rr(), Zt("}else{"), vn(), Zt("}"));
            }
            var Ir = Ut.shared;
            Fr.forEach(function(Cr) {
              var Lr, jr = Cr.name, Rr = xr.attributes[jr];
              if (Rr) {
                if (!pn(Rr)) return;
                Lr = Rr.append(Ut, Zt);
              } else {
                if (!pn(at)) return;
                var vn = Ut.scopeAttrib(jr);
                Lr = {}, Object.keys(new Xn()).forEach(function(Mn) {
                  Lr[Mn] = Zt.def(vn, ".", Mn);
                });
              }
              un(Ut.link(Cr), function(Mn) {
                switch (Mn) {
                  case 35664:
                  case 35667:
                  case 35671:
                    return 2;
                  case 35665:
                  case 35668:
                  case 35672:
                    return 3;
                  case 35666:
                  case 35669:
                  case 35673:
                    return 4;
                  default:
                    return 1;
                }
              }(Cr.info.type), Lr);
            });
          }
          function lr(Ut, Zt, xr, Fr, pn, un) {
            for (var Ir, Cr = Ut.shared, Lr = Cr.gl, jr = {}, Rr = 0; Rr < Fr.length; ++Rr) {
              var vn = (an = Fr[Rr]).name, Mn = an.info.type, jn = an.info.size, bn = xr.uniforms[vn];
              if (1 < jn) {
                if (!bn) continue;
                var Bn = vn.replace("[0]", "");
                if (jr[Bn]) continue;
                jr[Bn] = 1;
              }
              var sn, an = Ut.link(an) + ".location";
              if (bn) {
                if (!pn(bn)) continue;
                if (Y2(bn)) {
                  if (vn = bn.value, Mn === 35678 || Mn === 35680) Zt(Lr, ".uniform1i(", an, ",", (Mn = Ut.link(vn._texture || vn.color[0]._texture)) + ".bind());"), Zt.exit(Mn, ".unbind();");
                  else if (Mn === 35674 || Mn === 35675 || Mn === 35676) jn = Ut.global.def("new Float32Array([" + Array.prototype.slice.call(vn) + "])"), vn = 2, Mn === 35675 ? vn = 3 : Mn === 35676 && (vn = 4), Zt(Lr, ".uniformMatrix", vn, "fv(", an, ",false,", jn, ");");
                  else {
                    switch (Mn) {
                      case 5126:
                        Ir = "1f";
                        break;
                      case 35664:
                        Ir = "2f";
                        break;
                      case 35665:
                        Ir = "3f";
                        break;
                      case 35666:
                        Ir = "4f";
                        break;
                      case 35670:
                      case 5124:
                        Ir = "1i";
                        break;
                      case 35671:
                      case 35667:
                        Ir = "2i";
                        break;
                      case 35672:
                      case 35668:
                        Ir = "3i";
                        break;
                      case 35673:
                        Ir = "4i";
                        break;
                      case 35669:
                        Ir = "4i";
                    }
                    1 < jn ? (Ir += "v", vn = Ut.global.def("[" + Array.prototype.slice.call(vn) + "]")) : vn = b(vn) ? Array.prototype.slice.call(vn) : vn, Zt(Lr, ".uniform", Ir, "(", an, ",", vn, ");");
                  }
                  continue;
                }
                sn = bn.append(Ut, Zt);
              } else {
                if (!pn(at)) continue;
                sn = Zt.def(Cr.uniforms, "[", st.id(vn), "]");
              }
              switch (Mn === 35678 ? Zt("if(", sn, "&&", sn, '._reglType==="framebuffer"){', sn, "=", sn, ".color[0];", "}") : Mn === 35680 && Zt("if(", sn, "&&", sn, '._reglType==="framebufferCube"){', sn, "=", sn, ".color[0];", "}"), vn = 1, Mn) {
                case 35678:
                case 35680:
                  Mn = Zt.def(sn, "._texture"), Zt(Lr, ".uniform1i(", an, ",", Mn, ".bind());"), Zt.exit(Mn, ".unbind();");
                  continue;
                case 5124:
                case 35670:
                  Ir = "1i";
                  break;
                case 35667:
                case 35671:
                  Ir = "2i", vn = 2;
                  break;
                case 35668:
                case 35672:
                  Ir = "3i", vn = 3;
                  break;
                case 35669:
                case 35673:
                  Ir = "4i", vn = 4;
                  break;
                case 5126:
                  Ir = "1f";
                  break;
                case 35664:
                  Ir = "2f", vn = 2;
                  break;
                case 35665:
                  Ir = "3f", vn = 3;
                  break;
                case 35666:
                  Ir = "4f", vn = 4;
                  break;
                case 35674:
                  Ir = "Matrix2fv";
                  break;
                case 35675:
                  Ir = "Matrix3fv";
                  break;
                case 35676:
                  Ir = "Matrix4fv";
              }
              if (Ir.indexOf("Matrix") === -1 && 1 < jn && (Ir += "v", vn = 1), Ir.charAt(0) === "M") {
                Zt(Lr, ".uniform", Ir, "(", an, ","), an = Math.pow(Mn - 35674 + 2, 2);
                var Sn = Ut.global.def("new Float32Array(", an, ")");
                Array.isArray(sn) ? Zt("false,(", l(an, function(Kn) {
                  return Sn + "[" + Kn + "]=" + sn[Kn];
                }), ",", Sn, ")") : Zt("false,(Array.isArray(", sn, ")||", sn, " instanceof Float32Array)?", sn, ":(", l(an, function(Kn) {
                  return Sn + "[" + Kn + "]=" + sn + "[" + Kn + "]";
                }), ",", Sn, ")"), Zt(");");
              } else {
                if (1 < vn) {
                  Mn = [];
                  var Rn = [];
                  for (jn = 0; jn < vn; ++jn) Array.isArray(sn) ? Rn.push(sn[jn]) : Rn.push(Zt.def(sn + "[" + jn + "]")), un && Mn.push(Zt.def());
                  un && Zt("if(!", Ut.batchId, "||", Mn.map(function(Kn, qa) {
                    return Kn + "!==" + Rn[qa];
                  }).join("||"), "){", Mn.map(function(Kn, qa) {
                    return Kn + "=" + Rn[qa] + ";";
                  }).join("")), Zt(Lr, ".uniform", Ir, "(", an, ",", Rn.join(","), ");");
                } else un && (Mn = Zt.def(), Zt("if(!", Ut.batchId, "||", Mn, "!==", sn, "){", Mn, "=", sn, ";")), Zt(Lr, ".uniform", Ir, "(", an, ",", sn, ");");
                un && Zt("}");
              }
            }
          }
          function _r(Ut, Zt, xr, Fr) {
            function pn(Rn) {
              var Kn = Mn[Rn];
              return Kn ? Kn.contextDep && Fr.contextDynamic || Kn.propDep ? Kn.append(Ut, xr) : Kn.append(Ut, Zt) : Zt.def(vn, ".", Rn);
            }
            function un() {
              function Rn() {
                xr(Lr, ".drawElementsInstancedANGLE(", [bn, sn, an, Bn + "<<((" + an + "-5121)>>1)", Cr], ");");
              }
              function Kn() {
                xr(Lr, ".drawArraysInstancedANGLE(", [bn, Bn, sn, Cr], ");");
              }
              jn && jn !== "null" ? Sn ? Rn() : (xr("if(", jn, "){"), Rn(), xr("}else{"), Kn(), xr("}")) : Kn();
            }
            function Ir() {
              function Rn() {
                xr(Rr + ".drawElements(" + [bn, sn, an, Bn + "<<((" + an + "-5121)>>1)"] + ");");
              }
              function Kn() {
                xr(Rr + ".drawArrays(" + [bn, Bn, sn] + ");");
              }
              jn && jn !== "null" ? Sn ? Rn() : (xr("if(", jn, "){"), Rn(), xr("}else{"), Kn(), xr("}")) : Kn();
            }
            var Cr, Lr, jr = Ut.shared, Rr = jr.gl, vn = jr.draw, Mn = Fr.draw, jn = function() {
              var Rn = Mn.elements, Kn = Zt;
              return Rn ? ((Rn.contextDep && Fr.contextDynamic || Rn.propDep) && (Kn = xr), Rn = Rn.append(Ut, Kn), Mn.elementsActive && Kn("if(" + Rn + ")" + Rr + ".bindBuffer(34963," + Rn + ".buffer.buffer);")) : (Rn = Kn.def(), Kn(Rn, "=", vn, ".", "elements", ";", "if(", Rn, "){", Rr, ".bindBuffer(", 34963, ",", Rn, ".buffer.buffer);}", "else if(", jr.vao, ".currentVAO){", Rn, "=", Ut.shared.elements + ".getElements(" + jr.vao, ".currentVAO.elements);", Nr ? "" : "if(" + Rn + ")" + Rr + ".bindBuffer(34963," + Rn + ".buffer.buffer);", "}")), Rn;
            }(), bn = pn("primitive"), Bn = pn("offset"), sn = function() {
              var Rn = Mn.count, Kn = Zt;
              return Rn ? ((Rn.contextDep && Fr.contextDynamic || Rn.propDep) && (Kn = xr), Rn = Rn.append(Ut, Kn)) : Rn = Kn.def(vn, ".", "count"), Rn;
            }();
            if (typeof sn == "number") {
              if (sn === 0) return;
            } else xr("if(", sn, "){"), xr.exit("}");
            _n && (Cr = pn("instances"), Lr = Ut.instancing);
            var an = jn + ".type", Sn = Mn.elements && Y2(Mn.elements) && !Mn.vaoActive;
            _n && (typeof Cr != "number" || 0 <= Cr) ? typeof Cr == "string" ? (xr("if(", Cr, ">0){"), un(), xr("}else if(", Cr, "<0){"), Ir(), xr("}")) : un() : Ir();
          }
          function $r(Ut, Zt, xr, Fr, pn) {
            return pn = (Zt = ft()).proc("body", pn), _n && (Zt.instancing = pn.def(Zt.shared.extensions, ".angle_instanced_arrays")), Ut(Zt, pn, xr, Fr), Zt.compile().body;
          }
          function Ar(Ut, Zt, xr, Fr) {
            Tr(Ut, Zt), xr.useVAO ? xr.drawVAO ? Zt(Ut.shared.vao, ".setVAO(", xr.drawVAO.append(Ut, Zt), ");") : Zt(Ut.shared.vao, ".setVAO(", Ut.shared.vao, ".targetVAO);") : (Zt(Ut.shared.vao, ".setVAO(null);"), pr(Ut, Zt, xr, Fr.attributes, function() {
              return true;
            })), lr(Ut, Zt, xr, Fr.uniforms, function() {
              return true;
            }, false), _r(Ut, Zt, Zt, xr);
          }
          function Qr(Ut, Zt, xr, Fr) {
            function pn() {
              return true;
            }
            Ut.batchId = "a1", Tr(Ut, Zt), pr(Ut, Zt, xr, Fr.attributes, pn), lr(Ut, Zt, xr, Fr.uniforms, pn, false), _r(Ut, Zt, Zt, xr);
          }
          function hn(Ut, Zt, xr, Fr) {
            function pn(vn) {
              return vn.contextDep && Ir || vn.propDep;
            }
            function un(vn) {
              return !pn(vn);
            }
            Tr(Ut, Zt);
            var Ir = xr.contextDep, Cr = Zt.def(), Lr = Zt.def();
            Ut.shared.props = Lr, Ut.batchId = Cr;
            var jr = Ut.scope(), Rr = Ut.scope();
            Zt(jr.entry, "for(", Cr, "=0;", Cr, "<", "a1", ";++", Cr, "){", Lr, "=", "a0", "[", Cr, "];", Rr, "}", jr.exit), xr.needsContext && jt(Ut, Rr, xr.context), xr.needsFramebuffer && Vt(Ut, Rr, xr.framebuffer), rr(Ut, Rr, xr.state, pn), xr.profile && pn(xr.profile) && yr(Ut, Rr, xr, false, true), Fr ? (xr.useVAO ? xr.drawVAO ? pn(xr.drawVAO) ? Rr(Ut.shared.vao, ".setVAO(", xr.drawVAO.append(Ut, Rr), ");") : jr(Ut.shared.vao, ".setVAO(", xr.drawVAO.append(Ut, jr), ");") : jr(Ut.shared.vao, ".setVAO(", Ut.shared.vao, ".targetVAO);") : (jr(Ut.shared.vao, ".setVAO(null);"), pr(Ut, jr, xr, Fr.attributes, un), pr(Ut, Rr, xr, Fr.attributes, pn)), lr(Ut, jr, xr, Fr.uniforms, un, false), lr(Ut, Rr, xr, Fr.uniforms, pn, true), _r(Ut, jr, Rr, xr)) : (Zt = Ut.global.def("{}"), Fr = xr.shader.progVar.append(Ut, Rr), Lr = Rr.def(Fr, ".id"), jr = Rr.def(Zt, "[", Lr, "]"), Rr(Ut.shared.gl, ".useProgram(", Fr, ".program);", "if(!", jr, "){", jr, "=", Zt, "[", Lr, "]=", Ut.link(function(vn) {
              return $r(Qr, Ut, xr, vn, 2);
            }), "(", Fr, ");}", jr, ".call(this,a0[", Cr, "],", Cr, ");"));
          }
          function wn(Ut, Zt) {
            function xr(Ir) {
              var Cr = Zt.shader[Ir];
              Cr && Fr.set(pn.shader, "." + Ir, Cr.append(Ut, Fr));
            }
            var Fr = Ut.proc("scope", 3);
            Ut.batchId = "a2";
            var pn = Ut.shared, un = pn.current;
            jt(Ut, Fr, Zt.context), Zt.framebuffer && Zt.framebuffer.append(Ut, Fr), W2(Object.keys(Zt.state)).forEach(function(Ir) {
              var Cr = Zt.state[Ir].append(Ut, Fr);
              b(Cr) ? Cr.forEach(function(Lr, jr) {
                Fr.set(Ut.next[Ir], "[" + jr + "]", Lr);
              }) : Fr.set(pn.next, "." + Ir, Cr);
            }), yr(Ut, Fr, Zt, true, true), ["elements", "offset", "count", "instances", "primitive"].forEach(function(Ir) {
              var Cr = Zt.draw[Ir];
              Cr && Fr.set(pn.draw, "." + Ir, "" + Cr.append(Ut, Fr));
            }), Object.keys(Zt.uniforms).forEach(function(Ir) {
              var Cr = Zt.uniforms[Ir].append(Ut, Fr);
              Array.isArray(Cr) && (Cr = "[" + Cr.join() + "]"), Fr.set(pn.uniforms, "[" + st.id(Ir) + "]", Cr);
            }), Object.keys(Zt.attributes).forEach(function(Ir) {
              var Cr = Zt.attributes[Ir].append(Ut, Fr), Lr = Ut.scopeAttrib(Ir);
              Object.keys(new Xn()).forEach(function(jr) {
                Fr.set(Lr, "." + jr, Cr[jr]);
              });
            }), Zt.scopeVAO && Fr.set(pn.vao, ".targetVAO", Zt.scopeVAO.append(Ut, Fr)), xr("vert"), xr("frag"), 0 < Object.keys(Zt.state).length && (Fr(un, ".dirty=true;"), Fr.exit(un, ".dirty=true;")), Fr("a1(", Ut.shared.context, ",a0,", Ut.batchId, ");");
          }
          function Yn(Ut, Zt, xr) {
            var Fr = Zt.static[xr];
            if (Fr && function(Rr) {
              if (typeof Rr == "object" && !b(Rr)) {
                for (var vn = Object.keys(Rr), Mn = 0; Mn < vn.length; ++Mn) if (te.isDynamic(Rr[vn[Mn]])) return true;
                return false;
              }
            }(Fr)) {
              var pn = Ut.global, un = Object.keys(Fr), Ir = false, Cr = false, Lr = false, jr = Ut.global.def("{}");
              un.forEach(function(Rr) {
                var vn = Fr[Rr];
                if (te.isDynamic(vn)) typeof vn == "function" && (vn = Fr[Rr] = te.unbox(vn)), Rr = q(vn, null), Ir = Ir || Rr.thisDep, Lr = Lr || Rr.propDep, Cr = Cr || Rr.contextDep;
                else {
                  switch (pn(jr, ".", Rr, "="), typeof vn) {
                    case "number":
                      pn(vn);
                      break;
                    case "string":
                      pn('"', vn, '"');
                      break;
                    case "object":
                      Array.isArray(vn) && pn("[", vn.join(), "]");
                      break;
                    default:
                      pn(Ut.link(vn));
                  }
                  pn(";");
                }
              }), Zt.dynamic[xr] = new te.DynamicVariable(4, { thisDep: Ir, contextDep: Cr, propDep: Lr, ref: jr, append: function(Rr, vn) {
                un.forEach(function(Mn) {
                  var jn = Fr[Mn];
                  te.isDynamic(jn) && (jn = Rr.invoke(vn, jn), vn(jr, ".", Mn, "=", jn, ";"));
                });
              } }), delete Zt.static[xr];
            }
          }
          var Xn = je.Record, Wn = { add: 32774, subtract: 32778, "reverse subtract": 32779 };
          Ie.ext_blend_minmax && (Wn.min = 32775, Wn.max = 32776);
          var _n = Ie.angle_instanced_arrays, qr = Ie.webgl_draw_buffers, Nr = Ie.oes_vertex_array_object, Zr = { dirty: true, profile: ke.profile }, oa = {}, tn = [], Zn = {}, Ln = {};
          Le("dither", 3024), Le("blend.enable", 3042), ze("blend.color", "blendColor", [0, 0, 0, 0]), ze("blend.equation", "blendEquationSeparate", [32774, 32774]), ze("blend.func", "blendFuncSeparate", [1, 0, 1, 0]), Le("depth.enable", 2929, true), ze("depth.func", "depthFunc", 513), ze("depth.range", "depthRange", [0, 1]), ze("depth.mask", "depthMask", true), ze("colorMask", "colorMask", [true, true, true, true]), Le("cull.enable", 2884), ze("cull.face", "cullFace", 1029), ze("frontFace", "frontFace", 2305), ze("lineWidth", "lineWidth", 1), Le("polygonOffset.enable", 32823), ze("polygonOffset.offset", "polygonOffset", [0, 0]), Le("sample.alpha", 32926), Le("sample.enable", 32928), ze("sample.coverage", "sampleCoverage", [1, false]), Le("stencil.enable", 2960), ze("stencil.mask", "stencilMask", -1), ze("stencil.func", "stencilFunc", [519, 0, -1]), ze("stencil.opFront", "stencilOpSeparate", [1028, 7680, 7680, 7680]), ze("stencil.opBack", "stencilOpSeparate", [1029, 7680, 7680, 7680]), Le("scissor.enable", 3089), ze("scissor.box", "scissor", [0, 0, Ge.drawingBufferWidth, Ge.drawingBufferHeight]), ze("viewport", "viewport", [0, 0, Ge.drawingBufferWidth, Ge.drawingBufferHeight]);
          var gn = { gl: Ge, context: xe, strings: st, next: oa, current: Zr, draw: He, elements: Ve, buffer: $e, shader: rt, attributes: je.state, vao: je, uniforms: qe, framebuffer: Re, extensions: Ie, timer: Ne, isBufferArgs: V2 }, na = { primTypes: Ae, compareFuncs: Jt, blendFuncs: Ot, blendEquations: Wn, stencilOps: tr, glTypes: se, orientationType: Ye };
          qr && (na.backBuffer = [1029], na.drawBuffer = l(Pe.maxDrawbuffers, function(Ut) {
            return Ut === 0 ? [0] : l(Ut, function(Zt) {
              return 36064 + Zt;
            });
          }));
          var sr = 0;
          return { next: oa, current: Zr, procs: function() {
            var Ut = ft(), Zt = Ut.proc("poll"), xr = Ut.proc("refresh"), Fr = Ut.block();
            Zt(Fr), xr(Fr);
            var pn, un = Ut.shared, Ir = un.gl, Cr = un.next, Lr = un.current;
            Fr(Lr, ".dirty=false;"), Vt(Ut, Zt), Vt(Ut, xr, null, true), _n && (pn = Ut.link(_n)), Ie.oes_vertex_array_object && xr(Ut.link(Ie.oes_vertex_array_object), ".bindVertexArrayOES(null);");
            for (var jr = 0; jr < Pe.maxAttributes; ++jr) {
              var Rr = xr.def(un.attributes, "[", jr, "]"), vn = Ut.cond(Rr, ".buffer");
              vn.then(Ir, ".enableVertexAttribArray(", jr, ");", Ir, ".bindBuffer(", 34962, ",", Rr, ".buffer.buffer);", Ir, ".vertexAttribPointer(", jr, ",", Rr, ".size,", Rr, ".type,", Rr, ".normalized,", Rr, ".stride,", Rr, ".offset);").else(Ir, ".disableVertexAttribArray(", jr, ");", Ir, ".vertexAttrib4f(", jr, ",", Rr, ".x,", Rr, ".y,", Rr, ".z,", Rr, ".w);", Rr, ".buffer=null;"), xr(vn), _n && xr(pn, ".vertexAttribDivisorANGLE(", jr, ",", Rr, ".divisor);");
            }
            return xr(Ut.shared.vao, ".currentVAO=null;", Ut.shared.vao, ".setVAO(", Ut.shared.vao, ".targetVAO);"), Object.keys(Zn).forEach(function(Mn) {
              var jn = Zn[Mn], bn = Fr.def(Cr, ".", Mn), Bn = Ut.block();
              Bn("if(", bn, "){", Ir, ".enable(", jn, ")}else{", Ir, ".disable(", jn, ")}", Lr, ".", Mn, "=", bn, ";"), xr(Bn), Zt("if(", bn, "!==", Lr, ".", Mn, "){", Bn, "}");
            }), Object.keys(Ln).forEach(function(Mn) {
              var jn, bn, Bn = Ln[Mn], sn = Zr[Mn], an = Ut.block();
              an(Ir, ".", Bn, "("), b(sn) ? (Bn = sn.length, jn = Ut.global.def(Cr, ".", Mn), bn = Ut.global.def(Lr, ".", Mn), an(l(Bn, function(Sn) {
                return jn + "[" + Sn + "]";
              }), ");", l(Bn, function(Sn) {
                return bn + "[" + Sn + "]=" + jn + "[" + Sn + "];";
              }).join("")), Zt("if(", l(Bn, function(Sn) {
                return jn + "[" + Sn + "]!==" + bn + "[" + Sn + "]";
              }).join("||"), "){", an, "}")) : (jn = Fr.def(Cr, ".", Mn), bn = Fr.def(Lr, ".", Mn), an(jn, ");", Lr, ".", Mn, "=", jn, ";"), Zt("if(", jn, "!==", bn, "){", an, "}")), xr(an);
            }), Ut.compile();
          }(), compile: function(Ut, Zt, xr, Fr, pn) {
            var un = ft();
            un.stats = un.link(pn), Object.keys(Zt.static).forEach(function(Cr) {
              Yn(un, Zt, Cr);
            }), pt.forEach(function(Cr) {
              Yn(un, Ut, Cr);
            });
            var Ir = kt(Ut, Zt, xr, Fr);
            return function(Cr, Lr) {
              var jr = Cr.proc("draw", 1);
              Tr(Cr, jr), jt(Cr, jr, Lr.context), Vt(Cr, jr, Lr.framebuffer), Kt(Cr, jr, Lr), rr(Cr, jr, Lr.state), yr(Cr, jr, Lr, false, true);
              var Rr = Lr.shader.progVar.append(Cr, jr);
              if (jr(Cr.shared.gl, ".useProgram(", Rr, ".program);"), Lr.shader.program) Ar(Cr, jr, Lr, Lr.shader.program);
              else {
                jr(Cr.shared.vao, ".setVAO(null);");
                var vn = Cr.global.def("{}"), Mn = jr.def(Rr, ".id"), jn = jr.def(vn, "[", Mn, "]");
                jr(Cr.cond(jn).then(jn, ".call(this,a0);").else(jn, "=", vn, "[", Mn, "]=", Cr.link(function(bn) {
                  return $r(Ar, Cr, Lr, bn, 1);
                }), "(", Rr, ");", jn, ".call(this,a0);"));
              }
              0 < Object.keys(Lr.state).length && jr(Cr.shared.current, ".dirty=true;"), Cr.shared.vao && jr(Cr.shared.vao, ".setVAO(null);");
            }(un, Ir), wn(un, Ir), function(Cr, Lr) {
              function jr(sn) {
                return sn.contextDep && vn || sn.propDep;
              }
              var Rr = Cr.proc("batch", 2);
              Cr.batchId = "0", Tr(Cr, Rr);
              var vn = false, Mn = true;
              Object.keys(Lr.context).forEach(function(sn) {
                vn = vn || Lr.context[sn].propDep;
              }), vn || (jt(Cr, Rr, Lr.context), Mn = false);
              var jn = false;
              if ((bn = Lr.framebuffer) ? (bn.propDep ? vn = jn = true : bn.contextDep && vn && (jn = true), jn || Vt(Cr, Rr, bn)) : Vt(Cr, Rr, null), Lr.state.viewport && Lr.state.viewport.propDep && (vn = true), Kt(Cr, Rr, Lr), rr(Cr, Rr, Lr.state, function(sn) {
                return !jr(sn);
              }), Lr.profile && jr(Lr.profile) || yr(Cr, Rr, Lr, false, "a1"), Lr.contextDep = vn, Lr.needsContext = Mn, Lr.needsFramebuffer = jn, (Mn = Lr.shader.progVar).contextDep && vn || Mn.propDep) hn(Cr, Rr, Lr, null);
              else if (Mn = Mn.append(Cr, Rr), Rr(Cr.shared.gl, ".useProgram(", Mn, ".program);"), Lr.shader.program) hn(Cr, Rr, Lr, Lr.shader.program);
              else {
                Rr(Cr.shared.vao, ".setVAO(null);");
                var bn = Cr.global.def("{}"), Bn = (jn = Rr.def(Mn, ".id"), Rr.def(bn, "[", jn, "]"));
                Rr(Cr.cond(Bn).then(Bn, ".call(this,a0,a1);").else(Bn, "=", bn, "[", jn, "]=", Cr.link(function(sn) {
                  return $r(hn, Cr, Lr, sn, 2);
                }), "(", Mn, ");", Bn, ".call(this,a0,a1);"));
              }
              0 < Object.keys(Lr.state).length && Rr(Cr.shared.current, ".dirty=true;"), Cr.shared.vao && Rr(Cr.shared.vao, ".setVAO(null);");
            }(un, Ir), z(un.compile(), { destroy: function() {
              Ir.shader.program.destroy();
            } });
          } };
        }
        function R2(Ge, st) {
          for (var Ie = 0; Ie < Ge.length; ++Ie) if (Ge[Ie] === st) return Ie;
          return -1;
        }
        var z = function(Ge, st) {
          for (var Ie = Object.keys(st), Pe = 0; Pe < Ie.length; ++Pe) Ge[Ie[Pe]] = st[Ie[Pe]];
          return Ge;
        }, H2 = 0, te = { DynamicVariable: n, define: function(Ge, st) {
          return new n(Ge, a(st + ""));
        }, isDynamic: function(Ge) {
          return typeof Ge == "function" && !Ge._reglType || Ge instanceof n;
        }, unbox: function Ge(st, Ie) {
          return typeof st == "function" ? new n(0, st) : typeof st == "number" || typeof st == "boolean" ? new n(5, st) : Array.isArray(st) ? new n(6, st.map(function(Pe, $e) {
            return Ge(Pe, Ie + "[" + $e + "]");
          })) : st instanceof n ? st : void 0;
        }, accessor: a }, j = { next: typeof requestAnimationFrame == "function" ? function(Ge) {
          return requestAnimationFrame(Ge);
        } : function(Ge) {
          return setTimeout(Ge, 16);
        }, cancel: typeof cancelAnimationFrame == "function" ? function(Ge) {
          return cancelAnimationFrame(Ge);
        } : clearTimeout }, Q2 = typeof performance < "u" && performance.now ? function() {
          return performance.now();
        } : function() {
          return +/* @__PURE__ */ new Date();
        }, Z2 = c();
        Z2.zero = c();
        var ne = function(Ge, st) {
          var Ie = 1;
          st.ext_texture_filter_anisotropic && (Ie = Ge.getParameter(34047));
          var Pe = 1, $e = 1;
          st.webgl_draw_buffers && (Pe = Ge.getParameter(34852), $e = Ge.getParameter(36063));
          var Ve = !!st.oes_texture_float;
          if (Ve) {
            Ve = Ge.createTexture(), Ge.bindTexture(3553, Ve), Ge.texImage2D(3553, 0, 6408, 1, 1, 0, 6408, 5126, null);
            var ut = Ge.createFramebuffer();
            if (Ge.bindFramebuffer(36160, ut), Ge.framebufferTexture2D(36160, 36064, 3553, Ve, 0), Ge.bindTexture(3553, null), Ge.checkFramebufferStatus(36160) !== 36053) Ve = false;
            else {
              Ge.viewport(0, 0, 1, 1), Ge.clearColor(1, 0, 0, 1), Ge.clear(16384);
              var Re = Z2.allocType(5126, 4);
              Ge.readPixels(0, 0, 1, 1, 6408, 5126, Re), Ge.getError() ? Ve = false : (Ge.deleteFramebuffer(ut), Ge.deleteTexture(Ve), Ve = Re[0] === 1), Z2.freeType(Re);
            }
          }
          return Re = true, typeof navigator < "u" && (/MSIE/.test(navigator.userAgent) || /Trident\//.test(navigator.appVersion) || /Edge/.test(navigator.userAgent)) || (Re = Ge.createTexture(), ut = Z2.allocType(5121, 36), Ge.activeTexture(33984), Ge.bindTexture(34067, Re), Ge.texImage2D(34069, 0, 6408, 3, 3, 0, 6408, 5121, ut), Z2.freeType(ut), Ge.bindTexture(34067, null), Ge.deleteTexture(Re), Re = !Ge.getError()), { colorBits: [Ge.getParameter(3410), Ge.getParameter(3411), Ge.getParameter(3412), Ge.getParameter(3413)], depthBits: Ge.getParameter(3414), stencilBits: Ge.getParameter(3415), subpixelBits: Ge.getParameter(3408), extensions: Object.keys(st).filter(function(qe) {
            return !!st[qe];
          }), maxAnisotropic: Ie, maxDrawbuffers: Pe, maxColorAttachments: $e, pointSizeDims: Ge.getParameter(33901), lineWidthDims: Ge.getParameter(33902), maxViewportDims: Ge.getParameter(3386), maxCombinedTextureUnits: Ge.getParameter(35661), maxCubeMapSize: Ge.getParameter(34076), maxRenderbufferSize: Ge.getParameter(34024), maxTextureUnits: Ge.getParameter(34930), maxTextureSize: Ge.getParameter(3379), maxAttributes: Ge.getParameter(34921), maxVertexUniforms: Ge.getParameter(36347), maxVertexTextureUnits: Ge.getParameter(35660), maxVaryingVectors: Ge.getParameter(36348), maxFragmentUniforms: Ge.getParameter(36349), glsl: Ge.getParameter(35724), renderer: Ge.getParameter(7937), vendor: Ge.getParameter(7936), version: Ge.getParameter(7938), readFloat: Ve, npotTextureCube: Re };
        }, ae = function(Ge) {
          return Ge instanceof Uint8Array || Ge instanceof Uint16Array || Ge instanceof Uint32Array || Ge instanceof Int8Array || Ge instanceof Int16Array || Ge instanceof Int32Array || Ge instanceof Float32Array || Ge instanceof Float64Array || Ge instanceof Uint8ClampedArray;
        }, ue = function(Ge) {
          return Object.keys(Ge).map(function(st) {
            return Ge[st];
          });
        }, le = { shape: function(Ge) {
          for (var st = []; Ge.length; Ge = Ge[0]) st.push(Ge.length);
          return st;
        }, flatten: function(Ge, st, Ie, Pe) {
          var $e = 1;
          if (st.length) for (var Ve = 0; Ve < st.length; ++Ve) $e *= st[Ve];
          else $e = 0;
          switch (Ie = Pe || Z2.allocType(Ie, $e), st.length) {
            case 0:
              break;
            case 1:
              for (Pe = st[0], st = 0; st < Pe; ++st) Ie[st] = Ge[st];
              break;
            case 2:
              for (Pe = st[0], st = st[1], Ve = $e = 0; Ve < Pe; ++Ve) for (var ut = Ge[Ve], Re = 0; Re < st; ++Re) Ie[$e++] = ut[Re];
              break;
            case 3:
              h(Ge, st[0], st[1], st[2], Ie, 0);
              break;
            default:
              (function qe(je, rt, He, xe, Ne) {
                for (var ke = 1, Me = He + 1; Me < rt.length; ++Me) ke *= rt[Me];
                var Le = rt[He];
                if (rt.length - He == 4) {
                  var ze = rt[He + 1], ft = rt[He + 2];
                  for (rt = rt[He + 3], Me = 0; Me < Le; ++Me) h(je[Me], ze, ft, rt, xe, Ne), Ne += ke;
                } else for (Me = 0; Me < Le; ++Me) qe(je[Me], rt, He + 1, xe, Ne), Ne += ke;
              })(Ge, st, 0, Ie, 0);
          }
          return Ie;
        } }, ce = { "[object Int8Array]": 5120, "[object Int16Array]": 5122, "[object Int32Array]": 5124, "[object Uint8Array]": 5121, "[object Uint8ClampedArray]": 5121, "[object Uint16Array]": 5123, "[object Uint32Array]": 5125, "[object Float32Array]": 5126, "[object Float64Array]": 5121, "[object ArrayBuffer]": 5121 }, se = { int8: 5120, int16: 5122, int32: 5124, uint8: 5121, uint16: 5123, uint32: 5125, float: 5126, float32: 5126 }, he = { dynamic: 35048, stream: 35040, static: 35044 }, me = le.flatten, we = le.shape, be = [];
        be[5120] = 1, be[5122] = 2, be[5124] = 4, be[5121] = 1, be[5123] = 2, be[5125] = 4, be[5126] = 4;
        var Ae = { points: 0, point: 0, lines: 1, line: 1, triangles: 4, triangle: 4, "line loop": 2, "line strip": 3, "triangle strip": 5, "triangle fan": 6 }, pe = new Float32Array(1), ve = new Uint32Array(pe.buffer), Ee = [9984, 9986, 9985, 9987], Se = [0, 6409, 6410, 6407, 6408], Ce = {};
        Ce[6409] = Ce[6406] = Ce[6402] = 1, Ce[34041] = Ce[6410] = 2, Ce[6407] = Ce[35904] = 3, Ce[6408] = Ce[35906] = 4;
        var Be = y("HTMLCanvasElement"), Ue = y("OffscreenCanvas"), Ke = y("CanvasRenderingContext2D"), ct = y("ImageBitmap"), We = y("HTMLImageElement"), Ze = y("HTMLVideoElement"), it = Object.keys(ce).concat([Be, Ue, Ke, ct, We, Ze]), ot = [];
        ot[5121] = 1, ot[5126] = 4, ot[36193] = 2, ot[5123] = 2, ot[5125] = 4;
        var mt = [];
        mt[32854] = 2, mt[32855] = 2, mt[36194] = 2, mt[34041] = 4, mt[33776] = 0.5, mt[33777] = 0.5, mt[33778] = 1, mt[33779] = 1, mt[35986] = 0.5, mt[35987] = 1, mt[34798] = 1, mt[35840] = 0.5, mt[35841] = 0.25, mt[35842] = 0.5, mt[35843] = 0.25, mt[36196] = 0.5;
        var wt = [];
        wt[32854] = 2, wt[32855] = 2, wt[36194] = 2, wt[33189] = 2, wt[36168] = 1, wt[34041] = 4, wt[35907] = 4, wt[34836] = 16, wt[34842] = 8, wt[34843] = 6;
        var Et = function(Ge, st, Ie, Pe, $e) {
          function Ve(He) {
            this.id = je++, this.refCount = 1, this.renderbuffer = He, this.format = 32854, this.height = this.width = 0, $e.profile && (this.stats = { size: 0 });
          }
          function ut(He) {
            var xe = He.renderbuffer;
            Ge.bindRenderbuffer(36161, null), Ge.deleteRenderbuffer(xe), He.renderbuffer = null, He.refCount = 0, delete rt[He.id], Pe.renderbufferCount--;
          }
          var Re = { rgba4: 32854, rgb565: 36194, "rgb5 a1": 32855, depth: 33189, stencil: 36168, "depth stencil": 34041 };
          st.ext_srgb && (Re.srgba = 35907), st.ext_color_buffer_half_float && (Re.rgba16f = 34842, Re.rgb16f = 34843), st.webgl_color_buffer_float && (Re.rgba32f = 34836);
          var qe = [];
          Object.keys(Re).forEach(function(He) {
            qe[Re[He]] = He;
          });
          var je = 0, rt = {};
          return Ve.prototype.decRef = function() {
            0 >= --this.refCount && ut(this);
          }, $e.profile && (Pe.getTotalRenderbufferSize = function() {
            var He = 0;
            return Object.keys(rt).forEach(function(xe) {
              He += rt[xe].stats.size;
            }), He;
          }), { create: function(He, xe) {
            function Ne(Me, Le) {
              var ze = 0, ft = 0, De = 32854;
              if (typeof Me == "object" && Me ? ("shape" in Me ? (ze = 0 | (ft = Me.shape)[0], ft = 0 | ft[1]) : ("radius" in Me && (ze = ft = 0 | Me.radius), "width" in Me && (ze = 0 | Me.width), "height" in Me && (ft = 0 | Me.height)), "format" in Me && (De = Re[Me.format])) : typeof Me == "number" ? (ze = 0 | Me, ft = typeof Le == "number" ? 0 | Le : ze) : Me || (ze = ft = 1), ze !== ke.width || ft !== ke.height || De !== ke.format) return Ne.width = ke.width = ze, Ne.height = ke.height = ft, ke.format = De, Ge.bindRenderbuffer(36161, ke.renderbuffer), Ge.renderbufferStorage(36161, De, ze, ft), $e.profile && (ke.stats.size = wt[ke.format] * ke.width * ke.height), Ne.format = qe[ke.format], Ne;
            }
            var ke = new Ve(Ge.createRenderbuffer());
            return rt[ke.id] = ke, Pe.renderbufferCount++, Ne(He, xe), Ne.resize = function(Me, Le) {
              var ze = 0 | Me, ft = 0 | Le || ze;
              return ze === ke.width && ft === ke.height || (Ne.width = ke.width = ze, Ne.height = ke.height = ft, Ge.bindRenderbuffer(36161, ke.renderbuffer), Ge.renderbufferStorage(36161, ke.format, ze, ft), $e.profile && (ke.stats.size = wt[ke.format] * ke.width * ke.height)), Ne;
            }, Ne._reglType = "renderbuffer", Ne._renderbuffer = ke, $e.profile && (Ne.stats = ke.stats), Ne.destroy = function() {
              ke.decRef();
            }, Ne;
          }, clear: function() {
            ue(rt).forEach(ut);
          }, restore: function() {
            ue(rt).forEach(function(He) {
              He.renderbuffer = Ge.createRenderbuffer(), Ge.bindRenderbuffer(36161, He.renderbuffer), Ge.renderbufferStorage(36161, He.format, He.width, He.height);
            }), Ge.bindRenderbuffer(36161, null);
          } };
        }, zt = [];
        zt[6408] = 4, zt[6407] = 3;
        var Nt = [];
        Nt[5121] = 1, Nt[5126] = 4, Nt[36193] = 2;
        var yt = ["x", "y", "z", "w"], pt = "blend.func blend.equation stencil.func stencil.opFront stencil.opBack sample.coverage viewport scissor.box polygonOffset.offset".split(" "), Ot = { 0: 0, 1: 1, zero: 0, one: 1, "src color": 768, "one minus src color": 769, "src alpha": 770, "one minus src alpha": 771, "dst color": 774, "one minus dst color": 775, "dst alpha": 772, "one minus dst alpha": 773, "constant color": 32769, "one minus constant color": 32770, "constant alpha": 32771, "one minus constant alpha": 32772, "src alpha saturate": 776 }, Jt = { never: 512, less: 513, "<": 513, equal: 514, "=": 514, "==": 514, "===": 514, lequal: 515, "<=": 515, greater: 516, ">": 516, notequal: 517, "!=": 517, "!==": 517, gequal: 518, ">=": 518, always: 519 }, tr = { 0: 0, zero: 0, keep: 7680, replace: 7681, increment: 7682, decrement: 7683, "increment wrap": 34055, "decrement wrap": 34056, invert: 5386 }, Ye = { cw: 2304, ccw: 2305 }, at = new X2(false, false, false, function() {
        });
        return function(Ge) {
          function st() {
            if (Qr.length === 0) De && De.update(), Xn = null;
            else {
              Xn = j.next(st), rt();
              for (var _n = Qr.length - 1; 0 <= _n; --_n) {
                var qr = Qr[_n];
                qr && qr(kt, null, 0);
              }
              Ne.flush(), De && De.update();
            }
          }
          function Ie() {
            !Xn && 0 < Qr.length && (Xn = j.next(st));
          }
          function Pe() {
            Xn && (j.cancel(st), Xn = null);
          }
          function $e(_n) {
            _n.preventDefault(), Pe(), hn.forEach(function(qr) {
              qr();
            });
          }
          function Ve(_n) {
            Ne.getError(), Me.restore(), Tr.restore(), Vt.restore(), yr.restore(), pr.restore(), lr.restore(), rr.restore(), De && De.restore(), _r.procs.refresh(), Ie(), wn.forEach(function(qr) {
              qr();
            });
          }
          function ut(_n) {
            function qr(Ut, Zt) {
              var xr = {}, Fr = {};
              return Object.keys(Ut).forEach(function(pn) {
                var un = Ut[pn];
                if (te.isDynamic(un)) Fr[pn] = te.unbox(un, pn);
                else {
                  if (Zt && Array.isArray(un)) {
                    for (var Ir = 0; Ir < un.length; ++Ir) if (te.isDynamic(un[Ir])) return void (Fr[pn] = te.unbox(un, pn));
                  }
                  xr[pn] = un;
                }
              }), { dynamic: Fr, static: xr };
            }
            var Nr = qr(_n.context || {}, true), Zr = qr(_n.uniforms || {}, true), oa = qr(_n.attributes || {}, false);
            _n = qr(function(Ut) {
              function Zt(Fr) {
                if (Fr in xr) {
                  var pn = xr[Fr];
                  delete xr[Fr], Object.keys(pn).forEach(function(un) {
                    xr[Fr + "." + un] = pn[un];
                  });
                }
              }
              var xr = z({}, Ut);
              return delete xr.uniforms, delete xr.attributes, delete xr.context, delete xr.vao, "stencil" in xr && xr.stencil.op && (xr.stencil.opBack = xr.stencil.opFront = xr.stencil.op, delete xr.stencil.op), Zt("blend"), Zt("depth"), Zt("cull"), Zt("stencil"), Zt("polygonOffset"), Zt("scissor"), Zt("sample"), "vao" in Ut && (xr.vao = Ut.vao), xr;
            }(_n), false);
            var tn = { gpuTime: 0, cpuTime: 0, count: 0 }, Zn = _r.compile(_n, oa, Zr, Nr, tn), Ln = Zn.draw, gn = Zn.batch, na = Zn.scope, sr = [];
            return z(function(Ut, Zt) {
              var xr;
              if (typeof Ut == "function") return na.call(this, null, Ut, 0);
              if (typeof Zt == "function") if (typeof Ut == "number") for (xr = 0; xr < Ut; ++xr) na.call(this, null, Zt, xr);
              else {
                if (!Array.isArray(Ut)) return na.call(this, Ut, Zt, 0);
                for (xr = 0; xr < Ut.length; ++xr) na.call(this, Ut[xr], Zt, xr);
              }
              else if (typeof Ut == "number") {
                if (0 < Ut) return gn.call(this, function(Fr) {
                  for (; sr.length < Fr; ) sr.push(null);
                  return sr;
                }(0 | Ut), 0 | Ut);
              } else {
                if (!Array.isArray(Ut)) return Ln.call(this, Ut);
                if (Ut.length) return gn.call(this, Ut, Ut.length);
              }
            }, { stats: tn, destroy: function() {
              Zn.destroy();
            } });
          }
          function Re(_n, qr) {
            var Nr = 0;
            _r.procs.poll();
            var Zr = qr.color;
            Zr && (Ne.clearColor(+Zr[0] || 0, +Zr[1] || 0, +Zr[2] || 0, +Zr[3] || 0), Nr |= 16384), "depth" in qr && (Ne.clearDepth(+qr.depth), Nr |= 256), "stencil" in qr && (Ne.clearStencil(0 | qr.stencil), Nr |= 1024), Ne.clear(Nr);
          }
          function qe(_n) {
            return Qr.push(_n), Ie(), { cancel: function() {
              var qr = R2(Qr, _n);
              Qr[qr] = function Nr() {
                var Zr = R2(Qr, Nr);
                Qr[Zr] = Qr[Qr.length - 1], --Qr.length, 0 >= Qr.length && Pe();
              };
            } };
          }
          function je() {
            var _n = $r.viewport, qr = $r.scissor_box;
            _n[0] = _n[1] = qr[0] = qr[1] = 0, kt.viewportWidth = kt.framebufferWidth = kt.drawingBufferWidth = _n[2] = qr[2] = Ne.drawingBufferWidth, kt.viewportHeight = kt.framebufferHeight = kt.drawingBufferHeight = _n[3] = qr[3] = Ne.drawingBufferHeight;
          }
          function rt() {
            kt.tick += 1, kt.time = xe(), je(), _r.procs.poll();
          }
          function He() {
            yr.refresh(), je(), _r.procs.refresh(), De && De.update();
          }
          function xe() {
            return (Q2() - Je) / 1e3;
          }
          if (!(Ge = i(Ge))) return null;
          var Ne = Ge.gl, ke = Ne.getContextAttributes();
          Ne.isContextLost();
          var Me = function(_n, qr) {
            function Nr(Zn) {
              var Ln;
              Zn = Zn.toLowerCase();
              try {
                Ln = Zr[Zn] = _n.getExtension(Zn);
              } catch {
              }
              return !!Ln;
            }
            for (var Zr = {}, oa = 0; oa < qr.extensions.length; ++oa) {
              var tn = qr.extensions[oa];
              if (!Nr(tn)) return qr.onDestroy(), qr.onDone('"' + tn + '" extension is not supported by the current WebGL context, try upgrading your system or a different browser'), null;
            }
            return qr.optionalExtensions.forEach(Nr), { extensions: Zr, restore: function() {
              Object.keys(Zr).forEach(function(Zn) {
                if (Zr[Zn] && !Nr(Zn)) throw Error("(regl): error restoring extension " + Zn);
              });
            } };
          }(Ne, Ge);
          if (!Me) return null;
          var Le = /* @__PURE__ */ function() {
            var _n = { "": 0 }, qr = [""];
            return { id: function(Nr) {
              var Zr = _n[Nr];
              return Zr || (Zr = _n[Nr] = qr.length, qr.push(Nr), Zr);
            }, str: function(Nr) {
              return qr[Nr];
            } };
          }(), ze = { vaoCount: 0, bufferCount: 0, elementsCount: 0, framebufferCount: 0, shaderCount: 0, textureCount: 0, cubeCount: 0, renderbufferCount: 0, maxTextureUnits: 0 }, ft = Me.extensions, De = function(_n, qr) {
            function Nr() {
              this.endQueryIndex = this.startQueryIndex = -1, this.sum = 0, this.stats = null;
            }
            function Zr(sr, Ut, Zt) {
              var xr = Zn.pop() || new Nr();
              xr.startQueryIndex = sr, xr.endQueryIndex = Ut, xr.sum = 0, xr.stats = Zt, Ln.push(xr);
            }
            if (!qr.ext_disjoint_timer_query) return null;
            var oa = [], tn = [], Zn = [], Ln = [], gn = [], na = [];
            return { beginQuery: function(sr) {
              var Ut = oa.pop() || qr.ext_disjoint_timer_query.createQueryEXT();
              qr.ext_disjoint_timer_query.beginQueryEXT(35007, Ut), tn.push(Ut), Zr(tn.length - 1, tn.length, sr);
            }, endQuery: function() {
              qr.ext_disjoint_timer_query.endQueryEXT(35007);
            }, pushScopeStats: Zr, update: function() {
              var sr, Ut;
              if ((sr = tn.length) !== 0) {
                na.length = Math.max(na.length, sr + 1), gn.length = Math.max(gn.length, sr + 1), gn[0] = 0;
                var Zt = na[0] = 0;
                for (Ut = sr = 0; Ut < tn.length; ++Ut) {
                  var xr = tn[Ut];
                  qr.ext_disjoint_timer_query.getQueryObjectEXT(xr, 34919) ? (Zt += qr.ext_disjoint_timer_query.getQueryObjectEXT(xr, 34918), oa.push(xr)) : tn[sr++] = xr, gn[Ut + 1] = Zt, na[Ut + 1] = sr;
                }
                for (tn.length = sr, Ut = sr = 0; Ut < Ln.length; ++Ut) {
                  var Fr = (Zt = Ln[Ut]).startQueryIndex;
                  xr = Zt.endQueryIndex, Zt.sum += gn[xr] - gn[Fr], Fr = na[Fr], (xr = na[xr]) === Fr ? (Zt.stats.gpuTime += Zt.sum / 1e6, Zn.push(Zt)) : (Zt.startQueryIndex = Fr, Zt.endQueryIndex = xr, Ln[sr++] = Zt);
                }
                Ln.length = sr;
              }
            }, getNumPendingQueries: function() {
              return tn.length;
            }, clear: function() {
              oa.push.apply(oa, tn);
              for (var sr = 0; sr < oa.length; sr++) qr.ext_disjoint_timer_query.deleteQueryEXT(oa[sr]);
              tn.length = 0, oa.length = 0;
            }, restore: function() {
              tn.length = 0, oa.length = 0;
            } };
          }(0, ft), Je = Q2(), tt = Ne.drawingBufferWidth, vt = Ne.drawingBufferHeight, kt = { tick: 0, time: 0, viewportWidth: tt, viewportHeight: vt, framebufferWidth: tt, framebufferHeight: vt, drawingBufferWidth: tt, drawingBufferHeight: vt, pixelRatio: Ge.pixelRatio }, jt = (tt = { elements: null, primitive: 4, count: -1, offset: 0, instances: -1 }, ne(Ne, ft)), Vt = m(Ne, ze, Ge, function(_n) {
            return rr.destroyBuffer(_n);
          }), Kt = g(Ne, ft, Vt, ze), rr = N2(Ne, ft, jt, ze, Vt, Kt, tt), Tr = D2(Ne, Le, ze, Ge), yr = C2(Ne, ft, jt, function() {
            _r.procs.poll();
          }, kt, ze, Ge), pr = Et(Ne, ft, 0, ze, Ge), lr = E2(Ne, ft, jt, yr, pr, ze), _r = re(Ne, Le, ft, jt, Vt, Kt, 0, lr, {}, rr, Tr, tt, kt, De, Ge), $r = (Le = I2(Ne, lr, _r.procs.poll, kt), _r.next), Ar = Ne.canvas, Qr = [], hn = [], wn = [], Yn = [Ge.onDestroy], Xn = null;
          Ar && (Ar.addEventListener("webglcontextlost", $e, false), Ar.addEventListener("webglcontextrestored", Ve, false));
          var Wn = lr.setFBO = ut({ framebuffer: te.define.call(null, 1, "framebuffer") });
          return He(), ke = z(ut, { clear: function(_n) {
            if ("framebuffer" in _n) if (_n.framebuffer && _n.framebuffer_reglType === "framebufferCube") for (var qr = 0; 6 > qr; ++qr) Wn(z({ framebuffer: _n.framebuffer.faces[qr] }, _n), Re);
            else Wn(_n, Re);
            else Re(0, _n);
          }, prop: te.define.bind(null, 1), context: te.define.bind(null, 2), this: te.define.bind(null, 3), draw: ut({}), buffer: function(_n) {
            return Vt.create(_n, 34962, false, false);
          }, elements: function(_n) {
            return Kt.create(_n, false);
          }, texture: yr.create2D, cube: yr.createCube, renderbuffer: pr.create, framebuffer: lr.create, framebufferCube: lr.createCube, vao: rr.createVAO, attributes: ke, frame: qe, on: function(_n, qr) {
            var Nr;
            switch (_n) {
              case "frame":
                return qe(qr);
              case "lost":
                Nr = hn;
                break;
              case "restore":
                Nr = wn;
                break;
              case "destroy":
                Nr = Yn;
            }
            return Nr.push(qr), { cancel: function() {
              for (var Zr = 0; Zr < Nr.length; ++Zr) if (Nr[Zr] === qr) {
                Nr[Zr] = Nr[Nr.length - 1], Nr.pop();
                break;
              }
            } };
          }, limits: jt, hasExtension: function(_n) {
            return 0 <= jt.extensions.indexOf(_n.toLowerCase());
          }, read: Le, destroy: function() {
            Qr.length = 0, Pe(), Ar && (Ar.removeEventListener("webglcontextlost", $e), Ar.removeEventListener("webglcontextrestored", Ve)), Tr.clear(), lr.clear(), pr.clear(), rr.clear(), yr.clear(), Kt.clear(), Vt.clear(), De && De.clear(), Yn.forEach(function(_n) {
              _n();
            });
          }, _gl: Ne, _refresh: He, poll: function() {
            rt(), De && De.update();
          }, now: xe, stats: ze }), Ge.onDone(null, ke), ke;
        };
      });
    }, {}], 284: [function(e, t, r) {
      var n = e("buffer"), a = n.Buffer;
      function o(i, l) {
        for (var u2 in i) l[u2] = i[u2];
      }
      function s(i, l, u2) {
        return a(i, l, u2);
      }
      a.from && a.alloc && a.allocUnsafe && a.allocUnsafeSlow ? t.exports = n : (o(n, r), r.Buffer = s), s.prototype = Object.create(a.prototype), o(a, s), s.from = function(i, l, u2) {
        if (typeof i == "number") throw new TypeError("Argument must not be a number");
        return a(i, l, u2);
      }, s.alloc = function(i, l, u2) {
        if (typeof i != "number") throw new TypeError("Argument must be a number");
        var c = a(i);
        return l !== void 0 ? typeof u2 == "string" ? c.fill(l, u2) : c.fill(l) : c.fill(0), c;
      }, s.allocUnsafe = function(i) {
        if (typeof i != "number") throw new TypeError("Argument must be a number");
        return a(i);
      }, s.allocUnsafeSlow = function(i) {
        if (typeof i != "number") throw new TypeError("Argument must be a number");
        return n.SlowBuffer(i);
      };
    }, { buffer: 85 }], 285: [function(e, t, r) {
      t.exports = a;
      var n = e("events").EventEmitter;
      function a() {
        n.call(this);
      }
      e("inherits")(a, n), a.Readable = e("readable-stream/lib/_stream_readable.js"), a.Writable = e("readable-stream/lib/_stream_writable.js"), a.Duplex = e("readable-stream/lib/_stream_duplex.js"), a.Transform = e("readable-stream/lib/_stream_transform.js"), a.PassThrough = e("readable-stream/lib/_stream_passthrough.js"), a.finished = e("readable-stream/lib/internal/streams/end-of-stream.js"), a.pipeline = e("readable-stream/lib/internal/streams/pipeline.js"), a.Stream = a, a.prototype.pipe = function(o, s) {
        var i = this;
        function l(v) {
          o.writable && o.write(v) === false && i.pause && i.pause();
        }
        function u2() {
          i.readable && i.resume && i.resume();
        }
        i.on("data", l), o.on("drain", u2), o._isStdio || s && s.end === false || (i.on("end", f), i.on("close", h));
        var c = false;
        function f() {
          c || (c = true, o.end());
        }
        function h() {
          c || (c = true, typeof o.destroy == "function" && o.destroy());
        }
        function p(v) {
          if (d(), n.listenerCount(this, "error") === 0) throw v;
        }
        function d() {
          i.removeListener("data", l), o.removeListener("drain", u2), i.removeListener("end", f), i.removeListener("close", h), i.removeListener("error", p), o.removeListener("error", p), i.removeListener("end", d), i.removeListener("close", d), o.removeListener("close", d);
        }
        return i.on("error", p), o.on("error", p), i.on("end", d), i.on("close", d), o.on("close", d), o.emit("pipe", i), o;
      };
    }, { events: 84, inherits: 231, "readable-stream/lib/_stream_duplex.js": 287, "readable-stream/lib/_stream_passthrough.js": 288, "readable-stream/lib/_stream_readable.js": 289, "readable-stream/lib/_stream_transform.js": 290, "readable-stream/lib/_stream_writable.js": 291, "readable-stream/lib/internal/streams/end-of-stream.js": 295, "readable-stream/lib/internal/streams/pipeline.js": 297 }], 286: [function(e, t, r) {
      "use strict";
      var n = {};
      function a(s, i, l) {
        l || (l = Error);
        var u2 = function(c) {
          var f, h;
          function p(d, v, m) {
            return c.call(this, function(g, x, b) {
              return typeof i == "string" ? i : i(g, x, b);
            }(d, v, m)) || this;
          }
          return h = c, (f = p).prototype = Object.create(h.prototype), f.prototype.constructor = f, f.__proto__ = h, p;
        }(l);
        u2.prototype.name = l.name, u2.prototype.code = s, n[s] = u2;
      }
      function o(s, i) {
        if (Array.isArray(s)) {
          var l = s.length;
          return s = s.map(function(u2) {
            return String(u2);
          }), l > 2 ? "one of ".concat(i, " ").concat(s.slice(0, l - 1).join(", "), ", or ") + s[l - 1] : l === 2 ? "one of ".concat(i, " ").concat(s[0], " or ").concat(s[1]) : "of ".concat(i, " ").concat(s[0]);
        }
        return "of ".concat(i, " ").concat(String(s));
      }
      a("ERR_INVALID_OPT_VALUE", function(s, i) {
        return 'The value "' + i + '" is invalid for option "' + s + '"';
      }, TypeError), a("ERR_INVALID_ARG_TYPE", function(s, i, l) {
        var u2, c, f, h;
        if (typeof i == "string" && (c = "not ", i.substr(!f || f < 0 ? 0 : +f, c.length) === c) ? (u2 = "must not be", i = i.replace(/^not /, "")) : u2 = "must be", function(d, v, m) {
          return (m === void 0 || m > d.length) && (m = d.length), d.substring(m - v.length, m) === v;
        }(s, " argument")) h = "The ".concat(s, " ").concat(u2, " ").concat(o(i, "type"));
        else {
          var p = function(d, v, m) {
            return typeof m != "number" && (m = 0), !(m + v.length > d.length) && d.indexOf(v, m) !== -1;
          }(s, ".") ? "property" : "argument";
          h = 'The "'.concat(s, '" ').concat(p, " ").concat(u2, " ").concat(o(i, "type"));
        }
        return h += ". Received type ".concat(typeof l);
      }, TypeError), a("ERR_STREAM_PUSH_AFTER_EOF", "stream.push() after EOF"), a("ERR_METHOD_NOT_IMPLEMENTED", function(s) {
        return "The " + s + " method is not implemented";
      }), a("ERR_STREAM_PREMATURE_CLOSE", "Premature close"), a("ERR_STREAM_DESTROYED", function(s) {
        return "Cannot call " + s + " after a stream was destroyed";
      }), a("ERR_MULTIPLE_CALLBACK", "Callback called multiple times"), a("ERR_STREAM_CANNOT_PIPE", "Cannot pipe, not readable"), a("ERR_STREAM_WRITE_AFTER_END", "write after end"), a("ERR_STREAM_NULL_VALUES", "May not write null values to stream", TypeError), a("ERR_UNKNOWN_ENCODING", function(s) {
        return "Unknown encoding: " + s;
      }, TypeError), a("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event"), t.exports.codes = n;
    }, {}], 287: [function(e, t, r) {
      (function(n) {
        (function() {
          "use strict";
          var a = Object.keys || function(p) {
            var d = [];
            for (var v in p) d.push(v);
            return d;
          };
          t.exports = c;
          var o = e("./_stream_readable"), s = e("./_stream_writable");
          e("inherits")(c, o);
          for (var i = a(s.prototype), l = 0; l < i.length; l++) {
            var u2 = i[l];
            c.prototype[u2] || (c.prototype[u2] = s.prototype[u2]);
          }
          function c(p) {
            if (!(this instanceof c)) return new c(p);
            o.call(this, p), s.call(this, p), this.allowHalfOpen = true, p && (p.readable === false && (this.readable = false), p.writable === false && (this.writable = false), p.allowHalfOpen === false && (this.allowHalfOpen = false, this.once("end", f)));
          }
          function f() {
            this._writableState.ended || n.nextTick(h, this);
          }
          function h(p) {
            p.end();
          }
          Object.defineProperty(c.prototype, "writableHighWaterMark", { enumerable: false, get: function() {
            return this._writableState.highWaterMark;
          } }), Object.defineProperty(c.prototype, "writableBuffer", { enumerable: false, get: function() {
            return this._writableState && this._writableState.getBuffer();
          } }), Object.defineProperty(c.prototype, "writableLength", { enumerable: false, get: function() {
            return this._writableState.length;
          } }), Object.defineProperty(c.prototype, "destroyed", { enumerable: false, get: function() {
            return this._readableState !== void 0 && this._writableState !== void 0 && this._readableState.destroyed && this._writableState.destroyed;
          }, set: function(p) {
            this._readableState !== void 0 && this._writableState !== void 0 && (this._readableState.destroyed = p, this._writableState.destroyed = p);
          } });
        }).call(this);
      }).call(this, e("_process"));
    }, { "./_stream_readable": 289, "./_stream_writable": 291, _process: 277, inherits: 231 }], 288: [function(e, t, r) {
      "use strict";
      t.exports = a;
      var n = e("./_stream_transform");
      function a(o) {
        if (!(this instanceof a)) return new a(o);
        n.call(this, o);
      }
      e("inherits")(a, n), a.prototype._transform = function(o, s, i) {
        i(null, o);
      };
    }, { "./_stream_transform": 290, inherits: 231 }], 289: [function(e, t, r) {
      (function(n, a) {
        (function() {
          "use strict";
          var o;
          t.exports = S2, S2.ReadableState = A2, e("events").EventEmitter;
          var s = function(R2, z) {
            return R2.listeners(z).length;
          }, i = e("./internal/streams/stream"), l = e("buffer").Buffer, u2 = a.Uint8Array || function() {
          }, c, f = e("util");
          c = f && f.debuglog ? f.debuglog("stream") : function() {
          };
          var h, p, d, v = e("./internal/streams/buffer_list"), m = e("./internal/streams/destroy"), g = e("./internal/streams/state").getHighWaterMark, x = e("../errors").codes, b = x.ERR_INVALID_ARG_TYPE, y = x.ERR_STREAM_PUSH_AFTER_EOF, w = x.ERR_METHOD_NOT_IMPLEMENTED, _4 = x.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;
          e("inherits")(S2, i);
          var k = m.errorOrDestroy, T2 = ["error", "close", "destroy", "pause", "resume"];
          function A2(R2, z, H2) {
            o = o || e("./_stream_duplex"), R2 = R2 || {}, typeof H2 != "boolean" && (H2 = z instanceof o), this.objectMode = !!R2.objectMode, H2 && (this.objectMode = this.objectMode || !!R2.readableObjectMode), this.highWaterMark = g(this, R2, "readableHighWaterMark", H2), this.buffer = new v(), this.length = 0, this.pipes = null, this.pipesCount = 0, this.flowing = null, this.ended = false, this.endEmitted = false, this.reading = false, this.sync = true, this.needReadable = false, this.emittedReadable = false, this.readableListening = false, this.resumeScheduled = false, this.paused = true, this.emitClose = R2.emitClose !== false, this.autoDestroy = !!R2.autoDestroy, this.destroyed = false, this.defaultEncoding = R2.defaultEncoding || "utf8", this.awaitDrain = 0, this.readingMore = false, this.decoder = null, this.encoding = null, R2.encoding && (h || (h = e("string_decoder/").StringDecoder), this.decoder = new h(R2.encoding), this.encoding = R2.encoding);
          }
          function S2(R2) {
            if (o = o || e("./_stream_duplex"), !(this instanceof S2)) return new S2(R2);
            var z = this instanceof o;
            this._readableState = new A2(R2, this, z), this.readable = true, R2 && (typeof R2.read == "function" && (this._read = R2.read), typeof R2.destroy == "function" && (this._destroy = R2.destroy)), i.call(this);
          }
          function C2(R2, z, H2, te, j) {
            c("readableAddChunk", z);
            var Q2, Z2 = R2._readableState;
            if (z === null) Z2.reading = false, function(ne, ae) {
              if (c("onEofChunk"), !ae.ended) {
                if (ae.decoder) {
                  var ue = ae.decoder.end();
                  ue && ue.length && (ae.buffer.push(ue), ae.length += ae.objectMode ? 1 : ue.length);
                }
                ae.ended = true, ae.sync ? N2(ne) : (ae.needReadable = false, ae.emittedReadable || (ae.emittedReadable = true, D2(ne)));
              }
            }(R2, Z2);
            else if (j || (Q2 = function(ne, ae) {
              var ue;
              le = ae, l.isBuffer(le) || le instanceof u2 || typeof ae == "string" || ae === void 0 || ne.objectMode || (ue = new b("chunk", ["string", "Buffer", "Uint8Array"], ae));
              var le;
              return ue;
            }(Z2, z)), Q2) k(R2, Q2);
            else if (Z2.objectMode || z && z.length > 0) if (typeof z == "string" || Z2.objectMode || Object.getPrototypeOf(z) === l.prototype || (z = function(ne) {
              return l.from(ne);
            }(z)), te) Z2.endEmitted ? k(R2, new _4()) : E2(R2, Z2, z, true);
            else if (Z2.ended) k(R2, new y());
            else {
              if (Z2.destroyed) return false;
              Z2.reading = false, Z2.decoder && !H2 ? (z = Z2.decoder.write(z), Z2.objectMode || z.length !== 0 ? E2(R2, Z2, z, false) : I2(R2, Z2)) : E2(R2, Z2, z, false);
            }
            else te || (Z2.reading = false, I2(R2, Z2));
            return !Z2.ended && (Z2.length < Z2.highWaterMark || Z2.length === 0);
          }
          function E2(R2, z, H2, te) {
            z.flowing && z.length === 0 && !z.sync ? (z.awaitDrain = 0, R2.emit("data", H2)) : (z.length += z.objectMode ? 1 : H2.length, te ? z.buffer.unshift(H2) : z.buffer.push(H2), z.needReadable && N2(R2)), I2(R2, z);
          }
          Object.defineProperty(S2.prototype, "destroyed", { enumerable: false, get: function() {
            return this._readableState !== void 0 && this._readableState.destroyed;
          }, set: function(R2) {
            this._readableState && (this._readableState.destroyed = R2);
          } }), S2.prototype.destroy = m.destroy, S2.prototype._undestroy = m.undestroy, S2.prototype._destroy = function(R2, z) {
            z(R2);
          }, S2.prototype.push = function(R2, z) {
            var H2, te = this._readableState;
            return te.objectMode ? H2 = true : typeof R2 == "string" && ((z = z || te.defaultEncoding) !== te.encoding && (R2 = l.from(R2, z), z = ""), H2 = true), C2(this, R2, z, false, H2);
          }, S2.prototype.unshift = function(R2) {
            return C2(this, R2, null, true, false);
          }, S2.prototype.isPaused = function() {
            return this._readableState.flowing === false;
          }, S2.prototype.setEncoding = function(R2) {
            h || (h = e("string_decoder/").StringDecoder);
            var z = new h(R2);
            this._readableState.decoder = z, this._readableState.encoding = this._readableState.decoder.encoding;
            for (var H2 = this._readableState.buffer.head, te = ""; H2 !== null; ) te += z.write(H2.data), H2 = H2.next;
            return this._readableState.buffer.clear(), te !== "" && this._readableState.buffer.push(te), this._readableState.length = te.length, this;
          };
          function F13(R2, z) {
            return R2 <= 0 || z.length === 0 && z.ended ? 0 : z.objectMode ? 1 : R2 != R2 ? z.flowing && z.length ? z.buffer.head.data.length : z.length : (R2 > z.highWaterMark && (z.highWaterMark = function(H2) {
              return H2 >= 1073741824 ? H2 = 1073741824 : (H2--, H2 |= H2 >>> 1, H2 |= H2 >>> 2, H2 |= H2 >>> 4, H2 |= H2 >>> 8, H2 |= H2 >>> 16, H2++), H2;
            }(R2)), R2 <= z.length ? R2 : z.ended ? z.length : (z.needReadable = true, 0));
          }
          function N2(R2) {
            var z = R2._readableState;
            c("emitReadable", z.needReadable, z.emittedReadable), z.needReadable = false, z.emittedReadable || (c("emitReadable", z.flowing), z.emittedReadable = true, n.nextTick(D2, R2));
          }
          function D2(R2) {
            var z = R2._readableState;
            c("emitReadable_", z.destroyed, z.length, z.ended), z.destroyed || !z.length && !z.ended || (R2.emit("readable"), z.emittedReadable = false), z.needReadable = !z.flowing && !z.ended && z.length <= z.highWaterMark, X2(R2);
          }
          function I2(R2, z) {
            z.readingMore || (z.readingMore = true, n.nextTick(O2, R2, z));
          }
          function O2(R2, z) {
            for (; !z.reading && !z.ended && (z.length < z.highWaterMark || z.flowing && z.length === 0); ) {
              var H2 = z.length;
              if (c("maybeReadMore read 0"), R2.read(0), H2 === z.length) break;
            }
            z.readingMore = false;
          }
          function L2(R2) {
            var z = R2._readableState;
            z.readableListening = R2.listenerCount("readable") > 0, z.resumeScheduled && !z.paused ? z.flowing = true : R2.listenerCount("data") > 0 && R2.resume();
          }
          function V2(R2) {
            c("readable nexttick read 0"), R2.read(0);
          }
          function W2(R2, z) {
            c("resume", z.reading), z.reading || R2.read(0), z.resumeScheduled = false, R2.emit("resume"), X2(R2), z.flowing && !z.reading && R2.read(0);
          }
          function X2(R2) {
            var z = R2._readableState;
            for (c("flow", z.flowing); z.flowing && R2.read() !== null; ) ;
          }
          function Y2(R2, z) {
            return z.length === 0 ? null : (z.objectMode ? H2 = z.buffer.shift() : !R2 || R2 >= z.length ? (H2 = z.decoder ? z.buffer.join("") : z.buffer.length === 1 ? z.buffer.first() : z.buffer.concat(z.length), z.buffer.clear()) : H2 = z.buffer.consume(R2, z.decoder), H2);
            var H2;
          }
          function K2(R2) {
            var z = R2._readableState;
            c("endReadable", z.endEmitted), z.endEmitted || (z.ended = true, n.nextTick(q, z, R2));
          }
          function q(R2, z) {
            if (c("endReadableNT", R2.endEmitted, R2.length), !R2.endEmitted && R2.length === 0 && (R2.endEmitted = true, z.readable = false, z.emit("end"), R2.autoDestroy)) {
              var H2 = z._writableState;
              (!H2 || H2.autoDestroy && H2.finished) && z.destroy();
            }
          }
          function re(R2, z) {
            for (var H2 = 0, te = R2.length; H2 < te; H2++) if (R2[H2] === z) return H2;
            return -1;
          }
          S2.prototype.read = function(R2) {
            c("read", R2), R2 = parseInt(R2, 10);
            var z = this._readableState, H2 = R2;
            if (R2 !== 0 && (z.emittedReadable = false), R2 === 0 && z.needReadable && ((z.highWaterMark !== 0 ? z.length >= z.highWaterMark : z.length > 0) || z.ended)) return c("read: emitReadable", z.length, z.ended), z.length === 0 && z.ended ? K2(this) : N2(this), null;
            if ((R2 = F13(R2, z)) === 0 && z.ended) return z.length === 0 && K2(this), null;
            var te, j = z.needReadable;
            return c("need readable", j), (z.length === 0 || z.length - R2 < z.highWaterMark) && c("length less than watermark", j = true), z.ended || z.reading ? c("reading or ended", j = false) : j && (c("do read"), z.reading = true, z.sync = true, z.length === 0 && (z.needReadable = true), this._read(z.highWaterMark), z.sync = false, z.reading || (R2 = F13(H2, z))), (te = R2 > 0 ? Y2(R2, z) : null) === null ? (z.needReadable = z.length <= z.highWaterMark, R2 = 0) : (z.length -= R2, z.awaitDrain = 0), z.length === 0 && (z.ended || (z.needReadable = true), H2 !== R2 && z.ended && K2(this)), te !== null && this.emit("data", te), te;
          }, S2.prototype._read = function(R2) {
            k(this, new w("_read()"));
          }, S2.prototype.pipe = function(R2, z) {
            var H2 = this, te = this._readableState;
            switch (te.pipesCount) {
              case 0:
                te.pipes = R2;
                break;
              case 1:
                te.pipes = [te.pipes, R2];
                break;
              default:
                te.pipes.push(R2);
            }
            te.pipesCount += 1, c("pipe count=%d opts=%j", te.pipesCount, z);
            var j = (!z || z.end !== false) && R2 !== n.stdout && R2 !== n.stderr ? Z2 : he;
            function Q2(me, we) {
              c("onunpipe"), me === H2 && we && we.hasUnpiped === false && (we.hasUnpiped = true, c("cleanup"), R2.removeListener("close", ce), R2.removeListener("finish", se), R2.removeListener("drain", ne), R2.removeListener("error", le), R2.removeListener("unpipe", Q2), H2.removeListener("end", Z2), H2.removeListener("end", he), H2.removeListener("data", ue), ae = true, !te.awaitDrain || R2._writableState && !R2._writableState.needDrain || ne());
            }
            function Z2() {
              c("onend"), R2.end();
            }
            te.endEmitted ? n.nextTick(j) : H2.once("end", j), R2.on("unpipe", Q2);
            var ne = /* @__PURE__ */ function(me) {
              return function() {
                var we = me._readableState;
                c("pipeOnDrain", we.awaitDrain), we.awaitDrain && we.awaitDrain--, we.awaitDrain === 0 && s(me, "data") && (we.flowing = true, X2(me));
              };
            }(H2);
            R2.on("drain", ne);
            var ae = false;
            function ue(me) {
              c("ondata");
              var we = R2.write(me);
              c("dest.write", we), we === false && ((te.pipesCount === 1 && te.pipes === R2 || te.pipesCount > 1 && re(te.pipes, R2) !== -1) && !ae && (c("false write response, pause", te.awaitDrain), te.awaitDrain++), H2.pause());
            }
            function le(me) {
              c("onerror", me), he(), R2.removeListener("error", le), s(R2, "error") === 0 && k(R2, me);
            }
            function ce() {
              R2.removeListener("finish", se), he();
            }
            function se() {
              c("onfinish"), R2.removeListener("close", ce), he();
            }
            function he() {
              c("unpipe"), H2.unpipe(R2);
            }
            return H2.on("data", ue), function(me, we, be) {
              if (typeof me.prependListener == "function") return me.prependListener(we, be);
              me._events && me._events[we] ? Array.isArray(me._events[we]) ? me._events[we].unshift(be) : me._events[we] = [be, me._events[we]] : me.on(we, be);
            }(R2, "error", le), R2.once("close", ce), R2.once("finish", se), R2.emit("pipe", H2), te.flowing || (c("pipe resume"), H2.resume()), R2;
          }, S2.prototype.unpipe = function(R2) {
            var z = this._readableState, H2 = { hasUnpiped: false };
            if (z.pipesCount === 0) return this;
            if (z.pipesCount === 1) return R2 && R2 !== z.pipes || (R2 || (R2 = z.pipes), z.pipes = null, z.pipesCount = 0, z.flowing = false, R2 && R2.emit("unpipe", this, H2)), this;
            if (!R2) {
              var te = z.pipes, j = z.pipesCount;
              z.pipes = null, z.pipesCount = 0, z.flowing = false;
              for (var Q2 = 0; Q2 < j; Q2++) te[Q2].emit("unpipe", this, { hasUnpiped: false });
              return this;
            }
            var Z2 = re(z.pipes, R2);
            return Z2 === -1 || (z.pipes.splice(Z2, 1), z.pipesCount -= 1, z.pipesCount === 1 && (z.pipes = z.pipes[0]), R2.emit("unpipe", this, H2)), this;
          }, S2.prototype.on = function(R2, z) {
            var H2 = i.prototype.on.call(this, R2, z), te = this._readableState;
            return R2 === "data" ? (te.readableListening = this.listenerCount("readable") > 0, te.flowing !== false && this.resume()) : R2 === "readable" && (te.endEmitted || te.readableListening || (te.readableListening = te.needReadable = true, te.flowing = false, te.emittedReadable = false, c("on readable", te.length, te.reading), te.length ? N2(this) : te.reading || n.nextTick(V2, this))), H2;
          }, S2.prototype.addListener = S2.prototype.on, S2.prototype.removeListener = function(R2, z) {
            var H2 = i.prototype.removeListener.call(this, R2, z);
            return R2 === "readable" && n.nextTick(L2, this), H2;
          }, S2.prototype.removeAllListeners = function(R2) {
            var z = i.prototype.removeAllListeners.apply(this, arguments);
            return R2 !== "readable" && R2 !== void 0 || n.nextTick(L2, this), z;
          }, S2.prototype.resume = function() {
            var R2 = this._readableState;
            return R2.flowing || (c("resume"), R2.flowing = !R2.readableListening, function(z, H2) {
              H2.resumeScheduled || (H2.resumeScheduled = true, n.nextTick(W2, z, H2));
            }(this, R2)), R2.paused = false, this;
          }, S2.prototype.pause = function() {
            return c("call pause flowing=%j", this._readableState.flowing), this._readableState.flowing !== false && (c("pause"), this._readableState.flowing = false, this.emit("pause")), this._readableState.paused = true, this;
          }, S2.prototype.wrap = function(R2) {
            var z = this, H2 = this._readableState, te = false;
            for (var j in R2.on("end", function() {
              if (c("wrapped end"), H2.decoder && !H2.ended) {
                var Z2 = H2.decoder.end();
                Z2 && Z2.length && z.push(Z2);
              }
              z.push(null);
            }), R2.on("data", function(Z2) {
              c("wrapped data"), H2.decoder && (Z2 = H2.decoder.write(Z2)), H2.objectMode && Z2 == null || (H2.objectMode || Z2 && Z2.length) && (z.push(Z2) || (te = true, R2.pause()));
            }), R2) this[j] === void 0 && typeof R2[j] == "function" && (this[j] = /* @__PURE__ */ function(Z2) {
              return function() {
                return R2[Z2].apply(R2, arguments);
              };
            }(j));
            for (var Q2 = 0; Q2 < T2.length; Q2++) R2.on(T2[Q2], this.emit.bind(this, T2[Q2]));
            return this._read = function(Z2) {
              c("wrapped _read", Z2), te && (te = false, R2.resume());
            }, this;
          }, typeof Symbol == "function" && (S2.prototype[Symbol.asyncIterator] = function() {
            return p === void 0 && (p = e("./internal/streams/async_iterator")), p(this);
          }), Object.defineProperty(S2.prototype, "readableHighWaterMark", { enumerable: false, get: function() {
            return this._readableState.highWaterMark;
          } }), Object.defineProperty(S2.prototype, "readableBuffer", { enumerable: false, get: function() {
            return this._readableState && this._readableState.buffer;
          } }), Object.defineProperty(S2.prototype, "readableFlowing", { enumerable: false, get: function() {
            return this._readableState.flowing;
          }, set: function(R2) {
            this._readableState && (this._readableState.flowing = R2);
          } }), S2._fromList = Y2, Object.defineProperty(S2.prototype, "readableLength", { enumerable: false, get: function() {
            return this._readableState.length;
          } }), typeof Symbol == "function" && (S2.from = function(R2, z) {
            return d === void 0 && (d = e("./internal/streams/from")), d(S2, R2, z);
          });
        }).call(this);
      }).call(this, e("_process"), typeof global < "u" ? global : typeof self < "u" ? self : typeof window < "u" ? window : {});
    }, { "../errors": 286, "./_stream_duplex": 287, "./internal/streams/async_iterator": 292, "./internal/streams/buffer_list": 293, "./internal/streams/destroy": 294, "./internal/streams/from": 296, "./internal/streams/state": 298, "./internal/streams/stream": 299, _process: 277, buffer: 85, events: 84, inherits: 231, "string_decoder/": 300, util: 83 }], 290: [function(e, t, r) {
      "use strict";
      t.exports = c;
      var n = e("../errors").codes, a = n.ERR_METHOD_NOT_IMPLEMENTED, o = n.ERR_MULTIPLE_CALLBACK, s = n.ERR_TRANSFORM_ALREADY_TRANSFORMING, i = n.ERR_TRANSFORM_WITH_LENGTH_0, l = e("./_stream_duplex");
      function u2(p, d) {
        var v = this._transformState;
        v.transforming = false;
        var m = v.writecb;
        if (m === null) return this.emit("error", new o());
        v.writechunk = null, v.writecb = null, d != null && this.push(d), m(p);
        var g = this._readableState;
        g.reading = false, (g.needReadable || g.length < g.highWaterMark) && this._read(g.highWaterMark);
      }
      function c(p) {
        if (!(this instanceof c)) return new c(p);
        l.call(this, p), this._transformState = { afterTransform: u2.bind(this), needTransform: false, transforming: false, writecb: null, writechunk: null, writeencoding: null }, this._readableState.needReadable = true, this._readableState.sync = false, p && (typeof p.transform == "function" && (this._transform = p.transform), typeof p.flush == "function" && (this._flush = p.flush)), this.on("prefinish", f);
      }
      function f() {
        var p = this;
        typeof this._flush != "function" || this._readableState.destroyed ? h(this, null, null) : this._flush(function(d, v) {
          h(p, d, v);
        });
      }
      function h(p, d, v) {
        if (d) return p.emit("error", d);
        if (v != null && p.push(v), p._writableState.length) throw new i();
        if (p._transformState.transforming) throw new s();
        return p.push(null);
      }
      e("inherits")(c, l), c.prototype.push = function(p, d) {
        return this._transformState.needTransform = false, l.prototype.push.call(this, p, d);
      }, c.prototype._transform = function(p, d, v) {
        v(new a("_transform()"));
      }, c.prototype._write = function(p, d, v) {
        var m = this._transformState;
        if (m.writecb = v, m.writechunk = p, m.writeencoding = d, !m.transforming) {
          var g = this._readableState;
          (m.needTransform || g.needReadable || g.length < g.highWaterMark) && this._read(g.highWaterMark);
        }
      }, c.prototype._read = function(p) {
        var d = this._transformState;
        d.writechunk === null || d.transforming ? d.needTransform = true : (d.transforming = true, this._transform(d.writechunk, d.writeencoding, d.afterTransform));
      }, c.prototype._destroy = function(p, d) {
        l.prototype._destroy.call(this, p, function(v) {
          d(v);
        });
      };
    }, { "../errors": 286, "./_stream_duplex": 287, inherits: 231 }], 291: [function(e, t, r) {
      (function(n, a) {
        (function() {
          "use strict";
          function o(O2) {
            var L2 = this;
            this.next = null, this.entry = null, this.finish = function() {
              (function(V2, W2, X2) {
                var Y2 = V2.entry;
                for (V2.entry = null; Y2; ) {
                  var K2 = Y2.callback;
                  W2.pendingcb--, K2(X2), Y2 = Y2.next;
                }
                W2.corkedRequestsFree.next = V2;
              })(L2, O2);
            };
          }
          var s;
          t.exports = S2, S2.WritableState = A2;
          var i = { deprecate: e("util-deprecate") }, l = e("./internal/streams/stream"), u2 = e("buffer").Buffer, c = a.Uint8Array || function() {
          }, f, h = e("./internal/streams/destroy"), p = e("./internal/streams/state").getHighWaterMark, d = e("../errors").codes, v = d.ERR_INVALID_ARG_TYPE, m = d.ERR_METHOD_NOT_IMPLEMENTED, g = d.ERR_MULTIPLE_CALLBACK, x = d.ERR_STREAM_CANNOT_PIPE, b = d.ERR_STREAM_DESTROYED, y = d.ERR_STREAM_NULL_VALUES, w = d.ERR_STREAM_WRITE_AFTER_END, _4 = d.ERR_UNKNOWN_ENCODING, k = h.errorOrDestroy;
          function T2() {
          }
          function A2(O2, L2, V2) {
            s = s || e("./_stream_duplex"), O2 = O2 || {}, typeof V2 != "boolean" && (V2 = L2 instanceof s), this.objectMode = !!O2.objectMode, V2 && (this.objectMode = this.objectMode || !!O2.writableObjectMode), this.highWaterMark = p(this, O2, "writableHighWaterMark", V2), this.finalCalled = false, this.needDrain = false, this.ending = false, this.ended = false, this.finished = false, this.destroyed = false;
            var W2 = O2.decodeStrings === false;
            this.decodeStrings = !W2, this.defaultEncoding = O2.defaultEncoding || "utf8", this.length = 0, this.writing = false, this.corked = 0, this.sync = true, this.bufferProcessing = false, this.onwrite = function(X2) {
              (function(Y2, K2) {
                var q = Y2._writableState, re = q.sync, R2 = q.writecb;
                if (typeof R2 != "function") throw new g();
                if (function(H2) {
                  H2.writing = false, H2.writecb = null, H2.length -= H2.writelen, H2.writelen = 0;
                }(q), K2) (function(H2, te, j, Q2, Z2) {
                  --te.pendingcb, j ? (n.nextTick(Z2, Q2), n.nextTick(I2, H2, te), H2._writableState.errorEmitted = true, k(H2, Q2)) : (Z2(Q2), H2._writableState.errorEmitted = true, k(H2, Q2), I2(H2, te));
                })(Y2, q, re, K2, R2);
                else {
                  var z = N2(q) || Y2.destroyed;
                  z || q.corked || q.bufferProcessing || !q.bufferedRequest || F13(Y2, q), re ? n.nextTick(E2, Y2, q, z, R2) : E2(Y2, q, z, R2);
                }
              })(L2, X2);
            }, this.writecb = null, this.writelen = 0, this.bufferedRequest = null, this.lastBufferedRequest = null, this.pendingcb = 0, this.prefinished = false, this.errorEmitted = false, this.emitClose = O2.emitClose !== false, this.autoDestroy = !!O2.autoDestroy, this.bufferedRequestCount = 0, this.corkedRequestsFree = new o(this);
          }
          function S2(O2) {
            var L2 = this instanceof (s = s || e("./_stream_duplex"));
            if (!L2 && !f.call(S2, this)) return new S2(O2);
            this._writableState = new A2(O2, this, L2), this.writable = true, O2 && (typeof O2.write == "function" && (this._write = O2.write), typeof O2.writev == "function" && (this._writev = O2.writev), typeof O2.destroy == "function" && (this._destroy = O2.destroy), typeof O2.final == "function" && (this._final = O2.final)), l.call(this);
          }
          function C2(O2, L2, V2, W2, X2, Y2, K2) {
            L2.writelen = W2, L2.writecb = K2, L2.writing = true, L2.sync = true, L2.destroyed ? L2.onwrite(new b("write")) : V2 ? O2._writev(X2, L2.onwrite) : O2._write(X2, Y2, L2.onwrite), L2.sync = false;
          }
          function E2(O2, L2, V2, W2) {
            V2 || function(X2, Y2) {
              Y2.length === 0 && Y2.needDrain && (Y2.needDrain = false, X2.emit("drain"));
            }(O2, L2), L2.pendingcb--, W2(), I2(O2, L2);
          }
          function F13(O2, L2) {
            L2.bufferProcessing = true;
            var V2 = L2.bufferedRequest;
            if (O2._writev && V2 && V2.next) {
              var W2 = L2.bufferedRequestCount, X2 = new Array(W2), Y2 = L2.corkedRequestsFree;
              Y2.entry = V2;
              for (var K2 = 0, q = true; V2; ) X2[K2] = V2, V2.isBuf || (q = false), V2 = V2.next, K2 += 1;
              X2.allBuffers = q, C2(O2, L2, true, L2.length, X2, "", Y2.finish), L2.pendingcb++, L2.lastBufferedRequest = null, Y2.next ? (L2.corkedRequestsFree = Y2.next, Y2.next = null) : L2.corkedRequestsFree = new o(L2), L2.bufferedRequestCount = 0;
            } else {
              for (; V2; ) {
                var re = V2.chunk, R2 = V2.encoding, z = V2.callback;
                if (C2(O2, L2, false, L2.objectMode ? 1 : re.length, re, R2, z), V2 = V2.next, L2.bufferedRequestCount--, L2.writing) break;
              }
              V2 === null && (L2.lastBufferedRequest = null);
            }
            L2.bufferedRequest = V2, L2.bufferProcessing = false;
          }
          function N2(O2) {
            return O2.ending && O2.length === 0 && O2.bufferedRequest === null && !O2.finished && !O2.writing;
          }
          function D2(O2, L2) {
            O2._final(function(V2) {
              L2.pendingcb--, V2 && k(O2, V2), L2.prefinished = true, O2.emit("prefinish"), I2(O2, L2);
            });
          }
          function I2(O2, L2) {
            var V2 = N2(L2);
            if (V2 && (function(X2, Y2) {
              Y2.prefinished || Y2.finalCalled || (typeof X2._final != "function" || Y2.destroyed ? (Y2.prefinished = true, X2.emit("prefinish")) : (Y2.pendingcb++, Y2.finalCalled = true, n.nextTick(D2, X2, Y2)));
            }(O2, L2), L2.pendingcb === 0 && (L2.finished = true, O2.emit("finish"), L2.autoDestroy))) {
              var W2 = O2._readableState;
              (!W2 || W2.autoDestroy && W2.endEmitted) && O2.destroy();
            }
            return V2;
          }
          e("inherits")(S2, l), A2.prototype.getBuffer = function() {
            for (var O2 = this.bufferedRequest, L2 = []; O2; ) L2.push(O2), O2 = O2.next;
            return L2;
          }, function() {
            try {
              Object.defineProperty(A2.prototype, "buffer", { get: i.deprecate(function() {
                return this.getBuffer();
              }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003") });
            } catch {
            }
          }(), typeof Symbol == "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] == "function" ? (f = Function.prototype[Symbol.hasInstance], Object.defineProperty(S2, Symbol.hasInstance, { value: function(O2) {
            return !!f.call(this, O2) || this === S2 && O2 && O2._writableState instanceof A2;
          } })) : f = function(O2) {
            return O2 instanceof this;
          }, S2.prototype.pipe = function() {
            k(this, new x());
          }, S2.prototype.write = function(O2, L2, V2) {
            var W2, X2 = this._writableState, Y2 = false, K2 = !X2.objectMode && (W2 = O2, u2.isBuffer(W2) || W2 instanceof c);
            return K2 && !u2.isBuffer(O2) && (O2 = function(q) {
              return u2.from(q);
            }(O2)), typeof L2 == "function" && (V2 = L2, L2 = null), K2 ? L2 = "buffer" : L2 || (L2 = X2.defaultEncoding), typeof V2 != "function" && (V2 = T2), X2.ending ? function(q, re) {
              var R2 = new w();
              k(q, R2), n.nextTick(re, R2);
            }(this, V2) : (K2 || function(q, re, R2, z) {
              var H2;
              return R2 === null ? H2 = new y() : typeof R2 == "string" || re.objectMode || (H2 = new v("chunk", ["string", "Buffer"], R2)), !H2 || (k(q, H2), n.nextTick(z, H2), false);
            }(this, X2, O2, V2)) && (X2.pendingcb++, Y2 = function(q, re, R2, z, H2, te) {
              if (!R2) {
                var j = function(ae, ue, le) {
                  return ae.objectMode || ae.decodeStrings === false || typeof ue != "string" || (ue = u2.from(ue, le)), ue;
                }(re, z, H2);
                z !== j && (R2 = true, H2 = "buffer", z = j);
              }
              var Q2 = re.objectMode ? 1 : z.length;
              re.length += Q2;
              var Z2 = re.length < re.highWaterMark;
              if (Z2 || (re.needDrain = true), re.writing || re.corked) {
                var ne = re.lastBufferedRequest;
                re.lastBufferedRequest = { chunk: z, encoding: H2, isBuf: R2, callback: te, next: null }, ne ? ne.next = re.lastBufferedRequest : re.bufferedRequest = re.lastBufferedRequest, re.bufferedRequestCount += 1;
              } else C2(q, re, false, Q2, z, H2, te);
              return Z2;
            }(this, X2, K2, O2, L2, V2)), Y2;
          }, S2.prototype.cork = function() {
            this._writableState.corked++;
          }, S2.prototype.uncork = function() {
            var O2 = this._writableState;
            O2.corked && (O2.corked--, O2.writing || O2.corked || O2.bufferProcessing || !O2.bufferedRequest || F13(this, O2));
          }, S2.prototype.setDefaultEncoding = function(O2) {
            if (typeof O2 == "string" && (O2 = O2.toLowerCase()), !(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((O2 + "").toLowerCase()) > -1)) throw new _4(O2);
            return this._writableState.defaultEncoding = O2, this;
          }, Object.defineProperty(S2.prototype, "writableBuffer", { enumerable: false, get: function() {
            return this._writableState && this._writableState.getBuffer();
          } }), Object.defineProperty(S2.prototype, "writableHighWaterMark", { enumerable: false, get: function() {
            return this._writableState.highWaterMark;
          } }), S2.prototype._write = function(O2, L2, V2) {
            V2(new m("_write()"));
          }, S2.prototype._writev = null, S2.prototype.end = function(O2, L2, V2) {
            var W2 = this._writableState;
            return typeof O2 == "function" ? (V2 = O2, O2 = null, L2 = null) : typeof L2 == "function" && (V2 = L2, L2 = null), O2 != null && this.write(O2, L2), W2.corked && (W2.corked = 1, this.uncork()), W2.ending || function(X2, Y2, K2) {
              Y2.ending = true, I2(X2, Y2), K2 && (Y2.finished ? n.nextTick(K2) : X2.once("finish", K2)), Y2.ended = true, X2.writable = false;
            }(this, W2, V2), this;
          }, Object.defineProperty(S2.prototype, "writableLength", { enumerable: false, get: function() {
            return this._writableState.length;
          } }), Object.defineProperty(S2.prototype, "destroyed", { enumerable: false, get: function() {
            return this._writableState !== void 0 && this._writableState.destroyed;
          }, set: function(O2) {
            this._writableState && (this._writableState.destroyed = O2);
          } }), S2.prototype.destroy = h.destroy, S2.prototype._undestroy = h.undestroy, S2.prototype._destroy = function(O2, L2) {
            L2(O2);
          };
        }).call(this);
      }).call(this, e("_process"), typeof global < "u" ? global : typeof self < "u" ? self : typeof window < "u" ? window : {});
    }, { "../errors": 286, "./_stream_duplex": 287, "./internal/streams/destroy": 294, "./internal/streams/state": 298, "./internal/streams/stream": 299, _process: 277, buffer: 85, inherits: 231, "util-deprecate": 330 }], 292: [function(e, t, r) {
      (function(n) {
        (function() {
          "use strict";
          var a;
          function o(b, y, w) {
            return y in b ? Object.defineProperty(b, y, { value: w, enumerable: true, configurable: true, writable: true }) : b[y] = w, b;
          }
          var s = e("./end-of-stream"), i = Symbol("lastResolve"), l = Symbol("lastReject"), u2 = Symbol("error"), c = Symbol("ended"), f = Symbol("lastPromise"), h = Symbol("handlePromise"), p = Symbol("stream");
          function d(b, y) {
            return { value: b, done: y };
          }
          function v(b) {
            var y = b[i];
            if (y !== null) {
              var w = b[p].read();
              w !== null && (b[f] = null, b[i] = null, b[l] = null, y(d(w, false)));
            }
          }
          function m(b) {
            n.nextTick(v, b);
          }
          var g = Object.getPrototypeOf(function() {
          }), x = Object.setPrototypeOf((o(a = { get stream() {
            return this[p];
          }, next: function() {
            var b = this, y = this[u2];
            if (y !== null) return Promise.reject(y);
            if (this[c]) return Promise.resolve(d(void 0, true));
            if (this[p].destroyed) return new Promise(function(T2, A2) {
              n.nextTick(function() {
                b[u2] ? A2(b[u2]) : T2(d(void 0, true));
              });
            });
            var w, _4 = this[f];
            if (_4) w = new Promise(/* @__PURE__ */ function(T2, A2) {
              return function(S2, C2) {
                T2.then(function() {
                  A2[c] ? S2(d(void 0, true)) : A2[h](S2, C2);
                }, C2);
              };
            }(_4, this));
            else {
              var k = this[p].read();
              if (k !== null) return Promise.resolve(d(k, false));
              w = new Promise(this[h]);
            }
            return this[f] = w, w;
          } }, Symbol.asyncIterator, function() {
            return this;
          }), o(a, "return", function() {
            var b = this;
            return new Promise(function(y, w) {
              b[p].destroy(null, function(_4) {
                _4 ? w(_4) : y(d(void 0, true));
              });
            });
          }), a), g);
          t.exports = function(b) {
            var y, w = Object.create(x, (o(y = {}, p, { value: b, writable: true }), o(y, i, { value: null, writable: true }), o(y, l, { value: null, writable: true }), o(y, u2, { value: null, writable: true }), o(y, c, { value: b._readableState.endEmitted, writable: true }), o(y, h, { value: function(_4, k) {
              var T2 = w[p].read();
              T2 ? (w[f] = null, w[i] = null, w[l] = null, _4(d(T2, false))) : (w[i] = _4, w[l] = k);
            }, writable: true }), y));
            return w[f] = null, s(b, function(_4) {
              if (_4 && _4.code !== "ERR_STREAM_PREMATURE_CLOSE") {
                var k = w[l];
                return k !== null && (w[f] = null, w[i] = null, w[l] = null, k(_4)), void (w[u2] = _4);
              }
              var T2 = w[i];
              T2 !== null && (w[f] = null, w[i] = null, w[l] = null, T2(d(void 0, true))), w[c] = true;
            }), b.on("readable", m.bind(null, w)), w;
          };
        }).call(this);
      }).call(this, e("_process"));
    }, { "./end-of-stream": 295, _process: 277 }], 293: [function(e, t, r) {
      "use strict";
      function n(u2, c) {
        var f = Object.keys(u2);
        if (Object.getOwnPropertySymbols) {
          var h = Object.getOwnPropertySymbols(u2);
          c && (h = h.filter(function(p) {
            return Object.getOwnPropertyDescriptor(u2, p).enumerable;
          })), f.push.apply(f, h);
        }
        return f;
      }
      function a(u2, c, f) {
        return c in u2 ? Object.defineProperty(u2, c, { value: f, enumerable: true, configurable: true, writable: true }) : u2[c] = f, u2;
      }
      function o(u2, c) {
        for (var f = 0; f < c.length; f++) {
          var h = c[f];
          h.enumerable = h.enumerable || false, h.configurable = true, "value" in h && (h.writable = true), Object.defineProperty(u2, h.key, h);
        }
      }
      var s = e("buffer").Buffer, i = e("util").inspect, l = i && i.custom || "inspect";
      t.exports = function() {
        function u2() {
          (function(p, d) {
            if (!(p instanceof d)) throw new TypeError("Cannot call a class as a function");
          })(this, u2), this.head = null, this.tail = null, this.length = 0;
        }
        var c, f, h;
        return c = u2, (f = [{ key: "push", value: function(p) {
          var d = { data: p, next: null };
          this.length > 0 ? this.tail.next = d : this.head = d, this.tail = d, ++this.length;
        } }, { key: "unshift", value: function(p) {
          var d = { data: p, next: this.head };
          this.length === 0 && (this.tail = d), this.head = d, ++this.length;
        } }, { key: "shift", value: function() {
          if (this.length !== 0) {
            var p = this.head.data;
            return this.length === 1 ? this.head = this.tail = null : this.head = this.head.next, --this.length, p;
          }
        } }, { key: "clear", value: function() {
          this.head = this.tail = null, this.length = 0;
        } }, { key: "join", value: function(p) {
          if (this.length === 0) return "";
          for (var d = this.head, v = "" + d.data; d = d.next; ) v += p + d.data;
          return v;
        } }, { key: "concat", value: function(p) {
          if (this.length === 0) return s.alloc(0);
          for (var d, v, m, g = s.allocUnsafe(p >>> 0), x = this.head, b = 0; x; ) d = x.data, v = g, m = b, s.prototype.copy.call(d, v, m), b += x.data.length, x = x.next;
          return g;
        } }, { key: "consume", value: function(p, d) {
          var v;
          return p < this.head.data.length ? (v = this.head.data.slice(0, p), this.head.data = this.head.data.slice(p)) : v = p === this.head.data.length ? this.shift() : d ? this._getString(p) : this._getBuffer(p), v;
        } }, { key: "first", value: function() {
          return this.head.data;
        } }, { key: "_getString", value: function(p) {
          var d = this.head, v = 1, m = d.data;
          for (p -= m.length; d = d.next; ) {
            var g = d.data, x = p > g.length ? g.length : p;
            if (x === g.length ? m += g : m += g.slice(0, p), (p -= x) == 0) {
              x === g.length ? (++v, d.next ? this.head = d.next : this.head = this.tail = null) : (this.head = d, d.data = g.slice(x));
              break;
            }
            ++v;
          }
          return this.length -= v, m;
        } }, { key: "_getBuffer", value: function(p) {
          var d = s.allocUnsafe(p), v = this.head, m = 1;
          for (v.data.copy(d), p -= v.data.length; v = v.next; ) {
            var g = v.data, x = p > g.length ? g.length : p;
            if (g.copy(d, d.length - p, 0, x), (p -= x) == 0) {
              x === g.length ? (++m, v.next ? this.head = v.next : this.head = this.tail = null) : (this.head = v, v.data = g.slice(x));
              break;
            }
            ++m;
          }
          return this.length -= m, d;
        } }, { key: l, value: function(p, d) {
          return i(this, function(v) {
            for (var m = 1; m < arguments.length; m++) {
              var g = arguments[m] != null ? arguments[m] : {};
              m % 2 ? n(Object(g), true).forEach(function(x) {
                a(v, x, g[x]);
              }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(v, Object.getOwnPropertyDescriptors(g)) : n(Object(g)).forEach(function(x) {
                Object.defineProperty(v, x, Object.getOwnPropertyDescriptor(g, x));
              });
            }
            return v;
          }({}, d, { depth: 0, customInspect: false }));
        } }]) && o(c.prototype, f), h && o(c, h), u2;
      }();
    }, { buffer: 85, util: 83 }], 294: [function(e, t, r) {
      (function(n) {
        (function() {
          "use strict";
          function a(i, l) {
            s(i, l), o(i);
          }
          function o(i) {
            i._writableState && !i._writableState.emitClose || i._readableState && !i._readableState.emitClose || i.emit("close");
          }
          function s(i, l) {
            i.emit("error", l);
          }
          t.exports = { destroy: function(i, l) {
            var u2 = this, c = this._readableState && this._readableState.destroyed, f = this._writableState && this._writableState.destroyed;
            return c || f ? (l ? l(i) : i && (this._writableState ? this._writableState.errorEmitted || (this._writableState.errorEmitted = true, n.nextTick(s, this, i)) : n.nextTick(s, this, i)), this) : (this._readableState && (this._readableState.destroyed = true), this._writableState && (this._writableState.destroyed = true), this._destroy(i || null, function(h) {
              !l && h ? u2._writableState ? u2._writableState.errorEmitted ? n.nextTick(o, u2) : (u2._writableState.errorEmitted = true, n.nextTick(a, u2, h)) : n.nextTick(a, u2, h) : l ? (n.nextTick(o, u2), l(h)) : n.nextTick(o, u2);
            }), this);
          }, undestroy: function() {
            this._readableState && (this._readableState.destroyed = false, this._readableState.reading = false, this._readableState.ended = false, this._readableState.endEmitted = false), this._writableState && (this._writableState.destroyed = false, this._writableState.ended = false, this._writableState.ending = false, this._writableState.finalCalled = false, this._writableState.prefinished = false, this._writableState.finished = false, this._writableState.errorEmitted = false);
          }, errorOrDestroy: function(i, l) {
            var u2 = i._readableState, c = i._writableState;
            u2 && u2.autoDestroy || c && c.autoDestroy ? i.destroy(l) : i.emit("error", l);
          } };
        }).call(this);
      }).call(this, e("_process"));
    }, { _process: 277 }], 295: [function(e, t, r) {
      "use strict";
      var n = e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;
      function a() {
      }
      t.exports = function o(s, i, l) {
        if (typeof i == "function") return o(s, null, i);
        i || (i = {}), l = /* @__PURE__ */ function(b) {
          var y = false;
          return function() {
            if (!y) {
              y = true;
              for (var w = arguments.length, _4 = new Array(w), k = 0; k < w; k++) _4[k] = arguments[k];
              b.apply(this, _4);
            }
          };
        }(l || a);
        var u2 = i.readable || i.readable !== false && s.readable, c = i.writable || i.writable !== false && s.writable, f = function() {
          s.writable || p();
        }, h = s._writableState && s._writableState.finished, p = function() {
          c = false, h = true, u2 || l.call(s);
        }, d = s._readableState && s._readableState.endEmitted, v = function() {
          u2 = false, d = true, c || l.call(s);
        }, m = function(b) {
          l.call(s, b);
        }, g = function() {
          var b;
          return u2 && !d ? (s._readableState && s._readableState.ended || (b = new n()), l.call(s, b)) : c && !h ? (s._writableState && s._writableState.ended || (b = new n()), l.call(s, b)) : void 0;
        }, x = function() {
          s.req.on("finish", p);
        };
        return function(b) {
          return b.setHeader && typeof b.abort == "function";
        }(s) ? (s.on("complete", p), s.on("abort", g), s.req ? x() : s.on("request", x)) : c && !s._writableState && (s.on("end", f), s.on("close", f)), s.on("end", v), s.on("finish", p), i.error !== false && s.on("error", m), s.on("close", g), function() {
          s.removeListener("complete", p), s.removeListener("abort", g), s.removeListener("request", x), s.req && s.req.removeListener("finish", p), s.removeListener("end", f), s.removeListener("close", f), s.removeListener("finish", p), s.removeListener("end", v), s.removeListener("error", m), s.removeListener("close", g);
        };
      };
    }, { "../../../errors": 286 }], 296: [function(e, t, r) {
      t.exports = function() {
        throw new Error("Readable.from is not available in the browser");
      };
    }, {}], 297: [function(e, t, r) {
      "use strict";
      var n, a = e("../../../errors").codes, o = a.ERR_MISSING_ARGS, s = a.ERR_STREAM_DESTROYED;
      function i(h) {
        if (h) throw h;
      }
      function l(h, p, d, v) {
        v = /* @__PURE__ */ function(x) {
          var b = false;
          return function() {
            b || (b = true, x.apply(void 0, arguments));
          };
        }(v);
        var m = false;
        h.on("close", function() {
          m = true;
        }), n === void 0 && (n = e("./end-of-stream")), n(h, { readable: p, writable: d }, function(x) {
          if (x) return v(x);
          m = true, v();
        });
        var g = false;
        return function(x) {
          if (!m && !g) return g = true, function(b) {
            return b.setHeader && typeof b.abort == "function";
          }(h) ? h.abort() : typeof h.destroy == "function" ? h.destroy() : void v(x || new s("pipe"));
        };
      }
      function u2(h) {
        h();
      }
      function c(h, p) {
        return h.pipe(p);
      }
      function f(h) {
        return h.length ? typeof h[h.length - 1] != "function" ? i : h.pop() : i;
      }
      t.exports = function() {
        for (var h = arguments.length, p = new Array(h), d = 0; d < h; d++) p[d] = arguments[d];
        var v, m = f(p);
        if (Array.isArray(p[0]) && (p = p[0]), p.length < 2) throw new o("streams");
        var g = p.map(function(x, b) {
          var y = b < p.length - 1;
          return l(x, y, b > 0, function(w) {
            v || (v = w), w && g.forEach(u2), y || (g.forEach(u2), m(v));
          });
        });
        return p.reduce(c);
      };
    }, { "../../../errors": 286, "./end-of-stream": 295 }], 298: [function(e, t, r) {
      "use strict";
      var n = e("../../../errors").codes.ERR_INVALID_OPT_VALUE;
      t.exports = { getHighWaterMark: function(a, o, s, i) {
        var l = function(u2, c, f) {
          return u2.highWaterMark != null ? u2.highWaterMark : c ? u2[f] : null;
        }(o, i, s);
        if (l != null) {
          if (!isFinite(l) || Math.floor(l) !== l || l < 0) throw new n(i ? s : "highWaterMark", l);
          return Math.floor(l);
        }
        return a.objectMode ? 16 : 16384;
      } };
    }, { "../../../errors": 286 }], 299: [function(e, t, r) {
      t.exports = e("events").EventEmitter;
    }, { events: 84 }], 300: [function(e, t, r) {
      "use strict";
      var n = e("safe-buffer").Buffer, a = n.isEncoding || function(d) {
        switch ((d = "" + d) && d.toLowerCase()) {
          case "hex":
          case "utf8":
          case "utf-8":
          case "ascii":
          case "binary":
          case "base64":
          case "ucs2":
          case "ucs-2":
          case "utf16le":
          case "utf-16le":
          case "raw":
            return true;
          default:
            return false;
        }
      };
      function o(d) {
        var v;
        switch (this.encoding = function(m) {
          var g = function(x) {
            if (!x) return "utf8";
            for (var b; ; ) switch (x) {
              case "utf8":
              case "utf-8":
                return "utf8";
              case "ucs2":
              case "ucs-2":
              case "utf16le":
              case "utf-16le":
                return "utf16le";
              case "latin1":
              case "binary":
                return "latin1";
              case "base64":
              case "ascii":
              case "hex":
                return x;
              default:
                if (b) return;
                x = ("" + x).toLowerCase(), b = true;
            }
          }(m);
          if (typeof g != "string" && (n.isEncoding === a || !a(m))) throw new Error("Unknown encoding: " + m);
          return g || m;
        }(d), this.encoding) {
          case "utf16le":
            this.text = l, this.end = u2, v = 4;
            break;
          case "utf8":
            this.fillLast = i, v = 4;
            break;
          case "base64":
            this.text = c, this.end = f, v = 3;
            break;
          default:
            return this.write = h, void (this.end = p);
        }
        this.lastNeed = 0, this.lastTotal = 0, this.lastChar = n.allocUnsafe(v);
      }
      function s(d) {
        return d <= 127 ? 0 : d >> 5 == 6 ? 2 : d >> 4 == 14 ? 3 : d >> 3 == 30 ? 4 : d >> 6 == 2 ? -1 : -2;
      }
      function i(d) {
        var v = this.lastTotal - this.lastNeed, m = function(g, x, b) {
          if ((192 & x[0]) != 128) return g.lastNeed = 0, "\uFFFD";
          if (g.lastNeed > 1 && x.length > 1) {
            if ((192 & x[1]) != 128) return g.lastNeed = 1, "\uFFFD";
            if (g.lastNeed > 2 && x.length > 2 && (192 & x[2]) != 128) return g.lastNeed = 2, "\uFFFD";
          }
        }(this, d);
        return m !== void 0 ? m : this.lastNeed <= d.length ? (d.copy(this.lastChar, v, 0, this.lastNeed), this.lastChar.toString(this.encoding, 0, this.lastTotal)) : (d.copy(this.lastChar, v, 0, d.length), void (this.lastNeed -= d.length));
      }
      function l(d, v) {
        if ((d.length - v) % 2 == 0) {
          var m = d.toString("utf16le", v);
          if (m) {
            var g = m.charCodeAt(m.length - 1);
            if (g >= 55296 && g <= 56319) return this.lastNeed = 2, this.lastTotal = 4, this.lastChar[0] = d[d.length - 2], this.lastChar[1] = d[d.length - 1], m.slice(0, -1);
          }
          return m;
        }
        return this.lastNeed = 1, this.lastTotal = 2, this.lastChar[0] = d[d.length - 1], d.toString("utf16le", v, d.length - 1);
      }
      function u2(d) {
        var v = d && d.length ? this.write(d) : "";
        if (this.lastNeed) {
          var m = this.lastTotal - this.lastNeed;
          return v + this.lastChar.toString("utf16le", 0, m);
        }
        return v;
      }
      function c(d, v) {
        var m = (d.length - v) % 3;
        return m === 0 ? d.toString("base64", v) : (this.lastNeed = 3 - m, this.lastTotal = 3, m === 1 ? this.lastChar[0] = d[d.length - 1] : (this.lastChar[0] = d[d.length - 2], this.lastChar[1] = d[d.length - 1]), d.toString("base64", v, d.length - m));
      }
      function f(d) {
        var v = d && d.length ? this.write(d) : "";
        return this.lastNeed ? v + this.lastChar.toString("base64", 0, 3 - this.lastNeed) : v;
      }
      function h(d) {
        return d.toString(this.encoding);
      }
      function p(d) {
        return d && d.length ? this.write(d) : "";
      }
      r.StringDecoder = o, o.prototype.write = function(d) {
        if (d.length === 0) return "";
        var v, m;
        if (this.lastNeed) {
          if ((v = this.fillLast(d)) === void 0) return "";
          m = this.lastNeed, this.lastNeed = 0;
        } else m = 0;
        return m < d.length ? v ? v + this.text(d, m) : this.text(d, m) : v || "";
      }, o.prototype.end = function(d) {
        var v = d && d.length ? this.write(d) : "";
        return this.lastNeed ? v + "\uFFFD" : v;
      }, o.prototype.text = function(d, v) {
        var m = function(x, b, y) {
          var w = b.length - 1;
          if (w < y) return 0;
          var _4 = s(b[w]);
          return _4 >= 0 ? (_4 > 0 && (x.lastNeed = _4 - 1), _4) : --w < y || _4 === -2 ? 0 : (_4 = s(b[w])) >= 0 ? (_4 > 0 && (x.lastNeed = _4 - 2), _4) : --w < y || _4 === -2 ? 0 : (_4 = s(b[w])) >= 0 ? (_4 > 0 && (_4 === 2 ? _4 = 0 : x.lastNeed = _4 - 3), _4) : 0;
        }(this, d, v);
        if (!this.lastNeed) return d.toString("utf8", v);
        this.lastTotal = m;
        var g = d.length - (m - this.lastNeed);
        return d.copy(this.lastChar, 0, g), d.toString("utf8", v, g);
      }, o.prototype.fillLast = function(d) {
        if (this.lastNeed <= d.length) return d.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed), this.lastChar.toString(this.encoding, 0, this.lastTotal);
        d.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, d.length), this.lastNeed -= d.length;
      };
    }, { "safe-buffer": 284 }], 301: [function(e, t, r) {
      (function(n, a) {
        (function() {
          var o = e("assert"), s = e("debug")("stream-parser");
          t.exports = function(m) {
            var g = m && typeof m._transform == "function", x = m && typeof m._write == "function";
            if (!g && !x) throw new Error("must pass a Writable or Transform stream in");
            s("extending Parser into stream"), m._bytes = l, m._skipBytes = u2, g && (m._passthrough = c), g ? m._transform = h : m._write = f;
          };
          function i(m) {
            s("initializing parser stream"), m._parserBytesLeft = 0, m._parserBuffers = [], m._parserBuffered = 0, m._parserState = -1, m._parserCallback = null, typeof m.push == "function" && (m._parserOutput = m.push.bind(m)), m._parserInit = true;
          }
          function l(m, g) {
            o(!this._parserCallback, 'there is already a "callback" set!'), o(isFinite(m) && m > 0, 'can only buffer a finite number of bytes > 0, got "' + m + '"'), this._parserInit || i(this), s("buffering %o bytes", m), this._parserBytesLeft = m, this._parserCallback = g, this._parserState = 0;
          }
          function u2(m, g) {
            o(!this._parserCallback, 'there is already a "callback" set!'), o(m > 0, 'can only skip > 0 bytes, got "' + m + '"'), this._parserInit || i(this), s("skipping %o bytes", m), this._parserBytesLeft = m, this._parserCallback = g, this._parserState = 1;
          }
          function c(m, g) {
            o(!this._parserCallback, 'There is already a "callback" set!'), o(m > 0, 'can only pass through > 0 bytes, got "' + m + '"'), this._parserInit || i(this), s("passing through %o bytes", m), this._parserBytesLeft = m, this._parserCallback = g, this._parserState = 2;
          }
          function f(m, g, x) {
            this._parserInit || i(this), s("write(%o bytes)", m.length), typeof g == "function" && (x = g), d(this, m, null, x);
          }
          function h(m, g, x) {
            this._parserInit || i(this), s("transform(%o bytes)", m.length), typeof g != "function" && (g = this._parserOutput), d(this, m, g, x);
          }
          function p(m, g, x, b) {
            if (m._parserBytesLeft -= g.length, s("%o bytes left for stream piece", m._parserBytesLeft), m._parserState === 0 ? (m._parserBuffers.push(g), m._parserBuffered += g.length) : m._parserState === 2 && x(g), m._parserBytesLeft !== 0) return b;
            var y = m._parserCallback;
            if (y && m._parserState === 0 && m._parserBuffers.length > 1 && (g = a.concat(m._parserBuffers, m._parserBuffered)), m._parserState !== 0 && (g = null), m._parserCallback = null, m._parserBuffered = 0, m._parserState = -1, m._parserBuffers.splice(0), y) {
              var w = [];
              g && w.push(g), x && w.push(x);
              var _4 = y.length > w.length;
              _4 && w.push(v(b));
              var k = y.apply(m, w);
              if (!_4 || b === k) return b;
            }
          }
          var d = v(function m(g, x, b, y) {
            return g._parserBytesLeft <= 0 ? y(new Error("got data but not currently parsing anything")) : x.length <= g._parserBytesLeft ? function() {
              return p(g, x, b, y);
            } : function() {
              var w = x.slice(0, g._parserBytesLeft);
              return p(g, w, b, function(_4) {
                return _4 ? y(_4) : x.length > w.length ? function() {
                  return m(g, x.slice(w.length), b, y);
                } : void 0;
              });
            };
          });
          function v(m) {
            return function() {
              for (var g = m.apply(this, arguments); typeof g == "function"; ) g = g();
              return g;
            };
          }
        }).call(this);
      }).call(this, e("_process"), e("buffer").Buffer);
    }, { _process: 277, assert: 75, buffer: 85, debug: 302 }], 302: [function(e, t, r) {
      (function(n) {
        (function() {
          function a() {
            var o;
            try {
              o = r.storage.debug;
            } catch {
            }
            return !o && n !== void 0 && "env" in n && (o = n.env.DEBUG), o;
          }
          (r = t.exports = e("./debug")).log = function() {
            return typeof console == "object" && console.log && Function.prototype.apply.call(console.log, console, arguments);
          }, r.formatArgs = function(o) {
            var s = this.useColors;
            if (o[0] = (s ? "%c" : "") + this.namespace + (s ? " %c" : " ") + o[0] + (s ? "%c " : " ") + "+" + r.humanize(this.diff), !!s) {
              var i = "color: " + this.color;
              o.splice(1, 0, i, "color: inherit");
              var l = 0, u2 = 0;
              o[0].replace(/%[a-zA-Z%]/g, function(c) {
                c !== "%%" && (l++, c === "%c" && (u2 = l));
              }), o.splice(u2, 0, i);
            }
          }, r.save = function(o) {
            try {
              o == null ? r.storage.removeItem("debug") : r.storage.debug = o;
            } catch {
            }
          }, r.load = a, r.useColors = function() {
            return typeof window < "u" && window.process && window.process.type === "renderer" ? true : typeof document < "u" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window < "u" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
          }, r.storage = typeof chrome < "u" && chrome.storage !== void 0 ? chrome.storage.local : function() {
            try {
              return window.localStorage;
            } catch {
            }
          }(), r.colors = ["lightseagreen", "forestgreen", "goldenrod", "dodgerblue", "darkorchid", "crimson"], r.formatters.j = function(o) {
            try {
              return JSON.stringify(o);
            } catch (s) {
              return "[UnexpectedJSONParseError]: " + s.message;
            }
          }, r.enable(a());
        }).call(this);
      }).call(this, e("_process"));
    }, { "./debug": 303, _process: 277 }], 303: [function(e, t, r) {
      var n;
      function a(o) {
        function s() {
          if (s.enabled) {
            var i = s, l = +/* @__PURE__ */ new Date(), u2 = l - (n || l);
            i.diff = u2, i.prev = n, i.curr = l, n = l;
            for (var c = new Array(arguments.length), f = 0; f < c.length; f++) c[f] = arguments[f];
            c[0] = r.coerce(c[0]), typeof c[0] != "string" && c.unshift("%O");
            var h = 0;
            c[0] = c[0].replace(/%([a-zA-Z%])/g, function(d, v) {
              if (d === "%%") return d;
              h++;
              var m = r.formatters[v];
              if (typeof m == "function") {
                var g = c[h];
                d = m.call(i, g), c.splice(h, 1), h--;
              }
              return d;
            }), r.formatArgs.call(i, c);
            var p = s.log || r.log || console.log.bind(console);
            p.apply(i, c);
          }
        }
        return s.namespace = o, s.enabled = r.enabled(o), s.useColors = r.useColors(), s.color = function(i) {
          var l, u2 = 0;
          for (l in i) u2 = (u2 << 5) - u2 + i.charCodeAt(l), u2 |= 0;
          return r.colors[Math.abs(u2) % r.colors.length];
        }(o), typeof r.init == "function" && r.init(s), s;
      }
      (r = t.exports = a.debug = a.default = a).coerce = function(o) {
        return o instanceof Error ? o.stack || o.message : o;
      }, r.disable = function() {
        r.enable("");
      }, r.enable = function(o) {
        r.save(o), r.names = [], r.skips = [];
        for (var s = (typeof o == "string" ? o : "").split(/[\s,]+/), i = s.length, l = 0; l < i; l++) s[l] && ((o = s[l].replace(/\*/g, ".*?"))[0] === "-" ? r.skips.push(new RegExp("^" + o.substr(1) + "$")) : r.names.push(new RegExp("^" + o + "$")));
      }, r.enabled = function(o) {
        var s, i;
        for (s = 0, i = r.skips.length; s < i; s++) if (r.skips[s].test(o)) return false;
        for (s = 0, i = r.names.length; s < i; s++) if (r.names[s].test(o)) return true;
        return false;
      }, r.humanize = e("ms"), r.names = [], r.skips = [], r.formatters = {};
    }, { ms: 304 }], 304: [function(e, t, r) {
      var n = 1e3, a = 6e4, o = 60 * a, s = 24 * o;
      function i(l, u2, c) {
        if (!(l < u2)) return l < 1.5 * u2 ? Math.floor(l / u2) + " " + c : Math.ceil(l / u2) + " " + c + "s";
      }
      t.exports = function(l, u2) {
        u2 = u2 || {};
        var c, f = typeof l;
        if (f === "string" && l.length > 0) return function(h) {
          if (!((h = String(h)).length > 100)) {
            var p = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(h);
            if (!!p) {
              var d = parseFloat(p[1]);
              switch ((p[2] || "ms").toLowerCase()) {
                case "years":
                case "year":
                case "yrs":
                case "yr":
                case "y":
                  return 315576e5 * d;
                case "days":
                case "day":
                case "d":
                  return d * s;
                case "hours":
                case "hour":
                case "hrs":
                case "hr":
                case "h":
                  return d * o;
                case "minutes":
                case "minute":
                case "mins":
                case "min":
                case "m":
                  return d * a;
                case "seconds":
                case "second":
                case "secs":
                case "sec":
                case "s":
                  return d * n;
                case "milliseconds":
                case "millisecond":
                case "msecs":
                case "msec":
                case "ms":
                  return d;
                default:
                  return;
              }
            }
          }
        }(l);
        if (f === "number" && isNaN(l) === false) return u2.long ? i(c = l, s, "day") || i(c, o, "hour") || i(c, a, "minute") || i(c, n, "second") || c + " ms" : function(h) {
          return h >= s ? Math.round(h / s) + "d" : h >= o ? Math.round(h / o) + "h" : h >= a ? Math.round(h / a) + "m" : h >= n ? Math.round(h / n) + "s" : h + "ms";
        }(l);
        throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(l));
      };
    }, {}], 305: [function(e, t, r) {
      "use strict";
      var n = e("parenthesis");
      t.exports = function(a, o, s) {
        if (a == null) throw Error("First argument should be a string");
        if (o == null) throw Error("Separator should be a string or a RegExp");
        s ? (typeof s == "string" || Array.isArray(s)) && (s = { ignore: s }) : s = {}, s.escape == null && (s.escape = true), s.ignore == null ? s.ignore = ["[]", "()", "{}", "<>", '""', "''", "``", "\u201C\u201D", "\xAB\xBB"] : (typeof s.ignore == "string" && (s.ignore = [s.ignore]), s.ignore = s.ignore.map(function(p) {
          return p.length === 1 && (p += p), p;
        }));
        var i = n.parse(a, { flat: true, brackets: s.ignore }), l = i[0].split(o);
        if (s.escape) {
          for (var u2 = [], c = 0; c < l.length; c++) {
            var f = l[c], h = l[c + 1];
            f[f.length - 1] === "\\" && f[f.length - 2] !== "\\" ? (u2.push(f + o + h), c++) : u2.push(f);
          }
          l = u2;
        }
        for (c = 0; c < l.length; c++) i[0] = l[c], l[c] = n.stringify(i, { flat: true });
        return l;
      };
    }, { parenthesis: 248 }], 306: [function(e, t, r) {
      "use strict";
      t.exports = function(n) {
        for (var a = n.length, o = new Array(a), s = new Array(a), i = new Array(a), l = new Array(a), u2 = new Array(a), c = new Array(a), f = 0; f < a; ++f) o[f] = -1, s[f] = 0, i[f] = false, l[f] = 0, u2[f] = -1, c[f] = [];
        var h, p = 0, d = [], v = [];
        function m(b) {
          var y = [b], w = [b];
          for (o[b] = s[b] = p, i[b] = true, p += 1; w.length > 0; ) {
            b = w[w.length - 1];
            var _4 = n[b];
            if (l[b] < _4.length) {
              for (var k = l[b]; k < _4.length; ++k) {
                var T2 = _4[k];
                if (o[T2] < 0) {
                  o[T2] = s[T2] = p, i[T2] = true, p += 1, y.push(T2), w.push(T2);
                  break;
                }
                i[T2] && (s[b] = 0 | Math.min(s[b], s[T2])), u2[T2] >= 0 && c[b].push(u2[T2]);
              }
              l[b] = k;
            } else {
              if (s[b] === o[b]) {
                var A2 = [], S2 = [], C2 = 0;
                for (k = y.length - 1; k >= 0; --k) {
                  var E2 = y[k];
                  if (i[E2] = false, A2.push(E2), S2.push(c[E2]), C2 += c[E2].length, u2[E2] = d.length, E2 === b) {
                    y.length = k;
                    break;
                  }
                }
                d.push(A2);
                var F13 = new Array(C2);
                for (k = 0; k < S2.length; k++) for (var N2 = 0; N2 < S2[k].length; N2++) F13[--C2] = S2[k][N2];
                v.push(F13);
              }
              w.pop();
            }
          }
        }
        for (f = 0; f < a; ++f) o[f] < 0 && m(f);
        for (f = 0; f < v.length; f++) {
          var g = v[f];
          if (g.length !== 0) {
            g.sort(function(b, y) {
              return b - y;
            }), h = [g[0]];
            for (var x = 1; x < g.length; x++) g[x] !== g[x - 1] && h.push(g[x]);
            v[f] = h;
          }
        }
        return { components: d, adjacencyList: v };
      };
    }, {}], 307: [function(e, t, r) {
      "use strict";
      Object.defineProperty(r, "__esModule", { value: true });
      var n = function(l, u2) {
        if (Array.isArray(l)) return l;
        if (Symbol.iterator in Object(l)) return function(c, f) {
          var h = [], p = true, d = false, v = void 0;
          try {
            for (var m, g = c[Symbol.iterator](); !(p = (m = g.next()).done) && (h.push(m.value), !f || h.length !== f); p = true) ;
          } catch (x) {
            d = true, v = x;
          } finally {
            try {
              !p && g.return && g.return();
            } finally {
              if (d) throw v;
            }
          }
          return h;
        }(l, u2);
        throw new TypeError("Invalid attempt to destructure non-iterable instance");
      }, a = 2 * Math.PI, o = function(l, u2, c, f, h, p, d) {
        var v = l.x, m = l.y;
        return { x: f * (v *= u2) - h * (m *= c) + p, y: h * v + f * m + d };
      }, s = function(l, u2) {
        var c = u2 === 1.5707963267948966 ? 0.551915024494 : u2 === -1.5707963267948966 ? -0.551915024494 : 1.3333333333333333 * Math.tan(u2 / 4), f = Math.cos(l), h = Math.sin(l), p = Math.cos(l + u2), d = Math.sin(l + u2);
        return [{ x: f - h * c, y: h + f * c }, { x: p + d * c, y: d - p * c }, { x: p, y: d }];
      }, i = function(l, u2, c, f) {
        var h = l * c + u2 * f;
        return h > 1 && (h = 1), h < -1 && (h = -1), (l * f - u2 * c < 0 ? -1 : 1) * Math.acos(h);
      };
      r.default = function(l) {
        var u2 = l.px, c = l.py, f = l.cx, h = l.cy, p = l.rx, d = l.ry, v = l.xAxisRotation, m = v === void 0 ? 0 : v, g = l.largeArcFlag, x = g === void 0 ? 0 : g, b = l.sweepFlag, y = b === void 0 ? 0 : b, w = [];
        if (p === 0 || d === 0) return [];
        var _4 = Math.sin(m * a / 360), k = Math.cos(m * a / 360), T2 = k * (u2 - f) / 2 + _4 * (c - h) / 2, A2 = -_4 * (u2 - f) / 2 + k * (c - h) / 2;
        if (T2 === 0 && A2 === 0) return [];
        p = Math.abs(p), d = Math.abs(d);
        var S2 = Math.pow(T2, 2) / Math.pow(p, 2) + Math.pow(A2, 2) / Math.pow(d, 2);
        S2 > 1 && (p *= Math.sqrt(S2), d *= Math.sqrt(S2));
        var C2 = function(W2, X2, Y2, K2, q, re, R2, z, H2, te, j, Q2) {
          var Z2 = Math.pow(q, 2), ne = Math.pow(re, 2), ae = Math.pow(j, 2), ue = Math.pow(Q2, 2), le = Z2 * ne - Z2 * ue - ne * ae;
          le < 0 && (le = 0), le /= Z2 * ue + ne * ae;
          var ce = (le = Math.sqrt(le) * (R2 === z ? -1 : 1)) * q / re * Q2, se = le * -re / q * j, he = te * ce - H2 * se + (W2 + Y2) / 2, me = H2 * ce + te * se + (X2 + K2) / 2, we = (j - ce) / q, be = (Q2 - se) / re, Ae = (-j - ce) / q, pe = (-Q2 - se) / re, ve = i(1, 0, we, be), Ee = i(we, be, Ae, pe);
          return z === 0 && Ee > 0 && (Ee -= a), z === 1 && Ee < 0 && (Ee += a), [he, me, ve, Ee];
        }(u2, c, f, h, p, d, x, y, _4, k, T2, A2), E2 = n(C2, 4), F13 = E2[0], N2 = E2[1], D2 = E2[2], I2 = E2[3], O2 = Math.abs(I2) / (a / 4);
        Math.abs(1 - O2) < 1e-7 && (O2 = 1);
        var L2 = Math.max(Math.ceil(O2), 1);
        I2 /= L2;
        for (var V2 = 0; V2 < L2; V2++) w.push(s(D2, I2)), D2 += I2;
        return w.map(function(W2) {
          var X2 = o(W2[0], p, d, k, _4, F13, N2), Y2 = X2.x, K2 = X2.y, q = o(W2[1], p, d, k, _4, F13, N2), re = q.x, R2 = q.y, z = o(W2[2], p, d, k, _4, F13, N2);
          return { x1: Y2, y1: K2, x2: re, y2: R2, x: z.x, y: z.y };
        });
      }, t.exports = r.default;
    }, {}], 308: [function(e, t, r) {
      "use strict";
      var n = e("parse-svg-path"), a = e("abs-svg-path"), o = e("normalize-svg-path"), s = e("is-svg-path"), i = e("assert");
      t.exports = function(l) {
        if (Array.isArray(l) && l.length === 1 && typeof l[0] == "string" && (l = l[0]), typeof l == "string" && (i(s(l), "String is not an SVG path."), l = n(l)), i(Array.isArray(l), "Argument should be a string or an array of path segments."), l = a(l), !(l = o(l)).length) return [0, 0, 0, 0];
        for (var u2 = [1 / 0, 1 / 0, -1 / 0, -1 / 0], c = 0, f = l.length; c < f; c++) for (var h = l[c].slice(1), p = 0; p < h.length; p += 2) h[p + 0] < u2[0] && (u2[0] = h[p + 0]), h[p + 1] < u2[1] && (u2[1] = h[p + 1]), h[p + 0] > u2[2] && (u2[2] = h[p + 0]), h[p + 1] > u2[3] && (u2[3] = h[p + 1]);
        return u2;
      };
    }, { "abs-svg-path": 70, assert: 75, "is-svg-path": 238, "normalize-svg-path": 309, "parse-svg-path": 250 }], 309: [function(e, t, r) {
      "use strict";
      t.exports = function(s) {
        for (var i, l = [], u2 = 0, c = 0, f = 0, h = 0, p = null, d = null, v = 0, m = 0, g = 0, x = s.length; g < x; g++) {
          var b = s[g], y = b[0];
          switch (y) {
            case "M":
              f = b[1], h = b[2];
              break;
            case "A":
              var w = n({ px: v, py: m, cx: b[6], cy: b[7], rx: b[1], ry: b[2], xAxisRotation: b[3], largeArcFlag: b[4], sweepFlag: b[5] });
              if (!w.length) continue;
              for (var _4, k = 0; k < w.length; k++) _4 = w[k], b = ["C", _4.x1, _4.y1, _4.x2, _4.y2, _4.x, _4.y], k < w.length - 1 && l.push(b);
              break;
            case "S":
              var T2 = v, A2 = m;
              i != "C" && i != "S" || (T2 += T2 - u2, A2 += A2 - c), b = ["C", T2, A2, b[1], b[2], b[3], b[4]];
              break;
            case "T":
              i == "Q" || i == "T" ? (p = 2 * v - p, d = 2 * m - d) : (p = v, d = m), b = o(v, m, p, d, b[1], b[2]);
              break;
            case "Q":
              p = b[1], d = b[2], b = o(v, m, b[1], b[2], b[3], b[4]);
              break;
            case "L":
              b = a(v, m, b[1], b[2]);
              break;
            case "H":
              b = a(v, m, b[1], m);
              break;
            case "V":
              b = a(v, m, v, b[1]);
              break;
            case "Z":
              b = a(v, m, f, h);
          }
          i = y, v = b[b.length - 2], m = b[b.length - 1], b.length > 4 ? (u2 = b[b.length - 4], c = b[b.length - 3]) : (u2 = v, c = m), l.push(b);
        }
        return l;
      };
      var n = e("svg-arc-to-cubic-bezier");
      function a(s, i, l, u2) {
        return ["C", s, i, l, u2, l, u2];
      }
      function o(s, i, l, u2, c, f) {
        return ["C", s / 3 + 2 / 3 * l, i / 3 + 2 / 3 * u2, c / 3 + 2 / 3 * l, f / 3 + 2 / 3 * u2, c, f];
      }
    }, { "svg-arc-to-cubic-bezier": 307 }], 310: [function(e, t, r) {
      "use strict";
      var n, a = e("svg-path-bounds"), o = e("parse-svg-path"), s = e("draw-svg-path"), i = e("is-svg-path"), l = e("bitmap-sdf"), u2 = document.createElement("canvas"), c = u2.getContext("2d");
      t.exports = function(f, h) {
        if (!i(f)) throw Error("Argument should be valid svg path string");
        h || (h = {});
        var p, d;
        h.shape ? (p = h.shape[0], d = h.shape[1]) : (p = u2.width = h.w || h.width || 200, d = u2.height = h.h || h.height || 200);
        var v = Math.min(p, d), m = h.stroke || 0, g = h.viewbox || h.viewBox || a(f), x = [p / (g[2] - g[0]), d / (g[3] - g[1])], b = Math.min(x[0] || 0, x[1] || 0) / 2;
        if (c.fillStyle = "black", c.fillRect(0, 0, p, d), c.fillStyle = "white", m && (typeof m != "number" && (m = 1), c.strokeStyle = m > 0 ? "white" : "black", c.lineWidth = Math.abs(m)), c.translate(0.5 * p, 0.5 * d), c.scale(b, b), function() {
          if (n != null) return n;
          var _4 = document.createElement("canvas").getContext("2d");
          if (_4.canvas.width = _4.canvas.height = 1, !window.Path2D) return n = false;
          var k = new Path2D("M0,0h1v1h-1v-1Z");
          _4.fillStyle = "black", _4.fill(k);
          var T2 = _4.getImageData(0, 0, 1, 1);
          return n = T2 && T2.data && T2.data[3] === 255;
        }()) {
          var y = new Path2D(f);
          c.fill(y), m && c.stroke(y);
        } else {
          var w = o(f);
          s(c, w), c.fill(), m && c.stroke();
        }
        return c.setTransform(1, 0, 0, 1, 0, 0), l(c, { cutoff: h.cutoff != null ? h.cutoff : 0.5, radius: h.radius != null ? h.radius : 0.5 * v });
      };
    }, { "bitmap-sdf": 82, "draw-svg-path": 126, "is-svg-path": 238, "parse-svg-path": 250, "svg-path-bounds": 308 }], 311: [function(e, t, r) {
      (function(n, a) {
        (function() {
          var o = e("process/browser.js").nextTick, s = Function.prototype.apply, i = Array.prototype.slice, l = {}, u2 = 0;
          function c(f, h) {
            this._id = f, this._clearFn = h;
          }
          r.setTimeout = function() {
            return new c(s.call(setTimeout, window, arguments), clearTimeout);
          }, r.setInterval = function() {
            return new c(s.call(setInterval, window, arguments), clearInterval);
          }, r.clearTimeout = r.clearInterval = function(f) {
            f.close();
          }, c.prototype.unref = c.prototype.ref = function() {
          }, c.prototype.close = function() {
            this._clearFn.call(window, this._id);
          }, r.enroll = function(f, h) {
            clearTimeout(f._idleTimeoutId), f._idleTimeout = h;
          }, r.unenroll = function(f) {
            clearTimeout(f._idleTimeoutId), f._idleTimeout = -1;
          }, r._unrefActive = r.active = function(f) {
            clearTimeout(f._idleTimeoutId);
            var h = f._idleTimeout;
            h >= 0 && (f._idleTimeoutId = setTimeout(function() {
              f._onTimeout && f._onTimeout();
            }, h));
          }, r.setImmediate = typeof n == "function" ? n : function(f) {
            var h = u2++, p = !(arguments.length < 2) && i.call(arguments, 1);
            return l[h] = true, o(function() {
              l[h] && (p ? f.apply(null, p) : f.call(null), r.clearImmediate(h));
            }), h;
          }, r.clearImmediate = typeof a == "function" ? a : function(f) {
            delete l[f];
          };
        }).call(this);
      }).call(this, e("timers").setImmediate, e("timers").clearImmediate);
    }, { "process/browser.js": 277, timers: 311 }], 312: [function(e, t, r) {
      (function(n) {
        var a = /^\s+/, o = /\s+$/, s = 0, i = n.round, l = n.min, u2 = n.max, c = n.random;
        function f(H2, te) {
          if (te = te || {}, (H2 = H2 || "") instanceof f) return H2;
          if (!(this instanceof f)) return new f(H2, te);
          var j = function(Q2) {
            var Z2 = { r: 0, g: 0, b: 0 }, ne = 1, ae = null, ue = null, le = null, ce = false, se = false;
            typeof Q2 == "string" && (Q2 = function(be) {
              be = be.replace(a, "").replace(o, "").toLowerCase();
              var Ae, pe = false;
              if (F13[be]) be = F13[be], pe = true;
              else if (be == "transparent") return { r: 0, g: 0, b: 0, a: 0, format: "name" };
              return (Ae = R2.rgb.exec(be)) ? { r: Ae[1], g: Ae[2], b: Ae[3] } : (Ae = R2.rgba.exec(be)) ? { r: Ae[1], g: Ae[2], b: Ae[3], a: Ae[4] } : (Ae = R2.hsl.exec(be)) ? { h: Ae[1], s: Ae[2], l: Ae[3] } : (Ae = R2.hsla.exec(be)) ? { h: Ae[1], s: Ae[2], l: Ae[3], a: Ae[4] } : (Ae = R2.hsv.exec(be)) ? { h: Ae[1], s: Ae[2], v: Ae[3] } : (Ae = R2.hsva.exec(be)) ? { h: Ae[1], s: Ae[2], v: Ae[3], a: Ae[4] } : (Ae = R2.hex8.exec(be)) ? { r: L2(Ae[1]), g: L2(Ae[2]), b: L2(Ae[3]), a: Y2(Ae[4]), format: pe ? "name" : "hex8" } : (Ae = R2.hex6.exec(be)) ? { r: L2(Ae[1]), g: L2(Ae[2]), b: L2(Ae[3]), format: pe ? "name" : "hex" } : (Ae = R2.hex4.exec(be)) ? { r: L2(Ae[1] + "" + Ae[1]), g: L2(Ae[2] + "" + Ae[2]), b: L2(Ae[3] + "" + Ae[3]), a: Y2(Ae[4] + "" + Ae[4]), format: pe ? "name" : "hex8" } : (Ae = R2.hex3.exec(be)) ? { r: L2(Ae[1] + "" + Ae[1]), g: L2(Ae[2] + "" + Ae[2]), b: L2(Ae[3] + "" + Ae[3]), format: pe ? "name" : "hex" } : false;
            }(Q2)), typeof Q2 == "object" && (z(Q2.r) && z(Q2.g) && z(Q2.b) ? (he = Q2.r, me = Q2.g, we = Q2.b, Z2 = { r: 255 * I2(he, 255), g: 255 * I2(me, 255), b: 255 * I2(we, 255) }, ce = true, se = String(Q2.r).substr(-1) === "%" ? "prgb" : "rgb") : z(Q2.h) && z(Q2.s) && z(Q2.v) ? (ae = W2(Q2.s), ue = W2(Q2.v), Z2 = function(be, Ae, pe) {
              be = 6 * I2(be, 360), Ae = I2(Ae, 100), pe = I2(pe, 100);
              var ve = n.floor(be), Ee = be - ve, Se = pe * (1 - Ae), Ce = pe * (1 - Ee * Ae), Be = pe * (1 - (1 - Ee) * Ae), Ue = ve % 6;
              return { r: 255 * [pe, Ce, Se, Se, Be, pe][Ue], g: 255 * [Be, pe, pe, Ce, Se, Se][Ue], b: 255 * [Se, Se, Be, pe, pe, Ce][Ue] };
            }(Q2.h, ae, ue), ce = true, se = "hsv") : z(Q2.h) && z(Q2.s) && z(Q2.l) && (ae = W2(Q2.s), le = W2(Q2.l), Z2 = function(be, Ae, pe) {
              var ve, Ee, Se;
              function Ce(Ke, ct, We) {
                return We < 0 && (We += 1), We > 1 && (We -= 1), We < 1 / 6 ? Ke + 6 * (ct - Ke) * We : We < 0.5 ? ct : We < 2 / 3 ? Ke + (ct - Ke) * (2 / 3 - We) * 6 : Ke;
              }
              if (be = I2(be, 360), Ae = I2(Ae, 100), pe = I2(pe, 100), Ae === 0) ve = Ee = Se = pe;
              else {
                var Be = pe < 0.5 ? pe * (1 + Ae) : pe + Ae - pe * Ae, Ue = 2 * pe - Be;
                ve = Ce(Ue, Be, be + 1 / 3), Ee = Ce(Ue, Be, be), Se = Ce(Ue, Be, be - 1 / 3);
              }
              return { r: 255 * ve, g: 255 * Ee, b: 255 * Se };
            }(Q2.h, ae, le), ce = true, se = "hsl"), Q2.hasOwnProperty("a") && (ne = Q2.a));
            var he, me, we;
            return ne = D2(ne), { ok: ce, format: Q2.format || se, r: l(255, u2(Z2.r, 0)), g: l(255, u2(Z2.g, 0)), b: l(255, u2(Z2.b, 0)), a: ne };
          }(H2);
          this._originalInput = H2, this._r = j.r, this._g = j.g, this._b = j.b, this._a = j.a, this._roundA = i(100 * this._a) / 100, this._format = te.format || j.format, this._gradientType = te.gradientType, this._r < 1 && (this._r = i(this._r)), this._g < 1 && (this._g = i(this._g)), this._b < 1 && (this._b = i(this._b)), this._ok = j.ok, this._tc_id = s++;
        }
        function h(H2, te, j) {
          H2 = I2(H2, 255), te = I2(te, 255), j = I2(j, 255);
          var Q2, Z2, ne = u2(H2, te, j), ae = l(H2, te, j), ue = (ne + ae) / 2;
          if (ne == ae) Q2 = Z2 = 0;
          else {
            var le = ne - ae;
            switch (Z2 = ue > 0.5 ? le / (2 - ne - ae) : le / (ne + ae), ne) {
              case H2:
                Q2 = (te - j) / le + (te < j ? 6 : 0);
                break;
              case te:
                Q2 = (j - H2) / le + 2;
                break;
              case j:
                Q2 = (H2 - te) / le + 4;
            }
            Q2 /= 6;
          }
          return { h: Q2, s: Z2, l: ue };
        }
        function p(H2, te, j) {
          H2 = I2(H2, 255), te = I2(te, 255), j = I2(j, 255);
          var Q2, Z2, ne = u2(H2, te, j), ae = l(H2, te, j), ue = ne, le = ne - ae;
          if (Z2 = ne === 0 ? 0 : le / ne, ne == ae) Q2 = 0;
          else {
            switch (ne) {
              case H2:
                Q2 = (te - j) / le + (te < j ? 6 : 0);
                break;
              case te:
                Q2 = (j - H2) / le + 2;
                break;
              case j:
                Q2 = (H2 - te) / le + 4;
            }
            Q2 /= 6;
          }
          return { h: Q2, s: Z2, v: ue };
        }
        function d(H2, te, j, Q2) {
          var Z2 = [V2(i(H2).toString(16)), V2(i(te).toString(16)), V2(i(j).toString(16))];
          return Q2 && Z2[0].charAt(0) == Z2[0].charAt(1) && Z2[1].charAt(0) == Z2[1].charAt(1) && Z2[2].charAt(0) == Z2[2].charAt(1) ? Z2[0].charAt(0) + Z2[1].charAt(0) + Z2[2].charAt(0) : Z2.join("");
        }
        function v(H2, te, j, Q2) {
          return [V2(X2(Q2)), V2(i(H2).toString(16)), V2(i(te).toString(16)), V2(i(j).toString(16))].join("");
        }
        function m(H2, te) {
          te = te === 0 ? 0 : te || 10;
          var j = f(H2).toHsl();
          return j.s -= te / 100, j.s = O2(j.s), f(j);
        }
        function g(H2, te) {
          te = te === 0 ? 0 : te || 10;
          var j = f(H2).toHsl();
          return j.s += te / 100, j.s = O2(j.s), f(j);
        }
        function x(H2) {
          return f(H2).desaturate(100);
        }
        function b(H2, te) {
          te = te === 0 ? 0 : te || 10;
          var j = f(H2).toHsl();
          return j.l += te / 100, j.l = O2(j.l), f(j);
        }
        function y(H2, te) {
          te = te === 0 ? 0 : te || 10;
          var j = f(H2).toRgb();
          return j.r = u2(0, l(255, j.r - i(-te / 100 * 255))), j.g = u2(0, l(255, j.g - i(-te / 100 * 255))), j.b = u2(0, l(255, j.b - i(-te / 100 * 255))), f(j);
        }
        function w(H2, te) {
          te = te === 0 ? 0 : te || 10;
          var j = f(H2).toHsl();
          return j.l -= te / 100, j.l = O2(j.l), f(j);
        }
        function _4(H2, te) {
          var j = f(H2).toHsl(), Q2 = (j.h + te) % 360;
          return j.h = Q2 < 0 ? 360 + Q2 : Q2, f(j);
        }
        function k(H2) {
          var te = f(H2).toHsl();
          return te.h = (te.h + 180) % 360, f(te);
        }
        function T2(H2) {
          var te = f(H2).toHsl(), j = te.h;
          return [f(H2), f({ h: (j + 120) % 360, s: te.s, l: te.l }), f({ h: (j + 240) % 360, s: te.s, l: te.l })];
        }
        function A2(H2) {
          var te = f(H2).toHsl(), j = te.h;
          return [f(H2), f({ h: (j + 90) % 360, s: te.s, l: te.l }), f({ h: (j + 180) % 360, s: te.s, l: te.l }), f({ h: (j + 270) % 360, s: te.s, l: te.l })];
        }
        function S2(H2) {
          var te = f(H2).toHsl(), j = te.h;
          return [f(H2), f({ h: (j + 72) % 360, s: te.s, l: te.l }), f({ h: (j + 216) % 360, s: te.s, l: te.l })];
        }
        function C2(H2, te, j) {
          te = te || 6, j = j || 30;
          var Q2 = f(H2).toHsl(), Z2 = 360 / j, ne = [f(H2)];
          for (Q2.h = (Q2.h - (Z2 * te >> 1) + 720) % 360; --te; ) Q2.h = (Q2.h + Z2) % 360, ne.push(f(Q2));
          return ne;
        }
        function E2(H2, te) {
          te = te || 6;
          for (var j = f(H2).toHsv(), Q2 = j.h, Z2 = j.s, ne = j.v, ae = [], ue = 1 / te; te--; ) ae.push(f({ h: Q2, s: Z2, v: ne })), ne = (ne + ue) % 1;
          return ae;
        }
        f.prototype = { isDark: function() {
          return this.getBrightness() < 128;
        }, isLight: function() {
          return !this.isDark();
        }, isValid: function() {
          return this._ok;
        }, getOriginalInput: function() {
          return this._originalInput;
        }, getFormat: function() {
          return this._format;
        }, getAlpha: function() {
          return this._a;
        }, getBrightness: function() {
          var H2 = this.toRgb();
          return (299 * H2.r + 587 * H2.g + 114 * H2.b) / 1e3;
        }, getLuminance: function() {
          var H2, te, j, Q2 = this.toRgb();
          return H2 = Q2.r / 255, te = Q2.g / 255, j = Q2.b / 255, 0.2126 * (H2 <= 0.03928 ? H2 / 12.92 : n.pow((H2 + 0.055) / 1.055, 2.4)) + 0.7152 * (te <= 0.03928 ? te / 12.92 : n.pow((te + 0.055) / 1.055, 2.4)) + 0.0722 * (j <= 0.03928 ? j / 12.92 : n.pow((j + 0.055) / 1.055, 2.4));
        }, setAlpha: function(H2) {
          return this._a = D2(H2), this._roundA = i(100 * this._a) / 100, this;
        }, toHsv: function() {
          var H2 = p(this._r, this._g, this._b);
          return { h: 360 * H2.h, s: H2.s, v: H2.v, a: this._a };
        }, toHsvString: function() {
          var H2 = p(this._r, this._g, this._b), te = i(360 * H2.h), j = i(100 * H2.s), Q2 = i(100 * H2.v);
          return this._a == 1 ? "hsv(" + te + ", " + j + "%, " + Q2 + "%)" : "hsva(" + te + ", " + j + "%, " + Q2 + "%, " + this._roundA + ")";
        }, toHsl: function() {
          var H2 = h(this._r, this._g, this._b);
          return { h: 360 * H2.h, s: H2.s, l: H2.l, a: this._a };
        }, toHslString: function() {
          var H2 = h(this._r, this._g, this._b), te = i(360 * H2.h), j = i(100 * H2.s), Q2 = i(100 * H2.l);
          return this._a == 1 ? "hsl(" + te + ", " + j + "%, " + Q2 + "%)" : "hsla(" + te + ", " + j + "%, " + Q2 + "%, " + this._roundA + ")";
        }, toHex: function(H2) {
          return d(this._r, this._g, this._b, H2);
        }, toHexString: function(H2) {
          return "#" + this.toHex(H2);
        }, toHex8: function(H2) {
          return function(te, j, Q2, Z2, ne) {
            var ae = [V2(i(te).toString(16)), V2(i(j).toString(16)), V2(i(Q2).toString(16)), V2(X2(Z2))];
            return ne && ae[0].charAt(0) == ae[0].charAt(1) && ae[1].charAt(0) == ae[1].charAt(1) && ae[2].charAt(0) == ae[2].charAt(1) && ae[3].charAt(0) == ae[3].charAt(1) ? ae[0].charAt(0) + ae[1].charAt(0) + ae[2].charAt(0) + ae[3].charAt(0) : ae.join("");
          }(this._r, this._g, this._b, this._a, H2);
        }, toHex8String: function(H2) {
          return "#" + this.toHex8(H2);
        }, toRgb: function() {
          return { r: i(this._r), g: i(this._g), b: i(this._b), a: this._a };
        }, toRgbString: function() {
          return this._a == 1 ? "rgb(" + i(this._r) + ", " + i(this._g) + ", " + i(this._b) + ")" : "rgba(" + i(this._r) + ", " + i(this._g) + ", " + i(this._b) + ", " + this._roundA + ")";
        }, toPercentageRgb: function() {
          return { r: i(100 * I2(this._r, 255)) + "%", g: i(100 * I2(this._g, 255)) + "%", b: i(100 * I2(this._b, 255)) + "%", a: this._a };
        }, toPercentageRgbString: function() {
          return this._a == 1 ? "rgb(" + i(100 * I2(this._r, 255)) + "%, " + i(100 * I2(this._g, 255)) + "%, " + i(100 * I2(this._b, 255)) + "%)" : "rgba(" + i(100 * I2(this._r, 255)) + "%, " + i(100 * I2(this._g, 255)) + "%, " + i(100 * I2(this._b, 255)) + "%, " + this._roundA + ")";
        }, toName: function() {
          return this._a === 0 ? "transparent" : !(this._a < 1) && (N2[d(this._r, this._g, this._b, true)] || false);
        }, toFilter: function(H2) {
          var te = "#" + v(this._r, this._g, this._b, this._a), j = te, Q2 = this._gradientType ? "GradientType = 1, " : "";
          if (H2) {
            var Z2 = f(H2);
            j = "#" + v(Z2._r, Z2._g, Z2._b, Z2._a);
          }
          return "progid:DXImageTransform.Microsoft.gradient(" + Q2 + "startColorstr=" + te + ",endColorstr=" + j + ")";
        }, toString: function(H2) {
          var te = !!H2;
          H2 = H2 || this._format;
          var j = false, Q2 = this._a < 1 && this._a >= 0;
          return te || !Q2 || H2 !== "hex" && H2 !== "hex6" && H2 !== "hex3" && H2 !== "hex4" && H2 !== "hex8" && H2 !== "name" ? (H2 === "rgb" && (j = this.toRgbString()), H2 === "prgb" && (j = this.toPercentageRgbString()), H2 !== "hex" && H2 !== "hex6" || (j = this.toHexString()), H2 === "hex3" && (j = this.toHexString(true)), H2 === "hex4" && (j = this.toHex8String(true)), H2 === "hex8" && (j = this.toHex8String()), H2 === "name" && (j = this.toName()), H2 === "hsl" && (j = this.toHslString()), H2 === "hsv" && (j = this.toHsvString()), j || this.toHexString()) : H2 === "name" && this._a === 0 ? this.toName() : this.toRgbString();
        }, clone: function() {
          return f(this.toString());
        }, _applyModification: function(H2, te) {
          var j = H2.apply(null, [this].concat([].slice.call(te)));
          return this._r = j._r, this._g = j._g, this._b = j._b, this.setAlpha(j._a), this;
        }, lighten: function() {
          return this._applyModification(b, arguments);
        }, brighten: function() {
          return this._applyModification(y, arguments);
        }, darken: function() {
          return this._applyModification(w, arguments);
        }, desaturate: function() {
          return this._applyModification(m, arguments);
        }, saturate: function() {
          return this._applyModification(g, arguments);
        }, greyscale: function() {
          return this._applyModification(x, arguments);
        }, spin: function() {
          return this._applyModification(_4, arguments);
        }, _applyCombination: function(H2, te) {
          return H2.apply(null, [this].concat([].slice.call(te)));
        }, analogous: function() {
          return this._applyCombination(C2, arguments);
        }, complement: function() {
          return this._applyCombination(k, arguments);
        }, monochromatic: function() {
          return this._applyCombination(E2, arguments);
        }, splitcomplement: function() {
          return this._applyCombination(S2, arguments);
        }, triad: function() {
          return this._applyCombination(T2, arguments);
        }, tetrad: function() {
          return this._applyCombination(A2, arguments);
        } }, f.fromRatio = function(H2, te) {
          if (typeof H2 == "object") {
            var j = {};
            for (var Q2 in H2) H2.hasOwnProperty(Q2) && (j[Q2] = Q2 === "a" ? H2[Q2] : W2(H2[Q2]));
            H2 = j;
          }
          return f(H2, te);
        }, f.equals = function(H2, te) {
          return !(!H2 || !te) && f(H2).toRgbString() == f(te).toRgbString();
        }, f.random = function() {
          return f.fromRatio({ r: c(), g: c(), b: c() });
        }, f.mix = function(H2, te, j) {
          j = j === 0 ? 0 : j || 50;
          var Q2 = f(H2).toRgb(), Z2 = f(te).toRgb(), ne = j / 100;
          return f({ r: (Z2.r - Q2.r) * ne + Q2.r, g: (Z2.g - Q2.g) * ne + Q2.g, b: (Z2.b - Q2.b) * ne + Q2.b, a: (Z2.a - Q2.a) * ne + Q2.a });
        }, f.readability = function(H2, te) {
          var j = f(H2), Q2 = f(te);
          return (n.max(j.getLuminance(), Q2.getLuminance()) + 0.05) / (n.min(j.getLuminance(), Q2.getLuminance()) + 0.05);
        }, f.isReadable = function(H2, te, j) {
          var Q2, Z2, ne = f.readability(H2, te);
          switch (Z2 = false, (Q2 = function(ae) {
            var ue, le;
            return ue = ((ae = ae || { level: "AA", size: "small" }).level || "AA").toUpperCase(), le = (ae.size || "small").toLowerCase(), ue !== "AA" && ue !== "AAA" && (ue = "AA"), le !== "small" && le !== "large" && (le = "small"), { level: ue, size: le };
          }(j)).level + Q2.size) {
            case "AAsmall":
            case "AAAlarge":
              Z2 = ne >= 4.5;
              break;
            case "AAlarge":
              Z2 = ne >= 3;
              break;
            case "AAAsmall":
              Z2 = ne >= 7;
          }
          return Z2;
        }, f.mostReadable = function(H2, te, j) {
          var Q2, Z2, ne, ae, ue = null, le = 0;
          Z2 = (j = j || {}).includeFallbackColors, ne = j.level, ae = j.size;
          for (var ce = 0; ce < te.length; ce++) (Q2 = f.readability(H2, te[ce])) > le && (le = Q2, ue = f(te[ce]));
          return f.isReadable(H2, ue, { level: ne, size: ae }) || !Z2 ? ue : (j.includeFallbackColors = false, f.mostReadable(H2, ["#fff", "#000"], j));
        };
        var F13 = f.names = { aliceblue: "f0f8ff", antiquewhite: "faebd7", aqua: "0ff", aquamarine: "7fffd4", azure: "f0ffff", beige: "f5f5dc", bisque: "ffe4c4", black: "000", blanchedalmond: "ffebcd", blue: "00f", blueviolet: "8a2be2", brown: "a52a2a", burlywood: "deb887", burntsienna: "ea7e5d", cadetblue: "5f9ea0", chartreuse: "7fff00", chocolate: "d2691e", coral: "ff7f50", cornflowerblue: "6495ed", cornsilk: "fff8dc", crimson: "dc143c", cyan: "0ff", darkblue: "00008b", darkcyan: "008b8b", darkgoldenrod: "b8860b", darkgray: "a9a9a9", darkgreen: "006400", darkgrey: "a9a9a9", darkkhaki: "bdb76b", darkmagenta: "8b008b", darkolivegreen: "556b2f", darkorange: "ff8c00", darkorchid: "9932cc", darkred: "8b0000", darksalmon: "e9967a", darkseagreen: "8fbc8f", darkslateblue: "483d8b", darkslategray: "2f4f4f", darkslategrey: "2f4f4f", darkturquoise: "00ced1", darkviolet: "9400d3", deeppink: "ff1493", deepskyblue: "00bfff", dimgray: "696969", dimgrey: "696969", dodgerblue: "1e90ff", firebrick: "b22222", floralwhite: "fffaf0", forestgreen: "228b22", fuchsia: "f0f", gainsboro: "dcdcdc", ghostwhite: "f8f8ff", gold: "ffd700", goldenrod: "daa520", gray: "808080", green: "008000", greenyellow: "adff2f", grey: "808080", honeydew: "f0fff0", hotpink: "ff69b4", indianred: "cd5c5c", indigo: "4b0082", ivory: "fffff0", khaki: "f0e68c", lavender: "e6e6fa", lavenderblush: "fff0f5", lawngreen: "7cfc00", lemonchiffon: "fffacd", lightblue: "add8e6", lightcoral: "f08080", lightcyan: "e0ffff", lightgoldenrodyellow: "fafad2", lightgray: "d3d3d3", lightgreen: "90ee90", lightgrey: "d3d3d3", lightpink: "ffb6c1", lightsalmon: "ffa07a", lightseagreen: "20b2aa", lightskyblue: "87cefa", lightslategray: "789", lightslategrey: "789", lightsteelblue: "b0c4de", lightyellow: "ffffe0", lime: "0f0", limegreen: "32cd32", linen: "faf0e6", magenta: "f0f", maroon: "800000", mediumaquamarine: "66cdaa", mediumblue: "0000cd", mediumorchid: "ba55d3", mediumpurple: "9370db", mediumseagreen: "3cb371", mediumslateblue: "7b68ee", mediumspringgreen: "00fa9a", mediumturquoise: "48d1cc", mediumvioletred: "c71585", midnightblue: "191970", mintcream: "f5fffa", mistyrose: "ffe4e1", moccasin: "ffe4b5", navajowhite: "ffdead", navy: "000080", oldlace: "fdf5e6", olive: "808000", olivedrab: "6b8e23", orange: "ffa500", orangered: "ff4500", orchid: "da70d6", palegoldenrod: "eee8aa", palegreen: "98fb98", paleturquoise: "afeeee", palevioletred: "db7093", papayawhip: "ffefd5", peachpuff: "ffdab9", peru: "cd853f", pink: "ffc0cb", plum: "dda0dd", powderblue: "b0e0e6", purple: "800080", rebeccapurple: "663399", red: "f00", rosybrown: "bc8f8f", royalblue: "4169e1", saddlebrown: "8b4513", salmon: "fa8072", sandybrown: "f4a460", seagreen: "2e8b57", seashell: "fff5ee", sienna: "a0522d", silver: "c0c0c0", skyblue: "87ceeb", slateblue: "6a5acd", slategray: "708090", slategrey: "708090", snow: "fffafa", springgreen: "00ff7f", steelblue: "4682b4", tan: "d2b48c", teal: "008080", thistle: "d8bfd8", tomato: "ff6347", turquoise: "40e0d0", violet: "ee82ee", wheat: "f5deb3", white: "fff", whitesmoke: "f5f5f5", yellow: "ff0", yellowgreen: "9acd32" }, N2 = f.hexNames = function(H2) {
          var te = {};
          for (var j in H2) H2.hasOwnProperty(j) && (te[H2[j]] = j);
          return te;
        }(F13);
        function D2(H2) {
          return H2 = parseFloat(H2), (isNaN(H2) || H2 < 0 || H2 > 1) && (H2 = 1), H2;
        }
        function I2(H2, te) {
          (function(Q2) {
            return typeof Q2 == "string" && Q2.indexOf(".") != -1 && parseFloat(Q2) === 1;
          })(H2) && (H2 = "100%");
          var j = function(Q2) {
            return typeof Q2 == "string" && Q2.indexOf("%") != -1;
          }(H2);
          return H2 = l(te, u2(0, parseFloat(H2))), j && (H2 = parseInt(H2 * te, 10) / 100), n.abs(H2 - te) < 1e-6 ? 1 : H2 % te / parseFloat(te);
        }
        function O2(H2) {
          return l(1, u2(0, H2));
        }
        function L2(H2) {
          return parseInt(H2, 16);
        }
        function V2(H2) {
          return H2.length == 1 ? "0" + H2 : "" + H2;
        }
        function W2(H2) {
          return H2 <= 1 && (H2 = 100 * H2 + "%"), H2;
        }
        function X2(H2) {
          return n.round(255 * parseFloat(H2)).toString(16);
        }
        function Y2(H2) {
          return L2(H2) / 255;
        }
        var K2, q, re, R2 = (q = "[\\s|\\(]+(" + (K2 = "(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)") + ")[,|\\s]+(" + K2 + ")[,|\\s]+(" + K2 + ")\\s*\\)?", re = "[\\s|\\(]+(" + K2 + ")[,|\\s]+(" + K2 + ")[,|\\s]+(" + K2 + ")[,|\\s]+(" + K2 + ")\\s*\\)?", { CSS_UNIT: new RegExp(K2), rgb: new RegExp("rgb" + q), rgba: new RegExp("rgba" + re), hsl: new RegExp("hsl" + q), hsla: new RegExp("hsla" + re), hsv: new RegExp("hsv" + q), hsva: new RegExp("hsva" + re), hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/, hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/ });
        function z(H2) {
          return !!R2.CSS_UNIT.exec(H2);
        }
        t !== void 0 && t.exports ? t.exports = f : window.tinycolor = f;
      })(Math);
    }, {}], 313: [function(e, t, r) {
      "use strict";
      t.exports = a, t.exports.float32 = t.exports.float = a, t.exports.fract32 = t.exports.fract = function(o, s) {
        if (o.length) {
          if (o instanceof Float32Array) return new Float32Array(o.length);
          s instanceof Float32Array || (s = a(o));
          for (var i = 0, l = s.length; i < l; i++) s[i] = o[i] - s[i];
          return s;
        }
        return a(o - a(o));
      };
      var n = new Float32Array(1);
      function a(o) {
        return o.length ? o instanceof Float32Array ? o : new Float32Array(o) : (n[0] = o, n[0]);
      }
    }, {}], 314: [function(e, t, r) {
      "use strict";
      var n = e("parse-unit");
      t.exports = o;
      function a(s, i) {
        var l = n(getComputedStyle(s).getPropertyValue(i));
        return l[0] * o(l[1], s);
      }
      function o(s, i) {
        switch (i = i || document.body, s = (s || "px").trim().toLowerCase(), i !== window && i !== document || (i = document.body), s) {
          case "%":
            return i.clientHeight / 100;
          case "ch":
          case "ex":
            return function(l, u2) {
              var c = document.createElement("div");
              c.style["font-size"] = "128" + l, u2.appendChild(c);
              var f = a(c, "font-size") / 128;
              return u2.removeChild(c), f;
            }(s, i);
          case "em":
            return a(i, "font-size");
          case "rem":
            return a(document.body, "font-size");
          case "vw":
            return window.innerWidth / 100;
          case "vh":
            return window.innerHeight / 100;
          case "vmin":
            return Math.min(window.innerWidth, window.innerHeight) / 100;
          case "vmax":
            return Math.max(window.innerWidth, window.innerHeight) / 100;
          case "in":
            return 96;
          case "cm":
            return 96 / 2.54;
          case "mm":
            return 96 / 25.4;
          case "pt":
            return 96 / 72;
          case "pc":
            return 16;
        }
        return 1;
      }
    }, { "parse-unit": 251 }], 315: [function(e, t, r) {
      (function(n, a) {
        a(typeof r == "object" && t !== void 0 ? r : (n = n || self).topojson = n.topojson || {});
      })(this, function(n) {
        "use strict";
        function a(v) {
          return v;
        }
        function o(v) {
          if (v == null) return a;
          var m, g, x = v.scale[0], b = v.scale[1], y = v.translate[0], w = v.translate[1];
          return function(_4, k) {
            k || (m = g = 0);
            var T2 = 2, A2 = _4.length, S2 = new Array(A2);
            for (S2[0] = (m += _4[0]) * x + y, S2[1] = (g += _4[1]) * b + w; T2 < A2; ) S2[T2] = _4[T2], ++T2;
            return S2;
          };
        }
        function s(v) {
          var m, g = o(v.transform), x = 1 / 0, b = x, y = -x, w = -x;
          function _4(T2) {
            (T2 = g(T2))[0] < x && (x = T2[0]), T2[0] > y && (y = T2[0]), T2[1] < b && (b = T2[1]), T2[1] > w && (w = T2[1]);
          }
          function k(T2) {
            switch (T2.type) {
              case "GeometryCollection":
                T2.geometries.forEach(k);
                break;
              case "Point":
                _4(T2.coordinates);
                break;
              case "MultiPoint":
                T2.coordinates.forEach(_4);
            }
          }
          for (m in v.arcs.forEach(function(T2) {
            for (var A2, S2 = -1, C2 = T2.length; ++S2 < C2; ) (A2 = g(T2[S2], S2))[0] < x && (x = A2[0]), A2[0] > y && (y = A2[0]), A2[1] < b && (b = A2[1]), A2[1] > w && (w = A2[1]);
          }), v.objects) k(v.objects[m]);
          return [x, b, y, w];
        }
        function i(v, m) {
          var g = m.id, x = m.bbox, b = m.properties == null ? {} : m.properties, y = l(v, m);
          return g == null && x == null ? { type: "Feature", properties: b, geometry: y } : x == null ? { type: "Feature", id: g, properties: b, geometry: y } : { type: "Feature", id: g, bbox: x, properties: b, geometry: y };
        }
        function l(v, m) {
          var g = o(v.transform), x = v.arcs;
          function b(T2, A2) {
            A2.length && A2.pop();
            for (var S2 = x[T2 < 0 ? ~T2 : T2], C2 = 0, E2 = S2.length; C2 < E2; ++C2) A2.push(g(S2[C2], C2));
            T2 < 0 && function(F13, N2) {
              for (var D2, I2 = F13.length, O2 = I2 - N2; O2 < --I2; ) D2 = F13[O2], F13[O2++] = F13[I2], F13[I2] = D2;
            }(A2, E2);
          }
          function y(T2) {
            return g(T2);
          }
          function w(T2) {
            for (var A2 = [], S2 = 0, C2 = T2.length; S2 < C2; ++S2) b(T2[S2], A2);
            return A2.length < 2 && A2.push(A2[0]), A2;
          }
          function _4(T2) {
            for (var A2 = w(T2); A2.length < 4; ) A2.push(A2[0]);
            return A2;
          }
          function k(T2) {
            return T2.map(_4);
          }
          return function T2(A2) {
            var S2, C2 = A2.type;
            switch (C2) {
              case "GeometryCollection":
                return { type: C2, geometries: A2.geometries.map(T2) };
              case "Point":
                S2 = y(A2.coordinates);
                break;
              case "MultiPoint":
                S2 = A2.coordinates.map(y);
                break;
              case "LineString":
                S2 = w(A2.arcs);
                break;
              case "MultiLineString":
                S2 = A2.arcs.map(w);
                break;
              case "Polygon":
                S2 = k(A2.arcs);
                break;
              case "MultiPolygon":
                S2 = A2.arcs.map(k);
                break;
              default:
                return null;
            }
            return { type: C2, coordinates: S2 };
          }(m);
        }
        function u2(v, m) {
          var g = {}, x = {}, b = {}, y = [], w = -1;
          function _4(k, T2) {
            for (var A2 in k) {
              var S2 = k[A2];
              delete T2[S2.start], delete S2.start, delete S2.end, S2.forEach(function(C2) {
                g[C2 < 0 ? ~C2 : C2] = 1;
              }), y.push(S2);
            }
          }
          return m.forEach(function(k, T2) {
            var A2, S2 = v.arcs[k < 0 ? ~k : k];
            S2.length < 3 && !S2[1][0] && !S2[1][1] && (A2 = m[++w], m[w] = k, m[T2] = A2);
          }), m.forEach(function(k) {
            var T2, A2, S2 = function(D2) {
              var I2, O2 = v.arcs[D2 < 0 ? ~D2 : D2], L2 = O2[0];
              return v.transform ? (I2 = [0, 0], O2.forEach(function(V2) {
                I2[0] += V2[0], I2[1] += V2[1];
              })) : I2 = O2[O2.length - 1], D2 < 0 ? [I2, L2] : [L2, I2];
            }(k), C2 = S2[0], E2 = S2[1];
            if (T2 = b[C2]) if (delete b[T2.end], T2.push(k), T2.end = E2, A2 = x[E2]) {
              delete x[A2.start];
              var F13 = A2 === T2 ? T2 : T2.concat(A2);
              x[F13.start = T2.start] = b[F13.end = A2.end] = F13;
            } else x[T2.start] = b[T2.end] = T2;
            else if (T2 = x[E2]) if (delete x[T2.start], T2.unshift(k), T2.start = C2, A2 = b[C2]) {
              delete b[A2.end];
              var N2 = A2 === T2 ? T2 : A2.concat(T2);
              x[N2.start = A2.start] = b[N2.end = T2.end] = N2;
            } else x[T2.start] = b[T2.end] = T2;
            else x[(T2 = [k]).start = C2] = b[T2.end = E2] = T2;
          }), _4(b, x), _4(x, b), m.forEach(function(k) {
            g[k < 0 ? ~k : k] || y.push([k]);
          }), y;
        }
        function c(v, m, g) {
          var x, b, y;
          if (arguments.length > 1) x = f(v, m, g);
          else for (b = 0, x = new Array(y = v.arcs.length); b < y; ++b) x[b] = b;
          return { type: "MultiLineString", arcs: u2(v, x) };
        }
        function f(v, m, g) {
          var x, b = [], y = [];
          function w(T2) {
            var A2 = T2 < 0 ? ~T2 : T2;
            (y[A2] || (y[A2] = [])).push({ i: T2, g: x });
          }
          function _4(T2) {
            T2.forEach(w);
          }
          function k(T2) {
            T2.forEach(_4);
          }
          return function T2(A2) {
            switch (x = A2, A2.type) {
              case "GeometryCollection":
                A2.geometries.forEach(T2);
                break;
              case "LineString":
                _4(A2.arcs);
                break;
              case "MultiLineString":
              case "Polygon":
                k(A2.arcs);
                break;
              case "MultiPolygon":
                (function(S2) {
                  S2.forEach(k);
                })(A2.arcs);
            }
          }(m), y.forEach(g == null ? function(T2) {
            b.push(T2[0].i);
          } : function(T2) {
            g(T2[0].g, T2[T2.length - 1].g) && b.push(T2[0].i);
          }), b;
        }
        function h(v, m) {
          var g = {}, x = [], b = [];
          function y(_4) {
            _4.forEach(function(k) {
              k.forEach(function(T2) {
                (g[T2 = T2 < 0 ? ~T2 : T2] || (g[T2] = [])).push(_4);
              });
            }), x.push(_4);
          }
          function w(_4) {
            return function(k) {
              for (var T2, A2 = -1, S2 = k.length, C2 = k[S2 - 1], E2 = 0; ++A2 < S2; ) T2 = C2, C2 = k[A2], E2 += T2[0] * C2[1] - T2[1] * C2[0];
              return Math.abs(E2);
            }(l(v, { type: "Polygon", arcs: [_4] }).coordinates[0]);
          }
          return m.forEach(function _4(k) {
            switch (k.type) {
              case "GeometryCollection":
                k.geometries.forEach(_4);
                break;
              case "Polygon":
                y(k.arcs);
                break;
              case "MultiPolygon":
                k.arcs.forEach(y);
            }
          }), x.forEach(function(_4) {
            if (!_4._) {
              var k = [], T2 = [_4];
              for (_4._ = 1, b.push(k); _4 = T2.pop(); ) k.push(_4), _4.forEach(function(A2) {
                A2.forEach(function(S2) {
                  g[S2 < 0 ? ~S2 : S2].forEach(function(C2) {
                    C2._ || (C2._ = 1, T2.push(C2));
                  });
                });
              });
            }
          }), x.forEach(function(_4) {
            delete _4._;
          }), { type: "MultiPolygon", arcs: b.map(function(_4) {
            var k, T2 = [];
            if (_4.forEach(function(F13) {
              F13.forEach(function(N2) {
                N2.forEach(function(D2) {
                  g[D2 < 0 ? ~D2 : D2].length < 2 && T2.push(D2);
                });
              });
            }), (k = (T2 = u2(v, T2)).length) > 1) for (var A2, S2, C2 = 1, E2 = w(T2[0]); C2 < k; ++C2) (A2 = w(T2[C2])) > E2 && (S2 = T2[0], T2[0] = T2[C2], T2[C2] = S2, E2 = A2);
            return T2;
          }).filter(function(_4) {
            return _4.length > 0;
          }) };
        }
        function p(v, m) {
          for (var g = 0, x = v.length; g < x; ) {
            var b = g + x >>> 1;
            v[b] < m ? g = b + 1 : x = b;
          }
          return g;
        }
        function d(v) {
          if (v == null) return a;
          var m, g, x = v.scale[0], b = v.scale[1], y = v.translate[0], w = v.translate[1];
          return function(_4, k) {
            k || (m = g = 0);
            var T2 = 2, A2 = _4.length, S2 = new Array(A2), C2 = Math.round((_4[0] - y) / x), E2 = Math.round((_4[1] - w) / b);
            for (S2[0] = C2 - m, m = C2, S2[1] = E2 - g, g = E2; T2 < A2; ) S2[T2] = _4[T2], ++T2;
            return S2;
          };
        }
        n.bbox = s, n.feature = function(v, m) {
          return typeof m == "string" && (m = v.objects[m]), m.type === "GeometryCollection" ? { type: "FeatureCollection", features: m.geometries.map(function(g) {
            return i(v, g);
          }) } : i(v, m);
        }, n.merge = function(v) {
          return l(v, h.apply(this, arguments));
        }, n.mergeArcs = h, n.mesh = function(v) {
          return l(v, c.apply(this, arguments));
        }, n.meshArcs = c, n.neighbors = function(v) {
          var m = {}, g = v.map(function() {
            return [];
          });
          function x(F13, N2) {
            F13.forEach(function(D2) {
              D2 < 0 && (D2 = ~D2);
              var I2 = m[D2];
              I2 ? I2.push(N2) : m[D2] = [N2];
            });
          }
          function b(F13, N2) {
            F13.forEach(function(D2) {
              x(D2, N2);
            });
          }
          var y = { LineString: x, MultiLineString: b, Polygon: b, MultiPolygon: function(F13, N2) {
            F13.forEach(function(D2) {
              b(D2, N2);
            });
          } };
          for (var w in v.forEach(function F13(N2, D2) {
            N2.type === "GeometryCollection" ? N2.geometries.forEach(function(I2) {
              F13(I2, D2);
            }) : N2.type in y && y[N2.type](N2.arcs, D2);
          }), m) for (var _4 = m[w], k = _4.length, T2 = 0; T2 < k; ++T2) for (var A2 = T2 + 1; A2 < k; ++A2) {
            var S2, C2 = _4[T2], E2 = _4[A2];
            (S2 = g[C2])[w = p(S2, E2)] !== E2 && S2.splice(w, 0, E2), (S2 = g[E2])[w = p(S2, C2)] !== C2 && S2.splice(w, 0, C2);
          }
          return g;
        }, n.quantize = function(v, m) {
          if (v.transform) throw new Error("already quantized");
          if (m && m.scale) _4 = v.bbox;
          else {
            if (!((g = Math.floor(m)) >= 2)) throw new Error("n must be \u22652");
            var g, x = (_4 = v.bbox || s(v))[0], b = _4[1], y = _4[2], w = _4[3];
            m = { scale: [y - x ? (y - x) / (g - 1) : 1, w - b ? (w - b) / (g - 1) : 1], translate: [x, b] };
          }
          var _4, k, T2 = d(m), A2 = v.objects, S2 = {};
          function C2(F13) {
            return T2(F13);
          }
          function E2(F13) {
            var N2;
            switch (F13.type) {
              case "GeometryCollection":
                N2 = { type: "GeometryCollection", geometries: F13.geometries.map(E2) };
                break;
              case "Point":
                N2 = { type: "Point", coordinates: C2(F13.coordinates) };
                break;
              case "MultiPoint":
                N2 = { type: "MultiPoint", coordinates: F13.coordinates.map(C2) };
                break;
              default:
                return F13;
            }
            return F13.id != null && (N2.id = F13.id), F13.bbox != null && (N2.bbox = F13.bbox), F13.properties != null && (N2.properties = F13.properties), N2;
          }
          for (k in A2) S2[k] = E2(A2[k]);
          return { type: "Topology", bbox: _4, transform: m, objects: S2, arcs: v.arcs.map(function(F13) {
            var N2, D2 = 0, I2 = 1, O2 = F13.length, L2 = new Array(O2);
            for (L2[0] = T2(F13[0], 0); ++D2 < O2; ) ((N2 = T2(F13[D2], D2))[0] || N2[1]) && (L2[I2++] = N2);
            return I2 === 1 && (L2[I2++] = [0, 0]), L2.length = I2, L2;
          }) };
        }, n.transform = o, n.untransform = d, Object.defineProperty(n, "__esModule", { value: true });
      });
    }, {}], 316: [function(e, t, r) {
      "use strict";
      var n = e("../prototype/is");
      t.exports = function(a) {
        if (typeof a != "function" || !hasOwnProperty.call(a, "length")) return false;
        try {
          if (typeof a.length != "number" || typeof a.call != "function" || typeof a.apply != "function") return false;
        } catch {
          return false;
        }
        return !n(a);
      };
    }, { "../prototype/is": 323 }], 317: [function(e, t, r) {
      "use strict";
      var n = e("../value/is"), a = e("../object/is"), o = e("../string/coerce"), s = e("./to-short-string"), i = function(l, u2) {
        return l.replace("%v", s(u2));
      };
      t.exports = function(l, u2, c) {
        if (!a(c)) throw new TypeError(i(u2, l));
        if (!n(l)) {
          if ("default" in c) return c.default;
          if (c.isOptional) return null;
        }
        var f = o(c.errorMessage);
        throw n(f) || (f = u2), new TypeError(i(f, l));
      };
    }, { "../object/is": 320, "../string/coerce": 324, "../value/is": 326, "./to-short-string": 319 }], 318: [function(e, t, r) {
      "use strict";
      t.exports = function(n) {
        try {
          return n.toString();
        } catch {
          try {
            return String(n);
          } catch {
            return null;
          }
        }
      };
    }, {}], 319: [function(e, t, r) {
      "use strict";
      var n = e("./safe-to-string"), a = /[\n\r\u2028\u2029]/g;
      t.exports = function(o) {
        var s = n(o);
        return s === null ? "<Non-coercible to string value>" : (s.length > 100 && (s = s.slice(0, 99) + "\u2026"), s = s.replace(a, function(i) {
          switch (i) {
            case `
`:
              return "\\n";
            case "\r":
              return "\\r";
            case "\u2028":
              return "\\u2028";
            case "\u2029":
              return "\\u2029";
            default:
              throw new Error("Unexpected character");
          }
        }));
      };
    }, { "./safe-to-string": 318 }], 320: [function(e, t, r) {
      "use strict";
      var n = e("../value/is"), a = { object: true, function: true, undefined: true };
      t.exports = function(o) {
        return !!n(o) && hasOwnProperty.call(a, typeof o);
      };
    }, { "../value/is": 326 }], 321: [function(e, t, r) {
      "use strict";
      var n = e("../lib/resolve-exception"), a = e("./is");
      t.exports = function(o) {
        return a(o) ? o : n(o, "%v is not a plain function", arguments[1]);
      };
    }, { "../lib/resolve-exception": 317, "./is": 322 }], 322: [function(e, t, r) {
      "use strict";
      var n = e("../function/is"), a = /^\s*class[\s{/}]/, o = Function.prototype.toString;
      t.exports = function(s) {
        return !!n(s) && !a.test(o.call(s));
      };
    }, { "../function/is": 316 }], 323: [function(e, t, r) {
      "use strict";
      var n = e("../object/is");
      t.exports = function(a) {
        if (!n(a)) return false;
        try {
          return !!a.constructor && a.constructor.prototype === a;
        } catch {
          return false;
        }
      };
    }, { "../object/is": 320 }], 324: [function(e, t, r) {
      "use strict";
      var n = e("../value/is"), a = e("../object/is"), o = Object.prototype.toString;
      t.exports = function(s) {
        if (!n(s)) return null;
        if (a(s)) {
          var i = s.toString;
          if (typeof i != "function" || i === o) return null;
        }
        try {
          return "" + s;
        } catch {
          return null;
        }
      };
    }, { "../object/is": 320, "../value/is": 326 }], 325: [function(e, t, r) {
      "use strict";
      var n = e("../lib/resolve-exception"), a = e("./is");
      t.exports = function(o) {
        return a(o) ? o : n(o, "Cannot use %v", arguments[1]);
      };
    }, { "../lib/resolve-exception": 317, "./is": 326 }], 326: [function(e, t, r) {
      "use strict";
      t.exports = function(n) {
        return n != null;
      };
    }, {}], 327: [function(e, t, r) {
      (function(n) {
        (function() {
          "use strict";
          var a = e("bit-twiddle"), o = e("dup"), s = e("buffer").Buffer;
          n.__TYPEDARRAY_POOL || (n.__TYPEDARRAY_POOL = { UINT8: o([32, 0]), UINT16: o([32, 0]), UINT32: o([32, 0]), BIGUINT64: o([32, 0]), INT8: o([32, 0]), INT16: o([32, 0]), INT32: o([32, 0]), BIGINT64: o([32, 0]), FLOAT: o([32, 0]), DOUBLE: o([32, 0]), DATA: o([32, 0]), UINT8C: o([32, 0]), BUFFER: o([32, 0]) });
          var i = typeof Uint8ClampedArray < "u", l = typeof BigUint64Array < "u", u2 = typeof BigInt64Array < "u", c = n.__TYPEDARRAY_POOL;
          c.UINT8C || (c.UINT8C = o([32, 0])), c.BIGUINT64 || (c.BIGUINT64 = o([32, 0])), c.BIGINT64 || (c.BIGINT64 = o([32, 0])), c.BUFFER || (c.BUFFER = o([32, 0]));
          var f = c.DATA, h = c.BUFFER;
          function p(E2) {
            if (E2) {
              var F13 = E2.length || E2.byteLength, N2 = a.log2(F13);
              f[N2].push(E2);
            }
          }
          function d(E2) {
            E2 = a.nextPow2(E2);
            var F13 = a.log2(E2), N2 = f[F13];
            return N2.length > 0 ? N2.pop() : new ArrayBuffer(E2);
          }
          function v(E2) {
            return new Uint8Array(d(E2), 0, E2);
          }
          function m(E2) {
            return new Uint16Array(d(2 * E2), 0, E2);
          }
          function g(E2) {
            return new Uint32Array(d(4 * E2), 0, E2);
          }
          function x(E2) {
            return new Int8Array(d(E2), 0, E2);
          }
          function b(E2) {
            return new Int16Array(d(2 * E2), 0, E2);
          }
          function y(E2) {
            return new Int32Array(d(4 * E2), 0, E2);
          }
          function w(E2) {
            return new Float32Array(d(4 * E2), 0, E2);
          }
          function _4(E2) {
            return new Float64Array(d(8 * E2), 0, E2);
          }
          function k(E2) {
            return i ? new Uint8ClampedArray(d(E2), 0, E2) : v(E2);
          }
          function T2(E2) {
            return l ? new BigUint64Array(d(8 * E2), 0, E2) : null;
          }
          function A2(E2) {
            return u2 ? new BigInt64Array(d(8 * E2), 0, E2) : null;
          }
          function S2(E2) {
            return new DataView(d(E2), 0, E2);
          }
          function C2(E2) {
            E2 = a.nextPow2(E2);
            var F13 = a.log2(E2), N2 = h[F13];
            return N2.length > 0 ? N2.pop() : new s(E2);
          }
          r.free = function(E2) {
            if (s.isBuffer(E2)) h[a.log2(E2.length)].push(E2);
            else {
              if (Object.prototype.toString.call(E2) !== "[object ArrayBuffer]" && (E2 = E2.buffer), !E2) return;
              var F13 = E2.length || E2.byteLength, N2 = 0 | a.log2(F13);
              f[N2].push(E2);
            }
          }, r.freeUint8 = r.freeUint16 = r.freeUint32 = r.freeBigUint64 = r.freeInt8 = r.freeInt16 = r.freeInt32 = r.freeBigInt64 = r.freeFloat32 = r.freeFloat = r.freeFloat64 = r.freeDouble = r.freeUint8Clamped = r.freeDataView = function(E2) {
            p(E2.buffer);
          }, r.freeArrayBuffer = p, r.freeBuffer = function(E2) {
            h[a.log2(E2.length)].push(E2);
          }, r.malloc = function(E2, F13) {
            if (F13 === void 0 || F13 === "arraybuffer") return d(E2);
            switch (F13) {
              case "uint8":
                return v(E2);
              case "uint16":
                return m(E2);
              case "uint32":
                return g(E2);
              case "int8":
                return x(E2);
              case "int16":
                return b(E2);
              case "int32":
                return y(E2);
              case "float":
              case "float32":
                return w(E2);
              case "double":
              case "float64":
                return _4(E2);
              case "uint8_clamped":
                return k(E2);
              case "bigint64":
                return A2(E2);
              case "biguint64":
                return T2(E2);
              case "buffer":
                return C2(E2);
              case "data":
              case "dataview":
                return S2(E2);
              default:
                return null;
            }
            return null;
          }, r.mallocArrayBuffer = d, r.mallocUint8 = v, r.mallocUint16 = m, r.mallocUint32 = g, r.mallocInt8 = x, r.mallocInt16 = b, r.mallocInt32 = y, r.mallocFloat32 = r.mallocFloat = w, r.mallocFloat64 = r.mallocDouble = _4, r.mallocUint8Clamped = k, r.mallocBigUint64 = T2, r.mallocBigInt64 = A2, r.mallocDataView = S2, r.mallocBuffer = C2, r.clearCache = function() {
            for (var E2 = 0; E2 < 32; ++E2) c.UINT8[E2].length = 0, c.UINT16[E2].length = 0, c.UINT32[E2].length = 0, c.INT8[E2].length = 0, c.INT16[E2].length = 0, c.INT32[E2].length = 0, c.FLOAT[E2].length = 0, c.DOUBLE[E2].length = 0, c.BIGUINT64[E2].length = 0, c.BIGINT64[E2].length = 0, c.UINT8C[E2].length = 0, f[E2].length = 0, h[E2].length = 0;
          };
        }).call(this);
      }).call(this, typeof global < "u" ? global : typeof self < "u" ? self : typeof window < "u" ? window : {});
    }, { "bit-twiddle": 81, buffer: 85, dup: 128 }], 328: [function(e, t, r) {
      var n = /[\'\"]/;
      t.exports = function(a) {
        return a ? (n.test(a.charAt(0)) && (a = a.substr(1)), n.test(a.charAt(a.length - 1)) && (a = a.substr(0, a.length - 1)), a) : "";
      };
    }, {}], 329: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a, o) {
        Array.isArray(o) || (o = [].slice.call(arguments, 2));
        for (var s = 0, i = o.length; s < i; s++) {
          var l = o[s];
          for (var u2 in l) if ((a[u2] === void 0 || Array.isArray(a[u2]) || n[u2] !== a[u2]) && u2 in a) {
            var c;
            if (l[u2] === true) c = a[u2];
            else if (l[u2] === false || typeof l[u2] == "function" && (c = l[u2](a[u2], n, a)) === void 0) continue;
            n[u2] = c;
          }
        }
        return n;
      };
    }, {}], 330: [function(e, t, r) {
      (function(n) {
        (function() {
          function a(o) {
            try {
              if (!n.localStorage) return false;
            } catch {
              return false;
            }
            var s = n.localStorage[o];
            return s != null && String(s).toLowerCase() === "true";
          }
          t.exports = function(o, s) {
            if (a("noDeprecation")) return o;
            var i = false;
            return function() {
              if (!i) {
                if (a("throwDeprecation")) throw new Error(s);
                a("traceDeprecation") ? console.trace(s) : console.warn(s), i = true;
              }
              return o.apply(this, arguments);
            };
          };
        }).call(this);
      }).call(this, typeof global < "u" ? global : typeof self < "u" ? self : typeof window < "u" ? window : {});
    }, {}], 331: [function(e, t, r) {
      var n = e("get-canvas-context");
      t.exports = function(a) {
        return n("webgl", a);
      };
    }, { "get-canvas-context": 194 }], 332: [function(e, t, r) {
      var n = e("../main"), a = e("object-assign"), o = n.instance();
      function s(p) {
        this.local = this.regionalOptions[p || ""] || this.regionalOptions[""];
      }
      s.prototype = new n.baseCalendar(), a(s.prototype, { name: "Chinese", jdEpoch: 17214255e-1, hasYearZero: false, minMonth: 0, firstMonth: 0, minDay: 1, regionalOptions: { "": { name: "Chinese", epochs: ["BEC", "EC"], monthNumbers: function(p, d) {
        if (typeof p == "string") {
          var v = p.match(l);
          return v ? v[0] : "";
        }
        var m = this._validateYear(p), g = p.month(), x = "" + this.toChineseMonth(m, g);
        return d && x.length < 2 && (x = "0" + x), this.isIntercalaryMonth(m, g) && (x += "i"), x;
      }, monthNames: function(p) {
        if (typeof p == "string") {
          var d = p.match(u2);
          return d ? d[0] : "";
        }
        var v = this._validateYear(p), m = p.month(), g = ["\u4E00\u6708", "\u4E8C\u6708", "\u4E09\u6708", "\u56DB\u6708", "\u4E94\u6708", "\u516D\u6708", "\u4E03\u6708", "\u516B\u6708", "\u4E5D\u6708", "\u5341\u6708", "\u5341\u4E00\u6708", "\u5341\u4E8C\u6708"][this.toChineseMonth(v, m) - 1];
        return this.isIntercalaryMonth(v, m) && (g = "\u95F0" + g), g;
      }, monthNamesShort: function(p) {
        if (typeof p == "string") {
          var d = p.match(c);
          return d ? d[0] : "";
        }
        var v = this._validateYear(p), m = p.month(), g = ["\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D", "\u4E03", "\u516B", "\u4E5D", "\u5341", "\u5341\u4E00", "\u5341\u4E8C"][this.toChineseMonth(v, m) - 1];
        return this.isIntercalaryMonth(v, m) && (g = "\u95F0" + g), g;
      }, parseMonth: function(p, d) {
        p = this._validateYear(p);
        var v, m = parseInt(d);
        if (isNaN(m)) d[0] === "\u95F0" && (v = true, d = d.substring(1)), d[d.length - 1] === "\u6708" && (d = d.substring(0, d.length - 1)), m = 1 + ["\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D", "\u4E03", "\u516B", "\u4E5D", "\u5341", "\u5341\u4E00", "\u5341\u4E8C"].indexOf(d);
        else {
          var g = d[d.length - 1];
          v = g === "i" || g === "I";
        }
        return this.toMonthIndex(p, m, v);
      }, dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], dayNamesMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], digits: null, dateFormat: "yyyy/mm/dd", firstDay: 1, isRTL: false } }, _validateYear: function(p, d) {
        if (p.year && (p = p.year()), typeof p != "number" || p < 1888 || p > 2111) throw d.replace(/\{0\}/, this.local.name);
        return p;
      }, toMonthIndex: function(p, d, v) {
        var m = this.intercalaryMonth(p);
        if (v && d !== m || d < 1 || d > 12) throw n.local.invalidMonth.replace(/\{0\}/, this.local.name);
        return m ? !v && d <= m ? d - 1 : d : d - 1;
      }, toChineseMonth: function(p, d) {
        p.year && (d = (p = p.year()).month());
        var v = this.intercalaryMonth(p);
        if (d < 0 || d > (v ? 12 : 11)) throw n.local.invalidMonth.replace(/\{0\}/, this.local.name);
        return v ? d < v ? d + 1 : d : d + 1;
      }, intercalaryMonth: function(p) {
        return p = this._validateYear(p), f[p - f[0]] >> 13;
      }, isIntercalaryMonth: function(p, d) {
        p.year && (d = (p = p.year()).month());
        var v = this.intercalaryMonth(p);
        return !!v && v === d;
      }, leapYear: function(p) {
        return this.intercalaryMonth(p) !== 0;
      }, weekOfYear: function(p, d, v) {
        var m, g = this._validateYear(p, n.local.invalidyear), x = h[g - h[0]], b = x >> 9 & 4095, y = x >> 5 & 15, w = 31 & x;
        (m = o.newDate(b, y, w)).add(4 - (m.dayOfWeek() || 7), "d");
        var _4 = this.toJD(p, d, v) - m.toJD();
        return 1 + Math.floor(_4 / 7);
      }, monthsInYear: function(p) {
        return this.leapYear(p) ? 13 : 12;
      }, daysInMonth: function(p, d) {
        p.year && (d = p.month(), p = p.year()), p = this._validateYear(p);
        var v = f[p - f[0]];
        if (d > (v >> 13 ? 12 : 11)) throw n.local.invalidMonth.replace(/\{0\}/, this.local.name);
        return v & 1 << 12 - d ? 30 : 29;
      }, weekDay: function(p, d, v) {
        return (this.dayOfWeek(p, d, v) || 7) < 6;
      }, toJD: function(p, d, v) {
        var m = this._validate(p, x, v, n.local.invalidDate);
        p = this._validateYear(m.year()), d = m.month(), v = m.day();
        var g = this.isIntercalaryMonth(p, d), x = this.toChineseMonth(p, d), b = function(y, w, _4, k, T2) {
          var A2, S2, C2;
          if (typeof y == "object") S2 = y, A2 = w || {};
          else {
            var E2;
            if (!(typeof y == "number" && y >= 1888 && y <= 2111)) throw new Error("Lunar year outside range 1888-2111");
            if (!(typeof w == "number" && w >= 1 && w <= 12)) throw new Error("Lunar month outside range 1 - 12");
            if (!(typeof _4 == "number" && _4 >= 1 && _4 <= 30)) throw new Error("Lunar day outside range 1 - 30");
            typeof k == "object" ? (E2 = false, A2 = k) : (E2 = !!k, A2 = T2 || {}), S2 = { year: y, month: w, day: _4, isIntercalary: E2 };
          }
          C2 = S2.day - 1;
          var F13, N2 = f[S2.year - f[0]], D2 = N2 >> 13;
          F13 = D2 && (S2.month > D2 || S2.isIntercalary) ? S2.month : S2.month - 1;
          for (var I2 = 0; I2 < F13; I2++) C2 += N2 & 1 << 12 - I2 ? 30 : 29;
          var O2 = h[S2.year - h[0]], L2 = new Date(O2 >> 9 & 4095, (O2 >> 5 & 15) - 1, (31 & O2) + C2);
          return A2.year = L2.getFullYear(), A2.month = 1 + L2.getMonth(), A2.day = L2.getDate(), A2;
        }(p, x, v, g);
        return o.toJD(b.year, b.month, b.day);
      }, fromJD: function(p) {
        var d = o.fromJD(p), v = function(g, x, b, y) {
          var w, _4;
          if (typeof g == "object") w = g, _4 = x || {};
          else {
            if (!(typeof g == "number" && g >= 1888 && g <= 2111)) throw new Error("Solar year outside range 1888-2111");
            if (!(typeof x == "number" && x >= 1 && x <= 12)) throw new Error("Solar month outside range 1 - 12");
            if (!(typeof b == "number" && b >= 1 && b <= 31)) throw new Error("Solar day outside range 1 - 31");
            w = { year: g, month: x, day: b }, _4 = y || {};
          }
          var k = h[w.year - h[0]], T2 = w.year << 9 | w.month << 5 | w.day;
          _4.year = T2 >= k ? w.year : w.year - 1, k = h[_4.year - h[0]];
          var A2, S2 = new Date(k >> 9 & 4095, (k >> 5 & 15) - 1, 31 & k), C2 = new Date(w.year, w.month - 1, w.day);
          A2 = Math.round((C2 - S2) / 864e5);
          var E2, F13 = f[_4.year - f[0]];
          for (E2 = 0; E2 < 13; E2++) {
            var N2 = F13 & 1 << 12 - E2 ? 30 : 29;
            if (A2 < N2) break;
            A2 -= N2;
          }
          var D2 = F13 >> 13;
          return !D2 || E2 < D2 ? (_4.isIntercalary = false, _4.month = 1 + E2) : E2 === D2 ? (_4.isIntercalary = true, _4.month = E2) : (_4.isIntercalary = false, _4.month = E2), _4.day = 1 + A2, _4;
        }(d.year(), d.month(), d.day()), m = this.toMonthIndex(v.year, v.month, v.isIntercalary);
        return this.newDate(v.year, m, v.day);
      }, fromString: function(p) {
        var d = p.match(i), v = this._validateYear(+d[1]), m = +d[2], g = !!d[3], x = this.toMonthIndex(v, m, g), b = +d[4];
        return this.newDate(v, x, b);
      }, add: function(p, d, v) {
        var m = p.year(), g = p.month(), x = this.isIntercalaryMonth(m, g), b = this.toChineseMonth(m, g), y = Object.getPrototypeOf(s.prototype).add.call(this, p, d, v);
        if (v === "y") {
          var w = y.year(), _4 = y.month(), k = this.isIntercalaryMonth(w, b), T2 = x && k ? this.toMonthIndex(w, b, true) : this.toMonthIndex(w, b, false);
          T2 !== _4 && y.month(T2);
        }
        return y;
      } });
      var i = /^\s*(-?\d\d\d\d|\d\d)[-/](\d?\d)([iI]?)[-/](\d?\d)/m, l = /^\d?\d[iI]?/m, u2 = /^\u95f0?\u5341?[\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d]?\u6708/m, c = /^\u95f0?\u5341?[\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d]?/m;
      n.calendars.chinese = s;
      var f = [1887, 5780, 5802, 19157, 2742, 50359, 1198, 2646, 46378, 7466, 3412, 30122, 5482, 67949, 2396, 5294, 43597, 6732, 6954, 36181, 2772, 4954, 18781, 2396, 54427, 5274, 6730, 47781, 5800, 6868, 21210, 4790, 59703, 2350, 5270, 46667, 3402, 3496, 38325, 1388, 4782, 18735, 2350, 52374, 6804, 7498, 44457, 2906, 1388, 29294, 4700, 63789, 6442, 6804, 56138, 5802, 2772, 38235, 1210, 4698, 22827, 5418, 63125, 3476, 5802, 43701, 2484, 5302, 27223, 2646, 70954, 7466, 3412, 54698, 5482, 2412, 38062, 5294, 2636, 32038, 6954, 60245, 2772, 4826, 43357, 2394, 5274, 39501, 6730, 72357, 5800, 5844, 53978, 4790, 2358, 38039, 5270, 87627, 3402, 3496, 54708, 5484, 4782, 43311, 2350, 3222, 27978, 7498, 68965, 2904, 5484, 45677, 4700, 6444, 39573, 6804, 6986, 19285, 2772, 62811, 1210, 4698, 47403, 5418, 5780, 38570, 5546, 76469, 2420, 5302, 51799, 2646, 5414, 36501, 3412, 5546, 18869, 2412, 54446, 5276, 6732, 48422, 6822, 2900, 28010, 4826, 92509, 2394, 5274, 55883, 6730, 6820, 47956, 5812, 2778, 18779, 2358, 62615, 5270, 5450, 46757, 3492, 5556, 27318, 4718, 67887, 2350, 3222, 52554, 7498, 3428, 38252, 5468, 4700, 31022, 6444, 64149, 6804, 6986, 43861, 2772, 5338, 35421, 2650, 70955, 5418, 5780, 54954, 5546, 2740, 38074, 5302, 2646, 29991, 3366, 61011, 3412, 5546, 43445, 2412, 5294, 35406, 6732, 72998, 6820, 6996, 52586, 2778, 2396, 38045, 5274, 6698, 23333, 6820, 64338, 5812, 2746, 43355, 2358, 5270, 39499, 5450, 79525, 3492, 5548], h = [1887, 966732, 967231, 967733, 968265, 968766, 969297, 969798, 970298, 970829, 971330, 971830, 972362, 972863, 973395, 973896, 974397, 974928, 975428, 975929, 976461, 976962, 977462, 977994, 978494, 979026, 979526, 980026, 980558, 981059, 981559, 982091, 982593, 983124, 983624, 984124, 984656, 985157, 985656, 986189, 986690, 987191, 987722, 988222, 988753, 989254, 989754, 990286, 990788, 991288, 991819, 992319, 992851, 993352, 993851, 994383, 994885, 995385, 995917, 996418, 996918, 997450, 997949, 998481, 998982, 999483, 1000014, 1000515, 1001016, 1001548, 1002047, 1002578, 1003080, 1003580, 1004111, 1004613, 1005113, 1005645, 1006146, 1006645, 1007177, 1007678, 1008209, 1008710, 1009211, 1009743, 1010243, 1010743, 1011275, 1011775, 1012306, 1012807, 1013308, 1013840, 1014341, 1014841, 1015373, 1015874, 1016404, 1016905, 1017405, 1017937, 1018438, 1018939, 1019471, 1019972, 1020471, 1021002, 1021503, 1022035, 1022535, 1023036, 1023568, 1024069, 1024568, 1025100, 1025601, 1026102, 1026633, 1027133, 1027666, 1028167, 1028666, 1029198, 1029699, 1030199, 1030730, 1031231, 1031763, 1032264, 1032764, 1033296, 1033797, 1034297, 1034828, 1035329, 1035830, 1036362, 1036861, 1037393, 1037894, 1038394, 1038925, 1039427, 1039927, 1040459, 1040959, 1041491, 1041992, 1042492, 1043023, 1043524, 1044024, 1044556, 1045057, 1045558, 1046090, 1046590, 1047121, 1047622, 1048122, 1048654, 1049154, 1049655, 1050187, 1050689, 1051219, 1051720, 1052220, 1052751, 1053252, 1053752, 1054284, 1054786, 1055285, 1055817, 1056317, 1056849, 1057349, 1057850, 1058382, 1058883, 1059383, 1059915, 1060415, 1060947, 1061447, 1061947, 1062479, 1062981, 1063480, 1064012, 1064514, 1065014, 1065545, 1066045, 1066577, 1067078, 1067578, 1068110, 1068611, 1069112, 1069642, 1070142, 1070674, 1071175, 1071675, 1072207, 1072709, 1073209, 1073740, 1074241, 1074741, 1075273, 1075773, 1076305, 1076807, 1077308, 1077839, 1078340, 1078840, 1079372, 1079871, 1080403, 1080904];
    }, { "../main": 346, "object-assign": 247 }], 333: [function(e, t, r) {
      var n = e("../main"), a = e("object-assign");
      function o(s) {
        this.local = this.regionalOptions[s || ""] || this.regionalOptions[""];
      }
      o.prototype = new n.baseCalendar(), a(o.prototype, { name: "Coptic", jdEpoch: 18250295e-1, daysPerMonth: [30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 5], hasYearZero: false, minMonth: 1, firstMonth: 1, minDay: 1, regionalOptions: { "": { name: "Coptic", epochs: ["BAM", "AM"], monthNames: ["Thout", "Paopi", "Hathor", "Koiak", "Tobi", "Meshir", "Paremhat", "Paremoude", "Pashons", "Paoni", "Epip", "Mesori", "Pi Kogi Enavot"], monthNamesShort: ["Tho", "Pao", "Hath", "Koi", "Tob", "Mesh", "Pat", "Pad", "Pash", "Pao", "Epi", "Meso", "PiK"], dayNames: ["Tkyriaka", "Pesnau", "Pshoment", "Peftoou", "Ptiou", "Psoou", "Psabbaton"], dayNamesShort: ["Tky", "Pes", "Psh", "Pef", "Pti", "Pso", "Psa"], dayNamesMin: ["Tk", "Pes", "Psh", "Pef", "Pt", "Pso", "Psa"], digits: null, dateFormat: "dd/mm/yyyy", firstDay: 0, isRTL: false } }, leapYear: function(s) {
        var i = this._validate(s, this.minMonth, this.minDay, n.local.invalidYear);
        return (s = i.year() + (i.year() < 0 ? 1 : 0)) % 4 == 3 || s % 4 == -1;
      }, monthsInYear: function(s) {
        return this._validate(s, this.minMonth, this.minDay, n.local.invalidYear || n.regionalOptions[""].invalidYear), 13;
      }, weekOfYear: function(s, i, l) {
        var u2 = this.newDate(s, i, l);
        return u2.add(-u2.dayOfWeek(), "d"), Math.floor((u2.dayOfYear() - 1) / 7) + 1;
      }, daysInMonth: function(s, i) {
        var l = this._validate(s, i, this.minDay, n.local.invalidMonth);
        return this.daysPerMonth[l.month() - 1] + (l.month() === 13 && this.leapYear(l.year()) ? 1 : 0);
      }, weekDay: function(s, i, l) {
        return (this.dayOfWeek(s, i, l) || 7) < 6;
      }, toJD: function(s, i, l) {
        var u2 = this._validate(s, i, l, n.local.invalidDate);
        return (s = u2.year()) < 0 && s++, u2.day() + 30 * (u2.month() - 1) + 365 * (s - 1) + Math.floor(s / 4) + this.jdEpoch - 1;
      }, fromJD: function(s) {
        var i = Math.floor(s) + 0.5 - this.jdEpoch, l = Math.floor((i - Math.floor((i + 366) / 1461)) / 365) + 1;
        l <= 0 && l--, i = Math.floor(s) + 0.5 - this.newDate(l, 1, 1).toJD();
        var u2 = Math.floor(i / 30) + 1, c = i - 30 * (u2 - 1) + 1;
        return this.newDate(l, u2, c);
      } }), n.calendars.coptic = o;
    }, { "../main": 346, "object-assign": 247 }], 334: [function(e, t, r) {
      var n = e("../main"), a = e("object-assign");
      function o(i) {
        this.local = this.regionalOptions[i || ""] || this.regionalOptions[""];
      }
      o.prototype = new n.baseCalendar(), a(o.prototype, { name: "Discworld", jdEpoch: 17214255e-1, daysPerMonth: [16, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32], hasYearZero: false, minMonth: 1, firstMonth: 1, minDay: 1, regionalOptions: { "": { name: "Discworld", epochs: ["BUC", "UC"], monthNames: ["Ick", "Offle", "February", "March", "April", "May", "June", "Grune", "August", "Spune", "Sektober", "Ember", "December"], monthNamesShort: ["Ick", "Off", "Feb", "Mar", "Apr", "May", "Jun", "Gru", "Aug", "Spu", "Sek", "Emb", "Dec"], dayNames: ["Sunday", "Octeday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], dayNamesShort: ["Sun", "Oct", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], dayNamesMin: ["Su", "Oc", "Mo", "Tu", "We", "Th", "Fr", "Sa"], digits: null, dateFormat: "yyyy/mm/dd", firstDay: 2, isRTL: false } }, leapYear: function(i) {
        return this._validate(i, this.minMonth, this.minDay, n.local.invalidYear), false;
      }, monthsInYear: function(i) {
        return this._validate(i, this.minMonth, this.minDay, n.local.invalidYear), 13;
      }, daysInYear: function(i) {
        return this._validate(i, this.minMonth, this.minDay, n.local.invalidYear), 400;
      }, weekOfYear: function(i, l, u2) {
        var c = this.newDate(i, l, u2);
        return c.add(-c.dayOfWeek(), "d"), Math.floor((c.dayOfYear() - 1) / 8) + 1;
      }, daysInMonth: function(i, l) {
        var u2 = this._validate(i, l, this.minDay, n.local.invalidMonth);
        return this.daysPerMonth[u2.month() - 1];
      }, daysInWeek: function() {
        return 8;
      }, dayOfWeek: function(i, l, u2) {
        return (this._validate(i, l, u2, n.local.invalidDate).day() + 1) % 8;
      }, weekDay: function(i, l, u2) {
        var c = this.dayOfWeek(i, l, u2);
        return c >= 2 && c <= 6;
      }, extraInfo: function(i, l, u2) {
        var c = this._validate(i, l, u2, n.local.invalidDate);
        return { century: s[Math.floor((c.year() - 1) / 100) + 1] || "" };
      }, toJD: function(i, l, u2) {
        var c = this._validate(i, l, u2, n.local.invalidDate);
        return i = c.year() + (c.year() < 0 ? 1 : 0), l = c.month(), (u2 = c.day()) + (l > 1 ? 16 : 0) + (l > 2 ? 32 * (l - 2) : 0) + 400 * (i - 1) + this.jdEpoch - 1;
      }, fromJD: function(i) {
        i = Math.floor(i + 0.5) - Math.floor(this.jdEpoch) - 1;
        var l = Math.floor(i / 400) + 1;
        i -= 400 * (l - 1), i += i > 15 ? 16 : 0;
        var u2 = Math.floor(i / 32) + 1, c = i - 32 * (u2 - 1) + 1;
        return this.newDate(l <= 0 ? l - 1 : l, u2, c);
      } });
      var s = { 20: "Fruitbat", 21: "Anchovy" };
      n.calendars.discworld = o;
    }, { "../main": 346, "object-assign": 247 }], 335: [function(e, t, r) {
      var n = e("../main"), a = e("object-assign");
      function o(s) {
        this.local = this.regionalOptions[s || ""] || this.regionalOptions[""];
      }
      o.prototype = new n.baseCalendar(), a(o.prototype, { name: "Ethiopian", jdEpoch: 17242205e-1, daysPerMonth: [30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 5], hasYearZero: false, minMonth: 1, firstMonth: 1, minDay: 1, regionalOptions: { "": { name: "Ethiopian", epochs: ["BEE", "EE"], monthNames: ["Meskerem", "Tikemet", "Hidar", "Tahesas", "Tir", "Yekatit", "Megabit", "Miazia", "Genbot", "Sene", "Hamle", "Nehase", "Pagume"], monthNamesShort: ["Mes", "Tik", "Hid", "Tah", "Tir", "Yek", "Meg", "Mia", "Gen", "Sen", "Ham", "Neh", "Pag"], dayNames: ["Ehud", "Segno", "Maksegno", "Irob", "Hamus", "Arb", "Kidame"], dayNamesShort: ["Ehu", "Seg", "Mak", "Iro", "Ham", "Arb", "Kid"], dayNamesMin: ["Eh", "Se", "Ma", "Ir", "Ha", "Ar", "Ki"], digits: null, dateFormat: "dd/mm/yyyy", firstDay: 0, isRTL: false } }, leapYear: function(s) {
        var i = this._validate(s, this.minMonth, this.minDay, n.local.invalidYear);
        return (s = i.year() + (i.year() < 0 ? 1 : 0)) % 4 == 3 || s % 4 == -1;
      }, monthsInYear: function(s) {
        return this._validate(s, this.minMonth, this.minDay, n.local.invalidYear || n.regionalOptions[""].invalidYear), 13;
      }, weekOfYear: function(s, i, l) {
        var u2 = this.newDate(s, i, l);
        return u2.add(-u2.dayOfWeek(), "d"), Math.floor((u2.dayOfYear() - 1) / 7) + 1;
      }, daysInMonth: function(s, i) {
        var l = this._validate(s, i, this.minDay, n.local.invalidMonth);
        return this.daysPerMonth[l.month() - 1] + (l.month() === 13 && this.leapYear(l.year()) ? 1 : 0);
      }, weekDay: function(s, i, l) {
        return (this.dayOfWeek(s, i, l) || 7) < 6;
      }, toJD: function(s, i, l) {
        var u2 = this._validate(s, i, l, n.local.invalidDate);
        return (s = u2.year()) < 0 && s++, u2.day() + 30 * (u2.month() - 1) + 365 * (s - 1) + Math.floor(s / 4) + this.jdEpoch - 1;
      }, fromJD: function(s) {
        var i = Math.floor(s) + 0.5 - this.jdEpoch, l = Math.floor((i - Math.floor((i + 366) / 1461)) / 365) + 1;
        l <= 0 && l--, i = Math.floor(s) + 0.5 - this.newDate(l, 1, 1).toJD();
        var u2 = Math.floor(i / 30) + 1, c = i - 30 * (u2 - 1) + 1;
        return this.newDate(l, u2, c);
      } }), n.calendars.ethiopian = o;
    }, { "../main": 346, "object-assign": 247 }], 336: [function(e, t, r) {
      var n = e("../main"), a = e("object-assign");
      function o(i) {
        this.local = this.regionalOptions[i || ""] || this.regionalOptions[""];
      }
      function s(i, l) {
        return i - l * Math.floor(i / l);
      }
      o.prototype = new n.baseCalendar(), a(o.prototype, { name: "Hebrew", jdEpoch: 347995.5, daysPerMonth: [30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 29], hasYearZero: false, minMonth: 1, firstMonth: 7, minDay: 1, regionalOptions: { "": { name: "Hebrew", epochs: ["BAM", "AM"], monthNames: ["Nisan", "Iyar", "Sivan", "Tammuz", "Av", "Elul", "Tishrei", "Cheshvan", "Kislev", "Tevet", "Shevat", "Adar", "Adar II"], monthNamesShort: ["Nis", "Iya", "Siv", "Tam", "Av", "Elu", "Tis", "Che", "Kis", "Tev", "She", "Ada", "Ad2"], dayNames: ["Yom Rishon", "Yom Sheni", "Yom Shlishi", "Yom Revi'i", "Yom Chamishi", "Yom Shishi", "Yom Shabbat"], dayNamesShort: ["Ris", "She", "Shl", "Rev", "Cha", "Shi", "Sha"], dayNamesMin: ["Ri", "She", "Shl", "Re", "Ch", "Shi", "Sha"], digits: null, dateFormat: "dd/mm/yyyy", firstDay: 0, isRTL: false } }, leapYear: function(i) {
        var l = this._validate(i, this.minMonth, this.minDay, n.local.invalidYear);
        return this._leapYear(l.year());
      }, _leapYear: function(i) {
        return s(7 * (i = i < 0 ? i + 1 : i) + 1, 19) < 7;
      }, monthsInYear: function(i) {
        return this._validate(i, this.minMonth, this.minDay, n.local.invalidYear), this._leapYear(i.year ? i.year() : i) ? 13 : 12;
      }, weekOfYear: function(i, l, u2) {
        var c = this.newDate(i, l, u2);
        return c.add(-c.dayOfWeek(), "d"), Math.floor((c.dayOfYear() - 1) / 7) + 1;
      }, daysInYear: function(i) {
        return i = this._validate(i, this.minMonth, this.minDay, n.local.invalidYear).year(), this.toJD(i === -1 ? 1 : i + 1, 7, 1) - this.toJD(i, 7, 1);
      }, daysInMonth: function(i, l) {
        return i.year && (l = i.month(), i = i.year()), this._validate(i, l, this.minDay, n.local.invalidMonth), l === 12 && this.leapYear(i) || l === 8 && s(this.daysInYear(i), 10) === 5 ? 30 : l === 9 && s(this.daysInYear(i), 10) === 3 ? 29 : this.daysPerMonth[l - 1];
      }, weekDay: function(i, l, u2) {
        return this.dayOfWeek(i, l, u2) !== 6;
      }, extraInfo: function(i, l, u2) {
        var c = this._validate(i, l, u2, n.local.invalidDate);
        return { yearType: (this.leapYear(c) ? "embolismic" : "common") + " " + ["deficient", "regular", "complete"][this.daysInYear(c) % 10 - 3] };
      }, toJD: function(i, l, u2) {
        var c = this._validate(i, l, u2, n.local.invalidDate);
        i = c.year(), l = c.month(), u2 = c.day();
        var f = i <= 0 ? i + 1 : i, h = this.jdEpoch + this._delay1(f) + this._delay2(f) + u2 + 1;
        if (l < 7) {
          for (var p = 7; p <= this.monthsInYear(i); p++) h += this.daysInMonth(i, p);
          for (p = 1; p < l; p++) h += this.daysInMonth(i, p);
        } else for (p = 7; p < l; p++) h += this.daysInMonth(i, p);
        return h;
      }, _delay1: function(i) {
        var l = Math.floor((235 * i - 234) / 19), u2 = 12084 + 13753 * l, c = 29 * l + Math.floor(u2 / 25920);
        return s(3 * (c + 1), 7) < 3 && c++, c;
      }, _delay2: function(i) {
        var l = this._delay1(i - 1), u2 = this._delay1(i);
        return this._delay1(i + 1) - u2 == 356 ? 2 : u2 - l == 382 ? 1 : 0;
      }, fromJD: function(i) {
        i = Math.floor(i) + 0.5;
        for (var l = Math.floor(98496 * (i - this.jdEpoch) / 35975351) - 1; i >= this.toJD(l === -1 ? 1 : l + 1, 7, 1); ) l++;
        for (var u2 = i < this.toJD(l, 1, 1) ? 7 : 1; i > this.toJD(l, u2, this.daysInMonth(l, u2)); ) u2++;
        var c = i - this.toJD(l, u2, 1) + 1;
        return this.newDate(l, u2, c);
      } }), n.calendars.hebrew = o;
    }, { "../main": 346, "object-assign": 247 }], 337: [function(e, t, r) {
      var n = e("../main"), a = e("object-assign");
      function o(s) {
        this.local = this.regionalOptions[s || ""] || this.regionalOptions[""];
      }
      o.prototype = new n.baseCalendar(), a(o.prototype, { name: "Islamic", jdEpoch: 19484395e-1, daysPerMonth: [30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 29], hasYearZero: false, minMonth: 1, firstMonth: 1, minDay: 1, regionalOptions: { "": { name: "Islamic", epochs: ["BH", "AH"], monthNames: ["Muharram", "Safar", "Rabi' al-awwal", "Rabi' al-thani", "Jumada al-awwal", "Jumada al-thani", "Rajab", "Sha'aban", "Ramadan", "Shawwal", "Dhu al-Qi'dah", "Dhu al-Hijjah"], monthNamesShort: ["Muh", "Saf", "Rab1", "Rab2", "Jum1", "Jum2", "Raj", "Sha'", "Ram", "Shaw", "DhuQ", "DhuH"], dayNames: ["Yawm al-ahad", "Yawm al-ithnayn", "Yawm ath-thulaathaa'", "Yawm al-arbi'aa'", "Yawm al-kham\u012Bs", "Yawm al-jum'a", "Yawm as-sabt"], dayNamesShort: ["Aha", "Ith", "Thu", "Arb", "Kha", "Jum", "Sab"], dayNamesMin: ["Ah", "It", "Th", "Ar", "Kh", "Ju", "Sa"], digits: null, dateFormat: "yyyy/mm/dd", firstDay: 6, isRTL: false } }, leapYear: function(s) {
        return (11 * this._validate(s, this.minMonth, this.minDay, n.local.invalidYear).year() + 14) % 30 < 11;
      }, weekOfYear: function(s, i, l) {
        var u2 = this.newDate(s, i, l);
        return u2.add(-u2.dayOfWeek(), "d"), Math.floor((u2.dayOfYear() - 1) / 7) + 1;
      }, daysInYear: function(s) {
        return this.leapYear(s) ? 355 : 354;
      }, daysInMonth: function(s, i) {
        var l = this._validate(s, i, this.minDay, n.local.invalidMonth);
        return this.daysPerMonth[l.month() - 1] + (l.month() === 12 && this.leapYear(l.year()) ? 1 : 0);
      }, weekDay: function(s, i, l) {
        return this.dayOfWeek(s, i, l) !== 5;
      }, toJD: function(s, i, l) {
        var u2 = this._validate(s, i, l, n.local.invalidDate);
        return s = u2.year(), i = u2.month(), s = s <= 0 ? s + 1 : s, (l = u2.day()) + Math.ceil(29.5 * (i - 1)) + 354 * (s - 1) + Math.floor((3 + 11 * s) / 30) + this.jdEpoch - 1;
      }, fromJD: function(s) {
        s = Math.floor(s) + 0.5;
        var i = Math.floor((30 * (s - this.jdEpoch) + 10646) / 10631);
        i = i <= 0 ? i - 1 : i;
        var l = Math.min(12, Math.ceil((s - 29 - this.toJD(i, 1, 1)) / 29.5) + 1), u2 = s - this.toJD(i, l, 1) + 1;
        return this.newDate(i, l, u2);
      } }), n.calendars.islamic = o;
    }, { "../main": 346, "object-assign": 247 }], 338: [function(e, t, r) {
      var n = e("../main"), a = e("object-assign");
      function o(s) {
        this.local = this.regionalOptions[s || ""] || this.regionalOptions[""];
      }
      o.prototype = new n.baseCalendar(), a(o.prototype, { name: "Julian", jdEpoch: 17214235e-1, daysPerMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], hasYearZero: false, minMonth: 1, firstMonth: 1, minDay: 1, regionalOptions: { "": { name: "Julian", epochs: ["BC", "AD"], monthNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], dayNamesMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], digits: null, dateFormat: "mm/dd/yyyy", firstDay: 0, isRTL: false } }, leapYear: function(s) {
        var i = this._validate(s, this.minMonth, this.minDay, n.local.invalidYear);
        return (s = i.year() < 0 ? i.year() + 1 : i.year()) % 4 == 0;
      }, weekOfYear: function(s, i, l) {
        var u2 = this.newDate(s, i, l);
        return u2.add(4 - (u2.dayOfWeek() || 7), "d"), Math.floor((u2.dayOfYear() - 1) / 7) + 1;
      }, daysInMonth: function(s, i) {
        var l = this._validate(s, i, this.minDay, n.local.invalidMonth);
        return this.daysPerMonth[l.month() - 1] + (l.month() === 2 && this.leapYear(l.year()) ? 1 : 0);
      }, weekDay: function(s, i, l) {
        return (this.dayOfWeek(s, i, l) || 7) < 6;
      }, toJD: function(s, i, l) {
        var u2 = this._validate(s, i, l, n.local.invalidDate);
        return s = u2.year(), i = u2.month(), l = u2.day(), s < 0 && s++, i <= 2 && (s--, i += 12), Math.floor(365.25 * (s + 4716)) + Math.floor(30.6001 * (i + 1)) + l - 1524.5;
      }, fromJD: function(s) {
        var i = Math.floor(s + 0.5) + 1524, l = Math.floor((i - 122.1) / 365.25), u2 = Math.floor(365.25 * l), c = Math.floor((i - u2) / 30.6001), f = c - Math.floor(c < 14 ? 1 : 13), h = l - Math.floor(f > 2 ? 4716 : 4715), p = i - u2 - Math.floor(30.6001 * c);
        return h <= 0 && h--, this.newDate(h, f, p);
      } }), n.calendars.julian = o;
    }, { "../main": 346, "object-assign": 247 }], 339: [function(e, t, r) {
      var n = e("../main"), a = e("object-assign");
      function o(l) {
        this.local = this.regionalOptions[l || ""] || this.regionalOptions[""];
      }
      function s(l, u2) {
        return l - u2 * Math.floor(l / u2);
      }
      function i(l, u2) {
        return s(l - 1, u2) + 1;
      }
      o.prototype = new n.baseCalendar(), a(o.prototype, { name: "Mayan", jdEpoch: 584282.5, hasYearZero: true, minMonth: 0, firstMonth: 0, minDay: 0, regionalOptions: { "": { name: "Mayan", epochs: ["", ""], monthNames: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17"], monthNamesShort: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17"], dayNames: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19"], dayNamesShort: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19"], dayNamesMin: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19"], digits: null, dateFormat: "YYYY.m.d", firstDay: 0, isRTL: false, haabMonths: ["Pop", "Uo", "Zip", "Zotz", "Tzec", "Xul", "Yaxkin", "Mol", "Chen", "Yax", "Zac", "Ceh", "Mac", "Kankin", "Muan", "Pax", "Kayab", "Cumku", "Uayeb"], tzolkinMonths: ["Imix", "Ik", "Akbal", "Kan", "Chicchan", "Cimi", "Manik", "Lamat", "Muluc", "Oc", "Chuen", "Eb", "Ben", "Ix", "Men", "Cib", "Caban", "Etznab", "Cauac", "Ahau"] } }, leapYear: function(l) {
        return this._validate(l, this.minMonth, this.minDay, n.local.invalidYear), false;
      }, formatYear: function(l) {
        l = this._validate(l, this.minMonth, this.minDay, n.local.invalidYear).year();
        var u2 = Math.floor(l / 400);
        return l %= 400, l += l < 0 ? 400 : 0, u2 + "." + Math.floor(l / 20) + "." + l % 20;
      }, forYear: function(l) {
        if ((l = l.split(".")).length < 3) throw "Invalid Mayan year";
        for (var u2 = 0, c = 0; c < l.length; c++) {
          var f = parseInt(l[c], 10);
          if (Math.abs(f) > 19 || c > 0 && f < 0) throw "Invalid Mayan year";
          u2 = 20 * u2 + f;
        }
        return u2;
      }, monthsInYear: function(l) {
        return this._validate(l, this.minMonth, this.minDay, n.local.invalidYear), 18;
      }, weekOfYear: function(l, u2, c) {
        return this._validate(l, u2, c, n.local.invalidDate), 0;
      }, daysInYear: function(l) {
        return this._validate(l, this.minMonth, this.minDay, n.local.invalidYear), 360;
      }, daysInMonth: function(l, u2) {
        return this._validate(l, u2, this.minDay, n.local.invalidMonth), 20;
      }, daysInWeek: function() {
        return 5;
      }, dayOfWeek: function(l, u2, c) {
        return this._validate(l, u2, c, n.local.invalidDate).day();
      }, weekDay: function(l, u2, c) {
        return this._validate(l, u2, c, n.local.invalidDate), true;
      }, extraInfo: function(l, u2, c) {
        var f = this._validate(l, u2, c, n.local.invalidDate).toJD(), h = this._toHaab(f), p = this._toTzolkin(f);
        return { haabMonthName: this.local.haabMonths[h[0] - 1], haabMonth: h[0], haabDay: h[1], tzolkinDayName: this.local.tzolkinMonths[p[0] - 1], tzolkinDay: p[0], tzolkinTrecena: p[1] };
      }, _toHaab: function(l) {
        var u2 = s((l -= this.jdEpoch) + 8 + 340, 365);
        return [Math.floor(u2 / 20) + 1, s(u2, 20)];
      }, _toTzolkin: function(l) {
        return [i((l -= this.jdEpoch) + 20, 20), i(l + 4, 13)];
      }, toJD: function(l, u2, c) {
        var f = this._validate(l, u2, c, n.local.invalidDate);
        return f.day() + 20 * f.month() + 360 * f.year() + this.jdEpoch;
      }, fromJD: function(l) {
        l = Math.floor(l) + 0.5 - this.jdEpoch;
        var u2 = Math.floor(l / 360);
        l %= 360, l += l < 0 ? 360 : 0;
        var c = Math.floor(l / 20), f = l % 20;
        return this.newDate(u2, c, f);
      } }), n.calendars.mayan = o;
    }, { "../main": 346, "object-assign": 247 }], 340: [function(e, t, r) {
      var n = e("../main"), a = e("object-assign");
      function o(i) {
        this.local = this.regionalOptions[i || ""] || this.regionalOptions[""];
      }
      o.prototype = new n.baseCalendar();
      var s = n.instance("gregorian");
      a(o.prototype, { name: "Nanakshahi", jdEpoch: 22576735e-1, daysPerMonth: [31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 30, 30], hasYearZero: false, minMonth: 1, firstMonth: 1, minDay: 1, regionalOptions: { "": { name: "Nanakshahi", epochs: ["BN", "AN"], monthNames: ["Chet", "Vaisakh", "Jeth", "Harh", "Sawan", "Bhadon", "Assu", "Katak", "Maghar", "Poh", "Magh", "Phagun"], monthNamesShort: ["Che", "Vai", "Jet", "Har", "Saw", "Bha", "Ass", "Kat", "Mgr", "Poh", "Mgh", "Pha"], dayNames: ["Somvaar", "Mangalvar", "Budhvaar", "Veervaar", "Shukarvaar", "Sanicharvaar", "Etvaar"], dayNamesShort: ["Som", "Mangal", "Budh", "Veer", "Shukar", "Sanichar", "Et"], dayNamesMin: ["So", "Ma", "Bu", "Ve", "Sh", "Sa", "Et"], digits: null, dateFormat: "dd-mm-yyyy", firstDay: 0, isRTL: false } }, leapYear: function(i) {
        var l = this._validate(i, this.minMonth, this.minDay, n.local.invalidYear || n.regionalOptions[""].invalidYear);
        return s.leapYear(l.year() + (l.year() < 1 ? 1 : 0) + 1469);
      }, weekOfYear: function(i, l, u2) {
        var c = this.newDate(i, l, u2);
        return c.add(1 - (c.dayOfWeek() || 7), "d"), Math.floor((c.dayOfYear() - 1) / 7) + 1;
      }, daysInMonth: function(i, l) {
        var u2 = this._validate(i, l, this.minDay, n.local.invalidMonth);
        return this.daysPerMonth[u2.month() - 1] + (u2.month() === 12 && this.leapYear(u2.year()) ? 1 : 0);
      }, weekDay: function(i, l, u2) {
        return (this.dayOfWeek(i, l, u2) || 7) < 6;
      }, toJD: function(i, l, u2) {
        var c = this._validate(i, l, u2, n.local.invalidMonth);
        (i = c.year()) < 0 && i++;
        for (var f = c.day(), h = 1; h < c.month(); h++) f += this.daysPerMonth[h - 1];
        return f + s.toJD(i + 1468, 3, 13);
      }, fromJD: function(i) {
        i = Math.floor(i + 0.5);
        for (var l = Math.floor((i - (this.jdEpoch - 1)) / 366); i >= this.toJD(l + 1, 1, 1); ) l++;
        for (var u2 = i - Math.floor(this.toJD(l, 1, 1) + 0.5) + 1, c = 1; u2 > this.daysInMonth(l, c); ) u2 -= this.daysInMonth(l, c), c++;
        return this.newDate(l, c, u2);
      } }), n.calendars.nanakshahi = o;
    }, { "../main": 346, "object-assign": 247 }], 341: [function(e, t, r) {
      var n = e("../main"), a = e("object-assign");
      function o(s) {
        this.local = this.regionalOptions[s || ""] || this.regionalOptions[""];
      }
      o.prototype = new n.baseCalendar(), a(o.prototype, { name: "Nepali", jdEpoch: 17007095e-1, daysPerMonth: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], hasYearZero: false, minMonth: 1, firstMonth: 1, minDay: 1, daysPerYear: 365, regionalOptions: { "": { name: "Nepali", epochs: ["BBS", "ABS"], monthNames: ["Baisakh", "Jestha", "Ashadh", "Shrawan", "Bhadra", "Ashwin", "Kartik", "Mangsir", "Paush", "Mangh", "Falgun", "Chaitra"], monthNamesShort: ["Bai", "Je", "As", "Shra", "Bha", "Ash", "Kar", "Mang", "Pau", "Ma", "Fal", "Chai"], dayNames: ["Aaitabaar", "Sombaar", "Manglbaar", "Budhabaar", "Bihibaar", "Shukrabaar", "Shanibaar"], dayNamesShort: ["Aaita", "Som", "Mangl", "Budha", "Bihi", "Shukra", "Shani"], dayNamesMin: ["Aai", "So", "Man", "Bu", "Bi", "Shu", "Sha"], digits: null, dateFormat: "dd/mm/yyyy", firstDay: 1, isRTL: false } }, leapYear: function(s) {
        return this.daysInYear(s) !== this.daysPerYear;
      }, weekOfYear: function(s, i, l) {
        var u2 = this.newDate(s, i, l);
        return u2.add(-u2.dayOfWeek(), "d"), Math.floor((u2.dayOfYear() - 1) / 7) + 1;
      }, daysInYear: function(s) {
        if (s = this._validate(s, this.minMonth, this.minDay, n.local.invalidYear).year(), this.NEPALI_CALENDAR_DATA[s] === void 0) return this.daysPerYear;
        for (var i = 0, l = this.minMonth; l <= 12; l++) i += this.NEPALI_CALENDAR_DATA[s][l];
        return i;
      }, daysInMonth: function(s, i) {
        return s.year && (i = s.month(), s = s.year()), this._validate(s, i, this.minDay, n.local.invalidMonth), this.NEPALI_CALENDAR_DATA[s] === void 0 ? this.daysPerMonth[i - 1] : this.NEPALI_CALENDAR_DATA[s][i];
      }, weekDay: function(s, i, l) {
        return this.dayOfWeek(s, i, l) !== 6;
      }, toJD: function(s, i, l) {
        var u2 = this._validate(s, i, l, n.local.invalidDate);
        s = u2.year(), i = u2.month(), l = u2.day();
        var c = n.instance(), f = 0, h = i, p = s;
        this._createMissingCalendarData(s);
        var d = s - (h > 9 || h === 9 && l >= this.NEPALI_CALENDAR_DATA[p][0] ? 56 : 57);
        for (i !== 9 && (f = l, h--); h !== 9; ) h <= 0 && (h = 12, p--), f += this.NEPALI_CALENDAR_DATA[p][h], h--;
        return i === 9 ? (f += l - this.NEPALI_CALENDAR_DATA[p][0]) < 0 && (f += c.daysInYear(d)) : f += this.NEPALI_CALENDAR_DATA[p][9] - this.NEPALI_CALENDAR_DATA[p][0], c.newDate(d, 1, 1).add(f, "d").toJD();
      }, fromJD: function(s) {
        var i = n.instance().fromJD(s), l = i.year(), u2 = i.dayOfYear(), c = l + 56;
        this._createMissingCalendarData(c);
        for (var f = 9, h = this.NEPALI_CALENDAR_DATA[c][0], p = this.NEPALI_CALENDAR_DATA[c][f] - h + 1; u2 > p; ) ++f > 12 && (f = 1, c++), p += this.NEPALI_CALENDAR_DATA[c][f];
        var d = this.NEPALI_CALENDAR_DATA[c][f] - (p - u2);
        return this.newDate(c, f, d);
      }, _createMissingCalendarData: function(s) {
        var i = this.daysPerMonth.slice(0);
        i.unshift(17);
        for (var l = s - 1; l < s + 2; l++) this.NEPALI_CALENDAR_DATA[l] === void 0 && (this.NEPALI_CALENDAR_DATA[l] = i);
      }, NEPALI_CALENDAR_DATA: { 1970: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 1971: [18, 31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30], 1972: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], 1973: [19, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 1974: [19, 31, 31, 32, 30, 31, 31, 30, 29, 30, 29, 30, 30], 1975: [18, 31, 31, 32, 32, 30, 31, 30, 29, 30, 29, 30, 30], 1976: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 1977: [18, 31, 32, 31, 32, 31, 31, 29, 30, 29, 30, 29, 31], 1978: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 1979: [18, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 1980: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 1981: [18, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], 1982: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 1983: [18, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 1984: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 1985: [18, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], 1986: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 1987: [18, 31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30], 1988: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 1989: [18, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 1990: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 1991: [18, 31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30], 1992: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 1993: [18, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 1994: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 1995: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], 1996: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 1997: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 1998: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 1999: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 2e3: [17, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 2001: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 2002: [18, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 2003: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 2004: [17, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 2005: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 2006: [18, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 2007: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 2008: [17, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31], 2009: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 2010: [18, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 2011: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 2012: [17, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], 2013: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 2014: [18, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 2015: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 2016: [17, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], 2017: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 2018: [18, 31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30], 2019: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 2020: [17, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 2021: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 2022: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], 2023: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 2024: [17, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 2025: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 2026: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 2027: [17, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 2028: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 2029: [18, 31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30], 2030: [17, 31, 32, 31, 32, 31, 30, 30, 30, 30, 30, 30, 31], 2031: [17, 31, 32, 31, 32, 31, 31, 31, 31, 31, 31, 31, 31], 2032: [17, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32], 2033: [18, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 2034: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 2035: [17, 30, 32, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31], 2036: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 2037: [18, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 2038: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 2039: [17, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], 2040: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 2041: [18, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 2042: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 2043: [17, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], 2044: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 2045: [18, 31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30], 2046: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 2047: [17, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 2048: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 2049: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], 2050: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 2051: [17, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 2052: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 2053: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], 2054: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 2055: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 30, 29, 30], 2056: [17, 31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30], 2057: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 2058: [17, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 2059: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 2060: [17, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 2061: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 2062: [17, 30, 32, 31, 32, 31, 31, 29, 30, 29, 30, 29, 31], 2063: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 2064: [17, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 2065: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 2066: [17, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31], 2067: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 2068: [17, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 2069: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 2070: [17, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], 2071: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 2072: [17, 31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30], 2073: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 2074: [17, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 2075: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 2076: [16, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], 2077: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 2078: [17, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 2079: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 2080: [16, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], 2081: [17, 31, 31, 32, 32, 31, 30, 30, 30, 29, 30, 30, 30], 2082: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30], 2083: [17, 31, 31, 32, 31, 31, 30, 30, 30, 29, 30, 30, 30], 2084: [17, 31, 31, 32, 31, 31, 30, 30, 30, 29, 30, 30, 30], 2085: [17, 31, 32, 31, 32, 31, 31, 30, 30, 29, 30, 30, 30], 2086: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30], 2087: [16, 31, 31, 32, 31, 31, 31, 30, 30, 29, 30, 30, 30], 2088: [16, 30, 31, 32, 32, 30, 31, 30, 30, 29, 30, 30, 30], 2089: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30], 2090: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30], 2091: [16, 31, 31, 32, 31, 31, 31, 30, 30, 29, 30, 30, 30], 2092: [16, 31, 31, 32, 32, 31, 30, 30, 30, 29, 30, 30, 30], 2093: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30], 2094: [17, 31, 31, 32, 31, 31, 30, 30, 30, 29, 30, 30, 30], 2095: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 30, 30, 30], 2096: [17, 30, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 2097: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30], 2098: [17, 31, 31, 32, 31, 31, 31, 29, 30, 29, 30, 30, 31], 2099: [17, 31, 31, 32, 31, 31, 31, 30, 29, 29, 30, 30, 30], 2100: [17, 31, 32, 31, 32, 30, 31, 30, 29, 30, 29, 30, 30] } }), n.calendars.nepali = o;
    }, { "../main": 346, "object-assign": 247 }], 342: [function(e, t, r) {
      var n = e("../main"), a = e("object-assign");
      function o(i) {
        this.local = this.regionalOptions[i || ""] || this.regionalOptions[""];
      }
      function s(i, l) {
        return i - l * Math.floor(i / l);
      }
      o.prototype = new n.baseCalendar(), a(o.prototype, { name: "Persian", jdEpoch: 19483205e-1, daysPerMonth: [31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29], hasYearZero: false, minMonth: 1, firstMonth: 1, minDay: 1, regionalOptions: { "": { name: "Persian", epochs: ["BP", "AP"], monthNames: ["Farvardin", "Ordibehesht", "Khordad", "Tir", "Mordad", "Shahrivar", "Mehr", "Aban", "Azar", "Day", "Bahman", "Esfand"], monthNamesShort: ["Far", "Ord", "Kho", "Tir", "Mor", "Sha", "Meh", "Aba", "Aza", "Day", "Bah", "Esf"], dayNames: ["Yekshambe", "Doshambe", "Seshambe", "Ch\xE6harshambe", "Panjshambe", "Jom'e", "Shambe"], dayNamesShort: ["Yek", "Do", "Se", "Ch\xE6", "Panj", "Jom", "Sha"], dayNamesMin: ["Ye", "Do", "Se", "Ch", "Pa", "Jo", "Sh"], digits: null, dateFormat: "yyyy/mm/dd", firstDay: 6, isRTL: false } }, leapYear: function(i) {
        var l = this._validate(i, this.minMonth, this.minDay, n.local.invalidYear);
        return 682 * ((l.year() - (l.year() > 0 ? 474 : 473)) % 2820 + 474 + 38) % 2816 < 682;
      }, weekOfYear: function(i, l, u2) {
        var c = this.newDate(i, l, u2);
        return c.add(-(c.dayOfWeek() + 1) % 7, "d"), Math.floor((c.dayOfYear() - 1) / 7) + 1;
      }, daysInMonth: function(i, l) {
        var u2 = this._validate(i, l, this.minDay, n.local.invalidMonth);
        return this.daysPerMonth[u2.month() - 1] + (u2.month() === 12 && this.leapYear(u2.year()) ? 1 : 0);
      }, weekDay: function(i, l, u2) {
        return this.dayOfWeek(i, l, u2) !== 5;
      }, toJD: function(i, l, u2) {
        var c = this._validate(i, l, u2, n.local.invalidDate);
        i = c.year(), l = c.month(), u2 = c.day();
        var f = i - (i >= 0 ? 474 : 473), h = 474 + s(f, 2820);
        return u2 + (l <= 7 ? 31 * (l - 1) : 30 * (l - 1) + 6) + Math.floor((682 * h - 110) / 2816) + 365 * (h - 1) + 1029983 * Math.floor(f / 2820) + this.jdEpoch - 1;
      }, fromJD: function(i) {
        var l = (i = Math.floor(i) + 0.5) - this.toJD(475, 1, 1), u2 = Math.floor(l / 1029983), c = s(l, 1029983), f = 2820;
        if (c !== 1029982) {
          var h = Math.floor(c / 366), p = s(c, 366);
          f = Math.floor((2134 * h + 2816 * p + 2815) / 1028522) + h + 1;
        }
        var d = f + 2820 * u2 + 474;
        d = d <= 0 ? d - 1 : d;
        var v = i - this.toJD(d, 1, 1) + 1, m = v <= 186 ? Math.ceil(v / 31) : Math.ceil((v - 6) / 30), g = i - this.toJD(d, m, 1) + 1;
        return this.newDate(d, m, g);
      } }), n.calendars.persian = o, n.calendars.jalali = o;
    }, { "../main": 346, "object-assign": 247 }], 343: [function(e, t, r) {
      var n = e("../main"), a = e("object-assign"), o = n.instance();
      function s(i) {
        this.local = this.regionalOptions[i || ""] || this.regionalOptions[""];
      }
      s.prototype = new n.baseCalendar(), a(s.prototype, { name: "Taiwan", jdEpoch: 24194025e-1, yearsOffset: 1911, daysPerMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], hasYearZero: false, minMonth: 1, firstMonth: 1, minDay: 1, regionalOptions: { "": { name: "Taiwan", epochs: ["BROC", "ROC"], monthNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], dayNamesMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], digits: null, dateFormat: "yyyy/mm/dd", firstDay: 1, isRTL: false } }, leapYear: function(i) {
        var l = this._validate(i, this.minMonth, this.minDay, n.local.invalidYear);
        return i = this._t2gYear(l.year()), o.leapYear(i);
      }, weekOfYear: function(i, l, u2) {
        var c = this._validate(i, this.minMonth, this.minDay, n.local.invalidYear);
        return i = this._t2gYear(c.year()), o.weekOfYear(i, c.month(), c.day());
      }, daysInMonth: function(i, l) {
        var u2 = this._validate(i, l, this.minDay, n.local.invalidMonth);
        return this.daysPerMonth[u2.month() - 1] + (u2.month() === 2 && this.leapYear(u2.year()) ? 1 : 0);
      }, weekDay: function(i, l, u2) {
        return (this.dayOfWeek(i, l, u2) || 7) < 6;
      }, toJD: function(i, l, u2) {
        var c = this._validate(i, l, u2, n.local.invalidDate);
        return i = this._t2gYear(c.year()), o.toJD(i, c.month(), c.day());
      }, fromJD: function(i) {
        var l = o.fromJD(i), u2 = this._g2tYear(l.year());
        return this.newDate(u2, l.month(), l.day());
      }, _t2gYear: function(i) {
        return i + this.yearsOffset + (i >= -this.yearsOffset && i <= -1 ? 1 : 0);
      }, _g2tYear: function(i) {
        return i - this.yearsOffset - (i >= 1 && i <= this.yearsOffset ? 1 : 0);
      } }), n.calendars.taiwan = s;
    }, { "../main": 346, "object-assign": 247 }], 344: [function(e, t, r) {
      var n = e("../main"), a = e("object-assign"), o = n.instance();
      function s(i) {
        this.local = this.regionalOptions[i || ""] || this.regionalOptions[""];
      }
      s.prototype = new n.baseCalendar(), a(s.prototype, { name: "Thai", jdEpoch: 15230985e-1, yearsOffset: 543, daysPerMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], hasYearZero: false, minMonth: 1, firstMonth: 1, minDay: 1, regionalOptions: { "": { name: "Thai", epochs: ["BBE", "BE"], monthNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], dayNamesMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], digits: null, dateFormat: "dd/mm/yyyy", firstDay: 0, isRTL: false } }, leapYear: function(i) {
        var l = this._validate(i, this.minMonth, this.minDay, n.local.invalidYear);
        return i = this._t2gYear(l.year()), o.leapYear(i);
      }, weekOfYear: function(i, l, u2) {
        var c = this._validate(i, this.minMonth, this.minDay, n.local.invalidYear);
        return i = this._t2gYear(c.year()), o.weekOfYear(i, c.month(), c.day());
      }, daysInMonth: function(i, l) {
        var u2 = this._validate(i, l, this.minDay, n.local.invalidMonth);
        return this.daysPerMonth[u2.month() - 1] + (u2.month() === 2 && this.leapYear(u2.year()) ? 1 : 0);
      }, weekDay: function(i, l, u2) {
        return (this.dayOfWeek(i, l, u2) || 7) < 6;
      }, toJD: function(i, l, u2) {
        var c = this._validate(i, l, u2, n.local.invalidDate);
        return i = this._t2gYear(c.year()), o.toJD(i, c.month(), c.day());
      }, fromJD: function(i) {
        var l = o.fromJD(i), u2 = this._g2tYear(l.year());
        return this.newDate(u2, l.month(), l.day());
      }, _t2gYear: function(i) {
        return i - this.yearsOffset - (i >= 1 && i <= this.yearsOffset ? 1 : 0);
      }, _g2tYear: function(i) {
        return i + this.yearsOffset + (i >= -this.yearsOffset && i <= -1 ? 1 : 0);
      } }), n.calendars.thai = s;
    }, { "../main": 346, "object-assign": 247 }], 345: [function(e, t, r) {
      var n = e("../main"), a = e("object-assign");
      function o(i) {
        this.local = this.regionalOptions[i || ""] || this.regionalOptions[""];
      }
      o.prototype = new n.baseCalendar(), a(o.prototype, { name: "UmmAlQura", hasYearZero: false, minMonth: 1, firstMonth: 1, minDay: 1, regionalOptions: { "": { name: "Umm al-Qura", epochs: ["BH", "AH"], monthNames: ["Al-Muharram", "Safar", "Rabi' al-awwal", "Rabi' Al-Thani", "Jumada Al-Awwal", "Jumada Al-Thani", "Rajab", "Sha'aban", "Ramadan", "Shawwal", "Dhu al-Qi'dah", "Dhu al-Hijjah"], monthNamesShort: ["Muh", "Saf", "Rab1", "Rab2", "Jum1", "Jum2", "Raj", "Sha'", "Ram", "Shaw", "DhuQ", "DhuH"], 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"], dayNamesMin: ["Ah", "Ith", "Th", "Ar", "Kh", "Ju", "Sa"], digits: null, dateFormat: "yyyy/mm/dd", firstDay: 6, isRTL: true } }, leapYear: function(i) {
        var l = this._validate(i, this.minMonth, this.minDay, n.local.invalidYear);
        return this.daysInYear(l.year()) === 355;
      }, weekOfYear: function(i, l, u2) {
        var c = this.newDate(i, l, u2);
        return c.add(-c.dayOfWeek(), "d"), Math.floor((c.dayOfYear() - 1) / 7) + 1;
      }, daysInYear: function(i) {
        for (var l = 0, u2 = 1; u2 <= 12; u2++) l += this.daysInMonth(i, u2);
        return l;
      }, daysInMonth: function(i, l) {
        for (var u2 = this._validate(i, l, this.minDay, n.local.invalidMonth).toJD() - 24e5 + 0.5, c = 0, f = 0; f < s.length; f++) {
          if (s[f] > u2) return s[c] - s[c - 1];
          c++;
        }
        return 30;
      }, weekDay: function(i, l, u2) {
        return this.dayOfWeek(i, l, u2) !== 5;
      }, toJD: function(i, l, u2) {
        var c = this._validate(i, l, u2, n.local.invalidDate), f = 12 * (c.year() - 1) + c.month() - 15292;
        return c.day() + s[f - 1] - 1 + 24e5 - 0.5;
      }, fromJD: function(i) {
        for (var l = i - 24e5 + 0.5, u2 = 0, c = 0; c < s.length && !(s[c] > l); c++) u2++;
        var f = u2 + 15292, h = Math.floor((f - 1) / 12), p = h + 1, d = f - 12 * h, v = l - s[u2 - 1] + 1;
        return this.newDate(p, d, v);
      }, isValid: function(i, l, u2) {
        var c = n.baseCalendar.prototype.isValid.apply(this, arguments);
        return c && (c = (i = i.year != null ? i.year : i) >= 1276 && i <= 1500), c;
      }, _validate: function(i, l, u2, c) {
        var f = n.baseCalendar.prototype._validate.apply(this, arguments);
        if (f.year < 1276 || f.year > 1500) throw c.replace(/\{0\}/, this.local.name);
        return f;
      } }), n.calendars.ummalqura = o;
      var s = [20, 50, 79, 109, 138, 168, 197, 227, 256, 286, 315, 345, 374, 404, 433, 463, 492, 522, 551, 581, 611, 641, 670, 700, 729, 759, 788, 818, 847, 877, 906, 936, 965, 995, 1024, 1054, 1083, 1113, 1142, 1172, 1201, 1231, 1260, 1290, 1320, 1350, 1379, 1409, 1438, 1468, 1497, 1527, 1556, 1586, 1615, 1645, 1674, 1704, 1733, 1763, 1792, 1822, 1851, 1881, 1910, 1940, 1969, 1999, 2028, 2058, 2087, 2117, 2146, 2176, 2205, 2235, 2264, 2294, 2323, 2353, 2383, 2413, 2442, 2472, 2501, 2531, 2560, 2590, 2619, 2649, 2678, 2708, 2737, 2767, 2796, 2826, 2855, 2885, 2914, 2944, 2973, 3003, 3032, 3062, 3091, 3121, 3150, 3180, 3209, 3239, 3268, 3298, 3327, 3357, 3386, 3416, 3446, 3476, 3505, 3535, 3564, 3594, 3623, 3653, 3682, 3712, 3741, 3771, 3800, 3830, 3859, 3889, 3918, 3948, 3977, 4007, 4036, 4066, 4095, 4125, 4155, 4185, 4214, 4244, 4273, 4303, 4332, 4362, 4391, 4421, 4450, 4480, 4509, 4539, 4568, 4598, 4627, 4657, 4686, 4716, 4745, 4775, 4804, 4834, 4863, 4893, 4922, 4952, 4981, 5011, 5040, 5070, 5099, 5129, 5158, 5188, 5218, 5248, 5277, 5307, 5336, 5366, 5395, 5425, 5454, 5484, 5513, 5543, 5572, 5602, 5631, 5661, 5690, 5720, 5749, 5779, 5808, 5838, 5867, 5897, 5926, 5956, 5985, 6015, 6044, 6074, 6103, 6133, 6162, 6192, 6221, 6251, 6281, 6311, 6340, 6370, 6399, 6429, 6458, 6488, 6517, 6547, 6576, 6606, 6635, 6665, 6694, 6724, 6753, 6783, 6812, 6842, 6871, 6901, 6930, 6960, 6989, 7019, 7048, 7078, 7107, 7137, 7166, 7196, 7225, 7255, 7284, 7314, 7344, 7374, 7403, 7433, 7462, 7492, 7521, 7551, 7580, 7610, 7639, 7669, 7698, 7728, 7757, 7787, 7816, 7846, 7875, 7905, 7934, 7964, 7993, 8023, 8053, 8083, 8112, 8142, 8171, 8201, 8230, 8260, 8289, 8319, 8348, 8378, 8407, 8437, 8466, 8496, 8525, 8555, 8584, 8614, 8643, 8673, 8702, 8732, 8761, 8791, 8821, 8850, 8880, 8909, 8938, 8968, 8997, 9027, 9056, 9086, 9115, 9145, 9175, 9205, 9234, 9264, 9293, 9322, 9352, 9381, 9410, 9440, 9470, 9499, 9529, 9559, 9589, 9618, 9648, 9677, 9706, 9736, 9765, 9794, 9824, 9853, 9883, 9913, 9943, 9972, 10002, 10032, 10061, 10090, 10120, 10149, 10178, 10208, 10237, 10267, 10297, 10326, 10356, 10386, 10415, 10445, 10474, 10504, 10533, 10562, 10592, 10621, 10651, 10680, 10710, 10740, 10770, 10799, 10829, 10858, 10888, 10917, 10947, 10976, 11005, 11035, 11064, 11094, 11124, 11153, 11183, 11213, 11242, 11272, 11301, 11331, 11360, 11389, 11419, 11448, 11478, 11507, 11537, 11567, 11596, 11626, 11655, 11685, 11715, 11744, 11774, 11803, 11832, 11862, 11891, 11921, 11950, 11980, 12010, 12039, 12069, 12099, 12128, 12158, 12187, 12216, 12246, 12275, 12304, 12334, 12364, 12393, 12423, 12453, 12483, 12512, 12542, 12571, 12600, 12630, 12659, 12688, 12718, 12747, 12777, 12807, 12837, 12866, 12896, 12926, 12955, 12984, 13014, 13043, 13072, 13102, 13131, 13161, 13191, 13220, 13250, 13280, 13310, 13339, 13368, 13398, 13427, 13456, 13486, 13515, 13545, 13574, 13604, 13634, 13664, 13693, 13723, 13752, 13782, 13811, 13840, 13870, 13899, 13929, 13958, 13988, 14018, 14047, 14077, 14107, 14136, 14166, 14195, 14224, 14254, 14283, 14313, 14342, 14372, 14401, 14431, 14461, 14490, 14520, 14550, 14579, 14609, 14638, 14667, 14697, 14726, 14756, 14785, 14815, 14844, 14874, 14904, 14933, 14963, 14993, 15021, 15051, 15081, 15110, 15140, 15169, 15199, 15228, 15258, 15287, 15317, 15347, 15377, 15406, 15436, 15465, 15494, 15524, 15553, 15582, 15612, 15641, 15671, 15701, 15731, 15760, 15790, 15820, 15849, 15878, 15908, 15937, 15966, 15996, 16025, 16055, 16085, 16114, 16144, 16174, 16204, 16233, 16262, 16292, 16321, 16350, 16380, 16409, 16439, 16468, 16498, 16528, 16558, 16587, 16617, 16646, 16676, 16705, 16734, 16764, 16793, 16823, 16852, 16882, 16912, 16941, 16971, 17001, 17030, 17060, 17089, 17118, 17148, 17177, 17207, 17236, 17266, 17295, 17325, 17355, 17384, 17414, 17444, 17473, 17502, 17532, 17561, 17591, 17620, 17650, 17679, 17709, 17738, 17768, 17798, 17827, 17857, 17886, 17916, 17945, 17975, 18004, 18034, 18063, 18093, 18122, 18152, 18181, 18211, 18241, 18270, 18300, 18330, 18359, 18388, 18418, 18447, 18476, 18506, 18535, 18565, 18595, 18625, 18654, 18684, 18714, 18743, 18772, 18802, 18831, 18860, 18890, 18919, 18949, 18979, 19008, 19038, 19068, 19098, 19127, 19156, 19186, 19215, 19244, 19274, 19303, 19333, 19362, 19392, 19422, 19452, 19481, 19511, 19540, 19570, 19599, 19628, 19658, 19687, 19717, 19746, 19776, 19806, 19836, 19865, 19895, 19924, 19954, 19983, 20012, 20042, 20071, 20101, 20130, 20160, 20190, 20219, 20249, 20279, 20308, 20338, 20367, 20396, 20426, 20455, 20485, 20514, 20544, 20573, 20603, 20633, 20662, 20692, 20721, 20751, 20780, 20810, 20839, 20869, 20898, 20928, 20957, 20987, 21016, 21046, 21076, 21105, 21135, 21164, 21194, 21223, 21253, 21282, 21312, 21341, 21371, 21400, 21430, 21459, 21489, 21519, 21548, 21578, 21607, 21637, 21666, 21696, 21725, 21754, 21784, 21813, 21843, 21873, 21902, 21932, 21962, 21991, 22021, 22050, 22080, 22109, 22138, 22168, 22197, 22227, 22256, 22286, 22316, 22346, 22375, 22405, 22434, 22464, 22493, 22522, 22552, 22581, 22611, 22640, 22670, 22700, 22730, 22759, 22789, 22818, 22848, 22877, 22906, 22936, 22965, 22994, 23024, 23054, 23083, 23113, 23143, 23173, 23202, 23232, 23261, 23290, 23320, 23349, 23379, 23408, 23438, 23467, 23497, 23527, 23556, 23586, 23616, 23645, 23674, 23704, 23733, 23763, 23792, 23822, 23851, 23881, 23910, 23940, 23970, 23999, 24029, 24058, 24088, 24117, 24147, 24176, 24206, 24235, 24265, 24294, 24324, 24353, 24383, 24413, 24442, 24472, 24501, 24531, 24560, 24590, 24619, 24648, 24678, 24707, 24737, 24767, 24796, 24826, 24856, 24885, 24915, 24944, 24974, 25003, 25032, 25062, 25091, 25121, 25150, 25180, 25210, 25240, 25269, 25299, 25328, 25358, 25387, 25416, 25446, 25475, 25505, 25534, 25564, 25594, 25624, 25653, 25683, 25712, 25742, 25771, 25800, 25830, 25859, 25888, 25918, 25948, 25977, 26007, 26037, 26067, 26096, 26126, 26155, 26184, 26214, 26243, 26272, 26302, 26332, 26361, 26391, 26421, 26451, 26480, 26510, 26539, 26568, 26598, 26627, 26656, 26686, 26715, 26745, 26775, 26805, 26834, 26864, 26893, 26923, 26952, 26982, 27011, 27041, 27070, 27099, 27129, 27159, 27188, 27218, 27248, 27277, 27307, 27336, 27366, 27395, 27425, 27454, 27484, 27513, 27542, 27572, 27602, 27631, 27661, 27691, 27720, 27750, 27779, 27809, 27838, 27868, 27897, 27926, 27956, 27985, 28015, 28045, 28074, 28104, 28134, 28163, 28193, 28222, 28252, 28281, 28310, 28340, 28369, 28399, 28428, 28458, 28488, 28517, 28547, 28577, 28607, 28636, 28665, 28695, 28724, 28754, 28783, 28813, 28843, 28872, 28901, 28931, 28960, 28990, 29019, 29049, 29078, 29108, 29137, 29167, 29196, 29226, 29255, 29285, 29315, 29345, 29375, 29404, 29434, 29463, 29492, 29522, 29551, 29580, 29610, 29640, 29669, 29699, 29729, 29759, 29788, 29818, 29847, 29876, 29906, 29935, 29964, 29994, 30023, 30053, 30082, 30112, 30141, 30171, 30200, 30230, 30259, 30289, 30318, 30348, 30378, 30408, 30437, 30467, 30496, 30526, 30555, 30585, 30614, 30644, 30673, 30703, 30732, 30762, 30791, 30821, 30850, 30880, 30909, 30939, 30968, 30998, 31027, 31057, 31086, 31116, 31145, 31175, 31204, 31234, 31263, 31293, 31322, 31352, 31381, 31411, 31441, 31471, 31500, 31530, 31559, 31589, 31618, 31648, 31676, 31706, 31736, 31766, 31795, 31825, 31854, 31884, 31913, 31943, 31972, 32002, 32031, 32061, 32090, 32120, 32150, 32180, 32209, 32239, 32268, 32298, 32327, 32357, 32386, 32416, 32445, 32475, 32504, 32534, 32563, 32593, 32622, 32652, 32681, 32711, 32740, 32770, 32799, 32829, 32858, 32888, 32917, 32947, 32976, 33006, 33035, 33065, 33094, 33124, 33153, 33183, 33213, 33243, 33272, 33302, 33331, 33361, 33390, 33420, 33450, 33479, 33509, 33539, 33568, 33598, 33627, 33657, 33686, 33716, 33745, 33775, 33804, 33834, 33863, 33893, 33922, 33952, 33981, 34011, 34040, 34069, 34099, 34128, 34158, 34187, 34217, 34247, 34277, 34306, 34336, 34365, 34395, 34424, 34454, 34483, 34512, 34542, 34571, 34601, 34631, 34660, 34690, 34719, 34749, 34778, 34808, 34837, 34867, 34896, 34926, 34955, 34985, 35015, 35044, 35074, 35103, 35133, 35162, 35192, 35222, 35251, 35280, 35310, 35340, 35370, 35399, 35429, 35458, 35488, 35517, 35547, 35576, 35605, 35635, 35665, 35694, 35723, 35753, 35782, 35811, 35841, 35871, 35901, 35930, 35960, 35989, 36019, 36048, 36078, 36107, 36136, 36166, 36195, 36225, 36254, 36284, 36314, 36343, 36373, 36403, 36433, 36462, 36492, 36521, 36551, 36580, 36610, 36639, 36669, 36698, 36728, 36757, 36786, 36816, 36845, 36875, 36904, 36934, 36963, 36993, 37022, 37052, 37081, 37111, 37141, 37170, 37200, 37229, 37259, 37288, 37318, 37347, 37377, 37406, 37436, 37465, 37495, 37524, 37554, 37584, 37613, 37643, 37672, 37701, 37731, 37760, 37790, 37819, 37849, 37878, 37908, 37938, 37967, 37997, 38027, 38056, 38085, 38115, 38144, 38174, 38203, 38233, 38262, 38292, 38322, 38351, 38381, 38410, 38440, 38469, 38499, 38528, 38558, 38587, 38617, 38646, 38676, 38705, 38735, 38764, 38794, 38823, 38853, 38882, 38912, 38941, 38971, 39001, 39030, 39059, 39089, 39118, 39148, 39178, 39208, 39237, 39267, 39297, 39326, 39355, 39385, 39414, 39444, 39473, 39503, 39532, 39562, 39592, 39621, 39650, 39680, 39709, 39739, 39768, 39798, 39827, 39857, 39886, 39916, 39946, 39975, 40005, 40035, 40064, 40094, 40123, 40153, 40182, 40212, 40241, 40271, 40300, 40330, 40359, 40389, 40418, 40448, 40477, 40507, 40536, 40566, 40595, 40625, 40655, 40685, 40714, 40744, 40773, 40803, 40832, 40862, 40892, 40921, 40951, 40980, 41009, 41039, 41068, 41098, 41127, 41157, 41186, 41216, 41245, 41275, 41304, 41334, 41364, 41393, 41422, 41452, 41481, 41511, 41540, 41570, 41599, 41629, 41658, 41688, 41718, 41748, 41777, 41807, 41836, 41865, 41894, 41924, 41953, 41983, 42012, 42042, 42072, 42102, 42131, 42161, 42190, 42220, 42249, 42279, 42308, 42337, 42367, 42397, 42426, 42456, 42485, 42515, 42545, 42574, 42604, 42633, 42662, 42692, 42721, 42751, 42780, 42810, 42839, 42869, 42899, 42929, 42958, 42988, 43017, 43046, 43076, 43105, 43135, 43164, 43194, 43223, 43253, 43283, 43312, 43342, 43371, 43401, 43430, 43460, 43489, 43519, 43548, 43578, 43607, 43637, 43666, 43696, 43726, 43755, 43785, 43814, 43844, 43873, 43903, 43932, 43962, 43991, 44021, 44050, 44080, 44109, 44139, 44169, 44198, 44228, 44258, 44287, 44317, 44346, 44375, 44405, 44434, 44464, 44493, 44523, 44553, 44582, 44612, 44641, 44671, 44700, 44730, 44759, 44788, 44818, 44847, 44877, 44906, 44936, 44966, 44996, 45025, 45055, 45084, 45114, 45143, 45172, 45202, 45231, 45261, 45290, 45320, 45350, 45380, 45409, 45439, 45468, 45498, 45527, 45556, 45586, 45615, 45644, 45674, 45704, 45733, 45763, 45793, 45823, 45852, 45882, 45911, 45940, 45970, 45999, 46028, 46058, 46088, 46117, 46147, 46177, 46206, 46236, 46265, 46295, 46324, 46354, 46383, 46413, 46442, 46472, 46501, 46531, 46560, 46590, 46620, 46649, 46679, 46708, 46738, 46767, 46797, 46826, 46856, 46885, 46915, 46944, 46974, 47003, 47033, 47063, 47092, 47122, 47151, 47181, 47210, 47240, 47269, 47298, 47328, 47357, 47387, 47417, 47446, 47476, 47506, 47535, 47565, 47594, 47624, 47653, 47682, 47712, 47741, 47771, 47800, 47830, 47860, 47890, 47919, 47949, 47978, 48008, 48037, 48066, 48096, 48125, 48155, 48184, 48214, 48244, 48273, 48303, 48333, 48362, 48392, 48421, 48450, 48480, 48509, 48538, 48568, 48598, 48627, 48657, 48687, 48717, 48746, 48776, 48805, 48834, 48864, 48893, 48922, 48952, 48982, 49011, 49041, 49071, 49100, 49130, 49160, 49189, 49218, 49248, 49277, 49306, 49336, 49365, 49395, 49425, 49455, 49484, 49514, 49543, 49573, 49602, 49632, 49661, 49690, 49720, 49749, 49779, 49809, 49838, 49868, 49898, 49927, 49957, 49986, 50016, 50045, 50075, 50104, 50133, 50163, 50192, 50222, 50252, 50281, 50311, 50340, 50370, 50400, 50429, 50459, 50488, 50518, 50547, 50576, 50606, 50635, 50665, 50694, 50724, 50754, 50784, 50813, 50843, 50872, 50902, 50931, 50960, 50990, 51019, 51049, 51078, 51108, 51138, 51167, 51197, 51227, 51256, 51286, 51315, 51345, 51374, 51403, 51433, 51462, 51492, 51522, 51552, 51582, 51611, 51641, 51670, 51699, 51729, 51758, 51787, 51816, 51846, 51876, 51906, 51936, 51965, 51995, 52025, 52054, 52083, 52113, 52142, 52171, 52200, 52230, 52260, 52290, 52319, 52349, 52379, 52408, 52438, 52467, 52497, 52526, 52555, 52585, 52614, 52644, 52673, 52703, 52733, 52762, 52792, 52822, 52851, 52881, 52910, 52939, 52969, 52998, 53028, 53057, 53087, 53116, 53146, 53176, 53205, 53235, 53264, 53294, 53324, 53353, 53383, 53412, 53441, 53471, 53500, 53530, 53559, 53589, 53619, 53648, 53678, 53708, 53737, 53767, 53796, 53825, 53855, 53884, 53913, 53943, 53973, 54003, 54032, 54062, 54092, 54121, 54151, 54180, 54209, 54239, 54268, 54297, 54327, 54357, 54387, 54416, 54446, 54476, 54505, 54535, 54564, 54593, 54623, 54652, 54681, 54711, 54741, 54770, 54800, 54830, 54859, 54889, 54919, 54948, 54977, 55007, 55036, 55066, 55095, 55125, 55154, 55184, 55213, 55243, 55273, 55302, 55332, 55361, 55391, 55420, 55450, 55479, 55508, 55538, 55567, 55597, 55627, 55657, 55686, 55716, 55745, 55775, 55804, 55834, 55863, 55892, 55922, 55951, 55981, 56011, 56040, 56070, 56100, 56129, 56159, 56188, 56218, 56247, 56276, 56306, 56335, 56365, 56394, 56424, 56454, 56483, 56513, 56543, 56572, 56601, 56631, 56660, 56690, 56719, 56749, 56778, 56808, 56837, 56867, 56897, 56926, 56956, 56985, 57015, 57044, 57074, 57103, 57133, 57162, 57192, 57221, 57251, 57280, 57310, 57340, 57369, 57399, 57429, 57458, 57487, 57517, 57546, 57576, 57605, 57634, 57664, 57694, 57723, 57753, 57783, 57813, 57842, 57871, 57901, 57930, 57959, 57989, 58018, 58048, 58077, 58107, 58137, 58167, 58196, 58226, 58255, 58285, 58314, 58343, 58373, 58402, 58432, 58461, 58491, 58521, 58551, 58580, 58610, 58639, 58669, 58698, 58727, 58757, 58786, 58816, 58845, 58875, 58905, 58934, 58964, 58994, 59023, 59053, 59082, 59111, 59141, 59170, 59200, 59229, 59259, 59288, 59318, 59348, 59377, 59407, 59436, 59466, 59495, 59525, 59554, 59584, 59613, 59643, 59672, 59702, 59731, 59761, 59791, 59820, 59850, 59879, 59909, 59939, 59968, 59997, 60027, 60056, 60086, 60115, 60145, 60174, 60204, 60234, 60264, 60293, 60323, 60352, 60381, 60411, 60440, 60469, 60499, 60528, 60558, 60588, 60618, 60648, 60677, 60707, 60736, 60765, 60795, 60824, 60853, 60883, 60912, 60942, 60972, 61002, 61031, 61061, 61090, 61120, 61149, 61179, 61208, 61237, 61267, 61296, 61326, 61356, 61385, 61415, 61445, 61474, 61504, 61533, 61563, 61592, 61621, 61651, 61680, 61710, 61739, 61769, 61799, 61828, 61858, 61888, 61917, 61947, 61976, 62006, 62035, 62064, 62094, 62123, 62153, 62182, 62212, 62242, 62271, 62301, 62331, 62360, 62390, 62419, 62448, 62478, 62507, 62537, 62566, 62596, 62625, 62655, 62685, 62715, 62744, 62774, 62803, 62832, 62862, 62891, 62921, 62950, 62980, 63009, 63039, 63069, 63099, 63128, 63157, 63187, 63216, 63246, 63275, 63305, 63334, 63363, 63393, 63423, 63453, 63482, 63512, 63541, 63571, 63600, 63630, 63659, 63689, 63718, 63747, 63777, 63807, 63836, 63866, 63895, 63925, 63955, 63984, 64014, 64043, 64073, 64102, 64131, 64161, 64190, 64220, 64249, 64279, 64309, 64339, 64368, 64398, 64427, 64457, 64486, 64515, 64545, 64574, 64603, 64633, 64663, 64692, 64722, 64752, 64782, 64811, 64841, 64870, 64899, 64929, 64958, 64987, 65017, 65047, 65076, 65106, 65136, 65166, 65195, 65225, 65254, 65283, 65313, 65342, 65371, 65401, 65431, 65460, 65490, 65520, 65549, 65579, 65608, 65638, 65667, 65697, 65726, 65755, 65785, 65815, 65844, 65874, 65903, 65933, 65963, 65992, 66022, 66051, 66081, 66110, 66140, 66169, 66199, 66228, 66258, 66287, 66317, 66346, 66376, 66405, 66435, 66465, 66494, 66524, 66553, 66583, 66612, 66641, 66671, 66700, 66730, 66760, 66789, 66819, 66849, 66878, 66908, 66937, 66967, 66996, 67025, 67055, 67084, 67114, 67143, 67173, 67203, 67233, 67262, 67292, 67321, 67351, 67380, 67409, 67439, 67468, 67497, 67527, 67557, 67587, 67617, 67646, 67676, 67705, 67735, 67764, 67793, 67823, 67852, 67882, 67911, 67941, 67971, 68e3, 68030, 68060, 68089, 68119, 68148, 68177, 68207, 68236, 68266, 68295, 68325, 68354, 68384, 68414, 68443, 68473, 68502, 68532, 68561, 68591, 68620, 68650, 68679, 68708, 68738, 68768, 68797, 68827, 68857, 68886, 68916, 68946, 68975, 69004, 69034, 69063, 69092, 69122, 69152, 69181, 69211, 69240, 69270, 69300, 69330, 69359, 69388, 69418, 69447, 69476, 69506, 69535, 69565, 69595, 69624, 69654, 69684, 69713, 69743, 69772, 69802, 69831, 69861, 69890, 69919, 69949, 69978, 70008, 70038, 70067, 70097, 70126, 70156, 70186, 70215, 70245, 70274, 70303, 70333, 70362, 70392, 70421, 70451, 70481, 70510, 70540, 70570, 70599, 70629, 70658, 70687, 70717, 70746, 70776, 70805, 70835, 70864, 70894, 70924, 70954, 70983, 71013, 71042, 71071, 71101, 71130, 71159, 71189, 71218, 71248, 71278, 71308, 71337, 71367, 71397, 71426, 71455, 71485, 71514, 71543, 71573, 71602, 71632, 71662, 71691, 71721, 71751, 71781, 71810, 71839, 71869, 71898, 71927, 71957, 71986, 72016, 72046, 72075, 72105, 72135, 72164, 72194, 72223, 72253, 72282, 72311, 72341, 72370, 72400, 72429, 72459, 72489, 72518, 72548, 72577, 72607, 72637, 72666, 72695, 72725, 72754, 72784, 72813, 72843, 72872, 72902, 72931, 72961, 72991, 73020, 73050, 73080, 73109, 73139, 73168, 73197, 73227, 73256, 73286, 73315, 73345, 73375, 73404, 73434, 73464, 73493, 73523, 73552, 73581, 73611, 73640, 73669, 73699, 73729, 73758, 73788, 73818, 73848, 73877, 73907, 73936, 73965, 73995, 74024, 74053, 74083, 74113, 74142, 74172, 74202, 74231, 74261, 74291, 74320, 74349, 74379, 74408, 74437, 74467, 74497, 74526, 74556, 74586, 74615, 74645, 74675, 74704, 74733, 74763, 74792, 74822, 74851, 74881, 74910, 74940, 74969, 74999, 75029, 75058, 75088, 75117, 75147, 75176, 75206, 75235, 75264, 75294, 75323, 75353, 75383, 75412, 75442, 75472, 75501, 75531, 75560, 75590, 75619, 75648, 75678, 75707, 75737, 75766, 75796, 75826, 75856, 75885, 75915, 75944, 75974, 76003, 76032, 76062, 76091, 76121, 76150, 76180, 76210, 76239, 76269, 76299, 76328, 76358, 76387, 76416, 76446, 76475, 76505, 76534, 76564, 76593, 76623, 76653, 76682, 76712, 76741, 76771, 76801, 76830, 76859, 76889, 76918, 76948, 76977, 77007, 77036, 77066, 77096, 77125, 77155, 77185, 77214, 77243, 77273, 77302, 77332, 77361, 77390, 77420, 77450, 77479, 77509, 77539, 77569, 77598, 77627, 77657, 77686, 77715, 77745, 77774, 77804, 77833, 77863, 77893, 77923, 77952, 77982, 78011, 78041, 78070, 78099, 78129, 78158, 78188, 78217, 78247, 78277, 78307, 78336, 78366, 78395, 78425, 78454, 78483, 78513, 78542, 78572, 78601, 78631, 78661, 78690, 78720, 78750, 78779, 78808, 78838, 78867, 78897, 78926, 78956, 78985, 79015, 79044, 79074, 79104, 79133, 79163, 79192, 79222, 79251, 79281, 79310, 79340, 79369, 79399, 79428, 79458, 79487, 79517, 79546, 79576, 79606, 79635, 79665, 79695, 79724, 79753, 79783, 79812, 79841, 79871, 79900, 79930, 79960, 79990];
    }, { "../main": 346, "object-assign": 247 }], 346: [function(e, t, r) {
      var n = e("object-assign");
      function a() {
        this.regionalOptions = [], this.regionalOptions[""] = { invalidCalendar: "Calendar {0} not found", invalidDate: "Invalid {0} date", invalidMonth: "Invalid {0} month", invalidYear: "Invalid {0} year", differentCalendars: "Cannot mix {0} and {1} dates" }, this.local = this.regionalOptions[""], this.calendars = {}, this._localCals = {};
      }
      function o(c, f, h, p) {
        if (this._calendar = c, this._year = f, this._month = h, this._day = p, this._calendar._validateLevel === 0 && !this._calendar.isValid(this._year, this._month, this._day)) throw (u2.local.invalidDate || u2.regionalOptions[""].invalidDate).replace(/\{0\}/, this._calendar.local.name);
      }
      function s(c, f) {
        return "000000".substring(0, f - (c = "" + c).length) + c;
      }
      function i() {
        this.shortYearCutoff = "+10";
      }
      function l(c) {
        this.local = this.regionalOptions[c] || this.regionalOptions[""];
      }
      n(a.prototype, { instance: function(c, f) {
        c = (c || "gregorian").toLowerCase(), f = f || "";
        var h = this._localCals[c + "-" + f];
        if (!h && this.calendars[c] && (h = new this.calendars[c](f), this._localCals[c + "-" + f] = h), !h) throw (this.local.invalidCalendar || this.regionalOptions[""].invalidCalendar).replace(/\{0\}/, c);
        return h;
      }, newDate: function(c, f, h, p, d) {
        return (p = (c != null && c.year ? c.calendar() : typeof p == "string" ? this.instance(p, d) : p) || this.instance()).newDate(c, f, h);
      }, substituteDigits: function(c) {
        return function(f) {
          return (f + "").replace(/[0-9]/g, function(h) {
            return c[h];
          });
        };
      }, substituteChineseDigits: function(c, f) {
        return function(h) {
          for (var p = "", d = 0; h > 0; ) {
            var v = h % 10;
            p = (v === 0 ? "" : c[v] + f[d]) + p, d++, h = Math.floor(h / 10);
          }
          return p.indexOf(c[1] + f[1]) === 0 && (p = p.substr(1)), p || c[0];
        };
      } }), n(o.prototype, { newDate: function(c, f, h) {
        return this._calendar.newDate(c ?? this, f, h);
      }, year: function(c) {
        return arguments.length === 0 ? this._year : this.set(c, "y");
      }, month: function(c) {
        return arguments.length === 0 ? this._month : this.set(c, "m");
      }, day: function(c) {
        return arguments.length === 0 ? this._day : this.set(c, "d");
      }, date: function(c, f, h) {
        if (!this._calendar.isValid(c, f, h)) throw (u2.local.invalidDate || u2.regionalOptions[""].invalidDate).replace(/\{0\}/, this._calendar.local.name);
        return this._year = c, this._month = f, this._day = h, this;
      }, leapYear: function() {
        return this._calendar.leapYear(this);
      }, epoch: function() {
        return this._calendar.epoch(this);
      }, formatYear: function() {
        return this._calendar.formatYear(this);
      }, monthOfYear: function() {
        return this._calendar.monthOfYear(this);
      }, weekOfYear: function() {
        return this._calendar.weekOfYear(this);
      }, daysInYear: function() {
        return this._calendar.daysInYear(this);
      }, dayOfYear: function() {
        return this._calendar.dayOfYear(this);
      }, daysInMonth: function() {
        return this._calendar.daysInMonth(this);
      }, dayOfWeek: function() {
        return this._calendar.dayOfWeek(this);
      }, weekDay: function() {
        return this._calendar.weekDay(this);
      }, extraInfo: function() {
        return this._calendar.extraInfo(this);
      }, add: function(c, f) {
        return this._calendar.add(this, c, f);
      }, set: function(c, f) {
        return this._calendar.set(this, c, f);
      }, compareTo: function(c) {
        if (this._calendar.name !== c._calendar.name) throw (u2.local.differentCalendars || u2.regionalOptions[""].differentCalendars).replace(/\{0\}/, this._calendar.local.name).replace(/\{1\}/, c._calendar.local.name);
        var f = this._year !== c._year ? this._year - c._year : this._month !== c._month ? this.monthOfYear() - c.monthOfYear() : this._day - c._day;
        return f === 0 ? 0 : f < 0 ? -1 : 1;
      }, calendar: function() {
        return this._calendar;
      }, toJD: function() {
        return this._calendar.toJD(this);
      }, fromJD: function(c) {
        return this._calendar.fromJD(c);
      }, toJSDate: function() {
        return this._calendar.toJSDate(this);
      }, fromJSDate: function(c) {
        return this._calendar.fromJSDate(c);
      }, toString: function() {
        return (this.year() < 0 ? "-" : "") + s(Math.abs(this.year()), 4) + "-" + s(this.month(), 2) + "-" + s(this.day(), 2);
      } }), n(i.prototype, { _validateLevel: 0, newDate: function(c, f, h) {
        return c == null ? this.today() : (c.year && (this._validate(c, f, h, u2.local.invalidDate || u2.regionalOptions[""].invalidDate), h = c.day(), f = c.month(), c = c.year()), new o(this, c, f, h));
      }, today: function() {
        return this.fromJSDate(/* @__PURE__ */ new Date());
      }, epoch: function(c) {
        return this._validate(c, this.minMonth, this.minDay, u2.local.invalidYear || u2.regionalOptions[""].invalidYear).year() < 0 ? this.local.epochs[0] : this.local.epochs[1];
      }, formatYear: function(c) {
        var f = this._validate(c, this.minMonth, this.minDay, u2.local.invalidYear || u2.regionalOptions[""].invalidYear);
        return (f.year() < 0 ? "-" : "") + s(Math.abs(f.year()), 4);
      }, monthsInYear: function(c) {
        return this._validate(c, this.minMonth, this.minDay, u2.local.invalidYear || u2.regionalOptions[""].invalidYear), 12;
      }, monthOfYear: function(c, f) {
        var h = this._validate(c, f, this.minDay, u2.local.invalidMonth || u2.regionalOptions[""].invalidMonth);
        return (h.month() + this.monthsInYear(h) - this.firstMonth) % this.monthsInYear(h) + this.minMonth;
      }, fromMonthOfYear: function(c, f) {
        var h = (f + this.firstMonth - 2 * this.minMonth) % this.monthsInYear(c) + this.minMonth;
        return this._validate(c, h, this.minDay, u2.local.invalidMonth || u2.regionalOptions[""].invalidMonth), h;
      }, daysInYear: function(c) {
        var f = this._validate(c, this.minMonth, this.minDay, u2.local.invalidYear || u2.regionalOptions[""].invalidYear);
        return this.leapYear(f) ? 366 : 365;
      }, dayOfYear: function(c, f, h) {
        var p = this._validate(c, f, h, u2.local.invalidDate || u2.regionalOptions[""].invalidDate);
        return p.toJD() - this.newDate(p.year(), this.fromMonthOfYear(p.year(), this.minMonth), this.minDay).toJD() + 1;
      }, daysInWeek: function() {
        return 7;
      }, dayOfWeek: function(c, f, h) {
        var p = this._validate(c, f, h, u2.local.invalidDate || u2.regionalOptions[""].invalidDate);
        return (Math.floor(this.toJD(p)) + 2) % this.daysInWeek();
      }, extraInfo: function(c, f, h) {
        return this._validate(c, f, h, u2.local.invalidDate || u2.regionalOptions[""].invalidDate), {};
      }, add: function(c, f, h) {
        return this._validate(c, this.minMonth, this.minDay, u2.local.invalidDate || u2.regionalOptions[""].invalidDate), this._correctAdd(c, this._add(c, f, h), f, h);
      }, _add: function(c, f, h) {
        if (this._validateLevel++, h === "d" || h === "w") {
          var p = c.toJD() + f * (h === "w" ? this.daysInWeek() : 1), d = c.calendar().fromJD(p);
          return this._validateLevel--, [d.year(), d.month(), d.day()];
        }
        try {
          var v = c.year() + (h === "y" ? f : 0), m = c.monthOfYear() + (h === "m" ? f : 0);
          d = c.day(), h === "y" ? (c.month() !== this.fromMonthOfYear(v, m) && (m = this.newDate(v, c.month(), this.minDay).monthOfYear()), m = Math.min(m, this.monthsInYear(v)), d = Math.min(d, this.daysInMonth(v, this.fromMonthOfYear(v, m)))) : h === "m" && (function(x) {
            for (; m < x.minMonth; ) v--, m += x.monthsInYear(v);
            for (var b = x.monthsInYear(v); m > b - 1 + x.minMonth; ) v++, m -= b, b = x.monthsInYear(v);
          }(this), d = Math.min(d, this.daysInMonth(v, this.fromMonthOfYear(v, m))));
          var g = [v, this.fromMonthOfYear(v, m), d];
          return this._validateLevel--, g;
        } catch (x) {
          throw this._validateLevel--, x;
        }
      }, _correctAdd: function(c, f, h, p) {
        if (!(this.hasYearZero || p !== "y" && p !== "m" || f[0] !== 0 && c.year() > 0 == f[0] > 0)) {
          var d = { y: [1, 1, "y"], m: [1, this.monthsInYear(-1), "m"], w: [this.daysInWeek(), this.daysInYear(-1), "d"], d: [1, this.daysInYear(-1), "d"] }[p], v = h < 0 ? -1 : 1;
          f = this._add(c, h * d[0] + v * d[1], d[2]);
        }
        return c.date(f[0], f[1], f[2]);
      }, set: function(c, f, h) {
        this._validate(c, this.minMonth, this.minDay, u2.local.invalidDate || u2.regionalOptions[""].invalidDate);
        var p = h === "y" ? f : c.year(), d = h === "m" ? f : c.month(), v = h === "d" ? f : c.day();
        return h !== "y" && h !== "m" || (v = Math.min(v, this.daysInMonth(p, d))), c.date(p, d, v);
      }, isValid: function(c, f, h) {
        this._validateLevel++;
        var p = this.hasYearZero || c !== 0;
        if (p) {
          var d = this.newDate(c, f, this.minDay);
          p = f >= this.minMonth && f - this.minMonth < this.monthsInYear(d) && h >= this.minDay && h - this.minDay < this.daysInMonth(d);
        }
        return this._validateLevel--, p;
      }, toJSDate: function(c, f, h) {
        var p = this._validate(c, f, h, u2.local.invalidDate || u2.regionalOptions[""].invalidDate);
        return u2.instance().fromJD(this.toJD(p)).toJSDate();
      }, fromJSDate: function(c) {
        return this.fromJD(u2.instance().fromJSDate(c).toJD());
      }, _validate: function(c, f, h, p) {
        if (c.year) {
          if (this._validateLevel === 0 && this.name !== c.calendar().name) throw (u2.local.differentCalendars || u2.regionalOptions[""].differentCalendars).replace(/\{0\}/, this.local.name).replace(/\{1\}/, c.calendar().local.name);
          return c;
        }
        try {
          if (this._validateLevel++, this._validateLevel === 1 && !this.isValid(c, f, h)) throw p.replace(/\{0\}/, this.local.name);
          var d = this.newDate(c, f, h);
          return this._validateLevel--, d;
        } catch (v) {
          throw this._validateLevel--, v;
        }
      } }), l.prototype = new i(), n(l.prototype, { name: "Gregorian", jdEpoch: 17214255e-1, daysPerMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], hasYearZero: false, minMonth: 1, firstMonth: 1, minDay: 1, regionalOptions: { "": { name: "Gregorian", epochs: ["BCE", "CE"], monthNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], dayNamesMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], digits: null, dateFormat: "mm/dd/yyyy", firstDay: 0, isRTL: false } }, leapYear: function(c) {
        var f = this._validate(c, this.minMonth, this.minDay, u2.local.invalidYear || u2.regionalOptions[""].invalidYear);
        return (c = f.year() + (f.year() < 0 ? 1 : 0)) % 4 == 0 && (c % 100 != 0 || c % 400 == 0);
      }, weekOfYear: function(c, f, h) {
        var p = this.newDate(c, f, h);
        return p.add(4 - (p.dayOfWeek() || 7), "d"), Math.floor((p.dayOfYear() - 1) / 7) + 1;
      }, daysInMonth: function(c, f) {
        var h = this._validate(c, f, this.minDay, u2.local.invalidMonth || u2.regionalOptions[""].invalidMonth);
        return this.daysPerMonth[h.month() - 1] + (h.month() === 2 && this.leapYear(h.year()) ? 1 : 0);
      }, weekDay: function(c, f, h) {
        return (this.dayOfWeek(c, f, h) || 7) < 6;
      }, toJD: function(c, f, h) {
        var p = this._validate(c, f, h, u2.local.invalidDate || u2.regionalOptions[""].invalidDate);
        c = p.year(), f = p.month(), h = p.day(), c < 0 && c++, f < 3 && (f += 12, c--);
        var d = Math.floor(c / 100), v = 2 - d + Math.floor(d / 4);
        return Math.floor(365.25 * (c + 4716)) + Math.floor(30.6001 * (f + 1)) + h + v - 1524.5;
      }, fromJD: function(c) {
        var f = Math.floor(c + 0.5), h = Math.floor((f - 186721625e-2) / 36524.25), p = (h = f + 1 + h - Math.floor(h / 4)) + 1524, d = Math.floor((p - 122.1) / 365.25), v = Math.floor(365.25 * d), m = Math.floor((p - v) / 30.6001), g = p - v - Math.floor(30.6001 * m), x = m - (m > 13.5 ? 13 : 1), b = d - (x > 2.5 ? 4716 : 4715);
        return b <= 0 && b--, this.newDate(b, x, g);
      }, toJSDate: function(c, f, h) {
        var p = this._validate(c, f, h, u2.local.invalidDate || u2.regionalOptions[""].invalidDate), d = new Date(p.year(), p.month() - 1, p.day());
        return d.setHours(0), d.setMinutes(0), d.setSeconds(0), d.setMilliseconds(0), d.setHours(d.getHours() > 12 ? d.getHours() + 2 : 0), d;
      }, fromJSDate: function(c) {
        return this.newDate(c.getFullYear(), c.getMonth() + 1, c.getDate());
      } });
      var u2 = t.exports = new a();
      u2.cdate = o, u2.baseCalendar = i, u2.calendars.gregorian = l;
    }, { "object-assign": 247 }], 347: [function(e, t, r) {
      var n = e("object-assign"), a = e("./main");
      n(a.regionalOptions[""], { invalidArguments: "Invalid arguments", invalidFormat: "Cannot format a date from another calendar", missingNumberAt: "Missing number at position {0}", unknownNameAt: "Unknown name at position {0}", unexpectedLiteralAt: "Unexpected literal at position {0}", unexpectedText: "Additional text found at end" }), a.local = a.regionalOptions[""], n(a.cdate.prototype, { formatDate: function(o, s) {
        return typeof o != "string" && (s = o, o = ""), this._calendar.formatDate(o || "", this, s);
      } }), n(a.baseCalendar.prototype, { UNIX_EPOCH: a.instance().newDate(1970, 1, 1).toJD(), SECS_PER_DAY: 86400, TICKS_EPOCH: a.instance().jdEpoch, TICKS_PER_DAY: 864e9, ATOM: "yyyy-mm-dd", COOKIE: "D, dd M yyyy", FULL: "DD, MM d, yyyy", ISO_8601: "yyyy-mm-dd", JULIAN: "J", RFC_822: "D, d M yy", RFC_850: "DD, dd-M-yy", RFC_1036: "D, d M yy", RFC_1123: "D, d M yyyy", RFC_2822: "D, d M yyyy", RSS: "D, d M yy", TICKS: "!", TIMESTAMP: "@", W3C: "yyyy-mm-dd", formatDate: function(o, s, i) {
        if (typeof o != "string" && (i = s, s = o, o = ""), !s) return "";
        if (s.calendar() !== this) throw a.local.invalidFormat || a.regionalOptions[""].invalidFormat;
        o = o || this.local.dateFormat;
        for (var l, u2, c, f, h = (i = i || {}).dayNamesShort || this.local.dayNamesShort, p = i.dayNames || this.local.dayNames, d = i.monthNumbers || this.local.monthNumbers, v = i.monthNamesShort || this.local.monthNamesShort, m = i.monthNames || this.local.monthNames, g = (i.calculateWeek || this.local.calculateWeek, function(C2, E2) {
          for (var F13 = 1; S2 + F13 < o.length && o.charAt(S2 + F13) === C2; ) F13++;
          return S2 += F13 - 1, Math.floor(F13 / (E2 || 1)) > 1;
        }), x = function(C2, E2, F13, N2) {
          var D2 = "" + E2;
          if (g(C2, N2)) for (; D2.length < F13; ) D2 = "0" + D2;
          return D2;
        }, b = this, y = function(C2) {
          return typeof d == "function" ? d.call(b, C2, g("m")) : k(x("m", C2.month(), 2));
        }, w = function(C2, E2) {
          return E2 ? typeof m == "function" ? m.call(b, C2) : m[C2.month() - b.minMonth] : typeof v == "function" ? v.call(b, C2) : v[C2.month() - b.minMonth];
        }, _4 = this.local.digits, k = function(C2) {
          return i.localNumbers && _4 ? _4(C2) : C2;
        }, T2 = "", A2 = false, S2 = 0; S2 < o.length; S2++) if (A2) o.charAt(S2) !== "'" || g("'") ? T2 += o.charAt(S2) : A2 = false;
        else switch (o.charAt(S2)) {
          case "d":
            T2 += k(x("d", s.day(), 2));
            break;
          case "D":
            T2 += (l = "D", u2 = s.dayOfWeek(), c = h, f = p, g(l) ? f[u2] : c[u2]);
            break;
          case "o":
            T2 += x("o", s.dayOfYear(), 3);
            break;
          case "w":
            T2 += x("w", s.weekOfYear(), 2);
            break;
          case "m":
            T2 += y(s);
            break;
          case "M":
            T2 += w(s, g("M"));
            break;
          case "y":
            T2 += g("y", 2) ? s.year() : (s.year() % 100 < 10 ? "0" : "") + s.year() % 100;
            break;
          case "Y":
            g("Y", 2), T2 += s.formatYear();
            break;
          case "J":
            T2 += s.toJD();
            break;
          case "@":
            T2 += (s.toJD() - this.UNIX_EPOCH) * this.SECS_PER_DAY;
            break;
          case "!":
            T2 += (s.toJD() - this.TICKS_EPOCH) * this.TICKS_PER_DAY;
            break;
          case "'":
            g("'") ? T2 += "'" : A2 = true;
            break;
          default:
            T2 += o.charAt(S2);
        }
        return T2;
      }, parseDate: function(o, s, i) {
        if (s == null) throw a.local.invalidArguments || a.regionalOptions[""].invalidArguments;
        if ((s = typeof s == "object" ? s.toString() : s + "") === "") return null;
        o = o || this.local.dateFormat;
        var l = (i = i || {}).shortYearCutoff || this.shortYearCutoff;
        l = typeof l != "string" ? l : this.today().year() % 100 + parseInt(l, 10);
        for (var u2 = i.dayNamesShort || this.local.dayNamesShort, c = i.dayNames || this.local.dayNames, f = i.parseMonth || this.local.parseMonth, h = i.monthNumbers || this.local.monthNumbers, p = i.monthNamesShort || this.local.monthNamesShort, d = i.monthNames || this.local.monthNames, v = -1, m = -1, g = -1, x = -1, b = -1, y = false, w = false, _4 = function(O2, L2) {
          for (var V2 = 1; N2 + V2 < o.length && o.charAt(N2 + V2) === O2; ) V2++;
          return N2 += V2 - 1, Math.floor(V2 / (L2 || 1)) > 1;
        }, k = function(O2, L2) {
          var V2 = _4(O2, L2), W2 = [2, 3, V2 ? 4 : 2, V2 ? 4 : 2, 10, 11, 20]["oyYJ@!".indexOf(O2) + 1], X2 = new RegExp("^-?\\d{1," + W2 + "}"), Y2 = s.substring(F13).match(X2);
          if (!Y2) throw (a.local.missingNumberAt || a.regionalOptions[""].missingNumberAt).replace(/\{0\}/, F13);
          return F13 += Y2[0].length, parseInt(Y2[0], 10);
        }, T2 = this, A2 = function() {
          if (typeof h == "function") {
            _4("m");
            var O2 = h.call(T2, s.substring(F13));
            return F13 += O2.length, O2;
          }
          return k("m");
        }, S2 = function(O2, L2, V2, W2) {
          for (var X2 = _4(O2, W2) ? V2 : L2, Y2 = 0; Y2 < X2.length; Y2++) if (s.substr(F13, X2[Y2].length).toLowerCase() === X2[Y2].toLowerCase()) return F13 += X2[Y2].length, Y2 + T2.minMonth;
          throw (a.local.unknownNameAt || a.regionalOptions[""].unknownNameAt).replace(/\{0\}/, F13);
        }, C2 = function() {
          if (typeof d == "function") {
            var O2 = _4("M") ? d.call(T2, s.substring(F13)) : p.call(T2, s.substring(F13));
            return F13 += O2.length, O2;
          }
          return S2("M", p, d);
        }, E2 = function() {
          if (s.charAt(F13) !== o.charAt(N2)) throw (a.local.unexpectedLiteralAt || a.regionalOptions[""].unexpectedLiteralAt).replace(/\{0\}/, F13);
          F13++;
        }, F13 = 0, N2 = 0; N2 < o.length; N2++) if (w) o.charAt(N2) !== "'" || _4("'") ? E2() : w = false;
        else switch (o.charAt(N2)) {
          case "d":
            x = k("d");
            break;
          case "D":
            S2("D", u2, c);
            break;
          case "o":
            b = k("o");
            break;
          case "w":
            k("w");
            break;
          case "m":
            g = A2();
            break;
          case "M":
            g = C2();
            break;
          case "y":
            var D2 = N2;
            y = !_4("y", 2), N2 = D2, m = k("y", 2);
            break;
          case "Y":
            m = k("Y", 2);
            break;
          case "J":
            v = k("J") + 0.5, s.charAt(F13) === "." && (F13++, k("J"));
            break;
          case "@":
            v = k("@") / this.SECS_PER_DAY + this.UNIX_EPOCH;
            break;
          case "!":
            v = k("!") / this.TICKS_PER_DAY + this.TICKS_EPOCH;
            break;
          case "*":
            F13 = s.length;
            break;
          case "'":
            _4("'") ? E2() : w = true;
            break;
          default:
            E2();
        }
        if (F13 < s.length) throw a.local.unexpectedText || a.regionalOptions[""].unexpectedText;
        if (m === -1 ? m = this.today().year() : m < 100 && y && (m += l === -1 ? 1900 : this.today().year() - this.today().year() % 100 - (m <= l ? 0 : 100)), typeof g == "string" && (g = f.call(this, m, g)), b > -1) {
          g = 1, x = b;
          for (var I2 = this.daysInMonth(m, g); x > I2; I2 = this.daysInMonth(m, g)) g++, x -= I2;
        }
        return v > -1 ? this.fromJD(v) : this.newDate(m, g, x);
      }, determineDate: function(o, s, i, l, u2) {
        i && typeof i != "object" && (u2 = l, l = i, i = null), typeof l != "string" && (u2 = l, l = "");
        var c = this;
        return s = s ? s.newDate() : null, o = o == null ? s : typeof o == "string" ? function(f) {
          try {
            return c.parseDate(l, f, u2);
          } catch {
          }
          for (var h = ((f = f.toLowerCase()).match(/^c/) && i ? i.newDate() : null) || c.today(), p = /([+-]?[0-9]+)\s*(d|w|m|y)?/g, d = p.exec(f); d; ) h.add(parseInt(d[1], 10), d[2] || "d"), d = p.exec(f);
          return h;
        }(o) : typeof o == "number" ? isNaN(o) || o === 1 / 0 || o === -1 / 0 ? s : c.today().add(o, "d") : c.newDate(o);
      } });
    }, { "./main": 346, "object-assign": 247 }], 348: [function(e, t, r) {
      "use strict";
      t.exports = [{ path: "", backoff: 0 }, { path: "M-2.4,-3V3L0.6,0Z", backoff: 0.6 }, { path: "M-3.7,-2.5V2.5L1.3,0Z", backoff: 1.3 }, { path: "M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z", backoff: 1.55 }, { path: "M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z", backoff: 1.6 }, { path: "M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z", backoff: 2 }, { path: "M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z", backoff: 0, noRotate: true }, { path: "M2,2V-2H-2V2Z", backoff: 0, noRotate: true }];
    }, {}], 349: [function(e, t, r) {
      "use strict";
      var n = e("./arrow_paths"), a = e("../../plots/font_attributes"), o = e("../../plots/cartesian/constants"), s = e("../../plot_api/plot_template").templatedArray;
      e("../../constants/axis_placeable_objects"), t.exports = s("annotation", { visible: { valType: "boolean", dflt: true, editType: "calc+arraydraw" }, text: { valType: "string", editType: "calc+arraydraw" }, textangle: { valType: "angle", dflt: 0, editType: "calc+arraydraw" }, font: a({ editType: "calc+arraydraw", colorEditType: "arraydraw" }), width: { valType: "number", min: 1, dflt: null, editType: "calc+arraydraw" }, height: { valType: "number", min: 1, dflt: null, editType: "calc+arraydraw" }, opacity: { valType: "number", min: 0, max: 1, dflt: 1, editType: "arraydraw" }, align: { valType: "enumerated", values: ["left", "center", "right"], dflt: "center", editType: "arraydraw" }, valign: { valType: "enumerated", values: ["top", "middle", "bottom"], dflt: "middle", editType: "arraydraw" }, bgcolor: { valType: "color", dflt: "rgba(0,0,0,0)", editType: "arraydraw" }, bordercolor: { valType: "color", dflt: "rgba(0,0,0,0)", editType: "arraydraw" }, borderpad: { valType: "number", min: 0, dflt: 1, editType: "calc+arraydraw" }, borderwidth: { valType: "number", min: 0, dflt: 1, editType: "calc+arraydraw" }, showarrow: { valType: "boolean", dflt: true, editType: "calc+arraydraw" }, arrowcolor: { valType: "color", editType: "arraydraw" }, arrowhead: { valType: "integer", min: 0, max: n.length, dflt: 1, editType: "arraydraw" }, startarrowhead: { valType: "integer", min: 0, max: n.length, dflt: 1, editType: "arraydraw" }, arrowside: { valType: "flaglist", flags: ["end", "start"], extras: ["none"], dflt: "end", editType: "arraydraw" }, arrowsize: { valType: "number", min: 0.3, dflt: 1, editType: "calc+arraydraw" }, startarrowsize: { valType: "number", min: 0.3, dflt: 1, editType: "calc+arraydraw" }, arrowwidth: { valType: "number", min: 0.1, editType: "calc+arraydraw" }, standoff: { valType: "number", min: 0, dflt: 0, editType: "calc+arraydraw" }, startstandoff: { valType: "number", min: 0, dflt: 0, editType: "calc+arraydraw" }, ax: { valType: "any", editType: "calc+arraydraw" }, ay: { valType: "any", editType: "calc+arraydraw" }, axref: { valType: "enumerated", dflt: "pixel", values: ["pixel", o.idRegex.x.toString()], editType: "calc" }, ayref: { valType: "enumerated", dflt: "pixel", values: ["pixel", o.idRegex.y.toString()], editType: "calc" }, xref: { valType: "enumerated", values: ["paper", o.idRegex.x.toString()], editType: "calc" }, x: { valType: "any", editType: "calc+arraydraw" }, xanchor: { valType: "enumerated", values: ["auto", "left", "center", "right"], dflt: "auto", editType: "calc+arraydraw" }, xshift: { valType: "number", dflt: 0, editType: "calc+arraydraw" }, yref: { valType: "enumerated", values: ["paper", o.idRegex.y.toString()], editType: "calc" }, y: { valType: "any", editType: "calc+arraydraw" }, yanchor: { valType: "enumerated", values: ["auto", "top", "middle", "bottom"], dflt: "auto", editType: "calc+arraydraw" }, yshift: { valType: "number", dflt: 0, editType: "calc+arraydraw" }, clicktoshow: { valType: "enumerated", values: [false, "onoff", "onout"], dflt: false, editType: "arraydraw" }, xclick: { valType: "any", editType: "arraydraw" }, yclick: { valType: "any", editType: "arraydraw" }, hovertext: { valType: "string", editType: "arraydraw" }, hoverlabel: { bgcolor: { valType: "color", editType: "arraydraw" }, bordercolor: { valType: "color", editType: "arraydraw" }, font: a({ editType: "arraydraw" }), editType: "arraydraw" }, captureevents: { valType: "boolean", editType: "arraydraw" }, editType: "calc", _deprecated: { ref: { valType: "string", editType: "calc" } } });
    }, { "../../constants/axis_placeable_objects": 472, "../../plot_api/plot_template": 543, "../../plots/cartesian/constants": 561, "../../plots/font_attributes": 585, "./arrow_paths": 348 }], 350: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../plots/cartesian/axes"), o = e("./draw").draw;
      function s(l) {
        var u2 = l._fullLayout;
        n.filterVisible(u2.annotations).forEach(function(c) {
          var f = a.getFromId(l, c.xref), h = a.getFromId(l, c.yref), p = a.getRefType(c.xref), d = a.getRefType(c.yref);
          c._extremes = {}, p === "range" && i(c, f), d === "range" && i(c, h);
        });
      }
      function i(l, u2) {
        var c, f = u2._id, h = f.charAt(0), p = l[h], d = l["a" + h], v = l[h + "ref"], m = l["a" + h + "ref"], g = l["_" + h + "padplus"], x = l["_" + h + "padminus"], b = { x: 1, y: -1 }[h] * l[h + "shift"], y = 3 * l.arrowsize * l.arrowwidth || 0, w = y + b, _4 = y - b, k = 3 * l.startarrowsize * l.arrowwidth || 0, T2 = k + b, A2 = k - b;
        if (m === v) {
          var S2 = a.findExtremes(u2, [u2.r2c(p)], { ppadplus: w, ppadminus: _4 }), C2 = a.findExtremes(u2, [u2.r2c(d)], { ppadplus: Math.max(g, T2), ppadminus: Math.max(x, A2) });
          c = { min: [S2.min[0], C2.min[0]], max: [S2.max[0], C2.max[0]] };
        } else T2 = d ? T2 + d : T2, A2 = d ? A2 - d : A2, c = a.findExtremes(u2, [u2.r2c(p)], { ppadplus: Math.max(g, w, T2), ppadminus: Math.max(x, _4, A2) });
        l._extremes[f] = c;
      }
      t.exports = function(l) {
        var u2 = l._fullLayout;
        if (n.filterVisible(u2.annotations).length && l._fullData.length) return n.syncOrAsync([o, s], l);
      };
    }, { "../../lib": 503, "../../plots/cartesian/axes": 554, "./draw": 355 }], 351: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../registry"), o = e("../../plot_api/plot_template").arrayEditor;
      function s(l, u2) {
        var c, f, h, p, d, v, m, g = l._fullLayout.annotations, x = [], b = [], y = [], w = (u2 || []).length;
        for (c = 0; c < g.length; c++) if (p = (h = g[c]).clicktoshow) {
          for (f = 0; f < w; f++) if (v = (d = u2[f]).xaxis, m = d.yaxis, v._id === h.xref && m._id === h.yref && v.d2r(d.x) === i(h._xclick, v) && m.d2r(d.y) === i(h._yclick, m)) {
            (h.visible ? p === "onout" ? b : y : x).push(c);
            break;
          }
          f === w && h.visible && p === "onout" && b.push(c);
        }
        return { on: x, off: b, explicitOff: y };
      }
      function i(l, u2) {
        return u2.type === "log" ? u2.l2r(l) : u2.d2r(l);
      }
      t.exports = { hasClickToShow: function(l, u2) {
        var c = s(l, u2);
        return c.on.length > 0 || c.explicitOff.length > 0;
      }, onClick: function(l, u2) {
        var c, f, h = s(l, u2), p = h.on, d = h.off.concat(h.explicitOff), v = {}, m = l._fullLayout.annotations;
        if (!(!p.length && !d.length)) {
          for (c = 0; c < p.length; c++) (f = o(l.layout, "annotations", m[p[c]])).modifyItem("visible", true), n.extendFlat(v, f.getUpdateObj());
          for (c = 0; c < d.length; c++) (f = o(l.layout, "annotations", m[d[c]])).modifyItem("visible", false), n.extendFlat(v, f.getUpdateObj());
          return a.call("update", l, {}, v);
        }
      } };
    }, { "../../lib": 503, "../../plot_api/plot_template": 543, "../../registry": 638 }], 352: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../color");
      t.exports = function(o, s, i, l) {
        l("opacity");
        var u2 = l("bgcolor"), c = l("bordercolor"), f = a.opacity(c);
        l("borderpad");
        var h = l("borderwidth"), p = l("showarrow");
        if (l("text", p ? " " : i._dfltTitle.annotation), l("textangle"), n.coerceFont(l, "font", i.font), l("width"), l("align"), l("height") && l("valign"), p) {
          var d, v, m = l("arrowside");
          m.indexOf("end") !== -1 && (d = l("arrowhead"), v = l("arrowsize")), m.indexOf("start") !== -1 && (l("startarrowhead", d), l("startarrowsize", v)), l("arrowcolor", f ? s.bordercolor : a.defaultLine), l("arrowwidth", 2 * (f && h || 1)), l("standoff"), l("startstandoff");
        }
        var g = l("hovertext"), x = i.hoverlabel || {};
        if (g) {
          var b = l("hoverlabel.bgcolor", x.bgcolor || (a.opacity(u2) ? a.rgb(u2) : a.defaultLine)), y = l("hoverlabel.bordercolor", x.bordercolor || a.contrast(b));
          n.coerceFont(l, "hoverlabel.font", { family: x.font.family, size: x.font.size, color: x.font.color || y });
        }
        l("captureevents", !!g);
      };
    }, { "../../lib": 503, "../color": 366 }], 353: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("../../lib/to_log_range");
      t.exports = function(o, s, i, l) {
        s = s || {};
        var u2 = i === "log" && s.type === "linear", c = i === "linear" && s.type === "log";
        if (u2 || c) for (var f, h, p = o._fullLayout.annotations, d = s._id.charAt(0), v = 0; v < p.length; v++) f = p[v], h = "annotations[" + v + "].", f[d + "ref"] === s._id && m(d), f["a" + d + "ref"] === s._id && m("a" + d);
        function m(g) {
          var x = f[g], b = null;
          b = u2 ? a(x, s.range) : Math.pow(10, x), n(b) || (b = null), l(h + g, b);
        }
      };
    }, { "../../lib/to_log_range": 531, "fast-isnumeric": 190 }], 354: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../plots/cartesian/axes"), o = e("../../plots/array_container_defaults"), s = e("./common_defaults"), i = e("./attributes");
      function l(u2, c, f) {
        function h(C2, E2) {
          return n.coerce(u2, c, i, C2, E2);
        }
        var p = h("visible"), d = h("clicktoshow");
        if (p || d) {
          s(u2, c, f, h);
          for (var v = c.showarrow, m = ["x", "y"], g = [-10, -30], x = { _fullLayout: f }, b = 0; b < 2; b++) {
            var y = m[b], w = a.coerceRef(u2, c, x, y, "", "paper");
            if (w !== "paper" && a.getFromId(x, w)._annIndices.push(c._index), a.coercePosition(c, x, h, w, y, 0.5), v) {
              var _4 = "a" + y, k = a.coerceRef(u2, c, x, _4, "pixel", ["pixel", "paper"]);
              k !== "pixel" && k !== w && (k = c[_4] = "pixel");
              var T2 = k === "pixel" ? g[b] : 0.4;
              a.coercePosition(c, x, h, k, _4, T2);
            }
            h(y + "anchor"), h(y + "shift");
          }
          if (n.noneOrAll(u2, c, ["x", "y"]), v && n.noneOrAll(u2, c, ["ax", "ay"]), d) {
            var A2 = h("xclick"), S2 = h("yclick");
            c._xclick = A2 === void 0 ? c.x : a.cleanPosition(A2, x, c.xref), c._yclick = S2 === void 0 ? c.y : a.cleanPosition(S2, x, c.yref);
          }
        }
      }
      t.exports = function(u2, c) {
        o(u2, c, { name: "annotations", handleItemDefaults: l });
      };
    }, { "../../lib": 503, "../../plots/array_container_defaults": 549, "../../plots/cartesian/axes": 554, "./attributes": 349, "./common_defaults": 352 }], 355: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../registry"), o = e("../../plots/plots"), s = e("../../lib"), i = s.strTranslate, l = e("../../plots/cartesian/axes"), u2 = e("../color"), c = e("../drawing"), f = e("../fx"), h = e("../../lib/svg_text_utils"), p = e("../../lib/setcursor"), d = e("../dragelement"), v = e("../../plot_api/plot_template").arrayEditor, m = e("./draw_arrow_head");
      function g(y, w) {
        var _4 = y._fullLayout.annotations[w] || {}, k = l.getFromId(y, _4.xref), T2 = l.getFromId(y, _4.yref);
        k && k.setScale(), T2 && T2.setScale(), b(y, _4, w, false, k, T2);
      }
      function x(y, w, _4, k, T2) {
        var A2 = T2[_4], S2 = T2[_4 + "ref"], C2 = _4.indexOf("y") !== -1, E2 = l.getRefType(S2) === "domain", F13 = C2 ? k.h : k.w;
        return y ? E2 ? A2 + (C2 ? -w : w) / y._length : y.p2r(y.r2p(A2) + w) : A2 + (C2 ? -w : w) / F13;
      }
      function b(y, w, _4, k, T2, A2) {
        var S2, C2, E2 = y._fullLayout, F13 = y._fullLayout._size, N2 = y._context.edits;
        k ? (S2 = "annotation-" + k, C2 = k + ".annotations") : (S2 = "annotation", C2 = "annotations");
        var D2 = v(y.layout, C2, w), I2 = D2.modifyBase, O2 = D2.modifyItem, L2 = D2.getUpdateObj;
        E2._infolayer.selectAll("." + S2 + '[data-index="' + _4 + '"]').remove();
        var V2 = "clip" + E2._uid + "_ann" + _4;
        if (w._input && w.visible !== false) {
          var W2 = { x: {}, y: {} }, X2 = +w.textangle || 0, Y2 = E2._infolayer.append("g").classed(S2, true).attr("data-index", String(_4)).style("opacity", w.opacity), K2 = Y2.append("g").classed("annotation-text-g", true), q = N2[w.showarrow ? "annotationTail" : "annotationPosition"], re = w.captureevents || N2.annotationText || q, R2 = K2.append("g").style("pointer-events", re ? "all" : null).call(p, "pointer").on("click", function() {
            y._dragging = false, y.emit("plotly_clickannotation", le(n.event));
          });
          w.hovertext && R2.on("mouseover", function() {
            var he = w.hoverlabel, me = he.font, we = this.getBoundingClientRect(), be = y.getBoundingClientRect();
            f.loneHover({ x0: we.left - be.left, x1: we.right - be.left, y: (we.top + we.bottom) / 2 - be.top, text: w.hovertext, color: he.bgcolor, borderColor: he.bordercolor, fontFamily: me.family, fontSize: me.size, fontColor: me.color }, { container: E2._hoverlayer.node(), outerContainer: E2._paper.node(), gd: y });
          }).on("mouseout", function() {
            f.loneUnhover(E2._hoverlayer.node());
          });
          var z = w.borderwidth, H2 = w.borderpad, te = z + H2, j = R2.append("rect").attr("class", "bg").style("stroke-width", z + "px").call(u2.stroke, w.bordercolor).call(u2.fill, w.bgcolor), Q2 = w.width || w.height, Z2 = E2._topclips.selectAll("#" + V2).data(Q2 ? [0] : []);
          Z2.enter().append("clipPath").classed("annclip", true).attr("id", V2).append("rect"), Z2.exit().remove();
          var ne = w.font, ae = E2._meta ? s.templateString(w.text, E2._meta) : w.text, ue = R2.append("text").classed("annotation-text", true).text(ae);
          N2.annotationText ? ue.call(h.makeEditable, { delegate: R2, gd: y }).call(ce).on("edit", function(he) {
            w.text = he, this.call(ce), O2("text", he), T2 && T2.autorange && I2(T2._name + ".autorange", true), A2 && A2.autorange && I2(A2._name + ".autorange", true), a.call("_guiRelayout", y, L2());
          }) : ue.call(ce);
        } else n.selectAll("#" + V2).remove();
        function le(he) {
          var me = { index: _4, annotation: w._input, fullAnnotation: w, event: he };
          return k && (me.subplotId = k), me;
        }
        function ce(he) {
          return he.call(c.font, ne).attr({ "text-anchor": { left: "start", right: "end" }[w.align] || "middle" }), h.convertToTspans(he, y, se), he;
        }
        function se() {
          var he = ue.selectAll("a");
          he.size() === 1 && he.text() === ue.text() && R2.insert("a", ":first-child").attr({ "xlink:xlink:href": he.attr("xlink:href"), "xlink:xlink:show": he.attr("xlink:show") }).style({ cursor: "pointer" }).node().appendChild(j.node());
          var me = R2.select(".annotation-text-math-group"), we = !me.empty(), be = c.bBox((we ? me : ue).node()), Ae = be.width, pe = be.height, ve = w.width || Ae, Ee = w.height || pe, Se = Math.round(ve + 2 * te), Ce = Math.round(Ee + 2 * te);
          function Be(ke, Me) {
            return Me === "auto" && (Me = ke < 1 / 3 ? "left" : ke > 2 / 3 ? "right" : "center"), { center: 0, middle: 0, left: 0.5, bottom: -0.5, right: -0.5, top: 0.5 }[Me];
          }
          for (var Ue = false, Ke = ["x", "y"], ct = 0; ct < Ke.length; ct++) {
            var We, Ze, it, ot, mt, wt = Ke[ct], Et = w[wt + "ref"] || wt, zt = w["a" + wt + "ref"], Nt = { x: T2, y: A2 }[wt], yt = (X2 + (wt === "x" ? 0 : -90)) * Math.PI / 180, pt = Se * Math.cos(yt), Ot = Ce * Math.sin(yt), Jt = Math.abs(pt) + Math.abs(Ot), tr = w[wt + "anchor"], Ye = w[wt + "shift"] * (wt === "x" ? 1 : -1), at = W2[wt], Ge = l.getRefType(Et);
            if (Nt && Ge !== "domain") {
              var st = Nt.r2fraction(w[wt]);
              (st < 0 || st > 1) && (zt === Et ? ((st = Nt.r2fraction(w["a" + wt])) < 0 || st > 1) && (Ue = true) : Ue = true), We = Nt._offset + Nt.r2p(w[wt]), ot = 0.5;
            } else {
              var Ie = Ge === "domain";
              wt === "x" ? (it = w[wt], We = Ie ? Nt._offset + Nt._length * it : We = F13.l + F13.w * it) : (it = 1 - w[wt], We = Ie ? Nt._offset + Nt._length * it : We = F13.t + F13.h * it), ot = w.showarrow ? 0.5 : it;
            }
            if (w.showarrow) {
              at.head = We;
              var Pe = w["a" + wt];
              if (mt = pt * Be(0.5, w.xanchor) - Ot * Be(0.5, w.yanchor), zt === Et) {
                var $e = l.getRefType(zt);
                $e === "domain" ? (wt === "y" && (Pe = 1 - Pe), at.tail = Nt._offset + Nt._length * Pe) : $e === "paper" ? wt === "y" ? (Pe = 1 - Pe, at.tail = F13.t + F13.h * Pe) : at.tail = F13.l + F13.w * Pe : at.tail = Nt._offset + Nt.r2p(Pe), Ze = mt;
              } else at.tail = We + Pe, Ze = mt + Pe;
              at.text = at.tail + mt;
              var Ve = E2[wt === "x" ? "width" : "height"];
              if (Et === "paper" && (at.head = s.constrain(at.head, 1, Ve - 1)), zt === "pixel") {
                var ut = -Math.max(at.tail - 3, at.text), Re = Math.min(at.tail + 3, at.text) - Ve;
                ut > 0 ? (at.tail += ut, at.text += ut) : Re > 0 && (at.tail -= Re, at.text -= Re);
              }
              at.tail += Ye, at.head += Ye;
            } else Ze = mt = Jt * Be(ot, tr), at.text = We + mt;
            at.text += Ye, mt += Ye, Ze += Ye, w["_" + wt + "padplus"] = Jt / 2 + Ze, w["_" + wt + "padminus"] = Jt / 2 - Ze, w["_" + wt + "size"] = Jt, w["_" + wt + "shift"] = mt;
          }
          if (Ue) R2.remove();
          else {
            var qe = 0, je = 0;
            if (w.align !== "left" && (qe = (ve - Ae) * (w.align === "center" ? 0.5 : 1)), w.valign !== "top" && (je = (Ee - pe) * (w.valign === "middle" ? 0.5 : 1)), we) me.select("svg").attr({ x: te + qe - 1, y: te + je }).call(c.setClipUrl, Q2 ? V2 : null, y);
            else {
              var rt = te + je - be.top, He = te + qe - be.left;
              ue.call(h.positionText, He, rt).call(c.setClipUrl, Q2 ? V2 : null, y);
            }
            Z2.select("rect").call(c.setRect, te, te, ve, Ee), j.call(c.setRect, z / 2, z / 2, Se - z, Ce - z), R2.call(c.setTranslate, Math.round(W2.x.text - Se / 2), Math.round(W2.y.text - Ce / 2)), K2.attr({ transform: "rotate(" + X2 + "," + W2.x.text + "," + W2.y.text + ")" });
            var xe, Ne = function(ke, Me) {
              Y2.selectAll(".annotation-arrow-g").remove();
              var Le = W2.x.head, ze = W2.y.head, ft = W2.x.tail + ke, De = W2.y.tail + Me, Je = W2.x.text + ke, tt = W2.y.text + Me, vt = s.rotationXYMatrix(X2, Je, tt), kt = s.apply2DTransform(vt), jt = s.apply2DTransform2(vt), Vt = +j.attr("width"), Kt = +j.attr("height"), rr = Je - 0.5 * Vt, Tr = rr + Vt, yr = tt - 0.5 * Kt, pr = yr + Kt, lr = [[rr, yr, rr, pr], [rr, pr, Tr, pr], [Tr, pr, Tr, yr], [Tr, yr, rr, yr]].map(jt);
              if (!lr.reduce(function(Nr, Zr) {
                return Nr ^ !!s.segmentsIntersect(Le, ze, Le + 1e6, ze + 1e6, Zr[0], Zr[1], Zr[2], Zr[3]);
              }, false)) {
                lr.forEach(function(Nr) {
                  var Zr = s.segmentsIntersect(ft, De, Le, ze, Nr[0], Nr[1], Nr[2], Nr[3]);
                  Zr && (ft = Zr.x, De = Zr.y);
                });
                var _r = w.arrowwidth, $r = w.arrowcolor, Ar = w.arrowside, Qr = Y2.append("g").style({ opacity: u2.opacity($r) }).classed("annotation-arrow-g", true), hn = Qr.append("path").attr("d", "M" + ft + "," + De + "L" + Le + "," + ze).style("stroke-width", _r + "px").call(u2.stroke, u2.rgb($r));
                if (m(hn, Ar, w), N2.annotationPosition && hn.node().parentNode && !k) {
                  var wn = Le, Yn = ze;
                  if (w.standoff) {
                    var Xn = Math.sqrt(Math.pow(Le - ft, 2) + Math.pow(ze - De, 2));
                    wn += w.standoff * (ft - Le) / Xn, Yn += w.standoff * (De - ze) / Xn;
                  }
                  var Wn, _n, qr = Qr.append("path").classed("annotation-arrow", true).classed("anndrag", true).classed("cursor-move", true).attr({ d: "M3,3H-3V-3H3ZM0,0L" + (ft - wn) + "," + (De - Yn), transform: i(wn, Yn) }).style("stroke-width", _r + 6 + "px").call(u2.stroke, "rgba(0,0,0,0)").call(u2.fill, "rgba(0,0,0,0)");
                  d.init({ element: qr.node(), gd: y, prepFn: function() {
                    var Nr = c.getTranslate(R2);
                    Wn = Nr.x, _n = Nr.y, T2 && T2.autorange && I2(T2._name + ".autorange", true), A2 && A2.autorange && I2(A2._name + ".autorange", true);
                  }, moveFn: function(Nr, Zr) {
                    var oa = kt(Wn, _n), tn = oa[0] + Nr, Zn = oa[1] + Zr;
                    R2.call(c.setTranslate, tn, Zn), O2("x", x(T2, Nr, "x", F13, w)), O2("y", x(A2, Zr, "y", F13, w)), w.axref === w.xref && O2("ax", x(T2, Nr, "ax", F13, w)), w.ayref === w.yref && O2("ay", x(A2, Zr, "ay", F13, w)), Qr.attr("transform", i(Nr, Zr)), K2.attr({ transform: "rotate(" + X2 + "," + tn + "," + Zn + ")" });
                  }, doneFn: function() {
                    a.call("_guiRelayout", y, L2());
                    var Nr = document.querySelector(".js-notes-box-panel");
                    Nr && Nr.redraw(Nr.selectedObj);
                  } });
                }
              }
            };
            w.showarrow && Ne(0, 0), q && d.init({ element: R2.node(), gd: y, prepFn: function() {
              xe = K2.attr("transform");
            }, moveFn: function(ke, Me) {
              var Le = "pointer";
              if (w.showarrow) w.axref === w.xref ? O2("ax", x(T2, ke, "ax", F13, w)) : O2("ax", w.ax + ke), w.ayref === w.yref ? O2("ay", x(A2, Me, "ay", F13.w, w)) : O2("ay", w.ay + Me), Ne(ke, Me);
              else {
                if (k) return;
                var ze, ft;
                if (T2) ze = x(T2, ke, "x", F13, w);
                else {
                  var De = w._xsize / F13.w, Je = w.x + (w._xshift - w.xshift) / F13.w - De / 2;
                  ze = d.align(Je + ke / F13.w, De, 0, 1, w.xanchor);
                }
                if (A2) ft = x(A2, Me, "y", F13, w);
                else {
                  var tt = w._ysize / F13.h, vt = w.y - (w._yshift + w.yshift) / F13.h - tt / 2;
                  ft = d.align(vt - Me / F13.h, tt, 0, 1, w.yanchor);
                }
                O2("x", ze), O2("y", ft), T2 && A2 || (Le = d.getCursor(T2 ? 0.5 : ze, A2 ? 0.5 : ft, w.xanchor, w.yanchor));
              }
              K2.attr({ transform: i(ke, Me) + xe }), p(R2, Le);
            }, clickFn: function(ke, Me) {
              w.captureevents && y.emit("plotly_clickannotation", le(Me));
            }, doneFn: function() {
              p(R2), a.call("_guiRelayout", y, L2());
              var ke = document.querySelector(".js-notes-box-panel");
              ke && ke.redraw(ke.selectedObj);
            } });
          }
        }
      }
      t.exports = { draw: function(y) {
        var w = y._fullLayout;
        w._infolayer.selectAll(".annotation").remove();
        for (var _4 = 0; _4 < w.annotations.length; _4++) w.annotations[_4].visible && g(y, _4);
        return o.previousPromises(y);
      }, drawOne: g, drawRaw: b };
    }, { "../../lib": 503, "../../lib/setcursor": 524, "../../lib/svg_text_utils": 529, "../../plot_api/plot_template": 543, "../../plots/cartesian/axes": 554, "../../plots/plots": 619, "../../registry": 638, "../color": 366, "../dragelement": 385, "../drawing": 388, "../fx": 406, "./draw_arrow_head": 356, "@plotly/d3": 58 }], 356: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../color"), o = e("./arrow_paths"), s = e("../../lib"), i = s.strScale, l = s.strRotate, u2 = s.strTranslate;
      t.exports = function(c, f, h) {
        var p, d, v, m, g = c.node(), x = o[h.arrowhead || 0], b = o[h.startarrowhead || 0], y = (h.arrowwidth || 1) * (h.arrowsize || 1), w = (h.arrowwidth || 1) * (h.startarrowsize || 1), _4 = f.indexOf("start") >= 0, k = f.indexOf("end") >= 0, T2 = x.backoff * y + h.standoff, A2 = b.backoff * w + h.startstandoff;
        if (g.nodeName === "line") {
          p = { x: +c.attr("x1"), y: +c.attr("y1") }, d = { x: +c.attr("x2"), y: +c.attr("y2") };
          var S2 = p.x - d.x, C2 = p.y - d.y;
          if (m = (v = Math.atan2(C2, S2)) + Math.PI, T2 && A2 && T2 + A2 > Math.sqrt(S2 * S2 + C2 * C2)) return void Y2();
          if (T2) {
            if (T2 * T2 > S2 * S2 + C2 * C2) return void Y2();
            var E2 = T2 * Math.cos(v), F13 = T2 * Math.sin(v);
            d.x += E2, d.y += F13, c.attr({ x2: d.x, y2: d.y });
          }
          if (A2) {
            if (A2 * A2 > S2 * S2 + C2 * C2) return void Y2();
            var N2 = A2 * Math.cos(v), D2 = A2 * Math.sin(v);
            p.x -= N2, p.y -= D2, c.attr({ x1: p.x, y1: p.y });
          }
        } else if (g.nodeName === "path") {
          var I2 = g.getTotalLength(), O2 = "";
          if (I2 < T2 + A2) return void Y2();
          var L2 = g.getPointAtLength(0), V2 = g.getPointAtLength(0.1);
          v = Math.atan2(L2.y - V2.y, L2.x - V2.x), p = g.getPointAtLength(Math.min(A2, I2)), O2 = "0px," + A2 + "px,";
          var W2 = g.getPointAtLength(I2), X2 = g.getPointAtLength(I2 - 0.1);
          m = Math.atan2(W2.y - X2.y, W2.x - X2.x), d = g.getPointAtLength(Math.max(0, I2 - T2)), O2 += I2 - (O2 ? A2 + T2 : T2) + "px," + I2 + "px", c.style("stroke-dasharray", O2);
        }
        function Y2() {
          c.style("stroke-dasharray", "0px,100px");
        }
        function K2(q, re, R2, z) {
          q.path && (q.noRotate && (R2 = 0), n.select(g.parentNode).append("path").attr({ class: c.attr("class"), d: q.path, transform: u2(re.x, re.y) + l(180 * R2 / Math.PI) + i(z) }).style({ fill: a.rgb(h.arrowcolor), "stroke-width": 0 }));
        }
        _4 && K2(b, p, v, w), k && K2(x, d, m, y);
      };
    }, { "../../lib": 503, "../color": 366, "./arrow_paths": 348, "@plotly/d3": 58 }], 357: [function(e, t, r) {
      "use strict";
      var n = e("./draw"), a = e("./click");
      t.exports = { moduleType: "component", name: "annotations", layoutAttributes: e("./attributes"), supplyLayoutDefaults: e("./defaults"), includeBasePlot: e("../../plots/cartesian/include_components")("annotations"), calcAutorange: e("./calc_autorange"), draw: n.draw, drawOne: n.drawOne, drawRaw: n.drawRaw, hasClickToShow: a.hasClickToShow, onClick: a.onClick, convertCoords: e("./convert_coords") };
    }, { "../../plots/cartesian/include_components": 567, "./attributes": 349, "./calc_autorange": 350, "./click": 351, "./convert_coords": 353, "./defaults": 354, "./draw": 355 }], 358: [function(e, t, r) {
      "use strict";
      var n = e("../annotations/attributes"), a = e("../../plot_api/edit_types").overrideAll, o = e("../../plot_api/plot_template").templatedArray;
      t.exports = a(o("annotation", { visible: n.visible, x: { valType: "any" }, y: { valType: "any" }, z: { valType: "any" }, ax: { valType: "number" }, ay: { valType: "number" }, xanchor: n.xanchor, xshift: n.xshift, yanchor: n.yanchor, yshift: n.yshift, text: n.text, textangle: n.textangle, font: n.font, width: n.width, height: n.height, opacity: n.opacity, align: n.align, valign: n.valign, bgcolor: n.bgcolor, bordercolor: n.bordercolor, borderpad: n.borderpad, borderwidth: n.borderwidth, showarrow: n.showarrow, arrowcolor: n.arrowcolor, arrowhead: n.arrowhead, startarrowhead: n.startarrowhead, arrowside: n.arrowside, arrowsize: n.arrowsize, startarrowsize: n.startarrowsize, arrowwidth: n.arrowwidth, standoff: n.standoff, startstandoff: n.startstandoff, hovertext: n.hovertext, hoverlabel: n.hoverlabel, captureevents: n.captureevents }), "calc", "from-root");
    }, { "../../plot_api/edit_types": 536, "../../plot_api/plot_template": 543, "../annotations/attributes": 349 }], 359: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../plots/cartesian/axes");
      function o(s, i) {
        var l = i.fullSceneLayout.domain, u2 = i.fullLayout._size, c = { pdata: null, type: "linear", autorange: false, range: [-1 / 0, 1 / 0] };
        s._xa = {}, n.extendFlat(s._xa, c), a.setConvert(s._xa), s._xa._offset = u2.l + l.x[0] * u2.w, s._xa.l2p = function() {
          return 0.5 * (1 + s._pdata[0] / s._pdata[3]) * u2.w * (l.x[1] - l.x[0]);
        }, s._ya = {}, n.extendFlat(s._ya, c), a.setConvert(s._ya), s._ya._offset = u2.t + (1 - l.y[1]) * u2.h, s._ya.l2p = function() {
          return 0.5 * (1 - s._pdata[1] / s._pdata[3]) * u2.h * (l.y[1] - l.y[0]);
        };
      }
      t.exports = function(s) {
        for (var i = s.fullSceneLayout.annotations, l = 0; l < i.length; l++) o(i[l], s);
        s.fullLayout._infolayer.selectAll(".annotation-" + s.id).remove();
      };
    }, { "../../lib": 503, "../../plots/cartesian/axes": 554 }], 360: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../plots/cartesian/axes"), o = e("../../plots/array_container_defaults"), s = e("../annotations/common_defaults"), i = e("./attributes");
      function l(u2, c, f, h) {
        function p(v, m) {
          return n.coerce(u2, c, i, v, m);
        }
        function d(v) {
          var m = v + "axis", g = { _fullLayout: {} };
          return g._fullLayout[m] = f[m], a.coercePosition(c, g, p, v, v, 0.5);
        }
        p("visible") && (s(u2, c, h.fullLayout, p), d("x"), d("y"), d("z"), n.noneOrAll(u2, c, ["x", "y", "z"]), c.xref = "x", c.yref = "y", c.zref = "z", p("xanchor"), p("yanchor"), p("xshift"), p("yshift"), c.showarrow && (c.axref = "pixel", c.ayref = "pixel", p("ax", -10), p("ay", -30), n.noneOrAll(u2, c, ["ax", "ay"])));
      }
      t.exports = function(u2, c, f) {
        o(u2, c, { name: "annotations", handleItemDefaults: l, fullLayout: f.fullLayout });
      };
    }, { "../../lib": 503, "../../plots/array_container_defaults": 549, "../../plots/cartesian/axes": 554, "../annotations/common_defaults": 352, "./attributes": 358 }], 361: [function(e, t, r) {
      "use strict";
      var n = e("../annotations/draw").drawRaw, a = e("../../plots/gl3d/project"), o = ["x", "y", "z"];
      t.exports = function(s) {
        for (var i = s.fullSceneLayout, l = s.dataScale, u2 = i.annotations, c = 0; c < u2.length; c++) {
          for (var f = u2[c], h = false, p = 0; p < 3; p++) {
            var d = o[p], v = f[d], m = i[d + "axis"].r2fraction(v);
            if (m < 0 || m > 1) {
              h = true;
              break;
            }
          }
          h ? s.fullLayout._infolayer.select(".annotation-" + s.id + '[data-index="' + c + '"]').remove() : (f._pdata = a(s.glplot.cameraParams, [i.xaxis.r2l(f.x) * l[0], i.yaxis.r2l(f.y) * l[1], i.zaxis.r2l(f.z) * l[2]]), n(s.graphDiv, f, c, s.id, f._xa, f._ya));
        }
      };
    }, { "../../plots/gl3d/project": 607, "../annotations/draw": 355 }], 362: [function(e, t, r) {
      "use strict";
      var n = e("../../registry"), a = e("../../lib");
      t.exports = { moduleType: "component", name: "annotations3d", schema: { subplots: { scene: { annotations: e("./attributes") } } }, layoutAttributes: e("./attributes"), handleDefaults: e("./defaults"), includeBasePlot: function(o, s) {
        var i = n.subplotsRegistry.gl3d;
        if (!!i) for (var l = i.attrRegex, u2 = Object.keys(o), c = 0; c < u2.length; c++) {
          var f = u2[c];
          l.test(f) && (o[f].annotations || []).length && (a.pushUnique(s._basePlotModules, i), a.pushUnique(s._subplots.gl3d, f));
        }
      }, convert: e("./convert"), draw: e("./draw") };
    }, { "../../lib": 503, "../../registry": 638, "./attributes": 358, "./convert": 359, "./defaults": 360, "./draw": 361 }], 363: [function(e, t, r) {
      "use strict";
      t.exports = e("world-calendars/dist/main"), e("world-calendars/dist/plus"), e("world-calendars/dist/calendars/chinese"), e("world-calendars/dist/calendars/coptic"), e("world-calendars/dist/calendars/discworld"), e("world-calendars/dist/calendars/ethiopian"), e("world-calendars/dist/calendars/hebrew"), e("world-calendars/dist/calendars/islamic"), e("world-calendars/dist/calendars/julian"), e("world-calendars/dist/calendars/mayan"), e("world-calendars/dist/calendars/nanakshahi"), e("world-calendars/dist/calendars/nepali"), e("world-calendars/dist/calendars/persian"), e("world-calendars/dist/calendars/taiwan"), e("world-calendars/dist/calendars/thai"), e("world-calendars/dist/calendars/ummalqura");
    }, { "world-calendars/dist/calendars/chinese": 332, "world-calendars/dist/calendars/coptic": 333, "world-calendars/dist/calendars/discworld": 334, "world-calendars/dist/calendars/ethiopian": 335, "world-calendars/dist/calendars/hebrew": 336, "world-calendars/dist/calendars/islamic": 337, "world-calendars/dist/calendars/julian": 338, "world-calendars/dist/calendars/mayan": 339, "world-calendars/dist/calendars/nanakshahi": 340, "world-calendars/dist/calendars/nepali": 341, "world-calendars/dist/calendars/persian": 342, "world-calendars/dist/calendars/taiwan": 343, "world-calendars/dist/calendars/thai": 344, "world-calendars/dist/calendars/ummalqura": 345, "world-calendars/dist/main": 346, "world-calendars/dist/plus": 347 }], 364: [function(e, t, r) {
      "use strict";
      var n = e("./calendars"), a = e("../../lib"), o = e("../../constants/numerical"), s = o.EPOCHJD, i = o.ONEDAY, l = { valType: "enumerated", values: a.sortObjectKeys(n.calendars), editType: "calc", dflt: "gregorian" }, u2 = function(b, y, w, _4) {
        var k = {};
        return k[w] = l, a.coerce(b, y, k, w, _4);
      }, c = { d: { 0: "dd", "-": "d" }, e: { 0: "d", "-": "d" }, a: { 0: "D", "-": "D" }, A: { 0: "DD", "-": "DD" }, j: { 0: "oo", "-": "o" }, W: { 0: "ww", "-": "w" }, m: { 0: "mm", "-": "m" }, b: { 0: "M", "-": "M" }, B: { 0: "MM", "-": "MM" }, y: { 0: "yy", "-": "yy" }, Y: { 0: "yyyy", "-": "yyyy" }, U: "##", w: "##", c: { 0: "D M d %X yyyy", "-": "D M d %X yyyy" }, x: { 0: "mm/dd/yyyy", "-": "mm/dd/yyyy" } }, f = {};
      function h(b) {
        var y = f[b];
        return y || (y = f[b] = n.instance(b));
      }
      function p(b) {
        return a.extendFlat({}, l, { description: b });
      }
      function d(b) {
        return "Sets the calendar system to use with `" + b + "` date data.";
      }
      var v = { xcalendar: p(d("x")) }, m = a.extendFlat({}, v, { ycalendar: p(d("y")) }), g = a.extendFlat({}, m, { zcalendar: p(d("z")) }), x = p(["Sets the calendar system to use for `range` and `tick0`", "if this is a date axis. This does not set the calendar for", "interpreting data on this axis, that's specified in the trace", "or via the global `layout.calendar`"].join(" "));
      t.exports = { moduleType: "component", name: "calendars", schema: { traces: { scatter: m, bar: m, box: m, heatmap: m, contour: m, histogram: m, histogram2d: m, histogram2dcontour: m, scatter3d: g, surface: g, mesh3d: g, scattergl: m, ohlc: v, candlestick: v }, layout: { calendar: p(["Sets the default calendar system to use for interpreting and", "displaying dates throughout the plot."].join(" ")) }, subplots: { xaxis: { calendar: x }, yaxis: { calendar: x }, scene: { xaxis: { calendar: x }, yaxis: { calendar: x }, zaxis: { calendar: x } }, polar: { radialaxis: { calendar: x } } }, transforms: { filter: { valuecalendar: p(["WARNING: All transforms are deprecated and may be removed from the API in next major version.", "Sets the calendar system to use for `value`, if it is a date."].join(" ")), targetcalendar: p(["WARNING: All transforms are deprecated and may be removed from the API in next major version.", "Sets the calendar system to use for `target`, if it is an", "array of dates. If `target` is a string (eg *x*) we use the", "corresponding trace attribute (eg `xcalendar`) if it exists,", "even if `targetcalendar` is provided."].join(" ")) } } }, layoutAttributes: l, handleDefaults: u2, handleTraceDefaults: function(b, y, w, _4) {
        for (var k = 0; k < w.length; k++) u2(b, y, w[k] + "calendar", _4.calendar);
      }, CANONICAL_SUNDAY: { chinese: "2000-01-02", coptic: "2000-01-03", discworld: "2000-01-03", ethiopian: "2000-01-05", hebrew: "5000-01-01", islamic: "1000-01-02", julian: "2000-01-03", mayan: "5000-01-01", nanakshahi: "1000-01-05", nepali: "2000-01-05", persian: "1000-01-01", jalali: "1000-01-01", taiwan: "1000-01-04", thai: "2000-01-04", ummalqura: "1400-01-06" }, CANONICAL_TICK: { chinese: "2000-01-01", coptic: "2000-01-01", discworld: "2000-01-01", ethiopian: "2000-01-01", hebrew: "5000-01-01", islamic: "1000-01-01", julian: "2000-01-01", mayan: "5000-01-01", nanakshahi: "1000-01-01", nepali: "2000-01-01", persian: "1000-01-01", jalali: "1000-01-01", taiwan: "1000-01-01", thai: "2000-01-01", ummalqura: "1400-01-01" }, DFLTRANGE: { chinese: ["2000-01-01", "2001-01-01"], coptic: ["1700-01-01", "1701-01-01"], discworld: ["1800-01-01", "1801-01-01"], ethiopian: ["2000-01-01", "2001-01-01"], hebrew: ["5700-01-01", "5701-01-01"], islamic: ["1400-01-01", "1401-01-01"], julian: ["2000-01-01", "2001-01-01"], mayan: ["5200-01-01", "5201-01-01"], nanakshahi: ["0500-01-01", "0501-01-01"], nepali: ["2000-01-01", "2001-01-01"], persian: ["1400-01-01", "1401-01-01"], jalali: ["1400-01-01", "1401-01-01"], taiwan: ["0100-01-01", "0101-01-01"], thai: ["2500-01-01", "2501-01-01"], ummalqura: ["1400-01-01", "1401-01-01"] }, getCal: h, worldCalFmt: function(b, y, w) {
        for (var _4, k, T2, A2, S2, C2 = Math.floor((y + 0.05) / i) + s, E2 = h(w).fromJD(C2), F13 = 0; (F13 = b.indexOf("%", F13)) !== -1; ) (_4 = b.charAt(F13 + 1)) === "0" || _4 === "-" || _4 === "_" ? (T2 = 3, k = b.charAt(F13 + 2), _4 === "_" && (_4 = "-")) : (k = _4, _4 = "0", T2 = 2), (A2 = c[k]) ? (S2 = A2 === "##" ? "##" : E2.formatDate(A2[_4]), b = b.substr(0, F13) + S2 + b.substr(F13 + T2), F13 += S2.length) : F13 += T2;
        return b;
      } };
    }, { "../../constants/numerical": 479, "../../lib": 503, "./calendars": 363 }], 365: [function(e, t, r) {
      "use strict";
      r.defaults = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf"], r.defaultLine = "#444", r.lightLine = "#eee", r.background = "#fff", r.borderLine = "#BEC8D9", r.lightFraction = 1e3 / 11;
    }, {}], 366: [function(e, t, r) {
      "use strict";
      var n = e("tinycolor2"), a = e("fast-isnumeric"), o = e("../../lib/array").isTypedArray, s = t.exports = {}, i = e("./attributes");
      s.defaults = i.defaults;
      var l = s.defaultLine = i.defaultLine;
      s.lightLine = i.lightLine;
      var u2 = s.background = i.background;
      function c(f) {
        if (a(f) || typeof f != "string") return f;
        var h = f.trim();
        if (h.substr(0, 3) !== "rgb") return f;
        var p = h.match(/^rgba?\s*\(([^()]*)\)$/);
        if (!p) return f;
        var d = p[1].trim().split(/\s*[\s,]\s*/), v = h.charAt(3) === "a" && d.length === 4;
        if (!v && d.length !== 3) return f;
        for (var m = 0; m < d.length; m++) {
          if (!d[m].length || (d[m] = Number(d[m]), !(d[m] >= 0))) return f;
          if (m === 3) d[m] > 1 && (d[m] = 1);
          else if (d[m] >= 1) return f;
        }
        var g = Math.round(255 * d[0]) + ", " + Math.round(255 * d[1]) + ", " + Math.round(255 * d[2]);
        return v ? "rgba(" + g + ", " + d[3] + ")" : "rgb(" + g + ")";
      }
      s.tinyRGB = function(f) {
        var h = f.toRgb();
        return "rgb(" + Math.round(h.r) + ", " + Math.round(h.g) + ", " + Math.round(h.b) + ")";
      }, s.rgb = function(f) {
        return s.tinyRGB(n(f));
      }, s.opacity = function(f) {
        return f ? n(f).getAlpha() : 0;
      }, s.addOpacity = function(f, h) {
        var p = n(f).toRgb();
        return "rgba(" + Math.round(p.r) + ", " + Math.round(p.g) + ", " + Math.round(p.b) + ", " + h + ")";
      }, s.combine = function(f, h) {
        var p = n(f).toRgb();
        if (p.a === 1) return n(f).toRgbString();
        var d = n(h || u2).toRgb(), v = d.a === 1 ? d : { r: 255 * (1 - d.a) + d.r * d.a, g: 255 * (1 - d.a) + d.g * d.a, b: 255 * (1 - d.a) + d.b * d.a }, m = { r: v.r * (1 - p.a) + p.r * p.a, g: v.g * (1 - p.a) + p.g * p.a, b: v.b * (1 - p.a) + p.b * p.a };
        return n(m).toRgbString();
      }, s.contrast = function(f, h, p) {
        var d = n(f);
        return d.getAlpha() !== 1 && (d = n(s.combine(f, u2))), (d.isDark() ? h ? d.lighten(h) : u2 : p ? d.darken(p) : l).toString();
      }, s.stroke = function(f, h) {
        var p = n(h);
        f.style({ stroke: s.tinyRGB(p), "stroke-opacity": p.getAlpha() });
      }, s.fill = function(f, h) {
        var p = n(h);
        f.style({ fill: s.tinyRGB(p), "fill-opacity": p.getAlpha() });
      }, s.clean = function(f) {
        if (f && typeof f == "object") {
          var h, p, d, v, m = Object.keys(f);
          for (h = 0; h < m.length; h++) if (v = f[d = m[h]], d.substr(d.length - 5) === "color") if (Array.isArray(v)) for (p = 0; p < v.length; p++) v[p] = c(v[p]);
          else f[d] = c(v);
          else if (d.substr(d.length - 10) === "colorscale" && Array.isArray(v)) for (p = 0; p < v.length; p++) Array.isArray(v[p]) && (v[p][1] = c(v[p][1]));
          else if (Array.isArray(v)) {
            var g = v[0];
            if (!Array.isArray(g) && g && typeof g == "object") for (p = 0; p < v.length; p++) s.clean(v[p]);
          } else v && typeof v == "object" && !o(v) && s.clean(v);
        }
      };
    }, { "../../lib/array": 485, "./attributes": 365, "fast-isnumeric": 190, tinycolor2: 312 }], 367: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/cartesian/layout_attributes"), a = e("../../plots/font_attributes"), o = e("../../lib/extend").extendFlat, s = e("../../plot_api/edit_types").overrideAll;
      t.exports = s({ orientation: { valType: "enumerated", values: ["h", "v"], dflt: "v" }, thicknessmode: { valType: "enumerated", values: ["fraction", "pixels"], dflt: "pixels" }, thickness: { valType: "number", min: 0, dflt: 30 }, lenmode: { valType: "enumerated", values: ["fraction", "pixels"], dflt: "fraction" }, len: { valType: "number", min: 0, dflt: 1 }, x: { valType: "number", min: -2, max: 3 }, xanchor: { valType: "enumerated", values: ["left", "center", "right"] }, xpad: { valType: "number", min: 0, dflt: 10 }, y: { valType: "number", min: -2, max: 3 }, yanchor: { valType: "enumerated", values: ["top", "middle", "bottom"] }, ypad: { valType: "number", min: 0, dflt: 10 }, outlinecolor: n.linecolor, outlinewidth: n.linewidth, bordercolor: n.linecolor, borderwidth: { valType: "number", min: 0, dflt: 0 }, bgcolor: { valType: "color", dflt: "rgba(0,0,0,0)" }, tickmode: n.tickmode, nticks: n.nticks, tick0: n.tick0, dtick: n.dtick, tickvals: n.tickvals, ticktext: n.ticktext, ticks: o({}, n.ticks, { dflt: "" }), ticklabeloverflow: o({}, n.ticklabeloverflow, {}), ticklabelposition: { valType: "enumerated", values: ["outside", "inside", "outside top", "inside top", "outside left", "inside left", "outside right", "inside right", "outside bottom", "inside bottom"], dflt: "outside" }, ticklen: n.ticklen, tickwidth: n.tickwidth, tickcolor: n.tickcolor, showticklabels: n.showticklabels, tickfont: a({}), tickangle: n.tickangle, tickformat: n.tickformat, tickformatstops: n.tickformatstops, tickprefix: n.tickprefix, showtickprefix: n.showtickprefix, ticksuffix: n.ticksuffix, showticksuffix: n.showticksuffix, separatethousands: n.separatethousands, exponentformat: n.exponentformat, minexponent: n.minexponent, showexponent: n.showexponent, title: { text: { valType: "string" }, font: a({}), side: { valType: "enumerated", values: ["right", "top", "bottom"] } }, _deprecated: { title: { valType: "string" }, titlefont: a({}), titleside: { valType: "enumerated", values: ["right", "top", "bottom"], dflt: "top" } } }, "colorbars", "from-root");
    }, { "../../lib/extend": 493, "../../plot_api/edit_types": 536, "../../plots/cartesian/layout_attributes": 569, "../../plots/font_attributes": 585 }], 368: [function(e, t, r) {
      "use strict";
      t.exports = { cn: { colorbar: "colorbar", cbbg: "cbbg", cbfill: "cbfill", cbfills: "cbfills", cbline: "cbline", cblines: "cblines", cbaxis: "cbaxis", cbtitleunshift: "cbtitleunshift", cbtitle: "cbtitle", cboutline: "cboutline", crisp: "crisp", jsPlaceholder: "js-placeholder" } };
    }, {}], 369: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../plot_api/plot_template"), o = e("../../plots/cartesian/tick_value_defaults"), s = e("../../plots/cartesian/tick_mark_defaults"), i = e("../../plots/cartesian/tick_label_defaults"), l = e("../../plots/cartesian/prefix_suffix_defaults"), u2 = e("./attributes");
      t.exports = function(c, f, h) {
        var p = a.newContainer(f, "colorbar"), d = c.colorbar || {};
        function v(C2, E2) {
          return n.coerce(d, p, u2, C2, E2);
        }
        var m = h.margin || { t: 0, b: 0, l: 0, r: 0 }, g = h.width - m.l - m.r, x = h.height - m.t - m.b, b = v("orientation") === "v", y = v("thicknessmode");
        v("thickness", y === "fraction" ? 30 / (b ? g : x) : 30);
        var w = v("lenmode");
        v("len", w === "fraction" ? 1 : b ? x : g), v("x", b ? 1.02 : 0.5), v("xanchor", b ? "left" : "center"), v("xpad"), v("y", b ? 0.5 : 1.02), v("yanchor", b ? "middle" : "bottom"), v("ypad"), n.noneOrAll(d, p, ["x", "y"]), v("outlinecolor"), v("outlinewidth"), v("bordercolor"), v("borderwidth"), v("bgcolor");
        var _4 = n.coerce(d, p, { ticklabelposition: { valType: "enumerated", dflt: "outside", values: b ? ["outside", "inside", "outside top", "inside top", "outside bottom", "inside bottom"] : ["outside", "inside", "outside left", "inside left", "outside right", "inside right"] } }, "ticklabelposition");
        v("ticklabeloverflow", _4.indexOf("inside") !== -1 ? "hide past domain" : "hide past div"), o(d, p, v, "linear");
        var k = h.font, T2 = { outerTicks: false, font: k };
        _4.indexOf("inside") !== -1 && (T2.bgColor = "black"), l(d, p, v, "linear", T2), i(d, p, v, "linear", T2), s(d, p, v, "linear", T2), v("title.text", h._dfltTitle.colorbar);
        var A2 = p.tickfont, S2 = n.extendFlat({}, A2, { color: k.color, size: n.bigFont(A2.size) });
        n.coerceFont(v, "title.font", S2), v("title.side", b ? "top" : "right");
      };
    }, { "../../lib": 503, "../../plot_api/plot_template": 543, "../../plots/cartesian/prefix_suffix_defaults": 573, "../../plots/cartesian/tick_label_defaults": 578, "../../plots/cartesian/tick_mark_defaults": 579, "../../plots/cartesian/tick_value_defaults": 580, "./attributes": 367 }], 370: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("tinycolor2"), o = e("../../plots/plots"), s = e("../../registry"), i = e("../../plots/cartesian/axes"), l = e("../dragelement"), u2 = e("../../lib"), c = u2.strTranslate, f = e("../../lib/extend").extendFlat, h = e("../../lib/setcursor"), p = e("../drawing"), d = e("../color"), v = e("../titles"), m = e("../../lib/svg_text_utils"), g = e("../colorscale/helpers").flipScale, x = e("../../plots/cartesian/axis_defaults"), b = e("../../plots/cartesian/position_defaults"), y = e("../../plots/cartesian/layout_attributes"), w = e("../../constants/alignment"), _4 = w.LINE_SPACING, k = w.FROM_TL, T2 = w.FROM_BR, A2 = e("./constants").cn;
      t.exports = { draw: function(S2) {
        var C2 = S2._fullLayout._infolayer.selectAll("g." + A2.colorbar).data(function(E2) {
          var F13, N2, D2, I2, O2 = E2._fullLayout, L2 = E2.calcdata, V2 = [];
          function W2(Q2) {
            return f(Q2, { _fillcolor: null, _line: { color: null, width: null, dash: null }, _levels: { start: null, end: null, size: null }, _filllevels: null, _fillgradient: null, _zrange: null });
          }
          function X2() {
            typeof I2.calc == "function" ? I2.calc(E2, D2, F13) : (F13._fillgradient = N2.reversescale ? g(N2.colorscale) : N2.colorscale, F13._zrange = [N2[I2.min], N2[I2.max]]);
          }
          for (var Y2 = 0; Y2 < L2.length; Y2++) {
            var K2 = L2[Y2], q = (D2 = K2[0].trace)._module.colorbar;
            if (D2.visible === true && q) for (var re = Array.isArray(q), R2 = re ? q : [q], z = 0; z < R2.length; z++) {
              var H2 = (I2 = R2[z]).container;
              (N2 = H2 ? D2[H2] : D2) && N2.showscale && ((F13 = W2(N2.colorbar))._id = "cb" + D2.uid + (re && H2 ? "-" + H2 : ""), F13._traceIndex = D2.index, F13._propPrefix = (H2 ? H2 + "." : "") + "colorbar.", F13._meta = D2._meta, X2(), V2.push(F13));
            }
          }
          for (var te in O2._colorAxes) if ((N2 = O2[te]).showscale) {
            var j = O2._colorAxes[te];
            (F13 = W2(N2.colorbar))._id = "cb" + te, F13._propPrefix = te + ".colorbar.", F13._meta = O2._meta, I2 = { min: "cmin", max: "cmax" }, j[0] !== "heatmap" && (D2 = j[1], I2.calc = D2._module.colorbar.calc), X2(), V2.push(F13);
          }
          return V2;
        }(S2), function(E2) {
          return E2._id;
        });
        C2.enter().append("g").attr("class", function(E2) {
          return E2._id;
        }).classed(A2.colorbar, true), C2.each(function(E2) {
          var F13 = n.select(this);
          u2.ensureSingle(F13, "rect", A2.cbbg), u2.ensureSingle(F13, "g", A2.cbfills), u2.ensureSingle(F13, "g", A2.cblines), u2.ensureSingle(F13, "g", A2.cbaxis, function(D2) {
            D2.classed(A2.crisp, true);
          }), u2.ensureSingle(F13, "g", A2.cbtitleunshift, function(D2) {
            D2.append("g").classed(A2.cbtitle, true);
          }), u2.ensureSingle(F13, "rect", A2.cboutline);
          var N2 = function(D2, I2, O2) {
            var L2 = I2.orientation === "v", V2 = I2.len, W2 = I2.lenmode, X2 = I2.thickness, Y2 = I2.thicknessmode, K2 = I2.outlinewidth, q = I2.borderwidth, re = I2.bgcolor, R2 = I2.xanchor, z = I2.yanchor, H2 = I2.xpad, te = I2.ypad, j = I2.x, Q2 = L2 ? I2.y : 1 - I2.y, Z2 = O2._fullLayout, ne = Z2._size, ae = I2._fillcolor, ue = I2._line, le = I2.title, ce = le.side, se = I2._zrange || n.extent((typeof ae == "function" ? ae : ue.color).domain()), he = typeof ue.color == "function" ? ue.color : function() {
              return ue.color;
            }, me = typeof ae == "function" ? ae : function() {
              return ae;
            }, we = I2._levels, be = function(Ge, st, Ie) {
              var Pe, $e, Ve = st._levels, ut = [], Re = [], qe = Ve.end + Ve.size / 100, je = Ve.size, rt = 1.001 * Ie[0] - 1e-3 * Ie[1], He = 1.001 * Ie[1] - 1e-3 * Ie[0];
              for ($e = 0; $e < 1e5 && (Pe = Ve.start + $e * je, !(je > 0 ? Pe >= qe : Pe <= qe)); $e++) Pe > rt && Pe < He && ut.push(Pe);
              if (st._fillgradient) Re = [0];
              else if (typeof st._fillcolor == "function") {
                var xe = st._filllevels;
                if (xe) for (qe = xe.end + xe.size / 100, je = xe.size, $e = 0; $e < 1e5 && (Pe = xe.start + $e * je, !(je > 0 ? Pe >= qe : Pe <= qe)); $e++) Pe > Ie[0] && Pe < Ie[1] && Re.push(Pe);
                else (Re = ut.map(function(Ne) {
                  return Ne - Ve.size / 2;
                })).push(Re[Re.length - 1] + Ve.size);
              } else st._fillcolor && typeof st._fillcolor == "string" && (Re = [0]);
              return Ve.size < 0 && (ut.reverse(), Re.reverse()), { line: ut, fill: Re };
            }(0, I2, se), Ae = be.fill, pe = be.line, ve = Math.round(X2 * (Y2 === "fraction" ? L2 ? ne.w : ne.h : 1)), Ee = ve / (L2 ? ne.w : ne.h), Se = Math.round(V2 * (W2 === "fraction" ? L2 ? ne.h : ne.w : 1)), Ce = Se / (L2 ? ne.h : ne.w), Be = Math.round(L2 ? j * ne.w + H2 : Q2 * ne.h + te), Ue = { center: 0.5, right: 1 }[R2] || 0, Ke = { top: 1, middle: 0.5 }[z] || 0, ct = L2 ? j - Ue * Ee : Q2 - Ke * Ee, We = L2 ? Q2 - Ke * Ce : j - Ue * Ce, Ze = Math.round(L2 ? ne.h * (1 - We) : ne.w * We);
            I2._lenFrac = Ce, I2._thickFrac = Ee, I2._uFrac = ct, I2._vFrac = We;
            var it = I2._axis = function(Ge, st, Ie) {
              var Pe = Ge._fullLayout, $e = st.orientation === "v", Ve = { type: "linear", range: Ie, tickmode: st.tickmode, nticks: st.nticks, tick0: st.tick0, dtick: st.dtick, tickvals: st.tickvals, ticktext: st.ticktext, ticks: st.ticks, ticklen: st.ticklen, tickwidth: st.tickwidth, tickcolor: st.tickcolor, showticklabels: st.showticklabels, ticklabelposition: st.ticklabelposition, ticklabeloverflow: st.ticklabeloverflow, tickfont: st.tickfont, tickangle: st.tickangle, tickformat: st.tickformat, exponentformat: st.exponentformat, minexponent: st.minexponent, separatethousands: st.separatethousands, showexponent: st.showexponent, showtickprefix: st.showtickprefix, tickprefix: st.tickprefix, showticksuffix: st.showticksuffix, ticksuffix: st.ticksuffix, title: st.title, showline: true, anchor: "free", side: $e ? "right" : "bottom", position: 1 }, ut = $e ? "y" : "x", Re = { type: "linear", _id: ut + st._id }, qe = { letter: ut, font: Pe.font, noHover: true, noTickson: true, noTicklabelmode: true, calendar: Pe.calendar };
              function je(rt, He) {
                return u2.coerce(Ve, Re, y, rt, He);
              }
              return x(Ve, Re, je, qe, Pe), b(Ve, Re, je, qe), Re;
            }(O2, I2, se);
            it.position = Ee + (L2 ? j + H2 / ne.w : Q2 + te / ne.h);
            var ot = ["top", "bottom"].indexOf(ce) !== -1;
            if (L2 && ot && (it.title.side = ce, it.titlex = j + H2 / ne.w, it.titley = We + (le.side === "top" ? Ce - te / ne.h : te / ne.h)), L2 || ot || (it.title.side = ce, it.titley = Q2 + te / ne.h, it.titlex = We + H2 / ne.w), ue.color && I2.tickmode === "auto") {
              it.tickmode = "linear", it.tick0 = we.start;
              var mt = we.size, wt = u2.constrain(Se / 50, 4, 15) + 1, Et = (se[1] - se[0]) / ((I2.nticks || wt) * mt);
              if (Et > 1) {
                var zt = Math.pow(10, Math.floor(Math.log(Et) / Math.LN10));
                mt *= zt * u2.roundUp(Et / zt, [2, 5, 10]), (Math.abs(we.start) / we.size + 1e-6) % 1 < 2e-6 && (it.tick0 = 0);
              }
              it.dtick = mt;
            }
            it.domain = L2 ? [We + te / ne.h, We + Ce - te / ne.h] : [We + H2 / ne.w, We + Ce - H2 / ne.w], it.setScale(), D2.attr("transform", c(Math.round(ne.l), Math.round(ne.t)));
            var Nt, yt = D2.select("." + A2.cbtitleunshift).attr("transform", c(-Math.round(ne.l), -Math.round(ne.t))), pt = it.ticklabelposition, Ot = it.title.font.size, Jt = D2.select("." + A2.cbaxis), tr = 0, Ye = 0;
            function at(Ge, st) {
              var Ie = { propContainer: it, propName: I2._propPrefix + "title", traceIndex: I2._traceIndex, _meta: I2._meta, placeholder: Z2._dfltTitle.colorbar, containerGroup: D2.select("." + A2.cbtitle) }, Pe = Ge.charAt(0) === "h" ? Ge.substr(1) : "h" + Ge;
              D2.selectAll("." + Pe + ",." + Pe + "-math-group").remove(), v.draw(O2, Ge, f(Ie, st || {}));
            }
            return u2.syncOrAsync([o.previousPromises, function() {
              var Ge, st;
              (L2 && ot || !L2 && !ot) && (ce === "top" && (Ge = H2 + ne.l + ne.w * j, st = te + ne.t + ne.h * (1 - We - Ce) + 3 + 0.75 * Ot), ce === "bottom" && (Ge = H2 + ne.l + ne.w * j, st = te + ne.t + ne.h * (1 - We) - 3 - 0.25 * Ot), ce === "right" && (st = te + ne.t + ne.h * Q2 + 3 + 0.75 * Ot, Ge = H2 + ne.l + ne.w * We), at(it._id + "title", { attributes: { x: Ge, y: st, "text-anchor": L2 ? "start" : "middle" } }));
            }, function() {
              if (!L2 && !ot || L2 && ot) {
                var Ge, st = D2.select("." + A2.cbtitle), Ie = st.select("text"), Pe = [-K2 / 2, K2 / 2], $e = st.select(".h" + it._id + "title-math-group").node(), Ve = 15.6;
                if (Ie.node() && (Ve = parseInt(Ie.node().style.fontSize, 10) * _4), $e ? (Ge = p.bBox($e), Ye = Ge.width, (tr = Ge.height) > Ve && (Pe[1] -= (tr - Ve) / 2)) : Ie.node() && !Ie.classed(A2.jsPlaceholder) && (Ge = p.bBox(Ie.node()), Ye = Ge.width, tr = Ge.height), L2) {
                  if (tr) {
                    if (tr += 5, ce === "top") it.domain[1] -= tr / ne.h, Pe[1] *= -1;
                    else {
                      it.domain[0] += tr / ne.h;
                      var ut = m.lineCount(Ie);
                      Pe[1] += (1 - ut) * Ve;
                    }
                    st.attr("transform", c(Pe[0], Pe[1])), it.setScale();
                  }
                } else Ye && (ce === "right" && (it.domain[0] += (Ye + Ot / 2) / ne.w), st.attr("transform", c(Pe[0], Pe[1])), it.setScale());
              }
              D2.selectAll("." + A2.cbfills + ",." + A2.cblines).attr("transform", L2 ? c(0, Math.round(ne.h * (1 - it.domain[1]))) : c(Math.round(ne.w * it.domain[0]), 0)), Jt.attr("transform", L2 ? c(0, Math.round(-ne.t)) : c(Math.round(-ne.l), 0));
              var Re = D2.select("." + A2.cbfills).selectAll("rect." + A2.cbfill).attr("style", "").data(Ae);
              Re.enter().append("rect").classed(A2.cbfill, true).style("stroke", "none"), Re.exit().remove();
              var qe = se.map(it.c2p).map(Math.round).sort(function(Ne, ke) {
                return Ne - ke;
              });
              Re.each(function(Ne, ke) {
                var Me = [ke === 0 ? se[0] : (Ae[ke] + Ae[ke - 1]) / 2, ke === Ae.length - 1 ? se[1] : (Ae[ke] + Ae[ke + 1]) / 2].map(it.c2p).map(Math.round);
                L2 && (Me[1] = u2.constrain(Me[1] + (Me[1] > Me[0]) ? 1 : -1, qe[0], qe[1]));
                var Le = n.select(this).attr(L2 ? "x" : "y", Be).attr(L2 ? "y" : "x", n.min(Me)).attr(L2 ? "width" : "height", Math.max(ve, 2)).attr(L2 ? "height" : "width", Math.max(n.max(Me) - n.min(Me), 2));
                if (I2._fillgradient) p.gradient(Le, O2, I2._id, L2 ? "vertical" : "horizontalreversed", I2._fillgradient, "fill");
                else {
                  var ze = me(Ne).replace("e-", "");
                  Le.attr("fill", a(ze).toHexString());
                }
              });
              var je = D2.select("." + A2.cblines).selectAll("path." + A2.cbline).data(ue.color && ue.width ? pe : []);
              je.enter().append("path").classed(A2.cbline, true), je.exit().remove(), je.each(function(Ne) {
                var ke = Be, Me = Math.round(it.c2p(Ne)) + ue.width / 2 % 1;
                n.select(this).attr("d", "M" + (L2 ? ke + "," + Me : Me + "," + ke) + (L2 ? "h" : "v") + ve).call(p.lineGroupStyle, ue.width, he(Ne), ue.dash);
              }), Jt.selectAll("g." + it._id + "tick,path").remove();
              var rt = Be + ve + (K2 || 0) / 2 - (I2.ticks === "outside" ? 1 : 0), He = i.calcTicks(it), xe = i.getTickSigns(it)[2];
              return i.drawTicks(O2, it, { vals: it.ticks === "inside" ? i.clipEnds(it, He) : He, layer: Jt, path: i.makeTickPath(it, rt, xe), transFn: i.makeTransTickFn(it) }), i.drawLabels(O2, it, { vals: He, layer: Jt, transFn: i.makeTransTickLabelFn(it), labelFns: i.makeLabelFns(it, rt) });
            }, function() {
              if (L2 && !ot || !L2 && ot) {
                var Ge, st, Ie = it.position || 0, Pe = it._offset + it._length / 2;
                if (ce === "right") st = Pe, Ge = ne.l + ne.w * Ie + 10 + Ot * (it.showticklabels ? 1 : 0.5);
                else if (Ge = Pe, ce === "bottom" && (st = ne.t + ne.h * Ie + 10 + (pt.indexOf("inside") === -1 ? it.tickfont.size : 0) + (it.ticks !== "intside" && I2.ticklen || 0)), ce === "top") {
                  var $e = le.text.split("<br>").length;
                  st = ne.t + ne.h * Ie + 10 - ve - _4 * Ot * $e;
                }
                at((L2 ? "h" : "v") + it._id + "title", { avoid: { selection: n.select(O2).selectAll("g." + it._id + "tick"), side: ce, offsetTop: L2 ? 0 : ne.t, offsetLeft: L2 ? ne.l : 0, maxShift: L2 ? Z2.width : Z2.height }, attributes: { x: Ge, y: st, "text-anchor": "middle" }, transform: { rotate: L2 ? -90 : 0, offset: 0 } });
              }
            }, o.previousPromises, function() {
              var Ge, st = ve + K2 / 2;
              pt.indexOf("inside") === -1 && (Ge = p.bBox(Jt.node()), st += L2 ? Ge.width : Ge.height), Nt = yt.select("text");
              var Ie = 0, Pe = L2 && ce === "top", $e = !L2 && ce === "right", Ve = 0;
              if (Nt.node() && !Nt.classed(A2.jsPlaceholder)) {
                var ut, Re = yt.select(".h" + it._id + "title-math-group").node();
                Re && (L2 && ot || !L2 && !ot) ? (Ie = (Ge = p.bBox(Re)).width, ut = Ge.height) : (Ie = (Ge = p.bBox(yt.node())).right - ne.l - (L2 ? Be : Ze), ut = Ge.bottom - ne.t - (L2 ? Ze : Be), L2 || ce !== "top" || (st += Ge.height, Ve = Ge.height)), $e && (Nt.attr("transform", c(Ie / 2 + Ot / 2, 0)), Ie *= 2), st = Math.max(st, L2 ? Ie : ut);
              }
              var qe = 2 * (L2 ? H2 : te) + st + q + K2 / 2, je = 0;
              !L2 && le.text && z === "bottom" && Q2 <= 0 && (qe += je = qe / 2, Ve += je), Z2._hColorbarMoveTitle = je, Z2._hColorbarMoveCBTitle = Ve;
              var rt = q + K2;
              D2.select("." + A2.cbbg).attr("x", (L2 ? Be : Ze) - rt / 2 - (L2 ? H2 : 0)).attr("y", (L2 ? Ze : Be) - (L2 ? Se : te + Ve - je)).attr(L2 ? "width" : "height", Math.max(qe - je, 2)).attr(L2 ? "height" : "width", Math.max(Se + rt, 2)).call(d.fill, re).call(d.stroke, I2.bordercolor).style("stroke-width", q);
              var He = $e ? Math.max(Ie - 10, 0) : 0;
              if (D2.selectAll("." + A2.cboutline).attr("x", (L2 ? Be : Ze + H2) + He).attr("y", (L2 ? Ze + te - Se : Be) + (Pe ? tr : 0)).attr(L2 ? "width" : "height", Math.max(ve, 2)).attr(L2 ? "height" : "width", Math.max(Se - (L2 ? 2 * te + tr : 2 * H2 + He), 2)).call(d.stroke, I2.outlinecolor).style({ fill: "none", "stroke-width": K2 }), D2.attr("transform", c(ne.l - (L2 ? Ue * qe : 0), ne.t - (L2 ? 0 : (1 - Ke) * qe - Ve))), !L2 && (q || a(re).getAlpha() && !a.equals(Z2.paper_bgcolor, re))) {
                var xe = Jt.selectAll("text"), Ne = xe[0].length, ke = D2.select("." + A2.cbbg).node(), Me = p.bBox(ke), Le = p.getTranslate(D2);
                xe.each(function(kt, jt) {
                  var Vt = Ne - 1;
                  if (jt === 0 || jt === Vt) {
                    var Kt, rr = p.bBox(this), Tr = p.getTranslate(this);
                    if (jt === Vt) {
                      var yr = rr.right + Tr.x;
                      (Kt = Me.right + Le.x + Ze - q - 2 + j - yr) > 0 && (Kt = 0);
                    } else if (jt === 0) {
                      var pr = rr.left + Tr.x;
                      (Kt = Me.left + Le.x + Ze + q + 2 - pr) < 0 && (Kt = 0);
                    }
                    Kt && (Ne < 3 ? this.setAttribute("transform", "translate(" + Kt + ",0) " + this.getAttribute("transform")) : this.setAttribute("visibility", "hidden"));
                  }
                });
              }
              var ze = {}, ft = k[R2], De = T2[R2], Je = k[z], tt = T2[z], vt = qe - ve;
              L2 ? (W2 === "pixels" ? (ze.y = Q2, ze.t = Se * Je, ze.b = Se * tt) : (ze.t = ze.b = 0, ze.yt = Q2 + V2 * Je, ze.yb = Q2 - V2 * tt), Y2 === "pixels" ? (ze.x = j, ze.l = qe * ft, ze.r = qe * De) : (ze.l = vt * ft, ze.r = vt * De, ze.xl = j - X2 * ft, ze.xr = j + X2 * De)) : (W2 === "pixels" ? (ze.x = j, ze.l = Se * ft, ze.r = Se * De) : (ze.l = ze.r = 0, ze.xl = j + V2 * ft, ze.xr = j - V2 * De), Y2 === "pixels" ? (ze.y = 1 - Q2, ze.t = qe * Je, ze.b = qe * tt) : (ze.t = vt * Je, ze.b = vt * tt, ze.yt = Q2 - X2 * Je, ze.yb = Q2 + X2 * tt)), o.autoMargin(O2, I2._id, ze);
            }], O2);
          }(F13, E2, S2);
          N2 && N2.then && (S2._promises || []).push(N2), S2._context.edits.colorbarPosition && function(D2, I2, O2) {
            var L2, V2, W2, X2 = I2.orientation === "v", Y2 = O2._fullLayout._size;
            l.init({ element: D2.node(), gd: O2, prepFn: function() {
              L2 = D2.attr("transform"), h(D2);
            }, moveFn: function(K2, q) {
              D2.attr("transform", L2 + c(K2, q)), V2 = l.align((X2 ? I2._uFrac : I2._vFrac) + K2 / Y2.w, X2 ? I2._thickFrac : I2._lenFrac, 0, 1, I2.xanchor), W2 = l.align((X2 ? I2._vFrac : 1 - I2._uFrac) - q / Y2.h, X2 ? I2._lenFrac : I2._thickFrac, 0, 1, I2.yanchor);
              var re = l.getCursor(V2, W2, I2.xanchor, I2.yanchor);
              h(D2, re);
            }, doneFn: function() {
              if (h(D2), V2 !== void 0 && W2 !== void 0) {
                var K2 = {};
                K2[I2._propPrefix + "x"] = V2, K2[I2._propPrefix + "y"] = W2, I2._traceIndex !== void 0 ? s.call("_guiRestyle", O2, K2, I2._traceIndex) : s.call("_guiRelayout", O2, K2);
              }
            } });
          }(F13, E2, S2);
        }), C2.exit().each(function(E2) {
          o.autoMargin(S2, E2._id);
        }).remove(), C2.order();
      } };
    }, { "../../constants/alignment": 471, "../../lib": 503, "../../lib/extend": 493, "../../lib/setcursor": 524, "../../lib/svg_text_utils": 529, "../../plots/cartesian/axes": 554, "../../plots/cartesian/axis_defaults": 556, "../../plots/cartesian/layout_attributes": 569, "../../plots/cartesian/position_defaults": 572, "../../plots/plots": 619, "../../registry": 638, "../color": 366, "../colorscale/helpers": 377, "../dragelement": 385, "../drawing": 388, "../titles": 464, "./constants": 368, "@plotly/d3": 58, tinycolor2: 312 }], 371: [function(e, t, r) {
      "use strict";
      var n = e("../../lib");
      t.exports = function(a) {
        return n.isPlainObject(a.colorbar);
      };
    }, { "../../lib": 503 }], 372: [function(e, t, r) {
      "use strict";
      t.exports = { moduleType: "component", name: "colorbar", attributes: e("./attributes"), supplyDefaults: e("./defaults"), draw: e("./draw").draw, hasColorbar: e("./has_colorbar") };
    }, { "./attributes": 367, "./defaults": 369, "./draw": 370, "./has_colorbar": 371 }], 373: [function(e, t, r) {
      "use strict";
      var n = e("../colorbar/attributes"), a = e("../../lib/regex").counter, o = e("../../lib/sort_object_keys"), s = e("./scales.js").scales;
      o(s);
      function i(l) {
        return "`" + l + "`";
      }
      t.exports = function(l, u2) {
        l = l || "";
        var c, f = (u2 = u2 || {}).cLetter || "c", h = ("onlyIfNumerical" in u2 ? u2.onlyIfNumerical : Boolean(l), "noScale" in u2 ? u2.noScale : l === "marker.line"), p = "showScaleDflt" in u2 ? u2.showScaleDflt : f === "z", d = typeof u2.colorscaleDflt == "string" ? s[u2.colorscaleDflt] : null, v = u2.editTypeOverride || "", m = l ? l + "." : "";
        "colorAttr" in u2 ? (c = u2.colorAttr, u2.colorAttr) : i(m + (c = { z: "z", c: "color" }[f]));
        var g = f + "auto", x = f + "min", b = f + "max", y = f + "mid", w = (i(m + g), i(m + x), i(m + b), {});
        w[x] = w[b] = void 0;
        var _4 = {};
        _4[g] = false;
        var k = {};
        return c === "color" && (k.color = { valType: "color", arrayOk: true, editType: v || "style" }, u2.anim && (k.color.anim = true)), k[g] = { valType: "boolean", dflt: true, editType: "calc", impliedEdits: w }, k[x] = { valType: "number", dflt: null, editType: v || "plot", impliedEdits: _4 }, k[b] = { valType: "number", dflt: null, editType: v || "plot", impliedEdits: _4 }, k[y] = { valType: "number", dflt: null, editType: "calc", impliedEdits: w }, k.colorscale = { valType: "colorscale", editType: "calc", dflt: d, impliedEdits: { autocolorscale: false } }, k.autocolorscale = { valType: "boolean", dflt: u2.autoColorDflt !== false, editType: "calc", impliedEdits: { colorscale: void 0 } }, k.reversescale = { valType: "boolean", dflt: false, editType: "plot" }, h || (k.showscale = { valType: "boolean", dflt: p, editType: "calc" }, k.colorbar = n), u2.noColorAxis || (k.coloraxis = { valType: "subplotid", regex: a("coloraxis"), dflt: null, editType: "calc" }), k;
      };
    }, { "../../lib/regex": 520, "../../lib/sort_object_keys": 526, "../colorbar/attributes": 367, "./scales.js": 381 }], 374: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("../../lib"), o = e("./helpers").extractOpts;
      t.exports = function(s, i, l) {
        var u2, c = s._fullLayout, f = l.vals, h = l.containerStr, p = h ? a.nestedProperty(i, h).get() : i, d = o(p), v = d.auto !== false, m = d.min, g = d.max, x = d.mid, b = function() {
          return a.aggNums(Math.min, null, f);
        }, y = function() {
          return a.aggNums(Math.max, null, f);
        };
        m === void 0 ? m = b() : v && (m = p._colorAx && n(m) ? Math.min(m, b()) : b()), g === void 0 ? g = y() : v && (g = p._colorAx && n(g) ? Math.max(g, y()) : y()), v && x !== void 0 && (g - x > x - m ? m = x - (g - x) : g - x < x - m && (g = x + (x - m))), m === g && (m -= 0.5, g += 0.5), d._sync("min", m), d._sync("max", g), d.autocolorscale && (u2 = m * g < 0 ? c.colorscale.diverging : m >= 0 ? c.colorscale.sequential : c.colorscale.sequentialminus, d._sync("colorscale", u2));
      };
    }, { "../../lib": 503, "./helpers": 377, "fast-isnumeric": 190 }], 375: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("./helpers").hasColorscale, o = e("./helpers").extractOpts;
      t.exports = function(s, i) {
        function l(v, m) {
          var g = v["_" + m];
          g !== void 0 && (v[m] = g);
        }
        function u2(v, m) {
          var g = m.container ? n.nestedProperty(v, m.container).get() : v;
          if (g) if (g.coloraxis) g._colorAx = i[g.coloraxis];
          else {
            var x = o(g), b = x.auto;
            (b || x.min === void 0) && l(g, m.min), (b || x.max === void 0) && l(g, m.max), x.autocolorscale && l(g, "colorscale");
          }
        }
        for (var c = 0; c < s.length; c++) {
          var f = s[c], h = f._module.colorbar;
          if (h) if (Array.isArray(h)) for (var p = 0; p < h.length; p++) u2(f, h[p]);
          else u2(f, h);
          a(f, "marker.line") && u2(f, { container: "marker.line", min: "cmin", max: "cmax" });
        }
        for (var d in i._colorAxes) u2(i[d], { min: "cmin", max: "cmax" });
      };
    }, { "../../lib": 503, "./helpers": 377 }], 376: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("../../lib"), o = e("../colorbar/has_colorbar"), s = e("../colorbar/defaults"), i = e("./scales").isValid, l = e("../../registry").traceIs;
      function u2(c, f) {
        var h = f.slice(0, f.length - 1);
        return f ? a.nestedProperty(c, h).get() || {} : c;
      }
      t.exports = function c(f, h, p, d, v) {
        var m = v.prefix, g = v.cLetter, x = "_module" in h, b = u2(f, m), y = u2(h, m), w = u2(h._template || {}, m) || {}, _4 = function() {
          return delete f.coloraxis, delete h.coloraxis, c(f, h, p, d, v);
        };
        if (x) {
          var k = p._colorAxes || {}, T2 = d(m + "coloraxis");
          if (T2) {
            var A2 = l(h, "contour") && a.nestedProperty(h, "contours.coloring").get() || "heatmap", S2 = k[T2];
            return void (S2 ? (S2[2].push(_4), S2[0] !== A2 && (S2[0] = false, a.warn(["Ignoring coloraxis:", T2, "setting", "as it is linked to incompatible colorscales."].join(" ")))) : k[T2] = [A2, h, [_4]]);
          }
        }
        var C2 = b[g + "min"], E2 = b[g + "max"], F13 = n(C2) && n(E2) && C2 < E2;
        d(m + g + "auto", !F13) ? d(m + g + "mid") : (d(m + g + "min"), d(m + g + "max"));
        var N2, D2, I2 = b.colorscale, O2 = w.colorscale;
        I2 !== void 0 && (N2 = !i(I2)), O2 !== void 0 && (N2 = !i(O2)), d(m + "autocolorscale", N2), d(m + "colorscale"), d(m + "reversescale"), m !== "marker.line." && (m && x && (D2 = o(b)), d(m + "showscale", D2) && (m && w && (y._template = w), s(b, y, p)));
      };
    }, { "../../lib": 503, "../../registry": 638, "../colorbar/defaults": 369, "../colorbar/has_colorbar": 371, "./scales": 381, "fast-isnumeric": 190 }], 377: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("tinycolor2"), o = e("fast-isnumeric"), s = e("../../lib"), i = e("../color"), l = e("./scales").isValid, u2 = ["showscale", "autocolorscale", "colorscale", "reversescale", "colorbar"], c = ["min", "max", "mid", "auto"];
      function f(m) {
        var g, x, b, y = m._colorAx, w = y || m, _4 = {};
        for (x = 0; x < u2.length; x++) _4[b = u2[x]] = w[b];
        if (y) for (g = "c", x = 0; x < c.length; x++) _4[b = c[x]] = w["c" + b];
        else {
          var k;
          for (x = 0; x < c.length; x++) ((k = "c" + (b = c[x])) in w || (k = "z" + b) in w) && (_4[b] = w[k]);
          g = k.charAt(0);
        }
        return _4._sync = function(T2, A2) {
          var S2 = c.indexOf(T2) !== -1 ? g + T2 : T2;
          w[S2] = w["_" + S2] = A2;
        }, _4;
      }
      function h(m) {
        for (var g = f(m), x = g.min, b = g.max, y = g.reversescale ? p(g.colorscale) : g.colorscale, w = y.length, _4 = new Array(w), k = new Array(w), T2 = 0; T2 < w; T2++) {
          var A2 = y[T2];
          _4[T2] = x + A2[0] * (b - x), k[T2] = A2[1];
        }
        return { domain: _4, range: k };
      }
      function p(m) {
        for (var g = m.length, x = new Array(g), b = g - 1, y = 0; b >= 0; b--, y++) {
          var w = m[b];
          x[y] = [1 - w[0], w[1]];
        }
        return x;
      }
      function d(m, g) {
        g = g || {};
        for (var x = m.domain, b = m.range, y = b.length, w = new Array(y), _4 = 0; _4 < y; _4++) {
          var k = a(b[_4]).toRgb();
          w[_4] = [k.r, k.g, k.b, k.a];
        }
        var T2, A2 = n.scale.linear().domain(x).range(w).clamp(true), S2 = g.noNumericCheck, C2 = g.returnArray;
        return (T2 = S2 && C2 ? A2 : S2 ? function(E2) {
          return v(A2(E2));
        } : C2 ? function(E2) {
          return o(E2) ? A2(E2) : a(E2).isValid() ? E2 : i.defaultLine;
        } : function(E2) {
          return o(E2) ? v(A2(E2)) : a(E2).isValid() ? E2 : i.defaultLine;
        }).domain = A2.domain, T2.range = function() {
          return b;
        }, T2;
      }
      function v(m) {
        var g = { r: m[0], g: m[1], b: m[2], a: m[3] };
        return a(g).toRgbString();
      }
      t.exports = { hasColorscale: function(m, g, x) {
        var b = g ? s.nestedProperty(m, g).get() || {} : m, y = b[x || "color"], w = false;
        if (s.isArrayOrTypedArray(y)) {
          for (var _4 = 0; _4 < y.length; _4++) if (o(y[_4])) {
            w = true;
            break;
          }
        }
        return s.isPlainObject(b) && (w || b.showscale === true || o(b.cmin) && o(b.cmax) || l(b.colorscale) || s.isPlainObject(b.colorbar));
      }, extractOpts: f, extractScale: h, flipScale: p, makeColorScaleFunc: d, makeColorScaleFuncFromTrace: function(m, g) {
        return d(h(m), g);
      } };
    }, { "../../lib": 503, "../color": 366, "./scales": 381, "@plotly/d3": 58, "fast-isnumeric": 190, tinycolor2: 312 }], 378: [function(e, t, r) {
      "use strict";
      var n = e("./scales"), a = e("./helpers");
      t.exports = { moduleType: "component", name: "colorscale", attributes: e("./attributes"), layoutAttributes: e("./layout_attributes"), supplyLayoutDefaults: e("./layout_defaults"), handleDefaults: e("./defaults"), crossTraceDefaults: e("./cross_trace_defaults"), calc: e("./calc"), scales: n.scales, defaultScale: n.defaultScale, getScale: n.get, isValidScale: n.isValid, hasColorscale: a.hasColorscale, extractOpts: a.extractOpts, extractScale: a.extractScale, flipScale: a.flipScale, makeColorScaleFunc: a.makeColorScaleFunc, makeColorScaleFuncFromTrace: a.makeColorScaleFuncFromTrace };
    }, { "./attributes": 373, "./calc": 374, "./cross_trace_defaults": 375, "./defaults": 376, "./helpers": 377, "./layout_attributes": 379, "./layout_defaults": 380, "./scales": 381 }], 379: [function(e, t, r) {
      "use strict";
      var n = e("../../lib/extend").extendFlat, a = e("./attributes"), o = e("./scales").scales;
      t.exports = { editType: "calc", colorscale: { editType: "calc", sequential: { valType: "colorscale", dflt: o.Reds, editType: "calc" }, sequentialminus: { valType: "colorscale", dflt: o.Blues, editType: "calc" }, diverging: { valType: "colorscale", dflt: o.RdBu, editType: "calc" } }, coloraxis: n({ _isSubplotObj: true, editType: "calc" }, a("", { colorAttr: "corresponding trace color array(s)", noColorAxis: true, showScaleDflt: true })) };
    }, { "../../lib/extend": 493, "./attributes": 373, "./scales": 381 }], 380: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../plot_api/plot_template"), o = e("./layout_attributes"), s = e("./defaults");
      t.exports = function(i, l) {
        function u2(g, x) {
          return n.coerce(i, l, o, g, x);
        }
        u2("colorscale.sequential"), u2("colorscale.sequentialminus"), u2("colorscale.diverging");
        var c, f, h = l._colorAxes;
        function p(g, x) {
          return n.coerce(c, f, o.coloraxis, g, x);
        }
        for (var d in h) {
          var v = h[d];
          if (v[0]) c = i[d] || {}, (f = a.newContainer(l, d, "coloraxis"))._name = d, s(c, f, l, p, { prefix: "", cLetter: "c" });
          else {
            for (var m = 0; m < v[2].length; m++) v[2][m]();
            delete l._colorAxes[d];
          }
        }
      };
    }, { "../../lib": 503, "../../plot_api/plot_template": 543, "./defaults": 376, "./layout_attributes": 379 }], 381: [function(e, t, r) {
      "use strict";
      var n = e("tinycolor2"), a = { Greys: [[0, "rgb(0,0,0)"], [1, "rgb(255,255,255)"]], YlGnBu: [[0, "rgb(8,29,88)"], [0.125, "rgb(37,52,148)"], [0.25, "rgb(34,94,168)"], [0.375, "rgb(29,145,192)"], [0.5, "rgb(65,182,196)"], [0.625, "rgb(127,205,187)"], [0.75, "rgb(199,233,180)"], [0.875, "rgb(237,248,217)"], [1, "rgb(255,255,217)"]], Greens: [[0, "rgb(0,68,27)"], [0.125, "rgb(0,109,44)"], [0.25, "rgb(35,139,69)"], [0.375, "rgb(65,171,93)"], [0.5, "rgb(116,196,118)"], [0.625, "rgb(161,217,155)"], [0.75, "rgb(199,233,192)"], [0.875, "rgb(229,245,224)"], [1, "rgb(247,252,245)"]], YlOrRd: [[0, "rgb(128,0,38)"], [0.125, "rgb(189,0,38)"], [0.25, "rgb(227,26,28)"], [0.375, "rgb(252,78,42)"], [0.5, "rgb(253,141,60)"], [0.625, "rgb(254,178,76)"], [0.75, "rgb(254,217,118)"], [0.875, "rgb(255,237,160)"], [1, "rgb(255,255,204)"]], Bluered: [[0, "rgb(0,0,255)"], [1, "rgb(255,0,0)"]], RdBu: [[0, "rgb(5,10,172)"], [0.35, "rgb(106,137,247)"], [0.5, "rgb(190,190,190)"], [0.6, "rgb(220,170,132)"], [0.7, "rgb(230,145,90)"], [1, "rgb(178,10,28)"]], Reds: [[0, "rgb(220,220,220)"], [0.2, "rgb(245,195,157)"], [0.4, "rgb(245,160,105)"], [1, "rgb(178,10,28)"]], Blues: [[0, "rgb(5,10,172)"], [0.35, "rgb(40,60,190)"], [0.5, "rgb(70,100,245)"], [0.6, "rgb(90,120,245)"], [0.7, "rgb(106,137,247)"], [1, "rgb(220,220,220)"]], Picnic: [[0, "rgb(0,0,255)"], [0.1, "rgb(51,153,255)"], [0.2, "rgb(102,204,255)"], [0.3, "rgb(153,204,255)"], [0.4, "rgb(204,204,255)"], [0.5, "rgb(255,255,255)"], [0.6, "rgb(255,204,255)"], [0.7, "rgb(255,153,255)"], [0.8, "rgb(255,102,204)"], [0.9, "rgb(255,102,102)"], [1, "rgb(255,0,0)"]], Rainbow: [[0, "rgb(150,0,90)"], [0.125, "rgb(0,0,200)"], [0.25, "rgb(0,25,255)"], [0.375, "rgb(0,152,255)"], [0.5, "rgb(44,255,150)"], [0.625, "rgb(151,255,0)"], [0.75, "rgb(255,234,0)"], [0.875, "rgb(255,111,0)"], [1, "rgb(255,0,0)"]], Portland: [[0, "rgb(12,51,131)"], [0.25, "rgb(10,136,186)"], [0.5, "rgb(242,211,56)"], [0.75, "rgb(242,143,56)"], [1, "rgb(217,30,30)"]], Jet: [[0, "rgb(0,0,131)"], [0.125, "rgb(0,60,170)"], [0.375, "rgb(5,255,255)"], [0.625, "rgb(255,255,0)"], [0.875, "rgb(250,0,0)"], [1, "rgb(128,0,0)"]], Hot: [[0, "rgb(0,0,0)"], [0.3, "rgb(230,0,0)"], [0.6, "rgb(255,210,0)"], [1, "rgb(255,255,255)"]], Blackbody: [[0, "rgb(0,0,0)"], [0.2, "rgb(230,0,0)"], [0.4, "rgb(230,210,0)"], [0.7, "rgb(255,255,255)"], [1, "rgb(160,200,255)"]], Earth: [[0, "rgb(0,0,130)"], [0.1, "rgb(0,180,180)"], [0.2, "rgb(40,210,40)"], [0.4, "rgb(230,230,50)"], [0.6, "rgb(120,70,20)"], [1, "rgb(255,255,255)"]], Electric: [[0, "rgb(0,0,0)"], [0.15, "rgb(30,0,100)"], [0.4, "rgb(120,0,100)"], [0.6, "rgb(160,90,0)"], [0.8, "rgb(230,200,0)"], [1, "rgb(255,250,220)"]], Viridis: [[0, "#440154"], [0.06274509803921569, "#48186a"], [0.12549019607843137, "#472d7b"], [0.18823529411764706, "#424086"], [0.25098039215686274, "#3b528b"], [0.3137254901960784, "#33638d"], [0.3764705882352941, "#2c728e"], [0.4392156862745098, "#26828e"], [0.5019607843137255, "#21918c"], [0.5647058823529412, "#1fa088"], [0.6274509803921569, "#28ae80"], [0.6901960784313725, "#3fbc73"], [0.7529411764705882, "#5ec962"], [0.8156862745098039, "#84d44b"], [0.8784313725490196, "#addc30"], [0.9411764705882353, "#d8e219"], [1, "#fde725"]], Cividis: [[0, "rgb(0,32,76)"], [0.058824, "rgb(0,42,102)"], [0.117647, "rgb(0,52,110)"], [0.176471, "rgb(39,63,108)"], [0.235294, "rgb(60,74,107)"], [0.294118, "rgb(76,85,107)"], [0.352941, "rgb(91,95,109)"], [0.411765, "rgb(104,106,112)"], [0.470588, "rgb(117,117,117)"], [0.529412, "rgb(131,129,120)"], [0.588235, "rgb(146,140,120)"], [0.647059, "rgb(161,152,118)"], [0.705882, "rgb(176,165,114)"], [0.764706, "rgb(192,177,109)"], [0.823529, "rgb(209,191,102)"], [0.882353, "rgb(225,204,92)"], [0.941176, "rgb(243,219,79)"], [1, "rgb(255,233,69)"]] }, o = a.RdBu;
      function s(i) {
        var l = 0;
        if (!Array.isArray(i) || i.length < 2 || !i[0] || !i[i.length - 1] || +i[0][0] != 0 || +i[i.length - 1][0] != 1) return false;
        for (var u2 = 0; u2 < i.length; u2++) {
          var c = i[u2];
          if (c.length !== 2 || +c[0] < l || !n(c[1]).isValid()) return false;
          l = +c[0];
        }
        return true;
      }
      t.exports = { scales: a, defaultScale: o, get: function(i, l) {
        if (l || (l = o), !i) return l;
        function u2() {
          try {
            i = a[i] || JSON.parse(i);
          } catch {
            i = l;
          }
        }
        return typeof i == "string" && (u2(), typeof i == "string" && u2()), s(i) ? i : l;
      }, isValid: function(i) {
        return a[i] !== void 0 || s(i);
      } };
    }, { tinycolor2: 312 }], 382: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a, o, s, i) {
        var l = (n - o) / (s - o), u2 = l + a / (s - o), c = (l + u2) / 2;
        return i === "left" || i === "bottom" ? l : i === "center" || i === "middle" ? c : i === "right" || i === "top" ? u2 : l < 2 / 3 - c ? l : u2 > 4 / 3 - c ? u2 : c;
      };
    }, {}], 383: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = [["sw-resize", "s-resize", "se-resize"], ["w-resize", "move", "e-resize"], ["nw-resize", "n-resize", "ne-resize"]];
      t.exports = function(o, s, i, l) {
        return o = i === "left" ? 0 : i === "center" ? 1 : i === "right" ? 2 : n.constrain(Math.floor(3 * o), 0, 2), s = l === "bottom" ? 0 : l === "middle" ? 1 : l === "top" ? 2 : n.constrain(Math.floor(3 * s), 0, 2), a[s][o];
      };
    }, { "../../lib": 503 }], 384: [function(e, t, r) {
      "use strict";
      r.selectMode = function(n) {
        return n === "lasso" || n === "select";
      }, r.drawMode = function(n) {
        return n === "drawclosedpath" || n === "drawopenpath" || n === "drawline" || n === "drawrect" || n === "drawcircle";
      }, r.openMode = function(n) {
        return n === "drawline" || n === "drawopenpath";
      }, r.rectMode = function(n) {
        return n === "select" || n === "drawline" || n === "drawrect" || n === "drawcircle";
      }, r.freeMode = function(n) {
        return n === "lasso" || n === "drawclosedpath" || n === "drawopenpath";
      }, r.selectingOrDrawing = function(n) {
        return r.freeMode(n) || r.rectMode(n);
      };
    }, {}], 385: [function(e, t, r) {
      "use strict";
      var n = e("mouse-event-offset"), a = e("has-hover"), o = e("has-passive-events"), s = e("../../lib").removeElement, i = e("../../plots/cartesian/constants"), l = t.exports = {};
      l.align = e("./align"), l.getCursor = e("./cursor");
      var u2 = e("./unhover");
      function c() {
        var h = document.createElement("div");
        h.className = "dragcover";
        var p = h.style;
        return p.position = "fixed", p.left = 0, p.right = 0, p.top = 0, p.bottom = 0, p.zIndex = 999999999, p.background = "none", document.body.appendChild(h), h;
      }
      function f(h) {
        return n(h.changedTouches ? h.changedTouches[0] : h, document.body);
      }
      l.unhover = u2.wrapped, l.unhoverRaw = u2.raw, l.init = function(h) {
        var p, d, v, m, g, x, b, y, w = h.gd, _4 = 1, k = w._context.doubleClickDelay, T2 = h.element;
        w._mouseDownTime || (w._mouseDownTime = 0), T2.style.pointerEvents = "all", T2.onmousedown = S2, o ? (T2._ontouchstart && T2.removeEventListener("touchstart", T2._ontouchstart), T2._ontouchstart = S2, T2.addEventListener("touchstart", S2, { passive: false })) : T2.ontouchstart = S2;
        var A2 = h.clampFn || function(F13, N2, D2) {
          return Math.abs(F13) < D2 && (F13 = 0), Math.abs(N2) < D2 && (N2 = 0), [F13, N2];
        };
        function S2(F13) {
          w._dragged = false, w._dragging = true;
          var N2 = f(F13);
          p = N2[0], d = N2[1], b = F13.target, x = F13, y = F13.buttons === 2 || F13.ctrlKey, F13.clientX === void 0 && F13.clientY === void 0 && (F13.clientX = p, F13.clientY = d), (v = (/* @__PURE__ */ new Date()).getTime()) - w._mouseDownTime < k ? _4 += 1 : (_4 = 1, w._mouseDownTime = v), h.prepFn && h.prepFn(F13, p, d), a && !y ? (g = c()).style.cursor = window.getComputedStyle(T2).cursor : a || (g = document, m = window.getComputedStyle(document.documentElement).cursor, document.documentElement.style.cursor = window.getComputedStyle(T2).cursor), document.addEventListener("mouseup", E2), document.addEventListener("touchend", E2), h.dragmode !== false && (F13.preventDefault(), document.addEventListener("mousemove", C2), document.addEventListener("touchmove", C2, { passive: false }));
        }
        function C2(F13) {
          F13.preventDefault();
          var N2 = f(F13), D2 = h.minDrag || i.MINDRAG, I2 = A2(N2[0] - p, N2[1] - d, D2), O2 = I2[0], L2 = I2[1];
          (O2 || L2) && (w._dragged = true, l.unhover(w, F13)), w._dragged && h.moveFn && !y && (w._dragdata = { element: T2, dx: O2, dy: L2 }, h.moveFn(O2, L2));
        }
        function E2(F13) {
          if (delete w._dragdata, h.dragmode !== false && (F13.preventDefault(), document.removeEventListener("mousemove", C2), document.removeEventListener("touchmove", C2)), document.removeEventListener("mouseup", E2), document.removeEventListener("touchend", E2), a ? s(g) : m && (g.documentElement.style.cursor = m, m = null), w._dragging) {
            if (w._dragging = false, (/* @__PURE__ */ new Date()).getTime() - w._mouseDownTime > k && (_4 = Math.max(_4 - 1, 1)), w._dragged) h.doneFn && h.doneFn();
            else if (h.clickFn && h.clickFn(_4, x), !y) {
              var N2;
              try {
                N2 = new MouseEvent("click", F13);
              } catch {
                var D2 = f(F13);
                (N2 = document.createEvent("MouseEvents")).initMouseEvent("click", F13.bubbles, F13.cancelable, F13.view, F13.detail, F13.screenX, F13.screenY, D2[0], D2[1], F13.ctrlKey, F13.altKey, F13.shiftKey, F13.metaKey, F13.button, F13.relatedTarget);
              }
              b.dispatchEvent(N2);
            }
            w._dragging = false, w._dragged = false;
          } else w._dragged = false;
        }
      }, l.coverSlip = c;
    }, { "../../lib": 503, "../../plots/cartesian/constants": 561, "./align": 382, "./cursor": 383, "./unhover": 386, "has-hover": 228, "has-passive-events": 229, "mouse-event-offset": 242 }], 386: [function(e, t, r) {
      "use strict";
      var n = e("../../lib/events"), a = e("../../lib/throttle"), o = e("../../lib/dom").getGraphDiv, s = e("../fx/constants"), i = t.exports = {};
      i.wrapped = function(l, u2, c) {
        (l = o(l))._fullLayout && a.clear(l._fullLayout._uid + s.HOVERID), i.raw(l, u2, c);
      }, i.raw = function(l, u2) {
        var c = l._fullLayout, f = l._hoverdata;
        u2 || (u2 = {}), u2.target && !l._dragged && n.triggerHandler(l, "plotly_beforehover", u2) === false || (c._hoverlayer.selectAll("g").remove(), c._hoverlayer.selectAll("line").remove(), c._hoverlayer.selectAll("circle").remove(), l._hoverdata = void 0, u2.target && f && l.emit("plotly_unhover", { event: u2, points: f }));
      };
    }, { "../../lib/dom": 491, "../../lib/events": 492, "../../lib/throttle": 530, "../fx/constants": 400 }], 387: [function(e, t, r) {
      "use strict";
      r.dash = { valType: "string", values: ["solid", "dot", "dash", "longdash", "dashdot", "longdashdot"], dflt: "solid", editType: "style" }, r.pattern = { shape: { valType: "enumerated", values: ["", "/", "\\", "x", "-", "|", "+", "."], dflt: "", arrayOk: true, editType: "style" }, fillmode: { valType: "enumerated", values: ["replace", "overlay"], dflt: "replace", editType: "style" }, bgcolor: { valType: "color", arrayOk: true, editType: "style" }, fgcolor: { valType: "color", arrayOk: true, editType: "style" }, fgopacity: { valType: "number", editType: "style", min: 0, max: 1 }, size: { valType: "number", min: 0, dflt: 8, arrayOk: true, editType: "style" }, solidity: { valType: "number", min: 0, max: 1, dflt: 0.3, arrayOk: true, editType: "style" }, editType: "style" };
    }, {}], 388: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../lib"), o = a.numberFormat, s = e("fast-isnumeric"), i = e("tinycolor2"), l = e("../../registry"), u2 = e("../color"), c = e("../colorscale"), f = a.strTranslate, h = e("../../lib/svg_text_utils"), p = e("../../constants/xmlns_namespaces"), d = e("../../constants/alignment").LINE_SPACING, v = e("../../constants/interactions").DESELECTDIM, m = e("../../traces/scatter/subtypes"), g = e("../../traces/scatter/make_bubble_size_func"), x = e("../../components/fx/helpers").appendArrayPointValue, b = t.exports = {};
      b.font = function(Y2, K2, q, re) {
        a.isPlainObject(K2) && (re = K2.color, q = K2.size, K2 = K2.family), K2 && Y2.style("font-family", K2), q + 1 && Y2.style("font-size", q + "px"), re && Y2.call(u2.fill, re);
      }, b.setPosition = function(Y2, K2, q) {
        Y2.attr("x", K2).attr("y", q);
      }, b.setSize = function(Y2, K2, q) {
        Y2.attr("width", K2).attr("height", q);
      }, b.setRect = function(Y2, K2, q, re, R2) {
        Y2.call(b.setPosition, K2, q).call(b.setSize, re, R2);
      }, b.translatePoint = function(Y2, K2, q, re) {
        var R2 = q.c2p(Y2.x), z = re.c2p(Y2.y);
        return !!(s(R2) && s(z) && K2.node()) && (K2.node().nodeName === "text" ? K2.attr("x", R2).attr("y", z) : K2.attr("transform", f(R2, z)), true);
      }, b.translatePoints = function(Y2, K2, q) {
        Y2.each(function(re) {
          var R2 = n.select(this);
          b.translatePoint(re, R2, K2, q);
        });
      }, b.hideOutsideRangePoint = function(Y2, K2, q, re, R2, z) {
        K2.attr("display", q.isPtWithinRange(Y2, R2) && re.isPtWithinRange(Y2, z) ? null : "none");
      }, b.hideOutsideRangePoints = function(Y2, K2) {
        if (K2._hasClipOnAxisFalse) {
          var q = K2.xaxis, re = K2.yaxis;
          Y2.each(function(R2) {
            var z = R2[0].trace, H2 = z.xcalendar, te = z.ycalendar, j = l.traceIs(z, "bar-like") ? ".bartext" : ".point,.textpoint";
            Y2.selectAll(j).each(function(Q2) {
              b.hideOutsideRangePoint(Q2, n.select(this), q, re, H2, te);
            });
          });
        }
      }, b.crispRound = function(Y2, K2, q) {
        return K2 && s(K2) ? Y2._context.staticPlot ? K2 : K2 < 1 ? 1 : Math.round(K2) : q || 0;
      }, b.singleLineStyle = function(Y2, K2, q, re, R2) {
        K2.style("fill", "none");
        var z = (((Y2 || [])[0] || {}).trace || {}).line || {}, H2 = q || z.width || 0, te = R2 || z.dash || "";
        u2.stroke(K2, re || z.color), b.dashLine(K2, te, H2);
      }, b.lineGroupStyle = function(Y2, K2, q, re) {
        Y2.style("fill", "none").each(function(R2) {
          var z = (((R2 || [])[0] || {}).trace || {}).line || {}, H2 = K2 || z.width || 0, te = re || z.dash || "";
          n.select(this).call(u2.stroke, q || z.color).call(b.dashLine, te, H2);
        });
      }, b.dashLine = function(Y2, K2, q) {
        q = +q || 0, K2 = b.dashStyle(K2, q), Y2.style({ "stroke-dasharray": K2, "stroke-width": q + "px" });
      }, b.dashStyle = function(Y2, K2) {
        K2 = +K2 || 1;
        var q = Math.max(K2, 3);
        return Y2 === "solid" ? Y2 = "" : Y2 === "dot" ? Y2 = q + "px," + q + "px" : Y2 === "dash" ? Y2 = 3 * q + "px," + 3 * q + "px" : Y2 === "longdash" ? Y2 = 5 * q + "px," + 5 * q + "px" : Y2 === "dashdot" ? Y2 = 3 * q + "px," + q + "px," + q + "px," + q + "px" : Y2 === "longdashdot" && (Y2 = 5 * q + "px," + 2 * q + "px," + q + "px," + 2 * q + "px"), Y2;
      }, b.singleFillStyle = function(Y2) {
        var K2 = (((n.select(Y2.node()).data()[0] || [])[0] || {}).trace || {}).fillcolor;
        K2 && Y2.call(u2.fill, K2);
      }, b.fillGroupStyle = function(Y2) {
        Y2.style("stroke-width", 0).each(function(K2) {
          var q = n.select(this);
          K2[0].trace && q.call(u2.fill, K2[0].trace.fillcolor);
        });
      };
      var y = e("./symbol_defs");
      b.symbolNames = [], b.symbolFuncs = [], b.symbolNeedLines = {}, b.symbolNoDot = {}, b.symbolNoFill = {}, b.symbolList = [], Object.keys(y).forEach(function(Y2) {
        var K2 = y[Y2], q = K2.n;
        b.symbolList.push(q, String(q), Y2, q + 100, String(q + 100), Y2 + "-open"), b.symbolNames[q] = Y2, b.symbolFuncs[q] = K2.f, K2.needLine && (b.symbolNeedLines[q] = true), K2.noDot ? b.symbolNoDot[q] = true : b.symbolList.push(q + 200, String(q + 200), Y2 + "-dot", q + 300, String(q + 300), Y2 + "-open-dot"), K2.noFill && (b.symbolNoFill[q] = true);
      });
      var w = b.symbolNames.length;
      function _4(Y2, K2) {
        var q = Y2 % 100;
        return b.symbolFuncs[q](K2) + (Y2 >= 200 ? "M0,0.5L0.5,0L0,-0.5L-0.5,0Z" : "");
      }
      b.symbolNumber = function(Y2) {
        if (s(Y2)) Y2 = +Y2;
        else if (typeof Y2 == "string") {
          var K2 = 0;
          Y2.indexOf("-open") > 0 && (K2 = 100, Y2 = Y2.replace("-open", "")), Y2.indexOf("-dot") > 0 && (K2 += 200, Y2 = Y2.replace("-dot", "")), (Y2 = b.symbolNames.indexOf(Y2)) >= 0 && (Y2 += K2);
        }
        return Y2 % 100 >= w || Y2 >= 400 ? 0 : Math.floor(Math.max(Y2, 0));
      };
      var k = { x1: 1, x2: 0, y1: 0, y2: 0 }, T2 = { x1: 0, x2: 0, y1: 1, y2: 0 }, A2 = o("~f"), S2 = { radial: { node: "radialGradient" }, radialreversed: { node: "radialGradient", reversed: true }, horizontal: { node: "linearGradient", attrs: k }, horizontalreversed: { node: "linearGradient", attrs: k, reversed: true }, vertical: { node: "linearGradient", attrs: T2 }, verticalreversed: { node: "linearGradient", attrs: T2, reversed: true } };
      b.gradient = function(Y2, K2, q, re, R2, z) {
        for (var H2 = R2.length, te = S2[re], j = new Array(H2), Q2 = 0; Q2 < H2; Q2++) te.reversed ? j[H2 - 1 - Q2] = [A2(100 * (1 - R2[Q2][0])), R2[Q2][1]] : j[Q2] = [A2(100 * R2[Q2][0]), R2[Q2][1]];
        var Z2 = K2._fullLayout, ne = "g" + Z2._uid + "-" + q, ae = Z2._defs.select(".gradients").selectAll("#" + ne).data([re + j.join(";")], a.identity);
        ae.exit().remove(), ae.enter().append(te.node).each(function() {
          var ce = n.select(this);
          te.attrs && ce.attr(te.attrs), ce.attr("id", ne);
          var se = ce.selectAll("stop").data(j);
          se.exit().remove(), se.enter().append("stop"), se.each(function(he) {
            var me = i(he[1]);
            n.select(this).attr({ offset: he[0] + "%", "stop-color": u2.tinyRGB(me), "stop-opacity": me.getAlpha() });
          });
        }), Y2.style(z, V2(ne, K2)).style(z + "-opacity", null);
        var ue = function(ce) {
          return "." + ce.attr("class").replace(/\s/g, ".");
        }, le = ue(n.select(Y2.node().parentNode)) + ">" + ue(Y2);
        Z2._gradientUrlQueryParts[le] = 1;
      }, b.pattern = function(Y2, K2, q, re, R2, z, H2, te, j, Q2, Z2, ne) {
        var ae = K2 === "legend";
        te && (j === "overlay" ? (Q2 = te, Z2 = u2.contrast(Q2)) : (Q2 = void 0, Z2 = te));
        var ue, le, ce, se, he, me, we, be, Ae, pe, ve, Ee = q._fullLayout, Se = "p" + Ee._uid + "-" + re, Ce = {};
        switch (R2) {
          case "/":
            ue = z * Math.sqrt(2), le = z * Math.sqrt(2), me = "path", Ce = { d: ce = "M-" + ue / 4 + "," + le / 4 + "l" + ue / 2 + ",-" + le / 2 + "M0," + le + "L" + ue + ",0M" + ue / 4 * 3 + "," + le / 4 * 5 + "l" + ue / 2 + ",-" + le / 2, opacity: ne, stroke: Z2, "stroke-width": (se = H2 * z) + "px" };
            break;
          case "\\":
            ue = z * Math.sqrt(2), le = z * Math.sqrt(2), me = "path", Ce = { d: ce = "M" + ue / 4 * 3 + ",-" + le / 4 + "l" + ue / 2 + "," + le / 2 + "M0,0L" + ue + "," + le + "M-" + ue / 4 + "," + le / 4 * 3 + "l" + ue / 2 + "," + le / 2, opacity: ne, stroke: Z2, "stroke-width": (se = H2 * z) + "px" };
            break;
          case "x":
            ue = z * Math.sqrt(2), le = z * Math.sqrt(2), ce = "M-" + ue / 4 + "," + le / 4 + "l" + ue / 2 + ",-" + le / 2 + "M0," + le + "L" + ue + ",0M" + ue / 4 * 3 + "," + le / 4 * 5 + "l" + ue / 2 + ",-" + le / 2 + "M" + ue / 4 * 3 + ",-" + le / 4 + "l" + ue / 2 + "," + le / 2 + "M0,0L" + ue + "," + le + "M-" + ue / 4 + "," + le / 4 * 3 + "l" + ue / 2 + "," + le / 2, se = z - z * Math.sqrt(1 - H2), me = "path", Ce = { d: ce, opacity: ne, stroke: Z2, "stroke-width": se + "px" };
            break;
          case "|":
            me = "path", me = "path", Ce = { d: ce = "M" + (ue = z) / 2 + ",0L" + ue / 2 + "," + (le = z), opacity: ne, stroke: Z2, "stroke-width": (se = H2 * z) + "px" };
            break;
          case "-":
            me = "path", me = "path", Ce = { d: ce = "M0," + (le = z) / 2 + "L" + (ue = z) + "," + le / 2, opacity: ne, stroke: Z2, "stroke-width": (se = H2 * z) + "px" };
            break;
          case "+":
            me = "path", ce = "M" + (ue = z) / 2 + ",0L" + ue / 2 + "," + (le = z) + "M0," + le / 2 + "L" + ue + "," + le / 2, se = z - z * Math.sqrt(1 - H2), me = "path", Ce = { d: ce, opacity: ne, stroke: Z2, "stroke-width": se + "px" };
            break;
          case ".":
            ue = z, le = z, H2 < Math.PI / 4 ? he = Math.sqrt(H2 * z * z / Math.PI) : (we = H2, be = Math.PI / 4, Ae = 1, pe = z / 2, ve = z / Math.sqrt(2), he = pe + (ve - pe) * (we - be) / (Ae - be)), me = "circle", Ce = { cx: ue / 2, cy: le / 2, r: he, opacity: ne, fill: Z2 };
        }
        var Be = [R2 || "noSh", Q2 || "noBg", Z2 || "noFg", z, H2].join(";"), Ue = Ee._defs.select(".patterns").selectAll("#" + Se).data([Be], a.identity);
        Ue.exit().remove(), Ue.enter().append("pattern").each(function() {
          var ct = n.select(this);
          if (ct.attr({ id: Se, width: ue + "px", height: le + "px", patternUnits: "userSpaceOnUse", patternTransform: ae ? "scale(0.8)" : "" }), Q2) {
            var We = ct.selectAll("rect").data([0]);
            We.exit().remove(), We.enter().append("rect").attr({ width: ue + "px", height: le + "px", fill: Q2 });
          }
          var Ze = ct.selectAll(me).data([0]);
          Ze.exit().remove(), Ze.enter().append(me).attr(Ce);
        }), Y2.style("fill", V2(Se, q)).style("fill-opacity", null), Y2.classed("pattern_filled", true);
        var Ke = "." + n.select(Y2.node().parentNode).attr("class").replace(/\s/g, ".") + ">.pattern_filled";
        Ee._patternUrlQueryParts[Ke] = 1;
      }, b.initGradients = function(Y2) {
        var K2 = Y2._fullLayout;
        a.ensureSingle(K2._defs, "g", "gradients").selectAll("linearGradient,radialGradient").remove(), K2._gradientUrlQueryParts = {};
      }, b.initPatterns = function(Y2) {
        var K2 = Y2._fullLayout;
        a.ensureSingle(K2._defs, "g", "patterns").selectAll("pattern").remove(), K2._patternUrlQueryParts = {};
      }, b.getPatternAttr = function(Y2, K2, q) {
        return Y2 && a.isArrayOrTypedArray(Y2) ? K2 < Y2.length ? Y2[K2] : q : Y2;
      }, b.pointStyle = function(Y2, K2, q) {
        if (Y2.size()) {
          var re = b.makePointStyleFns(K2);
          Y2.each(function(R2) {
            b.singlePointStyle(R2, n.select(this), K2, re, q);
          });
        }
      }, b.singlePointStyle = function(Y2, K2, q, re, R2) {
        var z = q.marker, H2 = z.line;
        if (K2.style("opacity", re.selectedOpacityFn ? re.selectedOpacityFn(Y2) : Y2.mo === void 0 ? z.opacity : Y2.mo), re.ms2mrc) {
          var te;
          te = Y2.ms === "various" || z.size === "various" ? 3 : re.ms2mrc(Y2.ms), Y2.mrc = te, re.selectedSizeFn && (te = Y2.mrc = re.selectedSizeFn(Y2));
          var j = b.symbolNumber(Y2.mx || z.symbol) || 0;
          Y2.om = j % 200 >= 100, K2.attr("d", _4(j, te));
        }
        var Q2, Z2, ne, ae = false;
        if (Y2.so) ne = H2.outlierwidth, Z2 = H2.outliercolor, Q2 = z.outliercolor;
        else {
          var ue = (H2 || {}).width;
          ne = (Y2.mlw + 1 || ue + 1 || (Y2.trace ? (Y2.trace.marker.line || {}).width : 0) + 1) - 1 || 0, Z2 = "mlc" in Y2 ? Y2.mlcc = re.lineScale(Y2.mlc) : a.isArrayOrTypedArray(H2.color) ? u2.defaultLine : H2.color, a.isArrayOrTypedArray(z.color) && (Q2 = u2.defaultLine, ae = true), Q2 = "mc" in Y2 ? Y2.mcc = re.markerScale(Y2.mc) : z.color || "rgba(0,0,0,0)", re.selectedColorFn && (Q2 = re.selectedColorFn(Y2));
        }
        if (Y2.om) K2.call(u2.stroke, Q2).style({ "stroke-width": (ne || 1) + "px", fill: "none" });
        else {
          K2.style("stroke-width", (Y2.isBlank ? 0 : ne) + "px");
          var le = z.gradient, ce = Y2.mgt;
          ce ? ae = true : ce = le && le.type, a.isArrayOrTypedArray(ce) && (ce = ce[0], S2[ce] || (ce = 0));
          var se = z.pattern, he = se && b.getPatternAttr(se.shape, Y2.i, "");
          if (ce && ce !== "none") {
            var me = Y2.mgc;
            me ? ae = true : me = le.color;
            var we = q.uid;
            ae && (we += "-" + Y2.i), b.gradient(K2, R2, we, ce, [[0, me], [1, Q2]], "fill");
          } else if (he) {
            var be = b.getPatternAttr(se.bgcolor, Y2.i, null), Ae = b.getPatternAttr(se.fgcolor, Y2.i, null), pe = se.fgopacity, ve = b.getPatternAttr(se.size, Y2.i, 8), Ee = b.getPatternAttr(se.solidity, Y2.i, 0.3), Se = Y2.mcc || a.isArrayOrTypedArray(se.shape) || a.isArrayOrTypedArray(se.bgcolor) || a.isArrayOrTypedArray(se.size) || a.isArrayOrTypedArray(se.solidity), Ce = q.uid;
            Se && (Ce += "-" + Y2.i), b.pattern(K2, "point", R2, Ce, he, ve, Ee, Y2.mcc, se.fillmode, be, Ae, pe);
          } else u2.fill(K2, Q2);
          ne && u2.stroke(K2, Z2);
        }
      }, b.makePointStyleFns = function(Y2) {
        var K2 = {}, q = Y2.marker;
        return K2.markerScale = b.tryColorscale(q, ""), K2.lineScale = b.tryColorscale(q, "line"), l.traceIs(Y2, "symbols") && (K2.ms2mrc = m.isBubble(Y2) ? g(Y2) : function() {
          return (q.size || 6) / 2;
        }), Y2.selectedpoints && a.extendFlat(K2, b.makeSelectedPointStyleFns(Y2)), K2;
      }, b.makeSelectedPointStyleFns = function(Y2) {
        var K2 = {}, q = Y2.selected || {}, re = Y2.unselected || {}, R2 = Y2.marker || {}, z = q.marker || {}, H2 = re.marker || {}, te = R2.opacity, j = z.opacity, Q2 = H2.opacity, Z2 = j !== void 0, ne = Q2 !== void 0;
        (a.isArrayOrTypedArray(te) || Z2 || ne) && (K2.selectedOpacityFn = function(be) {
          var Ae = be.mo === void 0 ? R2.opacity : be.mo;
          return be.selected ? Z2 ? j : Ae : ne ? Q2 : v * Ae;
        });
        var ae = R2.color, ue = z.color, le = H2.color;
        (ue || le) && (K2.selectedColorFn = function(be) {
          var Ae = be.mcc || ae;
          return be.selected ? ue || Ae : le || Ae;
        });
        var ce = R2.size, se = z.size, he = H2.size, me = se !== void 0, we = he !== void 0;
        return l.traceIs(Y2, "symbols") && (me || we) && (K2.selectedSizeFn = function(be) {
          var Ae = be.mrc || ce / 2;
          return be.selected ? me ? se / 2 : Ae : we ? he / 2 : Ae;
        }), K2;
      }, b.makeSelectedTextStyleFns = function(Y2) {
        var K2 = {}, q = Y2.selected || {}, re = Y2.unselected || {}, R2 = Y2.textfont || {}, z = q.textfont || {}, H2 = re.textfont || {}, te = R2.color, j = z.color, Q2 = H2.color;
        return K2.selectedTextColorFn = function(Z2) {
          var ne = Z2.tc || te;
          return Z2.selected ? j || ne : Q2 || (j ? ne : u2.addOpacity(ne, v));
        }, K2;
      }, b.selectedPointStyle = function(Y2, K2) {
        if (Y2.size() && K2.selectedpoints) {
          var q = b.makeSelectedPointStyleFns(K2), re = K2.marker || {}, R2 = [];
          q.selectedOpacityFn && R2.push(function(z, H2) {
            z.style("opacity", q.selectedOpacityFn(H2));
          }), q.selectedColorFn && R2.push(function(z, H2) {
            u2.fill(z, q.selectedColorFn(H2));
          }), q.selectedSizeFn && R2.push(function(z, H2) {
            var te = H2.mx || re.symbol || 0, j = q.selectedSizeFn(H2);
            z.attr("d", _4(b.symbolNumber(te), j)), H2.mrc2 = j;
          }), R2.length && Y2.each(function(z) {
            for (var H2 = n.select(this), te = 0; te < R2.length; te++) R2[te](H2, z);
          });
        }
      }, b.tryColorscale = function(Y2, K2) {
        var q = K2 ? a.nestedProperty(Y2, K2).get() : Y2;
        if (q) {
          var re = q.color;
          if ((q.colorscale || q._colorAx) && a.isArrayOrTypedArray(re)) return c.makeColorScaleFuncFromTrace(q);
        }
        return a.identity;
      };
      var C2 = { start: 1, end: -1, middle: 0, bottom: 1, top: -1 };
      function E2(Y2, K2, q, re, R2) {
        var z = n.select(Y2.node().parentNode), H2 = K2.indexOf("top") !== -1 ? "top" : K2.indexOf("bottom") !== -1 ? "bottom" : "middle", te = K2.indexOf("left") !== -1 ? "end" : K2.indexOf("right") !== -1 ? "start" : "middle", j = re ? re / 0.8 + 1 : 0, Q2 = (h.lineCount(Y2) - 1) * d + 1, Z2 = C2[te] * j, ne = 0.75 * q + C2[H2] * j + (C2[H2] - 1) * Q2 * q / 2;
        Y2.attr("text-anchor", te), R2 || z.attr("transform", f(Z2, ne));
      }
      function F13(Y2, K2) {
        var q = Y2.ts || K2.textfont.size;
        return s(q) && q > 0 ? q : 0;
      }
      b.textPointStyle = function(Y2, K2, q) {
        if (Y2.size()) {
          var re;
          if (K2.selectedpoints) {
            var R2 = b.makeSelectedTextStyleFns(K2);
            re = R2.selectedTextColorFn;
          }
          var z = K2.texttemplate, H2 = q._fullLayout;
          Y2.each(function(te) {
            var j = n.select(this), Q2 = z ? a.extractOption(te, K2, "txt", "texttemplate") : a.extractOption(te, K2, "tx", "text");
            if (Q2 || Q2 === 0) {
              if (z) {
                var Z2 = K2._module.formatLabels, ne = Z2 ? Z2(te, K2, H2) : {}, ae = {};
                x(ae, K2, te.i);
                var ue = K2._meta || {};
                Q2 = a.texttemplateString(Q2, ne, H2._d3locale, ae, te, ue);
              }
              var le = te.tp || K2.textposition, ce = F13(te, K2), se = re ? re(te) : te.tc || K2.textfont.color;
              j.call(b.font, te.tf || K2.textfont.family, ce, se).text(Q2).call(h.convertToTspans, q).call(E2, le, ce, te.mrc);
            } else j.remove();
          });
        }
      }, b.selectedTextStyle = function(Y2, K2) {
        if (Y2.size() && K2.selectedpoints) {
          var q = b.makeSelectedTextStyleFns(K2);
          Y2.each(function(re) {
            var R2 = n.select(this), z = q.selectedTextColorFn(re), H2 = re.tp || K2.textposition, te = F13(re, K2);
            u2.fill(R2, z);
            var j = l.traceIs(K2, "bar-like");
            E2(R2, H2, te, re.mrc2 || re.mrc, j);
          });
        }
      };
      function N2(Y2, K2, q, re) {
        var R2 = Y2[0] - K2[0], z = Y2[1] - K2[1], H2 = q[0] - K2[0], te = q[1] - K2[1], j = Math.pow(R2 * R2 + z * z, 0.25), Q2 = Math.pow(H2 * H2 + te * te, 0.25), Z2 = (Q2 * Q2 * R2 - j * j * H2) * re, ne = (Q2 * Q2 * z - j * j * te) * re, ae = 3 * Q2 * (j + Q2), ue = 3 * j * (j + Q2);
        return [[n.round(K2[0] + (ae && Z2 / ae), 2), n.round(K2[1] + (ae && ne / ae), 2)], [n.round(K2[0] - (ue && Z2 / ue), 2), n.round(K2[1] - (ue && ne / ue), 2)]];
      }
      b.smoothopen = function(Y2, K2) {
        if (Y2.length < 3) return "M" + Y2.join("L");
        var q, re = "M" + Y2[0], R2 = [];
        for (q = 1; q < Y2.length - 1; q++) R2.push(N2(Y2[q - 1], Y2[q], Y2[q + 1], K2));
        for (re += "Q" + R2[0][0] + " " + Y2[1], q = 2; q < Y2.length - 1; q++) re += "C" + R2[q - 2][1] + " " + R2[q - 1][0] + " " + Y2[q];
        return re += "Q" + R2[Y2.length - 3][1] + " " + Y2[Y2.length - 1];
      }, b.smoothclosed = function(Y2, K2) {
        if (Y2.length < 3) return "M" + Y2.join("L") + "Z";
        var q, re = "M" + Y2[0], R2 = Y2.length - 1, z = [N2(Y2[R2], Y2[0], Y2[1], K2)];
        for (q = 1; q < R2; q++) z.push(N2(Y2[q - 1], Y2[q], Y2[q + 1], K2));
        for (z.push(N2(Y2[R2 - 1], Y2[R2], Y2[0], K2)), q = 1; q <= R2; q++) re += "C" + z[q - 1][1] + " " + z[q][0] + " " + Y2[q];
        return re += "C" + z[R2][1] + " " + z[0][0] + " " + Y2[0] + "Z";
      };
      var D2 = { hv: function(Y2, K2) {
        return "H" + n.round(K2[0], 2) + "V" + n.round(K2[1], 2);
      }, vh: function(Y2, K2) {
        return "V" + n.round(K2[1], 2) + "H" + n.round(K2[0], 2);
      }, hvh: function(Y2, K2) {
        return "H" + n.round((Y2[0] + K2[0]) / 2, 2) + "V" + n.round(K2[1], 2) + "H" + n.round(K2[0], 2);
      }, vhv: function(Y2, K2) {
        return "V" + n.round((Y2[1] + K2[1]) / 2, 2) + "H" + n.round(K2[0], 2) + "V" + n.round(K2[1], 2);
      } }, I2 = function(Y2, K2) {
        return "L" + n.round(K2[0], 2) + "," + n.round(K2[1], 2);
      };
      b.steps = function(Y2) {
        var K2 = D2[Y2] || I2;
        return function(q) {
          for (var re = "M" + n.round(q[0][0], 2) + "," + n.round(q[0][1], 2), R2 = 1; R2 < q.length; R2++) re += K2(q[R2 - 1], q[R2]);
          return re;
        };
      }, b.makeTester = function() {
        var Y2 = a.ensureSingleById(n.select("body"), "svg", "js-plotly-tester", function(q) {
          q.attr(p.svgAttrs).style({ position: "absolute", left: "-10000px", top: "-10000px", width: "9000px", height: "9000px", "z-index": "1" });
        }), K2 = a.ensureSingle(Y2, "path", "js-reference-point", function(q) {
          q.attr("d", "M0,0H1V1H0Z").style({ "stroke-width": 0, fill: "black" });
        });
        b.tester = Y2, b.testref = K2;
      }, b.savedBBoxes = {};
      var O2 = 0;
      function L2(Y2) {
        var K2 = Y2.getAttribute("data-unformatted");
        if (K2 !== null) return K2 + Y2.getAttribute("data-math") + Y2.getAttribute("text-anchor") + Y2.getAttribute("style");
      }
      function V2(Y2, K2) {
        if (!Y2) return null;
        var q = K2._context, re = q._exportedPlot ? "" : q._baseUrl || "";
        return re ? "url('" + re + "#" + Y2 + "')" : "url(#" + Y2 + ")";
      }
      b.bBox = function(Y2, K2, q) {
        var re, R2, z;
        if (q || (q = L2(Y2)), q) {
          if (re = b.savedBBoxes[q]) return a.extendFlat({}, re);
        } else if (Y2.childNodes.length === 1) {
          var H2 = Y2.childNodes[0];
          if (q = L2(H2)) {
            var te = +H2.getAttribute("x") || 0, j = +H2.getAttribute("y") || 0, Q2 = H2.getAttribute("transform");
            if (!Q2) {
              var Z2 = b.bBox(H2, false, q);
              return te && (Z2.left += te, Z2.right += te), j && (Z2.top += j, Z2.bottom += j), Z2;
            }
            if (q += "~" + te + "~" + j + "~" + Q2, re = b.savedBBoxes[q]) return a.extendFlat({}, re);
          }
        }
        K2 ? R2 = Y2 : (z = b.tester.node(), R2 = Y2.cloneNode(true), z.appendChild(R2)), n.select(R2).attr("transform", null).call(h.positionText, 0, 0);
        var ne = R2.getBoundingClientRect(), ae = b.testref.node().getBoundingClientRect();
        K2 || z.removeChild(R2);
        var ue = { height: ne.height, width: ne.width, left: ne.left - ae.left, top: ne.top - ae.top, right: ne.right - ae.left, bottom: ne.bottom - ae.top };
        return O2 >= 1e4 && (b.savedBBoxes = {}, O2 = 0), q && (b.savedBBoxes[q] = ue), O2++, a.extendFlat({}, ue);
      }, b.setClipUrl = function(Y2, K2, q) {
        Y2.attr("clip-path", V2(K2, q));
      }, b.getTranslate = function(Y2) {
        var K2 = (Y2[Y2.attr ? "attr" : "getAttribute"]("transform") || "").replace(/.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/, function(q, re, R2) {
          return [re, R2].join(" ");
        }).split(" ");
        return { x: +K2[0] || 0, y: +K2[1] || 0 };
      }, b.setTranslate = function(Y2, K2, q) {
        var re = Y2.attr ? "attr" : "getAttribute", R2 = Y2.attr ? "attr" : "setAttribute", z = Y2[re]("transform") || "";
        return K2 = K2 || 0, q = q || 0, z = z.replace(/(\btranslate\(.*?\);?)/, "").trim(), z = (z += f(K2, q)).trim(), Y2[R2]("transform", z), z;
      }, b.getScale = function(Y2) {
        var K2 = (Y2[Y2.attr ? "attr" : "getAttribute"]("transform") || "").replace(/.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/, function(q, re, R2) {
          return [re, R2].join(" ");
        }).split(" ");
        return { x: +K2[0] || 1, y: +K2[1] || 1 };
      }, b.setScale = function(Y2, K2, q) {
        var re = Y2.attr ? "attr" : "getAttribute", R2 = Y2.attr ? "attr" : "setAttribute", z = Y2[re]("transform") || "";
        return K2 = K2 || 1, q = q || 1, z = z.replace(/(\bscale\(.*?\);?)/, "").trim(), z = (z += "scale(" + K2 + "," + q + ")").trim(), Y2[R2]("transform", z), z;
      };
      var W2 = /\s*sc.*/;
      b.setPointGroupScale = function(Y2, K2, q) {
        if (K2 = K2 || 1, q = q || 1, Y2) {
          var re = K2 === 1 && q === 1 ? "" : "scale(" + K2 + "," + q + ")";
          Y2.each(function() {
            var R2 = (this.getAttribute("transform") || "").replace(W2, "");
            R2 = (R2 += re).trim(), this.setAttribute("transform", R2);
          });
        }
      };
      var X2 = /translate\([^)]*\)\s*$/;
      b.setTextPointsScale = function(Y2, K2, q) {
        Y2 && Y2.each(function() {
          var re, R2 = n.select(this), z = R2.select("text");
          if (z.node()) {
            var H2 = parseFloat(z.attr("x") || 0), te = parseFloat(z.attr("y") || 0), j = (R2.attr("transform") || "").match(X2);
            re = K2 === 1 && q === 1 ? [] : [f(H2, te), "scale(" + K2 + "," + q + ")", f(-H2, -te)], j && re.push(j), R2.attr("transform", re.join(""));
          }
        });
      };
    }, { "../../components/fx/helpers": 402, "../../constants/alignment": 471, "../../constants/interactions": 478, "../../constants/xmlns_namespaces": 480, "../../lib": 503, "../../lib/svg_text_utils": 529, "../../registry": 638, "../../traces/scatter/make_bubble_size_func": 943, "../../traces/scatter/subtypes": 951, "../color": 366, "../colorscale": 378, "./symbol_defs": 389, "@plotly/d3": 58, "fast-isnumeric": 190, tinycolor2: 312 }], 389: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3");
      t.exports = { circle: { n: 0, f: function(a) {
        var o = n.round(a, 2);
        return "M" + o + ",0A" + o + "," + o + " 0 1,1 0,-" + o + "A" + o + "," + o + " 0 0,1 " + o + ",0Z";
      } }, square: { n: 1, f: function(a) {
        var o = n.round(a, 2);
        return "M" + o + "," + o + "H-" + o + "V-" + o + "H" + o + "Z";
      } }, diamond: { n: 2, f: function(a) {
        var o = n.round(1.3 * a, 2);
        return "M" + o + ",0L0," + o + "L-" + o + ",0L0,-" + o + "Z";
      } }, cross: { n: 3, f: function(a) {
        var o = n.round(0.4 * a, 2), s = n.round(1.2 * a, 2);
        return "M" + s + "," + o + "H" + o + "V" + s + "H-" + o + "V" + o + "H-" + s + "V-" + o + "H-" + o + "V-" + s + "H" + o + "V-" + o + "H" + s + "Z";
      } }, x: { n: 4, f: function(a) {
        var o = n.round(0.8 * a / Math.sqrt(2), 2), s = "l" + o + "," + o, i = "l" + o + ",-" + o, l = "l-" + o + ",-" + o, u2 = "l-" + o + "," + o;
        return "M0," + o + s + i + l + i + l + u2 + l + u2 + s + u2 + s + "Z";
      } }, "triangle-up": { n: 5, f: function(a) {
        var o = n.round(2 * a / Math.sqrt(3), 2);
        return "M-" + o + "," + n.round(a / 2, 2) + "H" + o + "L0,-" + n.round(a, 2) + "Z";
      } }, "triangle-down": { n: 6, f: function(a) {
        var o = n.round(2 * a / Math.sqrt(3), 2);
        return "M-" + o + ",-" + n.round(a / 2, 2) + "H" + o + "L0," + n.round(a, 2) + "Z";
      } }, "triangle-left": { n: 7, f: function(a) {
        var o = n.round(2 * a / Math.sqrt(3), 2);
        return "M" + n.round(a / 2, 2) + ",-" + o + "V" + o + "L-" + n.round(a, 2) + ",0Z";
      } }, "triangle-right": { n: 8, f: function(a) {
        var o = n.round(2 * a / Math.sqrt(3), 2);
        return "M-" + n.round(a / 2, 2) + ",-" + o + "V" + o + "L" + n.round(a, 2) + ",0Z";
      } }, "triangle-ne": { n: 9, f: function(a) {
        var o = n.round(0.6 * a, 2), s = n.round(1.2 * a, 2);
        return "M-" + s + ",-" + o + "H" + o + "V" + s + "Z";
      } }, "triangle-se": { n: 10, f: function(a) {
        var o = n.round(0.6 * a, 2), s = n.round(1.2 * a, 2);
        return "M" + o + ",-" + s + "V" + o + "H-" + s + "Z";
      } }, "triangle-sw": { n: 11, f: function(a) {
        var o = n.round(0.6 * a, 2), s = n.round(1.2 * a, 2);
        return "M" + s + "," + o + "H-" + o + "V-" + s + "Z";
      } }, "triangle-nw": { n: 12, f: function(a) {
        var o = n.round(0.6 * a, 2), s = n.round(1.2 * a, 2);
        return "M-" + o + "," + s + "V-" + o + "H" + s + "Z";
      } }, pentagon: { n: 13, f: function(a) {
        var o = n.round(0.951 * a, 2), s = n.round(0.588 * a, 2), i = n.round(-a, 2), l = n.round(-0.309 * a, 2);
        return "M" + o + "," + l + "L" + s + "," + n.round(0.809 * a, 2) + "H-" + s + "L-" + o + "," + l + "L0," + i + "Z";
      } }, hexagon: { n: 14, f: function(a) {
        var o = n.round(a, 2), s = n.round(a / 2, 2), i = n.round(a * Math.sqrt(3) / 2, 2);
        return "M" + i + ",-" + s + "V" + s + "L0," + o + "L-" + i + "," + s + "V-" + s + "L0,-" + o + "Z";
      } }, hexagon2: { n: 15, f: function(a) {
        var o = n.round(a, 2), s = n.round(a / 2, 2), i = n.round(a * Math.sqrt(3) / 2, 2);
        return "M-" + s + "," + i + "H" + s + "L" + o + ",0L" + s + ",-" + i + "H-" + s + "L-" + o + ",0Z";
      } }, octagon: { n: 16, f: function(a) {
        var o = n.round(0.924 * a, 2), s = n.round(0.383 * a, 2);
        return "M-" + s + ",-" + o + "H" + s + "L" + o + ",-" + s + "V" + s + "L" + s + "," + o + "H-" + s + "L-" + o + "," + s + "V-" + s + "Z";
      } }, star: { n: 17, f: function(a) {
        var o = 1.4 * a, s = n.round(0.225 * o, 2), i = n.round(0.951 * o, 2), l = n.round(0.363 * o, 2), u2 = n.round(0.588 * o, 2), c = n.round(-o, 2), f = n.round(-0.309 * o, 2), h = n.round(0.118 * o, 2), p = n.round(0.809 * o, 2);
        return "M" + s + "," + f + "H" + i + "L" + l + "," + h + "L" + u2 + "," + p + "L0," + n.round(0.382 * o, 2) + "L-" + u2 + "," + p + "L-" + l + "," + h + "L-" + i + "," + f + "H-" + s + "L0," + c + "Z";
      } }, hexagram: { n: 18, f: function(a) {
        var o = n.round(0.66 * a, 2), s = n.round(0.38 * a, 2), i = n.round(0.76 * a, 2);
        return "M-" + i + ",0l-" + s + ",-" + o + "h" + i + "l" + s + ",-" + o + "l" + s + "," + o + "h" + i + "l-" + s + "," + o + "l" + s + "," + o + "h-" + i + "l-" + s + "," + o + "l-" + s + ",-" + o + "h-" + i + "Z";
      } }, "star-triangle-up": { n: 19, f: function(a) {
        var o = n.round(a * Math.sqrt(3) * 0.8, 2), s = n.round(0.8 * a, 2), i = n.round(1.6 * a, 2), l = n.round(4 * a, 2), u2 = "A " + l + "," + l + " 0 0 1 ";
        return "M-" + o + "," + s + u2 + o + "," + s + u2 + "0,-" + i + u2 + "-" + o + "," + s + "Z";
      } }, "star-triangle-down": { n: 20, f: function(a) {
        var o = n.round(a * Math.sqrt(3) * 0.8, 2), s = n.round(0.8 * a, 2), i = n.round(1.6 * a, 2), l = n.round(4 * a, 2), u2 = "A " + l + "," + l + " 0 0 1 ";
        return "M" + o + ",-" + s + u2 + "-" + o + ",-" + s + u2 + "0," + i + u2 + o + ",-" + s + "Z";
      } }, "star-square": { n: 21, f: function(a) {
        var o = n.round(1.1 * a, 2), s = n.round(2 * a, 2), i = "A " + s + "," + s + " 0 0 1 ";
        return "M-" + o + ",-" + o + i + "-" + o + "," + o + i + o + "," + o + i + o + ",-" + o + i + "-" + o + ",-" + o + "Z";
      } }, "star-diamond": { n: 22, f: function(a) {
        var o = n.round(1.4 * a, 2), s = n.round(1.9 * a, 2), i = "A " + s + "," + s + " 0 0 1 ";
        return "M-" + o + ",0" + i + "0," + o + i + o + ",0" + i + "0,-" + o + i + "-" + o + ",0Z";
      } }, "diamond-tall": { n: 23, f: function(a) {
        var o = n.round(0.7 * a, 2), s = n.round(1.4 * a, 2);
        return "M0," + s + "L" + o + ",0L0,-" + s + "L-" + o + ",0Z";
      } }, "diamond-wide": { n: 24, f: function(a) {
        var o = n.round(1.4 * a, 2), s = n.round(0.7 * a, 2);
        return "M0," + s + "L" + o + ",0L0,-" + s + "L-" + o + ",0Z";
      } }, hourglass: { n: 25, f: function(a) {
        var o = n.round(a, 2);
        return "M" + o + "," + o + "H-" + o + "L" + o + ",-" + o + "H-" + o + "Z";
      }, noDot: true }, bowtie: { n: 26, f: function(a) {
        var o = n.round(a, 2);
        return "M" + o + "," + o + "V-" + o + "L-" + o + "," + o + "V-" + o + "Z";
      }, noDot: true }, "circle-cross": { n: 27, f: function(a) {
        var o = n.round(a, 2);
        return "M0," + o + "V-" + o + "M" + o + ",0H-" + o + "M" + o + ",0A" + o + "," + o + " 0 1,1 0,-" + o + "A" + o + "," + o + " 0 0,1 " + o + ",0Z";
      }, needLine: true, noDot: true }, "circle-x": { n: 28, f: function(a) {
        var o = n.round(a, 2), s = n.round(a / Math.sqrt(2), 2);
        return "M" + s + "," + s + "L-" + s + ",-" + s + "M" + s + ",-" + s + "L-" + s + "," + s + "M" + o + ",0A" + o + "," + o + " 0 1,1 0,-" + o + "A" + o + "," + o + " 0 0,1 " + o + ",0Z";
      }, needLine: true, noDot: true }, "square-cross": { n: 29, f: function(a) {
        var o = n.round(a, 2);
        return "M0," + o + "V-" + o + "M" + o + ",0H-" + o + "M" + o + "," + o + "H-" + o + "V-" + o + "H" + o + "Z";
      }, needLine: true, noDot: true }, "square-x": { n: 30, f: function(a) {
        var o = n.round(a, 2);
        return "M" + o + "," + o + "L-" + o + ",-" + o + "M" + o + ",-" + o + "L-" + o + "," + o + "M" + o + "," + o + "H-" + o + "V-" + o + "H" + o + "Z";
      }, needLine: true, noDot: true }, "diamond-cross": { n: 31, f: function(a) {
        var o = n.round(1.3 * a, 2);
        return "M" + o + ",0L0," + o + "L-" + o + ",0L0,-" + o + "ZM0,-" + o + "V" + o + "M-" + o + ",0H" + o;
      }, needLine: true, noDot: true }, "diamond-x": { n: 32, f: function(a) {
        var o = n.round(1.3 * a, 2), s = n.round(0.65 * a, 2);
        return "M" + o + ",0L0," + o + "L-" + o + ",0L0,-" + o + "ZM-" + s + ",-" + s + "L" + s + "," + s + "M-" + s + "," + s + "L" + s + ",-" + s;
      }, needLine: true, noDot: true }, "cross-thin": { n: 33, f: function(a) {
        var o = n.round(1.4 * a, 2);
        return "M0," + o + "V-" + o + "M" + o + ",0H-" + o;
      }, needLine: true, noDot: true, noFill: true }, "x-thin": { n: 34, f: function(a) {
        var o = n.round(a, 2);
        return "M" + o + "," + o + "L-" + o + ",-" + o + "M" + o + ",-" + o + "L-" + o + "," + o;
      }, needLine: true, noDot: true, noFill: true }, asterisk: { n: 35, f: function(a) {
        var o = n.round(1.2 * a, 2), s = n.round(0.85 * a, 2);
        return "M0," + o + "V-" + o + "M" + o + ",0H-" + o + "M" + s + "," + s + "L-" + s + ",-" + s + "M" + s + ",-" + s + "L-" + s + "," + s;
      }, needLine: true, noDot: true, noFill: true }, hash: { n: 36, f: function(a) {
        var o = n.round(a / 2, 2), s = n.round(a, 2);
        return "M" + o + "," + s + "V-" + s + "m-" + s + ",0V" + s + "M" + s + "," + o + "H-" + s + "m0,-" + s + "H" + s;
      }, needLine: true, noFill: true }, "y-up": { n: 37, f: function(a) {
        var o = n.round(1.2 * a, 2), s = n.round(1.6 * a, 2), i = n.round(0.8 * a, 2);
        return "M-" + o + "," + i + "L0,0M" + o + "," + i + "L0,0M0,-" + s + "L0,0";
      }, needLine: true, noDot: true, noFill: true }, "y-down": { n: 38, f: function(a) {
        var o = n.round(1.2 * a, 2), s = n.round(1.6 * a, 2), i = n.round(0.8 * a, 2);
        return "M-" + o + ",-" + i + "L0,0M" + o + ",-" + i + "L0,0M0," + s + "L0,0";
      }, needLine: true, noDot: true, noFill: true }, "y-left": { n: 39, f: function(a) {
        var o = n.round(1.2 * a, 2), s = n.round(1.6 * a, 2), i = n.round(0.8 * a, 2);
        return "M" + i + "," + o + "L0,0M" + i + ",-" + o + "L0,0M-" + s + ",0L0,0";
      }, needLine: true, noDot: true, noFill: true }, "y-right": { n: 40, f: function(a) {
        var o = n.round(1.2 * a, 2), s = n.round(1.6 * a, 2), i = n.round(0.8 * a, 2);
        return "M-" + i + "," + o + "L0,0M-" + i + ",-" + o + "L0,0M" + s + ",0L0,0";
      }, needLine: true, noDot: true, noFill: true }, "line-ew": { n: 41, f: function(a) {
        var o = n.round(1.4 * a, 2);
        return "M" + o + ",0H-" + o;
      }, needLine: true, noDot: true, noFill: true }, "line-ns": { n: 42, f: function(a) {
        var o = n.round(1.4 * a, 2);
        return "M0," + o + "V-" + o;
      }, needLine: true, noDot: true, noFill: true }, "line-ne": { n: 43, f: function(a) {
        var o = n.round(a, 2);
        return "M" + o + ",-" + o + "L-" + o + "," + o;
      }, needLine: true, noDot: true, noFill: true }, "line-nw": { n: 44, f: function(a) {
        var o = n.round(a, 2);
        return "M" + o + "," + o + "L-" + o + ",-" + o;
      }, needLine: true, noDot: true, noFill: true }, "arrow-up": { n: 45, f: function(a) {
        var o = n.round(a, 2);
        return "M0,0L-" + o + "," + n.round(2 * a, 2) + "H" + o + "Z";
      }, noDot: true }, "arrow-down": { n: 46, f: function(a) {
        var o = n.round(a, 2);
        return "M0,0L-" + o + ",-" + n.round(2 * a, 2) + "H" + o + "Z";
      }, noDot: true }, "arrow-left": { n: 47, f: function(a) {
        var o = n.round(2 * a, 2), s = n.round(a, 2);
        return "M0,0L" + o + ",-" + s + "V" + s + "Z";
      }, noDot: true }, "arrow-right": { n: 48, f: function(a) {
        var o = n.round(2 * a, 2), s = n.round(a, 2);
        return "M0,0L-" + o + ",-" + s + "V" + s + "Z";
      }, noDot: true }, "arrow-bar-up": { n: 49, f: function(a) {
        var o = n.round(a, 2);
        return "M-" + o + ",0H" + o + "M0,0L-" + o + "," + n.round(2 * a, 2) + "H" + o + "Z";
      }, needLine: true, noDot: true }, "arrow-bar-down": { n: 50, f: function(a) {
        var o = n.round(a, 2);
        return "M-" + o + ",0H" + o + "M0,0L-" + o + ",-" + n.round(2 * a, 2) + "H" + o + "Z";
      }, needLine: true, noDot: true }, "arrow-bar-left": { n: 51, f: function(a) {
        var o = n.round(2 * a, 2), s = n.round(a, 2);
        return "M0,-" + s + "V" + s + "M0,0L" + o + ",-" + s + "V" + s + "Z";
      }, needLine: true, noDot: true }, "arrow-bar-right": { n: 52, f: function(a) {
        var o = n.round(2 * a, 2), s = n.round(a, 2);
        return "M0,-" + s + "V" + s + "M0,0L-" + o + ",-" + s + "V" + s + "Z";
      }, needLine: true, noDot: true } };
    }, { "@plotly/d3": 58 }], 390: [function(e, t, r) {
      "use strict";
      t.exports = { visible: { valType: "boolean", editType: "calc" }, type: { valType: "enumerated", values: ["percent", "constant", "sqrt", "data"], editType: "calc" }, symmetric: { valType: "boolean", editType: "calc" }, array: { valType: "data_array", editType: "calc" }, arrayminus: { valType: "data_array", editType: "calc" }, value: { valType: "number", min: 0, dflt: 10, editType: "calc" }, valueminus: { valType: "number", min: 0, dflt: 10, editType: "calc" }, traceref: { valType: "integer", min: 0, dflt: 0, editType: "style" }, tracerefminus: { valType: "integer", min: 0, dflt: 0, editType: "style" }, copy_ystyle: { valType: "boolean", editType: "plot" }, copy_zstyle: { valType: "boolean", editType: "style" }, color: { valType: "color", editType: "style" }, thickness: { valType: "number", min: 0, dflt: 2, editType: "style" }, width: { valType: "number", min: 0, editType: "plot" }, editType: "calc", _deprecated: { opacity: { valType: "number", editType: "style" } } };
    }, {}], 391: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("../../registry"), o = e("../../plots/cartesian/axes"), s = e("../../lib"), i = e("./compute_error");
      function l(u2, c, f, h) {
        var p = c["error_" + h] || {}, d = [];
        if (p.visible && ["linear", "log"].indexOf(f.type) !== -1) {
          for (var v = i(p), m = 0; m < u2.length; m++) {
            var g = u2[m], x = g.i;
            if (x === void 0) x = m;
            else if (x === null) continue;
            var b = g[h];
            if (n(f.c2l(b))) {
              var y = v(b, x);
              if (n(y[0]) && n(y[1])) {
                var w = g[h + "s"] = b - y[0], _4 = g[h + "h"] = b + y[1];
                d.push(w, _4);
              }
            }
          }
          var k = f._id, T2 = c._extremes[k], A2 = o.findExtremes(f, d, s.extendFlat({ tozero: T2.opts.tozero }, { padded: true }));
          T2.min = T2.min.concat(A2.min), T2.max = T2.max.concat(A2.max);
        }
      }
      t.exports = function(u2) {
        for (var c = u2.calcdata, f = 0; f < c.length; f++) {
          var h = c[f], p = h[0].trace;
          if (p.visible === true && a.traceIs(p, "errorBarsOK")) {
            var d = o.getFromId(u2, p.xaxis), v = o.getFromId(u2, p.yaxis);
            l(h, p, d, "x"), l(h, p, v, "y");
          }
        }
      };
    }, { "../../lib": 503, "../../plots/cartesian/axes": 554, "../../registry": 638, "./compute_error": 392, "fast-isnumeric": 190 }], 392: [function(e, t, r) {
      "use strict";
      function n(a, o) {
        return a === "percent" ? function(s) {
          return Math.abs(s * o / 100);
        } : a === "constant" ? function() {
          return Math.abs(o);
        } : a === "sqrt" ? function(s) {
          return Math.sqrt(Math.abs(s));
        } : void 0;
      }
      t.exports = function(a) {
        var o = a.type, s = a.symmetric;
        if (o === "data") {
          var i = a.array || [];
          if (s) return function(f, h) {
            var p = +i[h];
            return [p, p];
          };
          var l = a.arrayminus || [];
          return function(f, h) {
            var p = +i[h], d = +l[h];
            return isNaN(p) && isNaN(d) ? [NaN, NaN] : [d || 0, p || 0];
          };
        }
        var u2 = n(o, a.value), c = n(o, a.valueminus);
        return s || a.valueminus === void 0 ? function(f) {
          var h = u2(f);
          return [h, h];
        } : function(f) {
          return [c(f), u2(f)];
        };
      };
    }, {}], 393: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("../../registry"), o = e("../../lib"), s = e("../../plot_api/plot_template"), i = e("./attributes");
      t.exports = function(l, u2, c, f) {
        var h = "error_" + f.axis, p = s.newContainer(u2, h), d = l[h] || {};
        function v(b, y) {
          return o.coerce(d, p, i, b, y);
        }
        if (v("visible", d.array !== void 0 || d.value !== void 0 || d.type === "sqrt") !== false) {
          var m = v("type", "array" in d ? "data" : "percent"), g = true;
          m !== "sqrt" && (g = v("symmetric", !((m === "data" ? "arrayminus" : "valueminus") in d))), m === "data" ? (v("array"), v("traceref"), g || (v("arrayminus"), v("tracerefminus"))) : m !== "percent" && m !== "constant" || (v("value"), g || v("valueminus"));
          var x = "copy_" + f.inherit + "style";
          f.inherit && (u2["error_" + f.inherit] || {}).visible && v(x, !(d.color || n(d.thickness) || n(d.width))), f.inherit && p[x] || (v("color", c), v("thickness"), v("width", a.traceIs(u2, "gl3d") ? 0 : 4));
        }
      };
    }, { "../../lib": 503, "../../plot_api/plot_template": 543, "../../registry": 638, "./attributes": 390, "fast-isnumeric": 190 }], 394: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../plot_api/edit_types").overrideAll, o = e("./attributes"), s = { error_x: n.extendFlat({}, o), error_y: n.extendFlat({}, o) };
      delete s.error_x.copy_zstyle, delete s.error_y.copy_zstyle, delete s.error_y.copy_ystyle;
      var i = { error_x: n.extendFlat({}, o), error_y: n.extendFlat({}, o), error_z: n.extendFlat({}, o) };
      delete i.error_x.copy_ystyle, delete i.error_y.copy_ystyle, delete i.error_z.copy_ystyle, delete i.error_z.copy_zstyle, t.exports = { moduleType: "component", name: "errorbars", schema: { traces: { scatter: s, bar: s, histogram: s, scatter3d: a(i, "calc", "nested"), scattergl: a(s, "calc", "nested") } }, supplyDefaults: e("./defaults"), calc: e("./calc"), makeComputeError: e("./compute_error"), plot: e("./plot"), style: e("./style"), hoverInfo: function(l, u2, c) {
        (u2.error_y || {}).visible && (c.yerr = l.yh - l.y, u2.error_y.symmetric || (c.yerrneg = l.y - l.ys)), (u2.error_x || {}).visible && (c.xerr = l.xh - l.x, u2.error_x.symmetric || (c.xerrneg = l.x - l.xs));
      } };
    }, { "../../lib": 503, "../../plot_api/edit_types": 536, "./attributes": 390, "./calc": 391, "./compute_error": 392, "./defaults": 393, "./plot": 395, "./style": 396 }], 395: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("fast-isnumeric"), o = e("../drawing"), s = e("../../traces/scatter/subtypes");
      t.exports = function(i, l, u2, c) {
        var f = u2.xaxis, h = u2.yaxis, p = c && c.duration > 0;
        l.each(function(d) {
          var v, m = d[0].trace, g = m.error_x || {}, x = m.error_y || {};
          m.ids && (v = function(_4) {
            return _4.id;
          });
          var b = s.hasMarkers(m) && m.marker.maxdisplayed > 0;
          x.visible || g.visible || (d = []);
          var y = n.select(this).selectAll("g.errorbar").data(d, v);
          if (y.exit().remove(), d.length) {
            g.visible || y.selectAll("path.xerror").remove(), x.visible || y.selectAll("path.yerror").remove(), y.style("opacity", 1);
            var w = y.enter().append("g").classed("errorbar", true);
            p && w.style("opacity", 0).transition().duration(c.duration).style("opacity", 1), o.setClipUrl(y, u2.layerClipId, i), y.each(function(_4) {
              var k = n.select(this), T2 = function(N2, D2, I2) {
                var O2 = { x: D2.c2p(N2.x), y: I2.c2p(N2.y) };
                return N2.yh !== void 0 && (O2.yh = I2.c2p(N2.yh), O2.ys = I2.c2p(N2.ys), a(O2.ys) || (O2.noYS = true, O2.ys = I2.c2p(N2.ys, true))), N2.xh !== void 0 && (O2.xh = D2.c2p(N2.xh), O2.xs = D2.c2p(N2.xs), a(O2.xs) || (O2.noXS = true, O2.xs = D2.c2p(N2.xs, true))), O2;
              }(_4, f, h);
              if (!b || _4.vis) {
                var A2, S2 = k.select("path.yerror");
                if (x.visible && a(T2.x) && a(T2.yh) && a(T2.ys)) {
                  var C2 = x.width;
                  A2 = "M" + (T2.x - C2) + "," + T2.yh + "h" + 2 * C2 + "m-" + C2 + ",0V" + T2.ys, T2.noYS || (A2 += "m-" + C2 + ",0h" + 2 * C2), S2.size() ? p && (S2 = S2.transition().duration(c.duration).ease(c.easing)) : S2 = k.append("path").style("vector-effect", "non-scaling-stroke").classed("yerror", true), S2.attr("d", A2);
                } else S2.remove();
                var E2 = k.select("path.xerror");
                if (g.visible && a(T2.y) && a(T2.xh) && a(T2.xs)) {
                  var F13 = (g.copy_ystyle ? x : g).width;
                  A2 = "M" + T2.xh + "," + (T2.y - F13) + "v" + 2 * F13 + "m0,-" + F13 + "H" + T2.xs, T2.noXS || (A2 += "m0,-" + F13 + "v" + 2 * F13), E2.size() ? p && (E2 = E2.transition().duration(c.duration).ease(c.easing)) : E2 = k.append("path").style("vector-effect", "non-scaling-stroke").classed("xerror", true), E2.attr("d", A2);
                } else E2.remove();
              }
            });
          }
        });
      };
    }, { "../../traces/scatter/subtypes": 951, "../drawing": 388, "@plotly/d3": 58, "fast-isnumeric": 190 }], 396: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../color");
      t.exports = function(o) {
        o.each(function(s) {
          var i = s[0].trace, l = i.error_y || {}, u2 = i.error_x || {}, c = n.select(this);
          c.selectAll("path.yerror").style("stroke-width", l.thickness + "px").call(a.stroke, l.color), u2.copy_ystyle && (u2 = l), c.selectAll("path.xerror").style("stroke-width", u2.thickness + "px").call(a.stroke, u2.color);
        });
      };
    }, { "../color": 366, "@plotly/d3": 58 }], 397: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/font_attributes"), a = e("./layout_attributes").hoverlabel, o = e("../../lib/extend").extendFlat;
      t.exports = { hoverlabel: { bgcolor: o({}, a.bgcolor, { arrayOk: true }), bordercolor: o({}, a.bordercolor, { arrayOk: true }), font: n({ arrayOk: true, editType: "none" }), align: o({}, a.align, { arrayOk: true }), namelength: o({}, a.namelength, { arrayOk: true }), editType: "none" } };
    }, { "../../lib/extend": 493, "../../plots/font_attributes": 585, "./layout_attributes": 407 }], 398: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../registry");
      function o(s, i, l, u2) {
        u2 = u2 || n.identity, Array.isArray(s) && (i[0][l] = u2(s));
      }
      t.exports = function(s) {
        var i = s.calcdata, l = s._fullLayout;
        function u2(d) {
          return function(v) {
            return n.coerceHoverinfo({ hoverinfo: v }, { _module: d._module }, l);
          };
        }
        for (var c = 0; c < i.length; c++) {
          var f = i[c], h = f[0].trace;
          if (!a.traceIs(h, "pie-like")) {
            var p = a.traceIs(h, "2dMap") ? o : n.fillArray;
            p(h.hoverinfo, f, "hi", u2(h)), h.hovertemplate && p(h.hovertemplate, f, "ht"), h.hoverlabel && (p(h.hoverlabel.bgcolor, f, "hbg"), p(h.hoverlabel.bordercolor, f, "hbc"), p(h.hoverlabel.font.size, f, "hts"), p(h.hoverlabel.font.color, f, "htc"), p(h.hoverlabel.font.family, f, "htf"), p(h.hoverlabel.namelength, f, "hnl"), p(h.hoverlabel.align, f, "hta"));
          }
        }
      };
    }, { "../../lib": 503, "../../registry": 638 }], 399: [function(e, t, r) {
      "use strict";
      var n = e("../../registry"), a = e("./hover").hover;
      t.exports = function(o, s, i) {
        var l = n.getComponentMethod("annotations", "onClick")(o, o._hoverdata);
        function u2() {
          o.emit("plotly_click", { points: o._hoverdata, event: s });
        }
        i !== void 0 && a(o, s, i, true), o._hoverdata && s && s.target && (l && l.then ? l.then(u2) : u2(), s.stopImmediatePropagation && s.stopImmediatePropagation());
      };
    }, { "../../registry": 638, "./hover": 403 }], 400: [function(e, t, r) {
      "use strict";
      t.exports = { YANGLE: 60, HOVERARROWSIZE: 6, HOVERTEXTPAD: 3, HOVERFONTSIZE: 13, HOVERFONT: "Arial, sans-serif", HOVERMINTIME: 50, HOVERID: "-hover" };
    }, {}], 401: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("./attributes"), o = e("./hoverlabel_defaults");
      t.exports = function(s, i, l, u2) {
        var c = n.extendFlat({}, u2.hoverlabel);
        i.hovertemplate && (c.namelength = -1), o(s, i, function(f, h) {
          return n.coerce(s, i, a, f, h);
        }, c);
      };
    }, { "../../lib": 503, "./attributes": 397, "./hoverlabel_defaults": 404 }], 402: [function(e, t, r) {
      "use strict";
      var n = e("../../lib");
      r.getSubplot = function(u2) {
        return u2.subplot || u2.xaxis + u2.yaxis || u2.geo;
      }, r.isTraceInSubplots = function(u2, c) {
        if (u2.type === "splom") {
          for (var f = u2.xaxes || [], h = u2.yaxes || [], p = 0; p < f.length; p++) for (var d = 0; d < h.length; d++) if (c.indexOf(f[p] + h[d]) !== -1) return true;
          return false;
        }
        return c.indexOf(r.getSubplot(u2)) !== -1;
      }, r.flat = function(u2, c) {
        for (var f = new Array(u2.length), h = 0; h < u2.length; h++) f[h] = c;
        return f;
      }, r.p2c = function(u2, c) {
        for (var f = new Array(u2.length), h = 0; h < u2.length; h++) f[h] = u2[h].p2c(c);
        return f;
      }, r.getDistanceFunction = function(u2, c, f, h) {
        return u2 === "closest" ? h || r.quadrature(c, f) : u2.charAt(0) === "x" ? c : f;
      }, r.getClosest = function(u2, c, f) {
        if (f.index !== false) f.index >= 0 && f.index < u2.length ? f.distance = 0 : f.index = false;
        else for (var h = 0; h < u2.length; h++) {
          var p = c(u2[h]);
          p <= f.distance && (f.index = h, f.distance = p);
        }
        return f;
      }, r.inbox = function(u2, c, f) {
        return u2 * c < 0 || u2 === 0 ? f : 1 / 0;
      }, r.quadrature = function(u2, c) {
        return function(f) {
          var h = u2(f), p = c(f);
          return Math.sqrt(h * h + p * p);
        };
      }, r.makeEventData = function(u2, c, f) {
        var h = "index" in u2 ? u2.index : u2.pointNumber, p = { data: c._input, fullData: c, curveNumber: c.index, pointNumber: h };
        if (c._indexToPoints) {
          var d = c._indexToPoints[h];
          d.length === 1 ? p.pointIndex = d[0] : p.pointIndices = d;
        } else p.pointIndex = h;
        return c._module.eventData ? p = c._module.eventData(p, u2, c, f, h) : ("xVal" in u2 ? p.x = u2.xVal : "x" in u2 && (p.x = u2.x), "yVal" in u2 ? p.y = u2.yVal : "y" in u2 && (p.y = u2.y), u2.xa && (p.xaxis = u2.xa), u2.ya && (p.yaxis = u2.ya), u2.zLabelVal !== void 0 && (p.z = u2.zLabelVal)), r.appendArrayPointValue(p, c, h), p;
      }, r.appendArrayPointValue = function(u2, c, f) {
        var h = c._arrayAttrs;
        if (h) for (var p = 0; p < h.length; p++) {
          var d = h[p], v = o(d);
          if (u2[v] === void 0) {
            var m = s(n.nestedProperty(c, d).get(), f);
            m !== void 0 && (u2[v] = m);
          }
        }
      }, r.appendArrayMultiPointValues = function(u2, c, f) {
        var h = c._arrayAttrs;
        if (h) for (var p = 0; p < h.length; p++) {
          var d = h[p], v = o(d);
          if (u2[v] === void 0) {
            for (var m = n.nestedProperty(c, d).get(), g = new Array(f.length), x = 0; x < f.length; x++) g[x] = s(m, f[x]);
            u2[v] = g;
          }
        }
      };
      var a = { ids: "id", locations: "location", labels: "label", values: "value", "marker.colors": "color", parents: "parent" };
      function o(u2) {
        return a[u2] || u2;
      }
      function s(u2, c) {
        return Array.isArray(c) ? Array.isArray(u2) && Array.isArray(u2[c[0]]) ? u2[c[0]][c[1]] : void 0 : u2[c];
      }
      var i = { x: true, y: true }, l = { "x unified": true, "y unified": true };
      r.isUnifiedHover = function(u2) {
        return typeof u2 == "string" && !!l[u2];
      }, r.isXYhover = function(u2) {
        return typeof u2 == "string" && !!i[u2];
      };
    }, { "../../lib": 503 }], 403: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("fast-isnumeric"), o = e("tinycolor2"), s = e("../../lib"), i = s.strTranslate, l = s.strRotate, u2 = e("../../lib/events"), c = e("../../lib/svg_text_utils"), f = e("../../lib/override_cursor"), h = e("../drawing"), p = e("../color"), d = e("../dragelement"), v = e("../../plots/cartesian/axes"), m = e("../../registry"), g = e("./helpers"), x = e("./constants"), b = e("../legend/defaults"), y = e("../legend/draw"), w = x.YANGLE, _4 = Math.PI * w / 180, k = 1 / Math.sin(_4), T2 = Math.cos(_4), A2 = Math.sin(_4), S2 = x.HOVERARROWSIZE, C2 = x.HOVERTEXTPAD, E2 = { box: true, ohlc: true, violin: true, candlestick: true }, F13 = { scatter: true, scattergl: true, splom: true };
      function N2(z) {
        return [z.trace.index, z.index, z.x0, z.y0, z.name, z.attr, z.xa ? z.xa._id : "", z.ya ? z.ya._id : ""].join(",");
      }
      r.hover = function(z, H2, te, j) {
        z = s.getGraphDiv(z);
        var Q2 = H2.target;
        s.throttle(z._fullLayout._uid + x.HOVERID, x.HOVERMINTIME, function() {
          (function(Z2, ne, ae, ue, le) {
            ae || (ae = "xy");
            var ce = Array.isArray(ae) ? ae : [ae], se = Z2._fullLayout, he = se._plots || [], me = he[ae], we = se._has("cartesian");
            if (me) {
              var be = me.overlays.map(function(tn) {
                return tn.id;
              });
              ce = ce.concat(be);
            }
            for (var Ae = ce.length, pe = new Array(Ae), ve = new Array(Ae), Ee = false, Se = 0; Se < Ae; Se++) {
              var Ce = ce[Se];
              if (he[Ce]) Ee = true, pe[Se] = he[Ce].xaxis, ve[Se] = he[Ce].yaxis;
              else {
                if (!se[Ce] || !se[Ce]._subplot) return void s.warn("Unrecognized subplot: " + Ce);
                var Be = se[Ce]._subplot;
                pe[Se] = Be.xaxis, ve[Se] = Be.yaxis;
              }
            }
            var Ue = ne.hovermode || se.hovermode;
            if (Ue && !Ee && (Ue = "closest"), ["x", "y", "closest", "x unified", "y unified"].indexOf(Ue) === -1 || !Z2.calcdata || Z2.querySelector(".zoombox") || Z2._dragging) return d.unhoverRaw(Z2, ne);
            var Ke = se.hoverdistance;
            Ke === -1 && (Ke = 1 / 0);
            var ct = se.spikedistance;
            ct === -1 && (ct = 1 / 0);
            var We, Ze, it, ot, mt, wt, Et, zt, Nt, yt, pt, Ot, Jt, tr = [], Ye = [], at = { hLinePoint: null, vLinePoint: null }, Ge = false;
            if (Array.isArray(ne)) for (Ue = "array", it = 0; it < ne.length; it++) (mt = Z2.calcdata[ne[it].curveNumber || 0]) && (wt = mt[0].trace, mt[0].trace.hoverinfo !== "skip" && (Ye.push(mt), wt.orientation === "h" && (Ge = true)));
            else {
              for (ot = 0; ot < Z2.calcdata.length; ot++) mt = Z2.calcdata[ot], (wt = mt[0].trace).hoverinfo !== "skip" && g.isTraceInSubplots(wt, ce) && (Ye.push(mt), wt.orientation === "h" && (Ge = true));
              var st, Ie;
              if (!le) st = "xpx" in ne ? ne.xpx : pe[0]._length / 2, Ie = "ypx" in ne ? ne.ypx : ve[0]._length / 2;
              else {
                if (u2.triggerHandler(Z2, "plotly_beforehover", ne) === false) return;
                var Pe = le.getBoundingClientRect();
                st = ne.clientX - Pe.left, Ie = ne.clientY - Pe.top, se._calcInverseTransform(Z2);
                var $e = s.apply3DTransform(se._invTransform)(st, Ie);
                if (st = $e[0], Ie = $e[1], st < 0 || st > pe[0]._length || Ie < 0 || Ie > ve[0]._length) return d.unhoverRaw(Z2, ne);
              }
              if (ne.pointerX = st + pe[0]._offset, ne.pointerY = Ie + ve[0]._offset, We = "xval" in ne ? g.flat(ce, ne.xval) : g.p2c(pe, st), Ze = "yval" in ne ? g.flat(ce, ne.yval) : g.p2c(ve, Ie), !a(We[0]) || !a(Ze[0])) return s.warn("Fx.hover failed", ne, Z2), d.unhoverRaw(Z2, ne);
            }
            var Ve = 1 / 0;
            function ut(tn, Zn) {
              for (ot = 0; ot < Ye.length; ot++) if ((mt = Ye[ot]) && mt[0] && mt[0].trace && (wt = mt[0].trace).visible === true && wt._length !== 0 && ["carpet", "contourcarpet"].indexOf(wt._module.name) === -1) {
                if (wt.type === "splom" ? Et = ce[zt = 0] : (Et = g.getSubplot(wt), zt = ce.indexOf(Et)), Nt = Ue, g.isUnifiedHover(Nt) && (Nt = Nt.charAt(0)), Ot = { cd: mt, trace: wt, xa: pe[zt], ya: ve[zt], maxHoverDistance: Ke, maxSpikeDistance: ct, index: false, distance: Math.min(Ve, Ke), spikeDistance: 1 / 0, xSpike: void 0, ySpike: void 0, color: p.defaultLine, name: wt.name, x0: void 0, x1: void 0, y0: void 0, y1: void 0, xLabelVal: void 0, yLabelVal: void 0, zLabelVal: void 0, text: void 0 }, se[Et] && (Ot.subplot = se[Et]._subplot), se._splomScenes && se._splomScenes[wt.uid] && (Ot.scene = se._splomScenes[wt.uid]), Jt = tr.length, Nt === "array") {
                  var Ln = ne[ot];
                  "pointNumber" in Ln ? (Ot.index = Ln.pointNumber, Nt = "closest") : (Nt = "", "xval" in Ln && (yt = Ln.xval, Nt = "x"), "yval" in Ln && (pt = Ln.yval, Nt = Nt ? "closest" : "y"));
                } else tn !== void 0 && Zn !== void 0 ? (yt = tn, pt = Zn) : (yt = We[zt], pt = Ze[zt]);
                if (Ke !== 0) if (wt._module && wt._module.hoverPoints) {
                  var gn = wt._module.hoverPoints(Ot, yt, pt, Nt, { finiteRange: true, hoverLayer: se._hoverlayer });
                  if (gn) for (var na, sr = 0; sr < gn.length; sr++) na = gn[sr], a(na.x0) && a(na.y0) && tr.push(V2(na, Ue));
                } else s.log("Unrecognized trace type in hover:", wt);
                if (Ue === "closest" && tr.length > Jt && (tr.splice(0, Jt), Ve = tr[0].distance), we && ct !== 0 && tr.length === 0) {
                  Ot.distance = ct, Ot.index = false;
                  var Ut = wt._module.hoverPoints(Ot, yt, pt, "closest", { hoverLayer: se._hoverlayer });
                  if (Ut && (Ut = Ut.filter(function(Ir) {
                    return Ir.spikeDistance <= ct;
                  })), Ut && Ut.length) {
                    var Zt, xr = Ut.filter(function(Ir) {
                      return Ir.xa.showspikes && Ir.xa.spikesnap !== "hovered data";
                    });
                    if (xr.length) {
                      var Fr = xr[0];
                      a(Fr.x0) && a(Fr.y0) && (Zt = qe(Fr), (!at.vLinePoint || at.vLinePoint.spikeDistance > Zt.spikeDistance) && (at.vLinePoint = Zt));
                    }
                    var pn = Ut.filter(function(Ir) {
                      return Ir.ya.showspikes && Ir.ya.spikesnap !== "hovered data";
                    });
                    if (pn.length) {
                      var un = pn[0];
                      a(un.x0) && a(un.y0) && (Zt = qe(un), (!at.hLinePoint || at.hLinePoint.spikeDistance > Zt.spikeDistance) && (at.hLinePoint = Zt));
                    }
                  }
                }
              }
            }
            function Re(tn, Zn, Ln) {
              for (var gn, na = null, sr = 1 / 0, Ut = 0; Ut < tn.length; Ut++) gn = tn[Ut].spikeDistance, Ln && Ut === 0 && (gn = -1 / 0), gn <= sr && gn <= Zn && (na = tn[Ut], sr = gn);
              return na;
            }
            function qe(tn) {
              return tn ? { xa: tn.xa, ya: tn.ya, x: tn.xSpike !== void 0 ? tn.xSpike : (tn.x0 + tn.x1) / 2, y: tn.ySpike !== void 0 ? tn.ySpike : (tn.y0 + tn.y1) / 2, distance: tn.distance, spikeDistance: tn.spikeDistance, curveNumber: tn.trace.index, color: tn.color, pointNumber: tn.index } : null;
            }
            ut();
            var je = { fullLayout: se, container: se._hoverlayer, event: ne }, rt = Z2._spikepoints, He = { vLinePoint: at.vLinePoint, hLinePoint: at.hLinePoint };
            Z2._spikepoints = He;
            var xe = function() {
              tr.sort(function(tn, Zn) {
                return tn.distance - Zn.distance;
              }), tr = function(tn, Zn) {
                for (var Ln = Zn.charAt(0), gn = [], na = [], sr = [], Ut = 0; Ut < tn.length; Ut++) {
                  var Zt = tn[Ut];
                  m.traceIs(Zt.trace, "bar-like") || m.traceIs(Zt.trace, "box-violin") ? sr.push(Zt) : Zt.trace[Ln + "period"] ? na.push(Zt) : gn.push(Zt);
                }
                return gn.concat(na).concat(sr);
              }(tr, Ue);
            };
            xe();
            var Ne = Ue.charAt(0), ke = (Ne === "x" || Ne === "y") && tr[0] && F13[tr[0].trace.type];
            if (we && ct !== 0 && tr.length !== 0) {
              var Me = Re(tr.filter(function(tn) {
                return tn.ya.showspikes;
              }), ct, ke);
              at.hLinePoint = qe(Me);
              var Le = Re(tr.filter(function(tn) {
                return tn.xa.showspikes;
              }), ct, ke);
              at.vLinePoint = qe(Le);
            }
            if (tr.length === 0) {
              var ze = d.unhoverRaw(Z2, ne);
              return !we || at.hLinePoint === null && at.vLinePoint === null || X2(rt) && W2(Z2, at, je), ze;
            }
            if (we && X2(rt) && W2(Z2, at, je), g.isXYhover(Nt) && tr[0].length !== 0 && tr[0].trace.type !== "splom") {
              var ft = tr[0], De = (tr = E2[ft.trace.type] ? tr.filter(function(tn) {
                return tn.trace.index === ft.trace.index;
              }) : [ft]).length, Je = K2("x", ft, se), tt = K2("y", ft, se);
              ut(Je, tt);
              var vt, kt = [], jt = {}, Vt = 0, Kt = function(tn) {
                var Zn = E2[tn.trace.type] ? N2(tn) : tn.trace.index;
                if (jt[Zn]) {
                  var Ln = jt[Zn] - 1, gn = kt[Ln];
                  Ln > 0 && Math.abs(tn.distance) < Math.abs(gn.distance) && (kt[Ln] = tn);
                } else Vt++, jt[Zn] = Vt, kt.push(tn);
              };
              for (vt = 0; vt < De; vt++) Kt(tr[vt]);
              for (vt = tr.length - 1; vt > De - 1; vt--) Kt(tr[vt]);
              tr = kt, xe();
            }
            var rr = Z2._hoverdata, Tr = [], yr = q(Z2), pr = re(Z2);
            for (it = 0; it < tr.length; it++) {
              var lr = tr[it], _r = g.makeEventData(lr, lr.trace, lr.cd);
              if (lr.hovertemplate !== false) {
                var $r = false;
                lr.cd[lr.index] && lr.cd[lr.index].ht && ($r = lr.cd[lr.index].ht), lr.hovertemplate = $r || lr.trace.hovertemplate || false;
              }
              if (lr.xa && lr.ya) {
                var Ar = lr.x0 + lr.xa._offset, Qr = lr.x1 + lr.xa._offset, hn = lr.y0 + lr.ya._offset, wn = lr.y1 + lr.ya._offset, Yn = Math.min(Ar, Qr), Xn = Math.max(Ar, Qr), Wn = Math.min(hn, wn), _n = Math.max(hn, wn);
                _r.bbox = { x0: Yn + pr, x1: Xn + pr, y0: Wn + yr, y1: _n + yr };
              }
              lr.eventData = [_r], Tr.push(_r);
            }
            Z2._hoverdata = Tr;
            var qr = Ue === "y" && (Ye.length > 1 || tr.length > 1) || Ue === "closest" && Ge && tr.length > 1, Nr = p.combine(se.plot_bgcolor || p.background, se.paper_bgcolor), Zr = I2(tr, { gd: Z2, hovermode: Ue, rotateLabels: qr, bgColor: Nr, container: se._hoverlayer, outerContainer: se._paper.node(), commonLabelOpts: se.hoverlabel, hoverdistance: se.hoverdistance });
            if (g.isUnifiedHover(Ue) || (function(tn, Zn, Ln) {
              var gn, na, sr, Ut, Zt, xr, Fr, pn = 0, un = 1, Ir = tn.size(), Cr = new Array(Ir), Lr = 0;
              function jr(an) {
                var Sn = an[0], Rn = an[an.length - 1];
                if (na = Sn.pmin - Sn.pos - Sn.dp + Sn.size, sr = Rn.pos + Rn.dp + Rn.size - Sn.pmax, na > 0.01) {
                  for (Zt = an.length - 1; Zt >= 0; Zt--) an[Zt].dp += na;
                  gn = false;
                }
                if (!(sr < 0.01)) {
                  if (na < -0.01) {
                    for (Zt = an.length - 1; Zt >= 0; Zt--) an[Zt].dp -= sr;
                    gn = false;
                  }
                  if (gn) {
                    var Kn = 0;
                    for (Ut = 0; Ut < an.length; Ut++) (xr = an[Ut]).pos + xr.dp + xr.size > Sn.pmax && Kn++;
                    for (Ut = an.length - 1; Ut >= 0 && !(Kn <= 0); Ut--) (xr = an[Ut]).pos > Sn.pmax - 1 && (xr.del = true, Kn--);
                    for (Ut = 0; Ut < an.length && !(Kn <= 0); Ut++) if ((xr = an[Ut]).pos < Sn.pmin + 1) for (xr.del = true, Kn--, sr = 2 * xr.size, Zt = an.length - 1; Zt >= 0; Zt--) an[Zt].dp -= sr;
                    for (Ut = an.length - 1; Ut >= 0 && !(Kn <= 0); Ut--) (xr = an[Ut]).pos + xr.dp + xr.size > Sn.pmax && (xr.del = true, Kn--);
                  }
                }
              }
              for (tn.each(function(an) {
                var Sn = an[Zn], Rn = Sn._id.charAt(0) === "x", Kn = Sn.range;
                Lr === 0 && Kn && Kn[0] > Kn[1] !== Rn && (un = -1), Cr[Lr++] = [{ datum: an, traceIndex: an.trace.index, dp: 0, pos: an.pos, posref: an.posref, size: an.by * (Rn ? k : 1) / 2, pmin: 0, pmax: Rn ? Ln.width : Ln.height }];
              }), Cr.sort(function(an, Sn) {
                return an[0].posref - Sn[0].posref || un * (Sn[0].traceIndex - an[0].traceIndex);
              }); !gn && pn <= Ir; ) {
                for (pn++, gn = true, Ut = 0; Ut < Cr.length - 1; ) {
                  var Rr = Cr[Ut], vn = Cr[Ut + 1], Mn = Rr[Rr.length - 1], jn = vn[0];
                  if ((na = Mn.pos + Mn.dp + Mn.size - jn.pos - jn.dp + jn.size) > 0.01 && Mn.pmin === jn.pmin && Mn.pmax === jn.pmax) {
                    for (Zt = vn.length - 1; Zt >= 0; Zt--) vn[Zt].dp += na;
                    for (Rr.push.apply(Rr, vn), Cr.splice(Ut + 1, 1), Fr = 0, Zt = Rr.length - 1; Zt >= 0; Zt--) Fr += Rr[Zt].dp;
                    for (sr = Fr / Rr.length, Zt = Rr.length - 1; Zt >= 0; Zt--) Rr[Zt].dp -= sr;
                    gn = false;
                  } else Ut++;
                }
                Cr.forEach(jr);
              }
              for (Ut = Cr.length - 1; Ut >= 0; Ut--) {
                var bn = Cr[Ut];
                for (Zt = bn.length - 1; Zt >= 0; Zt--) {
                  var Bn = bn[Zt], sn = Bn.datum;
                  sn.offset = Bn.dp, sn.del = Bn.del;
                }
              }
            }(Zr, qr ? "xa" : "ya", se), L2(Zr, qr, se._invScaleX, se._invScaleY)), le && le.tagName) {
              var oa = m.getComponentMethod("annotations", "hasClickToShow")(Z2, Tr);
              f(n.select(le), oa ? "pointer" : "");
            }
            !le || ue || !function(tn, Zn, Ln) {
              if (!Ln || Ln.length !== tn._hoverdata.length) return true;
              for (var gn = Ln.length - 1; gn >= 0; gn--) {
                var na = Ln[gn], sr = tn._hoverdata[gn];
                if (na.curveNumber !== sr.curveNumber || String(na.pointNumber) !== String(sr.pointNumber) || String(na.pointNumbers) !== String(sr.pointNumbers)) return true;
              }
              return false;
            }(Z2, 0, rr) || (rr && Z2.emit("plotly_unhover", { event: ne, points: rr }), Z2.emit("plotly_hover", { event: ne, points: Z2._hoverdata, xaxes: pe, yaxes: ve, xvals: We, yvals: Ze }));
          })(z, H2, te, j, Q2);
        });
      }, r.loneHover = function(z, H2) {
        var te = true;
        Array.isArray(z) || (te = false, z = [z]);
        var j = H2.gd, Q2 = q(j), Z2 = re(j), ne = I2(z.map(function(le) {
          var ce = le._x0 || le.x0 || le.x || 0, se = le._x1 || le.x1 || le.x || 0, he = le._y0 || le.y0 || le.y || 0, me = le._y1 || le.y1 || le.y || 0, we = le.eventData;
          if (we) {
            var be = Math.min(ce, se), Ae = Math.max(ce, se), pe = Math.min(he, me), ve = Math.max(he, me), Ee = le.trace;
            if (m.traceIs(Ee, "gl3d")) {
              var Se = j._fullLayout[Ee.scene]._scene.container, Ce = Se.offsetLeft, Be = Se.offsetTop;
              be += Ce, Ae += Ce, pe += Be, ve += Be;
            }
            we.bbox = { x0: be + Z2, x1: Ae + Z2, y0: pe + Q2, y1: ve + Q2 }, H2.inOut_bbox && H2.inOut_bbox.push(we.bbox);
          } else we = false;
          return { color: le.color || p.defaultLine, x0: le.x0 || le.x || 0, x1: le.x1 || le.x || 0, y0: le.y0 || le.y || 0, y1: le.y1 || le.y || 0, xLabel: le.xLabel, yLabel: le.yLabel, zLabel: le.zLabel, text: le.text, name: le.name, idealAlign: le.idealAlign, borderColor: le.borderColor, fontFamily: le.fontFamily, fontSize: le.fontSize, fontColor: le.fontColor, nameLength: le.nameLength, textAlign: le.textAlign, trace: le.trace || { index: 0, hoverinfo: "" }, xa: { _offset: 0 }, ya: { _offset: 0 }, index: 0, hovertemplate: le.hovertemplate || false, hovertemplateLabels: le.hovertemplateLabels || false, eventData: we };
        }), { gd: j, hovermode: "closest", rotateLabels: false, bgColor: H2.bgColor || p.background, container: n.select(H2.container), outerContainer: H2.outerContainer || H2.container }), ae = 0, ue = 0;
        return ne.sort(function(le, ce) {
          return le.y0 - ce.y0;
        }).each(function(le, ce) {
          var se = le.y0 - le.by / 2;
          le.offset = se - 5 < ae ? ae - se + 5 : 0, ae = se + le.by + le.offset, ce === H2.anchorIndex && (ue = le.offset);
        }).each(function(le) {
          le.offset -= ue;
        }), L2(ne, false, j._fullLayout._invScaleX, j._fullLayout._invScaleY), te ? ne : ne.node();
      };
      var D2 = /<extra>([\s\S]*)<\/extra>/;
      function I2(z, H2) {
        var te = H2.gd, j = te._fullLayout, Q2 = H2.hovermode, Z2 = H2.rotateLabels, ne = H2.bgColor, ae = H2.container, ue = H2.outerContainer, le = H2.commonLabelOpts || {};
        if (z.length === 0) return [[]];
        var ce = H2.fontFamily || x.HOVERFONT, se = H2.fontSize || x.HOVERFONTSIZE, he = z[0], me = he.xa, we = he.ya, be = Q2.charAt(0), Ae = he[be + "Label"], pe = R2(te, ue), ve = pe.top, Ee = pe.width, Se = pe.height, Ce = Ae !== void 0 && he.distance <= H2.hoverdistance && (Q2 === "x" || Q2 === "y");
        if (Ce) {
          var Be, Ue, Ke = true;
          for (Be = 0; Be < z.length; Be++) if (Ke && z[Be].zLabel === void 0 && (Ke = false), Ue = z[Be].hoverinfo || z[Be].trace.hoverinfo) {
            var ct = Array.isArray(Ue) ? Ue : Ue.split("+");
            if (ct.indexOf("all") === -1 && ct.indexOf(Q2) === -1) {
              Ce = false;
              break;
            }
          }
          Ke && (Ce = false);
        }
        var We = ae.selectAll("g.axistext").data(Ce ? [0] : []);
        if (We.enter().append("g").classed("axistext", true), We.exit().remove(), We.each(function() {
          var ke = n.select(this), Me = s.ensureSingle(ke, "path", "", function(Qr) {
            Qr.style({ "stroke-width": "1px" });
          }), Le = s.ensureSingle(ke, "text", "", function(Qr) {
            Qr.attr("data-notex", 1);
          }), ze = le.bgcolor || p.defaultLine, ft = le.bordercolor || p.contrast(ze), De = p.contrast(ze), Je = { family: le.font.family || ce, size: le.font.size || se, color: le.font.color || De };
          Me.style({ fill: ze, stroke: ft }), Le.text(Ae).call(h.font, Je).call(c.positionText, 0, 0).call(c.convertToTspans, te), ke.attr("transform", "");
          var tt, vt, kt = R2(te, Le.node());
          if (Q2 === "x") {
            var jt = me.side === "top" ? "-" : "";
            Le.attr("text-anchor", "middle").call(c.positionText, 0, me.side === "top" ? ve - kt.bottom - S2 - C2 : ve - kt.top + S2 + C2), tt = me._offset + (he.x0 + he.x1) / 2, vt = we._offset + (me.side === "top" ? 0 : we._length);
            var Vt = kt.width / 2 + C2;
            tt < Vt ? (tt = Vt, Me.attr("d", "M-" + (Vt - S2) + ",0L-" + (Vt - 2 * S2) + "," + jt + S2 + "H" + (C2 + kt.width / 2) + "v" + jt + (2 * C2 + kt.height) + "H-" + Vt + "V" + jt + S2 + "Z")) : tt > j.width - Vt ? (tt = j.width - Vt, Me.attr("d", "M" + (Vt - S2) + ",0L" + Vt + "," + jt + S2 + "v" + jt + (2 * C2 + kt.height) + "H-" + Vt + "V" + jt + S2 + "H" + (Vt - 2 * S2) + "Z")) : Me.attr("d", "M0,0L" + S2 + "," + jt + S2 + "H" + (C2 + kt.width / 2) + "v" + jt + (2 * C2 + kt.height) + "H-" + (C2 + kt.width / 2) + "V" + jt + S2 + "H-" + S2 + "Z");
          } else {
            var Kt, rr, Tr;
            we.side === "right" ? (Kt = "start", rr = 1, Tr = "", tt = me._offset + me._length) : (Kt = "end", rr = -1, Tr = "-", tt = me._offset), vt = we._offset + (he.y0 + he.y1) / 2, Le.attr("text-anchor", Kt), Me.attr("d", "M0,0L" + Tr + S2 + "," + S2 + "V" + (C2 + kt.height / 2) + "h" + Tr + (2 * C2 + kt.width) + "V-" + (C2 + kt.height / 2) + "H" + Tr + S2 + "V-" + S2 + "Z");
            var yr, pr = kt.height / 2, lr = ve - kt.top - pr, _r = "clip" + j._uid + "commonlabel" + we._id;
            if (tt < kt.width + 2 * C2 + S2) {
              yr = "M-" + (S2 + C2) + "-" + pr + "h-" + (kt.width - C2) + "V" + pr + "h" + (kt.width - C2) + "Z";
              var $r = kt.width - tt + C2;
              c.positionText(Le, $r, lr), Kt === "end" && Le.selectAll("tspan").each(function() {
                var Qr = n.select(this), hn = h.tester.append("text").text(Qr.text()).call(h.font, Je), wn = R2(te, hn.node());
                Math.round(wn.width) < Math.round(kt.width) && Qr.attr("x", $r - wn.width), hn.remove();
              });
            } else c.positionText(Le, rr * (C2 + S2), lr), yr = null;
            var Ar = j._topclips.selectAll("#" + _r).data(yr ? [0] : []);
            Ar.enter().append("clipPath").attr("id", _r).append("path"), Ar.exit().remove(), Ar.select("path").attr("d", yr), h.setClipUrl(Le, yr ? _r : null, te);
          }
          ke.attr("transform", i(tt, vt));
        }), g.isUnifiedHover(Q2)) {
          ae.selectAll("g.hovertext").remove();
          var Ze = z.filter(function(ke) {
            return ke.hoverinfo !== "none";
          });
          if (Ze.length === 0) return;
          var it = j.hoverlabel, ot = it.font, mt = { showlegend: true, legend: { title: { text: Ae, font: ot }, font: ot, bgcolor: it.bgcolor, bordercolor: it.bordercolor, borderwidth: 1, tracegroupgap: 7, traceorder: j.legend ? j.legend.traceorder : void 0, orientation: "v" } }, wt = { font: ot };
          b(mt, wt, te._fullData);
          var Et = wt.legend;
          Et.entries = [];
          for (var zt = 0; zt < Ze.length; zt++) {
            var Nt = Ze[zt];
            if (Nt.hoverinfo !== "none") {
              var yt = O2(Nt, true, Q2, j, Ae), pt = yt[0], Ot = yt[1];
              Nt.name = Ot, Nt.text = Ot !== "" ? Ot + " : " + pt : pt;
              var Jt = Nt.cd[Nt.index];
              Jt && (Jt.mc && (Nt.mc = Jt.mc), Jt.mcc && (Nt.mc = Jt.mcc), Jt.mlc && (Nt.mlc = Jt.mlc), Jt.mlcc && (Nt.mlc = Jt.mlcc), Jt.mlw && (Nt.mlw = Jt.mlw), Jt.mrc && (Nt.mrc = Jt.mrc), Jt.dir && (Nt.dir = Jt.dir)), Nt._distinct = true, Et.entries.push([Nt]);
            }
          }
          Et.entries.sort(function(ke, Me) {
            return ke[0].trace.index - Me[0].trace.index;
          }), Et.layer = ae, Et._inHover = true, Et._groupTitleFont = it.grouptitlefont, y(te, Et);
          var tr, Ye, at, Ge, st = ae.select("g.legend"), Ie = R2(te, st.node()), Pe = Ie.width + 2 * C2, $e = Ie.height + 2 * C2, Ve = Ze[0], ut = (Ve.x0 + Ve.x1) / 2, Re = (Ve.y0 + Ve.y1) / 2, qe = !(m.traceIs(Ve.trace, "bar-like") || m.traceIs(Ve.trace, "box-violin"));
          be === "y" ? qe ? (Ye = Re - C2, tr = Re + C2) : (Ye = Math.min.apply(null, Ze.map(function(ke) {
            return Math.min(ke.y0, ke.y1);
          })), tr = Math.max.apply(null, Ze.map(function(ke) {
            return Math.max(ke.y0, ke.y1);
          }))) : Ye = tr = s.mean(Ze.map(function(ke) {
            return (ke.y0 + ke.y1) / 2;
          })) - $e / 2, be === "x" ? qe ? (at = ut + C2, Ge = ut - C2) : (at = Math.max.apply(null, Ze.map(function(ke) {
            return Math.max(ke.x0, ke.x1);
          })), Ge = Math.min.apply(null, Ze.map(function(ke) {
            return Math.min(ke.x0, ke.x1);
          }))) : at = Ge = s.mean(Ze.map(function(ke) {
            return (ke.x0 + ke.x1) / 2;
          })) - Pe / 2;
          var je, rt, He = me._offset, xe = we._offset;
          return Ge += He - Pe, Ye += xe - $e, je = (at += He) + Pe < Ee && at >= 0 ? at : Ge + Pe < Ee && Ge >= 0 ? Ge : He + Pe < Ee ? He : at - ut < ut - Ge + Pe ? Ee - Pe : 0, je += C2, rt = (tr += xe) + $e < Se && tr >= 0 ? tr : Ye + $e < Se && Ye >= 0 ? Ye : xe + $e < Se ? xe : tr - Re < Re - Ye + $e ? Se - $e : 0, rt += C2, st.attr("transform", i(je - 1, rt - 1)), st;
        }
        var Ne = ae.selectAll("g.hovertext").data(z, function(ke) {
          return N2(ke);
        });
        return Ne.enter().append("g").classed("hovertext", true).each(function() {
          var ke = n.select(this);
          ke.append("rect").call(p.fill, p.addOpacity(ne, 0.8)), ke.append("text").classed("name", true), ke.append("path").style("stroke-width", "1px"), ke.append("text").classed("nums", true).call(h.font, ce, se);
        }), Ne.exit().remove(), Ne.each(function(ke) {
          var Me = n.select(this).attr("transform", ""), Le = ke.color;
          Array.isArray(Le) && (Le = Le[ke.eventData[0].pointNumber]);
          var ze = ke.bgcolor || Le, ft = p.combine(p.opacity(ze) ? ze : p.defaultLine, ne), De = p.combine(p.opacity(Le) ? Le : p.defaultLine, ne), Je = ke.borderColor || p.contrast(ft), tt = O2(ke, Ce, Q2, j, Ae, Me), vt = tt[0], kt = tt[1], jt = Me.select("text.nums").call(h.font, ke.fontFamily || ce, ke.fontSize || se, ke.fontColor || Je).text(vt).attr("data-notex", 1).call(c.positionText, 0, 0).call(c.convertToTspans, te), Vt = Me.select("text.name"), Kt = 0, rr = 0;
          if (kt && kt !== vt) {
            Vt.call(h.font, ke.fontFamily || ce, ke.fontSize || se, De).text(kt).attr("data-notex", 1).call(c.positionText, 0, 0).call(c.convertToTspans, te);
            var Tr = R2(te, Vt.node());
            Kt = Tr.width + 2 * C2, rr = Tr.height + 2 * C2;
          } else Vt.remove(), Me.select("rect").remove();
          Me.select("path").style({ fill: ft, stroke: Je });
          var yr = ke.xa._offset + (ke.x0 + ke.x1) / 2, pr = ke.ya._offset + (ke.y0 + ke.y1) / 2, lr = Math.abs(ke.x1 - ke.x0), _r = Math.abs(ke.y1 - ke.y0), $r = R2(te, jt.node()), Ar = $r.width / j._invScaleX, Qr = $r.height / j._invScaleY;
          ke.ty0 = (ve - $r.top) / j._invScaleY, ke.bx = Ar + 2 * C2, ke.by = Math.max(Qr + 2 * C2, rr), ke.anchor = "start", ke.txwidth = Ar, ke.tx2width = Kt, ke.offset = 0;
          var hn, wn, Yn = (Ar + S2 + C2 + Kt) * j._invScaleX;
          if (Z2) ke.pos = yr, hn = pr + _r / 2 + Yn <= Se, wn = pr - _r / 2 - Yn >= 0, ke.idealAlign !== "top" && hn || !wn ? hn ? (pr += _r / 2, ke.anchor = "start") : ke.anchor = "middle" : (pr -= _r / 2, ke.anchor = "end");
          else if (ke.pos = pr, hn = yr + lr / 2 + Yn <= Ee, wn = yr - lr / 2 - Yn >= 0, ke.idealAlign !== "left" && hn || !wn) if (hn) yr += lr / 2, ke.anchor = "start";
          else {
            ke.anchor = "middle";
            var Xn = Yn / 2, Wn = yr + Xn - Ee, _n = yr - Xn;
            Wn > 0 && (yr -= Wn), _n < 0 && (yr += -_n);
          }
          else yr -= lr / 2, ke.anchor = "end";
          jt.attr("text-anchor", ke.anchor), Kt && Vt.attr("text-anchor", ke.anchor), Me.attr("transform", i(yr, pr) + (Z2 ? l(w) : ""));
        }), Ne;
      }
      function O2(z, H2, te, j, Q2, Z2) {
        var ne = "", ae = "";
        z.nameOverride !== void 0 && (z.name = z.nameOverride), z.name && (z.trace._meta && (z.name = s.templateString(z.name, z.trace._meta)), ne = Y2(z.name, z.nameLength));
        var ue = te.charAt(0), le = ue === "x" ? "y" : "x";
        z.zLabel !== void 0 ? (z.xLabel !== void 0 && (ae += "x: " + z.xLabel + "<br>"), z.yLabel !== void 0 && (ae += "y: " + z.yLabel + "<br>"), z.trace.type !== "choropleth" && z.trace.type !== "choroplethmapbox" && (ae += (ae ? "z: " : "") + z.zLabel)) : H2 && z[ue + "Label"] === Q2 ? ae = z[le + "Label"] || "" : z.xLabel === void 0 ? z.yLabel !== void 0 && z.trace.type !== "scattercarpet" && (ae = z.yLabel) : ae = z.yLabel === void 0 ? z.xLabel : "(" + z.xLabel + ", " + z.yLabel + ")", !z.text && z.text !== 0 || Array.isArray(z.text) || (ae += (ae ? "<br>" : "") + z.text), z.extraText !== void 0 && (ae += (ae ? "<br>" : "") + z.extraText), Z2 && ae === "" && !z.hovertemplate && (ne === "" && Z2.remove(), ae = ne);
        var ce = z.hovertemplate || false;
        if (ce) {
          var se = z.hovertemplateLabels || z;
          z[ue + "Label"] !== Q2 && (se[ue + "other"] = se[ue + "Val"], se[ue + "otherLabel"] = se[ue + "Label"]), ae = (ae = s.hovertemplateString(ce, se, j._d3locale, z.eventData[0] || {}, z.trace._meta)).replace(D2, function(he, me) {
            return ne = Y2(me, z.nameLength), "";
          });
        }
        return [ae, ne];
      }
      function L2(z, H2, te, j) {
        var Q2 = function(ne) {
          return ne * te;
        }, Z2 = function(ne) {
          return ne * j;
        };
        z.each(function(ne) {
          var ae = n.select(this);
          if (ne.del) return ae.remove();
          var ue = ae.select("text.nums"), le = ne.anchor, ce = le === "end" ? -1 : 1, se = { start: 1, end: -1, middle: 0 }[le], he = se * (S2 + C2), me = he + se * (ne.txwidth + C2), we = 0, be = ne.offset, Ae = le === "middle";
          Ae && (he -= ne.tx2width / 2, me += ne.txwidth / 2 + C2), H2 && (be *= -A2, we = ne.offset * T2), ae.select("path").attr("d", Ae ? "M-" + Q2(ne.bx / 2 + ne.tx2width / 2) + "," + Z2(be - ne.by / 2) + "h" + Q2(ne.bx) + "v" + Z2(ne.by) + "h-" + Q2(ne.bx) + "Z" : "M0,0L" + Q2(ce * S2 + we) + "," + Z2(S2 + be) + "v" + Z2(ne.by / 2 - S2) + "h" + Q2(ce * ne.bx) + "v-" + Z2(ne.by) + "H" + Q2(ce * S2 + we) + "V" + Z2(be - S2) + "Z");
          var pe = we + he, ve = be + ne.ty0 - ne.by / 2 + C2, Ee = ne.textAlign || "auto";
          Ee !== "auto" && (Ee === "left" && le !== "start" ? (ue.attr("text-anchor", "start"), pe = Ae ? -ne.bx / 2 - ne.tx2width / 2 + C2 : -ne.bx - C2) : Ee === "right" && le !== "end" && (ue.attr("text-anchor", "end"), pe = Ae ? ne.bx / 2 - ne.tx2width / 2 - C2 : ne.bx + C2)), ue.call(c.positionText, Q2(pe), Z2(ve)), ne.tx2width && (ae.select("text.name").call(c.positionText, Q2(me + se * C2 + we), Z2(be + ne.ty0 - ne.by / 2 + C2)), ae.select("rect").call(h.setRect, Q2(me + (se - 1) * ne.tx2width / 2 + we), Z2(be - ne.by / 2 - 1), Q2(ne.tx2width), Z2(ne.by + 2)));
        });
      }
      function V2(z, H2) {
        var te = z.index, j = z.trace || {}, Q2 = z.cd[0], Z2 = z.cd[te] || {};
        function ne(he) {
          return he || a(he) && he === 0;
        }
        var ae = Array.isArray(te) ? function(he, me) {
          var we = s.castOption(Q2, te, he);
          return ne(we) ? we : s.extractOption({}, j, "", me);
        } : function(he, me) {
          return s.extractOption(Z2, j, he, me);
        };
        function ue(he, me, we) {
          var be = ae(me, we);
          ne(be) && (z[he] = be);
        }
        if (ue("hoverinfo", "hi", "hoverinfo"), ue("bgcolor", "hbg", "hoverlabel.bgcolor"), ue("borderColor", "hbc", "hoverlabel.bordercolor"), ue("fontFamily", "htf", "hoverlabel.font.family"), ue("fontSize", "hts", "hoverlabel.font.size"), ue("fontColor", "htc", "hoverlabel.font.color"), ue("nameLength", "hnl", "hoverlabel.namelength"), ue("textAlign", "hta", "hoverlabel.align"), z.posref = H2 === "y" || H2 === "closest" && j.orientation === "h" ? z.xa._offset + (z.x0 + z.x1) / 2 : z.ya._offset + (z.y0 + z.y1) / 2, z.x0 = s.constrain(z.x0, 0, z.xa._length), z.x1 = s.constrain(z.x1, 0, z.xa._length), z.y0 = s.constrain(z.y0, 0, z.ya._length), z.y1 = s.constrain(z.y1, 0, z.ya._length), z.xLabelVal !== void 0 && (z.xLabel = "xLabel" in z ? z.xLabel : v.hoverLabelText(z.xa, z.xLabelVal, j.xhoverformat), z.xVal = z.xa.c2d(z.xLabelVal)), z.yLabelVal !== void 0 && (z.yLabel = "yLabel" in z ? z.yLabel : v.hoverLabelText(z.ya, z.yLabelVal, j.yhoverformat), z.yVal = z.ya.c2d(z.yLabelVal)), z.zLabelVal !== void 0 && z.zLabel === void 0 && (z.zLabel = String(z.zLabelVal)), !(isNaN(z.xerr) || z.xa.type === "log" && z.xerr <= 0)) {
          var le = v.tickText(z.xa, z.xa.c2l(z.xerr), "hover").text;
          z.xerrneg !== void 0 ? z.xLabel += " +" + le + " / -" + v.tickText(z.xa, z.xa.c2l(z.xerrneg), "hover").text : z.xLabel += " \xB1 " + le, H2 === "x" && (z.distance += 1);
        }
        if (!(isNaN(z.yerr) || z.ya.type === "log" && z.yerr <= 0)) {
          var ce = v.tickText(z.ya, z.ya.c2l(z.yerr), "hover").text;
          z.yerrneg !== void 0 ? z.yLabel += " +" + ce + " / -" + v.tickText(z.ya, z.ya.c2l(z.yerrneg), "hover").text : z.yLabel += " \xB1 " + ce, H2 === "y" && (z.distance += 1);
        }
        var se = z.hoverinfo || z.trace.hoverinfo;
        return se && se !== "all" && ((se = Array.isArray(se) ? se : se.split("+")).indexOf("x") === -1 && (z.xLabel = void 0), se.indexOf("y") === -1 && (z.yLabel = void 0), se.indexOf("z") === -1 && (z.zLabel = void 0), se.indexOf("text") === -1 && (z.text = void 0), se.indexOf("name") === -1 && (z.name = void 0)), z;
      }
      function W2(z, H2, te) {
        var j, Q2, Z2 = te.container, ne = te.fullLayout, ae = ne._size, ue = te.event, le = !!H2.hLinePoint, ce = !!H2.vLinePoint;
        if (Z2.selectAll(".spikeline").remove(), ce || le) {
          var se = p.combine(ne.plot_bgcolor, ne.paper_bgcolor);
          if (le) {
            var he, me, we = H2.hLinePoint;
            j = we && we.xa, (Q2 = we && we.ya).spikesnap === "cursor" ? (he = ue.pointerX, me = ue.pointerY) : (he = j._offset + we.x, me = Q2._offset + we.y);
            var be, Ae, pe = o.readability(we.color, se) < 1.5 ? p.contrast(se) : we.color, ve = Q2.spikemode, Ee = Q2.spikethickness, Se = Q2.spikecolor || pe, Ce = v.getPxPosition(z, Q2);
            if (ve.indexOf("toaxis") !== -1 || ve.indexOf("across") !== -1) {
              if (ve.indexOf("toaxis") !== -1 && (be = Ce, Ae = he), ve.indexOf("across") !== -1) {
                var Be = Q2._counterDomainMin, Ue = Q2._counterDomainMax;
                Q2.anchor === "free" && (Be = Math.min(Be, Q2.position), Ue = Math.max(Ue, Q2.position)), be = ae.l + Be * ae.w, Ae = ae.l + Ue * ae.w;
              }
              Z2.insert("line", ":first-child").attr({ x1: be, x2: Ae, y1: me, y2: me, "stroke-width": Ee, stroke: Se, "stroke-dasharray": h.dashStyle(Q2.spikedash, Ee) }).classed("spikeline", true).classed("crisp", true), Z2.insert("line", ":first-child").attr({ x1: be, x2: Ae, y1: me, y2: me, "stroke-width": Ee + 2, stroke: se }).classed("spikeline", true).classed("crisp", true);
            }
            ve.indexOf("marker") !== -1 && Z2.insert("circle", ":first-child").attr({ cx: Ce + (Q2.side !== "right" ? Ee : -Ee), cy: me, r: Ee, fill: Se }).classed("spikeline", true);
          }
          if (ce) {
            var Ke, ct, We = H2.vLinePoint;
            j = We && We.xa, Q2 = We && We.ya, j.spikesnap === "cursor" ? (Ke = ue.pointerX, ct = ue.pointerY) : (Ke = j._offset + We.x, ct = Q2._offset + We.y);
            var Ze, it, ot = o.readability(We.color, se) < 1.5 ? p.contrast(se) : We.color, mt = j.spikemode, wt = j.spikethickness, Et = j.spikecolor || ot, zt = v.getPxPosition(z, j);
            if (mt.indexOf("toaxis") !== -1 || mt.indexOf("across") !== -1) {
              if (mt.indexOf("toaxis") !== -1 && (Ze = zt, it = ct), mt.indexOf("across") !== -1) {
                var Nt = j._counterDomainMin, yt = j._counterDomainMax;
                j.anchor === "free" && (Nt = Math.min(Nt, j.position), yt = Math.max(yt, j.position)), Ze = ae.t + (1 - yt) * ae.h, it = ae.t + (1 - Nt) * ae.h;
              }
              Z2.insert("line", ":first-child").attr({ x1: Ke, x2: Ke, y1: Ze, y2: it, "stroke-width": wt, stroke: Et, "stroke-dasharray": h.dashStyle(j.spikedash, wt) }).classed("spikeline", true).classed("crisp", true), Z2.insert("line", ":first-child").attr({ x1: Ke, x2: Ke, y1: Ze, y2: it, "stroke-width": wt + 2, stroke: se }).classed("spikeline", true).classed("crisp", true);
            }
            mt.indexOf("marker") !== -1 && Z2.insert("circle", ":first-child").attr({ cx: Ke, cy: zt - (j.side !== "top" ? wt : -wt), r: wt, fill: Et }).classed("spikeline", true);
          }
        }
      }
      function X2(z, H2) {
        return !H2 || H2.vLinePoint !== z._spikepoints.vLinePoint || H2.hLinePoint !== z._spikepoints.hLinePoint;
      }
      function Y2(z, H2) {
        return c.plainText(z || "", { len: H2, allowedTags: ["br", "sub", "sup", "b", "i", "em"] });
      }
      function K2(z, H2, te) {
        var j = H2[z + "a"], Q2 = H2[z + "Val"], Z2 = H2.cd[0];
        if (j.type === "category") Q2 = j._categoriesMap[Q2];
        else if (j.type === "date") {
          var ne = H2.trace[z + "periodalignment"];
          if (ne) {
            var ae = H2.cd[H2.index], ue = ae[z + "Start"];
            ue === void 0 && (ue = ae[z]);
            var le = ae[z + "End"];
            le === void 0 && (le = ae[z]);
            var ce = le - ue;
            ne === "end" ? Q2 += ce : ne === "middle" && (Q2 += ce / 2);
          }
          Q2 = j.d2c(Q2);
        }
        return Z2 && Z2.t && Z2.t.posLetter === j._id && (te.boxmode !== "group" && te.violinmode !== "group" || (Q2 += Z2.t.dPos)), Q2;
      }
      function q(z) {
        return z.offsetTop + z.clientTop;
      }
      function re(z) {
        return z.offsetLeft + z.clientLeft;
      }
      function R2(z, H2) {
        var te = z._fullLayout, j = H2.getBoundingClientRect(), Q2 = j.x, Z2 = j.y, ne = Q2 + j.width, ae = Z2 + j.height, ue = s.apply3DTransform(te._invTransform)(Q2, Z2), le = s.apply3DTransform(te._invTransform)(ne, ae), ce = ue[0], se = ue[1], he = le[0], me = le[1];
        return { x: ce, y: se, width: he - ce, height: me - se, top: Math.min(se, me), left: Math.min(ce, he), right: Math.max(ce, he), bottom: Math.max(se, me) };
      }
    }, { "../../lib": 503, "../../lib/events": 492, "../../lib/override_cursor": 514, "../../lib/svg_text_utils": 529, "../../plots/cartesian/axes": 554, "../../registry": 638, "../color": 366, "../dragelement": 385, "../drawing": 388, "../legend/defaults": 418, "../legend/draw": 419, "./constants": 400, "./helpers": 402, "@plotly/d3": 58, "fast-isnumeric": 190, tinycolor2: 312 }], 404: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../color"), o = e("./helpers").isUnifiedHover;
      t.exports = function(s, i, l, u2) {
        u2 = u2 || {};
        var c = i.legend;
        function f(h) {
          u2.font[h] || (u2.font[h] = c ? i.legend.font[h] : i.font[h]);
        }
        i && o(i.hovermode) && (u2.font || (u2.font = {}), f("size"), f("family"), f("color"), c ? (u2.bgcolor || (u2.bgcolor = a.combine(i.legend.bgcolor, i.paper_bgcolor)), u2.bordercolor || (u2.bordercolor = i.legend.bordercolor)) : u2.bgcolor || (u2.bgcolor = i.paper_bgcolor)), l("hoverlabel.bgcolor", u2.bgcolor), l("hoverlabel.bordercolor", u2.bordercolor), l("hoverlabel.namelength", u2.namelength), n.coerceFont(l, "hoverlabel.font", u2.font), l("hoverlabel.align", u2.align);
      };
    }, { "../../lib": 503, "../color": 366, "./helpers": 402 }], 405: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("./layout_attributes");
      t.exports = function(o, s) {
        function i(l, u2) {
          return s[l] !== void 0 ? s[l] : n.coerce(o, s, a, l, u2);
        }
        return i("clickmode"), i("hovermode");
      };
    }, { "../../lib": 503, "./layout_attributes": 407 }], 406: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../lib"), o = e("../dragelement"), s = e("./helpers"), i = e("./layout_attributes"), l = e("./hover");
      t.exports = { moduleType: "component", name: "fx", constants: e("./constants"), schema: { layout: i }, attributes: e("./attributes"), layoutAttributes: i, supplyLayoutGlobalDefaults: e("./layout_global_defaults"), supplyDefaults: e("./defaults"), supplyLayoutDefaults: e("./layout_defaults"), calc: e("./calc"), getDistanceFunction: s.getDistanceFunction, getClosest: s.getClosest, inbox: s.inbox, quadrature: s.quadrature, appendArrayPointValue: s.appendArrayPointValue, castHoverOption: function(u2, c, f) {
        return a.castOption(u2, c, "hoverlabel." + f);
      }, castHoverinfo: function(u2, c, f) {
        return a.castOption(u2, f, "hoverinfo", function(h) {
          return a.coerceHoverinfo({ hoverinfo: h }, { _module: u2._module }, c);
        });
      }, hover: l.hover, unhover: o.unhover, loneHover: l.loneHover, loneUnhover: function(u2) {
        var c = a.isD3Selection(u2) ? u2 : n.select(u2);
        c.selectAll("g.hovertext").remove(), c.selectAll(".spikeline").remove();
      }, click: e("./click") };
    }, { "../../lib": 503, "../dragelement": 385, "./attributes": 397, "./calc": 398, "./click": 399, "./constants": 400, "./defaults": 401, "./helpers": 402, "./hover": 403, "./layout_attributes": 407, "./layout_defaults": 408, "./layout_global_defaults": 409, "@plotly/d3": 58 }], 407: [function(e, t, r) {
      "use strict";
      var n = e("./constants"), a = e("../../plots/font_attributes"), o = a({ editType: "none" });
      o.family.dflt = n.HOVERFONT, o.size.dflt = n.HOVERFONTSIZE, t.exports = { clickmode: { valType: "flaglist", flags: ["event", "select"], dflt: "event", editType: "plot", extras: ["none"] }, dragmode: { valType: "enumerated", values: ["zoom", "pan", "select", "lasso", "drawclosedpath", "drawopenpath", "drawline", "drawrect", "drawcircle", "orbit", "turntable", false], dflt: "zoom", editType: "modebar" }, hovermode: { valType: "enumerated", values: ["x", "y", "closest", false, "x unified", "y unified"], dflt: "closest", editType: "modebar" }, hoverdistance: { valType: "integer", min: -1, dflt: 20, editType: "none" }, spikedistance: { valType: "integer", min: -1, dflt: -1, editType: "none" }, hoverlabel: { bgcolor: { valType: "color", editType: "none" }, bordercolor: { valType: "color", editType: "none" }, font: o, grouptitlefont: a({ editType: "none" }), align: { valType: "enumerated", values: ["left", "right", "auto"], dflt: "auto", editType: "none" }, namelength: { valType: "integer", min: -1, dflt: 15, editType: "none" }, editType: "none" }, selectdirection: { valType: "enumerated", values: ["h", "v", "d", "any"], dflt: "any", editType: "none" } };
    }, { "../../plots/font_attributes": 585, "./constants": 400 }], 408: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("./layout_attributes"), o = e("./hovermode_defaults"), s = e("./hoverlabel_defaults");
      t.exports = function(i, l) {
        function u2(p, d) {
          return n.coerce(i, l, a, p, d);
        }
        o(i, l) && (u2("hoverdistance"), u2("spikedistance")), u2("dragmode") === "select" && u2("selectdirection");
        var c = l._has("mapbox"), f = l._has("geo"), h = l._basePlotModules.length;
        l.dragmode === "zoom" && ((c || f) && h === 1 || c && f && h === 2) && (l.dragmode = "pan"), s(i, l, u2), n.coerceFont(u2, "hoverlabel.grouptitlefont", l.hoverlabel.font);
      };
    }, { "../../lib": 503, "./hoverlabel_defaults": 404, "./hovermode_defaults": 405, "./layout_attributes": 407 }], 409: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("./hoverlabel_defaults"), o = e("./layout_attributes");
      t.exports = function(s, i) {
        a(s, i, function(l, u2) {
          return n.coerce(s, i, o, l, u2);
        });
      };
    }, { "../../lib": 503, "./hoverlabel_defaults": 404, "./layout_attributes": 407 }], 410: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../lib/regex").counter, o = e("../../plots/domain").attributes, s = e("../../plots/cartesian/constants").idRegex, i = e("../../plot_api/plot_template"), l = { rows: { valType: "integer", min: 1, editType: "plot" }, roworder: { valType: "enumerated", values: ["top to bottom", "bottom to top"], dflt: "top to bottom", editType: "plot" }, columns: { valType: "integer", min: 1, editType: "plot" }, subplots: { valType: "info_array", freeLength: true, dimensions: 2, items: { valType: "enumerated", values: [a("xy").toString(), ""], editType: "plot" }, editType: "plot" }, xaxes: { valType: "info_array", freeLength: true, items: { valType: "enumerated", values: [s.x.toString(), ""], editType: "plot" }, editType: "plot" }, yaxes: { valType: "info_array", freeLength: true, items: { valType: "enumerated", values: [s.y.toString(), ""], editType: "plot" }, editType: "plot" }, pattern: { valType: "enumerated", values: ["independent", "coupled"], dflt: "coupled", editType: "plot" }, xgap: { valType: "number", min: 0, max: 1, editType: "plot" }, ygap: { valType: "number", min: 0, max: 1, editType: "plot" }, domain: o({ name: "grid", editType: "plot", noGridCell: true }, {}), xside: { valType: "enumerated", values: ["bottom", "bottom plot", "top plot", "top"], dflt: "bottom plot", editType: "plot" }, yside: { valType: "enumerated", values: ["left", "left plot", "right plot", "right"], dflt: "left plot", editType: "plot" }, editType: "plot" };
      function u2(h, p, d) {
        var v = p[d + "axes"], m = Object.keys((h._splomAxes || {})[d] || {});
        return Array.isArray(v) ? v : m.length ? m : void 0;
      }
      function c(h, p, d, v, m, g) {
        var x = p(h + "gap", d), b = p("domain." + h);
        p(h + "side", v);
        for (var y = new Array(m), w = b[0], _4 = (b[1] - w) / (m - x), k = _4 * (1 - x), T2 = 0; T2 < m; T2++) {
          var A2 = w + _4 * T2;
          y[g ? m - 1 - T2 : T2] = [A2, A2 + k];
        }
        return y;
      }
      function f(h, p, d, v, m) {
        var g, x = new Array(d);
        function b(y, w) {
          p.indexOf(w) !== -1 && v[w] === void 0 ? (x[y] = w, v[w] = y) : x[y] = "";
        }
        if (Array.isArray(h)) for (g = 0; g < d; g++) b(g, h[g]);
        else for (b(0, m), g = 1; g < d; g++) b(g, m + (g + 1));
        return x;
      }
      t.exports = { moduleType: "component", name: "grid", schema: { layout: { grid: l } }, layoutAttributes: l, sizeDefaults: function(h, p) {
        var d = h.grid || {}, v = u2(p, d, "x"), m = u2(p, d, "y");
        if (h.grid || v || m) {
          var g, x, b = Array.isArray(d.subplots) && Array.isArray(d.subplots[0]), y = Array.isArray(v), w = Array.isArray(m), _4 = y && v !== d.xaxes && w && m !== d.yaxes;
          b ? (g = d.subplots.length, x = d.subplots[0].length) : (w && (g = m.length), y && (x = v.length));
          var k = i.newContainer(p, "grid"), T2 = D2("rows", g), A2 = D2("columns", x);
          if (T2 * A2 > 1) {
            !b && !y && !w && D2("pattern") === "independent" && (b = true), k._hasSubplotGrid = b;
            var S2, C2, E2 = D2("roworder") === "top to bottom", F13 = b ? 0.2 : 0.1, N2 = b ? 0.3 : 0.1;
            _4 && p._splomGridDflt && (S2 = p._splomGridDflt.xside, C2 = p._splomGridDflt.yside), k._domains = { x: c("x", D2, F13, S2, A2), y: c("y", D2, N2, C2, T2, E2) };
          } else delete p.grid;
        }
        function D2(I2, O2) {
          return n.coerce(d, k, l, I2, O2);
        }
      }, contentDefaults: function(h, p) {
        var d = p.grid;
        if (d && d._domains) {
          var v, m, g, x, b, y, w, _4 = h.grid || {}, k = p._subplots, T2 = d._hasSubplotGrid, A2 = d.rows, S2 = d.columns, C2 = d.pattern === "independent", E2 = d._axisMap = {};
          if (T2) {
            var F13 = _4.subplots || [];
            y = d.subplots = new Array(A2);
            var N2 = 1;
            for (v = 0; v < A2; v++) {
              var D2 = y[v] = new Array(S2), I2 = F13[v] || [];
              for (m = 0; m < S2; m++) if (C2 ? (b = N2 === 1 ? "xy" : "x" + N2 + "y" + N2, N2++) : b = I2[m], D2[m] = "", k.cartesian.indexOf(b) !== -1) {
                if (w = b.indexOf("y"), g = b.slice(0, w), x = b.slice(w), E2[g] !== void 0 && E2[g] !== m || E2[x] !== void 0 && E2[x] !== v) continue;
                D2[m] = b, E2[g] = m, E2[x] = v;
              }
            }
          } else {
            var O2 = u2(p, _4, "x"), L2 = u2(p, _4, "y");
            d.xaxes = f(O2, k.xaxis, S2, E2, "x"), d.yaxes = f(L2, k.yaxis, A2, E2, "y");
          }
          var V2 = d._anchors = {}, W2 = d.roworder === "top to bottom";
          for (var X2 in E2) {
            var Y2, K2, q, re = X2.charAt(0), R2 = d[re + "side"];
            if (R2.length < 8) V2[X2] = "free";
            else if (re === "x") {
              if (R2.charAt(0) === "t" === W2 ? (Y2 = 0, K2 = 1, q = A2) : (Y2 = A2 - 1, K2 = -1, q = -1), T2) {
                var z = E2[X2];
                for (v = Y2; v !== q; v += K2) if ((b = y[v][z]) && (w = b.indexOf("y"), b.slice(0, w) === X2)) {
                  V2[X2] = b.slice(w);
                  break;
                }
              } else for (v = Y2; v !== q; v += K2) if (x = d.yaxes[v], k.cartesian.indexOf(X2 + x) !== -1) {
                V2[X2] = x;
                break;
              }
            } else if (R2.charAt(0) === "l" ? (Y2 = 0, K2 = 1, q = S2) : (Y2 = S2 - 1, K2 = -1, q = -1), T2) {
              var H2 = E2[X2];
              for (v = Y2; v !== q; v += K2) if ((b = y[H2][v]) && (w = b.indexOf("y"), b.slice(w) === X2)) {
                V2[X2] = b.slice(0, w);
                break;
              }
            } else for (v = Y2; v !== q; v += K2) if (g = d.xaxes[v], k.cartesian.indexOf(g + X2) !== -1) {
              V2[X2] = g;
              break;
            }
          }
        }
      } };
    }, { "../../lib": 503, "../../lib/regex": 520, "../../plot_api/plot_template": 543, "../../plots/cartesian/constants": 561, "../../plots/domain": 584 }], 411: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/cartesian/constants"), a = e("../../plot_api/plot_template").templatedArray;
      e("../../constants/axis_placeable_objects"), t.exports = a("image", { visible: { valType: "boolean", dflt: true, editType: "arraydraw" }, source: { valType: "string", editType: "arraydraw" }, layer: { valType: "enumerated", values: ["below", "above"], dflt: "above", editType: "arraydraw" }, sizex: { valType: "number", dflt: 0, editType: "arraydraw" }, sizey: { valType: "number", dflt: 0, editType: "arraydraw" }, sizing: { valType: "enumerated", values: ["fill", "contain", "stretch"], dflt: "contain", editType: "arraydraw" }, opacity: { valType: "number", min: 0, max: 1, dflt: 1, editType: "arraydraw" }, x: { valType: "any", dflt: 0, editType: "arraydraw" }, y: { valType: "any", dflt: 0, editType: "arraydraw" }, xanchor: { valType: "enumerated", values: ["left", "center", "right"], dflt: "left", editType: "arraydraw" }, yanchor: { valType: "enumerated", values: ["top", "middle", "bottom"], dflt: "top", editType: "arraydraw" }, xref: { valType: "enumerated", values: ["paper", n.idRegex.x.toString()], dflt: "paper", editType: "arraydraw" }, yref: { valType: "enumerated", values: ["paper", n.idRegex.y.toString()], dflt: "paper", editType: "arraydraw" }, editType: "arraydraw" });
    }, { "../../constants/axis_placeable_objects": 472, "../../plot_api/plot_template": 543, "../../plots/cartesian/constants": 561 }], 412: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("../../lib/to_log_range");
      t.exports = function(o, s, i, l) {
        s = s || {};
        var u2 = i === "log" && s.type === "linear", c = i === "linear" && s.type === "log";
        if (u2 || c) {
          for (var f, h, p = o._fullLayout.images, d = s._id.charAt(0), v = 0; v < p.length; v++) if (h = "images[" + v + "].", (f = p[v])[d + "ref"] === s._id) {
            var m = f[d], g = f["size" + d], x = null, b = null;
            if (u2) {
              x = a(m, s.range);
              var y = g / Math.pow(10, x) / 2;
              b = 2 * Math.log(y + Math.sqrt(1 + y * y)) / Math.LN10;
            } else b = (x = Math.pow(10, m)) * (Math.pow(10, g / 2) - Math.pow(10, -g / 2));
            n(x) ? n(b) || (b = null) : (x = null, b = null), l(h + d, x), l(h + "size" + d, b);
          }
        }
      };
    }, { "../../lib/to_log_range": 531, "fast-isnumeric": 190 }], 413: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../plots/cartesian/axes"), o = e("../../plots/array_container_defaults"), s = e("./attributes");
      function i(l, u2, c) {
        function f(x, b) {
          return n.coerce(l, u2, s, x, b);
        }
        var h = f("source");
        if (!f("visible", !!h)) return u2;
        f("layer"), f("xanchor"), f("yanchor"), f("sizex"), f("sizey"), f("sizing"), f("opacity");
        for (var p = { _fullLayout: c }, d = ["x", "y"], v = 0; v < 2; v++) {
          var m = d[v], g = a.coerceRef(l, u2, p, m, "paper", void 0);
          g !== "paper" && a.getFromId(p, g)._imgIndices.push(u2._index), a.coercePosition(u2, p, f, g, m, 0);
        }
        return u2;
      }
      t.exports = function(l, u2) {
        o(l, u2, { name: "images", handleItemDefaults: i });
      };
    }, { "../../lib": 503, "../../plots/array_container_defaults": 549, "../../plots/cartesian/axes": 554, "./attributes": 411 }], 414: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../drawing"), o = e("../../plots/cartesian/axes"), s = e("../../plots/cartesian/axis_ids"), i = e("../../constants/xmlns_namespaces");
      t.exports = function(l) {
        var u2, c, f = l._fullLayout, h = [], p = {}, d = [];
        for (c = 0; c < f.images.length; c++) {
          var v = f.images[c];
          if (v.visible) if (v.layer === "below" && v.xref !== "paper" && v.yref !== "paper") {
            u2 = s.ref2id(v.xref) + s.ref2id(v.yref);
            var m = f._plots[u2];
            if (!m) {
              d.push(v);
              continue;
            }
            m.mainplot && (u2 = m.mainplot.id), p[u2] || (p[u2] = []), p[u2].push(v);
          } else v.layer === "above" ? h.push(v) : d.push(v);
        }
        var g = { left: { sizing: "xMin", offset: 0 }, center: { sizing: "xMid", offset: -0.5 }, right: { sizing: "xMax", offset: -1 } }, x = { top: { sizing: "YMin", offset: 0 }, middle: { sizing: "YMid", offset: -0.5 }, bottom: { sizing: "YMax", offset: -1 } };
        function b(S2) {
          var C2 = n.select(this);
          if (this._imgSrc !== S2.source) if (C2.attr("xmlns", i.svg), S2.source && S2.source.slice(0, 5) === "data:") C2.attr("xlink:href", S2.source), this._imgSrc = S2.source;
          else {
            var E2 = new Promise((function(F13) {
              var N2 = new Image();
              function D2() {
                C2.remove(), F13();
              }
              this.img = N2, N2.setAttribute("crossOrigin", "anonymous"), N2.onerror = D2, N2.onload = function() {
                var I2 = document.createElement("canvas");
                I2.width = this.width, I2.height = this.height, I2.getContext("2d").drawImage(this, 0, 0);
                var O2 = I2.toDataURL("image/png");
                C2.attr("xlink:href", O2), F13();
              }, C2.on("error", D2), N2.src = S2.source, this._imgSrc = S2.source;
            }).bind(this));
            l._promises.push(E2);
          }
        }
        function y(S2) {
          var C2, E2, F13 = n.select(this), N2 = o.getFromId(l, S2.xref), D2 = o.getFromId(l, S2.yref), I2 = o.getRefType(S2.xref) === "domain", O2 = o.getRefType(S2.yref) === "domain", L2 = f._size;
          C2 = N2 !== void 0 ? typeof S2.xref == "string" && I2 ? N2._length * S2.sizex : Math.abs(N2.l2p(S2.sizex) - N2.l2p(0)) : S2.sizex * L2.w, E2 = D2 !== void 0 ? typeof S2.yref == "string" && O2 ? D2._length * S2.sizey : Math.abs(D2.l2p(S2.sizey) - D2.l2p(0)) : S2.sizey * L2.h;
          var V2, W2, X2 = C2 * g[S2.xanchor].offset, Y2 = E2 * x[S2.yanchor].offset, K2 = g[S2.xanchor].sizing + x[S2.yanchor].sizing;
          switch (V2 = N2 !== void 0 ? typeof S2.xref == "string" && I2 ? N2._length * S2.x + N2._offset : N2.r2p(S2.x) + N2._offset : S2.x * L2.w + L2.l, V2 += X2, W2 = D2 !== void 0 ? typeof S2.yref == "string" && O2 ? D2._length * (1 - S2.y) + D2._offset : D2.r2p(S2.y) + D2._offset : L2.h - S2.y * L2.h + L2.t, W2 += Y2, S2.sizing) {
            case "fill":
              K2 += " slice";
              break;
            case "stretch":
              K2 = "none";
          }
          F13.attr({ x: V2, y: W2, width: C2, height: E2, preserveAspectRatio: K2, opacity: S2.opacity });
          var q = (N2 && o.getRefType(S2.xref) !== "domain" ? N2._id : "") + (D2 && o.getRefType(S2.yref) !== "domain" ? D2._id : "");
          a.setClipUrl(F13, q ? "clip" + f._uid + q : null, l);
        }
        var w = f._imageLowerLayer.selectAll("image").data(d), _4 = f._imageUpperLayer.selectAll("image").data(h);
        w.enter().append("image"), _4.enter().append("image"), w.exit().remove(), _4.exit().remove(), w.each(function(S2) {
          b.bind(this)(S2), y.bind(this)(S2);
        }), _4.each(function(S2) {
          b.bind(this)(S2), y.bind(this)(S2);
        });
        var k = Object.keys(f._plots);
        for (c = 0; c < k.length; c++) {
          u2 = k[c];
          var T2 = f._plots[u2];
          if (T2.imagelayer) {
            var A2 = T2.imagelayer.selectAll("image").data(p[u2] || []);
            A2.enter().append("image"), A2.exit().remove(), A2.each(function(S2) {
              b.bind(this)(S2), y.bind(this)(S2);
            });
          }
        }
      };
    }, { "../../constants/xmlns_namespaces": 480, "../../plots/cartesian/axes": 554, "../../plots/cartesian/axis_ids": 558, "../drawing": 388, "@plotly/d3": 58 }], 415: [function(e, t, r) {
      "use strict";
      t.exports = { moduleType: "component", name: "images", layoutAttributes: e("./attributes"), supplyLayoutDefaults: e("./defaults"), includeBasePlot: e("../../plots/cartesian/include_components")("images"), draw: e("./draw"), convertCoords: e("./convert_coords") };
    }, { "../../plots/cartesian/include_components": 567, "./attributes": 411, "./convert_coords": 412, "./defaults": 413, "./draw": 414 }], 416: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/font_attributes"), a = e("../color/attributes");
      t.exports = { bgcolor: { valType: "color", editType: "legend" }, bordercolor: { valType: "color", dflt: a.defaultLine, editType: "legend" }, borderwidth: { valType: "number", min: 0, dflt: 0, editType: "legend" }, font: n({ editType: "legend" }), grouptitlefont: n({ editType: "legend" }), orientation: { valType: "enumerated", values: ["v", "h"], dflt: "v", editType: "legend" }, traceorder: { valType: "flaglist", flags: ["reversed", "grouped"], extras: ["normal"], editType: "legend" }, tracegroupgap: { valType: "number", min: 0, dflt: 10, editType: "legend" }, itemsizing: { valType: "enumerated", values: ["trace", "constant"], dflt: "trace", editType: "legend" }, itemwidth: { valType: "number", min: 30, dflt: 30, editType: "legend" }, itemclick: { valType: "enumerated", values: ["toggle", "toggleothers", false], dflt: "toggle", editType: "legend" }, itemdoubleclick: { valType: "enumerated", values: ["toggle", "toggleothers", false], dflt: "toggleothers", editType: "legend" }, groupclick: { valType: "enumerated", values: ["toggleitem", "togglegroup"], dflt: "togglegroup", editType: "legend" }, x: { valType: "number", min: -2, max: 3, editType: "legend" }, xanchor: { valType: "enumerated", values: ["auto", "left", "center", "right"], dflt: "left", editType: "legend" }, y: { valType: "number", min: -2, max: 3, editType: "legend" }, yanchor: { valType: "enumerated", values: ["auto", "top", "middle", "bottom"], editType: "legend" }, uirevision: { valType: "any", editType: "none" }, valign: { valType: "enumerated", values: ["top", "middle", "bottom"], dflt: "middle", editType: "legend" }, title: { text: { valType: "string", dflt: "", editType: "legend" }, font: n({ editType: "legend" }), side: { valType: "enumerated", values: ["top", "left", "top left"], editType: "legend" }, editType: "legend" }, editType: "legend" };
    }, { "../../plots/font_attributes": 585, "../color/attributes": 365 }], 417: [function(e, t, r) {
      "use strict";
      t.exports = { scrollBarWidth: 6, scrollBarMinHeight: 20, scrollBarColor: "#808BA4", scrollBarMargin: 4, scrollBarEnterAttrs: { rx: 20, ry: 3, width: 0, height: 0 }, titlePad: 2, itemGap: 5 };
    }, {}], 418: [function(e, t, r) {
      "use strict";
      var n = e("../../registry"), a = e("../../lib"), o = e("../../plot_api/plot_template"), s = e("../../plots/attributes"), i = e("./attributes"), l = e("../../plots/layout_attributes"), u2 = e("./helpers");
      t.exports = function(c, f, h) {
        var p, d = c.legend || {}, v = o.newContainer(f, "legend");
        function m(D2, I2) {
          return a.coerce(d, v, i, D2, I2);
        }
        for (var g = function(D2, I2) {
          var O2 = p._input, L2 = p;
          return a.coerce(O2, L2, s, D2, I2);
        }, x = f.font || {}, b = a.coerceFont(m, "grouptitlefont", a.extendFlat({}, x, { size: Math.round(1.1 * x.size) })), y = 0, w = false, _4 = "normal", k = 0; k < h.length; k++) (p = h[k]).visible && ((p.showlegend || p._dfltShowLegend && !(p._module && p._module.attributes && p._module.attributes.showlegend && p._module.attributes.showlegend.dflt === false)) && (y++, p.showlegend && (w = true, (n.traceIs(p, "pie-like") || p._input.showlegend === true) && y++), a.coerceFont(g, "legendgrouptitle.font", b)), (n.traceIs(p, "bar") && f.barmode === "stack" || ["tonextx", "tonexty"].indexOf(p.fill) !== -1) && (_4 = u2.isGrouped({ traceorder: _4 }) ? "grouped+reversed" : "reversed"), p.legendgroup !== void 0 && p.legendgroup !== "" && (_4 = u2.isReversed({ traceorder: _4 }) ? "reversed+grouped" : "grouped"));
        var T2 = a.coerce(c, f, l, "showlegend", w && y > 1);
        if (T2 === false && (f.legend = void 0), (T2 !== false || d.uirevision) && (m("uirevision", f.uirevision), T2 !== false)) {
          m("bgcolor", f.paper_bgcolor), m("bordercolor"), m("borderwidth");
          var A2, S2, C2, E2 = a.coerceFont(m, "font", f.font), F13 = m("orientation") === "h";
          if (F13 ? (A2 = 0, n.getComponentMethod("rangeslider", "isVisible")(c.xaxis) ? (S2 = 1.1, C2 = "bottom") : (S2 = -0.1, C2 = "top")) : (A2 = 1.02, S2 = 1, C2 = "auto"), m("traceorder", _4), u2.isGrouped(f.legend) && m("tracegroupgap"), m("itemsizing"), m("itemwidth"), m("itemclick"), m("itemdoubleclick"), m("groupclick"), m("x", A2), m("xanchor"), m("y", S2), m("yanchor", C2), m("valign"), a.noneOrAll(d, v, ["x", "y"]), m("title.text")) {
            m("title.side", F13 ? "left" : "top");
            var N2 = a.extendFlat({}, E2, { size: a.bigFont(E2.size) });
            a.coerceFont(m, "title.font", N2);
          }
        }
      };
    }, { "../../lib": 503, "../../plot_api/plot_template": 543, "../../plots/attributes": 550, "../../plots/layout_attributes": 610, "../../registry": 638, "./attributes": 416, "./helpers": 422 }], 419: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../lib"), o = e("../../plots/plots"), s = e("../../registry"), i = e("../../lib/events"), l = e("../dragelement"), u2 = e("../drawing"), c = e("../color"), f = e("../../lib/svg_text_utils"), h = e("./handle_click"), p = e("./constants"), d = e("../../constants/alignment"), v = d.LINE_SPACING, m = d.FROM_TL, g = d.FROM_BR, x = e("./get_legend_data"), b = e("./style"), y = e("./helpers");
      function w(E2, F13, N2, D2, I2) {
        var O2 = N2.data()[0][0].trace, L2 = { event: I2, node: N2.node(), curveNumber: O2.index, expandedIndex: O2._expandedIndex, data: E2.data, layout: E2.layout, frames: E2._transitionData._frames, config: E2._context, fullData: E2._fullData, fullLayout: E2._fullLayout };
        O2._group && (L2.group = O2._group), s.traceIs(O2, "pie-like") && (L2.label = N2.datum()[0].label), i.triggerHandler(E2, "plotly_legendclick", L2) !== false && (D2 === 1 ? F13._clickTimeout = setTimeout(function() {
          E2._fullLayout && h(N2, E2, D2);
        }, E2._context.doubleClickDelay) : D2 === 2 && (F13._clickTimeout && clearTimeout(F13._clickTimeout), E2._legendMouseDownTime = 0, i.triggerHandler(E2, "plotly_legenddoubleclick", L2) !== false && h(N2, E2, D2)));
      }
      function _4(E2, F13, N2) {
        var D2, I2, O2 = E2.data()[0][0], L2 = O2.trace, V2 = s.traceIs(L2, "pie-like"), W2 = !N2._inHover && F13._context.edits.legendText && !V2, X2 = N2._maxNameLength;
        O2.groupTitle ? (D2 = O2.groupTitle.text, I2 = O2.groupTitle.font) : (I2 = N2.font, N2.entries ? D2 = O2.text : (D2 = V2 ? O2.label : L2.name, L2._meta && (D2 = a.templateString(D2, L2._meta))));
        var Y2 = a.ensureSingle(E2, "text", "legendtext");
        Y2.attr("text-anchor", "start").call(u2.font, I2).text(W2 ? k(D2, X2) : D2);
        var K2 = N2.itemwidth + 2 * p.itemGap;
        f.positionText(Y2, K2, 0), W2 ? Y2.call(f.makeEditable, { gd: F13, text: D2 }).call(A2, E2, F13, N2).on("edit", function(q) {
          this.text(k(q, X2)).call(A2, E2, F13, N2);
          var re = O2.trace._fullInput || {}, R2 = {};
          if (s.hasTransform(re, "groupby")) {
            var z = s.getTransformIndices(re, "groupby"), H2 = z[z.length - 1], te = a.keyedContainer(re, "transforms[" + H2 + "].styles", "target", "value.name");
            te.set(O2.trace._group, q), R2 = te.constructUpdate();
          } else R2.name = q;
          return s.call("_guiRestyle", F13, R2, L2.index);
        }) : A2(Y2, E2, F13, N2);
      }
      function k(E2, F13) {
        var N2 = Math.max(4, F13);
        if (E2 && E2.trim().length >= N2 / 2) return E2;
        for (var D2 = N2 - (E2 = E2 || "").length; D2 > 0; D2--) E2 += " ";
        return E2;
      }
      function T2(E2, F13) {
        var N2, D2 = F13._context.doubleClickDelay, I2 = 1, O2 = a.ensureSingle(E2, "rect", "legendtoggle", function(L2) {
          F13._context.staticPlot || L2.style("cursor", "pointer").attr("pointer-events", "all"), L2.call(c.fill, "rgba(0,0,0,0)");
        });
        F13._context.staticPlot || (O2.on("mousedown", function() {
          (N2 = (/* @__PURE__ */ new Date()).getTime()) - F13._legendMouseDownTime < D2 ? I2 += 1 : (I2 = 1, F13._legendMouseDownTime = N2);
        }), O2.on("mouseup", function() {
          if (!F13._dragged && !F13._editing) {
            var L2 = F13._fullLayout.legend;
            (/* @__PURE__ */ new Date()).getTime() - F13._legendMouseDownTime > D2 && (I2 = Math.max(I2 - 1, 1)), w(F13, L2, E2, I2, n.event);
          }
        }));
      }
      function A2(E2, F13, N2, D2, I2) {
        D2._inHover && E2.attr("data-notex", true), f.convertToTspans(E2, N2, function() {
          (function(O2, L2, V2, W2) {
            var X2 = O2.data()[0][0];
            if (!V2._inHover && X2 && !X2.trace.showlegend) return void O2.remove();
            var Y2 = O2.select("g[class*=math-group]"), K2 = Y2.node();
            V2 || (V2 = L2._fullLayout.legend);
            var q, re = V2.borderwidth;
            q = W2 === 1 ? V2.title.font : X2.groupTitle ? X2.groupTitle.font : V2.font;
            var R2, z, H2 = q.size * v;
            if (K2) {
              var te = u2.bBox(K2);
              R2 = te.height, z = te.width, W2 === 1 ? u2.setTranslate(Y2, re, re + 0.75 * R2) : u2.setTranslate(Y2, 0, 0.25 * R2);
            } else {
              var j = O2.select(W2 === 1 ? ".legendtitletext" : ".legendtext"), Q2 = f.lineCount(j), Z2 = j.node();
              if (R2 = H2 * Q2, z = Z2 ? u2.bBox(Z2).width : 0, W2 === 1) V2.title.side === "left" && (z += 2 * p.itemGap), f.positionText(j, re + p.titlePad, re + H2);
              else {
                var ne = 2 * p.itemGap + V2.itemwidth;
                X2.groupTitle && (ne = p.itemGap, z -= V2.itemwidth), f.positionText(j, ne, -H2 * ((Q2 - 1) / 2 - 0.3));
              }
            }
            W2 === 1 ? (V2._titleWidth = z, V2._titleHeight = R2) : (X2.lineHeight = H2, X2.height = Math.max(R2, 16) + 3, X2.width = z);
          })(F13, N2, D2, I2);
        });
      }
      function S2(E2) {
        return a.isRightAnchor(E2) ? "right" : a.isCenterAnchor(E2) ? "center" : "left";
      }
      function C2(E2) {
        return a.isBottomAnchor(E2) ? "bottom" : a.isMiddleAnchor(E2) ? "middle" : "top";
      }
      t.exports = function(E2, F13) {
        return F13 || (F13 = E2._fullLayout.legend || {}), function(N2, D2) {
          var I2, O2, L2 = N2._fullLayout, V2 = "legend" + L2._uid, W2 = D2._inHover;
          if (W2 ? (I2 = D2.layer, V2 += "-hover") : I2 = L2._infolayer, !!I2) {
            if (N2._legendMouseDownTime || (N2._legendMouseDownTime = 0), W2) {
              if (!D2.entries) return;
              O2 = x(D2.entries, D2);
            } else {
              if (!N2.calcdata) return;
              O2 = L2.showlegend && x(N2.calcdata, D2);
            }
            var X2 = L2.hiddenlabels || [];
            if (!(W2 || L2.showlegend && O2.length)) return I2.selectAll(".legend").remove(), L2._topdefs.select("#" + V2).remove(), o.autoMargin(N2, "legend");
            var Y2 = a.ensureSingle(I2, "g", "legend", function(Q2) {
              W2 || Q2.attr("pointer-events", "all");
            }), K2 = a.ensureSingleById(L2._topdefs, "clipPath", V2, function(Q2) {
              Q2.append("rect");
            }), q = a.ensureSingle(Y2, "rect", "bg", function(Q2) {
              Q2.attr("shape-rendering", "crispEdges");
            });
            q.call(c.stroke, D2.bordercolor).call(c.fill, D2.bgcolor).style("stroke-width", D2.borderwidth + "px");
            var re = a.ensureSingle(Y2, "g", "scrollbox"), R2 = D2.title;
            if (D2._titleWidth = 0, D2._titleHeight = 0, R2.text) {
              var z = a.ensureSingle(re, "text", "legendtitletext");
              z.attr("text-anchor", "start").call(u2.font, R2.font).text(R2.text), A2(z, re, N2, D2, 1);
            } else re.selectAll(".legendtitletext").remove();
            var H2 = a.ensureSingle(Y2, "rect", "scrollbar", function(Q2) {
              Q2.attr(p.scrollBarEnterAttrs).call(c.fill, p.scrollBarColor);
            }), te = re.selectAll("g.groups").data(O2);
            te.enter().append("g").attr("class", "groups"), te.exit().remove();
            var j = te.selectAll("g.traces").data(a.identity);
            j.enter().append("g").attr("class", "traces"), j.exit().remove(), j.style("opacity", function(Q2) {
              var Z2 = Q2[0].trace;
              return s.traceIs(Z2, "pie-like") ? X2.indexOf(Q2[0].label) !== -1 ? 0.5 : 1 : Z2.visible === "legendonly" ? 0.5 : 1;
            }).each(function() {
              n.select(this).call(_4, N2, D2);
            }).call(b, N2, D2).each(function() {
              W2 || n.select(this).call(T2, N2);
            }), a.syncOrAsync([o.previousPromises, function() {
              return function(Q2, Z2, ne, ae) {
                var ue = Q2._fullLayout;
                ae || (ae = ue.legend);
                var le = ue._size, ce = y.isVertical(ae), se = y.isGrouped(ae), he = ae.borderwidth, me = 2 * he, we = p.itemGap, be = ae.itemwidth + 2 * we, Ae = 2 * (he + we), pe = C2(ae), ve = ae.y < 0 || ae.y === 0 && pe === "top", Ee = ae.y > 1 || ae.y === 1 && pe === "bottom", Se = ae.tracegroupgap;
                ae._maxHeight = Math.max(ve || Ee ? ue.height / 2 : le.h, 30);
                var Ce = 0;
                ae._width = 0, ae._height = 0;
                var Be = function(Ge) {
                  var st = 0, Ie = 0, Pe = Ge.title.side;
                  return Pe && (Pe.indexOf("left") !== -1 && (st = Ge._titleWidth), Pe.indexOf("top") !== -1 && (Ie = Ge._titleHeight)), [st, Ie];
                }(ae);
                if (ce) ne.each(function(Ge) {
                  var st = Ge[0].height;
                  u2.setTranslate(this, he + Be[0], he + Be[1] + ae._height + st / 2 + we), ae._height += st, ae._width = Math.max(ae._width, Ge[0].width);
                }), Ce = be + ae._width, ae._width += we + be + me, ae._height += Ae, se && (Z2.each(function(Ge, st) {
                  u2.setTranslate(this, 0, st * ae.tracegroupgap);
                }), ae._height += (ae._lgroupsLength - 1) * ae.tracegroupgap);
                else {
                  var Ue = S2(ae), Ke = ae.x < 0 || ae.x === 0 && Ue === "right", ct = ae.x > 1 || ae.x === 1 && Ue === "left", We = Ee || ve, Ze = ue.width / 2;
                  ae._maxWidth = Math.max(Ke ? We && Ue === "left" ? le.l + le.w : Ze : ct ? We && Ue === "right" ? le.r + le.w : Ze : le.w, 2 * be);
                  var it = 0, ot = 0;
                  ne.each(function(Ge) {
                    var st = Ge[0].width + be;
                    it = Math.max(it, st), ot += st;
                  }), Ce = null;
                  var mt = 0;
                  if (se) {
                    var wt = 0, Et = 0, zt = 0;
                    Z2.each(function() {
                      var Ge = 0, st = 0;
                      n.select(this).selectAll("g.traces").each(function(Pe) {
                        var $e = Pe[0].width, Ve = Pe[0].height;
                        u2.setTranslate(this, Be[0], Be[1] + he + we + Ve / 2 + st), st += Ve, Ge = Math.max(Ge, be + $e);
                      }), wt = Math.max(wt, st);
                      var Ie = Ge + we;
                      Et > 0 && Ie + he + Et > ae._maxWidth && (mt = Math.max(mt, Et), Et = 0, zt += wt + Se, wt = st), u2.setTranslate(this, Et, zt), Et += Ie;
                    }), ae._width = Math.max(mt, Et) + he, ae._height = zt + wt + Ae;
                  } else {
                    var Nt = ne.size(), yt = ot + me + (Nt - 1) * we < ae._maxWidth, pt = 0, Ot = 0, Jt = 0, tr = 0;
                    ne.each(function(Ge) {
                      var st = Ge[0].height, Ie = be + Ge[0].width, Pe = (yt ? Ie : it) + we;
                      Pe + he + Ot - we >= ae._maxWidth && (mt = Math.max(mt, tr), Ot = 0, Jt += pt, ae._height += pt, pt = 0), u2.setTranslate(this, Be[0] + he + Ot, Be[1] + he + Jt + st / 2 + we), tr = Ot + Ie + we, Ot += Pe, pt = Math.max(pt, st);
                    }), yt ? (ae._width = Ot + me, ae._height = pt + Ae) : (ae._width = Math.max(mt, tr) + me, ae._height += pt + Ae);
                  }
                }
                ae._width = Math.ceil(Math.max(ae._width + Be[0], ae._titleWidth + 2 * (he + p.titlePad))), ae._height = Math.ceil(Math.max(ae._height + Be[1], ae._titleHeight + 2 * (he + p.itemGap))), ae._effHeight = Math.min(ae._height, ae._maxHeight);
                var Ye = Q2._context.edits, at = Ye.legendText || Ye.legendPosition;
                ne.each(function(Ge) {
                  var st = n.select(this).select(".legendtoggle"), Ie = Ge[0].height, Pe = at ? be : Ce || be + Ge[0].width;
                  ce || (Pe += we / 2), u2.setRect(st, 0, -Ie / 2, Pe, Ie);
                });
              }(N2, te, j, D2);
            }, function() {
              var Q2, Z2, ne, ae, ue = L2._size, le = D2.borderwidth;
              if (!W2) {
                if (function(We) {
                  var Ze = We._fullLayout.legend, it = S2(Ze), ot = C2(Ze);
                  return o.autoMargin(We, "legend", { x: Ze.x, y: Ze.y, l: Ze._width * m[it], r: Ze._width * g[it], b: Ze._effHeight * g[ot], t: Ze._effHeight * m[ot] });
                }(N2)) return;
                var ce = ue.l + ue.w * D2.x - m[S2(D2)] * D2._width, se = ue.t + ue.h * (1 - D2.y) - m[C2(D2)] * D2._effHeight;
                if (L2.margin.autoexpand) {
                  var he = ce, me = se;
                  ce = a.constrain(ce, 0, L2.width - D2._width), se = a.constrain(se, 0, L2.height - D2._effHeight), ce !== he && a.log("Constrain legend.x to make legend fit inside graph"), se !== me && a.log("Constrain legend.y to make legend fit inside graph");
                }
                u2.setTranslate(Y2, ce, se);
              }
              if (H2.on(".drag", null), Y2.on("wheel", null), W2 || D2._height <= D2._maxHeight || N2._context.staticPlot) {
                var we = D2._effHeight;
                W2 && (we = D2._height), q.attr({ width: D2._width - le, height: we - le, x: le / 2, y: le / 2 }), u2.setTranslate(re, 0, 0), K2.select("rect").attr({ width: D2._width - 2 * le, height: we - 2 * le, x: le, y: le }), u2.setClipUrl(re, V2, N2), u2.setRect(H2, 0, 0, 0, 0), delete D2._scrollY;
              } else {
                var be, Ae, pe, ve = Math.max(p.scrollBarMinHeight, D2._effHeight * D2._effHeight / D2._height), Ee = D2._effHeight - ve - 2 * p.scrollBarMargin, Se = D2._height - D2._effHeight, Ce = Ee / Se, Be = Math.min(D2._scrollY || 0, Se);
                q.attr({ width: D2._width - 2 * le + p.scrollBarWidth + p.scrollBarMargin, height: D2._effHeight - le, x: le / 2, y: le / 2 }), K2.select("rect").attr({ width: D2._width - 2 * le + p.scrollBarWidth + p.scrollBarMargin, height: D2._effHeight - 2 * le, x: le, y: le + Be }), u2.setClipUrl(re, V2, N2), ct(Be, ve, Ce), Y2.on("wheel", function() {
                  ct(Be = a.constrain(D2._scrollY + n.event.deltaY / Ee * Se, 0, Se), ve, Ce), Be !== 0 && Be !== Se && n.event.preventDefault();
                });
                var Ue = n.behavior.drag().on("dragstart", function() {
                  var We = n.event.sourceEvent;
                  be = We.type === "touchstart" ? We.changedTouches[0].clientY : We.clientY, pe = Be;
                }).on("drag", function() {
                  var We = n.event.sourceEvent;
                  We.buttons === 2 || We.ctrlKey || (Ae = We.type === "touchmove" ? We.changedTouches[0].clientY : We.clientY, ct(Be = function(Ze, it, ot) {
                    var mt = (ot - it) / Ce + Ze;
                    return a.constrain(mt, 0, Se);
                  }(pe, be, Ae), ve, Ce));
                });
                H2.call(Ue);
                var Ke = n.behavior.drag().on("dragstart", function() {
                  var We = n.event.sourceEvent;
                  We.type === "touchstart" && (be = We.changedTouches[0].clientY, pe = Be);
                }).on("drag", function() {
                  var We = n.event.sourceEvent;
                  We.type === "touchmove" && (Ae = We.changedTouches[0].clientY, ct(Be = function(Ze, it, ot) {
                    var mt = (it - ot) / Ce + Ze;
                    return a.constrain(mt, 0, Se);
                  }(pe, be, Ae), ve, Ce));
                });
                re.call(Ke);
              }
              function ct(We, Ze, it) {
                D2._scrollY = N2._fullLayout.legend._scrollY = We, u2.setTranslate(re, 0, -We), u2.setRect(H2, D2._width, p.scrollBarMargin + We * it, p.scrollBarWidth, Ze), K2.select("rect").attr("y", le + We);
              }
              N2._context.edits.legendPosition && (Y2.classed("cursor-move", true), l.init({ element: Y2.node(), gd: N2, prepFn: function() {
                var We = u2.getTranslate(Y2);
                ne = We.x, ae = We.y;
              }, moveFn: function(We, Ze) {
                var it = ne + We, ot = ae + Ze;
                u2.setTranslate(Y2, it, ot), Q2 = l.align(it, 0, ue.l, ue.l + ue.w, D2.xanchor), Z2 = l.align(ot, 0, ue.t + ue.h, ue.t, D2.yanchor);
              }, doneFn: function() {
                Q2 !== void 0 && Z2 !== void 0 && s.call("_guiRelayout", N2, { "legend.x": Q2, "legend.y": Z2 });
              }, clickFn: function(We, Ze) {
                var it = I2.selectAll("g.traces").filter(function() {
                  var ot = this.getBoundingClientRect();
                  return Ze.clientX >= ot.left && Ze.clientX <= ot.right && Ze.clientY >= ot.top && Ze.clientY <= ot.bottom;
                });
                it.size() > 0 && w(N2, Y2, it, We, Ze);
              } }));
            }], N2);
          }
        }(E2, F13);
      };
    }, { "../../constants/alignment": 471, "../../lib": 503, "../../lib/events": 492, "../../lib/svg_text_utils": 529, "../../plots/plots": 619, "../../registry": 638, "../color": 366, "../dragelement": 385, "../drawing": 388, "./constants": 417, "./get_legend_data": 420, "./handle_click": 421, "./helpers": 422, "./style": 424, "@plotly/d3": 58 }], 420: [function(e, t, r) {
      "use strict";
      var n = e("../../registry"), a = e("./helpers");
      t.exports = function(o, s) {
        var i, l, u2 = s._inHover, c = a.isGrouped(s), f = a.isReversed(s), h = {}, p = [], d = false, v = {}, m = 0, g = 0;
        function x(L2, V2) {
          if (L2 !== "" && a.isGrouped(s)) p.indexOf(L2) === -1 ? (p.push(L2), d = true, h[L2] = [V2]) : h[L2].push(V2);
          else {
            var W2 = "~~i" + m;
            p.push(W2), h[W2] = [V2], m++;
          }
        }
        for (i = 0; i < o.length; i++) {
          var b = o[i], y = b[0], w = y.trace, _4 = w.legendgroup;
          if (u2 || w.visible && w.showlegend) if (n.traceIs(w, "pie-like")) for (v[_4] || (v[_4] = {}), l = 0; l < b.length; l++) {
            var k = b[l].label;
            v[_4][k] || (x(_4, { label: k, color: b[l].color, i: b[l].i, trace: w, pts: b[l].pts }), v[_4][k] = true, g = Math.max(g, (k || "").length));
          }
          else x(_4, y), g = Math.max(g, (w.name || "").length);
        }
        if (!p.length) return [];
        var T2 = !d || !c, A2 = [];
        for (i = 0; i < p.length; i++) {
          var S2 = h[p[i]];
          T2 ? A2.push(S2[0]) : A2.push(S2);
        }
        for (T2 && (A2 = [A2]), i = 0; i < A2.length; i++) {
          var C2 = 1 / 0;
          for (l = 0; l < A2[i].length; l++) {
            var E2 = A2[i][l].trace.legendrank;
            C2 > E2 && (C2 = E2);
          }
          A2[i][0]._groupMinRank = C2, A2[i][0]._preGroupSort = i;
        }
        var F13 = function(L2, V2) {
          return L2.trace.legendrank - V2.trace.legendrank || L2._preSort - V2._preSort;
        };
        for (A2.forEach(function(L2, V2) {
          L2[0]._preGroupSort = V2;
        }), A2.sort(function(L2, V2) {
          return L2[0]._groupMinRank - V2[0]._groupMinRank || L2[0]._preGroupSort - V2[0]._preGroupSort;
        }), i = 0; i < A2.length; i++) {
          A2[i].forEach(function(L2, V2) {
            L2._preSort = V2;
          }), A2[i].sort(F13);
          var N2 = A2[i][0].trace, D2 = null;
          for (l = 0; l < A2[i].length; l++) {
            var I2 = A2[i][l].trace.legendgrouptitle;
            if (I2 && I2.text) {
              D2 = I2, u2 && (I2.font = s._groupTitleFont);
              break;
            }
          }
          if (f && A2[i].reverse(), D2) {
            var O2 = false;
            for (l = 0; l < A2[i].length; l++) if (n.traceIs(A2[i][l].trace, "pie-like")) {
              O2 = true;
              break;
            }
            A2[i].unshift({ i: -1, groupTitle: D2, noClick: O2, trace: { showlegend: N2.showlegend, legendgroup: N2.legendgroup, visible: s.groupclick === "toggleitem" || N2.visible } });
          }
          for (l = 0; l < A2[i].length; l++) A2[i][l] = [A2[i][l]];
        }
        return s._lgroupsLength = A2.length, s._maxNameLength = g, A2;
      };
    }, { "../../registry": 638, "./helpers": 422 }], 421: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../registry"), o = true;
      t.exports = function(s, i, l) {
        var u2 = i._fullLayout;
        if (!i._dragged && !i._editing) {
          var c, f = u2.legend.itemclick, h = u2.legend.itemdoubleclick, p = u2.legend.groupclick;
          if (l === 1 && f === "toggle" && h === "toggleothers" && o && i.data && i._context.showTips && n.notifier(n._(i, "Double-click on legend to isolate one trace"), "long"), o = false, l === 1 ? c = f : l === 2 && (c = h), c) {
            var d = p === "togglegroup", v = u2.hiddenlabels ? u2.hiddenlabels.slice() : [], m = s.data()[0][0];
            if (!m.groupTitle || !m.noClick) {
              var g, x, b, y, w, _4 = i._fullData, k = m.trace, T2 = k.legendgroup, A2 = {}, S2 = [], C2 = [], E2 = [];
              if (a.traceIs(k, "pie-like")) {
                var F13 = m.label, N2 = v.indexOf(F13);
                c === "toggle" ? N2 === -1 ? v.push(F13) : v.splice(N2, 1) : c === "toggleothers" && (v = [], i.calcdata[0].forEach(function(H2) {
                  F13 !== H2.label && v.push(H2.label);
                }), i._fullLayout.hiddenlabels && i._fullLayout.hiddenlabels.length === v.length && N2 === -1 && (v = [])), a.call("_guiRelayout", i, "hiddenlabels", v);
              } else {
                var D2, I2 = T2 && T2.length, O2 = [];
                if (I2) for (g = 0; g < _4.length; g++) (D2 = _4[g]).visible && D2.legendgroup === T2 && O2.push(g);
                if (c === "toggle") {
                  var L2;
                  switch (k.visible) {
                    case true:
                      L2 = "legendonly";
                      break;
                    case false:
                      L2 = false;
                      break;
                    case "legendonly":
                      L2 = true;
                  }
                  if (I2) if (d) for (g = 0; g < _4.length; g++) _4[g].visible !== false && _4[g].legendgroup === T2 && z(_4[g], L2);
                  else z(k, L2);
                  else z(k, L2);
                } else if (c === "toggleothers") {
                  var V2, W2, X2, Y2, K2 = true;
                  for (g = 0; g < _4.length; g++) if (V2 = _4[g] === k, X2 = _4[g].showlegend !== true, !(V2 || X2 || (W2 = I2 && _4[g].legendgroup === T2) || _4[g].visible !== true || a.traceIs(_4[g], "notLegendIsolatable"))) {
                    K2 = false;
                    break;
                  }
                  for (g = 0; g < _4.length; g++) if (_4[g].visible !== false && !a.traceIs(_4[g], "notLegendIsolatable")) switch (k.visible) {
                    case "legendonly":
                      z(_4[g], true);
                      break;
                    case true:
                      Y2 = !!K2 || "legendonly", V2 = _4[g] === k, X2 = _4[g].showlegend !== true && !_4[g].legendgroup, W2 = V2 || I2 && _4[g].legendgroup === T2, z(_4[g], !(!W2 && !X2) || Y2);
                  }
                }
                for (g = 0; g < C2.length; g++) if (b = C2[g]) {
                  var q = b.constructUpdate(), re = Object.keys(q);
                  for (x = 0; x < re.length; x++) y = re[x], (A2[y] = A2[y] || [])[E2[g]] = q[y];
                }
                for (w = Object.keys(A2), g = 0; g < w.length; g++) for (y = w[g], x = 0; x < S2.length; x++) A2[y].hasOwnProperty(x) || (A2[y][x] = void 0);
                a.call("_guiRestyle", i, A2, S2);
              }
            }
          }
        }
        function R2(H2, te, j) {
          var Q2 = S2.indexOf(H2), Z2 = A2[te];
          return Z2 || (Z2 = A2[te] = []), S2.indexOf(H2) === -1 && (S2.push(H2), Q2 = S2.length - 1), Z2[Q2] = j, Q2;
        }
        function z(H2, te) {
          if (!m.groupTitle || d) {
            var j = H2._fullInput;
            if (a.hasTransform(j, "groupby")) {
              var Q2 = C2[j.index];
              if (!Q2) {
                var Z2 = a.getTransformIndices(j, "groupby"), ne = Z2[Z2.length - 1];
                Q2 = n.keyedContainer(j, "transforms[" + ne + "].styles", "target", "value.visible"), C2[j.index] = Q2;
              }
              var ae = Q2.get(H2._group);
              ae === void 0 && (ae = true), ae !== false && Q2.set(H2._group, te), E2[j.index] = R2(j.index, "visible", j.visible !== false);
            } else {
              var ue = j.visible !== false && te;
              R2(j.index, "visible", ue);
            }
          }
        }
      };
    }, { "../../lib": 503, "../../registry": 638 }], 422: [function(e, t, r) {
      "use strict";
      r.isGrouped = function(n) {
        return (n.traceorder || "").indexOf("grouped") !== -1;
      }, r.isVertical = function(n) {
        return n.orientation !== "h";
      }, r.isReversed = function(n) {
        return (n.traceorder || "").indexOf("reversed") !== -1;
      };
    }, {}], 423: [function(e, t, r) {
      "use strict";
      t.exports = { moduleType: "component", name: "legend", layoutAttributes: e("./attributes"), supplyLayoutDefaults: e("./defaults"), draw: e("./draw"), style: e("./style") };
    }, { "./attributes": 416, "./defaults": 418, "./draw": 419, "./style": 424 }], 424: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../registry"), o = e("../../lib"), s = o.strTranslate, i = e("../drawing"), l = e("../color"), u2 = e("../colorscale/helpers").extractOpts, c = e("../../traces/scatter/subtypes"), f = e("../../traces/pie/style_one"), h = e("../../traces/pie/helpers").castOption, p = e("./constants");
      function d(g, x) {
        return (x ? "radial" : "horizontal") + (g ? "" : "reversed");
      }
      function v(g) {
        var x = g[0].trace, b = x.contours, y = c.hasLines(x), w = c.hasMarkers(x), _4 = x.visible && x.fill && x.fill !== "none", k = false, T2 = false;
        if (b) {
          var A2 = b.coloring;
          A2 === "lines" ? k = true : y = A2 === "none" || A2 === "heatmap" || b.showlines, b.type === "constraint" ? _4 = b._operation !== "=" : A2 !== "fill" && A2 !== "heatmap" || (T2 = true);
        }
        return { showMarker: w, showLine: y, showFill: _4, showGradientLine: k, showGradientFill: T2, anyLine: y || k, anyFill: _4 || T2 };
      }
      function m(g, x, b) {
        return g && o.isArrayOrTypedArray(g) ? x : g > b ? b : g;
      }
      t.exports = function(g, x, b) {
        var y = x._fullLayout;
        b || (b = y.legend);
        var w = b.itemsizing === "constant", _4 = b.itemwidth, k = (_4 + 2 * p.itemGap) / 2, T2 = s(k, 0), A2 = function(E2, F13, N2, D2) {
          var I2;
          if (E2 + 1) I2 = E2;
          else {
            if (!(F13 && F13.width > 0)) return 0;
            I2 = F13.width;
          }
          return w ? D2 : Math.min(I2, N2);
        };
        function S2(E2, F13, N2) {
          var D2 = E2[0].trace, I2 = D2.marker || {}, O2 = I2.line || {}, L2 = N2 ? D2.visible && D2.type === N2 : a.traceIs(D2, "bar"), V2 = n.select(F13).select("g.legendpoints").selectAll("path.legend" + N2).data(L2 ? [E2] : []);
          V2.enter().append("path").classed("legend" + N2, true).attr("d", "M6,6H-6V-6H6Z").attr("transform", T2), V2.exit().remove(), V2.each(function(W2) {
            var X2 = n.select(this), Y2 = W2[0], K2 = A2(Y2.mlw, I2.line, 5, 2);
            X2.style("stroke-width", K2 + "px");
            var q = Y2.mcc;
            if (!b._inHover && "mc" in Y2) {
              var re = u2(I2), R2 = re.mid;
              R2 === void 0 && (R2 = (re.max + re.min) / 2), q = i.tryColorscale(I2, "")(R2);
            }
            var z = q || Y2.mc || I2.color, H2 = I2.pattern, te = H2 && i.getPatternAttr(H2.shape, 0, "");
            if (te) {
              var j = i.getPatternAttr(H2.bgcolor, 0, null), Q2 = i.getPatternAttr(H2.fgcolor, 0, null), Z2 = H2.fgopacity, ne = m(H2.size, 8, 10), ae = m(H2.solidity, 0.5, 1), ue = "legend-" + D2.uid;
              X2.call(i.pattern, "legend", x, ue, te, ne, ae, q, H2.fillmode, j, Q2, Z2);
            } else X2.call(l.fill, z);
            K2 && l.stroke(X2, Y2.mlc || O2.color);
          });
        }
        function C2(E2, F13, N2) {
          var D2 = E2[0], I2 = D2.trace, O2 = N2 ? I2.visible && I2.type === N2 : a.traceIs(I2, N2), L2 = n.select(F13).select("g.legendpoints").selectAll("path.legend" + N2).data(O2 ? [E2] : []);
          if (L2.enter().append("path").classed("legend" + N2, true).attr("d", "M6,6H-6V-6H6Z").attr("transform", T2), L2.exit().remove(), L2.size()) {
            var V2 = (I2.marker || {}).line, W2 = A2(h(V2.width, D2.pts), V2, 5, 2), X2 = o.minExtend(I2, { marker: { line: { width: W2 } } });
            X2.marker.line.color = V2.color;
            var Y2 = o.minExtend(D2, { trace: X2 });
            f(L2, Y2, X2);
          }
        }
        g.each(function(E2) {
          var F13 = n.select(this), N2 = o.ensureSingle(F13, "g", "layers");
          N2.style("opacity", E2[0].trace.opacity);
          var D2 = b.valign, I2 = E2[0].lineHeight, O2 = E2[0].height;
          if (D2 !== "middle" && I2 && O2) {
            var L2 = { top: 1, bottom: -1 }[D2] * (0.5 * (I2 - O2 + 3));
            N2.attr("transform", s(0, L2));
          } else N2.attr("transform", null);
          N2.selectAll("g.legendfill").data([E2]).enter().append("g").classed("legendfill", true), N2.selectAll("g.legendlines").data([E2]).enter().append("g").classed("legendlines", true);
          var V2 = N2.selectAll("g.legendsymbols").data([E2]);
          V2.enter().append("g").classed("legendsymbols", true), V2.selectAll("g.legendpoints").data([E2]).enter().append("g").classed("legendpoints", true);
        }).each(function(E2) {
          var F13, N2 = E2[0].trace, D2 = [];
          if (N2.visible) switch (N2.type) {
            case "histogram2d":
            case "heatmap":
              D2 = [["M-15,-2V4H15V-2Z"]], F13 = true;
              break;
            case "choropleth":
            case "choroplethmapbox":
              D2 = [["M-6,-6V6H6V-6Z"]], F13 = true;
              break;
            case "densitymapbox":
              D2 = [["M-6,0 a6,6 0 1,0 12,0 a 6,6 0 1,0 -12,0"]], F13 = "radial";
              break;
            case "cone":
              D2 = [["M-6,2 A2,2 0 0,0 -6,6 V6L6,4Z"], ["M-6,-6 A2,2 0 0,0 -6,-2 L6,-4Z"], ["M-6,-2 A2,2 0 0,0 -6,2 L6,0Z"]], F13 = false;
              break;
            case "streamtube":
              D2 = [["M-6,2 A2,2 0 0,0 -6,6 H6 A2,2 0 0,1 6,2 Z"], ["M-6,-6 A2,2 0 0,0 -6,-2 H6 A2,2 0 0,1 6,-6 Z"], ["M-6,-2 A2,2 0 0,0 -6,2 H6 A2,2 0 0,1 6,-2 Z"]], F13 = false;
              break;
            case "surface":
              D2 = [["M-6,-6 A2,3 0 0,0 -6,0 H6 A2,3 0 0,1 6,-6 Z"], ["M-6,1 A2,3 0 0,1 -6,6 H6 A2,3 0 0,0 6,0 Z"]], F13 = true;
              break;
            case "mesh3d":
              D2 = [["M-6,6H0L-6,-6Z"], ["M6,6H0L6,-6Z"], ["M-6,-6H6L0,6Z"]], F13 = false;
              break;
            case "volume":
              D2 = [["M-6,6H0L-6,-6Z"], ["M6,6H0L6,-6Z"], ["M-6,-6H6L0,6Z"]], F13 = true;
              break;
            case "isosurface":
              D2 = [["M-6,6H0L-6,-6Z"], ["M6,6H0L6,-6Z"], ["M-6,-6 A12,24 0 0,0 6,-6 L0,6Z"]], F13 = false;
          }
          var I2 = n.select(this).select("g.legendpoints").selectAll("path.legend3dandfriends").data(D2);
          I2.enter().append("path").classed("legend3dandfriends", true).attr("transform", T2).style("stroke-miterlimit", 1), I2.exit().remove(), I2.each(function(O2, L2) {
            var V2, W2 = n.select(this), X2 = u2(N2), Y2 = X2.colorscale, K2 = X2.reversescale;
            if (Y2) {
              if (!F13) {
                var q = Y2.length;
                V2 = L2 === 0 ? Y2[K2 ? q - 1 : 0][1] : L2 === 1 ? Y2[K2 ? 0 : q - 1][1] : Y2[Math.floor((q - 1) / 2)][1];
              }
            } else {
              var re = N2.vertexcolor || N2.facecolor || N2.color;
              V2 = o.isArrayOrTypedArray(re) ? re[L2] || re[0] : re;
            }
            W2.attr("d", O2[0]), V2 ? W2.call(l.fill, V2) : W2.call(function(R2) {
              if (R2.size()) {
                var z = "legendfill-" + N2.uid;
                i.gradient(R2, x, z, d(K2, F13 === "radial"), Y2, "fill");
              }
            });
          });
        }).each(function(E2) {
          var F13 = E2[0].trace, N2 = F13.type === "waterfall";
          if (E2[0]._distinct && N2) {
            var D2 = E2[0].trace[E2[0].dir].marker;
            return E2[0].mc = D2.color, E2[0].mlw = D2.line.width, E2[0].mlc = D2.line.color, S2(E2, this, "waterfall");
          }
          var I2 = [];
          F13.visible && N2 && (I2 = E2[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"]]);
          var O2 = n.select(this).select("g.legendpoints").selectAll("path.legendwaterfall").data(I2);
          O2.enter().append("path").classed("legendwaterfall", true).attr("transform", T2).style("stroke-miterlimit", 1), O2.exit().remove(), O2.each(function(L2) {
            var V2 = n.select(this), W2 = F13[L2[0]].marker, X2 = A2(void 0, W2.line, 5, 2);
            V2.attr("d", L2[1]).style("stroke-width", X2 + "px").call(l.fill, W2.color), X2 && V2.call(l.stroke, W2.line.color);
          });
        }).each(function(E2) {
          S2(E2, this, "funnel");
        }).each(function(E2) {
          S2(E2, this);
        }).each(function(E2) {
          var F13 = E2[0].trace, N2 = n.select(this).select("g.legendpoints").selectAll("path.legendbox").data(F13.visible && a.traceIs(F13, "box-violin") ? [E2] : []);
          N2.enter().append("path").classed("legendbox", true).attr("d", "M6,6H-6V-6H6Z").attr("transform", T2), N2.exit().remove(), N2.each(function() {
            var D2 = n.select(this);
            if (F13.boxpoints !== "all" && F13.points !== "all" || l.opacity(F13.fillcolor) !== 0 || l.opacity((F13.line || {}).color) !== 0) {
              var I2 = A2(void 0, F13.line, 5, 2);
              D2.style("stroke-width", I2 + "px").call(l.fill, F13.fillcolor), I2 && l.stroke(D2, F13.line.color);
            } else {
              var O2 = o.minExtend(F13, { marker: { size: w ? 12 : o.constrain(F13.marker.size, 2, 16), sizeref: 1, sizemin: 1, sizemode: "diameter" } });
              N2.call(i.pointStyle, O2, x);
            }
          });
        }).each(function(E2) {
          C2(E2, this, "funnelarea");
        }).each(function(E2) {
          C2(E2, this, "pie");
        }).each(function(E2) {
          var F13, N2, D2 = v(E2), I2 = D2.showFill, O2 = D2.showLine, L2 = D2.showGradientLine, V2 = D2.showGradientFill, W2 = D2.anyFill, X2 = D2.anyLine, Y2 = E2[0], K2 = Y2.trace, q = u2(K2), re = q.colorscale, R2 = q.reversescale, z = c.hasMarkers(K2) || !W2 ? "M5,0" : X2 ? "M5,-2" : "M5,-3", H2 = n.select(this), te = H2.select(".legendfill").selectAll("path").data(I2 || V2 ? [E2] : []);
          if (te.enter().append("path").classed("js-fill", true), te.exit().remove(), te.attr("d", z + "h" + _4 + "v6h-" + _4 + "z").call(I2 ? i.fillGroupStyle : function(Z2) {
            if (Z2.size()) {
              var ne = "legendfill-" + K2.uid;
              i.gradient(Z2, x, ne, d(R2), re, "fill");
            }
          }), O2 || L2) {
            var j = A2(void 0, K2.line, 10, 5);
            N2 = o.minExtend(K2, { line: { width: j } }), F13 = [o.minExtend(Y2, { trace: N2 })];
          }
          var Q2 = H2.select(".legendlines").selectAll("path").data(O2 || L2 ? [F13] : []);
          Q2.enter().append("path").classed("js-line", true), Q2.exit().remove(), Q2.attr("d", z + (L2 ? "l" + _4 + ",0.0001" : "h" + _4)).call(O2 ? i.lineGroupStyle : function(Z2) {
            if (Z2.size()) {
              var ne = "legendline-" + K2.uid;
              i.lineGroupStyle(Z2), i.gradient(Z2, x, ne, d(R2), re, "stroke");
            }
          });
        }).each(function(E2) {
          var F13, N2, D2 = v(E2), I2 = D2.anyFill, O2 = D2.anyLine, L2 = D2.showLine, V2 = D2.showMarker, W2 = E2[0], X2 = W2.trace, Y2 = !V2 && !O2 && !I2 && c.hasText(X2);
          function K2(Q2, Z2, ne, ae) {
            var ue = o.nestedProperty(X2, Q2).get(), le = o.isArrayOrTypedArray(ue) && Z2 ? Z2(ue) : ue;
            if (w && le && ae !== void 0 && (le = ae), ne) {
              if (le < ne[0]) return ne[0];
              if (le > ne[1]) return ne[1];
            }
            return le;
          }
          function q(Q2) {
            return W2._distinct && W2.index && Q2[W2.index] ? Q2[W2.index] : Q2[0];
          }
          if (V2 || Y2 || L2) {
            var re = {}, R2 = {};
            if (V2) {
              re.mc = K2("marker.color", q), re.mx = K2("marker.symbol", q), re.mo = K2("marker.opacity", o.mean, [0.2, 1]), re.mlc = K2("marker.line.color", q), re.mlw = K2("marker.line.width", o.mean, [0, 5], 2), R2.marker = { sizeref: 1, sizemin: 1, sizemode: "diameter" };
              var z = K2("marker.size", o.mean, [2, 16], 12);
              re.ms = z, R2.marker.size = z;
            }
            L2 && (R2.line = { width: K2("line.width", q, [0, 10], 5) }), Y2 && (re.tx = "Aa", re.tp = K2("textposition", q), re.ts = 10, re.tc = K2("textfont.color", q), re.tf = K2("textfont.family", q)), F13 = [o.minExtend(W2, re)], (N2 = o.minExtend(X2, R2)).selectedpoints = null, N2.texttemplate = null;
          }
          var H2 = n.select(this).select("g.legendpoints"), te = H2.selectAll("path.scatterpts").data(V2 ? F13 : []);
          te.enter().insert("path", ":first-child").classed("scatterpts", true).attr("transform", T2), te.exit().remove(), te.call(i.pointStyle, N2, x), V2 && (F13[0].mrc = 3);
          var j = H2.selectAll("g.pointtext").data(Y2 ? F13 : []);
          j.enter().append("g").classed("pointtext", true).append("text").attr("transform", T2), j.exit().remove(), j.selectAll("text").call(i.textPointStyle, N2, x);
        }).each(function(E2) {
          var F13 = E2[0].trace, N2 = n.select(this).select("g.legendpoints").selectAll("path.legendcandle").data(F13.visible && F13.type === "candlestick" ? [E2, E2] : []);
          N2.enter().append("path").classed("legendcandle", true).attr("d", function(D2, I2) {
            return I2 ? "M-15,0H-8M-8,6V-6H8Z" : "M15,0H8M8,-6V6H-8Z";
          }).attr("transform", T2).style("stroke-miterlimit", 1), N2.exit().remove(), N2.each(function(D2, I2) {
            var O2 = n.select(this), L2 = F13[I2 ? "increasing" : "decreasing"], V2 = A2(void 0, L2.line, 5, 2);
            O2.style("stroke-width", V2 + "px").call(l.fill, L2.fillcolor), V2 && l.stroke(O2, L2.line.color);
          });
        }).each(function(E2) {
          var F13 = E2[0].trace, N2 = n.select(this).select("g.legendpoints").selectAll("path.legendohlc").data(F13.visible && F13.type === "ohlc" ? [E2, E2] : []);
          N2.enter().append("path").classed("legendohlc", true).attr("d", function(D2, I2) {
            return I2 ? "M-15,0H0M-8,-6V0" : "M15,0H0M8,6V0";
          }).attr("transform", T2).style("stroke-miterlimit", 1), N2.exit().remove(), N2.each(function(D2, I2) {
            var O2 = n.select(this), L2 = F13[I2 ? "increasing" : "decreasing"], V2 = A2(void 0, L2.line, 5, 2);
            O2.style("fill", "none").call(i.dashLine, L2.line.dash, V2), V2 && l.stroke(O2, L2.line.color);
          });
        });
      };
    }, { "../../lib": 503, "../../registry": 638, "../../traces/pie/helpers": 905, "../../traces/pie/style_one": 911, "../../traces/scatter/subtypes": 951, "../color": 366, "../colorscale/helpers": 377, "../drawing": 388, "./constants": 417, "@plotly/d3": 58 }], 425: [function(e, t, r) {
      "use strict";
      e("./constants"), t.exports = { editType: "modebar", orientation: { valType: "enumerated", values: ["v", "h"], dflt: "h", editType: "modebar" }, bgcolor: { valType: "color", editType: "modebar" }, color: { valType: "color", editType: "modebar" }, activecolor: { valType: "color", editType: "modebar" }, uirevision: { valType: "any", editType: "none" }, add: { valType: "string", arrayOk: true, dflt: "", editType: "modebar" }, remove: { valType: "string", arrayOk: true, dflt: "", editType: "modebar" } };
    }, { "./constants": 427 }], 426: [function(e, t, r) {
      "use strict";
      var n = e("../../registry"), a = e("../../plots/plots"), o = e("../../plots/cartesian/axis_ids"), s = e("../../fonts/ploticon"), i = e("../shapes/draw").eraseActiveShape, l = e("../../lib"), u2 = l._, c = t.exports = {};
      function f(y, w) {
        var _4, k, T2 = w.currentTarget, A2 = T2.getAttribute("data-attr"), S2 = T2.getAttribute("data-val") || true, C2 = y._fullLayout, E2 = {}, F13 = o.list(y, null, true), N2 = C2._cartesianSpikesEnabled;
        if (A2 === "zoom") {
          var D2, I2 = S2 === "in" ? 0.5 : 2, O2 = (1 + I2) / 2, L2 = (1 - I2) / 2;
          for (k = 0; k < F13.length; k++) if (!(_4 = F13[k]).fixedrange) if (D2 = _4._name, S2 === "auto") E2[D2 + ".autorange"] = true;
          else if (S2 === "reset") {
            if (_4._rangeInitial === void 0) E2[D2 + ".autorange"] = true;
            else {
              var V2 = _4._rangeInitial.slice();
              E2[D2 + ".range[0]"] = V2[0], E2[D2 + ".range[1]"] = V2[1];
            }
            _4._showSpikeInitial !== void 0 && (E2[D2 + ".showspikes"] = _4._showSpikeInitial, N2 !== "on" || _4._showSpikeInitial || (N2 = "off"));
          } else {
            var W2 = [_4.r2l(_4.range[0]), _4.r2l(_4.range[1])], X2 = [O2 * W2[0] + L2 * W2[1], O2 * W2[1] + L2 * W2[0]];
            E2[D2 + ".range[0]"] = _4.l2r(X2[0]), E2[D2 + ".range[1]"] = _4.l2r(X2[1]);
          }
        } else A2 !== "hovermode" || S2 !== "x" && S2 !== "y" || (S2 = C2._isHoriz ? "y" : "x", T2.setAttribute("data-val", S2)), E2[A2] = S2;
        C2._cartesianSpikesEnabled = N2, n.call("_guiRelayout", y, E2);
      }
      function h(y, w) {
        for (var _4 = w.currentTarget, k = _4.getAttribute("data-attr"), T2 = _4.getAttribute("data-val") || true, A2 = y._fullLayout._subplots.gl3d || [], S2 = {}, C2 = k.split("."), E2 = 0; E2 < A2.length; E2++) S2[A2[E2] + "." + C2[1]] = T2;
        var F13 = T2 === "pan" ? T2 : "zoom";
        S2.dragmode = F13, n.call("_guiRelayout", y, S2);
      }
      function p(y, w) {
        for (var _4 = w.currentTarget.getAttribute("data-attr"), k = _4 === "resetLastSave", T2 = _4 === "resetDefault", A2 = y._fullLayout, S2 = A2._subplots.gl3d || [], C2 = {}, E2 = 0; E2 < S2.length; E2++) {
          var F13, N2 = S2[E2], D2 = N2 + ".camera", I2 = N2 + ".aspectratio", O2 = N2 + ".aspectmode", L2 = A2[N2]._scene;
          k ? (C2[D2 + ".up"] = L2.viewInitial.up, C2[D2 + ".eye"] = L2.viewInitial.eye, C2[D2 + ".center"] = L2.viewInitial.center, F13 = true) : T2 && (C2[D2 + ".up"] = null, C2[D2 + ".eye"] = null, C2[D2 + ".center"] = null, F13 = true), F13 && (C2[I2 + ".x"] = L2.viewInitial.aspectratio.x, C2[I2 + ".y"] = L2.viewInitial.aspectratio.y, C2[I2 + ".z"] = L2.viewInitial.aspectratio.z, C2[O2] = L2.viewInitial.aspectmode);
        }
        n.call("_guiRelayout", y, C2);
      }
      function d(y, w) {
        var _4 = w.currentTarget, k = _4._previousVal, T2 = y._fullLayout, A2 = T2._subplots.gl3d || [], S2 = ["xaxis", "yaxis", "zaxis"], C2 = {}, E2 = {};
        if (k) E2 = k, _4._previousVal = null;
        else {
          for (var F13 = 0; F13 < A2.length; F13++) {
            var N2 = A2[F13], D2 = T2[N2], I2 = N2 + ".hovermode";
            C2[I2] = D2.hovermode, E2[I2] = false;
            for (var O2 = 0; O2 < 3; O2++) {
              var L2 = S2[O2], V2 = N2 + "." + L2 + ".showspikes";
              E2[V2] = false, C2[V2] = D2[L2].showspikes;
            }
          }
          _4._previousVal = C2;
        }
        return E2;
      }
      function v(y, w) {
        for (var _4 = w.currentTarget, k = _4.getAttribute("data-attr"), T2 = _4.getAttribute("data-val") || true, A2 = y._fullLayout, S2 = A2._subplots.geo || [], C2 = 0; C2 < S2.length; C2++) {
          var E2 = S2[C2], F13 = A2[E2];
          if (k === "zoom") {
            var N2 = F13.projection.scale, D2 = T2 === "in" ? 2 * N2 : 0.5 * N2;
            n.call("_guiRelayout", y, E2 + ".projection.scale", D2);
          }
        }
        k === "reset" && b(y, "geo");
      }
      function m(y) {
        var w = y._fullLayout;
        return !w.hovermode && (w._has("cartesian") ? w._isHoriz ? "y" : "x" : "closest");
      }
      function g(y) {
        var w = m(y);
        n.call("_guiRelayout", y, "hovermode", w);
      }
      function x(y, w) {
        for (var _4 = w.currentTarget.getAttribute("data-val"), k = y._fullLayout, T2 = k._subplots.mapbox || [], A2 = {}, S2 = 0; S2 < T2.length; S2++) {
          var C2 = T2[S2], E2 = k[C2].zoom, F13 = _4 === "in" ? 1.05 * E2 : E2 / 1.05;
          A2[C2 + ".zoom"] = F13;
        }
        n.call("_guiRelayout", y, A2);
      }
      function b(y, w) {
        for (var _4 = y._fullLayout, k = _4._subplots[w] || [], T2 = {}, A2 = 0; A2 < k.length; A2++) for (var S2 = k[A2], C2 = _4[S2]._subplot.viewInitial, E2 = Object.keys(C2), F13 = 0; F13 < E2.length; F13++) {
          var N2 = E2[F13];
          T2[S2 + "." + N2] = C2[N2];
        }
        n.call("_guiRelayout", y, T2);
      }
      c.toImage = { name: "toImage", title: function(y) {
        var w = (y._context.toImageButtonOptions || {}).format || "png";
        return u2(y, w === "png" ? "Download plot as a png" : "Download plot");
      }, icon: s.camera, click: function(y) {
        var w = y._context.toImageButtonOptions, _4 = { format: w.format || "png" };
        l.notifier(u2(y, "Taking snapshot - this may take a few seconds"), "long"), _4.format !== "svg" && l.isIE() && (l.notifier(u2(y, "IE only supports svg.  Changing format to svg."), "long"), _4.format = "svg"), ["filename", "width", "height", "scale"].forEach(function(k) {
          k in w && (_4[k] = w[k]);
        }), n.call("downloadImage", y, _4).then(function(k) {
          l.notifier(u2(y, "Snapshot succeeded") + " - " + k, "long");
        }).catch(function() {
          l.notifier(u2(y, "Sorry, there was a problem downloading your snapshot!"), "long");
        });
      } }, c.sendDataToCloud = { name: "sendDataToCloud", title: function(y) {
        return u2(y, "Edit in Chart Studio");
      }, icon: s.disk, click: function(y) {
        a.sendDataToCloud(y);
      } }, c.editInChartStudio = { name: "editInChartStudio", title: function(y) {
        return u2(y, "Edit in Chart Studio");
      }, icon: s.pencil, click: function(y) {
        a.sendDataToCloud(y);
      } }, c.zoom2d = { name: "zoom2d", _cat: "zoom", title: function(y) {
        return u2(y, "Zoom");
      }, attr: "dragmode", val: "zoom", icon: s.zoombox, click: f }, c.pan2d = { name: "pan2d", _cat: "pan", title: function(y) {
        return u2(y, "Pan");
      }, attr: "dragmode", val: "pan", icon: s.pan, click: f }, c.select2d = { name: "select2d", _cat: "select", title: function(y) {
        return u2(y, "Box Select");
      }, attr: "dragmode", val: "select", icon: s.selectbox, click: f }, c.lasso2d = { name: "lasso2d", _cat: "lasso", title: function(y) {
        return u2(y, "Lasso Select");
      }, attr: "dragmode", val: "lasso", icon: s.lasso, click: f }, c.drawclosedpath = { name: "drawclosedpath", title: function(y) {
        return u2(y, "Draw closed freeform");
      }, attr: "dragmode", val: "drawclosedpath", icon: s.drawclosedpath, click: f }, c.drawopenpath = { name: "drawopenpath", title: function(y) {
        return u2(y, "Draw open freeform");
      }, attr: "dragmode", val: "drawopenpath", icon: s.drawopenpath, click: f }, c.drawline = { name: "drawline", title: function(y) {
        return u2(y, "Draw line");
      }, attr: "dragmode", val: "drawline", icon: s.drawline, click: f }, c.drawrect = { name: "drawrect", title: function(y) {
        return u2(y, "Draw rectangle");
      }, attr: "dragmode", val: "drawrect", icon: s.drawrect, click: f }, c.drawcircle = { name: "drawcircle", title: function(y) {
        return u2(y, "Draw circle");
      }, attr: "dragmode", val: "drawcircle", icon: s.drawcircle, click: f }, c.eraseshape = { name: "eraseshape", title: function(y) {
        return u2(y, "Erase active shape");
      }, icon: s.eraseshape, click: i }, c.zoomIn2d = { name: "zoomIn2d", _cat: "zoomin", title: function(y) {
        return u2(y, "Zoom in");
      }, attr: "zoom", val: "in", icon: s.zoom_plus, click: f }, c.zoomOut2d = { name: "zoomOut2d", _cat: "zoomout", title: function(y) {
        return u2(y, "Zoom out");
      }, attr: "zoom", val: "out", icon: s.zoom_minus, click: f }, c.autoScale2d = { name: "autoScale2d", _cat: "autoscale", title: function(y) {
        return u2(y, "Autoscale");
      }, attr: "zoom", val: "auto", icon: s.autoscale, click: f }, c.resetScale2d = { name: "resetScale2d", _cat: "resetscale", title: function(y) {
        return u2(y, "Reset axes");
      }, attr: "zoom", val: "reset", icon: s.home, click: f }, c.hoverClosestCartesian = { name: "hoverClosestCartesian", _cat: "hoverclosest", title: function(y) {
        return u2(y, "Show closest data on hover");
      }, attr: "hovermode", val: "closest", icon: s.tooltip_basic, gravity: "ne", click: f }, c.hoverCompareCartesian = { name: "hoverCompareCartesian", _cat: "hoverCompare", title: function(y) {
        return u2(y, "Compare data on hover");
      }, attr: "hovermode", val: function(y) {
        return y._fullLayout._isHoriz ? "y" : "x";
      }, icon: s.tooltip_compare, gravity: "ne", click: f }, c.zoom3d = { name: "zoom3d", _cat: "zoom", title: function(y) {
        return u2(y, "Zoom");
      }, attr: "scene.dragmode", val: "zoom", icon: s.zoombox, click: h }, c.pan3d = { name: "pan3d", _cat: "pan", title: function(y) {
        return u2(y, "Pan");
      }, attr: "scene.dragmode", val: "pan", icon: s.pan, click: h }, c.orbitRotation = { name: "orbitRotation", title: function(y) {
        return u2(y, "Orbital rotation");
      }, attr: "scene.dragmode", val: "orbit", icon: s["3d_rotate"], click: h }, c.tableRotation = { name: "tableRotation", title: function(y) {
        return u2(y, "Turntable rotation");
      }, attr: "scene.dragmode", val: "turntable", icon: s["z-axis"], click: h }, c.resetCameraDefault3d = { name: "resetCameraDefault3d", _cat: "resetCameraDefault", title: function(y) {
        return u2(y, "Reset camera to default");
      }, attr: "resetDefault", icon: s.home, click: p }, c.resetCameraLastSave3d = { name: "resetCameraLastSave3d", _cat: "resetCameraLastSave", title: function(y) {
        return u2(y, "Reset camera to last save");
      }, attr: "resetLastSave", icon: s.movie, click: p }, c.hoverClosest3d = { name: "hoverClosest3d", _cat: "hoverclosest", title: function(y) {
        return u2(y, "Toggle show closest data on hover");
      }, attr: "hovermode", val: null, toggle: true, icon: s.tooltip_basic, gravity: "ne", click: function(y, w) {
        var _4 = d(y, w);
        n.call("_guiRelayout", y, _4);
      } }, c.zoomInGeo = { name: "zoomInGeo", _cat: "zoomin", title: function(y) {
        return u2(y, "Zoom in");
      }, attr: "zoom", val: "in", icon: s.zoom_plus, click: v }, c.zoomOutGeo = { name: "zoomOutGeo", _cat: "zoomout", title: function(y) {
        return u2(y, "Zoom out");
      }, attr: "zoom", val: "out", icon: s.zoom_minus, click: v }, c.resetGeo = { name: "resetGeo", _cat: "reset", title: function(y) {
        return u2(y, "Reset");
      }, attr: "reset", val: null, icon: s.autoscale, click: v }, c.hoverClosestGeo = { name: "hoverClosestGeo", _cat: "hoverclosest", title: function(y) {
        return u2(y, "Toggle show closest data on hover");
      }, attr: "hovermode", val: null, toggle: true, icon: s.tooltip_basic, gravity: "ne", click: g }, c.hoverClosestGl2d = { name: "hoverClosestGl2d", _cat: "hoverclosest", title: function(y) {
        return u2(y, "Toggle show closest data on hover");
      }, attr: "hovermode", val: null, toggle: true, icon: s.tooltip_basic, gravity: "ne", click: g }, c.hoverClosestPie = { name: "hoverClosestPie", _cat: "hoverclosest", title: function(y) {
        return u2(y, "Toggle show closest data on hover");
      }, attr: "hovermode", val: "closest", icon: s.tooltip_basic, gravity: "ne", click: g }, c.resetViewSankey = { name: "resetSankeyGroup", title: function(y) {
        return u2(y, "Reset view");
      }, icon: s.home, click: function(y) {
        for (var w = { "node.groups": [], "node.x": [], "node.y": [] }, _4 = 0; _4 < y._fullData.length; _4++) {
          var k = y._fullData[_4]._viewInitial;
          w["node.groups"].push(k.node.groups.slice()), w["node.x"].push(k.node.x.slice()), w["node.y"].push(k.node.y.slice());
        }
        n.call("restyle", y, w);
      } }, c.toggleHover = { name: "toggleHover", title: function(y) {
        return u2(y, "Toggle show closest data on hover");
      }, attr: "hovermode", val: null, toggle: true, icon: s.tooltip_basic, gravity: "ne", click: function(y, w) {
        var _4 = d(y, w);
        _4.hovermode = m(y), n.call("_guiRelayout", y, _4);
      } }, c.resetViews = { name: "resetViews", title: function(y) {
        return u2(y, "Reset views");
      }, icon: s.home, click: function(y, w) {
        var _4 = w.currentTarget;
        _4.setAttribute("data-attr", "zoom"), _4.setAttribute("data-val", "reset"), f(y, w), _4.setAttribute("data-attr", "resetLastSave"), p(y, w), b(y, "geo"), b(y, "mapbox");
      } }, c.toggleSpikelines = { name: "toggleSpikelines", title: function(y) {
        return u2(y, "Toggle Spike Lines");
      }, icon: s.spikeline, attr: "_cartesianSpikesEnabled", val: "on", click: function(y) {
        var w = y._fullLayout, _4 = w._cartesianSpikesEnabled;
        w._cartesianSpikesEnabled = _4 === "on" ? "off" : "on", n.call("_guiRelayout", y, function(k) {
          for (var T2 = k._fullLayout._cartesianSpikesEnabled === "on", A2 = o.list(k, null, true), S2 = {}, C2 = 0; C2 < A2.length; C2++) {
            var E2 = A2[C2];
            S2[E2._name + ".showspikes"] = !!T2 || E2._showSpikeInitial;
          }
          return S2;
        }(y));
      } }, c.resetViewMapbox = { name: "resetViewMapbox", _cat: "resetView", title: function(y) {
        return u2(y, "Reset view");
      }, attr: "reset", icon: s.home, click: function(y) {
        b(y, "mapbox");
      } }, c.zoomInMapbox = { name: "zoomInMapbox", _cat: "zoomin", title: function(y) {
        return u2(y, "Zoom in");
      }, attr: "zoom", val: "in", icon: s.zoom_plus, click: x }, c.zoomOutMapbox = { name: "zoomOutMapbox", _cat: "zoomout", title: function(y) {
        return u2(y, "Zoom out");
      }, attr: "zoom", val: "out", icon: s.zoom_minus, click: x };
    }, { "../../fonts/ploticon": 482, "../../lib": 503, "../../plots/cartesian/axis_ids": 558, "../../plots/plots": 619, "../../registry": 638, "../shapes/draw": 450 }], 427: [function(e, t, r) {
      "use strict";
      var n = e("./buttons"), a = Object.keys(n), o = ["drawline", "drawopenpath", "drawclosedpath", "drawcircle", "drawrect", "eraseshape"], s = ["v1hovermode", "hoverclosest", "hovercompare", "togglehover", "togglespikelines"].concat(o), i = [];
      a.forEach(function(l) {
        (function(u2) {
          if (s.indexOf(u2._cat || u2.name) === -1) {
            var c = u2.name, f = (u2._cat || u2.name).toLowerCase();
            i.indexOf(c) === -1 && i.push(c), i.indexOf(f) === -1 && i.push(f);
          }
        })(n[l]);
      }), i.sort(), t.exports = { DRAW_MODES: o, backButtons: s, foreButtons: i };
    }, { "./buttons": 426 }], 428: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../color"), o = e("../../plot_api/plot_template"), s = e("./attributes");
      t.exports = function(i, l) {
        var u2 = i.modebar || {}, c = o.newContainer(l, "modebar");
        function f(p, d) {
          return n.coerce(u2, c, s, p, d);
        }
        f("orientation"), f("bgcolor", a.addOpacity(l.paper_bgcolor, 0.5));
        var h = a.contrast(a.rgb(l.modebar.bgcolor));
        f("color", a.addOpacity(h, 0.3)), f("activecolor", a.addOpacity(h, 0.7)), f("uirevision", l.uirevision), f("add"), f("remove");
      };
    }, { "../../lib": 503, "../../plot_api/plot_template": 543, "../color": 366, "./attributes": 425 }], 429: [function(e, t, r) {
      "use strict";
      t.exports = { moduleType: "component", name: "modebar", layoutAttributes: e("./attributes"), supplyLayoutDefaults: e("./defaults"), manage: e("./manage") };
    }, { "./attributes": 425, "./defaults": 428, "./manage": 430 }], 430: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/cartesian/axis_ids"), a = e("../../traces/scatter/subtypes"), o = e("../../registry"), s = e("../fx/helpers").isUnifiedHover, i = e("./modebar"), l = e("./buttons"), u2 = e("./constants").DRAW_MODES;
      t.exports = function(c) {
        var f = c._fullLayout, h = c._context, p = f._modeBar;
        if (h.displayModeBar || h.watermark) {
          if (!Array.isArray(h.modeBarButtonsToRemove)) throw new Error(["*modeBarButtonsToRemove* configuration options", "must be an array."].join(" "));
          if (!Array.isArray(h.modeBarButtonsToAdd)) throw new Error(["*modeBarButtonsToAdd* configuration options", "must be an array."].join(" "));
          var d, v = h.modeBarButtons;
          d = Array.isArray(v) && v.length ? function(m) {
            for (var g = 0; g < m.length; g++) for (var x = m[g], b = 0; b < x.length; b++) {
              var y = x[b];
              if (typeof y == "string") {
                if (l[y] === void 0) throw new Error(["*modeBarButtons* configuration options", "invalid button name"].join(" "));
                m[g][b] = l[y];
              }
            }
            return m;
          }(v) : !h.displayModeBar && h.watermark ? [] : function(m) {
            var g = m._fullLayout, x = m._fullData, b = m._context;
            function y(ae, ue) {
              if (typeof ue == "string") {
                if (ue.toLowerCase() === ae.toLowerCase()) return true;
              } else {
                var le = ue.name, ce = ue._cat || ue.name;
                if (le === ae || ce === ae.toLowerCase()) return true;
              }
              return false;
            }
            var w = g.modebar.add;
            typeof w == "string" && (w = [w]);
            var _4 = g.modebar.remove;
            typeof _4 == "string" && (_4 = [_4]);
            var k = b.modeBarButtonsToAdd.concat(w.filter(function(ae) {
              for (var ue = 0; ue < b.modeBarButtonsToRemove.length; ue++) if (y(ae, b.modeBarButtonsToRemove[ue])) return false;
              return true;
            })), T2 = b.modeBarButtonsToRemove.concat(_4.filter(function(ae) {
              for (var ue = 0; ue < b.modeBarButtonsToAdd.length; ue++) if (y(ae, b.modeBarButtonsToAdd[ue])) return false;
              return true;
            })), A2 = g._has("cartesian"), S2 = g._has("gl3d"), C2 = g._has("geo"), E2 = g._has("pie"), F13 = g._has("funnelarea"), N2 = g._has("gl2d"), D2 = g._has("ternary"), I2 = g._has("mapbox"), O2 = g._has("polar"), L2 = g._has("smith"), V2 = g._has("sankey"), W2 = function(ae) {
              for (var ue = n.list({ _fullLayout: ae }, null, true), le = 0; le < ue.length; le++) if (!ue[le].fixedrange) return false;
              return true;
            }(g), X2 = s(g.hovermode), Y2 = [];
            function K2(ae) {
              if (ae.length) {
                for (var ue = [], le = 0; le < ae.length; le++) {
                  for (var ce = ae[le], se = l[ce], he = se.name.toLowerCase(), me = (se._cat || se.name).toLowerCase(), we = false, be = 0; be < T2.length; be++) {
                    var Ae = T2[be].toLowerCase();
                    if (Ae === he || Ae === me) {
                      we = true;
                      break;
                    }
                  }
                  we || ue.push(l[ce]);
                }
                Y2.push(ue);
              }
            }
            var q = ["toImage"];
            b.showEditInChartStudio ? q.push("editInChartStudio") : b.showSendToCloud && q.push("sendDataToCloud"), K2(q);
            var re = [], R2 = [], z = [], H2 = [];
            (A2 || N2 || E2 || F13 || D2) + C2 + S2 + I2 + O2 + L2 > 1 ? (R2 = ["toggleHover"], z = ["resetViews"]) : C2 ? (re = ["zoomInGeo", "zoomOutGeo"], R2 = ["hoverClosestGeo"], z = ["resetGeo"]) : S2 ? (R2 = ["hoverClosest3d"], z = ["resetCameraDefault3d", "resetCameraLastSave3d"]) : I2 ? (re = ["zoomInMapbox", "zoomOutMapbox"], R2 = ["toggleHover"], z = ["resetViewMapbox"]) : N2 ? R2 = ["hoverClosestGl2d"] : E2 ? R2 = ["hoverClosestPie"] : V2 ? (R2 = ["hoverClosestCartesian", "hoverCompareCartesian"], z = ["resetViewSankey"]) : R2 = ["toggleHover"], A2 && (R2 = ["toggleSpikelines", "hoverClosestCartesian", "hoverCompareCartesian"]), (function(ae) {
              for (var ue = 0; ue < ae.length; ue++) if (!o.traceIs(ae[ue], "noHover")) return false;
              return true;
            }(x) || X2) && (R2 = []), !A2 && !N2 || W2 || (re = ["zoomIn2d", "zoomOut2d", "autoScale2d"], z[0] !== "resetViews" && (z = ["resetScale2d"])), S2 ? H2 = ["zoom3d", "pan3d", "orbitRotation", "tableRotation"] : (A2 || N2) && !W2 || D2 ? H2 = ["zoom2d", "pan2d"] : I2 || C2 ? H2 = ["pan2d"] : O2 && (H2 = ["zoom2d"]), function(ae) {
              for (var ue = false, le = 0; le < ae.length && !ue; le++) {
                var ce = ae[le];
                ce._module && ce._module.selectPoints && (o.traceIs(ce, "scatter-like") ? (a.hasMarkers(ce) || a.hasText(ce)) && (ue = true) : o.traceIs(ce, "box-violin") && ce.boxpoints !== "all" && ce.points !== "all" || (ue = true));
              }
              return ue;
            }(x) && H2.push("select2d", "lasso2d");
            var te = [], j = function(ae) {
              te.indexOf(ae) === -1 && R2.indexOf(ae) !== -1 && te.push(ae);
            };
            if (Array.isArray(k)) {
              for (var Q2 = [], Z2 = 0; Z2 < k.length; Z2++) {
                var ne = k[Z2];
                typeof ne == "string" ? (ne = ne.toLowerCase(), u2.indexOf(ne) !== -1 ? (g._has("mapbox") || g._has("cartesian")) && H2.push(ne) : ne === "togglespikelines" ? j("toggleSpikelines") : ne === "togglehover" ? j("toggleHover") : ne === "hovercompare" ? j("hoverCompareCartesian") : ne === "hoverclosest" ? (j("hoverClosestCartesian"), j("hoverClosestGeo"), j("hoverClosest3d"), j("hoverClosestGl2d"), j("hoverClosestPie")) : ne === "v1hovermode" && (j("toggleHover"), j("hoverClosestCartesian"), j("hoverCompareCartesian"), j("hoverClosestGeo"), j("hoverClosest3d"), j("hoverClosestGl2d"), j("hoverClosestPie"))) : Q2.push(ne);
              }
              k = Q2;
            }
            return K2(H2), K2(re.concat(z)), K2(te), function(ae, ue) {
              if (ue.length) if (Array.isArray(ue[0])) for (var le = 0; le < ue.length; le++) ae.push(ue[le]);
              else ae.push(ue);
              return ae;
            }(Y2, k);
          }(c), p ? p.update(c, d) : f._modeBar = i(c, d);
        } else p && (p.destroy(), delete f._modeBar);
      };
    }, { "../../plots/cartesian/axis_ids": 558, "../../registry": 638, "../../traces/scatter/subtypes": 951, "../fx/helpers": 402, "./buttons": 426, "./constants": 427, "./modebar": 431 }], 431: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("fast-isnumeric"), o = e("../../lib"), s = e("../../fonts/ploticon"), i = new DOMParser();
      function l(c) {
        this.container = c.container, this.element = document.createElement("div"), this.update(c.graphInfo, c.buttons), this.container.appendChild(this.element);
      }
      var u2 = l.prototype;
      u2.update = function(c, f) {
        this.graphInfo = c;
        var h = this.graphInfo._context, p = this.graphInfo._fullLayout, d = "modebar-" + p._uid;
        this.element.setAttribute("id", d), this._uid = d, this.element.className = "modebar", h.displayModeBar === "hover" && (this.element.className += " modebar--hover ease-bg"), p.modebar.orientation === "v" && (this.element.className += " vertical", f = f.reverse());
        var v = p.modebar, m = h.displayModeBar === "hover" ? ".js-plotly-plot .plotly:hover " : "";
        o.deleteRelatedStyleRule(d), o.addRelatedStyleRule(d, m + "#" + d + " .modebar-group", "background-color: " + v.bgcolor), o.addRelatedStyleRule(d, "#" + d + " .modebar-btn .icon path", "fill: " + v.color), o.addRelatedStyleRule(d, "#" + d + " .modebar-btn:hover .icon path", "fill: " + v.activecolor), o.addRelatedStyleRule(d, "#" + d + " .modebar-btn.active .icon path", "fill: " + v.activecolor);
        var g = !this.hasButtons(f), x = this.hasLogo !== h.displaylogo, b = this.locale !== h.locale;
        if (this.locale = h.locale, (g || x || b) && (this.removeAllButtons(), this.updateButtons(f), h.watermark || h.displaylogo)) {
          var y = this.getLogo();
          h.watermark && (y.className = y.className + " watermark"), p.modebar.orientation === "v" ? this.element.insertBefore(y, this.element.childNodes[0]) : this.element.appendChild(y), this.hasLogo = true;
        }
        this.updateActiveButton();
      }, u2.updateButtons = function(c) {
        var f = this;
        this.buttons = c, this.buttonElements = [], this.buttonsNames = [], this.buttons.forEach(function(h) {
          var p = f.createGroup();
          h.forEach(function(d) {
            var v = d.name;
            if (!v) throw new Error("must provide button 'name' in button config");
            if (f.buttonsNames.indexOf(v) !== -1) throw new Error("button name '" + v + "' is taken");
            f.buttonsNames.push(v);
            var m = f.createButton(d);
            f.buttonElements.push(m), p.appendChild(m);
          }), f.element.appendChild(p);
        });
      }, u2.createGroup = function() {
        var c = document.createElement("div");
        return c.className = "modebar-group", c;
      }, u2.createButton = function(c) {
        var f = this, h = document.createElement("a");
        h.setAttribute("rel", "tooltip"), h.className = "modebar-btn";
        var p = c.title;
        p === void 0 ? p = c.name : typeof p == "function" && (p = p(this.graphInfo)), (p || p === 0) && h.setAttribute("data-title", p), c.attr !== void 0 && h.setAttribute("data-attr", c.attr);
        var d = c.val;
        if (d !== void 0 && (typeof d == "function" && (d = d(this.graphInfo)), h.setAttribute("data-val", d)), typeof c.click != "function") throw new Error("must provide button 'click' function in button config");
        h.addEventListener("click", function(m) {
          c.click(f.graphInfo, m), f.updateActiveButton(m.currentTarget);
        }), h.setAttribute("data-toggle", c.toggle || false), c.toggle && n.select(h).classed("active", true);
        var v = c.icon;
        return typeof v == "function" ? h.appendChild(v()) : h.appendChild(this.createIcon(v || s.question)), h.setAttribute("data-gravity", c.gravity || "n"), h;
      }, u2.createIcon = function(c) {
        var f, h = a(c.height) ? Number(c.height) : c.ascent - c.descent, p = "http://www.w3.org/2000/svg";
        if (c.path) {
          (f = document.createElementNS(p, "svg")).setAttribute("viewBox", [0, 0, c.width, h].join(" ")), f.setAttribute("class", "icon");
          var d = document.createElementNS(p, "path");
          d.setAttribute("d", c.path), c.transform ? d.setAttribute("transform", c.transform) : c.ascent !== void 0 && d.setAttribute("transform", "matrix(1 0 0 -1 0 " + c.ascent + ")"), f.appendChild(d);
        }
        return c.svg && (f = i.parseFromString(c.svg, "application/xml").childNodes[0]), f.setAttribute("height", "1em"), f.setAttribute("width", "1em"), f;
      }, u2.updateActiveButton = function(c) {
        var f = this.graphInfo._fullLayout, h = c !== void 0 ? c.getAttribute("data-attr") : null;
        this.buttonElements.forEach(function(p) {
          var d = p.getAttribute("data-val") || true, v = p.getAttribute("data-attr"), m = p.getAttribute("data-toggle") === "true", g = n.select(p);
          if (m) v === h && g.classed("active", !g.classed("active"));
          else {
            var x = v === null ? v : o.nestedProperty(f, v).get();
            g.classed("active", x === d);
          }
        });
      }, u2.hasButtons = function(c) {
        var f = this.buttons;
        if (!f || c.length !== f.length) return false;
        for (var h = 0; h < c.length; ++h) {
          if (c[h].length !== f[h].length) return false;
          for (var p = 0; p < c[h].length; p++) if (c[h][p].name !== f[h][p].name) return false;
        }
        return true;
      }, u2.getLogo = function() {
        var c = this.createGroup(), f = document.createElement("a");
        return f.href = "https://plotly.com/", f.target = "_blank", f.setAttribute("data-title", o._(this.graphInfo, "Produced with Plotly")), f.className = "modebar-btn plotlyjsicon modebar-btn--logo", f.appendChild(this.createIcon(s.newplotlylogo)), c.appendChild(f), c;
      }, u2.removeAllButtons = function() {
        for (; this.element.firstChild; ) this.element.removeChild(this.element.firstChild);
        this.hasLogo = false;
      }, u2.destroy = function() {
        o.removeElement(this.container.querySelector(".modebar")), o.deleteRelatedStyleRule(this._uid);
      }, t.exports = function(c, f) {
        var h = c._fullLayout, p = new l({ graphInfo: c, container: h._modebardiv.node(), buttons: f });
        return h._privateplot && n.select(p.element).append("span").classed("badge-private float--left", true).text("PRIVATE"), p;
      };
    }, { "../../fonts/ploticon": 482, "../../lib": 503, "@plotly/d3": 58, "fast-isnumeric": 190 }], 432: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/font_attributes"), a = e("../color/attributes"), o = (0, e("../../plot_api/plot_template").templatedArray)("button", { visible: { valType: "boolean", dflt: true, editType: "plot" }, step: { valType: "enumerated", values: ["month", "year", "day", "hour", "minute", "second", "all"], dflt: "month", editType: "plot" }, stepmode: { valType: "enumerated", values: ["backward", "todate"], dflt: "backward", editType: "plot" }, count: { valType: "number", min: 0, dflt: 1, editType: "plot" }, label: { valType: "string", editType: "plot" }, editType: "plot" });
      t.exports = { visible: { valType: "boolean", editType: "plot" }, buttons: o, x: { valType: "number", min: -2, max: 3, editType: "plot" }, xanchor: { valType: "enumerated", values: ["auto", "left", "center", "right"], dflt: "left", editType: "plot" }, y: { valType: "number", min: -2, max: 3, editType: "plot" }, yanchor: { valType: "enumerated", values: ["auto", "top", "middle", "bottom"], dflt: "bottom", editType: "plot" }, font: n({ editType: "plot" }), bgcolor: { valType: "color", dflt: a.lightLine, editType: "plot" }, activecolor: { valType: "color", editType: "plot" }, bordercolor: { valType: "color", dflt: a.defaultLine, editType: "plot" }, borderwidth: { valType: "number", min: 0, dflt: 0, editType: "plot" }, editType: "plot" };
    }, { "../../plot_api/plot_template": 543, "../../plots/font_attributes": 585, "../color/attributes": 365 }], 433: [function(e, t, r) {
      "use strict";
      t.exports = { yPad: 0.02, minButtonWidth: 30, rx: 3, ry: 3, lightAmount: 25, darkAmount: 10 };
    }, {}], 434: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../color"), o = e("../../plot_api/plot_template"), s = e("../../plots/array_container_defaults"), i = e("./attributes"), l = e("./constants");
      function u2(c, f, h, p) {
        var d = p.calendar;
        function v(g, x) {
          return n.coerce(c, f, i.buttons, g, x);
        }
        if (v("visible")) {
          var m = v("step");
          m !== "all" && (!d || d === "gregorian" || m !== "month" && m !== "year" ? v("stepmode") : f.stepmode = "backward", v("count")), v("label");
        }
      }
      t.exports = function(c, f, h, p, d) {
        var v = c.rangeselector || {}, m = o.newContainer(f, "rangeselector");
        function g(y, w) {
          return n.coerce(v, m, i, y, w);
        }
        if (g("visible", s(v, m, { name: "buttons", handleItemDefaults: u2, calendar: d }).length > 0)) {
          var x = function(y, w, _4) {
            for (var k = _4.filter(function(C2) {
              return w[C2].anchor === y._id;
            }), T2 = 0, A2 = 0; A2 < k.length; A2++) {
              var S2 = w[k[A2]].domain;
              S2 && (T2 = Math.max(S2[1], T2));
            }
            return [y.domain[0], T2 + l.yPad];
          }(f, h, p);
          g("x", x[0]), g("y", x[1]), n.noneOrAll(c, f, ["x", "y"]), g("xanchor"), g("yanchor"), n.coerceFont(g, "font", h.font);
          var b = g("bgcolor");
          g("activecolor", a.contrast(b, l.lightAmount, l.darkAmount)), g("bordercolor"), g("borderwidth");
        }
      };
    }, { "../../lib": 503, "../../plot_api/plot_template": 543, "../../plots/array_container_defaults": 549, "../color": 366, "./attributes": 432, "./constants": 433 }], 435: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../registry"), o = e("../../plots/plots"), s = e("../color"), i = e("../drawing"), l = e("../../lib"), u2 = l.strTranslate, c = e("../../lib/svg_text_utils"), f = e("../../plots/cartesian/axis_ids"), h = e("../../constants/alignment"), p = h.LINE_SPACING, d = h.FROM_TL, v = h.FROM_BR, m = e("./constants"), g = e("./get_update_object");
      function x(w) {
        return w._id;
      }
      function b(w, _4, k) {
        var T2 = l.ensureSingle(w, "rect", "selector-rect", function(A2) {
          A2.attr("shape-rendering", "crispEdges");
        });
        T2.attr({ rx: m.rx, ry: m.ry }), T2.call(s.stroke, _4.bordercolor).call(s.fill, function(A2, S2) {
          return S2._isActive || S2._isHovered ? A2.activecolor : A2.bgcolor;
        }(_4, k)).style("stroke-width", _4.borderwidth + "px");
      }
      function y(w, _4, k, T2) {
        l.ensureSingle(w, "text", "selector-text", function(A2) {
          A2.attr("text-anchor", "middle");
        }).call(i.font, _4.font).text(function(A2, S2) {
          return A2.label ? S2 ? l.templateString(A2.label, S2) : A2.label : A2.step === "all" ? "all" : A2.count + A2.step.charAt(0);
        }(k, T2._fullLayout._meta)).call(function(A2) {
          c.convertToTspans(A2, T2);
        });
      }
      t.exports = function(w) {
        var _4 = w._fullLayout._infolayer.selectAll(".rangeselector").data(function(k) {
          for (var T2 = f.list(k, "x", true), A2 = [], S2 = 0; S2 < T2.length; S2++) {
            var C2 = T2[S2];
            C2.rangeselector && C2.rangeselector.visible && A2.push(C2);
          }
          return A2;
        }(w), x);
        _4.enter().append("g").classed("rangeselector", true), _4.exit().remove(), _4.style({ cursor: "pointer", "pointer-events": "all" }), _4.each(function(k) {
          var T2 = n.select(this), A2 = k, S2 = A2.rangeselector, C2 = T2.selectAll("g.button").data(l.filterVisible(S2.buttons));
          C2.enter().append("g").classed("button", true), C2.exit().remove(), C2.each(function(E2) {
            var F13 = n.select(this), N2 = g(A2, E2);
            E2._isActive = function(D2, I2, O2) {
              if (I2.step === "all") return D2.autorange === true;
              var L2 = Object.keys(O2);
              return D2.range[0] === O2[L2[0]] && D2.range[1] === O2[L2[1]];
            }(A2, E2, N2), F13.call(b, S2, E2), F13.call(y, S2, E2, w), F13.on("click", function() {
              w._dragged || a.call("_guiRelayout", w, N2);
            }), F13.on("mouseover", function() {
              E2._isHovered = true, F13.call(b, S2, E2);
            }), F13.on("mouseout", function() {
              E2._isHovered = false, F13.call(b, S2, E2);
            });
          }), function(E2, F13, N2, D2, I2) {
            var O2 = 0, L2 = 0, V2 = N2.borderwidth;
            F13.each(function() {
              var re = n.select(this).select(".selector-text"), R2 = N2.font.size * p, z = Math.max(R2 * c.lineCount(re), 16) + 3;
              L2 = Math.max(L2, z);
            }), F13.each(function() {
              var re = n.select(this), R2 = re.select(".selector-rect"), z = re.select(".selector-text"), H2 = z.node() && i.bBox(z.node()).width, te = N2.font.size * p, j = c.lineCount(z), Q2 = Math.max(H2 + 10, m.minButtonWidth);
              re.attr("transform", u2(V2 + O2, V2)), R2.attr({ x: 0, y: 0, width: Q2, height: L2 }), c.positionText(z, Q2 / 2, L2 / 2 - (j - 1) * te / 2 + 3), O2 += Q2 + 5;
            });
            var W2 = E2._fullLayout._size, X2 = W2.l + W2.w * N2.x, Y2 = W2.t + W2.h * (1 - N2.y), K2 = "left";
            l.isRightAnchor(N2) && (X2 -= O2, K2 = "right"), l.isCenterAnchor(N2) && (X2 -= O2 / 2, K2 = "center");
            var q = "top";
            l.isBottomAnchor(N2) && (Y2 -= L2, q = "bottom"), l.isMiddleAnchor(N2) && (Y2 -= L2 / 2, q = "middle"), O2 = Math.ceil(O2), L2 = Math.ceil(L2), X2 = Math.round(X2), Y2 = Math.round(Y2), o.autoMargin(E2, D2 + "-range-selector", { x: N2.x, y: N2.y, l: O2 * d[K2], r: O2 * v[K2], b: L2 * v[q], t: L2 * d[q] }), I2.attr("transform", u2(X2, Y2));
          }(w, C2, S2, A2._name, T2);
        });
      };
    }, { "../../constants/alignment": 471, "../../lib": 503, "../../lib/svg_text_utils": 529, "../../plots/cartesian/axis_ids": 558, "../../plots/plots": 619, "../../registry": 638, "../color": 366, "../drawing": 388, "./constants": 433, "./get_update_object": 436, "@plotly/d3": 58 }], 436: [function(e, t, r) {
      "use strict";
      var n = e("d3-time"), a = e("../../lib").titleCase;
      t.exports = function(o, s) {
        var i = o._name, l = {};
        if (s.step === "all") l[i + ".autorange"] = true;
        else {
          var u2 = function(c, f) {
            var h, p = c.range, d = new Date(c.r2l(p[1])), v = f.step, m = n["utc" + a(v)], g = f.count;
            switch (f.stepmode) {
              case "backward":
                h = c.l2r(+m.offset(d, -g));
                break;
              case "todate":
                var x = m.offset(d, -g);
                h = c.l2r(+m.ceil(x));
            }
            var b = p[1];
            return [h, b];
          }(o, s);
          l[i + ".range[0]"] = u2[0], l[i + ".range[1]"] = u2[1];
        }
        return l;
      };
    }, { "../../lib": 503, "d3-time": 122 }], 437: [function(e, t, r) {
      "use strict";
      t.exports = { moduleType: "component", name: "rangeselector", schema: { subplots: { xaxis: { rangeselector: e("./attributes") } } }, layoutAttributes: e("./attributes"), handleDefaults: e("./defaults"), draw: e("./draw") };
    }, { "./attributes": 432, "./defaults": 434, "./draw": 435 }], 438: [function(e, t, r) {
      "use strict";
      var n = e("../color/attributes");
      t.exports = { bgcolor: { valType: "color", dflt: n.background, editType: "plot" }, bordercolor: { valType: "color", dflt: n.defaultLine, editType: "plot" }, borderwidth: { valType: "integer", dflt: 0, min: 0, editType: "plot" }, autorange: { valType: "boolean", dflt: true, editType: "calc", impliedEdits: { "range[0]": void 0, "range[1]": void 0 } }, range: { valType: "info_array", items: [{ valType: "any", editType: "calc", impliedEdits: { "^autorange": false } }, { valType: "any", editType: "calc", impliedEdits: { "^autorange": false } }], editType: "calc", impliedEdits: { autorange: false } }, thickness: { valType: "number", dflt: 0.15, min: 0, max: 1, editType: "plot" }, visible: { valType: "boolean", dflt: true, editType: "calc" }, editType: "calc" };
    }, { "../color/attributes": 365 }], 439: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/cartesian/axis_ids").list, a = e("../../plots/cartesian/autorange").getAutoRange, o = e("./constants");
      t.exports = function(s) {
        for (var i = n(s, "x", true), l = 0; l < i.length; l++) {
          var u2 = i[l], c = u2[o.name];
          c && c.visible && c.autorange && (c._input.autorange = true, c._input.range = c.range = a(s, u2));
        }
      };
    }, { "../../plots/cartesian/autorange": 553, "../../plots/cartesian/axis_ids": 558, "./constants": 440 }], 440: [function(e, t, r) {
      "use strict";
      t.exports = { name: "rangeslider", containerClassName: "rangeslider-container", bgClassName: "rangeslider-bg", rangePlotClassName: "rangeslider-rangeplot", maskMinClassName: "rangeslider-mask-min", maskMaxClassName: "rangeslider-mask-max", slideBoxClassName: "rangeslider-slidebox", grabberMinClassName: "rangeslider-grabber-min", grabAreaMinClassName: "rangeslider-grabarea-min", handleMinClassName: "rangeslider-handle-min", grabberMaxClassName: "rangeslider-grabber-max", grabAreaMaxClassName: "rangeslider-grabarea-max", handleMaxClassName: "rangeslider-handle-max", maskMinOppAxisClassName: "rangeslider-mask-min-opp-axis", maskMaxOppAxisClassName: "rangeslider-mask-max-opp-axis", maskColor: "rgba(0,0,0,0.4)", maskOppAxisColor: "rgba(0,0,0,0.2)", slideBoxFill: "transparent", slideBoxCursor: "ew-resize", grabAreaFill: "transparent", grabAreaCursor: "col-resize", grabAreaWidth: 10, handleWidth: 4, handleRadius: 1, handleStrokeWidth: 1, extraPad: 15 };
    }, {}], 441: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../plot_api/plot_template"), o = e("../../plots/cartesian/axis_ids"), s = e("./attributes"), i = e("./oppaxis_attributes");
      t.exports = function(l, u2, c) {
        var f = l[c], h = u2[c];
        if (f.rangeslider || u2._requestRangeslider[h._id]) {
          n.isPlainObject(f.rangeslider) || (f.rangeslider = {});
          var p, d, v = f.rangeslider, m = a.newContainer(h, "rangeslider");
          if (T2("visible")) {
            T2("bgcolor", u2.plot_bgcolor), T2("bordercolor"), T2("borderwidth"), T2("thickness"), T2("autorange", !h.isValidRange(v.range)), T2("range");
            var g = u2._subplots;
            if (g) for (var x = g.cartesian.filter(function(S2) {
              return S2.substr(0, S2.indexOf("y")) === o.name2id(c);
            }).map(function(S2) {
              return S2.substr(S2.indexOf("y"), S2.length);
            }), b = n.simpleMap(x, o.id2name), y = 0; y < b.length; y++) {
              var w = b[y];
              p = v[w] || {}, d = a.newContainer(m, w, "yaxis");
              var _4, k = u2[w];
              p.range && k.isValidRange(p.range) && (_4 = "fixed"), A2("rangemode", _4) !== "match" && A2("range", k.range.slice());
            }
            m._input = v;
          }
        }
        function T2(S2, C2) {
          return n.coerce(v, m, s, S2, C2);
        }
        function A2(S2, C2) {
          return n.coerce(p, d, i, S2, C2);
        }
      };
    }, { "../../lib": 503, "../../plot_api/plot_template": 543, "../../plots/cartesian/axis_ids": 558, "./attributes": 438, "./oppaxis_attributes": 445 }], 442: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../registry"), o = e("../../plots/plots"), s = e("../../lib"), i = s.strTranslate, l = e("../drawing"), u2 = e("../color"), c = e("../titles"), f = e("../../plots/cartesian"), h = e("../../plots/cartesian/axis_ids"), p = e("../dragelement"), d = e("../../lib/setcursor"), v = e("./constants");
      function m(_4, k, T2, A2) {
        var S2 = s.ensureSingle(_4, "rect", v.bgClassName, function(N2) {
          N2.attr({ x: 0, y: 0, "shape-rendering": "crispEdges" });
        }), C2 = A2.borderwidth % 2 == 0 ? A2.borderwidth : A2.borderwidth - 1, E2 = -A2._offsetShift, F13 = l.crispRound(k, A2.borderwidth);
        S2.attr({ width: A2._width + C2, height: A2._height + C2, transform: i(E2, E2), fill: A2.bgcolor, stroke: A2.bordercolor, "stroke-width": F13 });
      }
      function g(_4, k, T2, A2) {
        var S2 = k._fullLayout;
        s.ensureSingleById(S2._topdefs, "clipPath", A2._clipId, function(C2) {
          C2.append("rect").attr({ x: 0, y: 0 });
        }).select("rect").attr({ width: A2._width, height: A2._height });
      }
      function x(_4, k, T2, A2) {
        var S2, C2 = k.calcdata, E2 = _4.selectAll("g." + v.rangePlotClassName).data(T2._subplotsWith, s.identity);
        E2.enter().append("g").attr("class", function(F13) {
          return v.rangePlotClassName + " " + F13;
        }).call(l.setClipUrl, A2._clipId, k), E2.order(), E2.exit().remove(), E2.each(function(F13, N2) {
          var D2 = n.select(this), I2 = N2 === 0, O2 = h.getFromId(k, F13, "y"), L2 = O2._name, V2 = A2[L2], W2 = { data: [], layout: { xaxis: { type: T2.type, domain: [0, 1], range: A2.range.slice(), calendar: T2.calendar }, width: A2._width, height: A2._height, margin: { t: 0, b: 0, l: 0, r: 0 } }, _context: k._context };
          T2.rangebreaks && (W2.layout.xaxis.rangebreaks = T2.rangebreaks), W2.layout[L2] = { type: O2.type, domain: [0, 1], range: V2.rangemode !== "match" ? V2.range.slice() : O2.range.slice(), calendar: O2.calendar }, O2.rangebreaks && (W2.layout[L2].rangebreaks = O2.rangebreaks), o.supplyDefaults(W2);
          var X2 = W2._fullLayout.xaxis, Y2 = W2._fullLayout[L2];
          X2.clearCalc(), X2.setScale(), Y2.clearCalc(), Y2.setScale();
          var K2 = { id: F13, plotgroup: D2, xaxis: X2, yaxis: Y2, isRangePlot: true };
          I2 ? S2 = K2 : (K2.mainplot = "xy", K2.mainplotinfo = S2), f.rangePlot(k, K2, function(q, re) {
            for (var R2 = [], z = 0; z < q.length; z++) {
              var H2 = q[z], te = H2[0].trace;
              te.xaxis + te.yaxis === re && R2.push(H2);
            }
            return R2;
          }(C2, F13));
        });
      }
      function b(_4, k, T2, A2, S2) {
        s.ensureSingle(_4, "rect", v.maskMinClassName, function(C2) {
          C2.attr({ x: 0, y: 0, "shape-rendering": "crispEdges" });
        }).attr("height", A2._height).call(u2.fill, v.maskColor), s.ensureSingle(_4, "rect", v.maskMaxClassName, function(C2) {
          C2.attr({ y: 0, "shape-rendering": "crispEdges" });
        }).attr("height", A2._height).call(u2.fill, v.maskColor), S2.rangemode !== "match" && (s.ensureSingle(_4, "rect", v.maskMinOppAxisClassName, function(C2) {
          C2.attr({ y: 0, "shape-rendering": "crispEdges" });
        }).attr("width", A2._width).call(u2.fill, v.maskOppAxisColor), s.ensureSingle(_4, "rect", v.maskMaxOppAxisClassName, function(C2) {
          C2.attr({ y: 0, "shape-rendering": "crispEdges" });
        }).attr("width", A2._width).style("border-top", v.maskOppBorder).call(u2.fill, v.maskOppAxisColor));
      }
      function y(_4, k, T2, A2) {
        k._context.staticPlot || s.ensureSingle(_4, "rect", v.slideBoxClassName, function(S2) {
          S2.attr({ y: 0, cursor: v.slideBoxCursor, "shape-rendering": "crispEdges" });
        }).attr({ height: A2._height, fill: v.slideBoxFill });
      }
      function w(_4, k, T2, A2) {
        var S2 = s.ensureSingle(_4, "g", v.grabberMinClassName), C2 = s.ensureSingle(_4, "g", v.grabberMaxClassName), E2 = { x: 0, width: v.handleWidth, rx: v.handleRadius, fill: u2.background, stroke: u2.defaultLine, "stroke-width": v.handleStrokeWidth, "shape-rendering": "crispEdges" }, F13 = { y: Math.round(A2._height / 4), height: Math.round(A2._height / 2) };
        s.ensureSingle(S2, "rect", v.handleMinClassName, function(D2) {
          D2.attr(E2);
        }).attr(F13), s.ensureSingle(C2, "rect", v.handleMaxClassName, function(D2) {
          D2.attr(E2);
        }).attr(F13);
        var N2 = { width: v.grabAreaWidth, x: 0, y: 0, fill: v.grabAreaFill, cursor: k._context.staticPlot ? void 0 : v.grabAreaCursor };
        s.ensureSingle(S2, "rect", v.grabAreaMinClassName, function(D2) {
          D2.attr(N2);
        }).attr("height", A2._height), s.ensureSingle(C2, "rect", v.grabAreaMaxClassName, function(D2) {
          D2.attr(N2);
        }).attr("height", A2._height);
      }
      t.exports = function(_4) {
        for (var k = _4._fullLayout, T2 = k._rangeSliderData, A2 = 0; A2 < T2.length; A2++) {
          var S2 = T2[A2][v.name];
          S2._clipId = S2._id + "-" + k._uid;
        }
        var C2 = k._infolayer.selectAll("g." + v.containerClassName).data(T2, function(E2) {
          return E2._name;
        });
        C2.exit().each(function(E2) {
          var F13 = E2[v.name];
          k._topdefs.select("#" + F13._clipId).remove();
        }).remove(), T2.length !== 0 && (C2.enter().append("g").classed(v.containerClassName, true).attr("pointer-events", "all"), C2.each(function(E2) {
          var F13 = n.select(this), N2 = E2[v.name], D2 = k[h.id2name(E2.anchor)], I2 = N2[h.id2name(E2.anchor)];
          if (N2.range) {
            var O2, L2 = s.simpleMap(N2.range, E2.r2l), V2 = s.simpleMap(E2.range, E2.r2l);
            O2 = V2[0] < V2[1] ? [Math.min(L2[0], V2[0]), Math.max(L2[1], V2[1])] : [Math.max(L2[0], V2[0]), Math.min(L2[1], V2[1])], N2.range = N2._input.range = s.simpleMap(O2, E2.l2r);
          }
          E2.cleanRange("rangeslider.range");
          var W2 = k._size, X2 = E2.domain;
          N2._width = W2.w * (X2[1] - X2[0]);
          var Y2 = Math.round(W2.l + W2.w * X2[0]), K2 = Math.round(W2.t + W2.h * (1 - E2._counterDomainMin) + (E2.side === "bottom" ? E2._depth : 0) + N2._offsetShift + v.extraPad);
          F13.attr("transform", i(Y2, K2)), N2._rl = s.simpleMap(N2.range, E2.r2l);
          var q = N2._rl[0], re = N2._rl[1], R2 = re - q;
          if (N2.p2d = function(ue) {
            return ue / N2._width * R2 + q;
          }, N2.d2p = function(ue) {
            return (ue - q) / R2 * N2._width;
          }, E2.rangebreaks) {
            var z = E2.locateBreaks(q, re);
            if (z.length) {
              var H2, te, j = 0;
              for (H2 = 0; H2 < z.length; H2++) j += (te = z[H2]).max - te.min;
              var Q2 = N2._width / (re - q - j), Z2 = [-Q2 * q];
              for (H2 = 0; H2 < z.length; H2++) te = z[H2], Z2.push(Z2[Z2.length - 1] - Q2 * (te.max - te.min));
              for (N2.d2p = function(ue) {
                for (var le = Z2[0], ce = 0; ce < z.length; ce++) {
                  var se = z[ce];
                  if (ue >= se.max) le = Z2[ce + 1];
                  else if (ue < se.min) break;
                }
                return le + Q2 * ue;
              }, H2 = 0; H2 < z.length; H2++) (te = z[H2]).pmin = N2.d2p(te.min), te.pmax = N2.d2p(te.max);
              N2.p2d = function(ue) {
                for (var le = Z2[0], ce = 0; ce < z.length; ce++) {
                  var se = z[ce];
                  if (ue >= se.pmax) le = Z2[ce + 1];
                  else if (ue < se.pmin) break;
                }
                return (ue - le) / Q2;
              };
            }
          }
          if (I2.rangemode !== "match") {
            var ne = D2.r2l(I2.range[0]), ae = D2.r2l(I2.range[1]) - ne;
            N2.d2pOppAxis = function(ue) {
              return (ue - ne) / ae * N2._height;
            };
          }
          F13.call(m, _4, E2, N2).call(g, _4, E2, N2).call(x, _4, E2, N2).call(b, _4, E2, N2, I2).call(y, _4, E2, N2).call(w, _4, E2, N2), function(ue, le, ce, se) {
            if (le._context.staticPlot) return;
            var he = ue.select("rect." + v.slideBoxClassName).node(), me = ue.select("rect." + v.grabAreaMinClassName).node(), we = ue.select("rect." + v.grabAreaMaxClassName).node();
            function be() {
              var Ae = n.event, pe = Ae.target, ve = Ae.clientX || Ae.touches[0].clientX, Ee = ve - ue.node().getBoundingClientRect().left, Se = se.d2p(ce._rl[0]), Ce = se.d2p(ce._rl[1]), Be = p.coverSlip();
              function Ue(ct) {
                var We, Ze, it, ot = +(ct.clientX || ct.touches[0].clientX) - ve;
                switch (pe) {
                  case he:
                    it = "ew-resize", We = Se + ot, Ze = Ce + ot;
                    break;
                  case me:
                    it = "col-resize", We = Se + ot, Ze = Ce;
                    break;
                  case we:
                    it = "col-resize", We = Se, Ze = Ce + ot;
                    break;
                  default:
                    it = "ew-resize", We = Ee, Ze = Ee + ot;
                }
                if (Ze < We) {
                  var mt = Ze;
                  Ze = We, We = mt;
                }
                se._pixelMin = We, se._pixelMax = Ze, d(n.select(Be), it), function(wt, Et, zt, Nt) {
                  function yt(Jt) {
                    return zt.l2r(s.constrain(Jt, Nt._rl[0], Nt._rl[1]));
                  }
                  var pt = yt(Nt.p2d(Nt._pixelMin)), Ot = yt(Nt.p2d(Nt._pixelMax));
                  window.requestAnimationFrame(function() {
                    a.call("_guiRelayout", Et, zt._name + ".range", [pt, Ot]);
                  });
                }(0, le, ce, se);
              }
              function Ke() {
                Be.removeEventListener("mousemove", Ue), Be.removeEventListener("mouseup", Ke), this.removeEventListener("touchmove", Ue), this.removeEventListener("touchend", Ke), s.removeElement(Be);
              }
              this.addEventListener("touchmove", Ue), this.addEventListener("touchend", Ke), Be.addEventListener("mousemove", Ue), Be.addEventListener("mouseup", Ke);
            }
            ue.on("mousedown", be), ue.on("touchstart", be);
          }(F13, _4, E2, N2), function(ue, le, ce, se, he, me) {
            var we = v.handleWidth / 2;
            function be(Ke) {
              return s.constrain(Ke, 0, se._width);
            }
            function Ae(Ke) {
              return s.constrain(Ke, 0, se._height);
            }
            function pe(Ke) {
              return s.constrain(Ke, -we, se._width + we);
            }
            var ve = be(se.d2p(ce._rl[0])), Ee = be(se.d2p(ce._rl[1]));
            if (ue.select("rect." + v.slideBoxClassName).attr("x", ve).attr("width", Ee - ve), ue.select("rect." + v.maskMinClassName).attr("width", ve), ue.select("rect." + v.maskMaxClassName).attr("x", Ee).attr("width", se._width - Ee), me.rangemode !== "match") {
              var Se = se._height - Ae(se.d2pOppAxis(he._rl[1])), Ce = se._height - Ae(se.d2pOppAxis(he._rl[0]));
              ue.select("rect." + v.maskMinOppAxisClassName).attr("x", ve).attr("height", Se).attr("width", Ee - ve), ue.select("rect." + v.maskMaxOppAxisClassName).attr("x", ve).attr("y", Ce).attr("height", se._height - Ce).attr("width", Ee - ve), ue.select("rect." + v.slideBoxClassName).attr("y", Se).attr("height", Ce - Se);
            }
            var Be = Math.round(pe(ve - we)) - 0.5, Ue = Math.round(pe(Ee - we)) + 0.5;
            ue.select("g." + v.grabberMinClassName).attr("transform", i(Be, 0.5)), ue.select("g." + v.grabberMaxClassName).attr("transform", i(Ue, 0.5));
          }(F13, 0, E2, N2, D2, I2), E2.side === "bottom" && c.draw(_4, E2._id + "title", { propContainer: E2, propName: E2._name + ".title", placeholder: k._dfltTitle.x, attributes: { x: E2._offset + E2._length / 2, y: K2 + N2._height + N2._offsetShift + 10 + 1.5 * E2.title.font.size, "text-anchor": "middle" } });
        }));
      };
    }, { "../../lib": 503, "../../lib/setcursor": 524, "../../plots/cartesian": 568, "../../plots/cartesian/axis_ids": 558, "../../plots/plots": 619, "../../registry": 638, "../color": 366, "../dragelement": 385, "../drawing": 388, "../titles": 464, "./constants": 440, "@plotly/d3": 58 }], 443: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/cartesian/axis_ids"), a = e("../../lib/svg_text_utils"), o = e("./constants"), s = e("../../constants/alignment").LINE_SPACING, i = o.name;
      function l(u2) {
        var c = u2 && u2[i];
        return c && c.visible;
      }
      r.isVisible = l, r.makeData = function(u2) {
        var c = n.list({ _fullLayout: u2 }, "x", true), f = u2.margin, h = [];
        if (!u2._has("gl2d")) for (var p = 0; p < c.length; p++) {
          var d = c[p];
          if (l(d)) {
            h.push(d);
            var v = d[i];
            v._id = i + d._id, v._height = (u2.height - f.b - f.t) * v.thickness, v._offsetShift = Math.floor(v.borderwidth / 2);
          }
        }
        u2._rangeSliderData = h;
      }, r.autoMarginOpts = function(u2, c) {
        var f = u2._fullLayout, h = c[i], p = c._id.charAt(0), d = 0, v = 0;
        return c.side === "bottom" && (d = c._depth, c.title.text !== f._dfltTitle[p] && (v = 1.5 * c.title.font.size + 10 + h._offsetShift, v += (c.title.text.match(a.BR_TAG_ALL) || []).length * c.title.font.size * s)), { x: 0, y: c._counterDomainMin, l: 0, r: 0, t: 0, b: h._height + d + Math.max(f.margin.b, v), pad: o.extraPad + 2 * h._offsetShift };
      };
    }, { "../../constants/alignment": 471, "../../lib/svg_text_utils": 529, "../../plots/cartesian/axis_ids": 558, "./constants": 440 }], 444: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("./attributes"), o = e("./oppaxis_attributes"), s = e("./helpers");
      t.exports = { moduleType: "component", name: "rangeslider", schema: { subplots: { xaxis: { rangeslider: n.extendFlat({}, a, { yaxis: o }) } } }, layoutAttributes: e("./attributes"), handleDefaults: e("./defaults"), calcAutorange: e("./calc_autorange"), draw: e("./draw"), isVisible: s.isVisible, makeData: s.makeData, autoMarginOpts: s.autoMarginOpts };
    }, { "../../lib": 503, "./attributes": 438, "./calc_autorange": 439, "./defaults": 441, "./draw": 442, "./helpers": 443, "./oppaxis_attributes": 445 }], 445: [function(e, t, r) {
      "use strict";
      t.exports = { _isSubplotObj: true, rangemode: { valType: "enumerated", values: ["auto", "fixed", "match"], dflt: "match", editType: "calc" }, range: { valType: "info_array", items: [{ valType: "any", editType: "plot" }, { valType: "any", editType: "plot" }], editType: "plot" }, editType: "calc" };
    }, {}], 446: [function(e, t, r) {
      "use strict";
      var n = e("../annotations/attributes"), a = e("../../traces/scatter/attributes").line, o = e("../drawing/attributes").dash, s = e("../../lib/extend").extendFlat, i = e("../../plot_api/plot_template").templatedArray;
      e("../../constants/axis_placeable_objects"), t.exports = i("shape", { visible: { valType: "boolean", dflt: true, editType: "calc+arraydraw" }, type: { valType: "enumerated", values: ["circle", "rect", "path", "line"], editType: "calc+arraydraw" }, layer: { valType: "enumerated", values: ["below", "above"], dflt: "above", editType: "arraydraw" }, xref: s({}, n.xref, {}), xsizemode: { valType: "enumerated", values: ["scaled", "pixel"], dflt: "scaled", editType: "calc+arraydraw" }, xanchor: { valType: "any", editType: "calc+arraydraw" }, x0: { valType: "any", editType: "calc+arraydraw" }, x1: { valType: "any", editType: "calc+arraydraw" }, yref: s({}, n.yref, {}), ysizemode: { valType: "enumerated", values: ["scaled", "pixel"], dflt: "scaled", editType: "calc+arraydraw" }, yanchor: { valType: "any", editType: "calc+arraydraw" }, y0: { valType: "any", editType: "calc+arraydraw" }, y1: { valType: "any", editType: "calc+arraydraw" }, path: { valType: "string", editType: "calc+arraydraw" }, opacity: { valType: "number", min: 0, max: 1, dflt: 1, editType: "arraydraw" }, line: { color: s({}, a.color, { editType: "arraydraw" }), width: s({}, a.width, { editType: "calc+arraydraw" }), dash: s({}, o, { editType: "arraydraw" }), editType: "calc+arraydraw" }, fillcolor: { valType: "color", dflt: "rgba(0,0,0,0)", editType: "arraydraw" }, fillrule: { valType: "enumerated", values: ["evenodd", "nonzero"], dflt: "evenodd", editType: "arraydraw" }, editable: { valType: "boolean", dflt: false, editType: "calc+arraydraw" }, editType: "arraydraw" });
    }, { "../../constants/axis_placeable_objects": 472, "../../lib/extend": 493, "../../plot_api/plot_template": 543, "../../traces/scatter/attributes": 926, "../annotations/attributes": 349, "../drawing/attributes": 387 }], 447: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../plots/cartesian/axes"), o = e("./constants"), s = e("./helpers");
      function i(f) {
        return u2(f.line.width, f.xsizemode, f.x0, f.x1, f.path, false);
      }
      function l(f) {
        return u2(f.line.width, f.ysizemode, f.y0, f.y1, f.path, true);
      }
      function u2(f, h, p, d, v, m) {
        var g = f / 2, x = m;
        if (h === "pixel") {
          var b = v ? s.extractPathCoords(v, m ? o.paramIsY : o.paramIsX) : [p, d], y = n.aggNums(Math.max, null, b), w = n.aggNums(Math.min, null, b), _4 = w < 0 ? Math.abs(w) + g : g, k = y > 0 ? y + g : g;
          return { ppad: g, ppadplus: x ? _4 : k, ppadminus: x ? k : _4 };
        }
        return { ppad: g };
      }
      function c(f, h, p, d, v) {
        var m = f.type === "category" || f.type === "multicategory" ? f.r2c : f.d2c;
        if (h !== void 0) return [m(h), m(p)];
        if (d) {
          var g, x, b, y, w = 1 / 0, _4 = -1 / 0, k = d.match(o.segmentRE);
          for (f.type === "date" && (m = s.decodeDate(m)), g = 0; g < k.length; g++) (x = v[k[g].charAt(0)].drawn) !== void 0 && (!(b = k[g].substr(1).match(o.paramRE)) || b.length < x || ((y = m(b[x])) < w && (w = y), y > _4 && (_4 = y)));
          return _4 >= w ? [w, _4] : void 0;
        }
      }
      t.exports = function(f) {
        var h = f._fullLayout, p = n.filterVisible(h.shapes);
        if (p.length && f._fullData.length) for (var d = 0; d < p.length; d++) {
          var v, m, g = p[d];
          g._extremes = {};
          var x = a.getRefType(g.xref), b = a.getRefType(g.yref);
          if (g.xref !== "paper" && x !== "domain") {
            var y = g.xsizemode === "pixel" ? g.xanchor : g.x0, w = g.xsizemode === "pixel" ? g.xanchor : g.x1;
            (m = c(v = a.getFromId(f, g.xref), y, w, g.path, o.paramIsX)) && (g._extremes[v._id] = a.findExtremes(v, m, i(g)));
          }
          if (g.yref !== "paper" && b !== "domain") {
            var _4 = g.ysizemode === "pixel" ? g.yanchor : g.y0, k = g.ysizemode === "pixel" ? g.yanchor : g.y1;
            (m = c(v = a.getFromId(f, g.yref), _4, k, g.path, o.paramIsY)) && (g._extremes[v._id] = a.findExtremes(v, m, l(g)));
          }
        }
      };
    }, { "../../lib": 503, "../../plots/cartesian/axes": 554, "./constants": 448, "./helpers": 457 }], 448: [function(e, t, r) {
      "use strict";
      t.exports = { segmentRE: /[MLHVQCTSZ][^MLHVQCTSZ]*/g, paramRE: /[^\s,]+/g, paramIsX: { M: { 0: true, drawn: 0 }, L: { 0: true, drawn: 0 }, H: { 0: true, drawn: 0 }, V: {}, Q: { 0: true, 2: true, drawn: 2 }, C: { 0: true, 2: true, 4: true, drawn: 4 }, T: { 0: true, drawn: 0 }, S: { 0: true, 2: true, drawn: 2 }, Z: {} }, paramIsY: { M: { 1: true, drawn: 1 }, L: { 1: true, drawn: 1 }, H: {}, V: { 0: true, drawn: 0 }, Q: { 1: true, 3: true, drawn: 3 }, C: { 1: true, 3: true, 5: true, drawn: 5 }, T: { 1: true, drawn: 1 }, S: { 1: true, 3: true, drawn: 5 }, Z: {} }, numParams: { M: 2, L: 2, H: 1, V: 1, Q: 4, C: 6, T: 2, S: 4, Z: 0 } };
    }, {}], 449: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../plots/cartesian/axes"), o = e("../../plots/array_container_defaults"), s = e("./attributes"), i = e("./helpers");
      function l(u2, c, f) {
        function h(I2, O2) {
          return n.coerce(u2, c, s, I2, O2);
        }
        if (h("visible")) {
          var p = h("path"), d = h("type", p ? "path" : "rect");
          c.type !== "path" && delete c.path, h("editable"), h("layer"), h("opacity"), h("fillcolor"), h("fillrule"), h("line.width") && (h("line.color"), h("line.dash"));
          for (var v = h("xsizemode"), m = h("ysizemode"), g = ["x", "y"], x = 0; x < 2; x++) {
            var b, y, w, _4 = g[x], k = _4 + "anchor", T2 = _4 === "x" ? v : m, A2 = { _fullLayout: f }, S2 = a.coerceRef(u2, c, A2, _4, void 0, "paper");
            if (a.getRefType(S2) === "range" ? ((b = a.getFromId(A2, S2))._shapeIndices.push(c._index), w = i.rangeToShapePosition(b), y = i.shapePositionToRange(b)) : y = w = n.identity, d !== "path") {
              var C2 = _4 + "0", E2 = _4 + "1", F13 = u2[C2], N2 = u2[E2];
              u2[C2] = y(u2[C2], true), u2[E2] = y(u2[E2], true), T2 === "pixel" ? (h(C2, 0), h(E2, 10)) : (a.coercePosition(c, A2, h, S2, C2, 0.25), a.coercePosition(c, A2, h, S2, E2, 0.75)), c[C2] = w(c[C2]), c[E2] = w(c[E2]), u2[C2] = F13, u2[E2] = N2;
            }
            if (T2 === "pixel") {
              var D2 = u2[k];
              u2[k] = y(u2[k], true), a.coercePosition(c, A2, h, S2, k, 0.25), c[k] = w(c[k]), u2[k] = D2;
            }
          }
          d === "path" ? h("path") : n.noneOrAll(u2, c, ["x0", "x1", "y0", "y1"]);
        }
      }
      t.exports = function(u2, c) {
        o(u2, c, { name: "shapes", handleItemDefaults: l });
      };
    }, { "../../lib": 503, "../../plots/array_container_defaults": 549, "../../plots/cartesian/axes": 554, "./attributes": 446, "./helpers": 457 }], 450: [function(e, t, r) {
      "use strict";
      var n = e("../../registry"), a = e("../../lib"), o = e("../../plots/cartesian/axes"), s = e("./draw_newshape/helpers").readPaths, i = e("./draw_newshape/display_outlines"), l = e("../../plots/cartesian/handle_outline").clearOutlineControllers, u2 = e("../color"), c = e("../drawing"), f = e("../../plot_api/plot_template").arrayEditor, h = e("../dragelement"), p = e("../../lib/setcursor"), d = e("./constants"), v = e("./helpers");
      function m(T2) {
        var A2 = T2._fullLayout;
        for (var S2 in A2._shapeUpperLayer.selectAll("path").remove(), A2._shapeLowerLayer.selectAll("path").remove(), A2._plots) {
          var C2 = A2._plots[S2].shapelayer;
          C2 && C2.selectAll("path").remove();
        }
        for (var E2 = 0; E2 < A2.shapes.length; E2++) A2.shapes[E2].visible && b(T2, E2);
      }
      function g(T2) {
        return !!T2._fullLayout._drawing;
      }
      function x(T2) {
        return !T2._context.edits.shapePosition;
      }
      function b(T2, A2) {
        T2._fullLayout._paperdiv.selectAll('.shapelayer [data-index="' + A2 + '"]').remove();
        var S2 = v.makeOptionsAndPlotinfo(T2, A2), C2 = S2.options, E2 = S2.plotinfo;
        C2._input && C2.visible !== false && (C2.layer !== "below" ? F13(T2._fullLayout._shapeUpperLayer) : C2.xref === "paper" || C2.yref === "paper" ? F13(T2._fullLayout._shapeLowerLayer) : E2._hadPlotinfo ? F13((E2.mainplotinfo || E2).shapelayer) : F13(T2._fullLayout._shapeLowerLayer));
        function F13(N2) {
          var D2 = w(T2, C2), I2 = { "data-index": A2, "fill-rule": C2.fillrule, d: D2 }, O2 = C2.opacity, L2 = C2.fillcolor, V2 = C2.line.width ? C2.line.color : "rgba(0,0,0,0)", W2 = C2.line.width, X2 = C2.line.dash;
          W2 || C2.editable !== true || (W2 = 5, X2 = "solid");
          var Y2 = D2[D2.length - 1] !== "Z", K2 = x(T2) && C2.editable && T2._fullLayout._activeShapeIndex === A2;
          K2 && (L2 = Y2 ? "rgba(0,0,0,0)" : T2._fullLayout.activeshape.fillcolor, O2 = T2._fullLayout.activeshape.opacity);
          var q, re = N2.append("path").attr(I2).style("opacity", O2).call(u2.stroke, V2).call(u2.fill, L2).call(c.dashLine, X2, W2);
          if (y(re, T2, C2), (K2 || T2._context.edits.shapePosition) && (q = f(T2.layout, "shapes", C2)), K2) {
            re.style({ cursor: "move" });
            var R2 = { element: re.node(), plotinfo: E2, gd: T2, editHelpers: q, isActiveShape: true }, z = s(D2, T2);
            i(z, re, R2);
          } else T2._context.edits.shapePosition ? function(H2, te, j, Q2, Z2, ne) {
            var ae, ue, le, ce, se, he, me, we, be, Ae, pe, ve, Ee, Se, Ce, Be, Ue = j.xsizemode === "pixel", Ke = j.ysizemode === "pixel", ct = j.type === "line", We = j.type === "path", Ze = ne.modifyItem, it = o.getFromId(H2, j.xref), ot = o.getRefType(j.xref), mt = o.getFromId(H2, j.yref), wt = o.getRefType(j.yref), Et = v.getDataToPixel(H2, it, false, ot), zt = v.getDataToPixel(H2, mt, true, wt), Nt = v.getPixelToData(H2, it, false, ot), yt = v.getPixelToData(H2, mt, true, wt), pt = ct ? function() {
              var st = Math.max(j.line.width, 10), Ie = Z2.append("g").attr("data-index", Q2);
              Ie.append("path").attr("d", te.attr("d")).style({ cursor: "move", "stroke-width": st, "stroke-opacity": "0" });
              var Pe = { "fill-opacity": "0" }, $e = Math.max(st / 2, 10);
              return Ie.append("circle").attr({ "data-line-point": "start-point", cx: Ue ? Et(j.xanchor) + j.x0 : Et(j.x0), cy: Ke ? zt(j.yanchor) - j.y0 : zt(j.y0), r: $e }).style(Pe).classed("cursor-grab", true), Ie.append("circle").attr({ "data-line-point": "end-point", cx: Ue ? Et(j.xanchor) + j.x1 : Et(j.x1), cy: Ke ? zt(j.yanchor) - j.y1 : zt(j.y1), r: $e }).style(Pe).classed("cursor-grab", true), Ie;
            }() : te, Ot = { element: pt.node(), gd: H2, prepFn: function(st) {
              g(H2) || (Ue && (se = Et(j.xanchor)), Ke && (he = zt(j.yanchor)), j.type === "path" ? Ce = j.path : (ae = Ue ? j.x0 : Et(j.x0), ue = Ke ? j.y0 : zt(j.y0), le = Ue ? j.x1 : Et(j.x1), ce = Ke ? j.y1 : zt(j.y1)), ae < le ? (be = ae, Ee = "x0", Ae = le, Se = "x1") : (be = le, Ee = "x1", Ae = ae, Se = "x0"), !Ke && ue < ce || Ke && ue > ce ? (me = ue, pe = "y0", we = ce, ve = "y1") : (me = ce, pe = "y1", we = ue, ve = "y0"), Jt(st), at(Z2, j), function(Ie, Pe, $e) {
                var Ve = Pe.xref, ut = Pe.yref, Re = o.getFromId($e, Ve), qe = o.getFromId($e, ut), je = "";
                Ve === "paper" || Re.autorange || (je += Ve), ut === "paper" || qe.autorange || (je += ut), c.setClipUrl(Ie, je ? "clip" + $e._fullLayout._uid + je : null, $e);
              }(te, j, H2), Ot.moveFn = Be === "move" ? tr : Ye, Ot.altKey = st.altKey);
            }, doneFn: function() {
              g(H2) || (p(te), Ge(Z2), y(te, H2, j), n.call("_guiRelayout", H2, ne.getUpdateObj()));
            }, clickFn: function() {
              g(H2) || Ge(Z2);
            } };
            function Jt(st) {
              if (g(H2)) Be = null;
              else if (ct) Be = st.target.tagName === "path" ? "move" : st.target.attributes["data-line-point"].value === "start-point" ? "resize-over-start-point" : "resize-over-end-point";
              else {
                var Ie = Ot.element.getBoundingClientRect(), Pe = Ie.right - Ie.left, $e = Ie.bottom - Ie.top, Ve = st.clientX - Ie.left, ut = st.clientY - Ie.top, Re = !We && Pe > 10 && $e > 10 && !st.shiftKey ? h.getCursor(Ve / Pe, 1 - ut / $e) : "move";
                p(te, Re), Be = Re.split("-")[0];
              }
            }
            function tr(st, Ie) {
              if (j.type === "path") {
                var Pe = function(ut) {
                  return ut;
                }, $e = Pe, Ve = Pe;
                Ue ? Ze("xanchor", j.xanchor = Nt(se + st)) : ($e = function(ut) {
                  return Nt(Et(ut) + st);
                }, it && it.type === "date" && ($e = v.encodeDate($e))), Ke ? Ze("yanchor", j.yanchor = yt(he + Ie)) : (Ve = function(ut) {
                  return yt(zt(ut) + Ie);
                }, mt && mt.type === "date" && (Ve = v.encodeDate(Ve))), Ze("path", j.path = _4(Ce, $e, Ve));
              } else Ue ? Ze("xanchor", j.xanchor = Nt(se + st)) : (Ze("x0", j.x0 = Nt(ae + st)), Ze("x1", j.x1 = Nt(le + st))), Ke ? Ze("yanchor", j.yanchor = yt(he + Ie)) : (Ze("y0", j.y0 = yt(ue + Ie)), Ze("y1", j.y1 = yt(ce + Ie)));
              te.attr("d", w(H2, j)), at(Z2, j);
            }
            function Ye(st, Ie) {
              if (We) {
                var Pe = function(De) {
                  return De;
                }, $e = Pe, Ve = Pe;
                Ue ? Ze("xanchor", j.xanchor = Nt(se + st)) : ($e = function(De) {
                  return Nt(Et(De) + st);
                }, it && it.type === "date" && ($e = v.encodeDate($e))), Ke ? Ze("yanchor", j.yanchor = yt(he + Ie)) : (Ve = function(De) {
                  return yt(zt(De) + Ie);
                }, mt && mt.type === "date" && (Ve = v.encodeDate(Ve))), Ze("path", j.path = _4(Ce, $e, Ve));
              } else if (ct) {
                if (Be === "resize-over-start-point") {
                  var ut = ae + st, Re = Ke ? ue - Ie : ue + Ie;
                  Ze("x0", j.x0 = Ue ? ut : Nt(ut)), Ze("y0", j.y0 = Ke ? Re : yt(Re));
                } else if (Be === "resize-over-end-point") {
                  var qe = le + st, je = Ke ? ce - Ie : ce + Ie;
                  Ze("x1", j.x1 = Ue ? qe : Nt(qe)), Ze("y1", j.y1 = Ke ? je : yt(je));
                }
              } else {
                var rt = function(De) {
                  return Be.indexOf(De) !== -1;
                }, He = rt("n"), xe = rt("s"), Ne = rt("w"), ke = rt("e"), Me = He ? me + Ie : me, Le = xe ? we + Ie : we, ze = Ne ? be + st : be, ft = ke ? Ae + st : Ae;
                Ke && (He && (Me = me - Ie), xe && (Le = we - Ie)), (!Ke && Le - Me > 10 || Ke && Me - Le > 10) && (Ze(pe, j[pe] = Ke ? Me : yt(Me)), Ze(ve, j[ve] = Ke ? Le : yt(Le))), ft - ze > 10 && (Ze(Ee, j[Ee] = Ue ? ze : Nt(ze)), Ze(Se, j[Se] = Ue ? ft : Nt(ft)));
              }
              te.attr("d", w(H2, j)), at(Z2, j);
            }
            function at(st, Ie) {
              (Ue || Ke) && function() {
                var Pe = Ie.type !== "path", $e = st.selectAll(".visual-cue").data([0]);
                $e.enter().append("path").attr({ fill: "#fff", "fill-rule": "evenodd", stroke: "#000", "stroke-width": 1 }).classed("visual-cue", true);
                var Ve = Et(Ue ? Ie.xanchor : a.midRange(Pe ? [Ie.x0, Ie.x1] : v.extractPathCoords(Ie.path, d.paramIsX))), ut = zt(Ke ? Ie.yanchor : a.midRange(Pe ? [Ie.y0, Ie.y1] : v.extractPathCoords(Ie.path, d.paramIsY)));
                if (Ve = v.roundPositionForSharpStrokeRendering(Ve, 1), ut = v.roundPositionForSharpStrokeRendering(ut, 1), Ue && Ke) {
                  var Re = "M" + (Ve - 1 - 1) + "," + (ut - 1 - 1) + "h-8v2h8 v8h2v-8 h8v-2h-8 v-8h-2 Z";
                  $e.attr("d", Re);
                } else if (Ue) {
                  var qe = "M" + (Ve - 1 - 1) + "," + (ut - 9 - 1) + "v18 h2 v-18 Z";
                  $e.attr("d", qe);
                } else {
                  var je = "M" + (Ve - 9 - 1) + "," + (ut - 1 - 1) + "h18 v2 h-18 Z";
                  $e.attr("d", je);
                }
              }();
            }
            function Ge(st) {
              st.selectAll(".visual-cue").remove();
            }
            h.init(Ot), pt.node().onmousemove = Jt;
          }(T2, re, C2, A2, N2, q) : C2.editable === true && re.style("pointer-events", Y2 || u2.opacity(L2) * O2 <= 0.5 ? "stroke" : "all");
          re.node().addEventListener("click", function() {
            return function(H2, te) {
              if (!!x(H2)) {
                var j = +te.node().getAttribute("data-index");
                if (j >= 0) {
                  if (j === H2._fullLayout._activeShapeIndex) return void k(H2);
                  H2._fullLayout._activeShapeIndex = j, H2._fullLayout._deactivateShape = k, m(H2);
                }
              }
            }(T2, re);
          });
        }
      }
      function y(T2, A2, S2) {
        var C2 = (S2.xref + S2.yref).replace(/paper/g, "").replace(/[xyz][1-9]* *domain/g, "");
        c.setClipUrl(T2, C2 ? "clip" + A2._fullLayout._uid + C2 : null, A2);
      }
      function w(T2, A2) {
        var S2, C2, E2, F13, N2, D2, I2, O2, L2 = A2.type, V2 = o.getRefType(A2.xref), W2 = o.getRefType(A2.yref), X2 = o.getFromId(T2, A2.xref), Y2 = o.getFromId(T2, A2.yref), K2 = T2._fullLayout._size;
        if (X2 ? V2 === "domain" ? C2 = function(Z2) {
          return X2._offset + X2._length * Z2;
        } : (S2 = v.shapePositionToRange(X2), C2 = function(Z2) {
          return X2._offset + X2.r2p(S2(Z2, true));
        }) : C2 = function(Z2) {
          return K2.l + K2.w * Z2;
        }, Y2 ? W2 === "domain" ? F13 = function(Z2) {
          return Y2._offset + Y2._length * (1 - Z2);
        } : (E2 = v.shapePositionToRange(Y2), F13 = function(Z2) {
          return Y2._offset + Y2.r2p(E2(Z2, true));
        }) : F13 = function(Z2) {
          return K2.t + K2.h * (1 - Z2);
        }, L2 === "path") return X2 && X2.type === "date" && (C2 = v.decodeDate(C2)), Y2 && Y2.type === "date" && (F13 = v.decodeDate(F13)), function(Z2, ne, ae) {
          var ue = Z2.path, le = Z2.xsizemode, ce = Z2.ysizemode, se = Z2.xanchor, he = Z2.yanchor;
          return ue.replace(d.segmentRE, function(me) {
            var we = 0, be = me.charAt(0), Ae = d.paramIsX[be], pe = d.paramIsY[be], ve = d.numParams[be], Ee = me.substr(1).replace(d.paramRE, function(Se) {
              return Ae[we] ? Se = le === "pixel" ? ne(se) + Number(Se) : ne(Se) : pe[we] && (Se = ce === "pixel" ? ae(he) - Number(Se) : ae(Se)), ++we > ve && (Se = "X"), Se;
            });
            return we > ve && (Ee = Ee.replace(/[\s,]*X.*/, ""), a.log("Ignoring extra params in segment " + me)), be + Ee;
          });
        }(A2, C2, F13);
        if (A2.xsizemode === "pixel") {
          var q = C2(A2.xanchor);
          N2 = q + A2.x0, D2 = q + A2.x1;
        } else N2 = C2(A2.x0), D2 = C2(A2.x1);
        if (A2.ysizemode === "pixel") {
          var re = F13(A2.yanchor);
          I2 = re - A2.y0, O2 = re - A2.y1;
        } else I2 = F13(A2.y0), O2 = F13(A2.y1);
        if (L2 === "line") return "M" + N2 + "," + I2 + "L" + D2 + "," + O2;
        if (L2 === "rect") return "M" + N2 + "," + I2 + "H" + D2 + "V" + O2 + "H" + N2 + "Z";
        var R2 = (N2 + D2) / 2, z = (I2 + O2) / 2, H2 = Math.abs(R2 - N2), te = Math.abs(z - I2), j = "A" + H2 + "," + te, Q2 = R2 + H2 + "," + z;
        return "M" + Q2 + j + " 0 1,1 " + (R2 + "," + (z - te)) + j + " 0 0,1 " + Q2 + "Z";
      }
      function _4(T2, A2, S2) {
        return T2.replace(d.segmentRE, function(C2) {
          var E2 = 0, F13 = C2.charAt(0), N2 = d.paramIsX[F13], D2 = d.paramIsY[F13], I2 = d.numParams[F13];
          return F13 + C2.substr(1).replace(d.paramRE, function(O2) {
            return E2 >= I2 || (N2[E2] ? O2 = A2(O2) : D2[E2] && (O2 = S2(O2)), E2++), O2;
          });
        });
      }
      function k(T2) {
        x(T2) && T2._fullLayout._activeShapeIndex >= 0 && (l(T2), delete T2._fullLayout._activeShapeIndex, m(T2));
      }
      t.exports = { draw: m, drawOne: b, eraseActiveShape: function(T2) {
        if (!!x(T2)) {
          l(T2);
          var A2 = T2._fullLayout._activeShapeIndex, S2 = (T2.layout || {}).shapes || [];
          if (A2 < S2.length) {
            for (var C2 = [], E2 = 0; E2 < S2.length; E2++) E2 !== A2 && C2.push(S2[E2]);
            delete T2._fullLayout._activeShapeIndex, n.call("_guiRelayout", T2, { shapes: C2 });
          }
        }
      } };
    }, { "../../lib": 503, "../../lib/setcursor": 524, "../../plot_api/plot_template": 543, "../../plots/cartesian/axes": 554, "../../plots/cartesian/handle_outline": 565, "../../registry": 638, "../color": 366, "../dragelement": 385, "../drawing": 388, "./constants": 448, "./draw_newshape/display_outlines": 454, "./draw_newshape/helpers": 455, "./helpers": 457 }], 451: [function(e, t, r) {
      "use strict";
      var n = e("../../drawing/attributes").dash, a = e("../../../lib/extend").extendFlat;
      t.exports = { newshape: { line: { color: { valType: "color", editType: "none" }, width: { valType: "number", min: 0, dflt: 4, editType: "none" }, dash: a({}, n, { dflt: "solid", editType: "none" }), editType: "none" }, fillcolor: { valType: "color", dflt: "rgba(0,0,0,0)", editType: "none" }, fillrule: { valType: "enumerated", values: ["evenodd", "nonzero"], dflt: "evenodd", editType: "none" }, opacity: { valType: "number", min: 0, max: 1, dflt: 1, editType: "none" }, layer: { valType: "enumerated", values: ["below", "above"], dflt: "above", editType: "none" }, drawdirection: { valType: "enumerated", values: ["ortho", "horizontal", "vertical", "diagonal"], dflt: "diagonal", editType: "none" }, editType: "none" }, activeshape: { fillcolor: { valType: "color", dflt: "rgb(255,0,255)", editType: "none" }, opacity: { valType: "number", min: 0, max: 1, dflt: 0.5, editType: "none" }, editType: "none" } };
    }, { "../../../lib/extend": 493, "../../drawing/attributes": 387 }], 452: [function(e, t, r) {
      "use strict";
      t.exports = { CIRCLE_SIDES: 32, i000: 0, i090: 8, i180: 16, i270: 24, cos45: Math.cos(Math.PI / 4), sin45: Math.sin(Math.PI / 4), SQRT2: Math.sqrt(2) };
    }, {}], 453: [function(e, t, r) {
      "use strict";
      var n = e("../../color");
      t.exports = function(a, o, s) {
        if (s("newshape.drawdirection"), s("newshape.layer"), s("newshape.fillcolor"), s("newshape.fillrule"), s("newshape.opacity"), s("newshape.line.width")) {
          var i = (a || {}).plot_bgcolor || "#FFF";
          s("newshape.line.color", n.contrast(i)), s("newshape.line.dash");
        }
        s("activeshape.fillcolor"), s("activeshape.opacity");
      };
    }, { "../../color": 366 }], 454: [function(e, t, r) {
      "use strict";
      var n = e("../../dragelement"), a = e("../../dragelement/helpers").drawMode, o = e("../../../registry"), s = e("./constants"), i = s.i000, l = s.i090, u2 = s.i180, c = s.i270, f = e("../../../plots/cartesian/handle_outline").clearOutlineControllers, h = e("./helpers"), p = h.pointsShapeRectangle, d = h.pointsShapeEllipse, v = h.writePaths, m = e("./newshapes");
      t.exports = function g(x, b, y, w) {
        w || (w = 0);
        var _4 = y.gd;
        function k() {
          g(x, b, y, w++), d(x[0]) && T2({ redrawing: true });
        }
        function T2(q) {
          y.isActiveShape = false;
          var re = m(b, y);
          Object.keys(re).length && o.call((q || {}).redrawing ? "relayout" : "_guiRelayout", _4, re);
        }
        var A2, S2, C2, E2, F13, N2 = y.isActiveShape, D2 = _4._fullLayout._zoomlayer, I2 = y.dragmode;
        a(I2) ? _4._fullLayout._drawing = true : _4._fullLayout._activeShapeIndex >= 0 && f(_4), b.attr("d", v(x)), N2 && !w && (F13 = function(q, re) {
          for (var R2 = 0; R2 < re.length; R2++) {
            var z = re[R2];
            q[R2] = [];
            for (var H2 = 0; H2 < z.length; H2++) {
              q[R2][H2] = [];
              for (var te = 0; te < z[H2].length; te++) q[R2][H2][te] = z[H2][te];
            }
          }
          return q;
        }([], x), function(q) {
          A2 = [];
          for (var re = 0; re < x.length; re++) {
            var R2 = x[re], z = !p(R2) && d(R2);
            A2[re] = [];
            for (var H2 = 0; H2 < R2.length; H2++) if (R2[H2][0] !== "Z" && (!z || H2 === i || H2 === l || H2 === u2 || H2 === c)) {
              var te = R2[H2][1], j = R2[H2][2], Q2 = q.append("circle").classed("cursor-grab", true).attr("data-i", re).attr("data-j", H2).attr("cx", te).attr("cy", j).attr("r", 4).style({ "mix-blend-mode": "luminosity", fill: "black", stroke: "white", "stroke-width": 1 });
              A2[re][H2] = { element: Q2.node(), gd: _4, prepFn: O2, doneFn: V2, clickFn: W2 }, n.init(A2[re][H2]);
            }
          }
        }(D2.append("g").attr("class", "outline-controllers")), function() {
          S2 = [], x.length && (S2[0] = { element: b[0][0], gd: _4, prepFn: Y2, doneFn: K2 }, n.init(S2[0]));
        }());
        function O2(q) {
          C2 = +q.srcElement.getAttribute("data-i"), E2 = +q.srcElement.getAttribute("data-j"), A2[C2][E2].moveFn = L2;
        }
        function L2(q, re) {
          if (x.length) {
            var R2 = F13[C2][E2][1], z = F13[C2][E2][2], H2 = x[C2], te = H2.length;
            if (p(H2)) {
              for (var j = 0; j < te; j++) if (j !== E2) {
                var Q2 = H2[j];
                Q2[1] === H2[E2][1] && (Q2[1] = R2 + q), Q2[2] === H2[E2][2] && (Q2[2] = z + re);
              }
              if (H2[E2][1] = R2 + q, H2[E2][2] = z + re, !p(H2)) for (var Z2 = 0; Z2 < te; Z2++) for (var ne = 0; ne < H2[Z2].length; ne++) H2[Z2][ne] = F13[C2][Z2][ne];
            } else H2[E2][1] = R2 + q, H2[E2][2] = z + re;
            k();
          }
        }
        function V2() {
          T2();
        }
        function W2(q, re) {
          if (q === 2) {
            C2 = +re.srcElement.getAttribute("data-i"), E2 = +re.srcElement.getAttribute("data-j");
            var R2 = x[C2];
            p(R2) || d(R2) || function() {
              if (x.length && x[C2] && x[C2].length) {
                for (var z = [], H2 = 0; H2 < x[C2].length; H2++) H2 !== E2 && z.push(x[C2][H2]);
                z.length > 1 && (z.length !== 2 || z[1][0] !== "Z") && (E2 === 0 && (z[0][0] = "M"), x[C2] = z, k(), T2());
              }
            }();
          }
        }
        function X2(q, re) {
          (function(R2, z) {
            if (x.length) for (var H2 = 0; H2 < x.length; H2++) for (var te = 0; te < x[H2].length; te++) for (var j = 0; j + 2 < x[H2][te].length; j += 2) x[H2][te][j + 1] = F13[H2][te][j + 1] + R2, x[H2][te][j + 2] = F13[H2][te][j + 2] + z;
          })(q, re), k();
        }
        function Y2(q) {
          (C2 = +q.srcElement.getAttribute("data-i")) || (C2 = 0), S2[C2].moveFn = X2;
        }
        function K2() {
          T2();
        }
      };
    }, { "../../../plots/cartesian/handle_outline": 565, "../../../registry": 638, "../../dragelement": 385, "../../dragelement/helpers": 384, "./constants": 452, "./helpers": 455, "./newshapes": 456 }], 455: [function(e, t, r) {
      "use strict";
      var n = e("parse-svg-path"), a = e("./constants"), o = a.CIRCLE_SIDES, s = a.SQRT2, i = e("../../../plots/cartesian/helpers"), l = i.p2r, u2 = i.r2p, c = [0, 3, 4, 5, 6, 1, 2], f = [0, 3, 4, 1, 2];
      function h(d, v) {
        return Math.abs(d - v) <= 1e-6;
      }
      function p(d, v) {
        var m = v[1] - d[1], g = v[2] - d[2];
        return Math.sqrt(m * m + g * g);
      }
      r.writePaths = function(d) {
        var v = d.length;
        if (!v) return "M0,0Z";
        for (var m = "", g = 0; g < v; g++) for (var x = d[g].length, b = 0; b < x; b++) {
          var y = d[g][b][0];
          if (y === "Z") m += "Z";
          else for (var w = d[g][b].length, _4 = 0; _4 < w; _4++) {
            var k = _4;
            y === "Q" || y === "S" ? k = f[_4] : y === "C" && (k = c[_4]), m += d[g][b][k], _4 > 0 && _4 < w - 1 && (m += ",");
          }
        }
        return m;
      }, r.readPaths = function(d, v, m, g) {
        var x, b, y, w = n(d), _4 = [], k = -1, T2 = 0, A2 = 0, S2 = function() {
          b = T2, y = A2;
        };
        S2();
        for (var C2 = 0; C2 < w.length; C2++) {
          var E2, F13, N2, D2, I2 = [], O2 = w[C2][0], L2 = O2;
          switch (O2) {
            case "M":
              k++, _4[k] = [], T2 = +w[C2][1], A2 = +w[C2][2], I2.push([L2, T2, A2]), S2();
              break;
            case "Q":
            case "S":
              E2 = +w[C2][1], N2 = +w[C2][2], T2 = +w[C2][3], A2 = +w[C2][4], I2.push([L2, T2, A2, E2, N2]);
              break;
            case "C":
              E2 = +w[C2][1], N2 = +w[C2][2], F13 = +w[C2][3], D2 = +w[C2][4], T2 = +w[C2][5], A2 = +w[C2][6], I2.push([L2, T2, A2, E2, N2, F13, D2]);
              break;
            case "T":
            case "L":
              T2 = +w[C2][1], A2 = +w[C2][2], I2.push([L2, T2, A2]);
              break;
            case "H":
              L2 = "L", T2 = +w[C2][1], I2.push([L2, T2, A2]);
              break;
            case "V":
              L2 = "L", A2 = +w[C2][1], I2.push([L2, T2, A2]);
              break;
            case "A":
              L2 = "L";
              var V2 = +w[C2][1], W2 = +w[C2][2];
              +w[C2][4] || (V2 = -V2, W2 = -W2);
              var X2 = T2 - V2, Y2 = A2;
              for (x = 1; x <= o / 2; x++) {
                var K2 = 2 * Math.PI * x / o;
                I2.push([L2, X2 + V2 * Math.cos(K2), Y2 + W2 * Math.sin(K2)]);
              }
              break;
            case "Z":
              T2 === b && A2 === y || (T2 = b, A2 = y, I2.push([L2, T2, A2]));
          }
          for (var q = (m || {}).domain, re = v._fullLayout._size, R2 = m && m.xsizemode === "pixel", z = m && m.ysizemode === "pixel", H2 = g === false, te = 0; te < I2.length; te++) {
            for (x = 0; x + 2 < 7; x += 2) {
              var j = I2[te][x + 1], Q2 = I2[te][x + 2];
              j !== void 0 && Q2 !== void 0 && (T2 = j, A2 = Q2, m && (m.xaxis && m.xaxis.p2r ? (H2 && (j -= m.xaxis._offset), j = R2 ? u2(m.xaxis, m.xanchor) + j : l(m.xaxis, j)) : (H2 && (j -= re.l), q ? j = q.x[0] + j / re.w : j /= re.w), m.yaxis && m.yaxis.p2r ? (H2 && (Q2 -= m.yaxis._offset), Q2 = z ? u2(m.yaxis, m.yanchor) - Q2 : l(m.yaxis, Q2)) : (H2 && (Q2 -= re.t), Q2 = q ? q.y[1] - Q2 / re.h : 1 - Q2 / re.h)), I2[te][x + 1] = j, I2[te][x + 2] = Q2);
            }
            _4[k].push(I2[te].slice());
          }
        }
        return _4;
      }, r.pointsShapeRectangle = function(d) {
        if (d.length !== 5) return false;
        for (var v = 1; v < 3; v++) if (!h(d[0][v] - d[1][v], d[3][v] - d[2][v]) || !h(d[0][v] - d[3][v], d[1][v] - d[2][v])) return false;
        return !(!h(d[0][1], d[1][1]) && !h(d[0][1], d[3][1])) && !!(p(d[0], d[1]) * p(d[0], d[3]));
      }, r.pointsShapeEllipse = function(d) {
        var v = d.length;
        if (v !== o + 1) return false;
        v = o;
        for (var m = 0; m < v; m++) {
          var g = (2 * v - m) % v, x = (v / 2 + g) % v, b = (v / 2 + m) % v;
          if (!h(p(d[m], d[b]), p(d[g], d[x]))) return false;
        }
        return true;
      }, r.handleEllipse = function(d, v, m) {
        if (!d) return [v, m];
        var g = r.ellipseOver({ x0: v[0], y0: v[1], x1: m[0], y1: m[1] }), x = (g.x1 + g.x0) / 2, b = (g.y1 + g.y0) / 2, y = (g.x1 - g.x0) / 2, w = (g.y1 - g.y0) / 2;
        y || (y = w /= s), w || (w = y /= s);
        for (var _4 = [], k = 0; k < o; k++) {
          var T2 = 2 * k * Math.PI / o;
          _4.push([x + y * Math.cos(T2), b + w * Math.sin(T2)]);
        }
        return _4;
      }, r.ellipseOver = function(d) {
        var v = d.x0, m = d.y0, g = d.x1, x = d.y1, b = g - v, y = x - m, w = ((v -= b) + g) / 2, _4 = ((m -= y) + x) / 2;
        return { x0: w - (b *= s), y0: _4 - (y *= s), x1: w + b, y1: _4 + y };
      };
    }, { "../../../plots/cartesian/helpers": 566, "./constants": 452, "parse-svg-path": 250 }], 456: [function(e, t, r) {
      "use strict";
      var n = e("../../dragelement/helpers"), a = n.drawMode, o = n.openMode, s = e("./constants"), i = s.i000, l = s.i090, u2 = s.i180, c = s.i270, f = s.cos45, h = s.sin45, p = e("../../../plots/cartesian/helpers"), d = p.p2r, v = p.r2p, m = e("../../../plots/cartesian/handle_outline").clearSelect, g = e("./helpers"), x = g.readPaths, b = g.writePaths, y = g.ellipseOver;
      t.exports = function(w, _4) {
        if (w.length) {
          var k = w[0][0];
          if (k) {
            var T2 = k.getAttribute("d"), A2 = _4.gd, S2 = A2._fullLayout.newshape, C2 = _4.plotinfo, E2 = C2.xaxis, F13 = C2.yaxis, N2 = !!C2.domain || !C2.xaxis, D2 = !!C2.domain || !C2.yaxis, I2 = _4.isActiveShape, O2 = _4.dragmode, L2 = (A2.layout || {}).shapes || [];
            if (!a(O2) && I2 !== void 0) {
              var V2 = A2._fullLayout._activeShapeIndex;
              if (V2 < L2.length) switch (A2._fullLayout.shapes[V2].type) {
                case "rect":
                  O2 = "drawrect";
                  break;
                case "circle":
                  O2 = "drawcircle";
                  break;
                case "line":
                  O2 = "drawline";
                  break;
                case "path":
                  var W2 = L2[V2].path || "";
                  O2 = W2[W2.length - 1] === "Z" ? "drawclosedpath" : "drawopenpath";
              }
            }
            var X2, Y2 = o(O2), K2 = x(T2, A2, C2, I2), q = { editable: true, xref: N2 ? "paper" : E2._id, yref: D2 ? "paper" : F13._id, layer: S2.layer, opacity: S2.opacity, line: { color: S2.line.color, width: S2.line.width, dash: S2.line.dash } };
            if (Y2 || (q.fillcolor = S2.fillcolor, q.fillrule = S2.fillrule), K2.length === 1 && (X2 = K2[0]), X2 && O2 === "drawrect") q.type = "rect", q.x0 = X2[0][1], q.y0 = X2[0][2], q.x1 = X2[2][1], q.y1 = X2[2][2];
            else if (X2 && O2 === "drawline") q.type = "line", q.x0 = X2[0][1], q.y0 = X2[0][2], q.x1 = X2[1][1], q.y1 = X2[1][2];
            else if (X2 && O2 === "drawcircle") {
              q.type = "circle";
              var re = X2[i][1], R2 = X2[l][1], z = X2[u2][1], H2 = X2[c][1], te = X2[i][2], j = X2[l][2], Q2 = X2[u2][2], Z2 = X2[c][2], ne = C2.xaxis && (C2.xaxis.type === "date" || C2.xaxis.type === "log"), ae = C2.yaxis && (C2.yaxis.type === "date" || C2.yaxis.type === "log");
              ne && (re = v(C2.xaxis, re), R2 = v(C2.xaxis, R2), z = v(C2.xaxis, z), H2 = v(C2.xaxis, H2)), ae && (te = v(C2.yaxis, te), j = v(C2.yaxis, j), Q2 = v(C2.yaxis, Q2), Z2 = v(C2.yaxis, Z2));
              var ue = (R2 + H2) / 2, le = (te + Q2) / 2, ce = y({ x0: ue, y0: le, x1: ue + (H2 - R2 + z - re) / 2 * f, y1: le + (Z2 - j + Q2 - te) / 2 * h });
              ne && (ce.x0 = d(C2.xaxis, ce.x0), ce.x1 = d(C2.xaxis, ce.x1)), ae && (ce.y0 = d(C2.yaxis, ce.y0), ce.y1 = d(C2.yaxis, ce.y1)), q.x0 = ce.x0, q.y0 = ce.y0, q.x1 = ce.x1, q.y1 = ce.y1;
            } else q.type = "path", E2 && F13 && function(pe, ve, Ee) {
              var Se = ve.type === "date", Ce = Ee.type === "date";
              if (!Se && !Ce) return pe;
              for (var Be = 0; Be < pe.length; Be++) for (var Ue = 0; Ue < pe[Be].length; Ue++) for (var Ke = 0; Ke + 2 < pe[Be][Ue].length; Ke += 2) Se && (pe[Be][Ue][Ke + 1] = pe[Be][Ue][Ke + 1].replace(" ", "_")), Ce && (pe[Be][Ue][Ke + 2] = pe[Be][Ue][Ke + 2].replace(" ", "_"));
            }(K2, E2, F13), q.path = b(K2), X2 = null;
            m(A2);
            for (var se = _4.editHelpers, he = (se || {}).modifyItem, me = [], we = 0; we < L2.length; we++) {
              var be = A2._fullLayout.shapes[we];
              if (me[we] = be._input, I2 !== void 0 && we === A2._fullLayout._activeShapeIndex) {
                var Ae = q;
                switch (be.type) {
                  case "line":
                  case "rect":
                  case "circle":
                    he("x0", Ae.x0), he("x1", Ae.x1), he("y0", Ae.y0), he("y1", Ae.y1);
                    break;
                  case "path":
                    he("path", Ae.path);
                }
              }
            }
            return I2 === void 0 ? (me.push(q), me) : se ? se.getUpdateObj() : {};
          }
        }
      };
    }, { "../../../plots/cartesian/handle_outline": 565, "../../../plots/cartesian/helpers": 566, "../../dragelement/helpers": 384, "./constants": 452, "./helpers": 455 }], 457: [function(e, t, r) {
      "use strict";
      var n = e("./constants"), a = e("../../lib");
      r.rangeToShapePosition = function(o) {
        return o.type === "log" ? o.r2d : function(s) {
          return s;
        };
      }, r.shapePositionToRange = function(o) {
        return o.type === "log" ? o.d2r : function(s) {
          return s;
        };
      }, r.decodeDate = function(o) {
        return function(s) {
          return s.replace && (s = s.replace("_", " ")), o(s);
        };
      }, r.encodeDate = function(o) {
        return function(s) {
          return o(s).replace(" ", "_");
        };
      }, r.extractPathCoords = function(o, s) {
        var i = [];
        return o.match(n.segmentRE).forEach(function(l) {
          var u2 = s[l.charAt(0)].drawn;
          if (u2 !== void 0) {
            var c = l.substr(1).match(n.paramRE);
            !c || c.length < u2 || i.push(a.cleanNumber(c[u2]));
          }
        }), i;
      }, r.getDataToPixel = function(o, s, i, l) {
        var u2, c = o._fullLayout._size;
        if (s) if (l === "domain") u2 = function(h) {
          return s._length * (i ? 1 - h : h) + s._offset;
        };
        else {
          var f = r.shapePositionToRange(s);
          u2 = function(h) {
            return s._offset + s.r2p(f(h, true));
          }, s.type === "date" && (u2 = r.decodeDate(u2));
        }
        else u2 = i ? function(h) {
          return c.t + c.h * (1 - h);
        } : function(h) {
          return c.l + c.w * h;
        };
        return u2;
      }, r.getPixelToData = function(o, s, i, l) {
        var u2, c = o._fullLayout._size;
        if (s) if (l === "domain") u2 = function(h) {
          var p = (h - s._offset) / s._length;
          return i ? 1 - p : p;
        };
        else {
          var f = r.rangeToShapePosition(s);
          u2 = function(h) {
            return f(s.p2r(h - s._offset));
          };
        }
        else u2 = i ? function(h) {
          return 1 - (h - c.t) / c.h;
        } : function(h) {
          return (h - c.l) / c.w;
        };
        return u2;
      }, r.roundPositionForSharpStrokeRendering = function(o, s) {
        var i = Math.round(s % 2) === 1, l = Math.round(o);
        return i ? l + 0.5 : l;
      }, r.makeOptionsAndPlotinfo = function(o, s) {
        var i = o._fullLayout.shapes[s] || {}, l = o._fullLayout._plots[i.xref + i.yref];
        return l ? l._hadPlotinfo = true : (l = {}, i.xref && i.xref !== "paper" && (l.xaxis = o._fullLayout[i.xref + "axis"]), i.yref && i.yref !== "paper" && (l.yaxis = o._fullLayout[i.yref + "axis"])), l.xsizemode = i.xsizemode, l.ysizemode = i.ysizemode, l.xanchor = i.xanchor, l.yanchor = i.yanchor, { options: i, plotinfo: l };
      };
    }, { "../../lib": 503, "./constants": 448 }], 458: [function(e, t, r) {
      "use strict";
      var n = e("./draw");
      t.exports = { moduleType: "component", name: "shapes", layoutAttributes: e("./attributes"), supplyLayoutDefaults: e("./defaults"), supplyDrawNewShapeDefaults: e("./draw_newshape/defaults"), includeBasePlot: e("../../plots/cartesian/include_components")("shapes"), calcAutorange: e("./calc_autorange"), draw: n.draw, drawOne: n.drawOne };
    }, { "../../plots/cartesian/include_components": 567, "./attributes": 446, "./calc_autorange": 447, "./defaults": 449, "./draw": 450, "./draw_newshape/defaults": 453 }], 459: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/font_attributes"), a = e("../../plots/pad_attributes"), o = e("../../lib/extend").extendDeepAll, s = e("../../plot_api/edit_types").overrideAll, i = e("../../plots/animation_attributes"), l = e("../../plot_api/plot_template").templatedArray, u2 = e("./constants"), c = l("step", { visible: { valType: "boolean", dflt: true }, method: { valType: "enumerated", values: ["restyle", "relayout", "animate", "update", "skip"], dflt: "restyle" }, args: { valType: "info_array", freeLength: true, items: [{ valType: "any" }, { valType: "any" }, { valType: "any" }] }, label: { valType: "string" }, value: { valType: "string" }, execute: { valType: "boolean", dflt: true } });
      t.exports = s(l("slider", { visible: { valType: "boolean", dflt: true }, active: { valType: "number", min: 0, dflt: 0 }, steps: c, lenmode: { valType: "enumerated", values: ["fraction", "pixels"], dflt: "fraction" }, len: { valType: "number", min: 0, dflt: 1 }, x: { valType: "number", min: -2, max: 3, dflt: 0 }, pad: o(a({ editType: "arraydraw" }), {}, { t: { dflt: 20 } }), xanchor: { valType: "enumerated", values: ["auto", "left", "center", "right"], dflt: "left" }, y: { valType: "number", min: -2, max: 3, dflt: 0 }, yanchor: { valType: "enumerated", values: ["auto", "top", "middle", "bottom"], dflt: "top" }, transition: { duration: { valType: "number", min: 0, dflt: 150 }, easing: { valType: "enumerated", values: i.transition.easing.values, dflt: "cubic-in-out" } }, currentvalue: { visible: { valType: "boolean", dflt: true }, xanchor: { valType: "enumerated", values: ["left", "center", "right"], dflt: "left" }, offset: { valType: "number", dflt: 10 }, prefix: { valType: "string" }, suffix: { valType: "string" }, font: n({}) }, font: n({}), activebgcolor: { valType: "color", dflt: u2.gripBgActiveColor }, bgcolor: { valType: "color", dflt: u2.railBgColor }, bordercolor: { valType: "color", dflt: u2.railBorderColor }, borderwidth: { valType: "number", min: 0, dflt: u2.railBorderWidth }, ticklen: { valType: "number", min: 0, dflt: u2.tickLength }, tickcolor: { valType: "color", dflt: u2.tickColor }, tickwidth: { valType: "number", min: 0, dflt: 1 }, minorticklen: { valType: "number", min: 0, dflt: u2.minorTickLength } }), "arraydraw", "from-root");
    }, { "../../lib/extend": 493, "../../plot_api/edit_types": 536, "../../plot_api/plot_template": 543, "../../plots/animation_attributes": 548, "../../plots/font_attributes": 585, "../../plots/pad_attributes": 618, "./constants": 460 }], 460: [function(e, t, r) {
      "use strict";
      t.exports = { name: "sliders", containerClassName: "slider-container", groupClassName: "slider-group", inputAreaClass: "slider-input-area", railRectClass: "slider-rail-rect", railTouchRectClass: "slider-rail-touch-rect", gripRectClass: "slider-grip-rect", tickRectClass: "slider-tick-rect", inputProxyClass: "slider-input-proxy", labelsClass: "slider-labels", labelGroupClass: "slider-label-group", labelClass: "slider-label", currentValueClass: "slider-current-value", railHeight: 5, menuIndexAttrName: "slider-active-index", autoMarginIdRoot: "slider-", minWidth: 30, minHeight: 30, textPadX: 40, arrowOffsetX: 4, railRadius: 2, railWidth: 5, railBorder: 4, railBorderWidth: 1, railBorderColor: "#bec8d9", railBgColor: "#f8fafc", railInset: 8, stepInset: 10, gripRadius: 10, gripWidth: 20, gripHeight: 20, gripBorder: 20, gripBorderWidth: 1, gripBorderColor: "#bec8d9", gripBgColor: "#f6f8fa", gripBgActiveColor: "#dbdde0", labelPadding: 8, labelOffset: 0, tickWidth: 1, tickColor: "#333", tickOffset: 25, tickLength: 7, minorTickOffset: 25, minorTickColor: "#333", minorTickLength: 4, currentValuePadding: 8, currentValueInset: 0 };
    }, {}], 461: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../plots/array_container_defaults"), o = e("./attributes"), s = e("./constants").name, i = o.steps;
      function l(c, f, h) {
        function p(x, b) {
          return n.coerce(c, f, o, x, b);
        }
        for (var d = a(c, f, { name: "steps", handleItemDefaults: u2 }), v = 0, m = 0; m < d.length; m++) d[m].visible && v++;
        if (v < 2 ? f.visible = false : p("visible")) {
          f._stepCount = v;
          var g = f._visibleSteps = n.filterVisible(d);
          (d[p("active")] || {}).visible || (f.active = g[0]._index), p("x"), p("y"), n.noneOrAll(c, f, ["x", "y"]), p("xanchor"), p("yanchor"), p("len"), p("lenmode"), p("pad.t"), p("pad.r"), p("pad.b"), p("pad.l"), n.coerceFont(p, "font", h.font), p("currentvalue.visible") && (p("currentvalue.xanchor"), p("currentvalue.prefix"), p("currentvalue.suffix"), p("currentvalue.offset"), n.coerceFont(p, "currentvalue.font", f.font)), p("transition.duration"), p("transition.easing"), p("bgcolor"), p("activebgcolor"), p("bordercolor"), p("borderwidth"), p("ticklen"), p("tickwidth"), p("tickcolor"), p("minorticklen");
        }
      }
      function u2(c, f) {
        function h(d, v) {
          return n.coerce(c, f, i, d, v);
        }
        if (c.method === "skip" || Array.isArray(c.args) ? h("visible") : f.visible = false) {
          h("method"), h("args");
          var p = h("label", "step-" + f._index);
          h("value", p), h("execute");
        }
      }
      t.exports = function(c, f) {
        a(c, f, { name: s, handleItemDefaults: l });
      };
    }, { "../../lib": 503, "../../plots/array_container_defaults": 549, "./attributes": 459, "./constants": 460 }], 462: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../plots/plots"), o = e("../color"), s = e("../drawing"), i = e("../../lib"), l = i.strTranslate, u2 = e("../../lib/svg_text_utils"), c = e("../../plot_api/plot_template").arrayEditor, f = e("./constants"), h = e("../../constants/alignment"), p = h.LINE_SPACING, d = h.FROM_TL, v = h.FROM_BR;
      function m(I2) {
        return f.autoMarginIdRoot + I2._index;
      }
      function g(I2) {
        return I2._index;
      }
      function x(I2, O2) {
        var L2 = s.tester.selectAll("g." + f.labelGroupClass).data(O2._visibleSteps);
        L2.enter().append("g").classed(f.labelGroupClass, true);
        var V2 = 0, W2 = 0;
        L2.each(function(te) {
          var j = w(n.select(this), { step: te }, O2).node();
          if (j) {
            var Q2 = s.bBox(j);
            W2 = Math.max(W2, Q2.height), V2 = Math.max(V2, Q2.width);
          }
        }), L2.remove();
        var X2 = O2._dims = {};
        X2.inputAreaWidth = Math.max(f.railWidth, f.gripHeight);
        var Y2 = I2._fullLayout._size;
        X2.lx = Y2.l + Y2.w * O2.x, X2.ly = Y2.t + Y2.h * (1 - O2.y), O2.lenmode === "fraction" ? X2.outerLength = Math.round(Y2.w * O2.len) : X2.outerLength = O2.len, X2.inputAreaStart = 0, X2.inputAreaLength = Math.round(X2.outerLength - O2.pad.l - O2.pad.r);
        var K2 = (X2.inputAreaLength - 2 * f.stepInset) / (O2._stepCount - 1), q = V2 + f.labelPadding;
        if (X2.labelStride = Math.max(1, Math.ceil(q / K2)), X2.labelHeight = W2, X2.currentValueMaxWidth = 0, X2.currentValueHeight = 0, X2.currentValueTotalHeight = 0, X2.currentValueMaxLines = 1, O2.currentvalue.visible) {
          var re = s.tester.append("g");
          L2.each(function(te) {
            var j = b(re, O2, te.label), Q2 = j.node() && s.bBox(j.node()) || { width: 0, height: 0 }, Z2 = u2.lineCount(j);
            X2.currentValueMaxWidth = Math.max(X2.currentValueMaxWidth, Math.ceil(Q2.width)), X2.currentValueHeight = Math.max(X2.currentValueHeight, Math.ceil(Q2.height)), X2.currentValueMaxLines = Math.max(X2.currentValueMaxLines, Z2);
          }), X2.currentValueTotalHeight = X2.currentValueHeight + O2.currentvalue.offset, re.remove();
        }
        X2.height = X2.currentValueTotalHeight + f.tickOffset + O2.ticklen + f.labelOffset + X2.labelHeight + O2.pad.t + O2.pad.b;
        var R2 = "left";
        i.isRightAnchor(O2) && (X2.lx -= X2.outerLength, R2 = "right"), i.isCenterAnchor(O2) && (X2.lx -= X2.outerLength / 2, R2 = "center");
        var z = "top";
        i.isBottomAnchor(O2) && (X2.ly -= X2.height, z = "bottom"), i.isMiddleAnchor(O2) && (X2.ly -= X2.height / 2, z = "middle"), X2.outerLength = Math.ceil(X2.outerLength), X2.height = Math.ceil(X2.height), X2.lx = Math.round(X2.lx), X2.ly = Math.round(X2.ly);
        var H2 = { y: O2.y, b: X2.height * v[z], t: X2.height * d[z] };
        O2.lenmode === "fraction" ? (H2.l = 0, H2.xl = O2.x - O2.len * d[R2], H2.r = 0, H2.xr = O2.x + O2.len * v[R2]) : (H2.x = O2.x, H2.l = X2.outerLength * d[R2], H2.r = X2.outerLength * v[R2]), a.autoMargin(I2, m(O2), H2);
      }
      function b(I2, O2, L2) {
        if (O2.currentvalue.visible) {
          var V2, W2, X2 = O2._dims;
          switch (O2.currentvalue.xanchor) {
            case "right":
              V2 = X2.inputAreaLength - f.currentValueInset - X2.currentValueMaxWidth, W2 = "left";
              break;
            case "center":
              V2 = 0.5 * X2.inputAreaLength, W2 = "middle";
              break;
            default:
              V2 = f.currentValueInset, W2 = "left";
          }
          var Y2 = i.ensureSingle(I2, "text", f.labelClass, function(H2) {
            H2.attr({ "text-anchor": W2, "data-notex": 1 });
          }), K2 = O2.currentvalue.prefix ? O2.currentvalue.prefix : "";
          if (typeof L2 == "string") K2 += L2;
          else {
            var q = O2.steps[O2.active].label, re = O2._gd._fullLayout._meta;
            re && (q = i.templateString(q, re)), K2 += q;
          }
          O2.currentvalue.suffix && (K2 += O2.currentvalue.suffix), Y2.call(s.font, O2.currentvalue.font).text(K2).call(u2.convertToTspans, O2._gd);
          var R2 = u2.lineCount(Y2), z = (X2.currentValueMaxLines + 1 - R2) * O2.currentvalue.font.size * p;
          return u2.positionText(Y2, V2, z), Y2;
        }
      }
      function y(I2, O2, L2) {
        i.ensureSingle(I2, "rect", f.gripRectClass, function(V2) {
          V2.call(A2, O2, I2, L2).style("pointer-events", "all");
        }).attr({ width: f.gripWidth, height: f.gripHeight, rx: f.gripRadius, ry: f.gripRadius }).call(o.stroke, L2.bordercolor).call(o.fill, L2.bgcolor).style("stroke-width", L2.borderwidth + "px");
      }
      function w(I2, O2, L2) {
        var V2 = i.ensureSingle(I2, "text", f.labelClass, function(Y2) {
          Y2.attr({ "text-anchor": "middle", "data-notex": 1 });
        }), W2 = O2.step.label, X2 = L2._gd._fullLayout._meta;
        return X2 && (W2 = i.templateString(W2, X2)), V2.call(s.font, L2.font).text(W2).call(u2.convertToTspans, L2._gd), V2;
      }
      function _4(I2, O2) {
        var L2 = i.ensureSingle(I2, "g", f.labelsClass), V2 = O2._dims, W2 = L2.selectAll("g." + f.labelGroupClass).data(V2.labelSteps);
        W2.enter().append("g").classed(f.labelGroupClass, true), W2.exit().remove(), W2.each(function(X2) {
          var Y2 = n.select(this);
          Y2.call(w, X2, O2), s.setTranslate(Y2, E2(O2, X2.fraction), f.tickOffset + O2.ticklen + O2.font.size * p + f.labelOffset + V2.currentValueTotalHeight);
        });
      }
      function k(I2, O2, L2, V2, W2) {
        var X2 = Math.round(V2 * (L2._stepCount - 1)), Y2 = L2._visibleSteps[X2]._index;
        Y2 !== L2.active && T2(I2, O2, L2, Y2, true, W2);
      }
      function T2(I2, O2, L2, V2, W2, X2) {
        var Y2 = L2.active;
        L2.active = V2, c(I2.layout, f.name, L2).applyUpdate("active", V2);
        var K2 = L2.steps[L2.active];
        O2.call(C2, L2, X2), O2.call(b, L2), I2.emit("plotly_sliderchange", { slider: L2, step: L2.steps[L2.active], interaction: W2, previousActive: Y2 }), K2 && K2.method && W2 && (O2._nextMethod ? (O2._nextMethod.step = K2, O2._nextMethod.doCallback = W2, O2._nextMethod.doTransition = X2) : (O2._nextMethod = { step: K2, doCallback: W2, doTransition: X2 }, O2._nextMethodRaf = window.requestAnimationFrame(function() {
          var q = O2._nextMethod.step;
          q.method && (q.execute && a.executeAPICommand(I2, q.method, q.args), O2._nextMethod = null, O2._nextMethodRaf = null);
        })));
      }
      function A2(I2, O2, L2) {
        var V2 = L2.node(), W2 = n.select(O2);
        function X2() {
          return L2.data()[0];
        }
        function Y2() {
          var K2 = X2();
          O2.emit("plotly_sliderstart", { slider: K2 });
          var q = L2.select("." + f.gripRectClass);
          n.event.stopPropagation(), n.event.preventDefault(), q.call(o.fill, K2.activebgcolor);
          var re = F13(K2, n.mouse(V2)[0]);
          function R2() {
            var H2 = X2(), te = F13(H2, n.mouse(V2)[0]);
            k(O2, L2, H2, te, false);
          }
          function z() {
            var H2 = X2();
            H2._dragging = false, q.call(o.fill, H2.bgcolor), W2.on("mouseup", null), W2.on("mousemove", null), W2.on("touchend", null), W2.on("touchmove", null), O2.emit("plotly_sliderend", { slider: H2, step: H2.steps[H2.active] });
          }
          k(O2, L2, K2, re, true), K2._dragging = true, W2.on("mousemove", R2), W2.on("touchmove", R2), W2.on("mouseup", z), W2.on("touchend", z);
        }
        I2.on("mousedown", Y2), I2.on("touchstart", Y2);
      }
      function S2(I2, O2) {
        var L2 = I2.selectAll("rect." + f.tickRectClass).data(O2._visibleSteps), V2 = O2._dims;
        L2.enter().append("rect").classed(f.tickRectClass, true), L2.exit().remove(), L2.attr({ width: O2.tickwidth + "px", "shape-rendering": "crispEdges" }), L2.each(function(W2, X2) {
          var Y2 = X2 % V2.labelStride == 0, K2 = n.select(this);
          K2.attr({ height: Y2 ? O2.ticklen : O2.minorticklen }).call(o.fill, O2.tickcolor), s.setTranslate(K2, E2(O2, X2 / (O2._stepCount - 1)) - 0.5 * O2.tickwidth, (Y2 ? f.tickOffset : f.minorTickOffset) + V2.currentValueTotalHeight);
        });
      }
      function C2(I2, O2, L2) {
        for (var V2 = I2.select("rect." + f.gripRectClass), W2 = 0, X2 = 0; X2 < O2._stepCount; X2++) if (O2._visibleSteps[X2]._index === O2.active) {
          W2 = X2;
          break;
        }
        var Y2 = E2(O2, W2 / (O2._stepCount - 1));
        if (!O2._invokingCommand) {
          var K2 = V2;
          L2 && O2.transition.duration > 0 && (K2 = K2.transition().duration(O2.transition.duration).ease(O2.transition.easing)), K2.attr("transform", l(Y2 - 0.5 * f.gripWidth, O2._dims.currentValueTotalHeight));
        }
      }
      function E2(I2, O2) {
        var L2 = I2._dims;
        return L2.inputAreaStart + f.stepInset + (L2.inputAreaLength - 2 * f.stepInset) * Math.min(1, Math.max(0, O2));
      }
      function F13(I2, O2) {
        var L2 = I2._dims;
        return Math.min(1, Math.max(0, (O2 - f.stepInset - L2.inputAreaStart) / (L2.inputAreaLength - 2 * f.stepInset - 2 * L2.inputAreaStart)));
      }
      function N2(I2, O2, L2) {
        var V2 = L2._dims, W2 = i.ensureSingle(I2, "rect", f.railTouchRectClass, function(X2) {
          X2.call(A2, O2, I2, L2).style("pointer-events", "all");
        });
        W2.attr({ width: V2.inputAreaLength, height: Math.max(V2.inputAreaWidth, f.tickOffset + L2.ticklen + V2.labelHeight) }).call(o.fill, L2.bgcolor).attr("opacity", 0), s.setTranslate(W2, 0, V2.currentValueTotalHeight);
      }
      function D2(I2, O2) {
        var L2 = O2._dims, V2 = L2.inputAreaLength - 2 * f.railInset, W2 = i.ensureSingle(I2, "rect", f.railRectClass);
        W2.attr({ width: V2, height: f.railWidth, rx: f.railRadius, ry: f.railRadius, "shape-rendering": "crispEdges" }).call(o.stroke, O2.bordercolor).call(o.fill, O2.bgcolor).style("stroke-width", O2.borderwidth + "px"), s.setTranslate(W2, f.railInset, 0.5 * (L2.inputAreaWidth - f.railWidth) + L2.currentValueTotalHeight);
      }
      t.exports = function(I2) {
        var O2 = I2._fullLayout, L2 = function(q, re) {
          for (var R2 = q[f.name], z = [], H2 = 0; H2 < R2.length; H2++) {
            var te = R2[H2];
            te.visible && (te._gd = re, z.push(te));
          }
          return z;
        }(O2, I2), V2 = O2._infolayer.selectAll("g." + f.containerClassName).data(L2.length > 0 ? [0] : []);
        function W2(q) {
          q._commandObserver && (q._commandObserver.remove(), delete q._commandObserver), a.autoMargin(I2, m(q));
        }
        if (V2.enter().append("g").classed(f.containerClassName, true).style("cursor", "ew-resize"), V2.exit().each(function() {
          n.select(this).selectAll("g." + f.groupClassName).each(W2);
        }).remove(), L2.length !== 0) {
          var X2 = V2.selectAll("g." + f.groupClassName).data(L2, g);
          X2.enter().append("g").classed(f.groupClassName, true), X2.exit().each(W2).remove();
          for (var Y2 = 0; Y2 < L2.length; Y2++) {
            var K2 = L2[Y2];
            x(I2, K2);
          }
          X2.each(function(q) {
            var re = n.select(this);
            (function(R2) {
              var z = R2._dims;
              z.labelSteps = [];
              for (var H2 = R2._stepCount, te = 0; te < H2; te += z.labelStride) z.labelSteps.push({ fraction: te / (H2 - 1), step: R2._visibleSteps[te] });
            })(q), a.manageCommandObserver(I2, q, q._visibleSteps, function(R2) {
              var z = re.data()[0];
              z.active !== R2.index && (z._dragging || T2(I2, re, z, R2.index, false, true));
            }), function(R2, z, H2) {
              (H2.steps[H2.active] || {}).visible || (H2.active = H2._visibleSteps[0]._index), z.call(b, H2).call(D2, H2).call(_4, H2).call(S2, H2).call(N2, R2, H2).call(y, R2, H2);
              var te = H2._dims;
              s.setTranslate(z, te.lx + H2.pad.l, te.ly + H2.pad.t), z.call(C2, H2, false), z.call(b, H2);
            }(I2, n.select(this), q);
          });
        }
      };
    }, { "../../constants/alignment": 471, "../../lib": 503, "../../lib/svg_text_utils": 529, "../../plot_api/plot_template": 543, "../../plots/plots": 619, "../color": 366, "../drawing": 388, "./constants": 460, "@plotly/d3": 58 }], 463: [function(e, t, r) {
      "use strict";
      var n = e("./constants");
      t.exports = { moduleType: "component", name: n.name, layoutAttributes: e("./attributes"), supplyLayoutDefaults: e("./defaults"), draw: e("./draw") };
    }, { "./attributes": 459, "./constants": 460, "./defaults": 461, "./draw": 462 }], 464: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("fast-isnumeric"), o = e("../../plots/plots"), s = e("../../registry"), i = e("../../lib"), l = i.strTranslate, u2 = e("../drawing"), c = e("../color"), f = e("../../lib/svg_text_utils"), h = e("../../constants/interactions"), p = e("../../constants/alignment").OPPOSITE_SIDE, d = / [XY][0-9]* /;
      t.exports = { draw: function(v, m, g) {
        var x, b = g.propContainer, y = g.propName, w = g.placeholder, _4 = g.traceIndex, k = g.avoid || {}, T2 = g.attributes, A2 = g.transform, S2 = g.containerGroup, C2 = v._fullLayout, E2 = 1, F13 = false, N2 = b.title, D2 = (N2 && N2.text ? N2.text : "").trim(), I2 = N2 && N2.font ? N2.font : {}, O2 = I2.family, L2 = I2.size, V2 = I2.color;
        y === "title.text" ? x = "titleText" : y.indexOf("axis") !== -1 ? x = "axisTitleText" : y.indexOf(true) && (x = "colorbarTitleText");
        var W2 = v._context.edits[x];
        D2 === "" ? E2 = 0 : D2.replace(d, " % ") === w.replace(d, " % ") && (E2 = 0.2, F13 = true, W2 || (D2 = "")), g._meta ? D2 = i.templateString(D2, g._meta) : C2._meta && (D2 = i.templateString(D2, C2._meta));
        var X2, Y2 = D2 || W2;
        S2 || (S2 = i.ensureSingle(C2._infolayer, "g", "g-" + m), X2 = C2._hColorbarMoveTitle);
        var K2 = S2.selectAll("text").data(Y2 ? [0] : []);
        if (K2.enter().append("text"), K2.text(D2).attr("class", m), K2.exit().remove(), !Y2) return S2;
        function q(z) {
          i.syncOrAsync([re, R2], z);
        }
        function re(z) {
          var H2;
          return !A2 && X2 && (A2 = {}), A2 ? (H2 = "", A2.rotate && (H2 += "rotate(" + [A2.rotate, T2.x, T2.y] + ")"), (A2.offset || X2) && (H2 += l(0, (A2.offset || 0) - (X2 || 0)))) : H2 = null, z.attr("transform", H2), z.style({ "font-family": O2, "font-size": n.round(L2, 2) + "px", fill: c.rgb(V2), opacity: E2 * c.opacity(V2), "font-weight": o.fontWeight }).attr(T2).call(f.convertToTspans, v), o.previousPromises(v);
        }
        function R2(z) {
          var H2 = n.select(z.node().parentNode);
          if (k && k.selection && k.side && D2) {
            H2.attr("transform", null);
            var te = p[k.side], j = k.side === "left" || k.side === "top" ? -1 : 1, Q2 = a(k.pad) ? k.pad : 2, Z2 = u2.bBox(H2.node()), ne = { left: 0, top: 0, right: C2.width, bottom: C2.height }, ae = k.maxShift || j * (ne[k.side] - Z2[k.side]), ue = 0;
            if (ae < 0) ue = ae;
            else {
              var le = k.offsetLeft || 0, ce = k.offsetTop || 0;
              Z2.left -= le, Z2.right -= le, Z2.top -= ce, Z2.bottom -= ce, k.selection.each(function() {
                var he = u2.bBox(this);
                i.bBoxIntersect(Z2, he, Q2) && (ue = Math.max(ue, j * (he[k.side] - Z2[te]) + Q2));
              }), ue = Math.min(ae, ue);
            }
            if (ue > 0 || ae < 0) {
              var se = { left: [-ue, 0], right: [ue, 0], top: [0, -ue], bottom: [0, ue] }[k.side];
              H2.attr("transform", l(se[0], se[1]));
            }
          }
        }
        return K2.call(q), W2 && (D2 ? K2.on(".opacity", null) : (E2 = 0, F13 = true, K2.text(w).on("mouseover.opacity", function() {
          n.select(this).transition().duration(h.SHOW_PLACEHOLDER).style("opacity", 1);
        }).on("mouseout.opacity", function() {
          n.select(this).transition().duration(h.HIDE_PLACEHOLDER).style("opacity", 0);
        })), K2.call(f.makeEditable, { gd: v }).on("edit", function(z) {
          _4 !== void 0 ? s.call("_guiRestyle", v, y, z, _4) : s.call("_guiRelayout", v, y, z);
        }).on("cancel", function() {
          this.text(this.attr("data-unformatted")).call(q);
        }).on("input", function(z) {
          this.text(z || " ").call(f.positionText, T2.x, T2.y);
        })), K2.classed("js-placeholder", F13), S2;
      } };
    }, { "../../constants/alignment": 471, "../../constants/interactions": 478, "../../lib": 503, "../../lib/svg_text_utils": 529, "../../plots/plots": 619, "../../registry": 638, "../color": 366, "../drawing": 388, "@plotly/d3": 58, "fast-isnumeric": 190 }], 465: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/font_attributes"), a = e("../color/attributes"), o = e("../../lib/extend").extendFlat, s = e("../../plot_api/edit_types").overrideAll, i = e("../../plots/pad_attributes"), l = e("../../plot_api/plot_template").templatedArray, u2 = l("button", { visible: { valType: "boolean" }, method: { valType: "enumerated", values: ["restyle", "relayout", "animate", "update", "skip"], dflt: "restyle" }, args: { valType: "info_array", freeLength: true, items: [{ valType: "any" }, { valType: "any" }, { valType: "any" }] }, args2: { valType: "info_array", freeLength: true, items: [{ valType: "any" }, { valType: "any" }, { valType: "any" }] }, label: { valType: "string", dflt: "" }, execute: { valType: "boolean", dflt: true } });
      t.exports = s(l("updatemenu", { _arrayAttrRegexps: [/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/], visible: { valType: "boolean" }, type: { valType: "enumerated", values: ["dropdown", "buttons"], dflt: "dropdown" }, direction: { valType: "enumerated", values: ["left", "right", "up", "down"], dflt: "down" }, active: { valType: "integer", min: -1, dflt: 0 }, showactive: { valType: "boolean", dflt: true }, buttons: u2, x: { valType: "number", min: -2, max: 3, dflt: -0.05 }, xanchor: { valType: "enumerated", values: ["auto", "left", "center", "right"], dflt: "right" }, y: { valType: "number", min: -2, max: 3, dflt: 1 }, yanchor: { valType: "enumerated", values: ["auto", "top", "middle", "bottom"], dflt: "top" }, pad: o(i({ editType: "arraydraw" }), {}), font: n({}), bgcolor: { valType: "color" }, bordercolor: { valType: "color", dflt: a.borderLine }, borderwidth: { valType: "number", min: 0, dflt: 1, editType: "arraydraw" } }), "arraydraw", "from-root");
    }, { "../../lib/extend": 493, "../../plot_api/edit_types": 536, "../../plot_api/plot_template": 543, "../../plots/font_attributes": 585, "../../plots/pad_attributes": 618, "../color/attributes": 365 }], 466: [function(e, t, r) {
      "use strict";
      t.exports = { name: "updatemenus", containerClassName: "updatemenu-container", headerGroupClassName: "updatemenu-header-group", headerClassName: "updatemenu-header", headerArrowClassName: "updatemenu-header-arrow", dropdownButtonGroupClassName: "updatemenu-dropdown-button-group", dropdownButtonClassName: "updatemenu-dropdown-button", buttonClassName: "updatemenu-button", itemRectClassName: "updatemenu-item-rect", itemTextClassName: "updatemenu-item-text", menuIndexAttrName: "updatemenu-active-index", autoMarginIdRoot: "updatemenu-", blankHeaderOpts: { label: "  " }, minWidth: 30, minHeight: 30, textPadX: 24, arrowPadX: 16, rx: 2, ry: 2, textOffsetX: 12, textOffsetY: 3, arrowOffsetX: 4, gapButtonHeader: 5, gapButton: 2, activeColor: "#F4FAFF", hoverColor: "#F4FAFF", arrowSymbol: { left: "\u25C4", right: "\u25BA", up: "\u25B2", down: "\u25BC" } };
    }, {}], 467: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../plots/array_container_defaults"), o = e("./attributes"), s = e("./constants").name, i = o.buttons;
      function l(c, f, h) {
        function p(d, v) {
          return n.coerce(c, f, o, d, v);
        }
        p("visible", a(c, f, { name: "buttons", handleItemDefaults: u2 }).length > 0) && (p("active"), p("direction"), p("type"), p("showactive"), p("x"), p("y"), n.noneOrAll(c, f, ["x", "y"]), p("xanchor"), p("yanchor"), p("pad.t"), p("pad.r"), p("pad.b"), p("pad.l"), n.coerceFont(p, "font", h.font), p("bgcolor", h.paper_bgcolor), p("bordercolor"), p("borderwidth"));
      }
      function u2(c, f) {
        function h(p, d) {
          return n.coerce(c, f, i, p, d);
        }
        h("visible", c.method === "skip" || Array.isArray(c.args)) && (h("method"), h("args"), h("args2"), h("label"), h("execute"));
      }
      t.exports = function(c, f) {
        a(c, f, { name: s, handleItemDefaults: l });
      };
    }, { "../../lib": 503, "../../plots/array_container_defaults": 549, "./attributes": 465, "./constants": 466 }], 468: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../plots/plots"), o = e("../color"), s = e("../drawing"), i = e("../../lib"), l = e("../../lib/svg_text_utils"), u2 = e("../../plot_api/plot_template").arrayEditor, c = e("../../constants/alignment").LINE_SPACING, f = e("./constants"), h = e("./scrollbox");
      function p(E2) {
        return E2._index;
      }
      function d(E2, F13) {
        return +E2.attr(f.menuIndexAttrName) === F13._index;
      }
      function v(E2, F13, N2, D2, I2, O2, L2, V2) {
        F13.active = L2, u2(E2.layout, f.name, F13).applyUpdate("active", L2), F13.type === "buttons" ? g(E2, D2, null, null, F13) : F13.type === "dropdown" && (I2.attr(f.menuIndexAttrName, "-1"), m(E2, D2, I2, O2, F13), V2 || g(E2, D2, I2, O2, F13));
      }
      function m(E2, F13, N2, D2, I2) {
        var O2 = i.ensureSingle(F13, "g", f.headerClassName, function(K2) {
          K2.style("pointer-events", "all");
        }), L2 = I2._dims, V2 = I2.active, W2 = I2.buttons[V2] || f.blankHeaderOpts, X2 = { y: I2.pad.t, yPad: 0, x: I2.pad.l, xPad: 0, index: 0 }, Y2 = { width: L2.headerWidth, height: L2.headerHeight };
        O2.call(x, I2, W2, E2).call(S2, I2, X2, Y2), i.ensureSingle(F13, "text", f.headerArrowClassName, function(K2) {
          K2.attr("text-anchor", "end").call(s.font, I2.font).text(f.arrowSymbol[I2.direction]);
        }).attr({ x: L2.headerWidth - f.arrowOffsetX + I2.pad.l, y: L2.headerHeight / 2 + f.textOffsetY + I2.pad.t }), O2.on("click", function() {
          N2.call(C2, String(d(N2, I2) ? -1 : I2._index)), g(E2, F13, N2, D2, I2);
        }), O2.on("mouseover", function() {
          O2.call(_4);
        }), O2.on("mouseout", function() {
          O2.call(k, I2);
        }), s.setTranslate(F13, L2.lx, L2.ly);
      }
      function g(E2, F13, N2, D2, I2) {
        N2 || (N2 = F13).attr("pointer-events", "all");
        var O2 = function(H2) {
          return +H2.attr(f.menuIndexAttrName) == -1;
        }(N2) && I2.type !== "buttons" ? [] : I2.buttons, L2 = I2.type === "dropdown" ? f.dropdownButtonClassName : f.buttonClassName, V2 = N2.selectAll("g." + L2).data(i.filterVisible(O2)), W2 = V2.enter().append("g").classed(L2, true), X2 = V2.exit();
        I2.type === "dropdown" ? (W2.attr("opacity", "0").transition().attr("opacity", "1"), X2.transition().attr("opacity", "0").remove()) : X2.remove();
        var Y2 = 0, K2 = 0, q = I2._dims, re = ["up", "down"].indexOf(I2.direction) !== -1;
        I2.type === "dropdown" && (re ? K2 = q.headerHeight + f.gapButtonHeader : Y2 = q.headerWidth + f.gapButtonHeader), I2.type === "dropdown" && I2.direction === "up" && (K2 = -f.gapButtonHeader + f.gapButton - q.openHeight), I2.type === "dropdown" && I2.direction === "left" && (Y2 = -f.gapButtonHeader + f.gapButton - q.openWidth);
        var R2 = { x: q.lx + Y2 + I2.pad.l, y: q.ly + K2 + I2.pad.t, yPad: f.gapButton, xPad: f.gapButton, index: 0 }, z = { l: R2.x + I2.borderwidth, t: R2.y + I2.borderwidth };
        V2.each(function(H2, te) {
          var j = n.select(this);
          j.call(x, I2, H2, E2).call(S2, I2, R2), j.on("click", function() {
            n.event.defaultPrevented || (H2.execute && (H2.args2 && I2.active === te ? (v(E2, I2, 0, F13, N2, D2, -1), a.executeAPICommand(E2, H2.method, H2.args2)) : (v(E2, I2, 0, F13, N2, D2, te), a.executeAPICommand(E2, H2.method, H2.args))), E2.emit("plotly_buttonclicked", { menu: I2, button: H2, active: I2.active }));
          }), j.on("mouseover", function() {
            j.call(_4);
          }), j.on("mouseout", function() {
            j.call(k, I2), V2.call(w, I2);
          });
        }), V2.call(w, I2), re ? (z.w = Math.max(q.openWidth, q.headerWidth), z.h = R2.y - z.t) : (z.w = R2.x - z.l, z.h = Math.max(q.openHeight, q.headerHeight)), z.direction = I2.direction, D2 && (V2.size() ? function(H2, te, j, Q2, Z2, ne) {
          var ae, ue, le, ce = Z2.direction, se = ce === "up" || ce === "down", he = Z2._dims, me = Z2.active;
          if (se) for (ue = 0, le = 0; le < me; le++) ue += he.heights[le] + f.gapButton;
          else for (ae = 0, le = 0; le < me; le++) ae += he.widths[le] + f.gapButton;
          Q2.enable(ne, ae, ue), Q2.hbar && Q2.hbar.attr("opacity", "0").transition().attr("opacity", "1"), Q2.vbar && Q2.vbar.attr("opacity", "0").transition().attr("opacity", "1");
        }(0, 0, 0, D2, I2, z) : function(H2) {
          var te = !!H2.hbar, j = !!H2.vbar;
          te && H2.hbar.transition().attr("opacity", "0").each("end", function() {
            te = false, j || H2.disable();
          }), j && H2.vbar.transition().attr("opacity", "0").each("end", function() {
            j = false, te || H2.disable();
          });
        }(D2));
      }
      function x(E2, F13, N2, D2) {
        E2.call(b, F13).call(y, F13, N2, D2);
      }
      function b(E2, F13) {
        i.ensureSingle(E2, "rect", f.itemRectClassName, function(N2) {
          N2.attr({ rx: f.rx, ry: f.ry, "shape-rendering": "crispEdges" });
        }).call(o.stroke, F13.bordercolor).call(o.fill, F13.bgcolor).style("stroke-width", F13.borderwidth + "px");
      }
      function y(E2, F13, N2, D2) {
        var I2 = i.ensureSingle(E2, "text", f.itemTextClassName, function(V2) {
          V2.attr({ "text-anchor": "start", "data-notex": 1 });
        }), O2 = N2.label, L2 = D2._fullLayout._meta;
        L2 && (O2 = i.templateString(O2, L2)), I2.call(s.font, F13.font).text(O2).call(l.convertToTspans, D2);
      }
      function w(E2, F13) {
        var N2 = F13.active;
        E2.each(function(D2, I2) {
          var O2 = n.select(this);
          I2 === N2 && F13.showactive && O2.select("rect." + f.itemRectClassName).call(o.fill, f.activeColor);
        });
      }
      function _4(E2) {
        E2.select("rect." + f.itemRectClassName).call(o.fill, f.hoverColor);
      }
      function k(E2, F13) {
        E2.select("rect." + f.itemRectClassName).call(o.fill, F13.bgcolor);
      }
      function T2(E2, F13) {
        var N2 = F13._dims = { width1: 0, height1: 0, heights: [], widths: [], totalWidth: 0, totalHeight: 0, openWidth: 0, openHeight: 0, lx: 0, ly: 0 }, D2 = s.tester.selectAll("g." + f.dropdownButtonClassName).data(i.filterVisible(F13.buttons));
        D2.enter().append("g").classed(f.dropdownButtonClassName, true);
        var I2 = ["up", "down"].indexOf(F13.direction) !== -1;
        D2.each(function(Y2, K2) {
          var q = n.select(this);
          q.call(x, F13, Y2, E2);
          var re = q.select("." + f.itemTextClassName), R2 = re.node() && s.bBox(re.node()).width, z = Math.max(R2 + f.textPadX, f.minWidth), H2 = F13.font.size * c, te = l.lineCount(re), j = Math.max(H2 * te, f.minHeight) + f.textOffsetY;
          j = Math.ceil(j), z = Math.ceil(z), N2.widths[K2] = z, N2.heights[K2] = j, N2.height1 = Math.max(N2.height1, j), N2.width1 = Math.max(N2.width1, z), I2 ? (N2.totalWidth = Math.max(N2.totalWidth, z), N2.openWidth = N2.totalWidth, N2.totalHeight += j + f.gapButton, N2.openHeight += j + f.gapButton) : (N2.totalWidth += z + f.gapButton, N2.openWidth += z + f.gapButton, N2.totalHeight = Math.max(N2.totalHeight, j), N2.openHeight = N2.totalHeight);
        }), I2 ? N2.totalHeight -= f.gapButton : N2.totalWidth -= f.gapButton, N2.headerWidth = N2.width1 + f.arrowPadX, N2.headerHeight = N2.height1, F13.type === "dropdown" && (I2 ? (N2.width1 += f.arrowPadX, N2.totalHeight = N2.height1) : N2.totalWidth = N2.width1, N2.totalWidth += f.arrowPadX), D2.remove();
        var O2 = N2.totalWidth + F13.pad.l + F13.pad.r, L2 = N2.totalHeight + F13.pad.t + F13.pad.b, V2 = E2._fullLayout._size;
        N2.lx = V2.l + V2.w * F13.x, N2.ly = V2.t + V2.h * (1 - F13.y);
        var W2 = "left";
        i.isRightAnchor(F13) && (N2.lx -= O2, W2 = "right"), i.isCenterAnchor(F13) && (N2.lx -= O2 / 2, W2 = "center");
        var X2 = "top";
        i.isBottomAnchor(F13) && (N2.ly -= L2, X2 = "bottom"), i.isMiddleAnchor(F13) && (N2.ly -= L2 / 2, X2 = "middle"), N2.totalWidth = Math.ceil(N2.totalWidth), N2.totalHeight = Math.ceil(N2.totalHeight), N2.lx = Math.round(N2.lx), N2.ly = Math.round(N2.ly), a.autoMargin(E2, A2(F13), { x: F13.x, y: F13.y, l: O2 * ({ right: 1, center: 0.5 }[W2] || 0), r: O2 * ({ left: 1, center: 0.5 }[W2] || 0), b: L2 * ({ top: 1, middle: 0.5 }[X2] || 0), t: L2 * ({ bottom: 1, middle: 0.5 }[X2] || 0) });
      }
      function A2(E2) {
        return f.autoMarginIdRoot + E2._index;
      }
      function S2(E2, F13, N2, D2) {
        D2 = D2 || {};
        var I2 = E2.select("." + f.itemRectClassName), O2 = E2.select("." + f.itemTextClassName), L2 = F13.borderwidth, V2 = N2.index, W2 = F13._dims;
        s.setTranslate(E2, L2 + N2.x, L2 + N2.y);
        var X2 = ["up", "down"].indexOf(F13.direction) !== -1, Y2 = D2.height || (X2 ? W2.heights[V2] : W2.height1);
        I2.attr({ x: 0, y: 0, width: D2.width || (X2 ? W2.width1 : W2.widths[V2]), height: Y2 });
        var K2 = F13.font.size * c, q = (l.lineCount(O2) - 1) * K2 / 2;
        l.positionText(O2, f.textOffsetX, Y2 / 2 - q + f.textOffsetY), X2 ? N2.y += W2.heights[V2] + N2.yPad : N2.x += W2.widths[V2] + N2.xPad, N2.index++;
      }
      function C2(E2, F13) {
        E2.attr(f.menuIndexAttrName, F13 || "-1").selectAll("g." + f.dropdownButtonClassName).remove();
      }
      t.exports = function(E2) {
        var F13 = E2._fullLayout, N2 = i.filterVisible(F13[f.name]);
        function D2(K2) {
          a.autoMargin(E2, A2(K2));
        }
        var I2 = F13._menulayer.selectAll("g." + f.containerClassName).data(N2.length > 0 ? [0] : []);
        if (I2.enter().append("g").classed(f.containerClassName, true).style("cursor", "pointer"), I2.exit().each(function() {
          n.select(this).selectAll("g." + f.headerGroupClassName).each(D2);
        }).remove(), N2.length !== 0) {
          var O2 = I2.selectAll("g." + f.headerGroupClassName).data(N2, p);
          O2.enter().append("g").classed(f.headerGroupClassName, true);
          for (var L2 = i.ensureSingle(I2, "g", f.dropdownButtonGroupClassName, function(K2) {
            K2.style("pointer-events", "all");
          }), V2 = 0; V2 < N2.length; V2++) {
            var W2 = N2[V2];
            T2(E2, W2);
          }
          var X2 = "updatemenus" + F13._uid, Y2 = new h(E2, L2, X2);
          O2.enter().size() && (L2.node().parentNode.appendChild(L2.node()), L2.call(C2)), O2.exit().each(function(K2) {
            L2.call(C2), D2(K2);
          }).remove(), O2.each(function(K2) {
            var q = n.select(this), re = K2.type === "dropdown" ? L2 : null;
            a.manageCommandObserver(E2, K2, K2.buttons, function(R2) {
              v(E2, K2, K2.buttons[R2.index], q, re, Y2, R2.index, true);
            }), K2.type === "dropdown" ? (m(E2, q, L2, Y2, K2), d(L2, K2) && g(E2, q, L2, Y2, K2)) : g(E2, q, null, null, K2);
          });
        }
      };
    }, { "../../constants/alignment": 471, "../../lib": 503, "../../lib/svg_text_utils": 529, "../../plot_api/plot_template": 543, "../../plots/plots": 619, "../color": 366, "../drawing": 388, "./constants": 466, "./scrollbox": 470, "@plotly/d3": 58 }], 469: [function(e, t, r) {
      arguments[4][463][0].apply(r, arguments);
    }, { "./attributes": 465, "./constants": 466, "./defaults": 467, "./draw": 468, dup: 463 }], 470: [function(e, t, r) {
      "use strict";
      t.exports = i;
      var n = e("@plotly/d3"), a = e("../color"), o = e("../drawing"), s = e("../../lib");
      function i(l, u2, c) {
        this.gd = l, this.container = u2, this.id = c, this.position = null, this.translateX = null, this.translateY = null, this.hbar = null, this.vbar = null, this.bg = this.container.selectAll("rect.scrollbox-bg").data([0]), this.bg.exit().on(".drag", null).on("wheel", null).remove(), this.bg.enter().append("rect").classed("scrollbox-bg", true).style("pointer-events", "all").attr({ opacity: 0, x: 0, y: 0, width: 0, height: 0 });
      }
      i.barWidth = 2, i.barLength = 20, i.barRadius = 2, i.barPad = 1, i.barColor = "#808BA4", i.prototype.enable = function(l, u2, c) {
        var f = this.gd._fullLayout, h = f.width, p = f.height;
        this.position = l;
        var d, v, m, g, x = this.position.l, b = this.position.w, y = this.position.t, w = this.position.h, _4 = this.position.direction, k = _4 === "down", T2 = _4 === "left", A2 = _4 === "up", S2 = b, C2 = w;
        k || T2 || _4 === "right" || A2 || (this.position.direction = "down", k = true), k || A2 ? (v = (d = x) + S2, k ? (m = y, C2 = (g = Math.min(m + C2, p)) - m) : C2 = (g = y + C2) - (m = Math.max(g - C2, 0))) : (g = (m = y) + C2, T2 ? S2 = (v = x + S2) - (d = Math.max(v - S2, 0)) : (d = x, S2 = (v = Math.min(d + S2, h)) - d)), this._box = { l: d, t: m, w: S2, h: C2 };
        var E2 = b > S2, F13 = i.barLength + 2 * i.barPad, N2 = i.barWidth + 2 * i.barPad, D2 = x, I2 = y + w;
        I2 + N2 > p && (I2 = p - N2);
        var O2 = this.container.selectAll("rect.scrollbar-horizontal").data(E2 ? [0] : []);
        O2.exit().on(".drag", null).remove(), O2.enter().append("rect").classed("scrollbar-horizontal", true).call(a.fill, i.barColor), E2 ? (this.hbar = O2.attr({ rx: i.barRadius, ry: i.barRadius, x: D2, y: I2, width: F13, height: N2 }), this._hbarXMin = D2 + F13 / 2, this._hbarTranslateMax = S2 - F13) : (delete this.hbar, delete this._hbarXMin, delete this._hbarTranslateMax);
        var L2 = w > C2, V2 = i.barWidth + 2 * i.barPad, W2 = i.barLength + 2 * i.barPad, X2 = x + b, Y2 = y;
        X2 + V2 > h && (X2 = h - V2);
        var K2 = this.container.selectAll("rect.scrollbar-vertical").data(L2 ? [0] : []);
        K2.exit().on(".drag", null).remove(), K2.enter().append("rect").classed("scrollbar-vertical", true).call(a.fill, i.barColor), L2 ? (this.vbar = K2.attr({ rx: i.barRadius, ry: i.barRadius, x: X2, y: Y2, width: V2, height: W2 }), this._vbarYMin = Y2 + W2 / 2, this._vbarTranslateMax = C2 - W2) : (delete this.vbar, delete this._vbarYMin, delete this._vbarTranslateMax);
        var q = this.id, re = d - 0.5, R2 = L2 ? v + V2 + 0.5 : v + 0.5, z = m - 0.5, H2 = E2 ? g + N2 + 0.5 : g + 0.5, te = f._topdefs.selectAll("#" + q).data(E2 || L2 ? [0] : []);
        if (te.exit().remove(), te.enter().append("clipPath").attr("id", q).append("rect"), E2 || L2 ? (this._clipRect = te.select("rect").attr({ x: Math.floor(re), y: Math.floor(z), width: Math.ceil(R2) - Math.floor(re), height: Math.ceil(H2) - Math.floor(z) }), this.container.call(o.setClipUrl, q, this.gd), this.bg.attr({ x, y, width: b, height: w })) : (this.bg.attr({ width: 0, height: 0 }), this.container.on("wheel", null).on(".drag", null).call(o.setClipUrl, null), delete this._clipRect), E2 || L2) {
          var j = n.behavior.drag().on("dragstart", function() {
            n.event.sourceEvent.preventDefault();
          }).on("drag", this._onBoxDrag.bind(this));
          this.container.on("wheel", null).on("wheel", this._onBoxWheel.bind(this)).on(".drag", null).call(j);
          var Q2 = n.behavior.drag().on("dragstart", function() {
            n.event.sourceEvent.preventDefault(), n.event.sourceEvent.stopPropagation();
          }).on("drag", this._onBarDrag.bind(this));
          E2 && this.hbar.on(".drag", null).call(Q2), L2 && this.vbar.on(".drag", null).call(Q2);
        }
        this.setTranslate(u2, c);
      }, i.prototype.disable = function() {
        (this.hbar || this.vbar) && (this.bg.attr({ width: 0, height: 0 }), this.container.on("wheel", null).on(".drag", null).call(o.setClipUrl, null), delete this._clipRect), this.hbar && (this.hbar.on(".drag", null), this.hbar.remove(), delete this.hbar, delete this._hbarXMin, delete this._hbarTranslateMax), this.vbar && (this.vbar.on(".drag", null), this.vbar.remove(), delete this.vbar, delete this._vbarYMin, delete this._vbarTranslateMax);
      }, i.prototype._onBoxDrag = function() {
        var l = this.translateX, u2 = this.translateY;
        this.hbar && (l -= n.event.dx), this.vbar && (u2 -= n.event.dy), this.setTranslate(l, u2);
      }, i.prototype._onBoxWheel = function() {
        var l = this.translateX, u2 = this.translateY;
        this.hbar && (l += n.event.deltaY), this.vbar && (u2 += n.event.deltaY), this.setTranslate(l, u2);
      }, i.prototype._onBarDrag = function() {
        var l = this.translateX, u2 = this.translateY;
        if (this.hbar) {
          var c = l + this._hbarXMin, f = c + this._hbarTranslateMax;
          l = (s.constrain(n.event.x, c, f) - c) / (f - c) * (this.position.w - this._box.w);
        }
        if (this.vbar) {
          var h = u2 + this._vbarYMin, p = h + this._vbarTranslateMax;
          u2 = (s.constrain(n.event.y, h, p) - h) / (p - h) * (this.position.h - this._box.h);
        }
        this.setTranslate(l, u2);
      }, i.prototype.setTranslate = function(l, u2) {
        var c = this.position.w - this._box.w, f = this.position.h - this._box.h;
        if (l = s.constrain(l || 0, 0, c), u2 = s.constrain(u2 || 0, 0, f), this.translateX = l, this.translateY = u2, this.container.call(o.setTranslate, this._box.l - this.position.l - l, this._box.t - this.position.t - u2), this._clipRect && this._clipRect.attr({ x: Math.floor(this.position.l + l - 0.5), y: Math.floor(this.position.t + u2 - 0.5) }), this.hbar) {
          var h = l / c;
          this.hbar.call(o.setTranslate, l + h * this._hbarTranslateMax, u2);
        }
        if (this.vbar) {
          var p = u2 / f;
          this.vbar.call(o.setTranslate, l, u2 + p * this._vbarTranslateMax);
        }
      };
    }, { "../../lib": 503, "../color": 366, "../drawing": 388, "@plotly/d3": 58 }], 471: [function(e, t, r) {
      "use strict";
      t.exports = { FROM_BL: { left: 0, center: 0.5, right: 1, bottom: 0, middle: 0.5, top: 1 }, FROM_TL: { left: 0, center: 0.5, right: 1, bottom: 1, middle: 0.5, top: 0 }, FROM_BR: { left: 1, center: 0.5, right: 0, bottom: 0, middle: 0.5, top: 1 }, LINE_SPACING: 1.3, CAP_SHIFT: 0.7, MID_SHIFT: 0.35, OPPOSITE_SIDE: { left: "right", right: "left", top: "bottom", bottom: "top" } };
    }, {}], 472: [function(e, t, r) {
      "use strict";
      t.exports = { axisRefDescription: function(n, a, o) {
        return ["If set to a", n, "axis id (e.g. *" + n + "* or", "*" + n + "2*), the `" + n + "` position refers to a", n, "coordinate. If set to *paper*, the `" + n + "`", "position refers to the distance from the", a, "of the plotting", "area in normalized coordinates where *0* (*1*) corresponds to the", a, "(" + o + "). If set to a", n, "axis ID followed by", "*domain* (separated by a space), the position behaves like for", "*paper*, but refers to the distance in fractions of the domain", "length from the", a, "of the domain of that axis: e.g.,", "*" + n + "2 domain* refers to the domain of the second", n, " axis and a", n, "position of 0.5 refers to the", "point between the", a, "and the", o, "of the domain of the", "second", n, "axis."].join(" ");
      } };
    }, {}], 473: [function(e, t, r) {
      "use strict";
      t.exports = { INCREASING: { COLOR: "#3D9970", SYMBOL: "\u25B2" }, DECREASING: { COLOR: "#FF4136", SYMBOL: "\u25BC" } };
    }, {}], 474: [function(e, t, r) {
      "use strict";
      t.exports = { FORMAT_LINK: "https://github.com/d3/d3-format/tree/v1.4.5#d3-format", DATE_FORMAT_LINK: "https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format" };
    }, {}], 475: [function(e, t, r) {
      "use strict";
      t.exports = { COMPARISON_OPS: ["=", "!=", "<", ">=", ">", "<="], COMPARISON_OPS2: ["=", "<", ">=", ">", "<="], INTERVAL_OPS: ["[]", "()", "[)", "(]", "][", ")(", "](", ")["], SET_OPS: ["{}", "}{"], CONSTRAINT_REDUCTION: { "=": "=", "<": "<", "<=": "<", ">": ">", ">=": ">", "[]": "[]", "()": "[]", "[)": "[]", "(]": "[]", "][": "][", ")(": "][", "](": "][", ")[": "][" } };
    }, {}], 476: [function(e, t, r) {
      "use strict";
      t.exports = { solid: [[], 0], dot: [[0.5, 1], 200], dash: [[0.5, 1], 50], longdash: [[0.5, 1], 10], dashdot: [[0.5, 0.625, 0.875, 1], 50], longdashdot: [[0.5, 0.7, 0.8, 1], 10] };
    }, {}], 477: [function(e, t, r) {
      "use strict";
      t.exports = { circle: "\u25CF", "circle-open": "\u25CB", square: "\u25A0", "square-open": "\u25A1", diamond: "\u25C6", "diamond-open": "\u25C7", cross: "+", x: "\u274C" };
    }, {}], 478: [function(e, t, r) {
      "use strict";
      t.exports = { SHOW_PLACEHOLDER: 100, HIDE_PLACEHOLDER: 1e3, DESELECTDIM: 0.2 };
    }, {}], 479: [function(e, t, r) {
      "use strict";
      t.exports = { BADNUM: void 0, FP_SAFE: 1e-4 * Number.MAX_VALUE, ONEMAXYEAR: 316224e5, ONEAVGYEAR: 315576e5, ONEMINYEAR: 31536e6, ONEMAXQUARTER: 79488e5, ONEAVGQUARTER: 78894e5, ONEMINQUARTER: 76896e5, ONEMAXMONTH: 26784e5, ONEAVGMONTH: 26298e5, ONEMINMONTH: 24192e5, ONEWEEK: 6048e5, ONEDAY: 864e5, ONEHOUR: 36e5, ONEMIN: 6e4, ONESEC: 1e3, EPOCHJD: 24405875e-1, ALMOST_EQUAL: 0.999999, LOG_CLIP: 10, MINUS_SIGN: "\u2212" };
    }, {}], 480: [function(e, t, r) {
      "use strict";
      r.xmlns = "http://www.w3.org/2000/xmlns/", r.svg = "http://www.w3.org/2000/svg", r.xlink = "http://www.w3.org/1999/xlink", r.svgAttrs = { xmlns: r.svg, "xmlns:xlink": r.xlink };
    }, {}], 481: [function(e, t, r) {
      "use strict";
      r.version = e("./version").version, e("native-promise-only"), e("../build/plotcss");
      for (var n = e("./registry"), a = r.register = n.register, o = e("./plot_api"), s = Object.keys(o), i = 0; i < s.length; i++) {
        var l = s[i];
        l.charAt(0) !== "_" && (r[l] = o[l]), a({ moduleType: "apiMethod", name: l, fn: o[l] });
      }
      a(e("./traces/scatter")), a([e("./components/legend"), e("./components/fx"), e("./components/annotations"), e("./components/annotations3d"), e("./components/shapes"), e("./components/images"), e("./components/updatemenus"), e("./components/sliders"), e("./components/rangeslider"), e("./components/rangeselector"), e("./components/grid"), e("./components/errorbars"), e("./components/colorscale"), e("./components/colorbar"), e("./components/modebar")]), a([e("./locale-en"), e("./locale-en-us")]), window.PlotlyLocales && Array.isArray(window.PlotlyLocales) && (a(window.PlotlyLocales), delete window.PlotlyLocales), r.Icons = e("./fonts/ploticon");
      var u2 = e("./components/fx"), c = e("./plots/plots");
      r.Plots = { resize: c.resize, graphJson: c.graphJson, sendDataToCloud: c.sendDataToCloud }, r.Fx = { hover: u2.hover, unhover: u2.unhover, loneHover: u2.loneHover, loneUnhover: u2.loneUnhover }, r.Snapshot = e("./snapshot"), r.PlotSchema = e("./plot_api/plot_schema");
    }, { "../build/plotcss": 1, "./components/annotations": 357, "./components/annotations3d": 362, "./components/colorbar": 372, "./components/colorscale": 378, "./components/errorbars": 394, "./components/fx": 406, "./components/grid": 410, "./components/images": 415, "./components/legend": 423, "./components/modebar": 429, "./components/rangeselector": 437, "./components/rangeslider": 444, "./components/shapes": 458, "./components/sliders": 463, "./components/updatemenus": 469, "./fonts/ploticon": 482, "./locale-en": 534, "./locale-en-us": 533, "./plot_api": 538, "./plot_api/plot_schema": 542, "./plots/plots": 619, "./registry": 638, "./snapshot": 643, "./traces/scatter": 938, "./version": 1119, "native-promise-only": 245 }], 482: [function(e, t, r) {
      "use strict";
      t.exports = { undo: { width: 857.1, height: 1e3, 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", transform: "matrix(1 0 0 -1 0 850)" }, home: { width: 928.6, height: 1e3, 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", transform: "matrix(1 0 0 -1 0 850)" }, "camera-retro": { width: 1e3, height: 1e3, 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", transform: "matrix(1 0 0 -1 0 850)" }, zoombox: { width: 1e3, height: 1e3, 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", transform: "matrix(1 0 0 -1 0 850)" }, pan: { width: 1e3, height: 1e3, 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", transform: "matrix(1 0 0 -1 0 850)" }, zoom_plus: { width: 875, height: 1e3, 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", transform: "matrix(1 0 0 -1 0 850)" }, zoom_minus: { width: 875, height: 1e3, path: "m0 788l0-876 875 0 0 876-875 0z m688-500l-500 0 0 125 500 0 0-125z", transform: "matrix(1 0 0 -1 0 850)" }, autoscale: { width: 1e3, height: 1e3, 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", transform: "matrix(1 0 0 -1 0 850)" }, tooltip_basic: { width: 1500, height: 1e3, path: "m375 725l0 0-375-375 375-374 0-1 1125 0 0 750-1125 0z", transform: "matrix(1 0 0 -1 0 850)" }, tooltip_compare: { width: 1125, height: 1e3, 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", transform: "matrix(1 0 0 -1 0 850)" }, plotlylogo: { width: 1542, height: 1e3, 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", transform: "matrix(1 0 0 -1 0 850)" }, "z-axis": { width: 1e3, height: 1e3, 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", transform: "matrix(1 0 0 -1 0 850)" }, "3d_rotate": { width: 1e3, height: 1e3, 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", transform: "matrix(1 0 0 -1 0 850)" }, camera: { width: 1e3, height: 1e3, 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", transform: "matrix(1 0 0 -1 0 850)" }, movie: { width: 1e3, height: 1e3, 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", transform: "matrix(1 0 0 -1 0 850)" }, question: { width: 857.1, height: 1e3, 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", transform: "matrix(1 0 0 -1 0 850)" }, disk: { width: 857.1, height: 1e3, 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", transform: "matrix(1 0 0 -1 0 850)" }, drawopenpath: { width: 70, height: 70, 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", transform: "matrix(1 0 0 1 -15 -15)" }, drawclosedpath: { width: 90, height: 90, 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", transform: "matrix(1 0 0 1 -5 -5)" }, lasso: { width: 1031, height: 1e3, 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", transform: "matrix(1 0 0 -1 0 850)" }, selectbox: { width: 1e3, height: 1e3, 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", transform: "matrix(1 0 0 -1 0 850)" }, drawline: { width: 70, height: 70, 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", transform: "matrix(1 0 0 1 -15 -15)" }, drawrect: { width: 80, height: 80, path: "M78,22V79H21V22H78m9-9H12V88H87V13ZM68,46.22H31V54H68ZM53,32H45.22V69H53Z", transform: "matrix(1 0 0 1 -10 -10)" }, drawcircle: { width: 80, height: 80, 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", transform: "matrix(1 0 0 1 -10 -10)" }, eraseshape: { width: 80, height: 80, 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", transform: "matrix(1 0 0 1 -10 -10)" }, spikeline: { width: 1e3, height: 1e3, 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", transform: "matrix(1.5 0 0 -1.5 0 850)" }, pencil: { width: 1792, height: 1792, 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", transform: "matrix(1 0 0 1 0 1)" }, newplotlylogo: { name: "newplotlylogo", svg: "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 132 132'><defs><style>.cls-1 {fill: #3f4f75;} .cls-2 {fill: #80cfbe;} .cls-3 {fill: #fff;}</style></defs><title>plotly-logomark</title><g id='symbol'><rect class='cls-1' width='132' height='132' rx='6' ry='6'/><circle class='cls-2' cx='78' cy='54' r='6'/><circle class='cls-2' cx='102' cy='30' r='6'/><circle class='cls-2' cx='78' cy='30' r='6'/><circle class='cls-2' cx='54' cy='30' r='6'/><circle class='cls-2' cx='30' cy='30' r='6'/><circle class='cls-2' cx='30' cy='54' r='6'/><path class='cls-3' d='M30,72a6,6,0,0,0-6,6v24a6,6,0,0,0,12,0V78A6,6,0,0,0,30,72Z'/><path class='cls-3' d='M78,72a6,6,0,0,0-6,6v24a6,6,0,0,0,12,0V78A6,6,0,0,0,78,72Z'/><path class='cls-3' d='M54,48a6,6,0,0,0-6,6v48a6,6,0,0,0,12,0V54A6,6,0,0,0,54,48Z'/><path class='cls-3' d='M102,48a6,6,0,0,0-6,6v48a6,6,0,0,0,12,0V54A6,6,0,0,0,102,48Z'/></g></svg>" } };
    }, {}], 483: [function(e, t, r) {
      "use strict";
      r.isLeftAnchor = function(n) {
        return n.xanchor === "left" || n.xanchor === "auto" && n.x <= 1 / 3;
      }, r.isCenterAnchor = function(n) {
        return n.xanchor === "center" || n.xanchor === "auto" && n.x > 1 / 3 && n.x < 2 / 3;
      }, r.isRightAnchor = function(n) {
        return n.xanchor === "right" || n.xanchor === "auto" && n.x >= 2 / 3;
      }, r.isTopAnchor = function(n) {
        return n.yanchor === "top" || n.yanchor === "auto" && n.y >= 2 / 3;
      }, r.isMiddleAnchor = function(n) {
        return n.yanchor === "middle" || n.yanchor === "auto" && n.y > 1 / 3 && n.y < 2 / 3;
      }, r.isBottomAnchor = function(n) {
        return n.yanchor === "bottom" || n.yanchor === "auto" && n.y <= 1 / 3;
      };
    }, {}], 484: [function(e, t, r) {
      "use strict";
      var n = e("./mod"), a = n.mod, o = n.modHalf, s = Math.PI, i = 2 * s;
      function l(h) {
        return Math.abs(h[1] - h[0]) > i - 1e-14;
      }
      function u2(h, p) {
        return o(p - h, i);
      }
      function c(h, p) {
        if (l(p)) return true;
        var d, v;
        p[0] < p[1] ? (d = p[0], v = p[1]) : (d = p[1], v = p[0]), (d = a(d, i)) > (v = a(v, i)) && (v += i);
        var m = a(h, i), g = m + i;
        return m >= d && m <= v || g >= d && g <= v;
      }
      function f(h, p, d, v, m, g, x) {
        m = m || 0, g = g || 0;
        var b, y, w, _4, k, T2 = l([d, v]);
        function A2(F13, N2) {
          return [F13 * Math.cos(N2) + m, g - F13 * Math.sin(N2)];
        }
        T2 ? (b = 0, y = s, w = i) : d < v ? (b = d, w = v) : (b = v, w = d), h < p ? (_4 = h, k = p) : (_4 = p, k = h);
        var S2, C2 = Math.abs(w - b) <= s ? 0 : 1;
        function E2(F13, N2, D2) {
          return "A" + [F13, F13] + " " + [0, C2, D2] + " " + A2(F13, N2);
        }
        return T2 ? S2 = _4 === null ? "M" + A2(k, b) + E2(k, y, 0) + E2(k, w, 0) + "Z" : "M" + A2(_4, b) + E2(_4, y, 0) + E2(_4, w, 0) + "ZM" + A2(k, b) + E2(k, y, 1) + E2(k, w, 1) + "Z" : _4 === null ? (S2 = "M" + A2(k, b) + E2(k, w, 0), x && (S2 += "L0,0Z")) : S2 = "M" + A2(_4, b) + "L" + A2(k, b) + E2(k, w, 0) + "L" + A2(_4, w) + E2(_4, b, 1) + "Z", S2;
      }
      t.exports = { deg2rad: function(h) {
        return h / 180 * s;
      }, rad2deg: function(h) {
        return h / s * 180;
      }, angleDelta: u2, angleDist: function(h, p) {
        return Math.abs(u2(h, p));
      }, isFullCircle: l, isAngleInsideSector: c, isPtInsideSector: function(h, p, d, v) {
        return !!c(p, v) && (d[0] < d[1] ? (m = d[0], g = d[1]) : (m = d[1], g = d[0]), h >= m && h <= g);
        var m, g;
      }, pathArc: function(h, p, d, v, m) {
        return f(null, h, p, d, v, m, 0);
      }, pathSector: function(h, p, d, v, m) {
        return f(null, h, p, d, v, m, 1);
      }, pathAnnulus: function(h, p, d, v, m, g) {
        return f(h, p, d, v, m, g, 1);
      } };
    }, { "./mod": 510 }], 485: [function(e, t, r) {
      "use strict";
      var n = Array.isArray, a = ArrayBuffer, o = DataView;
      function s(u2) {
        return a.isView(u2) && !(u2 instanceof o);
      }
      function i(u2) {
        return n(u2) || s(u2);
      }
      function l(u2, c, f) {
        if (i(u2)) {
          if (i(u2[0])) {
            for (var h = f, p = 0; p < u2.length; p++) h = c(h, u2[p].length);
            return h;
          }
          return u2.length;
        }
        return 0;
      }
      r.isTypedArray = s, r.isArrayOrTypedArray = i, r.isArray1D = function(u2) {
        return !i(u2[0]);
      }, r.ensureArray = function(u2, c) {
        return n(u2) || (u2 = []), u2.length = c, u2;
      }, r.concat = function() {
        var u2, c, f, h, p, d, v, m, g = [], x = true, b = 0;
        for (f = 0; f < arguments.length; f++) (d = (h = arguments[f]).length) && (c ? g.push(h) : (c = h, p = d), n(h) ? u2 = false : (x = false, b ? u2 !== h.constructor && (u2 = false) : u2 = h.constructor), b += d);
        if (!b) return [];
        if (!g.length) return c;
        if (x) return c.concat.apply(c, g);
        if (u2) {
          for ((v = new u2(b)).set(c), f = 0; f < g.length; f++) h = g[f], v.set(h, p), p += h.length;
          return v;
        }
        for (v = new Array(b), m = 0; m < c.length; m++) v[m] = c[m];
        for (f = 0; f < g.length; f++) {
          for (h = g[f], m = 0; m < h.length; m++) v[p + m] = h[m];
          p += m;
        }
        return v;
      }, r.maxRowLength = function(u2) {
        return l(u2, Math.max, 0);
      }, r.minRowLength = function(u2) {
        return l(u2, Math.min, 1 / 0);
      };
    }, {}], 486: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("../constants/numerical").BADNUM, o = /^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g;
      t.exports = function(s) {
        return typeof s == "string" && (s = s.replace(o, "")), n(s) ? Number(s) : a;
      };
    }, { "../constants/numerical": 479, "fast-isnumeric": 190 }], 487: [function(e, t, r) {
      "use strict";
      t.exports = function(n) {
        var a = n._fullLayout;
        a._glcanvas && a._glcanvas.size() && a._glcanvas.each(function(o) {
          o.regl && o.regl.clear({ color: true, depth: true });
        });
      };
    }, {}], 488: [function(e, t, r) {
      "use strict";
      t.exports = function(n) {
        n._responsiveChartHandler && (window.removeEventListener("resize", n._responsiveChartHandler), delete n._responsiveChartHandler);
      };
    }, {}], 489: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("tinycolor2"), o = e("../plots/attributes"), s = e("../components/colorscale/scales"), i = e("../components/color"), l = e("../constants/interactions").DESELECTDIM, u2 = e("./nested_property"), c = e("./regex").counter, f = e("./mod").modHalf, h = e("./array").isArrayOrTypedArray;
      function p(d, v) {
        var m = r.valObjectMeta[v.valType];
        if (v.arrayOk && h(d)) return true;
        if (m.validateFunction) return m.validateFunction(d, v);
        var g = {}, x = g, b = { set: function(y) {
          x = y;
        } };
        return m.coerceFunction(d, b, g, v), x !== g;
      }
      r.valObjectMeta = { data_array: { coerceFunction: function(d, v, m) {
        h(d) ? v.set(d) : m !== void 0 && v.set(m);
      } }, enumerated: { coerceFunction: function(d, v, m, g) {
        g.coerceNumber && (d = +d), g.values.indexOf(d) === -1 ? v.set(m) : v.set(d);
      }, validateFunction: function(d, v) {
        v.coerceNumber && (d = +d);
        for (var m = v.values, g = 0; g < m.length; g++) {
          var x = String(m[g]);
          if (x.charAt(0) === "/" && x.charAt(x.length - 1) === "/") {
            if (new RegExp(x.substr(1, x.length - 2)).test(d)) return true;
          } else if (d === m[g]) return true;
        }
        return false;
      } }, boolean: { coerceFunction: function(d, v, m) {
        d === true || d === false ? v.set(d) : v.set(m);
      } }, number: { coerceFunction: function(d, v, m, g) {
        !n(d) || g.min !== void 0 && d < g.min || g.max !== void 0 && d > g.max ? v.set(m) : v.set(+d);
      } }, integer: { coerceFunction: function(d, v, m, g) {
        d % 1 || !n(d) || g.min !== void 0 && d < g.min || g.max !== void 0 && d > g.max ? v.set(m) : v.set(+d);
      } }, string: { coerceFunction: function(d, v, m, g) {
        if (typeof d != "string") {
          var x = typeof d == "number";
          g.strict !== true && x ? v.set(String(d)) : v.set(m);
        } else g.noBlank && !d ? v.set(m) : v.set(d);
      } }, color: { coerceFunction: function(d, v, m) {
        a(d).isValid() ? v.set(d) : v.set(m);
      } }, colorlist: { coerceFunction: function(d, v, m) {
        Array.isArray(d) && d.length && d.every(function(g) {
          return a(g).isValid();
        }) ? v.set(d) : v.set(m);
      } }, colorscale: { coerceFunction: function(d, v, m) {
        v.set(s.get(d, m));
      } }, angle: { coerceFunction: function(d, v, m) {
        d === "auto" ? v.set("auto") : n(d) ? v.set(f(+d, 360)) : v.set(m);
      } }, subplotid: { coerceFunction: function(d, v, m, g) {
        var x = g.regex || c(m);
        typeof d == "string" && x.test(d) ? v.set(d) : v.set(m);
      }, validateFunction: function(d, v) {
        var m = v.dflt;
        return d === m || typeof d == "string" && !!c(m).test(d);
      } }, flaglist: { coerceFunction: function(d, v, m, g) {
        if (typeof d == "string") if ((g.extras || []).indexOf(d) === -1) {
          for (var x = d.split("+"), b = 0; b < x.length; ) {
            var y = x[b];
            g.flags.indexOf(y) === -1 || x.indexOf(y) < b ? x.splice(b, 1) : b++;
          }
          x.length ? v.set(x.join("+")) : v.set(m);
        } else v.set(d);
        else v.set(m);
      } }, any: { coerceFunction: function(d, v, m) {
        d === void 0 ? v.set(m) : v.set(d);
      } }, info_array: { coerceFunction: function(d, v, m, g) {
        function x(I2, O2, L2) {
          var V2, W2 = { set: function(X2) {
            V2 = X2;
          } };
          return L2 === void 0 && (L2 = O2.dflt), r.valObjectMeta[O2.valType].coerceFunction(I2, W2, L2, O2), V2;
        }
        var b = g.dimensions === 2 || g.dimensions === "1-2" && Array.isArray(d) && Array.isArray(d[0]);
        if (Array.isArray(d)) {
          var y, w, _4, k, T2, A2, S2 = g.items, C2 = [], E2 = Array.isArray(S2), F13 = E2 && b && Array.isArray(S2[0]), N2 = b && E2 && !F13, D2 = E2 && !N2 ? S2.length : d.length;
          if (m = Array.isArray(m) ? m : [], b) for (y = 0; y < D2; y++) for (C2[y] = [], _4 = Array.isArray(d[y]) ? d[y] : [], T2 = N2 ? S2.length : E2 ? S2[y].length : _4.length, w = 0; w < T2; w++) k = N2 ? S2[w] : E2 ? S2[y][w] : S2, (A2 = x(_4[w], k, (m[y] || [])[w])) !== void 0 && (C2[y][w] = A2);
          else for (y = 0; y < D2; y++) (A2 = x(d[y], E2 ? S2[y] : S2, m[y])) !== void 0 && (C2[y] = A2);
          v.set(C2);
        } else v.set(m);
      }, validateFunction: function(d, v) {
        if (!Array.isArray(d)) return false;
        var m = v.items, g = Array.isArray(m), x = v.dimensions === 2;
        if (!v.freeLength && d.length !== m.length) return false;
        for (var b = 0; b < d.length; b++) if (x) {
          if (!Array.isArray(d[b]) || !v.freeLength && d[b].length !== m[b].length) return false;
          for (var y = 0; y < d[b].length; y++) if (!p(d[b][y], g ? m[b][y] : m)) return false;
        } else if (!p(d[b], g ? m[b] : m)) return false;
        return true;
      } } }, r.coerce = function(d, v, m, g, x) {
        var b = u2(m, g).get(), y = u2(d, g), w = u2(v, g), _4 = y.get(), k = v._template;
        if (_4 === void 0 && k && (_4 = u2(k, g).get(), k = 0), x === void 0 && (x = b.dflt), b.arrayOk && h(_4)) return w.set(_4), _4;
        var T2 = r.valObjectMeta[b.valType].coerceFunction;
        T2(_4, w, x, b);
        var A2 = w.get();
        return k && A2 === x && !p(_4, b) && (T2(_4 = u2(k, g).get(), w, x, b), A2 = w.get()), A2;
      }, r.coerce2 = function(d, v, m, g, x) {
        var b = u2(d, g), y = r.coerce(d, v, m, g, x), w = b.get();
        return w != null && y;
      }, r.coerceFont = function(d, v, m) {
        var g = {};
        return m = m || {}, g.family = d(v + ".family", m.family), g.size = d(v + ".size", m.size), g.color = d(v + ".color", m.color), g;
      }, r.coercePattern = function(d, v, m, g) {
        if (d(v + ".shape")) {
          d(v + ".solidity"), d(v + ".size");
          var x = d(v + ".fillmode") === "overlay";
          if (!g) {
            var b = d(v + ".bgcolor", x ? m : void 0);
            d(v + ".fgcolor", x ? i.contrast(b) : m);
          }
          d(v + ".fgopacity", x ? 0.5 : 1);
        }
      }, r.coerceHoverinfo = function(d, v, m) {
        var g, x = v._module.attributes, b = x.hoverinfo ? x : o, y = b.hoverinfo;
        if (m._dataLength === 1) {
          var w = y.dflt === "all" ? y.flags.slice() : y.dflt.split("+");
          w.splice(w.indexOf("name"), 1), g = w.join("+");
        }
        return r.coerce(d, v, b, "hoverinfo", g);
      }, r.coerceSelectionMarkerOpacity = function(d, v) {
        if (d.marker) {
          var m, g, x = d.marker.opacity;
          x !== void 0 && (h(x) || d.selected || d.unselected || (m = x, g = l * x), v("selected.marker.opacity", m), v("unselected.marker.opacity", g));
        }
      }, r.validate = p;
    }, { "../components/color": 366, "../components/colorscale/scales": 381, "../constants/interactions": 478, "../plots/attributes": 550, "./array": 485, "./mod": 510, "./nested_property": 511, "./regex": 520, "fast-isnumeric": 190, tinycolor2: 312 }], 490: [function(e, t, r) {
      "use strict";
      var n, a, o = e("d3-time-format").timeFormat, s = e("fast-isnumeric"), i = e("./loggers"), l = e("./mod").mod, u2 = e("../constants/numerical"), c = u2.BADNUM, f = u2.ONEDAY, h = u2.ONEHOUR, p = u2.ONEMIN, d = u2.ONESEC, v = u2.EPOCHJD, m = e("../registry"), g = e("d3-time-format").utcFormat, x = /^\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, b = /^\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, y = (/* @__PURE__ */ new Date()).getFullYear() - 70;
      function w(O2) {
        return O2 && m.componentsRegistry.calendars && typeof O2 == "string" && O2 !== "gregorian";
      }
      function _4(O2, L2) {
        return String(O2 + Math.pow(10, L2)).substr(1);
      }
      r.dateTick0 = function(O2, L2) {
        var V2 = function(X2, Y2) {
          return w(X2) ? Y2 ? m.getComponentMethod("calendars", "CANONICAL_SUNDAY")[X2] : m.getComponentMethod("calendars", "CANONICAL_TICK")[X2] : Y2 ? "2000-01-02" : "2000-01-01";
        }(O2, !!L2);
        if (L2 < 2) return V2;
        var W2 = r.dateTime2ms(V2, O2);
        return W2 += f * (L2 - 1), r.ms2DateTime(W2, 0, O2);
      }, r.dfltRange = function(O2) {
        return w(O2) ? m.getComponentMethod("calendars", "DFLTRANGE")[O2] : ["2000-01-01", "2001-01-01"];
      }, r.isJSDate = function(O2) {
        return typeof O2 == "object" && O2 !== null && typeof O2.getTime == "function";
      }, r.dateTime2ms = function(O2, L2) {
        if (r.isJSDate(O2)) {
          var V2 = O2.getTimezoneOffset() * p, W2 = (O2.getUTCMinutes() - O2.getMinutes()) * p + (O2.getUTCSeconds() - O2.getSeconds()) * d + (O2.getUTCMilliseconds() - O2.getMilliseconds());
          if (W2) {
            var X2 = 3 * p;
            V2 = V2 - X2 / 2 + l(W2 - V2 + X2 / 2, X2);
          }
          return (O2 = Number(O2) - V2) >= n && O2 <= a ? O2 : c;
        }
        if (typeof O2 != "string" && typeof O2 != "number") return c;
        O2 = String(O2);
        var Y2 = w(L2), K2 = O2.charAt(0);
        !Y2 || K2 !== "G" && K2 !== "g" || (O2 = O2.substr(1), L2 = "");
        var q = Y2 && L2.substr(0, 7) === "chinese", re = O2.match(q ? b : x);
        if (!re) return c;
        var R2 = re[1], z = re[3] || "1", H2 = Number(re[5] || 1), te = Number(re[7] || 0), j = Number(re[9] || 0), Q2 = Number(re[11] || 0);
        if (Y2) {
          if (R2.length === 2) return c;
          var Z2;
          R2 = Number(R2);
          try {
            var ne = m.getComponentMethod("calendars", "getCal")(L2);
            if (q) {
              var ae = z.charAt(z.length - 1) === "i";
              z = parseInt(z, 10), Z2 = ne.newDate(R2, ne.toMonthIndex(R2, z, ae), H2);
            } else Z2 = ne.newDate(R2, Number(z), H2);
          } catch {
            return c;
          }
          return Z2 ? (Z2.toJD() - v) * f + te * h + j * p + Q2 * d : c;
        }
        R2 = R2.length === 2 ? (Number(R2) + 2e3 - y) % 100 + y : Number(R2), z -= 1;
        var ue = new Date(Date.UTC(2e3, z, H2, te, j));
        return ue.setUTCFullYear(R2), ue.getUTCMonth() !== z || ue.getUTCDate() !== H2 ? c : ue.getTime() + Q2 * d;
      }, n = r.MIN_MS = r.dateTime2ms("-9999"), a = r.MAX_MS = r.dateTime2ms("9999-12-31 23:59:59.9999"), r.isDateTime = function(O2, L2) {
        return r.dateTime2ms(O2, L2) !== c;
      };
      var k = 90 * f, T2 = 3 * h, A2 = 5 * p;
      function S2(O2, L2, V2, W2, X2) {
        if ((L2 || V2 || W2 || X2) && (O2 += " " + _4(L2, 2) + ":" + _4(V2, 2), (W2 || X2) && (O2 += ":" + _4(W2, 2), X2))) {
          for (var Y2 = 4; X2 % 10 == 0; ) Y2 -= 1, X2 /= 10;
          O2 += "." + _4(X2, Y2);
        }
        return O2;
      }
      r.ms2DateTime = function(O2, L2, V2) {
        if (typeof O2 != "number" || !(O2 >= n && O2 <= a)) return c;
        L2 || (L2 = 0);
        var W2, X2, Y2, K2, q, re, R2 = Math.floor(10 * l(O2 + 0.05, 1)), z = Math.round(O2 - R2 / 10);
        if (w(V2)) {
          var H2 = Math.floor(z / f) + v, te = Math.floor(l(O2, f));
          try {
            W2 = m.getComponentMethod("calendars", "getCal")(V2).fromJD(H2).formatDate("yyyy-mm-dd");
          } catch {
            W2 = g("G%Y-%m-%d")(new Date(z));
          }
          if (W2.charAt(0) === "-") for (; W2.length < 11; ) W2 = "-0" + W2.substr(1);
          else for (; W2.length < 10; ) W2 = "0" + W2;
          X2 = L2 < k ? Math.floor(te / h) : 0, Y2 = L2 < k ? Math.floor(te % h / p) : 0, K2 = L2 < T2 ? Math.floor(te % p / d) : 0, q = L2 < A2 ? te % d * 10 + R2 : 0;
        } else re = new Date(z), W2 = g("%Y-%m-%d")(re), X2 = L2 < k ? re.getUTCHours() : 0, Y2 = L2 < k ? re.getUTCMinutes() : 0, K2 = L2 < T2 ? re.getUTCSeconds() : 0, q = L2 < A2 ? 10 * re.getUTCMilliseconds() + R2 : 0;
        return S2(W2, X2, Y2, K2, q);
      }, r.ms2DateTimeLocal = function(O2) {
        if (!(O2 >= n + f && O2 <= a - f)) return c;
        var L2 = Math.floor(10 * l(O2 + 0.05, 1)), V2 = new Date(Math.round(O2 - L2 / 10));
        return S2(o("%Y-%m-%d")(V2), V2.getHours(), V2.getMinutes(), V2.getSeconds(), 10 * V2.getUTCMilliseconds() + L2);
      }, r.cleanDate = function(O2, L2, V2) {
        if (O2 === c) return L2;
        if (r.isJSDate(O2) || typeof O2 == "number" && isFinite(O2)) {
          if (w(V2)) return i.error("JS Dates and milliseconds are incompatible with world calendars", O2), L2;
          if (!(O2 = r.ms2DateTimeLocal(+O2)) && L2 !== void 0) return L2;
        } else if (!r.isDateTime(O2, V2)) return i.error("unrecognized date", O2), L2;
        return O2;
      };
      var C2 = /%\d?f/g, E2 = /%h/g, F13 = { 1: "1", 2: "1", 3: "2", 4: "2" };
      function N2(O2, L2, V2, W2) {
        O2 = O2.replace(C2, function(Y2) {
          var K2 = Math.min(+Y2.charAt(1) || 6, 6);
          return (L2 / 1e3 % 1 + 2).toFixed(K2).substr(2).replace(/0+$/, "") || "0";
        });
        var X2 = new Date(Math.floor(L2 + 0.05));
        if (O2 = O2.replace(E2, function() {
          return F13[V2("%q")(X2)];
        }), w(W2)) try {
          O2 = m.getComponentMethod("calendars", "worldCalFmt")(O2, L2, W2);
        } catch {
          return "Invalid";
        }
        return V2(O2)(X2);
      }
      var D2 = [59, 59.9, 59.99, 59.999, 59.9999];
      r.formatDate = function(O2, L2, V2, W2, X2, Y2) {
        if (X2 = w(X2) && X2, !L2) if (V2 === "y") L2 = Y2.year;
        else if (V2 === "m") L2 = Y2.month;
        else {
          if (V2 !== "d") return function(K2, q) {
            var re = l(K2 + 0.05, f), R2 = _4(Math.floor(re / h), 2) + ":" + _4(l(Math.floor(re / p), 60), 2);
            if (q !== "M") {
              s(q) || (q = 0);
              var z = (100 + Math.min(l(K2 / d, 60), D2[q])).toFixed(q).substr(1);
              q > 0 && (z = z.replace(/0+$/, "").replace(/[\.]$/, "")), R2 += ":" + z;
            }
            return R2;
          }(O2, V2) + `
` + N2(Y2.dayMonthYear, O2, W2, X2);
          L2 = Y2.dayMonth + `
` + Y2.year;
        }
        return N2(L2, O2, W2, X2);
      };
      var I2 = 3 * f;
      r.incrementMonth = function(O2, L2, V2) {
        V2 = w(V2) && V2;
        var W2 = l(O2, f);
        if (O2 = Math.round(O2 - W2), V2) try {
          var X2 = Math.round(O2 / f) + v, Y2 = m.getComponentMethod("calendars", "getCal")(V2), K2 = Y2.fromJD(X2);
          return L2 % 12 ? Y2.add(K2, L2, "m") : Y2.add(K2, L2 / 12, "y"), (K2.toJD() - v) * f + W2;
        } catch {
          i.error("invalid ms " + O2 + " in calendar " + V2);
        }
        var q = new Date(O2 + I2);
        return q.setUTCMonth(q.getUTCMonth() + L2) + W2 - I2;
      }, r.findExactDates = function(O2, L2) {
        for (var V2, W2, X2 = 0, Y2 = 0, K2 = 0, q = 0, re = w(L2) && m.getComponentMethod("calendars", "getCal")(L2), R2 = 0; R2 < O2.length; R2++) if (W2 = O2[R2], s(W2)) {
          if (!(W2 % f)) if (re) try {
            (V2 = re.fromJD(W2 / f + v)).day() === 1 ? V2.month() === 1 ? X2++ : Y2++ : K2++;
          } catch {
          }
          else (V2 = new Date(W2)).getUTCDate() === 1 ? V2.getUTCMonth() === 0 ? X2++ : Y2++ : K2++;
        } else q++;
        K2 += Y2 += X2;
        var z = O2.length - q;
        return { exactYears: X2 / z, exactMonths: Y2 / z, exactDays: K2 / z };
      };
    }, { "../constants/numerical": 479, "../registry": 638, "./loggers": 507, "./mod": 510, "d3-time-format": 120, "fast-isnumeric": 190 }], 491: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("./loggers"), o = e("./matrix"), s = e("gl-mat4");
      function i(h) {
        var p = h && h.parentNode;
        p && p.removeChild(h);
      }
      function l(h, p, d) {
        var v = "plotly.js-style-" + h, m = document.getElementById(v);
        m || ((m = document.createElement("style")).setAttribute("id", v), m.appendChild(document.createTextNode("")), document.head.appendChild(m));
        var g = m.sheet;
        g.insertRule ? g.insertRule(p + "{" + d + "}", 0) : g.addRule ? g.addRule(p, d, 0) : a.warn("addStyleRule failed");
      }
      function u2(h) {
        var p = window.getComputedStyle(h, null), d = p.getPropertyValue("-webkit-transform") || p.getPropertyValue("-moz-transform") || p.getPropertyValue("-ms-transform") || p.getPropertyValue("-o-transform") || p.getPropertyValue("transform");
        return d === "none" ? null : d.replace("matrix", "").replace("3d", "").slice(1, -1).split(",").map(function(v) {
          return +v;
        });
      }
      function c(h) {
        for (var p = []; f(h); ) p.push(h), h = h.parentNode;
        return p;
      }
      function f(h) {
        return h && (h instanceof Element || h instanceof HTMLElement);
      }
      t.exports = { getGraphDiv: function(h) {
        var p;
        if (typeof h == "string") {
          if ((p = document.getElementById(h)) === null) throw new Error("No DOM element with id '" + h + "' exists on the page.");
          return p;
        }
        if (h == null) throw new Error("DOM element provided is null or undefined");
        return h;
      }, isPlotDiv: function(h) {
        var p = n.select(h);
        return p.node() instanceof HTMLElement && p.size() && p.classed("js-plotly-plot");
      }, removeElement: i, addStyleRule: function(h, p) {
        l("global", h, p);
      }, addRelatedStyleRule: l, deleteRelatedStyleRule: function(h) {
        var p = "plotly.js-style-" + h, d = document.getElementById(p);
        d && i(d);
      }, getFullTransformMatrix: function(h) {
        var p = c(h), d = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
        return p.forEach(function(v) {
          var m = u2(v);
          if (m) {
            var g = o.convertCssMatrix(m);
            d = s.multiply(d, d, g);
          }
        }), d;
      }, getElementTransformMatrix: u2, getElementAndAncestors: c, equalDomRects: function(h, p) {
        return h && p && h.x === p.x && h.y === p.y && h.top === p.top && h.left === p.left && h.right === p.right && h.bottom === p.bottom;
      } };
    }, { "./loggers": 507, "./matrix": 509, "@plotly/d3": 58, "gl-mat4": 210 }], 492: [function(e, t, r) {
      "use strict";
      var n = e("events").EventEmitter, a = { init: function(o) {
        if (o._ev instanceof n) return o;
        var s = new n(), i = new n();
        return o._ev = s, o._internalEv = i, o.on = s.on.bind(s), o.once = s.once.bind(s), o.removeListener = s.removeListener.bind(s), o.removeAllListeners = s.removeAllListeners.bind(s), o._internalOn = i.on.bind(i), o._internalOnce = i.once.bind(i), o._removeInternalListener = i.removeListener.bind(i), o._removeAllInternalListeners = i.removeAllListeners.bind(i), o.emit = function(l, u2) {
          typeof jQuery < "u" && jQuery(o).trigger(l, u2), s.emit(l, u2), i.emit(l, u2);
        }, o;
      }, triggerHandler: function(o, s, i) {
        var l, u2;
        typeof jQuery < "u" && (l = jQuery(o).triggerHandler(s, i));
        var c = o._ev;
        if (!c) return l;
        var f, h = c._events[s];
        if (!h) return l;
        function p(d) {
          return d.listener ? (c.removeListener(s, d.listener), d.fired ? void 0 : (d.fired = true, d.listener.apply(c, [i]))) : d.apply(c, [i]);
        }
        for (h = Array.isArray(h) ? h : [h], f = 0; f < h.length - 1; f++) p(h[f]);
        return u2 = p(h[f]), l !== void 0 ? l : u2;
      }, purge: function(o) {
        return delete o._ev, delete o.on, delete o.once, delete o.removeListener, delete o.removeAllListeners, delete o.emit, delete o._ev, delete o._internalEv, delete o._internalOn, delete o._internalOnce, delete o._removeInternalListener, delete o._removeAllInternalListeners, o;
      } };
      t.exports = a;
    }, { events: 84 }], 493: [function(e, t, r) {
      "use strict";
      var n = e("./is_plain_object.js"), a = Array.isArray;
      function o(s, i, l, u2) {
        var c, f, h, p, d, v, m = s[0], g = s.length;
        if (g === 2 && a(m) && a(s[1]) && m.length === 0) {
          if (function(b, y) {
            var w, _4;
            for (w = 0; w < b.length; w++) {
              if ((_4 = b[w]) !== null && typeof _4 == "object") return false;
              _4 !== void 0 && (y[w] = _4);
            }
            return true;
          }(s[1], m)) return m;
          m.splice(0, m.length);
        }
        for (var x = 1; x < g; x++) for (f in c = s[x]) h = m[f], p = c[f], u2 && a(p) ? m[f] = p : i && p && (n(p) || (d = a(p))) ? (d ? (d = false, v = h && a(h) ? h : []) : v = h && n(h) ? h : {}, m[f] = o([v, p], i, l, u2)) : (p !== void 0 || l) && (m[f] = p);
        return m;
      }
      r.extendFlat = function() {
        return o(arguments, false, false, false);
      }, r.extendDeep = function() {
        return o(arguments, true, false, false);
      }, r.extendDeepAll = function() {
        return o(arguments, true, true, false);
      }, r.extendDeepNoArrays = function() {
        return o(arguments, true, false, true);
      };
    }, { "./is_plain_object.js": 504 }], 494: [function(e, t, r) {
      "use strict";
      t.exports = function(n) {
        for (var a = {}, o = [], s = 0, i = 0; i < n.length; i++) {
          var l = n[i];
          a[l] !== 1 && (a[l] = 1, o[s++] = l);
        }
        return o;
      };
    }, {}], 495: [function(e, t, r) {
      "use strict";
      function n(o) {
        return o.visible === true;
      }
      function a(o) {
        var s = o[0].trace;
        return s.visible === true && s._length !== 0;
      }
      t.exports = function(o) {
        for (var s, i = (s = o, Array.isArray(s) && Array.isArray(s[0]) && s[0][0] && s[0][0].trace ? a : n), l = [], u2 = 0; u2 < o.length; u2++) {
          var c = o[u2];
          i(c) && l.push(c);
        }
        return l;
      };
    }, {}], 496: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("country-regex"), o = e("@turf/area"), s = e("@turf/centroid"), i = e("@turf/bbox"), l = e("./identity"), u2 = e("./loggers"), c = e("./is_plain_object"), f = e("./nested_property"), h = e("./polygon"), p = Object.keys(a), d = { "ISO-3": l, "USA-states": l, "country names": function(m) {
        for (var g = 0; g < p.length; g++) {
          var x = p[g];
          if (new RegExp(a[x]).test(m.trim().toLowerCase())) return x;
        }
        return u2.log("Unrecognized country name: " + m + "."), false;
      } };
      function v(m) {
        var g = m.geojson, x = window.PlotlyGeoAssets || {}, b = typeof g == "string" ? x[g] : g;
        return c(b) ? b : (u2.error("Oops ... something went wrong when fetching " + g), false);
      }
      t.exports = { locationToFeature: function(m, g, x) {
        if (!g || typeof g != "string") return false;
        var b, y, w, _4 = d[m](g);
        if (_4) {
          if (m === "USA-states") for (b = [], w = 0; w < x.length; w++) (y = x[w]).properties && y.properties.gu && y.properties.gu === "USA" && b.push(y);
          else b = x;
          for (w = 0; w < b.length; w++) if ((y = b[w]).id === _4) return y;
          u2.log(["Location with id", _4, "does not have a matching topojson feature at this resolution."].join(" "));
        }
        return false;
      }, feature2polygons: function(m) {
        var g, x, b, y, w = m.geometry, _4 = w.coordinates, k = m.id, T2 = [];
        function A2(S2) {
          for (var C2 = 0; C2 < S2.length - 1; C2++) if (S2[C2][0] > 0 && S2[C2 + 1][0] < 0) return C2;
          return null;
        }
        switch (g = k === "RUS" || k === "FJI" ? function(S2) {
          var C2;
          if (A2(S2) === null) C2 = S2;
          else for (C2 = new Array(S2.length), y = 0; y < S2.length; y++) C2[y] = [S2[y][0] < 0 ? S2[y][0] + 360 : S2[y][0], S2[y][1]];
          T2.push(h.tester(C2));
        } : k === "ATA" ? function(S2) {
          var C2 = A2(S2);
          if (C2 === null) return T2.push(h.tester(S2));
          var E2 = new Array(S2.length + 1), F13 = 0;
          for (y = 0; y < S2.length; y++) y > C2 ? E2[F13++] = [S2[y][0] + 360, S2[y][1]] : y === C2 ? (E2[F13++] = S2[y], E2[F13++] = [S2[y][0], -90]) : E2[F13++] = S2[y];
          var N2 = h.tester(E2);
          N2.pts.pop(), T2.push(N2);
        } : function(S2) {
          T2.push(h.tester(S2));
        }, w.type) {
          case "MultiPolygon":
            for (x = 0; x < _4.length; x++) for (b = 0; b < _4[x].length; b++) g(_4[x][b]);
            break;
          case "Polygon":
            for (x = 0; x < _4.length; x++) g(_4[x]);
        }
        return T2;
      }, getTraceGeojson: v, extractTraceFeature: function(m) {
        var g = m[0].trace, x = v(g);
        if (!x) return false;
        var b, y = {}, w = [];
        for (b = 0; b < g._length; b++) {
          var _4 = m[b];
          (_4.loc || _4.loc === 0) && (y[_4.loc] = _4);
        }
        function k(S2) {
          var C2 = f(S2, g.featureidkey || "id").get(), E2 = y[C2];
          if (E2) {
            var F13 = S2.geometry;
            if (F13.type === "Polygon" || F13.type === "MultiPolygon") {
              var N2 = { type: "Feature", id: C2, geometry: F13, properties: {} };
              N2.properties.ct = function(D2) {
                var I2, O2 = D2.geometry;
                if (O2.type === "MultiPolygon") for (var L2 = O2.coordinates, V2 = 0, W2 = 0; W2 < L2.length; W2++) {
                  var X2 = { type: "Polygon", coordinates: L2[W2] }, Y2 = o.default(X2);
                  Y2 > V2 && (V2 = Y2, I2 = X2);
                }
                else I2 = O2;
                return s.default(I2).geometry.coordinates;
              }(N2), E2.fIn = S2, E2.fOut = N2, w.push(N2);
            } else u2.log(["Location", E2.loc, "does not have a valid GeoJSON geometry.", "Traces with locationmode *geojson-id* only support", "*Polygon* and *MultiPolygon* geometries."].join(" "));
          }
          delete y[C2];
        }
        switch (x.type) {
          case "FeatureCollection":
            var T2 = x.features;
            for (b = 0; b < T2.length; b++) k(T2[b]);
            break;
          case "Feature":
            k(x);
            break;
          default:
            return u2.warn(["Invalid GeoJSON type", (x.type || "none") + ".", "Traces with locationmode *geojson-id* only support", "*FeatureCollection* and *Feature* types."].join(" ")), false;
        }
        for (var A2 in y) u2.log(["Location *" + A2 + "*", "does not have a matching feature with id-key", "*" + g.featureidkey + "*."].join(" "));
        return w;
      }, fetchTraceGeoData: function(m) {
        var g = window.PlotlyGeoAssets || {}, x = [];
        function b(k) {
          return new Promise(function(T2, A2) {
            n.json(k, function(S2, C2) {
              if (S2) {
                delete g[k];
                var E2 = S2.status === 404 ? 'GeoJSON at URL "' + k + '" does not exist.' : "Unexpected error while fetching from " + k;
                return A2(new Error(E2));
              }
              return g[k] = C2, T2(C2);
            });
          });
        }
        function y(k) {
          return new Promise(function(T2, A2) {
            var S2 = 0, C2 = setInterval(function() {
              return g[k] && g[k] !== "pending" ? (clearInterval(C2), T2(g[k])) : S2 > 100 ? (clearInterval(C2), A2("Unexpected error while fetching from " + k)) : void S2++;
            }, 50);
          });
        }
        for (var w = 0; w < m.length; w++) {
          var _4 = m[w][0].trace.geojson;
          typeof _4 == "string" && (g[_4] ? g[_4] === "pending" && x.push(y(_4)) : (g[_4] = "pending", x.push(b(_4))));
        }
        return x;
      }, computeBbox: function(m) {
        return i.default(m);
      } };
    }, { "./identity": 501, "./is_plain_object": 504, "./loggers": 507, "./nested_property": 511, "./polygon": 515, "@plotly/d3": 58, "@turf/area": 61, "@turf/bbox": 64, "@turf/centroid": 67, "country-regex": 94 }], 497: [function(e, t, r) {
      "use strict";
      var n = e("../constants/numerical").BADNUM;
      r.calcTraceToLineCoords = function(a) {
        for (var o = a[0].trace.connectgaps, s = [], i = [], l = 0; l < a.length; l++) {
          var u2 = a[l].lonlat;
          u2[0] !== n ? i.push(u2) : !o && i.length > 0 && (s.push(i), i = []);
        }
        return i.length > 0 && s.push(i), s;
      }, r.makeLine = function(a) {
        return a.length === 1 ? { type: "LineString", coordinates: a[0] } : { type: "MultiLineString", coordinates: a };
      }, r.makePolygon = function(a) {
        if (a.length === 1) return { type: "Polygon", coordinates: a };
        for (var o = new Array(a.length), s = 0; s < a.length; s++) o[s] = [a[s]];
        return { type: "MultiPolygon", coordinates: o };
      }, r.makeBlank = function() {
        return { type: "Point", coordinates: [] };
      };
    }, { "../constants/numerical": 479 }], 498: [function(e, t, r) {
      "use strict";
      var n, a, o, s = e("./mod").mod;
      function i(u2, c, f, h, p, d, v, m) {
        var g = f - u2, x = p - u2, b = v - p, y = h - c, w = d - c, _4 = m - d, k = g * _4 - b * y;
        if (k === 0) return null;
        var T2 = (x * _4 - b * w) / k, A2 = (x * y - g * w) / k;
        return A2 < 0 || A2 > 1 || T2 < 0 || T2 > 1 ? null : { x: u2 + g * T2, y: c + y * T2 };
      }
      function l(u2, c, f, h, p) {
        var d = h * u2 + p * c;
        if (d < 0) return h * h + p * p;
        if (d > f) {
          var v = h - u2, m = p - c;
          return v * v + m * m;
        }
        var g = h * c - p * u2;
        return g * g / f;
      }
      r.segmentsIntersect = i, r.segmentDistance = function(u2, c, f, h, p, d, v, m) {
        if (i(u2, c, f, h, p, d, v, m)) return 0;
        var g = f - u2, x = h - c, b = v - p, y = m - d, w = g * g + x * x, _4 = b * b + y * y, k = Math.min(l(g, x, w, p - u2, d - c), l(g, x, w, v - u2, m - c), l(b, y, _4, u2 - p, c - d), l(b, y, _4, f - p, h - d));
        return Math.sqrt(k);
      }, r.getTextLocation = function(u2, c, f, h) {
        if (u2 === a && h === o || (n = {}, a = u2, o = h), n[f]) return n[f];
        var p = u2.getPointAtLength(s(f - h / 2, c)), d = u2.getPointAtLength(s(f + h / 2, c)), v = Math.atan((d.y - p.y) / (d.x - p.x)), m = u2.getPointAtLength(s(f, c)), g = { x: (4 * m.x + p.x + d.x) / 6, y: (4 * m.y + p.y + d.y) / 6, theta: v };
        return n[f] = g, g;
      }, r.clearLocationCache = function() {
        a = null;
      }, r.getVisibleSegment = function(u2, c, f) {
        var h, p, d = c.left, v = c.right, m = c.top, g = c.bottom, x = 0, b = u2.getTotalLength(), y = b;
        function w(k) {
          var T2 = u2.getPointAtLength(k);
          k === 0 ? h = T2 : k === b && (p = T2);
          var A2 = T2.x < d ? d - T2.x : T2.x > v ? T2.x - v : 0, S2 = T2.y < m ? m - T2.y : T2.y > g ? T2.y - g : 0;
          return Math.sqrt(A2 * A2 + S2 * S2);
        }
        for (var _4 = w(x); _4; ) {
          if ((x += _4 + f) > y) return;
          _4 = w(x);
        }
        for (_4 = w(y); _4; ) {
          if (x > (y -= _4 + f)) return;
          _4 = w(y);
        }
        return { min: x, max: y, len: y - x, total: b, isClosed: x === 0 && y === b && Math.abs(h.x - p.x) < 0.1 && Math.abs(h.y - p.y) < 0.1 };
      }, r.findPointOnPath = function(u2, c, f, h) {
        for (var p, d, v, m = (h = h || {}).pathLength || u2.getTotalLength(), g = h.tolerance || 1e-3, x = h.iterationLimit || 30, b = u2.getPointAtLength(0)[f] > u2.getPointAtLength(m)[f] ? -1 : 1, y = 0, w = 0, _4 = m; y < x; ) {
          if (p = (w + _4) / 2, v = (d = u2.getPointAtLength(p))[f] - c, Math.abs(v) < g) return d;
          b * v > 0 ? _4 = p : w = p, y++;
        }
        return d;
      };
    }, { "./mod": 510 }], 499: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("tinycolor2"), o = e("color-normalize"), s = e("../components/colorscale"), i = e("../components/color/attributes").defaultLine, l = e("./array").isArrayOrTypedArray, u2 = o(i);
      function c(p, d) {
        var v = p;
        return v[3] *= d, v;
      }
      function f(p) {
        if (n(p)) return u2;
        var d = o(p);
        return d.length ? d : u2;
      }
      function h(p) {
        return n(p) ? p : 1;
      }
      t.exports = { formatColor: function(p, d, v) {
        var m, g, x, b, y, w = p.color, _4 = l(w), k = l(d), T2 = s.extractOpts(p), A2 = [];
        if (m = T2.colorscale !== void 0 ? s.makeColorScaleFuncFromTrace(p) : f, g = _4 ? function(C2, E2) {
          return C2[E2] === void 0 ? u2 : o(m(C2[E2]));
        } : f, x = k ? function(C2, E2) {
          return C2[E2] === void 0 ? 1 : h(C2[E2]);
        } : h, _4 || k) for (var S2 = 0; S2 < v; S2++) b = g(w, S2), y = x(d, S2), A2[S2] = c(b, y);
        else A2 = c(o(w), d);
        return A2;
      }, parseColorScale: function(p) {
        var d = s.extractOpts(p), v = d.colorscale;
        return d.reversescale && (v = s.flipScale(d.colorscale)), v.map(function(m) {
          var g = m[0], x = a(m[1]).toRgb();
          return { index: g, rgb: [x.r, x.g, x.b, x.a] };
        });
      } };
    }, { "../components/color/attributes": 365, "../components/colorscale": 378, "./array": 485, "color-normalize": 89, "fast-isnumeric": 190, tinycolor2: 312 }], 500: [function(e, t, r) {
      "use strict";
      var n = e("./identity");
      function a(o) {
        return [o];
      }
      t.exports = { keyFun: function(o) {
        return o.key;
      }, repeat: a, descend: n, wrap: a, unwrap: function(o) {
        return o[0];
      } };
    }, { "./identity": 501 }], 501: [function(e, t, r) {
      "use strict";
      t.exports = function(n) {
        return n;
      };
    }, {}], 502: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a) {
        if (!a) return n;
        var o = 1 / Math.abs(a), s = o > 1 ? (o * n + o * a) / o : n + a, i = String(s).length;
        if (i > 16) {
          var l = String(a).length;
          if (i >= String(n).length + l) {
            var u2 = parseFloat(s).toPrecision(12);
            u2.indexOf("e+") === -1 && (s = +u2);
          }
        }
        return s;
      };
    }, {}], 503: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("d3-time-format").utcFormat, o = e("d3-format").format, s = e("fast-isnumeric"), i = e("../constants/numerical"), l = i.FP_SAFE, u2 = -l, c = i.BADNUM, f = t.exports = {};
      f.adjustFormat = function(R2) {
        return !R2 || /^\d[.]\df/.test(R2) || /[.]\d%/.test(R2) ? R2 : R2 === "0.f" ? "~f" : /^\d%/.test(R2) ? "~%" : /^\ds/.test(R2) ? "~s" : !/^[~,.0$]/.test(R2) && /[&fps]/.test(R2) ? "~" + R2 : R2;
      };
      var h = {};
      f.warnBadFormat = function(R2) {
        var z = String(R2);
        h[z] || (h[z] = 1, f.warn('encountered bad format: "' + z + '"'));
      }, f.noFormat = function(R2) {
        return String(R2);
      }, f.numberFormat = function(R2) {
        var z;
        try {
          z = o(f.adjustFormat(R2));
        } catch {
          return f.warnBadFormat(R2), f.noFormat;
        }
        return z;
      }, f.nestedProperty = e("./nested_property"), f.keyedContainer = e("./keyed_container"), f.relativeAttr = e("./relative_attr"), f.isPlainObject = e("./is_plain_object"), f.toLogRange = e("./to_log_range"), f.relinkPrivateKeys = e("./relink_private");
      var p = e("./array");
      f.isTypedArray = p.isTypedArray, f.isArrayOrTypedArray = p.isArrayOrTypedArray, f.isArray1D = p.isArray1D, f.ensureArray = p.ensureArray, f.concat = p.concat, f.maxRowLength = p.maxRowLength, f.minRowLength = p.minRowLength;
      var d = e("./mod");
      f.mod = d.mod, f.modHalf = d.modHalf;
      var v = e("./coerce");
      f.valObjectMeta = v.valObjectMeta, f.coerce = v.coerce, f.coerce2 = v.coerce2, f.coerceFont = v.coerceFont, f.coercePattern = v.coercePattern, f.coerceHoverinfo = v.coerceHoverinfo, f.coerceSelectionMarkerOpacity = v.coerceSelectionMarkerOpacity, f.validate = v.validate;
      var m = e("./dates");
      f.dateTime2ms = m.dateTime2ms, f.isDateTime = m.isDateTime, f.ms2DateTime = m.ms2DateTime, f.ms2DateTimeLocal = m.ms2DateTimeLocal, f.cleanDate = m.cleanDate, f.isJSDate = m.isJSDate, f.formatDate = m.formatDate, f.incrementMonth = m.incrementMonth, f.dateTick0 = m.dateTick0, f.dfltRange = m.dfltRange, f.findExactDates = m.findExactDates, f.MIN_MS = m.MIN_MS, f.MAX_MS = m.MAX_MS;
      var g = e("./search");
      f.findBin = g.findBin, f.sorterAsc = g.sorterAsc, f.sorterDes = g.sorterDes, f.distinctVals = g.distinctVals, f.roundUp = g.roundUp, f.sort = g.sort, f.findIndexOfMin = g.findIndexOfMin, f.sortObjectKeys = e("./sort_object_keys");
      var x = e("./stats");
      f.aggNums = x.aggNums, f.len = x.len, f.mean = x.mean, f.median = x.median, f.midRange = x.midRange, f.variance = x.variance, f.stdev = x.stdev, f.interp = x.interp;
      var b = e("./matrix");
      f.init2dArray = b.init2dArray, f.transposeRagged = b.transposeRagged, f.dot = b.dot, f.translationMatrix = b.translationMatrix, f.rotationMatrix = b.rotationMatrix, f.rotationXYMatrix = b.rotationXYMatrix, f.apply3DTransform = b.apply3DTransform, f.apply2DTransform = b.apply2DTransform, f.apply2DTransform2 = b.apply2DTransform2, f.convertCssMatrix = b.convertCssMatrix, f.inverseTransformMatrix = b.inverseTransformMatrix;
      var y = e("./angles");
      f.deg2rad = y.deg2rad, f.rad2deg = y.rad2deg, f.angleDelta = y.angleDelta, f.angleDist = y.angleDist, f.isFullCircle = y.isFullCircle, f.isAngleInsideSector = y.isAngleInsideSector, f.isPtInsideSector = y.isPtInsideSector, f.pathArc = y.pathArc, f.pathSector = y.pathSector, f.pathAnnulus = y.pathAnnulus;
      var w = e("./anchor_utils");
      f.isLeftAnchor = w.isLeftAnchor, f.isCenterAnchor = w.isCenterAnchor, f.isRightAnchor = w.isRightAnchor, f.isTopAnchor = w.isTopAnchor, f.isMiddleAnchor = w.isMiddleAnchor, f.isBottomAnchor = w.isBottomAnchor;
      var _4 = e("./geometry2d");
      f.segmentsIntersect = _4.segmentsIntersect, f.segmentDistance = _4.segmentDistance, f.getTextLocation = _4.getTextLocation, f.clearLocationCache = _4.clearLocationCache, f.getVisibleSegment = _4.getVisibleSegment, f.findPointOnPath = _4.findPointOnPath;
      var k = e("./extend");
      f.extendFlat = k.extendFlat, f.extendDeep = k.extendDeep, f.extendDeepAll = k.extendDeepAll, f.extendDeepNoArrays = k.extendDeepNoArrays;
      var T2 = e("./loggers");
      f.log = T2.log, f.warn = T2.warn, f.error = T2.error;
      var A2 = e("./regex");
      f.counterRegex = A2.counter;
      var S2 = e("./throttle");
      f.throttle = S2.throttle, f.throttleDone = S2.done, f.clearThrottle = S2.clear;
      var C2 = e("./dom");
      function E2(R2) {
        var z = {};
        for (var H2 in R2) for (var te = R2[H2], j = 0; j < te.length; j++) z[te[j]] = +H2;
        return z;
      }
      f.getGraphDiv = C2.getGraphDiv, f.isPlotDiv = C2.isPlotDiv, f.removeElement = C2.removeElement, f.addStyleRule = C2.addStyleRule, f.addRelatedStyleRule = C2.addRelatedStyleRule, f.deleteRelatedStyleRule = C2.deleteRelatedStyleRule, f.getFullTransformMatrix = C2.getFullTransformMatrix, f.getElementTransformMatrix = C2.getElementTransformMatrix, f.getElementAndAncestors = C2.getElementAndAncestors, f.equalDomRects = C2.equalDomRects, f.clearResponsive = e("./clear_responsive"), f.preserveDrawingBuffer = e("./preserve_drawing_buffer"), f.makeTraceGroups = e("./make_trace_groups"), f._ = e("./localize"), f.notifier = e("./notifier"), f.filterUnique = e("./filter_unique"), f.filterVisible = e("./filter_visible"), f.pushUnique = e("./push_unique"), f.increment = e("./increment"), f.cleanNumber = e("./clean_number"), f.ensureNumber = function(R2) {
        return s(R2) ? (R2 = Number(R2)) > l || R2 < u2 ? c : R2 : c;
      }, f.isIndex = function(R2, z) {
        return !(z !== void 0 && R2 >= z) && s(R2) && R2 >= 0 && R2 % 1 == 0;
      }, f.noop = e("./noop"), f.identity = e("./identity"), f.repeat = function(R2, z) {
        for (var H2 = new Array(z), te = 0; te < z; te++) H2[te] = R2;
        return H2;
      }, f.swapAttrs = function(R2, z, H2, te) {
        H2 || (H2 = "x"), te || (te = "y");
        for (var j = 0; j < z.length; j++) {
          var Q2 = z[j], Z2 = f.nestedProperty(R2, Q2.replace("?", H2)), ne = f.nestedProperty(R2, Q2.replace("?", te)), ae = Z2.get();
          Z2.set(ne.get()), ne.set(ae);
        }
      }, f.raiseToTop = function(R2) {
        R2.parentNode.appendChild(R2);
      }, f.cancelTransition = function(R2) {
        return R2.transition().duration(0);
      }, f.constrain = function(R2, z, H2) {
        return z > H2 ? Math.max(H2, Math.min(z, R2)) : Math.max(z, Math.min(H2, R2));
      }, f.bBoxIntersect = function(R2, z, H2) {
        return H2 = H2 || 0, R2.left <= z.right + H2 && z.left <= R2.right + H2 && R2.top <= z.bottom + H2 && z.top <= R2.bottom + H2;
      }, f.simpleMap = function(R2, z, H2, te, j) {
        for (var Q2 = R2.length, Z2 = new Array(Q2), ne = 0; ne < Q2; ne++) Z2[ne] = z(R2[ne], H2, te, j);
        return Z2;
      }, f.randstr = function R2(z, H2, te, j) {
        if (te || (te = 16), H2 === void 0 && (H2 = 24), H2 <= 0) return "0";
        var Q2, Z2, ne = Math.log(Math.pow(2, H2)) / Math.log(te), ae = "";
        for (Q2 = 2; ne === 1 / 0; Q2 *= 2) ne = Math.log(Math.pow(2, H2 / Q2)) / Math.log(te) * Q2;
        var ue = ne - Math.floor(ne);
        for (Q2 = 0; Q2 < Math.floor(ne); Q2++) ae = Math.floor(Math.random() * te).toString(te) + ae;
        ue && (Z2 = Math.pow(te, ue), ae = Math.floor(Math.random() * Z2).toString(te) + ae);
        var le = parseInt(ae, te);
        return z && z[ae] || le !== 1 / 0 && le >= Math.pow(2, H2) ? j > 10 ? (f.warn("randstr failed uniqueness"), ae) : R2(z, H2, te, (j || 0) + 1) : ae;
      }, f.OptionControl = function(R2, z) {
        R2 || (R2 = {}), z || (z = "opt");
        var H2 = { optionList: [], _newoption: function(te) {
          te[z] = R2, H2[te.name] = te, H2.optionList.push(te);
        } };
        return H2["_" + z] = R2, H2;
      }, f.smooth = function(R2, z) {
        if ((z = Math.round(z) || 0) < 2) return R2;
        var H2, te, j, Q2, Z2 = R2.length, ne = 2 * Z2, ae = 2 * z - 1, ue = new Array(ae), le = new Array(Z2);
        for (H2 = 0; H2 < ae; H2++) ue[H2] = (1 - Math.cos(Math.PI * (H2 + 1) / z)) / (2 * z);
        for (H2 = 0; H2 < Z2; H2++) {
          for (Q2 = 0, te = 0; te < ae; te++) (j = H2 + te + 1 - z) < -Z2 ? j -= ne * Math.round(j / ne) : j >= ne && (j -= ne * Math.floor(j / ne)), j < 0 ? j = -1 - j : j >= Z2 && (j = ne - 1 - j), Q2 += R2[j] * ue[te];
          le[H2] = Q2;
        }
        return le;
      }, f.syncOrAsync = function(R2, z, H2) {
        var te;
        function j() {
          return f.syncOrAsync(R2, z, H2);
        }
        for (; R2.length; ) if ((te = (0, R2.splice(0, 1)[0])(z)) && te.then) return te.then(j);
        return H2 && H2(z);
      }, f.stripTrailingSlash = function(R2) {
        return R2.substr(-1) === "/" ? R2.substr(0, R2.length - 1) : R2;
      }, f.noneOrAll = function(R2, z, H2) {
        if (R2) {
          var te, j = false, Q2 = true;
          for (te = 0; te < H2.length; te++) R2[H2[te]] != null ? j = true : Q2 = false;
          if (j && !Q2) for (te = 0; te < H2.length; te++) R2[H2[te]] = z[H2[te]];
        }
      }, f.mergeArray = function(R2, z, H2, te) {
        var j = typeof te == "function";
        if (f.isArrayOrTypedArray(R2)) for (var Q2 = Math.min(R2.length, z.length), Z2 = 0; Z2 < Q2; Z2++) {
          var ne = R2[Z2];
          z[Z2][H2] = j ? te(ne) : ne;
        }
      }, f.mergeArrayCastPositive = function(R2, z, H2) {
        return f.mergeArray(R2, z, H2, function(te) {
          var j = +te;
          return isFinite(j) && j > 0 ? j : 0;
        });
      }, f.fillArray = function(R2, z, H2, te) {
        if (te = te || f.identity, f.isArrayOrTypedArray(R2)) for (var j = 0; j < z.length; j++) z[j][H2] = te(R2[j]);
      }, f.castOption = function(R2, z, H2, te) {
        te = te || f.identity;
        var j = f.nestedProperty(R2, H2).get();
        return f.isArrayOrTypedArray(j) ? Array.isArray(z) && f.isArrayOrTypedArray(j[z[0]]) ? te(j[z[0]][z[1]]) : te(j[z]) : j;
      }, f.extractOption = function(R2, z, H2, te) {
        if (H2 in R2) return R2[H2];
        var j = f.nestedProperty(z, te).get();
        return Array.isArray(j) ? void 0 : j;
      }, f.tagSelected = function(R2, z, H2) {
        var te, j, Q2 = z.selectedpoints, Z2 = z._indexToPoints;
        Z2 && (te = E2(Z2));
        for (var ne = 0; ne < Q2.length; ne++) {
          var ae = Q2[ne];
          if (f.isIndex(ae) || f.isArrayOrTypedArray(ae) && f.isIndex(ae[0]) && f.isIndex(ae[1])) {
            var ue = te ? te[ae] : ae, le = H2 ? H2[ue] : ue;
            (j = le) !== void 0 && j < R2.length && (R2[le].selected = 1);
          }
        }
      }, f.selIndices2selPoints = function(R2) {
        var z = R2.selectedpoints, H2 = R2._indexToPoints;
        if (H2) {
          for (var te = E2(H2), j = [], Q2 = 0; Q2 < z.length; Q2++) {
            var Z2 = z[Q2];
            if (f.isIndex(Z2)) {
              var ne = te[Z2];
              f.isIndex(ne) && j.push(ne);
            }
          }
          return j;
        }
        return z;
      }, f.getTargetArray = function(R2, z) {
        var H2 = z.target;
        if (typeof H2 == "string" && H2) {
          var te = f.nestedProperty(R2, H2).get();
          return !!Array.isArray(te) && te;
        }
        return !!Array.isArray(H2) && H2;
      }, f.minExtend = function(R2, z) {
        var H2 = {};
        typeof z != "object" && (z = {});
        var te, j, Q2, Z2 = Object.keys(R2);
        for (te = 0; te < Z2.length; te++) Q2 = R2[j = Z2[te]], j.charAt(0) !== "_" && typeof Q2 != "function" && (j === "module" ? H2[j] = Q2 : Array.isArray(Q2) ? H2[j] = j === "colorscale" ? Q2.slice() : Q2.slice(0, 3) : f.isTypedArray(Q2) ? H2[j] = Q2.subarray(0, 3) : H2[j] = Q2 && typeof Q2 == "object" ? f.minExtend(R2[j], z[j]) : Q2);
        for (Z2 = Object.keys(z), te = 0; te < Z2.length; te++) typeof (Q2 = z[j = Z2[te]]) == "object" && j in H2 && typeof H2[j] == "object" || (H2[j] = Q2);
        return H2;
      }, f.titleCase = function(R2) {
        return R2.charAt(0).toUpperCase() + R2.substr(1);
      }, f.containsAny = function(R2, z) {
        for (var H2 = 0; H2 < z.length; H2++) if (R2.indexOf(z[H2]) !== -1) return true;
        return false;
      }, f.isIE = function() {
        return window.navigator.msSaveBlob !== void 0;
      };
      var F13 = /Version\/[\d\.]+.*Safari/;
      f.isSafari = function() {
        return F13.test(window.navigator.userAgent);
      };
      var N2 = /iPad|iPhone|iPod/;
      f.isIOS = function() {
        return N2.test(window.navigator.userAgent);
      };
      var D2 = /Firefox\/(\d+)\.\d+/;
      f.getFirefoxVersion = function() {
        var R2 = D2.exec(window.navigator.userAgent);
        if (R2 && R2.length === 2) {
          var z = parseInt(R2[1]);
          if (!isNaN(z)) return z;
        }
        return null;
      }, f.isD3Selection = function(R2) {
        return R2 instanceof n.selection;
      }, f.ensureSingle = function(R2, z, H2, te) {
        var j = R2.select(z + (H2 ? "." + H2 : ""));
        if (j.size()) return j;
        var Q2 = R2.append(z);
        return H2 && Q2.classed(H2, true), te && Q2.call(te), Q2;
      }, f.ensureSingleById = function(R2, z, H2, te) {
        var j = R2.select(z + "#" + H2);
        if (j.size()) return j;
        var Q2 = R2.append(z).attr("id", H2);
        return te && Q2.call(te), Q2;
      }, f.objectFromPath = function(R2, z) {
        for (var H2, te = R2.split("."), j = H2 = {}, Q2 = 0; Q2 < te.length; Q2++) {
          var Z2 = te[Q2], ne = null, ae = te[Q2].match(/(.*)\[([0-9]+)\]/);
          ae ? (Z2 = ae[1], ne = ae[2], H2 = H2[Z2] = [], Q2 === te.length - 1 ? H2[ne] = z : H2[ne] = {}, H2 = H2[ne]) : (Q2 === te.length - 1 ? H2[Z2] = z : H2[Z2] = {}, H2 = H2[Z2]);
        }
        return j;
      };
      var I2 = /^([^\[\.]+)\.(.+)?/, O2 = /^([^\.]+)\[([0-9]+)\](\.)?(.+)?/;
      f.expandObjectPaths = function(R2) {
        var z, H2, te, j, Q2, Z2, ne;
        if (typeof R2 == "object" && !Array.isArray(R2)) for (H2 in R2) R2.hasOwnProperty(H2) && ((z = H2.match(I2)) ? (j = R2[H2], te = z[1], delete R2[H2], R2[te] = f.extendDeepNoArrays(R2[te] || {}, f.objectFromPath(H2, f.expandObjectPaths(j))[te])) : (z = H2.match(O2)) ? (j = R2[H2], te = z[1], Q2 = parseInt(z[2]), delete R2[H2], R2[te] = R2[te] || [], z[3] === "." ? (ne = z[4], Z2 = R2[te][Q2] = R2[te][Q2] || {}, f.extendDeepNoArrays(Z2, f.objectFromPath(ne, f.expandObjectPaths(j)))) : R2[te][Q2] = f.expandObjectPaths(j)) : R2[H2] = f.expandObjectPaths(R2[H2]));
        return R2;
      }, f.numSeparate = function(R2, z, H2) {
        if (H2 || (H2 = false), typeof z != "string" || z.length === 0) throw new Error("Separator string required for formatting!");
        typeof R2 == "number" && (R2 = String(R2));
        var te = /(\d+)(\d{3})/, j = z.charAt(0), Q2 = z.charAt(1), Z2 = R2.split("."), ne = Z2[0], ae = Z2.length > 1 ? j + Z2[1] : "";
        if (Q2 && (Z2.length > 1 || ne.length > 4 || H2)) for (; te.test(ne); ) ne = ne.replace(te, "$1" + Q2 + "$2");
        return ne + ae;
      }, f.TEMPLATE_STRING_REGEX = /%{([^\s%{}:]*)([:|\|][^}]*)?}/g;
      var L2 = /^\w*$/;
      f.templateString = function(R2, z) {
        var H2 = {};
        return R2.replace(f.TEMPLATE_STRING_REGEX, function(te, j) {
          var Q2;
          return L2.test(j) ? Q2 = z[j] : (H2[j] = H2[j] || f.nestedProperty(z, j).get, Q2 = H2[j]()), f.isValidTextValue(Q2) ? Q2 : "";
        });
      };
      var V2 = { max: 10, count: 0, name: "hovertemplate" };
      f.hovertemplateString = function() {
        return Y2.apply(V2, arguments);
      };
      var W2 = { max: 10, count: 0, name: "texttemplate" };
      f.texttemplateString = function() {
        return Y2.apply(W2, arguments);
      };
      var X2 = /^[:|\|]/;
      function Y2(R2, z, H2) {
        var te = this, j = arguments;
        z || (z = {});
        var Q2 = {};
        return R2.replace(f.TEMPLATE_STRING_REGEX, function(Z2, ne, ae) {
          var ue, le, ce, se = ne === "_xother" || ne === "_yother", he = ne === "_xother_" || ne === "_yother_", me = ne === "xother_" || ne === "yother_", we = ne === "xother" || ne === "yother" || se || me || he, be = ne;
          if ((se || he) && (be = be.substring(1)), (me || he) && (be = be.substring(0, be.length - 1)), we) {
            if ((ue = z[be]) === void 0) return "";
          } else for (ce = 3; ce < j.length; ce++) if (le = j[ce]) {
            if (le.hasOwnProperty(be)) {
              ue = le[be];
              break;
            }
            if (L2.test(be) || (ue = f.nestedProperty(le, be).get(), (ue = Q2[be] || f.nestedProperty(le, be).get()) && (Q2[be] = ue)), ue !== void 0) break;
          }
          if (ue === void 0 && te) return te.count < te.max && (f.warn("Variable '" + be + "' in " + te.name + " could not be found!"), ue = Z2), te.count === te.max && f.warn("Too many " + te.name + " warnings - additional warnings will be suppressed"), te.count++, Z2;
          if (ae) {
            var Ae;
            if (ae[0] === ":" && (ue = (Ae = H2 ? H2.numberFormat : f.numberFormat)(ae.replace(X2, ""))(ue)), ae[0] === "|") {
              Ae = H2 ? H2.timeFormat : a;
              var pe = f.dateTime2ms(ue);
              ue = f.formatDate(pe, ae.replace(X2, ""), false, Ae);
            }
          } else {
            var ve = be + "Label";
            z.hasOwnProperty(ve) && (ue = z[ve]);
          }
          return we && (ue = "(" + ue + ")", (se || he) && (ue = " " + ue), (me || he) && (ue += " ")), ue;
        });
      }
      f.subplotSort = function(R2, z) {
        for (var H2 = Math.min(R2.length, z.length) + 1, te = 0, j = 0, Q2 = 0; Q2 < H2; Q2++) {
          var Z2 = R2.charCodeAt(Q2) || 0, ne = z.charCodeAt(Q2) || 0, ae = Z2 >= 48 && Z2 <= 57, ue = ne >= 48 && ne <= 57;
          if (ae && (te = 10 * te + Z2 - 48), ue && (j = 10 * j + ne - 48), !ae || !ue) {
            if (te !== j) return te - j;
            if (Z2 !== ne) return Z2 - ne;
          }
        }
        return j - te;
      };
      var K2 = 2e9;
      f.seedPseudoRandom = function() {
        K2 = 2e9;
      }, f.pseudoRandom = function() {
        var R2 = K2;
        return K2 = (69069 * K2 + 1) % 4294967296, Math.abs(K2 - R2) < 429496729 ? f.pseudoRandom() : K2 / 4294967296;
      }, f.fillText = function(R2, z, H2) {
        var te = Array.isArray(H2) ? function(Z2) {
          H2.push(Z2);
        } : function(Z2) {
          H2.text = Z2;
        }, j = f.extractOption(R2, z, "htx", "hovertext");
        if (f.isValidTextValue(j)) return te(j);
        var Q2 = f.extractOption(R2, z, "tx", "text");
        return f.isValidTextValue(Q2) ? te(Q2) : void 0;
      }, f.isValidTextValue = function(R2) {
        return R2 || R2 === 0;
      }, f.formatPercent = function(R2, z) {
        z = z || 0;
        for (var H2 = (Math.round(100 * R2 * Math.pow(10, z)) * Math.pow(0.1, z)).toFixed(z) + "%", te = 0; te < z; te++) H2.indexOf(".") !== -1 && (H2 = (H2 = H2.replace("0%", "%")).replace(".%", "%"));
        return H2;
      }, f.isHidden = function(R2) {
        var z = window.getComputedStyle(R2).display;
        return !z || z === "none";
      }, f.strTranslate = function(R2, z) {
        return R2 || z ? "translate(" + R2 + "," + z + ")" : "";
      }, f.strRotate = function(R2) {
        return R2 ? "rotate(" + R2 + ")" : "";
      }, f.strScale = function(R2) {
        return R2 !== 1 ? "scale(" + R2 + ")" : "";
      }, f.getTextTransform = function(R2) {
        var z = R2.noCenter, H2 = R2.textX, te = R2.textY, j = R2.targetX, Q2 = R2.targetY, Z2 = R2.anchorX || 0, ne = R2.anchorY || 0, ae = R2.rotate, ue = R2.scale;
        return ue ? ue > 1 && (ue = 1) : ue = 0, f.strTranslate(j - ue * (H2 + Z2), Q2 - ue * (te + ne)) + f.strScale(ue) + (ae ? "rotate(" + ae + (z ? "" : " " + H2 + " " + te) + ")" : "");
      }, f.ensureUniformFontSize = function(R2, z) {
        var H2 = f.extendFlat({}, z);
        return H2.size = Math.max(z.size, R2._fullLayout.uniformtext.minsize || 0), H2;
      }, f.join2 = function(R2, z, H2) {
        var te = R2.length;
        return te > 1 ? R2.slice(0, -1).join(z) + H2 + R2[te - 1] : R2.join(z);
      }, f.bigFont = function(R2) {
        return Math.round(1.2 * R2);
      };
      var q = f.getFirefoxVersion(), re = q !== null && q < 86;
      f.getPositionFromD3Event = function() {
        return re ? [n.event.layerX, n.event.layerY] : [n.event.offsetX, n.event.offsetY];
      };
    }, { "../constants/numerical": 479, "./anchor_utils": 483, "./angles": 484, "./array": 485, "./clean_number": 486, "./clear_responsive": 488, "./coerce": 489, "./dates": 490, "./dom": 491, "./extend": 493, "./filter_unique": 494, "./filter_visible": 495, "./geometry2d": 498, "./identity": 501, "./increment": 502, "./is_plain_object": 504, "./keyed_container": 505, "./localize": 506, "./loggers": 507, "./make_trace_groups": 508, "./matrix": 509, "./mod": 510, "./nested_property": 511, "./noop": 512, "./notifier": 513, "./preserve_drawing_buffer": 517, "./push_unique": 518, "./regex": 520, "./relative_attr": 521, "./relink_private": 522, "./search": 523, "./sort_object_keys": 526, "./stats": 527, "./throttle": 530, "./to_log_range": 531, "@plotly/d3": 58, "d3-format": 112, "d3-time-format": 120, "fast-isnumeric": 190 }], 504: [function(e, t, r) {
      "use strict";
      t.exports = function(n) {
        return window && window.process && window.process.versions ? Object.prototype.toString.call(n) === "[object Object]" : Object.prototype.toString.call(n) === "[object Object]" && Object.getPrototypeOf(n).hasOwnProperty("hasOwnProperty");
      };
    }, {}], 505: [function(e, t, r) {
      "use strict";
      var n = e("./nested_property"), a = /^\w*$/;
      t.exports = function(o, s, i, l) {
        var u2, c, f;
        i = i || "name", l = l || "value";
        var h = {};
        s && s.length ? (f = n(o, s), c = f.get()) : c = o, s = s || "";
        var p = {};
        if (c) for (u2 = 0; u2 < c.length; u2++) p[c[u2][i]] = u2;
        var d = a.test(l), v = { set: function(m, g) {
          var x = g === null ? 4 : 0;
          if (!c) {
            if (!f || x === 4) return;
            c = [], f.set(c);
          }
          var b = p[m];
          if (b === void 0) {
            if (x === 4) return;
            x |= 3, b = c.length, p[m] = b;
          } else g !== (d ? c[b][l] : n(c[b], l).get()) && (x |= 2);
          var y = c[b] = c[b] || {};
          return y[i] = m, d ? y[l] = g : n(y, l).set(g), g !== null && (x &= -5), h[b] = h[b] | x, v;
        }, get: function(m) {
          if (c) {
            var g = p[m];
            return g === void 0 ? void 0 : d ? c[g][l] : n(c[g], l).get();
          }
        }, rename: function(m, g) {
          var x = p[m];
          return x === void 0 || (h[x] = 1 | h[x], p[g] = x, delete p[m], c[x][i] = g), v;
        }, remove: function(m) {
          var g = p[m];
          if (g === void 0) return v;
          var x = c[g];
          if (Object.keys(x).length > 2) return h[g] = 2 | h[g], v.set(m, null);
          if (d) {
            for (u2 = g; u2 < c.length; u2++) h[u2] = 3 | h[u2];
            for (u2 = g; u2 < c.length; u2++) p[c[u2][i]]--;
            c.splice(g, 1), delete p[m];
          } else n(x, l).set(null), h[g] = 6 | h[g];
          return v;
        }, constructUpdate: function() {
          for (var m, g, x = {}, b = Object.keys(h), y = 0; y < b.length; y++) g = b[y], m = s + "[" + g + "]", c[g] ? (1 & h[g] && (x[m + "." + i] = c[g][i]), 2 & h[g] && (x[m + "." + l] = d ? 4 & h[g] ? null : c[g][l] : 4 & h[g] ? null : n(c[g], l).get())) : x[m] = null;
          return x;
        } };
        return v;
      };
    }, { "./nested_property": 511 }], 506: [function(e, t, r) {
      "use strict";
      var n = e("../registry");
      t.exports = function(a, o) {
        for (var s = a._context.locale, i = 0; i < 2; i++) {
          for (var l = a._context.locales, u2 = 0; u2 < 2; u2++) {
            var c = (l[s] || {}).dictionary;
            if (c) {
              var f = c[o];
              if (f) return f;
            }
            l = n.localeRegistry;
          }
          var h = s.split("-")[0];
          if (h === s) break;
          s = h;
        }
        return o;
      };
    }, { "../registry": 638 }], 507: [function(e, t, r) {
      "use strict";
      var n = e("../plot_api/plot_config").dfltConfig, a = e("./notifier"), o = t.exports = {};
      o.log = function() {
        var s;
        if (n.logging > 1) {
          var i = ["LOG:"];
          for (s = 0; s < arguments.length; s++) i.push(arguments[s]);
          console.trace.apply(console, i);
        }
        if (n.notifyOnLogging > 1) {
          var l = [];
          for (s = 0; s < arguments.length; s++) l.push(arguments[s]);
          a(l.join("<br>"), "long");
        }
      }, o.warn = function() {
        var s;
        if (n.logging > 0) {
          var i = ["WARN:"];
          for (s = 0; s < arguments.length; s++) i.push(arguments[s]);
          console.trace.apply(console, i);
        }
        if (n.notifyOnLogging > 0) {
          var l = [];
          for (s = 0; s < arguments.length; s++) l.push(arguments[s]);
          a(l.join("<br>"), "stick");
        }
      }, o.error = function() {
        var s;
        if (n.logging > 0) {
          var i = ["ERROR:"];
          for (s = 0; s < arguments.length; s++) i.push(arguments[s]);
          console.error.apply(console, i);
        }
        if (n.notifyOnLogging > 0) {
          var l = [];
          for (s = 0; s < arguments.length; s++) l.push(arguments[s]);
          a(l.join("<br>"), "stick");
        }
      };
    }, { "../plot_api/plot_config": 541, "./notifier": 513 }], 508: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3");
      t.exports = function(a, o, s) {
        var i = a.selectAll("g." + s.replace(/\s/g, ".")).data(o, function(u2) {
          return u2[0].trace.uid;
        });
        i.exit().remove(), i.enter().append("g").attr("class", s), i.order();
        var l = a.classed("rangeplot") ? "nodeRangePlot3" : "node3";
        return i.each(function(u2) {
          u2[0][l] = n.select(this);
        }), i;
      };
    }, { "@plotly/d3": 58 }], 509: [function(e, t, r) {
      "use strict";
      var n = e("gl-mat4");
      r.init2dArray = function(a, o) {
        for (var s = new Array(a), i = 0; i < a; i++) s[i] = new Array(o);
        return s;
      }, r.transposeRagged = function(a) {
        var o, s, i = 0, l = a.length;
        for (o = 0; o < l; o++) i = Math.max(i, a[o].length);
        var u2 = new Array(i);
        for (o = 0; o < i; o++) for (u2[o] = new Array(l), s = 0; s < l; s++) u2[o][s] = a[s][o];
        return u2;
      }, r.dot = function(a, o) {
        if (!a.length || !o.length || a.length !== o.length) return null;
        var s, i, l = a.length;
        if (a[0].length) for (s = new Array(l), i = 0; i < l; i++) s[i] = r.dot(a[i], o);
        else if (o[0].length) {
          var u2 = r.transposeRagged(o);
          for (s = new Array(u2.length), i = 0; i < u2.length; i++) s[i] = r.dot(a, u2[i]);
        } else for (s = 0, i = 0; i < l; i++) s += a[i] * o[i];
        return s;
      }, r.translationMatrix = function(a, o) {
        return [[1, 0, a], [0, 1, o], [0, 0, 1]];
      }, r.rotationMatrix = function(a) {
        var o = a * Math.PI / 180;
        return [[Math.cos(o), -Math.sin(o), 0], [Math.sin(o), Math.cos(o), 0], [0, 0, 1]];
      }, r.rotationXYMatrix = function(a, o, s) {
        return r.dot(r.dot(r.translationMatrix(o, s), r.rotationMatrix(a)), r.translationMatrix(-o, -s));
      }, r.apply3DTransform = function(a) {
        return function() {
          var o = arguments, s = arguments.length === 1 ? o[0] : [o[0], o[1], o[2] || 0];
          return r.dot(a, [s[0], s[1], s[2], 1]).slice(0, 3);
        };
      }, r.apply2DTransform = function(a) {
        return function() {
          var o = arguments;
          o.length === 3 && (o = o[0]);
          var s = arguments.length === 1 ? o[0] : [o[0], o[1]];
          return r.dot(a, [s[0], s[1], 1]).slice(0, 2);
        };
      }, r.apply2DTransform2 = function(a) {
        var o = r.apply2DTransform(a);
        return function(s) {
          return o(s.slice(0, 2)).concat(o(s.slice(2, 4)));
        };
      }, r.convertCssMatrix = function(a) {
        if (a) {
          var o = a.length;
          if (o === 16) return a;
          if (o === 6) return [a[0], a[1], 0, 0, a[2], a[3], 0, 0, 0, 0, 1, 0, a[4], a[5], 0, 1];
        }
        return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
      }, r.inverseTransformMatrix = function(a) {
        var o = [];
        return n.invert(o, a), [[o[0], o[1], o[2], o[3]], [o[4], o[5], o[6], o[7]], [o[8], o[9], o[10], o[11]], [o[12], o[13], o[14], o[15]]];
      };
    }, { "gl-mat4": 210 }], 510: [function(e, t, r) {
      "use strict";
      t.exports = { mod: function(n, a) {
        var o = n % a;
        return o < 0 ? o + a : o;
      }, modHalf: function(n, a) {
        return Math.abs(n) > a / 2 ? n - Math.round(n / a) * a : n;
      } };
    }, {}], 511: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("./array").isArrayOrTypedArray;
      function o(h, p) {
        return function() {
          var d, v, m, g, x, b = h;
          for (g = 0; g < p.length - 1; g++) {
            if ((d = p[g]) === -1) {
              for (v = true, m = [], x = 0; x < b.length; x++) m[x] = o(b[x], p.slice(g + 1))(), m[x] !== m[0] && (v = false);
              return v ? m[0] : m;
            }
            if (typeof d == "number" && !a(b) || typeof (b = b[d]) != "object" || b === null) return;
          }
          if (typeof b == "object" && b !== null && (m = b[p[g]]) !== null) return m;
        };
      }
      t.exports = function(h, p) {
        if (n(p)) p = String(p);
        else if (typeof p != "string" || p.substr(p.length - 4) === "[-1]") throw "bad property string";
        for (var d, v, m, g = 0, x = p.split("."); g < x.length; ) {
          if (d = String(x[g]).match(/^([^\[\]]*)((\[\-?[0-9]*\])+)$/)) {
            if (d[1]) x[g] = d[1];
            else {
              if (g !== 0) throw "bad property string";
              x.splice(0, 1);
            }
            for (v = d[2].substr(1, d[2].length - 2).split("]["), m = 0; m < v.length; m++) g++, x.splice(g, 0, Number(v[m]));
          }
          g++;
        }
        return typeof h != "object" ? /* @__PURE__ */ function(b, y, w) {
          return { set: function() {
            throw "bad container";
          }, get: function() {
          }, astr: y, parts: w, obj: b };
        }(h, p, x) : { set: l(h, x, p), get: o(h, x), astr: p, parts: x, obj: h };
      };
      var s = /(^|\.)args\[/;
      function i(h, p) {
        return h === void 0 || h === null && !p.match(s);
      }
      function l(h, p, d) {
        return function(v) {
          var m, g, x = h, b = "", y = [[h, b]], w = i(v, d);
          for (g = 0; g < p.length - 1; g++) {
            if (typeof (m = p[g]) == "number" && !a(x)) throw "array index but container is not an array";
            if (m === -1) {
              if (w = !c(x, p.slice(g + 1), v, d)) break;
              return;
            }
            if (!f(x, m, p[g + 1], w)) break;
            if (typeof (x = x[m]) != "object" || x === null) throw "container is not an object";
            b = u2(b, m), y.push([x, b]);
          }
          if (w) {
            if (g === p.length - 1 && (delete x[p[g]], Array.isArray(x) && +p[g] == x.length - 1)) for (; x.length && x[x.length - 1] === void 0; ) x.pop();
          } else x[p[g]] = v;
        };
      }
      function u2(h, p) {
        var d = p;
        return n(p) ? d = "[" + p + "]" : h && (d = "." + p), h + d;
      }
      function c(h, p, d, v) {
        var m, g = a(d), x = true, b = d, y = v.replace("-1", 0), w = !g && i(d, y), _4 = p[0];
        for (m = 0; m < h.length; m++) y = v.replace("-1", m), g && (w = i(b = d[m % d.length], y)), w && (x = false), f(h, m, _4, w) && l(h[m], p, v.replace("-1", m))(b);
        return x;
      }
      function f(h, p, d, v) {
        if (h[p] === void 0) {
          if (v) return false;
          h[p] = typeof d == "number" ? [] : {};
        }
        return true;
      }
    }, { "./array": 485, "fast-isnumeric": 190 }], 512: [function(e, t, r) {
      "use strict";
      t.exports = function() {
      };
    }, {}], 513: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("fast-isnumeric"), o = [];
      t.exports = function(s, i) {
        if (o.indexOf(s) === -1) {
          o.push(s);
          var l = 1e3;
          a(i) ? l = i : i === "long" && (l = 3e3);
          var u2 = n.select("body").selectAll(".plotly-notifier").data([0]);
          u2.enter().append("div").classed("plotly-notifier", true), u2.selectAll(".notifier-note").data(o).enter().append("div").classed("notifier-note", true).style("opacity", 0).each(function(f) {
            var h = n.select(this);
            h.append("button").classed("notifier-close", true).html("&times;").on("click", function() {
              h.transition().call(c);
            });
            for (var p = h.append("p"), d = f.split(/<br\s*\/?>/g), v = 0; v < d.length; v++) v && p.append("br"), p.append("span").text(d[v]);
            i === "stick" ? h.transition().duration(350).style("opacity", 1) : h.transition().duration(700).style("opacity", 1).transition().delay(l).call(c);
          });
        }
        function c(f) {
          f.duration(700).style("opacity", 0).each("end", function(h) {
            var p = o.indexOf(h);
            p !== -1 && o.splice(p, 1), n.select(this).remove();
          });
        }
      };
    }, { "@plotly/d3": 58, "fast-isnumeric": 190 }], 514: [function(e, t, r) {
      "use strict";
      var n = e("./setcursor"), a = "data-savedcursor";
      t.exports = function(o, s) {
        var i = o.attr(a);
        if (s) {
          if (!i) {
            for (var l = (o.attr("class") || "").split(" "), u2 = 0; u2 < l.length; u2++) {
              var c = l[u2];
              c.indexOf("cursor-") === 0 && o.attr(a, c.substr(7)).classed(c, false);
            }
            o.attr(a) || o.attr(a, "!!");
          }
          n(o, s);
        } else i && (o.attr(a, null), i === "!!" ? n(o) : n(o, i));
      };
    }, { "./setcursor": 524 }], 515: [function(e, t, r) {
      "use strict";
      var n = e("./matrix").dot, a = e("../constants/numerical").BADNUM, o = t.exports = {};
      o.tester = function(s) {
        var i, l = s.slice(), u2 = l[0][0], c = u2, f = l[0][1], h = f;
        for (l.push(l[0]), i = 1; i < l.length; i++) u2 = Math.min(u2, l[i][0]), c = Math.max(c, l[i][0]), f = Math.min(f, l[i][1]), h = Math.max(h, l[i][1]);
        var p, d = false;
        l.length === 5 && (l[0][0] === l[1][0] ? l[2][0] === l[3][0] && l[0][1] === l[3][1] && l[1][1] === l[2][1] && (d = true, p = function(g) {
          return g[0] === l[0][0];
        }) : l[0][1] === l[1][1] && l[2][1] === l[3][1] && l[0][0] === l[3][0] && l[1][0] === l[2][0] && (d = true, p = function(g) {
          return g[1] === l[0][1];
        }));
        var v = true, m = l[0];
        for (i = 1; i < l.length; i++) if (m[0] !== l[i][0] || m[1] !== l[i][1]) {
          v = false;
          break;
        }
        return { xmin: u2, xmax: c, ymin: f, ymax: h, pts: l, contains: d ? function(g, x) {
          var b = g[0], y = g[1];
          return !(b === a || b < u2 || b > c || y === a || y < f || y > h) && (!x || !p(g));
        } : function(g, x) {
          var b = g[0], y = g[1];
          if (b === a || b < u2 || b > c || y === a || y < f || y > h) return false;
          var w, _4, k, T2, A2, S2 = l.length, C2 = l[0][0], E2 = l[0][1], F13 = 0;
          for (w = 1; w < S2; w++) if (_4 = C2, k = E2, C2 = l[w][0], E2 = l[w][1], !(b < (T2 = Math.min(_4, C2)) || b > Math.max(_4, C2) || y > Math.max(k, E2))) if (y < Math.min(k, E2)) b !== T2 && F13++;
          else {
            if (y === (A2 = C2 === _4 ? y : k + (b - _4) * (E2 - k) / (C2 - _4))) return w !== 1 || !x;
            y <= A2 && b !== T2 && F13++;
          }
          return F13 % 2 == 1;
        }, isRect: d, degenerate: v };
      }, o.isSegmentBent = function(s, i, l, u2) {
        var c, f, h, p = s[i], d = [s[l][0] - p[0], s[l][1] - p[1]], v = n(d, d), m = Math.sqrt(v), g = [-d[1] / m, d[0] / m];
        for (c = i + 1; c < l; c++) if (f = [s[c][0] - p[0], s[c][1] - p[1]], (h = n(f, d)) < 0 || h > v || Math.abs(n(f, g)) > u2) return true;
        return false;
      }, o.filter = function(s, i) {
        var l = [s[0]], u2 = 0, c = 0;
        function f(h) {
          s.push(h);
          var p = l.length, d = u2;
          l.splice(c + 1);
          for (var v = d + 1; v < s.length; v++) (v === s.length - 1 || o.isSegmentBent(s, d, v + 1, i)) && (l.push(s[v]), l.length < p - 2 && (u2 = v, c = l.length - 1), d = v);
        }
        return s.length > 1 && f(s.pop()), { addPt: f, raw: s, filtered: l };
      };
    }, { "../constants/numerical": 479, "./matrix": 509 }], 516: [function(e, t, r) {
      (function(n) {
        (function() {
          "use strict";
          var a = e("./show_no_webgl_msg"), o = e("regl");
          t.exports = function(s, i) {
            var l = s._fullLayout, u2 = true;
            return l._glcanvas.each(function(c) {
              if (!c.regl && (!c.pick || l._has("parcoords"))) {
                try {
                  c.regl = o({ canvas: this, attributes: { antialias: !c.pick, preserveDrawingBuffer: true }, pixelRatio: s._context.plotGlPixelRatio || n.devicePixelRatio, extensions: i || [] });
                } catch {
                  u2 = false;
                }
                c.regl || (u2 = false), u2 && this.addEventListener("webglcontextlost", function(f) {
                  s && s.emit && s.emit("plotly_webglcontextlost", { event: f, layer: c.key });
                }, false);
              }
            }), u2 || a({ container: l._glcontainer.node() }), u2;
          };
        }).call(this);
      }).call(this, typeof global < "u" ? global : typeof self < "u" ? self : typeof window < "u" ? window : {});
    }, { "./show_no_webgl_msg": 525, regl: 283 }], 517: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("is-mobile");
      t.exports = function(o) {
        var s;
        if (typeof (s = o && o.hasOwnProperty("userAgent") ? o.userAgent : function() {
          var p;
          return typeof navigator < "u" && (p = navigator.userAgent), p && p.headers && typeof p.headers["user-agent"] == "string" && (p = p.headers["user-agent"]), p;
        }()) != "string") return true;
        var i = a({ ua: { headers: { "user-agent": s } }, tablet: true, featureDetect: false });
        if (!i) {
          for (var l = s.split(" "), u2 = 1; u2 < l.length; u2++) if (l[u2].indexOf("Safari") !== -1) for (var c = u2 - 1; c > -1; c--) {
            var f = l[c];
            if (f.substr(0, 8) === "Version/") {
              var h = f.substr(8).split(".")[0];
              if (n(h) && (h = +h), h >= 13) return true;
            }
          }
        }
        return i;
      };
    }, { "fast-isnumeric": 190, "is-mobile": 234 }], 518: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a) {
        if (a instanceof RegExp) {
          for (var o = a.toString(), s = 0; s < n.length; s++) if (n[s] instanceof RegExp && n[s].toString() === o) return n;
          n.push(a);
        } else !a && a !== 0 || n.indexOf(a) !== -1 || n.push(a);
        return n;
      };
    }, {}], 519: [function(e, t, r) {
      "use strict";
      var n = e("../lib"), a = e("../plot_api/plot_config").dfltConfig, o = { add: function(s, i, l, u2, c) {
        var f, h;
        s.undoQueue = s.undoQueue || { index: 0, queue: [], sequence: false }, h = s.undoQueue.index, s.autoplay ? s.undoQueue.inSequence || (s.autoplay = false) : (!s.undoQueue.sequence || s.undoQueue.beginSequence ? (f = { undo: { calls: [], args: [] }, redo: { calls: [], args: [] } }, s.undoQueue.queue.splice(h, s.undoQueue.queue.length - h, f), s.undoQueue.index += 1) : f = s.undoQueue.queue[h - 1], s.undoQueue.beginSequence = false, f && (f.undo.calls.unshift(i), f.undo.args.unshift(l), f.redo.calls.push(u2), f.redo.args.push(c)), s.undoQueue.queue.length > a.queueLength && (s.undoQueue.queue.shift(), s.undoQueue.index--));
      }, startSequence: function(s) {
        s.undoQueue = s.undoQueue || { index: 0, queue: [], sequence: false }, s.undoQueue.sequence = true, s.undoQueue.beginSequence = true;
      }, stopSequence: function(s) {
        s.undoQueue = s.undoQueue || { index: 0, queue: [], sequence: false }, s.undoQueue.sequence = false, s.undoQueue.beginSequence = false;
      }, undo: function(s) {
        var i, l;
        if (!(s.undoQueue === void 0 || isNaN(s.undoQueue.index) || s.undoQueue.index <= 0)) {
          for (s.undoQueue.index--, i = s.undoQueue.queue[s.undoQueue.index], s.undoQueue.inSequence = true, l = 0; l < i.undo.calls.length; l++) o.plotDo(s, i.undo.calls[l], i.undo.args[l]);
          s.undoQueue.inSequence = false, s.autoplay = false;
        }
      }, redo: function(s) {
        var i, l;
        if (!(s.undoQueue === void 0 || isNaN(s.undoQueue.index) || s.undoQueue.index >= s.undoQueue.queue.length)) {
          for (i = s.undoQueue.queue[s.undoQueue.index], s.undoQueue.inSequence = true, l = 0; l < i.redo.calls.length; l++) o.plotDo(s, i.redo.calls[l], i.redo.args[l]);
          s.undoQueue.inSequence = false, s.autoplay = false, s.undoQueue.index++;
        }
      } };
      o.plotDo = function(s, i, l) {
        s.autoplay = true, l = function(u2, c) {
          for (var f, h = [], p = 0; p < c.length; p++) f = c[p], h[p] = f === u2 ? f : typeof f == "object" ? Array.isArray(f) ? n.extendDeep([], f) : n.extendDeepAll({}, f) : f;
          return h;
        }(s, l), i.apply(null, l);
      }, t.exports = o;
    }, { "../lib": 503, "../plot_api/plot_config": 541 }], 520: [function(e, t, r) {
      "use strict";
      r.counter = function(n, a, o, s) {
        var i = (a || "") + (o ? "" : "$"), l = s === false ? "" : "^";
        return n === "xy" ? new RegExp(l + "x([2-9]|[1-9][0-9]+)?y([2-9]|[1-9][0-9]+)?" + i) : new RegExp(l + n + "([2-9]|[1-9][0-9]+)?" + i);
      };
    }, {}], 521: [function(e, t, r) {
      "use strict";
      var n = /^(.*)(\.[^\.\[\]]+|\[\d\])$/, a = /^[^\.\[\]]+$/;
      t.exports = function(o, s) {
        for (; s; ) {
          var i = o.match(n);
          if (i) o = i[1];
          else {
            if (!o.match(a)) throw new Error("bad relativeAttr call:" + [o, s]);
            o = "";
          }
          if (s.charAt(0) !== "^") break;
          s = s.slice(1);
        }
        return o && s.charAt(0) !== "[" ? o + "." + s : o + s;
      };
    }, {}], 522: [function(e, t, r) {
      "use strict";
      var n = e("./array").isArrayOrTypedArray, a = e("./is_plain_object");
      t.exports = function o(s, i) {
        for (var l in i) {
          var u2 = i[l], c = s[l];
          if (c !== u2) if (l.charAt(0) === "_" || typeof u2 == "function") {
            if (l in s) continue;
            s[l] = u2;
          } else if (n(u2) && n(c) && a(u2[0])) {
            if (l === "customdata" || l === "ids") continue;
            for (var f = Math.min(u2.length, c.length), h = 0; h < f; h++) c[h] !== u2[h] && a(u2[h]) && a(c[h]) && o(c[h], u2[h]);
          } else a(u2) && a(c) && (o(c, u2), Object.keys(c).length || delete s[l]);
        }
      };
    }, { "./array": 485, "./is_plain_object": 504 }], 523: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("./loggers"), o = e("./identity"), s = e("../constants/numerical").BADNUM;
      function i(f, h) {
        return f < h;
      }
      function l(f, h) {
        return f <= h;
      }
      function u2(f, h) {
        return f > h;
      }
      function c(f, h) {
        return f >= h;
      }
      r.findBin = function(f, h, p) {
        if (n(h.start)) return p ? Math.ceil((f - h.start) / h.size - 1e-9) - 1 : Math.floor((f - h.start) / h.size + 1e-9);
        var d, v, m = 0, g = h.length, x = 0, b = g > 1 ? (h[g - 1] - h[0]) / (g - 1) : 1;
        for (v = b >= 0 ? p ? i : l : p ? c : u2, f += 1e-9 * b * (p ? -1 : 1) * (b >= 0 ? 1 : -1); m < g && x++ < 100; ) v(h[d = Math.floor((m + g) / 2)], f) ? m = d + 1 : g = d;
        return x > 90 && a.log("Long binary search..."), m - 1;
      }, r.sorterAsc = function(f, h) {
        return f - h;
      }, r.sorterDes = function(f, h) {
        return h - f;
      }, r.distinctVals = function(f) {
        var h, p = f.slice();
        for (p.sort(r.sorterAsc), h = p.length - 1; h > -1 && p[h] === s; h--) ;
        for (var d, v = p[h] - p[0] || 1, m = v / (h || 1) / 1e4, g = [], x = 0; x <= h; x++) {
          var b = p[x], y = b - d;
          d === void 0 ? (g.push(b), d = b) : y > m && (v = Math.min(v, y), g.push(b), d = b);
        }
        return { vals: g, minDiff: v };
      }, r.roundUp = function(f, h, p) {
        for (var d, v = 0, m = h.length - 1, g = 0, x = p ? 0 : 1, b = p ? 1 : 0, y = p ? Math.ceil : Math.floor; v < m && g++ < 100; ) h[d = y((v + m) / 2)] <= f ? v = d + x : m = d - b;
        return h[v];
      }, r.sort = function(f, h) {
        for (var p = 0, d = 0, v = 1; v < f.length; v++) {
          var m = h(f[v], f[v - 1]);
          if (m < 0 ? p = 1 : m > 0 && (d = 1), p && d) return f.sort(h);
        }
        return d ? f : f.reverse();
      }, r.findIndexOfMin = function(f, h) {
        h = h || o;
        for (var p, d = 1 / 0, v = 0; v < f.length; v++) {
          var m = h(f[v]);
          m < d && (d = m, p = v);
        }
        return p;
      };
    }, { "../constants/numerical": 479, "./identity": 501, "./loggers": 507, "fast-isnumeric": 190 }], 524: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a) {
        (n.attr("class") || "").split(" ").forEach(function(o) {
          o.indexOf("cursor-") === 0 && n.classed(o, false);
        }), a && n.classed("cursor-" + a, true);
      };
    }, {}], 525: [function(e, t, r) {
      "use strict";
      var n = e("../components/color"), a = function() {
      };
      t.exports = function(o) {
        for (var s in o) typeof o[s] == "function" && (o[s] = a);
        o.destroy = function() {
          o.container.parentNode.removeChild(o.container);
        };
        var i = document.createElement("div");
        i.className = "no-webgl", i.style.cursor = "pointer", i.style.fontSize = "24px", i.style.color = n.defaults[0], i.style.position = "absolute", i.style.left = i.style.top = "0px", i.style.width = i.style.height = "100%", i.style["background-color"] = n.lightLine, i.style["z-index"] = 30;
        var l = document.createElement("p");
        return l.textContent = "WebGL is not supported by your browser - visit https://get.webgl.org for more info", l.style.position = "relative", l.style.top = "50%", l.style.left = "50%", l.style.height = "30%", l.style.width = "50%", l.style.margin = "-15% 0 0 -25%", i.appendChild(l), o.container.appendChild(i), o.container.style.background = "#FFFFFF", o.container.onclick = function() {
          window.open("https://get.webgl.org");
        }, false;
      };
    }, { "../components/color": 366 }], 526: [function(e, t, r) {
      "use strict";
      t.exports = function(n) {
        return Object.keys(n).sort();
      };
    }, {}], 527: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("./array").isArrayOrTypedArray;
      r.aggNums = function(o, s, i, l) {
        var u2, c;
        if ((!l || l > i.length) && (l = i.length), n(s) || (s = false), a(i[0])) {
          for (c = new Array(l), u2 = 0; u2 < l; u2++) c[u2] = r.aggNums(o, s, i[u2]);
          i = c;
        }
        for (u2 = 0; u2 < l; u2++) n(s) ? n(i[u2]) && (s = o(+s, +i[u2])) : s = i[u2];
        return s;
      }, r.len = function(o) {
        return r.aggNums(function(s) {
          return s + 1;
        }, 0, o);
      }, r.mean = function(o, s) {
        return s || (s = r.len(o)), r.aggNums(function(i, l) {
          return i + l;
        }, 0, o) / s;
      }, r.midRange = function(o) {
        if (o !== void 0 && o.length !== 0) return (r.aggNums(Math.max, null, o) + r.aggNums(Math.min, null, o)) / 2;
      }, r.variance = function(o, s, i) {
        return s || (s = r.len(o)), n(i) || (i = r.mean(o, s)), r.aggNums(function(l, u2) {
          return l + Math.pow(u2 - i, 2);
        }, 0, o) / s;
      }, r.stdev = function(o, s, i) {
        return Math.sqrt(r.variance(o, s, i));
      }, r.median = function(o) {
        var s = o.slice().sort();
        return r.interp(s, 0.5);
      }, r.interp = function(o, s) {
        if (!n(s)) throw "n should be a finite number";
        if ((s = s * o.length - 0.5) < 0) return o[0];
        if (s > o.length - 1) return o[o.length - 1];
        var i = s % 1;
        return i * o[Math.ceil(s)] + (1 - i) * o[Math.floor(s)];
      };
    }, { "./array": 485, "fast-isnumeric": 190 }], 528: [function(e, t, r) {
      "use strict";
      var n = e("color-normalize");
      t.exports = function(a) {
        return a ? n(a) : [0, 0, 0, 1];
      };
    }, { "color-normalize": 89 }], 529: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../lib"), o = a.strTranslate, s = e("../constants/xmlns_namespaces"), i = e("../constants/alignment").LINE_SPACING, l = /([^$]*)([$]+[^$]*[$]+)([^$]*)/;
      r.convertToTspans = function(N2, D2, I2) {
        var O2 = N2.text(), L2 = !N2.attr("data-notex") && typeof MathJax < "u" && O2.match(l), V2 = n.select(N2.node().parentNode);
        if (!V2.empty()) {
          var W2 = N2.attr("class") ? N2.attr("class").split(" ")[0] : "text";
          return W2 += "-math", V2.selectAll("svg." + W2).remove(), V2.selectAll("g." + W2 + "-group").remove(), N2.style("display", null).attr({ "data-unformatted": O2, "data-math": "N" }), L2 ? (D2 && D2._promises || []).push(new Promise(function(Y2) {
            N2.style("display", "none");
            var K2 = parseInt(N2.node().style.fontSize, 10), q = { fontSize: K2 };
            (function(re, R2, z) {
              var H2, te, j, Q2;
              MathJax.Hub.Queue(function() {
                return te = a.extendDeepAll({}, MathJax.Hub.config), j = MathJax.Hub.processSectionDelay, MathJax.Hub.processSectionDelay !== void 0 && (MathJax.Hub.processSectionDelay = 0), MathJax.Hub.Config({ messageStyle: "none", tex2jax: { inlineMath: [["$", "$"], ["\\(", "\\)"]] }, displayAlign: "left" });
              }, function() {
                if ((H2 = MathJax.Hub.config.menuSettings.renderer) !== "SVG") return MathJax.Hub.setRenderer("SVG");
              }, function() {
                var Z2 = "math-output-" + a.randstr({}, 64);
                return Q2 = n.select("body").append("div").attr({ id: Z2 }).style({ visibility: "hidden", position: "absolute" }).style({ "font-size": R2.fontSize + "px" }).text(re.replace(u2, "\\lt ").replace(c, "\\gt ")), MathJax.Hub.Typeset(Q2.node());
              }, function() {
                var Z2 = n.select("body").select("#MathJax_SVG_glyphs");
                if (Q2.select(".MathJax_SVG").empty() || !Q2.select("svg").node()) a.log("There was an error in the tex syntax.", re), z();
                else {
                  var ne = Q2.select("svg").node().getBoundingClientRect();
                  z(Q2.select(".MathJax_SVG"), Z2, ne);
                }
                if (Q2.remove(), H2 !== "SVG") return MathJax.Hub.setRenderer(H2);
              }, function() {
                return j !== void 0 && (MathJax.Hub.processSectionDelay = j), MathJax.Hub.Config(te);
              });
            })(L2[2], q, function(re, R2, z) {
              V2.selectAll("svg." + W2).remove(), V2.selectAll("g." + W2 + "-group").remove();
              var H2 = re && re.select("svg");
              if (!H2 || !H2.node()) return X2(), void Y2();
              var te = V2.append("g").classed(W2 + "-group", true).attr({ "pointer-events": "none", "data-unformatted": O2, "data-math": "Y" });
              te.node().appendChild(H2.node()), R2 && R2.node() && H2.node().insertBefore(R2.node().cloneNode(true), H2.node().firstChild);
              var j = z.width, Q2 = z.height;
              H2.attr({ class: W2, height: Q2, preserveAspectRatio: "xMinYMin meet" }).style({ overflow: "visible", "pointer-events": "none" });
              var Z2 = N2.node().style.fill || "black", ne = H2.select("g");
              ne.attr({ fill: Z2, stroke: Z2 });
              var ae = ne.node().getBoundingClientRect(), ue = ae.width, le = ae.height;
              (ue > j || le > Q2) && (H2.style("overflow", "hidden"), ue = (ae = H2.node().getBoundingClientRect()).width, le = ae.height);
              var ce = +N2.attr("x"), se = +N2.attr("y"), he = -(K2 || N2.node().getBoundingClientRect().height) / 4;
              if (W2[0] === "y") te.attr({ transform: "rotate(" + [-90, ce, se] + ")" + o(-ue / 2, he - le / 2) });
              else if (W2[0] === "l") se = he - le / 2;
              else if (W2[0] === "a" && W2.indexOf("atitle") !== 0) ce = 0, se = he;
              else {
                var me = N2.attr("text-anchor");
                ce -= ue * (me === "middle" ? 0.5 : me === "end" ? 1 : 0), se = se + he - le / 2;
              }
              H2.attr({ x: ce, y: se }), I2 && I2.call(N2, te), Y2(te);
            });
          })) : X2(), N2;
        }
        function X2() {
          V2.empty() || (W2 = N2.attr("class") + "-math", V2.select("svg." + W2).remove()), N2.text("").style("white-space", "pre"), function(Y2, K2) {
            K2 = K2.replace(v, " ");
            var q, re = false, R2 = [], z = -1;
            function H2() {
              z++;
              var Ae = document.createElementNS(s.svg, "tspan");
              n.select(Ae).attr({ class: "line", dy: z * i + "em" }), Y2.appendChild(Ae), q = Ae;
              var pe = R2;
              if (R2 = [{ node: Ae }], pe.length > 1) for (var ve = 1; ve < pe.length; ve++) te(pe[ve]);
            }
            function te(Ae) {
              var pe, ve = Ae.type, Ee = {};
              if (ve === "a") {
                pe = "a";
                var Se = Ae.target, Ce = Ae.href, Be = Ae.popup;
                Ce && (Ee = { "xlink:xlink:show": Se === "_blank" || Se.charAt(0) !== "_" ? "new" : "replace", target: Se, "xlink:xlink:href": Ce }, Be && (Ee.onclick = 'window.open(this.href.baseVal,this.target.baseVal,"' + Be + '");return false;'));
              } else pe = "tspan";
              Ae.style && (Ee.style = Ae.style);
              var Ue = document.createElementNS(s.svg, pe);
              if (ve === "sup" || ve === "sub") {
                j(q, "\u200B"), q.appendChild(Ue);
                var Ke = document.createElementNS(s.svg, "tspan");
                j(Ke, "\u200B"), n.select(Ke).attr("dy", p[ve]), Ee.dy = h[ve], q.appendChild(Ue), q.appendChild(Ke);
              } else q.appendChild(Ue);
              n.select(Ue).attr(Ee), q = Ae.node = Ue, R2.push(Ae);
            }
            function j(Ae, pe) {
              Ae.appendChild(document.createTextNode(pe));
            }
            function Q2(Ae) {
              if (R2.length !== 1) {
                var pe = R2.pop();
                Ae !== pe.type && a.log("Start tag <" + pe.type + "> doesnt match end tag <" + Ae + ">. Pretending it did match.", K2), q = R2[R2.length - 1].node;
              } else a.log("Ignoring unexpected end tag </" + Ae + ">.", K2);
            }
            x.test(K2) ? H2() : (q = Y2, R2 = [{ node: Y2 }]);
            for (var Z2 = K2.split(m), ne = 0; ne < Z2.length; ne++) {
              var ae = Z2[ne], ue = ae.match(g), le = ue && ue[2].toLowerCase(), ce = f[le];
              if (le === "br") H2();
              else if (ce === void 0) j(q, C2(ae));
              else if (ue[1]) Q2(le);
              else {
                var se = ue[4], he = { type: le }, me = k(se, b);
                if (me ? (me = me.replace(T2, "$1 fill:"), ce && (me += ";" + ce)) : ce && (me = ce), me && (he.style = me), le === "a") {
                  re = true;
                  var we = k(se, y);
                  if (we) {
                    var be = E2(we);
                    be && (he.href = be, he.target = k(se, w) || "_blank", he.popup = k(se, _4));
                  }
                }
                te(he);
              }
            }
            return re;
          }(N2.node(), O2) && N2.style("pointer-events", "all"), r.positionText(N2), I2 && I2.call(N2);
        }
      };
      var u2 = /(<|&lt;|&#60;)/g, c = /(>|&gt;|&#62;)/g, f = { sup: "font-size:70%", sub: "font-size:70%", b: "font-weight:bold", i: "font-style:italic", a: "cursor:pointer", span: "", em: "font-style:italic;font-weight:bold" }, h = { sub: "0.3em", sup: "-0.6em" }, p = { sub: "-0.21em", sup: "0.42em" }, d = ["http:", "https:", "mailto:", "", void 0, ":"], v = r.NEWLINES = /(\r\n?|\n)/g, m = /(<[^<>]*>)/, g = /<(\/?)([^ >]*)(\s+(.*))?>/i, x = /<br(\s+.*)?>/i;
      r.BR_TAG_ALL = /<br(\s+.*)?>/gi;
      var b = /(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i, y = /(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i, w = /(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i, _4 = /(^|[\s"'])popup\s*=\s*("([\w=,]*)"|'([\w=,]*)')/i;
      function k(N2, D2) {
        if (!N2) return null;
        var I2 = N2.match(D2), O2 = I2 && (I2[3] || I2[4]);
        return O2 && C2(O2);
      }
      var T2 = /(^|;)\s*color:/;
      r.plainText = function(N2, D2) {
        for (var I2 = (D2 = D2 || {}).len !== void 0 && D2.len !== -1 ? D2.len : 1 / 0, O2 = D2.allowedTags !== void 0 ? D2.allowedTags : ["br"], L2 = 3, V2 = N2.split(m), W2 = [], X2 = "", Y2 = 0, K2 = 0; K2 < V2.length; K2++) {
          var q = V2[K2], re = q.match(g), R2 = re && re[2].toLowerCase();
          if (R2) O2.indexOf(R2) !== -1 && (W2.push(q), X2 = R2);
          else {
            var z = q.length;
            if (Y2 + z < I2) W2.push(q), Y2 += z;
            else if (Y2 < I2) {
              var H2 = I2 - Y2;
              X2 && (X2 !== "br" || H2 <= L2 || z <= L2) && W2.pop(), I2 > L2 ? W2.push(q.substr(0, H2 - L2) + "...") : W2.push(q.substr(0, H2));
              break;
            }
            X2 = "";
          }
        }
        return W2.join("");
      };
      var A2 = { mu: "\u03BC", amp: "&", lt: "<", gt: ">", nbsp: "\xA0", times: "\xD7", plusmn: "\xB1", deg: "\xB0" }, S2 = /&(#\d+|#x[\da-fA-F]+|[a-z]+);/g;
      function C2(N2) {
        return N2.replace(S2, function(D2, I2) {
          return (I2.charAt(0) === "#" ? function(O2) {
            if (!(O2 > 1114111)) {
              var L2 = String.fromCodePoint;
              if (L2) return L2(O2);
              var V2 = String.fromCharCode;
              return O2 <= 65535 ? V2(O2) : V2(55232 + (O2 >> 10), O2 % 1024 + 56320);
            }
          }(I2.charAt(1) === "x" ? parseInt(I2.substr(2), 16) : parseInt(I2.substr(1), 10)) : A2[I2]) || D2;
        });
      }
      function E2(N2) {
        var D2 = encodeURI(decodeURI(N2)), I2 = document.createElement("a"), O2 = document.createElement("a");
        I2.href = N2, O2.href = D2;
        var L2 = I2.protocol, V2 = O2.protocol;
        return d.indexOf(L2) !== -1 && d.indexOf(V2) !== -1 ? D2 : "";
      }
      function F13(N2, D2, I2) {
        var O2, L2, V2, W2 = I2.horizontalAlign, X2 = I2.verticalAlign || "top", Y2 = N2.node().getBoundingClientRect(), K2 = D2.node().getBoundingClientRect();
        return L2 = X2 === "bottom" ? function() {
          return Y2.bottom - O2.height;
        } : X2 === "middle" ? function() {
          return Y2.top + (Y2.height - O2.height) / 2;
        } : function() {
          return Y2.top;
        }, V2 = W2 === "right" ? function() {
          return Y2.right - O2.width;
        } : W2 === "center" ? function() {
          return Y2.left + (Y2.width - O2.width) / 2;
        } : function() {
          return Y2.left;
        }, function() {
          O2 = this.node().getBoundingClientRect();
          var q = V2() - K2.left, re = L2() - K2.top, R2 = I2.gd || {};
          if (I2.gd) {
            R2._fullLayout._calcInverseTransform(R2);
            var z = a.apply3DTransform(R2._fullLayout._invTransform)(q, re);
            q = z[0], re = z[1];
          }
          return this.style({ top: re + "px", left: q + "px", "z-index": 1e3 }), this;
        };
      }
      r.convertEntities = C2, r.sanitizeHTML = function(N2) {
        N2 = N2.replace(v, " ");
        for (var D2 = document.createElement("p"), I2 = D2, O2 = [], L2 = N2.split(m), V2 = 0; V2 < L2.length; V2++) {
          var W2 = L2[V2], X2 = W2.match(g), Y2 = X2 && X2[2].toLowerCase();
          if (Y2 in f) if (X2[1]) O2.length && (I2 = O2.pop());
          else {
            var K2 = X2[4], q = k(K2, b), re = q ? { style: q } : {};
            if (Y2 === "a") {
              var R2 = k(K2, y);
              if (R2) {
                var z = E2(R2);
                if (z) {
                  re.href = z;
                  var H2 = k(K2, w);
                  H2 && (re.target = H2);
                }
              }
            }
            var te = document.createElement(Y2);
            I2.appendChild(te), n.select(te).attr(re), I2 = te, O2.push(te);
          }
          else I2.appendChild(document.createTextNode(C2(W2)));
        }
        return D2.innerHTML;
      }, r.lineCount = function(N2) {
        return N2.selectAll("tspan.line").size() || 1;
      }, r.positionText = function(N2, D2, I2) {
        return N2.each(function() {
          var O2 = n.select(this);
          function L2(X2, Y2) {
            return Y2 === void 0 ? (Y2 = O2.attr(X2)) === null && (O2.attr(X2, 0), Y2 = 0) : O2.attr(X2, Y2), Y2;
          }
          var V2 = L2("x", D2), W2 = L2("y", I2);
          this.nodeName === "text" && O2.selectAll("tspan.line").attr({ x: V2, y: W2 });
        });
      }, r.makeTextShadow = function(N2) {
        var D2 = "1px ", I2 = "1px ", O2 = "1px ";
        return D2 + I2 + O2 + N2 + ", -" + D2 + "-" + I2 + O2 + N2 + ", " + D2 + "-" + I2 + O2 + N2 + ", -" + D2 + I2 + O2 + N2;
      }, r.makeEditable = function(N2, D2) {
        var I2 = D2.gd, O2 = D2.delegate, L2 = n.dispatch("edit", "input", "cancel"), V2 = O2 || N2;
        if (N2.style({ "pointer-events": O2 ? "none" : "all" }), N2.size() !== 1) throw new Error("boo");
        function W2() {
          (function() {
            var q = n.select(I2).select(".svg-container"), re = q.append("div"), R2 = N2.node().style, z = parseFloat(R2.fontSize || 12), H2 = D2.text;
            H2 === void 0 && (H2 = N2.attr("data-unformatted")), re.classed("plugin-editable editable", true).style({ position: "absolute", "font-family": R2.fontFamily || "Arial", "font-size": z, color: D2.fill || R2.fill || "black", opacity: 1, "background-color": D2.background || "transparent", outline: "#ffffff33 1px solid", margin: [-z / 8 + 1, 0, 0, -1].join("px ") + "px", padding: "0", "box-sizing": "border-box" }).attr({ contenteditable: true }).text(H2).call(F13(N2, q, D2)).on("blur", function() {
              I2._editing = false, N2.text(this.textContent).style({ opacity: 1 });
              var te, j = n.select(this).attr("class");
              (te = j ? "." + j.split(" ")[0] + "-math-group" : "[class*=-math-group]") && n.select(N2.node().parentNode).select(te).style({ opacity: 0 });
              var Q2 = this.textContent;
              n.select(this).transition().duration(0).remove(), n.select(document).on("mouseup", null), L2.edit.call(N2, Q2);
            }).on("focus", function() {
              var te = this;
              I2._editing = true, n.select(document).on("mouseup", function() {
                if (n.event.target === te) return false;
                document.activeElement === re.node() && re.node().blur();
              });
            }).on("keyup", function() {
              n.event.which === 27 ? (I2._editing = false, N2.style({ opacity: 1 }), n.select(this).style({ opacity: 0 }).on("blur", function() {
                return false;
              }).transition().remove(), L2.cancel.call(N2, this.textContent)) : (L2.input.call(N2, this.textContent), n.select(this).call(F13(N2, q, D2)));
            }).on("keydown", function() {
              n.event.which === 13 && this.blur();
            }).call(X2);
          })(), N2.style({ opacity: 0 });
          var Y2, K2 = V2.attr("class");
          (Y2 = K2 ? "." + K2.split(" ")[0] + "-math-group" : "[class*=-math-group]") && n.select(N2.node().parentNode).select(Y2).style({ opacity: 0 });
        }
        function X2(Y2) {
          var K2 = Y2.node(), q = document.createRange();
          q.selectNodeContents(K2);
          var re = window.getSelection();
          re.removeAllRanges(), re.addRange(q), K2.focus();
        }
        return D2.immediate ? W2() : V2.on("click", W2), n.rebind(N2, L2, "on");
      };
    }, { "../constants/alignment": 471, "../constants/xmlns_namespaces": 480, "../lib": 503, "@plotly/d3": 58 }], 530: [function(e, t, r) {
      "use strict";
      var n = {};
      function a(o) {
        o && o.timer !== null && (clearTimeout(o.timer), o.timer = null);
      }
      r.throttle = function(o, s, i) {
        var l = n[o], u2 = Date.now();
        if (!l) {
          for (var c in n) n[c].ts < u2 - 6e4 && delete n[c];
          l = n[o] = { ts: 0, timer: null };
        }
        function f() {
          i(), l.ts = Date.now(), l.onDone && (l.onDone(), l.onDone = null);
        }
        a(l), u2 > l.ts + s ? f() : l.timer = setTimeout(function() {
          f(), l.timer = null;
        }, s);
      }, r.done = function(o) {
        var s = n[o];
        return s && s.timer ? new Promise(function(i) {
          var l = s.onDone;
          s.onDone = function() {
            l && l(), i(), s.onDone = null;
          };
        }) : Promise.resolve();
      }, r.clear = function(o) {
        if (o) a(n[o]), delete n[o];
        else for (var s in n) r.clear(s);
      };
    }, {}], 531: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric");
      t.exports = function(a, o) {
        if (a > 0) return Math.log(a) / Math.LN10;
        var s = Math.log(Math.min(o[0], o[1])) / Math.LN10;
        return n(s) || (s = Math.log(Math.max(o[0], o[1])) / Math.LN10 - 6), s;
      };
    }, { "fast-isnumeric": 190 }], 532: [function(e, t, r) {
      "use strict";
      var n = t.exports = {}, a = e("../plots/geo/constants").locationmodeToLayer, o = e("topojson-client").feature;
      n.getTopojsonName = function(s) {
        return [s.scope.replace(/ /g, "-"), "_", s.resolution.toString(), "m"].join("");
      }, n.getTopojsonPath = function(s, i) {
        return s + i + ".json";
      }, n.getTopojsonFeatures = function(s, i) {
        var l = a[s.locationmode], u2 = i.objects[l];
        return o(i, u2).features;
      };
    }, { "../plots/geo/constants": 587, "topojson-client": 315 }], 533: [function(e, t, r) {
      "use strict";
      t.exports = { moduleType: "locale", name: "en-US", dictionary: { "Click to enter Colorscale title": "Click to enter Colorscale title" }, format: { date: "%m/%d/%Y" } };
    }, {}], 534: [function(e, t, r) {
      "use strict";
      t.exports = { moduleType: "locale", name: "en", dictionary: { "Click to enter Colorscale title": "Click to enter Colourscale title" }, format: { days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], periods: ["AM", "PM"], dateTime: "%a %b %e %X %Y", date: "%d/%m/%Y", time: "%H:%M:%S", decimal: ".", thousands: ",", grouping: [3], currency: ["$", ""], year: "%Y", month: "%b %Y", dayMonth: "%b %-d", dayMonthYear: "%b %-d, %Y" } };
    }, {}], 535: [function(e, t, r) {
      "use strict";
      var n = e("../registry");
      t.exports = function(a) {
        for (var o, s, i = n.layoutArrayContainers, l = n.layoutArrayRegexes, u2 = a.split("[")[0], c = 0; c < l.length; c++) if ((s = a.match(l[c])) && s.index === 0) {
          o = s[0];
          break;
        }
        if (o || (o = i[i.indexOf(u2)]), !o) return false;
        var f = a.substr(o.length);
        return f ? !!(s = f.match(/^\[(0|[1-9][0-9]*)\](\.(.+))?$/)) && { array: o, index: Number(s[1]), property: s[3] || "" } : { array: o, index: "", property: "" };
      };
    }, { "../registry": 638 }], 536: [function(e, t, r) {
      "use strict";
      var n = e("../lib"), a = n.extendFlat, o = n.isPlainObject, s = { valType: "flaglist", extras: ["none"], flags: ["calc", "clearAxisTypes", "plot", "style", "markerSize", "colorbars"] }, i = { valType: "flaglist", extras: ["none"], flags: ["calc", "plot", "legend", "ticks", "axrange", "layoutstyle", "modebar", "camera", "arraydraw", "colorbars"] }, l = s.flags.slice().concat(["fullReplot"]), u2 = i.flags.slice().concat("layoutReplot");
      function c(p) {
        for (var d = {}, v = 0; v < p.length; v++) d[p[v]] = false;
        return d;
      }
      function f(p, d, v) {
        var m = a({}, p);
        for (var g in m) {
          var x = m[g];
          o(x) && (m[g] = h(x, d, v, g));
        }
        return v === "from-root" && (m.editType = d), m;
      }
      function h(p, d, v, m) {
        if (p.valType) {
          var g = a({}, p);
          if (g.editType = d, Array.isArray(p.items)) {
            g.items = new Array(p.items.length);
            for (var x = 0; x < p.items.length; x++) g.items[x] = h(p.items[x], d, "from-root");
          }
          return g;
        }
        return f(p, d, m.charAt(0) === "_" ? "nested" : "from-root");
      }
      t.exports = { traces: s, layout: i, traceFlags: function() {
        return c(l);
      }, layoutFlags: function() {
        return c(u2);
      }, update: function(p, d) {
        var v = d.editType;
        if (v && v !== "none") for (var m = v.split("+"), g = 0; g < m.length; g++) p[m[g]] = true;
      }, overrideAll: f };
    }, { "../lib": 503 }], 537: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("gl-mat4/fromQuat"), o = e("../registry"), s = e("../lib"), i = e("../plots/plots"), l = e("../plots/cartesian/axis_ids"), u2 = e("../components/color"), c = l.cleanId, f = l.getFromTrace, h = o.traceIs;
      function p(_4, k) {
        var T2 = _4[k], A2 = k.charAt(0);
        T2 && T2 !== "paper" && (_4[k] = c(T2, A2, true));
      }
      function d(_4) {
        function k(T2, A2) {
          var S2 = _4[T2], C2 = _4.title && _4.title[A2];
          S2 && !C2 && (_4.title || (_4.title = {}), _4.title[A2] = _4[T2], delete _4[T2]);
        }
        _4 && (typeof _4.title != "string" && typeof _4.title != "number" || (_4.title = { text: _4.title }), k("titlefont", "font"), k("titleposition", "position"), k("titleside", "side"), k("titleoffset", "offset"));
      }
      function v(_4) {
        if (!s.isPlainObject(_4)) return false;
        var k = _4.name;
        return delete _4.name, delete _4.showlegend, (typeof k == "string" || typeof k == "number") && String(k);
      }
      function m(_4, k, T2, A2) {
        if (T2 && !A2) return _4;
        if (A2 && !T2 || !_4.trim()) return k;
        if (!k.trim()) return _4;
        var S2, C2 = Math.min(_4.length, k.length);
        for (S2 = 0; S2 < C2 && _4.charAt(S2) === k.charAt(S2); S2++) ;
        return _4.substr(0, S2).trim();
      }
      function g(_4) {
        var k = "middle", T2 = "center";
        return typeof _4 == "string" && (_4.indexOf("top") !== -1 ? k = "top" : _4.indexOf("bottom") !== -1 && (k = "bottom"), _4.indexOf("left") !== -1 ? T2 = "left" : _4.indexOf("right") !== -1 && (T2 = "right")), k + " " + T2;
      }
      function x(_4, k) {
        return k in _4 && typeof _4[k] == "object" && Object.keys(_4[k]).length === 0;
      }
      r.clearPromiseQueue = function(_4) {
        Array.isArray(_4._promises) && _4._promises.length > 0 && s.log("Clearing previous rejected promises from queue."), _4._promises = [];
      }, r.cleanLayout = function(_4) {
        var k, T2;
        _4 || (_4 = {}), _4.xaxis1 && (_4.xaxis || (_4.xaxis = _4.xaxis1), delete _4.xaxis1), _4.yaxis1 && (_4.yaxis || (_4.yaxis = _4.yaxis1), delete _4.yaxis1), _4.scene1 && (_4.scene || (_4.scene = _4.scene1), delete _4.scene1);
        var A2 = (i.subplotsRegistry.cartesian || {}).attrRegex, S2 = (i.subplotsRegistry.polar || {}).attrRegex, C2 = (i.subplotsRegistry.ternary || {}).attrRegex, E2 = (i.subplotsRegistry.gl3d || {}).attrRegex, F13 = Object.keys(_4);
        for (k = 0; k < F13.length; k++) {
          var N2 = F13[k];
          if (A2 && A2.test(N2)) {
            var D2 = _4[N2];
            D2.anchor && D2.anchor !== "free" && (D2.anchor = c(D2.anchor)), D2.overlaying && (D2.overlaying = c(D2.overlaying)), D2.type || (D2.isdate ? D2.type = "date" : D2.islog ? D2.type = "log" : D2.isdate === false && D2.islog === false && (D2.type = "linear")), D2.autorange !== "withzero" && D2.autorange !== "tozero" || (D2.autorange = true, D2.rangemode = "tozero"), delete D2.islog, delete D2.isdate, delete D2.categories, x(D2, "domain") && delete D2.domain, D2.autotick !== void 0 && (D2.tickmode === void 0 && (D2.tickmode = D2.autotick ? "auto" : "linear"), delete D2.autotick), d(D2);
          } else if (S2 && S2.test(N2)) d(_4[N2].radialaxis);
          else if (C2 && C2.test(N2)) {
            var I2 = _4[N2];
            d(I2.aaxis), d(I2.baxis), d(I2.caxis);
          } else if (E2 && E2.test(N2)) {
            var O2 = _4[N2], L2 = O2.cameraposition;
            if (Array.isArray(L2) && L2[0].length === 4) {
              var V2 = L2[0], W2 = L2[1], X2 = L2[2], Y2 = a([], V2), K2 = [];
              for (T2 = 0; T2 < 3; ++T2) K2[T2] = W2[T2] + X2 * Y2[2 + 4 * T2];
              O2.camera = { eye: { x: K2[0], y: K2[1], z: K2[2] }, center: { x: W2[0], y: W2[1], z: W2[2] }, up: { x: 0, y: 0, z: 1 } }, delete O2.cameraposition;
            }
            d(O2.xaxis), d(O2.yaxis), d(O2.zaxis);
          }
        }
        var q = Array.isArray(_4.annotations) ? _4.annotations.length : 0;
        for (k = 0; k < q; k++) {
          var re = _4.annotations[k];
          s.isPlainObject(re) && (re.ref && (re.ref === "paper" ? (re.xref = "paper", re.yref = "paper") : re.ref === "data" && (re.xref = "x", re.yref = "y"), delete re.ref), p(re, "xref"), p(re, "yref"));
        }
        var R2 = Array.isArray(_4.shapes) ? _4.shapes.length : 0;
        for (k = 0; k < R2; k++) {
          var z = _4.shapes[k];
          s.isPlainObject(z) && (p(z, "xref"), p(z, "yref"));
        }
        var H2 = Array.isArray(_4.images) ? _4.images.length : 0;
        for (k = 0; k < H2; k++) {
          var te = _4.images[k];
          s.isPlainObject(te) && (p(te, "xref"), p(te, "yref"));
        }
        var j = _4.legend;
        return j && (j.x > 3 ? (j.x = 1.02, j.xanchor = "left") : j.x < -2 && (j.x = -0.02, j.xanchor = "right"), j.y > 3 ? (j.y = 1.02, j.yanchor = "bottom") : j.y < -2 && (j.y = -0.02, j.yanchor = "top")), d(_4), _4.dragmode === "rotate" && (_4.dragmode = "orbit"), u2.clean(_4), _4.template && _4.template.layout && r.cleanLayout(_4.template.layout), _4;
      }, r.cleanData = function(_4) {
        for (var k = 0; k < _4.length; k++) {
          var T2, A2 = _4[k];
          if (A2.type === "histogramy" && "xbins" in A2 && !("ybins" in A2) && (A2.ybins = A2.xbins, delete A2.xbins), A2.error_y && "opacity" in A2.error_y) {
            var S2 = u2.defaults, C2 = A2.error_y.color || (h(A2, "bar") ? u2.defaultLine : S2[k % S2.length]);
            A2.error_y.color = u2.addOpacity(u2.rgb(C2), u2.opacity(C2) * A2.error_y.opacity), delete A2.error_y.opacity;
          }
          if ("bardir" in A2 && (A2.bardir !== "h" || !h(A2, "bar") && A2.type.substr(0, 9) !== "histogram" || (A2.orientation = "h", r.swapXYData(A2)), delete A2.bardir), A2.type === "histogramy" && r.swapXYData(A2), A2.type !== "histogramx" && A2.type !== "histogramy" || (A2.type = "histogram"), "scl" in A2 && !("colorscale" in A2) && (A2.colorscale = A2.scl, delete A2.scl), "reversescl" in A2 && !("reversescale" in A2) && (A2.reversescale = A2.reversescl, delete A2.reversescl), A2.xaxis && (A2.xaxis = c(A2.xaxis, "x")), A2.yaxis && (A2.yaxis = c(A2.yaxis, "y")), h(A2, "gl3d") && A2.scene && (A2.scene = i.subplotsRegistry.gl3d.cleanId(A2.scene)), !h(A2, "pie-like") && !h(A2, "bar-like")) if (Array.isArray(A2.textposition)) for (T2 = 0; T2 < A2.textposition.length; T2++) A2.textposition[T2] = g(A2.textposition[T2]);
          else A2.textposition && (A2.textposition = g(A2.textposition));
          var E2 = o.getModule(A2);
          if (E2 && E2.colorbar) {
            var F13 = E2.colorbar.container, N2 = F13 ? A2[F13] : A2;
            N2 && N2.colorscale && (N2.colorscale === "YIGnBu" && (N2.colorscale = "YlGnBu"), N2.colorscale === "YIOrRd" && (N2.colorscale = "YlOrRd"));
          }
          if (A2.type === "surface" && s.isPlainObject(A2.contours)) {
            var D2 = ["x", "y", "z"];
            for (T2 = 0; T2 < D2.length; T2++) {
              var I2 = A2.contours[D2[T2]];
              s.isPlainObject(I2) && (I2.highlightColor && (I2.highlightcolor = I2.highlightColor, delete I2.highlightColor), I2.highlightWidth && (I2.highlightwidth = I2.highlightWidth, delete I2.highlightWidth));
            }
          }
          if (A2.type === "candlestick" || A2.type === "ohlc") {
            var O2 = (A2.increasing || {}).showlegend !== false, L2 = (A2.decreasing || {}).showlegend !== false, V2 = v(A2.increasing), W2 = v(A2.decreasing);
            if (V2 !== false && W2 !== false) {
              var X2 = m(V2, W2, O2, L2);
              X2 && (A2.name = X2);
            } else !V2 && !W2 || A2.name || (A2.name = V2 || W2);
          }
          if (Array.isArray(A2.transforms)) {
            var Y2 = A2.transforms;
            for (T2 = 0; T2 < Y2.length; T2++) {
              var K2 = Y2[T2];
              if (s.isPlainObject(K2)) switch (K2.type) {
                case "filter":
                  K2.filtersrc && (K2.target = K2.filtersrc, delete K2.filtersrc), K2.calendar && (K2.valuecalendar || (K2.valuecalendar = K2.calendar), delete K2.calendar);
                  break;
                case "groupby":
                  if (K2.styles = K2.styles || K2.style, K2.styles && !Array.isArray(K2.styles)) {
                    var q = K2.styles, re = Object.keys(q);
                    K2.styles = [];
                    for (var R2 = 0; R2 < re.length; R2++) K2.styles.push({ target: re[R2], value: q[re[R2]] });
                  }
              }
            }
          }
          x(A2, "line") && delete A2.line, "marker" in A2 && (x(A2.marker, "line") && delete A2.marker.line, x(A2, "marker") && delete A2.marker), u2.clean(A2), A2.autobinx && (delete A2.autobinx, delete A2.xbins), A2.autobiny && (delete A2.autobiny, delete A2.ybins), d(A2), A2.colorbar && d(A2.colorbar), A2.marker && A2.marker.colorbar && d(A2.marker.colorbar), A2.line && A2.line.colorbar && d(A2.line.colorbar), A2.aaxis && d(A2.aaxis), A2.baxis && d(A2.baxis);
        }
      }, r.swapXYData = function(_4) {
        var k;
        if (s.swapAttrs(_4, ["?", "?0", "d?", "?bins", "nbins?", "autobin?", "?src", "error_?"]), Array.isArray(_4.z) && Array.isArray(_4.z[0]) && (_4.transpose ? delete _4.transpose : _4.transpose = true), _4.error_x && _4.error_y) {
          var T2 = _4.error_y, A2 = "copy_ystyle" in T2 ? T2.copy_ystyle : !(T2.color || T2.thickness || T2.width);
          s.swapAttrs(_4, ["error_?.copy_ystyle"]), A2 && s.swapAttrs(_4, ["error_?.color", "error_?.thickness", "error_?.width"]);
        }
        if (typeof _4.hoverinfo == "string") {
          var S2 = _4.hoverinfo.split("+");
          for (k = 0; k < S2.length; k++) S2[k] === "x" ? S2[k] = "y" : S2[k] === "y" && (S2[k] = "x");
          _4.hoverinfo = S2.join("+");
        }
      }, r.coerceTraceIndices = function(_4, k) {
        if (n(k)) return [k];
        if (!Array.isArray(k) || !k.length) return _4.data.map(function(S2, C2) {
          return C2;
        });
        if (Array.isArray(k)) {
          for (var T2 = [], A2 = 0; A2 < k.length; A2++) s.isIndex(k[A2], _4.data.length) ? T2.push(k[A2]) : s.warn("trace index (", k[A2], ") is not a number or is out of bounds");
          return T2;
        }
        return k;
      }, r.manageArrayContainers = function(_4, k, T2) {
        var A2 = _4.obj, S2 = _4.parts, C2 = S2.length, E2 = S2[C2 - 1], F13 = n(E2);
        if (F13 && k === null) {
          var N2 = S2.slice(0, C2 - 1).join(".");
          s.nestedProperty(A2, N2).get().splice(E2, 1);
        } else F13 && _4.get() === void 0 && _4.get() === void 0 && (T2[_4.astr] = null), _4.set(k);
      };
      var b = /(\.[^\[\]\.]+|\[[^\[\]\.]+\])$/;
      function y(_4) {
        var k = _4.search(b);
        if (k > 0) return _4.substr(0, k);
      }
      r.hasParent = function(_4, k) {
        for (var T2 = y(k); T2; ) {
          if (T2 in _4) return true;
          T2 = y(T2);
        }
        return false;
      };
      var w = ["x", "y", "z"];
      r.clearAxisTypes = function(_4, k, T2) {
        for (var A2 = 0; A2 < k.length; A2++) for (var S2 = _4._fullData[A2], C2 = 0; C2 < 3; C2++) {
          var E2 = f(_4, S2, w[C2]);
          if (E2 && E2.type !== "log") {
            var F13 = E2._name, N2 = E2._id.substr(1);
            if (N2.substr(0, 5) === "scene") {
              if (T2[N2] !== void 0) continue;
              F13 = N2 + "." + F13;
            }
            var D2 = F13 + ".type";
            T2[F13] === void 0 && T2[D2] === void 0 && s.nestedProperty(_4.layout, D2).set(null);
          }
        }
      };
    }, { "../components/color": 366, "../lib": 503, "../plots/cartesian/axis_ids": 558, "../plots/plots": 619, "../registry": 638, "fast-isnumeric": 190, "gl-mat4/fromQuat": 200 }], 538: [function(e, t, r) {
      "use strict";
      var n = e("./plot_api");
      r._doPlot = n._doPlot, r.newPlot = n.newPlot, r.restyle = n.restyle, r.relayout = n.relayout, r.redraw = n.redraw, r.update = n.update, r._guiRestyle = n._guiRestyle, r._guiRelayout = n._guiRelayout, r._guiUpdate = n._guiUpdate, r._storeDirectGUIEdit = n._storeDirectGUIEdit, r.react = n.react, r.extendTraces = n.extendTraces, r.prependTraces = n.prependTraces, r.addTraces = n.addTraces, r.deleteTraces = n.deleteTraces, r.moveTraces = n.moveTraces, r.purge = n.purge, r.addFrames = n.addFrames, r.deleteFrames = n.deleteFrames, r.animate = n.animate, r.setPlotConfig = n.setPlotConfig, r.toImage = e("./to_image"), r.validate = e("./validate"), r.downloadImage = e("../snapshot/download");
      var a = e("./template_api");
      r.makeTemplate = a.makeTemplate, r.validateTemplate = a.validateTemplate;
    }, { "../snapshot/download": 640, "./plot_api": 540, "./template_api": 545, "./to_image": 546, "./validate": 547 }], 539: [function(e, t, r) {
      "use strict";
      var n = e("../lib/is_plain_object"), a = e("../lib/noop"), o = e("../lib/loggers"), s = e("../lib/search").sorterAsc, i = e("../registry");
      r.containerArrayMatch = e("./container_array_match");
      var l = r.isAddVal = function(c) {
        return c === "add" || n(c);
      }, u2 = r.isRemoveVal = function(c) {
        return c === null || c === "remove";
      };
      r.applyContainerArrayChanges = function(c, f, h, p, d) {
        var v = f.astr, m = i.getComponentMethod(v, "supplyLayoutDefaults"), g = i.getComponentMethod(v, "draw"), x = i.getComponentMethod(v, "drawOne"), b = p.replot || p.recalc || m === a || g === a, y = c.layout, w = c._fullLayout;
        if (h[""]) {
          Object.keys(h).length > 1 && o.warn("Full array edits are incompatible with other edits", v);
          var _4 = h[""][""];
          if (u2(_4)) f.set(null);
          else {
            if (!Array.isArray(_4)) return o.warn("Unrecognized full array edit value", v, _4), true;
            f.set(_4);
          }
          return !b && (m(y, w), g(c), true);
        }
        var k, T2, A2, S2, C2, E2, F13, N2, D2 = Object.keys(h).map(Number).sort(s), I2 = f.get(), O2 = I2 || [], L2 = d(w, v).get(), V2 = [], W2 = -1, X2 = O2.length;
        for (k = 0; k < D2.length; k++) if (S2 = h[A2 = D2[k]], C2 = Object.keys(S2), E2 = S2[""], F13 = l(E2), A2 < 0 || A2 > O2.length - (F13 ? 0 : 1)) o.warn("index out of range", v, A2);
        else if (E2 !== void 0) C2.length > 1 && o.warn("Insertion & removal are incompatible with edits to the same index.", v, A2), u2(E2) ? V2.push(A2) : F13 ? (E2 === "add" && (E2 = {}), O2.splice(A2, 0, E2), L2 && L2.splice(A2, 0, {})) : o.warn("Unrecognized full object edit value", v, A2, E2), W2 === -1 && (W2 = A2);
        else for (T2 = 0; T2 < C2.length; T2++) N2 = v + "[" + A2 + "].", d(O2[A2], C2[T2], N2).set(S2[C2[T2]]);
        for (k = V2.length - 1; k >= 0; k--) O2.splice(V2[k], 1), L2 && L2.splice(V2[k], 1);
        if (O2.length ? I2 || f.set(O2) : f.set(null), b) return false;
        if (m(y, w), x !== a) {
          var Y2;
          if (W2 === -1) Y2 = D2;
          else {
            for (X2 = Math.max(O2.length, X2), Y2 = [], k = 0; k < D2.length && !((A2 = D2[k]) >= W2); k++) Y2.push(A2);
            for (k = W2; k < X2; k++) Y2.push(k);
          }
          for (k = 0; k < Y2.length; k++) x(c, Y2[k]);
        } else g(c);
        return true;
      };
    }, { "../lib/is_plain_object": 504, "../lib/loggers": 507, "../lib/noop": 512, "../lib/search": 523, "../registry": 638, "./container_array_match": 535 }], 540: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("fast-isnumeric"), o = e("has-hover"), s = e("../lib"), i = s.nestedProperty, l = e("../lib/events"), u2 = e("../lib/queue"), c = e("../registry"), f = e("./plot_schema"), h = e("../plots/plots"), p = e("../plots/cartesian/axes"), d = e("../components/drawing"), v = e("../components/color"), m = e("../plots/cartesian/graph_interact").initInteractions, g = e("../constants/xmlns_namespaces"), x = e("../plots/cartesian/select").clearSelect, b = e("./plot_config").dfltConfig, y = e("./manage_arrays"), w = e("./helpers"), _4 = e("./subroutines"), k = e("./edit_types"), T2 = e("../plots/cartesian/constants").AX_NAME_PATTERN, A2 = 0;
      function S2(pe) {
        var ve = pe._fullLayout;
        ve._redrawFromAutoMarginCount ? ve._redrawFromAutoMarginCount-- : pe.emit("plotly_afterplot");
      }
      function C2(pe, ve) {
        try {
          pe._fullLayout._paper.style("background", ve);
        } catch (Ee) {
          s.error(Ee);
        }
      }
      function E2(pe, ve) {
        C2(pe, v.combine(ve, "white"));
      }
      function F13(pe, ve) {
        if (!pe._context) {
          pe._context = s.extendDeep({}, b);
          var Ee = n.select("base");
          pe._context._baseUrl = Ee.size() && Ee.attr("href") ? window.location.href.split("#")[0] : "";
        }
        var Se, Ce, Be, Ue = pe._context;
        if (ve) {
          for (Ce = Object.keys(ve), Se = 0; Se < Ce.length; Se++) (Be = Ce[Se]) !== "editable" && Be !== "edits" && Be in Ue && (Be === "setBackground" && ve[Be] === "opaque" ? Ue[Be] = E2 : Ue[Be] = ve[Be]);
          ve.plot3dPixelRatio && !Ue.plotGlPixelRatio && (Ue.plotGlPixelRatio = Ue.plot3dPixelRatio);
          var Ke = ve.editable;
          if (Ke !== void 0) for (Ue.editable = Ke, Ce = Object.keys(Ue.edits), Se = 0; Se < Ce.length; Se++) Ue.edits[Ce[Se]] = Ke;
          if (ve.edits) for (Ce = Object.keys(ve.edits), Se = 0; Se < Ce.length; Se++) (Be = Ce[Se]) in Ue.edits && (Ue.edits[Be] = ve.edits[Be]);
          Ue._exportedPlot = ve._exportedPlot;
        }
        Ue.staticPlot && (Ue.editable = false, Ue.edits = {}, Ue.autosizable = false, Ue.scrollZoom = false, Ue.doubleClick = false, Ue.showTips = false, Ue.showLink = false, Ue.displayModeBar = false), Ue.displayModeBar !== "hover" || o || (Ue.displayModeBar = true), Ue.setBackground !== "transparent" && typeof Ue.setBackground == "function" || (Ue.setBackground = C2), Ue._hasZeroHeight = Ue._hasZeroHeight || pe.clientHeight === 0, Ue._hasZeroWidth = Ue._hasZeroWidth || pe.clientWidth === 0;
        var ct = Ue.scrollZoom, We = Ue._scrollZoom = {};
        if (ct === true) We.cartesian = 1, We.gl3d = 1, We.geo = 1, We.mapbox = 1;
        else if (typeof ct == "string") {
          var Ze = ct.split("+");
          for (Se = 0; Se < Ze.length; Se++) We[Ze[Se]] = 1;
        } else ct !== false && (We.gl3d = 1, We.geo = 1, We.mapbox = 1);
      }
      function N2(pe, ve) {
        var Ee, Se, Ce = ve + 1, Be = [];
        for (Ee = 0; Ee < pe.length; Ee++) (Se = pe[Ee]) < 0 ? Be.push(Ce + Se) : Be.push(Se);
        return Be;
      }
      function D2(pe, ve, Ee) {
        var Se, Ce;
        for (Se = 0; Se < ve.length; Se++) {
          if ((Ce = ve[Se]) !== parseInt(Ce, 10)) throw new Error("all values in " + Ee + " must be integers");
          if (Ce >= pe.data.length || Ce < -pe.data.length) throw new Error(Ee + " must be valid indices for gd.data.");
          if (ve.indexOf(Ce, Se + 1) > -1 || Ce >= 0 && ve.indexOf(-pe.data.length + Ce) > -1 || Ce < 0 && ve.indexOf(pe.data.length + Ce) > -1) throw new Error("each index in " + Ee + " must be unique.");
        }
      }
      function I2(pe, ve, Ee) {
        if (!Array.isArray(pe.data)) throw new Error("gd.data must be an array.");
        if (ve === void 0) throw new Error("currentIndices is a required argument.");
        if (Array.isArray(ve) || (ve = [ve]), D2(pe, ve, "currentIndices"), Ee === void 0 || Array.isArray(Ee) || (Ee = [Ee]), Ee !== void 0 && D2(pe, Ee, "newIndices"), Ee !== void 0 && ve.length !== Ee.length) throw new Error("current and new indices must be of equal length.");
      }
      function O2(pe, ve, Ee, Se, Ce) {
        (function(ot, mt, wt, Et) {
          var zt = s.isPlainObject(Et);
          if (!Array.isArray(ot.data)) throw new Error("gd.data must be an array");
          if (!s.isPlainObject(mt)) throw new Error("update must be a key:value object");
          if (wt === void 0) throw new Error("indices must be an integer or array of integers");
          for (var Nt in D2(ot, wt, "indices"), mt) {
            if (!Array.isArray(mt[Nt]) || mt[Nt].length !== wt.length) throw new Error("attribute " + Nt + " must be an array of length equal to indices array length");
            if (zt && (!(Nt in Et) || !Array.isArray(Et[Nt]) || Et[Nt].length !== mt[Nt].length)) 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");
          }
        })(pe, ve, Ee, Se);
        for (var Be = function(ot, mt, wt, Et) {
          var zt, Nt, yt, pt, Ot, Jt = s.isPlainObject(Et), tr = [];
          for (var Ye in Array.isArray(wt) || (wt = [wt]), wt = N2(wt, ot.data.length - 1), mt) for (var at = 0; at < wt.length; at++) {
            if (zt = ot.data[wt[at]], Nt = (yt = i(zt, Ye)).get(), pt = mt[Ye][at], !s.isArrayOrTypedArray(pt)) throw new Error("attribute: " + Ye + " index: " + at + " must be an array");
            if (!s.isArrayOrTypedArray(Nt)) throw new Error("cannot extend missing or non-array attribute: " + Ye);
            if (Nt.constructor !== pt.constructor) throw new Error("cannot extend array with an array of a different type: " + Ye);
            Ot = Jt ? Et[Ye][at] : Et, a(Ot) || (Ot = -1), tr.push({ prop: yt, target: Nt, insert: pt, maxp: Math.floor(Ot) });
          }
          return tr;
        }(pe, ve, Ee, Se), Ue = {}, Ke = {}, ct = 0; ct < Be.length; ct++) {
          var We = Be[ct].prop, Ze = Be[ct].maxp, it = Ce(Be[ct].target, Be[ct].insert, Ze);
          We.set(it[0]), Array.isArray(Ue[We.astr]) || (Ue[We.astr] = []), Ue[We.astr].push(it[1]), Array.isArray(Ke[We.astr]) || (Ke[We.astr] = []), Ke[We.astr].push(Be[ct].target.length);
        }
        return { update: Ue, maxPoints: Ke };
      }
      function L2(pe, ve) {
        var Ee = new pe.constructor(pe.length + ve.length);
        return Ee.set(pe), Ee.set(ve, pe.length), Ee;
      }
      function V2(pe, ve, Ee, Se) {
        pe = s.getGraphDiv(pe), w.clearPromiseQueue(pe);
        var Ce = {};
        if (typeof ve == "string") Ce[ve] = Ee;
        else {
          if (!s.isPlainObject(ve)) return s.warn("Restyle fail.", ve, Ee, Se), Promise.reject();
          Ce = s.extendFlat({}, ve), Se === void 0 && (Se = Ee);
        }
        Object.keys(Ce).length && (pe.changed = true);
        var Be = w.coerceTraceIndices(pe, Se), Ue = K2(pe, Ce, Be), Ke = Ue.flags;
        Ke.calc && (pe.calcdata = void 0), Ke.clearAxisTypes && w.clearAxisTypes(pe, Be, {});
        var ct = [];
        Ke.fullReplot ? ct.push(r._doPlot) : (ct.push(h.previousPromises), h.supplyDefaults(pe), Ke.markerSize && (h.doCalcdata(pe), z(ct)), Ke.style && ct.push(_4.doTraceStyle), Ke.colorbars && ct.push(_4.doColorBars), ct.push(S2)), ct.push(h.rehover, h.redrag), u2.add(pe, V2, [pe, Ue.undoit, Ue.traces], V2, [pe, Ue.redoit, Ue.traces]);
        var We = s.syncOrAsync(ct, pe);
        return We && We.then || (We = Promise.resolve()), We.then(function() {
          return pe.emit("plotly_restyle", Ue.eventData), pe;
        });
      }
      function W2(pe) {
        return pe === void 0 ? null : pe;
      }
      function X2(pe, ve) {
        return ve ? function(Ee, Se, Ce) {
          var Be = i(Ee, Se), Ue = Be.set;
          return Be.set = function(Ke) {
            Y2((Ce || "") + Se, Be.get(), Ke, pe), Ue(Ke);
          }, Be;
        } : i;
      }
      function Y2(pe, ve, Ee, Se) {
        if (Array.isArray(ve) || Array.isArray(Ee)) for (var Ce = Array.isArray(ve) ? ve : [], Be = Array.isArray(Ee) ? Ee : [], Ue = Math.max(Ce.length, Be.length), Ke = 0; Ke < Ue; Ke++) Y2(pe + "[" + Ke + "]", Ce[Ke], Be[Ke], Se);
        else if (s.isPlainObject(ve) || s.isPlainObject(Ee)) {
          var ct = s.isPlainObject(ve) ? ve : {}, We = s.isPlainObject(Ee) ? Ee : {}, Ze = s.extendFlat({}, ct, We);
          for (var it in Ze) Y2(pe + "." + it, ct[it], We[it], Se);
        } else Se[pe] === void 0 && (Se[pe] = W2(ve));
      }
      function K2(pe, ve, Ee) {
        var Se, Ce = pe._fullLayout, Be = pe._fullData, Ue = pe.data, Ke = Ce._guiEditing, ct = X2(Ce._preGUI, Ke), We = s.extendDeepAll({}, ve);
        q(ve);
        var Ze, it = k.traceFlags(), ot = {}, mt = {};
        function wt() {
          return Ee.map(function() {
          });
        }
        function Et(tt) {
          var vt = p.id2name(tt);
          Ze.indexOf(vt) === -1 && Ze.push(vt);
        }
        function zt(tt) {
          return "LAYOUT" + tt + ".autorange";
        }
        function Nt(tt) {
          return "LAYOUT" + tt + ".range";
        }
        function yt(tt) {
          for (var vt = tt; vt < Be.length; vt++) if (Be[vt]._input === Ue[tt]) return Be[vt];
        }
        function pt(tt, vt, kt) {
          if (Array.isArray(tt)) tt.forEach(function(Kt) {
            pt(Kt, vt, kt);
          });
          else if (!(tt in ve) && !w.hasParent(ve, tt)) {
            var jt;
            if (tt.substr(0, 6) === "LAYOUT") jt = ct(pe.layout, tt.replace("LAYOUT", ""));
            else {
              var Vt = Ee[kt];
              jt = X2(Ce._tracePreGUI[yt(Vt)._fullInput.uid], Ke)(Ue[Vt], tt);
            }
            tt in mt || (mt[tt] = wt()), mt[tt][kt] === void 0 && (mt[tt][kt] = W2(jt.get())), vt !== void 0 && jt.set(vt);
          }
        }
        function Ot(tt) {
          return function(vt) {
            return Be[vt][tt];
          };
        }
        function Jt(tt) {
          return function(vt, kt) {
            return vt === false ? Be[Ee[kt]][tt] : null;
          };
        }
        for (var tr in ve) {
          if (w.hasParent(ve, tr)) throw new Error("cannot set " + tr + " and a parent attribute simultaneously");
          var Ye, at, Ge, st, Ie, Pe, $e = ve[tr];
          if (tr !== "autobinx" && tr !== "autobiny" || (tr = tr.charAt(tr.length - 1) + "bins", $e = Array.isArray($e) ? $e.map(Jt(tr)) : $e === false ? Ee.map(Ot(tr)) : null), ot[tr] = $e, tr.substr(0, 6) !== "LAYOUT") {
            for (mt[tr] = wt(), Se = 0; Se < Ee.length; Se++) if (Ye = Ue[Ee[Se]], at = yt(Ee[Se]), st = (Ge = X2(Ce._tracePreGUI[at._fullInput.uid], Ke)(Ye, tr)).get(), (Ie = Array.isArray($e) ? $e[Se % $e.length] : $e) !== void 0) {
              var Ve = Ge.parts[Ge.parts.length - 1], ut = tr.substr(0, tr.length - Ve.length - 1), Re = ut ? ut + "." : "", qe = ut ? i(at, ut).get() : at;
              if ((Pe = f.getTraceValObject(at, Ge.parts)) && Pe.impliedEdits && Ie !== null) for (var je in Pe.impliedEdits) pt(s.relativeAttr(tr, je), Pe.impliedEdits[je], Se);
              else if (Ve !== "thicknessmode" && Ve !== "lenmode" || st === Ie || Ie !== "fraction" && Ie !== "pixels" || !qe) {
                if (tr === "type" && (Ie === "pie" != (st === "pie") || Ie === "funnelarea" != (st === "funnelarea"))) {
                  var rt = "x", He = "y";
                  Ie !== "bar" && st !== "bar" || Ye.orientation !== "h" || (rt = "y", He = "x"), s.swapAttrs(Ye, ["?", "?src"], "labels", rt), s.swapAttrs(Ye, ["d?", "?0"], "label", rt), s.swapAttrs(Ye, ["?", "?src"], "values", He), st === "pie" || st === "funnelarea" ? (i(Ye, "marker.color").set(i(Ye, "marker.colors").get()), Ce._pielayer.selectAll("g.trace").remove()) : c.traceIs(Ye, "cartesian") && i(Ye, "marker.colors").set(i(Ye, "marker.color").get());
                }
              } else {
                var xe = Ce._size, Ne = qe.orient, ke = Ne === "top" || Ne === "bottom";
                if (Ve === "thicknessmode") {
                  var Me = ke ? xe.h : xe.w;
                  pt(Re + "thickness", qe.thickness * (Ie === "fraction" ? 1 / Me : Me), Se);
                } else {
                  var Le = ke ? xe.w : xe.h;
                  pt(Re + "len", qe.len * (Ie === "fraction" ? 1 / Le : Le), Se);
                }
              }
              if (mt[tr][Se] = W2(st), ["swapxy", "swapxyaxes", "orientation", "orientationaxes"].indexOf(tr) !== -1) {
                if (tr === "orientation") {
                  Ge.set(Ie);
                  var ze = Ye.x && !Ye.y ? "h" : "v";
                  if ((Ge.get() || ze) === at.orientation) continue;
                } else tr === "orientationaxes" && (Ye.orientation = { v: "h", h: "v" }[at.orientation]);
                w.swapXYData(Ye), it.calc = it.clearAxisTypes = true;
              } else h.dataArrayContainers.indexOf(Ge.parts[0]) !== -1 ? (w.manageArrayContainers(Ge, Ie, mt), it.calc = true) : (Pe ? Pe.arrayOk && !c.traceIs(at, "regl") && (s.isArrayOrTypedArray(Ie) || s.isArrayOrTypedArray(st)) ? it.calc = true : k.update(it, Pe) : it.calc = true, Ge.set(Ie));
            }
            if (["swapxyaxes", "orientationaxes"].indexOf(tr) !== -1 && p.swap(pe, Ee), tr === "orientationaxes") {
              var ft = i(pe.layout, "hovermode"), De = ft.get();
              De === "x" ? ft.set("y") : De === "y" ? ft.set("x") : De === "x unified" ? ft.set("y unified") : De === "y unified" && ft.set("x unified");
            }
            if (["orientation", "type"].indexOf(tr) !== -1) {
              for (Ze = [], Se = 0; Se < Ee.length; Se++) {
                var Je = Ue[Ee[Se]];
                c.traceIs(Je, "cartesian") && (Et(Je.xaxis || "x"), Et(Je.yaxis || "y"));
              }
              pt(Ze.map(zt), true, 0), pt(Ze.map(Nt), [0, 1], 0);
            }
          } else Ge = ct(pe.layout, tr.replace("LAYOUT", "")), mt[tr] = [W2(Ge.get())], Ge.set(Array.isArray($e) ? $e[0] : $e), it.calc = true;
        }
        return (it.calc || it.plot) && (it.fullReplot = true), { flags: it, undoit: mt, redoit: ot, traces: Ee, eventData: s.extendDeepNoArrays([], [We, Ee]) };
      }
      function q(pe) {
        var ve, Ee, Se, Ce = s.counterRegex("axis", ".title", false, false), Be = /colorbar\.title$/, Ue = Object.keys(pe);
        for (ve = 0; ve < Ue.length; ve++) Ee = Ue[ve], Se = pe[Ee], Ee !== "title" && !Ce.test(Ee) && !Be.test(Ee) || typeof Se != "string" && typeof Se != "number" ? Ee.indexOf("titlefont") > -1 && Ee.indexOf("grouptitlefont") === -1 ? Ke(Ee, Ee.replace("titlefont", "title.font")) : Ee.indexOf("titleposition") > -1 ? Ke(Ee, Ee.replace("titleposition", "title.position")) : Ee.indexOf("titleside") > -1 ? Ke(Ee, Ee.replace("titleside", "title.side")) : Ee.indexOf("titleoffset") > -1 && Ke(Ee, Ee.replace("titleoffset", "title.offset")) : Ke(Ee, Ee.replace("title", "title.text"));
        function Ke(ct, We) {
          pe[We] = pe[ct], delete pe[ct];
        }
      }
      function re(pe, ve, Ee) {
        pe = s.getGraphDiv(pe), w.clearPromiseQueue(pe);
        var Se = {};
        if (typeof ve == "string") Se[ve] = Ee;
        else {
          if (!s.isPlainObject(ve)) return s.warn("Relayout fail.", ve, Ee), Promise.reject();
          Se = s.extendFlat({}, ve);
        }
        Object.keys(Se).length && (pe.changed = true);
        var Ce = Q2(pe, Se), Be = Ce.flags;
        Be.calc && (pe.calcdata = void 0);
        var Ue = [h.previousPromises];
        Be.layoutReplot ? Ue.push(_4.layoutReplot) : Object.keys(Se).length && (R2(pe, Be, Ce) || h.supplyDefaults(pe), Be.legend && Ue.push(_4.doLegend), Be.layoutstyle && Ue.push(_4.layoutStyles), Be.axrange && z(Ue, Ce.rangesAltered), Be.ticks && Ue.push(_4.doTicksRelayout), Be.modebar && Ue.push(_4.doModeBar), Be.camera && Ue.push(_4.doCamera), Be.colorbars && Ue.push(_4.doColorBars), Ue.push(S2)), Ue.push(h.rehover, h.redrag), u2.add(pe, re, [pe, Ce.undoit], re, [pe, Ce.redoit]);
        var Ke = s.syncOrAsync(Ue, pe);
        return Ke && Ke.then || (Ke = Promise.resolve(pe)), Ke.then(function() {
          return pe.emit("plotly_relayout", Ce.eventData), pe;
        });
      }
      function R2(pe, ve, Ee) {
        var Se = pe._fullLayout;
        if (!ve.axrange) return false;
        for (var Ce in ve) if (Ce !== "axrange" && ve[Ce]) return false;
        for (var Be in Ee.rangesAltered) {
          var Ue = p.id2name(Be), Ke = pe.layout[Ue], ct = Se[Ue];
          if (ct.autorange = Ke.autorange, Ke.range && (ct.range = Ke.range.slice()), ct.cleanRange(), ct._matchGroup) {
            for (var We in ct._matchGroup) if (We !== Be) {
              var Ze = Se[p.id2name(We)];
              Ze.autorange = ct.autorange, Ze.range = ct.range.slice(), Ze._input.range = ct.range.slice();
            }
          }
        }
        return true;
      }
      function z(pe, ve) {
        var Ee = ve ? function(Se) {
          var Ce = [], Be = true;
          for (var Ue in ve) {
            var Ke = p.getFromId(Se, Ue);
            if (Ce.push(Ue), (Ke.ticklabelposition || "").indexOf("inside") !== -1 && Ke._anchorAxis && Ce.push(Ke._anchorAxis._id), Ke._matchGroup) for (var ct in Ke._matchGroup) ve[ct] || Ce.push(ct);
            Ke.automargin && (Be = false);
          }
          return p.draw(Se, Ce, { skipTitle: Be });
        } : function(Se) {
          return p.draw(Se, "redraw");
        };
        pe.push(x, _4.doAutoRangeAndConstraints, Ee, _4.drawData, _4.finalDraw);
      }
      var H2 = /^[xyz]axis[0-9]*\.range(\[[0|1]\])?$/, te = /^[xyz]axis[0-9]*\.autorange$/, j = /^[xyz]axis[0-9]*\.domain(\[[0|1]\])?$/;
      function Q2(pe, ve) {
        var Ee, Se, Ce, Be = pe.layout, Ue = pe._fullLayout, Ke = Ue._guiEditing, ct = X2(Ue._preGUI, Ke), We = Object.keys(ve), Ze = p.list(pe), it = s.extendDeepAll({}, ve), ot = {};
        for (q(ve), We = Object.keys(ve), Se = 0; Se < We.length; Se++) if (We[Se].indexOf("allaxes") === 0) {
          for (Ce = 0; Ce < Ze.length; Ce++) {
            var mt = Ze[Ce]._id.substr(1), wt = mt.indexOf("scene") !== -1 ? mt + "." : "", Et = We[Se].replace("allaxes", wt + Ze[Ce]._name);
            ve[Et] || (ve[Et] = ve[We[Se]]);
          }
          delete ve[We[Se]];
        }
        var zt = k.layoutFlags(), Nt = {}, yt = {};
        function pt(Vt, Kt) {
          if (Array.isArray(Vt)) Vt.forEach(function(Tr) {
            pt(Tr, Kt);
          });
          else if (!(Vt in ve) && !w.hasParent(ve, Vt)) {
            var rr = ct(Be, Vt);
            Vt in yt || (yt[Vt] = W2(rr.get())), Kt !== void 0 && rr.set(Kt);
          }
        }
        var Ot, Jt = {};
        function tr(Vt) {
          var Kt = p.name2id(Vt.split(".")[0]);
          return Jt[Kt] = 1, Kt;
        }
        for (var Ye in ve) {
          if (w.hasParent(ve, Ye)) throw new Error("cannot set " + Ye + " and a parent attribute simultaneously");
          for (var at = ct(Be, Ye), Ge = ve[Ye], st = at.parts.length - 1; st > 0 && typeof at.parts[st] != "string"; ) st--;
          var Ie = at.parts[st], Pe = at.parts[st - 1] + "." + Ie, $e = at.parts.slice(0, st).join("."), Ve = i(pe.layout, $e).get(), ut = i(Ue, $e).get(), Re = at.get();
          if (Ge !== void 0) {
            Nt[Ye] = Ge, yt[Ye] = Ie === "reverse" ? Ge : W2(Re);
            var qe = f.getLayoutValObject(Ue, at.parts);
            if (qe && qe.impliedEdits && Ge !== null) for (var je in qe.impliedEdits) pt(s.relativeAttr(Ye, je), qe.impliedEdits[je]);
            if (["width", "height"].indexOf(Ye) !== -1) if (Ge) {
              pt("autosize", null);
              var rt = Ye === "height" ? "width" : "height";
              pt(rt, Ue[rt]);
            } else Ue[Ye] = pe._initialAutoSize[Ye];
            else if (Ye === "autosize") pt("width", Ge ? null : Ue.width), pt("height", Ge ? null : Ue.height);
            else if (Pe.match(H2)) tr(Pe), i(Ue, $e + "._inputRange").set(null);
            else if (Pe.match(te)) {
              tr(Pe), i(Ue, $e + "._inputRange").set(null);
              var He = i(Ue, $e).get();
              He._inputDomain && (He._input.domain = He._inputDomain.slice());
            } else Pe.match(j) && i(Ue, $e + "._inputDomain").set(null);
            if (Ie === "type") {
              Ot = Ve;
              var xe = ut.type === "linear" && Ge === "log", Ne = ut.type === "log" && Ge === "linear";
              if (xe || Ne) {
                if (Ot && Ot.range) if (ut.autorange) xe && (Ot.range = Ot.range[1] > Ot.range[0] ? [1, 2] : [2, 1]);
                else {
                  var ke = Ot.range[0], Me = Ot.range[1];
                  xe ? (ke <= 0 && Me <= 0 && pt($e + ".autorange", true), ke <= 0 ? ke = Me / 1e6 : Me <= 0 && (Me = ke / 1e6), pt($e + ".range[0]", Math.log(ke) / Math.LN10), pt($e + ".range[1]", Math.log(Me) / Math.LN10)) : (pt($e + ".range[0]", Math.pow(10, ke)), pt($e + ".range[1]", Math.pow(10, Me)));
                }
                else pt($e + ".autorange", true);
                Array.isArray(Ue._subplots.polar) && Ue._subplots.polar.length && Ue[at.parts[0]] && at.parts[1] === "radialaxis" && delete Ue[at.parts[0]]._subplot.viewInitial["radialaxis.range"], c.getComponentMethod("annotations", "convertCoords")(pe, ut, Ge, pt), c.getComponentMethod("images", "convertCoords")(pe, ut, Ge, pt);
              } else pt($e + ".autorange", true), pt($e + ".range", null);
              i(Ue, $e + "._inputRange").set(null);
            } else if (Ie.match(T2)) {
              var Le = i(Ue, Ye).get(), ze = (Ge || {}).type;
              ze && ze !== "-" || (ze = "linear"), c.getComponentMethod("annotations", "convertCoords")(pe, Le, ze, pt), c.getComponentMethod("images", "convertCoords")(pe, Le, ze, pt);
            }
            var ft = y.containerArrayMatch(Ye);
            if (ft) {
              Ee = ft.array, Se = ft.index;
              var De = ft.property, Je = qe || { editType: "calc" };
              Se !== "" && De === "" && (y.isAddVal(Ge) ? yt[Ye] = null : y.isRemoveVal(Ge) ? yt[Ye] = (i(Be, Ee).get() || [])[Se] : s.warn("unrecognized full object value", ve)), k.update(zt, Je), ot[Ee] || (ot[Ee] = {});
              var tt = ot[Ee][Se];
              tt || (tt = ot[Ee][Se] = {}), tt[De] = Ge, delete ve[Ye];
            } else Ie === "reverse" ? (Ve.range ? Ve.range.reverse() : (pt($e + ".autorange", true), Ve.range = [1, 0]), ut.autorange ? zt.calc = true : zt.plot = true) : (Ue._has("scatter-like") && Ue._has("regl") && Ye === "dragmode" && (Ge === "lasso" || Ge === "select") && Re !== "lasso" && Re !== "select" || Ue._has("gl2d") ? zt.plot = true : qe ? k.update(zt, qe) : zt.calc = true, at.set(Ge));
          }
        }
        for (Ee in ot) y.applyContainerArrayChanges(pe, ct(Be, Ee), ot[Ee], zt, ct) || (zt.plot = true);
        for (var vt in Jt) {
          var kt = (Ot = p.getFromId(pe, vt)) && Ot._constraintGroup;
          if (kt) for (var jt in zt.calc = true, kt) Jt[jt] || (p.getFromId(pe, jt)._constraintShrinkable = true);
        }
        return (Z2(pe) || ve.height || ve.width) && (zt.plot = true), (zt.plot || zt.calc) && (zt.layoutReplot = true), { flags: zt, rangesAltered: Jt, undoit: yt, redoit: Nt, eventData: it };
      }
      function Z2(pe) {
        var ve = pe._fullLayout, Ee = ve.width, Se = ve.height;
        return pe.layout.autosize && h.plotAutoSize(pe, pe.layout, ve), ve.width !== Ee || ve.height !== Se;
      }
      function ne(pe, ve, Ee, Se) {
        pe = s.getGraphDiv(pe), w.clearPromiseQueue(pe), s.isPlainObject(ve) || (ve = {}), s.isPlainObject(Ee) || (Ee = {}), Object.keys(ve).length && (pe.changed = true), Object.keys(Ee).length && (pe.changed = true);
        var Ce = w.coerceTraceIndices(pe, Se), Be = K2(pe, s.extendFlat({}, ve), Ce), Ue = Be.flags, Ke = Q2(pe, s.extendFlat({}, Ee)), ct = Ke.flags;
        (Ue.calc || ct.calc) && (pe.calcdata = void 0), Ue.clearAxisTypes && w.clearAxisTypes(pe, Ce, Ee);
        var We = [];
        ct.layoutReplot ? We.push(_4.layoutReplot) : Ue.fullReplot ? We.push(r._doPlot) : (We.push(h.previousPromises), R2(pe, ct, Ke) || h.supplyDefaults(pe), Ue.style && We.push(_4.doTraceStyle), (Ue.colorbars || ct.colorbars) && We.push(_4.doColorBars), ct.legend && We.push(_4.doLegend), ct.layoutstyle && We.push(_4.layoutStyles), ct.axrange && z(We, Ke.rangesAltered), ct.ticks && We.push(_4.doTicksRelayout), ct.modebar && We.push(_4.doModeBar), ct.camera && We.push(_4.doCamera), We.push(S2)), We.push(h.rehover, h.redrag), u2.add(pe, ne, [pe, Be.undoit, Ke.undoit, Be.traces], ne, [pe, Be.redoit, Ke.redoit, Be.traces]);
        var Ze = s.syncOrAsync(We, pe);
        return Ze && Ze.then || (Ze = Promise.resolve(pe)), Ze.then(function() {
          return pe.emit("plotly_update", { data: Be.eventData, layout: Ke.eventData }), pe;
        });
      }
      function ae(pe) {
        return function(ve) {
          ve._fullLayout._guiEditing = true;
          var Ee = pe.apply(null, arguments);
          return ve._fullLayout._guiEditing = false, Ee;
        };
      }
      var ue = [{ pattern: /^hiddenlabels/, attr: "legend.uirevision" }, { pattern: /^((x|y)axis\d*)\.((auto)?range|title\.text)/ }, { pattern: /axis\d*\.showspikes$/, attr: "modebar.uirevision" }, { pattern: /(hover|drag)mode$/, attr: "modebar.uirevision" }, { pattern: /^(scene\d*)\.camera/ }, { pattern: /^(geo\d*)\.(projection|center|fitbounds)/ }, { pattern: /^(ternary\d*\.[abc]axis)\.(min|title\.text)$/ }, { pattern: /^(polar\d*\.radialaxis)\.((auto)?range|angle|title\.text)/ }, { pattern: /^(polar\d*\.angularaxis)\.rotation/ }, { pattern: /^(mapbox\d*)\.(center|zoom|bearing|pitch)/ }, { pattern: /^legend\.(x|y)$/, attr: "editrevision" }, { pattern: /^(shapes|annotations)/, attr: "editrevision" }, { pattern: /^title\.text$/, attr: "editrevision" }], le = [{ pattern: /^selectedpoints$/, attr: "selectionrevision" }, { pattern: /(^|value\.)visible$/, attr: "legend.uirevision" }, { pattern: /^dimensions\[\d+\]\.constraintrange/ }, { pattern: /^node\.(x|y|groups)/ }, { pattern: /^level$/ }, { pattern: /(^|value\.)name$/ }, { pattern: /colorbar\.title\.text$/ }, { pattern: /colorbar\.(x|y)$/, attr: "editrevision" }];
      function ce(pe, ve) {
        for (var Ee = 0; Ee < ve.length; Ee++) {
          var Se = ve[Ee], Ce = pe.match(Se.pattern);
          if (Ce) {
            var Be = Ce[1] || "";
            return { head: Be, tail: pe.substr(Be.length + 1), attr: Se.attr };
          }
        }
      }
      function se(pe, ve) {
        var Ee = i(ve, pe).get();
        if (Ee !== void 0) return Ee;
        var Se = pe.split(".");
        for (Se.pop(); Se.length > 1; ) if (Se.pop(), (Ee = i(ve, Se.join(".") + ".uirevision").get()) !== void 0) return Ee;
        return ve.uirevision;
      }
      function he(pe, ve) {
        for (var Ee = 0; Ee < ve.length; Ee++) if (ve[Ee]._fullInput.uid === pe) return Ee;
        return -1;
      }
      function me(pe, ve, Ee) {
        for (var Se = 0; Se < ve.length; Se++) if (ve[Se].uid === pe) return Se;
        return !ve[Ee] || ve[Ee].uid ? -1 : Ee;
      }
      function we(pe, ve) {
        var Ee = s.isPlainObject(pe), Se = Array.isArray(pe);
        return Ee || Se ? (Ee && s.isPlainObject(ve) || Se && Array.isArray(ve)) && JSON.stringify(pe) === JSON.stringify(ve) : pe === ve;
      }
      function be(pe, ve, Ee, Se) {
        var Ce, Be, Ue, Ke = Se.getValObject, ct = Se.flags, We = Se.immutable, Ze = Se.inArray, it = Se.arrayIndex;
        function ot() {
          var Ve = Ce.editType;
          Ze && Ve.indexOf("arraydraw") !== -1 ? s.pushUnique(ct.arrays[Ze], it) : (k.update(ct, Ce), Ve !== "none" && ct.nChanges++, Se.transition && Ce.anim && ct.nChangesAnim++, (H2.test(Ue) || te.test(Ue)) && (ct.rangesAltered[Ee[0]] = 1), j.test(Ue) && i(ve, "_inputDomain").set(null), Be === "datarevision" && (ct.newDataRevision = 1));
        }
        function mt(Ve) {
          return Ve.valType === "data_array" || Ve.arrayOk;
        }
        for (Be in pe) {
          if (ct.calc && !Se.transition) return;
          var wt = pe[Be], Et = ve[Be], zt = Ee.concat(Be);
          if (Ue = zt.join("."), Be.charAt(0) !== "_" && typeof wt != "function" && wt !== Et) {
            if ((Be === "tick0" || Be === "dtick") && Ee[0] !== "geo") {
              var Nt = ve.tickmode;
              if (Nt === "auto" || Nt === "array" || !Nt) continue;
            }
            if ((Be !== "range" || !ve.autorange) && (Be !== "zmin" && Be !== "zmax" || ve.type !== "contourcarpet") && (Ce = Ke(zt)) && (!Ce._compareAsJSON || JSON.stringify(wt) !== JSON.stringify(Et))) {
              var yt, pt = Ce.valType, Ot = mt(Ce), Jt = Array.isArray(wt), tr = Array.isArray(Et);
              if (Jt && tr) {
                var Ye = "_input_" + Be, at = pe[Ye], Ge = ve[Ye];
                if (Array.isArray(at) && at === Ge) continue;
              }
              if (Et === void 0) Ot && Jt ? ct.calc = true : ot();
              else if (Ce._isLinkedToArray) {
                var st = [], Ie = false;
                Ze || (ct.arrays[Be] = st);
                var Pe = Math.min(wt.length, Et.length), $e = Math.max(wt.length, Et.length);
                if (Pe !== $e) {
                  if (Ce.editType !== "arraydraw") {
                    ot();
                    continue;
                  }
                  Ie = true;
                }
                for (yt = 0; yt < Pe; yt++) be(wt[yt], Et[yt], zt.concat(yt), s.extendFlat({ inArray: Be, arrayIndex: yt }, Se));
                if (Ie) for (yt = Pe; yt < $e; yt++) st.push(yt);
              } else !pt && s.isPlainObject(wt) ? be(wt, Et, zt, Se) : Ot ? Jt && tr ? (We && (ct.calc = true), (We || Se.newDataRevision) && ot()) : Jt !== tr ? ct.calc = true : ot() : Jt && tr && wt.length === Et.length && String(wt) === String(Et) || ot();
            }
          }
        }
        for (Be in ve) if (!(Be in pe) && Be.charAt(0) !== "_" && typeof ve[Be] != "function") {
          if (mt(Ce = Ke(Ee.concat(Be))) && Array.isArray(ve[Be])) return void (ct.calc = true);
          ot();
        }
      }
      function Ae(pe) {
        var ve = pe._fullLayout, Ee = pe.getBoundingClientRect();
        if (!s.equalDomRects(Ee, ve._lastBBox)) {
          var Se = ve._invTransform = s.inverseTransformMatrix(s.getFullTransformMatrix(pe));
          ve._invScaleX = Math.sqrt(Se[0][0] * Se[0][0] + Se[0][1] * Se[0][1] + Se[0][2] * Se[0][2]), ve._invScaleY = Math.sqrt(Se[1][0] * Se[1][0] + Se[1][1] * Se[1][1] + Se[1][2] * Se[1][2]), ve._lastBBox = Ee;
        }
      }
      r.animate = function(pe, ve, Ee) {
        if (pe = s.getGraphDiv(pe), !s.isPlotDiv(pe)) throw new Error("This element is not a Plotly plot: " + pe + ". It's likely that you've failed to create a plot before animating it. For more details, see https://plotly.com/javascript/animations/");
        var Se = pe._transitionData;
        Se._frameQueue || (Se._frameQueue = []);
        var Ce = (Ee = h.supplyAnimationDefaults(Ee)).transition, Be = Ee.frame;
        function Ue(We) {
          return Array.isArray(Ce) ? We >= Ce.length ? Ce[0] : Ce[We] : Ce;
        }
        function Ke(We) {
          return Array.isArray(Be) ? We >= Be.length ? Be[0] : Be[We] : Be;
        }
        function ct(We, Ze) {
          var it = 0;
          return function() {
            if (We && ++it === Ze) return We();
          };
        }
        return Se._frameWaitingCnt === void 0 && (Se._frameWaitingCnt = 0), new Promise(function(We, Ze) {
          function it() {
            Se._currentFrame && Se._currentFrame.onComplete && Se._currentFrame.onComplete();
            var at = Se._currentFrame = Se._frameQueue.shift();
            if (at) {
              var Ge = at.name ? at.name.toString() : null;
              pe._fullLayout._currentFrame = Ge, Se._lastFrameAt = Date.now(), Se._timeToNext = at.frameOpts.duration, h.transition(pe, at.frame.data, at.frame.layout, w.coerceTraceIndices(pe, at.frame.traces), at.frameOpts, at.transitionOpts).then(function() {
                at.onComplete && at.onComplete();
              }), pe.emit("plotly_animatingframe", { name: Ge, frame: at.frame, animation: { frame: at.frameOpts, transition: at.transitionOpts } });
            } else pe.emit("plotly_animated"), window.cancelAnimationFrame(Se._animationRaf), Se._animationRaf = null;
          }
          function ot() {
            pe.emit("plotly_animating"), Se._lastFrameAt = -1 / 0, Se._timeToNext = 0, Se._runningTransitions = 0, Se._currentFrame = null;
            var at = function() {
              Se._animationRaf = window.requestAnimationFrame(at), Date.now() - Se._lastFrameAt > Se._timeToNext && it();
            };
            at();
          }
          var mt, wt, Et = 0;
          function zt(at) {
            return Array.isArray(Ce) ? Et >= Ce.length ? at.transitionOpts = Ce[Et] : at.transitionOpts = Ce[0] : at.transitionOpts = Ce, Et++, at;
          }
          var Nt = [], yt = ve == null, pt = Array.isArray(ve);
          if (!yt && !pt && s.isPlainObject(ve)) Nt.push({ type: "object", data: zt(s.extendFlat({}, ve)) });
          else if (yt || ["string", "number"].indexOf(typeof ve) !== -1) for (mt = 0; mt < Se._frames.length; mt++) (wt = Se._frames[mt]) && (yt || String(wt.group) === String(ve)) && Nt.push({ type: "byname", name: String(wt.name), data: zt({ name: wt.name }) });
          else if (pt) for (mt = 0; mt < ve.length; mt++) {
            var Ot = ve[mt];
            ["number", "string"].indexOf(typeof Ot) !== -1 ? (Ot = String(Ot), Nt.push({ type: "byname", name: Ot, data: zt({ name: Ot }) })) : s.isPlainObject(Ot) && Nt.push({ type: "object", data: zt(s.extendFlat({}, Ot)) });
          }
          for (mt = 0; mt < Nt.length; mt++) if ((wt = Nt[mt]).type === "byname" && !Se._frameHash[wt.data.name]) return s.warn('animate failure: frame not found: "' + wt.data.name + '"'), void Ze();
          ["next", "immediate"].indexOf(Ee.mode) !== -1 && function() {
            if (Se._frameQueue.length !== 0) {
              for (; Se._frameQueue.length; ) {
                var at = Se._frameQueue.pop();
                at.onInterrupt && at.onInterrupt();
              }
              pe.emit("plotly_animationinterrupted", []);
            }
          }(), Ee.direction === "reverse" && Nt.reverse();
          var Jt = pe._fullLayout._currentFrame;
          if (Jt && Ee.fromcurrent) {
            var tr = -1;
            for (mt = 0; mt < Nt.length; mt++) if ((wt = Nt[mt]).type === "byname" && wt.name === Jt) {
              tr = mt;
              break;
            }
            if (tr > 0 && tr < Nt.length - 1) {
              var Ye = [];
              for (mt = 0; mt < Nt.length; mt++) wt = Nt[mt], (Nt[mt].type !== "byname" || mt > tr) && Ye.push(wt);
              Nt = Ye;
            }
          }
          Nt.length > 0 ? function(at) {
            if (at.length !== 0) {
              for (var Ge = 0; Ge < at.length; Ge++) {
                var st;
                st = at[Ge].type === "byname" ? h.computeFrame(pe, at[Ge].name) : at[Ge].data;
                var Ie = Ke(Ge), Pe = Ue(Ge);
                Pe.duration = Math.min(Pe.duration, Ie.duration);
                var $e = { frame: st, name: at[Ge].name, frameOpts: Ie, transitionOpts: Pe };
                Ge === at.length - 1 && ($e.onComplete = ct(We, 2), $e.onInterrupt = Ze), Se._frameQueue.push($e);
              }
              Ee.mode === "immediate" && (Se._lastFrameAt = -1 / 0), Se._animationRaf || ot();
            }
          }(Nt) : (pe.emit("plotly_animated"), We());
        });
      }, r.addFrames = function(pe, ve, Ee) {
        if (pe = s.getGraphDiv(pe), ve == null) return Promise.resolve();
        if (!s.isPlotDiv(pe)) throw new Error("This element is not a Plotly plot: " + pe + ". It's likely that you've failed to create a plot before adding frames. For more details, see https://plotly.com/javascript/animations/");
        var Se, Ce, Be, Ue, Ke = pe._transitionData._frames, ct = pe._transitionData._frameHash;
        if (!Array.isArray(ve)) throw new Error("addFrames failure: frameList must be an Array of frame definitions" + ve);
        var We = Ke.length + 2 * ve.length, Ze = [], it = {};
        for (Se = ve.length - 1; Se >= 0; Se--) if (s.isPlainObject(ve[Se])) {
          var ot = ve[Se].name, mt = (ct[ot] || it[ot] || {}).name, wt = ve[Se].name, Et = ct[mt] || it[mt];
          mt && wt && typeof wt == "number" && Et && A2 < 5 && (A2++, s.warn('addFrames: overwriting frame "' + (ct[mt] || it[mt]).name + '" with a frame whose name of type "number" also equates to "' + mt + '". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'), A2 === 5 && s.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.")), it[ot] = { name: ot }, Ze.push({ frame: h.supplyFrameDefaults(ve[Se]), index: Ee && Ee[Se] !== void 0 && Ee[Se] !== null ? Ee[Se] : We + Se });
        }
        Ze.sort(function(Ye, at) {
          return Ye.index > at.index ? -1 : Ye.index < at.index ? 1 : 0;
        });
        var zt = [], Nt = [], yt = Ke.length;
        for (Se = Ze.length - 1; Se >= 0; Se--) {
          if (typeof (Ce = Ze[Se].frame).name == "number" && s.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"), !Ce.name) for (; ct[Ce.name = "frame " + pe._transitionData._counter++]; ) ;
          if (ct[Ce.name]) {
            for (Be = 0; Be < Ke.length && (Ke[Be] || {}).name !== Ce.name; Be++) ;
            zt.push({ type: "replace", index: Be, value: Ce }), Nt.unshift({ type: "replace", index: Be, value: Ke[Be] });
          } else Ue = Math.max(0, Math.min(Ze[Se].index, yt)), zt.push({ type: "insert", index: Ue, value: Ce }), Nt.unshift({ type: "delete", index: Ue }), yt++;
        }
        var pt = h.modifyFrames, Ot = h.modifyFrames, Jt = [pe, Nt], tr = [pe, zt];
        return u2 && u2.add(pe, pt, Jt, Ot, tr), h.modifyFrames(pe, zt);
      }, r.deleteFrames = function(pe, ve) {
        if (pe = s.getGraphDiv(pe), !s.isPlotDiv(pe)) throw new Error("This element is not a Plotly plot: " + pe);
        var Ee, Se, Ce = pe._transitionData._frames, Be = [], Ue = [];
        if (!ve) for (ve = [], Ee = 0; Ee < Ce.length; Ee++) ve.push(Ee);
        for ((ve = ve.slice()).sort(), Ee = ve.length - 1; Ee >= 0; Ee--) Se = ve[Ee], Be.push({ type: "delete", index: Se }), Ue.unshift({ type: "insert", index: Se, value: Ce[Se] });
        var Ke = h.modifyFrames, ct = h.modifyFrames, We = [pe, Ue], Ze = [pe, Be];
        return u2 && u2.add(pe, Ke, We, ct, Ze), h.modifyFrames(pe, Be);
      }, r.addTraces = function pe(ve, Ee, Se) {
        ve = s.getGraphDiv(ve);
        var Ce, Be, Ue = [], Ke = r.deleteTraces, ct = pe, We = [ve, Ue], Ze = [ve, Ee];
        for (function(it, ot, mt) {
          var wt, Et;
          if (!Array.isArray(it.data)) throw new Error("gd.data must be an array.");
          if (ot === void 0) throw new Error("traces must be defined.");
          for (Array.isArray(ot) || (ot = [ot]), wt = 0; wt < ot.length; wt++) if (typeof (Et = ot[wt]) != "object" || Array.isArray(Et) || Et === null) throw new Error("all values in traces array must be non-array objects");
          if (mt === void 0 || Array.isArray(mt) || (mt = [mt]), mt !== void 0 && mt.length !== ot.length) throw new Error("if indices is specified, traces.length must equal indices.length");
        }(ve, Ee, Se), Array.isArray(Ee) || (Ee = [Ee]), Ee = Ee.map(function(it) {
          return s.extendFlat({}, it);
        }), w.cleanData(Ee), Ce = 0; Ce < Ee.length; Ce++) ve.data.push(Ee[Ce]);
        for (Ce = 0; Ce < Ee.length; Ce++) Ue.push(-Ee.length + Ce);
        if (Se === void 0) return Be = r.redraw(ve), u2.add(ve, Ke, We, ct, Ze), Be;
        Array.isArray(Se) || (Se = [Se]);
        try {
          I2(ve, Ue, Se);
        } catch (it) {
          throw ve.data.splice(ve.data.length - Ee.length, Ee.length), it;
        }
        return u2.startSequence(ve), u2.add(ve, Ke, We, ct, Ze), Be = r.moveTraces(ve, Ue, Se), u2.stopSequence(ve), Be;
      }, r.deleteTraces = function pe(ve, Ee) {
        ve = s.getGraphDiv(ve);
        var Se, Ce, Be = [], Ue = r.addTraces, Ke = pe, ct = [ve, Be, Ee], We = [ve, Ee];
        if (Ee === void 0) throw new Error("indices must be an integer or array of integers.");
        for (Array.isArray(Ee) || (Ee = [Ee]), D2(ve, Ee, "indices"), (Ee = N2(Ee, ve.data.length - 1)).sort(s.sorterDes), Se = 0; Se < Ee.length; Se += 1) Ce = ve.data.splice(Ee[Se], 1)[0], Be.push(Ce);
        var Ze = r.redraw(ve);
        return u2.add(ve, Ue, ct, Ke, We), Ze;
      }, r.extendTraces = function pe(ve, Ee, Se, Ce) {
        function Be(We, Ze, it) {
          var ot, mt;
          if (s.isTypedArray(We)) if (it < 0) {
            var wt = new We.constructor(0), Et = L2(We, Ze);
            it < 0 ? (ot = Et, mt = wt) : (ot = wt, mt = Et);
          } else if (ot = new We.constructor(it), mt = new We.constructor(We.length + Ze.length - it), it === Ze.length) ot.set(Ze), mt.set(We);
          else if (it < Ze.length) {
            var zt = Ze.length - it;
            ot.set(Ze.subarray(zt)), mt.set(We), mt.set(Ze.subarray(0, zt), We.length);
          } else {
            var Nt = it - Ze.length, yt = We.length - Nt;
            ot.set(We.subarray(yt)), ot.set(Ze, Nt), mt.set(We.subarray(0, yt));
          }
          else ot = We.concat(Ze), mt = it >= 0 && it < ot.length ? ot.splice(0, ot.length - it) : [];
          return [ot, mt];
        }
        var Ue = O2(ve = s.getGraphDiv(ve), Ee, Se, Ce, Be), Ke = r.redraw(ve), ct = [ve, Ue.update, Se, Ue.maxPoints];
        return u2.add(ve, r.prependTraces, ct, pe, arguments), Ke;
      }, r.moveTraces = function pe(ve, Ee, Se) {
        var Ce, Be = [], Ue = [], Ke = pe, ct = pe, We = [ve = s.getGraphDiv(ve), Se, Ee], Ze = [ve, Ee, Se];
        if (I2(ve, Ee, Se), Ee = Array.isArray(Ee) ? Ee : [Ee], Se === void 0) for (Se = [], Ce = 0; Ce < Ee.length; Ce++) Se.push(-Ee.length + Ce);
        for (Se = Array.isArray(Se) ? Se : [Se], Ee = N2(Ee, ve.data.length - 1), Se = N2(Se, ve.data.length - 1), Ce = 0; Ce < ve.data.length; Ce++) Ee.indexOf(Ce) === -1 && Be.push(ve.data[Ce]);
        for (Ce = 0; Ce < Ee.length; Ce++) Ue.push({ newIndex: Se[Ce], trace: ve.data[Ee[Ce]] });
        for (Ue.sort(function(ot, mt) {
          return ot.newIndex - mt.newIndex;
        }), Ce = 0; Ce < Ue.length; Ce += 1) Be.splice(Ue[Ce].newIndex, 0, Ue[Ce].trace);
        ve.data = Be;
        var it = r.redraw(ve);
        return u2.add(ve, Ke, We, ct, Ze), it;
      }, r.prependTraces = function pe(ve, Ee, Se, Ce) {
        function Be(We, Ze, it) {
          var ot, mt;
          if (s.isTypedArray(We)) if (it <= 0) {
            var wt = new We.constructor(0), Et = L2(Ze, We);
            it < 0 ? (ot = Et, mt = wt) : (ot = wt, mt = Et);
          } else if (ot = new We.constructor(it), mt = new We.constructor(We.length + Ze.length - it), it === Ze.length) ot.set(Ze), mt.set(We);
          else if (it < Ze.length) {
            var zt = Ze.length - it;
            ot.set(Ze.subarray(0, zt)), mt.set(Ze.subarray(zt)), mt.set(We, zt);
          } else {
            var Nt = it - Ze.length;
            ot.set(Ze), ot.set(We.subarray(0, Nt), Ze.length), mt.set(We.subarray(Nt));
          }
          else ot = Ze.concat(We), mt = it >= 0 && it < ot.length ? ot.splice(it, ot.length) : [];
          return [ot, mt];
        }
        var Ue = O2(ve = s.getGraphDiv(ve), Ee, Se, Ce, Be), Ke = r.redraw(ve), ct = [ve, Ue.update, Se, Ue.maxPoints];
        return u2.add(ve, r.extendTraces, ct, pe, arguments), Ke;
      }, r.newPlot = function(pe, ve, Ee, Se) {
        return pe = s.getGraphDiv(pe), h.cleanPlot([], {}, pe._fullData || [], pe._fullLayout || {}), h.purge(pe), r._doPlot(pe, ve, Ee, Se);
      }, r._doPlot = function(pe, ve, Ee, Se) {
        var Ce;
        if (pe = s.getGraphDiv(pe), l.init(pe), s.isPlainObject(ve)) {
          var Be = ve;
          ve = Be.data, Ee = Be.layout, Se = Be.config, Ce = Be.frames;
        }
        if (l.triggerHandler(pe, "plotly_beforeplot", [ve, Ee, Se]) === false) return Promise.reject();
        ve || Ee || s.isPlotDiv(pe) || s.warn("Calling _doPlot as if redrawing but this container doesn't yet have a plot.", pe), F13(pe, Se), Ee || (Ee = {}), n.select(pe).classed("js-plotly-plot", true), d.makeTester(), Array.isArray(pe._promises) || (pe._promises = []);
        var Ue = (pe.data || []).length === 0 && Array.isArray(ve);
        Array.isArray(ve) && (w.cleanData(ve), Ue ? pe.data = ve : pe.data.push.apply(pe.data, ve), pe.empty = false), pe.layout && !Ue || (pe.layout = w.cleanLayout(Ee)), h.supplyDefaults(pe);
        var Ke = pe._fullLayout, ct = Ke._has("cartesian");
        Ke._replotting = true, (Ue || Ke._shouldCreateBgLayer) && (function(Nt) {
          var yt = n.select(Nt), pt = Nt._fullLayout;
          if (pt._calcInverseTransform = Ae, pt._calcInverseTransform(Nt), pt._container = yt.selectAll(".plot-container").data([0]), pt._container.enter().insert("div", ":first-child").classed("plot-container", true).classed("plotly", true), pt._paperdiv = pt._container.selectAll(".svg-container").data([0]), pt._paperdiv.enter().append("div").classed("user-select-none", true).classed("svg-container", true).style("position", "relative"), pt._glcontainer = pt._paperdiv.selectAll(".gl-container").data([{}]), pt._glcontainer.enter().append("div").classed("gl-container", true), pt._paperdiv.selectAll(".main-svg").remove(), pt._paperdiv.select(".modebar-container").remove(), pt._paper = pt._paperdiv.insert("svg", ":first-child").classed("main-svg", true), pt._toppaper = pt._paperdiv.append("svg").classed("main-svg", true), pt._modebardiv = pt._paperdiv.append("div"), delete pt._modeBar, pt._hoverpaper = pt._paperdiv.append("svg").classed("main-svg", true), !pt._uid) {
            var Ot = {};
            n.selectAll("defs").each(function() {
              this.id && (Ot[this.id.split("-")[1]] = 1);
            }), pt._uid = s.randstr(Ot);
          }
          pt._paperdiv.selectAll(".main-svg").attr(g.svgAttrs), pt._defs = pt._paper.append("defs").attr("id", "defs-" + pt._uid), pt._clips = pt._defs.append("g").classed("clips", true), pt._topdefs = pt._toppaper.append("defs").attr("id", "topdefs-" + pt._uid), pt._topclips = pt._topdefs.append("g").classed("clips", true), pt._bgLayer = pt._paper.append("g").classed("bglayer", true), pt._draggers = pt._paper.append("g").classed("draglayer", true);
          var Jt = pt._paper.append("g").classed("layer-below", true);
          pt._imageLowerLayer = Jt.append("g").classed("imagelayer", true), pt._shapeLowerLayer = Jt.append("g").classed("shapelayer", true), pt._cartesianlayer = pt._paper.append("g").classed("cartesianlayer", true), pt._polarlayer = pt._paper.append("g").classed("polarlayer", true), pt._smithlayer = pt._paper.append("g").classed("smithlayer", true), pt._ternarylayer = pt._paper.append("g").classed("ternarylayer", true), pt._geolayer = pt._paper.append("g").classed("geolayer", true), pt._funnelarealayer = pt._paper.append("g").classed("funnelarealayer", true), pt._pielayer = pt._paper.append("g").classed("pielayer", true), pt._iciclelayer = pt._paper.append("g").classed("iciclelayer", true), pt._treemaplayer = pt._paper.append("g").classed("treemaplayer", true), pt._sunburstlayer = pt._paper.append("g").classed("sunburstlayer", true), pt._indicatorlayer = pt._toppaper.append("g").classed("indicatorlayer", true), pt._glimages = pt._paper.append("g").classed("glimages", true);
          var tr = pt._toppaper.append("g").classed("layer-above", true);
          pt._imageUpperLayer = tr.append("g").classed("imagelayer", true), pt._shapeUpperLayer = tr.append("g").classed("shapelayer", true), pt._infolayer = pt._toppaper.append("g").classed("infolayer", true), pt._menulayer = pt._toppaper.append("g").classed("menulayer", true), pt._zoomlayer = pt._toppaper.append("g").classed("zoomlayer", true), pt._hoverlayer = pt._hoverpaper.append("g").classed("hoverlayer", true), pt._modebardiv.classed("modebar-container", true).style("position", "absolute").style("top", "0px").style("right", "0px"), Nt.emit("plotly_framework");
        }(pe), Ke._shouldCreateBgLayer && delete Ke._shouldCreateBgLayer), d.initGradients(pe), d.initPatterns(pe), Ue && p.saveShowSpikeInitial(pe);
        var We = !pe.calcdata || pe.calcdata.length !== (pe._fullData || []).length;
        We && h.doCalcdata(pe);
        for (var Ze = 0; Ze < pe.calcdata.length; Ze++) pe.calcdata[Ze][0].trace = pe._fullData[Ze];
        pe._context.responsive ? pe._responsiveChartHandler || (pe._responsiveChartHandler = function() {
          s.isHidden(pe) || h.resize(pe);
        }, window.addEventListener("resize", pe._responsiveChartHandler)) : s.clearResponsive(pe);
        var it = s.extendFlat({}, Ke._size), ot = 0;
        function mt() {
          if (h.clearAutoMarginIds(pe), _4.drawMarginPushers(pe), p.allowAutoMargin(pe), Ke._has("pie")) for (var Nt = pe._fullData, yt = 0; yt < Nt.length; yt++) {
            var pt = Nt[yt];
            pt.type === "pie" && pt.automargin && h.allowAutoMargin(pe, "pie." + pt.uid + ".automargin");
          }
          return h.doAutoMargin(pe), h.previousPromises(pe);
        }
        function wt() {
          pe._transitioning || (_4.doAutoRangeAndConstraints(pe), Ue && p.saveRangeInitial(pe), c.getComponentMethod("rangeslider", "calcAutorange")(pe));
        }
        var Et = [h.previousPromises, function() {
          if (Ce) return r.addFrames(pe, Ce);
        }, function Nt() {
          for (var yt = Ke._basePlotModules, pt = 0; pt < yt.length; pt++) yt[pt].drawFramework && yt[pt].drawFramework(pe);
          !Ke._glcanvas && Ke._has("gl") && (Ke._glcanvas = Ke._glcontainer.selectAll(".gl-canvas").data([{ key: "contextLayer", context: true, pick: false }, { key: "focusLayer", context: false, pick: false }, { key: "pickLayer", context: false, pick: true }], function(Ye) {
            return Ye.key;
          }), Ke._glcanvas.enter().append("canvas").attr("class", function(Ye) {
            return "gl-canvas gl-canvas-" + Ye.key.replace("Layer", "");
          }).style({ position: "absolute", top: 0, left: 0, overflow: "visible", "pointer-events": "none" }));
          var Ot = pe._context.plotGlPixelRatio;
          if (Ke._glcanvas) {
            Ke._glcanvas.attr("width", Ke.width * Ot).attr("height", Ke.height * Ot).style("width", Ke.width + "px").style("height", Ke.height + "px");
            var Jt = Ke._glcanvas.data()[0].regl;
            if (Jt && (Math.floor(Ke.width * Ot) !== Jt._gl.drawingBufferWidth || Math.floor(Ke.height * Ot) !== Jt._gl.drawingBufferHeight)) {
              var tr = "WebGL context buffer and canvas dimensions do not match due to browser/WebGL bug.";
              if (!ot) return s.log(tr + " Clearing graph and plotting again."), h.cleanPlot([], {}, pe._fullData, Ke), h.supplyDefaults(pe), Ke = pe._fullLayout, h.doCalcdata(pe), ot++, Nt();
              s.error(tr);
            }
          }
          return Ke.modebar.orientation === "h" ? Ke._modebardiv.style("height", null).style("width", "100%") : Ke._modebardiv.style("width", null).style("height", Ke.height + "px"), h.previousPromises(pe);
        }, mt, function() {
          if (h.didMarginChange(it, Ke._size)) return s.syncOrAsync([mt, _4.layoutStyles], pe);
        }];
        ct && Et.push(function() {
          if (We) return s.syncOrAsync([c.getComponentMethod("shapes", "calcAutorange"), c.getComponentMethod("annotations", "calcAutorange"), wt], pe);
          wt();
        }), Et.push(_4.layoutStyles), ct && Et.push(function() {
          return p.draw(pe, Ue ? "" : "redraw");
        }, function(Nt) {
          Nt._fullLayout._insideTickLabelsAutorange && re(Nt, Nt._fullLayout._insideTickLabelsAutorange).then(function() {
            Nt._fullLayout._insideTickLabelsAutorange = void 0;
          });
        }), Et.push(_4.drawData, _4.finalDraw, m, h.addLinks, h.rehover, h.redrag, h.doAutoMargin, function(Nt) {
          Nt._fullLayout._insideTickLabelsAutorange && Ue && p.saveRangeInitial(Nt, true);
        }, h.previousPromises);
        var zt = s.syncOrAsync(Et, pe);
        return zt && zt.then || (zt = Promise.resolve()), zt.then(function() {
          return S2(pe), pe;
        });
      }, r.purge = function(pe) {
        var ve = (pe = s.getGraphDiv(pe))._fullLayout || {}, Ee = pe._fullData || [];
        return h.cleanPlot([], {}, Ee, ve), h.purge(pe), l.purge(pe), ve._container && ve._container.remove(), delete pe._context, pe;
      }, r.react = function(pe, ve, Ee, Se) {
        var Ce, Be;
        pe = s.getGraphDiv(pe), w.clearPromiseQueue(pe);
        var Ue = pe._fullData, Ke = pe._fullLayout;
        if (s.isPlotDiv(pe) && Ue && Ke) {
          if (s.isPlainObject(ve)) {
            var ct = ve;
            ve = ct.data, Ee = ct.layout, Se = ct.config, Ce = ct.frames;
          }
          var We = false;
          if (Se) {
            var Ze = s.extendDeep({}, pe._context);
            pe._context = void 0, F13(pe, Se), We = function $e(Ve, ut) {
              var Re;
              for (Re in Ve) if (Re.charAt(0) !== "_") {
                var qe = Ve[Re], je = ut[Re];
                if (qe !== je) if (s.isPlainObject(qe) && s.isPlainObject(je)) {
                  if ($e(qe, je)) return true;
                } else {
                  if (!Array.isArray(qe) || !Array.isArray(je) || qe.length !== je.length) return true;
                  for (var rt = 0; rt < qe.length; rt++) if (qe[rt] !== je[rt] && (!s.isPlainObject(qe[rt]) || !s.isPlainObject(je[rt]) || $e(qe[rt], je[rt]))) return true;
                }
              }
            }(Ze, pe._context);
          }
          pe.data = ve || [], w.cleanData(pe.data), pe.layout = Ee || {}, w.cleanLayout(pe.layout), function($e, Ve, ut, Re) {
            var qe, je, rt, He, xe, Ne, ke, Me, Le, ze, ft = Re._preGUI, De = [], Je = {}, tt = {};
            for (qe in ft) {
              if (xe = ce(qe, ue)) {
                if (Le = xe.head, ze = xe.tail, je = xe.attr || Le + ".uirevision", (He = (rt = i(Re, je).get()) && se(je, Ve)) && He === rt) {
                  if ((Ne = ft[qe]) === null && (Ne = void 0), we(Me = (ke = i(Ve, qe)).get(), Ne)) {
                    Me === void 0 && ze === "autorange" && De.push(Le), ke.set(W2(i(Re, qe).get()));
                    continue;
                  }
                  if (ze === "autorange" || ze.substr(0, 6) === "range[") {
                    var vt = ft[Le + ".range[0]"], kt = ft[Le + ".range[1]"], jt = ft[Le + ".autorange"];
                    if (jt || jt === null && vt === null && kt === null) {
                      if (!(Le in Je)) {
                        var Vt = i(Ve, Le).get();
                        Je[Le] = Vt && (Vt.autorange || Vt.autorange !== false && (!Vt.range || Vt.range.length !== 2));
                      }
                      if (Je[Le]) {
                        ke.set(W2(i(Re, qe).get()));
                        continue;
                      }
                    }
                  }
                }
              } else s.warn("unrecognized GUI edit: " + qe);
              delete ft[qe], xe && xe.tail.substr(0, 6) === "range[" && (tt[xe.head] = 1);
            }
            for (var Kt = 0; Kt < De.length; Kt++) {
              var rr = De[Kt];
              if (tt[rr]) {
                var Tr = i(Ve, rr).get();
                Tr && delete Tr.autorange;
              }
            }
            var yr = Re._tracePreGUI;
            for (var pr in yr) {
              var lr, _r = yr[pr], $r = null;
              for (qe in _r) {
                if (!$r) {
                  var Ar = he(pr, ut);
                  if (Ar < 0) {
                    delete yr[pr];
                    break;
                  }
                  var Qr = me(pr, $e, (lr = ut[Ar]._fullInput).index);
                  if (Qr < 0) {
                    delete yr[pr];
                    break;
                  }
                  $r = $e[Qr];
                }
                if (xe = ce(qe, le)) {
                  if (xe.attr ? He = (rt = i(Re, xe.attr).get()) && se(xe.attr, Ve) : (rt = lr.uirevision, (He = $r.uirevision) === void 0 && (He = Ve.uirevision)), He && He === rt && ((Ne = _r[qe]) === null && (Ne = void 0), we(Me = (ke = i($r, qe)).get(), Ne))) {
                    ke.set(W2(i(lr, qe).get()));
                    continue;
                  }
                } else s.warn("unrecognized GUI edit: " + qe + " in trace uid " + pr);
                delete _r[qe];
              }
            }
          }(pe.data, pe.layout, Ue, Ke), h.supplyDefaults(pe, { skipUpdateCalc: true });
          var it = pe._fullData, ot = pe._fullLayout, mt = ot.datarevision === void 0, wt = ot.transition, Et = function($e, Ve, ut, Re, qe) {
            var je = k.layoutFlags();
            function rt(He) {
              return f.getLayoutValObject(ut, He);
            }
            return je.arrays = {}, je.rangesAltered = {}, je.nChanges = 0, je.nChangesAnim = 0, be(Ve, ut, [], { getValObject: rt, flags: je, immutable: Re, transition: qe, gd: $e }), (je.plot || je.calc) && (je.layoutReplot = true), qe && je.nChanges && je.nChangesAnim && (je.anim = je.nChanges === je.nChangesAnim ? "all" : "some"), je;
          }(pe, Ke, ot, mt, wt), zt = Et.newDataRevision, Nt = function($e, Ve, ut, Re, qe, je) {
            var rt = Ve.length === ut.length;
            if (!qe && !rt) return { fullReplot: true, calc: true };
            var He, xe, Ne = k.traceFlags();
            Ne.arrays = {}, Ne.nChanges = 0, Ne.nChangesAnim = 0;
            var ke = { getValObject: function(Le) {
              var ze = f.getTraceValObject(xe, Le);
              return !xe._module.animatable && ze.anim && (ze.anim = false), ze;
            }, flags: Ne, immutable: Re, transition: qe, newDataRevision: je, gd: $e }, Me = {};
            for (He = 0; He < Ve.length; He++) if (ut[He]) {
              if (xe = ut[He]._fullInput, h.hasMakesDataTransform(xe) && (xe = ut[He]), Me[xe.uid]) continue;
              Me[xe.uid] = 1, be(Ve[He]._fullInput, xe, [], ke);
            }
            return (Ne.calc || Ne.plot) && (Ne.fullReplot = true), qe && Ne.nChanges && Ne.nChangesAnim && (Ne.anim = Ne.nChanges === Ne.nChangesAnim && rt ? "all" : "some"), Ne;
          }(pe, Ue, it, mt, wt, zt);
          if (Z2(pe) && (Et.layoutReplot = true), Nt.calc || Et.calc) {
            pe.calcdata = void 0;
            for (var yt = Object.getOwnPropertyNames(ot), pt = 0; pt < yt.length; pt++) {
              var Ot = yt[pt], Jt = Ot.substring(0, 5);
              if (Jt === "xaxis" || Jt === "yaxis") {
                var tr = ot[Ot]._emptyCategories;
                tr && tr();
              }
            }
          } else h.supplyDefaultsUpdateCalc(pe.calcdata, it);
          var Ye = [];
          if (Ce && (pe._transitionData = {}, h.createTransitionData(pe), Ye.push(function() {
            return r.addFrames(pe, Ce);
          })), ot.transition && !We && (Nt.anim || Et.anim)) Et.ticks && Ye.push(_4.doTicksRelayout), h.doCalcdata(pe), _4.doAutoRangeAndConstraints(pe), Ye.push(function() {
            return h.transitionFromReact(pe, Nt, Et, Ke);
          });
          else if (Nt.fullReplot || Et.layoutReplot || We) pe._fullLayout._skipDefaults = true, Ye.push(r._doPlot);
          else {
            for (var at in Et.arrays) {
              var Ge = Et.arrays[at];
              if (Ge.length) {
                var st = c.getComponentMethod(at, "drawOne");
                if (st !== s.noop) for (var Ie = 0; Ie < Ge.length; Ie++) st(pe, Ge[Ie]);
                else {
                  var Pe = c.getComponentMethod(at, "draw");
                  if (Pe === s.noop) throw new Error("cannot draw components: " + at);
                  Pe(pe);
                }
              }
            }
            Ye.push(h.previousPromises), Nt.style && Ye.push(_4.doTraceStyle), (Nt.colorbars || Et.colorbars) && Ye.push(_4.doColorBars), Et.legend && Ye.push(_4.doLegend), Et.layoutstyle && Ye.push(_4.layoutStyles), Et.axrange && z(Ye), Et.ticks && Ye.push(_4.doTicksRelayout), Et.modebar && Ye.push(_4.doModeBar), Et.camera && Ye.push(_4.doCamera), Ye.push(S2);
          }
          Ye.push(h.rehover, h.redrag), (Be = s.syncOrAsync(Ye, pe)) && Be.then || (Be = Promise.resolve(pe));
        } else Be = r.newPlot(pe, ve, Ee, Se);
        return Be.then(function() {
          return pe.emit("plotly_react", { data: ve, layout: Ee }), pe;
        });
      }, r.redraw = function(pe) {
        if (pe = s.getGraphDiv(pe), !s.isPlotDiv(pe)) throw new Error("This element is not a Plotly plot: " + pe);
        return w.cleanData(pe.data), w.cleanLayout(pe.layout), pe.calcdata = void 0, r._doPlot(pe).then(function() {
          return pe.emit("plotly_redraw"), pe;
        });
      }, r.relayout = re, r.restyle = V2, r.setPlotConfig = function(pe) {
        return s.extendFlat(b, pe);
      }, r.update = ne, r._guiRelayout = ae(re), r._guiRestyle = ae(V2), r._guiUpdate = ae(ne), r._storeDirectGUIEdit = function(pe, ve, Ee) {
        for (var Se in Ee) Y2(Se, i(pe, Se).get(), Ee[Se], ve);
      };
    }, { "../components/color": 366, "../components/drawing": 388, "../constants/xmlns_namespaces": 480, "../lib": 503, "../lib/events": 492, "../lib/queue": 519, "../plots/cartesian/axes": 554, "../plots/cartesian/constants": 561, "../plots/cartesian/graph_interact": 564, "../plots/cartesian/select": 575, "../plots/plots": 619, "../registry": 638, "./edit_types": 536, "./helpers": 537, "./manage_arrays": 539, "./plot_config": 541, "./plot_schema": 542, "./subroutines": 544, "@plotly/d3": 58, "fast-isnumeric": 190, "has-hover": 228 }], 541: [function(e, t, r) {
      "use strict";
      var n = { staticPlot: { valType: "boolean", dflt: false }, plotlyServerURL: { valType: "string", dflt: "" }, editable: { valType: "boolean", dflt: false }, edits: { annotationPosition: { valType: "boolean", dflt: false }, annotationTail: { valType: "boolean", dflt: false }, annotationText: { valType: "boolean", dflt: false }, axisTitleText: { valType: "boolean", dflt: false }, colorbarPosition: { valType: "boolean", dflt: false }, colorbarTitleText: { valType: "boolean", dflt: false }, legendPosition: { valType: "boolean", dflt: false }, legendText: { valType: "boolean", dflt: false }, shapePosition: { valType: "boolean", dflt: false }, titleText: { valType: "boolean", dflt: false } }, autosizable: { valType: "boolean", dflt: false }, responsive: { valType: "boolean", dflt: false }, fillFrame: { valType: "boolean", dflt: false }, frameMargins: { valType: "number", dflt: 0, min: 0, max: 0.5 }, scrollZoom: { valType: "flaglist", flags: ["cartesian", "gl3d", "geo", "mapbox"], extras: [true, false], dflt: "gl3d+geo+mapbox" }, doubleClick: { valType: "enumerated", values: [false, "reset", "autosize", "reset+autosize"], dflt: "reset+autosize" }, doubleClickDelay: { valType: "number", dflt: 300, min: 0 }, showAxisDragHandles: { valType: "boolean", dflt: true }, showAxisRangeEntryBoxes: { valType: "boolean", dflt: true }, showTips: { valType: "boolean", dflt: true }, showLink: { valType: "boolean", dflt: false }, linkText: { valType: "string", dflt: "Edit chart", noBlank: true }, sendData: { valType: "boolean", dflt: true }, showSources: { valType: "any", dflt: false }, displayModeBar: { valType: "enumerated", values: ["hover", true, false], dflt: "hover" }, showSendToCloud: { valType: "boolean", dflt: false }, showEditInChartStudio: { valType: "boolean", dflt: false }, modeBarButtonsToRemove: { valType: "any", dflt: [] }, modeBarButtonsToAdd: { valType: "any", dflt: [] }, modeBarButtons: { valType: "any", dflt: false }, toImageButtonOptions: { valType: "any", dflt: {} }, displaylogo: { valType: "boolean", dflt: true }, watermark: { valType: "boolean", dflt: false }, plotGlPixelRatio: { valType: "number", dflt: 2, min: 1, max: 4 }, setBackground: { valType: "any", dflt: "transparent" }, topojsonURL: { valType: "string", noBlank: true, dflt: "https://cdn.plot.ly/" }, mapboxAccessToken: { valType: "string", dflt: null }, logging: { valType: "integer", min: 0, max: 2, dflt: 1 }, notifyOnLogging: { valType: "integer", min: 0, max: 2, dflt: 0 }, queueLength: { valType: "integer", min: 0, dflt: 0 }, globalTransforms: { valType: "any", dflt: [] }, locale: { valType: "string", dflt: "en-US" }, locales: { valType: "any", dflt: {} } }, a = {};
      (function o(s, i) {
        for (var l in s) {
          var u2 = s[l];
          u2.valType ? i[l] = u2.dflt : (i[l] || (i[l] = {}), o(u2, i[l]));
        }
      })(n, a), t.exports = { configAttributes: n, dfltConfig: a };
    }, {}], 542: [function(e, t, r) {
      "use strict";
      var n = e("../registry"), a = e("../lib"), o = e("../plots/attributes"), s = e("../plots/layout_attributes"), i = e("../plots/frame_attributes"), l = e("../plots/animation_attributes"), u2 = e("./plot_config").configAttributes, c = e("./edit_types"), f = a.extendDeepAll, h = a.isPlainObject, p = a.isArrayOrTypedArray, d = a.nestedProperty, v = a.valObjectMeta, m = ["_isSubplotObj", "_isLinkedToArray", "_arrayAttrRegexps", "_deprecated"];
      function g(T2, A2, S2) {
        if (!T2) return false;
        if (T2._isLinkedToArray) {
          if (x(A2[S2])) S2++;
          else if (S2 < A2.length) return false;
        }
        for (; S2 < A2.length; S2++) {
          var C2 = T2[A2[S2]];
          if (!h(C2) || (T2 = C2, S2 === A2.length - 1)) break;
          if (T2._isLinkedToArray) {
            if (!x(A2[++S2])) return false;
          } else if (T2.valType === "info_array") {
            var E2 = A2[++S2];
            if (!x(E2)) return false;
            var F13 = T2.items;
            if (Array.isArray(F13)) {
              if (E2 >= F13.length) return false;
              if (T2.dimensions === 2) {
                if (S2++, A2.length === S2) return T2;
                var N2 = A2[S2];
                if (!x(N2)) return false;
                T2 = F13[E2][N2];
              } else T2 = F13[E2];
            } else T2 = F13;
          }
        }
        return T2;
      }
      function x(T2) {
        return T2 === Math.round(T2) && T2 >= 0;
      }
      function b() {
        var T2, A2, S2 = {};
        for (T2 in f(S2, s), n.subplotsRegistry) if ((A2 = n.subplotsRegistry[T2]).layoutAttributes) if (Array.isArray(A2.attr)) for (var C2 = 0; C2 < A2.attr.length; C2++) _4(S2, A2, A2.attr[C2]);
        else _4(S2, A2, A2.attr === "subplot" ? A2.name : A2.attr);
        for (T2 in n.componentsRegistry) {
          var E2 = (A2 = n.componentsRegistry[T2]).schema;
          if (E2 && (E2.subplots || E2.layout)) {
            var F13 = E2.subplots;
            if (F13 && F13.xaxis && !F13.yaxis) for (var N2 in F13.xaxis) delete S2.yaxis[N2];
          } else A2.name === "colorscale" ? f(S2, A2.layoutAttributes) : A2.layoutAttributes && k(S2, A2.layoutAttributes, A2.name);
        }
        return { layoutAttributes: w(S2) };
      }
      function y() {
        var T2 = { frames: f({}, i) };
        return w(T2), T2.frames;
      }
      function w(T2) {
        return function(A2) {
          r.crawl(A2, function(S2, C2, E2) {
            r.isValObject(S2) ? S2.arrayOk !== true && S2.valType !== "data_array" || (E2[C2 + "src"] = { valType: "string", editType: "none" }) : h(S2) && (S2.role = "object");
          });
        }(T2), function(A2) {
          r.crawl(A2, function(S2, C2, E2) {
            if (S2) {
              var F13 = S2._isLinkedToArray;
              F13 && (delete S2._isLinkedToArray, E2[C2] = { items: {} }, E2[C2].items[F13] = S2, E2[C2].role = "object");
            }
          });
        }(T2), function(A2) {
          (function S2(C2) {
            for (var E2 in C2) if (h(C2[E2])) S2(C2[E2]);
            else if (Array.isArray(C2[E2])) for (var F13 = 0; F13 < C2[E2].length; F13++) S2(C2[E2][F13]);
            else C2[E2] instanceof RegExp && (C2[E2] = C2[E2].toString());
          })(A2);
        }(T2), T2;
      }
      function _4(T2, A2, S2) {
        var C2 = d(T2, S2), E2 = f({}, A2.layoutAttributes);
        E2._isSubplotObj = true, C2.set(E2);
      }
      function k(T2, A2, S2) {
        var C2 = d(T2, S2);
        C2.set(f(C2.get() || {}, A2));
      }
      r.IS_SUBPLOT_OBJ = "_isSubplotObj", r.IS_LINKED_TO_ARRAY = "_isLinkedToArray", r.DEPRECATED = "_deprecated", r.UNDERSCORE_ATTRS = m, r.get = function() {
        var T2 = {};
        n.allTypes.forEach(function(S2) {
          T2[S2] = function(C2) {
            var E2, F13;
            E2 = n.modules[C2]._module, F13 = E2.basePlotModule;
            var N2 = { type: null }, D2 = f({}, o), I2 = f({}, E2.attributes);
            r.crawl(I2, function(V2, W2, X2, Y2, K2) {
              d(D2, K2).set(void 0), V2 === void 0 && d(I2, K2).set(void 0);
            }), f(N2, D2), n.traceIs(C2, "noOpacity") && delete N2.opacity, n.traceIs(C2, "showLegend") || (delete N2.showlegend, delete N2.legendgroup), n.traceIs(C2, "noHover") && (delete N2.hoverinfo, delete N2.hoverlabel), E2.selectPoints || delete N2.selectedpoints, f(N2, I2), F13.attributes && f(N2, F13.attributes), N2.type = C2;
            var O2 = { meta: E2.meta || {}, categories: E2.categories || {}, animatable: Boolean(E2.animatable), type: C2, attributes: w(N2) };
            if (E2.layoutAttributes) {
              var L2 = {};
              f(L2, E2.layoutAttributes), O2.layoutAttributes = w(L2);
            }
            return E2.animatable || r.crawl(O2, function(V2) {
              r.isValObject(V2) && "anim" in V2 && delete V2.anim;
            }), O2;
          }(S2);
        });
        var A2 = {};
        return Object.keys(n.transformsRegistry).forEach(function(S2) {
          A2[S2] = function(C2) {
            var E2 = n.transformsRegistry[C2], F13 = f({}, E2.attributes);
            return Object.keys(n.componentsRegistry).forEach(function(N2) {
              var D2 = n.componentsRegistry[N2];
              D2.schema && D2.schema.transforms && D2.schema.transforms[C2] && Object.keys(D2.schema.transforms[C2]).forEach(function(I2) {
                k(F13, D2.schema.transforms[C2][I2], I2);
              });
            }), { attributes: w(F13) };
          }(S2);
        }), { defs: { valObjects: v, metaKeys: m.concat(["description", "role", "editType", "impliedEdits"]), editType: { traces: c.traces, layout: c.layout }, impliedEdits: {} }, traces: T2, layout: b(), transforms: A2, frames: y(), animation: w(l), config: w(u2) };
      }, r.crawl = function(T2, A2, S2, C2) {
        var E2 = S2 || 0;
        C2 = C2 || "", Object.keys(T2).forEach(function(F13) {
          var N2 = T2[F13];
          if (m.indexOf(F13) === -1) {
            var D2 = (C2 ? C2 + "." : "") + F13;
            A2(N2, F13, T2, E2, D2), r.isValObject(N2) || h(N2) && F13 !== "impliedEdits" && r.crawl(N2, A2, E2 + 1, D2);
          }
        });
      }, r.isValObject = function(T2) {
        return T2 && T2.valType !== void 0;
      }, r.findArrayAttributes = function(T2) {
        var A2, S2, C2 = [], E2 = [], F13 = [];
        function N2(V2, W2, X2, Y2) {
          E2 = E2.slice(0, Y2).concat([W2]), F13 = F13.slice(0, Y2).concat([V2 && V2._isLinkedToArray]), V2 && (V2.valType === "data_array" || V2.arrayOk === true) && !(E2[Y2 - 1] === "colorbar" && (W2 === "ticktext" || W2 === "tickvals")) && function K2(q, re, R2) {
            var z = q[E2[re]], H2 = R2 + E2[re];
            if (re === E2.length - 1) p(z) && C2.push(S2 + H2);
            else if (F13[re]) {
              if (Array.isArray(z)) for (var te = 0; te < z.length; te++) h(z[te]) && K2(z[te], re + 1, H2 + "[" + te + "].");
            } else h(z) && K2(z, re + 1, H2 + ".");
          }(A2, 0, "");
        }
        A2 = T2, S2 = "", r.crawl(o, N2), T2._module && T2._module.attributes && r.crawl(T2._module.attributes, N2);
        var D2 = T2.transforms;
        if (D2) for (var I2 = 0; I2 < D2.length; I2++) {
          var O2 = D2[I2], L2 = O2._module;
          L2 && (S2 = "transforms[" + I2 + "].", A2 = O2, r.crawl(L2.attributes, N2));
        }
        return C2;
      }, r.getTraceValObject = function(T2, A2) {
        var S2, C2, E2 = A2[0], F13 = 1;
        if (E2 === "transforms") {
          if (A2.length === 1) return o.transforms;
          var N2 = T2.transforms;
          if (!Array.isArray(N2) || !N2.length) return false;
          var D2 = A2[1];
          if (!x(D2) || D2 >= N2.length) return false;
          C2 = (S2 = (n.transformsRegistry[N2[D2].type] || {}).attributes) && S2[A2[2]], F13 = 3;
        } else {
          var I2 = T2._module;
          if (I2 || (I2 = (n.modules[T2.type || o.type.dflt] || {})._module), !I2) return false;
          if (!(C2 = (S2 = I2.attributes) && S2[E2])) {
            var O2 = I2.basePlotModule;
            O2 && O2.attributes && (C2 = O2.attributes[E2]);
          }
          C2 || (C2 = o[E2]);
        }
        return g(C2, A2, F13);
      }, r.getLayoutValObject = function(T2, A2) {
        return g(function(S2, C2) {
          var E2, F13, N2, D2, I2 = S2._basePlotModules;
          if (I2) {
            var O2;
            for (E2 = 0; E2 < I2.length; E2++) {
              if ((N2 = I2[E2]).attrRegex && N2.attrRegex.test(C2)) {
                if (N2.layoutAttrOverrides) return N2.layoutAttrOverrides;
                !O2 && N2.layoutAttributes && (O2 = N2.layoutAttributes);
              }
              var L2 = N2.baseLayoutAttrOverrides;
              if (L2 && C2 in L2) return L2[C2];
            }
            if (O2) return O2;
          }
          var V2 = S2._modules;
          if (V2) {
            for (E2 = 0; E2 < V2.length; E2++) if ((D2 = V2[E2].layoutAttributes) && C2 in D2) return D2[C2];
          }
          for (F13 in n.componentsRegistry) {
            if ((N2 = n.componentsRegistry[F13]).name === "colorscale" && C2.indexOf("coloraxis") === 0) return N2.layoutAttributes[C2];
            if (!N2.schema && C2 === N2.name) return N2.layoutAttributes;
          }
          return C2 in s && s[C2];
        }(T2, A2[0]), A2, 1);
      };
    }, { "../lib": 503, "../plots/animation_attributes": 548, "../plots/attributes": 550, "../plots/frame_attributes": 586, "../plots/layout_attributes": 610, "../registry": 638, "./edit_types": 536, "./plot_config": 541 }], 543: [function(e, t, r) {
      "use strict";
      var n = e("../lib"), a = e("../plots/attributes"), o = { name: { valType: "string", editType: "none" } };
      function s(l) {
        return l && typeof l == "string";
      }
      function i(l) {
        var u2 = l.length - 1;
        return l.charAt(u2) !== "s" && n.warn("bad argument to arrayDefaultKey: " + l), l.substr(0, l.length - 1) + "defaults";
      }
      o.templateitemname = { valType: "string", editType: "calc" }, r.templatedArray = function(l, u2) {
        return u2._isLinkedToArray = l, u2.name = o.name, u2.templateitemname = o.templateitemname, u2;
      }, r.traceTemplater = function(l) {
        var u2, c, f = {};
        for (u2 in l) c = l[u2], Array.isArray(c) && c.length && (f[u2] = 0);
        return { newTrace: function(h) {
          var p = { type: u2 = n.coerce(h, {}, a, "type"), _template: null };
          if (u2 in f) {
            c = l[u2];
            var d = f[u2] % c.length;
            f[u2]++, p._template = c[d];
          }
          return p;
        } };
      }, r.newContainer = function(l, u2, c) {
        var f = l._template, h = f && (f[u2] || c && f[c]);
        return n.isPlainObject(h) || (h = null), l[u2] = { _template: h };
      }, r.arrayTemplater = function(l, u2, c) {
        var f = l._template, h = f && f[i(u2)], p = f && f[u2];
        Array.isArray(p) && p.length || (p = []);
        var d = {};
        return { newItem: function(v) {
          var m = { name: v.name, _input: v }, g = m.templateitemname = v.templateitemname;
          if (!s(g)) return m._template = h, m;
          for (var x = 0; x < p.length; x++) {
            var b = p[x];
            if (b.name === g) return d[g] = 1, m._template = b, m;
          }
          return m[c] = v[c] || false, m._template = false, m;
        }, defaultItems: function() {
          for (var v = [], m = 0; m < p.length; m++) {
            var g = p[m], x = g.name;
            if (s(x) && !d[x]) {
              var b = { _template: g, name: x, _input: { _templateitemname: x } };
              b.templateitemname = g.templateitemname, v.push(b), d[x] = 1;
            }
          }
          return v;
        } };
      }, r.arrayDefaultKey = i, r.arrayEditor = function(l, u2, c) {
        var f = (n.nestedProperty(l, u2).get() || []).length, h = c._index, p = h >= f && (c._input || {})._templateitemname;
        p && (h = f);
        var d, v = u2 + "[" + h + "]";
        function m() {
          d = {}, p && (d[v] = {}, d[v].templateitemname = p);
        }
        function g(b, y) {
          p ? n.nestedProperty(d[v], b).set(y) : d[v + "." + b] = y;
        }
        function x() {
          var b = d;
          return m(), b;
        }
        return m(), { modifyBase: function(b, y) {
          d[b] = y;
        }, modifyItem: g, getUpdateObj: x, applyUpdate: function(b, y) {
          b && g(b, y);
          var w = x();
          for (var _4 in w) n.nestedProperty(l, _4).set(w[_4]);
        } };
      };
    }, { "../lib": 503, "../plots/attributes": 550 }], 544: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../registry"), o = e("../plots/plots"), s = e("../lib"), i = e("../lib/clear_gl_canvases"), l = e("../components/color"), u2 = e("../components/drawing"), c = e("../components/titles"), f = e("../components/modebar"), h = e("../plots/cartesian/axes"), p = e("../constants/alignment"), d = e("../plots/cartesian/constraints"), v = d.enforce, m = d.clean, g = e("../plots/cartesian/autorange").doAutoRange;
      function x(A2, S2, C2) {
        for (var E2 = 0; E2 < C2.length; E2++) {
          var F13 = C2[E2][0], N2 = C2[E2][1];
          if (!(F13[0] >= A2[1] || F13[1] <= A2[0]) && N2[0] < S2[1] && N2[1] > S2[0]) return true;
        }
        return false;
      }
      function b(A2) {
        var S2, C2, E2, F13, N2, D2, I2 = A2._fullLayout, O2 = I2._size, L2 = O2.p, V2 = h.list(A2, "", true);
        if (I2._paperdiv.style({ width: A2._context.responsive && I2.autosize && !A2._context._hasZeroWidth && !A2.layout.width ? "100%" : I2.width + "px", height: A2._context.responsive && I2.autosize && !A2._context._hasZeroHeight && !A2.layout.height ? "100%" : I2.height + "px" }).selectAll(".main-svg").call(u2.setSize, I2.width, I2.height), A2._context.setBackground(A2, I2.paper_bgcolor), r.drawMainTitle(A2), f.manage(A2), !I2._has("cartesian")) return o.previousPromises(A2);
        function W2(ot, mt, wt) {
          var Et = ot._lw / 2;
          return ot._id.charAt(0) === "x" ? mt ? wt === "top" ? mt._offset - L2 - Et : mt._offset + mt._length + L2 + Et : O2.t + O2.h * (1 - (ot.position || 0)) + Et % 1 : mt ? wt === "right" ? mt._offset + mt._length + L2 + Et : mt._offset - L2 - Et : O2.l + O2.w * (ot.position || 0) + Et % 1;
        }
        for (S2 = 0; S2 < V2.length; S2++) {
          var X2 = (F13 = V2[S2])._anchorAxis;
          F13._linepositions = {}, F13._lw = u2.crispRound(A2, F13.linewidth, 1), F13._mainLinePosition = W2(F13, X2, F13.side), F13._mainMirrorPosition = F13.mirror && X2 ? W2(F13, X2, p.OPPOSITE_SIDE[F13.side]) : null;
        }
        var Y2 = [], K2 = [], q = [], re = l.opacity(I2.paper_bgcolor) === 1 && l.opacity(I2.plot_bgcolor) === 1 && I2.paper_bgcolor === I2.plot_bgcolor;
        for (C2 in I2._plots) if ((E2 = I2._plots[C2]).mainplot) E2.bg && E2.bg.remove(), E2.bg = void 0;
        else {
          var R2 = E2.xaxis.domain, z = E2.yaxis.domain, H2 = E2.plotgroup;
          if (x(R2, z, q)) {
            var te = H2.node(), j = E2.bg = s.ensureSingle(H2, "rect", "bg");
            te.insertBefore(j.node(), te.childNodes[0]), K2.push(C2);
          } else H2.select("rect.bg").remove(), q.push([R2, z]), re || (Y2.push(C2), K2.push(C2));
        }
        var Q2, Z2, ne, ae, ue, le, ce, se, he, me, we, be, Ae, pe = I2._bgLayer.selectAll(".bg").data(Y2);
        for (pe.enter().append("rect").classed("bg", true), pe.exit().remove(), pe.each(function(ot) {
          I2._plots[ot].bg = n.select(this);
        }), S2 = 0; S2 < K2.length; S2++) E2 = I2._plots[K2[S2]], N2 = E2.xaxis, D2 = E2.yaxis, E2.bg && N2._offset !== void 0 && D2._offset !== void 0 && E2.bg.call(u2.setRect, N2._offset - L2, D2._offset - L2, N2._length + 2 * L2, D2._length + 2 * L2).call(l.fill, I2.plot_bgcolor).style("stroke-width", 0);
        if (!I2._hasOnlyLargeSploms) for (C2 in I2._plots) {
          E2 = I2._plots[C2], N2 = E2.xaxis, D2 = E2.yaxis;
          var ve, Ee, Se = E2.clipId = "clip" + I2._uid + C2 + "plot", Ce = s.ensureSingleById(I2._clips, "clipPath", Se, function(ot) {
            ot.classed("plotclip", true).append("rect");
          });
          E2.clipRect = Ce.select("rect").attr({ width: N2._length, height: D2._length }), u2.setTranslate(E2.plot, N2._offset, D2._offset), E2._hasClipOnAxisFalse ? (ve = null, Ee = Se) : (ve = Se, Ee = null), u2.setClipUrl(E2.plot, ve, A2), E2.layerClipId = Ee;
        }
        function Be(ot) {
          return "M" + Q2 + "," + ot + "H" + Z2;
        }
        function Ue(ot) {
          return "M" + N2._offset + "," + ot + "h" + N2._length;
        }
        function Ke(ot) {
          return "M" + ot + "," + se + "V" + ce;
        }
        function ct(ot) {
          return "M" + ot + "," + D2._offset + "v" + D2._length;
        }
        function We(ot, mt, wt) {
          if (!ot.showline || C2 !== ot._mainSubplot) return "";
          if (!ot._anchorAxis) return wt(ot._mainLinePosition);
          var Et = mt(ot._mainLinePosition);
          return ot.mirror && (Et += mt(ot._mainMirrorPosition)), Et;
        }
        for (C2 in I2._plots) {
          E2 = I2._plots[C2], N2 = E2.xaxis, D2 = E2.yaxis;
          var Ze = "M0,0";
          y(N2, C2) && (ue = _4(N2, "left", D2, V2), Q2 = N2._offset - (ue ? L2 + ue : 0), le = _4(N2, "right", D2, V2), Z2 = N2._offset + N2._length + (le ? L2 + le : 0), ne = W2(N2, D2, "bottom"), ae = W2(N2, D2, "top"), !(Ae = !N2._anchorAxis || C2 !== N2._mainSubplot) || N2.mirror !== "allticks" && N2.mirror !== "all" || (N2._linepositions[C2] = [ne, ae]), Ze = We(N2, Be, Ue), Ae && N2.showline && (N2.mirror === "all" || N2.mirror === "allticks") && (Ze += Be(ne) + Be(ae)), E2.xlines.style("stroke-width", N2._lw + "px").call(l.stroke, N2.showline ? N2.linecolor : "rgba(0,0,0,0)")), E2.xlines.attr("d", Ze);
          var it = "M0,0";
          y(D2, C2) && (we = _4(D2, "bottom", N2, V2), ce = D2._offset + D2._length + (we ? L2 : 0), be = _4(D2, "top", N2, V2), se = D2._offset - (be ? L2 : 0), he = W2(D2, N2, "left"), me = W2(D2, N2, "right"), !(Ae = !D2._anchorAxis || C2 !== D2._mainSubplot) || D2.mirror !== "allticks" && D2.mirror !== "all" || (D2._linepositions[C2] = [he, me]), it = We(D2, Ke, ct), Ae && D2.showline && (D2.mirror === "all" || D2.mirror === "allticks") && (it += Ke(he) + Ke(me)), E2.ylines.style("stroke-width", D2._lw + "px").call(l.stroke, D2.showline ? D2.linecolor : "rgba(0,0,0,0)")), E2.ylines.attr("d", it);
        }
        return h.makeClipPaths(A2), o.previousPromises(A2);
      }
      function y(A2, S2) {
        return (A2.ticks || A2.showline) && (S2 === A2._mainSubplot || A2.mirror === "all" || A2.mirror === "allticks");
      }
      function w(A2, S2, C2) {
        if (!C2.showline || !C2._lw) return false;
        if (C2.mirror === "all" || C2.mirror === "allticks") return true;
        var E2 = C2._anchorAxis;
        if (!E2) return false;
        var F13 = p.FROM_BL[S2];
        return C2.side === S2 ? E2.domain[F13] === A2.domain[F13] : C2.mirror && E2.domain[1 - F13] === A2.domain[1 - F13];
      }
      function _4(A2, S2, C2, E2) {
        if (w(A2, S2, C2)) return C2._lw;
        for (var F13 = 0; F13 < E2.length; F13++) {
          var N2 = E2[F13];
          if (N2._mainAxis === C2._mainAxis && w(A2, S2, N2)) return N2._lw;
        }
        return 0;
      }
      function k(A2, S2) {
        var C2 = A2.title, E2 = A2._size, F13 = 0;
        switch (S2 === "start" ? F13 = C2.pad.l : S2 === "end" && (F13 = -C2.pad.r), C2.xref) {
          case "paper":
            return E2.l + E2.w * C2.x + F13;
          case "container":
          default:
            return A2.width * C2.x + F13;
        }
      }
      function T2(A2, S2) {
        var C2 = A2.title, E2 = A2._size, F13 = 0;
        if (S2 !== "0em" && S2 ? S2 === p.CAP_SHIFT + "em" && (F13 = C2.pad.t) : F13 = -C2.pad.b, C2.y === "auto") return E2.t / 2;
        switch (C2.yref) {
          case "paper":
            return E2.t + E2.h - E2.h * C2.y + F13;
          case "container":
          default:
            return A2.height - A2.height * C2.y + F13;
        }
      }
      r.layoutStyles = function(A2) {
        return s.syncOrAsync([o.doAutoMargin, b], A2);
      }, r.drawMainTitle = function(A2) {
        var S2 = A2._fullLayout, C2 = function(F13) {
          var N2 = F13.title, D2 = "middle";
          return s.isRightAnchor(N2) ? D2 = "end" : s.isLeftAnchor(N2) && (D2 = "start"), D2;
        }(S2), E2 = function(F13) {
          var N2 = F13.title, D2 = "0em";
          return s.isTopAnchor(N2) ? D2 = p.CAP_SHIFT + "em" : s.isMiddleAnchor(N2) && (D2 = p.MID_SHIFT + "em"), D2;
        }(S2);
        c.draw(A2, "gtitle", { propContainer: S2, propName: "title.text", placeholder: S2._dfltTitle.plot, attributes: { x: k(S2, C2), y: T2(S2, E2), "text-anchor": C2, dy: E2 } });
      }, r.doTraceStyle = function(A2) {
        var S2, C2 = A2.calcdata, E2 = [];
        for (S2 = 0; S2 < C2.length; S2++) {
          var F13 = C2[S2], N2 = F13[0] || {}, D2 = N2.trace || {}, I2 = D2._module || {}, O2 = I2.arraysToCalcdata;
          O2 && O2(F13, D2);
          var L2 = I2.editStyle;
          L2 && E2.push({ fn: L2, cd0: N2 });
        }
        if (E2.length) {
          for (S2 = 0; S2 < E2.length; S2++) {
            var V2 = E2[S2];
            V2.fn(A2, V2.cd0);
          }
          i(A2), r.redrawReglTraces(A2);
        }
        return o.style(A2), a.getComponentMethod("legend", "draw")(A2), o.previousPromises(A2);
      }, r.doColorBars = function(A2) {
        return a.getComponentMethod("colorbar", "draw")(A2), o.previousPromises(A2);
      }, r.layoutReplot = function(A2) {
        var S2 = A2.layout;
        return A2.layout = void 0, a.call("_doPlot", A2, "", S2);
      }, r.doLegend = function(A2) {
        return a.getComponentMethod("legend", "draw")(A2), o.previousPromises(A2);
      }, r.doTicksRelayout = function(A2) {
        return h.draw(A2, "redraw"), A2._fullLayout._hasOnlyLargeSploms && (a.subplotsRegistry.splom.updateGrid(A2), i(A2), r.redrawReglTraces(A2)), r.drawMainTitle(A2), o.previousPromises(A2);
      }, r.doModeBar = function(A2) {
        var S2 = A2._fullLayout;
        f.manage(A2);
        for (var C2 = 0; C2 < S2._basePlotModules.length; C2++) {
          var E2 = S2._basePlotModules[C2].updateFx;
          E2 && E2(A2);
        }
        return o.previousPromises(A2);
      }, r.doCamera = function(A2) {
        for (var S2 = A2._fullLayout, C2 = S2._subplots.gl3d, E2 = 0; E2 < C2.length; E2++) {
          var F13 = S2[C2[E2]];
          F13._scene.setViewport(F13);
        }
      }, r.drawData = function(A2) {
        var S2 = A2._fullLayout;
        i(A2);
        for (var C2 = S2._basePlotModules, E2 = 0; E2 < C2.length; E2++) C2[E2].plot(A2);
        return r.redrawReglTraces(A2), o.style(A2), a.getComponentMethod("shapes", "draw")(A2), a.getComponentMethod("annotations", "draw")(A2), a.getComponentMethod("images", "draw")(A2), S2._replotting = false, o.previousPromises(A2);
      }, r.redrawReglTraces = function(A2) {
        var S2 = A2._fullLayout;
        if (S2._has("regl")) {
          var C2, E2, F13 = A2._fullData, N2 = [], D2 = [];
          for (S2._hasOnlyLargeSploms && S2._splomGrid.draw(), C2 = 0; C2 < F13.length; C2++) {
            var I2 = F13[C2];
            I2.visible === true && I2._length !== 0 && (I2.type === "splom" ? S2._splomScenes[I2.uid].draw() : I2.type === "scattergl" ? s.pushUnique(N2, I2.xaxis + I2.yaxis) : I2.type === "scatterpolargl" && s.pushUnique(D2, I2.subplot));
          }
          for (C2 = 0; C2 < N2.length; C2++) (E2 = S2._plots[N2[C2]])._scene && E2._scene.draw();
          for (C2 = 0; C2 < D2.length; C2++) (E2 = S2[D2[C2]]._subplot)._scene && E2._scene.draw();
        }
      }, r.doAutoRangeAndConstraints = function(A2) {
        for (var S2, C2 = h.list(A2, "", true), E2 = {}, F13 = 0; F13 < C2.length; F13++) if (!E2[(S2 = C2[F13])._id]) {
          E2[S2._id] = 1, m(A2, S2), g(A2, S2);
          var N2 = S2._matchGroup;
          if (N2) for (var D2 in N2) {
            var I2 = h.getFromId(A2, D2);
            g(A2, I2, S2.range), E2[D2] = 1;
          }
        }
        v(A2);
      }, r.finalDraw = function(A2) {
        a.getComponentMethod("rangeslider", "draw")(A2), a.getComponentMethod("rangeselector", "draw")(A2);
      }, r.drawMarginPushers = function(A2) {
        a.getComponentMethod("legend", "draw")(A2), a.getComponentMethod("rangeselector", "draw")(A2), a.getComponentMethod("sliders", "draw")(A2), a.getComponentMethod("updatemenus", "draw")(A2), a.getComponentMethod("colorbar", "draw")(A2);
      };
    }, { "../components/color": 366, "../components/drawing": 388, "../components/modebar": 429, "../components/titles": 464, "../constants/alignment": 471, "../lib": 503, "../lib/clear_gl_canvases": 487, "../plots/cartesian/autorange": 553, "../plots/cartesian/axes": 554, "../plots/cartesian/constraints": 562, "../plots/plots": 619, "../registry": 638, "@plotly/d3": 58 }], 545: [function(e, t, r) {
      "use strict";
      var n = e("../lib"), a = n.isPlainObject, o = e("./plot_schema"), s = e("../plots/plots"), i = e("../plots/attributes"), l = e("./plot_template"), u2 = e("./plot_config").dfltConfig;
      function c(x, b) {
        x = n.extendDeep({}, x);
        var y, w, _4 = Object.keys(x).sort();
        function k(E2, F13, N2) {
          if (a(F13) && a(E2)) c(E2, F13);
          else if (Array.isArray(F13) && Array.isArray(E2)) {
            var D2 = l.arrayTemplater({ _template: x }, N2);
            for (w = 0; w < F13.length; w++) {
              var I2 = F13[w], O2 = D2.newItem(I2)._template;
              O2 && c(O2, I2);
            }
            var L2 = D2.defaultItems();
            for (w = 0; w < L2.length; w++) F13.push(L2[w]._template);
            for (w = 0; w < F13.length; w++) delete F13[w].templateitemname;
          }
        }
        for (y = 0; y < _4.length; y++) {
          var T2 = _4[y], A2 = x[T2];
          if (T2 in b ? k(A2, b[T2], T2) : b[T2] = A2, f(T2) === T2) for (var S2 in b) {
            var C2 = f(S2);
            S2 === C2 || C2 !== T2 || S2 in x || k(A2, b[S2], T2);
          }
        }
      }
      function f(x) {
        return x.replace(/[0-9]+$/, "");
      }
      function h(x, b, y, w, _4) {
        var k = _4 && y(_4);
        for (var T2 in x) {
          var A2 = x[T2], S2 = v(x, T2, w), C2 = v(x, T2, _4), E2 = y(C2);
          if (!E2) {
            var F13 = f(T2);
            F13 !== T2 && (E2 = y(C2 = v(x, F13, _4)));
          }
          if ((!k || k !== E2) && !(!E2 || E2._noTemplating || E2.valType === "data_array" || E2.arrayOk && Array.isArray(A2))) if (!E2.valType && a(A2)) h(A2, b, y, S2, C2);
          else if (E2._isLinkedToArray && Array.isArray(A2)) for (var N2 = false, D2 = 0, I2 = {}, O2 = 0; O2 < A2.length; O2++) {
            var L2 = A2[O2];
            if (a(L2)) {
              var V2 = L2.name;
              if (V2) I2[V2] || (h(L2, b, y, v(A2, D2, S2), v(A2, D2, C2)), D2++, I2[V2] = 1);
              else if (!N2) {
                var W2 = v(x, l.arrayDefaultKey(T2), w), X2 = v(A2, D2, S2);
                h(L2, b, y, X2, v(A2, D2, C2));
                var Y2 = n.nestedProperty(b, X2);
                n.nestedProperty(b, W2).set(Y2.get()), Y2.set(null), N2 = true;
              }
            }
          }
          else n.nestedProperty(b, S2).set(A2);
        }
      }
      function p(x, b) {
        return o.getLayoutValObject(x, n.nestedProperty({}, b).parts);
      }
      function d(x, b) {
        return o.getTraceValObject(x, n.nestedProperty({}, b).parts);
      }
      function v(x, b, y) {
        return y ? Array.isArray(x) ? y + "[" + b + "]" : y + "." + b : b;
      }
      function m(x) {
        for (var b = 0; b < x.length; b++) if (a(x[b])) return true;
      }
      function g(x) {
        var b;
        switch (x.code) {
          case "data":
            b = "The template has no key data.";
            break;
          case "layout":
            b = "The template has no key layout.";
            break;
          case "missing":
            b = x.path ? "There are no templates for item " + x.path + " with name " + x.templateitemname : "There are no templates for trace " + x.index + ", of type " + x.traceType + ".";
            break;
          case "unused":
            b = x.path ? "The template item at " + x.path + " was not used in constructing the plot." : x.dataCount ? "Some of the templates of type " + x.traceType + " were not used. The template has " + x.templateCount + " traces, the data only has " + x.dataCount + " of this type." : "The template has " + x.templateCount + " traces of type " + x.traceType + " but there are none in the data.";
            break;
          case "reused":
            b = "Some of the templates of type " + x.traceType + " were used more than once. The template has " + x.templateCount + " traces, the data has " + x.dataCount + " of this type.";
        }
        return x.msg = b, x;
      }
      r.makeTemplate = function(x) {
        x = n.isPlainObject(x) ? x : n.getGraphDiv(x), x = n.extendDeep({ _context: u2 }, { data: x.data, layout: x.layout }), s.supplyDefaults(x);
        var b = x.data || [], y = x.layout || {};
        y._basePlotModules = x._fullLayout._basePlotModules, y._modules = x._fullLayout._modules;
        var w = { data: {}, layout: {} };
        b.forEach(function(D2) {
          var I2 = {};
          h(D2, I2, d.bind(null, D2));
          var O2 = n.coerce(D2, {}, i, "type"), L2 = w.data[O2];
          L2 || (L2 = w.data[O2] = []), L2.push(I2);
        }), h(y, w.layout, p.bind(null, y)), delete w.layout.template;
        var _4 = y.template;
        if (a(_4)) {
          var k, T2, A2, S2, C2, E2, F13 = _4.layout;
          a(F13) && c(F13, w.layout);
          var N2 = _4.data;
          if (a(N2)) {
            for (T2 in w.data) if (A2 = N2[T2], Array.isArray(A2)) {
              for (E2 = (C2 = w.data[T2]).length, S2 = A2.length, k = 0; k < E2; k++) c(A2[k % S2], C2[k]);
              for (k = E2; k < S2; k++) C2.push(n.extendDeep({}, A2[k]));
            }
            for (T2 in N2) T2 in w.data || (w.data[T2] = n.extendDeep([], N2[T2]));
          }
        }
        return w;
      }, r.validateTemplate = function(x, b) {
        var y = n.extendDeep({}, { _context: u2, data: x.data, layout: x.layout }), w = y.layout || {};
        a(b) || (b = w.template || {});
        var _4 = b.layout, k = b.data, T2 = [];
        y.layout = w, y.layout.template = b, s.supplyDefaults(y);
        var A2 = y._fullLayout, S2 = y._fullData, C2 = {};
        if (a(_4) ? (function L2(V2, W2) {
          for (var X2 in V2) if (X2.charAt(0) !== "_" && a(V2[X2])) {
            var Y2, K2 = f(X2), q = [];
            for (Y2 = 0; Y2 < W2.length; Y2++) q.push(v(V2, X2, W2[Y2])), K2 !== X2 && q.push(v(V2, K2, W2[Y2]));
            for (Y2 = 0; Y2 < q.length; Y2++) C2[q[Y2]] = 1;
            L2(V2[X2], q);
          }
        }(A2, ["layout"]), function L2(V2, W2) {
          for (var X2 in V2) if (X2.indexOf("defaults") === -1 && a(V2[X2])) {
            var Y2 = v(V2, X2, W2);
            C2[Y2] ? L2(V2[X2], Y2) : T2.push({ code: "unused", path: Y2 });
          }
        }(_4, "layout")) : T2.push({ code: "layout" }), a(k)) {
          for (var E2, F13 = {}, N2 = 0; N2 < S2.length; N2++) {
            var D2 = S2[N2];
            F13[E2 = D2.type] = (F13[E2] || 0) + 1, D2._fullInput._template || T2.push({ code: "missing", index: D2._fullInput.index, traceType: E2 });
          }
          for (E2 in k) {
            var I2 = k[E2].length, O2 = F13[E2] || 0;
            I2 > O2 ? T2.push({ code: "unused", traceType: E2, templateCount: I2, dataCount: O2 }) : O2 > I2 && T2.push({ code: "reused", traceType: E2, templateCount: I2, dataCount: O2 });
          }
        } else T2.push({ code: "data" });
        if (function L2(V2, W2) {
          for (var X2 in V2) if (X2.charAt(0) !== "_") {
            var Y2 = V2[X2], K2 = v(V2, X2, W2);
            a(Y2) ? (Array.isArray(V2) && Y2._template === false && Y2.templateitemname && T2.push({ code: "missing", path: K2, templateitemname: Y2.templateitemname }), L2(Y2, K2)) : Array.isArray(Y2) && m(Y2) && L2(Y2, K2);
          }
        }({ data: S2, layout: A2 }, ""), T2.length) return T2.map(g);
      };
    }, { "../lib": 503, "../plots/attributes": 550, "../plots/plots": 619, "./plot_config": 541, "./plot_schema": 542, "./plot_template": 543 }], 546: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("./plot_api"), o = e("../plots/plots"), s = e("../lib"), i = e("../snapshot/helpers"), l = e("../snapshot/tosvg"), u2 = e("../snapshot/svgtoimg"), c = e("../version").version, f = { format: { valType: "enumerated", values: ["png", "jpeg", "webp", "svg", "full-json"], dflt: "png" }, width: { valType: "number", min: 1 }, height: { valType: "number", min: 1 }, scale: { valType: "number", min: 0, dflt: 1 }, setBackground: { valType: "any", dflt: false }, imageDataOnly: { valType: "boolean", dflt: false } };
      t.exports = function(h, p) {
        var d, v, m, g;
        function x(O2) {
          return !(O2 in p) || s.validate(p[O2], f[O2]);
        }
        if (p = p || {}, s.isPlainObject(h) ? (d = h.data || [], v = h.layout || {}, m = h.config || {}, g = {}) : (h = s.getGraphDiv(h), d = s.extendDeep([], h.data), v = s.extendDeep({}, h.layout), m = h._context, g = h._fullLayout || {}), !x("width") && p.width !== null || !x("height") && p.height !== null) throw new Error("Height and width should be pixel values.");
        if (!x("format")) throw new Error("Export format is not " + s.join2(f.format.values, ", ", " or ") + ".");
        var b = {};
        function y(O2, L2) {
          return s.coerce(p, b, f, O2, L2);
        }
        var w = y("format"), _4 = y("width"), k = y("height"), T2 = y("scale"), A2 = y("setBackground"), S2 = y("imageDataOnly"), C2 = document.createElement("div");
        C2.style.position = "absolute", C2.style.left = "-5000px", document.body.appendChild(C2);
        var E2 = s.extendFlat({}, v);
        _4 ? E2.width = _4 : p.width === null && n(g.width) && (E2.width = g.width), k ? E2.height = k : p.height === null && n(g.height) && (E2.height = g.height);
        var F13 = s.extendFlat({}, m, { _exportedPlot: true, staticPlot: true, setBackground: A2 }), N2 = i.getRedrawFunc(C2);
        function D2() {
          return new Promise(function(O2) {
            setTimeout(O2, i.getDelay(C2._fullLayout));
          });
        }
        function I2() {
          return new Promise(function(O2, L2) {
            var V2 = l(C2, w, T2), W2 = C2._fullLayout.width, X2 = C2._fullLayout.height;
            function Y2() {
              a.purge(C2), document.body.removeChild(C2);
            }
            if (w === "full-json") {
              var K2 = o.graphJson(C2, false, "keepdata", "object", true, true);
              return K2.version = c, K2 = JSON.stringify(K2), Y2(), O2(S2 ? K2 : i.encodeJSON(K2));
            }
            if (Y2(), w === "svg") return O2(S2 ? V2 : i.encodeSVG(V2));
            var q = document.createElement("canvas");
            q.id = s.randstr(), u2({ format: w, width: W2, height: X2, scale: T2, canvas: q, svg: V2, promise: true }).then(O2).catch(L2);
          });
        }
        return new Promise(function(O2, L2) {
          a.newPlot(C2, d, E2, F13).then(N2).then(D2).then(I2).then(function(V2) {
            O2(function(W2) {
              return S2 ? W2.replace(i.IMAGE_URL_PREFIX, "") : W2;
            }(V2));
          }).catch(function(V2) {
            L2(V2);
          });
        });
      };
    }, { "../lib": 503, "../plots/plots": 619, "../snapshot/helpers": 642, "../snapshot/svgtoimg": 644, "../snapshot/tosvg": 646, "../version": 1119, "./plot_api": 540, "fast-isnumeric": 190 }], 547: [function(e, t, r) {
      "use strict";
      var n = e("../lib"), a = e("../plots/plots"), o = e("./plot_schema"), s = e("./plot_config").dfltConfig, i = n.isPlainObject, l = Array.isArray, u2 = n.isArrayOrTypedArray;
      function c(b, y, w, _4, k, T2) {
        T2 = T2 || [];
        for (var A2 = Object.keys(b), S2 = 0; S2 < A2.length; S2++) {
          var C2 = A2[S2];
          if (C2 !== "transforms") {
            var E2 = T2.slice();
            E2.push(C2);
            var F13 = b[C2], N2 = y[C2], D2 = m(w, C2), I2 = (D2 || {}).valType, O2 = I2 === "info_array", L2 = I2 === "colorscale", V2 = (D2 || {}).items;
            if (v(w, C2)) if (i(F13) && i(N2) && I2 !== "any") c(F13, N2, D2, _4, k, E2);
            else if (O2 && l(F13)) {
              F13.length > N2.length && _4.push(d("unused", k, E2.concat(N2.length)));
              var W2, X2, Y2, K2, q, re = N2.length, R2 = Array.isArray(V2);
              if (R2 && (re = Math.min(re, V2.length)), D2.dimensions === 2) for (X2 = 0; X2 < re; X2++) if (l(F13[X2])) {
                F13[X2].length > N2[X2].length && _4.push(d("unused", k, E2.concat(X2, N2[X2].length)));
                var z = N2[X2].length;
                for (W2 = 0; W2 < (R2 ? Math.min(z, V2[X2].length) : z); W2++) Y2 = R2 ? V2[X2][W2] : V2, K2 = F13[X2][W2], q = N2[X2][W2], n.validate(K2, Y2) ? q !== K2 && q !== +K2 && _4.push(d("dynamic", k, E2.concat(X2, W2), K2, q)) : _4.push(d("value", k, E2.concat(X2, W2), K2));
              } else _4.push(d("array", k, E2.concat(X2), F13[X2]));
              else for (X2 = 0; X2 < re; X2++) Y2 = R2 ? V2[X2] : V2, K2 = F13[X2], q = N2[X2], n.validate(K2, Y2) ? q !== K2 && q !== +K2 && _4.push(d("dynamic", k, E2.concat(X2), K2, q)) : _4.push(d("value", k, E2.concat(X2), K2));
            } else if (D2.items && !O2 && l(F13)) {
              var H2, te, j = V2[Object.keys(V2)[0]], Q2 = [];
              for (H2 = 0; H2 < N2.length; H2++) {
                var Z2 = N2[H2]._index || H2;
                if ((te = E2.slice()).push(Z2), i(F13[Z2]) && i(N2[H2])) {
                  Q2.push(Z2);
                  var ne = F13[Z2], ae = N2[H2];
                  i(ne) && ne.visible !== false && ae.visible === false ? _4.push(d("invisible", k, te)) : c(ne, ae, j, _4, k, te);
                }
              }
              for (H2 = 0; H2 < F13.length; H2++) (te = E2.slice()).push(H2), i(F13[H2]) ? Q2.indexOf(H2) === -1 && _4.push(d("unused", k, te)) : _4.push(d("object", k, te, F13[H2]));
            } else !i(F13) && i(N2) ? _4.push(d("object", k, E2, F13)) : u2(F13) || !u2(N2) || O2 || L2 ? C2 in y ? n.validate(F13, D2) ? D2.valType === "enumerated" && (D2.coerceNumber && F13 !== +N2 || F13 !== N2) && _4.push(d("dynamic", k, E2, F13, N2)) : _4.push(d("value", k, E2, F13)) : _4.push(d("unused", k, E2, F13)) : _4.push(d("array", k, E2, F13));
            else _4.push(d("schema", k, E2));
          }
        }
        return _4;
      }
      function f(b, y) {
        for (var w = b.layout.layoutAttributes, _4 = 0; _4 < y.length; _4++) {
          var k = y[_4], T2 = b.traces[k.type], A2 = T2.layoutAttributes;
          A2 && (k.subplot ? n.extendFlat(w[T2.attributes.subplot.dflt], A2) : n.extendFlat(w, A2));
        }
        return w;
      }
      t.exports = function(b, y) {
        b === void 0 && (b = []), y === void 0 && (y = {});
        var w, _4, k = o.get(), T2 = [], A2 = { _context: n.extendFlat({}, s) };
        l(b) ? (A2.data = n.extendDeep([], b), w = b) : (A2.data = [], w = [], T2.push(d("array", "data"))), i(y) ? (A2.layout = n.extendDeep({}, y), _4 = y) : (A2.layout = {}, _4 = {}, arguments.length > 1 && T2.push(d("object", "layout"))), a.supplyDefaults(A2);
        for (var S2 = A2._fullData, C2 = w.length, E2 = 0; E2 < C2; E2++) {
          var F13 = w[E2], N2 = ["data", E2];
          if (i(F13)) {
            var D2 = S2[E2], I2 = D2.type, O2 = k.traces[I2].attributes;
            O2.type = { valType: "enumerated", values: [I2] }, D2.visible === false && F13.visible !== false && T2.push(d("invisible", N2)), c(F13, D2, O2, T2, N2);
            var L2 = F13.transforms, V2 = D2.transforms;
            if (L2) {
              l(L2) || T2.push(d("array", N2, ["transforms"])), N2.push("transforms");
              for (var W2 = 0; W2 < L2.length; W2++) {
                var X2 = ["transforms", W2], Y2 = L2[W2].type;
                if (i(L2[W2])) {
                  var K2 = k.transforms[Y2] ? k.transforms[Y2].attributes : {};
                  K2.type = { valType: "enumerated", values: Object.keys(k.transforms) }, c(L2[W2], V2[W2], K2, T2, N2, X2);
                } else T2.push(d("object", N2, X2));
              }
            }
          } else T2.push(d("object", N2));
        }
        var q = A2._fullLayout, re = f(k, S2);
        return c(_4, q, re, T2, "layout"), T2.length === 0 ? void 0 : T2;
      };
      var h = { object: function(b, y) {
        return (b === "layout" && y === "" ? "The layout argument" : b[0] === "data" && y === "" ? "Trace " + b[1] + " in the data argument" : p(b) + "key " + y) + " must be linked to an object container";
      }, array: function(b, y) {
        return (b === "data" ? "The data argument" : p(b) + "key " + y) + " must be linked to an array container";
      }, schema: function(b, y) {
        return p(b) + "key " + y + " is not part of the schema";
      }, unused: function(b, y, w) {
        var _4 = i(w) ? "container" : "key";
        return p(b) + _4 + " " + y + " did not get coerced";
      }, dynamic: function(b, y, w, _4) {
        return [p(b) + "key", y, "(set to '" + w + "')", "got reset to", "'" + _4 + "'", "during defaults."].join(" ");
      }, invisible: function(b, y) {
        return (y ? p(b) + "item " + y : "Trace " + b[1]) + " got defaulted to be not visible";
      }, value: function(b, y, w) {
        return [p(b) + "key " + y, "is set to an invalid value (" + w + ")"].join(" ");
      } };
      function p(b) {
        return l(b) ? "In data trace " + b[1] + ", " : "In " + b + ", ";
      }
      function d(b, y, w, _4, k) {
        var T2, A2;
        w = w || "", l(y) ? (T2 = y[0], A2 = y[1]) : (T2 = y, A2 = null);
        var S2 = function(E2) {
          if (!l(E2)) return String(E2);
          for (var F13 = "", N2 = 0; N2 < E2.length; N2++) {
            var D2 = E2[N2];
            typeof D2 == "number" ? F13 = F13.substr(0, F13.length - 1) + "[" + D2 + "]" : F13 += D2, N2 < E2.length - 1 && (F13 += ".");
          }
          return F13;
        }(w), C2 = h[b](y, S2, _4, k);
        return n.log(C2), { code: b, container: T2, trace: A2, path: w, astr: S2, msg: C2 };
      }
      function v(b, y) {
        var w = x(y), _4 = w.keyMinusId, k = w.id;
        return !!(_4 in b && b[_4]._isSubplotObj && k) || y in b;
      }
      function m(b, y) {
        return y in b ? b[y] : b[x(y).keyMinusId];
      }
      var g = n.counterRegex("([a-z]+)");
      function x(b) {
        var y = b.match(g);
        return { keyMinusId: y && y[1], id: y && y[2] };
      }
    }, { "../lib": 503, "../plots/plots": 619, "./plot_config": 541, "./plot_schema": 542 }], 548: [function(e, t, r) {
      "use strict";
      t.exports = { mode: { valType: "enumerated", dflt: "afterall", values: ["immediate", "next", "afterall"] }, direction: { valType: "enumerated", values: ["forward", "reverse"], dflt: "forward" }, fromcurrent: { valType: "boolean", dflt: false }, frame: { duration: { valType: "number", min: 0, dflt: 500 }, redraw: { valType: "boolean", dflt: true } }, transition: { duration: { valType: "number", min: 0, dflt: 500, editType: "none" }, easing: { valType: "enumerated", dflt: "cubic-in-out", values: ["linear", "quad", "cubic", "sin", "exp", "circle", "elastic", "back", "bounce", "linear-in", "quad-in", "cubic-in", "sin-in", "exp-in", "circle-in", "elastic-in", "back-in", "bounce-in", "linear-out", "quad-out", "cubic-out", "sin-out", "exp-out", "circle-out", "elastic-out", "back-out", "bounce-out", "linear-in-out", "quad-in-out", "cubic-in-out", "sin-in-out", "exp-in-out", "circle-in-out", "elastic-in-out", "back-in-out", "bounce-in-out"], editType: "none" }, ordering: { valType: "enumerated", values: ["layout first", "traces first"], dflt: "layout first", editType: "none" } } };
    }, {}], 549: [function(e, t, r) {
      "use strict";
      var n = e("../lib"), a = e("../plot_api/plot_template");
      t.exports = function(o, s, i) {
        var l, u2, c = i.name, f = i.inclusionAttr || "visible", h = s[c], p = n.isArrayOrTypedArray(o[c]) ? o[c] : [], d = s[c] = [], v = a.arrayTemplater(s, c, f);
        for (l = 0; l < p.length; l++) {
          var m = p[l];
          n.isPlainObject(m) ? u2 = v.newItem(m) : (u2 = v.newItem({}))[f] = false, u2._index = l, u2[f] !== false && i.handleItemDefaults(m, u2, s, i), d.push(u2);
        }
        var g = v.defaultItems();
        for (l = 0; l < g.length; l++) (u2 = g[l])._index = d.length, i.handleItemDefaults({}, u2, s, i, {}), d.push(u2);
        if (n.isArrayOrTypedArray(h)) {
          var x = Math.min(h.length, d.length);
          for (l = 0; l < x; l++) n.relinkPrivateKeys(d[l], h[l]);
        }
        return d;
      };
    }, { "../lib": 503, "../plot_api/plot_template": 543 }], 550: [function(e, t, r) {
      "use strict";
      var n = e("./font_attributes"), a = e("../components/fx/attributes");
      t.exports = { type: { valType: "enumerated", values: [], dflt: "scatter", editType: "calc+clearAxisTypes", _noTemplating: true }, visible: { valType: "enumerated", values: [true, false, "legendonly"], dflt: true, editType: "calc" }, showlegend: { valType: "boolean", dflt: true, editType: "style" }, legendgroup: { valType: "string", dflt: "", editType: "style" }, legendgrouptitle: { text: { valType: "string", dflt: "", editType: "style" }, font: n({ editType: "style" }), editType: "style" }, legendrank: { valType: "number", dflt: 1e3, editType: "style" }, opacity: { valType: "number", min: 0, max: 1, dflt: 1, editType: "style" }, name: { valType: "string", editType: "style" }, uid: { valType: "string", editType: "plot", anim: true }, ids: { valType: "data_array", editType: "calc", anim: true }, customdata: { valType: "data_array", editType: "calc" }, meta: { valType: "any", arrayOk: true, editType: "plot" }, selectedpoints: { valType: "any", editType: "calc" }, hoverinfo: { valType: "flaglist", flags: ["x", "y", "z", "text", "name"], extras: ["all", "none", "skip"], arrayOk: true, dflt: "all", editType: "none" }, hoverlabel: a.hoverlabel, stream: { token: { valType: "string", noBlank: true, strict: true, editType: "calc" }, maxpoints: { valType: "number", min: 0, max: 1e4, dflt: 500, editType: "calc" }, editType: "calc" }, transforms: { _isLinkedToArray: "transform", editType: "calc" }, uirevision: { valType: "any", editType: "none" } };
    }, { "../components/fx/attributes": 397, "./font_attributes": 585 }], 551: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("../../lib"), o = a.dateTime2ms, s = a.incrementMonth, i = e("../../constants/numerical").ONEAVGMONTH;
      t.exports = function(l, u2, c, f) {
        if (u2.type !== "date") return { vals: f };
        var h = l[c + "periodalignment"];
        if (!h) return { vals: f };
        var p, d = l[c + "period"];
        if (n(d)) {
          if ((d = +d) <= 0) return { vals: f };
        } else if (typeof d == "string" && d.charAt(0) === "M") {
          var v = +d.substring(1);
          if (!(v > 0 && Math.round(v) === v)) return { vals: f };
          p = v;
        }
        for (var m = u2.calendar, g = h === "start", x = h === "end", b = l[c + "period0"], y = o(b, m) || 0, w = [], _4 = [], k = [], T2 = f.length, A2 = 0; A2 < T2; A2++) {
          var S2, C2, E2, F13 = f[A2];
          if (p) {
            for (S2 = Math.round((F13 - y) / (p * i)), E2 = s(y, p * S2, m); E2 > F13; ) E2 = s(E2, -p, m);
            for (; E2 <= F13; ) E2 = s(E2, p, m);
            C2 = s(E2, -p, m);
          } else {
            for (E2 = y + (S2 = Math.round((F13 - y) / d)) * d; E2 > F13; ) E2 -= d;
            for (; E2 <= F13; ) E2 += d;
            C2 = E2 - d;
          }
          w[A2] = g ? C2 : x ? E2 : (C2 + E2) / 2, _4[A2] = C2, k[A2] = E2;
        }
        return { vals: w, starts: _4, ends: k };
      };
    }, { "../../constants/numerical": 479, "../../lib": 503, "fast-isnumeric": 190 }], 552: [function(e, t, r) {
      "use strict";
      t.exports = { xaxis: { valType: "subplotid", dflt: "x", editType: "calc+clearAxisTypes" }, yaxis: { valType: "subplotid", dflt: "y", editType: "calc+clearAxisTypes" } };
    }, {}], 553: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("fast-isnumeric"), o = e("../../lib"), s = e("../../constants/numerical").FP_SAFE, i = e("../../registry"), l = e("../../components/drawing"), u2 = e("./axis_ids"), c = u2.getFromId, f = u2.isLinked;
      function h(_4, k) {
        var T2, A2, S2 = [], C2 = _4._fullLayout, E2 = d(C2, k, 0), F13 = d(C2, k, 1), N2 = v(_4, k), D2 = N2.min, I2 = N2.max;
        if (D2.length === 0 || I2.length === 0) return o.simpleMap(k.range, k.r2l);
        var O2 = D2[0].val, L2 = I2[0].val;
        for (T2 = 1; T2 < D2.length && O2 === L2; T2++) O2 = Math.min(O2, D2[T2].val);
        for (T2 = 1; T2 < I2.length && O2 === L2; T2++) L2 = Math.max(L2, I2[T2].val);
        var V2 = false;
        if (k.range) {
          var W2 = o.simpleMap(k.range, k.r2l);
          V2 = W2[1] < W2[0];
        }
        k.autorange === "reversed" && (V2 = true, k.autorange = true);
        var X2, Y2, K2, q, re, R2, z = k.rangemode, H2 = z === "tozero", te = z === "nonnegative", j = k._length, Q2 = j / 10, Z2 = 0;
        for (T2 = 0; T2 < D2.length; T2++) for (X2 = D2[T2], A2 = 0; A2 < I2.length; A2++) (R2 = (Y2 = I2[A2]).val - X2.val - p(k, X2.val, Y2.val)) > 0 && ((re = j - E2(X2) - F13(Y2)) > Q2 ? R2 / re > Z2 && (K2 = X2, q = Y2, Z2 = R2 / re) : R2 / j > Z2 && (K2 = { val: X2.val, nopad: 1 }, q = { val: Y2.val, nopad: 1 }, Z2 = R2 / j));
        if (O2 === L2) {
          var ne = O2 - 1, ae = O2 + 1;
          if (H2) if (O2 === 0) S2 = [0, 1];
          else {
            var ue = (O2 > 0 ? I2 : D2).reduce(function(ce, se) {
              return Math.max(ce, F13(se));
            }, 0), le = O2 / (1 - Math.min(0.5, ue / j));
            S2 = O2 > 0 ? [0, le] : [le, 0];
          }
          else S2 = te ? [Math.max(0, ne), Math.max(1, ae)] : [ne, ae];
        } else H2 ? (K2.val >= 0 && (K2 = { val: 0, nopad: 1 }), q.val <= 0 && (q = { val: 0, nopad: 1 })) : te && (K2.val - Z2 * E2(K2) < 0 && (K2 = { val: 0, nopad: 1 }), q.val <= 0 && (q = { val: 1, nopad: 1 })), Z2 = (q.val - K2.val - p(k, X2.val, Y2.val)) / (j - E2(K2) - F13(q)), S2 = [K2.val - Z2 * E2(K2), q.val + Z2 * F13(q)];
        return V2 && S2.reverse(), o.simpleMap(S2, k.l2r || Number);
      }
      function p(_4, k, T2) {
        var A2 = 0;
        if (_4.rangebreaks) for (var S2 = _4.locateBreaks(k, T2), C2 = 0; C2 < S2.length; C2++) {
          var E2 = S2[C2];
          A2 += E2.max - E2.min;
        }
        return A2;
      }
      function d(_4, k, T2) {
        var A2 = 0.05 * k._length, S2 = k._anchorAxis || {};
        if ((k.ticklabelposition || "").indexOf("inside") !== -1 || (S2.ticklabelposition || "").indexOf("inside") !== -1) {
          var C2 = k.autorange === "reversed";
          if (!C2) {
            var E2 = o.simpleMap(k.range, k.r2l);
            C2 = E2[1] < E2[0];
          }
          C2 && (T2 = !T2);
        }
        var F13 = 0;
        return f(_4, k._id) || (F13 = function(N2, D2, I2) {
          var O2 = 0, L2 = D2._id.charAt(0) === "x";
          for (var V2 in N2._plots) {
            var W2 = N2._plots[V2];
            if (D2._id === W2.xaxis._id || D2._id === W2.yaxis._id) {
              var X2 = (L2 ? W2.yaxis : W2.xaxis) || {};
              if ((X2.ticklabelposition || "").indexOf("inside") !== -1 && (!I2 && (X2.side === "left" || X2.side === "bottom") || I2 && (X2.side === "top" || X2.side === "right"))) {
                if (X2._vals) {
                  var Y2 = o.deg2rad(X2._tickAngles[X2._id + "tick"] || 0), K2 = Math.abs(Math.cos(Y2)), q = Math.abs(Math.sin(Y2));
                  if (!X2._vals[0].bb) {
                    var re = X2._id + "tick";
                    X2._selections[re].each(function(j) {
                      var Q2 = n.select(this);
                      Q2.select(".text-math-group").empty() && (j.bb = l.bBox(Q2.node()));
                    });
                  }
                  for (var R2 = 0; R2 < X2._vals.length; R2++) {
                    var z = X2._vals[R2].bb;
                    if (z) {
                      var H2 = 6 + z.width, te = 6 + z.height;
                      O2 = Math.max(O2, L2 ? Math.max(H2 * K2, te * q) : Math.max(te * K2, H2 * q));
                    }
                  }
                }
                X2.ticks === "inside" && X2.ticklabelposition === "inside" && (O2 += X2.ticklen || 0);
              }
            }
          }
          return O2;
        }(_4, k, T2)), A2 = Math.max(F13, A2), k.constrain === "domain" && k._inputDomain && (A2 *= (k._inputDomain[1] - k._inputDomain[0]) / (k.domain[1] - k.domain[0])), function(N2) {
          return N2.nopad ? 0 : N2.pad + (N2.extrapad ? A2 : F13);
        };
      }
      t.exports = { getAutoRange: h, makePadFn: d, doAutoRange: function(_4, k, T2) {
        if (k.setScale(), k.autorange) {
          k.range = T2 ? T2.slice() : h(_4, k), k._r = k.range.slice(), k._rl = o.simpleMap(k._r, k.r2l);
          var A2 = k._input, S2 = {};
          S2[k._attr + ".range"] = k.range, S2[k._attr + ".autorange"] = k.autorange, i.call("_storeDirectGUIEdit", _4.layout, _4._fullLayout._preGUI, S2), A2.range = k.range.slice(), A2.autorange = k.autorange;
        }
        var C2 = k._anchorAxis;
        if (C2 && C2.rangeslider) {
          var E2 = C2.rangeslider[k._name];
          E2 && E2.rangemode === "auto" && (E2.range = h(_4, k)), C2._input.rangeslider[k._name] = o.extendFlat({}, E2);
        }
      }, findExtremes: function(_4, k, T2) {
        T2 || (T2 = {}), _4._m || _4.setScale();
        var A2, S2, C2, E2, F13, N2, D2, I2, O2, L2 = [], V2 = [], W2 = k.length, X2 = T2.padded || false, Y2 = T2.tozero && (_4.type === "linear" || _4.type === "-"), K2 = _4.type === "log", q = false, re = T2.vpadLinearized || false;
        function R2(ae) {
          if (Array.isArray(ae)) return q = true, function(le) {
            return Math.max(Number(ae[le] || 0), 0);
          };
          var ue = Math.max(Number(ae || 0), 0);
          return function() {
            return ue;
          };
        }
        var z = R2((_4._m > 0 ? T2.ppadplus : T2.ppadminus) || T2.ppad || 0), H2 = R2((_4._m > 0 ? T2.ppadminus : T2.ppadplus) || T2.ppad || 0), te = R2(T2.vpadplus || T2.vpad), j = R2(T2.vpadminus || T2.vpad);
        if (!q) {
          if (I2 = 1 / 0, O2 = -1 / 0, K2) for (A2 = 0; A2 < W2; A2++) (S2 = k[A2]) < I2 && S2 > 0 && (I2 = S2), S2 > O2 && S2 < s && (O2 = S2);
          else for (A2 = 0; A2 < W2; A2++) (S2 = k[A2]) < I2 && S2 > -s && (I2 = S2), S2 > O2 && S2 < s && (O2 = S2);
          k = [I2, O2], W2 = 2;
        }
        var Q2 = { tozero: Y2, extrapad: X2 };
        function Z2(ae) {
          C2 = k[ae], a(C2) && (N2 = z(ae), D2 = H2(ae), re ? (E2 = _4.c2l(C2) - j(ae), F13 = _4.c2l(C2) + te(ae)) : (I2 = C2 - j(ae), O2 = C2 + te(ae), K2 && I2 < O2 / 10 && (I2 = O2 / 10), E2 = _4.c2l(I2), F13 = _4.c2l(O2)), Y2 && (E2 = Math.min(0, E2), F13 = Math.max(0, F13)), b(E2) && m(L2, E2, D2, Q2), b(F13) && g(V2, F13, N2, Q2));
        }
        var ne = Math.min(6, W2);
        for (A2 = 0; A2 < ne; A2++) Z2(A2);
        for (A2 = W2 - 1; A2 >= ne; A2--) Z2(A2);
        return { min: L2, max: V2, opts: T2 };
      }, concatExtremes: v };
      function v(_4, k, T2) {
        var A2, S2, C2, E2 = k._id, F13 = _4._fullData, N2 = _4._fullLayout, D2 = [], I2 = [];
        function O2(Y2, K2) {
          for (A2 = 0; A2 < K2.length; A2++) {
            var q = Y2[K2[A2]], re = (q._extremes || {})[E2];
            if (q.visible === true && re) {
              for (S2 = 0; S2 < re.min.length; S2++) C2 = re.min[S2], m(D2, C2.val, C2.pad, { extrapad: C2.extrapad });
              for (S2 = 0; S2 < re.max.length; S2++) C2 = re.max[S2], g(I2, C2.val, C2.pad, { extrapad: C2.extrapad });
            }
          }
        }
        if (O2(F13, k._traceIndices), O2(N2.annotations || [], k._annIndices || []), O2(N2.shapes || [], k._shapeIndices || []), k._matchGroup && !T2) {
          for (var L2 in k._matchGroup) if (L2 !== k._id) {
            var V2 = c(_4, L2), W2 = v(_4, V2, true), X2 = k._length / V2._length;
            for (S2 = 0; S2 < W2.min.length; S2++) C2 = W2.min[S2], m(D2, C2.val, C2.pad * X2, { extrapad: C2.extrapad });
            for (S2 = 0; S2 < W2.max.length; S2++) C2 = W2.max[S2], g(I2, C2.val, C2.pad * X2, { extrapad: C2.extrapad });
          }
        }
        return { min: D2, max: I2 };
      }
      function m(_4, k, T2, A2) {
        x(_4, k, T2, A2, y);
      }
      function g(_4, k, T2, A2) {
        x(_4, k, T2, A2, w);
      }
      function x(_4, k, T2, A2, S2) {
        for (var C2 = A2.tozero, E2 = A2.extrapad, F13 = true, N2 = 0; N2 < _4.length && F13; N2++) {
          var D2 = _4[N2];
          if (S2(D2.val, k) && D2.pad >= T2 && (D2.extrapad || !E2)) {
            F13 = false;
            break;
          }
          S2(k, D2.val) && D2.pad <= T2 && (E2 || !D2.extrapad) && (_4.splice(N2, 1), N2--);
        }
        if (F13) {
          var I2 = C2 && k === 0;
          _4.push({ val: k, pad: I2 ? 0 : T2, extrapad: !I2 && E2 });
        }
      }
      function b(_4) {
        return a(_4) && Math.abs(_4) < s;
      }
      function y(_4, k) {
        return _4 <= k;
      }
      function w(_4, k) {
        return _4 >= k;
      }
    }, { "../../components/drawing": 388, "../../constants/numerical": 479, "../../lib": 503, "../../registry": 638, "./axis_ids": 558, "@plotly/d3": 58, "fast-isnumeric": 190 }], 554: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("fast-isnumeric"), o = e("../../plots/plots"), s = e("../../registry"), i = e("../../lib"), l = i.strTranslate, u2 = e("../../lib/svg_text_utils"), c = e("../../components/titles"), f = e("../../components/color"), h = e("../../components/drawing"), p = e("./layout_attributes"), d = e("./clean_ticks"), v = e("../../constants/numerical"), m = v.ONEMAXYEAR, g = v.ONEAVGYEAR, x = v.ONEMINYEAR, b = v.ONEMAXQUARTER, y = v.ONEAVGQUARTER, w = v.ONEMINQUARTER, _4 = v.ONEMAXMONTH, k = v.ONEAVGMONTH, T2 = v.ONEMINMONTH, A2 = v.ONEWEEK, S2 = v.ONEDAY, C2 = S2 / 2, E2 = v.ONEHOUR, F13 = v.ONEMIN, N2 = v.ONESEC, D2 = v.MINUS_SIGN, I2 = v.BADNUM, O2 = { K: "zeroline" }, L2 = { K: "gridline", L: "path" }, V2 = { K: "tick", L: "path" }, W2 = { K: "tick", L: "text" }, X2 = e("../../constants/alignment"), Y2 = X2.MID_SHIFT, K2 = X2.CAP_SHIFT, q = X2.LINE_SPACING, re = X2.OPPOSITE_SIDE, R2 = t.exports = {};
      R2.setConvert = e("./set_convert");
      var z = e("./axis_autotype"), H2 = e("./axis_ids"), te = H2.idSort, j = H2.isLinked;
      R2.id2name = H2.id2name, R2.name2id = H2.name2id, R2.cleanId = H2.cleanId, R2.list = H2.list, R2.listIds = H2.listIds, R2.getFromId = H2.getFromId, R2.getFromTrace = H2.getFromTrace;
      var Q2 = e("./autorange");
      R2.getAutoRange = Q2.getAutoRange, R2.findExtremes = Q2.findExtremes;
      function Z2(Ye) {
        var at = 1e-4 * (Ye[1] - Ye[0]);
        return [Ye[0] - at, Ye[1] + at];
      }
      R2.coerceRef = function(Ye, at, Ge, st, Ie, Pe) {
        var $e = st.charAt(st.length - 1), Ve = Ge._fullLayout._subplots[$e + "axis"], ut = st + "ref", Re = {};
        return Ie || (Ie = Ve[0] || (typeof Pe == "string" ? Pe : Pe[0])), Pe || (Pe = Ie), Ve = Ve.concat(Ve.map(function(qe) {
          return qe + " domain";
        })), Re[ut] = { valType: "enumerated", values: Ve.concat(Pe ? typeof Pe == "string" ? [Pe] : Pe : []), dflt: Ie }, i.coerce(Ye, at, Re, ut);
      }, R2.getRefType = function(Ye) {
        return Ye === void 0 ? Ye : Ye === "paper" ? "paper" : Ye === "pixel" ? "pixel" : /( domain)$/.test(Ye) ? "domain" : "range";
      }, R2.coercePosition = function(Ye, at, Ge, st, Ie, Pe) {
        var $e, Ve;
        if (R2.getRefType(st) !== "range") $e = i.ensureNumber, Ve = Ge(Ie, Pe);
        else {
          var ut = R2.getFromId(at, st);
          Ve = Ge(Ie, Pe = ut.fraction2r(Pe)), $e = ut.cleanPos;
        }
        Ye[Ie] = $e(Ve);
      }, R2.cleanPosition = function(Ye, at, Ge) {
        return (Ge === "paper" || Ge === "pixel" ? i.ensureNumber : R2.getFromId(at, Ge).cleanPos)(Ye);
      }, R2.redrawComponents = function(Ye, at) {
        at = at || R2.listIds(Ye);
        var Ge = Ye._fullLayout;
        function st(Ie, Pe, $e, Ve) {
          for (var ut = s.getComponentMethod(Ie, Pe), Re = {}, qe = 0; qe < at.length; qe++) for (var je = Ge[R2.id2name(at[qe])][$e], rt = 0; rt < je.length; rt++) {
            var He = je[rt];
            if (!Re[He] && (ut(Ye, He), Re[He] = 1, Ve)) return;
          }
        }
        st("annotations", "drawOne", "_annIndices"), st("shapes", "drawOne", "_shapeIndices"), st("images", "draw", "_imgIndices", true);
      };
      var ne = R2.getDataConversions = function(Ye, at, Ge, st) {
        var Ie, Pe = Ge === "x" || Ge === "y" || Ge === "z" ? Ge : st;
        if (Array.isArray(Pe)) {
          if (Ie = { type: z(st, void 0, { autotypenumbers: Ye._fullLayout.autotypenumbers }), _categories: [] }, R2.setConvert(Ie), Ie.type === "category") for (var $e = 0; $e < st.length; $e++) Ie.d2c(st[$e]);
        } else Ie = R2.getFromTrace(Ye, at, Pe);
        return Ie ? { d2c: Ie.d2c, c2d: Ie.c2d } : Pe === "ids" ? { d2c: ue, c2d: ue } : { d2c: ae, c2d: ae };
      };
      function ae(Ye) {
        return +Ye;
      }
      function ue(Ye) {
        return String(Ye);
      }
      function le(Ye) {
        return +Ye.substring(1);
      }
      R2.getDataToCoordFunc = function(Ye, at, Ge, st) {
        return ne(Ye, at, Ge, st).d2c;
      }, R2.counterLetter = function(Ye) {
        var at = Ye.charAt(0);
        return at === "x" ? "y" : at === "y" ? "x" : void 0;
      }, R2.minDtick = function(Ye, at, Ge, st) {
        ["log", "category", "multicategory"].indexOf(Ye.type) === -1 && st ? Ye._minDtick === void 0 ? (Ye._minDtick = at, Ye._forceTick0 = Ge) : Ye._minDtick && ((Ye._minDtick / at + 1e-6) % 1 < 2e-6 && ((Ge - Ye._forceTick0) / at % 1 + 1.000001) % 1 < 2e-6 ? (Ye._minDtick = at, Ye._forceTick0 = Ge) : ((at / Ye._minDtick + 1e-6) % 1 > 2e-6 || ((Ge - Ye._forceTick0) / Ye._minDtick % 1 + 1.000001) % 1 > 2e-6) && (Ye._minDtick = 0)) : Ye._minDtick = 0;
      }, R2.saveRangeInitial = function(Ye, at) {
        for (var Ge = R2.list(Ye, "", true), st = false, Ie = 0; Ie < Ge.length; Ie++) {
          var Pe = Ge[Ie], $e = Pe._rangeInitial === void 0, Ve = $e || !(Pe.range[0] === Pe._rangeInitial[0] && Pe.range[1] === Pe._rangeInitial[1]);
          ($e && Pe.autorange === false || at && Ve) && (Pe._rangeInitial = Pe.range.slice(), st = true);
        }
        return st;
      }, R2.saveShowSpikeInitial = function(Ye, at) {
        for (var Ge = R2.list(Ye, "", true), st = false, Ie = "on", Pe = 0; Pe < Ge.length; Pe++) {
          var $e = Ge[Pe], Ve = $e._showSpikeInitial === void 0, ut = Ve || $e.showspikes !== $e._showspikes;
          (Ve || at && ut) && ($e._showSpikeInitial = $e.showspikes, st = true), Ie !== "on" || $e.showspikes || (Ie = "off");
        }
        return Ye._fullLayout._cartesianSpikesEnabled = Ie, st;
      }, R2.autoBin = function(Ye, at, Ge, st, Ie, Pe) {
        var $e, Ve = i.aggNums(Math.min, null, Ye), ut = i.aggNums(Math.max, null, Ye);
        if (at.type === "category" || at.type === "multicategory") return { start: Ve - 0.5, end: ut + 0.5, size: Math.max(1, Math.round(Pe) || 1), _dataSpan: ut - Ve };
        if (Ie || (Ie = at.calendar), $e = at.type === "log" ? { type: "linear", range: [Ve, ut] } : { type: at.type, range: i.simpleMap([Ve, ut], at.c2r, 0, Ie), calendar: Ie }, R2.setConvert($e), Pe = Pe && d.dtick(Pe, $e.type)) $e.dtick = Pe, $e.tick0 = d.tick0(void 0, $e.type, Ie);
        else {
          var Re;
          if (Ge) Re = (ut - Ve) / Ge;
          else {
            var qe = i.distinctVals(Ye), je = Math.pow(10, Math.floor(Math.log(qe.minDiff) / Math.LN10)), rt = je * i.roundUp(qe.minDiff / je, [0.9, 1.9, 4.9, 9.9], true);
            Re = Math.max(rt, 2 * i.stdev(Ye) / Math.pow(Ye.length, st ? 0.25 : 0.4)), a(Re) || (Re = 1);
          }
          R2.autoTicks($e, Re);
        }
        var He, xe = $e.dtick, Ne = R2.tickIncrement(R2.tickFirst($e), xe, "reverse", Ie);
        if (typeof xe == "number") He = (Ne = function(ke, Me, Le, ze, ft) {
          var De = 0, Je = 0, tt = 0, vt = 0;
          function kt(rr) {
            return (1 + 100 * (rr - ke) / Le.dtick) % 100 < 2;
          }
          for (var jt = 0; jt < Me.length; jt++) Me[jt] % 1 == 0 ? tt++ : a(Me[jt]) || vt++, kt(Me[jt]) && De++, kt(Me[jt] + Le.dtick / 2) && Je++;
          var Vt = Me.length - vt;
          if (tt === Vt && Le.type !== "date") Le.dtick < 1 ? ke = ze - 0.5 * Le.dtick : (ke -= 0.5) + Le.dtick < ze && (ke += Le.dtick);
          else if (Je < 0.1 * Vt && (De > 0.3 * Vt || kt(ze) || kt(ft))) {
            var Kt = Le.dtick / 2;
            ke += ke + Kt < ze ? Kt : -Kt;
          }
          return ke;
        }(Ne, Ye, $e, Ve, ut)) + (1 + Math.floor((ut - Ne) / xe)) * xe;
        else for ($e.dtick.charAt(0) === "M" && (Ne = function(ke, Me, Le, ze, ft) {
          var De = i.findExactDates(Me, ft);
          if (De.exactDays > 0.8) {
            var Je = Number(Le.substr(1));
            De.exactYears > 0.8 && Je % 12 == 0 ? ke = R2.tickIncrement(ke, "M6", "reverse") + 1.5 * S2 : De.exactMonths > 0.8 ? ke = R2.tickIncrement(ke, "M1", "reverse") + 15.5 * S2 : ke -= C2;
            var tt = R2.tickIncrement(ke, Le);
            if (tt <= ze) return tt;
          }
          return ke;
        }(Ne, Ye, xe, Ve, Ie)), He = Ne, 0; He <= ut; ) He = R2.tickIncrement(He, xe, false, Ie);
        return { start: at.c2r(Ne, 0, Ie), end: at.c2r(He, 0, Ie), size: xe, _dataSpan: ut - Ve };
      }, R2.prepTicks = function(Ye, at) {
        var Ge = i.simpleMap(Ye.range, Ye.r2l, void 0, void 0, at);
        if (Ye._dtickInit = Ye.dtick, Ye._tick0Init = Ye.tick0, Ye.tickmode === "auto" || !Ye.dtick) {
          var st, Ie = Ye.nticks;
          Ie || (Ye.type === "category" || Ye.type === "multicategory" ? (st = Ye.tickfont ? i.bigFont(Ye.tickfont.size || 12) : 15, Ie = Ye._length / st) : (st = Ye._id.charAt(0) === "y" ? 40 : 80, Ie = i.constrain(Ye._length / st, 4, 9) + 1), Ye._name === "radialaxis" && (Ie *= 2)), Ye.tickmode === "array" && (Ie *= 100), Ye._roughDTick = Math.abs(Ge[1] - Ge[0]) / Ie, R2.autoTicks(Ye, Ye._roughDTick), Ye._minDtick > 0 && Ye.dtick < 2 * Ye._minDtick && (Ye.dtick = Ye._minDtick, Ye.tick0 = Ye.l2r(Ye._forceTick0));
        }
        Ye.ticklabelmode === "period" && function(Pe) {
          var $e;
          function Ve() {
            return !(a(Pe.dtick) || Pe.dtick.charAt(0) !== "M");
          }
          var ut = Ve(), Re = R2.getTickFormat(Pe);
          if (Re) {
            var qe = Pe._dtickInit !== Pe.dtick;
            /%[fLQsSMX]/.test(Re) || (/%[HI]/.test(Re) ? ($e = E2, qe && !ut && Pe.dtick < E2 && (Pe.dtick = E2)) : /%p/.test(Re) ? ($e = C2, qe && !ut && Pe.dtick < C2 && (Pe.dtick = C2)) : /%[Aadejuwx]/.test(Re) ? ($e = S2, qe && !ut && Pe.dtick < S2 && (Pe.dtick = S2)) : /%[UVW]/.test(Re) ? ($e = A2, qe && !ut && Pe.dtick < A2 && (Pe.dtick = A2)) : /%[Bbm]/.test(Re) ? ($e = k, qe && (ut ? le(Pe.dtick) < 1 : Pe.dtick < T2) && (Pe.dtick = "M1")) : /%[q]/.test(Re) ? ($e = y, qe && (ut ? le(Pe.dtick) < 3 : Pe.dtick < w) && (Pe.dtick = "M3")) : /%[Yy]/.test(Re) && ($e = g, qe && (ut ? le(Pe.dtick) < 12 : Pe.dtick < x) && (Pe.dtick = "M12")));
          }
          (ut = Ve()) && Pe.tick0 === Pe._dowTick0 && (Pe.tick0 = Pe._rawTick0), Pe._definedDelta = $e;
        }(Ye), Ye.tick0 || (Ye.tick0 = Ye.type === "date" ? "2000-01-01" : 0), Ye.type === "date" && Ye.dtick < 0.1 && (Ye.dtick = 0.1), ve(Ye);
      }, R2.calcTicks = function(Ye, at) {
        R2.prepTicks(Ye, at);
        var Ge = i.simpleMap(Ye.range, Ye.r2l, void 0, void 0, at);
        if (Ye.tickmode === "array") return function(jt) {
          var Vt = jt.tickvals, Kt = jt.ticktext, rr = new Array(Vt.length), Tr = Z2(i.simpleMap(jt.range, jt.r2l)), yr = Math.min(Tr[0], Tr[1]), pr = Math.max(Tr[0], Tr[1]), lr = 0;
          Array.isArray(Kt) || (Kt = []);
          var _r = jt.type === "category" ? jt.d2l_noadd : jt.d2l;
          jt.type === "log" && String(jt.dtick).charAt(0) !== "L" && (jt.dtick = "L" + Math.pow(10, Math.floor(Math.min(jt.range[0], jt.range[1])) - 1));
          for (var $r = 0; $r < Vt.length; $r++) {
            var Ar = _r(Vt[$r]);
            Ar > yr && Ar < pr && (Kt[$r] === void 0 ? rr[lr] = R2.tickText(jt, Ar) : rr[lr] = Ee(jt, Ar, String(Kt[$r])), lr++);
          }
          return lr < Vt.length && rr.splice(lr, Vt.length - lr), jt.rangebreaks && (rr = rr.filter(function(Qr) {
            return jt.maskBreaks(Qr.x) !== I2;
          })), rr;
        }(Ye);
        var st = Z2(Ge), Ie = st[0], Pe = st[1], $e = Ge[1] < Ge[0], Ve = Math.min(Ge[0], Ge[1]), ut = Math.max(Ge[0], Ge[1]), Re = Ye.type === "log" && !(a(Ye.dtick) || Ye.dtick.charAt(0) === "L"), qe = Ye.ticklabelmode === "period";
        if (Ye._tmin = R2.tickFirst(Ye, at), Ye._tmin < Ie !== $e) return [];
        Ye.type !== "category" && Ye.type !== "multicategory" || (Pe = $e ? Math.max(-0.5, Pe) : Math.min(Ye._categories.length - 0.5, Pe));
        var je = Ye._tmin;
        Ye.rangebreaks && Ye._tick0Init !== Ye.tick0 && (je = Ot(je, Ye), $e || (je = R2.tickIncrement(je, Ye.dtick, !$e, Ye.calendar))), qe && (je = R2.tickIncrement(je, Ye.dtick, !$e, Ye.calendar));
        for (var rt, He = Math.max(1e3, Ye._length || 0), xe = [], Ne = null; $e ? je >= Pe : je <= Pe; je = R2.tickIncrement(je, Ye.dtick, $e, Ye.calendar)) {
          if (Ye.rangebreaks && !$e) {
            if (je < Ie) continue;
            if (Ye.maskBreaks(je) === I2 && Ot(je, Ye) >= ut) break;
          }
          if (xe.length > He || je === Ne) break;
          Ne = je;
          var ke = false;
          Re && je !== (0 | je) && (ke = true), xe.push({ minor: ke, value: je });
        }
        if (qe && function(jt, Vt, Kt) {
          for (var rr = 0; rr < jt.length; rr++) {
            var Tr = jt[rr].value, yr = rr, pr = rr + 1;
            rr < jt.length - 1 ? (yr = rr, pr = rr + 1) : rr > 0 ? (yr = rr - 1, pr = rr) : (yr = rr, pr = rr);
            var lr, _r = jt[yr].value, $r = jt[pr].value, Ar = Math.abs($r - _r), Qr = Kt || Ar, hn = 0;
            Qr >= x ? hn = Ar >= x && Ar <= m ? Ar : g : Kt === y && Qr >= w ? hn = Ar >= w && Ar <= b ? Ar : y : Qr >= T2 ? hn = Ar >= T2 && Ar <= _4 ? Ar : k : Kt === A2 && Qr >= A2 ? hn = A2 : Qr >= S2 ? hn = S2 : Kt === C2 && Qr >= C2 ? hn = C2 : Kt === E2 && Qr >= E2 && (hn = E2), hn >= Ar && (hn = Ar, lr = true);
            var wn = Tr + hn;
            if (Vt.rangebreaks && hn > 0) {
              for (var Yn = 0, Xn = 0; Xn < 84; Xn++) {
                var Wn = (Xn + 0.5) / 84;
                Vt.maskBreaks(Tr * (1 - Wn) + Wn * wn) !== I2 && Yn++;
              }
              (hn *= Yn / 84) || (jt[rr].drop = true), lr && Ar > A2 && (hn = Ar);
            }
            (hn > 0 || rr === 0) && (jt[rr].periodX = Tr + hn / 2);
          }
        }(xe, Ye, Ye._definedDelta), Ye.rangebreaks) {
          var Me = Ye._id.charAt(0) === "y", Le = 1;
          Ye.tickmode === "auto" && (Le = Ye.tickfont ? Ye.tickfont.size : 12);
          var ze = NaN;
          for (rt = xe.length - 1; rt > -1; rt--) if (xe[rt].drop) xe.splice(rt, 1);
          else {
            xe[rt].value = Ot(xe[rt].value, Ye);
            var ft = Ye.c2p(xe[rt].value);
            (Me ? ze > ft - Le : ze < ft + Le) ? xe.splice($e ? rt + 1 : rt, 1) : ze = ft;
          }
        }
        pt(Ye) && Math.abs(Ge[1] - Ge[0]) === 360 && xe.pop(), Ye._tmax = (xe[xe.length - 1] || {}).value, Ye._prevDateHead = "", Ye._inCalcTicks = true;
        var De, Je, tt = [];
        for (rt = 0; rt < xe.length; rt++) {
          var vt = xe[rt].minor, kt = xe[rt].value;
          De = R2.tickText(Ye, kt, false, vt), (Je = xe[rt].periodX) !== void 0 && (De.periodX = Je, (Je > ut || Je < Ve) && (Je > ut && (De.periodX = ut), Je < Ve && (De.periodX = Ve), De.text = " ", Ye._prevDateHead = "")), tt.push(De);
        }
        return Ye._inCalcTicks = false, tt;
      };
      var ce = [2, 5, 10], se = [1, 2, 3, 6, 12], he = [1, 2, 5, 10, 15, 30], me = [1, 2, 3, 7, 14], we = [-0.046, 0, 0.301, 0.477, 0.602, 0.699, 0.778, 0.845, 0.903, 0.954, 1], be = [-0.301, 0, 0.301, 0.699, 1], Ae = [15, 30, 45, 90, 180];
      function pe(Ye, at, Ge) {
        return at * i.roundUp(Ye / at, Ge);
      }
      function ve(Ye) {
        var at = Ye.dtick;
        if (Ye._tickexponent = 0, a(at) || typeof at == "string" || (at = 1), Ye.type !== "category" && Ye.type !== "multicategory" || (Ye._tickround = null), Ye.type === "date") {
          var Ge = Ye.r2l(Ye.tick0), st = Ye.l2r(Ge).replace(/(^-|i)/g, ""), Ie = st.length;
          if (String(at).charAt(0) === "M") Ie > 10 || st.substr(5) !== "01-01" ? Ye._tickround = "d" : Ye._tickround = +at.substr(1) % 12 == 0 ? "y" : "m";
          else if (at >= S2 && Ie <= 10 || at >= 15 * S2) Ye._tickround = "d";
          else if (at >= F13 && Ie <= 16 || at >= E2) Ye._tickround = "M";
          else if (at >= N2 && Ie <= 19 || at >= F13) Ye._tickround = "S";
          else {
            var Pe = Ye.l2r(Ge + at).replace(/^-/, "").length;
            Ye._tickround = Math.max(Ie, Pe) - 20, Ye._tickround < 0 && (Ye._tickround = 4);
          }
        } else if (a(at) || at.charAt(0) === "L") {
          var $e = Ye.range.map(Ye.r2d || Number);
          a(at) || (at = Number(at.substr(1))), Ye._tickround = 2 - Math.floor(Math.log(at) / Math.LN10 + 0.01);
          var Ve = Math.max(Math.abs($e[0]), Math.abs($e[1])), ut = Math.floor(Math.log(Ve) / Math.LN10 + 0.01), Re = Ye.minexponent === void 0 ? 3 : Ye.minexponent;
          Math.abs(ut) > Re && (Ce(Ye.exponentformat) && !Be(ut) ? Ye._tickexponent = 3 * Math.round((ut - 1) / 3) : Ye._tickexponent = ut);
        } else Ye._tickround = null;
      }
      function Ee(Ye, at, Ge) {
        var st = Ye.tickfont || {};
        return { x: at, dx: 0, dy: 0, text: Ge || "", fontSize: st.size, font: st.family, fontColor: st.color };
      }
      R2.autoTicks = function(Ye, at) {
        var Ge;
        function st(qe) {
          return Math.pow(qe, Math.floor(Math.log(at) / Math.LN10));
        }
        if (Ye.type === "date") {
          Ye.tick0 = i.dateTick0(Ye.calendar, 0);
          var Ie = 2 * at;
          if (Ie > g) at /= g, Ge = st(10), Ye.dtick = "M" + 12 * pe(at, Ge, ce);
          else if (Ie > k) at /= k, Ye.dtick = "M" + pe(at, 1, se);
          else if (Ie > S2) {
            Ye.dtick = pe(at, S2, Ye._hasDayOfWeekBreaks ? [1, 2, 7, 14] : me);
            var Pe = R2.getTickFormat(Ye), $e = Ye.ticklabelmode === "period";
            $e && (Ye._rawTick0 = Ye.tick0), /%[uVW]/.test(Pe) ? Ye.tick0 = i.dateTick0(Ye.calendar, 2) : Ye.tick0 = i.dateTick0(Ye.calendar, 1), $e && (Ye._dowTick0 = Ye.tick0);
          } else Ie > E2 ? Ye.dtick = pe(at, E2, se) : Ie > F13 ? Ye.dtick = pe(at, F13, he) : Ie > N2 ? Ye.dtick = pe(at, N2, he) : (Ge = st(10), Ye.dtick = pe(at, Ge, ce));
        } else if (Ye.type === "log") {
          Ye.tick0 = 0;
          var Ve = i.simpleMap(Ye.range, Ye.r2l);
          if (at > 0.7) Ye.dtick = Math.ceil(at);
          else if (Math.abs(Ve[1] - Ve[0]) < 1) {
            var ut = 1.5 * Math.abs((Ve[1] - Ve[0]) / at);
            at = Math.abs(Math.pow(10, Ve[1]) - Math.pow(10, Ve[0])) / ut, Ge = st(10), Ye.dtick = "L" + pe(at, Ge, ce);
          } else Ye.dtick = at > 0.3 ? "D2" : "D1";
        } else Ye.type === "category" || Ye.type === "multicategory" ? (Ye.tick0 = 0, Ye.dtick = Math.ceil(Math.max(at, 1))) : pt(Ye) ? (Ye.tick0 = 0, Ge = 1, Ye.dtick = pe(at, Ge, Ae)) : (Ye.tick0 = 0, Ge = st(10), Ye.dtick = pe(at, Ge, ce));
        if (Ye.dtick === 0 && (Ye.dtick = 1), !a(Ye.dtick) && typeof Ye.dtick != "string") {
          var Re = Ye.dtick;
          throw Ye.dtick = 1, "ax.dtick error: " + String(Re);
        }
      }, R2.tickIncrement = function(Ye, at, Ge, st) {
        var Ie = Ge ? -1 : 1;
        if (a(at)) return i.increment(Ye, Ie * at);
        var Pe = at.charAt(0), $e = Ie * Number(at.substr(1));
        if (Pe === "M") return i.incrementMonth(Ye, $e, st);
        if (Pe === "L") return Math.log(Math.pow(10, Ye) + $e) / Math.LN10;
        if (Pe === "D") {
          var Ve = at === "D2" ? be : we, ut = Ye + 0.01 * Ie, Re = i.roundUp(i.mod(ut, 1), Ve, Ge);
          return Math.floor(ut) + Math.log(n.round(Math.pow(10, Re), 1)) / Math.LN10;
        }
        throw "unrecognized dtick " + String(at);
      }, R2.tickFirst = function(Ye, at) {
        var Ge = Ye.r2l || Number, st = i.simpleMap(Ye.range, Ge, void 0, void 0, at), Ie = st[1] < st[0], Pe = Ie ? Math.floor : Math.ceil, $e = Z2(st)[0], Ve = Ye.dtick, ut = Ge(Ye.tick0);
        if (a(Ve)) {
          var Re = Pe(($e - ut) / Ve) * Ve + ut;
          return Ye.type !== "category" && Ye.type !== "multicategory" || (Re = i.constrain(Re, 0, Ye._categories.length - 1)), Re;
        }
        var qe = Ve.charAt(0), je = Number(Ve.substr(1));
        if (qe === "M") {
          for (var rt, He, xe, Ne = 0, ke = ut; Ne < 10; ) {
            if (((rt = R2.tickIncrement(ke, Ve, Ie, Ye.calendar)) - $e) * (ke - $e) <= 0) return Ie ? Math.min(ke, rt) : Math.max(ke, rt);
            He = ($e - (ke + rt) / 2) / (rt - ke), xe = qe + (Math.abs(Math.round(He)) || 1) * je, ke = R2.tickIncrement(ke, xe, He < 0 ? !Ie : Ie, Ye.calendar), Ne++;
          }
          return i.error("tickFirst did not converge", Ye), ke;
        }
        if (qe === "L") return Math.log(Pe((Math.pow(10, $e) - ut) / je) * je + ut) / Math.LN10;
        if (qe === "D") {
          var Me = Ve === "D2" ? be : we, Le = i.roundUp(i.mod($e, 1), Me, Ie);
          return Math.floor($e) + Math.log(n.round(Math.pow(10, Le), 1)) / Math.LN10;
        }
        throw "unrecognized dtick " + String(Ve);
      }, R2.tickText = function(Ye, at, Ge, st) {
        var Ie, Pe = Ee(Ye, at), $e = Ye.tickmode === "array", Ve = Ge || $e, ut = Ye.type, Re = ut === "category" ? Ye.d2l_noadd : Ye.d2l;
        if ($e && Array.isArray(Ye.ticktext)) {
          var qe = i.simpleMap(Ye.range, Ye.r2l), je = (Math.abs(qe[1] - qe[0]) - (Ye._lBreaks || 0)) / 1e4;
          for (Ie = 0; Ie < Ye.ticktext.length && !(Math.abs(at - Re(Ye.tickvals[Ie])) < je); Ie++) ;
          if (Ie < Ye.ticktext.length) return Pe.text = String(Ye.ticktext[Ie]), Pe;
        }
        function rt(Ne) {
          if (Ne === void 0) return true;
          if (Ge) return Ne === "none";
          var ke = { first: Ye._tmin, last: Ye._tmax }[Ne];
          return Ne !== "all" && at !== ke;
        }
        var He = Ge ? "never" : Ye.exponentformat !== "none" && rt(Ye.showexponent) ? "hide" : "";
        if (ut === "date" ? function(Ne, ke, Me, Le) {
          var ze = Ne._tickround, ft = Me && Ne.hoverformat || R2.getTickFormat(Ne);
          Le && (ze = a(ze) ? 4 : { y: "m", m: "d", d: "M", M: "S", S: 4 }[ze]);
          var De, Je = i.formatDate(ke.x, ft, ze, Ne._dateFormat, Ne.calendar, Ne._extraFormat), tt = Je.indexOf(`
`);
          if (tt !== -1 && (De = Je.substr(tt + 1), Je = Je.substr(0, tt)), Le && (Je === "00:00:00" || Je === "00:00" ? (Je = De, De = "") : Je.length === 8 && (Je = Je.replace(/:00$/, ""))), De) if (Me) ze === "d" ? Je += ", " + De : Je = De + (Je ? ", " + Je : "");
          else if (Ne._inCalcTicks && Ne._prevDateHead === De) {
            var vt = Jt(Ne), kt = Ne._trueSide || Ne.side;
            (!vt && kt === "top" || vt && kt === "bottom") && (Je += "<br> ");
          } else Ne._prevDateHead = De, Je += "<br>" + De;
          ke.text = Je;
        }(Ye, Pe, Ge, Ve) : ut === "log" ? function(Ne, ke, Me, Le, ze) {
          var ft = Ne.dtick, De = ke.x, Je = Ne.tickformat, tt = typeof ft == "string" && ft.charAt(0);
          if (ze === "never" && (ze = ""), Le && tt !== "L" && (ft = "L3", tt = "L"), Je || tt === "L") ke.text = Ue(Math.pow(10, De), Ne, ze, Le);
          else if (a(ft) || tt === "D" && i.mod(De + 0.01, 1) < 0.1) {
            var vt = Math.round(De), kt = Math.abs(vt), jt = Ne.exponentformat;
            jt === "power" || Ce(jt) && Be(vt) ? (ke.text = vt === 0 ? 1 : vt === 1 ? "10" : "10<sup>" + (vt > 1 ? "" : D2) + kt + "</sup>", ke.fontSize *= 1.25) : (jt === "e" || jt === "E") && kt > 2 ? ke.text = "1" + jt + (vt > 0 ? "+" : D2) + kt : (ke.text = Ue(Math.pow(10, De), Ne, "", "fakehover"), ft === "D1" && Ne._id.charAt(0) === "y" && (ke.dy -= ke.fontSize / 6));
          } else {
            if (tt !== "D") throw "unrecognized dtick " + String(ft);
            ke.text = String(Math.round(Math.pow(10, i.mod(De, 1)))), ke.fontSize *= 0.75;
          }
          if (Ne.dtick === "D1") {
            var Vt = String(ke.text).charAt(0);
            Vt !== "0" && Vt !== "1" || (Ne._id.charAt(0) === "y" ? ke.dx -= ke.fontSize / 4 : (ke.dy += ke.fontSize / 2, ke.dx += (Ne.range[1] > Ne.range[0] ? 1 : -1) * ke.fontSize * (De < 0 ? 0.5 : 0.25)));
          }
        }(Ye, Pe, 0, Ve, He) : ut === "category" ? function(Ne, ke) {
          var Me = Ne._categories[Math.round(ke.x)];
          Me === void 0 && (Me = ""), ke.text = String(Me);
        }(Ye, Pe) : ut === "multicategory" ? function(Ne, ke, Me) {
          var Le = Math.round(ke.x), ze = Ne._categories[Le] || [], ft = ze[1] === void 0 ? "" : String(ze[1]), De = ze[0] === void 0 ? "" : String(ze[0]);
          Me ? ke.text = De + " - " + ft : (ke.text = ft, ke.text2 = De);
        }(Ye, Pe, Ge) : pt(Ye) ? function(Ne, ke, Me, Le, ze) {
          if (Ne.thetaunit !== "radians" || Me) ke.text = Ue(ke.x, Ne, ze, Le);
          else {
            var ft = ke.x / 180;
            if (ft === 0) ke.text = "0";
            else {
              var De = function(tt) {
                function vt(Kt, rr) {
                  return Math.abs(Kt - rr) <= 1e-6;
                }
                var kt = function(Kt) {
                  for (var rr = 1; !vt(Math.round(Kt * rr) / rr, Kt); ) rr *= 10;
                  return rr;
                }(tt), jt = tt * kt, Vt = Math.abs(function Kt(rr, Tr) {
                  return vt(Tr, 0) ? rr : Kt(Tr, rr % Tr);
                }(jt, kt));
                return [Math.round(jt / Vt), Math.round(kt / Vt)];
              }(ft);
              if (De[1] >= 100) ke.text = Ue(i.deg2rad(ke.x), Ne, ze, Le);
              else {
                var Je = ke.x < 0;
                De[1] === 1 ? De[0] === 1 ? ke.text = "\u03C0" : ke.text = De[0] + "\u03C0" : ke.text = ["<sup>", De[0], "</sup>", "\u2044", "<sub>", De[1], "</sub>", "\u03C0"].join(""), Je && (ke.text = D2 + ke.text);
              }
            }
          }
        }(Ye, Pe, Ge, Ve, He) : function(Ne, ke, Me, Le, ze) {
          ze === "never" ? ze = "" : Ne.showexponent === "all" && Math.abs(ke.x / Ne.dtick) < 1e-6 && (ze = "hide"), ke.text = Ue(ke.x, Ne, ze, Le);
        }(Ye, Pe, 0, Ve, He), st || (Ye.tickprefix && !rt(Ye.showtickprefix) && (Pe.text = Ye.tickprefix + Pe.text), Ye.ticksuffix && !rt(Ye.showticksuffix) && (Pe.text += Ye.ticksuffix)), Ye.tickson === "boundaries" || Ye.showdividers) {
          var xe = function(Ne) {
            var ke = Ye.l2p(Ne);
            return ke >= 0 && ke <= Ye._length ? Ne : null;
          };
          Pe.xbnd = [xe(Pe.x - 0.5), xe(Pe.x + Ye.dtick - 0.5)];
        }
        return Pe;
      }, R2.hoverLabelText = function(Ye, at, Ge) {
        Ge && (Ye = i.extendFlat({}, Ye, { hoverformat: Ge }));
        var st = Array.isArray(at) ? at[0] : at, Ie = Array.isArray(at) ? at[1] : void 0;
        if (Ie !== void 0 && Ie !== st) return R2.hoverLabelText(Ye, st, Ge) + " - " + R2.hoverLabelText(Ye, Ie, Ge);
        var Pe = Ye.type === "log" && st <= 0, $e = R2.tickText(Ye, Ye.c2l(Pe ? -st : st), "hover").text;
        return Pe ? st === 0 ? "0" : D2 + $e : $e;
      };
      var Se = ["f", "p", "n", "\u03BC", "m", "", "k", "M", "G", "T"];
      function Ce(Ye) {
        return Ye === "SI" || Ye === "B";
      }
      function Be(Ye) {
        return Ye > 14 || Ye < -15;
      }
      function Ue(Ye, at, Ge, st) {
        var Ie = Ye < 0, Pe = at._tickround, $e = Ge || at.exponentformat || "B", Ve = at._tickexponent, ut = R2.getTickFormat(at), Re = at.separatethousands;
        if (st) {
          var qe = { exponentformat: $e, minexponent: at.minexponent, dtick: at.showexponent === "none" ? at.dtick : a(Ye) && Math.abs(Ye) || 1, range: at.showexponent === "none" ? at.range.map(at.r2d) : [0, Ye || 1] };
          ve(qe), Pe = (Number(qe._tickround) || 0) + 4, Ve = qe._tickexponent, at.hoverformat && (ut = at.hoverformat);
        }
        if (ut) return at._numFormat(ut)(Ye).replace(/-/g, D2);
        var je, rt = Math.pow(10, -Pe) / 2;
        if ($e === "none" && (Ve = 0), (Ye = Math.abs(Ye)) < rt) Ye = "0", Ie = false;
        else {
          if (Ye += rt, Ve && (Ye *= Math.pow(10, -Ve), Pe += Ve), Pe === 0) Ye = String(Math.floor(Ye));
          else if (Pe < 0) {
            Ye = (Ye = String(Math.round(Ye))).substr(0, Ye.length + Pe);
            for (var He = Pe; He < 0; He++) Ye += "0";
          } else {
            var xe = (Ye = String(Ye)).indexOf(".") + 1;
            xe && (Ye = Ye.substr(0, xe + Pe).replace(/\.?0+$/, ""));
          }
          Ye = i.numSeparate(Ye, at._separators, Re);
        }
        return Ve && $e !== "hide" && (Ce($e) && Be(Ve) && ($e = "power"), je = Ve < 0 ? D2 + -Ve : $e !== "power" ? "+" + Ve : String(Ve), $e === "e" || $e === "E" ? Ye += $e + je : $e === "power" ? Ye += "\xD710<sup>" + je + "</sup>" : $e === "B" && Ve === 9 ? Ye += "B" : Ce($e) && (Ye += Se[Ve / 3 + 5])), Ie ? D2 + Ye : Ye;
      }
      function Ke(Ye, at) {
        for (var Ge = [], st = {}, Ie = 0; Ie < at.length; Ie++) {
          var Pe = at[Ie];
          st[Pe.text2] ? st[Pe.text2].push(Pe.x) : st[Pe.text2] = [Pe.x];
        }
        for (var $e in st) Ge.push(Ee(Ye, i.interp(st[$e], 0.5), $e));
        return Ge;
      }
      function ct(Ye) {
        return Ye.periodX !== void 0 ? Ye.periodX : Ye.x;
      }
      function We(Ye) {
        return [Ye.text, Ye.x, Ye.axInfo, Ye.font, Ye.fontSize, Ye.fontColor].join("_");
      }
      function Ze(Ye) {
        var at = Ye.title.font.size, Ge = (Ye.title.text.match(u2.BR_TAG_ALL) || []).length;
        return Ye.title.hasOwnProperty("standoff") ? Ge ? at * (K2 + Ge * q) : at * K2 : Ge ? at * (Ge + 1) * q : at;
      }
      function it(Ye, at) {
        var Ge = Ye.l2p(at);
        return Ge > 1 && Ge < Ye._length - 1;
      }
      function ot(Ye) {
        var at = n.select(Ye), Ge = at.select(".text-math-group");
        return Ge.empty() ? at.select("text") : Ge;
      }
      function mt(Ye) {
        return Ye._id + ".automargin";
      }
      function wt(Ye) {
        return mt(Ye) + ".mirror";
      }
      function Et(Ye) {
        return Ye._id + ".rangeslider";
      }
      function zt(Ye, at) {
        for (var Ge = 0; Ge < at.length; Ge++) Ye.indexOf(at[Ge]) === -1 && Ye.push(at[Ge]);
      }
      function Nt(Ye, at, Ge) {
        var st, Ie, Pe = [], $e = [], Ve = Ye.layout;
        for (st = 0; st < at.length; st++) Pe.push(R2.getFromId(Ye, at[st]));
        for (st = 0; st < Ge.length; st++) $e.push(R2.getFromId(Ye, Ge[st]));
        var ut = Object.keys(p), Re = ["anchor", "domain", "overlaying", "position", "side", "tickangle", "editType"], qe = ["linear", "log"];
        for (st = 0; st < ut.length; st++) {
          var je = ut[st], rt = Pe[0][je], He = $e[0][je], xe = true, Ne = false, ke = false;
          if (je.charAt(0) !== "_" && typeof rt != "function" && Re.indexOf(je) === -1) {
            for (Ie = 1; Ie < Pe.length && xe; Ie++) {
              var Me = Pe[Ie][je];
              je === "type" && qe.indexOf(rt) !== -1 && qe.indexOf(Me) !== -1 && rt !== Me ? Ne = true : Me !== rt && (xe = false);
            }
            for (Ie = 1; Ie < $e.length && xe; Ie++) {
              var Le = $e[Ie][je];
              je === "type" && qe.indexOf(He) !== -1 && qe.indexOf(Le) !== -1 && He !== Le ? ke = true : $e[Ie][je] !== He && (xe = false);
            }
            xe && (Ne && (Ve[Pe[0]._name].type = "linear"), ke && (Ve[$e[0]._name].type = "linear"), yt(Ve, je, Pe, $e, Ye._fullLayout._dfltTitle));
          }
        }
        for (st = 0; st < Ye._fullLayout.annotations.length; st++) {
          var ze = Ye._fullLayout.annotations[st];
          at.indexOf(ze.xref) !== -1 && Ge.indexOf(ze.yref) !== -1 && i.swapAttrs(Ve.annotations[st], ["?"]);
        }
      }
      function yt(Ye, at, Ge, st, Ie) {
        var Pe, $e = i.nestedProperty, Ve = $e(Ye[Ge[0]._name], at).get(), ut = $e(Ye[st[0]._name], at).get();
        for (at === "title" && (Ve && Ve.text === Ie.x && (Ve.text = Ie.y), ut && ut.text === Ie.y && (ut.text = Ie.x)), Pe = 0; Pe < Ge.length; Pe++) $e(Ye, Ge[Pe]._name + "." + at).set(ut);
        for (Pe = 0; Pe < st.length; Pe++) $e(Ye, st[Pe]._name + "." + at).set(Ve);
      }
      function pt(Ye) {
        return Ye._id === "angularaxis";
      }
      function Ot(Ye, at) {
        for (var Ge = at._rangebreaks.length, st = 0; st < Ge; st++) {
          var Ie = at._rangebreaks[st];
          if (Ye >= Ie.min && Ye < Ie.max) return Ie.max;
        }
        return Ye;
      }
      function Jt(Ye) {
        return (Ye.ticklabelposition || "").indexOf("inside") !== -1;
      }
      function tr(Ye, at) {
        Jt(Ye._anchorAxis || {}) && Ye._hideCounterAxisInsideTickLabels && Ye._hideCounterAxisInsideTickLabels(at);
      }
      R2.getTickFormat = function(Ye) {
        var at, Ge, st, Ie, Pe, $e, Ve, ut;
        function Re(rt) {
          return typeof rt != "string" ? rt : Number(rt.replace("M", "")) * k;
        }
        function qe(rt, He) {
          var xe = ["L", "D"];
          if (typeof rt == typeof He) {
            if (typeof rt == "number") return rt - He;
            var Ne = xe.indexOf(rt.charAt(0)), ke = xe.indexOf(He.charAt(0));
            return Ne === ke ? Number(rt.replace(/(L|D)/g, "")) - Number(He.replace(/(L|D)/g, "")) : Ne - ke;
          }
          return typeof rt == "number" ? 1 : -1;
        }
        function je(rt, He) {
          var xe = He[0] === null, Ne = He[1] === null, ke = qe(rt, He[0]) >= 0, Me = qe(rt, He[1]) <= 0;
          return (xe || ke) && (Ne || Me);
        }
        if (Ye.tickformatstops && Ye.tickformatstops.length > 0) switch (Ye.type) {
          case "date":
          case "linear":
            for (at = 0; at < Ye.tickformatstops.length; at++) if ((st = Ye.tickformatstops[at]).enabled && (Ie = Ye.dtick, Pe = st.dtickrange, $e = void 0, Ve = void 0, ut = void 0, $e = Re || function(rt) {
              return rt;
            }, Ve = Pe[0], ut = Pe[1], (!Ve && typeof Ve != "number" || $e(Ve) <= $e(Ie)) && (!ut && typeof ut != "number" || $e(ut) >= $e(Ie)))) {
              Ge = st;
              break;
            }
            break;
          case "log":
            for (at = 0; at < Ye.tickformatstops.length; at++) if ((st = Ye.tickformatstops[at]).enabled && je(Ye.dtick, st.dtickrange)) {
              Ge = st;
              break;
            }
        }
        return Ge ? Ge.value : Ye.tickformat;
      }, R2.getSubplots = function(Ye, at) {
        var Ge = Ye._fullLayout._subplots, st = Ge.cartesian.concat(Ge.gl2d || []), Ie = at ? R2.findSubplotsWithAxis(st, at) : st;
        return Ie.sort(function(Pe, $e) {
          var Ve = Pe.substr(1).split("y"), ut = $e.substr(1).split("y");
          return Ve[0] === ut[0] ? +Ve[1] - +ut[1] : +Ve[0] - +ut[0];
        }), Ie;
      }, R2.findSubplotsWithAxis = function(Ye, at) {
        for (var Ge = new RegExp(at._id.charAt(0) === "x" ? "^" + at._id + "y" : at._id + "$"), st = [], Ie = 0; Ie < Ye.length; Ie++) {
          var Pe = Ye[Ie];
          Ge.test(Pe) && st.push(Pe);
        }
        return st;
      }, R2.makeClipPaths = function(Ye) {
        var at = Ye._fullLayout;
        if (!at._hasOnlyLargeSploms) {
          var Ge, st, Ie = { _offset: 0, _length: at.width, _id: "" }, Pe = { _offset: 0, _length: at.height, _id: "" }, $e = R2.list(Ye, "x", true), Ve = R2.list(Ye, "y", true), ut = [];
          for (Ge = 0; Ge < $e.length; Ge++) for (ut.push({ x: $e[Ge], y: Pe }), st = 0; st < Ve.length; st++) Ge === 0 && ut.push({ x: Ie, y: Ve[st] }), ut.push({ x: $e[Ge], y: Ve[st] });
          var Re = at._clips.selectAll(".axesclip").data(ut, function(qe) {
            return qe.x._id + qe.y._id;
          });
          Re.enter().append("clipPath").classed("axesclip", true).attr("id", function(qe) {
            return "clip" + at._uid + qe.x._id + qe.y._id;
          }).append("rect"), Re.exit().remove(), Re.each(function(qe) {
            n.select(this).select("rect").attr({ x: qe.x._offset || 0, y: qe.y._offset || 0, width: qe.x._length || 1, height: qe.y._length || 1 });
          });
        }
      }, R2.draw = function(Ye, at, Ge) {
        var st = Ye._fullLayout;
        at === "redraw" && st._paper.selectAll("g.subplot").each(function(Pe) {
          var $e = Pe[0], Ve = st._plots[$e];
          if (Ve) {
            var ut = Ve.xaxis, Re = Ve.yaxis;
            Ve.xaxislayer.selectAll("." + ut._id + "tick").remove(), Ve.yaxislayer.selectAll("." + Re._id + "tick").remove(), Ve.xaxislayer.selectAll("." + ut._id + "tick2").remove(), Ve.yaxislayer.selectAll("." + Re._id + "tick2").remove(), Ve.xaxislayer.selectAll("." + ut._id + "divider").remove(), Ve.yaxislayer.selectAll("." + Re._id + "divider").remove(), Ve.gridlayer && Ve.gridlayer.selectAll("path").remove(), Ve.zerolinelayer && Ve.zerolinelayer.selectAll("path").remove(), st._infolayer.select(".g-" + ut._id + "title").remove(), st._infolayer.select(".g-" + Re._id + "title").remove();
          }
        });
        var Ie = at && at !== "redraw" ? at : R2.listIds(Ye);
        return i.syncOrAsync(Ie.map(function(Pe) {
          return function() {
            if (Pe) {
              var $e = R2.getFromId(Ye, Pe), Ve = R2.drawOne(Ye, $e, Ge);
              return $e._r = $e.range.slice(), $e._rl = i.simpleMap($e._r, $e.r2l), Ve;
            }
          };
        }));
      }, R2.drawOne = function(Ye, at, Ge) {
        var st, Ie, Pe;
        Ge = Ge || {}, at.setScale();
        var $e = Ye._fullLayout, Ve = at._id, ut = Ve.charAt(0), Re = R2.counterLetter(Ve), qe = $e._plots[at._mainSubplot];
        if (qe) {
          var je = qe[ut + "axislayer"], rt = at._mainLinePosition, He = at._mainMirrorPosition, xe = at._vals = R2.calcTicks(at), Ne = [at.mirror, rt, He].join("_");
          for (st = 0; st < xe.length; st++) xe[st].axInfo = Ne;
          at._selections = {}, at._tickAngles && (at._prevTickAngles = at._tickAngles), at._tickAngles = {}, at._depth = null;
          var ke = {};
          if (at.visible) {
            var Me, Le, ze = R2.makeTransTickFn(at), ft = R2.makeTransTickLabelFn(at), De = at.ticks === "inside", Je = at.ticks === "outside";
            if (at.tickson === "boundaries") {
              var tt = function(qr, Nr) {
                var Zr, oa = [], tn = function(Zn, Ln) {
                  var gn = Zn.xbnd[Ln];
                  gn !== null && oa.push(i.extendFlat({}, Zn, { x: gn }));
                };
                if (Nr.length) {
                  for (Zr = 0; Zr < Nr.length; Zr++) tn(Nr[Zr], 0);
                  tn(Nr[Zr - 1], 1);
                }
                return oa;
              }(0, xe);
              Le = R2.clipEnds(at, tt), Me = De ? Le : tt;
            } else Le = R2.clipEnds(at, xe), Me = De && at.ticklabelmode !== "period" ? Le : xe;
            var vt = at._gridVals = Le, kt = function(qr, Nr) {
              var Zr, oa, tn = [], Zn = Nr.length && Nr[Nr.length - 1].x < Nr[0].x, Ln = function(na, sr) {
                var Ut = na.xbnd[sr];
                Ut !== null && tn.push(i.extendFlat({}, na, { x: Ut }));
              };
              if (qr.showdividers && Nr.length) {
                for (Zr = 0; Zr < Nr.length; Zr++) {
                  var gn = Nr[Zr];
                  gn.text2 !== oa && Ln(gn, Zn ? 1 : 0), oa = gn.text2;
                }
                Ln(Nr[Zr - 1], Zn ? 0 : 1);
              }
              return tn;
            }(at, xe);
            if (!$e._hasOnlyLargeSploms) {
              var jt = at._subplotsWith, Vt = {};
              for (st = 0; st < jt.length; st++) {
                Ie = jt[st];
                var Kt = (Pe = $e._plots[Ie])[Re + "axis"], rr = Kt._mainAxis._id;
                if (!Vt[rr]) {
                  Vt[rr] = 1;
                  var Tr = ut === "x" ? "M0," + Kt._offset + "v" + Kt._length : "M" + Kt._offset + ",0h" + Kt._length;
                  R2.drawGrid(Ye, at, { vals: vt, counterAxis: Kt, layer: Pe.gridlayer.select("." + Ve), path: Tr, transFn: ze }), R2.drawZeroLine(Ye, at, { counterAxis: Kt, layer: Pe.zerolinelayer, path: Tr, transFn: ze });
                }
              }
            }
            var yr = R2.getTickSigns(at), pr = [];
            if (at.ticks) {
              var lr, _r, $r, Ar = R2.makeTickPath(at, rt, yr[2]);
              if (at._anchorAxis && at.mirror && at.mirror !== true ? (lr = R2.makeTickPath(at, He, yr[3]), _r = Ar + lr) : (lr = "", _r = Ar), at.showdividers && Je && at.tickson === "boundaries") {
                var Qr = {};
                for (st = 0; st < kt.length; st++) Qr[kt[st].x] = 1;
                $r = function(qr) {
                  return Qr[qr.x] ? lr : _r;
                };
              } else $r = _r;
              R2.drawTicks(Ye, at, { vals: Me, layer: je, path: $r, transFn: ze }), at.mirror === "allticks" && (pr = Object.keys(at._linepositions || {}));
            }
            for (st = 0; st < pr.length; st++) {
              Ie = pr[st], Pe = $e._plots[Ie];
              var hn = at._linepositions[Ie] || [], wn = R2.makeTickPath(at, hn[0], yr[0]) + R2.makeTickPath(at, hn[1], yr[1]);
              R2.drawTicks(Ye, at, { vals: Me, layer: Pe[ut + "axislayer"], path: wn, transFn: ze });
            }
            var Yn = [];
            if (Yn.push(function() {
              return R2.drawLabels(Ye, at, { vals: xe, layer: je, plotinfo: Pe, transFn: ft, labelFns: R2.makeLabelFns(at, rt) });
            }), at.type === "multicategory") {
              var Xn = { x: 2, y: 10 }[ut];
              Yn.push(function() {
                var qr = { x: "height", y: "width" }[ut], Nr = _n()[qr] + Xn + (at._tickAngles[Ve + "tick"] ? at.tickfont.size * q : 0);
                return R2.drawLabels(Ye, at, { vals: Ke(at, xe), layer: je, cls: Ve + "tick2", repositionOnUpdate: true, secondary: true, transFn: ze, labelFns: R2.makeLabelFns(at, rt + Nr * yr[4]) });
              }), Yn.push(function() {
                return at._depth = yr[4] * (_n("tick2")[at.side] - rt), function(qr, Nr, Zr) {
                  var oa = Nr._id + "divider", tn = Zr.vals, Zn = Zr.layer.selectAll("path." + oa).data(tn, We);
                  Zn.exit().remove(), Zn.enter().insert("path", ":first-child").classed(oa, 1).classed("crisp", 1).call(f.stroke, Nr.dividercolor).style("stroke-width", h.crispRound(qr, Nr.dividerwidth, 1) + "px"), Zn.attr("transform", Zr.transFn).attr("d", Zr.path);
                }(Ye, at, { vals: kt, layer: je, path: R2.makeTickPath(at, rt, yr[4], at._depth), transFn: ze });
              });
            } else at.title.hasOwnProperty("standoff") && Yn.push(function() {
              at._depth = yr[4] * (_n()[at.side] - rt);
            });
            var Wn = s.getComponentMethod("rangeslider", "isVisible")(at);
            return Yn.push(function() {
              var qr, Nr, Zr, oa, tn = at.side.charAt(0), Zn = re[at.side].charAt(0), Ln = R2.getPxPosition(Ye, at), gn = Je ? at.ticklen : 0;
              if ((at.automargin || Wn) && (at.type === "multicategory" ? qr = _n("tick2") : (qr = _n(), ut === "x" && tn === "b" && (at._depth = Math.max(qr.width > 0 ? qr.bottom - Ln : 0, gn)))), at.automargin) {
                Nr = { x: 0, y: 0, r: 0, l: 0, t: 0, b: 0 };
                var na = [0, 1];
                if (ut === "x") {
                  if (tn === "b" ? Nr[tn] = at._depth : (Nr[tn] = at._depth = Math.max(qr.width > 0 ? Ln - qr.top : 0, gn), na.reverse()), qr.width > 0) {
                    var sr = qr.right - (at._offset + at._length);
                    sr > 0 && (Nr.xr = 1, Nr.r = sr);
                    var Ut = at._offset - qr.left;
                    Ut > 0 && (Nr.xl = 0, Nr.l = Ut);
                  }
                } else if (tn === "l" ? Nr[tn] = at._depth = Math.max(qr.height > 0 ? Ln - qr.left : 0, gn) : (Nr[tn] = at._depth = Math.max(qr.height > 0 ? qr.right - Ln : 0, gn), na.reverse()), qr.height > 0) {
                  var Zt = qr.bottom - (at._offset + at._length);
                  Zt > 0 && (Nr.yb = 0, Nr.b = Zt);
                  var xr = at._offset - qr.top;
                  xr > 0 && (Nr.yt = 1, Nr.t = xr);
                }
                Nr[Re] = at.anchor === "free" ? at.position : at._anchorAxis.domain[na[0]], at.title.text !== $e._dfltTitle[ut] && (Nr[tn] += Ze(at) + (at.title.standoff || 0)), at.mirror && at.anchor !== "free" && ((Zr = { x: 0, y: 0, r: 0, l: 0, t: 0, b: 0 })[Zn] = at.linewidth, at.mirror && at.mirror !== true && (Zr[Zn] += gn), at.mirror === true || at.mirror === "ticks" ? Zr[Re] = at._anchorAxis.domain[na[1]] : at.mirror !== "all" && at.mirror !== "allticks" || (Zr[Re] = [at._counterDomainMin, at._counterDomainMax][na[1]]));
              }
              Wn && (oa = s.getComponentMethod("rangeslider", "autoMarginOpts")(Ye, at)), o.autoMargin(Ye, mt(at), Nr), o.autoMargin(Ye, wt(at), Zr), o.autoMargin(Ye, Et(at), oa);
            }), Ge.skipTitle || Wn && at.side === "bottom" || Yn.push(function() {
              return function(qr, Nr) {
                var Zr, oa = qr._fullLayout, tn = Nr._id, Zn = tn.charAt(0), Ln = Nr.title.font.size;
                if (Nr.title.hasOwnProperty("standoff")) Zr = Nr._depth + Nr.title.standoff + Ze(Nr);
                else {
                  var gn = Jt(Nr);
                  if (Nr.type === "multicategory") Zr = Nr._depth;
                  else {
                    var na = 1.5 * Ln;
                    gn && (na = 0.5 * Ln, Nr.ticks === "outside" && (na += Nr.ticklen)), Zr = 10 + na + (Nr.linewidth ? Nr.linewidth - 1 : 0);
                  }
                  gn || (Zr += Zn === "x" ? Nr.side === "top" ? Ln * (Nr.showticklabels ? 1 : 0) : Ln * (Nr.showticklabels ? 1.5 : 0.5) : Nr.side === "right" ? Ln * (Nr.showticklabels ? 1 : 0.5) : Ln * (Nr.showticklabels ? 0.5 : 0));
                }
                var sr, Ut, Zt, xr, Fr = R2.getPxPosition(qr, Nr);
                if (Zn === "x" ? (Ut = Nr._offset + Nr._length / 2, Zt = Nr.side === "top" ? Fr - Zr : Fr + Zr) : (Zt = Nr._offset + Nr._length / 2, Ut = Nr.side === "right" ? Fr + Zr : Fr - Zr, sr = { rotate: "-90", offset: 0 }), Nr.type !== "multicategory") {
                  var pn = Nr._selections[Nr._id + "tick"];
                  if (xr = { selection: pn, side: Nr.side }, pn && pn.node() && pn.node().parentNode) {
                    var un = h.getTranslate(pn.node().parentNode);
                    xr.offsetLeft = un.x, xr.offsetTop = un.y;
                  }
                  Nr.title.hasOwnProperty("standoff") && (xr.pad = 0);
                }
                return c.draw(qr, tn + "title", { propContainer: Nr, propName: Nr._name + ".title.text", placeholder: oa._dfltTitle[Zn], avoid: xr, transform: sr, attributes: { x: Ut, y: Zt, "text-anchor": "middle" } });
              }(Ye, at);
            }), i.syncOrAsync(Yn);
          }
        }
        function _n(qr) {
          var Nr = Ve + (qr || "tick");
          return ke[Nr] || (ke[Nr] = function(Zr, oa) {
            var tn, Zn, Ln, gn;
            return Zr._selections[oa].size() ? (tn = 1 / 0, Zn = -1 / 0, Ln = 1 / 0, gn = -1 / 0, Zr._selections[oa].each(function() {
              var na = ot(this), sr = h.bBox(na.node().parentNode);
              tn = Math.min(tn, sr.top), Zn = Math.max(Zn, sr.bottom), Ln = Math.min(Ln, sr.left), gn = Math.max(gn, sr.right);
            })) : (tn = 0, Zn = 0, Ln = 0, gn = 0), { top: tn, bottom: Zn, left: Ln, right: gn, height: Zn - tn, width: gn - Ln };
          }(at, Nr)), ke[Nr];
        }
      }, R2.getTickSigns = function(Ye) {
        var at = Ye._id.charAt(0), Ge = { x: "top", y: "right" }[at], st = Ye.side === Ge ? 1 : -1, Ie = [-1, 1, st, -st];
        return Ye.ticks !== "inside" == (at === "x") && (Ie = Ie.map(function(Pe) {
          return -Pe;
        })), Ye.side && Ie.push({ l: -1, t: -1, r: 1, b: 1 }[Ye.side.charAt(0)]), Ie;
      }, R2.makeTransTickFn = function(Ye) {
        return Ye._id.charAt(0) === "x" ? function(at) {
          return l(Ye._offset + Ye.l2p(at.x), 0);
        } : function(at) {
          return l(0, Ye._offset + Ye.l2p(at.x));
        };
      }, R2.makeTransTickLabelFn = function(Ye) {
        var at = function(Ie) {
          var Pe = Ie.ticklabelposition || "", $e = function(Me) {
            return Pe.indexOf(Me) !== -1;
          }, Ve = $e("top"), ut = $e("left"), Re = $e("right"), qe = $e("bottom"), je = $e("inside"), rt = qe || ut || Ve || Re;
          if (!rt && !je) return [0, 0];
          var He = Ie.side, xe = rt ? (Ie.tickwidth || 0) / 2 : 0, Ne = 3, ke = Ie.tickfont ? Ie.tickfont.size : 12;
          return (qe || Ve) && (xe += ke * K2, Ne += (Ie.linewidth || 0) / 2), (ut || Re) && (xe += (Ie.linewidth || 0) / 2, Ne += 3), je && He === "top" && (Ne -= ke * (1 - K2)), (ut || Ve) && (xe = -xe), He !== "bottom" && He !== "right" || (Ne = -Ne), [rt ? xe : 0, je ? Ne : 0];
        }(Ye), Ge = at[0], st = at[1];
        return Ye._id.charAt(0) === "x" ? function(Ie) {
          return l(Ge + Ye._offset + Ye.l2p(ct(Ie)), st);
        } : function(Ie) {
          return l(st, Ge + Ye._offset + Ye.l2p(ct(Ie)));
        };
      }, R2.makeTickPath = function(Ye, at, Ge, st) {
        st = st !== void 0 ? st : Ye.ticklen;
        var Ie = Ye._id.charAt(0), Pe = (Ye.linewidth || 1) / 2;
        return Ie === "x" ? "M0," + (at + Pe * Ge) + "v" + st * Ge : "M" + (at + Pe * Ge) + ",0h" + st * Ge;
      }, R2.makeLabelFns = function(Ye, at, Ge) {
        var st = Ye.ticklabelposition || "", Ie = function(Vt) {
          return st.indexOf(Vt) !== -1;
        }, Pe = Ie("top"), $e = Ie("left"), Ve = Ie("right"), ut = Ie("bottom") || $e || Pe || Ve, Re = Ie("inside"), qe = st === "inside" && Ye.ticks === "inside" || !Re && Ye.ticks === "outside" && Ye.tickson !== "boundaries", je = 0, rt = 0, He = qe ? Ye.ticklen : 0;
        if (Re ? He *= -1 : ut && (He = 0), qe && (je += He, Ge)) {
          var xe = i.deg2rad(Ge);
          je = He * Math.cos(xe) + 1, rt = He * Math.sin(xe);
        }
        Ye.showticklabels && (qe || Ye.showline) && (je += 0.2 * Ye.tickfont.size);
        var Ne, ke, Me, Le, ze, ft = { labelStandoff: je += (Ye.linewidth || 1) / 2 * (Re ? -1 : 1), labelShift: rt }, De = 0, Je = Ye.side, tt = Ye._id.charAt(0), vt = Ye.tickangle;
        if (tt === "x") Le = (ze = !Re && Je === "bottom" || Re && Je === "top") ? 1 : -1, Re && (Le *= -1), Ne = rt * Le, ke = at + je * Le, Me = ze ? 1 : -0.2, Math.abs(vt) === 90 && (Re ? Me += Y2 : Me = vt === -90 && Je === "bottom" ? K2 : vt === 90 && Je === "top" ? Y2 : 0.5, De = Y2 / 2 * (vt / 90)), ft.xFn = function(Vt) {
          return Vt.dx + Ne + De * Vt.fontSize;
        }, ft.yFn = function(Vt) {
          return Vt.dy + ke + Vt.fontSize * Me;
        }, ft.anchorFn = function(Vt, Kt) {
          if (ut) {
            if ($e) return "end";
            if (Ve) return "start";
          }
          return a(Kt) && Kt !== 0 && Kt !== 180 ? Kt * Le < 0 !== Re ? "end" : "start" : "middle";
        }, ft.heightFn = function(Vt, Kt, rr) {
          return Kt < -60 || Kt > 60 ? -0.5 * rr : Ye.side === "top" !== Re ? -rr : 0;
        };
        else if (tt === "y") {
          if (Le = (ze = !Re && Je === "left" || Re && Je === "right") ? 1 : -1, Re && (Le *= -1), Ne = je, ke = rt * Le, Me = 0, Re || Math.abs(vt) !== 90 || (Me = vt === -90 && Je === "left" || vt === 90 && Je === "right" ? K2 : 0.5), Re) {
            var kt = a(vt) ? +vt : 0;
            if (kt !== 0) {
              var jt = i.deg2rad(kt);
              De = Math.abs(Math.sin(jt)) * K2 * Le, Me = 0;
            }
          }
          ft.xFn = function(Vt) {
            return Vt.dx + at - (Ne + Vt.fontSize * Me) * Le + De * Vt.fontSize;
          }, ft.yFn = function(Vt) {
            return Vt.dy + ke + Vt.fontSize * Y2;
          }, ft.anchorFn = function(Vt, Kt) {
            return a(Kt) && Math.abs(Kt) === 90 ? "middle" : ze ? "end" : "start";
          }, ft.heightFn = function(Vt, Kt, rr) {
            return Ye.side === "right" && (Kt *= -1), Kt < -30 ? -rr : Kt < 30 ? -0.5 * rr : 0;
          };
        }
        return ft;
      }, R2.drawTicks = function(Ye, at, Ge) {
        Ge = Ge || {};
        var st = at._id + "tick", Ie = Ge.vals;
        at.ticklabelmode === "period" && (Ie = Ie.slice()).shift();
        var Pe = Ge.layer.selectAll("path." + st).data(at.ticks ? Ie : [], We);
        Pe.exit().remove(), Pe.enter().append("path").classed(st, 1).classed("ticks", 1).classed("crisp", Ge.crisp !== false).call(f.stroke, at.tickcolor).style("stroke-width", h.crispRound(Ye, at.tickwidth, 1) + "px").attr("d", Ge.path).style("display", null), tr(at, [V2]), Pe.attr("transform", Ge.transFn);
      }, R2.drawGrid = function(Ye, at, Ge) {
        Ge = Ge || {};
        var st = at._id + "grid", Ie = Ge.vals, Pe = Ge.counterAxis;
        if (at.showgrid === false) Ie = [];
        else if (Pe && R2.shouldShowZeroLine(Ye, at, Pe)) for (var $e = at.tickmode === "array", Ve = 0; Ve < Ie.length; Ve++) {
          var ut = Ie[Ve].x;
          if ($e ? !ut : Math.abs(ut) < at.dtick / 100) {
            if (Ie = Ie.slice(0, Ve).concat(Ie.slice(Ve + 1)), !$e) break;
            Ve--;
          }
        }
        var Re = Ge.layer.selectAll("path." + st).data(Ie, We);
        Re.exit().remove(), Re.enter().append("path").classed(st, 1).classed("crisp", Ge.crisp !== false), at._gw = h.crispRound(Ye, at.gridwidth, 1), Re.attr("transform", Ge.transFn).attr("d", Ge.path).call(f.stroke, at.gridcolor || "#ddd").style("stroke-width", at._gw + "px").style("display", null), tr(at, [L2]), typeof Ge.path == "function" && Re.attr("d", Ge.path);
      }, R2.drawZeroLine = function(Ye, at, Ge) {
        Ge = Ge || Ge;
        var st = at._id + "zl", Ie = R2.shouldShowZeroLine(Ye, at, Ge.counterAxis), Pe = Ge.layer.selectAll("path." + st).data(Ie ? [{ x: 0, id: at._id }] : []);
        Pe.exit().remove(), Pe.enter().append("path").classed(st, 1).classed("zl", 1).classed("crisp", Ge.crisp !== false).each(function() {
          Ge.layer.selectAll("path").sort(function($e, Ve) {
            return te($e.id, Ve.id);
          });
        }), Pe.attr("transform", Ge.transFn).attr("d", Ge.path).call(f.stroke, at.zerolinecolor || f.defaultLine).style("stroke-width", h.crispRound(Ye, at.zerolinewidth, at._gw || 1) + "px").style("display", null), tr(at, [O2]);
      }, R2.drawLabels = function(Ye, at, Ge) {
        Ge = Ge || {};
        var st = Ye._fullLayout, Ie = at._id, Pe = Ie.charAt(0), $e = Ge.cls || Ie + "tick", Ve = Ge.vals, ut = Ge.labelFns, Re = Ge.secondary ? 0 : at.tickangle, qe = (at._prevTickAngles || {})[$e], je = Ge.layer.selectAll("g." + $e).data(at.showticklabels ? Ve : [], We), rt = [];
        function He(Le, ze) {
          Le.each(function(ft) {
            var De = n.select(this), Je = De.select(".text-math-group"), tt = ut.anchorFn(ft, ze), vt = Ge.transFn.call(De.node(), ft) + (a(ze) && +ze != 0 ? " rotate(" + ze + "," + ut.xFn(ft) + "," + (ut.yFn(ft) - ft.fontSize / 2) + ")" : ""), kt = u2.lineCount(De), jt = q * ft.fontSize, Vt = ut.heightFn(ft, a(ze) ? +ze : 0, (kt - 1) * jt);
            if (Vt && (vt += l(0, Vt)), Je.empty()) {
              var Kt = De.select("text");
              Kt.attr({ transform: vt, "text-anchor": tt }), Kt.style("opacity", 1), at._adjustTickLabelsOverflow && at._adjustTickLabelsOverflow();
            } else {
              var rr = h.bBox(Je.node()).width * { end: -0.5, start: 0.5 }[tt];
              Je.attr("transform", vt + l(rr, 0));
            }
          });
        }
        je.enter().append("g").classed($e, 1).append("text").attr("text-anchor", "middle").each(function(Le) {
          var ze = n.select(this), ft = Ye._promises.length;
          ze.call(u2.positionText, ut.xFn(Le), ut.yFn(Le)).call(h.font, Le.font, Le.fontSize, Le.fontColor).text(Le.text).call(u2.convertToTspans, Ye), Ye._promises[ft] ? rt.push(Ye._promises.pop().then(function() {
            He(ze, Re);
          })) : He(ze, Re);
        }), tr(at, [W2]), je.exit().remove(), Ge.repositionOnUpdate && je.each(function(Le) {
          n.select(this).select("text").call(u2.positionText, ut.xFn(Le), ut.yFn(Le));
        }), at._adjustTickLabelsOverflow = function() {
          var Le = at.ticklabeloverflow;
          if (Le && Le !== "allow") {
            var ze = Le.indexOf("hide") !== -1, ft = at._id.charAt(0) === "x", De = 0, Je = ft ? Ye._fullLayout.width : Ye._fullLayout.height;
            if (Le.indexOf("domain") !== -1) {
              var tt = i.simpleMap(at.range, at.r2l);
              De = at.l2p(tt[0]) + at._offset, Je = at.l2p(tt[1]) + at._offset;
            }
            var vt = Math.min(De, Je), kt = Math.max(De, Je), jt = at.side, Vt = 1 / 0, Kt = -1 / 0;
            for (var rr in je.each(function(pr) {
              var lr = n.select(this);
              if (lr.select(".text-math-group").empty()) {
                var _r = h.bBox(lr.node()), $r = 0;
                ft ? (_r.right > kt || _r.left < vt) && ($r = 1) : (_r.bottom > kt || _r.top + (at.tickangle ? 0 : pr.fontSize / 4) < vt) && ($r = 1);
                var Ar = lr.select("text");
                $r ? ze && Ar.style("opacity", 0) : (Ar.style("opacity", 1), Vt = jt === "bottom" || jt === "right" ? Math.min(Vt, ft ? _r.top : _r.left) : -1 / 0, Kt = jt === "top" || jt === "left" ? Math.max(Kt, ft ? _r.bottom : _r.right) : 1 / 0);
              }
            }), st._plots) {
              var Tr = st._plots[rr];
              if (at._id === Tr.xaxis._id || at._id === Tr.yaxis._id) {
                var yr = ft ? Tr.yaxis : Tr.xaxis;
                yr && (yr["_visibleLabelMin_" + at._id] = Vt, yr["_visibleLabelMax_" + at._id] = Kt);
              }
            }
          }
        }, at._hideCounterAxisInsideTickLabels = function(Le) {
          var ze = at._id.charAt(0) === "x", ft = [];
          for (var De in st._plots) {
            var Je = st._plots[De];
            at._id !== Je.xaxis._id && at._id !== Je.yaxis._id || ft.push(ze ? Je.yaxis : Je.xaxis);
          }
          ft.forEach(function(tt, vt) {
            tt && Jt(tt) && (Le || [O2, L2, V2, W2]).forEach(function(kt) {
              var jt = kt.K === "tick" && kt.L === "text" && at.ticklabelmode === "period", Vt = st._plots[at._mainSubplot];
              (kt.K === O2.K ? Vt.zerolinelayer.selectAll("." + at._id + "zl") : kt.K === L2.K ? Vt.gridlayer.selectAll("." + at._id) : Vt[at._id.charAt(0) + "axislayer"]).each(function() {
                var Kt = n.select(this);
                kt.L && (Kt = Kt.selectAll(kt.L)), Kt.each(function(rr) {
                  var Tr = at.l2p(jt ? ct(rr) : rr.x) + at._offset, yr = n.select(this);
                  Tr < at["_visibleLabelMax_" + tt._id] && Tr > at["_visibleLabelMin_" + tt._id] ? yr.style("display", "none") : kt.K !== "tick" || vt || yr.style("display", null);
                });
              });
            });
          });
        }, He(je, qe + 1 ? qe : Re);
        var xe = null;
        at._selections && (at._selections[$e] = je);
        var Ne = [function() {
          return rt.length && Promise.all(rt);
        }];
        at.automargin && st._redrawFromAutoMarginCount && qe === 90 ? (xe = 90, Ne.push(function() {
          He(je, qe);
        })) : Ne.push(function() {
          if (He(je, Re), Ve.length && Pe === "x" && !a(Re) && (at.type !== "log" || String(at.dtick).charAt(0) !== "D")) {
            xe = 0;
            var Le, ze = 0, ft = [];
            if (je.each(function(lr) {
              ze = Math.max(ze, lr.fontSize);
              var _r = at.l2p(lr.x), $r = ot(this), Ar = h.bBox($r.node());
              ft.push({ top: 0, bottom: 10, height: 10, left: _r - Ar.width / 2, right: _r + Ar.width / 2 + 2, width: Ar.width + 2 });
            }), at.tickson !== "boundaries" && !at.showdividers || Ge.secondary) {
              var De = Ve.length, Je = Math.abs((Ve[De - 1].x - Ve[0].x) * at._m) / (De - 1), tt = at.ticklabelposition || "", vt = function(lr) {
                return tt.indexOf(lr) !== -1;
              }, kt = vt("top"), jt = vt("left"), Vt = vt("right"), Kt = vt("bottom") || jt || kt || Vt ? (at.tickwidth || 0) + 6 : 0, rr = Je < 2.5 * ze || at.type === "multicategory" || at._name === "realaxis";
              for (Le = 0; Le < ft.length - 1; Le++) if (i.bBoxIntersect(ft[Le], ft[Le + 1], Kt)) {
                xe = rr ? 90 : 30;
                break;
              }
            } else {
              var Tr = 2;
              for (at.ticks && (Tr += at.tickwidth / 2), Le = 0; Le < ft.length; Le++) {
                var yr = Ve[Le].xbnd, pr = ft[Le];
                if (yr[0] !== null && pr.left - at.l2p(yr[0]) < Tr || yr[1] !== null && at.l2p(yr[1]) - pr.right < Tr) {
                  xe = 90;
                  break;
                }
              }
            }
            xe && He(je, xe);
          }
        }), at._tickAngles && Ne.push(function() {
          at._tickAngles[$e] = xe === null ? a(Re) ? Re : 0 : xe;
        });
        var ke = at._anchorAxis;
        ke && ke.autorange && Jt(at) && !j(st, at._id) && (st._insideTickLabelsAutorange || (st._insideTickLabelsAutorange = {}), st._insideTickLabelsAutorange[ke._name + ".autorange"] = ke.autorange, Ne.push(function() {
          je.each(function(Le, ze) {
            var ft = ot(this);
            ft.select(".text-math-group").empty() && (at._vals[ze].bb = h.bBox(ft.node()));
          });
        }));
        var Me = i.syncOrAsync(Ne);
        return Me && Me.then && Ye._promises.push(Me), Me;
      }, R2.getPxPosition = function(Ye, at) {
        var Ge, st = Ye._fullLayout._size, Ie = at._id.charAt(0), Pe = at.side;
        return at.anchor !== "free" ? Ge = at._anchorAxis : Ie === "x" ? Ge = { _offset: st.t + (1 - (at.position || 0)) * st.h, _length: 0 } : Ie === "y" && (Ge = { _offset: st.l + (at.position || 0) * st.w, _length: 0 }), Pe === "top" || Pe === "left" ? Ge._offset : Pe === "bottom" || Pe === "right" ? Ge._offset + Ge._length : void 0;
      }, R2.shouldShowZeroLine = function(Ye, at, Ge) {
        var st = i.simpleMap(at.range, at.r2l);
        return st[0] * st[1] <= 0 && at.zeroline && (at.type === "linear" || at.type === "-") && !(at.rangebreaks && at.maskBreaks(0) === I2) && (it(at, 0) || !function(Ie, Pe, $e, Ve) {
          var ut = $e._mainAxis;
          if (!ut) return;
          var Re = Ie._fullLayout, qe = Pe._id.charAt(0), je = R2.counterLetter(Pe._id), rt = Pe._offset + (Math.abs(Ve[0]) < Math.abs(Ve[1]) == (qe === "x") ? 0 : Pe._length);
          function He(Le) {
            if (!Le.showline || !Le.linewidth) return false;
            var ze = Math.max((Le.linewidth + Pe.zerolinewidth) / 2, 1);
            function ft(tt) {
              return typeof tt == "number" && Math.abs(tt - rt) < ze;
            }
            if (ft(Le._mainLinePosition) || ft(Le._mainMirrorPosition)) return true;
            var De = Le._linepositions || {};
            for (var Je in De) if (ft(De[Je][0]) || ft(De[Je][1])) return true;
          }
          var xe = Re._plots[$e._mainSubplot];
          if (!(xe.mainplotinfo || xe).overlays.length) return He($e);
          for (var Ne = R2.list(Ie, je), ke = 0; ke < Ne.length; ke++) {
            var Me = Ne[ke];
            if (Me._mainAxis === ut && He(Me)) return true;
          }
        }(Ye, at, Ge, st) || function(Ie, Pe) {
          for (var $e = Ie._fullData, Ve = Pe._mainSubplot, ut = Pe._id.charAt(0), Re = 0; Re < $e.length; Re++) {
            var qe = $e[Re];
            if (qe.visible === true && qe.xaxis + qe.yaxis === Ve && (s.traceIs(qe, "bar-like") && qe.orientation === { x: "h", y: "v" }[ut] || qe.fill && qe.fill.charAt(qe.fill.length - 1) === ut)) return true;
          }
          return false;
        }(Ye, at));
      }, R2.clipEnds = function(Ye, at) {
        return at.filter(function(Ge) {
          return it(Ye, Ge.x);
        });
      }, R2.allowAutoMargin = function(Ye) {
        for (var at = R2.list(Ye, "", true), Ge = 0; Ge < at.length; Ge++) {
          var st = at[Ge];
          st.automargin && (o.allowAutoMargin(Ye, mt(st)), st.mirror && o.allowAutoMargin(Ye, wt(st))), s.getComponentMethod("rangeslider", "isVisible")(st) && o.allowAutoMargin(Ye, Et(st));
        }
      }, R2.swap = function(Ye, at) {
        for (var Ge = function(Ie, Pe) {
          var $e, Ve, ut = [];
          for ($e = 0; $e < Pe.length; $e++) {
            var Re = [], qe = Ie._fullData[Pe[$e]].xaxis, je = Ie._fullData[Pe[$e]].yaxis;
            if (qe && je) {
              for (Ve = 0; Ve < ut.length; Ve++) ut[Ve].x.indexOf(qe) === -1 && ut[Ve].y.indexOf(je) === -1 || Re.push(Ve);
              if (Re.length) {
                var rt, He = ut[Re[0]];
                if (Re.length > 1) for (Ve = 1; Ve < Re.length; Ve++) rt = ut[Re[Ve]], zt(He.x, rt.x), zt(He.y, rt.y);
                zt(He.x, [qe]), zt(He.y, [je]);
              } else ut.push({ x: [qe], y: [je] });
            }
          }
          return ut;
        }(Ye, at), st = 0; st < Ge.length; st++) Nt(Ye, Ge[st].x, Ge[st].y);
      };
    }, { "../../components/color": 366, "../../components/drawing": 388, "../../components/titles": 464, "../../constants/alignment": 471, "../../constants/numerical": 479, "../../lib": 503, "../../lib/svg_text_utils": 529, "../../plots/plots": 619, "../../registry": 638, "./autorange": 553, "./axis_autotype": 555, "./axis_ids": 558, "./clean_ticks": 560, "./layout_attributes": 569, "./set_convert": 576, "@plotly/d3": 58, "fast-isnumeric": 190 }], 555: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("../../lib"), o = e("../../constants/numerical").BADNUM, s = a.isArrayOrTypedArray, i = a.isDateTime, l = a.cleanNumber, u2 = Math.round;
      function c(h, p) {
        return p ? n(h) : typeof h == "number";
      }
      function f(h) {
        return Math.max(1, (h - 1) / 1e3);
      }
      t.exports = function(h, p, d) {
        var v = h, m = d.noMultiCategory;
        if (s(v) && !v.length) return "-";
        if (!m && function(w) {
          return s(w[0]) && s(w[1]);
        }(v)) return "multicategory";
        if (m && Array.isArray(v[0])) {
          for (var g = [], x = 0; x < v.length; x++) if (s(v[x])) for (var b = 0; b < v[x].length; b++) g.push(v[x][b]);
          v = g;
        }
        if (function(w, _4) {
          for (var k = w.length, T2 = f(k), A2 = 0, S2 = 0, C2 = {}, E2 = 0; E2 < k; E2 += T2) {
            var F13 = u2(E2), N2 = w[F13], D2 = String(N2);
            C2[D2] || (C2[D2] = 1, i(N2, _4) && A2++, n(N2) && S2++);
          }
          return A2 > 2 * S2;
        }(v, p)) return "date";
        var y = d.autotypenumbers !== "strict";
        return function(w, _4) {
          for (var k = w.length, T2 = f(k), A2 = 0, S2 = 0, C2 = {}, E2 = 0; E2 < k; E2 += T2) {
            var F13 = u2(E2), N2 = w[F13], D2 = String(N2);
            if (!C2[D2]) {
              C2[D2] = 1;
              var I2 = typeof N2;
              I2 === "boolean" ? S2++ : (_4 ? l(N2) !== o : I2 === "number") ? A2++ : I2 === "string" && S2++;
            }
          }
          return S2 > 2 * A2;
        }(v, y) ? "category" : function(w, _4) {
          for (var k = w.length, T2 = 0; T2 < k; T2++) if (c(w[T2], _4)) return true;
          return false;
        }(v, y) ? "linear" : "-";
      };
    }, { "../../constants/numerical": 479, "../../lib": 503, "fast-isnumeric": 190 }], 556: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("../../registry"), o = e("../../lib"), s = e("../array_container_defaults"), i = e("./layout_attributes"), l = e("./tick_value_defaults"), u2 = e("./tick_mark_defaults"), c = e("./tick_label_defaults"), f = e("./prefix_suffix_defaults"), h = e("./category_order_defaults"), p = e("./line_grid_defaults"), d = e("./set_convert"), v = e("./constants").WEEKDAY_PATTERN, m = e("./constants").HOUR_PATTERN;
      function g(y, w, _4) {
        function k(D2, I2) {
          return o.coerce(y, w, i.rangebreaks, D2, I2);
        }
        if (k("enabled")) {
          var T2 = k("bounds");
          if (T2 && T2.length >= 2) {
            var A2, S2, C2 = "";
            if (T2.length === 2) {
              for (A2 = 0; A2 < 2; A2++) if (S2 = b(T2[A2])) {
                C2 = v;
                break;
              }
            }
            var E2 = k("pattern", C2);
            if (E2 === v) for (A2 = 0; A2 < 2; A2++) (S2 = b(T2[A2])) && (w.bounds[A2] = T2[A2] = S2 - 1);
            if (E2) for (A2 = 0; A2 < 2; A2++) switch (S2 = T2[A2], E2) {
              case v:
                if (!n(S2) || (S2 = +S2) !== Math.floor(S2) || S2 < 0 || S2 >= 7) return void (w.enabled = false);
                w.bounds[A2] = T2[A2] = S2;
                break;
              case m:
                if (!n(S2) || (S2 = +S2) < 0 || S2 > 24) return void (w.enabled = false);
                w.bounds[A2] = T2[A2] = S2;
            }
            if (_4.autorange === false) {
              var F13 = _4.range;
              if (F13[0] < F13[1]) {
                if (T2[0] < F13[0] && T2[1] > F13[1]) return void (w.enabled = false);
              } else if (T2[0] > F13[0] && T2[1] < F13[1]) return void (w.enabled = false);
            }
          } else {
            var N2 = k("values");
            if (!N2 || !N2.length) return void (w.enabled = false);
            k("dvalue");
          }
        }
      }
      t.exports = function(y, w, _4, k, T2) {
        var A2, S2 = k.letter, C2 = k.font || {}, E2 = k.splomStash || {}, F13 = _4("visible", !k.visibleDflt), N2 = w._template || {}, D2 = w.type || N2.type || "-";
        D2 === "date" && (a.getComponentMethod("calendars", "handleDefaults")(y, w, "calendar", k.calendar), k.noTicklabelmode || (A2 = _4("ticklabelmode")));
        var I2 = "";
        k.noTicklabelposition && D2 !== "multicategory" || (I2 = o.coerce(y, w, { ticklabelposition: { valType: "enumerated", dflt: "outside", values: A2 === "period" ? ["outside", "inside"] : S2 === "x" ? ["outside", "inside", "outside left", "inside left", "outside right", "inside right"] : ["outside", "inside", "outside top", "inside top", "outside bottom", "inside bottom"] } }, "ticklabelposition")), k.noTicklabeloverflow || _4("ticklabeloverflow", I2.indexOf("inside") !== -1 ? "hide past domain" : D2 === "category" || D2 === "multicategory" ? "allow" : "hide past div"), d(w, T2);
        var O2 = !w.isValidRange(y.range);
        O2 && k.reverseDflt && (O2 = "reversed"), !_4("autorange", O2) || D2 !== "linear" && D2 !== "-" || _4("rangemode"), _4("range"), w.cleanRange(), h(y, w, _4, k), D2 === "category" || k.noHover || _4("hoverformat");
        var L2 = _4("color"), V2 = L2 !== i.color.dflt ? L2 : C2.color, W2 = E2.label || T2._dfltTitle[S2];
        if (f(y, w, _4, D2, k), !F13) return w;
        _4("title.text", W2), o.coerceFont(_4, "title.font", { family: C2.family, size: o.bigFont(C2.size), color: V2 }), l(y, w, _4, D2), c(y, w, _4, D2, k), u2(y, w, _4, k), p(y, w, _4, { dfltColor: L2, bgColor: k.bgColor, showGrid: k.showGrid, attributes: i }), (w.showline || w.ticks) && _4("mirror"), k.automargin && _4("automargin");
        var X2, Y2 = D2 === "multicategory";
        if (k.noTickson || D2 !== "category" && !Y2 || !w.ticks && !w.showgrid || (Y2 && (X2 = "boundaries"), _4("tickson", X2) === "boundaries" && delete w.ticklabelposition), Y2 && _4("showdividers") && (_4("dividercolor"), _4("dividerwidth")), D2 === "date") if (s(y, w, { name: "rangebreaks", inclusionAttr: "enabled", handleItemDefaults: g }), w.rangebreaks.length) {
          for (var K2 = 0; K2 < w.rangebreaks.length; K2++) if (w.rangebreaks[K2].pattern === v) {
            w._hasDayOfWeekBreaks = true;
            break;
          }
          if (d(w, T2), T2._has("scattergl") || T2._has("splom")) for (var q = 0; q < k.data.length; q++) {
            var re = k.data[q];
            re.type !== "scattergl" && re.type !== "splom" || (re.visible = false, o.warn(re.type + " traces do not work on axes with rangebreaks. Setting trace " + re.index + " to `visible: false`."));
          }
        } else delete w.rangebreaks;
        return w;
      };
      var x = { sun: 1, mon: 2, tue: 3, wed: 4, thu: 5, fri: 6, sat: 7 };
      function b(y) {
        if (typeof y == "string") return x[y.substr(0, 3).toLowerCase()];
      }
    }, { "../../lib": 503, "../../registry": 638, "../array_container_defaults": 549, "./category_order_defaults": 559, "./constants": 561, "./layout_attributes": 569, "./line_grid_defaults": 571, "./prefix_suffix_defaults": 573, "./set_convert": 576, "./tick_label_defaults": 578, "./tick_mark_defaults": 579, "./tick_value_defaults": 580, "fast-isnumeric": 190 }], 557: [function(e, t, r) {
      "use strict";
      var n = e("../../constants/docs"), a = n.FORMAT_LINK, o = n.DATE_FORMAT_LINK;
      function s(l, u2) {
        return ["Sets the " + l + " formatting rule" + (u2 ? "for `" + u2 + "` " : ""), "using d3 formatting mini-languages", "which are very similar to those in Python. For numbers, see: " + a + "."].join(" ");
      }
      function i(l, u2) {
        return s(l, u2) + [" And for dates see: " + o + ".", "We add two items to d3's date formatter:", "*%h* for half of the year as a decimal number as well as", "*%{n}f* for fractional seconds", "with n digits. For example, *2016-10-13 09:15:23.456* with tickformat", "*%H~%M~%S.%2f* would display *09~15~23.46*"].join(" ");
      }
      t.exports = { axisHoverFormat: function(l, u2) {
        return { valType: "string", dflt: "", editType: "none", description: (u2 ? s : i)("hover text", l) + ["By default the values are formatted using " + (u2 ? "generic number format" : "`" + l + "axis.hoverformat`") + "."].join(" ") };
      }, descriptionOnlyNumbers: s, descriptionWithDates: i };
    }, { "../../constants/docs": 474 }], 558: [function(e, t, r) {
      "use strict";
      var n = e("../../registry"), a = e("./constants");
      function o(s, i) {
        if (i && i.length) {
          for (var l = 0; l < i.length; l++) if (i[l][s]) return true;
        }
        return false;
      }
      r.id2name = function(s) {
        if (typeof s == "string" && s.match(a.AX_ID_PATTERN)) {
          var i = s.split(" ")[0].substr(1);
          return i === "1" && (i = ""), s.charAt(0) + "axis" + i;
        }
      }, r.name2id = function(s) {
        if (s.match(a.AX_NAME_PATTERN)) {
          var i = s.substr(5);
          return i === "1" && (i = ""), s.charAt(0) + i;
        }
      }, r.cleanId = function(s, i, l) {
        var u2 = /( domain)$/.test(s);
        if (typeof s == "string" && s.match(a.AX_ID_PATTERN) && (!i || s.charAt(0) === i) && (!u2 || l)) {
          var c = s.split(" ")[0].substr(1).replace(/^0+/, "");
          return c === "1" && (c = ""), s.charAt(0) + c + (u2 && l ? " domain" : "");
        }
      }, r.list = function(s, i, l) {
        var u2 = s._fullLayout;
        if (!u2) return [];
        var c, f = r.listIds(s, i), h = new Array(f.length);
        for (c = 0; c < f.length; c++) {
          var p = f[c];
          h[c] = u2[p.charAt(0) + "axis" + p.substr(1)];
        }
        if (!l) {
          var d = u2._subplots.gl3d || [];
          for (c = 0; c < d.length; c++) {
            var v = u2[d[c]];
            i ? h.push(v[i + "axis"]) : h.push(v.xaxis, v.yaxis, v.zaxis);
          }
        }
        return h;
      }, r.listIds = function(s, i) {
        var l = s._fullLayout;
        if (!l) return [];
        var u2 = l._subplots;
        return i ? u2[i + "axis"] : u2.xaxis.concat(u2.yaxis);
      }, r.getFromId = function(s, i, l) {
        var u2 = s._fullLayout;
        return i = i === void 0 || typeof i != "string" ? i : i.replace(" domain", ""), l === "x" ? i = i.replace(/y[0-9]*/, "") : l === "y" && (i = i.replace(/x[0-9]*/, "")), u2[r.id2name(i)];
      }, r.getFromTrace = function(s, i, l) {
        var u2 = s._fullLayout, c = null;
        if (n.traceIs(i, "gl3d")) {
          var f = i.scene;
          f.substr(0, 5) === "scene" && (c = u2[f][l + "axis"]);
        } else c = r.getFromId(s, i[l + "axis"] || l);
        return c;
      }, r.idSort = function(s, i) {
        var l = s.charAt(0), u2 = i.charAt(0);
        return l !== u2 ? l > u2 ? 1 : -1 : +(s.substr(1) || 1) - +(i.substr(1) || 1);
      }, r.ref2id = function(s) {
        return !!/^[xyz]/.test(s) && s.split(" ")[0];
      }, r.isLinked = function(s, i) {
        return o(i, s._axisMatchGroups) || o(i, s._axisConstraintGroups);
      };
    }, { "../../registry": 638, "./constants": 561 }], 559: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a, o, s) {
        if (a.type === "category") {
          var i, l = n.categoryarray, u2 = Array.isArray(l) && l.length > 0;
          u2 && (i = "array");
          var c, f = o("categoryorder", i);
          f === "array" && (c = o("categoryarray")), u2 || f !== "array" || (f = a.categoryorder = "trace"), f === "trace" ? a._initialCategories = [] : f === "array" ? a._initialCategories = c.slice() : (c = function(h, p) {
            var d, v, m, g = p.dataAttr || h._id.charAt(0), x = {};
            if (p.axData) d = p.axData;
            else for (d = [], v = 0; v < p.data.length; v++) {
              var b = p.data[v];
              b[g + "axis"] === h._id && d.push(b);
            }
            for (v = 0; v < d.length; v++) {
              var y = d[v][g];
              for (m = 0; m < y.length; m++) {
                var w = y[m];
                w != null && (x[w] = 1);
              }
            }
            return Object.keys(x);
          }(a, s).sort(), f === "category ascending" ? a._initialCategories = c : f === "category descending" && (a._initialCategories = c.reverse()));
        }
      };
    }, {}], 560: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("../../lib"), o = e("../../constants/numerical"), s = o.ONEDAY, i = o.ONEWEEK;
      r.dtick = function(l, u2) {
        var c = u2 === "log", f = u2 === "date", h = u2 === "category", p = f ? s : 1;
        if (!l) return p;
        if (n(l)) return (l = Number(l)) <= 0 ? p : h ? Math.max(1, Math.round(l)) : f ? Math.max(0.1, l) : l;
        if (typeof l != "string" || !f && !c) return p;
        var d = l.charAt(0), v = l.substr(1);
        return (v = n(v) ? Number(v) : 0) <= 0 || !(f && d === "M" && v === Math.round(v) || c && d === "L" || c && d === "D" && (v === 1 || v === 2)) ? p : l;
      }, r.tick0 = function(l, u2, c, f) {
        return u2 === "date" ? a.cleanDate(l, a.dateTick0(c, f % i == 0 ? 1 : 0)) : f !== "D1" && f !== "D2" ? n(l) ? Number(l) : 0 : void 0;
      };
    }, { "../../constants/numerical": 479, "../../lib": 503, "fast-isnumeric": 190 }], 561: [function(e, t, r) {
      "use strict";
      var n = e("../../lib/regex").counter;
      t.exports = { idRegex: { x: n("x", "( domain)?"), y: n("y", "( domain)?") }, attrRegex: n("[xy]axis"), xAxisMatch: n("xaxis"), yAxisMatch: n("yaxis"), AX_ID_PATTERN: /^[xyz][0-9]*( domain)?$/, AX_NAME_PATTERN: /^[xyz]axis[0-9]*$/, SUBPLOT_PATTERN: /^x([0-9]*)y([0-9]*)$/, HOUR_PATTERN: "hour", WEEKDAY_PATTERN: "day of week", MINDRAG: 8, MINSELECT: 12, MINZOOM: 20, DRAGGERSIZE: 20, BENDPX: 1.5, REDRAWDELAY: 50, SELECTDELAY: 100, SELECTID: "-select", DFLTRANGEX: [-1, 6], DFLTRANGEY: [-1, 4], traceLayerClasses: ["imagelayer", "heatmaplayer", "contourcarpetlayer", "contourlayer", "funnellayer", "waterfalllayer", "barlayer", "carpetlayer", "violinlayer", "boxlayer", "ohlclayer", "scattercarpetlayer", "scatterlayer"], clipOnAxisFalseQuery: [".scatterlayer", ".barlayer", ".funnellayer", ".waterfalllayer"], layerValue2layerClass: { "above traces": "above", "below traces": "below" } };
    }, { "../../lib/regex": 520 }], 562: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("./autorange"), o = e("./axis_ids").id2name, s = e("./layout_attributes"), i = e("./scale_zoom"), l = e("./set_convert"), u2 = e("../../constants/numerical").ALMOST_EQUAL, c = e("../../constants/alignment").FROM_BL;
      function f(x, b, y) {
        var w = y.axIds, _4 = y.layoutOut, k = y.hasImage, T2 = _4._axisConstraintGroups, A2 = _4._axisMatchGroups, S2 = b._id, C2 = S2.charAt(0), E2 = ((_4._splomAxes || {})[C2] || {})[S2] || {}, F13 = b._id, N2 = F13.charAt(0) === "x";
        function D2(te, j) {
          return n.coerce(x, b, s, te, j);
        }
        b._matchGroup = null, b._constraintGroup = null, D2("constrain", k ? "domain" : "range"), n.coerce(x, b, { constraintoward: { valType: "enumerated", values: N2 ? ["left", "center", "right"] : ["bottom", "middle", "top"], dflt: N2 ? "center" : "middle" } }, "constraintoward");
        var I2, O2, L2 = b.type, V2 = [];
        for (I2 = 0; I2 < w.length; I2++) (O2 = w[I2]) !== F13 && _4[o(O2)].type === L2 && V2.push(O2);
        var W2 = p(T2, F13);
        if (W2) {
          var X2 = [];
          for (I2 = 0; I2 < V2.length; I2++) W2[O2 = V2[I2]] || X2.push(O2);
          V2 = X2;
        }
        var Y2, K2, q = V2.length;
        q && (x.matches || E2.matches) && (Y2 = n.coerce(x, b, { matches: { valType: "enumerated", values: V2, dflt: V2.indexOf(E2.matches) !== -1 ? E2.matches : void 0 } }, "matches"));
        var re = k && !N2 ? b.anchor : void 0;
        if (q && !Y2 && (x.scaleanchor || re) && (K2 = n.coerce(x, b, { scaleanchor: { valType: "enumerated", values: V2 } }, "scaleanchor", re)), Y2) {
          b._matchGroup = d(A2, F13, Y2, 1);
          var R2 = _4[o(Y2)], z = h(_4, b) / h(_4, R2);
          N2 !== (Y2.charAt(0) === "x") && (z = (N2 ? "x" : "y") + z), d(T2, F13, Y2, z);
        } else x.matches && w.indexOf(x.matches) !== -1 && n.warn("ignored " + b._name + '.matches: "' + x.matches + '" to avoid an infinite loop');
        if (K2) {
          var H2 = D2("scaleratio");
          H2 || (H2 = b.scaleratio = 1), d(T2, F13, K2, H2);
        } else x.scaleanchor && w.indexOf(x.scaleanchor) !== -1 && n.warn("ignored " + b._name + '.scaleanchor: "' + x.scaleanchor + '" to avoid either an infinite loop and possibly inconsistent scaleratios, or because this axis declares a *matches* constraint.');
      }
      function h(x, b) {
        var y = b.domain;
        return y || (y = x[o(b.overlaying)].domain), y[1] - y[0];
      }
      function p(x, b) {
        for (var y = 0; y < x.length; y++) if (x[y][b]) return x[y];
        return null;
      }
      function d(x, b, y, w) {
        var _4, k, T2, A2, S2, C2 = p(x, b);
        C2 === null ? ((C2 = {})[b] = 1, S2 = x.length, x.push(C2)) : S2 = x.indexOf(C2);
        var E2 = Object.keys(C2);
        for (_4 = 0; _4 < x.length; _4++) if (T2 = x[_4], _4 !== S2 && T2[y]) {
          var F13 = T2[y];
          for (k = 0; k < E2.length; k++) T2[A2 = E2[k]] = v(F13, v(w, C2[A2]));
          return void x.splice(S2, 1);
        }
        if (w !== 1) for (k = 0; k < E2.length; k++) {
          var N2 = E2[k];
          C2[N2] = v(w, C2[N2]);
        }
        C2[y] = 1;
      }
      function v(x, b) {
        var y, w, _4 = "", k = "";
        typeof x == "string" && (y = (_4 = x.match(/^[xy]*/)[0]).length, x = +x.substr(y)), typeof b == "string" && (w = (k = b.match(/^[xy]*/)[0]).length, b = +b.substr(w));
        var T2 = x * b;
        return y || w ? y && w && _4.charAt(0) !== k.charAt(0) ? y === w ? T2 : (y > w ? _4.substr(w) : k.substr(y)) + T2 : _4 + k + x * b : T2;
      }
      function m(x, b) {
        for (var y = b._size, w = y.h / y.w, _4 = {}, k = Object.keys(x), T2 = 0; T2 < k.length; T2++) {
          var A2 = k[T2], S2 = x[A2];
          if (typeof S2 == "string") {
            var C2 = S2.match(/^[xy]*/)[0], E2 = C2.length;
            S2 = +S2.substr(E2);
            for (var F13 = C2.charAt(0) === "y" ? w : 1 / w, N2 = 0; N2 < E2; N2++) S2 *= F13;
          }
          _4[A2] = S2;
        }
        return _4;
      }
      function g(x, b) {
        var y = x._inputDomain, w = c[x.constraintoward], _4 = y[0] + (y[1] - y[0]) * w;
        x.domain = x._input.domain = [_4 + (y[0] - _4) / b, _4 + (y[1] - _4) / b], x.setScale();
      }
      r.handleDefaults = function(x, b, y) {
        var w, _4, k, T2, A2, S2, C2, E2, F13 = y.axIds, N2 = y.axHasImage, D2 = b._axisConstraintGroups = [], I2 = b._axisMatchGroups = [];
        for (w = 0; w < F13.length; w++) f(A2 = x[T2 = o(F13[w])], S2 = b[T2], { axIds: F13, layoutOut: b, hasImage: N2[T2] });
        function O2(R2, z) {
          for (w = 0; w < R2.length; w++) for (k in _4 = R2[w]) b[o(k)][z] = _4;
        }
        for (O2(I2, "_matchGroup"), w = 0; w < D2.length; w++) for (k in _4 = D2[w]) if ((S2 = b[o(k)]).fixedrange) {
          for (var L2 in _4) {
            var V2 = o(L2);
            (x[V2] || {}).fixedrange === false && n.warn("fixedrange was specified as false for axis " + V2 + " but was overridden because another axis in its constraint group has fixedrange true"), b[V2].fixedrange = true;
          }
          break;
        }
        for (w = 0; w < D2.length; ) {
          for (k in _4 = D2[w]) {
            (S2 = b[o(k)])._matchGroup && Object.keys(S2._matchGroup).length === Object.keys(_4).length && (D2.splice(w, 1), w--);
            break;
          }
          w++;
        }
        O2(D2, "_constraintGroup");
        var W2 = ["constrain", "range", "autorange", "rangemode", "rangebreaks", "categoryorder", "categoryarray"], X2 = false, Y2 = false;
        function K2() {
          E2 = S2[C2], C2 === "rangebreaks" && (Y2 = S2._hasDayOfWeekBreaks);
        }
        for (w = 0; w < I2.length; w++) {
          _4 = I2[w];
          for (var q = 0; q < W2.length; q++) {
            var re;
            for (k in C2 = W2[q], E2 = null, _4) if (A2 = x[T2 = o(k)], S2 = b[T2], C2 in S2) {
              if (!S2.matches && (re = S2, C2 in A2)) {
                K2();
                break;
              }
              E2 === null && C2 in A2 && K2();
            }
            if (C2 === "range" && E2 && (X2 = true), C2 === "autorange" && E2 === null && X2 && (E2 = false), E2 === null && C2 in re && (E2 = re[C2]), E2 !== null) for (k in _4) (S2 = b[o(k)])[C2] = C2 === "range" ? E2.slice() : E2, C2 === "rangebreaks" && (S2._hasDayOfWeekBreaks = Y2, l(S2, b));
          }
        }
      }, r.enforce = function(x) {
        var b, y, w, _4, k, T2, A2, S2, C2 = x._fullLayout, E2 = C2._axisConstraintGroups || [];
        for (b = 0; b < E2.length; b++) {
          w = m(E2[b], C2);
          var F13 = Object.keys(w), N2 = 1 / 0, D2 = 0, I2 = 1 / 0, O2 = {}, L2 = {}, V2 = false;
          for (y = 0; y < F13.length; y++) L2[_4 = F13[y]] = k = C2[o(_4)], k._inputDomain ? k.domain = k._inputDomain.slice() : k._inputDomain = k.domain.slice(), k._inputRange || (k._inputRange = k.range.slice()), k.setScale(), O2[_4] = T2 = Math.abs(k._m) / w[_4], N2 = Math.min(N2, T2), k.constrain !== "domain" && k._constraintShrinkable || (I2 = Math.min(I2, T2)), delete k._constraintShrinkable, D2 = Math.max(D2, T2), k.constrain === "domain" && (V2 = true);
          if (!(N2 > u2 * D2) || V2) {
            for (y = 0; y < F13.length; y++) if (T2 = O2[_4 = F13[y]], A2 = (k = L2[_4]).constrain, T2 !== I2 || A2 === "domain") if (S2 = T2 / I2, A2 === "range") i(k, S2);
            else {
              var W2 = k._inputDomain, X2 = (k.domain[1] - k.domain[0]) / (W2[1] - W2[0]), Y2 = (k.r2l(k.range[1]) - k.r2l(k.range[0])) / (k.r2l(k._inputRange[1]) - k.r2l(k._inputRange[0]));
              if ((S2 /= X2) * Y2 < 1) {
                k.domain = k._input.domain = W2.slice(), i(k, S2);
                continue;
              }
              if (Y2 < 1 && (k.range = k._input.range = k._inputRange.slice(), S2 *= Y2), k.autorange) {
                var K2 = k.r2l(k.range[0]), q = k.r2l(k.range[1]), re = (K2 + q) / 2, R2 = re, z = re, H2 = Math.abs(q - re), te = re - H2 * S2 * 1.0001, j = re + H2 * S2 * 1.0001, Q2 = a.makePadFn(C2, k, 0), Z2 = a.makePadFn(C2, k, 1);
                g(k, S2);
                var ne, ae, ue = Math.abs(k._m), le = a.concatExtremes(x, k), ce = le.min, se = le.max;
                for (ae = 0; ae < ce.length; ae++) (ne = ce[ae].val - Q2(ce[ae]) / ue) > te && ne < R2 && (R2 = ne);
                for (ae = 0; ae < se.length; ae++) (ne = se[ae].val + Z2(se[ae]) / ue) < j && ne > z && (z = ne);
                S2 /= (z - R2) / (2 * H2), R2 = k.l2r(R2), z = k.l2r(z), k.range = k._input.range = K2 < q ? [R2, z] : [z, R2];
              }
              g(k, S2);
            }
          }
        }
      }, r.getAxisGroup = function(x, b) {
        for (var y = x._axisMatchGroups, w = 0; w < y.length; w++) if (y[w][b]) return "g" + w;
        return b;
      }, r.clean = function(x, b) {
        if (b._inputDomain) {
          for (var y = false, w = b._id, _4 = x._fullLayout._axisConstraintGroups, k = 0; k < _4.length; k++) if (_4[k][w]) {
            y = true;
            break;
          }
          y && b.constrain === "domain" || (b._input.domain = b.domain = b._inputDomain, delete b._inputDomain);
        }
      };
    }, { "../../constants/alignment": 471, "../../constants/numerical": 479, "../../lib": 503, "./autorange": 553, "./axis_ids": 558, "./layout_attributes": 569, "./scale_zoom": 574, "./set_convert": 576 }], 563: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../lib"), o = a.numberFormat, s = e("tinycolor2"), i = e("has-passive-events"), l = e("../../registry"), u2 = a.strTranslate, c = e("../../lib/svg_text_utils"), f = e("../../components/color"), h = e("../../components/drawing"), p = e("../../components/fx"), d = e("./axes"), v = e("../../lib/setcursor"), m = e("../../components/dragelement"), g = e("../../components/dragelement/helpers"), x = g.selectingOrDrawing, b = g.freeMode, y = e("../../constants/alignment").FROM_TL, w = e("../../lib/clear_gl_canvases"), _4 = e("../../plot_api/subroutines").redrawReglTraces, k = e("../plots"), T2 = e("./axis_ids").getFromId, A2 = e("./select").prepSelect, S2 = e("./select").clearSelect, C2 = e("./select").selectOnClick, E2 = e("./scale_zoom"), F13 = e("./constants"), N2 = F13.MINDRAG, D2 = F13.MINZOOM, I2 = true;
      function O2(ne, ae, ue, le) {
        var ce = a.ensureSingle(ne.draglayer, ae, ue, function(se) {
          se.classed("drag", true).style({ fill: "transparent", "stroke-width": 0 }).attr("data-subplot", ne.id);
        });
        return ce.call(v, le), ce.node();
      }
      function L2(ne, ae, ue, le, ce, se, he) {
        var me = O2(ne, "rect", ae, ue);
        return n.select(me).call(h.setRect, le, ce, se, he), me;
      }
      function V2(ne, ae) {
        for (var ue = 0; ue < ne.length; ue++) if (!ne[ue].fixedrange) return ae;
        return "";
      }
      function W2(ne, ae, ue, le, ce) {
        for (var se = 0; se < ne.length; se++) {
          var he = ne[se];
          if (!he.fixedrange) if (he.rangebreaks) {
            var me = he._id.charAt(0) === "y", we = me ? 1 - ae : ae, be = me ? 1 - ue : ue;
            le[he._name + ".range[0]"] = he.l2r(he.p2l(we * he._length)), le[he._name + ".range[1]"] = he.l2r(he.p2l(be * he._length));
          } else {
            var Ae = he._rl[0], pe = he._rl[1] - Ae;
            le[he._name + ".range[0]"] = he.l2r(Ae + pe * ae), le[he._name + ".range[1]"] = he.l2r(Ae + pe * ue);
          }
        }
        if (ce && ce.length) {
          var ve = (ae + (1 - ue)) / 2;
          W2(ce, ve, 1 - ve, le, []);
        }
      }
      function X2(ne, ae) {
        for (var ue = 0; ue < ne.length; ue++) {
          var le = ne[ue];
          if (!le.fixedrange) if (le.rangebreaks) {
            var ce = le._length, se = (le.p2l(0 + ae) - le.p2l(0) + (le.p2l(ce + ae) - le.p2l(ce))) / 2;
            le.range = [le.l2r(le._rl[0] - se), le.l2r(le._rl[1] - se)];
          } else le.range = [le.l2r(le._rl[0] - ae / le._m), le.l2r(le._rl[1] - ae / le._m)];
        }
      }
      function Y2(ne) {
        return 1 - (ne >= 0 ? Math.min(ne, 0.9) : 1 / (1 / Math.max(ne, -0.3) + 3.222));
      }
      function K2(ne, ae, ue, le, ce) {
        return ne.append("path").attr("class", "zoombox").style({ fill: ae > 0.2 ? "rgba(0,0,0,0)" : "rgba(255,255,255,0)", "stroke-width": 0 }).attr("transform", u2(ue, le)).attr("d", ce + "Z");
      }
      function q(ne, ae, ue) {
        return ne.append("path").attr("class", "zoombox-corners").style({ fill: f.background, stroke: f.defaultLine, "stroke-width": 1, opacity: 0 }).attr("transform", u2(ae, ue)).attr("d", "M0,0Z");
      }
      function re(ne, ae, ue, le, ce, se) {
        ne.attr("d", le + "M" + ue.l + "," + ue.t + "v" + ue.h + "h" + ue.w + "v-" + ue.h + "h-" + ue.w + "Z"), R2(ne, ae, ce, se);
      }
      function R2(ne, ae, ue, le) {
        ue || (ne.transition().style("fill", le > 0.2 ? "rgba(0,0,0,0.4)" : "rgba(255,255,255,0.3)").duration(200), ae.transition().style("opacity", 1).duration(200));
      }
      function z(ne) {
        n.select(ne).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove();
      }
      function H2(ne) {
        I2 && ne.data && ne._context.showTips && (a.notifier(a._(ne, "Double-click to zoom back out"), "long"), I2 = false);
      }
      function te(ne) {
        var ae = Math.floor(Math.min(ne.b - ne.t, ne.r - ne.l, D2) / 2);
        return "M" + (ne.l - 3.5) + "," + (ne.t - 0.5 + ae) + "h3v" + -ae + "h" + ae + "v-3h-" + (ae + 3) + "ZM" + (ne.r + 3.5) + "," + (ne.t - 0.5 + ae) + "h-3v" + -ae + "h" + -ae + "v-3h" + (ae + 3) + "ZM" + (ne.r + 3.5) + "," + (ne.b + 0.5 - ae) + "h-3v" + ae + "h" + -ae + "v3h" + (ae + 3) + "ZM" + (ne.l - 3.5) + "," + (ne.b + 0.5 - ae) + "h3v" + ae + "h" + ae + "v3h-" + (ae + 3) + "Z";
      }
      function j(ne, ae, ue, le, ce) {
        for (var se, he, me, we, be = false, Ae = {}, pe = {}, ve = (ce || {}).xaHash, Ee = (ce || {}).yaHash, Se = 0; Se < ae.length; Se++) {
          var Ce = ae[Se];
          for (se in ue) if (Ce[se]) {
            for (me in Ce) ce && (ve[me] || Ee[me]) || (me.charAt(0) === "x" ? ue : le)[me] || (Ae[me] = se);
            for (he in le) ce && (ve[he] || Ee[he]) || !Ce[he] || (be = true);
          }
          for (he in le) if (Ce[he]) for (we in Ce) ce && (ve[we] || Ee[we]) || (we.charAt(0) === "x" ? ue : le)[we] || (pe[we] = he);
        }
        be && (a.extendFlat(Ae, pe), pe = {});
        var Be = {}, Ue = [];
        for (me in Ae) {
          var Ke = T2(ne, me);
          Ue.push(Ke), Be[Ke._id] = Ke;
        }
        var ct = {}, We = [];
        for (we in pe) {
          var Ze = T2(ne, we);
          We.push(Ze), ct[Ze._id] = Ze;
        }
        return { xaHash: Be, yaHash: ct, xaxes: Ue, yaxes: We, xLinks: Ae, yLinks: pe, isSubplotConstrained: be };
      }
      function Q2(ne, ae) {
        if (i) {
          var ue = ne.onwheel !== void 0 ? "wheel" : "mousewheel";
          ne._onwheel && ne.removeEventListener(ue, ne._onwheel), ne._onwheel = ae, ne.addEventListener(ue, ae, { passive: false });
        } else ne.onwheel !== void 0 ? ne.onwheel = ae : ne.onmousewheel !== void 0 ? ne.onmousewheel = ae : ne.isAddedWheelEvent || (ne.isAddedWheelEvent = true, ne.addEventListener("wheel", ae, { passive: false }));
      }
      function Z2(ne) {
        var ae = [];
        for (var ue in ne) ae.push(ne[ue]);
        return ae;
      }
      t.exports = { makeDragBox: function(ne, ae, ue, le, ce, se, he, me) {
        var we, be, Ae, pe, ve, Ee, Se, Ce, Be, Ue, Ke, ct, We, Ze, it, ot, mt, wt, Et, zt, Nt, yt, pt, Ot = ne._fullLayout._zoomlayer, Jt = he + me === "nsew", tr = (he + me).length === 1;
        function Ye() {
          if (we = ae.xaxis, be = ae.yaxis, Be = we._length, Ue = be._length, Se = we._offset, Ce = be._offset, (Ae = {})[we._id] = we, (pe = {})[be._id] = be, he && me) for (var pr = ae.overlays, lr = 0; lr < pr.length; lr++) {
            var _r = pr[lr].xaxis;
            Ae[_r._id] = _r;
            var $r = pr[lr].yaxis;
            pe[$r._id] = $r;
          }
          ve = Z2(Ae), Ee = Z2(pe), We = V2(ve, me), Ze = V2(Ee, he), it = !Ze && !We, ct = j(ne, ne._fullLayout._axisMatchGroups, Ae, pe);
          var Ar = (Ke = j(ne, ne._fullLayout._axisConstraintGroups, Ae, pe, ct)).isSubplotConstrained || ct.isSubplotConstrained;
          ot = me || Ar, mt = he || Ar;
          var Qr = ne._fullLayout;
          wt = Qr._has("scattergl"), Et = Qr._has("splom"), zt = Qr._has("svg");
        }
        Ye();
        var at = function(pr, lr, _r) {
          return pr ? pr === "nsew" ? _r ? "" : lr === "pan" ? "move" : "crosshair" : pr.toLowerCase() + "-resize" : "pointer";
        }(Ze + We, ne._fullLayout.dragmode, Jt), Ge = L2(ae, he + me + "drag", at, ue, le, ce, se);
        if (it && !Jt) return Ge.onmousedown = null, Ge.style.pointerEvents = "none", Ge;
        var st, Ie, Pe, $e, Ve, ut, Re, qe, je, rt, He = { element: Ge, gd: ne, plotinfo: ae };
        function xe() {
          He.plotinfo.selection = false, S2(ne);
        }
        function Ne(pr, lr) {
          var _r = He.gd;
          if (_r._fullLayout._activeShapeIndex >= 0) _r._fullLayout._deactivateShape(_r);
          else {
            var $r = _r._fullLayout.clickmode;
            if (z(_r), pr !== 2 || tr || jt(), Jt) $r.indexOf("select") > -1 && C2(lr, _r, ve, Ee, ae.id, He), $r.indexOf("event") > -1 && p.click(_r, lr, ae.id);
            else if (pr === 1 && tr) {
              var Ar = he ? be : we, Qr = he === "s" || me === "w" ? 0 : 1, hn = Ar._name + ".range[" + Qr + "]", wn = function(Wn, _n) {
                var qr, Nr = Wn.range[_n], Zr = Math.abs(Nr - Wn.range[1 - _n]);
                return Wn.type === "date" ? Nr : Wn.type === "log" ? (qr = Math.ceil(Math.max(0, -Math.log(Zr) / Math.LN10)) + 3, o("." + qr + "g")(Math.pow(10, Nr))) : (qr = Math.floor(Math.log(Math.abs(Nr)) / Math.LN10) - Math.floor(Math.log(Zr) / Math.LN10) + 4, o("." + String(qr) + "g")(Nr));
              }(Ar, Qr), Yn = "left", Xn = "middle";
              if (Ar.fixedrange) return;
              he ? (Xn = he === "n" ? "top" : "bottom", Ar.side === "right" && (Yn = "right")) : me === "e" && (Yn = "right"), _r._context.showAxisRangeEntryBoxes && n.select(Ge).call(c.makeEditable, { gd: _r, immediate: true, background: _r._fullLayout.paper_bgcolor, text: String(wn), fill: Ar.tickfont ? Ar.tickfont.color : "#444", horizontalAlign: Yn, verticalAlign: Xn }).on("edit", function(Wn) {
                var _n = Ar.d2r(Wn);
                _n !== void 0 && l.call("_guiRelayout", _r, hn, _n);
              });
            }
          }
        }
        function ke(pr, lr) {
          if (ne._transitioningWithDuration) return false;
          var _r = Math.max(0, Math.min(Be, yt * pr + st)), $r = Math.max(0, Math.min(Ue, pt * lr + Ie)), Ar = Math.abs(_r - st), Qr = Math.abs($r - Ie);
          function hn() {
            Re = "", Pe.r = Pe.l, Pe.t = Pe.b, je.attr("d", "M0,0Z");
          }
          if (Pe.l = Math.min(st, _r), Pe.r = Math.max(st, _r), Pe.t = Math.min(Ie, $r), Pe.b = Math.max(Ie, $r), Ke.isSubplotConstrained) Ar > D2 || Qr > D2 ? (Re = "xy", Ar / Be > Qr / Ue ? (Qr = Ar * Ue / Be, Ie > $r ? Pe.t = Ie - Qr : Pe.b = Ie + Qr) : (Ar = Qr * Be / Ue, st > _r ? Pe.l = st - Ar : Pe.r = st + Ar), je.attr("d", te(Pe))) : hn();
          else if (ct.isSubplotConstrained) if (Ar > D2 || Qr > D2) {
            Re = "xy";
            var wn = Math.min(Pe.l / Be, (Ue - Pe.b) / Ue), Yn = Math.max(Pe.r / Be, (Ue - Pe.t) / Ue);
            Pe.l = wn * Be, Pe.r = Yn * Be, Pe.b = (1 - wn) * Ue, Pe.t = (1 - Yn) * Ue, je.attr("d", te(Pe));
          } else hn();
          else !Ze || Qr < Math.min(Math.max(0.6 * Ar, N2), D2) ? Ar < N2 || !We ? hn() : (Pe.t = 0, Pe.b = Ue, Re = "x", je.attr("d", function(Xn, Wn) {
            return "M" + (Xn.l - 0.5) + "," + (Wn - D2 - 0.5) + "h-3v" + (2 * D2 + 1) + "h3ZM" + (Xn.r + 0.5) + "," + (Wn - D2 - 0.5) + "h3v" + (2 * D2 + 1) + "h-3Z";
          }(Pe, Ie))) : !We || Ar < Math.min(0.6 * Qr, D2) ? (Pe.l = 0, Pe.r = Be, Re = "y", je.attr("d", function(Xn, Wn) {
            return "M" + (Wn - D2 - 0.5) + "," + (Xn.t - 0.5) + "v-3h" + (2 * D2 + 1) + "v3ZM" + (Wn - D2 - 0.5) + "," + (Xn.b + 0.5) + "v3h" + (2 * D2 + 1) + "v-3Z";
          }(Pe, st))) : (Re = "xy", je.attr("d", te(Pe)));
          Pe.w = Pe.r - Pe.l, Pe.h = Pe.b - Pe.t, Re && (rt = true), ne._dragged = rt, re(qe, je, Pe, Ve, ut, $e), Me(), ne.emit("plotly_relayouting", Nt), ut = true;
        }
        function Me() {
          Nt = {}, Re !== "xy" && Re !== "x" || (W2(ve, Pe.l / Be, Pe.r / Be, Nt, Ke.xaxes), vt("x", Nt)), Re !== "xy" && Re !== "y" || (W2(Ee, (Ue - Pe.b) / Ue, (Ue - Pe.t) / Ue, Nt, Ke.yaxes), vt("y", Nt));
        }
        function Le() {
          Me(), z(ne), Vt(), H2(ne);
        }
        He.prepFn = function(pr, lr, _r) {
          var $r = He.dragmode, Ar = ne._fullLayout.dragmode;
          Ar !== $r && (He.dragmode = Ar), Ye(), yt = ne._fullLayout._invScaleX, pt = ne._fullLayout._invScaleY, it || (Jt ? pr.shiftKey ? Ar === "pan" ? Ar = "zoom" : x(Ar) || (Ar = "pan") : pr.ctrlKey && (Ar = "pan") : Ar = "pan"), b(Ar) ? He.minDrag = 1 : He.minDrag = void 0, x(Ar) ? (He.xaxes = ve, He.yaxes = Ee, A2(pr, lr, _r, He, Ar)) : (He.clickFn = Ne, x($r) && xe(), it || (Ar === "zoom" ? (He.moveFn = ke, He.doneFn = Le, He.minDrag = 1, function(Qr, hn, wn) {
            var Yn = Ge.getBoundingClientRect();
            st = hn - Yn.left, Ie = wn - Yn.top, ne._fullLayout._calcInverseTransform(ne);
            var Xn = a.apply3DTransform(ne._fullLayout._invTransform)(st, Ie);
            st = Xn[0], Ie = Xn[1], Pe = { l: st, r: st, w: 0, t: Ie, b: Ie, h: 0 }, $e = ne._hmpixcount ? ne._hmlumcount / ne._hmpixcount : s(ne._fullLayout.plot_bgcolor).getLuminance(), ut = false, Re = "xy", rt = false, qe = K2(Ot, $e, Se, Ce, Ve = "M0,0H" + Be + "V" + Ue + "H0V0"), je = q(Ot, Se, Ce);
          }(0, lr, _r)) : Ar === "pan" && (He.moveFn = tt, He.doneFn = Vt))), ne._fullLayout._redrag = function() {
            var Qr = ne._dragdata;
            if (Qr && Qr.element === Ge) {
              var hn = ne._fullLayout.dragmode;
              x(hn) || (Ye(), Kt([0, 0, Be, Ue]), He.moveFn(Qr.dx, Qr.dy));
            }
          };
        }, m.init(He);
        var ze = [0, 0, Be, Ue], ft = null, De = F13.REDRAWDELAY, Je = ae.mainplot ? ne._fullLayout._plots[ae.mainplot] : ae;
        function tt(pr, lr) {
          if (pr *= yt, lr *= pt, !ne._transitioningWithDuration) {
            if (ne._fullLayout._replotting = true, We === "ew" || Ze === "ns") {
              var _r = We ? -pr : 0, $r = Ze ? -lr : 0;
              if (ct.isSubplotConstrained) {
                if (We && Ze) {
                  var Ar = (pr / Be - lr / Ue) / 2;
                  _r = -(pr = Ar * Be), $r = -(lr = -Ar * Ue);
                }
                Ze ? _r = -$r * Be / Ue : $r = -_r * Ue / Be;
              }
              return We && (X2(ve, pr), vt("x")), Ze && (X2(Ee, lr), vt("y")), Kt([_r, $r, Be, Ue]), kt(), void ne.emit("plotly_relayouting", Nt);
            }
            var Qr, hn, wn = We === "w" == (Ze === "n") ? 1 : -1;
            if (We && Ze && (Ke.isSubplotConstrained || ct.isSubplotConstrained)) {
              var Yn = (pr / Be + wn * lr / Ue) / 2;
              pr = Yn * Be, lr = wn * Yn * Ue;
            }
            if (We === "w" ? pr = qr(ve, 0, pr) : We === "e" ? pr = qr(ve, 1, -pr) : We || (pr = 0), Ze === "n" ? lr = qr(Ee, 1, lr) : Ze === "s" ? lr = qr(Ee, 0, -lr) : Ze || (lr = 0), Qr = We === "w" ? pr : 0, hn = Ze === "n" ? lr : 0, Ke.isSubplotConstrained && !ct.isSubplotConstrained || ct.isSubplotConstrained && We && Ze && wn > 0) {
              var Xn;
              if (ct.isSubplotConstrained || !We && Ze.length === 1) {
                for (Xn = 0; Xn < ve.length; Xn++) ve[Xn].range = ve[Xn]._r.slice(), E2(ve[Xn], 1 - lr / Ue);
                Qr = (pr = lr * Be / Ue) / 2;
              }
              if (ct.isSubplotConstrained || !Ze && We.length === 1) {
                for (Xn = 0; Xn < Ee.length; Xn++) Ee[Xn].range = Ee[Xn]._r.slice(), E2(Ee[Xn], 1 - pr / Be);
                hn = (lr = pr * Ue / Be) / 2;
              }
            }
            ct.isSubplotConstrained && Ze || vt("x"), ct.isSubplotConstrained && We || vt("y");
            var Wn = Be - pr, _n = Ue - lr;
            !ct.isSubplotConstrained || We && Ze || (We ? (hn = Qr ? 0 : pr * Ue / Be, _n = Wn * Ue / Be) : (Qr = hn ? 0 : lr * Be / Ue, Wn = _n * Be / Ue)), Kt([Qr, hn, Wn, _n]), kt(), ne.emit("plotly_relayouting", Nt);
          }
          function qr(Nr, Zr, oa) {
            for (var tn, Zn, Ln = 1 - Zr, gn = 0; gn < Nr.length; gn++) {
              var na = Nr[gn];
              if (!na.fixedrange) {
                tn = na, Zn = na._rl[Ln] + (na._rl[Zr] - na._rl[Ln]) / Y2(oa / na._length);
                var sr = na.l2r(Zn);
                sr !== false && sr !== void 0 && (na.range[Zr] = sr);
              }
            }
            return tn._length * (tn._rl[Zr] - Zn) / (tn._rl[Zr] - tn._rl[Ln]);
          }
        }
        function vt(pr, lr) {
          for (var _r = ct.isSubplotConstrained ? { x: Ee, y: ve }[pr] : ct[pr + "axes"], $r = ct.isSubplotConstrained ? { x: ve, y: Ee }[pr] : [], Ar = 0; Ar < _r.length; Ar++) {
            var Qr = _r[Ar], hn = Qr._id, wn = ct.xLinks[hn] || ct.yLinks[hn], Yn = $r[0] || Ae[wn] || pe[wn];
            Yn && (lr ? (lr[Qr._name + ".range[0]"] = lr[Yn._name + ".range[0]"], lr[Qr._name + ".range[1]"] = lr[Yn._name + ".range[1]"]) : Qr.range = Yn.range.slice());
          }
        }
        function kt() {
          var pr, lr = [];
          function _r(Qr) {
            for (pr = 0; pr < Qr.length; pr++) Qr[pr].fixedrange || lr.push(Qr[pr]._id);
          }
          for (ot && (_r(ve), _r(Ke.xaxes), _r(ct.xaxes)), mt && (_r(Ee), _r(Ke.yaxes), _r(ct.yaxes)), Nt = {}, pr = 0; pr < lr.length; pr++) {
            var $r = lr[pr], Ar = T2(ne, $r);
            d.drawOne(ne, Ar, { skipTitle: true }), Nt[Ar._name + ".range[0]"] = Ar.range[0], Nt[Ar._name + ".range[1]"] = Ar.range[1];
          }
          d.redrawComponents(ne, lr);
        }
        function jt() {
          if (!ne._transitioningWithDuration) {
            var pr = ne._context.doubleClick, lr = [];
            We && (lr = lr.concat(ve)), Ze && (lr = lr.concat(Ee)), ct.xaxes && (lr = lr.concat(ct.xaxes)), ct.yaxes && (lr = lr.concat(ct.yaxes));
            var _r, $r, Ar, Qr = {};
            if (pr === "reset+autosize") {
              for (pr = "autosize", $r = 0; $r < lr.length; $r++) if ((_r = lr[$r])._rangeInitial && (_r.range[0] !== _r._rangeInitial[0] || _r.range[1] !== _r._rangeInitial[1]) || !_r._rangeInitial && !_r.autorange) {
                pr = "reset";
                break;
              }
            }
            if (pr === "autosize") for ($r = 0; $r < lr.length; $r++) (_r = lr[$r]).fixedrange || (Qr[_r._name + ".autorange"] = true);
            else if (pr === "reset") for ((We || Ke.isSubplotConstrained) && (lr = lr.concat(Ke.xaxes)), Ze && !Ke.isSubplotConstrained && (lr = lr.concat(Ke.yaxes)), Ke.isSubplotConstrained && (We ? Ze || (lr = lr.concat(Ee)) : lr = lr.concat(ve)), $r = 0; $r < lr.length; $r++) (_r = lr[$r]).fixedrange || (_r._rangeInitial ? (Ar = _r._rangeInitial, Qr[_r._name + ".range[0]"] = Ar[0], Qr[_r._name + ".range[1]"] = Ar[1]) : Qr[_r._name + ".autorange"] = true);
            ne.emit("plotly_doubleclick", null), l.call("_guiRelayout", ne, Qr);
          }
        }
        function Vt() {
          Kt([0, 0, Be, Ue]), a.syncOrAsync([k.previousPromises, function() {
            ne._fullLayout._replotting = false, l.call("_guiRelayout", ne, Nt);
          }], ne);
        }
        function Kt(pr) {
          var lr, _r, $r, Ar, Qr = ne._fullLayout, hn = Qr._plots, wn = Qr._subplots.cartesian;
          if (Et && l.subplotsRegistry.splom.drag(ne), wt) {
            for (lr = 0; lr < wn.length; lr++) if ($r = (_r = hn[wn[lr]]).xaxis, Ar = _r.yaxis, _r._scene) {
              var Yn = a.simpleMap($r.range, $r.r2l), Xn = a.simpleMap(Ar.range, Ar.r2l);
              _r._scene.update({ range: [Yn[0], Xn[0], Yn[1], Xn[1]] });
            }
          }
          if ((Et || wt) && (w(ne), _4(ne)), zt) {
            var Wn = pr[2] / we._length, _n = pr[3] / be._length;
            for (lr = 0; lr < wn.length; lr++) {
              $r = (_r = hn[wn[lr]]).xaxis, Ar = _r.yaxis;
              var qr, Nr, Zr, oa, tn = (ot || ct.isSubplotConstrained) && !$r.fixedrange && Ae[$r._id], Zn = (mt || ct.isSubplotConstrained) && !Ar.fixedrange && pe[Ar._id];
              if (tn ? (qr = Wn, Zr = me || ct.isSubplotConstrained ? pr[0] : yr($r, qr)) : ct.xaHash[$r._id] ? (qr = Wn, Zr = pr[0] * $r._length / we._length) : ct.yaHash[$r._id] ? (qr = _n, Zr = Ze === "ns" ? -pr[1] * $r._length / be._length : yr($r, qr, { n: "top", s: "bottom" }[Ze])) : Zr = Tr($r, qr = rr($r, Wn, _n)), Zn ? (Nr = _n, oa = he || ct.isSubplotConstrained ? pr[1] : yr(Ar, Nr)) : ct.yaHash[Ar._id] ? (Nr = _n, oa = pr[1] * Ar._length / be._length) : ct.xaHash[Ar._id] ? (Nr = Wn, oa = We === "ew" ? -pr[0] * Ar._length / we._length : yr(Ar, Nr, { e: "right", w: "left" }[We])) : oa = Tr(Ar, Nr = rr(Ar, Wn, _n)), qr || Nr) {
                qr || (qr = 1), Nr || (Nr = 1);
                var Ln = $r._offset - Zr / qr, gn = Ar._offset - oa / Nr;
                _r.clipRect.call(h.setTranslate, Zr, oa).call(h.setScale, qr, Nr), _r.plot.call(h.setTranslate, Ln, gn).call(h.setScale, 1 / qr, 1 / Nr), qr === _r.xScaleFactor && Nr === _r.yScaleFactor || (h.setPointGroupScale(_r.zoomScalePts, qr, Nr), h.setTextPointsScale(_r.zoomScaleTxt, qr, Nr)), h.hideOutsideRangePoints(_r.clipOnAxisFalseTraces, _r), _r.xScaleFactor = qr, _r.yScaleFactor = Nr;
              }
            }
          }
        }
        function rr(pr, lr, _r) {
          return pr.fixedrange ? 0 : ot && Ke.xaHash[pr._id] ? lr : mt && (Ke.isSubplotConstrained ? Ke.xaHash : Ke.yaHash)[pr._id] ? _r : 0;
        }
        function Tr(pr, lr) {
          return lr ? (pr.range = pr._r.slice(), E2(pr, lr), yr(pr, lr)) : 0;
        }
        function yr(pr, lr, _r) {
          return pr._length * (1 - lr) * y[_r || pr.constraintoward || "middle"];
        }
        return he.length * me.length != 1 && Q2(Ge, function(pr) {
          if (ne._context._scrollZoom.cartesian || ne._fullLayout._enablescrollzoom) {
            if (xe(), ne._transitioningWithDuration) return pr.preventDefault(), void pr.stopPropagation();
            Ye(), clearTimeout(ft);
            var lr = -pr.deltaY;
            if (isFinite(lr) || (lr = pr.wheelDelta / 10), isFinite(lr)) {
              var _r, $r = Math.exp(-Math.min(Math.max(lr, -20), 20) / 200), Ar = Je.draglayer.select(".nsewdrag").node().getBoundingClientRect(), Qr = (pr.clientX - Ar.left) / Ar.width, hn = (Ar.bottom - pr.clientY) / Ar.height;
              if (ot) {
                for (me || (Qr = 0.5), _r = 0; _r < ve.length; _r++) wn(ve[_r], Qr, $r);
                vt("x"), ze[2] *= $r, ze[0] += ze[2] * Qr * (1 / $r - 1);
              }
              if (mt) {
                for (he || (hn = 0.5), _r = 0; _r < Ee.length; _r++) wn(Ee[_r], hn, $r);
                vt("y"), ze[3] *= $r, ze[1] += ze[3] * (1 - hn) * (1 / $r - 1);
              }
              Kt(ze), kt(), ne.emit("plotly_relayouting", Nt), ft = setTimeout(function() {
                ne._fullLayout && (ze = [0, 0, Be, Ue], Vt());
              }, De), pr.preventDefault();
            } else a.log("Did not find wheel motion attributes: ", pr);
          }
          function wn(Yn, Xn, Wn) {
            if (!Yn.fixedrange) {
              var _n = a.simpleMap(Yn.range, Yn.r2l), qr = _n[0] + (_n[1] - _n[0]) * Xn;
              Yn.range = _n.map(function(Nr) {
                return Yn.l2r(qr + (Nr - qr) * Wn);
              });
            }
          }
        }), Ge;
      }, makeDragger: O2, makeRectDragger: L2, makeZoombox: K2, makeCorners: q, updateZoombox: re, xyCorners: te, transitionZoombox: R2, removeZoombox: z, showDoubleClickNotifier: H2, attachWheelEventHandler: Q2 };
    }, { "../../components/color": 366, "../../components/dragelement": 385, "../../components/dragelement/helpers": 384, "../../components/drawing": 388, "../../components/fx": 406, "../../constants/alignment": 471, "../../lib": 503, "../../lib/clear_gl_canvases": 487, "../../lib/setcursor": 524, "../../lib/svg_text_utils": 529, "../../plot_api/subroutines": 544, "../../registry": 638, "../plots": 619, "./axes": 554, "./axis_ids": 558, "./constants": 561, "./scale_zoom": 574, "./select": 575, "@plotly/d3": 58, "has-passive-events": 229, tinycolor2: 312 }], 564: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../components/fx"), o = e("../../components/dragelement"), s = e("../../lib/setcursor"), i = e("./dragbox").makeDragBox, l = e("./constants").DRAGGERSIZE;
      r.initInteractions = function(u2) {
        var c = u2._fullLayout;
        if (u2._context.staticPlot) n.select(u2).selectAll(".drag").remove();
        else if (c._has("cartesian") || c._has("splom")) {
          Object.keys(c._plots || {}).sort(function(h, p) {
            if ((c._plots[h].mainplot && true) === (c._plots[p].mainplot && true)) {
              var d = h.split("y"), v = p.split("y");
              return d[0] === v[0] ? Number(d[1] || 1) - Number(v[1] || 1) : Number(d[0] || 1) - Number(v[0] || 1);
            }
            return c._plots[h].mainplot ? 1 : -1;
          }).forEach(function(h) {
            var p = c._plots[h], d = p.xaxis, v = p.yaxis;
            if (!p.mainplot) {
              var m = i(u2, p, d._offset, v._offset, d._length, v._length, "ns", "ew");
              m.onmousemove = function(b) {
                u2._fullLayout._rehover = function() {
                  u2._fullLayout._hoversubplot === h && u2._fullLayout._plots[h] && a.hover(u2, b, h);
                }, a.hover(u2, b, h), u2._fullLayout._lasthover = m, u2._fullLayout._hoversubplot = h;
              }, m.onmouseout = function(b) {
                u2._dragging || (u2._fullLayout._hoversubplot = null, o.unhover(u2, b));
              }, u2._context.showAxisDragHandles && (i(u2, p, d._offset - l, v._offset - l, l, l, "n", "w"), i(u2, p, d._offset + d._length, v._offset - l, l, l, "n", "e"), i(u2, p, d._offset - l, v._offset + v._length, l, l, "s", "w"), i(u2, p, d._offset + d._length, v._offset + v._length, l, l, "s", "e"));
            }
            if (u2._context.showAxisDragHandles) {
              if (h === d._mainSubplot) {
                var g = d._mainLinePosition;
                d.side === "top" && (g -= l), i(u2, p, d._offset + 0.1 * d._length, g, 0.8 * d._length, l, "", "ew"), i(u2, p, d._offset, g, 0.1 * d._length, l, "", "w"), i(u2, p, d._offset + 0.9 * d._length, g, 0.1 * d._length, l, "", "e");
              }
              if (h === v._mainSubplot) {
                var x = v._mainLinePosition;
                v.side !== "right" && (x -= l), i(u2, p, x, v._offset + 0.1 * v._length, l, 0.8 * v._length, "ns", ""), i(u2, p, x, v._offset + 0.9 * v._length, l, 0.1 * v._length, "s", ""), i(u2, p, x, v._offset, l, 0.1 * v._length, "n", "");
              }
            }
          });
          var f = c._hoverlayer.node();
          f.onmousemove = function(h) {
            h.target = u2._fullLayout._lasthover, a.hover(u2, h, c._hoversubplot);
          }, f.onclick = function(h) {
            h.target = u2._fullLayout._lasthover, a.click(u2, h);
          }, f.onmousedown = function(h) {
            u2._fullLayout._lasthover.onmousedown(h);
          }, r.updateFx(u2);
        }
      }, r.updateFx = function(u2) {
        var c = u2._fullLayout, f = c.dragmode === "pan" ? "move" : "crosshair";
        s(c._draggers, f);
      };
    }, { "../../components/dragelement": 385, "../../components/fx": 406, "../../lib/setcursor": 524, "./constants": 561, "./dragbox": 563, "@plotly/d3": 58 }], 565: [function(e, t, r) {
      "use strict";
      t.exports = { clearOutlineControllers: function(n) {
        var a = n._fullLayout._zoomlayer;
        a && a.selectAll(".outline-controllers").remove();
      }, clearSelect: function(n) {
        var a = n._fullLayout._zoomlayer;
        a && a.selectAll(".select-outline").remove(), n._fullLayout._drawing = false;
      } };
    }, {}], 566: [function(e, t, r) {
      "use strict";
      var n = e("../../lib").strTranslate;
      function a(o, s) {
        switch (o.type) {
          case "log":
            return o.p2d(s);
          case "date":
            return o.p2r(s, 0, o.calendar);
          default:
            return o.p2r(s);
        }
      }
      t.exports = { p2r: a, r2p: function(o, s) {
        switch (o.type) {
          case "log":
            return o.d2p(s);
          case "date":
            return o.r2p(s, 0, o.calendar);
          default:
            return o.r2p(s);
        }
      }, axValue: function(o) {
        var s = o._id.charAt(0) === "y" ? 1 : 0;
        return function(i) {
          return a(o, i[s]);
        };
      }, getTransform: function(o) {
        return n(o.xaxis._offset, o.yaxis._offset);
      } };
    }, { "../../lib": 503 }], 567: [function(e, t, r) {
      "use strict";
      var n = e("../../registry"), a = e("../../lib"), o = e("./axis_ids");
      t.exports = function(s) {
        return function(i, l) {
          var u2 = i[s];
          if (Array.isArray(u2)) for (var c = n.subplotsRegistry.cartesian, f = c.idRegex, h = l._subplots, p = h.xaxis, d = h.yaxis, v = h.cartesian, m = l._has("cartesian") || l._has("gl2d"), g = 0; g < u2.length; g++) {
            var x = u2[g];
            if (a.isPlainObject(x)) {
              var b = o.cleanId(x.xref, "x", false), y = o.cleanId(x.yref, "y", false), w = f.x.test(b), _4 = f.y.test(y);
              if (w || _4) {
                m || a.pushUnique(l._basePlotModules, c);
                var k = false;
                w && p.indexOf(b) === -1 && (p.push(b), k = true), _4 && d.indexOf(y) === -1 && (d.push(y), k = true), k && w && _4 && v.push(b + y);
              }
            }
          }
        };
      };
    }, { "../../lib": 503, "../../registry": 638, "./axis_ids": 558 }], 568: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../registry"), o = e("../../lib"), s = e("../plots"), i = e("../../components/drawing"), l = e("../get_data").getModuleCalcData, u2 = e("./axis_ids"), c = e("./constants"), f = e("../../constants/xmlns_namespaces"), h = o.ensureSingle;
      function p(x, b, y) {
        return o.ensureSingle(x, b, y, function(w) {
          w.datum(y);
        });
      }
      function d(x, b, y, w, _4) {
        for (var k, T2, A2, S2 = c.traceLayerClasses, C2 = x._fullLayout, E2 = C2._modules, F13 = [], N2 = [], D2 = 0; D2 < E2.length; D2++) {
          var I2 = (k = E2[D2]).name, O2 = a.modules[I2].categories;
          if (O2.svg) {
            var L2 = k.layerName || I2 + "layer", V2 = k.plot;
            A2 = (T2 = l(y, V2))[0], y = T2[1], A2.length && F13.push({ i: S2.indexOf(L2), className: L2, plotMethod: V2, cdModule: A2 }), O2.zoomScale && N2.push("." + L2);
          }
        }
        F13.sort(function(Y2, K2) {
          return Y2.i - K2.i;
        });
        var W2 = b.plot.selectAll("g.mlayer").data(F13, function(Y2) {
          return Y2.className;
        });
        if (W2.enter().append("g").attr("class", function(Y2) {
          return Y2.className;
        }).classed("mlayer", true).classed("rangeplot", b.isRangePlot), W2.exit().remove(), W2.order(), W2.each(function(Y2) {
          var K2 = n.select(this), q = Y2.className;
          Y2.plotMethod(x, b, Y2.cdModule, K2, w, _4), c.clipOnAxisFalseQuery.indexOf("." + q) === -1 && i.setClipUrl(K2, b.layerClipId, x);
        }), C2._has("scattergl") && (k = a.getModule("scattergl"), A2 = l(y, k)[0], k.plot(x, b, A2)), !x._context.staticPlot && (b._hasClipOnAxisFalse && (b.clipOnAxisFalseTraces = b.plot.selectAll(c.clipOnAxisFalseQuery.join(",")).selectAll(".trace")), N2.length)) {
          var X2 = b.plot.selectAll(N2.join(",")).selectAll(".trace");
          b.zoomScalePts = X2.selectAll("path.point"), b.zoomScaleTxt = X2.selectAll(".textpoint");
        }
      }
      function v(x, b) {
        var y = b.plotgroup, w = b.id, _4 = c.layerValue2layerClass[b.xaxis.layer], k = c.layerValue2layerClass[b.yaxis.layer], T2 = x._fullLayout._hasOnlyLargeSploms;
        if (b.mainplot) {
          var A2 = b.mainplotinfo, S2 = A2.plotgroup, C2 = w + "-x", E2 = w + "-y";
          b.gridlayer = A2.gridlayer, b.zerolinelayer = A2.zerolinelayer, h(A2.overlinesBelow, "path", C2), h(A2.overlinesBelow, "path", E2), h(A2.overaxesBelow, "g", C2), h(A2.overaxesBelow, "g", E2), b.plot = h(A2.overplot, "g", w), h(A2.overlinesAbove, "path", C2), h(A2.overlinesAbove, "path", E2), h(A2.overaxesAbove, "g", C2), h(A2.overaxesAbove, "g", E2), b.xlines = S2.select(".overlines-" + _4).select("." + C2), b.ylines = S2.select(".overlines-" + k).select("." + E2), b.xaxislayer = S2.select(".overaxes-" + _4).select("." + C2), b.yaxislayer = S2.select(".overaxes-" + k).select("." + E2);
        } else if (T2) b.xlines = h(y, "path", "xlines-above"), b.ylines = h(y, "path", "ylines-above"), b.xaxislayer = h(y, "g", "xaxislayer-above"), b.yaxislayer = h(y, "g", "yaxislayer-above");
        else {
          var F13 = h(y, "g", "layer-subplot");
          b.shapelayer = h(F13, "g", "shapelayer"), b.imagelayer = h(F13, "g", "imagelayer"), b.gridlayer = h(y, "g", "gridlayer"), b.zerolinelayer = h(y, "g", "zerolinelayer"), h(y, "path", "xlines-below"), h(y, "path", "ylines-below"), b.overlinesBelow = h(y, "g", "overlines-below"), h(y, "g", "xaxislayer-below"), h(y, "g", "yaxislayer-below"), b.overaxesBelow = h(y, "g", "overaxes-below"), b.plot = h(y, "g", "plot"), b.overplot = h(y, "g", "overplot"), b.xlines = h(y, "path", "xlines-above"), b.ylines = h(y, "path", "ylines-above"), b.overlinesAbove = h(y, "g", "overlines-above"), h(y, "g", "xaxislayer-above"), h(y, "g", "yaxislayer-above"), b.overaxesAbove = h(y, "g", "overaxes-above"), b.xlines = y.select(".xlines-" + _4), b.ylines = y.select(".ylines-" + k), b.xaxislayer = y.select(".xaxislayer-" + _4), b.yaxislayer = y.select(".yaxislayer-" + k);
        }
        T2 || (p(b.gridlayer, "g", b.xaxis._id), p(b.gridlayer, "g", b.yaxis._id), b.gridlayer.selectAll("g").map(function(N2) {
          return N2[0];
        }).sort(u2.idSort)), b.xlines.style("fill", "none").classed("crisp", true), b.ylines.style("fill", "none").classed("crisp", true);
      }
      function m(x, b) {
        if (x) {
          var y = {};
          for (var w in x.each(function(A2) {
            var S2 = A2[0];
            n.select(this).remove(), g(S2, b), y[S2] = true;
          }), b._plots) for (var _4 = b._plots[w].overlays || [], k = 0; k < _4.length; k++) {
            var T2 = _4[k];
            y[T2.id] && T2.plot.selectAll(".trace").remove();
          }
        }
      }
      function g(x, b) {
        b._draggers.selectAll("g." + x).remove(), b._defs.select("#clip" + b._uid + x + "plot").remove();
      }
      r.name = "cartesian", r.attr = ["xaxis", "yaxis"], r.idRoot = ["x", "y"], r.idRegex = c.idRegex, r.attrRegex = c.attrRegex, r.attributes = e("./attributes"), r.layoutAttributes = e("./layout_attributes"), r.supplyLayoutDefaults = e("./layout_defaults"), r.transitionAxes = e("./transition_axes"), r.finalizeSubplots = function(x, b) {
        var y, w, _4, k = b._subplots, T2 = k.xaxis, A2 = k.yaxis, S2 = k.cartesian, C2 = S2.concat(k.gl2d || []), E2 = {}, F13 = {};
        for (y = 0; y < C2.length; y++) {
          var N2 = C2[y].split("y");
          E2[N2[0]] = 1, F13["y" + N2[1]] = 1;
        }
        for (y = 0; y < T2.length; y++) E2[w = T2[y]] || (_4 = (x[u2.id2name(w)] || {}).anchor, c.idRegex.y.test(_4) || (_4 = "y"), S2.push(w + _4), C2.push(w + _4), F13[_4] || (F13[_4] = 1, o.pushUnique(A2, _4)));
        for (y = 0; y < A2.length; y++) F13[_4 = A2[y]] || (w = (x[u2.id2name(_4)] || {}).anchor, c.idRegex.x.test(w) || (w = "x"), S2.push(w + _4), C2.push(w + _4), E2[w] || (E2[w] = 1, o.pushUnique(T2, w)));
        if (!C2.length) {
          for (var D2 in w = "", _4 = "", x) c.attrRegex.test(D2) && (D2.charAt(0) === "x" ? (!w || +D2.substr(5) < +w.substr(5)) && (w = D2) : (!_4 || +D2.substr(5) < +_4.substr(5)) && (_4 = D2));
          w = w ? u2.name2id(w) : "x", _4 = _4 ? u2.name2id(_4) : "y", T2.push(w), A2.push(_4), S2.push(w + _4);
        }
      }, r.plot = function(x, b, y, w) {
        var _4, k = x._fullLayout, T2 = k._subplots.cartesian, A2 = x.calcdata;
        if (!Array.isArray(b)) for (b = [], _4 = 0; _4 < A2.length; _4++) b.push(_4);
        for (_4 = 0; _4 < T2.length; _4++) {
          for (var S2, C2 = T2[_4], E2 = k._plots[C2], F13 = [], N2 = 0; N2 < A2.length; N2++) {
            var D2 = A2[N2], I2 = D2[0].trace;
            I2.xaxis + I2.yaxis === C2 && ((b.indexOf(I2.index) !== -1 || I2.carpet) && (S2 && S2[0].trace.xaxis + S2[0].trace.yaxis === C2 && ["tonextx", "tonexty", "tonext"].indexOf(I2.fill) !== -1 && F13.indexOf(S2) === -1 && F13.push(S2), F13.push(D2)), S2 = D2);
          }
          d(x, E2, F13, y, w);
        }
      }, r.clean = function(x, b, y, w) {
        var _4, k, T2, A2 = w._plots || {}, S2 = b._plots || {}, C2 = w._subplots || {};
        if (w._hasOnlyLargeSploms && !b._hasOnlyLargeSploms) for (T2 in A2) (_4 = A2[T2]).plotgroup && _4.plotgroup.remove();
        var E2 = w._has && w._has("gl"), F13 = b._has && b._has("gl");
        if (E2 && !F13) for (T2 in A2) (_4 = A2[T2])._scene && _4._scene.destroy();
        if (C2.xaxis && C2.yaxis) {
          var N2 = u2.listIds({ _fullLayout: w });
          for (k = 0; k < N2.length; k++) {
            var D2 = N2[k];
            b[u2.id2name(D2)] || w._infolayer.selectAll(".g-" + D2 + "title").remove();
          }
        }
        var I2 = w._has && w._has("cartesian"), O2 = b._has && b._has("cartesian");
        if (I2 && !O2) m(w._cartesianlayer.selectAll(".subplot"), w), w._defs.selectAll(".axesclip").remove(), delete w._axisConstraintGroups, delete w._axisMatchGroups;
        else if (C2.cartesian) for (k = 0; k < C2.cartesian.length; k++) {
          var L2 = C2.cartesian[k];
          if (!S2[L2]) {
            var V2 = "." + L2 + ",." + L2 + "-x,." + L2 + "-y";
            w._cartesianlayer.selectAll(V2).remove(), g(L2, w);
          }
        }
      }, r.drawFramework = function(x) {
        var b = x._fullLayout, y = function(_4) {
          var k, T2, A2, S2, C2, E2, F13 = _4._fullLayout, N2 = F13._subplots.cartesian, D2 = N2.length, I2 = [], O2 = [];
          for (k = 0; k < D2; k++) {
            A2 = N2[k], S2 = F13._plots[A2], C2 = S2.xaxis, E2 = S2.yaxis;
            var L2 = C2._mainAxis, V2 = E2._mainAxis, W2 = L2._id + V2._id, X2 = F13._plots[W2];
            S2.overlays = [], W2 !== A2 && X2 ? (S2.mainplot = W2, S2.mainplotinfo = X2, O2.push(A2)) : (S2.mainplot = void 0, S2.mainplotinfo = void 0, I2.push(A2));
          }
          for (k = 0; k < O2.length; k++) A2 = O2[k], (S2 = F13._plots[A2]).mainplotinfo.overlays.push(S2);
          var Y2 = I2.concat(O2), K2 = new Array(D2);
          for (k = 0; k < D2; k++) {
            A2 = Y2[k], S2 = F13._plots[A2], C2 = S2.xaxis, E2 = S2.yaxis;
            var q = [A2, C2.layer, E2.layer, C2.overlaying || "", E2.overlaying || ""];
            for (T2 = 0; T2 < S2.overlays.length; T2++) q.push(S2.overlays[T2].id);
            K2[k] = q;
          }
          return K2;
        }(x), w = b._cartesianlayer.selectAll(".subplot").data(y, String);
        w.enter().append("g").attr("class", function(_4) {
          return "subplot " + _4[0];
        }), w.order(), w.exit().call(m, b), w.each(function(_4) {
          var k = _4[0], T2 = b._plots[k];
          T2.plotgroup = n.select(this), v(x, T2), T2.draglayer = h(b._draggers, "g", k);
        });
      }, r.rangePlot = function(x, b, y) {
        v(x, b), d(x, b, y), s.style(x);
      }, r.toSVG = function(x) {
        var b = x._fullLayout._glimages, y = n.select(x).selectAll(".svg-container");
        y.filter(function(w, _4) {
          return _4 === y.size() - 1;
        }).selectAll(".gl-canvas-context, .gl-canvas-focus").each(function() {
          var w = this.toDataURL("image/png");
          b.append("svg:image").attr({ xmlns: f.svg, "xlink:href": w, preserveAspectRatio: "none", x: 0, y: 0, width: this.style.width, height: this.style.height });
        });
      }, r.updateFx = e("./graph_interact").updateFx;
    }, { "../../components/drawing": 388, "../../constants/xmlns_namespaces": 480, "../../lib": 503, "../../registry": 638, "../get_data": 593, "../plots": 619, "./attributes": 552, "./axis_ids": 558, "./constants": 561, "./graph_interact": 564, "./layout_attributes": 569, "./layout_defaults": 570, "./transition_axes": 581, "@plotly/d3": 58 }], 569: [function(e, t, r) {
      "use strict";
      var n = e("../font_attributes"), a = e("../../components/color/attributes"), o = e("../../components/drawing/attributes").dash, s = e("../../lib/extend").extendFlat, i = e("../../plot_api/plot_template").templatedArray, l = e("../../plots/cartesian/axis_format_attributes").descriptionWithDates, u2 = e("../../constants/numerical").ONEDAY, c = e("./constants"), f = c.HOUR_PATTERN, h = c.WEEKDAY_PATTERN;
      t.exports = { visible: { valType: "boolean", editType: "plot" }, color: { valType: "color", dflt: a.defaultLine, editType: "ticks" }, title: { text: { valType: "string", editType: "ticks" }, font: n({ editType: "ticks" }), standoff: { valType: "number", min: 0, editType: "ticks" }, editType: "ticks" }, type: { valType: "enumerated", values: ["-", "linear", "log", "date", "category", "multicategory"], dflt: "-", editType: "calc", _noTemplating: true }, autotypenumbers: { valType: "enumerated", values: ["convert types", "strict"], dflt: "convert types", editType: "calc" }, autorange: { valType: "enumerated", values: [true, false, "reversed"], dflt: true, editType: "axrange", impliedEdits: { "range[0]": void 0, "range[1]": void 0 } }, rangemode: { valType: "enumerated", values: ["normal", "tozero", "nonnegative"], dflt: "normal", editType: "plot" }, range: { valType: "info_array", items: [{ valType: "any", editType: "axrange", impliedEdits: { "^autorange": false }, anim: true }, { valType: "any", editType: "axrange", impliedEdits: { "^autorange": false }, anim: true }], editType: "axrange", impliedEdits: { autorange: false }, anim: true }, fixedrange: { valType: "boolean", dflt: false, editType: "calc" }, scaleanchor: { valType: "enumerated", values: [c.idRegex.x.toString(), c.idRegex.y.toString()], editType: "plot" }, scaleratio: { valType: "number", min: 0, dflt: 1, editType: "plot" }, constrain: { valType: "enumerated", values: ["range", "domain"], editType: "plot" }, constraintoward: { valType: "enumerated", values: ["left", "center", "right", "top", "middle", "bottom"], editType: "plot" }, matches: { valType: "enumerated", values: [c.idRegex.x.toString(), c.idRegex.y.toString()], editType: "calc" }, rangebreaks: i("rangebreak", { enabled: { valType: "boolean", dflt: true, editType: "calc" }, bounds: { valType: "info_array", items: [{ valType: "any", editType: "calc" }, { valType: "any", editType: "calc" }], editType: "calc" }, pattern: { valType: "enumerated", values: [h, f, ""], editType: "calc" }, values: { valType: "info_array", freeLength: true, editType: "calc", items: { valType: "any", editType: "calc" } }, dvalue: { valType: "number", editType: "calc", min: 0, dflt: u2 }, editType: "calc" }), tickmode: { valType: "enumerated", values: ["auto", "linear", "array"], editType: "ticks", impliedEdits: { tick0: void 0, dtick: void 0 } }, nticks: { valType: "integer", min: 0, dflt: 0, editType: "ticks" }, tick0: { valType: "any", editType: "ticks", impliedEdits: { tickmode: "linear" } }, dtick: { valType: "any", editType: "ticks", impliedEdits: { tickmode: "linear" } }, tickvals: { valType: "data_array", editType: "ticks" }, ticktext: { valType: "data_array", editType: "ticks" }, ticks: { valType: "enumerated", values: ["outside", "inside", ""], editType: "ticks" }, tickson: { valType: "enumerated", values: ["labels", "boundaries"], dflt: "labels", editType: "ticks" }, ticklabelmode: { valType: "enumerated", values: ["instant", "period"], dflt: "instant", editType: "ticks" }, ticklabelposition: { valType: "enumerated", values: ["outside", "inside", "outside top", "inside top", "outside left", "inside left", "outside right", "inside right", "outside bottom", "inside bottom"], dflt: "outside", editType: "calc" }, ticklabeloverflow: { valType: "enumerated", values: ["allow", "hide past div", "hide past domain"], editType: "calc" }, mirror: { valType: "enumerated", values: [true, "ticks", false, "all", "allticks"], dflt: false, editType: "ticks+layoutstyle" }, ticklen: { valType: "number", min: 0, dflt: 5, editType: "ticks" }, tickwidth: { valType: "number", min: 0, dflt: 1, editType: "ticks" }, tickcolor: { valType: "color", dflt: a.defaultLine, editType: "ticks" }, showticklabels: { valType: "boolean", dflt: true, editType: "ticks" }, automargin: { valType: "boolean", dflt: false, editType: "ticks" }, showspikes: { valType: "boolean", dflt: false, editType: "modebar" }, spikecolor: { valType: "color", dflt: null, editType: "none" }, spikethickness: { valType: "number", dflt: 3, editType: "none" }, spikedash: s({}, o, { dflt: "dash", editType: "none" }), spikemode: { valType: "flaglist", flags: ["toaxis", "across", "marker"], dflt: "toaxis", editType: "none" }, spikesnap: { valType: "enumerated", values: ["data", "cursor", "hovered data"], dflt: "hovered data", editType: "none" }, tickfont: n({ editType: "ticks" }), tickangle: { valType: "angle", dflt: "auto", editType: "ticks" }, tickprefix: { valType: "string", dflt: "", editType: "ticks" }, showtickprefix: { valType: "enumerated", values: ["all", "first", "last", "none"], dflt: "all", editType: "ticks" }, ticksuffix: { valType: "string", dflt: "", editType: "ticks" }, showticksuffix: { valType: "enumerated", values: ["all", "first", "last", "none"], dflt: "all", editType: "ticks" }, showexponent: { valType: "enumerated", values: ["all", "first", "last", "none"], dflt: "all", editType: "ticks" }, exponentformat: { valType: "enumerated", values: ["none", "e", "E", "power", "SI", "B"], dflt: "B", editType: "ticks" }, minexponent: { valType: "number", dflt: 3, min: 0, editType: "ticks" }, separatethousands: { valType: "boolean", dflt: false, editType: "ticks" }, tickformat: { valType: "string", dflt: "", editType: "ticks", description: l("tick label") }, tickformatstops: i("tickformatstop", { enabled: { valType: "boolean", dflt: true, editType: "ticks" }, dtickrange: { valType: "info_array", items: [{ valType: "any", editType: "ticks" }, { valType: "any", editType: "ticks" }], editType: "ticks" }, value: { valType: "string", dflt: "", editType: "ticks" }, editType: "ticks" }), hoverformat: { valType: "string", dflt: "", editType: "none", description: l("hover text") }, showline: { valType: "boolean", dflt: false, editType: "ticks+layoutstyle" }, linecolor: { valType: "color", dflt: a.defaultLine, editType: "layoutstyle" }, linewidth: { valType: "number", min: 0, dflt: 1, editType: "ticks+layoutstyle" }, showgrid: { valType: "boolean", editType: "ticks" }, gridcolor: { valType: "color", dflt: a.lightLine, editType: "ticks" }, gridwidth: { valType: "number", min: 0, dflt: 1, editType: "ticks" }, zeroline: { valType: "boolean", editType: "ticks" }, zerolinecolor: { valType: "color", dflt: a.defaultLine, editType: "ticks" }, zerolinewidth: { valType: "number", dflt: 1, editType: "ticks" }, showdividers: { valType: "boolean", dflt: true, editType: "ticks" }, dividercolor: { valType: "color", dflt: a.defaultLine, editType: "ticks" }, dividerwidth: { valType: "number", dflt: 1, editType: "ticks" }, anchor: { valType: "enumerated", values: ["free", c.idRegex.x.toString(), c.idRegex.y.toString()], editType: "plot" }, side: { valType: "enumerated", values: ["top", "bottom", "left", "right"], editType: "plot" }, overlaying: { valType: "enumerated", values: ["free", c.idRegex.x.toString(), c.idRegex.y.toString()], editType: "plot" }, layer: { valType: "enumerated", values: ["above traces", "below traces"], dflt: "above traces", editType: "plot" }, domain: { valType: "info_array", items: [{ valType: "number", min: 0, max: 1, editType: "plot" }, { valType: "number", min: 0, max: 1, editType: "plot" }], dflt: [0, 1], editType: "plot" }, position: { valType: "number", min: 0, max: 1, dflt: 0, editType: "plot" }, categoryorder: { valType: "enumerated", values: ["trace", "category ascending", "category descending", "array", "total ascending", "total descending", "min ascending", "min descending", "max ascending", "max descending", "sum ascending", "sum descending", "mean ascending", "mean descending", "median ascending", "median descending"], dflt: "trace", editType: "calc" }, categoryarray: { valType: "data_array", editType: "calc" }, uirevision: { valType: "any", editType: "none" }, editType: "calc", _deprecated: { autotick: { valType: "boolean", editType: "ticks" }, title: { valType: "string", editType: "ticks" }, titlefont: n({ editType: "ticks" }) } };
    }, { "../../components/color/attributes": 365, "../../components/drawing/attributes": 387, "../../constants/numerical": 479, "../../lib/extend": 493, "../../plot_api/plot_template": 543, "../../plots/cartesian/axis_format_attributes": 557, "../font_attributes": 585, "./constants": 561 }], 570: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../components/color"), o = e("../../components/fx/helpers").isUnifiedHover, s = e("../../components/fx/hovermode_defaults"), i = e("../../plot_api/plot_template"), l = e("../layout_attributes"), u2 = e("./layout_attributes"), c = e("./type_defaults"), f = e("./axis_defaults"), h = e("./constraints"), p = e("./position_defaults"), d = e("./axis_ids"), v = d.id2name, m = d.name2id, g = e("./constants").AX_ID_PATTERN, x = e("../../registry"), b = x.traceIs, y = x.getComponentMethod;
      function w(_4, k, T2) {
        Array.isArray(_4[k]) ? _4[k].push(T2) : _4[k] = [T2];
      }
      t.exports = function(_4, k, T2) {
        var A2, S2, C2 = k.autotypenumbers, E2 = {}, F13 = {}, N2 = {}, D2 = {}, I2 = {}, O2 = {}, L2 = {}, V2 = {}, W2 = {}, X2 = {};
        for (A2 = 0; A2 < T2.length; A2++) {
          var Y2 = T2[A2];
          if (b(Y2, "cartesian") || b(Y2, "gl2d")) {
            var K2, q;
            if (Y2.xaxis) K2 = v(Y2.xaxis), w(E2, K2, Y2);
            else if (Y2.xaxes) for (S2 = 0; S2 < Y2.xaxes.length; S2++) w(E2, v(Y2.xaxes[S2]), Y2);
            if (Y2.yaxis) q = v(Y2.yaxis), w(E2, q, Y2);
            else if (Y2.yaxes) for (S2 = 0; S2 < Y2.yaxes.length; S2++) w(E2, v(Y2.yaxes[S2]), Y2);
            Y2.type === "funnel" ? Y2.orientation === "h" ? (K2 && (F13[K2] = true), q && (L2[q] = true)) : q && (N2[q] = true) : Y2.type === "image" ? (q && (V2[q] = true), K2 && (V2[K2] = true)) : (q && (I2[q] = true, O2[q] = true), b(Y2, "carpet") && (Y2.type !== "carpet" || Y2._cheater) || K2 && (D2[K2] = true)), Y2.type === "carpet" && Y2._cheater && K2 && (F13[K2] = true), b(Y2, "2dMap") && (W2[K2] = true, W2[q] = true), b(Y2, "oriented") && (X2[Y2.orientation === "h" ? q : K2] = true);
          }
        }
        var re = k._subplots, R2 = re.xaxis, z = re.yaxis, H2 = n.simpleMap(R2, v), te = n.simpleMap(z, v), j = H2.concat(te), Q2 = a.background;
        R2.length && z.length && (Q2 = n.coerce(_4, k, l, "plot_bgcolor"));
        var Z2, ne, ae, ue, le, ce = a.combine(Q2, k.paper_bgcolor);
        function se() {
          var pt = E2[Z2] || [];
          le._traceIndices = pt.map(function(Ot) {
            return Ot._expandedIndex;
          }), le._annIndices = [], le._shapeIndices = [], le._imgIndices = [], le._subplotsWith = [], le._counterAxes = [], le._name = le._attr = Z2, le._id = ne;
        }
        function he(pt, Ot) {
          return n.coerce(ue, le, u2, pt, Ot);
        }
        function me(pt, Ot) {
          return n.coerce2(ue, le, u2, pt, Ot);
        }
        function we(pt) {
          return pt === "x" ? z : R2;
        }
        function be(pt, Ot) {
          for (var Jt = pt === "x" ? H2 : te, tr = [], Ye = 0; Ye < Jt.length; Ye++) {
            var at = Jt[Ye];
            at === Ot || (_4[at] || {}).overlaying || tr.push(m(at));
          }
          return tr;
        }
        var Ae = { x: we("x"), y: we("y") }, pe = Ae.x.concat(Ae.y), ve = {}, Ee = [];
        function Se() {
          var pt = ue.matches;
          g.test(pt) && pe.indexOf(pt) === -1 && (ve[pt] = ue.type, Ee = Object.keys(ve));
        }
        var Ce = s(_4, k), Be = o(Ce);
        for (A2 = 0; A2 < j.length; A2++) {
          Z2 = j[A2], ne = m(Z2), ae = Z2.charAt(0), n.isPlainObject(_4[Z2]) || (_4[Z2] = {}), ue = _4[Z2], le = i.newContainer(k, Z2, ae + "axis"), se();
          var Ue = ae === "x" && !D2[Z2] && F13[Z2] || ae === "y" && !I2[Z2] && N2[Z2], Ke = ae === "y" && (!O2[Z2] && L2[Z2] || V2[Z2]), ct = { letter: ae, font: k.font, outerTicks: W2[Z2], showGrid: !X2[Z2], data: E2[Z2] || [], bgColor: ce, calendar: k.calendar, automargin: true, visibleDflt: Ue, reverseDflt: Ke, autotypenumbersDflt: C2, splomStash: ((k._splomAxes || {})[ae] || {})[ne] };
          he("uirevision", k.uirevision), c(ue, le, he, ct), f(ue, le, he, ct, k);
          var We = Be && ae === Ce.charAt(0), Ze = me("spikecolor", Be ? le.color : void 0), it = me("spikethickness", Be ? 1.5 : void 0), ot = me("spikedash", Be ? "dot" : void 0), mt = me("spikemode", Be ? "across" : void 0), wt = me("spikesnap");
          he("showspikes", !!(We || Ze || it || ot || mt || wt)) || (delete le.spikecolor, delete le.spikethickness, delete le.spikedash, delete le.spikemode, delete le.spikesnap), p(ue, le, he, { letter: ae, counterAxes: Ae[ae], overlayableAxes: be(ae, Z2), grid: k.grid }), he("title.standoff"), Se(), le._input = ue;
        }
        for (A2 = 0; A2 < Ee.length; ) {
          ne = Ee[A2++], ae = (Z2 = v(ne)).charAt(0), n.isPlainObject(_4[Z2]) || (_4[Z2] = {}), ue = _4[Z2], le = i.newContainer(k, Z2, ae + "axis"), se();
          var Et = { letter: ae, font: k.font, outerTicks: W2[Z2], showGrid: !X2[Z2], data: [], bgColor: ce, calendar: k.calendar, automargin: true, visibleDflt: false, reverseDflt: false, autotypenumbersDflt: C2, splomStash: ((k._splomAxes || {})[ae] || {})[ne] };
          he("uirevision", k.uirevision), le.type = ve[ne] || "linear", f(ue, le, he, Et, k), p(ue, le, he, { letter: ae, counterAxes: Ae[ae], overlayableAxes: be(ae, Z2), grid: k.grid }), he("fixedrange"), Se(), le._input = ue;
        }
        var zt = y("rangeslider", "handleDefaults"), Nt = y("rangeselector", "handleDefaults");
        for (A2 = 0; A2 < H2.length; A2++) Z2 = H2[A2], ue = _4[Z2], le = k[Z2], zt(_4, k, Z2), le.type === "date" && Nt(ue, le, k, te, le.calendar), he("fixedrange");
        for (A2 = 0; A2 < te.length; A2++) {
          Z2 = te[A2], ue = _4[Z2], le = k[Z2];
          var yt = k[v(le.anchor)];
          he("fixedrange", y("rangeslider", "isVisible")(yt));
        }
        h.handleDefaults(_4, k, { axIds: pe.concat(Ee).sort(d.idSort), axHasImage: V2 });
      };
    }, { "../../components/color": 366, "../../components/fx/helpers": 402, "../../components/fx/hovermode_defaults": 405, "../../lib": 503, "../../plot_api/plot_template": 543, "../../registry": 638, "../layout_attributes": 610, "./axis_defaults": 556, "./axis_ids": 558, "./constants": 561, "./constraints": 562, "./layout_attributes": 569, "./position_defaults": 572, "./type_defaults": 582 }], 571: [function(e, t, r) {
      "use strict";
      var n = e("tinycolor2").mix, a = e("../../components/color/attributes").lightFraction, o = e("../../lib");
      t.exports = function(s, i, l, u2) {
        var c = (u2 = u2 || {}).dfltColor;
        function f(x, b) {
          return o.coerce2(s, i, u2.attributes, x, b);
        }
        var h = f("linecolor", c), p = f("linewidth");
        l("showline", u2.showLine || !!h || !!p) || (delete i.linecolor, delete i.linewidth);
        var d = f("gridcolor", n(c, u2.bgColor, u2.blend || a).toRgbString()), v = f("gridwidth");
        if (l("showgrid", u2.showGrid || !!d || !!v) || (delete i.gridcolor, delete i.gridwidth), !u2.noZeroLine) {
          var m = f("zerolinecolor", c), g = f("zerolinewidth");
          l("zeroline", u2.showGrid || !!m || !!g) || (delete i.zerolinecolor, delete i.zerolinewidth);
        }
      };
    }, { "../../components/color/attributes": 365, "../../lib": 503, tinycolor2: 312 }], 572: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("../../lib");
      t.exports = function(o, s, i, l) {
        var u2, c, f, h, p = l.counterAxes || [], d = l.overlayableAxes || [], v = l.letter, m = l.grid;
        m && (c = m._domains[v][m._axisMap[s._id]], u2 = m._anchors[s._id], c && (f = m[v + "side"].split(" ")[0], h = m.domain[v][f === "right" || f === "top" ? 1 : 0])), c = c || [0, 1], u2 = u2 || (n(o.position) ? "free" : p[0] || "free"), f = f || (v === "x" ? "bottom" : "left"), h = h || 0, a.coerce(o, s, { anchor: { valType: "enumerated", values: ["free"].concat(p), dflt: u2 } }, "anchor") === "free" && i("position", h), a.coerce(o, s, { side: { valType: "enumerated", values: v === "x" ? ["bottom", "top"] : ["left", "right"], dflt: f } }, "side");
        var g = false;
        if (d.length && (g = a.coerce(o, s, { overlaying: { valType: "enumerated", values: [false].concat(d), dflt: false } }, "overlaying")), !g) {
          var x = i("domain", c);
          x[0] > x[1] - 1 / 4096 && (s.domain = c), a.noneOrAll(o.domain, s.domain, c);
        }
        return i("layer"), s;
      };
    }, { "../../lib": 503, "fast-isnumeric": 190 }], 573: [function(e, t, r) {
      "use strict";
      var n = e("./show_dflt");
      t.exports = function(a, o, s, i, l) {
        l || (l = {});
        var u2 = l.tickSuffixDflt, c = n(a);
        s("tickprefix") && s("showtickprefix", c), s("ticksuffix", u2) && s("showticksuffix", c);
      };
    }, { "./show_dflt": 577 }], 574: [function(e, t, r) {
      "use strict";
      var n = e("../../constants/alignment").FROM_BL;
      t.exports = function(a, o, s) {
        s === void 0 && (s = n[a.constraintoward || "center"]);
        var i = [a.r2l(a.range[0]), a.r2l(a.range[1])], l = i[0] + (i[1] - i[0]) * s;
        a.range = a._input.range = [a.l2r(l + (i[0] - l) * o), a.l2r(l + (i[1] - l) * o)], a.setScale();
      };
    }, { "../../constants/alignment": 471 }], 575: [function(e, t, r) {
      "use strict";
      var n = e("polybooljs"), a = e("../../registry"), o = e("../../components/drawing").dashStyle, s = e("../../components/color"), i = e("../../components/fx"), l = e("../../components/fx/helpers").makeEventData, u2 = e("../../components/dragelement/helpers"), c = u2.freeMode, f = u2.rectMode, h = u2.drawMode, p = u2.openMode, d = u2.selectMode, v = e("../../components/shapes/draw_newshape/display_outlines"), m = e("../../components/shapes/draw_newshape/helpers").handleEllipse, g = e("../../components/shapes/draw_newshape/newshapes"), x = e("../../lib"), b = e("../../lib/polygon"), y = e("../../lib/throttle"), w = e("./axis_ids").getFromId, _4 = e("../../lib/clear_gl_canvases"), k = e("../../plot_api/subroutines").redrawReglTraces, T2 = e("./constants"), A2 = T2.MINSELECT, S2 = b.filter, C2 = b.tester, E2 = e("./handle_outline").clearSelect, F13 = e("./helpers"), N2 = F13.p2r, D2 = F13.axValue, I2 = F13.getTransform;
      function O2(H2, te, j, Q2, Z2, ne, ae) {
        var ue, le, ce, se, he, me, we, be, Ae, pe = te._hoverdata, ve = te._fullLayout.clickmode.indexOf("event") > -1, Ee = [];
        if (function(Ke) {
          return Ke && Array.isArray(Ke) && Ke[0].hoverOnBox !== true;
        }(pe)) {
          X2(H2, te, ne);
          var Se = function(Ke, ct) {
            var We, Ze, it = Ke[0], ot = -1, mt = [];
            for (Ze = 0; Ze < ct.length; Ze++) if (We = ct[Ze], it.fullData._expandedIndex === We.cd[0].trace._expandedIndex) {
              if (it.hoverOnBox === true) break;
              it.pointNumber !== void 0 ? ot = it.pointNumber : it.binNumber !== void 0 && (ot = it.binNumber, mt = it.pointNumbers);
              break;
            }
            return { pointNumber: ot, pointNumbers: mt, searchInfo: We };
          }(pe, ue = K2(te, j, Q2, Z2));
          if (Se.pointNumbers.length > 0 ? function(Ke, ct) {
            var We, Ze, it, ot = [];
            for (it = 0; it < Ke.length; it++) (We = Ke[it]).cd[0].trace.selectedpoints && We.cd[0].trace.selectedpoints.length > 0 && ot.push(We);
            if (ot.length === 1 && ot[0] === ct.searchInfo && (Ze = ct.searchInfo.cd[0].trace).selectedpoints.length === ct.pointNumbers.length) {
              for (it = 0; it < ct.pointNumbers.length; it++) if (Ze.selectedpoints.indexOf(ct.pointNumbers[it]) < 0) return false;
              return true;
            }
            return false;
          }(ue, Se) : function(Ke) {
            var ct, We, Ze, it = 0;
            for (Ze = 0; Ze < Ke.length; Ze++) if (ct = Ke[Ze], (We = ct.cd[0].trace).selectedpoints && (We.selectedpoints.length > 1 || (it += We.selectedpoints.length) > 1)) return false;
            return it === 1;
          }(ue) && (me = q(Se))) {
            for (ae && ae.remove(), Ae = 0; Ae < ue.length; Ae++) (le = ue[Ae])._module.selectPoints(le, false);
            re(te, ue), Y2(ne), ve && te.emit("plotly_deselect", null);
          } else {
            for (we = H2.shiftKey && (me !== void 0 ? me : q(Se)), ce = /* @__PURE__ */ function(Ke, ct, We) {
              return { pointNumber: Ke, searchInfo: ct, subtract: We };
            }(Se.pointNumber, Se.searchInfo, we), se = W2(ne.selectionDefs.concat([ce])), Ae = 0; Ae < ue.length; Ae++) if (he = R2(ue[Ae]._module.selectPoints(ue[Ae], se), ue[Ae]), Ee.length) for (var Ce = 0; Ce < he.length; Ce++) Ee.push(he[Ce]);
            else Ee = he;
            if (re(te, ue, be = { points: Ee }), ce && ne && ne.selectionDefs.push(ce), ae) {
              var Be = ne.mergedPolygons, Ue = p(ne.dragmode);
              v(z(Be, Ue), ae, ne);
            }
            ve && te.emit("plotly_selected", be);
          }
        }
      }
      function L2(H2) {
        return "pointNumber" in H2 && "searchInfo" in H2;
      }
      function V2(H2) {
        return { xmin: 0, xmax: 0, ymin: 0, ymax: 0, pts: [], contains: function(te, j, Q2, Z2) {
          var ne = H2.searchInfo.cd[0].trace._expandedIndex;
          return Z2.cd[0].trace._expandedIndex === ne && Q2 === H2.pointNumber;
        }, isRect: false, degenerate: false, subtract: H2.subtract };
      }
      function W2(H2) {
        for (var te = [], j = L2(H2[0]) ? 0 : H2[0][0][0], Q2 = j, Z2 = L2(H2[0]) ? 0 : H2[0][0][1], ne = Z2, ae = 0; ae < H2.length; ae++) if (L2(H2[ae])) te.push(V2(H2[ae]));
        else {
          var ue = b.tester(H2[ae]);
          ue.subtract = H2[ae].subtract, te.push(ue), j = Math.min(j, ue.xmin), Q2 = Math.max(Q2, ue.xmax), Z2 = Math.min(Z2, ue.ymin), ne = Math.max(ne, ue.ymax);
        }
        return { xmin: j, xmax: Q2, ymin: Z2, ymax: ne, pts: [], contains: function(le, ce, se, he) {
          for (var me = false, we = 0; we < te.length; we++) te[we].contains(le, ce, se, he) && (me = te[we].subtract === false);
          return me;
        }, isRect: false, degenerate: false };
      }
      function X2(H2, te, j) {
        te._fullLayout._drawing = false;
        var Q2 = te._fullLayout, Z2 = j.plotinfo, ne = j.dragmode, ae = Q2._lastSelectedSubplot && Q2._lastSelectedSubplot === Z2.id, ue = (H2.shiftKey || H2.altKey) && !(h(ne) && p(ne));
        ae && ue && Z2.selection && Z2.selection.selectionDefs && !j.selectionDefs ? (j.selectionDefs = Z2.selection.selectionDefs, j.mergedPolygons = Z2.selection.mergedPolygons) : ue && Z2.selection || Y2(j), ae || (E2(te), Q2._lastSelectedSubplot = Z2.id);
      }
      function Y2(H2) {
        var te = H2.dragmode, j = H2.plotinfo, Q2 = H2.gd;
        if (Q2._fullLayout._activeShapeIndex >= 0 && Q2._fullLayout._deactivateShape(Q2), h(te)) {
          var Z2 = Q2._fullLayout._zoomlayer.selectAll(".select-outline-" + j.id);
          if (Z2 && Q2._fullLayout._drawing) {
            var ne = g(Z2, H2);
            ne && a.call("_guiRelayout", Q2, { shapes: ne }), Q2._fullLayout._drawing = false;
          }
        }
        j.selection = {}, j.selection.selectionDefs = H2.selectionDefs = [], j.selection.mergedPolygons = H2.mergedPolygons = [];
      }
      function K2(H2, te, j, Q2) {
        var Z2, ne, ae, ue = [], le = te.map(function(we) {
          return we._id;
        }), ce = j.map(function(we) {
          return we._id;
        });
        for (ae = 0; ae < H2.calcdata.length; ae++) if ((ne = (Z2 = H2.calcdata[ae])[0].trace).visible === true && ne._module && ne._module.selectPoints) if (!Q2 || ne.subplot !== Q2 && ne.geo !== Q2) if (ne.type === "splom" && ne._xaxes[le[0]] && ne._yaxes[ce[0]]) {
          var se = me(ne._module, Z2, te[0], j[0]);
          se.scene = H2._fullLayout._splomScenes[ne.uid], ue.push(se);
        } else if (ne.type === "sankey") {
          var he = me(ne._module, Z2, te[0], j[0]);
          ue.push(he);
        } else {
          if (le.indexOf(ne.xaxis) === -1 || ce.indexOf(ne.yaxis) === -1) continue;
          ue.push(me(ne._module, Z2, w(H2, ne.xaxis), w(H2, ne.yaxis)));
        }
        else ue.push(me(ne._module, Z2, te[0], j[0]));
        return ue;
        function me(we, be, Ae, pe) {
          return { _module: we, cd: be, xaxis: Ae, yaxis: pe };
        }
      }
      function q(H2) {
        var te = H2.searchInfo.cd[0].trace, j = H2.pointNumber, Q2 = H2.pointNumbers, Z2 = Q2.length > 0 ? Q2[0] : j;
        return !!te.selectedpoints && te.selectedpoints.indexOf(Z2) > -1;
      }
      function re(H2, te, j) {
        var Q2, Z2, ne, ae;
        for (Q2 = 0; Q2 < te.length; Q2++) {
          var ue = te[Q2].cd[0].trace._fullInput, le = H2._fullLayout._tracePreGUI[ue.uid] || {};
          le.selectedpoints === void 0 && (le.selectedpoints = ue._input.selectedpoints || null);
        }
        if (j) {
          var ce = j.points || [];
          for (Q2 = 0; Q2 < te.length; Q2++) (ae = te[Q2].cd[0].trace)._input.selectedpoints = ae._fullInput.selectedpoints = [], ae._fullInput !== ae && (ae.selectedpoints = []);
          for (Q2 = 0; Q2 < ce.length; Q2++) {
            var se = ce[Q2], he = se.data, me = se.fullData;
            se.pointIndices ? ([].push.apply(he.selectedpoints, se.pointIndices), ae._fullInput !== ae && [].push.apply(me.selectedpoints, se.pointIndices)) : (he.selectedpoints.push(se.pointIndex), ae._fullInput !== ae && me.selectedpoints.push(se.pointIndex));
          }
        } else for (Q2 = 0; Q2 < te.length; Q2++) delete (ae = te[Q2].cd[0].trace).selectedpoints, delete ae._input.selectedpoints, ae._fullInput !== ae && delete ae._fullInput.selectedpoints;
        var we = false;
        for (Q2 = 0; Q2 < te.length; Q2++) {
          ae = (ne = (Z2 = te[Q2]).cd)[0].trace, a.traceIs(ae, "regl") && (we = true);
          var be = Z2._module, Ae = be.styleOnSelect || be.style;
          Ae && (Ae(H2, ne, ne[0].node3), ne[0].nodeRangePlot3 && Ae(H2, ne, ne[0].nodeRangePlot3));
        }
        we && (_4(H2), k(H2));
      }
      function R2(H2, te) {
        if (Array.isArray(H2)) for (var j = te.cd, Q2 = te.cd[0].trace, Z2 = 0; Z2 < H2.length; Z2++) H2[Z2] = l(H2[Z2], Q2, j);
        return H2;
      }
      function z(H2, te) {
        for (var j = [], Q2 = 0; Q2 < H2.length; Q2++) {
          j[Q2] = [];
          for (var Z2 = 0; Z2 < H2[Q2].length; Z2++) {
            j[Q2][Z2] = [], j[Q2][Z2][0] = Z2 ? "L" : "M";
            for (var ne = 0; ne < H2[Q2][Z2].length; ne++) j[Q2][Z2].push(H2[Q2][Z2][ne]);
          }
          te || j[Q2].push(["Z", j[Q2][0][1], j[Q2][0][2]]);
        }
        return j;
      }
      t.exports = { prepSelect: function(H2, te, j, Q2, Z2) {
        var ne = c(Z2), ae = f(Z2), ue = p(Z2), le = h(Z2), ce = d(Z2), se = Z2 === "drawcircle", he = Z2 === "drawline" || se, me = Q2.gd, we = me._fullLayout, be = we._zoomlayer, Ae = Q2.element.getBoundingClientRect(), pe = Q2.plotinfo, ve = I2(pe), Ee = te - Ae.left, Se = j - Ae.top;
        we._calcInverseTransform(me);
        var Ce = x.apply3DTransform(we._invTransform)(Ee, Se);
        Ee = Ce[0], Se = Ce[1];
        var Be, Ue, Ke, ct, We, Ze, it, ot = we._invScaleX, mt = we._invScaleY, wt = Ee, Et = Se, zt = "M" + Ee + "," + Se, Nt = Q2.xaxes[0]._length, yt = Q2.yaxes[0]._length, pt = Q2.xaxes.concat(Q2.yaxes), Ot = H2.altKey && !(h(Z2) && ue);
        X2(H2, me, Q2), ne && (Be = S2([[Ee, Se]], T2.BENDPX));
        var Jt = be.selectAll("path.select-outline-" + pe.id).data(le ? [0] : [1, 2]), tr = we.newshape;
        Jt.enter().append("path").attr("class", function($e) {
          return "select-outline select-outline-" + $e + " select-outline-" + pe.id;
        }).style(le ? { opacity: tr.opacity / 2, fill: ue ? void 0 : tr.fillcolor, stroke: tr.line.color, "stroke-dasharray": o(tr.line.dash, tr.line.width), "stroke-width": tr.line.width + "px" } : {}).attr("fill-rule", tr.fillrule).classed("cursor-move", !!le).attr("transform", ve).attr("d", zt + "Z");
        var Ye, at = be.append("path").attr("class", "zoombox-corners").style({ fill: s.background, stroke: s.defaultLine, "stroke-width": 1 }).attr("transform", ve).attr("d", "M0,0Z"), Ge = we._uid + T2.SELECTID, st = [], Ie = K2(me, Q2.xaxes, Q2.yaxes, Q2.subplot);
        function Pe($e, Ve) {
          return $e - Ve;
        }
        Ye = pe.fillRangeItems ? pe.fillRangeItems : ae ? function($e, Ve) {
          var ut = $e.range = {};
          for (We = 0; We < pt.length; We++) {
            var Re = pt[We], qe = Re._id.charAt(0);
            ut[Re._id] = [N2(Re, Ve[qe + "min"]), N2(Re, Ve[qe + "max"])].sort(Pe);
          }
        } : function($e, Ve, ut) {
          var Re = $e.lassoPoints = {};
          for (We = 0; We < pt.length; We++) {
            var qe = pt[We];
            Re[qe._id] = ut.filtered.map(D2(qe));
          }
        }, Q2.moveFn = function($e, Ve) {
          wt = Math.max(0, Math.min(Nt, ot * $e + Ee)), Et = Math.max(0, Math.min(yt, mt * Ve + Se));
          var ut = Math.abs(wt - Ee), Re = Math.abs(Et - Se);
          if (ae) {
            var qe, je, rt;
            if (ce) {
              var He = we.selectdirection;
              switch (qe = He === "any" ? Re < Math.min(0.6 * ut, A2) ? "h" : ut < Math.min(0.6 * Re, A2) ? "v" : "d" : He) {
                case "h":
                  je = se ? yt / 2 : 0, rt = yt;
                  break;
                case "v":
                  je = se ? Nt / 2 : 0, rt = Nt;
              }
            }
            if (le) switch (we.newshape.drawdirection) {
              case "vertical":
                qe = "h", je = se ? yt / 2 : 0, rt = yt;
                break;
              case "horizontal":
                qe = "v", je = se ? Nt / 2 : 0, rt = Nt;
                break;
              case "ortho":
                ut < Re ? (qe = "h", je = Se, rt = Et) : (qe = "v", je = Ee, rt = wt);
                break;
              default:
                qe = "d";
            }
            qe === "h" ? ((ct = he ? m(se, [wt, je], [wt, rt]) : [[Ee, je], [Ee, rt], [wt, rt], [wt, je]]).xmin = he ? wt : Math.min(Ee, wt), ct.xmax = he ? wt : Math.max(Ee, wt), ct.ymin = Math.min(je, rt), ct.ymax = Math.max(je, rt), at.attr("d", "M" + ct.xmin + "," + (Se - A2) + "h-4v" + 2 * A2 + "h4ZM" + (ct.xmax - 1) + "," + (Se - A2) + "h4v" + 2 * A2 + "h-4Z")) : qe === "v" ? ((ct = he ? m(se, [je, Et], [rt, Et]) : [[je, Se], [je, Et], [rt, Et], [rt, Se]]).xmin = Math.min(je, rt), ct.xmax = Math.max(je, rt), ct.ymin = he ? Et : Math.min(Se, Et), ct.ymax = he ? Et : Math.max(Se, Et), at.attr("d", "M" + (Ee - A2) + "," + ct.ymin + "v-4h" + 2 * A2 + "v4ZM" + (Ee - A2) + "," + (ct.ymax - 1) + "v4h" + 2 * A2 + "v-4Z")) : qe === "d" && ((ct = he ? m(se, [Ee, Se], [wt, Et]) : [[Ee, Se], [Ee, Et], [wt, Et], [wt, Se]]).xmin = Math.min(Ee, wt), ct.xmax = Math.max(Ee, wt), ct.ymin = Math.min(Se, Et), ct.ymax = Math.max(Se, Et), at.attr("d", "M0,0Z"));
          } else ne && (Be.addPt([wt, Et]), ct = Be.filtered);
          Q2.selectionDefs && Q2.selectionDefs.length ? (Ke = function(xe, Ne, ke) {
            return ke ? n.difference({ regions: xe, inverted: false }, { regions: [Ne], inverted: false }).regions : n.union({ regions: xe, inverted: false }, { regions: [Ne], inverted: false }).regions;
          }(Q2.mergedPolygons, ct, Ot), ct.subtract = Ot, Ue = W2(Q2.selectionDefs.concat([ct]))) : (Ke = [ct], Ue = C2(ct)), v(z(Ke, ue), Jt, Q2), ce && y.throttle(Ge, T2.SELECTDELAY, function() {
            var xe;
            st = [];
            var Ne, ke = [];
            for (We = 0; We < Ie.length; We++) if (Ne = (Ze = Ie[We])._module.selectPoints(Ze, Ue), ke.push(Ne), xe = R2(Ne, Ze), st.length) for (var Me = 0; Me < xe.length; Me++) st.push(xe[Me]);
            else st = xe;
            re(me, Ie, it = { points: st }), Ye(it, ct, Be), Q2.gd.emit("plotly_selecting", it);
          });
        }, Q2.clickFn = function($e, Ve) {
          if (at.remove(), me._fullLayout._activeShapeIndex >= 0) me._fullLayout._deactivateShape(me);
          else if (!le) {
            var ut = we.clickmode;
            y.done(Ge).then(function() {
              if (y.clear(Ge), $e === 2) {
                for (Jt.remove(), We = 0; We < Ie.length; We++) (Ze = Ie[We])._module.selectPoints(Ze, false);
                re(me, Ie), Y2(Q2), me.emit("plotly_deselect", null);
              } else ut.indexOf("select") > -1 && O2(Ve, me, Q2.xaxes, Q2.yaxes, Q2.subplot, Q2, Jt), ut === "event" && me.emit("plotly_selected", void 0);
              i.click(me, Ve);
            }).catch(x.error);
          }
        }, Q2.doneFn = function() {
          at.remove(), y.done(Ge).then(function() {
            y.clear(Ge), Q2.gd.emit("plotly_selected", it), ct && Q2.selectionDefs && (ct.subtract = Ot, Q2.selectionDefs.push(ct), Q2.mergedPolygons.length = 0, [].push.apply(Q2.mergedPolygons, Ke)), Q2.doneFnCompleted && Q2.doneFnCompleted(st);
          }).catch(x.error), le && Y2(Q2);
        };
      }, clearSelect: E2, clearSelectionsCache: Y2, selectOnClick: O2 };
    }, { "../../components/color": 366, "../../components/dragelement/helpers": 384, "../../components/drawing": 388, "../../components/fx": 406, "../../components/fx/helpers": 402, "../../components/shapes/draw_newshape/display_outlines": 454, "../../components/shapes/draw_newshape/helpers": 455, "../../components/shapes/draw_newshape/newshapes": 456, "../../lib": 503, "../../lib/clear_gl_canvases": 487, "../../lib/polygon": 515, "../../lib/throttle": 530, "../../plot_api/subroutines": 544, "../../registry": 638, "./axis_ids": 558, "./constants": 561, "./handle_outline": 565, "./helpers": 566, polybooljs: 254 }], 576: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("d3-time-format").utcFormat, o = e("../../lib"), s = o.numberFormat, i = e("fast-isnumeric"), l = o.cleanNumber, u2 = o.ms2DateTime, c = o.dateTime2ms, f = o.ensureNumber, h = o.isArrayOrTypedArray, p = e("../../constants/numerical"), d = p.FP_SAFE, v = p.BADNUM, m = p.LOG_CLIP, g = p.ONEWEEK, x = p.ONEDAY, b = p.ONEHOUR, y = p.ONEMIN, w = p.ONESEC, _4 = e("./axis_ids"), k = e("./constants"), T2 = k.HOUR_PATTERN, A2 = k.WEEKDAY_PATTERN;
      function S2(E2) {
        return Math.pow(10, E2);
      }
      function C2(E2) {
        return E2 != null;
      }
      t.exports = function(E2, F13) {
        F13 = F13 || {};
        var N2 = E2._id || "x", D2 = N2.charAt(0);
        function I2(j, Q2) {
          if (j > 0) return Math.log(j) / Math.LN10;
          if (j <= 0 && Q2 && E2.range && E2.range.length === 2) {
            var Z2 = E2.range[0], ne = E2.range[1];
            return 0.5 * (Z2 + ne - 2 * m * Math.abs(Z2 - ne));
          }
          return v;
        }
        function O2(j, Q2, Z2, ne) {
          if ((ne || {}).msUTC && i(j)) return +j;
          var ae = c(j, Z2 || E2.calendar);
          if (ae === v) {
            if (!i(j)) return v;
            j = +j;
            var ue = Math.floor(10 * o.mod(j + 0.05, 1)), le = Math.round(j - ue / 10);
            ae = c(new Date(le)) + ue / 10;
          }
          return ae;
        }
        function L2(j, Q2, Z2) {
          return u2(j, Q2, Z2 || E2.calendar);
        }
        function V2(j) {
          return E2._categories[Math.round(j)];
        }
        function W2(j) {
          if (C2(j)) {
            if (E2._categoriesMap === void 0 && (E2._categoriesMap = {}), E2._categoriesMap[j] !== void 0) return E2._categoriesMap[j];
            E2._categories.push(typeof j == "number" ? String(j) : j);
            var Q2 = E2._categories.length - 1;
            return E2._categoriesMap[j] = Q2, Q2;
          }
          return v;
        }
        function X2(j) {
          if (E2._categoriesMap) return E2._categoriesMap[j];
        }
        function Y2(j) {
          var Q2 = X2(j);
          return Q2 !== void 0 ? Q2 : i(j) ? +j : void 0;
        }
        function K2(j) {
          return i(j) ? +j : X2(j);
        }
        function q(j, Q2, Z2) {
          return n.round(Z2 + Q2 * j, 2);
        }
        function re(j, Q2, Z2) {
          return (j - Z2) / Q2;
        }
        var R2 = function(j) {
          return i(j) ? q(j, E2._m, E2._b) : v;
        }, z = function(j) {
          return re(j, E2._m, E2._b);
        };
        if (E2.rangebreaks) {
          var H2 = D2 === "y";
          R2 = function(j) {
            if (!i(j)) return v;
            var Q2 = E2._rangebreaks.length;
            if (!Q2) return q(j, E2._m, E2._b);
            var Z2 = H2;
            E2.range[0] > E2.range[1] && (Z2 = !Z2);
            for (var ne = Z2 ? -1 : 1, ae = ne * j, ue = 0, le = 0; le < Q2; le++) {
              var ce = ne * E2._rangebreaks[le].min, se = ne * E2._rangebreaks[le].max;
              if (ae < ce) break;
              if (!(ae > se)) {
                ue = ae < (ce + se) / 2 ? le : le + 1;
                break;
              }
              ue = le + 1;
            }
            var he = E2._B[ue] || 0;
            return isFinite(he) ? q(j, E2._m2, he) : 0;
          }, z = function(j) {
            var Q2 = E2._rangebreaks.length;
            if (!Q2) return re(j, E2._m, E2._b);
            for (var Z2 = 0, ne = 0; ne < Q2 && !(j < E2._rangebreaks[ne].pmin); ne++) j > E2._rangebreaks[ne].pmax && (Z2 = ne + 1);
            return re(j, E2._m2, E2._B[Z2]);
          };
        }
        E2.c2l = E2.type === "log" ? I2 : f, E2.l2c = E2.type === "log" ? S2 : f, E2.l2p = R2, E2.p2l = z, E2.c2p = E2.type === "log" ? function(j, Q2) {
          return R2(I2(j, Q2));
        } : R2, E2.p2c = E2.type === "log" ? function(j) {
          return S2(z(j));
        } : z, ["linear", "-"].indexOf(E2.type) !== -1 ? (E2.d2r = E2.r2d = E2.d2c = E2.r2c = E2.d2l = E2.r2l = l, E2.c2d = E2.c2r = E2.l2d = E2.l2r = f, E2.d2p = E2.r2p = function(j) {
          return E2.l2p(l(j));
        }, E2.p2d = E2.p2r = z, E2.cleanPos = f) : E2.type === "log" ? (E2.d2r = E2.d2l = function(j, Q2) {
          return I2(l(j), Q2);
        }, E2.r2d = E2.r2c = function(j) {
          return S2(l(j));
        }, E2.d2c = E2.r2l = l, E2.c2d = E2.l2r = f, E2.c2r = I2, E2.l2d = S2, E2.d2p = function(j, Q2) {
          return E2.l2p(E2.d2r(j, Q2));
        }, E2.p2d = function(j) {
          return S2(z(j));
        }, E2.r2p = function(j) {
          return E2.l2p(l(j));
        }, E2.p2r = z, E2.cleanPos = f) : E2.type === "date" ? (E2.d2r = E2.r2d = o.identity, E2.d2c = E2.r2c = E2.d2l = E2.r2l = O2, E2.c2d = E2.c2r = E2.l2d = E2.l2r = L2, E2.d2p = E2.r2p = function(j, Q2, Z2) {
          return E2.l2p(O2(j, 0, Z2));
        }, E2.p2d = E2.p2r = function(j, Q2, Z2) {
          return L2(z(j), Q2, Z2);
        }, E2.cleanPos = function(j) {
          return o.cleanDate(j, v, E2.calendar);
        }) : E2.type === "category" ? (E2.d2c = E2.d2l = W2, E2.r2d = E2.c2d = E2.l2d = V2, E2.d2r = E2.d2l_noadd = Y2, E2.r2c = function(j) {
          var Q2 = K2(j);
          return Q2 !== void 0 ? Q2 : E2.fraction2r(0.5);
        }, E2.l2r = E2.c2r = f, E2.r2l = K2, E2.d2p = function(j) {
          return E2.l2p(E2.r2c(j));
        }, E2.p2d = function(j) {
          return V2(z(j));
        }, E2.r2p = E2.d2p, E2.p2r = z, E2.cleanPos = function(j) {
          return typeof j == "string" && j !== "" ? j : f(j);
        }) : E2.type === "multicategory" && (E2.r2d = E2.c2d = E2.l2d = V2, E2.d2r = E2.d2l_noadd = Y2, E2.r2c = function(j) {
          var Q2 = Y2(j);
          return Q2 !== void 0 ? Q2 : E2.fraction2r(0.5);
        }, E2.r2c_just_indices = X2, E2.l2r = E2.c2r = f, E2.r2l = Y2, E2.d2p = function(j) {
          return E2.l2p(E2.r2c(j));
        }, E2.p2d = function(j) {
          return V2(z(j));
        }, E2.r2p = E2.d2p, E2.p2r = z, E2.cleanPos = function(j) {
          return Array.isArray(j) || typeof j == "string" && j !== "" ? j : f(j);
        }, E2.setupMultiCategory = function(j) {
          var Q2, Z2, ne = E2._traceIndices, ae = E2._matchGroup;
          if (ae && E2._categories.length === 0) {
            for (var ue in ae) if (ue !== N2) {
              var le = F13[_4.id2name(ue)];
              ne = ne.concat(le._traceIndices);
            }
          }
          var ce = [[0, {}], [0, {}]], se = [];
          for (Q2 = 0; Q2 < ne.length; Q2++) {
            var he = j[ne[Q2]];
            if (D2 in he) {
              var me = he[D2], we = he._length || o.minRowLength(me);
              if (h(me[0]) && h(me[1])) for (Z2 = 0; Z2 < we; Z2++) {
                var be = me[0][Z2], Ae = me[1][Z2];
                C2(be) && C2(Ae) && (se.push([be, Ae]), be in ce[0][1] || (ce[0][1][be] = ce[0][0]++), Ae in ce[1][1] || (ce[1][1][Ae] = ce[1][0]++));
              }
            }
          }
          for (se.sort(function(pe, ve) {
            var Ee = ce[0][1], Se = Ee[pe[0]] - Ee[ve[0]];
            if (Se) return Se;
            var Ce = ce[1][1];
            return Ce[pe[1]] - Ce[ve[1]];
          }), Q2 = 0; Q2 < se.length; Q2++) W2(se[Q2]);
        }), E2.fraction2r = function(j) {
          var Q2 = E2.r2l(E2.range[0]), Z2 = E2.r2l(E2.range[1]);
          return E2.l2r(Q2 + j * (Z2 - Q2));
        }, E2.r2fraction = function(j) {
          var Q2 = E2.r2l(E2.range[0]), Z2 = E2.r2l(E2.range[1]);
          return (E2.r2l(j) - Q2) / (Z2 - Q2);
        }, E2.cleanRange = function(j, Q2) {
          Q2 || (Q2 = {}), j || (j = "range");
          var Z2, ne, ae = o.nestedProperty(E2, j).get();
          if (ne = (ne = E2.type === "date" ? o.dfltRange(E2.calendar) : D2 === "y" ? k.DFLTRANGEY : E2._name === "realaxis" ? [0, 1] : Q2.dfltRange || k.DFLTRANGEX).slice(), E2.rangemode !== "tozero" && E2.rangemode !== "nonnegative" || (ne[0] = 0), ae && ae.length === 2) for (E2.type !== "date" || E2.autorange || (ae[0] = o.cleanDate(ae[0], v, E2.calendar), ae[1] = o.cleanDate(ae[1], v, E2.calendar)), Z2 = 0; Z2 < 2; Z2++) if (E2.type === "date") {
            if (!o.isDateTime(ae[Z2], E2.calendar)) {
              E2[j] = ne;
              break;
            }
            if (E2.r2l(ae[0]) === E2.r2l(ae[1])) {
              var ue = o.constrain(E2.r2l(ae[0]), o.MIN_MS + 1e3, o.MAX_MS - 1e3);
              ae[0] = E2.l2r(ue - 1e3), ae[1] = E2.l2r(ue + 1e3);
              break;
            }
          } else {
            if (!i(ae[Z2])) {
              if (!i(ae[1 - Z2])) {
                E2[j] = ne;
                break;
              }
              ae[Z2] = ae[1 - Z2] * (Z2 ? 10 : 0.1);
            }
            if (ae[Z2] < -d ? ae[Z2] = -d : ae[Z2] > d && (ae[Z2] = d), ae[0] === ae[1]) {
              var le = Math.max(1, Math.abs(1e-6 * ae[0]));
              ae[0] -= le, ae[1] += le;
            }
          }
          else o.nestedProperty(E2, j).set(ne);
        }, E2.setScale = function(j) {
          var Q2 = F13._size;
          if (E2.overlaying) {
            var Z2 = _4.getFromId({ _fullLayout: F13 }, E2.overlaying);
            E2.domain = Z2.domain;
          }
          var ne = j && E2._r ? "_r" : "range", ae = E2.calendar;
          E2.cleanRange(ne);
          var ue, le, ce = E2.r2l(E2[ne][0], ae), se = E2.r2l(E2[ne][1], ae), he = D2 === "y";
          if (he ? (E2._offset = Q2.t + (1 - E2.domain[1]) * Q2.h, E2._length = Q2.h * (E2.domain[1] - E2.domain[0]), E2._m = E2._length / (ce - se), E2._b = -E2._m * se) : (E2._offset = Q2.l + E2.domain[0] * Q2.w, E2._length = Q2.w * (E2.domain[1] - E2.domain[0]), E2._m = E2._length / (se - ce), E2._b = -E2._m * ce), E2._rangebreaks = [], E2._lBreaks = 0, E2._m2 = 0, E2._B = [], E2.rangebreaks && (E2._rangebreaks = E2.locateBreaks(Math.min(ce, se), Math.max(ce, se)), E2._rangebreaks.length)) {
            for (ue = 0; ue < E2._rangebreaks.length; ue++) le = E2._rangebreaks[ue], E2._lBreaks += Math.abs(le.max - le.min);
            var me = he;
            ce > se && (me = !me), me && E2._rangebreaks.reverse();
            var we = me ? -1 : 1;
            for (E2._m2 = we * E2._length / (Math.abs(se - ce) - E2._lBreaks), E2._B.push(-E2._m2 * (he ? se : ce)), ue = 0; ue < E2._rangebreaks.length; ue++) le = E2._rangebreaks[ue], E2._B.push(E2._B[E2._B.length - 1] - we * E2._m2 * (le.max - le.min));
            for (ue = 0; ue < E2._rangebreaks.length; ue++) (le = E2._rangebreaks[ue]).pmin = R2(le.min), le.pmax = R2(le.max);
          }
          if (!isFinite(E2._m) || !isFinite(E2._b) || E2._length < 0) throw F13._replotting = false, new Error("Something went wrong with axis scaling");
        }, E2.maskBreaks = function(j) {
          var Q2, Z2, ne, ae, ue, le = E2.rangebreaks || [];
          le._cachedPatterns || (le._cachedPatterns = le.map(function(be) {
            return be.enabled && be.bounds ? o.simpleMap(be.bounds, be.pattern ? l : E2.d2c) : null;
          })), le._cachedValues || (le._cachedValues = le.map(function(be) {
            return be.enabled && be.values ? o.simpleMap(be.values, E2.d2c).sort(o.sorterAsc) : null;
          }));
          for (var ce = 0; ce < le.length; ce++) {
            var se = le[ce];
            if (se.enabled) {
              if (se.bounds) {
                var he = se.pattern;
                switch (Z2 = (Q2 = le._cachedPatterns[ce])[0], ne = Q2[1], he) {
                  case A2:
                    ae = (ue = new Date(j)).getUTCDay(), Z2 > ne && (ne += 7, ae < Z2 && (ae += 7));
                    break;
                  case T2:
                    ae = (ue = new Date(j)).getUTCHours() + (ue.getUTCMinutes() / 60 + ue.getUTCSeconds() / 3600 + ue.getUTCMilliseconds() / 36e5), Z2 > ne && (ne += 24, ae < Z2 && (ae += 24));
                    break;
                  case "":
                    ae = j;
                }
                if (ae >= Z2 && ae < ne) return v;
              } else for (var me = le._cachedValues[ce], we = 0; we < me.length; we++) if (ne = (Z2 = me[we]) + se.dvalue, j >= Z2 && j < ne) return v;
            }
          }
          return j;
        }, E2.locateBreaks = function(j, Q2) {
          var Z2, ne, ae, ue, le = [];
          if (!E2.rangebreaks) return le;
          var ce = E2.rangebreaks.slice().sort(function(Ce, Be) {
            return Ce.pattern === A2 && Be.pattern === T2 ? -1 : Be.pattern === A2 && Ce.pattern === T2 ? 1 : 0;
          }), se = function(Ce, Be) {
            if ((Ce = o.constrain(Ce, j, Q2)) !== (Be = o.constrain(Be, j, Q2))) {
              for (var Ue = true, Ke = 0; Ke < le.length; Ke++) {
                var ct = le[Ke];
                Ce < ct.max && Be >= ct.min && (Ce < ct.min && (ct.min = Ce), Be > ct.max && (ct.max = Be), Ue = false);
              }
              Ue && le.push({ min: Ce, max: Be });
            }
          };
          for (Z2 = 0; Z2 < ce.length; Z2++) {
            var he = ce[Z2];
            if (he.enabled) if (he.bounds) {
              var me = j, we = Q2;
              he.pattern && (me = Math.floor(me)), ae = (ne = o.simpleMap(he.bounds, he.pattern ? l : E2.r2l))[0], ue = ne[1];
              var be, Ae, pe = new Date(me);
              switch (he.pattern) {
                case A2:
                  Ae = g, be = (ue - ae + (ue < ae ? 7 : 0)) * x, me += ae * x - (pe.getUTCDay() * x + pe.getUTCHours() * b + pe.getUTCMinutes() * y + pe.getUTCSeconds() * w + pe.getUTCMilliseconds());
                  break;
                case T2:
                  Ae = x, be = (ue - ae + (ue < ae ? 24 : 0)) * b, me += ae * b - (pe.getUTCHours() * b + pe.getUTCMinutes() * y + pe.getUTCSeconds() * w + pe.getUTCMilliseconds());
                  break;
                default:
                  me = Math.min(ne[0], ne[1]), be = Ae = (we = Math.max(ne[0], ne[1])) - me;
              }
              for (var ve = me; ve < we; ve += Ae) se(ve, ve + be);
            } else for (var Ee = o.simpleMap(he.values, E2.d2c), Se = 0; Se < Ee.length; Se++) se(ae = Ee[Se], ue = ae + he.dvalue);
          }
          return le.sort(function(Ce, Be) {
            return Ce.min - Be.min;
          }), le;
        }, E2.makeCalcdata = function(j, Q2, Z2) {
          var ne, ae, ue, le, ce = E2.type, se = ce === "date" && j[Q2 + "calendar"];
          if (Q2 in j) {
            if (ne = j[Q2], le = j._length || o.minRowLength(ne), o.isTypedArray(ne) && (ce === "linear" || ce === "log")) {
              if (le === ne.length) return ne;
              if (ne.subarray) return ne.subarray(0, le);
            }
            if (ce === "multicategory") return function(we, be) {
              for (var Ae = new Array(be), pe = 0; pe < be; pe++) {
                var ve = (we[0] || [])[pe], Ee = (we[1] || [])[pe];
                Ae[pe] = X2([ve, Ee]);
              }
              return Ae;
            }(ne, le);
            for (ae = new Array(le), ue = 0; ue < le; ue++) ae[ue] = E2.d2c(ne[ue], 0, se, Z2);
          } else {
            var he = Q2 + "0" in j ? E2.d2c(j[Q2 + "0"], 0, se) : 0, me = j["d" + Q2] ? Number(j["d" + Q2]) : 1;
            for (ne = j[{ x: "y", y: "x" }[Q2]], le = j._length || ne.length, ae = new Array(le), ue = 0; ue < le; ue++) ae[ue] = he + ue * me;
          }
          if (E2.rangebreaks) for (ue = 0; ue < le; ue++) ae[ue] = E2.maskBreaks(ae[ue]);
          return ae;
        }, E2.isValidRange = function(j) {
          return Array.isArray(j) && j.length === 2 && i(E2.r2l(j[0])) && i(E2.r2l(j[1]));
        }, E2.isPtWithinRange = function(j, Q2) {
          var Z2 = E2.c2l(j[D2], null, Q2), ne = E2.r2l(E2.range[0]), ae = E2.r2l(E2.range[1]);
          return ne < ae ? ne <= Z2 && Z2 <= ae : ae <= Z2 && Z2 <= ne;
        }, E2._emptyCategories = function() {
          E2._categories = [], E2._categoriesMap = {};
        }, E2.clearCalc = function() {
          var j = E2._matchGroup;
          if (j) {
            var Q2 = null, Z2 = null;
            for (var ne in j) {
              var ae = F13[_4.id2name(ne)];
              if (ae._categories) {
                Q2 = ae._categories, Z2 = ae._categoriesMap;
                break;
              }
            }
            Q2 && Z2 ? (E2._categories = Q2, E2._categoriesMap = Z2) : E2._emptyCategories();
          } else E2._emptyCategories();
          if (E2._initialCategories) for (var ue = 0; ue < E2._initialCategories.length; ue++) W2(E2._initialCategories[ue]);
        }, E2.sortByInitialCategories = function() {
          var j = [];
          if (E2._emptyCategories(), E2._initialCategories) for (var Q2 = 0; Q2 < E2._initialCategories.length; Q2++) W2(E2._initialCategories[Q2]);
          j = j.concat(E2._traceIndices);
          var Z2 = E2._matchGroup;
          for (var ne in Z2) if (N2 !== ne) {
            var ae = F13[_4.id2name(ne)];
            ae._categories = E2._categories, ae._categoriesMap = E2._categoriesMap, j = j.concat(ae._traceIndices);
          }
          return j;
        };
        var te = F13._d3locale;
        E2.type === "date" && (E2._dateFormat = te ? te.timeFormat : a, E2._extraFormat = F13._extraFormat), E2._separators = F13.separators, E2._numFormat = te ? te.numberFormat : s, delete E2._minDtick, delete E2._forceTick0;
      };
    }, { "../../constants/numerical": 479, "../../lib": 503, "./axis_ids": 558, "./constants": 561, "@plotly/d3": 58, "d3-time-format": 120, "fast-isnumeric": 190 }], 577: [function(e, t, r) {
      "use strict";
      t.exports = function(n) {
        var a = ["showexponent", "showtickprefix", "showticksuffix"].filter(function(o) {
          return n[o] !== void 0;
        });
        if (a.every(function(o) {
          return n[o] === n[a[0]];
        }) || a.length === 1) return n[a[0]];
      };
    }, {}], 578: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../components/color").contrast, o = e("./layout_attributes"), s = e("./show_dflt"), i = e("../array_container_defaults");
      function l(u2, c) {
        function f(h, p) {
          return n.coerce(u2, c, o.tickformatstops, h, p);
        }
        f("enabled") && (f("dtickrange"), f("value"));
      }
      t.exports = function(u2, c, f, h, p) {
        p || (p = {});
        var d = s(u2);
        if (f("showticklabels")) {
          var v = p.font || {}, m = c.color, g = (c.ticklabelposition || "").indexOf("inside") !== -1 ? a(p.bgColor) : m && m !== o.color.dflt ? m : v.color;
          if (n.coerceFont(f, "tickfont", { family: v.family, size: v.size, color: g }), p.noAng || f("tickangle"), h !== "category") {
            var x = f("tickformat");
            i(u2, c, { name: "tickformatstops", inclusionAttr: "enabled", handleItemDefaults: l }), c.tickformatstops.length || delete c.tickformatstops, p.noExp || x || h === "date" || (f("showexponent", d), f("exponentformat"), f("minexponent"), f("separatethousands"));
          }
        }
      };
    }, { "../../components/color": 366, "../../lib": 503, "../array_container_defaults": 549, "./layout_attributes": 569, "./show_dflt": 577 }], 579: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("./layout_attributes");
      t.exports = function(o, s, i, l) {
        var u2 = n.coerce2(o, s, a, "ticklen"), c = n.coerce2(o, s, a, "tickwidth"), f = n.coerce2(o, s, a, "tickcolor", s.color);
        i("ticks", l.outerTicks || u2 || c || f ? "outside" : "") || (delete s.ticklen, delete s.tickwidth, delete s.tickcolor);
      };
    }, { "../../lib": 503, "./layout_attributes": 569 }], 580: [function(e, t, r) {
      "use strict";
      var n = e("./clean_ticks"), a = e("../../lib").isArrayOrTypedArray;
      t.exports = function(o, s, i, l) {
        function u2(v) {
          var m = o[v];
          return m !== void 0 ? m : (s._template || {})[v];
        }
        var c = u2("tick0"), f = u2("dtick"), h = u2("tickvals"), p = i("tickmode", a(h) ? "array" : f ? "linear" : "auto");
        if (p === "auto") i("nticks");
        else if (p === "linear") {
          var d = s.dtick = n.dtick(f, l);
          s.tick0 = n.tick0(c, l, s.calendar, d);
        } else l !== "multicategory" && (i("tickvals") === void 0 ? s.tickmode = "auto" : i("ticktext"));
      };
    }, { "../../lib": 503, "./clean_ticks": 560 }], 581: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../registry"), o = e("../../lib"), s = e("../../components/drawing"), i = e("./axes");
      t.exports = function(l, u2, c, f) {
        var h = l._fullLayout;
        if (u2.length !== 0) {
          var p, d, v, m;
          f && (p = f());
          var g = n.ease(c.easing);
          return l._transitionData._interruptCallbacks.push(function() {
            return window.cancelAnimationFrame(m), m = null, function() {
              for (var y = {}, w = 0; w < u2.length; w++) {
                var _4 = u2[w], k = _4.plotinfo.xaxis, T2 = _4.plotinfo.yaxis;
                _4.xr0 && (y[k._name + ".range"] = _4.xr0.slice()), _4.yr0 && (y[T2._name + ".range"] = _4.yr0.slice());
              }
              return a.call("relayout", l, y).then(function() {
                for (var A2 = 0; A2 < u2.length; A2++) x(u2[A2].plotinfo);
              });
            }();
          }), d = Date.now(), m = window.requestAnimationFrame(function y() {
            v = Date.now();
            for (var w = Math.min(1, (v - d) / c.duration), _4 = g(w), k = 0; k < u2.length; k++) b(u2[k], _4);
            v - d > c.duration ? (function() {
              for (var T2 = {}, A2 = 0; A2 < u2.length; A2++) {
                var S2 = u2[A2], C2 = S2.plotinfo.xaxis, E2 = S2.plotinfo.yaxis;
                S2.xr1 && (T2[C2._name + ".range"] = S2.xr1.slice()), S2.yr1 && (T2[E2._name + ".range"] = S2.yr1.slice());
              }
              p && p(), a.call("relayout", l, T2).then(function() {
                for (var F13 = 0; F13 < u2.length; F13++) x(u2[F13].plotinfo);
              });
            }(), m = window.cancelAnimationFrame(y)) : m = window.requestAnimationFrame(y);
          }), Promise.resolve();
        }
        function x(y) {
          var w = y.xaxis, _4 = y.yaxis;
          h._defs.select("#" + y.clipId + "> rect").call(s.setTranslate, 0, 0).call(s.setScale, 1, 1), y.plot.call(s.setTranslate, w._offset, _4._offset).call(s.setScale, 1, 1);
          var k = y.plot.selectAll(".scatterlayer .trace");
          k.selectAll(".point").call(s.setPointGroupScale, 1, 1), k.selectAll(".textpoint").call(s.setTextPointsScale, 1, 1), k.call(s.hideOutsideRangePoints, y);
        }
        function b(y, w) {
          var _4 = y.plotinfo, k = _4.xaxis, T2 = _4.yaxis, A2 = k._length, S2 = T2._length, C2 = !!y.xr1, E2 = !!y.yr1, F13 = [];
          if (C2) {
            var N2 = o.simpleMap(y.xr0, k.r2l), D2 = o.simpleMap(y.xr1, k.r2l), I2 = N2[1] - N2[0], O2 = D2[1] - D2[0];
            F13[0] = (N2[0] * (1 - w) + w * D2[0] - N2[0]) / (N2[1] - N2[0]) * A2, F13[2] = A2 * (1 - w + w * O2 / I2), k.range[0] = k.l2r(N2[0] * (1 - w) + w * D2[0]), k.range[1] = k.l2r(N2[1] * (1 - w) + w * D2[1]);
          } else F13[0] = 0, F13[2] = A2;
          if (E2) {
            var L2 = o.simpleMap(y.yr0, T2.r2l), V2 = o.simpleMap(y.yr1, T2.r2l), W2 = L2[1] - L2[0], X2 = V2[1] - V2[0];
            F13[1] = (L2[1] * (1 - w) + w * V2[1] - L2[1]) / (L2[0] - L2[1]) * S2, F13[3] = S2 * (1 - w + w * X2 / W2), T2.range[0] = k.l2r(L2[0] * (1 - w) + w * V2[0]), T2.range[1] = T2.l2r(L2[1] * (1 - w) + w * V2[1]);
          } else F13[1] = 0, F13[3] = S2;
          i.drawOne(l, k, { skipTitle: true }), i.drawOne(l, T2, { skipTitle: true }), i.redrawComponents(l, [k._id, T2._id]);
          var Y2 = C2 ? A2 / F13[2] : 1, K2 = E2 ? S2 / F13[3] : 1, q = C2 ? F13[0] : 0, re = E2 ? F13[1] : 0, R2 = C2 ? F13[0] / F13[2] * A2 : 0, z = E2 ? F13[1] / F13[3] * S2 : 0, H2 = k._offset - R2, te = T2._offset - z;
          _4.clipRect.call(s.setTranslate, q, re).call(s.setScale, 1 / Y2, 1 / K2), _4.plot.call(s.setTranslate, H2, te).call(s.setScale, Y2, K2), s.setPointGroupScale(_4.zoomScalePts, 1 / Y2, 1 / K2), s.setTextPointsScale(_4.zoomScaleTxt, 1 / Y2, 1 / K2);
        }
        i.redrawComponents(l);
      };
    }, { "../../components/drawing": 388, "../../lib": 503, "../../registry": 638, "./axes": 554, "@plotly/d3": 58 }], 582: [function(e, t, r) {
      "use strict";
      var n = e("../../registry").traceIs, a = e("./axis_autotype");
      function o(i) {
        return { v: "x", h: "y" }[i.orientation || "v"];
      }
      function s(i, l) {
        var u2 = o(i), c = n(i, "box-violin"), f = n(i._fullInput || {}, "candlestick");
        return c && !f && l === u2 && i[u2] === void 0 && i[u2 + "0"] === void 0;
      }
      t.exports = function(i, l, u2, c) {
        u2("autotypenumbers", c.autotypenumbersDflt), u2("type", (c.splomStash || {}).type) === "-" && (function(f, h) {
          if (f.type === "-") {
            var p, d = f._id, v = d.charAt(0);
            d.indexOf("scene") !== -1 && (d = v);
            var m = function(T2, A2, S2) {
              for (var C2 = 0; C2 < T2.length; C2++) {
                var E2 = T2[C2];
                if (E2.type === "splom" && E2._length > 0 && (E2["_" + S2 + "axes"] || {})[A2] || (E2[S2 + "axis"] || S2) === A2 && (s(E2, S2) || (E2[S2] || []).length || E2[S2 + "0"])) return E2;
              }
            }(h, d, v);
            if (!!m) {
              if (m.type === "histogram" && v === { v: "y", h: "x" }[m.orientation || "v"]) return void (f.type = "linear");
              var g = v + "calendar", x = m[g], b = { noMultiCategory: !n(m, "cartesian") || n(m, "noMultiCategory") };
              if (m.type === "box" && m._hasPreCompStats && v === { h: "x", v: "y" }[m.orientation || "v"] && (b.noMultiCategory = true), b.autotypenumbers = f.autotypenumbers, s(m, v)) {
                var y = o(m), w = [];
                for (p = 0; p < h.length; p++) {
                  var _4 = h[p];
                  n(_4, "box-violin") && (_4[v + "axis"] || v) === d && (_4[y] !== void 0 ? w.push(_4[y][0]) : _4.name !== void 0 ? w.push(_4.name) : w.push("text"), _4[g] !== x && (x = void 0));
                }
                f.type = a(w, x, b);
              } else if (m.type === "splom") {
                var k = m.dimensions[m._axesDim[d]];
                k.visible && (f.type = a(k.values, x, b));
              } else f.type = a(m[v] || [m[v + "0"]], x, b);
            }
          }
        }(l, c.data), l.type === "-" ? l.type = "linear" : i.type = l.type);
      };
    }, { "../../registry": 638, "./axis_autotype": 555 }], 583: [function(e, t, r) {
      "use strict";
      var n = e("../registry"), a = e("../lib");
      function o(u2, c, f) {
        var h, p, d, v = false;
        if (c.type === "data") h = u2._fullData[c.traces !== null ? c.traces[0] : 0];
        else {
          if (c.type !== "layout") return false;
          h = u2._fullLayout;
        }
        return p = a.nestedProperty(h, c.prop).get(), (d = f[c.type] = f[c.type] || {}).hasOwnProperty(c.prop) && d[c.prop] !== p && (v = true), d[c.prop] = p, { changed: v, value: p };
      }
      function s(u2, c) {
        var f = [], h = c[0], p = {};
        if (typeof h == "string") p[h] = c[1];
        else {
          if (!a.isPlainObject(h)) return f;
          p = h;
        }
        return l(p, function(d, v, m) {
          f.push({ type: "layout", prop: d, value: m });
        }, "", 0), f;
      }
      function i(u2, c) {
        var f, h, p, d, v = [];
        if (h = c[0], p = c[1], f = c[2], d = {}, typeof h == "string") d[h] = p;
        else {
          if (!a.isPlainObject(h)) return v;
          d = h, f === void 0 && (f = p);
        }
        return f === void 0 && (f = null), l(d, function(m, g, x) {
          var b, y;
          if (Array.isArray(x)) {
            y = x.slice();
            var w = Math.min(y.length, u2.data.length);
            f && (w = Math.min(w, f.length)), b = [];
            for (var _4 = 0; _4 < w; _4++) b[_4] = f ? f[_4] : _4;
          } else y = x, b = f ? f.slice() : null;
          if (b === null) Array.isArray(y) && (y = y[0]);
          else if (Array.isArray(b)) {
            if (!Array.isArray(y)) {
              var k = y;
              y = [];
              for (var T2 = 0; T2 < b.length; T2++) y[T2] = k;
            }
            y.length = Math.min(b.length, y.length);
          }
          v.push({ type: "data", prop: m, traces: b, value: y });
        }, "", 0), v;
      }
      function l(u2, c, f, h) {
        Object.keys(u2).forEach(function(p) {
          var d = u2[p];
          if (p[0] !== "_") {
            var v = f + (h > 0 ? "." : "") + p;
            a.isPlainObject(d) ? l(d, c, v, h + 1) : c(v, p, d);
          }
        });
      }
      r.manageCommandObserver = function(u2, c, f, h) {
        var p = {}, d = true;
        c && c._commandObserver && (p = c._commandObserver), p.cache || (p.cache = {}), p.lookupTable = {};
        var v = r.hasSimpleAPICommandBindings(u2, f, p.lookupTable);
        if (c && c._commandObserver) {
          if (v) return p;
          if (c._commandObserver.remove) return c._commandObserver.remove(), c._commandObserver = null, p;
        }
        if (v) {
          o(u2, v, p.cache), p.check = function() {
            if (d) {
              var x = o(u2, v, p.cache);
              return x.changed && h && p.lookupTable[x.value] !== void 0 && (p.disable(), Promise.resolve(h({ value: x.value, type: v.type, prop: v.prop, traces: v.traces, index: p.lookupTable[x.value] })).then(p.enable, p.enable)), x.changed;
            }
          };
          for (var m = ["plotly_relayout", "plotly_redraw", "plotly_restyle", "plotly_update", "plotly_animatingframe", "plotly_afterplot"], g = 0; g < m.length; g++) u2._internalOn(m[g], p.check);
          p.remove = function() {
            for (var x = 0; x < m.length; x++) u2._removeInternalListener(m[x], p.check);
          };
        } else a.log("Unable to automatically bind plot updates to API command"), p.lookupTable = {}, p.remove = function() {
        };
        return p.disable = function() {
          d = false;
        }, p.enable = function() {
          d = true;
        }, c && (c._commandObserver = p), p;
      }, r.hasSimpleAPICommandBindings = function(u2, c, f) {
        var h, p, d = c.length;
        for (h = 0; h < d; h++) {
          var v, m = c[h], g = m.method, x = m.args;
          if (Array.isArray(x) || (x = []), !g) return false;
          var b = r.computeAPICommandBindings(u2, g, x);
          if (b.length !== 1) return false;
          if (p) {
            if ((v = b[0]).type !== p.type || v.prop !== p.prop) return false;
            if (Array.isArray(p.traces)) {
              if (!Array.isArray(v.traces)) return false;
              v.traces.sort();
              for (var y = 0; y < p.traces.length; y++) if (p.traces[y] !== v.traces[y]) return false;
            } else if (v.prop !== p.prop) return false;
          } else p = b[0], Array.isArray(p.traces) && p.traces.sort();
          var w = (v = b[0]).value;
          if (Array.isArray(w)) {
            if (w.length !== 1) return false;
            w = w[0];
          }
          f && (f[w] = h);
        }
        return p;
      }, r.executeAPICommand = function(u2, c, f) {
        if (c === "skip") return Promise.resolve();
        var h = n.apiMethodRegistry[c], p = [u2];
        Array.isArray(f) || (f = []);
        for (var d = 0; d < f.length; d++) p.push(f[d]);
        return h.apply(null, p).catch(function(v) {
          return a.warn("API call to Plotly." + c + " rejected.", v), Promise.reject(v);
        });
      }, r.computeAPICommandBindings = function(u2, c, f) {
        var h;
        switch (Array.isArray(f) || (f = []), c) {
          case "restyle":
            h = i(u2, f);
            break;
          case "relayout":
            h = s(u2, f);
            break;
          case "update":
            h = i(u2, [f[0], f[2]]).concat(s(u2, [f[1]]));
            break;
          case "animate":
            h = function(p, d) {
              return Array.isArray(d[0]) && d[0].length === 1 && ["string", "number"].indexOf(typeof d[0][0]) !== -1 ? [{ type: "layout", prop: "_currentFrame", value: d[0][0].toString() }] : [];
            }(0, f);
            break;
          default:
            h = [];
        }
        return h;
      };
    }, { "../lib": 503, "../registry": 638 }], 584: [function(e, t, r) {
      "use strict";
      var n = e("../lib/extend").extendFlat;
      r.attributes = function(a, o) {
        o = o || {};
        var s = { valType: "info_array", editType: (a = a || {}).editType, items: [{ valType: "number", min: 0, max: 1, editType: a.editType }, { valType: "number", min: 0, max: 1, editType: a.editType }], dflt: [0, 1] }, i = (a.name && a.name, a.trace, o.description && o.description, { x: n({}, s, {}), y: n({}, s, {}), editType: a.editType });
        return a.noGridCell || (i.row = { valType: "integer", min: 0, dflt: 0, editType: a.editType }, i.column = { valType: "integer", min: 0, dflt: 0, editType: a.editType }), i;
      }, r.defaults = function(a, o, s, i) {
        var l = i && i.x || [0, 1], u2 = i && i.y || [0, 1], c = o.grid;
        if (c) {
          var f = s("domain.column");
          f !== void 0 && (f < c.columns ? l = c._domains.x[f] : delete a.domain.column);
          var h = s("domain.row");
          h !== void 0 && (h < c.rows ? u2 = c._domains.y[h] : delete a.domain.row);
        }
        var p = s("domain.x", l), d = s("domain.y", u2);
        p[0] < p[1] || (a.domain.x = l.slice()), d[0] < d[1] || (a.domain.y = u2.slice());
      };
    }, { "../lib/extend": 493 }], 585: [function(e, t, r) {
      "use strict";
      t.exports = function(n) {
        var a = n.editType, o = n.colorEditType;
        o === void 0 && (o = a);
        var s = { family: { valType: "string", noBlank: true, strict: true, editType: a }, size: { valType: "number", min: 1, editType: a }, color: { valType: "color", editType: o }, editType: a };
        return n.autoSize && (s.size.dflt = "auto"), n.autoColor && (s.color.dflt = "auto"), n.arrayOk && (s.family.arrayOk = true, s.size.arrayOk = true, s.color.arrayOk = true), s;
      };
    }, {}], 586: [function(e, t, r) {
      "use strict";
      t.exports = { _isLinkedToArray: "frames_entry", group: { valType: "string" }, name: { valType: "string" }, traces: { valType: "any" }, baseframe: { valType: "string" }, data: { valType: "any" }, layout: { valType: "any" } };
    }, {}], 587: [function(e, t, r) {
      "use strict";
      r.projNames = { airy: "airy", aitoff: "aitoff", "albers usa": "albersUsa", albers: "albers", august: "august", "azimuthal equal area": "azimuthalEqualArea", "azimuthal equidistant": "azimuthalEquidistant", baker: "baker", bertin1953: "bertin1953", boggs: "boggs", bonne: "bonne", bottomley: "bottomley", bromley: "bromley", collignon: "collignon", "conic conformal": "conicConformal", "conic equal area": "conicEqualArea", "conic equidistant": "conicEquidistant", craig: "craig", craster: "craster", "cylindrical equal area": "cylindricalEqualArea", "cylindrical stereographic": "cylindricalStereographic", eckert1: "eckert1", eckert2: "eckert2", eckert3: "eckert3", eckert4: "eckert4", eckert5: "eckert5", eckert6: "eckert6", eisenlohr: "eisenlohr", equirectangular: "equirectangular", fahey: "fahey", "foucaut sinusoidal": "foucautSinusoidal", foucaut: "foucaut", ginzburg4: "ginzburg4", ginzburg5: "ginzburg5", ginzburg6: "ginzburg6", ginzburg8: "ginzburg8", ginzburg9: "ginzburg9", gnomonic: "gnomonic", "gringorten quincuncial": "gringortenQuincuncial", gringorten: "gringorten", guyou: "guyou", hammer: "hammer", hill: "hill", homolosine: "homolosine", hufnagel: "hufnagel", hyperelliptical: "hyperelliptical", kavrayskiy7: "kavrayskiy7", lagrange: "lagrange", larrivee: "larrivee", laskowski: "laskowski", loximuthal: "loximuthal", mercator: "mercator", miller: "miller", mollweide: "mollweide", "mt flat polar parabolic": "mtFlatPolarParabolic", "mt flat polar quartic": "mtFlatPolarQuartic", "mt flat polar sinusoidal": "mtFlatPolarSinusoidal", "natural earth": "naturalEarth", "natural earth1": "naturalEarth1", "natural earth2": "naturalEarth2", "nell hammer": "nellHammer", nicolosi: "nicolosi", orthographic: "orthographic", patterson: "patterson", "peirce quincuncial": "peirceQuincuncial", polyconic: "polyconic", "rectangular polyconic": "rectangularPolyconic", robinson: "robinson", satellite: "satellite", "sinu mollweide": "sinuMollweide", sinusoidal: "sinusoidal", stereographic: "stereographic", times: "times", "transverse mercator": "transverseMercator", "van der grinten": "vanDerGrinten", "van der grinten2": "vanDerGrinten2", "van der grinten3": "vanDerGrinten3", "van der grinten4": "vanDerGrinten4", wagner4: "wagner4", wagner6: "wagner6", wiechel: "wiechel", "winkel tripel": "winkel3", winkel3: "winkel3" }, r.axesNames = ["lonaxis", "lataxis"], r.lonaxisSpan = { orthographic: 180, "azimuthal equal area": 360, "azimuthal equidistant": 360, "conic conformal": 180, gnomonic: 160, stereographic: 180, "transverse mercator": 180, "*": 360 }, r.lataxisSpan = { "conic conformal": 150, stereographic: 179.5, "*": 180 }, r.scopeDefaults = { world: { lonaxisRange: [-180, 180], lataxisRange: [-90, 90], projType: "equirectangular", projRotate: [0, 0, 0] }, usa: { lonaxisRange: [-180, -50], lataxisRange: [15, 80], projType: "albers usa" }, europe: { lonaxisRange: [-30, 60], lataxisRange: [30, 85], projType: "conic conformal", projRotate: [15, 0, 0], projParallels: [0, 60] }, asia: { lonaxisRange: [22, 160], lataxisRange: [-15, 55], projType: "mercator", projRotate: [0, 0, 0] }, africa: { lonaxisRange: [-30, 60], lataxisRange: [-40, 40], projType: "mercator", projRotate: [0, 0, 0] }, "north america": { lonaxisRange: [-180, -45], lataxisRange: [5, 85], projType: "conic conformal", projRotate: [-100, 0, 0], projParallels: [29.5, 45.5] }, "south america": { lonaxisRange: [-100, -30], lataxisRange: [-60, 15], projType: "mercator", projRotate: [0, 0, 0] } }, r.clipPad = 1e-3, r.precision = 0.1, r.landColor = "#F0DC82", r.waterColor = "#3399FF", r.locationmodeToLayer = { "ISO-3": "countries", "USA-states": "subunits", "country names": "countries" }, r.sphereSVG = { type: "Sphere" }, r.fillLayers = { ocean: 1, land: 1, lakes: 1 }, r.lineLayers = { subunits: 1, countries: 1, coastlines: 1, rivers: 1, frame: 1 }, r.layers = ["bg", "ocean", "land", "lakes", "subunits", "countries", "coastlines", "rivers", "lataxis", "lonaxis", "frame", "backplot", "frontplot"], r.layersForChoropleth = ["bg", "ocean", "land", "subunits", "countries", "coastlines", "lataxis", "lonaxis", "frame", "backplot", "rivers", "lakes", "frontplot"], r.layerNameToAdjective = { ocean: "ocean", land: "land", lakes: "lake", subunits: "subunit", countries: "country", coastlines: "coastline", rivers: "river", frame: "frame" };
    }, {}], 588: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("d3-geo"), o = a.geoPath, s = a.geoDistance, i = e("d3-geo-projection"), l = e("../../registry"), u2 = e("../../lib"), c = u2.strTranslate, f = e("../../components/color"), h = e("../../components/drawing"), p = e("../../components/fx"), d = e("../plots"), v = e("../cartesian/axes"), m = e("../cartesian/autorange").getAutoRange, g = e("../../components/dragelement"), x = e("../cartesian/select").prepSelect, b = e("../cartesian/select").clearSelect, y = e("../cartesian/select").selectOnClick, w = e("./zoom"), _4 = e("./constants"), k = e("../../lib/geo_location_utils"), T2 = e("../../lib/topojson_utils"), A2 = e("topojson-client").feature;
      function S2(F13) {
        this.id = F13.id, this.graphDiv = F13.graphDiv, this.container = F13.container, this.topojsonURL = F13.topojsonURL, this.isStatic = F13.staticPlot, this.topojsonName = null, this.topojson = null, this.projection = null, this.scope = null, this.viewInitial = null, this.fitScale = null, this.bounds = null, this.midPt = null, this.hasChoropleth = false, this.traceHash = {}, this.layers = {}, this.basePaths = {}, this.dataPaths = {}, this.dataPoints = {}, this.clipDef = null, this.clipRect = null, this.bgRect = null, this.makeFramework();
      }
      var C2 = S2.prototype;
      function E2(F13, N2) {
        var D2 = _4.clipPad, I2 = F13[0] + D2, O2 = F13[1] - D2, L2 = N2[0] + D2, V2 = N2[1] - D2;
        I2 > 0 && O2 < 0 && (O2 += 360);
        var W2 = (O2 - I2) / 4;
        return { type: "Polygon", coordinates: [[[I2, L2], [I2, V2], [I2 + W2, V2], [I2 + 2 * W2, V2], [I2 + 3 * W2, V2], [O2, V2], [O2, L2], [O2 - W2, L2], [O2 - 2 * W2, L2], [O2 - 3 * W2, L2], [I2, L2]]] };
      }
      t.exports = function(F13) {
        return new S2(F13);
      }, C2.plot = function(F13, N2, D2) {
        var I2 = this, O2 = N2[this.id], L2 = [], V2 = false;
        for (var W2 in _4.layerNameToAdjective) if (W2 !== "frame" && O2["show" + W2]) {
          V2 = true;
          break;
        }
        for (var X2 = 0; X2 < F13.length; X2++) if (F13[0][0].trace.locationmode) {
          V2 = true;
          break;
        }
        if (V2) {
          var Y2 = T2.getTopojsonName(O2);
          I2.topojson !== null && Y2 === I2.topojsonName || (I2.topojsonName = Y2, PlotlyGeoAssets.topojson[I2.topojsonName] === void 0 && L2.push(I2.fetchTopojson()));
        }
        L2 = L2.concat(k.fetchTraceGeoData(F13)), D2.push(new Promise(function(K2, q) {
          Promise.all(L2).then(function() {
            I2.topojson = PlotlyGeoAssets.topojson[I2.topojsonName], I2.update(F13, N2), K2();
          }).catch(q);
        }));
      }, C2.fetchTopojson = function() {
        var F13 = this, N2 = T2.getTopojsonPath(F13.topojsonURL, F13.topojsonName);
        return new Promise(function(D2, I2) {
          n.json(N2, function(O2, L2) {
            if (O2) return O2.status === 404 ? I2(new Error(["plotly.js could not find topojson file at", N2, ".", "Make sure the *topojsonURL* plot config option", "is set properly."].join(" "))) : I2(new Error(["unexpected error while fetching topojson file at", N2].join(" ")));
            PlotlyGeoAssets.topojson[F13.topojsonName] = L2, D2();
          });
        });
      }, C2.update = function(F13, N2) {
        var D2 = N2[this.id];
        this.hasChoropleth = false;
        for (var I2 = 0; I2 < F13.length; I2++) {
          var O2 = F13[I2], L2 = O2[0].trace;
          L2.type === "choropleth" && (this.hasChoropleth = true), L2.visible === true && L2._length > 0 && L2._module.calcGeoJSON(O2, N2);
        }
        if (!this.updateProjection(F13, N2)) {
          this.viewInitial && this.scope === D2.scope || this.saveViewInitial(D2), this.scope = D2.scope, this.updateBaseLayers(N2, D2), this.updateDims(N2, D2), this.updateFx(N2, D2), d.generalUpdatePerTraceModule(this.graphDiv, this, F13, D2);
          var V2 = this.layers.frontplot.select(".scatterlayer");
          this.dataPoints.point = V2.selectAll(".point"), this.dataPoints.text = V2.selectAll("text"), this.dataPaths.line = V2.selectAll(".js-line");
          var W2 = this.layers.backplot.select(".choroplethlayer");
          this.dataPaths.choropleth = W2.selectAll("path"), this.render();
        }
      }, C2.updateProjection = function(F13, N2) {
        var D2 = this.graphDiv, I2 = N2[this.id], O2 = N2._size, L2 = I2.domain, V2 = I2.projection, W2 = I2.lonaxis, X2 = I2.lataxis, Y2 = W2._ax, K2 = X2._ax, q = this.projection = function(pe) {
          var ve = pe.projection, Ee = ve.type, Se = _4.projNames[Ee];
          Se = "geo" + u2.titleCase(Se);
          for (var Ce = (a[Se] || i[Se])(), Be = pe._isSatellite ? 180 * Math.acos(1 / ve.distance) / Math.PI : pe._isClipped ? _4.lonaxisSpan[Ee] / 2 : null, Ue = ["center", "rotate", "parallels", "clipExtent"], Ke = function(Ze) {
            return Ze ? Ce : [];
          }, ct = 0; ct < Ue.length; ct++) {
            var We = Ue[ct];
            typeof Ce[We] != "function" && (Ce[We] = Ke);
          }
          return Ce.isLonLatOverEdges = function(Ze) {
            if (Ce(Ze) === null) return true;
            if (Be) {
              var it = Ce.rotate();
              return s(Ze, [-it[0], -it[1]]) > Be * Math.PI / 180;
            }
            return false;
          }, Ce.getPath = function() {
            return o().projection(Ce);
          }, Ce.getBounds = function(Ze) {
            return Ce.getPath().bounds(Ze);
          }, Ce.precision(_4.precision), pe._isSatellite && Ce.tilt(ve.tilt).distance(ve.distance), Be && Ce.clipAngle(Be - _4.clipPad), Ce;
        }(I2), re = [[O2.l + O2.w * L2.x[0], O2.t + O2.h * (1 - L2.y[1])], [O2.l + O2.w * L2.x[1], O2.t + O2.h * (1 - L2.y[0])]], R2 = I2.center || {}, z = V2.rotation || {}, H2 = W2.range || [], te = X2.range || [];
        if (I2.fitbounds) {
          Y2._length = re[1][0] - re[0][0], K2._length = re[1][1] - re[0][1], Y2.range = m(D2, Y2), K2.range = m(D2, K2);
          var j = (Y2.range[0] + Y2.range[1]) / 2, Q2 = (K2.range[0] + K2.range[1]) / 2;
          if (I2._isScoped) R2 = { lon: j, lat: Q2 };
          else if (I2._isClipped) {
            R2 = { lon: j, lat: Q2 }, z = { lon: j, lat: Q2, roll: z.roll };
            var Z2 = V2.type, ne = _4.lonaxisSpan[Z2] / 2 || 180, ae = _4.lataxisSpan[Z2] / 2 || 90;
            H2 = [j - ne, j + ne], te = [Q2 - ae, Q2 + ae];
          } else R2 = { lon: j, lat: Q2 }, z = { lon: j, lat: z.lat, roll: z.roll };
        }
        q.center([R2.lon - z.lon, R2.lat - z.lat]).rotate([-z.lon, -z.lat, z.roll]).parallels(V2.parallels);
        var ue = E2(H2, te);
        q.fitExtent(re, ue);
        var le = this.bounds = q.getBounds(ue), ce = this.fitScale = q.scale(), se = q.translate();
        if (I2.fitbounds) {
          var he = q.getBounds(E2(Y2.range, K2.range)), me = Math.min((le[1][0] - le[0][0]) / (he[1][0] - he[0][0]), (le[1][1] - le[0][1]) / (he[1][1] - he[0][1]));
          isFinite(me) ? q.scale(me * ce) : u2.warn("Something went wrong during" + this.id + "fitbounds computations.");
        } else q.scale(V2.scale * ce);
        var we = this.midPt = [(le[0][0] + le[1][0]) / 2, (le[0][1] + le[1][1]) / 2];
        if (q.translate([se[0] + (we[0] - se[0]), se[1] + (we[1] - se[1])]).clipExtent(le), I2._isAlbersUsa) {
          var be = q([R2.lon, R2.lat]), Ae = q.translate();
          q.translate([Ae[0] - (be[0] - Ae[0]), Ae[1] - (be[1] - Ae[1])]);
        }
      }, C2.updateBaseLayers = function(F13, N2) {
        var D2 = this, I2 = D2.topojson, O2 = D2.layers, L2 = D2.basePaths;
        function V2(q) {
          return q === "lonaxis" || q === "lataxis";
        }
        function W2(q) {
          return Boolean(_4.lineLayers[q]);
        }
        function X2(q) {
          return Boolean(_4.fillLayers[q]);
        }
        var Y2 = (this.hasChoropleth ? _4.layersForChoropleth : _4.layers).filter(function(q) {
          return W2(q) || X2(q) ? N2["show" + q] : !V2(q) || N2[q].showgrid;
        }), K2 = D2.framework.selectAll(".layer").data(Y2, String);
        K2.exit().each(function(q) {
          delete O2[q], delete L2[q], n.select(this).remove();
        }), K2.enter().append("g").attr("class", function(q) {
          return "layer " + q;
        }).each(function(q) {
          var re = O2[q] = n.select(this);
          q === "bg" ? D2.bgRect = re.append("rect").style("pointer-events", "all") : V2(q) ? L2[q] = re.append("path").style("fill", "none") : q === "backplot" ? re.append("g").classed("choroplethlayer", true) : q === "frontplot" ? re.append("g").classed("scatterlayer", true) : W2(q) ? L2[q] = re.append("path").style("fill", "none").style("stroke-miterlimit", 2) : X2(q) && (L2[q] = re.append("path").style("stroke", "none"));
        }), K2.order(), K2.each(function(q) {
          var re = L2[q], R2 = _4.layerNameToAdjective[q];
          q === "frame" ? re.datum(_4.sphereSVG) : W2(q) || X2(q) ? re.datum(A2(I2, I2.objects[q])) : V2(q) && re.datum(function(z, H2, te) {
            var j, Q2, Z2, ne = H2[z], ae = _4.scopeDefaults[H2.scope];
            z === "lonaxis" ? (j = ae.lonaxisRange, Q2 = ae.lataxisRange, Z2 = function(Ae, pe) {
              return [Ae, pe];
            }) : z === "lataxis" && (j = ae.lataxisRange, Q2 = ae.lonaxisRange, Z2 = function(Ae, pe) {
              return [pe, Ae];
            });
            var ue = { type: "linear", range: [j[0], j[1] - 1e-6], tick0: ne.tick0, dtick: ne.dtick };
            v.setConvert(ue, te);
            var le = v.calcTicks(ue);
            H2.isScoped || z !== "lonaxis" || le.pop();
            for (var ce = le.length, se = new Array(ce), he = 0; he < ce; he++) for (var me = le[he].x, we = se[he] = [], be = Q2[0]; be < Q2[1] + 2.5; be += 2.5) we.push(Z2(me, be));
            return { type: "MultiLineString", coordinates: se };
          }(q, N2, F13)).call(f.stroke, N2[q].gridcolor).call(h.dashLine, "", N2[q].gridwidth), W2(q) ? re.call(f.stroke, N2[R2 + "color"]).call(h.dashLine, "", N2[R2 + "width"]) : X2(q) && re.call(f.fill, N2[R2 + "color"]);
        });
      }, C2.updateDims = function(F13, N2) {
        var D2 = this.bounds, I2 = (N2.framewidth || 0) / 2, O2 = D2[0][0] - I2, L2 = D2[0][1] - I2, V2 = D2[1][0] - O2 + I2, W2 = D2[1][1] - L2 + I2;
        h.setRect(this.clipRect, O2, L2, V2, W2), this.bgRect.call(h.setRect, O2, L2, V2, W2).call(f.fill, N2.bgcolor), this.xaxis._offset = O2, this.xaxis._length = V2, this.yaxis._offset = L2, this.yaxis._length = W2;
      }, C2.updateFx = function(F13, N2) {
        var D2 = this, I2 = D2.graphDiv, O2 = D2.bgRect, L2 = F13.dragmode, V2 = F13.clickmode;
        if (!D2.isStatic) {
          var W2;
          L2 === "select" ? W2 = function(K2, q) {
            (K2.range = {})[D2.id] = [Y2([q.xmin, q.ymin]), Y2([q.xmax, q.ymax])];
          } : L2 === "lasso" && (W2 = function(K2, q, re) {
            (K2.lassoPoints = {})[D2.id] = re.filtered.map(Y2);
          });
          var X2 = { element: D2.bgRect.node(), gd: I2, plotinfo: { id: D2.id, xaxis: D2.xaxis, yaxis: D2.yaxis, fillRangeItems: W2 }, xaxes: [D2.xaxis], yaxes: [D2.yaxis], subplot: D2.id, clickFn: function(K2) {
            K2 === 2 && b(I2);
          } };
          L2 === "pan" ? (O2.node().onmousedown = null, O2.call(w(D2, N2)), O2.on("dblclick.zoom", function() {
            var K2 = D2.viewInitial, q = {};
            for (var re in K2) q[D2.id + "." + re] = K2[re];
            l.call("_guiRelayout", I2, q), I2.emit("plotly_doubleclick", null);
          }), I2._context._scrollZoom.geo || O2.on("wheel.zoom", null)) : L2 !== "select" && L2 !== "lasso" || (O2.on(".zoom", null), X2.prepFn = function(K2, q, re) {
            x(K2, q, re, X2, L2);
          }, g.init(X2)), O2.on("mousemove", function() {
            var K2 = D2.projection.invert(u2.getPositionFromD3Event());
            if (!K2) return g.unhover(I2, n.event);
            D2.xaxis.p2c = function() {
              return K2[0];
            }, D2.yaxis.p2c = function() {
              return K2[1];
            }, p.hover(I2, n.event, D2.id);
          }), O2.on("mouseout", function() {
            I2._dragging || g.unhover(I2, n.event);
          }), O2.on("click", function() {
            L2 !== "select" && L2 !== "lasso" && (V2.indexOf("select") > -1 && y(n.event, I2, [D2.xaxis], [D2.yaxis], D2.id, X2), V2.indexOf("event") > -1 && p.click(I2, n.event));
          });
        }
        function Y2(K2) {
          return D2.projection.invert([K2[0] + D2.xaxis._offset, K2[1] + D2.yaxis._offset]);
        }
      }, C2.makeFramework = function() {
        var F13 = this, N2 = F13.graphDiv, D2 = N2._fullLayout, I2 = "clip" + D2._uid + F13.id;
        F13.clipDef = D2._clips.append("clipPath").attr("id", I2), F13.clipRect = F13.clipDef.append("rect"), F13.framework = n.select(F13.container).append("g").attr("class", "geo " + F13.id).call(h.setClipUrl, I2, N2), F13.project = function(O2) {
          var L2 = F13.projection(O2);
          return L2 ? [L2[0] - F13.xaxis._offset, L2[1] - F13.yaxis._offset] : [null, null];
        }, F13.xaxis = { _id: "x", c2p: function(O2) {
          return F13.project(O2)[0];
        } }, F13.yaxis = { _id: "y", c2p: function(O2) {
          return F13.project(O2)[1];
        } }, F13.mockAxis = { type: "linear", showexponent: "all", exponentformat: "B" }, v.setConvert(F13.mockAxis, D2);
      }, C2.saveViewInitial = function(F13) {
        var N2, D2 = F13.center || {}, I2 = F13.projection, O2 = I2.rotation || {};
        this.viewInitial = { fitbounds: F13.fitbounds, "projection.scale": I2.scale }, N2 = F13._isScoped ? { "center.lon": D2.lon, "center.lat": D2.lat } : F13._isClipped ? { "projection.rotation.lon": O2.lon, "projection.rotation.lat": O2.lat } : { "center.lon": D2.lon, "center.lat": D2.lat, "projection.rotation.lon": O2.lon }, u2.extendFlat(this.viewInitial, N2);
      }, C2.render = function() {
        var F13, N2 = this.projection, D2 = N2.getPath();
        function I2(L2) {
          var V2 = N2(L2.lonlat);
          return V2 ? c(V2[0], V2[1]) : null;
        }
        function O2(L2) {
          return N2.isLonLatOverEdges(L2.lonlat) ? "none" : null;
        }
        for (F13 in this.basePaths) this.basePaths[F13].attr("d", D2);
        for (F13 in this.dataPaths) this.dataPaths[F13].attr("d", function(L2) {
          return D2(L2.geojson);
        });
        for (F13 in this.dataPoints) this.dataPoints[F13].attr("display", O2).attr("transform", I2);
      };
    }, { "../../components/color": 366, "../../components/dragelement": 385, "../../components/drawing": 388, "../../components/fx": 406, "../../lib": 503, "../../lib/geo_location_utils": 496, "../../lib/topojson_utils": 532, "../../registry": 638, "../cartesian/autorange": 553, "../cartesian/axes": 554, "../cartesian/select": 575, "../plots": 619, "./constants": 587, "./zoom": 592, "@plotly/d3": 58, "d3-geo": 114, "d3-geo-projection": 113, "topojson-client": 315 }], 589: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/get_data").getSubplotCalcData, a = e("../../lib").counterRegex, o = e("./geo"), s = "geo", i = a(s), l = {};
      l.geo = { valType: "subplotid", dflt: s, editType: "calc" }, t.exports = { attr: s, name: s, idRoot: s, idRegex: i, attrRegex: i, attributes: l, layoutAttributes: e("./layout_attributes"), supplyLayoutDefaults: e("./layout_defaults"), plot: function(u2) {
        for (var c = u2._fullLayout, f = u2.calcdata, h = c._subplots.geo, p = 0; p < h.length; p++) {
          var d = h[p], v = n(f, s, d), m = c[d]._subplot;
          m || (m = o({ id: d, graphDiv: u2, container: c._geolayer.node(), topojsonURL: u2._context.topojsonURL, staticPlot: u2._context.staticPlot }), c[d]._subplot = m), m.plot(v, c, u2._promises);
        }
      }, updateFx: function(u2) {
        for (var c = u2._fullLayout, f = c._subplots.geo, h = 0; h < f.length; h++) {
          var p = c[f[h]];
          p._subplot.updateFx(c, p);
        }
      }, clean: function(u2, c, f, h) {
        for (var p = h._subplots.geo || [], d = 0; d < p.length; d++) {
          var v = p[d], m = h[v]._subplot;
          !c[v] && m && (m.framework.remove(), m.clipDef.remove());
        }
      } };
    }, { "../../lib": 503, "../../plots/get_data": 593, "./geo": 588, "./layout_attributes": 590, "./layout_defaults": 591 }], 590: [function(e, t, r) {
      "use strict";
      var n = e("../../components/color/attributes"), a = e("../domain").attributes, o = e("./constants"), s = e("../../plot_api/edit_types").overrideAll, i = e("../../lib/sort_object_keys"), l = { range: { valType: "info_array", items: [{ valType: "number" }, { valType: "number" }] }, showgrid: { valType: "boolean", dflt: false }, tick0: { valType: "number", dflt: 0 }, dtick: { valType: "number" }, gridcolor: { valType: "color", dflt: n.lightLine }, gridwidth: { valType: "number", min: 0, dflt: 1 } };
      (t.exports = s({ domain: a({ name: "geo" }, {}), fitbounds: { valType: "enumerated", values: [false, "locations", "geojson"], dflt: false, editType: "plot" }, resolution: { valType: "enumerated", values: [110, 50], dflt: 110, coerceNumber: true }, scope: { valType: "enumerated", values: i(o.scopeDefaults), dflt: "world" }, projection: { type: { valType: "enumerated", values: i(o.projNames) }, rotation: { lon: { valType: "number" }, lat: { valType: "number" }, roll: { valType: "number" } }, tilt: { valType: "number", dflt: 0 }, distance: { valType: "number", min: 1.001, dflt: 2 }, parallels: { valType: "info_array", items: [{ valType: "number" }, { valType: "number" }] }, scale: { valType: "number", min: 0, dflt: 1 } }, center: { lon: { valType: "number" }, lat: { valType: "number" } }, visible: { valType: "boolean", dflt: true }, showcoastlines: { valType: "boolean" }, coastlinecolor: { valType: "color", dflt: n.defaultLine }, coastlinewidth: { valType: "number", min: 0, dflt: 1 }, showland: { valType: "boolean", dflt: false }, landcolor: { valType: "color", dflt: o.landColor }, showocean: { valType: "boolean", dflt: false }, oceancolor: { valType: "color", dflt: o.waterColor }, showlakes: { valType: "boolean", dflt: false }, lakecolor: { valType: "color", dflt: o.waterColor }, showrivers: { valType: "boolean", dflt: false }, rivercolor: { valType: "color", dflt: o.waterColor }, riverwidth: { valType: "number", min: 0, dflt: 1 }, showcountries: { valType: "boolean" }, countrycolor: { valType: "color", dflt: n.defaultLine }, countrywidth: { valType: "number", min: 0, dflt: 1 }, showsubunits: { valType: "boolean" }, subunitcolor: { valType: "color", dflt: n.defaultLine }, subunitwidth: { valType: "number", min: 0, dflt: 1 }, showframe: { valType: "boolean" }, framecolor: { valType: "color", dflt: n.defaultLine }, framewidth: { valType: "number", min: 0, dflt: 1 }, bgcolor: { valType: "color", dflt: n.background }, lonaxis: l, lataxis: l }, "plot", "from-root")).uirevision = { valType: "any", editType: "none" };
    }, { "../../components/color/attributes": 365, "../../lib/sort_object_keys": 526, "../../plot_api/edit_types": 536, "../domain": 584, "./constants": 587 }], 591: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../subplot_defaults"), o = e("../get_data").getSubplotData, s = e("./constants"), i = e("./layout_attributes"), l = s.axesNames;
      function u2(c, f, h, p) {
        var d = o(p.fullData, "geo", p.id).map(function(z) {
          return z._expandedIndex;
        }), v = h("resolution"), m = h("scope"), g = s.scopeDefaults[m], x = h("projection.type", g.projType), b = f._isAlbersUsa = x === "albers usa";
        b && (m = f.scope = "usa");
        var y = f._isScoped = m !== "world", w = f._isSatellite = x === "satellite", _4 = f._isConic = x.indexOf("conic") !== -1 || x === "albers", k = f._isClipped = !!s.lonaxisSpan[x];
        if (c.visible === false) {
          var T2 = n.extendDeep({}, f._template);
          T2.showcoastlines = false, T2.showcountries = false, T2.showframe = false, T2.showlakes = false, T2.showland = false, T2.showocean = false, T2.showrivers = false, T2.showsubunits = false, T2.lonaxis && (T2.lonaxis.showgrid = false), T2.lataxis && (T2.lataxis.showgrid = false), f._template = T2;
        }
        for (var A2 = h("visible"), S2 = 0; S2 < l.length; S2++) {
          var C2, E2 = l[S2], F13 = [30, 10][S2];
          if (y) C2 = g[E2 + "Range"];
          else {
            var N2 = s[E2 + "Span"], D2 = (N2[x] || N2["*"]) / 2, I2 = h("projection.rotation." + E2.substr(0, 3), g.projRotate[S2]);
            C2 = [I2 - D2, I2 + D2];
          }
          var O2 = h(E2 + ".range", C2);
          h(E2 + ".tick0"), h(E2 + ".dtick", F13), h(E2 + ".showgrid", !!A2 && void 0) && (h(E2 + ".gridcolor"), h(E2 + ".gridwidth")), f[E2]._ax = { type: "linear", _id: E2.slice(0, 3), _traceIndices: d, setScale: n.identity, c2l: n.identity, r2l: n.identity, autorange: true, range: O2.slice(), _m: 1, _input: {} };
        }
        var L2 = f.lonaxis.range, V2 = f.lataxis.range, W2 = L2[0], X2 = L2[1];
        W2 > 0 && X2 < 0 && (X2 += 360);
        var Y2, K2, q, re = (W2 + X2) / 2;
        if (!b) {
          var R2 = y ? g.projRotate : [re, 0, 0];
          Y2 = h("projection.rotation.lon", R2[0]), h("projection.rotation.lat", R2[1]), h("projection.rotation.roll", R2[2]), h("showcoastlines", !y && A2) && (h("coastlinecolor"), h("coastlinewidth")), h("showocean", !!A2 && void 0) && h("oceancolor");
        }
        b ? (K2 = -96.6, q = 38.7) : (K2 = y ? re : Y2, q = (V2[0] + V2[1]) / 2), h("center.lon", K2), h("center.lat", q), w && (h("projection.tilt"), h("projection.distance")), _4 && h("projection.parallels", g.projParallels || [0, 60]), h("projection.scale"), h("showland", !!A2 && void 0) && h("landcolor"), h("showlakes", !!A2 && void 0) && h("lakecolor"), h("showrivers", !!A2 && void 0) && (h("rivercolor"), h("riverwidth")), h("showcountries", y && m !== "usa" && A2) && (h("countrycolor"), h("countrywidth")), (m === "usa" || m === "north america" && v === 50) && (h("showsubunits", A2), h("subunitcolor"), h("subunitwidth")), y || h("showframe", A2) && (h("framecolor"), h("framewidth")), h("bgcolor"), h("fitbounds") && (delete f.projection.scale, y ? (delete f.center.lon, delete f.center.lat) : k ? (delete f.center.lon, delete f.center.lat, delete f.projection.rotation.lon, delete f.projection.rotation.lat, delete f.lonaxis.range, delete f.lataxis.range) : (delete f.center.lon, delete f.center.lat, delete f.projection.rotation.lon));
      }
      t.exports = function(c, f, h) {
        a(c, f, h, { type: "geo", attributes: i, handleDefaults: u2, fullData: h, partition: "y" });
      };
    }, { "../../lib": 503, "../get_data": 593, "../subplot_defaults": 632, "./constants": 587, "./layout_attributes": 590 }], 592: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../lib"), o = e("../../registry"), s = Math.PI / 180, i = 180 / Math.PI, l = { cursor: "pointer" }, u2 = { cursor: "auto" };
      function c(A2, S2) {
        return n.behavior.zoom().translate(S2.translate()).scale(S2.scale());
      }
      function f(A2, S2, C2) {
        var E2 = A2.id, F13 = A2.graphDiv, N2 = F13.layout, D2 = N2[E2], I2 = F13._fullLayout, O2 = I2[E2], L2 = {}, V2 = {};
        function W2(X2, Y2) {
          L2[E2 + "." + X2] = a.nestedProperty(D2, X2).get(), o.call("_storeDirectGUIEdit", N2, I2._preGUI, L2);
          var K2 = a.nestedProperty(O2, X2);
          K2.get() !== Y2 && (K2.set(Y2), a.nestedProperty(D2, X2).set(Y2), V2[E2 + "." + X2] = Y2);
        }
        C2(W2), W2("projection.scale", S2.scale() / A2.fitScale), W2("fitbounds", false), F13.emit("plotly_relayout", V2);
      }
      function h(A2, S2) {
        var C2 = c(0, S2);
        function E2(F13) {
          var N2 = S2.invert(A2.midPt);
          F13("center.lon", N2[0]), F13("center.lat", N2[1]);
        }
        return C2.on("zoomstart", function() {
          n.select(this).style(l);
        }).on("zoom", function() {
          S2.scale(n.event.scale).translate(n.event.translate), A2.render();
          var F13 = S2.invert(A2.midPt);
          A2.graphDiv.emit("plotly_relayouting", { "geo.projection.scale": S2.scale() / A2.fitScale, "geo.center.lon": F13[0], "geo.center.lat": F13[1] });
        }).on("zoomend", function() {
          n.select(this).style(u2), f(A2, S2, E2);
        }), C2;
      }
      function p(A2, S2) {
        var C2, E2, F13, N2, D2, I2, O2, L2, V2, W2 = c(0, S2);
        function X2(K2) {
          return S2.invert(K2);
        }
        function Y2(K2) {
          var q = S2.rotate(), re = S2.invert(A2.midPt);
          K2("projection.rotation.lon", -q[0]), K2("center.lon", re[0]), K2("center.lat", re[1]);
        }
        return W2.on("zoomstart", function() {
          n.select(this).style(l), C2 = n.mouse(this), E2 = S2.rotate(), F13 = S2.translate(), N2 = E2, D2 = X2(C2);
        }).on("zoom", function() {
          if (I2 = n.mouse(this), function(re) {
            var R2 = X2(re);
            if (!R2) return true;
            var z = S2(R2);
            return Math.abs(z[0] - re[0]) > 2 || Math.abs(z[1] - re[1]) > 2;
          }(C2)) return W2.scale(S2.scale()), void W2.translate(S2.translate());
          S2.scale(n.event.scale), S2.translate([F13[0], n.event.translate[1]]), D2 ? X2(I2) && (L2 = X2(I2), O2 = [N2[0] + (L2[0] - D2[0]), E2[1], E2[2]], S2.rotate(O2), N2 = O2) : D2 = X2(C2 = I2), V2 = true, A2.render();
          var K2 = S2.rotate(), q = S2.invert(A2.midPt);
          A2.graphDiv.emit("plotly_relayouting", { "geo.projection.scale": S2.scale() / A2.fitScale, "geo.center.lon": q[0], "geo.center.lat": q[1], "geo.projection.rotation.lon": -K2[0] });
        }).on("zoomend", function() {
          n.select(this).style(u2), V2 && f(A2, S2, Y2);
        }), W2;
      }
      function d(A2, S2) {
        var C2, E2 = { r: S2.rotate(), k: S2.scale() }, F13 = c(0, S2), N2 = function(X2) {
          for (var Y2 = 0, K2 = arguments.length, q = []; ++Y2 < K2; ) q.push(arguments[Y2]);
          var re = n.dispatch.apply(null, q);
          return re.of = function(R2, z) {
            return function(H2) {
              var te;
              try {
                te = H2.sourceEvent = n.event, H2.target = X2, n.event = H2, re[H2.type].apply(R2, z);
              } finally {
                n.event = te;
              }
            };
          }, re;
        }(F13, "zoomstart", "zoom", "zoomend"), D2 = 0, I2 = F13.on;
        function O2(X2) {
          D2++ || X2({ type: "zoomstart" });
        }
        function L2(X2) {
          X2({ type: "zoom" });
        }
        function V2(X2) {
          --D2 || X2({ type: "zoomend" });
        }
        function W2(X2) {
          var Y2 = S2.rotate();
          X2("projection.rotation.lon", -Y2[0]), X2("projection.rotation.lat", -Y2[1]);
        }
        return F13.on("zoomstart", function() {
          n.select(this).style(l);
          var X2 = n.mouse(this), Y2 = S2.rotate(), K2 = Y2, q = S2.translate(), re = m(Y2);
          C2 = v(S2, X2), I2.call(F13, "zoom", function() {
            var R2 = n.mouse(this);
            if (S2.scale(E2.k = n.event.scale), C2) {
              if (v(S2, R2)) {
                S2.rotate(Y2).translate(q);
                var z = v(S2, R2), H2 = x(C2, z), te = k(g(re, H2)), j = E2.r = b(te, C2, K2);
                isFinite(j[0]) && isFinite(j[1]) && isFinite(j[2]) || (j = K2), S2.rotate(j), K2 = j;
              }
            } else C2 = v(S2, X2 = R2);
            L2(N2.of(this, arguments));
          }), O2(N2.of(this, arguments));
        }).on("zoomend", function() {
          n.select(this).style(u2), I2.call(F13, "zoom", null), V2(N2.of(this, arguments)), f(A2, S2, W2);
        }).on("zoom.redraw", function() {
          A2.render();
          var X2 = S2.rotate();
          A2.graphDiv.emit("plotly_relayouting", { "geo.projection.scale": S2.scale() / A2.fitScale, "geo.projection.rotation.lon": -X2[0], "geo.projection.rotation.lat": -X2[1] });
        }), n.rebind(F13, N2, "on");
      }
      function v(A2, S2) {
        var C2 = A2.invert(S2);
        return C2 && isFinite(C2[0]) && isFinite(C2[1]) && function(E2) {
          var F13 = E2[0] * s, N2 = E2[1] * s, D2 = Math.cos(N2);
          return [D2 * Math.cos(F13), D2 * Math.sin(F13), Math.sin(N2)];
        }(C2);
      }
      function m(A2) {
        var S2 = 0.5 * A2[0] * s, C2 = 0.5 * A2[1] * s, E2 = 0.5 * A2[2] * s, F13 = Math.sin(S2), N2 = Math.cos(S2), D2 = Math.sin(C2), I2 = Math.cos(C2), O2 = Math.sin(E2), L2 = Math.cos(E2);
        return [N2 * I2 * L2 + F13 * D2 * O2, F13 * I2 * L2 - N2 * D2 * O2, N2 * D2 * L2 + F13 * I2 * O2, N2 * I2 * O2 - F13 * D2 * L2];
      }
      function g(A2, S2) {
        var C2 = A2[0], E2 = A2[1], F13 = A2[2], N2 = A2[3], D2 = S2[0], I2 = S2[1], O2 = S2[2], L2 = S2[3];
        return [C2 * D2 - E2 * I2 - F13 * O2 - N2 * L2, C2 * I2 + E2 * D2 + F13 * L2 - N2 * O2, C2 * O2 - E2 * L2 + F13 * D2 + N2 * I2, C2 * L2 + E2 * O2 - F13 * I2 + N2 * D2];
      }
      function x(A2, S2) {
        if (A2 && S2) {
          var C2 = function(D2, I2) {
            return [D2[1] * I2[2] - D2[2] * I2[1], D2[2] * I2[0] - D2[0] * I2[2], D2[0] * I2[1] - D2[1] * I2[0]];
          }(A2, S2), E2 = Math.sqrt(T2(C2, C2)), F13 = 0.5 * Math.acos(Math.max(-1, Math.min(1, T2(A2, S2)))), N2 = Math.sin(F13) / E2;
          return E2 && [Math.cos(F13), C2[2] * N2, -C2[1] * N2, C2[0] * N2];
        }
      }
      function b(A2, S2, C2) {
        var E2 = _4(S2, 2, A2[0]);
        E2 = _4(E2, 1, A2[1]), E2 = _4(E2, 0, A2[2] - C2[2]);
        var F13, N2, D2 = S2[0], I2 = S2[1], O2 = S2[2], L2 = E2[0], V2 = E2[1], W2 = E2[2], X2 = Math.atan2(I2, D2) * i, Y2 = Math.sqrt(D2 * D2 + I2 * I2);
        Math.abs(V2) > Y2 ? (N2 = (V2 > 0 ? 90 : -90) - X2, F13 = 0) : (N2 = Math.asin(V2 / Y2) * i - X2, F13 = Math.sqrt(Y2 * Y2 - V2 * V2));
        var K2 = 180 - N2 - 2 * X2, q = (Math.atan2(W2, L2) - Math.atan2(O2, F13)) * i, re = (Math.atan2(W2, L2) - Math.atan2(O2, -F13)) * i;
        return y(C2[0], C2[1], N2, q) <= y(C2[0], C2[1], K2, re) ? [N2, q, C2[2]] : [K2, re, C2[2]];
      }
      function y(A2, S2, C2, E2) {
        var F13 = w(C2 - A2), N2 = w(E2 - S2);
        return Math.sqrt(F13 * F13 + N2 * N2);
      }
      function w(A2) {
        return (A2 % 360 + 540) % 360 - 180;
      }
      function _4(A2, S2, C2) {
        var E2 = C2 * s, F13 = A2.slice(), N2 = S2 === 0 ? 1 : 0, D2 = S2 === 2 ? 1 : 2, I2 = Math.cos(E2), O2 = Math.sin(E2);
        return F13[N2] = A2[N2] * I2 - A2[D2] * O2, F13[D2] = A2[D2] * I2 + A2[N2] * O2, F13;
      }
      function k(A2) {
        return [Math.atan2(2 * (A2[0] * A2[1] + A2[2] * A2[3]), 1 - 2 * (A2[1] * A2[1] + A2[2] * A2[2])) * i, Math.asin(Math.max(-1, Math.min(1, 2 * (A2[0] * A2[2] - A2[3] * A2[1])))) * i, Math.atan2(2 * (A2[0] * A2[3] + A2[1] * A2[2]), 1 - 2 * (A2[2] * A2[2] + A2[3] * A2[3])) * i];
      }
      function T2(A2, S2) {
        for (var C2 = 0, E2 = 0, F13 = A2.length; E2 < F13; ++E2) C2 += A2[E2] * S2[E2];
        return C2;
      }
      t.exports = function(A2, S2) {
        var C2 = A2.projection;
        return (S2._isScoped ? h : S2._isClipped ? d : p)(A2, C2);
      };
    }, { "../../lib": 503, "../../registry": 638, "@plotly/d3": 58 }], 593: [function(e, t, r) {
      "use strict";
      var n = e("../registry"), a = e("./cartesian/constants").SUBPLOT_PATTERN;
      r.getSubplotCalcData = function(o, s, i) {
        var l = n.subplotsRegistry[s];
        if (!l) return [];
        for (var u2 = l.attr, c = [], f = 0; f < o.length; f++) {
          var h = o[f];
          h[0].trace[u2] === i && c.push(h);
        }
        return c;
      }, r.getModuleCalcData = function(o, s) {
        var i, l = [], u2 = [];
        if (!(i = typeof s == "string" ? n.getModule(s).plot : typeof s == "function" ? s : s.plot)) return [l, o];
        for (var c = 0; c < o.length; c++) {
          var f = o[c], h = f[0].trace;
          h.visible === true && h._length !== 0 && (h._module.plot === i ? l.push(f) : u2.push(f));
        }
        return [l, u2];
      }, r.getSubplotData = function(o, s, i) {
        if (!n.subplotsRegistry[s]) return [];
        var l, u2, c, f = n.subplotsRegistry[s].attr, h = [];
        if (s === "gl2d") {
          var p = i.match(a);
          u2 = "x" + p[1], c = "y" + p[2];
        }
        for (var d = 0; d < o.length; d++) l = o[d], s === "gl2d" && n.traceIs(l, "gl2d") ? l[f[0]] === u2 && l[f[1]] === c && h.push(l) : l[f] === i && h.push(l);
        return h;
      };
    }, { "../registry": 638, "./cartesian/constants": 561 }], 594: [function(e, t, r) {
      "use strict";
      var n = e("mouse-change"), a = e("mouse-wheel"), o = e("mouse-event-offset"), s = e("../cartesian/constants"), i = e("has-passive-events");
      function l(u2, c) {
        this.element = u2, this.plot = c, this.mouseListener = null, this.wheelListener = null, this.lastInputTime = Date.now(), this.lastPos = [0, 0], this.boxEnabled = false, this.boxInited = false, this.boxStart = [0, 0], this.boxEnd = [0, 0], this.dragStart = [0, 0];
      }
      t.exports = function(u2) {
        var c = u2.mouseContainer, f = u2.glplot, h = new l(c, f);
        function p() {
          u2.xaxis.autorange = false, u2.yaxis.autorange = false;
        }
        function d(v, m, g) {
          var x, b, y = u2.calcDataBox(), w = f.viewBox, _4 = h.lastPos[0], k = h.lastPos[1], T2 = s.MINDRAG * f.pixelRatio, A2 = s.MINZOOM * f.pixelRatio;
          function S2(I2, O2, L2) {
            var V2 = Math.min(O2, L2), W2 = Math.max(O2, L2);
            V2 !== W2 ? (y[I2] = V2, y[I2 + 2] = W2, h.dataBox = y, u2.setRanges(y)) : (u2.selectBox.selectBox = [0, 0, 1, 1], u2.glplot.setDirty());
          }
          switch (m *= f.pixelRatio, g *= f.pixelRatio, g = w[3] - w[1] - g, u2.fullLayout.dragmode) {
            case "zoom":
              if (v) {
                var C2 = m / (w[2] - w[0]) * (y[2] - y[0]) + y[0], E2 = g / (w[3] - w[1]) * (y[3] - y[1]) + y[1];
                h.boxInited || (h.boxStart[0] = C2, h.boxStart[1] = E2, h.dragStart[0] = m, h.dragStart[1] = g), h.boxEnd[0] = C2, h.boxEnd[1] = E2, h.boxInited = true, h.boxEnabled || h.boxStart[0] === h.boxEnd[0] && h.boxStart[1] === h.boxEnd[1] || (h.boxEnabled = true);
                var F13 = Math.abs(h.dragStart[0] - m) < A2, N2 = Math.abs(h.dragStart[1] - g) < A2;
                if (!function() {
                  for (var I2 = u2.graphDiv._fullLayout._axisConstraintGroups, O2 = u2.xaxis._id, L2 = u2.yaxis._id, V2 = 0; V2 < I2.length; V2++) if (I2[V2][O2] !== -1) {
                    if (I2[V2][L2] !== -1) return true;
                    break;
                  }
                  return false;
                }() || F13 && N2) F13 && (h.boxEnd[0] = h.boxStart[0]), N2 && (h.boxEnd[1] = h.boxStart[1]);
                else {
                  x = h.boxEnd[0] - h.boxStart[0], b = h.boxEnd[1] - h.boxStart[1];
                  var D2 = (y[3] - y[1]) / (y[2] - y[0]);
                  Math.abs(x * D2) > Math.abs(b) ? (h.boxEnd[1] = h.boxStart[1] + Math.abs(x) * D2 * (b >= 0 ? 1 : -1), h.boxEnd[1] < y[1] ? (h.boxEnd[1] = y[1], h.boxEnd[0] = h.boxStart[0] + (y[1] - h.boxStart[1]) / Math.abs(D2)) : h.boxEnd[1] > y[3] && (h.boxEnd[1] = y[3], h.boxEnd[0] = h.boxStart[0] + (y[3] - h.boxStart[1]) / Math.abs(D2))) : (h.boxEnd[0] = h.boxStart[0] + Math.abs(b) / D2 * (x >= 0 ? 1 : -1), h.boxEnd[0] < y[0] ? (h.boxEnd[0] = y[0], h.boxEnd[1] = h.boxStart[1] + (y[0] - h.boxStart[0]) * Math.abs(D2)) : h.boxEnd[0] > y[2] && (h.boxEnd[0] = y[2], h.boxEnd[1] = h.boxStart[1] + (y[2] - h.boxStart[0]) * Math.abs(D2)));
                }
              } else h.boxEnabled ? (x = h.boxStart[0] !== h.boxEnd[0], b = h.boxStart[1] !== h.boxEnd[1], x || b ? (x && (S2(0, h.boxStart[0], h.boxEnd[0]), u2.xaxis.autorange = false), b && (S2(1, h.boxStart[1], h.boxEnd[1]), u2.yaxis.autorange = false), u2.relayoutCallback()) : u2.glplot.setDirty(), h.boxEnabled = false, h.boxInited = false) : h.boxInited && (h.boxInited = false);
              break;
            case "pan":
              h.boxEnabled = false, h.boxInited = false, v ? (h.panning || (h.dragStart[0] = m, h.dragStart[1] = g), Math.abs(h.dragStart[0] - m) < T2 && (m = h.dragStart[0]), Math.abs(h.dragStart[1] - g) < T2 && (g = h.dragStart[1]), x = (_4 - m) * (y[2] - y[0]) / (f.viewBox[2] - f.viewBox[0]), b = (k - g) * (y[3] - y[1]) / (f.viewBox[3] - f.viewBox[1]), y[0] += x, y[2] += x, y[1] += b, y[3] += b, u2.setRanges(y), h.panning = true, h.lastInputTime = Date.now(), p(), u2.cameraChanged(), u2.handleAnnotations()) : h.panning && (h.panning = false, u2.relayoutCallback());
          }
          h.lastPos[0] = m, h.lastPos[1] = g;
        }
        return h.mouseListener = n(c, d), c.addEventListener("touchstart", function(v) {
          var m = o(v.changedTouches[0], c);
          d(0, m[0], m[1]), d(1, m[0], m[1]), v.preventDefault();
        }, !!i && { passive: false }), c.addEventListener("touchmove", function(v) {
          v.preventDefault();
          var m = o(v.changedTouches[0], c);
          d(1, m[0], m[1]), v.preventDefault();
        }, !!i && { passive: false }), c.addEventListener("touchend", function(v) {
          d(0, h.lastPos[0], h.lastPos[1]), v.preventDefault();
        }, !!i && { passive: false }), h.wheelListener = a(c, function(v, m) {
          if (!u2.scrollZoom) return false;
          var g = u2.calcDataBox(), x = f.viewBox, b = h.lastPos[0], y = h.lastPos[1], w = Math.exp(5 * m / (x[3] - x[1])), _4 = b / (x[2] - x[0]) * (g[2] - g[0]) + g[0], k = y / (x[3] - x[1]) * (g[3] - g[1]) + g[1];
          return g[0] = (g[0] - _4) * w + _4, g[2] = (g[2] - _4) * w + _4, g[1] = (g[1] - k) * w + k, g[3] = (g[3] - k) * w + k, u2.setRanges(g), h.lastInputTime = Date.now(), p(), u2.cameraChanged(), u2.handleAnnotations(), u2.relayoutCallback(), true;
        }, true), h;
      };
    }, { "../cartesian/constants": 561, "has-passive-events": 229, "mouse-change": 241, "mouse-event-offset": 242, "mouse-wheel": 244 }], 595: [function(e, t, r) {
      "use strict";
      var n = e("../cartesian/axes"), a = e("../../lib/str2rgbarray");
      function o(l) {
        this.scene = l, this.gl = l.gl, this.pixelRatio = l.pixelRatio, this.screenBox = [0, 0, 1, 1], this.viewBox = [0, 0, 1, 1], this.dataBox = [-1, -1, 1, 1], this.borderLineEnable = [false, false, false, false], this.borderLineWidth = [1, 1, 1, 1], this.borderLineColor = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]], this.ticks = [[], []], this.tickEnable = [true, true, false, false], this.tickPad = [15, 15, 15, 15], this.tickAngle = [0, 0, 0, 0], this.tickColor = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]], this.tickMarkLength = [0, 0, 0, 0], this.tickMarkWidth = [0, 0, 0, 0], this.tickMarkColor = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]], this.labels = ["x", "y"], this.labelEnable = [true, true, false, false], this.labelAngle = [0, Math.PI / 2, 0, 3 * Math.PI / 2], this.labelPad = [15, 15, 15, 15], this.labelSize = [12, 12], this.labelFont = ["sans-serif", "sans-serif"], this.labelColor = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]], this.title = "", this.titleEnable = true, this.titleCenter = [0, 0, 0, 0], this.titleAngle = 0, this.titleColor = [0, 0, 0, 1], this.titleFont = "sans-serif", this.titleSize = 18, this.gridLineEnable = [true, true], this.gridLineColor = [[0, 0, 0, 0.5], [0, 0, 0, 0.5]], this.gridLineWidth = [1, 1], this.zeroLineEnable = [true, true], this.zeroLineWidth = [1, 1], this.zeroLineColor = [[0, 0, 0, 1], [0, 0, 0, 1]], this.borderColor = [0, 0, 0, 0], this.backgroundColor = [0, 0, 0, 0], this.static = this.scene.staticPlot;
      }
      var s = o.prototype, i = ["xaxis", "yaxis"];
      s.merge = function(l) {
        var u2, c, f, h, p, d, v, m, g, x, b;
        for (this.titleEnable = false, this.backgroundColor = a(l.plot_bgcolor), x = 0; x < 2; ++x) {
          var y = (u2 = i[x]).charAt(0);
          for (f = (c = l[this.scene[u2]._name]).title.text === this.scene.fullLayout._dfltTitle[y] ? "" : c.title.text, b = 0; b <= 2; b += 2) this.labelEnable[x + b] = false, this.labels[x + b] = f, this.labelColor[x + b] = a(c.title.font.color), this.labelFont[x + b] = c.title.font.family, this.labelSize[x + b] = c.title.font.size, this.labelPad[x + b] = this.getLabelPad(u2, c), this.tickEnable[x + b] = false, this.tickColor[x + b] = a((c.tickfont || {}).color), this.tickAngle[x + b] = c.tickangle === "auto" ? 0 : Math.PI * -c.tickangle / 180, this.tickPad[x + b] = this.getTickPad(c), this.tickMarkLength[x + b] = 0, this.tickMarkWidth[x + b] = c.tickwidth || 0, this.tickMarkColor[x + b] = a(c.tickcolor), this.borderLineEnable[x + b] = false, this.borderLineColor[x + b] = a(c.linecolor), this.borderLineWidth[x + b] = c.linewidth || 0;
          v = this.hasSharedAxis(c), p = this.hasAxisInDfltPos(u2, c) && !v, d = this.hasAxisInAltrPos(u2, c) && !v, h = c.mirror || false, m = v ? String(h).indexOf("all") !== -1 : !!h, g = v ? h === "allticks" : String(h).indexOf("ticks") !== -1, p ? this.labelEnable[x] = true : d && (this.labelEnable[x + 2] = true), p ? this.tickEnable[x] = c.showticklabels : d && (this.tickEnable[x + 2] = c.showticklabels), (p || m) && (this.borderLineEnable[x] = c.showline), (d || m) && (this.borderLineEnable[x + 2] = c.showline), (p || g) && (this.tickMarkLength[x] = this.getTickMarkLength(c)), (d || g) && (this.tickMarkLength[x + 2] = this.getTickMarkLength(c)), this.gridLineEnable[x] = c.showgrid, this.gridLineColor[x] = a(c.gridcolor), this.gridLineWidth[x] = c.gridwidth, this.zeroLineEnable[x] = c.zeroline, this.zeroLineColor[x] = a(c.zerolinecolor), this.zeroLineWidth[x] = c.zerolinewidth;
        }
      }, s.hasSharedAxis = function(l) {
        var u2 = this.scene, c = u2.fullLayout._subplots.gl2d;
        return n.findSubplotsWithAxis(c, l).indexOf(u2.id) !== 0;
      }, s.hasAxisInDfltPos = function(l, u2) {
        var c = u2.side;
        return l === "xaxis" ? c === "bottom" : l === "yaxis" ? c === "left" : void 0;
      }, s.hasAxisInAltrPos = function(l, u2) {
        var c = u2.side;
        return l === "xaxis" ? c === "top" : l === "yaxis" ? c === "right" : void 0;
      }, s.getLabelPad = function(l, u2) {
        var c = u2.title.font.size, f = u2.showticklabels;
        return l === "xaxis" ? u2.side === "top" ? c * (1.5 + (f ? 1 : 0)) - 10 : c * (1.5 + (f ? 0.5 : 0)) - 10 : l === "yaxis" ? u2.side === "right" ? 10 + c * (1.5 + (f ? 1 : 0.5)) : 10 + c * (1.5 + (f ? 0.5 : 0)) : void 0;
      }, s.getTickPad = function(l) {
        return l.ticks === "outside" ? 10 + l.ticklen : 15;
      }, s.getTickMarkLength = function(l) {
        if (!l.ticks) return 0;
        var u2 = l.ticklen;
        return l.ticks === "inside" ? -u2 : u2;
      }, t.exports = function(l) {
        return new o(l);
      };
    }, { "../../lib/str2rgbarray": 528, "../cartesian/axes": 554 }], 596: [function(e, t, r) {
      "use strict";
      var n = e("../../plot_api/edit_types").overrideAll, a = e("./scene2d"), o = e("../layout_attributes"), s = e("../../constants/xmlns_namespaces"), i = e("../cartesian/constants"), l = e("../cartesian"), u2 = e("../../components/fx/layout_attributes"), c = e("../get_data").getSubplotData;
      r.name = "gl2d", r.attr = ["xaxis", "yaxis"], r.idRoot = ["x", "y"], r.idRegex = i.idRegex, r.attrRegex = i.attrRegex, r.attributes = e("../cartesian/attributes"), r.supplyLayoutDefaults = function(f, h, p) {
        h._has("cartesian") || l.supplyLayoutDefaults(f, h, p);
      }, r.layoutAttrOverrides = n(l.layoutAttributes, "plot", "from-root"), r.baseLayoutAttrOverrides = n({ plot_bgcolor: o.plot_bgcolor, hoverlabel: u2.hoverlabel }, "plot", "nested"), r.plot = function(f) {
        for (var h = f._fullLayout, p = f._fullData, d = h._subplots.gl2d, v = 0; v < d.length; v++) {
          var m = d[v], g = h._plots[m], x = c(p, "gl2d", m), b = g._scene2d;
          b === void 0 && (b = new a({ id: m, graphDiv: f, container: f.querySelector(".gl-container"), staticPlot: f._context.staticPlot, plotGlPixelRatio: f._context.plotGlPixelRatio }, h), g._scene2d = b), b.plot(x, f.calcdata, h, f.layout);
        }
      }, r.clean = function(f, h, p, d) {
        for (var v = d._subplots.gl2d || [], m = 0; m < v.length; m++) {
          var g = v[m], x = d._plots[g];
          if (x._scene2d) {
            var b = c(f, "gl2d", g);
            b.length === 0 && (x._scene2d.destroy(), delete d._plots[g]);
          }
        }
        l.clean.apply(this, arguments);
      }, r.drawFramework = function(f) {
        f._context.staticPlot || l.drawFramework(f);
      }, r.toSVG = function(f) {
        for (var h = f._fullLayout, p = h._subplots.gl2d, d = 0; d < p.length; d++) {
          var v = h._plots[p[d]]._scene2d, m = v.toImage("png");
          h._glimages.append("svg:image").attr({ xmlns: s.svg, "xlink:href": m, x: 0, y: 0, width: "100%", height: "100%", preserveAspectRatio: "none" }), v.destroy();
        }
      }, r.updateFx = function(f) {
        for (var h = f._fullLayout, p = h._subplots.gl2d, d = 0; d < p.length; d++) h._plots[p[d]]._scene2d.updateFx(h.dragmode);
      };
    }, { "../../components/fx/layout_attributes": 407, "../../constants/xmlns_namespaces": 480, "../../plot_api/edit_types": 536, "../cartesian": 568, "../cartesian/attributes": 552, "../cartesian/constants": 561, "../get_data": 593, "../layout_attributes": 610, "./scene2d": 597 }], 597: [function(e, t, r) {
      "use strict";
      var n, a, o = e("../../registry"), s = e("../../plots/cartesian/axes"), i = e("../../components/fx"), l = e("../../../stackgl_modules").gl_plot2d, u2 = e("../../../stackgl_modules").gl_spikes2d, c = e("../../../stackgl_modules").gl_select_box, f = e("webgl-context"), h = e("./convert"), p = e("./camera"), d = e("../../lib/show_no_webgl_msg"), v = e("../cartesian/constraints"), m = v.enforce, g = v.clean, x = e("../cartesian/autorange").doAutoRange, b = e("../../components/dragelement/helpers"), y = b.drawMode, w = b.selectMode, _4 = ["xaxis", "yaxis"], k = e("../cartesian/constants").SUBPLOT_PATTERN;
      function T2(S2, C2) {
        this.container = S2.container, this.graphDiv = S2.graphDiv, this.pixelRatio = S2.plotGlPixelRatio || window.devicePixelRatio, this.id = S2.id, this.staticPlot = !!S2.staticPlot, this.scrollZoom = this.graphDiv._context._scrollZoom.cartesian, this.fullData = null, this.updateRefs(C2), this.makeFramework(), this.stopped || (this.glplotOptions = h(this), this.glplotOptions.merge(C2), this.glplot = l(this.glplotOptions), this.camera = p(this), this.traces = {}, this.spikes = u2(this.glplot), this.selectBox = c(this.glplot, { innerFill: false, outerFill: true }), this.lastButtonState = 0, this.pickResult = null, this.isMouseOver = true, this.stopped = false, this.redraw = this.draw.bind(this), this.redraw());
      }
      t.exports = T2;
      var A2 = T2.prototype;
      A2.makeFramework = function() {
        if (this.staticPlot) {
          if (!(a || (n = document.createElement("canvas"), a = f({ canvas: n, preserveDrawingBuffer: false, premultipliedAlpha: true, antialias: true })))) throw new Error("Error creating static canvas/context for image server");
          this.canvas = n, this.gl = a;
        } else {
          var S2 = this.container.querySelector(".gl-canvas-focus"), C2 = f({ canvas: S2, preserveDrawingBuffer: true, premultipliedAlpha: true });
          if (!C2) return d(this), void (this.stopped = true);
          this.canvas = S2, this.gl = C2;
        }
        var E2 = this.canvas;
        E2.style.width = "100%", E2.style.height = "100%", E2.style.position = "absolute", E2.style.top = "0px", E2.style.left = "0px", E2.style["pointer-events"] = "none", this.updateSize(E2);
        var F13 = this.svgContainer = document.createElementNS("http://www.w3.org/2000/svg", "svg");
        F13.style.position = "absolute", F13.style.top = F13.style.left = "0px", F13.style.width = F13.style.height = "100%", F13.style["z-index"] = 20, F13.style["pointer-events"] = "none";
        var N2 = this.mouseContainer = document.createElement("div");
        N2.style.position = "absolute", N2.style["pointer-events"] = "auto", this.pickCanvas = this.container.querySelector(".gl-canvas-pick");
        var D2 = this.container;
        D2.appendChild(F13), D2.appendChild(N2);
        var I2 = this;
        N2.addEventListener("mouseout", function() {
          I2.isMouseOver = false, I2.unhover();
        }), N2.addEventListener("mouseover", function() {
          I2.isMouseOver = true;
        });
      }, A2.toImage = function(S2) {
        S2 || (S2 = "png"), this.stopped = true, this.staticPlot && this.container.appendChild(n), this.updateSize(this.canvas);
        var C2 = this.glplot.gl, E2 = C2.drawingBufferWidth, F13 = C2.drawingBufferHeight;
        C2.clearColor(1, 1, 1, 0), C2.clear(C2.COLOR_BUFFER_BIT | C2.DEPTH_BUFFER_BIT), this.glplot.setDirty(), this.glplot.draw(), C2.bindFramebuffer(C2.FRAMEBUFFER, null);
        var N2 = new Uint8Array(E2 * F13 * 4);
        C2.readPixels(0, 0, E2, F13, C2.RGBA, C2.UNSIGNED_BYTE, N2);
        for (var D2 = 0, I2 = F13 - 1; D2 < I2; ++D2, --I2) for (var O2 = 0; O2 < E2; ++O2) for (var L2 = 0; L2 < 4; ++L2) {
          var V2 = N2[4 * (E2 * D2 + O2) + L2];
          N2[4 * (E2 * D2 + O2) + L2] = N2[4 * (E2 * I2 + O2) + L2], N2[4 * (E2 * I2 + O2) + L2] = V2;
        }
        var W2 = document.createElement("canvas");
        W2.width = E2, W2.height = F13;
        var X2, Y2 = W2.getContext("2d"), K2 = Y2.createImageData(E2, F13);
        switch (K2.data.set(N2), Y2.putImageData(K2, 0, 0), S2) {
          case "jpeg":
            X2 = W2.toDataURL("image/jpeg");
            break;
          case "webp":
            X2 = W2.toDataURL("image/webp");
            break;
          default:
            X2 = W2.toDataURL("image/png");
        }
        return this.staticPlot && this.container.removeChild(n), X2;
      }, A2.updateSize = function(S2) {
        S2 || (S2 = this.canvas);
        var C2 = this.pixelRatio, E2 = this.fullLayout, F13 = E2.width, N2 = E2.height, D2 = 0 | Math.ceil(C2 * F13), I2 = 0 | Math.ceil(C2 * N2);
        return S2.width === D2 && S2.height === I2 || (S2.width = D2, S2.height = I2), S2;
      }, A2.computeTickMarks = function() {
        this.xaxis.setScale(), this.yaxis.setScale();
        for (var S2 = [s.calcTicks(this.xaxis), s.calcTicks(this.yaxis)], C2 = 0; C2 < 2; ++C2) for (var E2 = 0; E2 < S2[C2].length; ++E2) S2[C2][E2].text = S2[C2][E2].text + "";
        return S2;
      }, A2.updateRefs = function(S2) {
        this.fullLayout = S2;
        var C2 = this.id.match(k), E2 = "xaxis" + C2[1], F13 = "yaxis" + C2[2];
        this.xaxis = this.fullLayout[E2], this.yaxis = this.fullLayout[F13];
      }, A2.relayoutCallback = function() {
        var S2 = this.graphDiv, C2 = this.xaxis, E2 = this.yaxis, F13 = S2.layout, N2 = {}, D2 = N2[C2._name + ".range"] = C2.range.slice(), I2 = N2[E2._name + ".range"] = E2.range.slice();
        N2[C2._name + ".autorange"] = C2.autorange, N2[E2._name + ".autorange"] = E2.autorange, o.call("_storeDirectGUIEdit", S2.layout, S2._fullLayout._preGUI, N2);
        var O2 = F13[C2._name];
        O2.range = D2, O2.autorange = C2.autorange;
        var L2 = F13[E2._name];
        L2.range = I2, L2.autorange = E2.autorange, N2.lastInputTime = this.camera.lastInputTime, S2.emit("plotly_relayout", N2);
      }, A2.cameraChanged = function() {
        var S2 = this.camera;
        this.glplot.setDataBox(this.calcDataBox());
        var C2 = this.computeTickMarks();
        (function(E2, F13) {
          for (var N2 = 0; N2 < 2; ++N2) {
            var D2 = E2[N2], I2 = F13[N2];
            if (D2.length !== I2.length) return true;
            for (var O2 = 0; O2 < D2.length; ++O2) if (D2[O2].x !== I2[O2].x) return true;
          }
          return false;
        })(C2, this.glplotOptions.ticks) && (this.glplotOptions.ticks = C2, this.glplotOptions.dataBox = S2.dataBox, this.glplot.update(this.glplotOptions), this.handleAnnotations());
      }, A2.handleAnnotations = function() {
        for (var S2 = this.graphDiv, C2 = this.fullLayout.annotations, E2 = 0; E2 < C2.length; E2++) {
          var F13 = C2[E2];
          F13.xref === this.xaxis._id && F13.yref === this.yaxis._id && o.getComponentMethod("annotations", "drawOne")(S2, E2);
        }
      }, A2.destroy = function() {
        if (this.glplot) {
          var S2 = this.traces;
          S2 && Object.keys(S2).map(function(C2) {
            S2[C2].dispose(), delete S2[C2];
          }), this.glplot.dispose(), this.container.removeChild(this.svgContainer), this.container.removeChild(this.mouseContainer), this.fullData = null, this.glplot = null, this.stopped = true, this.camera.mouseListener.enabled = false, this.mouseContainer.removeEventListener("wheel", this.camera.wheelListener), this.camera = null;
        }
      }, A2.plot = function(S2, C2, E2) {
        var F13 = this.glplot;
        this.updateRefs(E2), this.xaxis.clearCalc(), this.yaxis.clearCalc(), this.updateTraces(S2, C2), this.updateFx(E2.dragmode);
        var N2 = E2.width, D2 = E2.height;
        this.updateSize(this.canvas);
        var I2 = this.glplotOptions;
        I2.merge(E2), I2.screenBox = [0, 0, N2, D2];
        var O2 = { _fullLayout: { _axisConstraintGroups: E2._axisConstraintGroups, xaxis: this.xaxis, yaxis: this.yaxis, _size: E2._size } };
        g(O2, this.xaxis), g(O2, this.yaxis);
        var L2, V2, W2 = E2._size, X2 = this.xaxis.domain, Y2 = this.yaxis.domain;
        for (I2.viewBox = [W2.l + X2[0] * W2.w, W2.b + Y2[0] * W2.h, N2 - W2.r - (1 - X2[1]) * W2.w, D2 - W2.t - (1 - Y2[1]) * W2.h], this.mouseContainer.style.width = W2.w * (X2[1] - X2[0]) + "px", this.mouseContainer.style.height = W2.h * (Y2[1] - Y2[0]) + "px", this.mouseContainer.height = W2.h * (Y2[1] - Y2[0]), this.mouseContainer.style.left = W2.l + X2[0] * W2.w + "px", this.mouseContainer.style.top = W2.t + (1 - Y2[1]) * W2.h + "px", V2 = 0; V2 < 2; ++V2) (L2 = this[_4[V2]])._length = I2.viewBox[V2 + 2] - I2.viewBox[V2], x(this.graphDiv, L2), L2.setScale();
        m(O2), I2.ticks = this.computeTickMarks(), I2.dataBox = this.calcDataBox(), I2.merge(E2), F13.update(I2), this.glplot.draw();
      }, A2.calcDataBox = function() {
        var S2 = this.xaxis, C2 = this.yaxis, E2 = S2.range, F13 = C2.range, N2 = S2.r2l, D2 = C2.r2l;
        return [N2(E2[0]), D2(F13[0]), N2(E2[1]), D2(F13[1])];
      }, A2.setRanges = function(S2) {
        var C2 = this.xaxis, E2 = this.yaxis, F13 = C2.l2r, N2 = E2.l2r;
        C2.range = [F13(S2[0]), F13(S2[2])], E2.range = [N2(S2[1]), N2(S2[3])];
      }, A2.updateTraces = function(S2, C2) {
        var E2, F13, N2, D2 = Object.keys(this.traces);
        this.fullData = S2;
        e: for (E2 = 0; E2 < D2.length; E2++) {
          var I2 = D2[E2], O2 = this.traces[I2];
          for (F13 = 0; F13 < S2.length; F13++) if ((N2 = S2[F13]).uid === I2 && N2.type === O2.type) continue e;
          O2.dispose(), delete this.traces[I2];
        }
        for (E2 = 0; E2 < S2.length; E2++) {
          N2 = S2[E2];
          var L2 = C2[E2], V2 = this.traces[N2.uid];
          V2 ? V2.update(N2, L2) : (V2 = N2._module.plot(this, N2, L2), this.traces[N2.uid] = V2);
        }
        this.glplot.objects.sort(function(W2, X2) {
          return W2._trace.index - X2._trace.index;
        });
      }, A2.updateFx = function(S2) {
        w(S2) || y(S2) ? (this.pickCanvas.style["pointer-events"] = "none", this.mouseContainer.style["pointer-events"] = "none") : (this.pickCanvas.style["pointer-events"] = "auto", this.mouseContainer.style["pointer-events"] = "auto"), this.mouseContainer.style.cursor = S2 === "pan" ? "move" : S2 === "zoom" ? "crosshair" : null;
      }, A2.emitPointAction = function(S2, C2) {
        for (var E2, F13 = S2.trace.uid, N2 = S2.pointIndex, D2 = 0; D2 < this.fullData.length; D2++) this.fullData[D2].uid === F13 && (E2 = this.fullData[D2]);
        var I2 = { x: S2.traceCoord[0], y: S2.traceCoord[1], curveNumber: E2.index, pointNumber: N2, data: E2._input, fullData: this.fullData, xaxis: this.xaxis, yaxis: this.yaxis };
        i.appendArrayPointValue(I2, E2, N2), this.graphDiv.emit(C2, { points: [I2] });
      }, A2.draw = function() {
        if (!this.stopped) {
          requestAnimationFrame(this.redraw);
          var S2 = this.glplot, C2 = this.camera, E2 = C2.mouseListener, F13 = this.lastButtonState === 1 && E2.buttons === 0, N2 = this.fullLayout;
          this.lastButtonState = E2.buttons, this.cameraChanged();
          var D2, I2 = E2.x * S2.pixelRatio, O2 = this.canvas.height - S2.pixelRatio * E2.y;
          if (C2.boxEnabled && N2.dragmode === "zoom") {
            this.selectBox.enabled = true;
            for (var L2 = this.selectBox.selectBox = [Math.min(C2.boxStart[0], C2.boxEnd[0]), Math.min(C2.boxStart[1], C2.boxEnd[1]), Math.max(C2.boxStart[0], C2.boxEnd[0]), Math.max(C2.boxStart[1], C2.boxEnd[1])], V2 = 0; V2 < 2; V2++) C2.boxStart[V2] === C2.boxEnd[V2] && (L2[V2] = S2.dataBox[V2], L2[V2 + 2] = S2.dataBox[V2 + 2]);
            S2.setDirty();
          } else if (!C2.panning && this.isMouseOver) {
            this.selectBox.enabled = false;
            var W2 = N2._size, X2 = this.xaxis.domain, Y2 = this.yaxis.domain, K2 = (D2 = S2.pick(I2 / S2.pixelRatio + W2.l + X2[0] * W2.w, O2 / S2.pixelRatio - (W2.t + (1 - Y2[1]) * W2.h))) && D2.object._trace.handlePick(D2);
            if (K2 && F13 && this.emitPointAction(K2, "plotly_click"), D2 && D2.object._trace.hoverinfo !== "skip" && N2.hovermode && K2 && (!this.lastPickResult || this.lastPickResult.traceUid !== K2.trace.uid || this.lastPickResult.dataCoord[0] !== K2.dataCoord[0] || this.lastPickResult.dataCoord[1] !== K2.dataCoord[1])) {
              var q = K2;
              this.lastPickResult = { traceUid: K2.trace ? K2.trace.uid : null, dataCoord: K2.dataCoord.slice() }, this.spikes.update({ center: D2.dataCoord }), q.screenCoord = [((S2.viewBox[2] - S2.viewBox[0]) * (D2.dataCoord[0] - S2.dataBox[0]) / (S2.dataBox[2] - S2.dataBox[0]) + S2.viewBox[0]) / S2.pixelRatio, (this.canvas.height - (S2.viewBox[3] - S2.viewBox[1]) * (D2.dataCoord[1] - S2.dataBox[1]) / (S2.dataBox[3] - S2.dataBox[1]) - S2.viewBox[1]) / S2.pixelRatio], this.emitPointAction(K2, "plotly_hover");
              var re = this.fullData[q.trace.index] || {}, R2 = q.pointIndex, z = i.castHoverinfo(re, N2, R2);
              if (z && z !== "all") {
                var H2 = z.split("+");
                H2.indexOf("x") === -1 && (q.traceCoord[0] = void 0), H2.indexOf("y") === -1 && (q.traceCoord[1] = void 0), H2.indexOf("z") === -1 && (q.traceCoord[2] = void 0), H2.indexOf("text") === -1 && (q.textLabel = void 0), H2.indexOf("name") === -1 && (q.name = void 0);
              }
              i.loneHover({ x: q.screenCoord[0], y: q.screenCoord[1], xLabel: this.hoverFormatter("xaxis", q.traceCoord[0]), yLabel: this.hoverFormatter("yaxis", q.traceCoord[1]), zLabel: q.traceCoord[2], text: q.textLabel, name: q.name, color: i.castHoverOption(re, R2, "bgcolor") || q.color, borderColor: i.castHoverOption(re, R2, "bordercolor"), fontFamily: i.castHoverOption(re, R2, "font.family"), fontSize: i.castHoverOption(re, R2, "font.size"), fontColor: i.castHoverOption(re, R2, "font.color"), nameLength: i.castHoverOption(re, R2, "namelength"), textAlign: i.castHoverOption(re, R2, "align") }, { container: this.svgContainer, gd: this.graphDiv });
            }
          }
          D2 || this.unhover(), S2.draw();
        }
      }, A2.unhover = function() {
        this.lastPickResult && (this.spikes.update({}), this.lastPickResult = null, this.graphDiv.emit("plotly_unhover"), i.loneUnhover(this.svgContainer));
      }, A2.hoverFormatter = function(S2, C2) {
        if (C2 !== void 0) {
          var E2 = this[S2];
          return s.tickText(E2, E2.c2l(C2), "hover").text;
        }
      };
    }, { "../../../stackgl_modules": 1120, "../../components/dragelement/helpers": 384, "../../components/fx": 406, "../../lib/show_no_webgl_msg": 525, "../../plots/cartesian/axes": 554, "../../registry": 638, "../cartesian/autorange": 553, "../cartesian/constants": 561, "../cartesian/constraints": 562, "./camera": 594, "./convert": 595, "webgl-context": 331 }], 598: [function(e, t, r) {
      "use strict";
      var n = e("../../plot_api/edit_types").overrideAll, a = e("../../components/fx/layout_attributes"), o = e("./scene"), s = e("../get_data").getSubplotData, i = e("../../lib"), l = e("../../constants/xmlns_namespaces");
      r.name = "gl3d", r.attr = "scene", r.idRoot = "scene", r.idRegex = r.attrRegex = i.counterRegex("scene"), r.attributes = e("./layout/attributes"), r.layoutAttributes = e("./layout/layout_attributes"), r.baseLayoutAttrOverrides = n({ hoverlabel: a.hoverlabel }, "plot", "nested"), r.supplyLayoutDefaults = e("./layout/defaults"), r.plot = function(u2) {
        for (var c = u2._fullLayout, f = u2._fullData, h = c._subplots.gl3d, p = 0; p < h.length; p++) {
          var d = h[p], v = s(f, "gl3d", d), m = c[d], g = m.camera, x = m._scene;
          x || (x = new o({ id: d, graphDiv: u2, container: u2.querySelector(".gl-container"), staticPlot: u2._context.staticPlot, plotGlPixelRatio: u2._context.plotGlPixelRatio, camera: g }, c), m._scene = x), x.viewInitial || (x.viewInitial = { up: { x: g.up.x, y: g.up.y, z: g.up.z }, eye: { x: g.eye.x, y: g.eye.y, z: g.eye.z }, center: { x: g.center.x, y: g.center.y, z: g.center.z } }), x.plot(v, c, u2.layout);
        }
      }, r.clean = function(u2, c, f, h) {
        for (var p = h._subplots.gl3d || [], d = 0; d < p.length; d++) {
          var v = p[d];
          !c[v] && h[v]._scene && (h[v]._scene.destroy(), h._infolayer && h._infolayer.selectAll(".annotation-" + v).remove());
        }
      }, r.toSVG = function(u2) {
        for (var c = u2._fullLayout, f = c._subplots.gl3d, h = c._size, p = 0; p < f.length; p++) {
          var d = c[f[p]], v = d.domain, m = d._scene, g = m.toImage("png");
          c._glimages.append("svg:image").attr({ xmlns: l.svg, "xlink:href": g, x: h.l + h.w * v.x[0], y: h.t + h.h * (1 - v.y[1]), width: h.w * (v.x[1] - v.x[0]), height: h.h * (v.y[1] - v.y[0]), preserveAspectRatio: "none" }), m.destroy();
        }
      }, r.cleanId = function(u2) {
        if (u2.match(/^scene[0-9]*$/)) {
          var c = u2.substr(5);
          return c === "1" && (c = ""), "scene" + c;
        }
      }, r.updateFx = function(u2) {
        for (var c = u2._fullLayout, f = c._subplots.gl3d, h = 0; h < f.length; h++) c[f[h]]._scene.updateFx(c.dragmode, c.hovermode);
      };
    }, { "../../components/fx/layout_attributes": 407, "../../constants/xmlns_namespaces": 480, "../../lib": 503, "../../plot_api/edit_types": 536, "../get_data": 593, "./layout/attributes": 599, "./layout/defaults": 603, "./layout/layout_attributes": 604, "./scene": 608 }], 599: [function(e, t, r) {
      "use strict";
      t.exports = { scene: { valType: "subplotid", dflt: "scene", editType: "calc+clearAxisTypes" } };
    }, {}], 600: [function(e, t, r) {
      "use strict";
      var n = e("../../../components/color"), a = e("../../cartesian/layout_attributes"), o = e("../../../lib/extend").extendFlat, s = e("../../../plot_api/edit_types").overrideAll;
      t.exports = s({ visible: a.visible, showspikes: { valType: "boolean", dflt: true }, spikesides: { valType: "boolean", dflt: true }, spikethickness: { valType: "number", min: 0, dflt: 2 }, spikecolor: { valType: "color", dflt: n.defaultLine }, showbackground: { valType: "boolean", dflt: false }, backgroundcolor: { valType: "color", dflt: "rgba(204, 204, 204, 0.5)" }, showaxeslabels: { valType: "boolean", dflt: true }, color: a.color, categoryorder: a.categoryorder, categoryarray: a.categoryarray, title: { text: a.title.text, font: a.title.font }, type: o({}, a.type, { values: ["-", "linear", "log", "date", "category"] }), autotypenumbers: a.autotypenumbers, autorange: a.autorange, rangemode: a.rangemode, range: o({}, a.range, { items: [{ valType: "any", editType: "plot", impliedEdits: { "^autorange": false } }, { valType: "any", editType: "plot", impliedEdits: { "^autorange": false } }], anim: false }), tickmode: a.tickmode, nticks: a.nticks, tick0: a.tick0, dtick: a.dtick, tickvals: a.tickvals, ticktext: a.ticktext, ticks: a.ticks, mirror: a.mirror, ticklen: a.ticklen, tickwidth: a.tickwidth, tickcolor: a.tickcolor, showticklabels: a.showticklabels, tickfont: a.tickfont, tickangle: a.tickangle, tickprefix: a.tickprefix, showtickprefix: a.showtickprefix, ticksuffix: a.ticksuffix, showticksuffix: a.showticksuffix, showexponent: a.showexponent, exponentformat: a.exponentformat, minexponent: a.minexponent, separatethousands: a.separatethousands, tickformat: a.tickformat, tickformatstops: a.tickformatstops, hoverformat: a.hoverformat, showline: a.showline, linecolor: a.linecolor, linewidth: a.linewidth, showgrid: a.showgrid, gridcolor: o({}, a.gridcolor, { dflt: "rgb(204, 204, 204)" }), gridwidth: a.gridwidth, zeroline: a.zeroline, zerolinecolor: a.zerolinecolor, zerolinewidth: a.zerolinewidth, _deprecated: { title: a._deprecated.title, titlefont: a._deprecated.titlefont } }, "plot", "from-root");
    }, { "../../../components/color": 366, "../../../lib/extend": 493, "../../../plot_api/edit_types": 536, "../../cartesian/layout_attributes": 569 }], 601: [function(e, t, r) {
      "use strict";
      var n = e("tinycolor2").mix, a = e("../../../lib"), o = e("../../../plot_api/plot_template"), s = e("./axis_attributes"), i = e("../../cartesian/type_defaults"), l = e("../../cartesian/axis_defaults"), u2 = ["xaxis", "yaxis", "zaxis"];
      t.exports = function(c, f, h) {
        var p, d;
        function v(x, b) {
          return a.coerce(p, d, s, x, b);
        }
        for (var m = 0; m < u2.length; m++) {
          var g = u2[m];
          p = c[g] || {}, (d = o.newContainer(f, g))._id = g[0] + h.scene, d._name = g, i(p, d, v, h), l(p, d, v, { font: h.font, letter: g[0], data: h.data, showGrid: true, noTickson: true, noTicklabelmode: true, noTicklabelposition: true, noTicklabeloverflow: true, bgColor: h.bgColor, calendar: h.calendar }, h.fullLayout), v("gridcolor", n(d.color, h.bgColor, 13600 / 187).toRgbString()), v("title.text", g[0]), d.setScale = a.noop, v("showspikes") && (v("spikesides"), v("spikethickness"), v("spikecolor", d.color)), v("showaxeslabels"), v("showbackground") && v("backgroundcolor");
        }
      };
    }, { "../../../lib": 503, "../../../plot_api/plot_template": 543, "../../cartesian/axis_defaults": 556, "../../cartesian/type_defaults": 582, "./axis_attributes": 600, tinycolor2: 312 }], 602: [function(e, t, r) {
      "use strict";
      var n = e("../../../lib/str2rgbarray"), a = e("../../../lib"), o = ["xaxis", "yaxis", "zaxis"];
      function s() {
        this.bounds = [[-10, -10, -10], [10, 10, 10]], this.ticks = [[], [], []], this.tickEnable = [true, true, true], this.tickFont = ["sans-serif", "sans-serif", "sans-serif"], this.tickSize = [12, 12, 12], this.tickAngle = [0, 0, 0], this.tickColor = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]], this.tickPad = [18, 18, 18], this.labels = ["x", "y", "z"], this.labelEnable = [true, true, true], this.labelFont = ["Open Sans", "Open Sans", "Open Sans"], this.labelSize = [20, 20, 20], this.labelColor = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]], this.labelPad = [30, 30, 30], this.lineEnable = [true, true, true], this.lineMirror = [false, false, false], this.lineWidth = [1, 1, 1], this.lineColor = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]], this.lineTickEnable = [true, true, true], this.lineTickMirror = [false, false, false], this.lineTickLength = [10, 10, 10], this.lineTickWidth = [1, 1, 1], this.lineTickColor = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]], this.gridEnable = [true, true, true], this.gridWidth = [1, 1, 1], this.gridColor = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]], this.zeroEnable = [true, true, true], this.zeroLineColor = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]], this.zeroLineWidth = [2, 2, 2], this.backgroundEnable = [true, true, true], this.backgroundColor = [[0.8, 0.8, 0.8, 0.5], [0.8, 0.8, 0.8, 0.5], [0.8, 0.8, 0.8, 0.5]], this._defaultTickPad = this.tickPad.slice(), this._defaultLabelPad = this.labelPad.slice(), this._defaultLineTickLength = this.lineTickLength.slice();
      }
      s.prototype.merge = function(i, l) {
        for (var u2 = 0; u2 < 3; ++u2) {
          var c = l[o[u2]];
          c.visible ? (this.labels[u2] = i._meta ? a.templateString(c.title.text, i._meta) : c.title.text, "font" in c.title && (c.title.font.color && (this.labelColor[u2] = n(c.title.font.color)), c.title.font.family && (this.labelFont[u2] = c.title.font.family), c.title.font.size && (this.labelSize[u2] = c.title.font.size)), "showline" in c && (this.lineEnable[u2] = c.showline), "linecolor" in c && (this.lineColor[u2] = n(c.linecolor)), "linewidth" in c && (this.lineWidth[u2] = c.linewidth), "showgrid" in c && (this.gridEnable[u2] = c.showgrid), "gridcolor" in c && (this.gridColor[u2] = n(c.gridcolor)), "gridwidth" in c && (this.gridWidth[u2] = c.gridwidth), c.type === "log" ? this.zeroEnable[u2] = false : "zeroline" in c && (this.zeroEnable[u2] = c.zeroline), "zerolinecolor" in c && (this.zeroLineColor[u2] = n(c.zerolinecolor)), "zerolinewidth" in c && (this.zeroLineWidth[u2] = c.zerolinewidth), "ticks" in c && c.ticks ? this.lineTickEnable[u2] = true : this.lineTickEnable[u2] = false, "ticklen" in c && (this.lineTickLength[u2] = this._defaultLineTickLength[u2] = c.ticklen), "tickcolor" in c && (this.lineTickColor[u2] = n(c.tickcolor)), "tickwidth" in c && (this.lineTickWidth[u2] = c.tickwidth), "tickangle" in c && (this.tickAngle[u2] = c.tickangle === "auto" ? -3600 : Math.PI * -c.tickangle / 180), "showticklabels" in c && (this.tickEnable[u2] = c.showticklabels), "tickfont" in c && (c.tickfont.color && (this.tickColor[u2] = n(c.tickfont.color)), c.tickfont.family && (this.tickFont[u2] = c.tickfont.family), c.tickfont.size && (this.tickSize[u2] = c.tickfont.size)), "mirror" in c ? ["ticks", "all", "allticks"].indexOf(c.mirror) !== -1 ? (this.lineTickMirror[u2] = true, this.lineMirror[u2] = true) : c.mirror === true ? (this.lineTickMirror[u2] = false, this.lineMirror[u2] = true) : (this.lineTickMirror[u2] = false, this.lineMirror[u2] = false) : this.lineMirror[u2] = false, "showbackground" in c && c.showbackground !== false ? (this.backgroundEnable[u2] = true, this.backgroundColor[u2] = n(c.backgroundcolor)) : this.backgroundEnable[u2] = false) : (this.tickEnable[u2] = false, this.labelEnable[u2] = false, this.lineEnable[u2] = false, this.lineTickEnable[u2] = false, this.gridEnable[u2] = false, this.zeroEnable[u2] = false, this.backgroundEnable[u2] = false);
        }
      }, t.exports = function(i, l) {
        var u2 = new s();
        return u2.merge(i, l), u2;
      };
    }, { "../../../lib": 503, "../../../lib/str2rgbarray": 528 }], 603: [function(e, t, r) {
      "use strict";
      var n = e("../../../lib"), a = e("../../../components/color"), o = e("../../../registry"), s = e("../../subplot_defaults"), i = e("./axis_defaults"), l = e("./layout_attributes"), u2 = e("../../get_data").getSubplotData;
      function c(f, h, p, d) {
        for (var v = p("bgcolor"), m = a.combine(v, d.paper_bgcolor), g = ["up", "center", "eye"], x = 0; x < g.length; x++) p("camera." + g[x] + ".x"), p("camera." + g[x] + ".y"), p("camera." + g[x] + ".z");
        p("camera.projection.type");
        var b = !!p("aspectratio.x") && !!p("aspectratio.y") && !!p("aspectratio.z"), y = p("aspectmode", b ? "manual" : "auto");
        b || (f.aspectratio = h.aspectratio = { x: 1, y: 1, z: 1 }, y === "manual" && (h.aspectmode = "auto"), f.aspectmode = h.aspectmode);
        var w = u2(d.fullData, "gl3d", d.id);
        i(f, h, { font: d.font, scene: d.id, data: w, bgColor: m, calendar: d.calendar, autotypenumbersDflt: d.autotypenumbersDflt, fullLayout: d.fullLayout }), o.getComponentMethod("annotations3d", "handleDefaults")(f, h, d);
        var _4 = d.getDfltFromLayout("dragmode");
        if (_4 !== false && !_4) if (_4 = "orbit", f.camera && f.camera.up) {
          var k = f.camera.up.x, T2 = f.camera.up.y, A2 = f.camera.up.z;
          A2 !== 0 && (k && T2 && A2 ? A2 / Math.sqrt(k * k + T2 * T2 + A2 * A2) > 0.999 && (_4 = "turntable") : _4 = "turntable");
        } else _4 = "turntable";
        p("dragmode", _4), p("hovermode", d.getDfltFromLayout("hovermode"));
      }
      t.exports = function(f, h, p) {
        var d = h._basePlotModules.length > 1;
        s(f, h, p, { type: "gl3d", attributes: l, handleDefaults: c, fullLayout: h, font: h.font, fullData: p, getDfltFromLayout: function(v) {
          if (!d) return n.validate(f[v], l[v]) ? f[v] : void 0;
        }, autotypenumbersDflt: h.autotypenumbers, paper_bgcolor: h.paper_bgcolor, calendar: h.calendar });
      };
    }, { "../../../components/color": 366, "../../../lib": 503, "../../../registry": 638, "../../get_data": 593, "../../subplot_defaults": 632, "./axis_defaults": 601, "./layout_attributes": 604 }], 604: [function(e, t, r) {
      "use strict";
      var n = e("./axis_attributes"), a = e("../../domain").attributes, o = e("../../../lib/extend").extendFlat, s = e("../../../lib").counterRegex;
      function i(l, u2, c) {
        return { x: { valType: "number", dflt: l, editType: "camera" }, y: { valType: "number", dflt: u2, editType: "camera" }, z: { valType: "number", dflt: c, editType: "camera" }, editType: "camera" };
      }
      t.exports = { _arrayAttrRegexps: [s("scene", ".annotations", true)], bgcolor: { valType: "color", dflt: "rgba(0,0,0,0)", editType: "plot" }, camera: { up: o(i(0, 0, 1), {}), center: o(i(0, 0, 0), {}), eye: o(i(1.25, 1.25, 1.25), {}), projection: { type: { valType: "enumerated", values: ["perspective", "orthographic"], dflt: "perspective", editType: "calc" }, editType: "calc" }, editType: "camera" }, domain: a({ name: "scene", editType: "plot" }), aspectmode: { valType: "enumerated", values: ["auto", "cube", "data", "manual"], dflt: "auto", editType: "plot", impliedEdits: { "aspectratio.x": void 0, "aspectratio.y": void 0, "aspectratio.z": void 0 } }, aspectratio: { x: { valType: "number", min: 0, editType: "plot", impliedEdits: { "^aspectmode": "manual" } }, y: { valType: "number", min: 0, editType: "plot", impliedEdits: { "^aspectmode": "manual" } }, z: { valType: "number", min: 0, editType: "plot", impliedEdits: { "^aspectmode": "manual" } }, editType: "plot", impliedEdits: { aspectmode: "manual" } }, xaxis: n, yaxis: n, zaxis: n, dragmode: { valType: "enumerated", values: ["orbit", "turntable", "zoom", "pan", false], editType: "plot" }, hovermode: { valType: "enumerated", values: ["closest", false], dflt: "closest", editType: "modebar" }, uirevision: { valType: "any", editType: "none" }, editType: "plot", _deprecated: { cameraposition: { valType: "info_array", editType: "camera" } } };
    }, { "../../../lib": 503, "../../../lib/extend": 493, "../../domain": 584, "./axis_attributes": 600 }], 605: [function(e, t, r) {
      "use strict";
      var n = e("../../../lib/str2rgbarray"), a = ["xaxis", "yaxis", "zaxis"];
      function o() {
        this.enabled = [true, true, true], this.colors = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]], this.drawSides = [true, true, true], this.lineWidth = [1, 1, 1];
      }
      o.prototype.merge = function(s) {
        for (var i = 0; i < 3; ++i) {
          var l = s[a[i]];
          l.visible ? (this.enabled[i] = l.showspikes, this.colors[i] = n(l.spikecolor), this.drawSides[i] = l.spikesides, this.lineWidth[i] = l.spikethickness) : (this.enabled[i] = false, this.drawSides[i] = false);
        }
      }, t.exports = function(s) {
        var i = new o();
        return i.merge(s), i;
      };
    }, { "../../../lib/str2rgbarray": 528 }], 606: [function(e, t, r) {
      "use strict";
      t.exports = function(i) {
        for (var l = i.axesOptions, u2 = i.glplot.axesPixels, c = i.fullSceneLayout, f = [[], [], []], h = 0; h < 3; ++h) {
          var p = c[o[h]];
          if (p._length = (u2[h].hi - u2[h].lo) * u2[h].pixelsPerDataUnit / i.dataScale[h], Math.abs(p._length) === 1 / 0 || isNaN(p._length)) f[h] = [];
          else {
            p._input_range = p.range.slice(), p.range[0] = u2[h].lo / i.dataScale[h], p.range[1] = u2[h].hi / i.dataScale[h], p._m = 1 / (i.dataScale[h] * u2[h].pixelsPerDataUnit), p.range[0] === p.range[1] && (p.range[0] -= 1, p.range[1] += 1);
            var d = p.tickmode;
            if (p.tickmode === "auto") {
              p.tickmode = "linear";
              var v = p.nticks || a.constrain(p._length / 40, 4, 9);
              n.autoTicks(p, Math.abs(p.range[1] - p.range[0]) / v);
            }
            for (var m = n.calcTicks(p, { msUTC: true }), g = 0; g < m.length; ++g) m[g].x = m[g].x * i.dataScale[h], p.type === "date" && (m[g].text = m[g].text.replace(/\<br\>/g, " "));
            f[h] = m, p.tickmode = d;
          }
        }
        for (l.ticks = f, h = 0; h < 3; ++h) for (s[h] = 0.5 * (i.glplot.bounds[0][h] + i.glplot.bounds[1][h]), g = 0; g < 2; ++g) l.bounds[g][h] = i.glplot.bounds[g][h];
        i.contourLevels = function(x) {
          for (var b = new Array(3), y = 0; y < 3; ++y) {
            for (var w = x[y], _4 = new Array(w.length), k = 0; k < w.length; ++k) _4[k] = w[k].x;
            b[y] = _4;
          }
          return b;
        }(f);
      };
      var n = e("../../cartesian/axes"), a = e("../../../lib"), o = ["xaxis", "yaxis", "zaxis"], s = [0, 0, 0];
    }, { "../../../lib": 503, "../../cartesian/axes": 554 }], 607: [function(e, t, r) {
      "use strict";
      function n(a, o) {
        var s, i, l = [0, 0, 0, 0];
        for (s = 0; s < 4; ++s) for (i = 0; i < 4; ++i) l[i] += a[4 * s + i] * o[s];
        return l;
      }
      t.exports = function(a, o) {
        return n(a.projection, n(a.view, n(a.model, [o[0], o[1], o[2], 1])));
      };
    }, {}], 608: [function(e, t, r) {
      "use strict";
      var n, a, o = e("../../../stackgl_modules").gl_plot3d, s = o.createCamera, i = o.createScene, l = e("webgl-context"), u2 = e("has-passive-events"), c = e("../../registry"), f = e("../../lib"), h = f.preserveDrawingBuffer(), p = e("../../plots/cartesian/axes"), d = e("../../components/fx"), v = e("../../lib/str2rgbarray"), m = e("../../lib/show_no_webgl_msg"), g = e("./project"), x = e("./layout/convert"), b = e("./layout/spikes"), y = e("./layout/tick_marks");
      function w(S2, C2) {
        var E2 = document.createElement("div"), F13 = S2.container;
        this.graphDiv = S2.graphDiv;
        var N2 = document.createElementNS("http://www.w3.org/2000/svg", "svg");
        N2.style.position = "absolute", N2.style.top = N2.style.left = "0px", N2.style.width = N2.style.height = "100%", N2.style["z-index"] = 20, N2.style["pointer-events"] = "none", E2.appendChild(N2), this.svgContainer = N2, E2.id = S2.id, E2.style.position = "absolute", E2.style.top = E2.style.left = "0px", E2.style.width = E2.style.height = "100%", F13.appendChild(E2), this.fullLayout = C2, this.id = S2.id || "scene", this.fullSceneLayout = C2[this.id], this.plotArgs = [[], {}, {}], this.axesOptions = x(C2, C2[this.id]), this.spikeOptions = b(C2[this.id]), this.container = E2, this.staticMode = !!S2.staticPlot, this.pixelRatio = this.pixelRatio || S2.plotGlPixelRatio || 2, this.dataScale = [1, 1, 1], this.contourLevels = [[], [], []], this.convertAnnotations = c.getComponentMethod("annotations3d", "convert"), this.drawAnnotations = c.getComponentMethod("annotations3d", "draw"), this.initializeGLPlot();
      }
      var _4 = w.prototype;
      _4.prepareOptions = function() {
        var S2 = { canvas: this.canvas, gl: this.gl, glOptions: { preserveDrawingBuffer: h, premultipliedAlpha: true, antialias: true }, container: this.container, axes: this.axesOptions, spikes: this.spikeOptions, pickRadius: 10, snapToData: true, autoScale: true, autoBounds: false, cameraObject: this.camera, pixelRatio: this.pixelRatio };
        if (this.staticMode) {
          if (!(a || (n = document.createElement("canvas"), a = l({ canvas: n, preserveDrawingBuffer: true, premultipliedAlpha: true, antialias: true })))) throw new Error("error creating static canvas/context for image server");
          S2.gl = a, S2.canvas = n;
        }
        return S2;
      };
      var k = true;
      _4.tryCreatePlot = function() {
        var S2 = this.prepareOptions(), C2 = true;
        try {
          this.glplot = i(S2);
        } catch {
          if (this.staticMode || !k || h) C2 = false;
          else {
            f.warn(["webgl setup failed possibly due to", "false preserveDrawingBuffer config.", "The mobile/tablet device may not be detected by is-mobile module.", "Enabling preserveDrawingBuffer in second attempt to create webgl scene..."].join(" "));
            try {
              h = S2.glOptions.preserveDrawingBuffer = true, this.glplot = i(S2);
            } catch {
              h = S2.glOptions.preserveDrawingBuffer = false, C2 = false;
            }
          }
        }
        return k = false, C2;
      }, _4.initializeGLCamera = function() {
        var S2 = this.fullSceneLayout.camera, C2 = S2.projection.type === "orthographic";
        this.camera = s(this.container, { center: [S2.center.x, S2.center.y, S2.center.z], eye: [S2.eye.x, S2.eye.y, S2.eye.z], up: [S2.up.x, S2.up.y, S2.up.z], _ortho: C2, zoomMin: 0.01, zoomMax: 100, mode: "orbit" });
      }, _4.initializeGLPlot = function() {
        var S2 = this;
        if (S2.initializeGLCamera(), !S2.tryCreatePlot()) return m(S2);
        S2.traces = {}, S2.make4thDimension();
        var C2 = S2.graphDiv, E2 = C2.layout, F13 = function() {
          var D2 = {};
          return S2.isCameraChanged(E2) && (D2[S2.id + ".camera"] = S2.getCamera()), S2.isAspectChanged(E2) && (D2[S2.id + ".aspectratio"] = S2.glplot.getAspectratio(), E2[S2.id].aspectmode !== "manual" && (S2.fullSceneLayout.aspectmode = E2[S2.id].aspectmode = D2[S2.id + ".aspectmode"] = "manual")), D2;
        }, N2 = function(D2) {
          if (D2.fullSceneLayout.dragmode !== false) {
            var I2 = F13();
            D2.saveLayout(E2), D2.graphDiv.emit("plotly_relayout", I2);
          }
        };
        return S2.glplot.canvas && (S2.glplot.canvas.addEventListener("mouseup", function() {
          N2(S2);
        }), S2.glplot.canvas.addEventListener("wheel", function(D2) {
          if (C2._context._scrollZoom.gl3d) {
            if (S2.camera._ortho) {
              var I2 = D2.deltaX > D2.deltaY ? 1.1 : 0.9090909090909091, O2 = S2.glplot.getAspectratio();
              S2.glplot.setAspectratio({ x: I2 * O2.x, y: I2 * O2.y, z: I2 * O2.z });
            }
            N2(S2);
          }
        }, !!u2 && { passive: false }), S2.glplot.canvas.addEventListener("mousemove", function() {
          if (S2.fullSceneLayout.dragmode !== false && S2.camera.mouseListener.buttons !== 0) {
            var D2 = F13();
            S2.graphDiv.emit("plotly_relayouting", D2);
          }
        }), S2.staticMode || S2.glplot.canvas.addEventListener("webglcontextlost", function(D2) {
          C2 && C2.emit && C2.emit("plotly_webglcontextlost", { event: D2, layer: S2.id });
        }, false)), S2.glplot.oncontextloss = function() {
          S2.recoverContext();
        }, S2.glplot.onrender = function() {
          S2.render();
        }, true;
      }, _4.render = function() {
        var S2, C2 = this, E2 = C2.graphDiv, F13 = C2.svgContainer, N2 = C2.container.getBoundingClientRect();
        E2._fullLayout._calcInverseTransform(E2);
        var D2 = E2._fullLayout._invScaleX, I2 = E2._fullLayout._invScaleY, O2 = N2.width * D2, L2 = N2.height * I2;
        F13.setAttributeNS(null, "viewBox", "0 0 " + O2 + " " + L2), F13.setAttributeNS(null, "width", O2), F13.setAttributeNS(null, "height", L2), y(C2), C2.glplot.axes.update(C2.axesOptions);
        for (var V2 = Object.keys(C2.traces), W2 = null, X2 = C2.glplot.selection, Y2 = 0; Y2 < V2.length; ++Y2) (S2 = C2.traces[V2[Y2]]).data.hoverinfo !== "skip" && S2.handlePick(X2) && (W2 = S2), S2.setContourLevels && S2.setContourLevels();
        function K2(le, ce, se) {
          var he = C2.fullSceneLayout[le + "axis"];
          return he.type !== "log" && (ce = he.d2l(ce)), p.hoverLabelText(he, ce, se);
        }
        if (W2 !== null) {
          var q = g(C2.glplot.cameraParams, X2.dataCoordinate);
          S2 = W2.data;
          var re, R2 = E2._fullData[S2.index], z = X2.index, H2 = { xLabel: K2("x", X2.traceCoordinate[0], S2.xhoverformat), yLabel: K2("y", X2.traceCoordinate[1], S2.yhoverformat), zLabel: K2("z", X2.traceCoordinate[2], S2.zhoverformat) }, te = d.castHoverinfo(R2, C2.fullLayout, z), j = (te || "").split("+"), Q2 = te && te === "all";
          R2.hovertemplate || Q2 || (j.indexOf("x") === -1 && (H2.xLabel = void 0), j.indexOf("y") === -1 && (H2.yLabel = void 0), j.indexOf("z") === -1 && (H2.zLabel = void 0), j.indexOf("text") === -1 && (X2.textLabel = void 0), j.indexOf("name") === -1 && (W2.name = void 0));
          var Z2 = [];
          S2.type === "cone" || S2.type === "streamtube" ? (H2.uLabel = K2("x", X2.traceCoordinate[3], S2.uhoverformat), (Q2 || j.indexOf("u") !== -1) && Z2.push("u: " + H2.uLabel), H2.vLabel = K2("y", X2.traceCoordinate[4], S2.vhoverformat), (Q2 || j.indexOf("v") !== -1) && Z2.push("v: " + H2.vLabel), H2.wLabel = K2("z", X2.traceCoordinate[5], S2.whoverformat), (Q2 || j.indexOf("w") !== -1) && Z2.push("w: " + H2.wLabel), H2.normLabel = X2.traceCoordinate[6].toPrecision(3), (Q2 || j.indexOf("norm") !== -1) && Z2.push("norm: " + H2.normLabel), S2.type === "streamtube" && (H2.divergenceLabel = X2.traceCoordinate[7].toPrecision(3), (Q2 || j.indexOf("divergence") !== -1) && Z2.push("divergence: " + H2.divergenceLabel)), X2.textLabel && Z2.push(X2.textLabel), re = Z2.join("<br>")) : S2.type === "isosurface" || S2.type === "volume" ? (H2.valueLabel = p.hoverLabelText(C2._mockAxis, C2._mockAxis.d2l(X2.traceCoordinate[3]), S2.valuehoverformat), Z2.push("value: " + H2.valueLabel), X2.textLabel && Z2.push(X2.textLabel), re = Z2.join("<br>")) : re = X2.textLabel;
          var ne = { x: X2.traceCoordinate[0], y: X2.traceCoordinate[1], z: X2.traceCoordinate[2], data: R2._input, fullData: R2, curveNumber: R2.index, pointNumber: z };
          d.appendArrayPointValue(ne, R2, z), S2._module.eventData && (ne = R2._module.eventData(ne, X2, R2, {}, z));
          var ae = { points: [ne] };
          if (C2.fullSceneLayout.hovermode) {
            var ue = [];
            d.loneHover({ trace: R2, x: (0.5 + 0.5 * q[0] / q[3]) * O2, y: (0.5 - 0.5 * q[1] / q[3]) * L2, xLabel: H2.xLabel, yLabel: H2.yLabel, zLabel: H2.zLabel, text: re, name: W2.name, color: d.castHoverOption(R2, z, "bgcolor") || W2.color, borderColor: d.castHoverOption(R2, z, "bordercolor"), fontFamily: d.castHoverOption(R2, z, "font.family"), fontSize: d.castHoverOption(R2, z, "font.size"), fontColor: d.castHoverOption(R2, z, "font.color"), nameLength: d.castHoverOption(R2, z, "namelength"), textAlign: d.castHoverOption(R2, z, "align"), hovertemplate: f.castOption(R2, z, "hovertemplate"), hovertemplateLabels: f.extendFlat({}, ne, H2), eventData: [ne] }, { container: F13, gd: E2, inOut_bbox: ue }), ne.bbox = ue[0];
          }
          X2.buttons && X2.distance < 5 ? E2.emit("plotly_click", ae) : E2.emit("plotly_hover", ae), this.oldEventData = ae;
        } else d.loneUnhover(F13), this.oldEventData && E2.emit("plotly_unhover", this.oldEventData), this.oldEventData = void 0;
        C2.drawAnnotations(C2);
      }, _4.recoverContext = function() {
        var S2 = this;
        S2.glplot.dispose();
        var C2 = function() {
          S2.glplot.gl.isContextLost() ? requestAnimationFrame(C2) : S2.initializeGLPlot() ? S2.plot.apply(S2, S2.plotArgs) : f.error("Catastrophic and unrecoverable WebGL error. Context lost.");
        };
        requestAnimationFrame(C2);
      };
      var T2 = ["xaxis", "yaxis", "zaxis"];
      function A2(S2, C2, E2) {
        for (var F13 = S2.fullSceneLayout, N2 = 0; N2 < 3; N2++) {
          var D2 = T2[N2], I2 = D2.charAt(0), O2 = F13[D2], L2 = C2[I2], V2 = C2[I2 + "calendar"], W2 = C2["_" + I2 + "length"];
          if (f.isArrayOrTypedArray(L2)) for (var X2, Y2 = 0; Y2 < (W2 || L2.length); Y2++) if (f.isArrayOrTypedArray(L2[Y2])) for (var K2 = 0; K2 < L2[Y2].length; ++K2) X2 = O2.d2l(L2[Y2][K2], 0, V2), !isNaN(X2) && isFinite(X2) && (E2[0][N2] = Math.min(E2[0][N2], X2), E2[1][N2] = Math.max(E2[1][N2], X2));
          else X2 = O2.d2l(L2[Y2], 0, V2), !isNaN(X2) && isFinite(X2) && (E2[0][N2] = Math.min(E2[0][N2], X2), E2[1][N2] = Math.max(E2[1][N2], X2));
          else E2[0][N2] = Math.min(E2[0][N2], 0), E2[1][N2] = Math.max(E2[1][N2], W2 - 1);
        }
      }
      _4.plot = function(S2, C2, E2) {
        if (this.plotArgs = [S2, C2, E2], !this.glplot.contextLost) {
          var F13, N2, D2, I2, O2, L2, V2 = C2[this.id], W2 = E2[this.id];
          this.fullLayout = C2, this.fullSceneLayout = V2, this.axesOptions.merge(C2, V2), this.spikeOptions.merge(V2), this.setViewport(V2), this.updateFx(V2.dragmode, V2.hovermode), this.camera.enableWheel = this.graphDiv._context._scrollZoom.gl3d, this.glplot.setClearColor(v(V2.bgcolor)), this.setConvert(O2), S2 ? Array.isArray(S2) || (S2 = [S2]) : S2 = [];
          var X2 = [[1 / 0, 1 / 0, 1 / 0], [-1 / 0, -1 / 0, -1 / 0]];
          for (D2 = 0; D2 < S2.length; ++D2) (F13 = S2[D2]).visible === true && F13._length !== 0 && A2(this, F13, X2);
          (function(Ee, Se) {
            for (var Ce = Ee.fullSceneLayout, Be = Ce.annotations || [], Ue = 0; Ue < 3; Ue++) for (var Ke = T2[Ue], ct = Ke.charAt(0), We = Ce[Ke], Ze = 0; Ze < Be.length; Ze++) {
              var it = Be[Ze];
              if (it.visible) {
                var ot = We.r2l(it[ct]);
                !isNaN(ot) && isFinite(ot) && (Se[0][Ue] = Math.min(Se[0][Ue], ot), Se[1][Ue] = Math.max(Se[1][Ue], ot));
              }
            }
          })(this, X2);
          var Y2 = [1, 1, 1];
          for (I2 = 0; I2 < 3; ++I2) X2[1][I2] === X2[0][I2] ? Y2[I2] = 1 : Y2[I2] = 1 / (X2[1][I2] - X2[0][I2]);
          for (this.dataScale = Y2, this.convertAnnotations(this), D2 = 0; D2 < S2.length; ++D2) (F13 = S2[D2]).visible === true && F13._length !== 0 && ((N2 = this.traces[F13.uid]) ? N2.data.type === F13.type ? N2.update(F13) : (N2.dispose(), N2 = F13._module.plot(this, F13), this.traces[F13.uid] = N2) : (N2 = F13._module.plot(this, F13), this.traces[F13.uid] = N2), N2.name = F13.name);
          var K2 = Object.keys(this.traces);
          e: for (D2 = 0; D2 < K2.length; ++D2) {
            for (I2 = 0; I2 < S2.length; ++I2) if (S2[I2].uid === K2[D2] && S2[I2].visible === true && S2[I2]._length !== 0) continue e;
            (N2 = this.traces[K2[D2]]).dispose(), delete this.traces[K2[D2]];
          }
          this.glplot.objects.sort(function(Ee, Se) {
            return Ee._trace.data.index - Se._trace.data.index;
          });
          var q, re = [[0, 0, 0], [0, 0, 0]], R2 = [], z = {};
          for (D2 = 0; D2 < 3; ++D2) {
            if ((L2 = (O2 = V2[T2[D2]]).type) in z ? (z[L2].acc *= Y2[D2], z[L2].count += 1) : z[L2] = { acc: Y2[D2], count: 1 }, O2.autorange) {
              re[0][D2] = 1 / 0, re[1][D2] = -1 / 0;
              var H2 = this.glplot.objects, te = this.fullSceneLayout.annotations || [], j = O2._name.charAt(0);
              for (I2 = 0; I2 < H2.length; I2++) {
                var Q2 = H2[I2], Z2 = Q2.bounds, ne = Q2._trace.data._pad || 0;
                Q2.constructor.name === "ErrorBars" && O2._lowerLogErrorBound ? re[0][D2] = Math.min(re[0][D2], O2._lowerLogErrorBound) : re[0][D2] = Math.min(re[0][D2], Z2[0][D2] / Y2[D2] - ne), re[1][D2] = Math.max(re[1][D2], Z2[1][D2] / Y2[D2] + ne);
              }
              for (I2 = 0; I2 < te.length; I2++) {
                var ae = te[I2];
                if (ae.visible) {
                  var ue = O2.r2l(ae[j]);
                  re[0][D2] = Math.min(re[0][D2], ue), re[1][D2] = Math.max(re[1][D2], ue);
                }
              }
              if ("rangemode" in O2 && O2.rangemode === "tozero" && (re[0][D2] = Math.min(re[0][D2], 0), re[1][D2] = Math.max(re[1][D2], 0)), re[0][D2] > re[1][D2]) re[0][D2] = -1, re[1][D2] = 1;
              else {
                var le = re[1][D2] - re[0][D2];
                re[0][D2] -= le / 32, re[1][D2] += le / 32;
              }
              if (O2.autorange === "reversed") {
                var ce = re[0][D2];
                re[0][D2] = re[1][D2], re[1][D2] = ce;
              }
            } else {
              var se = O2.range;
              re[0][D2] = O2.r2l(se[0]), re[1][D2] = O2.r2l(se[1]);
            }
            re[0][D2] === re[1][D2] && (re[0][D2] -= 1, re[1][D2] += 1), R2[D2] = re[1][D2] - re[0][D2], this.glplot.setBounds(D2, { min: re[0][D2] * Y2[D2], max: re[1][D2] * Y2[D2] });
          }
          var he = V2.aspectmode;
          if (he === "cube") q = [1, 1, 1];
          else if (he === "manual") {
            var me = V2.aspectratio;
            q = [me.x, me.y, me.z];
          } else {
            if (he !== "auto" && he !== "data") throw new Error("scene.js aspectRatio was not one of the enumerated types");
            var we = [1, 1, 1];
            for (D2 = 0; D2 < 3; ++D2) {
              var be = z[L2 = (O2 = V2[T2[D2]]).type];
              we[D2] = Math.pow(be.acc, 1 / be.count) / Y2[D2];
            }
            q = he === "data" || Math.max.apply(null, we) / Math.min.apply(null, we) <= 4 ? we : [1, 1, 1];
          }
          V2.aspectratio.x = W2.aspectratio.x = q[0], V2.aspectratio.y = W2.aspectratio.y = q[1], V2.aspectratio.z = W2.aspectratio.z = q[2], this.glplot.setAspectratio(V2.aspectratio), this.viewInitial.aspectratio || (this.viewInitial.aspectratio = { x: V2.aspectratio.x, y: V2.aspectratio.y, z: V2.aspectratio.z }), this.viewInitial.aspectmode || (this.viewInitial.aspectmode = V2.aspectmode);
          var Ae = V2.domain || null, pe = C2._size || null;
          if (Ae && pe) {
            var ve = this.container.style;
            ve.position = "absolute", ve.left = pe.l + Ae.x[0] * pe.w + "px", ve.top = pe.t + (1 - Ae.y[1]) * pe.h + "px", ve.width = pe.w * (Ae.x[1] - Ae.x[0]) + "px", ve.height = pe.h * (Ae.y[1] - Ae.y[0]) + "px";
          }
          this.glplot.redraw();
        }
      }, _4.destroy = function() {
        this.glplot && (this.camera.mouseListener.enabled = false, this.container.removeEventListener("wheel", this.camera.wheelListener), this.camera = null, this.glplot.dispose(), this.container.parentNode.removeChild(this.container), this.glplot = null);
      }, _4.getCamera = function() {
        var S2;
        return this.camera.view.recalcMatrix(this.camera.view.lastT()), { up: { x: (S2 = this.camera).up[0], y: S2.up[1], z: S2.up[2] }, center: { x: S2.center[0], y: S2.center[1], z: S2.center[2] }, eye: { x: S2.eye[0], y: S2.eye[1], z: S2.eye[2] }, projection: { type: S2._ortho === true ? "orthographic" : "perspective" } };
      }, _4.setViewport = function(S2) {
        var C2, E2 = S2.camera;
        this.camera.lookAt.apply(this, [[(C2 = E2).eye.x, C2.eye.y, C2.eye.z], [C2.center.x, C2.center.y, C2.center.z], [C2.up.x, C2.up.y, C2.up.z]]), this.glplot.setAspectratio(S2.aspectratio), E2.projection.type === "orthographic" !== this.camera._ortho && (this.glplot.redraw(), this.glplot.clearRGBA(), this.glplot.dispose(), this.initializeGLPlot());
      }, _4.isCameraChanged = function(S2) {
        var C2 = this.getCamera(), E2 = f.nestedProperty(S2, this.id + ".camera").get();
        function F13(O2, L2, V2, W2) {
          var X2 = ["up", "center", "eye"], Y2 = ["x", "y", "z"];
          return L2[X2[V2]] && O2[X2[V2]][Y2[W2]] === L2[X2[V2]][Y2[W2]];
        }
        var N2 = false;
        if (E2 === void 0) N2 = true;
        else {
          for (var D2 = 0; D2 < 3; D2++) for (var I2 = 0; I2 < 3; I2++) if (!F13(C2, E2, D2, I2)) {
            N2 = true;
            break;
          }
          (!E2.projection || C2.projection && C2.projection.type !== E2.projection.type) && (N2 = true);
        }
        return N2;
      }, _4.isAspectChanged = function(S2) {
        var C2 = this.glplot.getAspectratio(), E2 = f.nestedProperty(S2, this.id + ".aspectratio").get();
        return E2 === void 0 || E2.x !== C2.x || E2.y !== C2.y || E2.z !== C2.z;
      }, _4.saveLayout = function(S2) {
        var C2, E2, F13, N2, D2, I2, O2 = this.fullLayout, L2 = this.isCameraChanged(S2), V2 = this.isAspectChanged(S2), W2 = L2 || V2;
        if (W2) {
          var X2 = {};
          L2 && (C2 = this.getCamera(), F13 = (E2 = f.nestedProperty(S2, this.id + ".camera")).get(), X2[this.id + ".camera"] = F13), V2 && (N2 = this.glplot.getAspectratio(), I2 = (D2 = f.nestedProperty(S2, this.id + ".aspectratio")).get(), X2[this.id + ".aspectratio"] = I2), c.call("_storeDirectGUIEdit", S2, O2._preGUI, X2), L2 && (E2.set(C2), f.nestedProperty(O2, this.id + ".camera").set(C2)), V2 && (D2.set(N2), f.nestedProperty(O2, this.id + ".aspectratio").set(N2), this.glplot.redraw());
        }
        return W2;
      }, _4.updateFx = function(S2, C2) {
        var E2 = this.camera;
        if (E2) if (S2 === "orbit") E2.mode = "orbit", E2.keyBindingMode = "rotate";
        else if (S2 === "turntable") {
          E2.up = [0, 0, 1], E2.mode = "turntable", E2.keyBindingMode = "rotate";
          var F13 = this.graphDiv, N2 = F13._fullLayout, D2 = this.fullSceneLayout.camera, I2 = D2.up.x, O2 = D2.up.y, L2 = D2.up.z;
          if (L2 / Math.sqrt(I2 * I2 + O2 * O2 + L2 * L2) < 0.999) {
            var V2 = this.id + ".camera.up", W2 = { x: 0, y: 0, z: 1 }, X2 = {};
            X2[V2] = W2;
            var Y2 = F13.layout;
            c.call("_storeDirectGUIEdit", Y2, N2._preGUI, X2), D2.up = W2, f.nestedProperty(Y2, V2).set(W2);
          }
        } else E2.keyBindingMode = S2;
        this.fullSceneLayout.hovermode = C2;
      }, _4.toImage = function(S2) {
        S2 || (S2 = "png"), this.staticMode && this.container.appendChild(n), this.glplot.redraw();
        var C2 = this.glplot.gl, E2 = C2.drawingBufferWidth, F13 = C2.drawingBufferHeight;
        C2.bindFramebuffer(C2.FRAMEBUFFER, null);
        var N2 = new Uint8Array(E2 * F13 * 4);
        C2.readPixels(0, 0, E2, F13, C2.RGBA, C2.UNSIGNED_BYTE, N2), function(V2, W2, X2) {
          for (var Y2 = 0, K2 = X2 - 1; Y2 < K2; ++Y2, --K2) for (var q = 0; q < W2; ++q) for (var re = 0; re < 4; ++re) {
            var R2 = 4 * (W2 * Y2 + q) + re, z = 4 * (W2 * K2 + q) + re, H2 = V2[R2];
            V2[R2] = V2[z], V2[z] = H2;
          }
        }(N2, E2, F13), function(V2, W2, X2) {
          for (var Y2 = 0; Y2 < X2; ++Y2) for (var K2 = 0; K2 < W2; ++K2) {
            var q = 4 * (W2 * Y2 + K2), re = V2[q + 3];
            if (re > 0) for (var R2 = 255 / re, z = 0; z < 3; ++z) V2[q + z] = Math.min(R2 * V2[q + z], 255);
          }
        }(N2, E2, F13);
        var D2 = document.createElement("canvas");
        D2.width = E2, D2.height = F13;
        var I2, O2 = D2.getContext("2d"), L2 = O2.createImageData(E2, F13);
        switch (L2.data.set(N2), O2.putImageData(L2, 0, 0), S2) {
          case "jpeg":
            I2 = D2.toDataURL("image/jpeg");
            break;
          case "webp":
            I2 = D2.toDataURL("image/webp");
            break;
          default:
            I2 = D2.toDataURL("image/png");
        }
        return this.staticMode && this.container.removeChild(n), I2;
      }, _4.setConvert = function() {
        for (var S2 = 0; S2 < 3; S2++) {
          var C2 = this.fullSceneLayout[T2[S2]];
          p.setConvert(C2, this.fullLayout), C2.setScale = f.noop;
        }
      }, _4.make4thDimension = function() {
        var S2 = this.graphDiv._fullLayout;
        this._mockAxis = { type: "linear", showexponent: "all", exponentformat: "B" }, p.setConvert(this._mockAxis, S2);
      }, t.exports = w;
    }, { "../../../stackgl_modules": 1120, "../../components/fx": 406, "../../lib": 503, "../../lib/show_no_webgl_msg": 525, "../../lib/str2rgbarray": 528, "../../plots/cartesian/axes": 554, "../../registry": 638, "./layout/convert": 602, "./layout/spikes": 605, "./layout/tick_marks": 606, "./project": 607, "has-passive-events": 229, "webgl-context": 331 }], 609: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a, o, s) {
        s = s || n.length;
        for (var i = new Array(s), l = 0; l < s; l++) i[l] = [n[l], a[l], o[l]];
        return i;
      };
    }, {}], 610: [function(e, t, r) {
      "use strict";
      var n = e("./font_attributes"), a = e("./animation_attributes"), o = e("../components/color/attributes"), s = e("../components/shapes/draw_newshape/attributes"), i = e("./pad_attributes"), l = e("../lib/extend").extendFlat, u2 = n({ editType: "calc" });
      u2.family.dflt = '"Open Sans", verdana, arial, sans-serif', u2.size.dflt = 12, u2.color.dflt = o.defaultLine, t.exports = { font: u2, title: { text: { valType: "string", editType: "layoutstyle" }, font: n({ editType: "layoutstyle" }), xref: { valType: "enumerated", dflt: "container", values: ["container", "paper"], editType: "layoutstyle" }, yref: { valType: "enumerated", dflt: "container", values: ["container", "paper"], editType: "layoutstyle" }, x: { valType: "number", min: 0, max: 1, dflt: 0.5, editType: "layoutstyle" }, y: { valType: "number", min: 0, max: 1, dflt: "auto", editType: "layoutstyle" }, xanchor: { valType: "enumerated", dflt: "auto", values: ["auto", "left", "center", "right"], editType: "layoutstyle" }, yanchor: { valType: "enumerated", dflt: "auto", values: ["auto", "top", "middle", "bottom"], editType: "layoutstyle" }, pad: l(i({ editType: "layoutstyle" }), {}), editType: "layoutstyle" }, uniformtext: { mode: { valType: "enumerated", values: [false, "hide", "show"], dflt: false, editType: "plot" }, minsize: { valType: "number", min: 0, dflt: 0, editType: "plot" }, editType: "plot" }, autosize: { valType: "boolean", dflt: false, editType: "none" }, width: { valType: "number", min: 10, dflt: 700, editType: "plot" }, height: { valType: "number", min: 10, dflt: 450, editType: "plot" }, margin: { l: { valType: "number", min: 0, dflt: 80, editType: "plot" }, r: { valType: "number", min: 0, dflt: 80, editType: "plot" }, t: { valType: "number", min: 0, dflt: 100, editType: "plot" }, b: { valType: "number", min: 0, dflt: 80, editType: "plot" }, pad: { valType: "number", min: 0, dflt: 0, editType: "plot" }, autoexpand: { valType: "boolean", dflt: true, editType: "plot" }, editType: "plot" }, computed: { valType: "any", editType: "none" }, paper_bgcolor: { valType: "color", dflt: o.background, editType: "plot" }, plot_bgcolor: { valType: "color", dflt: o.background, editType: "layoutstyle" }, autotypenumbers: { valType: "enumerated", values: ["convert types", "strict"], dflt: "convert types", editType: "calc" }, separators: { valType: "string", editType: "plot" }, hidesources: { valType: "boolean", dflt: false, editType: "plot" }, showlegend: { valType: "boolean", editType: "legend" }, colorway: { valType: "colorlist", dflt: o.defaults, editType: "calc" }, datarevision: { valType: "any", editType: "calc" }, uirevision: { valType: "any", editType: "none" }, editrevision: { valType: "any", editType: "none" }, selectionrevision: { valType: "any", editType: "none" }, template: { valType: "any", editType: "calc" }, newshape: s.newshape, activeshape: s.activeshape, meta: { valType: "any", arrayOk: true, editType: "plot" }, transition: l({}, a.transition, { editType: "none" }), _deprecated: { title: { valType: "string", editType: "layoutstyle" }, titlefont: n({ editType: "layoutstyle" }) } };
    }, { "../components/color/attributes": 365, "../components/shapes/draw_newshape/attributes": 451, "../lib/extend": 493, "./animation_attributes": 548, "./font_attributes": 585, "./pad_attributes": 618 }], 611: [function(e, t, r) {
      "use strict";
      var n = e("../../lib/sort_object_keys"), a = '\xA9 <a target="_blank" href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors', o = ['\xA9 <a target="_blank" href="https://carto.com/">Carto</a>', a].join(" "), s = ['Map tiles by <a target="_blank" href="https://stamen.com">Stamen Design</a>', 'under <a target="_blank" href="https://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>', "|", 'Data by <a target="_blank" href="https://openstreetmap.org">OpenStreetMap</a> contributors', 'under <a target="_blank" href="https://www.openstreetmap.org/copyright">ODbL</a>'].join(" "), i = { "open-street-map": { id: "osm", version: 8, sources: { "plotly-osm-tiles": { type: "raster", attribution: a, tiles: ["https://a.tile.openstreetmap.org/{z}/{x}/{y}.png", "https://b.tile.openstreetmap.org/{z}/{x}/{y}.png"], tileSize: 256 } }, layers: [{ id: "plotly-osm-tiles", type: "raster", source: "plotly-osm-tiles", minzoom: 0, maxzoom: 22 }] }, "white-bg": { id: "white-bg", version: 8, sources: {}, layers: [{ id: "white-bg", type: "background", paint: { "background-color": "#FFFFFF" }, minzoom: 0, maxzoom: 22 }] }, "carto-positron": { id: "carto-positron", version: 8, sources: { "plotly-carto-positron": { type: "raster", attribution: o, tiles: ["https://cartodb-basemaps-c.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png"], tileSize: 256 } }, layers: [{ id: "plotly-carto-positron", type: "raster", source: "plotly-carto-positron", minzoom: 0, maxzoom: 22 }] }, "carto-darkmatter": { id: "carto-darkmatter", version: 8, sources: { "plotly-carto-darkmatter": { type: "raster", attribution: o, tiles: ["https://cartodb-basemaps-c.global.ssl.fastly.net/dark_all/{z}/{x}/{y}.png"], tileSize: 256 } }, layers: [{ id: "plotly-carto-darkmatter", type: "raster", source: "plotly-carto-darkmatter", minzoom: 0, maxzoom: 22 }] }, "stamen-terrain": { id: "stamen-terrain", version: 8, sources: { "plotly-stamen-terrain": { type: "raster", attribution: s, tiles: ["https://stamen-tiles.a.ssl.fastly.net/terrain/{z}/{x}/{y}.png"], tileSize: 256 } }, layers: [{ id: "plotly-stamen-terrain", type: "raster", source: "plotly-stamen-terrain", minzoom: 0, maxzoom: 22 }] }, "stamen-toner": { id: "stamen-toner", version: 8, sources: { "plotly-stamen-toner": { type: "raster", attribution: s, tiles: ["https://stamen-tiles.a.ssl.fastly.net/toner/{z}/{x}/{y}.png"], tileSize: 256 } }, layers: [{ id: "plotly-stamen-toner", type: "raster", source: "plotly-stamen-toner", minzoom: 0, maxzoom: 22 }] }, "stamen-watercolor": { id: "stamen-watercolor", version: 8, sources: { "plotly-stamen-watercolor": { type: "raster", attribution: ['Map tiles by <a target="_blank" href="https://stamen.com">Stamen Design</a>', 'under <a target="_blank" href="https://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>', "|", 'Data by <a target="_blank" href="https://openstreetmap.org">OpenStreetMap</a> contributors', 'under <a target="_blank" href="https://creativecommons.org/licenses/by-sa/3.0">CC BY SA</a>'].join(" "), tiles: ["https://stamen-tiles.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.png"], tileSize: 256 } }, layers: [{ id: "plotly-stamen-watercolor", type: "raster", source: "plotly-stamen-watercolor", minzoom: 0, maxzoom: 22 }] } }, l = n(i);
      t.exports = { requiredVersion: "1.10.1", styleUrlPrefix: "mapbox://styles/mapbox/", styleUrlSuffix: "v9", styleValuesMapbox: ["basic", "streets", "outdoors", "light", "dark", "satellite", "satellite-streets"], styleValueDflt: "basic", stylesNonMapbox: i, styleValuesNonMapbox: l, traceLayerPrefix: "plotly-trace-layer-", layoutLayerPrefix: "plotly-layout-layer-", wrongVersionErrorMsg: ["Your custom plotly.js bundle is not using the correct mapbox-gl version", "Please install mapbox-gl@1.10.1."].join(`
`), noAccessTokenErrorMsg: ["Missing Mapbox access token.", "Mapbox trace type require a Mapbox access token to be registered.", "For example:", "  Plotly.newPlot(gd, data, layout, { mapboxAccessToken: 'my-access-token' });", "More info here: https://www.mapbox.com/help/define-access-token/"].join(`
`), missingStyleErrorMsg: ["No valid mapbox style found, please set `mapbox.style` to one of:", l.join(", "), "or register a Mapbox access token to use a Mapbox-served style."].join(`
`), multipleTokensErrorMsg: ["Set multiple mapbox access token across different mapbox subplot,", "using first token found as mapbox-gl does not allow multipleaccess tokens on the same page."].join(`
`), mapOnErrorMsg: "Mapbox error.", mapboxLogo: { 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", 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", 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", 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" }, styleRules: { map: "overflow:hidden;position:relative;", "missing-css": "display:none;", canary: "background-color:salmon;", "ctrl-bottom-left": "position: absolute; pointer-events: none; z-index: 2; bottom: 0; left: 0;", "ctrl-bottom-right": "position: absolute; pointer-events: none; z-index: 2; right: 0; bottom: 0;", ctrl: "clear: both; pointer-events: auto; transform: translate(0, 0);", "ctrl-attrib.mapboxgl-compact .mapboxgl-ctrl-attrib-inner": "display: none;", "ctrl-attrib.mapboxgl-compact:hover .mapboxgl-ctrl-attrib-inner": "display: block; margin-top:2px", "ctrl-attrib.mapboxgl-compact:hover": "padding: 2px 24px 2px 4px; visibility: visible; margin-top: 6px;", "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;`, "ctrl-attrib.mapboxgl-compact": "min-height: 20px; padding: 0; margin: 10px; position: relative; background-color: #fff; border-radius: 3px 12px 12px 3px;", "ctrl-bottom-right > .mapboxgl-ctrl-attrib.mapboxgl-compact::after": "bottom: 0; right: 0", "ctrl-bottom-left > .mapboxgl-ctrl-attrib.mapboxgl-compact::after": "bottom: 0; left: 0", "ctrl-bottom-left .mapboxgl-ctrl": "margin: 0 0 10px 10px; float: left;", "ctrl-bottom-right .mapboxgl-ctrl": "margin: 0 10px 10px 0; float: right;", "ctrl-attrib": "color: rgba(0, 0, 0, 0.75); text-decoration: none; font-size: 12px", "ctrl-attrib a": "color: rgba(0, 0, 0, 0.75); text-decoration: none; font-size: 12px", "ctrl-attrib a:hover": "color: inherit; text-decoration: underline;", "ctrl-attrib .mapbox-improve-map": "font-weight: bold; margin-left: 2px;", "attrib-empty": "display: none;", "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')` } };
    }, { "../../lib/sort_object_keys": 526 }], 612: [function(e, t, r) {
      "use strict";
      var n = e("../../lib");
      t.exports = function(a, o) {
        var s = a.split(" "), i = s[0], l = s[1], u2 = n.isArrayOrTypedArray(o) ? n.mean(o) : o, c = 0.5 + u2 / 100, f = 1.5 + u2 / 100, h = ["", ""], p = [0, 0];
        switch (i) {
          case "top":
            h[0] = "top", p[1] = -f;
            break;
          case "bottom":
            h[0] = "bottom", p[1] = f;
        }
        switch (l) {
          case "left":
            h[1] = "right", p[0] = -c;
            break;
          case "right":
            h[1] = "left", p[0] = c;
        }
        return { anchor: h[0] && h[1] ? h.join("-") : h[0] ? h[0] : h[1] ? h[1] : "center", offset: p };
      };
    }, { "../../lib": 503 }], 613: [function(e, t, r) {
      "use strict";
      var n = e("mapbox-gl/dist/mapbox-gl-unminified"), a = e("../../lib"), o = a.strTranslate, s = a.strScale, i = e("../../plots/get_data").getSubplotCalcData, l = e("../../constants/xmlns_namespaces"), u2 = e("@plotly/d3"), c = e("../../components/drawing"), f = e("../../lib/svg_text_utils"), h = e("./mapbox"), p = r.constants = e("./constants");
      function d(v) {
        return typeof v == "string" && (p.styleValuesMapbox.indexOf(v) !== -1 || v.indexOf("mapbox://") === 0);
      }
      r.name = "mapbox", r.attr = "subplot", r.idRoot = "mapbox", r.idRegex = r.attrRegex = a.counterRegex("mapbox"), r.attributes = { subplot: { valType: "subplotid", dflt: "mapbox", editType: "calc" } }, r.layoutAttributes = e("./layout_attributes"), r.supplyLayoutDefaults = e("./layout_defaults"), r.plot = function(v) {
        var m = v._fullLayout, g = v.calcdata, x = m._subplots.mapbox;
        if (n.version !== p.requiredVersion) throw new Error(p.wrongVersionErrorMsg);
        var b = function(A2, S2) {
          var C2 = A2._fullLayout;
          if (A2._context.mapboxAccessToken === "") return "";
          for (var E2 = [], F13 = [], N2 = false, D2 = false, I2 = 0; I2 < S2.length; I2++) {
            var O2 = C2[S2[I2]], L2 = O2.accesstoken;
            d(O2.style) && (L2 ? a.pushUnique(E2, L2) : (d(O2._input.style) && (a.error("Uses Mapbox map style, but did not set an access token."), N2 = true), D2 = true)), L2 && a.pushUnique(F13, L2);
          }
          if (D2) {
            var V2 = N2 ? p.noAccessTokenErrorMsg : p.missingStyleErrorMsg;
            throw a.error(V2), new Error(V2);
          }
          return E2.length ? (E2.length > 1 && a.warn(p.multipleTokensErrorMsg), E2[0]) : (F13.length && a.log(["Listed mapbox access token(s)", F13.join(","), "but did not use a Mapbox map style, ignoring token(s)."].join(" ")), "");
        }(v, x);
        n.accessToken = b;
        for (var y = 0; y < x.length; y++) {
          var w = x[y], _4 = i(g, "mapbox", w), k = m[w], T2 = k._subplot;
          T2 || (T2 = new h(v, w), m[w]._subplot = T2), T2.viewInitial || (T2.viewInitial = { center: a.extendFlat({}, k.center), zoom: k.zoom, bearing: k.bearing, pitch: k.pitch }), T2.plot(_4, m, v._promises);
        }
      }, r.clean = function(v, m, g, x) {
        for (var b = x._subplots.mapbox || [], y = 0; y < b.length; y++) {
          var w = b[y];
          !m[w] && x[w]._subplot && x[w]._subplot.destroy();
        }
      }, r.toSVG = function(v) {
        for (var m = v._fullLayout, g = m._subplots.mapbox, x = m._size, b = 0; b < g.length; b++) {
          var y = m[g[b]], w = y.domain, _4 = y._subplot.toImage("png");
          m._glimages.append("svg:image").attr({ xmlns: l.svg, "xlink:href": _4, x: x.l + x.w * w.x[0], y: x.t + x.h * (1 - w.y[1]), width: x.w * (w.x[1] - w.x[0]), height: x.h * (w.y[1] - w.y[0]), preserveAspectRatio: "none" });
          var k = u2.select(y._subplot.div);
          if (k.select(".mapboxgl-ctrl-logo").node().offsetParent !== null) {
            var T2 = m._glimages.append("g");
            T2.attr("transform", o(x.l + x.w * w.x[0] + 10, x.t + x.h * (1 - w.y[0]) - 31)), T2.append("path").attr("d", p.mapboxLogo.path0).style({ opacity: 0.9, fill: "#ffffff", "enable-background": "new" }), T2.append("path").attr("d", p.mapboxLogo.path1).style("opacity", 0.35).style("enable-background", "new"), T2.append("path").attr("d", p.mapboxLogo.path2).style("opacity", 0.35).style("enable-background", "new"), T2.append("polygon").attr("points", p.mapboxLogo.polygon).style({ opacity: 0.9, fill: "#ffffff", "enable-background": "new" });
          }
          var A2 = k.select(".mapboxgl-ctrl-attrib").text().replace("Improve this map", ""), S2 = m._glimages.append("g"), C2 = S2.append("text");
          C2.text(A2).classed("static-attribution", true).attr({ "font-size": 12, "font-family": "Arial", color: "rgba(0, 0, 0, 0.75)", "text-anchor": "end", "data-unformatted": A2 });
          var E2 = c.bBox(C2.node()), F13 = x.w * (w.x[1] - w.x[0]);
          if (E2.width > F13 / 2) {
            var N2 = A2.split("|").join("<br>");
            C2.text(N2).attr("data-unformatted", N2).call(f.convertToTspans, v), E2 = c.bBox(C2.node());
          }
          C2.attr("transform", o(-3, 8 - E2.height)), S2.insert("rect", ".static-attribution").attr({ x: -E2.width - 6, y: -E2.height - 3, width: E2.width + 6, height: E2.height + 3, fill: "rgba(255, 255, 255, 0.75)" });
          var D2 = 1;
          E2.width + 6 > F13 && (D2 = F13 / (E2.width + 6));
          var I2 = [x.l + x.w * w.x[1], x.t + x.h * (1 - w.y[0])];
          S2.attr("transform", o(I2[0], I2[1]) + s(D2));
        }
      }, r.updateFx = function(v) {
        for (var m = v._fullLayout, g = m._subplots.mapbox, x = 0; x < g.length; x++) m[g[x]]._subplot.updateFx(m);
      };
    }, { "../../components/drawing": 388, "../../constants/xmlns_namespaces": 480, "../../lib": 503, "../../lib/svg_text_utils": 529, "../../plots/get_data": 593, "./constants": 611, "./layout_attributes": 615, "./layout_defaults": 616, "./mapbox": 617, "@plotly/d3": 58, "mapbox-gl/dist/mapbox-gl-unminified": 239 }], 614: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../lib/svg_text_utils").sanitizeHTML, o = e("./convert_text_opts"), s = e("./constants");
      function i(f, h) {
        this.subplot = f, this.uid = f.uid + "-" + h, this.index = h, this.idSource = "source-" + this.uid, this.idLayer = s.layoutLayerPrefix + this.uid, this.sourceType = null, this.source = null, this.layerType = null, this.below = null, this.visible = false;
      }
      var l = i.prototype;
      function u2(f) {
        if (!f.visible) return false;
        var h = f.source;
        if (Array.isArray(h) && h.length > 0) {
          for (var p = 0; p < h.length; p++) if (typeof h[p] != "string" || h[p].length === 0) return false;
          return true;
        }
        return n.isPlainObject(h) || typeof h == "string" && h.length > 0;
      }
      function c(f) {
        var h = {}, p = {};
        switch (f.type) {
          case "circle":
            n.extendFlat(p, { "circle-radius": f.circle.radius, "circle-color": f.color, "circle-opacity": f.opacity });
            break;
          case "line":
            n.extendFlat(p, { "line-width": f.line.width, "line-color": f.color, "line-opacity": f.opacity, "line-dasharray": f.line.dash });
            break;
          case "fill":
            n.extendFlat(p, { "fill-color": f.color, "fill-outline-color": f.fill.outlinecolor, "fill-opacity": f.opacity });
            break;
          case "symbol":
            var d = f.symbol, v = o(d.textposition, d.iconsize);
            n.extendFlat(h, { "icon-image": d.icon + "-15", "icon-size": d.iconsize / 10, "text-field": d.text, "text-size": d.textfont.size, "text-anchor": v.anchor, "text-offset": v.offset, "symbol-placement": d.placement }), n.extendFlat(p, { "icon-color": f.color, "text-color": d.textfont.color, "text-opacity": f.opacity });
            break;
          case "raster":
            n.extendFlat(p, { "raster-fade-duration": 0, "raster-opacity": f.opacity });
        }
        return { layout: h, paint: p };
      }
      l.update = function(f) {
        this.visible ? this.needsNewImage(f) ? this.updateImage(f) : this.needsNewSource(f) ? (this.removeLayer(), this.updateSource(f), this.updateLayer(f)) : this.needsNewLayer(f) ? this.updateLayer(f) : this.updateStyle(f) : (this.updateSource(f), this.updateLayer(f)), this.visible = u2(f);
      }, l.needsNewImage = function(f) {
        return this.subplot.map.getSource(this.idSource) && this.sourceType === "image" && f.sourcetype === "image" && (this.source !== f.source || JSON.stringify(this.coordinates) !== JSON.stringify(f.coordinates));
      }, l.needsNewSource = function(f) {
        return this.sourceType !== f.sourcetype || JSON.stringify(this.source) !== JSON.stringify(f.source) || this.layerType !== f.type;
      }, l.needsNewLayer = function(f) {
        return this.layerType !== f.type || this.below !== this.subplot.belowLookup["layout-" + this.index];
      }, l.lookupBelow = function() {
        return this.subplot.belowLookup["layout-" + this.index];
      }, l.updateImage = function(f) {
        this.subplot.map.getSource(this.idSource).updateImage({ url: f.source, coordinates: f.coordinates });
        var h = this.findFollowingMapboxLayerId(this.lookupBelow());
        h !== null && this.subplot.map.moveLayer(this.idLayer, h);
      }, l.updateSource = function(f) {
        var h = this.subplot.map;
        if (h.getSource(this.idSource) && h.removeSource(this.idSource), this.sourceType = f.sourcetype, this.source = f.source, u2(f)) {
          var p = function(d) {
            var v, m = d.sourcetype, g = d.source, x = { type: m };
            return m === "geojson" ? v = "data" : m === "vector" ? v = typeof g == "string" ? "url" : "tiles" : m === "raster" ? (v = "tiles", x.tileSize = 256) : m === "image" && (v = "url", x.coordinates = d.coordinates), x[v] = g, d.sourceattribution && (x.attribution = a(d.sourceattribution)), x;
          }(f);
          h.addSource(this.idSource, p);
        }
      }, l.findFollowingMapboxLayerId = function(f) {
        if (f === "traces") for (var h = this.subplot.getMapLayers(), p = 0; p < h.length; p++) {
          var d = h[p].id;
          if (typeof d == "string" && d.indexOf(s.traceLayerPrefix) === 0) {
            f = d;
            break;
          }
        }
        return f;
      }, l.updateLayer = function(f) {
        var h = this.subplot, p = c(f), d = this.lookupBelow(), v = this.findFollowingMapboxLayerId(d);
        this.removeLayer(), u2(f) && h.addLayer({ id: this.idLayer, source: this.idSource, "source-layer": f.sourcelayer || "", type: f.type, minzoom: f.minzoom, maxzoom: f.maxzoom, layout: p.layout, paint: p.paint }, v), this.layerType = f.type, this.below = d;
      }, l.updateStyle = function(f) {
        if (u2(f)) {
          var h = c(f);
          this.subplot.setOptions(this.idLayer, "setLayoutProperty", h.layout), this.subplot.setOptions(this.idLayer, "setPaintProperty", h.paint);
        }
      }, l.removeLayer = function() {
        var f = this.subplot.map;
        f.getLayer(this.idLayer) && f.removeLayer(this.idLayer);
      }, l.dispose = function() {
        var f = this.subplot.map;
        f.getLayer(this.idLayer) && f.removeLayer(this.idLayer), f.getSource(this.idSource) && f.removeSource(this.idSource);
      }, t.exports = function(f, h, p) {
        var d = new i(f, h);
        return d.update(p), d;
      };
    }, { "../../lib": 503, "../../lib/svg_text_utils": 529, "./constants": 611, "./convert_text_opts": 612 }], 615: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../components/color").defaultLine, o = e("../domain").attributes, s = e("../font_attributes"), i = e("../../traces/scatter/attributes").textposition, l = e("../../plot_api/edit_types").overrideAll, u2 = e("../../plot_api/plot_template").templatedArray, c = e("./constants"), f = s({});
      f.family.dflt = "Open Sans Regular, Arial Unicode MS Regular", (t.exports = l({ _arrayAttrRegexps: [n.counterRegex("mapbox", ".layers", true)], domain: o({ name: "mapbox" }), accesstoken: { valType: "string", noBlank: true, strict: true }, style: { valType: "any", values: c.styleValuesMapbox.concat(c.styleValuesNonMapbox), dflt: c.styleValueDflt }, center: { lon: { valType: "number", dflt: 0 }, lat: { valType: "number", dflt: 0 } }, zoom: { valType: "number", dflt: 1 }, bearing: { valType: "number", dflt: 0 }, pitch: { valType: "number", dflt: 0 }, layers: u2("layer", { visible: { valType: "boolean", dflt: true }, sourcetype: { valType: "enumerated", values: ["geojson", "vector", "raster", "image"], dflt: "geojson" }, source: { valType: "any" }, sourcelayer: { valType: "string", dflt: "" }, sourceattribution: { valType: "string" }, type: { valType: "enumerated", values: ["circle", "line", "fill", "symbol", "raster"], dflt: "circle" }, coordinates: { valType: "any" }, below: { valType: "string" }, color: { valType: "color", dflt: a }, opacity: { valType: "number", min: 0, max: 1, dflt: 1 }, minzoom: { valType: "number", min: 0, max: 24, dflt: 0 }, maxzoom: { valType: "number", min: 0, max: 24, dflt: 24 }, circle: { radius: { valType: "number", dflt: 15 } }, line: { width: { valType: "number", dflt: 2 }, dash: { valType: "data_array" } }, fill: { outlinecolor: { valType: "color", dflt: a } }, symbol: { icon: { valType: "string", dflt: "marker" }, iconsize: { valType: "number", dflt: 10 }, text: { valType: "string", dflt: "" }, placement: { valType: "enumerated", values: ["point", "line", "line-center"], dflt: "point" }, textfont: f, textposition: n.extendFlat({}, i, { arrayOk: false }) } }) }, "plot", "from-root")).uirevision = { valType: "any", editType: "none" };
    }, { "../../components/color": 366, "../../lib": 503, "../../plot_api/edit_types": 536, "../../plot_api/plot_template": 543, "../../traces/scatter/attributes": 926, "../domain": 584, "../font_attributes": 585, "./constants": 611 }], 616: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../subplot_defaults"), o = e("../array_container_defaults"), s = e("./layout_attributes");
      function i(u2, c, f, h) {
        f("accesstoken", h.accessToken), f("style"), f("center.lon"), f("center.lat"), f("zoom"), f("bearing"), f("pitch"), o(u2, c, { name: "layers", handleItemDefaults: l }), c._input = u2;
      }
      function l(u2, c) {
        function f(m, g) {
          return n.coerce(u2, c, s.layers, m, g);
        }
        if (f("visible")) {
          var h, p = f("sourcetype"), d = p === "raster" || p === "image";
          f("source"), f("sourceattribution"), p === "vector" && f("sourcelayer"), p === "image" && f("coordinates"), d && (h = "raster");
          var v = f("type", h);
          d && v !== "raster" && (v = c.type = "raster", n.log("Source types *raster* and *image* must drawn *raster* layer type.")), f("below"), f("color"), f("opacity"), f("minzoom"), f("maxzoom"), v === "circle" && f("circle.radius"), v === "line" && (f("line.width"), f("line.dash")), v === "fill" && f("fill.outlinecolor"), v === "symbol" && (f("symbol.icon"), f("symbol.iconsize"), f("symbol.text"), n.coerceFont(f, "symbol.textfont"), f("symbol.textposition"), f("symbol.placement"));
        }
      }
      t.exports = function(u2, c, f) {
        a(u2, c, f, { type: "mapbox", attributes: s, handleDefaults: i, partition: "y", accessToken: c._mapboxAccessToken });
      };
    }, { "../../lib": 503, "../array_container_defaults": 549, "../subplot_defaults": 632, "./layout_attributes": 615 }], 617: [function(e, t, r) {
      "use strict";
      var n = e("mapbox-gl/dist/mapbox-gl-unminified"), a = e("../../lib"), o = e("../../lib/geo_location_utils"), s = e("../../registry"), i = e("../cartesian/axes"), l = e("../../components/dragelement"), u2 = e("../../components/fx"), c = e("../../components/dragelement/helpers"), f = c.rectMode, h = c.drawMode, p = c.selectMode, d = e("../cartesian/select").prepSelect, v = e("../cartesian/select").clearSelect, m = e("../cartesian/select").clearSelectionsCache, g = e("../cartesian/select").selectOnClick, x = e("./constants"), b = e("./layers");
      function y(S2, C2) {
        this.id = C2, this.gd = S2;
        var E2 = S2._fullLayout, F13 = S2._context;
        this.container = E2._glcontainer.node(), this.isStatic = F13.staticPlot, this.uid = E2._uid + "-" + this.id, this.div = null, this.xaxis = null, this.yaxis = null, this.createFramework(E2), this.map = null, this.accessToken = null, this.styleObj = null, this.traceHash = {}, this.layerList = [], this.belowLookup = {}, this.dragging = false, this.wheeling = false;
      }
      var w = y.prototype;
      w.plot = function(S2, C2, E2) {
        var F13, N2 = this, D2 = C2[N2.id];
        N2.map && D2.accesstoken !== N2.accessToken && (N2.map.remove(), N2.map = null, N2.styleObj = null, N2.traceHash = {}, N2.layerList = []), F13 = N2.map ? new Promise(function(I2, O2) {
          N2.updateMap(S2, C2, I2, O2);
        }) : new Promise(function(I2, O2) {
          N2.createMap(S2, C2, I2, O2);
        }), E2.push(F13);
      }, w.createMap = function(S2, C2, E2, F13) {
        var N2 = this, D2 = C2[N2.id], I2 = N2.styleObj = k(D2.style);
        N2.accessToken = D2.accesstoken;
        var O2 = N2.map = new n.Map({ container: N2.div, style: I2.style, center: A2(D2.center), zoom: D2.zoom, bearing: D2.bearing, pitch: D2.pitch, interactive: !N2.isStatic, preserveDrawingBuffer: N2.isStatic, doubleClickZoom: false, boxZoom: false, attributionControl: false }).addControl(new n.AttributionControl({ compact: true }));
        O2._canvas.style.left = "0px", O2._canvas.style.top = "0px", N2.rejectOnError(F13), N2.isStatic || N2.initFx(S2, C2);
        var L2 = [];
        L2.push(new Promise(function(V2) {
          O2.once("load", V2);
        })), L2 = L2.concat(o.fetchTraceGeoData(S2)), Promise.all(L2).then(function() {
          N2.fillBelowLookup(S2, C2), N2.updateData(S2), N2.updateLayout(C2), N2.resolveOnRender(E2);
        }).catch(F13);
      }, w.updateMap = function(S2, C2, E2, F13) {
        var N2 = this, D2 = N2.map, I2 = C2[this.id];
        N2.rejectOnError(F13);
        var O2 = [], L2 = k(I2.style);
        JSON.stringify(N2.styleObj) !== JSON.stringify(L2) && (N2.styleObj = L2, D2.setStyle(L2.style), N2.traceHash = {}, O2.push(new Promise(function(V2) {
          D2.once("styledata", V2);
        }))), O2 = O2.concat(o.fetchTraceGeoData(S2)), Promise.all(O2).then(function() {
          N2.fillBelowLookup(S2, C2), N2.updateData(S2), N2.updateLayout(C2), N2.resolveOnRender(E2);
        }).catch(F13);
      }, w.fillBelowLookup = function(S2, C2) {
        var E2, F13, N2 = C2[this.id].layers, D2 = this.belowLookup = {}, I2 = false;
        for (E2 = 0; E2 < S2.length; E2++) {
          var O2 = S2[E2][0].trace, L2 = O2._module;
          typeof O2.below == "string" ? F13 = O2.below : L2.getBelow && (F13 = L2.getBelow(O2, this)), F13 === "" && (I2 = true), D2["trace-" + O2.uid] = F13 || "";
        }
        for (E2 = 0; E2 < N2.length; E2++) {
          var V2 = N2[E2];
          F13 = typeof V2.below == "string" ? V2.below : I2 ? "traces" : "", D2["layout-" + E2] = F13;
        }
        var W2, X2, Y2 = {};
        for (W2 in D2) Y2[F13 = D2[W2]] ? Y2[F13].push(W2) : Y2[F13] = [W2];
        for (F13 in Y2) {
          var K2 = Y2[F13];
          if (K2.length > 1) for (E2 = 0; E2 < K2.length; E2++) (W2 = K2[E2]).indexOf("trace-") === 0 ? (X2 = W2.split("trace-")[1], this.traceHash[X2] && (this.traceHash[X2].below = null)) : W2.indexOf("layout-") === 0 && (X2 = W2.split("layout-")[1], this.layerList[X2] && (this.layerList[X2].below = null));
        }
      };
      var _4 = { choroplethmapbox: 0, densitymapbox: 1, scattermapbox: 2 };
      function k(S2) {
        var C2 = {};
        return a.isPlainObject(S2) ? (C2.id = S2.id, C2.style = S2) : typeof S2 == "string" ? (C2.id = S2, x.styleValuesMapbox.indexOf(S2) !== -1 ? C2.style = T2(S2) : x.stylesNonMapbox[S2] ? C2.style = x.stylesNonMapbox[S2] : C2.style = S2) : (C2.id = x.styleValueDflt, C2.style = T2(x.styleValueDflt)), C2.transition = { duration: 0, delay: 0 }, C2;
      }
      function T2(S2) {
        return x.styleUrlPrefix + S2 + "-" + x.styleUrlSuffix;
      }
      function A2(S2) {
        return [S2.lon, S2.lat];
      }
      w.updateData = function(S2) {
        var C2, E2, F13, N2, D2 = this.traceHash, I2 = S2.slice().sort(function(X2, Y2) {
          return _4[X2[0].trace.type] - _4[Y2[0].trace.type];
        });
        for (F13 = 0; F13 < I2.length; F13++) {
          var O2 = I2[F13], L2 = false;
          (C2 = D2[(E2 = O2[0].trace).uid]) && (C2.type === E2.type ? (C2.update(O2), L2 = true) : C2.dispose()), !L2 && E2._module && (D2[E2.uid] = E2._module.plot(this, O2));
        }
        var V2 = Object.keys(D2);
        e: for (F13 = 0; F13 < V2.length; F13++) {
          var W2 = V2[F13];
          for (N2 = 0; N2 < S2.length; N2++) if (W2 === (E2 = S2[N2][0].trace).uid) continue e;
          (C2 = D2[W2]).dispose(), delete D2[W2];
        }
      }, w.updateLayout = function(S2) {
        var C2 = this.map, E2 = S2[this.id];
        this.dragging || this.wheeling || (C2.setCenter(A2(E2.center)), C2.setZoom(E2.zoom), C2.setBearing(E2.bearing), C2.setPitch(E2.pitch)), this.updateLayers(S2), this.updateFramework(S2), this.updateFx(S2), this.map.resize(), this.gd._context._scrollZoom.mapbox ? C2.scrollZoom.enable() : C2.scrollZoom.disable();
      }, w.resolveOnRender = function(S2) {
        var C2 = this.map;
        C2.on("render", function E2() {
          C2.loaded() && (C2.off("render", E2), setTimeout(S2, 10));
        });
      }, w.rejectOnError = function(S2) {
        var C2 = this.map;
        function E2() {
          S2(new Error(x.mapOnErrorMsg));
        }
        C2.once("error", E2), C2.once("style.error", E2), C2.once("source.error", E2), C2.once("tile.error", E2), C2.once("layer.error", E2);
      }, w.createFramework = function(S2) {
        var C2 = this, E2 = C2.div = document.createElement("div");
        E2.id = C2.uid, E2.style.position = "absolute", C2.container.appendChild(E2), C2.xaxis = { _id: "x", c2p: function(F13) {
          return C2.project(F13).x;
        } }, C2.yaxis = { _id: "y", c2p: function(F13) {
          return C2.project(F13).y;
        } }, C2.updateFramework(S2), C2.mockAxis = { type: "linear", showexponent: "all", exponentformat: "B" }, i.setConvert(C2.mockAxis, S2);
      }, w.initFx = function(S2, C2) {
        var E2 = this, F13 = E2.gd, N2 = E2.map;
        function D2() {
          u2.loneUnhover(C2._hoverlayer);
        }
        function I2() {
          var O2 = E2.getView();
          F13.emit("plotly_relayouting", E2.getViewEditsWithDerived(O2));
        }
        N2.on("moveend", function(O2) {
          if (E2.map) {
            var L2 = F13._fullLayout;
            if (O2.originalEvent || E2.wheeling) {
              var V2 = L2[E2.id];
              s.call("_storeDirectGUIEdit", F13.layout, L2._preGUI, E2.getViewEdits(V2));
              var W2 = E2.getView();
              V2._input.center = V2.center = W2.center, V2._input.zoom = V2.zoom = W2.zoom, V2._input.bearing = V2.bearing = W2.bearing, V2._input.pitch = V2.pitch = W2.pitch, F13.emit("plotly_relayout", E2.getViewEditsWithDerived(W2));
            }
            O2.originalEvent && O2.originalEvent.type === "mouseup" ? E2.dragging = false : E2.wheeling && (E2.wheeling = false), L2._rehover && L2._rehover();
          }
        }), N2.on("wheel", function() {
          E2.wheeling = true;
        }), N2.on("mousemove", function(O2) {
          var L2 = E2.div.getBoundingClientRect(), V2 = [O2.originalEvent.offsetX, O2.originalEvent.offsetY];
          O2.target.getBoundingClientRect = function() {
            return L2;
          }, E2.xaxis.p2c = function() {
            return N2.unproject(V2).lng;
          }, E2.yaxis.p2c = function() {
            return N2.unproject(V2).lat;
          }, F13._fullLayout._rehover = function() {
            F13._fullLayout._hoversubplot === E2.id && F13._fullLayout[E2.id] && u2.hover(F13, O2, E2.id);
          }, u2.hover(F13, O2, E2.id), F13._fullLayout._hoversubplot = E2.id;
        }), N2.on("dragstart", function() {
          E2.dragging = true, D2();
        }), N2.on("zoomstart", D2), N2.on("mouseout", function() {
          F13._fullLayout._hoversubplot = null;
        }), N2.on("drag", I2), N2.on("zoom", I2), N2.on("dblclick", function() {
          var O2 = F13._fullLayout[E2.id];
          s.call("_storeDirectGUIEdit", F13.layout, F13._fullLayout._preGUI, E2.getViewEdits(O2));
          var L2 = E2.viewInitial;
          N2.setCenter(A2(L2.center)), N2.setZoom(L2.zoom), N2.setBearing(L2.bearing), N2.setPitch(L2.pitch);
          var V2 = E2.getView();
          O2._input.center = O2.center = V2.center, O2._input.zoom = O2.zoom = V2.zoom, O2._input.bearing = O2.bearing = V2.bearing, O2._input.pitch = O2.pitch = V2.pitch, F13.emit("plotly_doubleclick", null), F13.emit("plotly_relayout", E2.getViewEditsWithDerived(V2));
        }), E2.clearSelect = function() {
          m(E2.dragOptions), v(E2.dragOptions.gd);
        }, E2.onClickInPanFn = function(O2) {
          return function(L2) {
            var V2 = F13._fullLayout.clickmode;
            V2.indexOf("select") > -1 && g(L2.originalEvent, F13, [E2.xaxis], [E2.yaxis], E2.id, O2), V2.indexOf("event") > -1 && u2.click(F13, L2.originalEvent);
          };
        };
      }, w.updateFx = function(S2) {
        var C2 = this, E2 = C2.map, F13 = C2.gd;
        if (!C2.isStatic) {
          var N2, D2 = S2.dragmode;
          N2 = f(D2) ? function(L2, V2) {
            (L2.range = {})[C2.id] = [O2([V2.xmin, V2.ymin]), O2([V2.xmax, V2.ymax])];
          } : function(L2, V2, W2) {
            (L2.lassoPoints = {})[C2.id] = W2.filtered.map(O2);
          };
          var I2 = C2.dragOptions;
          C2.dragOptions = a.extendDeep(I2 || {}, { dragmode: S2.dragmode, element: C2.div, gd: F13, plotinfo: { id: C2.id, domain: S2[C2.id].domain, xaxis: C2.xaxis, yaxis: C2.yaxis, fillRangeItems: N2 }, xaxes: [C2.xaxis], yaxes: [C2.yaxis], subplot: C2.id }), E2.off("click", C2.onClickInPanHandler), p(D2) || h(D2) ? (E2.dragPan.disable(), E2.on("zoomstart", C2.clearSelect), C2.dragOptions.prepFn = function(L2, V2, W2) {
            d(L2, V2, W2, C2.dragOptions, D2);
          }, l.init(C2.dragOptions)) : (E2.dragPan.enable(), E2.off("zoomstart", C2.clearSelect), C2.div.onmousedown = null, C2.onClickInPanHandler = C2.onClickInPanFn(C2.dragOptions), E2.on("click", C2.onClickInPanHandler));
        }
        function O2(L2) {
          var V2 = C2.map.unproject(L2);
          return [V2.lng, V2.lat];
        }
      }, w.updateFramework = function(S2) {
        var C2 = S2[this.id].domain, E2 = S2._size, F13 = this.div.style;
        F13.width = E2.w * (C2.x[1] - C2.x[0]) + "px", F13.height = E2.h * (C2.y[1] - C2.y[0]) + "px", F13.left = E2.l + C2.x[0] * E2.w + "px", F13.top = E2.t + (1 - C2.y[1]) * E2.h + "px", this.xaxis._offset = E2.l + C2.x[0] * E2.w, this.xaxis._length = E2.w * (C2.x[1] - C2.x[0]), this.yaxis._offset = E2.t + (1 - C2.y[1]) * E2.h, this.yaxis._length = E2.h * (C2.y[1] - C2.y[0]);
      }, w.updateLayers = function(S2) {
        var C2, E2 = S2[this.id].layers, F13 = this.layerList;
        if (E2.length !== F13.length) {
          for (C2 = 0; C2 < F13.length; C2++) F13[C2].dispose();
          for (F13 = this.layerList = [], C2 = 0; C2 < E2.length; C2++) F13.push(b(this, C2, E2[C2]));
        } else for (C2 = 0; C2 < E2.length; C2++) F13[C2].update(E2[C2]);
      }, w.destroy = function() {
        this.map && (this.map.remove(), this.map = null, this.container.removeChild(this.div));
      }, w.toImage = function() {
        return this.map.stop(), this.map.getCanvas().toDataURL();
      }, w.setOptions = function(S2, C2, E2) {
        for (var F13 in E2) this.map[C2](S2, F13, E2[F13]);
      }, w.getMapLayers = function() {
        return this.map.getStyle().layers;
      }, w.addLayer = function(S2, C2) {
        var E2 = this.map;
        if (typeof C2 == "string") {
          if (C2 === "") return void E2.addLayer(S2, C2);
          for (var F13 = this.getMapLayers(), N2 = 0; N2 < F13.length; N2++) if (C2 === F13[N2].id) return void E2.addLayer(S2, C2);
          a.warn(["Trying to add layer with *below* value", C2, "referencing a layer that does not exist", "or that does not yet exist."].join(" "));
        }
        E2.addLayer(S2);
      }, w.project = function(S2) {
        return this.map.project(new n.LngLat(S2[0], S2[1]));
      }, w.getView = function() {
        var S2 = this.map, C2 = S2.getCenter(), E2 = { lon: C2.lng, lat: C2.lat }, F13 = S2.getCanvas(), N2 = parseInt(F13.style.width), D2 = parseInt(F13.style.height);
        return { center: E2, zoom: S2.getZoom(), bearing: S2.getBearing(), pitch: S2.getPitch(), _derived: { coordinates: [S2.unproject([0, 0]).toArray(), S2.unproject([N2, 0]).toArray(), S2.unproject([N2, D2]).toArray(), S2.unproject([0, D2]).toArray()] } };
      }, w.getViewEdits = function(S2) {
        for (var C2 = this.id, E2 = ["center", "zoom", "bearing", "pitch"], F13 = {}, N2 = 0; N2 < E2.length; N2++) {
          var D2 = E2[N2];
          F13[C2 + "." + D2] = S2[D2];
        }
        return F13;
      }, w.getViewEditsWithDerived = function(S2) {
        var C2 = this.id, E2 = this.getViewEdits(S2);
        return E2[C2 + "._derived"] = S2._derived, E2;
      }, t.exports = y;
    }, { "../../components/dragelement": 385, "../../components/dragelement/helpers": 384, "../../components/fx": 406, "../../lib": 503, "../../lib/geo_location_utils": 496, "../../registry": 638, "../cartesian/axes": 554, "../cartesian/select": 575, "./constants": 611, "./layers": 614, "mapbox-gl/dist/mapbox-gl-unminified": 239 }], 618: [function(e, t, r) {
      "use strict";
      t.exports = function(n) {
        var a = n.editType;
        return { t: { valType: "number", dflt: 0, editType: a }, r: { valType: "number", dflt: 0, editType: a }, b: { valType: "number", dflt: 0, editType: a }, l: { valType: "number", dflt: 0, editType: a }, editType: a };
      };
    }, {}], 619: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("d3-time-format").timeFormatLocale, o = e("d3-format").formatLocale, s = e("fast-isnumeric"), i = e("../registry"), l = e("../plot_api/plot_schema"), u2 = e("../plot_api/plot_template"), c = e("../lib"), f = e("../components/color"), h = e("../constants/numerical").BADNUM, p = e("./cartesian/axis_ids"), d = e("./cartesian/handle_outline").clearSelect, v = e("./animation_attributes"), m = e("./frame_attributes"), g = e("../plots/get_data").getModuleCalcData, x = c.relinkPrivateKeys, b = c._, y = t.exports = {};
      c.extendFlat(y, i), y.attributes = e("./attributes"), y.attributes.type.values = y.allTypes, y.fontAttrs = e("./font_attributes"), y.layoutAttributes = e("./layout_attributes"), y.fontWeight = "normal";
      var w = y.transformsRegistry, _4 = e("./command");
      y.executeAPICommand = _4.executeAPICommand, y.computeAPICommandBindings = _4.computeAPICommandBindings, y.manageCommandObserver = _4.manageCommandObserver, y.hasSimpleAPICommandBindings = _4.hasSimpleAPICommandBindings, y.redrawText = function(W2) {
        return W2 = c.getGraphDiv(W2), new Promise(function(X2) {
          setTimeout(function() {
            W2._fullLayout && (i.getComponentMethod("annotations", "draw")(W2), i.getComponentMethod("legend", "draw")(W2), i.getComponentMethod("colorbar", "draw")(W2), X2(y.previousPromises(W2)));
          }, 300);
        });
      }, y.resize = function(W2) {
        var X2;
        W2 = c.getGraphDiv(W2);
        var Y2 = new Promise(function(K2, q) {
          W2 && !c.isHidden(W2) || q(new Error("Resize must be passed a displayed plot div element.")), W2._redrawTimer && clearTimeout(W2._redrawTimer), W2._resolveResize && (X2 = W2._resolveResize), W2._resolveResize = K2, W2._redrawTimer = setTimeout(function() {
            if (!W2.layout || W2.layout.width && W2.layout.height || c.isHidden(W2)) K2(W2);
            else {
              delete W2.layout.width, delete W2.layout.height;
              var re = W2.changed;
              W2.autoplay = true, i.call("relayout", W2, { autosize: true }).then(function() {
                W2.changed = re, W2._resolveResize === K2 && (delete W2._resolveResize, K2(W2));
              });
            }
          }, 100);
        });
        return X2 && X2(Y2), Y2;
      }, y.previousPromises = function(W2) {
        if ((W2._promises || []).length) return Promise.all(W2._promises).then(function() {
          W2._promises = [];
        });
      }, y.addLinks = function(W2) {
        if (W2._context.showLink || W2._context.showSources) {
          var X2 = W2._fullLayout, Y2 = c.ensureSingle(X2._paper, "text", "js-plot-link-container", function(H2) {
            H2.style({ "font-family": '"Open Sans", Arial, sans-serif', "font-size": "12px", fill: f.defaultLine, "pointer-events": "all" }).each(function() {
              var te = n.select(this);
              te.append("tspan").classed("js-link-to-tool", true), te.append("tspan").classed("js-link-spacer", true), te.append("tspan").classed("js-sourcelinks", true);
            });
          }), K2 = Y2.node(), q = { y: X2._paper.attr("height") - 9 };
          document.body.contains(K2) && K2.getComputedTextLength() >= X2.width - 20 ? (q["text-anchor"] = "start", q.x = 5) : (q["text-anchor"] = "end", q.x = X2._paper.attr("width") - 7), Y2.attr(q);
          var re = Y2.select(".js-link-to-tool"), R2 = Y2.select(".js-link-spacer"), z = Y2.select(".js-sourcelinks");
          W2._context.showSources && W2._context.showSources(W2), W2._context.showLink && function(H2, te) {
            te.text("");
            var j = te.append("a").attr({ "xlink:xlink:href": "#", class: "link--impt link--embedview", "font-weight": "bold" }).text(H2._context.linkText + " " + String.fromCharCode(187));
            if (H2._context.sendData) j.on("click", function() {
              y.sendDataToCloud(H2);
            });
            else {
              var Q2 = window.location.pathname.split("/"), Z2 = window.location.search;
              j.attr({ "xlink:xlink:show": "new", "xlink:xlink:href": "/" + Q2[2].split(".")[0] + "/" + Q2[1] + Z2 });
            }
          }(W2, re), R2.text(re.text() && z.text() ? " - " : "");
        }
      }, y.sendDataToCloud = function(W2) {
        var X2 = (window.PLOTLYENV || {}).BASE_URL || W2._context.plotlyServerURL;
        if (X2) {
          W2.emit("plotly_beforeexport");
          var Y2 = n.select(W2).append("div").attr("id", "hiddenform").style("display", "none"), K2 = Y2.append("form").attr({ action: X2 + "/external", method: "post", target: "_blank" });
          return K2.append("input").attr({ type: "text", name: "data" }).node().value = y.graphJson(W2, false, "keepdata"), K2.node().submit(), Y2.remove(), W2.emit("plotly_afterexport"), false;
        }
      };
      var k = ["days", "shortDays", "months", "shortMonths", "periods", "dateTime", "date", "time", "decimal", "thousands", "grouping", "currency"], T2 = ["year", "month", "dayMonth", "dayMonthYear"];
      function A2(W2, X2) {
        var Y2 = W2._context.locale;
        Y2 || (Y2 = "en-US");
        var K2 = false, q = {};
        function re(Q2) {
          for (var Z2 = true, ne = 0; ne < X2.length; ne++) {
            var ae = X2[ne];
            q[ae] || (Q2[ae] ? q[ae] = Q2[ae] : Z2 = false);
          }
          Z2 && (K2 = true);
        }
        for (var R2 = 0; R2 < 2; R2++) {
          for (var z = W2._context.locales, H2 = 0; H2 < 2; H2++) {
            var te = (z[Y2] || {}).format;
            if (te && (re(te), K2)) break;
            z = i.localeRegistry;
          }
          var j = Y2.split("-")[0];
          if (K2 || j === Y2) break;
          Y2 = j;
        }
        return K2 || re(i.localeRegistry.en.format), q;
      }
      function S2(W2, X2) {
        var Y2 = { _fullLayout: X2 }, K2 = W2._id.charAt(0) === "x", q = W2._mainAxis._anchorAxis, re = "", R2 = "", z = "";
        if (q && (z = q._mainAxis._id, re = K2 ? W2._id + z : z + W2._id), !re || !X2._plots[re]) {
          re = "";
          for (var H2 = W2._counterAxes, te = 0; te < H2.length; te++) {
            var j = H2[te], Q2 = K2 ? W2._id + j : j + W2._id;
            R2 || (R2 = Q2);
            var Z2 = p.getFromId(Y2, j);
            if (z && Z2.overlaying === z) {
              re = Q2;
              break;
            }
          }
        }
        return re || R2;
      }
      function C2(W2) {
        var X2 = W2.transforms;
        if (Array.isArray(X2) && X2.length) for (var Y2 = 0; Y2 < X2.length; Y2++) {
          var K2 = X2[Y2], q = K2._module || w[K2.type];
          if (q && q.makesData) return true;
        }
        return false;
      }
      function E2(W2, X2, Y2, K2) {
        for (var q = W2.transforms, re = [W2], R2 = 0; R2 < q.length; R2++) {
          var z = q[R2], H2 = w[z.type];
          H2 && H2.transform && (re = H2.transform(re, { transform: z, fullTrace: W2, fullData: X2, layout: Y2, fullLayout: K2, transformIndex: R2 }));
        }
        return re;
      }
      function F13(W2) {
        return typeof W2 == "string" && W2.substr(W2.length - 2) === "px" && parseFloat(W2);
      }
      function N2(W2) {
        var X2 = W2.margin;
        if (!W2._size) {
          var Y2 = W2._size = { l: Math.round(X2.l), r: Math.round(X2.r), t: Math.round(X2.t), b: Math.round(X2.b), p: Math.round(X2.pad) };
          Y2.w = Math.round(W2.width) - Y2.l - Y2.r, Y2.h = Math.round(W2.height) - Y2.t - Y2.b;
        }
        W2._pushmargin || (W2._pushmargin = {}), W2._pushmarginIds || (W2._pushmarginIds = {});
      }
      y.supplyDefaults = function(W2, X2) {
        var Y2 = X2 && X2.skipUpdateCalc, K2 = W2._fullLayout || {};
        if (K2._skipDefaults) delete K2._skipDefaults;
        else {
          var q, re = W2._fullLayout = {}, R2 = W2.layout || {}, z = W2._fullData || [], H2 = W2._fullData = [], te = W2.data || [], j = W2.calcdata || [], Q2 = W2._context || {};
          W2._transitionData || y.createTransitionData(W2), re._dfltTitle = { plot: b(W2, "Click to enter Plot title"), x: b(W2, "Click to enter X axis title"), y: b(W2, "Click to enter Y axis title"), colorbar: b(W2, "Click to enter Colorscale title"), annotation: b(W2, "new text") }, re._traceWord = b(W2, "trace");
          var Z2 = A2(W2, k);
          if (re._mapboxAccessToken = Q2.mapboxAccessToken, K2._initialAutoSizeIsDone) {
            var ne = K2.width, ae = K2.height;
            y.supplyLayoutGlobalDefaults(R2, re, Z2), R2.width || (re.width = ne), R2.height || (re.height = ae), y.sanitizeMargins(re);
          } else {
            y.supplyLayoutGlobalDefaults(R2, re, Z2);
            var ue = !R2.width || !R2.height, le = re.autosize, ce = Q2.autosizable;
            ue && (le || ce) ? y.plotAutoSize(W2, R2, re) : ue && y.sanitizeMargins(re), !le && ue && (R2.width = re.width, R2.height = re.height);
          }
          re._d3locale = function(Ze, it) {
            return Ze.decimal = it.charAt(0), Ze.thousands = it.charAt(1), { numberFormat: function(ot) {
              try {
                ot = o(Ze).format(c.adjustFormat(ot));
              } catch {
                return c.warnBadFormat(ot), c.noFormat;
              }
              return ot;
            }, timeFormat: a(Ze).utcFormat };
          }(Z2, re.separators), re._extraFormat = A2(W2, T2), re._initialAutoSizeIsDone = true, re._dataLength = te.length, re._modules = [], re._visibleModules = [], re._basePlotModules = [];
          var se = re._subplots = function() {
            var Ze, it, ot = i.collectableSubplotTypes, mt = {};
            if (!ot) {
              ot = [];
              var wt = i.subplotsRegistry;
              for (var Et in wt) {
                var zt = wt[Et].attr;
                if (zt && (ot.push(Et), Array.isArray(zt))) for (it = 0; it < zt.length; it++) c.pushUnique(ot, zt[it]);
              }
            }
            for (Ze = 0; Ze < ot.length; Ze++) mt[ot[Ze]] = [];
            return mt;
          }(), he = re._splomAxes = { x: {}, y: {} }, me = re._splomSubplots = {};
          re._splomGridDflt = {}, re._scatterStackOpts = {}, re._firstScatter = {}, re._alignmentOpts = {}, re._colorAxes = {}, re._requestRangeslider = {}, re._traceUids = function(Ze, it) {
            var ot, mt, wt = it.length, Et = [];
            for (ot = 0; ot < Ze.length; ot++) {
              var zt = Ze[ot]._fullInput;
              zt !== mt && Et.push(zt), mt = zt;
            }
            var Nt = Et.length, yt = new Array(wt), pt = {};
            function Ot(Ye, at) {
              yt[at] = Ye, pt[Ye] = 1;
            }
            function Jt(Ye, at) {
              if (Ye && typeof Ye == "string" && !pt[Ye]) return Ot(Ye, at), true;
            }
            for (ot = 0; ot < wt; ot++) {
              var tr = it[ot].uid;
              typeof tr == "number" && (tr = String(tr)), Jt(tr, ot) || ot < Nt && Jt(Et[ot].uid, ot) || Ot(c.randstr(pt), ot);
            }
            return yt;
          }(z, te), re._globalTransforms = (W2._context || {}).globalTransforms, y.supplyDataDefaults(te, H2, R2, re);
          var we = Object.keys(he.x), be = Object.keys(he.y);
          if (we.length > 1 && be.length > 1) {
            for (i.getComponentMethod("grid", "sizeDefaults")(R2, re), q = 0; q < we.length; q++) c.pushUnique(se.xaxis, we[q]);
            for (q = 0; q < be.length; q++) c.pushUnique(se.yaxis, be[q]);
            for (var Ae in me) c.pushUnique(se.cartesian, Ae);
          }
          if (re._has = y._hasPlotType.bind(re), z.length === H2.length) for (q = 0; q < H2.length; q++) x(H2[q], z[q]);
          y.supplyLayoutModuleDefaults(R2, re, H2, W2._transitionData);
          var pe = re._visibleModules, ve = [];
          for (q = 0; q < pe.length; q++) {
            var Ee = pe[q].crossTraceDefaults;
            Ee && c.pushUnique(ve, Ee);
          }
          for (q = 0; q < ve.length; q++) ve[q](H2, re);
          re._hasOnlyLargeSploms = re._basePlotModules.length === 1 && re._basePlotModules[0].name === "splom" && we.length > 15 && be.length > 15 && re.shapes.length === 0 && re.images.length === 0, y.linkSubplots(H2, re, z, K2), y.cleanPlot(H2, re, z, K2);
          var Se = !(!K2._has || !K2._has("gl2d")), Ce = !(!re._has || !re._has("gl2d")), Be = !(!K2._has || !K2._has("cartesian")) || Se, Ue = !(!re._has || !re._has("cartesian")) || Ce;
          Be && !Ue ? K2._bgLayer.remove() : Ue && !Be && (re._shouldCreateBgLayer = true), K2._zoomlayer && !W2._dragging && d({ _fullLayout: K2 }), function(Ze, it) {
            var ot, mt = [];
            it.meta && (ot = it._meta = { meta: it.meta, layout: { meta: it.meta } });
            for (var wt = 0; wt < Ze.length; wt++) {
              var Et = Ze[wt];
              Et.meta ? mt[Et.index] = Et._meta = { meta: Et.meta } : it.meta && (Et._meta = { meta: it.meta }), it.meta && (Et._meta.layout = { meta: it.meta });
            }
            mt.length && (ot || (ot = it._meta = {}), ot.data = mt);
          }(H2, re), x(re, K2), i.getComponentMethod("colorscale", "crossTraceDefaults")(H2, re), re._preGUI || (re._preGUI = {}), re._tracePreGUI || (re._tracePreGUI = {});
          var Ke, ct = re._tracePreGUI, We = {};
          for (Ke in ct) We[Ke] = "old";
          for (q = 0; q < H2.length; q++) We[Ke = H2[q]._fullInput.uid] || (ct[Ke] = {}), We[Ke] = "new";
          for (Ke in We) We[Ke] === "old" && delete ct[Ke];
          N2(re), i.getComponentMethod("rangeslider", "makeData")(re), Y2 || j.length !== H2.length || y.supplyDefaultsUpdateCalc(j, H2);
        }
      }, y.supplyDefaultsUpdateCalc = function(W2, X2) {
        for (var Y2 = 0; Y2 < X2.length; Y2++) {
          var K2 = X2[Y2], q = (W2[Y2] || [])[0];
          if (q && q.trace) {
            var re = q.trace;
            if (re._hasCalcTransform) {
              var R2, z, H2, te = re._arrayAttrs;
              for (R2 = 0; R2 < te.length; R2++) z = te[R2], H2 = c.nestedProperty(re, z).get().slice(), c.nestedProperty(K2, z).set(H2);
            }
            q.trace = K2;
          }
        }
      }, y.createTransitionData = function(W2) {
        W2._transitionData || (W2._transitionData = {}), W2._transitionData._frames || (W2._transitionData._frames = []), W2._transitionData._frameHash || (W2._transitionData._frameHash = {}), W2._transitionData._counter || (W2._transitionData._counter = 0), W2._transitionData._interruptCallbacks || (W2._transitionData._interruptCallbacks = []);
      }, y._hasPlotType = function(W2) {
        var X2, Y2 = this._basePlotModules || [];
        for (X2 = 0; X2 < Y2.length; X2++) if (Y2[X2].name === W2) return true;
        var K2 = this._modules || [];
        for (X2 = 0; X2 < K2.length; X2++) {
          var q = K2[X2].name;
          if (q === W2) return true;
          var re = i.modules[q];
          if (re && re.categories[W2]) return true;
        }
        return false;
      }, y.cleanPlot = function(W2, X2, Y2, K2) {
        var q, re, R2 = K2._basePlotModules || [];
        for (q = 0; q < R2.length; q++) {
          var z = R2[q];
          z.clean && z.clean(W2, X2, Y2, K2);
        }
        var H2 = K2._has && K2._has("gl"), te = X2._has && X2._has("gl");
        H2 && !te && K2._glcontainer !== void 0 && (K2._glcontainer.selectAll(".gl-canvas").remove(), K2._glcontainer.selectAll(".no-webgl").remove(), K2._glcanvas = null);
        var j = !!K2._infolayer;
        e: for (q = 0; q < Y2.length; q++) {
          var Q2 = Y2[q].uid;
          for (re = 0; re < W2.length; re++) if (Q2 === W2[re].uid) continue e;
          j && K2._infolayer.select(".cb" + Q2).remove();
        }
      }, y.linkSubplots = function(W2, X2, Y2, K2) {
        var q, re, R2 = K2._plots || {}, z = X2._plots = {}, H2 = X2._subplots, te = { _fullData: W2, _fullLayout: X2 }, j = H2.cartesian.concat(H2.gl2d || []);
        for (q = 0; q < j.length; q++) {
          var Q2, Z2 = j[q], ne = R2[Z2], ae = p.getFromId(te, Z2, "x"), ue = p.getFromId(te, Z2, "y");
          for (ne ? Q2 = z[Z2] = ne : (Q2 = z[Z2] = {}).id = Z2, ae._counterAxes.push(ue._id), ue._counterAxes.push(ae._id), ae._subplotsWith.push(Z2), ue._subplotsWith.push(Z2), Q2.xaxis = ae, Q2.yaxis = ue, Q2._hasClipOnAxisFalse = false, re = 0; re < W2.length; re++) {
            var le = W2[re];
            if (le.xaxis === Q2.xaxis._id && le.yaxis === Q2.yaxis._id && le.cliponaxis === false) {
              Q2._hasClipOnAxisFalse = true;
              break;
            }
          }
        }
        var ce, se = p.list(te, null, true);
        for (q = 0; q < se.length; q++) {
          var he = null;
          (ce = se[q]).overlaying && (he = p.getFromId(te, ce.overlaying)) && he.overlaying && (ce.overlaying = false, he = null), ce._mainAxis = he || ce, he && (ce.domain = he.domain.slice()), ce._anchorAxis = ce.anchor === "free" ? null : p.getFromId(te, ce.anchor);
        }
        for (q = 0; q < se.length; q++) if ((ce = se[q])._counterAxes.sort(p.idSort), ce._subplotsWith.sort(c.subplotSort), ce._mainSubplot = S2(ce, X2), ce._counterAxes.length && (ce.spikemode && ce.spikemode.indexOf("across") !== -1 || ce.automargin && ce.mirror && ce.anchor !== "free" || i.getComponentMethod("rangeslider", "isVisible")(ce))) {
          var me = 1, we = 0;
          for (re = 0; re < ce._counterAxes.length; re++) {
            var be = p.getFromId(te, ce._counterAxes[re]);
            me = Math.min(me, be.domain[0]), we = Math.max(we, be.domain[1]);
          }
          me < we && (ce._counterDomainMin = me, ce._counterDomainMax = we);
        }
      }, y.clearExpandedTraceDefaultColors = function(W2) {
        var X2, Y2, K2;
        for (Y2 = [], (X2 = W2._module._colorAttrs) || (W2._module._colorAttrs = X2 = [], l.crawl(W2._module.attributes, function(q, re, R2, z) {
          Y2[z] = re, Y2.length = z + 1, q.valType === "color" && q.dflt === void 0 && X2.push(Y2.join("."));
        })), K2 = 0; K2 < X2.length; K2++) c.nestedProperty(W2, "_input." + X2[K2]).get() || c.nestedProperty(W2, X2[K2]).set(null);
      }, y.supplyDataDefaults = function(W2, X2, Y2, K2) {
        var q, re, R2, z = K2._modules, H2 = K2._visibleModules, te = K2._basePlotModules, j = 0, Q2 = 0;
        function Z2(Ae) {
          X2.push(Ae);
          var pe = Ae._module;
          pe && (c.pushUnique(z, pe), Ae.visible === true && c.pushUnique(H2, pe), c.pushUnique(te, Ae._module.basePlotModule), j++, Ae._input.visible !== false && Q2++);
        }
        K2._transformModules = [];
        var ne = {}, ae = [], ue = (Y2.template || {}).data || {}, le = u2.traceTemplater(ue);
        for (q = 0; q < W2.length; q++) {
          if (R2 = W2[q], (re = le.newTrace(R2)).uid = K2._traceUids[q], y.supplyTraceDefaults(R2, re, Q2, K2, q), re.index = q, re._input = R2, re._expandedIndex = j, re.transforms && re.transforms.length) for (var ce = R2.visible !== false && re.visible === false, se = E2(re, X2, Y2, K2), he = 0; he < se.length; he++) {
            var me = se[he], we = { _template: re._template, type: re.type, uid: re.uid + he };
            ce && me.visible === false && delete me.visible, y.supplyTraceDefaults(me, we, j, K2, q), x(we, me), we.index = q, we._input = R2, we._fullInput = re, we._expandedIndex = j, we._expandedInput = me, Z2(we);
          }
          else re._fullInput = re, re._expandedInput = re, Z2(re);
          i.traceIs(re, "carpetAxis") && (ne[re.carpet] = re), i.traceIs(re, "carpetDependent") && ae.push(q);
        }
        for (q = 0; q < ae.length; q++) if ((re = X2[ae[q]]).visible) {
          var be = ne[re.carpet];
          re._carpet = be, be && be.visible ? (re.xaxis = be.xaxis, re.yaxis = be.yaxis) : re.visible = false;
        }
      }, y.supplyAnimationDefaults = function(W2) {
        var X2;
        W2 = W2 || {};
        var Y2 = {};
        function K2(q, re) {
          return c.coerce(W2 || {}, Y2, v, q, re);
        }
        if (K2("mode"), K2("direction"), K2("fromcurrent"), Array.isArray(W2.frame)) for (Y2.frame = [], X2 = 0; X2 < W2.frame.length; X2++) Y2.frame[X2] = y.supplyAnimationFrameDefaults(W2.frame[X2] || {});
        else Y2.frame = y.supplyAnimationFrameDefaults(W2.frame || {});
        if (Array.isArray(W2.transition)) for (Y2.transition = [], X2 = 0; X2 < W2.transition.length; X2++) Y2.transition[X2] = y.supplyAnimationTransitionDefaults(W2.transition[X2] || {});
        else Y2.transition = y.supplyAnimationTransitionDefaults(W2.transition || {});
        return Y2;
      }, y.supplyAnimationFrameDefaults = function(W2) {
        var X2 = {};
        function Y2(K2, q) {
          return c.coerce(W2 || {}, X2, v.frame, K2, q);
        }
        return Y2("duration"), Y2("redraw"), X2;
      }, y.supplyAnimationTransitionDefaults = function(W2) {
        var X2 = {};
        function Y2(K2, q) {
          return c.coerce(W2 || {}, X2, v.transition, K2, q);
        }
        return Y2("duration"), Y2("easing"), X2;
      }, y.supplyFrameDefaults = function(W2) {
        var X2 = {};
        function Y2(K2, q) {
          return c.coerce(W2, X2, m, K2, q);
        }
        return Y2("group"), Y2("name"), Y2("traces"), Y2("baseframe"), Y2("data"), Y2("layout"), X2;
      }, y.supplyTraceDefaults = function(W2, X2, Y2, K2, q) {
        var re, R2 = K2.colorway || f.defaults, z = R2[Y2 % R2.length];
        function H2(se, he) {
          return c.coerce(W2, X2, y.attributes, se, he);
        }
        var te = H2("visible");
        H2("type"), H2("name", K2._traceWord + " " + q), H2("uirevision", K2.uirevision);
        var j = y.getModule(X2);
        if (X2._module = j, j) {
          var Q2 = j.basePlotModule, Z2 = Q2.attr, ne = Q2.attributes;
          if (Z2 && ne) {
            var ae = K2._subplots, ue = "";
            if (te || Q2.name !== "gl2d") {
              if (Array.isArray(Z2)) for (re = 0; re < Z2.length; re++) {
                var le = Z2[re], ce = c.coerce(W2, X2, ne, le);
                ae[le] && c.pushUnique(ae[le], ce), ue += ce;
              }
              else ue = c.coerce(W2, X2, ne, Z2);
              ae[Q2.name] && c.pushUnique(ae[Q2.name], ue);
            }
          }
        }
        return te && (H2("customdata"), H2("ids"), H2("meta"), i.traceIs(X2, "showLegend") ? (c.coerce(W2, X2, j.attributes.showlegend ? j.attributes : y.attributes, "showlegend"), H2("legendgroup"), H2("legendgrouptitle.text"), H2("legendrank"), X2._dfltShowLegend = true) : X2._dfltShowLegend = false, j && j.supplyDefaults(W2, X2, z, K2), i.traceIs(X2, "noOpacity") || H2("opacity"), i.traceIs(X2, "notLegendIsolatable") && (X2.visible = !!X2.visible), i.traceIs(X2, "noHover") || (X2.hovertemplate || c.coerceHoverinfo(W2, X2, K2), X2.type !== "parcats" && i.getComponentMethod("fx", "supplyDefaults")(W2, X2, z, K2)), j && j.selectPoints && H2("selectedpoints"), y.supplyTransformDefaults(W2, X2, K2)), X2;
      }, y.hasMakesDataTransform = C2, y.supplyTransformDefaults = function(W2, X2, Y2) {
        if (X2._length || C2(W2)) {
          var K2 = Y2._globalTransforms || [], q = Y2._transformModules || [];
          if (Array.isArray(W2.transforms) || K2.length !== 0) for (var re = W2.transforms || [], R2 = K2.concat(re), z = X2.transforms = [], H2 = 0; H2 < R2.length; H2++) {
            var te, j = R2[H2], Q2 = j.type, Z2 = w[Q2], ne = !(j._module && j._module === Z2), ae = Z2 && typeof Z2.transform == "function";
            Z2 || c.warn("Unrecognized transform type " + Q2 + "."), Z2 && Z2.supplyDefaults && (ne || ae) ? ((te = Z2.supplyDefaults(j, X2, Y2, W2)).type = Q2, te._module = Z2, c.pushUnique(q, Z2)) : te = c.extendFlat({}, j), z.push(te);
          }
        }
      }, y.supplyLayoutGlobalDefaults = function(W2, X2, Y2) {
        function K2(H2, te) {
          return c.coerce(W2, X2, y.layoutAttributes, H2, te);
        }
        var q = W2.template;
        c.isPlainObject(q) && (X2.template = q, X2._template = q.layout, X2._dataTemplate = q.data), K2("autotypenumbers");
        var re = c.coerceFont(K2, "font"), R2 = re.size;
        c.coerceFont(K2, "title.font", c.extendFlat({}, re, { size: Math.round(1.4 * R2) })), K2("title.text", X2._dfltTitle.plot), K2("title.xref"), K2("title.yref"), K2("title.x"), K2("title.y"), K2("title.xanchor"), K2("title.yanchor"), K2("title.pad.t"), K2("title.pad.r"), K2("title.pad.b"), K2("title.pad.l"), K2("uniformtext.mode") && K2("uniformtext.minsize"), K2("autosize", !(W2.width && W2.height)), K2("width"), K2("height"), K2("margin.l"), K2("margin.r"), K2("margin.t"), K2("margin.b"), K2("margin.pad"), K2("margin.autoexpand"), W2.width && W2.height && y.sanitizeMargins(X2), i.getComponentMethod("grid", "sizeDefaults")(W2, X2), K2("paper_bgcolor"), K2("separators", Y2.decimal + Y2.thousands), K2("hidesources"), K2("colorway"), K2("datarevision");
        var z = K2("uirevision");
        K2("editrevision", z), K2("selectionrevision", z), i.getComponentMethod("modebar", "supplyLayoutDefaults")(W2, X2), i.getComponentMethod("shapes", "supplyDrawNewShapeDefaults")(W2, X2, K2), K2("meta"), c.isPlainObject(W2.transition) && (K2("transition.duration"), K2("transition.easing"), K2("transition.ordering")), i.getComponentMethod("calendars", "handleDefaults")(W2, X2, "calendar"), i.getComponentMethod("fx", "supplyLayoutGlobalDefaults")(W2, X2, K2);
      }, y.plotAutoSize = function(W2, X2, Y2) {
        var K2, q, re = W2._context || {}, R2 = re.frameMargins, z = c.isPlotDiv(W2);
        if (z && W2.emit("plotly_autosize"), re.fillFrame) K2 = window.innerWidth, q = window.innerHeight, document.body.style.overflow = "hidden";
        else {
          var H2 = z ? window.getComputedStyle(W2) : {};
          if (K2 = F13(H2.width) || F13(H2.maxWidth) || Y2.width, q = F13(H2.height) || F13(H2.maxHeight) || Y2.height, s(R2) && R2 > 0) {
            var te = 1 - 2 * R2;
            K2 = Math.round(te * K2), q = Math.round(te * q);
          }
        }
        var j = y.layoutAttributes.width.min, Q2 = y.layoutAttributes.height.min;
        K2 < j && (K2 = j), q < Q2 && (q = Q2);
        var Z2 = !X2.width && Math.abs(Y2.width - K2) > 1, ne = !X2.height && Math.abs(Y2.height - q) > 1;
        (ne || Z2) && (Z2 && (Y2.width = K2), ne && (Y2.height = q)), W2._initialAutoSize || (W2._initialAutoSize = { width: K2, height: q }), y.sanitizeMargins(Y2);
      }, y.supplyLayoutModuleDefaults = function(W2, X2, Y2, K2) {
        var q, re, R2, z = i.componentsRegistry, H2 = X2._basePlotModules, te = i.subplotsRegistry.cartesian;
        for (q in z) (R2 = z[q]).includeBasePlot && R2.includeBasePlot(W2, X2);
        for (var j in H2.length || H2.push(te), X2._has("cartesian") && (i.getComponentMethod("grid", "contentDefaults")(W2, X2), te.finalizeSubplots(W2, X2)), X2._subplots) X2._subplots[j].sort(c.subplotSort);
        for (re = 0; re < H2.length; re++) (R2 = H2[re]).supplyLayoutDefaults && R2.supplyLayoutDefaults(W2, X2, Y2);
        var Q2 = X2._modules;
        for (re = 0; re < Q2.length; re++) (R2 = Q2[re]).supplyLayoutDefaults && R2.supplyLayoutDefaults(W2, X2, Y2);
        var Z2 = X2._transformModules;
        for (re = 0; re < Z2.length; re++) (R2 = Z2[re]).supplyLayoutDefaults && R2.supplyLayoutDefaults(W2, X2, Y2, K2);
        for (q in z) (R2 = z[q]).supplyLayoutDefaults && R2.supplyLayoutDefaults(W2, X2, Y2);
      }, y.purge = function(W2) {
        var X2 = W2._fullLayout || {};
        X2._glcontainer !== void 0 && (X2._glcontainer.selectAll(".gl-canvas").remove(), X2._glcontainer.remove(), X2._glcanvas = null), X2._modeBar && X2._modeBar.destroy(), W2._transitionData && (W2._transitionData._interruptCallbacks && (W2._transitionData._interruptCallbacks.length = 0), W2._transitionData._animationRaf && window.cancelAnimationFrame(W2._transitionData._animationRaf)), c.clearThrottle(), c.clearResponsive(W2), delete W2.data, delete W2.layout, delete W2._fullData, delete W2._fullLayout, delete W2.calcdata, delete W2.empty, delete W2.fid, delete W2.undoqueue, delete W2.undonum, delete W2.autoplay, delete W2.changed, delete W2._promises, delete W2._redrawTimer, delete W2._hmlumcount, delete W2._hmpixcount, delete W2._transitionData, delete W2._transitioning, delete W2._initialAutoSize, delete W2._transitioningWithDuration, delete W2._dragging, delete W2._dragged, delete W2._dragdata, delete W2._hoverdata, delete W2._snapshotInProgress, delete W2._editing, delete W2._mouseDownTime, delete W2._legendMouseDownTime, W2.removeAllListeners && W2.removeAllListeners();
      }, y.style = function(W2) {
        var X2, Y2 = W2._fullLayout._visibleModules, K2 = [];
        for (X2 = 0; X2 < Y2.length; X2++) {
          var q = Y2[X2];
          q.style && c.pushUnique(K2, q.style);
        }
        for (X2 = 0; X2 < K2.length; X2++) K2[X2](W2);
      }, y.sanitizeMargins = function(W2) {
        if (W2 && W2.margin) {
          var X2, Y2 = W2.width, K2 = W2.height, q = W2.margin, re = Y2 - (q.l + q.r), R2 = K2 - (q.t + q.b);
          re < 0 && (X2 = (Y2 - 1) / (q.l + q.r), q.l = Math.floor(X2 * q.l), q.r = Math.floor(X2 * q.r)), R2 < 0 && (X2 = (K2 - 1) / (q.t + q.b), q.t = Math.floor(X2 * q.t), q.b = Math.floor(X2 * q.b));
        }
      }, y.clearAutoMarginIds = function(W2) {
        W2._fullLayout._pushmarginIds = {};
      }, y.allowAutoMargin = function(W2, X2) {
        W2._fullLayout._pushmarginIds[X2] = 1;
      }, y.autoMargin = function(W2, X2, Y2) {
        var K2 = W2._fullLayout, q = K2.width, re = K2.height, R2 = K2.margin, z = c.constrain(q - R2.l - R2.r, 2, 64), H2 = c.constrain(re - R2.t - R2.b, 2, 64), te = Math.max(0, q - z), j = Math.max(0, re - H2), Q2 = K2._pushmargin, Z2 = K2._pushmarginIds;
        if (R2.autoexpand !== false) {
          if (Y2) {
            var ne = Y2.pad;
            if (ne === void 0 && (ne = Math.min(12, R2.l, R2.r, R2.t, R2.b)), te) {
              var ae = (Y2.l + Y2.r) / te;
              ae > 1 && (Y2.l /= ae, Y2.r /= ae);
            }
            if (j) {
              var ue = (Y2.t + Y2.b) / j;
              ue > 1 && (Y2.t /= ue, Y2.b /= ue);
            }
            var le = Y2.xl !== void 0 ? Y2.xl : Y2.x, ce = Y2.xr !== void 0 ? Y2.xr : Y2.x, se = Y2.yt !== void 0 ? Y2.yt : Y2.y, he = Y2.yb !== void 0 ? Y2.yb : Y2.y;
            Q2[X2] = { l: { val: le, size: Y2.l + ne }, r: { val: ce, size: Y2.r + ne }, b: { val: he, size: Y2.b + ne }, t: { val: se, size: Y2.t + ne } }, Z2[X2] = 1;
          } else delete Q2[X2], delete Z2[X2];
          if (!K2._replotting) return y.doAutoMargin(W2);
        }
      }, y.doAutoMargin = function(W2) {
        var X2 = W2._fullLayout, Y2 = X2.width, K2 = X2.height;
        X2._size || (X2._size = {}), N2(X2);
        var q = X2._size, re = X2.margin, R2 = c.extendFlat({}, q), z = re.l, H2 = re.r, te = re.t, j = re.b, Q2 = X2._pushmargin, Z2 = X2._pushmarginIds;
        if (X2.margin.autoexpand !== false) {
          for (var ne in Q2) Z2[ne] || delete Q2[ne];
          for (var ae in Q2.base = { l: { val: 0, size: z }, r: { val: 1, size: H2 }, t: { val: 1, size: te }, b: { val: 0, size: j } }, Q2) {
            var ue = Q2[ae].l || {}, le = Q2[ae].b || {}, ce = ue.val, se = ue.size, he = le.val, me = le.size;
            for (var we in Q2) {
              if (s(se) && Q2[we].r) {
                var be = Q2[we].r.val, Ae = Q2[we].r.size;
                if (be > ce) {
                  var pe = (se * be + (Ae - Y2) * ce) / (be - ce), ve = (Ae * (1 - ce) + (se - Y2) * (1 - be)) / (be - ce);
                  pe + ve > z + H2 && (z = pe, H2 = ve);
                }
              }
              if (s(me) && Q2[we].t) {
                var Ee = Q2[we].t.val, Se = Q2[we].t.size;
                if (Ee > he) {
                  var Ce = (me * Ee + (Se - K2) * he) / (Ee - he), Be = (Se * (1 - he) + (me - K2) * (1 - Ee)) / (Ee - he);
                  Ce + Be > j + te && (j = Ce, te = Be);
                }
              }
            }
          }
        }
        var Ue = c.constrain(Y2 - re.l - re.r, 2, 64), Ke = c.constrain(K2 - re.t - re.b, 2, 64), ct = Math.max(0, Y2 - Ue), We = Math.max(0, K2 - Ke);
        if (ct) {
          var Ze = (z + H2) / ct;
          Ze > 1 && (z /= Ze, H2 /= Ze);
        }
        if (We) {
          var it = (j + te) / We;
          it > 1 && (j /= it, te /= it);
        }
        if (q.l = Math.round(z), q.r = Math.round(H2), q.t = Math.round(te), q.b = Math.round(j), q.p = Math.round(re.pad), q.w = Math.round(Y2) - q.l - q.r, q.h = Math.round(K2) - q.t - q.b, !X2._replotting && y.didMarginChange(R2, q)) {
          "_redrawFromAutoMarginCount" in X2 ? X2._redrawFromAutoMarginCount++ : X2._redrawFromAutoMarginCount = 1;
          var ot = 3 * (1 + Object.keys(Z2).length);
          if (X2._redrawFromAutoMarginCount < ot) return i.call("_doPlot", W2);
          X2._size = R2, c.warn("Too many auto-margin redraws.");
        }
        (function(mt) {
          var wt = p.list(mt, "", true);
          ["_adjustTickLabelsOverflow", "_hideCounterAxisInsideTickLabels"].forEach(function(Et) {
            for (var zt = 0; zt < wt.length; zt++) {
              var Nt = wt[zt][Et];
              Nt && Nt();
            }
          });
        })(W2);
      };
      var D2 = ["l", "r", "t", "b", "p", "w", "h"];
      function I2(W2, X2, Y2) {
        var K2 = false, q = [y.previousPromises, function() {
          if (W2._transitionData) return W2._transitioning = false, function(R2) {
            var z = Promise.resolve();
            if (!R2) return z;
            for (; R2.length; ) z = z.then(R2.shift());
            return z;
          }(W2._transitionData._interruptCallbacks);
        }, Y2.prepareFn, y.rehover, function() {
          return W2.emit("plotly_transitioning", []), new Promise(function(R2) {
            W2._transitioning = true, X2.duration > 0 && (W2._transitioningWithDuration = true), W2._transitionData._interruptCallbacks.push(function() {
              K2 = true;
            }), Y2.redraw && W2._transitionData._interruptCallbacks.push(function() {
              return i.call("redraw", W2);
            }), W2._transitionData._interruptCallbacks.push(function() {
              W2.emit("plotly_transitioninterrupted", []);
            });
            var z = 0, H2 = 0;
            function te() {
              return z++, function() {
                H2++, K2 || H2 !== z || function(j) {
                  !W2._transitionData || (function(Q2) {
                    if (Q2) for (; Q2.length; ) Q2.shift();
                  }(W2._transitionData._interruptCallbacks), Promise.resolve().then(function() {
                    if (Y2.redraw) return i.call("redraw", W2);
                  }).then(function() {
                    W2._transitioning = false, W2._transitioningWithDuration = false, W2.emit("plotly_transitioned", []);
                  }).then(j));
                }(R2);
              };
            }
            Y2.runFn(te), setTimeout(te());
          });
        }], re = c.syncOrAsync(q, W2);
        return re && re.then || (re = Promise.resolve()), re.then(function() {
          return W2;
        });
      }
      y.didMarginChange = function(W2, X2) {
        for (var Y2 = 0; Y2 < D2.length; Y2++) {
          var K2 = D2[Y2], q = W2[K2], re = X2[K2];
          if (!s(q) || Math.abs(re - q) > 1) return true;
        }
        return false;
      }, y.graphJson = function(W2, X2, Y2, K2, q, re) {
        (q && X2 && !W2._fullData || q && !X2 && !W2._fullLayout) && y.supplyDefaults(W2);
        var R2 = q ? W2._fullData : W2.data, z = q ? W2._fullLayout : W2.layout, H2 = (W2._transitionData || {})._frames;
        function te(Z2, ne) {
          if (typeof Z2 == "function") return ne ? "_function_" : null;
          if (c.isPlainObject(Z2)) {
            var ae, ue = {};
            return Object.keys(Z2).sort().forEach(function(le) {
              if (["_", "["].indexOf(le.charAt(0)) === -1) if (typeof Z2[le] != "function") {
                if (Y2 === "keepdata") {
                  if (le.substr(le.length - 3) === "src") return;
                } else if (Y2 === "keepstream") {
                  if (typeof (ae = Z2[le + "src"]) == "string" && ae.indexOf(":") > 0 && !c.isPlainObject(Z2.stream)) return;
                } else if (Y2 !== "keepall" && typeof (ae = Z2[le + "src"]) == "string" && ae.indexOf(":") > 0) return;
                ue[le] = te(Z2[le], ne);
              } else ne && (ue[le] = "_function");
            }), ue;
          }
          return Array.isArray(Z2) ? Z2.map(function(le) {
            return te(le, ne);
          }) : c.isTypedArray(Z2) ? c.simpleMap(Z2, c.identity) : c.isJSDate(Z2) ? c.ms2DateTimeLocal(+Z2) : Z2;
        }
        var j = { data: (R2 || []).map(function(Z2) {
          var ne = te(Z2);
          return X2 && delete ne.fit, ne;
        }) };
        if (!X2 && (j.layout = te(z), q)) {
          var Q2 = z._size;
          j.layout.computed = { margin: { b: Q2.b, l: Q2.l, r: Q2.r, t: Q2.t } };
        }
        return H2 && (j.frames = te(H2)), re && (j.config = te(W2._context, true)), K2 === "object" ? j : JSON.stringify(j);
      }, y.modifyFrames = function(W2, X2) {
        var Y2, K2, q, re = W2._transitionData._frames, R2 = W2._transitionData._frameHash;
        for (Y2 = 0; Y2 < X2.length; Y2++) switch ((K2 = X2[Y2]).type) {
          case "replace":
            q = K2.value;
            var z = (re[K2.index] || {}).name, H2 = q.name;
            re[K2.index] = R2[H2] = q, H2 !== z && (delete R2[z], R2[H2] = q);
            break;
          case "insert":
            R2[(q = K2.value).name] = q, re.splice(K2.index, 0, q);
            break;
          case "delete":
            delete R2[(q = re[K2.index]).name], re.splice(K2.index, 1);
        }
        return Promise.resolve();
      }, y.computeFrame = function(W2, X2) {
        var Y2, K2, q, re, R2 = W2._transitionData._frameHash;
        if (!X2) throw new Error("computeFrame must be given a string frame name");
        var z = R2[X2.toString()];
        if (!z) return false;
        for (var H2 = [z], te = [z.name]; z.baseframe && (z = R2[z.baseframe.toString()]) && te.indexOf(z.name) === -1; ) H2.push(z), te.push(z.name);
        for (var j = {}; z = H2.pop(); ) if (z.layout && (j.layout = y.extendLayout(j.layout, z.layout)), z.data) {
          if (j.data || (j.data = []), !(K2 = z.traces)) for (K2 = [], Y2 = 0; Y2 < z.data.length; Y2++) K2[Y2] = Y2;
          for (j.traces || (j.traces = []), Y2 = 0; Y2 < z.data.length; Y2++) (q = K2[Y2]) != null && ((re = j.traces.indexOf(q)) === -1 && (re = j.data.length, j.traces[re] = q), j.data[re] = y.extendTrace(j.data[re], z.data[Y2]));
        }
        return j;
      }, y.recomputeFrameHash = function(W2) {
        for (var X2 = W2._transitionData._frameHash = {}, Y2 = W2._transitionData._frames, K2 = 0; K2 < Y2.length; K2++) {
          var q = Y2[K2];
          q && q.name && (X2[q.name] = q);
        }
      }, y.extendObjectWithContainers = function(W2, X2, Y2) {
        var K2, q, re, R2, z, H2, te, j = c.extendDeepNoArrays({}, X2 || {}), Q2 = c.expandObjectPaths(j), Z2 = {};
        if (Y2 && Y2.length) for (re = 0; re < Y2.length; re++) (q = (K2 = c.nestedProperty(Q2, Y2[re])).get()) === void 0 ? c.nestedProperty(Z2, Y2[re]).set(null) : (K2.set(null), c.nestedProperty(Z2, Y2[re]).set(q));
        if (W2 = c.extendDeepNoArrays(W2 || {}, Q2), Y2 && Y2.length) {
          for (re = 0; re < Y2.length; re++) if (H2 = c.nestedProperty(Z2, Y2[re]).get()) {
            for (te = (z = c.nestedProperty(W2, Y2[re])).get(), Array.isArray(te) || (te = [], z.set(te)), R2 = 0; R2 < H2.length; R2++) {
              var ne = H2[R2];
              te[R2] = ne === null ? null : y.extendObjectWithContainers(te[R2], ne);
            }
            z.set(te);
          }
        }
        return W2;
      }, y.dataArrayContainers = ["transforms", "dimensions"], y.layoutArrayContainers = i.layoutArrayContainers, y.extendTrace = function(W2, X2) {
        return y.extendObjectWithContainers(W2, X2, y.dataArrayContainers);
      }, y.extendLayout = function(W2, X2) {
        return y.extendObjectWithContainers(W2, X2, y.layoutArrayContainers);
      }, y.transition = function(W2, X2, Y2, K2, q, re) {
        var R2 = { redraw: q.redraw }, z = {}, H2 = [];
        return R2.prepareFn = function() {
          for (var te = Array.isArray(X2) ? X2.length : 0, j = K2.slice(0, te), Q2 = 0; Q2 < j.length; Q2++) {
            var Z2 = j[Q2], ne = W2._fullData[Z2]._module;
            if (ne) {
              if (ne.animatable) {
                var ae = ne.basePlotModule.name;
                z[ae] || (z[ae] = []), z[ae].push(Z2);
              }
              W2.data[j[Q2]] = y.extendTrace(W2.data[j[Q2]], X2[Q2]);
            }
          }
          var ue = c.expandObjectPaths(c.extendDeepNoArrays({}, Y2)), le = /^[xy]axis[0-9]*$/;
          for (var ce in ue) le.test(ce) && delete ue[ce].range;
          y.extendLayout(W2.layout, ue), delete W2.calcdata, y.supplyDefaults(W2), y.doCalcdata(W2);
          var se = c.expandObjectPaths(Y2);
          if (se) {
            var he = W2._fullLayout._plots;
            for (var me in he) {
              var we = he[me], be = we.xaxis, Ae = we.yaxis, pe = be.range.slice(), ve = Ae.range.slice(), Ee = null, Se = null, Ce = null, Be = null;
              Array.isArray(se[be._name + ".range"]) ? Ee = se[be._name + ".range"].slice() : Array.isArray((se[be._name] || {}).range) && (Ee = se[be._name].range.slice()), Array.isArray(se[Ae._name + ".range"]) ? Se = se[Ae._name + ".range"].slice() : Array.isArray((se[Ae._name] || {}).range) && (Se = se[Ae._name].range.slice()), pe && Ee && (be.r2l(pe[0]) !== be.r2l(Ee[0]) || be.r2l(pe[1]) !== be.r2l(Ee[1])) && (Ce = { xr0: pe, xr1: Ee }), ve && Se && (Ae.r2l(ve[0]) !== Ae.r2l(Se[0]) || Ae.r2l(ve[1]) !== Ae.r2l(Se[1])) && (Be = { yr0: ve, yr1: Se }), (Ce || Be) && H2.push(c.extendFlat({ plotinfo: we }, Ce, Be));
            }
          }
          return Promise.resolve();
        }, R2.runFn = function(te) {
          var j, Q2, Z2 = W2._fullLayout._basePlotModules, ne = H2.length;
          if (Y2) for (Q2 = 0; Q2 < Z2.length; Q2++) Z2[Q2].transitionAxes && Z2[Q2].transitionAxes(W2, H2, re, te);
          for (var ae in ne ? ((j = c.extendFlat({}, re)).duration = 0, delete z.cartesian) : j = re, z) {
            var ue = z[ae];
            W2._fullData[ue[0]]._module.basePlotModule.plot(W2, ue, j, te);
          }
        }, I2(W2, re, R2);
      }, y.transitionFromReact = function(W2, X2, Y2, K2) {
        var q = W2._fullLayout, re = q.transition, R2 = {}, z = [];
        return R2.prepareFn = function() {
          var H2 = q._plots;
          for (var te in R2.redraw = false, X2.anim === "some" && (R2.redraw = true), Y2.anim === "some" && (R2.redraw = true), H2) {
            var j = H2[te], Q2 = j.xaxis, Z2 = j.yaxis, ne = K2[Q2._name].range.slice(), ae = K2[Z2._name].range.slice(), ue = Q2.range.slice(), le = Z2.range.slice();
            Q2.setScale(), Z2.setScale();
            var ce = null, se = null;
            Q2.r2l(ne[0]) === Q2.r2l(ue[0]) && Q2.r2l(ne[1]) === Q2.r2l(ue[1]) || (ce = { xr0: ne, xr1: ue }), Z2.r2l(ae[0]) === Z2.r2l(le[0]) && Z2.r2l(ae[1]) === Z2.r2l(le[1]) || (se = { yr0: ae, yr1: le }), (ce || se) && z.push(c.extendFlat({ plotinfo: j }, ce, se));
          }
          return Promise.resolve();
        }, R2.runFn = function(H2) {
          for (var te, j, Q2, Z2 = W2._fullData, ne = W2._fullLayout._basePlotModules, ae = [], ue = 0; ue < Z2.length; ue++) ae.push(ue);
          function le() {
            if (W2._fullLayout) for (var se = 0; se < ne.length; se++) ne[se].transitionAxes && ne[se].transitionAxes(W2, z, te, H2);
          }
          function ce() {
            if (W2._fullLayout) for (var se = 0; se < ne.length; se++) ne[se].plot(W2, Q2, j, H2);
          }
          z.length && X2.anim ? re.ordering === "traces first" ? (te = c.extendFlat({}, re, { duration: 0 }), Q2 = ae, j = re, setTimeout(le, re.duration), ce()) : (te = re, Q2 = null, j = c.extendFlat({}, re, { duration: 0 }), setTimeout(ce, te.duration), le()) : z.length ? (te = re, le()) : X2.anim && (Q2 = ae, j = re, ce());
        }, I2(W2, re, R2);
      }, y.doCalcdata = function(W2, X2) {
        var Y2, K2, q, re, R2 = p.list(W2), z = W2._fullData, H2 = W2._fullLayout, te = new Array(z.length), j = (W2.calcdata || []).slice();
        for (W2.calcdata = te, H2._numBoxes = 0, H2._numViolins = 0, H2._violinScaleGroupStats = {}, W2._hmpixcount = 0, W2._hmlumcount = 0, H2._piecolormap = {}, H2._sunburstcolormap = {}, H2._treemapcolormap = {}, H2._iciclecolormap = {}, H2._funnelareacolormap = {}, q = 0; q < z.length; q++) Array.isArray(X2) && X2.indexOf(q) === -1 && (te[q] = j[q]);
        for (q = 0; q < z.length; q++) (Y2 = z[q])._arrayAttrs = l.findArrayAttributes(Y2), Y2._extremes = {};
        var Q2 = H2._subplots.polar || [];
        for (q = 0; q < Q2.length; q++) R2.push(H2[Q2[q]].radialaxis, H2[Q2[q]].angularaxis);
        for (var Z2 in H2._colorAxes) {
          var ne = H2[Z2];
          ne.cauto !== false && (delete ne.cmin, delete ne.cmax);
        }
        var ae = false;
        function ue(se) {
          if (Y2 = z[se], K2 = Y2._module, Y2.visible === true && Y2.transforms) {
            if (K2 && K2.calc) {
              var he = K2.calc(W2, Y2);
              he[0] && he[0].t && he[0].t._scene && delete he[0].t._scene.dirty;
            }
            for (re = 0; re < Y2.transforms.length; re++) {
              var me = Y2.transforms[re];
              (K2 = w[me.type]) && K2.calcTransform && (Y2._hasCalcTransform = true, ae = true, K2.calcTransform(W2, Y2, me));
            }
          }
        }
        function le(se, he) {
          if (Y2 = z[se], !!(K2 = Y2._module).isContainer === he) {
            var me = [];
            if (Y2.visible === true && Y2._length !== 0) {
              delete Y2._indexToPoints;
              var we = Y2.transforms || [];
              for (re = we.length - 1; re >= 0; re--) if (we[re].enabled) {
                Y2._indexToPoints = we[re]._indexToPoints;
                break;
              }
              K2 && K2.calc && (me = K2.calc(W2, Y2));
            }
            Array.isArray(me) && me[0] || (me = [{ x: h, y: h }]), me[0].t || (me[0].t = {}), me[0].trace = Y2, te[se] = me;
          }
        }
        for (L2(R2, z, H2), q = 0; q < z.length; q++) le(q, true);
        for (q = 0; q < z.length; q++) ue(q);
        for (ae && L2(R2, z, H2), q = 0; q < z.length; q++) le(q, true);
        for (q = 0; q < z.length; q++) le(q, false);
        V2(W2);
        var ce = function(se, he) {
          var me, we, be, Ae, pe, ve = [];
          function Ee(st, Ie, Pe) {
            var $e = Ie._id.charAt(0);
            if (st === "histogram2dcontour") {
              var Ve = Ie._counterAxes[0], ut = p.getFromId(he, Ve), Re = $e === "x" || Ve === "x" && ut.type === "category", qe = $e === "y" || Ve === "y" && ut.type === "category";
              return function(je, rt) {
                return je === 0 || rt === 0 || Re && je === Pe[rt].length - 1 || qe && rt === Pe.length - 1 ? -1 : ($e === "y" ? rt : je) - 1;
              };
            }
            return function(je, rt) {
              return $e === "y" ? rt : je;
            };
          }
          var Se = { min: function(st) {
            return c.aggNums(Math.min, null, st);
          }, max: function(st) {
            return c.aggNums(Math.max, null, st);
          }, sum: function(st) {
            return c.aggNums(function(Ie, Pe) {
              return Ie + Pe;
            }, null, st);
          }, total: function(st) {
            return c.aggNums(function(Ie, Pe) {
              return Ie + Pe;
            }, null, st);
          }, mean: function(st) {
            return c.mean(st);
          }, median: function(st) {
            return c.median(st);
          } };
          for (me = 0; me < se.length; me++) {
            var Ce = se[me];
            if (Ce.type === "category") {
              var Be = Ce.categoryorder.match(O2);
              if (Be) {
                var Ue = Be[1], Ke = Be[2], ct = Ce._id.charAt(0), We = ct === "x", Ze = [];
                for (we = 0; we < Ce._categories.length; we++) Ze.push([Ce._categories[we], []]);
                for (we = 0; we < Ce._traceIndices.length; we++) {
                  var it = Ce._traceIndices[we], ot = he._fullData[it];
                  if (ot.visible === true) {
                    var mt = ot.type;
                    i.traceIs(ot, "histogram") && (delete ot._xautoBinFinished, delete ot._yautoBinFinished);
                    var wt = mt === "splom", Et = mt === "scattergl", zt = he.calcdata[it];
                    for (be = 0; be < zt.length; be++) {
                      var Nt, yt, pt = zt[be];
                      if (wt) {
                        var Ot = ot._axesDim[Ce._id];
                        if (!We) {
                          var Jt = ot._diag[Ot][0];
                          Jt && (Ce = he._fullLayout[p.id2name(Jt)]);
                        }
                        var tr = pt.trace.dimensions[Ot].values;
                        for (Ae = 0; Ae < tr.length; Ae++) for (Nt = Ce._categoriesMap[tr[Ae]], pe = 0; pe < pt.trace.dimensions.length; pe++) if (pe !== Ot) {
                          var Ye = pt.trace.dimensions[pe];
                          Ze[Nt][1].push(Ye.values[Ae]);
                        }
                      } else if (Et) {
                        for (Ae = 0; Ae < pt.t.x.length; Ae++) We ? (Nt = pt.t.x[Ae], yt = pt.t.y[Ae]) : (Nt = pt.t.y[Ae], yt = pt.t.x[Ae]), Ze[Nt][1].push(yt);
                        pt.t && pt.t._scene && delete pt.t._scene.dirty;
                      } else if (pt.hasOwnProperty("z")) {
                        yt = pt.z;
                        var at = Ee(ot.type, Ce, yt);
                        for (Ae = 0; Ae < yt.length; Ae++) for (pe = 0; pe < yt[Ae].length; pe++) (Nt = at(pe, Ae)) + 1 && Ze[Nt][1].push(yt[Ae][pe]);
                      } else for ((Nt = pt.p) === void 0 && (Nt = pt[ct]), (yt = pt.s) === void 0 && (yt = pt.v), yt === void 0 && (yt = We ? pt.y : pt.x), Array.isArray(yt) || (yt = yt === void 0 ? [] : [yt]), Ae = 0; Ae < yt.length; Ae++) Ze[Nt][1].push(yt[Ae]);
                    }
                  }
                }
                Ce._categoriesValue = Ze;
                var Ge = [];
                for (we = 0; we < Ze.length; we++) Ge.push([Ze[we][0], Se[Ue](Ze[we][1])]);
                Ge.sort(function(st, Ie) {
                  return st[1] - Ie[1];
                }), Ce._categoriesAggregatedValue = Ge, Ce._initialCategories = Ge.map(function(st) {
                  return st[0];
                }), Ke === "descending" && Ce._initialCategories.reverse(), ve = ve.concat(Ce.sortByInitialCategories());
              }
            }
          }
          return ve;
        }(R2, W2);
        if (ce.length) {
          for (H2._numBoxes = 0, H2._numViolins = 0, q = 0; q < ce.length; q++) le(ce[q], true);
          for (q = 0; q < ce.length; q++) le(ce[q], false);
          V2(W2);
        }
        i.getComponentMethod("fx", "calc")(W2), i.getComponentMethod("errorbars", "calc")(W2);
      };
      var O2 = /(total|sum|min|max|mean|median) (ascending|descending)/;
      function L2(W2, X2, Y2) {
        var K2 = {};
        function q(H2) {
          H2.clearCalc(), H2.type === "multicategory" && H2.setupMultiCategory(X2), K2[H2._id] = 1;
        }
        c.simpleMap(W2, q);
        for (var re = Y2._axisMatchGroups || [], R2 = 0; R2 < re.length; R2++) for (var z in re[R2]) K2[z] || q(Y2[p.id2name(z)]);
      }
      function V2(W2) {
        var X2, Y2, K2, q = W2._fullLayout, re = q._visibleModules, R2 = {};
        for (Y2 = 0; Y2 < re.length; Y2++) {
          var z = re[Y2], H2 = z.crossTraceCalc;
          if (H2) {
            var te = z.basePlotModule.name;
            R2[te] ? c.pushUnique(R2[te], H2) : R2[te] = [H2];
          }
        }
        for (K2 in R2) {
          var j = R2[K2], Q2 = q._subplots[K2];
          if (Array.isArray(Q2)) for (X2 = 0; X2 < Q2.length; X2++) {
            var Z2 = Q2[X2], ne = K2 === "cartesian" ? q._plots[Z2] : q[Z2];
            for (Y2 = 0; Y2 < j.length; Y2++) j[Y2](W2, ne, Z2);
          }
          else for (Y2 = 0; Y2 < j.length; Y2++) j[Y2](W2);
        }
      }
      y.rehover = function(W2) {
        W2._fullLayout._rehover && W2._fullLayout._rehover();
      }, y.redrag = function(W2) {
        W2._fullLayout._redrag && W2._fullLayout._redrag();
      }, y.generalUpdatePerTraceModule = function(W2, X2, Y2, K2) {
        var q, re = X2.traceHash, R2 = {};
        for (q = 0; q < Y2.length; q++) {
          var z = Y2[q], H2 = z[0].trace;
          H2.visible && (R2[H2.type] = R2[H2.type] || [], R2[H2.type].push(z));
        }
        for (var te in re) if (!R2[te]) {
          var j = re[te][0];
          j[0].trace.visible = false, R2[te] = [j];
        }
        for (var Q2 in R2) {
          var Z2 = R2[Q2];
          Z2[0][0].trace._module.plot(W2, X2, c.filterVisible(Z2), K2);
        }
        X2.traceHash = R2;
      }, y.plotBasePlot = function(W2, X2, Y2, K2, q) {
        var re = i.getModule(W2), R2 = g(X2.calcdata, re)[0];
        re.plot(X2, R2, K2, q);
      }, y.cleanBasePlot = function(W2, X2, Y2, K2, q) {
        var re = q._has && q._has(W2), R2 = Y2._has && Y2._has(W2);
        re && !R2 && q["_" + W2 + "layer"].selectAll("g.trace").remove();
      };
    }, { "../components/color": 366, "../constants/numerical": 479, "../lib": 503, "../plot_api/plot_schema": 542, "../plot_api/plot_template": 543, "../plots/get_data": 593, "../registry": 638, "./animation_attributes": 548, "./attributes": 550, "./cartesian/axis_ids": 558, "./cartesian/handle_outline": 565, "./command": 583, "./font_attributes": 585, "./frame_attributes": 586, "./layout_attributes": 610, "@plotly/d3": 58, "d3-format": 112, "d3-time-format": 120, "fast-isnumeric": 190 }], 620: [function(e, t, r) {
      "use strict";
      t.exports = { attr: "subplot", name: "polar", axisNames: ["angularaxis", "radialaxis"], axisName2dataArray: { angularaxis: "theta", radialaxis: "r" }, layerNames: ["draglayer", "plotbg", "backplot", "angular-grid", "radial-grid", "frontplot", "angular-line", "radial-line", "angular-axis", "radial-axis"], radialDragBoxSize: 50, angularDragBoxSize: 30, cornerLen: 25, cornerHalfWidth: 2, MINDRAG: 8, MINZOOM: 20, OFFEDGE: 20 };
    }, {}], 621: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../lib/polygon").tester, o = n.findIndexOfMin, s = n.isAngleInsideSector, i = n.angleDelta, l = n.angleDist;
      function u2(p, d, v, m) {
        var g, x, b = m[0], y = m[1], w = f(Math.sin(d) - Math.sin(p)), _4 = f(Math.cos(d) - Math.cos(p)), k = Math.tan(v), T2 = f(1 / k), A2 = w / _4, S2 = y - A2 * b;
        return T2 ? w && _4 ? x = k * (g = S2 / (k - A2)) : _4 ? (g = y * T2, x = y) : (g = b, x = b * k) : w && _4 ? (g = 0, x = S2) : _4 ? (g = 0, x = y) : g = x = NaN, [g, x];
      }
      function c(p, d, v, m) {
        return n.isFullCircle([d, v]) ? function(g, x) {
          var b, y = x.length, w = new Array(y + 1);
          for (b = 0; b < y; b++) {
            var _4 = x[b];
            w[b] = [g * Math.cos(_4), g * Math.sin(_4)];
          }
          return w[b] = w[0].slice(), w;
        }(p, m) : function(g, x, b, y) {
          var w, _4, k = y.length, T2 = [];
          function A2(L2) {
            return [g * Math.cos(L2), g * Math.sin(L2)];
          }
          function S2(L2, V2, W2) {
            return u2(L2, V2, W2, A2(L2));
          }
          function C2(L2) {
            return n.mod(L2, k);
          }
          function E2(L2) {
            return s(L2, [x, b]);
          }
          var F13 = o(y, function(L2) {
            return E2(L2) ? l(L2, x) : 1 / 0;
          }), N2 = S2(y[F13], y[C2(F13 - 1)], x);
          for (T2.push(N2), w = F13, _4 = 0; _4 < k; w++, _4++) {
            var D2 = y[C2(w)];
            if (!E2(D2)) break;
            T2.push(A2(D2));
          }
          var I2 = o(y, function(L2) {
            return E2(L2) ? l(L2, b) : 1 / 0;
          }), O2 = S2(y[I2], y[C2(I2 + 1)], b);
          return T2.push(O2), T2.push([0, 0]), T2.push(T2[0].slice()), T2;
        }(p, d, v, m);
      }
      function f(p) {
        return Math.abs(p) > 1e-10 ? p : 0;
      }
      function h(p, d, v) {
        d = d || 0, v = v || 0;
        for (var m = p.length, g = new Array(m), x = 0; x < m; x++) {
          var b = p[x];
          g[x] = [d + b[0], v - b[1]];
        }
        return g;
      }
      t.exports = { isPtInsidePolygon: function(p, d, v, m, g) {
        if (!s(d, m)) return false;
        var x, b;
        v[0] < v[1] ? (x = v[0], b = v[1]) : (x = v[1], b = v[0]);
        var y = a(c(x, m[0], m[1], g)), w = a(c(b, m[0], m[1], g)), _4 = [p * Math.cos(d), p * Math.sin(d)];
        return w.contains(_4) && !y.contains(_4);
      }, findPolygonOffset: function(p, d, v, m) {
        for (var g = 1 / 0, x = 1 / 0, b = c(p, d, v, m), y = 0; y < b.length; y++) {
          var w = b[y];
          g = Math.min(g, w[0]), x = Math.min(x, -w[1]);
        }
        return [g, x];
      }, findEnclosingVertexAngles: function(p, d) {
        var v = o(d, function(g) {
          var x = i(g, p);
          return x > 0 ? x : 1 / 0;
        }), m = n.mod(v + 1, d.length);
        return [d[v], d[m]];
      }, findIntersectionXY: u2, findXYatLength: function(p, d, v, m) {
        var g = -d * v, x = d * d + 1, b = 2 * (d * g - v), y = g * g + v * v - p * p, w = Math.sqrt(b * b - 4 * x * y), _4 = (-b + w) / (2 * x), k = (-b - w) / (2 * x);
        return [[_4, d * _4 + g + m], [k, d * k + g + m]];
      }, clampTiny: f, pathPolygon: function(p, d, v, m, g, x) {
        return "M" + h(c(p, d, v, m), g, x).join("L");
      }, pathPolygonAnnulus: function(p, d, v, m, g, x, b) {
        var y, w;
        p < d ? (y = p, w = d) : (y = d, w = p);
        var _4 = h(c(y, v, m, g), x, b);
        return "M" + h(c(w, v, m, g), x, b).reverse().join("L") + "M" + _4.join("L");
      } };
    }, { "../../lib": 503, "../../lib/polygon": 515 }], 622: [function(e, t, r) {
      "use strict";
      var n = e("../get_data").getSubplotCalcData, a = e("../../lib").counterRegex, o = e("./polar"), s = e("./constants"), i = s.attr, l = s.name, u2 = a(l), c = {};
      c[i] = { valType: "subplotid", dflt: l, editType: "calc" }, t.exports = { attr: i, name: l, idRoot: l, idRegex: u2, attrRegex: u2, attributes: c, layoutAttributes: e("./layout_attributes"), supplyLayoutDefaults: e("./layout_defaults"), plot: function(f) {
        for (var h = f._fullLayout, p = f.calcdata, d = h._subplots[l], v = 0; v < d.length; v++) {
          var m = d[v], g = n(p, l, m), x = h[m]._subplot;
          x || (x = o(f, m), h[m]._subplot = x), x.plot(g, h, f._promises);
        }
      }, clean: function(f, h, p, d) {
        for (var v = d._subplots[l] || [], m = d._has && d._has("gl"), g = h._has && h._has("gl"), x = m && !g, b = 0; b < v.length; b++) {
          var y = v[b], w = d[y]._subplot;
          if (!h[y] && w) for (var _4 in w.framework.remove(), w.layers["radial-axis-title"].remove(), w.clipPaths) w.clipPaths[_4].remove();
          x && w._scene && (w._scene.destroy(), w._scene = null);
        }
      }, toSVG: e("../cartesian").toSVG };
    }, { "../../lib": 503, "../cartesian": 568, "../get_data": 593, "./constants": 620, "./layout_attributes": 623, "./layout_defaults": 624, "./polar": 625 }], 623: [function(e, t, r) {
      "use strict";
      var n = e("../../components/color/attributes"), a = e("../cartesian/layout_attributes"), o = e("../domain").attributes, s = e("../../lib").extendFlat, i = e("../../plot_api/edit_types").overrideAll, l = i({ color: a.color, showline: s({}, a.showline, { dflt: true }), linecolor: a.linecolor, linewidth: a.linewidth, showgrid: s({}, a.showgrid, { dflt: true }), gridcolor: a.gridcolor, gridwidth: a.gridwidth }, "plot", "from-root"), u2 = i({ tickmode: a.tickmode, nticks: a.nticks, tick0: a.tick0, dtick: a.dtick, tickvals: a.tickvals, ticktext: a.ticktext, ticks: a.ticks, ticklen: a.ticklen, tickwidth: a.tickwidth, tickcolor: a.tickcolor, showticklabels: a.showticklabels, showtickprefix: a.showtickprefix, tickprefix: a.tickprefix, showticksuffix: a.showticksuffix, ticksuffix: a.ticksuffix, showexponent: a.showexponent, exponentformat: a.exponentformat, minexponent: a.minexponent, separatethousands: a.separatethousands, tickfont: a.tickfont, tickangle: a.tickangle, tickformat: a.tickformat, tickformatstops: a.tickformatstops, layer: a.layer }, "plot", "from-root"), c = { visible: s({}, a.visible, { dflt: true }), type: s({}, a.type, { values: ["-", "linear", "log", "date", "category"] }), autotypenumbers: a.autotypenumbers, autorange: s({}, a.autorange, { editType: "plot" }), rangemode: { valType: "enumerated", values: ["tozero", "nonnegative", "normal"], dflt: "tozero", editType: "calc" }, range: s({}, a.range, { items: [{ valType: "any", editType: "plot", impliedEdits: { "^autorange": false } }, { valType: "any", editType: "plot", impliedEdits: { "^autorange": false } }], editType: "plot" }), categoryorder: a.categoryorder, categoryarray: a.categoryarray, angle: { valType: "angle", editType: "plot" }, side: { valType: "enumerated", values: ["clockwise", "counterclockwise"], dflt: "clockwise", editType: "plot" }, title: { text: s({}, a.title.text, { editType: "plot", dflt: "" }), font: s({}, a.title.font, { editType: "plot" }), editType: "plot" }, hoverformat: a.hoverformat, uirevision: { valType: "any", editType: "none" }, editType: "calc", _deprecated: { title: a._deprecated.title, titlefont: a._deprecated.titlefont } };
      s(c, l, u2);
      var f = { visible: s({}, a.visible, { dflt: true }), type: { valType: "enumerated", values: ["-", "linear", "category"], dflt: "-", editType: "calc", _noTemplating: true }, autotypenumbers: a.autotypenumbers, categoryorder: a.categoryorder, categoryarray: a.categoryarray, thetaunit: { valType: "enumerated", values: ["radians", "degrees"], dflt: "degrees", editType: "calc" }, period: { valType: "number", editType: "calc", min: 0 }, direction: { valType: "enumerated", values: ["counterclockwise", "clockwise"], dflt: "counterclockwise", editType: "calc" }, rotation: { valType: "angle", editType: "calc" }, hoverformat: a.hoverformat, uirevision: { valType: "any", editType: "none" }, editType: "calc" };
      s(f, l, u2), t.exports = { domain: o({ name: "polar", editType: "plot" }), sector: { valType: "info_array", items: [{ valType: "number", editType: "plot" }, { valType: "number", editType: "plot" }], dflt: [0, 360], editType: "plot" }, hole: { valType: "number", min: 0, max: 1, dflt: 0, editType: "plot" }, bgcolor: { valType: "color", editType: "plot", dflt: n.background }, radialaxis: c, angularaxis: f, gridshape: { valType: "enumerated", values: ["circular", "linear"], dflt: "circular", editType: "plot" }, uirevision: { valType: "any", editType: "none" }, editType: "calc" };
    }, { "../../components/color/attributes": 365, "../../lib": 503, "../../plot_api/edit_types": 536, "../cartesian/layout_attributes": 569, "../domain": 584 }], 624: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../components/color"), o = e("../../plot_api/plot_template"), s = e("../subplot_defaults"), i = e("../get_data").getSubplotData, l = e("../cartesian/tick_value_defaults"), u2 = e("../cartesian/tick_mark_defaults"), c = e("../cartesian/tick_label_defaults"), f = e("../cartesian/prefix_suffix_defaults"), h = e("../cartesian/category_order_defaults"), p = e("../cartesian/line_grid_defaults"), d = e("../cartesian/axis_autotype"), v = e("./layout_attributes"), m = e("./set_convert"), g = e("./constants"), x = g.axisNames;
      function b(w, _4, k, T2) {
        var A2 = k("bgcolor");
        T2.bgColor = a.combine(A2, T2.paper_bgcolor);
        var S2 = k("sector");
        k("hole");
        var C2, E2 = i(T2.fullData, g.name, T2.id), F13 = T2.layoutOut;
        function N2(te, j) {
          return k(C2 + "." + te, j);
        }
        for (var D2 = 0; D2 < x.length; D2++) {
          C2 = x[D2], n.isPlainObject(w[C2]) || (w[C2] = {});
          var I2 = w[C2], O2 = o.newContainer(_4, C2);
          O2._id = O2._name = C2, O2._attr = T2.id + "." + C2, O2._traceIndices = E2.map(function(te) {
            return te._expandedIndex;
          });
          var L2 = g.axisName2dataArray[C2], V2 = y(I2, O2, N2, E2, L2, T2);
          h(I2, O2, N2, { axData: E2, dataAttr: L2 });
          var W2 = N2("visible");
          switch (m(O2, _4, F13), N2("uirevision", _4.uirevision), O2._m = 1, C2) {
            case "radialaxis":
              var X2 = N2("autorange", !O2.isValidRange(I2.range));
              I2.autorange = X2, !X2 || V2 !== "linear" && V2 !== "-" || N2("rangemode"), X2 === "reversed" && (O2._m = -1), N2("range"), O2.cleanRange("range", { dfltRange: [0, 1] });
              break;
            case "angularaxis":
              if (V2 === "date") {
                n.log("Polar plots do not support date angular axes yet.");
                for (var Y2 = 0; Y2 < E2.length; Y2++) E2[Y2].visible = false;
                V2 = I2.type = O2.type = "linear";
              }
              N2(V2 === "linear" ? "thetaunit" : "period");
              var K2 = N2("direction");
              N2("rotation", { counterclockwise: 0, clockwise: 90 }[K2]);
          }
          if (f(I2, O2, N2, O2.type, { tickSuffixDflt: O2.thetaunit === "degrees" ? "\xB0" : void 0 }), W2) {
            var q, re, R2, z, H2 = T2.font || {};
            re = (q = N2("color")) === I2.color ? q : H2.color, R2 = H2.size, z = H2.family, l(I2, O2, N2, O2.type), c(I2, O2, N2, O2.type, { font: { color: re, size: R2, family: z } }), u2(I2, O2, N2, { outerTicks: true }), p(I2, O2, N2, { dfltColor: q, bgColor: T2.bgColor, blend: 60, showLine: true, showGrid: true, noZeroLine: true, attributes: v[C2] }), N2("layer"), C2 === "radialaxis" && (N2("side"), N2("angle", S2[0]), N2("title.text"), n.coerceFont(N2, "title.font", { color: re, size: n.bigFont(R2), family: z }));
          }
          V2 !== "category" && N2("hoverformat"), O2._input = I2;
        }
        _4.angularaxis.type === "category" && k("gridshape");
      }
      function y(w, _4, k, T2, A2, S2) {
        var C2 = k("autotypenumbers", S2.autotypenumbersDflt);
        if (k("type") === "-") {
          for (var E2, F13 = 0; F13 < T2.length; F13++) if (T2[F13].visible) {
            E2 = T2[F13];
            break;
          }
          E2 && E2[A2] && (_4.type = d(E2[A2], "gregorian", { noMultiCategory: true, autotypenumbers: C2 })), _4.type === "-" ? _4.type = "linear" : w.type = _4.type;
        }
        return _4.type;
      }
      t.exports = function(w, _4, k) {
        s(w, _4, k, { type: g.name, attributes: v, handleDefaults: b, font: _4.font, autotypenumbersDflt: _4.autotypenumbers, paper_bgcolor: _4.paper_bgcolor, fullData: k, layoutOut: _4 });
      };
    }, { "../../components/color": 366, "../../lib": 503, "../../plot_api/plot_template": 543, "../cartesian/axis_autotype": 555, "../cartesian/category_order_defaults": 559, "../cartesian/line_grid_defaults": 571, "../cartesian/prefix_suffix_defaults": 573, "../cartesian/tick_label_defaults": 578, "../cartesian/tick_mark_defaults": 579, "../cartesian/tick_value_defaults": 580, "../get_data": 593, "../subplot_defaults": 632, "./constants": 620, "./layout_attributes": 623, "./set_convert": 626 }], 625: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("tinycolor2"), o = e("../../registry"), s = e("../../lib"), i = s.strRotate, l = s.strTranslate, u2 = e("../../components/color"), c = e("../../components/drawing"), f = e("../plots"), h = e("../../plots/cartesian/axes"), p = e("../cartesian/set_convert"), d = e("./set_convert"), v = e("../cartesian/autorange").doAutoRange, m = e("../cartesian/dragbox"), g = e("../../components/dragelement"), x = e("../../components/fx"), b = e("../../components/titles"), y = e("../cartesian/select").prepSelect, w = e("../cartesian/select").selectOnClick, _4 = e("../cartesian/select").clearSelect, k = e("../../lib/setcursor"), T2 = e("../../lib/clear_gl_canvases"), A2 = e("../../plot_api/subroutines").redrawReglTraces, S2 = e("../../constants/alignment").MID_SHIFT, C2 = e("./constants"), E2 = e("./helpers"), F13 = e("../smith/helpers"), N2 = F13.smith, D2 = F13.reactanceArc, I2 = F13.resistanceArc, O2 = F13.smithTransform, L2 = s._, V2 = s.mod, W2 = s.deg2rad, X2 = s.rad2deg;
      function Y2(z, H2, te) {
        this.isSmith = te || false, this.id = H2, this.gd = z, this._hasClipOnAxisFalse = null, this.vangles = null, this.radialAxisAngle = null, this.traceHash = {}, this.layers = {}, this.clipPaths = {}, this.clipIds = {}, this.viewInitial = {};
        var j = z._fullLayout, Q2 = "clip" + j._uid + H2;
        this.clipIds.forTraces = Q2 + "-for-traces", this.clipPaths.forTraces = j._clips.append("clipPath").attr("id", this.clipIds.forTraces), this.clipPaths.forTraces.append("path"), this.framework = j["_" + (te ? "smith" : "polar") + "layer"].append("g").attr("class", H2), this.getHole = function(Z2) {
          return this.isSmith ? 0 : Z2.hole;
        }, this.getSector = function(Z2) {
          return this.isSmith ? [0, 360] : Z2.sector;
        }, this.getRadial = function(Z2) {
          return this.isSmith ? Z2.realaxis : Z2.radialaxis;
        }, this.getAngular = function(Z2) {
          return this.isSmith ? Z2.imaginaryaxis : Z2.angularaxis;
        }, te || (this.radialTickLayout = null, this.angularTickLayout = null);
      }
      var K2 = Y2.prototype;
      function q(z) {
        var H2 = z.ticks + String(z.ticklen) + String(z.showticklabels);
        return "side" in z && (H2 += z.side), H2;
      }
      function re(z, H2) {
        return H2[s.findIndexOfMin(H2, function(te) {
          return s.angleDist(z, te);
        })];
      }
      function R2(z, H2, te) {
        return H2 ? (z.attr("display", null), z.attr(te)) : z && z.attr("display", "none"), z;
      }
      t.exports = function(z, H2, te) {
        return new Y2(z, H2, te);
      }, K2.plot = function(z, H2) {
        for (var te = H2[this.id], j = false, Q2 = 0; Q2 < z.length; Q2++) if (z[Q2][0].trace.cliponaxis === false) {
          j = true;
          break;
        }
        this._hasClipOnAxisFalse = j, this.updateLayers(H2, te), this.updateLayout(H2, te), f.generalUpdatePerTraceModule(this.gd, this, z, te), this.updateFx(H2, te), this.isSmith && (delete te.realaxis.range, delete te.imaginaryaxis.range);
      }, K2.updateLayers = function(z, H2) {
        var te = this.isSmith, j = this.layers, Q2 = this.getRadial(H2), Z2 = this.getAngular(H2), ne = C2.layerNames, ae = ne.indexOf("frontplot"), ue = ne.slice(0, ae), le = Z2.layer === "below traces", ce = Q2.layer === "below traces";
        le && ue.push("angular-line"), ce && ue.push("radial-line"), le && ue.push("angular-axis"), ce && ue.push("radial-axis"), ue.push("frontplot"), le || ue.push("angular-line"), ce || ue.push("radial-line"), le || ue.push("angular-axis"), ce || ue.push("radial-axis");
        var se = (te ? "smith" : "polar") + "sublayer", he = this.framework.selectAll("." + se).data(ue, String);
        he.enter().append("g").attr("class", function(me) {
          return se + " " + me;
        }).each(function(me) {
          var we = j[me] = n.select(this);
          switch (me) {
            case "frontplot":
              te || we.append("g").classed("barlayer", true), we.append("g").classed("scatterlayer", true);
              break;
            case "backplot":
              we.append("g").classed("maplayer", true);
              break;
            case "plotbg":
              j.bg = we.append("path");
              break;
            case "radial-grid":
            case "angular-grid":
              we.style("fill", "none");
              break;
            case "radial-line":
              we.append("line").style("fill", "none");
              break;
            case "angular-line":
              we.append("path").style("fill", "none");
          }
        }), he.order();
      }, K2.updateLayout = function(z, H2) {
        var te = this.layers, j = z._size, Q2 = this.getRadial(H2), Z2 = this.getAngular(H2), ne = H2.domain.x, ae = H2.domain.y;
        this.xOffset = j.l + j.w * ne[0], this.yOffset = j.t + j.h * (1 - ae[1]);
        var ue = this.xLength = j.w * (ne[1] - ne[0]), le = this.yLength = j.h * (ae[1] - ae[0]), ce = this.getSector(H2);
        this.sectorInRad = ce.map(W2);
        var se, he, me, we, be, Ae = this.sectorBBox = function(Et) {
          var zt, Nt, yt, pt, Ot = Et[0], Jt = Et[1] - Ot, tr = V2(Ot, 360), Ye = tr + Jt, at = Math.cos(W2(tr)), Ge = Math.sin(W2(tr)), st = Math.cos(W2(Ye)), Ie = Math.sin(W2(Ye));
          return pt = tr <= 90 && Ye >= 90 || tr > 90 && Ye >= 450 ? 1 : Ge <= 0 && Ie <= 0 ? 0 : Math.max(Ge, Ie), zt = tr <= 180 && Ye >= 180 || tr > 180 && Ye >= 540 ? -1 : at >= 0 && st >= 0 ? 0 : Math.min(at, st), Nt = tr <= 270 && Ye >= 270 || tr > 270 && Ye >= 630 ? -1 : Ge >= 0 && Ie >= 0 ? 0 : Math.min(Ge, Ie), yt = Ye >= 360 ? 1 : at <= 0 && st <= 0 ? 0 : Math.max(at, st), [zt, Nt, yt, pt];
        }(ce), pe = Ae[2] - Ae[0], ve = Ae[3] - Ae[1], Ee = le / ue, Se = Math.abs(ve / pe);
        Ee > Se ? (se = ue, be = (le - (he = ue * Se)) / j.h / 2, me = [ne[0], ne[1]], we = [ae[0] + be, ae[1] - be]) : (he = le, be = (ue - (se = le / Se)) / j.w / 2, me = [ne[0] + be, ne[1] - be], we = [ae[0], ae[1]]), this.xLength2 = se, this.yLength2 = he, this.xDomain2 = me, this.yDomain2 = we;
        var Ce, Be = this.xOffset2 = j.l + j.w * me[0], Ue = this.yOffset2 = j.t + j.h * (1 - we[1]), Ke = this.radius = se / pe, ct = this.innerRadius = this.getHole(H2) * Ke, We = this.cx = Be - Ke * Ae[0], Ze = this.cy = Ue + Ke * Ae[3], it = this.cxx = We - Be, ot = this.cyy = Ze - Ue, mt = Q2.side;
        mt === "counterclockwise" ? (Ce = mt, mt = "top") : mt === "clockwise" && (Ce = mt, mt = "bottom"), this.radialAxis = this.mockAxis(z, H2, Q2, { _id: "x", side: mt, _trueSide: Ce, domain: [ct / j.w, Ke / j.w] }), this.angularAxis = this.mockAxis(z, H2, Z2, { side: "right", domain: [0, Math.PI], autorange: false }), this.doAutoRange(z, H2), this.updateAngularAxis(z, H2), this.updateRadialAxis(z, H2), this.updateRadialAxisTitle(z, H2), this.xaxis = this.mockCartesianAxis(z, H2, { _id: "x", domain: me }), this.yaxis = this.mockCartesianAxis(z, H2, { _id: "y", domain: we });
        var wt = this.pathSubplot();
        this.clipPaths.forTraces.select("path").attr("d", wt).attr("transform", l(it, ot)), te.frontplot.attr("transform", l(Be, Ue)).call(c.setClipUrl, this._hasClipOnAxisFalse ? null : this.clipIds.forTraces, this.gd), te.bg.attr("d", wt).attr("transform", l(We, Ze)).call(u2.fill, H2.bgcolor);
      }, K2.mockAxis = function(z, H2, te, j) {
        var Q2 = s.extendFlat({}, te, j);
        return d(Q2, H2, z), Q2;
      }, K2.mockCartesianAxis = function(z, H2, te) {
        var j = this, Q2 = j.isSmith, Z2 = te._id, ne = s.extendFlat({ type: "linear" }, te);
        p(ne, z);
        var ae = { x: [0, 2], y: [1, 3] };
        return ne.setRange = function() {
          var ue = j.sectorBBox, le = ae[Z2], ce = j.radialAxis._rl, se = (ce[1] - ce[0]) / (1 - j.getHole(H2));
          ne.range = [ue[le[0]] * se, ue[le[1]] * se];
        }, ne.isPtWithinRange = Z2 !== "x" || Q2 ? function() {
          return true;
        } : function(ue) {
          return j.isPtInside(ue);
        }, ne.setRange(), ne.setScale(), ne;
      }, K2.doAutoRange = function(z, H2) {
        var te = this.gd, j = this.radialAxis, Q2 = this.getRadial(H2);
        v(te, j);
        var Z2 = j.range;
        Q2.range = Z2.slice(), Q2._input.range = Z2.slice(), j._rl = [j.r2l(Z2[0], null, "gregorian"), j.r2l(Z2[1], null, "gregorian")];
      }, K2.updateRadialAxis = function(z, H2) {
        var te = this, j = te.gd, Q2 = te.layers, Z2 = te.radius, ne = te.innerRadius, ae = te.cx, ue = te.cy, le = te.getRadial(H2), ce = V2(te.getSector(H2)[0], 360), se = te.radialAxis, he = ne < Z2, me = te.isSmith;
        me || (te.fillViewInitialKey("radialaxis.angle", le.angle), te.fillViewInitialKey("radialaxis.range", se.range.slice()), se.setGeometry()), se.tickangle === "auto" && ce > 90 && ce <= 270 && (se.tickangle = 180);
        var we = me ? function(Ke) {
          var ct = O2(te, N2([Ke.x, 0]));
          return l(ct[0] - ae, ct[1] - ue);
        } : function(Ke) {
          return l(se.l2p(Ke.x) + ne, 0);
        }, be = me ? function(Ke) {
          return I2(te, Ke.x, -1 / 0, 1 / 0);
        } : function(Ke) {
          return te.pathArc(se.r2p(Ke.x) + ne);
        }, Ae = q(le);
        if (te.radialTickLayout !== Ae && (Q2["radial-axis"].selectAll(".xtick").remove(), te.radialTickLayout = Ae), he) {
          se.setScale();
          var pe = 0, ve = me ? (se.tickvals || []).filter(function(Ke) {
            return Ke >= 0;
          }).map(function(Ke) {
            return h.tickText(se, Ke, true, false);
          }) : h.calcTicks(se), Ee = me ? ve : h.clipEnds(se, ve), Se = h.getTickSigns(se)[2];
          me && ((se.ticks === "top" && se.side === "bottom" || se.ticks === "bottom" && se.side === "top") && (Se = -Se), se.ticks === "top" && se.side === "top" && (pe = -se.ticklen), se.ticks === "bottom" && se.side === "bottom" && (pe = se.ticklen)), h.drawTicks(j, se, { vals: ve, layer: Q2["radial-axis"], path: h.makeTickPath(se, 0, Se), transFn: we, crisp: false }), h.drawGrid(j, se, { vals: Ee, layer: Q2["radial-grid"], path: be, transFn: s.noop, crisp: false }), h.drawLabels(j, se, { vals: ve, layer: Q2["radial-axis"], transFn: we, labelFns: h.makeLabelFns(se, pe) });
        }
        var Ce = te.radialAxisAngle = te.vangles ? X2(re(W2(le.angle), te.vangles)) : le.angle, Be = l(ae, ue), Ue = Be + i(-Ce);
        R2(Q2["radial-axis"], he && (le.showticklabels || le.ticks), { transform: Ue }), R2(Q2["radial-grid"], he && le.showgrid, { transform: me ? "" : Be }), R2(Q2["radial-line"].select("line"), he && le.showline, { x1: me ? -Z2 : ne, y1: 0, x2: Z2, y2: 0, transform: Ue }).attr("stroke-width", le.linewidth).call(u2.stroke, le.linecolor);
      }, K2.updateRadialAxisTitle = function(z, H2, te) {
        if (!this.isSmith) {
          var j = this.gd, Q2 = this.radius, Z2 = this.cx, ne = this.cy, ae = this.getRadial(H2), ue = this.id + "title", le = 0;
          if (ae.title) {
            var ce = c.bBox(this.layers["radial-axis"].node()).height, se = ae.title.font.size, he = ae.side;
            le = he === "top" ? se : he === "counterclockwise" ? -(ce + 0.4 * se) : ce + 0.8 * se;
          }
          var me = te !== void 0 ? te : this.radialAxisAngle, we = W2(me), be = Math.cos(we), Ae = Math.sin(we), pe = Z2 + Q2 / 2 * be + le * Ae, ve = ne - Q2 / 2 * Ae + le * be;
          this.layers["radial-axis-title"] = b.draw(j, ue, { propContainer: ae, propName: this.id + ".radialaxis.title", placeholder: L2(j, "Click to enter radial axis title"), attributes: { x: pe, y: ve, "text-anchor": "middle" }, transform: { rotate: -me } });
        }
      }, K2.updateAngularAxis = function(z, H2) {
        var te = this, j = te.gd, Q2 = te.layers, Z2 = te.radius, ne = te.innerRadius, ae = te.cx, ue = te.cy, le = te.getAngular(H2), ce = te.angularAxis, se = te.isSmith;
        se || (te.fillViewInitialKey("angularaxis.rotation", le.rotation), ce.setGeometry(), ce.setScale());
        var he = se ? function(Ke) {
          var ct = O2(te, N2([0, Ke.x]));
          return Math.atan2(ct[0] - ae, ct[1] - ue) - Math.PI / 2;
        } : function(Ke) {
          return ce.t2g(Ke.x);
        };
        ce.type === "linear" && ce.thetaunit === "radians" && (ce.tick0 = X2(ce.tick0), ce.dtick = X2(ce.dtick));
        var me = function(Ke) {
          return l(ae + Z2 * Math.cos(Ke), ue - Z2 * Math.sin(Ke));
        }, we = se ? function(Ke) {
          var ct = O2(te, N2([0, Ke.x]));
          return l(ct[0], ct[1]);
        } : function(Ke) {
          return me(he(Ke));
        }, be = se ? function(Ke) {
          var ct = O2(te, N2([0, Ke.x])), We = Math.atan2(ct[0] - ae, ct[1] - ue) - Math.PI / 2;
          return l(ct[0], ct[1]) + i(-X2(We));
        } : function(Ke) {
          var ct = he(Ke);
          return me(ct) + i(-X2(ct));
        }, Ae = se ? function(Ke) {
          return D2(te, Ke.x, 0, 1 / 0);
        } : function(Ke) {
          var ct = he(Ke), We = Math.cos(ct), Ze = Math.sin(ct);
          return "M" + [ae + ne * We, ue - ne * Ze] + "L" + [ae + Z2 * We, ue - Z2 * Ze];
        }, pe = h.makeLabelFns(ce, 0).labelStandoff, ve = { xFn: function(Ke) {
          var ct = he(Ke);
          return Math.cos(ct) * pe;
        }, yFn: function(Ke) {
          var ct = he(Ke), We = Math.sin(ct) > 0 ? 0.2 : 1;
          return -Math.sin(ct) * (pe + Ke.fontSize * We) + Math.abs(Math.cos(ct)) * (Ke.fontSize * S2);
        }, anchorFn: function(Ke) {
          var ct = he(Ke), We = Math.cos(ct);
          return Math.abs(We) < 0.1 ? "middle" : We > 0 ? "start" : "end";
        }, heightFn: function(Ke, ct, We) {
          var Ze = he(Ke);
          return -0.5 * (1 + Math.sin(Ze)) * We;
        } }, Ee = q(le);
        te.angularTickLayout !== Ee && (Q2["angular-axis"].selectAll("." + ce._id + "tick").remove(), te.angularTickLayout = Ee);
        var Se, Ce = se ? [1 / 0].concat(ce.tickvals || []).map(function(Ke) {
          return h.tickText(ce, Ke, true, false);
        }) : h.calcTicks(ce);
        if (se && (Ce[0].text = "\u221E", Ce[0].fontSize *= 1.75), H2.gridshape === "linear" ? (Se = Ce.map(he), s.angleDelta(Se[0], Se[1]) < 0 && (Se = Se.slice().reverse())) : Se = null, te.vangles = Se, ce.type === "category" && (Ce = Ce.filter(function(Ke) {
          return s.isAngleInsideSector(he(Ke), te.sectorInRad);
        })), ce.visible) {
          var Be = ce.ticks === "inside" ? -1 : 1, Ue = (ce.linewidth || 1) / 2;
          h.drawTicks(j, ce, { vals: Ce, layer: Q2["angular-axis"], path: "M" + Be * Ue + ",0h" + Be * ce.ticklen, transFn: be, crisp: false }), h.drawGrid(j, ce, { vals: Ce, layer: Q2["angular-grid"], path: Ae, transFn: s.noop, crisp: false }), h.drawLabels(j, ce, { vals: Ce, layer: Q2["angular-axis"], repositionOnUpdate: true, transFn: we, labelFns: ve });
        }
        R2(Q2["angular-line"].select("path"), le.showline, { d: te.pathSubplot(), transform: l(ae, ue) }).attr("stroke-width", le.linewidth).call(u2.stroke, le.linecolor);
      }, K2.updateFx = function(z, H2) {
        this.gd._context.staticPlot || (!this.isSmith && (this.updateAngularDrag(z), this.updateRadialDrag(z, H2, 0), this.updateRadialDrag(z, H2, 1)), this.updateHoverAndMainDrag(z));
      }, K2.updateHoverAndMainDrag = function(z) {
        var H2, te, j = this, Q2 = j.isSmith, Z2 = j.gd, ne = j.layers, ae = z._zoomlayer, ue = C2.MINZOOM, le = C2.OFFEDGE, ce = j.radius, se = j.innerRadius, he = j.cx, me = j.cy, we = j.cxx, be = j.cyy, Ae = j.sectorInRad, pe = j.vangles, ve = j.radialAxis, Ee = E2.clampTiny, Se = E2.findXYatLength, Ce = E2.findEnclosingVertexAngles, Be = C2.cornerHalfWidth, Ue = C2.cornerLen / 2, Ke = m.makeDragger(ne, "path", "maindrag", "crosshair");
        n.select(Ke).attr("d", j.pathSubplot()).attr("transform", l(he, me)), Ke.onmousemove = function(Re) {
          x.hover(Z2, Re, j.id), Z2._fullLayout._lasthover = Ke, Z2._fullLayout._hoversubplot = j.id;
        }, Ke.onmouseout = function(Re) {
          Z2._dragging || g.unhover(Z2, Re);
        };
        var ct, We, Ze, it, ot, mt, wt, Et, zt, Nt = { element: Ke, gd: Z2, subplot: j.id, plotinfo: { id: j.id, xaxis: j.xaxis, yaxis: j.yaxis }, xaxes: [j.xaxis], yaxes: [j.yaxis] };
        function yt(Re, qe) {
          return Math.sqrt(Re * Re + qe * qe);
        }
        function pt(Re, qe) {
          return yt(Re - we, qe - be);
        }
        function Ot(Re, qe) {
          return Math.atan2(be - qe, Re - we);
        }
        function Jt(Re, qe) {
          return [Re * Math.cos(qe), Re * Math.sin(-qe)];
        }
        function tr(Re, qe) {
          if (Re === 0) return j.pathSector(2 * Be);
          var je = Ue / Re, rt = qe - je, He = qe + je, xe = Math.max(0, Math.min(Re, ce)), Ne = xe - Be, ke = xe + Be;
          return "M" + Jt(Ne, rt) + "A" + [Ne, Ne] + " 0,0,0 " + Jt(Ne, He) + "L" + Jt(ke, He) + "A" + [ke, ke] + " 0,0,1 " + Jt(ke, rt) + "Z";
        }
        function Ye(Re, qe, je) {
          if (Re === 0) return j.pathSector(2 * Be);
          var rt, He, xe = Jt(Re, qe), Ne = Jt(Re, je), ke = Ee((xe[0] + Ne[0]) / 2), Me = Ee((xe[1] + Ne[1]) / 2);
          if (ke && Me) {
            var Le = Me / ke, ze = -1 / Le, ft = Se(Be, Le, ke, Me);
            rt = Se(Ue, ze, ft[0][0], ft[0][1]), He = Se(Ue, ze, ft[1][0], ft[1][1]);
          } else {
            var De, Je;
            Me ? (De = Ue, Je = Be) : (De = Be, Je = Ue), rt = [[ke - De, Me - Je], [ke + De, Me - Je]], He = [[ke - De, Me + Je], [ke + De, Me + Je]];
          }
          return "M" + rt.join("L") + "L" + He.reverse().join("L") + "Z";
        }
        function at(Re, qe) {
          return qe = Math.max(Math.min(qe, ce), se), Re < le ? Re = 0 : ce - Re < le ? Re = ce : qe < le ? qe = 0 : ce - qe < le && (qe = ce), Math.abs(qe - Re) > ue ? (Re < qe ? (Ze = Re, it = qe) : (Ze = qe, it = Re), true) : (Ze = null, it = null, false);
        }
        function Ge(Re, qe) {
          Re = Re || ot, qe = qe || "M0,0Z", Et.attr("d", Re), zt.attr("d", qe), m.transitionZoombox(Et, zt, mt, wt), mt = true;
          var je = {};
          Ve(je), Z2.emit("plotly_relayouting", je);
        }
        function st(Re, qe) {
          var je, rt, He = ct + (Re *= H2), xe = We + (qe *= te), Ne = pt(ct, We), ke = Math.min(pt(He, xe), ce), Me = Ot(ct, We);
          at(Ne, ke) && (je = ot + j.pathSector(it), Ze && (je += j.pathSector(Ze)), rt = tr(Ze, Me) + tr(it, Me)), Ge(je, rt);
        }
        function Ie(Re, qe, je, rt) {
          var He = E2.findIntersectionXY(je, rt, je, [Re - we, be - qe]);
          return yt(He[0], He[1]);
        }
        function Pe(Re, qe) {
          var je, rt, He = ct + Re, xe = We + qe, Ne = Ot(ct, We), ke = Ot(He, xe), Me = Ce(Ne, pe), Le = Ce(ke, pe);
          at(Ie(ct, We, Me[0], Me[1]), Math.min(Ie(He, xe, Le[0], Le[1]), ce)) && (je = ot + j.pathSector(it), Ze && (je += j.pathSector(Ze)), rt = [Ye(Ze, Me[0], Me[1]), Ye(it, Me[0], Me[1])].join(" ")), Ge(je, rt);
        }
        function $e() {
          if (m.removeZoombox(Z2), Ze !== null && it !== null) {
            var Re = {};
            Ve(Re), m.showDoubleClickNotifier(Z2), o.call("_guiRelayout", Z2, Re);
          }
        }
        function Ve(Re) {
          var qe = ve._rl, je = (qe[1] - qe[0]) / (1 - se / ce) / ce, rt = [qe[0] + (Ze - se) * je, qe[0] + (it - se) * je];
          Re[j.id + ".radialaxis.range"] = rt;
        }
        function ut(Re, qe) {
          var je = Z2._fullLayout.clickmode;
          if (m.removeZoombox(Z2), Re === 2) {
            var rt = {};
            for (var He in j.viewInitial) rt[j.id + "." + He] = j.viewInitial[He];
            Z2.emit("plotly_doubleclick", null), o.call("_guiRelayout", Z2, rt);
          }
          je.indexOf("select") > -1 && Re === 1 && w(qe, Z2, [j.xaxis], [j.yaxis], j.id, Nt), je.indexOf("event") > -1 && x.click(Z2, qe, j.id);
        }
        Nt.prepFn = function(Re, qe, je) {
          var rt = Z2._fullLayout.dragmode, He = Ke.getBoundingClientRect();
          Z2._fullLayout._calcInverseTransform(Z2);
          var xe = Z2._fullLayout._invTransform;
          H2 = Z2._fullLayout._invScaleX, te = Z2._fullLayout._invScaleY;
          var Ne = s.apply3DTransform(xe)(qe - He.left, je - He.top);
          if (ct = Ne[0], We = Ne[1], pe) {
            var ke = E2.findPolygonOffset(ce, Ae[0], Ae[1], pe);
            ct += we + ke[0], We += be + ke[1];
          }
          switch (rt) {
            case "zoom":
              Nt.clickFn = ut, Q2 || (Nt.moveFn = pe ? Pe : st, Nt.doneFn = $e, function() {
                Ze = null, it = null, ot = j.pathSubplot(), mt = false;
                var Me = Z2._fullLayout[j.id];
                wt = a(Me.bgcolor).getLuminance(), (Et = m.makeZoombox(ae, wt, he, me, ot)).attr("fill-rule", "evenodd"), zt = m.makeCorners(ae, he, me), _4(Z2);
              }());
              break;
            case "select":
            case "lasso":
              y(Re, qe, je, Nt, rt);
          }
        }, g.init(Nt);
      }, K2.updateRadialDrag = function(z, H2, te) {
        var j = this, Q2 = j.gd, Z2 = j.layers, ne = j.radius, ae = j.innerRadius, ue = j.cx, le = j.cy, ce = j.radialAxis, se = C2.radialDragBoxSize, he = se / 2;
        if (ce.visible) {
          var me, we, be, Ae = W2(j.radialAxisAngle), pe = ce._rl, ve = pe[0], Ee = pe[1], Se = pe[te], Ce = 0.75 * (pe[1] - pe[0]) / (1 - j.getHole(H2)) / ne;
          te ? (me = ue + (ne + he) * Math.cos(Ae), we = le - (ne + he) * Math.sin(Ae), be = "radialdrag") : (me = ue + (ae - he) * Math.cos(Ae), we = le - (ae - he) * Math.sin(Ae), be = "radialdrag-inner");
          var Be, Ue, Ke, ct = m.makeRectDragger(Z2, be, "crosshair", -he, -he, se, se), We = { element: ct, gd: Q2 };
          R2(n.select(ct), ce.visible && ae < ne, { transform: l(me, we) }), We.prepFn = function() {
            Be = null, Ue = null, Ke = null, We.moveFn = Ze, We.doneFn = it, _4(Q2);
          }, We.clampFn = function(wt, Et) {
            return Math.sqrt(wt * wt + Et * Et) < C2.MINDRAG && (wt = 0, Et = 0), [wt, Et];
          }, g.init(We);
        }
        function Ze(wt, Et) {
          if (Be) Be(wt, Et);
          else {
            var zt = [wt, -Et], Nt = [Math.cos(Ae), Math.sin(Ae)], yt = Math.abs(s.dot(zt, Nt) / Math.sqrt(s.dot(zt, zt)));
            isNaN(yt) || (Be = yt < 0.5 ? ot : mt);
          }
          var pt = {};
          (function(Ot) {
            Ue !== null ? Ot[j.id + ".radialaxis.angle"] = Ue : Ke !== null && (Ot[j.id + ".radialaxis.range[" + te + "]"] = Ke);
          })(pt), Q2.emit("plotly_relayouting", pt);
        }
        function it() {
          Ue !== null ? o.call("_guiRelayout", Q2, j.id + ".radialaxis.angle", Ue) : Ke !== null && o.call("_guiRelayout", Q2, j.id + ".radialaxis.range[" + te + "]", Ke);
        }
        function ot(wt, Et) {
          if (te !== 0) {
            var zt = me + wt, Nt = we + Et;
            Ue = Math.atan2(le - Nt, zt - ue), j.vangles && (Ue = re(Ue, j.vangles)), Ue = X2(Ue);
            var yt = l(ue, le) + i(-Ue);
            Z2["radial-axis"].attr("transform", yt), Z2["radial-line"].select("line").attr("transform", yt);
            var pt = j.gd._fullLayout, Ot = pt[j.id];
            j.updateRadialAxisTitle(pt, Ot, Ue);
          }
        }
        function mt(wt, Et) {
          var zt = s.dot([wt, -Et], [Math.cos(Ae), Math.sin(Ae)]);
          if (Ke = Se - Ce * zt, Ce > 0 == (te ? Ke > ve : Ke < Ee)) {
            var Nt = Q2._fullLayout, yt = Nt[j.id];
            ce.range[te] = Ke, ce._rl[te] = Ke, j.updateRadialAxis(Nt, yt), j.xaxis.setRange(), j.xaxis.setScale(), j.yaxis.setRange(), j.yaxis.setScale();
            var pt = false;
            for (var Ot in j.traceHash) {
              var Jt = j.traceHash[Ot], tr = s.filterVisible(Jt);
              Jt[0][0].trace._module.plot(Q2, j, tr, yt), o.traceIs(Ot, "gl") && tr.length && (pt = true);
            }
            pt && (T2(Q2), A2(Q2));
          } else Ke = null;
        }
      }, K2.updateAngularDrag = function(z) {
        var H2 = this, te = H2.gd, j = H2.layers, Q2 = H2.radius, Z2 = H2.angularAxis, ne = H2.cx, ae = H2.cy, ue = H2.cxx, le = H2.cyy, ce = C2.angularDragBoxSize, se = m.makeDragger(j, "path", "angulardrag", "move"), he = { element: se, gd: te };
        function me(We, Ze) {
          return Math.atan2(le + ce - Ze, We - ue - ce);
        }
        n.select(se).attr("d", H2.pathAnnulus(Q2, Q2 + ce)).attr("transform", l(ne, ae)).call(k, "move");
        var we, be, Ae, pe, ve, Ee, Se = j.frontplot.select(".scatterlayer").selectAll(".trace"), Ce = Se.selectAll(".point"), Be = Se.selectAll(".textpoint");
        function Ue(We, Ze) {
          var it = H2.gd._fullLayout, ot = it[H2.id], mt = me(we + We * z._invScaleX, be + Ze * z._invScaleY), wt = X2(mt - Ee);
          if (pe = Ae + wt, j.frontplot.attr("transform", l(H2.xOffset2, H2.yOffset2) + i([-wt, ue, le])), H2.vangles) {
            ve = H2.radialAxisAngle + wt;
            var Et = l(ne, ae) + i(-wt), zt = l(ne, ae) + i(-ve);
            j.bg.attr("transform", Et), j["radial-grid"].attr("transform", Et), j["radial-axis"].attr("transform", zt), j["radial-line"].select("line").attr("transform", zt), H2.updateRadialAxisTitle(it, ot, ve);
          } else H2.clipPaths.forTraces.select("path").attr("transform", l(ue, le) + i(wt));
          Ce.each(function() {
            var tr = n.select(this), Ye = c.getTranslate(tr);
            tr.attr("transform", l(Ye.x, Ye.y) + i([wt]));
          }), Be.each(function() {
            var tr = n.select(this), Ye = tr.select("text"), at = c.getTranslate(tr);
            tr.attr("transform", i([wt, Ye.attr("x"), Ye.attr("y")]) + l(at.x, at.y));
          }), Z2.rotation = s.modHalf(pe, 360), H2.updateAngularAxis(it, ot), H2._hasClipOnAxisFalse && !s.isFullCircle(H2.sectorInRad) && Se.call(c.hideOutsideRangePoints, H2);
          var Nt = false;
          for (var yt in H2.traceHash) if (o.traceIs(yt, "gl")) {
            var pt = H2.traceHash[yt], Ot = s.filterVisible(pt);
            pt[0][0].trace._module.plot(te, H2, Ot, ot), Ot.length && (Nt = true);
          }
          Nt && (T2(te), A2(te));
          var Jt = {};
          Ke(Jt), te.emit("plotly_relayouting", Jt);
        }
        function Ke(We) {
          We[H2.id + ".angularaxis.rotation"] = pe, H2.vangles && (We[H2.id + ".radialaxis.angle"] = ve);
        }
        function ct() {
          Be.select("text").attr("transform", null);
          var We = {};
          Ke(We), o.call("_guiRelayout", te, We);
        }
        he.prepFn = function(We, Ze, it) {
          var ot = z[H2.id];
          Ae = ot.angularaxis.rotation;
          var mt = se.getBoundingClientRect();
          we = Ze - mt.left, be = it - mt.top, te._fullLayout._calcInverseTransform(te);
          var wt = s.apply3DTransform(z._invTransform)(we, be);
          we = wt[0], be = wt[1], Ee = me(we, be), he.moveFn = Ue, he.doneFn = ct, _4(te);
        }, H2.vangles && !s.isFullCircle(H2.sectorInRad) && (he.prepFn = s.noop, k(n.select(se), null)), g.init(he);
      }, K2.isPtInside = function(z) {
        if (this.isSmith) return true;
        var H2 = this.sectorInRad, te = this.vangles, j = this.angularAxis.c2g(z.theta), Q2 = this.radialAxis, Z2 = Q2.c2l(z.r), ne = Q2._rl;
        return (te ? E2.isPtInsidePolygon : s.isPtInsideSector)(Z2, j, ne, H2, te);
      }, K2.pathArc = function(z) {
        var H2 = this.sectorInRad, te = this.vangles;
        return (te ? E2.pathPolygon : s.pathArc)(z, H2[0], H2[1], te);
      }, K2.pathSector = function(z) {
        var H2 = this.sectorInRad, te = this.vangles;
        return (te ? E2.pathPolygon : s.pathSector)(z, H2[0], H2[1], te);
      }, K2.pathAnnulus = function(z, H2) {
        var te = this.sectorInRad, j = this.vangles;
        return (j ? E2.pathPolygonAnnulus : s.pathAnnulus)(z, H2, te[0], te[1], j);
      }, K2.pathSubplot = function() {
        var z = this.innerRadius, H2 = this.radius;
        return z ? this.pathAnnulus(z, H2) : this.pathSector(H2);
      }, K2.fillViewInitialKey = function(z, H2) {
        z in this.viewInitial || (this.viewInitial[z] = H2);
      };
    }, { "../../components/color": 366, "../../components/dragelement": 385, "../../components/drawing": 388, "../../components/fx": 406, "../../components/titles": 464, "../../constants/alignment": 471, "../../lib": 503, "../../lib/clear_gl_canvases": 487, "../../lib/setcursor": 524, "../../plot_api/subroutines": 544, "../../plots/cartesian/axes": 554, "../../registry": 638, "../cartesian/autorange": 553, "../cartesian/dragbox": 563, "../cartesian/select": 575, "../cartesian/set_convert": 576, "../plots": 619, "../smith/helpers": 628, "./constants": 620, "./helpers": 621, "./set_convert": 626, "@plotly/d3": 58, tinycolor2: 312 }], 626: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../cartesian/set_convert"), o = n.deg2rad, s = n.rad2deg;
      t.exports = function(i, l, u2) {
        switch (a(i, u2), i._id) {
          case "x":
          case "radialaxis":
            (function(c, f) {
              var h = f._subplot;
              c.setGeometry = function() {
                var p = c._rl[0], d = c._rl[1], v = h.innerRadius, m = (h.radius - v) / (d - p), g = v / m, x = p > d ? function(b) {
                  return b <= 0;
                } : function(b) {
                  return b >= 0;
                };
                c.c2g = function(b) {
                  var y = c.c2l(b) - p;
                  return (x(y) ? y : 0) + g;
                }, c.g2c = function(b) {
                  return c.l2c(b + p - g);
                }, c.g2p = function(b) {
                  return b * m;
                }, c.c2p = function(b) {
                  return c.g2p(c.c2g(b));
                };
              };
            })(i, l);
            break;
          case "angularaxis":
            (function(c, f) {
              var h = c.type;
              if (h === "linear") {
                var p = c.d2c, d = c.c2d;
                c.d2c = function(v, m) {
                  return function(g, x) {
                    return x === "degrees" ? o(g) : g;
                  }(p(v), m);
                }, c.c2d = function(v, m) {
                  return d(function(g, x) {
                    return x === "degrees" ? s(g) : g;
                  }(v, m));
                };
              }
              c.makeCalcdata = function(v, m) {
                var g, x, b = v[m], y = v._length, w = function(S2) {
                  return c.d2c(S2, v.thetaunit);
                };
                if (b) {
                  if (n.isTypedArray(b) && h === "linear") {
                    if (y === b.length) return b;
                    if (b.subarray) return b.subarray(0, y);
                  }
                  for (g = new Array(y), x = 0; x < y; x++) g[x] = w(b[x]);
                } else {
                  var _4 = m + "0", k = "d" + m, T2 = _4 in v ? w(v[_4]) : 0, A2 = v[k] ? w(v[k]) : (c.period || 2 * Math.PI) / y;
                  for (g = new Array(y), x = 0; x < y; x++) g[x] = T2 + x * A2;
                }
                return g;
              }, c.setGeometry = function() {
                var v, m, g, x, b = f.sector, y = b.map(o), w = { clockwise: -1, counterclockwise: 1 }[c.direction], _4 = o(c.rotation), k = function(C2) {
                  return w * C2 + _4;
                }, T2 = function(C2) {
                  return (C2 - _4) / w;
                };
                switch (h) {
                  case "linear":
                    m = v = n.identity, x = o, g = s, c.range = n.isFullCircle(y) ? [b[0], b[0] + 360] : y.map(T2).map(s);
                    break;
                  case "category":
                    var A2 = c._categories.length, S2 = c.period ? Math.max(c.period, A2) : A2;
                    S2 === 0 && (S2 = 1), m = x = function(C2) {
                      return 2 * C2 * Math.PI / S2;
                    }, v = g = function(C2) {
                      return C2 * S2 / Math.PI / 2;
                    }, c.range = [0, S2];
                }
                c.c2g = function(C2) {
                  return k(m(C2));
                }, c.g2c = function(C2) {
                  return v(T2(C2));
                }, c.t2g = function(C2) {
                  return k(x(C2));
                }, c.g2t = function(C2) {
                  return g(T2(C2));
                };
              };
            })(i, l);
        }
      };
    }, { "../../lib": 503, "../cartesian/set_convert": 576 }], 627: [function(e, t, r) {
      "use strict";
      t.exports = { attr: "subplot", name: "smith", axisNames: ["realaxis", "imaginaryaxis"], axisName2dataArray: { imaginaryaxis: "imag", realaxis: "real" } };
    }, {}], 628: [function(e, t, r) {
      "use strict";
      function n(i) {
        return i < 0 ? -1 : i > 0 ? 1 : 0;
      }
      function a(i) {
        var l = i[0], u2 = i[1];
        if (!isFinite(l) || !isFinite(u2)) return [1, 0];
        var c = (l + 1) * (l + 1) + u2 * u2;
        return [(l * l + u2 * u2 - 1) / c, 2 * u2 / c];
      }
      function o(i, l) {
        var u2 = l[0], c = l[1];
        return [u2 * i.radius + i.cx, -c * i.radius + i.cy];
      }
      function s(i, l) {
        return l * i.radius;
      }
      t.exports = { smith: a, reactanceArc: function(i, l, u2, c) {
        var f = o(i, a([u2, l])), h = f[0], p = f[1], d = o(i, a([c, l])), v = d[0], m = d[1];
        if (l === 0) return ["M" + h + "," + p, "L" + v + "," + m].join(" ");
        var g = s(i, 1 / Math.abs(l));
        return ["M" + h + "," + p, "A" + g + "," + g + " 0 0," + (l < 0 ? 1 : 0) + " " + v + "," + m].join(" ");
      }, resistanceArc: function(i, l, u2, c) {
        var f = s(i, 1 / (l + 1)), h = o(i, a([l, u2])), p = h[0], d = h[1], v = o(i, a([l, c])), m = v[0], g = v[1];
        if (n(u2) !== n(c)) {
          var x = o(i, a([l, 0]));
          return ["M" + p + "," + d, "A" + f + "," + f + " 0 0," + (0 < u2 ? 0 : 1) + " " + x[0] + "," + x[1], "A" + f + "," + f + " 0 0," + (c < 0 ? 0 : 1) + m + "," + g].join(" ");
        }
        return ["M" + p + "," + d, "A" + f + "," + f + " 0 0," + (c < u2 ? 0 : 1) + " " + m + "," + g].join(" ");
      }, smithTransform: o };
    }, {}], 629: [function(e, t, r) {
      "use strict";
      var n = e("../get_data").getSubplotCalcData, a = e("../../lib").counterRegex, o = e("../polar/polar"), s = e("./constants"), i = s.attr, l = s.name, u2 = a(l), c = {};
      c[i] = { valType: "subplotid", dflt: l, editType: "calc" }, t.exports = { attr: i, name: l, idRoot: l, idRegex: u2, attrRegex: u2, attributes: c, layoutAttributes: e("./layout_attributes"), supplyLayoutDefaults: e("./layout_defaults"), plot: function(f) {
        for (var h = f._fullLayout, p = f.calcdata, d = h._subplots[l], v = 0; v < d.length; v++) {
          var m = d[v], g = n(p, l, m), x = h[m]._subplot;
          x || (x = o(f, m, true), h[m]._subplot = x), x.plot(g, h, f._promises);
        }
      }, clean: function(f, h, p, d) {
        for (var v = d._subplots[l] || [], m = 0; m < v.length; m++) {
          var g = v[m], x = d[g]._subplot;
          if (!h[g] && x) for (var b in x.framework.remove(), x.clipPaths) x.clipPaths[b].remove();
        }
      }, toSVG: e("../cartesian").toSVG };
    }, { "../../lib": 503, "../cartesian": 568, "../get_data": 593, "../polar/polar": 625, "./constants": 627, "./layout_attributes": 630, "./layout_defaults": 631 }], 630: [function(e, t, r) {
      "use strict";
      var n = e("../../components/color/attributes"), a = e("../cartesian/layout_attributes"), o = e("../domain").attributes, s = e("../../lib").extendFlat, i = e("../../plot_api/edit_types").overrideAll, l = i({ color: a.color, showline: s({}, a.showline, { dflt: true }), linecolor: a.linecolor, linewidth: a.linewidth, showgrid: s({}, a.showgrid, { dflt: true }), gridcolor: a.gridcolor, gridwidth: a.gridwidth }, "plot", "from-root"), u2 = i({ ticklen: a.ticklen, tickwidth: s({}, a.tickwidth, { dflt: 2 }), tickcolor: a.tickcolor, showticklabels: a.showticklabels, showtickprefix: a.showtickprefix, tickprefix: a.tickprefix, showticksuffix: a.showticksuffix, ticksuffix: a.ticksuffix, tickfont: a.tickfont, tickformat: a.tickformat, hoverformat: a.hoverformat, layer: a.layer }, "plot", "from-root"), c = s({ visible: s({}, a.visible, { dflt: true }), tickvals: { dflt: [0.2, 0.5, 1, 2, 5], valType: "data_array", editType: "plot" }, tickangle: s({}, a.tickangle, { dflt: 90 }), ticks: { valType: "enumerated", values: ["top", "bottom", ""], editType: "ticks" }, side: { valType: "enumerated", values: ["top", "bottom"], dflt: "top", editType: "plot" }, editType: "calc" }, l, u2), f = s({ visible: s({}, a.visible, { dflt: true }), tickvals: { valType: "data_array", editType: "plot" }, ticks: a.ticks, editType: "calc" }, l, u2);
      t.exports = { domain: o({ name: "smith", editType: "plot" }), bgcolor: { valType: "color", editType: "plot", dflt: n.background }, realaxis: c, imaginaryaxis: f, editType: "calc" };
    }, { "../../components/color/attributes": 365, "../../lib": 503, "../../plot_api/edit_types": 536, "../cartesian/layout_attributes": 569, "../domain": 584 }], 631: [function(e, t, r) {
      "use strict";
      var n, a, o, s = e("../../lib"), i = e("../../components/color"), l = e("../../plot_api/plot_template"), u2 = e("../subplot_defaults"), c = e("../get_data").getSubplotData, f = e("../cartesian/prefix_suffix_defaults"), h = e("../cartesian/tick_label_defaults"), p = e("../cartesian/line_grid_defaults"), d = e("../cartesian/set_convert"), v = e("./layout_attributes"), m = e("./constants"), g = m.axisNames, x = (n = function(y) {
        return y.slice().reverse().map(function(w) {
          return -w;
        }).concat([0]).concat(y);
      }, a = String, o = {}, function(y) {
        var w = a ? a(y) : y;
        if (w in o) return o[w];
        var _4 = n(y);
        return o[w] = _4, _4;
      });
      function b(y, w, _4, k) {
        var T2 = _4("bgcolor");
        k.bgColor = i.combine(T2, k.paper_bgcolor);
        var A2, S2 = c(k.fullData, m.name, k.id), C2 = k.layoutOut;
        function E2(K2, q) {
          return _4(A2 + "." + K2, q);
        }
        for (var F13 = 0; F13 < g.length; F13++) {
          A2 = g[F13], s.isPlainObject(y[A2]) || (y[A2] = {});
          var N2 = y[A2], D2 = l.newContainer(w, A2);
          D2._id = D2._name = A2, D2._attr = k.id + "." + A2, D2._traceIndices = S2.map(function(K2) {
            return K2._expandedIndex;
          });
          var I2 = E2("visible");
          if (D2.type = "linear", d(D2, C2), f(N2, D2, E2, D2.type), I2) {
            var O2, L2, V2, W2, X2 = A2 === "realaxis";
            X2 && E2("side"), X2 ? E2("tickvals") : E2("tickvals", x(w.realaxis.tickvals || v.realaxis.tickvals.dflt));
            var Y2 = k.font || {};
            I2 && (L2 = (O2 = E2("color")) === N2.color ? O2 : Y2.color, V2 = Y2.size, W2 = Y2.family), h(N2, D2, E2, D2.type, { noAng: !X2, noExp: true, font: { color: L2, size: V2, family: W2 } }), s.coerce2(y, w, v, A2 + ".ticklen"), s.coerce2(y, w, v, A2 + ".tickwidth"), s.coerce2(y, w, v, A2 + ".tickcolor", w.color), E2("ticks") || (delete w[A2].ticklen, delete w[A2].tickwidth, delete w[A2].tickcolor), p(N2, D2, E2, { dfltColor: O2, bgColor: k.bgColor, blend: 60, showLine: true, showGrid: true, noZeroLine: true, attributes: v[A2] }), E2("layer");
          }
          E2("hoverformat"), delete D2.type, D2._input = N2;
        }
      }
      t.exports = function(y, w, _4) {
        u2(y, w, _4, { noUirevision: true, type: m.name, attributes: v, handleDefaults: b, font: w.font, paper_bgcolor: w.paper_bgcolor, fullData: _4, layoutOut: w });
      };
    }, { "../../components/color": 366, "../../lib": 503, "../../plot_api/plot_template": 543, "../cartesian/line_grid_defaults": 571, "../cartesian/prefix_suffix_defaults": 573, "../cartesian/set_convert": 576, "../cartesian/tick_label_defaults": 578, "../get_data": 593, "../subplot_defaults": 632, "./constants": 627, "./layout_attributes": 630 }], 632: [function(e, t, r) {
      "use strict";
      var n = e("../lib"), a = e("../plot_api/plot_template"), o = e("./domain").defaults;
      t.exports = function(s, i, l, u2) {
        var c, f, h = u2.type, p = u2.attributes, d = u2.handleDefaults, v = u2.partition || "x", m = i._subplots[h], g = m.length, x = g && m[0].replace(/\d+$/, "");
        function b(k, T2) {
          return n.coerce(c, f, p, k, T2);
        }
        for (var y = 0; y < g; y++) {
          var w = m[y];
          c = s[w] ? s[w] : s[w] = {}, f = a.newContainer(i, w, x), u2.noUirevision || b("uirevision", i.uirevision);
          var _4 = {};
          _4[v] = [y / g, (y + 1) / g], o(f, i, b, _4), u2.id = w, d(c, f, b, u2);
        }
      };
    }, { "../lib": 503, "../plot_api/plot_template": 543, "./domain": 584 }], 633: [function(e, t, r) {
      "use strict";
      var n = e("../constants/docs");
      n.FORMAT_LINK, n.DATE_FORMAT_LINK;
      function a(o) {
        var s = o.description ? " " + o.description : "", i = o.keys || [];
        if (i.length > 0) {
          for (var l = [], u2 = 0; u2 < i.length; u2++) l[u2] = "`" + i[u2] + "`";
          s += "Finally, the template string has access to ", s = i.length === 1 ? "variable " + l[0] : "variables " + l.slice(0, -1).join(", ") + " and " + l.slice(-1) + ".";
        }
        return s;
      }
      r.hovertemplateAttrs = function(o, s) {
        o = o || {}, a(s = s || {});
        var i = { valType: "string", dflt: "", editType: o.editType || "none" };
        return o.arrayOk !== false && (i.arrayOk = true), i;
      }, r.texttemplateAttrs = function(o, s) {
        o = o || {}, a(s = s || {});
        var i = { valType: "string", dflt: "", editType: o.editType || "calc" };
        return o.arrayOk !== false && (i.arrayOk = true), i;
      };
    }, { "../constants/docs": 474 }], 634: [function(e, t, r) {
      "use strict";
      var n = e("./ternary"), a = e("../../plots/get_data").getSubplotCalcData, o = e("../../lib").counterRegex;
      r.name = "ternary";
      var s = r.attr = "subplot";
      r.idRoot = "ternary", r.idRegex = r.attrRegex = o("ternary"), (r.attributes = {})[s] = { valType: "subplotid", dflt: "ternary", editType: "calc" }, r.layoutAttributes = e("./layout_attributes"), r.supplyLayoutDefaults = e("./layout_defaults"), r.plot = function(i) {
        for (var l = i._fullLayout, u2 = i.calcdata, c = l._subplots.ternary, f = 0; f < c.length; f++) {
          var h = c[f], p = a(u2, "ternary", h), d = l[h]._subplot;
          d || (d = new n({ id: h, graphDiv: i, container: l._ternarylayer.node() }, l), l[h]._subplot = d), d.plot(p, l, i._promises);
        }
      }, r.clean = function(i, l, u2, c) {
        for (var f = c._subplots.ternary || [], h = 0; h < f.length; h++) {
          var p = f[h], d = c[p]._subplot;
          !l[p] && d && (d.plotContainer.remove(), d.clipDef.remove(), d.clipDefRelative.remove(), d.layers["a-title"].remove(), d.layers["b-title"].remove(), d.layers["c-title"].remove());
        }
      };
    }, { "../../lib": 503, "../../plots/get_data": 593, "./layout_attributes": 635, "./layout_defaults": 636, "./ternary": 637 }], 635: [function(e, t, r) {
      "use strict";
      var n = e("../../components/color/attributes"), a = e("../domain").attributes, o = e("../cartesian/layout_attributes"), s = e("../../plot_api/edit_types").overrideAll, i = e("../../lib/extend").extendFlat, l = { title: { text: o.title.text, font: o.title.font }, color: o.color, tickmode: o.tickmode, nticks: i({}, o.nticks, { dflt: 6, min: 1 }), tick0: o.tick0, dtick: o.dtick, tickvals: o.tickvals, ticktext: o.ticktext, ticks: o.ticks, ticklen: o.ticklen, tickwidth: o.tickwidth, tickcolor: o.tickcolor, showticklabels: o.showticklabels, showtickprefix: o.showtickprefix, tickprefix: o.tickprefix, showticksuffix: o.showticksuffix, ticksuffix: o.ticksuffix, showexponent: o.showexponent, exponentformat: o.exponentformat, minexponent: o.minexponent, separatethousands: o.separatethousands, tickfont: o.tickfont, tickangle: o.tickangle, tickformat: o.tickformat, tickformatstops: o.tickformatstops, hoverformat: o.hoverformat, showline: i({}, o.showline, { dflt: true }), linecolor: o.linecolor, linewidth: o.linewidth, showgrid: i({}, o.showgrid, { dflt: true }), gridcolor: o.gridcolor, gridwidth: o.gridwidth, layer: o.layer, min: { valType: "number", dflt: 0, min: 0 }, _deprecated: { title: o._deprecated.title, titlefont: o._deprecated.titlefont } }, u2 = t.exports = s({ domain: a({ name: "ternary" }), bgcolor: { valType: "color", dflt: n.background }, sum: { valType: "number", dflt: 1, min: 0 }, aaxis: l, baxis: l, caxis: l }, "plot", "from-root");
      u2.uirevision = { valType: "any", editType: "none" }, u2.aaxis.uirevision = u2.baxis.uirevision = u2.caxis.uirevision = { valType: "any", editType: "none" };
    }, { "../../components/color/attributes": 365, "../../lib/extend": 493, "../../plot_api/edit_types": 536, "../cartesian/layout_attributes": 569, "../domain": 584 }], 636: [function(e, t, r) {
      "use strict";
      var n = e("../../components/color"), a = e("../../plot_api/plot_template"), o = e("../../lib"), s = e("../subplot_defaults"), i = e("../cartesian/tick_label_defaults"), l = e("../cartesian/prefix_suffix_defaults"), u2 = e("../cartesian/tick_mark_defaults"), c = e("../cartesian/tick_value_defaults"), f = e("../cartesian/line_grid_defaults"), h = e("./layout_attributes"), p = ["aaxis", "baxis", "caxis"];
      function d(m, g, x, b) {
        var y, w, _4, k = x("bgcolor"), T2 = x("sum");
        b.bgColor = n.combine(k, b.paper_bgcolor);
        for (var A2 = 0; A2 < p.length; A2++) w = m[y = p[A2]] || {}, (_4 = a.newContainer(g, y))._name = y, v(w, _4, b, g);
        var S2 = g.aaxis, C2 = g.baxis, E2 = g.caxis;
        S2.min + C2.min + E2.min >= T2 && (S2.min = 0, C2.min = 0, E2.min = 0, m.aaxis && delete m.aaxis.min, m.baxis && delete m.baxis.min, m.caxis && delete m.caxis.min);
      }
      function v(m, g, x, b) {
        var y = h[g._name];
        function w(C2, E2) {
          return o.coerce(m, g, y, C2, E2);
        }
        w("uirevision", b.uirevision), g.type = "linear";
        var _4 = w("color"), k = _4 !== y.color.dflt ? _4 : x.font.color, T2 = g._name.charAt(0).toUpperCase(), A2 = "Component " + T2, S2 = w("title.text", A2);
        g._hovertitle = S2 === A2 ? S2 : T2, o.coerceFont(w, "title.font", { family: x.font.family, size: o.bigFont(x.font.size), color: k }), w("min"), c(m, g, w, "linear"), l(m, g, w, "linear"), i(m, g, w, "linear"), u2(m, g, w, { outerTicks: true }), w("showticklabels") && (o.coerceFont(w, "tickfont", { family: x.font.family, size: x.font.size, color: k }), w("tickangle"), w("tickformat")), f(m, g, w, { dfltColor: _4, bgColor: x.bgColor, blend: 60, showLine: true, showGrid: true, noZeroLine: true, attributes: y }), w("hoverformat"), w("layer");
      }
      t.exports = function(m, g, x) {
        s(m, g, x, { type: "ternary", attributes: h, handleDefaults: d, font: g.font, paper_bgcolor: g.paper_bgcolor });
      };
    }, { "../../components/color": 366, "../../lib": 503, "../../plot_api/plot_template": 543, "../cartesian/line_grid_defaults": 571, "../cartesian/prefix_suffix_defaults": 573, "../cartesian/tick_label_defaults": 578, "../cartesian/tick_mark_defaults": 579, "../cartesian/tick_value_defaults": 580, "../subplot_defaults": 632, "./layout_attributes": 635 }], 637: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("tinycolor2"), o = e("../../registry"), s = e("../../lib"), i = s.strTranslate, l = s._, u2 = e("../../components/color"), c = e("../../components/drawing"), f = e("../cartesian/set_convert"), h = e("../../lib/extend").extendFlat, p = e("../plots"), d = e("../cartesian/axes"), v = e("../../components/dragelement"), m = e("../../components/fx"), g = e("../../components/dragelement/helpers"), x = g.freeMode, b = g.rectMode, y = e("../../components/titles"), w = e("../cartesian/select").prepSelect, _4 = e("../cartesian/select").selectOnClick, k = e("../cartesian/select").clearSelect, T2 = e("../cartesian/select").clearSelectionsCache, A2 = e("../cartesian/constants");
      function S2(V2, W2) {
        this.id = V2.id, this.graphDiv = V2.graphDiv, this.init(W2), this.makeFramework(W2), this.aTickLayout = null, this.bTickLayout = null, this.cTickLayout = null;
      }
      t.exports = S2;
      var C2 = S2.prototype;
      C2.init = function(V2) {
        this.container = V2._ternarylayer, this.defs = V2._defs, this.layoutId = V2._uid, this.traceHash = {}, this.layers = {};
      }, C2.plot = function(V2, W2) {
        var X2 = W2[this.id], Y2 = W2._size;
        this._hasClipOnAxisFalse = false;
        for (var K2 = 0; K2 < V2.length; K2++) if (V2[K2][0].trace.cliponaxis === false) {
          this._hasClipOnAxisFalse = true;
          break;
        }
        this.updateLayers(X2), this.adjustLayout(X2, Y2), p.generalUpdatePerTraceModule(this.graphDiv, this, V2, X2), this.layers.plotbg.select("path").call(u2.fill, X2.bgcolor);
      }, C2.makeFramework = function(V2) {
        var W2 = this.graphDiv, X2 = V2[this.id], Y2 = this.clipId = "clip" + this.layoutId + this.id, K2 = this.clipIdRelative = "clip-relative" + this.layoutId + this.id;
        this.clipDef = s.ensureSingleById(V2._clips, "clipPath", Y2, function(q) {
          q.append("path").attr("d", "M0,0Z");
        }), this.clipDefRelative = s.ensureSingleById(V2._clips, "clipPath", K2, function(q) {
          q.append("path").attr("d", "M0,0Z");
        }), this.plotContainer = s.ensureSingle(this.container, "g", this.id), this.updateLayers(X2), c.setClipUrl(this.layers.backplot, Y2, W2), c.setClipUrl(this.layers.grids, Y2, W2);
      }, C2.updateLayers = function(V2) {
        var W2 = this.layers, X2 = ["draglayer", "plotbg", "backplot", "grids"];
        V2.aaxis.layer === "below traces" && X2.push("aaxis", "aline"), V2.baxis.layer === "below traces" && X2.push("baxis", "bline"), V2.caxis.layer === "below traces" && X2.push("caxis", "cline"), X2.push("frontplot"), V2.aaxis.layer === "above traces" && X2.push("aaxis", "aline"), V2.baxis.layer === "above traces" && X2.push("baxis", "bline"), V2.caxis.layer === "above traces" && X2.push("caxis", "cline");
        var Y2 = this.plotContainer.selectAll("g.toplevel").data(X2, String), K2 = ["agrid", "bgrid", "cgrid"];
        Y2.enter().append("g").attr("class", function(q) {
          return "toplevel " + q;
        }).each(function(q) {
          var re = n.select(this);
          W2[q] = re, q === "frontplot" ? re.append("g").classed("scatterlayer", true) : q === "backplot" ? re.append("g").classed("maplayer", true) : q === "plotbg" ? re.append("path").attr("d", "M0,0Z") : q === "aline" || q === "bline" || q === "cline" ? re.append("path") : q === "grids" && K2.forEach(function(R2) {
            W2[R2] = re.append("g").classed("grid " + R2, true);
          });
        }), Y2.order();
      };
      var E2 = Math.sqrt(4 / 3);
      C2.adjustLayout = function(V2, W2) {
        var X2, Y2, K2, q, re, R2, z = this, H2 = V2.domain, te = (H2.x[0] + H2.x[1]) / 2, j = (H2.y[0] + H2.y[1]) / 2, Q2 = H2.x[1] - H2.x[0], Z2 = H2.y[1] - H2.y[0], ne = Q2 * W2.w, ae = Z2 * W2.h, ue = V2.sum, le = V2.aaxis.min, ce = V2.baxis.min, se = V2.caxis.min;
        ne > E2 * ae ? K2 = (q = ae) * E2 : q = (K2 = ne) / E2, re = Q2 * K2 / ne, R2 = Z2 * q / ae, X2 = W2.l + W2.w * te - K2 / 2, Y2 = W2.t + W2.h * (1 - j) - q / 2, z.x0 = X2, z.y0 = Y2, z.w = K2, z.h = q, z.sum = ue, z.xaxis = { type: "linear", range: [le + 2 * se - ue, ue - le - 2 * ce], domain: [te - re / 2, te + re / 2], _id: "x" }, f(z.xaxis, z.graphDiv._fullLayout), z.xaxis.setScale(), z.xaxis.isPtWithinRange = function(Be) {
          return Be.a >= z.aaxis.range[0] && Be.a <= z.aaxis.range[1] && Be.b >= z.baxis.range[1] && Be.b <= z.baxis.range[0] && Be.c >= z.caxis.range[1] && Be.c <= z.caxis.range[0];
        }, z.yaxis = { type: "linear", range: [le, ue - ce - se], domain: [j - R2 / 2, j + R2 / 2], _id: "y" }, f(z.yaxis, z.graphDiv._fullLayout), z.yaxis.setScale(), z.yaxis.isPtWithinRange = function() {
          return true;
        };
        var he = z.yaxis.domain[0], me = z.aaxis = h({}, V2.aaxis, { range: [le, ue - ce - se], side: "left", tickangle: (+V2.aaxis.tickangle || 0) - 30, domain: [he, he + R2 * E2], anchor: "free", position: 0, _id: "y", _length: K2 });
        f(me, z.graphDiv._fullLayout), me.setScale();
        var we = z.baxis = h({}, V2.baxis, { range: [ue - le - se, ce], side: "bottom", domain: z.xaxis.domain, anchor: "free", position: 0, _id: "x", _length: K2 });
        f(we, z.graphDiv._fullLayout), we.setScale();
        var be = z.caxis = h({}, V2.caxis, { range: [ue - le - ce, se], side: "right", tickangle: (+V2.caxis.tickangle || 0) + 30, domain: [he, he + R2 * E2], anchor: "free", position: 0, _id: "y", _length: K2 });
        f(be, z.graphDiv._fullLayout), be.setScale();
        var Ae = "M" + X2 + "," + (Y2 + q) + "h" + K2 + "l-" + K2 / 2 + ",-" + q + "Z";
        z.clipDef.select("path").attr("d", Ae), z.layers.plotbg.select("path").attr("d", Ae);
        var pe = "M0," + q + "h" + K2 + "l-" + K2 / 2 + ",-" + q + "Z";
        z.clipDefRelative.select("path").attr("d", pe);
        var ve = i(X2, Y2);
        z.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform", ve), z.clipDefRelative.select("path").attr("transform", null);
        var Ee = i(X2 - we._offset, Y2 + q);
        z.layers.baxis.attr("transform", Ee), z.layers.bgrid.attr("transform", Ee);
        var Se = i(X2 + K2 / 2, Y2) + "rotate(30)" + i(0, -me._offset);
        z.layers.aaxis.attr("transform", Se), z.layers.agrid.attr("transform", Se);
        var Ce = i(X2 + K2 / 2, Y2) + "rotate(-30)" + i(0, -be._offset);
        z.layers.caxis.attr("transform", Ce), z.layers.cgrid.attr("transform", Ce), z.drawAxes(true), z.layers.aline.select("path").attr("d", me.showline ? "M" + X2 + "," + (Y2 + q) + "l" + K2 / 2 + ",-" + q : "M0,0").call(u2.stroke, me.linecolor || "#000").style("stroke-width", (me.linewidth || 0) + "px"), z.layers.bline.select("path").attr("d", we.showline ? "M" + X2 + "," + (Y2 + q) + "h" + K2 : "M0,0").call(u2.stroke, we.linecolor || "#000").style("stroke-width", (we.linewidth || 0) + "px"), z.layers.cline.select("path").attr("d", be.showline ? "M" + (X2 + K2 / 2) + "," + Y2 + "l" + K2 / 2 + "," + q : "M0,0").call(u2.stroke, be.linecolor || "#000").style("stroke-width", (be.linewidth || 0) + "px"), z.graphDiv._context.staticPlot || z.initInteractions(), c.setClipUrl(z.layers.frontplot, z._hasClipOnAxisFalse ? null : z.clipId, z.graphDiv);
      }, C2.drawAxes = function(V2) {
        var W2 = this.graphDiv, X2 = this.id.substr(7) + "title", Y2 = this.layers, K2 = this.aaxis, q = this.baxis, re = this.caxis;
        if (this.drawAx(K2), this.drawAx(q), this.drawAx(re), V2) {
          var R2 = Math.max(K2.showticklabels ? K2.tickfont.size / 2 : 0, (re.showticklabels ? 0.75 * re.tickfont.size : 0) + (re.ticks === "outside" ? 0.87 * re.ticklen : 0)), z = (q.showticklabels ? q.tickfont.size : 0) + (q.ticks === "outside" ? q.ticklen : 0) + 3;
          Y2["a-title"] = y.draw(W2, "a" + X2, { propContainer: K2, propName: this.id + ".aaxis.title", placeholder: l(W2, "Click to enter Component A title"), attributes: { x: this.x0 + this.w / 2, y: this.y0 - K2.title.font.size / 3 - R2, "text-anchor": "middle" } }), Y2["b-title"] = y.draw(W2, "b" + X2, { propContainer: q, propName: this.id + ".baxis.title", placeholder: l(W2, "Click to enter Component B title"), attributes: { x: this.x0 - z, y: this.y0 + this.h + 0.83 * q.title.font.size + z, "text-anchor": "middle" } }), Y2["c-title"] = y.draw(W2, "c" + X2, { propContainer: re, propName: this.id + ".caxis.title", placeholder: l(W2, "Click to enter Component C title"), attributes: { x: this.x0 + this.w + z, y: this.y0 + this.h + 0.83 * re.title.font.size + z, "text-anchor": "middle" } });
        }
      }, C2.drawAx = function(V2) {
        var W2, X2 = this.graphDiv, Y2 = V2._name, K2 = Y2.charAt(0), q = V2._id, re = this.layers[Y2], R2 = K2 + "tickLayout", z = (W2 = V2).ticks + String(W2.ticklen) + String(W2.showticklabels);
        this[R2] !== z && (re.selectAll("." + q + "tick").remove(), this[R2] = z), V2.setScale();
        var H2 = d.calcTicks(V2), te = d.clipEnds(V2, H2), j = d.makeTransTickFn(V2), Q2 = d.getTickSigns(V2)[2], Z2 = s.deg2rad(30), ne = Q2 * (V2.linewidth || 1) / 2, ae = Q2 * V2.ticklen, ue = this.w, le = this.h, ce = K2 === "b" ? "M0," + ne + "l" + Math.sin(Z2) * ae + "," + Math.cos(Z2) * ae : "M" + ne + ",0l" + Math.cos(Z2) * ae + "," + -Math.sin(Z2) * ae, se = { a: "M0,0l" + le + ",-" + ue / 2, b: "M0,0l-" + ue / 2 + ",-" + le, c: "M0,0l-" + le + "," + ue / 2 }[K2];
        d.drawTicks(X2, V2, { vals: V2.ticks === "inside" ? te : H2, layer: re, path: ce, transFn: j, crisp: false }), d.drawGrid(X2, V2, { vals: te, layer: this.layers[K2 + "grid"], path: se, transFn: j, crisp: false }), d.drawLabels(X2, V2, { vals: H2, layer: re, transFn: j, labelFns: d.makeLabelFns(V2, 0, 30) });
      };
      var F13 = A2.MINZOOM / 2 + 0.87, N2 = "m-0.87,.5h" + F13 + "v3h-" + (F13 + 5.2) + "l" + (F13 / 2 + 2.6) + ",-" + (0.87 * F13 + 4.5) + "l2.6,1.5l-" + F13 / 2 + "," + 0.87 * F13 + "Z", D2 = "m0.87,.5h-" + F13 + "v3h" + (F13 + 5.2) + "l-" + (F13 / 2 + 2.6) + ",-" + (0.87 * F13 + 4.5) + "l-2.6,1.5l" + F13 / 2 + "," + 0.87 * F13 + "Z", I2 = "m0,1l" + F13 / 2 + "," + 0.87 * F13 + "l2.6,-1.5l-" + (F13 / 2 + 2.6) + ",-" + (0.87 * F13 + 4.5) + "l-" + (F13 / 2 + 2.6) + "," + (0.87 * F13 + 4.5) + "l2.6,1.5l" + F13 / 2 + ",-" + 0.87 * F13 + "Z", O2 = true;
      function L2(V2) {
        n.select(V2).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove();
      }
      C2.clearSelect = function() {
        T2(this.dragOptions), k(this.dragOptions.gd);
      }, C2.initInteractions = function() {
        var V2, W2, X2, Y2, K2, q, re, R2, z, H2, te, j, Q2 = this, Z2 = Q2.layers.plotbg.select("path").node(), ne = Q2.graphDiv, ae = ne._fullLayout._zoomlayer;
        function ue(pe) {
          var ve = {};
          return ve[Q2.id + ".aaxis.min"] = pe.a, ve[Q2.id + ".baxis.min"] = pe.b, ve[Q2.id + ".caxis.min"] = pe.c, ve;
        }
        function le(pe, ve) {
          var Ee = ne._fullLayout.clickmode;
          L2(ne), pe === 2 && (ne.emit("plotly_doubleclick", null), o.call("_guiRelayout", ne, ue({ a: 0, b: 0, c: 0 }))), Ee.indexOf("select") > -1 && pe === 1 && _4(ve, ne, [Q2.xaxis], [Q2.yaxis], Q2.id, Q2.dragOptions), Ee.indexOf("event") > -1 && m.click(ne, ve, Q2.id);
        }
        function ce(pe, ve) {
          return 1 - ve / Q2.h;
        }
        function se(pe, ve) {
          return 1 - (pe + (Q2.h - ve) / Math.sqrt(3)) / Q2.w;
        }
        function he(pe, ve) {
          return (pe - (Q2.h - ve) / Math.sqrt(3)) / Q2.w;
        }
        function me(pe, ve) {
          var Ee = X2 + pe * V2, Se = Y2 + ve * W2, Ce = Math.max(0, Math.min(1, ce(0, Y2), ce(0, Se))), Be = Math.max(0, Math.min(1, se(X2, Y2), se(Ee, Se))), Ue = Math.max(0, Math.min(1, he(X2, Y2), he(Ee, Se))), Ke = (Ce / 2 + Ue) * Q2.w, ct = (1 - Ce / 2 - Be) * Q2.w, We = (Ke + ct) / 2, Ze = ct - Ke, it = (1 - Ce) * Q2.h, ot = it - Ze / E2;
          Ze < A2.MINZOOM ? (re = K2, te.attr("d", z), j.attr("d", "M0,0Z")) : (re = { a: K2.a + Ce * q, b: K2.b + Be * q, c: K2.c + Ue * q }, te.attr("d", z + "M" + Ke + "," + it + "H" + ct + "L" + We + "," + ot + "L" + Ke + "," + it + "Z"), j.attr("d", "M" + X2 + "," + Y2 + "m0.5,0.5h5v-2h-5v-5h-2v5h-5v2h5v5h2ZM" + Ke + "," + it + N2 + "M" + ct + "," + it + D2 + "M" + We + "," + ot + I2)), H2 || (te.transition().style("fill", R2 > 0.2 ? "rgba(0,0,0,0.4)" : "rgba(255,255,255,0.3)").duration(200), j.transition().style("opacity", 1).duration(200), H2 = true), ne.emit("plotly_relayouting", ue(re));
        }
        function we() {
          L2(ne), re !== K2 && (o.call("_guiRelayout", ne, ue(re)), O2 && ne.data && ne._context.showTips && (s.notifier(l(ne, "Double-click to zoom back out"), "long"), O2 = false));
        }
        function be(pe, ve) {
          var Ee = pe / Q2.xaxis._m, Se = ve / Q2.yaxis._m, Ce = [(re = { a: K2.a - Se, b: K2.b + (Ee + Se) / 2, c: K2.c - (Ee - Se) / 2 }).a, re.b, re.c].sort(s.sorterAsc), Be = Ce.indexOf(re.a), Ue = Ce.indexOf(re.b), Ke = Ce.indexOf(re.c);
          Ce[0] < 0 && (Ce[1] + Ce[0] / 2 < 0 ? (Ce[2] += Ce[0] + Ce[1], Ce[0] = Ce[1] = 0) : (Ce[2] += Ce[0] / 2, Ce[1] += Ce[0] / 2, Ce[0] = 0), re = { a: Ce[Be], b: Ce[Ue], c: Ce[Ke] }, ve = (K2.a - re.a) * Q2.yaxis._m, pe = (K2.c - re.c - K2.b + re.b) * Q2.xaxis._m);
          var ct = i(Q2.x0 + pe, Q2.y0 + ve);
          Q2.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform", ct);
          var We = i(-pe, -ve);
          Q2.clipDefRelative.select("path").attr("transform", We), Q2.aaxis.range = [re.a, Q2.sum - re.b - re.c], Q2.baxis.range = [Q2.sum - re.a - re.c, re.b], Q2.caxis.range = [Q2.sum - re.a - re.b, re.c], Q2.drawAxes(false), Q2._hasClipOnAxisFalse && Q2.plotContainer.select(".scatterlayer").selectAll(".trace").call(c.hideOutsideRangePoints, Q2), ne.emit("plotly_relayouting", ue(re));
        }
        function Ae() {
          o.call("_guiRelayout", ne, ue(re));
        }
        this.dragOptions = { element: Z2, gd: ne, plotinfo: { id: Q2.id, domain: ne._fullLayout[Q2.id].domain, xaxis: Q2.xaxis, yaxis: Q2.yaxis }, subplot: Q2.id, prepFn: function(pe, ve, Ee) {
          Q2.dragOptions.xaxes = [Q2.xaxis], Q2.dragOptions.yaxes = [Q2.yaxis], V2 = ne._fullLayout._invScaleX, W2 = ne._fullLayout._invScaleY;
          var Se = Q2.dragOptions.dragmode = ne._fullLayout.dragmode;
          x(Se) ? Q2.dragOptions.minDrag = 1 : Q2.dragOptions.minDrag = void 0, Se === "zoom" ? (Q2.dragOptions.moveFn = me, Q2.dragOptions.clickFn = le, Q2.dragOptions.doneFn = we, function(Ce, Be, Ue) {
            var Ke = Z2.getBoundingClientRect();
            X2 = Be - Ke.left, Y2 = Ue - Ke.top, ne._fullLayout._calcInverseTransform(ne);
            var ct = ne._fullLayout._invTransform, We = s.apply3DTransform(ct)(X2, Y2);
            X2 = We[0], Y2 = We[1], K2 = { a: Q2.aaxis.range[0], b: Q2.baxis.range[1], c: Q2.caxis.range[1] }, re = K2, q = Q2.aaxis.range[1] - K2.a, R2 = a(Q2.graphDiv._fullLayout[Q2.id].bgcolor).getLuminance(), z = "M0," + Q2.h + "L" + Q2.w / 2 + ", 0L" + Q2.w + "," + Q2.h + "Z", H2 = false, te = ae.append("path").attr("class", "zoombox").attr("transform", i(Q2.x0, Q2.y0)).style({ fill: R2 > 0.2 ? "rgba(0,0,0,0)" : "rgba(255,255,255,0)", "stroke-width": 0 }).attr("d", z), j = ae.append("path").attr("class", "zoombox-corners").attr("transform", i(Q2.x0, Q2.y0)).style({ fill: u2.background, stroke: u2.defaultLine, "stroke-width": 1, opacity: 0 }).attr("d", "M0,0Z"), Q2.clearSelect(ne);
          }(0, ve, Ee)) : Se === "pan" ? (Q2.dragOptions.moveFn = be, Q2.dragOptions.clickFn = le, Q2.dragOptions.doneFn = Ae, K2 = { a: Q2.aaxis.range[0], b: Q2.baxis.range[1], c: Q2.caxis.range[1] }, re = K2, Q2.clearSelect(ne)) : (b(Se) || x(Se)) && w(pe, ve, Ee, Q2.dragOptions, Se);
        } }, Z2.onmousemove = function(pe) {
          m.hover(ne, pe, Q2.id), ne._fullLayout._lasthover = Z2, ne._fullLayout._hoversubplot = Q2.id;
        }, Z2.onmouseout = function(pe) {
          ne._dragging || v.unhover(ne, pe);
        }, v.init(this.dragOptions);
      };
    }, { "../../components/color": 366, "../../components/dragelement": 385, "../../components/dragelement/helpers": 384, "../../components/drawing": 388, "../../components/fx": 406, "../../components/titles": 464, "../../lib": 503, "../../lib/extend": 493, "../../registry": 638, "../cartesian/axes": 554, "../cartesian/constants": 561, "../cartesian/select": 575, "../cartesian/set_convert": 576, "../plots": 619, "@plotly/d3": 58, tinycolor2: 312 }], 638: [function(e, t, r) {
      "use strict";
      var n = e("./lib/loggers"), a = e("./lib/noop"), o = e("./lib/push_unique"), s = e("./lib/is_plain_object"), i = e("./lib/dom").addStyleRule, l = e("./lib/extend"), u2 = e("./plots/attributes"), c = e("./plots/layout_attributes"), f = l.extendFlat, h = l.extendDeepAll;
      function p(_4) {
        var k = _4.name, T2 = _4.categories, A2 = _4.meta;
        if (r.modules[k]) n.log("Type " + k + " already registered");
        else {
          r.subplotsRegistry[_4.basePlotModule.name] || function(O2) {
            var L2 = O2.name;
            if (r.subplotsRegistry[L2]) return void n.log("Plot type " + L2 + " already registered.");
            for (var V2 in g(O2), r.subplotsRegistry[L2] = O2, r.componentsRegistry) y(V2, O2.name);
          }(_4.basePlotModule);
          for (var S2 = {}, C2 = 0; C2 < T2.length; C2++) S2[T2[C2]] = true, r.allCategories[T2[C2]] = true;
          for (var E2 in r.modules[k] = { _module: _4, categories: S2 }, A2 && Object.keys(A2).length && (r.modules[k].meta = A2), r.allTypes.push(k), r.componentsRegistry) x(E2, k);
          _4.layoutAttributes && f(r.traceLayoutAttributes, _4.layoutAttributes);
          var F13 = _4.basePlotModule, N2 = F13.name;
          if (N2 === "mapbox") {
            var D2 = F13.constants.styleRules;
            for (var I2 in D2) i(".js-plotly-plot .plotly .mapboxgl-" + I2, D2[I2]);
          }
          N2 !== "geo" && N2 !== "mapbox" || typeof window === void 0 || window.PlotlyGeoAssets !== void 0 || (window.PlotlyGeoAssets = { topojson: {} });
        }
      }
      function d(_4) {
        if (typeof _4.name != "string") throw new Error("Component module *name* must be a string.");
        var k = _4.name;
        for (var T2 in r.componentsRegistry[k] = _4, _4.layoutAttributes && (_4.layoutAttributes._isLinkedToArray && o(r.layoutArrayContainers, k), g(_4)), r.modules) x(k, T2);
        for (var A2 in r.subplotsRegistry) y(k, A2);
        for (var S2 in r.transformsRegistry) b(k, S2);
        _4.schema && _4.schema.layout && h(c, _4.schema.layout);
      }
      function v(_4) {
        if (typeof _4.name != "string") throw new Error("Transform module *name* must be a string.");
        var k = "Transform module " + _4.name, T2 = typeof _4.transform == "function", A2 = typeof _4.calcTransform == "function";
        if (!T2 && !A2) throw new Error(k + " is missing a *transform* or *calcTransform* method.");
        for (var S2 in T2 && A2 && n.log([k + " has both a *transform* and *calcTransform* methods.", "Please note that all *transform* methods are executed", "before all *calcTransform* methods."].join(" ")), s(_4.attributes) || n.log(k + " registered without an *attributes* object."), typeof _4.supplyDefaults != "function" && n.log(k + " registered without a *supplyDefaults* method."), r.transformsRegistry[_4.name] = _4, r.componentsRegistry) b(S2, _4.name);
      }
      function m(_4) {
        var k = _4.name, T2 = k.split("-")[0], A2 = _4.dictionary, S2 = _4.format, C2 = A2 && Object.keys(A2).length, E2 = S2 && Object.keys(S2).length, F13 = r.localeRegistry, N2 = F13[k];
        if (N2 || (F13[k] = N2 = {}), T2 !== k) {
          var D2 = F13[T2];
          D2 || (F13[T2] = D2 = {}), C2 && D2.dictionary === N2.dictionary && (D2.dictionary = A2), E2 && D2.format === N2.format && (D2.format = S2);
        }
        C2 && (N2.dictionary = A2), E2 && (N2.format = S2);
      }
      function g(_4) {
        if (_4.layoutAttributes) {
          var k = _4.layoutAttributes._arrayAttrRegexps;
          if (k) for (var T2 = 0; T2 < k.length; T2++) o(r.layoutArrayRegexes, k[T2]);
        }
      }
      function x(_4, k) {
        var T2 = r.componentsRegistry[_4].schema;
        if (T2 && T2.traces) {
          var A2 = T2.traces[k];
          A2 && h(r.modules[k]._module.attributes, A2);
        }
      }
      function b(_4, k) {
        var T2 = r.componentsRegistry[_4].schema;
        if (T2 && T2.transforms) {
          var A2 = T2.transforms[k];
          A2 && h(r.transformsRegistry[k].attributes, A2);
        }
      }
      function y(_4, k) {
        var T2 = r.componentsRegistry[_4].schema;
        if (T2 && T2.subplots) {
          var A2 = r.subplotsRegistry[k], S2 = A2.layoutAttributes, C2 = A2.attr === "subplot" ? A2.name : A2.attr;
          Array.isArray(C2) && (C2 = C2[0]);
          var E2 = T2.subplots[C2];
          S2 && E2 && h(S2, E2);
        }
      }
      function w(_4) {
        return typeof _4 == "object" && (_4 = _4.type), _4;
      }
      r.modules = {}, r.allCategories = {}, r.allTypes = [], r.subplotsRegistry = {}, r.transformsRegistry = {}, r.componentsRegistry = {}, r.layoutArrayContainers = [], r.layoutArrayRegexes = [], r.traceLayoutAttributes = {}, r.localeRegistry = {}, r.apiMethodRegistry = {}, r.collectableSubplotTypes = null, r.register = function(_4) {
        if (r.collectableSubplotTypes = null, !_4) throw new Error("No argument passed to Plotly.register.");
        _4 && !Array.isArray(_4) && (_4 = [_4]);
        for (var k = 0; k < _4.length; k++) {
          var T2 = _4[k];
          if (!T2) throw new Error("Invalid module was attempted to be registered!");
          switch (T2.moduleType) {
            case "trace":
              p(T2);
              break;
            case "transform":
              v(T2);
              break;
            case "component":
              d(T2);
              break;
            case "locale":
              m(T2);
              break;
            case "apiMethod":
              var A2 = T2.name;
              r.apiMethodRegistry[A2] = T2.fn;
              break;
            default:
              throw new Error("Invalid module was attempted to be registered!");
          }
        }
      }, r.getModule = function(_4) {
        var k = r.modules[w(_4)];
        return !!k && k._module;
      }, r.traceIs = function(_4, k) {
        if ((_4 = w(_4)) === "various") return false;
        var T2 = r.modules[_4];
        return T2 || (_4 && n.log("Unrecognized trace type " + _4 + "."), T2 = r.modules[u2.type.dflt]), !!T2.categories[k];
      }, r.getTransformIndices = function(_4, k) {
        for (var T2 = [], A2 = _4.transforms || [], S2 = 0; S2 < A2.length; S2++) A2[S2].type === k && T2.push(S2);
        return T2;
      }, r.hasTransform = function(_4, k) {
        for (var T2 = _4.transforms || [], A2 = 0; A2 < T2.length; A2++) if (T2[A2].type === k) return true;
        return false;
      }, r.getComponentMethod = function(_4, k) {
        var T2 = r.componentsRegistry[_4];
        return T2 && T2[k] || a;
      }, r.call = function() {
        var _4 = arguments[0], k = [].slice.call(arguments, 1);
        return r.apiMethodRegistry[_4].apply(null, k);
      };
    }, { "./lib/dom": 491, "./lib/extend": 493, "./lib/is_plain_object": 504, "./lib/loggers": 507, "./lib/noop": 512, "./lib/push_unique": 518, "./plots/attributes": 550, "./plots/layout_attributes": 610 }], 639: [function(e, t, r) {
      "use strict";
      var n = e("../registry"), a = e("../lib"), o = a.extendFlat, s = a.extendDeep;
      function i(l) {
        var u2;
        switch (l) {
          case "themes__thumb":
            u2 = { autosize: true, width: 150, height: 150, title: { text: "" }, showlegend: false, margin: { l: 5, r: 5, t: 5, b: 5, pad: 0 }, annotations: [] };
            break;
          case "thumbnail":
            u2 = { title: { text: "" }, hidesources: true, showlegend: false, borderwidth: 0, bordercolor: "", margin: { l: 1, r: 1, t: 1, b: 1, pad: 0 }, annotations: [] };
            break;
          default:
            u2 = {};
        }
        return u2;
      }
      t.exports = function(l, u2) {
        var c, f, h = l.data, p = l.layout, d = s([], h), v = s({}, p, i(u2.tileClass)), m = l._context || {};
        if (u2.width && (v.width = u2.width), u2.height && (v.height = u2.height), u2.tileClass === "thumbnail" || u2.tileClass === "themes__thumb") {
          v.annotations = [];
          var g = Object.keys(v);
          for (c = 0; c < g.length; c++) f = g[c], ["xaxis", "yaxis", "zaxis"].indexOf(f.slice(0, 5)) > -1 && (v[g[c]].title = { text: "" });
          for (c = 0; c < d.length; c++) {
            var x = d[c];
            x.showscale = false, x.marker && (x.marker.showscale = false), n.traceIs(x, "pie-like") && (x.textposition = "none");
          }
        }
        if (Array.isArray(u2.annotations)) for (c = 0; c < u2.annotations.length; c++) v.annotations.push(u2.annotations[c]);
        var b = Object.keys(v).filter(function(T2) {
          return T2.match(/^scene\d*$/);
        });
        if (b.length) {
          var y = {};
          for (u2.tileClass === "thumbnail" && (y = { title: { text: "" }, showaxeslabels: false, showticklabels: false, linetickenable: false }), c = 0; c < b.length; c++) {
            var w = v[b[c]];
            w.xaxis || (w.xaxis = {}), w.yaxis || (w.yaxis = {}), w.zaxis || (w.zaxis = {}), o(w.xaxis, y), o(w.yaxis, y), o(w.zaxis, y), w._scene = null;
          }
        }
        var _4 = document.createElement("div");
        u2.tileClass && (_4.className = u2.tileClass);
        var k = { gd: _4, td: _4, layout: v, data: d, config: { staticPlot: u2.staticPlot === void 0 || u2.staticPlot, plotGlPixelRatio: u2.plotGlPixelRatio === void 0 ? 2 : u2.plotGlPixelRatio, displaylogo: u2.displaylogo || false, showLink: u2.showLink || false, showTips: u2.showTips || false, mapboxAccessToken: m.mapboxAccessToken } };
        return u2.setBackground !== "transparent" && (k.config.setBackground = u2.setBackground || "opaque"), k.gd.defaultLayout = i(u2.tileClass), k;
      };
    }, { "../lib": 503, "../registry": 638 }], 640: [function(e, t, r) {
      "use strict";
      var n = e("../lib"), a = e("../plot_api/to_image"), o = e("./filesaver"), s = e("./helpers");
      t.exports = function(i, l) {
        var u2;
        return n.isPlainObject(i) || (u2 = n.getGraphDiv(i)), (l = l || {}).format = l.format || "png", l.width = l.width || null, l.height = l.height || null, l.imageDataOnly = true, new Promise(function(c, f) {
          u2 && u2._snapshotInProgress && f(new Error("Snapshotting already in progress.")), n.isIE() && l.format !== "svg" && f(new Error(s.MSG_IE_BAD_FORMAT)), u2 && (u2._snapshotInProgress = true);
          var h = a(i, l), p = l.filename || i.fn || "newplot";
          p += "." + l.format.replace("-", "."), h.then(function(d) {
            return u2 && (u2._snapshotInProgress = false), o(d, p, l.format);
          }).then(function(d) {
            c(d);
          }).catch(function(d) {
            u2 && (u2._snapshotInProgress = false), f(d);
          });
        });
      };
    }, { "../lib": 503, "../plot_api/to_image": 546, "./filesaver": 641, "./helpers": 642 }], 641: [function(e, t, r) {
      "use strict";
      var n = e("../lib"), a = e("./helpers");
      t.exports = function(o, s, i) {
        var l = document.createElement("a"), u2 = "download" in l;
        return new Promise(function(c, f) {
          var h, p;
          if (n.isIE()) return h = a.createBlob(o, "svg"), window.navigator.msSaveBlob(h, s), h = null, c(s);
          if (u2) return h = a.createBlob(o, i), p = a.createObjectURL(h), l.href = p, l.download = s, document.body.appendChild(l), l.click(), document.body.removeChild(l), a.revokeObjectURL(p), h = null, c(s);
          if (n.isSafari()) {
            var d = i === "svg" ? "," : ";base64,";
            return a.octetStream(d + encodeURIComponent(o)), c(s);
          }
          f(new Error("download error"));
        });
      };
    }, { "../lib": 503, "./helpers": 642 }], 642: [function(e, t, r) {
      "use strict";
      var n = e("../registry");
      r.getDelay = function(o) {
        return o._has && (o._has("gl3d") || o._has("gl2d") || o._has("mapbox")) ? 500 : 0;
      }, r.getRedrawFunc = function(o) {
        return function() {
          n.getComponentMethod("colorbar", "draw")(o);
        };
      }, r.encodeSVG = function(o) {
        return "data:image/svg+xml," + encodeURIComponent(o);
      }, r.encodeJSON = function(o) {
        return "data:application/json," + encodeURIComponent(o);
      };
      var a = window.URL || window.webkitURL;
      r.createObjectURL = function(o) {
        return a.createObjectURL(o);
      }, r.revokeObjectURL = function(o) {
        return a.revokeObjectURL(o);
      }, r.createBlob = function(o, s) {
        if (s === "svg") return new window.Blob([o], { type: "image/svg+xml;charset=utf-8" });
        if (s === "full-json") return new window.Blob([o], { type: "application/json;charset=utf-8" });
        var i = function(l) {
          for (var u2 = l.length, c = new ArrayBuffer(u2), f = new Uint8Array(c), h = 0; h < u2; h++) f[h] = l.charCodeAt(h);
          return c;
        }(window.atob(o));
        return new window.Blob([i], { type: "image/" + s });
      }, r.octetStream = function(o) {
        document.location.href = "data:application/octet-stream" + o;
      }, r.IMAGE_URL_PREFIX = /^data:image\/\w+;base64,/, r.MSG_IE_BAD_FORMAT = "Sorry IE does not support downloading from canvas. Try {format:'svg'} instead.";
    }, { "../registry": 638 }], 643: [function(e, t, r) {
      "use strict";
      var n = e("./helpers"), a = { getDelay: n.getDelay, getRedrawFunc: n.getRedrawFunc, clone: e("./cloneplot"), toSVG: e("./tosvg"), svgToImg: e("./svgtoimg"), toImage: e("./toimage"), downloadImage: e("./download") };
      t.exports = a;
    }, { "./cloneplot": 639, "./download": 640, "./helpers": 642, "./svgtoimg": 644, "./toimage": 645, "./tosvg": 646 }], 644: [function(e, t, r) {
      "use strict";
      var n = e("../lib"), a = e("events").EventEmitter, o = e("./helpers");
      t.exports = function(s) {
        var i = s.emitter || new a(), l = new Promise(function(u2, c) {
          var f = window.Image, h = s.svg, p = s.format || "png";
          if (n.isIE() && p !== "svg") {
            var d = new Error(o.MSG_IE_BAD_FORMAT);
            return c(d), s.promise ? l : i.emit("error", d);
          }
          var v, m, g = s.canvas, x = s.scale || 1, b = s.width || 300, y = s.height || 150, w = x * b, _4 = x * y, k = g.getContext("2d"), T2 = new f();
          p === "svg" || n.isSafari() ? m = o.encodeSVG(h) : (v = o.createBlob(h, "svg"), m = o.createObjectURL(v)), g.width = w, g.height = _4, T2.onload = function() {
            var A2;
            switch (v = null, o.revokeObjectURL(m), p !== "svg" && k.drawImage(T2, 0, 0, w, _4), p) {
              case "jpeg":
                A2 = g.toDataURL("image/jpeg");
                break;
              case "png":
                A2 = g.toDataURL("image/png");
                break;
              case "webp":
                A2 = g.toDataURL("image/webp");
                break;
              case "svg":
                A2 = m;
                break;
              default:
                var S2 = "Image format is not jpeg, png, svg or webp.";
                if (c(new Error(S2)), !s.promise) return i.emit("error", S2);
            }
            u2(A2), s.promise || i.emit("success", A2);
          }, T2.onerror = function(A2) {
            if (v = null, o.revokeObjectURL(m), c(A2), !s.promise) return i.emit("error", A2);
          }, T2.src = m;
        });
        return s.promise ? l : i;
      };
    }, { "../lib": 503, "./helpers": 642, events: 84 }], 645: [function(e, t, r) {
      "use strict";
      var n = e("events").EventEmitter, a = e("../registry"), o = e("../lib"), s = e("./helpers"), i = e("./cloneplot"), l = e("./tosvg"), u2 = e("./svgtoimg");
      t.exports = function(c, f) {
        var h = new n(), p = i(c, { format: "png" }), d = p.gd;
        d.style.position = "absolute", d.style.left = "-5000px", document.body.appendChild(d);
        var v = s.getRedrawFunc(d);
        return a.call("_doPlot", d, p.data, p.layout, p.config).then(v).then(function() {
          var m = s.getDelay(d._fullLayout);
          setTimeout(function() {
            var g = l(d), x = document.createElement("canvas");
            x.id = o.randstr(), (h = u2({ format: f.format, width: d._fullLayout.width, height: d._fullLayout.height, canvas: x, emitter: h, svg: g })).clean = function() {
              d && document.body.removeChild(d);
            };
          }, m);
        }).catch(function(m) {
          h.emit("error", m);
        }), h;
      };
    }, { "../lib": 503, "../registry": 638, "./cloneplot": 639, "./helpers": 642, "./svgtoimg": 644, "./tosvg": 646, events: 84 }], 646: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../lib"), o = e("../components/drawing"), s = e("../components/color"), i = e("../constants/xmlns_namespaces"), l = /"/g, u2 = new RegExp('("TOBESTRIPPED)|(TOBESTRIPPED")', "g");
      t.exports = function(c, f, h) {
        var p, d, v = c._fullLayout, m = v._paper, g = v._toppaper, x = v.width, b = v.height;
        m.insert("rect", ":first-child").call(o.setRect, 0, 0, x, b).call(s.fill, v.paper_bgcolor);
        var y = v._basePlotModules || [];
        for (p = 0; p < y.length; p++) {
          var w = y[p];
          w.toSVG && w.toSVG(c);
        }
        if (g) {
          var _4 = g.node().childNodes, k = Array.prototype.slice.call(_4);
          for (p = 0; p < k.length; p++) {
            var T2 = k[p];
            T2.childNodes.length && m.node().appendChild(T2);
          }
        }
        v._draggers && v._draggers.remove(), m.node().style.background = "", m.selectAll("text").attr({ "data-unformatted": null, "data-math": null }).each(function() {
          var C2 = n.select(this);
          if (this.style.visibility !== "hidden" && this.style.display !== "none") {
            C2.style({ visibility: null, display: null });
            var E2 = this.style.fontFamily;
            E2 && E2.indexOf('"') !== -1 && C2.style("font-family", E2.replace(l, "TOBESTRIPPED"));
          } else C2.remove();
        });
        var A2 = [];
        if (v._gradientUrlQueryParts) for (d in v._gradientUrlQueryParts) A2.push(d);
        if (v._patternUrlQueryParts) for (d in v._patternUrlQueryParts) A2.push(d);
        A2.length && m.selectAll(A2.join(",")).each(function() {
          var C2 = n.select(this), E2 = this.style.fill;
          E2 && E2.indexOf("url(") !== -1 && C2.style("fill", E2.replace(l, "TOBESTRIPPED"));
          var F13 = this.style.stroke;
          F13 && F13.indexOf("url(") !== -1 && C2.style("stroke", F13.replace(l, "TOBESTRIPPED"));
        }), f !== "pdf" && f !== "eps" || m.selectAll("#MathJax_SVG_glyphs path").attr("stroke-width", 0), m.node().setAttributeNS(i.xmlns, "xmlns", i.svg), m.node().setAttributeNS(i.xmlns, "xmlns:xlink", i.xlink), f === "svg" && h && (m.attr("width", h * x), m.attr("height", h * b), m.attr("viewBox", "0 0 " + x + " " + b));
        var S2 = new window.XMLSerializer().serializeToString(m.node());
        return S2 = function(C2) {
          var E2 = n.select("body").append("div").style({ display: "none" }).html(""), F13 = C2.replace(/(&[^;]*;)/gi, function(N2) {
            return N2 === "&lt;" ? "&#60;" : N2 === "&rt;" ? "&#62;" : N2.indexOf("<") !== -1 || N2.indexOf(">") !== -1 ? "" : E2.html(N2).text();
          });
          return E2.remove(), F13;
        }(S2), S2 = (S2 = S2.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g, "&amp;")).replace(u2, "'"), a.isIE() && (S2 = (S2 = (S2 = S2.replace(/"/gi, "'")).replace(/(\('#)([^']*)('\))/gi, '("#$2")')).replace(/(\\')/gi, '"')), S2;
      };
    }, { "../components/color": 366, "../components/drawing": 388, "../constants/xmlns_namespaces": 480, "../lib": 503, "@plotly/d3": 58 }], 647: [function(e, t, r) {
      "use strict";
      var n = e("../../lib");
      t.exports = function(a, o) {
        for (var s = 0; s < a.length; s++) a[s].i = s;
        n.mergeArray(o.text, a, "tx"), n.mergeArray(o.hovertext, a, "htx");
        var i = o.marker;
        if (i) {
          n.mergeArray(i.opacity, a, "mo", true), n.mergeArray(i.color, a, "mc");
          var l = i.line;
          l && (n.mergeArray(l.color, a, "mlc"), n.mergeArrayCastPositive(l.width, a, "mlw"));
        }
      };
    }, { "../../lib": 503 }], 648: [function(e, t, r) {
      "use strict";
      var n = e("../scatter/attributes"), a = e("../../plots/cartesian/axis_format_attributes").axisHoverFormat, o = e("../../plots/template_attributes").hovertemplateAttrs, s = e("../../plots/template_attributes").texttemplateAttrs, i = e("../../components/colorscale/attributes"), l = e("../../plots/font_attributes"), u2 = e("./constants"), c = e("../../components/drawing/attributes").pattern, f = e("../../lib/extend").extendFlat, h = l({ editType: "calc", arrayOk: true, colorEditType: "style" }), p = f({}, n.marker.line.width, { dflt: 0 }), d = f({ width: p, editType: "calc" }, i("marker.line")), v = f({ line: d, editType: "calc" }, i("marker"), { opacity: { valType: "number", arrayOk: true, dflt: 1, min: 0, max: 1, editType: "style" }, pattern: c });
      t.exports = { x: n.x, x0: n.x0, dx: n.dx, y: n.y, y0: n.y0, dy: n.dy, xperiod: n.xperiod, yperiod: n.yperiod, xperiod0: n.xperiod0, yperiod0: n.yperiod0, xperiodalignment: n.xperiodalignment, yperiodalignment: n.yperiodalignment, xhoverformat: a("x"), yhoverformat: a("y"), text: n.text, texttemplate: s({ editType: "plot" }, { keys: u2.eventDataKeys }), hovertext: n.hovertext, hovertemplate: o({}, { keys: u2.eventDataKeys }), textposition: { valType: "enumerated", values: ["inside", "outside", "auto", "none"], dflt: "auto", arrayOk: true, editType: "calc" }, insidetextanchor: { valType: "enumerated", values: ["end", "middle", "start"], dflt: "end", editType: "plot" }, textangle: { valType: "angle", dflt: "auto", editType: "plot" }, textfont: f({}, h, {}), insidetextfont: f({}, h, {}), outsidetextfont: f({}, h, {}), constraintext: { valType: "enumerated", values: ["inside", "outside", "both", "none"], dflt: "both", editType: "calc" }, cliponaxis: f({}, n.cliponaxis, {}), orientation: { valType: "enumerated", values: ["v", "h"], editType: "calc+clearAxisTypes" }, base: { valType: "any", dflt: null, arrayOk: true, editType: "calc" }, offset: { valType: "number", dflt: null, arrayOk: true, editType: "calc" }, width: { valType: "number", dflt: null, min: 0, arrayOk: true, editType: "calc" }, marker: v, offsetgroup: { valType: "string", dflt: "", editType: "calc" }, alignmentgroup: { valType: "string", dflt: "", editType: "calc" }, selected: { marker: { opacity: n.selected.marker.opacity, color: n.selected.marker.color, editType: "style" }, textfont: n.selected.textfont, editType: "style" }, unselected: { marker: { opacity: n.unselected.marker.opacity, color: n.unselected.marker.color, editType: "style" }, textfont: n.unselected.textfont, editType: "style" }, _deprecated: { bardir: { valType: "enumerated", editType: "calc", values: ["v", "h"] } } };
    }, { "../../components/colorscale/attributes": 373, "../../components/drawing/attributes": 387, "../../lib/extend": 493, "../../plots/cartesian/axis_format_attributes": 557, "../../plots/font_attributes": 585, "../../plots/template_attributes": 633, "../scatter/attributes": 926, "./constants": 650 }], 649: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/cartesian/axes"), a = e("../../plots/cartesian/align_period"), o = e("../../components/colorscale/helpers").hasColorscale, s = e("../../components/colorscale/calc"), i = e("./arrays_to_calcdata"), l = e("../scatter/calc_selection");
      t.exports = function(u2, c) {
        var f, h, p, d, v, m, g = n.getFromId(u2, c.xaxis || "x"), x = n.getFromId(u2, c.yaxis || "y"), b = { msUTC: !(!c.base && c.base !== 0) };
        c.orientation === "h" ? (f = g.makeCalcdata(c, "x", b), p = x.makeCalcdata(c, "y"), d = a(c, x, "y", p), v = !!c.yperiodalignment, m = "y") : (f = x.makeCalcdata(c, "y", b), p = g.makeCalcdata(c, "x"), d = a(c, g, "x", p), v = !!c.xperiodalignment, m = "x"), h = d.vals;
        for (var y = Math.min(h.length, f.length), w = new Array(y), _4 = 0; _4 < y; _4++) w[_4] = { p: h[_4], s: f[_4] }, v && (w[_4].orig_p = p[_4], w[_4][m + "End"] = d.ends[_4], w[_4][m + "Start"] = d.starts[_4]), c.ids && (w[_4].id = String(c.ids[_4]));
        return o(c, "marker") && s(u2, c, { vals: c.marker.color, containerStr: "marker", cLetter: "c" }), o(c, "marker.line") && s(u2, c, { vals: c.marker.line.color, containerStr: "marker.line", cLetter: "c" }), i(w, c), l(w, c), w;
      };
    }, { "../../components/colorscale/calc": 374, "../../components/colorscale/helpers": 377, "../../plots/cartesian/align_period": 551, "../../plots/cartesian/axes": 554, "../scatter/calc_selection": 928, "./arrays_to_calcdata": 647 }], 650: [function(e, t, r) {
      "use strict";
      t.exports = { TEXTPAD: 3, eventDataKeys: ["value", "label"] };
    }, {}], 651: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("../../lib").isArrayOrTypedArray, o = e("../../constants/numerical").BADNUM, s = e("../../registry"), i = e("../../plots/cartesian/axes"), l = e("../../plots/cartesian/constraints").getAxisGroup, u2 = e("./sieve.js");
      function c(y, w, _4, k, T2) {
        if (k.length) {
          var A2, S2, C2, E2;
          switch (function(F13, N2) {
            var D2, I2;
            for (D2 = 0; D2 < N2.length; D2++) {
              var O2, L2 = N2[D2], V2 = L2[0].trace, W2 = V2.type === "funnel" ? V2._base : V2.base, X2 = V2.orientation === "h" ? V2.xcalendar : V2.ycalendar, Y2 = F13.type === "category" || F13.type === "multicategory" ? function() {
                return null;
              } : F13.d2c;
              if (a(W2)) {
                for (I2 = 0; I2 < Math.min(W2.length, L2.length); I2++) O2 = Y2(W2[I2], 0, X2), n(O2) ? (L2[I2].b = +O2, L2[I2].hasB = 1) : L2[I2].b = 0;
                for (; I2 < L2.length; I2++) L2[I2].b = 0;
              } else {
                O2 = Y2(W2, 0, X2);
                var K2 = n(O2);
                for (O2 = K2 ? O2 : 0, I2 = 0; I2 < L2.length; I2++) L2[I2].b = O2, K2 && (L2[I2].hasB = 1);
              }
            }
          }(_4, k), T2.mode) {
            case "overlay":
              f(w, _4, k, T2);
              break;
            case "group":
              for (A2 = [], S2 = [], C2 = 0; C2 < k.length; C2++) (E2 = k[C2])[0].trace.offset === void 0 ? S2.push(E2) : A2.push(E2);
              S2.length && function(F13, N2, D2, I2, O2) {
                var L2 = new u2(I2, { posAxis: N2, sepNegVal: false, overlapNoMerge: !O2.norm });
                (function(V2, W2, X2, Y2) {
                  for (var K2 = V2._fullLayout, q = X2.positions, re = X2.distinctPositions, R2 = X2.minDiff, z = X2.traces, H2 = z.length, te = q.length !== re.length, j = R2 * (1 - Y2.gap), Q2 = l(K2, W2._id) + z[0][0].trace.orientation, Z2 = K2._alignmentOpts[Q2] || {}, ne = 0; ne < H2; ne++) {
                    var ae, ue, le = z[ne], ce = le[0].trace, se = Z2[ce.alignmentgroup] || {}, he = Object.keys(se.offsetGroups || {}).length, me = (ae = he ? j / he : te ? j / H2 : j) * (1 - (Y2.groupgap || 0));
                    ue = he ? ((2 * ce._offsetIndex + 1 - he) * ae - me) / 2 : te ? ((2 * ne + 1 - H2) * ae - me) / 2 : -me / 2;
                    var we = le[0].t;
                    we.barwidth = me, we.poffset = ue, we.bargroupwidth = j, we.bardelta = R2;
                  }
                  X2.binWidth = z[0][0].t.barwidth / 100, p(X2), d(W2, X2), v(W2, X2, te);
                })(F13, N2, L2, O2), function(V2, W2) {
                  for (var X2 = V2.traces, Y2 = 0; Y2 < X2.length; Y2++) {
                    var K2 = X2[Y2];
                    if (K2[0].trace.base === void 0) for (var q = new u2([K2], { posAxis: W2, sepNegVal: true, overlapNoMerge: true }), re = 0; re < K2.length; re++) {
                      var R2 = K2[re];
                      if (R2.p !== o) {
                        var z = q.put(R2.p, R2.b + R2.s);
                        z && (R2.b = z);
                      }
                    }
                  }
                }(L2, N2), O2.norm ? (g(L2), x(D2, L2, O2)) : m(D2, L2);
              }(y, w, _4, S2, T2), A2.length && f(w, _4, A2, T2);
              break;
            case "stack":
            case "relative":
              for (A2 = [], S2 = [], C2 = 0; C2 < k.length; C2++) (E2 = k[C2])[0].trace.base === void 0 ? S2.push(E2) : A2.push(E2);
              S2.length && function(F13, N2, D2, I2, O2) {
                var L2 = new u2(I2, { posAxis: N2, sepNegVal: O2.mode === "relative", overlapNoMerge: !(O2.norm || O2.mode === "stack" || O2.mode === "relative") });
                h(N2, L2, O2), function(K2, q, re) {
                  var R2, z, H2, te, j, Q2, Z2 = b(K2), ne = q.traces;
                  for (te = 0; te < ne.length; te++) if (R2 = ne[te], (z = R2[0].trace).type === "funnel") for (j = 0; j < R2.length; j++) (Q2 = R2[j]).s !== o && q.put(Q2.p, -0.5 * Q2.s);
                  for (te = 0; te < ne.length; te++) {
                    R2 = ne[te], z = R2[0].trace, H2 = z.type === "funnel";
                    var ae = [];
                    for (j = 0; j < R2.length; j++) if ((Q2 = R2[j]).s !== o) {
                      var ue;
                      ue = H2 ? Q2.s : Q2.s + Q2.b;
                      var le = q.put(Q2.p, ue), ce = le + ue;
                      Q2.b = le, Q2[Z2] = ce, re.norm || (ae.push(ce), Q2.hasB && ae.push(le));
                    }
                    re.norm || (z._extremes[K2._id] = i.findExtremes(K2, ae, { tozero: true, padded: true }));
                  }
                }(D2, L2, O2);
                for (var V2 = 0; V2 < I2.length; V2++) for (var W2 = I2[V2], X2 = 0; X2 < W2.length; X2++) {
                  var Y2 = W2[X2];
                  Y2.s !== o && Y2.b + Y2.s === L2.get(Y2.p, Y2.s) && (Y2._outmost = true);
                }
                O2.norm && x(D2, L2, O2);
              }(0, w, _4, S2, T2), A2.length && f(w, _4, A2, T2);
          }
          (function(F13, N2) {
            var D2, I2, O2, L2 = b(N2), V2 = {}, W2 = 1 / 0, X2 = -1 / 0;
            for (D2 = 0; D2 < F13.length; D2++) for (O2 = F13[D2], I2 = 0; I2 < O2.length; I2++) {
              var Y2 = O2[I2].p;
              n(Y2) && (W2 = Math.min(W2, Y2), X2 = Math.max(X2, Y2));
            }
            var K2 = 1e4 / (X2 - W2), q = V2.round = function(Q2) {
              return String(Math.round(K2 * (Q2 - W2)));
            };
            for (D2 = 0; D2 < F13.length; D2++) {
              (O2 = F13[D2])[0].t.extents = V2;
              var re = O2[0].t.poffset, R2 = Array.isArray(re);
              for (I2 = 0; I2 < O2.length; I2++) {
                var z = O2[I2], H2 = z[L2] - z.w / 2;
                if (n(H2)) {
                  var te = z[L2] + z.w / 2, j = q(z.p);
                  V2[j] ? V2[j] = [Math.min(H2, V2[j][0]), Math.max(te, V2[j][1])] : V2[j] = [H2, te];
                }
                z.p0 = z.p + (R2 ? re[I2] : re), z.p1 = z.p0 + z.w, z.s0 = z.b, z.s1 = z.s0 + z.s;
              }
            }
          })(k, w);
        }
      }
      function f(y, w, _4, k) {
        for (var T2 = 0; T2 < _4.length; T2++) {
          var A2 = _4[T2], S2 = new u2([A2], { posAxis: y, sepNegVal: false, overlapNoMerge: !k.norm });
          h(y, S2, k), k.norm ? (g(S2), x(w, S2, k)) : m(w, S2);
        }
      }
      function h(y, w, _4) {
        for (var k = w.minDiff, T2 = w.traces, A2 = k * (1 - _4.gap), S2 = A2 * (1 - (_4.groupgap || 0)), C2 = -S2 / 2, E2 = 0; E2 < T2.length; E2++) {
          var F13 = T2[E2][0].t;
          F13.barwidth = S2, F13.poffset = C2, F13.bargroupwidth = A2, F13.bardelta = k;
        }
        w.binWidth = T2[0][0].t.barwidth / 100, p(w), d(y, w), v(y, w);
      }
      function p(y) {
        var w, _4, k = y.traces;
        for (w = 0; w < k.length; w++) {
          var T2, A2 = k[w], S2 = A2[0], C2 = S2.trace, E2 = S2.t, F13 = C2._offset || C2.offset, N2 = E2.poffset;
          if (a(F13)) {
            for (T2 = Array.prototype.slice.call(F13, 0, A2.length), _4 = 0; _4 < T2.length; _4++) n(T2[_4]) || (T2[_4] = N2);
            for (_4 = T2.length; _4 < A2.length; _4++) T2.push(N2);
            E2.poffset = T2;
          } else F13 !== void 0 && (E2.poffset = F13);
          var D2 = C2._width || C2.width, I2 = E2.barwidth;
          if (a(D2)) {
            var O2 = Array.prototype.slice.call(D2, 0, A2.length);
            for (_4 = 0; _4 < O2.length; _4++) n(O2[_4]) || (O2[_4] = I2);
            for (_4 = O2.length; _4 < A2.length; _4++) O2.push(I2);
            if (E2.barwidth = O2, F13 === void 0) {
              for (T2 = [], _4 = 0; _4 < A2.length; _4++) T2.push(N2 + (I2 - O2[_4]) / 2);
              E2.poffset = T2;
            }
          } else D2 !== void 0 && (E2.barwidth = D2, F13 === void 0 && (E2.poffset = N2 + (I2 - D2) / 2));
        }
      }
      function d(y, w) {
        for (var _4 = w.traces, k = b(y), T2 = 0; T2 < _4.length; T2++) for (var A2 = _4[T2], S2 = A2[0].t, C2 = S2.poffset, E2 = Array.isArray(C2), F13 = S2.barwidth, N2 = Array.isArray(F13), D2 = 0; D2 < A2.length; D2++) {
          var I2 = A2[D2], O2 = I2.w = N2 ? F13[D2] : F13;
          I2[k] = I2.p + (E2 ? C2[D2] : C2) + O2 / 2;
        }
      }
      function v(y, w, _4) {
        var k = w.traces, T2 = w.minDiff / 2;
        i.minDtick(y, w.minDiff, w.distinctPositions[0], _4);
        for (var A2 = 0; A2 < k.length; A2++) {
          var S2, C2, E2, F13, N2 = k[A2], D2 = N2[0], I2 = D2.trace, O2 = [];
          for (F13 = 0; F13 < N2.length; F13++) C2 = (S2 = N2[F13]).p - T2, E2 = S2.p + T2, O2.push(C2, E2);
          if (I2.width || I2.offset) {
            var L2 = D2.t, V2 = L2.poffset, W2 = L2.barwidth, X2 = Array.isArray(V2), Y2 = Array.isArray(W2);
            for (F13 = 0; F13 < N2.length; F13++) {
              S2 = N2[F13];
              var K2 = X2 ? V2[F13] : V2, q = Y2 ? W2[F13] : W2;
              E2 = (C2 = S2.p + K2) + q, O2.push(C2, E2);
            }
          }
          I2._extremes[y._id] = i.findExtremes(y, O2, { padded: false });
        }
      }
      function m(y, w) {
        for (var _4 = w.traces, k = b(y), T2 = 0; T2 < _4.length; T2++) {
          for (var A2 = _4[T2], S2 = A2[0].trace, C2 = [], E2 = false, F13 = 0; F13 < A2.length; F13++) {
            var N2 = A2[F13], D2 = N2.b, I2 = D2 + N2.s;
            N2[k] = I2, C2.push(I2), N2.hasB && C2.push(D2), N2.hasB && N2.b || (E2 = true);
          }
          S2._extremes[y._id] = i.findExtremes(y, C2, { tozero: E2, padded: true });
        }
      }
      function g(y) {
        for (var w = y.traces, _4 = 0; _4 < w.length; _4++) for (var k = w[_4], T2 = 0; T2 < k.length; T2++) {
          var A2 = k[T2];
          A2.s !== o && y.put(A2.p, A2.b + A2.s);
        }
      }
      function x(y, w, _4) {
        var k = w.traces, T2 = b(y), A2 = _4.norm === "fraction" ? 1 : 100, S2 = A2 / 1e9, C2 = y.l2c(y.c2l(0)), E2 = _4.mode === "stack" ? A2 : C2;
        function F13(re) {
          return n(y.c2l(re)) && (re < C2 - S2 || re > E2 + S2 || !n(C2));
        }
        for (var N2 = 0; N2 < k.length; N2++) {
          for (var D2 = k[N2], I2 = D2[0].trace, O2 = [], L2 = false, V2 = false, W2 = 0; W2 < D2.length; W2++) {
            var X2 = D2[W2];
            if (X2.s !== o) {
              var Y2 = Math.abs(A2 / w.get(X2.p, X2.s));
              X2.b *= Y2, X2.s *= Y2;
              var K2 = X2.b, q = K2 + X2.s;
              X2[T2] = q, O2.push(q), V2 = V2 || F13(q), X2.hasB && (O2.push(K2), V2 = V2 || F13(K2)), X2.hasB && X2.b || (L2 = true);
            }
          }
          I2._extremes[y._id] = i.findExtremes(y, O2, { tozero: L2, padded: V2 });
        }
      }
      function b(y) {
        return y._id.charAt(0);
      }
      t.exports = { crossTraceCalc: function(y, w) {
        for (var _4 = w.xaxis, k = w.yaxis, T2 = y._fullLayout, A2 = y._fullData, S2 = y.calcdata, C2 = [], E2 = [], F13 = 0; F13 < A2.length; F13++) {
          var N2 = A2[F13];
          if (N2.visible === true && s.traceIs(N2, "bar") && N2.xaxis === _4._id && N2.yaxis === k._id && (N2.orientation === "h" ? C2.push(S2[F13]) : E2.push(S2[F13]), N2._computePh)) for (var D2 = y.calcdata[F13], I2 = 0; I2 < D2.length; I2++) typeof D2[I2].ph0 == "function" && (D2[I2].ph0 = D2[I2].ph0()), typeof D2[I2].ph1 == "function" && (D2[I2].ph1 = D2[I2].ph1());
        }
        var O2 = { xCat: _4.type === "category" || _4.type === "multicategory", yCat: k.type === "category" || k.type === "multicategory", mode: T2.barmode, norm: T2.barnorm, gap: T2.bargap, groupgap: T2.bargroupgap };
        c(y, _4, k, E2, O2), c(y, k, _4, C2, O2);
      }, setGroupPositions: c };
    }, { "../../constants/numerical": 479, "../../lib": 503, "../../plots/cartesian/axes": 554, "../../plots/cartesian/constraints": 562, "../../registry": 638, "./sieve.js": 661, "fast-isnumeric": 190 }], 652: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../components/color"), o = e("../../registry"), s = e("../scatter/xy_defaults"), i = e("../scatter/period_defaults"), l = e("./style_defaults"), u2 = e("../../plots/cartesian/constraints").getAxisGroup, c = e("./attributes"), f = n.coerceFont;
      function h(d, v, m, g) {
        var x = v.orientation, b = v[{ v: "x", h: "y" }[x] + "axis"], y = u2(m, b) + x, w = m._alignmentOpts || {}, _4 = g("alignmentgroup"), k = w[y];
        k || (k = w[y] = {});
        var T2 = k[_4];
        T2 ? T2.traces.push(v) : T2 = k[_4] = { traces: [v], alignmentIndex: Object.keys(k).length, offsetGroups: {} };
        var A2 = g("offsetgroup"), S2 = T2.offsetGroups, C2 = S2[A2];
        A2 && (C2 || (C2 = S2[A2] = { offsetIndex: Object.keys(S2).length }), v._offsetIndex = C2.offsetIndex);
      }
      function p(d, v, m, g, x, b) {
        var y = (b = b || {}).moduleHasSelected !== false, w = b.moduleHasUnselected !== false, _4 = b.moduleHasConstrain !== false, k = b.moduleHasCliponaxis !== false, T2 = b.moduleHasTextangle !== false, A2 = b.moduleHasInsideanchor !== false, S2 = !!b.hasPathbar, C2 = Array.isArray(x) || x === "auto", E2 = C2 || x === "inside", F13 = C2 || x === "outside";
        if (E2 || F13) {
          var N2 = f(g, "textfont", m.font), D2 = n.extendFlat({}, N2), I2 = !(d.textfont && d.textfont.color);
          if (I2 && delete D2.color, f(g, "insidetextfont", D2), S2) {
            var O2 = n.extendFlat({}, N2);
            I2 && delete O2.color, f(g, "pathbar.textfont", O2);
          }
          F13 && f(g, "outsidetextfont", N2), y && g("selected.textfont.color"), w && g("unselected.textfont.color"), _4 && g("constraintext"), k && g("cliponaxis"), T2 && g("textangle"), g("texttemplate");
        }
        E2 && A2 && g("insidetextanchor");
      }
      t.exports = { supplyDefaults: function(d, v, m, g) {
        function x(_4, k) {
          return n.coerce(d, v, c, _4, k);
        }
        if (s(d, v, g, x)) {
          i(d, v, g, x), x("xhoverformat"), x("yhoverformat"), x("orientation", v.x && !v.y ? "h" : "v"), x("base"), x("offset"), x("width"), x("text"), x("hovertext"), x("hovertemplate");
          var b = x("textposition");
          p(d, v, g, x, b, { moduleHasSelected: true, moduleHasUnselected: true, moduleHasConstrain: true, moduleHasCliponaxis: true, moduleHasTextangle: true, moduleHasInsideanchor: true }), l(d, v, x, m, g);
          var y = (v.marker.line || {}).color, w = o.getComponentMethod("errorbars", "supplyDefaults");
          w(d, v, y || a.defaultLine, { axis: "y" }), w(d, v, y || a.defaultLine, { axis: "x", inherit: "y" }), n.coerceSelectionMarkerOpacity(v, x);
        } else v.visible = false;
      }, crossTraceDefaults: function(d, v) {
        var m;
        function g(b) {
          return n.coerce(m._input, m, c, b);
        }
        if (v.barmode === "group") for (var x = 0; x < d.length; x++) (m = d[x]).type === "bar" && (m._input, h(0, m, v, g));
      }, handleGroupingDefaults: h, handleText: p };
    }, { "../../components/color": 366, "../../lib": 503, "../../plots/cartesian/constraints": 562, "../../registry": 638, "../scatter/period_defaults": 946, "../scatter/xy_defaults": 953, "./attributes": 648, "./style_defaults": 663 }], 653: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a, o) {
        return n.x = "xVal" in a ? a.xVal : a.x, n.y = "yVal" in a ? a.yVal : a.y, a.xa && (n.xaxis = a.xa), a.ya && (n.yaxis = a.ya), o.orientation === "h" ? (n.label = n.y, n.value = n.x) : (n.label = n.x, n.value = n.y), n;
      };
    }, {}], 654: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("tinycolor2"), o = e("../../lib").isArrayOrTypedArray;
      r.coerceString = function(s, i, l) {
        if (typeof i == "string") {
          if (i || !s.noBlank) return i;
        } else if ((typeof i == "number" || i === true) && !s.strict) return String(i);
        return l !== void 0 ? l : s.dflt;
      }, r.coerceNumber = function(s, i, l) {
        if (n(i)) {
          i = +i;
          var u2 = s.min, c = s.max;
          if (!(u2 !== void 0 && i < u2 || c !== void 0 && i > c)) return i;
        }
        return l !== void 0 ? l : s.dflt;
      }, r.coerceColor = function(s, i, l) {
        return a(i).isValid() ? i : l !== void 0 ? l : s.dflt;
      }, r.coerceEnumerated = function(s, i, l) {
        return s.coerceNumber && (i = +i), s.values.indexOf(i) !== -1 ? i : l !== void 0 ? l : s.dflt;
      }, r.getValue = function(s, i) {
        var l;
        return Array.isArray(s) ? i < s.length && (l = s[i]) : l = s, l;
      }, r.getLineWidth = function(s, i) {
        return 0 < i.mlw ? i.mlw : o(s.marker.line.width) ? 0 : s.marker.line.width;
      };
    }, { "../../lib": 503, "fast-isnumeric": 190, tinycolor2: 312 }], 655: [function(e, t, r) {
      "use strict";
      var n = e("../../components/fx"), a = e("../../registry"), o = e("../../components/color"), s = e("../../lib").fillText, i = e("./helpers").getLineWidth, l = e("../../plots/cartesian/axes").hoverLabelText, u2 = e("../../constants/numerical").BADNUM;
      function c(h, p, d, v, m) {
        var g, x, b, y, w, _4, k, T2 = h.cd, A2 = T2[0].trace, S2 = T2[0].t, C2 = v === "closest", E2 = A2.type === "waterfall", F13 = h.maxHoverDistance, N2 = h.maxSpikeDistance;
        A2.orientation === "h" ? (g = d, x = p, b = "y", y = "x", w = R2, _4 = q) : (g = p, x = d, b = "x", y = "y", _4 = R2, w = q);
        var D2 = A2[b + "period"], I2 = C2 || D2;
        function O2(ae) {
          return V2(ae, -1);
        }
        function L2(ae) {
          return V2(ae, 1);
        }
        function V2(ae, ue) {
          var le = ae.w;
          return ae[b] + ue * le / 2;
        }
        function W2(ae) {
          return ae[b + "End"] - ae[b + "Start"];
        }
        var X2 = C2 ? O2 : D2 ? function(ae) {
          return ae.p - W2(ae) / 2;
        } : function(ae) {
          return Math.min(O2(ae), ae.p - S2.bardelta / 2);
        }, Y2 = C2 ? L2 : D2 ? function(ae) {
          return ae.p + W2(ae) / 2;
        } : function(ae) {
          return Math.max(L2(ae), ae.p + S2.bardelta / 2);
        };
        function K2(ae, ue, le) {
          return m.finiteRange && (le = 0), n.inbox(ae - g, ue - g, le + Math.min(1, Math.abs(ue - ae) / k) - 1);
        }
        function q(ae) {
          return K2(X2(ae), Y2(ae), F13);
        }
        function re(ae) {
          var ue = ae[y];
          if (E2) {
            var le = Math.abs(ae.rawS) || 0;
            x > 0 ? ue += le : x < 0 && (ue -= le);
          }
          return ue;
        }
        function R2(ae) {
          var ue = x, le = ae.b, ce = re(ae);
          return n.inbox(le - ue, ce - ue, F13 + (ce - ue) / (ce - le) - 1);
        }
        var z = h[b + "a"], H2 = h[y + "a"];
        k = Math.abs(z.r2c(z.range[1]) - z.r2c(z.range[0]));
        var te = n.getDistanceFunction(v, w, _4, function(ae) {
          return (w(ae) + _4(ae)) / 2;
        });
        if (n.getClosest(T2, te, h), h.index !== false && T2[h.index].p !== u2) {
          I2 || (X2 = function(ae) {
            return Math.min(O2(ae), ae.p - S2.bargroupwidth / 2);
          }, Y2 = function(ae) {
            return Math.max(L2(ae), ae.p + S2.bargroupwidth / 2);
          });
          var j = T2[h.index], Q2 = A2.base ? j.b + j.s : j.s;
          h[y + "0"] = h[y + "1"] = H2.c2p(j[y], true), h[y + "LabelVal"] = Q2;
          var Z2 = S2.extents[S2.extents.round(j.p)];
          h[b + "0"] = z.c2p(C2 ? X2(j) : Z2[0], true), h[b + "1"] = z.c2p(C2 ? Y2(j) : Z2[1], true);
          var ne = j.orig_p !== void 0;
          return h[b + "LabelVal"] = ne ? j.orig_p : j.p, h.labelLabel = l(z, h[b + "LabelVal"], A2[b + "hoverformat"]), h.valueLabel = l(H2, h[y + "LabelVal"], A2[y + "hoverformat"]), h.baseLabel = l(H2, j.b, A2[y + "hoverformat"]), h.spikeDistance = (function(ae) {
            var ue = x, le = ae.b, ce = re(ae);
            return n.inbox(le - ue, ce - ue, N2 + (ce - ue) / (ce - le) - 1);
          }(j) + function(ae) {
            return K2(O2(ae), L2(ae), N2);
          }(j)) / 2, h[b + "Spike"] = z.c2p(j.p, true), s(j, A2, h), h.hovertemplate = A2.hovertemplate, h;
        }
      }
      function f(h, p) {
        var d = p.mcc || h.marker.color, v = p.mlcc || h.marker.line.color, m = i(h, p);
        return o.opacity(d) ? d : o.opacity(v) && m ? v : void 0;
      }
      t.exports = { hoverPoints: function(h, p, d, v, m) {
        var g = c(h, p, d, v, m);
        if (g) {
          var x = g.cd, b = x[0].trace, y = x[g.index];
          return g.color = f(b, y), a.getComponentMethod("errorbars", "hoverInfo")(y, b, g), [g];
        }
      }, hoverOnBars: c, getTraceColor: f };
    }, { "../../components/color": 366, "../../components/fx": 406, "../../constants/numerical": 479, "../../lib": 503, "../../plots/cartesian/axes": 554, "../../registry": 638, "./helpers": 654 }], 656: [function(e, t, r) {
      "use strict";
      t.exports = { attributes: e("./attributes"), layoutAttributes: e("./layout_attributes"), supplyDefaults: e("./defaults").supplyDefaults, crossTraceDefaults: e("./defaults").crossTraceDefaults, supplyLayoutDefaults: e("./layout_defaults"), calc: e("./calc"), crossTraceCalc: e("./cross_trace_calc").crossTraceCalc, colorbar: e("../scatter/marker_colorbar"), arraysToCalcdata: e("./arrays_to_calcdata"), plot: e("./plot").plot, style: e("./style").style, styleOnSelect: e("./style").styleOnSelect, hoverPoints: e("./hover").hoverPoints, eventData: e("./event_data"), selectPoints: e("./select"), moduleType: "trace", name: "bar", basePlotModule: e("../../plots/cartesian"), categories: ["bar-like", "cartesian", "svg", "bar", "oriented", "errorBarsOK", "showLegend", "zoomScale"], animatable: true, meta: {} };
    }, { "../../plots/cartesian": 568, "../scatter/marker_colorbar": 944, "./arrays_to_calcdata": 647, "./attributes": 648, "./calc": 649, "./cross_trace_calc": 651, "./defaults": 652, "./event_data": 653, "./hover": 655, "./layout_attributes": 657, "./layout_defaults": 658, "./plot": 659, "./select": 660, "./style": 662 }], 657: [function(e, t, r) {
      "use strict";
      t.exports = { barmode: { valType: "enumerated", values: ["stack", "group", "overlay", "relative"], dflt: "group", editType: "calc" }, barnorm: { valType: "enumerated", values: ["", "fraction", "percent"], dflt: "", editType: "calc" }, bargap: { valType: "number", min: 0, max: 1, editType: "calc" }, bargroupgap: { valType: "number", min: 0, max: 1, dflt: 0, editType: "calc" } };
    }, {}], 658: [function(e, t, r) {
      "use strict";
      var n = e("../../registry"), a = e("../../plots/cartesian/axes"), o = e("../../lib"), s = e("./layout_attributes");
      t.exports = function(i, l, u2) {
        function c(b, y) {
          return o.coerce(i, l, s, b, y);
        }
        for (var f = false, h = false, p = false, d = {}, v = c("barmode"), m = 0; m < u2.length; m++) {
          var g = u2[m];
          if (n.traceIs(g, "bar") && g.visible) {
            if (f = true, v === "group") {
              var x = g.xaxis + g.yaxis;
              d[x] && (p = true), d[x] = true;
            }
            g.visible && g.type === "histogram" && a.getFromId({ _fullLayout: l }, g[g.orientation === "v" ? "xaxis" : "yaxis"]).type !== "category" && (h = true);
          }
        }
        f ? (v !== "overlay" && c("barnorm"), c("bargap", h && !p ? 0 : 0.2), c("bargroupgap")) : delete l.barmode;
      };
    }, { "../../lib": 503, "../../plots/cartesian/axes": 554, "../../registry": 638, "./layout_attributes": 657 }], 659: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("fast-isnumeric"), o = e("../../lib"), s = e("../../lib/svg_text_utils"), i = e("../../components/color"), l = e("../../components/drawing"), u2 = e("../../registry"), c = e("../../plots/cartesian/axes").tickText, f = e("./uniform_text"), h = f.recordMinTextSize, p = f.clearMinTextSize, d = e("./style"), v = e("./helpers"), m = e("./constants"), g = e("./attributes"), x = g.text, b = g.textposition, y = e("../../components/fx/helpers").appendArrayPointValue, w = m.TEXTPAD;
      function _4(N2) {
        return N2.id;
      }
      function k(N2) {
        if (N2.ids) return _4;
      }
      function T2(N2, D2) {
        return N2 < D2 ? 1 : -1;
      }
      function A2(N2, D2, I2, O2) {
        var L2;
        return !D2.uniformtext.mode && S2(I2) ? (O2 && (L2 = O2()), N2.transition().duration(I2.duration).ease(I2.easing).each("end", function() {
          L2 && L2();
        }).each("interrupt", function() {
          L2 && L2();
        })) : N2;
      }
      function S2(N2) {
        return N2 && N2.duration > 0;
      }
      function C2(N2) {
        return N2 === "auto" ? 0 : N2;
      }
      function E2(N2, D2) {
        var I2 = Math.PI / 180 * D2, O2 = Math.abs(Math.sin(I2)), L2 = Math.abs(Math.cos(I2));
        return { x: N2.width * L2 + N2.height * O2, y: N2.width * O2 + N2.height * L2 };
      }
      function F13(N2, D2, I2, O2, L2, V2) {
        var W2 = !!V2.isHorizontal, X2 = !!V2.constrained, Y2 = V2.angle || 0, K2 = V2.anchor || "end", q = K2 === "end", re = K2 === "start", R2 = ((V2.leftToRight || 0) + 1) / 2, z = 1 - R2, H2 = L2.width, te = L2.height, j = Math.abs(D2 - N2), Q2 = Math.abs(O2 - I2), Z2 = j > 2 * w && Q2 > 2 * w ? w : 0;
        j -= 2 * Z2, Q2 -= 2 * Z2;
        var ne = C2(Y2);
        Y2 !== "auto" || H2 <= j && te <= Q2 || !(H2 > j || te > Q2) || (H2 > Q2 || te > j) && H2 < te == j < Q2 || (ne += 90);
        var ae = E2(L2, ne), ue = 1;
        X2 && (ue = Math.min(1, j / ae.x, Q2 / ae.y));
        var le = L2.left * z + L2.right * R2, ce = (L2.top + L2.bottom) / 2, se = (N2 + w) * z + (D2 - w) * R2, he = (I2 + O2) / 2, me = 0, we = 0;
        if (re || q) {
          var be = (W2 ? ae.x : ae.y) / 2, Ae = W2 ? T2(N2, D2) : T2(I2, O2);
          W2 ? re ? (se = N2 + Ae * Z2, me = -Ae * be) : (se = D2 - Ae * Z2, me = Ae * be) : re ? (he = I2 + Ae * Z2, we = -Ae * be) : (he = O2 - Ae * Z2, we = Ae * be);
        }
        return { textX: le, textY: ce, targetX: se, targetY: he, anchorX: me, anchorY: we, scale: ue, rotate: ne };
      }
      t.exports = { plot: function(N2, D2, I2, O2, L2, V2) {
        var W2 = D2.xaxis, X2 = D2.yaxis, Y2 = N2._fullLayout;
        L2 || (L2 = { mode: Y2.barmode, norm: Y2.barmode, gap: Y2.bargap, groupgap: Y2.bargroupgap }, p("bar", Y2));
        var K2 = o.makeTraceGroups(O2, I2, "trace bars").each(function(q) {
          var re = n.select(this), R2 = q[0].trace, z = R2.type === "waterfall", H2 = R2.type === "funnel", te = R2.type === "bar" || H2, j = 0;
          z && R2.connector.visible && R2.connector.mode === "between" && (j = R2.connector.line.width / 2);
          var Q2 = R2.orientation === "h", Z2 = S2(L2), ne = o.ensureSingle(re, "g", "points"), ae = k(R2), ue = ne.selectAll("g.point").data(o.identity, ae);
          ue.enter().append("g").classed("point", true), ue.exit().remove(), ue.each(function(ce, se) {
            var he, me, we = n.select(this), be = function(We, Ze, it, ot) {
              var mt = [], wt = [], Et = ot ? Ze : it, zt = ot ? it : Ze;
              return mt[0] = Et.c2p(We.s0, true), wt[0] = zt.c2p(We.p0, true), mt[1] = Et.c2p(We.s1, true), wt[1] = zt.c2p(We.p1, true), ot ? [mt, wt] : [wt, mt];
            }(ce, W2, X2, Q2), Ae = be[0][0], pe = be[0][1], ve = be[1][0], Ee = be[1][1], Se = (Q2 ? pe - Ae : Ee - ve) == 0;
            if (Se && te && v.getLineWidth(R2, ce) && (Se = false), Se || (Se = !(a(Ae) && a(pe) && a(ve) && a(Ee))), ce.isBlank = Se, Se && (Q2 ? pe = Ae : Ee = ve), j && !Se && (Q2 ? (Ae -= T2(Ae, pe) * j, pe += T2(Ae, pe) * j) : (ve -= T2(ve, Ee) * j, Ee += T2(ve, Ee) * j)), R2.type === "waterfall") {
              if (!Se) {
                var Ce = R2[ce.dir].marker;
                he = Ce.line.width, me = Ce.color;
              }
            } else he = v.getLineWidth(R2, ce), me = ce.mc || R2.marker.color;
            function Be(We) {
              var Ze = n.round(he / 2 % 1, 2);
              return L2.gap === 0 && L2.groupgap === 0 ? n.round(Math.round(We) - Ze, 2) : We;
            }
            if (!N2._context.staticPlot) {
              var Ue = i.opacity(me) < 1 || he > 0.01 ? Be : function(We, Ze, it) {
                return it && We === Ze ? We : Math.abs(We - Ze) >= 2 ? Be(We) : We > Ze ? Math.ceil(We) : Math.floor(We);
              };
              Ae = Ue(Ae, pe, Q2), pe = Ue(pe, Ae, Q2), ve = Ue(ve, Ee, !Q2), Ee = Ue(Ee, ve, !Q2);
            }
            var Ke = A2(o.ensureSingle(we, "path"), Y2, L2, V2);
            if (Ke.style("vector-effect", "non-scaling-stroke").attr("d", isNaN((pe - Ae) * (Ee - ve)) || Se && N2._context.staticPlot ? "M0,0Z" : "M" + Ae + "," + ve + "V" + Ee + "H" + pe + "V" + ve + "Z").call(l.setClipUrl, D2.layerClipId, N2), !Y2.uniformtext.mode && Z2) {
              var ct = l.makePointStyleFns(R2);
              l.singlePointStyle(ce, Ke, R2, ct, N2);
            }
            (function(We, Ze, it, ot, mt, wt, Et, zt, Nt, yt, pt) {
              var Ot, Jt = Ze.xaxis, tr = Ze.yaxis, Ye = We._fullLayout;
              function at(Vt, Kt, rr) {
                return o.ensureSingle(Vt, "text").text(Kt).attr({ class: "bartext bartext-" + Ot, "text-anchor": "middle", "data-notex": 1 }).call(l.font, rr).call(s.convertToTspans, We);
              }
              var Ge = ot[0].trace, st = Ge.orientation === "h", Ie = function(Vt, Kt, rr, Tr, yr) {
                var pr, lr = Kt[0].trace;
                return pr = lr.texttemplate ? function(_r, $r, Ar, Qr, hn) {
                  var wn = $r[0].trace, Yn = o.castOption(wn, Ar, "texttemplate");
                  if (!Yn) return "";
                  var Xn, Wn, _n, qr, Nr = wn.type === "histogram", Zr = wn.type === "waterfall", oa = wn.type === "funnel", tn = wn.orientation === "h";
                  tn ? (Xn = "y", Wn = hn, _n = "x", qr = Qr) : (Xn = "x", Wn = Qr, _n = "y", qr = hn);
                  function Zn(xr) {
                    return c(qr, qr.c2l(xr), true).text;
                  }
                  var Ln = $r[Ar], gn = {};
                  gn.label = Ln.p, gn.labelLabel = gn[Xn + "Label"] = (na = Ln.p, c(Wn, Wn.c2l(na), true).text);
                  var na, sr = o.castOption(wn, Ln.i, "text");
                  (sr === 0 || sr) && (gn.text = sr), gn.value = Ln.s, gn.valueLabel = gn[_n + "Label"] = Zn(Ln.s);
                  var Ut = {};
                  y(Ut, wn, Ln.i), (Nr || Ut.x === void 0) && (Ut.x = tn ? gn.value : gn.label), (Nr || Ut.y === void 0) && (Ut.y = tn ? gn.label : gn.value), (Nr || Ut.xLabel === void 0) && (Ut.xLabel = tn ? gn.valueLabel : gn.labelLabel), (Nr || Ut.yLabel === void 0) && (Ut.yLabel = tn ? gn.labelLabel : gn.valueLabel), Zr && (gn.delta = +Ln.rawS || Ln.s, gn.deltaLabel = Zn(gn.delta), gn.final = Ln.v, gn.finalLabel = Zn(gn.final), gn.initial = gn.final - gn.delta, gn.initialLabel = Zn(gn.initial)), oa && (gn.value = Ln.s, gn.valueLabel = Zn(gn.value), gn.percentInitial = Ln.begR, gn.percentInitialLabel = o.formatPercent(Ln.begR), gn.percentPrevious = Ln.difR, gn.percentPreviousLabel = o.formatPercent(Ln.difR), gn.percentTotal = Ln.sumR, gn.percenTotalLabel = o.formatPercent(Ln.sumR));
                  var Zt = o.castOption(wn, Ln.i, "customdata");
                  return Zt && (gn.customdata = Zt), o.texttemplateString(Yn, gn, _r._d3locale, Ut, gn, wn._meta || {});
                }(Vt, Kt, rr, Tr, yr) : lr.textinfo ? function(_r, $r, Ar, Qr) {
                  var hn = _r[0].trace, wn = hn.orientation === "h", Yn = hn.type === "waterfall", Xn = hn.type === "funnel";
                  function Wn(Zt) {
                    return c(wn ? Ar : Qr, +Zt, true).text;
                  }
                  var _n, qr = hn.textinfo, Nr = _r[$r], Zr = qr.split("+"), oa = [], tn = function(Zt) {
                    return Zr.indexOf(Zt) !== -1;
                  };
                  tn("label") && oa.push((Zn = _r[$r].p, c(wn ? Qr : Ar, Zn, true).text));
                  var Zn;
                  if (tn("text") && ((_n = o.castOption(hn, Nr.i, "text")) === 0 || _n) && oa.push(_n), Yn) {
                    var Ln = +Nr.rawS || Nr.s, gn = Nr.v, na = gn - Ln;
                    tn("initial") && oa.push(Wn(na)), tn("delta") && oa.push(Wn(Ln)), tn("final") && oa.push(Wn(gn));
                  }
                  if (Xn) {
                    tn("value") && oa.push(Wn(Nr.s));
                    var sr = 0;
                    tn("percent initial") && sr++, tn("percent previous") && sr++, tn("percent total") && sr++;
                    var Ut = sr > 1;
                    tn("percent initial") && (_n = o.formatPercent(Nr.begR), Ut && (_n += " of initial"), oa.push(_n)), tn("percent previous") && (_n = o.formatPercent(Nr.difR), Ut && (_n += " of previous"), oa.push(_n)), tn("percent total") && (_n = o.formatPercent(Nr.sumR), Ut && (_n += " of total"), oa.push(_n));
                  }
                  return oa.join("<br>");
                }(Kt, rr, Tr, yr) : v.getValue(lr.text, rr), v.coerceString(x, pr);
              }(Ye, ot, mt, Jt, tr);
              Ot = function(Vt, Kt) {
                var rr = v.getValue(Vt.textposition, Kt);
                return v.coerceEnumerated(b, rr);
              }(Ge, mt);
              var Pe = yt.mode === "stack" || yt.mode === "relative", $e = ot[mt], Ve = !Pe || $e._outmost;
              if (!Ie || Ot === "none" || ($e.isBlank || wt === Et || zt === Nt) && (Ot === "auto" || Ot === "inside")) return void it.select("text").remove();
              var ut = Ye.font, Re = d.getBarColor(ot[mt], Ge), qe = d.getInsideTextFont(Ge, mt, ut, Re), je = d.getOutsideTextFont(Ge, mt, ut), rt = it.datum();
              st ? Jt.type === "log" && rt.s0 <= 0 && (wt = Jt.range[0] < Jt.range[1] ? 0 : Jt._length) : tr.type === "log" && rt.s0 <= 0 && (zt = tr.range[0] < tr.range[1] ? tr._length : 0);
              var He, xe, Ne, ke, Me, Le = Math.abs(Et - wt) - 2 * w, ze = Math.abs(Nt - zt) - 2 * w;
              if (Ot === "outside" && (Ve || $e.hasB || (Ot = "inside")), Ot === "auto") if (Ve) {
                Ot = "inside", Me = o.ensureUniformFontSize(We, qe), He = at(it, Ie, Me), xe = l.bBox(He.node()), Ne = xe.width, ke = xe.height;
                var ft = Ne <= Le && ke <= ze, De = Ne <= ze && ke <= Le, Je = st ? Le >= Ne * (ze / ke) : ze >= ke * (Le / Ne);
                Ne > 0 && ke > 0 && (ft || De || Je) ? Ot = "inside" : (Ot = "outside", He.remove(), He = null);
              } else Ot = "inside";
              if (!He) {
                Me = o.ensureUniformFontSize(We, Ot === "outside" ? je : qe);
                var tt = (He = at(it, Ie, Me)).attr("transform");
                if (He.attr("transform", ""), xe = l.bBox(He.node()), Ne = xe.width, ke = xe.height, He.attr("transform", tt), Ne <= 0 || ke <= 0) return void He.remove();
              }
              var vt, kt, jt = Ge.textangle;
              Ot === "outside" ? (kt = Ge.constraintext === "both" || Ge.constraintext === "outside", vt = function(Vt, Kt, rr, Tr, yr, pr) {
                var lr, _r = !!pr.isHorizontal, $r = !!pr.constrained, Ar = pr.angle || 0, Qr = yr.width, hn = yr.height, wn = Math.abs(Kt - Vt), Yn = Math.abs(Tr - rr);
                lr = _r ? Yn > 2 * w ? w : 0 : wn > 2 * w ? w : 0;
                var Xn = 1;
                $r && (Xn = _r ? Math.min(1, Yn / hn) : Math.min(1, wn / Qr));
                var Wn = C2(Ar), _n = E2(yr, Wn), qr = (_r ? _n.x : _n.y) / 2, Nr = (yr.left + yr.right) / 2, Zr = (yr.top + yr.bottom) / 2, oa = (Vt + Kt) / 2, tn = (rr + Tr) / 2, Zn = 0, Ln = 0, gn = _r ? T2(Kt, Vt) : T2(rr, Tr);
                return _r ? (oa = Kt - gn * lr, Zn = gn * qr) : (tn = Tr + gn * lr, Ln = -gn * qr), { textX: Nr, textY: Zr, targetX: oa, targetY: tn, anchorX: Zn, anchorY: Ln, scale: Xn, rotate: Wn };
              }(wt, Et, zt, Nt, xe, { isHorizontal: st, constrained: kt, angle: jt })) : (kt = Ge.constraintext === "both" || Ge.constraintext === "inside", vt = F13(wt, Et, zt, Nt, xe, { isHorizontal: st, constrained: kt, angle: jt, anchor: Ge.insidetextanchor })), vt.fontSize = Me.size, h(Ge.type === "histogram" ? "bar" : Ge.type, vt, Ye), $e.transform = vt, A2(He, Ye, yt, pt).attr("transform", o.getTextTransform(vt));
            })(N2, D2, we, q, se, Ae, pe, ve, Ee, L2, V2), D2.layerClipId && l.hideOutsideRangePoint(ce, we.select("text"), W2, X2, R2.xcalendar, R2.ycalendar);
          });
          var le = R2.cliponaxis === false;
          l.setClipUrl(re, le ? null : D2.layerClipId, N2);
        });
        u2.getComponentMethod("errorbars", "plot")(N2, K2, D2, L2);
      }, toMoveInsideBar: F13 };
    }, { "../../components/color": 366, "../../components/drawing": 388, "../../components/fx/helpers": 402, "../../lib": 503, "../../lib/svg_text_utils": 529, "../../plots/cartesian/axes": 554, "../../registry": 638, "./attributes": 648, "./constants": 650, "./helpers": 654, "./style": 662, "./uniform_text": 664, "@plotly/d3": 58, "fast-isnumeric": 190 }], 660: [function(e, t, r) {
      "use strict";
      function n(a, o, s, i, l) {
        var u2 = o.c2p(i ? a.s0 : a.p0, true), c = o.c2p(i ? a.s1 : a.p1, true), f = s.c2p(i ? a.p0 : a.s0, true), h = s.c2p(i ? a.p1 : a.s1, true);
        return l ? [(u2 + c) / 2, (f + h) / 2] : i ? [c, (f + h) / 2] : [(u2 + c) / 2, h];
      }
      t.exports = function(a, o) {
        var s, i = a.cd, l = a.xaxis, u2 = a.yaxis, c = i[0].trace, f = c.type === "funnel", h = c.orientation === "h", p = [];
        if (o === false) for (s = 0; s < i.length; s++) i[s].selected = 0;
        else for (s = 0; s < i.length; s++) {
          var d = i[s], v = "ct" in d ? d.ct : n(d, l, u2, h, f);
          o.contains(v, false, s, a) ? (p.push({ pointNumber: s, x: l.c2d(d.x), y: u2.c2d(d.y) }), d.selected = 1) : d.selected = 0;
        }
        return p;
      };
    }, {}], 661: [function(e, t, r) {
      "use strict";
      t.exports = o;
      var n = e("../../lib").distinctVals, a = e("../../constants/numerical").BADNUM;
      function o(s, i) {
        this.traces = s, this.sepNegVal = i.sepNegVal, this.overlapNoMerge = i.overlapNoMerge;
        for (var l = 1 / 0, u2 = [], c = 0; c < s.length; c++) {
          for (var f = s[c], h = 0; h < f.length; h++) {
            var p = f[h];
            p.p !== a && u2.push(p.p);
          }
          f[0] && f[0].width1 && (l = Math.min(f[0].width1, l));
        }
        this.positions = u2;
        var d = n(u2);
        this.distinctPositions = d.vals, d.vals.length === 1 && l !== 1 / 0 ? this.minDiff = l : this.minDiff = Math.min(d.minDiff, l);
        var v = (i.posAxis || {}).type;
        v !== "category" && v !== "multicategory" || (this.minDiff = 1), this.binWidth = this.minDiff, this.bins = {};
      }
      o.prototype.put = function(s, i) {
        var l = this.getLabel(s, i), u2 = this.bins[l] || 0;
        return this.bins[l] = u2 + i, u2;
      }, o.prototype.get = function(s, i) {
        var l = this.getLabel(s, i);
        return this.bins[l] || 0;
      }, o.prototype.getLabel = function(s, i) {
        return (i < 0 && this.sepNegVal ? "v" : "^") + (this.overlapNoMerge ? s : Math.round(s / this.binWidth));
      };
    }, { "../../constants/numerical": 479, "../../lib": 503 }], 662: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../components/color"), o = e("../../components/drawing"), s = e("../../lib"), i = e("../../registry"), l = e("./uniform_text").resizeText, u2 = e("./attributes"), c = u2.textfont, f = u2.insidetextfont, h = u2.outsidetextfont, p = e("./helpers");
      function d(_4, k, T2) {
        o.pointStyle(_4.selectAll("path"), k, T2), v(_4, k, T2);
      }
      function v(_4, k, T2) {
        _4.selectAll("text").each(function(A2) {
          var S2 = n.select(this), C2 = s.ensureUniformFontSize(T2, m(S2, A2, k, T2));
          o.font(S2, C2);
        });
      }
      function m(_4, k, T2, A2) {
        var S2 = A2._fullLayout.font, C2 = T2.textfont;
        if (_4.classed("bartext-inside")) {
          var E2 = w(k, T2);
          C2 = x(T2, k.i, S2, E2);
        } else _4.classed("bartext-outside") && (C2 = b(T2, k.i, S2));
        return C2;
      }
      function g(_4, k, T2) {
        return y(c, _4.textfont, k, T2);
      }
      function x(_4, k, T2, A2) {
        var S2 = g(_4, k, T2);
        return (_4._input.textfont === void 0 || _4._input.textfont.color === void 0 || Array.isArray(_4.textfont.color) && _4.textfont.color[k] === void 0) && (S2 = { color: a.contrast(A2), family: S2.family, size: S2.size }), y(f, _4.insidetextfont, k, S2);
      }
      function b(_4, k, T2) {
        var A2 = g(_4, k, T2);
        return y(h, _4.outsidetextfont, k, A2);
      }
      function y(_4, k, T2, A2) {
        k = k || {};
        var S2 = p.getValue(k.family, T2), C2 = p.getValue(k.size, T2), E2 = p.getValue(k.color, T2);
        return { family: p.coerceString(_4.family, S2, A2.family), size: p.coerceNumber(_4.size, C2, A2.size), color: p.coerceColor(_4.color, E2, A2.color) };
      }
      function w(_4, k) {
        return k.type === "waterfall" ? k[_4.dir].marker.color : _4.mcc || _4.mc || k.marker.color;
      }
      t.exports = { style: function(_4) {
        var k = n.select(_4).selectAll("g.barlayer").selectAll("g.trace");
        l(_4, k, "bar");
        var T2 = k.size(), A2 = _4._fullLayout;
        k.style("opacity", function(S2) {
          return S2[0].trace.opacity;
        }).each(function(S2) {
          (A2.barmode === "stack" && T2 > 1 || A2.bargap === 0 && A2.bargroupgap === 0 && !S2[0].trace.marker.line.width) && n.select(this).attr("shape-rendering", "crispEdges");
        }), k.selectAll("g.points").each(function(S2) {
          d(n.select(this), S2[0].trace, _4);
        }), i.getComponentMethod("errorbars", "style")(k);
      }, styleTextPoints: v, styleOnSelect: function(_4, k, T2) {
        var A2 = k[0].trace;
        A2.selectedpoints ? function(S2, C2, E2) {
          o.selectedPointStyle(S2.selectAll("path"), C2), function(F13, N2, D2) {
            F13.each(function(I2) {
              var O2, L2 = n.select(this);
              if (I2.selected) {
                O2 = s.ensureUniformFontSize(D2, m(L2, I2, N2, D2));
                var V2 = N2.selected.textfont && N2.selected.textfont.color;
                V2 && (O2.color = V2), o.font(L2, O2);
              } else o.selectedTextStyle(L2, N2);
            });
          }(S2.selectAll("text"), C2, E2);
        }(T2, A2, _4) : (d(T2, A2, _4), i.getComponentMethod("errorbars", "style")(T2));
      }, getInsideTextFont: x, getOutsideTextFont: b, getBarColor: w, resizeText: l };
    }, { "../../components/color": 366, "../../components/drawing": 388, "../../lib": 503, "../../registry": 638, "./attributes": 648, "./helpers": 654, "./uniform_text": 664, "@plotly/d3": 58 }], 663: [function(e, t, r) {
      "use strict";
      var n = e("../../components/color"), a = e("../../components/colorscale/helpers").hasColorscale, o = e("../../components/colorscale/defaults"), s = e("../../lib").coercePattern;
      t.exports = function(i, l, u2, c, f) {
        var h = u2("marker.color", c), p = a(i, "marker");
        p && o(i, l, f, u2, { prefix: "marker.", cLetter: "c" }), u2("marker.line.color", n.defaultLine), a(i, "marker.line") && o(i, l, f, u2, { prefix: "marker.line.", cLetter: "c" }), u2("marker.line.width"), u2("marker.opacity"), s(u2, "marker.pattern", h, p), u2("selected.marker.color"), u2("unselected.marker.color");
      };
    }, { "../../components/color": 366, "../../components/colorscale/defaults": 376, "../../components/colorscale/helpers": 377, "../../lib": 503 }], 664: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../lib");
      function o(s) {
        return "_" + s + "Text_minsize";
      }
      t.exports = { recordMinTextSize: function(s, i, l) {
        if (l.uniformtext.mode) {
          var u2 = o(s), c = l.uniformtext.minsize, f = i.scale * i.fontSize;
          i.hide = f < c, l[u2] = l[u2] || 1 / 0, i.hide || (l[u2] = Math.min(l[u2], Math.max(f, c)));
        }
      }, clearMinTextSize: function(s, i) {
        i[o(s)] = void 0;
      }, resizeText: function(s, i, l) {
        var u2 = s._fullLayout, c = u2["_" + l + "Text_minsize"];
        if (c) {
          var f, h = u2.uniformtext.mode === "hide";
          switch (l) {
            case "funnelarea":
            case "pie":
            case "sunburst":
              f = "g.slice";
              break;
            case "treemap":
            case "icicle":
              f = "g.slice, g.pathbar";
              break;
            default:
              f = "g.points > g.point";
          }
          i.selectAll(f).each(function(p) {
            var d = p.transform;
            d && (d.scale = h && d.hide ? 0 : c / d.fontSize, n.select(this).select("text").attr("transform", a.getTextTransform(d)));
          });
        }
      } };
    }, { "../../lib": 503, "@plotly/d3": 58 }], 665: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/template_attributes").hovertemplateAttrs, a = e("../../lib/extend").extendFlat, o = e("../scatterpolar/attributes"), s = e("../bar/attributes");
      t.exports = { r: o.r, theta: o.theta, r0: o.r0, dr: o.dr, theta0: o.theta0, dtheta: o.dtheta, thetaunit: o.thetaunit, base: a({}, s.base, {}), offset: a({}, s.offset, {}), width: a({}, s.width, {}), text: a({}, s.text, {}), hovertext: a({}, s.hovertext, {}), marker: s.marker, hoverinfo: o.hoverinfo, hovertemplate: n(), selected: s.selected, unselected: s.unselected };
    }, { "../../lib/extend": 493, "../../plots/template_attributes": 633, "../bar/attributes": 648, "../scatterpolar/attributes": 1e3 }], 666: [function(e, t, r) {
      "use strict";
      var n = e("../../components/colorscale/helpers").hasColorscale, a = e("../../components/colorscale/calc"), o = e("../bar/arrays_to_calcdata"), s = e("../bar/cross_trace_calc").setGroupPositions, i = e("../scatter/calc_selection"), l = e("../../registry").traceIs, u2 = e("../../lib").extendFlat;
      t.exports = { calc: function(c, f) {
        for (var h = c._fullLayout, p = f.subplot, d = h[p].radialaxis, v = h[p].angularaxis, m = d.makeCalcdata(f, "r"), g = v.makeCalcdata(f, "theta"), x = f._length, b = new Array(x), y = m, w = g, _4 = 0; _4 < x; _4++) b[_4] = { p: w[_4], s: y[_4] };
        function k(T2) {
          var A2 = f[T2];
          A2 !== void 0 && (f["_" + T2] = Array.isArray(A2) ? v.makeCalcdata(f, T2) : v.d2c(A2, f.thetaunit));
        }
        return v.type === "linear" && (k("width"), k("offset")), n(f, "marker") && a(c, f, { vals: f.marker.color, containerStr: "marker", cLetter: "c" }), n(f, "marker.line") && a(c, f, { vals: f.marker.line.color, containerStr: "marker.line", cLetter: "c" }), o(b, f), i(b, f), b;
      }, crossTraceCalc: function(c, f, h) {
        for (var p = c.calcdata, d = [], v = 0; v < p.length; v++) {
          var m = p[v], g = m[0].trace;
          g.visible === true && l(g, "bar") && g.subplot === h && d.push(m);
        }
        var x = u2({}, f.radialaxis, { _id: "x" }), b = f.angularaxis;
        s(c, b, x, d, { mode: f.barmode, norm: f.barnorm, gap: f.bargap, groupgap: f.bargroupgap });
      } };
    }, { "../../components/colorscale/calc": 374, "../../components/colorscale/helpers": 377, "../../lib": 503, "../../registry": 638, "../bar/arrays_to_calcdata": 647, "../bar/cross_trace_calc": 651, "../scatter/calc_selection": 928 }], 667: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../scatterpolar/defaults").handleRThetaDefaults, o = e("../bar/style_defaults"), s = e("./attributes");
      t.exports = function(i, l, u2, c) {
        function f(h, p) {
          return n.coerce(i, l, s, h, p);
        }
        a(i, l, c, f) ? (f("thetaunit"), f("base"), f("offset"), f("width"), f("text"), f("hovertext"), f("hovertemplate"), o(i, l, f, u2, c), n.coerceSelectionMarkerOpacity(l, f)) : l.visible = false;
      };
    }, { "../../lib": 503, "../bar/style_defaults": 663, "../scatterpolar/defaults": 1002, "./attributes": 665 }], 668: [function(e, t, r) {
      "use strict";
      var n = e("../../components/fx"), a = e("../../lib"), o = e("../bar/hover").getTraceColor, s = a.fillText, i = e("../scatterpolar/hover").makeHoverPointText, l = e("../../plots/polar/helpers").isPtInsidePolygon;
      t.exports = function(u2, c, f) {
        var h = u2.cd, p = h[0].trace, d = u2.subplot, v = d.radialAxis, m = d.angularAxis, g = d.vangles, x = g ? l : a.isPtInsideSector, b = u2.maxHoverDistance, y = m._period || 2 * Math.PI, w = Math.abs(v.g2p(Math.sqrt(c * c + f * f))), _4 = Math.atan2(f, c);
        if (v.range[0] > v.range[1] && (_4 += Math.PI), n.getClosest(h, function(A2) {
          return x(w, _4, [A2.rp0, A2.rp1], [A2.thetag0, A2.thetag1], g) ? b + Math.min(1, Math.abs(A2.thetag1 - A2.thetag0) / y) - 1 + (A2.rp1 - w) / (A2.rp1 - A2.rp0) - 1 : 1 / 0;
        }, u2), u2.index !== false) {
          var k = h[u2.index];
          u2.x0 = u2.x1 = k.ct[0], u2.y0 = u2.y1 = k.ct[1];
          var T2 = a.extendFlat({}, k, { r: k.s, theta: k.p });
          return s(k, p, u2), i(T2, p, d, u2), u2.hovertemplate = p.hovertemplate, u2.color = o(p, k), u2.xLabelVal = u2.yLabelVal = void 0, k.s < 0 && (u2.idealAlign = "left"), [u2];
        }
      };
    }, { "../../components/fx": 406, "../../lib": 503, "../../plots/polar/helpers": 621, "../bar/hover": 655, "../scatterpolar/hover": 1004 }], 669: [function(e, t, r) {
      "use strict";
      t.exports = { moduleType: "trace", name: "barpolar", basePlotModule: e("../../plots/polar"), categories: ["polar", "bar", "showLegend"], attributes: e("./attributes"), layoutAttributes: e("./layout_attributes"), supplyDefaults: e("./defaults"), supplyLayoutDefaults: e("./layout_defaults"), calc: e("./calc").calc, crossTraceCalc: e("./calc").crossTraceCalc, plot: e("./plot"), colorbar: e("../scatter/marker_colorbar"), formatLabels: e("../scatterpolar/format_labels"), style: e("../bar/style").style, styleOnSelect: e("../bar/style").styleOnSelect, hoverPoints: e("./hover"), selectPoints: e("../bar/select"), meta: {} };
    }, { "../../plots/polar": 622, "../bar/select": 660, "../bar/style": 662, "../scatter/marker_colorbar": 944, "../scatterpolar/format_labels": 1003, "./attributes": 665, "./calc": 666, "./defaults": 667, "./hover": 668, "./layout_attributes": 670, "./layout_defaults": 671, "./plot": 672 }], 670: [function(e, t, r) {
      "use strict";
      t.exports = { barmode: { valType: "enumerated", values: ["stack", "overlay"], dflt: "stack", editType: "calc" }, bargap: { valType: "number", dflt: 0.1, min: 0, max: 1, editType: "calc" } };
    }, {}], 671: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("./layout_attributes");
      t.exports = function(o, s, i) {
        var l, u2 = {};
        function c(p, d) {
          return n.coerce(o[l] || {}, s[l], a, p, d);
        }
        for (var f = 0; f < i.length; f++) {
          var h = i[f];
          h.type === "barpolar" && h.visible === true && (u2[l = h.subplot] || (c("barmode"), c("bargap"), u2[l] = 1));
        }
      };
    }, { "../../lib": 503, "./layout_attributes": 670 }], 672: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("fast-isnumeric"), o = e("../../lib"), s = e("../../components/drawing"), i = e("../../plots/polar/helpers");
      t.exports = function(l, u2, c) {
        var f = u2.xaxis, h = u2.yaxis, p = u2.radialAxis, d = u2.angularAxis, v = function(g) {
          var x = g.cxx, b = g.cyy;
          return g.vangles ? function(y, w, _4, k) {
            var T2, A2;
            o.angleDelta(_4, k) > 0 ? (T2 = _4, A2 = k) : (T2 = k, A2 = _4);
            var S2 = [i.findEnclosingVertexAngles(T2, g.vangles)[0], (T2 + A2) / 2, i.findEnclosingVertexAngles(A2, g.vangles)[1]];
            return i.pathPolygonAnnulus(y, w, T2, A2, S2, x, b);
          } : function(y, w, _4, k) {
            return o.pathAnnulus(y, w, _4, k, x, b);
          };
        }(u2), m = u2.layers.frontplot.select("g.barlayer");
        o.makeTraceGroups(m, c, "trace bars").each(function() {
          var g = n.select(this), x = o.ensureSingle(g, "g", "points").selectAll("g.point").data(o.identity);
          x.enter().append("g").style("vector-effect", "non-scaling-stroke").style("stroke-miterlimit", 2).classed("point", true), x.exit().remove(), x.each(function(b) {
            var y, w = n.select(this), _4 = b.rp0 = p.c2p(b.s0), k = b.rp1 = p.c2p(b.s1), T2 = b.thetag0 = d.c2g(b.p0), A2 = b.thetag1 = d.c2g(b.p1);
            if (a(_4) && a(k) && a(T2) && a(A2) && _4 !== k && T2 !== A2) {
              var S2 = p.c2g(b.s1), C2 = (T2 + A2) / 2;
              b.ct = [f.c2p(S2 * Math.cos(C2)), h.c2p(S2 * Math.sin(C2))], y = v(_4, k, T2, A2);
            } else y = "M0,0Z";
            o.ensureSingle(w, "path").attr("d", y);
          }), s.setClipUrl(g, u2._hasClipOnAxisFalse ? u2.clipIds.forTraces : null, l);
        });
      };
    }, { "../../components/drawing": 388, "../../lib": 503, "../../plots/polar/helpers": 621, "@plotly/d3": 58, "fast-isnumeric": 190 }], 673: [function(e, t, r) {
      "use strict";
      var n = e("../scatter/attributes"), a = e("../bar/attributes"), o = e("../../components/color/attributes"), s = e("../../plots/cartesian/axis_format_attributes").axisHoverFormat, i = e("../../plots/template_attributes").hovertemplateAttrs, l = e("../../lib/extend").extendFlat, u2 = n.marker, c = u2.line;
      t.exports = { y: { valType: "data_array", editType: "calc+clearAxisTypes" }, x: { valType: "data_array", editType: "calc+clearAxisTypes" }, x0: { valType: "any", editType: "calc+clearAxisTypes" }, y0: { valType: "any", editType: "calc+clearAxisTypes" }, dx: { valType: "number", editType: "calc" }, dy: { valType: "number", editType: "calc" }, xperiod: n.xperiod, yperiod: n.yperiod, xperiod0: n.xperiod0, yperiod0: n.yperiod0, xperiodalignment: n.xperiodalignment, yperiodalignment: n.yperiodalignment, xhoverformat: s("x"), yhoverformat: s("y"), name: { valType: "string", editType: "calc+clearAxisTypes" }, q1: { valType: "data_array", editType: "calc+clearAxisTypes" }, median: { valType: "data_array", editType: "calc+clearAxisTypes" }, q3: { valType: "data_array", editType: "calc+clearAxisTypes" }, lowerfence: { valType: "data_array", editType: "calc" }, upperfence: { valType: "data_array", editType: "calc" }, notched: { valType: "boolean", editType: "calc" }, notchwidth: { valType: "number", min: 0, max: 0.5, dflt: 0.25, editType: "calc" }, notchspan: { valType: "data_array", editType: "calc" }, boxpoints: { valType: "enumerated", values: ["all", "outliers", "suspectedoutliers", false], editType: "calc" }, jitter: { valType: "number", min: 0, max: 1, editType: "calc" }, pointpos: { valType: "number", min: -2, max: 2, editType: "calc" }, boxmean: { valType: "enumerated", values: [true, "sd", false], editType: "calc" }, mean: { valType: "data_array", editType: "calc" }, sd: { valType: "data_array", editType: "calc" }, orientation: { valType: "enumerated", values: ["v", "h"], editType: "calc+clearAxisTypes" }, quartilemethod: { valType: "enumerated", values: ["linear", "exclusive", "inclusive"], dflt: "linear", editType: "calc" }, width: { valType: "number", min: 0, dflt: 0, editType: "calc" }, marker: { outliercolor: { valType: "color", dflt: "rgba(0, 0, 0, 0)", editType: "style" }, symbol: l({}, u2.symbol, { arrayOk: false, editType: "plot" }), opacity: l({}, u2.opacity, { arrayOk: false, dflt: 1, editType: "style" }), size: l({}, u2.size, { arrayOk: false, editType: "calc" }), color: l({}, u2.color, { arrayOk: false, editType: "style" }), line: { color: l({}, c.color, { arrayOk: false, dflt: o.defaultLine, editType: "style" }), width: l({}, c.width, { arrayOk: false, dflt: 0, editType: "style" }), outliercolor: { valType: "color", editType: "style" }, outlierwidth: { valType: "number", min: 0, dflt: 1, editType: "style" }, editType: "style" }, editType: "plot" }, line: { color: { valType: "color", editType: "style" }, width: { valType: "number", min: 0, dflt: 2, editType: "style" }, editType: "plot" }, fillcolor: n.fillcolor, whiskerwidth: { valType: "number", min: 0, max: 1, dflt: 0.5, editType: "calc" }, offsetgroup: a.offsetgroup, alignmentgroup: a.alignmentgroup, selected: { marker: n.selected.marker, editType: "style" }, unselected: { marker: n.unselected.marker, editType: "style" }, text: l({}, n.text, {}), hovertext: l({}, n.hovertext, {}), hovertemplate: i({}), hoveron: { valType: "flaglist", flags: ["boxes", "points"], dflt: "boxes+points", editType: "style" } };
    }, { "../../components/color/attributes": 365, "../../lib/extend": 493, "../../plots/cartesian/axis_format_attributes": 557, "../../plots/template_attributes": 633, "../bar/attributes": 648, "../scatter/attributes": 926 }], 674: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("../../plots/cartesian/axes"), o = e("../../plots/cartesian/align_period"), s = e("../../lib"), i = e("../../constants/numerical").BADNUM, l = s._;
      t.exports = function(x, b) {
        var y, w, _4, k, T2, A2, S2, C2 = x._fullLayout, E2 = a.getFromId(x, b.xaxis || "x"), F13 = a.getFromId(x, b.yaxis || "y"), N2 = [], D2 = b.type === "violin" ? "_numViolins" : "_numBoxes";
        b.orientation === "h" ? (_4 = E2, k = "x", T2 = F13, A2 = "y", S2 = !!b.yperiodalignment) : (_4 = F13, k = "y", T2 = E2, A2 = "x", S2 = !!b.xperiodalignment);
        var I2, O2, L2, V2, W2, X2, Y2 = function(it, ot, mt, wt) {
          var Et, zt = ot + "0" in it, Nt = "d" + ot in it;
          if (ot in it || zt && Nt) {
            var yt = mt.makeCalcdata(it, ot);
            return [o(it, mt, ot, yt).vals, yt];
          }
          Et = zt ? it[ot + "0"] : "name" in it && (mt.type === "category" || n(it.name) && ["linear", "log"].indexOf(mt.type) !== -1 || s.isDateTime(it.name) && mt.type === "date") ? it.name : wt;
          for (var pt = mt.type === "multicategory" ? mt.r2c_just_indices(Et) : mt.d2c(Et, 0, it[ot + "calendar"]), Ot = it._length, Jt = new Array(Ot), tr = 0; tr < Ot; tr++) Jt[tr] = pt;
          return [Jt];
        }(b, A2, T2, C2[D2]), K2 = Y2[0], q = Y2[1], re = s.distinctVals(K2, T2), R2 = re.vals, z = re.minDiff / 2, H2 = (b.boxpoints || b.points) === "all" ? s.identity : function(it) {
          return it.v < I2.lf || it.v > I2.uf;
        };
        if (b._hasPreCompStats) {
          var te = b[k], j = function(it) {
            return _4.d2c((b[it] || [])[y]);
          }, Q2 = 1 / 0, Z2 = -1 / 0;
          for (y = 0; y < b._length; y++) {
            var ne = K2[y];
            if (n(ne)) {
              if ((I2 = {}).pos = I2[A2] = ne, S2 && q && (I2.orig_p = q[y]), I2.q1 = j("q1"), I2.med = j("median"), I2.q3 = j("q3"), O2 = [], te && s.isArrayOrTypedArray(te[y])) for (w = 0; w < te[y].length; w++) (X2 = _4.d2c(te[y][w])) !== i && (c(W2 = { v: X2, i: [y, w] }, b, [y, w]), O2.push(W2));
              if (I2.pts = O2.sort(f), V2 = (L2 = I2[k] = O2.map(h)).length, I2.med !== i && I2.q1 !== i && I2.q3 !== i && I2.med >= I2.q1 && I2.q3 >= I2.med) {
                var ae = j("lowerfence");
                I2.lf = ae !== i && ae <= I2.q1 ? ae : p(I2, L2, V2);
                var ue = j("upperfence");
                I2.uf = ue !== i && ue >= I2.q3 ? ue : d(I2, L2, V2);
                var le = j("mean");
                I2.mean = le !== i ? le : V2 ? s.mean(L2, V2) : (I2.q1 + I2.q3) / 2;
                var ce = j("sd");
                I2.sd = le !== i && ce >= 0 ? ce : V2 ? s.stdev(L2, V2, I2.mean) : I2.q3 - I2.q1, I2.lo = v(I2), I2.uo = m(I2);
                var se = j("notchspan");
                se = se !== i && se > 0 ? se : g(I2, V2), I2.ln = I2.med - se, I2.un = I2.med + se;
                var he = I2.lf, me = I2.uf;
                b.boxpoints && L2.length && (he = Math.min(he, L2[0]), me = Math.max(me, L2[V2 - 1])), b.notched && (he = Math.min(he, I2.ln), me = Math.max(me, I2.un)), I2.min = he, I2.max = me;
              } else {
                var we;
                s.warn(["Invalid input - make sure that q1 <= median <= q3", "q1 = " + I2.q1, "median = " + I2.med, "q3 = " + I2.q3].join(`
`)), we = I2.med !== i ? I2.med : I2.q1 !== i ? I2.q3 !== i ? (I2.q1 + I2.q3) / 2 : I2.q1 : I2.q3 !== i ? I2.q3 : 0, I2.med = we, I2.q1 = I2.q3 = we, I2.lf = I2.uf = we, I2.mean = I2.sd = we, I2.ln = I2.un = we, I2.min = I2.max = we;
              }
              Q2 = Math.min(Q2, I2.min), Z2 = Math.max(Z2, I2.max), I2.pts2 = O2.filter(H2), N2.push(I2);
            }
          }
          b._extremes[_4._id] = a.findExtremes(_4, [Q2, Z2], { padded: true });
        } else {
          var be = _4.makeCalcdata(b, k), Ae = function(it, ot) {
            for (var mt = it.length, wt = new Array(mt + 1), Et = 0; Et < mt; Et++) wt[Et] = it[Et] - ot;
            return wt[mt] = it[mt - 1] + ot, wt;
          }(R2, z), pe = R2.length, ve = function(it) {
            for (var ot = new Array(it), mt = 0; mt < it; mt++) ot[mt] = [];
            return ot;
          }(pe);
          for (y = 0; y < b._length; y++) if (X2 = be[y], n(X2)) {
            var Ee = s.findBin(K2[y], Ae);
            Ee >= 0 && Ee < pe && (c(W2 = { v: X2, i: y }, b, y), ve[Ee].push(W2));
          }
          var Se = 1 / 0, Ce = -1 / 0, Be = b.quartilemethod, Ue = Be === "exclusive", Ke = Be === "inclusive";
          for (y = 0; y < pe; y++) if (ve[y].length > 0) {
            var ct, We;
            (I2 = {}).pos = I2[A2] = R2[y], O2 = I2.pts = ve[y].sort(f), V2 = (L2 = I2[k] = O2.map(h)).length, I2.min = L2[0], I2.max = L2[V2 - 1], I2.mean = s.mean(L2, V2), I2.sd = s.stdev(L2, V2, I2.mean), I2.med = s.interp(L2, 0.5), V2 % 2 && (Ue || Ke) ? (Ue ? (ct = L2.slice(0, V2 / 2), We = L2.slice(V2 / 2 + 1)) : Ke && (ct = L2.slice(0, V2 / 2 + 1), We = L2.slice(V2 / 2)), I2.q1 = s.interp(ct, 0.5), I2.q3 = s.interp(We, 0.5)) : (I2.q1 = s.interp(L2, 0.25), I2.q3 = s.interp(L2, 0.75)), I2.lf = p(I2, L2, V2), I2.uf = d(I2, L2, V2), I2.lo = v(I2), I2.uo = m(I2);
            var Ze = g(I2, V2);
            I2.ln = I2.med - Ze, I2.un = I2.med + Ze, Se = Math.min(Se, I2.ln), Ce = Math.max(Ce, I2.un), I2.pts2 = O2.filter(H2), N2.push(I2);
          }
          b._extremes[_4._id] = a.findExtremes(_4, b.notched ? be.concat([Se, Ce]) : be, { padded: true });
        }
        return function(it, ot) {
          if (s.isArrayOrTypedArray(ot.selectedpoints)) for (var mt = 0; mt < it.length; mt++) {
            for (var wt = it[mt].pts || [], Et = {}, zt = 0; zt < wt.length; zt++) Et[wt[zt].i] = zt;
            s.tagSelected(wt, ot, Et);
          }
        }(N2, b), N2.length > 0 ? (N2[0].t = { num: C2[D2], dPos: z, posLetter: A2, valLetter: k, labels: { med: l(x, "median:"), min: l(x, "min:"), q1: l(x, "q1:"), q3: l(x, "q3:"), max: l(x, "max:"), mean: b.boxmean === "sd" ? l(x, "mean \xB1 \u03C3:") : l(x, "mean:"), lf: l(x, "lower fence:"), uf: l(x, "upper fence:") } }, C2[D2]++, N2) : [{ t: { empty: true } }];
      };
      var u2 = { text: "tx", hovertext: "htx" };
      function c(x, b, y) {
        for (var w in u2) s.isArrayOrTypedArray(b[w]) && (Array.isArray(y) ? s.isArrayOrTypedArray(b[w][y[0]]) && (x[u2[w]] = b[w][y[0]][y[1]]) : x[u2[w]] = b[w][y]);
      }
      function f(x, b) {
        return x.v - b.v;
      }
      function h(x) {
        return x.v;
      }
      function p(x, b, y) {
        return y === 0 ? x.q1 : Math.min(x.q1, b[Math.min(s.findBin(2.5 * x.q1 - 1.5 * x.q3, b, true) + 1, y - 1)]);
      }
      function d(x, b, y) {
        return y === 0 ? x.q3 : Math.max(x.q3, b[Math.max(s.findBin(2.5 * x.q3 - 1.5 * x.q1, b), 0)]);
      }
      function v(x) {
        return 4 * x.q1 - 3 * x.q3;
      }
      function m(x) {
        return 4 * x.q3 - 3 * x.q1;
      }
      function g(x, b) {
        return b === 0 ? 0 : 1.57 * (x.q3 - x.q1) / Math.sqrt(b);
      }
    }, { "../../constants/numerical": 479, "../../lib": 503, "../../plots/cartesian/align_period": 551, "../../plots/cartesian/axes": 554, "fast-isnumeric": 190 }], 675: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/cartesian/axes"), a = e("../../lib"), o = e("../../plots/cartesian/constraints").getAxisGroup, s = ["v", "h"];
      function i(l, u2, c, f) {
        var h, p, d, v = u2.calcdata, m = u2._fullLayout, g = f._id, x = g.charAt(0), b = [], y = 0;
        for (h = 0; h < c.length; h++) for (d = v[c[h]], p = 0; p < d.length; p++) b.push(f.c2l(d[p].pos, true)), y += (d[p].pts2 || []).length;
        if (b.length) {
          var w = a.distinctVals(b);
          f.type !== "category" && f.type !== "multicategory" || (w.minDiff = 1);
          var _4 = w.minDiff / 2;
          n.minDtick(f, w.minDiff, w.vals[0], true);
          var k = m[l === "violin" ? "_numViolins" : "_numBoxes"], T2 = m[l + "mode"] === "group" && k > 1, A2 = 1 - m[l + "gap"], S2 = 1 - m[l + "groupgap"];
          for (h = 0; h < c.length; h++) {
            var C2, E2, F13, N2, D2, I2, O2 = (d = v[c[h]])[0].trace, L2 = d[0].t, V2 = O2.width, W2 = O2.side;
            if (V2) C2 = E2 = N2 = V2 / 2, F13 = 0;
            else if (C2 = _4, T2) {
              var X2 = o(m, f._id) + O2.orientation, Y2 = (m._alignmentOpts[X2] || {})[O2.alignmentgroup] || {}, K2 = Object.keys(Y2.offsetGroups || {}).length, q = K2 || k;
              E2 = C2 * A2 * S2 / q, F13 = 2 * C2 * (((K2 ? O2._offsetIndex : L2.num) + 0.5) / q - 0.5) * A2, N2 = C2 * A2 / q;
            } else E2 = C2 * A2 * S2, F13 = 0, N2 = C2;
            L2.dPos = C2, L2.bPos = F13, L2.bdPos = E2, L2.wHover = N2;
            var re, R2, z, H2, te, j, Q2 = F13 + E2, Z2 = Boolean(V2);
            if (W2 === "positive" ? (D2 = C2 * (V2 ? 1 : 0.5), re = Q2, I2 = re = F13) : W2 === "negative" ? (D2 = re = F13, I2 = C2 * (V2 ? 1 : 0.5), R2 = Q2) : (D2 = I2 = C2, re = R2 = Q2), (O2.boxpoints || O2.points) && y > 0) {
              var ne = O2.pointpos, ae = O2.jitter, ue = O2.marker.size / 2, le = 0;
              ne + ae >= 0 && ((le = Q2 * (ne + ae)) > D2 ? (Z2 = true, te = ue, z = le) : le > re && (te = ue, z = D2)), le <= D2 && (z = D2);
              var ce = 0;
              ne - ae <= 0 && ((ce = -Q2 * (ne - ae)) > I2 ? (Z2 = true, j = ue, H2 = ce) : ce > R2 && (j = ue, H2 = I2)), ce <= I2 && (H2 = I2);
            } else z = D2, H2 = I2;
            var se = new Array(d.length);
            for (p = 0; p < d.length; p++) se[p] = d[p].pos;
            O2._extremes[g] = n.findExtremes(f, se, { padded: Z2, vpadminus: H2, vpadplus: z, vpadLinearized: true, ppadminus: { x: j, y: te }[x], ppadplus: { x: te, y: j }[x] });
          }
        }
      }
      t.exports = { crossTraceCalc: function(l, u2) {
        for (var c = l.calcdata, f = u2.xaxis, h = u2.yaxis, p = 0; p < s.length; p++) {
          for (var d = s[p], v = d === "h" ? h : f, m = [], g = 0; g < c.length; g++) {
            var x = c[g], b = x[0].t, y = x[0].trace;
            y.visible !== true || y.type !== "box" && y.type !== "candlestick" || b.empty || (y.orientation || "v") !== d || y.xaxis !== f._id || y.yaxis !== h._id || m.push(g);
          }
          i("box", l, m, v);
        }
      }, setPositionOffset: i };
    }, { "../../lib": 503, "../../plots/cartesian/axes": 554, "../../plots/cartesian/constraints": 562 }], 676: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../registry"), o = e("../../components/color"), s = e("../scatter/period_defaults"), i = e("../bar/defaults").handleGroupingDefaults, l = e("../../plots/cartesian/axis_autotype"), u2 = e("./attributes");
      function c(h, p, d, v) {
        function m(W2) {
          var X2 = 0;
          return W2 && W2.length && (X2 += 1, n.isArrayOrTypedArray(W2[0]) && W2[0].length && (X2 += 1)), X2;
        }
        function g(W2) {
          return n.validate(h[W2], u2[W2]);
        }
        var x, b = d("y"), y = d("x");
        if (p.type === "box") {
          var w = d("q1"), _4 = d("median"), k = d("q3");
          p._hasPreCompStats = w && w.length && _4 && _4.length && k && k.length, x = Math.min(n.minRowLength(w), n.minRowLength(_4), n.minRowLength(k));
        }
        var T2, A2, S2 = m(b), C2 = m(y), E2 = S2 && n.minRowLength(b), F13 = C2 && n.minRowLength(y), N2 = v.calendar, D2 = { autotypenumbers: v.autotypenumbers };
        if (p._hasPreCompStats) switch (String(C2) + String(S2)) {
          case "00":
            var I2 = g("x0") || g("dx");
            T2 = (g("y0") || g("dy")) && !I2 ? "h" : "v", A2 = x;
            break;
          case "10":
            T2 = "v", A2 = Math.min(x, F13);
            break;
          case "20":
            T2 = "h", A2 = Math.min(x, y.length);
            break;
          case "01":
            T2 = "h", A2 = Math.min(x, E2);
            break;
          case "02":
            T2 = "v", A2 = Math.min(x, b.length);
            break;
          case "12":
            T2 = "v", A2 = Math.min(x, F13, b.length);
            break;
          case "21":
            T2 = "h", A2 = Math.min(x, y.length, E2);
            break;
          case "11":
            A2 = 0;
            break;
          case "22":
            var O2, L2 = false;
            for (O2 = 0; O2 < y.length; O2++) if (l(y[O2], N2, D2) === "category") {
              L2 = true;
              break;
            }
            if (L2) T2 = "v", A2 = Math.min(x, F13, b.length);
            else {
              for (O2 = 0; O2 < b.length; O2++) if (l(b[O2], N2, D2) === "category") {
                L2 = true;
                break;
              }
              L2 ? (T2 = "h", A2 = Math.min(x, y.length, E2)) : (T2 = "v", A2 = Math.min(x, F13, b.length));
            }
        }
        else S2 > 0 ? (T2 = "v", A2 = C2 > 0 ? Math.min(F13, E2) : Math.min(E2)) : C2 > 0 ? (T2 = "h", A2 = Math.min(F13)) : A2 = 0;
        if (A2) {
          p._length = A2;
          var V2 = d("orientation", T2);
          p._hasPreCompStats ? V2 === "v" && C2 === 0 ? (d("x0", 0), d("dx", 1)) : V2 === "h" && S2 === 0 && (d("y0", 0), d("dy", 1)) : V2 === "v" && C2 === 0 ? d("x0") : V2 === "h" && S2 === 0 && d("y0"), a.getComponentMethod("calendars", "handleTraceDefaults")(h, p, ["x", "y"], v);
        } else p.visible = false;
      }
      function f(h, p, d, v) {
        var m = v.prefix, g = n.coerce2(h, p, u2, "marker.outliercolor"), x = d("marker.line.outliercolor"), b = "outliers";
        p._hasPreCompStats ? b = "all" : (g || x) && (b = "suspectedoutliers");
        var y = d(m + "points", b);
        y ? (d("jitter", y === "all" ? 0.3 : 0), d("pointpos", y === "all" ? -1.5 : 0), d("marker.symbol"), d("marker.opacity"), d("marker.size"), d("marker.color", p.line.color), d("marker.line.color"), d("marker.line.width"), y === "suspectedoutliers" && (d("marker.line.outliercolor", p.marker.color), d("marker.line.outlierwidth")), d("selected.marker.color"), d("unselected.marker.color"), d("selected.marker.size"), d("unselected.marker.size"), d("text"), d("hovertext")) : delete p.marker;
        var w = d("hoveron");
        w !== "all" && w.indexOf("points") === -1 || d("hovertemplate"), n.coerceSelectionMarkerOpacity(p, d);
      }
      t.exports = { supplyDefaults: function(h, p, d, v) {
        function m(k, T2) {
          return n.coerce(h, p, u2, k, T2);
        }
        if (c(h, p, m, v), p.visible !== false) {
          s(h, p, v, m), m("xhoverformat"), m("yhoverformat");
          var g = p._hasPreCompStats;
          g && (m("lowerfence"), m("upperfence")), m("line.color", (h.marker || {}).color || d), m("line.width"), m("fillcolor", o.addOpacity(p.line.color, 0.5));
          var x = false;
          if (g) {
            var b = m("mean"), y = m("sd");
            b && b.length && (x = true, y && y.length && (x = "sd"));
          }
          m("boxmean", x), m("whiskerwidth"), m("width"), m("quartilemethod");
          var w = false;
          if (g) {
            var _4 = m("notchspan");
            _4 && _4.length && (w = true);
          } else n.validate(h.notchwidth, u2.notchwidth) && (w = true);
          m("notched", w) && m("notchwidth"), f(h, p, m, { prefix: "box" });
        }
      }, crossTraceDefaults: function(h, p) {
        var d, v;
        function m(b) {
          return n.coerce(v._input, v, u2, b);
        }
        for (var g = 0; g < h.length; g++) {
          var x = (v = h[g]).type;
          x !== "box" && x !== "violin" || (d = v._input, p[x + "mode"] === "group" && i(d, v, p, m));
        }
      }, handleSampleDefaults: c, handlePointsDefaults: f };
    }, { "../../components/color": 366, "../../lib": 503, "../../plots/cartesian/axis_autotype": 555, "../../registry": 638, "../bar/defaults": 652, "../scatter/period_defaults": 946, "./attributes": 673 }], 677: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a) {
        return a.hoverOnBox && (n.hoverOnBox = a.hoverOnBox), "xVal" in a && (n.x = a.xVal), "yVal" in a && (n.y = a.yVal), a.xa && (n.xaxis = a.xa), a.ya && (n.yaxis = a.ya), n;
      };
    }, {}], 678: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/cartesian/axes"), a = e("../../lib"), o = e("../../components/fx"), s = e("../../components/color"), i = a.fillText;
      function l(c, f, h, p) {
        var d, v, m, g, x, b, y, w, _4, k, T2, A2, S2, C2, E2 = c.cd, F13 = c.xa, N2 = c.ya, D2 = E2[0].trace, I2 = E2[0].t, O2 = D2.type === "violin", L2 = [], V2 = I2.bdPos, W2 = I2.wHover, X2 = function(le) {
          return m.c2l(le.pos) + I2.bPos - m.c2l(b);
        };
        O2 && D2.side !== "both" ? (D2.side === "positive" && (_4 = function(le) {
          var ce = X2(le);
          return o.inbox(ce, ce + W2, k);
        }, A2 = V2, S2 = 0), D2.side === "negative" && (_4 = function(le) {
          var ce = X2(le);
          return o.inbox(ce - W2, ce, k);
        }, A2 = 0, S2 = V2)) : (_4 = function(le) {
          var ce = X2(le);
          return o.inbox(ce - W2, ce + W2, k);
        }, A2 = S2 = V2), C2 = O2 ? function(le) {
          return o.inbox(le.span[0] - x, le.span[1] - x, k);
        } : function(le) {
          return o.inbox(le.min - x, le.max - x, k);
        }, D2.orientation === "h" ? (x = f, b = h, y = C2, w = _4, d = "y", m = N2, v = "x", g = F13) : (x = h, b = f, y = _4, w = C2, d = "x", m = F13, v = "y", g = N2);
        var Y2 = Math.min(1, V2 / Math.abs(m.r2c(m.range[1]) - m.r2c(m.range[0])));
        function K2(le) {
          return (y(le) + w(le)) / 2;
        }
        k = c.maxHoverDistance - Y2, T2 = c.maxSpikeDistance - Y2;
        var q = o.getDistanceFunction(p, y, w, K2);
        if (o.getClosest(E2, q, c), c.index === false) return [];
        var re = E2[c.index], R2 = D2.line.color, z = (D2.marker || {}).color;
        s.opacity(R2) && D2.line.width ? c.color = R2 : s.opacity(z) && D2.boxpoints ? c.color = z : c.color = D2.fillcolor, c[d + "0"] = m.c2p(re.pos + I2.bPos - S2, true), c[d + "1"] = m.c2p(re.pos + I2.bPos + A2, true), c[d + "LabelVal"] = re.orig_p !== void 0 ? re.orig_p : re.pos;
        var H2 = d + "Spike";
        c.spikeDistance = K2(re) * T2 / k, c[H2] = m.c2p(re.pos, true);
        var te = {}, j = ["med", "q1", "q3", "min", "max"];
        (D2.boxmean || (D2.meanline || {}).visible) && j.push("mean"), (D2.boxpoints || D2.points) && j.push("lf", "uf");
        for (var Q2 = 0; Q2 < j.length; Q2++) {
          var Z2 = j[Q2];
          if (Z2 in re && !(re[Z2] in te)) {
            te[re[Z2]] = true;
            var ne = re[Z2], ae = g.c2p(ne, true), ue = a.extendFlat({}, c);
            ue.attr = Z2, ue[v + "0"] = ue[v + "1"] = ae, ue[v + "LabelVal"] = ne, ue[v + "Label"] = (I2.labels ? I2.labels[Z2] + " " : "") + n.hoverLabelText(g, ne, D2[v + "hoverformat"]), ue.hoverOnBox = true, Z2 === "mean" && "sd" in re && D2.boxmean === "sd" && (ue[v + "err"] = re.sd), c.name = "", c.spikeDistance = void 0, c[H2] = void 0, ue.hovertemplate = false, L2.push(ue);
          }
        }
        return L2;
      }
      function u2(c, f, h) {
        for (var p, d, v, m = c.cd, g = c.xa, x = c.ya, b = m[0].trace, y = g.c2p(f), w = x.c2p(h), _4 = o.quadrature(function(O2) {
          var L2 = Math.max(3, O2.mrc || 0);
          return Math.max(Math.abs(g.c2p(O2.x) - y) - L2, 1 - 3 / L2);
        }, function(O2) {
          var L2 = Math.max(3, O2.mrc || 0);
          return Math.max(Math.abs(x.c2p(O2.y) - w) - L2, 1 - 3 / L2);
        }), k = false, T2 = 0; T2 < m.length; T2++) {
          d = m[T2];
          for (var A2 = 0; A2 < (d.pts || []).length; A2++) {
            var S2 = _4(v = d.pts[A2]);
            S2 <= c.distance && (c.distance = S2, k = [T2, A2]);
          }
        }
        if (!k) return false;
        v = (d = m[k[0]]).pts[k[1]];
        var C2 = g.c2p(v.x, true), E2 = x.c2p(v.y, true), F13 = v.mrc || 1;
        p = a.extendFlat({}, c, { index: v.i, color: (b.marker || {}).color, name: b.name, x0: C2 - F13, x1: C2 + F13, y0: E2 - F13, y1: E2 + F13, spikeDistance: c.distance, hovertemplate: b.hovertemplate });
        var N2, D2 = d.orig_p, I2 = D2 !== void 0 ? D2 : d.pos;
        return b.orientation === "h" ? (N2 = x, p.xLabelVal = v.x, p.yLabelVal = I2) : (N2 = g, p.xLabelVal = I2, p.yLabelVal = v.y), p[N2._id.charAt(0) + "Spike"] = N2.c2p(d.pos, true), i(v, b, p), p;
      }
      t.exports = { hoverPoints: function(c, f, h, p) {
        var d, v = c.cd[0].trace.hoveron, m = [];
        return v.indexOf("boxes") !== -1 && (m = m.concat(l(c, f, h, p))), v.indexOf("points") !== -1 && (d = u2(c, f, h)), p === "closest" ? d ? [d] : m : (d && m.push(d), m);
      }, hoverOnBoxes: l, hoverOnPoints: u2 };
    }, { "../../components/color": 366, "../../components/fx": 406, "../../lib": 503, "../../plots/cartesian/axes": 554 }], 679: [function(e, t, r) {
      "use strict";
      t.exports = { attributes: e("./attributes"), layoutAttributes: e("./layout_attributes"), supplyDefaults: e("./defaults").supplyDefaults, crossTraceDefaults: e("./defaults").crossTraceDefaults, supplyLayoutDefaults: e("./layout_defaults").supplyLayoutDefaults, calc: e("./calc"), crossTraceCalc: e("./cross_trace_calc").crossTraceCalc, plot: e("./plot").plot, style: e("./style").style, styleOnSelect: e("./style").styleOnSelect, hoverPoints: e("./hover").hoverPoints, eventData: e("./event_data"), selectPoints: e("./select"), moduleType: "trace", name: "box", basePlotModule: e("../../plots/cartesian"), categories: ["cartesian", "svg", "symbols", "oriented", "box-violin", "showLegend", "boxLayout", "zoomScale"], meta: {} };
    }, { "../../plots/cartesian": 568, "./attributes": 673, "./calc": 674, "./cross_trace_calc": 675, "./defaults": 676, "./event_data": 677, "./hover": 678, "./layout_attributes": 680, "./layout_defaults": 681, "./plot": 682, "./select": 683, "./style": 684 }], 680: [function(e, t, r) {
      "use strict";
      t.exports = { boxmode: { valType: "enumerated", values: ["group", "overlay"], dflt: "overlay", editType: "calc" }, boxgap: { valType: "number", min: 0, max: 1, dflt: 0.3, editType: "calc" }, boxgroupgap: { valType: "number", min: 0, max: 1, dflt: 0.3, editType: "calc" } };
    }, {}], 681: [function(e, t, r) {
      "use strict";
      var n = e("../../registry"), a = e("../../lib"), o = e("./layout_attributes");
      function s(i, l, u2, c, f) {
        for (var h = f + "Layout", p = false, d = 0; d < u2.length; d++) {
          var v = u2[d];
          if (n.traceIs(v, h)) {
            p = true;
            break;
          }
        }
        p && (c(f + "mode"), c(f + "gap"), c(f + "groupgap"));
      }
      t.exports = { supplyLayoutDefaults: function(i, l, u2) {
        s(0, 0, u2, function(c, f) {
          return a.coerce(i, l, o, c, f);
        }, "box");
      }, _supply: s };
    }, { "../../lib": 503, "../../registry": 638, "./layout_attributes": 680 }], 682: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../lib"), o = e("../../components/drawing");
      function s(u2, c, f, h) {
        var p, d, v = f.orientation === "h", m = c.val, g = c.pos, x = !!g.rangebreaks, b = h.bPos, y = h.wdPos || 0, w = h.bPosPxOffset || 0, _4 = f.whiskerwidth || 0, k = f.notched || false, T2 = k ? 1 - 2 * f.notchwidth : 1;
        Array.isArray(h.bdPos) ? (p = h.bdPos[0], d = h.bdPos[1]) : (p = h.bdPos, d = h.bdPos);
        var A2 = u2.selectAll("path.box").data(f.type !== "violin" || f.box.visible ? a.identity : []);
        A2.enter().append("path").style("vector-effect", "non-scaling-stroke").attr("class", "box"), A2.exit().remove(), A2.each(function(S2) {
          if (S2.empty) return "M0,0Z";
          var C2 = g.c2l(S2.pos + b, true), E2 = g.l2p(C2 - p) + w, F13 = g.l2p(C2 + d) + w, N2 = x ? (E2 + F13) / 2 : g.l2p(C2) + w, D2 = f.whiskerwidth, I2 = x ? E2 * D2 + (1 - D2) * N2 : g.l2p(C2 - y) + w, O2 = x ? F13 * D2 + (1 - D2) * N2 : g.l2p(C2 + y) + w, L2 = g.l2p(C2 - p * T2) + w, V2 = g.l2p(C2 + d * T2) + w, W2 = m.c2p(S2.q1, true), X2 = m.c2p(S2.q3, true), Y2 = a.constrain(m.c2p(S2.med, true), Math.min(W2, X2) + 1, Math.max(W2, X2) - 1), K2 = S2.lf === void 0 || f.boxpoints === false, q = m.c2p(K2 ? S2.min : S2.lf, true), re = m.c2p(K2 ? S2.max : S2.uf, true), R2 = m.c2p(S2.ln, true), z = m.c2p(S2.un, true);
          v ? n.select(this).attr("d", "M" + Y2 + "," + L2 + "V" + V2 + "M" + W2 + "," + E2 + "V" + F13 + (k ? "H" + R2 + "L" + Y2 + "," + V2 + "L" + z + "," + F13 : "") + "H" + X2 + "V" + E2 + (k ? "H" + z + "L" + Y2 + "," + L2 + "L" + R2 + "," + E2 : "") + "ZM" + W2 + "," + N2 + "H" + q + "M" + X2 + "," + N2 + "H" + re + (_4 === 0 ? "" : "M" + q + "," + I2 + "V" + O2 + "M" + re + "," + I2 + "V" + O2)) : n.select(this).attr("d", "M" + L2 + "," + Y2 + "H" + V2 + "M" + E2 + "," + W2 + "H" + F13 + (k ? "V" + R2 + "L" + V2 + "," + Y2 + "L" + F13 + "," + z : "") + "V" + X2 + "H" + E2 + (k ? "V" + z + "L" + L2 + "," + Y2 + "L" + E2 + "," + R2 : "") + "ZM" + N2 + "," + W2 + "V" + q + "M" + N2 + "," + X2 + "V" + re + (_4 === 0 ? "" : "M" + I2 + "," + q + "H" + O2 + "M" + I2 + "," + re + "H" + O2));
        });
      }
      function i(u2, c, f, h) {
        var p = c.x, d = c.y, v = h.bdPos, m = h.bPos, g = f.boxpoints || f.points;
        a.seedPseudoRandom();
        var x = u2.selectAll("g.points").data(g ? function(y) {
          return y.forEach(function(w) {
            w.t = h, w.trace = f;
          }), y;
        } : []);
        x.enter().append("g").attr("class", "points"), x.exit().remove();
        var b = x.selectAll("path").data(function(y) {
          var w, _4, k = y.pts2, T2 = Math.max((y.max - y.min) / 10, y.q3 - y.q1), A2 = 1e-9 * T2, S2 = 0.01 * T2, C2 = [], E2 = 0;
          if (f.jitter) {
            if (T2 === 0) for (E2 = 1, C2 = new Array(k.length), w = 0; w < k.length; w++) C2[w] = 1;
            else for (w = 0; w < k.length; w++) {
              var F13 = Math.max(0, w - 5), N2 = k[F13].v, D2 = Math.min(k.length - 1, w + 5), I2 = k[D2].v;
              g !== "all" && (k[w].v < y.lf ? I2 = Math.min(I2, y.lf) : N2 = Math.max(N2, y.uf));
              var O2 = Math.sqrt(S2 * (D2 - F13) / (I2 - N2 + A2)) || 0;
              O2 = a.constrain(Math.abs(O2), 0, 1), C2.push(O2), E2 = Math.max(O2, E2);
            }
            _4 = 2 * f.jitter / (E2 || 1);
          }
          for (w = 0; w < k.length; w++) {
            var L2 = k[w], V2 = L2.v, W2 = f.jitter ? _4 * C2[w] * (a.pseudoRandom() - 0.5) : 0, X2 = y.pos + m + v * (f.pointpos + W2);
            f.orientation === "h" ? (L2.y = X2, L2.x = V2) : (L2.x = X2, L2.y = V2), g === "suspectedoutliers" && V2 < y.uo && V2 > y.lo && (L2.so = true);
          }
          return k;
        });
        b.enter().append("path").classed("point", true), b.exit().remove(), b.call(o.translatePoints, p, d);
      }
      function l(u2, c, f, h) {
        var p, d, v = c.val, m = c.pos, g = !!m.rangebreaks, x = h.bPos, b = h.bPosPxOffset || 0, y = f.boxmean || (f.meanline || {}).visible;
        Array.isArray(h.bdPos) ? (p = h.bdPos[0], d = h.bdPos[1]) : (p = h.bdPos, d = h.bdPos);
        var w = u2.selectAll("path.mean").data(f.type === "box" && f.boxmean || f.type === "violin" && f.box.visible && f.meanline.visible ? a.identity : []);
        w.enter().append("path").attr("class", "mean").style({ fill: "none", "vector-effect": "non-scaling-stroke" }), w.exit().remove(), w.each(function(_4) {
          var k = m.c2l(_4.pos + x, true), T2 = m.l2p(k - p) + b, A2 = m.l2p(k + d) + b, S2 = g ? (T2 + A2) / 2 : m.l2p(k) + b, C2 = v.c2p(_4.mean, true), E2 = v.c2p(_4.mean - _4.sd, true), F13 = v.c2p(_4.mean + _4.sd, true);
          f.orientation === "h" ? n.select(this).attr("d", "M" + C2 + "," + T2 + "V" + A2 + (y === "sd" ? "m0,0L" + E2 + "," + S2 + "L" + C2 + "," + T2 + "L" + F13 + "," + S2 + "Z" : "")) : n.select(this).attr("d", "M" + T2 + "," + C2 + "H" + A2 + (y === "sd" ? "m0,0L" + S2 + "," + E2 + "L" + T2 + "," + C2 + "L" + S2 + "," + F13 + "Z" : ""));
        });
      }
      t.exports = { plot: function(u2, c, f, h) {
        var p = c.xaxis, d = c.yaxis;
        a.makeTraceGroups(h, f, "trace boxes").each(function(v) {
          var m, g, x = n.select(this), b = v[0], y = b.t, w = b.trace;
          y.wdPos = y.bdPos * w.whiskerwidth, w.visible !== true || y.empty ? x.remove() : (w.orientation === "h" ? (m = d, g = p) : (m = p, g = d), s(x, { pos: m, val: g }, w, y), i(x, { x: p, y: d }, w, y), l(x, { pos: m, val: g }, w, y));
        });
      }, plotBoxAndWhiskers: s, plotPoints: i, plotBoxMean: l };
    }, { "../../components/drawing": 388, "../../lib": 503, "@plotly/d3": 58 }], 683: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a) {
        var o, s, i = n.cd, l = n.xaxis, u2 = n.yaxis, c = [];
        if (a === false) for (o = 0; o < i.length; o++) for (s = 0; s < (i[o].pts || []).length; s++) i[o].pts[s].selected = 0;
        else for (o = 0; o < i.length; o++) for (s = 0; s < (i[o].pts || []).length; s++) {
          var f = i[o].pts[s], h = l.c2p(f.x), p = u2.c2p(f.y);
          a.contains([h, p], null, f.i, n) ? (c.push({ pointNumber: f.i, x: l.c2d(f.x), y: u2.c2d(f.y) }), f.selected = 1) : f.selected = 0;
        }
        return c;
      };
    }, {}], 684: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../components/color"), o = e("../../components/drawing");
      t.exports = { style: function(s, i, l) {
        var u2 = l || n.select(s).selectAll("g.trace.boxes");
        u2.style("opacity", function(c) {
          return c[0].trace.opacity;
        }), u2.each(function(c) {
          var f = n.select(this), h = c[0].trace, p = h.line.width;
          function d(g, x, b, y) {
            g.style("stroke-width", x + "px").call(a.stroke, b).call(a.fill, y);
          }
          var v = f.selectAll("path.box");
          if (h.type === "candlestick") v.each(function(g) {
            if (!g.empty) {
              var x = n.select(this), b = h[g.dir];
              d(x, b.line.width, b.line.color, b.fillcolor), x.style("opacity", h.selectedpoints && !g.selected ? 0.3 : 1);
            }
          });
          else {
            d(v, p, h.line.color, h.fillcolor), f.selectAll("path.mean").style({ "stroke-width": p, "stroke-dasharray": 2 * p + "px," + p + "px" }).call(a.stroke, h.line.color);
            var m = f.selectAll("path.point");
            o.pointStyle(m, h, s);
          }
        });
      }, styleOnSelect: function(s, i, l) {
        var u2 = i[0].trace, c = l.selectAll("path.point");
        u2.selectedpoints ? o.selectedPointStyle(c, u2) : o.pointStyle(c, u2, s);
      } };
    }, { "../../components/color": 366, "../../components/drawing": 388, "@plotly/d3": 58 }], 685: [function(e, t, r) {
      "use strict";
      var n = e("../../lib").extendFlat, a = e("../../plots/cartesian/axis_format_attributes").axisHoverFormat, o = e("../ohlc/attributes"), s = e("../box/attributes");
      function i(l) {
        return { line: { color: n({}, s.line.color, { dflt: l }), width: s.line.width, editType: "style" }, fillcolor: s.fillcolor, editType: "style" };
      }
      t.exports = { xperiod: o.xperiod, xperiod0: o.xperiod0, xperiodalignment: o.xperiodalignment, xhoverformat: a("x"), yhoverformat: a("y"), x: o.x, open: o.open, high: o.high, low: o.low, close: o.close, line: { width: n({}, s.line.width, {}), editType: "style" }, increasing: i(o.increasing.line.color.dflt), decreasing: i(o.decreasing.line.color.dflt), text: o.text, hovertext: o.hovertext, whiskerwidth: n({}, s.whiskerwidth, { dflt: 0 }), hoverlabel: o.hoverlabel };
    }, { "../../lib": 503, "../../plots/cartesian/axis_format_attributes": 557, "../box/attributes": 673, "../ohlc/attributes": 872 }], 686: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../plots/cartesian/axes"), o = e("../../plots/cartesian/align_period"), s = e("../ohlc/calc").calcCommon;
      function i(l, u2, c, f) {
        return { min: c, q1: Math.min(l, f), med: f, q3: Math.max(l, f), max: u2 };
      }
      t.exports = function(l, u2) {
        var c = l._fullLayout, f = a.getFromId(l, u2.xaxis), h = a.getFromId(l, u2.yaxis), p = f.makeCalcdata(u2, "x"), d = o(u2, f, "x", p).vals, v = s(l, u2, p, d, h, i);
        return v.length ? (n.extendFlat(v[0].t, { num: c._numBoxes, dPos: n.distinctVals(d).minDiff / 2, posLetter: "x", valLetter: "y" }), c._numBoxes++, v) : [{ t: { empty: true } }];
      };
    }, { "../../lib": 503, "../../plots/cartesian/align_period": 551, "../../plots/cartesian/axes": 554, "../ohlc/calc": 873 }], 687: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../components/color"), o = e("../ohlc/ohlc_defaults"), s = e("../scatter/period_defaults"), i = e("./attributes");
      function l(u2, c, f, h) {
        var p = f(h + ".line.color");
        f(h + ".line.width", c.line.width), f(h + ".fillcolor", a.addOpacity(p, 0.5));
      }
      t.exports = function(u2, c, f, h) {
        function p(d, v) {
          return n.coerce(u2, c, i, d, v);
        }
        o(u2, c, p, h) ? (s(u2, c, h, p, { x: true }), p("xhoverformat"), p("yhoverformat"), p("line.width"), l(u2, c, p, "increasing"), l(u2, c, p, "decreasing"), p("text"), p("hovertext"), p("whiskerwidth"), h._requestRangeslider[c.xaxis] = true) : c.visible = false;
      };
    }, { "../../components/color": 366, "../../lib": 503, "../ohlc/ohlc_defaults": 877, "../scatter/period_defaults": 946, "./attributes": 685 }], 688: [function(e, t, r) {
      "use strict";
      t.exports = { moduleType: "trace", name: "candlestick", basePlotModule: e("../../plots/cartesian"), categories: ["cartesian", "svg", "showLegend", "candlestick", "boxLayout"], meta: {}, attributes: e("./attributes"), layoutAttributes: e("../box/layout_attributes"), supplyLayoutDefaults: e("../box/layout_defaults").supplyLayoutDefaults, crossTraceCalc: e("../box/cross_trace_calc").crossTraceCalc, supplyDefaults: e("./defaults"), calc: e("./calc"), plot: e("../box/plot").plot, layerName: "boxlayer", style: e("../box/style").style, hoverPoints: e("../ohlc/hover").hoverPoints, selectPoints: e("../ohlc/select") };
    }, { "../../plots/cartesian": 568, "../box/cross_trace_calc": 675, "../box/layout_attributes": 680, "../box/layout_defaults": 681, "../box/plot": 682, "../box/style": 684, "../ohlc/hover": 875, "../ohlc/select": 879, "./attributes": 685, "./calc": 686, "./defaults": 687 }], 689: [function(e, t, r) {
      "use strict";
      var n = e("./axis_defaults"), a = e("../../plot_api/plot_template");
      t.exports = function(o, s, i, l, u2) {
        l("a") || (l("da"), l("a0")), l("b") || (l("db"), l("b0")), function(c, f, h, p) {
          ["aaxis", "baxis"].forEach(function(d) {
            var v = d.charAt(0), m = c[d] || {}, g = a.newContainer(f, d), x = { tickfont: "x", id: v + "axis", letter: v, font: f.font, name: d, data: c[v], calendar: f.calendar, dfltColor: p, bgColor: h.paper_bgcolor, autotypenumbersDflt: h.autotypenumbers, fullLayout: h };
            n(m, g, x), g._categories = g._categories || [], c[d] || m.type === "-" || (c[d] = { type: m.type });
          });
        }(o, s, i, u2);
      };
    }, { "../../plot_api/plot_template": 543, "./axis_defaults": 694 }], 690: [function(e, t, r) {
      "use strict";
      var n = e("../../lib").isArrayOrTypedArray;
      t.exports = function(a) {
        return function o(s, i) {
          if (!n(s) || i >= 10) return null;
          for (var l = 1 / 0, u2 = -1 / 0, c = s.length, f = 0; f < c; f++) {
            var h = s[f];
            if (n(h)) {
              var p = o(h, i + 1);
              p && (l = Math.min(p[0], l), u2 = Math.max(p[1], u2));
            } else l = Math.min(h, l), u2 = Math.max(h, u2);
          }
          return [l, u2];
        }(a, 0);
      };
    }, { "../../lib": 503 }], 691: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/font_attributes"), a = e("./axis_attributes"), o = e("../../components/color/attributes"), s = n({ editType: "calc" });
      s.family.dflt = '"Open Sans", verdana, arial, sans-serif', s.size.dflt = 12, s.color.dflt = o.defaultLine, t.exports = { carpet: { valType: "string", editType: "calc" }, x: { valType: "data_array", editType: "calc+clearAxisTypes" }, y: { valType: "data_array", editType: "calc+clearAxisTypes" }, a: { valType: "data_array", editType: "calc" }, a0: { valType: "number", dflt: 0, editType: "calc" }, da: { valType: "number", dflt: 1, editType: "calc" }, b: { valType: "data_array", editType: "calc" }, b0: { valType: "number", dflt: 0, editType: "calc" }, db: { valType: "number", dflt: 1, editType: "calc" }, cheaterslope: { valType: "number", dflt: 1, editType: "calc" }, aaxis: a, baxis: a, font: s, color: { valType: "color", dflt: o.defaultLine, editType: "plot" }, transforms: void 0 };
    }, { "../../components/color/attributes": 365, "../../plots/font_attributes": 585, "./axis_attributes": 693 }], 692: [function(e, t, r) {
      "use strict";
      var n = e("../../lib").isArrayOrTypedArray;
      t.exports = function(a, o, s, i) {
        var l, u2, c, f, h, p, d, v, m, g, x, b, y, w = n(s) ? "a" : "b", _4 = (w === "a" ? a.aaxis : a.baxis).smoothing, k = w === "a" ? a.a2i : a.b2j, T2 = w === "a" ? s : i, A2 = w === "a" ? i : s, S2 = w === "a" ? o.a.length : o.b.length, C2 = w === "a" ? o.b.length : o.a.length, E2 = Math.floor(w === "a" ? a.b2j(A2) : a.a2i(A2)), F13 = w === "a" ? function(re) {
          return a.evalxy([], re, E2);
        } : function(re) {
          return a.evalxy([], E2, re);
        };
        _4 && (c = Math.max(0, Math.min(C2 - 2, E2)), f = E2 - c, u2 = w === "a" ? function(re, R2) {
          return a.dxydi([], re, c, R2, f);
        } : function(re, R2) {
          return a.dxydj([], c, re, f, R2);
        });
        var N2 = k(T2[0]), D2 = k(T2[1]), I2 = N2 < D2 ? 1 : -1, O2 = 1e-8 * (D2 - N2), L2 = I2 > 0 ? Math.floor : Math.ceil, V2 = I2 > 0 ? Math.ceil : Math.floor, W2 = I2 > 0 ? Math.min : Math.max, X2 = I2 > 0 ? Math.max : Math.min, Y2 = L2(N2 + O2), K2 = V2(D2 - O2), q = [[d = F13(N2)]];
        for (l = Y2; l * I2 < K2 * I2; l += I2) h = [], x = X2(N2, l), y = (b = W2(D2, l + I2)) - x, p = Math.max(0, Math.min(S2 - 2, Math.floor(0.5 * (x + b)))), v = F13(b), _4 && (m = u2(p, x - p), g = u2(p, b - p), h.push([d[0] + m[0] / 3 * y, d[1] + m[1] / 3 * y]), h.push([v[0] - g[0] / 3 * y, v[1] - g[1] / 3 * y])), h.push(v), q.push(h), d = v;
        return q;
      };
    }, { "../../lib": 503 }], 693: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/font_attributes"), a = e("../../components/color/attributes"), o = e("../../plots/cartesian/layout_attributes"), s = e("../../plots/cartesian/axis_format_attributes").descriptionWithDates, i = e("../../plot_api/edit_types").overrideAll;
      t.exports = { color: { valType: "color", editType: "calc" }, smoothing: { valType: "number", dflt: 1, min: 0, max: 1.3, editType: "calc" }, title: { text: { valType: "string", dflt: "", editType: "calc" }, font: n({ editType: "calc" }), offset: { valType: "number", dflt: 10, editType: "calc" }, editType: "calc" }, type: { valType: "enumerated", values: ["-", "linear", "date", "category"], dflt: "-", editType: "calc" }, autotypenumbers: o.autotypenumbers, autorange: { valType: "enumerated", values: [true, false, "reversed"], dflt: true, editType: "calc" }, rangemode: { valType: "enumerated", values: ["normal", "tozero", "nonnegative"], dflt: "normal", editType: "calc" }, range: { valType: "info_array", editType: "calc", items: [{ valType: "any", editType: "calc" }, { valType: "any", editType: "calc" }] }, fixedrange: { valType: "boolean", dflt: false, editType: "calc" }, cheatertype: { valType: "enumerated", values: ["index", "value"], dflt: "value", editType: "calc" }, tickmode: { valType: "enumerated", values: ["linear", "array"], dflt: "array", editType: "calc" }, nticks: { valType: "integer", min: 0, dflt: 0, editType: "calc" }, tickvals: { valType: "data_array", editType: "calc" }, ticktext: { valType: "data_array", editType: "calc" }, showticklabels: { valType: "enumerated", values: ["start", "end", "both", "none"], dflt: "start", editType: "calc" }, tickfont: n({ editType: "calc" }), tickangle: { valType: "angle", dflt: "auto", editType: "calc" }, tickprefix: { valType: "string", dflt: "", editType: "calc" }, showtickprefix: { valType: "enumerated", values: ["all", "first", "last", "none"], dflt: "all", editType: "calc" }, ticksuffix: { valType: "string", dflt: "", editType: "calc" }, showticksuffix: { valType: "enumerated", values: ["all", "first", "last", "none"], dflt: "all", editType: "calc" }, showexponent: { valType: "enumerated", values: ["all", "first", "last", "none"], dflt: "all", editType: "calc" }, exponentformat: { valType: "enumerated", values: ["none", "e", "E", "power", "SI", "B"], dflt: "B", editType: "calc" }, minexponent: { valType: "number", dflt: 3, min: 0, editType: "calc" }, separatethousands: { valType: "boolean", dflt: false, editType: "calc" }, tickformat: { valType: "string", dflt: "", editType: "calc", description: s("tick label") }, tickformatstops: i(o.tickformatstops, "calc", "from-root"), categoryorder: { valType: "enumerated", values: ["trace", "category ascending", "category descending", "array"], dflt: "trace", editType: "calc" }, categoryarray: { valType: "data_array", editType: "calc" }, labelpadding: { valType: "integer", dflt: 10, editType: "calc" }, labelprefix: { valType: "string", editType: "calc" }, labelsuffix: { valType: "string", dflt: "", editType: "calc" }, showline: { valType: "boolean", dflt: false, editType: "calc" }, linecolor: { valType: "color", dflt: a.defaultLine, editType: "calc" }, linewidth: { valType: "number", min: 0, dflt: 1, editType: "calc" }, gridcolor: { valType: "color", editType: "calc" }, gridwidth: { valType: "number", min: 0, dflt: 1, editType: "calc" }, showgrid: { valType: "boolean", dflt: true, editType: "calc" }, minorgridcount: { valType: "integer", min: 0, dflt: 0, editType: "calc" }, minorgridwidth: { valType: "number", min: 0, dflt: 1, editType: "calc" }, minorgridcolor: { valType: "color", dflt: a.lightLine, editType: "calc" }, startline: { valType: "boolean", editType: "calc" }, startlinecolor: { valType: "color", editType: "calc" }, startlinewidth: { valType: "number", dflt: 1, editType: "calc" }, endline: { valType: "boolean", editType: "calc" }, endlinewidth: { valType: "number", dflt: 1, editType: "calc" }, endlinecolor: { valType: "color", editType: "calc" }, tick0: { valType: "number", min: 0, dflt: 0, editType: "calc" }, dtick: { valType: "number", min: 0, dflt: 1, editType: "calc" }, arraytick0: { valType: "integer", min: 0, dflt: 0, editType: "calc" }, arraydtick: { valType: "integer", min: 1, dflt: 1, editType: "calc" }, _deprecated: { title: { valType: "string", editType: "calc" }, titlefont: n({ editType: "calc" }), titleoffset: { valType: "number", dflt: 10, editType: "calc" } }, editType: "calc" };
    }, { "../../components/color/attributes": 365, "../../plot_api/edit_types": 536, "../../plots/cartesian/axis_format_attributes": 557, "../../plots/cartesian/layout_attributes": 569, "../../plots/font_attributes": 585 }], 694: [function(e, t, r) {
      "use strict";
      var n = e("./attributes"), a = e("../../components/color").addOpacity, o = e("../../registry"), s = e("../../lib"), i = e("../../plots/cartesian/tick_value_defaults"), l = e("../../plots/cartesian/tick_label_defaults"), u2 = e("../../plots/cartesian/prefix_suffix_defaults"), c = e("../../plots/cartesian/category_order_defaults"), f = e("../../plots/cartesian/set_convert"), h = e("../../plots/cartesian/axis_autotype");
      t.exports = function(p, d, v) {
        var m = v.letter, g = v.font || {}, x = n[m + "axis"];
        function b(D2, I2) {
          return s.coerce(p, d, x, D2, I2);
        }
        function y(D2, I2) {
          return s.coerce2(p, d, x, D2, I2);
        }
        v.name && (d._name = v.name, d._id = v.name), b("autotypenumbers", v.autotypenumbersDflt);
        var w = b("type");
        w === "-" && (v.data && function(D2, I2) {
          if (D2.type === "-") {
            var O2 = D2._id.charAt(0), L2 = D2[O2 + "calendar"];
            D2.type = h(I2, L2, { autotypenumbers: D2.autotypenumbers });
          }
        }(d, v.data), d.type === "-" ? d.type = "linear" : w = p.type = d.type), b("smoothing"), b("cheatertype"), b("showticklabels"), b("labelprefix", m + " = "), b("labelsuffix"), b("showtickprefix"), b("showticksuffix"), b("separatethousands"), b("tickformat"), b("exponentformat"), b("minexponent"), b("showexponent"), b("categoryorder"), b("tickmode"), b("tickvals"), b("ticktext"), b("tick0"), b("dtick"), d.tickmode === "array" && (b("arraytick0"), b("arraydtick")), b("labelpadding"), d._hovertitle = m, w === "date" && o.getComponentMethod("calendars", "handleDefaults")(p, d, "calendar", v.calendar), f(d, v.fullLayout), d.c2p = s.identity;
        var _4 = b("color", v.dfltColor), k = _4 === p.color ? _4 : g.color;
        b("title.text") && (s.coerceFont(b, "title.font", { family: g.family, size: s.bigFont(g.size), color: k }), b("title.offset")), b("tickangle"), b("autorange", !d.isValidRange(p.range)) && b("rangemode"), b("range"), d.cleanRange(), b("fixedrange"), i(p, d, b, w), u2(p, d, b, w, v), l(p, d, b, w, v), c(p, d, b, { data: v.data, dataAttr: m });
        var T2 = y("gridcolor", a(_4, 0.3)), A2 = y("gridwidth"), S2 = b("showgrid");
        S2 || (delete d.gridcolor, delete d.gridwidth);
        var C2 = y("startlinecolor", _4), E2 = y("startlinewidth", A2);
        b("startline", d.showgrid || !!C2 || !!E2) || (delete d.startlinecolor, delete d.startlinewidth);
        var F13 = y("endlinecolor", _4), N2 = y("endlinewidth", A2);
        return b("endline", d.showgrid || !!F13 || !!N2) || (delete d.endlinecolor, delete d.endlinewidth), S2 ? (b("minorgridcount"), b("minorgridwidth", A2), b("minorgridcolor", a(T2, 0.06)), d.minorgridcount || (delete d.minorgridwidth, delete d.minorgridcolor)) : (delete d.gridcolor, delete d.gridWidth), d.showticklabels === "none" && (delete d.tickfont, delete d.tickangle, delete d.showexponent, delete d.exponentformat, delete d.minexponent, delete d.tickformat, delete d.showticksuffix, delete d.showtickprefix), d.showticksuffix || delete d.ticksuffix, d.showtickprefix || delete d.tickprefix, b("tickmode"), d;
      };
    }, { "../../components/color": 366, "../../lib": 503, "../../plots/cartesian/axis_autotype": 555, "../../plots/cartesian/category_order_defaults": 559, "../../plots/cartesian/prefix_suffix_defaults": 573, "../../plots/cartesian/set_convert": 576, "../../plots/cartesian/tick_label_defaults": 578, "../../plots/cartesian/tick_value_defaults": 580, "../../registry": 638, "./attributes": 691 }], 695: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/cartesian/axes"), a = e("../../lib").isArray1D, o = e("./cheater_basis"), s = e("./array_minmax"), i = e("./calc_gridlines"), l = e("./calc_labels"), u2 = e("./calc_clippath"), c = e("../heatmap/clean_2d_array"), f = e("./smooth_fill_2d_array"), h = e("../heatmap/convert_column_xyz"), p = e("./set_convert");
      t.exports = function(d, v) {
        var m = n.getFromId(d, v.xaxis), g = n.getFromId(d, v.yaxis), x = v.aaxis, b = v.baxis, y = v.x, w = v.y, _4 = [];
        y && a(y) && _4.push("x"), w && a(w) && _4.push("y"), _4.length && h(v, x, b, "a", "b", _4);
        var k = v._a = v._a || v.a, T2 = v._b = v._b || v.b;
        y = v._x || v.x, w = v._y || v.y;
        var A2 = {};
        if (v._cheater) {
          var S2 = x.cheatertype === "index" ? k.length : k, C2 = b.cheatertype === "index" ? T2.length : T2;
          y = o(S2, C2, v.cheaterslope);
        }
        v._x = y = c(y), v._y = w = c(w), f(y, k, T2), f(w, k, T2), p(v), v.setScale();
        var E2 = s(y), F13 = s(w), N2 = 0.5 * (E2[1] - E2[0]), D2 = 0.5 * (E2[1] + E2[0]), I2 = 0.5 * (F13[1] - F13[0]), O2 = 0.5 * (F13[1] + F13[0]);
        return E2 = [D2 - 1.3 * N2, D2 + 1.3 * N2], F13 = [O2 - 1.3 * I2, O2 + 1.3 * I2], v._extremes[m._id] = n.findExtremes(m, E2, { padded: true }), v._extremes[g._id] = n.findExtremes(g, F13, { padded: true }), i(v, "a", "b"), i(v, "b", "a"), l(v, x), l(v, b), A2.clipsegments = u2(v._xctrl, v._yctrl, x, b), A2.x = y, A2.y = w, A2.a = k, A2.b = T2, [A2];
      };
    }, { "../../lib": 503, "../../plots/cartesian/axes": 554, "../heatmap/clean_2d_array": 794, "../heatmap/convert_column_xyz": 796, "./array_minmax": 690, "./calc_clippath": 696, "./calc_gridlines": 697, "./calc_labels": 698, "./cheater_basis": 700, "./set_convert": 713, "./smooth_fill_2d_array": 714 }], 696: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a, o, s) {
        var i, l, u2, c = [], f = !!o.smoothing, h = !!s.smoothing, p = n[0].length - 1, d = n.length - 1;
        for (i = 0, l = [], u2 = []; i <= p; i++) l[i] = n[0][i], u2[i] = a[0][i];
        for (c.push({ x: l, y: u2, bicubic: f }), i = 0, l = [], u2 = []; i <= d; i++) l[i] = n[i][p], u2[i] = a[i][p];
        for (c.push({ x: l, y: u2, bicubic: h }), i = p, l = [], u2 = []; i >= 0; i--) l[p - i] = n[d][i], u2[p - i] = a[d][i];
        for (c.push({ x: l, y: u2, bicubic: f }), i = d, l = [], u2 = []; i >= 0; i--) l[d - i] = n[i][0], u2[d - i] = a[i][0];
        return c.push({ x: l, y: u2, bicubic: h }), c;
      };
    }, {}], 697: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/cartesian/axes"), a = e("../../lib/extend").extendFlat;
      t.exports = function(o, s, i) {
        var l, u2, c, f, h, p, d, v, m, g, x, b, y, w, _4 = o["_" + s], k = o[s + "axis"], T2 = k._gridlines = [], A2 = k._minorgridlines = [], S2 = k._boundarylines = [], C2 = o["_" + i], E2 = o[i + "axis"];
        k.tickmode === "array" && (k.tickvals = _4.slice());
        var F13 = o._xctrl, N2 = o._yctrl, D2 = F13[0].length, I2 = F13.length, O2 = o._a.length, L2 = o._b.length;
        n.prepTicks(k), k.tickmode === "array" && delete k.tickvals;
        var V2 = k.smoothing ? 3 : 1;
        function W2(Y2) {
          var K2, q, re, R2, z, H2, te, j, Q2, Z2, ne, ae, ue = [], le = [], ce = {};
          if (s === "b") for (q = o.b2j(Y2), re = Math.floor(Math.max(0, Math.min(L2 - 2, q))), R2 = q - re, ce.length = L2, ce.crossLength = O2, ce.xy = function(se) {
            return o.evalxy([], se, q);
          }, ce.dxy = function(se, he) {
            return o.dxydi([], se, re, he, R2);
          }, K2 = 0; K2 < O2; K2++) H2 = Math.min(O2 - 2, K2), te = K2 - H2, j = o.evalxy([], K2, q), E2.smoothing && K2 > 0 && (Q2 = o.dxydi([], K2 - 1, re, 0, R2), ue.push(z[0] + Q2[0] / 3), le.push(z[1] + Q2[1] / 3), Z2 = o.dxydi([], K2 - 1, re, 1, R2), ue.push(j[0] - Z2[0] / 3), le.push(j[1] - Z2[1] / 3)), ue.push(j[0]), le.push(j[1]), z = j;
          else for (K2 = o.a2i(Y2), H2 = Math.floor(Math.max(0, Math.min(O2 - 2, K2))), te = K2 - H2, ce.length = O2, ce.crossLength = L2, ce.xy = function(se) {
            return o.evalxy([], K2, se);
          }, ce.dxy = function(se, he) {
            return o.dxydj([], H2, se, te, he);
          }, q = 0; q < L2; q++) re = Math.min(L2 - 2, q), R2 = q - re, j = o.evalxy([], K2, q), E2.smoothing && q > 0 && (ne = o.dxydj([], H2, q - 1, te, 0), ue.push(z[0] + ne[0] / 3), le.push(z[1] + ne[1] / 3), ae = o.dxydj([], H2, q - 1, te, 1), ue.push(j[0] - ae[0] / 3), le.push(j[1] - ae[1] / 3)), ue.push(j[0]), le.push(j[1]), z = j;
          return ce.axisLetter = s, ce.axis = k, ce.crossAxis = E2, ce.value = Y2, ce.constvar = i, ce.index = v, ce.x = ue, ce.y = le, ce.smoothing = E2.smoothing, ce;
        }
        function X2(Y2) {
          var K2, q, re, R2, z, H2 = [], te = [], j = {};
          if (j.length = _4.length, j.crossLength = C2.length, s === "b") for (re = Math.max(0, Math.min(L2 - 2, Y2)), z = Math.min(1, Math.max(0, Y2 - re)), j.xy = function(Q2) {
            return o.evalxy([], Q2, Y2);
          }, j.dxy = function(Q2, Z2) {
            return o.dxydi([], Q2, re, Z2, z);
          }, K2 = 0; K2 < D2; K2++) H2[K2] = F13[Y2 * V2][K2], te[K2] = N2[Y2 * V2][K2];
          else for (q = Math.max(0, Math.min(O2 - 2, Y2)), R2 = Math.min(1, Math.max(0, Y2 - q)), j.xy = function(Q2) {
            return o.evalxy([], Y2, Q2);
          }, j.dxy = function(Q2, Z2) {
            return o.dxydj([], q, Q2, R2, Z2);
          }, K2 = 0; K2 < I2; K2++) H2[K2] = F13[K2][Y2 * V2], te[K2] = N2[K2][Y2 * V2];
          return j.axisLetter = s, j.axis = k, j.crossAxis = E2, j.value = _4[Y2], j.constvar = i, j.index = Y2, j.x = H2, j.y = te, j.smoothing = E2.smoothing, j;
        }
        if (k.tickmode === "array") {
          for (f = 5e-15, p = (h = [Math.floor((_4.length - 1 - k.arraytick0) / k.arraydtick * (1 + f)), Math.ceil(-k.arraytick0 / k.arraydtick / (1 + f))].sort(function(Y2, K2) {
            return Y2 - K2;
          }))[0] - 1, d = h[1] + 1, v = p; v < d; v++) (u2 = k.arraytick0 + k.arraydtick * v) < 0 || u2 > _4.length - 1 || T2.push(a(X2(u2), { color: k.gridcolor, width: k.gridwidth }));
          for (v = p; v < d; v++) if (c = k.arraytick0 + k.arraydtick * v, x = Math.min(c + k.arraydtick, _4.length - 1), !(c < 0 || c > _4.length - 1 || x < 0 || x > _4.length - 1)) for (b = _4[c], y = _4[x], l = 0; l < k.minorgridcount; l++) (w = x - c) <= 0 || (g = b + (y - b) * (l + 1) / (k.minorgridcount + 1) * (k.arraydtick / w)) < _4[0] || g > _4[_4.length - 1] || A2.push(a(W2(g), { color: k.minorgridcolor, width: k.minorgridwidth }));
          k.startline && S2.push(a(X2(0), { color: k.startlinecolor, width: k.startlinewidth })), k.endline && S2.push(a(X2(_4.length - 1), { color: k.endlinecolor, width: k.endlinewidth }));
        } else {
          for (f = 5e-15, p = (h = [Math.floor((_4[_4.length - 1] - k.tick0) / k.dtick * (1 + f)), Math.ceil((_4[0] - k.tick0) / k.dtick / (1 + f))].sort(function(Y2, K2) {
            return Y2 - K2;
          }))[0], d = h[1], v = p; v <= d; v++) m = k.tick0 + k.dtick * v, T2.push(a(W2(m), { color: k.gridcolor, width: k.gridwidth }));
          for (v = p - 1; v < d + 1; v++) for (m = k.tick0 + k.dtick * v, l = 0; l < k.minorgridcount; l++) (g = m + k.dtick * (l + 1) / (k.minorgridcount + 1)) < _4[0] || g > _4[_4.length - 1] || A2.push(a(W2(g), { color: k.minorgridcolor, width: k.minorgridwidth }));
          k.startline && S2.push(a(W2(_4[0]), { color: k.startlinecolor, width: k.startlinewidth })), k.endline && S2.push(a(W2(_4[_4.length - 1]), { color: k.endlinecolor, width: k.endlinewidth }));
        }
      };
    }, { "../../lib/extend": 493, "../../plots/cartesian/axes": 554 }], 698: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/cartesian/axes"), a = e("../../lib/extend").extendFlat;
      t.exports = function(o, s) {
        var i, l, u2, c = s._labels = [], f = s._gridlines;
        for (i = 0; i < f.length; i++) u2 = f[i], ["start", "both"].indexOf(s.showticklabels) !== -1 && (l = n.tickText(s, u2.value), a(l, { prefix: void 0, suffix: void 0, endAnchor: true, xy: u2.xy(0), dxy: u2.dxy(0, 0), axis: u2.axis, length: u2.crossAxis.length, font: u2.axis.tickfont, isFirst: i === 0, isLast: i === f.length - 1 }), c.push(l)), ["end", "both"].indexOf(s.showticklabels) !== -1 && (l = n.tickText(s, u2.value), a(l, { endAnchor: false, xy: u2.xy(u2.crossLength - 1), dxy: u2.dxy(u2.crossLength - 2, 1), axis: u2.axis, length: u2.crossAxis.length, font: u2.axis.tickfont, isFirst: i === 0, isLast: i === f.length - 1 }), c.push(l));
      };
    }, { "../../lib/extend": 493, "../../plots/cartesian/axes": 554 }], 699: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a, o, s) {
        var i = n[0] - a[0], l = n[1] - a[1], u2 = o[0] - a[0], c = o[1] - a[1], f = Math.pow(i * i + l * l, 0.25), h = Math.pow(u2 * u2 + c * c, 0.25), p = (h * h * i - f * f * u2) * s, d = (h * h * l - f * f * c) * s, v = h * (f + h) * 3, m = f * (f + h) * 3;
        return [[a[0] + (v && p / v), a[1] + (v && d / v)], [a[0] - (m && p / m), a[1] - (m && d / m)]];
      };
    }, {}], 700: [function(e, t, r) {
      "use strict";
      var n = e("../../lib").isArrayOrTypedArray;
      t.exports = function(a, o, s) {
        var i, l, u2, c, f, h, p = [], d = n(a) ? a.length : a, v = n(o) ? o.length : o, m = n(a) ? a : null, g = n(o) ? o : null;
        m && (u2 = (m.length - 1) / (m[m.length - 1] - m[0]) / (d - 1)), g && (c = (g.length - 1) / (g[g.length - 1] - g[0]) / (v - 1));
        var x = 1 / 0, b = -1 / 0;
        for (l = 0; l < v; l++) for (p[l] = [], f = g ? (g[l] - g[0]) * c : l / (v - 1), i = 0; i < d; i++) h = (m ? (m[i] - m[0]) * u2 : i / (d - 1)) - f * s, x = Math.min(h, x), b = Math.max(h, b), p[l][i] = h;
        var y = 1 / (b - x), w = -x * y;
        for (l = 0; l < v; l++) for (i = 0; i < d; i++) p[l][i] = y * p[l][i] + w;
        return p;
      };
    }, { "../../lib": 503 }], 701: [function(e, t, r) {
      "use strict";
      var n = e("./catmull_rom"), a = e("../../lib").ensureArray;
      function o(s, i, l) {
        var u2 = -0.5 * l[0] + 1.5 * i[0], c = -0.5 * l[1] + 1.5 * i[1];
        return [(2 * u2 + s[0]) / 3, (2 * c + s[1]) / 3];
      }
      t.exports = function(s, i, l, u2, c, f) {
        var h, p, d, v, m, g, x, b, y, w, _4 = l[0].length, k = l.length, T2 = c ? 3 * _4 - 2 : _4, A2 = f ? 3 * k - 2 : k;
        for (s = a(s, A2), i = a(i, A2), d = 0; d < A2; d++) s[d] = a(s[d], T2), i[d] = a(i[d], T2);
        for (p = 0, v = 0; p < k; p++, v += f ? 3 : 1) for (m = s[v], g = i[v], x = l[p], b = u2[p], h = 0, d = 0; h < _4; h++, d += c ? 3 : 1) m[d] = x[h], g[d] = b[h];
        if (c) for (p = 0, v = 0; p < k; p++, v += f ? 3 : 1) {
          for (h = 1, d = 3; h < _4 - 1; h++, d += 3) y = n([l[p][h - 1], u2[p][h - 1]], [l[p][h], u2[p][h]], [l[p][h + 1], u2[p][h + 1]], c), s[v][d - 1] = y[0][0], i[v][d - 1] = y[0][1], s[v][d + 1] = y[1][0], i[v][d + 1] = y[1][1];
          w = o([s[v][0], i[v][0]], [s[v][2], i[v][2]], [s[v][3], i[v][3]]), s[v][1] = w[0], i[v][1] = w[1], w = o([s[v][T2 - 1], i[v][T2 - 1]], [s[v][T2 - 3], i[v][T2 - 3]], [s[v][T2 - 4], i[v][T2 - 4]]), s[v][T2 - 2] = w[0], i[v][T2 - 2] = w[1];
        }
        if (f) for (d = 0; d < T2; d++) {
          for (v = 3; v < A2 - 3; v += 3) y = n([s[v - 3][d], i[v - 3][d]], [s[v][d], i[v][d]], [s[v + 3][d], i[v + 3][d]], f), s[v - 1][d] = y[0][0], i[v - 1][d] = y[0][1], s[v + 1][d] = y[1][0], i[v + 1][d] = y[1][1];
          w = o([s[0][d], i[0][d]], [s[2][d], i[2][d]], [s[3][d], i[3][d]]), s[1][d] = w[0], i[1][d] = w[1], w = o([s[A2 - 1][d], i[A2 - 1][d]], [s[A2 - 3][d], i[A2 - 3][d]], [s[A2 - 4][d], i[A2 - 4][d]]), s[A2 - 2][d] = w[0], i[A2 - 2][d] = w[1];
        }
        if (c && f) for (v = 1; v < A2; v += (v + 1) % 3 == 0 ? 2 : 1) {
          for (d = 3; d < T2 - 3; d += 3) y = n([s[v][d - 3], i[v][d - 3]], [s[v][d], i[v][d]], [s[v][d + 3], i[v][d + 3]], c), s[v][d - 1] = 0.5 * (s[v][d - 1] + y[0][0]), i[v][d - 1] = 0.5 * (i[v][d - 1] + y[0][1]), s[v][d + 1] = 0.5 * (s[v][d + 1] + y[1][0]), i[v][d + 1] = 0.5 * (i[v][d + 1] + y[1][1]);
          w = o([s[v][0], i[v][0]], [s[v][2], i[v][2]], [s[v][3], i[v][3]]), s[v][1] = 0.5 * (s[v][1] + w[0]), i[v][1] = 0.5 * (i[v][1] + w[1]), w = o([s[v][T2 - 1], i[v][T2 - 1]], [s[v][T2 - 3], i[v][T2 - 3]], [s[v][T2 - 4], i[v][T2 - 4]]), s[v][T2 - 2] = 0.5 * (s[v][T2 - 2] + w[0]), i[v][T2 - 2] = 0.5 * (i[v][T2 - 2] + w[1]);
        }
        return [s, i];
      };
    }, { "../../lib": 503, "./catmull_rom": 699 }], 702: [function(e, t, r) {
      "use strict";
      t.exports = { RELATIVE_CULL_TOLERANCE: 1e-6 };
    }, {}], 703: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a, o) {
        return a && o ? function(s, i, l, u2, c) {
          var f, h, p, d, v, m;
          s || (s = []), i *= 3, l *= 3;
          var g = u2 * u2, x = 1 - u2, b = x * x, y = x * u2 * 2, w = -3 * b, _4 = 3 * (b - y), k = 3 * (y - g), T2 = 3 * g, A2 = c * c, S2 = A2 * c, C2 = 1 - c, E2 = C2 * C2, F13 = E2 * C2;
          for (m = 0; m < n.length; m++) f = w * (v = n[m])[l][i] + _4 * v[l][i + 1] + k * v[l][i + 2] + T2 * v[l][i + 3], h = w * v[l + 1][i] + _4 * v[l + 1][i + 1] + k * v[l + 1][i + 2] + T2 * v[l + 1][i + 3], p = w * v[l + 2][i] + _4 * v[l + 2][i + 1] + k * v[l + 2][i + 2] + T2 * v[l + 2][i + 3], d = w * v[l + 3][i] + _4 * v[l + 3][i + 1] + k * v[l + 3][i + 2] + T2 * v[l + 3][i + 3], s[m] = F13 * f + 3 * (E2 * c * h + C2 * A2 * p) + S2 * d;
          return s;
        } : a ? function(s, i, l, u2, c) {
          var f, h, p, d;
          s || (s = []), i *= 3;
          var v = u2 * u2, m = 1 - u2, g = m * m, x = m * u2 * 2, b = -3 * g, y = 3 * (g - x), w = 3 * (x - v), _4 = 3 * v, k = 1 - c;
          for (p = 0; p < n.length; p++) f = b * (d = n[p])[l][i] + y * d[l][i + 1] + w * d[l][i + 2] + _4 * d[l][i + 3], h = b * d[l + 1][i] + y * d[l + 1][i + 1] + w * d[l + 1][i + 2] + _4 * d[l + 1][i + 3], s[p] = k * f + c * h;
          return s;
        } : o ? function(s, i, l, u2, c) {
          var f, h, p, d, v, m;
          s || (s = []), l *= 3;
          var g = c * c, x = g * c, b = 1 - c, y = b * b, w = y * b;
          for (v = 0; v < n.length; v++) f = (m = n[v])[l][i + 1] - m[l][i], h = m[l + 1][i + 1] - m[l + 1][i], p = m[l + 2][i + 1] - m[l + 2][i], d = m[l + 3][i + 1] - m[l + 3][i], s[v] = w * f + 3 * (y * c * h + b * g * p) + x * d;
          return s;
        } : function(s, i, l, u2, c) {
          var f, h, p, d;
          s || (s = []);
          var v = 1 - c;
          for (p = 0; p < n.length; p++) f = (d = n[p])[l][i + 1] - d[l][i], h = d[l + 1][i + 1] - d[l + 1][i], s[p] = v * f + c * h;
          return s;
        };
      };
    }, {}], 704: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a, o) {
        return a && o ? function(s, i, l, u2, c) {
          var f, h, p, d, v, m;
          s || (s = []), i *= 3, l *= 3;
          var g = u2 * u2, x = g * u2, b = 1 - u2, y = b * b, w = y * b, _4 = c * c, k = 1 - c, T2 = k * k, A2 = k * c * 2, S2 = -3 * T2, C2 = 3 * (T2 - A2), E2 = 3 * (A2 - _4), F13 = 3 * _4;
          for (m = 0; m < n.length; m++) f = S2 * (v = n[m])[l][i] + C2 * v[l + 1][i] + E2 * v[l + 2][i] + F13 * v[l + 3][i], h = S2 * v[l][i + 1] + C2 * v[l + 1][i + 1] + E2 * v[l + 2][i + 1] + F13 * v[l + 3][i + 1], p = S2 * v[l][i + 2] + C2 * v[l + 1][i + 2] + E2 * v[l + 2][i + 2] + F13 * v[l + 3][i + 2], d = S2 * v[l][i + 3] + C2 * v[l + 1][i + 3] + E2 * v[l + 2][i + 3] + F13 * v[l + 3][i + 3], s[m] = w * f + 3 * (y * u2 * h + b * g * p) + x * d;
          return s;
        } : a ? function(s, i, l, u2, c) {
          var f, h, p, d, v, m;
          s || (s = []), i *= 3;
          var g = c * c, x = g * c, b = 1 - c, y = b * b, w = y * b;
          for (v = 0; v < n.length; v++) f = (m = n[v])[l + 1][i] - m[l][i], h = m[l + 1][i + 1] - m[l][i + 1], p = m[l + 1][i + 2] - m[l][i + 2], d = m[l + 1][i + 3] - m[l][i + 3], s[v] = w * f + 3 * (y * c * h + b * g * p) + x * d;
          return s;
        } : o ? function(s, i, l, u2, c) {
          var f, h, p, d;
          s || (s = []), l *= 3;
          var v = 1 - u2, m = c * c, g = 1 - c, x = g * g, b = g * c * 2, y = -3 * x, w = 3 * (x - b), _4 = 3 * (b - m), k = 3 * m;
          for (p = 0; p < n.length; p++) f = y * (d = n[p])[l][i] + w * d[l + 1][i] + _4 * d[l + 2][i] + k * d[l + 3][i], h = y * d[l][i + 1] + w * d[l + 1][i + 1] + _4 * d[l + 2][i + 1] + k * d[l + 3][i + 1], s[p] = v * f + u2 * h;
          return s;
        } : function(s, i, l, u2, c) {
          var f, h, p, d;
          s || (s = []);
          var v = 1 - u2;
          for (p = 0; p < n.length; p++) f = (d = n[p])[l + 1][i] - d[l][i], h = d[l + 1][i + 1] - d[l][i + 1], s[p] = v * f + u2 * h;
          return s;
        };
      };
    }, {}], 705: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a, o, s, i) {
        var l = a - 2, u2 = o - 2;
        return s && i ? function(c, f, h) {
          var p, d, v, m, g, x;
          c || (c = []);
          var b = Math.max(0, Math.min(Math.floor(f), l)), y = Math.max(0, Math.min(Math.floor(h), u2)), w = Math.max(0, Math.min(1, f - b)), _4 = Math.max(0, Math.min(1, h - y));
          b *= 3, y *= 3;
          var k = w * w, T2 = k * w, A2 = 1 - w, S2 = A2 * A2, C2 = S2 * A2, E2 = _4 * _4, F13 = E2 * _4, N2 = 1 - _4, D2 = N2 * N2, I2 = D2 * N2;
          for (x = 0; x < n.length; x++) p = C2 * (g = n[x])[y][b] + 3 * (S2 * w * g[y][b + 1] + A2 * k * g[y][b + 2]) + T2 * g[y][b + 3], d = C2 * g[y + 1][b] + 3 * (S2 * w * g[y + 1][b + 1] + A2 * k * g[y + 1][b + 2]) + T2 * g[y + 1][b + 3], v = C2 * g[y + 2][b] + 3 * (S2 * w * g[y + 2][b + 1] + A2 * k * g[y + 2][b + 2]) + T2 * g[y + 2][b + 3], m = C2 * g[y + 3][b] + 3 * (S2 * w * g[y + 3][b + 1] + A2 * k * g[y + 3][b + 2]) + T2 * g[y + 3][b + 3], c[x] = I2 * p + 3 * (D2 * _4 * d + N2 * E2 * v) + F13 * m;
          return c;
        } : s ? function(c, f, h) {
          c || (c = []);
          var p, d, v, m, g, x, b = Math.max(0, Math.min(Math.floor(f), l)), y = Math.max(0, Math.min(Math.floor(h), u2)), w = Math.max(0, Math.min(1, f - b)), _4 = Math.max(0, Math.min(1, h - y));
          b *= 3;
          var k = w * w, T2 = k * w, A2 = 1 - w, S2 = A2 * A2, C2 = S2 * A2, E2 = 1 - _4;
          for (g = 0; g < n.length; g++) p = E2 * (x = n[g])[y][b] + _4 * x[y + 1][b], d = E2 * x[y][b + 1] + _4 * x[y + 1][b + 1], v = E2 * x[y][b + 2] + _4 * x[y + 1][b + 1], m = E2 * x[y][b + 3] + _4 * x[y + 1][b + 1], c[g] = C2 * p + 3 * (S2 * w * d + A2 * k * v) + T2 * m;
          return c;
        } : i ? function(c, f, h) {
          c || (c = []);
          var p, d, v, m, g, x, b = Math.max(0, Math.min(Math.floor(f), l)), y = Math.max(0, Math.min(Math.floor(h), u2)), w = Math.max(0, Math.min(1, f - b)), _4 = Math.max(0, Math.min(1, h - y));
          y *= 3;
          var k = _4 * _4, T2 = k * _4, A2 = 1 - _4, S2 = A2 * A2, C2 = S2 * A2, E2 = 1 - w;
          for (g = 0; g < n.length; g++) p = E2 * (x = n[g])[y][b] + w * x[y][b + 1], d = E2 * x[y + 1][b] + w * x[y + 1][b + 1], v = E2 * x[y + 2][b] + w * x[y + 2][b + 1], m = E2 * x[y + 3][b] + w * x[y + 3][b + 1], c[g] = C2 * p + 3 * (S2 * _4 * d + A2 * k * v) + T2 * m;
          return c;
        } : function(c, f, h) {
          c || (c = []);
          var p, d, v, m, g = Math.max(0, Math.min(Math.floor(f), l)), x = Math.max(0, Math.min(Math.floor(h), u2)), b = Math.max(0, Math.min(1, f - g)), y = Math.max(0, Math.min(1, h - x)), w = 1 - y, _4 = 1 - b;
          for (v = 0; v < n.length; v++) p = _4 * (m = n[v])[x][g] + b * m[x][g + 1], d = _4 * m[x + 1][g] + b * m[x + 1][g + 1], c[v] = w * p + y * d;
          return c;
        };
      };
    }, {}], 706: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("./xy_defaults"), o = e("./ab_defaults"), s = e("./attributes"), i = e("../../components/color/attributes");
      t.exports = function(l, u2, c, f) {
        function h(d, v) {
          return n.coerce(l, u2, s, d, v);
        }
        u2._clipPathId = "clip" + u2.uid + "carpet";
        var p = h("color", i.defaultLine);
        n.coerceFont(h, "font"), h("carpet"), o(l, u2, f, h, p), u2.a && u2.b ? (u2.a.length < 3 && (u2.aaxis.smoothing = 0), u2.b.length < 3 && (u2.baxis.smoothing = 0), a(l, u2, h) || (u2.visible = false), u2._cheater && h("cheaterslope")) : u2.visible = false;
      };
    }, { "../../components/color/attributes": 365, "../../lib": 503, "./ab_defaults": 689, "./attributes": 691, "./xy_defaults": 715 }], 707: [function(e, t, r) {
      "use strict";
      t.exports = { attributes: e("./attributes"), supplyDefaults: e("./defaults"), plot: e("./plot"), calc: e("./calc"), animatable: true, isContainer: true, moduleType: "trace", name: "carpet", basePlotModule: e("../../plots/cartesian"), categories: ["cartesian", "svg", "carpet", "carpetAxis", "notLegendIsolatable", "noMultiCategory", "noHover", "noSortingByValue"], meta: {} };
    }, { "../../plots/cartesian": 568, "./attributes": 691, "./calc": 695, "./defaults": 706, "./plot": 712 }], 708: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a) {
        for (var o, s = n._fullData.length, i = 0; i < s; i++) {
          var l = n._fullData[i];
          if (l.index !== a.index && l.type === "carpet" && (o || (o = l), l.carpet === a.carpet)) return l;
        }
        return o;
      };
    }, {}], 709: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a, o) {
        if (n.length === 0) return "";
        var s, i = [], l = o ? 3 : 1;
        for (s = 0; s < n.length; s += l) i.push(n[s] + "," + a[s]), o && s < n.length - l && (i.push("C"), i.push([n[s + 1] + "," + a[s + 1], n[s + 2] + "," + a[s + 2] + " "].join(" ")));
        return i.join(o ? "" : "L");
      };
    }, {}], 710: [function(e, t, r) {
      "use strict";
      var n = e("../../lib").isArrayOrTypedArray;
      t.exports = function(a, o, s) {
        var i;
        for (n(a) ? a.length > o.length && (a = a.slice(0, o.length)) : a = [], i = 0; i < o.length; i++) a[i] = s(o[i]);
        return a;
      };
    }, { "../../lib": 503 }], 711: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a, o, s, i, l) {
        var u2 = i[0] * n.dpdx(a), c = i[1] * n.dpdy(o), f = 1, h = 1;
        if (l) {
          var p = Math.sqrt(i[0] * i[0] + i[1] * i[1]), d = Math.sqrt(l[0] * l[0] + l[1] * l[1]), v = (i[0] * l[0] + i[1] * l[1]) / p / d;
          h = Math.max(0, v);
        }
        var m = 180 * Math.atan2(c, u2) / Math.PI;
        return m < -90 ? (m += 180, f = -f) : m > 90 && (m -= 180, f = -f), { angle: m, flip: f, p: n.c2p(s, a, o), offsetMultplier: h };
      };
    }, {}], 712: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../components/drawing"), o = e("./map_1d_array"), s = e("./makepath"), i = e("./orient_text"), l = e("../../lib/svg_text_utils"), u2 = e("../../lib"), c = u2.strRotate, f = u2.strTranslate, h = e("../../constants/alignment");
      function p(x, b, y, w, _4, k) {
        var T2 = "const-" + _4 + "-lines", A2 = y.selectAll("." + T2).data(k);
        A2.enter().append("path").classed(T2, true).style("vector-effect", "non-scaling-stroke"), A2.each(function(S2) {
          var C2 = S2, E2 = C2.x, F13 = C2.y, N2 = o([], E2, x.c2p), D2 = o([], F13, b.c2p), I2 = "M" + s(N2, D2, C2.smoothing);
          n.select(this).attr("d", I2).style("stroke-width", C2.width).style("stroke", C2.color).style("fill", "none");
        }), A2.exit().remove();
      }
      function d(x, b, y, w, _4, k, T2, A2) {
        var S2 = k.selectAll("text." + A2).data(T2);
        S2.enter().append("text").classed(A2, true);
        var C2 = 0, E2 = {};
        return S2.each(function(F13, N2) {
          var D2;
          if (F13.axis.tickangle === "auto") D2 = i(w, b, y, F13.xy, F13.dxy);
          else {
            var I2 = (F13.axis.tickangle + 180) * Math.PI / 180;
            D2 = i(w, b, y, F13.xy, [Math.cos(I2), Math.sin(I2)]);
          }
          N2 || (E2 = { angle: D2.angle, flip: D2.flip });
          var O2 = (F13.endAnchor ? -1 : 1) * D2.flip, L2 = n.select(this).attr({ "text-anchor": O2 > 0 ? "start" : "end", "data-notex": 1 }).call(a.font, F13.font).text(F13.text).call(l.convertToTspans, x), V2 = a.bBox(this);
          L2.attr("transform", f(D2.p[0], D2.p[1]) + c(D2.angle) + f(F13.axis.labelpadding * O2, 0.3 * V2.height)), C2 = Math.max(C2, V2.width + F13.axis.labelpadding);
        }), S2.exit().remove(), E2.maxExtent = C2, E2;
      }
      t.exports = function(x, b, y, w) {
        var _4 = b.xaxis, k = b.yaxis, T2 = x._fullLayout._clips;
        u2.makeTraceGroups(w, y, "trace").each(function(A2) {
          var S2 = n.select(this), C2 = A2[0], E2 = C2.trace, F13 = E2.aaxis, N2 = E2.baxis, D2 = u2.ensureSingle(S2, "g", "minorlayer"), I2 = u2.ensureSingle(S2, "g", "majorlayer"), O2 = u2.ensureSingle(S2, "g", "boundarylayer"), L2 = u2.ensureSingle(S2, "g", "labellayer");
          S2.style("opacity", E2.opacity), p(_4, k, I2, F13, "a", F13._gridlines), p(_4, k, I2, N2, "b", N2._gridlines), p(_4, k, D2, F13, "a", F13._minorgridlines), p(_4, k, D2, N2, "b", N2._minorgridlines), p(_4, k, O2, F13, "a-boundary", F13._boundarylines), p(_4, k, O2, N2, "b-boundary", N2._boundarylines);
          var V2 = d(x, _4, k, E2, C2, L2, F13._labels, "a-label"), W2 = d(x, _4, k, E2, C2, L2, N2._labels, "b-label");
          (function(X2, Y2, K2, q, re, R2, z, H2) {
            var te, j, Q2, Z2, ne = u2.aggNums(Math.min, null, K2.a), ae = u2.aggNums(Math.max, null, K2.a), ue = u2.aggNums(Math.min, null, K2.b), le = u2.aggNums(Math.max, null, K2.b);
            te = 0.5 * (ne + ae), j = ue, Q2 = K2.ab2xy(te, j, true), Z2 = K2.dxyda_rough(te, j), z.angle === void 0 && u2.extendFlat(z, i(K2, re, R2, Q2, K2.dxydb_rough(te, j))), g(X2, Y2, K2, q, Q2, Z2, K2.aaxis, re, R2, z, "a-title"), te = ne, j = 0.5 * (ue + le), Q2 = K2.ab2xy(te, j, true), Z2 = K2.dxydb_rough(te, j), H2.angle === void 0 && u2.extendFlat(H2, i(K2, re, R2, Q2, K2.dxyda_rough(te, j))), g(X2, Y2, K2, q, Q2, Z2, K2.baxis, re, R2, H2, "b-title");
          })(x, L2, E2, C2, _4, k, V2, W2), function(X2, Y2, K2, q, re) {
            var R2, z, H2, te, j = K2.select("#" + X2._clipPathId);
            j.size() || (j = K2.append("clipPath").classed("carpetclip", true));
            var Q2 = u2.ensureSingle(j, "path", "carpetboundary"), Z2 = Y2.clipsegments, ne = [];
            for (te = 0; te < Z2.length; te++) R2 = Z2[te], z = o([], R2.x, q.c2p), H2 = o([], R2.y, re.c2p), ne.push(s(z, H2, R2.bicubic));
            var ae = "M" + ne.join("L") + "Z";
            j.attr("id", X2._clipPathId), Q2.attr("d", ae);
          }(E2, C2, T2, _4, k);
        });
      };
      var v = h.LINE_SPACING, m = (1 - h.MID_SHIFT) / v + 1;
      function g(x, b, y, w, _4, k, T2, A2, S2, C2, E2) {
        var F13 = [];
        T2.title.text && F13.push(T2.title.text);
        var N2 = b.selectAll("text." + E2).data(F13), D2 = C2.maxExtent;
        N2.enter().append("text").classed(E2, true), N2.each(function() {
          var I2 = i(y, A2, S2, _4, k);
          ["start", "both"].indexOf(T2.showticklabels) === -1 && (D2 = 0);
          var O2 = T2.title.font.size;
          D2 += O2 + T2.title.offset;
          var L2 = (C2.angle + (C2.flip < 0 ? 180 : 0) - I2.angle + 450) % 360, V2 = L2 > 90 && L2 < 270, W2 = n.select(this);
          W2.text(T2.title.text).call(l.convertToTspans, x), V2 && (D2 = (-l.lineCount(W2) + m) * v * O2 - D2), W2.attr("transform", f(I2.p[0], I2.p[1]) + c(I2.angle) + f(0, D2)).attr("text-anchor", "middle").call(a.font, T2.title.font);
        }), N2.exit().remove();
      }
    }, { "../../components/drawing": 388, "../../constants/alignment": 471, "../../lib": 503, "../../lib/svg_text_utils": 529, "./makepath": 709, "./map_1d_array": 710, "./orient_text": 711, "@plotly/d3": 58 }], 713: [function(e, t, r) {
      "use strict";
      var n = e("./constants"), a = e("../../lib/search").findBin, o = e("./compute_control_points"), s = e("./create_spline_evaluator"), i = e("./create_i_derivative_evaluator"), l = e("./create_j_derivative_evaluator");
      t.exports = function(u2) {
        var c = u2._a, f = u2._b, h = c.length, p = f.length, d = u2.aaxis, v = u2.baxis, m = c[0], g = c[h - 1], x = f[0], b = f[p - 1], y = c[c.length - 1] - c[0], w = f[f.length - 1] - f[0], _4 = y * n.RELATIVE_CULL_TOLERANCE, k = w * n.RELATIVE_CULL_TOLERANCE;
        m -= _4, g += _4, x -= k, b += k, u2.isVisible = function(T2, A2) {
          return T2 > m && T2 < g && A2 > x && A2 < b;
        }, u2.isOccluded = function(T2, A2) {
          return T2 < m || T2 > g || A2 < x || A2 > b;
        }, u2.setScale = function() {
          var T2 = u2._x, A2 = u2._y, S2 = o(u2._xctrl, u2._yctrl, T2, A2, d.smoothing, v.smoothing);
          u2._xctrl = S2[0], u2._yctrl = S2[1], u2.evalxy = s([u2._xctrl, u2._yctrl], h, p, d.smoothing, v.smoothing), u2.dxydi = i([u2._xctrl, u2._yctrl], d.smoothing, v.smoothing), u2.dxydj = l([u2._xctrl, u2._yctrl], d.smoothing, v.smoothing);
        }, u2.i2a = function(T2) {
          var A2 = Math.max(0, Math.floor(T2[0]), h - 2), S2 = T2[0] - A2;
          return (1 - S2) * c[A2] + S2 * c[A2 + 1];
        }, u2.j2b = function(T2) {
          var A2 = Math.max(0, Math.floor(T2[1]), h - 2), S2 = T2[1] - A2;
          return (1 - S2) * f[A2] + S2 * f[A2 + 1];
        }, u2.ij2ab = function(T2) {
          return [u2.i2a(T2[0]), u2.j2b(T2[1])];
        }, u2.a2i = function(T2) {
          var A2 = Math.max(0, Math.min(a(T2, c), h - 2)), S2 = c[A2], C2 = c[A2 + 1];
          return Math.max(0, Math.min(h - 1, A2 + (T2 - S2) / (C2 - S2)));
        }, u2.b2j = function(T2) {
          var A2 = Math.max(0, Math.min(a(T2, f), p - 2)), S2 = f[A2], C2 = f[A2 + 1];
          return Math.max(0, Math.min(p - 1, A2 + (T2 - S2) / (C2 - S2)));
        }, u2.ab2ij = function(T2) {
          return [u2.a2i(T2[0]), u2.b2j(T2[1])];
        }, u2.i2c = function(T2, A2) {
          return u2.evalxy([], T2, A2);
        }, u2.ab2xy = function(T2, A2, S2) {
          if (!S2 && (T2 < c[0] || T2 > c[h - 1] | A2 < f[0] || A2 > f[p - 1])) return [false, false];
          var C2 = u2.a2i(T2), E2 = u2.b2j(A2), F13 = u2.evalxy([], C2, E2);
          if (S2) {
            var N2, D2, I2, O2, L2 = 0, V2 = 0, W2 = [];
            T2 < c[0] ? (N2 = 0, D2 = 0, L2 = (T2 - c[0]) / (c[1] - c[0])) : T2 > c[h - 1] ? (N2 = h - 2, D2 = 1, L2 = (T2 - c[h - 1]) / (c[h - 1] - c[h - 2])) : D2 = C2 - (N2 = Math.max(0, Math.min(h - 2, Math.floor(C2)))), A2 < f[0] ? (I2 = 0, O2 = 0, V2 = (A2 - f[0]) / (f[1] - f[0])) : A2 > f[p - 1] ? (I2 = p - 2, O2 = 1, V2 = (A2 - f[p - 1]) / (f[p - 1] - f[p - 2])) : O2 = E2 - (I2 = Math.max(0, Math.min(p - 2, Math.floor(E2)))), L2 && (u2.dxydi(W2, N2, I2, D2, O2), F13[0] += W2[0] * L2, F13[1] += W2[1] * L2), V2 && (u2.dxydj(W2, N2, I2, D2, O2), F13[0] += W2[0] * V2, F13[1] += W2[1] * V2);
          }
          return F13;
        }, u2.c2p = function(T2, A2, S2) {
          return [A2.c2p(T2[0]), S2.c2p(T2[1])];
        }, u2.p2x = function(T2, A2, S2) {
          return [A2.p2c(T2[0]), S2.p2c(T2[1])];
        }, u2.dadi = function(T2) {
          var A2 = Math.max(0, Math.min(c.length - 2, T2));
          return c[A2 + 1] - c[A2];
        }, u2.dbdj = function(T2) {
          var A2 = Math.max(0, Math.min(f.length - 2, T2));
          return f[A2 + 1] - f[A2];
        }, u2.dxyda = function(T2, A2, S2, C2) {
          var E2 = u2.dxydi(null, T2, A2, S2, C2), F13 = u2.dadi(T2, S2);
          return [E2[0] / F13, E2[1] / F13];
        }, u2.dxydb = function(T2, A2, S2, C2) {
          var E2 = u2.dxydj(null, T2, A2, S2, C2), F13 = u2.dbdj(A2, C2);
          return [E2[0] / F13, E2[1] / F13];
        }, u2.dxyda_rough = function(T2, A2, S2) {
          var C2 = y * (S2 || 0.1), E2 = u2.ab2xy(T2 + C2, A2, true), F13 = u2.ab2xy(T2 - C2, A2, true);
          return [0.5 * (E2[0] - F13[0]) / C2, 0.5 * (E2[1] - F13[1]) / C2];
        }, u2.dxydb_rough = function(T2, A2, S2) {
          var C2 = w * (S2 || 0.1), E2 = u2.ab2xy(T2, A2 + C2, true), F13 = u2.ab2xy(T2, A2 - C2, true);
          return [0.5 * (E2[0] - F13[0]) / C2, 0.5 * (E2[1] - F13[1]) / C2];
        }, u2.dpdx = function(T2) {
          return T2._m;
        }, u2.dpdy = function(T2) {
          return T2._m;
        };
      };
    }, { "../../lib/search": 523, "./compute_control_points": 701, "./constants": 702, "./create_i_derivative_evaluator": 703, "./create_j_derivative_evaluator": 704, "./create_spline_evaluator": 705 }], 714: [function(e, t, r) {
      "use strict";
      var n = e("../../lib");
      t.exports = function(a, o, s) {
        var i, l, u2, c = [], f = [], h = a[0].length, p = a.length;
        function d(Y2, K2) {
          var q, re = 0, R2 = 0;
          return Y2 > 0 && (q = a[K2][Y2 - 1]) !== void 0 && (R2++, re += q), Y2 < h - 1 && (q = a[K2][Y2 + 1]) !== void 0 && (R2++, re += q), K2 > 0 && (q = a[K2 - 1][Y2]) !== void 0 && (R2++, re += q), K2 < p - 1 && (q = a[K2 + 1][Y2]) !== void 0 && (R2++, re += q), re / Math.max(1, R2);
        }
        var v, m, g, x, b, y, w, _4, k, T2, A2, S2 = 0;
        for (i = 0; i < h; i++) for (l = 0; l < p; l++) a[l][i] === void 0 && (c.push(i), f.push(l), a[l][i] = d(i, l)), S2 = Math.max(S2, Math.abs(a[l][i]));
        if (!c.length) return a;
        var C2 = 0, E2 = 0, F13 = c.length;
        do {
          for (C2 = 0, u2 = 0; u2 < F13; u2++) {
            i = c[u2], l = f[u2];
            var N2, D2, I2, O2, L2, V2, W2 = 0, X2 = 0;
            i === 0 ? (I2 = o[L2 = Math.min(h - 1, 2)], O2 = o[1], N2 = a[l][L2], X2 += (D2 = a[l][1]) + (D2 - N2) * (o[0] - O2) / (O2 - I2), W2++) : i === h - 1 && (I2 = o[L2 = Math.max(0, h - 3)], O2 = o[h - 2], N2 = a[l][L2], X2 += (D2 = a[l][h - 2]) + (D2 - N2) * (o[h - 1] - O2) / (O2 - I2), W2++), (i === 0 || i === h - 1) && l > 0 && l < p - 1 && (v = s[l + 1] - s[l], X2 += ((m = s[l] - s[l - 1]) * a[l + 1][i] + v * a[l - 1][i]) / (m + v), W2++), l === 0 ? (I2 = s[V2 = Math.min(p - 1, 2)], O2 = s[1], N2 = a[V2][i], X2 += (D2 = a[1][i]) + (D2 - N2) * (s[0] - O2) / (O2 - I2), W2++) : l === p - 1 && (I2 = s[V2 = Math.max(0, p - 3)], O2 = s[p - 2], N2 = a[V2][i], X2 += (D2 = a[p - 2][i]) + (D2 - N2) * (s[p - 1] - O2) / (O2 - I2), W2++), (l === 0 || l === p - 1) && i > 0 && i < h - 1 && (v = o[i + 1] - o[i], X2 += ((m = o[i] - o[i - 1]) * a[l][i + 1] + v * a[l][i - 1]) / (m + v), W2++), W2 ? X2 /= W2 : (g = o[i + 1] - o[i], x = o[i] - o[i - 1], _4 = (b = s[l + 1] - s[l]) * (y = s[l] - s[l - 1]) * (b + y), X2 = ((w = g * x * (g + x)) * (y * a[l + 1][i] + b * a[l - 1][i]) + _4 * (x * a[l][i + 1] + g * a[l][i - 1])) / (_4 * (x + g) + w * (y + b))), C2 += (T2 = (k = X2 - a[l][i]) / S2) * T2, A2 = W2 ? 0 : 0.85, a[l][i] += k * (1 + A2);
          }
          C2 = Math.sqrt(C2);
        } while (E2++ < 100 && C2 > 1e-5);
        return n.log("Smoother converged to", C2, "after", E2, "iterations"), a;
      };
    }, { "../../lib": 503 }], 715: [function(e, t, r) {
      "use strict";
      var n = e("../../lib").isArray1D;
      t.exports = function(a, o, s) {
        var i = s("x"), l = i && i.length, u2 = s("y"), c = u2 && u2.length;
        if (!l && !c) return false;
        if (o._cheater = !i, l && !n(i) || c && !n(u2)) o._length = null;
        else {
          var f = l ? i.length : 1 / 0;
          c && (f = Math.min(f, u2.length)), o.a && o.a.length && (f = Math.min(f, o.a.length)), o.b && o.b.length && (f = Math.min(f, o.b.length)), o._length = f;
        }
        return true;
      };
    }, { "../../lib": 503 }], 716: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/template_attributes").hovertemplateAttrs, a = e("../scattergeo/attributes"), o = e("../../components/colorscale/attributes"), s = e("../../plots/attributes"), i = e("../../components/color/attributes").defaultLine, l = e("../../lib/extend").extendFlat, u2 = a.marker.line;
      t.exports = l({ locations: { valType: "data_array", editType: "calc" }, locationmode: a.locationmode, z: { valType: "data_array", editType: "calc" }, geojson: l({}, a.geojson, {}), featureidkey: a.featureidkey, text: l({}, a.text, {}), hovertext: l({}, a.hovertext, {}), marker: { line: { color: l({}, u2.color, { dflt: i }), width: l({}, u2.width, { dflt: 1 }), editType: "calc" }, opacity: { valType: "number", arrayOk: true, min: 0, max: 1, dflt: 1, editType: "style" }, editType: "calc" }, selected: { marker: { opacity: a.selected.marker.opacity, editType: "plot" }, editType: "plot" }, unselected: { marker: { opacity: a.unselected.marker.opacity, editType: "plot" }, editType: "plot" }, hoverinfo: l({}, s.hoverinfo, { editType: "calc", flags: ["location", "z", "text", "name"] }), hovertemplate: n(), showlegend: l({}, s.showlegend, { dflt: false }) }, o("", { cLetter: "z", editTypeOverride: "calc" }));
    }, { "../../components/color/attributes": 365, "../../components/colorscale/attributes": 373, "../../lib/extend": 493, "../../plots/attributes": 550, "../../plots/template_attributes": 633, "../scattergeo/attributes": 968 }], 717: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("../../constants/numerical").BADNUM, o = e("../../components/colorscale/calc"), s = e("../scatter/arrays_to_calcdata"), i = e("../scatter/calc_selection");
      function l(u2) {
        return u2 && typeof u2 == "string";
      }
      t.exports = function(u2, c) {
        var f, h = c._length, p = new Array(h);
        f = c.geojson ? function(x) {
          return l(x) || n(x);
        } : l;
        for (var d = 0; d < h; d++) {
          var v = p[d] = {}, m = c.locations[d], g = c.z[d];
          f(m) && n(g) ? (v.loc = m, v.z = g) : (v.loc = null, v.z = a), v.index = d;
        }
        return s(p, c), o(u2, c, { vals: c.z, containerStr: "", cLetter: "z" }), i(p, c), p;
      };
    }, { "../../components/colorscale/calc": 374, "../../constants/numerical": 479, "../scatter/arrays_to_calcdata": 925, "../scatter/calc_selection": 928, "fast-isnumeric": 190 }], 718: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../components/colorscale/defaults"), o = e("./attributes");
      t.exports = function(s, i, l, u2) {
        function c(v, m) {
          return n.coerce(s, i, o, v, m);
        }
        var f = c("locations"), h = c("z");
        if (f && f.length && n.isArrayOrTypedArray(h) && h.length) {
          i._length = Math.min(f.length, h.length);
          var p, d = c("geojson");
          (typeof d == "string" && d !== "" || n.isPlainObject(d)) && (p = "geojson-id"), c("locationmode", p) === "geojson-id" && c("featureidkey"), c("text"), c("hovertext"), c("hovertemplate"), c("marker.line.width") && c("marker.line.color"), c("marker.opacity"), a(s, i, u2, c, { prefix: "", cLetter: "z" }), n.coerceSelectionMarkerOpacity(i, c);
        } else i.visible = false;
      };
    }, { "../../components/colorscale/defaults": 376, "../../lib": 503, "./attributes": 716 }], 719: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a, o, s, i) {
        n.location = a.location, n.z = a.z;
        var l = s[i];
        return l.fIn && l.fIn.properties && (n.properties = l.fIn.properties), n.ct = l.ct, n;
      };
    }, {}], 720: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/cartesian/axes"), a = e("./attributes"), o = e("../../lib").fillText;
      t.exports = function(s, i, l) {
        var u2, c, f, h, p = s.cd, d = p[0].trace, v = s.subplot, m = [i, l], g = [i + 360, l];
        for (c = 0; c < p.length; c++) if (h = false, (u2 = p[c])._polygons) {
          for (f = 0; f < u2._polygons.length; f++) u2._polygons[f].contains(m) && (h = !h), u2._polygons[f].contains(g) && (h = !h);
          if (h) break;
        }
        if (h && u2) return s.x0 = s.x1 = s.xa.c2p(u2.ct), s.y0 = s.y1 = s.ya.c2p(u2.ct), s.index = u2.index, s.location = u2.loc, s.z = u2.z, s.zLabel = n.tickText(v.mockAxis, v.mockAxis.c2l(u2.z), "hover").text, s.hovertemplate = u2.hovertemplate, function(x, b, y) {
          if (!b.hovertemplate) {
            var w = y.hi || b.hoverinfo, _4 = String(y.loc), k = w === "all" ? a.hoverinfo.flags : w.split("+"), T2 = k.indexOf("name") !== -1, A2 = k.indexOf("location") !== -1, S2 = k.indexOf("z") !== -1, C2 = k.indexOf("text") !== -1, E2 = [];
            !T2 && A2 ? x.nameOverride = _4 : (T2 && (x.nameOverride = b.name), A2 && E2.push(_4)), S2 && E2.push(x.zLabel), C2 && o(y, b, E2), x.extraText = E2.join("<br>");
          }
        }(s, d, u2), [s];
      };
    }, { "../../lib": 503, "../../plots/cartesian/axes": 554, "./attributes": 716 }], 721: [function(e, t, r) {
      "use strict";
      t.exports = { attributes: e("./attributes"), supplyDefaults: e("./defaults"), colorbar: e("../heatmap/colorbar"), calc: e("./calc"), calcGeoJSON: e("./plot").calcGeoJSON, plot: e("./plot").plot, style: e("./style").style, styleOnSelect: e("./style").styleOnSelect, hoverPoints: e("./hover"), eventData: e("./event_data"), selectPoints: e("./select"), moduleType: "trace", name: "choropleth", basePlotModule: e("../../plots/geo"), categories: ["geo", "noOpacity", "showLegend"], meta: {} };
    }, { "../../plots/geo": 589, "../heatmap/colorbar": 795, "./attributes": 716, "./calc": 717, "./defaults": 718, "./event_data": 719, "./hover": 720, "./plot": 722, "./select": 723, "./style": 724 }], 722: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../lib"), o = e("../../lib/geo_location_utils"), s = e("../../lib/topojson_utils").getTopojsonFeatures, i = e("../../plots/cartesian/autorange").findExtremes, l = e("./style").style;
      t.exports = { calcGeoJSON: function(u2, c) {
        for (var f = u2[0].trace, h = c[f.geo], p = h._subplot, d = f.locationmode, v = f._length, m = d === "geojson-id" ? o.extractTraceFeature(u2) : s(f, p.topojson), g = [], x = [], b = 0; b < v; b++) {
          var y = u2[b], w = d === "geojson-id" ? y.fOut : o.locationToFeature(d, y.loc, m);
          if (w) {
            y.geojson = w, y.ct = w.properties.ct, y._polygons = o.feature2polygons(w);
            var _4 = o.computeBbox(w);
            g.push(_4[0], _4[2]), x.push(_4[1], _4[3]);
          } else y.geojson = null;
        }
        if (h.fitbounds === "geojson" && d === "geojson-id") {
          var k = o.computeBbox(o.getTraceGeojson(f));
          g = [k[0], k[2]], x = [k[1], k[3]];
        }
        var T2 = { padded: true };
        f._extremes.lon = i(h.lonaxis._ax, g, T2), f._extremes.lat = i(h.lataxis._ax, x, T2);
      }, plot: function(u2, c, f) {
        var h = c.layers.backplot.select(".choroplethlayer");
        a.makeTraceGroups(h, f, "trace choropleth").each(function(p) {
          var d = n.select(this).selectAll("path.choroplethlocation").data(a.identity);
          d.enter().append("path").classed("choroplethlocation", true), d.exit().remove(), l(u2, p);
        });
      } };
    }, { "../../lib": 503, "../../lib/geo_location_utils": 496, "../../lib/topojson_utils": 532, "../../plots/cartesian/autorange": 553, "./style": 724, "@plotly/d3": 58 }], 723: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a) {
        var o, s, i, l, u2, c = n.cd, f = n.xaxis, h = n.yaxis, p = [];
        if (a === false) for (o = 0; o < c.length; o++) c[o].selected = 0;
        else for (o = 0; o < c.length; o++) (i = (s = c[o]).ct) && (l = f.c2p(i), u2 = h.c2p(i), a.contains([l, u2], null, o, n) ? (p.push({ pointNumber: o, lon: i[0], lat: i[1] }), s.selected = 1) : s.selected = 0);
        return p;
      };
    }, {}], 724: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../components/color"), o = e("../../components/drawing"), s = e("../../components/colorscale");
      function i(l, u2) {
        var c = u2[0].trace, f = u2[0].node3.selectAll(".choroplethlocation"), h = c.marker || {}, p = h.line || {}, d = s.makeColorScaleFuncFromTrace(c);
        f.each(function(v) {
          n.select(this).attr("fill", d(v.z)).call(a.stroke, v.mlc || p.color).call(o.dashLine, "", v.mlw || p.width || 0).style("opacity", h.opacity);
        }), o.selectedPointStyle(f, c, l);
      }
      t.exports = { style: function(l, u2) {
        u2 && i(l, u2);
      }, styleOnSelect: function(l, u2) {
        var c = u2[0].node3, f = u2[0].trace;
        f.selectedpoints ? o.selectedPointStyle(c.selectAll(".choroplethlocation"), f, l) : i(l, u2);
      } };
    }, { "../../components/color": 366, "../../components/colorscale": 378, "../../components/drawing": 388, "@plotly/d3": 58 }], 725: [function(e, t, r) {
      "use strict";
      var n = e("../choropleth/attributes"), a = e("../../components/colorscale/attributes"), o = e("../../plots/template_attributes").hovertemplateAttrs, s = e("../../plots/attributes"), i = e("../../lib/extend").extendFlat;
      t.exports = i({ locations: { valType: "data_array", editType: "calc" }, z: { valType: "data_array", editType: "calc" }, geojson: { valType: "any", editType: "calc" }, featureidkey: i({}, n.featureidkey, {}), below: { valType: "string", editType: "plot" }, text: n.text, hovertext: n.hovertext, marker: { line: { color: i({}, n.marker.line.color, { editType: "plot" }), width: i({}, n.marker.line.width, { editType: "plot" }), editType: "calc" }, opacity: i({}, n.marker.opacity, { editType: "plot" }), editType: "calc" }, selected: { marker: { opacity: i({}, n.selected.marker.opacity, { editType: "plot" }), editType: "plot" }, editType: "plot" }, unselected: { marker: { opacity: i({}, n.unselected.marker.opacity, { editType: "plot" }), editType: "plot" }, editType: "plot" }, hoverinfo: n.hoverinfo, hovertemplate: o({}, { keys: ["properties"] }), showlegend: i({}, s.showlegend, { dflt: false }) }, a("", { cLetter: "z", editTypeOverride: "calc" }));
    }, { "../../components/colorscale/attributes": 373, "../../lib/extend": 493, "../../plots/attributes": 550, "../../plots/template_attributes": 633, "../choropleth/attributes": 716 }], 726: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("../../lib"), o = e("../../components/colorscale"), s = e("../../components/drawing"), i = e("../../lib/geojson_utils").makeBlank, l = e("../../lib/geo_location_utils");
      function u2(c) {
        var f, h = c[0].trace, p = h._opts;
        if (h.selectedpoints) {
          for (var d = s.makeSelectedPointStyleFns(h), v = 0; v < c.length; v++) {
            var m = c[v];
            m.fOut && (m.fOut.properties.mo2 = d.selectedOpacityFn(m));
          }
          f = { type: "identity", property: "mo2" };
        } else f = a.isArrayOrTypedArray(h.marker.opacity) ? { type: "identity", property: "mo" } : h.marker.opacity;
        return a.extendFlat(p.fill.paint, { "fill-opacity": f }), a.extendFlat(p.line.paint, { "line-opacity": f }), p;
      }
      t.exports = { convert: function(c) {
        var f = c[0].trace, h = f.visible === true && f._length !== 0, p = { layout: { visibility: "none" }, paint: {} }, d = { layout: { visibility: "none" }, paint: {} }, v = f._opts = { fill: p, line: d, geojson: i() };
        if (!h) return v;
        var m = l.extractTraceFeature(c);
        if (!m) return v;
        var g, x, b, y = o.makeColorScaleFuncFromTrace(f), w = f.marker, _4 = w.line || {};
        a.isArrayOrTypedArray(w.opacity) && (g = function(E2) {
          var F13 = E2.mo;
          return n(F13) ? +a.constrain(F13, 0, 1) : 0;
        }), a.isArrayOrTypedArray(_4.color) && (x = function(E2) {
          return E2.mlc;
        }), a.isArrayOrTypedArray(_4.width) && (b = function(E2) {
          return E2.mlw;
        });
        for (var k = 0; k < c.length; k++) {
          var T2 = c[k], A2 = T2.fOut;
          if (A2) {
            var S2 = A2.properties;
            S2.fc = y(T2.z), g && (S2.mo = g(T2)), x && (S2.mlc = x(T2)), b && (S2.mlw = b(T2)), T2.ct = S2.ct, T2._polygons = l.feature2polygons(A2);
          }
        }
        var C2 = g ? { type: "identity", property: "mo" } : w.opacity;
        return a.extendFlat(p.paint, { "fill-color": { type: "identity", property: "fc" }, "fill-opacity": C2 }), a.extendFlat(d.paint, { "line-color": x ? { type: "identity", property: "mlc" } : _4.color, "line-width": b ? { type: "identity", property: "mlw" } : _4.width, "line-opacity": C2 }), p.layout.visibility = "visible", d.layout.visibility = "visible", v.geojson = { type: "FeatureCollection", features: m }, u2(c), v;
      }, convertOnSelect: u2 };
    }, { "../../components/colorscale": 378, "../../components/drawing": 388, "../../lib": 503, "../../lib/geo_location_utils": 496, "../../lib/geojson_utils": 497, "fast-isnumeric": 190 }], 727: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../components/colorscale/defaults"), o = e("./attributes");
      t.exports = function(s, i, l, u2) {
        function c(d, v) {
          return n.coerce(s, i, o, d, v);
        }
        var f = c("locations"), h = c("z"), p = c("geojson");
        n.isArrayOrTypedArray(f) && f.length && n.isArrayOrTypedArray(h) && h.length && (typeof p == "string" && p !== "" || n.isPlainObject(p)) ? (c("featureidkey"), i._length = Math.min(f.length, h.length), c("below"), c("text"), c("hovertext"), c("hovertemplate"), c("marker.line.width") && c("marker.line.color"), c("marker.opacity"), a(s, i, u2, c, { prefix: "", cLetter: "z" }), n.coerceSelectionMarkerOpacity(i, c)) : i.visible = false;
      };
    }, { "../../components/colorscale/defaults": 376, "../../lib": 503, "./attributes": 725 }], 728: [function(e, t, r) {
      "use strict";
      t.exports = { attributes: e("./attributes"), supplyDefaults: e("./defaults"), colorbar: e("../heatmap/colorbar"), calc: e("../choropleth/calc"), plot: e("./plot"), hoverPoints: e("../choropleth/hover"), eventData: e("../choropleth/event_data"), selectPoints: e("../choropleth/select"), styleOnSelect: function(n, a) {
        a && a[0].trace._glTrace.updateOnSelect(a);
      }, getBelow: function(n, a) {
        for (var o = a.getMapLayers(), s = o.length - 2; s >= 0; s--) {
          var i = o[s].id;
          if (typeof i == "string" && i.indexOf("water") === 0) {
            for (var l = s + 1; l < o.length; l++) if (typeof (i = o[l].id) == "string" && i.indexOf("plotly-") === -1) return i;
          }
        }
      }, moduleType: "trace", name: "choroplethmapbox", basePlotModule: e("../../plots/mapbox"), categories: ["mapbox", "gl", "noOpacity", "showLegend"], meta: { hr_name: "choropleth_mapbox" } };
    }, { "../../plots/mapbox": 613, "../choropleth/calc": 717, "../choropleth/event_data": 719, "../choropleth/hover": 720, "../choropleth/select": 723, "../heatmap/colorbar": 795, "./attributes": 725, "./defaults": 727, "./plot": 729 }], 729: [function(e, t, r) {
      "use strict";
      var n = e("./convert").convert, a = e("./convert").convertOnSelect, o = e("../../plots/mapbox/constants").traceLayerPrefix;
      function s(l, u2) {
        this.type = "choroplethmapbox", this.subplot = l, this.uid = u2, this.sourceId = "source-" + u2, this.layerList = [["fill", o + u2 + "-fill"], ["line", o + u2 + "-line"]], this.below = null;
      }
      var i = s.prototype;
      i.update = function(l) {
        this._update(n(l));
      }, i.updateOnSelect = function(l) {
        this._update(a(l));
      }, i._update = function(l) {
        var u2 = this.subplot, c = this.layerList, f = u2.belowLookup["trace-" + this.uid];
        u2.map.getSource(this.sourceId).setData(l.geojson), f !== this.below && (this._removeLayers(), this._addLayers(l, f), this.below = f);
        for (var h = 0; h < c.length; h++) {
          var p = c[h], d = p[0], v = p[1], m = l[d];
          u2.setOptions(v, "setLayoutProperty", m.layout), m.layout.visibility === "visible" && u2.setOptions(v, "setPaintProperty", m.paint);
        }
      }, i._addLayers = function(l, u2) {
        for (var c = this.subplot, f = this.layerList, h = this.sourceId, p = 0; p < f.length; p++) {
          var d = f[p], v = d[0], m = l[v];
          c.addLayer({ type: v, id: d[1], source: h, layout: m.layout, paint: m.paint }, u2);
        }
      }, i._removeLayers = function() {
        for (var l = this.subplot.map, u2 = this.layerList, c = u2.length - 1; c >= 0; c--) l.removeLayer(u2[c][1]);
      }, i.dispose = function() {
        var l = this.subplot.map;
        this._removeLayers(), l.removeSource(this.sourceId);
      }, t.exports = function(l, u2) {
        var c = u2[0].trace, f = new s(l, c.uid), h = f.sourceId, p = n(u2), d = f.below = l.belowLookup["trace-" + c.uid];
        return l.map.addSource(h, { type: "geojson", data: p.geojson }), f._addLayers(p, d), u2[0].trace._glTrace = f, f;
      };
    }, { "../../plots/mapbox/constants": 611, "./convert": 726 }], 730: [function(e, t, r) {
      "use strict";
      var n = e("../../components/colorscale/attributes"), a = e("../../plots/cartesian/axis_format_attributes").axisHoverFormat, o = e("../../plots/template_attributes").hovertemplateAttrs, s = e("../mesh3d/attributes"), i = e("../../plots/attributes"), l = e("../../lib/extend").extendFlat, u2 = { x: { valType: "data_array", editType: "calc+clearAxisTypes" }, y: { valType: "data_array", editType: "calc+clearAxisTypes" }, z: { valType: "data_array", editType: "calc+clearAxisTypes" }, u: { valType: "data_array", editType: "calc" }, v: { valType: "data_array", editType: "calc" }, w: { valType: "data_array", editType: "calc" }, sizemode: { valType: "enumerated", values: ["scaled", "absolute"], editType: "calc", dflt: "scaled" }, sizeref: { valType: "number", editType: "calc", min: 0 }, anchor: { valType: "enumerated", editType: "calc", values: ["tip", "tail", "cm", "center"], dflt: "cm" }, text: { valType: "string", dflt: "", arrayOk: true, editType: "calc" }, hovertext: { valType: "string", dflt: "", arrayOk: true, editType: "calc" }, hovertemplate: o({ editType: "calc" }, { keys: ["norm"] }), uhoverformat: a("u", 1), vhoverformat: a("v", 1), whoverformat: a("w", 1), xhoverformat: a("x"), yhoverformat: a("y"), zhoverformat: a("z"), showlegend: l({}, i.showlegend, { dflt: false }) };
      l(u2, n("", { colorAttr: "u/v/w norm", showScaleDflt: true, editTypeOverride: "calc" })), ["opacity", "lightposition", "lighting"].forEach(function(c) {
        u2[c] = s[c];
      }), u2.hoverinfo = l({}, i.hoverinfo, { editType: "calc", flags: ["x", "y", "z", "u", "v", "w", "norm", "text", "name"], dflt: "x+y+z+norm+text+name" }), u2.transforms = void 0, t.exports = u2;
    }, { "../../components/colorscale/attributes": 373, "../../lib/extend": 493, "../../plots/attributes": 550, "../../plots/cartesian/axis_format_attributes": 557, "../../plots/template_attributes": 633, "../mesh3d/attributes": 867 }], 731: [function(e, t, r) {
      "use strict";
      var n = e("../../components/colorscale/calc");
      t.exports = function(a, o) {
        for (var s = o.u, i = o.v, l = o.w, u2 = Math.min(o.x.length, o.y.length, o.z.length, s.length, i.length, l.length), c = -1 / 0, f = 1 / 0, h = 0; h < u2; h++) {
          var p = s[h], d = i[h], v = l[h], m = Math.sqrt(p * p + d * d + v * v);
          c = Math.max(c, m), f = Math.min(f, m);
        }
        o._len = u2, o._normMax = c, n(a, o, { vals: [f, c], containerStr: "", cLetter: "c" });
      };
    }, { "../../components/colorscale/calc": 374 }], 732: [function(e, t, r) {
      "use strict";
      var n = e("../../../stackgl_modules").gl_cone3d, a = e("../../../stackgl_modules").gl_cone3d.createConeMesh, o = e("../../lib").simpleMap, s = e("../../lib/gl_format_color").parseColorScale, i = e("../../components/colorscale").extractOpts, l = e("../../plots/gl3d/zip3");
      function u2(v, m) {
        this.scene = v, this.uid = m, this.mesh = null, this.data = null;
      }
      var c = u2.prototype;
      c.handlePick = function(v) {
        if (v.object === this.mesh) {
          var m = v.index = v.data.index, g = this.data.x[m], x = this.data.y[m], b = this.data.z[m], y = this.data.u[m], w = this.data.v[m], _4 = this.data.w[m];
          v.traceCoordinate = [g, x, b, y, w, _4, Math.sqrt(y * y + w * w + _4 * _4)];
          var k = this.data.hovertext || this.data.text;
          return Array.isArray(k) && k[m] !== void 0 ? v.textLabel = k[m] : k && (v.textLabel = k), true;
        }
      };
      var f = { xaxis: 0, yaxis: 1, zaxis: 2 }, h = { tip: 1, tail: 0, cm: 0.25, center: 0.5 }, p = { tip: 1, tail: 1, cm: 0.75, center: 0.5 };
      function d(v, m) {
        var g = v.fullSceneLayout, x = v.dataScale, b = {};
        function y(T2, A2) {
          var S2 = g[A2], C2 = x[f[A2]];
          return o(T2, function(E2) {
            return S2.d2l(E2) * C2;
          });
        }
        b.vectors = l(y(m.u, "xaxis"), y(m.v, "yaxis"), y(m.w, "zaxis"), m._len), b.positions = l(y(m.x, "xaxis"), y(m.y, "yaxis"), y(m.z, "zaxis"), m._len);
        var w = i(m);
        b.colormap = s(m), b.vertexIntensityBounds = [w.min / m._normMax, w.max / m._normMax], b.coneOffset = h[m.anchor], m.sizemode === "scaled" ? b.coneSize = m.sizeref || 0.5 : b.coneSize = m.sizeref && m._normMax ? m.sizeref / m._normMax : 0.5;
        var _4 = n(b), k = m.lightposition;
        return _4.lightPosition = [k.x, k.y, k.z], _4.ambient = m.lighting.ambient, _4.diffuse = m.lighting.diffuse, _4.specular = m.lighting.specular, _4.roughness = m.lighting.roughness, _4.fresnel = m.lighting.fresnel, _4.opacity = m.opacity, m._pad = p[m.anchor] * _4.vectorScale * _4.coneScale * m._normMax, _4;
      }
      c.update = function(v) {
        this.data = v;
        var m = d(this.scene, v);
        this.mesh.update(m);
      }, c.dispose = function() {
        this.scene.glplot.remove(this.mesh), this.mesh.dispose();
      }, t.exports = function(v, m) {
        var g = v.glplot.gl, x = d(v, m), b = a(g, x), y = new u2(v, m.uid);
        return y.mesh = b, y.data = m, b._trace = y, v.glplot.add(b), y;
      };
    }, { "../../../stackgl_modules": 1120, "../../components/colorscale": 378, "../../lib": 503, "../../lib/gl_format_color": 499, "../../plots/gl3d/zip3": 609 }], 733: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../components/colorscale/defaults"), o = e("./attributes");
      t.exports = function(s, i, l, u2) {
        function c(g, x) {
          return n.coerce(s, i, o, g, x);
        }
        var f = c("u"), h = c("v"), p = c("w"), d = c("x"), v = c("y"), m = c("z");
        f && f.length && h && h.length && p && p.length && d && d.length && v && v.length && m && m.length ? (c("sizeref"), c("sizemode"), c("anchor"), c("lighting.ambient"), c("lighting.diffuse"), c("lighting.specular"), c("lighting.roughness"), c("lighting.fresnel"), c("lightposition.x"), c("lightposition.y"), c("lightposition.z"), a(s, i, u2, c, { prefix: "", cLetter: "c" }), c("text"), c("hovertext"), c("hovertemplate"), c("uhoverformat"), c("vhoverformat"), c("whoverformat"), c("xhoverformat"), c("yhoverformat"), c("zhoverformat"), i._length = null) : i.visible = false;
      };
    }, { "../../components/colorscale/defaults": 376, "../../lib": 503, "./attributes": 730 }], 734: [function(e, t, r) {
      "use strict";
      t.exports = { moduleType: "trace", name: "cone", basePlotModule: e("../../plots/gl3d"), categories: ["gl3d", "showLegend"], attributes: e("./attributes"), supplyDefaults: e("./defaults"), colorbar: { min: "cmin", max: "cmax" }, calc: e("./calc"), plot: e("./convert"), eventData: function(n, a) {
        return n.norm = a.traceCoordinate[6], n;
      }, meta: {} };
    }, { "../../plots/gl3d": 598, "./attributes": 730, "./calc": 731, "./convert": 732, "./defaults": 733 }], 735: [function(e, t, r) {
      "use strict";
      var n = e("../heatmap/attributes"), a = e("../scatter/attributes"), o = e("../../plots/cartesian/axis_format_attributes"), s = o.axisHoverFormat, i = o.descriptionOnlyNumbers, l = e("../../components/colorscale/attributes"), u2 = e("../../components/drawing/attributes").dash, c = e("../../plots/font_attributes"), f = e("../../lib/extend").extendFlat, h = e("../../constants/filter_ops"), p = h.COMPARISON_OPS2, d = h.INTERVAL_OPS, v = a.line;
      t.exports = f({ z: n.z, x: n.x, x0: n.x0, dx: n.dx, y: n.y, y0: n.y0, dy: n.dy, xperiod: n.xperiod, yperiod: n.yperiod, xperiod0: a.xperiod0, yperiod0: a.yperiod0, xperiodalignment: n.xperiodalignment, yperiodalignment: n.yperiodalignment, text: n.text, hovertext: n.hovertext, transpose: n.transpose, xtype: n.xtype, ytype: n.ytype, xhoverformat: s("x"), yhoverformat: s("y"), zhoverformat: s("z", 1), hovertemplate: n.hovertemplate, texttemplate: f({}, n.texttemplate, {}), textfont: f({}, n.textfont, {}), hoverongaps: n.hoverongaps, connectgaps: f({}, n.connectgaps, {}), fillcolor: { valType: "color", editType: "calc" }, autocontour: { valType: "boolean", dflt: true, editType: "calc", impliedEdits: { "contours.start": void 0, "contours.end": void 0, "contours.size": void 0 } }, ncontours: { valType: "integer", dflt: 15, min: 1, editType: "calc" }, contours: { type: { valType: "enumerated", values: ["levels", "constraint"], dflt: "levels", editType: "calc" }, start: { valType: "number", dflt: null, editType: "plot", impliedEdits: { "^autocontour": false } }, end: { valType: "number", dflt: null, editType: "plot", impliedEdits: { "^autocontour": false } }, size: { valType: "number", dflt: null, min: 0, editType: "plot", impliedEdits: { "^autocontour": false } }, coloring: { valType: "enumerated", values: ["fill", "heatmap", "lines", "none"], dflt: "fill", editType: "calc" }, showlines: { valType: "boolean", dflt: true, editType: "plot" }, showlabels: { valType: "boolean", dflt: false, editType: "plot" }, labelfont: c({ editType: "plot", colorEditType: "style" }), labelformat: { valType: "string", dflt: "", editType: "plot", description: i("contour label") }, operation: { valType: "enumerated", values: [].concat(p).concat(d), dflt: "=", editType: "calc" }, value: { valType: "any", dflt: 0, editType: "calc" }, editType: "calc", impliedEdits: { autocontour: false } }, line: { color: f({}, v.color, { editType: "style+colorbars" }), width: { valType: "number", min: 0, editType: "style+colorbars" }, dash: u2, smoothing: f({}, v.smoothing, {}), editType: "plot" } }, l("", { cLetter: "z", autoColorDflt: false, editTypeOverride: "calc" }));
    }, { "../../components/colorscale/attributes": 373, "../../components/drawing/attributes": 387, "../../constants/filter_ops": 475, "../../lib/extend": 493, "../../plots/cartesian/axis_format_attributes": 557, "../../plots/font_attributes": 585, "../heatmap/attributes": 792, "../scatter/attributes": 926 }], 736: [function(e, t, r) {
      "use strict";
      var n = e("../../components/colorscale"), a = e("../heatmap/calc"), o = e("./set_contours"), s = e("./end_plus");
      t.exports = function(i, l) {
        var u2 = a(i, l), c = u2[0].z;
        o(l, c);
        var f, h = l.contours, p = n.extractOpts(l);
        if (h.coloring === "heatmap" && p.auto && l.autocontour === false) {
          var d = h.start, v = s(h), m = h.size || 1, g = Math.floor((v - d) / m) + 1;
          isFinite(m) || (m = 1, g = 1);
          var x = d - m / 2;
          f = [x, x + g * m];
        } else f = c;
        return n.calc(i, l, { vals: f, cLetter: "z" }), u2;
      };
    }, { "../../components/colorscale": 378, "../heatmap/calc": 793, "./end_plus": 746, "./set_contours": 754 }], 737: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a) {
        var o, s = n[0], i = s.z;
        switch (a.type) {
          case "levels":
            var l = Math.min(i[0][0], i[0][1]);
            for (o = 0; o < n.length; o++) {
              var u2 = n[o];
              u2.prefixBoundary = !u2.edgepaths.length && (l > u2.level || u2.starts.length && l === u2.level);
            }
            break;
          case "constraint":
            if (s.prefixBoundary = false, s.edgepaths.length) return;
            var c = s.x.length, f = s.y.length, h = -1 / 0, p = 1 / 0;
            for (o = 0; o < f; o++) p = Math.min(p, i[o][0]), p = Math.min(p, i[o][c - 1]), h = Math.max(h, i[o][0]), h = Math.max(h, i[o][c - 1]);
            for (o = 1; o < c - 1; o++) p = Math.min(p, i[0][o]), p = Math.min(p, i[f - 1][o]), h = Math.max(h, i[0][o]), h = Math.max(h, i[f - 1][o]);
            var d, v, m = a.value;
            switch (a._operation) {
              case ">":
                m > h && (s.prefixBoundary = true);
                break;
              case "<":
                (m < p || s.starts.length && m === p) && (s.prefixBoundary = true);
                break;
              case "[]":
                d = Math.min(m[0], m[1]), ((v = Math.max(m[0], m[1])) < p || d > h || s.starts.length && v === p) && (s.prefixBoundary = true);
                break;
              case "][":
                d = Math.min(m[0], m[1]), v = Math.max(m[0], m[1]), d < p && v > h && (s.prefixBoundary = true);
            }
        }
      };
    }, {}], 738: [function(e, t, r) {
      "use strict";
      var n = e("../../components/colorscale"), a = e("./make_color_map"), o = e("./end_plus");
      t.exports = { min: "zmin", max: "zmax", calc: function(s, i, l) {
        var u2 = i.contours, c = i.line, f = u2.size || 1, h = u2.coloring, p = a(i, { isColorbar: true });
        if (h === "heatmap") {
          var d = n.extractOpts(i);
          l._fillgradient = d.reversescale ? n.flipScale(d.colorscale) : d.colorscale, l._zrange = [d.min, d.max];
        } else h === "fill" && (l._fillcolor = p);
        l._line = { color: h === "lines" ? p : c.color, width: u2.showlines !== false ? c.width : 0, dash: c.dash }, l._levels = { start: u2.start, end: o(u2), size: f };
      } };
    }, { "../../components/colorscale": 378, "./end_plus": 746, "./make_color_map": 751 }], 739: [function(e, t, r) {
      "use strict";
      t.exports = { BOTTOMSTART: [1, 9, 13, 104, 713], TOPSTART: [4, 6, 7, 104, 713], LEFTSTART: [8, 12, 14, 208, 1114], RIGHTSTART: [2, 3, 11, 208, 1114], NEWDELTA: [null, [-1, 0], [0, -1], [-1, 0], [1, 0], null, [0, -1], [-1, 0], [0, 1], [0, 1], null, [0, 1], [1, 0], [1, 0], [0, -1]], CHOOSESADDLE: { 104: [4, 1], 208: [2, 8], 713: [7, 13], 1114: [11, 14] }, SADDLEREMAINDER: { 1: 4, 2: 8, 4: 1, 7: 13, 8: 2, 11: 14, 13: 7, 14: 11 }, LABELDISTANCE: 2, LABELINCREASE: 10, LABELMIN: 3, LABELMAX: 10, LABELOPTIMIZER: { EDGECOST: 1, ANGLECOST: 1, NEIGHBORCOST: 5, SAMELEVELFACTOR: 10, SAMELEVELDISTANCE: 5, MAXCOST: 100, INITIALSEARCHPOINTS: 10, ITERATIONS: 5 } };
    }, {}], 740: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("./label_defaults"), o = e("../../components/color"), s = o.addOpacity, i = o.opacity, l = e("../../constants/filter_ops"), u2 = l.CONSTRAINT_REDUCTION, c = l.COMPARISON_OPS2;
      t.exports = function(f, h, p, d, v, m) {
        var g, x, b, y = h.contours, w = p("contours.operation");
        y._operation = u2[w], function(_4, k) {
          var T2;
          c.indexOf(k.operation) === -1 ? (_4("contours.value", [0, 1]), Array.isArray(k.value) ? k.value.length > 2 ? k.value = k.value.slice(2) : k.length === 0 ? k.value = [0, 1] : k.length < 2 ? (T2 = parseFloat(k.value[0]), k.value = [T2, T2 + 1]) : k.value = [parseFloat(k.value[0]), parseFloat(k.value[1])] : n(k.value) && (T2 = parseFloat(k.value), k.value = [T2, T2 + 1])) : (_4("contours.value", 0), n(k.value) || (Array.isArray(k.value) ? k.value = parseFloat(k.value[0]) : k.value = 0));
        }(p, y), w === "=" ? g = y.showlines = true : (g = p("contours.showlines"), b = p("fillcolor", s((f.line || {}).color || v, 0.5))), g && (x = p("line.color", b && i(b) ? s(h.fillcolor, 1) : v), p("line.width", 2), p("line.dash")), p("line.smoothing"), a(p, d, x, m);
      };
    }, { "../../components/color": 366, "../../constants/filter_ops": 475, "./label_defaults": 750, "fast-isnumeric": 190 }], 741: [function(e, t, r) {
      "use strict";
      var n = e("../../constants/filter_ops"), a = e("fast-isnumeric");
      function o(l, u2) {
        var c, f = Array.isArray(u2);
        function h(p) {
          return a(p) ? +p : null;
        }
        return n.COMPARISON_OPS2.indexOf(l) !== -1 ? c = h(f ? u2[0] : u2) : n.INTERVAL_OPS.indexOf(l) !== -1 ? c = f ? [h(u2[0]), h(u2[1])] : [h(u2), h(u2)] : n.SET_OPS.indexOf(l) !== -1 && (c = f ? u2.map(h) : [h(u2)]), c;
      }
      function s(l) {
        return function(u2) {
          u2 = o(l, u2);
          var c = Math.min(u2[0], u2[1]), f = Math.max(u2[0], u2[1]);
          return { start: c, end: f, size: f - c };
        };
      }
      function i(l) {
        return function(u2) {
          return { start: u2 = o(l, u2), end: 1 / 0, size: 1 / 0 };
        };
      }
      t.exports = { "[]": s("[]"), "][": s("]["), ">": i(">"), "<": i("<"), "=": i("=") };
    }, { "../../constants/filter_ops": 475, "fast-isnumeric": 190 }], 742: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a, o, s) {
        var i = s("contours.start"), l = s("contours.end"), u2 = i === false || l === false, c = o("contours.size");
        !(u2 ? a.autocontour = true : o("autocontour", false)) && c || o("ncontours");
      };
    }, {}], 743: [function(e, t, r) {
      "use strict";
      var n = e("../../lib");
      function a(o) {
        return n.extendFlat({}, o, { edgepaths: n.extendDeep([], o.edgepaths), paths: n.extendDeep([], o.paths), starts: n.extendDeep([], o.starts) });
      }
      t.exports = function(o, s) {
        var i, l, u2, c = function(p) {
          return p.reverse();
        }, f = function(p) {
          return p;
        };
        switch (s) {
          case "=":
          case "<":
            return o;
          case ">":
            for (o.length !== 1 && n.warn("Contour data invalid for the specified inequality operation."), l = o[0], i = 0; i < l.edgepaths.length; i++) l.edgepaths[i] = c(l.edgepaths[i]);
            for (i = 0; i < l.paths.length; i++) l.paths[i] = c(l.paths[i]);
            for (i = 0; i < l.starts.length; i++) l.starts[i] = c(l.starts[i]);
            return o;
          case "][":
            var h = c;
            c = f, f = h;
          case "[]":
            for (o.length !== 2 && n.warn("Contour data invalid for the specified inequality range operation."), l = a(o[0]), u2 = a(o[1]), i = 0; i < l.edgepaths.length; i++) l.edgepaths[i] = c(l.edgepaths[i]);
            for (i = 0; i < l.paths.length; i++) l.paths[i] = c(l.paths[i]);
            for (i = 0; i < l.starts.length; i++) l.starts[i] = c(l.starts[i]);
            for (; u2.edgepaths.length; ) l.edgepaths.push(f(u2.edgepaths.shift()));
            for (; u2.paths.length; ) l.paths.push(f(u2.paths.shift()));
            for (; u2.starts.length; ) l.starts.push(f(u2.starts.shift()));
            return [l];
        }
      };
    }, { "../../lib": 503 }], 744: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../heatmap/xyz_defaults"), o = e("../scatter/period_defaults"), s = e("./constraint_defaults"), i = e("./contours_defaults"), l = e("./style_defaults"), u2 = e("../heatmap/label_defaults"), c = e("./attributes");
      t.exports = function(f, h, p, d) {
        function v(g, x) {
          return n.coerce(f, h, c, g, x);
        }
        if (a(f, h, v, d)) {
          o(f, h, d, v), v("xhoverformat"), v("yhoverformat"), v("text"), v("hovertext"), v("hoverongaps"), v("hovertemplate");
          var m = v("contours.type") === "constraint";
          v("connectgaps", n.isArray1D(h.z)), m ? s(f, h, v, d, p) : (i(f, h, v, function(g) {
            return n.coerce2(f, h, c, g);
          }), l(f, h, v, d)), h.contours && h.contours.coloring === "heatmap" && u2(v, d);
        } else h.visible = false;
      };
    }, { "../../lib": 503, "../heatmap/label_defaults": 802, "../heatmap/xyz_defaults": 807, "../scatter/period_defaults": 946, "./attributes": 735, "./constraint_defaults": 740, "./contours_defaults": 742, "./style_defaults": 756 }], 745: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("./constraint_mapping"), o = e("./end_plus");
      t.exports = function(s, i, l) {
        for (var u2 = s.type === "constraint" ? a[s._operation](s.value) : s, c = u2.size, f = [], h = o(u2), p = l.trace._carpetTrace, d = p ? { xaxis: p.aaxis, yaxis: p.baxis, x: l.a, y: l.b } : { xaxis: i.xaxis, yaxis: i.yaxis, x: l.x, y: l.y }, v = u2.start; v < h; v += c) if (f.push(n.extendFlat({ level: v, crossings: {}, starts: [], edgepaths: [], paths: [], z: l.z, smoothing: l.trace.line.smoothing }, d)), f.length > 1e3) {
          n.warn("Too many contours, clipping at 1000", s);
          break;
        }
        return f;
      };
    }, { "../../lib": 503, "./constraint_mapping": 741, "./end_plus": 746 }], 746: [function(e, t, r) {
      "use strict";
      t.exports = function(n) {
        return n.end + n.size / 1e6;
      };
    }, {}], 747: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("./constants");
      function o(l, u2, c, f) {
        return Math.abs(l[0] - u2[0]) < c && Math.abs(l[1] - u2[1]) < f;
      }
      function s(l, u2, c, f, h) {
        var p, d = u2.join(","), v = l.crossings[d], m = function(Q2, Z2, ne) {
          var ae = 0, ue = 0;
          return Q2 > 20 && Z2 ? Q2 === 208 || Q2 === 1114 ? ae = ne[0] === 0 ? 1 : -1 : ue = ne[1] === 0 ? 1 : -1 : a.BOTTOMSTART.indexOf(Q2) !== -1 ? ue = 1 : a.LEFTSTART.indexOf(Q2) !== -1 ? ae = 1 : a.TOPSTART.indexOf(Q2) !== -1 ? ue = -1 : ae = -1, [ae, ue];
        }(v, c, u2), g = [i(l, u2, [-m[0], -m[1]])], x = l.z.length, b = l.z[0].length, y = u2.slice(), w = m.slice();
        for (p = 0; p < 1e4; p++) {
          if (v > 20 ? (v = a.CHOOSESADDLE[v][(m[0] || m[1]) < 0 ? 0 : 1], l.crossings[d] = a.SADDLEREMAINDER[v]) : delete l.crossings[d], !(m = a.NEWDELTA[v])) {
            n.log("Found bad marching index:", v, u2, l.level);
            break;
          }
          g.push(i(l, u2, m)), u2[0] += m[0], u2[1] += m[1], d = u2.join(","), o(g[g.length - 1], g[g.length - 2], f, h) && g.pop();
          var _4 = m[0] && (u2[0] < 0 || u2[0] > b - 2) || m[1] && (u2[1] < 0 || u2[1] > x - 2);
          if (u2[0] === y[0] && u2[1] === y[1] && m[0] === w[0] && m[1] === w[1] || c && _4) break;
          v = l.crossings[d];
        }
        p === 1e4 && n.log("Infinite loop in contour?");
        var k, T2, A2, S2, C2, E2, F13, N2, D2, I2, O2, L2, V2, W2, X2, Y2 = o(g[0], g[g.length - 1], f, h), K2 = 0, q = 0.2 * l.smoothing, re = [], R2 = 0;
        for (p = 1; p < g.length; p++) L2 = g[p], V2 = g[p - 1], W2 = void 0, X2 = void 0, W2 = L2[2] - V2[2], X2 = L2[3] - V2[3], K2 += F13 = Math.sqrt(W2 * W2 + X2 * X2), re.push(F13);
        var z = K2 / re.length * q;
        function H2(Q2) {
          return g[Q2 % g.length];
        }
        for (p = g.length - 2; p >= R2; p--) if ((k = re[p]) < z) {
          for (A2 = 0, T2 = p - 1; T2 >= R2 && k + re[T2] < z; T2--) k += re[T2];
          if (Y2 && p === g.length - 2) for (A2 = 0; A2 < T2 && k + re[A2] < z; A2++) k += re[A2];
          C2 = p - T2 + A2 + 1, E2 = Math.floor((p + T2 + A2 + 2) / 2), S2 = Y2 || p !== g.length - 2 ? Y2 || T2 !== -1 ? C2 % 2 ? H2(E2) : [(H2(E2)[0] + H2(E2 + 1)[0]) / 2, (H2(E2)[1] + H2(E2 + 1)[1]) / 2] : g[0] : g[g.length - 1], g.splice(T2 + 1, p - T2 + 1, S2), p = T2 + 1, A2 && (R2 = A2), Y2 && (p === g.length - 2 ? g[A2] = g[g.length - 1] : p === 0 && (g[g.length - 1] = g[0]));
        }
        for (g.splice(0, R2), p = 0; p < g.length; p++) g[p].length = 2;
        if (!(g.length < 2)) if (Y2) g.pop(), l.paths.push(g);
        else {
          c || n.log("Unclosed interior contour?", l.level, y.join(","), g.join("L"));
          var te = false;
          for (N2 = 0; N2 < l.edgepaths.length; N2++) if (I2 = l.edgepaths[N2], !te && o(I2[0], g[g.length - 1], f, h)) {
            g.pop(), te = true;
            var j = false;
            for (D2 = 0; D2 < l.edgepaths.length; D2++) if (o((O2 = l.edgepaths[D2])[O2.length - 1], g[0], f, h)) {
              j = true, g.shift(), l.edgepaths.splice(N2, 1), D2 === N2 ? l.paths.push(g.concat(O2)) : (D2 > N2 && D2--, l.edgepaths[D2] = O2.concat(g, I2));
              break;
            }
            j || (l.edgepaths[N2] = g.concat(I2));
          }
          for (N2 = 0; N2 < l.edgepaths.length && !te; N2++) o((I2 = l.edgepaths[N2])[I2.length - 1], g[0], f, h) && (g.shift(), l.edgepaths[N2] = I2.concat(g), te = true);
          te || l.edgepaths.push(g);
        }
      }
      function i(l, u2, c) {
        var f = u2[0] + Math.max(c[0], 0), h = u2[1] + Math.max(c[1], 0), p = l.z[h][f], d = l.xaxis, v = l.yaxis;
        if (c[1]) {
          var m = (l.level - p) / (l.z[h][f + 1] - p), g = (m !== 1 ? (1 - m) * d.c2l(l.x[f]) : 0) + (m !== 0 ? m * d.c2l(l.x[f + 1]) : 0);
          return [d.c2p(d.l2c(g), true), v.c2p(l.y[h], true), f + m, h];
        }
        var x = (l.level - p) / (l.z[h + 1][f] - p), b = (x !== 1 ? (1 - x) * v.c2l(l.y[h]) : 0) + (x !== 0 ? x * v.c2l(l.y[h + 1]) : 0);
        return [d.c2p(l.x[f], true), v.c2p(v.l2c(b), true), f, h + x];
      }
      t.exports = function(l, u2, c) {
        var f, h, p, d;
        for (u2 = u2 || 0.01, c = c || 0.01, h = 0; h < l.length; h++) {
          for (p = l[h], d = 0; d < p.starts.length; d++) s(p, p.starts[d], "edge", u2, c);
          for (f = 0; Object.keys(p.crossings).length && f < 1e4; ) f++, s(p, Object.keys(p.crossings)[0].split(",").map(Number), void 0, u2, c);
          f === 1e4 && n.log("Infinite loop in contour?");
        }
      };
    }, { "../../lib": 503, "./constants": 739 }], 748: [function(e, t, r) {
      "use strict";
      var n = e("../../components/color"), a = e("../heatmap/hover");
      t.exports = function(o, s, i, l, u2) {
        u2 || (u2 = {}), u2.isContour = true;
        var c = a(o, s, i, l, u2);
        return c && c.forEach(function(f) {
          var h = f.trace;
          h.contours.type === "constraint" && (h.fillcolor && n.opacity(h.fillcolor) ? f.color = n.addOpacity(h.fillcolor, 1) : h.contours.showlines && n.opacity(h.line.color) && (f.color = n.addOpacity(h.line.color, 1)));
        }), c;
      };
    }, { "../../components/color": 366, "../heatmap/hover": 799 }], 749: [function(e, t, r) {
      "use strict";
      t.exports = { attributes: e("./attributes"), supplyDefaults: e("./defaults"), calc: e("./calc"), plot: e("./plot").plot, style: e("./style"), colorbar: e("./colorbar"), hoverPoints: e("./hover"), moduleType: "trace", name: "contour", basePlotModule: e("../../plots/cartesian"), categories: ["cartesian", "svg", "2dMap", "contour", "showLegend"], meta: {} };
    }, { "../../plots/cartesian": 568, "./attributes": 735, "./calc": 736, "./colorbar": 738, "./defaults": 744, "./hover": 748, "./plot": 753, "./style": 755 }], 750: [function(e, t, r) {
      "use strict";
      var n = e("../../lib");
      t.exports = function(a, o, s, i) {
        if (i || (i = {}), a("contours.showlabels")) {
          var l = o.font;
          n.coerceFont(a, "contours.labelfont", { family: l.family, size: l.size, color: s }), a("contours.labelformat");
        }
        i.hasHover !== false && a("zhoverformat");
      };
    }, { "../../lib": 503 }], 751: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../components/colorscale"), o = e("./end_plus");
      t.exports = function(s) {
        var i = s.contours, l = i.start, u2 = o(i), c = i.size || 1, f = Math.floor((u2 - l) / c) + 1, h = i.coloring === "lines" ? 0 : 1, p = a.extractOpts(s);
        isFinite(c) || (c = 1, f = 1);
        var d, v, m = p.reversescale ? a.flipScale(p.colorscale) : p.colorscale, g = m.length, x = new Array(g), b = new Array(g);
        if (i.coloring === "heatmap") {
          var y = p.min, w = p.max;
          for (v = 0; v < g; v++) d = m[v], x[v] = d[0] * (w - y) + y, b[v] = d[1];
          var _4 = n.extent([y, w, i.start, i.start + c * (f - 1)]), k = _4[y < w ? 0 : 1], T2 = _4[y < w ? 1 : 0];
          k !== y && (x.splice(0, 0, k), b.splice(0, 0, b[0])), T2 !== w && (x.push(T2), b.push(b[b.length - 1]));
        } else for (v = 0; v < g; v++) d = m[v], x[v] = (d[0] * (f + h - 1) - h / 2) * c + l, b[v] = d[1];
        return a.makeColorScaleFunc({ domain: x, range: b }, { noNumericCheck: true });
      };
    }, { "../../components/colorscale": 378, "./end_plus": 746, "@plotly/d3": 58 }], 752: [function(e, t, r) {
      "use strict";
      var n = e("./constants");
      function a(o, s) {
        var i = (s[0][0] > o ? 0 : 1) + (s[0][1] > o ? 0 : 2) + (s[1][1] > o ? 0 : 4) + (s[1][0] > o ? 0 : 8);
        return i === 5 || i === 10 ? o > (s[0][0] + s[0][1] + s[1][0] + s[1][1]) / 4 ? i === 5 ? 713 : 1114 : i === 5 ? 104 : 208 : i === 15 ? 0 : i;
      }
      t.exports = function(o) {
        var s, i, l, u2, c, f, h, p, d, v = o[0].z, m = v.length, g = v[0].length, x = m === 2 || g === 2;
        for (i = 0; i < m - 1; i++) for (u2 = [], i === 0 && (u2 = u2.concat(n.BOTTOMSTART)), i === m - 2 && (u2 = u2.concat(n.TOPSTART)), s = 0; s < g - 1; s++) for (l = u2.slice(), s === 0 && (l = l.concat(n.LEFTSTART)), s === g - 2 && (l = l.concat(n.RIGHTSTART)), c = s + "," + i, f = [[v[i][s], v[i][s + 1]], [v[i + 1][s], v[i + 1][s + 1]]], d = 0; d < o.length; d++) (h = a((p = o[d]).level, f)) && (p.crossings[c] = h, l.indexOf(h) !== -1 && (p.starts.push([s, i]), x && l.indexOf(h, l.indexOf(h) + 1) !== -1 && p.starts.push([s, i])));
      };
    }, { "./constants": 739 }], 753: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../lib"), o = e("../../components/drawing"), s = e("../../components/colorscale"), i = e("../../lib/svg_text_utils"), l = e("../../plots/cartesian/axes"), u2 = e("../../plots/cartesian/set_convert"), c = e("../heatmap/plot"), f = e("./make_crossings"), h = e("./find_all_paths"), p = e("./empty_pathinfo"), d = e("./convert_to_constraints"), v = e("./close_boundaries"), m = e("./constants"), g = m.LABELOPTIMIZER;
      function x(w, _4) {
        var k, T2, A2, S2, C2, E2, F13, N2 = "", D2 = 0, I2 = w.edgepaths.map(function(Y2, K2) {
          return K2;
        }), O2 = true;
        function L2(Y2) {
          return Math.abs(Y2[1] - _4[2][1]) < 0.01;
        }
        function V2(Y2) {
          return Math.abs(Y2[0] - _4[0][0]) < 0.01;
        }
        function W2(Y2) {
          return Math.abs(Y2[0] - _4[2][0]) < 0.01;
        }
        for (; I2.length; ) {
          for (E2 = o.smoothopen(w.edgepaths[D2], w.smoothing), N2 += O2 ? E2 : E2.replace(/^M/, "L"), I2.splice(I2.indexOf(D2), 1), k = w.edgepaths[D2][w.edgepaths[D2].length - 1], S2 = -1, A2 = 0; A2 < 4; A2++) {
            if (!k) {
              a.log("Missing end?", D2, w);
              break;
            }
            for (F13 = k, Math.abs(F13[1] - _4[0][1]) < 0.01 && !W2(k) ? T2 = _4[1] : V2(k) ? T2 = _4[0] : L2(k) ? T2 = _4[3] : W2(k) && (T2 = _4[2]), C2 = 0; C2 < w.edgepaths.length; C2++) {
              var X2 = w.edgepaths[C2][0];
              Math.abs(k[0] - T2[0]) < 0.01 ? Math.abs(k[0] - X2[0]) < 0.01 && (X2[1] - k[1]) * (T2[1] - X2[1]) >= 0 && (T2 = X2, S2 = C2) : Math.abs(k[1] - T2[1]) < 0.01 ? Math.abs(k[1] - X2[1]) < 0.01 && (X2[0] - k[0]) * (T2[0] - X2[0]) >= 0 && (T2 = X2, S2 = C2) : a.log("endpt to newendpt is not vert. or horz.", k, T2, X2);
            }
            if (k = T2, S2 >= 0) break;
            N2 += "L" + T2;
          }
          if (S2 === w.edgepaths.length) {
            a.log("unclosed perimeter path");
            break;
          }
          D2 = S2, (O2 = I2.indexOf(D2) === -1) && (D2 = I2[0], N2 += "Z");
        }
        for (D2 = 0; D2 < w.paths.length; D2++) N2 += o.smoothclosed(w.paths[D2], w.smoothing);
        return N2;
      }
      function b(w, _4, k, T2) {
        var A2 = _4.width / 2, S2 = _4.height / 2, C2 = w.x, E2 = w.y, F13 = w.theta, N2 = Math.cos(F13) * A2, D2 = Math.sin(F13) * A2, I2 = (C2 > T2.center ? T2.right - C2 : C2 - T2.left) / (N2 + Math.abs(Math.sin(F13) * S2)), O2 = (E2 > T2.middle ? T2.bottom - E2 : E2 - T2.top) / (Math.abs(D2) + Math.cos(F13) * S2);
        if (I2 < 1 || O2 < 1) return 1 / 0;
        var L2 = g.EDGECOST * (1 / (I2 - 1) + 1 / (O2 - 1));
        L2 += g.ANGLECOST * F13 * F13;
        for (var V2 = C2 - N2, W2 = E2 - D2, X2 = C2 + N2, Y2 = E2 + D2, K2 = 0; K2 < k.length; K2++) {
          var q = k[K2], re = Math.cos(q.theta) * q.width / 2, R2 = Math.sin(q.theta) * q.width / 2, z = 2 * a.segmentDistance(V2, W2, X2, Y2, q.x - re, q.y - R2, q.x + re, q.y + R2) / (_4.height + q.height), H2 = q.level === _4.level, te = H2 ? g.SAMELEVELDISTANCE : 1;
          if (z <= te) return 1 / 0;
          L2 += g.NEIGHBORCOST * (H2 ? g.SAMELEVELFACTOR : 1) / (z - te);
        }
        return L2;
      }
      function y(w) {
        var _4, k, T2 = w.trace._emptypoints, A2 = [], S2 = w.z.length, C2 = w.z[0].length, E2 = [];
        for (_4 = 0; _4 < C2; _4++) E2.push(1);
        for (_4 = 0; _4 < S2; _4++) A2.push(E2.slice());
        for (_4 = 0; _4 < T2.length; _4++) A2[(k = T2[_4])[0]][k[1]] = 0;
        return w.zmask = A2, A2;
      }
      r.plot = function(w, _4, k, T2) {
        var A2 = _4.xaxis, S2 = _4.yaxis;
        a.makeTraceGroups(T2, k, "contour").each(function(C2) {
          var E2 = n.select(this), F13 = C2[0], N2 = F13.trace, D2 = F13.x, I2 = F13.y, O2 = N2.contours, L2 = p(O2, _4, F13), V2 = a.ensureSingle(E2, "g", "heatmapcoloring"), W2 = [];
          O2.coloring === "heatmap" && (W2 = [C2]), c(w, _4, W2, V2), f(L2), h(L2);
          var X2 = A2.c2p(D2[0], true), Y2 = A2.c2p(D2[D2.length - 1], true), K2 = S2.c2p(I2[0], true), q = S2.c2p(I2[I2.length - 1], true), re = [[X2, q], [Y2, q], [Y2, K2], [X2, K2]], R2 = L2;
          O2.type === "constraint" && (R2 = d(L2, O2._operation)), function(z, H2, te) {
            var j = a.ensureSingle(z, "g", "contourbg").selectAll("path").data(te.coloring === "fill" ? [0] : []);
            j.enter().append("path"), j.exit().remove(), j.attr("d", "M" + H2.join("L") + "Z").style("stroke", "none");
          }(E2, re, O2), function(z, H2, te, j) {
            var Q2 = j.coloring === "fill" || j.type === "constraint" && j._operation !== "=", Z2 = "M" + te.join("L") + "Z";
            Q2 && v(H2, j);
            var ne = a.ensureSingle(z, "g", "contourfill").selectAll("path").data(Q2 ? H2 : []);
            ne.enter().append("path"), ne.exit().remove(), ne.each(function(ae) {
              var ue = (ae.prefixBoundary ? Z2 : "") + x(ae, te);
              ue ? n.select(this).attr("d", ue).style("stroke", "none") : n.select(this).remove();
            });
          }(E2, R2, re, O2), function(z, H2, te, j, Q2) {
            var Z2 = a.ensureSingle(z, "g", "contourlines"), ne = Q2.showlines !== false, ae = Q2.showlabels, ue = ne && ae, le = r.createLines(Z2, ne || ae, H2), ce = r.createLineClip(Z2, ue, te, j.trace.uid), se = z.selectAll("g.contourlabels").data(ae ? [0] : []);
            if (se.exit().remove(), se.enter().append("g").classed("contourlabels", true), ae) {
              var he = [], me = [];
              a.clearLocationCache();
              var we = r.labelFormatter(te, j), be = o.tester.append("text").attr("data-notex", 1).call(o.font, Q2.labelfont), Ae = H2[0].xaxis, pe = H2[0].yaxis, ve = Ae._length, Ee = pe._length, Se = Ae.range, Ce = pe.range, Be = a.aggNums(Math.min, null, j.x), Ue = a.aggNums(Math.max, null, j.x), Ke = a.aggNums(Math.min, null, j.y), ct = a.aggNums(Math.max, null, j.y), We = Math.max(Ae.c2p(Be, true), 0), Ze = Math.min(Ae.c2p(Ue, true), ve), it = Math.max(pe.c2p(ct, true), 0), ot = Math.min(pe.c2p(Ke, true), Ee), mt = {};
              Se[0] < Se[1] ? (mt.left = We, mt.right = Ze) : (mt.left = Ze, mt.right = We), Ce[0] < Ce[1] ? (mt.top = it, mt.bottom = ot) : (mt.top = ot, mt.bottom = it), mt.middle = (mt.top + mt.bottom) / 2, mt.center = (mt.left + mt.right) / 2, he.push([[mt.left, mt.top], [mt.right, mt.top], [mt.right, mt.bottom], [mt.left, mt.bottom]]);
              var wt = Math.sqrt(ve * ve + Ee * Ee), Et = m.LABELDISTANCE * wt / Math.max(1, H2.length / m.LABELINCREASE);
              le.each(function(zt) {
                var Nt = r.calcTextOpts(zt.level, we, be, te);
                n.select(this).selectAll("path").each(function() {
                  var yt = a.getVisibleSegment(this, mt, Nt.height / 2);
                  if (yt && !(yt.len < (Nt.width + Nt.height) * m.LABELMIN)) for (var pt = Math.min(Math.ceil(yt.len / Et), m.LABELMAX), Ot = 0; Ot < pt; Ot++) {
                    var Jt = r.findBestTextLocation(this, yt, Nt, me, mt);
                    if (!Jt) break;
                    r.addLabelData(Jt, Nt, me, he);
                  }
                });
              }), be.remove(), r.drawLabels(se, me, te, ce, ue ? he : null);
            }
            ae && !ne && le.remove();
          }(E2, L2, w, F13, O2), function(z, H2, te, j, Q2) {
            var Z2 = j.trace, ne = te._fullLayout._clips, ae = "clip" + Z2.uid, ue = ne.selectAll("#" + ae).data(Z2.connectgaps ? [] : [0]);
            if (ue.enter().append("clipPath").classed("contourclip", true).attr("id", ae), ue.exit().remove(), Z2.connectgaps === false) {
              var le = { level: 0.9, crossings: {}, starts: [], edgepaths: [], paths: [], xaxis: H2.xaxis, yaxis: H2.yaxis, x: j.x, y: j.y, z: y(j), smoothing: 0 };
              f([le]), h([le]), v([le], { type: "levels" }), a.ensureSingle(ue, "path", "").attr("d", (le.prefixBoundary ? "M" + Q2.join("L") + "Z" : "") + x(le, Q2));
            } else ae = null;
            o.setClipUrl(z, ae, te);
          }(E2, _4, w, F13, re);
        });
      }, r.createLines = function(w, _4, k) {
        var T2 = k[0].smoothing, A2 = w.selectAll("g.contourlevel").data(_4 ? k : []);
        if (A2.exit().remove(), A2.enter().append("g").classed("contourlevel", true), _4) {
          var S2 = A2.selectAll("path.openline").data(function(E2) {
            return E2.pedgepaths || E2.edgepaths;
          });
          S2.exit().remove(), S2.enter().append("path").classed("openline", true), S2.attr("d", function(E2) {
            return o.smoothopen(E2, T2);
          }).style("stroke-miterlimit", 1).style("vector-effect", "non-scaling-stroke");
          var C2 = A2.selectAll("path.closedline").data(function(E2) {
            return E2.ppaths || E2.paths;
          });
          C2.exit().remove(), C2.enter().append("path").classed("closedline", true), C2.attr("d", function(E2) {
            return o.smoothclosed(E2, T2);
          }).style("stroke-miterlimit", 1).style("vector-effect", "non-scaling-stroke");
        }
        return A2;
      }, r.createLineClip = function(w, _4, k, T2) {
        var A2 = _4 ? "clipline" + T2 : null, S2 = k._fullLayout._clips.selectAll("#" + A2).data(_4 ? [0] : []);
        return S2.exit().remove(), S2.enter().append("clipPath").classed("contourlineclip", true).attr("id", A2), o.setClipUrl(w, A2, k), S2;
      }, r.labelFormatter = function(w, _4) {
        var k = w._fullLayout, T2 = _4.trace, A2 = T2.contours, S2 = { type: "linear", _id: "ycontour", showexponent: "all", exponentformat: "B" };
        if (A2.labelformat) S2.tickformat = A2.labelformat, u2(S2, k);
        else {
          var C2 = s.extractOpts(T2);
          if (C2 && C2.colorbar && C2.colorbar._axis) S2 = C2.colorbar._axis;
          else {
            if (A2.type === "constraint") {
              var E2 = A2.value;
              Array.isArray(E2) ? S2.range = [E2[0], E2[E2.length - 1]] : S2.range = [E2, E2];
            } else S2.range = [A2.start, A2.end], S2.nticks = (A2.end - A2.start) / A2.size;
            S2.range[0] === S2.range[1] && (S2.range[1] += S2.range[0] || 1), S2.nticks || (S2.nticks = 1e3), u2(S2, k), l.prepTicks(S2), S2._tmin = null, S2._tmax = null;
          }
        }
        return function(F13) {
          return l.tickText(S2, F13).text;
        };
      }, r.calcTextOpts = function(w, _4, k, T2) {
        var A2 = _4(w);
        k.text(A2).call(i.convertToTspans, T2);
        var S2 = k.node(), C2 = o.bBox(S2, true);
        return { text: A2, width: C2.width, height: C2.height, fontSize: +S2.style["font-size"].replace("px", ""), level: w, dy: (C2.top + C2.bottom) / 2 };
      }, r.findBestTextLocation = function(w, _4, k, T2, A2) {
        var S2, C2, E2, F13, N2, D2 = k.width;
        _4.isClosed ? (C2 = _4.len / g.INITIALSEARCHPOINTS, S2 = _4.min + C2 / 2, E2 = _4.max) : (C2 = (_4.len - D2) / (g.INITIALSEARCHPOINTS + 1), S2 = _4.min + C2 + D2 / 2, E2 = _4.max - (C2 + D2) / 2);
        for (var I2 = 1 / 0, O2 = 0; O2 < g.ITERATIONS; O2++) {
          for (var L2 = S2; L2 < E2; L2 += C2) {
            var V2 = a.getTextLocation(w, _4.total, L2, D2), W2 = b(V2, k, T2, A2);
            W2 < I2 && (I2 = W2, N2 = V2, F13 = L2);
          }
          if (I2 > 2 * g.MAXCOST) break;
          O2 && (C2 /= 2), E2 = (S2 = F13 - C2 / 2) + 1.5 * C2;
        }
        if (I2 <= g.MAXCOST) return N2;
      }, r.addLabelData = function(w, _4, k, T2) {
        var A2 = _4.fontSize, S2 = _4.width + A2 / 3, C2 = Math.max(0, _4.height - A2 / 3), E2 = w.x, F13 = w.y, N2 = w.theta, D2 = Math.sin(N2), I2 = Math.cos(N2), O2 = function(V2, W2) {
          return [E2 + V2 * I2 - W2 * D2, F13 + V2 * D2 + W2 * I2];
        }, L2 = [O2(-S2 / 2, -C2 / 2), O2(-S2 / 2, C2 / 2), O2(S2 / 2, C2 / 2), O2(S2 / 2, -C2 / 2)];
        k.push({ text: _4.text, x: E2, y: F13, dy: _4.dy, theta: N2, level: _4.level, width: S2, height: C2 }), T2.push(L2);
      }, r.drawLabels = function(w, _4, k, T2, A2) {
        var S2 = w.selectAll("text").data(_4, function(F13) {
          return F13.text + "," + F13.x + "," + F13.y + "," + F13.theta;
        });
        if (S2.exit().remove(), S2.enter().append("text").attr({ "data-notex": 1, "text-anchor": "middle" }).each(function(F13) {
          var N2 = F13.x + Math.sin(F13.theta) * F13.dy, D2 = F13.y - Math.cos(F13.theta) * F13.dy;
          n.select(this).text(F13.text).attr({ x: N2, y: D2, transform: "rotate(" + 180 * F13.theta / Math.PI + " " + N2 + " " + D2 + ")" }).call(i.convertToTspans, k);
        }), A2) {
          for (var C2 = "", E2 = 0; E2 < A2.length; E2++) C2 += "M" + A2[E2].join("L") + "Z";
          a.ensureSingle(T2, "path", "").attr("d", C2);
        }
      };
    }, { "../../components/colorscale": 378, "../../components/drawing": 388, "../../lib": 503, "../../lib/svg_text_utils": 529, "../../plots/cartesian/axes": 554, "../../plots/cartesian/set_convert": 576, "../heatmap/plot": 804, "./close_boundaries": 737, "./constants": 739, "./convert_to_constraints": 743, "./empty_pathinfo": 745, "./find_all_paths": 747, "./make_crossings": 752, "@plotly/d3": 58 }], 754: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/cartesian/axes"), a = e("../../lib");
      function o(s, i, l) {
        var u2 = { type: "linear", range: [s, i] };
        return n.autoTicks(u2, (i - s) / (l || 15)), u2;
      }
      t.exports = function(s, i) {
        var l = s.contours;
        if (s.autocontour) {
          var u2 = s.zmin, c = s.zmax;
          (s.zauto || u2 === void 0) && (u2 = a.aggNums(Math.min, null, i)), (s.zauto || c === void 0) && (c = a.aggNums(Math.max, null, i));
          var f = o(u2, c, s.ncontours);
          l.size = f.dtick, l.start = n.tickFirst(f), f.range.reverse(), l.end = n.tickFirst(f), l.start === u2 && (l.start += l.size), l.end === c && (l.end -= l.size), l.start > l.end && (l.start = l.end = (l.start + l.end) / 2), s._input.contours || (s._input.contours = {}), a.extendFlat(s._input.contours, { start: l.start, end: l.end, size: l.size }), s._input.autocontour = true;
        } else if (l.type !== "constraint") {
          var h, p = l.start, d = l.end, v = s._input.contours;
          p > d && (l.start = v.start = d, d = l.end = v.end = p, p = l.start), !(l.size > 0) && (h = p === d ? 1 : o(p, d, s.ncontours).dtick, v.size = l.size = h);
        }
      };
    }, { "../../lib": 503, "../../plots/cartesian/axes": 554 }], 755: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../components/drawing"), o = e("../heatmap/style"), s = e("./make_color_map");
      t.exports = function(i) {
        var l = n.select(i).selectAll("g.contour");
        l.style("opacity", function(u2) {
          return u2[0].trace.opacity;
        }), l.each(function(u2) {
          var c = n.select(this), f = u2[0].trace, h = f.contours, p = f.line, d = h.size || 1, v = h.start, m = h.type === "constraint", g = !m && h.coloring === "lines", x = !m && h.coloring === "fill", b = g || x ? s(f) : null;
          c.selectAll("g.contourlevel").each(function(_4) {
            n.select(this).selectAll("path").call(a.lineGroupStyle, p.width, g ? b(_4.level) : p.color, p.dash);
          });
          var y = h.labelfont;
          if (c.selectAll("g.contourlabels text").each(function(_4) {
            a.font(n.select(this), { family: y.family, size: y.size, color: y.color || (g ? b(_4.level) : p.color) });
          }), m) c.selectAll("g.contourfill path").style("fill", f.fillcolor);
          else if (x) {
            var w;
            c.selectAll("g.contourfill path").style("fill", function(_4) {
              return w === void 0 && (w = _4.level), b(_4.level + 0.5 * d);
            }), w === void 0 && (w = v), c.selectAll("g.contourbg path").style("fill", b(w - 0.5 * d));
          }
        }), o(i);
      };
    }, { "../../components/drawing": 388, "../heatmap/style": 805, "./make_color_map": 751, "@plotly/d3": 58 }], 756: [function(e, t, r) {
      "use strict";
      var n = e("../../components/colorscale/defaults"), a = e("./label_defaults");
      t.exports = function(o, s, i, l, u2) {
        var c, f = i("contours.coloring"), h = "";
        f === "fill" && (c = i("contours.showlines")), c !== false && (f !== "lines" && (h = i("line.color", "#000")), i("line.width", 0.5), i("line.dash")), f !== "none" && (o.showlegend !== true && (s.showlegend = false), s._dfltShowLegend = false, n(o, s, l, i, { prefix: "", cLetter: "z" })), i("line.smoothing"), a(i, l, h, u2);
      };
    }, { "../../components/colorscale/defaults": 376, "./label_defaults": 750 }], 757: [function(e, t, r) {
      "use strict";
      var n = e("../heatmap/attributes"), a = e("../contour/attributes"), o = e("../../components/colorscale/attributes"), s = e("../../lib/extend").extendFlat, i = a.contours;
      t.exports = s({ carpet: { valType: "string", editType: "calc" }, z: n.z, a: n.x, a0: n.x0, da: n.dx, b: n.y, b0: n.y0, db: n.dy, text: n.text, hovertext: n.hovertext, transpose: n.transpose, atype: n.xtype, btype: n.ytype, fillcolor: a.fillcolor, autocontour: a.autocontour, ncontours: a.ncontours, contours: { type: i.type, start: i.start, end: i.end, size: i.size, coloring: { valType: "enumerated", values: ["fill", "lines", "none"], dflt: "fill", editType: "calc" }, showlines: i.showlines, showlabels: i.showlabels, labelfont: i.labelfont, labelformat: i.labelformat, operation: i.operation, value: i.value, editType: "calc", impliedEdits: { autocontour: false } }, line: { color: a.line.color, width: a.line.width, dash: a.line.dash, smoothing: a.line.smoothing, editType: "plot" }, transforms: void 0 }, o("", { cLetter: "z", autoColorDflt: false }));
    }, { "../../components/colorscale/attributes": 373, "../../lib/extend": 493, "../contour/attributes": 735, "../heatmap/attributes": 792 }], 758: [function(e, t, r) {
      "use strict";
      var n = e("../../components/colorscale/calc"), a = e("../../lib"), o = e("../heatmap/convert_column_xyz"), s = e("../heatmap/clean_2d_array"), i = e("../heatmap/interp2d"), l = e("../heatmap/find_empties"), u2 = e("../heatmap/make_bound_array"), c = e("./defaults"), f = e("../carpet/lookup_carpetid"), h = e("../contour/set_contours");
      t.exports = function(p, d) {
        var v = d._carpetTrace = f(p, d);
        if (v && v.visible && v.visible !== "legendonly") {
          if (!d.a || !d.b) {
            var m = p.data[v.index], g = p.data[d.index];
            g.a || (g.a = m.a), g.b || (g.b = m.b), c(g, d, d._defaultColor, p._fullLayout);
          }
          var x = function(b, y) {
            var w, _4, k, T2, A2, S2, C2, E2 = y._carpetTrace, F13 = E2.aaxis, N2 = E2.baxis;
            F13._minDtick = 0, N2._minDtick = 0, a.isArray1D(y.z) && o(y, F13, N2, "a", "b", ["z"]), w = y._a = y._a || y.a, T2 = y._b = y._b || y.b, w = w ? F13.makeCalcdata(y, "_a") : [], T2 = T2 ? N2.makeCalcdata(y, "_b") : [], _4 = y.a0 || 0, k = y.da || 1, A2 = y.b0 || 0, S2 = y.db || 1, C2 = y._z = s(y._z || y.z, y.transpose), y._emptypoints = l(C2), i(C2, y._emptypoints);
            var D2 = a.maxRowLength(C2), I2 = y.xtype === "scaled" ? "" : w, O2 = u2(y, I2, _4, k, D2, F13), L2 = y.ytype === "scaled" ? "" : T2, V2 = u2(y, L2, A2, S2, C2.length, N2), W2 = { a: O2, b: V2, z: C2 };
            return y.contours.type === "levels" && y.contours.coloring !== "none" && n(b, y, { vals: C2, containerStr: "", cLetter: "z" }), [W2];
          }(p, d);
          return h(d, d._z), x;
        }
      };
    }, { "../../components/colorscale/calc": 374, "../../lib": 503, "../carpet/lookup_carpetid": 708, "../contour/set_contours": 754, "../heatmap/clean_2d_array": 794, "../heatmap/convert_column_xyz": 796, "../heatmap/find_empties": 798, "../heatmap/interp2d": 801, "../heatmap/make_bound_array": 803, "./defaults": 759 }], 759: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../heatmap/xyz_defaults"), o = e("./attributes"), s = e("../contour/constraint_defaults"), i = e("../contour/contours_defaults"), l = e("../contour/style_defaults");
      t.exports = function(u2, c, f, h) {
        function p(d, v) {
          return n.coerce(u2, c, o, d, v);
        }
        if (p("carpet"), u2.a && u2.b) {
          if (!a(u2, c, p, h, "a", "b")) return void (c.visible = false);
          p("text"), p("contours.type") === "constraint" ? s(u2, c, p, h, f, { hasHover: false }) : (i(u2, c, p, function(d) {
            return n.coerce2(u2, c, o, d);
          }), l(u2, c, p, h, { hasHover: false }));
        } else c._defaultColor = f, c._length = null;
      };
    }, { "../../lib": 503, "../contour/constraint_defaults": 740, "../contour/contours_defaults": 742, "../contour/style_defaults": 756, "../heatmap/xyz_defaults": 807, "./attributes": 757 }], 760: [function(e, t, r) {
      "use strict";
      t.exports = { attributes: e("./attributes"), supplyDefaults: e("./defaults"), colorbar: e("../contour/colorbar"), calc: e("./calc"), plot: e("./plot"), style: e("../contour/style"), moduleType: "trace", name: "contourcarpet", basePlotModule: e("../../plots/cartesian"), categories: ["cartesian", "svg", "carpet", "contour", "symbols", "showLegend", "hasLines", "carpetDependent", "noHover", "noSortingByValue"], meta: {} };
    }, { "../../plots/cartesian": 568, "../contour/colorbar": 738, "../contour/style": 755, "./attributes": 757, "./calc": 758, "./defaults": 759, "./plot": 761 }], 761: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../carpet/map_1d_array"), o = e("../carpet/makepath"), s = e("../../components/drawing"), i = e("../../lib"), l = e("../contour/make_crossings"), u2 = e("../contour/find_all_paths"), c = e("../contour/plot"), f = e("../contour/constants"), h = e("../contour/convert_to_constraints"), p = e("../contour/empty_pathinfo"), d = e("../contour/close_boundaries"), v = e("../carpet/lookup_carpetid"), m = e("../carpet/axis_aligned_line");
      function g(y, w, _4) {
        var k = y.getPointAtLength(w), T2 = y.getPointAtLength(_4), A2 = T2.x - k.x, S2 = T2.y - k.y, C2 = Math.sqrt(A2 * A2 + S2 * S2);
        return [A2 / C2, S2 / C2];
      }
      function x(y) {
        var w = Math.sqrt(y[0] * y[0] + y[1] * y[1]);
        return [y[0] / w, y[1] / w];
      }
      function b(y, w) {
        var _4 = Math.abs(y[0] * w[0] + y[1] * w[1]);
        return Math.sqrt(1 - _4 * _4) / _4;
      }
      t.exports = function(y, w, _4, k) {
        var T2 = w.xaxis, A2 = w.yaxis;
        i.makeTraceGroups(k, _4, "contour").each(function(S2) {
          var C2 = n.select(this), E2 = S2[0], F13 = E2.trace, N2 = F13._carpetTrace = v(y, F13), D2 = y.calcdata[N2.index][0];
          if (N2.visible && N2.visible !== "legendonly") {
            var I2 = E2.a, O2 = E2.b, L2 = F13.contours, V2 = p(L2, w, E2), W2 = L2.type === "constraint", X2 = L2._operation, Y2 = W2 ? X2 === "=" ? "lines" : "fill" : L2.coloring, K2 = [[I2[0], O2[O2.length - 1]], [I2[I2.length - 1], O2[O2.length - 1]], [I2[I2.length - 1], O2[0]], [I2[0], O2[0]]];
            l(V2);
            var q = 1e-8 * (I2[I2.length - 1] - I2[0]), re = 1e-8 * (O2[O2.length - 1] - O2[0]);
            u2(V2, q, re);
            var R2, z, H2, te, j = V2;
            L2.type === "constraint" && (j = h(V2, X2)), function(ae, ue) {
              var le, ce, se, he, me, we, be, Ae, pe;
              for (le = 0; le < ae.length; le++) {
                for (he = ae[le], me = he.pedgepaths = [], we = he.ppaths = [], ce = 0; ce < he.edgepaths.length; ce++) {
                  for (pe = he.edgepaths[ce], be = [], se = 0; se < pe.length; se++) be[se] = ue(pe[se]);
                  me.push(be);
                }
                for (ce = 0; ce < he.paths.length; ce++) {
                  for (pe = he.paths[ce], Ae = [], se = 0; se < pe.length; se++) Ae[se] = ue(pe[se]);
                  we.push(Ae);
                }
              }
            }(V2, ne);
            var Q2 = [];
            for (te = D2.clipsegments.length - 1; te >= 0; te--) R2 = D2.clipsegments[te], z = a([], R2.x, T2.c2p), H2 = a([], R2.y, A2.c2p), z.reverse(), H2.reverse(), Q2.push(o(z, H2, R2.bicubic));
            var Z2 = "M" + Q2.join("L") + "Z";
            (function(ae, ue, le, ce, se, he) {
              var me, we, be, Ae, pe = i.ensureSingle(ae, "g", "contourbg").selectAll("path").data(he !== "fill" || se ? [] : [0]);
              pe.enter().append("path"), pe.exit().remove();
              var ve = [];
              for (Ae = 0; Ae < ue.length; Ae++) me = ue[Ae], we = a([], me.x, le.c2p), be = a([], me.y, ce.c2p), ve.push(o(we, be, me.bicubic));
              pe.attr("d", "M" + ve.join("L") + "Z").style("stroke", "none");
            })(C2, D2.clipsegments, T2, A2, W2, Y2), function(ae, ue, le, ce, se, he, me, we, be, Ae, pe) {
              var ve = Ae === "fill";
              ve && d(se, ae.contours);
              var Ee = i.ensureSingle(ue, "g", "contourfill").selectAll("path").data(ve ? se : []);
              Ee.enter().append("path"), Ee.exit().remove(), Ee.each(function(Se) {
                var Ce = (Se.prefixBoundary ? pe : "") + function(Be, Ue, Ke, ct, We, Ze, it, ot) {
                  var mt, wt, Et, zt, Nt, yt, pt, Ot = "", Jt = Ue.edgepaths.map(function(Re, qe) {
                    return qe;
                  }), tr = true, Ye = 1e-4 * Math.abs(Ke[0][0] - Ke[2][0]), at = 1e-4 * Math.abs(Ke[0][1] - Ke[2][1]);
                  function Ge(Re) {
                    return Math.abs(Re[1] - Ke[0][1]) < at;
                  }
                  function st(Re) {
                    return Math.abs(Re[1] - Ke[2][1]) < at;
                  }
                  function Ie(Re) {
                    return Math.abs(Re[0] - Ke[0][0]) < Ye;
                  }
                  function Pe(Re) {
                    return Math.abs(Re[0] - Ke[2][0]) < Ye;
                  }
                  function $e(Re, qe) {
                    var je, rt, He, xe, Ne = "";
                    for (Ge(Re) && !Pe(Re) || st(Re) && !Ie(Re) ? (xe = We.aaxis, He = m(We, Ze, [Re[0], qe[0]], 0.5 * (Re[1] + qe[1]))) : (xe = We.baxis, He = m(We, Ze, 0.5 * (Re[0] + qe[0]), [Re[1], qe[1]])), je = 1; je < He.length; je++) for (Ne += xe.smoothing ? "C" : "L", rt = 0; rt < He[je].length; rt++) {
                      var ke = He[je][rt];
                      Ne += [it.c2p(ke[0]), ot.c2p(ke[1])] + " ";
                    }
                    return Ne;
                  }
                  for (mt = 0, wt = null; Jt.length; ) {
                    var Ve = Ue.edgepaths[mt][0];
                    for (wt && (Ot += $e(wt, Ve)), pt = s.smoothopen(Ue.edgepaths[mt].map(ct), Ue.smoothing), Ot += tr ? pt : pt.replace(/^M/, "L"), Jt.splice(Jt.indexOf(mt), 1), wt = Ue.edgepaths[mt][Ue.edgepaths[mt].length - 1], Nt = -1, zt = 0; zt < 4; zt++) {
                      if (!wt) {
                        i.log("Missing end?", mt, Ue);
                        break;
                      }
                      for (Ge(wt) && !Pe(wt) ? Et = Ke[1] : Ie(wt) ? Et = Ke[0] : st(wt) ? Et = Ke[3] : Pe(wt) && (Et = Ke[2]), yt = 0; yt < Ue.edgepaths.length; yt++) {
                        var ut = Ue.edgepaths[yt][0];
                        Math.abs(wt[0] - Et[0]) < Ye ? Math.abs(wt[0] - ut[0]) < Ye && (ut[1] - wt[1]) * (Et[1] - ut[1]) >= 0 && (Et = ut, Nt = yt) : Math.abs(wt[1] - Et[1]) < at ? Math.abs(wt[1] - ut[1]) < at && (ut[0] - wt[0]) * (Et[0] - ut[0]) >= 0 && (Et = ut, Nt = yt) : i.log("endpt to newendpt is not vert. or horz.", wt, Et, ut);
                      }
                      if (Nt >= 0) break;
                      Ot += $e(wt, Et), wt = Et;
                    }
                    if (Nt === Ue.edgepaths.length) {
                      i.log("unclosed perimeter path");
                      break;
                    }
                    mt = Nt, (tr = Jt.indexOf(mt) === -1) && (mt = Jt[0], Ot += $e(wt, Et) + "Z", wt = null);
                  }
                  for (mt = 0; mt < Ue.paths.length; mt++) Ot += s.smoothclosed(Ue.paths[mt].map(ct), Ue.smoothing);
                  return Ot;
                }(0, Se, he, me, we, be, le, ce);
                Ce ? n.select(this).attr("d", Ce).style("stroke", "none") : n.select(this).remove();
              });
            }(F13, C2, T2, A2, j, K2, ne, N2, D2, Y2, Z2), function(ae, ue, le, ce, se, he, me) {
              var we = i.ensureSingle(ae, "g", "contourlines"), be = se.showlines !== false, Ae = se.showlabels, pe = be && Ae, ve = c.createLines(we, be || Ae, ue), Ee = c.createLineClip(we, pe, le, ce.trace.uid), Se = ae.selectAll("g.contourlabels").data(Ae ? [0] : []);
              if (Se.exit().remove(), Se.enter().append("g").classed("contourlabels", true), Ae) {
                var Ce = he.xaxis, Be = he.yaxis, Ue = Ce._length, Ke = Be._length, ct = [[[0, 0], [Ue, 0], [Ue, Ke], [0, Ke]]], We = [];
                i.clearLocationCache();
                var Ze = c.labelFormatter(le, ce), it = s.tester.append("text").attr("data-notex", 1).call(s.font, se.labelfont), ot = { left: 0, right: Ue, center: Ue / 2, top: 0, bottom: Ke, middle: Ke / 2 }, mt = Math.sqrt(Ue * Ue + Ke * Ke), wt = f.LABELDISTANCE * mt / Math.max(1, ue.length / f.LABELINCREASE);
                ve.each(function(Et) {
                  var zt = c.calcTextOpts(Et.level, Ze, it, le);
                  n.select(this).selectAll("path").each(function(Nt) {
                    var yt = i.getVisibleSegment(this, ot, zt.height / 2);
                    if (yt && (function(tr, Ye, at, Ge, st, Ie) {
                      for (var Pe, $e = 0; $e < at.pedgepaths.length; $e++) Ye === at.pedgepaths[$e] && (Pe = at.edgepaths[$e]);
                      if (!Pe) return;
                      var Ve = st.a[0], ut = st.a[st.a.length - 1], Re = st.b[0], qe = st.b[st.b.length - 1];
                      function je(ke, Me) {
                        var Le, ze = 0;
                        return (Math.abs(ke[0] - Ve) < 0.1 || Math.abs(ke[0] - ut) < 0.1) && (Le = x(st.dxydb_rough(ke[0], ke[1], 0.1)), ze = Math.max(ze, Ie * b(Me, Le) / 2)), (Math.abs(ke[1] - Re) < 0.1 || Math.abs(ke[1] - qe) < 0.1) && (Le = x(st.dxyda_rough(ke[0], ke[1], 0.1)), ze = Math.max(ze, Ie * b(Me, Le) / 2)), ze;
                      }
                      var rt = g(tr, 0, 1), He = g(tr, Ge.total, Ge.total - 1), xe = je(Pe[0], rt), Ne = Ge.total - je(Pe[Pe.length - 1], He);
                      Ge.min < xe && (Ge.min = xe), Ge.max > Ne && (Ge.max = Ne), Ge.len = Ge.max - Ge.min;
                    }(this, Nt, Et, yt, me, zt.height), !(yt.len < (zt.width + zt.height) * f.LABELMIN))) for (var pt = Math.min(Math.ceil(yt.len / wt), f.LABELMAX), Ot = 0; Ot < pt; Ot++) {
                      var Jt = c.findBestTextLocation(this, yt, zt, We, ot);
                      if (!Jt) break;
                      c.addLabelData(Jt, zt, We, ct);
                    }
                  });
                }), it.remove(), c.drawLabels(Se, We, le, Ee, pe ? ct : null);
              }
              Ae && !be && ve.remove();
            }(C2, V2, y, E2, L2, w, N2), s.setClipUrl(C2, N2._clipPathId, y);
          }
          function ne(ae) {
            var ue = N2.ab2xy(ae[0], ae[1], true);
            return [T2.c2p(ue[0]), A2.c2p(ue[1])];
          }
        });
      };
    }, { "../../components/drawing": 388, "../../lib": 503, "../carpet/axis_aligned_line": 692, "../carpet/lookup_carpetid": 708, "../carpet/makepath": 709, "../carpet/map_1d_array": 710, "../contour/close_boundaries": 737, "../contour/constants": 739, "../contour/convert_to_constraints": 743, "../contour/empty_pathinfo": 745, "../contour/find_all_paths": 747, "../contour/make_crossings": 752, "../contour/plot": 753, "@plotly/d3": 58 }], 762: [function(e, t, r) {
      "use strict";
      var n = e("../../components/colorscale/attributes"), a = e("../../plots/template_attributes").hovertemplateAttrs, o = e("../../plots/attributes"), s = e("../scattermapbox/attributes"), i = e("../../lib/extend").extendFlat;
      t.exports = i({ lon: s.lon, lat: s.lat, z: { valType: "data_array", editType: "calc" }, radius: { valType: "number", editType: "plot", arrayOk: true, min: 1, dflt: 30 }, below: { valType: "string", editType: "plot" }, text: s.text, hovertext: s.hovertext, hoverinfo: i({}, o.hoverinfo, { flags: ["lon", "lat", "z", "text", "name"] }), hovertemplate: a(), showlegend: i({}, o.showlegend, { dflt: false }) }, n("", { cLetter: "z", editTypeOverride: "calc" }));
    }, { "../../components/colorscale/attributes": 373, "../../lib/extend": 493, "../../plots/attributes": 550, "../../plots/template_attributes": 633, "../scattermapbox/attributes": 991 }], 763: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("../../lib").isArrayOrTypedArray, o = e("../../constants/numerical").BADNUM, s = e("../../components/colorscale/calc"), i = e("../../lib")._;
      t.exports = function(l, u2) {
        for (var c = u2._length, f = new Array(c), h = u2.z, p = a(h) && h.length, d = 0; d < c; d++) {
          var v = f[d] = {}, m = u2.lon[d], g = u2.lat[d];
          if (v.lonlat = n(m) && n(g) ? [+m, +g] : [o, o], p) {
            var x = h[d];
            v.z = n(x) ? x : o;
          }
        }
        return s(l, u2, { vals: p ? h : [0, 1], containerStr: "", cLetter: "z" }), c && (f[0].t = { labels: { lat: i(l, "lat:") + " ", lon: i(l, "lon:") + " " } }), f;
      };
    }, { "../../components/colorscale/calc": 374, "../../constants/numerical": 479, "../../lib": 503, "fast-isnumeric": 190 }], 764: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("../../lib"), o = e("../../components/color"), s = e("../../components/colorscale"), i = e("../../constants/numerical").BADNUM, l = e("../../lib/geojson_utils").makeBlank;
      t.exports = function(u2) {
        var c = u2[0].trace, f = c.visible === true && c._length !== 0, h = c._opts = { heatmap: { layout: { visibility: "none" }, paint: {} }, geojson: l() };
        if (!f) return h;
        var p, d = [], v = c.z, m = c.radius, g = a.isArrayOrTypedArray(v) && v.length, x = a.isArrayOrTypedArray(m);
        for (p = 0; p < u2.length; p++) {
          var b = u2[p], y = b.lonlat;
          if (y[0] !== i) {
            var w = {};
            if (g) {
              var _4 = b.z;
              w.z = _4 !== i ? _4 : 0;
            }
            x && (w.r = n(m[p]) && m[p] > 0 ? +m[p] : 0), d.push({ type: "Feature", geometry: { type: "Point", coordinates: y }, properties: w });
          }
        }
        var k = s.extractOpts(c), T2 = k.reversescale ? s.flipScale(k.colorscale) : k.colorscale, A2 = T2[0][1], S2 = ["interpolate", ["linear"], ["heatmap-density"], 0, o.opacity(A2) < 1 ? A2 : o.addOpacity(A2, 0)];
        for (p = 1; p < T2.length; p++) S2.push(T2[p][0], T2[p][1]);
        var C2 = ["interpolate", ["linear"], ["get", "z"], k.min, 0, k.max, 1];
        return a.extendFlat(h.heatmap.paint, { "heatmap-weight": g ? C2 : 1 / (k.max - k.min), "heatmap-color": S2, "heatmap-radius": x ? { type: "identity", property: "r" } : c.radius, "heatmap-opacity": c.opacity }), h.geojson = { type: "FeatureCollection", features: d }, h.heatmap.layout.visibility = "visible", h;
      };
    }, { "../../components/color": 366, "../../components/colorscale": 378, "../../constants/numerical": 479, "../../lib": 503, "../../lib/geojson_utils": 497, "fast-isnumeric": 190 }], 765: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../components/colorscale/defaults"), o = e("./attributes");
      t.exports = function(s, i, l, u2) {
        function c(d, v) {
          return n.coerce(s, i, o, d, v);
        }
        var f = c("lon") || [], h = c("lat") || [], p = Math.min(f.length, h.length);
        p ? (i._length = p, c("z"), c("radius"), c("below"), c("text"), c("hovertext"), c("hovertemplate"), a(s, i, u2, c, { prefix: "", cLetter: "z" })) : i.visible = false;
      };
    }, { "../../components/colorscale/defaults": 376, "../../lib": 503, "./attributes": 762 }], 766: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a) {
        return n.lon = a.lon, n.lat = a.lat, n.z = a.z, n;
      };
    }, {}], 767: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/cartesian/axes"), a = e("../scattermapbox/hover").hoverPoints, o = e("../scattermapbox/hover").getExtraText;
      t.exports = function(s, i, l) {
        var u2 = a(s, i, l);
        if (u2) {
          var c = u2[0], f = c.cd, h = f[0].trace, p = f[c.index];
          if (delete c.color, "z" in p) {
            var d = c.subplot.mockAxis;
            c.z = p.z, c.zLabel = n.tickText(d, d.c2l(p.z), "hover").text;
          }
          return c.extraText = o(h, p, f[0].t.labels), [c];
        }
      };
    }, { "../../plots/cartesian/axes": 554, "../scattermapbox/hover": 996 }], 768: [function(e, t, r) {
      "use strict";
      t.exports = { attributes: e("./attributes"), supplyDefaults: e("./defaults"), colorbar: e("../heatmap/colorbar"), formatLabels: e("../scattermapbox/format_labels"), calc: e("./calc"), plot: e("./plot"), hoverPoints: e("./hover"), eventData: e("./event_data"), getBelow: function(n, a) {
        for (var o = a.getMapLayers(), s = 0; s < o.length; s++) {
          var i = o[s], l = i.id;
          if (i.type === "symbol" && typeof l == "string" && l.indexOf("plotly-") === -1) return l;
        }
      }, moduleType: "trace", name: "densitymapbox", basePlotModule: e("../../plots/mapbox"), categories: ["mapbox", "gl", "showLegend"], meta: { hr_name: "density_mapbox" } };
    }, { "../../plots/mapbox": 613, "../heatmap/colorbar": 795, "../scattermapbox/format_labels": 995, "./attributes": 762, "./calc": 763, "./defaults": 765, "./event_data": 766, "./hover": 767, "./plot": 769 }], 769: [function(e, t, r) {
      "use strict";
      var n = e("./convert"), a = e("../../plots/mapbox/constants").traceLayerPrefix;
      function o(i, l) {
        this.type = "densitymapbox", this.subplot = i, this.uid = l, this.sourceId = "source-" + l, this.layerList = [["heatmap", a + l + "-heatmap"]], this.below = null;
      }
      var s = o.prototype;
      s.update = function(i) {
        var l = this.subplot, u2 = this.layerList, c = n(i), f = l.belowLookup["trace-" + this.uid];
        l.map.getSource(this.sourceId).setData(c.geojson), f !== this.below && (this._removeLayers(), this._addLayers(c, f), this.below = f);
        for (var h = 0; h < u2.length; h++) {
          var p = u2[h], d = p[0], v = p[1], m = c[d];
          l.setOptions(v, "setLayoutProperty", m.layout), m.layout.visibility === "visible" && l.setOptions(v, "setPaintProperty", m.paint);
        }
      }, s._addLayers = function(i, l) {
        for (var u2 = this.subplot, c = this.layerList, f = this.sourceId, h = 0; h < c.length; h++) {
          var p = c[h], d = p[0], v = i[d];
          u2.addLayer({ type: d, id: p[1], source: f, layout: v.layout, paint: v.paint }, l);
        }
      }, s._removeLayers = function() {
        for (var i = this.subplot.map, l = this.layerList, u2 = l.length - 1; u2 >= 0; u2--) i.removeLayer(l[u2][1]);
      }, s.dispose = function() {
        var i = this.subplot.map;
        this._removeLayers(), i.removeSource(this.sourceId);
      }, t.exports = function(i, l) {
        var u2 = l[0].trace, c = new o(i, u2.uid), f = c.sourceId, h = n(l), p = c.below = i.belowLookup["trace-" + u2.uid];
        return i.map.addSource(f, { type: "geojson", data: h.geojson }), c._addLayers(h, p), c;
      };
    }, { "../../plots/mapbox/constants": 611, "./convert": 764 }], 770: [function(e, t, r) {
      "use strict";
      var n = e("../../lib");
      t.exports = function(a, o) {
        for (var s = 0; s < a.length; s++) a[s].i = s;
        n.mergeArray(o.text, a, "tx"), n.mergeArray(o.hovertext, a, "htx");
        var i = o.marker;
        if (i) {
          n.mergeArray(i.opacity, a, "mo"), n.mergeArray(i.color, a, "mc");
          var l = i.line;
          l && (n.mergeArray(l.color, a, "mlc"), n.mergeArrayCastPositive(l.width, a, "mlw"));
        }
      };
    }, { "../../lib": 503 }], 771: [function(e, t, r) {
      "use strict";
      var n, a = e("../bar/attributes"), o = e("../scatter/attributes").line, s = e("../../plots/attributes"), i = e("../../plots/cartesian/axis_format_attributes").axisHoverFormat, l = e("../../plots/template_attributes").hovertemplateAttrs, u2 = e("../../plots/template_attributes").texttemplateAttrs, c = e("./constants"), f = e("../../lib/extend").extendFlat, h = e("../../components/color");
      t.exports = { x: a.x, x0: a.x0, dx: a.dx, y: a.y, y0: a.y0, dy: a.dy, xperiod: a.xperiod, yperiod: a.yperiod, xperiod0: a.xperiod0, yperiod0: a.yperiod0, xperiodalignment: a.xperiodalignment, yperiodalignment: a.yperiodalignment, xhoverformat: i("x"), yhoverformat: i("y"), hovertext: a.hovertext, hovertemplate: l({}, { keys: c.eventDataKeys }), hoverinfo: f({}, s.hoverinfo, { flags: ["name", "x", "y", "text", "percent initial", "percent previous", "percent total"] }), textinfo: { valType: "flaglist", flags: ["label", "text", "percent initial", "percent previous", "percent total", "value"], extras: ["none"], editType: "plot", arrayOk: false }, texttemplate: u2({ editType: "plot" }, { keys: c.eventDataKeys.concat(["label", "value"]) }), text: a.text, textposition: a.textposition, insidetextanchor: f({}, a.insidetextanchor, { dflt: "middle" }), textangle: f({}, a.textangle, { dflt: 0 }), textfont: a.textfont, insidetextfont: a.insidetextfont, outsidetextfont: a.outsidetextfont, constraintext: a.constraintext, cliponaxis: a.cliponaxis, orientation: f({}, a.orientation, {}), offset: f({}, a.offset, { arrayOk: false }), width: f({}, a.width, { arrayOk: false }), marker: (n = f({}, a.marker), delete n.pattern, n), connector: { fillcolor: { valType: "color", editType: "style" }, line: { color: f({}, o.color, { dflt: h.defaultLine }), width: f({}, o.width, { dflt: 0, editType: "plot" }), dash: o.dash, editType: "style" }, visible: { valType: "boolean", dflt: true, editType: "plot" }, editType: "plot" }, offsetgroup: a.offsetgroup, alignmentgroup: a.alignmentgroup };
    }, { "../../components/color": 366, "../../lib/extend": 493, "../../plots/attributes": 550, "../../plots/cartesian/axis_format_attributes": 557, "../../plots/template_attributes": 633, "../bar/attributes": 648, "../scatter/attributes": 926, "./constants": 773 }], 772: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/cartesian/axes"), a = e("../../plots/cartesian/align_period"), o = e("./arrays_to_calcdata"), s = e("../scatter/calc_selection"), i = e("../../constants/numerical").BADNUM;
      function l(u2) {
        return u2 === i ? 0 : u2;
      }
      t.exports = function(u2, c) {
        var f, h, p, d, v, m, g, x, b = n.getFromId(u2, c.xaxis || "x"), y = n.getFromId(u2, c.yaxis || "y");
        c.orientation === "h" ? (f = b.makeCalcdata(c, "x"), p = y.makeCalcdata(c, "y"), d = a(c, y, "y", p), v = !!c.yperiodalignment, m = "y") : (f = y.makeCalcdata(c, "y"), p = b.makeCalcdata(c, "x"), d = a(c, b, "x", p), v = !!c.xperiodalignment, m = "x"), h = d.vals;
        var w, _4 = Math.min(h.length, f.length), k = new Array(_4);
        for (c._base = [], g = 0; g < _4; g++) {
          f[g] < 0 && (f[g] = i);
          var T2 = false;
          f[g] !== i && g + 1 < _4 && f[g + 1] !== i && (T2 = true), x = k[g] = { p: h[g], s: f[g], cNext: T2 }, c._base[g] = -0.5 * x.s, v && (k[g].orig_p = p[g], k[g][m + "End"] = d.ends[g], k[g][m + "Start"] = d.starts[g]), c.ids && (x.id = String(c.ids[g])), g === 0 && (k[0].vTotal = 0), k[0].vTotal += l(x.s), x.begR = l(x.s) / l(k[0].s);
        }
        for (g = 0; g < _4; g++) (x = k[g]).s !== i && (x.sumR = x.s / k[0].vTotal, x.difR = w !== void 0 ? x.s / w : 1, w = x.s);
        return o(k, c), s(k, c), k;
      };
    }, { "../../constants/numerical": 479, "../../plots/cartesian/align_period": 551, "../../plots/cartesian/axes": 554, "../scatter/calc_selection": 928, "./arrays_to_calcdata": 770 }], 773: [function(e, t, r) {
      "use strict";
      t.exports = { eventDataKeys: ["percentInitial", "percentPrevious", "percentTotal"] };
    }, {}], 774: [function(e, t, r) {
      "use strict";
      var n = e("../bar/cross_trace_calc").setGroupPositions;
      t.exports = function(a, o) {
        var s, i, l = a._fullLayout, u2 = a._fullData, c = a.calcdata, f = o.xaxis, h = o.yaxis, p = [], d = [], v = [];
        for (i = 0; i < u2.length; i++) {
          var m = u2[i], g = m.orientation === "h";
          m.visible === true && m.xaxis === f._id && m.yaxis === h._id && m.type === "funnel" && (s = c[i], g ? v.push(s) : d.push(s), p.push(s));
        }
        var x = { mode: l.funnelmode, norm: l.funnelnorm, gap: l.funnelgap, groupgap: l.funnelgroupgap };
        for (n(a, f, h, d, x), n(a, h, f, v, x), i = 0; i < p.length; i++) {
          s = p[i];
          for (var b = 0; b < s.length; b++) b + 1 < s.length && (s[b].nextP0 = s[b + 1].p0, s[b].nextS0 = s[b + 1].s0, s[b].nextP1 = s[b + 1].p1, s[b].nextS1 = s[b + 1].s1);
        }
      };
    }, { "../bar/cross_trace_calc": 651 }], 775: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../bar/defaults").handleGroupingDefaults, o = e("../bar/defaults").handleText, s = e("../scatter/xy_defaults"), i = e("../scatter/period_defaults"), l = e("./attributes"), u2 = e("../../components/color");
      t.exports = { supplyDefaults: function(c, f, h, p) {
        function d(x, b) {
          return n.coerce(c, f, l, x, b);
        }
        if (s(c, f, p, d)) {
          i(c, f, p, d), d("xhoverformat"), d("yhoverformat"), d("orientation", f.y && !f.x ? "v" : "h"), d("offset"), d("width");
          var v = d("text");
          d("hovertext"), d("hovertemplate");
          var m = d("textposition");
          o(c, f, p, d, m, { moduleHasSelected: false, moduleHasUnselected: false, moduleHasConstrain: true, moduleHasCliponaxis: true, moduleHasTextangle: true, moduleHasInsideanchor: true }), f.textposition === "none" || f.texttemplate || d("textinfo", Array.isArray(v) ? "text+value" : "value");
          var g = d("marker.color", h);
          d("marker.line.color", u2.defaultLine), d("marker.line.width"), d("connector.visible") && (d("connector.fillcolor", function(x) {
            var b = n.isArrayOrTypedArray(x) ? "#000" : x;
            return u2.addOpacity(b, 0.5 * u2.opacity(b));
          }(g)), d("connector.line.width") && (d("connector.line.color"), d("connector.line.dash")));
        } else f.visible = false;
      }, crossTraceDefaults: function(c, f) {
        var h, p;
        function d(m) {
          return n.coerce(p._input, p, l, m);
        }
        if (f.funnelmode === "group") for (var v = 0; v < c.length; v++) h = (p = c[v])._input, a(h, p, f, d);
      } };
    }, { "../../components/color": 366, "../../lib": 503, "../bar/defaults": 652, "../scatter/period_defaults": 946, "../scatter/xy_defaults": 953, "./attributes": 771 }], 776: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a) {
        return n.x = "xVal" in a ? a.xVal : a.x, n.y = "yVal" in a ? a.yVal : a.y, "percentInitial" in a && (n.percentInitial = a.percentInitial), "percentPrevious" in a && (n.percentPrevious = a.percentPrevious), "percentTotal" in a && (n.percentTotal = a.percentTotal), a.xa && (n.xaxis = a.xa), a.ya && (n.yaxis = a.ya), n;
      };
    }, {}], 777: [function(e, t, r) {
      "use strict";
      var n = e("../../components/color").opacity, a = e("../bar/hover").hoverOnBars, o = e("../../lib").formatPercent;
      t.exports = function(s, i, l, u2, c) {
        var f = a(s, i, l, u2, c);
        if (f) {
          var h = f.cd, p = h[0].trace, d = p.orientation === "h", v = h[f.index];
          f[(d ? "x" : "y") + "LabelVal"] = v.s, f.percentInitial = v.begR, f.percentInitialLabel = o(v.begR, 1), f.percentPrevious = v.difR, f.percentPreviousLabel = o(v.difR, 1), f.percentTotal = v.sumR, f.percentTotalLabel = o(v.sumR, 1);
          var m = v.hi || p.hoverinfo, g = [];
          if (m && m !== "none" && m !== "skip") {
            var x = m === "all", b = m.split("+"), y = function(w) {
              return x || b.indexOf(w) !== -1;
            };
            y("percent initial") && g.push(f.percentInitialLabel + " of initial"), y("percent previous") && g.push(f.percentPreviousLabel + " of previous"), y("percent total") && g.push(f.percentTotalLabel + " of total");
          }
          return f.extraText = g.join("<br>"), f.color = function(w, _4) {
            var k = w.marker, T2 = _4.mc || k.color, A2 = _4.mlc || k.line.color, S2 = _4.mlw || k.line.width;
            if (n(T2)) return T2;
            if (n(A2) && S2) return A2;
          }(p, v), [f];
        }
      };
    }, { "../../components/color": 366, "../../lib": 503, "../bar/hover": 655 }], 778: [function(e, t, r) {
      "use strict";
      t.exports = { attributes: e("./attributes"), layoutAttributes: e("./layout_attributes"), supplyDefaults: e("./defaults").supplyDefaults, crossTraceDefaults: e("./defaults").crossTraceDefaults, supplyLayoutDefaults: e("./layout_defaults"), calc: e("./calc"), crossTraceCalc: e("./cross_trace_calc"), plot: e("./plot"), style: e("./style").style, hoverPoints: e("./hover"), eventData: e("./event_data"), selectPoints: e("../bar/select"), moduleType: "trace", name: "funnel", basePlotModule: e("../../plots/cartesian"), categories: ["bar-like", "cartesian", "svg", "oriented", "showLegend", "zoomScale"], meta: {} };
    }, { "../../plots/cartesian": 568, "../bar/select": 660, "./attributes": 771, "./calc": 772, "./cross_trace_calc": 774, "./defaults": 775, "./event_data": 776, "./hover": 777, "./layout_attributes": 779, "./layout_defaults": 780, "./plot": 781, "./style": 782 }], 779: [function(e, t, r) {
      "use strict";
      t.exports = { funnelmode: { valType: "enumerated", values: ["stack", "group", "overlay"], dflt: "stack", editType: "calc" }, funnelgap: { valType: "number", min: 0, max: 1, editType: "calc" }, funnelgroupgap: { valType: "number", min: 0, max: 1, dflt: 0, editType: "calc" } };
    }, {}], 780: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("./layout_attributes");
      t.exports = function(o, s, i) {
        var l = false;
        function u2(h, p) {
          return n.coerce(o, s, a, h, p);
        }
        for (var c = 0; c < i.length; c++) {
          var f = i[c];
          if (f.visible && f.type === "funnel") {
            l = true;
            break;
          }
        }
        l && (u2("funnelmode"), u2("funnelgap", 0.2), u2("funnelgroupgap"));
      };
    }, { "../../lib": 503, "./layout_attributes": 779 }], 781: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../lib"), o = e("../../components/drawing"), s = e("../../constants/numerical").BADNUM, i = e("../bar/plot"), l = e("../bar/uniform_text").clearMinTextSize;
      function u2(c, f, h, p) {
        var d = [], v = [], m = p ? f : h, g = p ? h : f;
        return d[0] = m.c2p(c.s0, true), v[0] = g.c2p(c.p0, true), d[1] = m.c2p(c.s1, true), v[1] = g.c2p(c.p1, true), d[2] = m.c2p(c.nextS0, true), v[2] = g.c2p(c.nextP0, true), d[3] = m.c2p(c.nextS1, true), v[3] = g.c2p(c.nextP1, true), p ? [d, v] : [v, d];
      }
      t.exports = function(c, f, h, p) {
        var d = c._fullLayout;
        l("funnel", d), function(v, m, g, x) {
          var b = m.xaxis, y = m.yaxis;
          a.makeTraceGroups(x, g, "trace bars").each(function(w) {
            var _4 = n.select(this), k = w[0].trace, T2 = a.ensureSingle(_4, "g", "regions");
            if (k.connector && k.connector.visible) {
              var A2 = k.orientation === "h", S2 = T2.selectAll("g.region").data(a.identity);
              S2.enter().append("g").classed("region", true), S2.exit().remove();
              var C2 = S2.size();
              S2.each(function(E2, F13) {
                if (F13 === C2 - 1 || E2.cNext) {
                  var N2 = u2(E2, b, y, A2), D2 = N2[0], I2 = N2[1], O2 = "";
                  D2[0] !== s && I2[0] !== s && D2[1] !== s && I2[1] !== s && D2[2] !== s && I2[2] !== s && D2[3] !== s && I2[3] !== s && (O2 += A2 ? "M" + D2[0] + "," + I2[1] + "L" + D2[2] + "," + I2[2] + "H" + D2[3] + "L" + D2[1] + "," + I2[1] + "Z" : "M" + D2[1] + "," + I2[1] + "L" + D2[2] + "," + I2[3] + "V" + I2[2] + "L" + D2[1] + "," + I2[0] + "Z"), O2 === "" && (O2 = "M0,0Z"), a.ensureSingle(n.select(this), "path").attr("d", O2).call(o.setClipUrl, m.layerClipId, v);
                }
              });
            } else T2.remove();
          });
        }(c, f, h, p), function(v, m, g, x) {
          var b = m.xaxis, y = m.yaxis;
          a.makeTraceGroups(x, g, "trace bars").each(function(w) {
            var _4 = n.select(this), k = w[0].trace, T2 = a.ensureSingle(_4, "g", "lines");
            if (k.connector && k.connector.visible && k.connector.line.width) {
              var A2 = k.orientation === "h", S2 = T2.selectAll("g.line").data(a.identity);
              S2.enter().append("g").classed("line", true), S2.exit().remove();
              var C2 = S2.size();
              S2.each(function(E2, F13) {
                if (F13 === C2 - 1 || E2.cNext) {
                  var N2 = u2(E2, b, y, A2), D2 = N2[0], I2 = N2[1], O2 = "";
                  D2[3] !== void 0 && I2[3] !== void 0 && (A2 ? (O2 += "M" + D2[0] + "," + I2[1] + "L" + D2[2] + "," + I2[2], O2 += "M" + D2[1] + "," + I2[1] + "L" + D2[3] + "," + I2[2]) : (O2 += "M" + D2[1] + "," + I2[1] + "L" + D2[2] + "," + I2[3], O2 += "M" + D2[1] + "," + I2[0] + "L" + D2[2] + "," + I2[2])), O2 === "" && (O2 = "M0,0Z"), a.ensureSingle(n.select(this), "path").attr("d", O2).call(o.setClipUrl, m.layerClipId, v);
                }
              });
            } else T2.remove();
          });
        }(c, f, h, p), i.plot(c, f, h, p, { mode: d.funnelmode, norm: d.funnelmode, gap: d.funnelgap, groupgap: d.funnelgroupgap });
      };
    }, { "../../components/drawing": 388, "../../constants/numerical": 479, "../../lib": 503, "../bar/plot": 659, "../bar/uniform_text": 664, "@plotly/d3": 58 }], 782: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../components/drawing"), o = e("../../components/color"), s = e("../../constants/interactions").DESELECTDIM, i = e("../bar/style"), l = e("../bar/uniform_text").resizeText, u2 = i.styleTextPoints;
      t.exports = { style: function(c, f, h) {
        var p = h || n.select(c).selectAll("g.funnellayer").selectAll("g.trace");
        l(c, p, "funnel"), p.style("opacity", function(d) {
          return d[0].trace.opacity;
        }), p.each(function(d) {
          var v = n.select(this), m = d[0].trace;
          v.selectAll(".point > path").each(function(g) {
            if (!g.isBlank) {
              var x = m.marker;
              n.select(this).call(o.fill, g.mc || x.color).call(o.stroke, g.mlc || x.line.color).call(a.dashLine, x.line.dash, g.mlw || x.line.width).style("opacity", m.selectedpoints && !g.selected ? s : 1);
            }
          }), u2(v, m, c), v.selectAll(".regions").each(function() {
            n.select(this).selectAll("path").style("stroke-width", 0).call(o.fill, m.connector.fillcolor);
          }), v.selectAll(".lines").each(function() {
            var g = m.connector.line;
            a.lineGroupStyle(n.select(this).selectAll("path"), g.width, g.color, g.dash);
          });
        });
      } };
    }, { "../../components/color": 366, "../../components/drawing": 388, "../../constants/interactions": 478, "../bar/style": 662, "../bar/uniform_text": 664, "@plotly/d3": 58 }], 783: [function(e, t, r) {
      "use strict";
      var n = e("../pie/attributes"), a = e("../../plots/attributes"), o = e("../../plots/domain").attributes, s = e("../../plots/template_attributes").hovertemplateAttrs, i = e("../../plots/template_attributes").texttemplateAttrs, l = e("../../lib/extend").extendFlat;
      t.exports = { labels: n.labels, label0: n.label0, dlabel: n.dlabel, values: n.values, marker: { colors: n.marker.colors, line: { color: l({}, n.marker.line.color, { dflt: null }), width: l({}, n.marker.line.width, { dflt: 1 }), editType: "calc" }, editType: "calc" }, text: n.text, hovertext: n.hovertext, scalegroup: l({}, n.scalegroup, {}), textinfo: l({}, n.textinfo, { flags: ["label", "text", "value", "percent"] }), texttemplate: i({ editType: "plot" }, { keys: ["label", "color", "value", "text", "percent"] }), hoverinfo: l({}, a.hoverinfo, { flags: ["label", "text", "value", "percent", "name"] }), hovertemplate: s({}, { keys: ["label", "color", "value", "text", "percent"] }), textposition: l({}, n.textposition, { values: ["inside", "none"], dflt: "inside" }), textfont: n.textfont, insidetextfont: n.insidetextfont, title: { text: n.title.text, font: n.title.font, position: l({}, n.title.position, { values: ["top left", "top center", "top right"], dflt: "top center" }), editType: "plot" }, domain: o({ name: "funnelarea", trace: true, editType: "calc" }), aspectratio: { valType: "number", min: 0, dflt: 1, editType: "plot" }, baseratio: { valType: "number", min: 0, max: 1, dflt: 0.333, editType: "plot" } };
    }, { "../../lib/extend": 493, "../../plots/attributes": 550, "../../plots/domain": 584, "../../plots/template_attributes": 633, "../pie/attributes": 900 }], 784: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/plots");
      r.name = "funnelarea", r.plot = function(a, o, s, i) {
        n.plotBasePlot(r.name, a, o, s, i);
      }, r.clean = function(a, o, s, i) {
        n.cleanBasePlot(r.name, a, o, s, i);
      };
    }, { "../../plots/plots": 619 }], 785: [function(e, t, r) {
      "use strict";
      var n = e("../pie/calc");
      t.exports = { calc: function(a, o) {
        return n.calc(a, o);
      }, crossTraceCalc: function(a) {
        n.crossTraceCalc(a, { type: "funnelarea" });
      } };
    }, { "../pie/calc": 902 }], 786: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("./attributes"), o = e("../../plots/domain").defaults, s = e("../bar/defaults").handleText, i = e("../pie/defaults").handleLabelsAndValues;
      t.exports = function(l, u2, c, f) {
        function h(w, _4) {
          return n.coerce(l, u2, a, w, _4);
        }
        var p = h("labels"), d = h("values"), v = i(p, d), m = v.len;
        if (u2._hasLabels = v.hasLabels, u2._hasValues = v.hasValues, !u2._hasLabels && u2._hasValues && (h("label0"), h("dlabel")), m) {
          u2._length = m, h("marker.line.width") && h("marker.line.color", f.paper_bgcolor), h("marker.colors"), h("scalegroup");
          var g, x = h("text"), b = h("texttemplate");
          if (b || (g = h("textinfo", Array.isArray(x) ? "text+percent" : "percent")), h("hovertext"), h("hovertemplate"), b || g && g !== "none") {
            var y = h("textposition");
            s(l, u2, f, h, y, { moduleHasSelected: false, moduleHasUnselected: false, moduleHasConstrain: false, moduleHasCliponaxis: false, moduleHasTextangle: false, moduleHasInsideanchor: false });
          }
          o(u2, f, h), h("title.text") && (h("title.position"), n.coerceFont(h, "title.font", f.font)), h("aspectratio"), h("baseratio");
        } else u2.visible = false;
      };
    }, { "../../lib": 503, "../../plots/domain": 584, "../bar/defaults": 652, "../pie/defaults": 903, "./attributes": 783 }], 787: [function(e, t, r) {
      "use strict";
      t.exports = { moduleType: "trace", name: "funnelarea", basePlotModule: e("./base_plot"), categories: ["pie-like", "funnelarea", "showLegend"], attributes: e("./attributes"), layoutAttributes: e("./layout_attributes"), supplyDefaults: e("./defaults"), supplyLayoutDefaults: e("./layout_defaults"), calc: e("./calc").calc, crossTraceCalc: e("./calc").crossTraceCalc, plot: e("./plot"), style: e("./style"), styleOne: e("../pie/style_one"), meta: {} };
    }, { "../pie/style_one": 911, "./attributes": 783, "./base_plot": 784, "./calc": 785, "./defaults": 786, "./layout_attributes": 788, "./layout_defaults": 789, "./plot": 790, "./style": 791 }], 788: [function(e, t, r) {
      "use strict";
      var n = e("../pie/layout_attributes").hiddenlabels;
      t.exports = { hiddenlabels: n, funnelareacolorway: { valType: "colorlist", editType: "calc" }, extendfunnelareacolors: { valType: "boolean", dflt: true, editType: "calc" } };
    }, { "../pie/layout_attributes": 907 }], 789: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("./layout_attributes");
      t.exports = function(o, s) {
        function i(l, u2) {
          return n.coerce(o, s, a, l, u2);
        }
        i("hiddenlabels"), i("funnelareacolorway", s.colorway), i("extendfunnelareacolors");
      };
    }, { "../../lib": 503, "./layout_attributes": 788 }], 790: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../components/drawing"), o = e("../../lib"), s = o.strScale, i = o.strTranslate, l = e("../../lib/svg_text_utils"), u2 = e("../bar/plot").toMoveInsideBar, c = e("../bar/uniform_text"), f = c.recordMinTextSize, h = c.clearMinTextSize, p = e("../pie/helpers"), d = e("../pie/plot"), v = d.attachFxHandlers, m = d.determineInsideTextFont, g = d.layoutAreas, x = d.prerenderTitles, b = d.positionTitleOutside, y = d.formatSliceLabel;
      function w(_4, k) {
        return "l" + (k[0] - _4[0]) + "," + (k[1] - _4[1]);
      }
      t.exports = function(_4, k) {
        var T2 = _4._fullLayout;
        h("funnelarea", T2), x(k, _4), g(k, T2._size), o.makeTraceGroups(T2._funnelarealayer, k, "trace").each(function(A2) {
          var S2 = n.select(this), C2 = A2[0], E2 = C2.trace;
          (function(F13) {
            if (!F13.length) return;
            var N2 = F13[0], D2 = N2.trace, I2 = D2.aspectratio, O2 = D2.baseratio;
            O2 > 0.999 && (O2 = 0.999);
            var L2, V2 = Math.pow(O2, 2), W2 = N2.vTotal, X2 = W2, Y2 = W2 * V2 / (1 - V2) / W2;
            function K2() {
              var be, Ae = { x: be = Math.sqrt(Y2), y: -be };
              return [Ae.x, Ae.y];
            }
            var q, re, R2 = [];
            for (R2.push(K2()), q = F13.length - 1; q > -1; q--) if (!(re = F13[q]).hidden) {
              var z = re.v / X2;
              Y2 += z, R2.push(K2());
            }
            var H2 = 1 / 0, te = -1 / 0;
            for (q = 0; q < R2.length; q++) L2 = R2[q], H2 = Math.min(H2, L2[1]), te = Math.max(te, L2[1]);
            for (q = 0; q < R2.length; q++) R2[q][1] -= (te + H2) / 2;
            var j = R2[R2.length - 1][0], Q2 = N2.r, Z2 = (te - H2) / 2, ne = Q2 / j, ae = Q2 / Z2 * I2;
            for (N2.r = ae * Z2, q = 0; q < R2.length; q++) R2[q][0] *= ne, R2[q][1] *= ae;
            var ue = [-(L2 = R2[0])[0], L2[1]], le = [L2[0], L2[1]], ce = 0;
            for (q = F13.length - 1; q > -1; q--) if (!(re = F13[q]).hidden) {
              var se = R2[ce += 1][0], he = R2[ce][1];
              re.TL = [-se, he], re.TR = [se, he], re.BL = ue, re.BR = le, re.pxmid = (me = re.TR, we = re.BR, [0.5 * (me[0] + we[0]), 0.5 * (me[1] + we[1])]), ue = re.TL, le = re.TR;
            }
            var me, we;
          })(A2), S2.each(function() {
            var F13 = n.select(this).selectAll("g.slice").data(A2);
            F13.enter().append("g").classed("slice", true), F13.exit().remove(), F13.each(function(D2, I2) {
              if (D2.hidden) n.select(this).selectAll("path,g").remove();
              else {
                D2.pointNumber = D2.i, D2.curveNumber = E2.index;
                var O2 = C2.cx, L2 = C2.cy, V2 = n.select(this), W2 = V2.selectAll("path.surface").data([D2]);
                W2.enter().append("path").classed("surface", true).style({ "pointer-events": "all" }), V2.call(v, _4, A2);
                var X2 = "M" + (O2 + D2.TR[0]) + "," + (L2 + D2.TR[1]) + w(D2.TR, D2.BR) + w(D2.BR, D2.BL) + w(D2.BL, D2.TL) + "Z";
                W2.attr("d", X2), y(_4, D2, C2);
                var Y2 = p.castOption(E2.textposition, D2.pts), K2 = V2.selectAll("g.slicetext").data(D2.text && Y2 !== "none" ? [0] : []);
                K2.enter().append("g").classed("slicetext", true), K2.exit().remove(), K2.each(function() {
                  var q = o.ensureSingle(n.select(this), "text", "", function(Z2) {
                    Z2.attr("data-notex", 1);
                  }), re = o.ensureUniformFontSize(_4, m(E2, D2, T2.font));
                  q.text(D2.text).attr({ class: "slicetext", transform: "", "text-anchor": "middle" }).call(a.font, re).call(l.convertToTspans, _4);
                  var R2, z, H2, te = a.bBox(q.node()), j = Math.min(D2.BL[1], D2.BR[1]) + L2, Q2 = Math.max(D2.TL[1], D2.TR[1]) + L2;
                  z = Math.max(D2.TL[0], D2.BL[0]) + O2, H2 = Math.min(D2.TR[0], D2.BR[0]) + O2, (R2 = u2(z, H2, j, Q2, te, { isHorizontal: true, constrained: true, angle: 0, anchor: "middle" })).fontSize = re.size, f(E2.type, R2, T2), A2[I2].transform = R2, q.attr("transform", o.getTextTransform(R2));
                });
              }
            });
            var N2 = n.select(this).selectAll("g.titletext").data(E2.title.text ? [0] : []);
            N2.enter().append("g").classed("titletext", true), N2.exit().remove(), N2.each(function() {
              var D2 = o.ensureSingle(n.select(this), "text", "", function(L2) {
                L2.attr("data-notex", 1);
              }), I2 = E2.title.text;
              E2._meta && (I2 = o.templateString(I2, E2._meta)), D2.text(I2).attr({ class: "titletext", transform: "", "text-anchor": "middle" }).call(a.font, E2.title.font).call(l.convertToTspans, _4);
              var O2 = b(C2, T2._size);
              D2.attr("transform", i(O2.x, O2.y) + s(Math.min(1, O2.scale)) + i(O2.tx, O2.ty));
            });
          });
        });
      };
    }, { "../../components/drawing": 388, "../../lib": 503, "../../lib/svg_text_utils": 529, "../bar/plot": 659, "../bar/uniform_text": 664, "../pie/helpers": 905, "../pie/plot": 909, "@plotly/d3": 58 }], 791: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../pie/style_one"), o = e("../bar/uniform_text").resizeText;
      t.exports = function(s) {
        var i = s._fullLayout._funnelarealayer.selectAll(".trace");
        o(s, i, "funnelarea"), i.each(function(l) {
          var u2 = l[0].trace, c = n.select(this);
          c.style({ opacity: u2.opacity }), c.selectAll("path.surface").each(function(f) {
            n.select(this).call(a, f, u2);
          });
        });
      };
    }, { "../bar/uniform_text": 664, "../pie/style_one": 911, "@plotly/d3": 58 }], 792: [function(e, t, r) {
      "use strict";
      var n = e("../scatter/attributes"), a = e("../../plots/attributes"), o = e("../../plots/font_attributes"), s = e("../../plots/cartesian/axis_format_attributes").axisHoverFormat, i = e("../../plots/template_attributes").hovertemplateAttrs, l = e("../../plots/template_attributes").texttemplateAttrs, u2 = e("../../components/colorscale/attributes"), c = e("../../lib/extend").extendFlat;
      t.exports = c({ z: { valType: "data_array", editType: "calc" }, x: c({}, n.x, { impliedEdits: { xtype: "array" } }), x0: c({}, n.x0, { impliedEdits: { xtype: "scaled" } }), dx: c({}, n.dx, { impliedEdits: { xtype: "scaled" } }), y: c({}, n.y, { impliedEdits: { ytype: "array" } }), y0: c({}, n.y0, { impliedEdits: { ytype: "scaled" } }), dy: c({}, n.dy, { impliedEdits: { ytype: "scaled" } }), xperiod: c({}, n.xperiod, { impliedEdits: { xtype: "scaled" } }), yperiod: c({}, n.yperiod, { impliedEdits: { ytype: "scaled" } }), xperiod0: c({}, n.xperiod0, { impliedEdits: { xtype: "scaled" } }), yperiod0: c({}, n.yperiod0, { impliedEdits: { ytype: "scaled" } }), xperiodalignment: c({}, n.xperiodalignment, { impliedEdits: { xtype: "scaled" } }), yperiodalignment: c({}, n.yperiodalignment, { impliedEdits: { ytype: "scaled" } }), text: { valType: "data_array", editType: "calc" }, hovertext: { valType: "data_array", editType: "calc" }, transpose: { valType: "boolean", dflt: false, editType: "calc" }, xtype: { valType: "enumerated", values: ["array", "scaled"], editType: "calc+clearAxisTypes" }, ytype: { valType: "enumerated", values: ["array", "scaled"], editType: "calc+clearAxisTypes" }, zsmooth: { valType: "enumerated", values: ["fast", "best", false], dflt: false, editType: "calc" }, hoverongaps: { valType: "boolean", dflt: true, editType: "none" }, connectgaps: { valType: "boolean", editType: "calc" }, xgap: { valType: "number", dflt: 0, min: 0, editType: "plot" }, ygap: { valType: "number", dflt: 0, min: 0, editType: "plot" }, xhoverformat: s("x"), yhoverformat: s("y"), zhoverformat: s("z", 1), hovertemplate: i(), texttemplate: l({ arrayOk: false, editType: "plot" }, { keys: ["x", "y", "z", "text"] }), textfont: o({ editType: "plot", autoSize: true, autoColor: true, colorEditType: "style" }), showlegend: c({}, a.showlegend, { dflt: false }) }, { transforms: void 0 }, u2("", { cLetter: "z", autoColorDflt: false }));
    }, { "../../components/colorscale/attributes": 373, "../../lib/extend": 493, "../../plots/attributes": 550, "../../plots/cartesian/axis_format_attributes": 557, "../../plots/font_attributes": 585, "../../plots/template_attributes": 633, "../scatter/attributes": 926 }], 793: [function(e, t, r) {
      "use strict";
      var n = e("../../registry"), a = e("../../lib"), o = e("../../plots/cartesian/axes"), s = e("../../plots/cartesian/align_period"), i = e("../histogram2d/calc"), l = e("../../components/colorscale/calc"), u2 = e("./convert_column_xyz"), c = e("./clean_2d_array"), f = e("./interp2d"), h = e("./find_empties"), p = e("./make_bound_array"), d = e("../../constants/numerical").BADNUM;
      function v(m) {
        for (var g = [], x = m.length, b = 0; b < x; b++) {
          var y = m[b];
          y !== d && g.push(y);
        }
        return g;
      }
      t.exports = function(m, g) {
        var x, b, y, w, _4, k, T2, A2, S2, C2, E2, F13 = o.getFromId(m, g.xaxis || "x"), N2 = o.getFromId(m, g.yaxis || "y"), D2 = n.traceIs(g, "contour"), I2 = n.traceIs(g, "histogram"), O2 = n.traceIs(g, "gl2d"), L2 = D2 ? "best" : g.zsmooth;
        if (F13._minDtick = 0, N2._minDtick = 0, I2) w = (E2 = i(m, g)).orig_x, x = E2.x, b = E2.x0, y = E2.dx, A2 = E2.orig_y, _4 = E2.y, k = E2.y0, T2 = E2.dy, S2 = E2.z;
        else {
          var V2 = g.z;
          a.isArray1D(V2) ? (u2(g, F13, N2, "x", "y", ["z"]), x = g._x, _4 = g._y, V2 = g._z) : (w = g.x ? F13.makeCalcdata(g, "x") : [], A2 = g.y ? N2.makeCalcdata(g, "y") : [], x = s(g, F13, "x", w).vals, _4 = s(g, N2, "y", A2).vals, g._x = x, g._y = _4), b = g.x0, y = g.dx, k = g.y0, T2 = g.dy, S2 = c(V2, g, F13, N2);
        }
        function W2(Z2) {
          L2 = g._input.zsmooth = g.zsmooth = false, a.warn('cannot use zsmooth: "fast": ' + Z2);
        }
        if ((F13.rangebreaks || N2.rangebreaks) && (S2 = function(Z2, ne, ae) {
          for (var ue = [], le = -1, ce = 0; ce < ae.length; ce++) if (ne[ce] !== d) {
            le++, ue[le] = [];
            for (var se = 0; se < ae[ce].length; se++) Z2[se] !== d && ue[le].push(ae[ce][se]);
          }
          return ue;
        }(x, _4, S2), I2 || (x = v(x), _4 = v(_4), g._x = x, g._y = _4)), I2 || !D2 && !g.connectgaps || (g._emptypoints = h(S2), f(S2, g._emptypoints)), L2 === "fast") {
          if (F13.type === "log" || N2.type === "log") W2("log axis found");
          else if (!I2) {
            if (x.length) {
              var X2 = (x[x.length - 1] - x[0]) / (x.length - 1), Y2 = Math.abs(X2 / 100);
              for (C2 = 0; C2 < x.length - 1; C2++) if (Math.abs(x[C2 + 1] - x[C2] - X2) > Y2) {
                W2("x scale is not linear");
                break;
              }
            }
            if (_4.length && L2 === "fast") {
              var K2 = (_4[_4.length - 1] - _4[0]) / (_4.length - 1), q = Math.abs(K2 / 100);
              for (C2 = 0; C2 < _4.length - 1; C2++) if (Math.abs(_4[C2 + 1] - _4[C2] - K2) > q) {
                W2("y scale is not linear");
                break;
              }
            }
          }
        }
        var re = a.maxRowLength(S2), R2 = g.xtype === "scaled" ? "" : x, z = p(g, R2, b, y, re, F13), H2 = g.ytype === "scaled" ? "" : _4, te = p(g, H2, k, T2, S2.length, N2);
        O2 || (g._extremes[F13._id] = o.findExtremes(F13, z), g._extremes[N2._id] = o.findExtremes(N2, te));
        var j = { x: z, y: te, z: S2, text: g._text || g.text, hovertext: g._hovertext || g.hovertext };
        if (g.xperiodalignment && w && (j.orig_x = w), g.yperiodalignment && A2 && (j.orig_y = A2), R2 && R2.length === z.length - 1 && (j.xCenter = R2), H2 && H2.length === te.length - 1 && (j.yCenter = H2), I2 && (j.xRanges = E2.xRanges, j.yRanges = E2.yRanges, j.pts = E2.pts), D2 || l(m, g, { vals: S2, cLetter: "z" }), D2 && g.contours && g.contours.coloring === "heatmap") {
          var Q2 = { type: g.type === "contour" ? "heatmap" : "histogram2d", xcalendar: g.xcalendar, ycalendar: g.ycalendar };
          j.xfill = p(Q2, R2, b, y, re, F13), j.yfill = p(Q2, H2, k, T2, S2.length, N2);
        }
        return [j];
      };
    }, { "../../components/colorscale/calc": 374, "../../constants/numerical": 479, "../../lib": 503, "../../plots/cartesian/align_period": 551, "../../plots/cartesian/axes": 554, "../../registry": 638, "../histogram2d/calc": 826, "./clean_2d_array": 794, "./convert_column_xyz": 796, "./find_empties": 798, "./interp2d": 801, "./make_bound_array": 803 }], 794: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("../../lib"), o = e("../../constants/numerical").BADNUM;
      t.exports = function(s, i, l, u2) {
        var c, f, h, p, d, v;
        function m(_4) {
          if (n(_4)) return +_4;
        }
        if (i && i.transpose) {
          for (c = 0, d = 0; d < s.length; d++) c = Math.max(c, s[d].length);
          if (c === 0) return false;
          h = function(_4) {
            return _4.length;
          }, p = function(_4, k, T2) {
            return (_4[T2] || [])[k];
          };
        } else c = s.length, h = function(_4, k) {
          return _4[k].length;
        }, p = function(_4, k, T2) {
          return (_4[k] || [])[T2];
        };
        var g = function(_4, k, T2) {
          return k === o || T2 === o ? o : p(_4, k, T2);
        };
        function x(_4) {
          if (i && i.type !== "carpet" && i.type !== "contourcarpet" && _4 && _4.type === "category" && i["_" + _4._id.charAt(0)].length) {
            var k = _4._id.charAt(0), T2 = {}, A2 = i["_" + k + "CategoryMap"] || i[k];
            for (d = 0; d < A2.length; d++) T2[A2[d]] = d;
            return function(S2) {
              var C2 = T2[_4._categories[S2]];
              return C2 + 1 ? C2 : o;
            };
          }
          return a.identity;
        }
        var b = x(l), y = x(u2);
        u2 && u2.type === "category" && (c = u2._categories.length);
        var w = new Array(c);
        for (d = 0; d < c; d++) for (f = l && l.type === "category" ? l._categories.length : h(s, d), w[d] = new Array(f), v = 0; v < f; v++) w[d][v] = m(g(s, y(d), b(v)));
        return w;
      };
    }, { "../../constants/numerical": 479, "../../lib": 503, "fast-isnumeric": 190 }], 795: [function(e, t, r) {
      "use strict";
      t.exports = { min: "zmin", max: "zmax" };
    }, {}], 796: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../constants/numerical").BADNUM, o = e("../../plots/cartesian/align_period");
      t.exports = function(s, i, l, u2, c, f) {
        var h = s._length, p = i.makeCalcdata(s, u2), d = l.makeCalcdata(s, c);
        p = o(s, i, u2, p).vals, d = o(s, l, c, d).vals;
        var v, m, g, x, b = s.text, y = b !== void 0 && n.isArray1D(b), w = s.hovertext, _4 = w !== void 0 && n.isArray1D(w), k = n.distinctVals(p), T2 = k.vals, A2 = n.distinctVals(d), S2 = A2.vals, C2 = [], E2 = S2.length, F13 = T2.length;
        for (v = 0; v < f.length; v++) C2[v] = n.init2dArray(E2, F13);
        y && (g = n.init2dArray(E2, F13)), _4 && (x = n.init2dArray(E2, F13));
        var N2 = n.init2dArray(E2, F13);
        for (v = 0; v < h; v++) if (p[v] !== a && d[v] !== a) {
          var D2 = n.findBin(p[v] + k.minDiff / 2, T2), I2 = n.findBin(d[v] + A2.minDiff / 2, S2);
          for (m = 0; m < f.length; m++) {
            var O2 = s[f[m]];
            C2[m][I2][D2] = O2[v], N2[I2][D2] = v;
          }
          y && (g[I2][D2] = b[v]), _4 && (x[I2][D2] = w[v]);
        }
        for (s["_" + u2] = T2, s["_" + c] = S2, m = 0; m < f.length; m++) s["_" + f[m]] = C2[m];
        y && (s._text = g), _4 && (s._hovertext = x), i && i.type === "category" && (s["_" + u2 + "CategoryMap"] = T2.map(function(L2) {
          return i._categories[L2];
        })), l && l.type === "category" && (s["_" + c + "CategoryMap"] = S2.map(function(L2) {
          return l._categories[L2];
        })), s._after2before = N2;
      };
    }, { "../../constants/numerical": 479, "../../lib": 503, "../../plots/cartesian/align_period": 551 }], 797: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("./xyz_defaults"), o = e("./label_defaults"), s = e("../scatter/period_defaults"), i = e("./style_defaults"), l = e("../../components/colorscale/defaults"), u2 = e("./attributes");
      t.exports = function(c, f, h, p) {
        function d(v, m) {
          return n.coerce(c, f, u2, v, m);
        }
        a(c, f, d, p) ? (s(c, f, p, d), d("xhoverformat"), d("yhoverformat"), d("text"), d("hovertext"), d("hovertemplate"), o(d, p), i(c, f, d, p), d("hoverongaps"), d("connectgaps", n.isArray1D(f.z) && f.zsmooth !== false), l(c, f, p, d, { prefix: "", cLetter: "z" })) : f.visible = false;
      };
    }, { "../../components/colorscale/defaults": 376, "../../lib": 503, "../scatter/period_defaults": 946, "./attributes": 792, "./label_defaults": 802, "./style_defaults": 806, "./xyz_defaults": 807 }], 798: [function(e, t, r) {
      "use strict";
      var n = e("../../lib").maxRowLength;
      t.exports = function(a) {
        var o, s, i, l, u2, c, f, h, p = [], d = {}, v = [], m = a[0], g = [], x = [0, 0, 0], b = n(a);
        for (s = 0; s < a.length; s++) for (o = g, g = m, m = a[s + 1] || [], i = 0; i < b; i++) g[i] === void 0 && ((c = (g[i - 1] !== void 0 ? 1 : 0) + (g[i + 1] !== void 0 ? 1 : 0) + (o[i] !== void 0 ? 1 : 0) + (m[i] !== void 0 ? 1 : 0)) ? (s === 0 && c++, i === 0 && c++, s === a.length - 1 && c++, i === g.length - 1 && c++, c < 4 && (d[[s, i]] = [s, i, c]), p.push([s, i, c])) : v.push([s, i]));
        for (; v.length; ) {
          for (f = {}, h = false, u2 = v.length - 1; u2 >= 0; u2--) (c = ((d[[(s = (l = v[u2])[0]) - 1, i = l[1]]] || x)[2] + (d[[s + 1, i]] || x)[2] + (d[[s, i - 1]] || x)[2] + (d[[s, i + 1]] || x)[2]) / 20) && (f[l] = [s, i, c], v.splice(u2, 1), h = true);
          if (!h) throw "findEmpties iterated with no new neighbors";
          for (l in f) d[l] = f[l], p.push(f[l]);
        }
        return p.sort(function(y, w) {
          return w[2] - y[2];
        });
      };
    }, { "../../lib": 503 }], 799: [function(e, t, r) {
      "use strict";
      var n = e("../../components/fx"), a = e("../../lib"), o = e("../../plots/cartesian/axes"), s = e("../../components/colorscale").extractOpts;
      t.exports = function(i, l, u2, c, f) {
        f || (f = {});
        var h, p, d, v, m = f.isContour, g = i.cd[0], x = g.trace, b = i.xa, y = i.ya, w = g.x, _4 = g.y, k = g.z, T2 = g.xCenter, A2 = g.yCenter, S2 = g.zmask, C2 = x.zhoverformat, E2 = w, F13 = _4;
        if (i.index !== false) {
          try {
            d = Math.round(i.index[1]), v = Math.round(i.index[0]);
          } catch {
            return void a.error("Error hovering on heatmap, pointNumber must be [row,col], found:", i.index);
          }
          if (d < 0 || d >= k[0].length || v < 0 || v > k.length) return;
        } else {
          if (n.inbox(l - w[0], l - w[w.length - 1], 0) > 0 || n.inbox(u2 - _4[0], u2 - _4[_4.length - 1], 0) > 0) return;
          if (m) {
            var N2;
            for (E2 = [2 * w[0] - w[1]], N2 = 1; N2 < w.length; N2++) E2.push((w[N2] + w[N2 - 1]) / 2);
            for (E2.push([2 * w[w.length - 1] - w[w.length - 2]]), F13 = [2 * _4[0] - _4[1]], N2 = 1; N2 < _4.length; N2++) F13.push((_4[N2] + _4[N2 - 1]) / 2);
            F13.push([2 * _4[_4.length - 1] - _4[_4.length - 2]]);
          }
          d = Math.max(0, Math.min(E2.length - 2, a.findBin(l, E2))), v = Math.max(0, Math.min(F13.length - 2, a.findBin(u2, F13)));
        }
        var D2, I2, O2 = b.c2p(w[d]), L2 = b.c2p(w[d + 1]), V2 = y.c2p(_4[v]), W2 = y.c2p(_4[v + 1]);
        m ? (D2 = g.orig_x || w, I2 = g.orig_y || _4, L2 = O2, h = D2[d], W2 = V2, p = I2[v]) : (D2 = g.orig_x || T2 || w, I2 = g.orig_y || A2 || _4, h = T2 ? D2[d] : (D2[d] + D2[d + 1]) / 2, p = A2 ? I2[v] : (I2[v] + I2[v + 1]) / 2, b && b.type === "category" && (h = w[d]), y && y.type === "category" && (p = _4[v]), x.zsmooth && (O2 = L2 = b.c2p(h), V2 = W2 = y.c2p(p)));
        var X2 = k[v][d];
        if (S2 && !S2[v][d] && (X2 = void 0), X2 !== void 0 || x.hoverongaps) {
          var Y2;
          Array.isArray(g.hovertext) && Array.isArray(g.hovertext[v]) ? Y2 = g.hovertext[v][d] : Array.isArray(g.text) && Array.isArray(g.text[v]) && (Y2 = g.text[v][d]);
          var K2 = s(x), q = { type: "linear", range: [K2.min, K2.max], hoverformat: C2, _separators: b._separators, _numFormat: b._numFormat }, re = o.tickText(q, X2, "hover").text;
          return [a.extendFlat(i, { index: x._after2before ? x._after2before[v][d] : [v, d], distance: i.maxHoverDistance, spikeDistance: i.maxSpikeDistance, x0: O2, x1: L2, y0: V2, y1: W2, xLabelVal: h, yLabelVal: p, zLabelVal: X2, zLabel: re, text: Y2 })];
        }
      };
    }, { "../../components/colorscale": 378, "../../components/fx": 406, "../../lib": 503, "../../plots/cartesian/axes": 554 }], 800: [function(e, t, r) {
      "use strict";
      t.exports = { attributes: e("./attributes"), supplyDefaults: e("./defaults"), calc: e("./calc"), plot: e("./plot"), colorbar: e("./colorbar"), style: e("./style"), hoverPoints: e("./hover"), moduleType: "trace", name: "heatmap", basePlotModule: e("../../plots/cartesian"), categories: ["cartesian", "svg", "2dMap", "showLegend"], meta: {} };
    }, { "../../plots/cartesian": 568, "./attributes": 792, "./calc": 793, "./colorbar": 795, "./defaults": 797, "./hover": 799, "./plot": 804, "./style": 805 }], 801: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = [[-1, 0], [1, 0], [0, -1], [0, 1]];
      function o(i) {
        return 0.5 - 0.25 * Math.min(1, 0.5 * i);
      }
      function s(i, l, u2) {
        var c, f, h, p, d, v, m, g, x, b, y, w, _4, k = 0;
        for (p = 0; p < l.length; p++) {
          for (f = (c = l[p])[0], h = c[1], y = i[f][h], b = 0, x = 0, d = 0; d < 4; d++) (m = i[f + (v = a[d])[0]]) && (g = m[h + v[1]]) !== void 0 && (b === 0 ? w = _4 = g : (w = Math.min(w, g), _4 = Math.max(_4, g)), x++, b += g);
          if (x === 0) throw "iterateInterp2d order is wrong: no defined neighbors";
          i[f][h] = b / x, y === void 0 ? x < 4 && (k = 1) : (i[f][h] = (1 + u2) * i[f][h] - u2 * y, _4 > w && (k = Math.max(k, Math.abs(i[f][h] - y) / (_4 - w))));
        }
        return k;
      }
      t.exports = function(i, l) {
        var u2, c = 1;
        for (s(i, l), u2 = 0; u2 < l.length && !(l[u2][2] < 4); u2++) ;
        for (l = l.slice(u2), u2 = 0; u2 < 100 && c > 0.01; u2++) c = s(i, l, o(c));
        return c > 0.01 && n.log("interp2d didn't converge quickly", c), i;
      };
    }, { "../../lib": 503 }], 802: [function(e, t, r) {
      "use strict";
      var n = e("../../lib");
      t.exports = function(a, o) {
        a("texttemplate");
        var s = n.extendFlat({}, o.font, { color: "auto", size: "auto" });
        n.coerceFont(a, "textfont", s);
      };
    }, { "../../lib": 503 }], 803: [function(e, t, r) {
      "use strict";
      var n = e("../../registry"), a = e("../../lib").isArrayOrTypedArray;
      t.exports = function(o, s, i, l, u2, c) {
        var f, h, p, d = [], v = n.traceIs(o, "contour"), m = n.traceIs(o, "histogram"), g = n.traceIs(o, "gl2d");
        if (a(s) && s.length > 1 && !m && c.type !== "category") {
          var x = s.length;
          if (!(x <= u2)) return v ? s.slice(0, u2) : s.slice(0, u2 + 1);
          if (v || g) d = s.slice(0, u2);
          else if (u2 === 1) d = [s[0] - 0.5, s[0] + 0.5];
          else {
            for (d = [1.5 * s[0] - 0.5 * s[1]], p = 1; p < x; p++) d.push(0.5 * (s[p - 1] + s[p]));
            d.push(1.5 * s[x - 1] - 0.5 * s[x - 2]);
          }
          if (x < u2) {
            var b = d[d.length - 1], y = b - d[d.length - 2];
            for (p = x; p < u2; p++) b += y, d.push(b);
          }
        } else {
          var w = o[c._id.charAt(0) + "calendar"];
          for (m ? f = c.r2c(i, 0, w) : a(s) && s.length === 1 ? f = s[0] : i === void 0 ? f = 0 : f = (c.type === "log" ? c.d2c : c.r2c)(i, 0, w), h = l || 1, p = v || g ? 0 : -0.5; p < u2; p++) d.push(f + h * p);
        }
        return d;
      };
    }, { "../../lib": 503, "../../registry": 638 }], 804: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("tinycolor2"), o = e("../../registry"), s = e("../../components/drawing"), i = e("../../plots/cartesian/axes"), l = e("../../lib"), u2 = e("../../lib/svg_text_utils"), c = e("../scatter/format_labels"), f = e("../../components/color"), h = e("../../components/colorscale").extractOpts, p = e("../../components/colorscale").makeColorScaleFuncFromTrace, d = e("../../constants/xmlns_namespaces"), v = e("../../constants/alignment").LINE_SPACING;
      function m(w) {
        return w.selectAll("g.heatmap-label");
      }
      function g(w) {
        m(w).remove();
      }
      function x(w, _4) {
        var k = _4.length - 2, T2 = l.constrain(l.findBin(w, _4), 0, k), A2 = _4[T2], S2 = _4[T2 + 1], C2 = l.constrain(T2 + (w - A2) / (S2 - A2) - 0.5, 0, k), E2 = Math.round(C2), F13 = Math.abs(C2 - E2);
        return C2 && C2 !== k && F13 ? { bin0: E2, frac: F13, bin1: Math.round(E2 + F13 / (C2 - E2)) } : { bin0: E2, bin1: E2, frac: 0 };
      }
      function b(w, _4) {
        var k = _4.length - 1, T2 = l.constrain(l.findBin(w, _4), 0, k), A2 = _4[T2], S2 = (w - A2) / (_4[T2 + 1] - A2) || 0;
        return S2 <= 0 ? { bin0: T2, bin1: T2, frac: 0 } : S2 < 0.5 ? { bin0: T2, bin1: T2 + 1, frac: S2 } : { bin0: T2 + 1, bin1: T2, frac: 1 - S2 };
      }
      function y(w, _4, k) {
        w[_4] = k[0], w[_4 + 1] = k[1], w[_4 + 2] = k[2], w[_4 + 3] = Math.round(255 * k[3]);
      }
      t.exports = function(w, _4, k, T2) {
        var A2 = _4.xaxis, S2 = _4.yaxis;
        l.makeTraceGroups(T2, k, "hm").each(function(C2) {
          var E2, F13, N2, D2, I2, O2, L2, V2, W2 = n.select(this), X2 = C2[0], Y2 = X2.trace, K2 = Y2.xgap || 0, q = Y2.ygap || 0, re = X2.z, R2 = X2.x, z = X2.y, H2 = X2.xCenter, te = X2.yCenter, j = o.traceIs(Y2, "contour"), Q2 = j ? "best" : Y2.zsmooth, Z2 = re.length, ne = l.maxRowLength(re), ae = false, ue = false;
          for (O2 = 0; E2 === void 0 && O2 < R2.length - 1; ) E2 = A2.c2p(R2[O2]), O2++;
          for (O2 = R2.length - 1; F13 === void 0 && O2 > 0; ) F13 = A2.c2p(R2[O2]), O2--;
          for (F13 < E2 && (N2 = F13, F13 = E2, E2 = N2, ae = true), O2 = 0; D2 === void 0 && O2 < z.length - 1; ) D2 = S2.c2p(z[O2]), O2++;
          for (O2 = z.length - 1; I2 === void 0 && O2 > 0; ) I2 = S2.c2p(z[O2]), O2--;
          if (I2 < D2 && (N2 = D2, D2 = I2, I2 = N2, ue = true), j && (H2 = R2, te = z, R2 = X2.xfill, z = X2.yfill), Q2 !== "fast") {
            var le = Q2 === "best" ? 0 : 0.5;
            E2 = Math.max(-le * A2._length, E2), F13 = Math.min((1 + le) * A2._length, F13), D2 = Math.max(-le * S2._length, D2), I2 = Math.min((1 + le) * S2._length, I2);
          }
          var ce, se, he = Math.round(F13 - E2), me = Math.round(I2 - D2);
          if (he <= 0 || me <= 0) return W2.selectAll("image").data([]).exit().remove(), void g(W2);
          Q2 === "fast" ? (ce = ne, se = Z2) : (ce = he, se = me);
          var we = document.createElement("canvas");
          we.width = ce, we.height = se;
          var be, Ae, pe = we.getContext("2d"), ve = p(Y2, { noNumericCheck: true, returnArray: true });
          Q2 === "fast" ? (be = ae ? function(qr) {
            return ne - 1 - qr;
          } : l.identity, Ae = ue ? function(qr) {
            return Z2 - 1 - qr;
          } : l.identity) : (be = function(qr) {
            return l.constrain(Math.round(A2.c2p(R2[qr]) - E2), 0, he);
          }, Ae = function(qr) {
            return l.constrain(Math.round(S2.c2p(z[qr]) - D2), 0, me);
          });
          var Ee, Se, Ce, Be, Ue = Ae(0), Ke = [Ue, Ue], ct = ae ? 0 : 1, We = ue ? 0 : 1, Ze = 0, it = 0, ot = 0, mt = 0;
          function wt(qr, Nr) {
            if (qr !== void 0) {
              var Zr = ve(qr);
              return Zr[0] = Math.round(Zr[0]), Zr[1] = Math.round(Zr[1]), Zr[2] = Math.round(Zr[2]), Ze += Nr, it += Zr[0] * Nr, ot += Zr[1] * Nr, mt += Zr[2] * Nr, Zr;
            }
            return [0, 0, 0, 0];
          }
          function Et(qr, Nr, Zr, oa) {
            var tn = qr[Zr.bin0];
            if (tn === void 0) return wt(void 0, 1);
            var Zn, Ln = qr[Zr.bin1], gn = Nr[Zr.bin0], na = Nr[Zr.bin1], sr = Ln - tn || 0, Ut = gn - tn || 0;
            return Zn = Ln === void 0 ? na === void 0 ? 0 : gn === void 0 ? 2 * (na - tn) : 2 * (2 * na - gn - tn) / 3 : na === void 0 ? gn === void 0 ? 0 : 2 * (2 * tn - Ln - gn) / 3 : gn === void 0 ? 2 * (2 * na - Ln - tn) / 3 : na + tn - Ln - gn, wt(tn + Zr.frac * sr + oa.frac * (Ut + Zr.frac * Zn));
          }
          if (Q2) {
            var zt, Nt = 0;
            try {
              zt = new Uint8Array(he * me * 4);
            } catch {
              zt = new Array(he * me * 4);
            }
            if (Q2 === "best") {
              var yt, pt, Ot, Jt = H2 || R2, tr = te || z, Ye = new Array(Jt.length), at = new Array(tr.length), Ge = new Array(he), st = H2 ? b : x, Ie = te ? b : x;
              for (O2 = 0; O2 < Jt.length; O2++) Ye[O2] = Math.round(A2.c2p(Jt[O2]) - E2);
              for (O2 = 0; O2 < tr.length; O2++) at[O2] = Math.round(S2.c2p(tr[O2]) - D2);
              for (O2 = 0; O2 < he; O2++) Ge[O2] = st(O2, Ye);
              for (L2 = 0; L2 < me; L2++) for (pt = re[(yt = Ie(L2, at)).bin0], Ot = re[yt.bin1], O2 = 0; O2 < he; O2++, Nt += 4) y(zt, Nt, Be = Et(pt, Ot, Ge[O2], yt));
            } else for (L2 = 0; L2 < Z2; L2++) for (Ce = re[L2], Ke = Ae(L2), O2 = 0; O2 < he; O2++) Be = wt(Ce[O2], 1), y(zt, Nt = 4 * (Ke * he + be(O2)), Be);
            var Pe = pe.createImageData(he, me);
            try {
              Pe.data.set(zt);
            } catch {
              var $e = Pe.data, Ve = $e.length;
              for (L2 = 0; L2 < Ve; L2++) $e[L2] = zt[L2];
            }
            pe.putImageData(Pe, 0, 0);
          } else {
            var ut = Math.floor(K2 / 2), Re = Math.floor(q / 2);
            for (L2 = 0; L2 < Z2; L2++) if (Ce = re[L2], Ke.reverse(), Ke[We] = Ae(L2 + 1), Ke[0] !== Ke[1] && Ke[0] !== void 0 && Ke[1] !== void 0) for (Ee = [Se = be(0), Se], O2 = 0; O2 < ne; O2++) Ee.reverse(), Ee[ct] = be(O2 + 1), Ee[0] !== Ee[1] && Ee[0] !== void 0 && Ee[1] !== void 0 && (Be = wt(Ce[O2], (Ee[1] - Ee[0]) * (Ke[1] - Ke[0])), pe.fillStyle = "rgba(" + Be.join(",") + ")", pe.fillRect(Ee[0] + ut, Ke[0] + Re, Ee[1] - Ee[0] - K2, Ke[1] - Ke[0] - q));
          }
          it = Math.round(it / Ze), ot = Math.round(ot / Ze), mt = Math.round(mt / Ze);
          var qe = a("rgb(" + it + "," + ot + "," + mt + ")");
          w._hmpixcount = (w._hmpixcount || 0) + Ze, w._hmlumcount = (w._hmlumcount || 0) + Ze * qe.getLuminance();
          var je = W2.selectAll("image").data(C2);
          je.enter().append("svg:image").attr({ xmlns: d.svg, preserveAspectRatio: "none" }), je.attr({ height: me, width: he, x: E2, y: D2, "xlink:href": we.toDataURL("image/png") }), g(W2);
          var rt = Y2.texttemplate;
          if (rt) {
            var He = h(Y2), xe = { type: "linear", range: [He.min, He.max], _separators: A2._separators, _numFormat: A2._numFormat }, Ne = Y2.type === "histogram2dcontour", ke = Y2.type === "contour", Me = ke ? Z2 - 1 : Z2, Le = ke ? 1 : 0, ze = ke ? ne - 1 : ne, ft = [];
            for (O2 = ke ? 1 : 0; O2 < Me; O2++) {
              var De;
              if (ke) De = X2.y[O2];
              else if (Ne) {
                if (O2 === 0 || O2 === Z2 - 1) continue;
                De = X2.y[O2];
              } else if (X2.yCenter) De = X2.yCenter[O2];
              else {
                if (O2 + 1 === Z2 && X2.y[O2 + 1] === void 0) continue;
                De = (X2.y[O2] + X2.y[O2 + 1]) / 2;
              }
              var Je = Math.round(S2.c2p(De));
              if (!(0 > Je || Je > S2._length)) for (L2 = Le; L2 < ze; L2++) {
                var tt;
                if (ke) tt = X2.x[L2];
                else if (Ne) {
                  if (L2 === 0 || L2 === ne - 1) continue;
                  tt = X2.x[L2];
                } else if (X2.xCenter) tt = X2.xCenter[L2];
                else {
                  if (L2 + 1 === ne && X2.x[L2 + 1] === void 0) continue;
                  tt = (X2.x[L2] + X2.x[L2 + 1]) / 2;
                }
                var vt = Math.round(A2.c2p(tt));
                if (!(0 > vt || vt > A2._length)) {
                  var kt = c({ x: tt, y: De }, Y2, w._fullLayout);
                  kt.x = tt, kt.y = De;
                  var jt = X2.z[O2][L2];
                  jt === void 0 ? (kt.z = "", kt.zLabel = "") : (kt.z = jt, kt.zLabel = i.tickText(xe, jt, "hover").text);
                  var Vt = X2.text && X2.text[O2] && X2.text[O2][L2];
                  Vt !== void 0 && Vt !== false || (Vt = ""), kt.text = Vt;
                  var Kt = l.texttemplateString(rt, kt, w._fullLayout._d3locale, kt, Y2._meta || {});
                  if (Kt) {
                    var rr = Kt.split("<br>"), Tr = rr.length, yr = 0;
                    for (V2 = 0; V2 < Tr; V2++) yr = Math.max(yr, rr[V2].length);
                    ft.push({ l: Tr, c: yr, t: Kt, x: vt, y: Je, z: jt });
                  }
                }
              }
            }
            var pr = Y2.textfont, lr = pr.family, _r = pr.size, $r = w._fullLayout.font.size;
            if (!_r || _r === "auto") {
              var Ar = 1 / 0, Qr = 1 / 0, hn = 0, wn = 0;
              for (V2 = 0; V2 < ft.length; V2++) {
                var Yn = ft[V2];
                if (hn = Math.max(hn, Yn.l), wn = Math.max(wn, Yn.c), V2 < ft.length - 1) {
                  var Xn = ft[V2 + 1], Wn = Math.abs(Xn.x - Yn.x), _n = Math.abs(Xn.y - Yn.y);
                  Wn && (Ar = Math.min(Ar, Wn)), _n && (Qr = Math.min(Qr, _n));
                }
              }
              isFinite(Ar) && isFinite(Qr) ? (Ar -= K2, Qr -= q, Ar /= wn, Qr /= hn, Ar /= v / 2, Qr /= v, _r = Math.min(Math.floor(Ar), Math.floor(Qr), $r)) : _r = $r;
            }
            if (_r <= 0 || !isFinite(_r)) return;
            m(W2).data(ft).enter().append("g").classed("heatmap-label", 1).append("text").attr("text-anchor", "middle").each(function(qr) {
              var Nr = n.select(this), Zr = pr.color;
              Zr && Zr !== "auto" || (Zr = f.contrast("rgba(" + ve(qr.z).join() + ")")), Nr.attr("data-notex", 1).call(u2.positionText, function(oa) {
                return oa.x;
              }(qr), function(oa) {
                return oa.y - _r * (oa.l * v / 2 - 1);
              }(qr)).call(s.font, lr, _r, Zr).text(qr.t).call(u2.convertToTspans, w);
            });
          }
        });
      };
    }, { "../../components/color": 366, "../../components/colorscale": 378, "../../components/drawing": 388, "../../constants/alignment": 471, "../../constants/xmlns_namespaces": 480, "../../lib": 503, "../../lib/svg_text_utils": 529, "../../plots/cartesian/axes": 554, "../../registry": 638, "../scatter/format_labels": 935, "@plotly/d3": 58, tinycolor2: 312 }], 805: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3");
      t.exports = function(a) {
        n.select(a).selectAll(".hm image").style("opacity", function(o) {
          return o.trace.opacity;
        });
      };
    }, { "@plotly/d3": 58 }], 806: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a, o) {
        o("zsmooth") === false && (o("xgap"), o("ygap")), o("zhoverformat");
      };
    }, {}], 807: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("../../lib"), o = e("../../registry");
      function s(i, l) {
        var u2 = l(i);
        return (u2 ? l(i + "type", "array") : "scaled") === "scaled" && (l(i + "0"), l("d" + i)), u2;
      }
      t.exports = function(i, l, u2, c, f, h) {
        var p, d, v = u2("z");
        if (f = f || "x", h = h || "y", v === void 0 || !v.length) return 0;
        if (a.isArray1D(i.z)) {
          p = u2(f), d = u2(h);
          var m = a.minRowLength(p), g = a.minRowLength(d);
          if (m === 0 || g === 0) return 0;
          l._length = Math.min(m, g, v.length);
        } else {
          if (p = s(f, u2), d = s(h, u2), !function(x) {
            for (var b, y = true, w = false, _4 = false, k = 0; k < x.length; k++) {
              if (b = x[k], !a.isArrayOrTypedArray(b)) {
                y = false;
                break;
              }
              b.length > 0 && (w = true);
              for (var T2 = 0; T2 < b.length; T2++) if (n(b[T2])) {
                _4 = true;
                break;
              }
            }
            return y && w && _4;
          }(v)) return 0;
          u2("transpose"), l._length = null;
        }
        return i.type === "heatmapgl" || o.getComponentMethod("calendars", "handleTraceDefaults")(i, l, [f, h], c), true;
      };
    }, { "../../lib": 503, "../../registry": 638, "fast-isnumeric": 190 }], 808: [function(e, t, r) {
      "use strict";
      for (var n = e("../heatmap/attributes"), a = e("../../components/colorscale/attributes"), o = e("../../lib/extend").extendFlat, s = e("../../plot_api/edit_types").overrideAll, i = ["z", "x", "x0", "dx", "y", "y0", "dy", "text", "transpose", "xtype", "ytype"], l = {}, u2 = 0; u2 < i.length; u2++) {
        var c = i[u2];
        l[c] = n[c];
      }
      l.zsmooth = { valType: "enumerated", values: ["fast", false], dflt: "fast", editType: "calc" }, o(l, a("", { cLetter: "z", autoColorDflt: false })), t.exports = s(l, "calc", "nested");
    }, { "../../components/colorscale/attributes": 373, "../../lib/extend": 493, "../../plot_api/edit_types": 536, "../heatmap/attributes": 792 }], 809: [function(e, t, r) {
      "use strict";
      var n = e("../../../stackgl_modules").gl_heatmap2d, a = e("../../plots/cartesian/axes"), o = e("../../lib/str2rgbarray");
      function s(l, u2) {
        this.scene = l, this.uid = u2, this.type = "heatmapgl", this.name = "", this.hoverinfo = "all", this.xData = [], this.yData = [], this.zData = [], this.textLabels = [], this.idToIndex = [], this.bounds = [0, 0, 0, 0], this.options = { zsmooth: "fast", z: [], x: [], y: [], shape: [0, 0], colorLevels: [0], colorValues: [0, 0, 0, 1] }, this.heatmap = n(l.glplot, this.options), this.heatmap._trace = this;
      }
      var i = s.prototype;
      i.handlePick = function(l) {
        var u2 = this.options, c = u2.shape, f = l.pointId, h = f % c[0], p = Math.floor(f / c[0]), d = f;
        return { trace: this, dataCoord: l.dataCoord, traceCoord: [u2.x[h], u2.y[p], u2.z[d]], textLabel: this.textLabels[f], name: this.name, pointIndex: [p, h], hoverinfo: this.hoverinfo };
      }, i.update = function(l, u2) {
        var c = u2[0];
        this.index = l.index, this.name = l.name, this.hoverinfo = l.hoverinfo;
        var f = c.z;
        this.options.z = [].concat.apply([], f);
        var h = f[0].length, p = f.length;
        this.options.shape = [h, p], this.options.x = c.x, this.options.y = c.y, this.options.zsmooth = l.zsmooth;
        var d = function(b) {
          for (var y = b.colorscale, w = b.zmin, _4 = b.zmax, k = y.length, T2 = new Array(k), A2 = new Array(4 * k), S2 = 0; S2 < k; S2++) {
            var C2 = y[S2], E2 = o(C2[1]);
            T2[S2] = w + C2[0] * (_4 - w);
            for (var F13 = 0; F13 < 4; F13++) A2[4 * S2 + F13] = E2[F13];
          }
          return { colorLevels: T2, colorValues: A2 };
        }(l);
        this.options.colorLevels = d.colorLevels, this.options.colorValues = d.colorValues, this.textLabels = [].concat.apply([], l.text), this.heatmap.update(this.options);
        var v, m, g = this.scene.xaxis, x = this.scene.yaxis;
        l.zsmooth === false && (v = { ppad: c.x[1] - c.x[0] }, m = { ppad: c.y[1] - c.y[0] }), l._extremes[g._id] = a.findExtremes(g, c.x, v), l._extremes[x._id] = a.findExtremes(x, c.y, m);
      }, i.dispose = function() {
        this.heatmap.dispose();
      }, t.exports = function(l, u2, c) {
        var f = new s(l, u2.uid);
        return f.update(u2, c), f;
      };
    }, { "../../../stackgl_modules": 1120, "../../lib/str2rgbarray": 528, "../../plots/cartesian/axes": 554 }], 810: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../heatmap/xyz_defaults"), o = e("../../components/colorscale/defaults"), s = e("./attributes");
      t.exports = function(i, l, u2, c) {
        function f(h, p) {
          return n.coerce(i, l, s, h, p);
        }
        a(i, l, f, c) ? (f("text"), f("zsmooth"), o(i, l, c, f, { prefix: "", cLetter: "z" })) : l.visible = false;
      };
    }, { "../../components/colorscale/defaults": 376, "../../lib": 503, "../heatmap/xyz_defaults": 807, "./attributes": 808 }], 811: [function(e, t, r) {
      "use strict";
      ["*heatmapgl* trace is deprecated!", "Please consider switching to the *heatmap* or *image* trace types.", "Alternatively you could contribute/sponsor rewriting this trace type", "based on cartesian features and using regl framework."].join(" "), t.exports = { attributes: e("./attributes"), supplyDefaults: e("./defaults"), colorbar: e("../heatmap/colorbar"), calc: e("../heatmap/calc"), plot: e("./convert"), moduleType: "trace", name: "heatmapgl", basePlotModule: e("../../plots/gl2d"), categories: ["gl", "gl2d", "2dMap"], meta: {} };
    }, { "../../plots/gl2d": 596, "../heatmap/calc": 793, "../heatmap/colorbar": 795, "./attributes": 808, "./convert": 809, "./defaults": 810 }], 812: [function(e, t, r) {
      "use strict";
      var n = e("../bar/attributes"), a = e("../../plots/cartesian/axis_format_attributes").axisHoverFormat, o = e("../../plots/template_attributes").hovertemplateAttrs, s = e("../../plots/template_attributes").texttemplateAttrs, i = e("../../plots/font_attributes"), l = e("./bin_attributes"), u2 = e("./constants"), c = e("../../lib/extend").extendFlat;
      t.exports = { x: { valType: "data_array", editType: "calc+clearAxisTypes" }, y: { valType: "data_array", editType: "calc+clearAxisTypes" }, xhoverformat: a("x"), yhoverformat: a("y"), text: c({}, n.text, {}), hovertext: c({}, n.hovertext, {}), orientation: n.orientation, histfunc: { valType: "enumerated", values: ["count", "sum", "avg", "min", "max"], dflt: "count", editType: "calc" }, histnorm: { valType: "enumerated", values: ["", "percent", "probability", "density", "probability density"], dflt: "", editType: "calc" }, cumulative: { enabled: { valType: "boolean", dflt: false, editType: "calc" }, direction: { valType: "enumerated", values: ["increasing", "decreasing"], dflt: "increasing", editType: "calc" }, currentbin: { valType: "enumerated", values: ["include", "exclude", "half"], dflt: "include", editType: "calc" }, editType: "calc" }, nbinsx: { valType: "integer", min: 0, dflt: 0, editType: "calc" }, xbins: l("x", true), nbinsy: { valType: "integer", min: 0, dflt: 0, editType: "calc" }, ybins: l("y", true), autobinx: { valType: "boolean", dflt: null, editType: "calc" }, autobiny: { valType: "boolean", dflt: null, editType: "calc" }, bingroup: { valType: "string", dflt: "", editType: "calc" }, hovertemplate: o({}, { keys: u2.eventDataKeys }), texttemplate: s({ arrayOk: false, editType: "plot" }, { keys: ["label", "value"] }), textposition: c({}, n.textposition, { arrayOk: false }), textfont: i({ arrayOk: false, editType: "plot", colorEditType: "style" }), outsidetextfont: i({ arrayOk: false, editType: "plot", colorEditType: "style" }), insidetextfont: i({ arrayOk: false, editType: "plot", colorEditType: "style" }), insidetextanchor: n.insidetextanchor, textangle: n.textangle, cliponaxis: n.cliponaxis, constraintext: n.constraintext, marker: n.marker, offsetgroup: n.offsetgroup, alignmentgroup: n.alignmentgroup, selected: n.selected, unselected: n.unselected, _deprecated: { bardir: n._deprecated.bardir } };
    }, { "../../lib/extend": 493, "../../plots/cartesian/axis_format_attributes": 557, "../../plots/font_attributes": 585, "../../plots/template_attributes": 633, "../bar/attributes": 648, "./bin_attributes": 814, "./constants": 818 }], 813: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a) {
        for (var o = n.length, s = 0, i = 0; i < o; i++) a[i] ? (n[i] /= a[i], s += n[i]) : n[i] = null;
        return s;
      };
    }, {}], 814: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a) {
        return { start: { valType: "any", editType: "calc" }, end: { valType: "any", editType: "calc" }, size: { valType: "any", editType: "calc" }, editType: "calc" };
      };
    }, {}], 815: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric");
      t.exports = { count: function(a, o, s) {
        return s[a]++, 1;
      }, sum: function(a, o, s, i) {
        var l = i[o];
        return n(l) ? (l = Number(l), s[a] += l, l) : 0;
      }, avg: function(a, o, s, i, l) {
        var u2 = i[o];
        return n(u2) && (u2 = Number(u2), s[a] += u2, l[a]++), 0;
      }, min: function(a, o, s, i) {
        var l = i[o];
        if (n(l)) {
          if (l = Number(l), !n(s[a])) return s[a] = l, l;
          if (s[a] > l) {
            var u2 = l - s[a];
            return s[a] = l, u2;
          }
        }
        return 0;
      }, max: function(a, o, s, i) {
        var l = i[o];
        if (n(l)) {
          if (l = Number(l), !n(s[a])) return s[a] = l, l;
          if (s[a] < l) {
            var u2 = l - s[a];
            return s[a] = l, u2;
          }
        }
        return 0;
      } };
    }, { "fast-isnumeric": 190 }], 816: [function(e, t, r) {
      "use strict";
      var n = e("../../constants/numerical"), a = n.ONEAVGYEAR, o = n.ONEAVGMONTH, s = n.ONEDAY, i = n.ONEHOUR, l = n.ONEMIN, u2 = n.ONESEC, c = e("../../plots/cartesian/axes").tickIncrement;
      function f(v, m, g, x) {
        if (v * m <= 0) return 1 / 0;
        for (var b = Math.abs(m - v), y = g.type === "date", w = h(b, y), _4 = 0; _4 < 10; _4++) {
          var k = h(80 * w, y);
          if (w === k || !p(k, v, m, y, g, x)) break;
          w = k;
        }
        return w;
      }
      function h(v, m) {
        return m && v > u2 ? v > s ? v > 1.1 * a ? a : v > 1.1 * o ? o : s : v > i ? i : v > l ? l : u2 : Math.pow(10, Math.floor(Math.log(v) / Math.LN10));
      }
      function p(v, m, g, x, b, y) {
        if (x && v > s) {
          var w = d(m, b, y), _4 = d(g, b, y), k = v === a ? 0 : 1;
          return w[k] !== _4[k];
        }
        return Math.floor(g / v) - Math.floor(m / v) > 0.1;
      }
      function d(v, m, g) {
        var x = m.c2d(v, a, g).split("-");
        return x[0] === "" && (x.unshift(), x[0] = "-" + x[0]), x;
      }
      t.exports = function(v, m, g, x, b) {
        var y, w, _4 = -1.1 * m, k = -0.1 * m, T2 = v - k, A2 = g[0], S2 = g[1], C2 = Math.min(f(A2 + k, A2 + T2, x, b), f(S2 + k, S2 + T2, x, b)), E2 = Math.min(f(A2 + _4, A2 + k, x, b), f(S2 + _4, S2 + k, x, b));
        if (C2 > E2 && E2 < Math.abs(S2 - A2) / 4e3 ? (y = C2, w = false) : (y = Math.min(C2, E2), w = true), x.type === "date" && y > s) {
          var F13 = y === a ? 1 : 6, N2 = y === a ? "M12" : "M1";
          return function(D2, I2) {
            var O2 = x.c2d(D2, a, b), L2 = O2.indexOf("-", F13);
            L2 > 0 && (O2 = O2.substr(0, L2));
            var V2 = x.d2c(O2, 0, b);
            if (V2 < D2) {
              var W2 = c(V2, N2, false, b);
              (V2 + W2) / 2 < D2 + v && (V2 = W2);
            }
            return I2 && w ? c(V2, N2, true, b) : V2;
          };
        }
        return function(D2, I2) {
          var O2 = y * Math.round(D2 / y);
          return O2 + y / 10 < D2 && O2 + 0.9 * y < D2 + v && (O2 += y), I2 && w && (O2 -= y), O2;
        };
      };
    }, { "../../constants/numerical": 479, "../../plots/cartesian/axes": 554 }], 817: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("../../lib"), o = e("../../registry"), s = e("../../plots/cartesian/axes"), i = e("../bar/arrays_to_calcdata"), l = e("./bin_functions"), u2 = e("./norm_functions"), c = e("./average"), f = e("./bin_label_vals");
      function h(p, d, v, m, g) {
        var x, b, y, w, _4, k, T2, A2 = m + "bins", S2 = p._fullLayout, C2 = d["_" + m + "bingroup"], E2 = S2._histogramBinOpts[C2], F13 = S2.barmode === "overlay", N2 = function(se) {
          return v.r2c(se, 0, w);
        }, D2 = function(se) {
          return v.c2r(se, 0, w);
        }, I2 = v.type === "date" ? function(se) {
          return se || se === 0 ? a.cleanDate(se, null, w) : null;
        } : function(se) {
          return n(se) ? Number(se) : null;
        };
        function O2(se, he, me) {
          he[se + "Found"] ? (he[se] = I2(he[se]), he[se] === null && (he[se] = me[se])) : (k[se] = he[se] = me[se], a.nestedProperty(b[0], A2 + "." + se).set(me[se]));
        }
        if (d["_" + m + "autoBinFinished"]) delete d["_" + m + "autoBinFinished"];
        else {
          b = E2.traces;
          var L2 = [], V2 = true, W2 = false, X2 = false;
          for (x = 0; x < b.length; x++) if ((y = b[x]).visible) {
            var Y2 = E2.dirs[x];
            _4 = y["_" + Y2 + "pos0"] = v.makeCalcdata(y, Y2), L2 = a.concat(L2, _4), delete y["_" + m + "autoBinFinished"], d.visible === true && (V2 ? V2 = false : (delete y._autoBin, y["_" + m + "autoBinFinished"] = 1), o.traceIs(y, "2dMap") && (W2 = true), y.type === "histogram2dcontour" && (X2 = true));
          }
          w = b[0][m + "calendar"];
          var K2 = s.autoBin(L2, v, E2.nbins, W2, w, E2.sizeFound && E2.size), q = b[0]._autoBin = {};
          if (k = q[E2.dirs[0]] = {}, X2 && (E2.size || (K2.start = D2(s.tickIncrement(N2(K2.start), K2.size, true, w))), E2.end === void 0 && (K2.end = D2(s.tickIncrement(N2(K2.end), K2.size, false, w)))), F13 && !o.traceIs(d, "2dMap") && K2._dataSpan === 0 && v.type !== "category" && v.type !== "multicategory") {
            if (g) return [K2, _4, true];
            K2 = function(se, he, me, we, be) {
              var Ae, pe, ve, Ee = se._fullLayout, Se = function(Et, zt) {
                for (var Nt = zt.xaxis, yt = zt.yaxis, pt = zt.orientation, Ot = [], Jt = Et._fullData, tr = 0; tr < Jt.length; tr++) {
                  var Ye = Jt[tr];
                  Ye.type === "histogram" && Ye.visible === true && Ye.orientation === pt && Ye.xaxis === Nt && Ye.yaxis === yt && Ot.push(Ye);
                }
                return Ot;
              }(se, he), Ce = false, Be = 1 / 0, Ue = [he];
              for (Ae = 0; Ae < Se.length; Ae++) if ((pe = Se[Ae]) === he) Ce = true;
              else if (Ce) {
                var Ke = h(se, pe, me, we, true), ct = Ke[0], We = Ke[2];
                pe["_" + we + "autoBinFinished"] = 1, pe["_" + we + "pos0"] = Ke[1], We ? Ue.push(pe) : Be = Math.min(Be, ct.size);
              } else ve = Ee._histogramBinOpts[pe["_" + we + "bingroup"]], Be = Math.min(Be, ve.size || pe[be].size);
              var Ze = new Array(Ue.length);
              for (Ae = 0; Ae < Ue.length; Ae++) for (var it = Ue[Ae]["_" + we + "pos0"], ot = 0; ot < it.length; ot++) if (it[ot] !== void 0) {
                Ze[Ae] = it[ot];
                break;
              }
              for (isFinite(Be) || (Be = a.distinctVals(Ze).minDiff), Ae = 0; Ae < Ue.length; Ae++) {
                var mt = (pe = Ue[Ae])[we + "calendar"], wt = { start: me.c2r(Ze[Ae] - Be / 2, 0, mt), end: me.c2r(Ze[Ae] + Be / 2, 0, mt), size: Be };
                pe._input[be] = pe[be] = wt, (ve = Ee._histogramBinOpts[pe["_" + we + "bingroup"]]) && a.extendFlat(ve, wt);
              }
              return he[be];
            }(p, d, v, m, A2);
          }
          (T2 = y.cumulative || {}).enabled && T2.currentbin !== "include" && (T2.direction === "decreasing" ? K2.start = D2(s.tickIncrement(N2(K2.start), K2.size, true, w)) : K2.end = D2(s.tickIncrement(N2(K2.end), K2.size, false, w))), E2.size = K2.size, E2.sizeFound || (k.size = K2.size, a.nestedProperty(b[0], A2 + ".size").set(K2.size)), O2("start", E2, K2), O2("end", E2, K2);
        }
        _4 = d["_" + m + "pos0"], delete d["_" + m + "pos0"];
        var re = d._input[A2] || {}, R2 = a.extendFlat({}, E2), z = E2.start, H2 = v.r2l(re.start), te = H2 !== void 0;
        if ((E2.startFound || te) && H2 !== v.r2l(z)) {
          var j = te ? H2 : a.aggNums(Math.min, null, _4), Q2 = { type: v.type === "category" || v.type === "multicategory" ? "linear" : v.type, r2l: v.r2l, dtick: E2.size, tick0: z, calendar: w, range: [j, s.tickIncrement(j, E2.size, false, w)].map(v.l2r) }, Z2 = s.tickFirst(Q2);
          Z2 > v.r2l(j) && (Z2 = s.tickIncrement(Z2, E2.size, true, w)), R2.start = v.l2r(Z2), te || a.nestedProperty(d, A2 + ".start").set(R2.start);
        }
        var ne = E2.end, ae = v.r2l(re.end), ue = ae !== void 0;
        if ((E2.endFound || ue) && ae !== v.r2l(ne)) {
          var le = ue ? ae : a.aggNums(Math.max, null, _4);
          R2.end = v.l2r(le), ue || a.nestedProperty(d, A2 + ".start").set(R2.end);
        }
        var ce = "autobin" + m;
        return d._input[ce] === false && (d._input[A2] = a.extendFlat({}, d[A2] || {}), delete d._input[ce], delete d[ce]), [R2, _4];
      }
      t.exports = { calc: function(p, d) {
        var v, m, g, x, b = [], y = [], w = d.orientation === "h", _4 = s.getFromId(p, w ? d.yaxis : d.xaxis), k = w ? "y" : "x", T2 = { x: "y", y: "x" }[k], A2 = d[k + "calendar"], S2 = d.cumulative, C2 = h(p, d, _4, k), E2 = C2[0], F13 = C2[1], N2 = typeof E2.size == "string", D2 = [], I2 = N2 ? D2 : E2, O2 = [], L2 = [], V2 = [], W2 = 0, X2 = d.histnorm, Y2 = d.histfunc, K2 = X2.indexOf("density") !== -1;
        S2.enabled && K2 && (X2 = X2.replace(/ ?density$/, ""), K2 = false);
        var q, re = Y2 === "max" || Y2 === "min" ? null : 0, R2 = l.count, z = u2[X2], H2 = false, te = function(pe) {
          return _4.r2c(pe, 0, A2);
        };
        for (a.isArrayOrTypedArray(d[T2]) && Y2 !== "count" && (q = d[T2], H2 = Y2 === "avg", R2 = l[Y2]), v = te(E2.start), g = te(E2.end) + (v - s.tickIncrement(v, E2.size, false, A2)) / 1e6; v < g && b.length < 1e6 && (m = s.tickIncrement(v, E2.size, false, A2), b.push((v + m) / 2), y.push(re), V2.push([]), D2.push(v), K2 && O2.push(1 / (m - v)), H2 && L2.push(0), !(m <= v)); ) v = m;
        D2.push(v), N2 || _4.type !== "date" || (I2 = { start: te(I2.start), end: te(I2.end), size: I2.size }), p._fullLayout._roundFnOpts || (p._fullLayout._roundFnOpts = {});
        var j = d["_" + k + "bingroup"], Q2 = { leftGap: 1 / 0, rightGap: 1 / 0 };
        j && (p._fullLayout._roundFnOpts[j] || (p._fullLayout._roundFnOpts[j] = Q2), Q2 = p._fullLayout._roundFnOpts[j]);
        var Z2, ne = y.length, ae = true, ue = Q2.leftGap, le = Q2.rightGap, ce = {};
        for (v = 0; v < F13.length; v++) {
          var se = F13[v];
          (x = a.findBin(se, I2)) >= 0 && x < ne && (W2 += R2(x, v, y, q, L2), ae && V2[x].length && se !== F13[V2[x][0]] && (ae = false), V2[x].push(v), ce[v] = x, ue = Math.min(ue, se - D2[x]), le = Math.min(le, D2[x + 1] - se));
        }
        Q2.leftGap = ue, Q2.rightGap = le, ae || (Z2 = function(pe, ve) {
          return function() {
            var Ee = p._fullLayout._roundFnOpts[j];
            return f(Ee.leftGap, Ee.rightGap, D2, _4, A2)(pe, ve);
          };
        }), H2 && (W2 = c(y, L2)), z && z(y, W2, O2), S2.enabled && function(pe, ve, Ee) {
          var Se, Ce, Be;
          function Ue(ct) {
            Be = pe[ct], pe[ct] /= 2;
          }
          function Ke(ct) {
            Ce = pe[ct], pe[ct] = Be + Ce / 2, Be += Ce;
          }
          if (Ee === "half") if (ve === "increasing") for (Ue(0), Se = 1; Se < pe.length; Se++) Ke(Se);
          else for (Ue(pe.length - 1), Se = pe.length - 2; Se >= 0; Se--) Ke(Se);
          else if (ve === "increasing") {
            for (Se = 1; Se < pe.length; Se++) pe[Se] += pe[Se - 1];
            Ee === "exclude" && (pe.unshift(0), pe.pop());
          } else {
            for (Se = pe.length - 2; Se >= 0; Se--) pe[Se] += pe[Se + 1];
            Ee === "exclude" && (pe.push(0), pe.shift());
          }
        }(y, S2.direction, S2.currentbin);
        var he = Math.min(b.length, y.length), me = [], we = 0, be = he - 1;
        for (v = 0; v < he; v++) if (y[v]) {
          we = v;
          break;
        }
        for (v = he - 1; v >= we; v--) if (y[v]) {
          be = v;
          break;
        }
        for (v = we; v <= be; v++) if (n(b[v]) && n(y[v])) {
          var Ae = { p: b[v], s: y[v], b: 0 };
          S2.enabled || (Ae.pts = V2[v], ae ? Ae.ph0 = Ae.ph1 = V2[v].length ? F13[V2[v][0]] : b[v] : (d._computePh = true, Ae.ph0 = Z2(D2[v]), Ae.ph1 = Z2(D2[v + 1], true))), me.push(Ae);
        }
        return me.length === 1 && (me[0].width1 = s.tickIncrement(me[0].p, E2.size, false, A2) - me[0].p), i(me, d), a.isArrayOrTypedArray(d.selectedpoints) && a.tagSelected(me, d, ce), me;
      }, calcAllAutoBins: h };
    }, { "../../lib": 503, "../../plots/cartesian/axes": 554, "../../registry": 638, "../bar/arrays_to_calcdata": 647, "./average": 813, "./bin_functions": 815, "./bin_label_vals": 816, "./norm_functions": 824, "fast-isnumeric": 190 }], 818: [function(e, t, r) {
      "use strict";
      t.exports = { eventDataKeys: ["binNumber"] };
    }, {}], 819: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../plots/cartesian/axis_ids"), o = e("../../registry").traceIs, s = e("../bar/defaults").handleGroupingDefaults, i = n.nestedProperty, l = e("../../plots/cartesian/constraints").getAxisGroup, u2 = [{ aStr: { x: "xbins.start", y: "ybins.start" }, name: "start" }, { aStr: { x: "xbins.end", y: "ybins.end" }, name: "end" }, { aStr: { x: "xbins.size", y: "ybins.size" }, name: "size" }, { aStr: { x: "nbinsx", y: "nbinsy" }, name: "nbins" }], c = ["x", "y"];
      t.exports = function(f, h) {
        var p, d, v, m, g, x, b, y = h._histogramBinOpts = {}, w = [], _4 = {}, k = [];
        function T2(K2, q) {
          return n.coerce(p._input, p, p._module.attributes, K2, q);
        }
        function A2(K2) {
          return K2.orientation === "v" ? "x" : "y";
        }
        function S2(K2, q, re) {
          var R2 = K2.uid + "__" + re;
          q || (q = R2);
          var z = function(Q2, Z2) {
            return a.getFromTrace({ _fullLayout: h }, Q2, Z2).type;
          }(K2, re), H2 = K2[re + "calendar"] || "", te = y[q], j = true;
          te && (z === te.axType && H2 === te.calendar ? (j = false, te.traces.push(K2), te.dirs.push(re)) : (q = R2, z !== te.axType && n.warn(["Attempted to group the bins of trace", K2.index, "set on a", "type:" + z, "axis", "with bins on", "type:" + te.axType, "axis."].join(" ")), H2 !== te.calendar && n.warn(["Attempted to group the bins of trace", K2.index, "set with a", H2, "calendar", "with bins", te.calendar ? "on a " + te.calendar + " calendar" : "w/o a set calendar"].join(" ")))), j && (y[q] = { traces: [K2], dirs: [re], axType: z, calendar: K2[re + "calendar"] || "" }), K2["_" + re + "bingroup"] = q;
        }
        for (g = 0; g < f.length; g++) p = f[g], o(p, "histogram") && (w.push(p), delete p._xautoBinFinished, delete p._yautoBinFinished, o(p, "2dMap") || s(p._input, p, h, T2));
        var C2 = h._alignmentOpts || {};
        for (g = 0; g < w.length; g++) {
          if (p = w[g], v = "", !o(p, "2dMap")) {
            if (m = A2(p), h.barmode === "group" && p.alignmentgroup) {
              var E2 = p[m + "axis"], F13 = l(h, E2) + p.orientation;
              (C2[F13] || {})[p.alignmentgroup] && (v = F13);
            }
            v || h.barmode === "overlay" || (v = l(h, p.xaxis) + l(h, p.yaxis) + A2(p));
          }
          v ? (_4[v] || (_4[v] = []), _4[v].push(p)) : k.push(p);
        }
        for (v in _4) if ((d = _4[v]).length !== 1) {
          var N2 = false;
          for (d.length && (p = d[0], N2 = T2("bingroup")), v = N2 || v, g = 0; g < d.length; g++) {
            var D2 = (p = d[g])._input.bingroup;
            D2 && D2 !== v && n.warn(["Trace", p.index, "must match", "within bingroup", v + ".", "Ignoring its bingroup:", D2, "setting."].join(" ")), p.bingroup = v, S2(p, v, A2(p));
          }
        } else k.push(d[0]);
        for (g = 0; g < k.length; g++) {
          p = k[g];
          var I2 = T2("bingroup");
          if (o(p, "2dMap")) for (b = 0; b < 2; b++) {
            var O2 = T2((m = c[b]) + "bingroup", I2 ? I2 + "__" + m : null);
            S2(p, O2, m);
          }
          else S2(p, I2, A2(p));
        }
        for (v in y) {
          var L2 = y[v];
          for (d = L2.traces, x = 0; x < u2.length; x++) {
            var V2, W2, X2 = u2[x], Y2 = X2.name;
            if (Y2 !== "nbins" || !L2.sizeFound) {
              for (g = 0; g < d.length; g++) {
                if (p = d[g], m = L2.dirs[g], V2 = X2.aStr[m], i(p._input, V2).get() !== void 0) {
                  L2[Y2] = T2(V2), L2[Y2 + "Found"] = true;
                  break;
                }
                (W2 = (p._autoBin || {})[m] || {})[Y2] && i(p, V2).set(W2[Y2]);
              }
              if (Y2 === "start" || Y2 === "end") for (; g < d.length; g++) (p = d[g])["_" + m + "bingroup"] && T2(V2, (W2 = (p._autoBin || {})[m] || {})[Y2]);
              Y2 !== "nbins" || L2.sizeFound || L2.nbinsFound || (p = d[0], L2[Y2] = T2(V2));
            }
          }
        }
      };
    }, { "../../lib": 503, "../../plots/cartesian/axis_ids": 558, "../../plots/cartesian/constraints": 562, "../../registry": 638, "../bar/defaults": 652 }], 820: [function(e, t, r) {
      "use strict";
      var n = e("../../registry"), a = e("../../lib"), o = e("../../components/color"), s = e("../bar/defaults").handleText, i = e("../bar/style_defaults"), l = e("./attributes");
      t.exports = function(u2, c, f, h) {
        function p(k, T2) {
          return a.coerce(u2, c, l, k, T2);
        }
        var d = p("x"), v = p("y");
        p("cumulative.enabled") && (p("cumulative.direction"), p("cumulative.currentbin")), p("text");
        var m = p("textposition");
        s(u2, c, h, p, m, { moduleHasSelected: true, moduleHasUnselected: true, moduleHasConstrain: true, moduleHasCliponaxis: true, moduleHasTextangle: true, moduleHasInsideanchor: true }), p("hovertext"), p("hovertemplate"), p("xhoverformat"), p("yhoverformat");
        var g = p("orientation", v && !d ? "h" : "v"), x = g === "v" ? "x" : "y", b = g === "v" ? "y" : "x", y = d && v ? Math.min(a.minRowLength(d) && a.minRowLength(v)) : a.minRowLength(c[x] || []);
        if (y) {
          c._length = y, n.getComponentMethod("calendars", "handleTraceDefaults")(u2, c, ["x", "y"], h), c[b] && p("histfunc"), p("histnorm"), p("autobin" + x), i(u2, c, p, f, h), a.coerceSelectionMarkerOpacity(c, p);
          var w = (c.marker.line || {}).color, _4 = n.getComponentMethod("errorbars", "supplyDefaults");
          _4(u2, c, w || o.defaultLine, { axis: "y" }), _4(u2, c, w || o.defaultLine, { axis: "x", inherit: "y" });
        } else c.visible = false;
      };
    }, { "../../components/color": 366, "../../lib": 503, "../../registry": 638, "../bar/defaults": 652, "../bar/style_defaults": 663, "./attributes": 812 }], 821: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a, o, s, i) {
        if (n.x = "xVal" in a ? a.xVal : a.x, n.y = "yVal" in a ? a.yVal : a.y, "zLabelVal" in a && (n.z = a.zLabelVal), a.xa && (n.xaxis = a.xa), a.ya && (n.yaxis = a.ya), !(o.cumulative || {}).enabled) {
          var l, u2 = Array.isArray(i) ? s[0].pts[i[0]][i[1]] : s[i].pts;
          if (n.pointNumbers = u2, n.binNumber = n.pointNumber, delete n.pointNumber, delete n.pointIndex, o._indexToPoints) {
            l = [];
            for (var c = 0; c < u2.length; c++) l = l.concat(o._indexToPoints[u2[c]]);
          } else l = u2;
          n.pointIndices = l;
        }
        return n;
      };
    }, {}], 822: [function(e, t, r) {
      "use strict";
      var n = e("../bar/hover").hoverPoints, a = e("../../plots/cartesian/axes").hoverLabelText;
      t.exports = function(o, s, i, l, u2) {
        var c = n(o, s, i, l, u2);
        if (c) {
          var f = (o = c[0]).cd[o.index], h = o.cd[0].trace;
          if (!h.cumulative.enabled) {
            var p = h.orientation === "h" ? "y" : "x";
            o[p + "Label"] = a(o[p + "a"], [f.ph0, f.ph1], h[p + "hoverformat"]);
          }
          return c;
        }
      };
    }, { "../../plots/cartesian/axes": 554, "../bar/hover": 655 }], 823: [function(e, t, r) {
      "use strict";
      t.exports = { attributes: e("./attributes"), layoutAttributes: e("../bar/layout_attributes"), supplyDefaults: e("./defaults"), crossTraceDefaults: e("./cross_trace_defaults"), supplyLayoutDefaults: e("../bar/layout_defaults"), calc: e("./calc").calc, crossTraceCalc: e("../bar/cross_trace_calc").crossTraceCalc, plot: e("../bar/plot").plot, layerName: "barlayer", style: e("../bar/style").style, styleOnSelect: e("../bar/style").styleOnSelect, colorbar: e("../scatter/marker_colorbar"), hoverPoints: e("./hover"), selectPoints: e("../bar/select"), eventData: e("./event_data"), moduleType: "trace", name: "histogram", basePlotModule: e("../../plots/cartesian"), categories: ["bar-like", "cartesian", "svg", "bar", "histogram", "oriented", "errorBarsOK", "showLegend"], meta: {} };
    }, { "../../plots/cartesian": 568, "../bar/cross_trace_calc": 651, "../bar/layout_attributes": 657, "../bar/layout_defaults": 658, "../bar/plot": 659, "../bar/select": 660, "../bar/style": 662, "../scatter/marker_colorbar": 944, "./attributes": 812, "./calc": 817, "./cross_trace_defaults": 819, "./defaults": 820, "./event_data": 821, "./hover": 822 }], 824: [function(e, t, r) {
      "use strict";
      t.exports = { percent: function(n, a) {
        for (var o = n.length, s = 100 / a, i = 0; i < o; i++) n[i] *= s;
      }, probability: function(n, a) {
        for (var o = n.length, s = 0; s < o; s++) n[s] /= a;
      }, density: function(n, a, o, s) {
        var i = n.length;
        s = s || 1;
        for (var l = 0; l < i; l++) n[l] *= o[l] * s;
      }, "probability density": function(n, a, o, s) {
        var i = n.length;
        s && (a /= s);
        for (var l = 0; l < i; l++) n[l] *= o[l] / a;
      } };
    }, {}], 825: [function(e, t, r) {
      "use strict";
      var n = e("../histogram/attributes"), a = e("../histogram/bin_attributes"), o = e("../heatmap/attributes"), s = e("../../plots/attributes"), i = e("../../plots/cartesian/axis_format_attributes").axisHoverFormat, l = e("../../plots/template_attributes").hovertemplateAttrs, u2 = e("../../plots/template_attributes").texttemplateAttrs, c = e("../../components/colorscale/attributes"), f = e("../../lib/extend").extendFlat;
      t.exports = f({ x: n.x, y: n.y, z: { valType: "data_array", editType: "calc" }, marker: { color: { valType: "data_array", editType: "calc" }, editType: "calc" }, histnorm: n.histnorm, histfunc: n.histfunc, nbinsx: n.nbinsx, xbins: a("x"), nbinsy: n.nbinsy, ybins: a("y"), autobinx: n.autobinx, autobiny: n.autobiny, bingroup: f({}, n.bingroup, {}), xbingroup: f({}, n.bingroup, {}), ybingroup: f({}, n.bingroup, {}), xgap: o.xgap, ygap: o.ygap, zsmooth: o.zsmooth, xhoverformat: i("x"), yhoverformat: i("y"), zhoverformat: i("z", 1), hovertemplate: l({}, { keys: "z" }), texttemplate: u2({ arrayOk: false, editType: "plot" }, { keys: "z" }), textfont: o.textfont, showlegend: f({}, s.showlegend, { dflt: false }) }, c("", { cLetter: "z", autoColorDflt: false }));
    }, { "../../components/colorscale/attributes": 373, "../../lib/extend": 493, "../../plots/attributes": 550, "../../plots/cartesian/axis_format_attributes": 557, "../../plots/template_attributes": 633, "../heatmap/attributes": 792, "../histogram/attributes": 812, "../histogram/bin_attributes": 814 }], 826: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../plots/cartesian/axes"), o = e("../histogram/bin_functions"), s = e("../histogram/norm_functions"), i = e("../histogram/average"), l = e("../histogram/bin_label_vals"), u2 = e("../histogram/calc").calcAllAutoBins;
      function c(p, d, v, m) {
        var g, x = new Array(p);
        if (m) for (g = 0; g < p; g++) x[g] = 1 / (d[g + 1] - d[g]);
        else {
          var b = 1 / v;
          for (g = 0; g < p; g++) x[g] = b;
        }
        return x;
      }
      function f(p, d) {
        return { start: p(d.start), end: p(d.end), size: d.size };
      }
      function h(p, d, v, m, g, x) {
        var b, y = p.length - 1, w = new Array(y), _4 = l(v, m, p, g, x);
        for (b = 0; b < y; b++) {
          var k = (d || [])[b];
          w[b] = k === void 0 ? [_4(p[b]), _4(p[b + 1], true)] : [k, k];
        }
        return w;
      }
      t.exports = function(p, d) {
        var v, m, g, x, b = a.getFromId(p, d.xaxis), y = a.getFromId(p, d.yaxis), w = d.xcalendar, _4 = d.ycalendar, k = function(yt) {
          return b.r2c(yt, 0, w);
        }, T2 = function(yt) {
          return y.r2c(yt, 0, _4);
        }, A2 = u2(p, d, b, "x"), S2 = A2[0], C2 = A2[1], E2 = u2(p, d, y, "y"), F13 = E2[0], N2 = E2[1], D2 = d._length;
        C2.length > D2 && C2.splice(D2, C2.length - D2), N2.length > D2 && N2.splice(D2, N2.length - D2);
        var I2 = [], O2 = [], L2 = [], V2 = typeof S2.size == "string", W2 = typeof F13.size == "string", X2 = [], Y2 = [], K2 = V2 ? X2 : S2, q = W2 ? Y2 : F13, re = 0, R2 = [], z = [], H2 = d.histnorm, te = d.histfunc, j = H2.indexOf("density") !== -1, Q2 = te === "max" || te === "min" ? null : 0, Z2 = o.count, ne = s[H2], ae = false, ue = [], le = [], ce = "z" in d ? d.z : "marker" in d && Array.isArray(d.marker.color) ? d.marker.color : "";
        ce && te !== "count" && (ae = te === "avg", Z2 = o[te]);
        var se = S2.size, he = k(S2.start), me = k(S2.end) + (he - a.tickIncrement(he, se, false, w)) / 1e6;
        for (v = he; v < me; v = a.tickIncrement(v, se, false, w)) O2.push(Q2), X2.push(v), ae && L2.push(0);
        X2.push(v);
        var we, be = O2.length, Ae = (v - he) / be, pe = (we = he + Ae / 2, b.c2r(we, 0, w)), ve = F13.size, Ee = T2(F13.start), Se = T2(F13.end) + (Ee - a.tickIncrement(Ee, ve, false, _4)) / 1e6;
        for (v = Ee; v < Se; v = a.tickIncrement(v, ve, false, _4)) {
          I2.push(O2.slice()), Y2.push(v);
          var Ce = new Array(be);
          for (m = 0; m < be; m++) Ce[m] = [];
          z.push(Ce), ae && R2.push(L2.slice());
        }
        Y2.push(v);
        var Be = I2.length, Ue = (v - Ee) / Be, Ke = function(yt) {
          return y.c2r(yt, 0, _4);
        }(Ee + Ue / 2);
        j && (ue = c(O2.length, K2, Ae, V2), le = c(I2.length, q, Ue, W2)), V2 || b.type !== "date" || (K2 = f(k, K2)), W2 || y.type !== "date" || (q = f(T2, q));
        var ct = true, We = true, Ze = new Array(be), it = new Array(Be), ot = 1 / 0, mt = 1 / 0, wt = 1 / 0, Et = 1 / 0;
        for (v = 0; v < D2; v++) {
          var zt = C2[v], Nt = N2[v];
          g = n.findBin(zt, K2), x = n.findBin(Nt, q), g >= 0 && g < be && x >= 0 && x < Be && (re += Z2(g, v, I2[x], ce, R2[x]), z[x][g].push(v), ct && (Ze[g] === void 0 ? Ze[g] = zt : Ze[g] !== zt && (ct = false)), We && (it[x] === void 0 ? it[x] = Nt : it[x] !== Nt && (We = false)), ot = Math.min(ot, zt - X2[g]), mt = Math.min(mt, X2[g + 1] - zt), wt = Math.min(wt, Nt - Y2[x]), Et = Math.min(Et, Y2[x + 1] - Nt));
        }
        if (ae) for (x = 0; x < Be; x++) re += i(I2[x], R2[x]);
        if (ne) for (x = 0; x < Be; x++) ne(I2[x], re, ue, le[x]);
        return { x: C2, xRanges: h(X2, ct && Ze, ot, mt, b, w), x0: pe, dx: Ae, y: N2, yRanges: h(Y2, We && it, wt, Et, y, _4), y0: Ke, dy: Ue, z: I2, pts: z };
      };
    }, { "../../lib": 503, "../../plots/cartesian/axes": 554, "../histogram/average": 813, "../histogram/bin_functions": 815, "../histogram/bin_label_vals": 816, "../histogram/calc": 817, "../histogram/norm_functions": 824 }], 827: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("./sample_defaults"), o = e("../heatmap/style_defaults"), s = e("../../components/colorscale/defaults"), i = e("../heatmap/label_defaults"), l = e("./attributes");
      t.exports = function(u2, c, f, h) {
        function p(d, v) {
          return n.coerce(u2, c, l, d, v);
        }
        a(u2, c, p, h), c.visible !== false && (o(u2, c, p, h), s(u2, c, h, p, { prefix: "", cLetter: "z" }), p("hovertemplate"), i(p, h), p("xhoverformat"), p("yhoverformat"));
      };
    }, { "../../components/colorscale/defaults": 376, "../../lib": 503, "../heatmap/label_defaults": 802, "../heatmap/style_defaults": 806, "./attributes": 825, "./sample_defaults": 830 }], 828: [function(e, t, r) {
      "use strict";
      var n = e("../heatmap/hover"), a = e("../../plots/cartesian/axes").hoverLabelText;
      t.exports = function(o, s, i, l, u2) {
        var c = n(o, s, i, l, u2);
        if (c) {
          var f = (o = c[0]).index, h = f[0], p = f[1], d = o.cd[0], v = d.trace, m = d.xRanges[p], g = d.yRanges[h];
          return o.xLabel = a(o.xa, [m[0], m[1]], v.xhoverformat), o.yLabel = a(o.ya, [g[0], g[1]], v.yhoverformat), c;
        }
      };
    }, { "../../plots/cartesian/axes": 554, "../heatmap/hover": 799 }], 829: [function(e, t, r) {
      "use strict";
      t.exports = { attributes: e("./attributes"), supplyDefaults: e("./defaults"), crossTraceDefaults: e("../histogram/cross_trace_defaults"), calc: e("../heatmap/calc"), plot: e("../heatmap/plot"), layerName: "heatmaplayer", colorbar: e("../heatmap/colorbar"), style: e("../heatmap/style"), hoverPoints: e("./hover"), eventData: e("../histogram/event_data"), moduleType: "trace", name: "histogram2d", basePlotModule: e("../../plots/cartesian"), categories: ["cartesian", "svg", "2dMap", "histogram", "showLegend"], meta: {} };
    }, { "../../plots/cartesian": 568, "../heatmap/calc": 793, "../heatmap/colorbar": 795, "../heatmap/plot": 804, "../heatmap/style": 805, "../histogram/cross_trace_defaults": 819, "../histogram/event_data": 821, "./attributes": 825, "./defaults": 827, "./hover": 828 }], 830: [function(e, t, r) {
      "use strict";
      var n = e("../../registry"), a = e("../../lib");
      t.exports = function(o, s, i, l) {
        var u2 = i("x"), c = i("y"), f = a.minRowLength(u2), h = a.minRowLength(c);
        f && h ? (s._length = Math.min(f, h), n.getComponentMethod("calendars", "handleTraceDefaults")(o, s, ["x", "y"], l), (i("z") || i("marker.color")) && i("histfunc"), i("histnorm"), i("autobinx"), i("autobiny")) : s.visible = false;
      };
    }, { "../../lib": 503, "../../registry": 638 }], 831: [function(e, t, r) {
      "use strict";
      var n = e("../histogram2d/attributes"), a = e("../contour/attributes"), o = e("../../components/colorscale/attributes"), s = e("../../plots/cartesian/axis_format_attributes").axisHoverFormat, i = e("../../lib/extend").extendFlat;
      t.exports = i({ x: n.x, y: n.y, z: n.z, marker: n.marker, histnorm: n.histnorm, histfunc: n.histfunc, nbinsx: n.nbinsx, xbins: n.xbins, nbinsy: n.nbinsy, ybins: n.ybins, autobinx: n.autobinx, autobiny: n.autobiny, bingroup: n.bingroup, xbingroup: n.xbingroup, ybingroup: n.ybingroup, autocontour: a.autocontour, ncontours: a.ncontours, contours: a.contours, line: { color: a.line.color, width: i({}, a.line.width, { dflt: 0.5 }), dash: a.line.dash, smoothing: a.line.smoothing, editType: "plot" }, xhoverformat: s("x"), yhoverformat: s("y"), zhoverformat: s("z", 1), hovertemplate: n.hovertemplate, texttemplate: a.texttemplate, textfont: a.textfont }, o("", { cLetter: "z", editTypeOverride: "calc" }));
    }, { "../../components/colorscale/attributes": 373, "../../lib/extend": 493, "../../plots/cartesian/axis_format_attributes": 557, "../contour/attributes": 735, "../histogram2d/attributes": 825 }], 832: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../histogram2d/sample_defaults"), o = e("../contour/contours_defaults"), s = e("../contour/style_defaults"), i = e("../heatmap/label_defaults"), l = e("./attributes");
      t.exports = function(u2, c, f, h) {
        function p(d, v) {
          return n.coerce(u2, c, l, d, v);
        }
        a(u2, c, p, h), c.visible !== false && (o(u2, c, p, function(d) {
          return n.coerce2(u2, c, l, d);
        }), s(u2, c, p, h), p("xhoverformat"), p("yhoverformat"), p("hovertemplate"), c.contours && c.contours.coloring === "heatmap" && i(p, h));
      };
    }, { "../../lib": 503, "../contour/contours_defaults": 742, "../contour/style_defaults": 756, "../heatmap/label_defaults": 802, "../histogram2d/sample_defaults": 830, "./attributes": 831 }], 833: [function(e, t, r) {
      "use strict";
      t.exports = { attributes: e("./attributes"), supplyDefaults: e("./defaults"), crossTraceDefaults: e("../histogram/cross_trace_defaults"), calc: e("../contour/calc"), plot: e("../contour/plot").plot, layerName: "contourlayer", style: e("../contour/style"), colorbar: e("../contour/colorbar"), hoverPoints: e("../contour/hover"), moduleType: "trace", name: "histogram2dcontour", basePlotModule: e("../../plots/cartesian"), categories: ["cartesian", "svg", "2dMap", "contour", "histogram", "showLegend"], meta: {} };
    }, { "../../plots/cartesian": 568, "../contour/calc": 736, "../contour/colorbar": 738, "../contour/hover": 748, "../contour/plot": 753, "../contour/style": 755, "../histogram/cross_trace_defaults": 819, "./attributes": 831, "./defaults": 832 }], 834: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/template_attributes").hovertemplateAttrs, a = e("../../plots/template_attributes").texttemplateAttrs, o = e("../../components/colorscale/attributes"), s = e("../../plots/domain").attributes, i = e("../pie/attributes"), l = e("../sunburst/attributes"), u2 = e("../treemap/attributes"), c = e("../treemap/constants"), f = e("../../lib/extend").extendFlat;
      t.exports = { labels: l.labels, parents: l.parents, values: l.values, branchvalues: l.branchvalues, count: l.count, level: l.level, maxdepth: l.maxdepth, tiling: { orientation: { valType: "enumerated", values: ["v", "h"], dflt: "h", editType: "plot" }, flip: u2.tiling.flip, pad: { valType: "number", min: 0, dflt: 0, editType: "plot" }, editType: "calc" }, marker: f({ colors: l.marker.colors, line: l.marker.line, editType: "calc" }, o("marker", { colorAttr: "colors", anim: false })), leaf: l.leaf, pathbar: u2.pathbar, text: i.text, textinfo: l.textinfo, texttemplate: a({ editType: "plot" }, { keys: c.eventDataKeys.concat(["label", "value"]) }), hovertext: i.hovertext, hoverinfo: l.hoverinfo, hovertemplate: n({}, { keys: c.eventDataKeys }), textfont: i.textfont, insidetextfont: i.insidetextfont, outsidetextfont: u2.outsidetextfont, textposition: u2.textposition, sort: i.sort, root: l.root, domain: s({ name: "icicle", trace: true, editType: "calc" }) };
    }, { "../../components/colorscale/attributes": 373, "../../lib/extend": 493, "../../plots/domain": 584, "../../plots/template_attributes": 633, "../pie/attributes": 900, "../sunburst/attributes": 1045, "../treemap/attributes": 1071, "../treemap/constants": 1074 }], 835: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/plots");
      r.name = "icicle", r.plot = function(a, o, s, i) {
        n.plotBasePlot(r.name, a, o, s, i);
      }, r.clean = function(a, o, s, i) {
        n.cleanBasePlot(r.name, a, o, s, i);
      };
    }, { "../../plots/plots": 619 }], 836: [function(e, t, r) {
      "use strict";
      var n = e("../sunburst/calc");
      r.calc = function(a, o) {
        return n.calc(a, o);
      }, r.crossTraceCalc = function(a) {
        return n._runCrossTraceCalc("icicle", a);
      };
    }, { "../sunburst/calc": 1047 }], 837: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("./attributes"), o = e("../../components/color"), s = e("../../plots/domain").defaults, i = e("../bar/defaults").handleText, l = e("../bar/constants").TEXTPAD, u2 = e("../../components/colorscale"), c = u2.hasColorscale, f = u2.handleDefaults;
      t.exports = function(h, p, d, v) {
        function m(k, T2) {
          return n.coerce(h, p, a, k, T2);
        }
        var g = m("labels"), x = m("parents");
        if (g && g.length && x && x.length) {
          var b = m("values");
          b && b.length ? m("branchvalues") : m("count"), m("level"), m("maxdepth"), m("tiling.orientation"), m("tiling.flip"), m("tiling.pad");
          var y = m("text");
          m("texttemplate"), p.texttemplate || m("textinfo", Array.isArray(y) ? "text+label" : "label"), m("hovertext"), m("hovertemplate");
          var w = m("pathbar.visible");
          i(h, p, v, m, "auto", { hasPathbar: w, moduleHasSelected: false, moduleHasUnselected: false, moduleHasConstrain: false, moduleHasCliponaxis: false, moduleHasTextangle: false, moduleHasInsideanchor: false }), m("textposition"), m("marker.line.width") && m("marker.line.color", v.paper_bgcolor), m("marker.colors");
          var _4 = p._hasColorscale = c(h, "marker", "colors") || (h.marker || {}).coloraxis;
          _4 && f(h, p, v, m, { prefix: "marker.", cLetter: "c" }), m("leaf.opacity", _4 ? 1 : 0.7), p._hovered = { marker: { line: { width: 2, color: o.contrast(v.paper_bgcolor) } } }, w && (m("pathbar.thickness", p.pathbar.textfont.size + 2 * l), m("pathbar.side"), m("pathbar.edgeshape")), m("sort"), m("root.color"), s(p, v, m), p._length = null;
        } else p.visible = false;
      };
    }, { "../../components/color": 366, "../../components/colorscale": 378, "../../lib": 503, "../../plots/domain": 584, "../bar/constants": 650, "../bar/defaults": 652, "./attributes": 834 }], 838: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../lib"), o = e("../../components/drawing"), s = e("../../lib/svg_text_utils"), i = e("./partition"), l = e("./style").styleOne, u2 = e("../treemap/constants"), c = e("../sunburst/helpers"), f = e("../sunburst/fx"), h = e("../sunburst/plot").formatSliceLabel;
      t.exports = function(p, d, v, m, g) {
        var x = g.width, b = g.height, y = g.viewX, w = g.viewY, _4 = g.pathSlice, k = g.toMoveInsideSlice, T2 = g.strTransform, A2 = g.hasTransition, S2 = g.handleSlicesExit, C2 = g.makeUpdateSliceInterpolator, E2 = g.makeUpdateTextInterpolator, F13 = g.prevEntry, N2 = p._fullLayout, D2 = d[0].trace, I2 = D2.textposition.indexOf("left") !== -1, O2 = D2.textposition.indexOf("right") !== -1, L2 = D2.textposition.indexOf("bottom") !== -1, V2 = i(v, [x, b], { flipX: D2.tiling.flip.indexOf("x") > -1, flipY: D2.tiling.flip.indexOf("y") > -1, orientation: D2.tiling.orientation, pad: { inner: D2.tiling.pad }, maxDepth: D2._maxDepth }).descendants(), W2 = 1 / 0, X2 = -1 / 0;
        V2.forEach(function(R2) {
          var z = R2.depth;
          z >= D2._maxDepth ? (R2.x0 = R2.x1 = (R2.x0 + R2.x1) / 2, R2.y0 = R2.y1 = (R2.y0 + R2.y1) / 2) : (W2 = Math.min(W2, z), X2 = Math.max(X2, z));
        }), m = m.data(V2, c.getPtId), D2._maxVisibleLayers = isFinite(X2) ? X2 - W2 + 1 : 0, m.enter().append("g").classed("slice", true), S2(m, false, {}, [x, b], _4), m.order();
        var Y2 = null;
        if (A2 && F13) {
          var K2 = c.getPtId(F13);
          m.each(function(R2) {
            Y2 === null && c.getPtId(R2) === K2 && (Y2 = { x0: R2.x0, x1: R2.x1, y0: R2.y0, y1: R2.y1 });
          });
        }
        var q = function() {
          return Y2 || { x0: 0, x1: x, y0: 0, y1: b };
        }, re = m;
        return A2 && (re = re.transition().each("end", function() {
          var R2 = n.select(this);
          c.setSliceCursor(R2, p, { hideOnRoot: true, hideOnLeaves: false, isTransitioning: false });
        })), re.each(function(R2) {
          R2._x0 = y(R2.x0), R2._x1 = y(R2.x1), R2._y0 = w(R2.y0), R2._y1 = w(R2.y1), R2._hoverX = y(R2.x1 - D2.tiling.pad), R2._hoverY = w(L2 ? R2.y1 - D2.tiling.pad / 2 : R2.y0 + D2.tiling.pad / 2);
          var z = n.select(this), H2 = a.ensureSingle(z, "path", "surface", function(Z2) {
            Z2.style("pointer-events", "all");
          });
          A2 ? H2.transition().attrTween("d", function(Z2) {
            var ne = C2(Z2, false, q(), [x, b], { orientation: D2.tiling.orientation, flipX: D2.tiling.flip.indexOf("x") > -1, flipY: D2.tiling.flip.indexOf("y") > -1 });
            return function(ae) {
              return _4(ne(ae));
            };
          }) : H2.attr("d", _4), z.call(f, v, p, d, { styleOne: l, eventDataKeys: u2.eventDataKeys, transitionTime: u2.CLICK_TRANSITION_TIME, transitionEasing: u2.CLICK_TRANSITION_EASING }).call(c.setSliceCursor, p, { isTransitioning: p._transitioning }), H2.call(l, R2, D2, { hovered: false }), R2.x0 === R2.x1 || R2.y0 === R2.y1 ? R2._text = "" : R2._text = h(R2, v, D2, d, N2) || "";
          var te = a.ensureSingle(z, "g", "slicetext"), j = a.ensureSingle(te, "text", "", function(Z2) {
            Z2.attr("data-notex", 1);
          }), Q2 = a.ensureUniformFontSize(p, c.determineTextFont(D2, R2, N2.font));
          j.text(R2._text || " ").classed("slicetext", true).attr("text-anchor", O2 ? "end" : I2 ? "start" : "middle").call(o.font, Q2).call(s.convertToTspans, p), R2.textBB = o.bBox(j.node()), R2.transform = k(R2, { fontSize: Q2.size }), R2.transform.fontSize = Q2.size, A2 ? j.transition().attrTween("transform", function(Z2) {
            var ne = E2(Z2, false, q(), [x, b]);
            return function(ae) {
              return T2(ne(ae));
            };
          }) : j.attr("transform", T2(R2));
        }), Y2;
      };
    }, { "../../components/drawing": 388, "../../lib": 503, "../../lib/svg_text_utils": 529, "../sunburst/fx": 1050, "../sunburst/helpers": 1051, "../sunburst/plot": 1055, "../treemap/constants": 1074, "./partition": 842, "./style": 844, "@plotly/d3": 58 }], 839: [function(e, t, r) {
      "use strict";
      t.exports = { moduleType: "trace", name: "icicle", basePlotModule: e("./base_plot"), categories: [], animatable: true, attributes: e("./attributes"), layoutAttributes: e("./layout_attributes"), supplyDefaults: e("./defaults"), supplyLayoutDefaults: e("./layout_defaults"), calc: e("./calc").calc, crossTraceCalc: e("./calc").crossTraceCalc, plot: e("./plot"), style: e("./style").style, colorbar: e("../scatter/marker_colorbar"), meta: {} };
    }, { "../scatter/marker_colorbar": 944, "./attributes": 834, "./base_plot": 835, "./calc": 836, "./defaults": 837, "./layout_attributes": 840, "./layout_defaults": 841, "./plot": 843, "./style": 844 }], 840: [function(e, t, r) {
      "use strict";
      t.exports = { iciclecolorway: { valType: "colorlist", editType: "calc" }, extendiciclecolors: { valType: "boolean", dflt: true, editType: "calc" } };
    }, {}], 841: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("./layout_attributes");
      t.exports = function(o, s) {
        function i(l, u2) {
          return n.coerce(o, s, a, l, u2);
        }
        i("iciclecolorway", s.colorway), i("extendiciclecolors");
      };
    }, { "../../lib": 503, "./layout_attributes": 840 }], 842: [function(e, t, r) {
      "use strict";
      var n = e("d3-hierarchy"), a = e("../treemap/flip_tree");
      t.exports = function(o, s, i) {
        var l = i.flipX, u2 = i.flipY, c = i.orientation === "h", f = i.maxDepth, h = s[0], p = s[1];
        f && (h = (o.height + 1) * s[0] / Math.min(o.height + 1, f), p = (o.height + 1) * s[1] / Math.min(o.height + 1, f));
        var d = n.partition().padding(i.pad.inner).size(c ? [s[1], h] : [s[0], p])(o);
        return (c || l || u2) && a(d, s, { swapXY: c, flipX: l, flipY: u2 }), d;
      };
    }, { "../treemap/flip_tree": 1079, "d3-hierarchy": 115 }], 843: [function(e, t, r) {
      "use strict";
      var n = e("../treemap/draw"), a = e("./draw_descendants");
      t.exports = function(o, s, i, l) {
        return n(o, s, i, l, { type: "icicle", drawDescendants: a });
      };
    }, { "../treemap/draw": 1076, "./draw_descendants": 838 }], 844: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../components/color"), o = e("../../lib"), s = e("../bar/uniform_text").resizeText;
      function i(l, u2, c) {
        var f = u2.data.data, h = !u2.children, p = f.i, d = o.castOption(c, p, "marker.line.color") || a.defaultLine, v = o.castOption(c, p, "marker.line.width") || 0;
        l.style("stroke-width", v).call(a.fill, f.color).call(a.stroke, d).style("opacity", h ? c.leaf.opacity : null);
      }
      t.exports = { style: function(l) {
        var u2 = l._fullLayout._iciclelayer.selectAll(".trace");
        s(l, u2, "icicle"), u2.each(function(c) {
          var f = n.select(this), h = c[0].trace;
          f.style("opacity", h.opacity), f.selectAll("path.surface").each(function(p) {
            n.select(this).call(i, p, h);
          });
        });
      }, styleOne: i };
    }, { "../../components/color": 366, "../../lib": 503, "../bar/uniform_text": 664, "@plotly/d3": 58 }], 845: [function(e, t, r) {
      "use strict";
      for (var n = e("../../plots/attributes"), a = e("../../plots/template_attributes").hovertemplateAttrs, o = e("../../lib/extend").extendFlat, s = e("./constants").colormodel, i = ["rgb", "rgba", "rgba256", "hsl", "hsla"], l = [], u2 = [], c = 0; c < i.length; c++) {
        var f = s[i[c]];
        l.push("For the `" + i[c] + "` colormodel, it is [" + (f.zminDflt || f.min).join(", ") + "]."), u2.push("For the `" + i[c] + "` colormodel, it is [" + (f.zmaxDflt || f.max).join(", ") + "].");
      }
      t.exports = o({ source: { valType: "string", editType: "calc" }, z: { valType: "data_array", editType: "calc" }, colormodel: { valType: "enumerated", values: i, editType: "calc" }, zsmooth: { valType: "enumerated", values: ["fast", false], dflt: false, editType: "plot" }, zmin: { valType: "info_array", items: [{ valType: "number", editType: "calc" }, { valType: "number", editType: "calc" }, { valType: "number", editType: "calc" }, { valType: "number", editType: "calc" }], editType: "calc" }, zmax: { valType: "info_array", items: [{ valType: "number", editType: "calc" }, { valType: "number", editType: "calc" }, { valType: "number", editType: "calc" }, { valType: "number", editType: "calc" }], editType: "calc" }, x0: { valType: "any", dflt: 0, editType: "calc+clearAxisTypes" }, y0: { valType: "any", dflt: 0, editType: "calc+clearAxisTypes" }, dx: { valType: "number", dflt: 1, editType: "calc" }, dy: { valType: "number", dflt: 1, editType: "calc" }, text: { valType: "data_array", editType: "plot" }, hovertext: { valType: "data_array", editType: "plot" }, hoverinfo: o({}, n.hoverinfo, { flags: ["x", "y", "z", "color", "name", "text"], dflt: "x+y+z+text+name" }), hovertemplate: a({}, { keys: ["z", "color", "colormodel"] }), transforms: void 0 });
    }, { "../../lib/extend": 493, "../../plots/attributes": 550, "../../plots/template_attributes": 633, "./constants": 847 }], 846: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("./constants"), o = e("fast-isnumeric"), s = e("../../plots/cartesian/axes"), i = e("../../lib").maxRowLength, l = e("./helpers").getImageSize;
      function u2(f, h, p, d) {
        return function(v) {
          return n.constrain((v - f) * h, p, d);
        };
      }
      function c(f, h) {
        return function(p) {
          return n.constrain(p, f, h);
        };
      }
      t.exports = function(f, h) {
        var p, d;
        if (h._hasZ) p = h.z.length, d = i(h.z);
        else if (h._hasSource) {
          var v = l(h.source);
          p = v.height, d = v.width;
        }
        var m, g = s.getFromId(f, h.xaxis || "x"), x = s.getFromId(f, h.yaxis || "y"), b = g.d2c(h.x0) - h.dx / 2, y = x.d2c(h.y0) - h.dy / 2, w = [b, b + d * h.dx], _4 = [y, y + p * h.dy];
        if (g && g.type === "log") for (m = 0; m < d; m++) w.push(b + m * h.dx);
        if (x && x.type === "log") for (m = 0; m < p; m++) _4.push(y + m * h.dy);
        return h._extremes[g._id] = s.findExtremes(g, w), h._extremes[x._id] = s.findExtremes(x, _4), h._scaler = function(k) {
          var T2 = a.colormodel[k.colormodel], A2 = (T2.colormodel || k.colormodel).length;
          k._sArray = [];
          for (var S2 = 0; S2 < A2; S2++) T2.min[S2] !== k.zmin[S2] || T2.max[S2] !== k.zmax[S2] ? k._sArray.push(u2(k.zmin[S2], (T2.max[S2] - T2.min[S2]) / (k.zmax[S2] - k.zmin[S2]), T2.min[S2], T2.max[S2])) : k._sArray.push(c(T2.min[S2], T2.max[S2]));
          return function(C2) {
            for (var E2 = C2.slice(0, A2), F13 = 0; F13 < A2; F13++) {
              var N2 = E2[F13];
              if (!o(N2)) return false;
              E2[F13] = k._sArray[F13](N2);
            }
            return E2;
          };
        }(h), [{ x0: b, y0: y, z: h.z, w: d, h: p }];
      };
    }, { "../../lib": 503, "../../plots/cartesian/axes": 554, "./constants": 847, "./helpers": 850, "fast-isnumeric": 190 }], 847: [function(e, t, r) {
      "use strict";
      t.exports = { colormodel: { rgb: { min: [0, 0, 0], max: [255, 255, 255], fmt: function(n) {
        return n.slice(0, 3);
      }, suffix: ["", "", ""] }, rgba: { min: [0, 0, 0, 0], max: [255, 255, 255, 1], fmt: function(n) {
        return n.slice(0, 4);
      }, suffix: ["", "", "", ""] }, rgba256: { colormodel: "rgba", zminDflt: [0, 0, 0, 0], zmaxDflt: [255, 255, 255, 255], min: [0, 0, 0, 0], max: [255, 255, 255, 1], fmt: function(n) {
        return n.slice(0, 4);
      }, suffix: ["", "", "", ""] }, hsl: { min: [0, 0, 0], max: [360, 100, 100], fmt: function(n) {
        var a = n.slice(0, 3);
        return a[1] = a[1] + "%", a[2] = a[2] + "%", a;
      }, suffix: ["\xB0", "%", "%"] }, hsla: { min: [0, 0, 0, 0], max: [360, 100, 100, 1], fmt: function(n) {
        var a = n.slice(0, 4);
        return a[1] = a[1] + "%", a[2] = a[2] + "%", a;
      }, suffix: ["\xB0", "%", "%", ""] } }, pixelatedStyle: ["image-rendering: optimizeSpeed", "image-rendering: -moz-crisp-edges", "image-rendering: -o-crisp-edges", "image-rendering: -webkit-optimize-contrast", "image-rendering: optimize-contrast", "image-rendering: crisp-edges", "image-rendering: pixelated", ""].join("; ") };
    }, {}], 848: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("./attributes"), o = e("./constants"), s = e("../../snapshot/helpers").IMAGE_URL_PREFIX;
      t.exports = function(i, l) {
        function u2(h, p) {
          return n.coerce(i, l, a, h, p);
        }
        u2("source"), l.source && !l.source.match(s) && delete l.source, l._hasSource = !!l.source;
        var c, f = u2("z");
        l._hasZ = !(f === void 0 || !f.length || !f[0] || !f[0].length), l._hasZ || l._hasSource ? (u2("x0"), u2("y0"), u2("dx"), u2("dy"), l._hasZ ? (u2("colormodel", "rgb"), u2("zmin", (c = o.colormodel[l.colormodel]).zminDflt || c.min), u2("zmax", c.zmaxDflt || c.max)) : l._hasSource && (l.colormodel = "rgba256", c = o.colormodel[l.colormodel], l.zmin = c.zminDflt, l.zmax = c.zmaxDflt), u2("zsmooth"), u2("text"), u2("hovertext"), u2("hovertemplate"), l._length = null) : l.visible = false;
      };
    }, { "../../lib": 503, "../../snapshot/helpers": 642, "./attributes": 845, "./constants": 847 }], 849: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a) {
        return "xVal" in a && (n.x = a.xVal), "yVal" in a && (n.y = a.yVal), a.xa && (n.xaxis = a.xa), a.ya && (n.yaxis = a.ya), n.color = a.color, n.colormodel = a.trace.colormodel, n.z || (n.z = a.color), n;
      };
    }, {}], 850: [function(e, t, r) {
      "use strict";
      var n = e("probe-image-size/sync"), a = e("../../snapshot/helpers").IMAGE_URL_PREFIX, o = e("buffer/").Buffer;
      r.getImageSize = function(s) {
        var i = s.replace(a, ""), l = new o(i, "base64");
        return n(l);
      };
    }, { "../../snapshot/helpers": 642, "buffer/": 85, "probe-image-size/sync": 276 }], 851: [function(e, t, r) {
      "use strict";
      var n = e("../../components/fx"), a = e("../../lib"), o = e("./constants");
      t.exports = function(s, i, l) {
        var u2 = s.cd[0], c = u2.trace, f = s.xa, h = s.ya;
        if (!(n.inbox(i - u2.x0, i - (u2.x0 + u2.w * c.dx), 0) > 0 || n.inbox(l - u2.y0, l - (u2.y0 + u2.h * c.dy), 0) > 0)) {
          var p, d = Math.floor((i - u2.x0) / c.dx), v = Math.floor(Math.abs(l - u2.y0) / c.dy);
          if (c._hasZ ? p = u2.z[v][d] : c._hasSource && (p = c._canvas.el.getContext("2d").getImageData(d, v, 1, 1).data), p) {
            var m, g = u2.hi || c.hoverinfo;
            if (g) {
              var x = g.split("+");
              x.indexOf("all") !== -1 && (x = ["color"]), x.indexOf("color") !== -1 && (m = true);
            }
            var b, y = o.colormodel[c.colormodel], w = y.colormodel || c.colormodel, _4 = w.length, k = c._scaler(p), T2 = y.suffix, A2 = [];
            (c.hovertemplate || m) && (A2.push("[" + [k[0] + T2[0], k[1] + T2[1], k[2] + T2[2]].join(", ")), _4 === 4 && A2.push(", " + k[3] + T2[3]), A2.push("]"), A2 = A2.join(""), s.extraText = w.toUpperCase() + ": " + A2), Array.isArray(c.hovertext) && Array.isArray(c.hovertext[v]) ? b = c.hovertext[v][d] : Array.isArray(c.text) && Array.isArray(c.text[v]) && (b = c.text[v][d]);
            var S2 = h.c2p(u2.y0 + (v + 0.5) * c.dy), C2 = u2.x0 + (d + 0.5) * c.dx, E2 = u2.y0 + (v + 0.5) * c.dy, F13 = "[" + p.slice(0, c.colormodel.length).join(", ") + "]";
            return [a.extendFlat(s, { index: [v, d], x0: f.c2p(u2.x0 + d * c.dx), x1: f.c2p(u2.x0 + (d + 1) * c.dx), y0: S2, y1: S2, color: k, xVal: C2, xLabelVal: C2, yVal: E2, yLabelVal: E2, zLabelVal: F13, text: b, hovertemplateLabels: { zLabel: F13, colorLabel: A2, "color[0]Label": k[0] + T2[0], "color[1]Label": k[1] + T2[1], "color[2]Label": k[2] + T2[2], "color[3]Label": k[3] + T2[3] } })];
          }
        }
      };
    }, { "../../components/fx": 406, "../../lib": 503, "./constants": 847 }], 852: [function(e, t, r) {
      "use strict";
      t.exports = { attributes: e("./attributes"), supplyDefaults: e("./defaults"), calc: e("./calc"), plot: e("./plot"), style: e("./style"), hoverPoints: e("./hover"), eventData: e("./event_data"), moduleType: "trace", name: "image", basePlotModule: e("../../plots/cartesian"), categories: ["cartesian", "svg", "2dMap", "noSortingByValue"], animatable: false, meta: {} };
    }, { "../../plots/cartesian": 568, "./attributes": 845, "./calc": 846, "./defaults": 848, "./event_data": 849, "./hover": 851, "./plot": 853, "./style": 854 }], 853: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../lib"), o = a.strTranslate, s = e("../../constants/xmlns_namespaces"), i = e("./constants"), l = a.isIOS() || a.isSafari() || a.isIE();
      t.exports = function(u2, c, f, h) {
        var p = c.xaxis, d = c.yaxis, v = !(l || u2._context._exportedPlot);
        a.makeTraceGroups(h, f, "im").each(function(m) {
          var g = n.select(this), x = m[0], b = x.trace, y = (b.zsmooth === "fast" || b.zsmooth === false && v) && !b._hasZ && b._hasSource && p.type === "linear" && d.type === "linear";
          b._realImage = y;
          var w, _4, k, T2, A2, S2, C2 = x.z, E2 = x.x0, F13 = x.y0, N2 = x.w, D2 = x.h, I2 = b.dx, O2 = b.dy;
          for (S2 = 0; w === void 0 && S2 < N2; ) w = p.c2p(E2 + S2 * I2), S2++;
          for (S2 = N2; _4 === void 0 && S2 > 0; ) _4 = p.c2p(E2 + S2 * I2), S2--;
          for (S2 = 0; T2 === void 0 && S2 < D2; ) T2 = d.c2p(F13 + S2 * O2), S2++;
          for (S2 = D2; A2 === void 0 && S2 > 0; ) A2 = d.c2p(F13 + S2 * O2), S2--;
          _4 < w && (k = _4, _4 = w, w = k), A2 < T2 && (k = T2, T2 = A2, A2 = k), !y && (w = Math.max(-0.5 * p._length, w), _4 = Math.min(1.5 * p._length, _4), T2 = Math.max(-0.5 * d._length, T2), A2 = Math.min(1.5 * d._length, A2));
          var L2 = Math.round(_4 - w), V2 = Math.round(A2 - T2);
          if (L2 <= 0 || V2 <= 0) g.selectAll("image").data([]).exit().remove();
          else {
            var W2 = g.selectAll("image").data([m]);
            W2.enter().append("svg:image").attr({ xmlns: s.svg, preserveAspectRatio: "none" }), W2.exit().remove();
            var X2 = b.zsmooth === false ? i.pixelatedStyle : "";
            if (y) {
              var Y2 = a.simpleMap(p.range, p.r2l), K2 = a.simpleMap(d.range, d.r2l), q = Y2[1] < Y2[0], re = K2[1] > K2[0];
              if (q || re) {
                var R2 = w + L2 / 2, z = T2 + V2 / 2;
                X2 += "transform:" + o(R2 + "px", z + "px") + "scale(" + (q ? -1 : 1) + "," + (re ? -1 : 1) + ")" + o(-R2 + "px", -z + "px") + ";";
              }
            }
            W2.attr("style", X2);
            var H2 = new Promise(function(j) {
              if (b._hasZ) j();
              else if (b._hasSource) if (b._canvas && b._canvas.el.width === N2 && b._canvas.el.height === D2 && b._canvas.source === b.source) j();
              else {
                var Q2 = document.createElement("canvas");
                Q2.width = N2, Q2.height = D2;
                var Z2 = Q2.getContext("2d");
                b._image = b._image || new Image();
                var ne = b._image;
                ne.onload = function() {
                  Z2.drawImage(ne, 0, 0), b._canvas = { el: Q2, source: b.source }, j();
                }, ne.setAttribute("src", b.source);
              }
            }).then(function() {
              var j;
              if (b._hasZ) j = te(function(Z2, ne) {
                return C2[ne][Z2];
              }).toDataURL("image/png");
              else if (b._hasSource) if (y) j = b.source;
              else {
                var Q2 = b._canvas.el.getContext("2d").getImageData(0, 0, N2, D2).data;
                j = te(function(Z2, ne) {
                  var ae = 4 * (ne * N2 + Z2);
                  return [Q2[ae], Q2[ae + 1], Q2[ae + 2], Q2[ae + 3]];
                }).toDataURL("image/png");
              }
              W2.attr({ "xlink:href": j, height: V2, width: L2, x: w, y: T2 });
            });
            u2._promises.push(H2);
          }
          function te(j) {
            var Q2 = document.createElement("canvas");
            Q2.width = L2, Q2.height = V2;
            var Z2, ne = Q2.getContext("2d"), ae = function(pe) {
              return a.constrain(Math.round(p.c2p(E2 + pe * I2) - w), 0, L2);
            }, ue = function(pe) {
              return a.constrain(Math.round(d.c2p(F13 + pe * O2) - T2), 0, V2);
            }, le = i.colormodel[b.colormodel], ce = le.colormodel || b.colormodel, se = le.fmt;
            for (S2 = 0; S2 < x.w; S2++) {
              var he = ae(S2), me = ae(S2 + 1);
              if (me !== he && !isNaN(me) && !isNaN(he)) for (var we = 0; we < x.h; we++) {
                var be = ue(we), Ae = ue(we + 1);
                Ae === be || isNaN(Ae) || isNaN(be) || !j(S2, we) || (Z2 = b._scaler(j(S2, we)), ne.fillStyle = Z2 ? ce + "(" + se(Z2).join(",") + ")" : "rgba(0,0,0,0)", ne.fillRect(he, be, me - he, Ae - be));
              }
            }
            return Q2;
          }
        });
      };
    }, { "../../constants/xmlns_namespaces": 480, "../../lib": 503, "./constants": 847, "@plotly/d3": 58 }], 854: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3");
      t.exports = function(a) {
        n.select(a).selectAll(".im image").style("opacity", function(o) {
          return o[0].trace.opacity;
        });
      };
    }, { "@plotly/d3": 58 }], 855: [function(e, t, r) {
      "use strict";
      var n = e("../../lib/extend").extendFlat, a = e("../../lib/extend").extendDeep, o = e("../../plot_api/edit_types").overrideAll, s = e("../../plots/font_attributes"), i = e("../../components/color/attributes"), l = e("../../plots/domain").attributes, u2 = e("../../plots/cartesian/layout_attributes"), c = e("../../plot_api/plot_template").templatedArray, f = e("../../constants/delta.js"), h = e("../../plots/cartesian/axis_format_attributes").descriptionOnlyNumbers, p = s({ editType: "plot", colorEditType: "plot" }), d = { color: { valType: "color", editType: "plot" }, line: { color: { valType: "color", dflt: i.defaultLine, editType: "plot" }, width: { valType: "number", min: 0, dflt: 0, editType: "plot" }, editType: "calc" }, thickness: { valType: "number", min: 0, max: 1, dflt: 1, editType: "plot" }, editType: "calc" }, v = { valType: "info_array", items: [{ valType: "number", editType: "plot" }, { valType: "number", editType: "plot" }], editType: "plot" }, m = c("step", a({}, d, { range: v }));
      t.exports = { mode: { valType: "flaglist", editType: "calc", flags: ["number", "delta", "gauge"], dflt: "number" }, value: { valType: "number", editType: "calc", anim: true }, align: { valType: "enumerated", values: ["left", "center", "right"], editType: "plot" }, domain: l({ name: "indicator", trace: true, editType: "calc" }), title: { text: { valType: "string", editType: "plot" }, align: { valType: "enumerated", values: ["left", "center", "right"], editType: "plot" }, font: n({}, p, {}), editType: "plot" }, number: { valueformat: { valType: "string", dflt: "", editType: "plot", description: h("value") }, font: n({}, p, {}), prefix: { valType: "string", dflt: "", editType: "plot" }, suffix: { valType: "string", dflt: "", editType: "plot" }, editType: "plot" }, delta: { reference: { valType: "number", editType: "calc" }, position: { valType: "enumerated", values: ["top", "bottom", "left", "right"], dflt: "bottom", editType: "plot" }, relative: { valType: "boolean", editType: "plot", dflt: false }, valueformat: { valType: "string", editType: "plot", description: h("value") }, increasing: { symbol: { valType: "string", dflt: f.INCREASING.SYMBOL, editType: "plot" }, color: { valType: "color", dflt: f.INCREASING.COLOR, editType: "plot" }, editType: "plot" }, decreasing: { symbol: { valType: "string", dflt: f.DECREASING.SYMBOL, editType: "plot" }, color: { valType: "color", dflt: f.DECREASING.COLOR, editType: "plot" }, editType: "plot" }, font: n({}, p, {}), editType: "calc" }, gauge: { shape: { valType: "enumerated", editType: "plot", dflt: "angular", values: ["angular", "bullet"] }, bar: a({}, d, { color: { dflt: "green" } }), bgcolor: { valType: "color", editType: "plot" }, bordercolor: { valType: "color", dflt: i.defaultLine, editType: "plot" }, borderwidth: { valType: "number", min: 0, dflt: 1, editType: "plot" }, axis: o({ range: v, visible: n({}, u2.visible, { dflt: true }), tickmode: u2.tickmode, nticks: u2.nticks, tick0: u2.tick0, dtick: u2.dtick, tickvals: u2.tickvals, ticktext: u2.ticktext, ticks: n({}, u2.ticks, { dflt: "outside" }), ticklen: u2.ticklen, tickwidth: u2.tickwidth, tickcolor: u2.tickcolor, showticklabels: u2.showticklabels, tickfont: s({}), tickangle: u2.tickangle, tickformat: u2.tickformat, tickformatstops: u2.tickformatstops, tickprefix: u2.tickprefix, showtickprefix: u2.showtickprefix, ticksuffix: u2.ticksuffix, showticksuffix: u2.showticksuffix, separatethousands: u2.separatethousands, exponentformat: u2.exponentformat, minexponent: u2.minexponent, showexponent: u2.showexponent, editType: "plot" }, "plot"), steps: m, threshold: { line: { color: n({}, d.line.color, {}), width: n({}, d.line.width, { dflt: 1 }), editType: "plot" }, thickness: n({}, d.thickness, { dflt: 0.85 }), value: { valType: "number", editType: "calc", dflt: false }, editType: "plot" }, editType: "plot" } };
    }, { "../../components/color/attributes": 365, "../../constants/delta.js": 473, "../../lib/extend": 493, "../../plot_api/edit_types": 536, "../../plot_api/plot_template": 543, "../../plots/cartesian/axis_format_attributes": 557, "../../plots/cartesian/layout_attributes": 569, "../../plots/domain": 584, "../../plots/font_attributes": 585 }], 856: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/plots");
      r.name = "indicator", r.plot = function(a, o, s, i) {
        n.plotBasePlot(r.name, a, o, s, i);
      }, r.clean = function(a, o, s, i) {
        n.cleanBasePlot(r.name, a, o, s, i);
      };
    }, { "../../plots/plots": 619 }], 857: [function(e, t, r) {
      "use strict";
      t.exports = { calc: function(n, a) {
        var o = [], s = a.value;
        typeof a._lastValue != "number" && (a._lastValue = a.value);
        var i = a._lastValue, l = i;
        return a._hasDelta && typeof a.delta.reference == "number" && (l = a.delta.reference), o[0] = { y: s, lastY: i, delta: s - l, relativeDelta: (s - l) / l }, o;
      } };
    }, {}], 858: [function(e, t, r) {
      "use strict";
      t.exports = { defaultNumberFontSize: 80, bulletNumberDomainSize: 0.25, bulletPadding: 0.025, innerRadius: 0.75, valueThickness: 0.5, titlePadding: 5, horizontalPadding: 10 };
    }, {}], 859: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("./attributes"), o = e("../../plots/domain").defaults, s = e("../../plot_api/plot_template"), i = e("../../plots/array_container_defaults"), l = e("./constants.js"), u2 = e("../../plots/cartesian/tick_value_defaults"), c = e("../../plots/cartesian/tick_mark_defaults"), f = e("../../plots/cartesian/tick_label_defaults"), h = e("../../plots/cartesian/prefix_suffix_defaults");
      function p(d, v) {
        function m(g, x) {
          return n.coerce(d, v, a.gauge.steps, g, x);
        }
        m("color"), m("line.color"), m("line.width"), m("range"), m("thickness");
      }
      t.exports = { supplyDefaults: function(d, v, m, g) {
        function x(N2, D2) {
          return n.coerce(d, v, a, N2, D2);
        }
        o(v, g, x), x("mode"), v._hasNumber = v.mode.indexOf("number") !== -1, v._hasDelta = v.mode.indexOf("delta") !== -1, v._hasGauge = v.mode.indexOf("gauge") !== -1;
        var b = x("value");
        v._range = [0, typeof b == "number" ? 1.5 * b : 1];
        var y, w, _4, k, T2, A2, S2 = new Array(2);
        function C2(N2, D2) {
          return n.coerce(_4, k, a.gauge, N2, D2);
        }
        function E2(N2, D2) {
          return n.coerce(T2, A2, a.gauge.axis, N2, D2);
        }
        if (v._hasNumber && (x("number.valueformat"), x("number.font.color", g.font.color), x("number.font.family", g.font.family), x("number.font.size"), v.number.font.size === void 0 && (v.number.font.size = l.defaultNumberFontSize, S2[0] = true), x("number.prefix"), x("number.suffix"), y = v.number.font.size), v._hasDelta && (x("delta.font.color", g.font.color), x("delta.font.family", g.font.family), x("delta.font.size"), v.delta.font.size === void 0 && (v.delta.font.size = (v._hasNumber ? 0.5 : 1) * (y || l.defaultNumberFontSize), S2[1] = true), x("delta.reference", v.value), x("delta.relative"), x("delta.valueformat", v.delta.relative ? "2%" : ""), x("delta.increasing.symbol"), x("delta.increasing.color"), x("delta.decreasing.symbol"), x("delta.decreasing.color"), x("delta.position"), w = v.delta.font.size), v._scaleNumbers = (!v._hasNumber || S2[0]) && (!v._hasDelta || S2[1]) || false, x("title.font.color", g.font.color), x("title.font.family", g.font.family), x("title.font.size", 0.25 * (y || w || l.defaultNumberFontSize)), x("title.text"), v._hasGauge) {
          (_4 = d.gauge) || (_4 = {}), k = s.newContainer(v, "gauge"), C2("shape"), (v._isBullet = v.gauge.shape === "bullet") || x("title.align", "center"), (v._isAngular = v.gauge.shape === "angular") || x("align", "center"), C2("bgcolor", g.paper_bgcolor), C2("borderwidth"), C2("bordercolor"), C2("bar.color"), C2("bar.line.color"), C2("bar.line.width"), C2("bar.thickness", l.valueThickness * (v.gauge.shape === "bullet" ? 0.5 : 1)), i(_4, k, { name: "steps", handleItemDefaults: p }), C2("threshold.value"), C2("threshold.thickness"), C2("threshold.line.width"), C2("threshold.line.color"), T2 = {}, _4 && (T2 = _4.axis || {}), A2 = s.newContainer(k, "axis"), E2("visible"), v._range = E2("range", v._range);
          var F13 = { outerTicks: true };
          u2(T2, A2, E2, "linear"), h(T2, A2, E2, "linear", F13), f(T2, A2, E2, "linear", F13), c(T2, A2, E2, F13);
        } else x("title.align", "center"), x("align", "center"), v._isAngular = v._isBullet = false;
        v._length = null;
      } };
    }, { "../../lib": 503, "../../plot_api/plot_template": 543, "../../plots/array_container_defaults": 549, "../../plots/cartesian/prefix_suffix_defaults": 573, "../../plots/cartesian/tick_label_defaults": 578, "../../plots/cartesian/tick_mark_defaults": 579, "../../plots/cartesian/tick_value_defaults": 580, "../../plots/domain": 584, "./attributes": 855, "./constants.js": 858 }], 860: [function(e, t, r) {
      "use strict";
      t.exports = { moduleType: "trace", name: "indicator", basePlotModule: e("./base_plot"), categories: ["svg", "noOpacity", "noHover"], animatable: true, attributes: e("./attributes"), supplyDefaults: e("./defaults").supplyDefaults, calc: e("./calc").calc, plot: e("./plot"), meta: {} };
    }, { "./attributes": 855, "./base_plot": 856, "./calc": 857, "./defaults": 859, "./plot": 861 }], 861: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("d3-interpolate").interpolate, o = e("d3-interpolate").interpolateNumber, s = e("../../lib"), i = s.strScale, l = s.strTranslate, u2 = s.rad2deg, c = e("../../constants/alignment").MID_SHIFT, f = e("../../components/drawing"), h = e("./constants"), p = e("../../lib/svg_text_utils"), d = e("../../plots/cartesian/axes"), v = e("../../plots/cartesian/axis_defaults"), m = e("../../plots/cartesian/position_defaults"), g = e("../../plots/cartesian/layout_attributes"), x = e("../../components/color"), b = { left: "start", center: "middle", right: "end" }, y = { left: 0, center: 0.5, right: 1 }, w = /[yzafpn\xb5mkMGTPEZY]/;
      function _4(E2) {
        return E2 && E2.duration > 0;
      }
      function k(E2) {
        E2.each(function(F13) {
          x.stroke(n.select(this), F13.line.color);
        }).each(function(F13) {
          x.fill(n.select(this), F13.color);
        }).style("stroke-width", function(F13) {
          return F13.line.width;
        });
      }
      function T2(E2, F13, N2) {
        var D2 = E2._fullLayout, I2 = s.extendFlat({ type: "linear", ticks: "outside", range: N2, showline: true }, F13), O2 = { type: "linear", _id: "x" + F13._id }, L2 = { letter: "x", font: D2.font, noHover: true, noTickson: true };
        function V2(W2, X2) {
          return s.coerce(I2, O2, g, W2, X2);
        }
        return v(I2, O2, V2, L2, D2), m(I2, O2, V2, L2), O2;
      }
      function A2(E2, F13, N2) {
        return [Math.min(F13 / E2.width, N2 / E2.height), E2, F13 + "x" + N2];
      }
      function S2(E2, F13, N2, D2) {
        var I2 = document.createElementNS("http://www.w3.org/2000/svg", "text"), O2 = n.select(I2);
        return O2.text(E2).attr("x", 0).attr("y", 0).attr("text-anchor", N2).attr("data-unformatted", E2).call(p.convertToTspans, D2).call(f.font, F13), f.bBox(O2.node());
      }
      function C2(E2, F13, N2, D2, I2, O2) {
        var L2 = "_cache" + F13;
        E2[L2] && E2[L2].key === I2 || (E2[L2] = { key: I2, value: N2 });
        var V2 = s.aggNums(O2, null, [E2[L2].value, D2], 2);
        return E2[L2].value = V2, V2;
      }
      t.exports = function(E2, F13, N2, D2) {
        var I2, O2 = E2._fullLayout;
        _4(N2) && D2 && (I2 = D2()), s.makeTraceGroups(O2._indicatorlayer, F13, "trace").each(function(L2) {
          var V2, W2, X2, Y2, K2, q = L2[0].trace, re = n.select(this), R2 = q._hasGauge, z = q._isAngular, H2 = q._isBullet, te = q.domain, j = { w: O2._size.w * (te.x[1] - te.x[0]), h: O2._size.h * (te.y[1] - te.y[0]), l: O2._size.l + O2._size.w * te.x[0], r: O2._size.r + O2._size.w * (1 - te.x[1]), t: O2._size.t + O2._size.h * (1 - te.y[1]), b: O2._size.b + O2._size.h * te.y[0] }, Q2 = j.l + j.w / 2, Z2 = j.t + j.h / 2, ne = Math.min(j.w / 2, j.h), ae = h.innerRadius * ne, ue = q.align || "center";
          if (W2 = Z2, R2) {
            if (z && (V2 = Q2, W2 = Z2 + ne / 2, X2 = function(Ae) {
              return function(pe, ve) {
                var Ee = Math.sqrt(pe.width / 2 * (pe.width / 2) + pe.height * pe.height);
                return [ve / Ee, pe, ve];
              }(Ae, 0.9 * ae);
            }), H2) {
              var le = h.bulletPadding, ce = 1 - h.bulletNumberDomainSize + le;
              V2 = j.l + (ce + (1 - ce) * y[ue]) * j.w, X2 = function(Ae) {
                return A2(Ae, (h.bulletNumberDomainSize - le) * j.w, j.h);
              };
            }
          } else V2 = j.l + y[ue] * j.w, X2 = function(Ae) {
            return A2(Ae, j.w, j.h);
          };
          (function(Ae, pe, ve, Ee) {
            var Se, Ce, Be, Ue = ve[0].trace, Ke = Ee.numbersX, ct = Ee.numbersY, We = Ue.align || "center", Ze = b[We], it = Ee.transitionOpts, ot = Ee.onComplete, mt = s.ensureSingle(pe, "g", "numbers"), wt = [];
            Ue._hasNumber && wt.push("number"), Ue._hasDelta && (wt.push("delta"), Ue.delta.position === "left" && wt.reverse());
            var Et = mt.selectAll("text").data(wt);
            function zt(at, Ge, st, Ie) {
              if (!at.match("s") || st >= 0 == Ie >= 0 || Ge(st).slice(-1).match(w) || Ge(Ie).slice(-1).match(w)) return Ge;
              var Pe = at.slice().replace("s", "f").replace(/\d+/, function(Ve) {
                return parseInt(Ve) - 1;
              }), $e = T2(Ae, { tickformat: Pe });
              return function(Ve) {
                return Math.abs(Ve) < 1 ? d.tickText($e, Ve).text : Ge(Ve);
              };
            }
            Et.enter().append("text"), Et.attr("text-anchor", function() {
              return Ze;
            }).attr("class", function(at) {
              return at;
            }).attr("x", null).attr("y", null).attr("dx", null).attr("dy", null), Et.exit().remove();
            var Nt, yt = Ue.mode + Ue.align;
            if (Ue._hasDelta && (Nt = function() {
              var at = T2(Ae, { tickformat: Ue.delta.valueformat }, Ue._range);
              at.setScale(), d.prepTicks(at);
              var Ge = function(ut) {
                return d.tickText(at, ut).text;
              }, st = function(ut) {
                return Ue.delta.relative ? ut.relativeDelta : ut.delta;
              }, Ie = function(ut, Re) {
                return ut === 0 || typeof ut != "number" || isNaN(ut) ? "-" : (ut > 0 ? Ue.delta.increasing.symbol : Ue.delta.decreasing.symbol) + Re(ut);
              }, Pe = function(ut) {
                return ut.delta >= 0 ? Ue.delta.increasing.color : Ue.delta.decreasing.color;
              };
              Ue._deltaLastValue === void 0 && (Ue._deltaLastValue = st(ve[0]));
              var $e = mt.select("text.delta");
              function Ve() {
                $e.text(Ie(st(ve[0]), Ge)).call(x.fill, Pe(ve[0])).call(p.convertToTspans, Ae);
              }
              return $e.call(f.font, Ue.delta.font).call(x.fill, Pe({ delta: Ue._deltaLastValue })), _4(it) ? $e.transition().duration(it.duration).ease(it.easing).tween("text", function() {
                var ut = n.select(this), Re = st(ve[0]), qe = Ue._deltaLastValue, je = zt(Ue.delta.valueformat, Ge, qe, Re), rt = o(qe, Re);
                return Ue._deltaLastValue = Re, function(He) {
                  ut.text(Ie(rt(He), je)), ut.call(x.fill, Pe({ delta: rt(He) }));
                };
              }).each("end", function() {
                Ve(), ot && ot();
              }).each("interrupt", function() {
                Ve(), ot && ot();
              }) : Ve(), Ce = S2(Ie(st(ve[0]), Ge), Ue.delta.font, Ze, Ae), $e;
            }(), yt += Ue.delta.position + Ue.delta.font.size + Ue.delta.font.family + Ue.delta.valueformat, yt += Ue.delta.increasing.symbol + Ue.delta.decreasing.symbol, Be = Ce), Ue._hasNumber && (function() {
              var at = T2(Ae, { tickformat: Ue.number.valueformat }, Ue._range);
              at.setScale(), d.prepTicks(at);
              var Ge = function(Ve) {
                return d.tickText(at, Ve).text;
              }, st = Ue.number.suffix, Ie = Ue.number.prefix, Pe = mt.select("text.number");
              function $e() {
                var Ve = typeof ve[0].y == "number" ? Ie + Ge(ve[0].y) + st : "-";
                Pe.text(Ve).call(f.font, Ue.number.font).call(p.convertToTspans, Ae);
              }
              _4(it) ? Pe.transition().duration(it.duration).ease(it.easing).each("end", function() {
                $e(), ot && ot();
              }).each("interrupt", function() {
                $e(), ot && ot();
              }).attrTween("text", function() {
                var Ve = n.select(this), ut = o(ve[0].lastY, ve[0].y);
                Ue._lastValue = ve[0].y;
                var Re = zt(Ue.number.valueformat, Ge, ve[0].lastY, ve[0].y);
                return function(qe) {
                  Ve.text(Ie + Re(ut(qe)) + st);
                };
              }) : $e(), Se = S2(Ie + Ge(ve[0].y) + st, Ue.number.font, Ze, Ae);
            }(), yt += Ue.number.font.size + Ue.number.font.family + Ue.number.valueformat + Ue.number.suffix + Ue.number.prefix, Be = Se), Ue._hasDelta && Ue._hasNumber) {
              var pt, Ot, Jt = [(Se.left + Se.right) / 2, (Se.top + Se.bottom) / 2], tr = [(Ce.left + Ce.right) / 2, (Ce.top + Ce.bottom) / 2], Ye = 0.75 * Ue.delta.font.size;
              Ue.delta.position === "left" && (pt = C2(Ue, "deltaPos", 0, -1 * (Se.width * y[Ue.align] + Ce.width * (1 - y[Ue.align]) + Ye), yt, Math.min), Ot = Jt[1] - tr[1], Be = { width: Se.width + Ce.width + Ye, height: Math.max(Se.height, Ce.height), left: Ce.left + pt, right: Se.right, top: Math.min(Se.top, Ce.top + Ot), bottom: Math.max(Se.bottom, Ce.bottom + Ot) }), Ue.delta.position === "right" && (pt = C2(Ue, "deltaPos", 0, Se.width * (1 - y[Ue.align]) + Ce.width * y[Ue.align] + Ye, yt, Math.max), Ot = Jt[1] - tr[1], Be = { width: Se.width + Ce.width + Ye, height: Math.max(Se.height, Ce.height), left: Se.left, right: Ce.right + pt, top: Math.min(Se.top, Ce.top + Ot), bottom: Math.max(Se.bottom, Ce.bottom + Ot) }), Ue.delta.position === "bottom" && (pt = null, Ot = Ce.height, Be = { width: Math.max(Se.width, Ce.width), height: Se.height + Ce.height, left: Math.min(Se.left, Ce.left), right: Math.max(Se.right, Ce.right), top: Se.bottom - Se.height, bottom: Se.bottom + Ce.height }), Ue.delta.position === "top" && (pt = null, Ot = Se.top, Be = { width: Math.max(Se.width, Ce.width), height: Se.height + Ce.height, left: Math.min(Se.left, Ce.left), right: Math.max(Se.right, Ce.right), top: Se.bottom - Se.height - Ce.height, bottom: Se.bottom }), Nt.attr({ dx: pt, dy: Ot });
            }
            (Ue._hasNumber || Ue._hasDelta) && mt.attr("transform", function() {
              var at = Ee.numbersScaler(Be);
              yt += at[2];
              var Ge, st = C2(Ue, "numbersScale", 1, at[0], yt, Math.min);
              Ue._scaleNumbers || (st = 1), Ge = Ue._isAngular ? ct - st * Be.bottom : ct - st * (Be.top + Be.bottom) / 2, Ue._numbersTop = st * Be.top + Ge;
              var Ie = Be[We];
              We === "center" && (Ie = (Be.left + Be.right) / 2);
              var Pe = Ke - st * Ie;
              return Pe = C2(Ue, "numbersTranslate", 0, Pe, yt, Math.max), l(Pe, Ge) + i(st);
            });
          })(E2, re, L2, { numbersX: V2, numbersY: W2, numbersScaler: X2, transitionOpts: N2, onComplete: I2 }), R2 && (Y2 = { range: q.gauge.axis.range, color: q.gauge.bgcolor, line: { color: q.gauge.bordercolor, width: 0 }, thickness: 1 }, K2 = { range: q.gauge.axis.range, color: "rgba(0, 0, 0, 0)", line: { color: q.gauge.bordercolor, width: q.gauge.borderwidth }, thickness: 1 });
          var se = re.selectAll("g.angular").data(z ? L2 : []);
          se.exit().remove();
          var he = re.selectAll("g.angularaxis").data(z ? L2 : []);
          he.exit().remove(), z && function(Ae, pe, ve, Ee) {
            var Se, Ce, Be, Ue, Ke = ve[0].trace, ct = Ee.size, We = Ee.radius, Ze = Ee.innerRadius, it = Ee.gaugeBg, ot = Ee.gaugeOutline, mt = [ct.l + ct.w / 2, ct.t + ct.h / 2 + We / 2], wt = Ee.gauge, Et = Ee.layer, zt = Ee.transitionOpts, Nt = Ee.onComplete, yt = Math.PI / 2;
            function pt(Ne) {
              var ke = Ke.gauge.axis.range[0], Me = (Ne - ke) / (Ke.gauge.axis.range[1] - ke) * Math.PI - yt;
              return Me < -yt ? -yt : Me > yt ? yt : Me;
            }
            function Ot(Ne) {
              return n.svg.arc().innerRadius((Ze + We) / 2 - Ne / 2 * (We - Ze)).outerRadius((Ze + We) / 2 + Ne / 2 * (We - Ze)).startAngle(-yt);
            }
            function Jt(Ne) {
              Ne.attr("d", function(ke) {
                return Ot(ke.thickness).startAngle(pt(ke.range[0])).endAngle(pt(ke.range[1]))();
              });
            }
            wt.enter().append("g").classed("angular", true), wt.attr("transform", l(mt[0], mt[1])), Et.enter().append("g").classed("angularaxis", true).classed("crisp", true), Et.selectAll("g.xangularaxistick,path,text").remove(), (Se = T2(Ae, Ke.gauge.axis)).type = "linear", Se.range = Ke.gauge.axis.range, Se._id = "xangularaxis", Se.ticklabeloverflow = "allow", Se.setScale();
            var tr = function(Ne) {
              return (Se.range[0] - Ne.x) / (Se.range[1] - Se.range[0]) * Math.PI + Math.PI;
            }, Ye = {}, at = d.makeLabelFns(Se, 0).labelStandoff;
            Ye.xFn = function(Ne) {
              var ke = tr(Ne);
              return Math.cos(ke) * at;
            }, Ye.yFn = function(Ne) {
              var ke = tr(Ne), Me = Math.sin(ke) > 0 ? 0.2 : 1;
              return -Math.sin(ke) * (at + Ne.fontSize * Me) + Math.abs(Math.cos(ke)) * (Ne.fontSize * c);
            }, Ye.anchorFn = function(Ne) {
              var ke = tr(Ne), Me = Math.cos(ke);
              return Math.abs(Me) < 0.1 ? "middle" : Me > 0 ? "start" : "end";
            }, Ye.heightFn = function(Ne, ke, Me) {
              var Le = tr(Ne);
              return -0.5 * (1 + Math.sin(Le)) * Me;
            };
            var Ge = function(Ne) {
              return l(mt[0] + We * Math.cos(Ne), mt[1] - We * Math.sin(Ne));
            };
            if (Be = function(Ne) {
              return Ge(tr(Ne));
            }, Ce = d.calcTicks(Se), Ue = d.getTickSigns(Se)[2], Se.visible) {
              Ue = Se.ticks === "inside" ? -1 : 1;
              var st = (Se.linewidth || 1) / 2;
              d.drawTicks(Ae, Se, { vals: Ce, layer: Et, path: "M" + Ue * st + ",0h" + Ue * Se.ticklen, transFn: function(Ne) {
                var ke = tr(Ne);
                return Ge(ke) + "rotate(" + -u2(ke) + ")";
              } }), d.drawLabels(Ae, Se, { vals: Ce, layer: Et, transFn: Be, labelFns: Ye });
            }
            var Ie = [it].concat(Ke.gauge.steps), Pe = wt.selectAll("g.bg-arc").data(Ie);
            Pe.enter().append("g").classed("bg-arc", true).append("path"), Pe.select("path").call(Jt).call(k), Pe.exit().remove();
            var $e = Ot(Ke.gauge.bar.thickness), Ve = wt.selectAll("g.value-arc").data([Ke.gauge.bar]);
            Ve.enter().append("g").classed("value-arc", true).append("path");
            var ut = Ve.select("path");
            _4(zt) ? (ut.transition().duration(zt.duration).ease(zt.easing).each("end", function() {
              Nt && Nt();
            }).each("interrupt", function() {
              Nt && Nt();
            }).attrTween("d", (Re = $e, qe = pt(ve[0].lastY), je = pt(ve[0].y), function() {
              var Ne = a(qe, je);
              return function(ke) {
                return Re.endAngle(Ne(ke))();
              };
            })), Ke._lastValue = ve[0].y) : ut.attr("d", typeof ve[0].y == "number" ? $e.endAngle(pt(ve[0].y)) : "M0,0Z");
            var Re, qe, je;
            ut.call(k), Ve.exit().remove(), Ie = [];
            var rt = Ke.gauge.threshold.value;
            (rt || rt === 0) && Ie.push({ range: [rt, rt], color: Ke.gauge.threshold.color, line: { color: Ke.gauge.threshold.line.color, width: Ke.gauge.threshold.line.width }, thickness: Ke.gauge.threshold.thickness });
            var He = wt.selectAll("g.threshold-arc").data(Ie);
            He.enter().append("g").classed("threshold-arc", true).append("path"), He.select("path").call(Jt).call(k), He.exit().remove();
            var xe = wt.selectAll("g.gauge-outline").data([ot]);
            xe.enter().append("g").classed("gauge-outline", true).append("path"), xe.select("path").call(Jt).call(k), xe.exit().remove();
          }(E2, 0, L2, { radius: ne, innerRadius: ae, gauge: se, layer: he, size: j, gaugeBg: Y2, gaugeOutline: K2, transitionOpts: N2, onComplete: I2 });
          var me = re.selectAll("g.bullet").data(H2 ? L2 : []);
          me.exit().remove();
          var we = re.selectAll("g.bulletaxis").data(H2 ? L2 : []);
          we.exit().remove(), H2 && function(Ae, pe, ve, Ee) {
            var Se, Ce, Be, Ue, Ke, ct = ve[0].trace, We = Ee.gauge, Ze = Ee.layer, it = Ee.gaugeBg, ot = Ee.gaugeOutline, mt = Ee.size, wt = ct.domain, Et = Ee.transitionOpts, zt = Ee.onComplete;
            We.enter().append("g").classed("bullet", true), We.attr("transform", l(mt.l, mt.t)), Ze.enter().append("g").classed("bulletaxis", true).classed("crisp", true), Ze.selectAll("g.xbulletaxistick,path,text").remove();
            var Nt = mt.h, yt = ct.gauge.bar.thickness * Nt, pt = wt.x[0], Ot = wt.x[0] + (wt.x[1] - wt.x[0]) * (ct._hasNumber || ct._hasDelta ? 1 - h.bulletNumberDomainSize : 1);
            (Se = T2(Ae, ct.gauge.axis))._id = "xbulletaxis", Se.domain = [pt, Ot], Se.setScale(), Ce = d.calcTicks(Se), Be = d.makeTransTickFn(Se), Ue = d.getTickSigns(Se)[2], Ke = mt.t + mt.h, Se.visible && (d.drawTicks(Ae, Se, { vals: Se.ticks === "inside" ? d.clipEnds(Se, Ce) : Ce, layer: Ze, path: d.makeTickPath(Se, Ke, Ue), transFn: Be }), d.drawLabels(Ae, Se, { vals: Ce, layer: Ze, transFn: Be, labelFns: d.makeLabelFns(Se, Ke) }));
            function Jt(Pe) {
              Pe.attr("width", function($e) {
                return Math.max(0, Se.c2p($e.range[1]) - Se.c2p($e.range[0]));
              }).attr("x", function($e) {
                return Se.c2p($e.range[0]);
              }).attr("y", function($e) {
                return 0.5 * (1 - $e.thickness) * Nt;
              }).attr("height", function($e) {
                return $e.thickness * Nt;
              });
            }
            var tr = [it].concat(ct.gauge.steps), Ye = We.selectAll("g.bg-bullet").data(tr);
            Ye.enter().append("g").classed("bg-bullet", true).append("rect"), Ye.select("rect").call(Jt).call(k), Ye.exit().remove();
            var at = We.selectAll("g.value-bullet").data([ct.gauge.bar]);
            at.enter().append("g").classed("value-bullet", true).append("rect"), at.select("rect").attr("height", yt).attr("y", (Nt - yt) / 2).call(k), _4(Et) ? at.select("rect").transition().duration(Et.duration).ease(Et.easing).each("end", function() {
              zt && zt();
            }).each("interrupt", function() {
              zt && zt();
            }).attr("width", Math.max(0, Se.c2p(Math.min(ct.gauge.axis.range[1], ve[0].y)))) : at.select("rect").attr("width", typeof ve[0].y == "number" ? Math.max(0, Se.c2p(Math.min(ct.gauge.axis.range[1], ve[0].y))) : 0), at.exit().remove();
            var Ge = ve.filter(function() {
              return ct.gauge.threshold.value || ct.gauge.threshold.value === 0;
            }), st = We.selectAll("g.threshold-bullet").data(Ge);
            st.enter().append("g").classed("threshold-bullet", true).append("line"), st.select("line").attr("x1", Se.c2p(ct.gauge.threshold.value)).attr("x2", Se.c2p(ct.gauge.threshold.value)).attr("y1", (1 - ct.gauge.threshold.thickness) / 2 * Nt).attr("y2", (1 - (1 - ct.gauge.threshold.thickness) / 2) * Nt).call(x.stroke, ct.gauge.threshold.line.color).style("stroke-width", ct.gauge.threshold.line.width), st.exit().remove();
            var Ie = We.selectAll("g.gauge-outline").data([ot]);
            Ie.enter().append("g").classed("gauge-outline", true).append("rect"), Ie.select("rect").call(Jt).call(k), Ie.exit().remove();
          }(E2, 0, L2, { gauge: me, layer: we, size: j, gaugeBg: Y2, gaugeOutline: K2, transitionOpts: N2, onComplete: I2 });
          var be = re.selectAll("text.title").data(L2);
          be.exit().remove(), be.enter().append("text").classed("title", true), be.attr("text-anchor", function() {
            return H2 ? b.right : b[q.title.align];
          }).text(q.title.text).call(f.font, q.title.font).call(p.convertToTspans, E2), be.attr("transform", function() {
            var Ae, pe = j.l + j.w * y[q.title.align], ve = h.titlePadding, Ee = f.bBox(be.node());
            return R2 ? (z && (q.gauge.axis.visible ? Ae = f.bBox(he.node()).top - ve - Ee.bottom : Ae = j.t + j.h / 2 - ne / 2 - Ee.bottom - ve), H2 && (Ae = W2 - (Ee.top + Ee.bottom) / 2, pe = j.l - h.bulletPadding * j.w)) : Ae = q._numbersTop - ve - Ee.bottom, l(pe, Ae);
          });
        });
      };
    }, { "../../components/color": 366, "../../components/drawing": 388, "../../constants/alignment": 471, "../../lib": 503, "../../lib/svg_text_utils": 529, "../../plots/cartesian/axes": 554, "../../plots/cartesian/axis_defaults": 556, "../../plots/cartesian/layout_attributes": 569, "../../plots/cartesian/position_defaults": 572, "./constants": 858, "@plotly/d3": 58, "d3-interpolate": 116 }], 862: [function(e, t, r) {
      "use strict";
      var n = e("../../components/colorscale/attributes"), a = e("../../plots/cartesian/axis_format_attributes").axisHoverFormat, o = e("../../plots/template_attributes").hovertemplateAttrs, s = e("../mesh3d/attributes"), i = e("../../plots/attributes"), l = e("../../lib/extend").extendFlat, u2 = e("../../plot_api/edit_types").overrideAll, c = t.exports = u2(l({ x: { valType: "data_array" }, y: { valType: "data_array" }, z: { valType: "data_array" }, value: { valType: "data_array" }, isomin: { valType: "number" }, isomax: { valType: "number" }, surface: { show: { valType: "boolean", dflt: true }, count: { valType: "integer", dflt: 2, min: 1 }, fill: { valType: "number", min: 0, max: 1, dflt: 1 }, pattern: { valType: "flaglist", flags: ["A", "B", "C", "D", "E"], extras: ["all", "odd", "even"], dflt: "all" } }, spaceframe: { show: { valType: "boolean", dflt: false }, fill: { valType: "number", min: 0, max: 1, dflt: 0.15 } }, slices: { x: { show: { valType: "boolean", dflt: false }, locations: { valType: "data_array", dflt: [] }, fill: { valType: "number", min: 0, max: 1, dflt: 1 } }, y: { show: { valType: "boolean", dflt: false }, locations: { valType: "data_array", dflt: [] }, fill: { valType: "number", min: 0, max: 1, dflt: 1 } }, z: { show: { valType: "boolean", dflt: false }, locations: { valType: "data_array", dflt: [] }, fill: { valType: "number", min: 0, max: 1, dflt: 1 } } }, caps: { x: { show: { valType: "boolean", dflt: true }, fill: { valType: "number", min: 0, max: 1, dflt: 1 } }, y: { show: { valType: "boolean", dflt: true }, fill: { valType: "number", min: 0, max: 1, dflt: 1 } }, z: { show: { valType: "boolean", dflt: true }, fill: { valType: "number", min: 0, max: 1, dflt: 1 } } }, text: { valType: "string", dflt: "", arrayOk: true }, hovertext: { valType: "string", dflt: "", arrayOk: true }, hovertemplate: o(), xhoverformat: a("x"), yhoverformat: a("y"), zhoverformat: a("z"), valuehoverformat: a("value", 1), showlegend: l({}, i.showlegend, { dflt: false }) }, n("", { colorAttr: "`value`", showScaleDflt: true, editTypeOverride: "calc" }), { opacity: s.opacity, lightposition: s.lightposition, lighting: s.lighting, flatshading: s.flatshading, contour: s.contour, hoverinfo: l({}, i.hoverinfo) }), "calc", "nested");
      c.flatshading.dflt = true, c.lighting.facenormalsepsilon.dflt = 0, c.x.editType = c.y.editType = c.z.editType = c.value.editType = "calc+clearAxisTypes", c.transforms = void 0;
    }, { "../../components/colorscale/attributes": 373, "../../lib/extend": 493, "../../plot_api/edit_types": 536, "../../plots/attributes": 550, "../../plots/cartesian/axis_format_attributes": 557, "../../plots/template_attributes": 633, "../mesh3d/attributes": 867 }], 863: [function(e, t, r) {
      "use strict";
      var n = e("../../components/colorscale/calc"), a = e("../streamtube/calc").processGrid, o = e("../streamtube/calc").filter;
      t.exports = function(s, i) {
        i._len = Math.min(i.x.length, i.y.length, i.z.length, i.value.length), i._x = o(i.x, i._len), i._y = o(i.y, i._len), i._z = o(i.z, i._len), i._value = o(i.value, i._len);
        var l = a(i);
        i._gridFill = l.fill, i._Xs = l.Xs, i._Ys = l.Ys, i._Zs = l.Zs, i._len = l.len;
        for (var u2 = 1 / 0, c = -1 / 0, f = 0; f < i._len; f++) {
          var h = i._value[f];
          u2 = Math.min(u2, h), c = Math.max(c, h);
        }
        i._minValues = u2, i._maxValues = c, i._vMin = i.isomin === void 0 || i.isomin === null ? u2 : i.isomin, i._vMax = i.isomax === void 0 || i.isomin === null ? c : i.isomax, n(s, i, { vals: [i._vMin, i._vMax], containerStr: "", cLetter: "c" });
      };
    }, { "../../components/colorscale/calc": 374, "../streamtube/calc": 1041 }], 864: [function(e, t, r) {
      "use strict";
      var n = e("../../../stackgl_modules").gl_mesh3d, a = e("../../lib/gl_format_color").parseColorScale, o = e("../../lib/str2rgbarray"), s = e("../../components/colorscale").extractOpts, i = e("../../plots/gl3d/zip3"), l = function(p, d) {
        for (var v = d.length - 1; v > 0; v--) {
          var m = Math.min(d[v], d[v - 1]), g = Math.max(d[v], d[v - 1]);
          if (g > m && m < p && p <= g) return { id: v, distRatio: (g - p) / (g - m) };
        }
        return { id: 0, distRatio: 0 };
      };
      function u2(p, d, v) {
        this.scene = p, this.uid = v, this.mesh = d, this.name = "", this.data = null, this.showContour = false;
      }
      var c = u2.prototype;
      c.handlePick = function(p) {
        if (p.object === this.mesh) {
          var d = p.data.index, v = this.data._meshX[d], m = this.data._meshY[d], g = this.data._meshZ[d], x = this.data._Ys.length, b = this.data._Zs.length, y = l(v, this.data._Xs).id, w = l(m, this.data._Ys).id, _4 = l(g, this.data._Zs).id, k = p.index = _4 + b * w + b * x * y;
          p.traceCoordinate = [this.data._meshX[k], this.data._meshY[k], this.data._meshZ[k], this.data._value[k]];
          var T2 = this.data.hovertext || this.data.text;
          return Array.isArray(T2) && T2[k] !== void 0 ? p.textLabel = T2[k] : T2 && (p.textLabel = T2), true;
        }
      }, c.update = function(p) {
        var d = this.scene, v = d.fullSceneLayout;
        function m(b, y, w, _4) {
          return y.map(function(k) {
            return b.d2l(k, 0, _4) * w;
          });
        }
        this.data = h(p);
        var g = { positions: i(m(v.xaxis, p._meshX, d.dataScale[0], p.xcalendar), m(v.yaxis, p._meshY, d.dataScale[1], p.ycalendar), m(v.zaxis, p._meshZ, d.dataScale[2], p.zcalendar)), cells: i(p._meshI, p._meshJ, p._meshK), lightPosition: [p.lightposition.x, p.lightposition.y, p.lightposition.z], ambient: p.lighting.ambient, diffuse: p.lighting.diffuse, specular: p.lighting.specular, roughness: p.lighting.roughness, fresnel: p.lighting.fresnel, vertexNormalsEpsilon: p.lighting.vertexnormalsepsilon, faceNormalsEpsilon: p.lighting.facenormalsepsilon, opacity: p.opacity, contourEnable: p.contour.show, contourColor: o(p.contour.color).slice(0, 3), contourWidth: p.contour.width, useFacetNormals: p.flatshading }, x = s(p);
        g.vertexIntensity = p._meshIntensity, g.vertexIntensityBounds = [x.min, x.max], g.colormap = a(p), this.mesh.update(g);
      }, c.dispose = function() {
        this.scene.glplot.remove(this.mesh), this.mesh.dispose();
      };
      var f = ["xyz", "xzy", "yxz", "yzx", "zxy", "zyx"];
      function h(p) {
        p._meshI = [], p._meshJ = [], p._meshK = [];
        var d, v, m, g, x, b, y, w = p.surface.show, _4 = p.spaceframe.show, k = p.surface.fill, T2 = p.spaceframe.fill, A2 = false, S2 = false, C2 = 0, E2 = p._Xs, F13 = p._Ys, N2 = p._Zs, D2 = E2.length, I2 = F13.length, O2 = N2.length, L2 = f.indexOf(p._gridFill.replace(/-/g, "").replace(/\+/g, "")), V2 = function(We, Ze, it) {
          switch (L2) {
            case 5:
              return it + O2 * Ze + O2 * I2 * We;
            case 4:
              return it + O2 * We + O2 * D2 * Ze;
            case 3:
              return Ze + I2 * it + I2 * O2 * We;
            case 2:
              return Ze + I2 * We + I2 * D2 * it;
            case 1:
              return We + D2 * it + D2 * O2 * Ze;
            default:
              return We + D2 * Ze + D2 * I2 * it;
          }
        }, W2 = p._minValues, X2 = p._maxValues, Y2 = p._vMin, K2 = p._vMax;
        function q(We, Ze, it) {
          for (var ot = b.length, mt = v; mt < ot; mt++) if (We === m[mt] && Ze === g[mt] && it === x[mt]) return mt;
          return -1;
        }
        function re() {
          v = d;
        }
        function R2() {
          m = [], g = [], x = [], b = [], d = 0, re();
        }
        function z(We, Ze, it, ot) {
          return m.push(We), g.push(Ze), x.push(it), b.push(ot), ++d - 1;
        }
        function H2(We, Ze, it) {
          for (var ot = [], mt = 0; mt < We.length; mt++) ot[mt] = We[mt] * (1 - it) + it * Ze[mt];
          return ot;
        }
        function te(We) {
          y = We;
        }
        function j(We, Ze) {
          return We === "all" || We === null || We.indexOf(Ze) > -1;
        }
        function Q2(We, Ze) {
          return We === null ? Ze : We;
        }
        function Z2(We, Ze, it) {
          re();
          var ot, mt, wt, Et = [Ze], zt = [it];
          if (y >= 1) Et = [Ze], zt = [it];
          else if (y > 0) {
            var Nt = function(st, Ie) {
              var Pe = st[0], $e = st[1], Ve = st[2], ut = function(ke, Me, Le) {
                for (var ze = [], ft = 0; ft < ke.length; ft++) ze[ft] = (ke[ft] + Me[ft] + Le[ft]) / 3;
                return ze;
              }(Pe, $e, Ve), Re = Math.sqrt(1 - y), qe = H2(ut, Pe, Re), je = H2(ut, $e, Re), rt = H2(ut, Ve, Re), He = Ie[0], xe = Ie[1], Ne = Ie[2];
              return { xyzv: [[Pe, $e, je], [je, qe, Pe], [$e, Ve, rt], [rt, je, $e], [Ve, Pe, qe], [qe, rt, Ve]], abc: [[He, xe, -1], [-1, -1, He], [xe, Ne, -1], [-1, -1, xe], [Ne, He, -1], [-1, -1, Ne]] };
            }(Ze, it);
            Et = Nt.xyzv, zt = Nt.abc;
          }
          for (var yt = 0; yt < Et.length; yt++) {
            Ze = Et[yt], it = zt[yt];
            for (var pt = [], Ot = 0; Ot < 3; Ot++) {
              var Jt = Ze[Ot][0], tr = Ze[Ot][1], Ye = Ze[Ot][2], at = Ze[Ot][3], Ge = it[Ot] > -1 ? it[Ot] : q(Jt, tr, Ye);
              pt[Ot] = Ge > -1 ? Ge : z(Jt, tr, Ye, Q2(We, at));
            }
            ot = pt[0], mt = pt[1], wt = pt[2], p._meshI.push(ot), p._meshJ.push(mt), p._meshK.push(wt), ++C2;
          }
        }
        function ne(We, Ze, it, ot) {
          var mt = We[3];
          mt < it && (mt = it), mt > ot && (mt = ot);
          for (var wt = (We[3] - mt) / (We[3] - Ze[3] + 1e-9), Et = [], zt = 0; zt < 4; zt++) Et[zt] = (1 - wt) * We[zt] + wt * Ze[zt];
          return Et;
        }
        function ae(We, Ze, it) {
          return We >= Ze && We <= it;
        }
        function ue(We) {
          var Ze = 1e-3 * (K2 - Y2);
          return We >= Y2 - Ze && We <= K2 + Ze;
        }
        function le(We) {
          for (var Ze = [], it = 0; it < 4; it++) {
            var ot = We[it];
            Ze.push([p._x[ot], p._y[ot], p._z[ot], p._value[ot]]);
          }
          return Ze;
        }
        function ce(We, Ze, it, ot, mt, wt) {
          wt || (wt = 1), it = [-1, -1, -1];
          var Et = false, zt = [ae(Ze[0][3], ot, mt), ae(Ze[1][3], ot, mt), ae(Ze[2][3], ot, mt)];
          if (!zt[0] && !zt[1] && !zt[2]) return false;
          var Nt = function(pt, Ot, Jt) {
            return ue(Ot[0][3]) && ue(Ot[1][3]) && ue(Ot[2][3]) ? (Z2(pt, Ot, Jt), true) : wt < 3 && ce(pt, Ot, Jt, Y2, K2, ++wt);
          };
          if (zt[0] && zt[1] && zt[2]) return Nt(We, Ze, it) || Et;
          var yt = false;
          return [[0, 1, 2], [2, 0, 1], [1, 2, 0]].forEach(function(pt) {
            if (zt[pt[0]] && zt[pt[1]] && !zt[pt[2]]) {
              var Ot = Ze[pt[0]], Jt = Ze[pt[1]], tr = Ze[pt[2]], Ye = ne(tr, Ot, ot, mt), at = ne(tr, Jt, ot, mt);
              Et = Nt(We, [at, Ye, Ot], [-1, -1, it[pt[0]]]) || Et, Et = Nt(We, [Ot, Jt, at], [it[pt[0]], it[pt[1]], -1]) || Et, yt = true;
            }
          }), yt || [[0, 1, 2], [1, 2, 0], [2, 0, 1]].forEach(function(pt) {
            if (zt[pt[0]] && !zt[pt[1]] && !zt[pt[2]]) {
              var Ot = Ze[pt[0]], Jt = Ze[pt[1]], tr = Ze[pt[2]], Ye = ne(Jt, Ot, ot, mt), at = ne(tr, Ot, ot, mt);
              Et = Nt(We, [at, Ye, Ot], [-1, -1, it[pt[0]]]) || Et, yt = true;
            }
          }), Et;
        }
        function se(We, Ze, it, ot) {
          var mt = false, wt = le(Ze), Et = [ae(wt[0][3], it, ot), ae(wt[1][3], it, ot), ae(wt[2][3], it, ot), ae(wt[3][3], it, ot)];
          if (!(Et[0] || Et[1] || Et[2] || Et[3])) return mt;
          if (Et[0] && Et[1] && Et[2] && Et[3]) return S2 && (mt = function(Nt, yt, pt) {
            var Ot = function(Jt, tr, Ye) {
              Z2(Nt, [yt[Jt], yt[tr], yt[Ye]], [pt[Jt], pt[tr], pt[Ye]]);
            };
            Ot(0, 1, 2), Ot(3, 0, 1), Ot(2, 3, 0), Ot(1, 2, 3);
          }(We, wt, Ze) || mt), mt;
          var zt = false;
          return [[0, 1, 2, 3], [3, 0, 1, 2], [2, 3, 0, 1], [1, 2, 3, 0]].forEach(function(Nt) {
            if (Et[Nt[0]] && Et[Nt[1]] && Et[Nt[2]] && !Et[Nt[3]]) {
              var yt = wt[Nt[0]], pt = wt[Nt[1]], Ot = wt[Nt[2]], Jt = wt[Nt[3]];
              if (S2) mt = Z2(We, [yt, pt, Ot], [Ze[Nt[0]], Ze[Nt[1]], Ze[Nt[2]]]) || mt;
              else {
                var tr = ne(Jt, yt, it, ot), Ye = ne(Jt, pt, it, ot), at = ne(Jt, Ot, it, ot);
                mt = Z2(null, [tr, Ye, at], [-1, -1, -1]) || mt;
              }
              zt = true;
            }
          }), zt || ([[0, 1, 2, 3], [1, 2, 3, 0], [2, 3, 0, 1], [3, 0, 1, 2], [0, 2, 3, 1], [1, 3, 2, 0]].forEach(function(Nt) {
            if (Et[Nt[0]] && Et[Nt[1]] && !Et[Nt[2]] && !Et[Nt[3]]) {
              var yt = wt[Nt[0]], pt = wt[Nt[1]], Ot = wt[Nt[2]], Jt = wt[Nt[3]], tr = ne(Ot, yt, it, ot), Ye = ne(Ot, pt, it, ot), at = ne(Jt, pt, it, ot), Ge = ne(Jt, yt, it, ot);
              S2 ? (mt = Z2(We, [yt, Ge, tr], [Ze[Nt[0]], -1, -1]) || mt, mt = Z2(We, [pt, Ye, at], [Ze[Nt[1]], -1, -1]) || mt) : mt = function(st, Ie, Pe) {
                var $e = function(Ve, ut, Re) {
                  Z2(st, [Ie[Ve], Ie[ut], Ie[Re]], [Pe[Ve], Pe[ut], Pe[Re]]);
                };
                $e(0, 1, 2), $e(2, 3, 0);
              }(null, [tr, Ye, at, Ge], [-1, -1, -1, -1]) || mt, zt = true;
            }
          }), zt || [[0, 1, 2, 3], [1, 2, 3, 0], [2, 3, 0, 1], [3, 0, 1, 2]].forEach(function(Nt) {
            if (Et[Nt[0]] && !Et[Nt[1]] && !Et[Nt[2]] && !Et[Nt[3]]) {
              var yt = wt[Nt[0]], pt = wt[Nt[1]], Ot = wt[Nt[2]], Jt = wt[Nt[3]], tr = ne(pt, yt, it, ot), Ye = ne(Ot, yt, it, ot), at = ne(Jt, yt, it, ot);
              S2 ? (mt = Z2(We, [yt, tr, Ye], [Ze[Nt[0]], -1, -1]) || mt, mt = Z2(We, [yt, Ye, at], [Ze[Nt[0]], -1, -1]) || mt, mt = Z2(We, [yt, at, tr], [Ze[Nt[0]], -1, -1]) || mt) : mt = Z2(null, [tr, Ye, at], [-1, -1, -1]) || mt, zt = true;
            }
          })), mt;
        }
        function he(We, Ze, it, ot, mt, wt, Et, zt, Nt, yt, pt) {
          var Ot = false;
          return A2 && (j(We, "A") && (Ot = se(null, [Ze, it, ot, wt], yt, pt) || Ot), j(We, "B") && (Ot = se(null, [it, ot, mt, Nt], yt, pt) || Ot), j(We, "C") && (Ot = se(null, [it, wt, Et, Nt], yt, pt) || Ot), j(We, "D") && (Ot = se(null, [ot, wt, zt, Nt], yt, pt) || Ot), j(We, "E") && (Ot = se(null, [it, ot, wt, Nt], yt, pt) || Ot)), S2 && (Ot = se(We, [it, ot, wt, Nt], yt, pt) || Ot), Ot;
        }
        function me(We, Ze, it, ot, mt, wt, Et, zt) {
          return [zt[0] === true || ce(We, le([Ze, it, ot]), [Ze, it, ot], wt, Et), zt[1] === true || ce(We, le([ot, mt, Ze]), [ot, mt, Ze], wt, Et)];
        }
        function we(We, Ze, it, ot, mt, wt, Et, zt, Nt) {
          return zt ? me(We, Ze, it, mt, ot, wt, Et, Nt) : me(We, it, mt, ot, Ze, wt, Et, Nt);
        }
        function be(We, Ze, it, ot, mt, wt, Et) {
          var zt, Nt, yt, pt, Ot = false, Jt = function() {
            Ot = ce(We, [zt, Nt, yt], [-1, -1, -1], mt, wt) || Ot, Ot = ce(We, [yt, pt, zt], [-1, -1, -1], mt, wt) || Ot;
          }, tr = Et[0], Ye = Et[1], at = Et[2];
          return tr && (zt = H2(le([V2(Ze, it - 0, ot - 0)])[0], le([V2(Ze - 1, it - 0, ot - 0)])[0], tr), Nt = H2(le([V2(Ze, it - 0, ot - 1)])[0], le([V2(Ze - 1, it - 0, ot - 1)])[0], tr), yt = H2(le([V2(Ze, it - 1, ot - 1)])[0], le([V2(Ze - 1, it - 1, ot - 1)])[0], tr), pt = H2(le([V2(Ze, it - 1, ot - 0)])[0], le([V2(Ze - 1, it - 1, ot - 0)])[0], tr), Jt()), Ye && (zt = H2(le([V2(Ze - 0, it, ot - 0)])[0], le([V2(Ze - 0, it - 1, ot - 0)])[0], Ye), Nt = H2(le([V2(Ze - 0, it, ot - 1)])[0], le([V2(Ze - 0, it - 1, ot - 1)])[0], Ye), yt = H2(le([V2(Ze - 1, it, ot - 1)])[0], le([V2(Ze - 1, it - 1, ot - 1)])[0], Ye), pt = H2(le([V2(Ze - 1, it, ot - 0)])[0], le([V2(Ze - 1, it - 1, ot - 0)])[0], Ye), Jt()), at && (zt = H2(le([V2(Ze - 0, it - 0, ot)])[0], le([V2(Ze - 0, it - 0, ot - 1)])[0], at), Nt = H2(le([V2(Ze - 0, it - 1, ot)])[0], le([V2(Ze - 0, it - 1, ot - 1)])[0], at), yt = H2(le([V2(Ze - 1, it - 1, ot)])[0], le([V2(Ze - 1, it - 1, ot - 1)])[0], at), pt = H2(le([V2(Ze - 1, it - 0, ot)])[0], le([V2(Ze - 1, it - 0, ot - 1)])[0], at), Jt()), Ot;
        }
        function Ae(We, Ze, it, ot, mt, wt, Et, zt, Nt, yt, pt, Ot) {
          var Jt = We;
          return Ot ? (A2 && We === "even" && (Jt = null), he(Jt, Ze, it, ot, mt, wt, Et, zt, Nt, yt, pt)) : (A2 && We === "odd" && (Jt = null), he(Jt, Nt, zt, Et, wt, mt, ot, it, Ze, yt, pt));
        }
        function pe(We, Ze, it, ot, mt) {
          for (var wt = [], Et = 0, zt = 0; zt < Ze.length; zt++) for (var Nt = Ze[zt], yt = 1; yt < O2; yt++) for (var pt = 1; pt < I2; pt++) wt.push(we(We, V2(Nt, pt - 1, yt - 1), V2(Nt, pt - 1, yt), V2(Nt, pt, yt - 1), V2(Nt, pt, yt), it, ot, (Nt + pt + yt) % 2, mt && mt[Et] ? mt[Et] : [])), Et++;
          return wt;
        }
        function ve(We, Ze, it, ot, mt) {
          for (var wt = [], Et = 0, zt = 0; zt < Ze.length; zt++) for (var Nt = Ze[zt], yt = 1; yt < D2; yt++) for (var pt = 1; pt < O2; pt++) wt.push(we(We, V2(yt - 1, Nt, pt - 1), V2(yt, Nt, pt - 1), V2(yt - 1, Nt, pt), V2(yt, Nt, pt), it, ot, (yt + Nt + pt) % 2, mt && mt[Et] ? mt[Et] : [])), Et++;
          return wt;
        }
        function Ee(We, Ze, it, ot, mt) {
          for (var wt = [], Et = 0, zt = 0; zt < Ze.length; zt++) for (var Nt = Ze[zt], yt = 1; yt < I2; yt++) for (var pt = 1; pt < D2; pt++) wt.push(we(We, V2(pt - 1, yt - 1, Nt), V2(pt - 1, yt, Nt), V2(pt, yt - 1, Nt), V2(pt, yt, Nt), it, ot, (pt + yt + Nt) % 2, mt && mt[Et] ? mt[Et] : [])), Et++;
          return wt;
        }
        function Se(We, Ze, it) {
          for (var ot = 1; ot < O2; ot++) for (var mt = 1; mt < I2; mt++) for (var wt = 1; wt < D2; wt++) Ae(We, V2(wt - 1, mt - 1, ot - 1), V2(wt - 1, mt - 1, ot), V2(wt - 1, mt, ot - 1), V2(wt - 1, mt, ot), V2(wt, mt - 1, ot - 1), V2(wt, mt - 1, ot), V2(wt, mt, ot - 1), V2(wt, mt, ot), Ze, it, (wt + mt + ot) % 2);
        }
        function Ce(We, Ze, it) {
          A2 = true, Se(We, Ze, it), A2 = false;
        }
        function Be(We, Ze, it, ot, mt, wt) {
          for (var Et = [], zt = 0, Nt = 0; Nt < Ze.length; Nt++) for (var yt = Ze[Nt], pt = 1; pt < O2; pt++) for (var Ot = 1; Ot < I2; Ot++) Et.push(be(We, yt, Ot, pt, it, ot, mt[Nt], wt && wt[zt] && wt[zt])), zt++;
          return Et;
        }
        function Ue(We, Ze, it, ot, mt, wt) {
          for (var Et = [], zt = 0, Nt = 0; Nt < Ze.length; Nt++) for (var yt = Ze[Nt], pt = 1; pt < D2; pt++) for (var Ot = 1; Ot < O2; Ot++) Et.push(be(We, pt, yt, Ot, it, ot, mt[Nt], wt && wt[zt] && wt[zt])), zt++;
          return Et;
        }
        function Ke(We, Ze, it, ot, mt, wt) {
          for (var Et = [], zt = 0, Nt = 0; Nt < Ze.length; Nt++) for (var yt = Ze[Nt], pt = 1; pt < I2; pt++) for (var Ot = 1; Ot < D2; Ot++) Et.push(be(We, Ot, pt, yt, it, ot, mt[Nt], wt && wt[zt] && wt[zt])), zt++;
          return Et;
        }
        function ct(We, Ze) {
          for (var it = [], ot = We; ot < Ze; ot++) it.push(ot);
          return it;
        }
        return function() {
          if (R2(), function() {
            for (var zt = 0; zt < D2; zt++) for (var Nt = 0; Nt < I2; Nt++) for (var yt = 0; yt < O2; yt++) {
              var pt = V2(zt, Nt, yt);
              z(p._x[pt], p._y[pt], p._z[pt], p._value[pt]);
            }
          }(), _4 && T2 && (te(T2), S2 = true, Se(null, Y2, K2), S2 = false), w && k) {
            te(k);
            for (var We = p.surface.pattern, Ze = p.surface.count, it = 0; it < Ze; it++) {
              var ot = Ze === 1 ? 0.5 : it / (Ze - 1), mt = (1 - ot) * Y2 + ot * K2, wt = Math.abs(mt - W2) > Math.abs(mt - X2) ? [W2, mt] : [mt, X2];
              Ce(We, wt[0], wt[1]);
            }
          }
          var Et = [[Math.min(Y2, X2), Math.max(Y2, X2)], [Math.min(W2, K2), Math.max(W2, K2)]];
          ["x", "y", "z"].forEach(function(zt) {
            for (var Nt = [], yt = 0; yt < Et.length; yt++) {
              var pt = 0, Ot = Et[yt][0], Jt = Et[yt][1], tr = p.slices[zt];
              if (tr.show && tr.fill) {
                te(tr.fill);
                var Ye = [], at = [], Ge = [];
                if (tr.locations.length) for (var st = 0; st < tr.locations.length; st++) {
                  var Ie = l(tr.locations[st], zt === "x" ? E2 : zt === "y" ? F13 : N2);
                  Ie.distRatio === 0 ? Ye.push(Ie.id) : Ie.id > 0 && (at.push(Ie.id), zt === "x" ? Ge.push([Ie.distRatio, 0, 0]) : zt === "y" ? Ge.push([0, Ie.distRatio, 0]) : Ge.push([0, 0, Ie.distRatio]));
                }
                else Ye = ct(1, zt === "x" ? D2 - 1 : zt === "y" ? I2 - 1 : O2 - 1);
                at.length > 0 && (Nt[pt] = zt === "x" ? Be(null, at, Ot, Jt, Ge, Nt[pt]) : zt === "y" ? Ue(null, at, Ot, Jt, Ge, Nt[pt]) : Ke(null, at, Ot, Jt, Ge, Nt[pt]), pt++), Ye.length > 0 && (Nt[pt] = zt === "x" ? pe(null, Ye, Ot, Jt, Nt[pt]) : zt === "y" ? ve(null, Ye, Ot, Jt, Nt[pt]) : Ee(null, Ye, Ot, Jt, Nt[pt]), pt++);
              }
              var Pe = p.caps[zt];
              Pe.show && Pe.fill && (te(Pe.fill), Nt[pt] = zt === "x" ? pe(null, [0, D2 - 1], Ot, Jt, Nt[pt]) : zt === "y" ? ve(null, [0, I2 - 1], Ot, Jt, Nt[pt]) : Ee(null, [0, O2 - 1], Ot, Jt, Nt[pt]), pt++);
            }
          }), C2 === 0 && R2(), p._meshX = m, p._meshY = g, p._meshZ = x, p._meshIntensity = b, p._Xs = E2, p._Ys = F13, p._Zs = N2;
        }(), p;
      }
      t.exports = { findNearestOnAxis: l, generateIsoMeshes: h, createIsosurfaceTrace: function(p, d) {
        var v = p.glplot.gl, m = n({ gl: v }), g = new u2(p, m, d.uid);
        return m._trace = g, g.update(d), p.glplot.add(m), g;
      } };
    }, { "../../../stackgl_modules": 1120, "../../components/colorscale": 378, "../../lib/gl_format_color": 499, "../../lib/str2rgbarray": 528, "../../plots/gl3d/zip3": 609 }], 865: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../registry"), o = e("./attributes"), s = e("../../components/colorscale/defaults");
      function i(l, u2, c, f, h) {
        var p = h("isomin"), d = h("isomax");
        d != null && p != null && p > d && (u2.isomin = null, u2.isomax = null);
        var v = h("x"), m = h("y"), g = h("z"), x = h("value");
        v && v.length && m && m.length && g && g.length && x && x.length ? (a.getComponentMethod("calendars", "handleTraceDefaults")(l, u2, ["x", "y", "z"], f), h("valuehoverformat"), ["x", "y", "z"].forEach(function(b) {
          h(b + "hoverformat");
          var y = "caps." + b;
          h(y + ".show") && h(y + ".fill");
          var w = "slices." + b;
          h(w + ".show") && (h(w + ".fill"), h(w + ".locations"));
        }), h("spaceframe.show") && h("spaceframe.fill"), h("surface.show") && (h("surface.count"), h("surface.fill"), h("surface.pattern")), h("contour.show") && (h("contour.color"), h("contour.width")), ["text", "hovertext", "hovertemplate", "lighting.ambient", "lighting.diffuse", "lighting.specular", "lighting.roughness", "lighting.fresnel", "lighting.vertexnormalsepsilon", "lighting.facenormalsepsilon", "lightposition.x", "lightposition.y", "lightposition.z", "flatshading", "opacity"].forEach(function(b) {
          h(b);
        }), s(l, u2, f, h, { prefix: "", cLetter: "c" }), u2._length = null) : u2.visible = false;
      }
      t.exports = { supplyDefaults: function(l, u2, c, f) {
        i(l, u2, c, f, function(h, p) {
          return n.coerce(l, u2, o, h, p);
        });
      }, supplyIsoDefaults: i };
    }, { "../../components/colorscale/defaults": 376, "../../lib": 503, "../../registry": 638, "./attributes": 862 }], 866: [function(e, t, r) {
      "use strict";
      t.exports = { attributes: e("./attributes"), supplyDefaults: e("./defaults").supplyDefaults, calc: e("./calc"), colorbar: { min: "cmin", max: "cmax" }, plot: e("./convert").createIsosurfaceTrace, moduleType: "trace", name: "isosurface", basePlotModule: e("../../plots/gl3d"), categories: ["gl3d", "showLegend"], meta: {} };
    }, { "../../plots/gl3d": 598, "./attributes": 862, "./calc": 863, "./convert": 864, "./defaults": 865 }], 867: [function(e, t, r) {
      "use strict";
      var n = e("../../components/colorscale/attributes"), a = e("../../plots/cartesian/axis_format_attributes").axisHoverFormat, o = e("../../plots/template_attributes").hovertemplateAttrs, s = e("../surface/attributes"), i = e("../../plots/attributes"), l = e("../../lib/extend").extendFlat;
      t.exports = l({ x: { valType: "data_array", editType: "calc+clearAxisTypes" }, y: { valType: "data_array", editType: "calc+clearAxisTypes" }, z: { valType: "data_array", editType: "calc+clearAxisTypes" }, i: { valType: "data_array", editType: "calc" }, j: { valType: "data_array", editType: "calc" }, k: { valType: "data_array", editType: "calc" }, text: { valType: "string", dflt: "", arrayOk: true, editType: "calc" }, hovertext: { valType: "string", dflt: "", arrayOk: true, editType: "calc" }, hovertemplate: o({ editType: "calc" }), xhoverformat: a("x"), yhoverformat: a("y"), zhoverformat: a("z"), delaunayaxis: { valType: "enumerated", values: ["x", "y", "z"], dflt: "z", editType: "calc" }, alphahull: { valType: "number", dflt: -1, editType: "calc" }, intensity: { valType: "data_array", editType: "calc" }, intensitymode: { valType: "enumerated", values: ["vertex", "cell"], dflt: "vertex", editType: "calc" }, color: { valType: "color", editType: "calc" }, vertexcolor: { valType: "data_array", editType: "calc" }, facecolor: { valType: "data_array", editType: "calc" }, transforms: void 0 }, n("", { colorAttr: "`intensity`", showScaleDflt: true, editTypeOverride: "calc" }), { opacity: s.opacity, flatshading: { valType: "boolean", dflt: false, editType: "calc" }, contour: { show: l({}, s.contours.x.show, {}), color: s.contours.x.color, width: s.contours.x.width, editType: "calc" }, lightposition: { x: l({}, s.lightposition.x, { dflt: 1e5 }), y: l({}, s.lightposition.y, { dflt: 1e5 }), z: l({}, s.lightposition.z, { dflt: 0 }), editType: "calc" }, lighting: l({ vertexnormalsepsilon: { valType: "number", min: 0, max: 1, dflt: 1e-12, editType: "calc" }, facenormalsepsilon: { valType: "number", min: 0, max: 1, dflt: 1e-6, editType: "calc" }, editType: "calc" }, s.lighting), hoverinfo: l({}, i.hoverinfo, { editType: "calc" }), showlegend: l({}, i.showlegend, { dflt: false }) });
    }, { "../../components/colorscale/attributes": 373, "../../lib/extend": 493, "../../plots/attributes": 550, "../../plots/cartesian/axis_format_attributes": 557, "../../plots/template_attributes": 633, "../surface/attributes": 1057 }], 868: [function(e, t, r) {
      "use strict";
      var n = e("../../components/colorscale/calc");
      t.exports = function(a, o) {
        o.intensity && n(a, o, { vals: o.intensity, containerStr: "", cLetter: "c" });
      };
    }, { "../../components/colorscale/calc": 374 }], 869: [function(e, t, r) {
      "use strict";
      var n = e("../../../stackgl_modules").gl_mesh3d, a = e("../../../stackgl_modules").delaunay_triangulate, o = e("../../../stackgl_modules").alpha_shape, s = e("../../../stackgl_modules").convex_hull, i = e("../../lib/gl_format_color").parseColorScale, l = e("../../lib/str2rgbarray"), u2 = e("../../components/colorscale").extractOpts, c = e("../../plots/gl3d/zip3");
      function f(g, x, b) {
        this.scene = g, this.uid = b, this.mesh = x, this.name = "", this.color = "#fff", this.data = null, this.showContour = false;
      }
      var h = f.prototype;
      function p(g) {
        for (var x = [], b = g.length, y = 0; y < b; y++) x[y] = l(g[y]);
        return x;
      }
      function d(g, x, b, y) {
        for (var w = [], _4 = x.length, k = 0; k < _4; k++) w[k] = g.d2l(x[k], 0, y) * b;
        return w;
      }
      function v(g) {
        for (var x = [], b = g.length, y = 0; y < b; y++) x[y] = Math.round(g[y]);
        return x;
      }
      function m(g, x) {
        for (var b = g.length, y = 0; y < b; y++) if (g[y] <= -0.5 || g[y] >= x - 0.5) return false;
        return true;
      }
      h.handlePick = function(g) {
        if (g.object === this.mesh) {
          var x = g.index = g.data.index;
          g.data._cellCenter ? g.traceCoordinate = g.data.dataCoordinate : g.traceCoordinate = [this.data.x[x], this.data.y[x], this.data.z[x]];
          var b = this.data.hovertext || this.data.text;
          return Array.isArray(b) && b[x] !== void 0 ? g.textLabel = b[x] : b && (g.textLabel = b), true;
        }
      }, h.update = function(g) {
        var x = this.scene, b = x.fullSceneLayout;
        this.data = g;
        var y, w = g.x.length, _4 = c(d(b.xaxis, g.x, x.dataScale[0], g.xcalendar), d(b.yaxis, g.y, x.dataScale[1], g.ycalendar), d(b.zaxis, g.z, x.dataScale[2], g.zcalendar));
        if (g.i && g.j && g.k) {
          if (g.i.length !== g.j.length || g.j.length !== g.k.length || !m(g.i, w) || !m(g.j, w) || !m(g.k, w)) return;
          y = c(v(g.i), v(g.j), v(g.k));
        } else y = g.alphahull === 0 ? s(_4) : g.alphahull > 0 ? o(g.alphahull, _4) : function(S2, C2) {
          for (var E2 = ["x", "y", "z"].indexOf(S2), F13 = [], N2 = C2.length, D2 = 0; D2 < N2; D2++) F13[D2] = [C2[D2][(E2 + 1) % 3], C2[D2][(E2 + 2) % 3]];
          return a(F13);
        }(g.delaunayaxis, _4);
        var k = { positions: _4, cells: y, lightPosition: [g.lightposition.x, g.lightposition.y, g.lightposition.z], ambient: g.lighting.ambient, diffuse: g.lighting.diffuse, specular: g.lighting.specular, roughness: g.lighting.roughness, fresnel: g.lighting.fresnel, vertexNormalsEpsilon: g.lighting.vertexnormalsepsilon, faceNormalsEpsilon: g.lighting.facenormalsepsilon, opacity: g.opacity, contourEnable: g.contour.show, contourColor: l(g.contour.color).slice(0, 3), contourWidth: g.contour.width, useFacetNormals: g.flatshading };
        if (g.intensity) {
          var T2 = u2(g);
          this.color = "#fff";
          var A2 = g.intensitymode;
          k[A2 + "Intensity"] = g.intensity, k[A2 + "IntensityBounds"] = [T2.min, T2.max], k.colormap = i(g);
        } else g.vertexcolor ? (this.color = g.vertexcolor[0], k.vertexColors = p(g.vertexcolor)) : g.facecolor ? (this.color = g.facecolor[0], k.cellColors = p(g.facecolor)) : (this.color = g.color, k.meshColor = l(g.color));
        this.mesh.update(k);
      }, h.dispose = function() {
        this.scene.glplot.remove(this.mesh), this.mesh.dispose();
      }, t.exports = function(g, x) {
        var b = g.glplot.gl, y = n({ gl: b }), w = new f(g, y, x.uid);
        return y._trace = w, w.update(x), g.glplot.add(y), w;
      };
    }, { "../../../stackgl_modules": 1120, "../../components/colorscale": 378, "../../lib/gl_format_color": 499, "../../lib/str2rgbarray": 528, "../../plots/gl3d/zip3": 609 }], 870: [function(e, t, r) {
      "use strict";
      var n = e("../../registry"), a = e("../../lib"), o = e("../../components/colorscale/defaults"), s = e("./attributes");
      t.exports = function(i, l, u2, c) {
        function f(p, d) {
          return a.coerce(i, l, s, p, d);
        }
        function h(p) {
          var d = p.map(function(v) {
            var m = f(v);
            return m && a.isArrayOrTypedArray(m) ? m : null;
          });
          return d.every(function(v) {
            return v && v.length === d[0].length;
          }) && d;
        }
        h(["x", "y", "z"]) ? (h(["i", "j", "k"]), (!l.i || l.j && l.k) && (!l.j || l.k && l.i) && (!l.k || l.i && l.j) ? (n.getComponentMethod("calendars", "handleTraceDefaults")(i, l, ["x", "y", "z"], c), ["lighting.ambient", "lighting.diffuse", "lighting.specular", "lighting.roughness", "lighting.fresnel", "lighting.vertexnormalsepsilon", "lighting.facenormalsepsilon", "lightposition.x", "lightposition.y", "lightposition.z", "flatshading", "alphahull", "delaunayaxis", "opacity"].forEach(function(p) {
          f(p);
        }), f("contour.show") && (f("contour.color"), f("contour.width")), "intensity" in i ? (f("intensity"), f("intensitymode"), o(i, l, c, f, { prefix: "", cLetter: "c" })) : (l.showscale = false, "facecolor" in i ? f("facecolor") : "vertexcolor" in i ? f("vertexcolor") : f("color", u2)), f("text"), f("hovertext"), f("hovertemplate"), f("xhoverformat"), f("yhoverformat"), f("zhoverformat"), l._length = null) : l.visible = false) : l.visible = false;
      };
    }, { "../../components/colorscale/defaults": 376, "../../lib": 503, "../../registry": 638, "./attributes": 867 }], 871: [function(e, t, r) {
      "use strict";
      t.exports = { attributes: e("./attributes"), supplyDefaults: e("./defaults"), calc: e("./calc"), colorbar: { min: "cmin", max: "cmax" }, plot: e("./convert"), moduleType: "trace", name: "mesh3d", basePlotModule: e("../../plots/gl3d"), categories: ["gl3d", "showLegend"], meta: {} };
    }, { "../../plots/gl3d": 598, "./attributes": 867, "./calc": 868, "./convert": 869, "./defaults": 870 }], 872: [function(e, t, r) {
      "use strict";
      var n = e("../../lib").extendFlat, a = e("../scatter/attributes"), o = e("../../plots/cartesian/axis_format_attributes").axisHoverFormat, s = e("../../components/drawing/attributes").dash, i = e("../../components/fx/attributes"), l = e("../../constants/delta.js"), u2 = l.INCREASING.COLOR, c = l.DECREASING.COLOR, f = a.line;
      function h(p) {
        return { line: { color: n({}, f.color, { dflt: p }), width: f.width, dash: s, editType: "style" }, editType: "style" };
      }
      t.exports = { xperiod: a.xperiod, xperiod0: a.xperiod0, xperiodalignment: a.xperiodalignment, xhoverformat: o("x"), yhoverformat: o("y"), x: { valType: "data_array", editType: "calc+clearAxisTypes" }, open: { valType: "data_array", editType: "calc" }, high: { valType: "data_array", editType: "calc" }, low: { valType: "data_array", editType: "calc" }, close: { valType: "data_array", editType: "calc" }, line: { width: n({}, f.width, {}), dash: n({}, s, {}), editType: "style" }, increasing: h(u2), decreasing: h(c), text: { valType: "string", dflt: "", arrayOk: true, editType: "calc" }, hovertext: { valType: "string", dflt: "", arrayOk: true, editType: "calc" }, tickwidth: { valType: "number", min: 0, max: 0.5, dflt: 0.3, editType: "calc" }, hoverlabel: n({}, i.hoverlabel, { split: { valType: "boolean", dflt: false, editType: "style" } }) };
    }, { "../../components/drawing/attributes": 387, "../../components/fx/attributes": 397, "../../constants/delta.js": 473, "../../lib": 503, "../../plots/cartesian/axis_format_attributes": 557, "../scatter/attributes": 926 }], 873: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = n._, o = e("../../plots/cartesian/axes"), s = e("../../plots/cartesian/align_period"), i = e("../../constants/numerical").BADNUM;
      function l(c, f, h, p) {
        return { o: c, h: f, l: h, c: p };
      }
      function u2(c, f, h, p, d, v) {
        for (var m = d.makeCalcdata(f, "open"), g = d.makeCalcdata(f, "high"), x = d.makeCalcdata(f, "low"), b = d.makeCalcdata(f, "close"), y = Array.isArray(f.text), w = Array.isArray(f.hovertext), _4 = true, k = null, T2 = !!f.xperiodalignment, A2 = [], S2 = 0; S2 < p.length; S2++) {
          var C2 = p[S2], E2 = m[S2], F13 = g[S2], N2 = x[S2], D2 = b[S2];
          if (C2 !== i && E2 !== i && F13 !== i && N2 !== i && D2 !== i) {
            D2 === E2 ? k !== null && D2 !== k && (_4 = D2 > k) : _4 = D2 > E2, k = D2;
            var I2 = v(E2, F13, N2, D2);
            I2.pos = C2, I2.yc = (E2 + D2) / 2, I2.i = S2, I2.dir = _4 ? "increasing" : "decreasing", I2.x = I2.pos, I2.y = [N2, F13], T2 && (I2.orig_p = h[S2]), y && (I2.tx = f.text[S2]), w && (I2.htx = f.hovertext[S2]), A2.push(I2);
          } else A2.push({ pos: C2, empty: true });
        }
        return f._extremes[d._id] = o.findExtremes(d, n.concat(x, g), { padded: true }), A2.length && (A2[0].t = { labels: { open: a(c, "open:") + " ", high: a(c, "high:") + " ", low: a(c, "low:") + " ", close: a(c, "close:") + " " } }), A2;
      }
      t.exports = { calc: function(c, f) {
        var h = o.getFromId(c, f.xaxis), p = o.getFromId(c, f.yaxis), d = function(b, y, w) {
          var _4 = w._minDiff;
          if (!_4) {
            var k, T2 = b._fullData, A2 = [];
            for (_4 = 1 / 0, k = 0; k < T2.length; k++) {
              var S2 = T2[k];
              if (S2.type === "ohlc" && S2.visible === true && S2.xaxis === y._id) {
                A2.push(S2);
                var C2 = y.makeCalcdata(S2, "x");
                S2._origX = C2;
                var E2 = s(w, y, "x", C2).vals;
                S2._xcalc = E2;
                var F13 = n.distinctVals(E2).minDiff;
                F13 && isFinite(F13) && (_4 = Math.min(_4, F13));
              }
            }
            for (_4 === 1 / 0 && (_4 = 1), k = 0; k < A2.length; k++) A2[k]._minDiff = _4;
          }
          return _4 * w.tickwidth;
        }(c, h, f), v = f._minDiff;
        f._minDiff = null;
        var m = f._origX;
        f._origX = null;
        var g = f._xcalc;
        f._xcalc = null;
        var x = u2(c, f, m, g, p, l);
        return f._extremes[h._id] = o.findExtremes(h, g, { vpad: v / 2 }), x.length ? (n.extendFlat(x[0].t, { wHover: v / 2, tickLen: d }), x) : [{ t: { empty: true } }];
      }, calcCommon: u2 };
    }, { "../../constants/numerical": 479, "../../lib": 503, "../../plots/cartesian/align_period": 551, "../../plots/cartesian/axes": 554 }], 874: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("./ohlc_defaults"), o = e("../scatter/period_defaults"), s = e("./attributes");
      function i(l, u2, c, f) {
        c(f + ".line.color"), c(f + ".line.width", u2.line.width), c(f + ".line.dash", u2.line.dash);
      }
      t.exports = function(l, u2, c, f) {
        function h(p, d) {
          return n.coerce(l, u2, s, p, d);
        }
        a(l, u2, h, f) ? (o(l, u2, f, h, { x: true }), h("xhoverformat"), h("yhoverformat"), h("line.width"), h("line.dash"), i(l, u2, h, "increasing"), i(l, u2, h, "decreasing"), h("text"), h("hovertext"), h("tickwidth"), f._requestRangeslider[u2.xaxis] = true) : u2.visible = false;
      };
    }, { "../../lib": 503, "../scatter/period_defaults": 946, "./attributes": 872, "./ohlc_defaults": 877 }], 875: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/cartesian/axes"), a = e("../../lib"), o = e("../../components/fx"), s = e("../../components/color"), i = e("../../lib").fillText, l = e("../../constants/delta.js"), u2 = { increasing: l.INCREASING.SYMBOL, decreasing: l.DECREASING.SYMBOL };
      function c(p, d, v, m) {
        var g, x, b = p.cd, y = p.xa, w = b[0].trace, _4 = b[0].t, k = w.type, T2 = k === "ohlc" ? "l" : "min", A2 = k === "ohlc" ? "h" : "max", S2 = _4.bPos || 0, C2 = _4.bdPos || _4.tickLen, E2 = _4.wHover, F13 = Math.min(1, C2 / Math.abs(y.r2c(y.range[1]) - y.r2c(y.range[0])));
        function N2(X2) {
          var Y2 = function(K2) {
            return K2.pos + S2 - d;
          }(X2);
          return o.inbox(Y2 - E2, Y2 + E2, g);
        }
        function D2(X2) {
          var Y2 = X2[T2], K2 = X2[A2];
          return Y2 === K2 || o.inbox(Y2 - v, K2 - v, g);
        }
        function I2(X2) {
          return (N2(X2) + D2(X2)) / 2;
        }
        g = p.maxHoverDistance - F13, x = p.maxSpikeDistance - F13;
        var O2 = o.getDistanceFunction(m, N2, D2, I2);
        if (o.getClosest(b, O2, p), p.index === false) return null;
        var L2 = b[p.index];
        if (L2.empty) return null;
        var V2 = w[L2.dir], W2 = V2.line.color;
        return s.opacity(W2) && V2.line.width ? p.color = W2 : p.color = V2.fillcolor, p.x0 = y.c2p(L2.pos + S2 - C2, true), p.x1 = y.c2p(L2.pos + S2 + C2, true), p.xLabelVal = L2.orig_p !== void 0 ? L2.orig_p : L2.pos, p.spikeDistance = I2(L2) * x / g, p.xSpike = y.c2p(L2.pos, true), p;
      }
      function f(p, d, v, m) {
        var g = p.cd, x = p.ya, b = g[0].trace, y = g[0].t, w = [], _4 = c(p, d, v, m);
        if (!_4) return [];
        var k = g[_4.index].hi || b.hoverinfo, T2 = k.split("+");
        if (!(k === "all" || T2.indexOf("y") !== -1)) return [];
        for (var A2 = ["high", "open", "close", "low"], S2 = {}, C2 = 0; C2 < A2.length; C2++) {
          var E2, F13 = A2[C2], N2 = b[F13][_4.index], D2 = x.c2p(N2, true);
          N2 in S2 ? (E2 = S2[N2]).yLabel += "<br>" + y.labels[F13] + n.hoverLabelText(x, N2, b.yhoverformat) : ((E2 = a.extendFlat({}, _4)).y0 = E2.y1 = D2, E2.yLabelVal = N2, E2.yLabel = y.labels[F13] + n.hoverLabelText(x, N2, b.yhoverformat), E2.name = "", w.push(E2), S2[N2] = E2);
        }
        return w;
      }
      function h(p, d, v, m) {
        var g = p.cd, x = p.ya, b = g[0].trace, y = g[0].t, w = c(p, d, v, m);
        if (!w) return [];
        var _4 = g[w.index], k = w.index = _4.i, T2 = _4.dir;
        function A2(I2) {
          return y.labels[I2] + n.hoverLabelText(x, b[I2][k], b.yhoverformat);
        }
        var S2 = _4.hi || b.hoverinfo, C2 = S2.split("+"), E2 = S2 === "all", F13 = E2 || C2.indexOf("y") !== -1, N2 = E2 || C2.indexOf("text") !== -1, D2 = F13 ? [A2("open"), A2("high"), A2("low"), A2("close") + "  " + u2[T2]] : [];
        return N2 && i(_4, b, D2), w.extraText = D2.join("<br>"), w.y0 = w.y1 = x.c2p(_4.yc, true), [w];
      }
      t.exports = { hoverPoints: function(p, d, v, m) {
        return p.cd[0].trace.hoverlabel.split ? f(p, d, v, m) : h(p, d, v, m);
      }, hoverSplit: f, hoverOnPoints: h };
    }, { "../../components/color": 366, "../../components/fx": 406, "../../constants/delta.js": 473, "../../lib": 503, "../../plots/cartesian/axes": 554 }], 876: [function(e, t, r) {
      "use strict";
      t.exports = { moduleType: "trace", name: "ohlc", basePlotModule: e("../../plots/cartesian"), categories: ["cartesian", "svg", "showLegend"], meta: {}, attributes: e("./attributes"), supplyDefaults: e("./defaults"), calc: e("./calc").calc, plot: e("./plot"), style: e("./style"), hoverPoints: e("./hover").hoverPoints, selectPoints: e("./select") };
    }, { "../../plots/cartesian": 568, "./attributes": 872, "./calc": 873, "./defaults": 874, "./hover": 875, "./plot": 878, "./select": 879, "./style": 880 }], 877: [function(e, t, r) {
      "use strict";
      var n = e("../../registry"), a = e("../../lib");
      t.exports = function(o, s, i, l) {
        var u2 = i("x"), c = i("open"), f = i("high"), h = i("low"), p = i("close");
        if (i("hoverlabel.split"), n.getComponentMethod("calendars", "handleTraceDefaults")(o, s, ["x"], l), c && f && h && p) {
          var d = Math.min(c.length, f.length, h.length, p.length);
          return u2 && (d = Math.min(d, a.minRowLength(u2))), s._length = d, d;
        }
      };
    }, { "../../lib": 503, "../../registry": 638 }], 878: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../lib");
      t.exports = function(o, s, i, l) {
        var u2 = s.yaxis, c = s.xaxis, f = !!c.rangebreaks;
        a.makeTraceGroups(l, i, "trace ohlc").each(function(h) {
          var p = n.select(this), d = h[0], v = d.t;
          if (d.trace.visible !== true || v.empty) p.remove();
          else {
            var m = v.tickLen, g = p.selectAll("path").data(a.identity);
            g.enter().append("path"), g.exit().remove(), g.attr("d", function(x) {
              if (x.empty) return "M0,0Z";
              var b = c.c2p(x.pos - m, true), y = c.c2p(x.pos + m, true), w = f ? (b + y) / 2 : c.c2p(x.pos, true);
              return "M" + b + "," + u2.c2p(x.o, true) + "H" + w + "M" + w + "," + u2.c2p(x.h, true) + "V" + u2.c2p(x.l, true) + "M" + y + "," + u2.c2p(x.c, true) + "H" + w;
            });
          }
        });
      };
    }, { "../../lib": 503, "@plotly/d3": 58 }], 879: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a) {
        var o, s = n.cd, i = n.xaxis, l = n.yaxis, u2 = [], c = s[0].t.bPos || 0;
        if (a === false) for (o = 0; o < s.length; o++) s[o].selected = 0;
        else for (o = 0; o < s.length; o++) {
          var f = s[o];
          a.contains([i.c2p(f.pos + c), l.c2p(f.yc)], null, f.i, n) ? (u2.push({ pointNumber: f.i, x: i.c2d(f.pos), y: l.c2d(f.yc) }), f.selected = 1) : f.selected = 0;
        }
        return u2;
      };
    }, {}], 880: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../components/drawing"), o = e("../../components/color");
      t.exports = function(s, i, l) {
        var u2 = l || n.select(s).selectAll("g.ohlclayer").selectAll("g.trace");
        u2.style("opacity", function(c) {
          return c[0].trace.opacity;
        }), u2.each(function(c) {
          var f = c[0].trace;
          n.select(this).selectAll("path").each(function(h) {
            if (!h.empty) {
              var p = f[h.dir].line;
              n.select(this).style("fill", "none").call(o.stroke, p.color).call(a.dashLine, p.dash, p.width).style("opacity", f.selectedpoints && !h.selected ? 0.3 : 1);
            }
          });
        });
      };
    }, { "../../components/color": 366, "../../components/drawing": 388, "@plotly/d3": 58 }], 881: [function(e, t, r) {
      "use strict";
      var n = e("../../lib/extend").extendFlat, a = e("../../plots/attributes"), o = e("../../plots/font_attributes"), s = e("../../components/colorscale/attributes"), i = e("../../plots/template_attributes").hovertemplateAttrs, l = e("../../plots/domain").attributes, u2 = n({ editType: "calc" }, s("line", { editTypeOverride: "calc" }), { shape: { valType: "enumerated", values: ["linear", "hspline"], dflt: "linear", editType: "plot" }, hovertemplate: i({ editType: "plot", arrayOk: false }, { keys: ["count", "probability"] }) });
      t.exports = { domain: l({ name: "parcats", trace: true, editType: "calc" }), hoverinfo: n({}, a.hoverinfo, { flags: ["count", "probability"], editType: "plot", arrayOk: false }), hoveron: { valType: "enumerated", values: ["category", "color", "dimension"], dflt: "category", editType: "plot" }, hovertemplate: i({ editType: "plot", arrayOk: false }, { keys: ["count", "probability", "category", "categorycount", "colorcount", "bandcolorcount"] }), arrangement: { valType: "enumerated", values: ["perpendicular", "freeform", "fixed"], dflt: "perpendicular", editType: "plot" }, bundlecolors: { valType: "boolean", dflt: true, editType: "plot" }, sortpaths: { valType: "enumerated", values: ["forward", "backward"], dflt: "forward", editType: "plot" }, labelfont: o({ editType: "calc" }), tickfont: o({ editType: "calc" }), dimensions: { _isLinkedToArray: "dimension", label: { valType: "string", editType: "calc" }, categoryorder: { valType: "enumerated", values: ["trace", "category ascending", "category descending", "array"], dflt: "trace", editType: "calc" }, categoryarray: { valType: "data_array", editType: "calc" }, ticktext: { valType: "data_array", editType: "calc" }, values: { valType: "data_array", dflt: [], editType: "calc" }, displayindex: { valType: "integer", editType: "calc" }, editType: "calc", visible: { valType: "boolean", dflt: true, editType: "calc" } }, line: u2, counts: { valType: "number", min: 0, dflt: 1, arrayOk: true, editType: "calc" }, customdata: void 0, hoverlabel: void 0, ids: void 0, legendgroup: void 0, legendrank: void 0, opacity: void 0, selectedpoints: void 0, showlegend: void 0 };
    }, { "../../components/colorscale/attributes": 373, "../../lib/extend": 493, "../../plots/attributes": 550, "../../plots/domain": 584, "../../plots/font_attributes": 585, "../../plots/template_attributes": 633 }], 882: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/get_data").getModuleCalcData, a = e("./plot");
      r.name = "parcats", r.plot = function(o, s, i, l) {
        var u2 = n(o.calcdata, "parcats");
        if (u2.length) {
          var c = u2[0];
          a(o, c, i, l);
        }
      }, r.clean = function(o, s, i, l) {
        var u2 = l._has && l._has("parcats"), c = s._has && s._has("parcats");
        u2 && !c && l._paperdiv.selectAll(".parcats").remove();
      };
    }, { "../../plots/get_data": 593, "./plot": 887 }], 883: [function(e, t, r) {
      "use strict";
      var n = e("../../lib/gup").wrap, a = e("../../components/colorscale/helpers").hasColorscale, o = e("../../components/colorscale/calc"), s = e("../../lib/filter_unique.js"), i = e("../../components/drawing"), l = e("../../lib"), u2 = e("fast-isnumeric");
      function c(p, d, v) {
        p.valueInds.push(d), p.count += v;
      }
      function f(p, d, v) {
        return { categoryInds: p, color: d, rawColor: v, valueInds: [], count: 0 };
      }
      function h(p, d, v) {
        p.valueInds.push(d), p.count += v;
      }
      t.exports = function(p, d) {
        var v = l.filterVisible(d.dimensions);
        if (v.length === 0) return [];
        var m, g, x, b = v.map(function(q) {
          var re;
          if (q.categoryorder === "trace") re = null;
          else if (q.categoryorder === "array") re = q.categoryarray;
          else {
            re = s(q.values);
            for (var R2 = true, z = 0; z < re.length; z++) if (!u2(re[z])) {
              R2 = false;
              break;
            }
            re.sort(R2 ? l.sorterAsc : void 0), q.categoryorder === "category descending" && (re = re.reverse());
          }
          return function(H2, te) {
            te = te == null ? [] : te.map(function(ce) {
              return ce;
            });
            var j = {}, Q2 = {}, Z2 = [];
            te.forEach(function(ce, se) {
              j[ce] = 0, Q2[ce] = se;
            });
            for (var ne = 0; ne < H2.length; ne++) {
              var ae, ue = H2[ne];
              j[ue] === void 0 ? (j[ue] = 1, ae = te.push(ue) - 1, Q2[ue] = ae) : (j[ue]++, ae = Q2[ue]), Z2.push(ae);
            }
            var le = te.map(function(ce) {
              return j[ce];
            });
            return { uniqueValues: te, uniqueCounts: le, inds: Z2 };
          }(q.values, re);
        });
        m = l.isArrayOrTypedArray(d.counts) ? d.counts : [d.counts], function(q) {
          var re;
          if (function(R2) {
            for (var z = new Array(R2.length), H2 = 0; H2 < R2.length; H2++) {
              if (R2[H2] < 0 || R2[H2] >= R2.length || z[R2[H2]] !== void 0) return false;
              z[R2[H2]] = true;
            }
            return true;
          }(q.map(function(R2) {
            return R2.displayindex;
          }))) for (re = 0; re < q.length; re++) q[re]._displayindex = q[re].displayindex;
          else for (re = 0; re < q.length; re++) q[re]._displayindex = re;
        }(v), v.forEach(function(q, re) {
          (function(R2, z) {
            R2._categoryarray = z.uniqueValues, R2.ticktext === null || R2.ticktext === void 0 ? R2._ticktext = [] : R2._ticktext = R2.ticktext.slice();
            for (var H2 = R2._ticktext.length; H2 < z.uniqueValues.length; H2++) R2._ticktext.push(z.uniqueValues[H2]);
          })(q, b[re]);
        });
        var y, w = d.line;
        w ? (a(d, "line") && o(p, d, { vals: d.line.color, containerStr: "line", cLetter: "c" }), y = i.tryColorscale(w)) : y = l.identity;
        var _4, k, T2, A2, S2, C2 = v[0].values.length, E2 = {}, F13 = b.map(function(q) {
          return q.inds;
        });
        for (x = 0, _4 = 0; _4 < C2; _4++) {
          var N2 = [];
          for (k = 0; k < F13.length; k++) N2.push(F13[k][_4]);
          g = m[_4 % m.length], x += g;
          var D2 = (T2 = _4, A2 = void 0, S2 = void 0, l.isArrayOrTypedArray(w.color) ? S2 = A2 = w.color[T2 % w.color.length] : A2 = w.color, { color: y(A2), rawColor: S2 }), I2 = N2 + "-" + D2.rawColor;
          E2[I2] === void 0 && (E2[I2] = f(N2, D2.color, D2.rawColor)), h(E2[I2], _4, g);
        }
        var O2, L2 = v.map(function(q, re) {
          return /* @__PURE__ */ function(R2, z, H2, te, j) {
            return { dimensionInd: R2, containerInd: z, displayInd: H2, dimensionLabel: te, count: j, categories: [], dragX: null };
          }(re, q._index, q._displayindex, q.label, x);
        });
        for (_4 = 0; _4 < C2; _4++) for (g = m[_4 % m.length], k = 0; k < L2.length; k++) {
          var V2 = L2[k].containerInd, W2 = b[k].inds[_4], X2 = L2[k].categories;
          if (X2[W2] === void 0) {
            var Y2 = d.dimensions[V2]._categoryarray[W2], K2 = d.dimensions[V2]._ticktext[W2];
            X2[W2] = { dimensionInd: k, categoryInd: O2 = W2, categoryValue: Y2, displayInd: O2, categoryLabel: K2, valueInds: [], count: 0, dragY: null };
          }
          c(X2[W2], _4, g);
        }
        return n(function(q, re, R2) {
          var z = q.map(function(H2) {
            return H2.categories.length;
          }).reduce(function(H2, te) {
            return Math.max(H2, te);
          });
          return { dimensions: q, paths: re, trace: void 0, maxCats: z, count: R2 };
        }(L2, E2, x));
      };
    }, { "../../components/colorscale/calc": 374, "../../components/colorscale/helpers": 377, "../../components/drawing": 388, "../../lib": 503, "../../lib/filter_unique.js": 494, "../../lib/gup": 500, "fast-isnumeric": 190 }], 884: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../components/colorscale/helpers").hasColorscale, o = e("../../components/colorscale/defaults"), s = e("../../plots/domain").defaults, i = e("../../plots/array_container_defaults"), l = e("./attributes"), u2 = e("../parcoords/merge_length");
      function c(f, h) {
        function p(y, w) {
          return n.coerce(f, h, l.dimensions, y, w);
        }
        var d = p("values"), v = p("visible");
        if (d && d.length || (v = h.visible = false), v) {
          p("label"), p("displayindex", h._index);
          var m, g = f.categoryarray, x = Array.isArray(g) && g.length > 0;
          x && (m = "array");
          var b = p("categoryorder", m);
          b === "array" ? (p("categoryarray"), p("ticktext")) : (delete f.categoryarray, delete f.ticktext), x || b !== "array" || (h.categoryorder = "trace");
        }
      }
      t.exports = function(f, h, p, d) {
        function v(y, w) {
          return n.coerce(f, h, l, y, w);
        }
        var m = i(f, h, { name: "dimensions", handleItemDefaults: c }), g = function(y, w, _4, k, T2) {
          T2("line.shape"), T2("line.hovertemplate");
          var A2 = T2("line.color", k.colorway[0]);
          if (a(y, "line") && n.isArrayOrTypedArray(A2)) {
            if (A2.length) return T2("line.colorscale"), o(y, w, k, T2, { prefix: "line.", cLetter: "c" }), A2.length;
            w.line.color = _4;
          }
          return 1 / 0;
        }(f, h, p, d, v);
        s(h, d, v), Array.isArray(m) && m.length || (h.visible = false), u2(h, m, "values", g), v("hoveron"), v("hovertemplate"), v("arrangement"), v("bundlecolors"), v("sortpaths"), v("counts");
        var x = { family: d.font.family, size: Math.round(d.font.size), color: d.font.color };
        n.coerceFont(v, "labelfont", x);
        var b = { family: d.font.family, size: Math.round(d.font.size / 1.2), color: d.font.color };
        n.coerceFont(v, "tickfont", b);
      };
    }, { "../../components/colorscale/defaults": 376, "../../components/colorscale/helpers": 377, "../../lib": 503, "../../plots/array_container_defaults": 549, "../../plots/domain": 584, "../parcoords/merge_length": 897, "./attributes": 881 }], 885: [function(e, t, r) {
      "use strict";
      t.exports = { attributes: e("./attributes"), supplyDefaults: e("./defaults"), calc: e("./calc"), plot: e("./plot"), colorbar: { container: "line", min: "cmin", max: "cmax" }, moduleType: "trace", name: "parcats", basePlotModule: e("./base_plot"), categories: ["noOpacity"], meta: {} };
    }, { "./attributes": 881, "./base_plot": 882, "./calc": 883, "./defaults": 884, "./plot": 887 }], 886: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("d3-interpolate").interpolateNumber, o = e("../../plot_api/plot_api"), s = e("../../components/fx"), i = e("../../lib"), l = i.strTranslate, u2 = e("../../components/drawing"), c = e("tinycolor2"), f = e("../../lib/svg_text_utils");
      function h(R2, z, H2, te) {
        var j = R2.map(X2.bind(0, z, H2)), Q2 = te.selectAll("g.parcatslayer").data([null]);
        Q2.enter().append("g").attr("class", "parcatslayer").style("pointer-events", "all");
        var Z2 = Q2.selectAll("g.trace.parcats").data(j, p), ne = Z2.enter().append("g").attr("class", "trace parcats");
        Z2.attr("transform", function(be) {
          return l(be.x, be.y);
        }), ne.append("g").attr("class", "paths");
        var ae = Z2.select("g.paths").selectAll("path.path").data(function(be) {
          return be.paths;
        }, p);
        ae.attr("fill", function(be) {
          return be.model.color;
        });
        var ue = ae.enter().append("path").attr("class", "path").attr("stroke-opacity", 0).attr("fill", function(be) {
          return be.model.color;
        }).attr("fill-opacity", 0);
        w(ue), ae.attr("d", function(be) {
          return be.svgD;
        }), ue.empty() || ae.sort(v), ae.exit().remove(), ae.on("mouseover", m).on("mouseout", g).on("click", y), ne.append("g").attr("class", "dimensions");
        var le = Z2.select("g.dimensions").selectAll("g.dimension").data(function(be) {
          return be.dimensions;
        }, p);
        le.enter().append("g").attr("class", "dimension"), le.attr("transform", function(be) {
          return l(be.x, 0);
        }), le.exit().remove();
        var ce = le.selectAll("g.category").data(function(be) {
          return be.categories;
        }, p), se = ce.enter().append("g").attr("class", "category");
        ce.attr("transform", function(be) {
          return l(0, be.y);
        }), se.append("rect").attr("class", "catrect").attr("pointer-events", "none"), ce.select("rect.catrect").attr("fill", "none").attr("width", function(be) {
          return be.width;
        }).attr("height", function(be) {
          return be.height;
        }), k(se);
        var he = ce.selectAll("rect.bandrect").data(function(be) {
          return be.bands;
        }, p);
        he.each(function() {
          i.raiseToTop(this);
        }), he.attr("fill", function(be) {
          return be.color;
        });
        var me = he.enter().append("rect").attr("class", "bandrect").attr("stroke-opacity", 0).attr("fill", function(be) {
          return be.color;
        }).attr("fill-opacity", 0);
        he.attr("fill", function(be) {
          return be.color;
        }).attr("width", function(be) {
          return be.width;
        }).attr("height", function(be) {
          return be.height;
        }).attr("y", function(be) {
          return be.y;
        }).attr("cursor", function(be) {
          return be.parcatsViewModel.arrangement === "fixed" ? "default" : be.parcatsViewModel.arrangement === "perpendicular" ? "ns-resize" : "move";
        }), T2(me), he.exit().remove(), se.append("text").attr("class", "catlabel").attr("pointer-events", "none");
        var we = z._fullLayout.paper_bgcolor;
        ce.select("text.catlabel").attr("text-anchor", function(be) {
          return d(be) ? "start" : "end";
        }).attr("alignment-baseline", "middle").style("text-shadow", f.makeTextShadow(we)).style("fill", "rgb(0, 0, 0)").attr("x", function(be) {
          return d(be) ? be.width + 5 : -5;
        }).attr("y", function(be) {
          return be.height / 2;
        }).text(function(be) {
          return be.model.categoryLabel;
        }).each(function(be) {
          u2.font(n.select(this), be.parcatsViewModel.categorylabelfont), f.convertToTspans(n.select(this), z);
        }), se.append("text").attr("class", "dimlabel"), ce.select("text.dimlabel").attr("text-anchor", "middle").attr("alignment-baseline", "baseline").attr("cursor", function(be) {
          return be.parcatsViewModel.arrangement === "fixed" ? "default" : "ew-resize";
        }).attr("x", function(be) {
          return be.width / 2;
        }).attr("y", -5).text(function(be, Ae) {
          return Ae === 0 ? be.parcatsViewModel.model.dimensions[be.model.dimensionInd].dimensionLabel : null;
        }).each(function(be) {
          u2.font(n.select(this), be.parcatsViewModel.labelfont);
        }), ce.selectAll("rect.bandrect").on("mouseover", F13).on("mouseout", N2), ce.exit().remove(), le.call(n.behavior.drag().origin(function(be) {
          return { x: be.x, y: 0 };
        }).on("dragstart", D2).on("drag", I2).on("dragend", O2)), Z2.each(function(be) {
          be.traceSelection = n.select(this), be.pathSelection = n.select(this).selectAll("g.paths").selectAll("path.path"), be.dimensionSelection = n.select(this).selectAll("g.dimensions").selectAll("g.dimension");
        }), Z2.exit().remove();
      }
      function p(R2) {
        return R2.key;
      }
      function d(R2) {
        var z = R2.parcatsViewModel.dimensions.length, H2 = R2.parcatsViewModel.dimensions[z - 1].model.dimensionInd;
        return R2.model.dimensionInd === H2;
      }
      function v(R2, z) {
        return R2.model.rawColor > z.model.rawColor ? 1 : R2.model.rawColor < z.model.rawColor ? -1 : 0;
      }
      function m(R2) {
        if (!R2.parcatsViewModel.dragDimension && R2.parcatsViewModel.hoverinfoItems.indexOf("skip") === -1) {
          i.raiseToTop(this), _4(n.select(this));
          var z = x(R2), H2 = b(R2);
          if (R2.parcatsViewModel.graphDiv.emit("plotly_hover", { points: z, event: n.event, constraints: H2 }), R2.parcatsViewModel.hoverinfoItems.indexOf("none") === -1) {
            var te, j, Q2, Z2 = n.mouse(this)[0], ne = R2.parcatsViewModel.graphDiv, ae = R2.parcatsViewModel.trace, ue = ne._fullLayout, le = ue._paperdiv.node().getBoundingClientRect(), ce = R2.parcatsViewModel.graphDiv.getBoundingClientRect();
            for (Q2 = 0; Q2 < R2.leftXs.length - 1; Q2++) if (R2.leftXs[Q2] + R2.dimWidths[Q2] - 2 <= Z2 && Z2 <= R2.leftXs[Q2 + 1] + 2) {
              var se = R2.parcatsViewModel.dimensions[Q2], he = R2.parcatsViewModel.dimensions[Q2 + 1];
              te = (se.x + se.width + he.x) / 2, j = (R2.topYs[Q2] + R2.topYs[Q2 + 1] + R2.height) / 2;
              break;
            }
            var me = R2.parcatsViewModel.x + te, we = R2.parcatsViewModel.y + j, be = c.mostReadable(R2.model.color, ["black", "white"]), Ae = R2.model.count, pe = Ae / R2.parcatsViewModel.model.count, ve = { countLabel: Ae, probabilityLabel: pe.toFixed(3) }, Ee = [];
            R2.parcatsViewModel.hoverinfoItems.indexOf("count") !== -1 && Ee.push(["Count:", ve.countLabel].join(" ")), R2.parcatsViewModel.hoverinfoItems.indexOf("probability") !== -1 && Ee.push(["P:", ve.probabilityLabel].join(" "));
            var Se = Ee.join("<br>"), Ce = n.mouse(ne)[0];
            s.loneHover({ trace: ae, x: me - le.left + ce.left, y: we - le.top + ce.top, text: Se, color: R2.model.color, borderColor: "black", fontFamily: 'Monaco, "Courier New", monospace', fontSize: 10, fontColor: be, idealAlign: Ce < me ? "right" : "left", hovertemplate: (ae.line || {}).hovertemplate, hovertemplateLabels: ve, eventData: [{ data: ae._input, fullData: ae, count: Ae, probability: pe }] }, { container: ue._hoverlayer.node(), outerContainer: ue._paper.node(), gd: ne });
          }
        }
      }
      function g(R2) {
        if (!R2.parcatsViewModel.dragDimension && (w(n.select(this)), s.loneUnhover(R2.parcatsViewModel.graphDiv._fullLayout._hoverlayer.node()), R2.parcatsViewModel.pathSelection.sort(v), R2.parcatsViewModel.hoverinfoItems.indexOf("skip") === -1)) {
          var z = x(R2), H2 = b(R2);
          R2.parcatsViewModel.graphDiv.emit("plotly_unhover", { points: z, event: n.event, constraints: H2 });
        }
      }
      function x(R2) {
        for (var z = [], H2 = L2(R2.parcatsViewModel), te = 0; te < R2.model.valueInds.length; te++) {
          var j = R2.model.valueInds[te];
          z.push({ curveNumber: H2, pointNumber: j });
        }
        return z;
      }
      function b(R2) {
        for (var z = {}, H2 = R2.parcatsViewModel.model.dimensions, te = 0; te < H2.length; te++) {
          var j = H2[te], Q2 = j.categories[R2.model.categoryInds[te]];
          z[j.containerInd] = Q2.categoryValue;
        }
        return R2.model.rawColor !== void 0 && (z.color = R2.model.rawColor), z;
      }
      function y(R2) {
        if (R2.parcatsViewModel.hoverinfoItems.indexOf("skip") === -1) {
          var z = x(R2), H2 = b(R2);
          R2.parcatsViewModel.graphDiv.emit("plotly_click", { points: z, event: n.event, constraints: H2 });
        }
      }
      function w(R2) {
        R2.attr("fill", function(z) {
          return z.model.color;
        }).attr("fill-opacity", 0.6).attr("stroke", "lightgray").attr("stroke-width", 0.2).attr("stroke-opacity", 1);
      }
      function _4(R2) {
        R2.attr("fill-opacity", 0.8).attr("stroke", function(z) {
          return c.mostReadable(z.model.color, ["black", "white"]);
        }).attr("stroke-width", 0.3);
      }
      function k(R2) {
        R2.select("rect.catrect").attr("stroke", "black").attr("stroke-width", 1).attr("stroke-opacity", 1);
      }
      function T2(R2) {
        R2.attr("stroke", "black").attr("stroke-width", 0.2).attr("stroke-opacity", 1).attr("fill-opacity", 1);
      }
      function A2(R2) {
        var z = R2.parcatsViewModel.pathSelection, H2 = R2.categoryViewModel.model.dimensionInd, te = R2.categoryViewModel.model.categoryInd;
        return z.filter(function(j) {
          return j.model.categoryInds[H2] === te && j.model.color === R2.color;
        });
      }
      function S2(R2, z, H2) {
        var te = n.select(R2).datum(), j = te.categoryViewModel.model, Q2 = te.parcatsViewModel.graphDiv, Z2 = n.select(R2.parentNode).selectAll("rect.bandrect"), ne = [];
        Z2.each(function(ue) {
          A2(ue).each(function(le) {
            Array.prototype.push.apply(ne, x(le));
          });
        });
        var ae = {};
        ae[j.dimensionInd] = j.categoryValue, Q2.emit(z, { points: ne, event: H2, constraints: ae });
      }
      function C2(R2, z, H2) {
        var te = n.select(R2).datum(), j = te.categoryViewModel.model, Q2 = te.parcatsViewModel.graphDiv, Z2 = A2(te), ne = [];
        Z2.each(function(ue) {
          Array.prototype.push.apply(ne, x(ue));
        });
        var ae = {};
        ae[j.dimensionInd] = j.categoryValue, te.rawColor !== void 0 && (ae.color = te.rawColor), Q2.emit(z, { points: ne, event: H2, constraints: ae });
      }
      function E2(R2, z, H2) {
        R2._fullLayout._calcInverseTransform(R2);
        var te, j, Q2 = R2._fullLayout._invScaleX, Z2 = R2._fullLayout._invScaleY, ne = n.select(H2.parentNode).select("rect.catrect"), ae = ne.node().getBoundingClientRect(), ue = ne.datum(), le = ue.parcatsViewModel, ce = le.model.dimensions[ue.model.dimensionInd], se = le.trace, he = ae.top + ae.height / 2;
        le.dimensions.length > 1 && ce.displayInd === le.dimensions.length - 1 ? (te = ae.left, j = "left") : (te = ae.left + ae.width, j = "right");
        var me = ue.model.count, we = ue.model.categoryLabel, be = me / ue.parcatsViewModel.model.count, Ae = { countLabel: me, categoryLabel: we, probabilityLabel: be.toFixed(3) }, pe = [];
        ue.parcatsViewModel.hoverinfoItems.indexOf("count") !== -1 && pe.push(["Count:", Ae.countLabel].join(" ")), ue.parcatsViewModel.hoverinfoItems.indexOf("probability") !== -1 && pe.push(["P(" + Ae.categoryLabel + "):", Ae.probabilityLabel].join(" "));
        var ve = pe.join("<br>");
        return { trace: se, x: Q2 * (te - z.left), y: Z2 * (he - z.top), text: ve, color: "lightgray", borderColor: "black", fontFamily: 'Monaco, "Courier New", monospace', fontSize: 12, fontColor: "black", idealAlign: j, hovertemplate: se.hovertemplate, hovertemplateLabels: Ae, eventData: [{ data: se._input, fullData: se, count: me, category: we, probability: be }] };
      }
      function F13(R2) {
        if (!R2.parcatsViewModel.dragDimension && R2.parcatsViewModel.hoverinfoItems.indexOf("skip") === -1) {
          if (n.mouse(this)[1] < -1) return;
          var z, H2 = R2.parcatsViewModel.graphDiv, te = H2._fullLayout, j = te._paperdiv.node().getBoundingClientRect(), Q2 = R2.parcatsViewModel.hoveron;
          Q2 === "color" ? (function(Z2) {
            var ne = n.select(Z2).datum(), ae = A2(ne);
            _4(ae), ae.each(function() {
              i.raiseToTop(this);
            }), n.select(Z2.parentNode).selectAll("rect.bandrect").filter(function(ue) {
              return ue.color === ne.color;
            }).each(function() {
              i.raiseToTop(this), n.select(this).attr("stroke", "black").attr("stroke-width", 1.5);
            });
          }(this), C2(this, "plotly_hover", n.event)) : (function(Z2) {
            n.select(Z2.parentNode).selectAll("rect.bandrect").each(function(ne) {
              var ae = A2(ne);
              _4(ae), ae.each(function() {
                i.raiseToTop(this);
              });
            }), n.select(Z2.parentNode).select("rect.catrect").attr("stroke", "black").attr("stroke-width", 2.5);
          }(this), S2(this, "plotly_hover", n.event)), R2.parcatsViewModel.hoverinfoItems.indexOf("none") === -1 && (Q2 === "category" ? z = E2(H2, j, this) : Q2 === "color" ? z = function(Z2, ne, ae) {
            Z2._fullLayout._calcInverseTransform(Z2);
            var ue, le, ce = Z2._fullLayout._invScaleX, se = Z2._fullLayout._invScaleY, he = ae.getBoundingClientRect(), me = n.select(ae).datum(), we = me.categoryViewModel, be = we.parcatsViewModel, Ae = be.model.dimensions[we.model.dimensionInd], pe = be.trace, ve = he.y + he.height / 2;
            be.dimensions.length > 1 && Ae.displayInd === be.dimensions.length - 1 ? (ue = he.left, le = "left") : (ue = he.left + he.width, le = "right");
            var Ee = we.model.categoryLabel, Se = me.parcatsViewModel.model.count, Ce = 0;
            me.categoryViewModel.bands.forEach(function(wt) {
              wt.color === me.color && (Ce += wt.count);
            });
            var Be = we.model.count, Ue = 0;
            be.pathSelection.each(function(wt) {
              wt.model.color === me.color && (Ue += wt.model.count);
            });
            var Ke = Ce / Se, ct = Ce / Ue, We = Ce / Be, Ze = { countLabel: Se, categoryLabel: Ee, probabilityLabel: Ke.toFixed(3) }, it = [];
            we.parcatsViewModel.hoverinfoItems.indexOf("count") !== -1 && it.push(["Count:", Ze.countLabel].join(" ")), we.parcatsViewModel.hoverinfoItems.indexOf("probability") !== -1 && (it.push("P(color \u2229 " + Ee + "): " + Ze.probabilityLabel), it.push("P(" + Ee + " | color): " + ct.toFixed(3)), it.push("P(color | " + Ee + "): " + We.toFixed(3)));
            var ot = it.join("<br>"), mt = c.mostReadable(me.color, ["black", "white"]);
            return { trace: pe, x: ce * (ue - ne.left), y: se * (ve - ne.top), text: ot, color: me.color, borderColor: "black", fontFamily: 'Monaco, "Courier New", monospace', fontColor: mt, fontSize: 10, idealAlign: le, hovertemplate: pe.hovertemplate, hovertemplateLabels: Ze, eventData: [{ data: pe._input, fullData: pe, category: Ee, count: Se, probability: Ke, categorycount: Be, colorcount: Ue, bandcolorcount: Ce }] };
          }(H2, j, this) : Q2 === "dimension" && (z = function(Z2, ne, ae) {
            var ue = [];
            return n.select(ae.parentNode.parentNode).selectAll("g.category").select("rect.catrect").each(function() {
              ue.push(E2(Z2, ne, this));
            }), ue;
          }(H2, j, this)), z && s.loneHover(z, { container: te._hoverlayer.node(), outerContainer: te._paper.node(), gd: H2 }));
        }
      }
      function N2(R2) {
        var z = R2.parcatsViewModel;
        !z.dragDimension && (w(z.pathSelection), k(z.dimensionSelection.selectAll("g.category")), T2(z.dimensionSelection.selectAll("g.category").selectAll("rect.bandrect")), s.loneUnhover(z.graphDiv._fullLayout._hoverlayer.node()), z.pathSelection.sort(v), z.hoverinfoItems.indexOf("skip") === -1) && (R2.parcatsViewModel.hoveron === "color" ? C2(this, "plotly_unhover", n.event) : S2(this, "plotly_unhover", n.event));
      }
      function D2(R2) {
        R2.parcatsViewModel.arrangement !== "fixed" && (R2.dragDimensionDisplayInd = R2.model.displayInd, R2.initialDragDimensionDisplayInds = R2.parcatsViewModel.model.dimensions.map(function(z) {
          return z.displayInd;
        }), R2.dragHasMoved = false, R2.dragCategoryDisplayInd = null, n.select(this).selectAll("g.category").select("rect.catrect").each(function(z) {
          var H2 = n.mouse(this)[0], te = n.mouse(this)[1];
          -2 <= H2 && H2 <= z.width + 2 && -2 <= te && te <= z.height + 2 && (R2.dragCategoryDisplayInd = z.model.displayInd, R2.initialDragCategoryDisplayInds = R2.model.categories.map(function(j) {
            return j.displayInd;
          }), z.model.dragY = z.y, i.raiseToTop(this.parentNode), n.select(this.parentNode).selectAll("rect.bandrect").each(function(j) {
            j.y < te && te <= j.y + j.height && (R2.potentialClickBand = this);
          }));
        }), R2.parcatsViewModel.dragDimension = R2, s.loneUnhover(R2.parcatsViewModel.graphDiv._fullLayout._hoverlayer.node()));
      }
      function I2(R2) {
        if (R2.parcatsViewModel.arrangement !== "fixed" && (R2.dragHasMoved = true, R2.dragDimensionDisplayInd !== null)) {
          var z = R2.dragDimensionDisplayInd, H2 = z - 1, te = z + 1, j = R2.parcatsViewModel.dimensions[z];
          if (R2.dragCategoryDisplayInd !== null) {
            var Q2 = j.categories[R2.dragCategoryDisplayInd];
            Q2.model.dragY += n.event.dy;
            var Z2 = Q2.model.dragY, ne = Q2.model.displayInd, ae = j.categories, ue = ae[ne - 1], le = ae[ne + 1];
            ue !== void 0 && Z2 < ue.y + ue.height / 2 && (Q2.model.displayInd = ue.model.displayInd, ue.model.displayInd = ne), le !== void 0 && Z2 + Q2.height > le.y + le.height / 2 && (Q2.model.displayInd = le.model.displayInd, le.model.displayInd = ne), R2.dragCategoryDisplayInd = Q2.model.displayInd;
          }
          if (R2.dragCategoryDisplayInd === null || R2.parcatsViewModel.arrangement === "freeform") {
            j.model.dragX = n.event.x;
            var ce = R2.parcatsViewModel.dimensions[H2], se = R2.parcatsViewModel.dimensions[te];
            ce !== void 0 && j.model.dragX < ce.x + ce.width && (j.model.displayInd = ce.model.displayInd, ce.model.displayInd = z), se !== void 0 && j.model.dragX + j.width > se.x && (j.model.displayInd = se.model.displayInd, se.model.displayInd = R2.dragDimensionDisplayInd), R2.dragDimensionDisplayInd = j.model.displayInd;
          }
          q(R2.parcatsViewModel), K2(R2.parcatsViewModel), W2(R2.parcatsViewModel), V2(R2.parcatsViewModel);
        }
      }
      function O2(R2) {
        if (R2.parcatsViewModel.arrangement !== "fixed" && R2.dragDimensionDisplayInd !== null) {
          n.select(this).selectAll("text").attr("font-weight", "normal");
          var z = {}, H2 = L2(R2.parcatsViewModel), te = R2.parcatsViewModel.model.dimensions.map(function(le) {
            return le.displayInd;
          }), j = R2.initialDragDimensionDisplayInds.some(function(le, ce) {
            return le !== te[ce];
          });
          j && te.forEach(function(le, ce) {
            var se = R2.parcatsViewModel.model.dimensions[ce].containerInd;
            z["dimensions[" + se + "].displayindex"] = le;
          });
          var Q2 = false;
          if (R2.dragCategoryDisplayInd !== null) {
            var Z2 = R2.model.categories.map(function(le) {
              return le.displayInd;
            });
            if (Q2 = R2.initialDragCategoryDisplayInds.some(function(le, ce) {
              return le !== Z2[ce];
            })) {
              var ne = R2.model.categories.slice().sort(function(le, ce) {
                return le.displayInd - ce.displayInd;
              }), ae = ne.map(function(le) {
                return le.categoryValue;
              }), ue = ne.map(function(le) {
                return le.categoryLabel;
              });
              z["dimensions[" + R2.model.containerInd + "].categoryarray"] = [ae], z["dimensions[" + R2.model.containerInd + "].ticktext"] = [ue], z["dimensions[" + R2.model.containerInd + "].categoryorder"] = "array";
            }
          }
          R2.parcatsViewModel.hoverinfoItems.indexOf("skip") === -1 && !R2.dragHasMoved && R2.potentialClickBand && (R2.parcatsViewModel.hoveron === "color" ? C2(R2.potentialClickBand, "plotly_click", n.event.sourceEvent) : S2(R2.potentialClickBand, "plotly_click", n.event.sourceEvent)), R2.model.dragX = null, R2.dragCategoryDisplayInd !== null && (R2.parcatsViewModel.dimensions[R2.dragDimensionDisplayInd].categories[R2.dragCategoryDisplayInd].model.dragY = null, R2.dragCategoryDisplayInd = null), R2.dragDimensionDisplayInd = null, R2.parcatsViewModel.dragDimension = null, R2.dragHasMoved = null, R2.potentialClickBand = null, q(R2.parcatsViewModel), K2(R2.parcatsViewModel), n.transition().duration(300).ease("cubic-in-out").each(function() {
            W2(R2.parcatsViewModel, true), V2(R2.parcatsViewModel, true);
          }).each("end", function() {
            (j || Q2) && o.restyle(R2.parcatsViewModel.graphDiv, z, [H2]);
          });
        }
      }
      function L2(R2) {
        for (var z, H2 = R2.graphDiv._fullData, te = 0; te < H2.length; te++) if (R2.key === H2[te].uid) {
          z = te;
          break;
        }
        return z;
      }
      function V2(R2, z) {
        var H2;
        z === void 0 && (z = false), R2.pathSelection.data(function(te) {
          return te.paths;
        }, p), (H2 = R2.pathSelection, z ? H2.transition() : H2).attr("d", function(te) {
          return te.svgD;
        });
      }
      function W2(R2, z) {
        function H2(Z2) {
          return z ? Z2.transition() : Z2;
        }
        z === void 0 && (z = false), R2.dimensionSelection.data(function(Z2) {
          return Z2.dimensions;
        }, p);
        var te = R2.dimensionSelection.selectAll("g.category").data(function(Z2) {
          return Z2.categories;
        }, p);
        H2(R2.dimensionSelection).attr("transform", function(Z2) {
          return l(Z2.x, 0);
        }), H2(te).attr("transform", function(Z2) {
          return l(0, Z2.y);
        }), te.select(".dimlabel").text(function(Z2, ne) {
          return ne === 0 ? Z2.parcatsViewModel.model.dimensions[Z2.model.dimensionInd].dimensionLabel : null;
        }), te.select(".catlabel").attr("text-anchor", function(Z2) {
          return d(Z2) ? "start" : "end";
        }).attr("x", function(Z2) {
          return d(Z2) ? Z2.width + 5 : -5;
        }).each(function(Z2) {
          var ne, ae;
          d(Z2) ? (ne = Z2.width + 5, ae = "start") : (ne = -5, ae = "end"), n.select(this).selectAll("tspan").attr("x", ne).attr("text-anchor", ae);
        });
        var j = te.selectAll("rect.bandrect").data(function(Z2) {
          return Z2.bands;
        }, p), Q2 = j.enter().append("rect").attr("class", "bandrect").attr("cursor", "move").attr("stroke-opacity", 0).attr("fill", function(Z2) {
          return Z2.color;
        }).attr("fill-opacity", 0);
        j.attr("fill", function(Z2) {
          return Z2.color;
        }).attr("width", function(Z2) {
          return Z2.width;
        }).attr("height", function(Z2) {
          return Z2.height;
        }).attr("y", function(Z2) {
          return Z2.y;
        }), T2(Q2), j.each(function() {
          i.raiseToTop(this);
        }), j.exit().remove();
      }
      function X2(R2, z, H2) {
        var te, j = H2[0], Q2 = z.margin || { l: 80, r: 80, t: 100, b: 80 }, Z2 = j.trace, ne = Z2.domain, ae = z.width, ue = z.height, le = Math.floor(ae * (ne.x[1] - ne.x[0])), ce = Math.floor(ue * (ne.y[1] - ne.y[0])), se = ne.x[0] * ae + Q2.l, he = z.height - ne.y[1] * z.height + Q2.t, me = Z2.line.shape;
        te = Z2.hoverinfo === "all" ? ["count", "probability"] : (Z2.hoverinfo || "").split("+");
        var we = { trace: Z2, key: Z2.uid, model: j, x: se, y: he, width: le, height: ce, hoveron: Z2.hoveron, hoverinfoItems: te, arrangement: Z2.arrangement, bundlecolors: Z2.bundlecolors, sortpaths: Z2.sortpaths, labelfont: Z2.labelfont, categorylabelfont: Z2.tickfont, pathShape: me, dragDimension: null, margin: Q2, paths: [], dimensions: [], graphDiv: R2, traceSelection: null, pathSelection: null, dimensionSelection: null };
        return j.dimensions && (q(we), K2(we)), we;
      }
      function Y2(R2, z, H2, te, j) {
        var Q2, Z2, ne = [], ae = [];
        for (Z2 = 0; Z2 < H2.length - 1; Z2++) Q2 = a(H2[Z2] + R2[Z2], R2[Z2 + 1]), ne.push(Q2(j)), ae.push(Q2(1 - j));
        var ue = "M " + R2[0] + "," + z[0];
        for (ue += "l" + H2[0] + ",0 ", Z2 = 1; Z2 < H2.length; Z2++) ue += "C" + ne[Z2 - 1] + "," + z[Z2 - 1] + " " + ae[Z2 - 1] + "," + z[Z2] + " " + R2[Z2] + "," + z[Z2], ue += "l" + H2[Z2] + ",0 ";
        for (ue += "l0," + te + " ", ue += "l -" + H2[H2.length - 1] + ",0 ", Z2 = H2.length - 2; Z2 >= 0; Z2--) ue += "C" + ae[Z2] + "," + (z[Z2 + 1] + te) + " " + ne[Z2] + "," + (z[Z2] + te) + " " + (R2[Z2] + H2[Z2]) + "," + (z[Z2] + te), ue += "l-" + H2[Z2] + ",0 ";
        return ue += "Z";
      }
      function K2(R2) {
        var z = R2.dimensions, H2 = R2.model, te = z.map(function(it) {
          return it.categories.map(function(ot) {
            return ot.y;
          });
        }), j = R2.model.dimensions.map(function(it) {
          return it.categories.map(function(ot) {
            return ot.displayInd;
          });
        }), Q2 = R2.model.dimensions.map(function(it) {
          return it.displayInd;
        }), Z2 = R2.dimensions.map(function(it) {
          return it.model.dimensionInd;
        }), ne = z.map(function(it) {
          return it.x;
        }), ae = z.map(function(it) {
          return it.width;
        }), ue = [];
        for (var le in H2.paths) H2.paths.hasOwnProperty(le) && ue.push(H2.paths[le]);
        function ce(it) {
          var ot = it.categoryInds.map(function(mt, wt) {
            return j[wt][mt];
          });
          return Z2.map(function(mt) {
            return ot[mt];
          });
        }
        ue.sort(function(it, ot) {
          var mt = ce(it), wt = ce(ot);
          return R2.sortpaths === "backward" && (mt.reverse(), wt.reverse()), mt.push(it.valueInds[0]), wt.push(ot.valueInds[0]), R2.bundlecolors && (mt.unshift(it.rawColor), wt.unshift(ot.rawColor)), mt < wt ? -1 : mt > wt ? 1 : 0;
        });
        for (var se = new Array(ue.length), he = z[0].model.count, me = z[0].categories.map(function(it) {
          return it.height;
        }).reduce(function(it, ot) {
          return it + ot;
        }), we = 0; we < ue.length; we++) {
          var be, Ae = ue[we];
          be = he > 0 ? me * (Ae.count / he) : 0;
          for (var pe, ve = new Array(te.length), Ee = 0; Ee < Ae.categoryInds.length; Ee++) {
            var Se = Ae.categoryInds[Ee], Ce = j[Ee][Se], Be = Q2[Ee];
            ve[Be] = te[Be][Ce], te[Be][Ce] += be;
            var Ue = R2.dimensions[Be].categories[Ce], Ke = Ue.bands.length, ct = Ue.bands[Ke - 1];
            if (ct === void 0 || Ae.rawColor !== ct.rawColor) {
              var We = ct === void 0 ? 0 : ct.y + ct.height;
              Ue.bands.push({ key: We, color: Ae.color, rawColor: Ae.rawColor, height: be, width: Ue.width, count: Ae.count, y: We, categoryViewModel: Ue, parcatsViewModel: R2 });
            } else {
              var Ze = Ue.bands[Ke - 1];
              Ze.height += be, Ze.count += Ae.count;
            }
          }
          pe = R2.pathShape === "hspline" ? Y2(ne, ve, ae, be, 0.5) : Y2(ne, ve, ae, be, 0), se[we] = { key: Ae.valueInds[0], model: Ae, height: be, leftXs: ne, topYs: ve, dimWidths: ae, svgD: pe, parcatsViewModel: R2 };
        }
        R2.paths = se;
      }
      function q(R2) {
        var z = R2.model.dimensions.map(function(Z2) {
          return { displayInd: Z2.displayInd, dimensionInd: Z2.dimensionInd };
        });
        z.sort(function(Z2, ne) {
          return Z2.displayInd - ne.displayInd;
        });
        var H2 = [];
        for (var te in z) {
          var j = z[te].dimensionInd, Q2 = R2.model.dimensions[j];
          H2.push(re(R2, Q2));
        }
        R2.dimensions = H2;
      }
      function re(R2, z) {
        var H2, te = R2.model.dimensions.length, j = z.displayInd;
        H2 = 40 + (te > 1 ? (R2.width - 80 - 16) / (te - 1) : 0) * j;
        var Q2, Z2, ne, ae, ue, le = [], ce = R2.model.maxCats, se = z.categories.length, he = z.count, me = R2.height - 8 * (ce - 1), we = 8 * (ce - se) / 2, be = z.categories.map(function(Ae) {
          return { displayInd: Ae.displayInd, categoryInd: Ae.categoryInd };
        });
        for (be.sort(function(Ae, pe) {
          return Ae.displayInd - pe.displayInd;
        }), ue = 0; ue < se; ue++) ae = be[ue].categoryInd, Z2 = z.categories[ae], Q2 = he > 0 ? Z2.count / he * me : 0, ne = { key: Z2.valueInds[0], model: Z2, width: 16, height: Q2, y: Z2.dragY !== null ? Z2.dragY : we, bands: [], parcatsViewModel: R2 }, we = we + Q2 + 8, le.push(ne);
        return { key: z.dimensionInd, x: z.dragX !== null ? z.dragX : H2, y: 0, width: 16, model: z, categories: le, parcatsViewModel: R2, dragCategoryDisplayInd: null, dragDimensionDisplayInd: null, initialDragDimensionDisplayInds: null, initialDragCategoryDisplayInds: null, dragHasMoved: null, potentialClickBand: null };
      }
      t.exports = function(R2, z, H2, te) {
        h(H2, R2, te, z);
      };
    }, { "../../components/drawing": 388, "../../components/fx": 406, "../../lib": 503, "../../lib/svg_text_utils": 529, "../../plot_api/plot_api": 540, "@plotly/d3": 58, "d3-interpolate": 116, tinycolor2: 312 }], 887: [function(e, t, r) {
      "use strict";
      var n = e("./parcats");
      t.exports = function(a, o, s, i) {
        var l = a._fullLayout, u2 = l._paper, c = l._size;
        n(a, u2, o, { width: c.w, height: c.h, margin: { t: c.t, r: c.r, b: c.b, l: c.l } }, s, i);
      };
    }, { "./parcats": 886 }], 888: [function(e, t, r) {
      "use strict";
      var n = e("../../components/colorscale/attributes"), a = e("../../plots/cartesian/layout_attributes"), o = e("../../plots/font_attributes"), s = e("../../plots/domain").attributes, i = e("../../lib/extend").extendFlat, l = e("../../plot_api/plot_template").templatedArray;
      t.exports = { domain: s({ name: "parcoords", trace: true, editType: "plot" }), labelangle: { valType: "angle", dflt: 0, editType: "plot" }, labelside: { valType: "enumerated", values: ["top", "bottom"], dflt: "top", editType: "plot" }, labelfont: o({ editType: "plot" }), tickfont: o({ editType: "plot" }), rangefont: o({ editType: "plot" }), dimensions: l("dimension", { label: { valType: "string", editType: "plot" }, tickvals: i({}, a.tickvals, { editType: "plot" }), ticktext: i({}, a.ticktext, { editType: "plot" }), tickformat: i({}, a.tickformat, { editType: "plot" }), visible: { valType: "boolean", dflt: true, editType: "plot" }, range: { valType: "info_array", items: [{ valType: "number", editType: "plot" }, { valType: "number", editType: "plot" }], editType: "plot" }, constraintrange: { valType: "info_array", freeLength: true, dimensions: "1-2", items: [{ valType: "any", editType: "plot" }, { valType: "any", editType: "plot" }], editType: "plot" }, multiselect: { valType: "boolean", dflt: true, editType: "plot" }, values: { valType: "data_array", editType: "calc" }, editType: "calc" }), line: i({ editType: "calc" }, n("line", { colorscaleDflt: "Viridis", autoColorDflt: false, editTypeOverride: "calc" })) };
    }, { "../../components/colorscale/attributes": 373, "../../lib/extend": 493, "../../plot_api/plot_template": 543, "../../plots/cartesian/layout_attributes": 569, "../../plots/domain": 584, "../../plots/font_attributes": 585 }], 889: [function(e, t, r) {
      "use strict";
      var n = e("./constants"), a = e("@plotly/d3"), o = e("../../lib/gup").keyFun, s = e("../../lib/gup").repeat, i = e("../../lib").sorterAsc, l = e("../../lib").strTranslate, u2 = n.bar.snapRatio;
      function c(E2, F13) {
        return E2 * (1 - u2) + F13 * u2;
      }
      var f = n.bar.snapClose;
      function h(E2, F13) {
        return E2 * (1 - f) + F13 * f;
      }
      function p(E2, F13, N2, D2) {
        if (function(re, R2) {
          for (var z = 0; z < R2.length; z++) if (re >= R2[z][0] && re <= R2[z][1]) return true;
          return false;
        }(N2, D2)) return N2;
        var I2 = E2 ? -1 : 1, O2 = 0, L2 = F13.length - 1;
        if (I2 < 0) {
          var V2 = O2;
          O2 = L2, L2 = V2;
        }
        for (var W2 = F13[O2], X2 = W2, Y2 = O2; I2 * Y2 < I2 * L2; Y2 += I2) {
          var K2 = Y2 + I2, q = F13[K2];
          if (I2 * N2 < I2 * h(W2, q)) return c(W2, X2);
          if (I2 * N2 < I2 * q || K2 === L2) return c(q, W2);
          X2 = W2, W2 = q;
        }
      }
      function d(E2) {
        E2.attr("x", -n.bar.captureWidth / 2).attr("width", n.bar.captureWidth);
      }
      function v(E2) {
        E2.attr("visibility", "visible").style("visibility", "visible").attr("fill", "yellow").attr("opacity", 0);
      }
      function m(E2) {
        if (!E2.brush.filterSpecified) return "0," + E2.height;
        for (var F13, N2, D2, I2 = g(E2.brush.filter.getConsolidated(), E2.height), O2 = [0], L2 = I2.length ? I2[0][0] : null, V2 = 0; V2 < I2.length; V2++) N2 = (F13 = I2[V2])[1] - F13[0], O2.push(L2), O2.push(N2), (D2 = V2 + 1) < I2.length && (L2 = I2[D2][0] - F13[1]);
        return O2.push(E2.height), O2;
      }
      function g(E2, F13) {
        return E2.map(function(N2) {
          return N2.map(function(D2) {
            return Math.max(0, D2 * F13);
          }).sort(i);
        });
      }
      function x() {
        a.select(document.body).style("cursor", null);
      }
      function b(E2) {
        E2.attr("stroke-dasharray", m);
      }
      function y(E2, F13) {
        var N2 = a.select(E2).selectAll(".highlight, .highlight-shadow");
        b(F13 ? N2.transition().duration(n.bar.snapDuration).each("end", F13) : N2);
      }
      function w(E2, F13) {
        var N2, D2 = E2.brush, I2 = NaN, O2 = {};
        if (D2.filterSpecified) {
          var L2 = E2.height, V2 = D2.filter.getConsolidated(), W2 = g(V2, L2), X2 = NaN, Y2 = NaN, K2 = NaN;
          for (N2 = 0; N2 <= W2.length; N2++) {
            var q = W2[N2];
            if (q && q[0] <= F13 && F13 <= q[1]) {
              X2 = N2;
              break;
            }
            if (Y2 = N2 ? N2 - 1 : NaN, q && q[0] > F13) {
              K2 = N2;
              break;
            }
          }
          if (I2 = X2, isNaN(I2) && (I2 = isNaN(Y2) || isNaN(K2) ? isNaN(Y2) ? K2 : Y2 : F13 - W2[Y2][1] < W2[K2][0] - F13 ? Y2 : K2), !isNaN(I2)) {
            var re = W2[I2], R2 = function(j, Q2) {
              var Z2 = n.bar.handleHeight;
              if (!(Q2 > j[1] + Z2 || Q2 < j[0] - Z2)) return Q2 >= 0.9 * j[1] + 0.1 * j[0] ? "n" : Q2 <= 0.9 * j[0] + 0.1 * j[1] ? "s" : "ns";
            }(re, F13);
            R2 && (O2.interval = V2[I2], O2.intervalPix = re, O2.region = R2);
          }
        }
        if (E2.ordinal && !O2.region) {
          var z = E2.unitTickvals, H2 = E2.unitToPaddedPx.invert(F13);
          for (N2 = 0; N2 < z.length; N2++) {
            var te = [0.25 * z[Math.max(N2 - 1, 0)] + 0.75 * z[N2], 0.25 * z[Math.min(N2 + 1, z.length - 1)] + 0.75 * z[N2]];
            if (H2 >= te[0] && H2 <= te[1]) {
              O2.clickableOrdinalRange = te;
              break;
            }
          }
        }
        return O2;
      }
      function _4(E2, F13) {
        a.event.sourceEvent.stopPropagation();
        var N2 = F13.height - a.mouse(E2)[1] - 2 * n.verticalPadding, D2 = F13.brush.svgBrush;
        D2.wasDragged = true, D2._dragging = true, D2.grabbingBar ? D2.newExtent = [N2 - D2.grabPoint, N2 + D2.barLength - D2.grabPoint].map(F13.unitToPaddedPx.invert) : D2.newExtent = [D2.startExtent, F13.unitToPaddedPx.invert(N2)].sort(i), F13.brush.filterSpecified = true, D2.extent = D2.stayingIntervals.concat([D2.newExtent]), D2.brushCallback(F13), y(E2.parentNode);
      }
      function k(E2, F13) {
        var N2 = w(F13, F13.height - a.mouse(E2)[1] - 2 * n.verticalPadding), D2 = "crosshair";
        N2.clickableOrdinalRange ? D2 = "pointer" : N2.region && (D2 = N2.region + "-resize"), a.select(document.body).style("cursor", D2);
      }
      function T2(E2) {
        E2.on("mousemove", function(F13) {
          a.event.preventDefault(), F13.parent.inBrushDrag || k(this, F13);
        }).on("mouseleave", function(F13) {
          F13.parent.inBrushDrag || x();
        }).call(a.behavior.drag().on("dragstart", function(F13) {
          (function(N2, D2) {
            a.event.sourceEvent.stopPropagation();
            var I2 = D2.height - a.mouse(N2)[1] - 2 * n.verticalPadding, O2 = D2.unitToPaddedPx.invert(I2), L2 = D2.brush, V2 = w(D2, I2), W2 = V2.interval, X2 = L2.svgBrush;
            if (X2.wasDragged = false, X2.grabbingBar = V2.region === "ns", X2.grabbingBar) {
              var Y2 = W2.map(D2.unitToPaddedPx);
              X2.grabPoint = I2 - Y2[0] - n.verticalPadding, X2.barLength = Y2[1] - Y2[0];
            }
            X2.clickableOrdinalRange = V2.clickableOrdinalRange, X2.stayingIntervals = D2.multiselect && L2.filterSpecified ? L2.filter.getConsolidated() : [], W2 && (X2.stayingIntervals = X2.stayingIntervals.filter(function(K2) {
              return K2[0] !== W2[0] && K2[1] !== W2[1];
            })), X2.startExtent = V2.region ? W2[V2.region === "s" ? 1 : 0] : O2, D2.parent.inBrushDrag = true, X2.brushStartCallback();
          })(this, F13);
        }).on("drag", function(F13) {
          _4(this, F13);
        }).on("dragend", function(F13) {
          (function(N2, D2) {
            var I2 = D2.brush, O2 = I2.filter, L2 = I2.svgBrush;
            L2._dragging || (k(N2, D2), _4(N2, D2), D2.brush.svgBrush.wasDragged = false), L2._dragging = false, a.event.sourceEvent.stopPropagation();
            var V2 = L2.grabbingBar;
            if (L2.grabbingBar = false, L2.grabLocation = void 0, D2.parent.inBrushDrag = false, x(), !L2.wasDragged) return L2.wasDragged = void 0, L2.clickableOrdinalRange ? I2.filterSpecified && D2.multiselect ? L2.extent.push(L2.clickableOrdinalRange) : (L2.extent = [L2.clickableOrdinalRange], I2.filterSpecified = true) : V2 ? (L2.extent = L2.stayingIntervals, L2.extent.length === 0 && S2(I2)) : S2(I2), L2.brushCallback(D2), y(N2.parentNode), void L2.brushEndCallback(I2.filterSpecified ? O2.getConsolidated() : []);
            var W2 = function() {
              O2.set(O2.getConsolidated());
            };
            if (D2.ordinal) {
              var X2 = D2.unitTickvals;
              X2[X2.length - 1] < X2[0] && X2.reverse(), L2.newExtent = [p(0, X2, L2.newExtent[0], L2.stayingIntervals), p(1, X2, L2.newExtent[1], L2.stayingIntervals)];
              var Y2 = L2.newExtent[1] > L2.newExtent[0];
              L2.extent = L2.stayingIntervals.concat(Y2 ? [L2.newExtent] : []), L2.extent.length || S2(I2), L2.brushCallback(D2), Y2 ? y(N2.parentNode, W2) : (W2(), y(N2.parentNode));
            } else W2();
            L2.brushEndCallback(I2.filterSpecified ? O2.getConsolidated() : []);
          })(this, F13);
        }));
      }
      function A2(E2, F13) {
        return E2[0] - F13[0];
      }
      function S2(E2) {
        E2.filterSpecified = false, E2.svgBrush.extent = [[-1 / 0, 1 / 0]];
      }
      function C2(E2) {
        for (var F13, N2 = E2.slice(), D2 = [], I2 = N2.shift(); I2; ) {
          for (F13 = I2.slice(); (I2 = N2.shift()) && I2[0] <= F13[1]; ) F13[1] = Math.max(F13[1], I2[1]);
          D2.push(F13);
        }
        return D2.length === 1 && D2[0][0] > D2[0][1] && (D2 = []), D2;
      }
      t.exports = { makeBrush: function(E2, F13, N2, D2, I2, O2) {
        var L2, V2 = /* @__PURE__ */ function() {
          var W2, X2, Y2 = [];
          return { set: function(K2) {
            (Y2 = K2.map(function(q) {
              return q.slice().sort(i);
            }).sort(A2)).length === 1 && Y2[0][0] === -1 / 0 && Y2[0][1] === 1 / 0 && (Y2 = [[0, -1]]), W2 = C2(Y2), X2 = Y2.reduce(function(q, re) {
              return [Math.min(q[0], re[0]), Math.max(q[1], re[1])];
            }, [1 / 0, -1 / 0]);
          }, get: function() {
            return Y2.slice();
          }, getConsolidated: function() {
            return W2;
          }, getBounds: function() {
            return X2;
          } };
        }();
        return V2.set(N2), { filter: V2, filterSpecified: F13, svgBrush: { extent: [], brushStartCallback: D2, brushCallback: (L2 = I2, function(W2) {
          var X2 = W2.brush, Y2 = function(K2) {
            return K2.svgBrush.extent.map(function(q) {
              return q.slice();
            });
          }(X2).slice();
          X2.filter.set(Y2), L2();
        }), brushEndCallback: O2 } };
      }, ensureAxisBrush: function(E2, F13) {
        var N2 = E2.selectAll("." + n.cn.axisBrush).data(s, o);
        N2.enter().append("g").classed(n.cn.axisBrush, true), function(D2, I2) {
          var O2 = D2.selectAll(".background").data(s);
          O2.enter().append("rect").classed("background", true).call(d).call(v).style("pointer-events", "auto").attr("transform", l(0, n.verticalPadding)), O2.call(T2).attr("height", function(W2) {
            return W2.height - n.verticalPadding;
          });
          var L2 = D2.selectAll(".highlight-shadow").data(s);
          L2.enter().append("line").classed("highlight-shadow", true).attr("x", -n.bar.width / 2).attr("stroke-width", n.bar.width + n.bar.strokeWidth).attr("stroke", I2).attr("opacity", n.bar.strokeOpacity).attr("stroke-linecap", "butt"), L2.attr("y1", function(W2) {
            return W2.height;
          }).call(b);
          var V2 = D2.selectAll(".highlight").data(s);
          V2.enter().append("line").classed("highlight", true).attr("x", -n.bar.width / 2).attr("stroke-width", n.bar.width - n.bar.strokeWidth).attr("stroke", n.bar.fillColor).attr("opacity", n.bar.fillOpacity).attr("stroke-linecap", "butt"), V2.attr("y1", function(W2) {
            return W2.height;
          }).call(b);
        }(N2, F13);
      }, cleanRanges: function(E2, F13) {
        if (Array.isArray(E2[0]) ? (E2 = E2.map(function(D2) {
          return D2.sort(i);
        }), E2 = F13.multiselect ? C2(E2.sort(A2)) : [E2[0]]) : E2 = [E2.sort(i)], F13.tickvals) {
          var N2 = F13.tickvals.slice().sort(i);
          if (!(E2 = E2.map(function(D2) {
            var I2 = [p(0, N2, D2[0], []), p(1, N2, D2[1], [])];
            if (I2[1] > I2[0]) return I2;
          }).filter(function(D2) {
            return D2;
          })).length) return;
        }
        return E2.length > 1 ? E2 : E2[0];
      } };
    }, { "../../lib": 503, "../../lib/gup": 500, "./constants": 892, "@plotly/d3": 58 }], 890: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../plots/get_data").getModuleCalcData, o = e("./plot"), s = e("../../constants/xmlns_namespaces");
      r.name = "parcoords", r.plot = function(i) {
        var l = a(i.calcdata, "parcoords")[0];
        l.length && o(i, l);
      }, r.clean = function(i, l, u2, c) {
        var f = c._has && c._has("parcoords"), h = l._has && l._has("parcoords");
        f && !h && (c._paperdiv.selectAll(".parcoords").remove(), c._glimages.selectAll("*").remove());
      }, r.toSVG = function(i) {
        var l = i._fullLayout._glimages, u2 = n.select(i).selectAll(".svg-container");
        u2.filter(function(c, f) {
          return f === u2.size() - 1;
        }).selectAll(".gl-canvas-context, .gl-canvas-focus").each(function() {
          var c = this.toDataURL("image/png");
          l.append("svg:image").attr({ xmlns: s.svg, "xlink:href": c, preserveAspectRatio: "none", x: 0, y: 0, width: this.style.width, height: this.style.height });
        }), window.setTimeout(function() {
          n.selectAll("#filterBarPattern").attr("id", "filterBarPattern");
        }, 60);
      };
    }, { "../../constants/xmlns_namespaces": 480, "../../plots/get_data": 593, "./plot": 899, "@plotly/d3": 58 }], 891: [function(e, t, r) {
      "use strict";
      var n = e("../../lib").isArrayOrTypedArray, a = e("../../components/colorscale"), o = e("../../lib/gup").wrap;
      t.exports = function(s, i) {
        var l, u2;
        return a.hasColorscale(i, "line") && n(i.line.color) ? (l = i.line.color, u2 = a.extractOpts(i.line).colorscale, a.calc(s, i, { vals: l, containerStr: "line", cLetter: "c" })) : (l = function(c) {
          for (var f = new Array(c), h = 0; h < c; h++) f[h] = 0.5;
          return f;
        }(i._length), u2 = [[0, i.line.color], [1, i.line.color]]), o({ lineColor: l, cscale: u2 });
      };
    }, { "../../components/colorscale": 378, "../../lib": 503, "../../lib/gup": 500 }], 892: [function(e, t, r) {
      "use strict";
      t.exports = { maxDimensionCount: 60, overdrag: 45, verticalPadding: 2, tickDistance: 50, canvasPixelRatio: 1, blockLineCount: 5e3, layers: ["contextLineLayer", "focusLineLayer", "pickLineLayer"], axisTitleOffset: 28, axisExtentOffset: 10, deselectedLineColor: "#777", bar: { width: 4, captureWidth: 10, fillColor: "magenta", fillOpacity: 1, snapDuration: 150, snapRatio: 0.25, snapClose: 0.01, strokeOpacity: 1, strokeWidth: 1, handleHeight: 8, handleOpacity: 1, handleOverlap: 0 }, cn: { axisExtentText: "axis-extent-text", parcoordsLineLayers: "parcoords-line-layers", parcoordsLineLayer: "parcoords-lines", parcoords: "parcoords", parcoordsControlView: "parcoords-control-view", yAxis: "y-axis", axisOverlays: "axis-overlays", axis: "axis", axisHeading: "axis-heading", axisTitle: "axis-title", axisExtent: "axis-extent", axisExtentTop: "axis-extent-top", axisExtentTopText: "axis-extent-top-text", axisExtentBottom: "axis-extent-bottom", axisExtentBottomText: "axis-extent-bottom-text", axisBrush: "axis-brush" }, id: { filterBarPattern: "filter-bar-pattern" } };
    }, {}], 893: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../components/colorscale/helpers").hasColorscale, o = e("../../components/colorscale/defaults"), s = e("../../plots/domain").defaults, i = e("../../plots/array_container_defaults"), l = e("../../plots/cartesian/axes"), u2 = e("./attributes"), c = e("./axisbrush"), f = e("./constants").maxDimensionCount, h = e("./merge_length");
      function p(d, v, m, g) {
        function x(k, T2) {
          return n.coerce(d, v, u2.dimensions, k, T2);
        }
        var b = x("values"), y = x("visible");
        if (b && b.length || (y = v.visible = false), y) {
          x("label"), x("tickvals"), x("ticktext"), x("tickformat");
          var w = x("range");
          v._ax = { _id: "y", type: "linear", showexponent: "all", exponentformat: "B", range: w }, l.setConvert(v._ax, g.layout), x("multiselect");
          var _4 = x("constraintrange");
          _4 && (v.constraintrange = c.cleanRanges(_4, v));
        }
      }
      t.exports = function(d, v, m, g) {
        function x(k, T2) {
          return n.coerce(d, v, u2, k, T2);
        }
        var b = d.dimensions;
        Array.isArray(b) && b.length > f && (n.log("parcoords traces support up to " + f + " dimensions at the moment"), b.splice(f));
        var y = i(d, v, { name: "dimensions", layout: g, handleItemDefaults: p }), w = function(k, T2, A2, S2, C2) {
          var E2 = C2("line.color", A2);
          if (a(k, "line") && n.isArrayOrTypedArray(E2)) {
            if (E2.length) return C2("line.colorscale"), o(k, T2, S2, C2, { prefix: "line.", cLetter: "c" }), E2.length;
            T2.line.color = A2;
          }
          return 1 / 0;
        }(d, v, m, g, x);
        s(v, g, x), Array.isArray(y) && y.length || (v.visible = false), h(v, y, "values", w);
        var _4 = { family: g.font.family, size: Math.round(g.font.size / 1.2), color: g.font.color };
        n.coerceFont(x, "labelfont", _4), n.coerceFont(x, "tickfont", _4), n.coerceFont(x, "rangefont", _4), x("labelangle"), x("labelside");
      };
    }, { "../../components/colorscale/defaults": 376, "../../components/colorscale/helpers": 377, "../../lib": 503, "../../plots/array_container_defaults": 549, "../../plots/cartesian/axes": 554, "../../plots/domain": 584, "./attributes": 888, "./axisbrush": 889, "./constants": 892, "./merge_length": 897 }], 894: [function(e, t, r) {
      "use strict";
      var n = e("../../lib").isTypedArray;
      r.convertTypedArray = function(a) {
        return n(a) ? Array.prototype.slice.call(a) : a;
      }, r.isOrdinal = function(a) {
        return !!a.tickvals;
      }, r.isVisible = function(a) {
        return a.visible || !("visible" in a);
      };
    }, { "../../lib": 503 }], 895: [function(e, t, r) {
      "use strict";
      t.exports = { attributes: e("./attributes"), supplyDefaults: e("./defaults"), calc: e("./calc"), plot: e("./plot"), colorbar: { container: "line", min: "cmin", max: "cmax" }, moduleType: "trace", name: "parcoords", basePlotModule: e("./base_plot"), categories: ["gl", "regl", "noOpacity", "noHover"], meta: {} };
    }, { "./attributes": 888, "./base_plot": 890, "./calc": 891, "./defaults": 893, "./plot": 899 }], 896: [function(e, t, r) {
      "use strict";
      var n = e("glslify"), a = n([`precision highp float;
#define GLSLIFY 1

varying vec4 fragColor;

attribute vec4 p01_04, p05_08, p09_12, p13_16,
               p17_20, p21_24, p25_28, p29_32,
               p33_36, p37_40, p41_44, p45_48,
               p49_52, p53_56, p57_60, colors;

uniform mat4 dim0A, dim1A, dim0B, dim1B, dim0C, dim1C, dim0D, dim1D,
             loA, hiA, loB, hiB, loC, hiC, loD, hiD;

uniform vec2 resolution, viewBoxPos, viewBoxSize;
uniform float maskHeight;
uniform float drwLayer; // 0: context, 1: focus, 2: pick
uniform vec4 contextColor;
uniform sampler2D maskTexture, palette;

bool isPick    = (drwLayer > 1.5);
bool isContext = (drwLayer < 0.5);

const vec4 ZEROS = vec4(0.0, 0.0, 0.0, 0.0);
const vec4 UNITS = vec4(1.0, 1.0, 1.0, 1.0);

float val(mat4 p, mat4 v) {
    return dot(matrixCompMult(p, v) * UNITS, UNITS);
}

float axisY(float ratio, mat4 A, mat4 B, mat4 C, mat4 D) {
    float y1 = val(A, dim0A) + val(B, dim0B) + val(C, dim0C) + val(D, dim0D);
    float y2 = val(A, dim1A) + val(B, dim1B) + val(C, dim1C) + val(D, dim1D);
    return y1 * (1.0 - ratio) + y2 * ratio;
}

int iMod(int a, int b) {
    return a - b * (a / b);
}

bool fOutside(float p, float lo, float hi) {
    return (lo < hi) && (lo > p || p > hi);
}

bool vOutside(vec4 p, vec4 lo, vec4 hi) {
    return (
        fOutside(p[0], lo[0], hi[0]) ||
        fOutside(p[1], lo[1], hi[1]) ||
        fOutside(p[2], lo[2], hi[2]) ||
        fOutside(p[3], lo[3], hi[3])
    );
}

bool mOutside(mat4 p, mat4 lo, mat4 hi) {
    return (
        vOutside(p[0], lo[0], hi[0]) ||
        vOutside(p[1], lo[1], hi[1]) ||
        vOutside(p[2], lo[2], hi[2]) ||
        vOutside(p[3], lo[3], hi[3])
    );
}

bool outsideBoundingBox(mat4 A, mat4 B, mat4 C, mat4 D) {
    return mOutside(A, loA, hiA) ||
           mOutside(B, loB, hiB) ||
           mOutside(C, loC, hiC) ||
           mOutside(D, loD, hiD);
}

bool outsideRasterMask(mat4 A, mat4 B, mat4 C, mat4 D) {
    mat4 pnts[4];
    pnts[0] = A;
    pnts[1] = B;
    pnts[2] = C;
    pnts[3] = D;

    for(int i = 0; i < 4; ++i) {
        for(int j = 0; j < 4; ++j) {
            for(int k = 0; k < 4; ++k) {
                if(0 == iMod(
                    int(255.0 * texture2D(maskTexture,
                        vec2(
                            (float(i * 2 + j / 2) + 0.5) / 8.0,
                            (pnts[i][j][k] * (maskHeight - 1.0) + 1.0) / maskHeight
                        ))[3]
                    ) / int(pow(2.0, float(iMod(j * 4 + k, 8)))),
                    2
                )) return true;
            }
        }
    }
    return false;
}

vec4 position(bool isContext, float v, mat4 A, mat4 B, mat4 C, mat4 D) {
    float x = 0.5 * sign(v) + 0.5;
    float y = axisY(x, A, B, C, D);
    float z = 1.0 - abs(v);

    z += isContext ? 0.0 : 2.0 * float(
        outsideBoundingBox(A, B, C, D) ||
        outsideRasterMask(A, B, C, D)
    );

    return vec4(
        2.0 * (vec2(x, y) * viewBoxSize + viewBoxPos) / resolution - 1.0,
        z,
        1.0
    );
}

void main() {
    mat4 A = mat4(p01_04, p05_08, p09_12, p13_16);
    mat4 B = mat4(p17_20, p21_24, p25_28, p29_32);
    mat4 C = mat4(p33_36, p37_40, p41_44, p45_48);
    mat4 D = mat4(p49_52, p53_56, p57_60, ZEROS);

    float v = colors[3];

    gl_Position = position(isContext, v, A, B, C, D);

    fragColor =
        isContext ? vec4(contextColor) :
        isPick ? vec4(colors.rgb, 1.0) : texture2D(palette, vec2(abs(v), 0.5));
}
`]), o = n([`precision highp float;
#define GLSLIFY 1

varying vec4 fragColor;

void main() {
    gl_FragColor = fragColor;
}
`]), s = e("./constants").maxDimensionCount, i = e("../../lib"), l = new Uint8Array(4), u2 = new Uint8Array(4), c = { shape: [256, 1], format: "rgba", type: "uint8", mag: "nearest", min: "nearest" };
      function f(y, w, _4, k, T2) {
        var A2 = y._gl;
        A2.enable(A2.SCISSOR_TEST), A2.scissor(w, _4, k, T2), y.clear({ color: [0, 0, 0, 0], depth: 1 });
      }
      function h(y, w, _4, k, T2, A2) {
        var S2 = A2.key;
        _4.drawCompleted || (function(C2) {
          C2.read({ x: 0, y: 0, width: 1, height: 1, data: l });
        }(y), _4.drawCompleted = true), function C2(E2) {
          var F13 = Math.min(k, T2 - E2 * k);
          E2 === 0 && (window.cancelAnimationFrame(_4.currentRafs[S2]), delete _4.currentRafs[S2], f(y, A2.scissorX, A2.scissorY, A2.scissorWidth, A2.viewBoxSize[1])), _4.clearOnly || (A2.count = 2 * F13, A2.offset = 2 * E2 * k, w(A2), E2 * k + F13 < T2 && (_4.currentRafs[S2] = window.requestAnimationFrame(function() {
            C2(E2 + 1);
          })), _4.drawCompleted = false);
        }(0);
      }
      function p(y, w) {
        for (var _4 = new Array(256), k = 0; k < 256; k++) _4[k] = y(k / 255).concat(w);
        return _4;
      }
      function d(y, w) {
        return (y >>> 8 * w) % 256 / 255;
      }
      function v(y, w, _4) {
        for (var k = new Array(8 * w), T2 = 0, A2 = 0; A2 < w; A2++) for (var S2 = 0; S2 < 2; S2++) for (var C2 = 0; C2 < 4; C2++) {
          var E2 = 4 * y + C2, F13 = _4[64 * A2 + E2];
          E2 === 63 && S2 === 0 && (F13 *= -1), k[T2++] = F13;
        }
        return k;
      }
      function m(y) {
        var w = "0" + y;
        return w.substr(w.length - 2);
      }
      function g(y) {
        return y < s ? "p" + m(y + 1) + "_" + m(y + 4) : "colors";
      }
      function x(y, w, _4, k, T2, A2, S2, C2, E2, F13, N2, D2, I2, O2) {
        for (var L2 = [[], []], V2 = 0; V2 < 64; V2++) L2[0][V2] = V2 === T2 ? 1 : 0, L2[1][V2] = V2 === A2 ? 1 : 0;
        S2 *= O2, C2 *= O2, E2 *= O2, F13 *= O2;
        var W2 = y.lines.canvasOverdrag * O2, X2 = y.domain, Y2 = y.canvasWidth * O2, K2 = y.canvasHeight * O2, q = y.pad.l * O2, re = y.pad.b * O2, R2 = y.layoutHeight * O2, z = y.layoutWidth * O2, H2 = y.deselectedLines.color;
        return i.extendFlat({ key: N2, resolution: [Y2, K2], viewBoxPos: [S2 + W2, C2], viewBoxSize: [E2, F13], i0: T2, i1: A2, dim0A: L2[0].slice(0, 16), dim0B: L2[0].slice(16, 32), dim0C: L2[0].slice(32, 48), dim0D: L2[0].slice(48, 64), dim1A: L2[1].slice(0, 16), dim1B: L2[1].slice(16, 32), dim1C: L2[1].slice(32, 48), dim1D: L2[1].slice(48, 64), drwLayer: D2, contextColor: [H2[0] / 255, H2[1] / 255, H2[2] / 255, H2[3] < 1 ? H2[3] : Math.max(1 / 255, Math.pow(1 / y.lines.color.length, 1 / 3))], scissorX: (k === w ? 0 : S2 + W2) + (q - W2) + z * X2.x[0], scissorWidth: (k === _4 ? Y2 - S2 + W2 : E2 + 0.5) + (k === w ? S2 + W2 : 0), scissorY: C2 + re + R2 * X2.y[0], scissorHeight: F13, viewportX: q - W2 + z * X2.x[0], viewportY: re + R2 * X2.y[0], viewportWidth: Y2, viewportHeight: K2 }, I2);
      }
      function b(y) {
        var w = Math.max(0, Math.floor(2047 * y[0]), 0), _4 = Math.min(2047, Math.ceil(2047 * y[1]), 2047);
        return [Math.min(w, _4), Math.max(w, _4)];
      }
      t.exports = function(y, w) {
        var _4, k, T2, A2, S2, C2 = w.context, E2 = w.pick, F13 = w.regl, N2 = F13._gl, D2 = N2.getParameter(N2.ALIASED_LINE_WIDTH_RANGE), I2 = Math.max(D2[0], Math.min(D2[1], w.viewModel.plotGlPixelRatio)), O2 = { currentRafs: {}, drawCompleted: true, clearOnly: false }, L2 = function(K2) {
          for (var q = {}, re = 0; re <= s; re += 4) q[g(re)] = K2.buffer({ usage: "dynamic", type: "float", data: new Uint8Array(0) });
          return q;
        }(F13), V2 = F13.texture(c), W2 = [];
        Y2(w);
        var X2 = F13({ profile: false, blend: { enable: C2, func: { srcRGB: "src alpha", dstRGB: "one minus src alpha", srcAlpha: 1, dstAlpha: 1 }, equation: { rgb: "add", alpha: "add" }, color: [0, 0, 0, 0] }, depth: { enable: !C2, mask: true, func: "less", range: [0, 1] }, cull: { enable: true, face: "back" }, scissor: { enable: true, box: { x: F13.prop("scissorX"), y: F13.prop("scissorY"), width: F13.prop("scissorWidth"), height: F13.prop("scissorHeight") } }, viewport: { x: F13.prop("viewportX"), y: F13.prop("viewportY"), width: F13.prop("viewportWidth"), height: F13.prop("viewportHeight") }, dither: false, vert: a, frag: o, primitive: "lines", lineWidth: I2, attributes: L2, uniforms: { resolution: F13.prop("resolution"), viewBoxPos: F13.prop("viewBoxPos"), viewBoxSize: F13.prop("viewBoxSize"), dim0A: F13.prop("dim0A"), dim1A: F13.prop("dim1A"), dim0B: F13.prop("dim0B"), dim1B: F13.prop("dim1B"), dim0C: F13.prop("dim0C"), dim1C: F13.prop("dim1C"), dim0D: F13.prop("dim0D"), dim1D: F13.prop("dim1D"), loA: F13.prop("loA"), hiA: F13.prop("hiA"), loB: F13.prop("loB"), hiB: F13.prop("hiB"), loC: F13.prop("loC"), hiC: F13.prop("hiC"), loD: F13.prop("loD"), hiD: F13.prop("hiD"), palette: V2, contextColor: F13.prop("contextColor"), maskTexture: F13.prop("maskTexture"), drwLayer: F13.prop("drwLayer"), maskHeight: F13.prop("maskHeight") }, offset: F13.prop("offset"), count: F13.prop("count") });
        function Y2(K2) {
          _4 = K2.model, k = K2.viewModel, T2 = k.dimensions.slice(), A2 = T2[0] ? T2[0].values.length : 0;
          var q = _4.lines, re = E2 ? q.color.map(function(z, H2) {
            return H2 / q.color.length;
          }) : q.color, R2 = function(z, H2, te) {
            for (var j, Q2 = new Array(z * (s + 4)), Z2 = 0, ne = 0; ne < z; ne++) {
              for (var ae = 0; ae < s; ae++) Q2[Z2++] = ae < H2.length ? H2[ae].paddedUnitValues[ne] : 0.5;
              Q2[Z2++] = d(ne, 2), Q2[Z2++] = d(ne, 1), Q2[Z2++] = d(ne, 0), Q2[Z2++] = (j = te[ne], Math.max(1e-6, Math.min(0.999999, j)));
            }
            return Q2;
          }(A2, T2, re);
          (function(z, H2, te) {
            for (var j = 0; j <= s; j += 4) z[g(j)](v(j / 4, H2, te));
          })(L2, A2, R2), C2 || E2 || (V2 = F13.texture(i.extendFlat({ data: p(_4.unitToColor, 255) }, c)));
        }
        return { render: function(K2, q, re) {
          var R2, z, H2, te = K2.length, j = 1 / 0, Q2 = -1 / 0;
          for (R2 = 0; R2 < te; R2++) K2[R2].dim0.canvasX < j && (j = K2[R2].dim0.canvasX, z = R2), K2[R2].dim1.canvasX > Q2 && (Q2 = K2[R2].dim1.canvasX, H2 = R2);
          te === 0 && f(F13, 0, 0, _4.canvasWidth, _4.canvasHeight);
          var Z2 = function(be) {
            var Ae, pe, ve, Ee = [[], []];
            for (ve = 0; ve < 64; ve++) {
              var Se = !be && ve < T2.length ? T2[ve].brush.filter.getBounds() : [-1 / 0, 1 / 0];
              Ee[0][ve] = Se[0], Ee[1][ve] = Se[1];
            }
            var Ce = new Array(16384);
            for (Ae = 0; Ae < 16384; Ae++) Ce[Ae] = 255;
            if (!be) for (Ae = 0; Ae < T2.length; Ae++) {
              var Be = Ae % 8, Ue = (Ae - Be) / 8, Ke = Math.pow(2, Be), ct = T2[Ae].brush.filter.get();
              if (!(ct.length < 2)) {
                var We = b(ct[0])[1];
                for (pe = 1; pe < ct.length; pe++) {
                  var Ze = b(ct[pe]);
                  for (ve = We + 1; ve < Ze[0]; ve++) Ce[8 * ve + Ue] &= ~Ke;
                  We = Math.max(We, Ze[1]);
                }
              }
            }
            var it = { shape: [8, 2048], format: "alpha", type: "uint8", mag: "nearest", min: "nearest", data: Ce };
            return S2 ? S2(it) : S2 = F13.texture(it), { maskTexture: S2, maskHeight: 2048, loA: Ee[0].slice(0, 16), loB: Ee[0].slice(16, 32), loC: Ee[0].slice(32, 48), loD: Ee[0].slice(48, 64), hiA: Ee[1].slice(0, 16), hiB: Ee[1].slice(16, 32), hiC: Ee[1].slice(32, 48), hiD: Ee[1].slice(48, 64) };
          }(C2);
          for (R2 = 0; R2 < te; R2++) {
            var ne = K2[R2], ae = ne.dim0.crossfilterDimensionIndex, ue = ne.dim1.crossfilterDimensionIndex, le = ne.canvasX, ce = ne.canvasY, se = le + ne.panelSizeX, he = ne.plotGlPixelRatio;
            if (q || !W2[ae] || W2[ae][0] !== le || W2[ae][1] !== se) {
              W2[ae] = [le, se];
              var me = x(_4, z, H2, R2, ae, ue, le, ce, ne.panelSizeX, ne.panelSizeY, ne.dim0.crossfilterDimensionIndex, C2 ? 0 : E2 ? 2 : 1, Z2, he);
              O2.clearOnly = re;
              var we = q ? _4.lines.blockLineCount : A2;
              h(F13, X2, O2, we, A2, me);
            }
          }
        }, readPixel: function(K2, q) {
          return F13.read({ x: K2, y: q, width: 1, height: 1, data: u2 }), u2;
        }, readPixels: function(K2, q, re, R2) {
          var z = new Uint8Array(4 * re * R2);
          return F13.read({ x: K2, y: q, width: re, height: R2, data: z }), z;
        }, destroy: function() {
          for (var K2 in y.style["pointer-events"] = "none", V2.destroy(), S2 && S2.destroy(), L2) L2[K2].destroy();
        }, update: Y2 };
      };
    }, { "../../lib": 503, "./constants": 892, glslify: 227 }], 897: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a, o, s) {
        var i, l;
        for (s || (s = 1 / 0), i = 0; i < a.length; i++) (l = a[i]).visible && (s = Math.min(s, l[o].length));
        for (s === 1 / 0 && (s = 0), n._length = s, i = 0; i < a.length; i++) (l = a[i]).visible && (l._length = s);
        return s;
      };
    }, {}], 898: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../lib"), o = a.numberFormat, s = e("color-rgba"), i = e("../../plots/cartesian/axes"), l = a.strRotate, u2 = a.strTranslate, c = e("../../lib/svg_text_utils"), f = e("../../components/drawing"), h = e("../../components/colorscale"), p = e("../../lib/gup"), d = p.keyFun, v = p.repeat, m = p.unwrap, g = e("./helpers"), x = e("./constants"), b = e("./axisbrush"), y = e("./lines");
      function w(W2, X2, Y2) {
        return a.aggNums(W2, null, X2, Y2);
      }
      function _4(W2, X2) {
        return T2(w(Math.min, W2, X2), w(Math.max, W2, X2));
      }
      function k(W2) {
        var X2 = W2.range;
        return X2 ? T2(X2[0], X2[1]) : _4(W2.values, W2._length);
      }
      function T2(W2, X2) {
        return !isNaN(W2) && isFinite(W2) || (W2 = 0), !isNaN(X2) && isFinite(X2) || (X2 = 0), W2 === X2 && (W2 === 0 ? (W2 -= 1, X2 += 1) : (W2 *= 0.9, X2 *= 1.1)), [W2, X2];
      }
      function A2(W2, X2, Y2, K2, q) {
        var re, R2, z = k(Y2);
        return K2 ? n.scale.ordinal().domain(K2.map((re = o(Y2.tickformat), R2 = q, R2 ? function(H2, te) {
          var j = R2[te];
          return j ?? re(H2);
        } : re))).range(K2.map(function(H2) {
          var te = (H2 - z[0]) / (z[1] - z[0]);
          return W2 - X2 + te * (2 * X2 - W2);
        })) : n.scale.linear().domain(z).range([W2 - X2, X2]);
      }
      function S2(W2) {
        if (W2.tickvals) {
          var X2 = k(W2);
          return n.scale.ordinal().domain(W2.tickvals).range(W2.tickvals.map(function(Y2) {
            return (Y2 - X2[0]) / (X2[1] - X2[0]);
          }));
        }
      }
      function C2(W2) {
        var X2 = W2.map(function(q) {
          return q[0];
        }), Y2 = W2.map(function(q) {
          var re = s(q[1]);
          return n.rgb("rgb(" + re[0] + "," + re[1] + "," + re[2] + ")");
        }), K2 = "rgb".split("").map(function(q) {
          return n.scale.linear().clamp(true).domain(X2).range(Y2.map((re = q, function(R2) {
            return R2[re];
          })));
          var re;
        });
        return function(q) {
          return K2.map(function(re) {
            return re(q);
          });
        };
      }
      function E2(W2) {
        return W2.dimensions.some(function(X2) {
          return X2.brush.filterSpecified;
        });
      }
      function F13(W2, X2, Y2) {
        var K2 = m(X2), q = K2.trace, re = g.convertTypedArray(K2.lineColor), R2 = q.line, z = { color: s(x.deselectedLineColor) }, H2 = h.extractOpts(R2), te = H2.reversescale ? h.flipScale(K2.cscale) : K2.cscale, j = q.domain, Q2 = q.dimensions, Z2 = W2.width, ne = q.labelangle, ae = q.labelside, ue = q.labelfont, le = q.tickfont, ce = q.rangefont, se = a.extendDeepNoArrays({}, R2, { color: re.map(n.scale.linear().domain(k({ values: re, range: [H2.min, H2.max], _length: q._length }))), blockLineCount: x.blockLineCount, canvasOverdrag: x.overdrag * x.canvasPixelRatio }), he = Math.floor(Z2 * (j.x[1] - j.x[0])), me = Math.floor(W2.height * (j.y[1] - j.y[0])), we = W2.margin || { l: 80, r: 80, t: 100, b: 80 }, be = he, Ae = me;
        return { key: Y2, colCount: Q2.filter(g.isVisible).length, dimensions: Q2, tickDistance: x.tickDistance, unitToColor: C2(te), lines: se, deselectedLines: z, labelAngle: ne, labelSide: ae, labelFont: ue, tickFont: le, rangeFont: ce, layoutWidth: Z2, layoutHeight: W2.height, domain: j, translateX: j.x[0] * Z2, translateY: W2.height - j.y[1] * W2.height, pad: we, canvasWidth: be * x.canvasPixelRatio + 2 * se.canvasOverdrag, canvasHeight: Ae * x.canvasPixelRatio, width: be, height: Ae, canvasPixelRatio: x.canvasPixelRatio };
      }
      function N2(W2, X2, Y2) {
        var K2 = Y2.width, q = Y2.height, re = Y2.dimensions, R2 = Y2.canvasPixelRatio, z = function(Z2) {
          return K2 * Z2 / Math.max(1, Y2.colCount - 1);
        }, H2 = x.verticalPadding / q, te = function(Z2, ne) {
          return n.scale.linear().range([ne, Z2 - ne]);
        }(q, x.verticalPadding), j = { key: Y2.key, xScale: z, model: Y2, inBrushDrag: false }, Q2 = {};
        return j.dimensions = re.filter(g.isVisible).map(function(Z2, ne) {
          var ae = function(Ce, Be) {
            return n.scale.linear().domain(k(Ce)).range([Be, 1 - Be]);
          }(Z2, H2), ue = Q2[Z2.label];
          Q2[Z2.label] = (ue || 0) + 1;
          var le = Z2.label + (ue ? "__" + ue : ""), ce = Z2.constraintrange, se = ce && ce.length;
          se && !Array.isArray(ce[0]) && (ce = [ce]);
          var he = se ? ce.map(function(Ce) {
            return Ce.map(ae);
          }) : [[-1 / 0, 1 / 0]], me = Z2.values;
          me.length > Z2._length && (me = me.slice(0, Z2._length));
          var we, be = Z2.tickvals;
          function Ae(Ce, Be) {
            return { val: Ce, text: we[Be] };
          }
          function pe(Ce, Be) {
            return Ce.val - Be.val;
          }
          if (Array.isArray(be) && be.length) {
            we = Z2.ticktext, Array.isArray(we) && we.length ? we.length > be.length ? we = we.slice(0, be.length) : be.length > we.length && (be = be.slice(0, we.length)) : we = be.map(o(Z2.tickformat));
            for (var ve = 1; ve < be.length; ve++) if (be[ve] < be[ve - 1]) {
              for (var Ee = be.map(Ae).sort(pe), Se = 0; Se < be.length; Se++) be[Se] = Ee[Se].val, we[Se] = Ee[Se].text;
              break;
            }
          } else be = void 0;
          return me = g.convertTypedArray(me), { key: le, label: Z2.label, tickFormat: Z2.tickformat, tickvals: be, ticktext: we, ordinal: g.isOrdinal(Z2), multiselect: Z2.multiselect, xIndex: ne, crossfilterDimensionIndex: ne, visibleIndex: Z2._index, height: q, values: me, paddedUnitValues: me.map(ae), unitTickvals: be && be.map(ae), xScale: z, x: z(ne), canvasX: z(ne) * R2, unitToPaddedPx: te, domainScale: A2(q, x.verticalPadding, Z2, be, we), ordinalScale: S2(Z2), parent: j, model: Y2, brush: b.makeBrush(W2, se, he, function() {
            W2.linePickActive(false);
          }, function() {
            var Ce = j;
            Ce.focusLayer && Ce.focusLayer.render(Ce.panels, true);
            var Be = E2(Ce);
            !W2.contextShown() && Be ? (Ce.contextLayer && Ce.contextLayer.render(Ce.panels, true), W2.contextShown(true)) : W2.contextShown() && !Be && (Ce.contextLayer && Ce.contextLayer.render(Ce.panels, true, true), W2.contextShown(false));
          }, function(Ce) {
            if (j.focusLayer.render(j.panels, true), j.pickLayer && j.pickLayer.render(j.panels, true), W2.linePickActive(true), X2 && X2.filterChanged) {
              var Be = ae.invert, Ue = Ce.map(function(Ke) {
                return Ke.map(Be).sort(a.sorterAsc);
              }).sort(function(Ke, ct) {
                return Ke[0] - ct[0];
              });
              X2.filterChanged(j.key, Z2._index, Ue);
            }
          }) };
        }), j;
      }
      function D2(W2) {
        W2.classed(x.cn.axisExtentText, true).attr("text-anchor", "middle").style("cursor", "default");
      }
      function I2(W2, X2) {
        var Y2 = X2 === "top" ? 1 : -1, K2 = W2 * Math.PI / 180;
        return { dir: Y2, dx: Math.sin(K2), dy: Math.cos(K2), degrees: W2 };
      }
      function O2(W2, X2, Y2) {
        for (var K2 = X2.panels || (X2.panels = []), q = W2.data(), re = 0; re < q.length - 1; re++) {
          var R2 = K2[re] || (K2[re] = {}), z = q[re], H2 = q[re + 1];
          R2.dim0 = z, R2.dim1 = H2, R2.canvasX = z.canvasX, R2.panelSizeX = H2.canvasX - z.canvasX, R2.panelSizeY = X2.model.canvasHeight, R2.y = 0, R2.canvasY = 0, R2.plotGlPixelRatio = Y2;
        }
      }
      function L2(W2, X2) {
        return i.tickText(W2._ax, X2, false).text;
      }
      function V2(W2, X2) {
        if (W2.ordinal) return "";
        var Y2 = W2.domainScale.domain(), K2 = Y2[X2 ? Y2.length - 1 : 0];
        return L2(W2.model.dimensions[W2.visibleIndex], K2);
      }
      t.exports = function(W2, X2, Y2, K2) {
        var q = W2._fullLayout, re = q._toppaper, R2 = q._glcontainer, z = W2._context.plotGlPixelRatio, H2 = W2._fullLayout.paper_bgcolor;
        (function(Se) {
          for (var Ce = 0; Ce < Se.length; Ce++) for (var Be = 0; Be < Se[Ce].length; Be++) for (var Ue = Se[Ce][Be].trace, Ke = Ue.dimensions, ct = 0; ct < Ke.length; ct++) {
            var We = Ke[ct].values, Ze = Ke[ct]._ax;
            Ze && (Ze.range ? Ze.range = T2(Ze.range[0], Ze.range[1]) : Ze.range = _4(We, Ue._length), Ze.dtick || (Ze.dtick = 0.01 * (Math.abs(Ze.range[1] - Ze.range[0]) || 1)), Ze.tickformat = Ke[ct].tickformat, i.calcTicks(Ze), Ze.cleanRange());
          }
        })(X2);
        var te, j, Q2 = (te = true, j = false, { linePickActive: function(Se) {
          return arguments.length ? te = !!Se : te;
        }, contextShown: function(Se) {
          return arguments.length ? j = !!Se : j;
        } }), Z2 = X2.filter(function(Se) {
          return m(Se).trace.visible;
        }).map(F13.bind(0, Y2)).map(N2.bind(0, Q2, K2));
        R2.each(function(Se, Ce) {
          return a.extendFlat(Se, Z2[Ce]);
        });
        var ne = R2.selectAll(".gl-canvas").each(function(Se) {
          Se.viewModel = Z2[0], Se.viewModel.plotGlPixelRatio = z, Se.viewModel.paperColor = H2, Se.model = Se.viewModel ? Se.viewModel.model : null;
        }), ae = null;
        ne.filter(function(Se) {
          return Se.pick;
        }).style("pointer-events", "auto").on("mousemove", function(Se) {
          if (Q2.linePickActive() && Se.lineLayer && K2 && K2.hover) {
            var Ce = n.event, Be = this.width, Ue = this.height, Ke = n.mouse(this), ct = Ke[0], We = Ke[1];
            if (ct < 0 || We < 0 || ct >= Be || We >= Ue) return;
            var Ze = Se.lineLayer.readPixel(ct, Ue - 1 - We), it = Ze[3] !== 0, ot = it ? Ze[2] + 256 * (Ze[1] + 256 * Ze[0]) : null, mt = { x: ct, y: We, clientX: Ce.clientX, clientY: Ce.clientY, dataIndex: Se.model.key, curveNumber: ot };
            ot !== ae && (it ? K2.hover(mt) : K2.unhover && K2.unhover(mt), ae = ot);
          }
        }), ne.style("opacity", function(Se) {
          return Se.pick ? 0 : 1;
        }), re.style("background", "rgba(255, 255, 255, 0)");
        var ue = re.selectAll("." + x.cn.parcoords).data(Z2, d);
        ue.exit().remove(), ue.enter().append("g").classed(x.cn.parcoords, true).style("shape-rendering", "crispEdges").style("pointer-events", "none"), ue.attr("transform", function(Se) {
          return u2(Se.model.translateX, Se.model.translateY);
        });
        var le = ue.selectAll("." + x.cn.parcoordsControlView).data(v, d);
        le.enter().append("g").classed(x.cn.parcoordsControlView, true), le.attr("transform", function(Se) {
          return u2(Se.model.pad.l, Se.model.pad.t);
        });
        var ce = le.selectAll("." + x.cn.yAxis).data(function(Se) {
          return Se.dimensions;
        }, d);
        ce.enter().append("g").classed(x.cn.yAxis, true), le.each(function(Se) {
          O2(ce, Se, z);
        }), ne.each(function(Se) {
          if (Se.viewModel) {
            !Se.lineLayer || K2 ? Se.lineLayer = y(this, Se) : Se.lineLayer.update(Se), (Se.key || Se.key === 0) && (Se.viewModel[Se.key] = Se.lineLayer);
            var Ce = !Se.context || K2;
            Se.lineLayer.render(Se.viewModel.panels, Ce);
          }
        }), ce.attr("transform", function(Se) {
          return u2(Se.xScale(Se.xIndex), 0);
        }), ce.call(n.behavior.drag().origin(function(Se) {
          return Se;
        }).on("drag", function(Se) {
          var Ce = Se.parent;
          Q2.linePickActive(false), Se.x = Math.max(-x.overdrag, Math.min(Se.model.width + x.overdrag, n.event.x)), Se.canvasX = Se.x * Se.model.canvasPixelRatio, ce.sort(function(Be, Ue) {
            return Be.x - Ue.x;
          }).each(function(Be, Ue) {
            Be.xIndex = Ue, Be.x = Se === Be ? Be.x : Be.xScale(Be.xIndex), Be.canvasX = Be.x * Be.model.canvasPixelRatio;
          }), O2(ce, Ce, z), ce.filter(function(Be) {
            return Math.abs(Se.xIndex - Be.xIndex) !== 0;
          }).attr("transform", function(Be) {
            return u2(Be.xScale(Be.xIndex), 0);
          }), n.select(this).attr("transform", u2(Se.x, 0)), ce.each(function(Be, Ue, Ke) {
            Ke === Se.parent.key && (Ce.dimensions[Ue] = Be);
          }), Ce.contextLayer && Ce.contextLayer.render(Ce.panels, false, !E2(Ce)), Ce.focusLayer.render && Ce.focusLayer.render(Ce.panels);
        }).on("dragend", function(Se) {
          var Ce = Se.parent;
          Se.x = Se.xScale(Se.xIndex), Se.canvasX = Se.x * Se.model.canvasPixelRatio, O2(ce, Ce, z), n.select(this).attr("transform", function(Be) {
            return u2(Be.x, 0);
          }), Ce.contextLayer && Ce.contextLayer.render(Ce.panels, false, !E2(Ce)), Ce.focusLayer && Ce.focusLayer.render(Ce.panels), Ce.pickLayer && Ce.pickLayer.render(Ce.panels, true), Q2.linePickActive(true), K2 && K2.axesMoved && K2.axesMoved(Ce.key, Ce.dimensions.map(function(Be) {
            return Be.crossfilterDimensionIndex;
          }));
        })), ce.exit().remove();
        var se = ce.selectAll("." + x.cn.axisOverlays).data(v, d);
        se.enter().append("g").classed(x.cn.axisOverlays, true), se.selectAll("." + x.cn.axis).remove();
        var he = se.selectAll("." + x.cn.axis).data(v, d);
        he.enter().append("g").classed(x.cn.axis, true), he.each(function(Se) {
          var Ce = Se.model.height / Se.model.tickDistance, Be = Se.domainScale, Ue = Be.domain();
          n.select(this).call(n.svg.axis().orient("left").tickSize(4).outerTickSize(2).ticks(Ce, Se.tickFormat).tickValues(Se.ordinal ? Ue : null).tickFormat(function(Ke) {
            return g.isOrdinal(Se) ? Ke : L2(Se.model.dimensions[Se.visibleIndex], Ke);
          }).scale(Be)), f.font(he.selectAll("text"), Se.model.tickFont);
        }), he.selectAll(".domain, .tick>line").attr("fill", "none").attr("stroke", "black").attr("stroke-opacity", 0.25).attr("stroke-width", "1px"), he.selectAll("text").style("text-shadow", c.makeTextShadow(H2)).style("cursor", "default");
        var me = se.selectAll("." + x.cn.axisHeading).data(v, d);
        me.enter().append("g").classed(x.cn.axisHeading, true);
        var we = me.selectAll("." + x.cn.axisTitle).data(v, d);
        we.enter().append("text").classed(x.cn.axisTitle, true).attr("text-anchor", "middle").style("cursor", "ew-resize").style("pointer-events", "auto"), we.text(function(Se) {
          return Se.label;
        }).each(function(Se) {
          var Ce = n.select(this);
          f.font(Ce, Se.model.labelFont), c.convertToTspans(Ce, W2);
        }).attr("transform", function(Se) {
          var Ce = I2(Se.model.labelAngle, Se.model.labelSide), Be = x.axisTitleOffset;
          return (Ce.dir > 0 ? "" : u2(0, 2 * Be + Se.model.height)) + l(Ce.degrees) + u2(-Be * Ce.dx, -Be * Ce.dy);
        }).attr("text-anchor", function(Se) {
          var Ce = I2(Se.model.labelAngle, Se.model.labelSide);
          return 2 * Math.abs(Ce.dx) > Math.abs(Ce.dy) ? Ce.dir * Ce.dx < 0 ? "start" : "end" : "middle";
        });
        var be = se.selectAll("." + x.cn.axisExtent).data(v, d);
        be.enter().append("g").classed(x.cn.axisExtent, true);
        var Ae = be.selectAll("." + x.cn.axisExtentTop).data(v, d);
        Ae.enter().append("g").classed(x.cn.axisExtentTop, true), Ae.attr("transform", u2(0, -x.axisExtentOffset));
        var pe = Ae.selectAll("." + x.cn.axisExtentTopText).data(v, d);
        pe.enter().append("text").classed(x.cn.axisExtentTopText, true).call(D2), pe.text(function(Se) {
          return V2(Se, true);
        }).each(function(Se) {
          f.font(n.select(this), Se.model.rangeFont);
        });
        var ve = be.selectAll("." + x.cn.axisExtentBottom).data(v, d);
        ve.enter().append("g").classed(x.cn.axisExtentBottom, true), ve.attr("transform", function(Se) {
          return u2(0, Se.model.height + x.axisExtentOffset);
        });
        var Ee = ve.selectAll("." + x.cn.axisExtentBottomText).data(v, d);
        Ee.enter().append("text").classed(x.cn.axisExtentBottomText, true).attr("dy", "0.75em").call(D2), Ee.text(function(Se) {
          return V2(Se, false);
        }).each(function(Se) {
          f.font(n.select(this), Se.model.rangeFont);
        }), b.ensureAxisBrush(se, H2);
      };
    }, { "../../components/colorscale": 378, "../../components/drawing": 388, "../../lib": 503, "../../lib/gup": 500, "../../lib/svg_text_utils": 529, "../../plots/cartesian/axes": 554, "./axisbrush": 889, "./constants": 892, "./helpers": 894, "./lines": 896, "@plotly/d3": 58, "color-rgba": 91 }], 899: [function(e, t, r) {
      "use strict";
      var n = e("./parcoords"), a = e("../../lib/prepare_regl"), o = e("./helpers").isVisible;
      function s(i, l, u2) {
        var c = l.indexOf(u2), f = i.indexOf(c);
        return f === -1 && (f += l.length), f;
      }
      t.exports = function(i, l) {
        var u2 = i._fullLayout;
        if (a(i)) {
          var c = {}, f = {}, h = {}, p = {}, d = u2._size;
          l.forEach(function(v, m) {
            var g = v[0].trace;
            h[m] = g.index;
            var x = p[m] = g._fullInput.index;
            c[m] = i.data[x].dimensions, f[m] = i.data[x].dimensions.slice();
          }), n(i, l, { width: d.w, height: d.h, margin: { t: d.t, r: d.r, b: d.b, l: d.l } }, { filterChanged: function(v, m, g) {
            var x = f[v][m], b = g.map(function(A2) {
              return A2.slice();
            }), y = "dimensions[" + m + "].constraintrange", w = u2._tracePreGUI[i._fullData[h[v]]._fullInput.uid];
            if (w[y] === void 0) {
              var _4 = x.constraintrange;
              w[y] = _4 || null;
            }
            var k = i._fullData[h[v]].dimensions[m];
            b.length ? (b.length === 1 && (b = b[0]), x.constraintrange = b, k.constraintrange = b.slice(), b = [b]) : (delete x.constraintrange, delete k.constraintrange, b = null);
            var T2 = {};
            T2[y] = b, i.emit("plotly_restyle", [T2, [p[v]]]);
          }, hover: function(v) {
            i.emit("plotly_hover", v);
          }, unhover: function(v) {
            i.emit("plotly_unhover", v);
          }, axesMoved: function(v, m) {
            var g = /* @__PURE__ */ function(x, b) {
              return function(y, w) {
                return s(x, b, y) - s(x, b, w);
              };
            }(m, f[v].filter(o));
            c[v].sort(g), f[v].filter(function(x) {
              return !o(x);
            }).sort(function(x) {
              return f[v].indexOf(x);
            }).forEach(function(x) {
              c[v].splice(c[v].indexOf(x), 1), c[v].splice(f[v].indexOf(x), 0, x);
            }), i.emit("plotly_restyle", [{ dimensions: [c[v]] }, [p[v]]]);
          } });
        }
      };
    }, { "../../lib/prepare_regl": 516, "./helpers": 894, "./parcoords": 898 }], 900: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/attributes"), a = e("../../plots/domain").attributes, o = e("../../plots/font_attributes"), s = e("../../components/color/attributes"), i = e("../../plots/template_attributes").hovertemplateAttrs, l = e("../../plots/template_attributes").texttemplateAttrs, u2 = e("../../lib/extend").extendFlat, c = o({ editType: "plot", arrayOk: true, colorEditType: "plot" });
      t.exports = { labels: { valType: "data_array", editType: "calc" }, label0: { valType: "number", dflt: 0, editType: "calc" }, dlabel: { valType: "number", dflt: 1, editType: "calc" }, values: { valType: "data_array", editType: "calc" }, marker: { colors: { valType: "data_array", editType: "calc" }, line: { color: { valType: "color", dflt: s.defaultLine, arrayOk: true, editType: "style" }, width: { valType: "number", min: 0, dflt: 0, arrayOk: true, editType: "style" }, editType: "calc" }, editType: "calc" }, text: { valType: "data_array", editType: "plot" }, hovertext: { valType: "string", dflt: "", arrayOk: true, editType: "style" }, scalegroup: { valType: "string", dflt: "", editType: "calc" }, textinfo: { valType: "flaglist", flags: ["label", "text", "value", "percent"], extras: ["none"], editType: "calc" }, hoverinfo: u2({}, n.hoverinfo, { flags: ["label", "text", "value", "percent", "name"] }), hovertemplate: i({}, { keys: ["label", "color", "value", "percent", "text"] }), texttemplate: l({ editType: "plot" }, { keys: ["label", "color", "value", "percent", "text"] }), textposition: { valType: "enumerated", values: ["inside", "outside", "auto", "none"], dflt: "auto", arrayOk: true, editType: "plot" }, textfont: u2({}, c, {}), insidetextorientation: { valType: "enumerated", values: ["horizontal", "radial", "tangential", "auto"], dflt: "auto", editType: "plot" }, insidetextfont: u2({}, c, {}), outsidetextfont: u2({}, c, {}), automargin: { valType: "boolean", dflt: false, editType: "plot" }, title: { text: { valType: "string", dflt: "", editType: "plot" }, font: u2({}, c, {}), position: { valType: "enumerated", values: ["top left", "top center", "top right", "middle center", "bottom left", "bottom center", "bottom right"], editType: "plot" }, editType: "plot" }, domain: a({ name: "pie", trace: true, editType: "calc" }), hole: { valType: "number", min: 0, max: 1, dflt: 0, editType: "calc" }, sort: { valType: "boolean", dflt: true, editType: "calc" }, direction: { valType: "enumerated", values: ["clockwise", "counterclockwise"], dflt: "counterclockwise", editType: "calc" }, rotation: { valType: "number", min: -360, max: 360, dflt: 0, editType: "calc" }, pull: { valType: "number", min: 0, max: 1, dflt: 0, arrayOk: true, editType: "calc" }, _deprecated: { title: { valType: "string", dflt: "", editType: "calc" }, titlefont: u2({}, c, {}), titleposition: { valType: "enumerated", values: ["top left", "top center", "top right", "middle center", "bottom left", "bottom center", "bottom right"], editType: "calc" } } };
    }, { "../../components/color/attributes": 365, "../../lib/extend": 493, "../../plots/attributes": 550, "../../plots/domain": 584, "../../plots/font_attributes": 585, "../../plots/template_attributes": 633 }], 901: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/plots");
      r.name = "pie", r.plot = function(a, o, s, i) {
        n.plotBasePlot(r.name, a, o, s, i);
      }, r.clean = function(a, o, s, i) {
        n.cleanBasePlot(r.name, a, o, s, i);
      };
    }, { "../../plots/plots": 619 }], 902: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("tinycolor2"), o = e("../../components/color"), s = {};
      function i(u2) {
        return function(c, f) {
          return !!c && !!(c = a(c)).isValid() && (c = o.addOpacity(c, c.getAlpha()), u2[f] || (u2[f] = c), c);
        };
      }
      function l(u2, c) {
        var f, h = JSON.stringify(u2), p = c[h];
        if (!p) {
          for (p = u2.slice(), f = 0; f < u2.length; f++) p.push(a(u2[f]).lighten(20).toHexString());
          for (f = 0; f < u2.length; f++) p.push(a(u2[f]).darken(20).toHexString());
          c[h] = p;
        }
        return p;
      }
      t.exports = { calc: function(u2, c) {
        var f, h, p = [], d = u2._fullLayout, v = d.hiddenlabels || [], m = c.labels, g = c.marker.colors || [], x = c.values, b = c._length, y = c._hasValues && b;
        if (c.dlabel) for (m = new Array(b), f = 0; f < b; f++) m[f] = String(c.label0 + f * c.dlabel);
        var w = {}, _4 = i(d["_" + c.type + "colormap"]), k = 0, T2 = false;
        for (f = 0; f < b; f++) {
          var A2, S2, C2;
          if (y) {
            if (A2 = x[f], !n(A2)) continue;
            A2 = +A2;
          } else A2 = 1;
          (S2 = m[f]) !== void 0 && S2 !== "" || (S2 = f);
          var E2 = w[S2 = String(S2)];
          E2 === void 0 ? (w[S2] = p.length, (C2 = v.indexOf(S2) !== -1) || (k += A2), p.push({ v: A2, label: S2, color: _4(g[f], S2), i: f, pts: [f], hidden: C2 })) : (T2 = true, (h = p[E2]).v += A2, h.pts.push(f), h.hidden || (k += A2), h.color === false && g[f] && (h.color = _4(g[f], S2)));
        }
        return p = p.filter(function(F13) {
          return F13.v >= 0;
        }), (c.type === "funnelarea" ? T2 : c.sort) && p.sort(function(F13, N2) {
          return N2.v - F13.v;
        }), p[0] && (p[0].vTotal = k), p;
      }, crossTraceCalc: function(u2, c) {
        var f = (c || {}).type;
        f || (f = "pie");
        var h = u2._fullLayout, p = u2.calcdata, d = h[f + "colorway"], v = h["_" + f + "colormap"];
        h["extend" + f + "colors"] && (d = l(d, s));
        for (var m = 0, g = 0; g < p.length; g++) {
          var x = p[g];
          if (x[0].trace.type === f) for (var b = 0; b < x.length; b++) {
            var y = x[b];
            y.color === false && (v[y.label] ? y.color = v[y.label] : (v[y.label] = y.color = d[m % d.length], m++));
          }
        }
      }, makePullColorFn: i, generateExtendedColors: l };
    }, { "../../components/color": 366, "fast-isnumeric": 190, tinycolor2: 312 }], 903: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("../../lib"), o = e("./attributes"), s = e("../../plots/domain").defaults, i = e("../bar/defaults").handleText;
      function l(u2, c) {
        var f = Array.isArray(u2), h = a.isArrayOrTypedArray(c), p = Math.min(f ? u2.length : 1 / 0, h ? c.length : 1 / 0);
        if (isFinite(p) || (p = 0), p && h) {
          for (var d, v = 0; v < p; v++) {
            var m = c[v];
            if (n(m) && m > 0) {
              d = true;
              break;
            }
          }
          d || (p = 0);
        }
        return { hasLabels: f, hasValues: h, len: p };
      }
      t.exports = { handleLabelsAndValues: l, supplyDefaults: function(u2, c, f, h) {
        function p(_4, k) {
          return a.coerce(u2, c, o, _4, k);
        }
        var d = l(p("labels"), p("values")), v = d.len;
        if (c._hasLabels = d.hasLabels, c._hasValues = d.hasValues, !c._hasLabels && c._hasValues && (p("label0"), p("dlabel")), v) {
          c._length = v, p("marker.line.width") && p("marker.line.color"), p("marker.colors"), p("scalegroup");
          var m, g = p("text"), x = p("texttemplate");
          if (x || (m = p("textinfo", Array.isArray(g) ? "text+percent" : "percent")), p("hovertext"), p("hovertemplate"), x || m && m !== "none") {
            var b = p("textposition");
            i(u2, c, h, p, b, { moduleHasSelected: false, moduleHasUnselected: false, moduleHasConstrain: false, moduleHasCliponaxis: false, moduleHasTextangle: false, moduleHasInsideanchor: false }), (Array.isArray(b) || b === "auto" || b === "outside") && p("automargin"), (b === "inside" || b === "auto" || Array.isArray(b)) && p("insidetextorientation");
          }
          s(c, h, p);
          var y = p("hole");
          if (p("title.text")) {
            var w = p("title.position", y ? "middle center" : "top center");
            y || w !== "middle center" || (c.title.position = "top center"), a.coerceFont(p, "title.font", h.font);
          }
          p("sort"), p("direction"), p("rotation"), p("pull");
        } else c.visible = false;
      } };
    }, { "../../lib": 503, "../../plots/domain": 584, "../bar/defaults": 652, "./attributes": 900, "fast-isnumeric": 190 }], 904: [function(e, t, r) {
      "use strict";
      var n = e("../../components/fx/helpers").appendArrayMultiPointValues;
      t.exports = function(a, o) {
        var s = { curveNumber: o.index, pointNumbers: a.pts, data: o._input, fullData: o, label: a.label, color: a.color, value: a.v, percent: a.percent, text: a.text, bbox: a.bbox, v: a.v };
        return a.pts.length === 1 && (s.pointNumber = s.i = a.pts[0]), n(s, o, a.pts), o.type === "funnelarea" && (delete s.v, delete s.i), s;
      };
    }, { "../../components/fx/helpers": 402 }], 905: [function(e, t, r) {
      "use strict";
      var n = e("../../lib");
      function a(o) {
        return o.indexOf("e") !== -1 ? o.replace(/[.]?0+e/, "e") : o.indexOf(".") !== -1 ? o.replace(/[.]?0+$/, "") : o;
      }
      r.formatPiePercent = function(o, s) {
        var i = a((100 * o).toPrecision(3));
        return n.numSeparate(i, s) + "%";
      }, r.formatPieValue = function(o, s) {
        var i = a(o.toPrecision(10));
        return n.numSeparate(i, s);
      }, r.getFirstFilled = function(o, s) {
        if (Array.isArray(o)) for (var i = 0; i < s.length; i++) {
          var l = o[s[i]];
          if (l || l === 0 || l === "") return l;
        }
      }, r.castOption = function(o, s) {
        return Array.isArray(o) ? r.getFirstFilled(o, s) : o || void 0;
      }, r.getRotationAngle = function(o) {
        return (o === "auto" ? 0 : o) * Math.PI / 180;
      };
    }, { "../../lib": 503 }], 906: [function(e, t, r) {
      "use strict";
      t.exports = { attributes: e("./attributes"), supplyDefaults: e("./defaults").supplyDefaults, supplyLayoutDefaults: e("./layout_defaults"), layoutAttributes: e("./layout_attributes"), calc: e("./calc").calc, crossTraceCalc: e("./calc").crossTraceCalc, plot: e("./plot").plot, style: e("./style"), styleOne: e("./style_one"), moduleType: "trace", name: "pie", basePlotModule: e("./base_plot"), categories: ["pie-like", "pie", "showLegend"], meta: {} };
    }, { "./attributes": 900, "./base_plot": 901, "./calc": 902, "./defaults": 903, "./layout_attributes": 907, "./layout_defaults": 908, "./plot": 909, "./style": 910, "./style_one": 911 }], 907: [function(e, t, r) {
      "use strict";
      t.exports = { hiddenlabels: { valType: "data_array", editType: "calc" }, piecolorway: { valType: "colorlist", editType: "calc" }, extendpiecolors: { valType: "boolean", dflt: true, editType: "calc" } };
    }, {}], 908: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("./layout_attributes");
      t.exports = function(o, s) {
        function i(l, u2) {
          return n.coerce(o, s, a, l, u2);
        }
        i("hiddenlabels"), i("piecolorway", s.colorway), i("extendpiecolors");
      };
    }, { "../../lib": 503, "./layout_attributes": 907 }], 909: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../plots/plots"), o = e("../../components/fx"), s = e("../../components/color"), i = e("../../components/drawing"), l = e("../../lib"), u2 = l.strScale, c = l.strTranslate, f = e("../../lib/svg_text_utils"), h = e("../bar/uniform_text"), p = h.recordMinTextSize, d = h.clearMinTextSize, v = e("../bar/constants").TEXTPAD, m = e("./helpers"), g = e("./event_data"), x = e("../../lib").isValidTextValue;
      function b(X2, Y2, K2) {
        var q = K2[0], re = q.cx, R2 = q.cy, z = q.trace, H2 = z.type === "funnelarea";
        "_hasHoverLabel" in z || (z._hasHoverLabel = false), "_hasHoverEvent" in z || (z._hasHoverEvent = false), X2.on("mouseover", function(te) {
          var j = Y2._fullLayout, Q2 = Y2._fullData[z.index];
          if (!Y2._dragging && j.hovermode !== false) {
            var Z2 = Q2.hoverinfo;
            if (Array.isArray(Z2) && (Z2 = o.castHoverinfo({ hoverinfo: [m.castOption(Z2, te.pts)], _module: z._module }, j, 0)), Z2 === "all" && (Z2 = "label+text+value+percent+name"), Q2.hovertemplate || Z2 !== "none" && Z2 !== "skip" && Z2) {
              var ne = te.rInscribed || 0, ae = re + te.pxmid[0] * (1 - ne), ue = R2 + te.pxmid[1] * (1 - ne), le = j.separators, ce = [];
              if (Z2 && Z2.indexOf("label") !== -1 && ce.push(te.label), te.text = m.castOption(Q2.hovertext || Q2.text, te.pts), Z2 && Z2.indexOf("text") !== -1) {
                var se = te.text;
                l.isValidTextValue(se) && ce.push(se);
              }
              te.value = te.v, te.valueLabel = m.formatPieValue(te.v, le), Z2 && Z2.indexOf("value") !== -1 && ce.push(te.valueLabel), te.percent = te.v / q.vTotal, te.percentLabel = m.formatPiePercent(te.percent, le), Z2 && Z2.indexOf("percent") !== -1 && ce.push(te.percentLabel);
              var he = Q2.hoverlabel, me = he.font, we = [];
              o.loneHover({ trace: z, x0: ae - ne * q.r, x1: ae + ne * q.r, y: ue, _x0: H2 ? re + te.TL[0] : ae - ne * q.r, _x1: H2 ? re + te.TR[0] : ae + ne * q.r, _y0: H2 ? R2 + te.TL[1] : ue - ne * q.r, _y1: H2 ? R2 + te.BL[1] : ue + ne * q.r, text: ce.join("<br>"), name: Q2.hovertemplate || Z2.indexOf("name") !== -1 ? Q2.name : void 0, idealAlign: te.pxmid[0] < 0 ? "left" : "right", color: m.castOption(he.bgcolor, te.pts) || te.color, borderColor: m.castOption(he.bordercolor, te.pts), fontFamily: m.castOption(me.family, te.pts), fontSize: m.castOption(me.size, te.pts), fontColor: m.castOption(me.color, te.pts), nameLength: m.castOption(he.namelength, te.pts), textAlign: m.castOption(he.align, te.pts), hovertemplate: m.castOption(Q2.hovertemplate, te.pts), hovertemplateLabels: te, eventData: [g(te, Q2)] }, { container: j._hoverlayer.node(), outerContainer: j._paper.node(), gd: Y2, inOut_bbox: we }), te.bbox = we[0], z._hasHoverLabel = true;
            }
            z._hasHoverEvent = true, Y2.emit("plotly_hover", { points: [g(te, Q2)], event: n.event });
          }
        }), X2.on("mouseout", function(te) {
          var j = Y2._fullLayout, Q2 = Y2._fullData[z.index], Z2 = n.select(this).datum();
          z._hasHoverEvent && (te.originalEvent = n.event, Y2.emit("plotly_unhover", { points: [g(Z2, Q2)], event: n.event }), z._hasHoverEvent = false), z._hasHoverLabel && (o.loneUnhover(j._hoverlayer.node()), z._hasHoverLabel = false);
        }), X2.on("click", function(te) {
          var j = Y2._fullLayout, Q2 = Y2._fullData[z.index];
          Y2._dragging || j.hovermode === false || (Y2._hoverdata = [g(te, Q2)], o.click(Y2, n.event));
        });
      }
      function y(X2, Y2, K2) {
        var q = m.castOption(X2.insidetextfont.color, Y2.pts);
        !q && X2._input.textfont && (q = m.castOption(X2._input.textfont.color, Y2.pts));
        var re = m.castOption(X2.insidetextfont.family, Y2.pts) || m.castOption(X2.textfont.family, Y2.pts) || K2.family, R2 = m.castOption(X2.insidetextfont.size, Y2.pts) || m.castOption(X2.textfont.size, Y2.pts) || K2.size;
        return { color: q || s.contrast(Y2.color), family: re, size: R2 };
      }
      function w(X2, Y2) {
        for (var K2, q, re = 0; re < X2.length; re++) if ((q = (K2 = X2[re][0]).trace).title.text) {
          var R2 = q.title.text;
          q._meta && (R2 = l.templateString(R2, q._meta));
          var z = i.tester.append("text").attr("data-notex", 1).text(R2).call(i.font, q.title.font).call(f.convertToTspans, Y2), H2 = i.bBox(z.node(), true);
          K2.titleBox = { width: H2.width, height: H2.height }, z.remove();
        }
      }
      function _4(X2, Y2, K2) {
        var q = K2.r || Y2.rpx1, re = Y2.rInscribed;
        if (Y2.startangle === Y2.stopangle) return { rCenter: 1 - re, scale: 0, rotate: 0, textPosAngle: 0 };
        var R2, z = Y2.ring, H2 = z === 1 && Math.abs(Y2.startangle - Y2.stopangle) === 2 * Math.PI, te = Y2.halfangle, j = Y2.midangle, Q2 = K2.trace.insidetextorientation, Z2 = Q2 === "horizontal", ne = Q2 === "tangential", ae = Q2 === "radial", ue = Q2 === "auto", le = [];
        if (!ue) {
          var ce, se = function(pe, ve) {
            if (function(Be, Ue) {
              var Ke = Be.startangle, ct = Be.stopangle;
              return Ke > Ue && Ue > ct || Ke < Ue && Ue < ct;
            }(Y2, pe)) {
              var Ee = Math.abs(pe - Y2.startangle), Se = Math.abs(pe - Y2.stopangle), Ce = Ee < Se ? Ee : Se;
              (R2 = ve === "tan" ? T2(X2, q, z, Ce, 0) : k(X2, q, z, Ce, Math.PI / 2)).textPosAngle = pe, le.push(R2);
            }
          };
          if (Z2 || ne) {
            for (ce = 4; ce >= -4; ce -= 2) se(Math.PI * ce, "tan");
            for (ce = 4; ce >= -4; ce -= 2) se(Math.PI * (ce + 1), "tan");
          }
          if (Z2 || ae) {
            for (ce = 4; ce >= -4; ce -= 2) se(Math.PI * (ce + 1.5), "rad");
            for (ce = 4; ce >= -4; ce -= 2) se(Math.PI * (ce + 0.5), "rad");
          }
        }
        if (H2 || ue || Z2) {
          var he = Math.sqrt(X2.width * X2.width + X2.height * X2.height);
          if ((R2 = { scale: re * q * 2 / he, rCenter: 1 - re, rotate: 0 }).textPosAngle = (Y2.startangle + Y2.stopangle) / 2, R2.scale >= 1) return R2;
          le.push(R2);
        }
        (ue || ae) && ((R2 = k(X2, q, z, te, j)).textPosAngle = (Y2.startangle + Y2.stopangle) / 2, le.push(R2)), (ue || ne) && ((R2 = T2(X2, q, z, te, j)).textPosAngle = (Y2.startangle + Y2.stopangle) / 2, le.push(R2));
        for (var me = 0, we = 0, be = 0; be < le.length; be++) {
          var Ae = le[be].scale;
          if (we < Ae && (we = Ae, me = be), !ue && we >= 1) break;
        }
        return le[me];
      }
      function k(X2, Y2, K2, q, re) {
        Y2 = Math.max(0, Y2 - 2 * v);
        var R2 = X2.width / X2.height, z = C2(R2, q, Y2, K2);
        return { scale: 2 * z / X2.height, rCenter: A2(R2, z / Y2), rotate: S2(re) };
      }
      function T2(X2, Y2, K2, q, re) {
        Y2 = Math.max(0, Y2 - 2 * v);
        var R2 = X2.height / X2.width, z = C2(R2, q, Y2, K2);
        return { scale: 2 * z / X2.width, rCenter: A2(R2, z / Y2), rotate: S2(re + Math.PI / 2) };
      }
      function A2(X2, Y2) {
        return Math.cos(Y2) - X2 * Y2;
      }
      function S2(X2) {
        return (180 / Math.PI * X2 + 720) % 180 - 90;
      }
      function C2(X2, Y2, K2, q) {
        var re = X2 + 1 / (2 * Math.tan(Y2));
        return K2 * Math.min(1 / (Math.sqrt(re * re + 0.5) + re), q / (Math.sqrt(X2 * X2 + q / 2) + X2));
      }
      function E2(X2, Y2) {
        return X2.v !== Y2.vTotal || Y2.trace.hole ? Math.min(1 / (1 + 1 / Math.sin(X2.halfangle)), X2.ring / 2) : 1;
      }
      function F13(X2, Y2) {
        var K2 = Y2.pxmid[0], q = Y2.pxmid[1], re = X2.width / 2, R2 = X2.height / 2;
        return K2 < 0 && (re *= -1), q < 0 && (R2 *= -1), { scale: 1, rCenter: 1, rotate: 0, x: re + Math.abs(R2) * (re > 0 ? 1 : -1) / 2, y: R2 / (1 + K2 * K2 / (q * q)), outside: true };
      }
      function N2(X2, Y2) {
        var K2, q, re, R2 = X2.trace, z = { x: X2.cx, y: X2.cy }, H2 = { tx: 0, ty: 0 };
        H2.ty += R2.title.font.size, re = I2(R2), R2.title.position.indexOf("top") !== -1 ? (z.y -= (1 + re) * X2.r, H2.ty -= X2.titleBox.height) : R2.title.position.indexOf("bottom") !== -1 && (z.y += (1 + re) * X2.r);
        var te, j, Q2 = (te = X2.r, j = X2.trace.aspectratio, te / (j === void 0 ? 1 : j)), Z2 = Y2.w * (R2.domain.x[1] - R2.domain.x[0]) / 2;
        return R2.title.position.indexOf("left") !== -1 ? (Z2 += Q2, z.x -= (1 + re) * Q2, H2.tx += X2.titleBox.width / 2) : R2.title.position.indexOf("center") !== -1 ? Z2 *= 2 : R2.title.position.indexOf("right") !== -1 && (Z2 += Q2, z.x += (1 + re) * Q2, H2.tx -= X2.titleBox.width / 2), K2 = Z2 / X2.titleBox.width, q = D2(X2, Y2) / X2.titleBox.height, { x: z.x, y: z.y, scale: Math.min(K2, q), tx: H2.tx, ty: H2.ty };
      }
      function D2(X2, Y2) {
        var K2 = X2.trace, q = Y2.h * (K2.domain.y[1] - K2.domain.y[0]);
        return Math.min(X2.titleBox.height, q / 2);
      }
      function I2(X2) {
        var Y2, K2 = X2.pull;
        if (!K2) return 0;
        if (Array.isArray(K2)) for (K2 = 0, Y2 = 0; Y2 < X2.pull.length; Y2++) X2.pull[Y2] > K2 && (K2 = X2.pull[Y2]);
        return K2;
      }
      function O2(X2, Y2) {
        for (var K2 = [], q = 0; q < X2.length; q++) {
          var re = X2[q][0], R2 = re.trace, z = R2.domain, H2 = Y2.w * (z.x[1] - z.x[0]), te = Y2.h * (z.y[1] - z.y[0]);
          R2.title.text && R2.title.position !== "middle center" && (te -= D2(re, Y2));
          var j = H2 / 2, Q2 = te / 2;
          R2.type !== "funnelarea" || R2.scalegroup || (Q2 /= R2.aspectratio), re.r = Math.min(j, Q2) / (1 + I2(R2)), re.cx = Y2.l + Y2.w * (R2.domain.x[1] + R2.domain.x[0]) / 2, re.cy = Y2.t + Y2.h * (1 - R2.domain.y[0]) - te / 2, R2.title.text && R2.title.position.indexOf("bottom") !== -1 && (re.cy -= D2(re, Y2)), R2.scalegroup && K2.indexOf(R2.scalegroup) === -1 && K2.push(R2.scalegroup);
        }
        (function(Z2, ne) {
          for (var ae, ue, le, ce = 0; ce < ne.length; ce++) {
            var se = 1 / 0, he = ne[ce];
            for (ue = 0; ue < Z2.length; ue++) if (ae = Z2[ue][0], (le = ae.trace).scalegroup === he) {
              var me;
              if (le.type === "pie") me = ae.r * ae.r;
              else if (le.type === "funnelarea") {
                var we, be;
                le.aspectratio > 1 ? (we = ae.r, be = we / le.aspectratio) : (be = ae.r, we = be * le.aspectratio), we *= (1 + le.baseratio) / 2, me = we * be;
              }
              se = Math.min(se, me / ae.vTotal);
            }
            for (ue = 0; ue < Z2.length; ue++) if (ae = Z2[ue][0], (le = ae.trace).scalegroup === he) {
              var Ae = se * ae.vTotal;
              le.type === "funnelarea" && (Ae /= (1 + le.baseratio) / 2, Ae /= le.aspectratio), ae.r = Math.sqrt(Ae);
            }
          }
        })(X2, K2);
      }
      function L2(X2, Y2) {
        return [X2 * Math.sin(Y2), -X2 * Math.cos(Y2)];
      }
      function V2(X2, Y2, K2) {
        var q = X2._fullLayout, re = K2.trace, R2 = re.texttemplate, z = re.textinfo;
        if (!R2 && z && z !== "none") {
          var H2, te = z.split("+"), j = function(me) {
            return te.indexOf(me) !== -1;
          }, Q2 = j("label"), Z2 = j("text"), ne = j("value"), ae = j("percent"), ue = q.separators;
          if (H2 = Q2 ? [Y2.label] : [], Z2) {
            var le = m.getFirstFilled(re.text, Y2.pts);
            x(le) && H2.push(le);
          }
          ne && H2.push(m.formatPieValue(Y2.v, ue)), ae && H2.push(m.formatPiePercent(Y2.v / K2.vTotal, ue)), Y2.text = H2.join("<br>");
        }
        if (R2) {
          var ce = l.castOption(re, Y2.i, "texttemplate");
          if (ce) {
            var se = function(me) {
              return { label: me.label, value: me.v, valueLabel: m.formatPieValue(me.v, q.separators), percent: me.v / K2.vTotal, percentLabel: m.formatPiePercent(me.v / K2.vTotal, q.separators), color: me.color, text: me.text, customdata: l.castOption(re, me.i, "customdata") };
            }(Y2), he = m.getFirstFilled(re.text, Y2.pts);
            (x(he) || he === "") && (se.text = he), Y2.text = l.texttemplateString(ce, se, X2._fullLayout._d3locale, se, re._meta || {});
          } else Y2.text = "";
        }
      }
      function W2(X2, Y2) {
        var K2 = X2.rotate * Math.PI / 180, q = Math.cos(K2), re = Math.sin(K2), R2 = (Y2.left + Y2.right) / 2, z = (Y2.top + Y2.bottom) / 2;
        X2.textX = R2 * q - z * re, X2.textY = R2 * re + z * q, X2.noCenter = true;
      }
      t.exports = { plot: function(X2, Y2) {
        var K2 = X2._fullLayout, q = K2._size;
        d("pie", K2), w(Y2, X2), O2(Y2, q);
        var re = l.makeTraceGroups(K2._pielayer, Y2, "trace").each(function(R2) {
          var z = n.select(this), H2 = R2[0], te = H2.trace;
          (function(j) {
            var Q2, Z2, ne, ae = j[0], ue = ae.r, le = ae.trace, ce = m.getRotationAngle(le.rotation), se = 2 * Math.PI / ae.vTotal, he = "px0", me = "px1";
            if (le.direction === "counterclockwise") {
              for (Q2 = 0; Q2 < j.length && j[Q2].hidden; Q2++) ;
              if (Q2 === j.length) return;
              ce += se * j[Q2].v, se *= -1, he = "px1", me = "px0";
            }
            for (ne = L2(ue, ce), Q2 = 0; Q2 < j.length; Q2++) (Z2 = j[Q2]).hidden || (Z2[he] = ne, Z2.startangle = ce, ce += se * Z2.v / 2, Z2.pxmid = L2(ue, ce), Z2.midangle = ce, ce += se * Z2.v / 2, ne = L2(ue, ce), Z2.stopangle = ce, Z2[me] = ne, Z2.largeArc = Z2.v > ae.vTotal / 2 ? 1 : 0, Z2.halfangle = Math.PI * Math.min(Z2.v / ae.vTotal, 0.5), Z2.ring = 1 - le.hole, Z2.rInscribed = E2(Z2, ae));
          })(R2), z.attr("stroke-linejoin", "round"), z.each(function() {
            var j = n.select(this).selectAll("g.slice").data(R2);
            j.enter().append("g").classed("slice", true), j.exit().remove();
            var Q2 = [[[], []], [[], []]], Z2 = false;
            j.each(function(me, we) {
              if (me.hidden) n.select(this).selectAll("path,g").remove();
              else {
                me.pointNumber = me.i, me.curveNumber = te.index, Q2[me.pxmid[1] < 0 ? 0 : 1][me.pxmid[0] < 0 ? 0 : 1].push(me);
                var be = H2.cx, Ae = H2.cy, pe = n.select(this), ve = pe.selectAll("path.surface").data([me]);
                if (ve.enter().append("path").classed("surface", true).style({ "pointer-events": "all" }), pe.call(b, X2, R2), te.pull) {
                  var Ee = +m.castOption(te.pull, me.pts) || 0;
                  Ee > 0 && (be += Ee * me.pxmid[0], Ae += Ee * me.pxmid[1]);
                }
                me.cxFinal = be, me.cyFinal = Ae;
                var Se = te.hole;
                if (me.v === H2.vTotal) {
                  var Ce = "M" + (be + me.px0[0]) + "," + (Ae + me.px0[1]) + We(me.px0, me.pxmid, true, 1) + We(me.pxmid, me.px0, true, 1) + "Z";
                  Se ? ve.attr("d", "M" + (be + Se * me.px0[0]) + "," + (Ae + Se * me.px0[1]) + We(me.px0, me.pxmid, false, Se) + We(me.pxmid, me.px0, false, Se) + "Z" + Ce) : ve.attr("d", Ce);
                } else {
                  var Be = We(me.px0, me.px1, true, 1);
                  if (Se) {
                    var Ue = 1 - Se;
                    ve.attr("d", "M" + (be + Se * me.px1[0]) + "," + (Ae + Se * me.px1[1]) + We(me.px1, me.px0, false, Se) + "l" + Ue * me.px0[0] + "," + Ue * me.px0[1] + Be + "Z");
                  } else ve.attr("d", "M" + be + "," + Ae + "l" + me.px0[0] + "," + me.px0[1] + Be + "Z");
                }
                V2(X2, me, H2);
                var Ke = m.castOption(te.textposition, me.pts), ct = pe.selectAll("g.slicetext").data(me.text && Ke !== "none" ? [0] : []);
                ct.enter().append("g").classed("slicetext", true), ct.exit().remove(), ct.each(function() {
                  var Ze = l.ensureSingle(n.select(this), "text", "", function(yt) {
                    yt.attr("data-notex", 1);
                  }), it = l.ensureUniformFontSize(X2, Ke === "outside" ? function(yt, pt, Ot) {
                    var Jt = m.castOption(yt.outsidetextfont.color, pt.pts) || m.castOption(yt.textfont.color, pt.pts) || Ot.color, tr = m.castOption(yt.outsidetextfont.family, pt.pts) || m.castOption(yt.textfont.family, pt.pts) || Ot.family, Ye = m.castOption(yt.outsidetextfont.size, pt.pts) || m.castOption(yt.textfont.size, pt.pts) || Ot.size;
                    return { color: Jt, family: tr, size: Ye };
                  }(te, me, K2.font) : y(te, me, K2.font));
                  Ze.text(me.text).attr({ class: "slicetext", transform: "", "text-anchor": "middle" }).call(i.font, it).call(f.convertToTspans, X2);
                  var ot, mt = i.bBox(Ze.node());
                  if (Ke === "outside") ot = F13(mt, me);
                  else if (ot = _4(mt, me, H2), Ke === "auto" && ot.scale < 1) {
                    var wt = l.ensureUniformFontSize(X2, te.outsidetextfont);
                    Ze.call(i.font, wt), ot = F13(mt = i.bBox(Ze.node()), me);
                  }
                  var Et = ot.textPosAngle, zt = Et === void 0 ? me.pxmid : L2(H2.r, Et);
                  if (ot.targetX = be + zt[0] * ot.rCenter + (ot.x || 0), ot.targetY = Ae + zt[1] * ot.rCenter + (ot.y || 0), W2(ot, mt), ot.outside) {
                    var Nt = ot.targetY;
                    me.yLabelMin = Nt - mt.height / 2, me.yLabelMid = Nt, me.yLabelMax = Nt + mt.height / 2, me.labelExtraX = 0, me.labelExtraY = 0, Z2 = true;
                  }
                  ot.fontSize = it.size, p(te.type, ot, K2), R2[we].transform = ot, Ze.attr("transform", l.getTextTransform(ot));
                });
              }
              function We(Ze, it, ot, mt) {
                var wt = mt * (it[0] - Ze[0]), Et = mt * (it[1] - Ze[1]);
                return "a" + mt * H2.r + "," + mt * H2.r + " 0 " + me.largeArc + (ot ? " 1 " : " 0 ") + wt + "," + Et;
              }
            });
            var ne = n.select(this).selectAll("g.titletext").data(te.title.text ? [0] : []);
            if (ne.enter().append("g").classed("titletext", true), ne.exit().remove(), ne.each(function() {
              var me, we = l.ensureSingle(n.select(this), "text", "", function(Ae) {
                Ae.attr("data-notex", 1);
              }), be = te.title.text;
              te._meta && (be = l.templateString(be, te._meta)), we.text(be).attr({ class: "titletext", transform: "", "text-anchor": "middle" }).call(i.font, te.title.font).call(f.convertToTspans, X2), me = te.title.position === "middle center" ? function(Ae) {
                var pe = Math.sqrt(Ae.titleBox.width * Ae.titleBox.width + Ae.titleBox.height * Ae.titleBox.height);
                return { x: Ae.cx, y: Ae.cy, scale: Ae.trace.hole * Ae.r * 2 / pe, tx: 0, ty: -Ae.titleBox.height / 2 + Ae.trace.title.font.size };
              }(H2) : N2(H2, q), we.attr("transform", c(me.x, me.y) + u2(Math.min(1, me.scale)) + c(me.tx, me.ty));
            }), Z2 && function(me, we) {
              var be, Ae, pe, ve, Ee, Se, Ce, Be, Ue, Ke, ct, We, Ze;
              function it(Et, zt) {
                return Et.pxmid[1] - zt.pxmid[1];
              }
              function ot(Et, zt) {
                return zt.pxmid[1] - Et.pxmid[1];
              }
              function mt(Et, zt) {
                zt || (zt = {});
                var Nt, yt, pt, Ot, Jt = zt.labelExtraY + (Ae ? zt.yLabelMax : zt.yLabelMin), tr = Ae ? Et.yLabelMin : Et.yLabelMax, Ye = Ae ? Et.yLabelMax : Et.yLabelMin, at = Et.cyFinal + Ee(Et.px0[1], Et.px1[1]), Ge = Jt - tr;
                if (Ge * Ce > 0 && (Et.labelExtraY = Ge), Array.isArray(we.pull)) for (yt = 0; yt < Ke.length; yt++) (pt = Ke[yt]) === Et || (m.castOption(we.pull, Et.pts) || 0) >= (m.castOption(we.pull, pt.pts) || 0) || ((Et.pxmid[1] - pt.pxmid[1]) * Ce > 0 ? (Ge = pt.cyFinal + Ee(pt.px0[1], pt.px1[1]) - tr - Et.labelExtraY) * Ce > 0 && (Et.labelExtraY += Ge) : (Ye + Et.labelExtraY - at) * Ce > 0 && (Nt = 3 * Se * Math.abs(yt - Ke.indexOf(Et)), (Ot = pt.cxFinal + ve(pt.px0[0], pt.px1[0]) + Nt - (Et.cxFinal + Et.pxmid[0]) - Et.labelExtraX) * Se > 0 && (Et.labelExtraX += Ot)));
              }
              for (Ae = 0; Ae < 2; Ae++) for (pe = Ae ? it : ot, Ee = Ae ? Math.max : Math.min, Ce = Ae ? 1 : -1, be = 0; be < 2; be++) {
                for (ve = be ? Math.max : Math.min, Se = be ? 1 : -1, (Be = me[Ae][be]).sort(pe), Ue = me[1 - Ae][be], Ke = Ue.concat(Be), We = [], ct = 0; ct < Be.length; ct++) Be[ct].yLabelMid !== void 0 && We.push(Be[ct]);
                for (Ze = false, ct = 0; Ae && ct < Ue.length; ct++) if (Ue[ct].yLabelMid !== void 0) {
                  Ze = Ue[ct];
                  break;
                }
                for (ct = 0; ct < We.length; ct++) {
                  var wt = ct && We[ct - 1];
                  Ze && !ct && (wt = Ze), mt(We[ct], wt);
                }
              }
            }(Q2, te), function(me, we) {
              me.each(function(be) {
                var Ae = n.select(this);
                if (be.labelExtraX || be.labelExtraY) {
                  var pe = Ae.select("g.slicetext text");
                  be.transform.targetX += be.labelExtraX, be.transform.targetY += be.labelExtraY, pe.attr("transform", l.getTextTransform(be.transform));
                  var ve = be.cxFinal + be.pxmid[0], Ee = "M" + ve + "," + (be.cyFinal + be.pxmid[1]), Se = (be.yLabelMax - be.yLabelMin) * (be.pxmid[0] < 0 ? -1 : 1) / 4;
                  if (be.labelExtraX) {
                    var Ce = be.labelExtraX * be.pxmid[1] / be.pxmid[0], Be = be.yLabelMid + be.labelExtraY - (be.cyFinal + be.pxmid[1]);
                    Math.abs(Ce) > Math.abs(Be) ? Ee += "l" + Be * be.pxmid[0] / be.pxmid[1] + "," + Be + "H" + (ve + be.labelExtraX + Se) : Ee += "l" + be.labelExtraX + "," + Ce + "v" + (Be - Ce) + "h" + Se;
                  } else Ee += "V" + (be.yLabelMid + be.labelExtraY) + "h" + Se;
                  l.ensureSingle(Ae, "path", "textline").call(s.stroke, we.outsidetextfont.color).attr({ "stroke-width": Math.min(2, we.outsidetextfont.size / 8), d: Ee, fill: "none" });
                } else Ae.select("path.textline").remove();
              });
            }(j, te), Z2 && te.automargin) {
              var ae = i.bBox(z.node()), ue = te.domain, le = q.w * (ue.x[1] - ue.x[0]), ce = q.h * (ue.y[1] - ue.y[0]), se = (0.5 * le - H2.r) / q.w, he = (0.5 * ce - H2.r) / q.h;
              a.autoMargin(X2, "pie." + te.uid + ".automargin", { xl: ue.x[0] - se, xr: ue.x[1] + se, yb: ue.y[0] - he, yt: ue.y[1] + he, l: Math.max(H2.cx - H2.r - ae.left, 0), r: Math.max(ae.right - (H2.cx + H2.r), 0), b: Math.max(ae.bottom - (H2.cy + H2.r), 0), t: Math.max(H2.cy - H2.r - ae.top, 0), pad: 5 });
            }
          });
        });
        setTimeout(function() {
          re.selectAll("tspan").each(function() {
            var R2 = n.select(this);
            R2.attr("dy") && R2.attr("dy", R2.attr("dy"));
          });
        }, 0);
      }, formatSliceLabel: V2, transformInsideText: _4, determineInsideTextFont: y, positionTitleOutside: N2, prerenderTitles: w, layoutAreas: O2, attachFxHandlers: b, computeTransform: W2 };
    }, { "../../components/color": 366, "../../components/drawing": 388, "../../components/fx": 406, "../../lib": 503, "../../lib/svg_text_utils": 529, "../../plots/plots": 619, "../bar/constants": 650, "../bar/uniform_text": 664, "./event_data": 904, "./helpers": 905, "@plotly/d3": 58 }], 910: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("./style_one"), o = e("../bar/uniform_text").resizeText;
      t.exports = function(s) {
        var i = s._fullLayout._pielayer.selectAll(".trace");
        o(s, i, "pie"), i.each(function(l) {
          var u2 = l[0].trace, c = n.select(this);
          c.style({ opacity: u2.opacity }), c.selectAll("path.surface").each(function(f) {
            n.select(this).call(a, f, u2);
          });
        });
      };
    }, { "../bar/uniform_text": 664, "./style_one": 911, "@plotly/d3": 58 }], 911: [function(e, t, r) {
      "use strict";
      var n = e("../../components/color"), a = e("./helpers").castOption;
      t.exports = function(o, s, i) {
        var l = i.marker.line, u2 = a(l.color, s.pts) || n.defaultLine, c = a(l.width, s.pts) || 0;
        o.style("stroke-width", c).call(n.fill, s.color).call(n.stroke, u2);
      };
    }, { "../../components/color": 366, "./helpers": 905 }], 912: [function(e, t, r) {
      "use strict";
      var n = e("../scatter/attributes");
      t.exports = { x: n.x, y: n.y, xy: { valType: "data_array", editType: "calc" }, indices: { valType: "data_array", editType: "calc" }, xbounds: { valType: "data_array", editType: "calc" }, ybounds: { valType: "data_array", editType: "calc" }, text: n.text, marker: { color: { valType: "color", arrayOk: false, editType: "calc" }, opacity: { valType: "number", min: 0, max: 1, dflt: 1, arrayOk: false, editType: "calc" }, blend: { valType: "boolean", dflt: null, editType: "calc" }, sizemin: { valType: "number", min: 0.1, max: 2, dflt: 0.5, editType: "calc" }, sizemax: { valType: "number", min: 0.1, dflt: 20, editType: "calc" }, border: { color: { valType: "color", arrayOk: false, editType: "calc" }, arearatio: { valType: "number", min: 0, max: 1, dflt: 0, editType: "calc" }, editType: "calc" }, editType: "calc" }, transforms: void 0 };
    }, { "../scatter/attributes": 926 }], 913: [function(e, t, r) {
      "use strict";
      var n = e("../../../stackgl_modules").gl_pointcloud2d, a = e("../../lib/str2rgbarray"), o = e("../../plots/cartesian/autorange").findExtremes, s = e("../scatter/get_trace_color");
      function i(u2, c) {
        this.scene = u2, this.uid = c, this.type = "pointcloud", this.pickXData = [], this.pickYData = [], this.xData = [], this.yData = [], this.textLabels = [], this.color = "rgb(0, 0, 0)", this.name = "", this.hoverinfo = "all", this.idToIndex = new Int32Array(0), this.bounds = [0, 0, 0, 0], this.pointcloudOptions = { positions: new Float32Array(0), idToIndex: this.idToIndex, sizemin: 0.5, sizemax: 12, color: [0, 0, 0, 1], areaRatio: 1, borderColor: [0, 0, 0, 1] }, this.pointcloud = n(u2.glplot, this.pointcloudOptions), this.pointcloud._trace = this;
      }
      var l = i.prototype;
      l.handlePick = function(u2) {
        var c = this.idToIndex[u2.pointId];
        return { trace: this, dataCoord: u2.dataCoord, traceCoord: this.pickXYData ? [this.pickXYData[2 * c], this.pickXYData[2 * c + 1]] : [this.pickXData[c], this.pickYData[c]], textLabel: Array.isArray(this.textLabels) ? this.textLabels[c] : this.textLabels, color: this.color, name: this.name, pointIndex: c, hoverinfo: this.hoverinfo };
      }, l.update = function(u2) {
        this.index = u2.index, this.textLabels = u2.text, this.name = u2.name, this.hoverinfo = u2.hoverinfo, this.bounds = [1 / 0, 1 / 0, -1 / 0, -1 / 0], this.updateFast(u2), this.color = s(u2, {});
      }, l.updateFast = function(u2) {
        var c, f, h, p, d, v, m = this.xData = this.pickXData = u2.x, g = this.yData = this.pickYData = u2.y, x = this.pickXYData = u2.xy, b = u2.xbounds && u2.ybounds, y = u2.indices, w = this.bounds;
        if (x) {
          if (h = x, c = x.length >>> 1, b) w[0] = u2.xbounds[0], w[2] = u2.xbounds[1], w[1] = u2.ybounds[0], w[3] = u2.ybounds[1];
          else for (v = 0; v < c; v++) p = h[2 * v], d = h[2 * v + 1], p < w[0] && (w[0] = p), p > w[2] && (w[2] = p), d < w[1] && (w[1] = d), d > w[3] && (w[3] = d);
          if (y) f = y;
          else for (f = new Int32Array(c), v = 0; v < c; v++) f[v] = v;
        } else for (c = m.length, h = new Float32Array(2 * c), f = new Int32Array(c), v = 0; v < c; v++) p = m[v], d = g[v], f[v] = v, h[2 * v] = p, h[2 * v + 1] = d, p < w[0] && (w[0] = p), p > w[2] && (w[2] = p), d < w[1] && (w[1] = d), d > w[3] && (w[3] = d);
        this.idToIndex = f, this.pointcloudOptions.idToIndex = f, this.pointcloudOptions.positions = h;
        var _4 = a(u2.marker.color), k = a(u2.marker.border.color), T2 = u2.opacity * u2.marker.opacity;
        _4[3] *= T2, this.pointcloudOptions.color = _4;
        var A2 = u2.marker.blend;
        A2 === null && (A2 = m.length < 100 || g.length < 100), this.pointcloudOptions.blend = A2, k[3] *= T2, this.pointcloudOptions.borderColor = k;
        var S2 = u2.marker.sizemin, C2 = Math.max(u2.marker.sizemax, u2.marker.sizemin);
        this.pointcloudOptions.sizeMin = S2, this.pointcloudOptions.sizeMax = C2, this.pointcloudOptions.areaRatio = u2.marker.border.arearatio, this.pointcloud.update(this.pointcloudOptions);
        var E2 = this.scene.xaxis, F13 = this.scene.yaxis, N2 = C2 / 2 || 0.5;
        u2._extremes[E2._id] = o(E2, [w[0], w[2]], { ppad: N2 }), u2._extremes[F13._id] = o(F13, [w[1], w[3]], { ppad: N2 });
      }, l.dispose = function() {
        this.pointcloud.dispose();
      }, t.exports = function(u2, c) {
        var f = new i(u2, c.uid);
        return f.update(c), f;
      };
    }, { "../../../stackgl_modules": 1120, "../../lib/str2rgbarray": 528, "../../plots/cartesian/autorange": 553, "../scatter/get_trace_color": 936 }], 914: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("./attributes");
      t.exports = function(o, s, i) {
        function l(u2, c) {
          return n.coerce(o, s, a, u2, c);
        }
        l("x"), l("y"), l("xbounds"), l("ybounds"), o.xy && o.xy instanceof Float32Array && (s.xy = o.xy), o.indices && o.indices instanceof Int32Array && (s.indices = o.indices), l("text"), l("marker.color", i), l("marker.opacity"), l("marker.blend"), l("marker.sizemin"), l("marker.sizemax"), l("marker.border.color", i), l("marker.border.arearatio"), s._length = null;
      };
    }, { "../../lib": 503, "./attributes": 912 }], 915: [function(e, t, r) {
      "use strict";
      ["*pointcloud* trace is deprecated!", "Please consider switching to the *scattergl* trace type."].join(" "), t.exports = { attributes: e("./attributes"), supplyDefaults: e("./defaults"), calc: e("../scatter3d/calc"), plot: e("./convert"), moduleType: "trace", name: "pointcloud", basePlotModule: e("../../plots/gl2d"), categories: ["gl", "gl2d", "showLegend"], meta: {} };
    }, { "../../plots/gl2d": 596, "../scatter3d/calc": 955, "./attributes": 912, "./convert": 913, "./defaults": 914 }], 916: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/font_attributes"), a = e("../../plots/attributes"), o = e("../../components/color/attributes"), s = e("../../components/fx/attributes"), i = e("../../plots/domain").attributes, l = e("../../plots/template_attributes").hovertemplateAttrs, u2 = e("../../components/colorscale/attributes"), c = e("../../plot_api/plot_template").templatedArray, f = e("../../plots/cartesian/axis_format_attributes").descriptionOnlyNumbers, h = e("../../lib/extend").extendFlat, p = e("../../plot_api/edit_types").overrideAll;
      (t.exports = p({ hoverinfo: h({}, a.hoverinfo, { flags: [], arrayOk: false }), hoverlabel: s.hoverlabel, domain: i({ name: "sankey", trace: true }), orientation: { valType: "enumerated", values: ["v", "h"], dflt: "h" }, valueformat: { valType: "string", dflt: ".3s", description: f("value") }, valuesuffix: { valType: "string", dflt: "" }, arrangement: { valType: "enumerated", values: ["snap", "perpendicular", "freeform", "fixed"], dflt: "snap" }, textfont: n({}), customdata: void 0, node: { label: { valType: "data_array", dflt: [] }, groups: { valType: "info_array", impliedEdits: { x: [], y: [] }, dimensions: 2, freeLength: true, dflt: [], items: { valType: "number", editType: "calc" } }, x: { valType: "data_array", dflt: [] }, y: { valType: "data_array", dflt: [] }, color: { valType: "color", arrayOk: true }, customdata: { valType: "data_array", editType: "calc" }, line: { color: { valType: "color", dflt: o.defaultLine, arrayOk: true }, width: { valType: "number", min: 0, dflt: 0.5, arrayOk: true } }, pad: { valType: "number", arrayOk: false, min: 0, dflt: 20 }, thickness: { valType: "number", arrayOk: false, min: 1, dflt: 20 }, hoverinfo: { valType: "enumerated", values: ["all", "none", "skip"], dflt: "all" }, hoverlabel: s.hoverlabel, hovertemplate: l({}, { keys: ["value", "label"] }) }, link: { label: { valType: "data_array", dflt: [] }, color: { valType: "color", arrayOk: true }, customdata: { valType: "data_array", editType: "calc" }, line: { color: { valType: "color", dflt: o.defaultLine, arrayOk: true }, width: { valType: "number", min: 0, dflt: 0, arrayOk: true } }, source: { valType: "data_array", dflt: [] }, target: { valType: "data_array", dflt: [] }, value: { valType: "data_array", dflt: [] }, hoverinfo: { valType: "enumerated", values: ["all", "none", "skip"], dflt: "all" }, hoverlabel: s.hoverlabel, hovertemplate: l({}, { keys: ["value", "label"] }), colorscales: c("concentrationscales", { editType: "calc", label: { valType: "string", editType: "calc", dflt: "" }, cmax: { valType: "number", editType: "calc", dflt: 1 }, cmin: { valType: "number", editType: "calc", dflt: 0 }, colorscale: h(u2().colorscale, { dflt: [[0, "white"], [1, "black"]] }) }) } }, "calc", "nested")).transforms = void 0;
    }, { "../../components/color/attributes": 365, "../../components/colorscale/attributes": 373, "../../components/fx/attributes": 397, "../../lib/extend": 493, "../../plot_api/edit_types": 536, "../../plot_api/plot_template": 543, "../../plots/attributes": 550, "../../plots/cartesian/axis_format_attributes": 557, "../../plots/domain": 584, "../../plots/font_attributes": 585, "../../plots/template_attributes": 633 }], 917: [function(e, t, r) {
      "use strict";
      var n = e("../../plot_api/edit_types").overrideAll, a = e("../../plots/get_data").getModuleCalcData, o = e("./plot"), s = e("../../components/fx/layout_attributes"), i = e("../../lib/setcursor"), l = e("../../components/dragelement"), u2 = e("../../plots/cartesian/select").prepSelect, c = e("../../lib"), f = e("../../registry");
      function h(p, d) {
        var v = p._fullData[d], m = p._fullLayout, g = m.dragmode, x = m.dragmode === "pan" ? "move" : "crosshair", b = v._bgRect;
        if (g !== "pan" && g !== "zoom") {
          i(b, x);
          var y = { _id: "x", c2p: c.identity, _offset: v._sankey.translateX, _length: v._sankey.width }, w = { _id: "y", c2p: c.identity, _offset: v._sankey.translateY, _length: v._sankey.height }, _4 = { gd: p, element: b.node(), plotinfo: { id: d, xaxis: y, yaxis: w, fillRangeItems: c.noop }, subplot: d, xaxes: [y], yaxes: [w], doneFnCompleted: function(k) {
            var T2, A2 = p._fullData[d], S2 = A2.node.groups.slice(), C2 = [];
            function E2(I2) {
              for (var O2 = A2._sankey.graph.nodes, L2 = 0; L2 < O2.length; L2++) if (O2[L2].pointNumber === I2) return O2[L2];
            }
            for (var F13 = 0; F13 < k.length; F13++) {
              var N2 = E2(k[F13].pointNumber);
              if (N2) if (N2.group) {
                for (var D2 = 0; D2 < N2.childrenNodes.length; D2++) C2.push(N2.childrenNodes[D2].pointNumber);
                S2[N2.pointNumber - A2.node._count] = false;
              } else C2.push(N2.pointNumber);
            }
            T2 = S2.filter(Boolean).concat([C2]), f.call("_guiRestyle", p, { "node.groups": [T2] }, d);
          }, prepFn: function(k, T2, A2) {
            u2(k, T2, A2, _4, g);
          } };
          l.init(_4);
        }
      }
      r.name = "sankey", r.baseLayoutAttrOverrides = n({ hoverlabel: s.hoverlabel }, "plot", "nested"), r.plot = function(p) {
        var d = a(p.calcdata, "sankey")[0];
        o(p, d), r.updateFx(p);
      }, r.clean = function(p, d, v, m) {
        var g = m._has && m._has("sankey"), x = d._has && d._has("sankey");
        g && !x && (m._paperdiv.selectAll(".sankey").remove(), m._paperdiv.selectAll(".bgsankey").remove());
      }, r.updateFx = function(p) {
        for (var d = 0; d < p._fullData.length; d++) h(p, d);
      };
    }, { "../../components/dragelement": 385, "../../components/fx/layout_attributes": 407, "../../lib": 503, "../../lib/setcursor": 524, "../../plot_api/edit_types": 536, "../../plots/cartesian/select": 575, "../../plots/get_data": 593, "../../registry": 638, "./plot": 922 }], 918: [function(e, t, r) {
      "use strict";
      var n = e("strongly-connected-components"), a = e("../../lib"), o = e("../../lib/gup").wrap, s = a.isArrayOrTypedArray, i = a.isIndex, l = e("../../components/colorscale");
      function u2(c) {
        var f, h = c.node, p = c.link, d = [], v = s(p.color), m = s(p.customdata), g = {}, x = {}, b = p.colorscales.length;
        for (f = 0; f < b; f++) {
          var y = p.colorscales[f], w = l.extractScale(y, { cLetter: "c" }), _4 = l.makeColorScaleFunc(w);
          x[y.label] = _4;
        }
        var k = 0;
        for (f = 0; f < p.value.length; f++) p.source[f] > k && (k = p.source[f]), p.target[f] > k && (k = p.target[f]);
        var T2, A2 = k + 1;
        c.node._count = A2;
        var S2 = c.node.groups, C2 = {};
        for (f = 0; f < S2.length; f++) {
          var E2 = S2[f];
          for (T2 = 0; T2 < E2.length; T2++) {
            var F13 = E2[T2], N2 = A2 + f;
            C2.hasOwnProperty(F13) ? a.warn("Node " + F13 + " is already part of a group.") : C2[F13] = N2;
          }
        }
        var D2 = { source: [], target: [] };
        for (f = 0; f < p.value.length; f++) {
          var I2 = p.value[f], O2 = p.source[f], L2 = p.target[f];
          if (I2 > 0 && i(O2, A2) && i(L2, A2) && (!C2.hasOwnProperty(O2) || !C2.hasOwnProperty(L2) || C2[O2] !== C2[L2])) {
            C2.hasOwnProperty(L2) && (L2 = C2[L2]), C2.hasOwnProperty(O2) && (O2 = C2[O2]), L2 = +L2, g[O2 = +O2] = g[L2] = true;
            var V2 = "";
            p.label && p.label[f] && (V2 = p.label[f]);
            var W2 = null;
            V2 && x.hasOwnProperty(V2) && (W2 = x[V2]), d.push({ pointNumber: f, label: V2, color: v ? p.color[f] : p.color, customdata: m ? p.customdata[f] : p.customdata, concentrationscale: W2, source: O2, target: L2, value: +I2 }), D2.source.push(O2), D2.target.push(L2);
          }
        }
        var X2 = A2 + S2.length, Y2 = s(h.color), K2 = s(h.customdata), q = [];
        for (f = 0; f < X2; f++) if (g[f]) {
          var re = h.label[f];
          q.push({ group: f > A2 - 1, childrenNodes: [], pointNumber: f, label: re, color: Y2 ? h.color[f] : h.color, customdata: K2 ? h.customdata[f] : h.customdata });
        }
        var R2 = false;
        return function(z, H2, te) {
          for (var j = a.init2dArray(z, 0), Q2 = 0; Q2 < Math.min(H2.length, te.length); Q2++) if (a.isIndex(H2[Q2], z) && a.isIndex(te[Q2], z)) {
            if (H2[Q2] === te[Q2]) return true;
            j[H2[Q2]].push(te[Q2]);
          }
          return n(j).components.some(function(Z2) {
            return Z2.length > 1;
          });
        }(X2, D2.source, D2.target) && (R2 = true), { circular: R2, links: d, nodes: q, groups: S2, groupLookup: C2 };
      }
      t.exports = function(c, f) {
        var h = u2(f);
        return o({ circular: h.circular, _nodes: h.nodes, _links: h.links, _groups: h.groups, _groupLookup: h.groupLookup });
      };
    }, { "../../components/colorscale": 378, "../../lib": 503, "../../lib/gup": 500, "strongly-connected-components": 306 }], 919: [function(e, t, r) {
      "use strict";
      t.exports = { nodeTextOffsetHorizontal: 4, nodeTextOffsetVertical: 3, nodePadAcross: 10, sankeyIterations: 50, forceIterations: 5, forceTicksPerFrame: 10, duration: 500, ease: "linear", cn: { sankey: "sankey", sankeyLinks: "sankey-links", sankeyLink: "sankey-link", sankeyNodeSet: "sankey-node-set", sankeyNode: "sankey-node", nodeRect: "node-rect", nodeLabel: "node-label" } };
    }, {}], 920: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("./attributes"), o = e("../../components/color"), s = e("tinycolor2"), i = e("../../plots/domain").defaults, l = e("../../components/fx/hoverlabel_defaults"), u2 = e("../../plot_api/plot_template"), c = e("../../plots/array_container_defaults");
      function f(h, p) {
        function d(v, m) {
          return n.coerce(h, p, a.link.colorscales, v, m);
        }
        d("label"), d("cmin"), d("cmax"), d("colorscale");
      }
      t.exports = function(h, p, d, v) {
        function m(C2, E2) {
          return n.coerce(h, p, a, C2, E2);
        }
        var g = n.extendDeep(v.hoverlabel, h.hoverlabel), x = h.node, b = u2.newContainer(p, "node");
        function y(C2, E2) {
          return n.coerce(x, b, a.node, C2, E2);
        }
        y("label"), y("groups"), y("x"), y("y"), y("pad"), y("thickness"), y("line.color"), y("line.width"), y("hoverinfo", h.hoverinfo), l(x, b, y, g), y("hovertemplate");
        var w = v.colorway;
        y("color", b.label.map(function(C2, E2) {
          return o.addOpacity(function(F13) {
            return w[F13 % w.length];
          }(E2), 0.8);
        })), y("customdata");
        var _4 = h.link || {}, k = u2.newContainer(p, "link");
        function T2(C2, E2) {
          return n.coerce(_4, k, a.link, C2, E2);
        }
        T2("label"), T2("source"), T2("target"), T2("value"), T2("line.color"), T2("line.width"), T2("hoverinfo", h.hoverinfo), l(_4, k, T2, g), T2("hovertemplate");
        var A2, S2 = s(v.paper_bgcolor).getLuminance() < 0.333 ? "rgba(255, 255, 255, 0.6)" : "rgba(0, 0, 0, 0.2)";
        T2("color", n.repeat(S2, k.value.length)), T2("customdata"), c(_4, k, { name: "colorscales", handleItemDefaults: f }), i(p, v, m), m("orientation"), m("valueformat"), m("valuesuffix"), b.x.length && b.y.length && (A2 = "freeform"), m("arrangement", A2), n.coerceFont(m, "textfont", n.extendFlat({}, v.font)), p._length = null;
      };
    }, { "../../components/color": 366, "../../components/fx/hoverlabel_defaults": 404, "../../lib": 503, "../../plot_api/plot_template": 543, "../../plots/array_container_defaults": 549, "../../plots/domain": 584, "./attributes": 916, tinycolor2: 312 }], 921: [function(e, t, r) {
      "use strict";
      t.exports = { attributes: e("./attributes"), supplyDefaults: e("./defaults"), calc: e("./calc"), plot: e("./plot"), moduleType: "trace", name: "sankey", basePlotModule: e("./base_plot"), selectPoints: e("./select.js"), categories: ["noOpacity"], meta: {} };
    }, { "./attributes": 916, "./base_plot": 917, "./calc": 918, "./defaults": 920, "./plot": 922, "./select.js": 924 }], 922: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../lib"), o = a.numberFormat, s = e("./render"), i = e("../../components/fx"), l = e("../../components/color"), u2 = e("./constants").cn, c = a._;
      function f(_4) {
        return _4 !== "";
      }
      function h(_4, k) {
        return _4.filter(function(T2) {
          return T2.key === k.traceId;
        });
      }
      function p(_4, k) {
        n.select(_4).select("path").style("fill-opacity", k), n.select(_4).select("rect").style("fill-opacity", k);
      }
      function d(_4) {
        n.select(_4).select("text.name").style("fill", "black");
      }
      function v(_4) {
        return function(k) {
          return _4.node.sourceLinks.indexOf(k.link) !== -1 || _4.node.targetLinks.indexOf(k.link) !== -1;
        };
      }
      function m(_4) {
        return function(k) {
          return k.node.sourceLinks.indexOf(_4.link) !== -1 || k.node.targetLinks.indexOf(_4.link) !== -1;
        };
      }
      function g(_4, k, T2) {
        k && T2 && h(T2, k).selectAll("." + u2.sankeyLink).filter(v(k)).call(b.bind(0, k, T2, false));
      }
      function x(_4, k, T2) {
        k && T2 && h(T2, k).selectAll("." + u2.sankeyLink).filter(v(k)).call(y.bind(0, k, T2, false));
      }
      function b(_4, k, T2, A2) {
        var S2 = A2.datum().link.label;
        A2.style("fill-opacity", function(C2) {
          if (!C2.link.concentrationscale) return 0.4;
        }), S2 && h(k, _4).selectAll("." + u2.sankeyLink).filter(function(C2) {
          return C2.link.label === S2;
        }).style("fill-opacity", function(C2) {
          if (!C2.link.concentrationscale) return 0.4;
        }), T2 && h(k, _4).selectAll("." + u2.sankeyNode).filter(m(_4)).call(g);
      }
      function y(_4, k, T2, A2) {
        var S2 = A2.datum().link.label;
        A2.style("fill-opacity", function(C2) {
          return C2.tinyColorAlpha;
        }), S2 && h(k, _4).selectAll("." + u2.sankeyLink).filter(function(C2) {
          return C2.link.label === S2;
        }).style("fill-opacity", function(C2) {
          return C2.tinyColorAlpha;
        }), T2 && h(k, _4).selectAll(u2.sankeyNode).filter(m(_4)).call(x);
      }
      function w(_4, k) {
        var T2 = _4.hoverlabel || {}, A2 = a.nestedProperty(T2, k).get();
        return !Array.isArray(A2) && A2;
      }
      t.exports = function(_4, k) {
        for (var T2 = _4._fullLayout, A2 = T2._paper, S2 = T2._size, C2 = 0; C2 < _4._fullData.length; C2++) if (_4._fullData[C2].visible && _4._fullData[C2].type === u2.sankey && !_4._fullData[C2]._viewInitial) {
          var E2 = _4._fullData[C2].node;
          _4._fullData[C2]._viewInitial = { node: { groups: E2.groups.slice(), x: E2.x.slice(), y: E2.y.slice() } };
        }
        var F13 = c(_4, "source:") + " ", N2 = c(_4, "target:") + " ", D2 = c(_4, "concentration:") + " ", I2 = c(_4, "incoming flow count:") + " ", O2 = c(_4, "outgoing flow count:") + " ";
        s(_4, A2, k, { width: S2.w, height: S2.h, margin: { t: S2.t, r: S2.r, b: S2.b, l: S2.l } }, { linkEvents: { hover: function(L2, V2, W2) {
          _4._fullLayout.hovermode !== false && (n.select(L2).call(b.bind(0, V2, W2, true)), V2.link.trace.link.hoverinfo !== "skip" && (V2.link.fullData = V2.link.trace, _4.emit("plotly_hover", { event: n.event, points: [V2.link] })));
        }, follow: function(L2, V2) {
          if (_4._fullLayout.hovermode !== false) {
            var W2 = V2.link.trace.link;
            if (W2.hoverinfo !== "none" && W2.hoverinfo !== "skip") {
              for (var X2 = [], Y2 = 0, K2 = 0; K2 < V2.flow.links.length; K2++) {
                var q = V2.flow.links[K2];
                if (_4._fullLayout.hovermode !== "closest" || V2.link.pointNumber === q.pointNumber) {
                  V2.link.pointNumber === q.pointNumber && (Y2 = K2), q.fullData = q.trace, W2 = V2.link.trace.link;
                  var re = z(q), R2 = { valueLabel: o(V2.valueFormat)(q.value) + V2.valueSuffix };
                  X2.push({ x: re[0], y: re[1], name: R2.valueLabel, text: [q.label || "", F13 + q.source.label, N2 + q.target.label, q.concentrationscale ? D2 + o("%0.2f")(q.flow.labelConcentration) : ""].filter(f).join("<br>"), color: w(W2, "bgcolor") || l.addOpacity(q.color, 1), borderColor: w(W2, "bordercolor"), fontFamily: w(W2, "font.family"), fontSize: w(W2, "font.size"), fontColor: w(W2, "font.color"), nameLength: w(W2, "namelength"), textAlign: w(W2, "align"), idealAlign: n.event.x < re[0] ? "right" : "left", hovertemplate: W2.hovertemplate, hovertemplateLabels: R2, eventData: [q] });
                }
              }
              i.loneHover(X2, { container: T2._hoverlayer.node(), outerContainer: T2._paper.node(), gd: _4, anchorIndex: Y2 }).each(function() {
                V2.link.concentrationscale || p(this, 0.65), d(this);
              });
            }
          }
          function z(H2) {
            var te, j;
            H2.circular ? (te = (H2.circularPathData.leftInnerExtent + H2.circularPathData.rightInnerExtent) / 2, j = H2.circularPathData.verticalFullExtent) : (te = (H2.source.x1 + H2.target.x0) / 2, j = (H2.y0 + H2.y1) / 2);
            var Q2 = [te, j];
            return H2.trace.orientation === "v" && Q2.reverse(), Q2[0] += V2.parent.translateX, Q2[1] += V2.parent.translateY, Q2;
          }
        }, unhover: function(L2, V2, W2) {
          _4._fullLayout.hovermode !== false && (n.select(L2).call(y.bind(0, V2, W2, true)), V2.link.trace.link.hoverinfo !== "skip" && (V2.link.fullData = V2.link.trace, _4.emit("plotly_unhover", { event: n.event, points: [V2.link] })), i.loneUnhover(T2._hoverlayer.node()));
        }, select: function(L2, V2) {
          var W2 = V2.link;
          W2.originalEvent = n.event, _4._hoverdata = [W2], i.click(_4, { target: true });
        } }, nodeEvents: { hover: function(L2, V2, W2) {
          _4._fullLayout.hovermode !== false && (n.select(L2).call(g, V2, W2), V2.node.trace.node.hoverinfo !== "skip" && (V2.node.fullData = V2.node.trace, _4.emit("plotly_hover", { event: n.event, points: [V2.node] })));
        }, follow: function(L2, V2) {
          if (_4._fullLayout.hovermode !== false) {
            var W2 = V2.node.trace.node;
            if (W2.hoverinfo !== "none" && W2.hoverinfo !== "skip") {
              var X2 = n.select(L2).select("." + u2.nodeRect), Y2 = _4._fullLayout._paperdiv.node().getBoundingClientRect(), K2 = X2.node().getBoundingClientRect(), q = K2.left - 2 - Y2.left, re = K2.right + 2 - Y2.left, R2 = K2.top + K2.height / 4 - Y2.top, z = { valueLabel: o(V2.valueFormat)(V2.node.value) + V2.valueSuffix };
              V2.node.fullData = V2.node.trace, _4._fullLayout._calcInverseTransform(_4);
              var H2 = _4._fullLayout._invScaleX, te = _4._fullLayout._invScaleY, j = i.loneHover({ x0: H2 * q, x1: H2 * re, y: te * R2, name: o(V2.valueFormat)(V2.node.value) + V2.valueSuffix, text: [V2.node.label, I2 + V2.node.targetLinks.length, O2 + V2.node.sourceLinks.length].filter(f).join("<br>"), color: w(W2, "bgcolor") || V2.tinyColorHue, borderColor: w(W2, "bordercolor"), fontFamily: w(W2, "font.family"), fontSize: w(W2, "font.size"), fontColor: w(W2, "font.color"), nameLength: w(W2, "namelength"), textAlign: w(W2, "align"), idealAlign: "left", hovertemplate: W2.hovertemplate, hovertemplateLabels: z, eventData: [V2.node] }, { container: T2._hoverlayer.node(), outerContainer: T2._paper.node(), gd: _4 });
              p(j, 0.85), d(j);
            }
          }
        }, unhover: function(L2, V2, W2) {
          _4._fullLayout.hovermode !== false && (n.select(L2).call(x, V2, W2), V2.node.trace.node.hoverinfo !== "skip" && (V2.node.fullData = V2.node.trace, _4.emit("plotly_unhover", { event: n.event, points: [V2.node] })), i.loneUnhover(T2._hoverlayer.node()));
        }, select: function(L2, V2, W2) {
          var X2 = V2.node;
          X2.originalEvent = n.event, _4._hoverdata = [X2], n.select(L2).call(x, V2, W2), i.click(_4, { target: true });
        } } });
      };
    }, { "../../components/color": 366, "../../components/fx": 406, "../../lib": 503, "./constants": 919, "./render": 923, "@plotly/d3": 58 }], 923: [function(e, t, r) {
      "use strict";
      var n = e("d3-force"), a = e("d3-interpolate").interpolateNumber, o = e("@plotly/d3"), s = e("@plotly/d3-sankey"), i = e("@plotly/d3-sankey-circular"), l = e("./constants"), u2 = e("tinycolor2"), c = e("../../components/color"), f = e("../../components/drawing"), h = e("../../lib"), p = h.strTranslate, d = h.strRotate, v = e("../../lib/gup"), m = v.keyFun, g = v.repeat, x = v.unwrap, b = e("../../lib/svg_text_utils"), y = e("../../registry"), w = e("../../constants/alignment"), _4 = w.CAP_SHIFT, k = w.LINE_SPACING;
      function T2(K2, q, re) {
        var R2, z = x(q), H2 = z.trace, te = H2.domain, j = H2.orientation === "h", Q2 = H2.node.pad, Z2 = H2.node.thickness, ne = K2.width * (te.x[1] - te.x[0]), ae = K2.height * (te.y[1] - te.y[0]), ue = z._nodes, le = z._links, ce = z.circular;
        (R2 = ce ? i.sankeyCircular().circularLinkGap(0) : s.sankey()).iterations(l.sankeyIterations).size(j ? [ne, ae] : [ae, ne]).nodeWidth(Z2).nodePadding(Q2).nodeId(function(Ce) {
          return Ce.pointNumber;
        }).nodes(ue).links(le);
        var se, he, me, we = R2();
        for (var be in R2.nodePadding() < Q2 && h.warn("node.pad was reduced to ", R2.nodePadding(), " to fit within the figure."), z._groupLookup) {
          var Ae, pe = parseInt(z._groupLookup[be]);
          for (se = 0; se < we.nodes.length; se++) if (we.nodes[se].pointNumber === pe) {
            Ae = we.nodes[se];
            break;
          }
          if (Ae) {
            var ve = { pointNumber: parseInt(be), x0: Ae.x0, x1: Ae.x1, y0: Ae.y0, y1: Ae.y1, partOfGroup: true, sourceLinks: [], targetLinks: [] };
            we.nodes.unshift(ve), Ae.childrenNodes.unshift(ve);
          }
        }
        if (function() {
          for (se = 0; se < we.nodes.length; se++) {
            var Ce, Be, Ue = we.nodes[se], Ke = {};
            for (he = 0; he < Ue.targetLinks.length; he++) Ce = (Be = Ue.targetLinks[he]).source.pointNumber + ":" + Be.target.pointNumber, Ke.hasOwnProperty(Ce) || (Ke[Ce] = []), Ke[Ce].push(Be);
            var ct = Object.keys(Ke);
            for (he = 0; he < ct.length; he++) {
              var We = Ke[Ce = ct[he]], Ze = 0, it = {};
              for (me = 0; me < We.length; me++) it[(Be = We[me]).label] || (it[Be.label] = 0), it[Be.label] += Be.value, Ze += Be.value;
              for (me = 0; me < We.length; me++) (Be = We[me]).flow = { value: Ze, labelConcentration: it[Be.label] / Ze, concentration: Be.value / Ze, links: We }, Be.concentrationscale && (Be.color = u2(Be.concentrationscale(Be.flow.labelConcentration)));
            }
            var ot = 0;
            for (he = 0; he < Ue.sourceLinks.length; he++) ot += Ue.sourceLinks[he].value;
            for (he = 0; he < Ue.sourceLinks.length; he++) (Be = Ue.sourceLinks[he]).concentrationOut = Be.value / ot;
            var mt = 0;
            for (he = 0; he < Ue.targetLinks.length; he++) mt += Ue.targetLinks[he].value;
            for (he = 0; he < Ue.targetLinks.length; he++) (Be = Ue.targetLinks[he]).concenrationIn = Be.value / mt;
          }
        }(), H2.node.x.length && H2.node.y.length) {
          for (se = 0; se < Math.min(H2.node.x.length, H2.node.y.length, we.nodes.length); se++) if (H2.node.x[se] && H2.node.y[se]) {
            var Ee = [H2.node.x[se] * ne, H2.node.y[se] * ae];
            we.nodes[se].x0 = Ee[0] - Z2 / 2, we.nodes[se].x1 = Ee[0] + Z2 / 2;
            var Se = we.nodes[se].y1 - we.nodes[se].y0;
            we.nodes[se].y0 = Ee[1] - Se / 2, we.nodes[se].y1 = Ee[1] + Se / 2;
          }
          H2.arrangement === "snap" && function(Ce) {
            Ce.forEach(function(Be) {
              var Ue, Ke, ct, We = 0, Ze = Be.length;
              for (Be.sort(function(it, ot) {
                return it.y0 - ot.y0;
              }), ct = 0; ct < Ze; ++ct) (Ue = Be[ct]).y0 >= We || (Ke = We - Ue.y0) > 1e-6 && (Ue.y0 += Ke, Ue.y1 += Ke), We = Ue.y1 + Q2;
            });
          }(function(Ce) {
            var Be, Ue, Ke = Ce.map(function(ot, mt) {
              return { x0: ot.x0, index: mt };
            }).sort(function(ot, mt) {
              return ot.x0 - mt.x0;
            }), ct = [], We = -1, Ze = -1 / 0;
            for (se = 0; se < Ke.length; se++) {
              var it = Ce[Ke[se].index];
              it.x0 > Ze + Z2 && (We += 1, Be = it.x0), Ze = it.x0, ct[We] || (ct[We] = []), ct[We].push(it), Ue = Be - it.x0, it.x0 += Ue, it.x1 += Ue;
            }
            return ct;
          }(ue = we.nodes)), R2.update(we);
        }
        return { circular: ce, key: re, trace: H2, guid: h.randstr(), horizontal: j, width: ne, height: ae, nodePad: H2.node.pad, nodeLineColor: H2.node.line.color, nodeLineWidth: H2.node.line.width, linkLineColor: H2.link.line.color, linkLineWidth: H2.link.line.width, valueFormat: H2.valueformat, valueSuffix: H2.valuesuffix, textFont: H2.textfont, translateX: te.x[0] * K2.width + K2.margin.l, translateY: K2.height - te.y[1] * K2.height + K2.margin.t, dragParallel: j ? ae : ne, dragPerpendicular: j ? ne : ae, arrangement: H2.arrangement, sankey: R2, graph: we, forceLayouts: {}, interactionState: { dragInProgress: false, hovered: false } };
      }
      function A2(K2, q, re) {
        var R2 = u2(q.color), z = q.source.label + "|" + q.target.label + "__" + re;
        return q.trace = K2.trace, q.curveNumber = K2.trace.index, { circular: K2.circular, key: z, traceId: K2.key, pointNumber: q.pointNumber, link: q, tinyColorHue: c.tinyRGB(R2), tinyColorAlpha: R2.getAlpha(), linkPath: S2, linkLineColor: K2.linkLineColor, linkLineWidth: K2.linkLineWidth, valueFormat: K2.valueFormat, valueSuffix: K2.valueSuffix, sankey: K2.sankey, parent: K2, interactionState: K2.interactionState, flow: q.flow };
      }
      function S2() {
        return function(K2) {
          if (K2.link.circular) return q = K2.link, re = q.width / 2, R2 = q.circularPathData, q.circularLinkType === "top" ? "M " + R2.targetX + " " + (R2.targetY + re) + " L" + R2.rightInnerExtent + " " + (R2.targetY + re) + "A" + (R2.rightLargeArcRadius + re) + " " + (R2.rightSmallArcRadius + re) + " 0 0 1 " + (R2.rightFullExtent - re) + " " + (R2.targetY - R2.rightSmallArcRadius) + "L" + (R2.rightFullExtent - re) + " " + R2.verticalRightInnerExtent + "A" + (R2.rightLargeArcRadius + re) + " " + (R2.rightLargeArcRadius + re) + " 0 0 1 " + R2.rightInnerExtent + " " + (R2.verticalFullExtent - re) + "L" + R2.leftInnerExtent + " " + (R2.verticalFullExtent - re) + "A" + (R2.leftLargeArcRadius + re) + " " + (R2.leftLargeArcRadius + re) + " 0 0 1 " + (R2.leftFullExtent + re) + " " + R2.verticalLeftInnerExtent + "L" + (R2.leftFullExtent + re) + " " + (R2.sourceY - R2.leftSmallArcRadius) + "A" + (R2.leftLargeArcRadius + re) + " " + (R2.leftSmallArcRadius + re) + " 0 0 1 " + R2.leftInnerExtent + " " + (R2.sourceY + re) + "L" + R2.sourceX + " " + (R2.sourceY + re) + "L" + R2.sourceX + " " + (R2.sourceY - re) + "L" + R2.leftInnerExtent + " " + (R2.sourceY - re) + "A" + (R2.leftLargeArcRadius - re) + " " + (R2.leftSmallArcRadius - re) + " 0 0 0 " + (R2.leftFullExtent - re) + " " + (R2.sourceY - R2.leftSmallArcRadius) + "L" + (R2.leftFullExtent - re) + " " + R2.verticalLeftInnerExtent + "A" + (R2.leftLargeArcRadius - re) + " " + (R2.leftLargeArcRadius - re) + " 0 0 0 " + R2.leftInnerExtent + " " + (R2.verticalFullExtent + re) + "L" + R2.rightInnerExtent + " " + (R2.verticalFullExtent + re) + "A" + (R2.rightLargeArcRadius - re) + " " + (R2.rightLargeArcRadius - re) + " 0 0 0 " + (R2.rightFullExtent + re) + " " + R2.verticalRightInnerExtent + "L" + (R2.rightFullExtent + re) + " " + (R2.targetY - R2.rightSmallArcRadius) + "A" + (R2.rightLargeArcRadius - re) + " " + (R2.rightSmallArcRadius - re) + " 0 0 0 " + R2.rightInnerExtent + " " + (R2.targetY - re) + "L" + R2.targetX + " " + (R2.targetY - re) + "Z" : "M " + R2.targetX + " " + (R2.targetY - re) + " L" + R2.rightInnerExtent + " " + (R2.targetY - re) + "A" + (R2.rightLargeArcRadius + re) + " " + (R2.rightSmallArcRadius + re) + " 0 0 0 " + (R2.rightFullExtent - re) + " " + (R2.targetY + R2.rightSmallArcRadius) + "L" + (R2.rightFullExtent - re) + " " + R2.verticalRightInnerExtent + "A" + (R2.rightLargeArcRadius + re) + " " + (R2.rightLargeArcRadius + re) + " 0 0 0 " + R2.rightInnerExtent + " " + (R2.verticalFullExtent + re) + "L" + R2.leftInnerExtent + " " + (R2.verticalFullExtent + re) + "A" + (R2.leftLargeArcRadius + re) + " " + (R2.leftLargeArcRadius + re) + " 0 0 0 " + (R2.leftFullExtent + re) + " " + R2.verticalLeftInnerExtent + "L" + (R2.leftFullExtent + re) + " " + (R2.sourceY + R2.leftSmallArcRadius) + "A" + (R2.leftLargeArcRadius + re) + " " + (R2.leftSmallArcRadius + re) + " 0 0 0 " + R2.leftInnerExtent + " " + (R2.sourceY - re) + "L" + R2.sourceX + " " + (R2.sourceY - re) + "L" + R2.sourceX + " " + (R2.sourceY + re) + "L" + R2.leftInnerExtent + " " + (R2.sourceY + re) + "A" + (R2.leftLargeArcRadius - re) + " " + (R2.leftSmallArcRadius - re) + " 0 0 1 " + (R2.leftFullExtent - re) + " " + (R2.sourceY + R2.leftSmallArcRadius) + "L" + (R2.leftFullExtent - re) + " " + R2.verticalLeftInnerExtent + "A" + (R2.leftLargeArcRadius - re) + " " + (R2.leftLargeArcRadius - re) + " 0 0 1 " + R2.leftInnerExtent + " " + (R2.verticalFullExtent - re) + "L" + R2.rightInnerExtent + " " + (R2.verticalFullExtent - re) + "A" + (R2.rightLargeArcRadius - re) + " " + (R2.rightLargeArcRadius - re) + " 0 0 1 " + (R2.rightFullExtent + re) + " " + R2.verticalRightInnerExtent + "L" + (R2.rightFullExtent + re) + " " + (R2.targetY + R2.rightSmallArcRadius) + "A" + (R2.rightLargeArcRadius - re) + " " + (R2.rightSmallArcRadius - re) + " 0 0 1 " + R2.rightInnerExtent + " " + (R2.targetY + re) + "L" + R2.targetX + " " + (R2.targetY + re) + "Z";
          var q, re, R2, z = K2.link.source.x1, H2 = K2.link.target.x0, te = a(z, H2), j = te(0.5), Q2 = te(0.5), Z2 = K2.link.y0 - K2.link.width / 2, ne = K2.link.y0 + K2.link.width / 2, ae = K2.link.y1 - K2.link.width / 2, ue = K2.link.y1 + K2.link.width / 2;
          return "M" + z + "," + Z2 + "C" + j + "," + Z2 + " " + Q2 + "," + ae + " " + H2 + "," + ae + "L" + H2 + "," + ue + "C" + Q2 + "," + ue + " " + j + "," + ne + " " + z + "," + ne + "Z";
        };
      }
      function C2(K2, q) {
        var re = u2(q.color), R2 = l.nodePadAcross, z = K2.nodePad / 2;
        q.dx = q.x1 - q.x0, q.dy = q.y1 - q.y0;
        var H2 = q.dx, te = Math.max(0.5, q.dy), j = "node_" + q.pointNumber;
        return q.group && (j = h.randstr()), q.trace = K2.trace, q.curveNumber = K2.trace.index, { index: q.pointNumber, key: j, partOfGroup: q.partOfGroup || false, group: q.group, traceId: K2.key, trace: K2.trace, node: q, nodePad: K2.nodePad, nodeLineColor: K2.nodeLineColor, nodeLineWidth: K2.nodeLineWidth, textFont: K2.textFont, size: K2.horizontal ? K2.height : K2.width, visibleWidth: Math.ceil(H2), visibleHeight: te, zoneX: -R2, zoneY: -z, zoneWidth: H2 + 2 * R2, zoneHeight: te + 2 * z, labelY: K2.horizontal ? q.dy / 2 + 1 : q.dx / 2 + 1, left: q.originalLayer === 1, sizeAcross: K2.width, forceLayouts: K2.forceLayouts, horizontal: K2.horizontal, darkBackground: re.getBrightness() <= 128, tinyColorHue: c.tinyRGB(re), tinyColorAlpha: re.getAlpha(), valueFormat: K2.valueFormat, valueSuffix: K2.valueSuffix, sankey: K2.sankey, graph: K2.graph, arrangement: K2.arrangement, uniqueNodeLabelPathId: [K2.guid, K2.key, j].join("_"), interactionState: K2.interactionState, figure: K2 };
      }
      function E2(K2) {
        K2.attr("transform", function(q) {
          return p(q.node.x0.toFixed(3), q.node.y0.toFixed(3));
        });
      }
      function F13(K2) {
        K2.call(E2);
      }
      function N2(K2, q) {
        K2.call(F13), q.attr("d", S2());
      }
      function D2(K2) {
        K2.attr("width", function(q) {
          return q.node.x1 - q.node.x0;
        }).attr("height", function(q) {
          return q.visibleHeight;
        });
      }
      function I2(K2) {
        return K2.link.width > 1 || K2.linkLineWidth > 0;
      }
      function O2(K2) {
        return p(K2.translateX, K2.translateY) + (K2.horizontal ? "matrix(1 0 0 1 0 0)" : "matrix(0 1 1 0 0 0)");
      }
      function L2(K2, q, re) {
        K2.on(".basic", null).on("mouseover.basic", function(R2) {
          R2.interactionState.dragInProgress || R2.partOfGroup || (re.hover(this, R2, q), R2.interactionState.hovered = [this, R2]);
        }).on("mousemove.basic", function(R2) {
          R2.interactionState.dragInProgress || R2.partOfGroup || (re.follow(this, R2), R2.interactionState.hovered = [this, R2]);
        }).on("mouseout.basic", function(R2) {
          R2.interactionState.dragInProgress || R2.partOfGroup || (re.unhover(this, R2, q), R2.interactionState.hovered = false);
        }).on("click.basic", function(R2) {
          R2.interactionState.hovered && (re.unhover(this, R2, q), R2.interactionState.hovered = false), R2.interactionState.dragInProgress || R2.partOfGroup || re.select(this, R2, q);
        });
      }
      function V2(K2, q, re, R2) {
        var z = o.behavior.drag().origin(function(H2) {
          return { x: H2.node.x0 + H2.visibleWidth / 2, y: H2.node.y0 + H2.visibleHeight / 2 };
        }).on("dragstart", function(H2) {
          if (H2.arrangement !== "fixed" && (h.ensureSingle(R2._fullLayout._infolayer, "g", "dragcover", function(j) {
            R2._fullLayout._dragCover = j;
          }), h.raiseToTop(this), H2.interactionState.dragInProgress = H2.node, X2(H2.node), H2.interactionState.hovered && (re.nodeEvents.unhover.apply(0, H2.interactionState.hovered), H2.interactionState.hovered = false), H2.arrangement === "snap")) {
            var te = H2.traceId + "|" + H2.key;
            H2.forceLayouts[te] ? H2.forceLayouts[te].alpha(1) : function(j, Q2, Z2, ne) {
              (function(ue) {
                for (var le = 0; le < ue.length; le++) ue[le].y = (ue[le].y0 + ue[le].y1) / 2, ue[le].x = (ue[le].x0 + ue[le].x1) / 2;
              })(Z2.graph.nodes);
              var ae = Z2.graph.nodes.filter(function(ue) {
                return ue.originalX === Z2.node.originalX;
              }).filter(function(ue) {
                return !ue.partOfGroup;
              });
              Z2.forceLayouts[Q2] = n.forceSimulation(ae).alphaDecay(0).force("collide", n.forceCollide().radius(function(ue) {
                return ue.dy / 2 + Z2.nodePad / 2;
              }).strength(1).iterations(l.forceIterations)).force("constrain", /* @__PURE__ */ function(ue, le, ce, se) {
                return function() {
                  for (var he = 0, me = 0; me < ce.length; me++) {
                    var we = ce[me];
                    we === se.interactionState.dragInProgress ? (we.x = we.lastDraggedX, we.y = we.lastDraggedY) : (we.vx = (we.originalX - we.x) / l.forceTicksPerFrame, we.y = Math.min(se.size - we.dy / 2, Math.max(we.dy / 2, we.y))), he = Math.max(he, Math.abs(we.vx), Math.abs(we.vy));
                  }
                  !se.interactionState.dragInProgress && he < 0.1 && se.forceLayouts[le].alpha() > 0 && se.forceLayouts[le].alpha(0);
                };
              }(0, Q2, ae, Z2)).stop();
            }(0, te, H2), function(j, Q2, Z2, ne, ae) {
              window.requestAnimationFrame(function ue() {
                var le;
                for (le = 0; le < l.forceTicksPerFrame; le++) Z2.forceLayouts[ne].tick();
                if (function(se) {
                  for (var he = 0; he < se.length; he++) se[he].y0 = se[he].y - se[he].dy / 2, se[he].y1 = se[he].y0 + se[he].dy, se[he].x0 = se[he].x - se[he].dx / 2, se[he].x1 = se[he].x0 + se[he].dx;
                }(Z2.graph.nodes), Z2.sankey.update(Z2.graph), N2(j.filter(Y2(Z2)), Q2), Z2.forceLayouts[ne].alpha() > 0) window.requestAnimationFrame(ue);
                else {
                  var ce = Z2.node.originalX;
                  Z2.node.x0 = ce - Z2.visibleWidth / 2, Z2.node.x1 = ce + Z2.visibleWidth / 2, W2(Z2, ae);
                }
              });
            }(K2, q, H2, te, R2);
          }
        }).on("drag", function(H2) {
          if (H2.arrangement !== "fixed") {
            var te = o.event.x, j = o.event.y;
            H2.arrangement === "snap" ? (H2.node.x0 = te - H2.visibleWidth / 2, H2.node.x1 = te + H2.visibleWidth / 2, H2.node.y0 = j - H2.visibleHeight / 2, H2.node.y1 = j + H2.visibleHeight / 2) : (H2.arrangement === "freeform" && (H2.node.x0 = te - H2.visibleWidth / 2, H2.node.x1 = te + H2.visibleWidth / 2), j = Math.max(0, Math.min(H2.size - H2.visibleHeight / 2, j)), H2.node.y0 = j - H2.visibleHeight / 2, H2.node.y1 = j + H2.visibleHeight / 2), X2(H2.node), H2.arrangement !== "snap" && (H2.sankey.update(H2.graph), N2(K2.filter(Y2(H2)), q));
          }
        }).on("dragend", function(H2) {
          if (H2.arrangement !== "fixed") {
            H2.interactionState.dragInProgress = false;
            for (var te = 0; te < H2.node.childrenNodes.length; te++) H2.node.childrenNodes[te].x = H2.node.x, H2.node.childrenNodes[te].y = H2.node.y;
            H2.arrangement !== "snap" && W2(H2, R2);
          }
        });
        K2.on(".drag", null).call(z);
      }
      function W2(K2, q) {
        for (var re = [], R2 = [], z = 0; z < K2.graph.nodes.length; z++) {
          var H2 = (K2.graph.nodes[z].x0 + K2.graph.nodes[z].x1) / 2, te = (K2.graph.nodes[z].y0 + K2.graph.nodes[z].y1) / 2;
          re.push(H2 / K2.figure.width), R2.push(te / K2.figure.height);
        }
        y.call("_guiRestyle", q, { "node.x": [re], "node.y": [R2] }, K2.trace.index).then(function() {
          q._fullLayout._dragCover && q._fullLayout._dragCover.remove();
        });
      }
      function X2(K2) {
        K2.lastDraggedX = K2.x0 + K2.dx / 2, K2.lastDraggedY = K2.y0 + K2.dy / 2;
      }
      function Y2(K2) {
        return function(q) {
          return q.node.originalX === K2.node.originalX;
        };
      }
      t.exports = function(K2, q, re, R2, z) {
        var H2 = false;
        h.ensureSingle(K2._fullLayout._infolayer, "g", "first-render", function() {
          H2 = true;
        });
        var te = K2._fullLayout._dragCover, j = re.filter(function(se) {
          return x(se).trace.visible;
        }).map(T2.bind(null, R2)), Q2 = q.selectAll("." + l.cn.sankey).data(j, m);
        Q2.exit().remove(), Q2.enter().append("g").classed(l.cn.sankey, true).style("box-sizing", "content-box").style("position", "absolute").style("left", 0).style("shape-rendering", "geometricPrecision").style("pointer-events", "auto").attr("transform", O2), Q2.each(function(se, he) {
          K2._fullData[he]._sankey = se;
          var me = "bgsankey-" + se.trace.uid + "-" + he;
          h.ensureSingle(K2._fullLayout._draggers, "rect", me), K2._fullData[he]._bgRect = o.select("." + me), K2._fullData[he]._bgRect.style("pointer-events", "all").attr("width", se.width).attr("height", se.height).attr("x", se.translateX).attr("y", se.translateY).classed("bgsankey", true).style({ fill: "transparent", "stroke-width": 0 });
        }), Q2.transition().ease(l.ease).duration(l.duration).attr("transform", O2);
        var Z2 = Q2.selectAll("." + l.cn.sankeyLinks).data(g, m);
        Z2.enter().append("g").classed(l.cn.sankeyLinks, true).style("fill", "none");
        var ne = Z2.selectAll("." + l.cn.sankeyLink).data(function(se) {
          return se.graph.links.filter(function(he) {
            return he.value;
          }).map(A2.bind(null, se));
        }, m);
        ne.enter().append("path").classed(l.cn.sankeyLink, true).call(L2, Q2, z.linkEvents), ne.style("stroke", function(se) {
          return I2(se) ? c.tinyRGB(u2(se.linkLineColor)) : se.tinyColorHue;
        }).style("stroke-opacity", function(se) {
          return I2(se) ? c.opacity(se.linkLineColor) : se.tinyColorAlpha;
        }).style("fill", function(se) {
          return se.tinyColorHue;
        }).style("fill-opacity", function(se) {
          return se.tinyColorAlpha;
        }).style("stroke-width", function(se) {
          return I2(se) ? se.linkLineWidth : 1;
        }).attr("d", S2()), ne.style("opacity", function() {
          return K2._context.staticPlot || H2 || te ? 1 : 0;
        }).transition().ease(l.ease).duration(l.duration).style("opacity", 1), ne.exit().transition().ease(l.ease).duration(l.duration).style("opacity", 0).remove();
        var ae = Q2.selectAll("." + l.cn.sankeyNodeSet).data(g, m);
        ae.enter().append("g").classed(l.cn.sankeyNodeSet, true), ae.style("cursor", function(se) {
          switch (se.arrangement) {
            case "fixed":
              return "default";
            case "perpendicular":
              return "ns-resize";
            default:
              return "move";
          }
        });
        var ue = ae.selectAll("." + l.cn.sankeyNode).data(function(se) {
          var he = se.graph.nodes;
          return function(me) {
            var we, be = [];
            for (we = 0; we < me.length; we++) me[we].originalX = (me[we].x0 + me[we].x1) / 2, me[we].originalY = (me[we].y0 + me[we].y1) / 2, be.indexOf(me[we].originalX) === -1 && be.push(me[we].originalX);
            for (be.sort(function(Ae, pe) {
              return Ae - pe;
            }), we = 0; we < me.length; we++) me[we].originalLayerIndex = be.indexOf(me[we].originalX), me[we].originalLayer = me[we].originalLayerIndex / (be.length - 1);
          }(he), he.map(C2.bind(null, se));
        }, m);
        ue.enter().append("g").classed(l.cn.sankeyNode, true).call(E2).style("opacity", function(se) {
          return !K2._context.staticPlot && !H2 || se.partOfGroup ? 0 : 1;
        }), ue.call(L2, Q2, z.nodeEvents).call(V2, ne, z, K2), ue.transition().ease(l.ease).duration(l.duration).call(E2).style("opacity", function(se) {
          return se.partOfGroup ? 0 : 1;
        }), ue.exit().transition().ease(l.ease).duration(l.duration).style("opacity", 0).remove();
        var le = ue.selectAll("." + l.cn.nodeRect).data(g);
        le.enter().append("rect").classed(l.cn.nodeRect, true).call(D2), le.style("stroke-width", function(se) {
          return se.nodeLineWidth;
        }).style("stroke", function(se) {
          return c.tinyRGB(u2(se.nodeLineColor));
        }).style("stroke-opacity", function(se) {
          return c.opacity(se.nodeLineColor);
        }).style("fill", function(se) {
          return se.tinyColorHue;
        }).style("fill-opacity", function(se) {
          return se.tinyColorAlpha;
        }), le.transition().ease(l.ease).duration(l.duration).call(D2);
        var ce = ue.selectAll("." + l.cn.nodeLabel).data(g);
        ce.enter().append("text").classed(l.cn.nodeLabel, true).style("cursor", "default"), ce.attr("data-notex", 1).text(function(se) {
          return se.node.label;
        }).each(function(se) {
          var he = o.select(this);
          f.font(he, se.textFont), b.convertToTspans(he, K2);
        }).style("text-shadow", b.makeTextShadow(K2._fullLayout.paper_bgcolor)).attr("text-anchor", function(se) {
          return se.horizontal && se.left ? "end" : "start";
        }).attr("transform", function(se) {
          var he = o.select(this), me = b.lineCount(he), we = se.textFont.size * ((me - 1) * k - _4), be = se.nodeLineWidth / 2 + 3, Ae = ((se.horizontal ? se.visibleHeight : se.visibleWidth) - we) / 2;
          se.horizontal && (se.left ? be = -be : be += se.visibleWidth);
          var pe = se.horizontal ? "" : "scale(-1,1)" + d(90);
          return p(se.horizontal ? be : Ae, se.horizontal ? Ae : be) + pe;
        }), ce.transition().ease(l.ease).duration(l.duration);
      };
    }, { "../../components/color": 366, "../../components/drawing": 388, "../../constants/alignment": 471, "../../lib": 503, "../../lib/gup": 500, "../../lib/svg_text_utils": 529, "../../registry": 638, "./constants": 919, "@plotly/d3": 58, "@plotly/d3-sankey": 57, "@plotly/d3-sankey-circular": 56, "d3-force": 111, "d3-interpolate": 116, tinycolor2: 312 }], 924: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a) {
        for (var o = [], s = n.cd[0].trace, i = s._sankey.graph.nodes, l = 0; l < i.length; l++) {
          var u2 = i[l];
          if (!u2.partOfGroup) {
            var c = [(u2.x0 + u2.x1) / 2, (u2.y0 + u2.y1) / 2];
            s.orientation === "v" && c.reverse(), a && a.contains(c, false, l, n) && o.push({ pointNumber: u2.pointNumber });
          }
        }
        return o;
      };
    }, {}], 925: [function(e, t, r) {
      "use strict";
      var n = e("../../lib");
      t.exports = function(a, o) {
        for (var s = 0; s < a.length; s++) a[s].i = s;
        n.mergeArray(o.text, a, "tx"), n.mergeArray(o.texttemplate, a, "txt"), n.mergeArray(o.hovertext, a, "htx"), n.mergeArray(o.customdata, a, "data"), n.mergeArray(o.textposition, a, "tp"), o.textfont && (n.mergeArrayCastPositive(o.textfont.size, a, "ts"), n.mergeArray(o.textfont.color, a, "tc"), n.mergeArray(o.textfont.family, a, "tf"));
        var i = o.marker;
        if (i) {
          n.mergeArrayCastPositive(i.size, a, "ms"), n.mergeArrayCastPositive(i.opacity, a, "mo"), n.mergeArray(i.symbol, a, "mx"), n.mergeArray(i.color, a, "mc");
          var l = i.line;
          i.line && (n.mergeArray(l.color, a, "mlc"), n.mergeArrayCastPositive(l.width, a, "mlw"));
          var u2 = i.gradient;
          u2 && u2.type !== "none" && (n.mergeArray(u2.type, a, "mgt"), n.mergeArray(u2.color, a, "mgc"));
        }
      };
    }, { "../../lib": 503 }], 926: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/cartesian/axis_format_attributes").axisHoverFormat, a = e("../../plots/template_attributes").texttemplateAttrs, o = e("../../plots/template_attributes").hovertemplateAttrs, s = e("../../components/colorscale/attributes"), i = e("../../plots/font_attributes"), l = e("../../components/drawing/attributes").dash, u2 = e("../../components/drawing"), c = e("./constants"), f = e("../../lib/extend").extendFlat;
      t.exports = { x: { valType: "data_array", editType: "calc+clearAxisTypes", anim: true }, x0: { valType: "any", dflt: 0, editType: "calc+clearAxisTypes", anim: true }, dx: { valType: "number", dflt: 1, editType: "calc", anim: true }, y: { valType: "data_array", editType: "calc+clearAxisTypes", anim: true }, y0: { valType: "any", dflt: 0, editType: "calc+clearAxisTypes", anim: true }, dy: { valType: "number", dflt: 1, editType: "calc", anim: true }, xperiod: { valType: "any", dflt: 0, editType: "calc" }, yperiod: { valType: "any", dflt: 0, editType: "calc" }, xperiod0: { valType: "any", editType: "calc" }, yperiod0: { valType: "any", editType: "calc" }, xperiodalignment: { valType: "enumerated", values: ["start", "middle", "end"], dflt: "middle", editType: "calc" }, yperiodalignment: { valType: "enumerated", values: ["start", "middle", "end"], dflt: "middle", editType: "calc" }, xhoverformat: n("x"), yhoverformat: n("y"), stackgroup: { valType: "string", dflt: "", editType: "calc" }, orientation: { valType: "enumerated", values: ["v", "h"], editType: "calc" }, groupnorm: { valType: "enumerated", values: ["", "fraction", "percent"], dflt: "", editType: "calc" }, stackgaps: { valType: "enumerated", values: ["infer zero", "interpolate"], dflt: "infer zero", editType: "calc" }, text: { valType: "string", dflt: "", arrayOk: true, editType: "calc" }, texttemplate: a({}, {}), hovertext: { valType: "string", dflt: "", arrayOk: true, editType: "style" }, mode: { valType: "flaglist", flags: ["lines", "markers", "text"], extras: ["none"], editType: "calc" }, hoveron: { valType: "flaglist", flags: ["points", "fills"], editType: "style" }, hovertemplate: o({}, { keys: c.eventDataKeys }), line: { color: { valType: "color", editType: "style", anim: true }, width: { valType: "number", min: 0, dflt: 2, editType: "style", anim: true }, shape: { valType: "enumerated", values: ["linear", "spline", "hv", "vh", "hvh", "vhv"], dflt: "linear", editType: "plot" }, smoothing: { valType: "number", min: 0, max: 1.3, dflt: 1, editType: "plot" }, dash: f({}, l, { editType: "style" }), simplify: { valType: "boolean", dflt: true, editType: "plot" }, editType: "plot" }, connectgaps: { valType: "boolean", dflt: false, editType: "calc" }, cliponaxis: { valType: "boolean", dflt: true, editType: "plot" }, fill: { valType: "enumerated", values: ["none", "tozeroy", "tozerox", "tonexty", "tonextx", "toself", "tonext"], editType: "calc" }, fillcolor: { valType: "color", editType: "style", anim: true }, marker: f({ symbol: { valType: "enumerated", values: u2.symbolList, dflt: "circle", arrayOk: true, editType: "style" }, opacity: { valType: "number", min: 0, max: 1, arrayOk: true, editType: "style", anim: true }, size: { valType: "number", min: 0, dflt: 6, arrayOk: true, editType: "calc", anim: true }, maxdisplayed: { valType: "number", min: 0, dflt: 0, editType: "plot" }, sizeref: { valType: "number", dflt: 1, editType: "calc" }, sizemin: { valType: "number", min: 0, dflt: 0, editType: "calc" }, sizemode: { valType: "enumerated", values: ["diameter", "area"], dflt: "diameter", editType: "calc" }, line: f({ width: { valType: "number", min: 0, arrayOk: true, editType: "style", anim: true }, editType: "calc" }, s("marker.line", { anim: true })), gradient: { type: { valType: "enumerated", values: ["radial", "horizontal", "vertical", "none"], arrayOk: true, dflt: "none", editType: "calc" }, color: { valType: "color", arrayOk: true, editType: "calc" }, editType: "calc" }, editType: "calc" }, s("marker", { anim: true })), selected: { marker: { opacity: { valType: "number", min: 0, max: 1, editType: "style" }, color: { valType: "color", editType: "style" }, size: { valType: "number", min: 0, editType: "style" }, editType: "style" }, textfont: { color: { valType: "color", editType: "style" }, editType: "style" }, editType: "style" }, unselected: { marker: { opacity: { valType: "number", min: 0, max: 1, editType: "style" }, color: { valType: "color", editType: "style" }, size: { valType: "number", min: 0, editType: "style" }, editType: "style" }, textfont: { color: { valType: "color", editType: "style" }, editType: "style" }, editType: "style" }, textposition: { valType: "enumerated", values: ["top left", "top center", "top right", "middle left", "middle center", "middle right", "bottom left", "bottom center", "bottom right"], dflt: "middle center", arrayOk: true, editType: "calc" }, textfont: i({ editType: "calc", colorEditType: "style", arrayOk: true }) };
    }, { "../../components/colorscale/attributes": 373, "../../components/drawing": 388, "../../components/drawing/attributes": 387, "../../lib/extend": 493, "../../plots/cartesian/axis_format_attributes": 557, "../../plots/font_attributes": 585, "../../plots/template_attributes": 633, "./constants": 930 }], 927: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("../../lib"), o = e("../../plots/cartesian/axes"), s = e("../../plots/cartesian/align_period"), i = e("../../constants/numerical").BADNUM, l = e("./subtypes"), u2 = e("./colorscale_calc"), c = e("./arrays_to_calcdata"), f = e("./calc_selection");
      function h(g, x, b, y, w, _4, k) {
        var T2 = x._length, A2 = g._fullLayout, S2 = b._id, C2 = y._id, E2 = A2._firstScatter[v(x)] === x.uid, F13 = (m(x, A2, b, y) || {}).orientation, N2 = x.fill;
        b._minDtick = 0, y._minDtick = 0;
        var D2 = { padded: true }, I2 = { padded: true };
        k && (D2.ppad = I2.ppad = k);
        var O2 = T2 < 2 || w[0] !== w[T2 - 1] || _4[0] !== _4[T2 - 1];
        O2 && (N2 === "tozerox" || N2 === "tonextx" && (E2 || F13 === "h")) ? D2.tozero = true : (x.error_y || {}).visible || N2 !== "tonexty" && N2 !== "tozeroy" && (l.hasMarkers(x) || l.hasText(x)) || (D2.padded = false, D2.ppad = 0), O2 && (N2 === "tozeroy" || N2 === "tonexty" && (E2 || F13 === "v")) ? I2.tozero = true : N2 !== "tonextx" && N2 !== "tozerox" || (I2.padded = false), S2 && (x._extremes[S2] = o.findExtremes(b, w, D2)), C2 && (x._extremes[C2] = o.findExtremes(y, _4, I2));
      }
      function p(g, x) {
        if (l.hasMarkers(g)) {
          var b, y = g.marker, w = 1.6 * (g.marker.sizeref || 1);
          if (b = g.marker.sizemode === "area" ? function(S2) {
            return Math.max(Math.sqrt((S2 || 0) / w), 3);
          } : function(S2) {
            return Math.max((S2 || 0) / w, 3);
          }, a.isArrayOrTypedArray(y.size)) {
            var _4 = { type: "linear" };
            o.setConvert(_4);
            for (var k = _4.makeCalcdata(g.marker, "size"), T2 = new Array(x), A2 = 0; A2 < x; A2++) T2[A2] = b(k[A2]);
            return T2;
          }
          return b(y.size);
        }
      }
      function d(g, x) {
        var b = v(x), y = g._firstScatter;
        y[b] || (y[b] = x.uid);
      }
      function v(g) {
        var x = g.stackgroup;
        return g.xaxis + g.yaxis + g.type + (x ? "-" + x : "");
      }
      function m(g, x, b, y) {
        var w = g.stackgroup;
        if (w) {
          var _4 = x._scatterStackOpts[b._id + y._id][w], k = _4.orientation === "v" ? y : b;
          return k.type === "linear" || k.type === "log" ? _4 : void 0;
        }
      }
      t.exports = { calc: function(g, x) {
        var b, y, w, _4, k, T2, A2 = g._fullLayout, S2 = o.getFromId(g, x.xaxis || "x"), C2 = o.getFromId(g, x.yaxis || "y"), E2 = S2.makeCalcdata(x, "x"), F13 = C2.makeCalcdata(x, "y"), N2 = s(x, S2, "x", E2), D2 = s(x, C2, "y", F13), I2 = N2.vals, O2 = D2.vals, L2 = x._length, V2 = new Array(L2), W2 = x.ids, X2 = m(x, A2, S2, C2), Y2 = false;
        d(A2, x);
        var K2, q = "x", re = "y";
        X2 ? (a.pushUnique(X2.traceIndices, x._expandedIndex), (b = X2.orientation === "v") ? (re = "s", K2 = "x") : (q = "s", K2 = "y"), k = X2.stackgaps === "interpolate") : h(g, x, S2, C2, I2, O2, p(x, L2));
        var R2 = !!x.xperiodalignment, z = !!x.yperiodalignment;
        for (y = 0; y < L2; y++) {
          var H2 = V2[y] = {}, te = n(I2[y]), j = n(O2[y]);
          te && j ? (H2[q] = I2[y], H2[re] = O2[y], R2 && (H2.orig_x = E2[y], H2.xEnd = N2.ends[y], H2.xStart = N2.starts[y]), z && (H2.orig_y = F13[y], H2.yEnd = D2.ends[y], H2.yStart = D2.starts[y])) : X2 && (b ? te : j) ? (H2[K2] = b ? I2[y] : O2[y], H2.gap = true, k ? (H2.s = i, Y2 = true) : H2.s = 0) : H2[q] = H2[re] = i, W2 && (H2.id = String(W2[y]));
        }
        if (c(V2, x), u2(g, x), f(V2, x), X2) {
          for (y = 0; y < V2.length; ) V2[y][K2] === i ? V2.splice(y, 1) : y++;
          if (a.sort(V2, function(ae, ue) {
            return ae[K2] - ue[K2] || ae.i - ue.i;
          }), Y2) {
            for (y = 0; y < V2.length - 1 && V2[y].gap; ) y++;
            for ((T2 = V2[y].s) || (T2 = V2[y].s = 0), w = 0; w < y; w++) V2[w].s = T2;
            for (_4 = V2.length - 1; _4 > y && V2[_4].gap; ) _4--;
            for (T2 = V2[_4].s, w = V2.length - 1; w > _4; w--) V2[w].s = T2;
            for (; y < _4; ) if (V2[++y].gap) {
              for (w = y + 1; V2[w].gap; ) w++;
              for (var Q2 = V2[y - 1][K2], Z2 = V2[y - 1].s, ne = (V2[w].s - Z2) / (V2[w][K2] - Q2); y < w; ) V2[y].s = Z2 + (V2[y][K2] - Q2) * ne, y++;
            }
          }
        }
        return V2;
      }, calcMarkerSize: p, calcAxisExpansion: h, setFirstScatter: d, getStackOpts: m };
    }, { "../../constants/numerical": 479, "../../lib": 503, "../../plots/cartesian/align_period": 551, "../../plots/cartesian/axes": 554, "./arrays_to_calcdata": 925, "./calc_selection": 928, "./colorscale_calc": 929, "./subtypes": 951, "fast-isnumeric": 190 }], 928: [function(e, t, r) {
      "use strict";
      var n = e("../../lib");
      t.exports = function(a, o) {
        n.isArrayOrTypedArray(o.selectedpoints) && n.tagSelected(a, o);
      };
    }, { "../../lib": 503 }], 929: [function(e, t, r) {
      "use strict";
      var n = e("../../components/colorscale/helpers").hasColorscale, a = e("../../components/colorscale/calc"), o = e("./subtypes");
      t.exports = function(s, i) {
        o.hasLines(i) && n(i, "line") && a(s, i, { vals: i.line.color, containerStr: "line", cLetter: "c" }), o.hasMarkers(i) && (n(i, "marker") && a(s, i, { vals: i.marker.color, containerStr: "marker", cLetter: "c" }), n(i, "marker.line") && a(s, i, { vals: i.marker.line.color, containerStr: "marker.line", cLetter: "c" }));
      };
    }, { "../../components/colorscale/calc": 374, "../../components/colorscale/helpers": 377, "./subtypes": 951 }], 930: [function(e, t, r) {
      "use strict";
      t.exports = { PTS_LINESONLY: 20, minTolerance: 0.2, toleranceGrowth: 10, maxScreensAway: 20, eventDataKeys: [] };
    }, {}], 931: [function(e, t, r) {
      "use strict";
      var n = e("./calc");
      function a(o, s, i, l, u2, c, f) {
        u2[l] = true;
        var h = { i: null, gap: true, s: 0 };
        if (h[f] = i, o.splice(s, 0, h), s && i === o[s - 1][f]) {
          var p = o[s - 1];
          h.s = p.s, h.i = p.i, h.gap = p.gap;
        } else c && (h.s = function(d, v, m, g) {
          var x = d[v - 1], b = d[v + 1];
          return b ? x ? x.s + (b.s - x.s) * (m - x[g]) / (b[g] - x[g]) : b.s : x.s;
        }(o, s, i, f));
        s || (o[0].t = o[1].t, o[0].trace = o[1].trace, delete o[1].t, delete o[1].trace);
      }
      t.exports = function(o, s) {
        var i = s.xaxis, l = s.yaxis, u2 = i._id + l._id, c = o._fullLayout._scatterStackOpts[u2];
        if (c) {
          var f, h, p, d, v, m, g, x, b, y, w, _4, k, T2, A2, S2 = o.calcdata;
          for (var C2 in c) {
            var E2 = (y = c[C2]).traceIndices;
            if (E2.length) {
              for (w = y.stackgaps === "interpolate", _4 = y.groupnorm, y.orientation === "v" ? (k = "x", T2 = "y") : (k = "y", T2 = "x"), A2 = new Array(E2.length), f = 0; f < A2.length; f++) A2[f] = false;
              m = S2[E2[0]];
              var F13 = new Array(m.length);
              for (f = 0; f < m.length; f++) F13[f] = m[f][k];
              for (f = 1; f < E2.length; f++) {
                for (v = S2[E2[f]], h = p = 0; h < v.length; h++) {
                  for (g = v[h][k]; g > F13[p] && p < F13.length; p++) a(v, h, F13[p], f, A2, w, k), h++;
                  if (g !== F13[p]) {
                    for (d = 0; d < f; d++) a(S2[E2[d]], p, g, d, A2, w, k);
                    F13.splice(p, 0, g);
                  }
                  p++;
                }
                for (; p < F13.length; p++) a(v, h, F13[p], f, A2, w, k), h++;
              }
              var N2 = F13.length;
              for (h = 0; h < m.length; h++) {
                for (x = m[h][T2] = m[h].s, f = 1; f < E2.length; f++) (v = S2[E2[f]])[0].trace._rawLength = v[0].trace._length, v[0].trace._length = N2, x += v[h].s, v[h][T2] = x;
                if (_4) for (b = (_4 === "fraction" ? x : x / 100) || 1, f = 0; f < E2.length; f++) {
                  var D2 = S2[E2[f]][h];
                  D2[T2] /= b, D2.sNorm = D2.s / b;
                }
              }
              for (f = 0; f < E2.length; f++) {
                var I2 = (v = S2[E2[f]])[0].trace, O2 = n.calcMarkerSize(I2, I2._rawLength), L2 = Array.isArray(O2);
                if (O2 && A2[f] || L2) {
                  var V2 = O2;
                  for (O2 = new Array(N2), h = 0; h < N2; h++) O2[h] = v[h].gap ? 0 : L2 ? V2[v[h].i] : V2;
                }
                var W2 = new Array(N2), X2 = new Array(N2);
                for (h = 0; h < N2; h++) W2[h] = v[h].x, X2[h] = v[h].y;
                n.calcAxisExpansion(o, I2, i, l, W2, X2, O2), v[0].t.orientation = y.orientation;
              }
            }
          }
        }
      };
    }, { "./calc": 927 }], 932: [function(e, t, r) {
      "use strict";
      t.exports = function(n) {
        for (var a = 0; a < n.length; a++) {
          var o = n[a];
          if (o.type === "scatter") {
            var s = o.fill;
            if (s !== "none" && s !== "toself" && (o.opacity = void 0, s === "tonexty" || s === "tonextx")) for (var i = a - 1; i >= 0; i--) {
              var l = n[i];
              if (l.type === "scatter" && l.xaxis === o.xaxis && l.yaxis === o.yaxis) {
                l.opacity = void 0;
                break;
              }
            }
          }
        }
      };
    }, {}], 933: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../registry"), o = e("./attributes"), s = e("./constants"), i = e("./subtypes"), l = e("./xy_defaults"), u2 = e("./period_defaults"), c = e("./stack_defaults"), f = e("./marker_defaults"), h = e("./line_defaults"), p = e("./line_shape_defaults"), d = e("./text_defaults"), v = e("./fillcolor_defaults");
      t.exports = function(m, g, x, b) {
        function y(E2, F13) {
          return n.coerce(m, g, o, E2, F13);
        }
        var w = l(m, g, b, y);
        if (w || (g.visible = false), g.visible) {
          u2(m, g, b, y), y("xhoverformat"), y("yhoverformat");
          var _4 = c(m, g, b, y), k = !_4 && w < s.PTS_LINESONLY ? "lines+markers" : "lines";
          y("text"), y("hovertext"), y("mode", k), i.hasLines(g) && (h(m, g, x, b, y), p(m, g, y), y("connectgaps"), y("line.simplify")), i.hasMarkers(g) && f(m, g, x, b, y, { gradient: true }), i.hasText(g) && (y("texttemplate"), d(m, g, b, y));
          var T2 = [];
          (i.hasMarkers(g) || i.hasText(g)) && (y("cliponaxis"), y("marker.maxdisplayed"), T2.push("points")), y("fill", _4 ? _4.fillDflt : "none"), g.fill !== "none" && (v(m, g, x, y), i.hasLines(g) || p(m, g, y));
          var A2 = (g.line || {}).color, S2 = (g.marker || {}).color;
          g.fill !== "tonext" && g.fill !== "toself" || T2.push("fills"), y("hoveron", T2.join("+") || "points"), g.hoveron !== "fills" && y("hovertemplate");
          var C2 = a.getComponentMethod("errorbars", "supplyDefaults");
          C2(m, g, A2 || S2 || x, { axis: "y" }), C2(m, g, A2 || S2 || x, { axis: "x", inherit: "y" }), n.coerceSelectionMarkerOpacity(g, y);
        }
      };
    }, { "../../lib": 503, "../../registry": 638, "./attributes": 926, "./constants": 930, "./fillcolor_defaults": 934, "./line_defaults": 939, "./line_shape_defaults": 941, "./marker_defaults": 945, "./period_defaults": 946, "./stack_defaults": 949, "./subtypes": 951, "./text_defaults": 952, "./xy_defaults": 953 }], 934: [function(e, t, r) {
      "use strict";
      var n = e("../../components/color"), a = e("../../lib").isArrayOrTypedArray;
      t.exports = function(o, s, i, l) {
        var u2 = false;
        if (s.marker) {
          var c = s.marker.color, f = (s.marker.line || {}).color;
          c && !a(c) ? u2 = c : f && !a(f) && (u2 = f);
        }
        l("fillcolor", n.addOpacity((s.line || {}).color || u2 || i, 0.5));
      };
    }, { "../../components/color": 366, "../../lib": 503 }], 935: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/cartesian/axes");
      t.exports = function(a, o, s) {
        var i = {}, l = { _fullLayout: s }, u2 = n.getFromTrace(l, o, "x"), c = n.getFromTrace(l, o, "y");
        return i.xLabel = n.tickText(u2, u2.c2l(a.x), true).text, i.yLabel = n.tickText(c, c.c2l(a.y), true).text, i;
      };
    }, { "../../plots/cartesian/axes": 554 }], 936: [function(e, t, r) {
      "use strict";
      var n = e("../../components/color"), a = e("./subtypes");
      t.exports = function(o, s) {
        var i, l;
        if (o.mode === "lines") return (i = o.line.color) && n.opacity(i) ? i : o.fillcolor;
        if (o.mode === "none") return o.fill ? o.fillcolor : "";
        var u2 = s.mcc || (o.marker || {}).color, c = s.mlcc || ((o.marker || {}).line || {}).color;
        return (l = u2 && n.opacity(u2) ? u2 : c && n.opacity(c) && (s.mlw || ((o.marker || {}).line || {}).width) ? c : "") ? n.opacity(l) < 0.3 ? n.addOpacity(l, 0.3) : l : (i = (o.line || {}).color) && n.opacity(i) && a.hasLines(o) && o.line.width ? i : o.fillcolor;
      };
    }, { "../../components/color": 366, "./subtypes": 951 }], 937: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../components/fx"), o = e("../../registry"), s = e("./get_trace_color"), i = e("../../components/color"), l = n.fillText;
      t.exports = function(u2, c, f, h) {
        var p = u2.cd, d = p[0].trace, v = u2.xa, m = u2.ya, g = v.c2p(c), x = m.c2p(f), b = [g, x], y = d.hoveron || "", w = d.mode.indexOf("markers") !== -1 ? 3 : 0.5, _4 = !!d.xperiodalignment, k = !!d.yperiodalignment;
        if (y.indexOf("points") !== -1) {
          var T2 = function(le) {
            var ce = Math.max(w, le.mrc || 0), se = v.c2p(le.x) - g, he = m.c2p(le.y) - x;
            return Math.max(Math.sqrt(se * se + he * he) - ce, 1 - w / ce);
          }, A2 = a.getDistanceFunction(h, function(le) {
            if (_4) {
              var ce = v.c2p(le.xStart), se = v.c2p(le.xEnd);
              return g >= Math.min(ce, se) && g <= Math.max(ce, se) ? 0 : 1 / 0;
            }
            var he = Math.max(3, le.mrc || 0), me = 1 - 1 / he, we = Math.abs(v.c2p(le.x) - g);
            return we < he ? me * we / he : we - he + me;
          }, function(le) {
            if (k) {
              var ce = m.c2p(le.yStart), se = m.c2p(le.yEnd);
              return x >= Math.min(ce, se) && x <= Math.max(ce, se) ? 0 : 1 / 0;
            }
            var he = Math.max(3, le.mrc || 0), me = 1 - 1 / he, we = Math.abs(m.c2p(le.y) - x);
            return we < he ? me * we / he : we - he + me;
          }, T2);
          if (a.getClosest(p, A2, u2), u2.index !== false) {
            var S2 = p[u2.index], C2 = v.c2p(S2.x, true), E2 = m.c2p(S2.y, true), F13 = S2.mrc || 1;
            u2.index = S2.i;
            var N2 = p[0].t.orientation, D2 = N2 && (S2.sNorm || S2.s), I2 = N2 === "h" ? D2 : S2.orig_x !== void 0 ? S2.orig_x : S2.x, O2 = N2 === "v" ? D2 : S2.orig_y !== void 0 ? S2.orig_y : S2.y;
            return n.extendFlat(u2, { color: s(d, S2), x0: C2 - F13, x1: C2 + F13, xLabelVal: I2, y0: E2 - F13, y1: E2 + F13, yLabelVal: O2, spikeDistance: T2(S2), hovertemplate: d.hovertemplate }), l(S2, d, u2), o.getComponentMethod("errorbars", "hoverInfo")(S2, d, u2), [u2];
          }
        }
        if (y.indexOf("fills") !== -1 && d._polygons) {
          var L2, V2, W2, X2, Y2, K2, q, re, R2, z = d._polygons, H2 = [], te = false, j = 1 / 0, Q2 = -1 / 0, Z2 = 1 / 0, ne = -1 / 0;
          for (L2 = 0; L2 < z.length; L2++) (W2 = z[L2]).contains(b) && (te = !te, H2.push(W2), Z2 = Math.min(Z2, W2.ymin), ne = Math.max(ne, W2.ymax));
          if (te) {
            var ae = ((Z2 = Math.max(Z2, 0)) + (ne = Math.min(ne, m._length))) / 2;
            for (L2 = 0; L2 < H2.length; L2++) for (X2 = H2[L2].pts, V2 = 1; V2 < X2.length; V2++) (re = X2[V2 - 1][1]) > ae != (R2 = X2[V2][1]) >= ae && (K2 = X2[V2 - 1][0], q = X2[V2][0], R2 - re && (Y2 = K2 + (q - K2) * (ae - re) / (R2 - re), j = Math.min(j, Y2), Q2 = Math.max(Q2, Y2)));
            j = Math.max(j, 0), Q2 = Math.min(Q2, v._length);
            var ue = i.defaultLine;
            return i.opacity(d.fillcolor) ? ue = d.fillcolor : i.opacity((d.line || {}).color) && (ue = d.line.color), n.extendFlat(u2, { distance: u2.maxHoverDistance, x0: j, x1: Q2, y0: ae, y1: ae, color: ue, hovertemplate: false }), delete u2.index, d.text && !Array.isArray(d.text) ? u2.text = String(d.text) : u2.text = d.name, [u2];
          }
        }
      };
    }, { "../../components/color": 366, "../../components/fx": 406, "../../lib": 503, "../../registry": 638, "./get_trace_color": 936 }], 938: [function(e, t, r) {
      "use strict";
      var n = e("./subtypes");
      t.exports = { hasLines: n.hasLines, hasMarkers: n.hasMarkers, hasText: n.hasText, isBubble: n.isBubble, attributes: e("./attributes"), supplyDefaults: e("./defaults"), crossTraceDefaults: e("./cross_trace_defaults"), calc: e("./calc").calc, crossTraceCalc: e("./cross_trace_calc"), arraysToCalcdata: e("./arrays_to_calcdata"), plot: e("./plot"), colorbar: e("./marker_colorbar"), formatLabels: e("./format_labels"), style: e("./style").style, styleOnSelect: e("./style").styleOnSelect, hoverPoints: e("./hover"), selectPoints: e("./select"), animatable: true, moduleType: "trace", name: "scatter", basePlotModule: e("../../plots/cartesian"), categories: ["cartesian", "svg", "symbols", "errorBarsOK", "showLegend", "scatter-like", "zoomScale"], meta: {} };
    }, { "../../plots/cartesian": 568, "./arrays_to_calcdata": 925, "./attributes": 926, "./calc": 927, "./cross_trace_calc": 931, "./cross_trace_defaults": 932, "./defaults": 933, "./format_labels": 935, "./hover": 937, "./marker_colorbar": 944, "./plot": 947, "./select": 948, "./style": 950, "./subtypes": 951 }], 939: [function(e, t, r) {
      "use strict";
      var n = e("../../lib").isArrayOrTypedArray, a = e("../../components/colorscale/helpers").hasColorscale, o = e("../../components/colorscale/defaults");
      t.exports = function(s, i, l, u2, c, f) {
        var h = (s.marker || {}).color;
        c("line.color", l), a(s, "line") ? o(s, i, u2, c, { prefix: "line.", cLetter: "c" }) : c("line.color", !n(h) && h || l), c("line.width"), (f || {}).noDash || c("line.dash");
      };
    }, { "../../components/colorscale/defaults": 376, "../../components/colorscale/helpers": 377, "../../lib": 503 }], 940: [function(e, t, r) {
      "use strict";
      var n = e("../../constants/numerical"), a = n.BADNUM, o = n.LOG_CLIP, s = o + 0.5, i = o - 0.5, l = e("../../lib"), u2 = l.segmentsIntersect, c = l.constrain, f = e("./constants");
      t.exports = function(h, p) {
        var d, v, m, g, x, b, y, w, _4, k, T2, A2, S2, C2, E2, F13, N2, D2, I2 = p.xaxis, O2 = p.yaxis, L2 = I2.type === "log", V2 = O2.type === "log", W2 = I2._length, X2 = O2._length, Y2 = p.connectGaps, K2 = p.baseTolerance, q = p.shape, re = q === "linear", R2 = p.fill && p.fill !== "none", z = [], H2 = f.minTolerance, te = h.length, j = new Array(te), Q2 = 0;
        function Z2(ot) {
          var mt = h[ot];
          if (!mt) return false;
          var wt = p.linearized ? I2.l2p(mt.x) : I2.c2p(mt.x), Et = p.linearized ? O2.l2p(mt.y) : O2.c2p(mt.y);
          if (wt === a) {
            if (L2 && (wt = I2.c2p(mt.x, true)), wt === a) return false;
            V2 && Et === a && (wt *= Math.abs(I2._m * X2 * (I2._m > 0 ? s : i) / (O2._m * W2 * (O2._m > 0 ? s : i)))), wt *= 1e3;
          }
          if (Et === a) {
            if (V2 && (Et = O2.c2p(mt.y, true)), Et === a) return false;
            Et *= 1e3;
          }
          return [wt, Et];
        }
        function ne(ot, mt, wt, Et) {
          var zt = wt - ot, Nt = Et - mt, yt = 0.5 - ot, pt = 0.5 - mt, Ot = zt * zt + Nt * Nt, Jt = zt * yt + Nt * pt;
          if (Jt > 0 && Jt < Ot) {
            var tr = yt * Nt - pt * zt;
            if (tr * tr < Ot) return true;
          }
        }
        function ae(ot, mt) {
          var wt = ot[0] / W2, Et = ot[1] / X2, zt = Math.max(0, -wt, wt - 1, -Et, Et - 1);
          return zt && N2 !== void 0 && ne(wt, Et, N2, D2) && (zt = 0), zt && mt && ne(wt, Et, mt[0] / W2, mt[1] / X2) && (zt = 0), (1 + f.toleranceGrowth * zt) * K2;
        }
        function ue(ot, mt) {
          var wt = ot[0] - mt[0], Et = ot[1] - mt[1];
          return Math.sqrt(wt * wt + Et * Et);
        }
        var le, ce, se, he, me, we, be, Ae = f.maxScreensAway, pe = -W2 * Ae, ve = W2 * (1 + Ae), Ee = -X2 * Ae, Se = X2 * (1 + Ae), Ce = [[pe, Ee, ve, Ee], [ve, Ee, ve, Se], [ve, Se, pe, Se], [pe, Se, pe, Ee]];
        function Be(ot) {
          if (ot[0] < pe || ot[0] > ve || ot[1] < Ee || ot[1] > Se) return [c(ot[0], pe, ve), c(ot[1], Ee, Se)];
        }
        function Ue(ot, mt) {
          return ot[0] === mt[0] && (ot[0] === pe || ot[0] === ve) || ot[1] === mt[1] && (ot[1] === Ee || ot[1] === Se) || void 0;
        }
        function Ke(ot, mt, wt) {
          return function(Et, zt) {
            var Nt = Be(Et), yt = Be(zt), pt = [];
            if (Nt && yt && Ue(Nt, yt)) return pt;
            Nt && pt.push(Nt), yt && pt.push(yt);
            var Ot = 2 * l.constrain((Et[ot] + zt[ot]) / 2, mt, wt) - ((Nt || Et)[ot] + (yt || zt)[ot]);
            return Ot && ((Nt && yt ? Ot > 0 == Nt[ot] > yt[ot] ? Nt : yt : Nt || yt)[ot] += Ot), pt;
          };
        }
        function ct(ot) {
          var mt = ot[0], wt = ot[1], Et = mt === j[Q2 - 1][0], zt = wt === j[Q2 - 1][1];
          if (!Et || !zt) if (Q2 > 1) {
            var Nt = mt === j[Q2 - 2][0], yt = wt === j[Q2 - 2][1];
            Et && (mt === pe || mt === ve) && Nt ? yt ? Q2-- : j[Q2 - 1] = ot : zt && (wt === Ee || wt === Se) && yt ? Nt ? Q2-- : j[Q2 - 1] = ot : j[Q2++] = ot;
          } else j[Q2++] = ot;
        }
        function We(ot) {
          j[Q2 - 1][0] !== ot[0] && j[Q2 - 1][1] !== ot[1] && ct([se, he]), ct(ot), me = null, se = he = 0;
        }
        function Ze(ot) {
          if (N2 = ot[0] / W2, D2 = ot[1] / X2, le = ot[0] < pe ? pe : ot[0] > ve ? ve : 0, ce = ot[1] < Ee ? Ee : ot[1] > Se ? Se : 0, le || ce) {
            if (Q2) if (me) {
              var mt = be(me, ot);
              mt.length > 1 && (We(mt[0]), j[Q2++] = mt[1]);
            } else we = be(j[Q2 - 1], ot)[0], j[Q2++] = we;
            else j[Q2++] = [le || ot[0], ce || ot[1]];
            var wt = j[Q2 - 1];
            le && ce && (wt[0] !== le || wt[1] !== ce) ? (me && (se !== le && he !== ce ? ct(se && he ? (Et = me, Nt = (zt = ot)[0] - Et[0], yt = (zt[1] - Et[1]) / Nt, (Et[1] * zt[0] - zt[1] * Et[0]) / Nt > 0 ? [yt > 0 ? pe : ve, Se] : [yt > 0 ? ve : pe, Ee]) : [se || le, he || ce]) : se && he && ct([se, he])), ct([le, ce])) : se - le && he - ce && ct([le || se, ce || he]), me = ot, se = le, he = ce;
          } else me && We(be(me, ot)[0]), j[Q2++] = ot;
          var Et, zt, Nt, yt;
        }
        for (q === "linear" || q === "spline" ? be = function(ot, mt) {
          for (var wt = [], Et = 0, zt = 0; zt < 4; zt++) {
            var Nt = Ce[zt], yt = u2(ot[0], ot[1], mt[0], mt[1], Nt[0], Nt[1], Nt[2], Nt[3]);
            yt && (!Et || Math.abs(yt.x - wt[0][0]) > 1 || Math.abs(yt.y - wt[0][1]) > 1) && (yt = [yt.x, yt.y], Et && ue(yt, ot) < ue(wt[0], ot) ? wt.unshift(yt) : wt.push(yt), Et++);
          }
          return wt;
        } : q === "hv" || q === "vh" ? be = function(ot, mt) {
          var wt = [], Et = Be(ot), zt = Be(mt);
          return Et && zt && Ue(Et, zt) || (Et && wt.push(Et), zt && wt.push(zt)), wt;
        } : q === "hvh" ? be = Ke(0, pe, ve) : q === "vhv" && (be = Ke(1, Ee, Se)), d = 0; d < te; d++) if (v = Z2(d)) {
          for (Q2 = 0, me = null, Ze(v), d++; d < te; d++) {
            if (!(g = Z2(d))) {
              if (Y2) continue;
              break;
            }
            if (re && p.simplify) {
              var it = Z2(d + 1);
              if (k = ue(g, v), R2 && (Q2 === 0 || Q2 === te - 1) || !(k < ae(g, it) * H2)) {
                for (w = [(g[0] - v[0]) / k, (g[1] - v[1]) / k], x = v, T2 = k, A2 = C2 = E2 = 0, y = false, m = g, d++; d < h.length; d++) {
                  if (b = it, it = Z2(d + 1), !b) {
                    if (Y2) continue;
                    break;
                  }
                  if (F13 = (_4 = [b[0] - v[0], b[1] - v[1]])[0] * w[1] - _4[1] * w[0], C2 = Math.min(C2, F13), (E2 = Math.max(E2, F13)) - C2 > ae(b, it)) break;
                  m = b, (S2 = _4[0] * w[0] + _4[1] * w[1]) > T2 ? (T2 = S2, g = b, y = false) : S2 < A2 && (A2 = S2, x = b, y = true);
                }
                if (y ? (Ze(g), m !== x && Ze(x)) : (x !== v && Ze(x), m !== g && Ze(g)), Ze(m), d >= h.length || !b) break;
                Ze(b), v = b;
              }
            } else Ze(g);
          }
          me && ct([se || me[0], he || me[1]]), z.push(j.slice(0, Q2));
        }
        return z;
      };
    }, { "../../constants/numerical": 479, "../../lib": 503, "./constants": 930 }], 941: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a, o) {
        o("line.shape") === "spline" && o("line.smoothing");
      };
    }, {}], 942: [function(e, t, r) {
      "use strict";
      var n = { tonextx: 1, tonexty: 1, tonext: 1 };
      t.exports = function(a, o, s) {
        var i, l, u2, c, f, h = {}, p = false, d = -1, v = 0, m = -1;
        for (l = 0; l < s.length; l++) (u2 = (i = s[l][0].trace).stackgroup || "") ? u2 in h ? f = h[u2] : (f = h[u2] = v, v++) : i.fill in n && m >= 0 ? f = m : (f = m = v, v++), f < d && (p = true), i._groupIndex = d = f;
        var g = s.slice();
        p && g.sort(function(b, y) {
          var w = b[0].trace, _4 = y[0].trace;
          return w._groupIndex - _4._groupIndex || w.index - _4.index;
        });
        var x = {};
        for (l = 0; l < g.length; l++) u2 = (i = g[l][0].trace).stackgroup || "", i.visible === true ? (i._nexttrace = null, i.fill in n && (c = x[u2], i._prevtrace = c || null, c && (c._nexttrace = i)), i._ownfill = i.fill && (i.fill.substr(0, 6) === "tozero" || i.fill === "toself" || i.fill.substr(0, 2) === "to" && !i._prevtrace), x[u2] = i) : i._prevtrace = i._nexttrace = i._ownfill = null;
        return g;
      };
    }, {}], 943: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric");
      t.exports = function(a, o) {
        o || (o = 2);
        var s = a.marker, i = s.sizeref || 1, l = s.sizemin || 0, u2 = s.sizemode === "area" ? function(c) {
          return Math.sqrt(c / i);
        } : function(c) {
          return c / i;
        };
        return function(c) {
          var f = u2(c / o);
          return n(f) && f > 0 ? Math.max(f, l) : 0;
        };
      };
    }, { "fast-isnumeric": 190 }], 944: [function(e, t, r) {
      "use strict";
      t.exports = { container: "marker", min: "cmin", max: "cmax" };
    }, {}], 945: [function(e, t, r) {
      "use strict";
      var n = e("../../components/color"), a = e("../../components/colorscale/helpers").hasColorscale, o = e("../../components/colorscale/defaults"), s = e("./subtypes");
      t.exports = function(i, l, u2, c, f, h) {
        var p = s.isBubble(i), d = (i.line || {}).color;
        h = h || {}, d && (u2 = d), f("marker.symbol"), f("marker.opacity", p ? 0.7 : 1), f("marker.size"), f("marker.color", u2), a(i, "marker") && o(i, l, c, f, { prefix: "marker.", cLetter: "c" }), h.noSelect || (f("selected.marker.color"), f("unselected.marker.color"), f("selected.marker.size"), f("unselected.marker.size")), h.noLine || (f("marker.line.color", d && !Array.isArray(d) && l.marker.color !== d ? d : p ? n.background : n.defaultLine), a(i, "marker.line") && o(i, l, c, f, { prefix: "marker.line.", cLetter: "c" }), f("marker.line.width", p ? 1 : 0)), p && (f("marker.sizeref"), f("marker.sizemin"), f("marker.sizemode")), h.gradient && f("marker.gradient.type") !== "none" && f("marker.gradient.color");
      };
    }, { "../../components/color": 366, "../../components/colorscale/defaults": 376, "../../components/colorscale/helpers": 377, "./subtypes": 951 }], 946: [function(e, t, r) {
      "use strict";
      var n = e("../../lib").dateTick0, a = e("../../constants/numerical").ONEWEEK;
      function o(s, i) {
        return n(i, s % a == 0 ? 1 : 0);
      }
      t.exports = function(s, i, l, u2, c) {
        if (c || (c = { x: true, y: true }), c.x) {
          var f = u2("xperiod");
          f && (u2("xperiod0", o(f, i.xcalendar)), u2("xperiodalignment"));
        }
        if (c.y) {
          var h = u2("yperiod");
          h && (u2("yperiod0", o(h, i.ycalendar)), u2("yperiodalignment"));
        }
      };
    }, { "../../constants/numerical": 479, "../../lib": 503 }], 947: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../registry"), o = e("../../lib"), s = o.ensureSingle, i = o.identity, l = e("../../components/drawing"), u2 = e("./subtypes"), c = e("./line_points"), f = e("./link_traces"), h = e("../../lib/polygon").tester;
      function p(d, v, m, g, x, b, y) {
        var w;
        (function(ve, Ee, Se, Ce, Be) {
          var Ue = Se.xaxis, Ke = Se.yaxis, ct = n.extent(o.simpleMap(Ue.range, Ue.r2c)), We = n.extent(o.simpleMap(Ke.range, Ke.r2c)), Ze = Ce[0].trace;
          if (!!u2.hasMarkers(Ze)) {
            var it = Ze.marker.maxdisplayed;
            if (it !== 0) {
              var ot = Ce.filter(function(zt) {
                return zt.x >= ct[0] && zt.x <= ct[1] && zt.y >= We[0] && zt.y <= We[1];
              }), mt = Math.ceil(ot.length / it), wt = 0;
              Be.forEach(function(zt, Nt) {
                var yt = zt[0].trace;
                u2.hasMarkers(yt) && yt.marker.maxdisplayed > 0 && Nt < Ee && wt++;
              });
              var Et = Math.round(wt * mt / 3 + Math.floor(wt / 3) * mt / 7.1);
              Ce.forEach(function(zt) {
                delete zt.vis;
              }), ot.forEach(function(zt, Nt) {
                Math.round((Nt + Et) % mt) === 0 && (zt.vis = true);
              });
            }
          }
        })(0, v, m, g, x);
        var _4 = !!y && y.duration > 0;
        function k(ve) {
          return _4 ? ve.transition() : ve;
        }
        var T2 = m.xaxis, A2 = m.yaxis, S2 = g[0].trace, C2 = S2.line, E2 = n.select(b), F13 = s(E2, "g", "errorbars"), N2 = s(E2, "g", "lines"), D2 = s(E2, "g", "points"), I2 = s(E2, "g", "text");
        if (a.getComponentMethod("errorbars", "plot")(d, F13, m, y), S2.visible === true) {
          var O2, L2;
          k(E2).style("opacity", S2.opacity);
          var V2 = S2.fill.charAt(S2.fill.length - 1);
          V2 !== "x" && V2 !== "y" && (V2 = ""), g[0][m.isRangePlot ? "nodeRangePlot3" : "node3"] = E2;
          var W2, X2, Y2 = "", K2 = [], q = S2._prevtrace;
          q && (Y2 = q._prevRevpath || "", L2 = q._nextFill, K2 = q._polygons);
          var re, R2, z, H2, te, j, Q2, Z2 = "", ne = "", ae = [], ue = o.noop;
          if (O2 = S2._ownFill, u2.hasLines(S2) || S2.fill !== "none") {
            for (L2 && L2.datum(g), ["hv", "vh", "hvh", "vhv"].indexOf(C2.shape) !== -1 ? (re = l.steps(C2.shape), R2 = l.steps(C2.shape.split("").reverse().join(""))) : re = R2 = C2.shape === "spline" ? function(ve) {
              var Ee = ve[ve.length - 1];
              return ve.length > 1 && ve[0][0] === Ee[0] && ve[0][1] === Ee[1] ? l.smoothclosed(ve.slice(1), C2.smoothing) : l.smoothopen(ve, C2.smoothing);
            } : function(ve) {
              return "M" + ve.join("L");
            }, z = function(ve) {
              return R2(ve.reverse());
            }, ae = c(g, { xaxis: T2, yaxis: A2, connectGaps: S2.connectgaps, baseTolerance: Math.max(C2.width || 1, 3) / 4, shape: C2.shape, simplify: C2.simplify, fill: S2.fill }), Q2 = S2._polygons = new Array(ae.length), w = 0; w < ae.length; w++) S2._polygons[w] = h(ae[w]);
            ae.length && (H2 = ae[0][0], j = (te = ae[ae.length - 1])[te.length - 1]), ue = function(ve) {
              return function(Ee) {
                if (W2 = re(Ee), X2 = z(Ee), Z2 ? V2 ? (Z2 += "L" + W2.substr(1), ne = X2 + "L" + ne.substr(1)) : (Z2 += "Z" + W2, ne = X2 + "Z" + ne) : (Z2 = W2, ne = X2), u2.hasLines(S2) && Ee.length > 1) {
                  var Se = n.select(this);
                  if (Se.datum(g), ve) k(Se.style("opacity", 0).attr("d", W2).call(l.lineGroupStyle)).style("opacity", 1);
                  else {
                    var Ce = k(Se);
                    Ce.attr("d", W2), l.singleLineStyle(g, Ce);
                  }
                }
              };
            };
          }
          var le = N2.selectAll(".js-line").data(ae);
          k(le.exit()).style("opacity", 0).remove(), le.each(ue(false)), le.enter().append("path").classed("js-line", true).style("vector-effect", "non-scaling-stroke").call(l.lineGroupStyle).each(ue(true)), l.setClipUrl(le, m.layerClipId, d), ae.length ? (O2 ? (O2.datum(g), H2 && j && (V2 ? (V2 === "y" ? H2[1] = j[1] = A2.c2p(0, true) : V2 === "x" && (H2[0] = j[0] = T2.c2p(0, true)), k(O2).attr("d", "M" + j + "L" + H2 + "L" + Z2.substr(1)).call(l.singleFillStyle)) : k(O2).attr("d", Z2 + "Z").call(l.singleFillStyle))) : L2 && (S2.fill.substr(0, 6) === "tonext" && Z2 && Y2 ? (S2.fill === "tonext" ? k(L2).attr("d", Z2 + "Z" + Y2 + "Z").call(l.singleFillStyle) : k(L2).attr("d", Z2 + "L" + Y2.substr(1) + "Z").call(l.singleFillStyle), S2._polygons = S2._polygons.concat(K2)) : (se(L2), S2._polygons = null)), S2._prevRevpath = ne, S2._prevPolygons = Q2) : (O2 ? se(O2) : L2 && se(L2), S2._polygons = S2._prevRevpath = S2._prevPolygons = null), D2.datum(g), I2.datum(g), function(ve, Ee, Se) {
            var Ce, Be = Se[0].trace, Ue = u2.hasMarkers(Be), Ke = u2.hasText(Be), ct = Ae(Be), We = pe, Ze = pe;
            if (Ue || Ke) {
              var it = i, ot = Be.stackgroup, mt = ot && d._fullLayout._scatterStackOpts[T2._id + A2._id][ot].stackgaps === "infer zero";
              Be.marker.maxdisplayed || Be._needsCull ? it = mt ? me : he : ot && !mt && (it = we), Ue && (We = it), Ke && (Ze = it);
            }
            var wt, Et = (Ce = ve.selectAll("path.point").data(We, ct)).enter().append("path").classed("point", true);
            _4 && Et.call(l.pointStyle, Be, d).call(l.translatePoints, T2, A2).style("opacity", 0).transition().style("opacity", 1), Ce.order(), Ue && (wt = l.makePointStyleFns(Be)), Ce.each(function(zt) {
              var Nt = n.select(this), yt = k(Nt);
              l.translatePoint(zt, yt, T2, A2) ? (l.singlePointStyle(zt, yt, Be, wt, d), m.layerClipId && l.hideOutsideRangePoint(zt, yt, T2, A2, Be.xcalendar, Be.ycalendar), Be.customdata && Nt.classed("plotly-customdata", zt.data !== null && zt.data !== void 0)) : yt.remove();
            }), _4 ? Ce.exit().transition().style("opacity", 0).remove() : Ce.exit().remove(), (Ce = Ee.selectAll("g").data(Ze, ct)).enter().append("g").classed("textpoint", true).append("text"), Ce.order(), Ce.each(function(zt) {
              var Nt = n.select(this), yt = k(Nt.select("text"));
              l.translatePoint(zt, yt, T2, A2) ? m.layerClipId && l.hideOutsideRangePoint(zt, Nt, T2, A2, Be.xcalendar, Be.ycalendar) : Nt.remove();
            }), Ce.selectAll("text").call(l.textPointStyle, Be, d).each(function(zt) {
              var Nt = T2.c2p(zt.x), yt = A2.c2p(zt.y);
              n.select(this).selectAll("tspan.line").each(function() {
                k(n.select(this)).attr({ x: Nt, y: yt });
              });
            }), Ce.exit().remove();
          }(D2, I2, g);
          var ce = S2.cliponaxis === false ? null : m.layerClipId;
          l.setClipUrl(D2, ce, d), l.setClipUrl(I2, ce, d);
        }
        function se(ve) {
          k(ve).attr("d", "M0,0Z");
        }
        function he(ve) {
          return ve.filter(function(Ee) {
            return !Ee.gap && Ee.vis;
          });
        }
        function me(ve) {
          return ve.filter(function(Ee) {
            return Ee.vis;
          });
        }
        function we(ve) {
          return ve.filter(function(Ee) {
            return !Ee.gap;
          });
        }
        function be(ve) {
          return ve.id;
        }
        function Ae(ve) {
          if (ve.ids) return be;
        }
        function pe() {
          return false;
        }
      }
      t.exports = function(d, v, m, g, x, b) {
        var y, w, _4 = !x, k = !!x && x.duration > 0, T2 = f(d, v, m);
        (y = g.selectAll("g.trace").data(T2, function(A2) {
          return A2[0].trace.uid;
        })).enter().append("g").attr("class", function(A2) {
          return "trace scatter trace" + A2[0].trace.uid;
        }).style("stroke-miterlimit", 2), y.order(), function(A2, S2, C2) {
          S2.each(function(E2) {
            var F13 = s(n.select(this), "g", "fills");
            l.setClipUrl(F13, C2.layerClipId, A2);
            var N2 = E2[0].trace, D2 = [];
            N2._ownfill && D2.push("_ownFill"), N2._nexttrace && D2.push("_nextFill");
            var I2 = F13.selectAll("g").data(D2, i);
            I2.enter().append("g"), I2.exit().each(function(O2) {
              N2[O2] = null;
            }).remove(), I2.order().each(function(O2) {
              N2[O2] = s(n.select(this), "path", "js-fill");
            });
          });
        }(d, y, v), k ? (b && (w = b()), n.transition().duration(x.duration).ease(x.easing).each("end", function() {
          w && w();
        }).each("interrupt", function() {
          w && w();
        }).each(function() {
          g.selectAll("g.trace").each(function(A2, S2) {
            p(d, S2, v, A2, T2, this, x);
          });
        })) : y.each(function(A2, S2) {
          p(d, S2, v, A2, T2, this, x);
        }), _4 && y.exit().remove(), g.selectAll("path:not([d])").remove();
      };
    }, { "../../components/drawing": 388, "../../lib": 503, "../../lib/polygon": 515, "../../registry": 638, "./line_points": 940, "./link_traces": 942, "./subtypes": 951, "@plotly/d3": 58 }], 948: [function(e, t, r) {
      "use strict";
      var n = e("./subtypes");
      t.exports = function(a, o) {
        var s, i, l, u2, c = a.cd, f = a.xaxis, h = a.yaxis, p = [], d = c[0].trace;
        if (!n.hasMarkers(d) && !n.hasText(d)) return [];
        if (o === false) for (s = 0; s < c.length; s++) c[s].selected = 0;
        else for (s = 0; s < c.length; s++) i = c[s], l = f.c2p(i.x), u2 = h.c2p(i.y), i.i !== null && o.contains([l, u2], false, s, a) ? (p.push({ pointNumber: i.i, x: f.c2d(i.x), y: h.c2d(i.y) }), i.selected = 1) : i.selected = 0;
        return p;
      };
    }, { "./subtypes": 951 }], 949: [function(e, t, r) {
      "use strict";
      var n = ["orientation", "groupnorm", "stackgaps"];
      t.exports = function(a, o, s, i) {
        var l = s._scatterStackOpts, u2 = i("stackgroup");
        if (u2) {
          var c = o.xaxis + o.yaxis, f = l[c];
          f || (f = l[c] = {});
          var h = f[u2], p = false;
          h ? h.traces.push(o) : (h = f[u2] = { traceIndices: [], traces: [o] }, p = true);
          for (var d = { orientation: o.x && !o.y ? "h" : "v" }, v = 0; v < n.length; v++) {
            var m = n[v], g = m + "Found";
            if (!h[g]) {
              var x = a[m] !== void 0, b = m === "orientation";
              if ((x || p) && (h[m] = i(m, d[m]), b && (h.fillDflt = h[m] === "h" ? "tonextx" : "tonexty"), x && (h[g] = true, !p && (delete h.traces[0][m], b)))) for (var y = 0; y < h.traces.length - 1; y++) {
                var w = h.traces[y];
                w._input.fill !== w.fill && (w.fill = h.fillDflt);
              }
            }
          }
          return h;
        }
      };
    }, {}], 950: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../components/drawing"), o = e("../../registry");
      function s(l, u2, c) {
        a.pointStyle(l.selectAll("path.point"), u2, c);
      }
      function i(l, u2, c) {
        a.textPointStyle(l.selectAll("text"), u2, c);
      }
      t.exports = { style: function(l) {
        var u2 = n.select(l).selectAll("g.trace.scatter");
        u2.style("opacity", function(c) {
          return c[0].trace.opacity;
        }), u2.selectAll("g.points").each(function(c) {
          s(n.select(this), c.trace || c[0].trace, l);
        }), u2.selectAll("g.text").each(function(c) {
          i(n.select(this), c.trace || c[0].trace, l);
        }), u2.selectAll("g.trace path.js-line").call(a.lineGroupStyle), u2.selectAll("g.trace path.js-fill").call(a.fillGroupStyle), o.getComponentMethod("errorbars", "style")(u2);
      }, stylePoints: s, styleText: i, styleOnSelect: function(l, u2, c) {
        var f = u2[0].trace;
        f.selectedpoints ? (a.selectedPointStyle(c.selectAll("path.point"), f), a.selectedTextStyle(c.selectAll("text"), f)) : (s(c, f, l), i(c, f, l));
      } };
    }, { "../../components/drawing": 388, "../../registry": 638, "@plotly/d3": 58 }], 951: [function(e, t, r) {
      "use strict";
      var n = e("../../lib");
      t.exports = { hasLines: function(a) {
        return a.visible && a.mode && a.mode.indexOf("lines") !== -1;
      }, hasMarkers: function(a) {
        return a.visible && (a.mode && a.mode.indexOf("markers") !== -1 || a.type === "splom");
      }, hasText: function(a) {
        return a.visible && a.mode && a.mode.indexOf("text") !== -1;
      }, isBubble: function(a) {
        return n.isPlainObject(a.marker) && n.isArrayOrTypedArray(a.marker.size);
      } };
    }, { "../../lib": 503 }], 952: [function(e, t, r) {
      "use strict";
      var n = e("../../lib");
      t.exports = function(a, o, s, i, l) {
        l = l || {}, i("textposition"), n.coerceFont(i, "textfont", s.font), l.noSelect || (i("selected.textfont.color"), i("unselected.textfont.color"));
      };
    }, { "../../lib": 503 }], 953: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../registry");
      t.exports = function(o, s, i, l) {
        var u2, c = l("x"), f = l("y");
        if (a.getComponentMethod("calendars", "handleTraceDefaults")(o, s, ["x", "y"], i), c) {
          var h = n.minRowLength(c);
          f ? u2 = Math.min(h, n.minRowLength(f)) : (u2 = h, l("y0"), l("dy"));
        } else {
          if (!f) return 0;
          u2 = n.minRowLength(f), l("x0"), l("dx");
        }
        return s._length = u2, u2;
      };
    }, { "../../lib": 503, "../../registry": 638 }], 954: [function(e, t, r) {
      "use strict";
      var n = e("../scatter/attributes"), a = e("../../components/colorscale/attributes"), o = e("../../plots/cartesian/axis_format_attributes").axisHoverFormat, s = e("../../plots/template_attributes").hovertemplateAttrs, i = e("../../plots/template_attributes").texttemplateAttrs, l = e("../../plots/attributes"), u2 = e("../../constants/gl3d_dashes"), c = e("../../constants/gl3d_markers"), f = e("../../lib/extend").extendFlat, h = e("../../plot_api/edit_types").overrideAll, p = e("../../lib/sort_object_keys"), d = n.line, v = n.marker, m = v.line, g = f({ width: d.width, dash: { valType: "enumerated", values: p(u2), dflt: "solid" } }, a("line")), x = t.exports = h({ x: n.x, y: n.y, z: { valType: "data_array" }, text: f({}, n.text, {}), texttemplate: i({}, {}), hovertext: f({}, n.hovertext, {}), hovertemplate: s(), xhoverformat: o("x"), yhoverformat: o("y"), zhoverformat: o("z"), mode: f({}, n.mode, { dflt: "lines+markers" }), surfaceaxis: { valType: "enumerated", values: [-1, 0, 1, 2], dflt: -1 }, surfacecolor: { valType: "color" }, projection: { x: { show: { valType: "boolean", dflt: false }, opacity: { valType: "number", min: 0, max: 1, dflt: 1 }, scale: { valType: "number", min: 0, max: 10, dflt: 2 / 3 } }, y: { show: { valType: "boolean", dflt: false }, opacity: { valType: "number", min: 0, max: 1, dflt: 1 }, scale: { valType: "number", min: 0, max: 10, dflt: 2 / 3 } }, z: { show: { valType: "boolean", dflt: false }, opacity: { valType: "number", min: 0, max: 1, dflt: 1 }, scale: { valType: "number", min: 0, max: 10, dflt: 2 / 3 } } }, connectgaps: n.connectgaps, line: g, marker: f({ symbol: { valType: "enumerated", values: p(c), dflt: "circle", arrayOk: true }, size: f({}, v.size, { dflt: 8 }), sizeref: v.sizeref, sizemin: v.sizemin, sizemode: v.sizemode, opacity: f({}, v.opacity, { arrayOk: false }), colorbar: v.colorbar, line: f({ width: f({}, m.width, { arrayOk: false }) }, a("marker.line")) }, a("marker")), textposition: f({}, n.textposition, { dflt: "top center" }), textfont: { color: n.textfont.color, size: n.textfont.size, family: f({}, n.textfont.family, { arrayOk: false }) }, opacity: l.opacity, hoverinfo: f({}, l.hoverinfo) }, "calc", "nested");
      x.x.editType = x.y.editType = x.z.editType = "calc+clearAxisTypes";
    }, { "../../components/colorscale/attributes": 373, "../../constants/gl3d_dashes": 476, "../../constants/gl3d_markers": 477, "../../lib/extend": 493, "../../lib/sort_object_keys": 526, "../../plot_api/edit_types": 536, "../../plots/attributes": 550, "../../plots/cartesian/axis_format_attributes": 557, "../../plots/template_attributes": 633, "../scatter/attributes": 926 }], 955: [function(e, t, r) {
      "use strict";
      var n = e("../scatter/arrays_to_calcdata"), a = e("../scatter/colorscale_calc");
      t.exports = function(o, s) {
        var i = [{ x: false, y: false, trace: s, t: {} }];
        return n(i, s), a(o, s), i;
      };
    }, { "../scatter/arrays_to_calcdata": 925, "../scatter/colorscale_calc": 929 }], 956: [function(e, t, r) {
      "use strict";
      var n = e("../../registry");
      function a(o, s, i, l) {
        if (!s || !s.visible) return null;
        for (var u2 = n.getComponentMethod("errorbars", "makeComputeError")(s), c = new Array(o.length), f = 0; f < o.length; f++) {
          var h = u2(+o[f], f);
          if (l.type === "log") {
            var p = l.c2l(o[f]), d = o[f] - h[0], v = o[f] + h[1];
            if (c[f] = [(l.c2l(d, true) - p) * i, (l.c2l(v, true) - p) * i], d > 0) {
              var m = l.c2l(d);
              l._lowerLogErrorBound || (l._lowerLogErrorBound = m), l._lowerErrorBound = Math.min(l._lowerLogErrorBound, m);
            }
          } else c[f] = [-h[0] * i, h[1] * i];
        }
        return c;
      }
      t.exports = function(o, s, i) {
        var l = [a(o.x, o.error_x, s[0], i.xaxis), a(o.y, o.error_y, s[1], i.yaxis), a(o.z, o.error_z, s[2], i.zaxis)], u2 = function(v) {
          for (var m = 0; m < v.length; m++) if (v[m]) return v[m].length;
          return 0;
        }(l);
        if (u2 === 0) return null;
        for (var c = new Array(u2), f = 0; f < u2; f++) {
          for (var h = [[0, 0, 0], [0, 0, 0]], p = 0; p < 3; p++) if (l[p]) for (var d = 0; d < 2; d++) h[d][p] = l[p][f][d];
          c[f] = h;
        }
        return c;
      };
    }, { "../../registry": 638 }], 957: [function(e, t, r) {
      "use strict";
      var n = e("../../../stackgl_modules").gl_line3d, a = e("../../../stackgl_modules").gl_scatter3d, o = e("../../../stackgl_modules").gl_error3d, s = e("../../../stackgl_modules").gl_mesh3d, i = e("../../../stackgl_modules").delaunay_triangulate, l = e("../../lib"), u2 = e("../../lib/str2rgbarray"), c = e("../../lib/gl_format_color").formatColor, f = e("../scatter/make_bubble_size_func"), h = e("../../constants/gl3d_dashes"), p = e("../../constants/gl3d_markers"), d = e("../../plots/cartesian/axes"), v = e("../../components/fx/helpers").appendArrayPointValue, m = e("./calc_errors");
      function g(C2, E2) {
        this.scene = C2, this.uid = E2, this.linePlot = null, this.scatterPlot = null, this.errorBars = null, this.textMarkers = null, this.delaunayMesh = null, this.color = null, this.mode = "", this.dataPoints = [], this.axesBounds = [[-1 / 0, -1 / 0, -1 / 0], [1 / 0, 1 / 0, 1 / 0]], this.textLabels = null, this.data = null;
      }
      var x = g.prototype;
      function b(C2) {
        return C2 == null ? 0 : C2.indexOf("left") > -1 ? -1 : C2.indexOf("right") > -1 ? 1 : 0;
      }
      function y(C2) {
        return C2 == null ? 0 : C2.indexOf("top") > -1 ? -1 : C2.indexOf("bottom") > -1 ? 1 : 0;
      }
      function w(C2, E2) {
        return E2(4 * C2);
      }
      function _4(C2) {
        return p[C2];
      }
      function k(C2, E2, F13, N2, D2) {
        var I2 = null;
        if (l.isArrayOrTypedArray(C2)) {
          I2 = [];
          for (var O2 = 0; O2 < E2; O2++) C2[O2] === void 0 ? I2[O2] = N2 : I2[O2] = F13(C2[O2], D2);
        } else I2 = F13(C2, l.identity);
        return I2;
      }
      function T2(C2, E2) {
        var F13, N2, D2, I2, O2, L2, V2 = [], W2 = C2.fullSceneLayout, X2 = C2.dataScale, Y2 = W2.xaxis, K2 = W2.yaxis, q = W2.zaxis, re = E2.marker, R2 = E2.line, z = E2.x || [], H2 = E2.y || [], te = E2.z || [], j = z.length, Q2 = E2.xcalendar, Z2 = E2.ycalendar, ne = E2.zcalendar;
        for (O2 = 0; O2 < j; O2++) F13 = Y2.d2l(z[O2], 0, Q2) * X2[0], N2 = K2.d2l(H2[O2], 0, Z2) * X2[1], D2 = q.d2l(te[O2], 0, ne) * X2[2], V2[O2] = [F13, N2, D2];
        if (Array.isArray(E2.text)) L2 = E2.text;
        else if (E2.text !== void 0) for (L2 = new Array(j), O2 = 0; O2 < j; O2++) L2[O2] = E2.text;
        function ae(Ce, Be) {
          var Ue = W2[Ce];
          return d.tickText(Ue, Ue.d2l(Be), true).text;
        }
        var ue = E2.texttemplate;
        if (ue) {
          var le = C2.fullLayout._d3locale, ce = Array.isArray(ue), se = ce ? Math.min(ue.length, j) : j, he = ce ? function(Ce) {
            return ue[Ce];
          } : function() {
            return ue;
          };
          for (L2 = new Array(se), O2 = 0; O2 < se; O2++) {
            var me = { x: z[O2], y: H2[O2], z: te[O2] }, we = { xLabel: ae("xaxis", z[O2]), yLabel: ae("yaxis", H2[O2]), zLabel: ae("zaxis", te[O2]) }, be = {};
            v(be, E2, O2);
            var Ae = E2._meta || {};
            L2[O2] = l.texttemplateString(he(O2), we, le, be, me, Ae);
          }
        }
        if (I2 = { position: V2, mode: E2.mode, text: L2 }, "line" in E2 && (I2.lineColor = c(R2, 1, j), I2.lineWidth = R2.width, I2.lineDashes = R2.dash), "marker" in E2) {
          var pe = f(E2);
          I2.scatterColor = c(re, 1, j), I2.scatterSize = k(re.size, j, w, 20, pe), I2.scatterMarker = k(re.symbol, j, _4, "\u25CF"), I2.scatterLineWidth = re.line.width, I2.scatterLineColor = c(re.line, 1, j), I2.scatterAngle = 0;
        }
        "textposition" in E2 && (I2.textOffset = function(Ce) {
          var Be = [0, 0];
          if (Array.isArray(Ce)) for (var Ue = 0; Ue < Ce.length; Ue++) Be[Ue] = [0, 0], Ce[Ue] && (Be[Ue][0] = b(Ce[Ue]), Be[Ue][1] = y(Ce[Ue]));
          else Be[0] = b(Ce), Be[1] = y(Ce);
          return Be;
        }(E2.textposition), I2.textColor = c(E2.textfont, 1, j), I2.textSize = k(E2.textfont.size, j, l.identity, 12), I2.textFont = E2.textfont.family, I2.textAngle = 0);
        var ve = ["x", "y", "z"];
        for (I2.project = [false, false, false], I2.projectScale = [1, 1, 1], I2.projectOpacity = [1, 1, 1], O2 = 0; O2 < 3; ++O2) {
          var Ee = E2.projection[ve[O2]];
          (I2.project[O2] = Ee.show) && (I2.projectOpacity[O2] = Ee.opacity, I2.projectScale[O2] = Ee.scale);
        }
        I2.errorBounds = m(E2, X2, W2);
        var Se = function(Ce) {
          for (var Be = [0, 0, 0], Ue = [[0, 0, 0], [0, 0, 0], [0, 0, 0]], Ke = [1, 1, 1], ct = 0; ct < 3; ct++) {
            var We = Ce[ct];
            We && We.copy_zstyle !== false && Ce[2].visible !== false && (We = Ce[2]), We && We.visible && (Be[ct] = We.width / 2, Ue[ct] = u2(We.color), Ke[ct] = We.thickness);
          }
          return { capSize: Be, color: Ue, lineWidth: Ke };
        }([E2.error_x, E2.error_y, E2.error_z]);
        return I2.errorColor = Se.color, I2.errorLineWidth = Se.lineWidth, I2.errorCapSize = Se.capSize, I2.delaunayAxis = E2.surfaceaxis, I2.delaunayColor = u2(E2.surfacecolor), I2;
      }
      function A2(C2) {
        if (l.isArrayOrTypedArray(C2)) {
          var E2 = C2[0];
          return l.isArrayOrTypedArray(E2) && (C2 = E2), "rgb(" + C2.slice(0, 3).map(function(F13) {
            return Math.round(255 * F13);
          }) + ")";
        }
        return null;
      }
      function S2(C2) {
        return l.isArrayOrTypedArray(C2) ? C2.length === 4 && typeof C2[0] == "number" ? A2(C2) : C2.map(A2) : null;
      }
      x.handlePick = function(C2) {
        if (C2.object && (C2.object === this.linePlot || C2.object === this.delaunayMesh || C2.object === this.textMarkers || C2.object === this.scatterPlot)) {
          var E2 = C2.index = C2.data.index;
          return C2.object.highlight && C2.object.highlight(null), this.scatterPlot && (C2.object = this.scatterPlot, this.scatterPlot.highlight(C2.data)), C2.textLabel = "", this.textLabels && (Array.isArray(this.textLabels) ? (this.textLabels[E2] || this.textLabels[E2] === 0) && (C2.textLabel = this.textLabels[E2]) : C2.textLabel = this.textLabels), C2.traceCoordinate = [this.data.x[E2], this.data.y[E2], this.data.z[E2]], true;
        }
      }, x.update = function(C2) {
        var E2, F13, N2, D2, I2 = this.scene.glplot.gl, O2 = h.solid;
        this.data = C2;
        var L2 = T2(this.scene, C2);
        "mode" in L2 && (this.mode = L2.mode), "lineDashes" in L2 && L2.lineDashes in h && (O2 = h[L2.lineDashes]), this.color = S2(L2.scatterColor) || S2(L2.lineColor), this.dataPoints = L2.position, E2 = { gl: this.scene.glplot.gl, position: L2.position, color: L2.lineColor, lineWidth: L2.lineWidth || 1, dashes: O2[0], dashScale: O2[1], opacity: C2.opacity, connectGaps: C2.connectgaps }, this.mode.indexOf("lines") !== -1 ? this.linePlot ? this.linePlot.update(E2) : (this.linePlot = n(E2), this.linePlot._trace = this, this.scene.glplot.add(this.linePlot)) : this.linePlot && (this.scene.glplot.remove(this.linePlot), this.linePlot.dispose(), this.linePlot = null);
        var V2 = C2.opacity;
        if (C2.marker && C2.marker.opacity && (V2 *= C2.marker.opacity), F13 = { gl: this.scene.glplot.gl, position: L2.position, color: L2.scatterColor, size: L2.scatterSize, glyph: L2.scatterMarker, opacity: V2, orthographic: true, lineWidth: L2.scatterLineWidth, lineColor: L2.scatterLineColor, project: L2.project, projectScale: L2.projectScale, projectOpacity: L2.projectOpacity }, this.mode.indexOf("markers") !== -1 ? this.scatterPlot ? this.scatterPlot.update(F13) : (this.scatterPlot = a(F13), this.scatterPlot._trace = this, this.scatterPlot.highlightScale = 1, this.scene.glplot.add(this.scatterPlot)) : this.scatterPlot && (this.scene.glplot.remove(this.scatterPlot), this.scatterPlot.dispose(), this.scatterPlot = null), D2 = { gl: this.scene.glplot.gl, position: L2.position, glyph: L2.text, color: L2.textColor, size: L2.textSize, angle: L2.textAngle, alignment: L2.textOffset, font: L2.textFont, orthographic: true, lineWidth: 0, project: false, opacity: C2.opacity }, this.textLabels = C2.hovertext || C2.text, this.mode.indexOf("text") !== -1 ? this.textMarkers ? this.textMarkers.update(D2) : (this.textMarkers = a(D2), this.textMarkers._trace = this, this.textMarkers.highlightScale = 1, this.scene.glplot.add(this.textMarkers)) : this.textMarkers && (this.scene.glplot.remove(this.textMarkers), this.textMarkers.dispose(), this.textMarkers = null), N2 = { gl: this.scene.glplot.gl, position: L2.position, color: L2.errorColor, error: L2.errorBounds, lineWidth: L2.errorLineWidth, capSize: L2.errorCapSize, opacity: C2.opacity }, this.errorBars ? L2.errorBounds ? this.errorBars.update(N2) : (this.scene.glplot.remove(this.errorBars), this.errorBars.dispose(), this.errorBars = null) : L2.errorBounds && (this.errorBars = o(N2), this.errorBars._trace = this, this.scene.glplot.add(this.errorBars)), L2.delaunayAxis >= 0) {
          var W2 = function(X2, Y2, K2) {
            var q, re = (K2 + 1) % 3, R2 = (K2 + 2) % 3, z = [], H2 = [];
            for (q = 0; q < X2.length; ++q) {
              var te = X2[q];
              !isNaN(te[re]) && isFinite(te[re]) && !isNaN(te[R2]) && isFinite(te[R2]) && (z.push([te[re], te[R2]]), H2.push(q));
            }
            var j = i(z);
            for (q = 0; q < j.length; ++q) for (var Q2 = j[q], Z2 = 0; Z2 < Q2.length; ++Z2) Q2[Z2] = H2[Q2[Z2]];
            return { positions: X2, cells: j, meshColor: Y2 };
          }(L2.position, L2.delaunayColor, L2.delaunayAxis);
          W2.opacity = C2.opacity, this.delaunayMesh ? this.delaunayMesh.update(W2) : (W2.gl = I2, this.delaunayMesh = s(W2), this.delaunayMesh._trace = this, this.scene.glplot.add(this.delaunayMesh));
        } else this.delaunayMesh && (this.scene.glplot.remove(this.delaunayMesh), this.delaunayMesh.dispose(), this.delaunayMesh = null);
      }, x.dispose = function() {
        this.linePlot && (this.scene.glplot.remove(this.linePlot), this.linePlot.dispose()), this.scatterPlot && (this.scene.glplot.remove(this.scatterPlot), this.scatterPlot.dispose()), this.errorBars && (this.scene.glplot.remove(this.errorBars), this.errorBars.dispose()), this.textMarkers && (this.scene.glplot.remove(this.textMarkers), this.textMarkers.dispose()), this.delaunayMesh && (this.scene.glplot.remove(this.delaunayMesh), this.delaunayMesh.dispose());
      }, t.exports = function(C2, E2) {
        var F13 = new g(C2, E2.uid);
        return F13.update(E2), F13;
      };
    }, { "../../../stackgl_modules": 1120, "../../components/fx/helpers": 402, "../../constants/gl3d_dashes": 476, "../../constants/gl3d_markers": 477, "../../lib": 503, "../../lib/gl_format_color": 499, "../../lib/str2rgbarray": 528, "../../plots/cartesian/axes": 554, "../scatter/make_bubble_size_func": 943, "./calc_errors": 956 }], 958: [function(e, t, r) {
      "use strict";
      var n = e("../../registry"), a = e("../../lib"), o = e("../scatter/subtypes"), s = e("../scatter/marker_defaults"), i = e("../scatter/line_defaults"), l = e("../scatter/text_defaults"), u2 = e("./attributes");
      t.exports = function(c, f, h, p) {
        function d(w, _4) {
          return a.coerce(c, f, u2, w, _4);
        }
        if (function(w, _4, k, T2) {
          var A2 = 0, S2 = k("x"), C2 = k("y"), E2 = k("z");
          return n.getComponentMethod("calendars", "handleTraceDefaults")(w, _4, ["x", "y", "z"], T2), S2 && C2 && E2 && (A2 = Math.min(S2.length, C2.length, E2.length), _4._length = _4._xlength = _4._ylength = _4._zlength = A2), A2;
        }(c, f, d, p)) {
          d("text"), d("hovertext"), d("hovertemplate"), d("xhoverformat"), d("yhoverformat"), d("zhoverformat"), d("mode"), o.hasLines(f) && (d("connectgaps"), i(c, f, h, p, d)), o.hasMarkers(f) && s(c, f, h, p, d, { noSelect: true }), o.hasText(f) && (d("texttemplate"), l(c, f, p, d, { noSelect: true }));
          var v = (f.line || {}).color, m = (f.marker || {}).color;
          d("surfaceaxis") >= 0 && d("surfacecolor", v || m);
          for (var g = ["x", "y", "z"], x = 0; x < 3; ++x) {
            var b = "projection." + g[x];
            d(b + ".show") && (d(b + ".opacity"), d(b + ".scale"));
          }
          var y = n.getComponentMethod("errorbars", "supplyDefaults");
          y(c, f, v || m || h, { axis: "z" }), y(c, f, v || m || h, { axis: "y", inherit: "z" }), y(c, f, v || m || h, { axis: "x", inherit: "z" });
        } else f.visible = false;
      };
    }, { "../../lib": 503, "../../registry": 638, "../scatter/line_defaults": 939, "../scatter/marker_defaults": 945, "../scatter/subtypes": 951, "../scatter/text_defaults": 952, "./attributes": 954 }], 959: [function(e, t, r) {
      "use strict";
      t.exports = { plot: e("./convert"), attributes: e("./attributes"), markerSymbols: e("../../constants/gl3d_markers"), supplyDefaults: e("./defaults"), colorbar: [{ container: "marker", min: "cmin", max: "cmax" }, { container: "line", min: "cmin", max: "cmax" }], calc: e("./calc"), moduleType: "trace", name: "scatter3d", basePlotModule: e("../../plots/gl3d"), categories: ["gl3d", "symbols", "showLegend", "scatter-like"], meta: {} };
    }, { "../../constants/gl3d_markers": 477, "../../plots/gl3d": 598, "./attributes": 954, "./calc": 955, "./convert": 957, "./defaults": 958 }], 960: [function(e, t, r) {
      "use strict";
      var n = e("../scatter/attributes"), a = e("../../plots/attributes"), o = e("../../plots/template_attributes").hovertemplateAttrs, s = e("../../plots/template_attributes").texttemplateAttrs, i = e("../../components/colorscale/attributes"), l = e("../../lib/extend").extendFlat, u2 = n.marker, c = n.line, f = u2.line;
      t.exports = { carpet: { valType: "string", editType: "calc" }, a: { valType: "data_array", editType: "calc" }, b: { valType: "data_array", editType: "calc" }, mode: l({}, n.mode, { dflt: "markers" }), text: l({}, n.text, {}), texttemplate: s({ editType: "plot" }, { keys: ["a", "b", "text"] }), hovertext: l({}, n.hovertext, {}), line: { color: c.color, width: c.width, dash: c.dash, shape: l({}, c.shape, { values: ["linear", "spline"] }), smoothing: c.smoothing, editType: "calc" }, connectgaps: n.connectgaps, fill: l({}, n.fill, { values: ["none", "toself", "tonext"], dflt: "none" }), fillcolor: n.fillcolor, marker: l({ symbol: u2.symbol, opacity: u2.opacity, maxdisplayed: u2.maxdisplayed, size: u2.size, sizeref: u2.sizeref, sizemin: u2.sizemin, sizemode: u2.sizemode, line: l({ width: f.width, editType: "calc" }, i("marker.line")), gradient: u2.gradient, editType: "calc" }, i("marker")), textfont: n.textfont, textposition: n.textposition, selected: n.selected, unselected: n.unselected, hoverinfo: l({}, a.hoverinfo, { flags: ["a", "b", "text", "name"] }), hoveron: n.hoveron, hovertemplate: o() };
    }, { "../../components/colorscale/attributes": 373, "../../lib/extend": 493, "../../plots/attributes": 550, "../../plots/template_attributes": 633, "../scatter/attributes": 926 }], 961: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("../scatter/colorscale_calc"), o = e("../scatter/arrays_to_calcdata"), s = e("../scatter/calc_selection"), i = e("../scatter/calc").calcMarkerSize, l = e("../carpet/lookup_carpetid");
      t.exports = function(u2, c) {
        var f = c._carpetTrace = l(u2, c);
        if (f && f.visible && f.visible !== "legendonly") {
          var h;
          c.xaxis = f.xaxis, c.yaxis = f.yaxis;
          var p, d, v = c._length, m = new Array(v), g = false;
          for (h = 0; h < v; h++) if (p = c.a[h], d = c.b[h], n(p) && n(d)) {
            var x = f.ab2xy(+p, +d, true), b = f.isVisible(+p, +d);
            b || (g = true), m[h] = { x: x[0], y: x[1], a: p, b: d, vis: b };
          } else m[h] = { x: false, y: false };
          return c._needsCull = g, m[0].carpet = f, m[0].trace = c, i(c, v), a(u2, c), o(m, c), s(m, c), m;
        }
      };
    }, { "../carpet/lookup_carpetid": 708, "../scatter/arrays_to_calcdata": 925, "../scatter/calc": 927, "../scatter/calc_selection": 928, "../scatter/colorscale_calc": 929, "fast-isnumeric": 190 }], 962: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../scatter/constants"), o = e("../scatter/subtypes"), s = e("../scatter/marker_defaults"), i = e("../scatter/line_defaults"), l = e("../scatter/line_shape_defaults"), u2 = e("../scatter/text_defaults"), c = e("../scatter/fillcolor_defaults"), f = e("./attributes");
      t.exports = function(h, p, d, v) {
        function m(w, _4) {
          return n.coerce(h, p, f, w, _4);
        }
        m("carpet"), p.xaxis = "x", p.yaxis = "y";
        var g = m("a"), x = m("b"), b = Math.min(g.length, x.length);
        if (b) {
          p._length = b, m("text"), m("texttemplate"), m("hovertext"), m("mode", b < a.PTS_LINESONLY ? "lines+markers" : "lines"), o.hasLines(p) && (i(h, p, d, v, m), l(h, p, m), m("connectgaps")), o.hasMarkers(p) && s(h, p, d, v, m, { gradient: true }), o.hasText(p) && u2(h, p, v, m);
          var y = [];
          (o.hasMarkers(p) || o.hasText(p)) && (m("marker.maxdisplayed"), y.push("points")), m("fill"), p.fill !== "none" && (c(h, p, d, m), o.hasLines(p) || l(h, p, m)), p.fill !== "tonext" && p.fill !== "toself" || y.push("fills"), m("hoveron", y.join("+") || "points") !== "fills" && m("hovertemplate"), n.coerceSelectionMarkerOpacity(p, m);
        } else p.visible = false;
      };
    }, { "../../lib": 503, "../scatter/constants": 930, "../scatter/fillcolor_defaults": 934, "../scatter/line_defaults": 939, "../scatter/line_shape_defaults": 941, "../scatter/marker_defaults": 945, "../scatter/subtypes": 951, "../scatter/text_defaults": 952, "./attributes": 960 }], 963: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a, o, s, i) {
        var l = s[i];
        return n.a = l.a, n.b = l.b, n.y = l.y, n;
      };
    }, {}], 964: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a) {
        var o = {}, s = a._carpet, i = s.ab2ij([n.a, n.b]), l = Math.floor(i[0]), u2 = i[0] - l, c = Math.floor(i[1]), f = i[1] - c, h = s.evalxy([], l, c, u2, f);
        return o.yLabel = h[1].toFixed(3), o;
      };
    }, {}], 965: [function(e, t, r) {
      "use strict";
      var n = e("../scatter/hover"), a = e("../../lib").fillText;
      t.exports = function(o, s, i, l) {
        var u2 = n(o, s, i, l);
        if (u2 && u2[0].index !== false) {
          var c = u2[0];
          if (c.index === void 0) {
            var f = 1 - c.y0 / o.ya._length, h = o.xa._length, p = h * f / 2, d = h - p;
            return c.x0 = Math.max(Math.min(c.x0, d), p), c.x1 = Math.max(Math.min(c.x1, d), p), u2;
          }
          var v = c.cd[c.index];
          c.a = v.a, c.b = v.b, c.xLabelVal = void 0, c.yLabelVal = void 0;
          var m = c.trace, g = m._carpet, x = m._module.formatLabels(v, m);
          c.yLabel = x.yLabel, delete c.text;
          var b = [];
          if (!m.hovertemplate) {
            var y = (v.hi || m.hoverinfo).split("+");
            y.indexOf("all") !== -1 && (y = ["a", "b", "text"]), y.indexOf("a") !== -1 && w(g.aaxis, v.a), y.indexOf("b") !== -1 && w(g.baxis, v.b), b.push("y: " + c.yLabel), y.indexOf("text") !== -1 && a(v, m, b), c.extraText = b.join("<br>");
          }
          return u2;
        }
        function w(_4, k) {
          var T2;
          T2 = _4.labelprefix && _4.labelprefix.length > 0 ? _4.labelprefix.replace(/ = $/, "") : _4._hovertitle, b.push(T2 + ": " + k.toFixed(3) + _4.labelsuffix);
        }
      };
    }, { "../../lib": 503, "../scatter/hover": 937 }], 966: [function(e, t, r) {
      "use strict";
      t.exports = { attributes: e("./attributes"), supplyDefaults: e("./defaults"), colorbar: e("../scatter/marker_colorbar"), formatLabels: e("./format_labels"), calc: e("./calc"), plot: e("./plot"), style: e("../scatter/style").style, styleOnSelect: e("../scatter/style").styleOnSelect, hoverPoints: e("./hover"), selectPoints: e("../scatter/select"), eventData: e("./event_data"), moduleType: "trace", name: "scattercarpet", basePlotModule: e("../../plots/cartesian"), categories: ["svg", "carpet", "symbols", "showLegend", "carpetDependent", "zoomScale"], meta: {} };
    }, { "../../plots/cartesian": 568, "../scatter/marker_colorbar": 944, "../scatter/select": 948, "../scatter/style": 950, "./attributes": 960, "./calc": 961, "./defaults": 962, "./event_data": 963, "./format_labels": 964, "./hover": 965, "./plot": 967 }], 967: [function(e, t, r) {
      "use strict";
      var n = e("../scatter/plot"), a = e("../../plots/cartesian/axes"), o = e("../../components/drawing");
      t.exports = function(s, i, l, u2) {
        var c, f, h, p = l[0][0].carpet, d = { xaxis: a.getFromId(s, p.xaxis || "x"), yaxis: a.getFromId(s, p.yaxis || "y"), plot: i.plot };
        for (n(s, d, l, u2), c = 0; c < l.length; c++) f = l[c][0].trace, h = u2.selectAll("g.trace" + f.uid + " .js-line"), o.setClipUrl(h, l[c][0].carpet._clipPathId, s);
      };
    }, { "../../components/drawing": 388, "../../plots/cartesian/axes": 554, "../scatter/plot": 947 }], 968: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/template_attributes").hovertemplateAttrs, a = e("../../plots/template_attributes").texttemplateAttrs, o = e("../scatter/attributes"), s = e("../../plots/attributes"), i = e("../../components/colorscale/attributes"), l = e("../../components/drawing/attributes").dash, u2 = e("../../lib/extend").extendFlat, c = e("../../plot_api/edit_types").overrideAll, f = o.marker, h = o.line, p = f.line;
      t.exports = c({ lon: { valType: "data_array" }, lat: { valType: "data_array" }, locations: { valType: "data_array" }, locationmode: { valType: "enumerated", values: ["ISO-3", "USA-states", "country names", "geojson-id"], dflt: "ISO-3" }, geojson: { valType: "any", editType: "calc" }, featureidkey: { valType: "string", editType: "calc", dflt: "id" }, mode: u2({}, o.mode, { dflt: "markers" }), text: u2({}, o.text, {}), texttemplate: a({ editType: "plot" }, { keys: ["lat", "lon", "location", "text"] }), hovertext: u2({}, o.hovertext, {}), textfont: o.textfont, textposition: o.textposition, line: { color: h.color, width: h.width, dash: l }, connectgaps: o.connectgaps, marker: u2({ symbol: f.symbol, opacity: f.opacity, size: f.size, sizeref: f.sizeref, sizemin: f.sizemin, sizemode: f.sizemode, colorbar: f.colorbar, line: u2({ width: p.width }, i("marker.line")), gradient: f.gradient }, i("marker")), fill: { valType: "enumerated", values: ["none", "toself"], dflt: "none" }, fillcolor: o.fillcolor, selected: o.selected, unselected: o.unselected, hoverinfo: u2({}, s.hoverinfo, { flags: ["lon", "lat", "location", "text", "name"] }), hovertemplate: n() }, "calc", "nested");
    }, { "../../components/colorscale/attributes": 373, "../../components/drawing/attributes": 387, "../../lib/extend": 493, "../../plot_api/edit_types": 536, "../../plots/attributes": 550, "../../plots/template_attributes": 633, "../scatter/attributes": 926 }], 969: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("../../constants/numerical").BADNUM, o = e("../scatter/colorscale_calc"), s = e("../scatter/arrays_to_calcdata"), i = e("../scatter/calc_selection"), l = e("../../lib")._;
      function u2(c) {
        return c && typeof c == "string";
      }
      t.exports = function(c, f) {
        var h, p = Array.isArray(f.locations), d = p ? f.locations.length : f._length, v = new Array(d);
        h = f.geojson ? function(w) {
          return u2(w) || n(w);
        } : u2;
        for (var m = 0; m < d; m++) {
          var g = v[m] = {};
          if (p) {
            var x = f.locations[m];
            g.loc = h(x) ? x : null;
          } else {
            var b = f.lon[m], y = f.lat[m];
            n(b) && n(y) ? g.lonlat = [+b, +y] : g.lonlat = [a, a];
          }
        }
        return s(v, f), o(c, f), i(v, f), d && (v[0].t = { labels: { lat: l(c, "lat:") + " ", lon: l(c, "lon:") + " " } }), v;
      };
    }, { "../../constants/numerical": 479, "../../lib": 503, "../scatter/arrays_to_calcdata": 925, "../scatter/calc_selection": 928, "../scatter/colorscale_calc": 929, "fast-isnumeric": 190 }], 970: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../scatter/subtypes"), o = e("../scatter/marker_defaults"), s = e("../scatter/line_defaults"), i = e("../scatter/text_defaults"), l = e("../scatter/fillcolor_defaults"), u2 = e("./attributes");
      t.exports = function(c, f, h, p) {
        function d(w, _4) {
          return n.coerce(c, f, u2, w, _4);
        }
        var v, m = d("locations");
        if (m && m.length) {
          var g, x = d("geojson");
          (typeof x == "string" && x !== "" || n.isPlainObject(x)) && (g = "geojson-id"), d("locationmode", g) === "geojson-id" && d("featureidkey"), v = m.length;
        } else {
          var b = d("lon") || [], y = d("lat") || [];
          v = Math.min(b.length, y.length);
        }
        v ? (f._length = v, d("text"), d("hovertext"), d("hovertemplate"), d("mode"), a.hasLines(f) && (s(c, f, h, p, d), d("connectgaps")), a.hasMarkers(f) && o(c, f, h, p, d, { gradient: true }), a.hasText(f) && (d("texttemplate"), i(c, f, p, d)), d("fill"), f.fill !== "none" && l(c, f, h, d), n.coerceSelectionMarkerOpacity(f, d)) : f.visible = false;
      };
    }, { "../../lib": 503, "../scatter/fillcolor_defaults": 934, "../scatter/line_defaults": 939, "../scatter/marker_defaults": 945, "../scatter/subtypes": 951, "../scatter/text_defaults": 952, "./attributes": 968 }], 971: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a, o, s, i) {
        n.lon = a.lon, n.lat = a.lat, n.location = a.loc ? a.loc : null;
        var l = s[i];
        return l.fIn && l.fIn.properties && (n.properties = l.fIn.properties), n;
      };
    }, {}], 972: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/cartesian/axes");
      t.exports = function(a, o, s) {
        var i = {}, l = s[o.geo]._subplot.mockAxis, u2 = a.lonlat;
        return i.lonLabel = n.tickText(l, l.c2l(u2[0]), true).text, i.latLabel = n.tickText(l, l.c2l(u2[1]), true).text, i;
      };
    }, { "../../plots/cartesian/axes": 554 }], 973: [function(e, t, r) {
      "use strict";
      var n = e("../../components/fx"), a = e("../../constants/numerical").BADNUM, o = e("../scatter/get_trace_color"), s = e("../../lib").fillText, i = e("./attributes");
      t.exports = function(l, u2, c) {
        var f = l.cd, h = f[0].trace, p = l.xa, d = l.ya, v = l.subplot, m = v.projection.isLonLatOverEdges, g = v.project;
        if (n.getClosest(f, function(T2) {
          var A2 = T2.lonlat;
          if (A2[0] === a || m(A2)) return 1 / 0;
          var S2 = g(A2), C2 = g([u2, c]), E2 = Math.abs(S2[0] - C2[0]), F13 = Math.abs(S2[1] - C2[1]), N2 = Math.max(3, T2.mrc || 0);
          return Math.max(Math.sqrt(E2 * E2 + F13 * F13) - N2, 1 - 3 / N2);
        }, l), l.index !== false) {
          var x = f[l.index], b = x.lonlat, y = [p.c2p(b), d.c2p(b)], w = x.mrc || 1;
          l.x0 = y[0] - w, l.x1 = y[0] + w, l.y0 = y[1] - w, l.y1 = y[1] + w, l.loc = x.loc, l.lon = b[0], l.lat = b[1];
          var _4 = {};
          _4[h.geo] = { _subplot: v };
          var k = h._module.formatLabels(x, h, _4);
          return l.lonLabel = k.lonLabel, l.latLabel = k.latLabel, l.color = o(h, x), l.extraText = function(T2, A2, S2, C2) {
            if (T2.hovertemplate) return;
            var E2 = A2.hi || T2.hoverinfo, F13 = E2 === "all" ? i.hoverinfo.flags : E2.split("+"), N2 = F13.indexOf("location") !== -1 && Array.isArray(T2.locations), D2 = F13.indexOf("lon") !== -1, I2 = F13.indexOf("lat") !== -1, O2 = F13.indexOf("text") !== -1, L2 = [];
            function V2(W2) {
              return W2 + "\xB0";
            }
            return N2 ? L2.push(A2.loc) : D2 && I2 ? L2.push("(" + V2(S2.latLabel) + ", " + V2(S2.lonLabel) + ")") : D2 ? L2.push(C2.lon + V2(S2.lonLabel)) : I2 && L2.push(C2.lat + V2(S2.latLabel)), O2 && s(A2, T2, L2), L2.join("<br>");
          }(h, x, l, f[0].t.labels), l.hovertemplate = h.hovertemplate, [l];
        }
      };
    }, { "../../components/fx": 406, "../../constants/numerical": 479, "../../lib": 503, "../scatter/get_trace_color": 936, "./attributes": 968 }], 974: [function(e, t, r) {
      "use strict";
      t.exports = { attributes: e("./attributes"), supplyDefaults: e("./defaults"), colorbar: e("../scatter/marker_colorbar"), formatLabels: e("./format_labels"), calc: e("./calc"), calcGeoJSON: e("./plot").calcGeoJSON, plot: e("./plot").plot, style: e("./style"), styleOnSelect: e("../scatter/style").styleOnSelect, hoverPoints: e("./hover"), eventData: e("./event_data"), selectPoints: e("./select"), moduleType: "trace", name: "scattergeo", basePlotModule: e("../../plots/geo"), categories: ["geo", "symbols", "showLegend", "scatter-like"], meta: {} };
    }, { "../../plots/geo": 589, "../scatter/marker_colorbar": 944, "../scatter/style": 950, "./attributes": 968, "./calc": 969, "./defaults": 970, "./event_data": 971, "./format_labels": 972, "./hover": 973, "./plot": 975, "./select": 976, "./style": 977 }], 975: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../lib"), o = e("../../lib/topojson_utils").getTopojsonFeatures, s = e("../../lib/geojson_utils"), i = e("../../lib/geo_location_utils"), l = e("../../plots/cartesian/autorange").findExtremes, u2 = e("../../constants/numerical").BADNUM, c = e("../scatter/calc").calcMarkerSize, f = e("../scatter/subtypes"), h = e("./style");
      t.exports = { calcGeoJSON: function(p, d) {
        var v, m, g = p[0].trace, x = d[g.geo], b = x._subplot, y = g._length;
        if (Array.isArray(g.locations)) {
          var w = g.locationmode, _4 = w === "geojson-id" ? i.extractTraceFeature(p) : o(g, b.topojson);
          for (v = 0; v < y; v++) {
            m = p[v];
            var k = w === "geojson-id" ? m.fOut : i.locationToFeature(w, m.loc, _4);
            m.lonlat = k ? k.properties.ct : [u2, u2];
          }
        }
        var T2, A2, S2 = { padded: true };
        if (x.fitbounds === "geojson" && g.locationmode === "geojson-id") {
          var C2 = i.computeBbox(i.getTraceGeojson(g));
          T2 = [C2[0], C2[2]], A2 = [C2[1], C2[3]];
        } else {
          for (T2 = new Array(y), A2 = new Array(y), v = 0; v < y; v++) m = p[v], T2[v] = m.lonlat[0], A2[v] = m.lonlat[1];
          S2.ppad = c(g, y);
        }
        g._extremes.lon = l(x.lonaxis._ax, T2, S2), g._extremes.lat = l(x.lataxis._ax, A2, S2);
      }, plot: function(p, d, v) {
        var m = d.layers.frontplot.select(".scatterlayer"), g = a.makeTraceGroups(m, v, "trace scattergeo");
        function x(b, y) {
          b.lonlat[0] === u2 && n.select(y).remove();
        }
        g.selectAll("*").remove(), g.each(function(b) {
          var y = n.select(this), w = b[0].trace;
          if (f.hasLines(w) || w.fill !== "none") {
            var _4 = s.calcTraceToLineCoords(b), k = w.fill !== "none" ? s.makePolygon(_4) : s.makeLine(_4);
            y.selectAll("path.js-line").data([{ geojson: k, trace: w }]).enter().append("path").classed("js-line", true).style("stroke-miterlimit", 2);
          }
          f.hasMarkers(w) && y.selectAll("path.point").data(a.identity).enter().append("path").classed("point", true).each(function(T2) {
            x(T2, this);
          }), f.hasText(w) && y.selectAll("g").data(a.identity).enter().append("g").append("text").each(function(T2) {
            x(T2, this);
          }), h(p, b);
        });
      } };
    }, { "../../constants/numerical": 479, "../../lib": 503, "../../lib/geo_location_utils": 496, "../../lib/geojson_utils": 497, "../../lib/topojson_utils": 532, "../../plots/cartesian/autorange": 553, "../scatter/calc": 927, "../scatter/subtypes": 951, "./style": 977, "@plotly/d3": 58 }], 976: [function(e, t, r) {
      "use strict";
      var n = e("../scatter/subtypes"), a = e("../../constants/numerical").BADNUM;
      t.exports = function(o, s) {
        var i, l, u2, c, f, h = o.cd, p = o.xaxis, d = o.yaxis, v = [], m = h[0].trace;
        if (!n.hasMarkers(m) && !n.hasText(m)) return [];
        if (s === false) for (f = 0; f < h.length; f++) h[f].selected = 0;
        else for (f = 0; f < h.length; f++) (l = (i = h[f]).lonlat)[0] !== a && (u2 = p.c2p(l), c = d.c2p(l), s.contains([u2, c], null, f, o) ? (v.push({ pointNumber: f, lon: l[0], lat: l[1] }), i.selected = 1) : i.selected = 0);
        return v;
      };
    }, { "../../constants/numerical": 479, "../scatter/subtypes": 951 }], 977: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../components/drawing"), o = e("../../components/color"), s = e("../scatter/style"), i = s.stylePoints, l = s.styleText;
      t.exports = function(u2, c) {
        c && function(f, h) {
          var p = h[0].trace, d = h[0].node3;
          d.style("opacity", h[0].trace.opacity), i(d, p, f), l(d, p, f), d.selectAll("path.js-line").style("fill", "none").each(function(v) {
            var m = n.select(this), g = v.trace, x = g.line || {};
            m.call(o.stroke, x.color).call(a.dashLine, x.dash || "", x.width || 0), g.fill !== "none" && m.call(o.fill, g.fillcolor);
          });
        }(u2, c);
      };
    }, { "../../components/color": 366, "../../components/drawing": 388, "../scatter/style": 950, "@plotly/d3": 58 }], 978: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/attributes"), a = e("../scatter/attributes"), o = e("../../plots/cartesian/axis_format_attributes").axisHoverFormat, s = e("../../components/colorscale/attributes"), i = e("../../lib/sort_object_keys"), l = e("../../lib/extend").extendFlat, u2 = e("../../plot_api/edit_types").overrideAll, c = e("./constants").DASHES, f = a.line, h = a.marker, p = h.line, d = t.exports = u2({ x: a.x, x0: a.x0, dx: a.dx, y: a.y, y0: a.y0, dy: a.dy, xperiod: a.xperiod, yperiod: a.yperiod, xperiod0: a.xperiod0, yperiod0: a.yperiod0, xperiodalignment: a.xperiodalignment, yperiodalignment: a.yperiodalignment, xhoverformat: o("x"), yhoverformat: o("y"), text: a.text, hovertext: a.hovertext, textposition: a.textposition, textfont: a.textfont, mode: { valType: "flaglist", flags: ["lines", "markers", "text"], extras: ["none"] }, line: { color: f.color, width: f.width, shape: { valType: "enumerated", values: ["linear", "hv", "vh", "hvh", "vhv"], dflt: "linear", editType: "plot" }, dash: { valType: "enumerated", values: i(c), dflt: "solid" } }, marker: l({}, s("marker"), { symbol: h.symbol, size: h.size, sizeref: h.sizeref, sizemin: h.sizemin, sizemode: h.sizemode, opacity: h.opacity, colorbar: h.colorbar, line: l({}, s("marker.line"), { width: p.width }) }), connectgaps: a.connectgaps, fill: l({}, a.fill, { dflt: "none" }), fillcolor: a.fillcolor, selected: { marker: a.selected.marker, textfont: a.selected.textfont }, unselected: { marker: a.unselected.marker, textfont: a.unselected.textfont }, opacity: n.opacity }, "calc", "nested");
      d.x.editType = d.y.editType = d.x0.editType = d.y0.editType = "calc+clearAxisTypes", d.hovertemplate = a.hovertemplate, d.texttemplate = a.texttemplate;
    }, { "../../components/colorscale/attributes": 373, "../../lib/extend": 493, "../../lib/sort_object_keys": 526, "../../plot_api/edit_types": 536, "../../plots/attributes": 550, "../../plots/cartesian/axis_format_attributes": 557, "../scatter/attributes": 926, "./constants": 980 }], 979: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/point-cluster"), a = e("../../lib"), o = e("../../plots/cartesian/axis_ids"), s = e("../../plots/cartesian/autorange").findExtremes, i = e("../../plots/cartesian/align_period"), l = e("../scatter/calc"), u2 = l.calcMarkerSize, c = l.calcAxisExpansion, f = l.setFirstScatter, h = e("../scatter/colorscale_calc"), p = e("./convert"), d = e("./scene_update"), v = e("../../constants/numerical").BADNUM, m = e("./constants").TOO_MANY_POINTS;
      function g(x, b, y) {
        var w = x._extremes[b._id], _4 = s(b, y._bnds, { padded: true });
        w.min = w.min.concat(_4.min), w.max = w.max.concat(_4.max);
      }
      t.exports = function(x, b) {
        var y, w = x._fullLayout, _4 = o.getFromId(x, b.xaxis), k = o.getFromId(x, b.yaxis), T2 = w._plots[b.xaxis + b.yaxis], A2 = b._length, S2 = A2 >= m, C2 = 2 * A2, E2 = {}, F13 = _4.makeCalcdata(b, "x"), N2 = k.makeCalcdata(b, "y"), D2 = i(b, _4, "x", F13), I2 = i(b, k, "y", N2), O2 = D2.vals, L2 = I2.vals;
        b._x = O2, b._y = L2, b.xperiodalignment && (b._origX = F13, b._xStarts = D2.starts, b._xEnds = D2.ends), b.yperiodalignment && (b._origY = N2, b._yStarts = I2.starts, b._yEnds = I2.ends);
        var V2 = new Array(C2), W2 = new Array(A2);
        for (y = 0; y < A2; y++) V2[2 * y] = O2[y] === v ? NaN : O2[y], V2[2 * y + 1] = L2[y] === v ? NaN : L2[y], W2[y] = y;
        if (_4.type === "log") for (y = 0; y < C2; y += 2) V2[y] = _4.c2l(V2[y]);
        if (k.type === "log") for (y = 1; y < C2; y += 2) V2[y] = k.c2l(V2[y]);
        S2 && _4.type !== "log" && k.type !== "log" ? E2.tree = n(V2) : E2.ids = W2, h(x, b);
        var X2, Y2 = function(q, re, R2, z, H2, te) {
          var j = p.style(q, R2);
          if (j.marker && (j.marker.positions = z), j.line && z.length > 1 && a.extendFlat(j.line, p.linePositions(q, R2, z)), j.errorX || j.errorY) {
            var Q2 = p.errorBarPositions(q, R2, z, H2, te);
            j.errorX && a.extendFlat(j.errorX, Q2.x), j.errorY && a.extendFlat(j.errorY, Q2.y);
          }
          return j.text && (a.extendFlat(j.text, { positions: z }, p.textPosition(q, R2, j.text, j.marker)), a.extendFlat(j.textSel, { positions: z }, p.textPosition(q, R2, j.text, j.markerSel)), a.extendFlat(j.textUnsel, { positions: z }, p.textPosition(q, R2, j.text, j.markerUnsel))), j;
        }(x, 0, b, V2, O2, L2), K2 = d(x, T2);
        return f(w, b), S2 ? Y2.marker && (X2 = Y2.marker.sizeAvg || Math.max(Y2.marker.size, 3)) : X2 = u2(b, A2), c(x, b, _4, k, O2, L2, X2), Y2.errorX && g(b, _4, Y2.errorX), Y2.errorY && g(b, k, Y2.errorY), Y2.fill && !K2.fill2d && (K2.fill2d = true), Y2.marker && !K2.scatter2d && (K2.scatter2d = true), Y2.line && !K2.line2d && (K2.line2d = true), !Y2.errorX && !Y2.errorY || K2.error2d || (K2.error2d = true), Y2.text && !K2.glText && (K2.glText = true), Y2.marker && (Y2.marker.snap = A2), K2.lineOptions.push(Y2.line), K2.errorXOptions.push(Y2.errorX), K2.errorYOptions.push(Y2.errorY), K2.fillOptions.push(Y2.fill), K2.markerOptions.push(Y2.marker), K2.markerSelectedOptions.push(Y2.markerSel), K2.markerUnselectedOptions.push(Y2.markerUnsel), K2.textOptions.push(Y2.text), K2.textSelectedOptions.push(Y2.textSel), K2.textUnselectedOptions.push(Y2.textUnsel), K2.selectBatch.push([]), K2.unselectBatch.push([]), E2._scene = K2, E2.index = K2.count, E2.x = O2, E2.y = L2, E2.positions = V2, K2.count++, [{ x: false, y: false, t: E2, trace: b }];
      };
    }, { "../../constants/numerical": 479, "../../lib": 503, "../../plots/cartesian/align_period": 551, "../../plots/cartesian/autorange": 553, "../../plots/cartesian/axis_ids": 558, "../scatter/calc": 927, "../scatter/colorscale_calc": 929, "./constants": 980, "./convert": 981, "./scene_update": 989, "@plotly/point-cluster": 59 }], 980: [function(e, t, r) {
      "use strict";
      t.exports = { TOO_MANY_POINTS: 1e5, SYMBOL_SDF_SIZE: 200, SYMBOL_SIZE: 20, SYMBOL_STROKE: 1, DOT_RE: /-dot/, OPEN_RE: /-open/, DASHES: { solid: [1], dot: [1, 1], dash: [4, 1], longdash: [8, 1], dashdot: [4, 1, 1, 1], longdashdot: [8, 1, 1, 1] } };
    }, {}], 981: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("svg-path-sdf"), o = e("color-normalize"), s = e("../../registry"), i = e("../../lib"), l = e("../../components/drawing"), u2 = e("../../plots/cartesian/axis_ids"), c = e("../../lib/gl_format_color").formatColor, f = e("../scatter/subtypes"), h = e("../scatter/make_bubble_size_func"), p = e("./helpers"), d = e("./constants"), v = e("../../constants/interactions").DESELECTDIM, m = { start: 1, left: 1, end: -1, right: -1, middle: 0, center: 0, bottom: 1, top: -1 }, g = e("../../components/fx/helpers").appendArrayPointValue;
      function x(F13, N2) {
        var D2, I2 = F13._fullLayout, O2 = N2._length, L2 = N2.textfont, V2 = N2.textposition, W2 = Array.isArray(V2) ? V2 : [V2], X2 = L2.color, Y2 = L2.size, K2 = L2.family, q = {}, re = F13._context.plotGlPixelRatio, R2 = N2.texttemplate;
        if (R2) {
          q.text = [];
          var z = I2._d3locale, H2 = Array.isArray(R2), te = H2 ? Math.min(R2.length, O2) : O2, j = H2 ? function(ce) {
            return R2[ce];
          } : function() {
            return R2;
          };
          for (D2 = 0; D2 < te; D2++) {
            var Q2 = { i: D2 }, Z2 = N2._module.formatLabels(Q2, N2, I2), ne = {};
            g(ne, N2, D2);
            var ae = N2._meta || {};
            q.text.push(i.texttemplateString(j(D2), Z2, z, ne, Q2, ae));
          }
        } else Array.isArray(N2.text) && N2.text.length < O2 ? q.text = N2.text.slice() : q.text = N2.text;
        if (Array.isArray(q.text)) for (D2 = q.text.length; D2 < O2; D2++) q.text[D2] = "";
        for (q.opacity = N2.opacity, q.font = {}, q.align = [], q.baseline = [], D2 = 0; D2 < W2.length; D2++) {
          var ue = W2[D2].split(/\s+/);
          switch (ue[1]) {
            case "left":
              q.align.push("right");
              break;
            case "right":
              q.align.push("left");
              break;
            default:
              q.align.push(ue[1]);
          }
          switch (ue[0]) {
            case "top":
              q.baseline.push("bottom");
              break;
            case "bottom":
              q.baseline.push("top");
              break;
            default:
              q.baseline.push(ue[0]);
          }
        }
        if (Array.isArray(X2)) for (q.color = new Array(O2), D2 = 0; D2 < O2; D2++) q.color[D2] = X2[D2];
        else q.color = X2;
        if (i.isArrayOrTypedArray(Y2) || Array.isArray(K2)) for (q.font = new Array(O2), D2 = 0; D2 < O2; D2++) {
          var le = q.font[D2] = {};
          le.size = (i.isTypedArray(Y2) ? Y2[D2] : Array.isArray(Y2) ? n(Y2[D2]) ? Y2[D2] : 0 : Y2) * re, le.family = Array.isArray(K2) ? K2[D2] : K2;
        }
        else q.font = { size: Y2 * re, family: K2 };
        return q;
      }
      function b(F13) {
        var N2, D2, I2 = F13._length, O2 = F13.marker, L2 = {}, V2 = i.isArrayOrTypedArray(O2.symbol), W2 = i.isArrayOrTypedArray(O2.color), X2 = i.isArrayOrTypedArray(O2.line.color), Y2 = i.isArrayOrTypedArray(O2.opacity), K2 = i.isArrayOrTypedArray(O2.size), q = i.isArrayOrTypedArray(O2.line.width);
        if (V2 || (D2 = p.isOpenSymbol(O2.symbol)), V2 || W2 || X2 || Y2) {
          L2.colors = new Array(I2), L2.borderColors = new Array(I2);
          var re = c(O2, O2.opacity, I2), R2 = c(O2.line, O2.opacity, I2);
          if (!Array.isArray(R2[0])) {
            var z = R2;
            for (R2 = Array(I2), N2 = 0; N2 < I2; N2++) R2[N2] = z;
          }
          if (!Array.isArray(re[0])) {
            var H2 = re;
            for (re = Array(I2), N2 = 0; N2 < I2; N2++) re[N2] = H2;
          }
          for (L2.colors = re, L2.borderColors = R2, N2 = 0; N2 < I2; N2++) {
            if (V2) {
              var te = O2.symbol[N2];
              D2 = p.isOpenSymbol(te);
            }
            D2 && (R2[N2] = re[N2].slice(), re[N2] = re[N2].slice(), re[N2][3] = 0);
          }
          L2.opacity = F13.opacity;
        } else D2 ? (L2.color = o(O2.color, "uint8"), L2.color[3] = 0, L2.borderColor = o(O2.color, "uint8")) : (L2.color = o(O2.color, "uint8"), L2.borderColor = o(O2.line.color, "uint8")), L2.opacity = F13.opacity * O2.opacity;
        if (V2) for (L2.markers = new Array(I2), N2 = 0; N2 < I2; N2++) L2.markers[N2] = E2(O2.symbol[N2]);
        else L2.marker = E2(O2.symbol);
        var j, Q2 = h(F13, 1);
        if (K2 || q) {
          var Z2, ne = L2.sizes = new Array(I2), ae = L2.borderSizes = new Array(I2), ue = 0;
          if (K2) {
            for (N2 = 0; N2 < I2; N2++) ne[N2] = Q2(O2.size[N2]), ue += ne[N2];
            Z2 = ue / I2;
          } else for (j = Q2(O2.size), N2 = 0; N2 < I2; N2++) ne[N2] = j;
          if (q) for (N2 = 0; N2 < I2; N2++) ae[N2] = O2.line.width[N2];
          else for (j = O2.line.width, N2 = 0; N2 < I2; N2++) ae[N2] = j;
          L2.sizeAvg = Z2;
        } else L2.size = Q2(O2 && O2.size || 10), L2.borderSizes = Q2(O2.line.width);
        return L2;
      }
      function y(F13, N2) {
        var D2 = F13.marker, I2 = {};
        return N2 && (N2.marker && N2.marker.symbol ? I2 = b(i.extendFlat({}, D2, N2.marker)) : N2.marker && (N2.marker.size && (I2.size = N2.marker.size), N2.marker.color && (I2.colors = N2.marker.color), N2.marker.opacity !== void 0 && (I2.opacity = N2.marker.opacity))), I2;
      }
      function w(F13, N2, D2) {
        var I2 = {};
        if (!D2) return I2;
        if (D2.textfont) {
          var O2 = { opacity: 1, text: N2.text, texttemplate: N2.texttemplate, textposition: N2.textposition, textfont: i.extendFlat({}, N2.textfont) };
          D2.textfont && i.extendFlat(O2.textfont, D2.textfont), I2 = x(F13, O2);
        }
        return I2;
      }
      function _4(F13, N2, D2) {
        var I2 = { capSize: 2 * N2.width * D2, lineWidth: N2.thickness * D2, color: N2.color };
        return N2.copy_ystyle && (I2 = F13.error_y), I2;
      }
      var k = d.SYMBOL_SDF_SIZE, T2 = d.SYMBOL_SIZE, A2 = d.SYMBOL_STROKE, S2 = {}, C2 = l.symbolFuncs[0](0.05 * T2);
      function E2(F13) {
        if (F13 === "circle") return null;
        var N2, D2, I2 = l.symbolNumber(F13), O2 = l.symbolFuncs[I2 % 100], L2 = !!l.symbolNoDot[I2 % 100], V2 = !!l.symbolNoFill[I2 % 100], W2 = p.isDotSymbol(F13);
        return S2[F13] ? S2[F13] : (N2 = W2 && !L2 ? O2(1.1 * T2) + C2 : O2(T2), D2 = a(N2, { w: k, h: k, viewBox: [-T2, -T2, T2, T2], stroke: V2 ? A2 : -A2 }), S2[F13] = D2, D2 || null);
      }
      t.exports = { style: function(F13, N2) {
        var D2, I2 = { marker: void 0, markerSel: void 0, markerUnsel: void 0, line: void 0, fill: void 0, errorX: void 0, errorY: void 0, text: void 0, textSel: void 0, textUnsel: void 0 }, O2 = F13._context.plotGlPixelRatio;
        if (N2.visible !== true) return I2;
        if (f.hasText(N2) && (I2.text = x(F13, N2), I2.textSel = w(F13, N2, N2.selected), I2.textUnsel = w(F13, N2, N2.unselected)), f.hasMarkers(N2) && (I2.marker = b(N2), I2.markerSel = y(N2, N2.selected), I2.markerUnsel = y(N2, N2.unselected), !N2.unselected && i.isArrayOrTypedArray(N2.marker.opacity))) {
          var L2 = N2.marker.opacity;
          for (I2.markerUnsel.opacity = new Array(L2.length), D2 = 0; D2 < L2.length; D2++) I2.markerUnsel.opacity[D2] = v * L2[D2];
        }
        if (f.hasLines(N2)) {
          I2.line = { overlay: true, thickness: N2.line.width * O2, color: N2.line.color, opacity: N2.opacity };
          var V2 = (d.DASHES[N2.line.dash] || [1]).slice();
          for (D2 = 0; D2 < V2.length; ++D2) V2[D2] *= N2.line.width * O2;
          I2.line.dashes = V2;
        }
        return N2.error_x && N2.error_x.visible && (I2.errorX = _4(N2, N2.error_x, O2)), N2.error_y && N2.error_y.visible && (I2.errorY = _4(N2, N2.error_y, O2)), N2.fill && N2.fill !== "none" && (I2.fill = { closed: true, fill: N2.fillcolor, thickness: 0 }), I2;
      }, markerStyle: b, markerSelection: y, linePositions: function(F13, N2, D2) {
        var I2, O2, L2 = D2.length, V2 = L2 / 2;
        if (f.hasLines(N2) && V2) if (N2.line.shape === "hv") {
          for (I2 = [], O2 = 0; O2 < V2 - 1; O2++) isNaN(D2[2 * O2]) || isNaN(D2[2 * O2 + 1]) ? I2.push(NaN, NaN, NaN, NaN) : (I2.push(D2[2 * O2], D2[2 * O2 + 1]), isNaN(D2[2 * O2 + 2]) || isNaN(D2[2 * O2 + 3]) ? I2.push(NaN, NaN) : I2.push(D2[2 * O2 + 2], D2[2 * O2 + 1]));
          I2.push(D2[L2 - 2], D2[L2 - 1]);
        } else if (N2.line.shape === "hvh") {
          for (I2 = [], O2 = 0; O2 < V2 - 1; O2++) if (isNaN(D2[2 * O2]) || isNaN(D2[2 * O2 + 1]) || isNaN(D2[2 * O2 + 2]) || isNaN(D2[2 * O2 + 3])) isNaN(D2[2 * O2]) || isNaN(D2[2 * O2 + 1]) ? I2.push(NaN, NaN) : I2.push(D2[2 * O2], D2[2 * O2 + 1]), I2.push(NaN, NaN);
          else {
            var W2 = (D2[2 * O2] + D2[2 * O2 + 2]) / 2;
            I2.push(D2[2 * O2], D2[2 * O2 + 1], W2, D2[2 * O2 + 1], W2, D2[2 * O2 + 3]);
          }
          I2.push(D2[L2 - 2], D2[L2 - 1]);
        } else if (N2.line.shape === "vhv") {
          for (I2 = [], O2 = 0; O2 < V2 - 1; O2++) if (isNaN(D2[2 * O2]) || isNaN(D2[2 * O2 + 1]) || isNaN(D2[2 * O2 + 2]) || isNaN(D2[2 * O2 + 3])) isNaN(D2[2 * O2]) || isNaN(D2[2 * O2 + 1]) ? I2.push(NaN, NaN) : I2.push(D2[2 * O2], D2[2 * O2 + 1]), I2.push(NaN, NaN);
          else {
            var X2 = (D2[2 * O2 + 1] + D2[2 * O2 + 3]) / 2;
            I2.push(D2[2 * O2], D2[2 * O2 + 1], D2[2 * O2], X2, D2[2 * O2 + 2], X2);
          }
          I2.push(D2[L2 - 2], D2[L2 - 1]);
        } else if (N2.line.shape === "vh") {
          for (I2 = [], O2 = 0; O2 < V2 - 1; O2++) isNaN(D2[2 * O2]) || isNaN(D2[2 * O2 + 1]) ? I2.push(NaN, NaN, NaN, NaN) : (I2.push(D2[2 * O2], D2[2 * O2 + 1]), isNaN(D2[2 * O2 + 2]) || isNaN(D2[2 * O2 + 3]) ? I2.push(NaN, NaN) : I2.push(D2[2 * O2], D2[2 * O2 + 3]));
          I2.push(D2[L2 - 2], D2[L2 - 1]);
        } else I2 = D2;
        var Y2 = false;
        for (O2 = 0; O2 < I2.length; O2++) if (isNaN(I2[O2])) {
          Y2 = true;
          break;
        }
        var K2 = Y2 || I2.length > d.TOO_MANY_POINTS || f.hasMarkers(N2) ? "rect" : "round";
        if (Y2 && N2.connectgaps) {
          var q = I2[0], re = I2[1];
          for (O2 = 0; O2 < I2.length; O2 += 2) isNaN(I2[O2]) || isNaN(I2[O2 + 1]) ? (I2[O2] = q, I2[O2 + 1] = re) : (q = I2[O2], re = I2[O2 + 1]);
        }
        return { join: K2, positions: I2 };
      }, errorBarPositions: function(F13, N2, D2, I2, O2) {
        var L2 = s.getComponentMethod("errorbars", "makeComputeError"), V2 = u2.getFromId(F13, N2.xaxis), W2 = u2.getFromId(F13, N2.yaxis), X2 = D2.length / 2, Y2 = {};
        function K2(q, re) {
          var R2 = re._id.charAt(0), z = N2["error_" + R2];
          if (z && z.visible && (re.type === "linear" || re.type === "log")) {
            for (var H2 = L2(z), te = { x: 0, y: 1 }[R2], j = { x: [0, 1, 2, 3], y: [2, 3, 0, 1] }[R2], Q2 = new Float64Array(4 * X2), Z2 = 1 / 0, ne = -1 / 0, ae = 0, ue = 0; ae < X2; ae++, ue += 4) {
              var le = q[ae];
              if (n(le)) {
                var ce = D2[2 * ae + te], se = H2(le, ae), he = se[0], me = se[1];
                if (n(he) && n(me)) {
                  var we = le - he, be = le + me;
                  Q2[ue + j[0]] = ce - re.c2l(we), Q2[ue + j[1]] = re.c2l(be) - ce, Q2[ue + j[2]] = 0, Q2[ue + j[3]] = 0, Z2 = Math.min(Z2, le - he), ne = Math.max(ne, le + me);
                }
              }
            }
            Y2[R2] = { positions: D2, errors: Q2, _bnds: [Z2, ne] };
          }
        }
        return K2(I2, V2), K2(O2, W2), Y2;
      }, textPosition: function(F13, N2, D2, I2) {
        var O2, L2 = N2._length, V2 = {};
        if (f.hasMarkers(N2)) {
          var W2 = D2.font, X2 = D2.align, Y2 = D2.baseline;
          for (V2.offset = new Array(L2), O2 = 0; O2 < L2; O2++) {
            var K2 = I2.sizes ? I2.sizes[O2] : I2.size, q = Array.isArray(W2) ? W2[O2].size : W2.size, re = Array.isArray(X2) ? X2.length > 1 ? X2[O2] : X2[0] : X2, R2 = Array.isArray(Y2) ? Y2.length > 1 ? Y2[O2] : Y2[0] : Y2, z = m[re], H2 = m[R2], te = K2 ? K2 / 0.8 + 1 : 0, j = -H2 * te - 0.5 * H2;
            V2.offset[O2] = [z * te / q, j / q];
          }
        }
        return V2;
      } };
    }, { "../../components/drawing": 388, "../../components/fx/helpers": 402, "../../constants/interactions": 478, "../../lib": 503, "../../lib/gl_format_color": 499, "../../plots/cartesian/axis_ids": 558, "../../registry": 638, "../scatter/make_bubble_size_func": 943, "../scatter/subtypes": 951, "./constants": 980, "./helpers": 985, "color-normalize": 89, "fast-isnumeric": 190, "svg-path-sdf": 310 }], 982: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../registry"), o = e("./helpers"), s = e("./attributes"), i = e("../scatter/constants"), l = e("../scatter/subtypes"), u2 = e("../scatter/xy_defaults"), c = e("../scatter/period_defaults"), f = e("../scatter/marker_defaults"), h = e("../scatter/line_defaults"), p = e("../scatter/fillcolor_defaults"), d = e("../scatter/text_defaults");
      t.exports = function(v, m, g, x) {
        function b(C2, E2) {
          return n.coerce(v, m, s, C2, E2);
        }
        var y = !!v.marker && o.isOpenSymbol(v.marker.symbol), w = l.isBubble(v), _4 = u2(v, m, x, b);
        if (_4) {
          c(v, m, x, b), b("xhoverformat"), b("yhoverformat");
          var k = _4 < i.PTS_LINESONLY ? "lines+markers" : "lines";
          b("text"), b("hovertext"), b("hovertemplate"), b("mode", k), l.hasLines(m) && (b("connectgaps"), h(v, m, g, x, b), b("line.shape")), l.hasMarkers(m) && (f(v, m, g, x, b), b("marker.line.width", y || w ? 1 : 0)), l.hasText(m) && (b("texttemplate"), d(v, m, x, b));
          var T2 = (m.line || {}).color, A2 = (m.marker || {}).color;
          b("fill"), m.fill !== "none" && p(v, m, g, b);
          var S2 = a.getComponentMethod("errorbars", "supplyDefaults");
          S2(v, m, T2 || A2 || g, { axis: "y" }), S2(v, m, T2 || A2 || g, { axis: "x", inherit: "y" }), n.coerceSelectionMarkerOpacity(m, b);
        } else m.visible = false;
      };
    }, { "../../lib": 503, "../../registry": 638, "../scatter/constants": 930, "../scatter/fillcolor_defaults": 934, "../scatter/line_defaults": 939, "../scatter/marker_defaults": 945, "../scatter/period_defaults": 946, "../scatter/subtypes": 951, "../scatter/text_defaults": 952, "../scatter/xy_defaults": 953, "./attributes": 978, "./helpers": 985 }], 983: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../components/color"), o = e("../../constants/interactions").DESELECTDIM;
      t.exports = { styleTextSelection: function(s) {
        var i, l, u2 = s[0], c = u2.trace, f = u2.t, h = f._scene, p = f.index, d = h.selectBatch[p], v = h.unselectBatch[p], m = h.textOptions[p], g = h.textSelectedOptions[p] || {}, x = h.textUnselectedOptions[p] || {}, b = n.extendFlat({}, m);
        if (d.length || v.length) {
          var y = g.color, w = x.color, _4 = m.color, k = Array.isArray(_4);
          for (b.color = new Array(c._length), i = 0; i < d.length; i++) l = d[i], b.color[l] = y || (k ? _4[l] : _4);
          for (i = 0; i < v.length; i++) {
            l = v[i];
            var T2 = k ? _4[l] : _4;
            b.color[l] = w || (y ? T2 : a.addOpacity(T2, o));
          }
        }
        h.glText[p].update(b);
      } };
    }, { "../../components/color": 366, "../../constants/interactions": 478, "../../lib": 503 }], 984: [function(e, t, r) {
      "use strict";
      var n = e("../scatter/format_labels");
      t.exports = function(a, o, s) {
        var i = a.i;
        return "x" in a || (a.x = o._x[i]), "y" in a || (a.y = o._y[i]), n(a, o, s);
      };
    }, { "../scatter/format_labels": 935 }], 985: [function(e, t, r) {
      "use strict";
      var n = e("./constants");
      r.isOpenSymbol = function(a) {
        return typeof a == "string" ? n.OPEN_RE.test(a) : a % 200 > 100;
      }, r.isDotSymbol = function(a) {
        return typeof a == "string" ? n.DOT_RE.test(a) : a > 200;
      };
    }, { "./constants": 980 }], 986: [function(e, t, r) {
      "use strict";
      var n = e("../../registry"), a = e("../../lib"), o = e("../scatter/get_trace_color");
      function s(i, l, u2, c) {
        var f = i.xa, h = i.ya, p = i.distance, d = i.dxy, v = i.index, m = { pointNumber: v, x: l[v], y: u2[v] };
        m.tx = Array.isArray(c.text) ? c.text[v] : c.text, m.htx = Array.isArray(c.hovertext) ? c.hovertext[v] : c.hovertext, m.data = Array.isArray(c.customdata) ? c.customdata[v] : c.customdata, m.tp = Array.isArray(c.textposition) ? c.textposition[v] : c.textposition;
        var g = c.textfont;
        g && (m.ts = a.isArrayOrTypedArray(g.size) ? g.size[v] : g.size, m.tc = Array.isArray(g.color) ? g.color[v] : g.color, m.tf = Array.isArray(g.family) ? g.family[v] : g.family);
        var x = c.marker;
        x && (m.ms = a.isArrayOrTypedArray(x.size) ? x.size[v] : x.size, m.mo = a.isArrayOrTypedArray(x.opacity) ? x.opacity[v] : x.opacity, m.mx = a.isArrayOrTypedArray(x.symbol) ? x.symbol[v] : x.symbol, m.mc = a.isArrayOrTypedArray(x.color) ? x.color[v] : x.color);
        var b = x && x.line;
        b && (m.mlc = Array.isArray(b.color) ? b.color[v] : b.color, m.mlw = a.isArrayOrTypedArray(b.width) ? b.width[v] : b.width);
        var y = x && x.gradient;
        y && y.type !== "none" && (m.mgt = Array.isArray(y.type) ? y.type[v] : y.type, m.mgc = Array.isArray(y.color) ? y.color[v] : y.color);
        var w = f.c2p(m.x, true), _4 = h.c2p(m.y, true), k = m.mrc || 1, T2 = c.hoverlabel;
        T2 && (m.hbg = Array.isArray(T2.bgcolor) ? T2.bgcolor[v] : T2.bgcolor, m.hbc = Array.isArray(T2.bordercolor) ? T2.bordercolor[v] : T2.bordercolor, m.hts = a.isArrayOrTypedArray(T2.font.size) ? T2.font.size[v] : T2.font.size, m.htc = Array.isArray(T2.font.color) ? T2.font.color[v] : T2.font.color, m.htf = Array.isArray(T2.font.family) ? T2.font.family[v] : T2.font.family, m.hnl = a.isArrayOrTypedArray(T2.namelength) ? T2.namelength[v] : T2.namelength);
        var A2 = c.hoverinfo;
        A2 && (m.hi = Array.isArray(A2) ? A2[v] : A2);
        var S2 = c.hovertemplate;
        S2 && (m.ht = Array.isArray(S2) ? S2[v] : S2);
        var C2 = {};
        C2[i.index] = m;
        var E2 = c._origX, F13 = c._origY, N2 = a.extendFlat({}, i, { color: o(c, m), x0: w - k, x1: w + k, xLabelVal: E2 ? E2[v] : m.x, y0: _4 - k, y1: _4 + k, yLabelVal: F13 ? F13[v] : m.y, cd: C2, distance: p, spikeDistance: d, hovertemplate: m.ht });
        return m.htx ? N2.text = m.htx : m.tx ? N2.text = m.tx : c.text && (N2.text = c.text), a.fillText(m, c, N2), n.getComponentMethod("errorbars", "hoverInfo")(m, c, N2), N2;
      }
      t.exports = { hoverPoints: function(i, l, u2, c) {
        var f, h, p, d, v, m, g, x, b, y, w = i.cd, _4 = w[0].t, k = w[0].trace, T2 = i.xa, A2 = i.ya, S2 = _4.x, C2 = _4.y, E2 = T2.c2p(l), F13 = A2.c2p(u2), N2 = i.distance;
        if (_4.tree) {
          var D2 = T2.p2c(E2 - N2), I2 = T2.p2c(E2 + N2), O2 = A2.p2c(F13 - N2), L2 = A2.p2c(F13 + N2);
          f = c === "x" ? _4.tree.range(Math.min(D2, I2), Math.min(A2._rl[0], A2._rl[1]), Math.max(D2, I2), Math.max(A2._rl[0], A2._rl[1])) : _4.tree.range(Math.min(D2, I2), Math.min(O2, L2), Math.max(D2, I2), Math.max(O2, L2));
        } else f = _4.ids;
        var V2 = N2;
        if (c === "x") {
          var W2 = !!k.xperiodalignment, X2 = !!k.yperiodalignment;
          for (m = 0; m < f.length; m++) {
            if (d = S2[h = f[m]], g = Math.abs(T2.c2p(d) - E2), W2) {
              var Y2 = T2.c2p(k._xStarts[h]), K2 = T2.c2p(k._xEnds[h]);
              g = E2 >= Math.min(Y2, K2) && E2 <= Math.max(Y2, K2) ? 0 : 1 / 0;
            }
            if (g < V2) {
              if (V2 = g, v = C2[h], x = A2.c2p(v) - F13, X2) {
                var q = A2.c2p(k._yStarts[h]), re = A2.c2p(k._yEnds[h]);
                x = F13 >= Math.min(q, re) && F13 <= Math.max(q, re) ? 0 : 1 / 0;
              }
              y = Math.sqrt(g * g + x * x), p = f[m];
            }
          }
        } else for (m = f.length - 1; m > -1; m--) d = S2[h = f[m]], v = C2[h], g = T2.c2p(d) - E2, x = A2.c2p(v) - F13, (b = Math.sqrt(g * g + x * x)) < V2 && (V2 = y = b, p = h);
        return i.index = p, i.distance = V2, i.dxy = y, p === void 0 ? [i] : [s(i, S2, C2, k)];
      }, calcHover: s };
    }, { "../../lib": 503, "../../registry": 638, "../scatter/get_trace_color": 936 }], 987: [function(e, t, r) {
      "use strict";
      var n = e("./hover");
      t.exports = { moduleType: "trace", name: "scattergl", basePlotModule: e("../../plots/cartesian"), categories: ["gl", "regl", "cartesian", "symbols", "errorBarsOK", "showLegend", "scatter-like"], attributes: e("./attributes"), supplyDefaults: e("./defaults"), crossTraceDefaults: e("../scatter/cross_trace_defaults"), colorbar: e("../scatter/marker_colorbar"), formatLabels: e("./format_labels"), calc: e("./calc"), plot: e("./plot"), hoverPoints: n.hoverPoints, selectPoints: e("./select"), meta: {} };
    }, { "../../plots/cartesian": 568, "../scatter/cross_trace_defaults": 932, "../scatter/marker_colorbar": 944, "./attributes": 978, "./calc": 979, "./defaults": 982, "./format_labels": 984, "./hover": 986, "./plot": 988, "./select": 990 }], 988: [function(e, t, r) {
      "use strict";
      var n = e("regl-scatter2d"), a = e("regl-line2d"), o = e("regl-error2d"), s = e("gl-text"), i = e("../../lib"), l = e("../../components/dragelement/helpers").selectMode, u2 = e("../../lib/prepare_regl"), c = e("../scatter/subtypes"), f = e("../scatter/link_traces"), h = e("./edit_style").styleTextSelection;
      function p(d, v, m, g) {
        var x = d._size, b = d.width * g, y = d.height * g, w = x.l * g, _4 = x.b * g, k = x.r * g, T2 = x.t * g, A2 = x.w * g, S2 = x.h * g;
        return [w + v.domain[0] * A2, _4 + m.domain[0] * S2, b - k - (1 - v.domain[1]) * A2, y - T2 - (1 - m.domain[1]) * S2];
      }
      t.exports = function(d, v, m) {
        if (m.length) {
          var g, x, b = d._fullLayout, y = v._scene, w = v.xaxis, _4 = v.yaxis;
          if (y) if (u2(d, ["ANGLE_instanced_arrays", "OES_element_index_uint"])) {
            var k = y.count, T2 = b._glcanvas.data()[0].regl;
            if (f(d, v, m), y.dirty) {
              if (y.error2d === true && (y.error2d = o(T2)), y.line2d === true && (y.line2d = a(T2)), y.scatter2d === true && (y.scatter2d = n(T2)), y.fill2d === true && (y.fill2d = a(T2)), y.glText === true) for (y.glText = new Array(k), g = 0; g < k; g++) y.glText[g] = new s(T2);
              if (y.glText) {
                if (k > y.glText.length) {
                  var A2 = k - y.glText.length;
                  for (g = 0; g < A2; g++) y.glText.push(new s(T2));
                } else if (k < y.glText.length) {
                  var S2 = y.glText.length - k;
                  y.glText.splice(k, S2).forEach(function(j) {
                    j.destroy();
                  });
                }
                for (g = 0; g < k; g++) y.glText[g].update(y.textOptions[g]);
              }
              if (y.line2d && (y.line2d.update(y.lineOptions), y.lineOptions = y.lineOptions.map(function(j) {
                if (j && j.positions) {
                  for (var Q2 = j.positions, Z2 = 0; Z2 < Q2.length && (isNaN(Q2[Z2]) || isNaN(Q2[Z2 + 1])); ) Z2 += 2;
                  for (var ne = Q2.length - 2; ne > Z2 && (isNaN(Q2[ne]) || isNaN(Q2[ne + 1])); ) ne -= 2;
                  j.positions = Q2.slice(Z2, ne + 2);
                }
                return j;
              }), y.line2d.update(y.lineOptions)), y.error2d) {
                var C2 = (y.errorXOptions || []).concat(y.errorYOptions || []);
                y.error2d.update(C2);
              }
              y.scatter2d && y.scatter2d.update(y.markerOptions), y.fillOrder = i.repeat(null, k), y.fill2d && (y.fillOptions = y.fillOptions.map(function(j, Q2) {
                var Z2 = m[Q2];
                if (j && Z2 && Z2[0] && Z2[0].trace) {
                  var ne, ae, ue = Z2[0], le = ue.trace, ce = ue.t, se = y.lineOptions[Q2], he = [];
                  le._ownfill && he.push(Q2), le._nexttrace && he.push(Q2 + 1), he.length && (y.fillOrder[Q2] = he);
                  var me, we, be = [], Ae = se && se.positions || ce.positions;
                  if (le.fill === "tozeroy") {
                    for (me = 0; me < Ae.length && isNaN(Ae[me + 1]); ) me += 2;
                    for (we = Ae.length - 2; we > me && isNaN(Ae[we + 1]); ) we -= 2;
                    Ae[me + 1] !== 0 && (be = [Ae[me], 0]), be = be.concat(Ae.slice(me, we + 2)), Ae[we + 1] !== 0 && (be = be.concat([Ae[we], 0]));
                  } else if (le.fill === "tozerox") {
                    for (me = 0; me < Ae.length && isNaN(Ae[me]); ) me += 2;
                    for (we = Ae.length - 2; we > me && isNaN(Ae[we]); ) we -= 2;
                    Ae[me] !== 0 && (be = [0, Ae[me + 1]]), be = be.concat(Ae.slice(me, we + 2)), Ae[we] !== 0 && (be = be.concat([0, Ae[we + 1]]));
                  } else if (le.fill === "toself" || le.fill === "tonext") {
                    for (be = [], ne = 0, j.splitNull = true, ae = 0; ae < Ae.length; ae += 2) (isNaN(Ae[ae]) || isNaN(Ae[ae + 1])) && ((be = be.concat(Ae.slice(ne, ae))).push(Ae[ne], Ae[ne + 1]), be.push(null, null), ne = ae + 2);
                    be = be.concat(Ae.slice(ne)), ne && be.push(Ae[ne], Ae[ne + 1]);
                  } else {
                    var pe = le._nexttrace;
                    if (pe) {
                      var ve = y.lineOptions[Q2 + 1];
                      if (ve) {
                        var Ee = ve.positions;
                        if (le.fill === "tonexty") {
                          for (be = Ae.slice(), Q2 = Math.floor(Ee.length / 2); Q2--; ) {
                            var Se = Ee[2 * Q2], Ce = Ee[2 * Q2 + 1];
                            isNaN(Se) || isNaN(Ce) || be.push(Se, Ce);
                          }
                          j.fill = pe.fillcolor;
                        }
                      }
                    }
                  }
                  if (le._prevtrace && le._prevtrace.fill === "tonext") {
                    var Be = y.lineOptions[Q2 - 1].positions, Ue = be.length / 2, Ke = [ne = Ue];
                    for (ae = 0; ae < Be.length; ae += 2) (isNaN(Be[ae]) || isNaN(Be[ae + 1])) && (Ke.push(ae / 2 + Ue + 1), ne = ae + 2);
                    be = be.concat(Be), j.hole = Ke;
                  }
                  return j.fillmode = le.fill, j.opacity = le.opacity, j.positions = be, j;
                }
              }), y.fill2d.update(y.fillOptions));
            }
            var E2 = b.dragmode, F13 = l(E2), N2 = b.clickmode.indexOf("select") > -1;
            for (g = 0; g < k; g++) {
              var D2 = m[g][0], I2 = D2.trace, O2 = D2.t, L2 = O2.index, V2 = I2._length, W2 = O2.x, X2 = O2.y;
              if (I2.selectedpoints || F13 || N2) {
                if (F13 || (F13 = true), I2.selectedpoints) {
                  var Y2 = y.selectBatch[L2] = i.selIndices2selPoints(I2), K2 = {};
                  for (x = 0; x < Y2.length; x++) K2[Y2[x]] = 1;
                  var q = [];
                  for (x = 0; x < V2; x++) K2[x] || q.push(x);
                  y.unselectBatch[L2] = q;
                }
                var re = O2.xpx = new Array(V2), R2 = O2.ypx = new Array(V2);
                for (x = 0; x < V2; x++) re[x] = w.c2p(W2[x]), R2[x] = _4.c2p(X2[x]);
              } else O2.xpx = O2.ypx = null;
            }
            if (F13) {
              if (y.select2d || (y.select2d = n(b._glcanvas.data()[1].regl)), y.scatter2d) {
                var z = new Array(k);
                for (g = 0; g < k; g++) z[g] = y.selectBatch[g].length || y.unselectBatch[g].length ? y.markerUnselectedOptions[g] : {};
                y.scatter2d.update(z);
              }
              y.select2d && (y.select2d.update(y.markerOptions), y.select2d.update(y.markerSelectedOptions)), y.glText && m.forEach(function(j) {
                var Q2 = ((j || [])[0] || {}).trace || {};
                c.hasText(Q2) && h(j);
              });
            } else y.scatter2d && y.scatter2d.update(y.markerOptions);
            var H2 = { viewport: p(b, w, _4, d._context.plotGlPixelRatio), range: [(w._rl || w.range)[0], (_4._rl || _4.range)[0], (w._rl || w.range)[1], (_4._rl || _4.range)[1]] }, te = i.repeat(H2, y.count);
            y.fill2d && y.fill2d.update(te), y.line2d && y.line2d.update(te), y.error2d && y.error2d.update(te.concat(te)), y.scatter2d && y.scatter2d.update(te), y.select2d && y.select2d.update(te), y.glText && y.glText.forEach(function(j) {
              j.update(H2);
            });
          } else y.init();
        }
      };
    }, { "../../components/dragelement/helpers": 384, "../../lib": 503, "../../lib/prepare_regl": 516, "../scatter/link_traces": 942, "../scatter/subtypes": 951, "./edit_style": 983, "gl-text": 225, "regl-error2d": 279, "regl-line2d": 280, "regl-scatter2d": 281 }], 989: [function(e, t, r) {
      "use strict";
      var n = e("../../lib");
      t.exports = function(a, o) {
        var s = o._scene, i = { count: 0, dirty: true, lineOptions: [], fillOptions: [], markerOptions: [], markerSelectedOptions: [], markerUnselectedOptions: [], errorXOptions: [], errorYOptions: [], textOptions: [], textSelectedOptions: [], textUnselectedOptions: [], selectBatch: [], unselectBatch: [] }, l = { fill2d: false, scatter2d: false, error2d: false, line2d: false, glText: false, select2d: false };
        return o._scene || ((s = o._scene = {}).init = function() {
          n.extendFlat(s, l, i);
        }, s.init(), s.update = function(u2) {
          var c = n.repeat(u2, s.count);
          if (s.fill2d && s.fill2d.update(c), s.scatter2d && s.scatter2d.update(c), s.line2d && s.line2d.update(c), s.error2d && s.error2d.update(c.concat(c)), s.select2d && s.select2d.update(c), s.glText) for (var f = 0; f < s.count; f++) s.glText[f].update(u2);
        }, s.draw = function() {
          for (var u2 = s.count, c = s.fill2d, f = s.error2d, h = s.line2d, p = s.scatter2d, d = s.glText, v = s.select2d, m = s.selectBatch, g = s.unselectBatch, x = 0; x < u2; x++) {
            if (c && s.fillOrder[x] && c.draw(s.fillOrder[x]), h && s.lineOptions[x] && h.draw(x), f && (s.errorXOptions[x] && f.draw(x), s.errorYOptions[x] && f.draw(x + u2)), p && s.markerOptions[x]) if (g[x].length) {
              var b = n.repeat([], s.count);
              b[x] = g[x], p.draw(b);
            } else m[x].length || p.draw(x);
            d[x] && s.textOptions[x] && d[x].render();
          }
          v && v.draw(m), s.dirty = false;
        }, s.destroy = function() {
          s.fill2d && s.fill2d.destroy && s.fill2d.destroy(), s.scatter2d && s.scatter2d.destroy && s.scatter2d.destroy(), s.error2d && s.error2d.destroy && s.error2d.destroy(), s.line2d && s.line2d.destroy && s.line2d.destroy(), s.select2d && s.select2d.destroy && s.select2d.destroy(), s.glText && s.glText.forEach(function(u2) {
            u2.destroy && u2.destroy();
          }), s.lineOptions = null, s.fillOptions = null, s.markerOptions = null, s.markerSelectedOptions = null, s.markerUnselectedOptions = null, s.errorXOptions = null, s.errorYOptions = null, s.textOptions = null, s.textSelectedOptions = null, s.textUnselectedOptions = null, s.selectBatch = null, s.unselectBatch = null, o._scene = null;
        }), s.dirty || n.extendFlat(s, i), s;
      };
    }, { "../../lib": 503 }], 990: [function(e, t, r) {
      "use strict";
      var n = e("../scatter/subtypes"), a = e("./edit_style").styleTextSelection;
      t.exports = function(o, s) {
        var i = o.cd, l = o.xaxis, u2 = o.yaxis, c = [], f = i[0].trace, h = i[0].t, p = f._length, d = h.x, v = h.y, m = h._scene, g = h.index;
        if (!m) return c;
        var x = n.hasText(f), b = n.hasMarkers(f), y = !b && !x;
        if (f.visible !== true || y) return c;
        var w = [], _4 = [];
        if (s !== false && !s.degenerate) for (var k = 0; k < p; k++) s.contains([h.xpx[k], h.ypx[k]], false, k, o) ? (w.push(k), c.push({ pointNumber: k, x: l.c2d(d[k]), y: u2.c2d(v[k]) })) : _4.push(k);
        if (b) {
          var T2 = m.scatter2d;
          if (w.length || _4.length) {
            if (!m.selectBatch[g].length && !m.unselectBatch[g].length) {
              var A2 = new Array(m.count);
              A2[g] = m.markerUnselectedOptions[g], T2.update.apply(T2, A2);
            }
          } else {
            var S2 = new Array(m.count);
            S2[g] = m.markerOptions[g], T2.update.apply(T2, S2);
          }
        }
        return m.selectBatch[g] = w, m.unselectBatch[g] = _4, x && a(i), c;
      };
    }, { "../scatter/subtypes": 951, "./edit_style": 983 }], 991: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/template_attributes").hovertemplateAttrs, a = e("../../plots/template_attributes").texttemplateAttrs, o = e("../scattergeo/attributes"), s = e("../scatter/attributes"), i = e("../../plots/mapbox/layout_attributes"), l = e("../../plots/attributes"), u2 = e("../../components/colorscale/attributes"), c = e("../../lib/extend").extendFlat, f = e("../../plot_api/edit_types").overrideAll, h = o.line, p = o.marker;
      t.exports = f({ lon: o.lon, lat: o.lat, mode: c({}, s.mode, { dflt: "markers" }), text: c({}, s.text, {}), texttemplate: a({ editType: "plot" }, { keys: ["lat", "lon", "text"] }), hovertext: c({}, s.hovertext, {}), line: { color: h.color, width: h.width }, connectgaps: s.connectgaps, marker: c({ symbol: { valType: "string", dflt: "circle", arrayOk: true }, angle: { valType: "number", dflt: "auto", arrayOk: true }, allowoverlap: { valType: "boolean", dflt: false }, opacity: p.opacity, size: p.size, sizeref: p.sizeref, sizemin: p.sizemin, sizemode: p.sizemode }, u2("marker")), fill: o.fill, fillcolor: s.fillcolor, textfont: i.layers.symbol.textfont, textposition: i.layers.symbol.textposition, below: { valType: "string" }, selected: { marker: s.selected.marker }, unselected: { marker: s.unselected.marker }, hoverinfo: c({}, l.hoverinfo, { flags: ["lon", "lat", "text", "name"] }), hovertemplate: n() }, "calc", "nested");
    }, { "../../components/colorscale/attributes": 373, "../../lib/extend": 493, "../../plot_api/edit_types": 536, "../../plots/attributes": 550, "../../plots/mapbox/layout_attributes": 615, "../../plots/template_attributes": 633, "../scatter/attributes": 926, "../scattergeo/attributes": 968 }], 992: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("../../lib"), o = e("../../constants/numerical").BADNUM, s = e("../../lib/geojson_utils"), i = e("../../components/colorscale"), l = e("../../components/drawing"), u2 = e("../scatter/make_bubble_size_func"), c = e("../scatter/subtypes"), f = e("../../plots/mapbox/convert_text_opts"), h = e("../../components/fx/helpers").appendArrayPointValue, p = e("../../lib/svg_text_utils").NEWLINES, d = e("../../lib/svg_text_utils").BR_TAG_ALL;
      function v() {
        return { geojson: s.makeBlank(), layout: { visibility: "none" }, paint: {} };
      }
      function m(b, y) {
        return a.isArrayOrTypedArray(b) ? y ? function(w) {
          return n(b[w]) ? +b[w] : 0;
        } : function(w) {
          return b[w];
        } : b ? function() {
          return b;
        } : g;
      }
      function g() {
        return "";
      }
      function x(b) {
        return b[0] === o;
      }
      t.exports = function(b, y) {
        var w, _4 = y[0].trace, k = _4.visible === true && _4._length !== 0, T2 = _4.fill !== "none", A2 = c.hasLines(_4), S2 = c.hasMarkers(_4), C2 = c.hasText(_4), E2 = S2 && _4.marker.symbol === "circle", F13 = S2 && _4.marker.symbol !== "circle", N2 = v(), D2 = v(), I2 = v(), O2 = v(), L2 = { fill: N2, line: D2, circle: I2, symbol: O2 };
        if (!k) return L2;
        if ((T2 || A2) && (w = s.calcTraceToLineCoords(y)), T2 && (N2.geojson = s.makePolygon(w), N2.layout.visibility = "visible", a.extendFlat(N2.paint, { "fill-color": _4.fillcolor })), A2 && (D2.geojson = s.makeLine(w), D2.layout.visibility = "visible", a.extendFlat(D2.paint, { "line-width": _4.line.width, "line-color": _4.line.color, "line-opacity": _4.opacity })), E2) {
          var V2 = function(Y2) {
            var K2, q, re, R2, z = Y2[0].trace, H2 = z.marker, te = z.selectedpoints, j = a.isArrayOrTypedArray(H2.color), Q2 = a.isArrayOrTypedArray(H2.size), Z2 = a.isArrayOrTypedArray(H2.opacity);
            function ne(we) {
              return z.opacity * we;
            }
            j && (q = i.hasColorscale(z, "marker") ? i.makeColorScaleFuncFromTrace(H2) : a.identity), Q2 && (re = u2(z)), Z2 && (R2 = function(we) {
              return ne(n(we) ? +a.constrain(we, 0, 1) : 0);
            });
            var ae, ue = [];
            for (K2 = 0; K2 < Y2.length; K2++) {
              var le = Y2[K2], ce = le.lonlat;
              if (!x(ce)) {
                var se = {};
                q && (se.mcc = le.mcc = q(le.mc)), re && (se.mrc = le.mrc = re(le.ms)), R2 && (se.mo = R2(le.mo)), te && (se.selected = le.selected || 0), ue.push({ type: "Feature", geometry: { type: "Point", coordinates: ce }, properties: se });
              }
            }
            if (te) for (ae = l.makeSelectedPointStyleFns(z), K2 = 0; K2 < ue.length; K2++) {
              var he = ue[K2].properties;
              ae.selectedOpacityFn && (he.mo = ne(ae.selectedOpacityFn(he))), ae.selectedColorFn && (he.mcc = ae.selectedColorFn(he)), ae.selectedSizeFn && (he.mrc = ae.selectedSizeFn(he));
            }
            return { geojson: { type: "FeatureCollection", features: ue }, mcc: j || ae && ae.selectedColorFn ? { type: "identity", property: "mcc" } : H2.color, mrc: Q2 || ae && ae.selectedSizeFn ? { type: "identity", property: "mrc" } : (me = H2.size, me / 2), mo: Z2 || ae && ae.selectedOpacityFn ? { type: "identity", property: "mo" } : ne(H2.opacity) };
            var me;
          }(y);
          I2.geojson = V2.geojson, I2.layout.visibility = "visible", a.extendFlat(I2.paint, { "circle-color": V2.mcc, "circle-radius": V2.mrc, "circle-opacity": V2.mo });
        }
        if ((F13 || C2) && (O2.geojson = function(Y2, K2) {
          for (var q = K2._fullLayout, re = Y2[0].trace, R2 = re.marker || {}, z = R2.symbol, H2 = R2.angle, te = z !== "circle" ? m(z) : g, j = H2 !== "auto" ? m(H2, true) : g, Q2 = c.hasText(re) ? m(re.text) : g, Z2 = [], ne = 0; ne < Y2.length; ne++) {
            var ae = Y2[ne];
            if (!x(ae.lonlat)) {
              var ue, le = re.texttemplate;
              if (le) {
                var ce = Array.isArray(le) ? le[ne] || "" : le, se = re._module.formatLabels(ae, re, q), he = {};
                h(he, re, ae.i);
                var me = re._meta || {};
                ue = a.texttemplateString(ce, se, q._d3locale, he, ae, me);
              } else ue = Q2(ne);
              ue && (ue = ue.replace(p, "").replace(d, `
`)), Z2.push({ type: "Feature", geometry: { type: "Point", coordinates: ae.lonlat }, properties: { symbol: te(ne), angle: j(ne), text: ue } });
            }
          }
          return { type: "FeatureCollection", features: Z2 };
        }(y, b), a.extendFlat(O2.layout, { visibility: "visible", "icon-image": "{symbol}-15", "text-field": "{text}" }), F13 && (a.extendFlat(O2.layout, { "icon-size": _4.marker.size / 10 }), "angle" in _4.marker && _4.marker.angle !== "auto" && a.extendFlat(O2.layout, { "icon-rotate": { type: "identity", property: "angle" }, "icon-rotation-alignment": "map" }), O2.layout["icon-allow-overlap"] = _4.marker.allowoverlap, a.extendFlat(O2.paint, { "icon-opacity": _4.opacity * _4.marker.opacity, "icon-color": _4.marker.color })), C2)) {
          var W2 = (_4.marker || {}).size, X2 = f(_4.textposition, W2);
          a.extendFlat(O2.layout, { "text-size": _4.textfont.size, "text-anchor": X2.anchor, "text-offset": X2.offset }), a.extendFlat(O2.paint, { "text-color": _4.textfont.color, "text-opacity": _4.opacity });
        }
        return L2;
      };
    }, { "../../components/colorscale": 378, "../../components/drawing": 388, "../../components/fx/helpers": 402, "../../constants/numerical": 479, "../../lib": 503, "../../lib/geojson_utils": 497, "../../lib/svg_text_utils": 529, "../../plots/mapbox/convert_text_opts": 612, "../scatter/make_bubble_size_func": 943, "../scatter/subtypes": 951, "fast-isnumeric": 190 }], 993: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../scatter/subtypes"), o = e("../scatter/marker_defaults"), s = e("../scatter/line_defaults"), i = e("../scatter/text_defaults"), l = e("../scatter/fillcolor_defaults"), u2 = e("./attributes");
      t.exports = function(c, f, h, p) {
        function d(m, g) {
          return n.coerce(c, f, u2, m, g);
        }
        if (function(m, g, x) {
          var b = x("lon") || [], y = x("lat") || [], w = Math.min(b.length, y.length);
          return g._length = w, w;
        }(0, f, d)) {
          if (d("text"), d("texttemplate"), d("hovertext"), d("hovertemplate"), d("mode"), d("below"), a.hasLines(f) && (s(c, f, h, p, d, { noDash: true }), d("connectgaps")), a.hasMarkers(f)) {
            o(c, f, h, p, d, { noLine: true }), d("marker.allowoverlap"), d("marker.angle");
            var v = f.marker;
            v.symbol !== "circle" && (n.isArrayOrTypedArray(v.size) && (v.size = v.size[0]), n.isArrayOrTypedArray(v.color) && (v.color = v.color[0]));
          }
          a.hasText(f) && i(c, f, p, d, { noSelect: true }), d("fill"), f.fill !== "none" && l(c, f, h, d), n.coerceSelectionMarkerOpacity(f, d);
        } else f.visible = false;
      };
    }, { "../../lib": 503, "../scatter/fillcolor_defaults": 934, "../scatter/line_defaults": 939, "../scatter/marker_defaults": 945, "../scatter/subtypes": 951, "../scatter/text_defaults": 952, "./attributes": 991 }], 994: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a) {
        return n.lon = a.lon, n.lat = a.lat, n;
      };
    }, {}], 995: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/cartesian/axes");
      t.exports = function(a, o, s) {
        var i = {}, l = s[o.subplot]._subplot.mockAxis, u2 = a.lonlat;
        return i.lonLabel = n.tickText(l, l.c2l(u2[0]), true).text, i.latLabel = n.tickText(l, l.c2l(u2[1]), true).text, i;
      };
    }, { "../../plots/cartesian/axes": 554 }], 996: [function(e, t, r) {
      "use strict";
      var n = e("../../components/fx"), a = e("../../lib"), o = e("../scatter/get_trace_color"), s = a.fillText, i = e("../../constants/numerical").BADNUM;
      function l(u2, c, f) {
        if (!u2.hovertemplate) {
          var h = (c.hi || u2.hoverinfo).split("+"), p = h.indexOf("all") !== -1, d = h.indexOf("lon") !== -1, v = h.indexOf("lat") !== -1, m = c.lonlat, g = [];
          return p || d && v ? g.push("(" + x(m[1]) + ", " + x(m[0]) + ")") : d ? g.push(f.lon + x(m[0])) : v && g.push(f.lat + x(m[1])), (p || h.indexOf("text") !== -1) && s(c, u2, g), g.join("<br>");
        }
        function x(b) {
          return b + "\xB0";
        }
      }
      t.exports = { hoverPoints: function(u2, c, f) {
        var h = u2.cd, p = h[0].trace, d = u2.xa, v = u2.ya, m = u2.subplot, g = 360 * (c >= 0 ? Math.floor((c + 180) / 360) : Math.ceil((c - 180) / 360)), x = c - g;
        if (n.getClosest(h, function(C2) {
          var E2 = C2.lonlat;
          if (E2[0] === i) return 1 / 0;
          var F13 = a.modHalf(E2[0], 360), N2 = E2[1], D2 = m.project([F13, N2]), I2 = D2.x - d.c2p([x, N2]), O2 = D2.y - v.c2p([F13, f]), L2 = Math.max(3, C2.mrc || 0);
          return Math.max(Math.sqrt(I2 * I2 + O2 * O2) - L2, 1 - 3 / L2);
        }, u2), u2.index !== false) {
          var b = h[u2.index], y = b.lonlat, w = [a.modHalf(y[0], 360) + g, y[1]], _4 = d.c2p(w), k = v.c2p(w), T2 = b.mrc || 1;
          u2.x0 = _4 - T2, u2.x1 = _4 + T2, u2.y0 = k - T2, u2.y1 = k + T2;
          var A2 = {};
          A2[p.subplot] = { _subplot: m };
          var S2 = p._module.formatLabels(b, p, A2);
          return u2.lonLabel = S2.lonLabel, u2.latLabel = S2.latLabel, u2.color = o(p, b), u2.extraText = l(p, b, h[0].t.labels), u2.hovertemplate = p.hovertemplate, [u2];
        }
      }, getExtraText: l };
    }, { "../../components/fx": 406, "../../constants/numerical": 479, "../../lib": 503, "../scatter/get_trace_color": 936 }], 997: [function(e, t, r) {
      "use strict";
      t.exports = { attributes: e("./attributes"), supplyDefaults: e("./defaults"), colorbar: e("../scatter/marker_colorbar"), formatLabels: e("./format_labels"), calc: e("../scattergeo/calc"), plot: e("./plot"), hoverPoints: e("./hover").hoverPoints, eventData: e("./event_data"), selectPoints: e("./select"), styleOnSelect: function(n, a) {
        a && a[0].trace._glTrace.update(a);
      }, moduleType: "trace", name: "scattermapbox", basePlotModule: e("../../plots/mapbox"), categories: ["mapbox", "gl", "symbols", "showLegend", "scatter-like"], meta: {} };
    }, { "../../plots/mapbox": 613, "../scatter/marker_colorbar": 944, "../scattergeo/calc": 969, "./attributes": 991, "./defaults": 993, "./event_data": 994, "./format_labels": 995, "./hover": 996, "./plot": 998, "./select": 999 }], 998: [function(e, t, r) {
      "use strict";
      var n = e("./convert"), a = e("../../plots/mapbox/constants").traceLayerPrefix, o = ["fill", "line", "circle", "symbol"];
      function s(l, u2) {
        this.type = "scattermapbox", this.subplot = l, this.uid = u2, this.sourceIds = { fill: "source-" + u2 + "-fill", line: "source-" + u2 + "-line", circle: "source-" + u2 + "-circle", symbol: "source-" + u2 + "-symbol" }, this.layerIds = { fill: a + u2 + "-fill", line: a + u2 + "-line", circle: a + u2 + "-circle", symbol: a + u2 + "-symbol" }, this.below = null;
      }
      var i = s.prototype;
      i.addSource = function(l, u2) {
        this.subplot.map.addSource(this.sourceIds[l], { type: "geojson", data: u2.geojson });
      }, i.setSourceData = function(l, u2) {
        this.subplot.map.getSource(this.sourceIds[l]).setData(u2.geojson);
      }, i.addLayer = function(l, u2, c) {
        this.subplot.addLayer({ type: l, id: this.layerIds[l], source: this.sourceIds[l], layout: u2.layout, paint: u2.paint }, c);
      }, i.update = function(l) {
        var u2, c, f, h = this.subplot, p = h.map, d = n(h.gd, l), v = h.belowLookup["trace-" + this.uid];
        if (v !== this.below) {
          for (u2 = o.length - 1; u2 >= 0; u2--) c = o[u2], p.removeLayer(this.layerIds[c]);
          for (u2 = 0; u2 < o.length; u2++) f = d[c = o[u2]], this.addLayer(c, f, v);
          this.below = v;
        }
        for (u2 = 0; u2 < o.length; u2++) f = d[c = o[u2]], h.setOptions(this.layerIds[c], "setLayoutProperty", f.layout), f.layout.visibility === "visible" && (this.setSourceData(c, f), h.setOptions(this.layerIds[c], "setPaintProperty", f.paint));
        l[0].trace._glTrace = this;
      }, i.dispose = function() {
        for (var l = this.subplot.map, u2 = o.length - 1; u2 >= 0; u2--) {
          var c = o[u2];
          l.removeLayer(this.layerIds[c]), l.removeSource(this.sourceIds[c]);
        }
      }, t.exports = function(l, u2) {
        for (var c = u2[0].trace, f = new s(l, c.uid), h = n(l.gd, u2), p = f.below = l.belowLookup["trace-" + c.uid], d = 0; d < o.length; d++) {
          var v = o[d], m = h[v];
          f.addSource(v, m), f.addLayer(v, m, p);
        }
        return u2[0].trace._glTrace = f, f;
      };
    }, { "../../plots/mapbox/constants": 611, "./convert": 992 }], 999: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../scatter/subtypes"), o = e("../../constants/numerical").BADNUM;
      t.exports = function(s, i) {
        var l, u2 = s.cd, c = s.xaxis, f = s.yaxis, h = [], p = u2[0].trace;
        if (!a.hasMarkers(p)) return [];
        if (i === false) for (l = 0; l < u2.length; l++) u2[l].selected = 0;
        else for (l = 0; l < u2.length; l++) {
          var d = u2[l], v = d.lonlat;
          if (v[0] !== o) {
            var m = [n.modHalf(v[0], 360), v[1]], g = [c.c2p(m), f.c2p(m)];
            i.contains(g, null, l, s) ? (h.push({ pointNumber: l, lon: v[0], lat: v[1] }), d.selected = 1) : d.selected = 0;
          }
        }
        return h;
      };
    }, { "../../constants/numerical": 479, "../../lib": 503, "../scatter/subtypes": 951 }], 1e3: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/template_attributes").hovertemplateAttrs, a = e("../../plots/template_attributes").texttemplateAttrs, o = e("../../lib/extend").extendFlat, s = e("../scatter/attributes"), i = e("../../plots/attributes"), l = s.line;
      t.exports = { mode: s.mode, r: { valType: "data_array", editType: "calc+clearAxisTypes" }, theta: { valType: "data_array", editType: "calc+clearAxisTypes" }, r0: { valType: "any", dflt: 0, editType: "calc+clearAxisTypes" }, dr: { valType: "number", dflt: 1, editType: "calc" }, theta0: { valType: "any", dflt: 0, editType: "calc+clearAxisTypes" }, dtheta: { valType: "number", editType: "calc" }, thetaunit: { valType: "enumerated", values: ["radians", "degrees", "gradians"], dflt: "degrees", editType: "calc+clearAxisTypes" }, text: s.text, texttemplate: a({ editType: "plot" }, { keys: ["r", "theta", "text"] }), hovertext: s.hovertext, line: { color: l.color, width: l.width, dash: l.dash, shape: o({}, l.shape, { values: ["linear", "spline"] }), smoothing: l.smoothing, editType: "calc" }, connectgaps: s.connectgaps, marker: s.marker, cliponaxis: o({}, s.cliponaxis, { dflt: false }), textposition: s.textposition, textfont: s.textfont, fill: o({}, s.fill, { values: ["none", "toself", "tonext"], dflt: "none" }), fillcolor: s.fillcolor, hoverinfo: o({}, i.hoverinfo, { flags: ["r", "theta", "text", "name"] }), hoveron: s.hoveron, hovertemplate: n(), selected: s.selected, unselected: s.unselected };
    }, { "../../lib/extend": 493, "../../plots/attributes": 550, "../../plots/template_attributes": 633, "../scatter/attributes": 926 }], 1001: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("../../constants/numerical").BADNUM, o = e("../../plots/cartesian/axes"), s = e("../scatter/colorscale_calc"), i = e("../scatter/arrays_to_calcdata"), l = e("../scatter/calc_selection"), u2 = e("../scatter/calc").calcMarkerSize;
      t.exports = function(c, f) {
        for (var h = c._fullLayout, p = f.subplot, d = h[p].radialaxis, v = h[p].angularaxis, m = d.makeCalcdata(f, "r"), g = v.makeCalcdata(f, "theta"), x = f._length, b = new Array(x), y = 0; y < x; y++) {
          var w = m[y], _4 = g[y], k = b[y] = {};
          n(w) && n(_4) ? (k.r = w, k.theta = _4) : k.r = a;
        }
        var T2 = u2(f, x);
        return f._extremes.x = o.findExtremes(d, m, { ppad: T2 }), s(c, f), i(b, f), l(b, f), b;
      };
    }, { "../../constants/numerical": 479, "../../plots/cartesian/axes": 554, "../scatter/arrays_to_calcdata": 925, "../scatter/calc": 927, "../scatter/calc_selection": 928, "../scatter/colorscale_calc": 929, "fast-isnumeric": 190 }], 1002: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../scatter/subtypes"), o = e("../scatter/marker_defaults"), s = e("../scatter/line_defaults"), i = e("../scatter/line_shape_defaults"), l = e("../scatter/text_defaults"), u2 = e("../scatter/fillcolor_defaults"), c = e("../scatter/constants").PTS_LINESONLY, f = e("./attributes");
      function h(p, d, v, m) {
        var g, x = m("r"), b = m("theta");
        if (x) b ? g = Math.min(x.length, b.length) : (g = x.length, m("theta0"), m("dtheta"));
        else {
          if (!b) return 0;
          g = d.theta.length, m("r0"), m("dr");
        }
        return d._length = g, g;
      }
      t.exports = { handleRThetaDefaults: h, supplyDefaults: function(p, d, v, m) {
        function g(y, w) {
          return n.coerce(p, d, f, y, w);
        }
        var x = h(p, d, m, g);
        if (x) {
          g("thetaunit"), g("mode", x < c ? "lines+markers" : "lines"), g("text"), g("hovertext"), d.hoveron !== "fills" && g("hovertemplate"), a.hasLines(d) && (s(p, d, v, m, g), i(p, d, g), g("connectgaps")), a.hasMarkers(d) && o(p, d, v, m, g, { gradient: true }), a.hasText(d) && (g("texttemplate"), l(p, d, m, g));
          var b = [];
          (a.hasMarkers(d) || a.hasText(d)) && (g("cliponaxis"), g("marker.maxdisplayed"), b.push("points")), g("fill"), d.fill !== "none" && (u2(p, d, v, g), a.hasLines(d) || i(p, d, g)), d.fill !== "tonext" && d.fill !== "toself" || b.push("fills"), g("hoveron", b.join("+") || "points"), n.coerceSelectionMarkerOpacity(d, g);
        } else d.visible = false;
      } };
    }, { "../../lib": 503, "../scatter/constants": 930, "../scatter/fillcolor_defaults": 934, "../scatter/line_defaults": 939, "../scatter/line_shape_defaults": 941, "../scatter/marker_defaults": 945, "../scatter/subtypes": 951, "../scatter/text_defaults": 952, "./attributes": 1e3 }], 1003: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../plots/cartesian/axes");
      t.exports = function(o, s, i) {
        var l, u2, c = {}, f = i[s.subplot]._subplot;
        f ? (l = f.radialAxis, u2 = f.angularAxis) : (l = (f = i[s.subplot]).radialaxis, u2 = f.angularaxis);
        var h = l.c2l(o.r);
        c.rLabel = a.tickText(l, h, true).text;
        var p = u2.thetaunit === "degrees" ? n.rad2deg(o.theta) : o.theta;
        return c.thetaLabel = a.tickText(u2, p, true).text, c;
      };
    }, { "../../lib": 503, "../../plots/cartesian/axes": 554 }], 1004: [function(e, t, r) {
      "use strict";
      var n = e("../scatter/hover");
      function a(o, s, i, l) {
        var u2 = i.radialAxis, c = i.angularAxis;
        u2._hovertitle = "r", c._hovertitle = "\u03B8";
        var f = {};
        f[s.subplot] = { _subplot: i };
        var h = s._module.formatLabels(o, s, f);
        l.rLabel = h.rLabel, l.thetaLabel = h.thetaLabel;
        var p = o.hi || s.hoverinfo, d = [];
        function v(g, x) {
          d.push(g._hovertitle + ": " + x);
        }
        if (!s.hovertemplate) {
          var m = p.split("+");
          m.indexOf("all") !== -1 && (m = ["r", "theta", "text"]), m.indexOf("r") !== -1 && v(u2, l.rLabel), m.indexOf("theta") !== -1 && v(c, l.thetaLabel), m.indexOf("text") !== -1 && l.text && (d.push(l.text), delete l.text), l.extraText = d.join("<br>");
        }
      }
      t.exports = { hoverPoints: function(o, s, i, l) {
        var u2 = n(o, s, i, l);
        if (u2 && u2[0].index !== false) {
          var c = u2[0];
          if (c.index === void 0) return u2;
          var f = o.subplot, h = c.cd[c.index], p = c.trace;
          if (f.isPtInside(h)) return c.xLabelVal = void 0, c.yLabelVal = void 0, a(h, p, f, c), c.hovertemplate = p.hovertemplate, u2;
        }
      }, makeHoverPointText: a };
    }, { "../scatter/hover": 937 }], 1005: [function(e, t, r) {
      "use strict";
      t.exports = { moduleType: "trace", name: "scatterpolar", basePlotModule: e("../../plots/polar"), categories: ["polar", "symbols", "showLegend", "scatter-like"], attributes: e("./attributes"), supplyDefaults: e("./defaults").supplyDefaults, colorbar: e("../scatter/marker_colorbar"), formatLabels: e("./format_labels"), calc: e("./calc"), plot: e("./plot"), style: e("../scatter/style").style, styleOnSelect: e("../scatter/style").styleOnSelect, hoverPoints: e("./hover").hoverPoints, selectPoints: e("../scatter/select"), meta: {} };
    }, { "../../plots/polar": 622, "../scatter/marker_colorbar": 944, "../scatter/select": 948, "../scatter/style": 950, "./attributes": 1e3, "./calc": 1001, "./defaults": 1002, "./format_labels": 1003, "./hover": 1004, "./plot": 1006 }], 1006: [function(e, t, r) {
      "use strict";
      var n = e("../scatter/plot"), a = e("../../constants/numerical").BADNUM;
      t.exports = function(o, s, i) {
        for (var l = s.layers.frontplot.select("g.scatterlayer"), u2 = { xaxis: s.xaxis, yaxis: s.yaxis, plot: s.framework, layerClipId: s._hasClipOnAxisFalse ? s.clipIds.forTraces : null }, c = s.radialAxis, f = s.angularAxis, h = 0; h < i.length; h++) for (var p = i[h], d = 0; d < p.length; d++) {
          var v = p[d], m = v.r;
          if (m === a) v.x = v.y = a;
          else {
            var g = c.c2g(m), x = f.c2g(v.theta);
            v.x = g * Math.cos(x), v.y = g * Math.sin(x);
          }
        }
        n(o, u2, i, l);
      };
    }, { "../../constants/numerical": 479, "../scatter/plot": 947 }], 1007: [function(e, t, r) {
      "use strict";
      var n = e("../scatterpolar/attributes"), a = e("../scattergl/attributes"), o = e("../../plots/template_attributes").texttemplateAttrs;
      t.exports = { mode: n.mode, r: n.r, theta: n.theta, r0: n.r0, dr: n.dr, theta0: n.theta0, dtheta: n.dtheta, thetaunit: n.thetaunit, text: n.text, texttemplate: o({ editType: "plot" }, { keys: ["r", "theta", "text"] }), hovertext: n.hovertext, hovertemplate: n.hovertemplate, line: a.line, connectgaps: a.connectgaps, marker: a.marker, fill: a.fill, fillcolor: a.fillcolor, textposition: a.textposition, textfont: a.textfont, hoverinfo: n.hoverinfo, selected: n.selected, unselected: n.unselected };
    }, { "../../plots/template_attributes": 633, "../scattergl/attributes": 978, "../scatterpolar/attributes": 1e3 }], 1008: [function(e, t, r) {
      "use strict";
      var n = e("../scatter/colorscale_calc"), a = e("../scatter/calc").calcMarkerSize, o = e("../scattergl/convert"), s = e("../../plots/cartesian/axes"), i = e("../scattergl/constants").TOO_MANY_POINTS;
      t.exports = function(l, u2) {
        var c = l._fullLayout, f = u2.subplot, h = c[f].radialaxis, p = c[f].angularaxis, d = u2._r = h.makeCalcdata(u2, "r"), v = u2._theta = p.makeCalcdata(u2, "theta"), m = u2._length, g = {};
        m < d.length && (d = d.slice(0, m)), m < v.length && (v = v.slice(0, m)), g.r = d, g.theta = v, n(l, u2);
        var x, b = g.opts = o.style(l, u2);
        return m < i ? x = a(u2, m) : b.marker && (x = 2 * (b.marker.sizeAvg || Math.max(b.marker.size, 3))), u2._extremes.x = s.findExtremes(h, d, { ppad: x }), [{ x: false, y: false, t: g, trace: u2 }];
      };
    }, { "../../plots/cartesian/axes": 554, "../scatter/calc": 927, "../scatter/colorscale_calc": 929, "../scattergl/constants": 980, "../scattergl/convert": 981 }], 1009: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../scatter/subtypes"), o = e("../scatterpolar/defaults").handleRThetaDefaults, s = e("../scatter/marker_defaults"), i = e("../scatter/line_defaults"), l = e("../scatter/text_defaults"), u2 = e("../scatter/fillcolor_defaults"), c = e("../scatter/constants").PTS_LINESONLY, f = e("./attributes");
      t.exports = function(h, p, d, v) {
        function m(x, b) {
          return n.coerce(h, p, f, x, b);
        }
        var g = o(h, p, v, m);
        g ? (m("thetaunit"), m("mode", g < c ? "lines+markers" : "lines"), m("text"), m("hovertext"), p.hoveron !== "fills" && m("hovertemplate"), a.hasLines(p) && (i(h, p, d, v, m), m("connectgaps")), a.hasMarkers(p) && s(h, p, d, v, m), a.hasText(p) && (m("texttemplate"), l(h, p, v, m)), m("fill"), p.fill !== "none" && u2(h, p, d, m), n.coerceSelectionMarkerOpacity(p, m)) : p.visible = false;
      };
    }, { "../../lib": 503, "../scatter/constants": 930, "../scatter/fillcolor_defaults": 934, "../scatter/line_defaults": 939, "../scatter/marker_defaults": 945, "../scatter/subtypes": 951, "../scatter/text_defaults": 952, "../scatterpolar/defaults": 1002, "./attributes": 1007 }], 1010: [function(e, t, r) {
      "use strict";
      var n = e("../scatterpolar/format_labels");
      t.exports = function(a, o, s) {
        var i = a.i;
        return "r" in a || (a.r = o._r[i]), "theta" in a || (a.theta = o._theta[i]), n(a, o, s);
      };
    }, { "../scatterpolar/format_labels": 1003 }], 1011: [function(e, t, r) {
      "use strict";
      var n = e("../scattergl/hover"), a = e("../scatterpolar/hover").makeHoverPointText;
      t.exports = { hoverPoints: function(o, s, i, l) {
        var u2 = o.cd[0].t, c = u2.r, f = u2.theta, h = n.hoverPoints(o, s, i, l);
        if (h && h[0].index !== false) {
          var p = h[0];
          if (p.index === void 0) return h;
          var d = o.subplot, v = p.cd[p.index], m = p.trace;
          if (v.r = c[p.index], v.theta = f[p.index], d.isPtInside(v)) return p.xLabelVal = void 0, p.yLabelVal = void 0, a(v, m, d, p), h;
        }
      } };
    }, { "../scattergl/hover": 986, "../scatterpolar/hover": 1004 }], 1012: [function(e, t, r) {
      "use strict";
      t.exports = { moduleType: "trace", name: "scatterpolargl", basePlotModule: e("../../plots/polar"), categories: ["gl", "regl", "polar", "symbols", "showLegend", "scatter-like"], attributes: e("./attributes"), supplyDefaults: e("./defaults"), colorbar: e("../scatter/marker_colorbar"), formatLabels: e("./format_labels"), calc: e("./calc"), plot: e("./plot"), hoverPoints: e("./hover").hoverPoints, selectPoints: e("../scattergl/select"), meta: {} };
    }, { "../../plots/polar": 622, "../scatter/marker_colorbar": 944, "../scattergl/select": 990, "./attributes": 1007, "./calc": 1008, "./defaults": 1009, "./format_labels": 1010, "./hover": 1011, "./plot": 1013 }], 1013: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/point-cluster"), a = e("fast-isnumeric"), o = e("../scattergl/plot"), s = e("../scattergl/scene_update"), i = e("../scattergl/convert"), l = e("../../lib"), u2 = e("../scattergl/constants").TOO_MANY_POINTS;
      t.exports = function(c, f, h) {
        if (h.length) {
          var p = f.radialAxis, d = f.angularAxis, v = s(c, f);
          return h.forEach(function(m) {
            if (m && m[0] && m[0].trace) {
              var g, x = m[0], b = x.trace, y = x.t, w = b._length, _4 = y.r, k = y.theta, T2 = y.opts, A2 = _4.slice(), S2 = k.slice();
              for (g = 0; g < _4.length; g++) f.isPtInside({ r: _4[g], theta: k[g] }) || (A2[g] = NaN, S2[g] = NaN);
              var C2 = new Array(2 * w), E2 = Array(w), F13 = Array(w);
              for (g = 0; g < w; g++) {
                var N2, D2, I2 = A2[g];
                if (a(I2)) {
                  var O2 = p.c2g(I2), L2 = d.c2g(S2[g], b.thetaunit);
                  N2 = O2 * Math.cos(L2), D2 = O2 * Math.sin(L2);
                } else N2 = D2 = NaN;
                E2[g] = C2[2 * g] = N2, F13[g] = C2[2 * g + 1] = D2;
              }
              y.tree = n(C2), T2.marker && w >= u2 && (T2.marker.cluster = y.tree), T2.marker && (T2.markerSel.positions = T2.markerUnsel.positions = T2.marker.positions = C2), T2.line && C2.length > 1 && l.extendFlat(T2.line, i.linePositions(c, b, C2)), T2.text && (l.extendFlat(T2.text, { positions: C2 }, i.textPosition(c, b, T2.text, T2.marker)), l.extendFlat(T2.textSel, { positions: C2 }, i.textPosition(c, b, T2.text, T2.markerSel)), l.extendFlat(T2.textUnsel, { positions: C2 }, i.textPosition(c, b, T2.text, T2.markerUnsel))), T2.fill && !v.fill2d && (v.fill2d = true), T2.marker && !v.scatter2d && (v.scatter2d = true), T2.line && !v.line2d && (v.line2d = true), T2.text && !v.glText && (v.glText = true), v.lineOptions.push(T2.line), v.fillOptions.push(T2.fill), v.markerOptions.push(T2.marker), v.markerSelectedOptions.push(T2.markerSel), v.markerUnselectedOptions.push(T2.markerUnsel), v.textOptions.push(T2.text), v.textSelectedOptions.push(T2.textSel), v.textUnselectedOptions.push(T2.textUnsel), v.selectBatch.push([]), v.unselectBatch.push([]), y.x = E2, y.y = F13, y.rawx = E2, y.rawy = F13, y.r = _4, y.theta = k, y.positions = C2, y._scene = v, y.index = v.count, v.count++;
            }
          }), o(c, f, h);
        }
      };
    }, { "../../lib": 503, "../scattergl/constants": 980, "../scattergl/convert": 981, "../scattergl/plot": 988, "../scattergl/scene_update": 989, "@plotly/point-cluster": 59, "fast-isnumeric": 190 }], 1014: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/template_attributes").hovertemplateAttrs, a = e("../../plots/template_attributes").texttemplateAttrs, o = e("../../lib/extend").extendFlat, s = e("../scatter/attributes"), i = e("../../plots/attributes"), l = s.line;
      t.exports = { mode: s.mode, real: { valType: "data_array", editType: "calc+clearAxisTypes" }, imag: { valType: "data_array", editType: "calc+clearAxisTypes" }, text: s.text, texttemplate: a({ editType: "plot" }, { keys: ["real", "imag", "text"] }), hovertext: s.hovertext, line: { color: l.color, width: l.width, dash: l.dash, shape: o({}, l.shape, { values: ["linear", "spline"] }), smoothing: l.smoothing, editType: "calc" }, connectgaps: s.connectgaps, marker: s.marker, cliponaxis: o({}, s.cliponaxis, { dflt: false }), textposition: s.textposition, textfont: s.textfont, fill: o({}, s.fill, { values: ["none", "toself", "tonext"], dflt: "none" }), fillcolor: s.fillcolor, hoverinfo: o({}, i.hoverinfo, { flags: ["real", "imag", "text", "name"] }), hoveron: s.hoveron, hovertemplate: n(), selected: s.selected, unselected: s.unselected };
    }, { "../../lib/extend": 493, "../../plots/attributes": 550, "../../plots/template_attributes": 633, "../scatter/attributes": 926 }], 1015: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("../../constants/numerical").BADNUM, o = e("../scatter/colorscale_calc"), s = e("../scatter/arrays_to_calcdata"), i = e("../scatter/calc_selection"), l = e("../scatter/calc").calcMarkerSize;
      t.exports = function(u2, c) {
        for (var f = u2._fullLayout, h = c.subplot, p = f[h].realaxis, d = f[h].imaginaryaxis, v = p.makeCalcdata(c, "real"), m = d.makeCalcdata(c, "imag"), g = c._length, x = new Array(g), b = 0; b < g; b++) {
          var y = v[b], w = m[b], _4 = x[b] = {};
          n(y) && n(w) ? (_4.real = y, _4.imag = w) : _4.real = a;
        }
        return l(c, g), o(u2, c), s(x, c), i(x, c), x;
      };
    }, { "../../constants/numerical": 479, "../scatter/arrays_to_calcdata": 925, "../scatter/calc": 927, "../scatter/calc_selection": 928, "../scatter/colorscale_calc": 929, "fast-isnumeric": 190 }], 1016: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../scatter/subtypes"), o = e("../scatter/marker_defaults"), s = e("../scatter/line_defaults"), i = e("../scatter/line_shape_defaults"), l = e("../scatter/text_defaults"), u2 = e("../scatter/fillcolor_defaults"), c = e("../scatter/constants").PTS_LINESONLY, f = e("./attributes");
      t.exports = function(h, p, d, v) {
        function m(b, y) {
          return n.coerce(h, p, f, b, y);
        }
        var g = function(b, y, w, _4) {
          var k, T2 = _4("real"), A2 = _4("imag");
          return T2 && A2 && (k = Math.min(T2.length, A2.length)), y._length = k, k;
        }(0, p, 0, m);
        if (g) {
          m("mode", g < c ? "lines+markers" : "lines"), m("text"), m("hovertext"), p.hoveron !== "fills" && m("hovertemplate"), a.hasLines(p) && (s(h, p, d, v, m), i(h, p, m), m("connectgaps")), a.hasMarkers(p) && o(h, p, d, v, m, { gradient: true }), a.hasText(p) && (m("texttemplate"), l(h, p, v, m));
          var x = [];
          (a.hasMarkers(p) || a.hasText(p)) && (m("cliponaxis"), m("marker.maxdisplayed"), x.push("points")), m("fill"), p.fill !== "none" && (u2(h, p, d, m), a.hasLines(p) || i(h, p, m)), p.fill !== "tonext" && p.fill !== "toself" || x.push("fills"), m("hoveron", x.join("+") || "points"), n.coerceSelectionMarkerOpacity(p, m);
        } else p.visible = false;
      };
    }, { "../../lib": 503, "../scatter/constants": 930, "../scatter/fillcolor_defaults": 934, "../scatter/line_defaults": 939, "../scatter/line_shape_defaults": 941, "../scatter/marker_defaults": 945, "../scatter/subtypes": 951, "../scatter/text_defaults": 952, "./attributes": 1014 }], 1017: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/cartesian/axes");
      t.exports = function(a, o, s) {
        var i = {}, l = s[o.subplot]._subplot;
        return i.realLabel = n.tickText(l.radialAxis, a.real, true).text, i.imagLabel = n.tickText(l.angularAxis, a.imag, true).text, i;
      };
    }, { "../../plots/cartesian/axes": 554 }], 1018: [function(e, t, r) {
      "use strict";
      var n = e("../scatter/hover");
      function a(o, s, i, l) {
        var u2 = i.radialAxis, c = i.angularAxis;
        u2._hovertitle = "real", c._hovertitle = "imag";
        var f = {};
        f[s.subplot] = { _subplot: i };
        var h = s._module.formatLabels(o, s, f);
        l.realLabel = h.realLabel, l.imagLabel = h.imagLabel;
        var p = o.hi || s.hoverinfo, d = [];
        function v(g, x) {
          d.push(g._hovertitle + ": " + x);
        }
        if (!s.hovertemplate) {
          var m = p.split("+");
          m.indexOf("all") !== -1 && (m = ["real", "imag", "text"]), m.indexOf("real") !== -1 && v(u2, l.realLabel), m.indexOf("imag") !== -1 && v(c, l.imagLabel), m.indexOf("text") !== -1 && l.text && (d.push(l.text), delete l.text), l.extraText = d.join("<br>");
        }
      }
      t.exports = { hoverPoints: function(o, s, i, l) {
        var u2 = n(o, s, i, l);
        if (u2 && u2[0].index !== false) {
          var c = u2[0];
          if (c.index === void 0) return u2;
          var f = o.subplot, h = c.cd[c.index], p = c.trace;
          if (f.isPtInside(h)) return c.xLabelVal = void 0, c.yLabelVal = void 0, a(h, p, f, c), c.hovertemplate = p.hovertemplate, u2;
        }
      }, makeHoverPointText: a };
    }, { "../scatter/hover": 937 }], 1019: [function(e, t, r) {
      "use strict";
      t.exports = { moduleType: "trace", name: "scattersmith", basePlotModule: e("../../plots/smith"), categories: ["smith", "symbols", "showLegend", "scatter-like"], attributes: e("./attributes"), supplyDefaults: e("./defaults"), colorbar: e("../scatter/marker_colorbar"), formatLabels: e("./format_labels"), calc: e("./calc"), plot: e("./plot"), style: e("../scatter/style").style, styleOnSelect: e("../scatter/style").styleOnSelect, hoverPoints: e("./hover").hoverPoints, selectPoints: e("../scatter/select"), meta: {} };
    }, { "../../plots/smith": 629, "../scatter/marker_colorbar": 944, "../scatter/select": 948, "../scatter/style": 950, "./attributes": 1014, "./calc": 1015, "./defaults": 1016, "./format_labels": 1017, "./hover": 1018, "./plot": 1020 }], 1020: [function(e, t, r) {
      "use strict";
      var n = e("../scatter/plot"), a = e("../../constants/numerical").BADNUM, o = e("../../plots/smith/helpers").smith;
      t.exports = function(s, i, l) {
        for (var u2 = i.layers.frontplot.select("g.scatterlayer"), c = { xaxis: i.xaxis, yaxis: i.yaxis, plot: i.framework, layerClipId: i._hasClipOnAxisFalse ? i.clipIds.forTraces : null }, f = 0; f < l.length; f++) for (var h = l[f], p = 0; p < h.length; p++) {
          var d = h[p], v = d.real;
          if (v === a) d.x = d.y = a;
          else {
            var m = o([v, d.imag]);
            d.x = m[0], d.y = m[1];
          }
        }
        n(s, c, l, u2);
      };
    }, { "../../constants/numerical": 479, "../../plots/smith/helpers": 628, "../scatter/plot": 947 }], 1021: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/template_attributes").hovertemplateAttrs, a = e("../../plots/template_attributes").texttemplateAttrs, o = e("../scatter/attributes"), s = e("../../plots/attributes"), i = e("../../components/colorscale/attributes"), l = e("../../components/drawing/attributes").dash, u2 = e("../../lib/extend").extendFlat, c = o.marker, f = o.line, h = c.line;
      t.exports = { a: { valType: "data_array", editType: "calc" }, b: { valType: "data_array", editType: "calc" }, c: { valType: "data_array", editType: "calc" }, sum: { valType: "number", dflt: 0, min: 0, editType: "calc" }, mode: u2({}, o.mode, { dflt: "markers" }), text: u2({}, o.text, {}), texttemplate: a({ editType: "plot" }, { keys: ["a", "b", "c", "text"] }), hovertext: u2({}, o.hovertext, {}), line: { color: f.color, width: f.width, dash: l, shape: u2({}, f.shape, { values: ["linear", "spline"] }), smoothing: f.smoothing, editType: "calc" }, connectgaps: o.connectgaps, cliponaxis: o.cliponaxis, fill: u2({}, o.fill, { values: ["none", "toself", "tonext"], dflt: "none" }), fillcolor: o.fillcolor, marker: u2({ symbol: c.symbol, opacity: c.opacity, maxdisplayed: c.maxdisplayed, size: c.size, sizeref: c.sizeref, sizemin: c.sizemin, sizemode: c.sizemode, line: u2({ width: h.width, editType: "calc" }, i("marker.line")), gradient: c.gradient, editType: "calc" }, i("marker")), textfont: o.textfont, textposition: o.textposition, selected: o.selected, unselected: o.unselected, hoverinfo: u2({}, s.hoverinfo, { flags: ["a", "b", "c", "text", "name"] }), hoveron: o.hoveron, hovertemplate: n() };
    }, { "../../components/colorscale/attributes": 373, "../../components/drawing/attributes": 387, "../../lib/extend": 493, "../../plots/attributes": 550, "../../plots/template_attributes": 633, "../scatter/attributes": 926 }], 1022: [function(e, t, r) {
      "use strict";
      var n = e("fast-isnumeric"), a = e("../scatter/colorscale_calc"), o = e("../scatter/arrays_to_calcdata"), s = e("../scatter/calc_selection"), i = e("../scatter/calc").calcMarkerSize, l = ["a", "b", "c"], u2 = { a: ["b", "c"], b: ["a", "c"], c: ["a", "b"] };
      t.exports = function(c, f) {
        var h, p, d, v, m, g, x = c._fullLayout[f.subplot].sum, b = f.sum || x, y = { a: f.a, b: f.b, c: f.c };
        for (h = 0; h < l.length; h++) if (!y[d = l[h]]) {
          for (m = y[u2[d][0]], g = y[u2[d][1]], v = new Array(m.length), p = 0; p < m.length; p++) v[p] = b - m[p] - g[p];
          y[d] = v;
        }
        var w, _4, k, T2, A2, S2, C2 = f._length, E2 = new Array(C2);
        for (h = 0; h < C2; h++) w = y.a[h], _4 = y.b[h], k = y.c[h], n(w) && n(_4) && n(k) ? ((T2 = x / ((w = +w) + (_4 = +_4) + (k = +k))) !== 1 && (w *= T2, _4 *= T2, k *= T2), S2 = w, A2 = k - _4, E2[h] = { x: A2, y: S2, a: w, b: _4, c: k }) : E2[h] = { x: false, y: false };
        return i(f, C2), a(c, f), o(E2, f), s(E2, f), E2;
      };
    }, { "../scatter/arrays_to_calcdata": 925, "../scatter/calc": 927, "../scatter/calc_selection": 928, "../scatter/colorscale_calc": 929, "fast-isnumeric": 190 }], 1023: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../scatter/constants"), o = e("../scatter/subtypes"), s = e("../scatter/marker_defaults"), i = e("../scatter/line_defaults"), l = e("../scatter/line_shape_defaults"), u2 = e("../scatter/text_defaults"), c = e("../scatter/fillcolor_defaults"), f = e("./attributes");
      t.exports = function(h, p, d, v) {
        function m(_4, k) {
          return n.coerce(h, p, f, _4, k);
        }
        var g, x = m("a"), b = m("b"), y = m("c");
        if (x ? (g = x.length, b ? (g = Math.min(g, b.length), y && (g = Math.min(g, y.length))) : g = y ? Math.min(g, y.length) : 0) : b && y && (g = Math.min(b.length, y.length)), g) {
          p._length = g, m("sum"), m("text"), m("hovertext"), p.hoveron !== "fills" && m("hovertemplate"), m("mode", g < a.PTS_LINESONLY ? "lines+markers" : "lines"), o.hasLines(p) && (i(h, p, d, v, m), l(h, p, m), m("connectgaps")), o.hasMarkers(p) && s(h, p, d, v, m, { gradient: true }), o.hasText(p) && (m("texttemplate"), u2(h, p, v, m));
          var w = [];
          (o.hasMarkers(p) || o.hasText(p)) && (m("cliponaxis"), m("marker.maxdisplayed"), w.push("points")), m("fill"), p.fill !== "none" && (c(h, p, d, m), o.hasLines(p) || l(h, p, m)), p.fill !== "tonext" && p.fill !== "toself" || w.push("fills"), m("hoveron", w.join("+") || "points"), n.coerceSelectionMarkerOpacity(p, m);
        } else p.visible = false;
      };
    }, { "../../lib": 503, "../scatter/constants": 930, "../scatter/fillcolor_defaults": 934, "../scatter/line_defaults": 939, "../scatter/line_shape_defaults": 941, "../scatter/marker_defaults": 945, "../scatter/subtypes": 951, "../scatter/text_defaults": 952, "./attributes": 1021 }], 1024: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a, o, s, i) {
        if (a.xa && (n.xaxis = a.xa), a.ya && (n.yaxis = a.ya), s[i]) {
          var l = s[i];
          n.a = l.a, n.b = l.b, n.c = l.c;
        } else n.a = a.a, n.b = a.b, n.c = a.c;
        return n;
      };
    }, {}], 1025: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/cartesian/axes");
      t.exports = function(a, o, s) {
        var i = {}, l = s[o.subplot]._subplot;
        return i.aLabel = n.tickText(l.aaxis, a.a, true).text, i.bLabel = n.tickText(l.baxis, a.b, true).text, i.cLabel = n.tickText(l.caxis, a.c, true).text, i;
      };
    }, { "../../plots/cartesian/axes": 554 }], 1026: [function(e, t, r) {
      "use strict";
      var n = e("../scatter/hover");
      t.exports = function(a, o, s, i) {
        var l = n(a, o, s, i);
        if (l && l[0].index !== false) {
          var u2 = l[0];
          if (u2.index === void 0) {
            var c = 1 - u2.y0 / a.ya._length, f = a.xa._length, h = f * c / 2, p = f - h;
            return u2.x0 = Math.max(Math.min(u2.x0, p), h), u2.x1 = Math.max(Math.min(u2.x1, p), h), l;
          }
          var d = u2.cd[u2.index], v = u2.trace, m = u2.subplot;
          u2.a = d.a, u2.b = d.b, u2.c = d.c, u2.xLabelVal = void 0, u2.yLabelVal = void 0;
          var g = {};
          g[v.subplot] = { _subplot: m };
          var x = v._module.formatLabels(d, v, g);
          u2.aLabel = x.aLabel, u2.bLabel = x.bLabel, u2.cLabel = x.cLabel;
          var b = d.hi || v.hoverinfo, y = [];
          if (!v.hovertemplate) {
            var w = b.split("+");
            w.indexOf("all") !== -1 && (w = ["a", "b", "c"]), w.indexOf("a") !== -1 && _4(m.aaxis, u2.aLabel), w.indexOf("b") !== -1 && _4(m.baxis, u2.bLabel), w.indexOf("c") !== -1 && _4(m.caxis, u2.cLabel);
          }
          return u2.extraText = y.join("<br>"), u2.hovertemplate = v.hovertemplate, l;
        }
        function _4(k, T2) {
          y.push(k._hovertitle + ": " + T2);
        }
      };
    }, { "../scatter/hover": 937 }], 1027: [function(e, t, r) {
      "use strict";
      t.exports = { attributes: e("./attributes"), supplyDefaults: e("./defaults"), colorbar: e("../scatter/marker_colorbar"), formatLabels: e("./format_labels"), calc: e("./calc"), plot: e("./plot"), style: e("../scatter/style").style, styleOnSelect: e("../scatter/style").styleOnSelect, hoverPoints: e("./hover"), selectPoints: e("../scatter/select"), eventData: e("./event_data"), moduleType: "trace", name: "scatterternary", basePlotModule: e("../../plots/ternary"), categories: ["ternary", "symbols", "showLegend", "scatter-like"], meta: {} };
    }, { "../../plots/ternary": 634, "../scatter/marker_colorbar": 944, "../scatter/select": 948, "../scatter/style": 950, "./attributes": 1021, "./calc": 1022, "./defaults": 1023, "./event_data": 1024, "./format_labels": 1025, "./hover": 1026, "./plot": 1028 }], 1028: [function(e, t, r) {
      "use strict";
      var n = e("../scatter/plot");
      t.exports = function(a, o, s) {
        var i = o.plotContainer;
        i.select(".scatterlayer").selectAll("*").remove();
        var l = { xaxis: o.xaxis, yaxis: o.yaxis, plot: i, layerClipId: o._hasClipOnAxisFalse ? o.clipIdRelative : null }, u2 = o.layers.frontplot.select("g.scatterlayer");
        n(a, l, s, u2);
      };
    }, { "../scatter/plot": 947 }], 1029: [function(e, t, r) {
      "use strict";
      var n = e("../scatter/attributes"), a = e("../../components/colorscale/attributes"), o = e("../../plots/cartesian/axis_format_attributes").axisHoverFormat, s = e("../../plots/template_attributes").hovertemplateAttrs, i = e("../scattergl/attributes"), l = e("../../plots/cartesian/constants").idRegex, u2 = e("../../plot_api/plot_template").templatedArray, c = e("../../lib/extend").extendFlat, f = n.marker, h = f.line, p = c(a("marker.line", { editTypeOverride: "calc" }), { width: c({}, h.width, { editType: "calc" }), editType: "calc" }), d = c(a("marker"), { symbol: f.symbol, size: c({}, f.size, { editType: "markerSize" }), sizeref: f.sizeref, sizemin: f.sizemin, sizemode: f.sizemode, opacity: f.opacity, colorbar: f.colorbar, line: p, editType: "calc" });
      function v(m) {
        return { valType: "info_array", freeLength: true, editType: "calc", items: { valType: "subplotid", regex: l[m], editType: "plot" } };
      }
      d.color.editType = d.cmin.editType = d.cmax.editType = "style", t.exports = { dimensions: u2("dimension", { visible: { valType: "boolean", dflt: true, editType: "calc" }, label: { valType: "string", editType: "calc" }, values: { valType: "data_array", editType: "calc+clearAxisTypes" }, axis: { type: { valType: "enumerated", values: ["linear", "log", "date", "category"], editType: "calc+clearAxisTypes" }, matches: { valType: "boolean", dflt: false, editType: "calc" }, editType: "calc+clearAxisTypes" }, editType: "calc+clearAxisTypes" }), text: c({}, i.text, {}), hovertext: c({}, i.hovertext, {}), hovertemplate: s(), xhoverformat: o("x"), yhoverformat: o("y"), marker: d, xaxes: v("x"), yaxes: v("y"), diagonal: { visible: { valType: "boolean", dflt: true, editType: "calc" }, editType: "calc" }, showupperhalf: { valType: "boolean", dflt: true, editType: "calc" }, showlowerhalf: { valType: "boolean", dflt: true, editType: "calc" }, selected: { marker: i.selected.marker, editType: "calc" }, unselected: { marker: i.unselected.marker, editType: "calc" }, opacity: i.opacity };
    }, { "../../components/colorscale/attributes": 373, "../../lib/extend": 493, "../../plot_api/plot_template": 543, "../../plots/cartesian/axis_format_attributes": 557, "../../plots/cartesian/constants": 561, "../../plots/template_attributes": 633, "../scatter/attributes": 926, "../scattergl/attributes": 978 }], 1030: [function(e, t, r) {
      "use strict";
      var n = e("regl-line2d"), a = e("../../registry"), o = e("../../lib/prepare_regl"), s = e("../../plots/get_data").getModuleCalcData, i = e("../../plots/cartesian"), l = e("../../plots/cartesian/axis_ids").getFromId, u2 = e("../../plots/cartesian/axes").shouldShowZeroLine;
      function c(h, p, d) {
        for (var v = d.matrixOptions.data.length, m = p._visibleDims, g = d.viewOpts.ranges = new Array(v), x = 0; x < m.length; x++) {
          var b = m[x], y = g[x] = new Array(4), w = l(h, p._diag[b][0]);
          w && (y[0] = w.r2l(w.range[0]), y[2] = w.r2l(w.range[1]));
          var _4 = l(h, p._diag[b][1]);
          _4 && (y[1] = _4.r2l(_4.range[0]), y[3] = _4.r2l(_4.range[1]));
        }
        d.selectBatch.length || d.unselectBatch.length ? d.matrix.update({ ranges: g }, { ranges: g }) : d.matrix.update({ ranges: g });
      }
      function f(h) {
        var p = h._fullLayout, d = p._glcanvas.data()[0].regl, v = p._splomGrid;
        v || (v = p._splomGrid = n(d)), v.update(function(m) {
          var g, x = m._context.plotGlPixelRatio, b = m._fullLayout, y = b._size, w = [0, 0, b.width * x, b.height * x], _4 = {};
          function k(Y2, K2, q, re, R2, z) {
            q *= x, re *= x, R2 *= x, z *= x;
            var H2 = K2[Y2 + "color"], te = K2[Y2 + "width"], j = String(H2 + te);
            j in _4 ? _4[j].data.push(NaN, NaN, q, re, R2, z) : _4[j] = { data: [q, re, R2, z], join: "rect", thickness: te * x, color: H2, viewport: w, range: w, overlay: false };
          }
          for (g in b._splomSubplots) {
            var T2, A2, S2 = b._plots[g], C2 = S2.xaxis, E2 = S2.yaxis, F13 = C2._gridVals, N2 = E2._gridVals, D2 = C2._offset, I2 = C2._length, O2 = E2._length, L2 = y.b + E2.domain[0] * y.h, V2 = -E2._m, W2 = -V2 * E2.r2l(E2.range[0], E2.calendar);
            if (C2.showgrid) for (g = 0; g < F13.length; g++) T2 = D2 + C2.l2p(F13[g].x), k("grid", C2, T2, L2, T2, L2 + O2);
            if (E2.showgrid) for (g = 0; g < N2.length; g++) A2 = L2 + W2 + V2 * N2[g].x, k("grid", E2, D2, A2, D2 + I2, A2);
            u2(m, C2, E2) && (T2 = D2 + C2.l2p(0), k("zeroline", C2, T2, L2, T2, L2 + O2)), u2(m, E2, C2) && k("zeroline", E2, D2, A2 = L2 + W2 + 0, D2 + I2, A2);
          }
          var X2 = [];
          for (g in _4) X2.push(_4[g]);
          return X2;
        }(h));
      }
      t.exports = { name: "splom", attr: i.attr, attrRegex: i.attrRegex, layoutAttributes: i.layoutAttributes, supplyLayoutDefaults: i.supplyLayoutDefaults, drawFramework: i.drawFramework, plot: function(h) {
        var p = h._fullLayout, d = a.getModule("splom"), v = s(h.calcdata, d)[0];
        o(h, ["ANGLE_instanced_arrays", "OES_element_index_uint"]) && (p._hasOnlyLargeSploms && f(h), d.plot(h, {}, v));
      }, drag: function(h) {
        var p = h.calcdata, d = h._fullLayout;
        d._hasOnlyLargeSploms && f(h);
        for (var v = 0; v < p.length; v++) {
          var m = p[v][0].trace, g = d._splomScenes[m.uid];
          m.type === "splom" && g && g.matrix && c(h, m, g);
        }
      }, updateGrid: f, clean: function(h, p, d, v) {
        var m, g = {};
        if (v._splomScenes) {
          for (m = 0; m < h.length; m++) {
            var x = h[m];
            x.type === "splom" && (g[x.uid] = 1);
          }
          for (m = 0; m < d.length; m++) {
            var b = d[m];
            if (!g[b.uid]) {
              var y = v._splomScenes[b.uid];
              y && y.destroy && y.destroy(), v._splomScenes[b.uid] = null, delete v._splomScenes[b.uid];
            }
          }
        }
        Object.keys(v._splomScenes || {}).length === 0 && delete v._splomScenes, v._splomGrid && !p._hasOnlyLargeSploms && v._hasOnlyLargeSploms && (v._splomGrid.destroy(), v._splomGrid = null, delete v._splomGrid), i.clean(h, p, d, v);
      }, updateFx: i.updateFx, toSVG: i.toSVG };
    }, { "../../lib/prepare_regl": 516, "../../plots/cartesian": 568, "../../plots/cartesian/axes": 554, "../../plots/cartesian/axis_ids": 558, "../../plots/get_data": 593, "../../registry": 638, "regl-line2d": 280 }], 1031: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../plots/cartesian/axis_ids"), o = e("../scatter/calc").calcMarkerSize, s = e("../scatter/calc").calcAxisExpansion, i = e("../scatter/colorscale_calc"), l = e("../scattergl/convert").markerSelection, u2 = e("../scattergl/convert").markerStyle, c = e("./scene_update"), f = e("../../constants/numerical").BADNUM, h = e("../scattergl/constants").TOO_MANY_POINTS;
      t.exports = function(p, d) {
        var v, m, g, x, b, y, w = d.dimensions, _4 = d._length, k = {}, T2 = k.cdata = [], A2 = k.data = [], S2 = d._visibleDims = [];
        function C2(F13, N2) {
          for (var D2 = F13.makeCalcdata({ v: N2.values, vcalendar: d.calendar }, "v"), I2 = 0; I2 < D2.length; I2++) D2[I2] = D2[I2] === f ? NaN : D2[I2];
          T2.push(D2), A2.push(F13.type === "log" ? n.simpleMap(D2, F13.c2l) : D2);
        }
        for (v = 0; v < w.length; v++) if ((g = w[v]).visible) {
          if (x = a.getFromId(p, d._diag[v][0]), b = a.getFromId(p, d._diag[v][1]), x && b && x.type !== b.type) {
            n.log("Skipping splom dimension " + v + " with conflicting axis types");
            continue;
          }
          x ? (C2(x, g), b && b.type === "category" && (b._categories = x._categories.slice())) : C2(b, g), S2.push(v);
        }
        for (i(p, d), n.extendFlat(k, u2(d)), y = T2.length * _4 > h ? k.sizeAvg || Math.max(k.size, 3) : o(d, _4), m = 0; m < S2.length; m++) g = w[v = S2[m]], x = a.getFromId(p, d._diag[v][0]) || {}, b = a.getFromId(p, d._diag[v][1]) || {}, s(p, d, x, b, T2[m], T2[m], y);
        var E2 = c(p, d);
        return E2.matrix || (E2.matrix = true), E2.matrixOptions = k, E2.selectedOptions = l(d, d.selected), E2.unselectedOptions = l(d, d.unselected), [{ x: false, y: false, t: {}, trace: d }];
      };
    }, { "../../constants/numerical": 479, "../../lib": 503, "../../plots/cartesian/axis_ids": 558, "../scatter/calc": 927, "../scatter/colorscale_calc": 929, "../scattergl/constants": 980, "../scattergl/convert": 981, "./scene_update": 1038 }], 1032: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../plots/array_container_defaults"), o = e("./attributes"), s = e("../scatter/subtypes"), i = e("../scatter/marker_defaults"), l = e("../parcoords/merge_length"), u2 = e("../scattergl/helpers").isOpenSymbol;
      function c(f, h) {
        function p(v, m) {
          return n.coerce(f, h, o.dimensions, v, m);
        }
        p("label");
        var d = p("values");
        d && d.length ? p("visible") : h.visible = false, p("axis.type"), p("axis.matches");
      }
      t.exports = function(f, h, p, d) {
        function v(_4, k) {
          return n.coerce(f, h, o, _4, k);
        }
        var m = a(f, h, { name: "dimensions", handleItemDefaults: c }), g = v("diagonal.visible"), x = v("showupperhalf"), b = v("showlowerhalf");
        if (l(h, m, "values") && (g || x || b)) {
          v("text"), v("hovertext"), v("hovertemplate"), v("xhoverformat"), v("yhoverformat"), i(f, h, p, d, v);
          var y = u2(h.marker.symbol), w = s.isBubble(h);
          v("marker.line.width", y || w ? 1 : 0), function(_4, k, T2, A2) {
            var S2, C2, E2 = k.dimensions, F13 = E2.length, N2 = k.showupperhalf, D2 = k.showlowerhalf, I2 = k.diagonal.visible, O2 = new Array(F13), L2 = new Array(F13);
            for (S2 = 0; S2 < F13; S2++) {
              var V2 = S2 ? S2 + 1 : "";
              O2[S2] = "x" + V2, L2[S2] = "y" + V2;
            }
            var W2 = A2("xaxes", O2), X2 = A2("yaxes", L2), Y2 = k._diag = new Array(F13);
            k._xaxes = {}, k._yaxes = {};
            var K2 = [], q = [];
            function re(ae, ue, le, ce) {
              if (ae) {
                var se = ae.charAt(0), he = T2._splomAxes[se];
                if (k["_" + se + "axes"][ae] = 1, ce.push(ae), !(ae in he)) {
                  var me = he[ae] = {};
                  le && (me.label = le.label || "", le.visible && le.axis && (le.axis.type && (me.type = le.axis.type), le.axis.matches && (me.matches = ue)));
                }
              }
            }
            var R2 = !I2 && !D2, z = !I2 && !N2;
            for (k._axesDim = {}, S2 = 0; S2 < F13; S2++) {
              var H2 = E2[S2], te = S2 === 0, j = S2 === F13 - 1, Q2 = te && R2 || j && z ? void 0 : W2[S2], Z2 = te && z || j && R2 ? void 0 : X2[S2];
              re(Q2, Z2, H2, K2), re(Z2, Q2, H2, q), Y2[S2] = [Q2, Z2], k._axesDim[Q2] = S2, k._axesDim[Z2] = S2;
            }
            for (S2 = 0; S2 < K2.length; S2++) for (C2 = 0; C2 < q.length; C2++) {
              var ne = K2[S2] + q[C2];
              S2 > C2 && N2 || S2 < C2 && D2 ? T2._splomSubplots[ne] = 1 : S2 !== C2 || !I2 && D2 && N2 || (T2._splomSubplots[ne] = 1);
            }
            (!D2 || !I2 && N2 && D2) && (T2._splomGridDflt.xside = "bottom", T2._splomGridDflt.yside = "left");
          }(0, h, d, v), n.coerceSelectionMarkerOpacity(h, v);
        } else h.visible = false;
      };
    }, { "../../lib": 503, "../../plots/array_container_defaults": 549, "../parcoords/merge_length": 897, "../scatter/marker_defaults": 945, "../scatter/subtypes": 951, "../scattergl/helpers": 985, "./attributes": 1029 }], 1033: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../scatter/colorscale_calc"), o = e("../scattergl/convert").markerStyle;
      t.exports = function(s, i) {
        var l = i.trace, u2 = s._fullLayout._splomScenes[l.uid];
        if (u2) {
          a(s, l), n.extendFlat(u2.matrixOptions, o(l));
          var c = n.extendFlat({}, u2.matrixOptions, u2.viewOpts);
          u2.matrix.update(c, null);
        }
      };
    }, { "../../lib": 503, "../scatter/colorscale_calc": 929, "../scattergl/convert": 981 }], 1034: [function(e, t, r) {
      "use strict";
      r.getDimIndex = function(n, a) {
        for (var o = a._id, s = { x: 0, y: 1 }[o.charAt(0)], i = n._visibleDims, l = 0; l < i.length; l++) {
          var u2 = i[l];
          if (n._diag[u2][s] === o) return l;
        }
        return false;
      };
    }, {}], 1035: [function(e, t, r) {
      "use strict";
      var n = e("./helpers"), a = e("../scattergl/hover").calcHover;
      t.exports = { hoverPoints: function(o, s, i) {
        var l = o.cd[0].trace, u2 = o.scene.matrixOptions.cdata, c = o.xa, f = o.ya, h = c.c2p(s), p = f.c2p(i), d = o.distance, v = n.getDimIndex(l, c), m = n.getDimIndex(l, f);
        if (v === false || m === false) return [o];
        for (var g, x, b = u2[v], y = u2[m], w = d, _4 = 0; _4 < b.length; _4++) {
          var k = b[_4], T2 = y[_4], A2 = c.c2p(k) - h, S2 = f.c2p(T2) - p, C2 = Math.sqrt(A2 * A2 + S2 * S2);
          C2 < w && (w = x = C2, g = _4);
        }
        return o.index = g, o.distance = w, o.dxy = x, g === void 0 ? [o] : [a(o, b, y, l)];
      } };
    }, { "../scattergl/hover": 986, "./helpers": 1034 }], 1036: [function(e, t, r) {
      "use strict";
      var n = e("../../registry"), a = e("../../components/grid");
      t.exports = { moduleType: "trace", name: "splom", basePlotModule: e("./base_plot"), categories: ["gl", "regl", "cartesian", "symbols", "showLegend", "scatter-like"], attributes: e("./attributes"), supplyDefaults: e("./defaults"), colorbar: e("../scatter/marker_colorbar"), calc: e("./calc"), plot: e("./plot"), hoverPoints: e("./hover").hoverPoints, selectPoints: e("./select"), editStyle: e("./edit_style"), meta: {} }, n.register(a);
    }, { "../../components/grid": 410, "../../registry": 638, "../scatter/marker_colorbar": 944, "./attributes": 1029, "./base_plot": 1030, "./calc": 1031, "./defaults": 1032, "./edit_style": 1033, "./hover": 1035, "./plot": 1037, "./select": 1039 }], 1037: [function(e, t, r) {
      "use strict";
      var n = e("regl-splom"), a = e("../../lib"), o = e("../../plots/cartesian/axis_ids"), s = e("../../components/dragelement/helpers").selectMode;
      function i(l, u2) {
        var c, f, h, p, d, v = l._fullLayout, m = v._size, g = u2.trace, x = u2.t, b = v._splomScenes[g.uid], y = b.matrixOptions, w = y.cdata, _4 = v._glcanvas.data()[0].regl, k = v.dragmode;
        if (w.length !== 0) {
          y.lower = g.showupperhalf, y.upper = g.showlowerhalf, y.diagonal = g.diagonal.visible;
          var T2 = g._visibleDims, A2 = w.length, S2 = b.viewOpts = {};
          for (S2.ranges = new Array(A2), S2.domains = new Array(A2), d = 0; d < T2.length; d++) {
            h = T2[d];
            var C2 = S2.ranges[d] = new Array(4), E2 = S2.domains[d] = new Array(4);
            (c = o.getFromId(l, g._diag[h][0])) && (C2[0] = c._rl[0], C2[2] = c._rl[1], E2[0] = c.domain[0], E2[2] = c.domain[1]), (f = o.getFromId(l, g._diag[h][1])) && (C2[1] = f._rl[0], C2[3] = f._rl[1], E2[1] = f.domain[0], E2[3] = f.domain[1]);
          }
          var F13 = l._context.plotGlPixelRatio, N2 = m.l * F13, D2 = m.b * F13, I2 = m.w * F13, O2 = m.h * F13;
          S2.viewport = [N2, D2, I2 + N2, O2 + D2], b.matrix === true && (b.matrix = n(_4));
          var L2 = v.clickmode.indexOf("select") > -1, V2 = true;
          if (s(k) || !!g.selectedpoints || L2) {
            var W2 = g._length;
            if (g.selectedpoints) {
              b.selectBatch = g.selectedpoints;
              var X2 = g.selectedpoints, Y2 = {};
              for (h = 0; h < X2.length; h++) Y2[X2[h]] = true;
              var K2 = [];
              for (h = 0; h < W2; h++) Y2[h] || K2.push(h);
              b.unselectBatch = K2;
            }
            var q = x.xpx = new Array(A2), re = x.ypx = new Array(A2);
            for (d = 0; d < T2.length; d++) {
              if (h = T2[d], c = o.getFromId(l, g._diag[h][0])) for (q[d] = new Array(W2), p = 0; p < W2; p++) q[d][p] = c.c2p(w[d][p]);
              if (f = o.getFromId(l, g._diag[h][1])) for (re[d] = new Array(W2), p = 0; p < W2; p++) re[d][p] = f.c2p(w[d][p]);
            }
            if (b.selectBatch.length || b.unselectBatch.length) {
              var R2 = a.extendFlat({}, y, b.unselectedOptions, S2), z = a.extendFlat({}, y, b.selectedOptions, S2);
              b.matrix.update(R2, z), V2 = false;
            }
          } else x.xpx = x.ypx = null;
          if (V2) {
            var H2 = a.extendFlat({}, y, S2);
            b.matrix.update(H2, null);
          }
        }
      }
      t.exports = function(l, u2, c) {
        if (c.length) for (var f = 0; f < c.length; f++) i(l, c[f][0]);
      };
    }, { "../../components/dragelement/helpers": 384, "../../lib": 503, "../../plots/cartesian/axis_ids": 558, "regl-splom": 282 }], 1038: [function(e, t, r) {
      "use strict";
      var n = e("../../lib");
      t.exports = function(a, o) {
        var s = a._fullLayout, i = o.uid, l = s._splomScenes;
        l || (l = s._splomScenes = {});
        var u2 = { dirty: true, selectBatch: [], unselectBatch: [] }, c = l[o.uid];
        return c || ((c = l[i] = n.extendFlat({}, u2, { matrix: false, selectBatch: [], unselectBatch: [] })).draw = function() {
          c.matrix && c.matrix.draw && (c.selectBatch.length || c.unselectBatch.length ? c.matrix.draw(c.unselectBatch, c.selectBatch) : c.matrix.draw()), c.dirty = false;
        }, c.destroy = function() {
          c.matrix && c.matrix.destroy && c.matrix.destroy(), c.matrixOptions = null, c.selectBatch = null, c.unselectBatch = null, c = null;
        }), c.dirty || n.extendFlat(c, u2), c;
      };
    }, { "../../lib": 503 }], 1039: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../scatter/subtypes"), o = e("./helpers");
      t.exports = function(s, i) {
        var l = s.cd, u2 = l[0].trace, c = l[0].t, f = s.scene, h = f.matrixOptions.cdata, p = s.xaxis, d = s.yaxis, v = [];
        if (!f) return v;
        var m = !a.hasMarkers(u2) && !a.hasText(u2);
        if (u2.visible !== true || m) return v;
        var g = o.getDimIndex(u2, p), x = o.getDimIndex(u2, d);
        if (g === false || x === false) return v;
        var b = c.xpx[g], y = c.ypx[x], w = h[g], _4 = h[x], k = [], T2 = [];
        if (i !== false && !i.degenerate) for (var A2 = 0; A2 < w.length; A2++) i.contains([b[A2], y[A2]], null, A2, s) ? (k.push(A2), v.push({ pointNumber: A2, x: w[A2], y: _4[A2] })) : T2.push(A2);
        var S2 = f.matrixOptions;
        return k.length || T2.length ? f.selectBatch.length || f.unselectBatch.length || f.matrix.update(f.unselectedOptions, n.extendFlat({}, S2, f.selectedOptions, f.viewOpts)) : f.matrix.update(S2, null), f.selectBatch = k, f.unselectBatch = T2, v;
      };
    }, { "../../lib": 503, "../scatter/subtypes": 951, "./helpers": 1034 }], 1040: [function(e, t, r) {
      "use strict";
      var n = e("../../components/colorscale/attributes"), a = e("../../plots/cartesian/axis_format_attributes").axisHoverFormat, o = e("../../plots/template_attributes").hovertemplateAttrs, s = e("../mesh3d/attributes"), i = e("../../plots/attributes"), l = e("../../lib/extend").extendFlat, u2 = { x: { valType: "data_array", editType: "calc+clearAxisTypes" }, y: { valType: "data_array", editType: "calc+clearAxisTypes" }, z: { valType: "data_array", editType: "calc+clearAxisTypes" }, u: { valType: "data_array", editType: "calc" }, v: { valType: "data_array", editType: "calc" }, w: { valType: "data_array", editType: "calc" }, starts: { x: { valType: "data_array", editType: "calc" }, y: { valType: "data_array", editType: "calc" }, z: { valType: "data_array", editType: "calc" }, editType: "calc" }, maxdisplayed: { valType: "integer", min: 0, dflt: 1e3, editType: "calc" }, sizeref: { valType: "number", editType: "calc", min: 0, dflt: 1 }, text: { valType: "string", dflt: "", editType: "calc" }, hovertext: { valType: "string", dflt: "", editType: "calc" }, hovertemplate: o({ editType: "calc" }, { keys: ["tubex", "tubey", "tubez", "tubeu", "tubev", "tubew", "norm", "divergence"] }), uhoverformat: a("u", 1), vhoverformat: a("v", 1), whoverformat: a("w", 1), xhoverformat: a("x"), yhoverformat: a("y"), zhoverformat: a("z"), showlegend: l({}, i.showlegend, { dflt: false }) };
      l(u2, n("", { colorAttr: "u/v/w norm", showScaleDflt: true, editTypeOverride: "calc" })), ["opacity", "lightposition", "lighting"].forEach(function(c) {
        u2[c] = s[c];
      }), u2.hoverinfo = l({}, i.hoverinfo, { editType: "calc", flags: ["x", "y", "z", "u", "v", "w", "norm", "divergence", "text", "name"], dflt: "x+y+z+norm+text+name" }), u2.transforms = void 0, t.exports = u2;
    }, { "../../components/colorscale/attributes": 373, "../../lib/extend": 493, "../../plots/attributes": 550, "../../plots/cartesian/axis_format_attributes": 557, "../../plots/template_attributes": 633, "../mesh3d/attributes": 867 }], 1041: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../components/colorscale/calc");
      function o(l) {
        var u2, c, f, h, p, d, v, m, g, x, b, y, w = l._x, _4 = l._y, k = l._z, T2 = l._len, A2 = -1 / 0, S2 = 1 / 0, C2 = -1 / 0, E2 = 1 / 0, F13 = -1 / 0, N2 = 1 / 0, D2 = "";
        for (T2 && (v = w[0], g = _4[0], b = k[0]), T2 > 1 && (m = w[T2 - 1], x = _4[T2 - 1], y = k[T2 - 1]), u2 = 0; u2 < T2; u2++) A2 = Math.max(A2, w[u2]), S2 = Math.min(S2, w[u2]), C2 = Math.max(C2, _4[u2]), E2 = Math.min(E2, _4[u2]), F13 = Math.max(F13, k[u2]), N2 = Math.min(N2, k[u2]), h || w[u2] === v || (h = true, D2 += "x"), p || _4[u2] === g || (p = true, D2 += "y"), d || k[u2] === b || (d = true, D2 += "z");
        h || (D2 += "x"), p || (D2 += "y"), d || (D2 += "z");
        var I2 = s(l._x), O2 = s(l._y), L2 = s(l._z);
        D2 = (D2 = (D2 = D2.replace("x", (v > m ? "-" : "+") + "x")).replace("y", (g > x ? "-" : "+") + "y")).replace("z", (b > y ? "-" : "+") + "z");
        var V2 = function() {
          T2 = 0, I2 = [], O2 = [], L2 = [];
        };
        (!T2 || T2 < I2.length * O2.length * L2.length) && V2();
        var W2 = function(se) {
          return se === "x" ? w : se === "y" ? _4 : k;
        }, X2 = function(se) {
          return se === "x" ? I2 : se === "y" ? O2 : L2;
        }, Y2 = function(se) {
          return se[T2 - 1] < se[0] ? -1 : 1;
        }, K2 = W2(D2[1]), q = W2(D2[3]), re = W2(D2[5]), R2 = X2(D2[1]).length, z = X2(D2[3]).length, H2 = X2(D2[5]).length, te = false, j = function(se, he, me) {
          return R2 * (z * se + he) + me;
        }, Q2 = Y2(W2(D2[1])), Z2 = Y2(W2(D2[3])), ne = Y2(W2(D2[5]));
        for (u2 = 0; u2 < H2 - 1; u2++) {
          for (c = 0; c < z - 1; c++) {
            for (f = 0; f < R2 - 1; f++) {
              var ae = j(u2, c, f), ue = j(u2, c, f + 1), le = j(u2, c + 1, f), ce = j(u2 + 1, c, f);
              if (K2[ae] * Q2 < K2[ue] * Q2 && q[ae] * Z2 < q[le] * Z2 && re[ae] * ne < re[ce] * ne || (te = true), te) break;
            }
            if (te) break;
          }
          if (te) break;
        }
        return te && (n.warn("Encountered arbitrary coordinates! Unable to input data grid."), V2()), { xMin: S2, yMin: E2, zMin: N2, xMax: A2, yMax: C2, zMax: F13, Xs: I2, Ys: O2, Zs: L2, len: T2, fill: D2 };
      }
      function s(l) {
        return n.distinctVals(l).vals;
      }
      function i(l, u2) {
        if (u2 === void 0 && (u2 = l.length), n.isTypedArray(l)) return l.subarray(0, u2);
        for (var c = [], f = 0; f < u2; f++) c[f] = +l[f];
        return c;
      }
      t.exports = { calc: function(l, u2) {
        u2._len = Math.min(u2.u.length, u2.v.length, u2.w.length, u2.x.length, u2.y.length, u2.z.length), u2._u = i(u2.u, u2._len), u2._v = i(u2.v, u2._len), u2._w = i(u2.w, u2._len), u2._x = i(u2.x, u2._len), u2._y = i(u2.y, u2._len), u2._z = i(u2.z, u2._len);
        var c = o(u2);
        u2._gridFill = c.fill, u2._Xs = c.Xs, u2._Ys = c.Ys, u2._Zs = c.Zs, u2._len = c.len;
        var f, h, p, d = 0;
        u2.starts && (f = i(u2.starts.x || []), h = i(u2.starts.y || []), p = i(u2.starts.z || []), d = Math.min(f.length, h.length, p.length)), u2._startsX = f || [], u2._startsY = h || [], u2._startsZ = p || [];
        var v, m = 0, g = 1 / 0;
        for (v = 0; v < u2._len; v++) {
          var x = u2._u[v], b = u2._v[v], y = u2._w[v], w = Math.sqrt(x * x + b * b + y * y);
          m = Math.max(m, w), g = Math.min(g, w);
        }
        for (a(l, u2, { vals: [g, m], containerStr: "", cLetter: "c" }), v = 0; v < d; v++) {
          var _4 = f[v];
          c.xMax = Math.max(c.xMax, _4), c.xMin = Math.min(c.xMin, _4);
          var k = h[v];
          c.yMax = Math.max(c.yMax, k), c.yMin = Math.min(c.yMin, k);
          var T2 = p[v];
          c.zMax = Math.max(c.zMax, T2), c.zMin = Math.min(c.zMin, T2);
        }
        u2._slen = d, u2._normMax = m, u2._xbnds = [c.xMin, c.xMax], u2._ybnds = [c.yMin, c.yMax], u2._zbnds = [c.zMin, c.zMax];
      }, filter: i, processGrid: o };
    }, { "../../components/colorscale/calc": 374, "../../lib": 503 }], 1042: [function(e, t, r) {
      "use strict";
      var n = e("../../../stackgl_modules").gl_streamtube3d, a = n.createTubeMesh, o = e("../../lib"), s = e("../../lib/gl_format_color").parseColorScale, i = e("../../components/colorscale").extractOpts, l = e("../../plots/gl3d/zip3"), u2 = { xaxis: 0, yaxis: 1, zaxis: 2 };
      function c(v, m) {
        this.scene = v, this.uid = m, this.mesh = null, this.data = null;
      }
      var f = c.prototype;
      function h(v) {
        var m = v.length;
        return m > 2 ? v.slice(1, m - 1) : m === 2 ? [(v[0] + v[1]) / 2] : v;
      }
      function p(v) {
        var m = v.length;
        return m === 1 ? [0.5, 0.5] : [v[1] - v[0], v[m - 1] - v[m - 2]];
      }
      function d(v, m) {
        var g = v.fullSceneLayout, x = v.dataScale, b = m._len, y = {};
        function w(R2, z) {
          var H2 = g[z], te = x[u2[z]];
          return o.simpleMap(R2, function(j) {
            return H2.d2l(j) * te;
          });
        }
        if (y.vectors = l(w(m._u, "xaxis"), w(m._v, "yaxis"), w(m._w, "zaxis"), b), !b) return { positions: [], cells: [] };
        var _4 = w(m._Xs, "xaxis"), k = w(m._Ys, "yaxis"), T2 = w(m._Zs, "zaxis");
        if (y.meshgrid = [_4, k, T2], y.gridFill = m._gridFill, m._slen) y.startingPositions = l(w(m._startsX, "xaxis"), w(m._startsY, "yaxis"), w(m._startsZ, "zaxis"));
        else {
          for (var A2 = k[0], S2 = h(_4), C2 = h(T2), E2 = new Array(S2.length * C2.length), F13 = 0, N2 = 0; N2 < S2.length; N2++) for (var D2 = 0; D2 < C2.length; D2++) E2[F13++] = [S2[N2], A2, C2[D2]];
          y.startingPositions = E2;
        }
        y.colormap = s(m), y.tubeSize = m.sizeref, y.maxLength = m.maxdisplayed;
        var I2 = w(m._xbnds, "xaxis"), O2 = w(m._ybnds, "yaxis"), L2 = w(m._zbnds, "zaxis"), V2 = p(_4), W2 = p(k), X2 = p(T2), Y2 = [[I2[0] - V2[0], O2[0] - W2[0], L2[0] - X2[0]], [I2[1] + V2[1], O2[1] + W2[1], L2[1] + X2[1]]], K2 = n(y, Y2), q = i(m);
        K2.vertexIntensityBounds = [q.min / m._normMax, q.max / m._normMax];
        var re = m.lightposition;
        return K2.lightPosition = [re.x, re.y, re.z], K2.ambient = m.lighting.ambient, K2.diffuse = m.lighting.diffuse, K2.specular = m.lighting.specular, K2.roughness = m.lighting.roughness, K2.fresnel = m.lighting.fresnel, K2.opacity = m.opacity, m._pad = K2.tubeScale * m.sizeref * 2, K2;
      }
      f.handlePick = function(v) {
        var m = this.scene.fullSceneLayout, g = this.scene.dataScale;
        function x(w, _4) {
          var k = m[_4], T2 = g[u2[_4]];
          return k.l2c(w) / T2;
        }
        if (v.object === this.mesh) {
          var b = v.data.position, y = v.data.velocity;
          return v.traceCoordinate = [x(b[0], "xaxis"), x(b[1], "yaxis"), x(b[2], "zaxis"), x(y[0], "xaxis"), x(y[1], "yaxis"), x(y[2], "zaxis"), v.data.intensity * this.data._normMax, v.data.divergence], v.textLabel = this.data.hovertext || this.data.text, true;
        }
      }, f.update = function(v) {
        this.data = v;
        var m = d(this.scene, v);
        this.mesh.update(m);
      }, f.dispose = function() {
        this.scene.glplot.remove(this.mesh), this.mesh.dispose();
      }, t.exports = function(v, m) {
        var g = v.glplot.gl, x = d(v, m), b = a(g, x), y = new c(v, m.uid);
        return y.mesh = b, y.data = m, b._trace = y, v.glplot.add(b), y;
      };
    }, { "../../../stackgl_modules": 1120, "../../components/colorscale": 378, "../../lib": 503, "../../lib/gl_format_color": 499, "../../plots/gl3d/zip3": 609 }], 1043: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../components/colorscale/defaults"), o = e("./attributes");
      t.exports = function(s, i, l, u2) {
        function c(g, x) {
          return n.coerce(s, i, o, g, x);
        }
        var f = c("u"), h = c("v"), p = c("w"), d = c("x"), v = c("y"), m = c("z");
        f && f.length && h && h.length && p && p.length && d && d.length && v && v.length && m && m.length ? (c("starts.x"), c("starts.y"), c("starts.z"), c("maxdisplayed"), c("sizeref"), c("lighting.ambient"), c("lighting.diffuse"), c("lighting.specular"), c("lighting.roughness"), c("lighting.fresnel"), c("lightposition.x"), c("lightposition.y"), c("lightposition.z"), a(s, i, u2, c, { prefix: "", cLetter: "c" }), c("text"), c("hovertext"), c("hovertemplate"), c("uhoverformat"), c("vhoverformat"), c("whoverformat"), c("xhoverformat"), c("yhoverformat"), c("zhoverformat"), i._length = null) : i.visible = false;
      };
    }, { "../../components/colorscale/defaults": 376, "../../lib": 503, "./attributes": 1040 }], 1044: [function(e, t, r) {
      "use strict";
      t.exports = { moduleType: "trace", name: "streamtube", basePlotModule: e("../../plots/gl3d"), categories: ["gl3d", "showLegend"], attributes: e("./attributes"), supplyDefaults: e("./defaults"), colorbar: { min: "cmin", max: "cmax" }, calc: e("./calc").calc, plot: e("./convert"), eventData: function(n, a) {
        return n.tubex = n.x, n.tubey = n.y, n.tubez = n.z, n.tubeu = a.traceCoordinate[3], n.tubev = a.traceCoordinate[4], n.tubew = a.traceCoordinate[5], n.norm = a.traceCoordinate[6], n.divergence = a.traceCoordinate[7], delete n.x, delete n.y, delete n.z, n;
      }, meta: {} };
    }, { "../../plots/gl3d": 598, "./attributes": 1040, "./calc": 1041, "./convert": 1042, "./defaults": 1043 }], 1045: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/attributes"), a = e("../../plots/template_attributes").hovertemplateAttrs, o = e("../../plots/template_attributes").texttemplateAttrs, s = e("../../components/colorscale/attributes"), i = e("../../plots/domain").attributes, l = e("../pie/attributes"), u2 = e("./constants"), c = e("../../lib/extend").extendFlat;
      t.exports = { labels: { valType: "data_array", editType: "calc" }, parents: { valType: "data_array", editType: "calc" }, values: { valType: "data_array", editType: "calc" }, branchvalues: { valType: "enumerated", values: ["remainder", "total"], dflt: "remainder", editType: "calc" }, count: { valType: "flaglist", flags: ["branches", "leaves"], dflt: "leaves", editType: "calc" }, level: { valType: "any", editType: "plot", anim: true }, maxdepth: { valType: "integer", editType: "plot", dflt: -1 }, marker: c({ colors: { valType: "data_array", editType: "calc" }, line: { color: c({}, l.marker.line.color, { dflt: null }), width: c({}, l.marker.line.width, { dflt: 1 }), editType: "calc" }, editType: "calc" }, s("marker", { colorAttr: "colors", anim: false })), leaf: { opacity: { valType: "number", editType: "style", min: 0, max: 1 }, editType: "plot" }, text: l.text, textinfo: { valType: "flaglist", flags: ["label", "text", "value", "current path", "percent root", "percent entry", "percent parent"], extras: ["none"], editType: "plot" }, texttemplate: o({ editType: "plot" }, { keys: u2.eventDataKeys.concat(["label", "value"]) }), hovertext: l.hovertext, hoverinfo: c({}, n.hoverinfo, { flags: ["label", "text", "value", "name", "current path", "percent root", "percent entry", "percent parent"], dflt: "label+text+value+name" }), hovertemplate: a({}, { keys: u2.eventDataKeys }), textfont: l.textfont, insidetextorientation: l.insidetextorientation, insidetextfont: l.insidetextfont, outsidetextfont: c({}, l.outsidetextfont, {}), rotation: { valType: "angle", dflt: 0, editType: "plot" }, sort: l.sort, root: { color: { valType: "color", editType: "calc", dflt: "rgba(0,0,0,0)" }, editType: "calc" }, domain: i({ name: "sunburst", trace: true, editType: "calc" }) };
    }, { "../../components/colorscale/attributes": 373, "../../lib/extend": 493, "../../plots/attributes": 550, "../../plots/domain": 584, "../../plots/template_attributes": 633, "../pie/attributes": 900, "./constants": 1048 }], 1046: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/plots");
      r.name = "sunburst", r.plot = function(a, o, s, i) {
        n.plotBasePlot(r.name, a, o, s, i);
      }, r.clean = function(a, o, s, i) {
        n.cleanBasePlot(r.name, a, o, s, i);
      };
    }, { "../../plots/plots": 619 }], 1047: [function(e, t, r) {
      "use strict";
      var n = e("d3-hierarchy"), a = e("fast-isnumeric"), o = e("../../lib"), s = e("../../components/colorscale").makeColorScaleFuncFromTrace, i = e("../pie/calc").makePullColorFn, l = e("../pie/calc").generateExtendedColors, u2 = e("../../components/colorscale").calc, c = e("../../constants/numerical").ALMOST_EQUAL, f = {}, h = {}, p = {};
      r.calc = function(d, v) {
        var m, g, x, b, y, w, _4 = d._fullLayout, k = v.ids, T2 = o.isArrayOrTypedArray(k), A2 = v.labels, S2 = v.parents, C2 = v.values, E2 = o.isArrayOrTypedArray(C2), F13 = [], N2 = {}, D2 = {}, I2 = function(Z2) {
          return Z2 || typeof Z2 == "number";
        }, O2 = function(Z2) {
          return !E2 || a(C2[Z2]) && C2[Z2] >= 0;
        };
        T2 ? (m = Math.min(k.length, S2.length), g = function(Z2) {
          return I2(k[Z2]) && O2(Z2);
        }, x = function(Z2) {
          return String(k[Z2]);
        }) : (m = Math.min(A2.length, S2.length), g = function(Z2) {
          return I2(A2[Z2]) && O2(Z2);
        }, x = function(Z2) {
          return String(A2[Z2]);
        }), E2 && (m = Math.min(m, C2.length));
        for (var L2 = 0; L2 < m; L2++) if (g(L2)) {
          var V2 = x(L2), W2 = I2(S2[L2]) ? String(S2[L2]) : "", X2 = { i: L2, id: V2, pid: W2, label: I2(A2[L2]) ? String(A2[L2]) : "" };
          E2 && (X2.v = +C2[L2]), F13.push(X2), y = V2, N2[b = W2] ? N2[b].push(y) : N2[b] = [y], D2[y] = 1;
        }
        if (N2[""]) {
          if (N2[""].length > 1) {
            for (var Y2 = o.randstr(), K2 = 0; K2 < F13.length; K2++) F13[K2].pid === "" && (F13[K2].pid = Y2);
            F13.unshift({ hasMultipleRoots: true, id: Y2, pid: "", label: "" });
          }
        } else {
          var q, re = [];
          for (q in N2) D2[q] || re.push(q);
          if (re.length !== 1) return o.warn(["Multiple implied roots, cannot build", v.type, "hierarchy of", v.name + ".", "These roots include:", re.join(", ")].join(" "));
          q = re[0], F13.unshift({ hasImpliedRoot: true, id: q, pid: "", label: q });
        }
        try {
          w = n.stratify().id(function(Z2) {
            return Z2.id;
          }).parentId(function(Z2) {
            return Z2.pid;
          })(F13);
        } catch (Z2) {
          return o.warn(["Failed to build", v.type, "hierarchy of", v.name + ".", "Error:", Z2.message].join(" "));
        }
        var R2 = n.hierarchy(w), z = false;
        if (E2) switch (v.branchvalues) {
          case "remainder":
            R2.sum(function(Z2) {
              return Z2.data.v;
            });
            break;
          case "total":
            R2.each(function(Z2) {
              var ne = Z2.data.data, ae = ne.v;
              if (Z2.children) {
                var ue = Z2.children.reduce(function(le, ce) {
                  return le + ce.data.data.v;
                }, 0);
                if ((ne.hasImpliedRoot || ne.hasMultipleRoots) && (ae = ue), ae < ue * c) return z = true, o.warn(["Total value for node", Z2.data.data.id, "of", v.name, "is smaller than the sum of its children.", `
parent value =`, ae, `
children sum =`, ue].join(" "));
              }
              Z2.value = ae;
            });
        }
        else (function Z2(ne, ae, ue) {
          var le = 0, ce = ne.children;
          if (ce) {
            for (var se = ce.length, he = 0; he < se; he++) le += Z2(ce[he], ae, ue);
            ue.branches && le++;
          } else ue.leaves && le++;
          return ne.value = ne.data.data.value = le, ae._values || (ae._values = []), ae._values[ne.data.data.i] = le, le;
        })(R2, v, { branches: v.count.indexOf("branches") !== -1, leaves: v.count.indexOf("leaves") !== -1 });
        if (!z) {
          var H2, te;
          v.sort && R2.sort(function(Z2, ne) {
            return ne.value - Z2.value;
          });
          var j = v.marker.colors || [], Q2 = !!j.length;
          return v._hasColorscale ? (Q2 || (j = E2 ? v.values : v._values), u2(d, v, { vals: j, containerStr: "marker", cLetter: "c" }), te = s(v.marker)) : H2 = i(_4["_" + v.type + "colormap"]), R2.each(function(Z2) {
            var ne = Z2.data.data;
            ne.color = v._hasColorscale ? te(j[ne.i]) : H2(j[ne.i], ne.id);
          }), F13[0].hierarchy = R2, F13;
        }
      }, r._runCrossTraceCalc = function(d, v) {
        var m = v._fullLayout, g = v.calcdata, x = m[d + "colorway"], b = m["_" + d + "colormap"];
        m["extend" + d + "colors"] && (x = l(x, d === "icicle" ? p : d === "treemap" ? h : f));
        var y, w = 0;
        function _4(A2) {
          var S2 = A2.data.data, C2 = S2.id;
          S2.color === false && (b[C2] ? S2.color = b[C2] : A2.parent ? A2.parent.parent ? S2.color = A2.parent.data.data.color : (b[C2] = S2.color = x[w % x.length], w++) : S2.color = y);
        }
        for (var k = 0; k < g.length; k++) {
          var T2 = g[k][0];
          T2.trace.type === d && T2.hierarchy && (y = T2.trace.root.color, T2.hierarchy.each(_4));
        }
      }, r.crossTraceCalc = function(d) {
        return r._runCrossTraceCalc("sunburst", d);
      };
    }, { "../../components/colorscale": 378, "../../constants/numerical": 479, "../../lib": 503, "../pie/calc": 902, "d3-hierarchy": 115, "fast-isnumeric": 190 }], 1048: [function(e, t, r) {
      "use strict";
      t.exports = { CLICK_TRANSITION_TIME: 750, CLICK_TRANSITION_EASING: "linear", eventDataKeys: ["currentPath", "root", "entry", "percentRoot", "percentEntry", "percentParent"] };
    }, {}], 1049: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("./attributes"), o = e("../../plots/domain").defaults, s = e("../bar/defaults").handleText, i = e("../../components/colorscale"), l = i.hasColorscale, u2 = i.handleDefaults;
      t.exports = function(c, f, h, p) {
        function d(y, w) {
          return n.coerce(c, f, a, y, w);
        }
        var v = d("labels"), m = d("parents");
        if (v && v.length && m && m.length) {
          var g = d("values");
          g && g.length ? d("branchvalues") : d("count"), d("level"), d("maxdepth"), d("marker.line.width") && d("marker.line.color", p.paper_bgcolor), d("marker.colors");
          var x = f._hasColorscale = l(c, "marker", "colors") || (c.marker || {}).coloraxis;
          x && u2(c, f, p, d, { prefix: "marker.", cLetter: "c" }), d("leaf.opacity", x ? 1 : 0.7);
          var b = d("text");
          d("texttemplate"), f.texttemplate || d("textinfo", Array.isArray(b) ? "text+label" : "label"), d("hovertext"), d("hovertemplate"), s(c, f, p, d, "auto", { moduleHasSelected: false, moduleHasUnselected: false, moduleHasConstrain: false, moduleHasCliponaxis: false, moduleHasTextangle: false, moduleHasInsideanchor: false }), d("insidetextorientation"), d("sort"), d("rotation"), d("root.color"), o(f, p, d), f._length = null;
        } else f.visible = false;
      };
    }, { "../../components/colorscale": 378, "../../lib": 503, "../../plots/domain": 584, "../bar/defaults": 652, "./attributes": 1045 }], 1050: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../registry"), o = e("../../components/fx/helpers").appendArrayPointValue, s = e("../../components/fx"), i = e("../../lib"), l = e("../../lib/events"), u2 = e("./helpers"), c = e("../pie/helpers").formatPieValue;
      function f(h, p, d) {
        for (var v = h.data.data, m = { curveNumber: p.index, pointNumber: v.i, data: p._input, fullData: p }, g = 0; g < d.length; g++) {
          var x = d[g];
          x in h && (m[x] = h[x]);
        }
        return "parentString" in h && !u2.isHierarchyRoot(h) && (m.parent = h.parentString), o(m, p, v.i), m;
      }
      t.exports = function(h, p, d, v, m) {
        var g = v[0], x = g.trace, b = g.hierarchy, y = x.type === "sunburst", w = x.type === "treemap" || x.type === "icicle";
        "_hasHoverLabel" in x || (x._hasHoverLabel = false), "_hasHoverEvent" in x || (x._hasHoverEvent = false), h.on("mouseover", function(_4) {
          var k = d._fullLayout;
          if (!d._dragging && k.hovermode !== false) {
            var T2, A2 = d._fullData[x.index], S2 = _4.data.data, C2 = S2.i, E2 = u2.isHierarchyRoot(_4), F13 = u2.getParent(b, _4), N2 = u2.getValue(_4), D2 = function(Q2) {
              return i.castOption(A2, C2, Q2);
            }, I2 = D2("hovertemplate"), O2 = s.castHoverinfo(A2, k, C2), L2 = k.separators;
            if (I2 || O2 && O2 !== "none" && O2 !== "skip") {
              var V2, W2;
              y && (V2 = g.cx + _4.pxmid[0] * (1 - _4.rInscribed), W2 = g.cy + _4.pxmid[1] * (1 - _4.rInscribed)), w && (V2 = _4._hoverX, W2 = _4._hoverY);
              var X2, Y2 = {}, K2 = [], q = [], re = function(Q2) {
                return K2.indexOf(Q2) !== -1;
              };
              O2 && (K2 = O2 === "all" ? A2._module.attributes.hoverinfo.flags : O2.split("+")), Y2.label = S2.label, re("label") && Y2.label && q.push(Y2.label), S2.hasOwnProperty("v") && (Y2.value = S2.v, Y2.valueLabel = c(Y2.value, L2), re("value") && q.push(Y2.valueLabel)), Y2.currentPath = _4.currentPath = u2.getPath(_4.data), re("current path") && !E2 && q.push(Y2.currentPath);
              var R2 = [], z = function() {
                R2.indexOf(X2) === -1 && (q.push(X2), R2.push(X2));
              };
              Y2.percentParent = _4.percentParent = N2 / u2.getValue(F13), Y2.parent = _4.parentString = u2.getPtLabel(F13), re("percent parent") && (X2 = u2.formatPercent(Y2.percentParent, L2) + " of " + Y2.parent, z()), Y2.percentEntry = _4.percentEntry = N2 / u2.getValue(p), Y2.entry = _4.entry = u2.getPtLabel(p), !re("percent entry") || E2 || _4.onPathbar || (X2 = u2.formatPercent(Y2.percentEntry, L2) + " of " + Y2.entry, z()), Y2.percentRoot = _4.percentRoot = N2 / u2.getValue(b), Y2.root = _4.root = u2.getPtLabel(b), re("percent root") && !E2 && (X2 = u2.formatPercent(Y2.percentRoot, L2) + " of " + Y2.root, z()), Y2.text = D2("hovertext") || D2("text"), re("text") && (X2 = Y2.text, i.isValidTextValue(X2) && q.push(X2)), T2 = [f(_4, A2, m.eventDataKeys)];
              var H2 = { trace: A2, y: W2, _x0: _4._x0, _x1: _4._x1, _y0: _4._y0, _y1: _4._y1, text: q.join("<br>"), name: I2 || re("name") ? A2.name : void 0, color: D2("hoverlabel.bgcolor") || S2.color, borderColor: D2("hoverlabel.bordercolor"), fontFamily: D2("hoverlabel.font.family"), fontSize: D2("hoverlabel.font.size"), fontColor: D2("hoverlabel.font.color"), nameLength: D2("hoverlabel.namelength"), textAlign: D2("hoverlabel.align"), hovertemplate: I2, hovertemplateLabels: Y2, eventData: T2 };
              y && (H2.x0 = V2 - _4.rInscribed * _4.rpx1, H2.x1 = V2 + _4.rInscribed * _4.rpx1, H2.idealAlign = _4.pxmid[0] < 0 ? "left" : "right"), w && (H2.x = V2, H2.idealAlign = V2 < 0 ? "left" : "right");
              var te = [];
              s.loneHover(H2, { container: k._hoverlayer.node(), outerContainer: k._paper.node(), gd: d, inOut_bbox: te }), T2[0].bbox = te[0], x._hasHoverLabel = true;
            }
            if (w) {
              var j = h.select("path.surface");
              m.styleOne(j, _4, A2, { hovered: true });
            }
            x._hasHoverEvent = true, d.emit("plotly_hover", { points: T2 || [f(_4, A2, m.eventDataKeys)], event: n.event });
          }
        }), h.on("mouseout", function(_4) {
          var k = d._fullLayout, T2 = d._fullData[x.index], A2 = n.select(this).datum();
          if (x._hasHoverEvent && (_4.originalEvent = n.event, d.emit("plotly_unhover", { points: [f(A2, T2, m.eventDataKeys)], event: n.event }), x._hasHoverEvent = false), x._hasHoverLabel && (s.loneUnhover(k._hoverlayer.node()), x._hasHoverLabel = false), w) {
            var S2 = h.select("path.surface");
            m.styleOne(S2, A2, T2, { hovered: false });
          }
        }), h.on("click", function(_4) {
          var k = d._fullLayout, T2 = d._fullData[x.index], A2 = y && (u2.isHierarchyRoot(_4) || u2.isLeaf(_4)), S2 = u2.getPtId(_4), C2 = u2.isEntry(_4) ? u2.findEntryWithChild(b, S2) : u2.findEntryWithLevel(b, S2), E2 = u2.getPtId(C2), F13 = { points: [f(_4, T2, m.eventDataKeys)], event: n.event };
          A2 || (F13.nextLevel = E2);
          var N2 = l.triggerHandler(d, "plotly_" + x.type + "click", F13);
          if (N2 !== false && k.hovermode && (d._hoverdata = [f(_4, T2, m.eventDataKeys)], s.click(d, n.event)), !A2 && N2 !== false && !d._dragging && !d._transitioning) {
            a.call("_storeDirectGUIEdit", T2, k._tracePreGUI[T2.uid], { level: T2.level });
            var D2 = { data: [{ level: E2 }], traces: [x.index] }, I2 = { frame: { redraw: false, duration: m.transitionTime }, transition: { duration: m.transitionTime, easing: m.transitionEasing }, mode: "immediate", fromcurrent: true };
            s.loneUnhover(k._hoverlayer.node()), a.call("animate", d, D2, I2);
          }
        });
      };
    }, { "../../components/fx": 406, "../../components/fx/helpers": 402, "../../lib": 503, "../../lib/events": 492, "../../registry": 638, "../pie/helpers": 905, "./helpers": 1051, "@plotly/d3": 58 }], 1051: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../components/color"), o = e("../../lib/setcursor"), s = e("../pie/helpers");
      function i(l) {
        return l.data.data.pid;
      }
      r.findEntryWithLevel = function(l, u2) {
        var c;
        return u2 && l.eachAfter(function(f) {
          if (r.getPtId(f) === u2) return c = f.copy();
        }), c || l;
      }, r.findEntryWithChild = function(l, u2) {
        var c;
        return l.eachAfter(function(f) {
          for (var h = f.children || [], p = 0; p < h.length; p++) {
            var d = h[p];
            if (r.getPtId(d) === u2) return c = f.copy();
          }
        }), c || l;
      }, r.isEntry = function(l) {
        return !l.parent;
      }, r.isLeaf = function(l) {
        return !l.children;
      }, r.getPtId = function(l) {
        return l.data.data.id;
      }, r.getPtLabel = function(l) {
        return l.data.data.label;
      }, r.getValue = function(l) {
        return l.value;
      }, r.isHierarchyRoot = function(l) {
        return i(l) === "";
      }, r.setSliceCursor = function(l, u2, c) {
        var f = c.isTransitioning;
        if (!f) {
          var h = l.datum();
          f = c.hideOnRoot && r.isHierarchyRoot(h) || c.hideOnLeaves && r.isLeaf(h);
        }
        o(l, f ? null : "pointer");
      }, r.getInsideTextFontKey = function(l, u2, c, f, h) {
        var p = (h || {}).onPathbar ? "pathbar.textfont" : "insidetextfont", d = c.data.data.i;
        return n.castOption(u2, d, p + "." + l) || n.castOption(u2, d, "textfont." + l) || f.size;
      }, r.getOutsideTextFontKey = function(l, u2, c, f) {
        var h = c.data.data.i;
        return n.castOption(u2, h, "outsidetextfont." + l) || n.castOption(u2, h, "textfont." + l) || f.size;
      }, r.isOutsideText = function(l, u2) {
        return !l._hasColorscale && r.isHierarchyRoot(u2);
      }, r.determineTextFont = function(l, u2, c, f) {
        return r.isOutsideText(l, u2) ? function(h, p, d) {
          return { color: r.getOutsideTextFontKey("color", h, p, d), family: r.getOutsideTextFontKey("family", h, p, d), size: r.getOutsideTextFontKey("size", h, p, d) };
        }(l, u2, c) : function(h, p, d, v) {
          var m = (v || {}).onPathbar, g = p.data.data, x = g.i, b = n.castOption(h, x, (m ? "pathbar.textfont" : "insidetextfont") + ".color");
          return !b && h._input.textfont && (b = n.castOption(h._input, x, "textfont.color")), { color: b || a.contrast(g.color), family: r.getInsideTextFontKey("family", h, p, d, v), size: r.getInsideTextFontKey("size", h, p, d, v) };
        }(l, u2, c, f);
      }, r.hasTransition = function(l) {
        return !!(l && l.duration > 0);
      }, r.getMaxDepth = function(l) {
        return l.maxdepth >= 0 ? l.maxdepth : 1 / 0;
      }, r.isHeader = function(l, u2) {
        return !(r.isLeaf(l) || l.depth === u2._maxDepth - 1);
      }, r.getParent = function(l, u2) {
        return r.findEntryWithLevel(l, i(u2));
      }, r.listPath = function(l, u2) {
        var c = l.parent;
        if (!c) return [];
        var f = u2 ? [c.data[u2]] : [c];
        return r.listPath(c, u2).concat(f);
      }, r.getPath = function(l) {
        return r.listPath(l, "label").join("/") + "/";
      }, r.formatValue = s.formatPieValue, r.formatPercent = function(l, u2) {
        var c = n.formatPercent(l, 0);
        return c === "0%" && (c = s.formatPiePercent(l, u2)), c;
      };
    }, { "../../components/color": 366, "../../lib": 503, "../../lib/setcursor": 524, "../pie/helpers": 905 }], 1052: [function(e, t, r) {
      "use strict";
      t.exports = { moduleType: "trace", name: "sunburst", basePlotModule: e("./base_plot"), categories: [], animatable: true, attributes: e("./attributes"), layoutAttributes: e("./layout_attributes"), supplyDefaults: e("./defaults"), supplyLayoutDefaults: e("./layout_defaults"), calc: e("./calc").calc, crossTraceCalc: e("./calc").crossTraceCalc, plot: e("./plot").plot, style: e("./style").style, colorbar: e("../scatter/marker_colorbar"), meta: {} };
    }, { "../scatter/marker_colorbar": 944, "./attributes": 1045, "./base_plot": 1046, "./calc": 1047, "./defaults": 1049, "./layout_attributes": 1053, "./layout_defaults": 1054, "./plot": 1055, "./style": 1056 }], 1053: [function(e, t, r) {
      "use strict";
      t.exports = { sunburstcolorway: { valType: "colorlist", editType: "calc" }, extendsunburstcolors: { valType: "boolean", dflt: true, editType: "calc" } };
    }, {}], 1054: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("./layout_attributes");
      t.exports = function(o, s) {
        function i(l, u2) {
          return n.coerce(o, s, a, l, u2);
        }
        i("sunburstcolorway", s.colorway), i("extendsunburstcolors");
      };
    }, { "../../lib": 503, "./layout_attributes": 1053 }], 1055: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("d3-hierarchy"), o = e("d3-interpolate").interpolate, s = e("../../components/drawing"), i = e("../../lib"), l = e("../../lib/svg_text_utils"), u2 = e("../bar/uniform_text"), c = u2.recordMinTextSize, f = u2.clearMinTextSize, h = e("../pie/plot"), p = e("../pie/helpers").getRotationAngle, d = h.computeTransform, v = h.transformInsideText, m = e("./style").styleOne, g = e("../bar/style").resizeText, x = e("./fx"), b = e("./constants"), y = e("./helpers");
      function w(k, T2, A2, S2) {
        var C2 = k._fullLayout, E2 = !C2.uniformtext.mode && y.hasTransition(S2), F13 = n.select(A2).selectAll("g.slice"), N2 = T2[0], D2 = N2.trace, I2 = N2.hierarchy, O2 = y.findEntryWithLevel(I2, D2.level), L2 = y.getMaxDepth(D2), V2 = C2._size, W2 = D2.domain, X2 = V2.w * (W2.x[1] - W2.x[0]), Y2 = V2.h * (W2.y[1] - W2.y[0]), K2 = 0.5 * Math.min(X2, Y2), q = N2.cx = V2.l + V2.w * (W2.x[1] + W2.x[0]) / 2, re = N2.cy = V2.t + V2.h * (1 - W2.y[0]) - Y2 / 2;
        if (!O2) return F13.remove();
        var R2 = null, z = {};
        E2 && F13.each(function(Ae) {
          z[y.getPtId(Ae)] = { rpx0: Ae.rpx0, rpx1: Ae.rpx1, x0: Ae.x0, x1: Ae.x1, transform: Ae.transform }, !R2 && y.isEntry(Ae) && (R2 = Ae);
        });
        var H2 = function(Ae) {
          return a.partition().size([2 * Math.PI, Ae.height + 1])(Ae);
        }(O2).descendants(), te = O2.height + 1, j = 0, Q2 = L2;
        N2.hasMultipleRoots && y.isHierarchyRoot(O2) && (H2 = H2.slice(1), te -= 1, j = 1, Q2 += 1), H2 = H2.filter(function(Ae) {
          return Ae.y1 <= Q2;
        });
        var Z2 = p(D2.rotation);
        Z2 && H2.forEach(function(Ae) {
          Ae.x0 += Z2, Ae.x1 += Z2;
        });
        var ne = Math.min(te, L2), ae = function(Ae) {
          return (Ae - j) / ne * K2;
        }, ue = function(Ae, pe) {
          return [Ae * Math.cos(pe), -Ae * Math.sin(pe)];
        }, le = function(Ae) {
          return i.pathAnnulus(Ae.rpx0, Ae.rpx1, Ae.x0, Ae.x1, q, re);
        }, ce = function(Ae) {
          return q + _4(Ae)[0] * (Ae.transform.rCenter || 0) + (Ae.transform.x || 0);
        }, se = function(Ae) {
          return re + _4(Ae)[1] * (Ae.transform.rCenter || 0) + (Ae.transform.y || 0);
        };
        (F13 = F13.data(H2, y.getPtId)).enter().append("g").classed("slice", true), E2 ? F13.exit().transition().each(function() {
          var Ae = n.select(this);
          Ae.select("path.surface").transition().attrTween("d", function(pe) {
            var ve = function(Ee) {
              var Se, Ce = y.getPtId(Ee), Be = z[Ce], Ue = z[y.getPtId(O2)];
              if (Ue) {
                var Ke = (Ee.x1 > Ue.x1 ? 2 * Math.PI : 0) + Z2;
                Se = Ee.rpx1 < Ue.rpx1 ? { x0: Ee.x0, x1: Ee.x1, rpx0: 0, rpx1: 0 } : { x0: Ke, x1: Ke, rpx0: Ee.rpx0, rpx1: Ee.rpx1 };
              } else {
                var ct, We = y.getPtId(Ee.parent);
                F13.each(function(wt) {
                  if (y.getPtId(wt) === We) return ct = wt;
                });
                var Ze, it = ct.children;
                it.forEach(function(wt, Et) {
                  if (y.getPtId(wt) === Ce) return Ze = Et;
                });
                var ot = it.length, mt = o(ct.x0, ct.x1);
                Se = { rpx0: K2, rpx1: K2, x0: mt(Ze / ot), x1: mt((Ze + 1) / ot) };
              }
              return o(Be, Se);
            }(pe);
            return function(Ee) {
              return le(ve(Ee));
            };
          }), Ae.select("g.slicetext").attr("opacity", 0);
        }).remove() : F13.exit().remove(), F13.order();
        var he = null;
        if (E2 && R2) {
          var me = y.getPtId(R2);
          F13.each(function(Ae) {
            he === null && y.getPtId(Ae) === me && (he = Ae.x1);
          });
        }
        var we = F13;
        function be(Ae) {
          var pe = Ae.parent, ve = z[y.getPtId(pe)], Ee = {};
          if (ve) {
            var Se = pe.children, Ce = Se.indexOf(Ae), Be = Se.length, Ue = o(ve.x0, ve.x1);
            Ee.x0 = Ue(Ce / Be), Ee.x1 = Ue(Ce / Be);
          } else Ee.x0 = Ee.x1 = 0;
          return Ee;
        }
        E2 && (we = we.transition().each("end", function() {
          var Ae = n.select(this);
          y.setSliceCursor(Ae, k, { hideOnRoot: true, hideOnLeaves: true, isTransitioning: false });
        })), we.each(function(Ae) {
          var pe = n.select(this), ve = i.ensureSingle(pe, "path", "surface", function(Ke) {
            Ke.style("pointer-events", "all");
          });
          Ae.rpx0 = ae(Ae.y0), Ae.rpx1 = ae(Ae.y1), Ae.xmid = (Ae.x0 + Ae.x1) / 2, Ae.pxmid = ue(Ae.rpx1, Ae.xmid), Ae.midangle = -(Ae.xmid - Math.PI / 2), Ae.startangle = -(Ae.x0 - Math.PI / 2), Ae.stopangle = -(Ae.x1 - Math.PI / 2), Ae.halfangle = 0.5 * Math.min(i.angleDelta(Ae.x0, Ae.x1) || Math.PI, Math.PI), Ae.ring = 1 - Ae.rpx0 / Ae.rpx1, Ae.rInscribed = function(Ke) {
            return Ke.rpx0 === 0 && i.isFullCircle([Ke.x0, Ke.x1]) ? 1 : Math.max(0, Math.min(1 / (1 + 1 / Math.sin(Ke.halfangle)), Ke.ring / 2));
          }(Ae), E2 ? ve.transition().attrTween("d", function(Ke) {
            var ct = function(We) {
              var Ze, it = z[y.getPtId(We)], ot = { x0: We.x0, x1: We.x1, rpx0: We.rpx0, rpx1: We.rpx1 };
              if (it) Ze = it;
              else if (R2) if (We.parent) if (he) {
                var mt = (We.x1 > he ? 2 * Math.PI : 0) + Z2;
                Ze = { x0: mt, x1: mt };
              } else Ze = { rpx0: K2, rpx1: K2 }, i.extendFlat(Ze, be(We));
              else Ze = { rpx0: 0, rpx1: 0 };
              else Ze = { x0: Z2, x1: Z2 };
              return o(Ze, ot);
            }(Ke);
            return function(We) {
              return le(ct(We));
            };
          }) : ve.attr("d", le), pe.call(x, O2, k, T2, { eventDataKeys: b.eventDataKeys, transitionTime: b.CLICK_TRANSITION_TIME, transitionEasing: b.CLICK_TRANSITION_EASING }).call(y.setSliceCursor, k, { hideOnRoot: true, hideOnLeaves: true, isTransitioning: k._transitioning }), ve.call(m, Ae, D2);
          var Ee = i.ensureSingle(pe, "g", "slicetext"), Se = i.ensureSingle(Ee, "text", "", function(Ke) {
            Ke.attr("data-notex", 1);
          }), Ce = i.ensureUniformFontSize(k, y.determineTextFont(D2, Ae, C2.font));
          Se.text(r.formatSliceLabel(Ae, O2, D2, T2, C2)).classed("slicetext", true).attr("text-anchor", "middle").call(s.font, Ce).call(l.convertToTspans, k);
          var Be = s.bBox(Se.node());
          Ae.transform = v(Be, Ae, N2), Ae.transform.targetX = ce(Ae), Ae.transform.targetY = se(Ae);
          var Ue = function(Ke, ct) {
            var We = Ke.transform;
            return d(We, ct), We.fontSize = Ce.size, c(D2.type, We, C2), i.getTextTransform(We);
          };
          E2 ? Se.transition().attrTween("transform", function(Ke) {
            var ct = function(We) {
              var Ze, it = z[y.getPtId(We)], ot = We.transform;
              if (it) Ze = it;
              else if (Ze = { rpx1: We.rpx1, transform: { textPosAngle: ot.textPosAngle, scale: 0, rotate: ot.rotate, rCenter: ot.rCenter, x: ot.x, y: ot.y } }, R2) if (We.parent) if (he) {
                var mt = We.x1 > he ? 2 * Math.PI : 0;
                Ze.x0 = Ze.x1 = mt;
              } else i.extendFlat(Ze, be(We));
              else Ze.x0 = Ze.x1 = Z2;
              else Ze.x0 = Ze.x1 = Z2;
              var wt = o(Ze.transform.textPosAngle, We.transform.textPosAngle), Et = o(Ze.rpx1, We.rpx1), zt = o(Ze.x0, We.x0), Nt = o(Ze.x1, We.x1), yt = o(Ze.transform.scale, ot.scale), pt = o(Ze.transform.rotate, ot.rotate), Ot = ot.rCenter === 0 ? 3 : Ze.transform.rCenter === 0 ? 1 / 3 : 1, Jt = o(Ze.transform.rCenter, ot.rCenter);
              return function(tr) {
                var Ye = Et(tr), at = zt(tr), Ge = Nt(tr), st = function(Pe) {
                  return Jt(Math.pow(Pe, Ot));
                }(tr), Ie = { pxmid: ue(Ye, (at + Ge) / 2), rpx1: Ye, transform: { textPosAngle: wt(tr), rCenter: st, x: ot.x, y: ot.y } };
                return c(D2.type, ot, C2), { transform: { targetX: ce(Ie), targetY: se(Ie), scale: yt(tr), rotate: pt(tr), rCenter: st } };
              };
            }(Ke);
            return function(We) {
              return Ue(ct(We), Be);
            };
          }) : Se.attr("transform", Ue(Ae, Be));
        });
      }
      function _4(k) {
        return T2 = k.rpx1, A2 = k.transform.textPosAngle, [T2 * Math.sin(A2), -T2 * Math.cos(A2)];
        var T2, A2;
      }
      r.plot = function(k, T2, A2, S2) {
        var C2, E2, F13 = k._fullLayout, N2 = F13._sunburstlayer, D2 = !A2, I2 = !F13.uniformtext.mode && y.hasTransition(A2);
        f("sunburst", F13), (C2 = N2.selectAll("g.trace.sunburst").data(T2, function(O2) {
          return O2[0].trace.uid;
        })).enter().append("g").classed("trace", true).classed("sunburst", true).attr("stroke-linejoin", "round"), C2.order(), I2 ? (S2 && (E2 = S2()), n.transition().duration(A2.duration).ease(A2.easing).each("end", function() {
          E2 && E2();
        }).each("interrupt", function() {
          E2 && E2();
        }).each(function() {
          N2.selectAll("g.trace").each(function(O2) {
            w(k, O2, this, A2);
          });
        })) : (C2.each(function(O2) {
          w(k, O2, this, A2);
        }), F13.uniformtext.mode && g(k, F13._sunburstlayer.selectAll(".trace"), "sunburst")), D2 && C2.exit().remove();
      }, r.formatSliceLabel = function(k, T2, A2, S2, C2) {
        var E2 = A2.texttemplate, F13 = A2.textinfo;
        if (!(E2 || F13 && F13 !== "none")) return "";
        var N2 = C2.separators, D2 = S2[0], I2 = k.data.data, O2 = D2.hierarchy, L2 = y.isHierarchyRoot(k), V2 = y.getParent(O2, k), W2 = y.getValue(k);
        if (!E2) {
          var X2, Y2 = F13.split("+"), K2 = function(Z2) {
            return Y2.indexOf(Z2) !== -1;
          }, q = [];
          if (K2("label") && I2.label && q.push(I2.label), I2.hasOwnProperty("v") && K2("value") && q.push(y.formatValue(I2.v, N2)), !L2) {
            K2("current path") && q.push(y.getPath(k.data));
            var re = 0;
            K2("percent parent") && re++, K2("percent entry") && re++, K2("percent root") && re++;
            var R2 = re > 1;
            if (re) {
              var z, H2 = function(Z2) {
                X2 = y.formatPercent(z, N2), R2 && (X2 += " of " + Z2), q.push(X2);
              };
              K2("percent parent") && !L2 && (z = W2 / y.getValue(V2), H2("parent")), K2("percent entry") && (z = W2 / y.getValue(T2), H2("entry")), K2("percent root") && (z = W2 / y.getValue(O2), H2("root"));
            }
          }
          return K2("text") && (X2 = i.castOption(A2, I2.i, "text"), i.isValidTextValue(X2) && q.push(X2)), q.join("<br>");
        }
        var te = i.castOption(A2, I2.i, "texttemplate");
        if (!te) return "";
        var j = {};
        I2.label && (j.label = I2.label), I2.hasOwnProperty("v") && (j.value = I2.v, j.valueLabel = y.formatValue(I2.v, N2)), j.currentPath = y.getPath(k.data), L2 || (j.percentParent = W2 / y.getValue(V2), j.percentParentLabel = y.formatPercent(j.percentParent, N2), j.parent = y.getPtLabel(V2)), j.percentEntry = W2 / y.getValue(T2), j.percentEntryLabel = y.formatPercent(j.percentEntry, N2), j.entry = y.getPtLabel(T2), j.percentRoot = W2 / y.getValue(O2), j.percentRootLabel = y.formatPercent(j.percentRoot, N2), j.root = y.getPtLabel(O2), I2.hasOwnProperty("color") && (j.color = I2.color);
        var Q2 = i.castOption(A2, I2.i, "text");
        return (i.isValidTextValue(Q2) || Q2 === "") && (j.text = Q2), j.customdata = i.castOption(A2, I2.i, "customdata"), i.texttemplateString(te, j, C2._d3locale, j, A2._meta || {});
      };
    }, { "../../components/drawing": 388, "../../lib": 503, "../../lib/svg_text_utils": 529, "../bar/style": 662, "../bar/uniform_text": 664, "../pie/helpers": 905, "../pie/plot": 909, "./constants": 1048, "./fx": 1050, "./helpers": 1051, "./style": 1056, "@plotly/d3": 58, "d3-hierarchy": 115, "d3-interpolate": 116 }], 1056: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../components/color"), o = e("../../lib"), s = e("../bar/uniform_text").resizeText;
      function i(l, u2, c) {
        var f = u2.data.data, h = !u2.children, p = f.i, d = o.castOption(c, p, "marker.line.color") || a.defaultLine, v = o.castOption(c, p, "marker.line.width") || 0;
        l.style("stroke-width", v).call(a.fill, f.color).call(a.stroke, d).style("opacity", h ? c.leaf.opacity : null);
      }
      t.exports = { style: function(l) {
        var u2 = l._fullLayout._sunburstlayer.selectAll(".trace");
        s(l, u2, "sunburst"), u2.each(function(c) {
          var f = n.select(this), h = c[0].trace;
          f.style("opacity", h.opacity), f.selectAll("path.surface").each(function(p) {
            n.select(this).call(i, p, h);
          });
        });
      }, styleOne: i };
    }, { "../../components/color": 366, "../../lib": 503, "../bar/uniform_text": 664, "@plotly/d3": 58 }], 1057: [function(e, t, r) {
      "use strict";
      var n = e("../../components/color"), a = e("../../components/colorscale/attributes"), o = e("../../plots/cartesian/axis_format_attributes").axisHoverFormat, s = e("../../plots/template_attributes").hovertemplateAttrs, i = e("../../plots/attributes"), l = e("../../lib/extend").extendFlat, u2 = e("../../plot_api/edit_types").overrideAll;
      function c(h) {
        return { show: { valType: "boolean", dflt: false }, start: { valType: "number", dflt: null, editType: "plot" }, end: { valType: "number", dflt: null, editType: "plot" }, size: { valType: "number", dflt: null, min: 0, editType: "plot" }, project: { x: { valType: "boolean", dflt: false }, y: { valType: "boolean", dflt: false }, z: { valType: "boolean", dflt: false } }, color: { valType: "color", dflt: n.defaultLine }, usecolormap: { valType: "boolean", dflt: false }, width: { valType: "number", min: 1, max: 16, dflt: 2 }, highlight: { valType: "boolean", dflt: true }, highlightcolor: { valType: "color", dflt: n.defaultLine }, highlightwidth: { valType: "number", min: 1, max: 16, dflt: 2 } };
      }
      var f = t.exports = u2(l({ z: { valType: "data_array" }, x: { valType: "data_array" }, y: { valType: "data_array" }, text: { valType: "string", dflt: "", arrayOk: true }, hovertext: { valType: "string", dflt: "", arrayOk: true }, hovertemplate: s(), xhoverformat: o("x"), yhoverformat: o("y"), zhoverformat: o("z"), connectgaps: { valType: "boolean", dflt: false, editType: "calc" }, surfacecolor: { valType: "data_array" } }, a("", { colorAttr: "z or surfacecolor", showScaleDflt: true, autoColorDflt: false, editTypeOverride: "calc" }), { contours: { x: c(), y: c(), z: c() }, hidesurface: { valType: "boolean", dflt: false }, lightposition: { x: { valType: "number", min: -1e5, max: 1e5, dflt: 10 }, y: { valType: "number", min: -1e5, max: 1e5, dflt: 1e4 }, z: { valType: "number", min: -1e5, max: 1e5, dflt: 0 } }, lighting: { ambient: { valType: "number", min: 0, max: 1, dflt: 0.8 }, diffuse: { valType: "number", min: 0, max: 1, dflt: 0.8 }, specular: { valType: "number", min: 0, max: 2, dflt: 0.05 }, roughness: { valType: "number", min: 0, max: 1, dflt: 0.5 }, fresnel: { valType: "number", min: 0, max: 5, dflt: 0.2 } }, opacity: { valType: "number", min: 0, max: 1, dflt: 1 }, opacityscale: { valType: "any", editType: "calc" }, _deprecated: { zauto: l({}, a.zauto, {}), zmin: l({}, a.zmin, {}), zmax: l({}, a.zmax, {}) }, hoverinfo: l({}, i.hoverinfo), showlegend: l({}, i.showlegend, { dflt: false }) }), "calc", "nested");
      f.x.editType = f.y.editType = f.z.editType = "calc+clearAxisTypes", f.transforms = void 0;
    }, { "../../components/color": 366, "../../components/colorscale/attributes": 373, "../../lib/extend": 493, "../../plot_api/edit_types": 536, "../../plots/attributes": 550, "../../plots/cartesian/axis_format_attributes": 557, "../../plots/template_attributes": 633 }], 1058: [function(e, t, r) {
      "use strict";
      var n = e("../../components/colorscale/calc");
      t.exports = function(a, o) {
        o.surfacecolor ? n(a, o, { vals: o.surfacecolor, containerStr: "", cLetter: "c" }) : n(a, o, { vals: o.z, containerStr: "", cLetter: "c" });
      };
    }, { "../../components/colorscale/calc": 374 }], 1059: [function(e, t, r) {
      "use strict";
      var n = e("../../../stackgl_modules").gl_surface3d, a = e("../../../stackgl_modules").ndarray, o = e("../../../stackgl_modules").ndarray_linear_interpolate.d2, s = e("../heatmap/interp2d"), i = e("../heatmap/find_empties"), l = e("../../lib").isArrayOrTypedArray, u2 = e("../../lib/gl_format_color").parseColorScale, c = e("../../lib/str2rgbarray"), f = e("../../components/colorscale").extractOpts;
      function h(A2, S2, C2) {
        this.scene = A2, this.uid = C2, this.surface = S2, this.data = null, this.showContour = [false, false, false], this.contourStart = [null, null, null], this.contourEnd = [null, null, null], this.contourSize = [0, 0, 0], this.minValues = [1 / 0, 1 / 0, 1 / 0], this.maxValues = [-1 / 0, -1 / 0, -1 / 0], this.dataScaleX = 1, this.dataScaleY = 1, this.refineData = true, this.objectOffset = [0, 0, 0];
      }
      var p = h.prototype;
      p.getXat = function(A2, S2, C2, E2) {
        var F13 = l(this.data.x) ? l(this.data.x[0]) ? this.data.x[S2][A2] : this.data.x[A2] : A2;
        return C2 === void 0 ? F13 : E2.d2l(F13, 0, C2);
      }, p.getYat = function(A2, S2, C2, E2) {
        var F13 = l(this.data.y) ? l(this.data.y[0]) ? this.data.y[S2][A2] : this.data.y[S2] : S2;
        return C2 === void 0 ? F13 : E2.d2l(F13, 0, C2);
      }, p.getZat = function(A2, S2, C2, E2) {
        var F13 = this.data.z[S2][A2];
        return F13 === null && this.data.connectgaps && this.data._interpolatedZ && (F13 = this.data._interpolatedZ[S2][A2]), C2 === void 0 ? F13 : E2.d2l(F13, 0, C2);
      }, p.handlePick = function(A2) {
        if (A2.object === this.surface) {
          var S2 = (A2.data.index[0] - 1) / this.dataScaleX - 1, C2 = (A2.data.index[1] - 1) / this.dataScaleY - 1, E2 = Math.max(Math.min(Math.round(S2), this.data.z[0].length - 1), 0), F13 = Math.max(Math.min(Math.round(C2), this.data._ylength - 1), 0);
          A2.index = [E2, F13], A2.traceCoordinate = [this.getXat(E2, F13), this.getYat(E2, F13), this.getZat(E2, F13)], A2.dataCoordinate = [this.getXat(E2, F13, this.data.xcalendar, this.scene.fullSceneLayout.xaxis), this.getYat(E2, F13, this.data.ycalendar, this.scene.fullSceneLayout.yaxis), this.getZat(E2, F13, this.data.zcalendar, this.scene.fullSceneLayout.zaxis)];
          for (var N2 = 0; N2 < 3; N2++) {
            var D2 = A2.dataCoordinate[N2];
            D2 != null && (A2.dataCoordinate[N2] *= this.scene.dataScale[N2]);
          }
          var I2 = this.data.hovertext || this.data.text;
          return Array.isArray(I2) && I2[F13] && I2[F13][E2] !== void 0 ? A2.textLabel = I2[F13][E2] : A2.textLabel = I2 || "", A2.data.dataCoordinate = A2.dataCoordinate.slice(), this.surface.highlight(A2.data), this.scene.glplot.spikes.position = A2.dataCoordinate, true;
        }
      };
      var d = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733, 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811, 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973, 1979, 1987, 1993, 1997, 1999, 2003, 2011, 2017, 2027, 2029, 2039, 2053, 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129, 2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, 2221, 2237, 2239, 2243, 2251, 2267, 2269, 2273, 2281, 2287, 2293, 2297, 2309, 2311, 2333, 2339, 2341, 2347, 2351, 2357, 2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423, 2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503, 2521, 2531, 2539, 2543, 2549, 2551, 2557, 2579, 2591, 2593, 2609, 2617, 2621, 2633, 2647, 2657, 2659, 2663, 2671, 2677, 2683, 2687, 2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729, 2731, 2741, 2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801, 2803, 2819, 2833, 2837, 2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903, 2909, 2917, 2927, 2939, 2953, 2957, 2963, 2969, 2971, 2999];
      function v(A2, S2) {
        if (A2 < S2) return 0;
        for (var C2 = 0; Math.floor(A2 % S2) === 0; ) A2 /= S2, C2++;
        return C2;
      }
      function m(A2) {
        for (var S2 = [], C2 = 0; C2 < d.length; C2++) {
          var E2 = d[C2];
          S2.push(v(A2, E2));
        }
        return S2;
      }
      function g(A2) {
        for (var S2 = m(A2), C2 = A2, E2 = 0; E2 < d.length; E2++) if (S2[E2] > 0) {
          C2 = d[E2];
          break;
        }
        return C2;
      }
      function x(A2, S2) {
        if (!(A2 < 1 || S2 < 1)) {
          for (var C2 = m(A2), E2 = m(S2), F13 = 1, N2 = 0; N2 < d.length; N2++) F13 *= Math.pow(d[N2], Math.max(C2[N2], E2[N2]));
          return F13;
        }
      }
      p.calcXnums = function(A2) {
        var S2, C2 = [];
        for (S2 = 1; S2 < A2; S2++) {
          var E2 = this.getXat(S2 - 1, 0), F13 = this.getXat(S2, 0);
          C2[S2 - 1] = F13 !== E2 && E2 != null && F13 != null ? Math.abs(F13 - E2) : 0;
        }
        var N2 = 0;
        for (S2 = 1; S2 < A2; S2++) N2 += C2[S2 - 1];
        for (S2 = 1; S2 < A2; S2++) C2[S2 - 1] === 0 ? C2[S2 - 1] = 1 : C2[S2 - 1] = Math.round(N2 / C2[S2 - 1]);
        return C2;
      }, p.calcYnums = function(A2) {
        var S2, C2 = [];
        for (S2 = 1; S2 < A2; S2++) {
          var E2 = this.getYat(0, S2 - 1), F13 = this.getYat(0, S2);
          C2[S2 - 1] = F13 !== E2 && E2 != null && F13 != null ? Math.abs(F13 - E2) : 0;
        }
        var N2 = 0;
        for (S2 = 1; S2 < A2; S2++) N2 += C2[S2 - 1];
        for (S2 = 1; S2 < A2; S2++) C2[S2 - 1] === 0 ? C2[S2 - 1] = 1 : C2[S2 - 1] = Math.round(N2 / C2[S2 - 1]);
        return C2;
      };
      var b = [1, 2, 4, 6, 12, 24, 36, 48, 60, 120, 180, 240, 360, 720, 840, 1260], y = b[9], w = b[13];
      function _4(A2, S2, C2) {
        var E2 = C2[8] + C2[2] * S2[0] + C2[5] * S2[1];
        return A2[0] = (C2[6] + C2[0] * S2[0] + C2[3] * S2[1]) / E2, A2[1] = (C2[7] + C2[1] * S2[0] + C2[4] * S2[1]) / E2, A2;
      }
      function k(A2, S2, C2) {
        return function(E2, F13, N2, D2) {
          for (var I2 = [0, 0], O2 = E2.shape[0], L2 = E2.shape[1], V2 = 0; V2 < O2; V2++) for (var W2 = 0; W2 < L2; W2++) N2(I2, [V2, W2], D2), E2.set(V2, W2, o(F13, I2[0], I2[1]));
        }(A2, S2, _4, C2), A2;
      }
      function T2(A2, S2) {
        for (var C2 = false, E2 = 0; E2 < A2.length; E2++) if (S2 === A2[E2]) {
          C2 = true;
          break;
        }
        C2 === false && A2.push(S2);
      }
      p.estimateScale = function(A2, S2) {
        for (var C2 = 1 + function(F13) {
          if (F13.length !== 0) {
            for (var N2 = 1, D2 = 0; D2 < F13.length; D2++) N2 = x(N2, F13[D2]);
            return N2;
          }
        }(S2 === 0 ? this.calcXnums(A2) : this.calcYnums(A2)); C2 < y; ) C2 *= 2;
        for (; C2 > w; ) C2--, C2 /= g(C2), ++C2 < y && (C2 = w);
        var E2 = Math.round(C2 / A2);
        return E2 > 1 ? E2 : 1;
      }, p.refineCoords = function(A2) {
        for (var S2 = this.dataScaleX, C2 = this.dataScaleY, E2 = A2[0].shape[0], F13 = A2[0].shape[1], N2 = 0 | Math.floor(A2[0].shape[0] * S2 + 1), D2 = 0 | Math.floor(A2[0].shape[1] * C2 + 1), I2 = 1 + E2 + 1, O2 = 1 + F13 + 1, L2 = a(new Float32Array(I2 * O2), [I2, O2]), V2 = [1 / S2, 0, 0, 0, 1 / C2, 0, 0, 0, 1], W2 = 0; W2 < A2.length; ++W2) {
          this.surface.padField(L2, A2[W2]);
          var X2 = a(new Float32Array(N2 * D2), [N2, D2]);
          k(X2, L2, V2), A2[W2] = X2;
        }
      }, p.setContourLevels = function() {
        var A2, S2, C2, E2 = [[], [], []], F13 = [false, false, false], N2 = false;
        for (A2 = 0; A2 < 3; ++A2) if (this.showContour[A2] && (N2 = true, this.contourSize[A2] > 0 && this.contourStart[A2] !== null && this.contourEnd[A2] !== null && this.contourEnd[A2] > this.contourStart[A2])) for (F13[A2] = true, S2 = this.contourStart[A2]; S2 < this.contourEnd[A2]; S2 += this.contourSize[A2]) C2 = S2 * this.scene.dataScale[A2], T2(E2[A2], C2);
        if (N2) {
          var D2 = [[], [], []];
          for (A2 = 0; A2 < 3; ++A2) this.showContour[A2] && (D2[A2] = F13[A2] ? E2[A2] : this.scene.contourLevels[A2]);
          this.surface.update({ levels: D2 });
        }
      }, p.update = function(A2) {
        var S2, C2, E2, F13, N2 = this.scene, D2 = N2.fullSceneLayout, I2 = this.surface, O2 = u2(A2), L2 = N2.dataScale, V2 = A2.z[0].length, W2 = A2._ylength, X2 = N2.contourLevels;
        this.data = A2;
        var Y2 = [];
        for (S2 = 0; S2 < 3; S2++) for (Y2[S2] = [], C2 = 0; C2 < V2; C2++) Y2[S2][C2] = [];
        for (C2 = 0; C2 < V2; C2++) for (E2 = 0; E2 < W2; E2++) Y2[0][C2][E2] = this.getXat(C2, E2, A2.xcalendar, D2.xaxis), Y2[1][C2][E2] = this.getYat(C2, E2, A2.ycalendar, D2.yaxis), Y2[2][C2][E2] = this.getZat(C2, E2, A2.zcalendar, D2.zaxis);
        if (A2.connectgaps) for (A2._emptypoints = i(Y2[2]), s(Y2[2], A2._emptypoints), A2._interpolatedZ = [], C2 = 0; C2 < V2; C2++) for (A2._interpolatedZ[C2] = [], E2 = 0; E2 < W2; E2++) A2._interpolatedZ[C2][E2] = Y2[2][C2][E2];
        for (S2 = 0; S2 < 3; S2++) for (C2 = 0; C2 < V2; C2++) for (E2 = 0; E2 < W2; E2++) (F13 = Y2[S2][C2][E2]) == null ? Y2[S2][C2][E2] = NaN : F13 = Y2[S2][C2][E2] *= L2[S2];
        for (S2 = 0; S2 < 3; S2++) for (C2 = 0; C2 < V2; C2++) for (E2 = 0; E2 < W2; E2++) (F13 = Y2[S2][C2][E2]) != null && (this.minValues[S2] > F13 && (this.minValues[S2] = F13), this.maxValues[S2] < F13 && (this.maxValues[S2] = F13));
        for (S2 = 0; S2 < 3; S2++) this.objectOffset[S2] = 0.5 * (this.minValues[S2] + this.maxValues[S2]);
        for (S2 = 0; S2 < 3; S2++) for (C2 = 0; C2 < V2; C2++) for (E2 = 0; E2 < W2; E2++) (F13 = Y2[S2][C2][E2]) != null && (Y2[S2][C2][E2] -= this.objectOffset[S2]);
        var K2 = [a(new Float32Array(V2 * W2), [V2, W2]), a(new Float32Array(V2 * W2), [V2, W2]), a(new Float32Array(V2 * W2), [V2, W2])];
        for (S2 = 0; S2 < 3; S2++) for (C2 = 0; C2 < V2; C2++) for (E2 = 0; E2 < W2; E2++) K2[S2].set(C2, E2, Y2[S2][C2][E2]);
        Y2 = [];
        var q = { colormap: O2, levels: [[], [], []], showContour: [true, true, true], showSurface: !A2.hidesurface, contourProject: [[false, false, false], [false, false, false], [false, false, false]], contourWidth: [1, 1, 1], contourColor: [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]], contourTint: [1, 1, 1], dynamicColor: [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]], dynamicWidth: [1, 1, 1], dynamicTint: [1, 1, 1], opacityscale: A2.opacityscale, opacity: A2.opacity }, re = f(A2);
        if (q.intensityBounds = [re.min, re.max], A2.surfacecolor) {
          var R2 = a(new Float32Array(V2 * W2), [V2, W2]);
          for (C2 = 0; C2 < V2; C2++) for (E2 = 0; E2 < W2; E2++) R2.set(C2, E2, A2.surfacecolor[E2][C2]);
          K2.push(R2);
        } else q.intensityBounds[0] *= L2[2], q.intensityBounds[1] *= L2[2];
        (w < K2[0].shape[0] || w < K2[0].shape[1]) && (this.refineData = false), this.refineData === true && (this.dataScaleX = this.estimateScale(K2[0].shape[0], 0), this.dataScaleY = this.estimateScale(K2[0].shape[1], 1), this.dataScaleX === 1 && this.dataScaleY === 1 || this.refineCoords(K2)), A2.surfacecolor && (q.intensity = K2.pop());
        var z = [true, true, true], H2 = ["x", "y", "z"];
        for (S2 = 0; S2 < 3; ++S2) {
          var te = A2.contours[H2[S2]];
          z[S2] = te.highlight, q.showContour[S2] = te.show || te.highlight, q.showContour[S2] && (q.contourProject[S2] = [te.project.x, te.project.y, te.project.z], te.show ? (this.showContour[S2] = true, q.levels[S2] = X2[S2], I2.highlightColor[S2] = q.contourColor[S2] = c(te.color), te.usecolormap ? I2.highlightTint[S2] = q.contourTint[S2] = 0 : I2.highlightTint[S2] = q.contourTint[S2] = 1, q.contourWidth[S2] = te.width, this.contourStart[S2] = te.start, this.contourEnd[S2] = te.end, this.contourSize[S2] = te.size) : (this.showContour[S2] = false, this.contourStart[S2] = null, this.contourEnd[S2] = null, this.contourSize[S2] = 0), te.highlight && (q.dynamicColor[S2] = c(te.highlightcolor), q.dynamicWidth[S2] = te.highlightwidth));
        }
        (function(j) {
          var Q2 = j[0].rgb, Z2 = j[j.length - 1].rgb;
          return Q2[0] === Z2[0] && Q2[1] === Z2[1] && Q2[2] === Z2[2] && Q2[3] === Z2[3];
        })(O2) && (q.vertexColor = true), q.objectOffset = this.objectOffset, q.coords = K2, I2.update(q), I2.visible = A2.visible, I2.enableDynamic = z, I2.enableHighlight = z, I2.snapToData = true, "lighting" in A2 && (I2.ambientLight = A2.lighting.ambient, I2.diffuseLight = A2.lighting.diffuse, I2.specularLight = A2.lighting.specular, I2.roughness = A2.lighting.roughness, I2.fresnel = A2.lighting.fresnel), "lightposition" in A2 && (I2.lightPosition = [A2.lightposition.x, A2.lightposition.y, A2.lightposition.z]);
      }, p.dispose = function() {
        this.scene.glplot.remove(this.surface), this.surface.dispose();
      }, t.exports = function(A2, S2) {
        var C2 = A2.glplot.gl, E2 = n({ gl: C2 }), F13 = new h(A2, E2, S2.uid);
        return E2._trace = F13, F13.update(S2), A2.glplot.add(E2), F13;
      };
    }, { "../../../stackgl_modules": 1120, "../../components/colorscale": 378, "../../lib": 503, "../../lib/gl_format_color": 499, "../../lib/str2rgbarray": 528, "../heatmap/find_empties": 798, "../heatmap/interp2d": 801 }], 1060: [function(e, t, r) {
      "use strict";
      var n = e("../../registry"), a = e("../../lib"), o = e("../../components/colorscale/defaults"), s = e("./attributes");
      function i(u2, c, f, h) {
        var p = h("opacityscale");
        p === "max" ? c.opacityscale = [[0, 0.1], [1, 1]] : p === "min" ? c.opacityscale = [[0, 1], [1, 0.1]] : p === "extremes" ? c.opacityscale = function(d, v) {
          for (var m = [], g = 0; g < 32; g++) {
            var x = g / 31, b = v + (1 - v) * (1 - Math.pow(Math.sin(d * x * Math.PI), 2));
            m.push([x, Math.max(0, Math.min(1, b))]);
          }
          return m;
        }(1, 0.1) : function(d) {
          var v = 0;
          if (!Array.isArray(d) || d.length < 2 || !d[0] || !d[d.length - 1] || +d[0][0] != 0 || +d[d.length - 1][0] != 1) return false;
          for (var m = 0; m < d.length; m++) {
            var g = d[m];
            if (g.length !== 2 || +g[0] < v) return false;
            v = +g[0];
          }
          return true;
        }(p) || (c.opacityscale = void 0);
      }
      function l(u2, c, f) {
        c in u2 && !(f in u2) && (u2[f] = u2[c]);
      }
      t.exports = { supplyDefaults: function(u2, c, f, h) {
        var p, d;
        function v(T2, A2) {
          return a.coerce(u2, c, s, T2, A2);
        }
        var m = v("x"), g = v("y"), x = v("z");
        if (!x || !x.length || m && m.length < 1 || g && g.length < 1) c.visible = false;
        else {
          c._xlength = Array.isArray(m) && a.isArrayOrTypedArray(m[0]) ? x.length : x[0].length, c._ylength = x.length, n.getComponentMethod("calendars", "handleTraceDefaults")(u2, c, ["x", "y", "z"], h), v("text"), v("hovertext"), v("hovertemplate"), v("xhoverformat"), v("yhoverformat"), v("zhoverformat"), ["lighting.ambient", "lighting.diffuse", "lighting.specular", "lighting.roughness", "lighting.fresnel", "lightposition.x", "lightposition.y", "lightposition.z", "hidesurface", "connectgaps", "opacity"].forEach(function(T2) {
            v(T2);
          });
          var b = v("surfacecolor"), y = ["x", "y", "z"];
          for (p = 0; p < 3; ++p) {
            var w = "contours." + y[p], _4 = v(w + ".show"), k = v(w + ".highlight");
            if (_4 || k) for (d = 0; d < 3; ++d) v(w + ".project." + y[d]);
            _4 && (v(w + ".color"), v(w + ".width"), v(w + ".usecolormap")), k && (v(w + ".highlightcolor"), v(w + ".highlightwidth")), v(w + ".start"), v(w + ".end"), v(w + ".size");
          }
          b || (l(u2, "zmin", "cmin"), l(u2, "zmax", "cmax"), l(u2, "zauto", "cauto")), o(u2, c, h, v, { prefix: "", cLetter: "c" }), i(u2, c, h, v), c._length = null;
        }
      }, opacityscaleDefaults: i };
    }, { "../../components/colorscale/defaults": 376, "../../lib": 503, "../../registry": 638, "./attributes": 1057 }], 1061: [function(e, t, r) {
      "use strict";
      t.exports = { attributes: e("./attributes"), supplyDefaults: e("./defaults").supplyDefaults, colorbar: { min: "cmin", max: "cmax" }, calc: e("./calc"), plot: e("./convert"), moduleType: "trace", name: "surface", basePlotModule: e("../../plots/gl3d"), categories: ["gl3d", "2dMap", "showLegend"], meta: {} };
    }, { "../../plots/gl3d": 598, "./attributes": 1057, "./calc": 1058, "./convert": 1059, "./defaults": 1060 }], 1062: [function(e, t, r) {
      "use strict";
      var n = e("../../components/annotations/attributes"), a = e("../../lib/extend").extendFlat, o = e("../../plot_api/edit_types").overrideAll, s = e("../../plots/font_attributes"), i = e("../../plots/domain").attributes, l = e("../../plots/cartesian/axis_format_attributes").descriptionOnlyNumbers;
      (t.exports = o({ domain: i({ name: "table", trace: true }), columnwidth: { valType: "number", arrayOk: true, dflt: null }, columnorder: { valType: "data_array" }, header: { values: { valType: "data_array", dflt: [] }, format: { valType: "data_array", dflt: [], description: l("cell value") }, prefix: { valType: "string", arrayOk: true, dflt: null }, suffix: { valType: "string", arrayOk: true, dflt: null }, height: { valType: "number", dflt: 28 }, align: a({}, n.align, { arrayOk: true }), line: { width: { valType: "number", arrayOk: true, dflt: 1 }, color: { valType: "color", arrayOk: true, dflt: "grey" } }, fill: { color: { valType: "color", arrayOk: true, dflt: "white" } }, font: a({}, s({ arrayOk: true })) }, cells: { values: { valType: "data_array", dflt: [] }, format: { valType: "data_array", dflt: [], description: l("cell value") }, prefix: { valType: "string", arrayOk: true, dflt: null }, suffix: { valType: "string", arrayOk: true, dflt: null }, height: { valType: "number", dflt: 20 }, align: a({}, n.align, { arrayOk: true }), line: { width: { valType: "number", arrayOk: true, dflt: 1 }, color: { valType: "color", arrayOk: true, dflt: "grey" } }, fill: { color: { valType: "color", arrayOk: true, dflt: "white" } }, font: a({}, s({ arrayOk: true })) } }, "calc", "from-root")).transforms = void 0;
    }, { "../../components/annotations/attributes": 349, "../../lib/extend": 493, "../../plot_api/edit_types": 536, "../../plots/cartesian/axis_format_attributes": 557, "../../plots/domain": 584, "../../plots/font_attributes": 585 }], 1063: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/get_data").getModuleCalcData, a = e("./plot");
      r.name = "table", r.plot = function(o) {
        var s = n(o.calcdata, "table")[0];
        s.length && a(o, s);
      }, r.clean = function(o, s, i, l) {
        var u2 = l._has && l._has("table"), c = s._has && s._has("table");
        u2 && !c && l._paperdiv.selectAll(".table").remove();
      };
    }, { "../../plots/get_data": 593, "./plot": 1070 }], 1064: [function(e, t, r) {
      "use strict";
      var n = e("../../lib/gup").wrap;
      t.exports = function() {
        return n({});
      };
    }, { "../../lib/gup": 500 }], 1065: [function(e, t, r) {
      "use strict";
      t.exports = { cellPad: 8, columnExtentOffset: 10, columnTitleOffset: 28, emptyHeaderHeight: 16, latexCheck: /^\$.*\$$/, goldenRatio: 1.618, lineBreaker: "<br>", maxDimensionCount: 60, overdrag: 45, releaseTransitionDuration: 120, releaseTransitionEase: "cubic-out", scrollbarCaptureWidth: 18, scrollbarHideDelay: 1e3, scrollbarHideDuration: 1e3, scrollbarOffset: 5, scrollbarWidth: 8, transitionDuration: 100, transitionEase: "cubic-out", uplift: 5, wrapSpacer: " ", wrapSplitCharacter: " ", cn: { table: "table", tableControlView: "table-control-view", scrollBackground: "scroll-background", yColumn: "y-column", columnBlock: "column-block", scrollAreaClip: "scroll-area-clip", scrollAreaClipRect: "scroll-area-clip-rect", columnBoundary: "column-boundary", columnBoundaryClippath: "column-boundary-clippath", columnBoundaryRect: "column-boundary-rect", columnCells: "column-cells", columnCell: "column-cell", cellRect: "cell-rect", cellText: "cell-text", cellTextHolder: "cell-text-holder", scrollbarKit: "scrollbar-kit", scrollbar: "scrollbar", scrollbarSlider: "scrollbar-slider", scrollbarGlyph: "scrollbar-glyph", scrollbarCaptureZone: "scrollbar-capture-zone" } };
    }, {}], 1066: [function(e, t, r) {
      "use strict";
      var n = e("./constants"), a = e("../../lib/extend").extendFlat, o = e("fast-isnumeric");
      function s(p) {
        if (Array.isArray(p)) {
          for (var d = 0, v = 0; v < p.length; v++) d = Math.max(d, s(p[v]));
          return d;
        }
        return p;
      }
      function i(p, d) {
        return p + d;
      }
      function l(p) {
        var d, v = p.slice(), m = 1 / 0, g = 0;
        for (d = 0; d < v.length; d++) Array.isArray(v[d]) || (v[d] = [v[d]]), m = Math.min(m, v[d].length), g = Math.max(g, v[d].length);
        if (m !== g) for (d = 0; d < v.length; d++) {
          var x = g - v[d].length;
          x && (v[d] = v[d].concat(u2(x)));
        }
        return v;
      }
      function u2(p) {
        for (var d = new Array(p), v = 0; v < p; v++) d[v] = "";
        return d;
      }
      function c(p) {
        return p.calcdata.columns.reduce(function(d, v) {
          return v.xIndex < p.xIndex ? d + v.columnWidth : d;
        }, 0);
      }
      function f(p, d) {
        return Object.keys(p).map(function(v) {
          return a({}, p[v], { auxiliaryBlocks: d });
        });
      }
      function h(p, d) {
        for (var v, m = {}, g = 0, x = 0, b = { firstRowIndex: null, lastRowIndex: null, rows: [] }, y = 0, w = 0, _4 = 0; _4 < p.length; _4++) v = p[_4], b.rows.push({ rowIndex: _4, rowHeight: v }), ((x += v) >= d || _4 === p.length - 1) && (m[g] = b, b.key = w++, b.firstRowIndex = y, b.lastRowIndex = _4, b = { firstRowIndex: null, lastRowIndex: null, rows: [] }, g += x, y = _4 + 1, x = 0);
        return m;
      }
      t.exports = function(p, d) {
        var v = l(d.cells.values), m = function(L2) {
          return L2.slice(d.header.values.length, L2.length);
        }, g = l(d.header.values);
        g.length && !g[0].length && (g[0] = [""], g = l(g));
        var x = g.concat(m(v).map(function() {
          return u2((g[0] || [""]).length);
        })), b = d.domain, y = Math.floor(p._fullLayout._size.w * (b.x[1] - b.x[0])), w = Math.floor(p._fullLayout._size.h * (b.y[1] - b.y[0])), _4 = d.header.values.length ? x[0].map(function() {
          return d.header.height;
        }) : [n.emptyHeaderHeight], k = v.length ? v[0].map(function() {
          return d.cells.height;
        }) : [], T2 = _4.reduce(i, 0), A2 = h(k, w - T2 + n.uplift), S2 = f(h(_4, T2), []), C2 = f(A2, S2), E2 = {}, F13 = d._fullInput.columnorder.concat(m(v.map(function(L2, V2) {
          return V2;
        }))), N2 = x.map(function(L2, V2) {
          var W2 = Array.isArray(d.columnwidth) ? d.columnwidth[Math.min(V2, d.columnwidth.length - 1)] : d.columnwidth;
          return o(W2) ? Number(W2) : 1;
        }), D2 = N2.reduce(i, 0);
        N2 = N2.map(function(L2) {
          return L2 / D2 * y;
        });
        var I2 = Math.max(s(d.header.line.width), s(d.cells.line.width)), O2 = { key: d.uid + p._context.staticPlot, translateX: b.x[0] * p._fullLayout._size.w, translateY: p._fullLayout._size.h * (1 - b.y[1]), size: p._fullLayout._size, width: y, maxLineWidth: I2, height: w, columnOrder: F13, groupHeight: w, rowBlocks: C2, headerRowBlocks: S2, scrollY: 0, cells: a({}, d.cells, { values: v }), headerCells: a({}, d.header, { values: x }), gdColumns: x.map(function(L2) {
          return L2[0];
        }), gdColumnsOriginalOrder: x.map(function(L2) {
          return L2[0];
        }), prevPages: [0, 0], scrollbarState: { scrollbarScrollInProgress: false }, columns: x.map(function(L2, V2) {
          var W2 = E2[L2];
          return E2[L2] = (W2 || 0) + 1, { key: L2 + "__" + E2[L2], label: L2, specIndex: V2, xIndex: F13[V2], xScale: c, x: void 0, calcdata: void 0, columnWidth: N2[V2] };
        }) };
        return O2.columns.forEach(function(L2) {
          L2.calcdata = O2, L2.x = c(L2);
        }), O2;
      };
    }, { "../../lib/extend": 493, "./constants": 1065, "fast-isnumeric": 190 }], 1067: [function(e, t, r) {
      "use strict";
      var n = e("../../lib/extend").extendFlat;
      r.splitToPanels = function(a) {
        var o = [0, 0], s = n({}, a, { key: "header", type: "header", page: 0, prevPages: o, currentRepaint: [null, null], dragHandle: true, values: a.calcdata.headerCells.values[a.specIndex], rowBlocks: a.calcdata.headerRowBlocks, calcdata: n({}, a.calcdata, { cells: a.calcdata.headerCells }) });
        return [n({}, a, { key: "cells1", type: "cells", page: 0, prevPages: o, currentRepaint: [null, null], dragHandle: false, values: a.calcdata.cells.values[a.specIndex], rowBlocks: a.calcdata.rowBlocks }), n({}, a, { key: "cells2", type: "cells", page: 1, prevPages: o, currentRepaint: [null, null], dragHandle: false, values: a.calcdata.cells.values[a.specIndex], rowBlocks: a.calcdata.rowBlocks }), s];
      }, r.splitToCells = function(a) {
        var o = function(s) {
          var i = s.rowBlocks[s.page], l = i ? i.rows[0].rowIndex : 0, u2 = i ? l + i.rows.length : 0;
          return [l, u2];
        }(a);
        return (a.values || []).slice(o[0], o[1]).map(function(s, i) {
          return { keyWithinBlock: i + (typeof s == "string" && s.match(/[<$&> ]/) ? "_keybuster_" + Math.random() : ""), key: o[0] + i, column: a, calcdata: a.calcdata, page: a.page, rowBlocks: a.rowBlocks, value: s };
        });
      };
    }, { "../../lib/extend": 493 }], 1068: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("./attributes"), o = e("../../plots/domain").defaults;
      t.exports = function(s, i, l, u2) {
        function c(f, h) {
          return n.coerce(s, i, a, f, h);
        }
        o(i, u2, c), c("columnwidth"), c("header.values"), c("header.format"), c("header.align"), c("header.prefix"), c("header.suffix"), c("header.height"), c("header.line.width"), c("header.line.color"), c("header.fill.color"), n.coerceFont(c, "header.font", n.extendFlat({}, u2.font)), function(f, h) {
          for (var p = f.columnorder || [], d = f.header.values.length, v = p.slice(0, d), m = v.slice().sort(function(b, y) {
            return b - y;
          }), g = v.map(function(b) {
            return m.indexOf(b);
          }), x = g.length; x < d; x++) g.push(x);
          h("columnorder", g);
        }(i, c), c("cells.values"), c("cells.format"), c("cells.align"), c("cells.prefix"), c("cells.suffix"), c("cells.height"), c("cells.line.width"), c("cells.line.color"), c("cells.fill.color"), n.coerceFont(c, "cells.font", n.extendFlat({}, u2.font)), i._length = null;
      };
    }, { "../../lib": 503, "../../plots/domain": 584, "./attributes": 1062 }], 1069: [function(e, t, r) {
      "use strict";
      t.exports = { attributes: e("./attributes"), supplyDefaults: e("./defaults"), calc: e("./calc"), plot: e("./plot"), moduleType: "trace", name: "table", basePlotModule: e("./base_plot"), categories: ["noOpacity"], meta: {} };
    }, { "./attributes": 1062, "./base_plot": 1063, "./calc": 1064, "./defaults": 1068, "./plot": 1070 }], 1070: [function(e, t, r) {
      "use strict";
      var n = e("./constants"), a = e("@plotly/d3"), o = e("../../lib").numberFormat, s = e("../../lib/gup"), i = e("../../components/drawing"), l = e("../../lib/svg_text_utils"), u2 = e("../../lib").raiseToTop, c = e("../../lib").strTranslate, f = e("../../lib").cancelTransition, h = e("./data_preparation_helper"), p = e("./data_split_helpers"), d = e("../../components/color");
      function v(K2) {
        return Math.ceil(K2.calcdata.maxLineWidth / 2);
      }
      function m(K2, q) {
        return "clip" + K2._fullLayout._uid + "_scrollAreaBottomClip_" + q.key;
      }
      function g(K2, q) {
        return "clip" + K2._fullLayout._uid + "_columnBoundaryClippath_" + q.calcdata.key + "_" + q.specIndex;
      }
      function x(K2) {
        return [].concat.apply([], K2.map(function(q) {
          return q;
        })).map(function(q) {
          return q.__data__;
        });
      }
      function b(K2, q, re) {
        var R2 = K2.selectAll("." + n.cn.scrollbarKit).data(s.repeat, s.keyFun);
        R2.enter().append("g").classed(n.cn.scrollbarKit, true).style("shape-rendering", "geometricPrecision"), R2.each(function(Q2) {
          var Z2 = Q2.scrollbarState;
          Z2.totalHeight = function(ne) {
            var ae = ne.rowBlocks;
            return V2(ae, ae.length - 1) + (ae.length ? W2(ae[ae.length - 1], 1 / 0) : 1);
          }(Q2), Z2.scrollableAreaHeight = Q2.groupHeight - C2(Q2), Z2.currentlyVisibleHeight = Math.min(Z2.totalHeight, Z2.scrollableAreaHeight), Z2.ratio = Z2.currentlyVisibleHeight / Z2.totalHeight, Z2.barLength = Math.max(Z2.ratio * Z2.currentlyVisibleHeight, n.goldenRatio * n.scrollbarWidth), Z2.barWiggleRoom = Z2.currentlyVisibleHeight - Z2.barLength, Z2.wiggleRoom = Math.max(0, Z2.totalHeight - Z2.scrollableAreaHeight), Z2.topY = Z2.barWiggleRoom === 0 ? 0 : Q2.scrollY / Z2.wiggleRoom * Z2.barWiggleRoom, Z2.bottomY = Z2.topY + Z2.barLength, Z2.dragMultiplier = Z2.wiggleRoom / Z2.barWiggleRoom;
        }).attr("transform", function(Q2) {
          var Z2 = Q2.width + n.scrollbarWidth / 2 + n.scrollbarOffset;
          return c(Z2, C2(Q2));
        });
        var z = R2.selectAll("." + n.cn.scrollbar).data(s.repeat, s.keyFun);
        z.enter().append("g").classed(n.cn.scrollbar, true);
        var H2 = z.selectAll("." + n.cn.scrollbarSlider).data(s.repeat, s.keyFun);
        H2.enter().append("g").classed(n.cn.scrollbarSlider, true), H2.attr("transform", function(Q2) {
          return c(0, Q2.scrollbarState.topY || 0);
        });
        var te = H2.selectAll("." + n.cn.scrollbarGlyph).data(s.repeat, s.keyFun);
        te.enter().append("line").classed(n.cn.scrollbarGlyph, true).attr("stroke", "black").attr("stroke-width", n.scrollbarWidth).attr("stroke-linecap", "round").attr("y1", n.scrollbarWidth / 2), te.attr("y2", function(Q2) {
          return Q2.scrollbarState.barLength - n.scrollbarWidth / 2;
        }).attr("stroke-opacity", function(Q2) {
          return Q2.columnDragInProgress || !Q2.scrollbarState.barWiggleRoom || re ? 0 : 0.4;
        }), te.transition().delay(0).duration(0), te.transition().delay(n.scrollbarHideDelay).duration(n.scrollbarHideDuration).attr("stroke-opacity", 0);
        var j = z.selectAll("." + n.cn.scrollbarCaptureZone).data(s.repeat, s.keyFun);
        j.enter().append("line").classed(n.cn.scrollbarCaptureZone, true).attr("stroke", "white").attr("stroke-opacity", 0.01).attr("stroke-width", n.scrollbarCaptureWidth).attr("stroke-linecap", "butt").attr("y1", 0).on("mousedown", function(Q2) {
          var Z2 = a.event.y, ne = this.getBoundingClientRect(), ae = Q2.scrollbarState, ue = Z2 - ne.top, le = a.scale.linear().domain([0, ae.scrollableAreaHeight]).range([0, ae.totalHeight]).clamp(true);
          ae.topY <= ue && ue <= ae.bottomY || F13(q, K2, null, le(ue - ae.barLength / 2))(Q2);
        }).call(a.behavior.drag().origin(function(Q2) {
          return a.event.stopPropagation(), Q2.scrollbarState.scrollbarScrollInProgress = true, Q2;
        }).on("drag", F13(q, K2)).on("dragend", function() {
        })), j.attr("y2", function(Q2) {
          return Q2.scrollbarState.scrollableAreaHeight;
        }), q._context.staticPlot && (te.remove(), j.remove());
      }
      function y(K2, q, re, R2) {
        var z = function(te) {
          var j = te.selectAll("." + n.cn.columnCell).data(p.splitToCells, function(Q2) {
            return Q2.keyWithinBlock;
          });
          return j.enter().append("g").classed(n.cn.columnCell, true), j.exit().remove(), j;
        }(function(te) {
          var j = te.selectAll("." + n.cn.columnCells).data(s.repeat, s.keyFun);
          return j.enter().append("g").classed(n.cn.columnCells, true), j.exit().remove(), j;
        }(re));
        (function(te) {
          te.each(function(j, Q2) {
            var Z2 = j.calcdata.cells.font, ne = j.column.specIndex, ae = { size: k(Z2.size, ne, Q2), color: k(Z2.color, ne, Q2), family: k(Z2.family, ne, Q2) };
            j.rowNumber = j.key, j.align = k(j.calcdata.cells.align, ne, Q2), j.cellBorderWidth = k(j.calcdata.cells.line.width, ne, Q2), j.font = ae;
          });
        })(z), function(te) {
          te.attr("width", function(j) {
            return j.column.columnWidth;
          }).attr("stroke-width", function(j) {
            return j.cellBorderWidth;
          }).each(function(j) {
            var Q2 = a.select(this);
            d.stroke(Q2, k(j.calcdata.cells.line.color, j.column.specIndex, j.rowNumber)), d.fill(Q2, k(j.calcdata.cells.fill.color, j.column.specIndex, j.rowNumber));
          });
        }(function(te) {
          var j = te.selectAll("." + n.cn.cellRect).data(s.repeat, function(Q2) {
            return Q2.keyWithinBlock;
          });
          return j.enter().append("rect").classed(n.cn.cellRect, true), j;
        }(z));
        var H2 = function(te) {
          var j = te.selectAll("." + n.cn.cellText).data(s.repeat, function(Q2) {
            return Q2.keyWithinBlock;
          });
          return j.enter().append("text").classed(n.cn.cellText, true).style("cursor", function() {
            return "auto";
          }).on("mousedown", function() {
            a.event.stopPropagation();
          }), j;
        }(function(te) {
          var j = te.selectAll("." + n.cn.cellTextHolder).data(s.repeat, function(Q2) {
            return Q2.keyWithinBlock;
          });
          return j.enter().append("g").classed(n.cn.cellTextHolder, true).style("shape-rendering", "geometricPrecision"), j;
        }(z));
        (function(te) {
          te.each(function(j) {
            i.font(a.select(this), j.font);
          });
        })(H2), w(H2, q, R2, K2), L2(z);
      }
      function w(K2, q, re, R2) {
        K2.text(function(z) {
          var H2 = z.column.specIndex, te = z.rowNumber, j = z.value, Q2 = typeof j == "string", Z2 = Q2 && j.match(/<br>/i), ne = !Q2 || Z2;
          z.mayHaveMarkup = Q2 && j.match(/[<&>]/);
          var ae, ue = typeof (ae = j) == "string" && ae.match(n.latexCheck);
          z.latex = ue;
          var le, ce, se = ue ? "" : k(z.calcdata.cells.prefix, H2, te) || "", he = ue ? "" : k(z.calcdata.cells.suffix, H2, te) || "", me = ue ? null : k(z.calcdata.cells.format, H2, te) || null, we = se + (me ? o(me)(z.value) : z.value) + he;
          if (z.wrappingNeeded = !z.wrapped && !ne && !ue && (le = _4(we)), z.cellHeightMayIncrease = Z2 || ue || z.mayHaveMarkup || (le === void 0 ? _4(we) : le), z.needsConvertToTspans = z.mayHaveMarkup || z.wrappingNeeded || z.latex, z.wrappingNeeded) {
            var be = (n.wrapSplitCharacter === " " ? we.replace(/<a href=/gi, "<a_href=") : we).split(n.wrapSplitCharacter), Ae = n.wrapSplitCharacter === " " ? be.map(function(pe) {
              return pe.replace(/<a_href=/gi, "<a href=");
            }) : be;
            z.fragments = Ae.map(function(pe) {
              return { text: pe, width: null };
            }), z.fragments.push({ fragment: n.wrapSpacer, width: null }), ce = Ae.join(n.lineBreaker) + n.lineBreaker + n.wrapSpacer;
          } else delete z.fragments, ce = we;
          return ce;
        }).attr("dy", function(z) {
          return z.needsConvertToTspans ? 0 : "0.75em";
        }).each(function(z) {
          var H2 = a.select(this), te = z.wrappingNeeded ? D2 : I2;
          z.needsConvertToTspans ? l.convertToTspans(H2, R2, te(re, this, q, R2, z)) : a.select(this.parentNode).attr("transform", function(j) {
            return c(O2(j), n.cellPad);
          }).attr("text-anchor", function(j) {
            return { left: "start", center: "middle", right: "end" }[j.align];
          });
        });
      }
      function _4(K2) {
        return K2.indexOf(n.wrapSplitCharacter) !== -1;
      }
      function k(K2, q, re) {
        if (Array.isArray(K2)) {
          var R2 = K2[Math.min(q, K2.length - 1)];
          return Array.isArray(R2) ? R2[Math.min(re, R2.length - 1)] : R2;
        }
        return K2;
      }
      function T2(K2, q, re) {
        K2.transition().ease(n.releaseTransitionEase).duration(n.releaseTransitionDuration).attr("transform", c(q.x, re));
      }
      function A2(K2) {
        return K2.type === "cells";
      }
      function S2(K2) {
        return K2.type === "header";
      }
      function C2(K2) {
        return (K2.rowBlocks.length ? K2.rowBlocks[0].auxiliaryBlocks : []).reduce(function(q, re) {
          return q + W2(re, 1 / 0);
        }, 0);
      }
      function E2(K2, q, re) {
        var R2 = x(q)[0];
        if (R2 !== void 0) {
          var z = R2.rowBlocks, H2 = R2.calcdata, te = V2(z, z.length), j = R2.calcdata.groupHeight - C2(R2), Q2 = H2.scrollY = Math.max(0, Math.min(te - j, H2.scrollY)), Z2 = function(ne, ae, ue) {
            for (var le = [], ce = 0, se = 0; se < ne.length; se++) {
              for (var he = ne[se], me = he.rows, we = 0, be = 0; be < me.length; be++) we += me[be].rowHeight;
              he.allRowsHeight = we, ae < ce + we && ae + ue > ce && le.push(se), ce += we;
            }
            return le;
          }(z, Q2, j);
          Z2.length === 1 && (Z2[0] === z.length - 1 ? Z2.unshift(Z2[0] - 1) : Z2.push(Z2[0] + 1)), Z2[0] % 2 && Z2.reverse(), q.each(function(ne, ae) {
            ne.page = Z2[ae], ne.scrollY = Q2;
          }), q.attr("transform", function(ne) {
            var ae = V2(ne.rowBlocks, ne.page) - ne.scrollY;
            return c(0, ae);
          }), K2 && (N2(K2, re, q, Z2, R2.prevPages, R2, 0), N2(K2, re, q, Z2, R2.prevPages, R2, 1), b(re, K2));
        }
      }
      function F13(K2, q, re, R2) {
        return function(z) {
          var H2 = z.calcdata ? z.calcdata : z, te = q.filter(function(ne) {
            return H2.key === ne.key;
          }), j = re || H2.scrollbarState.dragMultiplier, Q2 = H2.scrollY;
          H2.scrollY = R2 === void 0 ? H2.scrollY + j * a.event.dy : R2;
          var Z2 = te.selectAll("." + n.cn.yColumn).selectAll("." + n.cn.columnBlock).filter(A2);
          return E2(K2, Z2, te), H2.scrollY === Q2;
        };
      }
      function N2(K2, q, re, R2, z, H2, te) {
        R2[te] !== z[te] && (clearTimeout(H2.currentRepaint[te]), H2.currentRepaint[te] = setTimeout(function() {
          var j = re.filter(function(Q2, Z2) {
            return Z2 === te && R2[Z2] !== z[Z2];
          });
          y(K2, q, j, re), z[te] = R2[te];
        }));
      }
      function D2(K2, q, re, R2) {
        return function() {
          var z = a.select(q.parentNode);
          z.each(function(H2) {
            var te = H2.fragments;
            z.selectAll("tspan.line").each(function(ce, se) {
              te[se].width = this.getComputedTextLength();
            });
            var j, Q2, Z2 = te[te.length - 1].width, ne = te.slice(0, -1), ae = [], ue = 0, le = H2.column.columnWidth - 2 * n.cellPad;
            for (H2.value = ""; ne.length; ) ue + (Q2 = (j = ne.shift()).width + Z2) > le && (H2.value += ae.join(n.wrapSpacer) + n.lineBreaker, ae = [], ue = 0), ae.push(j.text), ue += Q2;
            ue && (H2.value += ae.join(n.wrapSpacer)), H2.wrapped = true;
          }), z.selectAll("tspan.line").remove(), w(z.select("." + n.cn.cellText), re, K2, R2), a.select(q.parentNode.parentNode).call(L2);
        };
      }
      function I2(K2, q, re, R2, z) {
        return function() {
          if (!z.settledY) {
            var H2 = a.select(q.parentNode), te = Y2(z), j = z.key - te.firstRowIndex, Q2 = te.rows[j].rowHeight, Z2 = z.cellHeightMayIncrease ? q.parentNode.getBoundingClientRect().height + 2 * n.cellPad : Q2, ne = Math.max(Z2, Q2);
            ne - te.rows[j].rowHeight && (te.rows[j].rowHeight = ne, K2.selectAll("." + n.cn.columnCell).call(L2), E2(null, K2.filter(A2), 0), b(re, R2, true)), H2.attr("transform", function() {
              var ae = this.parentNode.getBoundingClientRect(), ue = a.select(this.parentNode).select("." + n.cn.cellRect).node().getBoundingClientRect(), le = this.transform.baseVal.consolidate(), ce = ue.top - ae.top + (le ? le.matrix.f : n.cellPad);
              return c(O2(z, a.select(this.parentNode).select("." + n.cn.cellTextHolder).node().getBoundingClientRect().width), ce);
            }), z.settledY = true;
          }
        };
      }
      function O2(K2, q) {
        switch (K2.align) {
          case "left":
            return n.cellPad;
          case "right":
            return K2.column.columnWidth - (q || 0) - n.cellPad;
          case "center":
            return (K2.column.columnWidth - (q || 0)) / 2;
          default:
            return n.cellPad;
        }
      }
      function L2(K2) {
        K2.attr("transform", function(q) {
          var re = q.rowBlocks[0].auxiliaryBlocks.reduce(function(z, H2) {
            return z + W2(H2, 1 / 0);
          }, 0), R2 = W2(Y2(q), q.key);
          return c(0, R2 + re);
        }).selectAll("." + n.cn.cellRect).attr("height", function(q) {
          return (re = Y2(q), R2 = q.key, re.rows[R2 - re.firstRowIndex]).rowHeight;
          var re, R2;
        });
      }
      function V2(K2, q) {
        for (var re = 0, R2 = q - 1; R2 >= 0; R2--) re += X2(K2[R2]);
        return re;
      }
      function W2(K2, q) {
        for (var re = 0, R2 = 0; R2 < K2.rows.length && K2.rows[R2].rowIndex < q; R2++) re += K2.rows[R2].rowHeight;
        return re;
      }
      function X2(K2) {
        var q = K2.allRowsHeight;
        if (q !== void 0) return q;
        for (var re = 0, R2 = 0; R2 < K2.rows.length; R2++) re += K2.rows[R2].rowHeight;
        return K2.allRowsHeight = re, re;
      }
      function Y2(K2) {
        return K2.rowBlocks[K2.page];
      }
      t.exports = function(K2, q) {
        var re = !K2._context.staticPlot, R2 = K2._fullLayout._paper.selectAll("." + n.cn.table).data(q.map(function(he) {
          var me = s.unwrap(he).trace;
          return h(K2, me);
        }), s.keyFun);
        R2.exit().remove(), R2.enter().append("g").classed(n.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"), R2.attr("width", function(he) {
          return he.width + he.size.l + he.size.r;
        }).attr("height", function(he) {
          return he.height + he.size.t + he.size.b;
        }).attr("transform", function(he) {
          return c(he.translateX, he.translateY);
        });
        var z = R2.selectAll("." + n.cn.tableControlView).data(s.repeat, s.keyFun), H2 = z.enter().append("g").classed(n.cn.tableControlView, true).style("box-sizing", "content-box");
        if (re) {
          var te = "onwheel" in document ? "wheel" : "mousewheel";
          H2.on("mousemove", function(he) {
            z.filter(function(me) {
              return he === me;
            }).call(b, K2);
          }).on(te, function(he) {
            if (!he.scrollbarState.wheeling) {
              he.scrollbarState.wheeling = true;
              var me = he.scrollY + a.event.deltaY;
              F13(K2, z, null, me)(he) || (a.event.stopPropagation(), a.event.preventDefault()), he.scrollbarState.wheeling = false;
            }
          }).call(b, K2, true);
        }
        z.attr("transform", function(he) {
          return c(he.size.l, he.size.t);
        });
        var j = z.selectAll("." + n.cn.scrollBackground).data(s.repeat, s.keyFun);
        j.enter().append("rect").classed(n.cn.scrollBackground, true).attr("fill", "none"), j.attr("width", function(he) {
          return he.width;
        }).attr("height", function(he) {
          return he.height;
        }), z.each(function(he) {
          i.setClipUrl(a.select(this), m(K2, he), K2);
        });
        var Q2 = z.selectAll("." + n.cn.yColumn).data(function(he) {
          return he.columns;
        }, s.keyFun);
        Q2.enter().append("g").classed(n.cn.yColumn, true), Q2.exit().remove(), Q2.attr("transform", function(he) {
          return c(he.x, 0);
        }), re && Q2.call(a.behavior.drag().origin(function(he) {
          return T2(a.select(this), he, -n.uplift), u2(this), he.calcdata.columnDragInProgress = true, b(z.filter(function(me) {
            return he.calcdata.key === me.key;
          }), K2), he;
        }).on("drag", function(he) {
          var me = a.select(this), we = function(be) {
            return (he === be ? a.event.x : be.x) + be.columnWidth / 2;
          };
          he.x = Math.max(-n.overdrag, Math.min(he.calcdata.width + n.overdrag - he.columnWidth, a.event.x)), x(Q2).filter(function(be) {
            return be.calcdata.key === he.calcdata.key;
          }).sort(function(be, Ae) {
            return we(be) - we(Ae);
          }).forEach(function(be, Ae) {
            be.xIndex = Ae, be.x = he === be ? be.x : be.xScale(be);
          }), Q2.filter(function(be) {
            return he !== be;
          }).transition().ease(n.transitionEase).duration(n.transitionDuration).attr("transform", function(be) {
            return c(be.x, 0);
          }), me.call(f).attr("transform", c(he.x, -n.uplift));
        }).on("dragend", function(he) {
          var me = a.select(this), we = he.calcdata;
          he.x = he.xScale(he), he.calcdata.columnDragInProgress = false, T2(me, he, 0), function(be, Ae, pe) {
            var ve = Ae.gdColumnsOriginalOrder;
            Ae.gdColumns.sort(function(Ee, Se) {
              return pe[ve.indexOf(Ee)] - pe[ve.indexOf(Se)];
            }), Ae.columnorder = pe, be.emit("plotly_restyle");
          }(K2, we, we.columns.map(function(be) {
            return be.xIndex;
          }));
        })), Q2.each(function(he) {
          i.setClipUrl(a.select(this), g(K2, he), K2);
        });
        var Z2 = Q2.selectAll("." + n.cn.columnBlock).data(p.splitToPanels, s.keyFun);
        Z2.enter().append("g").classed(n.cn.columnBlock, true).attr("id", function(he) {
          return he.key;
        }), Z2.style("cursor", function(he) {
          return he.dragHandle ? "ew-resize" : he.calcdata.scrollbarState.barWiggleRoom ? "ns-resize" : "default";
        });
        var ne = Z2.filter(S2), ae = Z2.filter(A2);
        re && ae.call(a.behavior.drag().origin(function(he) {
          return a.event.stopPropagation(), he;
        }).on("drag", F13(K2, z, -1)).on("dragend", function() {
        })), y(K2, z, ne, Z2), y(K2, z, ae, Z2);
        var ue = z.selectAll("." + n.cn.scrollAreaClip).data(s.repeat, s.keyFun);
        ue.enter().append("clipPath").classed(n.cn.scrollAreaClip, true).attr("id", function(he) {
          return m(K2, he);
        });
        var le = ue.selectAll("." + n.cn.scrollAreaClipRect).data(s.repeat, s.keyFun);
        le.enter().append("rect").classed(n.cn.scrollAreaClipRect, true).attr("x", -n.overdrag).attr("y", -n.uplift).attr("fill", "none"), le.attr("width", function(he) {
          return he.width + 2 * n.overdrag;
        }).attr("height", function(he) {
          return he.height + n.uplift;
        }), Q2.selectAll("." + n.cn.columnBoundary).data(s.repeat, s.keyFun).enter().append("g").classed(n.cn.columnBoundary, true);
        var ce = Q2.selectAll("." + n.cn.columnBoundaryClippath).data(s.repeat, s.keyFun);
        ce.enter().append("clipPath").classed(n.cn.columnBoundaryClippath, true), ce.attr("id", function(he) {
          return g(K2, he);
        });
        var se = ce.selectAll("." + n.cn.columnBoundaryRect).data(s.repeat, s.keyFun);
        se.enter().append("rect").classed(n.cn.columnBoundaryRect, true).attr("fill", "none"), se.attr("width", function(he) {
          return he.columnWidth + 2 * v(he);
        }).attr("height", function(he) {
          return he.calcdata.height + 2 * v(he) + n.uplift;
        }).attr("x", function(he) {
          return -v(he);
        }).attr("y", function(he) {
          return -v(he);
        }), E2(null, ae, z);
      };
    }, { "../../components/color": 366, "../../components/drawing": 388, "../../lib": 503, "../../lib/gup": 500, "../../lib/svg_text_utils": 529, "./constants": 1065, "./data_preparation_helper": 1066, "./data_split_helpers": 1067, "@plotly/d3": 58 }], 1071: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/template_attributes").hovertemplateAttrs, a = e("../../plots/template_attributes").texttemplateAttrs, o = e("../../components/colorscale/attributes"), s = e("../../plots/domain").attributes, i = e("../pie/attributes"), l = e("../sunburst/attributes"), u2 = e("./constants"), c = e("../../lib/extend").extendFlat;
      t.exports = { labels: l.labels, parents: l.parents, values: l.values, branchvalues: l.branchvalues, count: l.count, level: l.level, maxdepth: l.maxdepth, tiling: { packing: { valType: "enumerated", values: ["squarify", "binary", "dice", "slice", "slice-dice", "dice-slice"], dflt: "squarify", editType: "plot" }, squarifyratio: { valType: "number", min: 1, dflt: 1, editType: "plot" }, flip: { valType: "flaglist", flags: ["x", "y"], dflt: "", editType: "plot" }, pad: { valType: "number", min: 0, dflt: 3, editType: "plot" }, editType: "calc" }, marker: c({ pad: { t: { valType: "number", min: 0, editType: "plot" }, l: { valType: "number", min: 0, editType: "plot" }, r: { valType: "number", min: 0, editType: "plot" }, b: { valType: "number", min: 0, editType: "plot" }, editType: "calc" }, colors: l.marker.colors, depthfade: { valType: "enumerated", values: [true, false, "reversed"], editType: "style" }, line: l.marker.line, editType: "calc" }, o("marker", { colorAttr: "colors", anim: false })), pathbar: { visible: { valType: "boolean", dflt: true, editType: "plot" }, side: { valType: "enumerated", values: ["top", "bottom"], dflt: "top", editType: "plot" }, edgeshape: { valType: "enumerated", values: [">", "<", "|", "/", "\\"], dflt: ">", editType: "plot" }, thickness: { valType: "number", min: 12, editType: "plot" }, textfont: c({}, i.textfont, {}), editType: "calc" }, text: i.text, textinfo: l.textinfo, texttemplate: a({ editType: "plot" }, { keys: u2.eventDataKeys.concat(["label", "value"]) }), hovertext: i.hovertext, hoverinfo: l.hoverinfo, hovertemplate: n({}, { keys: u2.eventDataKeys }), textfont: i.textfont, insidetextfont: i.insidetextfont, outsidetextfont: c({}, i.outsidetextfont, {}), textposition: { valType: "enumerated", values: ["top left", "top center", "top right", "middle left", "middle center", "middle right", "bottom left", "bottom center", "bottom right"], dflt: "top left", editType: "plot" }, sort: i.sort, root: l.root, domain: s({ name: "treemap", trace: true, editType: "calc" }) };
    }, { "../../components/colorscale/attributes": 373, "../../lib/extend": 493, "../../plots/domain": 584, "../../plots/template_attributes": 633, "../pie/attributes": 900, "../sunburst/attributes": 1045, "./constants": 1074 }], 1072: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/plots");
      r.name = "treemap", r.plot = function(a, o, s, i) {
        n.plotBasePlot(r.name, a, o, s, i);
      }, r.clean = function(a, o, s, i) {
        n.cleanBasePlot(r.name, a, o, s, i);
      };
    }, { "../../plots/plots": 619 }], 1073: [function(e, t, r) {
      "use strict";
      var n = e("../sunburst/calc");
      r.calc = function(a, o) {
        return n.calc(a, o);
      }, r.crossTraceCalc = function(a) {
        return n._runCrossTraceCalc("treemap", a);
      };
    }, { "../sunburst/calc": 1047 }], 1074: [function(e, t, r) {
      "use strict";
      t.exports = { CLICK_TRANSITION_TIME: 750, CLICK_TRANSITION_EASING: "poly", eventDataKeys: ["currentPath", "root", "entry", "percentRoot", "percentEntry", "percentParent"], gapWithPathbar: 1 };
    }, {}], 1075: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("./attributes"), o = e("../../components/color"), s = e("../../plots/domain").defaults, i = e("../bar/defaults").handleText, l = e("../bar/constants").TEXTPAD, u2 = e("../../components/colorscale"), c = u2.hasColorscale, f = u2.handleDefaults;
      t.exports = function(h, p, d, v) {
        function m(A2, S2) {
          return n.coerce(h, p, a, A2, S2);
        }
        var g = m("labels"), x = m("parents");
        if (g && g.length && x && x.length) {
          var b = m("values");
          b && b.length ? m("branchvalues") : m("count"), m("level"), m("maxdepth"), m("tiling.packing") === "squarify" && m("tiling.squarifyratio"), m("tiling.flip"), m("tiling.pad");
          var y = m("text");
          m("texttemplate"), p.texttemplate || m("textinfo", Array.isArray(y) ? "text+label" : "label"), m("hovertext"), m("hovertemplate");
          var w = m("pathbar.visible");
          i(h, p, v, m, "auto", { hasPathbar: w, moduleHasSelected: false, moduleHasUnselected: false, moduleHasConstrain: false, moduleHasCliponaxis: false, moduleHasTextangle: false, moduleHasInsideanchor: false }), m("textposition");
          var _4 = p.textposition.indexOf("bottom") !== -1;
          m("marker.line.width") && m("marker.line.color", v.paper_bgcolor);
          var k = m("marker.colors");
          (p._hasColorscale = c(h, "marker", "colors") || (h.marker || {}).coloraxis) ? f(h, p, v, m, { prefix: "marker.", cLetter: "c" }) : m("marker.depthfade", !(k || []).length);
          var T2 = 2 * p.textfont.size;
          m("marker.pad.t", _4 ? T2 / 4 : T2), m("marker.pad.l", T2 / 4), m("marker.pad.r", T2 / 4), m("marker.pad.b", _4 ? T2 : T2 / 4), p._hovered = { marker: { line: { width: 2, color: o.contrast(v.paper_bgcolor) } } }, w && (m("pathbar.thickness", p.pathbar.textfont.size + 2 * l), m("pathbar.side"), m("pathbar.edgeshape")), m("sort"), m("root.color"), s(p, v, m), p._length = null;
        } else p.visible = false;
      };
    }, { "../../components/color": 366, "../../components/colorscale": 378, "../../lib": 503, "../../plots/domain": 584, "../bar/constants": 650, "../bar/defaults": 652, "./attributes": 1071 }], 1076: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../sunburst/helpers"), o = e("../bar/uniform_text").clearMinTextSize, s = e("../bar/style").resizeText, i = e("./plot_one");
      t.exports = function(l, u2, c, f, h) {
        var p, d, v = h.type, m = h.drawDescendants, g = l._fullLayout, x = g["_" + v + "layer"], b = !c;
        o(v, g), (p = x.selectAll("g.trace." + v).data(u2, function(y) {
          return y[0].trace.uid;
        })).enter().append("g").classed("trace", true).classed(v, true), p.order(), !g.uniformtext.mode && a.hasTransition(c) ? (f && (d = f()), n.transition().duration(c.duration).ease(c.easing).each("end", function() {
          d && d();
        }).each("interrupt", function() {
          d && d();
        }).each(function() {
          x.selectAll("g.trace").each(function(y) {
            i(l, y, this, c, m);
          });
        })) : (p.each(function(y) {
          i(l, y, this, c, m);
        }), g.uniformtext.mode && s(l, x.selectAll(".trace"), v)), b && p.exit().remove();
      };
    }, { "../bar/style": 662, "../bar/uniform_text": 664, "../sunburst/helpers": 1051, "./plot_one": 1085, "@plotly/d3": 58 }], 1077: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../lib"), o = e("../../components/drawing"), s = e("../../lib/svg_text_utils"), i = e("./partition"), l = e("./style").styleOne, u2 = e("./constants"), c = e("../sunburst/helpers"), f = e("../sunburst/fx");
      t.exports = function(h, p, d, v, m) {
        var g = m.barDifY, x = m.width, b = m.height, y = m.viewX, w = m.viewY, _4 = m.pathSlice, k = m.toMoveInsideSlice, T2 = m.strTransform, A2 = m.hasTransition, S2 = m.handleSlicesExit, C2 = m.makeUpdateSliceInterpolator, E2 = m.makeUpdateTextInterpolator, F13 = {}, N2 = h._fullLayout, D2 = p[0], I2 = D2.trace, O2 = D2.hierarchy, L2 = x / I2._entryDepth, V2 = c.listPath(d.data, "id"), W2 = i(O2.copy(), [x, b], { packing: "dice", pad: { inner: 0, top: 0, left: 0, right: 0, bottom: 0 } }).descendants();
        (W2 = W2.filter(function(Y2) {
          var K2 = V2.indexOf(Y2.data.id);
          return K2 !== -1 && (Y2.x0 = L2 * K2, Y2.x1 = L2 * (K2 + 1), Y2.y0 = g, Y2.y1 = g + b, Y2.onPathbar = true, true);
        })).reverse(), (v = v.data(W2, c.getPtId)).enter().append("g").classed("pathbar", true), S2(v, true, F13, [x, b], _4), v.order();
        var X2 = v;
        A2 && (X2 = X2.transition().each("end", function() {
          var Y2 = n.select(this);
          c.setSliceCursor(Y2, h, { hideOnRoot: false, hideOnLeaves: false, isTransitioning: false });
        })), X2.each(function(Y2) {
          Y2._x0 = y(Y2.x0), Y2._x1 = y(Y2.x1), Y2._y0 = w(Y2.y0), Y2._y1 = w(Y2.y1), Y2._hoverX = y(Y2.x1 - Math.min(x, b) / 2), Y2._hoverY = w(Y2.y1 - b / 2);
          var K2 = n.select(this), q = a.ensureSingle(K2, "path", "surface", function(H2) {
            H2.style("pointer-events", "all");
          });
          A2 ? q.transition().attrTween("d", function(H2) {
            var te = C2(H2, true, F13, [x, b]);
            return function(j) {
              return _4(te(j));
            };
          }) : q.attr("d", _4), K2.call(f, d, h, p, { styleOne: l, eventDataKeys: u2.eventDataKeys, transitionTime: u2.CLICK_TRANSITION_TIME, transitionEasing: u2.CLICK_TRANSITION_EASING }).call(c.setSliceCursor, h, { hideOnRoot: false, hideOnLeaves: false, isTransitioning: h._transitioning }), q.call(l, Y2, I2, { hovered: false }), Y2._text = (c.getPtLabel(Y2) || "").split("<br>").join(" ") || "";
          var re = a.ensureSingle(K2, "g", "slicetext"), R2 = a.ensureSingle(re, "text", "", function(H2) {
            H2.attr("data-notex", 1);
          }), z = a.ensureUniformFontSize(h, c.determineTextFont(I2, Y2, N2.font, { onPathbar: true }));
          R2.text(Y2._text || " ").classed("slicetext", true).attr("text-anchor", "start").call(o.font, z).call(s.convertToTspans, h), Y2.textBB = o.bBox(R2.node()), Y2.transform = k(Y2, { fontSize: z.size, onPathbar: true }), Y2.transform.fontSize = z.size, A2 ? R2.transition().attrTween("transform", function(H2) {
            var te = E2(H2, true, F13, [x, b]);
            return function(j) {
              return T2(te(j));
            };
          }) : R2.attr("transform", T2(Y2));
        });
      };
    }, { "../../components/drawing": 388, "../../lib": 503, "../../lib/svg_text_utils": 529, "../sunburst/fx": 1050, "../sunburst/helpers": 1051, "./constants": 1074, "./partition": 1083, "./style": 1086, "@plotly/d3": 58 }], 1078: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../lib"), o = e("../../components/drawing"), s = e("../../lib/svg_text_utils"), i = e("./partition"), l = e("./style").styleOne, u2 = e("./constants"), c = e("../sunburst/helpers"), f = e("../sunburst/fx"), h = e("../sunburst/plot").formatSliceLabel;
      t.exports = function(p, d, v, m, g) {
        var x = g.width, b = g.height, y = g.viewX, w = g.viewY, _4 = g.pathSlice, k = g.toMoveInsideSlice, T2 = g.strTransform, A2 = g.hasTransition, S2 = g.handleSlicesExit, C2 = g.makeUpdateSliceInterpolator, E2 = g.makeUpdateTextInterpolator, F13 = g.prevEntry, N2 = p._fullLayout, D2 = d[0].trace, I2 = D2.textposition.indexOf("left") !== -1, O2 = D2.textposition.indexOf("right") !== -1, L2 = D2.textposition.indexOf("bottom") !== -1, V2 = !L2 && !D2.marker.pad.t || L2 && !D2.marker.pad.b, W2 = i(v, [x, b], { packing: D2.tiling.packing, squarifyratio: D2.tiling.squarifyratio, flipX: D2.tiling.flip.indexOf("x") > -1, flipY: D2.tiling.flip.indexOf("y") > -1, pad: { inner: D2.tiling.pad, top: D2.marker.pad.t, left: D2.marker.pad.l, right: D2.marker.pad.r, bottom: D2.marker.pad.b } }).descendants(), X2 = 1 / 0, Y2 = -1 / 0;
        W2.forEach(function(z) {
          var H2 = z.depth;
          H2 >= D2._maxDepth ? (z.x0 = z.x1 = (z.x0 + z.x1) / 2, z.y0 = z.y1 = (z.y0 + z.y1) / 2) : (X2 = Math.min(X2, H2), Y2 = Math.max(Y2, H2));
        }), m = m.data(W2, c.getPtId), D2._maxVisibleLayers = isFinite(Y2) ? Y2 - X2 + 1 : 0, m.enter().append("g").classed("slice", true), S2(m, false, {}, [x, b], _4), m.order();
        var K2 = null;
        if (A2 && F13) {
          var q = c.getPtId(F13);
          m.each(function(z) {
            K2 === null && c.getPtId(z) === q && (K2 = { x0: z.x0, x1: z.x1, y0: z.y0, y1: z.y1 });
          });
        }
        var re = function() {
          return K2 || { x0: 0, x1: x, y0: 0, y1: b };
        }, R2 = m;
        return A2 && (R2 = R2.transition().each("end", function() {
          var z = n.select(this);
          c.setSliceCursor(z, p, { hideOnRoot: true, hideOnLeaves: false, isTransitioning: false });
        })), R2.each(function(z) {
          var H2 = c.isHeader(z, D2);
          z._x0 = y(z.x0), z._x1 = y(z.x1), z._y0 = w(z.y0), z._y1 = w(z.y1), z._hoverX = y(z.x1 - D2.marker.pad.r), z._hoverY = w(L2 ? z.y1 - D2.marker.pad.b / 2 : z.y0 + D2.marker.pad.t / 2);
          var te = n.select(this), j = a.ensureSingle(te, "path", "surface", function(ae) {
            ae.style("pointer-events", "all");
          });
          A2 ? j.transition().attrTween("d", function(ae) {
            var ue = C2(ae, false, re(), [x, b]);
            return function(le) {
              return _4(ue(le));
            };
          }) : j.attr("d", _4), te.call(f, v, p, d, { styleOne: l, eventDataKeys: u2.eventDataKeys, transitionTime: u2.CLICK_TRANSITION_TIME, transitionEasing: u2.CLICK_TRANSITION_EASING }).call(c.setSliceCursor, p, { isTransitioning: p._transitioning }), j.call(l, z, D2, { hovered: false }), z.x0 === z.x1 || z.y0 === z.y1 ? z._text = "" : z._text = H2 ? V2 ? "" : c.getPtLabel(z) || "" : h(z, v, D2, d, N2) || "";
          var Q2 = a.ensureSingle(te, "g", "slicetext"), Z2 = a.ensureSingle(Q2, "text", "", function(ae) {
            ae.attr("data-notex", 1);
          }), ne = a.ensureUniformFontSize(p, c.determineTextFont(D2, z, N2.font));
          Z2.text(z._text || " ").classed("slicetext", true).attr("text-anchor", O2 ? "end" : I2 || H2 ? "start" : "middle").call(o.font, ne).call(s.convertToTspans, p), z.textBB = o.bBox(Z2.node()), z.transform = k(z, { fontSize: ne.size, isHeader: H2 }), z.transform.fontSize = ne.size, A2 ? Z2.transition().attrTween("transform", function(ae) {
            var ue = E2(ae, false, re(), [x, b]);
            return function(le) {
              return T2(ue(le));
            };
          }) : Z2.attr("transform", T2(z));
        }), K2;
      };
    }, { "../../components/drawing": 388, "../../lib": 503, "../../lib/svg_text_utils": 529, "../sunburst/fx": 1050, "../sunburst/helpers": 1051, "../sunburst/plot": 1055, "./constants": 1074, "./partition": 1083, "./style": 1086, "@plotly/d3": 58 }], 1079: [function(e, t, r) {
      "use strict";
      t.exports = function n(a, o, s) {
        var i;
        s.swapXY && (i = a.x0, a.x0 = a.y0, a.y0 = i, i = a.x1, a.x1 = a.y1, a.y1 = i), s.flipX && (i = a.x0, a.x0 = o[0] - a.x1, a.x1 = o[0] - i), s.flipY && (i = a.y0, a.y0 = o[1] - a.y1, a.y1 = o[1] - i);
        var l = a.children;
        if (l) for (var u2 = 0; u2 < l.length; u2++) n(l[u2], o, s);
      };
    }, {}], 1080: [function(e, t, r) {
      "use strict";
      t.exports = { moduleType: "trace", name: "treemap", basePlotModule: e("./base_plot"), categories: [], animatable: true, attributes: e("./attributes"), layoutAttributes: e("./layout_attributes"), supplyDefaults: e("./defaults"), supplyLayoutDefaults: e("./layout_defaults"), calc: e("./calc").calc, crossTraceCalc: e("./calc").crossTraceCalc, plot: e("./plot"), style: e("./style").style, colorbar: e("../scatter/marker_colorbar"), meta: {} };
    }, { "../scatter/marker_colorbar": 944, "./attributes": 1071, "./base_plot": 1072, "./calc": 1073, "./defaults": 1075, "./layout_attributes": 1081, "./layout_defaults": 1082, "./plot": 1084, "./style": 1086 }], 1081: [function(e, t, r) {
      "use strict";
      t.exports = { treemapcolorway: { valType: "colorlist", editType: "calc" }, extendtreemapcolors: { valType: "boolean", dflt: true, editType: "calc" } };
    }, {}], 1082: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("./layout_attributes");
      t.exports = function(o, s) {
        function i(l, u2) {
          return n.coerce(o, s, a, l, u2);
        }
        i("treemapcolorway", s.colorway), i("extendtreemapcolors");
      };
    }, { "../../lib": 503, "./layout_attributes": 1081 }], 1083: [function(e, t, r) {
      "use strict";
      var n = e("d3-hierarchy"), a = e("./flip_tree");
      t.exports = function(o, s, i) {
        var l, u2 = i.flipX, c = i.flipY, f = i.packing === "dice-slice", h = i.pad[c ? "bottom" : "top"], p = i.pad[u2 ? "right" : "left"], d = i.pad[u2 ? "left" : "right"], v = i.pad[c ? "top" : "bottom"];
        f && (l = p, p = h, h = l, l = d, d = v, v = l);
        var m = n.treemap().tile(function(g, x) {
          switch (g) {
            case "squarify":
              return n.treemapSquarify.ratio(x);
            case "binary":
              return n.treemapBinary;
            case "dice":
              return n.treemapDice;
            case "slice":
              return n.treemapSlice;
            default:
              return n.treemapSliceDice;
          }
        }(i.packing, i.squarifyratio)).paddingInner(i.pad.inner).paddingLeft(p).paddingRight(d).paddingTop(h).paddingBottom(v).size(f ? [s[1], s[0]] : s)(o);
        return (f || u2 || c) && a(m, s, { swapXY: f, flipX: u2, flipY: c }), m;
      };
    }, { "./flip_tree": 1079, "d3-hierarchy": 115 }], 1084: [function(e, t, r) {
      "use strict";
      var n = e("./draw"), a = e("./draw_descendants");
      t.exports = function(o, s, i, l) {
        return n(o, s, i, l, { type: "treemap", drawDescendants: a });
      };
    }, { "./draw": 1076, "./draw_descendants": 1078 }], 1085: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("d3-interpolate").interpolate, o = e("../sunburst/helpers"), s = e("../../lib"), i = e("../bar/constants").TEXTPAD, l = e("../bar/plot").toMoveInsideBar, u2 = e("../bar/uniform_text").recordMinTextSize, c = e("./constants"), f = e("./draw_ancestors");
      function h(p) {
        return o.isHierarchyRoot(p) ? "" : o.getPtId(p);
      }
      t.exports = function(p, d, v, m, g) {
        var x = p._fullLayout, b = d[0], y = b.trace, w = y.type === "icicle", _4 = b.hierarchy, k = o.findEntryWithLevel(_4, y.level), T2 = n.select(v), A2 = T2.selectAll("g.pathbar"), S2 = T2.selectAll("g.slice");
        if (!k) return A2.remove(), void S2.remove();
        var C2 = o.isHierarchyRoot(k), E2 = !x.uniformtext.mode && o.hasTransition(m), F13 = o.getMaxDepth(y), N2 = x._size, D2 = y.domain, I2 = N2.w * (D2.x[1] - D2.x[0]), O2 = N2.h * (D2.y[1] - D2.y[0]), L2 = I2, V2 = y.pathbar.thickness, W2 = y.marker.line.width + c.gapWithPathbar, X2 = y.pathbar.visible ? y.pathbar.side.indexOf("bottom") > -1 ? O2 + W2 : -(V2 + W2) : 0, Y2 = { x0: L2, x1: L2, y0: X2, y1: X2 + V2 }, K2 = function(Ce, Be, Ue) {
          var Ke = y.tiling.pad, ct = function(ot) {
            return ot - Ke <= Be.x0;
          }, We = function(ot) {
            return ot + Ke >= Be.x1;
          }, Ze = function(ot) {
            return ot - Ke <= Be.y0;
          }, it = function(ot) {
            return ot + Ke >= Be.y1;
          };
          return Ce.x0 === Be.x0 && Ce.x1 === Be.x1 && Ce.y0 === Be.y0 && Ce.y1 === Be.y1 ? { x0: Ce.x0, x1: Ce.x1, y0: Ce.y0, y1: Ce.y1 } : { x0: ct(Ce.x0 - Ke) ? 0 : We(Ce.x0 - Ke) ? Ue[0] : Ce.x0, x1: ct(Ce.x1 + Ke) ? 0 : We(Ce.x1 + Ke) ? Ue[0] : Ce.x1, y0: Ze(Ce.y0 - Ke) ? 0 : it(Ce.y0 - Ke) ? Ue[1] : Ce.y0, y1: Ze(Ce.y1 + Ke) ? 0 : it(Ce.y1 + Ke) ? Ue[1] : Ce.y1 };
        }, q = null, re = {}, R2 = {}, z = null, H2 = function(Ce, Be) {
          return Be ? re[h(Ce)] : R2[h(Ce)];
        }, te = function(Ce, Be, Ue, Ke) {
          if (Be) return re[h(_4)] || Y2;
          var ct = R2[y.level] || Ue;
          return function(We) {
            return We.data.depth - k.data.depth < F13;
          }(Ce) ? K2(Ce, ct, Ke) : {};
        };
        b.hasMultipleRoots && C2 && F13++, y._maxDepth = F13, y._backgroundColor = x.paper_bgcolor, y._entryDepth = k.data.depth, y._atRootLevel = C2;
        var j = -I2 / 2 + N2.l + N2.w * (D2.x[1] + D2.x[0]) / 2, Q2 = -O2 / 2 + N2.t + N2.h * (1 - (D2.y[1] + D2.y[0]) / 2), Z2 = function(Ce) {
          return j + Ce;
        }, ne = function(Ce) {
          return Q2 + Ce;
        }, ae = ne(0), ue = Z2(0), le = function(Ce) {
          return ue + Ce;
        }, ce = function(Ce) {
          return ae + Ce;
        };
        function se(Ce, Be) {
          return Ce + "," + Be;
        }
        var he = le(0), me = function(Ce) {
          Ce.x = Math.max(he, Ce.x);
        }, we = y.pathbar.edgeshape, be = function(Ce, Be) {
          var Ue = Ce.x0, Ke = Ce.x1, ct = Ce.y0, We = Ce.y1, Ze = Ce.textBB, it = function(Ot) {
            return y.textposition.indexOf(Ot) !== -1;
          }, ot = it("bottom"), mt = it("top") || Be.isHeader && !ot ? "start" : ot ? "end" : "middle", wt = it("right"), Et = it("left") || Be.onPathbar ? -1 : wt ? 1 : 0, zt = y[w ? "tiling" : "marker"].pad;
          if (Be.isHeader) {
            if ((Ue += (w ? zt : zt.l) - i) >= (Ke -= (w ? zt : zt.r) - i)) {
              var Nt = (Ue + Ke) / 2;
              Ue = Nt, Ke = Nt;
            }
            var yt;
            ot ? ct < (yt = We - (w ? zt : zt.b)) && yt < We && (ct = yt) : ct < (yt = ct + (w ? zt : zt.t)) && yt < We && (We = yt);
          }
          var pt = l(Ue, Ke, ct, We, Ze, { isHorizontal: false, constrained: true, angle: 0, anchor: mt, leftToRight: Et });
          return pt.fontSize = Be.fontSize, pt.targetX = Z2(pt.targetX), pt.targetY = ne(pt.targetY), isNaN(pt.targetX) || isNaN(pt.targetY) ? {} : (Ue !== Ke && ct !== We && u2(y.type, pt, x), { scale: pt.scale, rotate: pt.rotate, textX: pt.textX, textY: pt.textY, anchorX: pt.anchorX, anchorY: pt.anchorY, targetX: pt.targetX, targetY: pt.targetY });
        }, Ae = function(Ce, Be) {
          for (var Ue, Ke = 0, ct = Ce; !Ue && Ke < F13; ) Ke++, (ct = ct.parent) ? Ue = H2(ct, Be) : Ke = F13;
          return Ue || {};
        }, pe = function(Ce, Be, Ue, Ke, ct) {
          var We, Ze = H2(Ce, Be);
          if (Ze) We = Ze;
          else if (Be) We = Y2;
          else if (q) if (Ce.parent) {
            var it = z || Ue;
            it && !Be ? We = K2(Ce, it, Ke) : (We = {}, s.extendFlat(We, Ae(Ce, Be)));
          } else We = s.extendFlat({}, Ce), w && (ct.orientation === "h" ? ct.flipX ? We.x0 = Ce.x1 : We.x1 = 0 : ct.flipY ? We.y0 = Ce.y1 : We.y1 = 0);
          else We = {};
          return a(We, { x0: Ce.x0, x1: Ce.x1, y0: Ce.y0, y1: Ce.y1 });
        }, ve = function(Ce, Be, Ue, Ke) {
          var ct = H2(Ce, Be), We = {}, Ze = te(Ce, Be, Ue, Ke);
          s.extendFlat(We, { transform: be({ x0: Ze.x0, x1: Ze.x1, y0: Ze.y0, y1: Ze.y1, textBB: Ce.textBB, _text: Ce._text }, { isHeader: o.isHeader(Ce, y) }) }), ct ? We = ct : Ce.parent && s.extendFlat(We, Ae(Ce, Be));
          var it = Ce.transform;
          return Ce.x0 !== Ce.x1 && Ce.y0 !== Ce.y1 && u2(y.type, it, x), a(We, { transform: { scale: it.scale, rotate: it.rotate, textX: it.textX, textY: it.textY, anchorX: it.anchorX, anchorY: it.anchorY, targetX: it.targetX, targetY: it.targetY } });
        }, Ee = function(Ce, Be, Ue, Ke, ct) {
          var We = Ke[0], Ze = Ke[1];
          E2 ? Ce.exit().transition().each(function() {
            var it = n.select(this);
            it.select("path.surface").transition().attrTween("d", function(ot) {
              var mt = function(wt, Et, zt, Nt) {
                var yt, pt = H2(wt, Et);
                if (Et) yt = Y2;
                else {
                  var Ot = H2(k, Et);
                  yt = Ot ? K2(wt, Ot, Nt) : {};
                }
                return a(pt, yt);
              }(ot, Be, 0, [We, Ze]);
              return function(wt) {
                return ct(mt(wt));
              };
            }), it.select("g.slicetext").attr("opacity", 0);
          }).remove() : Ce.exit().remove();
        }, Se = function(Ce) {
          var Be = Ce.transform;
          return Ce.x0 !== Ce.x1 && Ce.y0 !== Ce.y1 && u2(y.type, Be, x), s.getTextTransform({ textX: Be.textX, textY: Be.textY, anchorX: Be.anchorX, anchorY: Be.anchorY, targetX: Be.targetX, targetY: Be.targetY, scale: Be.scale, rotate: Be.rotate });
        };
        E2 && (A2.each(function(Ce) {
          re[h(Ce)] = { x0: Ce.x0, x1: Ce.x1, y0: Ce.y0, y1: Ce.y1 }, Ce.transform && (re[h(Ce)].transform = { textX: Ce.transform.textX, textY: Ce.transform.textY, anchorX: Ce.transform.anchorX, anchorY: Ce.transform.anchorY, targetX: Ce.transform.targetX, targetY: Ce.transform.targetY, scale: Ce.transform.scale, rotate: Ce.transform.rotate });
        }), S2.each(function(Ce) {
          R2[h(Ce)] = { x0: Ce.x0, x1: Ce.x1, y0: Ce.y0, y1: Ce.y1 }, Ce.transform && (R2[h(Ce)].transform = { textX: Ce.transform.textX, textY: Ce.transform.textY, anchorX: Ce.transform.anchorX, anchorY: Ce.transform.anchorY, targetX: Ce.transform.targetX, targetY: Ce.transform.targetY, scale: Ce.transform.scale, rotate: Ce.transform.rotate }), !q && o.isEntry(Ce) && (q = Ce);
        })), z = g(p, d, k, S2, { width: I2, height: O2, viewX: Z2, viewY: ne, pathSlice: function(Ce) {
          var Be = Z2(Ce.x0), Ue = Z2(Ce.x1), Ke = ne(Ce.y0), ct = ne(Ce.y1), We = Ue - Be, Ze = ct - Ke;
          return !We || !Ze ? "" : "M" + se(Be, Ke + 0) + "L" + se(Ue - 0, Ke) + "L" + se(Ue, ct - 0) + "L" + se(Be + 0, ct) + "Z";
        }, toMoveInsideSlice: be, prevEntry: q, makeUpdateSliceInterpolator: pe, makeUpdateTextInterpolator: ve, handleSlicesExit: Ee, hasTransition: E2, strTransform: Se }), y.pathbar.visible ? f(p, d, k, A2, { barDifY: X2, width: L2, height: V2, viewX: le, viewY: ce, pathSlice: function(Ce) {
          var Be = le(Math.max(Math.min(Ce.x0, Ce.x0), 0)), Ue = le(Math.min(Math.max(Ce.x1, Ce.x1), L2)), Ke = ce(Ce.y0), ct = ce(Ce.y1), We = V2 / 2, Ze = {}, it = {};
          Ze.x = Be, it.x = Ue, Ze.y = it.y = (Ke + ct) / 2;
          var ot = { x: Be, y: Ke }, mt = { x: Ue, y: Ke }, wt = { x: Ue, y: ct }, Et = { x: Be, y: ct };
          return we === ">" ? (ot.x -= We, mt.x -= We, wt.x -= We, Et.x -= We) : we === "/" ? (wt.x -= We, Et.x -= We, Ze.x -= We / 2, it.x -= We / 2) : we === "\\" ? (ot.x -= We, mt.x -= We, Ze.x -= We / 2, it.x -= We / 2) : we === "<" && (Ze.x -= We, it.x -= We), me(ot), me(Et), me(Ze), me(mt), me(wt), me(it), "M" + se(ot.x, ot.y) + "L" + se(mt.x, mt.y) + "L" + se(it.x, it.y) + "L" + se(wt.x, wt.y) + "L" + se(Et.x, Et.y) + "L" + se(Ze.x, Ze.y) + "Z";
        }, toMoveInsideSlice: be, makeUpdateSliceInterpolator: pe, makeUpdateTextInterpolator: ve, handleSlicesExit: Ee, hasTransition: E2, strTransform: Se }) : A2.remove();
      };
    }, { "../../lib": 503, "../bar/constants": 650, "../bar/plot": 659, "../bar/uniform_text": 664, "../sunburst/helpers": 1051, "./constants": 1074, "./draw_ancestors": 1077, "@plotly/d3": 58, "d3-interpolate": 116 }], 1086: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../components/color"), o = e("../../lib"), s = e("../sunburst/helpers"), i = e("../bar/uniform_text").resizeText;
      function l(u2, c, f, h) {
        var p, d, v = (h || {}).hovered, m = c.data.data, g = m.i, x = m.color, b = s.isHierarchyRoot(c), y = 1;
        if (v) p = f._hovered.marker.line.color, d = f._hovered.marker.line.width;
        else if (b && x === f.root.color) y = 100, p = "rgba(0,0,0,0)", d = 0;
        else if (p = o.castOption(f, g, "marker.line.color") || a.defaultLine, d = o.castOption(f, g, "marker.line.width") || 0, !f._hasColorscale && !c.onPathbar) {
          var w = f.marker.depthfade;
          if (w) {
            var _4, k = a.combine(a.addOpacity(f._backgroundColor, 0.75), x);
            if (w === true) {
              var T2 = s.getMaxDepth(f);
              _4 = isFinite(T2) ? s.isLeaf(c) ? 0 : f._maxVisibleLayers - (c.data.depth - f._entryDepth) : c.data.height + 1;
            } else _4 = c.data.depth - f._entryDepth, f._atRootLevel || _4++;
            if (_4 > 0) for (var A2 = 0; A2 < _4; A2++) {
              var S2 = 0.5 * A2 / _4;
              x = a.combine(a.addOpacity(k, S2), x);
            }
          }
        }
        u2.style("stroke-width", d).call(a.fill, x).call(a.stroke, p).style("opacity", y);
      }
      t.exports = { style: function(u2) {
        var c = u2._fullLayout._treemaplayer.selectAll(".trace");
        i(u2, c, "treemap"), c.each(function(f) {
          var h = n.select(this), p = f[0].trace;
          h.style("opacity", p.opacity), h.selectAll("path.surface").each(function(d) {
            n.select(this).call(l, d, p, { hovered: false });
          });
        });
      }, styleOne: l };
    }, { "../../components/color": 366, "../../lib": 503, "../bar/uniform_text": 664, "../sunburst/helpers": 1051, "@plotly/d3": 58 }], 1087: [function(e, t, r) {
      "use strict";
      var n = e("../box/attributes"), a = e("../../lib/extend").extendFlat, o = e("../../plots/cartesian/axis_format_attributes").axisHoverFormat;
      t.exports = { y: n.y, x: n.x, x0: n.x0, y0: n.y0, xhoverformat: o("x"), yhoverformat: o("y"), name: a({}, n.name, {}), orientation: a({}, n.orientation, {}), bandwidth: { valType: "number", min: 0, editType: "calc" }, scalegroup: { valType: "string", dflt: "", editType: "calc" }, scalemode: { valType: "enumerated", values: ["width", "count"], dflt: "width", editType: "calc" }, spanmode: { valType: "enumerated", values: ["soft", "hard", "manual"], dflt: "soft", editType: "calc" }, span: { valType: "info_array", items: [{ valType: "any", editType: "calc" }, { valType: "any", editType: "calc" }], editType: "calc" }, line: { color: { valType: "color", editType: "style" }, width: { valType: "number", min: 0, dflt: 2, editType: "style" }, editType: "plot" }, fillcolor: n.fillcolor, points: a({}, n.boxpoints, {}), jitter: a({}, n.jitter, {}), pointpos: a({}, n.pointpos, {}), width: a({}, n.width, {}), marker: n.marker, text: n.text, hovertext: n.hovertext, hovertemplate: n.hovertemplate, box: { visible: { valType: "boolean", dflt: false, editType: "plot" }, width: { valType: "number", min: 0, max: 1, dflt: 0.25, editType: "plot" }, fillcolor: { valType: "color", editType: "style" }, line: { color: { valType: "color", editType: "style" }, width: { valType: "number", min: 0, editType: "style" }, editType: "style" }, editType: "plot" }, meanline: { visible: { valType: "boolean", dflt: false, editType: "plot" }, color: { valType: "color", editType: "style" }, width: { valType: "number", min: 0, editType: "style" }, editType: "plot" }, side: { valType: "enumerated", values: ["both", "positive", "negative"], dflt: "both", editType: "calc" }, offsetgroup: n.offsetgroup, alignmentgroup: n.alignmentgroup, selected: n.selected, unselected: n.unselected, hoveron: { valType: "flaglist", flags: ["violins", "points", "kde"], dflt: "violins+points+kde", extras: ["all"], editType: "style" } };
    }, { "../../lib/extend": 493, "../../plots/cartesian/axis_format_attributes": 557, "../box/attributes": 673 }], 1088: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../plots/cartesian/axes"), o = e("../box/calc"), s = e("./helpers"), i = e("../../constants/numerical").BADNUM;
      function l(c, f, h) {
        var p = f.max - f.min;
        if (!p) return c.bandwidth ? c.bandwidth : 0;
        if (c.bandwidth) return Math.max(c.bandwidth, p / 1e4);
        var d = h.length, v = n.stdev(h, d - 1, f.mean);
        return Math.max(function(m, g, x) {
          return 1.059 * Math.min(g, x / 1.349) * Math.pow(m, -0.2);
        }(d, v, f.q3 - f.q1), p / 100);
      }
      function u2(c, f, h, p) {
        var d, v = c.spanmode, m = c.span || [], g = [f.min, f.max], x = [f.min - 2 * p, f.max + 2 * p];
        function b(w) {
          var _4 = m[w], k = h.type === "multicategory" ? h.r2c(_4) : h.d2c(_4, 0, c[f.valLetter + "calendar"]);
          return k === i ? x[w] : k;
        }
        var y = { type: "linear", range: d = v === "soft" ? x : v === "hard" ? g : [b(0), b(1)] };
        return a.setConvert(y), y.cleanRange(), d;
      }
      t.exports = function(c, f) {
        var h = o(c, f);
        if (h[0].t.empty) return h;
        for (var p = c._fullLayout, d = a.getFromId(c, f[f.orientation === "h" ? "xaxis" : "yaxis"]), v = 1 / 0, m = -1 / 0, g = 0, x = 0, b = 0; b < h.length; b++) {
          var y = h[b], w = y.pts.map(s.extractVal), _4 = y.bandwidth = l(f, y, w), k = y.span = u2(f, y, d, _4);
          if (y.min === y.max && _4 === 0) k = y.span = [y.min, y.max], y.density = [{ v: 1, t: k[0] }], y.bandwidth = _4, g = Math.max(g, 1);
          else {
            var T2 = k[1] - k[0], A2 = Math.ceil(T2 / (_4 / 3)), S2 = T2 / A2;
            if (!isFinite(S2) || !isFinite(A2)) return n.error("Something went wrong with computing the violin span"), h[0].t.empty = true, h;
            var C2 = s.makeKDE(y, f, w);
            y.density = new Array(A2);
            for (var E2 = 0, F13 = k[0]; F13 < k[1] + S2 / 2; E2++, F13 += S2) {
              var N2 = C2(F13);
              y.density[E2] = { v: N2, t: F13 }, g = Math.max(g, N2);
            }
          }
          x = Math.max(x, w.length), v = Math.min(v, k[0]), m = Math.max(m, k[1]);
        }
        var D2 = a.findExtremes(d, [v, m], { padded: true });
        if (f._extremes[d._id] = D2, f.width) h[0].t.maxKDE = g;
        else {
          var I2 = p._violinScaleGroupStats, O2 = f.scalegroup, L2 = I2[O2];
          L2 ? (L2.maxKDE = Math.max(L2.maxKDE, g), L2.maxCount = Math.max(L2.maxCount, x)) : I2[O2] = { maxKDE: g, maxCount: x };
        }
        return h[0].t.labels.kde = n._(c, "kde:"), h;
      };
    }, { "../../constants/numerical": 479, "../../lib": 503, "../../plots/cartesian/axes": 554, "../box/calc": 674, "./helpers": 1091 }], 1089: [function(e, t, r) {
      "use strict";
      var n = e("../box/cross_trace_calc").setPositionOffset, a = ["v", "h"];
      t.exports = function(o, s) {
        for (var i = o.calcdata, l = s.xaxis, u2 = s.yaxis, c = 0; c < a.length; c++) {
          for (var f = a[c], h = f === "h" ? u2 : l, p = [], d = 0; d < i.length; d++) {
            var v = i[d], m = v[0].t, g = v[0].trace;
            g.visible !== true || g.type !== "violin" || m.empty || g.orientation !== f || g.xaxis !== l._id || g.yaxis !== u2._id || p.push(d);
          }
          n("violin", o, p, h);
        }
      };
    }, { "../box/cross_trace_calc": 675 }], 1090: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../components/color"), o = e("../box/defaults"), s = e("./attributes");
      t.exports = function(i, l, u2, c) {
        function f(T2, A2) {
          return n.coerce(i, l, s, T2, A2);
        }
        function h(T2, A2) {
          return n.coerce2(i, l, s, T2, A2);
        }
        if (o.handleSampleDefaults(i, l, f, c), l.visible !== false) {
          f("bandwidth"), f("side"), f("width") || (f("scalegroup", l.name), f("scalemode"));
          var p, d = f("span");
          Array.isArray(d) && (p = "manual"), f("spanmode", p);
          var v = f("line.color", (i.marker || {}).color || u2), m = f("line.width"), g = f("fillcolor", a.addOpacity(l.line.color, 0.5));
          o.handlePointsDefaults(i, l, f, { prefix: "" });
          var x = h("box.width"), b = h("box.fillcolor", g), y = h("box.line.color", v), w = h("box.line.width", m);
          f("box.visible", Boolean(x || b || y || w)) || (l.box = { visible: false });
          var _4 = h("meanline.color", v), k = h("meanline.width", m);
          f("meanline.visible", Boolean(_4 || k)) || (l.meanline = { visible: false });
        }
      };
    }, { "../../components/color": 366, "../../lib": 503, "../box/defaults": 676, "./attributes": 1087 }], 1091: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = function(o) {
        return 1 / Math.sqrt(2 * Math.PI) * Math.exp(-0.5 * o * o);
      };
      r.makeKDE = function(o, s, i) {
        var l = i.length, u2 = a, c = o.bandwidth, f = 1 / (l * c);
        return function(h) {
          for (var p = 0, d = 0; d < l; d++) p += u2((h - i[d]) / c);
          return f * p;
        };
      }, r.getPositionOnKdePath = function(o, s, i) {
        var l, u2;
        s.orientation === "h" ? (l = "y", u2 = "x") : (l = "x", u2 = "y");
        var c = n.findPointOnPath(o.path, i, u2, { pathLength: o.pathLength }), f = o.posCenterPx, h = c[l];
        return [h, s.side === "both" ? 2 * f - h : f];
      }, r.getKdeValue = function(o, s, i) {
        var l = o.pts.map(r.extractVal);
        return r.makeKDE(o, s, l)(i) / o.posDensityScale;
      }, r.extractVal = function(o) {
        return o.v;
      };
    }, { "../../lib": 503 }], 1092: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../../plots/cartesian/axes"), o = e("../box/hover"), s = e("./helpers");
      t.exports = function(i, l, u2, c, f) {
        f || (f = {});
        var h, p, d = f.hoverLayer, v = i.cd, m = v[0].trace, g = m.hoveron, x = g.indexOf("violins") !== -1, b = g.indexOf("kde") !== -1, y = [];
        if (x || b) {
          var w = o.hoverOnBoxes(i, l, u2, c);
          if (b && w.length > 0) {
            var _4, k, T2, A2, S2, C2 = i.xa, E2 = i.ya;
            m.orientation === "h" ? (S2 = l, _4 = "y", T2 = E2, k = "x", A2 = C2) : (S2 = u2, _4 = "x", T2 = C2, k = "y", A2 = E2);
            var F13 = v[i.index];
            if (S2 >= F13.span[0] && S2 <= F13.span[1]) {
              var N2 = n.extendFlat({}, i), D2 = A2.c2p(S2, true), I2 = s.getKdeValue(F13, m, S2), O2 = s.getPositionOnKdePath(F13, m, D2), L2 = T2._offset, V2 = T2._length;
              N2[_4 + "0"] = O2[0], N2[_4 + "1"] = O2[1], N2[k + "0"] = N2[k + "1"] = D2, N2[k + "Label"] = k + ": " + a.hoverLabelText(A2, S2, m[k + "hoverformat"]) + ", " + v[0].t.labels.kde + " " + I2.toFixed(3), N2.spikeDistance = w[0].spikeDistance;
              var W2 = _4 + "Spike";
              N2[W2] = w[0][W2], w[0].spikeDistance = void 0, w[0][W2] = void 0, N2.hovertemplate = false, y.push(N2), (p = { stroke: i.color })[_4 + "1"] = n.constrain(L2 + O2[0], L2, L2 + V2), p[_4 + "2"] = n.constrain(L2 + O2[1], L2, L2 + V2), p[k + "1"] = p[k + "2"] = A2._offset + D2;
            }
          }
          x && (y = y.concat(w));
        }
        g.indexOf("points") !== -1 && (h = o.hoverOnPoints(i, l, u2));
        var X2 = d.selectAll(".violinline-" + m.uid).data(p ? [0] : []);
        return X2.enter().append("line").classed("violinline-" + m.uid, true).attr("stroke-width", 1.5), X2.exit().remove(), X2.attr(p), c === "closest" ? h ? [h] : y : (h && y.push(h), y);
      };
    }, { "../../lib": 503, "../../plots/cartesian/axes": 554, "../box/hover": 678, "./helpers": 1091 }], 1093: [function(e, t, r) {
      "use strict";
      t.exports = { attributes: e("./attributes"), layoutAttributes: e("./layout_attributes"), supplyDefaults: e("./defaults"), crossTraceDefaults: e("../box/defaults").crossTraceDefaults, supplyLayoutDefaults: e("./layout_defaults"), calc: e("./calc"), crossTraceCalc: e("./cross_trace_calc"), plot: e("./plot"), style: e("./style"), styleOnSelect: e("../scatter/style").styleOnSelect, hoverPoints: e("./hover"), selectPoints: e("../box/select"), moduleType: "trace", name: "violin", basePlotModule: e("../../plots/cartesian"), categories: ["cartesian", "svg", "symbols", "oriented", "box-violin", "showLegend", "violinLayout", "zoomScale"], meta: {} };
    }, { "../../plots/cartesian": 568, "../box/defaults": 676, "../box/select": 683, "../scatter/style": 950, "./attributes": 1087, "./calc": 1088, "./cross_trace_calc": 1089, "./defaults": 1090, "./hover": 1092, "./layout_attributes": 1094, "./layout_defaults": 1095, "./plot": 1096, "./style": 1097 }], 1094: [function(e, t, r) {
      "use strict";
      var n = e("../box/layout_attributes"), a = e("../../lib").extendFlat;
      t.exports = { violinmode: a({}, n.boxmode, {}), violingap: a({}, n.boxgap, {}), violingroupgap: a({}, n.boxgroupgap, {}) };
    }, { "../../lib": 503, "../box/layout_attributes": 680 }], 1095: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("./layout_attributes"), o = e("../box/layout_defaults");
      t.exports = function(s, i, l) {
        o._supply(s, i, l, function(u2, c) {
          return n.coerce(s, i, a, u2, c);
        }, "violin");
      };
    }, { "../../lib": 503, "../box/layout_defaults": 681, "./layout_attributes": 1094 }], 1096: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../lib"), o = e("../../components/drawing"), s = e("../box/plot"), i = e("../scatter/line_points"), l = e("./helpers");
      t.exports = function(u2, c, f, h) {
        var p = u2._fullLayout, d = c.xaxis, v = c.yaxis;
        function m(g) {
          var x = i(g, { xaxis: d, yaxis: v, connectGaps: true, baseTolerance: 0.75, shape: "spline", simplify: true, linearized: true });
          return o.smoothopen(x[0], 1);
        }
        a.makeTraceGroups(h, f, "trace violins").each(function(g) {
          var x = n.select(this), b = g[0], y = b.t, w = b.trace;
          if (w.visible !== true || y.empty) x.remove();
          else {
            var _4 = y.bPos, k = y.bdPos, T2 = c[y.valLetter + "axis"], A2 = c[y.posLetter + "axis"], S2 = w.side === "both", C2 = S2 || w.side === "positive", E2 = S2 || w.side === "negative", F13 = x.selectAll("path.violin").data(a.identity);
            F13.enter().append("path").style("vector-effect", "non-scaling-stroke").attr("class", "violin"), F13.exit().remove(), F13.each(function(X2) {
              var Y2, K2, q, re, R2, z, H2, te, j = n.select(this), Q2 = X2.density, Z2 = Q2.length, ne = A2.c2l(X2.pos + _4, true), ae = A2.l2p(ne);
              if (w.width) Y2 = y.maxKDE / k;
              else {
                var ue = p._violinScaleGroupStats[w.scalegroup];
                Y2 = w.scalemode === "count" ? ue.maxKDE / k * (ue.maxCount / X2.pts.length) : ue.maxKDE / k;
              }
              if (C2) {
                for (H2 = new Array(Z2), R2 = 0; R2 < Z2; R2++) (te = H2[R2] = {})[y.posLetter] = ne + Q2[R2].v / Y2, te[y.valLetter] = T2.c2l(Q2[R2].t, true);
                K2 = m(H2);
              }
              if (E2) {
                for (H2 = new Array(Z2), z = 0, R2 = Z2 - 1; z < Z2; z++, R2--) (te = H2[z] = {})[y.posLetter] = ne - Q2[R2].v / Y2, te[y.valLetter] = T2.c2l(Q2[R2].t, true);
                q = m(H2);
              }
              if (S2) re = K2 + "L" + q.substr(1) + "Z";
              else {
                var le = [ae, T2.c2p(Q2[0].t)], ce = [ae, T2.c2p(Q2[Z2 - 1].t)];
                w.orientation === "h" && (le.reverse(), ce.reverse()), re = C2 ? "M" + le + "L" + K2.substr(1) + "L" + ce : "M" + ce + "L" + q.substr(1) + "L" + le;
              }
              j.attr("d", re), X2.posCenterPx = ae, X2.posDensityScale = Y2 * k, X2.path = j.node(), X2.pathLength = X2.path.getTotalLength() / (S2 ? 2 : 1);
            });
            var N2, D2, I2, O2 = w.box, L2 = O2.width, V2 = (O2.line || {}).width;
            S2 ? (N2 = k * L2, D2 = 0) : C2 ? (N2 = [0, k * L2 / 2], D2 = V2 * { x: 1, y: -1 }[y.posLetter]) : (N2 = [k * L2 / 2, 0], D2 = V2 * { x: -1, y: 1 }[y.posLetter]), s.plotBoxAndWhiskers(x, { pos: A2, val: T2 }, w, { bPos: _4, bdPos: N2, bPosPxOffset: D2 }), s.plotBoxMean(x, { pos: A2, val: T2 }, w, { bPos: _4, bdPos: N2, bPosPxOffset: D2 }), !w.box.visible && w.meanline.visible && (I2 = a.identity);
            var W2 = x.selectAll("path.meanline").data(I2 || []);
            W2.enter().append("path").attr("class", "meanline").style("fill", "none").style("vector-effect", "non-scaling-stroke"), W2.exit().remove(), W2.each(function(X2) {
              var Y2 = T2.c2p(X2.mean, true), K2 = l.getPositionOnKdePath(X2, w, Y2);
              n.select(this).attr("d", w.orientation === "h" ? "M" + Y2 + "," + K2[0] + "V" + K2[1] : "M" + K2[0] + "," + Y2 + "H" + K2[1]);
            }), s.plotPoints(x, { x: d, y: v }, w, y);
          }
        });
      };
    }, { "../../components/drawing": 388, "../../lib": 503, "../box/plot": 682, "../scatter/line_points": 940, "./helpers": 1091, "@plotly/d3": 58 }], 1097: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../components/color"), o = e("../scatter/style").stylePoints;
      t.exports = function(s) {
        var i = n.select(s).selectAll("g.trace.violins");
        i.style("opacity", function(l) {
          return l[0].trace.opacity;
        }), i.each(function(l) {
          var u2 = l[0].trace, c = n.select(this), f = u2.box || {}, h = f.line || {}, p = u2.meanline || {}, d = p.width;
          c.selectAll("path.violin").style("stroke-width", u2.line.width + "px").call(a.stroke, u2.line.color).call(a.fill, u2.fillcolor), c.selectAll("path.box").style("stroke-width", h.width + "px").call(a.stroke, h.color).call(a.fill, f.fillcolor);
          var v = { "stroke-width": d + "px", "stroke-dasharray": 2 * d + "px," + d + "px" };
          c.selectAll("path.mean").style(v).call(a.stroke, p.color), c.selectAll("path.meanline").style(v).call(a.stroke, p.color), o(c, u2, s);
        });
      };
    }, { "../../components/color": 366, "../scatter/style": 950, "@plotly/d3": 58 }], 1098: [function(e, t, r) {
      "use strict";
      var n = e("../../components/colorscale/attributes"), a = e("../isosurface/attributes"), o = e("../surface/attributes"), s = e("../../plots/attributes"), i = e("../../lib/extend").extendFlat, l = e("../../plot_api/edit_types").overrideAll, u2 = t.exports = l(i({ x: a.x, y: a.y, z: a.z, value: a.value, isomin: a.isomin, isomax: a.isomax, surface: a.surface, spaceframe: { show: { valType: "boolean", dflt: false }, fill: { valType: "number", min: 0, max: 1, dflt: 1 } }, slices: a.slices, caps: a.caps, text: a.text, hovertext: a.hovertext, xhoverformat: a.xhoverformat, yhoverformat: a.yhoverformat, zhoverformat: a.zhoverformat, valuehoverformat: a.valuehoverformat, hovertemplate: a.hovertemplate }, n("", { colorAttr: "`value`", showScaleDflt: true, editTypeOverride: "calc" }), { colorbar: a.colorbar, opacity: a.opacity, opacityscale: o.opacityscale, lightposition: a.lightposition, lighting: a.lighting, flatshading: a.flatshading, contour: a.contour, hoverinfo: i({}, s.hoverinfo), showlegend: i({}, s.showlegend, { dflt: false }) }), "calc", "nested");
      u2.x.editType = u2.y.editType = u2.z.editType = u2.value.editType = "calc+clearAxisTypes", u2.transforms = void 0;
    }, { "../../components/colorscale/attributes": 373, "../../lib/extend": 493, "../../plot_api/edit_types": 536, "../../plots/attributes": 550, "../isosurface/attributes": 862, "../surface/attributes": 1057 }], 1099: [function(e, t, r) {
      "use strict";
      var n = e("../../../stackgl_modules").gl_mesh3d, a = e("../../lib/gl_format_color").parseColorScale, o = e("../../lib/str2rgbarray"), s = e("../../components/colorscale").extractOpts, i = e("../../plots/gl3d/zip3"), l = e("../isosurface/convert").findNearestOnAxis, u2 = e("../isosurface/convert").generateIsoMeshes;
      function c(h, p, d) {
        this.scene = h, this.uid = d, this.mesh = p, this.name = "", this.data = null, this.showContour = false;
      }
      var f = c.prototype;
      f.handlePick = function(h) {
        if (h.object === this.mesh) {
          var p = h.data.index, d = this.data._meshX[p], v = this.data._meshY[p], m = this.data._meshZ[p], g = this.data._Ys.length, x = this.data._Zs.length, b = l(d, this.data._Xs).id, y = l(v, this.data._Ys).id, w = l(m, this.data._Zs).id, _4 = h.index = w + x * y + x * g * b;
          h.traceCoordinate = [this.data._meshX[_4], this.data._meshY[_4], this.data._meshZ[_4], this.data._value[_4]];
          var k = this.data.hovertext || this.data.text;
          return Array.isArray(k) && k[_4] !== void 0 ? h.textLabel = k[_4] : k && (h.textLabel = k), true;
        }
      }, f.update = function(h) {
        var p = this.scene, d = p.fullSceneLayout;
        function v(x, b, y, w) {
          return b.map(function(_4) {
            return x.d2l(_4, 0, w) * y;
          });
        }
        this.data = u2(h);
        var m = { positions: i(v(d.xaxis, h._meshX, p.dataScale[0], h.xcalendar), v(d.yaxis, h._meshY, p.dataScale[1], h.ycalendar), v(d.zaxis, h._meshZ, p.dataScale[2], h.zcalendar)), cells: i(h._meshI, h._meshJ, h._meshK), lightPosition: [h.lightposition.x, h.lightposition.y, h.lightposition.z], ambient: h.lighting.ambient, diffuse: h.lighting.diffuse, specular: h.lighting.specular, roughness: h.lighting.roughness, fresnel: h.lighting.fresnel, vertexNormalsEpsilon: h.lighting.vertexnormalsepsilon, faceNormalsEpsilon: h.lighting.facenormalsepsilon, opacity: h.opacity, opacityscale: h.opacityscale, contourEnable: h.contour.show, contourColor: o(h.contour.color).slice(0, 3), contourWidth: h.contour.width, useFacetNormals: h.flatshading }, g = s(h);
        m.vertexIntensity = h._meshIntensity, m.vertexIntensityBounds = [g.min, g.max], m.colormap = a(h), this.mesh.update(m);
      }, f.dispose = function() {
        this.scene.glplot.remove(this.mesh), this.mesh.dispose();
      }, t.exports = function(h, p) {
        var d = h.glplot.gl, v = n({ gl: d }), m = new c(h, v, p.uid);
        return v._trace = m, m.update(p), h.glplot.add(v), m;
      };
    }, { "../../../stackgl_modules": 1120, "../../components/colorscale": 378, "../../lib/gl_format_color": 499, "../../lib/str2rgbarray": 528, "../../plots/gl3d/zip3": 609, "../isosurface/convert": 864 }], 1100: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("./attributes"), o = e("../isosurface/defaults").supplyIsoDefaults, s = e("../surface/defaults").opacityscaleDefaults;
      t.exports = function(i, l, u2, c) {
        function f(h, p) {
          return n.coerce(i, l, a, h, p);
        }
        o(i, l, u2, c, f), s(i, l, c, f);
      };
    }, { "../../lib": 503, "../isosurface/defaults": 865, "../surface/defaults": 1060, "./attributes": 1098 }], 1101: [function(e, t, r) {
      "use strict";
      t.exports = { attributes: e("./attributes"), supplyDefaults: e("./defaults"), calc: e("../isosurface/calc"), colorbar: { min: "cmin", max: "cmax" }, plot: e("./convert"), moduleType: "trace", name: "volume", basePlotModule: e("../../plots/gl3d"), categories: ["gl3d", "showLegend"], meta: {} };
    }, { "../../plots/gl3d": 598, "../isosurface/calc": 863, "./attributes": 1098, "./convert": 1099, "./defaults": 1100 }], 1102: [function(e, t, r) {
      "use strict";
      var n = e("../bar/attributes"), a = e("../scatter/attributes").line, o = e("../../plots/attributes"), s = e("../../plots/cartesian/axis_format_attributes").axisHoverFormat, i = e("../../plots/template_attributes").hovertemplateAttrs, l = e("../../plots/template_attributes").texttemplateAttrs, u2 = e("./constants"), c = e("../../lib/extend").extendFlat, f = e("../../components/color");
      function h(p) {
        return { marker: { color: c({}, n.marker.color, { arrayOk: false, editType: "style" }), line: { color: c({}, n.marker.line.color, { arrayOk: false, editType: "style" }), width: c({}, n.marker.line.width, { arrayOk: false, editType: "style" }), editType: "style" }, editType: "style" }, editType: "style" };
      }
      t.exports = { measure: { valType: "data_array", dflt: [], editType: "calc" }, base: { valType: "number", dflt: null, arrayOk: false, editType: "calc" }, x: n.x, x0: n.x0, dx: n.dx, y: n.y, y0: n.y0, dy: n.dy, xperiod: n.xperiod, yperiod: n.yperiod, xperiod0: n.xperiod0, yperiod0: n.yperiod0, xperiodalignment: n.xperiodalignment, yperiodalignment: n.yperiodalignment, xhoverformat: s("x"), yhoverformat: s("y"), hovertext: n.hovertext, hovertemplate: i({}, { keys: u2.eventDataKeys }), hoverinfo: c({}, o.hoverinfo, { flags: ["name", "x", "y", "text", "initial", "delta", "final"] }), textinfo: { valType: "flaglist", flags: ["label", "text", "initial", "delta", "final"], extras: ["none"], editType: "plot", arrayOk: false }, texttemplate: l({ editType: "plot" }, { keys: u2.eventDataKeys.concat(["label"]) }), text: n.text, textposition: n.textposition, insidetextanchor: n.insidetextanchor, textangle: n.textangle, textfont: n.textfont, insidetextfont: n.insidetextfont, outsidetextfont: n.outsidetextfont, constraintext: n.constraintext, cliponaxis: n.cliponaxis, orientation: n.orientation, offset: n.offset, width: n.width, increasing: h(), decreasing: h(), totals: h(), connector: { line: { color: c({}, a.color, { dflt: f.defaultLine }), width: c({}, a.width, { editType: "plot" }), dash: a.dash, editType: "plot" }, mode: { valType: "enumerated", values: ["spanning", "between"], dflt: "between", editType: "plot" }, visible: { valType: "boolean", dflt: true, editType: "plot" }, editType: "plot" }, offsetgroup: n.offsetgroup, alignmentgroup: n.alignmentgroup };
    }, { "../../components/color": 366, "../../lib/extend": 493, "../../plots/attributes": 550, "../../plots/cartesian/axis_format_attributes": 557, "../../plots/template_attributes": 633, "../bar/attributes": 648, "../scatter/attributes": 926, "./constants": 1104 }], 1103: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/cartesian/axes"), a = e("../../plots/cartesian/align_period"), o = e("../../lib").mergeArray, s = e("../scatter/calc_selection"), i = e("../../constants/numerical").BADNUM;
      function l(c) {
        return c === "a" || c === "absolute";
      }
      function u2(c) {
        return c === "t" || c === "total";
      }
      t.exports = function(c, f) {
        var h, p, d, v, m, g, x = n.getFromId(c, f.xaxis || "x"), b = n.getFromId(c, f.yaxis || "y");
        f.orientation === "h" ? (h = x.makeCalcdata(f, "x"), d = b.makeCalcdata(f, "y"), v = a(f, b, "y", d), m = !!f.yperiodalignment, g = "y") : (h = b.makeCalcdata(f, "y"), d = x.makeCalcdata(f, "x"), v = a(f, x, "x", d), m = !!f.xperiodalignment, g = "x"), p = v.vals;
        for (var y, w = Math.min(p.length, h.length), _4 = new Array(w), k = 0, T2 = false, A2 = 0; A2 < w; A2++) {
          var S2 = h[A2] || 0, C2 = false;
          (h[A2] !== i || u2(f.measure[A2]) || l(f.measure[A2])) && A2 + 1 < w && (h[A2 + 1] !== i || u2(f.measure[A2 + 1]) || l(f.measure[A2 + 1])) && (C2 = true);
          var E2 = _4[A2] = { i: A2, p: p[A2], s: S2, rawS: S2, cNext: C2 };
          l(f.measure[A2]) ? (k = E2.s, E2.isSum = true, E2.dir = "totals", E2.s = k) : u2(f.measure[A2]) ? (E2.isSum = true, E2.dir = "totals", E2.s = k) : (E2.isSum = false, E2.dir = E2.rawS < 0 ? "decreasing" : "increasing", y = E2.s, E2.s = k + y, k += y), E2.dir === "totals" && (T2 = true), m && (_4[A2].orig_p = d[A2], _4[A2][g + "End"] = v.ends[A2], _4[A2][g + "Start"] = v.starts[A2]), f.ids && (E2.id = String(f.ids[A2])), E2.v = (f.base || 0) + k;
        }
        return _4.length && (_4[0].hasTotals = T2), o(f.text, _4, "tx"), o(f.hovertext, _4, "htx"), s(_4, f), _4;
      };
    }, { "../../constants/numerical": 479, "../../lib": 503, "../../plots/cartesian/align_period": 551, "../../plots/cartesian/axes": 554, "../scatter/calc_selection": 928 }], 1104: [function(e, t, r) {
      "use strict";
      t.exports = { eventDataKeys: ["initial", "delta", "final"] };
    }, {}], 1105: [function(e, t, r) {
      "use strict";
      var n = e("../bar/cross_trace_calc").setGroupPositions;
      t.exports = function(a, o) {
        var s, i, l = a._fullLayout, u2 = a._fullData, c = a.calcdata, f = o.xaxis, h = o.yaxis, p = [], d = [], v = [];
        for (i = 0; i < u2.length; i++) {
          var m = u2[i];
          m.visible === true && m.xaxis === f._id && m.yaxis === h._id && m.type === "waterfall" && (s = c[i], m.orientation === "h" ? v.push(s) : d.push(s), p.push(s));
        }
        var g = { mode: l.waterfallmode, norm: l.waterfallnorm, gap: l.waterfallgap, groupgap: l.waterfallgroupgap };
        for (n(a, f, h, d, g), n(a, h, f, v, g), i = 0; i < p.length; i++) {
          s = p[i];
          for (var x = 0; x < s.length; x++) {
            var b = s[x];
            b.isSum === false && (b.s0 += x === 0 ? 0 : s[x - 1].s), x + 1 < s.length && (s[x].nextP0 = s[x + 1].p0, s[x].nextS0 = s[x + 1].s0);
          }
        }
      };
    }, { "../bar/cross_trace_calc": 651 }], 1106: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("../bar/defaults").handleGroupingDefaults, o = e("../bar/defaults").handleText, s = e("../scatter/xy_defaults"), i = e("../scatter/period_defaults"), l = e("./attributes"), u2 = e("../../components/color"), c = e("../../constants/delta.js"), f = c.INCREASING.COLOR, h = c.DECREASING.COLOR;
      function p(d, v, m) {
        d(v + ".marker.color", m), d(v + ".marker.line.color", u2.defaultLine), d(v + ".marker.line.width");
      }
      t.exports = { supplyDefaults: function(d, v, m, g) {
        function x(y, w) {
          return n.coerce(d, v, l, y, w);
        }
        if (s(d, v, g, x)) {
          i(d, v, g, x), x("xhoverformat"), x("yhoverformat"), x("measure"), x("orientation", v.x && !v.y ? "h" : "v"), x("base"), x("offset"), x("width"), x("text"), x("hovertext"), x("hovertemplate");
          var b = x("textposition");
          o(d, v, g, x, b, { moduleHasSelected: false, moduleHasUnselected: false, moduleHasConstrain: true, moduleHasCliponaxis: true, moduleHasTextangle: true, moduleHasInsideanchor: true }), v.textposition !== "none" && (x("texttemplate"), v.texttemplate || x("textinfo")), p(x, "increasing", f), p(x, "decreasing", h), p(x, "totals", "#4499FF"), x("connector.visible") && (x("connector.mode"), x("connector.line.width") && (x("connector.line.color"), x("connector.line.dash")));
        } else v.visible = false;
      }, crossTraceDefaults: function(d, v) {
        var m, g;
        function x(y) {
          return n.coerce(g._input, g, l, y);
        }
        if (v.waterfallmode === "group") for (var b = 0; b < d.length; b++) m = (g = d[b])._input, a(m, g, v, x);
      } };
    }, { "../../components/color": 366, "../../constants/delta.js": 473, "../../lib": 503, "../bar/defaults": 652, "../scatter/period_defaults": 946, "../scatter/xy_defaults": 953, "./attributes": 1102 }], 1107: [function(e, t, r) {
      "use strict";
      t.exports = function(n, a) {
        return n.x = "xVal" in a ? a.xVal : a.x, n.y = "yVal" in a ? a.yVal : a.y, "initial" in a && (n.initial = a.initial), "delta" in a && (n.delta = a.delta), "final" in a && (n.final = a.final), a.xa && (n.xaxis = a.xa), a.ya && (n.yaxis = a.ya), n;
      };
    }, {}], 1108: [function(e, t, r) {
      "use strict";
      var n = e("../../plots/cartesian/axes").hoverLabelText, a = e("../../components/color").opacity, o = e("../bar/hover").hoverOnBars, s = e("../../constants/delta.js"), i = s.INCREASING.SYMBOL, l = s.DECREASING.SYMBOL;
      t.exports = function(u2, c, f, h, p) {
        var d = o(u2, c, f, h, p);
        if (d) {
          var v = d.cd, m = v[0].trace, g = m.orientation === "h", x = g ? "x" : "y", b = g ? u2.xa : u2.ya, y = v[d.index], w = y.isSum ? y.b + y.s : y.rawS;
          if (!y.isSum) {
            d.initial = y.b + y.s - w, d.delta = w, d.final = d.initial + d.delta;
            var _4 = E2(Math.abs(d.delta));
            d.deltaLabel = w < 0 ? "(" + _4 + ")" : _4, d.finalLabel = E2(d.final), d.initialLabel = E2(d.initial);
          }
          var k = y.hi || m.hoverinfo, T2 = [];
          if (k && k !== "none" && k !== "skip") {
            var A2 = k === "all", S2 = k.split("+"), C2 = function(F13) {
              return A2 || S2.indexOf(F13) !== -1;
            };
            y.isSum || (!C2("final") || C2(g ? "x" : "y") || T2.push(d.finalLabel), C2("delta") && (w < 0 ? T2.push(d.deltaLabel + " " + l) : T2.push(d.deltaLabel + " " + i)), C2("initial") && T2.push("Initial: " + d.initialLabel));
          }
          return T2.length && (d.extraText = T2.join("<br>")), d.color = function(F13, N2) {
            var D2 = F13[N2.dir].marker, I2 = D2.color, O2 = D2.line.color, L2 = D2.line.width;
            if (a(I2)) return I2;
            if (a(O2) && L2) return O2;
          }(m, y), [d];
        }
        function E2(F13) {
          return n(b, F13, m[x + "hoverformat"]);
        }
      };
    }, { "../../components/color": 366, "../../constants/delta.js": 473, "../../plots/cartesian/axes": 554, "../bar/hover": 655 }], 1109: [function(e, t, r) {
      "use strict";
      t.exports = { attributes: e("./attributes"), layoutAttributes: e("./layout_attributes"), supplyDefaults: e("./defaults").supplyDefaults, crossTraceDefaults: e("./defaults").crossTraceDefaults, supplyLayoutDefaults: e("./layout_defaults"), calc: e("./calc"), crossTraceCalc: e("./cross_trace_calc"), plot: e("./plot"), style: e("./style").style, hoverPoints: e("./hover"), eventData: e("./event_data"), selectPoints: e("../bar/select"), moduleType: "trace", name: "waterfall", basePlotModule: e("../../plots/cartesian"), categories: ["bar-like", "cartesian", "svg", "oriented", "showLegend", "zoomScale"], meta: {} };
    }, { "../../plots/cartesian": 568, "../bar/select": 660, "./attributes": 1102, "./calc": 1103, "./cross_trace_calc": 1105, "./defaults": 1106, "./event_data": 1107, "./hover": 1108, "./layout_attributes": 1110, "./layout_defaults": 1111, "./plot": 1112, "./style": 1113 }], 1110: [function(e, t, r) {
      "use strict";
      t.exports = { waterfallmode: { valType: "enumerated", values: ["group", "overlay"], dflt: "group", editType: "calc" }, waterfallgap: { valType: "number", min: 0, max: 1, editType: "calc" }, waterfallgroupgap: { valType: "number", min: 0, max: 1, dflt: 0, editType: "calc" } };
    }, {}], 1111: [function(e, t, r) {
      "use strict";
      var n = e("../../lib"), a = e("./layout_attributes");
      t.exports = function(o, s, i) {
        var l = false;
        function u2(h, p) {
          return n.coerce(o, s, a, h, p);
        }
        for (var c = 0; c < i.length; c++) {
          var f = i[c];
          if (f.visible && f.type === "waterfall") {
            l = true;
            break;
          }
        }
        l && (u2("waterfallmode"), u2("waterfallgap", 0.2), u2("waterfallgroupgap"));
      };
    }, { "../../lib": 503, "./layout_attributes": 1110 }], 1112: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../lib"), o = e("../../components/drawing"), s = e("../../constants/numerical").BADNUM, i = e("../bar/plot"), l = e("../bar/uniform_text").clearMinTextSize;
      t.exports = function(u2, c, f, h) {
        var p = u2._fullLayout;
        l("waterfall", p), i.plot(u2, c, f, h, { mode: p.waterfallmode, norm: p.waterfallmode, gap: p.waterfallgap, groupgap: p.waterfallgroupgap }), function(d, v, m, g) {
          var x = v.xaxis, b = v.yaxis;
          a.makeTraceGroups(g, m, "trace bars").each(function(y) {
            var w = n.select(this), _4 = y[0].trace, k = a.ensureSingle(w, "g", "lines");
            if (_4.connector && _4.connector.visible) {
              var T2 = _4.orientation === "h", A2 = _4.connector.mode, S2 = k.selectAll("g.line").data(a.identity);
              S2.enter().append("g").classed("line", true), S2.exit().remove();
              var C2 = S2.size();
              S2.each(function(E2, F13) {
                if (F13 === C2 - 1 || E2.cNext) {
                  var N2 = function(L2, V2, W2, X2) {
                    var Y2 = [], K2 = [], q = X2 ? V2 : W2, re = X2 ? W2 : V2;
                    return Y2[0] = q.c2p(L2.s0, true), K2[0] = re.c2p(L2.p0, true), Y2[1] = q.c2p(L2.s1, true), K2[1] = re.c2p(L2.p1, true), Y2[2] = q.c2p(L2.nextS0, true), K2[2] = re.c2p(L2.nextP0, true), X2 ? [Y2, K2] : [K2, Y2];
                  }(E2, x, b, T2), D2 = N2[0], I2 = N2[1], O2 = "";
                  D2[0] !== s && I2[0] !== s && D2[1] !== s && I2[1] !== s && (A2 === "spanning" && !E2.isSum && F13 > 0 && (O2 += T2 ? "M" + D2[0] + "," + I2[1] + "V" + I2[0] : "M" + D2[1] + "," + I2[0] + "H" + D2[0]), A2 !== "between" && (E2.isSum || F13 < C2 - 1) && (O2 += T2 ? "M" + D2[1] + "," + I2[0] + "V" + I2[1] : "M" + D2[0] + "," + I2[1] + "H" + D2[1]), D2[2] !== s && I2[2] !== s && (O2 += T2 ? "M" + D2[1] + "," + I2[1] + "V" + I2[2] : "M" + D2[1] + "," + I2[1] + "H" + D2[2])), O2 === "" && (O2 = "M0,0Z"), a.ensureSingle(n.select(this), "path").attr("d", O2).call(o.setClipUrl, v.layerClipId, d);
                }
              });
            } else k.remove();
          });
        }(u2, c, f, h);
      };
    }, { "../../components/drawing": 388, "../../constants/numerical": 479, "../../lib": 503, "../bar/plot": 659, "../bar/uniform_text": 664, "@plotly/d3": 58 }], 1113: [function(e, t, r) {
      "use strict";
      var n = e("@plotly/d3"), a = e("../../components/drawing"), o = e("../../components/color"), s = e("../../constants/interactions").DESELECTDIM, i = e("../bar/style"), l = e("../bar/uniform_text").resizeText, u2 = i.styleTextPoints;
      t.exports = { style: function(c, f, h) {
        var p = h || n.select(c).selectAll("g.waterfalllayer").selectAll("g.trace");
        l(c, p, "waterfall"), p.style("opacity", function(d) {
          return d[0].trace.opacity;
        }), p.each(function(d) {
          var v = n.select(this), m = d[0].trace;
          v.selectAll(".point > path").each(function(g) {
            if (!g.isBlank) {
              var x = m[g.dir].marker;
              n.select(this).call(o.fill, x.color).call(o.stroke, x.line.color).call(a.dashLine, x.line.dash, x.line.width).style("opacity", m.selectedpoints && !g.selected ? s : 1);
            }
          }), u2(v, m, c), v.selectAll(".lines").each(function() {
            var g = m.connector.line;
            a.lineGroupStyle(n.select(this).selectAll("path"), g.width, g.color, g.dash);
          });
        });
      } };
    }, { "../../components/color": 366, "../../components/drawing": 388, "../../constants/interactions": 478, "../bar/style": 662, "../bar/uniform_text": 664, "@plotly/d3": 58 }], 1114: [function(e, t, r) {
      "use strict";
      var n = e("../plots/cartesian/axes"), a = e("../lib"), o = e("../plot_api/plot_schema"), s = e("./helpers").pointsAccessorFunction, i = e("../constants/numerical").BADNUM;
      r.moduleType = "transform", r.name = "aggregate";
      var l = r.attributes = { enabled: { valType: "boolean", dflt: true, editType: "calc" }, groups: { valType: "string", strict: true, noBlank: true, arrayOk: true, dflt: "x", editType: "calc" }, aggregations: { _isLinkedToArray: "aggregation", target: { valType: "string", editType: "calc" }, func: { valType: "enumerated", values: ["count", "sum", "avg", "median", "mode", "rms", "stddev", "min", "max", "first", "last", "change", "range"], dflt: "first", editType: "calc" }, funcmode: { valType: "enumerated", values: ["sample", "population"], dflt: "sample", editType: "calc" }, enabled: { valType: "boolean", dflt: true, editType: "calc" }, editType: "calc" }, editType: "calc" }, u2 = l.aggregations;
      function c(d, v, m, g) {
        if (g.enabled) {
          for (var x = g.target, b = a.nestedProperty(v, x), y = b.get(), w = function(T2, A2) {
            var S2 = T2.func, C2 = A2.d2c, E2 = A2.c2d;
            switch (S2) {
              case "count":
                return f;
              case "first":
                return h;
              case "last":
                return p;
              case "sum":
                return function(F13, N2) {
                  for (var D2 = 0, I2 = 0; I2 < N2.length; I2++) {
                    var O2 = C2(F13[N2[I2]]);
                    O2 !== i && (D2 += O2);
                  }
                  return E2(D2);
                };
              case "avg":
                return function(F13, N2) {
                  for (var D2 = 0, I2 = 0, O2 = 0; O2 < N2.length; O2++) {
                    var L2 = C2(F13[N2[O2]]);
                    L2 !== i && (D2 += L2, I2++);
                  }
                  return I2 ? E2(D2 / I2) : i;
                };
              case "min":
                return function(F13, N2) {
                  for (var D2 = 1 / 0, I2 = 0; I2 < N2.length; I2++) {
                    var O2 = C2(F13[N2[I2]]);
                    O2 !== i && (D2 = Math.min(D2, O2));
                  }
                  return D2 === 1 / 0 ? i : E2(D2);
                };
              case "max":
                return function(F13, N2) {
                  for (var D2 = -1 / 0, I2 = 0; I2 < N2.length; I2++) {
                    var O2 = C2(F13[N2[I2]]);
                    O2 !== i && (D2 = Math.max(D2, O2));
                  }
                  return D2 === -1 / 0 ? i : E2(D2);
                };
              case "range":
                return function(F13, N2) {
                  for (var D2 = 1 / 0, I2 = -1 / 0, O2 = 0; O2 < N2.length; O2++) {
                    var L2 = C2(F13[N2[O2]]);
                    L2 !== i && (D2 = Math.min(D2, L2), I2 = Math.max(I2, L2));
                  }
                  return I2 === -1 / 0 || D2 === 1 / 0 ? i : E2(I2 - D2);
                };
              case "change":
                return function(F13, N2) {
                  var D2 = C2(F13[N2[0]]), I2 = C2(F13[N2[N2.length - 1]]);
                  return D2 === i || I2 === i ? i : E2(I2 - D2);
                };
              case "median":
                return function(F13, N2) {
                  for (var D2 = [], I2 = 0; I2 < N2.length; I2++) {
                    var O2 = C2(F13[N2[I2]]);
                    O2 !== i && D2.push(O2);
                  }
                  if (!D2.length) return i;
                  D2.sort(a.sorterAsc);
                  var L2 = (D2.length - 1) / 2;
                  return E2((D2[Math.floor(L2)] + D2[Math.ceil(L2)]) / 2);
                };
              case "mode":
                return function(F13, N2) {
                  for (var D2 = {}, I2 = 0, O2 = i, L2 = 0; L2 < N2.length; L2++) {
                    var V2 = C2(F13[N2[L2]]);
                    if (V2 !== i) {
                      var W2 = D2[V2] = (D2[V2] || 0) + 1;
                      W2 > I2 && (I2 = W2, O2 = V2);
                    }
                  }
                  return I2 ? E2(O2) : i;
                };
              case "rms":
                return function(F13, N2) {
                  for (var D2 = 0, I2 = 0, O2 = 0; O2 < N2.length; O2++) {
                    var L2 = C2(F13[N2[O2]]);
                    L2 !== i && (D2 += L2 * L2, I2++);
                  }
                  return I2 ? E2(Math.sqrt(D2 / I2)) : i;
                };
              case "stddev":
                return function(F13, N2) {
                  var D2, I2 = 0, O2 = 0, L2 = 1, V2 = i;
                  for (D2 = 0; D2 < N2.length && V2 === i; D2++) V2 = C2(F13[N2[D2]]);
                  if (V2 === i) return i;
                  for (; D2 < N2.length; D2++) {
                    var W2 = C2(F13[N2[D2]]);
                    if (W2 !== i) {
                      var X2 = W2 - V2;
                      I2 += X2, O2 += X2 * X2, L2++;
                    }
                  }
                  var Y2 = T2.funcmode === "sample" ? L2 - 1 : L2;
                  return Y2 ? Math.sqrt((O2 - I2 * I2 / L2) / Y2) : 0;
                };
            }
          }(g, n.getDataConversions(d, v, x, y)), _4 = new Array(m.length), k = 0; k < m.length; k++) _4[k] = w(y, m[k]);
          b.set(_4), g.func === "count" && a.pushUnique(v._arrayAttrs, x);
        }
      }
      function f(d, v) {
        return v.length;
      }
      function h(d, v) {
        return d[v[0]];
      }
      function p(d, v) {
        return d[v[v.length - 1]];
      }
      r.supplyDefaults = function(d, v) {
        var m, g = {};
        function x(E2, F13) {
          return a.coerce(d, g, l, E2, F13);
        }
        if (!x("enabled")) return g;
        var b = o.findArrayAttributes(v), y = {};
        for (m = 0; m < b.length; m++) y[b[m]] = 1;
        var w = x("groups");
        if (!Array.isArray(w)) {
          if (!y[w]) return g.enabled = false, g;
          y[w] = 0;
        }
        var _4, k = d.aggregations || [], T2 = g.aggregations = new Array(k.length);
        function A2(E2, F13) {
          return a.coerce(k[m], _4, u2, E2, F13);
        }
        for (m = 0; m < k.length; m++) {
          _4 = { _index: m };
          var S2 = A2("target"), C2 = A2("func");
          A2("enabled") && S2 && (y[S2] || C2 === "count" && y[S2] === void 0) ? (C2 === "stddev" && A2("funcmode"), y[S2] = 0, T2[m] = _4) : T2[m] = { enabled: false, _index: m };
        }
        for (m = 0; m < b.length; m++) y[b[m]] && T2.push({ target: b[m], func: u2.func.dflt, enabled: true, _index: -1 });
        return g;
      }, r.calcTransform = function(d, v, m) {
        if (m.enabled) {
          var g = m.groups, x = a.getTargetArray(v, { target: g });
          if (x) {
            var b, y, w, _4, k = {}, T2 = {}, A2 = [], S2 = s(v.transforms, m), C2 = x.length;
            for (v._length && (C2 = Math.min(C2, v._length)), b = 0; b < C2; b++) (w = k[y = x[b]]) === void 0 ? (k[y] = A2.length, _4 = [b], A2.push(_4), T2[k[y]] = S2(b)) : (A2[w].push(b), T2[k[y]] = (T2[k[y]] || []).concat(S2(b)));
            m._indexToPoints = T2;
            var E2 = m.aggregations;
            for (b = 0; b < E2.length; b++) c(d, v, A2, E2[b]);
            typeof g == "string" && c(d, v, A2, { target: g, func: "first", enabled: true }), v._length = A2.length;
          }
        }
      };
    }, { "../constants/numerical": 479, "../lib": 503, "../plot_api/plot_schema": 542, "../plots/cartesian/axes": 554, "./helpers": 1117 }], 1115: [function(e, t, r) {
      "use strict";
      var n = e("../lib"), a = e("../registry"), o = e("../plots/cartesian/axes"), s = e("./helpers").pointsAccessorFunction, i = e("../constants/filter_ops"), l = i.COMPARISON_OPS, u2 = i.INTERVAL_OPS, c = i.SET_OPS;
      r.moduleType = "transform", r.name = "filter", r.attributes = { enabled: { valType: "boolean", dflt: true, editType: "calc" }, target: { valType: "string", strict: true, noBlank: true, arrayOk: true, dflt: "x", editType: "calc" }, operation: { valType: "enumerated", values: [].concat(l).concat(u2).concat(c), dflt: "=", editType: "calc" }, value: { valType: "any", dflt: 0, editType: "calc" }, preservegaps: { valType: "boolean", dflt: false, editType: "calc" }, editType: "calc" }, r.supplyDefaults = function(f) {
        var h = {};
        function p(m, g) {
          return n.coerce(f, h, r.attributes, m, g);
        }
        if (p("enabled")) {
          var d = p("target");
          if (n.isArrayOrTypedArray(d) && d.length === 0) return h.enabled = false, h;
          p("preservegaps"), p("operation"), p("value");
          var v = a.getComponentMethod("calendars", "handleDefaults");
          v(f, h, "valuecalendar", null), v(f, h, "targetcalendar", null);
        }
        return h;
      }, r.calcTransform = function(f, h, p) {
        if (p.enabled) {
          var d = n.getTargetArray(h, p);
          if (d) {
            var v = p.target, m = d.length;
            h._length && (m = Math.min(m, h._length));
            var g = p.targetcalendar, x = h._arrayAttrs, b = p.preservegaps;
            if (typeof v == "string") {
              var y = n.nestedProperty(h, v + "calendar").get();
              y && (g = y);
            }
            var w, _4, k = function(N2, D2, I2) {
              var O2 = N2.operation, L2 = N2.value, V2 = Array.isArray(L2);
              function W2(q) {
                return q.indexOf(O2) !== -1;
              }
              var X2, Y2 = function(q) {
                return D2(q, 0, N2.valuecalendar);
              }, K2 = function(q) {
                return D2(q, 0, I2);
              };
              switch (W2(l) ? X2 = Y2(V2 ? L2[0] : L2) : W2(u2) ? X2 = V2 ? [Y2(L2[0]), Y2(L2[1])] : [Y2(L2), Y2(L2)] : W2(c) && (X2 = V2 ? L2.map(Y2) : [Y2(L2)]), O2) {
                case "=":
                  return function(q) {
                    return K2(q) === X2;
                  };
                case "!=":
                  return function(q) {
                    return K2(q) !== X2;
                  };
                case "<":
                  return function(q) {
                    return K2(q) < X2;
                  };
                case "<=":
                  return function(q) {
                    return K2(q) <= X2;
                  };
                case ">":
                  return function(q) {
                    return K2(q) > X2;
                  };
                case ">=":
                  return function(q) {
                    return K2(q) >= X2;
                  };
                case "[]":
                  return function(q) {
                    var re = K2(q);
                    return re >= X2[0] && re <= X2[1];
                  };
                case "()":
                  return function(q) {
                    var re = K2(q);
                    return re > X2[0] && re < X2[1];
                  };
                case "[)":
                  return function(q) {
                    var re = K2(q);
                    return re >= X2[0] && re < X2[1];
                  };
                case "(]":
                  return function(q) {
                    var re = K2(q);
                    return re > X2[0] && re <= X2[1];
                  };
                case "][":
                  return function(q) {
                    var re = K2(q);
                    return re <= X2[0] || re >= X2[1];
                  };
                case ")(":
                  return function(q) {
                    var re = K2(q);
                    return re < X2[0] || re > X2[1];
                  };
                case "](":
                  return function(q) {
                    var re = K2(q);
                    return re <= X2[0] || re > X2[1];
                  };
                case ")[":
                  return function(q) {
                    var re = K2(q);
                    return re < X2[0] || re >= X2[1];
                  };
                case "{}":
                  return function(q) {
                    return X2.indexOf(K2(q)) !== -1;
                  };
                case "}{":
                  return function(q) {
                    return X2.indexOf(K2(q)) === -1;
                  };
              }
            }(p, o.getDataToCoordFunc(f, h, v, d), g), T2 = {}, A2 = {}, S2 = 0;
            b ? (w = function(N2) {
              T2[N2.astr] = n.extendDeep([], N2.get()), N2.set(new Array(m));
            }, _4 = function(N2, D2) {
              var I2 = T2[N2.astr][D2];
              N2.get()[D2] = I2;
            }) : (w = function(N2) {
              T2[N2.astr] = n.extendDeep([], N2.get()), N2.set([]);
            }, _4 = function(N2, D2) {
              var I2 = T2[N2.astr][D2];
              N2.get().push(I2);
            }), F13(w);
            for (var C2 = s(h.transforms, p), E2 = 0; E2 < m; E2++) k(d[E2]) ? (F13(_4, E2), A2[S2++] = C2(E2)) : b && S2++;
            p._indexToPoints = A2, h._length = S2;
          }
        }
        function F13(N2, D2) {
          for (var I2 = 0; I2 < x.length; I2++) N2(n.nestedProperty(h, x[I2]), D2);
        }
      };
    }, { "../constants/filter_ops": 475, "../lib": 503, "../plots/cartesian/axes": 554, "../registry": 638, "./helpers": 1117 }], 1116: [function(e, t, r) {
      "use strict";
      var n = e("../lib"), a = e("../plot_api/plot_schema"), o = e("../plots/plots"), s = e("./helpers").pointsAccessorFunction;
      function i(l, u2) {
        var c, f, h, p, d, v, m, g, x, b, y = u2.transform, w = u2.transformIndex, _4 = l.transforms[w].groups, k = s(l.transforms, y);
        if (!n.isArrayOrTypedArray(_4) || _4.length === 0) return [l];
        var T2 = n.filterUnique(_4), A2 = new Array(T2.length), S2 = _4.length, C2 = a.findArrayAttributes(l), E2 = y.styles || [], F13 = {};
        for (c = 0; c < E2.length; c++) F13[E2[c].target] = E2[c].value;
        y.styles && (b = n.keyedContainer(y, "styles", "target", "value.name"));
        var N2 = {}, D2 = {};
        for (c = 0; c < T2.length; c++) {
          N2[v = T2[c]] = c, D2[v] = 0, (m = A2[c] = n.extendDeepNoArrays({}, l))._group = v, m.transforms[w]._indexToPoints = {};
          var I2 = null;
          for (b && (I2 = b.get(v)), m.name = I2 || I2 === "" ? I2 : n.templateString(y.nameformat, { trace: l.name, group: v }), g = m.transforms, m.transforms = [], f = 0; f < g.length; f++) m.transforms[f] = n.extendDeepNoArrays({}, g[f]);
          for (f = 0; f < C2.length; f++) n.nestedProperty(m, C2[f]).set([]);
        }
        for (h = 0; h < C2.length; h++) {
          for (p = C2[h], f = 0, x = []; f < T2.length; f++) x[f] = n.nestedProperty(A2[f], p).get();
          for (d = n.nestedProperty(l, p).get(), f = 0; f < S2; f++) x[N2[_4[f]]].push(d[f]);
        }
        for (f = 0; f < S2; f++) (m = A2[N2[_4[f]]]).transforms[w]._indexToPoints[D2[_4[f]]] = k(f), D2[_4[f]]++;
        for (c = 0; c < T2.length; c++) v = T2[c], m = A2[c], o.clearExpandedTraceDefaultColors(m), m = n.extendDeepNoArrays(m, F13[v] || {});
        return A2;
      }
      r.moduleType = "transform", r.name = "groupby", r.attributes = { enabled: { valType: "boolean", dflt: true, editType: "calc" }, groups: { valType: "data_array", dflt: [], editType: "calc" }, nameformat: { valType: "string", editType: "calc" }, styles: { _isLinkedToArray: "style", target: { valType: "string", editType: "calc" }, value: { valType: "any", dflt: {}, editType: "calc", _compareAsJSON: true }, editType: "calc" }, editType: "calc" }, r.supplyDefaults = function(l, u2, c) {
        var f, h = {};
        function p(x, b) {
          return n.coerce(l, h, r.attributes, x, b);
        }
        if (!p("enabled")) return h;
        p("groups"), p("nameformat", c._dataLength > 1 ? "%{group} (%{trace})" : "%{group}");
        var d = l.styles, v = h.styles = [];
        if (d) for (f = 0; f < d.length; f++) {
          var m = v[f] = {};
          n.coerce(d[f], v[f], r.attributes.styles, "target");
          var g = n.coerce(d[f], v[f], r.attributes.styles, "value");
          n.isPlainObject(g) ? m.value = n.extendDeep({}, g) : g && delete m.value;
        }
        return h;
      }, r.transform = function(l, u2) {
        var c, f, h, p = [];
        for (f = 0; f < l.length; f++) for (c = i(l[f], u2), h = 0; h < c.length; h++) p.push(c[h]);
        return p;
      };
    }, { "../lib": 503, "../plot_api/plot_schema": 542, "../plots/plots": 619, "./helpers": 1117 }], 1117: [function(e, t, r) {
      "use strict";
      r.pointsAccessorFunction = function(n, a) {
        for (var o, s, i = 0; i < n.length && (o = n[i]) !== a; i++) o._indexToPoints && o.enabled !== false && (s = o._indexToPoints);
        return s ? function(l) {
          return s[l];
        } : function(l) {
          return [l];
        };
      };
    }, {}], 1118: [function(e, t, r) {
      "use strict";
      var n = e("../lib"), a = e("../plots/cartesian/axes"), o = e("./helpers").pointsAccessorFunction, s = e("../constants/numerical").BADNUM;
      r.moduleType = "transform", r.name = "sort", r.attributes = { enabled: { valType: "boolean", dflt: true, editType: "calc" }, target: { valType: "string", strict: true, noBlank: true, arrayOk: true, dflt: "x", editType: "calc" }, order: { valType: "enumerated", values: ["ascending", "descending"], dflt: "ascending", editType: "calc" }, editType: "calc" }, r.supplyDefaults = function(i) {
        var l = {};
        function u2(c, f) {
          return n.coerce(i, l, r.attributes, c, f);
        }
        return u2("enabled") && (u2("target"), u2("order")), l;
      }, r.calcTransform = function(i, l, u2) {
        if (u2.enabled) {
          var c = n.getTargetArray(l, u2);
          if (c) {
            var f = u2.target, h = c.length;
            l._length && (h = Math.min(h, l._length));
            var p, d, v = l._arrayAttrs, m = function(_4, k, T2, A2) {
              var S2, C2 = new Array(A2), E2 = new Array(A2);
              for (S2 = 0; S2 < A2; S2++) C2[S2] = { v: k[S2], i: S2 };
              for (C2.sort(function(F13, N2) {
                switch (F13.order) {
                  case "ascending":
                    return function(D2, I2) {
                      var O2 = N2(D2.v), L2 = N2(I2.v);
                      return O2 === s ? 1 : L2 === s ? -1 : O2 - L2;
                    };
                  case "descending":
                    return function(D2, I2) {
                      var O2 = N2(D2.v), L2 = N2(I2.v);
                      return O2 === s ? 1 : L2 === s ? -1 : L2 - O2;
                    };
                }
              }(_4, T2)), S2 = 0; S2 < A2; S2++) E2[S2] = C2[S2].i;
              return E2;
            }(u2, c, a.getDataToCoordFunc(i, l, f, c), h), g = o(l.transforms, u2), x = {};
            for (p = 0; p < v.length; p++) {
              var b = n.nestedProperty(l, v[p]), y = b.get(), w = new Array(h);
              for (d = 0; d < h; d++) w[d] = y[m[d]];
              b.set(w);
            }
            for (d = 0; d < h; d++) x[d] = g(m[d]);
            u2._indexToPoints = x, l._length = h;
          }
        }
      };
    }, { "../constants/numerical": 479, "../lib": 503, "../plots/cartesian/axes": 554, "./helpers": 1117 }], 1119: [function(e, t, r) {
      "use strict";
      r.version = "2.8.3";
    }, {}], 1120: [function(e, t, r) {
      (function(n) {
        (function() {
          (function(a) {
            typeof r == "object" && t !== void 0 ? t.exports = a() : (typeof window < "u" ? window : n !== void 0 ? n : typeof self < "u" ? self : this).stackgl = a();
          })(function() {
            return function a(o, s, i) {
              function l(f, h) {
                if (!s[f]) {
                  if (!o[f]) {
                    var p = typeof e == "function" && e;
                    if (!h && p) return p(f, true);
                    if (u2) return u2(f, true);
                    var d = new Error("Cannot find module '" + f + "'");
                    throw d.code = "MODULE_NOT_FOUND", d;
                  }
                  var v = s[f] = { exports: {} };
                  o[f][0].call(v.exports, function(m) {
                    return l(o[f][1][m] || m);
                  }, v, v.exports, a, o, s, i);
                }
                return s[f].exports;
              }
              for (var u2 = typeof e == "function" && e, c = 0; c < i.length; c++) l(i[c]);
              return l;
            }({ 1: [function(a, o, s) {
              "use strict";
              s.byteLength = function(v) {
                var m = p(v), g = m[0], x = m[1];
                return 3 * (g + x) / 4 - x;
              }, s.toByteArray = function(v) {
                var m, g, x = p(v), b = x[0], y = x[1], w = new u2(function(T2, A2, S2) {
                  return 3 * (A2 + S2) / 4 - S2;
                }(0, b, y)), _4 = 0, k = y > 0 ? b - 4 : b;
                for (g = 0; g < k; g += 4) m = l[v.charCodeAt(g)] << 18 | l[v.charCodeAt(g + 1)] << 12 | l[v.charCodeAt(g + 2)] << 6 | l[v.charCodeAt(g + 3)], w[_4++] = m >> 16 & 255, w[_4++] = m >> 8 & 255, w[_4++] = 255 & m;
                return y === 2 && (m = l[v.charCodeAt(g)] << 2 | l[v.charCodeAt(g + 1)] >> 4, w[_4++] = 255 & m), y === 1 && (m = l[v.charCodeAt(g)] << 10 | l[v.charCodeAt(g + 1)] << 4 | l[v.charCodeAt(g + 2)] >> 2, w[_4++] = m >> 8 & 255, w[_4++] = 255 & m), w;
              }, s.fromByteArray = function(v) {
                for (var m, g = v.length, x = g % 3, b = [], y = 0, w = g - x; y < w; y += 16383) b.push(d(v, y, y + 16383 > w ? w : y + 16383));
                return x === 1 ? (m = v[g - 1], b.push(i[m >> 2] + i[m << 4 & 63] + "==")) : x === 2 && (m = (v[g - 2] << 8) + v[g - 1], b.push(i[m >> 10] + i[m >> 4 & 63] + i[m << 2 & 63] + "=")), b.join("");
              };
              for (var i = [], l = [], u2 = typeof Uint8Array < "u" ? Uint8Array : Array, c = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", f = 0, h = c.length; f < h; ++f) i[f] = c[f], l[c.charCodeAt(f)] = f;
              function p(v) {
                var m = v.length;
                if (m % 4 > 0) throw new Error("Invalid string. Length must be a multiple of 4");
                var g = v.indexOf("=");
                return g === -1 && (g = m), [g, g === m ? 0 : 4 - g % 4];
              }
              function d(v, m, g) {
                for (var x, b, y = [], w = m; w < g; w += 3) x = (v[w] << 16 & 16711680) + (v[w + 1] << 8 & 65280) + (255 & v[w + 2]), y.push(i[(b = x) >> 18 & 63] + i[b >> 12 & 63] + i[b >> 6 & 63] + i[63 & b]);
                return y.join("");
              }
              l["-".charCodeAt(0)] = 62, l["_".charCodeAt(0)] = 63;
            }, {}], 2: [function(a, o, s) {
            }, {}], 3: [function(a, o, s) {
              (function(i) {
                (function() {
                  "use strict";
                  var l = a("base64-js"), u2 = a("ieee754");
                  s.Buffer = f, s.SlowBuffer = function(j) {
                    return +j != j && (j = 0), f.alloc(+j);
                  }, s.INSPECT_MAX_BYTES = 50;
                  function c(j) {
                    if (j > 2147483647) throw new RangeError('The value "' + j + '" is invalid for option "size"');
                    var Q2 = new Uint8Array(j);
                    return Q2.__proto__ = f.prototype, Q2;
                  }
                  function f(j, Q2, Z2) {
                    if (typeof j == "number") {
                      if (typeof Q2 == "string") throw new TypeError('The "string" argument must be of type string. Received type number');
                      return d(j);
                    }
                    return h(j, Q2, Z2);
                  }
                  function h(j, Q2, Z2) {
                    if (typeof j == "string") return function(ue, le) {
                      if (typeof le == "string" && le !== "" || (le = "utf8"), !f.isEncoding(le)) throw new TypeError("Unknown encoding: " + le);
                      var ce = 0 | g(ue, le), se = c(ce), he = se.write(ue, le);
                      return he !== ce && (se = se.slice(0, he)), se;
                    }(j, Q2);
                    if (ArrayBuffer.isView(j)) return v(j);
                    if (j == null) throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof j);
                    if (H2(j, ArrayBuffer) || j && H2(j.buffer, ArrayBuffer)) return function(ue, le, ce) {
                      if (le < 0 || ue.byteLength < le) throw new RangeError('"offset" is outside of buffer bounds');
                      if (ue.byteLength < le + (ce || 0)) throw new RangeError('"length" is outside of buffer bounds');
                      var se;
                      return se = le === void 0 && ce === void 0 ? new Uint8Array(ue) : ce === void 0 ? new Uint8Array(ue, le) : new Uint8Array(ue, le, ce), se.__proto__ = f.prototype, se;
                    }(j, Q2, Z2);
                    if (typeof j == "number") throw new TypeError('The "value" argument must not be of type number. Received type number');
                    var ne = j.valueOf && j.valueOf();
                    if (ne != null && ne !== j) return f.from(ne, Q2, Z2);
                    var ae = function(ue) {
                      if (f.isBuffer(ue)) {
                        var le = 0 | m(ue.length), ce = c(le);
                        return ce.length === 0 || ue.copy(ce, 0, 0, le), ce;
                      }
                      if (ue.length !== void 0) return typeof ue.length != "number" || te(ue.length) ? c(0) : v(ue);
                      if (ue.type === "Buffer" && Array.isArray(ue.data)) return v(ue.data);
                    }(j);
                    if (ae) return ae;
                    if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof j[Symbol.toPrimitive] == "function") return f.from(j[Symbol.toPrimitive]("string"), Q2, Z2);
                    throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof j);
                  }
                  function p(j) {
                    if (typeof j != "number") throw new TypeError('"size" argument must be of type number');
                    if (j < 0) throw new RangeError('The value "' + j + '" is invalid for option "size"');
                  }
                  function d(j) {
                    return p(j), c(j < 0 ? 0 : 0 | m(j));
                  }
                  function v(j) {
                    for (var Q2 = j.length < 0 ? 0 : 0 | m(j.length), Z2 = c(Q2), ne = 0; ne < Q2; ne += 1) Z2[ne] = 255 & j[ne];
                    return Z2;
                  }
                  function m(j) {
                    if (j >= 2147483647) throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + 2147483647 .toString(16) + " bytes");
                    return 0 | j;
                  }
                  function g(j, Q2) {
                    if (f.isBuffer(j)) return j.length;
                    if (ArrayBuffer.isView(j) || H2(j, ArrayBuffer)) return j.byteLength;
                    if (typeof j != "string") throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof j);
                    var Z2 = j.length, ne = arguments.length > 2 && arguments[2] === true;
                    if (!ne && Z2 === 0) return 0;
                    for (var ae = false; ; ) switch (Q2) {
                      case "ascii":
                      case "latin1":
                      case "binary":
                        return Z2;
                      case "utf8":
                      case "utf-8":
                        return re(j).length;
                      case "ucs2":
                      case "ucs-2":
                      case "utf16le":
                      case "utf-16le":
                        return 2 * Z2;
                      case "hex":
                        return Z2 >>> 1;
                      case "base64":
                        return R2(j).length;
                      default:
                        if (ae) return ne ? -1 : re(j).length;
                        Q2 = ("" + Q2).toLowerCase(), ae = true;
                    }
                  }
                  function x(j, Q2, Z2) {
                    var ne = false;
                    if ((Q2 === void 0 || Q2 < 0) && (Q2 = 0), Q2 > this.length || ((Z2 === void 0 || Z2 > this.length) && (Z2 = this.length), Z2 <= 0) || (Z2 >>>= 0) <= (Q2 >>>= 0)) return "";
                    for (j || (j = "utf8"); ; ) switch (j) {
                      case "hex":
                        return I2(this, Q2, Z2);
                      case "utf8":
                      case "utf-8":
                        return F13(this, Q2, Z2);
                      case "ascii":
                        return N2(this, Q2, Z2);
                      case "latin1":
                      case "binary":
                        return D2(this, Q2, Z2);
                      case "base64":
                        return E2(this, Q2, Z2);
                      case "ucs2":
                      case "ucs-2":
                      case "utf16le":
                      case "utf-16le":
                        return O2(this, Q2, Z2);
                      default:
                        if (ne) throw new TypeError("Unknown encoding: " + j);
                        j = (j + "").toLowerCase(), ne = true;
                    }
                  }
                  function b(j, Q2, Z2) {
                    var ne = j[Q2];
                    j[Q2] = j[Z2], j[Z2] = ne;
                  }
                  function y(j, Q2, Z2, ne, ae) {
                    if (j.length === 0) return -1;
                    if (typeof Z2 == "string" ? (ne = Z2, Z2 = 0) : Z2 > 2147483647 ? Z2 = 2147483647 : Z2 < -2147483648 && (Z2 = -2147483648), te(Z2 = +Z2) && (Z2 = ae ? 0 : j.length - 1), Z2 < 0 && (Z2 = j.length + Z2), Z2 >= j.length) {
                      if (ae) return -1;
                      Z2 = j.length - 1;
                    } else if (Z2 < 0) {
                      if (!ae) return -1;
                      Z2 = 0;
                    }
                    if (typeof Q2 == "string" && (Q2 = f.from(Q2, ne)), f.isBuffer(Q2)) return Q2.length === 0 ? -1 : w(j, Q2, Z2, ne, ae);
                    if (typeof Q2 == "number") return Q2 &= 255, typeof Uint8Array.prototype.indexOf == "function" ? ae ? Uint8Array.prototype.indexOf.call(j, Q2, Z2) : Uint8Array.prototype.lastIndexOf.call(j, Q2, Z2) : w(j, [Q2], Z2, ne, ae);
                    throw new TypeError("val must be string, number or Buffer");
                  }
                  function w(j, Q2, Z2, ne, ae) {
                    var ue, le = 1, ce = j.length, se = Q2.length;
                    if (ne !== void 0 && ((ne = String(ne).toLowerCase()) === "ucs2" || ne === "ucs-2" || ne === "utf16le" || ne === "utf-16le")) {
                      if (j.length < 2 || Q2.length < 2) return -1;
                      le = 2, ce /= 2, se /= 2, Z2 /= 2;
                    }
                    function he(Ae, pe) {
                      return le === 1 ? Ae[pe] : Ae.readUInt16BE(pe * le);
                    }
                    if (ae) {
                      var me = -1;
                      for (ue = Z2; ue < ce; ue++) if (he(j, ue) === he(Q2, me === -1 ? 0 : ue - me)) {
                        if (me === -1 && (me = ue), ue - me + 1 === se) return me * le;
                      } else me !== -1 && (ue -= ue - me), me = -1;
                    } else for (Z2 + se > ce && (Z2 = ce - se), ue = Z2; ue >= 0; ue--) {
                      for (var we = true, be = 0; be < se; be++) if (he(j, ue + be) !== he(Q2, be)) {
                        we = false;
                        break;
                      }
                      if (we) return ue;
                    }
                    return -1;
                  }
                  function _4(j, Q2, Z2, ne) {
                    Z2 = Number(Z2) || 0;
                    var ae = j.length - Z2;
                    ne ? (ne = Number(ne)) > ae && (ne = ae) : ne = ae;
                    var ue = Q2.length;
                    ne > ue / 2 && (ne = ue / 2);
                    for (var le = 0; le < ne; ++le) {
                      var ce = parseInt(Q2.substr(2 * le, 2), 16);
                      if (te(ce)) return le;
                      j[Z2 + le] = ce;
                    }
                    return le;
                  }
                  function k(j, Q2, Z2, ne) {
                    return z(re(Q2, j.length - Z2), j, Z2, ne);
                  }
                  function T2(j, Q2, Z2, ne) {
                    return z(function(ae) {
                      for (var ue = [], le = 0; le < ae.length; ++le) ue.push(255 & ae.charCodeAt(le));
                      return ue;
                    }(Q2), j, Z2, ne);
                  }
                  function A2(j, Q2, Z2, ne) {
                    return T2(j, Q2, Z2, ne);
                  }
                  function S2(j, Q2, Z2, ne) {
                    return z(R2(Q2), j, Z2, ne);
                  }
                  function C2(j, Q2, Z2, ne) {
                    return z(function(ae, ue) {
                      for (var le, ce, se, he = [], me = 0; me < ae.length && !((ue -= 2) < 0); ++me) le = ae.charCodeAt(me), ce = le >> 8, se = le % 256, he.push(se), he.push(ce);
                      return he;
                    }(Q2, j.length - Z2), j, Z2, ne);
                  }
                  function E2(j, Q2, Z2) {
                    return Q2 === 0 && Z2 === j.length ? l.fromByteArray(j) : l.fromByteArray(j.slice(Q2, Z2));
                  }
                  function F13(j, Q2, Z2) {
                    Z2 = Math.min(j.length, Z2);
                    for (var ne = [], ae = Q2; ae < Z2; ) {
                      var ue, le, ce, se, he = j[ae], me = null, we = he > 239 ? 4 : he > 223 ? 3 : he > 191 ? 2 : 1;
                      if (ae + we <= Z2) switch (we) {
                        case 1:
                          he < 128 && (me = he);
                          break;
                        case 2:
                          (192 & (ue = j[ae + 1])) == 128 && (se = (31 & he) << 6 | 63 & ue) > 127 && (me = se);
                          break;
                        case 3:
                          ue = j[ae + 1], le = j[ae + 2], (192 & ue) == 128 && (192 & le) == 128 && (se = (15 & he) << 12 | (63 & ue) << 6 | 63 & le) > 2047 && (se < 55296 || se > 57343) && (me = se);
                          break;
                        case 4:
                          ue = j[ae + 1], le = j[ae + 2], ce = j[ae + 3], (192 & ue) == 128 && (192 & le) == 128 && (192 & ce) == 128 && (se = (15 & he) << 18 | (63 & ue) << 12 | (63 & le) << 6 | 63 & ce) > 65535 && se < 1114112 && (me = se);
                      }
                      me === null ? (me = 65533, we = 1) : me > 65535 && (me -= 65536, ne.push(me >>> 10 & 1023 | 55296), me = 56320 | 1023 & me), ne.push(me), ae += we;
                    }
                    return function(be) {
                      var Ae = be.length;
                      if (Ae <= 4096) return String.fromCharCode.apply(String, be);
                      for (var pe = "", ve = 0; ve < Ae; ) pe += String.fromCharCode.apply(String, be.slice(ve, ve += 4096));
                      return pe;
                    }(ne);
                  }
                  s.kMaxLength = 2147483647, f.TYPED_ARRAY_SUPPORT = function() {
                    try {
                      var j = new Uint8Array(1);
                      return j.__proto__ = { __proto__: Uint8Array.prototype, foo: function() {
                        return 42;
                      } }, j.foo() === 42;
                    } catch {
                      return false;
                    }
                  }(), f.TYPED_ARRAY_SUPPORT || typeof console > "u" || typeof console.error != "function" || 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."), Object.defineProperty(f.prototype, "parent", { enumerable: true, get: function() {
                    if (f.isBuffer(this)) return this.buffer;
                  } }), Object.defineProperty(f.prototype, "offset", { enumerable: true, get: function() {
                    if (f.isBuffer(this)) return this.byteOffset;
                  } }), typeof Symbol < "u" && Symbol.species != null && f[Symbol.species] === f && Object.defineProperty(f, Symbol.species, { value: null, configurable: true, enumerable: false, writable: false }), f.poolSize = 8192, f.from = function(j, Q2, Z2) {
                    return h(j, Q2, Z2);
                  }, f.prototype.__proto__ = Uint8Array.prototype, f.__proto__ = Uint8Array, f.alloc = function(j, Q2, Z2) {
                    return function(ne, ae, ue) {
                      return p(ne), ne <= 0 ? c(ne) : ae !== void 0 ? typeof ue == "string" ? c(ne).fill(ae, ue) : c(ne).fill(ae) : c(ne);
                    }(j, Q2, Z2);
                  }, f.allocUnsafe = function(j) {
                    return d(j);
                  }, f.allocUnsafeSlow = function(j) {
                    return d(j);
                  }, f.isBuffer = function(j) {
                    return j != null && j._isBuffer === true && j !== f.prototype;
                  }, f.compare = function(j, Q2) {
                    if (H2(j, Uint8Array) && (j = f.from(j, j.offset, j.byteLength)), H2(Q2, Uint8Array) && (Q2 = f.from(Q2, Q2.offset, Q2.byteLength)), !f.isBuffer(j) || !f.isBuffer(Q2)) throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');
                    if (j === Q2) return 0;
                    for (var Z2 = j.length, ne = Q2.length, ae = 0, ue = Math.min(Z2, ne); ae < ue; ++ae) if (j[ae] !== Q2[ae]) {
                      Z2 = j[ae], ne = Q2[ae];
                      break;
                    }
                    return Z2 < ne ? -1 : ne < Z2 ? 1 : 0;
                  }, f.isEncoding = function(j) {
                    switch (String(j).toLowerCase()) {
                      case "hex":
                      case "utf8":
                      case "utf-8":
                      case "ascii":
                      case "latin1":
                      case "binary":
                      case "base64":
                      case "ucs2":
                      case "ucs-2":
                      case "utf16le":
                      case "utf-16le":
                        return true;
                      default:
                        return false;
                    }
                  }, f.concat = function(j, Q2) {
                    if (!Array.isArray(j)) throw new TypeError('"list" argument must be an Array of Buffers');
                    if (j.length === 0) return f.alloc(0);
                    var Z2;
                    if (Q2 === void 0) for (Q2 = 0, Z2 = 0; Z2 < j.length; ++Z2) Q2 += j[Z2].length;
                    var ne = f.allocUnsafe(Q2), ae = 0;
                    for (Z2 = 0; Z2 < j.length; ++Z2) {
                      var ue = j[Z2];
                      if (H2(ue, Uint8Array) && (ue = f.from(ue)), !f.isBuffer(ue)) throw new TypeError('"list" argument must be an Array of Buffers');
                      ue.copy(ne, ae), ae += ue.length;
                    }
                    return ne;
                  }, f.byteLength = g, f.prototype._isBuffer = true, f.prototype.swap16 = function() {
                    var j = this.length;
                    if (j % 2 != 0) throw new RangeError("Buffer size must be a multiple of 16-bits");
                    for (var Q2 = 0; Q2 < j; Q2 += 2) b(this, Q2, Q2 + 1);
                    return this;
                  }, f.prototype.swap32 = function() {
                    var j = this.length;
                    if (j % 4 != 0) throw new RangeError("Buffer size must be a multiple of 32-bits");
                    for (var Q2 = 0; Q2 < j; Q2 += 4) b(this, Q2, Q2 + 3), b(this, Q2 + 1, Q2 + 2);
                    return this;
                  }, f.prototype.swap64 = function() {
                    var j = this.length;
                    if (j % 8 != 0) throw new RangeError("Buffer size must be a multiple of 64-bits");
                    for (var Q2 = 0; Q2 < j; Q2 += 8) b(this, Q2, Q2 + 7), b(this, Q2 + 1, Q2 + 6), b(this, Q2 + 2, Q2 + 5), b(this, Q2 + 3, Q2 + 4);
                    return this;
                  }, f.prototype.toString = function() {
                    var j = this.length;
                    return j === 0 ? "" : arguments.length === 0 ? F13(this, 0, j) : x.apply(this, arguments);
                  }, f.prototype.toLocaleString = f.prototype.toString, f.prototype.equals = function(j) {
                    if (!f.isBuffer(j)) throw new TypeError("Argument must be a Buffer");
                    return this === j || f.compare(this, j) === 0;
                  }, f.prototype.inspect = function() {
                    var j = "", Q2 = s.INSPECT_MAX_BYTES;
                    return j = this.toString("hex", 0, Q2).replace(/(.{2})/g, "$1 ").trim(), this.length > Q2 && (j += " ... "), "<Buffer " + j + ">";
                  }, f.prototype.compare = function(j, Q2, Z2, ne, ae) {
                    if (H2(j, Uint8Array) && (j = f.from(j, j.offset, j.byteLength)), !f.isBuffer(j)) throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof j);
                    if (Q2 === void 0 && (Q2 = 0), Z2 === void 0 && (Z2 = j ? j.length : 0), ne === void 0 && (ne = 0), ae === void 0 && (ae = this.length), Q2 < 0 || Z2 > j.length || ne < 0 || ae > this.length) throw new RangeError("out of range index");
                    if (ne >= ae && Q2 >= Z2) return 0;
                    if (ne >= ae) return -1;
                    if (Q2 >= Z2) return 1;
                    if (this === j) return 0;
                    for (var ue = (ae >>>= 0) - (ne >>>= 0), le = (Z2 >>>= 0) - (Q2 >>>= 0), ce = Math.min(ue, le), se = this.slice(ne, ae), he = j.slice(Q2, Z2), me = 0; me < ce; ++me) if (se[me] !== he[me]) {
                      ue = se[me], le = he[me];
                      break;
                    }
                    return ue < le ? -1 : le < ue ? 1 : 0;
                  }, f.prototype.includes = function(j, Q2, Z2) {
                    return this.indexOf(j, Q2, Z2) !== -1;
                  }, f.prototype.indexOf = function(j, Q2, Z2) {
                    return y(this, j, Q2, Z2, true);
                  }, f.prototype.lastIndexOf = function(j, Q2, Z2) {
                    return y(this, j, Q2, Z2, false);
                  }, f.prototype.write = function(j, Q2, Z2, ne) {
                    if (Q2 === void 0) ne = "utf8", Z2 = this.length, Q2 = 0;
                    else if (Z2 === void 0 && typeof Q2 == "string") ne = Q2, Z2 = this.length, Q2 = 0;
                    else {
                      if (!isFinite(Q2)) throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");
                      Q2 >>>= 0, isFinite(Z2) ? (Z2 >>>= 0, ne === void 0 && (ne = "utf8")) : (ne = Z2, Z2 = void 0);
                    }
                    var ae = this.length - Q2;
                    if ((Z2 === void 0 || Z2 > ae) && (Z2 = ae), j.length > 0 && (Z2 < 0 || Q2 < 0) || Q2 > this.length) throw new RangeError("Attempt to write outside buffer bounds");
                    ne || (ne = "utf8");
                    for (var ue = false; ; ) switch (ne) {
                      case "hex":
                        return _4(this, j, Q2, Z2);
                      case "utf8":
                      case "utf-8":
                        return k(this, j, Q2, Z2);
                      case "ascii":
                        return T2(this, j, Q2, Z2);
                      case "latin1":
                      case "binary":
                        return A2(this, j, Q2, Z2);
                      case "base64":
                        return S2(this, j, Q2, Z2);
                      case "ucs2":
                      case "ucs-2":
                      case "utf16le":
                      case "utf-16le":
                        return C2(this, j, Q2, Z2);
                      default:
                        if (ue) throw new TypeError("Unknown encoding: " + ne);
                        ne = ("" + ne).toLowerCase(), ue = true;
                    }
                  }, f.prototype.toJSON = function() {
                    return { type: "Buffer", data: Array.prototype.slice.call(this._arr || this, 0) };
                  };
                  function N2(j, Q2, Z2) {
                    var ne = "";
                    Z2 = Math.min(j.length, Z2);
                    for (var ae = Q2; ae < Z2; ++ae) ne += String.fromCharCode(127 & j[ae]);
                    return ne;
                  }
                  function D2(j, Q2, Z2) {
                    var ne = "";
                    Z2 = Math.min(j.length, Z2);
                    for (var ae = Q2; ae < Z2; ++ae) ne += String.fromCharCode(j[ae]);
                    return ne;
                  }
                  function I2(j, Q2, Z2) {
                    var ne = j.length;
                    (!Q2 || Q2 < 0) && (Q2 = 0), (!Z2 || Z2 < 0 || Z2 > ne) && (Z2 = ne);
                    for (var ae = "", ue = Q2; ue < Z2; ++ue) ae += q(j[ue]);
                    return ae;
                  }
                  function O2(j, Q2, Z2) {
                    for (var ne = j.slice(Q2, Z2), ae = "", ue = 0; ue < ne.length; ue += 2) ae += String.fromCharCode(ne[ue] + 256 * ne[ue + 1]);
                    return ae;
                  }
                  function L2(j, Q2, Z2) {
                    if (j % 1 != 0 || j < 0) throw new RangeError("offset is not uint");
                    if (j + Q2 > Z2) throw new RangeError("Trying to access beyond buffer length");
                  }
                  function V2(j, Q2, Z2, ne, ae, ue) {
                    if (!f.isBuffer(j)) throw new TypeError('"buffer" argument must be a Buffer instance');
                    if (Q2 > ae || Q2 < ue) throw new RangeError('"value" argument is out of bounds');
                    if (Z2 + ne > j.length) throw new RangeError("Index out of range");
                  }
                  function W2(j, Q2, Z2, ne, ae, ue) {
                    if (Z2 + ne > j.length) throw new RangeError("Index out of range");
                    if (Z2 < 0) throw new RangeError("Index out of range");
                  }
                  function X2(j, Q2, Z2, ne, ae) {
                    return Q2 = +Q2, Z2 >>>= 0, ae || W2(j, 0, Z2, 4), u2.write(j, Q2, Z2, ne, 23, 4), Z2 + 4;
                  }
                  function Y2(j, Q2, Z2, ne, ae) {
                    return Q2 = +Q2, Z2 >>>= 0, ae || W2(j, 0, Z2, 8), u2.write(j, Q2, Z2, ne, 52, 8), Z2 + 8;
                  }
                  f.prototype.slice = function(j, Q2) {
                    var Z2 = this.length;
                    (j = ~~j) < 0 ? (j += Z2) < 0 && (j = 0) : j > Z2 && (j = Z2), (Q2 = Q2 === void 0 ? Z2 : ~~Q2) < 0 ? (Q2 += Z2) < 0 && (Q2 = 0) : Q2 > Z2 && (Q2 = Z2), Q2 < j && (Q2 = j);
                    var ne = this.subarray(j, Q2);
                    return ne.__proto__ = f.prototype, ne;
                  }, f.prototype.readUIntLE = function(j, Q2, Z2) {
                    j >>>= 0, Q2 >>>= 0, Z2 || L2(j, Q2, this.length);
                    for (var ne = this[j], ae = 1, ue = 0; ++ue < Q2 && (ae *= 256); ) ne += this[j + ue] * ae;
                    return ne;
                  }, f.prototype.readUIntBE = function(j, Q2, Z2) {
                    j >>>= 0, Q2 >>>= 0, Z2 || L2(j, Q2, this.length);
                    for (var ne = this[j + --Q2], ae = 1; Q2 > 0 && (ae *= 256); ) ne += this[j + --Q2] * ae;
                    return ne;
                  }, f.prototype.readUInt8 = function(j, Q2) {
                    return j >>>= 0, Q2 || L2(j, 1, this.length), this[j];
                  }, f.prototype.readUInt16LE = function(j, Q2) {
                    return j >>>= 0, Q2 || L2(j, 2, this.length), this[j] | this[j + 1] << 8;
                  }, f.prototype.readUInt16BE = function(j, Q2) {
                    return j >>>= 0, Q2 || L2(j, 2, this.length), this[j] << 8 | this[j + 1];
                  }, f.prototype.readUInt32LE = function(j, Q2) {
                    return j >>>= 0, Q2 || L2(j, 4, this.length), (this[j] | this[j + 1] << 8 | this[j + 2] << 16) + 16777216 * this[j + 3];
                  }, f.prototype.readUInt32BE = function(j, Q2) {
                    return j >>>= 0, Q2 || L2(j, 4, this.length), 16777216 * this[j] + (this[j + 1] << 16 | this[j + 2] << 8 | this[j + 3]);
                  }, f.prototype.readIntLE = function(j, Q2, Z2) {
                    j >>>= 0, Q2 >>>= 0, Z2 || L2(j, Q2, this.length);
                    for (var ne = this[j], ae = 1, ue = 0; ++ue < Q2 && (ae *= 256); ) ne += this[j + ue] * ae;
                    return ne >= (ae *= 128) && (ne -= Math.pow(2, 8 * Q2)), ne;
                  }, f.prototype.readIntBE = function(j, Q2, Z2) {
                    j >>>= 0, Q2 >>>= 0, Z2 || L2(j, Q2, this.length);
                    for (var ne = Q2, ae = 1, ue = this[j + --ne]; ne > 0 && (ae *= 256); ) ue += this[j + --ne] * ae;
                    return ue >= (ae *= 128) && (ue -= Math.pow(2, 8 * Q2)), ue;
                  }, f.prototype.readInt8 = function(j, Q2) {
                    return j >>>= 0, Q2 || L2(j, 1, this.length), 128 & this[j] ? -1 * (255 - this[j] + 1) : this[j];
                  }, f.prototype.readInt16LE = function(j, Q2) {
                    j >>>= 0, Q2 || L2(j, 2, this.length);
                    var Z2 = this[j] | this[j + 1] << 8;
                    return 32768 & Z2 ? 4294901760 | Z2 : Z2;
                  }, f.prototype.readInt16BE = function(j, Q2) {
                    j >>>= 0, Q2 || L2(j, 2, this.length);
                    var Z2 = this[j + 1] | this[j] << 8;
                    return 32768 & Z2 ? 4294901760 | Z2 : Z2;
                  }, f.prototype.readInt32LE = function(j, Q2) {
                    return j >>>= 0, Q2 || L2(j, 4, this.length), this[j] | this[j + 1] << 8 | this[j + 2] << 16 | this[j + 3] << 24;
                  }, f.prototype.readInt32BE = function(j, Q2) {
                    return j >>>= 0, Q2 || L2(j, 4, this.length), this[j] << 24 | this[j + 1] << 16 | this[j + 2] << 8 | this[j + 3];
                  }, f.prototype.readFloatLE = function(j, Q2) {
                    return j >>>= 0, Q2 || L2(j, 4, this.length), u2.read(this, j, true, 23, 4);
                  }, f.prototype.readFloatBE = function(j, Q2) {
                    return j >>>= 0, Q2 || L2(j, 4, this.length), u2.read(this, j, false, 23, 4);
                  }, f.prototype.readDoubleLE = function(j, Q2) {
                    return j >>>= 0, Q2 || L2(j, 8, this.length), u2.read(this, j, true, 52, 8);
                  }, f.prototype.readDoubleBE = function(j, Q2) {
                    return j >>>= 0, Q2 || L2(j, 8, this.length), u2.read(this, j, false, 52, 8);
                  }, f.prototype.writeUIntLE = function(j, Q2, Z2, ne) {
                    j = +j, Q2 >>>= 0, Z2 >>>= 0, ne || V2(this, j, Q2, Z2, Math.pow(2, 8 * Z2) - 1, 0);
                    var ae = 1, ue = 0;
                    for (this[Q2] = 255 & j; ++ue < Z2 && (ae *= 256); ) this[Q2 + ue] = j / ae & 255;
                    return Q2 + Z2;
                  }, f.prototype.writeUIntBE = function(j, Q2, Z2, ne) {
                    j = +j, Q2 >>>= 0, Z2 >>>= 0, ne || V2(this, j, Q2, Z2, Math.pow(2, 8 * Z2) - 1, 0);
                    var ae = Z2 - 1, ue = 1;
                    for (this[Q2 + ae] = 255 & j; --ae >= 0 && (ue *= 256); ) this[Q2 + ae] = j / ue & 255;
                    return Q2 + Z2;
                  }, f.prototype.writeUInt8 = function(j, Q2, Z2) {
                    return j = +j, Q2 >>>= 0, Z2 || V2(this, j, Q2, 1, 255, 0), this[Q2] = 255 & j, Q2 + 1;
                  }, f.prototype.writeUInt16LE = function(j, Q2, Z2) {
                    return j = +j, Q2 >>>= 0, Z2 || V2(this, j, Q2, 2, 65535, 0), this[Q2] = 255 & j, this[Q2 + 1] = j >>> 8, Q2 + 2;
                  }, f.prototype.writeUInt16BE = function(j, Q2, Z2) {
                    return j = +j, Q2 >>>= 0, Z2 || V2(this, j, Q2, 2, 65535, 0), this[Q2] = j >>> 8, this[Q2 + 1] = 255 & j, Q2 + 2;
                  }, f.prototype.writeUInt32LE = function(j, Q2, Z2) {
                    return j = +j, Q2 >>>= 0, Z2 || V2(this, j, Q2, 4, 4294967295, 0), this[Q2 + 3] = j >>> 24, this[Q2 + 2] = j >>> 16, this[Q2 + 1] = j >>> 8, this[Q2] = 255 & j, Q2 + 4;
                  }, f.prototype.writeUInt32BE = function(j, Q2, Z2) {
                    return j = +j, Q2 >>>= 0, Z2 || V2(this, j, Q2, 4, 4294967295, 0), this[Q2] = j >>> 24, this[Q2 + 1] = j >>> 16, this[Q2 + 2] = j >>> 8, this[Q2 + 3] = 255 & j, Q2 + 4;
                  }, f.prototype.writeIntLE = function(j, Q2, Z2, ne) {
                    if (j = +j, Q2 >>>= 0, !ne) {
                      var ae = Math.pow(2, 8 * Z2 - 1);
                      V2(this, j, Q2, Z2, ae - 1, -ae);
                    }
                    var ue = 0, le = 1, ce = 0;
                    for (this[Q2] = 255 & j; ++ue < Z2 && (le *= 256); ) j < 0 && ce === 0 && this[Q2 + ue - 1] !== 0 && (ce = 1), this[Q2 + ue] = (j / le >> 0) - ce & 255;
                    return Q2 + Z2;
                  }, f.prototype.writeIntBE = function(j, Q2, Z2, ne) {
                    if (j = +j, Q2 >>>= 0, !ne) {
                      var ae = Math.pow(2, 8 * Z2 - 1);
                      V2(this, j, Q2, Z2, ae - 1, -ae);
                    }
                    var ue = Z2 - 1, le = 1, ce = 0;
                    for (this[Q2 + ue] = 255 & j; --ue >= 0 && (le *= 256); ) j < 0 && ce === 0 && this[Q2 + ue + 1] !== 0 && (ce = 1), this[Q2 + ue] = (j / le >> 0) - ce & 255;
                    return Q2 + Z2;
                  }, f.prototype.writeInt8 = function(j, Q2, Z2) {
                    return j = +j, Q2 >>>= 0, Z2 || V2(this, j, Q2, 1, 127, -128), j < 0 && (j = 255 + j + 1), this[Q2] = 255 & j, Q2 + 1;
                  }, f.prototype.writeInt16LE = function(j, Q2, Z2) {
                    return j = +j, Q2 >>>= 0, Z2 || V2(this, j, Q2, 2, 32767, -32768), this[Q2] = 255 & j, this[Q2 + 1] = j >>> 8, Q2 + 2;
                  }, f.prototype.writeInt16BE = function(j, Q2, Z2) {
                    return j = +j, Q2 >>>= 0, Z2 || V2(this, j, Q2, 2, 32767, -32768), this[Q2] = j >>> 8, this[Q2 + 1] = 255 & j, Q2 + 2;
                  }, f.prototype.writeInt32LE = function(j, Q2, Z2) {
                    return j = +j, Q2 >>>= 0, Z2 || V2(this, j, Q2, 4, 2147483647, -2147483648), this[Q2] = 255 & j, this[Q2 + 1] = j >>> 8, this[Q2 + 2] = j >>> 16, this[Q2 + 3] = j >>> 24, Q2 + 4;
                  }, f.prototype.writeInt32BE = function(j, Q2, Z2) {
                    return j = +j, Q2 >>>= 0, Z2 || V2(this, j, Q2, 4, 2147483647, -2147483648), j < 0 && (j = 4294967295 + j + 1), this[Q2] = j >>> 24, this[Q2 + 1] = j >>> 16, this[Q2 + 2] = j >>> 8, this[Q2 + 3] = 255 & j, Q2 + 4;
                  }, f.prototype.writeFloatLE = function(j, Q2, Z2) {
                    return X2(this, j, Q2, true, Z2);
                  }, f.prototype.writeFloatBE = function(j, Q2, Z2) {
                    return X2(this, j, Q2, false, Z2);
                  }, f.prototype.writeDoubleLE = function(j, Q2, Z2) {
                    return Y2(this, j, Q2, true, Z2);
                  }, f.prototype.writeDoubleBE = function(j, Q2, Z2) {
                    return Y2(this, j, Q2, false, Z2);
                  }, f.prototype.copy = function(j, Q2, Z2, ne) {
                    if (!f.isBuffer(j)) throw new TypeError("argument should be a Buffer");
                    if (Z2 || (Z2 = 0), ne || ne === 0 || (ne = this.length), Q2 >= j.length && (Q2 = j.length), Q2 || (Q2 = 0), ne > 0 && ne < Z2 && (ne = Z2), ne === Z2 || j.length === 0 || this.length === 0) return 0;
                    if (Q2 < 0) throw new RangeError("targetStart out of bounds");
                    if (Z2 < 0 || Z2 >= this.length) throw new RangeError("Index out of range");
                    if (ne < 0) throw new RangeError("sourceEnd out of bounds");
                    ne > this.length && (ne = this.length), j.length - Q2 < ne - Z2 && (ne = j.length - Q2 + Z2);
                    var ae = ne - Z2;
                    if (this === j && typeof Uint8Array.prototype.copyWithin == "function") this.copyWithin(Q2, Z2, ne);
                    else if (this === j && Z2 < Q2 && Q2 < ne) for (var ue = ae - 1; ue >= 0; --ue) j[ue + Q2] = this[ue + Z2];
                    else Uint8Array.prototype.set.call(j, this.subarray(Z2, ne), Q2);
                    return ae;
                  }, f.prototype.fill = function(j, Q2, Z2, ne) {
                    if (typeof j == "string") {
                      if (typeof Q2 == "string" ? (ne = Q2, Q2 = 0, Z2 = this.length) : typeof Z2 == "string" && (ne = Z2, Z2 = this.length), ne !== void 0 && typeof ne != "string") throw new TypeError("encoding must be a string");
                      if (typeof ne == "string" && !f.isEncoding(ne)) throw new TypeError("Unknown encoding: " + ne);
                      if (j.length === 1) {
                        var ae = j.charCodeAt(0);
                        (ne === "utf8" && ae < 128 || ne === "latin1") && (j = ae);
                      }
                    } else typeof j == "number" && (j &= 255);
                    if (Q2 < 0 || this.length < Q2 || this.length < Z2) throw new RangeError("Out of range index");
                    if (Z2 <= Q2) return this;
                    var ue;
                    if (Q2 >>>= 0, Z2 = Z2 === void 0 ? this.length : Z2 >>> 0, j || (j = 0), typeof j == "number") for (ue = Q2; ue < Z2; ++ue) this[ue] = j;
                    else {
                      var le = f.isBuffer(j) ? j : f.from(j, ne), ce = le.length;
                      if (ce === 0) throw new TypeError('The value "' + j + '" is invalid for argument "value"');
                      for (ue = 0; ue < Z2 - Q2; ++ue) this[ue + Q2] = le[ue % ce];
                    }
                    return this;
                  };
                  var K2 = /[^+/0-9A-Za-z-_]/g;
                  function q(j) {
                    return j < 16 ? "0" + j.toString(16) : j.toString(16);
                  }
                  function re(j, Q2) {
                    var Z2;
                    Q2 = Q2 || 1 / 0;
                    for (var ne = j.length, ae = null, ue = [], le = 0; le < ne; ++le) {
                      if ((Z2 = j.charCodeAt(le)) > 55295 && Z2 < 57344) {
                        if (!ae) {
                          if (Z2 > 56319) {
                            (Q2 -= 3) > -1 && ue.push(239, 191, 189);
                            continue;
                          }
                          if (le + 1 === ne) {
                            (Q2 -= 3) > -1 && ue.push(239, 191, 189);
                            continue;
                          }
                          ae = Z2;
                          continue;
                        }
                        if (Z2 < 56320) {
                          (Q2 -= 3) > -1 && ue.push(239, 191, 189), ae = Z2;
                          continue;
                        }
                        Z2 = 65536 + (ae - 55296 << 10 | Z2 - 56320);
                      } else ae && (Q2 -= 3) > -1 && ue.push(239, 191, 189);
                      if (ae = null, Z2 < 128) {
                        if ((Q2 -= 1) < 0) break;
                        ue.push(Z2);
                      } else if (Z2 < 2048) {
                        if ((Q2 -= 2) < 0) break;
                        ue.push(Z2 >> 6 | 192, 63 & Z2 | 128);
                      } else if (Z2 < 65536) {
                        if ((Q2 -= 3) < 0) break;
                        ue.push(Z2 >> 12 | 224, Z2 >> 6 & 63 | 128, 63 & Z2 | 128);
                      } else {
                        if (!(Z2 < 1114112)) throw new Error("Invalid code point");
                        if ((Q2 -= 4) < 0) break;
                        ue.push(Z2 >> 18 | 240, Z2 >> 12 & 63 | 128, Z2 >> 6 & 63 | 128, 63 & Z2 | 128);
                      }
                    }
                    return ue;
                  }
                  function R2(j) {
                    return l.toByteArray(function(Q2) {
                      if ((Q2 = (Q2 = Q2.split("=")[0]).trim().replace(K2, "")).length < 2) return "";
                      for (; Q2.length % 4 != 0; ) Q2 += "=";
                      return Q2;
                    }(j));
                  }
                  function z(j, Q2, Z2, ne) {
                    for (var ae = 0; ae < ne && !(ae + Z2 >= Q2.length || ae >= j.length); ++ae) Q2[ae + Z2] = j[ae];
                    return ae;
                  }
                  function H2(j, Q2) {
                    return j instanceof Q2 || j != null && j.constructor != null && j.constructor.name != null && j.constructor.name === Q2.name;
                  }
                  function te(j) {
                    return j != j;
                  }
                }).call(this);
              }).call(this, a("buffer").Buffer);
            }, { "base64-js": 1, buffer: 3, ieee754: 4 }], 4: [function(a, o, s) {
              s.read = function(i, l, u2, c, f) {
                var h, p, d = 8 * f - c - 1, v = (1 << d) - 1, m = v >> 1, g = -7, x = u2 ? f - 1 : 0, b = u2 ? -1 : 1, y = i[l + x];
                for (x += b, h = y & (1 << -g) - 1, y >>= -g, g += d; g > 0; h = 256 * h + i[l + x], x += b, g -= 8) ;
                for (p = h & (1 << -g) - 1, h >>= -g, g += c; g > 0; p = 256 * p + i[l + x], x += b, g -= 8) ;
                if (h === 0) h = 1 - m;
                else {
                  if (h === v) return p ? NaN : 1 / 0 * (y ? -1 : 1);
                  p += Math.pow(2, c), h -= m;
                }
                return (y ? -1 : 1) * p * Math.pow(2, h - c);
              }, s.write = function(i, l, u2, c, f, h) {
                var p, d, v, m = 8 * h - f - 1, g = (1 << m) - 1, x = g >> 1, b = f === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, y = c ? 0 : h - 1, w = c ? 1 : -1, _4 = l < 0 || l === 0 && 1 / l < 0 ? 1 : 0;
                for (l = Math.abs(l), isNaN(l) || l === 1 / 0 ? (d = isNaN(l) ? 1 : 0, p = g) : (p = Math.floor(Math.log(l) / Math.LN2), l * (v = Math.pow(2, -p)) < 1 && (p--, v *= 2), (l += p + x >= 1 ? b / v : b * Math.pow(2, 1 - x)) * v >= 2 && (p++, v /= 2), p + x >= g ? (d = 0, p = g) : p + x >= 1 ? (d = (l * v - 1) * Math.pow(2, f), p += x) : (d = l * Math.pow(2, x - 1) * Math.pow(2, f), p = 0)); f >= 8; i[u2 + y] = 255 & d, y += w, d /= 256, f -= 8) ;
                for (p = p << f | d, m += f; m > 0; i[u2 + y] = 255 & p, y += w, p /= 256, m -= 8) ;
                i[u2 + y - w] |= 128 * _4;
              };
            }, {}], 5: [function(a, o, s) {
              var i, l, u2 = o.exports = {};
              function c() {
                throw new Error("setTimeout has not been defined");
              }
              function f() {
                throw new Error("clearTimeout has not been defined");
              }
              function h(w) {
                if (i === setTimeout) return setTimeout(w, 0);
                if ((i === c || !i) && setTimeout) return i = setTimeout, setTimeout(w, 0);
                try {
                  return i(w, 0);
                } catch {
                  try {
                    return i.call(null, w, 0);
                  } catch {
                    return i.call(this, w, 0);
                  }
                }
              }
              (function() {
                try {
                  i = typeof setTimeout == "function" ? setTimeout : c;
                } catch {
                  i = c;
                }
                try {
                  l = typeof clearTimeout == "function" ? clearTimeout : f;
                } catch {
                  l = f;
                }
              })();
              var p, d = [], v = false, m = -1;
              function g() {
                v && p && (v = false, p.length ? d = p.concat(d) : m = -1, d.length && x());
              }
              function x() {
                if (!v) {
                  var w = h(g);
                  v = true;
                  for (var _4 = d.length; _4; ) {
                    for (p = d, d = []; ++m < _4; ) p && p[m].run();
                    m = -1, _4 = d.length;
                  }
                  p = null, v = false, function(k) {
                    if (l === clearTimeout) return clearTimeout(k);
                    if ((l === f || !l) && clearTimeout) return l = clearTimeout, clearTimeout(k);
                    try {
                      l(k);
                    } catch {
                      try {
                        return l.call(null, k);
                      } catch {
                        return l.call(this, k);
                      }
                    }
                  }(w);
                }
              }
              function b(w, _4) {
                this.fun = w, this.array = _4;
              }
              function y() {
              }
              u2.nextTick = function(w) {
                var _4 = new Array(arguments.length - 1);
                if (arguments.length > 1) for (var k = 1; k < arguments.length; k++) _4[k - 1] = arguments[k];
                d.push(new b(w, _4)), d.length !== 1 || v || h(x);
              }, b.prototype.run = function() {
                this.fun.apply(null, this.array);
              }, u2.title = "browser", u2.browser = true, u2.env = {}, u2.argv = [], u2.version = "", u2.versions = {}, u2.on = y, u2.addListener = y, u2.once = y, u2.off = y, u2.removeListener = y, u2.removeAllListeners = y, u2.emit = y, u2.prependListener = y, u2.prependOnceListener = y, u2.listeners = function(w) {
                return [];
              }, u2.binding = function(w) {
                throw new Error("process.binding is not supported");
              }, u2.cwd = function() {
                return "/";
              }, u2.chdir = function(w) {
                throw new Error("process.chdir is not supported");
              }, u2.umask = function() {
                return 0;
              };
            }, {}], 6: [function(a, o, s) {
              o.exports = { alpha_shape: a("alpha-shape"), convex_hull: a("convex-hull"), delaunay_triangulate: a("delaunay-triangulate"), gl_cone3d: a("gl-cone3d"), gl_error3d: a("gl-error3d"), gl_heatmap2d: a("gl-heatmap2d"), gl_line3d: a("gl-line3d"), gl_mesh3d: a("gl-mesh3d"), gl_plot2d: a("gl-plot2d"), gl_plot3d: a("gl-plot3d"), gl_pointcloud2d: a("gl-pointcloud2d"), gl_scatter3d: a("gl-scatter3d"), gl_select_box: a("gl-select-box"), gl_spikes2d: a("gl-spikes2d"), gl_streamtube3d: a("gl-streamtube3d"), gl_surface3d: a("gl-surface3d"), ndarray: a("ndarray"), ndarray_linear_interpolate: a("ndarray-linear-interpolate") };
            }, { "alpha-shape": 12, "convex-hull": 58, "delaunay-triangulate": 63, "gl-cone3d": 79, "gl-error3d": 84, "gl-heatmap2d": 88, "gl-line3d": 91, "gl-mesh3d": 112, "gl-plot2d": 118, "gl-plot3d": 121, "gl-pointcloud2d": 123, "gl-scatter3d": 128, "gl-select-box": 130, "gl-spikes2d": 139, "gl-streamtube3d": 143, "gl-surface3d": 145, ndarray: 259, "ndarray-linear-interpolate": 253 }], 7: [function(a, o, s) {
              "use strict";
              o.exports = function(h) {
                var p = (h = h || {}).eye || [0, 0, 1], d = h.center || [0, 0, 0], v = h.up || [0, 1, 0], m = h.distanceLimits || [0, 1 / 0], g = h.mode || "turntable", x = i(), b = l(), y = u2();
                return x.setDistanceLimits(m[0], m[1]), x.lookAt(0, p, d, v), b.setDistanceLimits(m[0], m[1]), b.lookAt(0, p, d, v), y.setDistanceLimits(m[0], m[1]), y.lookAt(0, p, d, v), new c({ turntable: x, orbit: b, matrix: y }, g);
              };
              var i = a("turntable-camera-controller"), l = a("orbit-camera-controller"), u2 = a("matrix-camera-controller");
              function c(h, p) {
                this._controllerNames = Object.keys(h), this._controllerList = this._controllerNames.map(function(d) {
                  return h[d];
                }), this._mode = p, this._active = h[p], this._active || (this._mode = "turntable", this._active = h.turntable), this.modes = this._controllerNames, this.computedMatrix = this._active.computedMatrix, this.computedEye = this._active.computedEye, this.computedUp = this._active.computedUp, this.computedCenter = this._active.computedCenter, this.computedRadius = this._active.computedRadius;
              }
              var f = c.prototype;
              f.flush = function(h) {
                for (var p = this._controllerList, d = 0; d < p.length; ++d) p[d].flush(h);
              }, f.idle = function(h) {
                for (var p = this._controllerList, d = 0; d < p.length; ++d) p[d].idle(h);
              }, f.lookAt = function(h, p, d, v) {
                for (var m = this._controllerList, g = 0; g < m.length; ++g) m[g].lookAt(h, p, d, v);
              }, f.rotate = function(h, p, d, v) {
                for (var m = this._controllerList, g = 0; g < m.length; ++g) m[g].rotate(h, p, d, v);
              }, f.pan = function(h, p, d, v) {
                for (var m = this._controllerList, g = 0; g < m.length; ++g) m[g].pan(h, p, d, v);
              }, f.translate = function(h, p, d, v) {
                for (var m = this._controllerList, g = 0; g < m.length; ++g) m[g].translate(h, p, d, v);
              }, f.setMatrix = function(h, p) {
                for (var d = this._controllerList, v = 0; v < d.length; ++v) d[v].setMatrix(h, p);
              }, f.setDistanceLimits = function(h, p) {
                for (var d = this._controllerList, v = 0; v < d.length; ++v) d[v].setDistanceLimits(h, p);
              }, f.setDistance = function(h, p) {
                for (var d = this._controllerList, v = 0; v < d.length; ++v) d[v].setDistance(h, p);
              }, f.recalcMatrix = function(h) {
                this._active.recalcMatrix(h);
              }, f.getDistance = function(h) {
                return this._active.getDistance(h);
              }, f.getDistanceLimits = function(h) {
                return this._active.getDistanceLimits(h);
              }, f.lastT = function() {
                return this._active.lastT();
              }, f.setMode = function(h) {
                if (h !== this._mode) {
                  var p = this._controllerNames.indexOf(h);
                  if (!(p < 0)) {
                    var d = this._active, v = this._controllerList[p], m = Math.max(d.lastT(), v.lastT());
                    d.recalcMatrix(m), v.setMatrix(m, d.computedMatrix), this._active = v, this._mode = h, this.computedMatrix = this._active.computedMatrix, this.computedEye = this._active.computedEye, this.computedUp = this._active.computedUp, this.computedCenter = this._active.computedCenter, this.computedRadius = this._active.computedRadius;
                  }
                }
              }, f.getMode = function() {
                return this._mode;
              };
            }, { "matrix-camera-controller": 245, "orbit-camera-controller": 263, "turntable-camera-controller": 305 }], 8: [function(a, o, s) {
              "use strict";
              var i = typeof WeakMap > "u" ? a("weak-map") : WeakMap, l = a("gl-buffer"), u2 = a("gl-vao"), c = new i();
              o.exports = function(f) {
                var h = c.get(f), p = h && (h._triangleBuffer.handle || h._triangleBuffer.buffer);
                if (!p || !f.isBuffer(p)) {
                  var d = l(f, new Float32Array([-1, -1, -1, 4, 4, -1]));
                  (h = u2(f, [{ buffer: d, type: f.FLOAT, size: 2 }]))._triangleBuffer = d, c.set(f, h);
                }
                h.bind(), f.drawArrays(f.TRIANGLES, 0, 3), h.unbind();
              };
            }, { "gl-buffer": 78, "gl-vao": 150, "weak-map": 313 }], 9: [function(a, o, s) {
              var i = a("pad-left");
              o.exports = function(l, u2, c) {
                u2 = typeof u2 == "number" ? u2 : 1, c = c || ": ";
                var f = l.split(/\r?\n/), h = String(f.length + u2 - 1).length;
                return f.map(function(p, d) {
                  var v = d + u2, m = String(v).length;
                  return i(v, h - m) + c + p;
                }).join(`
`);
              };
            }, { "pad-left": 264 }], 10: [function(a, o, s) {
              "use strict";
              o.exports = function(u2) {
                var c = u2.length;
                if (c === 0) return [];
                if (c === 1) return [0];
                for (var f = u2[0].length, h = [u2[0]], p = [0], d = 1; d < c; ++d) if (h.push(u2[d]), l(h, f)) {
                  if (p.push(d), p.length === f + 1) return p;
                } else h.pop();
                return p;
              };
              var i = a("robust-orientation");
              function l(u2, c) {
                for (var f = new Array(c + 1), h = 0; h < u2.length; ++h) f[h] = u2[h];
                for (h = 0; h <= u2.length; ++h) {
                  for (var p = u2.length; p <= c; ++p) {
                    for (var d = new Array(c), v = 0; v < c; ++v) d[v] = Math.pow(p + 1 - h, v);
                    f[p] = d;
                  }
                  if (i.apply(void 0, f)) return true;
                }
                return false;
              }
            }, { "robust-orientation": 284 }], 11: [function(a, o, s) {
              "use strict";
              o.exports = function(u2, c) {
                return i(c).filter(function(f) {
                  for (var h = new Array(f.length), p = 0; p < f.length; ++p) h[p] = c[f[p]];
                  return l(h) * u2 < 1;
                });
              };
              var i = a("delaunay-triangulate"), l = a("circumradius");
            }, { circumradius: 49, "delaunay-triangulate": 63 }], 12: [function(a, o, s) {
              o.exports = function(u2, c) {
                return l(i(u2, c));
              };
              var i = a("alpha-complex"), l = a("simplicial-complex-boundary");
            }, { "alpha-complex": 11, "simplicial-complex-boundary": 290 }], 13: [function(a, o, s) {
              o.exports = function(i) {
                return atob(i);
              };
            }, {}], 14: [function(a, o, s) {
              "use strict";
              o.exports = function(u2, c) {
                for (var f = c.length, h = new Array(f + 1), p = 0; p < f; ++p) {
                  for (var d = new Array(f + 1), v = 0; v <= f; ++v) d[v] = u2[v][p];
                  h[p] = d;
                }
                for (h[f] = new Array(f + 1), p = 0; p <= f; ++p) h[f][p] = 1;
                var m = new Array(f + 1);
                for (p = 0; p < f; ++p) m[p] = c[p];
                m[f] = 1;
                var g = i(h, m), x = l(g[f + 1]);
                x === 0 && (x = 1);
                var b = new Array(f + 1);
                for (p = 0; p <= f; ++p) b[p] = l(g[p]) / x;
                return b;
              };
              var i = a("robust-linear-solve");
              function l(u2) {
                for (var c = 0, f = 0; f < u2.length; ++f) c += u2[f];
                return c;
              }
            }, { "robust-linear-solve": 283 }], 15: [function(a, o, s) {
              "use strict";
              var i = a("./lib/rationalize");
              o.exports = function(l, u2) {
                return i(l[0].mul(u2[1]).add(u2[0].mul(l[1])), l[1].mul(u2[1]));
              };
            }, { "./lib/rationalize": 25 }], 16: [function(a, o, s) {
              "use strict";
              o.exports = function(i, l) {
                return i[0].mul(l[1]).cmp(l[0].mul(i[1]));
              };
            }, {}], 17: [function(a, o, s) {
              "use strict";
              var i = a("./lib/rationalize");
              o.exports = function(l, u2) {
                return i(l[0].mul(u2[1]), l[1].mul(u2[0]));
              };
            }, { "./lib/rationalize": 25 }], 18: [function(a, o, s) {
              "use strict";
              var i = a("./is-rat"), l = a("./lib/is-bn"), u2 = a("./lib/num-to-bn"), c = a("./lib/str-to-bn"), f = a("./lib/rationalize"), h = a("./div");
              o.exports = function p(d, v) {
                if (i(d)) return v ? h(d, p(v)) : [d[0].clone(), d[1].clone()];
                var m, g, x = 0;
                if (l(d)) m = d.clone();
                else if (typeof d == "string") m = c(d);
                else {
                  if (d === 0) return [u2(0), u2(1)];
                  if (d === Math.floor(d)) m = u2(d);
                  else {
                    for (; d !== Math.floor(d); ) d *= Math.pow(2, 256), x -= 256;
                    m = u2(d);
                  }
                }
                if (i(v)) m.mul(v[1]), g = v[0].clone();
                else if (l(v)) g = v.clone();
                else if (typeof v == "string") g = c(v);
                else if (v) if (v === Math.floor(v)) g = u2(v);
                else {
                  for (; v !== Math.floor(v); ) v *= Math.pow(2, 256), x += 256;
                  g = u2(v);
                }
                else g = u2(1);
                return x > 0 ? m = m.ushln(x) : x < 0 && (g = g.ushln(-x)), f(m, g);
              };
            }, { "./div": 17, "./is-rat": 19, "./lib/is-bn": 23, "./lib/num-to-bn": 24, "./lib/rationalize": 25, "./lib/str-to-bn": 26 }], 19: [function(a, o, s) {
              "use strict";
              var i = a("./lib/is-bn");
              o.exports = function(l) {
                return Array.isArray(l) && l.length === 2 && i(l[0]) && i(l[1]);
              };
            }, { "./lib/is-bn": 23 }], 20: [function(a, o, s) {
              "use strict";
              var i = a("bn.js");
              o.exports = function(l) {
                return l.cmp(new i(0));
              };
            }, { "bn.js": 33 }], 21: [function(a, o, s) {
              "use strict";
              var i = a("./bn-sign");
              o.exports = function(l) {
                var u2 = l.length, c = l.words, f = 0;
                if (u2 === 1) f = c[0];
                else if (u2 === 2) f = c[0] + 67108864 * c[1];
                else for (var h = 0; h < u2; h++) {
                  var p = c[h];
                  f += p * Math.pow(67108864, h);
                }
                return i(l) * f;
              };
            }, { "./bn-sign": 20 }], 22: [function(a, o, s) {
              "use strict";
              var i = a("double-bits"), l = a("bit-twiddle").countTrailingZeros;
              o.exports = function(u2) {
                var c = l(i.lo(u2));
                if (c < 32) return c;
                var f = l(i.hi(u2));
                return f > 20 ? 52 : f + 32;
              };
            }, { "bit-twiddle": 32, "double-bits": 64 }], 23: [function(a, o, s) {
              "use strict";
              a("bn.js"), o.exports = function(i) {
                return i && typeof i == "object" && Boolean(i.words);
              };
            }, { "bn.js": 33 }], 24: [function(a, o, s) {
              "use strict";
              var i = a("bn.js"), l = a("double-bits");
              o.exports = function(u2) {
                var c = l.exponent(u2);
                return c < 52 ? new i(u2) : new i(u2 * Math.pow(2, 52 - c)).ushln(c - 52);
              };
            }, { "bn.js": 33, "double-bits": 64 }], 25: [function(a, o, s) {
              "use strict";
              var i = a("./num-to-bn"), l = a("./bn-sign");
              o.exports = function(u2, c) {
                var f = l(u2), h = l(c);
                if (f === 0) return [i(0), i(1)];
                if (h === 0) return [i(0), i(0)];
                h < 0 && (u2 = u2.neg(), c = c.neg());
                var p = u2.gcd(c);
                return p.cmpn(1) ? [u2.div(p), c.div(p)] : [u2, c];
              };
            }, { "./bn-sign": 20, "./num-to-bn": 24 }], 26: [function(a, o, s) {
              "use strict";
              var i = a("bn.js");
              o.exports = function(l) {
                return new i(l);
              };
            }, { "bn.js": 33 }], 27: [function(a, o, s) {
              "use strict";
              var i = a("./lib/rationalize");
              o.exports = function(l, u2) {
                return i(l[0].mul(u2[0]), l[1].mul(u2[1]));
              };
            }, { "./lib/rationalize": 25 }], 28: [function(a, o, s) {
              "use strict";
              var i = a("./lib/bn-sign");
              o.exports = function(l) {
                return i(l[0]) * i(l[1]);
              };
            }, { "./lib/bn-sign": 20 }], 29: [function(a, o, s) {
              "use strict";
              var i = a("./lib/rationalize");
              o.exports = function(l, u2) {
                return i(l[0].mul(u2[1]).sub(l[1].mul(u2[0])), l[1].mul(u2[1]));
              };
            }, { "./lib/rationalize": 25 }], 30: [function(a, o, s) {
              "use strict";
              var i = a("./lib/bn-to-num"), l = a("./lib/ctz");
              o.exports = function(u2) {
                var c = u2[0], f = u2[1];
                if (c.cmpn(0) === 0) return 0;
                var h = c.abs().divmod(f.abs()), p = h.div, d = i(p), v = h.mod, m = c.negative !== f.negative ? -1 : 1;
                if (v.cmpn(0) === 0) return m * d;
                if (d) {
                  var g = l(d) + 4, x = i(v.ushln(g).divRound(f));
                  return m * (d + x * Math.pow(2, -g));
                }
                var b = f.bitLength() - v.bitLength() + 53;
                return x = i(v.ushln(b).divRound(f)), b < 1023 ? m * x * Math.pow(2, -b) : (x *= Math.pow(2, -1023), m * x * Math.pow(2, 1023 - b));
              };
            }, { "./lib/bn-to-num": 21, "./lib/ctz": 22 }], 31: [function(a, o, s) {
              "use strict";
              function i(p, d, v, m, g) {
                for (var x = g + 1; m <= g; ) {
                  var b = m + g >>> 1, y = p[b];
                  (v !== void 0 ? v(y, d) : y - d) >= 0 ? (x = b, g = b - 1) : m = b + 1;
                }
                return x;
              }
              function l(p, d, v, m, g) {
                for (var x = g + 1; m <= g; ) {
                  var b = m + g >>> 1, y = p[b];
                  (v !== void 0 ? v(y, d) : y - d) > 0 ? (x = b, g = b - 1) : m = b + 1;
                }
                return x;
              }
              function u2(p, d, v, m, g) {
                for (var x = m - 1; m <= g; ) {
                  var b = m + g >>> 1, y = p[b];
                  (v !== void 0 ? v(y, d) : y - d) < 0 ? (x = b, m = b + 1) : g = b - 1;
                }
                return x;
              }
              function c(p, d, v, m, g) {
                for (var x = m - 1; m <= g; ) {
                  var b = m + g >>> 1, y = p[b];
                  (v !== void 0 ? v(y, d) : y - d) <= 0 ? (x = b, m = b + 1) : g = b - 1;
                }
                return x;
              }
              function f(p, d, v, m, g) {
                for (; m <= g; ) {
                  var x = m + g >>> 1, b = p[x], y = v !== void 0 ? v(b, d) : b - d;
                  if (y === 0) return x;
                  y <= 0 ? m = x + 1 : g = x - 1;
                }
                return -1;
              }
              function h(p, d, v, m, g, x) {
                return typeof v == "function" ? x(p, d, v, m === void 0 ? 0 : 0 | m, g === void 0 ? p.length - 1 : 0 | g) : x(p, d, void 0, v === void 0 ? 0 : 0 | v, m === void 0 ? p.length - 1 : 0 | m);
              }
              o.exports = { ge: function(p, d, v, m, g) {
                return h(p, d, v, m, g, i);
              }, gt: function(p, d, v, m, g) {
                return h(p, d, v, m, g, l);
              }, lt: function(p, d, v, m, g) {
                return h(p, d, v, m, g, u2);
              }, le: function(p, d, v, m, g) {
                return h(p, d, v, m, g, c);
              }, eq: function(p, d, v, m, g) {
                return h(p, d, v, m, g, f);
              } };
            }, {}], 32: [function(a, o, s) {
              "use strict";
              function i(u2) {
                var c = 32;
                return (u2 &= -u2) && c--, 65535 & u2 && (c -= 16), 16711935 & u2 && (c -= 8), 252645135 & u2 && (c -= 4), 858993459 & u2 && (c -= 2), 1431655765 & u2 && (c -= 1), c;
              }
              s.INT_BITS = 32, s.INT_MAX = 2147483647, s.INT_MIN = -1 << 31, s.sign = function(u2) {
                return (u2 > 0) - (u2 < 0);
              }, s.abs = function(u2) {
                var c = u2 >> 31;
                return (u2 ^ c) - c;
              }, s.min = function(u2, c) {
                return c ^ (u2 ^ c) & -(u2 < c);
              }, s.max = function(u2, c) {
                return u2 ^ (u2 ^ c) & -(u2 < c);
              }, s.isPow2 = function(u2) {
                return !(u2 & u2 - 1 || !u2);
              }, s.log2 = function(u2) {
                var c, f;
                return c = (u2 > 65535) << 4, c |= f = ((u2 >>>= c) > 255) << 3, c |= f = ((u2 >>>= f) > 15) << 2, (c |= f = ((u2 >>>= f) > 3) << 1) | (u2 >>>= f) >> 1;
              }, s.log10 = function(u2) {
                return u2 >= 1e9 ? 9 : u2 >= 1e8 ? 8 : u2 >= 1e7 ? 7 : u2 >= 1e6 ? 6 : u2 >= 1e5 ? 5 : u2 >= 1e4 ? 4 : u2 >= 1e3 ? 3 : u2 >= 100 ? 2 : u2 >= 10 ? 1 : 0;
              }, s.popCount = function(u2) {
                return 16843009 * ((u2 = (858993459 & (u2 -= u2 >>> 1 & 1431655765)) + (u2 >>> 2 & 858993459)) + (u2 >>> 4) & 252645135) >>> 24;
              }, s.countTrailingZeros = i, s.nextPow2 = function(u2) {
                return u2 += u2 === 0, --u2, u2 |= u2 >>> 1, u2 |= u2 >>> 2, u2 |= u2 >>> 4, u2 |= u2 >>> 8, (u2 |= u2 >>> 16) + 1;
              }, s.prevPow2 = function(u2) {
                return u2 |= u2 >>> 1, u2 |= u2 >>> 2, u2 |= u2 >>> 4, u2 |= u2 >>> 8, (u2 |= u2 >>> 16) - (u2 >>> 1);
              }, s.parity = function(u2) {
                return u2 ^= u2 >>> 16, u2 ^= u2 >>> 8, u2 ^= u2 >>> 4, 27030 >>> (u2 &= 15) & 1;
              };
              var l = new Array(256);
              (function(u2) {
                for (var c = 0; c < 256; ++c) {
                  var f = c, h = c, p = 7;
                  for (f >>>= 1; f; f >>>= 1) h <<= 1, h |= 1 & f, --p;
                  u2[c] = h << p & 255;
                }
              })(l), s.reverse = function(u2) {
                return l[255 & u2] << 24 | l[u2 >>> 8 & 255] << 16 | l[u2 >>> 16 & 255] << 8 | l[u2 >>> 24 & 255];
              }, s.interleave2 = function(u2, c) {
                return (u2 = 1431655765 & ((u2 = 858993459 & ((u2 = 252645135 & ((u2 = 16711935 & ((u2 &= 65535) | u2 << 8)) | u2 << 4)) | u2 << 2)) | u2 << 1)) | (c = 1431655765 & ((c = 858993459 & ((c = 252645135 & ((c = 16711935 & ((c &= 65535) | c << 8)) | c << 4)) | c << 2)) | c << 1)) << 1;
              }, s.deinterleave2 = function(u2, c) {
                return (u2 = 65535 & ((u2 = 16711935 & ((u2 = 252645135 & ((u2 = 858993459 & ((u2 = u2 >>> c & 1431655765) | u2 >>> 1)) | u2 >>> 2)) | u2 >>> 4)) | u2 >>> 16)) << 16 >> 16;
              }, s.interleave3 = function(u2, c, f) {
                return u2 = 1227133513 & ((u2 = 3272356035 & ((u2 = 251719695 & ((u2 = 4278190335 & ((u2 &= 1023) | u2 << 16)) | u2 << 8)) | u2 << 4)) | u2 << 2), (u2 |= (c = 1227133513 & ((c = 3272356035 & ((c = 251719695 & ((c = 4278190335 & ((c &= 1023) | c << 16)) | c << 8)) | c << 4)) | c << 2)) << 1) | (f = 1227133513 & ((f = 3272356035 & ((f = 251719695 & ((f = 4278190335 & ((f &= 1023) | f << 16)) | f << 8)) | f << 4)) | f << 2)) << 2;
              }, s.deinterleave3 = function(u2, c) {
                return (u2 = 1023 & ((u2 = 4278190335 & ((u2 = 251719695 & ((u2 = 3272356035 & ((u2 = u2 >>> c & 1227133513) | u2 >>> 2)) | u2 >>> 4)) | u2 >>> 8)) | u2 >>> 16)) << 22 >> 22;
              }, s.nextCombination = function(u2) {
                var c = u2 | u2 - 1;
                return c + 1 | (~c & -~c) - 1 >>> i(u2) + 1;
              };
            }, {}], 33: [function(a, o, s) {
              (function(i, l) {
                "use strict";
                function u2(D2, I2) {
                  if (!D2) throw new Error(I2 || "Assertion failed");
                }
                function c(D2, I2) {
                  D2.super_ = I2;
                  var O2 = function() {
                  };
                  O2.prototype = I2.prototype, D2.prototype = new O2(), D2.prototype.constructor = D2;
                }
                function f(D2, I2, O2) {
                  if (f.isBN(D2)) return D2;
                  this.negative = 0, this.words = null, this.length = 0, this.red = null, D2 !== null && (I2 !== "le" && I2 !== "be" || (O2 = I2, I2 = 10), this._init(D2 || 0, I2 || 10, O2 || "be"));
                }
                var h;
                typeof i == "object" ? i.exports = f : l.BN = f, f.BN = f, f.wordSize = 26;
                try {
                  h = typeof window < "u" && window.Buffer !== void 0 ? window.Buffer : a("buffer").Buffer;
                } catch {
                }
                function p(D2, I2) {
                  var O2 = D2.charCodeAt(I2);
                  return O2 >= 65 && O2 <= 70 ? O2 - 55 : O2 >= 97 && O2 <= 102 ? O2 - 87 : O2 - 48 & 15;
                }
                function d(D2, I2, O2) {
                  var L2 = p(D2, O2);
                  return O2 - 1 >= I2 && (L2 |= p(D2, O2 - 1) << 4), L2;
                }
                function v(D2, I2, O2, L2) {
                  for (var V2 = 0, W2 = Math.min(D2.length, O2), X2 = I2; X2 < W2; X2++) {
                    var Y2 = D2.charCodeAt(X2) - 48;
                    V2 *= L2, V2 += Y2 >= 49 ? Y2 - 49 + 10 : Y2 >= 17 ? Y2 - 17 + 10 : Y2;
                  }
                  return V2;
                }
                f.isBN = function(D2) {
                  return D2 instanceof f || D2 !== null && typeof D2 == "object" && D2.constructor.wordSize === f.wordSize && Array.isArray(D2.words);
                }, f.max = function(D2, I2) {
                  return D2.cmp(I2) > 0 ? D2 : I2;
                }, f.min = function(D2, I2) {
                  return D2.cmp(I2) < 0 ? D2 : I2;
                }, f.prototype._init = function(D2, I2, O2) {
                  if (typeof D2 == "number") return this._initNumber(D2, I2, O2);
                  if (typeof D2 == "object") return this._initArray(D2, I2, O2);
                  I2 === "hex" && (I2 = 16), u2(I2 === (0 | I2) && I2 >= 2 && I2 <= 36);
                  var L2 = 0;
                  (D2 = D2.toString().replace(/\s+/g, ""))[0] === "-" && (L2++, this.negative = 1), L2 < D2.length && (I2 === 16 ? this._parseHex(D2, L2, O2) : (this._parseBase(D2, I2, L2), O2 === "le" && this._initArray(this.toArray(), I2, O2)));
                }, f.prototype._initNumber = function(D2, I2, O2) {
                  D2 < 0 && (this.negative = 1, D2 = -D2), D2 < 67108864 ? (this.words = [67108863 & D2], this.length = 1) : D2 < 4503599627370496 ? (this.words = [67108863 & D2, D2 / 67108864 & 67108863], this.length = 2) : (u2(D2 < 9007199254740992), this.words = [67108863 & D2, D2 / 67108864 & 67108863, 1], this.length = 3), O2 === "le" && this._initArray(this.toArray(), I2, O2);
                }, f.prototype._initArray = function(D2, I2, O2) {
                  if (u2(typeof D2.length == "number"), D2.length <= 0) return this.words = [0], this.length = 1, this;
                  this.length = Math.ceil(D2.length / 3), this.words = new Array(this.length);
                  for (var L2 = 0; L2 < this.length; L2++) this.words[L2] = 0;
                  var V2, W2, X2 = 0;
                  if (O2 === "be") for (L2 = D2.length - 1, V2 = 0; L2 >= 0; L2 -= 3) W2 = D2[L2] | D2[L2 - 1] << 8 | D2[L2 - 2] << 16, this.words[V2] |= W2 << X2 & 67108863, this.words[V2 + 1] = W2 >>> 26 - X2 & 67108863, (X2 += 24) >= 26 && (X2 -= 26, V2++);
                  else if (O2 === "le") for (L2 = 0, V2 = 0; L2 < D2.length; L2 += 3) W2 = D2[L2] | D2[L2 + 1] << 8 | D2[L2 + 2] << 16, this.words[V2] |= W2 << X2 & 67108863, this.words[V2 + 1] = W2 >>> 26 - X2 & 67108863, (X2 += 24) >= 26 && (X2 -= 26, V2++);
                  return this.strip();
                }, f.prototype._parseHex = function(D2, I2, O2) {
                  this.length = Math.ceil((D2.length - I2) / 6), this.words = new Array(this.length);
                  for (var L2 = 0; L2 < this.length; L2++) this.words[L2] = 0;
                  var V2, W2 = 0, X2 = 0;
                  if (O2 === "be") for (L2 = D2.length - 1; L2 >= I2; L2 -= 2) V2 = d(D2, I2, L2) << W2, this.words[X2] |= 67108863 & V2, W2 >= 18 ? (W2 -= 18, X2 += 1, this.words[X2] |= V2 >>> 26) : W2 += 8;
                  else for (L2 = (D2.length - I2) % 2 == 0 ? I2 + 1 : I2; L2 < D2.length; L2 += 2) V2 = d(D2, I2, L2) << W2, this.words[X2] |= 67108863 & V2, W2 >= 18 ? (W2 -= 18, X2 += 1, this.words[X2] |= V2 >>> 26) : W2 += 8;
                  this.strip();
                }, f.prototype._parseBase = function(D2, I2, O2) {
                  this.words = [0], this.length = 1;
                  for (var L2 = 0, V2 = 1; V2 <= 67108863; V2 *= I2) L2++;
                  L2--, V2 = V2 / I2 | 0;
                  for (var W2 = D2.length - O2, X2 = W2 % L2, Y2 = Math.min(W2, W2 - X2) + O2, K2 = 0, q = O2; q < Y2; q += L2) K2 = v(D2, q, q + L2, I2), this.imuln(V2), this.words[0] + K2 < 67108864 ? this.words[0] += K2 : this._iaddn(K2);
                  if (X2 !== 0) {
                    var re = 1;
                    for (K2 = v(D2, q, D2.length, I2), q = 0; q < X2; q++) re *= I2;
                    this.imuln(re), this.words[0] + K2 < 67108864 ? this.words[0] += K2 : this._iaddn(K2);
                  }
                  this.strip();
                }, f.prototype.copy = function(D2) {
                  D2.words = new Array(this.length);
                  for (var I2 = 0; I2 < this.length; I2++) D2.words[I2] = this.words[I2];
                  D2.length = this.length, D2.negative = this.negative, D2.red = this.red;
                }, f.prototype.clone = function() {
                  var D2 = new f(null);
                  return this.copy(D2), D2;
                }, f.prototype._expand = function(D2) {
                  for (; this.length < D2; ) this.words[this.length++] = 0;
                  return this;
                }, f.prototype.strip = function() {
                  for (; this.length > 1 && this.words[this.length - 1] === 0; ) this.length--;
                  return this._normSign();
                }, f.prototype._normSign = function() {
                  return this.length === 1 && this.words[0] === 0 && (this.negative = 0), this;
                }, f.prototype.inspect = function() {
                  return (this.red ? "<BN-R: " : "<BN: ") + this.toString(16) + ">";
                };
                var m = ["", "0", "00", "000", "0000", "00000", "000000", "0000000", "00000000", "000000000", "0000000000", "00000000000", "000000000000", "0000000000000", "00000000000000", "000000000000000", "0000000000000000", "00000000000000000", "000000000000000000", "0000000000000000000", "00000000000000000000", "000000000000000000000", "0000000000000000000000", "00000000000000000000000", "000000000000000000000000", "0000000000000000000000000"], g = [0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], x = [0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, 43046721, 1e7, 19487171, 35831808, 62748517, 7529536, 11390625, 16777216, 24137569, 34012224, 47045881, 64e6, 4084101, 5153632, 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, 243e5, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176];
                function b(D2, I2, O2) {
                  O2.negative = I2.negative ^ D2.negative;
                  var L2 = D2.length + I2.length | 0;
                  O2.length = L2, L2 = L2 - 1 | 0;
                  var V2 = 0 | D2.words[0], W2 = 0 | I2.words[0], X2 = V2 * W2, Y2 = 67108863 & X2, K2 = X2 / 67108864 | 0;
                  O2.words[0] = Y2;
                  for (var q = 1; q < L2; q++) {
                    for (var re = K2 >>> 26, R2 = 67108863 & K2, z = Math.min(q, I2.length - 1), H2 = Math.max(0, q - D2.length + 1); H2 <= z; H2++) {
                      var te = q - H2 | 0;
                      re += (X2 = (V2 = 0 | D2.words[te]) * (W2 = 0 | I2.words[H2]) + R2) / 67108864 | 0, R2 = 67108863 & X2;
                    }
                    O2.words[q] = 0 | R2, K2 = 0 | re;
                  }
                  return K2 !== 0 ? O2.words[q] = 0 | K2 : O2.length--, O2.strip();
                }
                f.prototype.toString = function(D2, I2) {
                  var O2;
                  if (I2 = 0 | I2 || 1, (D2 = D2 || 10) === 16 || D2 === "hex") {
                    O2 = "";
                    for (var L2 = 0, V2 = 0, W2 = 0; W2 < this.length; W2++) {
                      var X2 = this.words[W2], Y2 = (16777215 & (X2 << L2 | V2)).toString(16);
                      O2 = (V2 = X2 >>> 24 - L2 & 16777215) !== 0 || W2 !== this.length - 1 ? m[6 - Y2.length] + Y2 + O2 : Y2 + O2, (L2 += 2) >= 26 && (L2 -= 26, W2--);
                    }
                    for (V2 !== 0 && (O2 = V2.toString(16) + O2); O2.length % I2 != 0; ) O2 = "0" + O2;
                    return this.negative !== 0 && (O2 = "-" + O2), O2;
                  }
                  if (D2 === (0 | D2) && D2 >= 2 && D2 <= 36) {
                    var K2 = g[D2], q = x[D2];
                    O2 = "";
                    var re = this.clone();
                    for (re.negative = 0; !re.isZero(); ) {
                      var R2 = re.modn(q).toString(D2);
                      O2 = (re = re.idivn(q)).isZero() ? R2 + O2 : m[K2 - R2.length] + R2 + O2;
                    }
                    for (this.isZero() && (O2 = "0" + O2); O2.length % I2 != 0; ) O2 = "0" + O2;
                    return this.negative !== 0 && (O2 = "-" + O2), O2;
                  }
                  u2(false, "Base should be between 2 and 36");
                }, f.prototype.toNumber = function() {
                  var D2 = this.words[0];
                  return this.length === 2 ? D2 += 67108864 * this.words[1] : this.length === 3 && this.words[2] === 1 ? D2 += 4503599627370496 + 67108864 * this.words[1] : this.length > 2 && u2(false, "Number can only safely store up to 53 bits"), this.negative !== 0 ? -D2 : D2;
                }, f.prototype.toJSON = function() {
                  return this.toString(16);
                }, f.prototype.toBuffer = function(D2, I2) {
                  return u2(h !== void 0), this.toArrayLike(h, D2, I2);
                }, f.prototype.toArray = function(D2, I2) {
                  return this.toArrayLike(Array, D2, I2);
                }, f.prototype.toArrayLike = function(D2, I2, O2) {
                  var L2 = this.byteLength(), V2 = O2 || Math.max(1, L2);
                  u2(L2 <= V2, "byte array longer than desired length"), u2(V2 > 0, "Requested array length <= 0"), this.strip();
                  var W2, X2, Y2 = I2 === "le", K2 = new D2(V2), q = this.clone();
                  if (Y2) {
                    for (X2 = 0; !q.isZero(); X2++) W2 = q.andln(255), q.iushrn(8), K2[X2] = W2;
                    for (; X2 < V2; X2++) K2[X2] = 0;
                  } else {
                    for (X2 = 0; X2 < V2 - L2; X2++) K2[X2] = 0;
                    for (X2 = 0; !q.isZero(); X2++) W2 = q.andln(255), q.iushrn(8), K2[V2 - X2 - 1] = W2;
                  }
                  return K2;
                }, Math.clz32 ? f.prototype._countBits = function(D2) {
                  return 32 - Math.clz32(D2);
                } : f.prototype._countBits = function(D2) {
                  var I2 = D2, O2 = 0;
                  return I2 >= 4096 && (O2 += 13, I2 >>>= 13), I2 >= 64 && (O2 += 7, I2 >>>= 7), I2 >= 8 && (O2 += 4, I2 >>>= 4), I2 >= 2 && (O2 += 2, I2 >>>= 2), O2 + I2;
                }, f.prototype._zeroBits = function(D2) {
                  if (D2 === 0) return 26;
                  var I2 = D2, O2 = 0;
                  return (8191 & I2) == 0 && (O2 += 13, I2 >>>= 13), (127 & I2) == 0 && (O2 += 7, I2 >>>= 7), (15 & I2) == 0 && (O2 += 4, I2 >>>= 4), (3 & I2) == 0 && (O2 += 2, I2 >>>= 2), (1 & I2) == 0 && O2++, O2;
                }, f.prototype.bitLength = function() {
                  var D2 = this.words[this.length - 1], I2 = this._countBits(D2);
                  return 26 * (this.length - 1) + I2;
                }, f.prototype.zeroBits = function() {
                  if (this.isZero()) return 0;
                  for (var D2 = 0, I2 = 0; I2 < this.length; I2++) {
                    var O2 = this._zeroBits(this.words[I2]);
                    if (D2 += O2, O2 !== 26) break;
                  }
                  return D2;
                }, f.prototype.byteLength = function() {
                  return Math.ceil(this.bitLength() / 8);
                }, f.prototype.toTwos = function(D2) {
                  return this.negative !== 0 ? this.abs().inotn(D2).iaddn(1) : this.clone();
                }, f.prototype.fromTwos = function(D2) {
                  return this.testn(D2 - 1) ? this.notn(D2).iaddn(1).ineg() : this.clone();
                }, f.prototype.isNeg = function() {
                  return this.negative !== 0;
                }, f.prototype.neg = function() {
                  return this.clone().ineg();
                }, f.prototype.ineg = function() {
                  return this.isZero() || (this.negative ^= 1), this;
                }, f.prototype.iuor = function(D2) {
                  for (; this.length < D2.length; ) this.words[this.length++] = 0;
                  for (var I2 = 0; I2 < D2.length; I2++) this.words[I2] = this.words[I2] | D2.words[I2];
                  return this.strip();
                }, f.prototype.ior = function(D2) {
                  return u2((this.negative | D2.negative) == 0), this.iuor(D2);
                }, f.prototype.or = function(D2) {
                  return this.length > D2.length ? this.clone().ior(D2) : D2.clone().ior(this);
                }, f.prototype.uor = function(D2) {
                  return this.length > D2.length ? this.clone().iuor(D2) : D2.clone().iuor(this);
                }, f.prototype.iuand = function(D2) {
                  var I2;
                  I2 = this.length > D2.length ? D2 : this;
                  for (var O2 = 0; O2 < I2.length; O2++) this.words[O2] = this.words[O2] & D2.words[O2];
                  return this.length = I2.length, this.strip();
                }, f.prototype.iand = function(D2) {
                  return u2((this.negative | D2.negative) == 0), this.iuand(D2);
                }, f.prototype.and = function(D2) {
                  return this.length > D2.length ? this.clone().iand(D2) : D2.clone().iand(this);
                }, f.prototype.uand = function(D2) {
                  return this.length > D2.length ? this.clone().iuand(D2) : D2.clone().iuand(this);
                }, f.prototype.iuxor = function(D2) {
                  var I2, O2;
                  this.length > D2.length ? (I2 = this, O2 = D2) : (I2 = D2, O2 = this);
                  for (var L2 = 0; L2 < O2.length; L2++) this.words[L2] = I2.words[L2] ^ O2.words[L2];
                  if (this !== I2) for (; L2 < I2.length; L2++) this.words[L2] = I2.words[L2];
                  return this.length = I2.length, this.strip();
                }, f.prototype.ixor = function(D2) {
                  return u2((this.negative | D2.negative) == 0), this.iuxor(D2);
                }, f.prototype.xor = function(D2) {
                  return this.length > D2.length ? this.clone().ixor(D2) : D2.clone().ixor(this);
                }, f.prototype.uxor = function(D2) {
                  return this.length > D2.length ? this.clone().iuxor(D2) : D2.clone().iuxor(this);
                }, f.prototype.inotn = function(D2) {
                  u2(typeof D2 == "number" && D2 >= 0);
                  var I2 = 0 | Math.ceil(D2 / 26), O2 = D2 % 26;
                  this._expand(I2), O2 > 0 && I2--;
                  for (var L2 = 0; L2 < I2; L2++) this.words[L2] = 67108863 & ~this.words[L2];
                  return O2 > 0 && (this.words[L2] = ~this.words[L2] & 67108863 >> 26 - O2), this.strip();
                }, f.prototype.notn = function(D2) {
                  return this.clone().inotn(D2);
                }, f.prototype.setn = function(D2, I2) {
                  u2(typeof D2 == "number" && D2 >= 0);
                  var O2 = D2 / 26 | 0, L2 = D2 % 26;
                  return this._expand(O2 + 1), this.words[O2] = I2 ? this.words[O2] | 1 << L2 : this.words[O2] & ~(1 << L2), this.strip();
                }, f.prototype.iadd = function(D2) {
                  var I2, O2, L2;
                  if (this.negative !== 0 && D2.negative === 0) return this.negative = 0, I2 = this.isub(D2), this.negative ^= 1, this._normSign();
                  if (this.negative === 0 && D2.negative !== 0) return D2.negative = 0, I2 = this.isub(D2), D2.negative = 1, I2._normSign();
                  this.length > D2.length ? (O2 = this, L2 = D2) : (O2 = D2, L2 = this);
                  for (var V2 = 0, W2 = 0; W2 < L2.length; W2++) I2 = (0 | O2.words[W2]) + (0 | L2.words[W2]) + V2, this.words[W2] = 67108863 & I2, V2 = I2 >>> 26;
                  for (; V2 !== 0 && W2 < O2.length; W2++) I2 = (0 | O2.words[W2]) + V2, this.words[W2] = 67108863 & I2, V2 = I2 >>> 26;
                  if (this.length = O2.length, V2 !== 0) this.words[this.length] = V2, this.length++;
                  else if (O2 !== this) for (; W2 < O2.length; W2++) this.words[W2] = O2.words[W2];
                  return this;
                }, f.prototype.add = function(D2) {
                  var I2;
                  return D2.negative !== 0 && this.negative === 0 ? (D2.negative = 0, I2 = this.sub(D2), D2.negative ^= 1, I2) : D2.negative === 0 && this.negative !== 0 ? (this.negative = 0, I2 = D2.sub(this), this.negative = 1, I2) : this.length > D2.length ? this.clone().iadd(D2) : D2.clone().iadd(this);
                }, f.prototype.isub = function(D2) {
                  if (D2.negative !== 0) {
                    D2.negative = 0;
                    var I2 = this.iadd(D2);
                    return D2.negative = 1, I2._normSign();
                  }
                  if (this.negative !== 0) return this.negative = 0, this.iadd(D2), this.negative = 1, this._normSign();
                  var O2, L2, V2 = this.cmp(D2);
                  if (V2 === 0) return this.negative = 0, this.length = 1, this.words[0] = 0, this;
                  V2 > 0 ? (O2 = this, L2 = D2) : (O2 = D2, L2 = this);
                  for (var W2 = 0, X2 = 0; X2 < L2.length; X2++) W2 = (I2 = (0 | O2.words[X2]) - (0 | L2.words[X2]) + W2) >> 26, this.words[X2] = 67108863 & I2;
                  for (; W2 !== 0 && X2 < O2.length; X2++) W2 = (I2 = (0 | O2.words[X2]) + W2) >> 26, this.words[X2] = 67108863 & I2;
                  if (W2 === 0 && X2 < O2.length && O2 !== this) for (; X2 < O2.length; X2++) this.words[X2] = O2.words[X2];
                  return this.length = Math.max(this.length, X2), O2 !== this && (this.negative = 1), this.strip();
                }, f.prototype.sub = function(D2) {
                  return this.clone().isub(D2);
                };
                var y = function(D2, I2, O2) {
                  var L2, V2, W2, X2 = D2.words, Y2 = I2.words, K2 = O2.words, q = 0, re = 0 | X2[0], R2 = 8191 & re, z = re >>> 13, H2 = 0 | X2[1], te = 8191 & H2, j = H2 >>> 13, Q2 = 0 | X2[2], Z2 = 8191 & Q2, ne = Q2 >>> 13, ae = 0 | X2[3], ue = 8191 & ae, le = ae >>> 13, ce = 0 | X2[4], se = 8191 & ce, he = ce >>> 13, me = 0 | X2[5], we = 8191 & me, be = me >>> 13, Ae = 0 | X2[6], pe = 8191 & Ae, ve = Ae >>> 13, Ee = 0 | X2[7], Se = 8191 & Ee, Ce = Ee >>> 13, Be = 0 | X2[8], Ue = 8191 & Be, Ke = Be >>> 13, ct = 0 | X2[9], We = 8191 & ct, Ze = ct >>> 13, it = 0 | Y2[0], ot = 8191 & it, mt = it >>> 13, wt = 0 | Y2[1], Et = 8191 & wt, zt = wt >>> 13, Nt = 0 | Y2[2], yt = 8191 & Nt, pt = Nt >>> 13, Ot = 0 | Y2[3], Jt = 8191 & Ot, tr = Ot >>> 13, Ye = 0 | Y2[4], at = 8191 & Ye, Ge = Ye >>> 13, st = 0 | Y2[5], Ie = 8191 & st, Pe = st >>> 13, $e = 0 | Y2[6], Ve = 8191 & $e, ut = $e >>> 13, Re = 0 | Y2[7], qe = 8191 & Re, je = Re >>> 13, rt = 0 | Y2[8], He = 8191 & rt, xe = rt >>> 13, Ne = 0 | Y2[9], ke = 8191 & Ne, Me = Ne >>> 13;
                  O2.negative = D2.negative ^ I2.negative, O2.length = 19;
                  var Le = (q + (L2 = Math.imul(R2, ot)) | 0) + ((8191 & (V2 = (V2 = Math.imul(R2, mt)) + Math.imul(z, ot) | 0)) << 13) | 0;
                  q = ((W2 = Math.imul(z, mt)) + (V2 >>> 13) | 0) + (Le >>> 26) | 0, Le &= 67108863, L2 = Math.imul(te, ot), V2 = (V2 = Math.imul(te, mt)) + Math.imul(j, ot) | 0, W2 = Math.imul(j, mt);
                  var ze = (q + (L2 = L2 + Math.imul(R2, Et) | 0) | 0) + ((8191 & (V2 = (V2 = V2 + Math.imul(R2, zt) | 0) + Math.imul(z, Et) | 0)) << 13) | 0;
                  q = ((W2 = W2 + Math.imul(z, zt) | 0) + (V2 >>> 13) | 0) + (ze >>> 26) | 0, ze &= 67108863, L2 = Math.imul(Z2, ot), V2 = (V2 = Math.imul(Z2, mt)) + Math.imul(ne, ot) | 0, W2 = Math.imul(ne, mt), L2 = L2 + Math.imul(te, Et) | 0, V2 = (V2 = V2 + Math.imul(te, zt) | 0) + Math.imul(j, Et) | 0, W2 = W2 + Math.imul(j, zt) | 0;
                  var ft = (q + (L2 = L2 + Math.imul(R2, yt) | 0) | 0) + ((8191 & (V2 = (V2 = V2 + Math.imul(R2, pt) | 0) + Math.imul(z, yt) | 0)) << 13) | 0;
                  q = ((W2 = W2 + Math.imul(z, pt) | 0) + (V2 >>> 13) | 0) + (ft >>> 26) | 0, ft &= 67108863, L2 = Math.imul(ue, ot), V2 = (V2 = Math.imul(ue, mt)) + Math.imul(le, ot) | 0, W2 = Math.imul(le, mt), L2 = L2 + Math.imul(Z2, Et) | 0, V2 = (V2 = V2 + Math.imul(Z2, zt) | 0) + Math.imul(ne, Et) | 0, W2 = W2 + Math.imul(ne, zt) | 0, L2 = L2 + Math.imul(te, yt) | 0, V2 = (V2 = V2 + Math.imul(te, pt) | 0) + Math.imul(j, yt) | 0, W2 = W2 + Math.imul(j, pt) | 0;
                  var De = (q + (L2 = L2 + Math.imul(R2, Jt) | 0) | 0) + ((8191 & (V2 = (V2 = V2 + Math.imul(R2, tr) | 0) + Math.imul(z, Jt) | 0)) << 13) | 0;
                  q = ((W2 = W2 + Math.imul(z, tr) | 0) + (V2 >>> 13) | 0) + (De >>> 26) | 0, De &= 67108863, L2 = Math.imul(se, ot), V2 = (V2 = Math.imul(se, mt)) + Math.imul(he, ot) | 0, W2 = Math.imul(he, mt), L2 = L2 + Math.imul(ue, Et) | 0, V2 = (V2 = V2 + Math.imul(ue, zt) | 0) + Math.imul(le, Et) | 0, W2 = W2 + Math.imul(le, zt) | 0, L2 = L2 + Math.imul(Z2, yt) | 0, V2 = (V2 = V2 + Math.imul(Z2, pt) | 0) + Math.imul(ne, yt) | 0, W2 = W2 + Math.imul(ne, pt) | 0, L2 = L2 + Math.imul(te, Jt) | 0, V2 = (V2 = V2 + Math.imul(te, tr) | 0) + Math.imul(j, Jt) | 0, W2 = W2 + Math.imul(j, tr) | 0;
                  var Je = (q + (L2 = L2 + Math.imul(R2, at) | 0) | 0) + ((8191 & (V2 = (V2 = V2 + Math.imul(R2, Ge) | 0) + Math.imul(z, at) | 0)) << 13) | 0;
                  q = ((W2 = W2 + Math.imul(z, Ge) | 0) + (V2 >>> 13) | 0) + (Je >>> 26) | 0, Je &= 67108863, L2 = Math.imul(we, ot), V2 = (V2 = Math.imul(we, mt)) + Math.imul(be, ot) | 0, W2 = Math.imul(be, mt), L2 = L2 + Math.imul(se, Et) | 0, V2 = (V2 = V2 + Math.imul(se, zt) | 0) + Math.imul(he, Et) | 0, W2 = W2 + Math.imul(he, zt) | 0, L2 = L2 + Math.imul(ue, yt) | 0, V2 = (V2 = V2 + Math.imul(ue, pt) | 0) + Math.imul(le, yt) | 0, W2 = W2 + Math.imul(le, pt) | 0, L2 = L2 + Math.imul(Z2, Jt) | 0, V2 = (V2 = V2 + Math.imul(Z2, tr) | 0) + Math.imul(ne, Jt) | 0, W2 = W2 + Math.imul(ne, tr) | 0, L2 = L2 + Math.imul(te, at) | 0, V2 = (V2 = V2 + Math.imul(te, Ge) | 0) + Math.imul(j, at) | 0, W2 = W2 + Math.imul(j, Ge) | 0;
                  var tt = (q + (L2 = L2 + Math.imul(R2, Ie) | 0) | 0) + ((8191 & (V2 = (V2 = V2 + Math.imul(R2, Pe) | 0) + Math.imul(z, Ie) | 0)) << 13) | 0;
                  q = ((W2 = W2 + Math.imul(z, Pe) | 0) + (V2 >>> 13) | 0) + (tt >>> 26) | 0, tt &= 67108863, L2 = Math.imul(pe, ot), V2 = (V2 = Math.imul(pe, mt)) + Math.imul(ve, ot) | 0, W2 = Math.imul(ve, mt), L2 = L2 + Math.imul(we, Et) | 0, V2 = (V2 = V2 + Math.imul(we, zt) | 0) + Math.imul(be, Et) | 0, W2 = W2 + Math.imul(be, zt) | 0, L2 = L2 + Math.imul(se, yt) | 0, V2 = (V2 = V2 + Math.imul(se, pt) | 0) + Math.imul(he, yt) | 0, W2 = W2 + Math.imul(he, pt) | 0, L2 = L2 + Math.imul(ue, Jt) | 0, V2 = (V2 = V2 + Math.imul(ue, tr) | 0) + Math.imul(le, Jt) | 0, W2 = W2 + Math.imul(le, tr) | 0, L2 = L2 + Math.imul(Z2, at) | 0, V2 = (V2 = V2 + Math.imul(Z2, Ge) | 0) + Math.imul(ne, at) | 0, W2 = W2 + Math.imul(ne, Ge) | 0, L2 = L2 + Math.imul(te, Ie) | 0, V2 = (V2 = V2 + Math.imul(te, Pe) | 0) + Math.imul(j, Ie) | 0, W2 = W2 + Math.imul(j, Pe) | 0;
                  var vt = (q + (L2 = L2 + Math.imul(R2, Ve) | 0) | 0) + ((8191 & (V2 = (V2 = V2 + Math.imul(R2, ut) | 0) + Math.imul(z, Ve) | 0)) << 13) | 0;
                  q = ((W2 = W2 + Math.imul(z, ut) | 0) + (V2 >>> 13) | 0) + (vt >>> 26) | 0, vt &= 67108863, L2 = Math.imul(Se, ot), V2 = (V2 = Math.imul(Se, mt)) + Math.imul(Ce, ot) | 0, W2 = Math.imul(Ce, mt), L2 = L2 + Math.imul(pe, Et) | 0, V2 = (V2 = V2 + Math.imul(pe, zt) | 0) + Math.imul(ve, Et) | 0, W2 = W2 + Math.imul(ve, zt) | 0, L2 = L2 + Math.imul(we, yt) | 0, V2 = (V2 = V2 + Math.imul(we, pt) | 0) + Math.imul(be, yt) | 0, W2 = W2 + Math.imul(be, pt) | 0, L2 = L2 + Math.imul(se, Jt) | 0, V2 = (V2 = V2 + Math.imul(se, tr) | 0) + Math.imul(he, Jt) | 0, W2 = W2 + Math.imul(he, tr) | 0, L2 = L2 + Math.imul(ue, at) | 0, V2 = (V2 = V2 + Math.imul(ue, Ge) | 0) + Math.imul(le, at) | 0, W2 = W2 + Math.imul(le, Ge) | 0, L2 = L2 + Math.imul(Z2, Ie) | 0, V2 = (V2 = V2 + Math.imul(Z2, Pe) | 0) + Math.imul(ne, Ie) | 0, W2 = W2 + Math.imul(ne, Pe) | 0, L2 = L2 + Math.imul(te, Ve) | 0, V2 = (V2 = V2 + Math.imul(te, ut) | 0) + Math.imul(j, Ve) | 0, W2 = W2 + Math.imul(j, ut) | 0;
                  var kt = (q + (L2 = L2 + Math.imul(R2, qe) | 0) | 0) + ((8191 & (V2 = (V2 = V2 + Math.imul(R2, je) | 0) + Math.imul(z, qe) | 0)) << 13) | 0;
                  q = ((W2 = W2 + Math.imul(z, je) | 0) + (V2 >>> 13) | 0) + (kt >>> 26) | 0, kt &= 67108863, L2 = Math.imul(Ue, ot), V2 = (V2 = Math.imul(Ue, mt)) + Math.imul(Ke, ot) | 0, W2 = Math.imul(Ke, mt), L2 = L2 + Math.imul(Se, Et) | 0, V2 = (V2 = V2 + Math.imul(Se, zt) | 0) + Math.imul(Ce, Et) | 0, W2 = W2 + Math.imul(Ce, zt) | 0, L2 = L2 + Math.imul(pe, yt) | 0, V2 = (V2 = V2 + Math.imul(pe, pt) | 0) + Math.imul(ve, yt) | 0, W2 = W2 + Math.imul(ve, pt) | 0, L2 = L2 + Math.imul(we, Jt) | 0, V2 = (V2 = V2 + Math.imul(we, tr) | 0) + Math.imul(be, Jt) | 0, W2 = W2 + Math.imul(be, tr) | 0, L2 = L2 + Math.imul(se, at) | 0, V2 = (V2 = V2 + Math.imul(se, Ge) | 0) + Math.imul(he, at) | 0, W2 = W2 + Math.imul(he, Ge) | 0, L2 = L2 + Math.imul(ue, Ie) | 0, V2 = (V2 = V2 + Math.imul(ue, Pe) | 0) + Math.imul(le, Ie) | 0, W2 = W2 + Math.imul(le, Pe) | 0, L2 = L2 + Math.imul(Z2, Ve) | 0, V2 = (V2 = V2 + Math.imul(Z2, ut) | 0) + Math.imul(ne, Ve) | 0, W2 = W2 + Math.imul(ne, ut) | 0, L2 = L2 + Math.imul(te, qe) | 0, V2 = (V2 = V2 + Math.imul(te, je) | 0) + Math.imul(j, qe) | 0, W2 = W2 + Math.imul(j, je) | 0;
                  var jt = (q + (L2 = L2 + Math.imul(R2, He) | 0) | 0) + ((8191 & (V2 = (V2 = V2 + Math.imul(R2, xe) | 0) + Math.imul(z, He) | 0)) << 13) | 0;
                  q = ((W2 = W2 + Math.imul(z, xe) | 0) + (V2 >>> 13) | 0) + (jt >>> 26) | 0, jt &= 67108863, L2 = Math.imul(We, ot), V2 = (V2 = Math.imul(We, mt)) + Math.imul(Ze, ot) | 0, W2 = Math.imul(Ze, mt), L2 = L2 + Math.imul(Ue, Et) | 0, V2 = (V2 = V2 + Math.imul(Ue, zt) | 0) + Math.imul(Ke, Et) | 0, W2 = W2 + Math.imul(Ke, zt) | 0, L2 = L2 + Math.imul(Se, yt) | 0, V2 = (V2 = V2 + Math.imul(Se, pt) | 0) + Math.imul(Ce, yt) | 0, W2 = W2 + Math.imul(Ce, pt) | 0, L2 = L2 + Math.imul(pe, Jt) | 0, V2 = (V2 = V2 + Math.imul(pe, tr) | 0) + Math.imul(ve, Jt) | 0, W2 = W2 + Math.imul(ve, tr) | 0, L2 = L2 + Math.imul(we, at) | 0, V2 = (V2 = V2 + Math.imul(we, Ge) | 0) + Math.imul(be, at) | 0, W2 = W2 + Math.imul(be, Ge) | 0, L2 = L2 + Math.imul(se, Ie) | 0, V2 = (V2 = V2 + Math.imul(se, Pe) | 0) + Math.imul(he, Ie) | 0, W2 = W2 + Math.imul(he, Pe) | 0, L2 = L2 + Math.imul(ue, Ve) | 0, V2 = (V2 = V2 + Math.imul(ue, ut) | 0) + Math.imul(le, Ve) | 0, W2 = W2 + Math.imul(le, ut) | 0, L2 = L2 + Math.imul(Z2, qe) | 0, V2 = (V2 = V2 + Math.imul(Z2, je) | 0) + Math.imul(ne, qe) | 0, W2 = W2 + Math.imul(ne, je) | 0, L2 = L2 + Math.imul(te, He) | 0, V2 = (V2 = V2 + Math.imul(te, xe) | 0) + Math.imul(j, He) | 0, W2 = W2 + Math.imul(j, xe) | 0;
                  var Vt = (q + (L2 = L2 + Math.imul(R2, ke) | 0) | 0) + ((8191 & (V2 = (V2 = V2 + Math.imul(R2, Me) | 0) + Math.imul(z, ke) | 0)) << 13) | 0;
                  q = ((W2 = W2 + Math.imul(z, Me) | 0) + (V2 >>> 13) | 0) + (Vt >>> 26) | 0, Vt &= 67108863, L2 = Math.imul(We, Et), V2 = (V2 = Math.imul(We, zt)) + Math.imul(Ze, Et) | 0, W2 = Math.imul(Ze, zt), L2 = L2 + Math.imul(Ue, yt) | 0, V2 = (V2 = V2 + Math.imul(Ue, pt) | 0) + Math.imul(Ke, yt) | 0, W2 = W2 + Math.imul(Ke, pt) | 0, L2 = L2 + Math.imul(Se, Jt) | 0, V2 = (V2 = V2 + Math.imul(Se, tr) | 0) + Math.imul(Ce, Jt) | 0, W2 = W2 + Math.imul(Ce, tr) | 0, L2 = L2 + Math.imul(pe, at) | 0, V2 = (V2 = V2 + Math.imul(pe, Ge) | 0) + Math.imul(ve, at) | 0, W2 = W2 + Math.imul(ve, Ge) | 0, L2 = L2 + Math.imul(we, Ie) | 0, V2 = (V2 = V2 + Math.imul(we, Pe) | 0) + Math.imul(be, Ie) | 0, W2 = W2 + Math.imul(be, Pe) | 0, L2 = L2 + Math.imul(se, Ve) | 0, V2 = (V2 = V2 + Math.imul(se, ut) | 0) + Math.imul(he, Ve) | 0, W2 = W2 + Math.imul(he, ut) | 0, L2 = L2 + Math.imul(ue, qe) | 0, V2 = (V2 = V2 + Math.imul(ue, je) | 0) + Math.imul(le, qe) | 0, W2 = W2 + Math.imul(le, je) | 0, L2 = L2 + Math.imul(Z2, He) | 0, V2 = (V2 = V2 + Math.imul(Z2, xe) | 0) + Math.imul(ne, He) | 0, W2 = W2 + Math.imul(ne, xe) | 0;
                  var Kt = (q + (L2 = L2 + Math.imul(te, ke) | 0) | 0) + ((8191 & (V2 = (V2 = V2 + Math.imul(te, Me) | 0) + Math.imul(j, ke) | 0)) << 13) | 0;
                  q = ((W2 = W2 + Math.imul(j, Me) | 0) + (V2 >>> 13) | 0) + (Kt >>> 26) | 0, Kt &= 67108863, L2 = Math.imul(We, yt), V2 = (V2 = Math.imul(We, pt)) + Math.imul(Ze, yt) | 0, W2 = Math.imul(Ze, pt), L2 = L2 + Math.imul(Ue, Jt) | 0, V2 = (V2 = V2 + Math.imul(Ue, tr) | 0) + Math.imul(Ke, Jt) | 0, W2 = W2 + Math.imul(Ke, tr) | 0, L2 = L2 + Math.imul(Se, at) | 0, V2 = (V2 = V2 + Math.imul(Se, Ge) | 0) + Math.imul(Ce, at) | 0, W2 = W2 + Math.imul(Ce, Ge) | 0, L2 = L2 + Math.imul(pe, Ie) | 0, V2 = (V2 = V2 + Math.imul(pe, Pe) | 0) + Math.imul(ve, Ie) | 0, W2 = W2 + Math.imul(ve, Pe) | 0, L2 = L2 + Math.imul(we, Ve) | 0, V2 = (V2 = V2 + Math.imul(we, ut) | 0) + Math.imul(be, Ve) | 0, W2 = W2 + Math.imul(be, ut) | 0, L2 = L2 + Math.imul(se, qe) | 0, V2 = (V2 = V2 + Math.imul(se, je) | 0) + Math.imul(he, qe) | 0, W2 = W2 + Math.imul(he, je) | 0, L2 = L2 + Math.imul(ue, He) | 0, V2 = (V2 = V2 + Math.imul(ue, xe) | 0) + Math.imul(le, He) | 0, W2 = W2 + Math.imul(le, xe) | 0;
                  var rr = (q + (L2 = L2 + Math.imul(Z2, ke) | 0) | 0) + ((8191 & (V2 = (V2 = V2 + Math.imul(Z2, Me) | 0) + Math.imul(ne, ke) | 0)) << 13) | 0;
                  q = ((W2 = W2 + Math.imul(ne, Me) | 0) + (V2 >>> 13) | 0) + (rr >>> 26) | 0, rr &= 67108863, L2 = Math.imul(We, Jt), V2 = (V2 = Math.imul(We, tr)) + Math.imul(Ze, Jt) | 0, W2 = Math.imul(Ze, tr), L2 = L2 + Math.imul(Ue, at) | 0, V2 = (V2 = V2 + Math.imul(Ue, Ge) | 0) + Math.imul(Ke, at) | 0, W2 = W2 + Math.imul(Ke, Ge) | 0, L2 = L2 + Math.imul(Se, Ie) | 0, V2 = (V2 = V2 + Math.imul(Se, Pe) | 0) + Math.imul(Ce, Ie) | 0, W2 = W2 + Math.imul(Ce, Pe) | 0, L2 = L2 + Math.imul(pe, Ve) | 0, V2 = (V2 = V2 + Math.imul(pe, ut) | 0) + Math.imul(ve, Ve) | 0, W2 = W2 + Math.imul(ve, ut) | 0, L2 = L2 + Math.imul(we, qe) | 0, V2 = (V2 = V2 + Math.imul(we, je) | 0) + Math.imul(be, qe) | 0, W2 = W2 + Math.imul(be, je) | 0, L2 = L2 + Math.imul(se, He) | 0, V2 = (V2 = V2 + Math.imul(se, xe) | 0) + Math.imul(he, He) | 0, W2 = W2 + Math.imul(he, xe) | 0;
                  var Tr = (q + (L2 = L2 + Math.imul(ue, ke) | 0) | 0) + ((8191 & (V2 = (V2 = V2 + Math.imul(ue, Me) | 0) + Math.imul(le, ke) | 0)) << 13) | 0;
                  q = ((W2 = W2 + Math.imul(le, Me) | 0) + (V2 >>> 13) | 0) + (Tr >>> 26) | 0, Tr &= 67108863, L2 = Math.imul(We, at), V2 = (V2 = Math.imul(We, Ge)) + Math.imul(Ze, at) | 0, W2 = Math.imul(Ze, Ge), L2 = L2 + Math.imul(Ue, Ie) | 0, V2 = (V2 = V2 + Math.imul(Ue, Pe) | 0) + Math.imul(Ke, Ie) | 0, W2 = W2 + Math.imul(Ke, Pe) | 0, L2 = L2 + Math.imul(Se, Ve) | 0, V2 = (V2 = V2 + Math.imul(Se, ut) | 0) + Math.imul(Ce, Ve) | 0, W2 = W2 + Math.imul(Ce, ut) | 0, L2 = L2 + Math.imul(pe, qe) | 0, V2 = (V2 = V2 + Math.imul(pe, je) | 0) + Math.imul(ve, qe) | 0, W2 = W2 + Math.imul(ve, je) | 0, L2 = L2 + Math.imul(we, He) | 0, V2 = (V2 = V2 + Math.imul(we, xe) | 0) + Math.imul(be, He) | 0, W2 = W2 + Math.imul(be, xe) | 0;
                  var yr = (q + (L2 = L2 + Math.imul(se, ke) | 0) | 0) + ((8191 & (V2 = (V2 = V2 + Math.imul(se, Me) | 0) + Math.imul(he, ke) | 0)) << 13) | 0;
                  q = ((W2 = W2 + Math.imul(he, Me) | 0) + (V2 >>> 13) | 0) + (yr >>> 26) | 0, yr &= 67108863, L2 = Math.imul(We, Ie), V2 = (V2 = Math.imul(We, Pe)) + Math.imul(Ze, Ie) | 0, W2 = Math.imul(Ze, Pe), L2 = L2 + Math.imul(Ue, Ve) | 0, V2 = (V2 = V2 + Math.imul(Ue, ut) | 0) + Math.imul(Ke, Ve) | 0, W2 = W2 + Math.imul(Ke, ut) | 0, L2 = L2 + Math.imul(Se, qe) | 0, V2 = (V2 = V2 + Math.imul(Se, je) | 0) + Math.imul(Ce, qe) | 0, W2 = W2 + Math.imul(Ce, je) | 0, L2 = L2 + Math.imul(pe, He) | 0, V2 = (V2 = V2 + Math.imul(pe, xe) | 0) + Math.imul(ve, He) | 0, W2 = W2 + Math.imul(ve, xe) | 0;
                  var pr = (q + (L2 = L2 + Math.imul(we, ke) | 0) | 0) + ((8191 & (V2 = (V2 = V2 + Math.imul(we, Me) | 0) + Math.imul(be, ke) | 0)) << 13) | 0;
                  q = ((W2 = W2 + Math.imul(be, Me) | 0) + (V2 >>> 13) | 0) + (pr >>> 26) | 0, pr &= 67108863, L2 = Math.imul(We, Ve), V2 = (V2 = Math.imul(We, ut)) + Math.imul(Ze, Ve) | 0, W2 = Math.imul(Ze, ut), L2 = L2 + Math.imul(Ue, qe) | 0, V2 = (V2 = V2 + Math.imul(Ue, je) | 0) + Math.imul(Ke, qe) | 0, W2 = W2 + Math.imul(Ke, je) | 0, L2 = L2 + Math.imul(Se, He) | 0, V2 = (V2 = V2 + Math.imul(Se, xe) | 0) + Math.imul(Ce, He) | 0, W2 = W2 + Math.imul(Ce, xe) | 0;
                  var lr = (q + (L2 = L2 + Math.imul(pe, ke) | 0) | 0) + ((8191 & (V2 = (V2 = V2 + Math.imul(pe, Me) | 0) + Math.imul(ve, ke) | 0)) << 13) | 0;
                  q = ((W2 = W2 + Math.imul(ve, Me) | 0) + (V2 >>> 13) | 0) + (lr >>> 26) | 0, lr &= 67108863, L2 = Math.imul(We, qe), V2 = (V2 = Math.imul(We, je)) + Math.imul(Ze, qe) | 0, W2 = Math.imul(Ze, je), L2 = L2 + Math.imul(Ue, He) | 0, V2 = (V2 = V2 + Math.imul(Ue, xe) | 0) + Math.imul(Ke, He) | 0, W2 = W2 + Math.imul(Ke, xe) | 0;
                  var _r = (q + (L2 = L2 + Math.imul(Se, ke) | 0) | 0) + ((8191 & (V2 = (V2 = V2 + Math.imul(Se, Me) | 0) + Math.imul(Ce, ke) | 0)) << 13) | 0;
                  q = ((W2 = W2 + Math.imul(Ce, Me) | 0) + (V2 >>> 13) | 0) + (_r >>> 26) | 0, _r &= 67108863, L2 = Math.imul(We, He), V2 = (V2 = Math.imul(We, xe)) + Math.imul(Ze, He) | 0, W2 = Math.imul(Ze, xe);
                  var $r = (q + (L2 = L2 + Math.imul(Ue, ke) | 0) | 0) + ((8191 & (V2 = (V2 = V2 + Math.imul(Ue, Me) | 0) + Math.imul(Ke, ke) | 0)) << 13) | 0;
                  q = ((W2 = W2 + Math.imul(Ke, Me) | 0) + (V2 >>> 13) | 0) + ($r >>> 26) | 0, $r &= 67108863;
                  var Ar = (q + (L2 = Math.imul(We, ke)) | 0) + ((8191 & (V2 = (V2 = Math.imul(We, Me)) + Math.imul(Ze, ke) | 0)) << 13) | 0;
                  return q = ((W2 = Math.imul(Ze, Me)) + (V2 >>> 13) | 0) + (Ar >>> 26) | 0, Ar &= 67108863, K2[0] = Le, K2[1] = ze, K2[2] = ft, K2[3] = De, K2[4] = Je, K2[5] = tt, K2[6] = vt, K2[7] = kt, K2[8] = jt, K2[9] = Vt, K2[10] = Kt, K2[11] = rr, K2[12] = Tr, K2[13] = yr, K2[14] = pr, K2[15] = lr, K2[16] = _r, K2[17] = $r, K2[18] = Ar, q !== 0 && (K2[19] = q, O2.length++), O2;
                };
                function w(D2, I2, O2) {
                  return new _4().mulp(D2, I2, O2);
                }
                function _4(D2, I2) {
                  this.x = D2, this.y = I2;
                }
                Math.imul || (y = b), f.prototype.mulTo = function(D2, I2) {
                  var O2 = this.length + D2.length;
                  return this.length === 10 && D2.length === 10 ? y(this, D2, I2) : O2 < 63 ? b(this, D2, I2) : O2 < 1024 ? function(L2, V2, W2) {
                    W2.negative = V2.negative ^ L2.negative, W2.length = L2.length + V2.length;
                    for (var X2 = 0, Y2 = 0, K2 = 0; K2 < W2.length - 1; K2++) {
                      var q = Y2;
                      Y2 = 0;
                      for (var re = 67108863 & X2, R2 = Math.min(K2, V2.length - 1), z = Math.max(0, K2 - L2.length + 1); z <= R2; z++) {
                        var H2 = K2 - z, te = (0 | L2.words[H2]) * (0 | V2.words[z]), j = 67108863 & te;
                        re = 67108863 & (j = j + re | 0), Y2 += (q = (q = q + (te / 67108864 | 0) | 0) + (j >>> 26) | 0) >>> 26, q &= 67108863;
                      }
                      W2.words[K2] = re, X2 = q, q = Y2;
                    }
                    return X2 !== 0 ? W2.words[K2] = X2 : W2.length--, W2.strip();
                  }(this, D2, I2) : w(this, D2, I2);
                }, _4.prototype.makeRBT = function(D2) {
                  for (var I2 = new Array(D2), O2 = f.prototype._countBits(D2) - 1, L2 = 0; L2 < D2; L2++) I2[L2] = this.revBin(L2, O2, D2);
                  return I2;
                }, _4.prototype.revBin = function(D2, I2, O2) {
                  if (D2 === 0 || D2 === O2 - 1) return D2;
                  for (var L2 = 0, V2 = 0; V2 < I2; V2++) L2 |= (1 & D2) << I2 - V2 - 1, D2 >>= 1;
                  return L2;
                }, _4.prototype.permute = function(D2, I2, O2, L2, V2, W2) {
                  for (var X2 = 0; X2 < W2; X2++) L2[X2] = I2[D2[X2]], V2[X2] = O2[D2[X2]];
                }, _4.prototype.transform = function(D2, I2, O2, L2, V2, W2) {
                  this.permute(W2, D2, I2, O2, L2, V2);
                  for (var X2 = 1; X2 < V2; X2 <<= 1) for (var Y2 = X2 << 1, K2 = Math.cos(2 * Math.PI / Y2), q = Math.sin(2 * Math.PI / Y2), re = 0; re < V2; re += Y2) for (var R2 = K2, z = q, H2 = 0; H2 < X2; H2++) {
                    var te = O2[re + H2], j = L2[re + H2], Q2 = O2[re + H2 + X2], Z2 = L2[re + H2 + X2], ne = R2 * Q2 - z * Z2;
                    Z2 = R2 * Z2 + z * Q2, Q2 = ne, O2[re + H2] = te + Q2, L2[re + H2] = j + Z2, O2[re + H2 + X2] = te - Q2, L2[re + H2 + X2] = j - Z2, H2 !== Y2 && (ne = K2 * R2 - q * z, z = K2 * z + q * R2, R2 = ne);
                  }
                }, _4.prototype.guessLen13b = function(D2, I2) {
                  var O2 = 1 | Math.max(I2, D2), L2 = 1 & O2, V2 = 0;
                  for (O2 = O2 / 2 | 0; O2; O2 >>>= 1) V2++;
                  return 1 << V2 + 1 + L2;
                }, _4.prototype.conjugate = function(D2, I2, O2) {
                  if (!(O2 <= 1)) for (var L2 = 0; L2 < O2 / 2; L2++) {
                    var V2 = D2[L2];
                    D2[L2] = D2[O2 - L2 - 1], D2[O2 - L2 - 1] = V2, V2 = I2[L2], I2[L2] = -I2[O2 - L2 - 1], I2[O2 - L2 - 1] = -V2;
                  }
                }, _4.prototype.normalize13b = function(D2, I2) {
                  for (var O2 = 0, L2 = 0; L2 < I2 / 2; L2++) {
                    var V2 = 8192 * Math.round(D2[2 * L2 + 1] / I2) + Math.round(D2[2 * L2] / I2) + O2;
                    D2[L2] = 67108863 & V2, O2 = V2 < 67108864 ? 0 : V2 / 67108864 | 0;
                  }
                  return D2;
                }, _4.prototype.convert13b = function(D2, I2, O2, L2) {
                  for (var V2 = 0, W2 = 0; W2 < I2; W2++) V2 += 0 | D2[W2], O2[2 * W2] = 8191 & V2, V2 >>>= 13, O2[2 * W2 + 1] = 8191 & V2, V2 >>>= 13;
                  for (W2 = 2 * I2; W2 < L2; ++W2) O2[W2] = 0;
                  u2(V2 === 0), u2((-8192 & V2) == 0);
                }, _4.prototype.stub = function(D2) {
                  for (var I2 = new Array(D2), O2 = 0; O2 < D2; O2++) I2[O2] = 0;
                  return I2;
                }, _4.prototype.mulp = function(D2, I2, O2) {
                  var L2 = 2 * this.guessLen13b(D2.length, I2.length), V2 = this.makeRBT(L2), W2 = this.stub(L2), X2 = new Array(L2), Y2 = new Array(L2), K2 = new Array(L2), q = new Array(L2), re = new Array(L2), R2 = new Array(L2), z = O2.words;
                  z.length = L2, this.convert13b(D2.words, D2.length, X2, L2), this.convert13b(I2.words, I2.length, q, L2), this.transform(X2, W2, Y2, K2, L2, V2), this.transform(q, W2, re, R2, L2, V2);
                  for (var H2 = 0; H2 < L2; H2++) {
                    var te = Y2[H2] * re[H2] - K2[H2] * R2[H2];
                    K2[H2] = Y2[H2] * R2[H2] + K2[H2] * re[H2], Y2[H2] = te;
                  }
                  return this.conjugate(Y2, K2, L2), this.transform(Y2, K2, z, W2, L2, V2), this.conjugate(z, W2, L2), this.normalize13b(z, L2), O2.negative = D2.negative ^ I2.negative, O2.length = D2.length + I2.length, O2.strip();
                }, f.prototype.mul = function(D2) {
                  var I2 = new f(null);
                  return I2.words = new Array(this.length + D2.length), this.mulTo(D2, I2);
                }, f.prototype.mulf = function(D2) {
                  var I2 = new f(null);
                  return I2.words = new Array(this.length + D2.length), w(this, D2, I2);
                }, f.prototype.imul = function(D2) {
                  return this.clone().mulTo(D2, this);
                }, f.prototype.imuln = function(D2) {
                  u2(typeof D2 == "number"), u2(D2 < 67108864);
                  for (var I2 = 0, O2 = 0; O2 < this.length; O2++) {
                    var L2 = (0 | this.words[O2]) * D2, V2 = (67108863 & L2) + (67108863 & I2);
                    I2 >>= 26, I2 += L2 / 67108864 | 0, I2 += V2 >>> 26, this.words[O2] = 67108863 & V2;
                  }
                  return I2 !== 0 && (this.words[O2] = I2, this.length++), this;
                }, f.prototype.muln = function(D2) {
                  return this.clone().imuln(D2);
                }, f.prototype.sqr = function() {
                  return this.mul(this);
                }, f.prototype.isqr = function() {
                  return this.imul(this.clone());
                }, f.prototype.pow = function(D2) {
                  var I2 = function(W2) {
                    for (var X2 = new Array(W2.bitLength()), Y2 = 0; Y2 < X2.length; Y2++) {
                      var K2 = Y2 / 26 | 0, q = Y2 % 26;
                      X2[Y2] = (W2.words[K2] & 1 << q) >>> q;
                    }
                    return X2;
                  }(D2);
                  if (I2.length === 0) return new f(1);
                  for (var O2 = this, L2 = 0; L2 < I2.length && I2[L2] === 0; L2++, O2 = O2.sqr()) ;
                  if (++L2 < I2.length) for (var V2 = O2.sqr(); L2 < I2.length; L2++, V2 = V2.sqr()) I2[L2] !== 0 && (O2 = O2.mul(V2));
                  return O2;
                }, f.prototype.iushln = function(D2) {
                  u2(typeof D2 == "number" && D2 >= 0);
                  var I2, O2 = D2 % 26, L2 = (D2 - O2) / 26, V2 = 67108863 >>> 26 - O2 << 26 - O2;
                  if (O2 !== 0) {
                    var W2 = 0;
                    for (I2 = 0; I2 < this.length; I2++) {
                      var X2 = this.words[I2] & V2, Y2 = (0 | this.words[I2]) - X2 << O2;
                      this.words[I2] = Y2 | W2, W2 = X2 >>> 26 - O2;
                    }
                    W2 && (this.words[I2] = W2, this.length++);
                  }
                  if (L2 !== 0) {
                    for (I2 = this.length - 1; I2 >= 0; I2--) this.words[I2 + L2] = this.words[I2];
                    for (I2 = 0; I2 < L2; I2++) this.words[I2] = 0;
                    this.length += L2;
                  }
                  return this.strip();
                }, f.prototype.ishln = function(D2) {
                  return u2(this.negative === 0), this.iushln(D2);
                }, f.prototype.iushrn = function(D2, I2, O2) {
                  var L2;
                  u2(typeof D2 == "number" && D2 >= 0), L2 = I2 ? (I2 - I2 % 26) / 26 : 0;
                  var V2 = D2 % 26, W2 = Math.min((D2 - V2) / 26, this.length), X2 = 67108863 ^ 67108863 >>> V2 << V2, Y2 = O2;
                  if (L2 -= W2, L2 = Math.max(0, L2), Y2) {
                    for (var K2 = 0; K2 < W2; K2++) Y2.words[K2] = this.words[K2];
                    Y2.length = W2;
                  }
                  if (W2 !== 0) if (this.length > W2) for (this.length -= W2, K2 = 0; K2 < this.length; K2++) this.words[K2] = this.words[K2 + W2];
                  else this.words[0] = 0, this.length = 1;
                  var q = 0;
                  for (K2 = this.length - 1; K2 >= 0 && (q !== 0 || K2 >= L2); K2--) {
                    var re = 0 | this.words[K2];
                    this.words[K2] = q << 26 - V2 | re >>> V2, q = re & X2;
                  }
                  return Y2 && q !== 0 && (Y2.words[Y2.length++] = q), this.length === 0 && (this.words[0] = 0, this.length = 1), this.strip();
                }, f.prototype.ishrn = function(D2, I2, O2) {
                  return u2(this.negative === 0), this.iushrn(D2, I2, O2);
                }, f.prototype.shln = function(D2) {
                  return this.clone().ishln(D2);
                }, f.prototype.ushln = function(D2) {
                  return this.clone().iushln(D2);
                }, f.prototype.shrn = function(D2) {
                  return this.clone().ishrn(D2);
                }, f.prototype.ushrn = function(D2) {
                  return this.clone().iushrn(D2);
                }, f.prototype.testn = function(D2) {
                  u2(typeof D2 == "number" && D2 >= 0);
                  var I2 = D2 % 26, O2 = (D2 - I2) / 26, L2 = 1 << I2;
                  return !(this.length <= O2) && !!(this.words[O2] & L2);
                }, f.prototype.imaskn = function(D2) {
                  u2(typeof D2 == "number" && D2 >= 0);
                  var I2 = D2 % 26, O2 = (D2 - I2) / 26;
                  if (u2(this.negative === 0, "imaskn works only with positive numbers"), this.length <= O2) return this;
                  if (I2 !== 0 && O2++, this.length = Math.min(O2, this.length), I2 !== 0) {
                    var L2 = 67108863 ^ 67108863 >>> I2 << I2;
                    this.words[this.length - 1] &= L2;
                  }
                  return this.strip();
                }, f.prototype.maskn = function(D2) {
                  return this.clone().imaskn(D2);
                }, f.prototype.iaddn = function(D2) {
                  return u2(typeof D2 == "number"), u2(D2 < 67108864), D2 < 0 ? this.isubn(-D2) : this.negative !== 0 ? this.length === 1 && (0 | this.words[0]) < D2 ? (this.words[0] = D2 - (0 | this.words[0]), this.negative = 0, this) : (this.negative = 0, this.isubn(D2), this.negative = 1, this) : this._iaddn(D2);
                }, f.prototype._iaddn = function(D2) {
                  this.words[0] += D2;
                  for (var I2 = 0; I2 < this.length && this.words[I2] >= 67108864; I2++) this.words[I2] -= 67108864, I2 === this.length - 1 ? this.words[I2 + 1] = 1 : this.words[I2 + 1]++;
                  return this.length = Math.max(this.length, I2 + 1), this;
                }, f.prototype.isubn = function(D2) {
                  if (u2(typeof D2 == "number"), u2(D2 < 67108864), D2 < 0) return this.iaddn(-D2);
                  if (this.negative !== 0) return this.negative = 0, this.iaddn(D2), this.negative = 1, this;
                  if (this.words[0] -= D2, this.length === 1 && this.words[0] < 0) this.words[0] = -this.words[0], this.negative = 1;
                  else for (var I2 = 0; I2 < this.length && this.words[I2] < 0; I2++) this.words[I2] += 67108864, this.words[I2 + 1] -= 1;
                  return this.strip();
                }, f.prototype.addn = function(D2) {
                  return this.clone().iaddn(D2);
                }, f.prototype.subn = function(D2) {
                  return this.clone().isubn(D2);
                }, f.prototype.iabs = function() {
                  return this.negative = 0, this;
                }, f.prototype.abs = function() {
                  return this.clone().iabs();
                }, f.prototype._ishlnsubmul = function(D2, I2, O2) {
                  var L2, V2, W2 = D2.length + O2;
                  this._expand(W2);
                  var X2 = 0;
                  for (L2 = 0; L2 < D2.length; L2++) {
                    V2 = (0 | this.words[L2 + O2]) + X2;
                    var Y2 = (0 | D2.words[L2]) * I2;
                    X2 = ((V2 -= 67108863 & Y2) >> 26) - (Y2 / 67108864 | 0), this.words[L2 + O2] = 67108863 & V2;
                  }
                  for (; L2 < this.length - O2; L2++) X2 = (V2 = (0 | this.words[L2 + O2]) + X2) >> 26, this.words[L2 + O2] = 67108863 & V2;
                  if (X2 === 0) return this.strip();
                  for (u2(X2 === -1), X2 = 0, L2 = 0; L2 < this.length; L2++) X2 = (V2 = -(0 | this.words[L2]) + X2) >> 26, this.words[L2] = 67108863 & V2;
                  return this.negative = 1, this.strip();
                }, f.prototype._wordDiv = function(D2, I2) {
                  var O2 = (this.length, D2.length), L2 = this.clone(), V2 = D2, W2 = 0 | V2.words[V2.length - 1];
                  (O2 = 26 - this._countBits(W2)) !== 0 && (V2 = V2.ushln(O2), L2.iushln(O2), W2 = 0 | V2.words[V2.length - 1]);
                  var X2, Y2 = L2.length - V2.length;
                  if (I2 !== "mod") {
                    (X2 = new f(null)).length = Y2 + 1, X2.words = new Array(X2.length);
                    for (var K2 = 0; K2 < X2.length; K2++) X2.words[K2] = 0;
                  }
                  var q = L2.clone()._ishlnsubmul(V2, 1, Y2);
                  q.negative === 0 && (L2 = q, X2 && (X2.words[Y2] = 1));
                  for (var re = Y2 - 1; re >= 0; re--) {
                    var R2 = 67108864 * (0 | L2.words[V2.length + re]) + (0 | L2.words[V2.length + re - 1]);
                    for (R2 = Math.min(R2 / W2 | 0, 67108863), L2._ishlnsubmul(V2, R2, re); L2.negative !== 0; ) R2--, L2.negative = 0, L2._ishlnsubmul(V2, 1, re), L2.isZero() || (L2.negative ^= 1);
                    X2 && (X2.words[re] = R2);
                  }
                  return X2 && X2.strip(), L2.strip(), I2 !== "div" && O2 !== 0 && L2.iushrn(O2), { div: X2 || null, mod: L2 };
                }, f.prototype.divmod = function(D2, I2, O2) {
                  return u2(!D2.isZero()), this.isZero() ? { div: new f(0), mod: new f(0) } : this.negative !== 0 && D2.negative === 0 ? (W2 = this.neg().divmod(D2, I2), I2 !== "mod" && (L2 = W2.div.neg()), I2 !== "div" && (V2 = W2.mod.neg(), O2 && V2.negative !== 0 && V2.iadd(D2)), { div: L2, mod: V2 }) : this.negative === 0 && D2.negative !== 0 ? (W2 = this.divmod(D2.neg(), I2), I2 !== "mod" && (L2 = W2.div.neg()), { div: L2, mod: W2.mod }) : (this.negative & D2.negative) != 0 ? (W2 = this.neg().divmod(D2.neg(), I2), I2 !== "div" && (V2 = W2.mod.neg(), O2 && V2.negative !== 0 && V2.isub(D2)), { div: W2.div, mod: V2 }) : D2.length > this.length || this.cmp(D2) < 0 ? { div: new f(0), mod: this } : D2.length === 1 ? I2 === "div" ? { div: this.divn(D2.words[0]), mod: null } : I2 === "mod" ? { div: null, mod: new f(this.modn(D2.words[0])) } : { div: this.divn(D2.words[0]), mod: new f(this.modn(D2.words[0])) } : this._wordDiv(D2, I2);
                  var L2, V2, W2;
                }, f.prototype.div = function(D2) {
                  return this.divmod(D2, "div", false).div;
                }, f.prototype.mod = function(D2) {
                  return this.divmod(D2, "mod", false).mod;
                }, f.prototype.umod = function(D2) {
                  return this.divmod(D2, "mod", true).mod;
                }, f.prototype.divRound = function(D2) {
                  var I2 = this.divmod(D2);
                  if (I2.mod.isZero()) return I2.div;
                  var O2 = I2.div.negative !== 0 ? I2.mod.isub(D2) : I2.mod, L2 = D2.ushrn(1), V2 = D2.andln(1), W2 = O2.cmp(L2);
                  return W2 < 0 || V2 === 1 && W2 === 0 ? I2.div : I2.div.negative !== 0 ? I2.div.isubn(1) : I2.div.iaddn(1);
                }, f.prototype.modn = function(D2) {
                  u2(D2 <= 67108863);
                  for (var I2 = (1 << 26) % D2, O2 = 0, L2 = this.length - 1; L2 >= 0; L2--) O2 = (I2 * O2 + (0 | this.words[L2])) % D2;
                  return O2;
                }, f.prototype.idivn = function(D2) {
                  u2(D2 <= 67108863);
                  for (var I2 = 0, O2 = this.length - 1; O2 >= 0; O2--) {
                    var L2 = (0 | this.words[O2]) + 67108864 * I2;
                    this.words[O2] = L2 / D2 | 0, I2 = L2 % D2;
                  }
                  return this.strip();
                }, f.prototype.divn = function(D2) {
                  return this.clone().idivn(D2);
                }, f.prototype.egcd = function(D2) {
                  u2(D2.negative === 0), u2(!D2.isZero());
                  var I2 = this, O2 = D2.clone();
                  I2 = I2.negative !== 0 ? I2.umod(D2) : I2.clone();
                  for (var L2 = new f(1), V2 = new f(0), W2 = new f(0), X2 = new f(1), Y2 = 0; I2.isEven() && O2.isEven(); ) I2.iushrn(1), O2.iushrn(1), ++Y2;
                  for (var K2 = O2.clone(), q = I2.clone(); !I2.isZero(); ) {
                    for (var re = 0, R2 = 1; (I2.words[0] & R2) == 0 && re < 26; ++re, R2 <<= 1) ;
                    if (re > 0) for (I2.iushrn(re); re-- > 0; ) (L2.isOdd() || V2.isOdd()) && (L2.iadd(K2), V2.isub(q)), L2.iushrn(1), V2.iushrn(1);
                    for (var z = 0, H2 = 1; (O2.words[0] & H2) == 0 && z < 26; ++z, H2 <<= 1) ;
                    if (z > 0) for (O2.iushrn(z); z-- > 0; ) (W2.isOdd() || X2.isOdd()) && (W2.iadd(K2), X2.isub(q)), W2.iushrn(1), X2.iushrn(1);
                    I2.cmp(O2) >= 0 ? (I2.isub(O2), L2.isub(W2), V2.isub(X2)) : (O2.isub(I2), W2.isub(L2), X2.isub(V2));
                  }
                  return { a: W2, b: X2, gcd: O2.iushln(Y2) };
                }, f.prototype._invmp = function(D2) {
                  u2(D2.negative === 0), u2(!D2.isZero());
                  var I2 = this, O2 = D2.clone();
                  I2 = I2.negative !== 0 ? I2.umod(D2) : I2.clone();
                  for (var L2, V2 = new f(1), W2 = new f(0), X2 = O2.clone(); I2.cmpn(1) > 0 && O2.cmpn(1) > 0; ) {
                    for (var Y2 = 0, K2 = 1; (I2.words[0] & K2) == 0 && Y2 < 26; ++Y2, K2 <<= 1) ;
                    if (Y2 > 0) for (I2.iushrn(Y2); Y2-- > 0; ) V2.isOdd() && V2.iadd(X2), V2.iushrn(1);
                    for (var q = 0, re = 1; (O2.words[0] & re) == 0 && q < 26; ++q, re <<= 1) ;
                    if (q > 0) for (O2.iushrn(q); q-- > 0; ) W2.isOdd() && W2.iadd(X2), W2.iushrn(1);
                    I2.cmp(O2) >= 0 ? (I2.isub(O2), V2.isub(W2)) : (O2.isub(I2), W2.isub(V2));
                  }
                  return (L2 = I2.cmpn(1) === 0 ? V2 : W2).cmpn(0) < 0 && L2.iadd(D2), L2;
                }, f.prototype.gcd = function(D2) {
                  if (this.isZero()) return D2.abs();
                  if (D2.isZero()) return this.abs();
                  var I2 = this.clone(), O2 = D2.clone();
                  I2.negative = 0, O2.negative = 0;
                  for (var L2 = 0; I2.isEven() && O2.isEven(); L2++) I2.iushrn(1), O2.iushrn(1);
                  for (; ; ) {
                    for (; I2.isEven(); ) I2.iushrn(1);
                    for (; O2.isEven(); ) O2.iushrn(1);
                    var V2 = I2.cmp(O2);
                    if (V2 < 0) {
                      var W2 = I2;
                      I2 = O2, O2 = W2;
                    } else if (V2 === 0 || O2.cmpn(1) === 0) break;
                    I2.isub(O2);
                  }
                  return O2.iushln(L2);
                }, f.prototype.invm = function(D2) {
                  return this.egcd(D2).a.umod(D2);
                }, f.prototype.isEven = function() {
                  return (1 & this.words[0]) == 0;
                }, f.prototype.isOdd = function() {
                  return (1 & this.words[0]) == 1;
                }, f.prototype.andln = function(D2) {
                  return this.words[0] & D2;
                }, f.prototype.bincn = function(D2) {
                  u2(typeof D2 == "number");
                  var I2 = D2 % 26, O2 = (D2 - I2) / 26, L2 = 1 << I2;
                  if (this.length <= O2) return this._expand(O2 + 1), this.words[O2] |= L2, this;
                  for (var V2 = L2, W2 = O2; V2 !== 0 && W2 < this.length; W2++) {
                    var X2 = 0 | this.words[W2];
                    V2 = (X2 += V2) >>> 26, X2 &= 67108863, this.words[W2] = X2;
                  }
                  return V2 !== 0 && (this.words[W2] = V2, this.length++), this;
                }, f.prototype.isZero = function() {
                  return this.length === 1 && this.words[0] === 0;
                }, f.prototype.cmpn = function(D2) {
                  var I2, O2 = D2 < 0;
                  if (this.negative !== 0 && !O2) return -1;
                  if (this.negative === 0 && O2) return 1;
                  if (this.strip(), this.length > 1) I2 = 1;
                  else {
                    O2 && (D2 = -D2), u2(D2 <= 67108863, "Number is too big");
                    var L2 = 0 | this.words[0];
                    I2 = L2 === D2 ? 0 : L2 < D2 ? -1 : 1;
                  }
                  return this.negative !== 0 ? 0 | -I2 : I2;
                }, f.prototype.cmp = function(D2) {
                  if (this.negative !== 0 && D2.negative === 0) return -1;
                  if (this.negative === 0 && D2.negative !== 0) return 1;
                  var I2 = this.ucmp(D2);
                  return this.negative !== 0 ? 0 | -I2 : I2;
                }, f.prototype.ucmp = function(D2) {
                  if (this.length > D2.length) return 1;
                  if (this.length < D2.length) return -1;
                  for (var I2 = 0, O2 = this.length - 1; O2 >= 0; O2--) {
                    var L2 = 0 | this.words[O2], V2 = 0 | D2.words[O2];
                    if (L2 !== V2) {
                      L2 < V2 ? I2 = -1 : L2 > V2 && (I2 = 1);
                      break;
                    }
                  }
                  return I2;
                }, f.prototype.gtn = function(D2) {
                  return this.cmpn(D2) === 1;
                }, f.prototype.gt = function(D2) {
                  return this.cmp(D2) === 1;
                }, f.prototype.gten = function(D2) {
                  return this.cmpn(D2) >= 0;
                }, f.prototype.gte = function(D2) {
                  return this.cmp(D2) >= 0;
                }, f.prototype.ltn = function(D2) {
                  return this.cmpn(D2) === -1;
                }, f.prototype.lt = function(D2) {
                  return this.cmp(D2) === -1;
                }, f.prototype.lten = function(D2) {
                  return this.cmpn(D2) <= 0;
                }, f.prototype.lte = function(D2) {
                  return this.cmp(D2) <= 0;
                }, f.prototype.eqn = function(D2) {
                  return this.cmpn(D2) === 0;
                }, f.prototype.eq = function(D2) {
                  return this.cmp(D2) === 0;
                }, f.red = function(D2) {
                  return new F13(D2);
                }, f.prototype.toRed = function(D2) {
                  return u2(!this.red, "Already a number in reduction context"), u2(this.negative === 0, "red works only with positives"), D2.convertTo(this)._forceRed(D2);
                }, f.prototype.fromRed = function() {
                  return u2(this.red, "fromRed works only with numbers in reduction context"), this.red.convertFrom(this);
                }, f.prototype._forceRed = function(D2) {
                  return this.red = D2, this;
                }, f.prototype.forceRed = function(D2) {
                  return u2(!this.red, "Already a number in reduction context"), this._forceRed(D2);
                }, f.prototype.redAdd = function(D2) {
                  return u2(this.red, "redAdd works only with red numbers"), this.red.add(this, D2);
                }, f.prototype.redIAdd = function(D2) {
                  return u2(this.red, "redIAdd works only with red numbers"), this.red.iadd(this, D2);
                }, f.prototype.redSub = function(D2) {
                  return u2(this.red, "redSub works only with red numbers"), this.red.sub(this, D2);
                }, f.prototype.redISub = function(D2) {
                  return u2(this.red, "redISub works only with red numbers"), this.red.isub(this, D2);
                }, f.prototype.redShl = function(D2) {
                  return u2(this.red, "redShl works only with red numbers"), this.red.shl(this, D2);
                }, f.prototype.redMul = function(D2) {
                  return u2(this.red, "redMul works only with red numbers"), this.red._verify2(this, D2), this.red.mul(this, D2);
                }, f.prototype.redIMul = function(D2) {
                  return u2(this.red, "redMul works only with red numbers"), this.red._verify2(this, D2), this.red.imul(this, D2);
                }, f.prototype.redSqr = function() {
                  return u2(this.red, "redSqr works only with red numbers"), this.red._verify1(this), this.red.sqr(this);
                }, f.prototype.redISqr = function() {
                  return u2(this.red, "redISqr works only with red numbers"), this.red._verify1(this), this.red.isqr(this);
                }, f.prototype.redSqrt = function() {
                  return u2(this.red, "redSqrt works only with red numbers"), this.red._verify1(this), this.red.sqrt(this);
                }, f.prototype.redInvm = function() {
                  return u2(this.red, "redInvm works only with red numbers"), this.red._verify1(this), this.red.invm(this);
                }, f.prototype.redNeg = function() {
                  return u2(this.red, "redNeg works only with red numbers"), this.red._verify1(this), this.red.neg(this);
                }, f.prototype.redPow = function(D2) {
                  return u2(this.red && !D2.red, "redPow(normalNum)"), this.red._verify1(this), this.red.pow(this, D2);
                };
                var k = { k256: null, p224: null, p192: null, p25519: null };
                function T2(D2, I2) {
                  this.name = D2, this.p = new f(I2, 16), this.n = this.p.bitLength(), this.k = new f(1).iushln(this.n).isub(this.p), this.tmp = this._tmp();
                }
                function A2() {
                  T2.call(this, "k256", "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f");
                }
                function S2() {
                  T2.call(this, "p224", "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001");
                }
                function C2() {
                  T2.call(this, "p192", "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff");
                }
                function E2() {
                  T2.call(this, "25519", "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed");
                }
                function F13(D2) {
                  if (typeof D2 == "string") {
                    var I2 = f._prime(D2);
                    this.m = I2.p, this.prime = I2;
                  } else u2(D2.gtn(1), "modulus must be greater than 1"), this.m = D2, this.prime = null;
                }
                function N2(D2) {
                  F13.call(this, D2), this.shift = this.m.bitLength(), this.shift % 26 != 0 && (this.shift += 26 - this.shift % 26), this.r = new f(1).iushln(this.shift), this.r2 = this.imod(this.r.sqr()), this.rinv = this.r._invmp(this.m), this.minv = this.rinv.mul(this.r).isubn(1).div(this.m), this.minv = this.minv.umod(this.r), this.minv = this.r.sub(this.minv);
                }
                T2.prototype._tmp = function() {
                  var D2 = new f(null);
                  return D2.words = new Array(Math.ceil(this.n / 13)), D2;
                }, T2.prototype.ireduce = function(D2) {
                  var I2, O2 = D2;
                  do
                    this.split(O2, this.tmp), I2 = (O2 = (O2 = this.imulK(O2)).iadd(this.tmp)).bitLength();
                  while (I2 > this.n);
                  var L2 = I2 < this.n ? -1 : O2.ucmp(this.p);
                  return L2 === 0 ? (O2.words[0] = 0, O2.length = 1) : L2 > 0 ? O2.isub(this.p) : O2.strip !== void 0 ? O2.strip() : O2._strip(), O2;
                }, T2.prototype.split = function(D2, I2) {
                  D2.iushrn(this.n, 0, I2);
                }, T2.prototype.imulK = function(D2) {
                  return D2.imul(this.k);
                }, c(A2, T2), A2.prototype.split = function(D2, I2) {
                  for (var O2 = Math.min(D2.length, 9), L2 = 0; L2 < O2; L2++) I2.words[L2] = D2.words[L2];
                  if (I2.length = O2, D2.length <= 9) return D2.words[0] = 0, void (D2.length = 1);
                  var V2 = D2.words[9];
                  for (I2.words[I2.length++] = 4194303 & V2, L2 = 10; L2 < D2.length; L2++) {
                    var W2 = 0 | D2.words[L2];
                    D2.words[L2 - 10] = (4194303 & W2) << 4 | V2 >>> 22, V2 = W2;
                  }
                  V2 >>>= 22, D2.words[L2 - 10] = V2, V2 === 0 && D2.length > 10 ? D2.length -= 10 : D2.length -= 9;
                }, A2.prototype.imulK = function(D2) {
                  D2.words[D2.length] = 0, D2.words[D2.length + 1] = 0, D2.length += 2;
                  for (var I2 = 0, O2 = 0; O2 < D2.length; O2++) {
                    var L2 = 0 | D2.words[O2];
                    I2 += 977 * L2, D2.words[O2] = 67108863 & I2, I2 = 64 * L2 + (I2 / 67108864 | 0);
                  }
                  return D2.words[D2.length - 1] === 0 && (D2.length--, D2.words[D2.length - 1] === 0 && D2.length--), D2;
                }, c(S2, T2), c(C2, T2), c(E2, T2), E2.prototype.imulK = function(D2) {
                  for (var I2 = 0, O2 = 0; O2 < D2.length; O2++) {
                    var L2 = 19 * (0 | D2.words[O2]) + I2, V2 = 67108863 & L2;
                    L2 >>>= 26, D2.words[O2] = V2, I2 = L2;
                  }
                  return I2 !== 0 && (D2.words[D2.length++] = I2), D2;
                }, f._prime = function(D2) {
                  if (k[D2]) return k[D2];
                  var I2;
                  if (D2 === "k256") I2 = new A2();
                  else if (D2 === "p224") I2 = new S2();
                  else if (D2 === "p192") I2 = new C2();
                  else {
                    if (D2 !== "p25519") throw new Error("Unknown prime " + D2);
                    I2 = new E2();
                  }
                  return k[D2] = I2, I2;
                }, F13.prototype._verify1 = function(D2) {
                  u2(D2.negative === 0, "red works only with positives"), u2(D2.red, "red works only with red numbers");
                }, F13.prototype._verify2 = function(D2, I2) {
                  u2((D2.negative | I2.negative) == 0, "red works only with positives"), u2(D2.red && D2.red === I2.red, "red works only with red numbers");
                }, F13.prototype.imod = function(D2) {
                  return this.prime ? this.prime.ireduce(D2)._forceRed(this) : D2.umod(this.m)._forceRed(this);
                }, F13.prototype.neg = function(D2) {
                  return D2.isZero() ? D2.clone() : this.m.sub(D2)._forceRed(this);
                }, F13.prototype.add = function(D2, I2) {
                  this._verify2(D2, I2);
                  var O2 = D2.add(I2);
                  return O2.cmp(this.m) >= 0 && O2.isub(this.m), O2._forceRed(this);
                }, F13.prototype.iadd = function(D2, I2) {
                  this._verify2(D2, I2);
                  var O2 = D2.iadd(I2);
                  return O2.cmp(this.m) >= 0 && O2.isub(this.m), O2;
                }, F13.prototype.sub = function(D2, I2) {
                  this._verify2(D2, I2);
                  var O2 = D2.sub(I2);
                  return O2.cmpn(0) < 0 && O2.iadd(this.m), O2._forceRed(this);
                }, F13.prototype.isub = function(D2, I2) {
                  this._verify2(D2, I2);
                  var O2 = D2.isub(I2);
                  return O2.cmpn(0) < 0 && O2.iadd(this.m), O2;
                }, F13.prototype.shl = function(D2, I2) {
                  return this._verify1(D2), this.imod(D2.ushln(I2));
                }, F13.prototype.imul = function(D2, I2) {
                  return this._verify2(D2, I2), this.imod(D2.imul(I2));
                }, F13.prototype.mul = function(D2, I2) {
                  return this._verify2(D2, I2), this.imod(D2.mul(I2));
                }, F13.prototype.isqr = function(D2) {
                  return this.imul(D2, D2.clone());
                }, F13.prototype.sqr = function(D2) {
                  return this.mul(D2, D2);
                }, F13.prototype.sqrt = function(D2) {
                  if (D2.isZero()) return D2.clone();
                  var I2 = this.m.andln(3);
                  if (u2(I2 % 2 == 1), I2 === 3) {
                    var O2 = this.m.add(new f(1)).iushrn(2);
                    return this.pow(D2, O2);
                  }
                  for (var L2 = this.m.subn(1), V2 = 0; !L2.isZero() && L2.andln(1) === 0; ) V2++, L2.iushrn(1);
                  u2(!L2.isZero());
                  var W2 = new f(1).toRed(this), X2 = W2.redNeg(), Y2 = this.m.subn(1).iushrn(1), K2 = this.m.bitLength();
                  for (K2 = new f(2 * K2 * K2).toRed(this); this.pow(K2, Y2).cmp(X2) !== 0; ) K2.redIAdd(X2);
                  for (var q = this.pow(K2, L2), re = this.pow(D2, L2.addn(1).iushrn(1)), R2 = this.pow(D2, L2), z = V2; R2.cmp(W2) !== 0; ) {
                    for (var H2 = R2, te = 0; H2.cmp(W2) !== 0; te++) H2 = H2.redSqr();
                    u2(te < z);
                    var j = this.pow(q, new f(1).iushln(z - te - 1));
                    re = re.redMul(j), q = j.redSqr(), R2 = R2.redMul(q), z = te;
                  }
                  return re;
                }, F13.prototype.invm = function(D2) {
                  var I2 = D2._invmp(this.m);
                  return I2.negative !== 0 ? (I2.negative = 0, this.imod(I2).redNeg()) : this.imod(I2);
                }, F13.prototype.pow = function(D2, I2) {
                  if (I2.isZero()) return new f(1).toRed(this);
                  if (I2.cmpn(1) === 0) return D2.clone();
                  var O2 = new Array(16);
                  O2[0] = new f(1).toRed(this), O2[1] = D2;
                  for (var L2 = 2; L2 < O2.length; L2++) O2[L2] = this.mul(O2[L2 - 1], D2);
                  var V2 = O2[0], W2 = 0, X2 = 0, Y2 = I2.bitLength() % 26;
                  for (Y2 === 0 && (Y2 = 26), L2 = I2.length - 1; L2 >= 0; L2--) {
                    for (var K2 = I2.words[L2], q = Y2 - 1; q >= 0; q--) {
                      var re = K2 >> q & 1;
                      V2 !== O2[0] && (V2 = this.sqr(V2)), re !== 0 || W2 !== 0 ? (W2 <<= 1, W2 |= re, (++X2 === 4 || L2 === 0 && q === 0) && (V2 = this.mul(V2, O2[W2]), X2 = 0, W2 = 0)) : X2 = 0;
                    }
                    Y2 = 26;
                  }
                  return V2;
                }, F13.prototype.convertTo = function(D2) {
                  var I2 = D2.umod(this.m);
                  return I2 === D2 ? I2.clone() : I2;
                }, F13.prototype.convertFrom = function(D2) {
                  var I2 = D2.clone();
                  return I2.red = null, I2;
                }, f.mont = function(D2) {
                  return new N2(D2);
                }, c(N2, F13), N2.prototype.convertTo = function(D2) {
                  return this.imod(D2.ushln(this.shift));
                }, N2.prototype.convertFrom = function(D2) {
                  var I2 = this.imod(D2.mul(this.rinv));
                  return I2.red = null, I2;
                }, N2.prototype.imul = function(D2, I2) {
                  if (D2.isZero() || I2.isZero()) return D2.words[0] = 0, D2.length = 1, D2;
                  var O2 = D2.imul(I2), L2 = O2.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), V2 = O2.isub(L2).iushrn(this.shift), W2 = V2;
                  return V2.cmp(this.m) >= 0 ? W2 = V2.isub(this.m) : V2.cmpn(0) < 0 && (W2 = V2.iadd(this.m)), W2._forceRed(this);
                }, N2.prototype.mul = function(D2, I2) {
                  if (D2.isZero() || I2.isZero()) return new f(0)._forceRed(this);
                  var O2 = D2.mul(I2), L2 = O2.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), V2 = O2.isub(L2).iushrn(this.shift), W2 = V2;
                  return V2.cmp(this.m) >= 0 ? W2 = V2.isub(this.m) : V2.cmpn(0) < 0 && (W2 = V2.iadd(this.m)), W2._forceRed(this);
                }, N2.prototype.invm = function(D2) {
                  return this.imod(D2._invmp(this.m).mul(this.r2))._forceRed(this);
                };
              })(o === void 0 || o, this);
            }, { buffer: 2 }], 34: [function(a, o, s) {
              "use strict";
              o.exports = function(i) {
                var l, u2, c, f = i.length, h = 0;
                for (l = 0; l < f; ++l) h += i[l].length;
                var p = new Array(h), d = 0;
                for (l = 0; l < f; ++l) {
                  var v = i[l], m = v.length;
                  for (u2 = 0; u2 < m; ++u2) {
                    var g = p[d++] = new Array(m - 1), x = 0;
                    for (c = 0; c < m; ++c) c !== u2 && (g[x++] = v[c]);
                    if (1 & u2) {
                      var b = g[1];
                      g[1] = g[0], g[0] = b;
                    }
                  }
                }
                return p;
              };
            }, {}], 35: [function(a, o, s) {
              "use strict";
              o.exports = function(g, x, b) {
                switch (arguments.length) {
                  case 1:
                    return v(g);
                  case 2:
                    return typeof x == "function" ? p(g, g, x, true) : m(g, x);
                  case 3:
                    return p(g, x, b, false);
                  default:
                    throw new Error("box-intersect: Invalid arguments");
                }
              };
              var i, l = a("typedarray-pool"), u2 = a("./lib/sweep"), c = a("./lib/intersect");
              function f(g, x) {
                for (var b = 0; b < g; ++b) if (!(x[b] <= x[b + g])) return true;
                return false;
              }
              function h(g, x, b, y) {
                for (var w = 0, _4 = 0, k = 0, T2 = g.length; k < T2; ++k) {
                  var A2 = g[k];
                  if (!f(x, A2)) {
                    for (var S2 = 0; S2 < 2 * x; ++S2) b[w++] = A2[S2];
                    y[_4++] = k;
                  }
                }
                return _4;
              }
              function p(g, x, b, y) {
                var w = g.length, _4 = x.length;
                if (!(w <= 0 || _4 <= 0)) {
                  var k = g[0].length >>> 1;
                  if (!(k <= 0)) {
                    var T2, A2 = l.mallocDouble(2 * k * w), S2 = l.mallocInt32(w);
                    if ((w = h(g, k, A2, S2)) > 0) {
                      if (k === 1 && y) u2.init(w), T2 = u2.sweepComplete(k, b, 0, w, A2, S2, 0, w, A2, S2);
                      else {
                        var C2 = l.mallocDouble(2 * k * _4), E2 = l.mallocInt32(_4);
                        (_4 = h(x, k, C2, E2)) > 0 && (u2.init(w + _4), T2 = k === 1 ? u2.sweepBipartite(k, b, 0, w, A2, S2, 0, _4, C2, E2) : c(k, b, y, w, A2, S2, _4, C2, E2), l.free(C2), l.free(E2));
                      }
                      l.free(A2), l.free(S2);
                    }
                    return T2;
                  }
                }
              }
              function d(g, x) {
                i.push([g, x]);
              }
              function v(g) {
                return i = [], p(g, g, d, true), i;
              }
              function m(g, x) {
                return i = [], p(g, x, d, false), i;
              }
            }, { "./lib/intersect": 37, "./lib/sweep": 41, "typedarray-pool": 308 }], 36: [function(a, o, s) {
              "use strict";
              function i(l) {
                return l ? function(u2, c, f, h, p, d, v, m, g, x, b) {
                  return p - h > g - m ? function(y, w, _4, k, T2, A2, S2, C2, E2, F13, N2) {
                    for (var D2 = 2 * y, I2 = k, O2 = D2 * k; I2 < T2; ++I2, O2 += D2) {
                      var L2 = A2[w + O2], V2 = A2[w + O2 + y], W2 = S2[I2];
                      e: for (var X2 = C2, Y2 = D2 * C2; X2 < E2; ++X2, Y2 += D2) {
                        var K2 = F13[w + Y2], q = F13[w + Y2 + y], re = N2[X2];
                        if (!(q < L2 || V2 < K2)) {
                          for (var R2 = w + 1; R2 < y; ++R2) {
                            var z = A2[R2 + O2], H2 = A2[R2 + y + O2], te = F13[R2 + Y2], j = F13[R2 + y + Y2];
                            if (H2 < te || j < z) continue e;
                          }
                          var Q2 = _4(W2, re);
                          if (Q2 !== void 0) return Q2;
                        }
                      }
                    }
                  }(u2, c, f, h, p, d, v, m, g, x, b) : function(y, w, _4, k, T2, A2, S2, C2, E2, F13, N2) {
                    for (var D2 = 2 * y, I2 = C2, O2 = D2 * C2; I2 < E2; ++I2, O2 += D2) {
                      var L2 = F13[w + O2], V2 = F13[w + O2 + y], W2 = N2[I2];
                      e: for (var X2 = k, Y2 = D2 * k; X2 < T2; ++X2, Y2 += D2) {
                        var K2 = A2[w + Y2], q = A2[w + Y2 + y], re = S2[X2];
                        if (!(V2 < K2 || q < L2)) {
                          for (var R2 = w + 1; R2 < y; ++R2) {
                            var z = A2[R2 + Y2], H2 = A2[R2 + y + Y2], te = F13[R2 + O2], j = F13[R2 + y + O2];
                            if (H2 < te || j < z) continue e;
                          }
                          var Q2 = _4(re, W2);
                          if (Q2 !== void 0) return Q2;
                        }
                      }
                    }
                  }(u2, c, f, h, p, d, v, m, g, x, b);
                } : function(u2, c, f, h, p, d, v, m, g, x, b, y) {
                  return d - p > x - g ? h ? function(w, _4, k, T2, A2, S2, C2, E2, F13, N2, D2) {
                    for (var I2 = 2 * w, O2 = T2, L2 = I2 * T2; O2 < A2; ++O2, L2 += I2) {
                      var V2 = S2[_4 + L2], W2 = S2[_4 + L2 + w], X2 = C2[O2];
                      e: for (var Y2 = E2, K2 = I2 * E2; Y2 < F13; ++Y2, K2 += I2) {
                        var q = N2[_4 + K2], re = D2[Y2];
                        if (!(q <= V2 || W2 < q)) {
                          for (var R2 = _4 + 1; R2 < w; ++R2) {
                            var z = S2[R2 + L2], H2 = S2[R2 + w + L2], te = N2[R2 + K2], j = N2[R2 + w + K2];
                            if (H2 < te || j < z) continue e;
                          }
                          var Q2 = k(re, X2);
                          if (Q2 !== void 0) return Q2;
                        }
                      }
                    }
                  }(u2, c, f, p, d, v, m, g, x, b, y) : function(w, _4, k, T2, A2, S2, C2, E2, F13, N2, D2) {
                    for (var I2 = 2 * w, O2 = T2, L2 = I2 * T2; O2 < A2; ++O2, L2 += I2) {
                      var V2 = S2[_4 + L2], W2 = S2[_4 + L2 + w], X2 = C2[O2];
                      e: for (var Y2 = E2, K2 = I2 * E2; Y2 < F13; ++Y2, K2 += I2) {
                        var q = N2[_4 + K2], re = D2[Y2];
                        if (!(q < V2 || W2 < q)) {
                          for (var R2 = _4 + 1; R2 < w; ++R2) {
                            var z = S2[R2 + L2], H2 = S2[R2 + w + L2], te = N2[R2 + K2], j = N2[R2 + w + K2];
                            if (H2 < te || j < z) continue e;
                          }
                          var Q2 = k(X2, re);
                          if (Q2 !== void 0) return Q2;
                        }
                      }
                    }
                  }(u2, c, f, p, d, v, m, g, x, b, y) : h ? function(w, _4, k, T2, A2, S2, C2, E2, F13, N2, D2) {
                    for (var I2 = 2 * w, O2 = E2, L2 = I2 * E2; O2 < F13; ++O2, L2 += I2) {
                      var V2 = N2[_4 + L2], W2 = D2[O2];
                      e: for (var X2 = T2, Y2 = I2 * T2; X2 < A2; ++X2, Y2 += I2) {
                        var K2 = S2[_4 + Y2], q = S2[_4 + Y2 + w], re = C2[X2];
                        if (!(V2 <= K2 || q < V2)) {
                          for (var R2 = _4 + 1; R2 < w; ++R2) {
                            var z = S2[R2 + Y2], H2 = S2[R2 + w + Y2], te = N2[R2 + L2], j = N2[R2 + w + L2];
                            if (H2 < te || j < z) continue e;
                          }
                          var Q2 = k(W2, re);
                          if (Q2 !== void 0) return Q2;
                        }
                      }
                    }
                  }(u2, c, f, p, d, v, m, g, x, b, y) : function(w, _4, k, T2, A2, S2, C2, E2, F13, N2, D2) {
                    for (var I2 = 2 * w, O2 = E2, L2 = I2 * E2; O2 < F13; ++O2, L2 += I2) {
                      var V2 = N2[_4 + L2], W2 = D2[O2];
                      e: for (var X2 = T2, Y2 = I2 * T2; X2 < A2; ++X2, Y2 += I2) {
                        var K2 = S2[_4 + Y2], q = S2[_4 + Y2 + w], re = C2[X2];
                        if (!(V2 < K2 || q < V2)) {
                          for (var R2 = _4 + 1; R2 < w; ++R2) {
                            var z = S2[R2 + Y2], H2 = S2[R2 + w + Y2], te = N2[R2 + L2], j = N2[R2 + w + L2];
                            if (H2 < te || j < z) continue e;
                          }
                          var Q2 = k(re, W2);
                          if (Q2 !== void 0) return Q2;
                        }
                      }
                    }
                  }(u2, c, f, p, d, v, m, g, x, b, y);
                };
              }
              s.partial = i(false), s.full = i(true);
            }, {}], 37: [function(a, o, s) {
              "use strict";
              o.exports = function(S2, C2, E2, F13, N2, D2, I2, O2, L2) {
                (function(Ee, Se) {
                  var Ce = 8 * l.log2(Se + 1) * (Ee + 1) | 0, Be = l.nextPow2(6 * Ce);
                  w.length < Be && (i.free(w), w = i.mallocInt32(Be));
                  var Ue = l.nextPow2(2 * Ce);
                  _4.length < Ue && (i.free(_4), _4 = i.mallocDouble(Ue));
                })(S2, F13 + I2);
                var V2, W2 = 0, X2 = 2 * S2;
                for (k(W2++, 0, 0, F13, 0, I2, E2 ? 16 : 0, -1 / 0, 1 / 0), E2 || k(W2++, 0, 0, I2, 0, F13, 1, -1 / 0, 1 / 0); W2 > 0; ) {
                  var Y2 = 6 * (W2 -= 1), K2 = w[Y2], q = w[Y2 + 1], re = w[Y2 + 2], R2 = w[Y2 + 3], z = w[Y2 + 4], H2 = w[Y2 + 5], te = 2 * W2, j = _4[te], Q2 = _4[te + 1], Z2 = 1 & H2, ne = !!(16 & H2), ae = N2, ue = D2, le = O2, ce = L2;
                  if (Z2 && (ae = O2, ue = L2, le = N2, ce = D2), !(2 & H2 && (re = g(S2, K2, q, re, ae, ue, Q2), q >= re) || 4 & H2 && (q = x(S2, K2, q, re, ae, ue, j)) >= re)) {
                    var se = re - q, he = z - R2;
                    if (ne) {
                      if (S2 * se * (se + he) < 1 << 22) {
                        if ((V2 = h.scanComplete(S2, K2, C2, q, re, ae, ue, R2, z, le, ce)) !== void 0) return V2;
                        continue;
                      }
                    } else {
                      if (S2 * Math.min(se, he) < 128) {
                        if ((V2 = c(S2, K2, C2, Z2, q, re, ae, ue, R2, z, le, ce)) !== void 0) return V2;
                        continue;
                      }
                      if (S2 * se * he < 1 << 22) {
                        if ((V2 = h.scanBipartite(S2, K2, C2, Z2, q, re, ae, ue, R2, z, le, ce)) !== void 0) return V2;
                        continue;
                      }
                    }
                    var me = v(S2, K2, q, re, ae, ue, j, Q2);
                    if (q < me) if (S2 * (me - q) < 128) {
                      if ((V2 = f(S2, K2 + 1, C2, q, me, ae, ue, R2, z, le, ce)) !== void 0) return V2;
                    } else if (K2 === S2 - 2) {
                      if ((V2 = Z2 ? h.sweepBipartite(S2, C2, R2, z, le, ce, q, me, ae, ue) : h.sweepBipartite(S2, C2, q, me, ae, ue, R2, z, le, ce)) !== void 0) return V2;
                    } else k(W2++, K2 + 1, q, me, R2, z, Z2, -1 / 0, 1 / 0), k(W2++, K2 + 1, R2, z, q, me, 1 ^ Z2, -1 / 0, 1 / 0);
                    if (me < re) {
                      var we = p(S2, K2, R2, z, le, ce), be = le[X2 * we + K2], Ae = m(S2, K2, we, z, le, ce, be);
                      if (Ae < z && k(W2++, K2, me, re, Ae, z, (4 | Z2) + (ne ? 16 : 0), be, Q2), R2 < we && k(W2++, K2, me, re, R2, we, (2 | Z2) + (ne ? 16 : 0), j, be), we + 1 === Ae) {
                        if ((V2 = ne ? A2(S2, K2, C2, me, re, ae, ue, we, le, ce[we]) : T2(S2, K2, C2, Z2, me, re, ae, ue, we, le, ce[we])) !== void 0) return V2;
                      } else if (we < Ae) {
                        var pe;
                        if (ne) {
                          if (pe = b(S2, K2, me, re, ae, ue, be), me < pe) {
                            var ve = m(S2, K2, me, pe, ae, ue, be);
                            if (K2 === S2 - 2) {
                              if (me < ve && (V2 = h.sweepComplete(S2, C2, me, ve, ae, ue, we, Ae, le, ce)) !== void 0 || ve < pe && (V2 = h.sweepBipartite(S2, C2, ve, pe, ae, ue, we, Ae, le, ce)) !== void 0) return V2;
                            } else me < ve && k(W2++, K2 + 1, me, ve, we, Ae, 16, -1 / 0, 1 / 0), ve < pe && (k(W2++, K2 + 1, ve, pe, we, Ae, 0, -1 / 0, 1 / 0), k(W2++, K2 + 1, we, Ae, ve, pe, 1, -1 / 0, 1 / 0));
                          }
                        } else pe = Z2 ? y(S2, K2, me, re, ae, ue, be) : b(S2, K2, me, re, ae, ue, be), me < pe && (K2 === S2 - 2 ? V2 = Z2 ? h.sweepBipartite(S2, C2, we, Ae, le, ce, me, pe, ae, ue) : h.sweepBipartite(S2, C2, me, pe, ae, ue, we, Ae, le, ce) : (k(W2++, K2 + 1, me, pe, we, Ae, Z2, -1 / 0, 1 / 0), k(W2++, K2 + 1, we, Ae, me, pe, 1 ^ Z2, -1 / 0, 1 / 0)));
                      }
                    }
                  }
                }
              };
              var i = a("typedarray-pool"), l = a("bit-twiddle"), u2 = a("./brute"), c = u2.partial, f = u2.full, h = a("./sweep"), p = a("./median"), d = a("./partition"), v = d("!(lo>=p0)&&!(p1>=hi)"), m = d("lo===p0"), g = d("lo<p0"), x = d("hi<=p0"), b = d("lo<=p0&&p0<=hi"), y = d("lo<p0&&p0<=hi"), w = i.mallocInt32(1024), _4 = i.mallocDouble(1024);
              function k(S2, C2, E2, F13, N2, D2, I2, O2, L2) {
                var V2 = 6 * S2;
                w[V2] = C2, w[V2 + 1] = E2, w[V2 + 2] = F13, w[V2 + 3] = N2, w[V2 + 4] = D2, w[V2 + 5] = I2;
                var W2 = 2 * S2;
                _4[W2] = O2, _4[W2 + 1] = L2;
              }
              function T2(S2, C2, E2, F13, N2, D2, I2, O2, L2, V2, W2) {
                var X2 = 2 * S2, Y2 = L2 * X2, K2 = V2[Y2 + C2];
                e: for (var q = N2, re = N2 * X2; q < D2; ++q, re += X2) {
                  var R2 = I2[re + C2], z = I2[re + C2 + S2];
                  if (!(K2 < R2 || z < K2) && (!F13 || K2 !== R2)) {
                    for (var H2, te = O2[q], j = C2 + 1; j < S2; ++j) {
                      R2 = I2[re + j], z = I2[re + j + S2];
                      var Q2 = V2[Y2 + j], Z2 = V2[Y2 + j + S2];
                      if (z < Q2 || Z2 < R2) continue e;
                    }
                    if ((H2 = F13 ? E2(W2, te) : E2(te, W2)) !== void 0) return H2;
                  }
                }
              }
              function A2(S2, C2, E2, F13, N2, D2, I2, O2, L2, V2) {
                var W2 = 2 * S2, X2 = O2 * W2, Y2 = L2[X2 + C2];
                e: for (var K2 = F13, q = F13 * W2; K2 < N2; ++K2, q += W2) {
                  var re = I2[K2];
                  if (re !== V2) {
                    var R2 = D2[q + C2], z = D2[q + C2 + S2];
                    if (!(Y2 < R2 || z < Y2)) {
                      for (var H2 = C2 + 1; H2 < S2; ++H2) {
                        R2 = D2[q + H2], z = D2[q + H2 + S2];
                        var te = L2[X2 + H2], j = L2[X2 + H2 + S2];
                        if (z < te || j < R2) continue e;
                      }
                      var Q2 = E2(re, V2);
                      if (Q2 !== void 0) return Q2;
                    }
                  }
                }
              }
            }, { "./brute": 36, "./median": 38, "./partition": 39, "./sweep": 41, "bit-twiddle": 32, "typedarray-pool": 308 }], 38: [function(a, o, s) {
              "use strict";
              o.exports = function(u2, c, f, h, p, d) {
                if (h <= f + 1) return f;
                for (var v = f, m = h, g = h + f >>> 1, x = 2 * u2, b = g, y = p[x * g + c]; v < m; ) {
                  if (m - v < 8) {
                    l(u2, c, v, m, p, d), y = p[x * g + c];
                    break;
                  }
                  var w = m - v, _4 = Math.random() * w + v | 0, k = p[x * _4 + c], T2 = Math.random() * w + v | 0, A2 = p[x * T2 + c], S2 = Math.random() * w + v | 0, C2 = p[x * S2 + c];
                  k <= A2 ? C2 >= A2 ? (b = T2, y = A2) : k >= C2 ? (b = _4, y = k) : (b = S2, y = C2) : A2 >= C2 ? (b = T2, y = A2) : C2 >= k ? (b = _4, y = k) : (b = S2, y = C2);
                  for (var E2 = x * (m - 1), F13 = x * b, N2 = 0; N2 < x; ++N2, ++E2, ++F13) {
                    var D2 = p[E2];
                    p[E2] = p[F13], p[F13] = D2;
                  }
                  var I2 = d[m - 1];
                  for (d[m - 1] = d[b], d[b] = I2, b = i(u2, c, v, m - 1, p, d, y), E2 = x * (m - 1), F13 = x * b, N2 = 0; N2 < x; ++N2, ++E2, ++F13) D2 = p[E2], p[E2] = p[F13], p[F13] = D2;
                  if (I2 = d[m - 1], d[m - 1] = d[b], d[b] = I2, g < b) {
                    for (m = b - 1; v < m && p[x * (m - 1) + c] === y; ) m -= 1;
                    m += 1;
                  } else {
                    if (!(b < g)) break;
                    for (v = b + 1; v < m && p[x * v + c] === y; ) v += 1;
                  }
                }
                return i(u2, c, f, g, p, d, p[x * g + c]);
              };
              var i = a("./partition")("lo<p0");
              function l(u2, c, f, h, p, d) {
                for (var v = 2 * u2, m = v * (f + 1) + c, g = f + 1; g < h; ++g, m += v) for (var x = p[m], b = g, y = v * (g - 1); b > f && p[y + c] > x; --b, y -= v) {
                  for (var w = y, _4 = y + v, k = 0; k < v; ++k, ++w, ++_4) {
                    var T2 = p[w];
                    p[w] = p[_4], p[_4] = T2;
                  }
                  var A2 = d[b];
                  d[b] = d[b - 1], d[b - 1] = A2;
                }
              }
            }, { "./partition": 39 }], 39: [function(a, o, s) {
              "use strict";
              o.exports = function(l) {
                return i[l];
              };
              var i = { "lo===p0": function(l, u2, c, f, h, p, d) {
                for (var v = 2 * l, m = v * c, g = m, x = c, b = u2, y = c; f > y; ++y, m += v) if (h[m + b] === d) if (x === y) x += 1, g += v;
                else {
                  for (var w = 0; v > w; ++w) {
                    var _4 = h[m + w];
                    h[m + w] = h[g], h[g++] = _4;
                  }
                  var k = p[y];
                  p[y] = p[x], p[x++] = k;
                }
                return x;
              }, "lo<p0": function(l, u2, c, f, h, p, d) {
                for (var v = 2 * l, m = v * c, g = m, x = c, b = u2, y = c; f > y; ++y, m += v) if (h[m + b] < d) if (x === y) x += 1, g += v;
                else {
                  for (var w = 0; v > w; ++w) {
                    var _4 = h[m + w];
                    h[m + w] = h[g], h[g++] = _4;
                  }
                  var k = p[y];
                  p[y] = p[x], p[x++] = k;
                }
                return x;
              }, "lo<=p0": function(l, u2, c, f, h, p, d) {
                for (var v = 2 * l, m = v * c, g = m, x = c, b = l + u2, y = c; f > y; ++y, m += v) if (h[m + b] <= d) if (x === y) x += 1, g += v;
                else {
                  for (var w = 0; v > w; ++w) {
                    var _4 = h[m + w];
                    h[m + w] = h[g], h[g++] = _4;
                  }
                  var k = p[y];
                  p[y] = p[x], p[x++] = k;
                }
                return x;
              }, "hi<=p0": function(l, u2, c, f, h, p, d) {
                for (var v = 2 * l, m = v * c, g = m, x = c, b = l + u2, y = c; f > y; ++y, m += v) if (h[m + b] <= d) if (x === y) x += 1, g += v;
                else {
                  for (var w = 0; v > w; ++w) {
                    var _4 = h[m + w];
                    h[m + w] = h[g], h[g++] = _4;
                  }
                  var k = p[y];
                  p[y] = p[x], p[x++] = k;
                }
                return x;
              }, "lo<p0&&p0<=hi": function(l, u2, c, f, h, p, d) {
                for (var v = 2 * l, m = v * c, g = m, x = c, b = u2, y = l + u2, w = c; f > w; ++w, m += v) {
                  var _4 = h[m + b], k = h[m + y];
                  if (_4 < d && d <= k) if (x === w) x += 1, g += v;
                  else {
                    for (var T2 = 0; v > T2; ++T2) {
                      var A2 = h[m + T2];
                      h[m + T2] = h[g], h[g++] = A2;
                    }
                    var S2 = p[w];
                    p[w] = p[x], p[x++] = S2;
                  }
                }
                return x;
              }, "lo<=p0&&p0<=hi": function(l, u2, c, f, h, p, d) {
                for (var v = 2 * l, m = v * c, g = m, x = c, b = u2, y = l + u2, w = c; f > w; ++w, m += v) {
                  var _4 = h[m + b], k = h[m + y];
                  if (_4 <= d && d <= k) if (x === w) x += 1, g += v;
                  else {
                    for (var T2 = 0; v > T2; ++T2) {
                      var A2 = h[m + T2];
                      h[m + T2] = h[g], h[g++] = A2;
                    }
                    var S2 = p[w];
                    p[w] = p[x], p[x++] = S2;
                  }
                }
                return x;
              }, "!(lo>=p0)&&!(p1>=hi)": function(l, u2, c, f, h, p, d, v) {
                for (var m = 2 * l, g = m * c, x = g, b = c, y = u2, w = l + u2, _4 = c; f > _4; ++_4, g += m) {
                  var k = h[g + y], T2 = h[g + w];
                  if (!(k >= d || v >= T2)) if (b === _4) b += 1, x += m;
                  else {
                    for (var A2 = 0; m > A2; ++A2) {
                      var S2 = h[g + A2];
                      h[g + A2] = h[x], h[x++] = S2;
                    }
                    var C2 = p[_4];
                    p[_4] = p[b], p[b++] = C2;
                  }
                }
                return b;
              } };
            }, {}], 40: [function(a, o, s) {
              "use strict";
              o.exports = function(d, v) {
                v <= 128 ? i(0, v - 1, d) : function m(g, x, b) {
                  var y = (x - g + 1) / 6 | 0, w = g + y, _4 = x - y, k = g + x >> 1, T2 = k - y, A2 = k + y, S2 = w, C2 = T2, E2 = k, F13 = A2, N2 = _4, D2 = g + 1, I2 = x - 1, O2 = 0;
                  h(S2, C2, b) && (O2 = S2, S2 = C2, C2 = O2), h(F13, N2, b) && (O2 = F13, F13 = N2, N2 = O2), h(S2, E2, b) && (O2 = S2, S2 = E2, E2 = O2), h(C2, E2, b) && (O2 = C2, C2 = E2, E2 = O2), h(S2, F13, b) && (O2 = S2, S2 = F13, F13 = O2), h(E2, F13, b) && (O2 = E2, E2 = F13, F13 = O2), h(C2, N2, b) && (O2 = C2, C2 = N2, N2 = O2), h(C2, E2, b) && (O2 = C2, C2 = E2, E2 = O2), h(F13, N2, b) && (O2 = F13, F13 = N2, N2 = O2);
                  for (var L2 = b[2 * C2], V2 = b[2 * C2 + 1], W2 = b[2 * F13], X2 = b[2 * F13 + 1], Y2 = 2 * S2, K2 = 2 * E2, q = 2 * N2, re = 2 * w, R2 = 2 * k, z = 2 * _4, H2 = 0; H2 < 2; ++H2) {
                    var te = b[Y2 + H2], j = b[K2 + H2], Q2 = b[q + H2];
                    b[re + H2] = te, b[R2 + H2] = j, b[z + H2] = Q2;
                  }
                  u2(T2, g, b), u2(A2, x, b);
                  for (var Z2 = D2; Z2 <= I2; ++Z2) if (p(Z2, L2, V2, b)) Z2 !== D2 && l(Z2, D2, b), ++D2;
                  else if (!p(Z2, W2, X2, b)) for (; ; ) {
                    if (p(I2, W2, X2, b)) {
                      p(I2, L2, V2, b) ? (c(Z2, D2, I2, b), ++D2, --I2) : (l(Z2, I2, b), --I2);
                      break;
                    }
                    if (--I2 < Z2) break;
                  }
                  f(g, D2 - 1, L2, V2, b), f(x, I2 + 1, W2, X2, b), D2 - 2 - g <= 32 ? i(g, D2 - 2, b) : m(g, D2 - 2, b), x - (I2 + 2) <= 32 ? i(I2 + 2, x, b) : m(I2 + 2, x, b), I2 - D2 <= 32 ? i(D2, I2, b) : m(D2, I2, b);
                }(0, v - 1, d);
              };
              function i(d, v, m) {
                for (var g = 2 * (d + 1), x = d + 1; x <= v; ++x) {
                  for (var b = m[g++], y = m[g++], w = x, _4 = g - 2; w-- > d; ) {
                    var k = m[_4 - 2], T2 = m[_4 - 1];
                    if (k < b || k === b && T2 < y) break;
                    m[_4] = k, m[_4 + 1] = T2, _4 -= 2;
                  }
                  m[_4] = b, m[_4 + 1] = y;
                }
              }
              function l(d, v, m) {
                v *= 2;
                var g = m[d *= 2], x = m[d + 1];
                m[d] = m[v], m[d + 1] = m[v + 1], m[v] = g, m[v + 1] = x;
              }
              function u2(d, v, m) {
                v *= 2, m[d *= 2] = m[v], m[d + 1] = m[v + 1];
              }
              function c(d, v, m, g) {
                v *= 2, m *= 2;
                var x = g[d *= 2], b = g[d + 1];
                g[d] = g[v], g[d + 1] = g[v + 1], g[v] = g[m], g[v + 1] = g[m + 1], g[m] = x, g[m + 1] = b;
              }
              function f(d, v, m, g, x) {
                v *= 2, x[d *= 2] = x[v], x[v] = m, x[d + 1] = x[v + 1], x[v + 1] = g;
              }
              function h(d, v, m) {
                v *= 2;
                var g = m[d *= 2], x = m[v];
                return !(g < x) && (g !== x || m[d + 1] > m[v + 1]);
              }
              function p(d, v, m, g) {
                var x = g[d *= 2];
                return x < v || x === v && g[d + 1] < m;
              }
            }, {}], 41: [function(a, o, s) {
              "use strict";
              o.exports = { init: function(b) {
                var y = l.nextPow2(b);
                c.length < y && (i.free(c), c = i.mallocInt32(y)), f.length < y && (i.free(f), f = i.mallocInt32(y)), h.length < y && (i.free(h), h = i.mallocInt32(y)), p.length < y && (i.free(p), p = i.mallocInt32(y)), d.length < y && (i.free(d), d = i.mallocInt32(y)), v.length < y && (i.free(v), v = i.mallocInt32(y));
                var w = 8 * y;
                m.length < w && (i.free(m), m = i.mallocDouble(w));
              }, sweepBipartite: function(b, y, w, _4, k, T2, A2, S2, C2, E2) {
                for (var F13 = 0, N2 = 2 * b, D2 = b - 1, I2 = N2 - 1, O2 = w; O2 < _4; ++O2) {
                  var L2 = T2[O2], V2 = N2 * O2;
                  m[F13++] = k[V2 + D2], m[F13++] = -(L2 + 1), m[F13++] = k[V2 + I2], m[F13++] = L2;
                }
                for (O2 = A2; O2 < S2; ++O2) {
                  L2 = E2[O2] + (1 << 28);
                  var W2 = N2 * O2;
                  m[F13++] = C2[W2 + D2], m[F13++] = -L2, m[F13++] = C2[W2 + I2], m[F13++] = L2;
                }
                var X2 = F13 >>> 1;
                u2(m, X2);
                var Y2 = 0, K2 = 0;
                for (O2 = 0; O2 < X2; ++O2) {
                  var q = 0 | m[2 * O2 + 1];
                  if (q >= 1 << 28) g(h, p, K2--, q = q - (1 << 28) | 0);
                  else if (q >= 0) g(c, f, Y2--, q);
                  else if (q <= -(1 << 28)) {
                    q = -q - (1 << 28) | 0;
                    for (var re = 0; re < Y2; ++re) if ((R2 = y(c[re], q)) !== void 0) return R2;
                    x(h, p, K2++, q);
                  } else {
                    for (q = -q - 1 | 0, re = 0; re < K2; ++re) {
                      var R2;
                      if ((R2 = y(q, h[re])) !== void 0) return R2;
                    }
                    x(c, f, Y2++, q);
                  }
                }
              }, sweepComplete: function(b, y, w, _4, k, T2, A2, S2, C2, E2) {
                for (var F13 = 0, N2 = 2 * b, D2 = b - 1, I2 = N2 - 1, O2 = w; O2 < _4; ++O2) {
                  var L2 = T2[O2] + 1 << 1, V2 = N2 * O2;
                  m[F13++] = k[V2 + D2], m[F13++] = -L2, m[F13++] = k[V2 + I2], m[F13++] = L2;
                }
                for (O2 = A2; O2 < S2; ++O2) {
                  L2 = E2[O2] + 1 << 1;
                  var W2 = N2 * O2;
                  m[F13++] = C2[W2 + D2], m[F13++] = 1 | -L2, m[F13++] = C2[W2 + I2], m[F13++] = 1 | L2;
                }
                var X2 = F13 >>> 1;
                u2(m, X2);
                var Y2 = 0, K2 = 0, q = 0;
                for (O2 = 0; O2 < X2; ++O2) {
                  var re = 0 | m[2 * O2 + 1], R2 = 1 & re;
                  if (O2 < X2 - 1 && re >> 1 == m[2 * O2 + 3] >> 1 && (R2 = 2, O2 += 1), re < 0) {
                    for (var z = -(re >> 1) - 1, H2 = 0; H2 < q; ++H2) if ((te = y(d[H2], z)) !== void 0) return te;
                    if (R2 !== 0) {
                      for (H2 = 0; H2 < Y2; ++H2) if ((te = y(c[H2], z)) !== void 0) return te;
                    }
                    if (R2 !== 1) for (H2 = 0; H2 < K2; ++H2) {
                      var te;
                      if ((te = y(h[H2], z)) !== void 0) return te;
                    }
                    R2 === 0 ? x(c, f, Y2++, z) : R2 === 1 ? x(h, p, K2++, z) : R2 === 2 && x(d, v, q++, z);
                  } else z = (re >> 1) - 1, R2 === 0 ? g(c, f, Y2--, z) : R2 === 1 ? g(h, p, K2--, z) : R2 === 2 && g(d, v, q--, z);
                }
              }, scanBipartite: function(b, y, w, _4, k, T2, A2, S2, C2, E2, F13, N2) {
                var D2 = 0, I2 = 2 * b, O2 = y, L2 = y + b, V2 = 1, W2 = 1;
                _4 ? W2 = 1 << 28 : V2 = 1 << 28;
                for (var X2 = k; X2 < T2; ++X2) {
                  var Y2 = X2 + V2, K2 = I2 * X2;
                  m[D2++] = A2[K2 + O2], m[D2++] = -Y2, m[D2++] = A2[K2 + L2], m[D2++] = Y2;
                }
                for (X2 = C2; X2 < E2; ++X2) {
                  Y2 = X2 + W2;
                  var q = I2 * X2;
                  m[D2++] = F13[q + O2], m[D2++] = -Y2;
                }
                var re = D2 >>> 1;
                u2(m, re);
                var R2 = 0;
                for (X2 = 0; X2 < re; ++X2) {
                  var z = 0 | m[2 * X2 + 1];
                  if (z < 0) {
                    var H2 = false;
                    if ((Y2 = -z) >= 1 << 28 ? (H2 = !_4, Y2 -= 1 << 28) : (H2 = !!_4, Y2 -= 1), H2) x(c, f, R2++, Y2);
                    else {
                      var te = N2[Y2], j = I2 * Y2, Q2 = F13[j + y + 1], Z2 = F13[j + y + 1 + b];
                      e: for (var ne = 0; ne < R2; ++ne) {
                        var ae = c[ne], ue = I2 * ae;
                        if (!(Z2 < A2[ue + y + 1] || A2[ue + y + 1 + b] < Q2)) {
                          for (var le = y + 2; le < b; ++le) if (F13[j + le + b] < A2[ue + le] || A2[ue + le + b] < F13[j + le]) continue e;
                          var ce, se = S2[ae];
                          if ((ce = _4 ? w(te, se) : w(se, te)) !== void 0) return ce;
                        }
                      }
                    }
                  } else g(c, f, R2--, z - V2);
                }
              }, scanComplete: function(b, y, w, _4, k, T2, A2, S2, C2, E2, F13) {
                for (var N2 = 0, D2 = 2 * b, I2 = y, O2 = y + b, L2 = _4; L2 < k; ++L2) {
                  var V2 = L2 + 268435456, W2 = D2 * L2;
                  m[N2++] = T2[W2 + I2], m[N2++] = -V2, m[N2++] = T2[W2 + O2], m[N2++] = V2;
                }
                for (L2 = S2; L2 < C2; ++L2) {
                  V2 = L2 + 1;
                  var X2 = D2 * L2;
                  m[N2++] = E2[X2 + I2], m[N2++] = -V2;
                }
                var Y2 = N2 >>> 1;
                u2(m, Y2);
                var K2 = 0;
                for (L2 = 0; L2 < Y2; ++L2) {
                  var q = 0 | m[2 * L2 + 1];
                  if (q < 0) if ((V2 = -q) >= 1 << 28) c[K2++] = V2 - (1 << 28);
                  else {
                    var re = F13[V2 -= 1], R2 = D2 * V2, z = E2[R2 + y + 1], H2 = E2[R2 + y + 1 + b];
                    e: for (var te = 0; te < K2; ++te) {
                      var j = c[te], Q2 = A2[j];
                      if (Q2 === re) break;
                      var Z2 = D2 * j;
                      if (!(H2 < T2[Z2 + y + 1] || T2[Z2 + y + 1 + b] < z)) {
                        for (var ne = y + 2; ne < b; ++ne) if (E2[R2 + ne + b] < T2[Z2 + ne] || T2[Z2 + ne + b] < E2[R2 + ne]) continue e;
                        var ae = w(Q2, re);
                        if (ae !== void 0) return ae;
                      }
                    }
                  }
                  else {
                    for (V2 = q - (1 << 28), te = K2 - 1; te >= 0; --te) if (c[te] === V2) {
                      for (ne = te + 1; ne < K2; ++ne) c[ne - 1] = c[ne];
                      break;
                    }
                    --K2;
                  }
                }
              } };
              var i = a("typedarray-pool"), l = a("bit-twiddle"), u2 = a("./sort"), c = i.mallocInt32(1024), f = i.mallocInt32(1024), h = i.mallocInt32(1024), p = i.mallocInt32(1024), d = i.mallocInt32(1024), v = i.mallocInt32(1024), m = i.mallocDouble(8192);
              function g(b, y, w, _4) {
                var k = y[_4], T2 = b[w - 1];
                b[k] = T2, y[T2] = k;
              }
              function x(b, y, w, _4) {
                b[w] = _4, y[_4] = w;
              }
            }, { "./sort": 40, "bit-twiddle": 32, "typedarray-pool": 308 }], 42: [function(a, o, s) {
              "use strict";
              var i = a("./lib/monotone"), l = a("./lib/triangulation"), u2 = a("./lib/delaunay"), c = a("./lib/filter");
              function f(d) {
                return [Math.min(d[0], d[1]), Math.max(d[0], d[1])];
              }
              function h(d, v) {
                return d[0] - v[0] || d[1] - v[1];
              }
              function p(d, v, m) {
                return v in d ? d[v] : m;
              }
              o.exports = function(d, v, m) {
                Array.isArray(v) ? (m = m || {}, v = v || []) : (m = v || {}, v = []);
                var g = !!p(m, "delaunay", true), x = !!p(m, "interior", true), b = !!p(m, "exterior", true), y = !!p(m, "infinity", false);
                if (!x && !b || d.length === 0) return [];
                var w = i(d, v);
                if (g || x !== b || y) {
                  for (var _4 = l(d.length, function(A2) {
                    return A2.map(f).sort(h);
                  }(v)), k = 0; k < w.length; ++k) {
                    var T2 = w[k];
                    _4.addTriangle(T2[0], T2[1], T2[2]);
                  }
                  return g && u2(d, _4), b ? x ? y ? c(_4, 0, y) : _4.cells() : c(_4, 1, y) : c(_4, -1);
                }
                return w;
              };
            }, { "./lib/delaunay": 43, "./lib/filter": 44, "./lib/monotone": 45, "./lib/triangulation": 46 }], 43: [function(a, o, s) {
              "use strict";
              var i = a("robust-in-sphere")[4];
              a("binary-search-bounds");
              function l(u2, c, f, h, p, d) {
                var v = c.opposite(h, p);
                if (!(v < 0)) {
                  if (p < h) {
                    var m = h;
                    h = p, p = m, m = d, d = v, v = m;
                  }
                  c.isConstraint(h, p) || i(u2[h], u2[p], u2[d], u2[v]) < 0 && f.push(h, p);
                }
              }
              o.exports = function(u2, c) {
                for (var f = [], h = u2.length, p = c.stars, d = 0; d < h; ++d) for (var v = p[d], m = 1; m < v.length; m += 2) if (!((y = v[m]) < d) && !c.isConstraint(d, y)) {
                  for (var g = v[m - 1], x = -1, b = 1; b < v.length; b += 2) if (v[b - 1] === y) {
                    x = v[b];
                    break;
                  }
                  x < 0 || i(u2[d], u2[y], u2[g], u2[x]) < 0 && f.push(d, y);
                }
                for (; f.length > 0; ) {
                  for (var y = f.pop(), w = (d = f.pop(), g = -1, x = -1, v = p[d], 1); w < v.length; w += 2) {
                    var _4 = v[w - 1], k = v[w];
                    _4 === y ? x = k : k === y && (g = _4);
                  }
                  g < 0 || x < 0 || i(u2[d], u2[y], u2[g], u2[x]) >= 0 || (c.flip(d, y), l(u2, c, f, g, d, x), l(u2, c, f, d, x, g), l(u2, c, f, x, y, g), l(u2, c, f, y, g, x));
                }
              };
            }, { "binary-search-bounds": 31, "robust-in-sphere": 282 }], 44: [function(a, o, s) {
              "use strict";
              var i, l = a("binary-search-bounds");
              function u2(f, h, p, d, v, m, g) {
                this.cells = f, this.neighbor = h, this.flags = d, this.constraint = p, this.active = v, this.next = m, this.boundary = g;
              }
              function c(f, h) {
                return f[0] - h[0] || f[1] - h[1] || f[2] - h[2];
              }
              o.exports = function(f, h, p) {
                var d = function(C2, E2) {
                  for (var F13 = C2.cells(), N2 = F13.length, D2 = 0; D2 < N2; ++D2) {
                    var I2 = (R2 = F13[D2])[0], O2 = R2[1], L2 = R2[2];
                    O2 < L2 ? O2 < I2 && (R2[0] = O2, R2[1] = L2, R2[2] = I2) : L2 < I2 && (R2[0] = L2, R2[1] = I2, R2[2] = O2);
                  }
                  F13.sort(c);
                  var V2 = new Array(N2);
                  for (D2 = 0; D2 < V2.length; ++D2) V2[D2] = 0;
                  var W2 = [], X2 = [], Y2 = new Array(3 * N2), K2 = new Array(3 * N2), q = null;
                  E2 && (q = []);
                  var re = new u2(F13, Y2, K2, V2, W2, X2, q);
                  for (D2 = 0; D2 < N2; ++D2) for (var R2 = F13[D2], z = 0; z < 3; ++z) {
                    I2 = R2[z], O2 = R2[(z + 1) % 3];
                    var H2 = Y2[3 * D2 + z] = re.locate(O2, I2, C2.opposite(O2, I2)), te = K2[3 * D2 + z] = C2.isConstraint(I2, O2);
                    H2 < 0 && (te ? X2.push(D2) : (W2.push(D2), V2[D2] = 1), E2 && q.push([O2, I2, -1]));
                  }
                  return re;
                }(f, p);
                if (h === 0) return p ? d.cells.concat(d.boundary) : d.cells;
                for (var v = 1, m = d.active, g = d.next, x = d.flags, b = d.cells, y = d.constraint, w = d.neighbor; m.length > 0 || g.length > 0; ) {
                  for (; m.length > 0; ) {
                    var _4 = m.pop();
                    if (x[_4] !== -v) {
                      x[_4] = v, b[_4];
                      for (var k = 0; k < 3; ++k) {
                        var T2 = w[3 * _4 + k];
                        T2 >= 0 && x[T2] === 0 && (y[3 * _4 + k] ? g.push(T2) : (m.push(T2), x[T2] = v));
                      }
                    }
                  }
                  var A2 = g;
                  g = m, m = A2, g.length = 0, v = -v;
                }
                var S2 = function(C2, E2, F13) {
                  for (var N2 = 0, D2 = 0; D2 < C2.length; ++D2) E2[D2] === F13 && (C2[N2++] = C2[D2]);
                  return C2.length = N2, C2;
                }(b, x, h);
                return p ? S2.concat(d.boundary) : S2;
              }, u2.prototype.locate = (i = [0, 0, 0], function(f, h, p) {
                var d = f, v = h, m = p;
                return h < p ? h < f && (d = h, v = p, m = f) : p < f && (d = p, v = f, m = h), d < 0 ? -1 : (i[0] = d, i[1] = v, i[2] = m, l.eq(this.cells, i, c));
              });
            }, { "binary-search-bounds": 31 }], 45: [function(a, o, s) {
              "use strict";
              var i = a("binary-search-bounds"), l = a("robust-orientation")[3];
              function u2(g, x, b, y, w) {
                this.a = g, this.b = x, this.idx = b, this.lowerIds = y, this.upperIds = w;
              }
              function c(g, x, b, y) {
                this.a = g, this.b = x, this.type = b, this.idx = y;
              }
              function f(g, x) {
                var b = g.a[0] - x.a[0] || g.a[1] - x.a[1] || g.type - x.type;
                return b || (g.type !== 0 && (b = l(g.a, g.b, x.b)) ? b : g.idx - x.idx);
              }
              function h(g, x) {
                return l(g.a, g.b, x);
              }
              function p(g, x, b, y, w) {
                for (var _4 = i.lt(x, y, h), k = i.gt(x, y, h), T2 = _4; T2 < k; ++T2) {
                  for (var A2 = x[T2], S2 = A2.lowerIds, C2 = S2.length; C2 > 1 && l(b[S2[C2 - 2]], b[S2[C2 - 1]], y) > 0; ) g.push([S2[C2 - 1], S2[C2 - 2], w]), C2 -= 1;
                  S2.length = C2, S2.push(w);
                  var E2 = A2.upperIds;
                  for (C2 = E2.length; C2 > 1 && l(b[E2[C2 - 2]], b[E2[C2 - 1]], y) < 0; ) g.push([E2[C2 - 2], E2[C2 - 1], w]), C2 -= 1;
                  E2.length = C2, E2.push(w);
                }
              }
              function d(g, x) {
                var b;
                return (b = g.a[0] < x.a[0] ? l(g.a, g.b, x.a) : l(x.b, x.a, g.a)) ? b : (b = x.b[0] < g.b[0] ? l(g.a, g.b, x.b) : l(x.b, x.a, g.b)) || g.idx - x.idx;
              }
              function v(g, x, b) {
                var y = i.le(g, b, d), w = g[y], _4 = w.upperIds, k = _4[_4.length - 1];
                w.upperIds = [k], g.splice(y + 1, 0, new u2(b.a, b.b, b.idx, [k], _4));
              }
              function m(g, x, b) {
                var y = b.a;
                b.a = b.b, b.b = y;
                var w = i.eq(g, b, d), _4 = g[w];
                g[w - 1].upperIds = _4.upperIds, g.splice(w, 1);
              }
              o.exports = function(g, x) {
                for (var b = g.length, y = x.length, w = [], _4 = 0; _4 < b; ++_4) w.push(new c(g[_4], null, 0, _4));
                for (_4 = 0; _4 < y; ++_4) {
                  var k = x[_4], T2 = g[k[0]], A2 = g[k[1]];
                  T2[0] < A2[0] ? w.push(new c(T2, A2, 2, _4), new c(A2, T2, 1, _4)) : T2[0] > A2[0] && w.push(new c(A2, T2, 2, _4), new c(T2, A2, 1, _4));
                }
                w.sort(f);
                for (var S2 = w[0].a[0] - (1 + Math.abs(w[0].a[0])) * Math.pow(2, -52), C2 = [new u2([S2, 1], [S2, 0], -1, [], [], [], [])], E2 = [], F13 = (_4 = 0, w.length); _4 < F13; ++_4) {
                  var N2 = w[_4], D2 = N2.type;
                  D2 === 0 ? p(E2, C2, g, N2.a, N2.idx) : D2 === 2 ? v(C2, g, N2) : m(C2, g, N2);
                }
                return E2;
              };
            }, { "binary-search-bounds": 31, "robust-orientation": 284 }], 46: [function(a, o, s) {
              "use strict";
              var i = a("binary-search-bounds");
              function l(f, h) {
                this.stars = f, this.edges = h;
              }
              o.exports = function(f, h) {
                for (var p = new Array(f), d = 0; d < f; ++d) p[d] = [];
                return new l(p, h);
              };
              var u2 = l.prototype;
              function c(f, h, p) {
                for (var d = 1, v = f.length; d < v; d += 2) if (f[d - 1] === h && f[d] === p) return f[d - 1] = f[v - 2], f[d] = f[v - 1], void (f.length = v - 2);
              }
              u2.isConstraint = /* @__PURE__ */ function() {
                var f = [0, 0];
                function h(p, d) {
                  return p[0] - d[0] || p[1] - d[1];
                }
                return function(p, d) {
                  return f[0] = Math.min(p, d), f[1] = Math.max(p, d), i.eq(this.edges, f, h) >= 0;
                };
              }(), u2.removeTriangle = function(f, h, p) {
                var d = this.stars;
                c(d[f], h, p), c(d[h], p, f), c(d[p], f, h);
              }, u2.addTriangle = function(f, h, p) {
                var d = this.stars;
                d[f].push(h, p), d[h].push(p, f), d[p].push(f, h);
              }, u2.opposite = function(f, h) {
                for (var p = this.stars[h], d = 1, v = p.length; d < v; d += 2) if (p[d] === f) return p[d - 1];
                return -1;
              }, u2.flip = function(f, h) {
                var p = this.opposite(f, h), d = this.opposite(h, f);
                this.removeTriangle(f, h, p), this.removeTriangle(h, f, d), this.addTriangle(f, d, p), this.addTriangle(h, p, d);
              }, u2.edges = function() {
                for (var f = this.stars, h = [], p = 0, d = f.length; p < d; ++p) for (var v = f[p], m = 0, g = v.length; m < g; m += 2) h.push([v[m], v[m + 1]]);
                return h;
              }, u2.cells = function() {
                for (var f = this.stars, h = [], p = 0, d = f.length; p < d; ++p) for (var v = f[p], m = 0, g = v.length; m < g; m += 2) {
                  var x = v[m], b = v[m + 1];
                  p < Math.min(x, b) && h.push([p, x, b]);
                }
                return h;
              };
            }, { "binary-search-bounds": 31 }], 47: [function(a, o, s) {
              "use strict";
              o.exports = function(i) {
                for (var l = 1, u2 = 1; u2 < i.length; ++u2) for (var c = 0; c < u2; ++c) if (i[u2] < i[c]) l = -l;
                else if (i[c] === i[u2]) return 0;
                return l;
              };
            }, {}], 48: [function(a, o, s) {
              "use strict";
              var i = a("dup"), l = a("robust-linear-solve");
              function u2(h, p) {
                for (var d = 0, v = h.length, m = 0; m < v; ++m) d += h[m] * p[m];
                return d;
              }
              function c(h) {
                var p = h.length;
                if (p === 0) return [];
                h[0].length;
                var d = i([h.length + 1, h.length + 1], 1), v = i([h.length + 1], 1);
                d[p][p] = 0;
                for (var m = 0; m < p; ++m) {
                  for (var g = 0; g <= m; ++g) d[g][m] = d[m][g] = 2 * u2(h[m], h[g]);
                  v[m] = u2(h[m], h[m]);
                }
                var x = l(d, v), b = 0, y = x[p + 1];
                for (m = 0; m < y.length; ++m) b += y[m];
                var w = new Array(p);
                for (m = 0; m < p; ++m) {
                  y = x[m];
                  var _4 = 0;
                  for (g = 0; g < y.length; ++g) _4 += y[g];
                  w[m] = _4 / b;
                }
                return w;
              }
              function f(h) {
                if (h.length === 0) return [];
                for (var p = h[0].length, d = i([p]), v = c(h), m = 0; m < h.length; ++m) for (var g = 0; g < p; ++g) d[g] += h[m][g] * v[m];
                return d;
              }
              f.barycenetric = c, o.exports = f;
            }, { dup: 65, "robust-linear-solve": 283 }], 49: [function(a, o, s) {
              o.exports = function(l) {
                for (var u2 = i(l), c = 0, f = 0; f < l.length; ++f) for (var h = l[f], p = 0; p < u2.length; ++p) c += Math.pow(h[p] - u2[p], 2);
                return Math.sqrt(c / l.length);
              };
              var i = a("circumcenter");
            }, { circumcenter: 48 }], 50: [function(a, o, s) {
              "use strict";
              o.exports = function(k, T2, A2) {
                var S2;
                if (A2) {
                  S2 = T2;
                  for (var C2 = new Array(T2.length), E2 = 0; E2 < T2.length; ++E2) {
                    var F13 = T2[E2];
                    C2[E2] = [F13[0], F13[1], A2[E2]];
                  }
                  T2 = C2;
                }
                for (var N2 = function(D2, I2, O2) {
                  var L2 = x(D2, [], g(D2));
                  return w(I2, L2, O2), !!L2;
                }(k, T2, !!A2); _4(k, T2, !!A2); ) N2 = true;
                if (A2 && N2) for (S2.length = 0, A2.length = 0, E2 = 0; E2 < T2.length; ++E2) F13 = T2[E2], S2.push([F13[0], F13[1]]), A2.push(F13[2]);
                return N2;
              };
              var i = a("union-find"), l = a("box-intersect"), u2 = a("robust-segment-intersect"), c = a("big-rat"), f = a("big-rat/cmp"), h = a("big-rat/to-float"), p = a("rat-vec"), d = a("nextafter"), v = a("./lib/rat-seg-intersect");
              function m(k) {
                var T2 = h(k);
                return [d(T2, -1 / 0), d(T2, 1 / 0)];
              }
              function g(k) {
                for (var T2 = new Array(k.length), A2 = 0; A2 < k.length; ++A2) {
                  var S2 = k[A2];
                  T2[A2] = [d(S2[0], -1 / 0), d(S2[1], -1 / 0), d(S2[0], 1 / 0), d(S2[1], 1 / 0)];
                }
                return T2;
              }
              function x(k, T2, A2) {
                for (var S2 = T2.length, C2 = new i(S2), E2 = [], F13 = 0; F13 < T2.length; ++F13) {
                  var N2 = T2[F13], D2 = m(N2[0]), I2 = m(N2[1]);
                  E2.push([d(D2[0], -1 / 0), d(I2[0], -1 / 0), d(D2[1], 1 / 0), d(I2[1], 1 / 0)]);
                }
                l(E2, function(X2, Y2) {
                  C2.link(X2, Y2);
                });
                var O2 = true, L2 = new Array(S2);
                for (F13 = 0; F13 < S2; ++F13) (W2 = C2.find(F13)) !== F13 && (O2 = false, k[W2] = [Math.min(k[F13][0], k[W2][0]), Math.min(k[F13][1], k[W2][1])]);
                if (O2) return null;
                var V2 = 0;
                for (F13 = 0; F13 < S2; ++F13) {
                  var W2;
                  (W2 = C2.find(F13)) === F13 ? (L2[F13] = V2, k[V2++] = k[F13]) : L2[F13] = -1;
                }
                for (k.length = V2, F13 = 0; F13 < S2; ++F13) L2[F13] < 0 && (L2[F13] = L2[C2.find(F13)]);
                return L2;
              }
              function b(k, T2) {
                return k[0] - T2[0] || k[1] - T2[1];
              }
              function y(k, T2) {
                var A2 = k[0] - T2[0] || k[1] - T2[1];
                return A2 || (k[2] < T2[2] ? -1 : k[2] > T2[2] ? 1 : 0);
              }
              function w(k, T2, A2) {
                if (k.length !== 0) {
                  if (T2) for (var S2 = 0; S2 < k.length; ++S2) {
                    var C2 = T2[(F13 = k[S2])[0]], E2 = T2[F13[1]];
                    F13[0] = Math.min(C2, E2), F13[1] = Math.max(C2, E2);
                  }
                  else for (S2 = 0; S2 < k.length; ++S2) {
                    var F13;
                    C2 = (F13 = k[S2])[0], E2 = F13[1], F13[0] = Math.min(C2, E2), F13[1] = Math.max(C2, E2);
                  }
                  A2 ? k.sort(y) : k.sort(b);
                  var N2 = 1;
                  for (S2 = 1; S2 < k.length; ++S2) {
                    var D2 = k[S2 - 1], I2 = k[S2];
                    (I2[0] !== D2[0] || I2[1] !== D2[1] || A2 && I2[2] !== D2[2]) && (k[N2++] = I2);
                  }
                  k.length = N2;
                }
              }
              function _4(k, T2, A2) {
                var S2 = function(D2, I2) {
                  for (var O2 = new Array(I2.length), L2 = 0; L2 < I2.length; ++L2) {
                    var V2 = I2[L2], W2 = D2[V2[0]], X2 = D2[V2[1]];
                    O2[L2] = [d(Math.min(W2[0], X2[0]), -1 / 0), d(Math.min(W2[1], X2[1]), -1 / 0), d(Math.max(W2[0], X2[0]), 1 / 0), d(Math.max(W2[1], X2[1]), 1 / 0)];
                  }
                  return O2;
                }(k, T2), C2 = function(D2, I2, O2) {
                  var L2 = [];
                  return l(O2, function(V2, W2) {
                    var X2 = I2[V2], Y2 = I2[W2];
                    if (X2[0] !== Y2[0] && X2[0] !== Y2[1] && X2[1] !== Y2[0] && X2[1] !== Y2[1]) {
                      var K2 = D2[X2[0]], q = D2[X2[1]], re = D2[Y2[0]], R2 = D2[Y2[1]];
                      u2(K2, q, re, R2) && L2.push([V2, W2]);
                    }
                  }), L2;
                }(k, T2, S2), E2 = g(k), F13 = function(D2, I2, O2, L2) {
                  var V2 = [];
                  return l(O2, L2, function(W2, X2) {
                    var Y2 = I2[W2];
                    if (Y2[0] !== X2 && Y2[1] !== X2) {
                      var K2 = D2[X2], q = D2[Y2[0]], re = D2[Y2[1]];
                      u2(q, re, K2, K2) && V2.push([W2, X2]);
                    }
                  }), V2;
                }(k, T2, S2, E2), N2 = x(k, function(D2, I2, O2, L2, V2) {
                  var W2, X2, Y2 = D2.map(function(he) {
                    return [c(he[0]), c(he[1])];
                  });
                  for (W2 = 0; W2 < O2.length; ++W2) {
                    var K2 = O2[W2];
                    X2 = K2[0];
                    var q = K2[1], re = I2[X2], R2 = I2[q], z = v(p(D2[re[0]]), p(D2[re[1]]), p(D2[R2[0]]), p(D2[R2[1]]));
                    if (z) {
                      var H2 = D2.length;
                      D2.push([h(z[0]), h(z[1])]), Y2.push(z), L2.push([X2, H2], [q, H2]);
                    }
                  }
                  for (L2.sort(function(he, me) {
                    if (he[0] !== me[0]) return he[0] - me[0];
                    var we = Y2[he[1]], be = Y2[me[1]];
                    return f(we[0], be[0]) || f(we[1], be[1]);
                  }), W2 = L2.length - 1; W2 >= 0; --W2) {
                    var te = I2[X2 = (ce = L2[W2])[0]], j = te[0], Q2 = te[1], Z2 = D2[j], ne = D2[Q2];
                    if ((Z2[0] - ne[0] || Z2[1] - ne[1]) < 0) {
                      var ae = j;
                      j = Q2, Q2 = ae;
                    }
                    te[0] = j;
                    var ue, le = te[1] = ce[1];
                    for (V2 && (ue = te[2]); W2 > 0 && L2[W2 - 1][0] === X2; ) {
                      var ce, se = (ce = L2[--W2])[1];
                      V2 ? I2.push([le, se, ue]) : I2.push([le, se]), le = se;
                    }
                    V2 ? I2.push([le, Q2, ue]) : I2.push([le, Q2]);
                  }
                  return Y2;
                }(k, T2, C2, F13, A2));
                return w(T2, N2, A2), !!N2 || C2.length > 0 || F13.length > 0;
              }
            }, { "./lib/rat-seg-intersect": 51, "big-rat": 18, "big-rat/cmp": 16, "big-rat/to-float": 30, "box-intersect": 35, nextafter: 260, "rat-vec": 273, "robust-segment-intersect": 287, "union-find": 309 }], 51: [function(a, o, s) {
              "use strict";
              o.exports = function(v, m, g, x) {
                var b = f(m, v), y = f(x, g), w = d(b, y);
                if (c(w) === 0) return null;
                var _4 = f(v, g), k = d(y, _4), T2 = l(k, w), A2 = p(b, T2);
                return h(v, A2);
              };
              var i = a("big-rat/mul"), l = a("big-rat/div"), u2 = a("big-rat/sub"), c = a("big-rat/sign"), f = a("rat-vec/sub"), h = a("rat-vec/add"), p = a("rat-vec/muls");
              function d(v, m) {
                return u2(i(v[0], m[1]), i(v[1], m[0]));
              }
            }, { "big-rat/div": 17, "big-rat/mul": 27, "big-rat/sign": 28, "big-rat/sub": 29, "rat-vec/add": 272, "rat-vec/muls": 274, "rat-vec/sub": 275 }], 52: [function(a, o, s) {
              o.exports = { 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] }], 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] }], 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] }], spring: [{ index: 0, rgb: [255, 0, 255] }, { index: 1, rgb: [255, 255, 0] }], summer: [{ index: 0, rgb: [0, 128, 102] }, { index: 1, rgb: [255, 255, 102] }], autumn: [{ index: 0, rgb: [255, 0, 0] }, { index: 1, rgb: [255, 255, 0] }], winter: [{ index: 0, rgb: [0, 0, 255] }, { index: 1, rgb: [0, 255, 128] }], 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] }], copper: [{ index: 0, rgb: [0, 0, 0] }, { index: 0.804, rgb: [255, 160, 102] }, { index: 1, rgb: [255, 199, 127] }], greys: [{ index: 0, rgb: [0, 0, 0] }, { index: 1, rgb: [255, 255, 255] }], 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] }], 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] }], 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] }], bluered: [{ index: 0, rgb: [0, 0, 255] }, { index: 1, rgb: [255, 0, 0] }], 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] }], 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] }], 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] }], 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] }], 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] }], 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] }], 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] }], alpha: [{ index: 0, rgb: [255, 255, 255, 0] }, { index: 1, rgb: [255, 255, 255, 1] }], 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] }], 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] }], 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] }], 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] }], 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] }], 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] }], "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] }], 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] }], 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] }], 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] }], 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] }], "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] }], "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] }], 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] }], 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] }], 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] }], 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] }], 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] }], 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] }], "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] }], "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] }], 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] }] };
            }, {}], 53: [function(a, o, s) {
              "use strict";
              var i = a("./colorScale"), l = a("lerp");
              function u2(h) {
                return [h[0] / 255, h[1] / 255, h[2] / 255, h[3]];
              }
              function c(h) {
                for (var p, d = "#", v = 0; v < 3; ++v) d += ("00" + (p = (p = h[v]).toString(16))).substr(p.length);
                return d;
              }
              function f(h) {
                return "rgba(" + h.join(",") + ")";
              }
              o.exports = function(h) {
                var p, d, v, m, g, x, b, y, w, _4;
                if (h || (h = {}), y = (h.nshades || 72) - 1, b = h.format || "hex", (x = h.colormap) || (x = "jet"), typeof x == "string") {
                  if (x = x.toLowerCase(), !i[x]) throw Error(x + " not a supported colorscale");
                  g = i[x];
                } else {
                  if (!Array.isArray(x)) throw Error("unsupported colormap option", x);
                  g = x.slice();
                }
                if (g.length > y + 1) throw new Error(x + " map requires nshades to be at least size " + g.length);
                w = Array.isArray(h.alpha) ? h.alpha.length !== 2 ? [1, 1] : h.alpha.slice() : typeof h.alpha == "number" ? [h.alpha, h.alpha] : [1, 1], p = g.map(function(C2) {
                  return Math.round(C2.index * y);
                }), w[0] = Math.min(Math.max(w[0], 0), 1), w[1] = Math.min(Math.max(w[1], 0), 1);
                var k = g.map(function(C2, E2) {
                  var F13 = g[E2].index, N2 = g[E2].rgb.slice();
                  return N2.length === 4 && N2[3] >= 0 && N2[3] <= 1 || (N2[3] = w[0] + (w[1] - w[0]) * F13), N2;
                }), T2 = [];
                for (_4 = 0; _4 < p.length - 1; ++_4) {
                  m = p[_4 + 1] - p[_4], d = k[_4], v = k[_4 + 1];
                  for (var A2 = 0; A2 < m; A2++) {
                    var S2 = A2 / m;
                    T2.push([Math.round(l(d[0], v[0], S2)), Math.round(l(d[1], v[1], S2)), Math.round(l(d[2], v[2], S2)), l(d[3], v[3], S2)]);
                  }
                }
                return T2.push(g[g.length - 1].rgb.concat(w[1])), b === "hex" ? T2 = T2.map(c) : b === "rgbaString" ? T2 = T2.map(f) : b === "float" && (T2 = T2.map(u2)), T2;
              };
            }, { "./colorScale": 52, lerp: 240 }], 54: [function(a, o, s) {
              "use strict";
              o.exports = function(p, d, v, m) {
                var g = i(d, v, m);
                if (g === 0) {
                  var x = l(i(p, d, v)), b = l(i(p, d, m));
                  if (x === b) {
                    if (x === 0) {
                      var y = h(p, d, v), w = h(p, d, m);
                      return y === w ? 0 : y ? 1 : -1;
                    }
                    return 0;
                  }
                  return b === 0 ? x > 0 || h(p, d, m) ? -1 : 1 : x === 0 ? b > 0 || h(p, d, v) ? 1 : -1 : l(b - x);
                }
                var _4 = i(p, d, v);
                return _4 > 0 ? g > 0 && i(p, d, m) > 0 ? 1 : -1 : _4 < 0 ? g > 0 || i(p, d, m) > 0 ? 1 : -1 : i(p, d, m) > 0 || h(p, d, v) ? 1 : -1;
              };
              var i = a("robust-orientation"), l = a("signum"), u2 = a("two-sum"), c = a("robust-product"), f = a("robust-sum");
              function h(p, d, v) {
                var m = u2(p[0], -d[0]), g = u2(p[1], -d[1]), x = u2(v[0], -d[0]), b = u2(v[1], -d[1]), y = f(c(m, x), c(g, b));
                return y[y.length - 1] >= 0;
              }
            }, { "robust-orientation": 284, "robust-product": 285, "robust-sum": 289, signum: 55, "two-sum": 307 }], 55: [function(a, o, s) {
              "use strict";
              o.exports = function(i) {
                return i < 0 ? -1 : i > 0 ? 1 : 0;
              };
            }, {}], 56: [function(a, o, s) {
              o.exports = function(u2, c) {
                var f = u2.length, h = u2.length - c.length;
                if (h) return h;
                switch (f) {
                  case 0:
                    return 0;
                  case 1:
                    return u2[0] - c[0];
                  case 2:
                    return u2[0] + u2[1] - c[0] - c[1] || i(u2[0], u2[1]) - i(c[0], c[1]);
                  case 3:
                    var p = u2[0] + u2[1], d = c[0] + c[1];
                    if (h = p + u2[2] - (d + c[2])) return h;
                    var v = i(u2[0], u2[1]), m = i(c[0], c[1]);
                    return i(v, u2[2]) - i(m, c[2]) || i(v + u2[2], p) - i(m + c[2], d);
                  case 4:
                    var g = u2[0], x = u2[1], b = u2[2], y = u2[3], w = c[0], _4 = c[1], k = c[2], T2 = c[3];
                    return g + x + b + y - (w + _4 + k + T2) || i(g, x, b, y) - i(w, _4, k, T2, w) || i(g + x, g + b, g + y, x + b, x + y, b + y) - i(w + _4, w + k, w + T2, _4 + k, _4 + T2, k + T2) || i(g + x + b, g + x + y, g + b + y, x + b + y) - i(w + _4 + k, w + _4 + T2, w + k + T2, _4 + k + T2);
                  default:
                    for (var A2 = u2.slice().sort(l), S2 = c.slice().sort(l), C2 = 0; C2 < f; ++C2) if (h = A2[C2] - S2[C2]) return h;
                    return 0;
                }
              };
              var i = Math.min;
              function l(u2, c) {
                return u2 - c;
              }
            }, {}], 57: [function(a, o, s) {
              "use strict";
              var i = a("compare-cell"), l = a("cell-orientation");
              o.exports = function(u2, c) {
                return i(u2, c) || l(u2) - l(c);
              };
            }, { "cell-orientation": 47, "compare-cell": 56 }], 58: [function(a, o, s) {
              "use strict";
              var i = a("./lib/ch1d"), l = a("./lib/ch2d"), u2 = a("./lib/chnd");
              o.exports = function(c) {
                var f = c.length;
                if (f === 0) return [];
                if (f === 1) return [[0]];
                var h = c[0].length;
                return h === 0 ? [] : h === 1 ? i(c) : h === 2 ? l(c) : u2(c, h);
              };
            }, { "./lib/ch1d": 59, "./lib/ch2d": 60, "./lib/chnd": 61 }], 59: [function(a, o, s) {
              "use strict";
              o.exports = function(i) {
                for (var l = 0, u2 = 0, c = 1; c < i.length; ++c) i[c][0] < i[l][0] && (l = c), i[c][0] > i[u2][0] && (u2 = c);
                return l < u2 ? [[l], [u2]] : l > u2 ? [[u2], [l]] : [[l]];
              };
            }, {}], 60: [function(a, o, s) {
              "use strict";
              o.exports = function(l) {
                var u2 = i(l), c = u2.length;
                if (c <= 2) return [];
                for (var f = new Array(c), h = u2[c - 1], p = 0; p < c; ++p) {
                  var d = u2[p];
                  f[p] = [h, d], h = d;
                }
                return f;
              };
              var i = a("monotone-convex-hull-2d");
            }, { "monotone-convex-hull-2d": 246 }], 61: [function(a, o, s) {
              "use strict";
              o.exports = function(u2, c) {
                try {
                  return i(u2, true);
                } catch {
                  var f = l(u2);
                  if (f.length <= c) return [];
                  var h = function(d, v) {
                    for (var m = d.length, g = new Array(m), x = 0; x < v.length; ++x) g[x] = d[v[x]];
                    var b = v.length;
                    for (x = 0; x < m; ++x) v.indexOf(x) < 0 && (g[b++] = d[x]);
                    return g;
                  }(u2, f);
                  return function(d, v) {
                    for (var m = d.length, g = v.length, x = 0; x < m; ++x) for (var b = d[x], y = 0; y < b.length; ++y) {
                      var w = b[y];
                      if (w < g) b[y] = v[w];
                      else {
                        w -= g;
                        for (var _4 = 0; _4 < g; ++_4) w >= v[_4] && (w += 1);
                        b[y] = w;
                      }
                    }
                    return d;
                  }(i(h, true), f);
                }
              };
              var i = a("incremental-convex-hull"), l = a("affine-hull");
            }, { "affine-hull": 10, "incremental-convex-hull": 233 }], 62: [function(a, o, s) {
              "use strict";
              o.exports = function(i, l, u2, c, f, h) {
                var p = f - 1, d = f * f, v = p * p, m = (1 + 2 * f) * v, g = f * v, x = d * (3 - 2 * f), b = d * p;
                if (i.length) {
                  h || (h = new Array(i.length));
                  for (var y = i.length - 1; y >= 0; --y) h[y] = m * i[y] + g * l[y] + x * u2[y] + b * c[y];
                  return h;
                }
                return m * i + g * l + x * u2 + b * c;
              }, o.exports.derivative = function(i, l, u2, c, f, h) {
                var p = 6 * f * f - 6 * f, d = 3 * f * f - 4 * f + 1, v = -6 * f * f + 6 * f, m = 3 * f * f - 2 * f;
                if (i.length) {
                  h || (h = new Array(i.length));
                  for (var g = i.length - 1; g >= 0; --g) h[g] = p * i[g] + d * l[g] + v * u2[g] + m * c[g];
                  return h;
                }
                return p * i + d * l + v * u2[g] + m * c;
              };
            }, {}], 63: [function(a, o, s) {
              "use strict";
              var i = a("incremental-convex-hull"), l = a("uniq");
              function u2(f, h) {
                this.point = f, this.index = h;
              }
              function c(f, h) {
                for (var p = f.point, d = h.point, v = p.length, m = 0; m < v; ++m) {
                  var g = d[m] - p[m];
                  if (g) return g;
                }
                return 0;
              }
              o.exports = function(f, h) {
                var p = f.length;
                if (p === 0) return [];
                var d = f[0].length;
                if (d < 1) return [];
                if (d === 1) return function(F13, N2, D2) {
                  if (F13 === 1) return D2 ? [[-1, 0]] : [];
                  var I2 = N2.map(function(X2, Y2) {
                    return [X2[0], Y2];
                  });
                  I2.sort(function(X2, Y2) {
                    return X2[0] - Y2[0];
                  });
                  for (var O2 = new Array(F13 - 1), L2 = 1; L2 < F13; ++L2) {
                    var V2 = I2[L2 - 1], W2 = I2[L2];
                    O2[L2 - 1] = [V2[1], W2[1]];
                  }
                  return D2 && O2.push([-1, O2[0][1]], [O2[F13 - 1][1], -1]), O2;
                }(p, f, h);
                for (var v = new Array(p), m = 1, g = 0; g < p; ++g) {
                  for (var x = f[g], b = new Array(d + 1), y = 0, w = 0; w < d; ++w) {
                    var _4 = x[w];
                    b[w] = _4, y += _4 * _4;
                  }
                  b[d] = y, v[g] = new u2(b, g), m = Math.max(y, m);
                }
                l(v, c), p = v.length;
                var k = new Array(p + d + 1), T2 = new Array(p + d + 1), A2 = (d + 1) * (d + 1) * m, S2 = new Array(d + 1);
                for (g = 0; g <= d; ++g) S2[g] = 0;
                for (S2[d] = A2, k[0] = S2.slice(), T2[0] = -1, g = 0; g <= d; ++g) (b = S2.slice())[g] = 1, k[g + 1] = b, T2[g + 1] = -1;
                for (g = 0; g < p; ++g) {
                  var C2 = v[g];
                  k[g + d + 1] = C2.point, T2[g + d + 1] = C2.index;
                }
                var E2 = i(k, false);
                if (E2 = h ? E2.filter(function(F13) {
                  for (var N2 = 0, D2 = 0; D2 <= d; ++D2) {
                    var I2 = T2[F13[D2]];
                    if (I2 < 0 && ++N2 >= 2) return false;
                    F13[D2] = I2;
                  }
                  return true;
                }) : E2.filter(function(F13) {
                  for (var N2 = 0; N2 <= d; ++N2) {
                    var D2 = T2[F13[N2]];
                    if (D2 < 0) return false;
                    F13[N2] = D2;
                  }
                  return true;
                }), 1 & d) for (g = 0; g < E2.length; ++g) b = (C2 = E2[g])[0], C2[0] = C2[1], C2[1] = b;
                return E2;
              };
            }, { "incremental-convex-hull": 233, uniq: 310 }], 64: [function(a, o, s) {
              (function(i) {
                (function() {
                  var l = false;
                  if (typeof Float64Array < "u") {
                    var u2 = new Float64Array(1), c = new Uint32Array(u2.buffer);
                    u2[0] = 1, l = true, c[1] === 1072693248 ? (o.exports = function(h) {
                      return u2[0] = h, [c[0], c[1]];
                    }, o.exports.pack = function(h, p) {
                      return c[0] = h, c[1] = p, u2[0];
                    }, o.exports.lo = function(h) {
                      return u2[0] = h, c[0];
                    }, o.exports.hi = function(h) {
                      return u2[0] = h, c[1];
                    }) : c[0] === 1072693248 ? (o.exports = function(h) {
                      return u2[0] = h, [c[1], c[0]];
                    }, o.exports.pack = function(h, p) {
                      return c[1] = h, c[0] = p, u2[0];
                    }, o.exports.lo = function(h) {
                      return u2[0] = h, c[1];
                    }, o.exports.hi = function(h) {
                      return u2[0] = h, c[0];
                    }) : l = false;
                  }
                  if (!l) {
                    var f = new i(8);
                    o.exports = function(h) {
                      return f.writeDoubleLE(h, 0, true), [f.readUInt32LE(0, true), f.readUInt32LE(4, true)];
                    }, o.exports.pack = function(h, p) {
                      return f.writeUInt32LE(h, 0, true), f.writeUInt32LE(p, 4, true), f.readDoubleLE(0, true);
                    }, o.exports.lo = function(h) {
                      return f.writeDoubleLE(h, 0, true), f.readUInt32LE(0, true);
                    }, o.exports.hi = function(h) {
                      return f.writeDoubleLE(h, 0, true), f.readUInt32LE(4, true);
                    };
                  }
                  o.exports.sign = function(h) {
                    return o.exports.hi(h) >>> 31;
                  }, o.exports.exponent = function(h) {
                    return (o.exports.hi(h) << 1 >>> 21) - 1023;
                  }, o.exports.fraction = function(h) {
                    var p = o.exports.lo(h), d = o.exports.hi(h), v = 1048575 & d;
                    return 2146435072 & d && (v += 1 << 20), [p, v];
                  }, o.exports.denormalized = function(h) {
                    return !(2146435072 & o.exports.hi(h));
                  };
                }).call(this);
              }).call(this, a("buffer").Buffer);
            }, { buffer: 3 }], 65: [function(a, o, s) {
              "use strict";
              o.exports = function(i, l) {
                switch (l === void 0 && (l = 0), typeof i) {
                  case "number":
                    if (i > 0) return function(u2, c) {
                      var f, h;
                      for (f = new Array(u2), h = 0; h < u2; ++h) f[h] = c;
                      return f;
                    }(0 | i, l);
                    break;
                  case "object":
                    if (typeof i.length == "number") return function u2(c, f, h) {
                      var p = 0 | c[h];
                      if (p <= 0) return [];
                      var d, v = new Array(p);
                      if (h === c.length - 1) for (d = 0; d < p; ++d) v[d] = f;
                      else for (d = 0; d < p; ++d) v[d] = u2(c, f, h + 1);
                      return v;
                    }(i, l, 0);
                }
                return [];
              };
            }, {}], 66: [function(a, o, s) {
              "use strict";
              o.exports = function(l, u2) {
                var c = l.length;
                if (typeof u2 != "number") {
                  u2 = 0;
                  for (var f = 0; f < c; ++f) {
                    var h = l[f];
                    u2 = Math.max(u2, h[0], h[1]);
                  }
                  u2 = 1 + (0 | u2);
                }
                u2 |= 0;
                var p = new Array(u2);
                for (f = 0; f < u2; ++f) p[f] = [];
                for (f = 0; f < c; ++f) h = l[f], p[h[0]].push(h[1]), p[h[1]].push(h[0]);
                for (var d = 0; d < u2; ++d) i(p[d], function(v, m) {
                  return v - m;
                });
                return p;
              };
              var i = a("uniq");
            }, { uniq: 310 }], 67: [function(a, o, s) {
              "use strict";
              o.exports = function(i, l, u2) {
                var c = l || 0, f = u2 || 1;
                return [[i[12] + i[0], i[13] + i[1], i[14] + i[2], i[15] + i[3]], [i[12] - i[0], i[13] - i[1], i[14] - i[2], i[15] - i[3]], [i[12] + i[4], i[13] + i[5], i[14] + i[6], i[15] + i[7]], [i[12] - i[4], i[13] - i[5], i[14] - i[6], i[15] - i[7]], [c * i[12] + i[8], c * i[13] + i[9], c * i[14] + i[10], c * i[15] + i[11]], [f * i[12] - i[8], f * i[13] - i[9], f * i[14] - i[10], f * i[15] - i[11]]];
              };
            }, {}], 68: [function(a, o, s) {
              "use strict";
              o.exports = function(p, d, v) {
                switch (arguments.length) {
                  case 0:
                    return new c([0], [0], 0);
                  case 1:
                    return typeof p == "number" ? new c(m = h(p), m, 0) : new c(p, h(p.length), 0);
                  case 2:
                    if (typeof d == "number") {
                      var m = h(p.length);
                      return new c(p, m, +d);
                    }
                    v = 0;
                  case 3:
                    if (p.length !== d.length) throw new Error("state and velocity lengths must match");
                    return new c(p, d, v);
                }
              };
              var i = a("cubic-hermite"), l = a("binary-search-bounds");
              function u2(p, d, v) {
                return Math.min(d, Math.max(p, v));
              }
              function c(p, d, v) {
                this.dimension = p.length, this.bounds = [new Array(this.dimension), new Array(this.dimension)];
                for (var m = 0; m < this.dimension; ++m) this.bounds[0][m] = -1 / 0, this.bounds[1][m] = 1 / 0;
                this._state = p.slice().reverse(), this._velocity = d.slice().reverse(), this._time = [v], this._scratch = [p.slice(), p.slice(), p.slice(), p.slice(), p.slice()];
              }
              var f = c.prototype;
              function h(p) {
                for (var d = new Array(p), v = 0; v < p; ++v) d[v] = 0;
                return d;
              }
              f.flush = function(p) {
                var d = l.gt(this._time, p) - 1;
                d <= 0 || (this._time.splice(0, d), this._state.splice(0, d * this.dimension), this._velocity.splice(0, d * this.dimension));
              }, f.curve = function(p) {
                var d = this._time, v = d.length, m = l.le(d, p), g = this._scratch[0], x = this._state, b = this._velocity, y = this.dimension, w = this.bounds;
                if (m < 0) for (var _4 = y - 1, k = 0; k < y; ++k, --_4) g[k] = x[_4];
                else if (m >= v - 1) {
                  _4 = x.length - 1;
                  var T2 = p - d[v - 1];
                  for (k = 0; k < y; ++k, --_4) g[k] = x[_4] + T2 * b[_4];
                } else {
                  _4 = y * (m + 1) - 1;
                  var A2 = d[m], S2 = d[m + 1] - A2 || 1, C2 = this._scratch[1], E2 = this._scratch[2], F13 = this._scratch[3], N2 = this._scratch[4], D2 = true;
                  for (k = 0; k < y; ++k, --_4) C2[k] = x[_4], F13[k] = b[_4] * S2, E2[k] = x[_4 + y], N2[k] = b[_4 + y] * S2, D2 = D2 && C2[k] === E2[k] && F13[k] === N2[k] && F13[k] === 0;
                  if (D2) for (k = 0; k < y; ++k) g[k] = C2[k];
                  else i(C2, F13, E2, N2, (p - A2) / S2, g);
                }
                var I2 = w[0], O2 = w[1];
                for (k = 0; k < y; ++k) g[k] = u2(I2[k], O2[k], g[k]);
                return g;
              }, f.dcurve = function(p) {
                var d = this._time, v = d.length, m = l.le(d, p), g = this._scratch[0], x = this._state, b = this._velocity, y = this.dimension;
                if (m >= v - 1) for (var w = x.length - 1, _4 = (d[v - 1], 0); _4 < y; ++_4, --w) g[_4] = b[w];
                else {
                  w = y * (m + 1) - 1;
                  var k = d[m], T2 = d[m + 1] - k || 1, A2 = this._scratch[1], S2 = this._scratch[2], C2 = this._scratch[3], E2 = this._scratch[4], F13 = true;
                  for (_4 = 0; _4 < y; ++_4, --w) A2[_4] = x[w], C2[_4] = b[w] * T2, S2[_4] = x[w + y], E2[_4] = b[w + y] * T2, F13 = F13 && A2[_4] === S2[_4] && C2[_4] === E2[_4] && C2[_4] === 0;
                  if (F13) for (_4 = 0; _4 < y; ++_4) g[_4] = 0;
                  else for (i.derivative(A2, C2, S2, E2, (p - k) / T2, g), _4 = 0; _4 < y; ++_4) g[_4] /= T2;
                }
                return g;
              }, f.lastT = function() {
                var p = this._time;
                return p[p.length - 1];
              }, f.stable = function() {
                for (var p = this._velocity, d = p.length, v = this.dimension - 1; v >= 0; --v) if (p[--d]) return false;
                return true;
              }, f.jump = function(p) {
                var d = this.lastT(), v = this.dimension;
                if (!(p < d || arguments.length !== v + 1)) {
                  var m = this._state, g = this._velocity, x = m.length - this.dimension, b = this.bounds, y = b[0], w = b[1];
                  this._time.push(d, p);
                  for (var _4 = 0; _4 < 2; ++_4) for (var k = 0; k < v; ++k) m.push(m[x++]), g.push(0);
                  for (this._time.push(p), k = v; k > 0; --k) m.push(u2(y[k - 1], w[k - 1], arguments[k])), g.push(0);
                }
              }, f.push = function(p) {
                var d = this.lastT(), v = this.dimension;
                if (!(p < d || arguments.length !== v + 1)) {
                  var m = this._state, g = this._velocity, x = m.length - this.dimension, b = p - d, y = this.bounds, w = y[0], _4 = y[1], k = b > 1e-6 ? 1 / b : 0;
                  this._time.push(p);
                  for (var T2 = v; T2 > 0; --T2) {
                    var A2 = u2(w[T2 - 1], _4[T2 - 1], arguments[T2]);
                    m.push(A2), g.push((A2 - m[x++]) * k);
                  }
                }
              }, f.set = function(p) {
                var d = this.dimension;
                if (!(p < this.lastT() || arguments.length !== d + 1)) {
                  var v = this._state, m = this._velocity, g = this.bounds, x = g[0], b = g[1];
                  this._time.push(p);
                  for (var y = d; y > 0; --y) v.push(u2(x[y - 1], b[y - 1], arguments[y])), m.push(0);
                }
              }, f.move = function(p) {
                var d = this.lastT(), v = this.dimension;
                if (!(p <= d || arguments.length !== v + 1)) {
                  var m = this._state, g = this._velocity, x = m.length - this.dimension, b = this.bounds, y = b[0], w = b[1], _4 = p - d, k = _4 > 1e-6 ? 1 / _4 : 0;
                  this._time.push(p);
                  for (var T2 = v; T2 > 0; --T2) {
                    var A2 = arguments[T2];
                    m.push(u2(y[T2 - 1], w[T2 - 1], m[x++] + A2)), g.push(A2 * k);
                  }
                }
              }, f.idle = function(p) {
                var d = this.lastT();
                if (!(p < d)) {
                  var v = this.dimension, m = this._state, g = this._velocity, x = m.length - v, b = this.bounds, y = b[0], w = b[1], _4 = p - d;
                  this._time.push(p);
                  for (var k = v - 1; k >= 0; --k) m.push(u2(y[k], w[k], m[x] + _4 * g[x])), g.push(0), x += 1;
                }
              };
            }, { "binary-search-bounds": 31, "cubic-hermite": 62 }], 69: [function(a, o, s) {
              "use strict";
              o.exports = function(y) {
                return new f(y || b, null);
              };
              function i(y, w, _4, k, T2, A2) {
                this._color = y, this.key = w, this.value = _4, this.left = k, this.right = T2, this._count = A2;
              }
              function l(y) {
                return new i(y._color, y.key, y.value, y.left, y.right, y._count);
              }
              function u2(y, w) {
                return new i(y, w.key, w.value, w.left, w.right, w._count);
              }
              function c(y) {
                y._count = 1 + (y.left ? y.left._count : 0) + (y.right ? y.right._count : 0);
              }
              function f(y, w) {
                this._compare = y, this.root = w;
              }
              var h = f.prototype;
              function p(y, w) {
                var _4;
                return w.left && (_4 = p(y, w.left)) ? _4 : (_4 = y(w.key, w.value)) || (w.right ? p(y, w.right) : void 0);
              }
              function d(y, w, _4, k) {
                if (w(y, k.key) <= 0) {
                  var T2;
                  if (k.left && (T2 = d(y, w, _4, k.left)) || (T2 = _4(k.key, k.value))) return T2;
                }
                if (k.right) return d(y, w, _4, k.right);
              }
              function v(y, w, _4, k, T2) {
                var A2, S2 = _4(y, T2.key), C2 = _4(w, T2.key);
                if (S2 <= 0 && (T2.left && (A2 = v(y, w, _4, k, T2.left)) || C2 > 0 && (A2 = k(T2.key, T2.value)))) return A2;
                if (C2 > 0 && T2.right) return v(y, w, _4, k, T2.right);
              }
              function m(y, w) {
                this.tree = y, this._stack = w;
              }
              Object.defineProperty(h, "keys", { get: function() {
                var y = [];
                return this.forEach(function(w, _4) {
                  y.push(w);
                }), y;
              } }), Object.defineProperty(h, "values", { get: function() {
                var y = [];
                return this.forEach(function(w, _4) {
                  y.push(_4);
                }), y;
              } }), Object.defineProperty(h, "length", { get: function() {
                return this.root ? this.root._count : 0;
              } }), h.insert = function(y, w) {
                for (var _4 = this._compare, k = this.root, T2 = [], A2 = []; k; ) {
                  var S2 = _4(y, k.key);
                  T2.push(k), A2.push(S2), k = S2 <= 0 ? k.left : k.right;
                }
                T2.push(new i(0, y, w, null, null, 1));
                for (var C2 = T2.length - 2; C2 >= 0; --C2) k = T2[C2], A2[C2] <= 0 ? T2[C2] = new i(k._color, k.key, k.value, T2[C2 + 1], k.right, k._count + 1) : T2[C2] = new i(k._color, k.key, k.value, k.left, T2[C2 + 1], k._count + 1);
                for (C2 = T2.length - 1; C2 > 1; --C2) {
                  var E2 = T2[C2 - 1];
                  if (k = T2[C2], E2._color === 1 || k._color === 1) break;
                  var F13 = T2[C2 - 2];
                  if (F13.left === E2) if (E2.left === k) {
                    if (!(N2 = F13.right) || N2._color !== 0) {
                      F13._color = 0, F13.left = E2.right, E2._color = 1, E2.right = F13, T2[C2 - 2] = E2, T2[C2 - 1] = k, c(F13), c(E2), C2 >= 3 && ((D2 = T2[C2 - 3]).left === F13 ? D2.left = E2 : D2.right = E2);
                      break;
                    }
                    E2._color = 1, F13.right = u2(1, N2), F13._color = 0, C2 -= 1;
                  } else {
                    if (!(N2 = F13.right) || N2._color !== 0) {
                      E2.right = k.left, F13._color = 0, F13.left = k.right, k._color = 1, k.left = E2, k.right = F13, T2[C2 - 2] = k, T2[C2 - 1] = E2, c(F13), c(E2), c(k), C2 >= 3 && ((D2 = T2[C2 - 3]).left === F13 ? D2.left = k : D2.right = k);
                      break;
                    }
                    E2._color = 1, F13.right = u2(1, N2), F13._color = 0, C2 -= 1;
                  }
                  else if (E2.right === k) {
                    if (!(N2 = F13.left) || N2._color !== 0) {
                      F13._color = 0, F13.right = E2.left, E2._color = 1, E2.left = F13, T2[C2 - 2] = E2, T2[C2 - 1] = k, c(F13), c(E2), C2 >= 3 && ((D2 = T2[C2 - 3]).right === F13 ? D2.right = E2 : D2.left = E2);
                      break;
                    }
                    E2._color = 1, F13.left = u2(1, N2), F13._color = 0, C2 -= 1;
                  } else {
                    var N2;
                    if (!(N2 = F13.left) || N2._color !== 0) {
                      var D2;
                      E2.left = k.right, F13._color = 0, F13.right = k.left, k._color = 1, k.right = E2, k.left = F13, T2[C2 - 2] = k, T2[C2 - 1] = E2, c(F13), c(E2), c(k), C2 >= 3 && ((D2 = T2[C2 - 3]).right === F13 ? D2.right = k : D2.left = k);
                      break;
                    }
                    E2._color = 1, F13.left = u2(1, N2), F13._color = 0, C2 -= 1;
                  }
                }
                return T2[0]._color = 1, new f(_4, T2[0]);
              }, h.forEach = function(y, w, _4) {
                if (this.root) switch (arguments.length) {
                  case 1:
                    return p(y, this.root);
                  case 2:
                    return d(w, this._compare, y, this.root);
                  case 3:
                    return this._compare(w, _4) >= 0 ? void 0 : v(w, _4, this._compare, y, this.root);
                }
              }, Object.defineProperty(h, "begin", { get: function() {
                for (var y = [], w = this.root; w; ) y.push(w), w = w.left;
                return new m(this, y);
              } }), Object.defineProperty(h, "end", { get: function() {
                for (var y = [], w = this.root; w; ) y.push(w), w = w.right;
                return new m(this, y);
              } }), h.at = function(y) {
                if (y < 0) return new m(this, []);
                for (var w = this.root, _4 = []; ; ) {
                  if (_4.push(w), w.left) {
                    if (y < w.left._count) {
                      w = w.left;
                      continue;
                    }
                    y -= w.left._count;
                  }
                  if (!y) return new m(this, _4);
                  if (y -= 1, !w.right || y >= w.right._count) break;
                  w = w.right;
                }
                return new m(this, []);
              }, h.ge = function(y) {
                for (var w = this._compare, _4 = this.root, k = [], T2 = 0; _4; ) {
                  var A2 = w(y, _4.key);
                  k.push(_4), A2 <= 0 && (T2 = k.length), _4 = A2 <= 0 ? _4.left : _4.right;
                }
                return k.length = T2, new m(this, k);
              }, h.gt = function(y) {
                for (var w = this._compare, _4 = this.root, k = [], T2 = 0; _4; ) {
                  var A2 = w(y, _4.key);
                  k.push(_4), A2 < 0 && (T2 = k.length), _4 = A2 < 0 ? _4.left : _4.right;
                }
                return k.length = T2, new m(this, k);
              }, h.lt = function(y) {
                for (var w = this._compare, _4 = this.root, k = [], T2 = 0; _4; ) {
                  var A2 = w(y, _4.key);
                  k.push(_4), A2 > 0 && (T2 = k.length), _4 = A2 <= 0 ? _4.left : _4.right;
                }
                return k.length = T2, new m(this, k);
              }, h.le = function(y) {
                for (var w = this._compare, _4 = this.root, k = [], T2 = 0; _4; ) {
                  var A2 = w(y, _4.key);
                  k.push(_4), A2 >= 0 && (T2 = k.length), _4 = A2 < 0 ? _4.left : _4.right;
                }
                return k.length = T2, new m(this, k);
              }, h.find = function(y) {
                for (var w = this._compare, _4 = this.root, k = []; _4; ) {
                  var T2 = w(y, _4.key);
                  if (k.push(_4), T2 === 0) return new m(this, k);
                  _4 = T2 <= 0 ? _4.left : _4.right;
                }
                return new m(this, []);
              }, h.remove = function(y) {
                var w = this.find(y);
                return w ? w.remove() : this;
              }, h.get = function(y) {
                for (var w = this._compare, _4 = this.root; _4; ) {
                  var k = w(y, _4.key);
                  if (k === 0) return _4.value;
                  _4 = k <= 0 ? _4.left : _4.right;
                }
              };
              var g = m.prototype;
              function x(y, w) {
                y.key = w.key, y.value = w.value, y.left = w.left, y.right = w.right, y._color = w._color, y._count = w._count;
              }
              function b(y, w) {
                return y < w ? -1 : y > w ? 1 : 0;
              }
              Object.defineProperty(g, "valid", { get: function() {
                return this._stack.length > 0;
              } }), Object.defineProperty(g, "node", { get: function() {
                return this._stack.length > 0 ? this._stack[this._stack.length - 1] : null;
              }, enumerable: true }), g.clone = function() {
                return new m(this.tree, this._stack.slice());
              }, g.remove = function() {
                var y = this._stack;
                if (y.length === 0) return this.tree;
                var w = new Array(y.length), _4 = y[y.length - 1];
                w[w.length - 1] = new i(_4._color, _4.key, _4.value, _4.left, _4.right, _4._count);
                for (var k = y.length - 2; k >= 0; --k) (_4 = y[k]).left === y[k + 1] ? w[k] = new i(_4._color, _4.key, _4.value, w[k + 1], _4.right, _4._count) : w[k] = new i(_4._color, _4.key, _4.value, _4.left, w[k + 1], _4._count);
                if ((_4 = w[w.length - 1]).left && _4.right) {
                  var T2 = w.length;
                  for (_4 = _4.left; _4.right; ) w.push(_4), _4 = _4.right;
                  var A2 = w[T2 - 1];
                  for (w.push(new i(_4._color, A2.key, A2.value, _4.left, _4.right, _4._count)), w[T2 - 1].key = _4.key, w[T2 - 1].value = _4.value, k = w.length - 2; k >= T2; --k) _4 = w[k], w[k] = new i(_4._color, _4.key, _4.value, _4.left, w[k + 1], _4._count);
                  w[T2 - 1].left = w[T2];
                }
                if ((_4 = w[w.length - 1])._color === 0) {
                  var S2 = w[w.length - 2];
                  for (S2.left === _4 ? S2.left = null : S2.right === _4 && (S2.right = null), w.pop(), k = 0; k < w.length; ++k) w[k]._count--;
                  return new f(this.tree._compare, w[0]);
                }
                if (_4.left || _4.right) {
                  for (_4.left ? x(_4, _4.left) : _4.right && x(_4, _4.right), _4._color = 1, k = 0; k < w.length - 1; ++k) w[k]._count--;
                  return new f(this.tree._compare, w[0]);
                }
                if (w.length === 1) return new f(this.tree._compare, null);
                for (k = 0; k < w.length; ++k) w[k]._count--;
                var C2 = w[w.length - 2];
                return function(E2) {
                  for (var F13, N2, D2, I2, O2 = E2.length - 1; O2 >= 0; --O2) {
                    if (F13 = E2[O2], O2 === 0) return void (F13._color = 1);
                    if ((N2 = E2[O2 - 1]).left === F13) {
                      if ((D2 = N2.right).right && D2.right._color === 0) return I2 = (D2 = N2.right = l(D2)).right = l(D2.right), N2.right = D2.left, D2.left = N2, D2.right = I2, D2._color = N2._color, F13._color = 1, N2._color = 1, I2._color = 1, c(N2), c(D2), O2 > 1 && ((L2 = E2[O2 - 2]).left === N2 ? L2.left = D2 : L2.right = D2), void (E2[O2 - 1] = D2);
                      if (D2.left && D2.left._color === 0) return I2 = (D2 = N2.right = l(D2)).left = l(D2.left), N2.right = I2.left, D2.left = I2.right, I2.left = N2, I2.right = D2, I2._color = N2._color, N2._color = 1, D2._color = 1, F13._color = 1, c(N2), c(D2), c(I2), O2 > 1 && ((L2 = E2[O2 - 2]).left === N2 ? L2.left = I2 : L2.right = I2), void (E2[O2 - 1] = I2);
                      if (D2._color === 1) {
                        if (N2._color === 0) return N2._color = 1, void (N2.right = u2(0, D2));
                        N2.right = u2(0, D2);
                        continue;
                      }
                      D2 = l(D2), N2.right = D2.left, D2.left = N2, D2._color = N2._color, N2._color = 0, c(N2), c(D2), O2 > 1 && ((L2 = E2[O2 - 2]).left === N2 ? L2.left = D2 : L2.right = D2), E2[O2 - 1] = D2, E2[O2] = N2, O2 + 1 < E2.length ? E2[O2 + 1] = F13 : E2.push(F13), O2 += 2;
                    } else {
                      if ((D2 = N2.left).left && D2.left._color === 0) return I2 = (D2 = N2.left = l(D2)).left = l(D2.left), N2.left = D2.right, D2.right = N2, D2.left = I2, D2._color = N2._color, F13._color = 1, N2._color = 1, I2._color = 1, c(N2), c(D2), O2 > 1 && ((L2 = E2[O2 - 2]).right === N2 ? L2.right = D2 : L2.left = D2), void (E2[O2 - 1] = D2);
                      if (D2.right && D2.right._color === 0) return I2 = (D2 = N2.left = l(D2)).right = l(D2.right), N2.left = I2.right, D2.right = I2.left, I2.right = N2, I2.left = D2, I2._color = N2._color, N2._color = 1, D2._color = 1, F13._color = 1, c(N2), c(D2), c(I2), O2 > 1 && ((L2 = E2[O2 - 2]).right === N2 ? L2.right = I2 : L2.left = I2), void (E2[O2 - 1] = I2);
                      if (D2._color === 1) {
                        if (N2._color === 0) return N2._color = 1, void (N2.left = u2(0, D2));
                        N2.left = u2(0, D2);
                        continue;
                      }
                      var L2;
                      D2 = l(D2), N2.left = D2.right, D2.right = N2, D2._color = N2._color, N2._color = 0, c(N2), c(D2), O2 > 1 && ((L2 = E2[O2 - 2]).right === N2 ? L2.right = D2 : L2.left = D2), E2[O2 - 1] = D2, E2[O2] = N2, O2 + 1 < E2.length ? E2[O2 + 1] = F13 : E2.push(F13), O2 += 2;
                    }
                  }
                }(w), C2.left === _4 ? C2.left = null : C2.right = null, new f(this.tree._compare, w[0]);
              }, Object.defineProperty(g, "key", { get: function() {
                if (this._stack.length > 0) return this._stack[this._stack.length - 1].key;
              }, enumerable: true }), Object.defineProperty(g, "value", { get: function() {
                if (this._stack.length > 0) return this._stack[this._stack.length - 1].value;
              }, enumerable: true }), Object.defineProperty(g, "index", { get: function() {
                var y = 0, w = this._stack;
                if (w.length === 0) {
                  var _4 = this.tree.root;
                  return _4 ? _4._count : 0;
                }
                w[w.length - 1].left && (y = w[w.length - 1].left._count);
                for (var k = w.length - 2; k >= 0; --k) w[k + 1] === w[k].right && (++y, w[k].left && (y += w[k].left._count));
                return y;
              }, enumerable: true }), g.next = function() {
                var y = this._stack;
                if (y.length !== 0) {
                  var w = y[y.length - 1];
                  if (w.right) for (w = w.right; w; ) y.push(w), w = w.left;
                  else for (y.pop(); y.length > 0 && y[y.length - 1].right === w; ) w = y[y.length - 1], y.pop();
                }
              }, Object.defineProperty(g, "hasNext", { get: function() {
                var y = this._stack;
                if (y.length === 0) return false;
                if (y[y.length - 1].right) return true;
                for (var w = y.length - 1; w > 0; --w) if (y[w - 1].left === y[w]) return true;
                return false;
              } }), g.update = function(y) {
                var w = this._stack;
                if (w.length === 0) throw new Error("Can't update empty node!");
                var _4 = new Array(w.length), k = w[w.length - 1];
                _4[_4.length - 1] = new i(k._color, k.key, y, k.left, k.right, k._count);
                for (var T2 = w.length - 2; T2 >= 0; --T2) (k = w[T2]).left === w[T2 + 1] ? _4[T2] = new i(k._color, k.key, k.value, _4[T2 + 1], k.right, k._count) : _4[T2] = new i(k._color, k.key, k.value, k.left, _4[T2 + 1], k._count);
                return new f(this.tree._compare, _4[0]);
              }, g.prev = function() {
                var y = this._stack;
                if (y.length !== 0) {
                  var w = y[y.length - 1];
                  if (w.left) for (w = w.left; w; ) y.push(w), w = w.right;
                  else for (y.pop(); y.length > 0 && y[y.length - 1].left === w; ) w = y[y.length - 1], y.pop();
                }
              }, Object.defineProperty(g, "hasPrev", { get: function() {
                var y = this._stack;
                if (y.length === 0) return false;
                if (y[y.length - 1].left) return true;
                for (var w = y.length - 1; w > 0; --w) if (y[w - 1].right === y[w]) return true;
                return false;
              } });
            }, {}], 70: [function(a, o, s) {
              "use strict";
              o.exports = function(T2, A2) {
                var S2 = new d(T2);
                return S2.update(A2), S2;
              };
              var i = a("./lib/text.js"), l = a("./lib/lines.js"), u2 = a("./lib/background.js"), c = a("./lib/cube.js"), f = a("./lib/ticks.js"), h = new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
              function p(T2, A2) {
                return T2[0] = A2[0], T2[1] = A2[1], T2[2] = A2[2], T2;
              }
              function d(T2) {
                this.gl = T2, this.pixelRatio = 1, this.bounds = [[-10, -10, -10], [10, 10, 10]], this.ticks = [[], [], []], this.autoTicks = true, this.tickSpacing = [1, 1, 1], this.tickEnable = [true, true, true], this.tickFont = ["sans-serif", "sans-serif", "sans-serif"], this.tickSize = [12, 12, 12], this.tickAngle = [0, 0, 0], this.tickAlign = ["auto", "auto", "auto"], this.tickColor = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]], this.tickPad = [10, 10, 10], this.lastCubeProps = { cubeEdges: [0, 0, 0], axis: [0, 0, 0] }, this.labels = ["x", "y", "z"], this.labelEnable = [true, true, true], this.labelFont = "sans-serif", this.labelSize = [20, 20, 20], this.labelAngle = [0, 0, 0], this.labelAlign = ["auto", "auto", "auto"], this.labelColor = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]], this.labelPad = [10, 10, 10], this.lineEnable = [true, true, true], this.lineMirror = [false, false, false], this.lineWidth = [1, 1, 1], this.lineColor = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]], this.lineTickEnable = [true, true, true], this.lineTickMirror = [false, false, false], this.lineTickLength = [0, 0, 0], this.lineTickWidth = [1, 1, 1], this.lineTickColor = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]], this.gridEnable = [true, true, true], this.gridWidth = [1, 1, 1], this.gridColor = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]], this.zeroEnable = [true, true, true], this.zeroLineColor = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]], this.zeroLineWidth = [2, 2, 2], this.backgroundEnable = [false, false, false], this.backgroundColor = [[0.8, 0.8, 0.8, 0.5], [0.8, 0.8, 0.8, 0.5], [0.8, 0.8, 0.8, 0.5]], this._firstInit = true, this._text = null, this._lines = null, this._background = u2(T2);
              }
              var v = d.prototype;
              function m() {
                this.primalOffset = [0, 0, 0], this.primalMinor = [0, 0, 0], this.mirrorOffset = [0, 0, 0], this.mirrorMinor = [0, 0, 0];
              }
              v.update = function(T2) {
                function A2(X2, Y2, K2) {
                  if (K2 in T2) {
                    var q, re = T2[K2], R2 = this[K2];
                    (X2 ? Array.isArray(re) && Array.isArray(re[0]) : Array.isArray(re)) ? this[K2] = q = [Y2(re[0]), Y2(re[1]), Y2(re[2])] : this[K2] = q = [Y2(re), Y2(re), Y2(re)];
                    for (var z = 0; z < 3; ++z) if (q[z] !== R2[z]) return true;
                  }
                  return false;
                }
                T2 = T2 || {};
                var S2, C2 = A2.bind(this, false, Number), E2 = A2.bind(this, false, Boolean), F13 = A2.bind(this, false, String), N2 = A2.bind(this, true, function(X2) {
                  if (Array.isArray(X2)) {
                    if (X2.length === 3) return [+X2[0], +X2[1], +X2[2], 1];
                    if (X2.length === 4) return [+X2[0], +X2[1], +X2[2], +X2[3]];
                  }
                  return [0, 0, 0, 1];
                }), D2 = false, I2 = false;
                if ("bounds" in T2) for (var O2 = T2.bounds, L2 = 0; L2 < 2; ++L2) for (var V2 = 0; V2 < 3; ++V2) O2[L2][V2] !== this.bounds[L2][V2] && (I2 = true), this.bounds[L2][V2] = O2[L2][V2];
                if ("ticks" in T2) for (S2 = T2.ticks, D2 = true, this.autoTicks = false, L2 = 0; L2 < 3; ++L2) this.tickSpacing[L2] = 0;
                else C2("tickSpacing") && (this.autoTicks = true, I2 = true);
                if (this._firstInit && ("ticks" in T2 || "tickSpacing" in T2 || (this.autoTicks = true), I2 = true, D2 = true, this._firstInit = false), I2 && this.autoTicks && (S2 = f.create(this.bounds, this.tickSpacing), D2 = true), D2) {
                  for (L2 = 0; L2 < 3; ++L2) S2[L2].sort(function(X2, Y2) {
                    return X2.x - Y2.x;
                  });
                  f.equal(S2, this.ticks) ? D2 = false : this.ticks = S2;
                }
                E2("tickEnable"), F13("tickFont") && (D2 = true), C2("tickSize"), C2("tickAngle"), C2("tickPad"), N2("tickColor");
                var W2 = F13("labels");
                F13("labelFont") && (W2 = true), E2("labelEnable"), C2("labelSize"), C2("labelPad"), N2("labelColor"), E2("lineEnable"), E2("lineMirror"), C2("lineWidth"), N2("lineColor"), E2("lineTickEnable"), E2("lineTickMirror"), C2("lineTickLength"), C2("lineTickWidth"), N2("lineTickColor"), E2("gridEnable"), C2("gridWidth"), N2("gridColor"), E2("zeroEnable"), N2("zeroLineColor"), C2("zeroLineWidth"), E2("backgroundEnable"), N2("backgroundColor"), this._text ? this._text && (W2 || D2) && this._text.update(this.bounds, this.labels, this.labelFont, this.ticks, this.tickFont) : this._text = i(this.gl, this.bounds, this.labels, this.labelFont, this.ticks, this.tickFont), this._lines && D2 && (this._lines.dispose(), this._lines = null), this._lines || (this._lines = l(this.gl, this.bounds, this.ticks));
              };
              var g = [new m(), new m(), new m()];
              function x(T2, A2, S2, C2, E2) {
                for (var F13 = T2.primalOffset, N2 = T2.primalMinor, D2 = T2.mirrorOffset, I2 = T2.mirrorMinor, O2 = C2[A2], L2 = 0; L2 < 3; ++L2) if (A2 !== L2) {
                  var V2 = F13, W2 = D2, X2 = N2, Y2 = I2;
                  O2 & 1 << L2 && (V2 = D2, W2 = F13, X2 = I2, Y2 = N2), V2[L2] = S2[0][L2], W2[L2] = S2[1][L2], E2[L2] > 0 ? (X2[L2] = -1, Y2[L2] = 0) : (X2[L2] = 0, Y2[L2] = 1);
                }
              }
              var b = [0, 0, 0], y = { model: h, view: h, projection: h, _ortho: false };
              v.isOpaque = function() {
                return true;
              }, v.isTransparent = function() {
                return false;
              }, v.drawTransparent = function(T2) {
              };
              var w = [0, 0, 0], _4 = [0, 0, 0], k = [0, 0, 0];
              v.draw = function(T2) {
                T2 = T2 || y;
                for (var A2 = this.gl, S2 = T2.model || h, C2 = T2.view || h, E2 = T2.projection || h, F13 = this.bounds, N2 = T2._ortho || false, D2 = c(S2, C2, E2, F13, N2), I2 = D2.cubeEdges, O2 = D2.axis, L2 = C2[12], V2 = C2[13], W2 = C2[14], X2 = C2[15], Y2 = (N2 ? 2 : 1) * this.pixelRatio * (E2[3] * L2 + E2[7] * V2 + E2[11] * W2 + E2[15] * X2) / A2.drawingBufferHeight, K2 = 0; K2 < 3; ++K2) this.lastCubeProps.cubeEdges[K2] = I2[K2], this.lastCubeProps.axis[K2] = O2[K2];
                var q = g;
                for (K2 = 0; K2 < 3; ++K2) x(g[K2], K2, this.bounds, I2, O2);
                A2 = this.gl;
                var re, R2 = b;
                for (K2 = 0; K2 < 3; ++K2) this.backgroundEnable[K2] ? R2[K2] = O2[K2] : R2[K2] = 0;
                for (this._background.draw(S2, C2, E2, F13, R2, this.backgroundColor), this._lines.bind(S2, C2, E2, this), K2 = 0; K2 < 3; ++K2) {
                  var z = [0, 0, 0];
                  O2[K2] > 0 ? z[K2] = F13[1][K2] : z[K2] = F13[0][K2];
                  for (var H2 = 0; H2 < 2; ++H2) {
                    var te = (K2 + 1 + H2) % 3, j = (K2 + 1 + (1 ^ H2)) % 3;
                    this.gridEnable[te] && this._lines.drawGrid(te, j, this.bounds, z, this.gridColor[te], this.gridWidth[te] * this.pixelRatio);
                  }
                  for (H2 = 0; H2 < 2; ++H2) te = (K2 + 1 + H2) % 3, j = (K2 + 1 + (1 ^ H2)) % 3, this.zeroEnable[j] && Math.min(F13[0][j], F13[1][j]) <= 0 && Math.max(F13[0][j], F13[1][j]) >= 0 && this._lines.drawZero(te, j, this.bounds, z, this.zeroLineColor[j], this.zeroLineWidth[j] * this.pixelRatio);
                }
                for (K2 = 0; K2 < 3; ++K2) {
                  this.lineEnable[K2] && this._lines.drawAxisLine(K2, this.bounds, q[K2].primalOffset, this.lineColor[K2], this.lineWidth[K2] * this.pixelRatio), this.lineMirror[K2] && this._lines.drawAxisLine(K2, this.bounds, q[K2].mirrorOffset, this.lineColor[K2], this.lineWidth[K2] * this.pixelRatio);
                  var Q2 = p(w, q[K2].primalMinor), Z2 = p(_4, q[K2].mirrorMinor), ne = this.lineTickLength;
                  for (H2 = 0; H2 < 3; ++H2) {
                    var ae = Y2 / S2[5 * H2];
                    Q2[H2] *= ne[H2] * ae, Z2[H2] *= ne[H2] * ae;
                  }
                  this.lineTickEnable[K2] && this._lines.drawAxisTicks(K2, q[K2].primalOffset, Q2, this.lineTickColor[K2], this.lineTickWidth[K2] * this.pixelRatio), this.lineTickMirror[K2] && this._lines.drawAxisTicks(K2, q[K2].mirrorOffset, Z2, this.lineTickColor[K2], this.lineTickWidth[K2] * this.pixelRatio);
                }
                this._lines.unbind(), this._text.bind(S2, C2, E2, this.pixelRatio);
                var ue, le;
                function ce(Ae) {
                  (le = [0, 0, 0])[Ae] = 1;
                }
                function se(Ae, pe, ve) {
                  var Ee = (Ae + 1) % 3, Se = (Ae + 2) % 3, Ce = pe[Ee], Be = pe[Se], Ue = ve[Ee], Ke = ve[Se];
                  Ce > 0 && Ke > 0 || Ce > 0 && Ke < 0 || Ce < 0 && Ke > 0 || Ce < 0 && Ke < 0 ? ce(Ee) : (Be > 0 && Ue > 0 || Be > 0 && Ue < 0 || Be < 0 && Ue > 0 || Be < 0 && Ue < 0) && ce(Se);
                }
                for (K2 = 0; K2 < 3; ++K2) {
                  var he = q[K2].primalMinor, me = q[K2].mirrorMinor, we = p(k, q[K2].primalOffset);
                  for (H2 = 0; H2 < 3; ++H2) this.lineTickEnable[K2] && (we[H2] += Y2 * he[H2] * Math.max(this.lineTickLength[H2], 0) / S2[5 * H2]);
                  var be = [0, 0, 0];
                  if (be[K2] = 1, this.tickEnable[K2]) {
                    for (this.tickAngle[K2] === -3600 ? (this.tickAngle[K2] = 0, this.tickAlign[K2] = "auto") : this.tickAlign[K2] = -1, ue = 1, (re = [this.tickAlign[K2], 0.5, ue])[0] === "auto" ? re[0] = 0 : re[0] = parseInt("" + re[0]), le = [0, 0, 0], se(K2, he, me), H2 = 0; H2 < 3; ++H2) we[H2] += Y2 * he[H2] * this.tickPad[H2] / S2[5 * H2];
                    this._text.drawTicks(K2, this.tickSize[K2], this.tickAngle[K2], we, this.tickColor[K2], be, le, re);
                  }
                  if (this.labelEnable[K2]) {
                    for (ue = 0, le = [0, 0, 0], this.labels[K2].length > 4 && (ce(K2), ue = 1), (re = [this.labelAlign[K2], 0.5, ue])[0] === "auto" ? re[0] = 0 : re[0] = parseInt("" + re[0]), H2 = 0; H2 < 3; ++H2) we[H2] += Y2 * he[H2] * this.labelPad[H2] / S2[5 * H2];
                    we[K2] += 0.5 * (F13[0][K2] + F13[1][K2]), this._text.drawLabel(K2, this.labelSize[K2], this.labelAngle[K2], we, this.labelColor[K2], [0, 0, 0], le, re);
                  }
                }
                this._text.unbind();
              }, v.dispose = function() {
                this._text.dispose(), this._lines.dispose(), this._background.dispose(), this._lines = null, this._text = null, this._background = null, this.gl = null;
              };
            }, { "./lib/background.js": 71, "./lib/cube.js": 72, "./lib/lines.js": 73, "./lib/text.js": 75, "./lib/ticks.js": 76 }], 71: [function(a, o, s) {
              "use strict";
              o.exports = function(h) {
                for (var p = [], d = [], v = 0, m = 0; m < 3; ++m) for (var g = (m + 1) % 3, x = (m + 2) % 3, b = [0, 0, 0], y = [0, 0, 0], w = -1; w <= 1; w += 2) {
                  d.push(v, v + 2, v + 1, v + 1, v + 2, v + 3), b[m] = w, y[m] = w;
                  for (var _4 = -1; _4 <= 1; _4 += 2) {
                    b[g] = _4;
                    for (var k = -1; k <= 1; k += 2) b[x] = k, p.push(b[0], b[1], b[2], y[0], y[1], y[2]), v += 1;
                  }
                  var T2 = g;
                  g = x, x = T2;
                }
                var A2 = i(h, new Float32Array(p)), S2 = i(h, new Uint16Array(d), h.ELEMENT_ARRAY_BUFFER), C2 = l(h, [{ buffer: A2, type: h.FLOAT, size: 3, offset: 0, stride: 24 }, { buffer: A2, type: h.FLOAT, size: 3, offset: 12, stride: 24 }], S2), E2 = u2(h);
                return E2.attributes.position.location = 0, E2.attributes.normal.location = 1, new c(h, A2, C2, E2);
              };
              var i = a("gl-buffer"), l = a("gl-vao"), u2 = a("./shaders").bg;
              function c(h, p, d, v) {
                this.gl = h, this.buffer = p, this.vao = d, this.shader = v;
              }
              var f = c.prototype;
              f.draw = function(h, p, d, v, m, g) {
                for (var x = false, b = 0; b < 3; ++b) x = x || m[b];
                if (x) {
                  var y = this.gl;
                  y.enable(y.POLYGON_OFFSET_FILL), y.polygonOffset(1, 2), this.shader.bind(), this.shader.uniforms = { model: h, view: p, projection: d, bounds: v, enable: m, colors: g }, this.vao.bind(), this.vao.draw(this.gl.TRIANGLES, 36), this.vao.unbind(), y.disable(y.POLYGON_OFFSET_FILL);
                }
              }, f.dispose = function() {
                this.vao.dispose(), this.buffer.dispose(), this.shader.dispose();
              };
            }, { "./shaders": 74, "gl-buffer": 78, "gl-vao": 150 }], 72: [function(a, o, s) {
              "use strict";
              o.exports = function(_4, k, T2, A2, S2) {
                l(f, k, _4), l(f, T2, f);
                for (var C2 = 0, E2 = 0; E2 < 2; ++E2) {
                  d[2] = A2[E2][2];
                  for (var F13 = 0; F13 < 2; ++F13) {
                    d[1] = A2[F13][1];
                    for (var N2 = 0; N2 < 2; ++N2) d[0] = A2[N2][0], m(h[C2], d, f), C2 += 1;
                  }
                }
                var D2 = -1;
                for (E2 = 0; E2 < 8; ++E2) {
                  for (var I2 = h[E2][3], O2 = 0; O2 < 3; ++O2) p[E2][O2] = h[E2][O2] / I2;
                  S2 && (p[E2][2] *= -1), I2 < 0 && (D2 < 0 || p[E2][2] < p[D2][2]) && (D2 = E2);
                }
                if (D2 < 0) {
                  D2 = 0;
                  for (var L2 = 0; L2 < 3; ++L2) {
                    for (var V2 = (L2 + 2) % 3, W2 = (L2 + 1) % 3, X2 = -1, Y2 = -1, K2 = 0; K2 < 2; ++K2) {
                      var q = (R2 = K2 << L2) + (K2 << V2) + (1 - K2 << W2), re = R2 + (1 - K2 << V2) + (K2 << W2);
                      c(p[R2], p[q], p[re], v) < 0 || (K2 ? X2 = 1 : Y2 = 1);
                    }
                    if (X2 < 0 || Y2 < 0) Y2 > X2 && (D2 |= 1 << L2);
                    else {
                      for (K2 = 0; K2 < 2; ++K2) {
                        q = (R2 = K2 << L2) + (K2 << V2) + (1 - K2 << W2), re = R2 + (1 - K2 << V2) + (K2 << W2);
                        var R2, z = x([h[R2], h[q], h[re], h[R2 + (1 << V2) + (1 << W2)]]);
                        K2 ? X2 = z : Y2 = z;
                      }
                      Y2 > X2 && (D2 |= 1 << L2);
                    }
                  }
                }
                var H2 = 7 ^ D2, te = -1;
                for (E2 = 0; E2 < 8; ++E2) E2 !== D2 && E2 !== H2 && (te < 0 || p[te][1] > p[E2][1]) && (te = E2);
                var j = -1;
                for (E2 = 0; E2 < 3; ++E2) (Z2 = te ^ 1 << E2) !== D2 && Z2 !== H2 && (j < 0 && (j = Z2), (W2 = p[Z2])[0] < p[j][0] && (j = Z2));
                var Q2 = -1;
                for (E2 = 0; E2 < 3; ++E2) {
                  var Z2;
                  (Z2 = te ^ 1 << E2) !== D2 && Z2 !== H2 && Z2 !== j && (Q2 < 0 && (Q2 = Z2), (W2 = p[Z2])[0] > p[Q2][0] && (Q2 = Z2));
                }
                var ne = b;
                ne[0] = ne[1] = ne[2] = 0, ne[i.log2(j ^ te)] = te & j, ne[i.log2(te ^ Q2)] = te & Q2;
                var ae = 7 ^ Q2;
                ae === D2 || ae === H2 ? (ae = 7 ^ j, ne[i.log2(Q2 ^ ae)] = ae & Q2) : ne[i.log2(j ^ ae)] = ae & j;
                var ue = y, le = D2;
                for (L2 = 0; L2 < 3; ++L2) ue[L2] = le & 1 << L2 ? -1 : 1;
                return w;
              };
              var i = a("bit-twiddle"), l = a("gl-mat4/multiply"), u2 = a("split-polygon"), c = a("robust-orientation"), f = new Array(16), h = new Array(8), p = new Array(8), d = new Array(3), v = [0, 0, 0];
              function m(_4, k, T2) {
                for (var A2 = 0; A2 < 4; ++A2) {
                  _4[A2] = T2[12 + A2];
                  for (var S2 = 0; S2 < 3; ++S2) _4[A2] += k[S2] * T2[4 * S2 + A2];
                }
              }
              (function() {
                for (var _4 = 0; _4 < 8; ++_4) h[_4] = [1, 1, 1, 1], p[_4] = [1, 1, 1];
              })();
              var g = [[0, 0, 1, 0, 0], [0, 0, -1, 1, 0], [0, -1, 0, 1, 0], [0, 1, 0, 1, 0], [-1, 0, 0, 1, 0], [1, 0, 0, 1, 0]];
              function x(_4) {
                for (var k = 0; k < g.length; ++k) if ((_4 = u2.positive(_4, g[k])).length < 3) return 0;
                var T2 = _4[0], A2 = T2[0] / T2[3], S2 = T2[1] / T2[3], C2 = 0;
                for (k = 1; k + 1 < _4.length; ++k) {
                  var E2 = _4[k], F13 = _4[k + 1], N2 = E2[0] / E2[3] - A2, D2 = E2[1] / E2[3] - S2, I2 = F13[0] / F13[3] - A2, O2 = F13[1] / F13[3] - S2;
                  C2 += Math.abs(N2 * O2 - D2 * I2);
                }
                return C2;
              }
              var b = [1, 1, 1], y = [0, 0, 0], w = { cubeEdges: b, axis: y };
            }, { "bit-twiddle": 32, "gl-mat4/multiply": 100, "robust-orientation": 284, "split-polygon": 300 }], 73: [function(a, o, s) {
              "use strict";
              o.exports = function(b, y, w) {
                var _4 = [], k = [0, 0, 0], T2 = [0, 0, 0], A2 = [0, 0, 0], S2 = [0, 0, 0];
                _4.push(0, 0, 1, 0, 1, 1, 0, 0, -1, 0, 0, -1, 0, 1, 1, 0, 1, -1);
                for (var C2 = 0; C2 < 3; ++C2) {
                  for (var E2 = _4.length / 3 | 0, F13 = 0; F13 < w[C2].length; ++F13) {
                    var N2 = +w[C2][F13].x;
                    _4.push(N2, 0, 1, N2, 1, 1, N2, 0, -1, N2, 0, -1, N2, 1, 1, N2, 1, -1);
                  }
                  var D2 = _4.length / 3 | 0;
                  k[C2] = E2, T2[C2] = D2 - E2, E2 = _4.length / 3 | 0;
                  for (var I2 = 0; I2 < w[C2].length; ++I2) N2 = +w[C2][I2].x, _4.push(N2, 0, 1, N2, 1, 1, N2, 0, -1, N2, 0, -1, N2, 1, 1, N2, 1, -1);
                  D2 = _4.length / 3 | 0, A2[C2] = E2, S2[C2] = D2 - E2;
                }
                var O2 = i(b, new Float32Array(_4)), L2 = l(b, [{ buffer: O2, type: b.FLOAT, size: 3, stride: 0, offset: 0 }]), V2 = u2(b);
                return V2.attributes.position.location = 0, new g(b, O2, L2, V2, T2, k, S2, A2);
              };
              var i = a("gl-buffer"), l = a("gl-vao"), u2 = a("./shaders").line, c = [0, 0, 0], f = [0, 0, 0], h = [0, 0, 0], p = [0, 0, 0], d = [1, 1];
              function v(b) {
                return b[0] = b[1] = b[2] = 0, b;
              }
              function m(b, y) {
                return b[0] = y[0], b[1] = y[1], b[2] = y[2], b;
              }
              function g(b, y, w, _4, k, T2, A2, S2) {
                this.gl = b, this.vertBuffer = y, this.vao = w, this.shader = _4, this.tickCount = k, this.tickOffset = T2, this.gridCount = A2, this.gridOffset = S2;
              }
              var x = g.prototype;
              x.bind = function(b, y, w) {
                this.shader.bind(), this.shader.uniforms.model = b, this.shader.uniforms.view = y, this.shader.uniforms.projection = w, d[0] = this.gl.drawingBufferWidth, d[1] = this.gl.drawingBufferHeight, this.shader.uniforms.screenShape = d, this.vao.bind();
              }, x.unbind = function() {
                this.vao.unbind();
              }, x.drawAxisLine = function(b, y, w, _4, k) {
                var T2 = v(f);
                this.shader.uniforms.majorAxis = f, T2[b] = y[1][b] - y[0][b], this.shader.uniforms.minorAxis = T2;
                var A2, S2 = m(p, w);
                S2[b] += y[0][b], this.shader.uniforms.offset = S2, this.shader.uniforms.lineWidth = k, this.shader.uniforms.color = _4, (A2 = v(h))[(b + 2) % 3] = 1, this.shader.uniforms.screenAxis = A2, this.vao.draw(this.gl.TRIANGLES, 6), (A2 = v(h))[(b + 1) % 3] = 1, this.shader.uniforms.screenAxis = A2, this.vao.draw(this.gl.TRIANGLES, 6);
              }, x.drawAxisTicks = function(b, y, w, _4, k) {
                if (this.tickCount[b]) {
                  var T2 = v(c);
                  T2[b] = 1, this.shader.uniforms.majorAxis = T2, this.shader.uniforms.offset = y, this.shader.uniforms.minorAxis = w, this.shader.uniforms.color = _4, this.shader.uniforms.lineWidth = k;
                  var A2 = v(h);
                  A2[b] = 1, this.shader.uniforms.screenAxis = A2, this.vao.draw(this.gl.TRIANGLES, this.tickCount[b], this.tickOffset[b]);
                }
              }, x.drawGrid = function(b, y, w, _4, k, T2) {
                if (this.gridCount[b]) {
                  var A2 = v(f);
                  A2[y] = w[1][y] - w[0][y], this.shader.uniforms.minorAxis = A2;
                  var S2 = m(p, _4);
                  S2[y] += w[0][y], this.shader.uniforms.offset = S2;
                  var C2 = v(c);
                  C2[b] = 1, this.shader.uniforms.majorAxis = C2;
                  var E2 = v(h);
                  E2[b] = 1, this.shader.uniforms.screenAxis = E2, this.shader.uniforms.lineWidth = T2, this.shader.uniforms.color = k, this.vao.draw(this.gl.TRIANGLES, this.gridCount[b], this.gridOffset[b]);
                }
              }, x.drawZero = function(b, y, w, _4, k, T2) {
                var A2 = v(f);
                this.shader.uniforms.majorAxis = A2, A2[b] = w[1][b] - w[0][b], this.shader.uniforms.minorAxis = A2;
                var S2 = m(p, _4);
                S2[b] += w[0][b], this.shader.uniforms.offset = S2;
                var C2 = v(h);
                C2[y] = 1, this.shader.uniforms.screenAxis = C2, this.shader.uniforms.lineWidth = T2, this.shader.uniforms.color = k, this.vao.draw(this.gl.TRIANGLES, 6);
              }, x.dispose = function() {
                this.vao.dispose(), this.vertBuffer.dispose(), this.shader.dispose();
              };
            }, { "./shaders": 74, "gl-buffer": 78, "gl-vao": 150 }], 74: [function(a, o, s) {
              "use strict";
              var i = a("glslify"), l = a("gl-shader"), u2 = i([`precision highp float;
#define GLSLIFY 1

attribute vec3 position;

uniform mat4 model, view, projection;
uniform vec3 offset, majorAxis, minorAxis, screenAxis;
uniform float lineWidth;
uniform vec2 screenShape;

vec3 project(vec3 p) {
  vec4 pp = projection * view * model * vec4(p, 1.0);
  return pp.xyz / max(pp.w, 0.0001);
}

void main() {
  vec3 major = position.x * majorAxis;
  vec3 minor = position.y * minorAxis;

  vec3 vPosition = major + minor + offset;
  vec3 pPosition = project(vPosition);
  vec3 offset = project(vPosition + screenAxis * position.z);

  vec2 screen = normalize((offset - pPosition).xy * screenShape) / screenShape;

  gl_Position = vec4(pPosition + vec3(0.5 * screen * lineWidth, 0), 1.0);
}
`]), c = i([`precision highp float;
#define GLSLIFY 1

uniform vec4 color;
void main() {
  gl_FragColor = color;
}`]);
              s.line = function(v) {
                return l(v, u2, c, null, [{ name: "position", type: "vec3" }]);
              };
              var f = i([`precision highp float;
#define GLSLIFY 1

attribute vec3 position;

uniform mat4 model, view, projection;
uniform vec3 offset, axis, alignDir, alignOpt;
uniform float scale, angle, pixelScale;
uniform vec2 resolution;

vec3 project(vec3 p) {
  vec4 pp = projection * view * model * vec4(p, 1.0);
  return pp.xyz / max(pp.w, 0.0001);
}

float computeViewAngle(vec3 a, vec3 b) {
  vec3 A = project(a);
  vec3 B = project(b);

  return atan(
    (B.y - A.y) * resolution.y,
    (B.x - A.x) * resolution.x
  );
}

const float PI = 3.141592;
const float TWO_PI = 2.0 * PI;
const float HALF_PI = 0.5 * PI;
const float ONE_AND_HALF_PI = 1.5 * PI;

int option = int(floor(alignOpt.x + 0.001));
float hv_ratio =       alignOpt.y;
bool enableAlign =    (alignOpt.z != 0.0);

float mod_angle(float a) {
  return mod(a, PI);
}

float positive_angle(float a) {
  return mod_angle((a < 0.0) ?
    a + TWO_PI :
    a
  );
}

float look_upwards(float a) {
  float b = positive_angle(a);
  return ((b > HALF_PI) && (b <= ONE_AND_HALF_PI)) ?
    b - PI :
    b;
}

float look_horizontal_or_vertical(float a, float ratio) {
  // ratio controls the ratio between being horizontal to (vertical + horizontal)
  // if ratio is set to 0.5 then it is 50%, 50%.
  // when using a higher ratio e.g. 0.75 the result would
  // likely be more horizontal than vertical.

  float b = positive_angle(a);

  return
    (b < (      ratio) * HALF_PI) ? 0.0 :
    (b < (2.0 - ratio) * HALF_PI) ? -HALF_PI :
    (b < (2.0 + ratio) * HALF_PI) ? 0.0 :
    (b < (4.0 - ratio) * HALF_PI) ? HALF_PI :
                                    0.0;
}

float roundTo(float a, float b) {
  return float(b * floor((a + 0.5 * b) / b));
}

float look_round_n_directions(float a, int n) {
  float b = positive_angle(a);
  float div = TWO_PI / float(n);
  float c = roundTo(b, div);
  return look_upwards(c);
}

float applyAlignOption(float rawAngle, float delta) {
  return
    (option >  2) ? look_round_n_directions(rawAngle + delta, option) :       // option 3-n: round to n directions
    (option == 2) ? look_horizontal_or_vertical(rawAngle + delta, hv_ratio) : // horizontal or vertical
    (option == 1) ? rawAngle + delta :       // use free angle, and flip to align with one direction of the axis
    (option == 0) ? look_upwards(rawAngle) : // use free angle, and stay upwards
    (option ==-1) ? 0.0 :                    // useful for backward compatibility, all texts remains horizontal
                    rawAngle;                // otherwise return back raw input angle
}

bool isAxisTitle = (axis.x == 0.0) &&
                   (axis.y == 0.0) &&
                   (axis.z == 0.0);

void main() {
  //Compute world offset
  float axisDistance = position.z;
  vec3 dataPosition = axisDistance * axis + offset;

  float beta = angle; // i.e. user defined attributes for each tick

  float axisAngle;
  float clipAngle;
  float flip;

  if (enableAlign) {
    axisAngle = (isAxisTitle) ? HALF_PI :
                      computeViewAngle(dataPosition, dataPosition + axis);
    clipAngle = computeViewAngle(dataPosition, dataPosition + alignDir);

    axisAngle += (sin(axisAngle) < 0.0) ? PI : 0.0;
    clipAngle += (sin(clipAngle) < 0.0) ? PI : 0.0;

    flip = (dot(vec2(cos(axisAngle), sin(axisAngle)),
                vec2(sin(clipAngle),-cos(clipAngle))) > 0.0) ? 1.0 : 0.0;

    beta += applyAlignOption(clipAngle, flip * PI);
  }

  //Compute plane offset
  vec2 planeCoord = position.xy * pixelScale;

  mat2 planeXform = scale * mat2(
     cos(beta), sin(beta),
    -sin(beta), cos(beta)
  );

  vec2 viewOffset = 2.0 * planeXform * planeCoord / resolution;

  //Compute clip position
  vec3 clipPosition = project(dataPosition);

  //Apply text offset in clip coordinates
  clipPosition += vec3(viewOffset, 0.0);

  //Done
  gl_Position = vec4(clipPosition, 1.0);
}`]), h = i([`precision highp float;
#define GLSLIFY 1

uniform vec4 color;
void main() {
  gl_FragColor = color;
}`]);
              s.text = function(v) {
                return l(v, f, h, null, [{ name: "position", type: "vec3" }]);
              };
              var p = i([`precision highp float;
#define GLSLIFY 1

attribute vec3 position;
attribute vec3 normal;

uniform mat4 model, view, projection;
uniform vec3 enable;
uniform vec3 bounds[2];

varying vec3 colorChannel;

void main() {

  vec3 signAxis = sign(bounds[1] - bounds[0]);

  vec3 realNormal = signAxis * normal;

  if(dot(realNormal, enable) > 0.0) {
    vec3 minRange = min(bounds[0], bounds[1]);
    vec3 maxRange = max(bounds[0], bounds[1]);
    vec3 nPosition = mix(minRange, maxRange, 0.5 * (position + 1.0));
    gl_Position = projection * view * model * vec4(nPosition, 1.0);
  } else {
    gl_Position = vec4(0,0,0,0);
  }

  colorChannel = abs(realNormal);
}`]), d = i([`precision highp float;
#define GLSLIFY 1

uniform vec4 colors[3];

varying vec3 colorChannel;

void main() {
  gl_FragColor = colorChannel.x * colors[0] +
                 colorChannel.y * colors[1] +
                 colorChannel.z * colors[2];
}`]);
              s.bg = function(v) {
                return l(v, p, d, null, [{ name: "position", type: "vec3" }, { name: "normal", type: "vec3" }]);
              };
            }, { "gl-shader": 132, glslify: 231 }], 75: [function(a, o, s) {
              (function(i) {
                (function() {
                  "use strict";
                  o.exports = function(g, x, b, y, w, _4) {
                    var k = l(g), T2 = u2(g, [{ buffer: k, size: 3 }]), A2 = f(g);
                    A2.attributes.position.location = 0;
                    var S2 = new d(g, A2, k, T2);
                    return S2.update(x, b, y, w, _4), S2;
                  };
                  var l = a("gl-buffer"), u2 = a("gl-vao"), c = a("vectorize-text"), f = a("./shaders").text, h = window || i.global || {}, p = h.__TEXT_CACHE || {};
                  h.__TEXT_CACHE = {};
                  function d(g, x, b, y) {
                    this.gl = g, this.shader = x, this.buffer = b, this.vao = y, this.tickOffset = this.tickCount = this.labelOffset = this.labelCount = null;
                  }
                  var v = d.prototype, m = [0, 0];
                  v.bind = function(g, x, b, y) {
                    this.vao.bind(), this.shader.bind();
                    var w = this.shader.uniforms;
                    w.model = g, w.view = x, w.projection = b, w.pixelScale = y, m[0] = this.gl.drawingBufferWidth, m[1] = this.gl.drawingBufferHeight, this.shader.uniforms.resolution = m;
                  }, v.unbind = function() {
                    this.vao.unbind();
                  }, v.update = function(g, x, b, y, w) {
                    var _4 = [];
                    function k(D2, I2, O2, L2, V2, W2) {
                      var X2 = p[O2];
                      X2 || (X2 = p[O2] = {});
                      var Y2 = X2[I2];
                      Y2 || (Y2 = X2[I2] = function(Q2, Z2) {
                        try {
                          return c(Q2, Z2);
                        } catch (ne) {
                          return console.warn('error vectorizing text:"' + Q2 + '" error:', ne), { cells: [], positions: [] };
                        }
                      }(I2, { triangles: true, font: O2, textAlign: "center", textBaseline: "middle", lineSpacing: V2, styletags: W2 }));
                      for (var K2 = (L2 || 12) / 12, q = Y2.positions, re = Y2.cells, R2 = 0, z = re.length; R2 < z; ++R2) for (var H2 = re[R2], te = 2; te >= 0; --te) {
                        var j = q[H2[te]];
                        _4.push(K2 * j[0], -K2 * j[1], D2);
                      }
                    }
                    for (var T2 = [0, 0, 0], A2 = [0, 0, 0], S2 = [0, 0, 0], C2 = [0, 0, 0], E2 = { breaklines: true, bolds: true, italics: true, subscripts: true, superscripts: true }, F13 = 0; F13 < 3; ++F13) {
                      S2[F13] = _4.length / 3 | 0, k(0.5 * (g[0][F13] + g[1][F13]), x[F13], b[F13], 12, 1.25, E2), C2[F13] = (_4.length / 3 | 0) - S2[F13], T2[F13] = _4.length / 3 | 0;
                      for (var N2 = 0; N2 < y[F13].length; ++N2) y[F13][N2].text && k(y[F13][N2].x, y[F13][N2].text, y[F13][N2].font || w, y[F13][N2].fontSize || 12, 1.25, E2);
                      A2[F13] = (_4.length / 3 | 0) - T2[F13];
                    }
                    this.buffer.update(_4), this.tickOffset = T2, this.tickCount = A2, this.labelOffset = S2, this.labelCount = C2;
                  }, v.drawTicks = function(g, x, b, y, w, _4, k, T2) {
                    this.tickCount[g] && (this.shader.uniforms.axis = _4, this.shader.uniforms.color = w, this.shader.uniforms.angle = b, this.shader.uniforms.scale = x, this.shader.uniforms.offset = y, this.shader.uniforms.alignDir = k, this.shader.uniforms.alignOpt = T2, this.vao.draw(this.gl.TRIANGLES, this.tickCount[g], this.tickOffset[g]));
                  }, v.drawLabel = function(g, x, b, y, w, _4, k, T2) {
                    this.labelCount[g] && (this.shader.uniforms.axis = _4, this.shader.uniforms.color = w, this.shader.uniforms.angle = b, this.shader.uniforms.scale = x, this.shader.uniforms.offset = y, this.shader.uniforms.alignDir = k, this.shader.uniforms.alignOpt = T2, this.vao.draw(this.gl.TRIANGLES, this.labelCount[g], this.labelOffset[g]));
                  }, v.dispose = function() {
                    this.shader.dispose(), this.vao.dispose(), this.buffer.dispose();
                  };
                }).call(this);
              }).call(this, a("_process"));
            }, { "./shaders": 74, _process: 5, "gl-buffer": 78, "gl-vao": 150, "vectorize-text": 311 }], 76: [function(a, o, s) {
              "use strict";
              function i(l, u2) {
                var c = l + "", f = c.indexOf("."), h = 0;
                f >= 0 && (h = c.length - f - 1);
                var p = Math.pow(10, h), d = Math.round(l * u2 * p), v = d + "";
                if (v.indexOf("e") >= 0) return v;
                var m = d / p, g = d % p;
                d < 0 ? (m = 0 | -Math.ceil(m), g = 0 | -g) : (m = 0 | Math.floor(m), g |= 0);
                var x = "" + m;
                if (d < 0 && (x = "-" + x), h) {
                  for (var b = "" + g; b.length < h; ) b = "0" + b;
                  return x + "." + b;
                }
                return x;
              }
              s.create = function(l, u2) {
                for (var c = [], f = 0; f < 3; ++f) {
                  for (var h = [], p = (l[0][f], l[1][f], 0); p * u2[f] <= l[1][f]; ++p) h.push({ x: p * u2[f], text: i(u2[f], p) });
                  for (p = -1; p * u2[f] >= l[0][f]; --p) h.push({ x: p * u2[f], text: i(u2[f], p) });
                  c.push(h);
                }
                return c;
              }, s.equal = function(l, u2) {
                for (var c = 0; c < 3; ++c) {
                  if (l[c].length !== u2[c].length) return false;
                  for (var f = 0; f < l[c].length; ++f) {
                    var h = l[c][f], p = u2[c][f];
                    if (h.x !== p.x || h.text !== p.text || h.font !== p.font || h.fontColor !== p.fontColor || h.fontSize !== p.fontSize || h.dx !== p.dx || h.dy !== p.dy) return false;
                  }
                }
                return true;
              };
            }, {}], 77: [function(a, o, s) {
              "use strict";
              o.exports = function(w, _4, k, T2, A2) {
                var S2 = _4.model || p, C2 = _4.view || p, E2 = _4.projection || p, F13 = _4._ortho || false, N2 = w.bounds, D2 = (A2 = A2 || u2(S2, C2, E2, N2, F13)).axis;
                c(d, C2, S2), c(d, E2, d);
                for (var I2 = b, O2 = 0; O2 < 3; ++O2) I2[O2].lo = 1 / 0, I2[O2].hi = -1 / 0, I2[O2].pixelsPerDataUnit = 1 / 0;
                var L2 = i(f(d, d));
                f(d, d);
                for (var V2 = 0; V2 < 3; ++V2) {
                  var W2 = (V2 + 1) % 3, X2 = (V2 + 2) % 3, Y2 = y;
                  e: for (O2 = 0; O2 < 2; ++O2) {
                    var K2 = [];
                    if (D2[V2] < 0 != !!O2) {
                      Y2[V2] = N2[O2][V2];
                      for (var q = 0; q < 2; ++q) {
                        Y2[W2] = N2[q ^ O2][W2];
                        for (var re = 0; re < 2; ++re) Y2[X2] = N2[re ^ q ^ O2][X2], K2.push(Y2.slice());
                      }
                      var R2 = F13 ? 5 : 4;
                      for (q = R2; q === R2; ++q) {
                        if (K2.length === 0) continue e;
                        K2 = l.positive(K2, L2[q]);
                      }
                      for (q = 0; q < K2.length; ++q) {
                        X2 = K2[q];
                        var z = x(y, d, X2, k, T2);
                        for (re = 0; re < 3; ++re) I2[re].lo = Math.min(I2[re].lo, X2[re]), I2[re].hi = Math.max(I2[re].hi, X2[re]), re !== V2 && (I2[re].pixelsPerDataUnit = Math.min(I2[re].pixelsPerDataUnit, Math.abs(z[re])));
                      }
                    }
                  }
                }
                return I2;
              };
              var i = a("extract-frustum-planes"), l = a("split-polygon"), u2 = a("./lib/cube.js"), c = a("gl-mat4/multiply"), f = a("gl-mat4/transpose"), h = a("gl-vec4/transformMat4"), p = new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]), d = new Float32Array(16);
              function v(w, _4, k) {
                this.lo = w, this.hi = _4, this.pixelsPerDataUnit = k;
              }
              var m = [0, 0, 0, 1], g = [0, 0, 0, 1];
              function x(w, _4, k, T2, A2) {
                for (var S2 = 0; S2 < 3; ++S2) {
                  for (var C2 = m, E2 = g, F13 = 0; F13 < 3; ++F13) E2[F13] = C2[F13] = k[F13];
                  E2[3] = C2[3] = 1, E2[S2] += 1, h(E2, E2, _4), E2[3] < 0 && (w[S2] = 1 / 0), C2[S2] -= 1, h(C2, C2, _4), C2[3] < 0 && (w[S2] = 1 / 0);
                  var N2 = (C2[0] / C2[3] - E2[0] / E2[3]) * T2, D2 = (C2[1] / C2[3] - E2[1] / E2[3]) * A2;
                  w[S2] = 0.25 * Math.sqrt(N2 * N2 + D2 * D2);
                }
                return w;
              }
              var b = [new v(1 / 0, -1 / 0, 1 / 0), new v(1 / 0, -1 / 0, 1 / 0), new v(1 / 0, -1 / 0, 1 / 0)], y = [0, 0, 0];
            }, { "./lib/cube.js": 72, "extract-frustum-planes": 67, "gl-mat4/multiply": 100, "gl-mat4/transpose": 109, "gl-vec4/transformMat4": 221, "split-polygon": 300 }], 78: [function(a, o, s) {
              "use strict";
              var i = a("typedarray-pool"), l = a("ndarray-ops"), u2 = a("ndarray"), c = ["uint8", "uint8_clamped", "uint16", "uint32", "int8", "int16", "int32", "float32"];
              function f(v, m, g, x, b) {
                this.gl = v, this.type = m, this.handle = g, this.length = x, this.usage = b;
              }
              var h = f.prototype;
              function p(v, m, g, x, b, y) {
                var w = b.length * b.BYTES_PER_ELEMENT;
                if (y < 0) return v.bufferData(m, b, x), w;
                if (w + y > g) throw new Error("gl-buffer: If resizing buffer, must not specify offset");
                return v.bufferSubData(m, y, b), g;
              }
              function d(v, m) {
                for (var g = i.malloc(v.length, m), x = v.length, b = 0; b < x; ++b) g[b] = v[b];
                return g;
              }
              h.bind = function() {
                this.gl.bindBuffer(this.type, this.handle);
              }, h.unbind = function() {
                this.gl.bindBuffer(this.type, null);
              }, h.dispose = function() {
                this.gl.deleteBuffer(this.handle);
              }, h.update = function(v, m) {
                if (typeof m != "number" && (m = -1), this.bind(), typeof v == "object" && v.shape !== void 0) {
                  var g = v.dtype;
                  if (c.indexOf(g) < 0 && (g = "float32"), this.type === this.gl.ELEMENT_ARRAY_BUFFER && (g = gl.getExtension("OES_element_index_uint") && g !== "uint16" ? "uint32" : "uint16"), g === v.dtype && function(w, _4) {
                    for (var k = 1, T2 = _4.length - 1; T2 >= 0; --T2) {
                      if (_4[T2] !== k) return false;
                      k *= w[T2];
                    }
                    return true;
                  }(v.shape, v.stride)) v.offset === 0 && v.data.length === v.shape[0] ? this.length = p(this.gl, this.type, this.length, this.usage, v.data, m) : this.length = p(this.gl, this.type, this.length, this.usage, v.data.subarray(v.offset, v.shape[0]), m);
                  else {
                    var x = i.malloc(v.size, g), b = u2(x, v.shape);
                    l.assign(b, v), this.length = p(this.gl, this.type, this.length, this.usage, m < 0 ? x : x.subarray(0, v.size), m), i.free(x);
                  }
                } else if (Array.isArray(v)) {
                  var y;
                  y = this.type === this.gl.ELEMENT_ARRAY_BUFFER ? d(v, "uint16") : d(v, "float32"), this.length = p(this.gl, this.type, this.length, this.usage, m < 0 ? y : y.subarray(0, v.length), m), i.free(y);
                } else if (typeof v == "object" && typeof v.length == "number") this.length = p(this.gl, this.type, this.length, this.usage, v, m);
                else {
                  if (typeof v != "number" && v !== void 0) throw new Error("gl-buffer: Invalid data type");
                  if (m >= 0) throw new Error("gl-buffer: Cannot specify offset when resizing buffer");
                  (v |= 0) <= 0 && (v = 1), this.gl.bufferData(this.type, 0 | v, this.usage), this.length = v;
                }
              }, o.exports = function(v, m, g, x) {
                if (g = g || v.ARRAY_BUFFER, x = x || v.DYNAMIC_DRAW, g !== v.ARRAY_BUFFER && g !== v.ELEMENT_ARRAY_BUFFER) throw new Error("gl-buffer: Invalid type for webgl buffer, must be either gl.ARRAY_BUFFER or gl.ELEMENT_ARRAY_BUFFER");
                if (x !== v.DYNAMIC_DRAW && x !== v.STATIC_DRAW && x !== v.STREAM_DRAW) throw new Error("gl-buffer: Invalid usage for buffer, must be either gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW");
                var b = v.createBuffer(), y = new f(v, g, b, 0, x);
                return y.update(m), y;
              };
            }, { ndarray: 259, "ndarray-ops": 254, "typedarray-pool": 308 }], 79: [function(a, o, s) {
              "use strict";
              var i = a("gl-vec3");
              o.exports = function(u2, c) {
                var f = u2.positions, h = u2.vectors, p = { positions: [], vertexIntensity: [], vertexIntensityBounds: u2.vertexIntensityBounds, vectors: [], cells: [], coneOffset: u2.coneOffset, colormap: u2.colormap };
                if (u2.positions.length === 0) return c && (c[0] = [0, 0, 0], c[1] = [0, 0, 0]), p;
                for (var d = 0, v = 1 / 0, m = -1 / 0, g = 1 / 0, x = -1 / 0, b = 1 / 0, y = -1 / 0, w = null, _4 = null, k = [], T2 = 1 / 0, A2 = false, S2 = 0; S2 < f.length; S2++) {
                  var C2 = f[S2];
                  v = Math.min(C2[0], v), m = Math.max(C2[0], m), g = Math.min(C2[1], g), x = Math.max(C2[1], x), b = Math.min(C2[2], b), y = Math.max(C2[2], y);
                  var E2 = h[S2];
                  if (i.length(E2) > d && (d = i.length(E2)), S2) {
                    var F13 = 2 * i.distance(w, C2) / (i.length(_4) + i.length(E2));
                    F13 ? (T2 = Math.min(T2, F13), A2 = false) : A2 = true;
                  }
                  A2 || (w = C2, _4 = E2), k.push(E2);
                }
                var N2 = [v, g, b], D2 = [m, x, y];
                c && (c[0] = N2, c[1] = D2), d === 0 && (d = 1);
                var I2 = 1 / d;
                isFinite(T2) || (T2 = 1), p.vectorScale = T2;
                var O2 = u2.coneSize || 0.5;
                u2.absoluteConeSize && (O2 = u2.absoluteConeSize * I2), p.coneScale = O2, S2 = 0;
                for (var L2 = 0; S2 < f.length; S2++) for (var V2 = (C2 = f[S2])[0], W2 = C2[1], X2 = C2[2], Y2 = k[S2], K2 = i.length(Y2) * I2, q = 0; q < 8; q++) {
                  p.positions.push([V2, W2, X2, L2++]), p.positions.push([V2, W2, X2, L2++]), p.positions.push([V2, W2, X2, L2++]), p.positions.push([V2, W2, X2, L2++]), p.positions.push([V2, W2, X2, L2++]), p.positions.push([V2, W2, X2, L2++]), p.vectors.push(Y2), p.vectors.push(Y2), p.vectors.push(Y2), p.vectors.push(Y2), p.vectors.push(Y2), p.vectors.push(Y2), p.vertexIntensity.push(K2, K2, K2), p.vertexIntensity.push(K2, K2, K2);
                  var re = p.positions.length;
                  p.cells.push([re - 6, re - 5, re - 4], [re - 3, re - 2, re - 1]);
                }
                return p;
              };
              var l = a("./lib/shaders");
              o.exports.createMesh = a("./create_mesh"), o.exports.createConeMesh = function(u2, c) {
                return o.exports.createMesh(u2, c, { shaders: l, traceType: "cone" });
              };
            }, { "./create_mesh": 80, "./lib/shaders": 81, "gl-vec3": 169 }], 80: [function(a, o, s) {
              "use strict";
              var i = a("gl-shader"), l = a("gl-buffer"), u2 = a("gl-vao"), c = a("gl-texture2d"), f = a("gl-mat4/multiply"), h = a("gl-mat4/invert"), p = a("ndarray"), d = a("colormap"), v = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
              function m(y, w, _4, k, T2, A2, S2, C2, E2, F13, N2) {
                this.gl = y, this.pixelRatio = 1, this.cells = [], this.positions = [], this.intensity = [], this.texture = w, this.dirty = true, this.triShader = _4, this.pickShader = k, this.trianglePositions = T2, this.triangleVectors = A2, this.triangleColors = C2, this.triangleUVs = E2, this.triangleIds = S2, this.triangleVAO = F13, this.triangleCount = 0, this.pickId = 1, this.bounds = [[1 / 0, 1 / 0, 1 / 0], [-1 / 0, -1 / 0, -1 / 0]], this.clipBounds = [[-1 / 0, -1 / 0, -1 / 0], [1 / 0, 1 / 0, 1 / 0]], this.lightPosition = [1e5, 1e5, 0], this.ambientLight = 0.8, this.diffuseLight = 0.8, this.specularLight = 2, this.roughness = 0.5, this.fresnel = 1.5, this.opacity = 1, this.traceType = N2, this.tubeScale = 1, this.coneScale = 2, this.vectorScale = 1, this.coneOffset = 0.25, this._model = v, this._view = v, this._projection = v, this._resolution = [1, 1];
              }
              var g = m.prototype;
              function x(y, w) {
                var _4 = i(y, w.meshShader.vertex, w.meshShader.fragment, null, w.meshShader.attributes);
                return _4.attributes.position.location = 0, _4.attributes.color.location = 2, _4.attributes.uv.location = 3, _4.attributes.vector.location = 4, _4;
              }
              function b(y, w) {
                var _4 = i(y, w.pickShader.vertex, w.pickShader.fragment, null, w.pickShader.attributes);
                return _4.attributes.position.location = 0, _4.attributes.id.location = 1, _4.attributes.vector.location = 4, _4;
              }
              g.isOpaque = function() {
                return this.opacity >= 1;
              }, g.isTransparent = function() {
                return this.opacity < 1;
              }, g.pickSlots = 1, g.setPickBase = function(y) {
                this.pickId = y;
              }, g.update = function(y) {
                y = y || {};
                var w = this.gl;
                this.dirty = true, "lightPosition" in y && (this.lightPosition = y.lightPosition), "opacity" in y && (this.opacity = y.opacity), "ambient" in y && (this.ambientLight = y.ambient), "diffuse" in y && (this.diffuseLight = y.diffuse), "specular" in y && (this.specularLight = y.specular), "roughness" in y && (this.roughness = y.roughness), "fresnel" in y && (this.fresnel = y.fresnel), y.tubeScale !== void 0 && (this.tubeScale = y.tubeScale), y.vectorScale !== void 0 && (this.vectorScale = y.vectorScale), y.coneScale !== void 0 && (this.coneScale = y.coneScale), y.coneOffset !== void 0 && (this.coneOffset = y.coneOffset), y.colormap && (this.texture.shape = [256, 256], this.texture.minFilter = w.LINEAR_MIPMAP_LINEAR, this.texture.magFilter = w.LINEAR, this.texture.setPixels(function(te) {
                  for (var j = d({ colormap: te, nshades: 256, format: "rgba" }), Q2 = new Uint8Array(1024), Z2 = 0; Z2 < 256; ++Z2) {
                    for (var ne = j[Z2], ae = 0; ae < 3; ++ae) Q2[4 * Z2 + ae] = ne[ae];
                    Q2[4 * Z2 + 3] = 255 * ne[3];
                  }
                  return p(Q2, [256, 256, 4], [4, 0, 1]);
                }(y.colormap)), this.texture.generateMipmap());
                var _4 = y.cells, k = y.positions, T2 = y.vectors;
                if (k && _4 && T2) {
                  var A2 = [], S2 = [], C2 = [], E2 = [], F13 = [];
                  this.cells = _4, this.positions = k, this.vectors = T2;
                  var N2 = y.meshColor || [1, 1, 1, 1], D2 = y.vertexIntensity, I2 = 1 / 0, O2 = -1 / 0;
                  if (D2) if (y.vertexIntensityBounds) I2 = +y.vertexIntensityBounds[0], O2 = +y.vertexIntensityBounds[1];
                  else for (var L2 = 0; L2 < D2.length; ++L2) {
                    var V2 = D2[L2];
                    I2 = Math.min(I2, V2), O2 = Math.max(O2, V2);
                  }
                  else for (L2 = 0; L2 < k.length; ++L2) V2 = k[L2][2], I2 = Math.min(I2, V2), O2 = Math.max(O2, V2);
                  for (this.intensity = D2 || function(te) {
                    for (var j = te.length, Q2 = new Array(j), Z2 = 0; Z2 < j; ++Z2) Q2[Z2] = te[Z2][2];
                    return Q2;
                  }(k), this.bounds = [[1 / 0, 1 / 0, 1 / 0], [-1 / 0, -1 / 0, -1 / 0]], L2 = 0; L2 < k.length; ++L2) for (var W2 = k[L2], X2 = 0; X2 < 3; ++X2) !isNaN(W2[X2]) && isFinite(W2[X2]) && (this.bounds[0][X2] = Math.min(this.bounds[0][X2], W2[X2]), this.bounds[1][X2] = Math.max(this.bounds[1][X2], W2[X2]));
                  var Y2 = 0;
                  e: for (L2 = 0; L2 < _4.length; ++L2) {
                    var K2 = _4[L2];
                    switch (K2.length) {
                      case 3:
                        for (X2 = 0; X2 < 3; ++X2) {
                          W2 = k[re = K2[X2]];
                          for (var q = 0; q < 3; ++q) if (isNaN(W2[q]) || !isFinite(W2[q])) continue e;
                        }
                        for (X2 = 0; X2 < 3; ++X2) {
                          var re;
                          W2 = k[re = K2[2 - X2]], A2.push(W2[0], W2[1], W2[2], W2[3]);
                          var R2 = T2[re];
                          S2.push(R2[0], R2[1], R2[2], R2[3] || 0);
                          var z, H2 = N2;
                          H2.length === 3 ? C2.push(H2[0], H2[1], H2[2], 1) : C2.push(H2[0], H2[1], H2[2], H2[3]), z = D2 ? [(D2[re] - I2) / (O2 - I2), 0] : [(W2[2] - I2) / (O2 - I2), 0], E2.push(z[0], z[1]), F13.push(L2);
                        }
                        Y2 += 1;
                    }
                  }
                  this.triangleCount = Y2, this.trianglePositions.update(A2), this.triangleVectors.update(S2), this.triangleColors.update(C2), this.triangleUVs.update(E2), this.triangleIds.update(new Uint32Array(F13));
                }
              }, g.drawTransparent = g.draw = function(y) {
                y = y || {};
                for (var w = this.gl, _4 = y.model || v, k = y.view || v, T2 = y.projection || v, A2 = [[-1e6, -1e6, -1e6], [1e6, 1e6, 1e6]], S2 = 0; S2 < 3; ++S2) A2[0][S2] = Math.max(A2[0][S2], this.clipBounds[0][S2]), A2[1][S2] = Math.min(A2[1][S2], this.clipBounds[1][S2]);
                var C2 = { model: _4, view: k, projection: T2, inverseModel: v.slice(), clipBounds: A2, kambient: this.ambientLight, kdiffuse: this.diffuseLight, kspecular: this.specularLight, roughness: this.roughness, fresnel: this.fresnel, eyePosition: [0, 0, 0], lightPosition: [0, 0, 0], opacity: this.opacity, tubeScale: this.tubeScale, vectorScale: this.vectorScale, coneScale: this.coneScale, coneOffset: this.coneOffset, texture: 0 };
                C2.inverseModel = h(C2.inverseModel, C2.model), w.disable(w.CULL_FACE), this.texture.bind(0);
                var E2 = new Array(16);
                for (f(E2, C2.view, C2.model), f(E2, C2.projection, E2), h(E2, E2), S2 = 0; S2 < 3; ++S2) C2.eyePosition[S2] = E2[12 + S2] / E2[15];
                var F13 = E2[15];
                for (S2 = 0; S2 < 3; ++S2) F13 += this.lightPosition[S2] * E2[4 * S2 + 3];
                for (S2 = 0; S2 < 3; ++S2) {
                  for (var N2 = E2[12 + S2], D2 = 0; D2 < 3; ++D2) N2 += E2[4 * D2 + S2] * this.lightPosition[D2];
                  C2.lightPosition[S2] = N2 / F13;
                }
                if (this.triangleCount > 0) {
                  var I2 = this.triShader;
                  I2.bind(), I2.uniforms = C2, this.triangleVAO.bind(), w.drawArrays(w.TRIANGLES, 0, 3 * this.triangleCount), this.triangleVAO.unbind();
                }
              }, g.drawPick = function(y) {
                y = y || {};
                for (var w = this.gl, _4 = y.model || v, k = y.view || v, T2 = y.projection || v, A2 = [[-1e6, -1e6, -1e6], [1e6, 1e6, 1e6]], S2 = 0; S2 < 3; ++S2) A2[0][S2] = Math.max(A2[0][S2], this.clipBounds[0][S2]), A2[1][S2] = Math.min(A2[1][S2], this.clipBounds[1][S2]);
                this._model = [].slice.call(_4), this._view = [].slice.call(k), this._projection = [].slice.call(T2), this._resolution = [w.drawingBufferWidth, w.drawingBufferHeight];
                var C2 = { model: _4, view: k, projection: T2, clipBounds: A2, tubeScale: this.tubeScale, vectorScale: this.vectorScale, coneScale: this.coneScale, coneOffset: this.coneOffset, pickId: this.pickId / 255 }, E2 = this.pickShader;
                E2.bind(), E2.uniforms = C2, this.triangleCount > 0 && (this.triangleVAO.bind(), w.drawArrays(w.TRIANGLES, 0, 3 * this.triangleCount), this.triangleVAO.unbind());
              }, g.pick = function(y) {
                if (!y || y.id !== this.pickId) return null;
                var w = y.value[0] + 256 * y.value[1] + 65536 * y.value[2], _4 = this.cells[w], k = this.positions[_4[1]].slice(0, 3), T2 = { position: k, dataCoordinate: k, index: Math.floor(_4[1] / 48) };
                return this.traceType === "cone" ? T2.index = Math.floor(_4[1] / 48) : this.traceType === "streamtube" && (T2.intensity = this.intensity[_4[1]], T2.velocity = this.vectors[_4[1]].slice(0, 3), T2.divergence = this.vectors[_4[1]][3], T2.index = w), T2;
              }, g.dispose = function() {
                this.texture.dispose(), this.triShader.dispose(), this.pickShader.dispose(), this.triangleVAO.dispose(), this.trianglePositions.dispose(), this.triangleVectors.dispose(), this.triangleColors.dispose(), this.triangleUVs.dispose(), this.triangleIds.dispose();
              }, o.exports = function(y, w, _4) {
                var k = _4.shaders;
                arguments.length === 1 && (y = (w = y).gl);
                var T2 = x(y, k), A2 = b(y, k), S2 = c(y, p(new Uint8Array([255, 255, 255, 255]), [1, 1, 4]));
                S2.generateMipmap(), S2.minFilter = y.LINEAR_MIPMAP_LINEAR, S2.magFilter = y.LINEAR;
                var C2 = l(y), E2 = l(y), F13 = l(y), N2 = l(y), D2 = l(y), I2 = u2(y, [{ buffer: C2, type: y.FLOAT, size: 4 }, { buffer: D2, type: y.UNSIGNED_BYTE, size: 4, normalized: true }, { buffer: F13, type: y.FLOAT, size: 4 }, { buffer: N2, type: y.FLOAT, size: 2 }, { buffer: E2, type: y.FLOAT, size: 4 }]), O2 = new m(y, S2, T2, A2, C2, E2, D2, F13, N2, I2, _4.traceType || "cone");
                return O2.update(w), O2;
              };
            }, { colormap: 53, "gl-buffer": 78, "gl-mat4/invert": 98, "gl-mat4/multiply": 100, "gl-shader": 132, "gl-texture2d": 146, "gl-vao": 150, ndarray: 259 }], 81: [function(a, o, s) {
              var i = a("glslify"), l = i([`precision highp float;

precision highp float;
#define GLSLIFY 1

vec3 getOrthogonalVector(vec3 v) {
  // Return up-vector for only-z vector.
  // 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).
  // From the above if-statement we have ||a|| > 0  U  ||b|| > 0.
  // Assign z = 0, x = -b, y = a:
  // a*-b + b*a + c*0 = -ba + ba + 0 = 0
  if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {
    return normalize(vec3(-v.y, v.x, 0.0));
  } else {
    return normalize(vec3(0.0, v.z, -v.y));
  }
}

// Calculate the cone vertex and normal at the given index.
//
// The returned vertex is for a cone with its top at origin and height of 1.0,
// pointing in the direction of the vector attribute.
//
// Each cone is made up of a top vertex, a center base vertex and base perimeter vertices.
// These vertices are used to make up the triangles of the cone by the following:
//   segment + 0 top vertex
//   segment + 1 perimeter vertex a+1
//   segment + 2 perimeter vertex a
//   segment + 3 center base vertex
//   segment + 4 perimeter vertex a
//   segment + 5 perimeter vertex a+1
// Where segment is the number of the radial segment * 6 and a is the angle at that radial segment.
// To go from index to segment, floor(index / 6)
// To go from segment to angle, 2*pi * (segment/segmentCount)
// To go from index to segment index, index - (segment*6)
//
vec3 getConePosition(vec3 d, float rawIndex, float coneOffset, out vec3 normal) {

  const float segmentCount = 8.0;

  float index = rawIndex - floor(rawIndex /
    (segmentCount * 6.0)) *
    (segmentCount * 6.0);

  float segment = floor(0.001 + index/6.0);
  float segmentIndex = index - (segment*6.0);

  normal = -normalize(d);

  if (segmentIndex > 2.99 && segmentIndex < 3.01) {
    return mix(vec3(0.0), -d, coneOffset);
  }

  float nextAngle = (
    (segmentIndex > 0.99 &&  segmentIndex < 1.01) ||
    (segmentIndex > 4.99 &&  segmentIndex < 5.01)
  ) ? 1.0 : 0.0;
  float angle = 2.0 * 3.14159 * ((segment + nextAngle) / segmentCount);

  vec3 v1 = mix(d, vec3(0.0), coneOffset);
  vec3 v2 = v1 - d;

  vec3 u = getOrthogonalVector(d);
  vec3 v = normalize(cross(u, d));

  vec3 x = u * cos(angle) * length(d)*0.25;
  vec3 y = v * sin(angle) * length(d)*0.25;
  vec3 v3 = v2 + x + y;
  if (segmentIndex < 3.0) {
    vec3 tx = u * sin(angle);
    vec3 ty = v * -cos(angle);
    vec3 tangent = tx + ty;
    normal = normalize(cross(v3 - v1, tangent));
  }

  if (segmentIndex == 0.0) {
    return mix(d, vec3(0.0), coneOffset);
  }
  return v3;
}

attribute vec3 vector;
attribute vec4 color, position;
attribute vec2 uv;

uniform float vectorScale, coneScale, coneOffset;
uniform mat4 model, view, projection, inverseModel;
uniform vec3 eyePosition, lightPosition;

varying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, f_position;
varying vec4 f_color;
varying vec2 f_uv;

void main() {
  // Scale the vector magnitude to stay constant with
  // model & view changes.
  vec3 normal;
  vec3 XYZ = getConePosition(mat3(model) * ((vectorScale * coneScale) * vector), position.w, coneOffset, normal);
  vec4 conePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0);

  //Lighting geometry parameters
  vec4 cameraCoordinate = view * conePosition;
  cameraCoordinate.xyz /= cameraCoordinate.w;
  f_lightDirection = lightPosition - cameraCoordinate.xyz;
  f_eyeDirection   = eyePosition - cameraCoordinate.xyz;
  f_normal = normalize((vec4(normal, 0.0) * inverseModel).xyz);

  // vec4 m_position  = model * vec4(conePosition, 1.0);
  vec4 t_position  = view * conePosition;
  gl_Position      = projection * t_position;

  f_color          = color;
  f_data           = conePosition.xyz;
  f_position       = position.xyz;
  f_uv             = uv;
}
`]), u2 = i([`#extension GL_OES_standard_derivatives : enable

precision highp float;
#define GLSLIFY 1

float beckmannDistribution(float x, float roughness) {
  float NdotH = max(x, 0.0001);
  float cos2Alpha = NdotH * NdotH;
  float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;
  float roughness2 = roughness * roughness;
  float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;
  return exp(tan2Alpha / roughness2) / denom;
}

float cookTorranceSpecular(
  vec3 lightDirection,
  vec3 viewDirection,
  vec3 surfaceNormal,
  float roughness,
  float fresnel) {

  float VdotN = max(dot(viewDirection, surfaceNormal), 0.0);
  float LdotN = max(dot(lightDirection, surfaceNormal), 0.0);

  //Half angle vector
  vec3 H = normalize(lightDirection + viewDirection);

  //Geometric term
  float NdotH = max(dot(surfaceNormal, H), 0.0);
  float VdotH = max(dot(viewDirection, H), 0.000001);
  float LdotH = max(dot(lightDirection, H), 0.000001);
  float G1 = (2.0 * NdotH * VdotN) / VdotH;
  float G2 = (2.0 * NdotH * LdotN) / LdotH;
  float G = min(1.0, min(G1, G2));
  
  //Distribution term
  float D = beckmannDistribution(NdotH, roughness);

  //Fresnel term
  float F = pow(1.0 - VdotN, fresnel);

  //Multiply terms and done
  return  G * F * D / max(3.14159265 * VdotN, 0.000001);
}

bool outOfRange(float a, float b, float p) {
  return ((p > max(a, b)) || 
          (p < min(a, b)));
}

bool outOfRange(vec2 a, vec2 b, vec2 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y));
}

bool outOfRange(vec3 a, vec3 b, vec3 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y) ||
          outOfRange(a.z, b.z, p.z));
}

bool outOfRange(vec4 a, vec4 b, vec4 p) {
  return outOfRange(a.xyz, b.xyz, p.xyz);
}

uniform vec3 clipBounds[2];
uniform float roughness, fresnel, kambient, kdiffuse, kspecular, opacity;
uniform sampler2D texture;

varying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, f_position;
varying vec4 f_color;
varying vec2 f_uv;

void main() {
  if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard;
  vec3 N = normalize(f_normal);
  vec3 L = normalize(f_lightDirection);
  vec3 V = normalize(f_eyeDirection);

  if(gl_FrontFacing) {
    N = -N;
  }

  float specular = min(1.0, max(0.0, cookTorranceSpecular(L, V, N, roughness, fresnel)));
  float diffuse  = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);

  vec4 surfaceColor = f_color * texture2D(texture, f_uv);
  vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular,  1.0);

  gl_FragColor = litColor * opacity;
}
`]), c = i([`precision highp float;

precision highp float;
#define GLSLIFY 1

vec3 getOrthogonalVector(vec3 v) {
  // Return up-vector for only-z vector.
  // 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).
  // From the above if-statement we have ||a|| > 0  U  ||b|| > 0.
  // Assign z = 0, x = -b, y = a:
  // a*-b + b*a + c*0 = -ba + ba + 0 = 0
  if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {
    return normalize(vec3(-v.y, v.x, 0.0));
  } else {
    return normalize(vec3(0.0, v.z, -v.y));
  }
}

// Calculate the cone vertex and normal at the given index.
//
// The returned vertex is for a cone with its top at origin and height of 1.0,
// pointing in the direction of the vector attribute.
//
// Each cone is made up of a top vertex, a center base vertex and base perimeter vertices.
// These vertices are used to make up the triangles of the cone by the following:
//   segment + 0 top vertex
//   segment + 1 perimeter vertex a+1
//   segment + 2 perimeter vertex a
//   segment + 3 center base vertex
//   segment + 4 perimeter vertex a
//   segment + 5 perimeter vertex a+1
// Where segment is the number of the radial segment * 6 and a is the angle at that radial segment.
// To go from index to segment, floor(index / 6)
// To go from segment to angle, 2*pi * (segment/segmentCount)
// To go from index to segment index, index - (segment*6)
//
vec3 getConePosition(vec3 d, float rawIndex, float coneOffset, out vec3 normal) {

  const float segmentCount = 8.0;

  float index = rawIndex - floor(rawIndex /
    (segmentCount * 6.0)) *
    (segmentCount * 6.0);

  float segment = floor(0.001 + index/6.0);
  float segmentIndex = index - (segment*6.0);

  normal = -normalize(d);

  if (segmentIndex > 2.99 && segmentIndex < 3.01) {
    return mix(vec3(0.0), -d, coneOffset);
  }

  float nextAngle = (
    (segmentIndex > 0.99 &&  segmentIndex < 1.01) ||
    (segmentIndex > 4.99 &&  segmentIndex < 5.01)
  ) ? 1.0 : 0.0;
  float angle = 2.0 * 3.14159 * ((segment + nextAngle) / segmentCount);

  vec3 v1 = mix(d, vec3(0.0), coneOffset);
  vec3 v2 = v1 - d;

  vec3 u = getOrthogonalVector(d);
  vec3 v = normalize(cross(u, d));

  vec3 x = u * cos(angle) * length(d)*0.25;
  vec3 y = v * sin(angle) * length(d)*0.25;
  vec3 v3 = v2 + x + y;
  if (segmentIndex < 3.0) {
    vec3 tx = u * sin(angle);
    vec3 ty = v * -cos(angle);
    vec3 tangent = tx + ty;
    normal = normalize(cross(v3 - v1, tangent));
  }

  if (segmentIndex == 0.0) {
    return mix(d, vec3(0.0), coneOffset);
  }
  return v3;
}

attribute vec4 vector;
attribute vec4 position;
attribute vec4 id;

uniform mat4 model, view, projection;
uniform float vectorScale, coneScale, coneOffset;

varying vec3 f_position;
varying vec4 f_id;

void main() {
  vec3 normal;
  vec3 XYZ = getConePosition(mat3(model) * ((vectorScale * coneScale) * vector.xyz), position.w, coneOffset, normal);
  vec4 conePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0);
  gl_Position = projection * view * conePosition;
  f_id        = id;
  f_position  = position.xyz;
}
`]), f = i([`precision highp float;
#define GLSLIFY 1

bool outOfRange(float a, float b, float p) {
  return ((p > max(a, b)) || 
          (p < min(a, b)));
}

bool outOfRange(vec2 a, vec2 b, vec2 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y));
}

bool outOfRange(vec3 a, vec3 b, vec3 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y) ||
          outOfRange(a.z, b.z, p.z));
}

bool outOfRange(vec4 a, vec4 b, vec4 p) {
  return outOfRange(a.xyz, b.xyz, p.xyz);
}

uniform vec3  clipBounds[2];
uniform float pickId;

varying vec3 f_position;
varying vec4 f_id;

void main() {
  if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard;

  gl_FragColor = vec4(pickId, f_id.xyz);
}`]);
              s.meshShader = { vertex: l, fragment: u2, attributes: [{ name: "position", type: "vec4" }, { name: "color", type: "vec4" }, { name: "uv", type: "vec2" }, { name: "vector", type: "vec3" }] }, s.pickShader = { vertex: c, fragment: f, attributes: [{ name: "position", type: "vec4" }, { name: "id", type: "vec4" }, { name: "vector", type: "vec3" }] };
            }, { glslify: 231 }], 82: [function(a, o, s) {
              o.exports = { 0: "NONE", 1: "ONE", 2: "LINE_LOOP", 3: "LINE_STRIP", 4: "TRIANGLES", 5: "TRIANGLE_STRIP", 6: "TRIANGLE_FAN", 256: "DEPTH_BUFFER_BIT", 512: "NEVER", 513: "LESS", 514: "EQUAL", 515: "LEQUAL", 516: "GREATER", 517: "NOTEQUAL", 518: "GEQUAL", 519: "ALWAYS", 768: "SRC_COLOR", 769: "ONE_MINUS_SRC_COLOR", 770: "SRC_ALPHA", 771: "ONE_MINUS_SRC_ALPHA", 772: "DST_ALPHA", 773: "ONE_MINUS_DST_ALPHA", 774: "DST_COLOR", 775: "ONE_MINUS_DST_COLOR", 776: "SRC_ALPHA_SATURATE", 1024: "STENCIL_BUFFER_BIT", 1028: "FRONT", 1029: "BACK", 1032: "FRONT_AND_BACK", 1280: "INVALID_ENUM", 1281: "INVALID_VALUE", 1282: "INVALID_OPERATION", 1285: "OUT_OF_MEMORY", 1286: "INVALID_FRAMEBUFFER_OPERATION", 2304: "CW", 2305: "CCW", 2849: "LINE_WIDTH", 2884: "CULL_FACE", 2885: "CULL_FACE_MODE", 2886: "FRONT_FACE", 2928: "DEPTH_RANGE", 2929: "DEPTH_TEST", 2930: "DEPTH_WRITEMASK", 2931: "DEPTH_CLEAR_VALUE", 2932: "DEPTH_FUNC", 2960: "STENCIL_TEST", 2961: "STENCIL_CLEAR_VALUE", 2962: "STENCIL_FUNC", 2963: "STENCIL_VALUE_MASK", 2964: "STENCIL_FAIL", 2965: "STENCIL_PASS_DEPTH_FAIL", 2966: "STENCIL_PASS_DEPTH_PASS", 2967: "STENCIL_REF", 2968: "STENCIL_WRITEMASK", 2978: "VIEWPORT", 3024: "DITHER", 3042: "BLEND", 3088: "SCISSOR_BOX", 3089: "SCISSOR_TEST", 3106: "COLOR_CLEAR_VALUE", 3107: "COLOR_WRITEMASK", 3317: "UNPACK_ALIGNMENT", 3333: "PACK_ALIGNMENT", 3379: "MAX_TEXTURE_SIZE", 3386: "MAX_VIEWPORT_DIMS", 3408: "SUBPIXEL_BITS", 3410: "RED_BITS", 3411: "GREEN_BITS", 3412: "BLUE_BITS", 3413: "ALPHA_BITS", 3414: "DEPTH_BITS", 3415: "STENCIL_BITS", 3553: "TEXTURE_2D", 4352: "DONT_CARE", 4353: "FASTEST", 4354: "NICEST", 5120: "BYTE", 5121: "UNSIGNED_BYTE", 5122: "SHORT", 5123: "UNSIGNED_SHORT", 5124: "INT", 5125: "UNSIGNED_INT", 5126: "FLOAT", 5386: "INVERT", 5890: "TEXTURE", 6401: "STENCIL_INDEX", 6402: "DEPTH_COMPONENT", 6406: "ALPHA", 6407: "RGB", 6408: "RGBA", 6409: "LUMINANCE", 6410: "LUMINANCE_ALPHA", 7680: "KEEP", 7681: "REPLACE", 7682: "INCR", 7683: "DECR", 7936: "VENDOR", 7937: "RENDERER", 7938: "VERSION", 9728: "NEAREST", 9729: "LINEAR", 9984: "NEAREST_MIPMAP_NEAREST", 9985: "LINEAR_MIPMAP_NEAREST", 9986: "NEAREST_MIPMAP_LINEAR", 9987: "LINEAR_MIPMAP_LINEAR", 10240: "TEXTURE_MAG_FILTER", 10241: "TEXTURE_MIN_FILTER", 10242: "TEXTURE_WRAP_S", 10243: "TEXTURE_WRAP_T", 10497: "REPEAT", 10752: "POLYGON_OFFSET_UNITS", 16384: "COLOR_BUFFER_BIT", 32769: "CONSTANT_COLOR", 32770: "ONE_MINUS_CONSTANT_COLOR", 32771: "CONSTANT_ALPHA", 32772: "ONE_MINUS_CONSTANT_ALPHA", 32773: "BLEND_COLOR", 32774: "FUNC_ADD", 32777: "BLEND_EQUATION_RGB", 32778: "FUNC_SUBTRACT", 32779: "FUNC_REVERSE_SUBTRACT", 32819: "UNSIGNED_SHORT_4_4_4_4", 32820: "UNSIGNED_SHORT_5_5_5_1", 32823: "POLYGON_OFFSET_FILL", 32824: "POLYGON_OFFSET_FACTOR", 32854: "RGBA4", 32855: "RGB5_A1", 32873: "TEXTURE_BINDING_2D", 32926: "SAMPLE_ALPHA_TO_COVERAGE", 32928: "SAMPLE_COVERAGE", 32936: "SAMPLE_BUFFERS", 32937: "SAMPLES", 32938: "SAMPLE_COVERAGE_VALUE", 32939: "SAMPLE_COVERAGE_INVERT", 32968: "BLEND_DST_RGB", 32969: "BLEND_SRC_RGB", 32970: "BLEND_DST_ALPHA", 32971: "BLEND_SRC_ALPHA", 33071: "CLAMP_TO_EDGE", 33170: "GENERATE_MIPMAP_HINT", 33189: "DEPTH_COMPONENT16", 33306: "DEPTH_STENCIL_ATTACHMENT", 33635: "UNSIGNED_SHORT_5_6_5", 33648: "MIRRORED_REPEAT", 33901: "ALIASED_POINT_SIZE_RANGE", 33902: "ALIASED_LINE_WIDTH_RANGE", 33984: "TEXTURE0", 33985: "TEXTURE1", 33986: "TEXTURE2", 33987: "TEXTURE3", 33988: "TEXTURE4", 33989: "TEXTURE5", 33990: "TEXTURE6", 33991: "TEXTURE7", 33992: "TEXTURE8", 33993: "TEXTURE9", 33994: "TEXTURE10", 33995: "TEXTURE11", 33996: "TEXTURE12", 33997: "TEXTURE13", 33998: "TEXTURE14", 33999: "TEXTURE15", 34e3: "TEXTURE16", 34001: "TEXTURE17", 34002: "TEXTURE18", 34003: "TEXTURE19", 34004: "TEXTURE20", 34005: "TEXTURE21", 34006: "TEXTURE22", 34007: "TEXTURE23", 34008: "TEXTURE24", 34009: "TEXTURE25", 34010: "TEXTURE26", 34011: "TEXTURE27", 34012: "TEXTURE28", 34013: "TEXTURE29", 34014: "TEXTURE30", 34015: "TEXTURE31", 34016: "ACTIVE_TEXTURE", 34024: "MAX_RENDERBUFFER_SIZE", 34041: "DEPTH_STENCIL", 34055: "INCR_WRAP", 34056: "DECR_WRAP", 34067: "TEXTURE_CUBE_MAP", 34068: "TEXTURE_BINDING_CUBE_MAP", 34069: "TEXTURE_CUBE_MAP_POSITIVE_X", 34070: "TEXTURE_CUBE_MAP_NEGATIVE_X", 34071: "TEXTURE_CUBE_MAP_POSITIVE_Y", 34072: "TEXTURE_CUBE_MAP_NEGATIVE_Y", 34073: "TEXTURE_CUBE_MAP_POSITIVE_Z", 34074: "TEXTURE_CUBE_MAP_NEGATIVE_Z", 34076: "MAX_CUBE_MAP_TEXTURE_SIZE", 34338: "VERTEX_ATTRIB_ARRAY_ENABLED", 34339: "VERTEX_ATTRIB_ARRAY_SIZE", 34340: "VERTEX_ATTRIB_ARRAY_STRIDE", 34341: "VERTEX_ATTRIB_ARRAY_TYPE", 34342: "CURRENT_VERTEX_ATTRIB", 34373: "VERTEX_ATTRIB_ARRAY_POINTER", 34466: "NUM_COMPRESSED_TEXTURE_FORMATS", 34467: "COMPRESSED_TEXTURE_FORMATS", 34660: "BUFFER_SIZE", 34661: "BUFFER_USAGE", 34816: "STENCIL_BACK_FUNC", 34817: "STENCIL_BACK_FAIL", 34818: "STENCIL_BACK_PASS_DEPTH_FAIL", 34819: "STENCIL_BACK_PASS_DEPTH_PASS", 34877: "BLEND_EQUATION_ALPHA", 34921: "MAX_VERTEX_ATTRIBS", 34922: "VERTEX_ATTRIB_ARRAY_NORMALIZED", 34930: "MAX_TEXTURE_IMAGE_UNITS", 34962: "ARRAY_BUFFER", 34963: "ELEMENT_ARRAY_BUFFER", 34964: "ARRAY_BUFFER_BINDING", 34965: "ELEMENT_ARRAY_BUFFER_BINDING", 34975: "VERTEX_ATTRIB_ARRAY_BUFFER_BINDING", 35040: "STREAM_DRAW", 35044: "STATIC_DRAW", 35048: "DYNAMIC_DRAW", 35632: "FRAGMENT_SHADER", 35633: "VERTEX_SHADER", 35660: "MAX_VERTEX_TEXTURE_IMAGE_UNITS", 35661: "MAX_COMBINED_TEXTURE_IMAGE_UNITS", 35663: "SHADER_TYPE", 35664: "FLOAT_VEC2", 35665: "FLOAT_VEC3", 35666: "FLOAT_VEC4", 35667: "INT_VEC2", 35668: "INT_VEC3", 35669: "INT_VEC4", 35670: "BOOL", 35671: "BOOL_VEC2", 35672: "BOOL_VEC3", 35673: "BOOL_VEC4", 35674: "FLOAT_MAT2", 35675: "FLOAT_MAT3", 35676: "FLOAT_MAT4", 35678: "SAMPLER_2D", 35680: "SAMPLER_CUBE", 35712: "DELETE_STATUS", 35713: "COMPILE_STATUS", 35714: "LINK_STATUS", 35715: "VALIDATE_STATUS", 35716: "INFO_LOG_LENGTH", 35717: "ATTACHED_SHADERS", 35718: "ACTIVE_UNIFORMS", 35719: "ACTIVE_UNIFORM_MAX_LENGTH", 35720: "SHADER_SOURCE_LENGTH", 35721: "ACTIVE_ATTRIBUTES", 35722: "ACTIVE_ATTRIBUTE_MAX_LENGTH", 35724: "SHADING_LANGUAGE_VERSION", 35725: "CURRENT_PROGRAM", 36003: "STENCIL_BACK_REF", 36004: "STENCIL_BACK_VALUE_MASK", 36005: "STENCIL_BACK_WRITEMASK", 36006: "FRAMEBUFFER_BINDING", 36007: "RENDERBUFFER_BINDING", 36048: "FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE", 36049: "FRAMEBUFFER_ATTACHMENT_OBJECT_NAME", 36050: "FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL", 36051: "FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE", 36053: "FRAMEBUFFER_COMPLETE", 36054: "FRAMEBUFFER_INCOMPLETE_ATTACHMENT", 36055: "FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT", 36057: "FRAMEBUFFER_INCOMPLETE_DIMENSIONS", 36061: "FRAMEBUFFER_UNSUPPORTED", 36064: "COLOR_ATTACHMENT0", 36096: "DEPTH_ATTACHMENT", 36128: "STENCIL_ATTACHMENT", 36160: "FRAMEBUFFER", 36161: "RENDERBUFFER", 36162: "RENDERBUFFER_WIDTH", 36163: "RENDERBUFFER_HEIGHT", 36164: "RENDERBUFFER_INTERNAL_FORMAT", 36168: "STENCIL_INDEX8", 36176: "RENDERBUFFER_RED_SIZE", 36177: "RENDERBUFFER_GREEN_SIZE", 36178: "RENDERBUFFER_BLUE_SIZE", 36179: "RENDERBUFFER_ALPHA_SIZE", 36180: "RENDERBUFFER_DEPTH_SIZE", 36181: "RENDERBUFFER_STENCIL_SIZE", 36194: "RGB565", 36336: "LOW_FLOAT", 36337: "MEDIUM_FLOAT", 36338: "HIGH_FLOAT", 36339: "LOW_INT", 36340: "MEDIUM_INT", 36341: "HIGH_INT", 36346: "SHADER_COMPILER", 36347: "MAX_VERTEX_UNIFORM_VECTORS", 36348: "MAX_VARYING_VECTORS", 36349: "MAX_FRAGMENT_UNIFORM_VECTORS", 37440: "UNPACK_FLIP_Y_WEBGL", 37441: "UNPACK_PREMULTIPLY_ALPHA_WEBGL", 37442: "CONTEXT_LOST_WEBGL", 37443: "UNPACK_COLORSPACE_CONVERSION_WEBGL", 37444: "BROWSER_DEFAULT_WEBGL" };
            }, {}], 83: [function(a, o, s) {
              var i = a("./1.0/numbers");
              o.exports = function(l) {
                return i[l];
              };
            }, { "./1.0/numbers": 82 }], 84: [function(a, o, s) {
              "use strict";
              o.exports = function(m) {
                var g = m.gl, x = i(g), b = l(g, [{ buffer: x, type: g.FLOAT, size: 3, offset: 0, stride: 40 }, { buffer: x, type: g.FLOAT, size: 4, offset: 12, stride: 40 }, { buffer: x, type: g.FLOAT, size: 3, offset: 28, stride: 40 }]), y = u2(g);
                y.attributes.position.location = 0, y.attributes.color.location = 1, y.attributes.offset.location = 2;
                var w = new f(g, x, b, y);
                return w.update(m), w;
              };
              var i = a("gl-buffer"), l = a("gl-vao"), u2 = a("./shaders/index"), c = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
              function f(m, g, x, b) {
                this.gl = m, this.shader = b, this.buffer = g, this.vao = x, this.pixelRatio = 1, this.bounds = [[1 / 0, 1 / 0, 1 / 0], [-1 / 0, -1 / 0, -1 / 0]], this.clipBounds = [[-1 / 0, -1 / 0, -1 / 0], [1 / 0, 1 / 0, 1 / 0]], this.lineWidth = [1, 1, 1], this.capSize = [10, 10, 10], this.lineCount = [0, 0, 0], this.lineOffset = [0, 0, 0], this.opacity = 1, this.hasAlpha = false;
              }
              var h = f.prototype;
              function p(m, g) {
                for (var x = 0; x < 3; ++x) m[0][x] = Math.min(m[0][x], g[x]), m[1][x] = Math.max(m[1][x], g[x]);
              }
              h.isOpaque = function() {
                return !this.hasAlpha;
              }, h.isTransparent = function() {
                return this.hasAlpha;
              }, h.drawTransparent = h.draw = function(m) {
                var g = this.gl, x = this.shader.uniforms;
                this.shader.bind();
                var b = x.view = m.view || c, y = x.projection = m.projection || c;
                x.model = m.model || c, x.clipBounds = this.clipBounds, x.opacity = this.opacity;
                var w = b[12], _4 = b[13], k = b[14], T2 = b[15], A2 = (m._ortho ? 2 : 1) * this.pixelRatio * (y[3] * w + y[7] * _4 + y[11] * k + y[15] * T2) / g.drawingBufferHeight;
                this.vao.bind();
                for (var S2 = 0; S2 < 3; ++S2) g.lineWidth(this.lineWidth[S2] * this.pixelRatio), x.capSize = this.capSize[S2] * A2, this.lineCount[S2] && g.drawArrays(g.LINES, this.lineOffset[S2], this.lineCount[S2]);
                this.vao.unbind();
              };
              var d = function() {
                for (var m = new Array(3), g = 0; g < 3; ++g) {
                  for (var x = [], b = 1; b <= 2; ++b) for (var y = -1; y <= 1; y += 2) {
                    var w = [0, 0, 0];
                    w[(b + g) % 3] = y, x.push(w);
                  }
                  m[g] = x;
                }
                return m;
              }();
              function v(m, g, x, b) {
                for (var y = d[b], w = 0; w < y.length; ++w) {
                  var _4 = y[w];
                  m.push(g[0], g[1], g[2], x[0], x[1], x[2], x[3], _4[0], _4[1], _4[2]);
                }
                return y.length;
              }
              h.update = function(m) {
                "lineWidth" in (m = m || {}) && (this.lineWidth = m.lineWidth, Array.isArray(this.lineWidth) || (this.lineWidth = [this.lineWidth, this.lineWidth, this.lineWidth])), "capSize" in m && (this.capSize = m.capSize, Array.isArray(this.capSize) || (this.capSize = [this.capSize, this.capSize, this.capSize])), this.hasAlpha = false, "opacity" in m && (this.opacity = +m.opacity, this.opacity < 1 && (this.hasAlpha = true));
                var g = m.color || [[0, 0, 0], [0, 0, 0], [0, 0, 0]], x = m.position, b = m.error;
                if (Array.isArray(g[0]) || (g = [g, g, g]), x && b) {
                  var y = [], w = x.length, _4 = 0;
                  this.bounds = [[1 / 0, 1 / 0, 1 / 0], [-1 / 0, -1 / 0, -1 / 0]], this.lineCount = [0, 0, 0];
                  for (var k = 0; k < 3; ++k) {
                    this.lineOffset[k] = _4;
                    e: for (var T2 = 0; T2 < w; ++T2) {
                      for (var A2 = x[T2], S2 = 0; S2 < 3; ++S2) if (isNaN(A2[S2]) || !isFinite(A2[S2])) continue e;
                      var C2 = b[T2], E2 = g[k];
                      if (Array.isArray(E2[0]) && (E2 = g[T2]), E2.length === 3 ? E2 = [E2[0], E2[1], E2[2], 1] : E2.length === 4 && (E2 = [E2[0], E2[1], E2[2], E2[3]], !this.hasAlpha && E2[3] < 1 && (this.hasAlpha = true)), !isNaN(C2[0][k]) && !isNaN(C2[1][k])) {
                        var F13;
                        C2[0][k] < 0 && ((F13 = A2.slice())[k] += C2[0][k], y.push(A2[0], A2[1], A2[2], E2[0], E2[1], E2[2], E2[3], 0, 0, 0, F13[0], F13[1], F13[2], E2[0], E2[1], E2[2], E2[3], 0, 0, 0), p(this.bounds, F13), _4 += 2 + v(y, F13, E2, k)), C2[1][k] > 0 && ((F13 = A2.slice())[k] += C2[1][k], y.push(A2[0], A2[1], A2[2], E2[0], E2[1], E2[2], E2[3], 0, 0, 0, F13[0], F13[1], F13[2], E2[0], E2[1], E2[2], E2[3], 0, 0, 0), p(this.bounds, F13), _4 += 2 + v(y, F13, E2, k));
                      }
                    }
                    this.lineCount[k] = _4 - this.lineOffset[k];
                  }
                  this.buffer.update(y);
                }
              }, h.dispose = function() {
                this.shader.dispose(), this.buffer.dispose(), this.vao.dispose();
              };
            }, { "./shaders/index": 85, "gl-buffer": 78, "gl-vao": 150 }], 85: [function(a, o, s) {
              "use strict";
              var i = a("glslify"), l = a("gl-shader"), u2 = i([`precision highp float;
#define GLSLIFY 1

attribute vec3 position, offset;
attribute vec4 color;
uniform mat4 model, view, projection;
uniform float capSize;
varying vec4 fragColor;
varying vec3 fragPosition;

void main() {
  vec4 worldPosition  = model * vec4(position, 1.0);
  worldPosition       = (worldPosition / worldPosition.w) + vec4(capSize * offset, 0.0);
  gl_Position         = projection * view * worldPosition;
  fragColor           = color;
  fragPosition        = position;
}`]), c = i([`precision highp float;
#define GLSLIFY 1

bool outOfRange(float a, float b, float p) {
  return ((p > max(a, b)) || 
          (p < min(a, b)));
}

bool outOfRange(vec2 a, vec2 b, vec2 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y));
}

bool outOfRange(vec3 a, vec3 b, vec3 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y) ||
          outOfRange(a.z, b.z, p.z));
}

bool outOfRange(vec4 a, vec4 b, vec4 p) {
  return outOfRange(a.xyz, b.xyz, p.xyz);
}

uniform vec3 clipBounds[2];
uniform float opacity;
varying vec3 fragPosition;
varying vec4 fragColor;

void main() {
  if (
    outOfRange(clipBounds[0], clipBounds[1], fragPosition) ||
    fragColor.a * opacity == 0.
  ) discard;

  gl_FragColor = opacity * fragColor;
}`]);
              o.exports = function(f) {
                return l(f, u2, c, null, [{ name: "position", type: "vec3" }, { name: "color", type: "vec4" }, { name: "offset", type: "vec3" }]);
              };
            }, { "gl-shader": 132, glslify: 231 }], 86: [function(a, o, s) {
              "use strict";
              var i = a("gl-texture2d");
              o.exports = function(w, _4, k, T2) {
                l || (l = w.FRAMEBUFFER_UNSUPPORTED, u2 = w.FRAMEBUFFER_INCOMPLETE_ATTACHMENT, c = w.FRAMEBUFFER_INCOMPLETE_DIMENSIONS, f = w.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT);
                var A2 = w.getExtension("WEBGL_draw_buffers");
                if (!h && A2 && function(I2, O2) {
                  var L2 = I2.getParameter(O2.MAX_COLOR_ATTACHMENTS_WEBGL);
                  h = new Array(L2 + 1);
                  for (var V2 = 0; V2 <= L2; ++V2) {
                    for (var W2 = new Array(L2), X2 = 0; X2 < V2; ++X2) W2[X2] = I2.COLOR_ATTACHMENT0 + X2;
                    for (X2 = V2; X2 < L2; ++X2) W2[X2] = I2.NONE;
                    h[V2] = W2;
                  }
                }(w, A2), Array.isArray(_4) && (T2 = k, k = 0 | _4[1], _4 = 0 | _4[0]), typeof _4 != "number") throw new Error("gl-fbo: Missing shape parameter");
                var S2 = w.getParameter(w.MAX_RENDERBUFFER_SIZE);
                if (_4 < 0 || _4 > S2 || k < 0 || k > S2) throw new Error("gl-fbo: Parameters are too large for FBO");
                var C2 = 1;
                if ("color" in (T2 = T2 || {})) {
                  if ((C2 = Math.max(0 | T2.color, 0)) < 0) throw new Error("gl-fbo: Must specify a nonnegative number of colors");
                  if (C2 > 1) {
                    if (!A2) throw new Error("gl-fbo: Multiple draw buffer extension not supported");
                    if (C2 > w.getParameter(A2.MAX_COLOR_ATTACHMENTS_WEBGL)) throw new Error("gl-fbo: Context does not support " + C2 + " draw buffers");
                  }
                }
                var E2 = w.UNSIGNED_BYTE, F13 = w.getExtension("OES_texture_float");
                if (T2.float && C2 > 0) {
                  if (!F13) throw new Error("gl-fbo: Context does not support floating point textures");
                  E2 = w.FLOAT;
                } else T2.preferFloat && C2 > 0 && F13 && (E2 = w.FLOAT);
                var N2 = true;
                "depth" in T2 && (N2 = !!T2.depth);
                var D2 = false;
                return "stencil" in T2 && (D2 = !!T2.stencil), new x(w, _4, k, E2, C2, N2, D2, A2);
              };
              var l, u2, c, f, h = null;
              function p(w) {
                return [w.getParameter(w.FRAMEBUFFER_BINDING), w.getParameter(w.RENDERBUFFER_BINDING), w.getParameter(w.TEXTURE_BINDING_2D)];
              }
              function d(w, _4) {
                w.bindFramebuffer(w.FRAMEBUFFER, _4[0]), w.bindRenderbuffer(w.RENDERBUFFER, _4[1]), w.bindTexture(w.TEXTURE_2D, _4[2]);
              }
              function v(w) {
                switch (w) {
                  case l:
                    throw new Error("gl-fbo: Framebuffer unsupported");
                  case u2:
                    throw new Error("gl-fbo: Framebuffer incomplete attachment");
                  case c:
                    throw new Error("gl-fbo: Framebuffer incomplete dimensions");
                  case f:
                    throw new Error("gl-fbo: Framebuffer incomplete missing attachment");
                  default:
                    throw new Error("gl-fbo: Framebuffer failed for unspecified reason");
                }
              }
              function m(w, _4, k, T2, A2, S2) {
                if (!T2) return null;
                var C2 = i(w, _4, k, A2, T2);
                return C2.magFilter = w.NEAREST, C2.minFilter = w.NEAREST, C2.mipSamples = 1, C2.bind(), w.framebufferTexture2D(w.FRAMEBUFFER, S2, w.TEXTURE_2D, C2.handle, 0), C2;
              }
              function g(w, _4, k, T2, A2) {
                var S2 = w.createRenderbuffer();
                return w.bindRenderbuffer(w.RENDERBUFFER, S2), w.renderbufferStorage(w.RENDERBUFFER, T2, _4, k), w.framebufferRenderbuffer(w.FRAMEBUFFER, A2, w.RENDERBUFFER, S2), S2;
              }
              function x(w, _4, k, T2, A2, S2, C2, E2) {
                this.gl = w, this._shape = [0 | _4, 0 | k], this._destroyed = false, this._ext = E2, this.color = new Array(A2);
                for (var F13 = 0; F13 < A2; ++F13) this.color[F13] = null;
                this._color_rb = null, this.depth = null, this._depth_rb = null, this._colorType = T2, this._useDepth = S2, this._useStencil = C2;
                var N2 = this, D2 = [0 | _4, 0 | k];
                Object.defineProperties(D2, { 0: { get: function() {
                  return N2._shape[0];
                }, set: function(I2) {
                  return N2.width = I2;
                } }, 1: { get: function() {
                  return N2._shape[1];
                }, set: function(I2) {
                  return N2.height = I2;
                } } }), this._shapeVector = D2, function(I2) {
                  var O2 = p(I2.gl), L2 = I2.gl, V2 = I2.handle = L2.createFramebuffer(), W2 = I2._shape[0], X2 = I2._shape[1], Y2 = I2.color.length, K2 = I2._ext, q = I2._useStencil, re = I2._useDepth, R2 = I2._colorType;
                  L2.bindFramebuffer(L2.FRAMEBUFFER, V2);
                  for (var z = 0; z < Y2; ++z) I2.color[z] = m(L2, W2, X2, R2, L2.RGBA, L2.COLOR_ATTACHMENT0 + z);
                  Y2 === 0 ? (I2._color_rb = g(L2, W2, X2, L2.RGBA4, L2.COLOR_ATTACHMENT0), K2 && K2.drawBuffersWEBGL(h[0])) : Y2 > 1 && K2.drawBuffersWEBGL(h[Y2]);
                  var H2 = L2.getExtension("WEBGL_depth_texture");
                  H2 ? q ? I2.depth = m(L2, W2, X2, H2.UNSIGNED_INT_24_8_WEBGL, L2.DEPTH_STENCIL, L2.DEPTH_STENCIL_ATTACHMENT) : re && (I2.depth = m(L2, W2, X2, L2.UNSIGNED_SHORT, L2.DEPTH_COMPONENT, L2.DEPTH_ATTACHMENT)) : re && q ? I2._depth_rb = g(L2, W2, X2, L2.DEPTH_STENCIL, L2.DEPTH_STENCIL_ATTACHMENT) : re ? I2._depth_rb = g(L2, W2, X2, L2.DEPTH_COMPONENT16, L2.DEPTH_ATTACHMENT) : q && (I2._depth_rb = g(L2, W2, X2, L2.STENCIL_INDEX, L2.STENCIL_ATTACHMENT));
                  var te = L2.checkFramebufferStatus(L2.FRAMEBUFFER);
                  if (te !== L2.FRAMEBUFFER_COMPLETE) {
                    for (I2._destroyed = true, L2.bindFramebuffer(L2.FRAMEBUFFER, null), L2.deleteFramebuffer(I2.handle), I2.handle = null, I2.depth && (I2.depth.dispose(), I2.depth = null), I2._depth_rb && (L2.deleteRenderbuffer(I2._depth_rb), I2._depth_rb = null), z = 0; z < I2.color.length; ++z) I2.color[z].dispose(), I2.color[z] = null;
                    I2._color_rb && (L2.deleteRenderbuffer(I2._color_rb), I2._color_rb = null), d(L2, O2), v(te);
                  }
                  d(L2, O2);
                }(this);
              }
              var b = x.prototype;
              function y(w, _4, k) {
                if (w._destroyed) throw new Error("gl-fbo: Can't resize destroyed FBO");
                if (w._shape[0] !== _4 || w._shape[1] !== k) {
                  var T2 = w.gl, A2 = T2.getParameter(T2.MAX_RENDERBUFFER_SIZE);
                  if (_4 < 0 || _4 > A2 || k < 0 || k > A2) throw new Error("gl-fbo: Can't resize FBO, invalid dimensions");
                  w._shape[0] = _4, w._shape[1] = k;
                  for (var S2 = p(T2), C2 = 0; C2 < w.color.length; ++C2) w.color[C2].shape = w._shape;
                  w._color_rb && (T2.bindRenderbuffer(T2.RENDERBUFFER, w._color_rb), T2.renderbufferStorage(T2.RENDERBUFFER, T2.RGBA4, w._shape[0], w._shape[1])), w.depth && (w.depth.shape = w._shape), w._depth_rb && (T2.bindRenderbuffer(T2.RENDERBUFFER, w._depth_rb), w._useDepth && w._useStencil ? T2.renderbufferStorage(T2.RENDERBUFFER, T2.DEPTH_STENCIL, w._shape[0], w._shape[1]) : w._useDepth ? T2.renderbufferStorage(T2.RENDERBUFFER, T2.DEPTH_COMPONENT16, w._shape[0], w._shape[1]) : w._useStencil && T2.renderbufferStorage(T2.RENDERBUFFER, T2.STENCIL_INDEX, w._shape[0], w._shape[1])), T2.bindFramebuffer(T2.FRAMEBUFFER, w.handle);
                  var E2 = T2.checkFramebufferStatus(T2.FRAMEBUFFER);
                  E2 !== T2.FRAMEBUFFER_COMPLETE && (w.dispose(), d(T2, S2), v(E2)), d(T2, S2);
                }
              }
              Object.defineProperties(b, { shape: { get: function() {
                return this._destroyed ? [0, 0] : this._shapeVector;
              }, set: function(w) {
                if (Array.isArray(w) || (w = [0 | w, 0 | w]), w.length !== 2) throw new Error("gl-fbo: Shape vector must be length 2");
                var _4 = 0 | w[0], k = 0 | w[1];
                return y(this, _4, k), [_4, k];
              }, enumerable: false }, width: { get: function() {
                return this._destroyed ? 0 : this._shape[0];
              }, set: function(w) {
                return y(this, w |= 0, this._shape[1]), w;
              }, enumerable: false }, height: { get: function() {
                return this._destroyed ? 0 : this._shape[1];
              }, set: function(w) {
                return w |= 0, y(this, this._shape[0], w), w;
              }, enumerable: false } }), b.bind = function() {
                if (!this._destroyed) {
                  var w = this.gl;
                  w.bindFramebuffer(w.FRAMEBUFFER, this.handle), w.viewport(0, 0, this._shape[0], this._shape[1]);
                }
              }, b.dispose = function() {
                if (!this._destroyed) {
                  this._destroyed = true;
                  var w = this.gl;
                  w.deleteFramebuffer(this.handle), this.handle = null, this.depth && (this.depth.dispose(), this.depth = null), this._depth_rb && (w.deleteRenderbuffer(this._depth_rb), this._depth_rb = null);
                  for (var _4 = 0; _4 < this.color.length; ++_4) this.color[_4].dispose(), this.color[_4] = null;
                  this._color_rb && (w.deleteRenderbuffer(this._color_rb), this._color_rb = null);
                }
              };
            }, { "gl-texture2d": 146 }], 87: [function(a, o, s) {
              var i = a("sprintf-js").sprintf, l = a("gl-constants/lookup"), u2 = a("glsl-shader-name"), c = a("add-line-numbers");
              o.exports = function(f, h, p) {
                "use strict";
                var d = u2(h) || "of unknown name (see npm glsl-shader-name)", v = "unknown type";
                p !== void 0 && (v = p === l.FRAGMENT_SHADER ? "fragment" : "vertex");
                for (var m = i(`Error compiling %s shader %s:
`, v, d), g = i("%s%s", m, f), x = f.split(`
`), b = {}, y = 0; y < x.length; y++) {
                  var w = x[y];
                  if (w !== "" && w !== "\0") {
                    var _4 = parseInt(w.split(":")[2]);
                    if (isNaN(_4)) throw new Error(i("Could not parse error: %s", w));
                    b[_4] = w;
                  }
                }
                var k = c(h).split(`
`);
                for (y = 0; y < k.length; y++) if (b[y + 3] || b[y + 2] || b[y + 1]) {
                  var T2 = k[y];
                  if (m += T2 + `
`, b[y + 1]) {
                    var A2 = b[y + 1];
                    A2 = A2.substr(A2.split(":", 3).join(":").length + 1).trim(), m += i(`^^^ %s

`, A2);
                  }
                }
                return { long: m.trim(), short: g.trim() };
              };
            }, { "add-line-numbers": 9, "gl-constants/lookup": 83, "glsl-shader-name": 223, "sprintf-js": 301 }], 88: [function(a, o, s) {
              "use strict";
              o.exports = function(g, x) {
                var b = g.gl, y = c(b, h.vertex, h.fragment), w = c(b, h.pickVertex, h.pickFragment), _4 = f(b), k = f(b), T2 = f(b), A2 = f(b), S2 = new p(g, y, w, _4, k, T2, A2);
                return S2.update(x), g.addObject(S2), S2;
              };
              var i = a("binary-search-bounds"), l = a("iota-array"), u2 = a("typedarray-pool"), c = a("gl-shader"), f = a("gl-buffer"), h = a("./lib/shaders");
              function p(g, x, b, y, w, _4, k) {
                this.plot = g, this.shader = x, this.pickShader = b, this.positionBuffer = y, this.weightBuffer = w, this.colorBuffer = _4, this.idBuffer = k, this.xData = [], this.yData = [], this.shape = [0, 0], this.bounds = [1 / 0, 1 / 0, -1 / 0, -1 / 0], this.pickOffset = 0;
              }
              var d, v = p.prototype, m = [0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1];
              v.draw = (d = [1, 0, 0, 0, 1, 0, 0, 0, 1], function() {
                var g = this.plot, x = this.shader, b = this.bounds, y = this.numVertices;
                if (!(y <= 0)) {
                  var w = g.gl, _4 = g.dataBox, k = b[2] - b[0], T2 = b[3] - b[1], A2 = _4[2] - _4[0], S2 = _4[3] - _4[1];
                  d[0] = 2 * k / A2, d[4] = 2 * T2 / S2, d[6] = 2 * (b[0] - _4[0]) / A2 - 1, d[7] = 2 * (b[1] - _4[1]) / S2 - 1, x.bind();
                  var C2 = x.uniforms;
                  C2.viewTransform = d, C2.shape = this.shape;
                  var E2 = x.attributes;
                  this.positionBuffer.bind(), E2.position.pointer(), this.weightBuffer.bind(), E2.weight.pointer(w.UNSIGNED_BYTE, false), this.colorBuffer.bind(), E2.color.pointer(w.UNSIGNED_BYTE, true), w.drawArrays(w.TRIANGLES, 0, y);
                }
              }), v.drawPick = /* @__PURE__ */ function() {
                var g = [1, 0, 0, 0, 1, 0, 0, 0, 1], x = [0, 0, 0, 0];
                return function(b) {
                  var y = this.plot, w = this.pickShader, _4 = this.bounds, k = this.numVertices;
                  if (!(k <= 0)) {
                    var T2 = y.gl, A2 = y.dataBox, S2 = _4[2] - _4[0], C2 = _4[3] - _4[1], E2 = A2[2] - A2[0], F13 = A2[3] - A2[1];
                    g[0] = 2 * S2 / E2, g[4] = 2 * C2 / F13, g[6] = 2 * (_4[0] - A2[0]) / E2 - 1, g[7] = 2 * (_4[1] - A2[1]) / F13 - 1;
                    for (var N2 = 0; N2 < 4; ++N2) x[N2] = b >> 8 * N2 & 255;
                    this.pickOffset = b, w.bind();
                    var D2 = w.uniforms;
                    D2.viewTransform = g, D2.pickOffset = x, D2.shape = this.shape;
                    var I2 = w.attributes;
                    return this.positionBuffer.bind(), I2.position.pointer(), this.weightBuffer.bind(), I2.weight.pointer(T2.UNSIGNED_BYTE, false), this.idBuffer.bind(), I2.pickId.pointer(T2.UNSIGNED_BYTE, false), T2.drawArrays(T2.TRIANGLES, 0, k), b + this.shape[0] * this.shape[1];
                  }
                };
              }(), v.pick = function(g, x, b) {
                var y = this.pickOffset, w = this.shape[0] * this.shape[1];
                if (b < y || b >= y + w) return null;
                var _4 = b - y, k = this.xData, T2 = this.yData;
                return { object: this, pointId: _4, dataCoord: [k[_4 % this.shape[0]], T2[_4 / this.shape[0] | 0]] };
              }, v.update = function(g) {
                var x = (g = g || {}).shape || [0, 0], b = g.x || l(x[0]), y = g.y || l(x[1]), w = g.z || new Float32Array(x[0] * x[1]), _4 = g.zsmooth !== false;
                this.xData = b, this.yData = y;
                var k, T2, A2, S2, C2 = g.colorLevels || [0], E2 = g.colorValues || [0, 0, 0, 1], F13 = C2.length, N2 = this.bounds;
                _4 ? (k = N2[0] = b[0], T2 = N2[1] = y[0], A2 = N2[2] = b[b.length - 1], S2 = N2[3] = y[y.length - 1]) : (k = N2[0] = b[0] + (b[1] - b[0]) / 2, T2 = N2[1] = y[0] + (y[1] - y[0]) / 2, A2 = N2[2] = b[b.length - 1] + (b[b.length - 1] - b[b.length - 2]) / 2, S2 = N2[3] = y[y.length - 1] + (y[y.length - 1] - y[y.length - 2]) / 2);
                var D2 = 1 / (A2 - k), I2 = 1 / (S2 - T2), O2 = x[0], L2 = x[1];
                this.shape = [O2, L2];
                var V2 = (_4 ? (O2 - 1) * (L2 - 1) : O2 * L2) * (m.length >>> 1);
                this.numVertices = V2;
                for (var W2 = u2.mallocUint8(4 * V2), X2 = u2.mallocFloat32(2 * V2), Y2 = u2.mallocUint8(2 * V2), K2 = u2.mallocUint32(V2), q = 0, re = _4 ? O2 - 1 : O2, R2 = _4 ? L2 - 1 : L2, z = 0; z < R2; ++z) {
                  var H2, te;
                  _4 ? (H2 = I2 * (y[z] - T2), te = I2 * (y[z + 1] - T2)) : (H2 = z < L2 - 1 ? I2 * (y[z] - (y[z + 1] - y[z]) / 2 - T2) : I2 * (y[z] - (y[z] - y[z - 1]) / 2 - T2), te = z < L2 - 1 ? I2 * (y[z] + (y[z + 1] - y[z]) / 2 - T2) : I2 * (y[z] + (y[z] - y[z - 1]) / 2 - T2));
                  for (var j = 0; j < re; ++j) {
                    var Q2, Z2;
                    _4 ? (Q2 = D2 * (b[j] - k), Z2 = D2 * (b[j + 1] - k)) : (Q2 = j < O2 - 1 ? D2 * (b[j] - (b[j + 1] - b[j]) / 2 - k) : D2 * (b[j] - (b[j] - b[j - 1]) / 2 - k), Z2 = j < O2 - 1 ? D2 * (b[j] + (b[j + 1] - b[j]) / 2 - k) : D2 * (b[j] + (b[j] - b[j - 1]) / 2 - k));
                    for (var ne = 0; ne < m.length; ne += 2) {
                      var ae, ue, le, ce, se = m[ne], he = m[ne + 1], me = w[_4 ? (z + he) * O2 + (j + se) : z * O2 + j], we = i.le(C2, me);
                      if (we < 0) ae = E2[0], ue = E2[1], le = E2[2], ce = E2[3];
                      else if (we === F13 - 1) ae = E2[4 * F13 - 4], ue = E2[4 * F13 - 3], le = E2[4 * F13 - 2], ce = E2[4 * F13 - 1];
                      else {
                        var be = (me - C2[we]) / (C2[we + 1] - C2[we]), Ae = 1 - be, pe = 4 * we, ve = 4 * (we + 1);
                        ae = Ae * E2[pe] + be * E2[ve], ue = Ae * E2[pe + 1] + be * E2[ve + 1], le = Ae * E2[pe + 2] + be * E2[ve + 2], ce = Ae * E2[pe + 3] + be * E2[ve + 3];
                      }
                      W2[4 * q] = 255 * ae, W2[4 * q + 1] = 255 * ue, W2[4 * q + 2] = 255 * le, W2[4 * q + 3] = 255 * ce, X2[2 * q] = 0.5 * Q2 + 0.5 * Z2, X2[2 * q + 1] = 0.5 * H2 + 0.5 * te, Y2[2 * q] = se, Y2[2 * q + 1] = he, K2[q] = z * O2 + j, q += 1;
                    }
                  }
                }
                this.positionBuffer.update(X2), this.weightBuffer.update(Y2), this.colorBuffer.update(W2), this.idBuffer.update(K2), u2.free(X2), u2.free(W2), u2.free(Y2), u2.free(K2);
              }, v.dispose = function() {
                this.shader.dispose(), this.pickShader.dispose(), this.positionBuffer.dispose(), this.weightBuffer.dispose(), this.colorBuffer.dispose(), this.idBuffer.dispose(), this.plot.removeObject(this);
              };
            }, { "./lib/shaders": 89, "binary-search-bounds": 31, "gl-buffer": 78, "gl-shader": 132, "iota-array": 235, "typedarray-pool": 308 }], 89: [function(a, o, s) {
              "use strict";
              var i = a("glslify");
              o.exports = { fragment: i([`precision lowp float;
#define GLSLIFY 1
varying vec4 fragColor;
void main() {
  gl_FragColor = vec4(fragColor.rgb * fragColor.a, fragColor.a);
}
`]), vertex: i([`precision mediump float;
#define GLSLIFY 1

attribute vec2 position;
attribute vec4 color;
attribute vec2 weight;

uniform vec2 shape;
uniform mat3 viewTransform;

varying vec4 fragColor;

void main() {
  vec3 vPosition = viewTransform * vec3( position + (weight-.5)/(shape-1.) , 1.0);
  fragColor = color;
  gl_Position = vec4(vPosition.xy, 0, vPosition.z);
}
`]), pickFragment: i([`precision mediump float;
#define GLSLIFY 1

varying vec4 fragId;
varying vec2 vWeight;

uniform vec2 shape;
uniform vec4 pickOffset;

void main() {
  vec2 d = step(.5, vWeight);
  vec4 id = fragId + pickOffset;
  id.x += d.x + d.y*shape.x;

  id.y += floor(id.x / 256.0);
  id.x -= floor(id.x / 256.0) * 256.0;

  id.z += floor(id.y / 256.0);
  id.y -= floor(id.y / 256.0) * 256.0;

  id.w += floor(id.z / 256.0);
  id.z -= floor(id.z / 256.0) * 256.0;

  gl_FragColor = id/255.;
}
`]), pickVertex: i([`precision mediump float;
#define GLSLIFY 1

attribute vec2 position;
attribute vec4 pickId;
attribute vec2 weight;

uniform vec2 shape;
uniform mat3 viewTransform;

varying vec4 fragId;
varying vec2 vWeight;

void main() {
  vWeight = weight;

  fragId = pickId;

  vec3 vPosition = viewTransform * vec3( position + (weight-.5)/(shape-1.) , 1.0);
  gl_Position = vec4(vPosition.xy, 0, vPosition.z);
}
`]) };
            }, { glslify: 231 }], 90: [function(a, o, s) {
              var i = a("glslify"), l = a("gl-shader"), u2 = i([`precision highp float;
#define GLSLIFY 1

attribute vec3 position, nextPosition;
attribute float arcLength, lineWidth;
attribute vec4 color;

uniform vec2 screenShape;
uniform float pixelRatio;
uniform mat4 model, view, projection;

varying vec4 fragColor;
varying vec3 worldPosition;
varying float pixelArcLength;

vec4 project(vec3 p) {
  return projection * view * model * vec4(p, 1.0);
}

void main() {
  vec4 startPoint = project(position);
  vec4 endPoint   = project(nextPosition);

  vec2 A = startPoint.xy / startPoint.w;
  vec2 B =   endPoint.xy /   endPoint.w;

  float clipAngle = atan(
    (B.y - A.y) * screenShape.y,
    (B.x - A.x) * screenShape.x
  );

  vec2 offset = 0.5 * pixelRatio * lineWidth * vec2(
    sin(clipAngle),
    -cos(clipAngle)
  ) / screenShape;

  gl_Position = vec4(startPoint.xy + startPoint.w * offset, startPoint.zw);

  worldPosition = position;
  pixelArcLength = arcLength;
  fragColor = color;
}
`]), c = i([`precision highp float;
#define GLSLIFY 1

bool outOfRange(float a, float b, float p) {
  return ((p > max(a, b)) || 
          (p < min(a, b)));
}

bool outOfRange(vec2 a, vec2 b, vec2 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y));
}

bool outOfRange(vec3 a, vec3 b, vec3 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y) ||
          outOfRange(a.z, b.z, p.z));
}

bool outOfRange(vec4 a, vec4 b, vec4 p) {
  return outOfRange(a.xyz, b.xyz, p.xyz);
}

uniform vec3      clipBounds[2];
uniform sampler2D dashTexture;
uniform float     dashScale;
uniform float     opacity;

varying vec3    worldPosition;
varying float   pixelArcLength;
varying vec4    fragColor;

void main() {
  if (
    outOfRange(clipBounds[0], clipBounds[1], worldPosition) ||
    fragColor.a * opacity == 0.
  ) discard;

  float dashWeight = texture2D(dashTexture, vec2(dashScale * pixelArcLength, 0)).r;
  if(dashWeight < 0.5) {
    discard;
  }
  gl_FragColor = fragColor * opacity;
}
`]), f = i([`precision highp float;
#define GLSLIFY 1

#define FLOAT_MAX  1.70141184e38
#define FLOAT_MIN  1.17549435e-38

// https://github.com/mikolalysenko/glsl-read-float/blob/master/index.glsl
vec4 packFloat(float v) {
  float av = abs(v);

  //Handle special cases
  if(av < FLOAT_MIN) {
    return vec4(0.0, 0.0, 0.0, 0.0);
  } else if(v > FLOAT_MAX) {
    return vec4(127.0, 128.0, 0.0, 0.0) / 255.0;
  } else if(v < -FLOAT_MAX) {
    return vec4(255.0, 128.0, 0.0, 0.0) / 255.0;
  }

  vec4 c = vec4(0,0,0,0);

  //Compute exponent and mantissa
  float e = floor(log2(av));
  float m = av * pow(2.0, -e) - 1.0;

  //Unpack mantissa
  c[1] = floor(128.0 * m);
  m -= c[1] / 128.0;
  c[2] = floor(32768.0 * m);
  m -= c[2] / 32768.0;
  c[3] = floor(8388608.0 * m);

  //Unpack exponent
  float ebias = e + 127.0;
  c[0] = floor(ebias / 2.0);
  ebias -= c[0] * 2.0;
  c[1] += floor(ebias) * 128.0;

  //Unpack sign bit
  c[0] += 128.0 * step(0.0, -v);

  //Scale back to range
  return c / 255.0;
}

bool outOfRange(float a, float b, float p) {
  return ((p > max(a, b)) || 
          (p < min(a, b)));
}

bool outOfRange(vec2 a, vec2 b, vec2 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y));
}

bool outOfRange(vec3 a, vec3 b, vec3 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y) ||
          outOfRange(a.z, b.z, p.z));
}

bool outOfRange(vec4 a, vec4 b, vec4 p) {
  return outOfRange(a.xyz, b.xyz, p.xyz);
}

uniform float pickId;
uniform vec3 clipBounds[2];

varying vec3 worldPosition;
varying float pixelArcLength;
varying vec4 fragColor;

void main() {
  if (outOfRange(clipBounds[0], clipBounds[1], worldPosition)) discard;

  gl_FragColor = vec4(pickId/255.0, packFloat(pixelArcLength).xyz);
}`]), h = [{ name: "position", type: "vec3" }, { name: "nextPosition", type: "vec3" }, { name: "arcLength", type: "float" }, { name: "lineWidth", type: "float" }, { name: "color", type: "vec4" }];
              s.createShader = function(p) {
                return l(p, u2, c, null, h);
              }, s.createPickShader = function(p) {
                return l(p, u2, f, null, h);
              };
            }, { "gl-shader": 132, glslify: 231 }], 91: [function(a, o, s) {
              "use strict";
              o.exports = function(k) {
                var T2 = k.gl || k.scene && k.scene.gl, A2 = v(T2);
                A2.attributes.position.location = 0, A2.attributes.nextPosition.location = 1, A2.attributes.arcLength.location = 2, A2.attributes.lineWidth.location = 3, A2.attributes.color.location = 4;
                var S2 = m(T2);
                S2.attributes.position.location = 0, S2.attributes.nextPosition.location = 1, S2.attributes.arcLength.location = 2, S2.attributes.lineWidth.location = 3, S2.attributes.color.location = 4;
                for (var C2 = i(T2), E2 = l(T2, [{ buffer: C2, size: 3, offset: 0, stride: 48 }, { buffer: C2, size: 3, offset: 12, stride: 48 }, { buffer: C2, size: 1, offset: 24, stride: 48 }, { buffer: C2, size: 1, offset: 28, stride: 48 }, { buffer: C2, size: 4, offset: 32, stride: 48 }]), F13 = p(new Array(1024), [256, 1, 4]), N2 = 0; N2 < 1024; ++N2) F13.data[N2] = 255;
                var D2 = u2(T2, F13);
                D2.wrap = T2.REPEAT;
                var I2 = new w(T2, A2, S2, C2, E2, D2);
                return I2.update(k), I2;
              };
              var i = a("gl-buffer"), l = a("gl-vao"), u2 = a("gl-texture2d"), c = new Uint8Array(4), f = new Float32Array(c.buffer), h = a("binary-search-bounds"), p = a("ndarray"), d = a("./lib/shaders"), v = d.createShader, m = d.createPickShader, g = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
              function x(k, T2) {
                for (var A2 = 0, S2 = 0; S2 < 3; ++S2) {
                  var C2 = k[S2] - T2[S2];
                  A2 += C2 * C2;
                }
                return Math.sqrt(A2);
              }
              function b(k) {
                for (var T2 = [[-1e6, -1e6, -1e6], [1e6, 1e6, 1e6]], A2 = 0; A2 < 3; ++A2) T2[0][A2] = Math.max(k[0][A2], T2[0][A2]), T2[1][A2] = Math.min(k[1][A2], T2[1][A2]);
                return T2;
              }
              function y(k, T2, A2, S2) {
                this.arcLength = k, this.position = T2, this.index = A2, this.dataCoordinate = S2;
              }
              function w(k, T2, A2, S2, C2, E2) {
                this.gl = k, this.shader = T2, this.pickShader = A2, this.buffer = S2, this.vao = C2, this.clipBounds = [[-1 / 0, -1 / 0, -1 / 0], [1 / 0, 1 / 0, 1 / 0]], this.points = [], this.arcLength = [], this.vertexCount = 0, this.bounds = [[0, 0, 0], [0, 0, 0]], this.pickId = 0, this.lineWidth = 1, this.texture = E2, this.dashScale = 1, this.opacity = 1, this.hasAlpha = false, this.dirty = true, this.pixelRatio = 1;
              }
              var _4 = w.prototype;
              _4.isTransparent = function() {
                return this.hasAlpha;
              }, _4.isOpaque = function() {
                return !this.hasAlpha;
              }, _4.pickSlots = 1, _4.setPickBase = function(k) {
                this.pickId = k;
              }, _4.drawTransparent = _4.draw = function(k) {
                if (this.vertexCount) {
                  var T2 = this.gl, A2 = this.shader, S2 = this.vao;
                  A2.bind(), A2.uniforms = { model: k.model || g, view: k.view || g, projection: k.projection || g, clipBounds: b(this.clipBounds), dashTexture: this.texture.bind(), dashScale: this.dashScale / this.arcLength[this.arcLength.length - 1], opacity: this.opacity, screenShape: [T2.drawingBufferWidth, T2.drawingBufferHeight], pixelRatio: this.pixelRatio }, S2.bind(), S2.draw(T2.TRIANGLE_STRIP, this.vertexCount), S2.unbind();
                }
              }, _4.drawPick = function(k) {
                if (this.vertexCount) {
                  var T2 = this.gl, A2 = this.pickShader, S2 = this.vao;
                  A2.bind(), A2.uniforms = { model: k.model || g, view: k.view || g, projection: k.projection || g, pickId: this.pickId, clipBounds: b(this.clipBounds), screenShape: [T2.drawingBufferWidth, T2.drawingBufferHeight], pixelRatio: this.pixelRatio }, S2.bind(), S2.draw(T2.TRIANGLE_STRIP, this.vertexCount), S2.unbind();
                }
              }, _4.update = function(k) {
                var T2, A2;
                this.dirty = true;
                var S2 = !!k.connectGaps;
                "dashScale" in k && (this.dashScale = k.dashScale), this.hasAlpha = false, "opacity" in k && (this.opacity = +k.opacity, this.opacity < 1 && (this.hasAlpha = true));
                var C2 = [], E2 = [], F13 = [], N2 = 0, D2 = 0, I2 = [[1 / 0, 1 / 0, 1 / 0], [-1 / 0, -1 / 0, -1 / 0]], O2 = k.position || k.positions;
                if (O2) {
                  var L2 = k.color || k.colors || [0, 0, 0, 1], V2 = k.lineWidth || 1, W2 = false;
                  e: for (T2 = 1; T2 < O2.length; ++T2) {
                    var X2, Y2, K2, q = O2[T2 - 1], re = O2[T2];
                    for (E2.push(N2), F13.push(q.slice()), A2 = 0; A2 < 3; ++A2) {
                      if (isNaN(q[A2]) || isNaN(re[A2]) || !isFinite(q[A2]) || !isFinite(re[A2])) {
                        if (!S2 && C2.length > 0) {
                          for (var R2 = 0; R2 < 24; ++R2) C2.push(C2[C2.length - 12]);
                          D2 += 2, W2 = true;
                        }
                        continue e;
                      }
                      I2[0][A2] = Math.min(I2[0][A2], q[A2], re[A2]), I2[1][A2] = Math.max(I2[1][A2], q[A2], re[A2]);
                    }
                    Array.isArray(L2[0]) ? (X2 = L2.length > T2 - 1 ? L2[T2 - 1] : L2.length > 0 ? L2[L2.length - 1] : [0, 0, 0, 1], Y2 = L2.length > T2 ? L2[T2] : L2.length > 0 ? L2[L2.length - 1] : [0, 0, 0, 1]) : X2 = Y2 = L2, X2.length === 3 && (X2 = [X2[0], X2[1], X2[2], 1]), Y2.length === 3 && (Y2 = [Y2[0], Y2[1], Y2[2], 1]), !this.hasAlpha && X2[3] < 1 && (this.hasAlpha = true), K2 = Array.isArray(V2) ? V2.length > T2 - 1 ? V2[T2 - 1] : V2.length > 0 ? V2[V2.length - 1] : [0, 0, 0, 1] : V2;
                    var z = N2;
                    if (N2 += x(q, re), W2) {
                      for (A2 = 0; A2 < 2; ++A2) C2.push(q[0], q[1], q[2], re[0], re[1], re[2], z, K2, X2[0], X2[1], X2[2], X2[3]);
                      D2 += 2, W2 = false;
                    }
                    C2.push(q[0], q[1], q[2], re[0], re[1], re[2], z, K2, X2[0], X2[1], X2[2], X2[3], q[0], q[1], q[2], re[0], re[1], re[2], z, -K2, X2[0], X2[1], X2[2], X2[3], re[0], re[1], re[2], q[0], q[1], q[2], N2, -K2, Y2[0], Y2[1], Y2[2], Y2[3], re[0], re[1], re[2], q[0], q[1], q[2], N2, K2, Y2[0], Y2[1], Y2[2], Y2[3]), D2 += 4;
                  }
                }
                if (this.buffer.update(C2), E2.push(N2), F13.push(O2[O2.length - 1].slice()), this.bounds = I2, this.vertexCount = D2, this.points = F13, this.arcLength = E2, "dashes" in k) {
                  var H2 = k.dashes.slice();
                  for (H2.unshift(0), T2 = 1; T2 < H2.length; ++T2) H2[T2] = H2[T2 - 1] + H2[T2];
                  var te = p(new Array(1024), [256, 1, 4]);
                  for (T2 = 0; T2 < 256; ++T2) {
                    for (A2 = 0; A2 < 4; ++A2) te.set(T2, 0, A2, 0);
                    1 & h.le(H2, H2[H2.length - 1] * T2 / 255) ? te.set(T2, 0, 0, 0) : te.set(T2, 0, 0, 255);
                  }
                  this.texture.setPixels(te);
                }
              }, _4.dispose = function() {
                this.shader.dispose(), this.vao.dispose(), this.buffer.dispose();
              }, _4.pick = function(k) {
                if (!k || k.id !== this.pickId) return null;
                var T2 = function(O2, L2, V2, W2) {
                  return c[0] = W2, c[1] = V2, c[2] = L2, c[3] = O2, f[0];
                }(k.value[0], k.value[1], k.value[2], 0), A2 = h.le(this.arcLength, T2);
                if (A2 < 0) return null;
                if (A2 === this.arcLength.length - 1) return new y(this.arcLength[this.arcLength.length - 1], this.points[this.points.length - 1].slice(), A2);
                for (var S2 = this.points[A2], C2 = this.points[Math.min(A2 + 1, this.points.length - 1)], E2 = (T2 - this.arcLength[A2]) / (this.arcLength[A2 + 1] - this.arcLength[A2]), F13 = 1 - E2, N2 = [0, 0, 0], D2 = 0; D2 < 3; ++D2) N2[D2] = F13 * S2[D2] + E2 * C2[D2];
                var I2 = Math.min(E2 < 0.5 ? A2 : A2 + 1, this.points.length - 1);
                return new y(T2, N2, I2, this.points[I2]);
              };
            }, { "./lib/shaders": 90, "binary-search-bounds": 31, "gl-buffer": 78, "gl-texture2d": 146, "gl-vao": 150, ndarray: 259 }], 92: [function(a, o, s) {
              o.exports = function(i) {
                var l = new Float32Array(16);
                return l[0] = i[0], l[1] = i[1], l[2] = i[2], l[3] = i[3], l[4] = i[4], l[5] = i[5], l[6] = i[6], l[7] = i[7], l[8] = i[8], l[9] = i[9], l[10] = i[10], l[11] = i[11], l[12] = i[12], l[13] = i[13], l[14] = i[14], l[15] = i[15], l;
              };
            }, {}], 93: [function(a, o, s) {
              o.exports = function() {
                var i = new Float32Array(16);
                return i[0] = 1, i[1] = 0, i[2] = 0, i[3] = 0, i[4] = 0, i[5] = 1, i[6] = 0, i[7] = 0, i[8] = 0, i[9] = 0, i[10] = 1, i[11] = 0, i[12] = 0, i[13] = 0, i[14] = 0, i[15] = 1, i;
              };
            }, {}], 94: [function(a, o, s) {
              o.exports = function(i) {
                var l = i[0], u2 = i[1], c = i[2], f = i[3], h = i[4], p = i[5], d = i[6], v = i[7], m = i[8], g = i[9], x = i[10], b = i[11], y = i[12], w = i[13], _4 = i[14], k = i[15];
                return (l * p - u2 * h) * (x * k - b * _4) - (l * d - c * h) * (g * k - b * w) + (l * v - f * h) * (g * _4 - x * w) + (u2 * d - c * p) * (m * k - b * y) - (u2 * v - f * p) * (m * _4 - x * y) + (c * v - f * d) * (m * w - g * y);
              };
            }, {}], 95: [function(a, o, s) {
              o.exports = function(i, l) {
                var u2 = l[0], c = l[1], f = l[2], h = l[3], p = u2 + u2, d = c + c, v = f + f, m = u2 * p, g = c * p, x = c * d, b = f * p, y = f * d, w = f * v, _4 = h * p, k = h * d, T2 = h * v;
                return i[0] = 1 - x - w, i[1] = g + T2, i[2] = b - k, i[3] = 0, i[4] = g - T2, i[5] = 1 - m - w, i[6] = y + _4, i[7] = 0, i[8] = b + k, i[9] = y - _4, i[10] = 1 - m - x, i[11] = 0, i[12] = 0, i[13] = 0, i[14] = 0, i[15] = 1, i;
              };
            }, {}], 96: [function(a, o, s) {
              o.exports = function(i, l, u2) {
                var c = l[0], f = l[1], h = l[2], p = l[3], d = c + c, v = f + f, m = h + h, g = c * d, x = c * v, b = c * m, y = f * v, w = f * m, _4 = h * m, k = p * d, T2 = p * v, A2 = p * m;
                return i[0] = 1 - (y + _4), i[1] = x + A2, i[2] = b - T2, i[3] = 0, i[4] = x - A2, i[5] = 1 - (g + _4), i[6] = w + k, i[7] = 0, i[8] = b + T2, i[9] = w - k, i[10] = 1 - (g + y), i[11] = 0, i[12] = u2[0], i[13] = u2[1], i[14] = u2[2], i[15] = 1, i;
              };
            }, {}], 97: [function(a, o, s) {
              o.exports = function(i) {
                return i[0] = 1, i[1] = 0, i[2] = 0, i[3] = 0, i[4] = 0, i[5] = 1, i[6] = 0, i[7] = 0, i[8] = 0, i[9] = 0, i[10] = 1, i[11] = 0, i[12] = 0, i[13] = 0, i[14] = 0, i[15] = 1, i;
              };
            }, {}], 98: [function(a, o, s) {
              o.exports = function(i, l) {
                var u2 = l[0], c = l[1], f = l[2], h = l[3], p = l[4], d = l[5], v = l[6], m = l[7], g = l[8], x = l[9], b = l[10], y = l[11], w = l[12], _4 = l[13], k = l[14], T2 = l[15], A2 = u2 * d - c * p, S2 = u2 * v - f * p, C2 = u2 * m - h * p, E2 = c * v - f * d, F13 = c * m - h * d, N2 = f * m - h * v, D2 = g * _4 - x * w, I2 = g * k - b * w, O2 = g * T2 - y * w, L2 = x * k - b * _4, V2 = x * T2 - y * _4, W2 = b * T2 - y * k, X2 = A2 * W2 - S2 * V2 + C2 * L2 + E2 * O2 - F13 * I2 + N2 * D2;
                return X2 ? (X2 = 1 / X2, i[0] = (d * W2 - v * V2 + m * L2) * X2, i[1] = (f * V2 - c * W2 - h * L2) * X2, i[2] = (_4 * N2 - k * F13 + T2 * E2) * X2, i[3] = (b * F13 - x * N2 - y * E2) * X2, i[4] = (v * O2 - p * W2 - m * I2) * X2, i[5] = (u2 * W2 - f * O2 + h * I2) * X2, i[6] = (k * C2 - w * N2 - T2 * S2) * X2, i[7] = (g * N2 - b * C2 + y * S2) * X2, i[8] = (p * V2 - d * O2 + m * D2) * X2, i[9] = (c * O2 - u2 * V2 - h * D2) * X2, i[10] = (w * F13 - _4 * C2 + T2 * A2) * X2, i[11] = (x * C2 - g * F13 - y * A2) * X2, i[12] = (d * I2 - p * L2 - v * D2) * X2, i[13] = (u2 * L2 - c * I2 + f * D2) * X2, i[14] = (_4 * S2 - w * E2 - k * A2) * X2, i[15] = (g * E2 - x * S2 + b * A2) * X2, i) : null;
              };
            }, {}], 99: [function(a, o, s) {
              var i = a("./identity");
              o.exports = function(l, u2, c, f) {
                var h, p, d, v, m, g, x, b, y, w, _4 = u2[0], k = u2[1], T2 = u2[2], A2 = f[0], S2 = f[1], C2 = f[2], E2 = c[0], F13 = c[1], N2 = c[2];
                return Math.abs(_4 - E2) < 1e-6 && Math.abs(k - F13) < 1e-6 && Math.abs(T2 - N2) < 1e-6 ? i(l) : (x = _4 - E2, b = k - F13, y = T2 - N2, w = 1 / Math.sqrt(x * x + b * b + y * y), h = S2 * (y *= w) - C2 * (b *= w), p = C2 * (x *= w) - A2 * y, d = A2 * b - S2 * x, (w = Math.sqrt(h * h + p * p + d * d)) ? (h *= w = 1 / w, p *= w, d *= w) : (h = 0, p = 0, d = 0), v = b * d - y * p, m = y * h - x * d, g = x * p - b * h, (w = Math.sqrt(v * v + m * m + g * g)) ? (v *= w = 1 / w, m *= w, g *= w) : (v = 0, m = 0, g = 0), l[0] = h, l[1] = v, l[2] = x, l[3] = 0, l[4] = p, l[5] = m, l[6] = b, l[7] = 0, l[8] = d, l[9] = g, l[10] = y, l[11] = 0, l[12] = -(h * _4 + p * k + d * T2), l[13] = -(v * _4 + m * k + g * T2), l[14] = -(x * _4 + b * k + y * T2), l[15] = 1, l);
              };
            }, { "./identity": 97 }], 100: [function(a, o, s) {
              o.exports = function(i, l, u2) {
                var c = l[0], f = l[1], h = l[2], p = l[3], d = l[4], v = l[5], m = l[6], g = l[7], x = l[8], b = l[9], y = l[10], w = l[11], _4 = l[12], k = l[13], T2 = l[14], A2 = l[15], S2 = u2[0], C2 = u2[1], E2 = u2[2], F13 = u2[3];
                return i[0] = S2 * c + C2 * d + E2 * x + F13 * _4, i[1] = S2 * f + C2 * v + E2 * b + F13 * k, i[2] = S2 * h + C2 * m + E2 * y + F13 * T2, i[3] = S2 * p + C2 * g + E2 * w + F13 * A2, S2 = u2[4], C2 = u2[5], E2 = u2[6], F13 = u2[7], i[4] = S2 * c + C2 * d + E2 * x + F13 * _4, i[5] = S2 * f + C2 * v + E2 * b + F13 * k, i[6] = S2 * h + C2 * m + E2 * y + F13 * T2, i[7] = S2 * p + C2 * g + E2 * w + F13 * A2, S2 = u2[8], C2 = u2[9], E2 = u2[10], F13 = u2[11], i[8] = S2 * c + C2 * d + E2 * x + F13 * _4, i[9] = S2 * f + C2 * v + E2 * b + F13 * k, i[10] = S2 * h + C2 * m + E2 * y + F13 * T2, i[11] = S2 * p + C2 * g + E2 * w + F13 * A2, S2 = u2[12], C2 = u2[13], E2 = u2[14], F13 = u2[15], i[12] = S2 * c + C2 * d + E2 * x + F13 * _4, i[13] = S2 * f + C2 * v + E2 * b + F13 * k, i[14] = S2 * h + C2 * m + E2 * y + F13 * T2, i[15] = S2 * p + C2 * g + E2 * w + F13 * A2, i;
              };
            }, {}], 101: [function(a, o, s) {
              o.exports = function(i, l, u2, c, f, h, p) {
                var d = 1 / (l - u2), v = 1 / (c - f), m = 1 / (h - p);
                return i[0] = -2 * d, i[1] = 0, i[2] = 0, i[3] = 0, i[4] = 0, i[5] = -2 * v, i[6] = 0, i[7] = 0, i[8] = 0, i[9] = 0, i[10] = 2 * m, i[11] = 0, i[12] = (l + u2) * d, i[13] = (f + c) * v, i[14] = (p + h) * m, i[15] = 1, i;
              };
            }, {}], 102: [function(a, o, s) {
              o.exports = function(i, l, u2, c, f) {
                var h = 1 / Math.tan(l / 2), p = 1 / (c - f);
                return i[0] = h / u2, i[1] = 0, i[2] = 0, i[3] = 0, i[4] = 0, i[5] = h, i[6] = 0, i[7] = 0, i[8] = 0, i[9] = 0, i[10] = (f + c) * p, i[11] = -1, i[12] = 0, i[13] = 0, i[14] = 2 * f * c * p, i[15] = 0, i;
              };
            }, {}], 103: [function(a, o, s) {
              o.exports = function(i, l, u2, c) {
                var f, h, p, d, v, m, g, x, b, y, w, _4, k, T2, A2, S2, C2, E2, F13, N2, D2, I2, O2, L2, V2 = c[0], W2 = c[1], X2 = c[2], Y2 = Math.sqrt(V2 * V2 + W2 * W2 + X2 * X2);
                return Math.abs(Y2) < 1e-6 ? null : (V2 *= Y2 = 1 / Y2, W2 *= Y2, X2 *= Y2, f = Math.sin(u2), h = Math.cos(u2), p = 1 - h, d = l[0], v = l[1], m = l[2], g = l[3], x = l[4], b = l[5], y = l[6], w = l[7], _4 = l[8], k = l[9], T2 = l[10], A2 = l[11], S2 = V2 * V2 * p + h, C2 = W2 * V2 * p + X2 * f, E2 = X2 * V2 * p - W2 * f, F13 = V2 * W2 * p - X2 * f, N2 = W2 * W2 * p + h, D2 = X2 * W2 * p + V2 * f, I2 = V2 * X2 * p + W2 * f, O2 = W2 * X2 * p - V2 * f, L2 = X2 * X2 * p + h, i[0] = d * S2 + x * C2 + _4 * E2, i[1] = v * S2 + b * C2 + k * E2, i[2] = m * S2 + y * C2 + T2 * E2, i[3] = g * S2 + w * C2 + A2 * E2, i[4] = d * F13 + x * N2 + _4 * D2, i[5] = v * F13 + b * N2 + k * D2, i[6] = m * F13 + y * N2 + T2 * D2, i[7] = g * F13 + w * N2 + A2 * D2, i[8] = d * I2 + x * O2 + _4 * L2, i[9] = v * I2 + b * O2 + k * L2, i[10] = m * I2 + y * O2 + T2 * L2, i[11] = g * I2 + w * O2 + A2 * L2, l !== i && (i[12] = l[12], i[13] = l[13], i[14] = l[14], i[15] = l[15]), i);
              };
            }, {}], 104: [function(a, o, s) {
              o.exports = function(i, l, u2) {
                var c = Math.sin(u2), f = Math.cos(u2), h = l[4], p = l[5], d = l[6], v = l[7], m = l[8], g = l[9], x = l[10], b = l[11];
                return l !== i && (i[0] = l[0], i[1] = l[1], i[2] = l[2], i[3] = l[3], i[12] = l[12], i[13] = l[13], i[14] = l[14], i[15] = l[15]), i[4] = h * f + m * c, i[5] = p * f + g * c, i[6] = d * f + x * c, i[7] = v * f + b * c, i[8] = m * f - h * c, i[9] = g * f - p * c, i[10] = x * f - d * c, i[11] = b * f - v * c, i;
              };
            }, {}], 105: [function(a, o, s) {
              o.exports = function(i, l, u2) {
                var c = Math.sin(u2), f = Math.cos(u2), h = l[0], p = l[1], d = l[2], v = l[3], m = l[8], g = l[9], x = l[10], b = l[11];
                return l !== i && (i[4] = l[4], i[5] = l[5], i[6] = l[6], i[7] = l[7], i[12] = l[12], i[13] = l[13], i[14] = l[14], i[15] = l[15]), i[0] = h * f - m * c, i[1] = p * f - g * c, i[2] = d * f - x * c, i[3] = v * f - b * c, i[8] = h * c + m * f, i[9] = p * c + g * f, i[10] = d * c + x * f, i[11] = v * c + b * f, i;
              };
            }, {}], 106: [function(a, o, s) {
              o.exports = function(i, l, u2) {
                var c = Math.sin(u2), f = Math.cos(u2), h = l[0], p = l[1], d = l[2], v = l[3], m = l[4], g = l[5], x = l[6], b = l[7];
                return l !== i && (i[8] = l[8], i[9] = l[9], i[10] = l[10], i[11] = l[11], i[12] = l[12], i[13] = l[13], i[14] = l[14], i[15] = l[15]), i[0] = h * f + m * c, i[1] = p * f + g * c, i[2] = d * f + x * c, i[3] = v * f + b * c, i[4] = m * f - h * c, i[5] = g * f - p * c, i[6] = x * f - d * c, i[7] = b * f - v * c, i;
              };
            }, {}], 107: [function(a, o, s) {
              o.exports = function(i, l, u2) {
                var c = u2[0], f = u2[1], h = u2[2];
                return i[0] = l[0] * c, i[1] = l[1] * c, i[2] = l[2] * c, i[3] = l[3] * c, i[4] = l[4] * f, i[5] = l[5] * f, i[6] = l[6] * f, i[7] = l[7] * f, i[8] = l[8] * h, i[9] = l[9] * h, i[10] = l[10] * h, i[11] = l[11] * h, i[12] = l[12], i[13] = l[13], i[14] = l[14], i[15] = l[15], i;
              };
            }, {}], 108: [function(a, o, s) {
              o.exports = function(i, l, u2) {
                var c, f, h, p, d, v, m, g, x, b, y, w, _4 = u2[0], k = u2[1], T2 = u2[2];
                return l === i ? (i[12] = l[0] * _4 + l[4] * k + l[8] * T2 + l[12], i[13] = l[1] * _4 + l[5] * k + l[9] * T2 + l[13], i[14] = l[2] * _4 + l[6] * k + l[10] * T2 + l[14], i[15] = l[3] * _4 + l[7] * k + l[11] * T2 + l[15]) : (c = l[0], f = l[1], h = l[2], p = l[3], d = l[4], v = l[5], m = l[6], g = l[7], x = l[8], b = l[9], y = l[10], w = l[11], i[0] = c, i[1] = f, i[2] = h, i[3] = p, i[4] = d, i[5] = v, i[6] = m, i[7] = g, i[8] = x, i[9] = b, i[10] = y, i[11] = w, i[12] = c * _4 + d * k + x * T2 + l[12], i[13] = f * _4 + v * k + b * T2 + l[13], i[14] = h * _4 + m * k + y * T2 + l[14], i[15] = p * _4 + g * k + w * T2 + l[15]), i;
              };
            }, {}], 109: [function(a, o, s) {
              o.exports = function(i, l) {
                if (i === l) {
                  var u2 = l[1], c = l[2], f = l[3], h = l[6], p = l[7], d = l[11];
                  i[1] = l[4], i[2] = l[8], i[3] = l[12], i[4] = u2, i[6] = l[9], i[7] = l[13], i[8] = c, i[9] = h, i[11] = l[14], i[12] = f, i[13] = p, i[14] = d;
                } else i[0] = l[0], i[1] = l[4], i[2] = l[8], i[3] = l[12], i[4] = l[1], i[5] = l[5], i[6] = l[9], i[7] = l[13], i[8] = l[2], i[9] = l[6], i[10] = l[10], i[11] = l[14], i[12] = l[3], i[13] = l[7], i[14] = l[11], i[15] = l[15];
                return i;
              };
            }, {}], 110: [function(a, o, s) {
              "use strict";
              var i = a("barycentric"), l = a("polytope-closest-point/lib/closest_point_2d.js");
              function u2(h, p) {
                for (var d = [0, 0, 0, 0], v = 0; v < 4; ++v) for (var m = 0; m < 4; ++m) d[m] += h[4 * v + m] * p[v];
                return d;
              }
              function c(h, p, d, v, m) {
                for (var g = u2(v, u2(d, u2(p, [h[0], h[1], h[2], 1]))), x = 0; x < 3; ++x) g[x] /= g[3];
                return [0.5 * m[0] * (1 + g[0]), 0.5 * m[1] * (1 - g[1])];
              }
              function f(h, p) {
                for (var d = [0, 0, 0], v = 0; v < h.length; ++v) for (var m = h[v], g = p[v], x = 0; x < 3; ++x) d[x] += g * m[x];
                return d;
              }
              o.exports = function(h, p, d, v, m, g) {
                if (h.length === 1) return [0, h[0].slice()];
                for (var x = new Array(h.length), b = 0; b < h.length; ++b) x[b] = c(h[b], d, v, m, g);
                var y = 0, w = 1 / 0;
                for (b = 0; b < x.length; ++b) {
                  for (var _4 = 0, k = 0; k < 2; ++k) _4 += Math.pow(x[b][k] - p[k], 2);
                  _4 < w && (w = _4, y = b);
                }
                var T2 = function(S2, C2) {
                  if (S2.length === 2) {
                    for (var E2 = 0, F13 = 0, N2 = 0; N2 < 2; ++N2) E2 += Math.pow(C2[N2] - S2[0][N2], 2), F13 += Math.pow(C2[N2] - S2[1][N2], 2);
                    return E2 = Math.sqrt(E2), F13 = Math.sqrt(F13), E2 + F13 < 1e-6 ? [1, 0] : [F13 / (E2 + F13), E2 / (F13 + E2)];
                  }
                  if (S2.length === 3) {
                    var D2 = [0, 0];
                    return l(S2[0], S2[1], S2[2], C2, D2), i(S2, D2);
                  }
                  return [];
                }(x, p), A2 = 0;
                for (b = 0; b < 3; ++b) {
                  if (T2[b] < -1e-3 || T2[b] > 1.0001) return null;
                  A2 += T2[b];
                }
                return Math.abs(A2 - 1) > 1e-3 ? null : [y, f(h, T2), T2];
              };
            }, { barycentric: 14, "polytope-closest-point/lib/closest_point_2d.js": 270 }], 111: [function(a, o, s) {
              var i = a("glslify"), l = i([`precision highp float;
#define GLSLIFY 1

attribute vec3 position, normal;
attribute vec4 color;
attribute vec2 uv;

uniform mat4 model
           , view
           , projection
           , inverseModel;
uniform vec3 eyePosition
           , lightPosition;

varying vec3 f_normal
           , f_lightDirection
           , f_eyeDirection
           , f_data;
varying vec4 f_color;
varying vec2 f_uv;

vec4 project(vec3 p) {
  return projection * view * model * vec4(p, 1.0);
}

void main() {
  gl_Position      = project(position);

  //Lighting geometry parameters
  vec4 cameraCoordinate = view * vec4(position , 1.0);
  cameraCoordinate.xyz /= cameraCoordinate.w;
  f_lightDirection = lightPosition - cameraCoordinate.xyz;
  f_eyeDirection   = eyePosition - cameraCoordinate.xyz;
  f_normal  = normalize((vec4(normal, 0.0) * inverseModel).xyz);

  f_color          = color;
  f_data           = position;
  f_uv             = uv;
}
`]), u2 = i([`#extension GL_OES_standard_derivatives : enable

precision highp float;
#define GLSLIFY 1

float beckmannDistribution(float x, float roughness) {
  float NdotH = max(x, 0.0001);
  float cos2Alpha = NdotH * NdotH;
  float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;
  float roughness2 = roughness * roughness;
  float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;
  return exp(tan2Alpha / roughness2) / denom;
}

float cookTorranceSpecular(
  vec3 lightDirection,
  vec3 viewDirection,
  vec3 surfaceNormal,
  float roughness,
  float fresnel) {

  float VdotN = max(dot(viewDirection, surfaceNormal), 0.0);
  float LdotN = max(dot(lightDirection, surfaceNormal), 0.0);

  //Half angle vector
  vec3 H = normalize(lightDirection + viewDirection);

  //Geometric term
  float NdotH = max(dot(surfaceNormal, H), 0.0);
  float VdotH = max(dot(viewDirection, H), 0.000001);
  float LdotH = max(dot(lightDirection, H), 0.000001);
  float G1 = (2.0 * NdotH * VdotN) / VdotH;
  float G2 = (2.0 * NdotH * LdotN) / LdotH;
  float G = min(1.0, min(G1, G2));
  
  //Distribution term
  float D = beckmannDistribution(NdotH, roughness);

  //Fresnel term
  float F = pow(1.0 - VdotN, fresnel);

  //Multiply terms and done
  return  G * F * D / max(3.14159265 * VdotN, 0.000001);
}

//#pragma glslify: beckmann = require(glsl-specular-beckmann) // used in gl-surface3d

bool outOfRange(float a, float b, float p) {
  return ((p > max(a, b)) || 
          (p < min(a, b)));
}

bool outOfRange(vec2 a, vec2 b, vec2 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y));
}

bool outOfRange(vec3 a, vec3 b, vec3 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y) ||
          outOfRange(a.z, b.z, p.z));
}

bool outOfRange(vec4 a, vec4 b, vec4 p) {
  return outOfRange(a.xyz, b.xyz, p.xyz);
}

uniform vec3 clipBounds[2];
uniform float roughness
            , fresnel
            , kambient
            , kdiffuse
            , kspecular;
uniform sampler2D texture;

varying vec3 f_normal
           , f_lightDirection
           , f_eyeDirection
           , f_data;
varying vec4 f_color;
varying vec2 f_uv;

void main() {
  if (f_color.a == 0.0 ||
    outOfRange(clipBounds[0], clipBounds[1], f_data)
  ) discard;

  vec3 N = normalize(f_normal);
  vec3 L = normalize(f_lightDirection);
  vec3 V = normalize(f_eyeDirection);

  if(gl_FrontFacing) {
    N = -N;
  }

  float specular = min(1.0, max(0.0, cookTorranceSpecular(L, V, N, roughness, fresnel)));
  //float specular = max(0.0, beckmann(L, V, N, roughness)); // used in gl-surface3d

  float diffuse  = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);

  vec4 surfaceColor = vec4(f_color.rgb, 1.0) * texture2D(texture, f_uv);
  vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular,  1.0);

  gl_FragColor = litColor * f_color.a;
}
`]), c = i([`precision highp float;
#define GLSLIFY 1

attribute vec3 position;
attribute vec4 color;
attribute vec2 uv;

uniform mat4 model, view, projection;

varying vec4 f_color;
varying vec3 f_data;
varying vec2 f_uv;

void main() {
  gl_Position = projection * view * model * vec4(position, 1.0);
  f_color = color;
  f_data  = position;
  f_uv    = uv;
}`]), f = i([`precision highp float;
#define GLSLIFY 1

bool outOfRange(float a, float b, float p) {
  return ((p > max(a, b)) || 
          (p < min(a, b)));
}

bool outOfRange(vec2 a, vec2 b, vec2 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y));
}

bool outOfRange(vec3 a, vec3 b, vec3 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y) ||
          outOfRange(a.z, b.z, p.z));
}

bool outOfRange(vec4 a, vec4 b, vec4 p) {
  return outOfRange(a.xyz, b.xyz, p.xyz);
}

uniform vec3 clipBounds[2];
uniform sampler2D texture;
uniform float opacity;

varying vec4 f_color;
varying vec3 f_data;
varying vec2 f_uv;

void main() {
  if (outOfRange(clipBounds[0], clipBounds[1], f_data)) discard;

  gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;
}`]), h = i([`precision highp float;
#define GLSLIFY 1

bool outOfRange(float a, float b, float p) {
  return ((p > max(a, b)) || 
          (p < min(a, b)));
}

bool outOfRange(vec2 a, vec2 b, vec2 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y));
}

bool outOfRange(vec3 a, vec3 b, vec3 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y) ||
          outOfRange(a.z, b.z, p.z));
}

bool outOfRange(vec4 a, vec4 b, vec4 p) {
  return outOfRange(a.xyz, b.xyz, p.xyz);
}

attribute vec3 position;
attribute vec4 color;
attribute vec2 uv;
attribute float pointSize;

uniform mat4 model, view, projection;
uniform vec3 clipBounds[2];

varying vec4 f_color;
varying vec2 f_uv;

void main() {
  if (outOfRange(clipBounds[0], clipBounds[1], position)) {

    gl_Position = vec4(0.0, 0.0 ,0.0 ,0.0);
  } else {
    gl_Position = projection * view * model * vec4(position, 1.0);
  }
  gl_PointSize = pointSize;
  f_color = color;
  f_uv = uv;
}`]), p = i([`precision highp float;
#define GLSLIFY 1

uniform sampler2D texture;
uniform float opacity;

varying vec4 f_color;
varying vec2 f_uv;

void main() {
  vec2 pointR = gl_PointCoord.xy - vec2(0.5, 0.5);
  if(dot(pointR, pointR) > 0.25) {
    discard;
  }
  gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;
}`]), d = i([`precision highp float;
#define GLSLIFY 1

attribute vec3 position;
attribute vec4 id;

uniform mat4 model, view, projection;

varying vec3 f_position;
varying vec4 f_id;

void main() {
  gl_Position = projection * view * model * vec4(position, 1.0);
  f_id        = id;
  f_position  = position;
}`]), v = i([`precision highp float;
#define GLSLIFY 1

bool outOfRange(float a, float b, float p) {
  return ((p > max(a, b)) || 
          (p < min(a, b)));
}

bool outOfRange(vec2 a, vec2 b, vec2 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y));
}

bool outOfRange(vec3 a, vec3 b, vec3 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y) ||
          outOfRange(a.z, b.z, p.z));
}

bool outOfRange(vec4 a, vec4 b, vec4 p) {
  return outOfRange(a.xyz, b.xyz, p.xyz);
}

uniform vec3  clipBounds[2];
uniform float pickId;

varying vec3 f_position;
varying vec4 f_id;

void main() {
  if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard;

  gl_FragColor = vec4(pickId, f_id.xyz);
}`]), m = i([`precision highp float;
#define GLSLIFY 1

bool outOfRange(float a, float b, float p) {
  return ((p > max(a, b)) || 
          (p < min(a, b)));
}

bool outOfRange(vec2 a, vec2 b, vec2 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y));
}

bool outOfRange(vec3 a, vec3 b, vec3 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y) ||
          outOfRange(a.z, b.z, p.z));
}

bool outOfRange(vec4 a, vec4 b, vec4 p) {
  return outOfRange(a.xyz, b.xyz, p.xyz);
}

attribute vec3  position;
attribute float pointSize;
attribute vec4  id;

uniform mat4 model, view, projection;
uniform vec3 clipBounds[2];

varying vec3 f_position;
varying vec4 f_id;

void main() {
  if (outOfRange(clipBounds[0], clipBounds[1], position)) {

    gl_Position = vec4(0.0, 0.0, 0.0, 0.0);
  } else {
    gl_Position  = projection * view * model * vec4(position, 1.0);
    gl_PointSize = pointSize;
  }
  f_id         = id;
  f_position   = position;
}`]), g = i([`precision highp float;
#define GLSLIFY 1

attribute vec3 position;

uniform mat4 model, view, projection;

void main() {
  gl_Position = projection * view * model * vec4(position, 1.0);
}`]), x = i([`precision highp float;
#define GLSLIFY 1

uniform vec3 contourColor;

void main() {
  gl_FragColor = vec4(contourColor, 1.0);
}
`]);
              s.meshShader = { vertex: l, fragment: u2, attributes: [{ name: "position", type: "vec3" }, { name: "normal", type: "vec3" }, { name: "color", type: "vec4" }, { name: "uv", type: "vec2" }] }, s.wireShader = { vertex: c, fragment: f, attributes: [{ name: "position", type: "vec3" }, { name: "color", type: "vec4" }, { name: "uv", type: "vec2" }] }, s.pointShader = { vertex: h, fragment: p, attributes: [{ name: "position", type: "vec3" }, { name: "color", type: "vec4" }, { name: "uv", type: "vec2" }, { name: "pointSize", type: "float" }] }, s.pickShader = { vertex: d, fragment: v, attributes: [{ name: "position", type: "vec3" }, { name: "id", type: "vec4" }] }, s.pointPickShader = { vertex: m, fragment: v, attributes: [{ name: "position", type: "vec3" }, { name: "pointSize", type: "float" }, { name: "id", type: "vec4" }] }, s.contourShader = { vertex: g, fragment: x, attributes: [{ name: "position", type: "vec3" }] };
            }, { glslify: 231 }], 112: [function(a, o, s) {
              "use strict";
              var i = a("gl-shader"), l = a("gl-buffer"), u2 = a("gl-vao"), c = a("gl-texture2d"), f = a("normals"), h = a("gl-mat4/multiply"), p = a("gl-mat4/invert"), d = a("ndarray"), v = a("colormap"), m = a("simplicial-complex-contour"), g = a("typedarray-pool"), x = a("./lib/shaders"), b = a("./lib/closest-point"), y = x.meshShader, w = x.wireShader, _4 = x.pointShader, k = x.pickShader, T2 = x.pointPickShader, A2 = x.contourShader, S2 = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
              function C2(W2, X2, Y2, K2, q, re, R2, z, H2, te, j, Q2, Z2, ne, ae, ue, le, ce, se, he, me, we, be, Ae, pe, ve, Ee) {
                this.gl = W2, this.pixelRatio = 1, this.cells = [], this.positions = [], this.intensity = [], this.texture = X2, this.dirty = true, this.triShader = Y2, this.lineShader = K2, this.pointShader = q, this.pickShader = re, this.pointPickShader = R2, this.contourShader = z, this.trianglePositions = H2, this.triangleColors = j, this.triangleNormals = Z2, this.triangleUVs = Q2, this.triangleIds = te, this.triangleVAO = ne, this.triangleCount = 0, this.lineWidth = 1, this.edgePositions = ae, this.edgeColors = le, this.edgeUVs = ce, this.edgeIds = ue, this.edgeVAO = se, this.edgeCount = 0, this.pointPositions = he, this.pointColors = we, this.pointUVs = be, this.pointSizes = Ae, this.pointIds = me, this.pointVAO = pe, this.pointCount = 0, this.contourLineWidth = 1, this.contourPositions = ve, this.contourVAO = Ee, this.contourCount = 0, this.contourColor = [0, 0, 0], this.contourEnable = true, this.pickVertex = true, this.pickId = 1, this.bounds = [[1 / 0, 1 / 0, 1 / 0], [-1 / 0, -1 / 0, -1 / 0]], this.clipBounds = [[-1 / 0, -1 / 0, -1 / 0], [1 / 0, 1 / 0, 1 / 0]], this.lightPosition = [1e5, 1e5, 0], this.ambientLight = 0.8, this.diffuseLight = 0.8, this.specularLight = 2, this.roughness = 0.5, this.fresnel = 1.5, this.opacity = 1, this.hasAlpha = false, this.opacityscale = false, this._model = S2, this._view = S2, this._projection = S2, this._resolution = [1, 1];
              }
              var E2 = C2.prototype;
              function F13(W2, X2) {
                if (!X2 || !X2.length) return 1;
                for (var Y2 = 0; Y2 < X2.length; ++Y2) {
                  if (X2.length < 2) return 1;
                  if (X2[Y2][0] === W2) return X2[Y2][1];
                  if (X2[Y2][0] > W2 && Y2 > 0) {
                    var K2 = (X2[Y2][0] - W2) / (X2[Y2][0] - X2[Y2 - 1][0]);
                    return X2[Y2][1] * (1 - K2) + K2 * X2[Y2 - 1][1];
                  }
                }
                return 1;
              }
              function N2(W2) {
                var X2 = i(W2, y.vertex, y.fragment);
                return X2.attributes.position.location = 0, X2.attributes.color.location = 2, X2.attributes.uv.location = 3, X2.attributes.normal.location = 4, X2;
              }
              function D2(W2) {
                var X2 = i(W2, w.vertex, w.fragment);
                return X2.attributes.position.location = 0, X2.attributes.color.location = 2, X2.attributes.uv.location = 3, X2;
              }
              function I2(W2) {
                var X2 = i(W2, _4.vertex, _4.fragment);
                return X2.attributes.position.location = 0, X2.attributes.color.location = 2, X2.attributes.uv.location = 3, X2.attributes.pointSize.location = 4, X2;
              }
              function O2(W2) {
                var X2 = i(W2, k.vertex, k.fragment);
                return X2.attributes.position.location = 0, X2.attributes.id.location = 1, X2;
              }
              function L2(W2) {
                var X2 = i(W2, T2.vertex, T2.fragment);
                return X2.attributes.position.location = 0, X2.attributes.id.location = 1, X2.attributes.pointSize.location = 4, X2;
              }
              function V2(W2) {
                var X2 = i(W2, A2.vertex, A2.fragment);
                return X2.attributes.position.location = 0, X2;
              }
              E2.isOpaque = function() {
                return !this.hasAlpha;
              }, E2.isTransparent = function() {
                return this.hasAlpha;
              }, E2.pickSlots = 1, E2.setPickBase = function(W2) {
                this.pickId = W2;
              }, E2.highlight = function(W2) {
                if (W2 && this.contourEnable) {
                  for (var X2 = m(this.cells, this.intensity, W2.intensity), Y2 = X2.cells, K2 = X2.vertexIds, q = X2.vertexWeights, re = Y2.length, R2 = g.mallocFloat32(6 * re), z = 0, H2 = 0; H2 < re; ++H2) for (var te = Y2[H2], j = 0; j < 2; ++j) {
                    var Q2 = te[0];
                    te.length === 2 && (Q2 = te[j]);
                    for (var Z2 = K2[Q2][0], ne = K2[Q2][1], ae = q[Q2], ue = 1 - ae, le = this.positions[Z2], ce = this.positions[ne], se = 0; se < 3; ++se) R2[z++] = ae * le[se] + ue * ce[se];
                  }
                  this.contourCount = z / 3 | 0, this.contourPositions.update(R2.subarray(0, z)), g.free(R2);
                } else this.contourCount = 0;
              }, E2.update = function(W2) {
                W2 = W2 || {};
                var X2 = this.gl;
                this.dirty = true, "contourEnable" in W2 && (this.contourEnable = W2.contourEnable), "contourColor" in W2 && (this.contourColor = W2.contourColor), "lineWidth" in W2 && (this.lineWidth = W2.lineWidth), "lightPosition" in W2 && (this.lightPosition = W2.lightPosition), this.hasAlpha = false, "opacity" in W2 && (this.opacity = W2.opacity, this.opacity < 1 && (this.hasAlpha = true)), "opacityscale" in W2 && (this.opacityscale = W2.opacityscale, this.hasAlpha = true), "ambient" in W2 && (this.ambientLight = W2.ambient), "diffuse" in W2 && (this.diffuseLight = W2.diffuse), "specular" in W2 && (this.specularLight = W2.specular), "roughness" in W2 && (this.roughness = W2.roughness), "fresnel" in W2 && (this.fresnel = W2.fresnel), W2.texture ? (this.texture.dispose(), this.texture = c(X2, W2.texture)) : W2.colormap && (this.texture.shape = [256, 256], this.texture.minFilter = X2.LINEAR_MIPMAP_LINEAR, this.texture.magFilter = X2.LINEAR, this.texture.setPixels(function(tr, Ye) {
                  for (var at = v({ colormap: tr, nshades: 256, format: "rgba" }), Ge = new Uint8Array(1024), st = 0; st < 256; ++st) {
                    for (var Ie = at[st], Pe = 0; Pe < 3; ++Pe) Ge[4 * st + Pe] = Ie[Pe];
                    Ge[4 * st + 3] = Ye ? 255 * F13(st / 255, Ye) : 255 * Ie[3];
                  }
                  return d(Ge, [256, 256, 4], [4, 0, 1]);
                }(W2.colormap, this.opacityscale)), this.texture.generateMipmap());
                var Y2 = W2.cells, K2 = W2.positions;
                if (K2 && Y2) {
                  var q = [], re = [], R2 = [], z = [], H2 = [], te = [], j = [], Q2 = [], Z2 = [], ne = [], ae = [], ue = [], le = [], ce = [];
                  this.cells = Y2, this.positions = K2;
                  var se = W2.vertexNormals, he = W2.cellNormals, me = W2.vertexNormalsEpsilon === void 0 ? 1e-6 : W2.vertexNormalsEpsilon, we = W2.faceNormalsEpsilon === void 0 ? 1e-6 : W2.faceNormalsEpsilon;
                  W2.useFacetNormals && !he && (he = f.faceNormals(Y2, K2, we)), he || se || (se = f.vertexNormals(Y2, K2, me));
                  var be = W2.vertexColors, Ae = W2.cellColors, pe = W2.meshColor || [1, 1, 1, 1], ve = W2.vertexUVs, Ee = W2.vertexIntensity, Se = W2.cellUVs, Ce = W2.cellIntensity, Be = 1 / 0, Ue = -1 / 0;
                  if (!ve && !Se) if (Ee) if (W2.vertexIntensityBounds) Be = +W2.vertexIntensityBounds[0], Ue = +W2.vertexIntensityBounds[1];
                  else for (var Ke = 0; Ke < Ee.length; ++Ke) {
                    var ct = Ee[Ke];
                    Be = Math.min(Be, ct), Ue = Math.max(Ue, ct);
                  }
                  else if (Ce) if (W2.cellIntensityBounds) Be = +W2.cellIntensityBounds[0], Ue = +W2.cellIntensityBounds[1];
                  else for (Ke = 0; Ke < Ce.length; ++Ke) ct = Ce[Ke], Be = Math.min(Be, ct), Ue = Math.max(Ue, ct);
                  else for (Ke = 0; Ke < K2.length; ++Ke) ct = K2[Ke][2], Be = Math.min(Be, ct), Ue = Math.max(Ue, ct);
                  this.intensity = Ee || Ce || function(tr) {
                    for (var Ye = tr.length, at = new Array(Ye), Ge = 0; Ge < Ye; ++Ge) at[Ge] = tr[Ge][2];
                    return at;
                  }(K2), this.pickVertex = !(Ce || Ae);
                  var We = W2.pointSizes, Ze = W2.pointSize || 1;
                  for (this.bounds = [[1 / 0, 1 / 0, 1 / 0], [-1 / 0, -1 / 0, -1 / 0]], Ke = 0; Ke < K2.length; ++Ke) for (var it = K2[Ke], ot = 0; ot < 3; ++ot) !isNaN(it[ot]) && isFinite(it[ot]) && (this.bounds[0][ot] = Math.min(this.bounds[0][ot], it[ot]), this.bounds[1][ot] = Math.max(this.bounds[1][ot], it[ot]));
                  var mt = 0, wt = 0, Et = 0;
                  e: for (Ke = 0; Ke < Y2.length; ++Ke) {
                    var zt = Y2[Ke];
                    switch (zt.length) {
                      case 1:
                        for (it = K2[yt = zt[0]], ot = 0; ot < 3; ++ot) if (isNaN(it[ot]) || !isFinite(it[ot])) continue e;
                        ne.push(it[0], it[1], it[2]), pt = be ? be[yt] : Ae ? Ae[Ke] : pe, this.opacityscale && Ee ? re.push(pt[0], pt[1], pt[2], this.opacity * F13((Ee[yt] - Be) / (Ue - Be), this.opacityscale)) : pt.length === 3 ? ae.push(pt[0], pt[1], pt[2], this.opacity) : (ae.push(pt[0], pt[1], pt[2], pt[3] * this.opacity), pt[3] < 1 && (this.hasAlpha = true)), Ot = ve ? ve[yt] : Ee ? [(Ee[yt] - Be) / (Ue - Be), 0] : Se ? Se[Ke] : Ce ? [(Ce[Ke] - Be) / (Ue - Be), 0] : [(it[2] - Be) / (Ue - Be), 0], ue.push(Ot[0], Ot[1]), We ? le.push(We[yt]) : le.push(Ze), ce.push(Ke), Et += 1;
                        break;
                      case 2:
                        for (ot = 0; ot < 2; ++ot) {
                          it = K2[yt = zt[ot]];
                          for (var Nt = 0; Nt < 3; ++Nt) if (isNaN(it[Nt]) || !isFinite(it[Nt])) continue e;
                        }
                        for (ot = 0; ot < 2; ++ot) it = K2[yt = zt[ot]], te.push(it[0], it[1], it[2]), pt = be ? be[yt] : Ae ? Ae[Ke] : pe, this.opacityscale && Ee ? re.push(pt[0], pt[1], pt[2], this.opacity * F13((Ee[yt] - Be) / (Ue - Be), this.opacityscale)) : pt.length === 3 ? j.push(pt[0], pt[1], pt[2], this.opacity) : (j.push(pt[0], pt[1], pt[2], pt[3] * this.opacity), pt[3] < 1 && (this.hasAlpha = true)), Ot = ve ? ve[yt] : Ee ? [(Ee[yt] - Be) / (Ue - Be), 0] : Se ? Se[Ke] : Ce ? [(Ce[Ke] - Be) / (Ue - Be), 0] : [(it[2] - Be) / (Ue - Be), 0], Q2.push(Ot[0], Ot[1]), Z2.push(Ke);
                        wt += 1;
                        break;
                      case 3:
                        for (ot = 0; ot < 3; ++ot) for (it = K2[yt = zt[ot]], Nt = 0; Nt < 3; ++Nt) if (isNaN(it[Nt]) || !isFinite(it[Nt])) continue e;
                        for (ot = 0; ot < 3; ++ot) {
                          var yt, pt, Ot, Jt;
                          it = K2[yt = zt[2 - ot]], q.push(it[0], it[1], it[2]), (pt = be ? be[yt] : Ae ? Ae[Ke] : pe) ? this.opacityscale && Ee ? re.push(pt[0], pt[1], pt[2], this.opacity * F13((Ee[yt] - Be) / (Ue - Be), this.opacityscale)) : pt.length === 3 ? re.push(pt[0], pt[1], pt[2], this.opacity) : (re.push(pt[0], pt[1], pt[2], pt[3] * this.opacity), pt[3] < 1 && (this.hasAlpha = true)) : re.push(0.5, 0.5, 0.5, 1), Ot = ve ? ve[yt] : Ee ? [(Ee[yt] - Be) / (Ue - Be), 0] : Se ? Se[Ke] : Ce ? [(Ce[Ke] - Be) / (Ue - Be), 0] : [(it[2] - Be) / (Ue - Be), 0], z.push(Ot[0], Ot[1]), Jt = se ? se[yt] : he[Ke], R2.push(Jt[0], Jt[1], Jt[2]), H2.push(Ke);
                        }
                        mt += 1;
                    }
                  }
                  this.pointCount = Et, this.edgeCount = wt, this.triangleCount = mt, this.pointPositions.update(ne), this.pointColors.update(ae), this.pointUVs.update(ue), this.pointSizes.update(le), this.pointIds.update(new Uint32Array(ce)), this.edgePositions.update(te), this.edgeColors.update(j), this.edgeUVs.update(Q2), this.edgeIds.update(new Uint32Array(Z2)), this.trianglePositions.update(q), this.triangleColors.update(re), this.triangleUVs.update(z), this.triangleNormals.update(R2), this.triangleIds.update(new Uint32Array(H2));
                }
              }, E2.drawTransparent = E2.draw = function(W2) {
                W2 = W2 || {};
                for (var X2 = this.gl, Y2 = W2.model || S2, K2 = W2.view || S2, q = W2.projection || S2, re = [[-1e6, -1e6, -1e6], [1e6, 1e6, 1e6]], R2 = 0; R2 < 3; ++R2) re[0][R2] = Math.max(re[0][R2], this.clipBounds[0][R2]), re[1][R2] = Math.min(re[1][R2], this.clipBounds[1][R2]);
                var z = { model: Y2, view: K2, projection: q, inverseModel: S2.slice(), clipBounds: re, kambient: this.ambientLight, kdiffuse: this.diffuseLight, kspecular: this.specularLight, roughness: this.roughness, fresnel: this.fresnel, eyePosition: [0, 0, 0], lightPosition: [0, 0, 0], contourColor: this.contourColor, texture: 0 };
                z.inverseModel = p(z.inverseModel, z.model), X2.disable(X2.CULL_FACE), this.texture.bind(0);
                var H2 = new Array(16);
                for (h(H2, z.view, z.model), h(H2, z.projection, H2), p(H2, H2), R2 = 0; R2 < 3; ++R2) z.eyePosition[R2] = H2[12 + R2] / H2[15];
                var te, j = H2[15];
                for (R2 = 0; R2 < 3; ++R2) j += this.lightPosition[R2] * H2[4 * R2 + 3];
                for (R2 = 0; R2 < 3; ++R2) {
                  for (var Q2 = H2[12 + R2], Z2 = 0; Z2 < 3; ++Z2) Q2 += H2[4 * Z2 + R2] * this.lightPosition[Z2];
                  z.lightPosition[R2] = Q2 / j;
                }
                this.triangleCount > 0 && ((te = this.triShader).bind(), te.uniforms = z, this.triangleVAO.bind(), X2.drawArrays(X2.TRIANGLES, 0, 3 * this.triangleCount), this.triangleVAO.unbind()), this.edgeCount > 0 && this.lineWidth > 0 && ((te = this.lineShader).bind(), te.uniforms = z, this.edgeVAO.bind(), X2.lineWidth(this.lineWidth * this.pixelRatio), X2.drawArrays(X2.LINES, 0, 2 * this.edgeCount), this.edgeVAO.unbind()), this.pointCount > 0 && ((te = this.pointShader).bind(), te.uniforms = z, this.pointVAO.bind(), X2.drawArrays(X2.POINTS, 0, this.pointCount), this.pointVAO.unbind()), this.contourEnable && this.contourCount > 0 && this.contourLineWidth > 0 && ((te = this.contourShader).bind(), te.uniforms = z, this.contourVAO.bind(), X2.drawArrays(X2.LINES, 0, this.contourCount), this.contourVAO.unbind());
              }, E2.drawPick = function(W2) {
                W2 = W2 || {};
                for (var X2 = this.gl, Y2 = W2.model || S2, K2 = W2.view || S2, q = W2.projection || S2, re = [[-1e6, -1e6, -1e6], [1e6, 1e6, 1e6]], R2 = 0; R2 < 3; ++R2) re[0][R2] = Math.max(re[0][R2], this.clipBounds[0][R2]), re[1][R2] = Math.min(re[1][R2], this.clipBounds[1][R2]);
                this._model = [].slice.call(Y2), this._view = [].slice.call(K2), this._projection = [].slice.call(q), this._resolution = [X2.drawingBufferWidth, X2.drawingBufferHeight];
                var z, H2 = { model: Y2, view: K2, projection: q, clipBounds: re, pickId: this.pickId / 255 };
                (z = this.pickShader).bind(), z.uniforms = H2, this.triangleCount > 0 && (this.triangleVAO.bind(), X2.drawArrays(X2.TRIANGLES, 0, 3 * this.triangleCount), this.triangleVAO.unbind()), this.edgeCount > 0 && (this.edgeVAO.bind(), X2.lineWidth(this.lineWidth * this.pixelRatio), X2.drawArrays(X2.LINES, 0, 2 * this.edgeCount), this.edgeVAO.unbind()), this.pointCount > 0 && ((z = this.pointPickShader).bind(), z.uniforms = H2, this.pointVAO.bind(), X2.drawArrays(X2.POINTS, 0, this.pointCount), this.pointVAO.unbind());
              }, E2.pick = function(W2) {
                if (!W2 || W2.id !== this.pickId) return null;
                for (var X2 = W2.value[0] + 256 * W2.value[1] + 65536 * W2.value[2], Y2 = this.cells[X2], K2 = this.positions, q = new Array(Y2.length), re = 0; re < Y2.length; ++re) q[re] = K2[Y2[re]];
                var R2 = W2.coord[0], z = W2.coord[1];
                if (!this.pickVertex) {
                  var H2 = this.positions[Y2[0]], te = this.positions[Y2[1]], j = this.positions[Y2[2]], Q2 = [(H2[0] + te[0] + j[0]) / 3, (H2[1] + te[1] + j[1]) / 3, (H2[2] + te[2] + j[2]) / 3];
                  return { _cellCenter: true, position: [R2, z], index: X2, cell: Y2, cellId: X2, intensity: this.intensity[X2], dataCoordinate: Q2 };
                }
                var Z2 = b(q, [R2 * this.pixelRatio, this._resolution[1] - z * this.pixelRatio], this._model, this._view, this._projection, this._resolution);
                if (!Z2) return null;
                var ne = Z2[2], ae = 0;
                for (re = 0; re < Y2.length; ++re) ae += ne[re] * this.intensity[Y2[re]];
                return { position: Z2[1], index: Y2[Z2[0]], cell: Y2, cellId: X2, intensity: ae, dataCoordinate: this.positions[Y2[Z2[0]]] };
              }, E2.dispose = function() {
                this.texture.dispose(), this.triShader.dispose(), this.lineShader.dispose(), this.pointShader.dispose(), this.pickShader.dispose(), this.pointPickShader.dispose(), this.triangleVAO.dispose(), this.trianglePositions.dispose(), this.triangleColors.dispose(), this.triangleUVs.dispose(), this.triangleNormals.dispose(), this.triangleIds.dispose(), this.edgeVAO.dispose(), this.edgePositions.dispose(), this.edgeColors.dispose(), this.edgeUVs.dispose(), this.edgeIds.dispose(), this.pointVAO.dispose(), this.pointPositions.dispose(), this.pointColors.dispose(), this.pointUVs.dispose(), this.pointSizes.dispose(), this.pointIds.dispose(), this.contourVAO.dispose(), this.contourPositions.dispose(), this.contourShader.dispose();
              }, o.exports = function(W2, X2) {
                arguments.length === 1 && (W2 = (X2 = W2).gl);
                var Y2 = W2.getExtension("OES_standard_derivatives") || W2.getExtension("MOZ_OES_standard_derivatives") || W2.getExtension("WEBKIT_OES_standard_derivatives");
                if (!Y2) throw new Error("derivatives not supported");
                var K2 = N2(W2), q = D2(W2), re = I2(W2), R2 = O2(W2), z = L2(W2), H2 = V2(W2), te = c(W2, d(new Uint8Array([255, 255, 255, 255]), [1, 1, 4]));
                te.generateMipmap(), te.minFilter = W2.LINEAR_MIPMAP_LINEAR, te.magFilter = W2.LINEAR;
                var j = l(W2), Q2 = l(W2), Z2 = l(W2), ne = l(W2), ae = l(W2), ue = u2(W2, [{ buffer: j, type: W2.FLOAT, size: 3 }, { buffer: ae, type: W2.UNSIGNED_BYTE, size: 4, normalized: true }, { buffer: Q2, type: W2.FLOAT, size: 4 }, { buffer: Z2, type: W2.FLOAT, size: 2 }, { buffer: ne, type: W2.FLOAT, size: 3 }]), le = l(W2), ce = l(W2), se = l(W2), he = l(W2), me = u2(W2, [{ buffer: le, type: W2.FLOAT, size: 3 }, { buffer: he, type: W2.UNSIGNED_BYTE, size: 4, normalized: true }, { buffer: ce, type: W2.FLOAT, size: 4 }, { buffer: se, type: W2.FLOAT, size: 2 }]), we = l(W2), be = l(W2), Ae = l(W2), pe = l(W2), ve = l(W2), Ee = u2(W2, [{ buffer: we, type: W2.FLOAT, size: 3 }, { buffer: ve, type: W2.UNSIGNED_BYTE, size: 4, normalized: true }, { buffer: be, type: W2.FLOAT, size: 4 }, { buffer: Ae, type: W2.FLOAT, size: 2 }, { buffer: pe, type: W2.FLOAT, size: 1 }]), Se = l(W2), Ce = u2(W2, [{ buffer: Se, type: W2.FLOAT, size: 3 }]), Be = new C2(W2, te, K2, q, re, R2, z, H2, j, ae, Q2, Z2, ne, ue, le, he, ce, se, me, we, ve, be, Ae, pe, Ee, Se, Ce);
                return Be.update(X2), Be;
              };
            }, { "./lib/closest-point": 110, "./lib/shaders": 111, colormap: 53, "gl-buffer": 78, "gl-mat4/invert": 98, "gl-mat4/multiply": 100, "gl-shader": 132, "gl-texture2d": 146, "gl-vao": 150, ndarray: 259, normals: 261, "simplicial-complex-contour": 291, "typedarray-pool": 308 }], 113: [function(a, o, s) {
              "use strict";
              o.exports = function(d) {
                var v = d.gl, m = i(v, [0, 0, 0, 1, 1, 0, 1, 1]), g = l(v, u2.boxVert, u2.lineFrag);
                return new c(d, m, g);
              };
              var i = a("gl-buffer"), l = a("gl-shader"), u2 = a("./shaders");
              function c(d, v, m) {
                this.plot = d, this.vbo = v, this.shader = m;
              }
              var f, h, p = c.prototype;
              p.bind = function() {
                var d = this.shader;
                this.vbo.bind(), this.shader.bind(), d.attributes.coord.pointer(), d.uniforms.screenBox = this.plot.screenBox;
              }, p.drawBox = (f = [0, 0], h = [0, 0], function(d, v, m, g, x) {
                var b = this.plot, y = this.shader, w = b.gl;
                f[0] = d, f[1] = v, h[0] = m, h[1] = g, y.uniforms.lo = f, y.uniforms.hi = h, y.uniforms.color = x, w.drawArrays(w.TRIANGLE_STRIP, 0, 4);
              }), p.dispose = function() {
                this.vbo.dispose(), this.shader.dispose();
              };
            }, { "./shaders": 116, "gl-buffer": 78, "gl-shader": 132 }], 114: [function(a, o, s) {
              "use strict";
              o.exports = function(b) {
                var y = b.gl, w = i(y), _4 = l(y, c.gridVert, c.gridFrag), k = l(y, c.tickVert, c.gridFrag);
                return new f(b, w, _4, k);
              };
              var i = a("gl-buffer"), l = a("gl-shader"), u2 = a("binary-search-bounds"), c = a("./shaders");
              function f(b, y, w, _4) {
                this.plot = b, this.vbo = y, this.shader = w, this.tickShader = _4, this.ticks = [[], []];
              }
              function h(b, y) {
                return b - y;
              }
              var p, d, v, m, g, x = f.prototype;
              x.draw = (p = [0, 0], d = [0, 0], v = [0, 0], function() {
                for (var b = this.plot, y = this.vbo, w = this.shader, _4 = this.ticks, k = b.gl, T2 = b._tickBounds, A2 = b.dataBox, S2 = b.viewBox, C2 = b.gridLineWidth, E2 = b.gridLineColor, F13 = b.gridLineEnable, N2 = b.pixelRatio, D2 = 0; D2 < 2; ++D2) {
                  var I2 = T2[D2], O2 = T2[D2 + 2] - I2, L2 = 0.5 * (A2[D2 + 2] + A2[D2]), V2 = A2[D2 + 2] - A2[D2];
                  d[D2] = 2 * O2 / V2, p[D2] = 2 * (I2 - L2) / V2;
                }
                w.bind(), y.bind(), w.attributes.dataCoord.pointer(), w.uniforms.dataShift = p, w.uniforms.dataScale = d;
                var W2 = 0;
                for (D2 = 0; D2 < 2; ++D2) {
                  v[0] = v[1] = 0, v[D2] = 1, w.uniforms.dataAxis = v, w.uniforms.lineWidth = C2[D2] / (S2[D2 + 2] - S2[D2]) * N2, w.uniforms.color = E2[D2];
                  var X2 = 6 * _4[D2].length;
                  F13[D2] && X2 && k.drawArrays(k.TRIANGLES, W2, X2), W2 += X2;
                }
              }), x.drawTickMarks = /* @__PURE__ */ function() {
                var b = [0, 0], y = [0, 0], w = [1, 0], _4 = [0, 1], k = [0, 0], T2 = [0, 0];
                return function() {
                  for (var A2 = this.plot, S2 = this.vbo, C2 = this.tickShader, E2 = this.ticks, F13 = A2.gl, N2 = A2._tickBounds, D2 = A2.dataBox, I2 = A2.viewBox, O2 = A2.pixelRatio, L2 = A2.screenBox, V2 = L2[2] - L2[0], W2 = L2[3] - L2[1], X2 = I2[2] - I2[0], Y2 = I2[3] - I2[1], K2 = 0; K2 < 2; ++K2) {
                    var q = N2[K2], re = N2[K2 + 2] - q, R2 = 0.5 * (D2[K2 + 2] + D2[K2]), z = D2[K2 + 2] - D2[K2];
                    y[K2] = 2 * re / z, b[K2] = 2 * (q - R2) / z;
                  }
                  y[0] *= X2 / V2, b[0] *= X2 / V2, y[1] *= Y2 / W2, b[1] *= Y2 / W2, C2.bind(), S2.bind(), C2.attributes.dataCoord.pointer();
                  var H2 = C2.uniforms;
                  H2.dataShift = b, H2.dataScale = y;
                  var te = A2.tickMarkLength, j = A2.tickMarkWidth, Q2 = A2.tickMarkColor, Z2 = 6 * E2[0].length, ne = Math.min(u2.ge(E2[0], (D2[0] - N2[0]) / (N2[2] - N2[0]), h), E2[0].length), ae = Math.min(u2.gt(E2[0], (D2[2] - N2[0]) / (N2[2] - N2[0]), h), E2[0].length), ue = 0 + 6 * ne, le = 6 * Math.max(0, ae - ne), ce = Math.min(u2.ge(E2[1], (D2[1] - N2[1]) / (N2[3] - N2[1]), h), E2[1].length), se = Math.min(u2.gt(E2[1], (D2[3] - N2[1]) / (N2[3] - N2[1]), h), E2[1].length), he = Z2 + 6 * ce, me = 6 * Math.max(0, se - ce);
                  k[0] = 2 * (I2[0] - te[1]) / V2 - 1, k[1] = (I2[3] + I2[1]) / W2 - 1, T2[0] = te[1] * O2 / V2, T2[1] = j[1] * O2 / W2, me && (H2.color = Q2[1], H2.tickScale = T2, H2.dataAxis = _4, H2.screenOffset = k, F13.drawArrays(F13.TRIANGLES, he, me)), k[0] = (I2[2] + I2[0]) / V2 - 1, k[1] = 2 * (I2[1] - te[0]) / W2 - 1, T2[0] = j[0] * O2 / V2, T2[1] = te[0] * O2 / W2, le && (H2.color = Q2[0], H2.tickScale = T2, H2.dataAxis = w, H2.screenOffset = k, F13.drawArrays(F13.TRIANGLES, ue, le)), k[0] = 2 * (I2[2] + te[3]) / V2 - 1, k[1] = (I2[3] + I2[1]) / W2 - 1, T2[0] = te[3] * O2 / V2, T2[1] = j[3] * O2 / W2, me && (H2.color = Q2[3], H2.tickScale = T2, H2.dataAxis = _4, H2.screenOffset = k, F13.drawArrays(F13.TRIANGLES, he, me)), k[0] = (I2[2] + I2[0]) / V2 - 1, k[1] = 2 * (I2[3] + te[2]) / W2 - 1, T2[0] = j[2] * O2 / V2, T2[1] = te[2] * O2 / W2, le && (H2.color = Q2[2], H2.tickScale = T2, H2.dataAxis = w, H2.screenOffset = k, F13.drawArrays(F13.TRIANGLES, ue, le));
                };
              }(), x.update = (m = [1, 1, -1, -1, 1, -1], g = [1, -1, 1, 1, -1, -1], function(b) {
                for (var y = b.ticks, w = b.bounds, _4 = new Float32Array(18 * (y[0].length + y[1].length)), k = (this.plot.zeroLineEnable, 0), T2 = [[], []], A2 = 0; A2 < 2; ++A2) for (var S2 = T2[A2], C2 = y[A2], E2 = w[A2], F13 = w[A2 + 2], N2 = 0; N2 < C2.length; ++N2) {
                  var D2 = (C2[N2].x - E2) / (F13 - E2);
                  S2.push(D2);
                  for (var I2 = 0; I2 < 6; ++I2) _4[k++] = D2, _4[k++] = m[I2], _4[k++] = g[I2];
                }
                this.ticks = T2, this.vbo.update(_4);
              }), x.dispose = function() {
                this.vbo.dispose(), this.shader.dispose(), this.tickShader.dispose();
              };
            }, { "./shaders": 116, "binary-search-bounds": 31, "gl-buffer": 78, "gl-shader": 132 }], 115: [function(a, o, s) {
              "use strict";
              o.exports = function(d) {
                var v = d.gl, m = i(v, [-1, -1, -1, 1, 1, -1, 1, 1]), g = l(v, u2.lineVert, u2.lineFrag);
                return new c(d, m, g);
              };
              var i = a("gl-buffer"), l = a("gl-shader"), u2 = a("./shaders");
              function c(d, v, m) {
                this.plot = d, this.vbo = v, this.shader = m;
              }
              var f, h, p = c.prototype;
              p.bind = function() {
                var d = this.shader;
                this.vbo.bind(), this.shader.bind(), d.attributes.coord.pointer(), d.uniforms.screenBox = this.plot.screenBox;
              }, p.drawLine = (f = [0, 0], h = [0, 0], function(d, v, m, g, x, b) {
                var y = this.plot, w = this.shader, _4 = y.gl;
                f[0] = d, f[1] = v, h[0] = m, h[1] = g, w.uniforms.start = f, w.uniforms.end = h, w.uniforms.width = x * y.pixelRatio, w.uniforms.color = b, _4.drawArrays(_4.TRIANGLE_STRIP, 0, 4);
              }), p.dispose = function() {
                this.vbo.dispose(), this.shader.dispose();
              };
            }, { "./shaders": 116, "gl-buffer": 78, "gl-shader": 132 }], 116: [function(a, o, s) {
              "use strict";
              var i = a("glslify"), l = i([`precision lowp float;
#define GLSLIFY 1
uniform vec4 color;
void main() {
  gl_FragColor = vec4(color.xyz * color.w, color.w);
}
`]);
              o.exports = { lineVert: i([`precision mediump float;
#define GLSLIFY 1

attribute vec2 coord;

uniform vec4 screenBox;
uniform vec2 start, end;
uniform float width;

vec2 perp(vec2 v) {
  return vec2(v.y, -v.x);
}

vec2 screen(vec2 v) {
  return 2.0 * (v - screenBox.xy) / (screenBox.zw - screenBox.xy) - 1.0;
}

void main() {
  vec2 delta = normalize(perp(start - end));
  vec2 offset = mix(start, end, 0.5 * (coord.y+1.0));
  gl_Position = vec4(screen(offset + 0.5 * width * delta * coord.x), 0, 1);
}
`]), lineFrag: l, textVert: i([`#define GLSLIFY 1
attribute vec3 textCoordinate;

uniform vec2 dataScale, dataShift, dataAxis, screenOffset, textScale;
uniform float angle;

void main() {
  float dataOffset  = textCoordinate.z;
  vec2 glyphOffset  = textCoordinate.xy;
  mat2 glyphMatrix = mat2(cos(angle), sin(angle), -sin(angle), cos(angle));
  vec2 screenCoordinate = dataAxis * (dataScale * dataOffset + dataShift) +
    glyphMatrix * glyphOffset * textScale + screenOffset;
  gl_Position = vec4(screenCoordinate, 0, 1);
}
`]), textFrag: l, gridVert: i([`precision mediump float;
#define GLSLIFY 1

attribute vec3 dataCoord;

uniform vec2 dataAxis, dataShift, dataScale;
uniform float lineWidth;

void main() {
  vec2 pos = dataAxis * (dataScale * dataCoord.x + dataShift);
  pos += 10.0 * dataCoord.y * vec2(dataAxis.y, -dataAxis.x) + dataCoord.z * lineWidth;
  gl_Position = vec4(pos, 0, 1);
}
`]), gridFrag: l, boxVert: i([`precision mediump float;
#define GLSLIFY 1

attribute vec2 coord;

uniform vec4 screenBox;
uniform vec2 lo, hi;

vec2 screen(vec2 v) {
  return 2.0 * (v - screenBox.xy) / (screenBox.zw - screenBox.xy) - 1.0;
}

void main() {
  gl_Position = vec4(screen(mix(lo, hi, coord)), 0, 1);
}
`]), tickVert: i([`precision mediump float;
#define GLSLIFY 1

attribute vec3 dataCoord;

uniform vec2 dataAxis, dataShift, dataScale, screenOffset, tickScale;

void main() {
  vec2 pos = dataAxis * (dataScale * dataCoord.x + dataShift);
  gl_Position = vec4(pos + tickScale*dataCoord.yz + screenOffset, 0, 1);
}
`]) };
            }, { glslify: 231 }], 117: [function(a, o, s) {
              "use strict";
              o.exports = function(y) {
                var w = y.gl, _4 = i(w), k = l(w, f.textVert, f.textFrag);
                return new h(y, _4, k);
              };
              var i = a("gl-buffer"), l = a("gl-shader"), u2 = a("text-cache"), c = a("binary-search-bounds"), f = a("./shaders");
              function h(y, w, _4) {
                this.plot = y, this.vbo = w, this.shader = _4, this.tickOffset = [[], []], this.tickX = [[], []], this.labelOffset = [0, 0], this.labelCount = [0, 0];
              }
              var p, d, v, m, g, x, b = h.prototype;
              b.drawTicks = (p = [0, 0], d = [0, 0], v = [0, 0], function(y) {
                var w = this.plot, _4 = this.shader, k = this.tickX[y], T2 = this.tickOffset[y], A2 = w.gl, S2 = w.viewBox, C2 = w.dataBox, E2 = w.screenBox, F13 = w.pixelRatio, N2 = w.tickEnable, D2 = w.tickPad, I2 = w.tickColor, O2 = w.tickAngle, L2 = w.labelEnable, V2 = w.labelPad, W2 = w.labelColor, X2 = w.labelAngle, Y2 = this.labelOffset[y], K2 = this.labelCount[y], q = c.lt(k, C2[y]), re = c.le(k, C2[y + 2]);
                p[0] = p[1] = 0, p[y] = 1, d[y] = (S2[2 + y] + S2[y]) / (E2[2 + y] - E2[y]) - 1;
                var R2 = 2 / E2[2 + (1 ^ y)] - E2[1 ^ y];
                d[1 ^ y] = R2 * S2[1 ^ y] - 1, N2[y] && (d[1 ^ y] -= R2 * F13 * D2[y], q < re && T2[re] > T2[q] && (_4.uniforms.dataAxis = p, _4.uniforms.screenOffset = d, _4.uniforms.color = I2[y], _4.uniforms.angle = O2[y], A2.drawArrays(A2.TRIANGLES, T2[q], T2[re] - T2[q]))), L2[y] && K2 && (d[1 ^ y] -= R2 * F13 * V2[y], _4.uniforms.dataAxis = v, _4.uniforms.screenOffset = d, _4.uniforms.color = W2[y], _4.uniforms.angle = X2[y], A2.drawArrays(A2.TRIANGLES, Y2, K2)), d[1 ^ y] = R2 * S2[2 + (1 ^ y)] - 1, N2[y + 2] && (d[1 ^ y] += R2 * F13 * D2[y + 2], q < re && T2[re] > T2[q] && (_4.uniforms.dataAxis = p, _4.uniforms.screenOffset = d, _4.uniforms.color = I2[y + 2], _4.uniforms.angle = O2[y + 2], A2.drawArrays(A2.TRIANGLES, T2[q], T2[re] - T2[q]))), L2[y + 2] && K2 && (d[1 ^ y] += R2 * F13 * V2[y + 2], _4.uniforms.dataAxis = v, _4.uniforms.screenOffset = d, _4.uniforms.color = W2[y + 2], _4.uniforms.angle = X2[y + 2], A2.drawArrays(A2.TRIANGLES, Y2, K2));
              }), b.drawTitle = /* @__PURE__ */ function() {
                var y = [0, 0], w = [0, 0];
                return function() {
                  var _4 = this.plot, k = this.shader, T2 = _4.gl, A2 = _4.screenBox, S2 = _4.titleCenter, C2 = _4.titleAngle, E2 = _4.titleColor, F13 = _4.pixelRatio;
                  if (this.titleCount) {
                    for (var N2 = 0; N2 < 2; ++N2) w[N2] = 2 * (S2[N2] * F13 - A2[N2]) / (A2[2 + N2] - A2[N2]) - 1;
                    k.bind(), k.uniforms.dataAxis = y, k.uniforms.screenOffset = w, k.uniforms.angle = C2, k.uniforms.color = E2, T2.drawArrays(T2.TRIANGLES, this.titleOffset, this.titleCount);
                  }
                };
              }(), b.bind = (m = [0, 0], g = [0, 0], x = [0, 0], function() {
                var y = this.plot, w = this.shader, _4 = y._tickBounds, k = y.dataBox, T2 = y.screenBox, A2 = y.viewBox;
                w.bind();
                for (var S2 = 0; S2 < 2; ++S2) {
                  var C2 = _4[S2], E2 = _4[S2 + 2] - C2, F13 = 0.5 * (k[S2 + 2] + k[S2]), N2 = k[S2 + 2] - k[S2], D2 = A2[S2], I2 = A2[S2 + 2] - D2, O2 = T2[S2], L2 = T2[S2 + 2] - O2;
                  g[S2] = 2 * E2 / N2 * I2 / L2, m[S2] = 2 * (C2 - F13) / N2 * I2 / L2;
                }
                x[1] = 2 * y.pixelRatio / (T2[3] - T2[1]), x[0] = x[1] * (T2[3] - T2[1]) / (T2[2] - T2[0]), w.uniforms.dataScale = g, w.uniforms.dataShift = m, w.uniforms.textScale = x, this.vbo.bind(), w.attributes.textCoordinate.pointer();
              }), b.update = function(y) {
                var w, _4, k, T2, A2, S2 = [], C2 = y.ticks, E2 = y.bounds;
                for (A2 = 0; A2 < 2; ++A2) {
                  var F13 = [Math.floor(S2.length / 3)], N2 = [-1 / 0], D2 = C2[A2];
                  for (w = 0; w < D2.length; ++w) {
                    var I2 = D2[w], O2 = I2.x, L2 = I2.text, V2 = I2.font || "sans-serif";
                    T2 = I2.fontSize || 12;
                    for (var W2 = 1 / (E2[A2 + 2] - E2[A2]), X2 = E2[A2], Y2 = L2.split(`
`), K2 = 0; K2 < Y2.length; K2++) for (k = u2(V2, Y2[K2]).data, _4 = 0; _4 < k.length; _4 += 2) S2.push(k[_4] * T2, -k[_4 + 1] * T2 - K2 * T2 * 1.2, (O2 - X2) * W2);
                    F13.push(Math.floor(S2.length / 3)), N2.push(O2);
                  }
                  this.tickOffset[A2] = F13, this.tickX[A2] = N2;
                }
                for (A2 = 0; A2 < 2; ++A2) {
                  for (this.labelOffset[A2] = Math.floor(S2.length / 3), k = u2(y.labelFont[A2], y.labels[A2], { textAlign: "center" }).data, T2 = y.labelSize[A2], w = 0; w < k.length; w += 2) S2.push(k[w] * T2, -k[w + 1] * T2, 0);
                  this.labelCount[A2] = Math.floor(S2.length / 3) - this.labelOffset[A2];
                }
                for (this.titleOffset = Math.floor(S2.length / 3), k = u2(y.titleFont, y.title).data, T2 = y.titleSize, w = 0; w < k.length; w += 2) S2.push(k[w] * T2, -k[w + 1] * T2, 0);
                this.titleCount = Math.floor(S2.length / 3) - this.titleOffset, this.vbo.update(S2);
              }, b.dispose = function() {
                this.vbo.dispose(), this.shader.dispose();
              };
            }, { "./shaders": 116, "binary-search-bounds": 31, "gl-buffer": 78, "gl-shader": 132, "text-cache": 303 }], 118: [function(a, o, s) {
              "use strict";
              o.exports = function(m) {
                var g = m.gl, x = i(g, [g.drawingBufferWidth, g.drawingBufferHeight]), b = new h(g, x);
                return b.grid = l(b), b.text = u2(b), b.line = c(b), b.box = f(b), b.update(m), b;
              };
              var i = a("gl-select-static"), l = a("./lib/grid"), u2 = a("./lib/text"), c = a("./lib/line"), f = a("./lib/box");
              function h(m, g) {
                this.gl = m, this.pickBuffer = g, this.screenBox = [0, 0, m.drawingBufferWidth, m.drawingBufferHeight], this.viewBox = [0, 0, 0, 0], this.dataBox = [-10, -10, 10, 10], this.gridLineEnable = [true, true], this.gridLineWidth = [1, 1], this.gridLineColor = [[0, 0, 0, 1], [0, 0, 0, 1]], this.pixelRatio = 1, this.tickMarkLength = [0, 0, 0, 0], this.tickMarkWidth = [0, 0, 0, 0], this.tickMarkColor = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]], this.tickPad = [15, 15, 15, 15], this.tickAngle = [0, 0, 0, 0], this.tickEnable = [true, true, true, true], this.tickColor = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]], this.labelPad = [15, 15, 15, 15], this.labelAngle = [0, Math.PI / 2, 0, 3 * Math.PI / 2], this.labelEnable = [true, true, true, true], this.labelColor = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]], this.titleCenter = [0, 0], this.titleEnable = true, this.titleAngle = 0, this.titleColor = [0, 0, 0, 1], this.borderColor = [0, 0, 0, 0], this.backgroundColor = [0, 0, 0, 0], this.zeroLineEnable = [true, true], this.zeroLineWidth = [4, 4], this.zeroLineColor = [[0, 0, 0, 1], [0, 0, 0, 1]], this.borderLineEnable = [true, true, true, true], this.borderLineWidth = [2, 2, 2, 2], this.borderLineColor = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]], this.grid = null, this.text = null, this.line = null, this.box = null, this.objects = [], this.overlays = [], this._tickBounds = [1 / 0, 1 / 0, -1 / 0, -1 / 0], this.static = false, this.dirty = false, this.pickDirty = false, this.pickDelay = 120, this.pickRadius = 10, this._pickTimeout = null, this._drawPick = this.drawPick.bind(this), this._depthCounter = 0;
              }
              var p = h.prototype;
              function d(m) {
                for (var g = m.slice(), x = 0; x < g.length; ++x) g[x] = g[x].slice();
                return g;
              }
              function v(m, g) {
                return m.x - g.x;
              }
              p.setDirty = function() {
                this.dirty = this.pickDirty = true;
              }, p.setOverlayDirty = function() {
                this.dirty = true;
              }, p.nextDepthValue = function() {
                return this._depthCounter++ / 65536;
              }, p.draw = function() {
                var m = this.gl, g = this.screenBox, x = this.viewBox, b = this.dataBox, y = this.pixelRatio, w = this.grid, _4 = this.line, k = this.text, T2 = this.objects;
                if (this._depthCounter = 0, this.pickDirty && (this._pickTimeout && clearTimeout(this._pickTimeout), this.pickDirty = false, this._pickTimeout = setTimeout(this._drawPick, this.pickDelay)), this.dirty) {
                  if (this.dirty = false, m.bindFramebuffer(m.FRAMEBUFFER, null), m.enable(m.SCISSOR_TEST), m.disable(m.DEPTH_TEST), m.depthFunc(m.LESS), m.depthMask(false), m.enable(m.BLEND), m.blendEquation(m.FUNC_ADD, m.FUNC_ADD), m.blendFunc(m.ONE, m.ONE_MINUS_SRC_ALPHA), this.borderColor) {
                    m.scissor(g[0], g[1], g[2] - g[0], g[3] - g[1]);
                    var A2 = this.borderColor;
                    m.clearColor(A2[0] * A2[3], A2[1] * A2[3], A2[2] * A2[3], A2[3]), m.clear(m.COLOR_BUFFER_BIT | m.DEPTH_BUFFER_BIT);
                  }
                  m.scissor(x[0], x[1], x[2] - x[0], x[3] - x[1]), m.viewport(x[0], x[1], x[2] - x[0], x[3] - x[1]);
                  var S2 = this.backgroundColor;
                  m.clearColor(S2[0] * S2[3], S2[1] * S2[3], S2[2] * S2[3], S2[3]), m.clear(m.COLOR_BUFFER_BIT), w.draw();
                  var C2 = this.zeroLineEnable, E2 = this.zeroLineColor, F13 = this.zeroLineWidth;
                  if (C2[0] || C2[1]) {
                    _4.bind();
                    for (var N2 = 0; N2 < 2; ++N2) if (C2[N2] && b[N2] <= 0 && b[N2 + 2] >= 0) {
                      var D2 = g[N2] - b[N2] * (g[N2 + 2] - g[N2]) / (b[N2 + 2] - b[N2]);
                      N2 === 0 ? _4.drawLine(D2, g[1], D2, g[3], F13[N2], E2[N2]) : _4.drawLine(g[0], D2, g[2], D2, F13[N2], E2[N2]);
                    }
                  }
                  for (N2 = 0; N2 < T2.length; ++N2) T2[N2].draw();
                  m.viewport(g[0], g[1], g[2] - g[0], g[3] - g[1]), m.scissor(g[0], g[1], g[2] - g[0], g[3] - g[1]), this.grid.drawTickMarks(), _4.bind();
                  var I2 = this.borderLineEnable, O2 = this.borderLineWidth, L2 = this.borderLineColor;
                  for (I2[1] && _4.drawLine(x[0], x[1] - 0.5 * O2[1] * y, x[0], x[3] + 0.5 * O2[3] * y, O2[1], L2[1]), I2[0] && _4.drawLine(x[0] - 0.5 * O2[0] * y, x[1], x[2] + 0.5 * O2[2] * y, x[1], O2[0], L2[0]), I2[3] && _4.drawLine(x[2], x[1] - 0.5 * O2[1] * y, x[2], x[3] + 0.5 * O2[3] * y, O2[3], L2[3]), I2[2] && _4.drawLine(x[0] - 0.5 * O2[0] * y, x[3], x[2] + 0.5 * O2[2] * y, x[3], O2[2], L2[2]), k.bind(), N2 = 0; N2 < 2; ++N2) k.drawTicks(N2);
                  this.titleEnable && k.drawTitle();
                  var V2 = this.overlays;
                  for (N2 = 0; N2 < V2.length; ++N2) V2[N2].draw();
                  m.disable(m.SCISSOR_TEST), m.disable(m.BLEND), m.depthMask(true);
                }
              }, p.drawPick = function() {
                if (!this.static) {
                  var m = this.pickBuffer;
                  this.gl, this._pickTimeout = null, m.begin();
                  for (var g = 1, x = this.objects, b = 0; b < x.length; ++b) g = x[b].drawPick(g);
                  m.end();
                }
              }, p.pick = function(m, g) {
                if (!this.static) {
                  var x = this.pixelRatio, b = this.pickPixelRatio, y = this.viewBox, w = 0 | Math.round((m - y[0] / x) * b), _4 = 0 | Math.round((g - y[1] / x) * b), k = this.pickBuffer.query(w, _4, this.pickRadius);
                  if (!k) return null;
                  for (var T2 = k.id + (k.value[0] << 8) + (k.value[1] << 16) + (k.value[2] << 24), A2 = this.objects, S2 = 0; S2 < A2.length; ++S2) {
                    var C2 = A2[S2].pick(w, _4, T2);
                    if (C2) return C2;
                  }
                  return null;
                }
              }, p.setScreenBox = function(m) {
                var g = this.screenBox, x = this.pixelRatio;
                g[0] = 0 | Math.round(m[0] * x), g[1] = 0 | Math.round(m[1] * x), g[2] = 0 | Math.round(m[2] * x), g[3] = 0 | Math.round(m[3] * x), this.setDirty();
              }, p.setDataBox = function(m) {
                var g = this.dataBox;
                (g[0] !== m[0] || g[1] !== m[1] || g[2] !== m[2] || g[3] !== m[3]) && (g[0] = m[0], g[1] = m[1], g[2] = m[2], g[3] = m[3], this.setDirty());
              }, p.setViewBox = function(m) {
                var g = this.pixelRatio, x = this.viewBox;
                x[0] = 0 | Math.round(m[0] * g), x[1] = 0 | Math.round(m[1] * g), x[2] = 0 | Math.round(m[2] * g), x[3] = 0 | Math.round(m[3] * g);
                var b = this.pickPixelRatio;
                this.pickBuffer.shape = [0 | Math.round((m[2] - m[0]) * b), 0 | Math.round((m[3] - m[1]) * b)], this.setDirty();
              }, p.update = function(m) {
                m = m || {};
                var g = this.gl;
                this.pixelRatio = m.pixelRatio || 1;
                var x = this.pixelRatio;
                this.pickPixelRatio = Math.max(x, 1), this.setScreenBox(m.screenBox || [0, 0, g.drawingBufferWidth / x, g.drawingBufferHeight / x]), this.screenBox, this.setViewBox(m.viewBox || [0.125 * (this.screenBox[2] - this.screenBox[0]) / x, 0.125 * (this.screenBox[3] - this.screenBox[1]) / x, 0.875 * (this.screenBox[2] - this.screenBox[0]) / x, 0.875 * (this.screenBox[3] - this.screenBox[1]) / x]);
                var b = this.viewBox, y = (b[2] - b[0]) / (b[3] - b[1]);
                this.setDataBox(m.dataBox || [-10, -10 / y, 10, 10 / y]), this.borderColor = m.borderColor !== false && (m.borderColor || [0, 0, 0, 0]).slice(), this.backgroundColor = (m.backgroundColor || [0, 0, 0, 0]).slice(), this.gridLineEnable = (m.gridLineEnable || [true, true]).slice(), this.gridLineWidth = (m.gridLineWidth || [1, 1]).slice(), this.gridLineColor = d(m.gridLineColor || [[0.5, 0.5, 0.5, 1], [0.5, 0.5, 0.5, 1]]), this.zeroLineEnable = (m.zeroLineEnable || [true, true]).slice(), this.zeroLineWidth = (m.zeroLineWidth || [4, 4]).slice(), this.zeroLineColor = d(m.zeroLineColor || [[0, 0, 0, 1], [0, 0, 0, 1]]), this.tickMarkLength = (m.tickMarkLength || [0, 0, 0, 0]).slice(), this.tickMarkWidth = (m.tickMarkWidth || [0, 0, 0, 0]).slice(), this.tickMarkColor = d(m.tickMarkColor || [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]]), this.titleCenter = (m.titleCenter || [0.5 * (b[0] + b[2]) / x, (b[3] + 120) / x]).slice(), this.titleEnable = !("titleEnable" in m) || !!m.titleEnable, this.titleAngle = m.titleAngle || 0, this.titleColor = (m.titleColor || [0, 0, 0, 1]).slice(), this.labelPad = (m.labelPad || [15, 15, 15, 15]).slice(), this.labelAngle = (m.labelAngle || [0, Math.PI / 2, 0, 3 * Math.PI / 2]).slice(), this.labelEnable = (m.labelEnable || [true, true, true, true]).slice(), this.labelColor = d(m.labelColor || [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]]), this.tickPad = (m.tickPad || [15, 15, 15, 15]).slice(), this.tickAngle = (m.tickAngle || [0, 0, 0, 0]).slice(), this.tickEnable = (m.tickEnable || [true, true, true, true]).slice(), this.tickColor = d(m.tickColor || [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]]), this.borderLineEnable = (m.borderLineEnable || [true, true, true, true]).slice(), this.borderLineWidth = (m.borderLineWidth || [2, 2, 2, 2]).slice(), this.borderLineColor = d(m.borderLineColor || [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]]);
                var w = m.ticks || [[], []], _4 = this._tickBounds;
                _4[0] = _4[1] = 1 / 0, _4[2] = _4[3] = -1 / 0;
                for (var k = 0; k < 2; ++k) {
                  var T2 = w[k].slice(0);
                  T2.length !== 0 && (T2.sort(v), _4[k] = Math.min(_4[k], T2[0].x), _4[k + 2] = Math.max(_4[k + 2], T2[T2.length - 1].x));
                }
                this.grid.update({ bounds: _4, ticks: w }), this.text.update({ bounds: _4, ticks: w, labels: m.labels || ["x", "y"], labelSize: m.labelSize || [12, 12], labelFont: m.labelFont || ["sans-serif", "sans-serif"], title: m.title || "", titleSize: m.titleSize || 18, titleFont: m.titleFont || "sans-serif" }), this.static = !!m.static, this.setDirty();
              }, p.dispose = function() {
                this.box.dispose(), this.grid.dispose(), this.text.dispose(), this.line.dispose();
                for (var m = this.objects.length - 1; m >= 0; --m) this.objects[m].dispose();
                for (this.objects.length = 0, m = this.overlays.length - 1; m >= 0; --m) this.overlays[m].dispose();
                this.overlays.length = 0, this.gl = null;
              }, p.addObject = function(m) {
                this.objects.indexOf(m) < 0 && (this.objects.push(m), this.setDirty());
              }, p.removeObject = function(m) {
                for (var g = this.objects, x = 0; x < g.length; ++x) if (g[x] === m) {
                  g.splice(x, 1), this.setDirty();
                  break;
                }
              }, p.addOverlay = function(m) {
                this.overlays.indexOf(m) < 0 && (this.overlays.push(m), this.setOverlayDirty());
              }, p.removeOverlay = function(m) {
                for (var g = this.overlays, x = 0; x < g.length; ++x) if (g[x] === m) {
                  g.splice(x, 1), this.setOverlayDirty();
                  break;
                }
              };
            }, { "./lib/box": 113, "./lib/grid": 114, "./lib/line": 115, "./lib/text": 117, "gl-select-static": 131 }], 119: [function(a, o, s) {
              "use strict";
              o.exports = function(p, d) {
                p = p || document.body, d = d || {};
                var v = [0.01, 1 / 0];
                "distanceLimits" in d && (v[0] = d.distanceLimits[0], v[1] = d.distanceLimits[1]), "zoomMin" in d && (v[0] = d.zoomMin), "zoomMax" in d && (v[1] = d.zoomMax);
                var m = l({ center: d.center || [0, 0, 0], up: d.up || [0, 1, 0], eye: d.eye || [0, 0, 10], mode: d.mode || "orbit", distanceLimits: v }), g = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], x = 0, b = p.clientWidth, y = p.clientHeight, w = { keyBindingMode: "rotate", enableWheel: true, view: m, element: p, delay: d.delay || 16, rotateSpeed: d.rotateSpeed || 1, zoomSpeed: d.zoomSpeed || 1, translateSpeed: d.translateSpeed || 1, flipX: !!d.flipX, flipY: !!d.flipY, modes: m.modes, _ortho: d._ortho || d.projection && d.projection.type === "orthographic" || false, tick: function() {
                  var _4 = i(), k = this.delay, T2 = _4 - 2 * k;
                  m.idle(_4 - k), m.recalcMatrix(T2), m.flush(_4 - (100 + 2 * k));
                  for (var A2 = true, S2 = m.computedMatrix, C2 = 0; C2 < 16; ++C2) A2 = A2 && g[C2] === S2[C2], g[C2] = S2[C2];
                  var E2 = p.clientWidth === b && p.clientHeight === y;
                  return b = p.clientWidth, y = p.clientHeight, A2 ? !E2 : (x = Math.exp(m.computedRadius[0]), true);
                }, lookAt: function(_4, k, T2) {
                  m.lookAt(m.lastT(), _4, k, T2);
                }, rotate: function(_4, k, T2) {
                  m.rotate(m.lastT(), _4, k, T2);
                }, pan: function(_4, k, T2) {
                  m.pan(m.lastT(), _4, k, T2);
                }, translate: function(_4, k, T2) {
                  m.translate(m.lastT(), _4, k, T2);
                } };
                return Object.defineProperties(w, { matrix: { get: function() {
                  return m.computedMatrix;
                }, set: function(_4) {
                  return m.setMatrix(m.lastT(), _4), m.computedMatrix;
                }, enumerable: true }, mode: { get: function() {
                  return m.getMode();
                }, set: function(_4) {
                  var k = m.computedUp.slice(), T2 = m.computedEye.slice(), A2 = m.computedCenter.slice();
                  if (m.setMode(_4), _4 === "turntable") {
                    var S2 = i();
                    m._active.lookAt(S2, T2, A2, k), m._active.lookAt(S2 + 500, T2, A2, [0, 0, 1]), m._active.flush(S2);
                  }
                  return m.getMode();
                }, enumerable: true }, center: { get: function() {
                  return m.computedCenter;
                }, set: function(_4) {
                  return m.lookAt(m.lastT(), null, _4), m.computedCenter;
                }, enumerable: true }, eye: { get: function() {
                  return m.computedEye;
                }, set: function(_4) {
                  return m.lookAt(m.lastT(), _4), m.computedEye;
                }, enumerable: true }, up: { get: function() {
                  return m.computedUp;
                }, set: function(_4) {
                  return m.lookAt(m.lastT(), null, null, _4), m.computedUp;
                }, enumerable: true }, distance: { get: function() {
                  return x;
                }, set: function(_4) {
                  return m.setDistance(m.lastT(), _4), _4;
                }, enumerable: true }, distanceLimits: { get: function() {
                  return m.getDistanceLimits(v);
                }, set: function(_4) {
                  return m.setDistanceLimits(_4), _4;
                }, enumerable: true } }), p.addEventListener("contextmenu", function(_4) {
                  return _4.preventDefault(), false;
                }), w._lastX = -1, w._lastY = -1, w._lastMods = { shift: false, control: false, alt: false, meta: false }, w.enableMouseListeners = function() {
                  function _4(k, T2, A2, S2) {
                    var C2 = w.keyBindingMode;
                    if (C2 !== false) {
                      var E2 = C2 === "rotate", F13 = C2 === "pan", N2 = C2 === "zoom", D2 = !!S2.control, I2 = !!S2.alt, O2 = !!S2.shift, L2 = !!(1 & k), V2 = !!(2 & k), W2 = !!(4 & k), X2 = 1 / p.clientHeight, Y2 = X2 * (T2 - w._lastX), K2 = X2 * (A2 - w._lastY), q = w.flipX ? 1 : -1, re = w.flipY ? 1 : -1, R2 = Math.PI * w.rotateSpeed, z = i();
                      if (w._lastX !== -1 && w._lastY !== -1 && ((E2 && L2 && !D2 && !I2 && !O2 || L2 && !D2 && !I2 && O2) && m.rotate(z, q * R2 * Y2, -re * R2 * K2, 0), (F13 && L2 && !D2 && !I2 && !O2 || V2 || L2 && D2 && !I2 && !O2) && m.pan(z, -w.translateSpeed * Y2 * x, w.translateSpeed * K2 * x, 0), N2 && L2 && !D2 && !I2 && !O2 || W2 || L2 && !D2 && I2 && !O2)) {
                        var H2 = -w.zoomSpeed * K2 / window.innerHeight * (z - m.lastT()) * 100;
                        m.pan(z, 0, 0, x * (Math.exp(H2) - 1));
                      }
                      return w._lastX = T2, w._lastY = A2, w._lastMods = S2, true;
                    }
                  }
                  w.mouseListener = u2(p, _4), p.addEventListener("touchstart", function(k) {
                    var T2 = f(k.changedTouches[0], p);
                    _4(0, T2[0], T2[1], w._lastMods), _4(1, T2[0], T2[1], w._lastMods);
                  }, !!h && { passive: true }), p.addEventListener("touchmove", function(k) {
                    var T2 = f(k.changedTouches[0], p);
                    _4(1, T2[0], T2[1], w._lastMods), k.preventDefault();
                  }, !!h && { passive: false }), p.addEventListener("touchend", function(k) {
                    _4(0, w._lastX, w._lastY, w._lastMods);
                  }, !!h && { passive: true }), w.wheelListener = c(p, function(k, T2) {
                    if (w.keyBindingMode !== false && w.enableWheel) {
                      var A2 = w.flipX ? 1 : -1, S2 = w.flipY ? 1 : -1, C2 = i();
                      if (Math.abs(k) > Math.abs(T2)) m.rotate(C2, 0, 0, -k * A2 * Math.PI * w.rotateSpeed / window.innerWidth);
                      else if (!w._ortho) {
                        var E2 = -w.zoomSpeed * S2 * T2 / window.innerHeight * (C2 - m.lastT()) / 20;
                        m.pan(C2, 0, 0, x * (Math.exp(E2) - 1));
                      }
                    }
                  }, true);
                }, w.enableMouseListeners(), w;
              };
              var i = a("right-now"), l = a("3d-view"), u2 = a("mouse-change"), c = a("mouse-wheel"), f = a("mouse-event-offset"), h = a("has-passive-events");
            }, { "3d-view": 7, "has-passive-events": 232, "mouse-change": 247, "mouse-event-offset": 248, "mouse-wheel": 250, "right-now": 278 }], 120: [function(a, o, s) {
              var i = a("glslify"), l = a("gl-shader"), u2 = i([`precision mediump float;
#define GLSLIFY 1
attribute vec2 position;
varying vec2 uv;
void main() {
  uv = position;
  gl_Position = vec4(position, 0, 1);
}`]), c = i([`precision mediump float;
#define GLSLIFY 1

uniform sampler2D accumBuffer;
varying vec2 uv;

void main() {
  vec4 accum = texture2D(accumBuffer, 0.5 * (uv + 1.0));
  gl_FragColor = min(vec4(1,1,1,1), accum);
}`]);
              o.exports = function(f) {
                return l(f, u2, c, null, [{ name: "position", type: "vec2" }]);
              };
            }, { "gl-shader": 132, glslify: 231 }], 121: [function(a, o, s) {
              "use strict";
              var i = a("./camera.js"), l = a("gl-axes3d"), u2 = a("gl-axes3d/properties"), c = a("gl-spikes3d"), f = a("gl-select-static"), h = a("gl-fbo"), p = a("a-big-triangle"), d = a("mouse-change"), v = a("gl-mat4/perspective"), m = a("gl-mat4/ortho"), g = a("./lib/shader"), x = a("is-mobile")({ tablet: true, featureDetect: true });
              function b() {
                this.mouse = [-1, -1], this.screen = null, this.distance = 1 / 0, this.index = null, this.dataCoordinate = null, this.dataPosition = null, this.object = null, this.data = null;
              }
              function y(_4) {
                var k = Math.round(Math.log(Math.abs(_4)) / Math.log(10));
                if (k < 0) {
                  var T2 = Math.round(Math.pow(10, -k));
                  return Math.ceil(_4 * T2) / T2;
                }
                return k > 0 ? (T2 = Math.round(Math.pow(10, k)), Math.ceil(_4 / T2) * T2) : Math.ceil(_4);
              }
              function w(_4) {
                return typeof _4 != "boolean" || _4;
              }
              o.exports = { createScene: function(_4) {
                (_4 = _4 || {}).camera = _4.camera || {};
                var k = _4.canvas;
                k || (k = document.createElement("canvas"), _4.container ? _4.container.appendChild(k) : document.body.appendChild(k));
                var T2 = _4.gl;
                if (T2 || (_4.glOptions && (x = !!_4.glOptions.preserveDrawingBuffer), T2 = function(se, he) {
                  var me = null;
                  try {
                    (me = se.getContext("webgl", he)) || (me = se.getContext("experimental-webgl", he));
                  } catch {
                    return null;
                  }
                  return me;
                }(k, _4.glOptions || { premultipliedAlpha: true, antialias: true, preserveDrawingBuffer: x })), !T2) throw new Error("webgl not supported");
                var A2 = _4.bounds || [[-10, -10, -10], [10, 10, 10]], S2 = new b(), C2 = h(T2, T2.drawingBufferWidth, T2.drawingBufferHeight, { preferFloat: !x }), E2 = g(T2), F13 = _4.cameraObject && _4.cameraObject._ortho === true || _4.camera.projection && _4.camera.projection.type === "orthographic" || false, N2 = { eye: _4.camera.eye || [2, 0, 0], center: _4.camera.center || [0, 0, 0], up: _4.camera.up || [0, 1, 0], zoomMin: _4.camera.zoomMax || 0.1, zoomMax: _4.camera.zoomMin || 100, mode: _4.camera.mode || "turntable", _ortho: F13 }, D2 = _4.axes || {}, I2 = l(T2, D2);
                I2.enable = !D2.disable;
                var O2 = _4.spikes || {}, L2 = c(T2, O2), V2 = [], W2 = [], X2 = [], Y2 = [], K2 = true, q = true, re = new Array(16), R2 = new Array(16), z = { view: null, projection: re, model: R2, _ortho: false }, H2 = (q = true, [T2.drawingBufferWidth, T2.drawingBufferHeight]), te = _4.cameraObject || i(k, N2), j = { gl: T2, contextLost: false, pixelRatio: _4.pixelRatio || 1, canvas: k, selection: S2, camera: te, axes: I2, axesPixels: null, spikes: L2, bounds: A2, objects: V2, shape: H2, aspect: _4.aspectRatio || [1, 1, 1], pickRadius: _4.pickRadius || 10, zNear: _4.zNear || 0.01, zFar: _4.zFar || 1e3, fovy: _4.fovy || Math.PI / 4, clearColor: _4.clearColor || [0, 0, 0, 0], autoResize: w(_4.autoResize), autoBounds: w(_4.autoBounds), autoScale: !!_4.autoScale, autoCenter: w(_4.autoCenter), clipToBounds: w(_4.clipToBounds), snapToData: !!_4.snapToData, onselect: _4.onselect || null, onrender: _4.onrender || null, onclick: _4.onclick || null, cameraParams: z, oncontextloss: null, mouseListener: null, _stopped: false, getAspectratio: function() {
                  return { x: this.aspect[0], y: this.aspect[1], z: this.aspect[2] };
                }, setAspectratio: function(se) {
                  this.aspect[0] = se.x, this.aspect[1] = se.y, this.aspect[2] = se.z, q = true;
                }, setBounds: function(se, he) {
                  this.bounds[0][se] = he.min, this.bounds[1][se] = he.max;
                }, setClearColor: function(se) {
                  this.clearColor = se;
                }, clearRGBA: function() {
                  this.gl.clearColor(this.clearColor[0], this.clearColor[1], this.clearColor[2], this.clearColor[3]), this.gl.clear(this.gl.COLOR_BUFFER_BIT | this.gl.DEPTH_BUFFER_BIT);
                } }, Q2 = [T2.drawingBufferWidth / j.pixelRatio | 0, T2.drawingBufferHeight / j.pixelRatio | 0];
                function Z2() {
                  if (!j._stopped && j.autoResize) {
                    var se = k.parentNode, he = 1, me = 1;
                    se && se !== document.body ? (he = se.clientWidth, me = se.clientHeight) : (he = window.innerWidth, me = window.innerHeight);
                    var we = 0 | Math.ceil(he * j.pixelRatio), be = 0 | Math.ceil(me * j.pixelRatio);
                    if (we !== k.width || be !== k.height) {
                      k.width = we, k.height = be;
                      var Ae = k.style;
                      Ae.position = Ae.position || "absolute", Ae.left = "0px", Ae.top = "0px", Ae.width = he + "px", Ae.height = me + "px", K2 = true;
                    }
                  }
                }
                j.autoResize && Z2();
                function ne() {
                  for (var se = V2.length, he = Y2.length, me = 0; me < he; ++me) X2[me] = 0;
                  e: for (me = 0; me < se; ++me) {
                    var we = V2[me], be = we.pickSlots;
                    if (be) {
                      for (var Ae = 0; Ae < he; ++Ae) if (X2[Ae] + be < 255) {
                        W2[me] = Ae, we.setPickBase(X2[Ae] + 1), X2[Ae] += be;
                        continue e;
                      }
                      var pe = f(T2, H2);
                      W2[me] = he, Y2.push(pe), X2.push(be), we.setPickBase(1), he += 1;
                    } else W2[me] = -1;
                  }
                  for (; he > 0 && X2[he - 1] === 0; ) X2.pop(), Y2.pop().dispose();
                }
                function ae() {
                  if (j.contextLost) return true;
                  T2.isContextLost() && (j.contextLost = true, j.mouseListener.enabled = false, j.selection.object = null, j.oncontextloss && j.oncontextloss());
                }
                window.addEventListener("resize", Z2), j.update = function(se) {
                  j._stopped || (se = se || {}, K2 = true, q = true);
                }, j.add = function(se) {
                  j._stopped || (se.axes = I2, V2.push(se), W2.push(-1), K2 = true, q = true, ne());
                }, j.remove = function(se) {
                  if (!j._stopped) {
                    var he = V2.indexOf(se);
                    he < 0 || (V2.splice(he, 1), W2.pop(), K2 = true, q = true, ne());
                  }
                }, j.dispose = function() {
                  if (!j._stopped && (j._stopped = true, window.removeEventListener("resize", Z2), k.removeEventListener("webglcontextlost", ae), j.mouseListener.enabled = false, !j.contextLost)) {
                    I2.dispose(), L2.dispose();
                    for (var se = 0; se < V2.length; ++se) V2[se].dispose();
                    for (C2.dispose(), se = 0; se < Y2.length; ++se) Y2[se].dispose();
                    E2.dispose(), T2 = null, I2 = null, L2 = null, V2 = [];
                  }
                }, j._mouseRotating = false, j._prevButtons = 0, j.enableMouseListeners = function() {
                  j.mouseListener = d(k, function(se, he, me) {
                    if (!j._stopped) {
                      var we = Y2.length, be = V2.length, Ae = S2.object;
                      S2.distance = 1 / 0, S2.mouse[0] = he, S2.mouse[1] = me, S2.object = null, S2.screen = null, S2.dataCoordinate = S2.dataPosition = null;
                      var pe = false;
                      if (se && j._prevButtons) j._mouseRotating = true;
                      else {
                        j._mouseRotating && (q = true), j._mouseRotating = false;
                        for (var ve = 0; ve < we; ++ve) {
                          var Ee = Y2[ve].query(he, Q2[1] - me - 1, j.pickRadius);
                          if (Ee) {
                            if (Ee.distance > S2.distance) continue;
                            for (var Se = 0; Se < be; ++Se) {
                              var Ce = V2[Se];
                              if (W2[Se] === ve) {
                                var Be = Ce.pick(Ee);
                                Be && (S2.buttons = se, S2.screen = Ee.coord, S2.distance = Ee.distance, S2.object = Ce, S2.index = Be.distance, S2.dataPosition = Be.position, S2.dataCoordinate = Be.dataCoordinate, S2.data = Be, pe = true);
                              }
                            }
                          }
                        }
                      }
                      Ae && Ae !== S2.object && (Ae.highlight && Ae.highlight(null), K2 = true), S2.object && (S2.object.highlight && S2.object.highlight(S2.data), K2 = true), (pe = pe || S2.object !== Ae) && j.onselect && j.onselect(S2), 1 & se && !(1 & j._prevButtons) && j.onclick && j.onclick(S2), j._prevButtons = se;
                    }
                  });
                }, k.addEventListener("webglcontextlost", ae);
                var ue = [[1 / 0, 1 / 0, 1 / 0], [-1 / 0, -1 / 0, -1 / 0]], le = [ue[0].slice(), ue[1].slice()];
                function ce() {
                  if (!ae()) {
                    Z2();
                    var se = j.camera.tick();
                    z.view = j.camera.matrix, K2 = K2 || se, q = q || se, I2.pixelRatio = j.pixelRatio, L2.pixelRatio = j.pixelRatio;
                    var he = V2.length, me = ue[0], we = ue[1];
                    me[0] = me[1] = me[2] = 1 / 0, we[0] = we[1] = we[2] = -1 / 0;
                    for (var be = 0; be < he; ++be) {
                      (Ze = V2[be]).pixelRatio = j.pixelRatio, Ze.axes = j.axes, K2 = K2 || !!Ze.dirty, q = q || !!Ze.dirty;
                      var Ae = Ze.bounds;
                      if (Ae) for (var pe = Ae[0], ve = Ae[1], Ee = 0; Ee < 3; ++Ee) me[Ee] = Math.min(me[Ee], pe[Ee]), we[Ee] = Math.max(we[Ee], ve[Ee]);
                    }
                    var Se = j.bounds;
                    if (j.autoBounds) for (Ee = 0; Ee < 3; ++Ee) {
                      if (we[Ee] < me[Ee]) me[Ee] = -1, we[Ee] = 1;
                      else {
                        me[Ee] === we[Ee] && (me[Ee] -= 1, we[Ee] += 1);
                        var Ce = 0.05 * (we[Ee] - me[Ee]);
                        me[Ee] = me[Ee] - Ce, we[Ee] = we[Ee] + Ce;
                      }
                      Se[0][Ee] = me[Ee], Se[1][Ee] = we[Ee];
                    }
                    var Be = false;
                    for (Ee = 0; Ee < 3; ++Ee) Be = Be || le[0][Ee] !== Se[0][Ee] || le[1][Ee] !== Se[1][Ee], le[0][Ee] = Se[0][Ee], le[1][Ee] = Se[1][Ee];
                    if (q = q || Be, K2 = K2 || Be) {
                      if (Be) {
                        var Ue = [0, 0, 0];
                        for (be = 0; be < 3; ++be) Ue[be] = y((Se[1][be] - Se[0][be]) / 10);
                        I2.autoTicks ? I2.update({ bounds: Se, tickSpacing: Ue }) : I2.update({ bounds: Se });
                      }
                      var Ke = T2.drawingBufferWidth, ct = T2.drawingBufferHeight;
                      for (H2[0] = Ke, H2[1] = ct, Q2[0] = 0 | Math.max(Ke / j.pixelRatio, 1), Q2[1] = 0 | Math.max(ct / j.pixelRatio, 1), function(it, ot) {
                        var mt = it.bounds, wt = it.cameraParams, Et = wt.projection, zt = wt.model, Nt = it.gl.drawingBufferWidth, yt = it.gl.drawingBufferHeight, pt = it.zNear, Ot = it.zFar, Jt = it.fovy, tr = Nt / yt;
                        ot ? (m(Et, -tr, tr, -1, 1, pt, Ot), wt._ortho = true) : (v(Et, Jt, tr, pt, Ot), wt._ortho = false);
                        for (var Ye = 0; Ye < 16; ++Ye) zt[Ye] = 0;
                        zt[15] = 1;
                        var at = 0;
                        for (Ye = 0; Ye < 3; ++Ye) at = Math.max(at, mt[1][Ye] - mt[0][Ye]);
                        for (Ye = 0; Ye < 3; ++Ye) it.autoScale ? zt[5 * Ye] = it.aspect[Ye] / (mt[1][Ye] - mt[0][Ye]) : zt[5 * Ye] = 1 / at, it.autoCenter && (zt[12 + Ye] = 0.5 * -zt[5 * Ye] * (mt[0][Ye] + mt[1][Ye]));
                      }(j, F13), be = 0; be < he; ++be) (Ze = V2[be]).axesBounds = Se, j.clipToBounds && (Ze.clipBounds = Se);
                      S2.object && (j.snapToData ? L2.position = S2.dataCoordinate : L2.position = S2.dataPosition, L2.bounds = Se), q && (q = false, function() {
                        if (!ae()) {
                          T2.colorMask(true, true, true, true), T2.depthMask(true), T2.disable(T2.BLEND), T2.enable(T2.DEPTH_TEST), T2.depthFunc(T2.LEQUAL);
                          for (var it = V2.length, ot = Y2.length, mt = 0; mt < ot; ++mt) {
                            var wt = Y2[mt];
                            wt.shape = Q2, wt.begin();
                            for (var Et = 0; Et < it; ++Et) if (W2[Et] === mt) {
                              var zt = V2[Et];
                              zt.drawPick && (zt.pixelRatio = 1, zt.drawPick(z));
                            }
                            wt.end();
                          }
                        }
                      }()), j.axesPixels = u2(j.axes, z, Ke, ct), j.onrender && j.onrender(), T2.bindFramebuffer(T2.FRAMEBUFFER, null), T2.viewport(0, 0, Ke, ct), j.clearRGBA(), T2.depthMask(true), T2.colorMask(true, true, true, true), T2.enable(T2.DEPTH_TEST), T2.depthFunc(T2.LEQUAL), T2.disable(T2.BLEND), T2.disable(T2.CULL_FACE);
                      var We = false;
                      for (I2.enable && (We = We || I2.isTransparent(), I2.draw(z)), L2.axes = I2, S2.object && L2.draw(z), T2.disable(T2.CULL_FACE), be = 0; be < he; ++be) (Ze = V2[be]).axes = I2, Ze.pixelRatio = j.pixelRatio, Ze.isOpaque && Ze.isOpaque() && Ze.draw(z), Ze.isTransparent && Ze.isTransparent() && (We = true);
                      if (We) {
                        for (C2.shape = H2, C2.bind(), T2.clear(T2.DEPTH_BUFFER_BIT), T2.colorMask(false, false, false, false), T2.depthMask(true), T2.depthFunc(T2.LESS), I2.enable && I2.isTransparent() && I2.drawTransparent(z), be = 0; be < he; ++be) (Ze = V2[be]).isOpaque && Ze.isOpaque() && Ze.draw(z);
                        for (T2.enable(T2.BLEND), T2.blendEquation(T2.FUNC_ADD), T2.blendFunc(T2.ONE, T2.ONE_MINUS_SRC_ALPHA), T2.colorMask(true, true, true, true), T2.depthMask(false), T2.clearColor(0, 0, 0, 0), T2.clear(T2.COLOR_BUFFER_BIT), I2.isTransparent() && I2.drawTransparent(z), be = 0; be < he; ++be) {
                          var Ze;
                          (Ze = V2[be]).isTransparent && Ze.isTransparent() && Ze.drawTransparent(z);
                        }
                        T2.bindFramebuffer(T2.FRAMEBUFFER, null), T2.blendFunc(T2.ONE, T2.ONE_MINUS_SRC_ALPHA), T2.disable(T2.DEPTH_TEST), E2.bind(), C2.color[0].bind(0), E2.uniforms.accumBuffer = 0, p(T2), T2.disable(T2.BLEND);
                      }
                      for (K2 = false, be = 0; be < he; ++be) V2[be].dirty = false;
                    }
                  }
                }
                return j.enableMouseListeners(), function se() {
                  j._stopped || j.contextLost || (ce(), requestAnimationFrame(se));
                }(), j.redraw = function() {
                  j._stopped || (K2 = true, ce());
                }, j;
              }, createCamera: i };
            }, { "./camera.js": 119, "./lib/shader": 120, "a-big-triangle": 8, "gl-axes3d": 70, "gl-axes3d/properties": 77, "gl-fbo": 86, "gl-mat4/ortho": 101, "gl-mat4/perspective": 102, "gl-select-static": 131, "gl-spikes3d": 141, "is-mobile": 238, "mouse-change": 247 }], 122: [function(a, o, s) {
              var i = a("glslify");
              s.pointVertex = i([`precision mediump float;
#define GLSLIFY 1

attribute vec2 position;

uniform mat3 matrix;
uniform float pointSize;
uniform float pointCloud;

highp float rand(vec2 co) {
  highp float a = 12.9898;
  highp float b = 78.233;
  highp float c = 43758.5453;
  highp float d = dot(co.xy, vec2(a, b));
  highp float e = mod(d, 3.14);
  return fract(sin(e) * c);
}

void main() {
  vec3 hgPosition = matrix * vec3(position, 1);
  gl_Position  = vec4(hgPosition.xy, 0, hgPosition.z);
    // if we don't jitter the point size a bit, overall point cloud
    // saturation 'jumps' on zooming, which is disturbing and confusing
  gl_PointSize = pointSize * ((19.5 + rand(position)) / 20.0);
  if(pointCloud != 0.0) { // pointCloud is truthy
    // get the same square surface as circle would be
    gl_PointSize *= 0.886;
  }
}`]), s.pointFragment = i([`precision mediump float;
#define GLSLIFY 1

uniform vec4 color, borderColor;
uniform float centerFraction;
uniform float pointCloud;

void main() {
  float radius;
  vec4 baseColor;
  if(pointCloud != 0.0) { // pointCloud is truthy
    if(centerFraction == 1.0) {
      gl_FragColor = color;
    } else {
      gl_FragColor = mix(borderColor, color, centerFraction);
    }
  } else {
    radius = length(2.0 * gl_PointCoord.xy - 1.0);
    if(radius > 1.0) {
      discard;
    }
    baseColor = mix(borderColor, color, step(radius, centerFraction));
    gl_FragColor = vec4(baseColor.rgb * baseColor.a, baseColor.a);
  }
}
`]), s.pickVertex = i([`precision mediump float;
#define GLSLIFY 1

attribute vec2 position;
attribute vec4 pickId;

uniform mat3 matrix;
uniform float pointSize;
uniform vec4 pickOffset;

varying vec4 fragId;

void main() {
  vec3 hgPosition = matrix * vec3(position, 1);
  gl_Position  = vec4(hgPosition.xy, 0, hgPosition.z);
  gl_PointSize = pointSize;

  vec4 id = pickId + pickOffset;
  id.y += floor(id.x / 256.0);
  id.x -= floor(id.x / 256.0) * 256.0;

  id.z += floor(id.y / 256.0);
  id.y -= floor(id.y / 256.0) * 256.0;

  id.w += floor(id.z / 256.0);
  id.z -= floor(id.z / 256.0) * 256.0;

  fragId = id;
}
`]), s.pickFragment = i([`precision mediump float;
#define GLSLIFY 1

varying vec4 fragId;

void main() {
  float radius = length(2.0 * gl_PointCoord.xy - 1.0);
  if(radius > 1.0) {
    discard;
  }
  gl_FragColor = fragId / 255.0;
}
`]);
            }, { glslify: 231 }], 123: [function(a, o, s) {
              "use strict";
              var i = a("gl-shader"), l = a("gl-buffer"), u2 = a("typedarray-pool"), c = a("./lib/shader");
              function f(v, m, g, x, b) {
                this.plot = v, this.offsetBuffer = m, this.pickBuffer = g, this.shader = x, this.pickShader = b, this.sizeMin = 0.5, this.sizeMinCap = 2, this.sizeMax = 20, this.areaRatio = 1, this.pointCount = 0, this.color = [1, 0, 0, 1], this.borderColor = [0, 0, 0, 1], this.blend = false, this.pickOffset = 0, this.points = null;
              }
              o.exports = function(v, m) {
                var g = v.gl, x = l(g), b = l(g), y = i(g, c.pointVertex, c.pointFragment), w = i(g, c.pickVertex, c.pickFragment), _4 = new f(v, x, b, y, w);
                return _4.update(m), v.addObject(_4), _4;
              };
              var h, p, d = f.prototype;
              d.dispose = function() {
                this.shader.dispose(), this.pickShader.dispose(), this.offsetBuffer.dispose(), this.pickBuffer.dispose(), this.plot.removeObject(this);
              }, d.update = function(v) {
                var m;
                function g(T2, A2) {
                  return T2 in v ? v[T2] : A2;
                }
                v = v || {}, this.sizeMin = g("sizeMin", 0.5), this.sizeMax = g("sizeMax", 20), this.color = g("color", [1, 0, 0, 1]).slice(), this.areaRatio = g("areaRatio", 1), this.borderColor = g("borderColor", [0, 0, 0, 1]).slice(), this.blend = g("blend", false);
                var x = v.positions.length >>> 1, b = v.positions instanceof Float32Array, y = v.idToIndex instanceof Int32Array && v.idToIndex.length >= x, w = v.positions, _4 = b ? w : u2.mallocFloat32(w.length), k = y ? v.idToIndex : u2.mallocInt32(x);
                if (b || _4.set(w), !y) for (_4.set(w), m = 0; m < x; m++) k[m] = m;
                this.points = w, this.offsetBuffer.update(_4), this.pickBuffer.update(k), b || u2.free(_4), y || u2.free(k), this.pointCount = x, this.pickOffset = 0;
              }, d.unifiedDraw = (h = [1, 0, 0, 0, 1, 0, 0, 0, 1], p = [0, 0, 0, 0], function(v) {
                var m = v !== void 0, g = m ? this.pickShader : this.shader, x = this.plot.gl, b = this.plot.dataBox;
                if (this.pointCount === 0) return v;
                var y = b[2] - b[0], w = b[3] - b[1], _4 = function(S2, C2) {
                  var E2, F13 = 0, N2 = S2.length >>> 1;
                  for (E2 = 0; E2 < N2; E2++) {
                    var D2 = S2[2 * E2], I2 = S2[2 * E2 + 1];
                    D2 >= C2[0] && D2 <= C2[2] && I2 >= C2[1] && I2 <= C2[3] && F13++;
                  }
                  return F13;
                }(this.points, b), k = this.plot.pickPixelRatio * Math.max(Math.min(this.sizeMinCap, this.sizeMin), Math.min(this.sizeMax, this.sizeMax / Math.pow(_4, 0.33333)));
                h[0] = 2 / y, h[4] = 2 / w, h[6] = -2 * b[0] / y - 1, h[7] = -2 * b[1] / w - 1, this.offsetBuffer.bind(), g.bind(), g.attributes.position.pointer(), g.uniforms.matrix = h, g.uniforms.color = this.color, g.uniforms.borderColor = this.borderColor, g.uniforms.pointCloud = k < 5, g.uniforms.pointSize = k, g.uniforms.centerFraction = Math.min(1, Math.max(0, Math.sqrt(1 - this.areaRatio))), m && (p[0] = 255 & v, p[1] = v >> 8 & 255, p[2] = v >> 16 & 255, p[3] = v >> 24 & 255, this.pickBuffer.bind(), g.attributes.pickId.pointer(x.UNSIGNED_BYTE), g.uniforms.pickOffset = p, this.pickOffset = v);
                var T2 = x.getParameter(x.BLEND), A2 = x.getParameter(x.DITHER);
                return T2 && !this.blend && x.disable(x.BLEND), A2 && x.disable(x.DITHER), x.drawArrays(x.POINTS, 0, this.pointCount), T2 && !this.blend && x.enable(x.BLEND), A2 && x.enable(x.DITHER), v + this.pointCount;
              }), d.draw = d.unifiedDraw, d.drawPick = d.unifiedDraw, d.pick = function(v, m, g) {
                var x = this.pickOffset, b = this.pointCount;
                if (g < x || g >= x + b) return null;
                var y = g - x, w = this.points;
                return { object: this, pointId: y, dataCoord: [w[2 * y], w[2 * y + 1]] };
              };
            }, { "./lib/shader": 122, "gl-buffer": 78, "gl-shader": 132, "typedarray-pool": 308 }], 124: [function(a, o, s) {
              o.exports = function(i, l, u2, c) {
                var f, h, p, d, v, m = l[0], g = l[1], x = l[2], b = l[3], y = u2[0], w = u2[1], _4 = u2[2], k = u2[3];
                return (h = m * y + g * w + x * _4 + b * k) < 0 && (h = -h, y = -y, w = -w, _4 = -_4, k = -k), 1 - h > 1e-6 ? (f = Math.acos(h), p = Math.sin(f), d = Math.sin((1 - c) * f) / p, v = Math.sin(c * f) / p) : (d = 1 - c, v = c), i[0] = d * m + v * y, i[1] = d * g + v * w, i[2] = d * x + v * _4, i[3] = d * b + v * k, i;
              };
            }, {}], 125: [function(a, o, s) {
              "use strict";
              o.exports = function(i) {
                return i || i === 0 ? i.toString() : "";
              };
            }, {}], 126: [function(a, o, s) {
              "use strict";
              var i = a("vectorize-text");
              o.exports = function(u2, c, f) {
                var h = l[c];
                if (h || (h = l[c] = {}), u2 in h) return h[u2];
                var p = { textAlign: "center", textBaseline: "middle", lineHeight: 1, font: c, lineSpacing: 1.25, styletags: { breaklines: true, bolds: true, italics: true, subscripts: true, superscripts: true }, triangles: true }, d = i(u2, p);
                p.triangles = false;
                var v, m, g = i(u2, p);
                if (f && f !== 1) {
                  for (v = 0; v < d.positions.length; ++v) for (m = 0; m < d.positions[v].length; ++m) d.positions[v][m] /= f;
                  for (v = 0; v < g.positions.length; ++v) for (m = 0; m < g.positions[v].length; ++m) g.positions[v][m] /= f;
                }
                var x = [[1 / 0, 1 / 0], [-1 / 0, -1 / 0]], b = g.positions.length;
                for (v = 0; v < b; ++v) {
                  var y = g.positions[v];
                  for (m = 0; m < 2; ++m) x[0][m] = Math.min(x[0][m], y[m]), x[1][m] = Math.max(x[1][m], y[m]);
                }
                return h[u2] = [d, g, x];
              };
              var l = {};
            }, { "vectorize-text": 311 }], 127: [function(a, o, s) {
              var i = a("gl-shader"), l = a("glslify"), u2 = l([`precision highp float;
#define GLSLIFY 1

bool outOfRange(float a, float b, float p) {
  return ((p > max(a, b)) || 
          (p < min(a, b)));
}

bool outOfRange(vec2 a, vec2 b, vec2 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y));
}

bool outOfRange(vec3 a, vec3 b, vec3 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y) ||
          outOfRange(a.z, b.z, p.z));
}

bool outOfRange(vec4 a, vec4 b, vec4 p) {
  return outOfRange(a.xyz, b.xyz, p.xyz);
}

attribute vec3 position;
attribute vec4 color;
attribute vec2 glyph;
attribute vec4 id;

uniform vec4 highlightId;
uniform float highlightScale;
uniform mat4 model, view, projection;
uniform vec3 clipBounds[2];

varying vec4 interpColor;
varying vec4 pickId;
varying vec3 dataCoordinate;

void main() {
  if (outOfRange(clipBounds[0], clipBounds[1], position)) {

    gl_Position = vec4(0,0,0,0);
  } else {
    float scale = 1.0;
    if(distance(highlightId, id) < 0.0001) {
      scale = highlightScale;
    }

    vec4 worldPosition = model * vec4(position, 1);
    vec4 viewPosition = view * worldPosition;
    viewPosition = viewPosition / viewPosition.w;
    vec4 clipPosition = projection * (viewPosition + scale * vec4(glyph.x, -glyph.y, 0, 0));

    gl_Position = clipPosition;
    interpColor = color;
    pickId = id;
    dataCoordinate = position;
  }
}`]), c = l([`precision highp float;
#define GLSLIFY 1

bool outOfRange(float a, float b, float p) {
  return ((p > max(a, b)) || 
          (p < min(a, b)));
}

bool outOfRange(vec2 a, vec2 b, vec2 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y));
}

bool outOfRange(vec3 a, vec3 b, vec3 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y) ||
          outOfRange(a.z, b.z, p.z));
}

bool outOfRange(vec4 a, vec4 b, vec4 p) {
  return outOfRange(a.xyz, b.xyz, p.xyz);
}

attribute vec3 position;
attribute vec4 color;
attribute vec2 glyph;
attribute vec4 id;

uniform mat4 model, view, projection;
uniform vec2 screenSize;
uniform vec3 clipBounds[2];
uniform float highlightScale, pixelRatio;
uniform vec4 highlightId;

varying vec4 interpColor;
varying vec4 pickId;
varying vec3 dataCoordinate;

void main() {
  if (outOfRange(clipBounds[0], clipBounds[1], position)) {

    gl_Position = vec4(0,0,0,0);
  } else {
    float scale = pixelRatio;
    if(distance(highlightId.bgr, id.bgr) < 0.001) {
      scale *= highlightScale;
    }

    vec4 worldPosition = model * vec4(position, 1.0);
    vec4 viewPosition = view * worldPosition;
    vec4 clipPosition = projection * viewPosition;
    clipPosition /= clipPosition.w;

    gl_Position = clipPosition + vec4(screenSize * scale * vec2(glyph.x, -glyph.y), 0.0, 0.0);
    interpColor = color;
    pickId = id;
    dataCoordinate = position;
  }
}`]), f = l([`precision highp float;
#define GLSLIFY 1

bool outOfRange(float a, float b, float p) {
  return ((p > max(a, b)) || 
          (p < min(a, b)));
}

bool outOfRange(vec2 a, vec2 b, vec2 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y));
}

bool outOfRange(vec3 a, vec3 b, vec3 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y) ||
          outOfRange(a.z, b.z, p.z));
}

bool outOfRange(vec4 a, vec4 b, vec4 p) {
  return outOfRange(a.xyz, b.xyz, p.xyz);
}

attribute vec3 position;
attribute vec4 color;
attribute vec2 glyph;
attribute vec4 id;

uniform float highlightScale;
uniform vec4 highlightId;
uniform vec3 axes[2];
uniform mat4 model, view, projection;
uniform vec2 screenSize;
uniform vec3 clipBounds[2];
uniform float scale, pixelRatio;

varying vec4 interpColor;
varying vec4 pickId;
varying vec3 dataCoordinate;

void main() {
  if (outOfRange(clipBounds[0], clipBounds[1], position)) {

    gl_Position = vec4(0,0,0,0);
  } else {
    float lscale = pixelRatio * scale;
    if(distance(highlightId, id) < 0.0001) {
      lscale *= highlightScale;
    }

    vec4 clipCenter   = projection * view * model * vec4(position, 1);
    vec3 dataPosition = position + 0.5*lscale*(axes[0] * glyph.x + axes[1] * glyph.y) * clipCenter.w * screenSize.y;
    vec4 clipPosition = projection * view * model * vec4(dataPosition, 1);

    gl_Position = clipPosition;
    interpColor = color;
    pickId = id;
    dataCoordinate = dataPosition;
  }
}
`]), h = l([`precision highp float;
#define GLSLIFY 1

bool outOfRange(float a, float b, float p) {
  return ((p > max(a, b)) || 
          (p < min(a, b)));
}

bool outOfRange(vec2 a, vec2 b, vec2 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y));
}

bool outOfRange(vec3 a, vec3 b, vec3 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y) ||
          outOfRange(a.z, b.z, p.z));
}

bool outOfRange(vec4 a, vec4 b, vec4 p) {
  return outOfRange(a.xyz, b.xyz, p.xyz);
}

uniform vec3 fragClipBounds[2];
uniform float opacity;

varying vec4 interpColor;
varying vec3 dataCoordinate;

void main() {
  if (
    outOfRange(fragClipBounds[0], fragClipBounds[1], dataCoordinate) ||
    interpColor.a * opacity == 0.
  ) discard;
  gl_FragColor = interpColor * opacity;
}
`]), p = l([`precision highp float;
#define GLSLIFY 1

bool outOfRange(float a, float b, float p) {
  return ((p > max(a, b)) || 
          (p < min(a, b)));
}

bool outOfRange(vec2 a, vec2 b, vec2 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y));
}

bool outOfRange(vec3 a, vec3 b, vec3 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y) ||
          outOfRange(a.z, b.z, p.z));
}

bool outOfRange(vec4 a, vec4 b, vec4 p) {
  return outOfRange(a.xyz, b.xyz, p.xyz);
}

uniform vec3 fragClipBounds[2];
uniform float pickGroup;

varying vec4 pickId;
varying vec3 dataCoordinate;

void main() {
  if (outOfRange(fragClipBounds[0], fragClipBounds[1], dataCoordinate)) discard;

  gl_FragColor = vec4(pickGroup, pickId.bgr);
}`]), d = [{ name: "position", type: "vec3" }, { name: "color", type: "vec4" }, { name: "glyph", type: "vec2" }, { name: "id", type: "vec4" }], v = { vertex: u2, fragment: h, attributes: d }, m = { vertex: c, fragment: h, attributes: d }, g = { vertex: f, fragment: h, attributes: d }, x = { vertex: u2, fragment: p, attributes: d }, b = { vertex: c, fragment: p, attributes: d }, y = { vertex: f, fragment: p, attributes: d };
              function w(_4, k) {
                var T2 = i(_4, k), A2 = T2.attributes;
                return A2.position.location = 0, A2.color.location = 1, A2.glyph.location = 2, A2.id.location = 3, T2;
              }
              s.createPerspective = function(_4) {
                return w(_4, v);
              }, s.createOrtho = function(_4) {
                return w(_4, m);
              }, s.createProject = function(_4) {
                return w(_4, g);
              }, s.createPickPerspective = function(_4) {
                return w(_4, x);
              }, s.createPickOrtho = function(_4) {
                return w(_4, b);
              }, s.createPickProject = function(_4) {
                return w(_4, y);
              };
            }, { "gl-shader": 132, glslify: 231 }], 128: [function(a, o, s) {
              "use strict";
              var i = a("is-string-blank"), l = a("gl-buffer"), u2 = a("gl-vao"), c = a("typedarray-pool"), f = a("gl-mat4/multiply"), h = a("./lib/shaders"), p = a("./lib/glyphs"), d = a("./lib/get-simple-string"), v = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
              function m(X2, Y2) {
                var K2 = X2[0], q = X2[1], re = X2[2], R2 = X2[3];
                return X2[0] = Y2[0] * K2 + Y2[4] * q + Y2[8] * re + Y2[12] * R2, X2[1] = Y2[1] * K2 + Y2[5] * q + Y2[9] * re + Y2[13] * R2, X2[2] = Y2[2] * K2 + Y2[6] * q + Y2[10] * re + Y2[14] * R2, X2[3] = Y2[3] * K2 + Y2[7] * q + Y2[11] * re + Y2[15] * R2, X2;
              }
              function g(X2, Y2, K2, q) {
                return m(q, q), m(q, q), m(q, q);
              }
              function x(X2, Y2) {
                this.index = X2, this.dataCoordinate = this.position = Y2;
              }
              function b(X2) {
                return X2 === true || X2 > 1 ? 1 : X2;
              }
              function y(X2, Y2, K2, q, re, R2, z, H2, te, j, Q2, Z2) {
                this.gl = X2, this.pixelRatio = 1, this.shader = Y2, this.orthoShader = K2, this.projectShader = q, this.pointBuffer = re, this.colorBuffer = R2, this.glyphBuffer = z, this.idBuffer = H2, this.vao = te, this.vertexCount = 0, this.lineVertexCount = 0, this.opacity = 1, this.hasAlpha = false, this.lineWidth = 0, this.projectScale = [2 / 3, 2 / 3, 2 / 3], this.projectOpacity = [1, 1, 1], this.projectHasAlpha = false, this.pickId = 0, this.pickPerspectiveShader = j, this.pickOrthoShader = Q2, this.pickProjectShader = Z2, this.points = [], this._selectResult = new x(0, [0, 0, 0]), this.useOrtho = true, this.bounds = [[1 / 0, 1 / 0, 1 / 0], [-1 / 0, -1 / 0, -1 / 0]], this.axesProject = [true, true, true], this.axesBounds = [[-1 / 0, -1 / 0, -1 / 0], [1 / 0, 1 / 0, 1 / 0]], this.highlightId = [1, 1, 1, 1], this.highlightScale = 2, this.clipBounds = [[-1 / 0, -1 / 0, -1 / 0], [1 / 0, 1 / 0, 1 / 0]], this.dirty = true;
              }
              o.exports = function(X2) {
                var Y2 = X2.gl, K2 = h.createPerspective(Y2), q = h.createOrtho(Y2), re = h.createProject(Y2), R2 = h.createPickPerspective(Y2), z = h.createPickOrtho(Y2), H2 = h.createPickProject(Y2), te = l(Y2), j = l(Y2), Q2 = l(Y2), Z2 = l(Y2), ne = u2(Y2, [{ buffer: te, size: 3, type: Y2.FLOAT }, { buffer: j, size: 4, type: Y2.FLOAT }, { buffer: Q2, size: 2, type: Y2.FLOAT }, { buffer: Z2, size: 4, type: Y2.UNSIGNED_BYTE, normalized: true }]), ae = new y(Y2, K2, q, re, te, j, Q2, Z2, ne, R2, z, H2);
                return ae.update(X2), ae;
              };
              var w = y.prototype;
              w.pickSlots = 1, w.setPickBase = function(X2) {
                this.pickId = X2;
              }, w.isTransparent = function() {
                if (this.hasAlpha) return true;
                for (var X2 = 0; X2 < 3; ++X2) if (this.axesProject[X2] && this.projectHasAlpha) return true;
                return false;
              }, w.isOpaque = function() {
                if (!this.hasAlpha) return true;
                for (var X2 = 0; X2 < 3; ++X2) if (this.axesProject[X2] && !this.projectHasAlpha) return true;
                return false;
              };
              var _4 = [0, 0], k = [0, 0, 0], T2 = [0, 0, 0], A2 = [0, 0, 0, 1], S2 = [0, 0, 0, 1], C2 = v.slice(), E2 = [0, 0, 0], F13 = [[0, 0, 0], [0, 0, 0]];
              function N2(X2) {
                return X2[0] = X2[1] = X2[2] = 0, X2;
              }
              function D2(X2, Y2) {
                return X2[0] = Y2[0], X2[1] = Y2[1], X2[2] = Y2[2], X2[3] = 1, X2;
              }
              function I2(X2, Y2, K2, q) {
                return X2[0] = Y2[0], X2[1] = Y2[1], X2[2] = Y2[2], X2[K2] = q, X2;
              }
              function O2(X2, Y2, K2, q) {
                var re, R2 = Y2.axesProject, z = Y2.gl, H2 = X2.uniforms, te = K2.model || v, j = K2.view || v, Q2 = K2.projection || v, Z2 = Y2.axesBounds, ne = function(Se) {
                  for (var Ce = F13, Be = 0; Be < 2; ++Be) for (var Ue = 0; Ue < 3; ++Ue) Ce[Be][Ue] = Math.max(Math.min(Se[Be][Ue], 1e8), -1e8);
                  return Ce;
                }(Y2.clipBounds);
                re = Y2.axes && Y2.axes.lastCubeProps ? Y2.axes.lastCubeProps.axis : [1, 1, 1], _4[0] = 2 / z.drawingBufferWidth, _4[1] = 2 / z.drawingBufferHeight, X2.bind(), H2.view = j, H2.projection = Q2, H2.screenSize = _4, H2.highlightId = Y2.highlightId, H2.highlightScale = Y2.highlightScale, H2.clipBounds = ne, H2.pickGroup = Y2.pickId / 255, H2.pixelRatio = q;
                for (var ae = 0; ae < 3; ++ae) if (R2[ae]) {
                  H2.scale = Y2.projectScale[ae], H2.opacity = Y2.projectOpacity[ae];
                  for (var ue = C2, le = 0; le < 16; ++le) ue[le] = 0;
                  for (le = 0; le < 4; ++le) ue[5 * le] = 1;
                  ue[5 * ae] = 0, re[ae] < 0 ? ue[12 + ae] = Z2[0][ae] : ue[12 + ae] = Z2[1][ae], f(ue, te, ue), H2.model = ue;
                  var ce = (ae + 1) % 3, se = (ae + 2) % 3, he = N2(k), me = N2(T2);
                  he[ce] = 1, me[se] = 1;
                  var we = g(0, 0, 0, D2(A2, he)), be = g(0, 0, 0, D2(S2, me));
                  if (Math.abs(we[1]) > Math.abs(be[1])) {
                    var Ae = we;
                    we = be, be = Ae, Ae = he, he = me, me = Ae;
                    var pe = ce;
                    ce = se, se = pe;
                  }
                  we[0] < 0 && (he[ce] = -1), be[1] > 0 && (me[se] = -1);
                  var ve = 0, Ee = 0;
                  for (le = 0; le < 4; ++le) ve += Math.pow(te[4 * ce + le], 2), Ee += Math.pow(te[4 * se + le], 2);
                  he[ce] /= Math.sqrt(ve), me[se] /= Math.sqrt(Ee), H2.axes[0] = he, H2.axes[1] = me, H2.fragClipBounds[0] = I2(E2, ne[0], ae, -1e8), H2.fragClipBounds[1] = I2(E2, ne[1], ae, 1e8), Y2.vao.bind(), Y2.vao.draw(z.TRIANGLES, Y2.vertexCount), Y2.lineWidth > 0 && (z.lineWidth(Y2.lineWidth * q), Y2.vao.draw(z.LINES, Y2.lineVertexCount, Y2.vertexCount)), Y2.vao.unbind();
                }
              }
              var L2 = [[-1e8, -1e8, -1e8], [1e8, 1e8, 1e8]];
              function V2(X2, Y2, K2, q, re, R2, z) {
                var H2 = K2.gl;
                if ((R2 === K2.projectHasAlpha || z) && O2(Y2, K2, q, re), R2 === K2.hasAlpha || z) {
                  X2.bind();
                  var te = X2.uniforms;
                  te.model = q.model || v, te.view = q.view || v, te.projection = q.projection || v, _4[0] = 2 / H2.drawingBufferWidth, _4[1] = 2 / H2.drawingBufferHeight, te.screenSize = _4, te.highlightId = K2.highlightId, te.highlightScale = K2.highlightScale, te.fragClipBounds = L2, te.clipBounds = K2.axes.bounds, te.opacity = K2.opacity, te.pickGroup = K2.pickId / 255, te.pixelRatio = re, K2.vao.bind(), K2.vao.draw(H2.TRIANGLES, K2.vertexCount), K2.lineWidth > 0 && (H2.lineWidth(K2.lineWidth * re), K2.vao.draw(H2.LINES, K2.lineVertexCount, K2.vertexCount)), K2.vao.unbind();
                }
              }
              function W2(X2, Y2, K2, q) {
                var re;
                re = Array.isArray(X2) ? Y2 < X2.length ? X2[Y2] : void 0 : X2, re = d(re);
                var R2 = true;
                i(re) && (re = "\u25BC", R2 = false);
                var z = p(re, K2, q);
                return { mesh: z[0], lines: z[1], bounds: z[2], visible: R2 };
              }
              w.draw = function(X2) {
                V2(this.useOrtho ? this.orthoShader : this.shader, this.projectShader, this, X2, this.pixelRatio, false, false);
              }, w.drawTransparent = function(X2) {
                V2(this.useOrtho ? this.orthoShader : this.shader, this.projectShader, this, X2, this.pixelRatio, true, false);
              }, w.drawPick = function(X2) {
                V2(this.useOrtho ? this.pickOrthoShader : this.pickPerspectiveShader, this.pickProjectShader, this, X2, 1, true, true);
              }, w.pick = function(X2) {
                if (!X2 || X2.id !== this.pickId) return null;
                var Y2 = X2.value[2] + (X2.value[1] << 8) + (X2.value[0] << 16);
                if (Y2 >= this.pointCount || Y2 < 0) return null;
                var K2 = this.points[Y2], q = this._selectResult;
                q.index = Y2;
                for (var re = 0; re < 3; ++re) q.position[re] = q.dataCoordinate[re] = K2[re];
                return q;
              }, w.highlight = function(X2) {
                if (X2) {
                  var Y2 = X2.index, K2 = 255 & Y2, q = Y2 >> 8 & 255, re = Y2 >> 16 & 255;
                  this.highlightId = [K2 / 255, q / 255, re / 255, 0];
                } else this.highlightId = [1, 1, 1, 1];
              }, w.update = function(X2) {
                if ("perspective" in (X2 = X2 || {}) && (this.useOrtho = !X2.perspective), "orthographic" in X2 && (this.useOrtho = !!X2.orthographic), "lineWidth" in X2 && (this.lineWidth = X2.lineWidth), "project" in X2) if (Array.isArray(X2.project)) this.axesProject = X2.project;
                else {
                  var Y2 = !!X2.project;
                  this.axesProject = [Y2, Y2, Y2];
                }
                if ("projectScale" in X2) if (Array.isArray(X2.projectScale)) this.projectScale = X2.projectScale.slice();
                else {
                  var K2 = +X2.projectScale;
                  this.projectScale = [K2, K2, K2];
                }
                if (this.projectHasAlpha = false, "projectOpacity" in X2) {
                  Array.isArray(X2.projectOpacity) ? this.projectOpacity = X2.projectOpacity.slice() : (K2 = +X2.projectOpacity, this.projectOpacity = [K2, K2, K2]);
                  for (var q = 0; q < 3; ++q) this.projectOpacity[q] = b(this.projectOpacity[q]), this.projectOpacity[q] < 1 && (this.projectHasAlpha = true);
                }
                this.hasAlpha = false, "opacity" in X2 && (this.opacity = b(X2.opacity), this.opacity < 1 && (this.hasAlpha = true)), this.dirty = true;
                var re, R2, z = X2.position, H2 = X2.font || "normal", te = X2.alignment || [0, 0];
                if (te.length === 2) re = te[0], R2 = te[1];
                else for (re = [], R2 = [], q = 0; q < te.length; ++q) re[q] = te[q][0], R2[q] = te[q][1];
                var j = [1 / 0, 1 / 0, 1 / 0], Q2 = [-1 / 0, -1 / 0, -1 / 0], Z2 = X2.glyph, ne = X2.color, ae = X2.size, ue = X2.angle, le = X2.lineColor, ce = -1, se = 0, he = 0, me = 0;
                if (z.length) {
                  me = z.length;
                  e: for (q = 0; q < me; ++q) {
                    for (var we = z[q], be = 0; be < 3; ++be) if (isNaN(we[be]) || !isFinite(we[be])) continue e;
                    var Ae = (mt = W2(Z2, q, H2, this.pixelRatio)).mesh, pe = mt.lines, ve = mt.bounds;
                    se += 3 * Ae.cells.length, he += 2 * pe.edges.length;
                  }
                }
                var Ee = se + he, Se = c.mallocFloat(3 * Ee), Ce = c.mallocFloat(4 * Ee), Be = c.mallocFloat(2 * Ee), Ue = c.mallocUint32(Ee);
                if (Ee > 0) {
                  var Ke = 0, ct = se, We = [0, 0, 0, 1], Ze = [0, 0, 0, 1], it = Array.isArray(ne) && Array.isArray(ne[0]), ot = Array.isArray(le) && Array.isArray(le[0]);
                  e: for (q = 0; q < me; ++q) {
                    for (ce += 1, we = z[q], be = 0; be < 3; ++be) {
                      if (isNaN(we[be]) || !isFinite(we[be])) continue e;
                      Q2[be] = Math.max(Q2[be], we[be]), j[be] = Math.min(j[be], we[be]);
                    }
                    Ae = (mt = W2(Z2, q, H2, this.pixelRatio)).mesh, pe = mt.lines, ve = mt.bounds;
                    var mt, wt = mt.visible;
                    if (wt) if (Array.isArray(ne)) {
                      if ((Et = it ? q < ne.length ? ne[q] : [0, 0, 0, 0] : ne).length === 3) {
                        for (be = 0; be < 3; ++be) We[be] = Et[be];
                        We[3] = 1;
                      } else if (Et.length === 4) {
                        for (be = 0; be < 4; ++be) We[be] = Et[be];
                        !this.hasAlpha && Et[3] < 1 && (this.hasAlpha = true);
                      }
                    } else We[0] = We[1] = We[2] = 0, We[3] = 1;
                    else We = [1, 1, 1, 0];
                    if (wt) if (Array.isArray(le)) {
                      var Et;
                      if ((Et = ot ? q < le.length ? le[q] : [0, 0, 0, 0] : le).length === 3) {
                        for (be = 0; be < 3; ++be) Ze[be] = Et[be];
                        Ze[be] = 1;
                      } else if (Et.length === 4) {
                        for (be = 0; be < 4; ++be) Ze[be] = Et[be];
                        !this.hasAlpha && Et[3] < 1 && (this.hasAlpha = true);
                      }
                    } else Ze[0] = Ze[1] = Ze[2] = 0, Ze[3] = 1;
                    else Ze = [1, 1, 1, 0];
                    var zt = 0.5;
                    wt ? Array.isArray(ae) ? zt = q < ae.length ? +ae[q] : 12 : ae ? zt = +ae : this.useOrtho && (zt = 12) : zt = 0;
                    var Nt = 0;
                    Array.isArray(ue) ? Nt = q < ue.length ? +ue[q] : 0 : ue && (Nt = +ue);
                    var yt = Math.cos(Nt), pt = Math.sin(Nt);
                    for (we = z[q], be = 0; be < 3; ++be) Q2[be] = Math.max(Q2[be], we[be]), j[be] = Math.min(j[be], we[be]);
                    var Ot = re, Jt = R2;
                    Ot = 0, Array.isArray(re) ? Ot = q < re.length ? re[q] : 0 : re && (Ot = re), Jt = 0, Array.isArray(R2) ? Jt = q < R2.length ? R2[q] : 0 : R2 && (Jt = R2);
                    var tr = [Ot *= Ot > 0 ? 1 - ve[0][0] : Ot < 0 ? 1 + ve[1][0] : 1, Jt *= Jt > 0 ? 1 - ve[0][1] : Jt < 0 ? 1 + ve[1][1] : 1], Ye = Ae.cells || [], at = Ae.positions || [];
                    for (be = 0; be < Ye.length; ++be) for (var Ge = Ye[be], st = 0; st < 3; ++st) {
                      for (var Ie = 0; Ie < 3; ++Ie) Se[3 * Ke + Ie] = we[Ie];
                      for (Ie = 0; Ie < 4; ++Ie) Ce[4 * Ke + Ie] = We[Ie];
                      Ue[Ke] = ce;
                      var Pe = at[Ge[st]];
                      Be[2 * Ke] = zt * (yt * Pe[0] - pt * Pe[1] + tr[0]), Be[2 * Ke + 1] = zt * (pt * Pe[0] + yt * Pe[1] + tr[1]), Ke += 1;
                    }
                    for (Ye = pe.edges, at = pe.positions, be = 0; be < Ye.length; ++be) for (Ge = Ye[be], st = 0; st < 2; ++st) {
                      for (Ie = 0; Ie < 3; ++Ie) Se[3 * ct + Ie] = we[Ie];
                      for (Ie = 0; Ie < 4; ++Ie) Ce[4 * ct + Ie] = Ze[Ie];
                      Ue[ct] = ce, Pe = at[Ge[st]], Be[2 * ct] = zt * (yt * Pe[0] - pt * Pe[1] + tr[0]), Be[2 * ct + 1] = zt * (pt * Pe[0] + yt * Pe[1] + tr[1]), ct += 1;
                    }
                  }
                }
                this.bounds = [j, Q2], this.points = z, this.pointCount = z.length, this.vertexCount = se, this.lineVertexCount = he, this.pointBuffer.update(Se), this.colorBuffer.update(Ce), this.glyphBuffer.update(Be), this.idBuffer.update(Ue), c.free(Se), c.free(Ce), c.free(Be), c.free(Ue);
              }, w.dispose = function() {
                this.shader.dispose(), this.orthoShader.dispose(), this.pickPerspectiveShader.dispose(), this.pickOrthoShader.dispose(), this.vao.dispose(), this.pointBuffer.dispose(), this.colorBuffer.dispose(), this.glyphBuffer.dispose(), this.idBuffer.dispose();
              };
            }, { "./lib/get-simple-string": 125, "./lib/glyphs": 126, "./lib/shaders": 127, "gl-buffer": 78, "gl-mat4/multiply": 100, "gl-vao": 150, "is-string-blank": 239, "typedarray-pool": 308 }], 129: [function(a, o, s) {
              "use strict";
              var i = a("glslify");
              s.boxVertex = i([`precision mediump float;
#define GLSLIFY 1

attribute vec2 vertex;

uniform vec2 cornerA, cornerB;

void main() {
  gl_Position = vec4(mix(cornerA, cornerB, vertex), 0, 1);
}
`]), s.boxFragment = i([`precision mediump float;
#define GLSLIFY 1

uniform vec4 color;

void main() {
  gl_FragColor = color;
}
`]);
            }, { glslify: 231 }], 130: [function(a, o, s) {
              "use strict";
              var i = a("gl-shader"), l = a("gl-buffer"), u2 = a("./lib/shaders");
              function c(h, p, d) {
                this.plot = h, this.boxBuffer = p, this.boxShader = d, this.enabled = true, this.selectBox = [1 / 0, 1 / 0, -1 / 0, -1 / 0], this.borderColor = [0, 0, 0, 1], this.innerFill = false, this.innerColor = [0, 0, 0, 0.25], this.outerFill = true, this.outerColor = [0, 0, 0, 0.5], this.borderWidth = 10;
              }
              o.exports = function(h, p) {
                var d = h.gl, v = l(d, [0, 0, 0, 1, 1, 0, 1, 1]), m = i(d, u2.boxVertex, u2.boxFragment), g = new c(h, v, m);
                return g.update(p), h.addOverlay(g), g;
              };
              var f = c.prototype;
              f.draw = function() {
                if (this.enabled) {
                  var h = this.plot, p = this.selectBox, d = this.borderWidth, v = (this.innerFill, this.innerColor), m = (this.outerFill, this.outerColor), g = this.borderColor, x = h.box, b = h.screenBox, y = h.dataBox, w = h.viewBox, _4 = h.pixelRatio, k = (p[0] - y[0]) * (w[2] - w[0]) / (y[2] - y[0]) + w[0], T2 = (p[1] - y[1]) * (w[3] - w[1]) / (y[3] - y[1]) + w[1], A2 = (p[2] - y[0]) * (w[2] - w[0]) / (y[2] - y[0]) + w[0], S2 = (p[3] - y[1]) * (w[3] - w[1]) / (y[3] - y[1]) + w[1];
                  if (k = Math.max(k, w[0]), T2 = Math.max(T2, w[1]), A2 = Math.min(A2, w[2]), S2 = Math.min(S2, w[3]), !(A2 < k || S2 < T2)) {
                    x.bind();
                    var C2 = b[2] - b[0], E2 = b[3] - b[1];
                    if (this.outerFill && (x.drawBox(0, 0, C2, T2, m), x.drawBox(0, T2, k, S2, m), x.drawBox(0, S2, C2, E2, m), x.drawBox(A2, T2, C2, S2, m)), this.innerFill && x.drawBox(k, T2, A2, S2, v), d > 0) {
                      var F13 = d * _4;
                      x.drawBox(k - F13, T2 - F13, A2 + F13, T2 + F13, g), x.drawBox(k - F13, S2 - F13, A2 + F13, S2 + F13, g), x.drawBox(k - F13, T2 - F13, k + F13, S2 + F13, g), x.drawBox(A2 - F13, T2 - F13, A2 + F13, S2 + F13, g);
                    }
                  }
                }
              }, f.update = function(h) {
                h = h || {}, this.innerFill = !!h.innerFill, this.outerFill = !!h.outerFill, this.innerColor = (h.innerColor || [0, 0, 0, 0.5]).slice(), this.outerColor = (h.outerColor || [0, 0, 0, 0.5]).slice(), this.borderColor = (h.borderColor || [0, 0, 0, 1]).slice(), this.borderWidth = h.borderWidth || 0, this.selectBox = (h.selectBox || this.selectBox).slice();
              }, f.dispose = function() {
                this.boxBuffer.dispose(), this.boxShader.dispose(), this.plot.removeOverlay(this);
              };
            }, { "./lib/shaders": 129, "gl-buffer": 78, "gl-shader": 132 }], 131: [function(a, o, s) {
              "use strict";
              o.exports = function(d, v) {
                var m = v[0], g = v[1], x = i(d, m, g, {}), b = l.mallocUint8(m * g * 4);
                return new h(d, x, b);
              };
              var i = a("gl-fbo"), l = a("typedarray-pool"), u2 = a("ndarray"), c = a("bit-twiddle").nextPow2;
              function f(d, v, m, g, x) {
                this.coord = [d, v], this.id = m, this.value = g, this.distance = x;
              }
              function h(d, v, m) {
                this.gl = d, this.fbo = v, this.buffer = m, this._readTimeout = null;
                var g = this;
                this._readCallback = function() {
                  g.gl && (v.bind(), d.readPixels(0, 0, v.shape[0], v.shape[1], d.RGBA, d.UNSIGNED_BYTE, g.buffer), g._readTimeout = null);
                };
              }
              var p = h.prototype;
              Object.defineProperty(p, "shape", { get: function() {
                return this.gl ? this.fbo.shape.slice() : [0, 0];
              }, set: function(d) {
                if (this.gl) {
                  this.fbo.shape = d;
                  var v = this.fbo.shape[0], m = this.fbo.shape[1];
                  if (m * v * 4 > this.buffer.length) {
                    l.free(this.buffer);
                    for (var g = this.buffer = l.mallocUint8(c(m * v * 4)), x = 0; x < m * v * 4; ++x) g[x] = 255;
                  }
                  return d;
                }
              } }), p.begin = function() {
                var d = this.gl;
                this.shape, d && (this.fbo.bind(), d.clearColor(1, 1, 1, 1), d.clear(d.COLOR_BUFFER_BIT | d.DEPTH_BUFFER_BIT));
              }, p.end = function() {
                var d = this.gl;
                d && (d.bindFramebuffer(d.FRAMEBUFFER, null), this._readTimeout || clearTimeout(this._readTimeout), this._readTimeout = setTimeout(this._readCallback, 1));
              }, p.query = function(d, v, m) {
                if (!this.gl) return null;
                var g = this.fbo.shape.slice();
                d |= 0, v |= 0, typeof m != "number" && (m = 1);
                var x = 0 | Math.min(Math.max(d - m, 0), g[0]), b = 0 | Math.min(Math.max(d + m, 0), g[0]), y = 0 | Math.min(Math.max(v - m, 0), g[1]), w = 0 | Math.min(Math.max(v + m, 0), g[1]);
                if (b <= x || w <= y) return null;
                var _4 = [b - x, w - y], k = u2(this.buffer, [_4[0], _4[1], 4], [4, 4 * g[0], 1], 4 * (x + g[0] * y)), T2 = function(C2, E2, F13) {
                  for (var N2 = 1e8, D2 = -1, I2 = -1, O2 = C2.shape[0], L2 = C2.shape[1], V2 = 0; V2 < O2; V2++) for (var W2 = 0; W2 < L2; W2++) {
                    var X2 = C2.get(V2, W2, 0), Y2 = C2.get(V2, W2, 1), K2 = C2.get(V2, W2, 2), q = C2.get(V2, W2, 3);
                    if (X2 < 255 || Y2 < 255 || K2 < 255 || q < 255) {
                      var re = E2 - V2, R2 = F13 - W2, z = re * re + R2 * R2;
                      z < N2 && (N2 = z, D2 = V2, I2 = W2);
                    }
                  }
                  return [D2, I2, N2];
                }(k.hi(_4[0], _4[1], 1), m, m), A2 = T2[0], S2 = T2[1];
                return A2 < 0 || Math.pow(this.radius, 2) < T2[2] ? null : new f(A2 + x | 0, S2 + y | 0, k.get(A2, S2, 0), [k.get(A2, S2, 1), k.get(A2, S2, 2), k.get(A2, S2, 3)], Math.sqrt(T2[2]));
              }, p.dispose = function() {
                this.gl && (this.fbo.dispose(), l.free(this.buffer), this.gl = null, this._readTimeout && clearTimeout(this._readTimeout));
              };
            }, { "bit-twiddle": 32, "gl-fbo": 86, ndarray: 259, "typedarray-pool": 308 }], 132: [function(a, o, s) {
              "use strict";
              var i = a("./lib/create-uniforms"), l = a("./lib/create-attributes"), u2 = a("./lib/reflect"), c = a("./lib/shader-cache"), f = a("./lib/runtime-reflect"), h = a("./lib/GLError");
              function p(m) {
                this.gl = m, this.gl.lastAttribCount = 0, this._vref = this._fref = this._relink = this.vertShader = this.fragShader = this.program = this.attributes = this.uniforms = this.types = null;
              }
              var d = p.prototype;
              function v(m, g) {
                return m.name < g.name ? -1 : 1;
              }
              d.bind = function() {
                var m;
                this.program || this._relink();
                var g = this.gl.getProgramParameter(this.program, this.gl.ACTIVE_ATTRIBUTES), x = this.gl.lastAttribCount;
                if (g > x) for (m = x; m < g; m++) this.gl.enableVertexAttribArray(m);
                else if (x > g) for (m = g; m < x; m++) this.gl.disableVertexAttribArray(m);
                this.gl.lastAttribCount = g, this.gl.useProgram(this.program);
              }, d.dispose = function() {
                for (var m = this.gl.lastAttribCount, g = 0; g < m; g++) this.gl.disableVertexAttribArray(g);
                this.gl.lastAttribCount = 0, this._fref && this._fref.dispose(), this._vref && this._vref.dispose(), this.attributes = this.types = this.vertShader = this.fragShader = this.program = this._relink = this._fref = this._vref = null;
              }, d.update = function(m, g, x, b) {
                if (!g || arguments.length === 1) {
                  var y = m;
                  m = y.vertex, g = y.fragment, x = y.uniforms, b = y.attributes;
                }
                var w = this, _4 = w.gl, k = w._vref;
                w._vref = c.shader(_4, _4.VERTEX_SHADER, m), k && k.dispose(), w.vertShader = w._vref.shader;
                var T2 = this._fref;
                if (w._fref = c.shader(_4, _4.FRAGMENT_SHADER, g), T2 && T2.dispose(), w.fragShader = w._fref.shader, !x || !b) {
                  var A2 = _4.createProgram();
                  if (_4.attachShader(A2, w.fragShader), _4.attachShader(A2, w.vertShader), _4.linkProgram(A2), !_4.getProgramParameter(A2, _4.LINK_STATUS)) {
                    var S2 = _4.getProgramInfoLog(A2);
                    throw new h(S2, "Error linking program:" + S2);
                  }
                  x = x || f.uniforms(_4, A2), b = b || f.attributes(_4, A2), _4.deleteProgram(A2);
                }
                (b = b.slice()).sort(v);
                var C2, E2 = [], F13 = [], N2 = [];
                for (C2 = 0; C2 < b.length; ++C2) {
                  var D2 = b[C2];
                  if (D2.type.indexOf("mat") >= 0) {
                    for (var I2 = 0 | D2.type.charAt(D2.type.length - 1), O2 = new Array(I2), L2 = 0; L2 < I2; ++L2) O2[L2] = N2.length, F13.push(D2.name + "[" + L2 + "]"), typeof D2.location == "number" ? N2.push(D2.location + L2) : Array.isArray(D2.location) && D2.location.length === I2 && typeof D2.location[L2] == "number" ? N2.push(0 | D2.location[L2]) : N2.push(-1);
                    E2.push({ name: D2.name, type: D2.type, locations: O2 });
                  } else E2.push({ name: D2.name, type: D2.type, locations: [N2.length] }), F13.push(D2.name), typeof D2.location == "number" ? N2.push(0 | D2.location) : N2.push(-1);
                }
                var V2 = 0;
                for (C2 = 0; C2 < N2.length; ++C2) if (N2[C2] < 0) {
                  for (; N2.indexOf(V2) >= 0; ) V2 += 1;
                  N2[C2] = V2;
                }
                var W2 = new Array(x.length);
                function X2() {
                  w.program = c.program(_4, w._vref, w._fref, F13, N2);
                  for (var Y2 = 0; Y2 < x.length; ++Y2) W2[Y2] = _4.getUniformLocation(w.program, x[Y2].name);
                }
                X2(), w._relink = X2, w.types = { uniforms: u2(x), attributes: u2(b) }, w.attributes = l(_4, w, E2, N2), Object.defineProperty(w, "uniforms", i(_4, w, x, W2));
              }, o.exports = function(m, g, x, b, y) {
                var w = new p(m);
                return w.update(g, x, b, y), w;
              };
            }, { "./lib/GLError": 133, "./lib/create-attributes": 134, "./lib/create-uniforms": 135, "./lib/reflect": 136, "./lib/runtime-reflect": 137, "./lib/shader-cache": 138 }], 133: [function(a, o, s) {
              function i(l, u2, c) {
                this.shortMessage = u2 || "", this.longMessage = c || "", this.rawError = l || "", this.message = "gl-shader: " + (u2 || l || "") + (c ? `
` + c : ""), this.stack = new Error().stack;
              }
              i.prototype = new Error(), i.prototype.name = "GLError", i.prototype.constructor = i, o.exports = i;
            }, {}], 134: [function(a, o, s) {
              "use strict";
              o.exports = function(p, d, v, m) {
                for (var g = {}, x = 0, b = v.length; x < b; ++x) {
                  var y = v[x], w = y.name, _4 = y.type, k = y.locations;
                  switch (_4) {
                    case "bool":
                    case "int":
                    case "float":
                      f(p, d, k[0], m, 1, g, w);
                      break;
                    default:
                      if (_4.indexOf("vec") >= 0) {
                        if ((T2 = _4.charCodeAt(_4.length - 1) - 48) < 2 || T2 > 4) throw new i("", "Invalid data type for attribute " + w + ": " + _4);
                        f(p, d, k[0], m, T2, g, w);
                      } else {
                        if (!(_4.indexOf("mat") >= 0)) throw new i("", "Unknown data type for attribute " + w + ": " + _4);
                        var T2;
                        if ((T2 = _4.charCodeAt(_4.length - 1) - 48) < 2 || T2 > 4) throw new i("", "Invalid data type for attribute " + w + ": " + _4);
                        h(p, d, k, m, T2, g, w);
                      }
                  }
                }
                return g;
              };
              var i = a("./GLError");
              function l(p, d, v, m, g, x) {
                this._gl = p, this._wrapper = d, this._index = v, this._locations = m, this._dimension = g, this._constFunc = x;
              }
              var u2 = l.prototype;
              u2.pointer = function(p, d, v, m) {
                var g = this._gl, x = this._locations[this._index];
                g.vertexAttribPointer(x, this._dimension, p || g.FLOAT, !!d, v || 0, m || 0), g.enableVertexAttribArray(x);
              }, u2.set = function(p, d, v, m) {
                return this._constFunc(this._locations[this._index], p, d, v, m);
              }, Object.defineProperty(u2, "location", { get: function() {
                return this._locations[this._index];
              }, set: function(p) {
                return p !== this._locations[this._index] && (this._locations[this._index] = 0 | p, this._wrapper.program = null), 0 | p;
              } });
              var c = [function(p, d, v) {
                return v.length === void 0 ? p.vertexAttrib1f(d, v) : p.vertexAttrib1fv(d, v);
              }, function(p, d, v, m) {
                return v.length === void 0 ? p.vertexAttrib2f(d, v, m) : p.vertexAttrib2fv(d, v);
              }, function(p, d, v, m, g) {
                return v.length === void 0 ? p.vertexAttrib3f(d, v, m, g) : p.vertexAttrib3fv(d, v);
              }, function(p, d, v, m, g, x) {
                return v.length === void 0 ? p.vertexAttrib4f(d, v, m, g, x) : p.vertexAttrib4fv(d, v);
              }];
              function f(p, d, v, m, g, x, b) {
                var y = c[g], w = new l(p, d, v, m, g, y);
                Object.defineProperty(x, b, { set: function(_4) {
                  return p.disableVertexAttribArray(m[v]), y(p, m[v], _4), _4;
                }, get: function() {
                  return w;
                }, enumerable: true });
              }
              function h(p, d, v, m, g, x, b) {
                for (var y = new Array(g), w = new Array(g), _4 = 0; _4 < g; ++_4) f(p, d, v[_4], m, g, y, _4), w[_4] = y[_4];
                Object.defineProperty(y, "location", { set: function(A2) {
                  if (Array.isArray(A2)) for (var S2 = 0; S2 < g; ++S2) w[S2].location = A2[S2];
                  else for (S2 = 0; S2 < g; ++S2) w[S2].location = A2 + S2;
                  return A2;
                }, get: function() {
                  for (var A2 = new Array(g), S2 = 0; S2 < g; ++S2) A2[S2] = m[v[S2]];
                  return A2;
                }, enumerable: true }), y.pointer = function(A2, S2, C2, E2) {
                  A2 = A2 || p.FLOAT, S2 = !!S2, C2 = C2 || g * g, E2 = E2 || 0;
                  for (var F13 = 0; F13 < g; ++F13) {
                    var N2 = m[v[F13]];
                    p.vertexAttribPointer(N2, g, A2, S2, C2, E2 + F13 * g), p.enableVertexAttribArray(N2);
                  }
                };
                var k = new Array(g), T2 = p["vertexAttrib" + g + "fv"];
                Object.defineProperty(x, b, { set: function(A2) {
                  for (var S2 = 0; S2 < g; ++S2) {
                    var C2 = m[v[S2]];
                    if (p.disableVertexAttribArray(C2), Array.isArray(A2[0])) T2.call(p, C2, A2[S2]);
                    else {
                      for (var E2 = 0; E2 < g; ++E2) k[E2] = A2[g * S2 + E2];
                      T2.call(p, C2, k);
                    }
                  }
                  return A2;
                }, get: function() {
                  return y;
                }, enumerable: true });
              }
            }, { "./GLError": 133 }], 135: [function(a, o, s) {
              "use strict";
              var i = a("./reflect"), l = a("./GLError");
              function u2(f) {
                return function() {
                  return f;
                };
              }
              function c(f, h) {
                for (var p = new Array(f), d = 0; d < f; ++d) p[d] = h;
                return p;
              }
              o.exports = function(f, h, p, d) {
                function v(b) {
                  return function(y) {
                    for (var w = function L2(V2, W2) {
                      if (typeof W2 != "object") return [[V2, W2]];
                      var X2 = [];
                      for (var Y2 in W2) {
                        var K2 = W2[Y2], q = V2;
                        parseInt(Y2) + "" === Y2 ? q += "[" + Y2 + "]" : q += "." + Y2, typeof K2 == "object" ? X2.push.apply(X2, L2(q, K2)) : X2.push([q, K2]);
                      }
                      return X2;
                    }("", b), _4 = 0; _4 < w.length; ++_4) {
                      var k = w[_4], T2 = k[0], A2 = k[1];
                      if (d[A2]) {
                        var S2 = y;
                        if (typeof T2 == "string" && (T2.indexOf(".") === 0 || T2.indexOf("[") === 0)) {
                          var C2 = T2;
                          if (T2.indexOf(".") === 0 && (C2 = T2.slice(1)), C2.indexOf("]") === C2.length - 1) {
                            var E2 = C2.indexOf("["), F13 = C2.slice(0, E2), N2 = C2.slice(E2 + 1, C2.length - 1);
                            S2 = F13 ? y[F13][N2] : y[N2];
                          } else S2 = y[C2];
                        }
                        var D2, I2 = p[A2].type;
                        switch (I2) {
                          case "bool":
                          case "int":
                          case "sampler2D":
                          case "samplerCube":
                            f.uniform1i(d[A2], S2);
                            break;
                          case "float":
                            f.uniform1f(d[A2], S2);
                            break;
                          default:
                            var O2 = I2.indexOf("vec");
                            if (!(0 <= O2 && O2 <= 1 && I2.length === 4 + O2)) {
                              if (I2.indexOf("mat") === 0 && I2.length === 4) {
                                if ((D2 = I2.charCodeAt(I2.length - 1) - 48) < 2 || D2 > 4) throw new l("", "Invalid uniform dimension type for matrix " + name + ": " + I2);
                                f["uniformMatrix" + D2 + "fv"](d[A2], false, S2);
                                break;
                              }
                              throw new l("", "Unknown uniform data type for " + name + ": " + I2);
                            }
                            if ((D2 = I2.charCodeAt(I2.length - 1) - 48) < 2 || D2 > 4) throw new l("", "Invalid data type");
                            switch (I2.charAt(0)) {
                              case "b":
                              case "i":
                                f["uniform" + D2 + "iv"](d[A2], S2);
                                break;
                              case "v":
                                f["uniform" + D2 + "fv"](d[A2], S2);
                                break;
                              default:
                                throw new l("", "Unrecognized data type for vector " + name + ": " + I2);
                            }
                        }
                      }
                    }
                  };
                }
                function m(b, y, w) {
                  if (typeof w == "object") {
                    var _4 = g(w);
                    Object.defineProperty(b, y, { get: u2(_4), set: v(w), enumerable: true, configurable: false });
                  } else d[w] ? Object.defineProperty(b, y, { get: (k = w, function(T2, A2, S2) {
                    return T2.getUniform(A2.program, S2[k]);
                  }), set: v(w), enumerable: true, configurable: false }) : b[y] = function(T2) {
                    switch (T2) {
                      case "bool":
                        return false;
                      case "int":
                      case "sampler2D":
                      case "samplerCube":
                      case "float":
                        return 0;
                      default:
                        var A2 = T2.indexOf("vec");
                        if (0 <= A2 && A2 <= 1 && T2.length === 4 + A2) {
                          if ((S2 = T2.charCodeAt(T2.length - 1) - 48) < 2 || S2 > 4) throw new l("", "Invalid data type");
                          return T2.charAt(0) === "b" ? c(S2, false) : c(S2, 0);
                        }
                        if (T2.indexOf("mat") === 0 && T2.length === 4) {
                          var S2;
                          if ((S2 = T2.charCodeAt(T2.length - 1) - 48) < 2 || S2 > 4) throw new l("", "Invalid uniform dimension type for matrix " + name + ": " + T2);
                          return c(S2 * S2, 0);
                        }
                        throw new l("", "Unknown uniform data type for " + name + ": " + T2);
                    }
                  }(p[w].type);
                  var k;
                }
                function g(b) {
                  var y;
                  if (Array.isArray(b)) {
                    y = new Array(b.length);
                    for (var w = 0; w < b.length; ++w) m(y, w, b[w]);
                  } else for (var _4 in y = {}, b) m(y, _4, b[_4]);
                  return y;
                }
                var x = i(p, true);
                return { get: u2(g(x)), set: v(x), enumerable: true, configurable: true };
              };
            }, { "./GLError": 133, "./reflect": 136 }], 136: [function(a, o, s) {
              "use strict";
              o.exports = function(i, l) {
                for (var u2 = {}, c = 0; c < i.length; ++c) for (var f = i[c].name.split("."), h = u2, p = 0; p < f.length; ++p) {
                  var d = f[p].split("[");
                  if (d.length > 1) {
                    d[0] in h || (h[d[0]] = []), h = h[d[0]];
                    for (var v = 1; v < d.length; ++v) {
                      var m = parseInt(d[v]);
                      v < d.length - 1 || p < f.length - 1 ? (m in h || (v < d.length - 1 ? h[m] = [] : h[m] = {}), h = h[m]) : h[m] = l ? c : i[c].type;
                    }
                  } else p < f.length - 1 ? (d[0] in h || (h[d[0]] = {}), h = h[d[0]]) : h[d[0]] = l ? c : i[c].type;
                }
                return u2;
              };
            }, {}], 137: [function(a, o, s) {
              "use strict";
              s.uniforms = function(c, f) {
                for (var h = c.getProgramParameter(f, c.ACTIVE_UNIFORMS), p = [], d = 0; d < h; ++d) {
                  var v = c.getActiveUniform(f, d);
                  if (v) {
                    var m = u2(c, v.type);
                    if (v.size > 1) for (var g = 0; g < v.size; ++g) p.push({ name: v.name.replace("[0]", "[" + g + "]"), type: m });
                    else p.push({ name: v.name, type: m });
                  }
                }
                return p;
              }, s.attributes = function(c, f) {
                for (var h = c.getProgramParameter(f, c.ACTIVE_ATTRIBUTES), p = [], d = 0; d < h; ++d) {
                  var v = c.getActiveAttrib(f, d);
                  v && p.push({ name: v.name, type: u2(c, v.type) });
                }
                return p;
              };
              var i = { FLOAT: "float", FLOAT_VEC2: "vec2", FLOAT_VEC3: "vec3", FLOAT_VEC4: "vec4", INT: "int", INT_VEC2: "ivec2", INT_VEC3: "ivec3", INT_VEC4: "ivec4", BOOL: "bool", BOOL_VEC2: "bvec2", BOOL_VEC3: "bvec3", BOOL_VEC4: "bvec4", FLOAT_MAT2: "mat2", FLOAT_MAT3: "mat3", FLOAT_MAT4: "mat4", SAMPLER_2D: "sampler2D", SAMPLER_CUBE: "samplerCube" }, l = null;
              function u2(c, f) {
                if (!l) {
                  var h = Object.keys(i);
                  l = {};
                  for (var p = 0; p < h.length; ++p) {
                    var d = h[p];
                    l[c[d]] = i[d];
                  }
                }
                return l[f];
              }
            }, {}], 138: [function(a, o, s) {
              "use strict";
              s.shader = function(v, m, g) {
                return d(v).getShaderReference(m, g);
              }, s.program = function(v, m, g, x, b) {
                return d(v).getProgram(m, g, x, b);
              };
              var i = a("./GLError"), l = a("gl-format-compiler-error"), u2 = new (typeof WeakMap > "u" ? a("weakmap-shim") : WeakMap)(), c = 0;
              function f(v, m, g, x, b, y, w) {
                this.id = v, this.src = m, this.type = g, this.shader = x, this.count = y, this.programs = [], this.cache = w;
              }
              function h(v) {
                this.gl = v, this.shaders = [{}, {}], this.programs = {};
              }
              f.prototype.dispose = function() {
                if (--this.count == 0) {
                  for (var v = this.cache, m = v.gl, g = this.programs, x = 0, b = g.length; x < b; ++x) {
                    var y = v.programs[g[x]];
                    y && (delete v.programs[x], m.deleteProgram(y));
                  }
                  m.deleteShader(this.shader), delete v.shaders[this.type === m.FRAGMENT_SHADER | 0][this.src];
                }
              };
              var p = h.prototype;
              function d(v) {
                var m = u2.get(v);
                return m || (m = new h(v), u2.set(v, m)), m;
              }
              p.getShaderReference = function(v, m) {
                var g = this.gl, x = this.shaders[v === g.FRAGMENT_SHADER | 0], b = x[m];
                if (b && g.isShader(b.shader)) b.count += 1;
                else {
                  var y = function(w, _4, k) {
                    var T2 = w.createShader(_4);
                    if (w.shaderSource(T2, k), w.compileShader(T2), !w.getShaderParameter(T2, w.COMPILE_STATUS)) {
                      var A2 = w.getShaderInfoLog(T2);
                      try {
                        var S2 = l(A2, k, _4);
                      } catch (C2) {
                        throw console.warn("Failed to format compiler error: " + C2), new i(A2, `Error compiling shader:
` + A2);
                      }
                      throw new i(A2, S2.short, S2.long);
                    }
                    return T2;
                  }(g, v, m);
                  b = x[m] = new f(c++, m, v, y, [], 1, this);
                }
                return b;
              }, p.getProgram = function(v, m, g, x) {
                var b = [v.id, m.id, g.join(":"), x.join(":")].join("@"), y = this.programs[b];
                return y && this.gl.isProgram(y) || (this.programs[b] = y = function(w, _4, k, T2, A2) {
                  var S2 = w.createProgram();
                  w.attachShader(S2, _4), w.attachShader(S2, k);
                  for (var C2 = 0; C2 < T2.length; ++C2) w.bindAttribLocation(S2, A2[C2], T2[C2]);
                  if (w.linkProgram(S2), !w.getProgramParameter(S2, w.LINK_STATUS)) {
                    var E2 = w.getProgramInfoLog(S2);
                    throw new i(E2, "Error linking program: " + E2);
                  }
                  return S2;
                }(this.gl, v.shader, m.shader, g, x), v.programs.push(b), m.programs.push(b)), y;
              };
            }, { "./GLError": 133, "gl-format-compiler-error": 87, "weakmap-shim": 316 }], 139: [function(a, o, s) {
              "use strict";
              function i(u2) {
                this.plot = u2, this.enable = [true, true, false, false], this.width = [1, 1, 1, 1], this.color = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]], this.center = [1 / 0, 1 / 0];
              }
              o.exports = function(u2, c) {
                var f = new i(u2);
                return f.update(c), u2.addOverlay(f), f;
              };
              var l = i.prototype;
              l.update = function(u2) {
                u2 = u2 || {}, this.enable = (u2.enable || [true, true, false, false]).slice(), this.width = (u2.width || [1, 1, 1, 1]).slice(), this.color = (u2.color || [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]]).map(function(c) {
                  return c.slice();
                }), this.center = (u2.center || [1 / 0, 1 / 0]).slice(), this.plot.setOverlayDirty();
              }, l.draw = function() {
                var u2 = this.enable, c = this.width, f = this.color, h = this.center, p = this.plot, d = p.line, v = p.dataBox, m = p.viewBox;
                if (d.bind(), v[0] <= h[0] && h[0] <= v[2] && v[1] <= h[1] && h[1] <= v[3]) {
                  var g = m[0] + (h[0] - v[0]) / (v[2] - v[0]) * (m[2] - m[0]), x = m[1] + (h[1] - v[1]) / (v[3] - v[1]) * (m[3] - m[1]);
                  u2[0] && d.drawLine(g, x, m[0], x, c[0], f[0]), u2[1] && d.drawLine(g, x, g, m[1], c[1], f[1]), u2[2] && d.drawLine(g, x, m[2], x, c[2], f[2]), u2[3] && d.drawLine(g, x, g, m[3], c[3], f[3]);
                }
              }, l.dispose = function() {
                this.plot.removeOverlay(this);
              };
            }, {}], 140: [function(a, o, s) {
              "use strict";
              var i = a("glslify"), l = a("gl-shader"), u2 = i([`precision mediump float;
#define GLSLIFY 1

attribute vec3 position, color;
attribute float weight;

uniform mat4 model, view, projection;
uniform vec3 coordinates[3];
uniform vec4 colors[3];
uniform vec2 screenShape;
uniform float lineWidth;

varying vec4 fragColor;

void main() {
  vec3 vertexPosition = mix(coordinates[0],
    mix(coordinates[2], coordinates[1], 0.5 * (position + 1.0)), abs(position));

  vec4 clipPos = projection * view * model * vec4(vertexPosition, 1.0);
  vec2 clipOffset = (projection * view * model * vec4(color, 0.0)).xy;
  vec2 delta = weight * clipOffset * screenShape;
  vec2 lineOffset = normalize(vec2(delta.y, -delta.x)) / screenShape;

  gl_Position   = vec4(clipPos.xy + clipPos.w * 0.5 * lineWidth * lineOffset, clipPos.z, clipPos.w);
  fragColor     = color.x * colors[0] + color.y * colors[1] + color.z * colors[2];
}
`]), c = i([`precision mediump float;
#define GLSLIFY 1

varying vec4 fragColor;

void main() {
  gl_FragColor = fragColor;
}`]);
              o.exports = function(f) {
                return l(f, u2, c, null, [{ name: "position", type: "vec3" }, { name: "color", type: "vec3" }, { name: "weight", type: "float" }]);
              };
            }, { "gl-shader": 132, glslify: 231 }], 141: [function(a, o, s) {
              "use strict";
              var i = a("gl-buffer"), l = a("gl-vao"), u2 = a("./shaders/index");
              o.exports = function(m, g) {
                var x = [];
                function b(T2, A2, S2, C2, E2, F13) {
                  var N2 = [T2, A2, S2, 0, 0, 0, 1];
                  N2[C2 + 3] = 1, N2[C2] = E2, x.push.apply(x, N2), N2[6] = -1, x.push.apply(x, N2), N2[C2] = F13, x.push.apply(x, N2), x.push.apply(x, N2), N2[6] = 1, x.push.apply(x, N2), N2[C2] = E2, x.push.apply(x, N2);
                }
                b(0, 0, 0, 0, 0, 1), b(0, 0, 0, 1, 0, 1), b(0, 0, 0, 2, 0, 1), b(1, 0, 0, 1, -1, 1), b(1, 0, 0, 2, -1, 1), b(0, 1, 0, 0, -1, 1), b(0, 1, 0, 2, -1, 1), b(0, 0, 1, 0, -1, 1), b(0, 0, 1, 1, -1, 1);
                var y = i(m, x), w = l(m, [{ type: m.FLOAT, buffer: y, size: 3, offset: 0, stride: 28 }, { type: m.FLOAT, buffer: y, size: 3, offset: 12, stride: 28 }, { type: m.FLOAT, buffer: y, size: 1, offset: 24, stride: 28 }]), _4 = u2(m);
                _4.attributes.position.location = 0, _4.attributes.color.location = 1, _4.attributes.weight.location = 2;
                var k = new f(m, y, w, _4);
                return k.update(g), k;
              };
              var c = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
              function f(m, g, x, b) {
                this.gl = m, this.buffer = g, this.vao = x, this.shader = b, this.pixelRatio = 1, this.bounds = [[-1e3, -1e3, -1e3], [1e3, 1e3, 1e3]], this.position = [0, 0, 0], this.lineWidth = [2, 2, 2], this.colors = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]], this.enabled = [true, true, true], this.drawSides = [true, true, true], this.axes = null;
              }
              var h = f.prototype, p = [0, 0, 0], d = [0, 0, 0], v = [0, 0];
              h.isTransparent = function() {
                return false;
              }, h.drawTransparent = function(m) {
              }, h.draw = function(m) {
                var g = this.gl, x = this.vao, b = this.shader;
                x.bind(), b.bind();
                var y, w = m.model || c, _4 = m.view || c, k = m.projection || c;
                this.axes && (y = this.axes.lastCubeProps.axis);
                for (var T2 = p, A2 = d, S2 = 0; S2 < 3; ++S2) y && y[S2] < 0 ? (T2[S2] = this.bounds[0][S2], A2[S2] = this.bounds[1][S2]) : (T2[S2] = this.bounds[1][S2], A2[S2] = this.bounds[0][S2]);
                for (v[0] = g.drawingBufferWidth, v[1] = g.drawingBufferHeight, b.uniforms.model = w, b.uniforms.view = _4, b.uniforms.projection = k, b.uniforms.coordinates = [this.position, T2, A2], b.uniforms.colors = this.colors, b.uniforms.screenShape = v, S2 = 0; S2 < 3; ++S2) b.uniforms.lineWidth = this.lineWidth[S2] * this.pixelRatio, this.enabled[S2] && (x.draw(g.TRIANGLES, 6, 6 * S2), this.drawSides[S2] && x.draw(g.TRIANGLES, 12, 18 + 12 * S2));
                x.unbind();
              }, h.update = function(m) {
                m && ("bounds" in m && (this.bounds = m.bounds), "position" in m && (this.position = m.position), "lineWidth" in m && (this.lineWidth = m.lineWidth), "colors" in m && (this.colors = m.colors), "enabled" in m && (this.enabled = m.enabled), "drawSides" in m && (this.drawSides = m.drawSides));
              }, h.dispose = function() {
                this.vao.dispose(), this.buffer.dispose(), this.shader.dispose();
              };
            }, { "./shaders/index": 140, "gl-buffer": 78, "gl-vao": 150 }], 142: [function(a, o, s) {
              var i = a("glslify"), l = i([`precision highp float;

precision highp float;
#define GLSLIFY 1

vec3 getOrthogonalVector(vec3 v) {
  // Return up-vector for only-z vector.
  // 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).
  // From the above if-statement we have ||a|| > 0  U  ||b|| > 0.
  // Assign z = 0, x = -b, y = a:
  // a*-b + b*a + c*0 = -ba + ba + 0 = 0
  if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {
    return normalize(vec3(-v.y, v.x, 0.0));
  } else {
    return normalize(vec3(0.0, v.z, -v.y));
  }
}

// Calculate the tube vertex and normal at the given index.
//
// The returned vertex is for a tube ring with its center at origin, radius of length(d), pointing in the direction of d.
//
// Each tube segment is made up of a ring of vertices.
// These vertices are used to make up the triangles of the tube by connecting them together in the vertex array.
// The indexes of tube segments run from 0 to 8.
//
vec3 getTubePosition(vec3 d, float index, out vec3 normal) {
  float segmentCount = 8.0;

  float angle = 2.0 * 3.14159 * (index / segmentCount);

  vec3 u = getOrthogonalVector(d);
  vec3 v = normalize(cross(u, d));

  vec3 x = u * cos(angle) * length(d);
  vec3 y = v * sin(angle) * length(d);
  vec3 v3 = x + y;

  normal = normalize(v3);

  return v3;
}

attribute vec4 vector;
attribute vec4 color, position;
attribute vec2 uv;

uniform float vectorScale, tubeScale;
uniform mat4 model, view, projection, inverseModel;
uniform vec3 eyePosition, lightPosition;

varying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, f_position;
varying vec4 f_color;
varying vec2 f_uv;

void main() {
  // Scale the vector magnitude to stay constant with
  // model & view changes.
  vec3 normal;
  vec3 XYZ = getTubePosition(mat3(model) * (tubeScale * vector.w * normalize(vector.xyz)), position.w, normal);
  vec4 tubePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0);

  //Lighting geometry parameters
  vec4 cameraCoordinate = view * tubePosition;
  cameraCoordinate.xyz /= cameraCoordinate.w;
  f_lightDirection = lightPosition - cameraCoordinate.xyz;
  f_eyeDirection   = eyePosition - cameraCoordinate.xyz;
  f_normal = normalize((vec4(normal, 0.0) * inverseModel).xyz);

  // vec4 m_position  = model * vec4(tubePosition, 1.0);
  vec4 t_position  = view * tubePosition;
  gl_Position      = projection * t_position;

  f_color          = color;
  f_data           = tubePosition.xyz;
  f_position       = position.xyz;
  f_uv             = uv;
}
`]), u2 = i([`#extension GL_OES_standard_derivatives : enable

precision highp float;
#define GLSLIFY 1

float beckmannDistribution(float x, float roughness) {
  float NdotH = max(x, 0.0001);
  float cos2Alpha = NdotH * NdotH;
  float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;
  float roughness2 = roughness * roughness;
  float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;
  return exp(tan2Alpha / roughness2) / denom;
}

float cookTorranceSpecular(
  vec3 lightDirection,
  vec3 viewDirection,
  vec3 surfaceNormal,
  float roughness,
  float fresnel) {

  float VdotN = max(dot(viewDirection, surfaceNormal), 0.0);
  float LdotN = max(dot(lightDirection, surfaceNormal), 0.0);

  //Half angle vector
  vec3 H = normalize(lightDirection + viewDirection);

  //Geometric term
  float NdotH = max(dot(surfaceNormal, H), 0.0);
  float VdotH = max(dot(viewDirection, H), 0.000001);
  float LdotH = max(dot(lightDirection, H), 0.000001);
  float G1 = (2.0 * NdotH * VdotN) / VdotH;
  float G2 = (2.0 * NdotH * LdotN) / LdotH;
  float G = min(1.0, min(G1, G2));
  
  //Distribution term
  float D = beckmannDistribution(NdotH, roughness);

  //Fresnel term
  float F = pow(1.0 - VdotN, fresnel);

  //Multiply terms and done
  return  G * F * D / max(3.14159265 * VdotN, 0.000001);
}

bool outOfRange(float a, float b, float p) {
  return ((p > max(a, b)) || 
          (p < min(a, b)));
}

bool outOfRange(vec2 a, vec2 b, vec2 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y));
}

bool outOfRange(vec3 a, vec3 b, vec3 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y) ||
          outOfRange(a.z, b.z, p.z));
}

bool outOfRange(vec4 a, vec4 b, vec4 p) {
  return outOfRange(a.xyz, b.xyz, p.xyz);
}

uniform vec3 clipBounds[2];
uniform float roughness, fresnel, kambient, kdiffuse, kspecular, opacity;
uniform sampler2D texture;

varying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, f_position;
varying vec4 f_color;
varying vec2 f_uv;

void main() {
  if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard;
  vec3 N = normalize(f_normal);
  vec3 L = normalize(f_lightDirection);
  vec3 V = normalize(f_eyeDirection);

  if(gl_FrontFacing) {
    N = -N;
  }

  float specular = min(1.0, max(0.0, cookTorranceSpecular(L, V, N, roughness, fresnel)));
  float diffuse  = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);

  vec4 surfaceColor = f_color * texture2D(texture, f_uv);
  vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular,  1.0);

  gl_FragColor = litColor * opacity;
}
`]), c = i([`precision highp float;

precision highp float;
#define GLSLIFY 1

vec3 getOrthogonalVector(vec3 v) {
  // Return up-vector for only-z vector.
  // 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).
  // From the above if-statement we have ||a|| > 0  U  ||b|| > 0.
  // Assign z = 0, x = -b, y = a:
  // a*-b + b*a + c*0 = -ba + ba + 0 = 0
  if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {
    return normalize(vec3(-v.y, v.x, 0.0));
  } else {
    return normalize(vec3(0.0, v.z, -v.y));
  }
}

// Calculate the tube vertex and normal at the given index.
//
// The returned vertex is for a tube ring with its center at origin, radius of length(d), pointing in the direction of d.
//
// Each tube segment is made up of a ring of vertices.
// These vertices are used to make up the triangles of the tube by connecting them together in the vertex array.
// The indexes of tube segments run from 0 to 8.
//
vec3 getTubePosition(vec3 d, float index, out vec3 normal) {
  float segmentCount = 8.0;

  float angle = 2.0 * 3.14159 * (index / segmentCount);

  vec3 u = getOrthogonalVector(d);
  vec3 v = normalize(cross(u, d));

  vec3 x = u * cos(angle) * length(d);
  vec3 y = v * sin(angle) * length(d);
  vec3 v3 = x + y;

  normal = normalize(v3);

  return v3;
}

attribute vec4 vector;
attribute vec4 position;
attribute vec4 id;

uniform mat4 model, view, projection;
uniform float tubeScale;

varying vec3 f_position;
varying vec4 f_id;

void main() {
  vec3 normal;
  vec3 XYZ = getTubePosition(mat3(model) * (tubeScale * vector.w * normalize(vector.xyz)), position.w, normal);
  vec4 tubePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0);

  gl_Position = projection * view * tubePosition;
  f_id        = id;
  f_position  = position.xyz;
}
`]), f = i([`precision highp float;
#define GLSLIFY 1

bool outOfRange(float a, float b, float p) {
  return ((p > max(a, b)) || 
          (p < min(a, b)));
}

bool outOfRange(vec2 a, vec2 b, vec2 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y));
}

bool outOfRange(vec3 a, vec3 b, vec3 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y) ||
          outOfRange(a.z, b.z, p.z));
}

bool outOfRange(vec4 a, vec4 b, vec4 p) {
  return outOfRange(a.xyz, b.xyz, p.xyz);
}

uniform vec3  clipBounds[2];
uniform float pickId;

varying vec3 f_position;
varying vec4 f_id;

void main() {
  if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard;

  gl_FragColor = vec4(pickId, f_id.xyz);
}`]);
              s.meshShader = { vertex: l, fragment: u2, attributes: [{ name: "position", type: "vec4" }, { name: "color", type: "vec4" }, { name: "uv", type: "vec2" }, { name: "vector", type: "vec4" }] }, s.pickShader = { vertex: c, fragment: f, attributes: [{ name: "position", type: "vec4" }, { name: "id", type: "vec4" }, { name: "vector", type: "vec4" }] };
            }, { glslify: 231 }], 143: [function(a, o, s) {
              "use strict";
              var i = a("gl-vec3"), l = a("gl-vec4"), u2 = ["xyz", "xzy", "yxz", "yzx", "zxy", "zyx"], c = function(m, g, x, b) {
                for (var y = 0, w = 0; w < m.length; w++) for (var _4 = m[w].velocities, k = 0; k < _4.length; k++) y = Math.max(y, i.length(_4[k]));
                var T2 = m.map(function(L2) {
                  return function(V2, W2, X2, Y2) {
                    for (var K2 = V2.points, q = V2.velocities, re = V2.divergences, R2 = [], z = [], H2 = [], te = [], j = [], Q2 = [], Z2 = 0, ne = 0, ae = l.create(), ue = l.create(), le = 0; le < K2.length; le++) {
                      var ce = K2[le], se = q[le], he = re[le];
                      W2 === 0 && (he = 0.05 * X2), ne = i.length(se) / Y2, ae = l.create(), i.copy(ae, se), ae[3] = he;
                      for (var me = 0; me < 8; me++) j[me] = [ce[0], ce[1], ce[2], me];
                      if (te.length > 0) for (me = 0; me < 8; me++) {
                        var we = (me + 1) % 8;
                        R2.push(te[me], j[me], j[we], j[we], te[we], te[me]), H2.push(ue, ae, ae, ae, ue, ue), Q2.push(Z2, ne, ne, ne, Z2, Z2);
                        var be = R2.length;
                        z.push([be - 6, be - 5, be - 4], [be - 3, be - 2, be - 1]);
                      }
                      var Ae = te;
                      te = j, j = Ae;
                      var pe = ue;
                      ue = ae, ae = pe;
                      var ve = Z2;
                      Z2 = ne, ne = ve;
                    }
                    return { positions: R2, cells: z, vectors: H2, vertexIntensity: Q2 };
                  }(L2, x, b, y);
                }), A2 = [], S2 = [], C2 = [], E2 = [];
                for (w = 0; w < T2.length; w++) {
                  var F13 = T2[w], N2 = A2.length;
                  for (A2 = A2.concat(F13.positions), C2 = C2.concat(F13.vectors), E2 = E2.concat(F13.vertexIntensity), k = 0; k < F13.cells.length; k++) {
                    var D2 = F13.cells[k], I2 = [];
                    S2.push(I2);
                    for (var O2 = 0; O2 < D2.length; O2++) I2.push(D2[O2] + N2);
                  }
                }
                return { positions: A2, cells: S2, vectors: C2, vertexIntensity: E2, colormap: g };
              }, f = function(m, g) {
                var x, b = m.length;
                for (x = 0; x < b; x++) {
                  var y = m[x];
                  if (y === g) return x;
                  if (y > g) return x - 1;
                }
                return x;
              }, h = function(m, g, x) {
                return m < g ? g : m > x ? x : m;
              }, p = function(m) {
                var g = 1 / 0;
                m.sort(function(w, _4) {
                  return w - _4;
                });
                for (var x = m.length, b = 1; b < x; b++) {
                  var y = Math.abs(m[b] - m[b - 1]);
                  y < g && (g = y);
                }
                return g;
              };
              o.exports = function(m, g) {
                var x = m.startingPositions, b = m.maxLength || 1e3, y = m.tubeSize || 1, w = m.absoluteTubeSize, _4 = m.gridFill || "+x+y+z", k = {};
                _4.indexOf("-x") !== -1 && (k.reversedX = true), _4.indexOf("-y") !== -1 && (k.reversedY = true), _4.indexOf("-z") !== -1 && (k.reversedZ = true), k.filled = u2.indexOf(_4.replace(/-/g, "").replace(/\+/g, ""));
                var T2 = m.getVelocity || function(le) {
                  return function(ce, se, he) {
                    var me = se.vectors, we = se.meshgrid, be = ce[0], Ae = ce[1], pe = ce[2], ve = we[0].length, Ee = we[1].length, Se = we[2].length, Ce = f(we[0], be), Be = f(we[1], Ae), Ue = f(we[2], pe), Ke = Ce + 1, ct = Be + 1, We = Ue + 1;
                    if (Ce = h(Ce, 0, ve - 1), Ke = h(Ke, 0, ve - 1), Be = h(Be, 0, Ee - 1), ct = h(ct, 0, Ee - 1), Ue = h(Ue, 0, Se - 1), We = h(We, 0, Se - 1), Ce < 0 || Be < 0 || Ue < 0 || Ke > ve - 1 || ct > Ee - 1 || We > Se - 1) return i.create();
                    var Ze, it, ot, mt, wt, Et, zt = we[0][Ce], Nt = we[0][Ke], yt = we[1][Be], pt = we[1][ct], Ot = we[2][Ue], Jt = (be - zt) / (Nt - zt), tr = (Ae - yt) / (pt - yt), Ye = (pe - Ot) / (we[2][We] - Ot);
                    switch (isFinite(Jt) || (Jt = 0.5), isFinite(tr) || (tr = 0.5), isFinite(Ye) || (Ye = 0.5), he.reversedX && (Ce = ve - 1 - Ce, Ke = ve - 1 - Ke), he.reversedY && (Be = Ee - 1 - Be, ct = Ee - 1 - ct), he.reversedZ && (Ue = Se - 1 - Ue, We = Se - 1 - We), he.filled) {
                      case 5:
                        wt = Ue, Et = We, ot = Be * Se, mt = ct * Se, Ze = Ce * Se * Ee, it = Ke * Se * Ee;
                        break;
                      case 4:
                        wt = Ue, Et = We, Ze = Ce * Se, it = Ke * Se, ot = Be * Se * ve, mt = ct * Se * ve;
                        break;
                      case 3:
                        ot = Be, mt = ct, wt = Ue * Ee, Et = We * Ee, Ze = Ce * Ee * Se, it = Ke * Ee * Se;
                        break;
                      case 2:
                        ot = Be, mt = ct, Ze = Ce * Ee, it = Ke * Ee, wt = Ue * Ee * ve, Et = We * Ee * ve;
                        break;
                      case 1:
                        Ze = Ce, it = Ke, wt = Ue * ve, Et = We * ve, ot = Be * ve * Se, mt = ct * ve * Se;
                        break;
                      default:
                        Ze = Ce, it = Ke, ot = Be * ve, mt = ct * ve, wt = Ue * ve * Ee, Et = We * ve * Ee;
                    }
                    var at = me[Ze + ot + wt], Ge = me[Ze + ot + Et], st = me[Ze + mt + wt], Ie = me[Ze + mt + Et], Pe = me[it + ot + wt], $e = me[it + ot + Et], Ve = me[it + mt + wt], ut = me[it + mt + Et], Re = i.create(), qe = i.create(), je = i.create(), rt = i.create();
                    i.lerp(Re, at, Pe, Jt), i.lerp(qe, Ge, $e, Jt), i.lerp(je, st, Ve, Jt), i.lerp(rt, Ie, ut, Jt);
                    var He = i.create(), xe = i.create();
                    i.lerp(He, Re, je, tr), i.lerp(xe, qe, rt, tr);
                    var Ne = i.create();
                    return i.lerp(Ne, He, xe, Ye), Ne;
                  }(le, m, k);
                }, A2 = m.getDivergence || function(le, ce) {
                  var se = i.create(), he = 1e-4;
                  i.add(se, le, [he, 0, 0]);
                  var me = T2(se);
                  i.subtract(me, me, ce), i.scale(me, me, 1 / he), i.add(se, le, [0, he, 0]);
                  var we = T2(se);
                  i.subtract(we, we, ce), i.scale(we, we, 1 / he), i.add(se, le, [0, 0, he]);
                  var be = T2(se);
                  return i.subtract(be, be, ce), i.scale(be, be, 1 / he), i.add(se, me, we), i.add(se, se, be), se;
                }, S2 = [], C2 = g[0][0], E2 = g[0][1], F13 = g[0][2], N2 = g[1][0], D2 = g[1][1], I2 = g[1][2], O2 = function(le) {
                  var ce = le[0], se = le[1], he = le[2];
                  return !(ce < C2 || ce > N2 || se < E2 || se > D2 || he < F13 || he > I2);
                }, L2 = 10 * i.distance(g[0], g[1]) / b, V2 = L2 * L2, W2 = 1, X2 = 0, Y2 = x.length;
                Y2 > 1 && (W2 = function(le) {
                  for (var ce = [], se = [], he = [], me = {}, we = {}, be = {}, Ae = le.length, pe = 0; pe < Ae; pe++) {
                    var ve = le[pe], Ee = ve[0], Se = ve[1], Ce = ve[2];
                    me[Ee] || (ce.push(Ee), me[Ee] = true), we[Se] || (se.push(Se), we[Se] = true), be[Ce] || (he.push(Ce), be[Ce] = true);
                  }
                  var Be = p(ce), Ue = p(se), Ke = p(he), ct = Math.min(Be, Ue, Ke);
                  return isFinite(ct) ? ct : 1;
                }(x));
                for (var K2 = 0; K2 < Y2; K2++) {
                  var q = i.create();
                  i.copy(q, x[K2]);
                  var re = [q], R2 = [], z = T2(q), H2 = q;
                  R2.push(z);
                  var te = [], j = A2(q, z), Q2 = i.length(j);
                  isFinite(Q2) && Q2 > X2 && (X2 = Q2), te.push(Q2), S2.push({ points: re, velocities: R2, divergences: te });
                  for (var Z2 = 0; Z2 < 100 * b && re.length < b && O2(q); ) {
                    Z2++;
                    var ne = i.clone(z), ae = i.squaredLength(ne);
                    if (ae === 0) break;
                    ae > V2 && i.scale(ne, ne, L2 / Math.sqrt(ae)), i.add(ne, ne, q), z = T2(ne), i.squaredDistance(H2, ne) - V2 > -1e-4 * V2 && (re.push(ne), H2 = ne, R2.push(z), j = A2(ne, z), Q2 = i.length(j), isFinite(Q2) && Q2 > X2 && (X2 = Q2), te.push(Q2)), q = ne;
                  }
                }
                var ue = c(S2, m.colormap, X2, W2);
                return w ? ue.tubeScale = w : (X2 === 0 && (X2 = 1), ue.tubeScale = 0.5 * y * W2 / X2), ue;
              };
              var d = a("./lib/shaders"), v = a("gl-cone3d").createMesh;
              o.exports.createTubeMesh = function(m, g) {
                return v(m, g, { shaders: d, traceType: "streamtube" });
              };
            }, { "./lib/shaders": 142, "gl-cone3d": 79, "gl-vec3": 169, "gl-vec4": 205 }], 144: [function(a, o, s) {
              var i = a("gl-shader"), l = a("glslify"), u2 = l([`precision highp float;
#define GLSLIFY 1

attribute vec4 uv;
attribute vec3 f;
attribute vec3 normal;

uniform vec3 objectOffset;
uniform mat4 model, view, projection, inverseModel;
uniform vec3 lightPosition, eyePosition;
uniform sampler2D colormap;

varying float value, kill;
varying vec3 worldCoordinate;
varying vec2 planeCoordinate;
varying vec3 lightDirection, eyeDirection, surfaceNormal;
varying vec4 vColor;

void main() {
  vec3 localCoordinate = vec3(uv.zw, f.x);
  worldCoordinate = objectOffset + localCoordinate;
  vec4 worldPosition = model * vec4(worldCoordinate, 1.0);
  vec4 clipPosition = projection * view * worldPosition;
  gl_Position = clipPosition;
  kill = f.y;
  value = f.z;
  planeCoordinate = uv.xy;

  vColor = texture2D(colormap, vec2(value, value));

  //Lighting geometry parameters
  vec4 cameraCoordinate = view * worldPosition;
  cameraCoordinate.xyz /= cameraCoordinate.w;
  lightDirection = lightPosition - cameraCoordinate.xyz;
  eyeDirection   = eyePosition - cameraCoordinate.xyz;
  surfaceNormal  = normalize((vec4(normal,0) * inverseModel).xyz);
}
`]), c = l([`precision highp float;
#define GLSLIFY 1

float beckmannDistribution(float x, float roughness) {
  float NdotH = max(x, 0.0001);
  float cos2Alpha = NdotH * NdotH;
  float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;
  float roughness2 = roughness * roughness;
  float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;
  return exp(tan2Alpha / roughness2) / denom;
}

float beckmannSpecular(
  vec3 lightDirection,
  vec3 viewDirection,
  vec3 surfaceNormal,
  float roughness) {
  return beckmannDistribution(dot(surfaceNormal, normalize(lightDirection + viewDirection)), roughness);
}

bool outOfRange(float a, float b, float p) {
  return ((p > max(a, b)) || 
          (p < min(a, b)));
}

bool outOfRange(vec2 a, vec2 b, vec2 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y));
}

bool outOfRange(vec3 a, vec3 b, vec3 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y) ||
          outOfRange(a.z, b.z, p.z));
}

bool outOfRange(vec4 a, vec4 b, vec4 p) {
  return outOfRange(a.xyz, b.xyz, p.xyz);
}

uniform vec3 lowerBound, upperBound;
uniform float contourTint;
uniform vec4 contourColor;
uniform sampler2D colormap;
uniform vec3 clipBounds[2];
uniform float roughness, fresnel, kambient, kdiffuse, kspecular, opacity;
uniform float vertexColor;

varying float value, kill;
varying vec3 worldCoordinate;
varying vec3 lightDirection, eyeDirection, surfaceNormal;
varying vec4 vColor;

void main() {
  if (
    kill > 0.0 ||
    vColor.a == 0.0 ||
    outOfRange(clipBounds[0], clipBounds[1], worldCoordinate)
  ) discard;

  vec3 N = normalize(surfaceNormal);
  vec3 V = normalize(eyeDirection);
  vec3 L = normalize(lightDirection);

  if(gl_FrontFacing) {
    N = -N;
  }

  float specular = max(beckmannSpecular(L, V, N, roughness), 0.);
  float diffuse  = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);

  //decide how to interpolate color \u2014 in vertex or in fragment
  vec4 surfaceColor =
    step(vertexColor, .5) * texture2D(colormap, vec2(value, value)) +
    step(.5, vertexColor) * vColor;

  vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular,  1.0);

  gl_FragColor = mix(litColor, contourColor, contourTint) * opacity;
}
`]), f = l([`precision highp float;
#define GLSLIFY 1

attribute vec4 uv;
attribute float f;

uniform vec3 objectOffset;
uniform mat3 permutation;
uniform mat4 model, view, projection;
uniform float height, zOffset;
uniform sampler2D colormap;

varying float value, kill;
varying vec3 worldCoordinate;
varying vec2 planeCoordinate;
varying vec3 lightDirection, eyeDirection, surfaceNormal;
varying vec4 vColor;

void main() {
  vec3 dataCoordinate = permutation * vec3(uv.xy, height);
  worldCoordinate = objectOffset + dataCoordinate;
  vec4 worldPosition = model * vec4(worldCoordinate, 1.0);

  vec4 clipPosition = projection * view * worldPosition;
  clipPosition.z += zOffset;

  gl_Position = clipPosition;
  value = f + objectOffset.z;
  kill = -1.0;
  planeCoordinate = uv.zw;

  vColor = texture2D(colormap, vec2(value, value));

  //Don't do lighting for contours
  surfaceNormal   = vec3(1,0,0);
  eyeDirection    = vec3(0,1,0);
  lightDirection  = vec3(0,0,1);
}
`]), h = l([`precision highp float;
#define GLSLIFY 1

bool outOfRange(float a, float b, float p) {
  return ((p > max(a, b)) || 
          (p < min(a, b)));
}

bool outOfRange(vec2 a, vec2 b, vec2 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y));
}

bool outOfRange(vec3 a, vec3 b, vec3 p) {
  return (outOfRange(a.x, b.x, p.x) ||
          outOfRange(a.y, b.y, p.y) ||
          outOfRange(a.z, b.z, p.z));
}

bool outOfRange(vec4 a, vec4 b, vec4 p) {
  return outOfRange(a.xyz, b.xyz, p.xyz);
}

uniform vec2 shape;
uniform vec3 clipBounds[2];
uniform float pickId;

varying float value, kill;
varying vec3 worldCoordinate;
varying vec2 planeCoordinate;
varying vec3 surfaceNormal;

vec2 splitFloat(float v) {
  float vh = 255.0 * v;
  float upper = floor(vh);
  float lower = fract(vh);
  return vec2(upper / 255.0, floor(lower * 16.0) / 16.0);
}

void main() {
  if ((kill > 0.0) ||
      (outOfRange(clipBounds[0], clipBounds[1], worldCoordinate))) discard;

  vec2 ux = splitFloat(planeCoordinate.x / shape.x);
  vec2 uy = splitFloat(planeCoordinate.y / shape.y);
  gl_FragColor = vec4(pickId, ux.x, uy.x, ux.y + (uy.y/16.0));
}
`]);
              s.createShader = function(p) {
                var d = i(p, u2, c, null, [{ name: "uv", type: "vec4" }, { name: "f", type: "vec3" }, { name: "normal", type: "vec3" }]);
                return d.attributes.uv.location = 0, d.attributes.f.location = 1, d.attributes.normal.location = 2, d;
              }, s.createPickShader = function(p) {
                var d = i(p, u2, h, null, [{ name: "uv", type: "vec4" }, { name: "f", type: "vec3" }, { name: "normal", type: "vec3" }]);
                return d.attributes.uv.location = 0, d.attributes.f.location = 1, d.attributes.normal.location = 2, d;
              }, s.createContourShader = function(p) {
                var d = i(p, f, c, null, [{ name: "uv", type: "vec4" }, { name: "f", type: "float" }]);
                return d.attributes.uv.location = 0, d.attributes.f.location = 1, d;
              }, s.createPickContourShader = function(p) {
                var d = i(p, f, h, null, [{ name: "uv", type: "vec4" }, { name: "f", type: "float" }]);
                return d.attributes.uv.location = 0, d.attributes.f.location = 1, d;
              };
            }, { "gl-shader": 132, glslify: 231 }], 145: [function(a, o, s) {
              "use strict";
              o.exports = function(z) {
                var H2 = z.gl, te = _4(H2), j = T2(H2), Q2 = k(H2), Z2 = A2(H2), ne = l(H2), ae = u2(H2, [{ buffer: ne, size: 4, stride: 40, offset: 0 }, { buffer: ne, size: 3, stride: 40, offset: 16 }, { buffer: ne, size: 3, stride: 40, offset: 28 }]), ue = l(H2), le = u2(H2, [{ buffer: ue, size: 4, stride: 20, offset: 0 }, { buffer: ue, size: 1, stride: 20, offset: 16 }]), ce = l(H2), se = u2(H2, [{ buffer: ce, size: 2, type: H2.FLOAT }]), he = c(H2, 1, 256, H2.RGBA, H2.UNSIGNED_BYTE);
                he.minFilter = H2.LINEAR, he.magFilter = H2.LINEAR;
                var me = new N2(H2, [0, 0], [[0, 0, 0], [0, 0, 0]], te, j, ne, ae, he, Q2, Z2, ue, le, ce, se, [0, 0, 0]), we = { levels: [[], [], []] };
                for (var be in z) we[be] = z[be];
                return we.colormap = we.colormap || "jet", me.update(we), me;
              };
              var i = a("bit-twiddle"), l = a("gl-buffer"), u2 = a("gl-vao"), c = a("gl-texture2d"), f = a("typedarray-pool"), h = a("colormap"), p = a("ndarray-ops"), d = a("ndarray-pack"), v = a("ndarray"), m = a("surface-nets"), g = a("gl-mat4/multiply"), x = a("gl-mat4/invert"), b = a("binary-search-bounds"), y = a("ndarray-gradient"), w = a("./lib/shaders"), _4 = w.createShader, k = w.createContourShader, T2 = w.createPickShader, A2 = w.createPickContourShader, S2 = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], C2 = [[0, 0], [0, 1], [1, 0], [1, 1], [1, 0], [0, 1]], E2 = [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]];
              function F13(z, H2, te, j, Q2) {
                this.position = z, this.index = H2, this.uv = te, this.level = j, this.dataCoordinate = Q2;
              }
              (function() {
                for (var z = 0; z < 3; ++z) {
                  var H2 = E2[z], te = (z + 2) % 3;
                  H2[(z + 1) % 3 + 0] = 1, H2[te + 3] = 1, H2[z + 6] = 1;
                }
              })();
              function N2(z, H2, te, j, Q2, Z2, ne, ae, ue, le, ce, se, he, me, we) {
                this.gl = z, this.shape = H2, this.bounds = te, this.objectOffset = we, this.intensityBounds = [], this._shader = j, this._pickShader = Q2, this._coordinateBuffer = Z2, this._vao = ne, this._colorMap = ae, this._contourShader = ue, this._contourPickShader = le, this._contourBuffer = ce, this._contourVAO = se, this._contourOffsets = [[], [], []], this._contourCounts = [[], [], []], this._vertexCount = 0, this._pickResult = new F13([0, 0, 0], [0, 0], [0, 0], [0, 0, 0], [0, 0, 0]), this._dynamicBuffer = he, this._dynamicVAO = me, this._dynamicOffsets = [0, 0, 0], this._dynamicCounts = [0, 0, 0], this.contourWidth = [1, 1, 1], this.contourLevels = [[1], [1], [1]], this.contourTint = [0, 0, 0], this.contourColor = [[0.5, 0.5, 0.5, 1], [0.5, 0.5, 0.5, 1], [0.5, 0.5, 0.5, 1]], this.showContour = true, this.showSurface = true, this.enableHighlight = [true, true, true], this.highlightColor = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]], this.highlightTint = [1, 1, 1], this.highlightLevel = [-1, -1, -1], this.enableDynamic = [true, true, true], this.dynamicLevel = [NaN, NaN, NaN], this.dynamicColor = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]], this.dynamicTint = [1, 1, 1], this.dynamicWidth = [1, 1, 1], this.axesBounds = [[1 / 0, 1 / 0, 1 / 0], [-1 / 0, -1 / 0, -1 / 0]], this.surfaceProject = [false, false, false], this.contourProject = [[false, false, false], [false, false, false], [false, false, false]], this.colorBounds = [false, false], this._field = [v(f.mallocFloat(1024), [0, 0]), v(f.mallocFloat(1024), [0, 0]), v(f.mallocFloat(1024), [0, 0])], this.pickId = 1, this.clipBounds = [[-1 / 0, -1 / 0, -1 / 0], [1 / 0, 1 / 0, 1 / 0]], this.snapToData = false, this.pixelRatio = 1, this.opacity = 1, this.lightPosition = [10, 1e4, 0], this.ambientLight = 0.8, this.diffuseLight = 0.8, this.specularLight = 2, this.roughness = 0.5, this.fresnel = 1.5, this.vertexColor = 0, this.dirty = true;
              }
              var D2 = N2.prototype;
              D2.genColormap = function(z, H2) {
                var te = false, j = d([h({ colormap: z, nshades: 256, format: "rgba" }).map(function(Q2, Z2) {
                  var ne = H2 ? function(ae, ue) {
                    if (!ue || !ue.length) return 1;
                    for (var le = 0; le < ue.length; ++le) {
                      if (ue.length < 2) return 1;
                      if (ue[le][0] === ae) return ue[le][1];
                      if (ue[le][0] > ae && le > 0) {
                        var ce = (ue[le][0] - ae) / (ue[le][0] - ue[le - 1][0]);
                        return ue[le][1] * (1 - ce) + ce * ue[le - 1][1];
                      }
                    }
                    return 1;
                  }(Z2 / 255, H2) : Q2[3];
                  return ne < 1 && (te = true), [Q2[0], Q2[1], Q2[2], 255 * ne];
                })]);
                return p.divseq(j, 255), this.hasAlphaScale = te, j;
              }, D2.isTransparent = function() {
                return this.opacity < 1 || this.hasAlphaScale;
              }, D2.isOpaque = function() {
                return !this.isTransparent();
              }, D2.pickSlots = 1, D2.setPickBase = function(z) {
                this.pickId = z;
              };
              var I2 = [0, 0, 0], O2 = { showSurface: false, showContour: false, projections: [S2.slice(), S2.slice(), S2.slice()], clipBounds: [[[0, 0, 0], [0, 0, 0]], [[0, 0, 0], [0, 0, 0]], [[0, 0, 0], [0, 0, 0]]] };
              function L2(z, H2) {
                var te, j, Q2, Z2 = H2.axes && H2.axes.lastCubeProps.axis || I2, ne = H2.showSurface, ae = H2.showContour;
                for (te = 0; te < 3; ++te) for (ne = ne || H2.surfaceProject[te], j = 0; j < 3; ++j) ae = ae || H2.contourProject[te][j];
                for (te = 0; te < 3; ++te) {
                  var ue = O2.projections[te];
                  for (j = 0; j < 16; ++j) ue[j] = 0;
                  for (j = 0; j < 4; ++j) ue[5 * j] = 1;
                  ue[5 * te] = 0, ue[12 + te] = H2.axesBounds[+(Z2[te] > 0)][te], g(ue, z.model, ue);
                  var le = O2.clipBounds[te];
                  for (Q2 = 0; Q2 < 2; ++Q2) for (j = 0; j < 3; ++j) le[Q2][j] = z.clipBounds[Q2][j];
                  le[0][te] = -1e8, le[1][te] = 1e8;
                }
                return O2.showSurface = ne, O2.showContour = ae, O2;
              }
              var V2 = { model: S2, view: S2, projection: S2, inverseModel: S2.slice(), lowerBound: [0, 0, 0], upperBound: [0, 0, 0], colorMap: 0, clipBounds: [[0, 0, 0], [0, 0, 0]], height: 0, contourTint: 0, contourColor: [0, 0, 0, 1], permutation: [1, 0, 0, 0, 1, 0, 0, 0, 1], zOffset: -1e-4, objectOffset: [0, 0, 0], kambient: 1, kdiffuse: 1, kspecular: 1, lightPosition: [1e3, 1e3, 1e3], eyePosition: [0, 0, 0], roughness: 1, fresnel: 1, opacity: 1, vertexColor: 0 }, W2 = S2.slice(), X2 = [1, 0, 0, 0, 1, 0, 0, 0, 1];
              function Y2(z, H2) {
                z = z || {};
                var te = this.gl;
                te.disable(te.CULL_FACE), this._colorMap.bind(0);
                var j = V2;
                j.model = z.model || S2, j.view = z.view || S2, j.projection = z.projection || S2, j.lowerBound = [this.bounds[0][0], this.bounds[0][1], this.colorBounds[0] || this.bounds[0][2]], j.upperBound = [this.bounds[1][0], this.bounds[1][1], this.colorBounds[1] || this.bounds[1][2]], j.objectOffset = this.objectOffset, j.contourColor = this.contourColor[0], j.inverseModel = x(j.inverseModel, j.model);
                for (var Q2 = 0; Q2 < 2; ++Q2) for (var Z2 = j.clipBounds[Q2], ne = 0; ne < 3; ++ne) Z2[ne] = Math.min(Math.max(this.clipBounds[Q2][ne], -1e8), 1e8);
                j.kambient = this.ambientLight, j.kdiffuse = this.diffuseLight, j.kspecular = this.specularLight, j.roughness = this.roughness, j.fresnel = this.fresnel, j.opacity = this.opacity, j.height = 0, j.permutation = X2, j.vertexColor = this.vertexColor;
                var ae = W2;
                for (g(ae, j.view, j.model), g(ae, j.projection, ae), x(ae, ae), Q2 = 0; Q2 < 3; ++Q2) j.eyePosition[Q2] = ae[12 + Q2] / ae[15];
                var ue = ae[15];
                for (Q2 = 0; Q2 < 3; ++Q2) ue += this.lightPosition[Q2] * ae[4 * Q2 + 3];
                for (Q2 = 0; Q2 < 3; ++Q2) {
                  var le = ae[12 + Q2];
                  for (ne = 0; ne < 3; ++ne) le += ae[4 * ne + Q2] * this.lightPosition[ne];
                  j.lightPosition[Q2] = le / ue;
                }
                var ce = L2(j, this);
                if (ce.showSurface) {
                  for (this._shader.bind(), this._shader.uniforms = j, this._vao.bind(), this.showSurface && this._vertexCount && this._vao.draw(te.TRIANGLES, this._vertexCount), Q2 = 0; Q2 < 3; ++Q2) this.surfaceProject[Q2] && this.vertexCount && (this._shader.uniforms.model = ce.projections[Q2], this._shader.uniforms.clipBounds = ce.clipBounds[Q2], this._vao.draw(te.TRIANGLES, this._vertexCount));
                  this._vao.unbind();
                }
                if (ce.showContour) {
                  var se = this._contourShader;
                  j.kambient = 1, j.kdiffuse = 0, j.kspecular = 0, j.opacity = 1, se.bind(), se.uniforms = j;
                  var he = this._contourVAO;
                  for (he.bind(), Q2 = 0; Q2 < 3; ++Q2) for (se.uniforms.permutation = E2[Q2], te.lineWidth(this.contourWidth[Q2] * this.pixelRatio), ne = 0; ne < this.contourLevels[Q2].length; ++ne) ne === this.highlightLevel[Q2] ? (se.uniforms.contourColor = this.highlightColor[Q2], se.uniforms.contourTint = this.highlightTint[Q2]) : ne !== 0 && ne - 1 !== this.highlightLevel[Q2] || (se.uniforms.contourColor = this.contourColor[Q2], se.uniforms.contourTint = this.contourTint[Q2]), this._contourCounts[Q2][ne] && (se.uniforms.height = this.contourLevels[Q2][ne], he.draw(te.LINES, this._contourCounts[Q2][ne], this._contourOffsets[Q2][ne]));
                  for (Q2 = 0; Q2 < 3; ++Q2) for (se.uniforms.model = ce.projections[Q2], se.uniforms.clipBounds = ce.clipBounds[Q2], ne = 0; ne < 3; ++ne) if (this.contourProject[Q2][ne]) {
                    se.uniforms.permutation = E2[ne], te.lineWidth(this.contourWidth[ne] * this.pixelRatio);
                    for (var me = 0; me < this.contourLevels[ne].length; ++me) me === this.highlightLevel[ne] ? (se.uniforms.contourColor = this.highlightColor[ne], se.uniforms.contourTint = this.highlightTint[ne]) : me !== 0 && me - 1 !== this.highlightLevel[ne] || (se.uniforms.contourColor = this.contourColor[ne], se.uniforms.contourTint = this.contourTint[ne]), this._contourCounts[ne][me] && (se.uniforms.height = this.contourLevels[ne][me], he.draw(te.LINES, this._contourCounts[ne][me], this._contourOffsets[ne][me]));
                  }
                  for (he.unbind(), (he = this._dynamicVAO).bind(), Q2 = 0; Q2 < 3; ++Q2) if (this._dynamicCounts[Q2] !== 0) for (se.uniforms.model = j.model, se.uniforms.clipBounds = j.clipBounds, se.uniforms.permutation = E2[Q2], te.lineWidth(this.dynamicWidth[Q2] * this.pixelRatio), se.uniforms.contourColor = this.dynamicColor[Q2], se.uniforms.contourTint = this.dynamicTint[Q2], se.uniforms.height = this.dynamicLevel[Q2], he.draw(te.LINES, this._dynamicCounts[Q2], this._dynamicOffsets[Q2]), ne = 0; ne < 3; ++ne) this.contourProject[ne][Q2] && (se.uniforms.model = ce.projections[ne], se.uniforms.clipBounds = ce.clipBounds[ne], he.draw(te.LINES, this._dynamicCounts[Q2], this._dynamicOffsets[Q2]));
                  he.unbind();
                }
              }
              D2.draw = function(z) {
                return Y2.call(this, z, false);
              }, D2.drawTransparent = function(z) {
                return Y2.call(this, z, true);
              };
              var K2 = { model: S2, view: S2, projection: S2, inverseModel: S2, clipBounds: [[0, 0, 0], [0, 0, 0]], height: 0, shape: [0, 0], pickId: 0, lowerBound: [0, 0, 0], upperBound: [0, 0, 0], zOffset: 0, objectOffset: [0, 0, 0], permutation: [1, 0, 0, 0, 1, 0, 0, 0, 1], lightPosition: [0, 0, 0], eyePosition: [0, 0, 0] };
              function q(z, H2) {
                return Array.isArray(z) ? [H2(z[0]), H2(z[1]), H2(z[2])] : [H2(z), H2(z), H2(z)];
              }
              function re(z) {
                return Array.isArray(z) ? z.length === 3 ? [z[0], z[1], z[2], 1] : [z[0], z[1], z[2], z[3]] : [0, 0, 0, 1];
              }
              function R2(z) {
                if (Array.isArray(z)) {
                  if (Array.isArray(z)) return [re(z[0]), re(z[1]), re(z[2])];
                  var H2 = re(z);
                  return [H2.slice(), H2.slice(), H2.slice()];
                }
              }
              D2.drawPick = function(z) {
                z = z || {};
                var H2 = this.gl;
                H2.disable(H2.CULL_FACE);
                var te = K2;
                te.model = z.model || S2, te.view = z.view || S2, te.projection = z.projection || S2, te.shape = this._field[2].shape, te.pickId = this.pickId / 255, te.lowerBound = this.bounds[0], te.upperBound = this.bounds[1], te.objectOffset = this.objectOffset, te.permutation = X2;
                for (var j = 0; j < 2; ++j) for (var Q2 = te.clipBounds[j], Z2 = 0; Z2 < 3; ++Z2) Q2[Z2] = Math.min(Math.max(this.clipBounds[j][Z2], -1e8), 1e8);
                var ne = L2(te, this);
                if (ne.showSurface) {
                  for (this._pickShader.bind(), this._pickShader.uniforms = te, this._vao.bind(), this._vao.draw(H2.TRIANGLES, this._vertexCount), j = 0; j < 3; ++j) this.surfaceProject[j] && (this._pickShader.uniforms.model = ne.projections[j], this._pickShader.uniforms.clipBounds = ne.clipBounds[j], this._vao.draw(H2.TRIANGLES, this._vertexCount));
                  this._vao.unbind();
                }
                if (ne.showContour) {
                  var ae = this._contourPickShader;
                  ae.bind(), ae.uniforms = te;
                  var ue = this._contourVAO;
                  for (ue.bind(), Z2 = 0; Z2 < 3; ++Z2) for (H2.lineWidth(this.contourWidth[Z2] * this.pixelRatio), ae.uniforms.permutation = E2[Z2], j = 0; j < this.contourLevels[Z2].length; ++j) this._contourCounts[Z2][j] && (ae.uniforms.height = this.contourLevels[Z2][j], ue.draw(H2.LINES, this._contourCounts[Z2][j], this._contourOffsets[Z2][j]));
                  for (j = 0; j < 3; ++j) for (ae.uniforms.model = ne.projections[j], ae.uniforms.clipBounds = ne.clipBounds[j], Z2 = 0; Z2 < 3; ++Z2) if (this.contourProject[j][Z2]) {
                    ae.uniforms.permutation = E2[Z2], H2.lineWidth(this.contourWidth[Z2] * this.pixelRatio);
                    for (var le = 0; le < this.contourLevels[Z2].length; ++le) this._contourCounts[Z2][le] && (ae.uniforms.height = this.contourLevels[Z2][le], ue.draw(H2.LINES, this._contourCounts[Z2][le], this._contourOffsets[Z2][le]));
                  }
                  ue.unbind();
                }
              }, D2.pick = function(z) {
                if (!z || z.id !== this.pickId) return null;
                var H2 = this._field[2].shape, te = this._pickResult, j = H2[0] * (z.value[0] + (z.value[2] >> 4) / 16) / 255, Q2 = Math.floor(j), Z2 = j - Q2, ne = H2[1] * (z.value[1] + (15 & z.value[2]) / 16) / 255, ae = Math.floor(ne), ue = ne - ae;
                Q2 += 1, ae += 1;
                var le = te.position;
                le[0] = le[1] = le[2] = 0;
                for (var ce = 0; ce < 2; ++ce) for (var se = ce ? Z2 : 1 - Z2, he = 0; he < 2; ++he) for (var me = Q2 + ce, we = ae + he, be = se * (he ? ue : 1 - ue), Ae = 0; Ae < 3; ++Ae) le[Ae] += this._field[Ae].get(me, we) * be;
                for (var pe = this._pickResult.level, ve = 0; ve < 3; ++ve) if (pe[ve] = b.le(this.contourLevels[ve], le[ve]), pe[ve] < 0) this.contourLevels[ve].length > 0 && (pe[ve] = 0);
                else if (pe[ve] < this.contourLevels[ve].length - 1) {
                  var Ee = this.contourLevels[ve][pe[ve]], Se = this.contourLevels[ve][pe[ve] + 1];
                  Math.abs(Ee - le[ve]) > Math.abs(Se - le[ve]) && (pe[ve] += 1);
                }
                for (te.index[0] = Z2 < 0.5 ? Q2 : Q2 + 1, te.index[1] = ue < 0.5 ? ae : ae + 1, te.uv[0] = j / H2[0], te.uv[1] = ne / H2[1], Ae = 0; Ae < 3; ++Ae) te.dataCoordinate[Ae] = this._field[Ae].get(te.index[0], te.index[1]);
                return te;
              }, D2.padField = function(z, H2) {
                var te = H2.shape.slice(), j = z.shape.slice();
                p.assign(z.lo(1, 1).hi(te[0], te[1]), H2), p.assign(z.lo(1).hi(te[0], 1), H2.hi(te[0], 1)), p.assign(z.lo(1, j[1] - 1).hi(te[0], 1), H2.lo(0, te[1] - 1).hi(te[0], 1)), p.assign(z.lo(0, 1).hi(1, te[1]), H2.hi(1)), p.assign(z.lo(j[0] - 1, 1).hi(1, te[1]), H2.lo(te[0] - 1)), z.set(0, 0, H2.get(0, 0)), z.set(0, j[1] - 1, H2.get(0, te[1] - 1)), z.set(j[0] - 1, 0, H2.get(te[0] - 1, 0)), z.set(j[0] - 1, j[1] - 1, H2.get(te[0] - 1, te[1] - 1));
              }, D2.update = function(z) {
                z = z || {}, this.objectOffset = z.objectOffset || this.objectOffset, this.dirty = true, "contourWidth" in z && (this.contourWidth = q(z.contourWidth, Number)), "showContour" in z && (this.showContour = q(z.showContour, Boolean)), "showSurface" in z && (this.showSurface = !!z.showSurface), "contourTint" in z && (this.contourTint = q(z.contourTint, Boolean)), "contourColor" in z && (this.contourColor = R2(z.contourColor)), "contourProject" in z && (this.contourProject = q(z.contourProject, function(Vt) {
                  return q(Vt, Boolean);
                })), "surfaceProject" in z && (this.surfaceProject = z.surfaceProject), "dynamicColor" in z && (this.dynamicColor = R2(z.dynamicColor)), "dynamicTint" in z && (this.dynamicTint = q(z.dynamicTint, Number)), "dynamicWidth" in z && (this.dynamicWidth = q(z.dynamicWidth, Number)), "opacity" in z && (this.opacity = z.opacity), "opacityscale" in z && (this.opacityscale = z.opacityscale), "colorBounds" in z && (this.colorBounds = z.colorBounds), "vertexColor" in z && (this.vertexColor = z.vertexColor ? 1 : 0), "colormap" in z && this._colorMap.setPixels(this.genColormap(z.colormap, this.opacityscale));
                var H2 = z.field || z.coords && z.coords[2] || null, te = false;
                if (H2 || (H2 = this._field[2].shape[0] || this._field[2].shape[2] ? this._field[2].lo(1, 1).hi(this._field[2].shape[0] - 2, this._field[2].shape[1] - 2) : this._field[2].hi(0, 0)), "field" in z || "coords" in z) {
                  var j = (H2.shape[0] + 2) * (H2.shape[1] + 2);
                  j > this._field[2].data.length && (f.freeFloat(this._field[2].data), this._field[2].data = f.mallocFloat(i.nextPow2(j))), this._field[2] = v(this._field[2].data, [H2.shape[0] + 2, H2.shape[1] + 2]), this.padField(this._field[2], H2), this.shape = H2.shape.slice();
                  for (var Q2 = this.shape, Z2 = 0; Z2 < 2; ++Z2) this._field[2].size > this._field[Z2].data.length && (f.freeFloat(this._field[Z2].data), this._field[Z2].data = f.mallocFloat(this._field[2].size)), this._field[Z2] = v(this._field[Z2].data, [Q2[0] + 2, Q2[1] + 2]);
                  if (z.coords) {
                    var ne = z.coords;
                    if (!Array.isArray(ne) || ne.length !== 3) throw new Error("gl-surface: invalid coordinates for x/y");
                    for (Z2 = 0; Z2 < 2; ++Z2) {
                      var ae = ne[Z2];
                      for (he = 0; he < 2; ++he) if (ae.shape[he] !== Q2[he]) throw new Error("gl-surface: coords have incorrect shape");
                      this.padField(this._field[Z2], ae);
                    }
                  } else if (z.ticks) {
                    var ue = z.ticks;
                    if (!Array.isArray(ue) || ue.length !== 2) throw new Error("gl-surface: invalid ticks");
                    for (Z2 = 0; Z2 < 2; ++Z2) {
                      var le = ue[Z2];
                      if ((Array.isArray(le) || le.length) && (le = v(le)), le.shape[0] !== Q2[Z2]) throw new Error("gl-surface: invalid tick length");
                      var ce = v(le.data, Q2);
                      ce.stride[Z2] = le.stride[0], ce.stride[1 ^ Z2] = 0, this.padField(this._field[Z2], ce);
                    }
                  } else {
                    for (Z2 = 0; Z2 < 2; ++Z2) {
                      var se = [0, 0];
                      se[Z2] = 1, this._field[Z2] = v(this._field[Z2].data, [Q2[0] + 2, Q2[1] + 2], se, 0);
                    }
                    this._field[0].set(0, 0, 0);
                    for (var he = 0; he < Q2[0]; ++he) this._field[0].set(he + 1, 0, he);
                    for (this._field[0].set(Q2[0] + 1, 0, Q2[0] - 1), this._field[1].set(0, 0, 0), he = 0; he < Q2[1]; ++he) this._field[1].set(0, he + 1, he);
                    this._field[1].set(0, Q2[1] + 1, Q2[1] - 1);
                  }
                  var me = this._field, we = v(f.mallocFloat(3 * me[2].size * 2), [3, Q2[0] + 2, Q2[1] + 2, 2]);
                  for (Z2 = 0; Z2 < 3; ++Z2) y(we.pick(Z2), me[Z2], "mirror");
                  var be = v(f.mallocFloat(3 * me[2].size), [Q2[0] + 2, Q2[1] + 2, 3]);
                  for (Z2 = 0; Z2 < Q2[0] + 2; ++Z2) for (he = 0; he < Q2[1] + 2; ++he) {
                    var Ae = we.get(0, Z2, he, 0), pe = we.get(0, Z2, he, 1), ve = we.get(1, Z2, he, 0), Ee = we.get(1, Z2, he, 1), Se = we.get(2, Z2, he, 0), Ce = we.get(2, Z2, he, 1), Be = ve * Ce - Ee * Se, Ue = Se * pe - Ce * Ae, Ke = Ae * Ee - pe * ve, ct = Math.sqrt(Be * Be + Ue * Ue + Ke * Ke);
                    ct < 1e-8 ? (ct = Math.max(Math.abs(Be), Math.abs(Ue), Math.abs(Ke))) < 1e-8 ? (Ke = 1, Ue = Be = 0, ct = 1) : ct = 1 / ct : ct = 1 / Math.sqrt(ct), be.set(Z2, he, 0, Be * ct), be.set(Z2, he, 1, Ue * ct), be.set(Z2, he, 2, Ke * ct);
                  }
                  f.free(we.data);
                  var We = [1 / 0, 1 / 0, 1 / 0], Ze = [-1 / 0, -1 / 0, -1 / 0], it = 1 / 0, ot = -1 / 0, mt = (Q2[0] - 1) * (Q2[1] - 1) * 6, wt = f.mallocFloat(i.nextPow2(10 * mt)), Et = 0, zt = 0;
                  for (Z2 = 0; Z2 < Q2[0] - 1; ++Z2) e: for (he = 0; he < Q2[1] - 1; ++he) {
                    for (var Nt = 0; Nt < 2; ++Nt) for (var yt = 0; yt < 2; ++yt) for (var pt = 0; pt < 3; ++pt) {
                      var Ot = this._field[pt].get(1 + Z2 + Nt, 1 + he + yt);
                      if (isNaN(Ot) || !isFinite(Ot)) continue e;
                    }
                    for (pt = 0; pt < 6; ++pt) {
                      var Jt = Z2 + C2[pt][0], tr = he + C2[pt][1], Ye = this._field[0].get(Jt + 1, tr + 1), at = this._field[1].get(Jt + 1, tr + 1);
                      Ot = this._field[2].get(Jt + 1, tr + 1), Be = be.get(Jt + 1, tr + 1, 0), Ue = be.get(Jt + 1, tr + 1, 1), Ke = be.get(Jt + 1, tr + 1, 2), z.intensity && (Ge = z.intensity.get(Jt, tr));
                      var Ge = z.intensity ? z.intensity.get(Jt, tr) : Ot + this.objectOffset[2];
                      wt[Et++] = Jt, wt[Et++] = tr, wt[Et++] = Ye, wt[Et++] = at, wt[Et++] = Ot, wt[Et++] = 0, wt[Et++] = Ge, wt[Et++] = Be, wt[Et++] = Ue, wt[Et++] = Ke, We[0] = Math.min(We[0], Ye + this.objectOffset[0]), We[1] = Math.min(We[1], at + this.objectOffset[1]), We[2] = Math.min(We[2], Ot + this.objectOffset[2]), it = Math.min(it, Ge), Ze[0] = Math.max(Ze[0], Ye + this.objectOffset[0]), Ze[1] = Math.max(Ze[1], at + this.objectOffset[1]), Ze[2] = Math.max(Ze[2], Ot + this.objectOffset[2]), ot = Math.max(ot, Ge), zt += 1;
                    }
                  }
                  for (z.intensityBounds && (it = +z.intensityBounds[0], ot = +z.intensityBounds[1]), Z2 = 6; Z2 < Et; Z2 += 10) wt[Z2] = (wt[Z2] - it) / (ot - it);
                  this._vertexCount = zt, this._coordinateBuffer.update(wt.subarray(0, Et)), f.freeFloat(wt), f.free(be.data), this.bounds = [We, Ze], this.intensity = z.intensity || this._field[2], this.intensityBounds[0] === it && this.intensityBounds[1] === ot || (te = true), this.intensityBounds = [it, ot];
                }
                if ("levels" in z) {
                  var st = z.levels;
                  for (st = Array.isArray(st[0]) ? st.slice() : [[], [], st], Z2 = 0; Z2 < 3; ++Z2) st[Z2] = st[Z2].slice(), st[Z2].sort(function(Vt, Kt) {
                    return Vt - Kt;
                  });
                  for (Z2 = 0; Z2 < 3; ++Z2) for (he = 0; he < st[Z2].length; ++he) st[Z2][he] -= this.objectOffset[Z2];
                  e: for (Z2 = 0; Z2 < 3; ++Z2) {
                    if (st[Z2].length !== this.contourLevels[Z2].length) {
                      te = true;
                      break;
                    }
                    for (he = 0; he < st[Z2].length; ++he) if (st[Z2][he] !== this.contourLevels[Z2][he]) {
                      te = true;
                      break e;
                    }
                  }
                  this.contourLevels = st;
                }
                if (te) {
                  me = this._field, Q2 = this.shape;
                  for (var Ie = [], Pe = 0; Pe < 3; ++Pe) {
                    var $e = this.contourLevels[Pe], Ve = [], ut = [], Re = [0, 0, 0];
                    for (Z2 = 0; Z2 < $e.length; ++Z2) {
                      var qe = m(this._field[Pe], $e[Z2]);
                      Ve.push(Ie.length / 5 | 0), zt = 0;
                      e: for (he = 0; he < qe.cells.length; ++he) {
                        var je = qe.cells[he];
                        for (pt = 0; pt < 2; ++pt) {
                          var rt = qe.positions[je[pt]], He = rt[0], xe = 0 | Math.floor(He), Ne = He - xe, ke = rt[1], Me = 0 | Math.floor(ke), Le = ke - Me, ze = false;
                          t: for (var ft = 0; ft < 3; ++ft) {
                            Re[ft] = 0;
                            var De = (Pe + ft + 1) % 3;
                            for (Nt = 0; Nt < 2; ++Nt) {
                              var Je = Nt ? Ne : 1 - Ne;
                              for (Jt = 0 | Math.min(Math.max(xe + Nt, 0), Q2[0]), yt = 0; yt < 2; ++yt) {
                                var tt = yt ? Le : 1 - Le;
                                if (tr = 0 | Math.min(Math.max(Me + yt, 0), Q2[1]), Ot = ft < 2 ? this._field[De].get(Jt, tr) : (this.intensity.get(Jt, tr) - this.intensityBounds[0]) / (this.intensityBounds[1] - this.intensityBounds[0]), !isFinite(Ot) || isNaN(Ot)) {
                                  ze = true;
                                  break t;
                                }
                                var vt = Je * tt;
                                Re[ft] += vt * Ot;
                              }
                            }
                          }
                          if (ze) {
                            if (pt > 0) {
                              for (var kt = 0; kt < 5; ++kt) Ie.pop();
                              zt -= 1;
                            }
                            continue e;
                          }
                          Ie.push(Re[0], Re[1], rt[0], rt[1], Re[2]), zt += 1;
                        }
                      }
                      ut.push(zt);
                    }
                    this._contourOffsets[Pe] = Ve, this._contourCounts[Pe] = ut;
                  }
                  var jt = f.mallocFloat(Ie.length);
                  for (Z2 = 0; Z2 < Ie.length; ++Z2) jt[Z2] = Ie[Z2];
                  this._contourBuffer.update(jt), f.freeFloat(jt);
                }
              }, D2.dispose = function() {
                this._shader.dispose(), this._vao.dispose(), this._coordinateBuffer.dispose(), this._colorMap.dispose(), this._contourBuffer.dispose(), this._contourVAO.dispose(), this._contourShader.dispose(), this._contourPickShader.dispose(), this._dynamicBuffer.dispose(), this._dynamicVAO.dispose();
                for (var z = 0; z < 3; ++z) f.freeFloat(this._field[z].data);
              }, D2.highlight = function(z) {
                var H2, te;
                if (!z) return this._dynamicCounts = [0, 0, 0], this.dyanamicLevel = [NaN, NaN, NaN], void (this.highlightLevel = [-1, -1, -1]);
                for (H2 = 0; H2 < 3; ++H2) this.enableHighlight[H2] ? this.highlightLevel[H2] = z.level[H2] : this.highlightLevel[H2] = -1;
                for (te = this.snapToData ? z.dataCoordinate : z.position, H2 = 0; H2 < 3; ++H2) te[H2] -= this.objectOffset[H2];
                if (this.enableDynamic[0] && te[0] !== this.dynamicLevel[0] || this.enableDynamic[1] && te[1] !== this.dynamicLevel[1] || this.enableDynamic[2] && te[2] !== this.dynamicLevel[2]) {
                  for (var j = 0, Q2 = this.shape, Z2 = f.mallocFloat(12 * Q2[0] * Q2[1]), ne = 0; ne < 3; ++ne) if (this.enableDynamic[ne]) {
                    this.dynamicLevel[ne] = te[ne];
                    var ae = (ne + 1) % 3, ue = (ne + 2) % 3, le = this._field[ne], ce = this._field[ae], se = this._field[ue], he = m(le, te[ne]), me = he.cells, we = he.positions;
                    for (this._dynamicOffsets[ne] = j, H2 = 0; H2 < me.length; ++H2) for (var be = me[H2], Ae = 0; Ae < 2; ++Ae) {
                      var pe = we[be[Ae]], ve = +pe[0], Ee = 0 | ve, Se = 0 | Math.min(Ee + 1, Q2[0]), Ce = ve - Ee, Be = 1 - Ce, Ue = +pe[1], Ke = 0 | Ue, ct = 0 | Math.min(Ke + 1, Q2[1]), We = Ue - Ke, Ze = 1 - We, it = Be * Ze, ot = Be * We, mt = Ce * Ze, wt = Ce * We, Et = it * ce.get(Ee, Ke) + ot * ce.get(Ee, ct) + mt * ce.get(Se, Ke) + wt * ce.get(Se, ct), zt = it * se.get(Ee, Ke) + ot * se.get(Ee, ct) + mt * se.get(Se, Ke) + wt * se.get(Se, ct);
                      if (isNaN(Et) || isNaN(zt)) {
                        Ae && (j -= 1);
                        break;
                      }
                      Z2[2 * j + 0] = Et, Z2[2 * j + 1] = zt, j += 1;
                    }
                    this._dynamicCounts[ne] = j - this._dynamicOffsets[ne];
                  } else this.dynamicLevel[ne] = NaN, this._dynamicCounts[ne] = 0;
                  this._dynamicBuffer.update(Z2.subarray(0, 2 * j)), f.freeFloat(Z2);
                }
              };
            }, { "./lib/shaders": 144, "binary-search-bounds": 31, "bit-twiddle": 32, colormap: 53, "gl-buffer": 78, "gl-mat4/invert": 98, "gl-mat4/multiply": 100, "gl-texture2d": 146, "gl-vao": 150, ndarray: 259, "ndarray-gradient": 252, "ndarray-ops": 254, "ndarray-pack": 255, "surface-nets": 302, "typedarray-pool": 308 }], 146: [function(a, o, s) {
              "use strict";
              var i = a("ndarray"), l = a("ndarray-ops"), u2 = a("typedarray-pool");
              o.exports = function(T2) {
                if (arguments.length <= 1) throw new Error("gl-texture2d: Missing arguments for texture2d constructor");
                if (c || p(T2), typeof arguments[1] == "number") return w(T2, arguments[1], arguments[2], arguments[3] || T2.RGBA, arguments[4] || T2.UNSIGNED_BYTE);
                if (Array.isArray(arguments[1])) return w(T2, 0 | arguments[1][0], 0 | arguments[1][1], arguments[2] || T2.RGBA, arguments[3] || T2.UNSIGNED_BYTE);
                if (typeof arguments[1] == "object") {
                  var A2 = arguments[1], S2 = d(A2) ? A2 : A2.raw;
                  if (S2) return _4(T2, S2, 0 | A2.width, 0 | A2.height, arguments[2] || T2.RGBA, arguments[3] || T2.UNSIGNED_BYTE);
                  if (A2.shape && A2.data && A2.stride) return k(T2, A2);
                }
                throw new Error("gl-texture2d: Invalid arguments for texture2d constructor");
              };
              var c = null, f = null, h = null;
              function p(T2) {
                c = [T2.LINEAR, T2.NEAREST_MIPMAP_LINEAR, T2.LINEAR_MIPMAP_NEAREST, T2.LINEAR_MIPMAP_NEAREST], f = [T2.NEAREST, T2.LINEAR, T2.NEAREST_MIPMAP_NEAREST, T2.NEAREST_MIPMAP_LINEAR, T2.LINEAR_MIPMAP_NEAREST, T2.LINEAR_MIPMAP_LINEAR], h = [T2.REPEAT, T2.CLAMP_TO_EDGE, T2.MIRRORED_REPEAT];
              }
              function d(T2) {
                return typeof HTMLCanvasElement < "u" && T2 instanceof HTMLCanvasElement || typeof HTMLImageElement < "u" && T2 instanceof HTMLImageElement || typeof HTMLVideoElement < "u" && T2 instanceof HTMLVideoElement || typeof ImageData < "u" && T2 instanceof ImageData;
              }
              var v = function(T2, A2) {
                l.muls(T2, A2, 255);
              };
              function m(T2, A2, S2) {
                var C2 = T2.gl, E2 = C2.getParameter(C2.MAX_TEXTURE_SIZE);
                if (A2 < 0 || A2 > E2 || S2 < 0 || S2 > E2) throw new Error("gl-texture2d: Invalid texture size");
                return T2._shape = [A2, S2], T2.bind(), C2.texImage2D(C2.TEXTURE_2D, 0, T2.format, A2, S2, 0, T2.format, T2.type, null), T2._mipLevels = [0], T2;
              }
              function g(T2, A2, S2, C2, E2, F13) {
                this.gl = T2, this.handle = A2, this.format = E2, this.type = F13, this._shape = [S2, C2], this._mipLevels = [0], this._magFilter = T2.NEAREST, this._minFilter = T2.NEAREST, this._wrapS = T2.CLAMP_TO_EDGE, this._wrapT = T2.CLAMP_TO_EDGE, this._anisoSamples = 1;
                var N2 = this, D2 = [this._wrapS, this._wrapT];
                Object.defineProperties(D2, [{ get: function() {
                  return N2._wrapS;
                }, set: function(O2) {
                  return N2.wrapS = O2;
                } }, { get: function() {
                  return N2._wrapT;
                }, set: function(O2) {
                  return N2.wrapT = O2;
                } }]), this._wrapVector = D2;
                var I2 = [this._shape[0], this._shape[1]];
                Object.defineProperties(I2, [{ get: function() {
                  return N2._shape[0];
                }, set: function(O2) {
                  return N2.width = O2;
                } }, { get: function() {
                  return N2._shape[1];
                }, set: function(O2) {
                  return N2.height = O2;
                } }]), this._shapeVector = I2;
              }
              var x = g.prototype;
              function b(T2, A2) {
                return T2.length === 3 ? A2[2] === 1 && A2[1] === T2[0] * T2[2] && A2[0] === T2[2] : A2[0] === 1 && A2[1] === T2[0];
              }
              function y(T2) {
                var A2 = T2.createTexture();
                return T2.bindTexture(T2.TEXTURE_2D, A2), T2.texParameteri(T2.TEXTURE_2D, T2.TEXTURE_MIN_FILTER, T2.NEAREST), T2.texParameteri(T2.TEXTURE_2D, T2.TEXTURE_MAG_FILTER, T2.NEAREST), T2.texParameteri(T2.TEXTURE_2D, T2.TEXTURE_WRAP_S, T2.CLAMP_TO_EDGE), T2.texParameteri(T2.TEXTURE_2D, T2.TEXTURE_WRAP_T, T2.CLAMP_TO_EDGE), A2;
              }
              function w(T2, A2, S2, C2, E2) {
                var F13 = T2.getParameter(T2.MAX_TEXTURE_SIZE);
                if (A2 < 0 || A2 > F13 || S2 < 0 || S2 > F13) throw new Error("gl-texture2d: Invalid texture shape");
                if (E2 === T2.FLOAT && !T2.getExtension("OES_texture_float")) throw new Error("gl-texture2d: Floating point textures not supported on this platform");
                var N2 = y(T2);
                return T2.texImage2D(T2.TEXTURE_2D, 0, C2, A2, S2, 0, C2, E2, null), new g(T2, N2, A2, S2, C2, E2);
              }
              function _4(T2, A2, S2, C2, E2, F13) {
                var N2 = y(T2);
                return T2.texImage2D(T2.TEXTURE_2D, 0, E2, E2, F13, A2), new g(T2, N2, S2, C2, E2, F13);
              }
              function k(T2, A2) {
                var S2 = A2.dtype, C2 = A2.shape.slice(), E2 = T2.getParameter(T2.MAX_TEXTURE_SIZE);
                if (C2[0] < 0 || C2[0] > E2 || C2[1] < 0 || C2[1] > E2) throw new Error("gl-texture2d: Invalid texture size");
                var F13 = b(C2, A2.stride.slice()), N2 = 0;
                S2 === "float32" ? N2 = T2.FLOAT : S2 === "float64" ? (N2 = T2.FLOAT, F13 = false, S2 = "float32") : S2 === "uint8" ? N2 = T2.UNSIGNED_BYTE : (N2 = T2.UNSIGNED_BYTE, F13 = false, S2 = "uint8");
                var D2, I2, O2 = 0;
                if (C2.length === 2) O2 = T2.LUMINANCE, C2 = [C2[0], C2[1], 1], A2 = i(A2.data, C2, [A2.stride[0], A2.stride[1], 1], A2.offset);
                else {
                  if (C2.length !== 3) throw new Error("gl-texture2d: Invalid shape for texture");
                  if (C2[2] === 1) O2 = T2.ALPHA;
                  else if (C2[2] === 2) O2 = T2.LUMINANCE_ALPHA;
                  else if (C2[2] === 3) O2 = T2.RGB;
                  else {
                    if (C2[2] !== 4) throw new Error("gl-texture2d: Invalid shape for pixel coords");
                    O2 = T2.RGBA;
                  }
                }
                N2 !== T2.FLOAT || T2.getExtension("OES_texture_float") || (N2 = T2.UNSIGNED_BYTE, F13 = false);
                var L2 = A2.size;
                if (F13) D2 = A2.offset === 0 && A2.data.length === L2 ? A2.data : A2.data.subarray(A2.offset, A2.offset + L2);
                else {
                  var V2 = [C2[2], C2[2] * C2[0], 1];
                  I2 = u2.malloc(L2, S2);
                  var W2 = i(I2, C2, V2, 0);
                  S2 !== "float32" && S2 !== "float64" || N2 !== T2.UNSIGNED_BYTE ? l.assign(W2, A2) : v(W2, A2), D2 = I2.subarray(0, L2);
                }
                var X2 = y(T2);
                return T2.texImage2D(T2.TEXTURE_2D, 0, O2, C2[0], C2[1], 0, O2, N2, D2), F13 || u2.free(I2), new g(T2, X2, C2[0], C2[1], O2, N2);
              }
              Object.defineProperties(x, { minFilter: { get: function() {
                return this._minFilter;
              }, set: function(T2) {
                this.bind();
                var A2 = this.gl;
                if (this.type === A2.FLOAT && c.indexOf(T2) >= 0 && (A2.getExtension("OES_texture_float_linear") || (T2 = A2.NEAREST)), f.indexOf(T2) < 0) throw new Error("gl-texture2d: Unknown filter mode " + T2);
                return A2.texParameteri(A2.TEXTURE_2D, A2.TEXTURE_MIN_FILTER, T2), this._minFilter = T2;
              } }, magFilter: { get: function() {
                return this._magFilter;
              }, set: function(T2) {
                this.bind();
                var A2 = this.gl;
                if (this.type === A2.FLOAT && c.indexOf(T2) >= 0 && (A2.getExtension("OES_texture_float_linear") || (T2 = A2.NEAREST)), f.indexOf(T2) < 0) throw new Error("gl-texture2d: Unknown filter mode " + T2);
                return A2.texParameteri(A2.TEXTURE_2D, A2.TEXTURE_MAG_FILTER, T2), this._magFilter = T2;
              } }, mipSamples: { get: function() {
                return this._anisoSamples;
              }, set: function(T2) {
                var A2 = this._anisoSamples;
                if (this._anisoSamples = 0 | Math.max(T2, 1), A2 !== this._anisoSamples) {
                  var S2 = this.gl.getExtension("EXT_texture_filter_anisotropic");
                  S2 && this.gl.texParameterf(this.gl.TEXTURE_2D, S2.TEXTURE_MAX_ANISOTROPY_EXT, this._anisoSamples);
                }
                return this._anisoSamples;
              } }, wrapS: { get: function() {
                return this._wrapS;
              }, set: function(T2) {
                if (this.bind(), h.indexOf(T2) < 0) throw new Error("gl-texture2d: Unknown wrap mode " + T2);
                return this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_S, T2), this._wrapS = T2;
              } }, wrapT: { get: function() {
                return this._wrapT;
              }, set: function(T2) {
                if (this.bind(), h.indexOf(T2) < 0) throw new Error("gl-texture2d: Unknown wrap mode " + T2);
                return this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_T, T2), this._wrapT = T2;
              } }, wrap: { get: function() {
                return this._wrapVector;
              }, set: function(T2) {
                if (Array.isArray(T2) || (T2 = [T2, T2]), T2.length !== 2) throw new Error("gl-texture2d: Must specify wrap mode for rows and columns");
                for (var A2 = 0; A2 < 2; ++A2) if (h.indexOf(T2[A2]) < 0) throw new Error("gl-texture2d: Unknown wrap mode " + T2);
                this._wrapS = T2[0], this._wrapT = T2[1];
                var S2 = this.gl;
                return this.bind(), S2.texParameteri(S2.TEXTURE_2D, S2.TEXTURE_WRAP_S, this._wrapS), S2.texParameteri(S2.TEXTURE_2D, S2.TEXTURE_WRAP_T, this._wrapT), T2;
              } }, shape: { get: function() {
                return this._shapeVector;
              }, set: function(T2) {
                if (Array.isArray(T2)) {
                  if (T2.length !== 2) throw new Error("gl-texture2d: Invalid texture shape");
                } else T2 = [0 | T2, 0 | T2];
                return m(this, 0 | T2[0], 0 | T2[1]), [0 | T2[0], 0 | T2[1]];
              } }, width: { get: function() {
                return this._shape[0];
              }, set: function(T2) {
                return m(this, T2 |= 0, this._shape[1]), T2;
              } }, height: { get: function() {
                return this._shape[1];
              }, set: function(T2) {
                return T2 |= 0, m(this, this._shape[0], T2), T2;
              } } }), x.bind = function(T2) {
                var A2 = this.gl;
                return T2 !== void 0 && A2.activeTexture(A2.TEXTURE0 + (0 | T2)), A2.bindTexture(A2.TEXTURE_2D, this.handle), T2 !== void 0 ? 0 | T2 : A2.getParameter(A2.ACTIVE_TEXTURE) - A2.TEXTURE0;
              }, x.dispose = function() {
                this.gl.deleteTexture(this.handle);
              }, x.generateMipmap = function() {
                this.bind(), this.gl.generateMipmap(this.gl.TEXTURE_2D);
                for (var T2 = Math.min(this._shape[0], this._shape[1]), A2 = 0; T2 > 0; ++A2, T2 >>>= 1) this._mipLevels.indexOf(A2) < 0 && this._mipLevels.push(A2);
              }, x.setPixels = function(T2, A2, S2, C2) {
                var E2 = this.gl;
                this.bind(), Array.isArray(A2) ? (C2 = S2, S2 = 0 | A2[1], A2 = 0 | A2[0]) : (A2 = A2 || 0, S2 = S2 || 0), C2 = C2 || 0;
                var F13 = d(T2) ? T2 : T2.raw;
                if (F13) this._mipLevels.indexOf(C2) < 0 ? (E2.texImage2D(E2.TEXTURE_2D, 0, this.format, this.format, this.type, F13), this._mipLevels.push(C2)) : E2.texSubImage2D(E2.TEXTURE_2D, C2, A2, S2, this.format, this.type, F13);
                else {
                  if (!(T2.shape && T2.stride && T2.data)) throw new Error("gl-texture2d: Unsupported data type");
                  if (T2.shape.length < 2 || A2 + T2.shape[1] > this._shape[1] >>> C2 || S2 + T2.shape[0] > this._shape[0] >>> C2 || A2 < 0 || S2 < 0) throw new Error("gl-texture2d: Texture dimensions are out of bounds");
                  (function(N2, D2, I2, O2, L2, V2, W2, X2) {
                    var Y2 = X2.dtype, K2 = X2.shape.slice();
                    if (K2.length < 2 || K2.length > 3) throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");
                    var q = 0, re = 0, R2 = b(K2, X2.stride.slice());
                    if (Y2 === "float32" ? q = N2.FLOAT : Y2 === "float64" ? (q = N2.FLOAT, R2 = false, Y2 = "float32") : Y2 === "uint8" ? q = N2.UNSIGNED_BYTE : (q = N2.UNSIGNED_BYTE, R2 = false, Y2 = "uint8"), K2.length === 2) re = N2.LUMINANCE, K2 = [K2[0], K2[1], 1], X2 = i(X2.data, K2, [X2.stride[0], X2.stride[1], 1], X2.offset);
                    else {
                      if (K2.length !== 3) throw new Error("gl-texture2d: Invalid shape for texture");
                      if (K2[2] === 1) re = N2.ALPHA;
                      else if (K2[2] === 2) re = N2.LUMINANCE_ALPHA;
                      else if (K2[2] === 3) re = N2.RGB;
                      else {
                        if (K2[2] !== 4) throw new Error("gl-texture2d: Invalid shape for pixel coords");
                        re = N2.RGBA;
                      }
                      K2[2];
                    }
                    if (re !== N2.LUMINANCE && re !== N2.ALPHA || L2 !== N2.LUMINANCE && L2 !== N2.ALPHA || (re = L2), re !== L2) throw new Error("gl-texture2d: Incompatible texture format for setPixels");
                    var z = X2.size, H2 = W2.indexOf(O2) < 0;
                    if (H2 && W2.push(O2), q === V2 && R2) X2.offset === 0 && X2.data.length === z ? H2 ? N2.texImage2D(N2.TEXTURE_2D, O2, L2, K2[0], K2[1], 0, L2, V2, X2.data) : N2.texSubImage2D(N2.TEXTURE_2D, O2, D2, I2, K2[0], K2[1], L2, V2, X2.data) : H2 ? N2.texImage2D(N2.TEXTURE_2D, O2, L2, K2[0], K2[1], 0, L2, V2, X2.data.subarray(X2.offset, X2.offset + z)) : N2.texSubImage2D(N2.TEXTURE_2D, O2, D2, I2, K2[0], K2[1], L2, V2, X2.data.subarray(X2.offset, X2.offset + z));
                    else {
                      var te;
                      te = V2 === N2.FLOAT ? u2.mallocFloat32(z) : u2.mallocUint8(z);
                      var j = i(te, K2, [K2[2], K2[2] * K2[0], 1]);
                      q === N2.FLOAT && V2 === N2.UNSIGNED_BYTE ? v(j, X2) : l.assign(j, X2), H2 ? N2.texImage2D(N2.TEXTURE_2D, O2, L2, K2[0], K2[1], 0, L2, V2, te.subarray(0, z)) : N2.texSubImage2D(N2.TEXTURE_2D, O2, D2, I2, K2[0], K2[1], L2, V2, te.subarray(0, z)), V2 === N2.FLOAT ? u2.freeFloat32(te) : u2.freeUint8(te);
                    }
                  })(E2, A2, S2, C2, this.format, this.type, this._mipLevels, T2);
                }
              };
            }, { ndarray: 259, "ndarray-ops": 254, "typedarray-pool": 308 }], 147: [function(a, o, s) {
              "use strict";
              o.exports = function(i, l, u2) {
                l ? l.bind() : i.bindBuffer(i.ELEMENT_ARRAY_BUFFER, null);
                var c = 0 | i.getParameter(i.MAX_VERTEX_ATTRIBS);
                if (u2) {
                  if (u2.length > c) throw new Error("gl-vao: Too many vertex attributes");
                  for (var f = 0; f < u2.length; ++f) {
                    var h = u2[f];
                    if (h.buffer) {
                      var p = h.buffer, d = h.size || 4, v = h.type || i.FLOAT, m = !!h.normalized, g = h.stride || 0, x = h.offset || 0;
                      p.bind(), i.enableVertexAttribArray(f), i.vertexAttribPointer(f, d, v, m, g, x);
                    } else {
                      if (typeof h == "number") i.vertexAttrib1f(f, h);
                      else if (h.length === 1) i.vertexAttrib1f(f, h[0]);
                      else if (h.length === 2) i.vertexAttrib2f(f, h[0], h[1]);
                      else if (h.length === 3) i.vertexAttrib3f(f, h[0], h[1], h[2]);
                      else {
                        if (h.length !== 4) throw new Error("gl-vao: Invalid vertex attribute");
                        i.vertexAttrib4f(f, h[0], h[1], h[2], h[3]);
                      }
                      i.disableVertexAttribArray(f);
                    }
                  }
                  for (; f < c; ++f) i.disableVertexAttribArray(f);
                } else for (i.bindBuffer(i.ARRAY_BUFFER, null), f = 0; f < c; ++f) i.disableVertexAttribArray(f);
              };
            }, {}], 148: [function(a, o, s) {
              "use strict";
              var i = a("./do-bind.js");
              function l(u2) {
                this.gl = u2, this._elements = null, this._attributes = null, this._elementsType = u2.UNSIGNED_SHORT;
              }
              l.prototype.bind = function() {
                i(this.gl, this._elements, this._attributes);
              }, l.prototype.update = function(u2, c, f) {
                this._elements = c, this._attributes = u2, this._elementsType = f || this.gl.UNSIGNED_SHORT;
              }, l.prototype.dispose = function() {
              }, l.prototype.unbind = function() {
              }, l.prototype.draw = function(u2, c, f) {
                f = f || 0;
                var h = this.gl;
                this._elements ? h.drawElements(u2, c, this._elementsType, f) : h.drawArrays(u2, f, c);
              }, o.exports = function(u2) {
                return new l(u2);
              };
            }, { "./do-bind.js": 147 }], 149: [function(a, o, s) {
              "use strict";
              var i = a("./do-bind.js");
              function l(c, f, h, p, d, v) {
                this.location = c, this.dimension = f, this.a = h, this.b = p, this.c = d, this.d = v;
              }
              function u2(c, f, h) {
                this.gl = c, this._ext = f, this.handle = h, this._attribs = [], this._useElements = false, this._elementsType = c.UNSIGNED_SHORT;
              }
              l.prototype.bind = function(c) {
                switch (this.dimension) {
                  case 1:
                    c.vertexAttrib1f(this.location, this.a);
                    break;
                  case 2:
                    c.vertexAttrib2f(this.location, this.a, this.b);
                    break;
                  case 3:
                    c.vertexAttrib3f(this.location, this.a, this.b, this.c);
                    break;
                  case 4:
                    c.vertexAttrib4f(this.location, this.a, this.b, this.c, this.d);
                }
              }, u2.prototype.bind = function() {
                this._ext.bindVertexArrayOES(this.handle);
                for (var c = 0; c < this._attribs.length; ++c) this._attribs[c].bind(this.gl);
              }, u2.prototype.unbind = function() {
                this._ext.bindVertexArrayOES(null);
              }, u2.prototype.dispose = function() {
                this._ext.deleteVertexArrayOES(this.handle);
              }, u2.prototype.update = function(c, f, h) {
                if (this.bind(), i(this.gl, f, c), this.unbind(), this._attribs.length = 0, c) for (var p = 0; p < c.length; ++p) {
                  var d = c[p];
                  typeof d == "number" ? this._attribs.push(new l(p, 1, d)) : Array.isArray(d) && this._attribs.push(new l(p, d.length, d[0], d[1], d[2], d[3]));
                }
                this._useElements = !!f, this._elementsType = h || this.gl.UNSIGNED_SHORT;
              }, u2.prototype.draw = function(c, f, h) {
                h = h || 0;
                var p = this.gl;
                this._useElements ? p.drawElements(c, f, this._elementsType, h) : p.drawArrays(c, h, f);
              }, o.exports = function(c, f) {
                return new u2(c, f, f.createVertexArrayOES());
              };
            }, { "./do-bind.js": 147 }], 150: [function(a, o, s) {
              "use strict";
              var i = a("./lib/vao-native.js"), l = a("./lib/vao-emulated.js");
              function u2(c) {
                this.bindVertexArrayOES = c.bindVertexArray.bind(c), this.createVertexArrayOES = c.createVertexArray.bind(c), this.deleteVertexArrayOES = c.deleteVertexArray.bind(c);
              }
              o.exports = function(c, f, h, p) {
                var d, v = c.createVertexArray ? new u2(c) : c.getExtension("OES_vertex_array_object");
                return (d = v ? i(c, v) : l(c)).update(f, h, p), d;
              };
            }, { "./lib/vao-emulated.js": 148, "./lib/vao-native.js": 149 }], 151: [function(a, o, s) {
              o.exports = function(i, l, u2) {
                return i[0] = l[0] + u2[0], i[1] = l[1] + u2[1], i[2] = l[2] + u2[2], i;
              };
            }, {}], 152: [function(a, o, s) {
              o.exports = function(c, f) {
                var h = i(c[0], c[1], c[2]), p = i(f[0], f[1], f[2]);
                l(h, h), l(p, p);
                var d = u2(h, p);
                return d > 1 ? 0 : Math.acos(d);
              };
              var i = a("./fromValues"), l = a("./normalize"), u2 = a("./dot");
            }, { "./dot": 162, "./fromValues": 168, "./normalize": 179 }], 153: [function(a, o, s) {
              o.exports = function(i, l) {
                return i[0] = Math.ceil(l[0]), i[1] = Math.ceil(l[1]), i[2] = Math.ceil(l[2]), i;
              };
            }, {}], 154: [function(a, o, s) {
              o.exports = function(i) {
                var l = new Float32Array(3);
                return l[0] = i[0], l[1] = i[1], l[2] = i[2], l;
              };
            }, {}], 155: [function(a, o, s) {
              o.exports = function(i, l) {
                return i[0] = l[0], i[1] = l[1], i[2] = l[2], i;
              };
            }, {}], 156: [function(a, o, s) {
              o.exports = function() {
                var i = new Float32Array(3);
                return i[0] = 0, i[1] = 0, i[2] = 0, i;
              };
            }, {}], 157: [function(a, o, s) {
              o.exports = function(i, l, u2) {
                var c = l[0], f = l[1], h = l[2], p = u2[0], d = u2[1], v = u2[2];
                return i[0] = f * v - h * d, i[1] = h * p - c * v, i[2] = c * d - f * p, i;
              };
            }, {}], 158: [function(a, o, s) {
              o.exports = a("./distance");
            }, { "./distance": 159 }], 159: [function(a, o, s) {
              o.exports = function(i, l) {
                var u2 = l[0] - i[0], c = l[1] - i[1], f = l[2] - i[2];
                return Math.sqrt(u2 * u2 + c * c + f * f);
              };
            }, {}], 160: [function(a, o, s) {
              o.exports = a("./divide");
            }, { "./divide": 161 }], 161: [function(a, o, s) {
              o.exports = function(i, l, u2) {
                return i[0] = l[0] / u2[0], i[1] = l[1] / u2[1], i[2] = l[2] / u2[2], i;
              };
            }, {}], 162: [function(a, o, s) {
              o.exports = function(i, l) {
                return i[0] * l[0] + i[1] * l[1] + i[2] * l[2];
              };
            }, {}], 163: [function(a, o, s) {
              o.exports = 1e-6;
            }, {}], 164: [function(a, o, s) {
              o.exports = function(l, u2) {
                var c = l[0], f = l[1], h = l[2], p = u2[0], d = u2[1], v = u2[2];
                return Math.abs(c - p) <= i * Math.max(1, Math.abs(c), Math.abs(p)) && Math.abs(f - d) <= i * Math.max(1, Math.abs(f), Math.abs(d)) && Math.abs(h - v) <= i * Math.max(1, Math.abs(h), Math.abs(v));
              };
              var i = a("./epsilon");
            }, { "./epsilon": 163 }], 165: [function(a, o, s) {
              o.exports = function(i, l) {
                return i[0] === l[0] && i[1] === l[1] && i[2] === l[2];
              };
            }, {}], 166: [function(a, o, s) {
              o.exports = function(i, l) {
                return i[0] = Math.floor(l[0]), i[1] = Math.floor(l[1]), i[2] = Math.floor(l[2]), i;
              };
            }, {}], 167: [function(a, o, s) {
              o.exports = function(l, u2, c, f, h, p) {
                var d, v;
                for (u2 || (u2 = 3), c || (c = 0), v = f ? Math.min(f * u2 + c, l.length) : l.length, d = c; d < v; d += u2) i[0] = l[d], i[1] = l[d + 1], i[2] = l[d + 2], h(i, i, p), l[d] = i[0], l[d + 1] = i[1], l[d + 2] = i[2];
                return l;
              };
              var i = a("./create")();
            }, { "./create": 156 }], 168: [function(a, o, s) {
              o.exports = function(i, l, u2) {
                var c = new Float32Array(3);
                return c[0] = i, c[1] = l, c[2] = u2, c;
              };
            }, {}], 169: [function(a, o, s) {
              o.exports = { EPSILON: a("./epsilon"), create: a("./create"), clone: a("./clone"), angle: a("./angle"), fromValues: a("./fromValues"), copy: a("./copy"), set: a("./set"), equals: a("./equals"), exactEquals: a("./exactEquals"), add: a("./add"), subtract: a("./subtract"), sub: a("./sub"), multiply: a("./multiply"), mul: a("./mul"), divide: a("./divide"), div: a("./div"), min: a("./min"), max: a("./max"), floor: a("./floor"), ceil: a("./ceil"), round: a("./round"), scale: a("./scale"), scaleAndAdd: a("./scaleAndAdd"), distance: a("./distance"), dist: a("./dist"), squaredDistance: a("./squaredDistance"), sqrDist: a("./sqrDist"), length: a("./length"), len: a("./len"), squaredLength: a("./squaredLength"), sqrLen: a("./sqrLen"), negate: a("./negate"), inverse: a("./inverse"), normalize: a("./normalize"), dot: a("./dot"), cross: a("./cross"), lerp: a("./lerp"), random: a("./random"), transformMat4: a("./transformMat4"), transformMat3: a("./transformMat3"), transformQuat: a("./transformQuat"), rotateX: a("./rotateX"), rotateY: a("./rotateY"), rotateZ: a("./rotateZ"), forEach: a("./forEach") };
            }, { "./add": 151, "./angle": 152, "./ceil": 153, "./clone": 154, "./copy": 155, "./create": 156, "./cross": 157, "./dist": 158, "./distance": 159, "./div": 160, "./divide": 161, "./dot": 162, "./epsilon": 163, "./equals": 164, "./exactEquals": 165, "./floor": 166, "./forEach": 167, "./fromValues": 168, "./inverse": 170, "./len": 171, "./length": 172, "./lerp": 173, "./max": 174, "./min": 175, "./mul": 176, "./multiply": 177, "./negate": 178, "./normalize": 179, "./random": 180, "./rotateX": 181, "./rotateY": 182, "./rotateZ": 183, "./round": 184, "./scale": 185, "./scaleAndAdd": 186, "./set": 187, "./sqrDist": 188, "./sqrLen": 189, "./squaredDistance": 190, "./squaredLength": 191, "./sub": 192, "./subtract": 193, "./transformMat3": 194, "./transformMat4": 195, "./transformQuat": 196 }], 170: [function(a, o, s) {
              o.exports = function(i, l) {
                return i[0] = 1 / l[0], i[1] = 1 / l[1], i[2] = 1 / l[2], i;
              };
            }, {}], 171: [function(a, o, s) {
              o.exports = a("./length");
            }, { "./length": 172 }], 172: [function(a, o, s) {
              o.exports = function(i) {
                var l = i[0], u2 = i[1], c = i[2];
                return Math.sqrt(l * l + u2 * u2 + c * c);
              };
            }, {}], 173: [function(a, o, s) {
              o.exports = function(i, l, u2, c) {
                var f = l[0], h = l[1], p = l[2];
                return i[0] = f + c * (u2[0] - f), i[1] = h + c * (u2[1] - h), i[2] = p + c * (u2[2] - p), i;
              };
            }, {}], 174: [function(a, o, s) {
              o.exports = function(i, l, u2) {
                return i[0] = Math.max(l[0], u2[0]), i[1] = Math.max(l[1], u2[1]), i[2] = Math.max(l[2], u2[2]), i;
              };
            }, {}], 175: [function(a, o, s) {
              o.exports = function(i, l, u2) {
                return i[0] = Math.min(l[0], u2[0]), i[1] = Math.min(l[1], u2[1]), i[2] = Math.min(l[2], u2[2]), i;
              };
            }, {}], 176: [function(a, o, s) {
              o.exports = a("./multiply");
            }, { "./multiply": 177 }], 177: [function(a, o, s) {
              o.exports = function(i, l, u2) {
                return i[0] = l[0] * u2[0], i[1] = l[1] * u2[1], i[2] = l[2] * u2[2], i;
              };
            }, {}], 178: [function(a, o, s) {
              o.exports = function(i, l) {
                return i[0] = -l[0], i[1] = -l[1], i[2] = -l[2], i;
              };
            }, {}], 179: [function(a, o, s) {
              o.exports = function(i, l) {
                var u2 = l[0], c = l[1], f = l[2], h = u2 * u2 + c * c + f * f;
                return h > 0 && (h = 1 / Math.sqrt(h), i[0] = l[0] * h, i[1] = l[1] * h, i[2] = l[2] * h), i;
              };
            }, {}], 180: [function(a, o, s) {
              o.exports = function(i, l) {
                l = l || 1;
                var u2 = 2 * Math.random() * Math.PI, c = 2 * Math.random() - 1, f = Math.sqrt(1 - c * c) * l;
                return i[0] = Math.cos(u2) * f, i[1] = Math.sin(u2) * f, i[2] = c * l, i;
              };
            }, {}], 181: [function(a, o, s) {
              o.exports = function(i, l, u2, c) {
                var f = u2[1], h = u2[2], p = l[1] - f, d = l[2] - h, v = Math.sin(c), m = Math.cos(c);
                return i[0] = l[0], i[1] = f + p * m - d * v, i[2] = h + p * v + d * m, i;
              };
            }, {}], 182: [function(a, o, s) {
              o.exports = function(i, l, u2, c) {
                var f = u2[0], h = u2[2], p = l[0] - f, d = l[2] - h, v = Math.sin(c), m = Math.cos(c);
                return i[0] = f + d * v + p * m, i[1] = l[1], i[2] = h + d * m - p * v, i;
              };
            }, {}], 183: [function(a, o, s) {
              o.exports = function(i, l, u2, c) {
                var f = u2[0], h = u2[1], p = l[0] - f, d = l[1] - h, v = Math.sin(c), m = Math.cos(c);
                return i[0] = f + p * m - d * v, i[1] = h + p * v + d * m, i[2] = l[2], i;
              };
            }, {}], 184: [function(a, o, s) {
              o.exports = function(i, l) {
                return i[0] = Math.round(l[0]), i[1] = Math.round(l[1]), i[2] = Math.round(l[2]), i;
              };
            }, {}], 185: [function(a, o, s) {
              o.exports = function(i, l, u2) {
                return i[0] = l[0] * u2, i[1] = l[1] * u2, i[2] = l[2] * u2, i;
              };
            }, {}], 186: [function(a, o, s) {
              o.exports = function(i, l, u2, c) {
                return i[0] = l[0] + u2[0] * c, i[1] = l[1] + u2[1] * c, i[2] = l[2] + u2[2] * c, i;
              };
            }, {}], 187: [function(a, o, s) {
              o.exports = function(i, l, u2, c) {
                return i[0] = l, i[1] = u2, i[2] = c, i;
              };
            }, {}], 188: [function(a, o, s) {
              o.exports = a("./squaredDistance");
            }, { "./squaredDistance": 190 }], 189: [function(a, o, s) {
              o.exports = a("./squaredLength");
            }, { "./squaredLength": 191 }], 190: [function(a, o, s) {
              o.exports = function(i, l) {
                var u2 = l[0] - i[0], c = l[1] - i[1], f = l[2] - i[2];
                return u2 * u2 + c * c + f * f;
              };
            }, {}], 191: [function(a, o, s) {
              o.exports = function(i) {
                var l = i[0], u2 = i[1], c = i[2];
                return l * l + u2 * u2 + c * c;
              };
            }, {}], 192: [function(a, o, s) {
              o.exports = a("./subtract");
            }, { "./subtract": 193 }], 193: [function(a, o, s) {
              o.exports = function(i, l, u2) {
                return i[0] = l[0] - u2[0], i[1] = l[1] - u2[1], i[2] = l[2] - u2[2], i;
              };
            }, {}], 194: [function(a, o, s) {
              o.exports = function(i, l, u2) {
                var c = l[0], f = l[1], h = l[2];
                return i[0] = c * u2[0] + f * u2[3] + h * u2[6], i[1] = c * u2[1] + f * u2[4] + h * u2[7], i[2] = c * u2[2] + f * u2[5] + h * u2[8], i;
              };
            }, {}], 195: [function(a, o, s) {
              o.exports = function(i, l, u2) {
                var c = l[0], f = l[1], h = l[2], p = u2[3] * c + u2[7] * f + u2[11] * h + u2[15];
                return p = p || 1, i[0] = (u2[0] * c + u2[4] * f + u2[8] * h + u2[12]) / p, i[1] = (u2[1] * c + u2[5] * f + u2[9] * h + u2[13]) / p, i[2] = (u2[2] * c + u2[6] * f + u2[10] * h + u2[14]) / p, i;
              };
            }, {}], 196: [function(a, o, s) {
              o.exports = function(i, l, u2) {
                var c = l[0], f = l[1], h = l[2], p = u2[0], d = u2[1], v = u2[2], m = u2[3], g = m * c + d * h - v * f, x = m * f + v * c - p * h, b = m * h + p * f - d * c, y = -p * c - d * f - v * h;
                return i[0] = g * m + y * -p + x * -v - b * -d, i[1] = x * m + y * -d + b * -p - g * -v, i[2] = b * m + y * -v + g * -d - x * -p, i;
              };
            }, {}], 197: [function(a, o, s) {
              o.exports = function(i, l, u2) {
                return i[0] = l[0] + u2[0], i[1] = l[1] + u2[1], i[2] = l[2] + u2[2], i[3] = l[3] + u2[3], i;
              };
            }, {}], 198: [function(a, o, s) {
              o.exports = function(i) {
                var l = new Float32Array(4);
                return l[0] = i[0], l[1] = i[1], l[2] = i[2], l[3] = i[3], l;
              };
            }, {}], 199: [function(a, o, s) {
              o.exports = function(i, l) {
                return i[0] = l[0], i[1] = l[1], i[2] = l[2], i[3] = l[3], i;
              };
            }, {}], 200: [function(a, o, s) {
              o.exports = function() {
                var i = new Float32Array(4);
                return i[0] = 0, i[1] = 0, i[2] = 0, i[3] = 0, i;
              };
            }, {}], 201: [function(a, o, s) {
              o.exports = function(i, l) {
                var u2 = l[0] - i[0], c = l[1] - i[1], f = l[2] - i[2], h = l[3] - i[3];
                return Math.sqrt(u2 * u2 + c * c + f * f + h * h);
              };
            }, {}], 202: [function(a, o, s) {
              o.exports = function(i, l, u2) {
                return i[0] = l[0] / u2[0], i[1] = l[1] / u2[1], i[2] = l[2] / u2[2], i[3] = l[3] / u2[3], i;
              };
            }, {}], 203: [function(a, o, s) {
              o.exports = function(i, l) {
                return i[0] * l[0] + i[1] * l[1] + i[2] * l[2] + i[3] * l[3];
              };
            }, {}], 204: [function(a, o, s) {
              o.exports = function(i, l, u2, c) {
                var f = new Float32Array(4);
                return f[0] = i, f[1] = l, f[2] = u2, f[3] = c, f;
              };
            }, {}], 205: [function(a, o, s) {
              o.exports = { create: a("./create"), clone: a("./clone"), fromValues: a("./fromValues"), copy: a("./copy"), set: a("./set"), add: a("./add"), subtract: a("./subtract"), multiply: a("./multiply"), divide: a("./divide"), min: a("./min"), max: a("./max"), scale: a("./scale"), scaleAndAdd: a("./scaleAndAdd"), distance: a("./distance"), squaredDistance: a("./squaredDistance"), length: a("./length"), squaredLength: a("./squaredLength"), negate: a("./negate"), inverse: a("./inverse"), normalize: a("./normalize"), dot: a("./dot"), lerp: a("./lerp"), random: a("./random"), transformMat4: a("./transformMat4"), transformQuat: a("./transformQuat") };
            }, { "./add": 197, "./clone": 198, "./copy": 199, "./create": 200, "./distance": 201, "./divide": 202, "./dot": 203, "./fromValues": 204, "./inverse": 206, "./length": 207, "./lerp": 208, "./max": 209, "./min": 210, "./multiply": 211, "./negate": 212, "./normalize": 213, "./random": 214, "./scale": 215, "./scaleAndAdd": 216, "./set": 217, "./squaredDistance": 218, "./squaredLength": 219, "./subtract": 220, "./transformMat4": 221, "./transformQuat": 222 }], 206: [function(a, o, s) {
              o.exports = function(i, l) {
                return i[0] = 1 / l[0], i[1] = 1 / l[1], i[2] = 1 / l[2], i[3] = 1 / l[3], i;
              };
            }, {}], 207: [function(a, o, s) {
              o.exports = function(i) {
                var l = i[0], u2 = i[1], c = i[2], f = i[3];
                return Math.sqrt(l * l + u2 * u2 + c * c + f * f);
              };
            }, {}], 208: [function(a, o, s) {
              o.exports = function(i, l, u2, c) {
                var f = l[0], h = l[1], p = l[2], d = l[3];
                return i[0] = f + c * (u2[0] - f), i[1] = h + c * (u2[1] - h), i[2] = p + c * (u2[2] - p), i[3] = d + c * (u2[3] - d), i;
              };
            }, {}], 209: [function(a, o, s) {
              o.exports = function(i, l, u2) {
                return i[0] = Math.max(l[0], u2[0]), i[1] = Math.max(l[1], u2[1]), i[2] = Math.max(l[2], u2[2]), i[3] = Math.max(l[3], u2[3]), i;
              };
            }, {}], 210: [function(a, o, s) {
              o.exports = function(i, l, u2) {
                return i[0] = Math.min(l[0], u2[0]), i[1] = Math.min(l[1], u2[1]), i[2] = Math.min(l[2], u2[2]), i[3] = Math.min(l[3], u2[3]), i;
              };
            }, {}], 211: [function(a, o, s) {
              o.exports = function(i, l, u2) {
                return i[0] = l[0] * u2[0], i[1] = l[1] * u2[1], i[2] = l[2] * u2[2], i[3] = l[3] * u2[3], i;
              };
            }, {}], 212: [function(a, o, s) {
              o.exports = function(i, l) {
                return i[0] = -l[0], i[1] = -l[1], i[2] = -l[2], i[3] = -l[3], i;
              };
            }, {}], 213: [function(a, o, s) {
              o.exports = function(i, l) {
                var u2 = l[0], c = l[1], f = l[2], h = l[3], p = u2 * u2 + c * c + f * f + h * h;
                return p > 0 && (p = 1 / Math.sqrt(p), i[0] = u2 * p, i[1] = c * p, i[2] = f * p, i[3] = h * p), i;
              };
            }, {}], 214: [function(a, o, s) {
              var i = a("./normalize"), l = a("./scale");
              o.exports = function(u2, c) {
                return c = c || 1, u2[0] = Math.random(), u2[1] = Math.random(), u2[2] = Math.random(), u2[3] = Math.random(), i(u2, u2), l(u2, u2, c), u2;
              };
            }, { "./normalize": 213, "./scale": 215 }], 215: [function(a, o, s) {
              o.exports = function(i, l, u2) {
                return i[0] = l[0] * u2, i[1] = l[1] * u2, i[2] = l[2] * u2, i[3] = l[3] * u2, i;
              };
            }, {}], 216: [function(a, o, s) {
              o.exports = function(i, l, u2, c) {
                return i[0] = l[0] + u2[0] * c, i[1] = l[1] + u2[1] * c, i[2] = l[2] + u2[2] * c, i[3] = l[3] + u2[3] * c, i;
              };
            }, {}], 217: [function(a, o, s) {
              o.exports = function(i, l, u2, c, f) {
                return i[0] = l, i[1] = u2, i[2] = c, i[3] = f, i;
              };
            }, {}], 218: [function(a, o, s) {
              o.exports = function(i, l) {
                var u2 = l[0] - i[0], c = l[1] - i[1], f = l[2] - i[2], h = l[3] - i[3];
                return u2 * u2 + c * c + f * f + h * h;
              };
            }, {}], 219: [function(a, o, s) {
              o.exports = function(i) {
                var l = i[0], u2 = i[1], c = i[2], f = i[3];
                return l * l + u2 * u2 + c * c + f * f;
              };
            }, {}], 220: [function(a, o, s) {
              o.exports = function(i, l, u2) {
                return i[0] = l[0] - u2[0], i[1] = l[1] - u2[1], i[2] = l[2] - u2[2], i[3] = l[3] - u2[3], i;
              };
            }, {}], 221: [function(a, o, s) {
              o.exports = function(i, l, u2) {
                var c = l[0], f = l[1], h = l[2], p = l[3];
                return i[0] = u2[0] * c + u2[4] * f + u2[8] * h + u2[12] * p, i[1] = u2[1] * c + u2[5] * f + u2[9] * h + u2[13] * p, i[2] = u2[2] * c + u2[6] * f + u2[10] * h + u2[14] * p, i[3] = u2[3] * c + u2[7] * f + u2[11] * h + u2[15] * p, i;
              };
            }, {}], 222: [function(a, o, s) {
              o.exports = function(i, l, u2) {
                var c = l[0], f = l[1], h = l[2], p = u2[0], d = u2[1], v = u2[2], m = u2[3], g = m * c + d * h - v * f, x = m * f + v * c - p * h, b = m * h + p * f - d * c, y = -p * c - d * f - v * h;
                return i[0] = g * m + y * -p + x * -v - b * -d, i[1] = x * m + y * -d + b * -p - g * -v, i[2] = b * m + y * -v + g * -d - x * -p, i[3] = l[3], i;
              };
            }, {}], 223: [function(a, o, s) {
              var i = a("glsl-tokenizer"), l = a("atob-lite");
              o.exports = function(u2) {
                for (var c = Array.isArray(u2) ? u2 : i(u2), f = 0; f < c.length; f++) {
                  var h = c[f];
                  if (h.type === "preprocessor") {
                    var p = h.data.match(/\#define\s+SHADER_NAME(_B64)?\s+(.+)$/);
                    if (p && p[2]) {
                      var d = p[1], v = p[2];
                      return (d ? l(v) : v).trim();
                    }
                  }
                }
              };
            }, { "atob-lite": 13, "glsl-tokenizer": 230 }], 224: [function(a, o, s) {
              o.exports = function(p) {
                var d, v, m, g = 0, x = 0, b = 999, y = [], w = [], _4 = 1, k = 0, T2 = 0, A2 = false, S2 = false, C2 = "", E2 = u2, F13 = i;
                (p = p || {}).version === "300 es" && (E2 = f, F13 = c);
                var N2 = {}, D2 = {};
                for (g = 0; g < E2.length; g++) N2[E2[g]] = true;
                for (g = 0; g < F13.length; g++) D2[F13[g]] = true;
                return function(z) {
                  return w = [], z !== null ? function(H2) {
                    g = 0, H2.toString && (H2 = H2.toString());
                    var te;
                    for (C2 += H2.replace(/\r\n/g, `
`), m = C2.length; d = C2[g], g < m; ) {
                      switch (te = g, b) {
                        case 0:
                          g = W2();
                          break;
                        case 1:
                        case 2:
                          g = V2();
                          break;
                        case 3:
                          g = X2();
                          break;
                        case 4:
                          g = q();
                          break;
                        case 11:
                          g = K2();
                          break;
                        case 5:
                          g = re();
                          break;
                        case 9999:
                          g = R2();
                          break;
                        case 9:
                          g = L2();
                          break;
                        case 999:
                          g = O2();
                      }
                      if (te !== g) switch (C2[te]) {
                        case `
`:
                          k = 0, ++_4;
                          break;
                        default:
                          ++k;
                      }
                    }
                    return x += g, C2 = C2.slice(g), w;
                  }(z) : function(H2) {
                    return y.length && I2(y.join("")), b = 10, I2("(eof)"), w;
                  }();
                };
                function I2(z) {
                  z.length && w.push({ type: h[b], data: z, position: T2, line: _4, column: k });
                }
                function O2() {
                  return y = y.length ? [] : y, v === "/" && d === "*" ? (T2 = x + g - 1, b = 0, v = d, g + 1) : v === "/" && d === "/" ? (T2 = x + g - 1, b = 1, v = d, g + 1) : d === "#" ? (b = 2, T2 = x + g, g) : /\s/.test(d) ? (b = 9, T2 = x + g, g) : (A2 = /\d/.test(d), S2 = /[^\w_]/.test(d), T2 = x + g, b = A2 ? 4 : S2 ? 3 : 9999, g);
                }
                function L2() {
                  return /[^\s]/g.test(d) ? (I2(y.join("")), b = 999, g) : (y.push(d), v = d, g + 1);
                }
                function V2() {
                  return d !== "\r" && d !== `
` || v === "\\" ? (y.push(d), v = d, g + 1) : (I2(y.join("")), b = 999, g);
                }
                function W2() {
                  return d === "/" && v === "*" ? (y.push(d), I2(y.join("")), b = 999, g + 1) : (y.push(d), v = d, g + 1);
                }
                function X2() {
                  if (v === "." && /\d/.test(d)) return b = 5, g;
                  if (v === "/" && d === "*") return b = 0, g;
                  if (v === "/" && d === "/") return b = 1, g;
                  if (d === "." && y.length) {
                    for (; Y2(y); ) ;
                    return b = 5, g;
                  }
                  if (d === ";" || d === ")" || d === "(") {
                    if (y.length) for (; Y2(y); ) ;
                    return I2(d), b = 999, g + 1;
                  }
                  var z = y.length === 2 && d !== "=";
                  if (/[\w_\d\s]/.test(d) || z) {
                    for (; Y2(y); ) ;
                    return b = 999, g;
                  }
                  return y.push(d), v = d, g + 1;
                }
                function Y2(z) {
                  for (var H2, te, j = 0; ; ) {
                    if (H2 = l.indexOf(z.slice(0, z.length + j).join("")), te = l[H2], H2 === -1) {
                      if (j-- + z.length > 0) continue;
                      te = z.slice(0, 1).join("");
                    }
                    return I2(te), T2 += te.length, (y = y.slice(te.length)).length;
                  }
                }
                function K2() {
                  return /[^a-fA-F0-9]/.test(d) ? (I2(y.join("")), b = 999, g) : (y.push(d), v = d, g + 1);
                }
                function q() {
                  return d === "." || /[eE]/.test(d) ? (y.push(d), b = 5, v = d, g + 1) : d === "x" && y.length === 1 && y[0] === "0" ? (b = 11, y.push(d), v = d, g + 1) : /[^\d]/.test(d) ? (I2(y.join("")), b = 999, g) : (y.push(d), v = d, g + 1);
                }
                function re() {
                  return d === "f" && (y.push(d), v = d, g += 1), /[eE]/.test(d) ? (y.push(d), v = d, g + 1) : (d !== "-" && d !== "+" || !/[eE]/.test(v)) && /[^\d]/.test(d) ? (I2(y.join("")), b = 999, g) : (y.push(d), v = d, g + 1);
                }
                function R2() {
                  if (/[^\d\w_]/.test(d)) {
                    var z = y.join("");
                    return b = D2[z] ? 8 : N2[z] ? 7 : 6, I2(y.join("")), b = 999, g;
                  }
                  return y.push(d), v = d, g + 1;
                }
              };
              var i = a("./lib/literals"), l = a("./lib/operators"), u2 = a("./lib/builtins"), c = a("./lib/literals-300es"), f = a("./lib/builtins-300es"), h = ["block-comment", "line-comment", "preprocessor", "operator", "integer", "float", "ident", "builtin", "keyword", "whitespace", "eof", "integer"];
            }, { "./lib/builtins": 226, "./lib/builtins-300es": 225, "./lib/literals": 228, "./lib/literals-300es": 227, "./lib/operators": 229 }], 225: [function(a, o, s) {
              var i = a("./builtins");
              i = i.slice().filter(function(l) {
                return !/^(gl\_|texture)/.test(l);
              }), o.exports = i.concat(["gl_VertexID", "gl_InstanceID", "gl_Position", "gl_PointSize", "gl_FragCoord", "gl_FrontFacing", "gl_FragDepth", "gl_PointCoord", "gl_MaxVertexAttribs", "gl_MaxVertexUniformVectors", "gl_MaxVertexOutputVectors", "gl_MaxFragmentInputVectors", "gl_MaxVertexTextureImageUnits", "gl_MaxCombinedTextureImageUnits", "gl_MaxTextureImageUnits", "gl_MaxFragmentUniformVectors", "gl_MaxDrawBuffers", "gl_MinProgramTexelOffset", "gl_MaxProgramTexelOffset", "gl_DepthRangeParameters", "gl_DepthRange", "trunc", "round", "roundEven", "isnan", "isinf", "floatBitsToInt", "floatBitsToUint", "intBitsToFloat", "uintBitsToFloat", "packSnorm2x16", "unpackSnorm2x16", "packUnorm2x16", "unpackUnorm2x16", "packHalf2x16", "unpackHalf2x16", "outerProduct", "transpose", "determinant", "inverse", "texture", "textureSize", "textureProj", "textureLod", "textureOffset", "texelFetch", "texelFetchOffset", "textureProjOffset", "textureLodOffset", "textureProjLod", "textureProjLodOffset", "textureGrad", "textureGradOffset", "textureProjGrad", "textureProjGradOffset"]);
            }, { "./builtins": 226 }], 226: [function(a, o, s) {
              o.exports = ["abs", "acos", "all", "any", "asin", "atan", "ceil", "clamp", "cos", "cross", "dFdx", "dFdy", "degrees", "distance", "dot", "equal", "exp", "exp2", "faceforward", "floor", "fract", "gl_BackColor", "gl_BackLightModelProduct", "gl_BackLightProduct", "gl_BackMaterial", "gl_BackSecondaryColor", "gl_ClipPlane", "gl_ClipVertex", "gl_Color", "gl_DepthRange", "gl_DepthRangeParameters", "gl_EyePlaneQ", "gl_EyePlaneR", "gl_EyePlaneS", "gl_EyePlaneT", "gl_Fog", "gl_FogCoord", "gl_FogFragCoord", "gl_FogParameters", "gl_FragColor", "gl_FragCoord", "gl_FragData", "gl_FragDepth", "gl_FragDepthEXT", "gl_FrontColor", "gl_FrontFacing", "gl_FrontLightModelProduct", "gl_FrontLightProduct", "gl_FrontMaterial", "gl_FrontSecondaryColor", "gl_LightModel", "gl_LightModelParameters", "gl_LightModelProducts", "gl_LightProducts", "gl_LightSource", "gl_LightSourceParameters", "gl_MaterialParameters", "gl_MaxClipPlanes", "gl_MaxCombinedTextureImageUnits", "gl_MaxDrawBuffers", "gl_MaxFragmentUniformComponents", "gl_MaxLights", "gl_MaxTextureCoords", "gl_MaxTextureImageUnits", "gl_MaxTextureUnits", "gl_MaxVaryingFloats", "gl_MaxVertexAttribs", "gl_MaxVertexTextureImageUnits", "gl_MaxVertexUniformComponents", "gl_ModelViewMatrix", "gl_ModelViewMatrixInverse", "gl_ModelViewMatrixInverseTranspose", "gl_ModelViewMatrixTranspose", "gl_ModelViewProjectionMatrix", "gl_ModelViewProjectionMatrixInverse", "gl_ModelViewProjectionMatrixInverseTranspose", "gl_ModelViewProjectionMatrixTranspose", "gl_MultiTexCoord0", "gl_MultiTexCoord1", "gl_MultiTexCoord2", "gl_MultiTexCoord3", "gl_MultiTexCoord4", "gl_MultiTexCoord5", "gl_MultiTexCoord6", "gl_MultiTexCoord7", "gl_Normal", "gl_NormalMatrix", "gl_NormalScale", "gl_ObjectPlaneQ", "gl_ObjectPlaneR", "gl_ObjectPlaneS", "gl_ObjectPlaneT", "gl_Point", "gl_PointCoord", "gl_PointParameters", "gl_PointSize", "gl_Position", "gl_ProjectionMatrix", "gl_ProjectionMatrixInverse", "gl_ProjectionMatrixInverseTranspose", "gl_ProjectionMatrixTranspose", "gl_SecondaryColor", "gl_TexCoord", "gl_TextureEnvColor", "gl_TextureMatrix", "gl_TextureMatrixInverse", "gl_TextureMatrixInverseTranspose", "gl_TextureMatrixTranspose", "gl_Vertex", "greaterThan", "greaterThanEqual", "inversesqrt", "length", "lessThan", "lessThanEqual", "log", "log2", "matrixCompMult", "max", "min", "mix", "mod", "normalize", "not", "notEqual", "pow", "radians", "reflect", "refract", "sign", "sin", "smoothstep", "sqrt", "step", "tan", "texture2D", "texture2DLod", "texture2DProj", "texture2DProjLod", "textureCube", "textureCubeLod", "texture2DLodEXT", "texture2DProjLodEXT", "textureCubeLodEXT", "texture2DGradEXT", "texture2DProjGradEXT", "textureCubeGradEXT"];
            }, {}], 227: [function(a, o, s) {
              var i = a("./literals");
              o.exports = i.slice().concat(["layout", "centroid", "smooth", "case", "mat2x2", "mat2x3", "mat2x4", "mat3x2", "mat3x3", "mat3x4", "mat4x2", "mat4x3", "mat4x4", "uvec2", "uvec3", "uvec4", "samplerCubeShadow", "sampler2DArray", "sampler2DArrayShadow", "isampler2D", "isampler3D", "isamplerCube", "isampler2DArray", "usampler2D", "usampler3D", "usamplerCube", "usampler2DArray", "coherent", "restrict", "readonly", "writeonly", "resource", "atomic_uint", "noperspective", "patch", "sample", "subroutine", "common", "partition", "active", "filter", "image1D", "image2D", "image3D", "imageCube", "iimage1D", "iimage2D", "iimage3D", "iimageCube", "uimage1D", "uimage2D", "uimage3D", "uimageCube", "image1DArray", "image2DArray", "iimage1DArray", "iimage2DArray", "uimage1DArray", "uimage2DArray", "image1DShadow", "image2DShadow", "image1DArrayShadow", "image2DArrayShadow", "imageBuffer", "iimageBuffer", "uimageBuffer", "sampler1DArray", "sampler1DArrayShadow", "isampler1D", "isampler1DArray", "usampler1D", "usampler1DArray", "isampler2DRect", "usampler2DRect", "samplerBuffer", "isamplerBuffer", "usamplerBuffer", "sampler2DMS", "isampler2DMS", "usampler2DMS", "sampler2DMSArray", "isampler2DMSArray", "usampler2DMSArray"]);
            }, { "./literals": 228 }], 228: [function(a, o, s) {
              o.exports = ["precision", "highp", "mediump", "lowp", "attribute", "const", "uniform", "varying", "break", "continue", "do", "for", "while", "if", "else", "in", "out", "inout", "float", "int", "uint", "void", "bool", "true", "false", "discard", "return", "mat2", "mat3", "mat4", "vec2", "vec3", "vec4", "ivec2", "ivec3", "ivec4", "bvec2", "bvec3", "bvec4", "sampler1D", "sampler2D", "sampler3D", "samplerCube", "sampler1DShadow", "sampler2DShadow", "struct", "asm", "class", "union", "enum", "typedef", "template", "this", "packed", "goto", "switch", "default", "inline", "noinline", "volatile", "public", "static", "extern", "external", "interface", "long", "short", "double", "half", "fixed", "unsigned", "input", "output", "hvec2", "hvec3", "hvec4", "dvec2", "dvec3", "dvec4", "fvec2", "fvec3", "fvec4", "sampler2DRect", "sampler3DRect", "sampler2DRectShadow", "sizeof", "cast", "namespace", "using"];
            }, {}], 229: [function(a, o, s) {
              o.exports = ["<<=", ">>=", "++", "--", "<<", ">>", "<=", ">=", "==", "!=", "&&", "||", "+=", "-=", "*=", "/=", "%=", "&=", "^^", "^=", "|=", "(", ")", "[", "]", ".", "!", "~", "*", "/", "%", "+", "-", "<", ">", "&", "^", "|", "?", ":", "=", ",", ";", "{", "}"];
            }, {}], 230: [function(a, o, s) {
              var i = a("./index");
              o.exports = function(l, u2) {
                var c = i(u2), f = [];
                return f = (f = f.concat(c(l))).concat(c(null));
              };
            }, { "./index": 224 }], 231: [function(a, o, s) {
              o.exports = function(i) {
                typeof i == "string" && (i = [i]);
                for (var l = [].slice.call(arguments, 1), u2 = [], c = 0; c < i.length - 1; c++) u2.push(i[c], l[c] || "");
                return u2.push(i[c]), u2.join("");
              };
            }, {}], 232: [function(a, o, s) {
              "use strict";
              var i = a("is-browser");
              o.exports = i && function() {
                var l = false;
                try {
                  var u2 = Object.defineProperty({}, "passive", { get: function() {
                    l = true;
                  } });
                  window.addEventListener("test", null, u2), window.removeEventListener("test", null, u2);
                } catch {
                  l = false;
                }
                return l;
              }();
            }, { "is-browser": 236 }], 233: [function(a, o, s) {
              "use strict";
              o.exports = function(v, m) {
                var g = v.length;
                if (g === 0) throw new Error("Must have at least d+1 points");
                var x = v[0].length;
                if (g <= x) throw new Error("Must input at least d+1 points");
                var b = v.slice(0, x + 1), y = i.apply(void 0, b);
                if (y === 0) throw new Error("Input not in general position");
                for (var w = new Array(x + 1), _4 = 0; _4 <= x; ++_4) w[_4] = _4;
                y < 0 && (w[0] = 1, w[1] = 0);
                var k = new u2(w, new Array(x + 1), false), T2 = k.adjacent, A2 = new Array(x + 2);
                for (_4 = 0; _4 <= x; ++_4) {
                  for (var S2 = w.slice(), C2 = 0; C2 <= x; ++C2) C2 === _4 && (S2[C2] = -1);
                  var E2 = S2[0];
                  S2[0] = S2[1], S2[1] = E2;
                  var F13 = new u2(S2, new Array(x + 1), true);
                  T2[_4] = F13, A2[_4] = F13;
                }
                for (A2[x + 1] = k, _4 = 0; _4 <= x; ++_4) {
                  S2 = T2[_4].vertices;
                  var N2 = T2[_4].adjacent;
                  for (C2 = 0; C2 <= x; ++C2) {
                    var D2 = S2[C2];
                    if (D2 < 0) N2[C2] = k;
                    else for (var I2 = 0; I2 <= x; ++I2) T2[I2].vertices.indexOf(D2) < 0 && (N2[C2] = T2[I2]);
                  }
                }
                var O2 = new p(x, b, A2), L2 = !!m;
                for (_4 = x + 1; _4 < g; ++_4) O2.insert(v[_4], L2);
                return O2.boundary();
              };
              var i = a("robust-orientation"), l = a("simplicial-complex").compareCells;
              function u2(v, m, g) {
                this.vertices = v, this.adjacent = m, this.boundary = g, this.lastVisited = -1;
              }
              function c(v, m, g) {
                this.vertices = v, this.cell = m, this.index = g;
              }
              function f(v, m) {
                return l(v.vertices, m.vertices);
              }
              u2.prototype.flip = function() {
                var v = this.vertices[0];
                this.vertices[0] = this.vertices[1], this.vertices[1] = v;
                var m = this.adjacent[0];
                this.adjacent[0] = this.adjacent[1], this.adjacent[1] = m;
              };
              var h = [];
              function p(v, m, g) {
                this.dimension = v, this.vertices = m, this.simplices = g, this.interior = g.filter(function(w) {
                  return !w.boundary;
                }), this.tuple = new Array(v + 1);
                for (var x = 0; x <= v; ++x) this.tuple[x] = this.vertices[x];
                var b, y = h[v];
                y || (y = h[v] = ((b = i[v + 1]) || (b = i), /* @__PURE__ */ function(w) {
                  return function() {
                    var _4 = this.tuple;
                    return w.apply(this, _4);
                  };
                }(b))), this.orient = y;
              }
              var d = p.prototype;
              d.handleBoundaryDegeneracy = function(v, m) {
                var g = this.dimension, x = this.vertices.length - 1, b = this.tuple, y = this.vertices, w = [v];
                for (v.lastVisited = -x; w.length > 0; ) for (var _4 = (v = w.pop()).adjacent, k = 0; k <= g; ++k) {
                  var T2 = _4[k];
                  if (T2.boundary && !(T2.lastVisited <= -x)) {
                    for (var A2 = T2.vertices, S2 = 0; S2 <= g; ++S2) {
                      var C2 = A2[S2];
                      b[S2] = C2 < 0 ? m : y[C2];
                    }
                    var E2 = this.orient();
                    if (E2 > 0) return T2;
                    T2.lastVisited = -x, E2 === 0 && w.push(T2);
                  }
                }
                return null;
              }, d.walk = function(v, m) {
                var g = this.vertices.length - 1, x = this.dimension, b = this.vertices, y = this.tuple, w = m ? this.interior.length * Math.random() | 0 : this.interior.length - 1, _4 = this.interior[w];
                e: for (; !_4.boundary; ) {
                  for (var k = _4.vertices, T2 = _4.adjacent, A2 = 0; A2 <= x; ++A2) y[A2] = b[k[A2]];
                  for (_4.lastVisited = g, A2 = 0; A2 <= x; ++A2) {
                    var S2 = T2[A2];
                    if (!(S2.lastVisited >= g)) {
                      var C2 = y[A2];
                      y[A2] = v;
                      var E2 = this.orient();
                      if (y[A2] = C2, E2 < 0) {
                        _4 = S2;
                        continue e;
                      }
                      S2.boundary ? S2.lastVisited = -g : S2.lastVisited = g;
                    }
                  }
                  return;
                }
                return _4;
              }, d.addPeaks = function(v, m) {
                var g = this.vertices.length - 1, x = this.dimension, b = this.vertices, y = this.tuple, w = this.interior, _4 = this.simplices, k = [m];
                m.lastVisited = g, m.vertices[m.vertices.indexOf(-1)] = g, m.boundary = false, w.push(m);
                for (var T2 = []; k.length > 0; ) {
                  var A2 = (m = k.pop()).vertices, S2 = m.adjacent, C2 = A2.indexOf(g);
                  if (!(C2 < 0)) {
                    for (var E2 = 0; E2 <= x; ++E2) if (E2 !== C2) {
                      var F13 = S2[E2];
                      if (F13.boundary && !(F13.lastVisited >= g)) {
                        var N2 = F13.vertices;
                        if (F13.lastVisited !== -g) {
                          for (var D2 = 0, I2 = 0; I2 <= x; ++I2) N2[I2] < 0 ? (D2 = I2, y[I2] = v) : y[I2] = b[N2[I2]];
                          if (this.orient() > 0) {
                            N2[D2] = g, F13.boundary = false, w.push(F13), k.push(F13), F13.lastVisited = g;
                            continue;
                          }
                          F13.lastVisited = -g;
                        }
                        var O2 = F13.adjacent, L2 = A2.slice(), V2 = S2.slice(), W2 = new u2(L2, V2, true);
                        _4.push(W2);
                        var X2 = O2.indexOf(m);
                        if (!(X2 < 0)) for (O2[X2] = W2, V2[C2] = F13, L2[E2] = -1, V2[E2] = m, S2[E2] = W2, W2.flip(), I2 = 0; I2 <= x; ++I2) {
                          var Y2 = L2[I2];
                          if (!(Y2 < 0 || Y2 === g)) {
                            for (var K2 = new Array(x - 1), q = 0, re = 0; re <= x; ++re) {
                              var R2 = L2[re];
                              R2 < 0 || re === I2 || (K2[q++] = R2);
                            }
                            T2.push(new c(K2, W2, I2));
                          }
                        }
                      }
                    }
                  }
                }
                for (T2.sort(f), E2 = 0; E2 + 1 < T2.length; E2 += 2) {
                  var z = T2[E2], H2 = T2[E2 + 1], te = z.index, j = H2.index;
                  te < 0 || j < 0 || (z.cell.adjacent[z.index] = H2.cell, H2.cell.adjacent[H2.index] = z.cell);
                }
              }, d.insert = function(v, m) {
                var g = this.vertices;
                g.push(v);
                var x = this.walk(v, m);
                if (x) {
                  for (var b = this.dimension, y = this.tuple, w = 0; w <= b; ++w) {
                    var _4 = x.vertices[w];
                    y[w] = _4 < 0 ? v : g[_4];
                  }
                  var k = this.orient(y);
                  k < 0 || (k !== 0 || (x = this.handleBoundaryDegeneracy(x, v))) && this.addPeaks(v, x);
                }
              }, d.boundary = function() {
                for (var v = this.dimension, m = [], g = this.simplices, x = g.length, b = 0; b < x; ++b) {
                  var y = g[b];
                  if (y.boundary) {
                    for (var w = new Array(v), _4 = y.vertices, k = 0, T2 = 0, A2 = 0; A2 <= v; ++A2) _4[A2] >= 0 ? w[k++] = _4[A2] : T2 = 1 & A2;
                    if (T2 === (1 & v)) {
                      var S2 = w[0];
                      w[0] = w[1], w[1] = S2;
                    }
                    m.push(w);
                  }
                }
                return m;
              };
            }, { "robust-orientation": 284, "simplicial-complex": 293 }], 234: [function(a, o, s) {
              "use strict";
              var i = a("binary-search-bounds");
              function l(k, T2, A2, S2, C2) {
                this.mid = k, this.left = T2, this.right = A2, this.leftPoints = S2, this.rightPoints = C2, this.count = (T2 ? T2.count : 0) + (A2 ? A2.count : 0) + S2.length;
              }
              o.exports = function(k) {
                return !k || k.length === 0 ? new w(null) : new w(y(k));
              };
              var u2 = l.prototype;
              function c(k, T2) {
                k.mid = T2.mid, k.left = T2.left, k.right = T2.right, k.leftPoints = T2.leftPoints, k.rightPoints = T2.rightPoints, k.count = T2.count;
              }
              function f(k, T2) {
                var A2 = y(T2);
                k.mid = A2.mid, k.left = A2.left, k.right = A2.right, k.leftPoints = A2.leftPoints, k.rightPoints = A2.rightPoints, k.count = A2.count;
              }
              function h(k, T2) {
                var A2 = k.intervals([]);
                A2.push(T2), f(k, A2);
              }
              function p(k, T2) {
                var A2 = k.intervals([]), S2 = A2.indexOf(T2);
                return S2 < 0 ? 0 : (A2.splice(S2, 1), f(k, A2), 1);
              }
              function d(k, T2, A2) {
                for (var S2 = 0; S2 < k.length && k[S2][0] <= T2; ++S2) {
                  var C2 = A2(k[S2]);
                  if (C2) return C2;
                }
              }
              function v(k, T2, A2) {
                for (var S2 = k.length - 1; S2 >= 0 && k[S2][1] >= T2; --S2) {
                  var C2 = A2(k[S2]);
                  if (C2) return C2;
                }
              }
              function m(k, T2) {
                for (var A2 = 0; A2 < k.length; ++A2) {
                  var S2 = T2(k[A2]);
                  if (S2) return S2;
                }
              }
              function g(k, T2) {
                return k - T2;
              }
              function x(k, T2) {
                var A2 = k[0] - T2[0];
                return A2 || k[1] - T2[1];
              }
              function b(k, T2) {
                var A2 = k[1] - T2[1];
                return A2 || k[0] - T2[0];
              }
              function y(k) {
                if (k.length === 0) return null;
                for (var T2 = [], A2 = 0; A2 < k.length; ++A2) T2.push(k[A2][0], k[A2][1]);
                T2.sort(g);
                var S2 = T2[T2.length >> 1], C2 = [], E2 = [], F13 = [];
                for (A2 = 0; A2 < k.length; ++A2) {
                  var N2 = k[A2];
                  N2[1] < S2 ? C2.push(N2) : S2 < N2[0] ? E2.push(N2) : F13.push(N2);
                }
                var D2 = F13, I2 = F13.slice();
                return D2.sort(x), I2.sort(b), new l(S2, y(C2), y(E2), D2, I2);
              }
              function w(k) {
                this.root = k;
              }
              u2.intervals = function(k) {
                return k.push.apply(k, this.leftPoints), this.left && this.left.intervals(k), this.right && this.right.intervals(k), k;
              }, u2.insert = function(k) {
                var T2 = this.count - this.leftPoints.length;
                if (this.count += 1, k[1] < this.mid) this.left ? 4 * (this.left.count + 1) > 3 * (T2 + 1) ? h(this, k) : this.left.insert(k) : this.left = y([k]);
                else if (k[0] > this.mid) this.right ? 4 * (this.right.count + 1) > 3 * (T2 + 1) ? h(this, k) : this.right.insert(k) : this.right = y([k]);
                else {
                  var A2 = i.ge(this.leftPoints, k, x), S2 = i.ge(this.rightPoints, k, b);
                  this.leftPoints.splice(A2, 0, k), this.rightPoints.splice(S2, 0, k);
                }
              }, u2.remove = function(k) {
                var T2 = this.count - this.leftPoints;
                if (k[1] < this.mid) return this.left ? 4 * (this.right ? this.right.count : 0) > 3 * (T2 - 1) ? p(this, k) : (E2 = this.left.remove(k)) === 2 ? (this.left = null, this.count -= 1, 1) : (E2 === 1 && (this.count -= 1), E2) : 0;
                if (k[0] > this.mid) return this.right ? 4 * (this.left ? this.left.count : 0) > 3 * (T2 - 1) ? p(this, k) : (E2 = this.right.remove(k)) === 2 ? (this.right = null, this.count -= 1, 1) : (E2 === 1 && (this.count -= 1), E2) : 0;
                if (this.count === 1) return this.leftPoints[0] === k ? 2 : 0;
                if (this.leftPoints.length === 1 && this.leftPoints[0] === k) {
                  if (this.left && this.right) {
                    for (var A2 = this, S2 = this.left; S2.right; ) A2 = S2, S2 = S2.right;
                    if (A2 === this) S2.right = this.right;
                    else {
                      var C2 = this.left, E2 = this.right;
                      A2.count -= S2.count, A2.right = S2.left, S2.left = C2, S2.right = E2;
                    }
                    c(this, S2), this.count = (this.left ? this.left.count : 0) + (this.right ? this.right.count : 0) + this.leftPoints.length;
                  } else this.left ? c(this, this.left) : c(this, this.right);
                  return 1;
                }
                for (C2 = i.ge(this.leftPoints, k, x); C2 < this.leftPoints.length && this.leftPoints[C2][0] === k[0]; ++C2) if (this.leftPoints[C2] === k) {
                  for (this.count -= 1, this.leftPoints.splice(C2, 1), E2 = i.ge(this.rightPoints, k, b); E2 < this.rightPoints.length && this.rightPoints[E2][1] === k[1]; ++E2) if (this.rightPoints[E2] === k) return this.rightPoints.splice(E2, 1), 1;
                }
                return 0;
              }, u2.queryPoint = function(k, T2) {
                if (k < this.mid) return this.left && (A2 = this.left.queryPoint(k, T2)) ? A2 : d(this.leftPoints, k, T2);
                if (k > this.mid) {
                  var A2;
                  return this.right && (A2 = this.right.queryPoint(k, T2)) ? A2 : v(this.rightPoints, k, T2);
                }
                return m(this.leftPoints, T2);
              }, u2.queryInterval = function(k, T2, A2) {
                var S2;
                return k < this.mid && this.left && (S2 = this.left.queryInterval(k, T2, A2)) || T2 > this.mid && this.right && (S2 = this.right.queryInterval(k, T2, A2)) ? S2 : T2 < this.mid ? d(this.leftPoints, T2, A2) : k > this.mid ? v(this.rightPoints, k, A2) : m(this.leftPoints, A2);
              };
              var _4 = w.prototype;
              _4.insert = function(k) {
                this.root ? this.root.insert(k) : this.root = new l(k[0], null, null, [k], [k]);
              }, _4.remove = function(k) {
                if (this.root) {
                  var T2 = this.root.remove(k);
                  return T2 === 2 && (this.root = null), T2 !== 0;
                }
                return false;
              }, _4.queryPoint = function(k, T2) {
                if (this.root) return this.root.queryPoint(k, T2);
              }, _4.queryInterval = function(k, T2, A2) {
                if (k <= T2 && this.root) return this.root.queryInterval(k, T2, A2);
              }, Object.defineProperty(_4, "count", { get: function() {
                return this.root ? this.root.count : 0;
              } }), Object.defineProperty(_4, "intervals", { get: function() {
                return this.root ? this.root.intervals([]) : [];
              } });
            }, { "binary-search-bounds": 31 }], 235: [function(a, o, s) {
              "use strict";
              o.exports = function(i) {
                for (var l = new Array(i), u2 = 0; u2 < i; ++u2) l[u2] = u2;
                return l;
              };
            }, {}], 236: [function(a, o, s) {
              o.exports = true;
            }, {}], 237: [function(a, o, s) {
              function i(l) {
                return !!l.constructor && typeof l.constructor.isBuffer == "function" && l.constructor.isBuffer(l);
              }
              o.exports = function(l) {
                return l != null && (i(l) || function(u2) {
                  return typeof u2.readFloatLE == "function" && typeof u2.slice == "function" && i(u2.slice(0, 0));
                }(l) || !!l._isBuffer);
              };
            }, {}], 238: [function(a, o, s) {
              "use strict";
              o.exports = u2, o.exports.isMobile = u2, o.exports.default = u2;
              var i = /(android|bb\d+|meego).+mobile|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|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i, l = /(android|bb\d+|meego).+mobile|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|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino|android|ipad|playbook|silk/i;
              function u2(c) {
                c || (c = {});
                var f = c.ua;
                if (f || typeof navigator > "u" || (f = navigator.userAgent), f && f.headers && typeof f.headers["user-agent"] == "string" && (f = f.headers["user-agent"]), typeof f != "string") return false;
                var h = c.tablet ? l.test(f) : i.test(f);
                return !h && c.tablet && c.featureDetect && navigator && navigator.maxTouchPoints > 1 && f.indexOf("Macintosh") !== -1 && f.indexOf("Safari") !== -1 && (h = true), h;
              }
            }, {}], 239: [function(a, o, s) {
              "use strict";
              o.exports = function(i) {
                for (var l, u2 = i.length, c = 0; c < u2; c++) if (((l = i.charCodeAt(c)) < 9 || l > 13) && l !== 32 && l !== 133 && l !== 160 && l !== 5760 && l !== 6158 && (l < 8192 || l > 8205) && l !== 8232 && l !== 8233 && l !== 8239 && l !== 8287 && l !== 8288 && l !== 12288 && l !== 65279) return false;
                return true;
              };
            }, {}], 240: [function(a, o, s) {
              o.exports = function(i, l, u2) {
                return i * (1 - u2) + l * u2;
              };
            }, {}], 241: [function(a, o, s) {
              var i = a("./normalize"), l = a("gl-mat4/create"), u2 = a("gl-mat4/clone"), c = a("gl-mat4/determinant"), f = a("gl-mat4/invert"), h = a("gl-mat4/transpose"), p = { length: a("gl-vec3/length"), normalize: a("gl-vec3/normalize"), dot: a("gl-vec3/dot"), cross: a("gl-vec3/cross") }, d = l(), v = l(), m = [0, 0, 0, 0], g = [[0, 0, 0], [0, 0, 0], [0, 0, 0]], x = [0, 0, 0];
              function b(y, w, _4, k, T2) {
                y[0] = w[0] * k + _4[0] * T2, y[1] = w[1] * k + _4[1] * T2, y[2] = w[2] * k + _4[2] * T2;
              }
              o.exports = function(y, w, _4, k, T2, A2) {
                if (w || (w = [0, 0, 0]), _4 || (_4 = [0, 0, 0]), k || (k = [0, 0, 0]), T2 || (T2 = [0, 0, 0, 1]), A2 || (A2 = [0, 0, 0, 1]), !i(d, y) || (u2(v, d), v[3] = 0, v[7] = 0, v[11] = 0, v[15] = 1, Math.abs(c(v) < 1e-8))) return false;
                var S2, C2, E2, F13, N2, D2, I2, O2 = d[3], L2 = d[7], V2 = d[11], W2 = d[12], X2 = d[13], Y2 = d[14], K2 = d[15];
                if (O2 !== 0 || L2 !== 0 || V2 !== 0) {
                  if (m[0] = O2, m[1] = L2, m[2] = V2, m[3] = K2, !f(v, v)) return false;
                  h(v, v), S2 = T2, E2 = v, F13 = (C2 = m)[0], N2 = C2[1], D2 = C2[2], I2 = C2[3], S2[0] = E2[0] * F13 + E2[4] * N2 + E2[8] * D2 + E2[12] * I2, S2[1] = E2[1] * F13 + E2[5] * N2 + E2[9] * D2 + E2[13] * I2, S2[2] = E2[2] * F13 + E2[6] * N2 + E2[10] * D2 + E2[14] * I2, S2[3] = E2[3] * F13 + E2[7] * N2 + E2[11] * D2 + E2[15] * I2;
                } else T2[0] = T2[1] = T2[2] = 0, T2[3] = 1;
                if (w[0] = W2, w[1] = X2, w[2] = Y2, function(re, R2) {
                  re[0][0] = R2[0], re[0][1] = R2[1], re[0][2] = R2[2], re[1][0] = R2[4], re[1][1] = R2[5], re[1][2] = R2[6], re[2][0] = R2[8], re[2][1] = R2[9], re[2][2] = R2[10];
                }(g, d), _4[0] = p.length(g[0]), p.normalize(g[0], g[0]), k[0] = p.dot(g[0], g[1]), b(g[1], g[1], g[0], 1, -k[0]), _4[1] = p.length(g[1]), p.normalize(g[1], g[1]), k[0] /= _4[1], k[1] = p.dot(g[0], g[2]), b(g[2], g[2], g[0], 1, -k[1]), k[2] = p.dot(g[1], g[2]), b(g[2], g[2], g[1], 1, -k[2]), _4[2] = p.length(g[2]), p.normalize(g[2], g[2]), k[1] /= _4[2], k[2] /= _4[2], p.cross(x, g[1], g[2]), p.dot(g[0], x) < 0) for (var q = 0; q < 3; q++) _4[q] *= -1, g[q][0] *= -1, g[q][1] *= -1, g[q][2] *= -1;
                return A2[0] = 0.5 * Math.sqrt(Math.max(1 + g[0][0] - g[1][1] - g[2][2], 0)), A2[1] = 0.5 * Math.sqrt(Math.max(1 - g[0][0] + g[1][1] - g[2][2], 0)), A2[2] = 0.5 * Math.sqrt(Math.max(1 - g[0][0] - g[1][1] + g[2][2], 0)), A2[3] = 0.5 * Math.sqrt(Math.max(1 + g[0][0] + g[1][1] + g[2][2], 0)), g[2][1] > g[1][2] && (A2[0] = -A2[0]), g[0][2] > g[2][0] && (A2[1] = -A2[1]), g[1][0] > g[0][1] && (A2[2] = -A2[2]), true;
              };
            }, { "./normalize": 242, "gl-mat4/clone": 92, "gl-mat4/create": 93, "gl-mat4/determinant": 94, "gl-mat4/invert": 98, "gl-mat4/transpose": 109, "gl-vec3/cross": 157, "gl-vec3/dot": 162, "gl-vec3/length": 172, "gl-vec3/normalize": 179 }], 242: [function(a, o, s) {
              o.exports = function(i, l) {
                var u2 = l[15];
                if (u2 === 0) return false;
                for (var c = 1 / u2, f = 0; f < 16; f++) i[f] = l[f] * c;
                return true;
              };
            }, {}], 243: [function(a, o, s) {
              var i = a("gl-vec3/lerp"), l = a("mat4-recompose"), u2 = a("mat4-decompose"), c = a("gl-mat4/determinant"), f = a("quat-slerp"), h = v(), p = v(), d = v();
              function v() {
                return { translate: m(), scale: m(1), skew: m(), perspective: [0, 0, 0, 1], quaternion: [0, 0, 0, 1] };
              }
              function m(g) {
                return [g || 0, g || 0, g || 0];
              }
              o.exports = function(g, x, b, y) {
                if (c(x) === 0 || c(b) === 0) return false;
                var w = u2(x, h.translate, h.scale, h.skew, h.perspective, h.quaternion), _4 = u2(b, p.translate, p.scale, p.skew, p.perspective, p.quaternion);
                return !(!w || !_4) && (i(d.translate, h.translate, p.translate, y), i(d.skew, h.skew, p.skew, y), i(d.scale, h.scale, p.scale, y), i(d.perspective, h.perspective, p.perspective, y), f(d.quaternion, h.quaternion, p.quaternion, y), l(g, d.translate, d.scale, d.skew, d.perspective, d.quaternion), true);
              };
            }, { "gl-mat4/determinant": 94, "gl-vec3/lerp": 173, "mat4-decompose": 241, "mat4-recompose": 244, "quat-slerp": 271 }], 244: [function(a, o, s) {
              var i = { identity: a("gl-mat4/identity"), translate: a("gl-mat4/translate"), multiply: a("gl-mat4/multiply"), create: a("gl-mat4/create"), scale: a("gl-mat4/scale"), fromRotationTranslation: a("gl-mat4/fromRotationTranslation") }, l = (i.create(), i.create());
              o.exports = function(u2, c, f, h, p, d) {
                return i.identity(u2), i.fromRotationTranslation(u2, d, c), u2[3] = p[0], u2[7] = p[1], u2[11] = p[2], u2[15] = p[3], i.identity(l), h[2] !== 0 && (l[9] = h[2], i.multiply(u2, u2, l)), h[1] !== 0 && (l[9] = 0, l[8] = h[1], i.multiply(u2, u2, l)), h[0] !== 0 && (l[8] = 0, l[4] = h[0], i.multiply(u2, u2, l)), i.scale(u2, u2, f), u2;
              };
            }, { "gl-mat4/create": 93, "gl-mat4/fromRotationTranslation": 96, "gl-mat4/identity": 97, "gl-mat4/multiply": 100, "gl-mat4/scale": 107, "gl-mat4/translate": 108 }], 245: [function(a, o, s) {
              "use strict";
              var i = a("binary-search-bounds"), l = a("mat4-interpolate"), u2 = a("gl-mat4/invert"), c = a("gl-mat4/rotateX"), f = a("gl-mat4/rotateY"), h = a("gl-mat4/rotateZ"), p = a("gl-mat4/lookAt"), d = a("gl-mat4/translate"), v = (a("gl-mat4/scale"), a("gl-vec3/normalize")), m = [0, 0, 0];
              function g(y) {
                this._components = y.slice(), this._time = [0], this.prevMatrix = y.slice(), this.nextMatrix = y.slice(), this.computedMatrix = y.slice(), this.computedInverse = y.slice(), this.computedEye = [0, 0, 0], this.computedUp = [0, 0, 0], this.computedCenter = [0, 0, 0], this.computedRadius = [0], this._limits = [-1 / 0, 1 / 0];
              }
              o.exports = function(y) {
                return new g((y = y || {}).matrix || [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
              };
              var x = g.prototype;
              x.recalcMatrix = function(y) {
                var w = this._time, _4 = i.le(w, y), k = this.computedMatrix;
                if (!(_4 < 0)) {
                  var T2 = this._components;
                  if (_4 === w.length - 1) for (var A2 = 16 * _4, S2 = 0; S2 < 16; ++S2) k[S2] = T2[A2++];
                  else {
                    var C2 = w[_4 + 1] - w[_4], E2 = (A2 = 16 * _4, this.prevMatrix), F13 = true;
                    for (S2 = 0; S2 < 16; ++S2) E2[S2] = T2[A2++];
                    var N2 = this.nextMatrix;
                    for (S2 = 0; S2 < 16; ++S2) N2[S2] = T2[A2++], F13 = F13 && E2[S2] === N2[S2];
                    if (C2 < 1e-6 || F13) for (S2 = 0; S2 < 16; ++S2) k[S2] = E2[S2];
                    else l(k, E2, N2, (y - w[_4]) / C2);
                  }
                  var D2 = this.computedUp;
                  D2[0] = k[1], D2[1] = k[5], D2[2] = k[9], v(D2, D2);
                  var I2 = this.computedInverse;
                  u2(I2, k);
                  var O2 = this.computedEye, L2 = I2[15];
                  O2[0] = I2[12] / L2, O2[1] = I2[13] / L2, O2[2] = I2[14] / L2;
                  var V2 = this.computedCenter, W2 = Math.exp(this.computedRadius[0]);
                  for (S2 = 0; S2 < 3; ++S2) V2[S2] = O2[S2] - k[2 + 4 * S2] * W2;
                }
              }, x.idle = function(y) {
                if (!(y < this.lastT())) {
                  for (var w = this._components, _4 = w.length - 16, k = 0; k < 16; ++k) w.push(w[_4++]);
                  this._time.push(y);
                }
              }, x.flush = function(y) {
                var w = i.gt(this._time, y) - 2;
                w < 0 || (this._time.splice(0, w), this._components.splice(0, 16 * w));
              }, x.lastT = function() {
                return this._time[this._time.length - 1];
              }, x.lookAt = function(y, w, _4, k) {
                this.recalcMatrix(y), w = w || this.computedEye, _4 = _4 || m, k = k || this.computedUp, this.setMatrix(y, p(this.computedMatrix, w, _4, k));
                for (var T2 = 0, A2 = 0; A2 < 3; ++A2) T2 += Math.pow(_4[A2] - w[A2], 2);
                T2 = Math.log(Math.sqrt(T2)), this.computedRadius[0] = T2;
              }, x.rotate = function(y, w, _4, k) {
                this.recalcMatrix(y);
                var T2 = this.computedInverse;
                w && f(T2, T2, w), _4 && c(T2, T2, _4), k && h(T2, T2, k), this.setMatrix(y, u2(this.computedMatrix, T2));
              };
              var b = [0, 0, 0];
              x.pan = function(y, w, _4, k) {
                b[0] = -(w || 0), b[1] = -(_4 || 0), b[2] = -(k || 0), this.recalcMatrix(y);
                var T2 = this.computedInverse;
                d(T2, T2, b), this.setMatrix(y, u2(T2, T2));
              }, x.translate = function(y, w, _4, k) {
                b[0] = w || 0, b[1] = _4 || 0, b[2] = k || 0, this.recalcMatrix(y);
                var T2 = this.computedMatrix;
                d(T2, T2, b), this.setMatrix(y, T2);
              }, x.setMatrix = function(y, w) {
                if (!(y < this.lastT())) {
                  this._time.push(y);
                  for (var _4 = 0; _4 < 16; ++_4) this._components.push(w[_4]);
                }
              }, x.setDistance = function(y, w) {
                this.computedRadius[0] = w;
              }, x.setDistanceLimits = function(y, w) {
                var _4 = this._limits;
                _4[0] = y, _4[1] = w;
              }, x.getDistanceLimits = function(y) {
                var w = this._limits;
                return y ? (y[0] = w[0], y[1] = w[1], y) : w;
              };
            }, { "binary-search-bounds": 31, "gl-mat4/invert": 98, "gl-mat4/lookAt": 99, "gl-mat4/rotateX": 104, "gl-mat4/rotateY": 105, "gl-mat4/rotateZ": 106, "gl-mat4/scale": 107, "gl-mat4/translate": 108, "gl-vec3/normalize": 179, "mat4-interpolate": 243 }], 246: [function(a, o, s) {
              "use strict";
              o.exports = function(l) {
                var u2 = l.length;
                if (u2 < 3) {
                  for (var c = new Array(u2), f = 0; f < u2; ++f) c[f] = f;
                  return u2 === 2 && l[0][0] === l[1][0] && l[0][1] === l[1][1] ? [0] : c;
                }
                var h = new Array(u2);
                for (f = 0; f < u2; ++f) h[f] = f;
                h.sort(function(w, _4) {
                  var k = l[w][0] - l[_4][0];
                  return k || l[w][1] - l[_4][1];
                });
                var p = [h[0], h[1]], d = [h[0], h[1]];
                for (f = 2; f < u2; ++f) {
                  for (var v = h[f], m = l[v], g = p.length; g > 1 && i(l[p[g - 2]], l[p[g - 1]], m) <= 0; ) g -= 1, p.pop();
                  for (p.push(v), g = d.length; g > 1 && i(l[d[g - 2]], l[d[g - 1]], m) >= 0; ) g -= 1, d.pop();
                  d.push(v);
                }
                c = new Array(d.length + p.length - 2);
                for (var x = 0, b = (f = 0, p.length); f < b; ++f) c[x++] = p[f];
                for (var y = d.length - 2; y > 0; --y) c[x++] = d[y];
                return c;
              };
              var i = a("robust-orientation")[3];
            }, { "robust-orientation": 284 }], 247: [function(a, o, s) {
              "use strict";
              o.exports = function(l, u2) {
                u2 || (u2 = l, l = window);
                var c = 0, f = 0, h = 0, p = { shift: false, alt: false, control: false, meta: false }, d = false;
                function v(A2) {
                  var S2 = false;
                  return "altKey" in A2 && (S2 = S2 || A2.altKey !== p.alt, p.alt = !!A2.altKey), "shiftKey" in A2 && (S2 = S2 || A2.shiftKey !== p.shift, p.shift = !!A2.shiftKey), "ctrlKey" in A2 && (S2 = S2 || A2.ctrlKey !== p.control, p.control = !!A2.ctrlKey), "metaKey" in A2 && (S2 = S2 || A2.metaKey !== p.meta, p.meta = !!A2.metaKey), S2;
                }
                function m(A2, S2) {
                  var C2 = i.x(S2), E2 = i.y(S2);
                  "buttons" in S2 && (A2 = 0 | S2.buttons), (A2 !== c || C2 !== f || E2 !== h || v(S2)) && (c = 0 | A2, f = C2 || 0, h = E2 || 0, u2 && u2(c, f, h, p));
                }
                function g(A2) {
                  m(0, A2);
                }
                function x() {
                  (c || f || h || p.shift || p.alt || p.meta || p.control) && (f = h = 0, c = 0, p.shift = p.alt = p.control = p.meta = false, u2 && u2(0, 0, 0, p));
                }
                function b(A2) {
                  v(A2) && u2 && u2(c, f, h, p);
                }
                function y(A2) {
                  i.buttons(A2) === 0 ? m(0, A2) : m(c, A2);
                }
                function w(A2) {
                  m(c | i.buttons(A2), A2);
                }
                function _4(A2) {
                  m(c & ~i.buttons(A2), A2);
                }
                function k() {
                  d || (d = true, l.addEventListener("mousemove", y), l.addEventListener("mousedown", w), l.addEventListener("mouseup", _4), l.addEventListener("mouseleave", g), l.addEventListener("mouseenter", g), l.addEventListener("mouseout", g), l.addEventListener("mouseover", g), l.addEventListener("blur", x), l.addEventListener("keyup", b), l.addEventListener("keydown", b), l.addEventListener("keypress", b), l !== window && (window.addEventListener("blur", x), window.addEventListener("keyup", b), window.addEventListener("keydown", b), window.addEventListener("keypress", b)));
                }
                k();
                var T2 = { element: l };
                return Object.defineProperties(T2, { enabled: { get: function() {
                  return d;
                }, set: function(A2) {
                  A2 ? k() : function() {
                    !d || (d = false, l.removeEventListener("mousemove", y), l.removeEventListener("mousedown", w), l.removeEventListener("mouseup", _4), l.removeEventListener("mouseleave", g), l.removeEventListener("mouseenter", g), l.removeEventListener("mouseout", g), l.removeEventListener("mouseover", g), l.removeEventListener("blur", x), l.removeEventListener("keyup", b), l.removeEventListener("keydown", b), l.removeEventListener("keypress", b), l !== window && (window.removeEventListener("blur", x), window.removeEventListener("keyup", b), window.removeEventListener("keydown", b), window.removeEventListener("keypress", b)));
                  }();
                }, enumerable: true }, buttons: { get: function() {
                  return c;
                }, enumerable: true }, x: { get: function() {
                  return f;
                }, enumerable: true }, y: { get: function() {
                  return h;
                }, enumerable: true }, mods: { get: function() {
                  return p;
                }, enumerable: true } }), T2;
              };
              var i = a("mouse-event");
            }, { "mouse-event": 249 }], 248: [function(a, o, s) {
              var i = { left: 0, top: 0 };
              o.exports = function(l, u2, c) {
                u2 = u2 || l.currentTarget || l.srcElement, Array.isArray(c) || (c = [0, 0]);
                var f = l.clientX || 0, h = l.clientY || 0, p = (d = u2, d === window || d === document || d === document.body ? i : d.getBoundingClientRect()), d;
                return c[0] = f - p.left, c[1] = h - p.top, c;
              };
            }, {}], 249: [function(a, o, s) {
              "use strict";
              function i(l) {
                return l.target || l.srcElement || window;
              }
              s.buttons = function(l) {
                if (typeof l == "object") {
                  if ("buttons" in l) return l.buttons;
                  if ("which" in l) {
                    if ((u2 = l.which) === 2) return 4;
                    if (u2 === 3) return 2;
                    if (u2 > 0) return 1 << u2 - 1;
                  } else if ("button" in l) {
                    var u2;
                    if ((u2 = l.button) === 1) return 4;
                    if (u2 === 2) return 2;
                    if (u2 >= 0) return 1 << u2;
                  }
                }
                return 0;
              }, s.element = i, s.x = function(l) {
                if (typeof l == "object") {
                  if ("offsetX" in l) return l.offsetX;
                  var u2 = i(l).getBoundingClientRect();
                  return l.clientX - u2.left;
                }
                return 0;
              }, s.y = function(l) {
                if (typeof l == "object") {
                  if ("offsetY" in l) return l.offsetY;
                  var u2 = i(l).getBoundingClientRect();
                  return l.clientY - u2.top;
                }
                return 0;
              };
            }, {}], 250: [function(a, o, s) {
              "use strict";
              var i = a("to-px");
              o.exports = function(l, u2, c) {
                typeof l == "function" && (c = !!u2, u2 = l, l = window);
                var f = i("ex", l), h = function(p) {
                  c && p.preventDefault();
                  var d = p.deltaX || 0, v = p.deltaY || 0, m = p.deltaZ || 0, g = 1;
                  switch (p.deltaMode) {
                    case 1:
                      g = f;
                      break;
                    case 2:
                      g = window.innerHeight;
                  }
                  if (v *= g, m *= g, (d *= g) || v || m) return u2(d, v, m, p);
                };
                return l.addEventListener("wheel", h), h;
              };
            }, { "to-px": 304 }], 251: [function(a, o, s) {
              "use strict";
              var i = a("typedarray-pool");
              o.exports = function(u2) {
                function c(g) {
                  throw new Error("ndarray-extract-contour: " + g);
                }
                typeof u2 != "object" && c("Must specify arguments");
                var f = u2.order;
                Array.isArray(f) || c("Must specify order");
                var h = u2.arrayArguments || 1;
                h < 1 && c("Must have at least one array argument");
                var p = u2.scalarArguments || 0;
                p < 0 && c("Scalar arg count must be > 0"), typeof u2.vertex != "function" && c("Must specify vertex creation function"), typeof u2.cell != "function" && c("Must specify cell creation function"), typeof u2.phase != "function" && c("Must specify phase function");
                for (var d = u2.getters || [], v = new Array(h), m = 0; m < h; ++m) d.indexOf(m) >= 0 ? v[m] = true : v[m] = false;
                return function(g, x, b, y, w, _4) {
                  var k = [_4, w].join(",");
                  return (0, l[k])(g, x, b, i.mallocUint32, i.freeUint32);
                }(u2.vertex, u2.cell, u2.phase, 0, f, v);
              };
              var l = { "false,0,1": function(u2, c, f, h, p) {
                return function(d, v, m, g) {
                  var x, b = 0 | d.shape[0], y = 0 | d.shape[1], w = d.data, _4 = 0 | d.offset, k = 0 | d.stride[0], T2 = 0 | d.stride[1], A2 = _4, S2 = 0 | -k, C2 = 0, E2 = 0 | -T2, F13 = 0, N2 = -k - T2 | 0, D2 = 0, I2 = 0 | k, O2 = T2 - k * b | 0, L2 = 0, V2 = 0, W2 = 0, X2 = 2 * b | 0, Y2 = h(X2), K2 = h(X2), q = 0, re = 0, R2 = -1, z = -1, H2 = 0, te = 0 | -b, j = 0 | b, Q2 = 0, Z2 = -b - 1 | 0, ne = b - 1 | 0, ae = 0, ue = 0, le = 0;
                  for (L2 = 0; L2 < b; ++L2) Y2[q++] = f(w[A2], v, m, g), A2 += I2;
                  if (A2 += O2, y > 0) {
                    if (V2 = 1, Y2[q++] = f(w[A2], v, m, g), A2 += I2, b > 0) for (L2 = 1, x = w[A2], re = Y2[q] = f(x, v, m, g), H2 = Y2[q + R2], Q2 = Y2[q + te], ae = Y2[q + Z2], re === H2 && re === Q2 && re === ae || (C2 = w[A2 + S2], F13 = w[A2 + E2], D2 = w[A2 + N2], u2(L2, V2, x, C2, F13, D2, re, H2, Q2, ae, v, m, g), ue = K2[q] = W2++), q += 1, A2 += I2, L2 = 2; L2 < b; ++L2) x = w[A2], re = Y2[q] = f(x, v, m, g), H2 = Y2[q + R2], Q2 = Y2[q + te], ae = Y2[q + Z2], re === H2 && re === Q2 && re === ae || (C2 = w[A2 + S2], F13 = w[A2 + E2], D2 = w[A2 + N2], u2(L2, V2, x, C2, F13, D2, re, H2, Q2, ae, v, m, g), ue = K2[q] = W2++, ae !== H2 && c(K2[q + R2], ue, D2, C2, ae, H2, v, m, g)), q += 1, A2 += I2;
                    for (A2 += O2, q = 0, le = R2, R2 = z, z = le, le = te, te = j, j = le, le = Z2, Z2 = ne, ne = le, V2 = 2; V2 < y; ++V2) {
                      if (Y2[q++] = f(w[A2], v, m, g), A2 += I2, b > 0) for (L2 = 1, x = w[A2], re = Y2[q] = f(x, v, m, g), H2 = Y2[q + R2], Q2 = Y2[q + te], ae = Y2[q + Z2], re === H2 && re === Q2 && re === ae || (C2 = w[A2 + S2], F13 = w[A2 + E2], D2 = w[A2 + N2], u2(L2, V2, x, C2, F13, D2, re, H2, Q2, ae, v, m, g), ue = K2[q] = W2++, ae !== Q2 && c(K2[q + te], ue, F13, D2, Q2, ae, v, m, g)), q += 1, A2 += I2, L2 = 2; L2 < b; ++L2) x = w[A2], re = Y2[q] = f(x, v, m, g), H2 = Y2[q + R2], Q2 = Y2[q + te], ae = Y2[q + Z2], re === H2 && re === Q2 && re === ae || (C2 = w[A2 + S2], F13 = w[A2 + E2], D2 = w[A2 + N2], u2(L2, V2, x, C2, F13, D2, re, H2, Q2, ae, v, m, g), ue = K2[q] = W2++, ae !== Q2 && c(K2[q + te], ue, F13, D2, Q2, ae, v, m, g), ae !== H2 && c(K2[q + R2], ue, D2, C2, ae, H2, v, m, g)), q += 1, A2 += I2;
                      1 & V2 && (q = 0), le = R2, R2 = z, z = le, le = te, te = j, j = le, le = Z2, Z2 = ne, ne = le, A2 += O2;
                    }
                  }
                  p(K2), p(Y2);
                };
              }, "false,1,0": function(u2, c, f, h, p) {
                return function(d, v, m, g) {
                  var x, b = 0 | d.shape[0], y = 0 | d.shape[1], w = d.data, _4 = 0 | d.offset, k = 0 | d.stride[0], T2 = 0 | d.stride[1], A2 = _4, S2 = 0 | -k, C2 = 0, E2 = 0 | -T2, F13 = 0, N2 = -k - T2 | 0, D2 = 0, I2 = 0 | T2, O2 = k - T2 * y | 0, L2 = 0, V2 = 0, W2 = 0, X2 = 2 * y | 0, Y2 = h(X2), K2 = h(X2), q = 0, re = 0, R2 = -1, z = -1, H2 = 0, te = 0 | -y, j = 0 | y, Q2 = 0, Z2 = -y - 1 | 0, ne = y - 1 | 0, ae = 0, ue = 0, le = 0;
                  for (V2 = 0; V2 < y; ++V2) Y2[q++] = f(w[A2], v, m, g), A2 += I2;
                  if (A2 += O2, b > 0) {
                    if (L2 = 1, Y2[q++] = f(w[A2], v, m, g), A2 += I2, y > 0) for (V2 = 1, x = w[A2], re = Y2[q] = f(x, v, m, g), Q2 = Y2[q + te], H2 = Y2[q + R2], ae = Y2[q + Z2], re === Q2 && re === H2 && re === ae || (C2 = w[A2 + S2], F13 = w[A2 + E2], D2 = w[A2 + N2], u2(L2, V2, x, C2, F13, D2, re, Q2, H2, ae, v, m, g), ue = K2[q] = W2++), q += 1, A2 += I2, V2 = 2; V2 < y; ++V2) x = w[A2], re = Y2[q] = f(x, v, m, g), Q2 = Y2[q + te], H2 = Y2[q + R2], ae = Y2[q + Z2], re === Q2 && re === H2 && re === ae || (C2 = w[A2 + S2], F13 = w[A2 + E2], D2 = w[A2 + N2], u2(L2, V2, x, C2, F13, D2, re, Q2, H2, ae, v, m, g), ue = K2[q] = W2++, ae !== H2 && c(K2[q + R2], ue, F13, D2, H2, ae, v, m, g)), q += 1, A2 += I2;
                    for (A2 += O2, q = 0, le = te, te = j, j = le, le = R2, R2 = z, z = le, le = Z2, Z2 = ne, ne = le, L2 = 2; L2 < b; ++L2) {
                      if (Y2[q++] = f(w[A2], v, m, g), A2 += I2, y > 0) for (V2 = 1, x = w[A2], re = Y2[q] = f(x, v, m, g), Q2 = Y2[q + te], H2 = Y2[q + R2], ae = Y2[q + Z2], re === Q2 && re === H2 && re === ae || (C2 = w[A2 + S2], F13 = w[A2 + E2], D2 = w[A2 + N2], u2(L2, V2, x, C2, F13, D2, re, Q2, H2, ae, v, m, g), ue = K2[q] = W2++, ae !== Q2 && c(K2[q + te], ue, D2, C2, ae, Q2, v, m, g)), q += 1, A2 += I2, V2 = 2; V2 < y; ++V2) x = w[A2], re = Y2[q] = f(x, v, m, g), Q2 = Y2[q + te], H2 = Y2[q + R2], ae = Y2[q + Z2], re === Q2 && re === H2 && re === ae || (C2 = w[A2 + S2], F13 = w[A2 + E2], D2 = w[A2 + N2], u2(L2, V2, x, C2, F13, D2, re, Q2, H2, ae, v, m, g), ue = K2[q] = W2++, ae !== H2 && c(K2[q + R2], ue, F13, D2, H2, ae, v, m, g), ae !== Q2 && c(K2[q + te], ue, D2, C2, ae, Q2, v, m, g)), q += 1, A2 += I2;
                      1 & L2 && (q = 0), le = te, te = j, j = le, le = R2, R2 = z, z = le, le = Z2, Z2 = ne, ne = le, A2 += O2;
                    }
                  }
                  p(K2), p(Y2);
                };
              } };
            }, { "typedarray-pool": 308 }], 252: [function(a, o, s) {
              "use strict";
              var i = a("dup"), l = { zero: function(b, y, w, _4) {
                var k = b[0];
                _4 |= 0;
                var T2 = 0, A2 = w[0];
                for (T2 = 0; T2 < k; ++T2) y[_4] = 0, _4 += A2;
              }, fdTemplate1: function(b, y, w, _4, k, T2, A2) {
                var S2 = b[0], C2 = w[0], E2 = -1 * C2, F13 = C2;
                _4 |= 0, A2 |= 0;
                var N2 = 0, D2 = C2, I2 = T2[0];
                for (N2 = 0; N2 < S2; ++N2) k[A2] = 0.5 * (y[_4 + E2] - y[_4 + F13]), _4 += D2, A2 += I2;
              }, fdTemplate2: function(b, y, w, _4, k, T2, A2, S2, C2, E2) {
                var F13 = b[0], N2 = b[1], D2 = w[0], I2 = w[1], O2 = T2[0], L2 = T2[1], V2 = C2[0], W2 = C2[1], X2 = -1 * D2, Y2 = D2, K2 = -1 * I2, q = I2;
                _4 |= 0, A2 |= 0, E2 |= 0;
                var re = 0, R2 = 0, z = I2, H2 = D2 - N2 * I2, te = L2, j = O2 - N2 * L2, Q2 = W2, Z2 = V2 - N2 * W2;
                for (R2 = 0; R2 < F13; ++R2) {
                  for (re = 0; re < N2; ++re) k[A2] = 0.5 * (y[_4 + X2] - y[_4 + Y2]), S2[E2] = 0.5 * (y[_4 + K2] - y[_4 + q]), _4 += z, A2 += te, E2 += Q2;
                  _4 += H2, A2 += j, E2 += Z2;
                }
              } }, u2 = { cdiff: function(b) {
                var y = {};
                return function(w, _4, k) {
                  var T2 = w.dtype, A2 = w.order, S2 = _4.dtype, C2 = _4.order, E2 = k.dtype, F13 = k.order, N2 = [T2, A2.join(), S2, C2.join(), E2, F13.join()].join(), D2 = y[N2];
                  return D2 || (y[N2] = D2 = b([T2, A2, S2, C2, E2, F13])), D2(w.shape.slice(0), w.data, w.stride, 0 | w.offset, _4.data, _4.stride, 0 | _4.offset, k.data, k.stride, 0 | k.offset);
                };
              }, zero: function(b) {
                var y = {};
                return function(w) {
                  var _4 = w.dtype, k = w.order, T2 = [_4, k.join()].join(), A2 = y[T2];
                  return A2 || (y[T2] = A2 = b([_4, k])), A2(w.shape.slice(0), w.data, w.stride, 0 | w.offset);
                };
              }, fdTemplate1: function(b) {
                var y = {};
                return function(w, _4) {
                  var k = w.dtype, T2 = w.order, A2 = _4.dtype, S2 = _4.order, C2 = [k, T2.join(), A2, S2.join()].join(), E2 = y[C2];
                  return E2 || (y[C2] = E2 = b([k, T2, A2, S2])), E2(w.shape.slice(0), w.data, w.stride, 0 | w.offset, _4.data, _4.stride, 0 | _4.offset);
                };
              }, fdTemplate2: function(b) {
                var y = {};
                return function(w, _4, k) {
                  var T2 = w.dtype, A2 = w.order, S2 = _4.dtype, C2 = _4.order, E2 = k.dtype, F13 = k.order, N2 = [T2, A2.join(), S2, C2.join(), E2, F13.join()].join(), D2 = y[N2];
                  return D2 || (y[N2] = D2 = b([T2, A2, S2, C2, E2, F13])), D2(w.shape.slice(0), w.data, w.stride, 0 | w.offset, _4.data, _4.stride, 0 | _4.offset, k.data, k.stride, 0 | k.offset);
                };
              } };
              function c(b) {
                return (0, u2[b.funcName])(f.bind(void 0, b));
              }
              function f(b) {
                return l[b.funcName];
              }
              function h(b) {
                return c({ funcName: b.funcName });
              }
              var p = {}, d = {}, v = h({ funcName: "cdiff" }), m = h({ funcName: "zero" });
              function g(b) {
                return b in p ? p[b] : p[b] = h({ funcName: "fdTemplate" + b });
              }
              function x(b, y, w, _4) {
                return function(k, T2) {
                  var A2 = T2.shape.slice();
                  return A2[0] > 2 && A2[1] > 2 && _4(T2.pick(-1, -1).lo(1, 1).hi(A2[0] - 2, A2[1] - 2), k.pick(-1, -1, 0).lo(1, 1).hi(A2[0] - 2, A2[1] - 2), k.pick(-1, -1, 1).lo(1, 1).hi(A2[0] - 2, A2[1] - 2)), A2[1] > 2 && (w(T2.pick(0, -1).lo(1).hi(A2[1] - 2), k.pick(0, -1, 1).lo(1).hi(A2[1] - 2)), y(k.pick(0, -1, 0).lo(1).hi(A2[1] - 2))), A2[1] > 2 && (w(T2.pick(A2[0] - 1, -1).lo(1).hi(A2[1] - 2), k.pick(A2[0] - 1, -1, 1).lo(1).hi(A2[1] - 2)), y(k.pick(A2[0] - 1, -1, 0).lo(1).hi(A2[1] - 2))), A2[0] > 2 && (w(T2.pick(-1, 0).lo(1).hi(A2[0] - 2), k.pick(-1, 0, 0).lo(1).hi(A2[0] - 2)), y(k.pick(-1, 0, 1).lo(1).hi(A2[0] - 2))), A2[0] > 2 && (w(T2.pick(-1, A2[1] - 1).lo(1).hi(A2[0] - 2), k.pick(-1, A2[1] - 1, 0).lo(1).hi(A2[0] - 2)), y(k.pick(-1, A2[1] - 1, 1).lo(1).hi(A2[0] - 2))), k.set(0, 0, 0, 0), k.set(0, 0, 1, 0), k.set(A2[0] - 1, 0, 0, 0), k.set(A2[0] - 1, 0, 1, 0), k.set(0, A2[1] - 1, 0, 0), k.set(0, A2[1] - 1, 1, 0), k.set(A2[0] - 1, A2[1] - 1, 0, 0), k.set(A2[0] - 1, A2[1] - 1, 1, 0), k;
                };
              }
              o.exports = function(b, y, w) {
                return Array.isArray(w) || (w = i(y.dimension, typeof w == "string" ? w : "clamp")), y.size === 0 ? b : y.dimension === 0 ? (b.set(0), b) : function(_4) {
                  var k = _4.join();
                  if (C2 = d[k]) return C2;
                  for (var T2 = _4.length, A2 = [v, m], S2 = 1; S2 <= T2; ++S2) A2.push(g(S2));
                  var C2 = x.apply(void 0, A2);
                  return d[k] = C2, C2;
                }(w)(b, y);
              };
            }, { dup: 65 }], 253: [function(a, o, s) {
              "use strict";
              function i(f, h) {
                var p = Math.floor(h), d = h - p, v = 0 <= p && p < f.shape[0], m = 0 <= p + 1 && p + 1 < f.shape[0];
                return (1 - d) * (v ? +f.get(p) : 0) + d * (m ? +f.get(p + 1) : 0);
              }
              function l(f, h, p) {
                var d = Math.floor(h), v = h - d, m = 0 <= d && d < f.shape[0], g = 0 <= d + 1 && d + 1 < f.shape[0], x = Math.floor(p), b = p - x, y = 0 <= x && x < f.shape[1], w = 0 <= x + 1 && x + 1 < f.shape[1], _4 = m && y ? f.get(d, x) : 0, k = m && w ? f.get(d, x + 1) : 0;
                return (1 - b) * ((1 - v) * _4 + v * (g && y ? f.get(d + 1, x) : 0)) + b * ((1 - v) * k + v * (g && w ? f.get(d + 1, x + 1) : 0));
              }
              function u2(f, h, p, d) {
                var v = Math.floor(h), m = h - v, g = 0 <= v && v < f.shape[0], x = 0 <= v + 1 && v + 1 < f.shape[0], b = Math.floor(p), y = p - b, w = 0 <= b && b < f.shape[1], _4 = 0 <= b + 1 && b + 1 < f.shape[1], k = Math.floor(d), T2 = d - k, A2 = 0 <= k && k < f.shape[2], S2 = 0 <= k + 1 && k + 1 < f.shape[2], C2 = g && w && A2 ? f.get(v, b, k) : 0, E2 = g && _4 && A2 ? f.get(v, b + 1, k) : 0, F13 = x && w && A2 ? f.get(v + 1, b, k) : 0, N2 = x && _4 && A2 ? f.get(v + 1, b + 1, k) : 0, D2 = g && w && S2 ? f.get(v, b, k + 1) : 0, I2 = g && _4 && S2 ? f.get(v, b + 1, k + 1) : 0;
                return (1 - T2) * ((1 - y) * ((1 - m) * C2 + m * F13) + y * ((1 - m) * E2 + m * N2)) + T2 * ((1 - y) * ((1 - m) * D2 + m * (x && w && S2 ? f.get(v + 1, b, k + 1) : 0)) + y * ((1 - m) * I2 + m * (x && _4 && S2 ? f.get(v + 1, b + 1, k + 1) : 0)));
              }
              function c(f) {
                var h, p, d = 0 | f.shape.length, v = new Array(d), m = new Array(d), g = new Array(d), x = new Array(d);
                for (h = 0; h < d; ++h) p = +arguments[h + 1], v[h] = Math.floor(p), m[h] = p - v[h], g[h] = 0 <= v[h] && v[h] < f.shape[h], x[h] = 0 <= v[h] + 1 && v[h] + 1 < f.shape[h];
                var b, y, w, _4 = 0;
                e: for (h = 0; h < 1 << d; ++h) {
                  for (y = 1, w = f.offset, b = 0; b < d; ++b) if (h & 1 << b) {
                    if (!x[b]) continue e;
                    y *= m[b], w += f.stride[b] * (v[b] + 1);
                  } else {
                    if (!g[b]) continue e;
                    y *= 1 - m[b], w += f.stride[b] * v[b];
                  }
                  _4 += y * f.data[w];
                }
                return _4;
              }
              o.exports = function(f, h, p, d) {
                switch (f.shape.length) {
                  case 0:
                    return 0;
                  case 1:
                    return i(f, h);
                  case 2:
                    return l(f, h, p);
                  case 3:
                    return u2(f, h, p, d);
                  default:
                    return c.apply(void 0, arguments);
                }
              }, o.exports.d1 = i, o.exports.d2 = l, o.exports.d3 = u2;
            }, {}], 254: [function(a, o, s) {
              "use strict";
              var i = { "float64,2,1,0": function() {
                return function(h, p, d, v, m) {
                  var g = h[0], x = h[1], b = h[2], y = d[0], w = d[1], _4 = d[2];
                  v |= 0;
                  var k = 0, T2 = 0, A2 = 0, S2 = _4, C2 = w - b * _4, E2 = y - x * w;
                  for (A2 = 0; A2 < g; ++A2) {
                    for (T2 = 0; T2 < x; ++T2) {
                      for (k = 0; k < b; ++k) p[v] /= m, v += S2;
                      v += C2;
                    }
                    v += E2;
                  }
                };
              }, "uint8,2,0,1,float64,2,1,0": function() {
                return function(h, p, d, v, m, g, x, b) {
                  for (var y = h[0], w = h[1], _4 = h[2], k = d[0], T2 = d[1], A2 = d[2], S2 = g[0], C2 = g[1], E2 = g[2], F13 = v |= 0, N2 = x |= 0, D2 = 0 | h[0]; D2 > 0; ) {
                    D2 < 64 ? (y = D2, D2 = 0) : (y = 64, D2 -= 64);
                    for (var I2 = 0 | h[1]; I2 > 0; ) {
                      I2 < 64 ? (w = I2, I2 = 0) : (w = 64, I2 -= 64), v = F13 + D2 * k + I2 * T2, x = N2 + D2 * S2 + I2 * C2;
                      var O2 = 0, L2 = 0, V2 = 0, W2 = A2, X2 = k - _4 * A2, Y2 = T2 - y * k, K2 = E2, q = S2 - _4 * E2, re = C2 - y * S2;
                      for (V2 = 0; V2 < w; ++V2) {
                        for (L2 = 0; L2 < y; ++L2) {
                          for (O2 = 0; O2 < _4; ++O2) p[v] = m[x] * b, v += W2, x += K2;
                          v += X2, x += q;
                        }
                        v += Y2, x += re;
                      }
                    }
                  }
                };
              }, "float32,1,0,float32,1,0": function() {
                return function(h, p, d, v, m, g, x) {
                  var b = h[0], y = h[1], w = d[0], _4 = d[1], k = g[0], T2 = g[1];
                  v |= 0, x |= 0;
                  var A2 = 0, S2 = 0, C2 = _4, E2 = w - y * _4, F13 = T2, N2 = k - y * T2;
                  for (S2 = 0; S2 < b; ++S2) {
                    for (A2 = 0; A2 < y; ++A2) p[v] = m[x], v += C2, x += F13;
                    v += E2, x += N2;
                  }
                };
              }, "float32,1,0,float32,0,1": function() {
                return function(h, p, d, v, m, g, x) {
                  for (var b = h[0], y = h[1], w = d[0], _4 = d[1], k = g[0], T2 = g[1], A2 = v |= 0, S2 = x |= 0, C2 = 0 | h[1]; C2 > 0; ) {
                    C2 < 64 ? (y = C2, C2 = 0) : (y = 64, C2 -= 64);
                    for (var E2 = 0 | h[0]; E2 > 0; ) {
                      E2 < 64 ? (b = E2, E2 = 0) : (b = 64, E2 -= 64), v = A2 + C2 * _4 + E2 * w, x = S2 + C2 * T2 + E2 * k;
                      var F13 = 0, N2 = 0, D2 = _4, I2 = w - y * _4, O2 = T2, L2 = k - y * T2;
                      for (N2 = 0; N2 < b; ++N2) {
                        for (F13 = 0; F13 < y; ++F13) p[v] = m[x], v += D2, x += O2;
                        v += I2, x += L2;
                      }
                    }
                  }
                };
              }, "uint8,2,0,1,uint8,1,2,0": function() {
                return function(h, p, d, v, m, g, x) {
                  for (var b = h[0], y = h[1], w = h[2], _4 = d[0], k = d[1], T2 = d[2], A2 = g[0], S2 = g[1], C2 = g[2], E2 = v |= 0, F13 = x |= 0, N2 = 0 | h[2]; N2 > 0; ) {
                    N2 < 64 ? (w = N2, N2 = 0) : (w = 64, N2 -= 64);
                    for (var D2 = 0 | h[0]; D2 > 0; ) {
                      D2 < 64 ? (b = D2, D2 = 0) : (b = 64, D2 -= 64);
                      for (var I2 = 0 | h[1]; I2 > 0; ) {
                        I2 < 64 ? (y = I2, I2 = 0) : (y = 64, I2 -= 64), v = E2 + N2 * T2 + D2 * _4 + I2 * k, x = F13 + N2 * C2 + D2 * A2 + I2 * S2;
                        var O2 = 0, L2 = 0, V2 = 0, W2 = T2, X2 = _4 - w * T2, Y2 = k - b * _4, K2 = C2, q = A2 - w * C2, re = S2 - b * A2;
                        for (V2 = 0; V2 < y; ++V2) {
                          for (L2 = 0; L2 < b; ++L2) {
                            for (O2 = 0; O2 < w; ++O2) p[v] = m[x], v += W2, x += K2;
                            v += X2, x += q;
                          }
                          v += Y2, x += re;
                        }
                      }
                    }
                  }
                };
              }, "uint8,2,0,1,array,2,0,1": function() {
                return function(h, p, d, v, m, g, x) {
                  var b = h[0], y = h[1], w = h[2], _4 = d[0], k = d[1], T2 = d[2], A2 = g[0], S2 = g[1], C2 = g[2];
                  v |= 0, x |= 0;
                  var E2 = 0, F13 = 0, N2 = 0, D2 = T2, I2 = _4 - w * T2, O2 = k - b * _4, L2 = C2, V2 = A2 - w * C2, W2 = S2 - b * A2;
                  for (N2 = 0; N2 < y; ++N2) {
                    for (F13 = 0; F13 < b; ++F13) {
                      for (E2 = 0; E2 < w; ++E2) p[v] = m[x], v += D2, x += L2;
                      v += I2, x += V2;
                    }
                    v += O2, x += W2;
                  }
                };
              } }, l = function(h, p) {
                var d = p.join(",");
                return (0, i[d])();
              }, u2 = { mul: function(h) {
                var p = {};
                return function(d, v, m) {
                  var g = d.dtype, x = d.order, b = v.dtype, y = v.order, w = m.dtype, _4 = m.order, k = [g, x.join(), b, y.join(), w, _4.join()].join(), T2 = p[k];
                  return T2 || (p[k] = T2 = h([g, x, b, y, w, _4])), T2(d.shape.slice(0), d.data, d.stride, 0 | d.offset, v.data, v.stride, 0 | v.offset, m.data, m.stride, 0 | m.offset);
                };
              }, muls: function(h) {
                var p = {};
                return function(d, v, m) {
                  var g = d.dtype, x = d.order, b = v.dtype, y = v.order, w = [g, x.join(), b, y.join()].join(), _4 = p[w];
                  return _4 || (p[w] = _4 = h([g, x, b, y])), _4(d.shape.slice(0), d.data, d.stride, 0 | d.offset, v.data, v.stride, 0 | v.offset, m);
                };
              }, mulseq: function(h) {
                var p = {};
                return function(d, v) {
                  var m = d.dtype, g = d.order, x = [m, g.join()].join(), b = p[x];
                  return b || (p[x] = b = h([m, g])), b(d.shape.slice(0), d.data, d.stride, 0 | d.offset, v);
                };
              }, div: function(h) {
                var p = {};
                return function(d, v, m) {
                  var g = d.dtype, x = d.order, b = v.dtype, y = v.order, w = m.dtype, _4 = m.order, k = [g, x.join(), b, y.join(), w, _4.join()].join(), T2 = p[k];
                  return T2 || (p[k] = T2 = h([g, x, b, y, w, _4])), T2(d.shape.slice(0), d.data, d.stride, 0 | d.offset, v.data, v.stride, 0 | v.offset, m.data, m.stride, 0 | m.offset);
                };
              }, divs: function(h) {
                var p = {};
                return function(d, v, m) {
                  var g = d.dtype, x = d.order, b = v.dtype, y = v.order, w = [g, x.join(), b, y.join()].join(), _4 = p[w];
                  return _4 || (p[w] = _4 = h([g, x, b, y])), _4(d.shape.slice(0), d.data, d.stride, 0 | d.offset, v.data, v.stride, 0 | v.offset, m);
                };
              }, divseq: function(h) {
                var p = {};
                return function(d, v) {
                  var m = d.dtype, g = d.order, x = [m, g.join()].join(), b = p[x];
                  return b || (p[x] = b = h([m, g])), b(d.shape.slice(0), d.data, d.stride, 0 | d.offset, v);
                };
              }, assign: function(h) {
                var p = {};
                return function(d, v) {
                  var m = d.dtype, g = d.order, x = v.dtype, b = v.order, y = [m, g.join(), x, b.join()].join(), w = p[y];
                  return w || (p[y] = w = h([m, g, x, b])), w(d.shape.slice(0), d.data, d.stride, 0 | d.offset, v.data, v.stride, 0 | v.offset);
                };
              } };
              function c(h) {
                return p = { funcName: h.funcName }, (0, u2[p.funcName])(l.bind(void 0, p));
                var p;
              }
              var f = { mul: "*", div: "/" };
              (function() {
                for (var h in f) s[h] = c({ funcName: h }), s[h + "s"] = c({ funcName: h + "s" }), s[h + "seq"] = c({ funcName: h + "seq" });
              })(), s.assign = c({ funcName: "assign" });
            }, {}], 255: [function(a, o, s) {
              "use strict";
              var i = a("ndarray"), l = a("./doConvert.js");
              o.exports = function(u2, c) {
                for (var f = [], h = u2, p = 1; Array.isArray(h); ) f.push(h.length), p *= h.length, h = h[0];
                return f.length === 0 ? i() : (c || (c = i(new Float64Array(p), f)), l(c, u2), c);
              };
            }, { "./doConvert.js": 256, ndarray: 259 }], 256: [function(a, o, s) {
              "use strict";
              var i, l = function() {
                return function(u2, c, f, h, p) {
                  var d = u2[0], v = u2[1], m = u2[2], g = f[0], x = f[1], b = f[2], y = [0, 0, 0];
                  h |= 0;
                  var w = 0, _4 = 0, k = 0, T2 = b, A2 = x - m * b, S2 = g - v * x;
                  for (k = 0; k < d; ++k) {
                    for (_4 = 0; _4 < v; ++_4) {
                      for (w = 0; w < m; ++w) {
                        var C2, E2 = p;
                        for (C2 = 0; C2 < y.length - 1; ++C2) E2 = E2[y[C2]];
                        c[h] = E2[y[y.length - 1]], h += T2, ++y[2];
                      }
                      h += A2, y[2] -= m, ++y[1];
                    }
                    h += S2, y[1] -= v, ++y[0];
                  }
                };
              };
              o.exports = (i = { funcName: "convert" }, /* @__PURE__ */ function(u2) {
                var c = {};
                return function(f, h) {
                  var p = f.dtype, d = f.order, v = [p, d.join()].join(), m = c[v];
                  return m || (c[v] = m = u2([p, d])), m(f.shape.slice(0), f.data, f.stride, 0 | f.offset, h);
                };
              }(l.bind(void 0, i)));
            }, {}], 257: [function(a, o, s) {
              "use strict";
              var i = a("typedarray-pool");
              function l(h) {
                switch (h) {
                  case "uint32":
                    return [i.mallocUint32, i.freeUint32];
                  default:
                    return null;
                }
              }
              var u2 = { "uint32,1,0": function(h, p) {
                return function(d, v, m, g, x, b, y, w, _4, k, T2) {
                  var A2, S2, C2, E2, F13, N2, D2, I2, O2 = d * x + g, L2 = h(w);
                  for (A2 = d + 1; A2 <= v; ++A2) {
                    for (S2 = A2, C2 = O2 += x, F13 = 0, N2 = O2, E2 = 0; E2 < w; ++E2) L2[F13++] = m[N2], N2 += _4;
                    e: for (; S2-- > d; ) {
                      F13 = 0, N2 = C2 - x;
                      t: for (E2 = 0; E2 < w; ++E2) {
                        if ((D2 = m[N2]) < (I2 = L2[F13])) break e;
                        if (D2 > I2) break t;
                        N2 += k, F13 += T2;
                      }
                      for (F13 = C2, N2 = C2 - x, E2 = 0; E2 < w; ++E2) m[F13] = m[N2], F13 += _4, N2 += _4;
                      C2 -= x;
                    }
                    for (F13 = C2, N2 = 0, E2 = 0; E2 < w; ++E2) m[F13] = L2[N2++], F13 += _4;
                  }
                  p(L2);
                };
              } }, c = { "uint32,1,0": function(h, p, d) {
                return function v(m, g, x, b, y, w, _4, k, T2, A2, S2) {
                  var C2, E2, F13, N2, D2, I2, O2, L2, V2, W2, X2, Y2, K2, q, re, R2, z, H2, te, j, Q2, Z2, ne, ae, ue, le = (g - m + 1) / 6 | 0, ce = m + le, se = g - le, he = m + g >> 1, me = he - le, we = he + le, be = ce, Ae = me, pe = he, ve = we, Ee = se, Se = m + 1, Ce = g - 1, Be = true, Ue = 0, Ke = 0, ct = 0, We = k, Ze = p(We), it = p(We);
                  X2 = y * be, Y2 = y * Ae, ue = b;
                  e: for (W2 = 0; W2 < k; ++W2) {
                    if (L2 = Y2 + ue, (ct = x[O2 = X2 + ue] - x[L2]) > 0) {
                      E2 = be, be = Ae, Ae = E2;
                      break e;
                    }
                    if (ct < 0) break e;
                    ue += A2;
                  }
                  X2 = y * ve, Y2 = y * Ee, ue = b;
                  e: for (W2 = 0; W2 < k; ++W2) {
                    if (L2 = Y2 + ue, (ct = x[O2 = X2 + ue] - x[L2]) > 0) {
                      E2 = ve, ve = Ee, Ee = E2;
                      break e;
                    }
                    if (ct < 0) break e;
                    ue += A2;
                  }
                  X2 = y * be, Y2 = y * pe, ue = b;
                  e: for (W2 = 0; W2 < k; ++W2) {
                    if (L2 = Y2 + ue, (ct = x[O2 = X2 + ue] - x[L2]) > 0) {
                      E2 = be, be = pe, pe = E2;
                      break e;
                    }
                    if (ct < 0) break e;
                    ue += A2;
                  }
                  X2 = y * Ae, Y2 = y * pe, ue = b;
                  e: for (W2 = 0; W2 < k; ++W2) {
                    if (L2 = Y2 + ue, (ct = x[O2 = X2 + ue] - x[L2]) > 0) {
                      E2 = Ae, Ae = pe, pe = E2;
                      break e;
                    }
                    if (ct < 0) break e;
                    ue += A2;
                  }
                  X2 = y * be, Y2 = y * ve, ue = b;
                  e: for (W2 = 0; W2 < k; ++W2) {
                    if (L2 = Y2 + ue, (ct = x[O2 = X2 + ue] - x[L2]) > 0) {
                      E2 = be, be = ve, ve = E2;
                      break e;
                    }
                    if (ct < 0) break e;
                    ue += A2;
                  }
                  X2 = y * pe, Y2 = y * ve, ue = b;
                  e: for (W2 = 0; W2 < k; ++W2) {
                    if (L2 = Y2 + ue, (ct = x[O2 = X2 + ue] - x[L2]) > 0) {
                      E2 = pe, pe = ve, ve = E2;
                      break e;
                    }
                    if (ct < 0) break e;
                    ue += A2;
                  }
                  X2 = y * Ae, Y2 = y * Ee, ue = b;
                  e: for (W2 = 0; W2 < k; ++W2) {
                    if (L2 = Y2 + ue, (ct = x[O2 = X2 + ue] - x[L2]) > 0) {
                      E2 = Ae, Ae = Ee, Ee = E2;
                      break e;
                    }
                    if (ct < 0) break e;
                    ue += A2;
                  }
                  X2 = y * Ae, Y2 = y * pe, ue = b;
                  e: for (W2 = 0; W2 < k; ++W2) {
                    if (L2 = Y2 + ue, (ct = x[O2 = X2 + ue] - x[L2]) > 0) {
                      E2 = Ae, Ae = pe, pe = E2;
                      break e;
                    }
                    if (ct < 0) break e;
                    ue += A2;
                  }
                  X2 = y * ve, Y2 = y * Ee, ue = b;
                  e: for (W2 = 0; W2 < k; ++W2) {
                    if (L2 = Y2 + ue, (ct = x[O2 = X2 + ue] - x[L2]) > 0) {
                      E2 = ve, ve = Ee, Ee = E2;
                      break e;
                    }
                    if (ct < 0) break e;
                    ue += A2;
                  }
                  for (X2 = y * be, Y2 = y * Ae, K2 = y * pe, q = y * ve, re = y * Ee, R2 = y * ce, z = y * he, H2 = y * se, ae = 0, ue = b, W2 = 0; W2 < k; ++W2) O2 = X2 + ue, L2 = Y2 + ue, V2 = K2 + ue, te = q + ue, j = re + ue, Q2 = R2 + ue, Z2 = z + ue, ne = H2 + ue, Ze[ae] = x[L2], it[ae] = x[te], Be = Be && Ze[ae] === it[ae], F13 = x[O2], N2 = x[V2], D2 = x[j], x[Q2] = F13, x[Z2] = N2, x[ne] = D2, ++ae, ue += T2;
                  for (X2 = y * me, Y2 = y * m, ue = b, W2 = 0; W2 < k; ++W2) L2 = Y2 + ue, x[O2 = X2 + ue] = x[L2], ue += T2;
                  for (X2 = y * we, Y2 = y * g, ue = b, W2 = 0; W2 < k; ++W2) L2 = Y2 + ue, x[O2 = X2 + ue] = x[L2], ue += T2;
                  if (Be) for (I2 = Se; I2 <= Ce; ++I2) {
                    O2 = b + I2 * y, ae = 0;
                    e: for (W2 = 0; W2 < k && (ct = x[O2] - Ze[ae]) === 0; ++W2) ae += S2, O2 += A2;
                    if (ct !== 0) if (ct < 0) {
                      if (I2 !== Se) for (X2 = y * I2, Y2 = y * Se, ue = b, W2 = 0; W2 < k; ++W2) L2 = Y2 + ue, C2 = x[O2 = X2 + ue], x[O2] = x[L2], x[L2] = C2, ue += T2;
                      ++Se;
                    } else for (; ; ) {
                      O2 = b + Ce * y, ae = 0;
                      e: for (W2 = 0; W2 < k && (ct = x[O2] - Ze[ae]) === 0; ++W2) ae += S2, O2 += A2;
                      if (!(ct > 0)) {
                        if (ct < 0) {
                          for (X2 = y * I2, Y2 = y * Se, K2 = y * Ce, ue = b, W2 = 0; W2 < k; ++W2) L2 = Y2 + ue, V2 = K2 + ue, C2 = x[O2 = X2 + ue], x[O2] = x[L2], x[L2] = x[V2], x[V2] = C2, ue += T2;
                          ++Se, --Ce;
                          break;
                        }
                        for (X2 = y * I2, Y2 = y * Ce, ue = b, W2 = 0; W2 < k; ++W2) L2 = Y2 + ue, C2 = x[O2 = X2 + ue], x[O2] = x[L2], x[L2] = C2, ue += T2;
                        --Ce;
                        break;
                      }
                      Ce--;
                    }
                  }
                  else for (I2 = Se; I2 <= Ce; ++I2) {
                    O2 = b + I2 * y, ae = 0;
                    e: for (W2 = 0; W2 < k && (Ue = x[O2] - Ze[ae]) === 0; ++W2) ae += S2, O2 += A2;
                    if (Ue < 0) {
                      if (I2 !== Se) for (X2 = y * I2, Y2 = y * Se, ue = b, W2 = 0; W2 < k; ++W2) L2 = Y2 + ue, C2 = x[O2 = X2 + ue], x[O2] = x[L2], x[L2] = C2, ue += T2;
                      ++Se;
                    } else {
                      O2 = b + I2 * y, ae = 0;
                      e: for (W2 = 0; W2 < k && (Ke = x[O2] - it[ae]) === 0; ++W2) ae += S2, O2 += A2;
                      if (Ke > 0) for (; ; ) {
                        O2 = b + Ce * y, ae = 0;
                        e: for (W2 = 0; W2 < k && (ct = x[O2] - it[ae]) === 0; ++W2) ae += S2, O2 += A2;
                        if (!(ct > 0)) {
                          O2 = b + Ce * y, ae = 0;
                          e: for (W2 = 0; W2 < k && (ct = x[O2] - Ze[ae]) === 0; ++W2) ae += S2, O2 += A2;
                          if (ct < 0) {
                            for (X2 = y * I2, Y2 = y * Se, K2 = y * Ce, ue = b, W2 = 0; W2 < k; ++W2) L2 = Y2 + ue, V2 = K2 + ue, C2 = x[O2 = X2 + ue], x[O2] = x[L2], x[L2] = x[V2], x[V2] = C2, ue += T2;
                            ++Se, --Ce;
                          } else {
                            for (X2 = y * I2, Y2 = y * Ce, ue = b, W2 = 0; W2 < k; ++W2) L2 = Y2 + ue, C2 = x[O2 = X2 + ue], x[O2] = x[L2], x[L2] = C2, ue += T2;
                            --Ce;
                          }
                          break;
                        }
                        if (--Ce < I2) break;
                      }
                    }
                  }
                  for (X2 = y * m, Y2 = y * (Se - 1), ae = 0, ue = b, W2 = 0; W2 < k; ++W2) L2 = Y2 + ue, x[O2 = X2 + ue] = x[L2], x[L2] = Ze[ae], ++ae, ue += T2;
                  for (X2 = y * g, Y2 = y * (Ce + 1), ae = 0, ue = b, W2 = 0; W2 < k; ++W2) L2 = Y2 + ue, x[O2 = X2 + ue] = x[L2], x[L2] = it[ae], ++ae, ue += T2;
                  if (Se - 2 - m <= 32 ? h(m, Se - 2, x, b, y, w, _4, k, T2, A2, S2) : v(m, Se - 2, x, b, y, w, _4, k, T2, A2, S2), g - (Ce + 2) <= 32 ? h(Ce + 2, g, x, b, y, w, _4, k, T2, A2, S2) : v(Ce + 2, g, x, b, y, w, _4, k, T2, A2, S2), Be) return d(Ze), void d(it);
                  if (Se < ce && Ce > se) {
                    e: for (; ; ) {
                      for (O2 = b + Se * y, ae = 0, ue = b, W2 = 0; W2 < k; ++W2) {
                        if (x[O2] !== Ze[ae]) break e;
                        ++ae, O2 += T2;
                      }
                      ++Se;
                    }
                    e: for (; ; ) {
                      for (O2 = b + Ce * y, ae = 0, ue = b, W2 = 0; W2 < k; ++W2) {
                        if (x[O2] !== it[ae]) break e;
                        ++ae, O2 += T2;
                      }
                      --Ce;
                    }
                    for (I2 = Se; I2 <= Ce; ++I2) {
                      O2 = b + I2 * y, ae = 0;
                      e: for (W2 = 0; W2 < k && (Ue = x[O2] - Ze[ae]) === 0; ++W2) ae += S2, O2 += A2;
                      if (Ue === 0) {
                        if (I2 !== Se) for (X2 = y * I2, Y2 = y * Se, ue = b, W2 = 0; W2 < k; ++W2) L2 = Y2 + ue, C2 = x[O2 = X2 + ue], x[O2] = x[L2], x[L2] = C2, ue += T2;
                        ++Se;
                      } else {
                        O2 = b + I2 * y, ae = 0;
                        e: for (W2 = 0; W2 < k && (Ke = x[O2] - it[ae]) === 0; ++W2) ae += S2, O2 += A2;
                        if (Ke === 0) for (; ; ) {
                          O2 = b + Ce * y, ae = 0;
                          e: for (W2 = 0; W2 < k && (ct = x[O2] - it[ae]) === 0; ++W2) ae += S2, O2 += A2;
                          if (ct !== 0) {
                            O2 = b + Ce * y, ae = 0;
                            e: for (W2 = 0; W2 < k && (ct = x[O2] - Ze[ae]) === 0; ++W2) ae += S2, O2 += A2;
                            if (ct < 0) {
                              for (X2 = y * I2, Y2 = y * Se, K2 = y * Ce, ue = b, W2 = 0; W2 < k; ++W2) L2 = Y2 + ue, V2 = K2 + ue, C2 = x[O2 = X2 + ue], x[O2] = x[L2], x[L2] = x[V2], x[V2] = C2, ue += T2;
                              ++Se, --Ce;
                            } else {
                              for (X2 = y * I2, Y2 = y * Ce, ue = b, W2 = 0; W2 < k; ++W2) L2 = Y2 + ue, C2 = x[O2 = X2 + ue], x[O2] = x[L2], x[L2] = C2, ue += T2;
                              --Ce;
                            }
                            break;
                          }
                          if (--Ce < I2) break;
                        }
                      }
                    }
                  }
                  d(Ze), d(it), Ce - Se <= 32 ? h(Se, Ce, x, b, y, w, _4, k, T2, A2, S2) : v(Se, Ce, x, b, y, w, _4, k, T2, A2, S2);
                };
              } }, f = { "uint32,1,0": function(h, p) {
                return function(d) {
                  var v = d.data, m = 0 | d.offset, g = d.shape, x = d.stride, b = 0 | x[0], y = 0 | g[0], w = 0 | x[1], _4 = 0 | g[1], k = w, T2 = w;
                  y <= 32 ? h(0, y - 1, v, m, b, w, y, _4, k, T2, 1) : p(0, y - 1, v, m, b, w, y, _4, k, T2, 1);
                };
              } };
              o.exports = function(h, p) {
                var d = [p, h].join(","), v = f[d], m = function(x, b) {
                  var y = l(b), w = [b, x].join(","), _4 = u2[w];
                  return y ? _4(y[0], y[1]) : _4();
                }(h, p), g = function(x, b, y) {
                  var w = l(b), _4 = [b, x].join(","), k = c[_4];
                  return x.length > 1 && w ? k(y, w[0], w[1]) : k(y);
                }(h, p, m);
                return v(m, g);
              };
            }, { "typedarray-pool": 308 }], 258: [function(a, o, s) {
              "use strict";
              var i = a("./lib/compile_sort.js"), l = {};
              o.exports = function(u2) {
                var c = u2.order, f = u2.dtype, h = [c, f].join(":"), p = l[h];
                return p || (l[h] = p = i(c, f)), p(u2), u2;
              };
            }, { "./lib/compile_sort.js": 257 }], 259: [function(a, o, s) {
              var i = a("is-buffer"), l = typeof Float64Array < "u";
              function u2(d, v) {
                return d[0] - v[0];
              }
              function c() {
                var d, v = this.stride, m = new Array(v.length);
                for (d = 0; d < m.length; ++d) m[d] = [Math.abs(v[d]), d];
                m.sort(u2);
                var g = new Array(m.length);
                for (d = 0; d < g.length; ++d) g[d] = m[d][1];
                return g;
              }
              var f = { T: function(d) {
                function v(g) {
                  this.data = g;
                }
                var m = v.prototype;
                return m.dtype = d, m.index = function() {
                  return -1;
                }, m.size = 0, m.dimension = -1, m.shape = m.stride = m.order = [], m.lo = m.hi = m.transpose = m.step = function() {
                  return new v(this.data);
                }, m.get = m.set = function() {
                }, m.pick = function() {
                  return null;
                }, function(g) {
                  return new v(g);
                };
              }, 0: function(d, v) {
                function m(x, b) {
                  this.data = x, this.offset = b;
                }
                var g = m.prototype;
                return g.dtype = d, g.index = function() {
                  return this.offset;
                }, g.dimension = 0, g.size = 1, g.shape = g.stride = g.order = [], g.lo = g.hi = g.transpose = g.step = function() {
                  return new m(this.data, this.offset);
                }, g.pick = function() {
                  return v(this.data);
                }, g.valueOf = g.get = function() {
                  return d === "generic" ? this.data.get(this.offset) : this.data[this.offset];
                }, g.set = function(x) {
                  return d === "generic" ? this.data.set(this.offset, x) : this.data[this.offset] = x;
                }, function(x, b, y, w) {
                  return new m(x, w);
                };
              }, 1: function(d, v, m) {
                function g(b, y, w, _4) {
                  this.data = b, this.shape = [y], this.stride = [w], this.offset = 0 | _4;
                }
                var x = g.prototype;
                return x.dtype = d, x.dimension = 1, Object.defineProperty(x, "size", { get: function() {
                  return this.shape[0];
                } }), x.order = [0], x.set = function(b, y) {
                  return d === "generic" ? this.data.set(this.offset + this.stride[0] * b, y) : this.data[this.offset + this.stride[0] * b] = y;
                }, x.get = function(b) {
                  return d === "generic" ? this.data.get(this.offset + this.stride[0] * b) : this.data[this.offset + this.stride[0] * b];
                }, x.index = function(b) {
                  return this.offset + this.stride[0] * b;
                }, x.hi = function(b) {
                  return new g(this.data, typeof b != "number" || b < 0 ? this.shape[0] : 0 | b, this.stride[0], this.offset);
                }, x.lo = function(b) {
                  var y = this.offset, w = 0, _4 = this.shape[0], k = this.stride[0];
                  return typeof b == "number" && b >= 0 && (y += k * (w = 0 | b), _4 -= w), new g(this.data, _4, k, y);
                }, x.step = function(b) {
                  var y = this.shape[0], w = this.stride[0], _4 = this.offset, k = 0, T2 = Math.ceil;
                  return typeof b == "number" && ((k = 0 | b) < 0 ? (_4 += w * (y - 1), y = T2(-y / k)) : y = T2(y / k), w *= k), new g(this.data, y, w, _4);
                }, x.transpose = function(b) {
                  b = b === void 0 ? 0 : 0 | b;
                  var y = this.shape, w = this.stride;
                  return new g(this.data, y[b], w[b], this.offset);
                }, x.pick = function(b) {
                  var y = [], w = [], _4 = this.offset;
                  return typeof b == "number" && b >= 0 ? _4 = _4 + this.stride[0] * b | 0 : (y.push(this.shape[0]), w.push(this.stride[0])), (0, v[y.length + 1])(this.data, y, w, _4);
                }, function(b, y, w, _4) {
                  return new g(b, y[0], w[0], _4);
                };
              }, 2: function(d, v, m) {
                function g(b, y, w, _4, k, T2) {
                  this.data = b, this.shape = [y, w], this.stride = [_4, k], this.offset = 0 | T2;
                }
                var x = g.prototype;
                return x.dtype = d, x.dimension = 2, Object.defineProperty(x, "size", { get: function() {
                  return this.shape[0] * this.shape[1];
                } }), Object.defineProperty(x, "order", { get: function() {
                  return Math.abs(this.stride[0]) > Math.abs(this.stride[1]) ? [1, 0] : [0, 1];
                } }), x.set = function(b, y, w) {
                  return d === "generic" ? this.data.set(this.offset + this.stride[0] * b + this.stride[1] * y, w) : this.data[this.offset + this.stride[0] * b + this.stride[1] * y] = w;
                }, x.get = function(b, y) {
                  return d === "generic" ? this.data.get(this.offset + this.stride[0] * b + this.stride[1] * y) : this.data[this.offset + this.stride[0] * b + this.stride[1] * y];
                }, x.index = function(b, y) {
                  return this.offset + this.stride[0] * b + this.stride[1] * y;
                }, x.hi = function(b, y) {
                  return new g(this.data, typeof b != "number" || b < 0 ? this.shape[0] : 0 | b, typeof y != "number" || y < 0 ? this.shape[1] : 0 | y, this.stride[0], this.stride[1], this.offset);
                }, x.lo = function(b, y) {
                  var w = this.offset, _4 = 0, k = this.shape[0], T2 = this.shape[1], A2 = this.stride[0], S2 = this.stride[1];
                  return typeof b == "number" && b >= 0 && (w += A2 * (_4 = 0 | b), k -= _4), typeof y == "number" && y >= 0 && (w += S2 * (_4 = 0 | y), T2 -= _4), new g(this.data, k, T2, A2, S2, w);
                }, x.step = function(b, y) {
                  var w = this.shape[0], _4 = this.shape[1], k = this.stride[0], T2 = this.stride[1], A2 = this.offset, S2 = 0, C2 = Math.ceil;
                  return typeof b == "number" && ((S2 = 0 | b) < 0 ? (A2 += k * (w - 1), w = C2(-w / S2)) : w = C2(w / S2), k *= S2), typeof y == "number" && ((S2 = 0 | y) < 0 ? (A2 += T2 * (_4 - 1), _4 = C2(-_4 / S2)) : _4 = C2(_4 / S2), T2 *= S2), new g(this.data, w, _4, k, T2, A2);
                }, x.transpose = function(b, y) {
                  b = b === void 0 ? 0 : 0 | b, y = y === void 0 ? 1 : 0 | y;
                  var w = this.shape, _4 = this.stride;
                  return new g(this.data, w[b], w[y], _4[b], _4[y], this.offset);
                }, x.pick = function(b, y) {
                  var w = [], _4 = [], k = this.offset;
                  return typeof b == "number" && b >= 0 ? k = k + this.stride[0] * b | 0 : (w.push(this.shape[0]), _4.push(this.stride[0])), typeof y == "number" && y >= 0 ? k = k + this.stride[1] * y | 0 : (w.push(this.shape[1]), _4.push(this.stride[1])), (0, v[w.length + 1])(this.data, w, _4, k);
                }, function(b, y, w, _4) {
                  return new g(b, y[0], y[1], w[0], w[1], _4);
                };
              }, 3: function(d, v, m) {
                function g(b, y, w, _4, k, T2, A2, S2) {
                  this.data = b, this.shape = [y, w, _4], this.stride = [k, T2, A2], this.offset = 0 | S2;
                }
                var x = g.prototype;
                return x.dtype = d, x.dimension = 3, Object.defineProperty(x, "size", { get: function() {
                  return this.shape[0] * this.shape[1] * this.shape[2];
                } }), Object.defineProperty(x, "order", { get: function() {
                  var b = Math.abs(this.stride[0]), y = Math.abs(this.stride[1]), w = Math.abs(this.stride[2]);
                  return b > y ? y > w ? [2, 1, 0] : b > w ? [1, 2, 0] : [1, 0, 2] : b > w ? [2, 0, 1] : w > y ? [0, 1, 2] : [0, 2, 1];
                } }), x.set = function(b, y, w, _4) {
                  return d === "generic" ? this.data.set(this.offset + this.stride[0] * b + this.stride[1] * y + this.stride[2] * w, _4) : this.data[this.offset + this.stride[0] * b + this.stride[1] * y + this.stride[2] * w] = _4;
                }, x.get = function(b, y, w) {
                  return d === "generic" ? this.data.get(this.offset + this.stride[0] * b + this.stride[1] * y + this.stride[2] * w) : this.data[this.offset + this.stride[0] * b + this.stride[1] * y + this.stride[2] * w];
                }, x.index = function(b, y, w) {
                  return this.offset + this.stride[0] * b + this.stride[1] * y + this.stride[2] * w;
                }, x.hi = function(b, y, w) {
                  return new g(this.data, typeof b != "number" || b < 0 ? this.shape[0] : 0 | b, typeof y != "number" || y < 0 ? this.shape[1] : 0 | y, typeof w != "number" || w < 0 ? this.shape[2] : 0 | w, this.stride[0], this.stride[1], this.stride[2], this.offset);
                }, x.lo = function(b, y, w) {
                  var _4 = this.offset, k = 0, T2 = this.shape[0], A2 = this.shape[1], S2 = this.shape[2], C2 = this.stride[0], E2 = this.stride[1], F13 = this.stride[2];
                  return typeof b == "number" && b >= 0 && (_4 += C2 * (k = 0 | b), T2 -= k), typeof y == "number" && y >= 0 && (_4 += E2 * (k = 0 | y), A2 -= k), typeof w == "number" && w >= 0 && (_4 += F13 * (k = 0 | w), S2 -= k), new g(this.data, T2, A2, S2, C2, E2, F13, _4);
                }, x.step = function(b, y, w) {
                  var _4 = this.shape[0], k = this.shape[1], T2 = this.shape[2], A2 = this.stride[0], S2 = this.stride[1], C2 = this.stride[2], E2 = this.offset, F13 = 0, N2 = Math.ceil;
                  return typeof b == "number" && ((F13 = 0 | b) < 0 ? (E2 += A2 * (_4 - 1), _4 = N2(-_4 / F13)) : _4 = N2(_4 / F13), A2 *= F13), typeof y == "number" && ((F13 = 0 | y) < 0 ? (E2 += S2 * (k - 1), k = N2(-k / F13)) : k = N2(k / F13), S2 *= F13), typeof w == "number" && ((F13 = 0 | w) < 0 ? (E2 += C2 * (T2 - 1), T2 = N2(-T2 / F13)) : T2 = N2(T2 / F13), C2 *= F13), new g(this.data, _4, k, T2, A2, S2, C2, E2);
                }, x.transpose = function(b, y, w) {
                  b = b === void 0 ? 0 : 0 | b, y = y === void 0 ? 1 : 0 | y, w = w === void 0 ? 2 : 0 | w;
                  var _4 = this.shape, k = this.stride;
                  return new g(this.data, _4[b], _4[y], _4[w], k[b], k[y], k[w], this.offset);
                }, x.pick = function(b, y, w) {
                  var _4 = [], k = [], T2 = this.offset;
                  return typeof b == "number" && b >= 0 ? T2 = T2 + this.stride[0] * b | 0 : (_4.push(this.shape[0]), k.push(this.stride[0])), typeof y == "number" && y >= 0 ? T2 = T2 + this.stride[1] * y | 0 : (_4.push(this.shape[1]), k.push(this.stride[1])), typeof w == "number" && w >= 0 ? T2 = T2 + this.stride[2] * w | 0 : (_4.push(this.shape[2]), k.push(this.stride[2])), (0, v[_4.length + 1])(this.data, _4, k, T2);
                }, function(b, y, w, _4) {
                  return new g(b, y[0], y[1], y[2], w[0], w[1], w[2], _4);
                };
              }, 4: function(d, v, m) {
                function g(b, y, w, _4, k, T2, A2, S2, C2, E2) {
                  this.data = b, this.shape = [y, w, _4, k], this.stride = [T2, A2, S2, C2], this.offset = 0 | E2;
                }
                var x = g.prototype;
                return x.dtype = d, x.dimension = 4, Object.defineProperty(x, "size", { get: function() {
                  return this.shape[0] * this.shape[1] * this.shape[2] * this.shape[3];
                } }), Object.defineProperty(x, "order", { get: m }), x.set = function(b, y, w, _4, k) {
                  return d === "generic" ? this.data.set(this.offset + this.stride[0] * b + this.stride[1] * y + this.stride[2] * w + this.stride[3] * _4, k) : this.data[this.offset + this.stride[0] * b + this.stride[1] * y + this.stride[2] * w + this.stride[3] * _4] = k;
                }, x.get = function(b, y, w, _4) {
                  return d === "generic" ? this.data.get(this.offset + this.stride[0] * b + this.stride[1] * y + this.stride[2] * w + this.stride[3] * _4) : this.data[this.offset + this.stride[0] * b + this.stride[1] * y + this.stride[2] * w + this.stride[3] * _4];
                }, x.index = function(b, y, w, _4) {
                  return this.offset + this.stride[0] * b + this.stride[1] * y + this.stride[2] * w + this.stride[3] * _4;
                }, x.hi = function(b, y, w, _4) {
                  return new g(this.data, typeof b != "number" || b < 0 ? this.shape[0] : 0 | b, typeof y != "number" || y < 0 ? this.shape[1] : 0 | y, typeof w != "number" || w < 0 ? this.shape[2] : 0 | w, typeof _4 != "number" || _4 < 0 ? this.shape[3] : 0 | _4, this.stride[0], this.stride[1], this.stride[2], this.stride[3], this.offset);
                }, x.lo = function(b, y, w, _4) {
                  var k = this.offset, T2 = 0, A2 = this.shape[0], S2 = this.shape[1], C2 = this.shape[2], E2 = this.shape[3], F13 = this.stride[0], N2 = this.stride[1], D2 = this.stride[2], I2 = this.stride[3];
                  return typeof b == "number" && b >= 0 && (k += F13 * (T2 = 0 | b), A2 -= T2), typeof y == "number" && y >= 0 && (k += N2 * (T2 = 0 | y), S2 -= T2), typeof w == "number" && w >= 0 && (k += D2 * (T2 = 0 | w), C2 -= T2), typeof _4 == "number" && _4 >= 0 && (k += I2 * (T2 = 0 | _4), E2 -= T2), new g(this.data, A2, S2, C2, E2, F13, N2, D2, I2, k);
                }, x.step = function(b, y, w, _4) {
                  var k = this.shape[0], T2 = this.shape[1], A2 = this.shape[2], S2 = this.shape[3], C2 = this.stride[0], E2 = this.stride[1], F13 = this.stride[2], N2 = this.stride[3], D2 = this.offset, I2 = 0, O2 = Math.ceil;
                  return typeof b == "number" && ((I2 = 0 | b) < 0 ? (D2 += C2 * (k - 1), k = O2(-k / I2)) : k = O2(k / I2), C2 *= I2), typeof y == "number" && ((I2 = 0 | y) < 0 ? (D2 += E2 * (T2 - 1), T2 = O2(-T2 / I2)) : T2 = O2(T2 / I2), E2 *= I2), typeof w == "number" && ((I2 = 0 | w) < 0 ? (D2 += F13 * (A2 - 1), A2 = O2(-A2 / I2)) : A2 = O2(A2 / I2), F13 *= I2), typeof _4 == "number" && ((I2 = 0 | _4) < 0 ? (D2 += N2 * (S2 - 1), S2 = O2(-S2 / I2)) : S2 = O2(S2 / I2), N2 *= I2), new g(this.data, k, T2, A2, S2, C2, E2, F13, N2, D2);
                }, x.transpose = function(b, y, w, _4) {
                  b = b === void 0 ? 0 : 0 | b, y = y === void 0 ? 1 : 0 | y, w = w === void 0 ? 2 : 0 | w, _4 = _4 === void 0 ? 3 : 0 | _4;
                  var k = this.shape, T2 = this.stride;
                  return new g(this.data, k[b], k[y], k[w], k[_4], T2[b], T2[y], T2[w], T2[_4], this.offset);
                }, x.pick = function(b, y, w, _4) {
                  var k = [], T2 = [], A2 = this.offset;
                  return typeof b == "number" && b >= 0 ? A2 = A2 + this.stride[0] * b | 0 : (k.push(this.shape[0]), T2.push(this.stride[0])), typeof y == "number" && y >= 0 ? A2 = A2 + this.stride[1] * y | 0 : (k.push(this.shape[1]), T2.push(this.stride[1])), typeof w == "number" && w >= 0 ? A2 = A2 + this.stride[2] * w | 0 : (k.push(this.shape[2]), T2.push(this.stride[2])), typeof _4 == "number" && _4 >= 0 ? A2 = A2 + this.stride[3] * _4 | 0 : (k.push(this.shape[3]), T2.push(this.stride[3])), (0, v[k.length + 1])(this.data, k, T2, A2);
                }, function(b, y, w, _4) {
                  return new g(b, y[0], y[1], y[2], y[3], w[0], w[1], w[2], w[3], _4);
                };
              }, 5: function(d, v, m) {
                function g(b, y, w, _4, k, T2, A2, S2, C2, E2, F13, N2) {
                  this.data = b, this.shape = [y, w, _4, k, T2], this.stride = [A2, S2, C2, E2, F13], this.offset = 0 | N2;
                }
                var x = g.prototype;
                return x.dtype = d, x.dimension = 5, Object.defineProperty(x, "size", { get: function() {
                  return this.shape[0] * this.shape[1] * this.shape[2] * this.shape[3] * this.shape[4];
                } }), Object.defineProperty(x, "order", { get: m }), x.set = function(b, y, w, _4, k, T2) {
                  return d === "generic" ? this.data.set(this.offset + this.stride[0] * b + this.stride[1] * y + this.stride[2] * w + this.stride[3] * _4 + this.stride[4] * k, T2) : this.data[this.offset + this.stride[0] * b + this.stride[1] * y + this.stride[2] * w + this.stride[3] * _4 + this.stride[4] * k] = T2;
                }, x.get = function(b, y, w, _4, k) {
                  return d === "generic" ? this.data.get(this.offset + this.stride[0] * b + this.stride[1] * y + this.stride[2] * w + this.stride[3] * _4 + this.stride[4] * k) : this.data[this.offset + this.stride[0] * b + this.stride[1] * y + this.stride[2] * w + this.stride[3] * _4 + this.stride[4] * k];
                }, x.index = function(b, y, w, _4, k) {
                  return this.offset + this.stride[0] * b + this.stride[1] * y + this.stride[2] * w + this.stride[3] * _4 + this.stride[4] * k;
                }, x.hi = function(b, y, w, _4, k) {
                  return new g(this.data, typeof b != "number" || b < 0 ? this.shape[0] : 0 | b, typeof y != "number" || y < 0 ? this.shape[1] : 0 | y, typeof w != "number" || w < 0 ? this.shape[2] : 0 | w, typeof _4 != "number" || _4 < 0 ? this.shape[3] : 0 | _4, typeof k != "number" || k < 0 ? this.shape[4] : 0 | k, this.stride[0], this.stride[1], this.stride[2], this.stride[3], this.stride[4], this.offset);
                }, x.lo = function(b, y, w, _4, k) {
                  var T2 = this.offset, A2 = 0, S2 = this.shape[0], C2 = this.shape[1], E2 = this.shape[2], F13 = this.shape[3], N2 = this.shape[4], D2 = this.stride[0], I2 = this.stride[1], O2 = this.stride[2], L2 = this.stride[3], V2 = this.stride[4];
                  return typeof b == "number" && b >= 0 && (T2 += D2 * (A2 = 0 | b), S2 -= A2), typeof y == "number" && y >= 0 && (T2 += I2 * (A2 = 0 | y), C2 -= A2), typeof w == "number" && w >= 0 && (T2 += O2 * (A2 = 0 | w), E2 -= A2), typeof _4 == "number" && _4 >= 0 && (T2 += L2 * (A2 = 0 | _4), F13 -= A2), typeof k == "number" && k >= 0 && (T2 += V2 * (A2 = 0 | k), N2 -= A2), new g(this.data, S2, C2, E2, F13, N2, D2, I2, O2, L2, V2, T2);
                }, x.step = function(b, y, w, _4, k) {
                  var T2 = this.shape[0], A2 = this.shape[1], S2 = this.shape[2], C2 = this.shape[3], E2 = this.shape[4], F13 = this.stride[0], N2 = this.stride[1], D2 = this.stride[2], I2 = this.stride[3], O2 = this.stride[4], L2 = this.offset, V2 = 0, W2 = Math.ceil;
                  return typeof b == "number" && ((V2 = 0 | b) < 0 ? (L2 += F13 * (T2 - 1), T2 = W2(-T2 / V2)) : T2 = W2(T2 / V2), F13 *= V2), typeof y == "number" && ((V2 = 0 | y) < 0 ? (L2 += N2 * (A2 - 1), A2 = W2(-A2 / V2)) : A2 = W2(A2 / V2), N2 *= V2), typeof w == "number" && ((V2 = 0 | w) < 0 ? (L2 += D2 * (S2 - 1), S2 = W2(-S2 / V2)) : S2 = W2(S2 / V2), D2 *= V2), typeof _4 == "number" && ((V2 = 0 | _4) < 0 ? (L2 += I2 * (C2 - 1), C2 = W2(-C2 / V2)) : C2 = W2(C2 / V2), I2 *= V2), typeof k == "number" && ((V2 = 0 | k) < 0 ? (L2 += O2 * (E2 - 1), E2 = W2(-E2 / V2)) : E2 = W2(E2 / V2), O2 *= V2), new g(this.data, T2, A2, S2, C2, E2, F13, N2, D2, I2, O2, L2);
                }, x.transpose = function(b, y, w, _4, k) {
                  b = b === void 0 ? 0 : 0 | b, y = y === void 0 ? 1 : 0 | y, w = w === void 0 ? 2 : 0 | w, _4 = _4 === void 0 ? 3 : 0 | _4, k = k === void 0 ? 4 : 0 | k;
                  var T2 = this.shape, A2 = this.stride;
                  return new g(this.data, T2[b], T2[y], T2[w], T2[_4], T2[k], A2[b], A2[y], A2[w], A2[_4], A2[k], this.offset);
                }, x.pick = function(b, y, w, _4, k) {
                  var T2 = [], A2 = [], S2 = this.offset;
                  return typeof b == "number" && b >= 0 ? S2 = S2 + this.stride[0] * b | 0 : (T2.push(this.shape[0]), A2.push(this.stride[0])), typeof y == "number" && y >= 0 ? S2 = S2 + this.stride[1] * y | 0 : (T2.push(this.shape[1]), A2.push(this.stride[1])), typeof w == "number" && w >= 0 ? S2 = S2 + this.stride[2] * w | 0 : (T2.push(this.shape[2]), A2.push(this.stride[2])), typeof _4 == "number" && _4 >= 0 ? S2 = S2 + this.stride[3] * _4 | 0 : (T2.push(this.shape[3]), A2.push(this.stride[3])), typeof k == "number" && k >= 0 ? S2 = S2 + this.stride[4] * k | 0 : (T2.push(this.shape[4]), A2.push(this.stride[4])), (0, v[T2.length + 1])(this.data, T2, A2, S2);
                }, function(b, y, w, _4) {
                  return new g(b, y[0], y[1], y[2], y[3], y[4], w[0], w[1], w[2], w[3], w[4], _4);
                };
              } };
              function h(d, v) {
                var m = v === -1 ? "T" : String(v), g = f[m];
                return v === -1 ? g(d) : v === 0 ? g(d, p[d][0]) : g(d, p[d], c);
              }
              var p = { generic: [], buffer: [], array: [], float32: [], float64: [], int8: [], int16: [], int32: [], uint8_clamped: [], uint8: [], uint16: [], uint32: [], bigint64: [], biguint64: [] };
              o.exports = function(d, v, m, g) {
                if (d === void 0) return (0, p.array[0])([]);
                typeof d == "number" && (d = [d]), v === void 0 && (v = [d.length]);
                var x = v.length;
                if (m === void 0) {
                  m = new Array(x);
                  for (var b = x - 1, y = 1; b >= 0; --b) m[b] = y, y *= v[b];
                }
                if (g === void 0) for (g = 0, b = 0; b < x; ++b) m[b] < 0 && (g -= (v[b] - 1) * m[b]);
                for (var w = function(k) {
                  if (i(k)) return "buffer";
                  if (l) switch (Object.prototype.toString.call(k)) {
                    case "[object Float64Array]":
                      return "float64";
                    case "[object Float32Array]":
                      return "float32";
                    case "[object Int8Array]":
                      return "int8";
                    case "[object Int16Array]":
                      return "int16";
                    case "[object Int32Array]":
                      return "int32";
                    case "[object Uint8ClampedArray]":
                      return "uint8_clamped";
                    case "[object Uint8Array]":
                      return "uint8";
                    case "[object Uint16Array]":
                      return "uint16";
                    case "[object Uint32Array]":
                      return "uint32";
                    case "[object BigInt64Array]":
                      return "bigint64";
                    case "[object BigUint64Array]":
                      return "biguint64";
                  }
                  return Array.isArray(k) ? "array" : "generic";
                }(d), _4 = p[w]; _4.length <= x + 1; ) _4.push(h(w, _4.length - 1));
                return (0, _4[x + 1])(d, v, m, g);
              };
            }, { "is-buffer": 237 }], 260: [function(a, o, s) {
              "use strict";
              var i = a("double-bits"), l = Math.pow(2, -1074);
              o.exports = function(u2, c) {
                if (isNaN(u2) || isNaN(c)) return NaN;
                if (u2 === c) return u2;
                if (u2 === 0) return c < 0 ? -l : l;
                var f = i.hi(u2), h = i.lo(u2);
                return c > u2 == u2 > 0 ? h === -1 >>> 0 ? (f += 1, h = 0) : h += 1 : h === 0 ? (h = -1 >>> 0, f -= 1) : h -= 1, i.pack(h, f);
              };
            }, { "double-bits": 64 }], 261: [function(a, o, s) {
              s.vertexNormals = function(i, l, u2) {
                for (var c = l.length, f = new Array(c), h = u2 === void 0 ? 1e-6 : u2, p = 0; p < c; ++p) f[p] = [0, 0, 0];
                for (p = 0; p < i.length; ++p) for (var d = i[p], v = 0, m = d[d.length - 1], g = d[0], x = 0; x < d.length; ++x) {
                  v = m, m = g, g = d[(x + 1) % d.length];
                  for (var b = l[v], y = l[m], w = l[g], _4 = new Array(3), k = 0, T2 = new Array(3), A2 = 0, S2 = 0; S2 < 3; ++S2) _4[S2] = b[S2] - y[S2], k += _4[S2] * _4[S2], T2[S2] = w[S2] - y[S2], A2 += T2[S2] * T2[S2];
                  if (k * A2 > h) {
                    var C2 = f[m], E2 = 1 / Math.sqrt(k * A2);
                    for (S2 = 0; S2 < 3; ++S2) {
                      var F13 = (S2 + 1) % 3, N2 = (S2 + 2) % 3;
                      C2[S2] += E2 * (T2[F13] * _4[N2] - T2[N2] * _4[F13]);
                    }
                  }
                }
                for (p = 0; p < c; ++p) {
                  C2 = f[p];
                  var D2 = 0;
                  for (S2 = 0; S2 < 3; ++S2) D2 += C2[S2] * C2[S2];
                  if (D2 > h) for (E2 = 1 / Math.sqrt(D2), S2 = 0; S2 < 3; ++S2) C2[S2] *= E2;
                  else for (S2 = 0; S2 < 3; ++S2) C2[S2] = 0;
                }
                return f;
              }, s.faceNormals = function(i, l, u2) {
                for (var c = i.length, f = new Array(c), h = u2 === void 0 ? 1e-6 : u2, p = 0; p < c; ++p) {
                  for (var d = i[p], v = new Array(3), m = 0; m < 3; ++m) v[m] = l[d[m]];
                  var g = new Array(3), x = new Array(3);
                  for (m = 0; m < 3; ++m) g[m] = v[1][m] - v[0][m], x[m] = v[2][m] - v[0][m];
                  var b = new Array(3), y = 0;
                  for (m = 0; m < 3; ++m) {
                    var w = (m + 1) % 3, _4 = (m + 2) % 3;
                    b[m] = g[w] * x[_4] - g[_4] * x[w], y += b[m] * b[m];
                  }
                  for (y = y > h ? 1 / Math.sqrt(y) : 0, m = 0; m < 3; ++m) b[m] *= y;
                  f[p] = b;
                }
                return f;
              };
            }, {}], 262: [function(a, o, s) {
              "use strict";
              o.exports = function(i, l, u2, c, f, h, p, d, v, m) {
                var g = l + h + m;
                if (x > 0) {
                  var x = Math.sqrt(g + 1);
                  i[0] = 0.5 * (p - v) / x, i[1] = 0.5 * (d - c) / x, i[2] = 0.5 * (u2 - h) / x, i[3] = 0.5 * x;
                } else {
                  var b = Math.max(l, h, m);
                  x = Math.sqrt(2 * b - g + 1), l >= b ? (i[0] = 0.5 * x, i[1] = 0.5 * (f + u2) / x, i[2] = 0.5 * (d + c) / x, i[3] = 0.5 * (p - v) / x) : h >= b ? (i[0] = 0.5 * (u2 + f) / x, i[1] = 0.5 * x, i[2] = 0.5 * (v + p) / x, i[3] = 0.5 * (d - c) / x) : (i[0] = 0.5 * (c + d) / x, i[1] = 0.5 * (p + v) / x, i[2] = 0.5 * x, i[3] = 0.5 * (u2 - f) / x);
                }
                return i;
              };
            }, {}], 263: [function(a, o, s) {
              "use strict";
              o.exports = function(g) {
                var x = (g = g || {}).center || [0, 0, 0], b = g.rotation || [0, 0, 0, 1], y = g.radius || 1;
                x = [].slice.call(x, 0, 3), d(b = [].slice.call(b, 0, 4), b);
                var w = new v(b, x, Math.log(y));
                return w.setDistanceLimits(g.zoomMin, g.zoomMax), ("eye" in g || "up" in g) && w.lookAt(0, g.eye, g.center, g.up), w;
              };
              var i = a("filtered-vector"), l = a("gl-mat4/lookAt"), u2 = a("gl-mat4/fromQuat"), c = a("gl-mat4/invert"), f = a("./lib/quatFromFrame");
              function h(g, x, b) {
                return Math.sqrt(Math.pow(g, 2) + Math.pow(x, 2) + Math.pow(b, 2));
              }
              function p(g, x, b, y) {
                return Math.sqrt(Math.pow(g, 2) + Math.pow(x, 2) + Math.pow(b, 2) + Math.pow(y, 2));
              }
              function d(g, x) {
                var b = x[0], y = x[1], w = x[2], _4 = x[3], k = p(b, y, w, _4);
                k > 1e-6 ? (g[0] = b / k, g[1] = y / k, g[2] = w / k, g[3] = _4 / k) : (g[0] = g[1] = g[2] = 0, g[3] = 1);
              }
              function v(g, x, b) {
                this.radius = i([b]), this.center = i(x), this.rotation = i(g), this.computedRadius = this.radius.curve(0), this.computedCenter = this.center.curve(0), this.computedRotation = this.rotation.curve(0), this.computedUp = [0.1, 0, 0], this.computedEye = [0.1, 0, 0], this.computedMatrix = [0.1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], this.recalcMatrix(0);
              }
              var m = v.prototype;
              m.lastT = function() {
                return Math.max(this.radius.lastT(), this.center.lastT(), this.rotation.lastT());
              }, m.recalcMatrix = function(g) {
                this.radius.curve(g), this.center.curve(g), this.rotation.curve(g);
                var x = this.computedRotation;
                d(x, x);
                var b = this.computedMatrix;
                u2(b, x);
                var y = this.computedCenter, w = this.computedEye, _4 = this.computedUp, k = Math.exp(this.computedRadius[0]);
                w[0] = y[0] + k * b[2], w[1] = y[1] + k * b[6], w[2] = y[2] + k * b[10], _4[0] = b[1], _4[1] = b[5], _4[2] = b[9];
                for (var T2 = 0; T2 < 3; ++T2) {
                  for (var A2 = 0, S2 = 0; S2 < 3; ++S2) A2 += b[T2 + 4 * S2] * w[S2];
                  b[12 + T2] = -A2;
                }
              }, m.getMatrix = function(g, x) {
                this.recalcMatrix(g);
                var b = this.computedMatrix;
                if (x) {
                  for (var y = 0; y < 16; ++y) x[y] = b[y];
                  return x;
                }
                return b;
              }, m.idle = function(g) {
                this.center.idle(g), this.radius.idle(g), this.rotation.idle(g);
              }, m.flush = function(g) {
                this.center.flush(g), this.radius.flush(g), this.rotation.flush(g);
              }, m.pan = function(g, x, b, y) {
                x = x || 0, b = b || 0, y = y || 0, this.recalcMatrix(g);
                var w = this.computedMatrix, _4 = w[1], k = w[5], T2 = w[9], A2 = h(_4, k, T2);
                _4 /= A2, k /= A2, T2 /= A2;
                var S2 = w[0], C2 = w[4], E2 = w[8], F13 = S2 * _4 + C2 * k + E2 * T2, N2 = h(S2 -= _4 * F13, C2 -= k * F13, E2 -= T2 * F13);
                S2 /= N2, C2 /= N2, E2 /= N2;
                var D2 = w[2], I2 = w[6], O2 = w[10], L2 = D2 * _4 + I2 * k + O2 * T2, V2 = D2 * S2 + I2 * C2 + O2 * E2, W2 = h(D2 -= L2 * _4 + V2 * S2, I2 -= L2 * k + V2 * C2, O2 -= L2 * T2 + V2 * E2);
                D2 /= W2, I2 /= W2, O2 /= W2;
                var X2 = S2 * x + _4 * b, Y2 = C2 * x + k * b, K2 = E2 * x + T2 * b;
                this.center.move(g, X2, Y2, K2);
                var q = Math.exp(this.computedRadius[0]);
                q = Math.max(1e-4, q + y), this.radius.set(g, Math.log(q));
              }, m.rotate = function(g, x, b, y) {
                this.recalcMatrix(g), x = x || 0, b = b || 0;
                var w = this.computedMatrix, _4 = w[0], k = w[4], T2 = w[8], A2 = w[1], S2 = w[5], C2 = w[9], E2 = w[2], F13 = w[6], N2 = w[10], D2 = x * _4 + b * A2, I2 = x * k + b * S2, O2 = x * T2 + b * C2, L2 = -(F13 * O2 - N2 * I2), V2 = -(N2 * D2 - E2 * O2), W2 = -(E2 * I2 - F13 * D2), X2 = Math.sqrt(Math.max(0, 1 - Math.pow(L2, 2) - Math.pow(V2, 2) - Math.pow(W2, 2))), Y2 = p(L2, V2, W2, X2);
                Y2 > 1e-6 ? (L2 /= Y2, V2 /= Y2, W2 /= Y2, X2 /= Y2) : (L2 = V2 = W2 = 0, X2 = 1);
                var K2 = this.computedRotation, q = K2[0], re = K2[1], R2 = K2[2], z = K2[3], H2 = q * X2 + z * L2 + re * W2 - R2 * V2, te = re * X2 + z * V2 + R2 * L2 - q * W2, j = R2 * X2 + z * W2 + q * V2 - re * L2, Q2 = z * X2 - q * L2 - re * V2 - R2 * W2;
                if (y) {
                  L2 = E2, V2 = F13, W2 = N2;
                  var Z2 = Math.sin(y) / h(L2, V2, W2);
                  L2 *= Z2, V2 *= Z2, W2 *= Z2, Q2 = Q2 * (X2 = Math.cos(x)) - (H2 = H2 * X2 + Q2 * L2 + te * W2 - j * V2) * L2 - (te = te * X2 + Q2 * V2 + j * L2 - H2 * W2) * V2 - (j = j * X2 + Q2 * W2 + H2 * V2 - te * L2) * W2;
                }
                var ne = p(H2, te, j, Q2);
                ne > 1e-6 ? (H2 /= ne, te /= ne, j /= ne, Q2 /= ne) : (H2 = te = j = 0, Q2 = 1), this.rotation.set(g, H2, te, j, Q2);
              }, m.lookAt = function(g, x, b, y) {
                this.recalcMatrix(g), b = b || this.computedCenter, x = x || this.computedEye, y = y || this.computedUp;
                var w = this.computedMatrix;
                l(w, x, b, y);
                var _4 = this.computedRotation;
                f(_4, w[0], w[1], w[2], w[4], w[5], w[6], w[8], w[9], w[10]), d(_4, _4), this.rotation.set(g, _4[0], _4[1], _4[2], _4[3]);
                for (var k = 0, T2 = 0; T2 < 3; ++T2) k += Math.pow(b[T2] - x[T2], 2);
                this.radius.set(g, 0.5 * Math.log(Math.max(k, 1e-6))), this.center.set(g, b[0], b[1], b[2]);
              }, m.translate = function(g, x, b, y) {
                this.center.move(g, x || 0, b || 0, y || 0);
              }, m.setMatrix = function(g, x) {
                var b = this.computedRotation;
                f(b, x[0], x[1], x[2], x[4], x[5], x[6], x[8], x[9], x[10]), d(b, b), this.rotation.set(g, b[0], b[1], b[2], b[3]);
                var y = this.computedMatrix;
                c(y, x);
                var w = y[15];
                if (Math.abs(w) > 1e-6) {
                  var _4 = y[12] / w, k = y[13] / w, T2 = y[14] / w;
                  this.recalcMatrix(g);
                  var A2 = Math.exp(this.computedRadius[0]);
                  this.center.set(g, _4 - y[2] * A2, k - y[6] * A2, T2 - y[10] * A2), this.radius.idle(g);
                } else this.center.idle(g), this.radius.idle(g);
              }, m.setDistance = function(g, x) {
                x > 0 && this.radius.set(g, Math.log(x));
              }, m.setDistanceLimits = function(g, x) {
                g = g > 0 ? Math.log(g) : -1 / 0, x = x > 0 ? Math.log(x) : 1 / 0, x = Math.max(x, g), this.radius.bounds[0][0] = g, this.radius.bounds[1][0] = x;
              }, m.getDistanceLimits = function(g) {
                var x = this.radius.bounds;
                return g ? (g[0] = Math.exp(x[0][0]), g[1] = Math.exp(x[1][0]), g) : [Math.exp(x[0][0]), Math.exp(x[1][0])];
              }, m.toJSON = function() {
                return this.recalcMatrix(this.lastT()), { center: this.computedCenter.slice(), rotation: this.computedRotation.slice(), distance: Math.log(this.computedRadius[0]), zoomMin: this.radius.bounds[0][0], zoomMax: this.radius.bounds[1][0] };
              }, m.fromJSON = function(g) {
                var x = this.lastT(), b = g.center;
                b && this.center.set(x, b[0], b[1], b[2]);
                var y = g.rotation;
                y && this.rotation.set(x, y[0], y[1], y[2], y[3]);
                var w = g.distance;
                w && w > 0 && this.radius.set(x, Math.log(w)), this.setDistanceLimits(g.zoomMin, g.zoomMax);
              };
            }, { "./lib/quatFromFrame": 262, "filtered-vector": 68, "gl-mat4/fromQuat": 95, "gl-mat4/invert": 98, "gl-mat4/lookAt": 99 }], 264: [function(a, o, s) {
              "use strict";
              var i = a("repeat-string");
              o.exports = function(l, u2, c) {
                return i(c = c !== void 0 ? c + "" : " ", u2) + l;
              };
            }, { "repeat-string": 277 }], 265: [function(a, o, s) {
              o.exports = function(i, l) {
                l || (l = [0, ""]), i = String(i);
                var u2 = parseFloat(i, 10);
                return l[0] = u2, l[1] = i.match(/[\d.\-\+]*\s*(.*)/)[1] || "", l;
              };
            }, {}], 266: [function(a, o, s) {
              "use strict";
              o.exports = function(l, u2) {
                for (var c = 0 | u2.length, f = l.length, h = [new Array(c), new Array(c)], p = 0; p < c; ++p) h[0][p] = [], h[1][p] = [];
                for (p = 0; p < f; ++p) {
                  var d = l[p];
                  h[0][d[0]].push(d), h[1][d[1]].push(d);
                }
                var v = [];
                for (p = 0; p < c; ++p) h[0][p].length + h[1][p].length === 0 && v.push([p]);
                function m(k, T2) {
                  var A2 = h[T2][k[T2]];
                  A2.splice(A2.indexOf(k), 1);
                }
                function g(k, T2, A2) {
                  for (var S2, C2, E2, F13 = 0; F13 < 2; ++F13) if (h[F13][T2].length > 0) {
                    S2 = h[F13][T2][0], E2 = F13;
                    break;
                  }
                  C2 = S2[1 ^ E2];
                  for (var N2 = 0; N2 < 2; ++N2) for (var D2 = h[N2][T2], I2 = 0; I2 < D2.length; ++I2) {
                    var O2 = D2[I2], L2 = O2[1 ^ N2];
                    i(u2[k], u2[T2], u2[C2], u2[L2]) > 0 && (S2 = O2, C2 = L2, E2 = N2);
                  }
                  return A2 || S2 && m(S2, E2), C2;
                }
                function x(k, T2) {
                  var A2 = h[T2][k][0], S2 = [k];
                  m(A2, T2);
                  for (var C2 = A2[1 ^ T2]; ; ) {
                    for (; C2 !== k; ) S2.push(C2), C2 = g(S2[S2.length - 2], C2, false);
                    if (h[0][k].length + h[1][k].length === 0) break;
                    var E2 = S2[S2.length - 1], F13 = k, N2 = S2[1], D2 = g(E2, F13, true);
                    if (i(u2[E2], u2[F13], u2[N2], u2[D2]) < 0) break;
                    S2.push(k), C2 = g(E2, F13);
                  }
                  return S2;
                }
                function b(k, T2) {
                  return T2[1] === T2[T2.length - 1];
                }
                for (p = 0; p < c; ++p) for (var y = 0; y < 2; ++y) {
                  for (var w = []; h[y][p].length > 0; ) {
                    h[0][p].length;
                    var _4 = x(p, y);
                    b(0, _4) ? w.push.apply(w, _4) : (w.length > 0 && v.push(w), w = _4);
                  }
                  w.length > 0 && v.push(w);
                }
                return v;
              };
              var i = a("compare-angle");
            }, { "compare-angle": 54 }], 267: [function(a, o, s) {
              "use strict";
              o.exports = function(l, u2) {
                for (var c = i(l, u2.length), f = new Array(u2.length), h = new Array(u2.length), p = [], d = 0; d < u2.length; ++d) {
                  var v = c[d].length;
                  h[d] = v, f[d] = true, v <= 1 && p.push(d);
                }
                for (; p.length > 0; ) {
                  var m = p.pop();
                  f[m] = false;
                  var g = c[m];
                  for (d = 0; d < g.length; ++d) {
                    var x = g[d];
                    --h[x] == 0 && p.push(x);
                  }
                }
                var b = new Array(u2.length), y = [];
                for (d = 0; d < u2.length; ++d) f[d] ? (m = y.length, b[d] = m, y.push(u2[d])) : b[d] = -1;
                var w = [];
                for (d = 0; d < l.length; ++d) {
                  var _4 = l[d];
                  f[_4[0]] && f[_4[1]] && w.push([b[_4[0]], b[_4[1]]]);
                }
                return [w, y];
              };
              var i = a("edges-to-adjacency-list");
            }, { "edges-to-adjacency-list": 66 }], 268: [function(a, o, s) {
              "use strict";
              o.exports = function(v, m) {
                var g = p(v, m);
                v = g[0];
                for (var x = (m = g[1]).length, b = (v.length, i(v, m.length)), y = 0; y < x; ++y) if (b[y].length % 2 == 1) throw new Error("planar-graph-to-polyline: graph must be manifold");
                var w = l(v, m), _4 = (w = w.filter(function(le) {
                  for (var ce = le.length, se = [0], he = 0; he < ce; ++he) {
                    var me = m[le[he]], we = m[le[(he + 1) % ce]], be = c(-me[0], me[1]), Ae = c(-me[0], we[1]), pe = c(we[0], me[1]), ve = c(we[0], we[1]);
                    se = f(se, f(f(be, Ae), f(pe, ve)));
                  }
                  return se[se.length - 1] > 0;
                })).length, k = new Array(_4), T2 = new Array(_4);
                for (y = 0; y < _4; ++y) {
                  k[y] = y;
                  var A2 = new Array(_4), S2 = w[y].map(function(le) {
                    return m[le];
                  }), C2 = u2([S2]), E2 = 0;
                  e: for (var F13 = 0; F13 < _4; ++F13) if (A2[F13] = 0, y !== F13) {
                    for (var N2 = (ae = w[F13]).length, D2 = 0; D2 < N2; ++D2) {
                      var I2 = C2(m[ae[D2]]);
                      if (I2 !== 0) {
                        I2 < 0 && (A2[F13] = 1, E2 += 1);
                        continue e;
                      }
                    }
                    A2[F13] = 1, E2 += 1;
                  }
                  T2[y] = [E2, y, A2];
                }
                for (T2.sort(function(le, ce) {
                  return ce[0] - le[0];
                }), y = 0; y < _4; ++y) {
                  var O2 = (A2 = T2[y])[1], L2 = A2[2];
                  for (F13 = 0; F13 < _4; ++F13) L2[F13] && (k[F13] = O2);
                }
                var V2 = function(le) {
                  for (var ce = new Array(le), se = 0; se < le; ++se) ce[se] = [];
                  return ce;
                }(_4);
                for (y = 0; y < _4; ++y) V2[y].push(k[y]), V2[k[y]].push(y);
                var W2 = {}, X2 = d(x, false);
                for (y = 0; y < _4; ++y) for (N2 = (ae = w[y]).length, F13 = 0; F13 < N2; ++F13) {
                  var Y2 = ae[F13], K2 = ae[(F13 + 1) % N2], q = Math.min(Y2, K2) + ":" + Math.max(Y2, K2);
                  if (q in W2) {
                    var re = W2[q];
                    V2[re].push(y), V2[y].push(re), X2[Y2] = X2[K2] = true;
                  } else W2[q] = y;
                }
                function R2(le) {
                  for (var ce = le.length, se = 0; se < ce; ++se) if (!X2[le[se]]) return false;
                  return true;
                }
                var z = [], H2 = d(_4, -1);
                for (y = 0; y < _4; ++y) k[y] !== y || R2(w[y]) ? H2[y] = -1 : (z.push(y), H2[y] = 0);
                for (g = []; z.length > 0; ) {
                  var te = z.pop(), j = V2[te];
                  h(j, function(le, ce) {
                    return le - ce;
                  });
                  var Q2, Z2 = j.length, ne = H2[te];
                  if (ne === 0) {
                    var ae = w[te];
                    Q2 = [ae];
                  }
                  for (y = 0; y < Z2; ++y) {
                    var ue = j[y];
                    H2[ue] >= 0 || (H2[ue] = 1 ^ ne, z.push(ue), ne === 0 && (R2(ae = w[ue]) || (ae.reverse(), Q2.push(ae))));
                  }
                  ne === 0 && g.push(Q2);
                }
                return g;
              };
              var i = a("edges-to-adjacency-list"), l = a("planar-dual"), u2 = a("point-in-big-polygon"), c = a("two-product"), f = a("robust-sum"), h = a("uniq"), p = a("./lib/trim-leaves");
              function d(v, m) {
                for (var g = new Array(v), x = 0; x < v; ++x) g[x] = m;
                return g;
              }
            }, { "./lib/trim-leaves": 267, "edges-to-adjacency-list": 66, "planar-dual": 266, "point-in-big-polygon": 269, "robust-sum": 289, "two-product": 306, uniq: 310 }], 269: [function(a, o, s) {
              o.exports = function(d) {
                for (var v = d.length, m = [], g = [], x = 0; x < v; ++x) for (var b = d[x], y = b.length, w = y - 1, _4 = 0; _4 < y; w = _4++) {
                  var k = b[w], T2 = b[_4];
                  k[0] === T2[0] ? g.push([k, T2]) : m.push([k, T2]);
                }
                if (m.length === 0) return g.length === 0 ? p : (A2 = h(g), function(E2) {
                  return A2(E2[0], E2[1]) ? 0 : 1;
                });
                var A2, S2 = l(m), C2 = /* @__PURE__ */ function(E2, F13) {
                  return function(N2) {
                    var D2 = c.le(F13, N2[0]);
                    if (D2 < 0) return 1;
                    var I2 = E2[D2];
                    if (!I2) {
                      if (!(D2 > 0 && F13[D2] === N2[0])) return 1;
                      I2 = E2[D2 - 1];
                    }
                    for (var O2 = 1; I2; ) {
                      var L2 = I2.key, V2 = i(N2, L2[0], L2[1]);
                      if (L2[0][0] < L2[1][0]) if (V2 < 0) I2 = I2.left;
                      else {
                        if (!(V2 > 0)) return 0;
                        O2 = -1, I2 = I2.right;
                      }
                      else if (V2 > 0) I2 = I2.left;
                      else {
                        if (!(V2 < 0)) return 0;
                        O2 = 1, I2 = I2.right;
                      }
                    }
                    return O2;
                  };
                }(S2.slabs, S2.coordinates);
                return g.length === 0 ? C2 : /* @__PURE__ */ function(E2, F13) {
                  return function(N2) {
                    return E2(N2[0], N2[1]) ? 0 : F13(N2);
                  };
                }(h(g), C2);
              };
              var i = a("robust-orientation")[3], l = a("slab-decomposition"), u2 = a("interval-tree-1d"), c = a("binary-search-bounds");
              function f() {
                return true;
              }
              function h(d) {
                for (var v = {}, m = 0; m < d.length; ++m) {
                  var g = d[m], x = g[0][0], b = g[0][1], y = g[1][1], w = [Math.min(b, y), Math.max(b, y)];
                  x in v ? v[x].push(w) : v[x] = [w];
                }
                var _4 = {}, k = Object.keys(v);
                for (m = 0; m < k.length; ++m) {
                  var T2 = v[k[m]];
                  _4[k[m]] = u2(T2);
                }
                return /* @__PURE__ */ function(A2) {
                  return function(S2, C2) {
                    var E2 = A2[S2];
                    return !!E2 && !!E2.queryPoint(C2, f);
                  };
                }(_4);
              }
              function p(d) {
                return 1;
              }
            }, { "binary-search-bounds": 31, "interval-tree-1d": 234, "robust-orientation": 284, "slab-decomposition": 299 }], 270: [function(a, o, s) {
              "use strict";
              var i = new Float64Array(4), l = new Float64Array(4), u2 = new Float64Array(4);
              o.exports = function(c, f, h, p, d) {
                i.length < p.length && (i = new Float64Array(p.length), l = new Float64Array(p.length), u2 = new Float64Array(p.length));
                for (var v = 0; v < p.length; ++v) i[v] = c[v] - p[v], l[v] = f[v] - c[v], u2[v] = h[v] - c[v];
                var m = 0, g = 0, x = 0, b = 0, y = 0, w = 0;
                for (v = 0; v < p.length; ++v) {
                  var _4 = l[v], k = u2[v], T2 = i[v];
                  m += _4 * _4, g += _4 * k, x += k * k, b += T2 * _4, y += T2 * k, w += T2 * T2;
                }
                var A2, S2, C2, E2, F13, N2 = Math.abs(m * x - g * g), D2 = g * y - x * b, I2 = g * b - m * y;
                if (D2 + I2 <= N2) if (D2 < 0) I2 < 0 && b < 0 ? (I2 = 0, -b >= m ? (D2 = 1, A2 = m + 2 * b + w) : A2 = b * (D2 = -b / m) + w) : (D2 = 0, y >= 0 ? (I2 = 0, A2 = w) : -y >= x ? (I2 = 1, A2 = x + 2 * y + w) : A2 = y * (I2 = -y / x) + w);
                else if (I2 < 0) I2 = 0, b >= 0 ? (D2 = 0, A2 = w) : -b >= m ? (D2 = 1, A2 = m + 2 * b + w) : A2 = b * (D2 = -b / m) + w;
                else {
                  var O2 = 1 / N2;
                  A2 = (D2 *= O2) * (m * D2 + g * (I2 *= O2) + 2 * b) + I2 * (g * D2 + x * I2 + 2 * y) + w;
                }
                else D2 < 0 ? (C2 = x + y) > (S2 = g + b) ? (E2 = C2 - S2) >= (F13 = m - 2 * g + x) ? (D2 = 1, I2 = 0, A2 = m + 2 * b + w) : A2 = (D2 = E2 / F13) * (m * D2 + g * (I2 = 1 - D2) + 2 * b) + I2 * (g * D2 + x * I2 + 2 * y) + w : (D2 = 0, C2 <= 0 ? (I2 = 1, A2 = x + 2 * y + w) : y >= 0 ? (I2 = 0, A2 = w) : A2 = y * (I2 = -y / x) + w) : I2 < 0 ? (C2 = m + b) > (S2 = g + y) ? (E2 = C2 - S2) >= (F13 = m - 2 * g + x) ? (I2 = 1, D2 = 0, A2 = x + 2 * y + w) : A2 = (D2 = 1 - (I2 = E2 / F13)) * (m * D2 + g * I2 + 2 * b) + I2 * (g * D2 + x * I2 + 2 * y) + w : (I2 = 0, C2 <= 0 ? (D2 = 1, A2 = m + 2 * b + w) : b >= 0 ? (D2 = 0, A2 = w) : A2 = b * (D2 = -b / m) + w) : (E2 = x + y - g - b) <= 0 ? (D2 = 0, I2 = 1, A2 = x + 2 * y + w) : E2 >= (F13 = m - 2 * g + x) ? (D2 = 1, I2 = 0, A2 = m + 2 * b + w) : A2 = (D2 = E2 / F13) * (m * D2 + g * (I2 = 1 - D2) + 2 * b) + I2 * (g * D2 + x * I2 + 2 * y) + w;
                var L2 = 1 - D2 - I2;
                for (v = 0; v < p.length; ++v) d[v] = L2 * c[v] + D2 * f[v] + I2 * h[v];
                return A2 < 0 ? 0 : A2;
              };
            }, {}], 271: [function(a, o, s) {
              o.exports = a("gl-quat/slerp");
            }, { "gl-quat/slerp": 124 }], 272: [function(a, o, s) {
              "use strict";
              var i = a("big-rat/add");
              o.exports = function(l, u2) {
                for (var c = l.length, f = new Array(c), h = 0; h < c; ++h) f[h] = i(l[h], u2[h]);
                return f;
              };
            }, { "big-rat/add": 15 }], 273: [function(a, o, s) {
              "use strict";
              o.exports = function(l) {
                for (var u2 = new Array(l.length), c = 0; c < l.length; ++c) u2[c] = i(l[c]);
                return u2;
              };
              var i = a("big-rat");
            }, { "big-rat": 18 }], 274: [function(a, o, s) {
              "use strict";
              var i = a("big-rat"), l = a("big-rat/mul");
              o.exports = function(u2, c) {
                for (var f = i(c), h = u2.length, p = new Array(h), d = 0; d < h; ++d) p[d] = l(u2[d], f);
                return p;
              };
            }, { "big-rat": 18, "big-rat/mul": 27 }], 275: [function(a, o, s) {
              "use strict";
              var i = a("big-rat/sub");
              o.exports = function(l, u2) {
                for (var c = l.length, f = new Array(c), h = 0; h < c; ++h) f[h] = i(l[h], u2[h]);
                return f;
              };
            }, { "big-rat/sub": 29 }], 276: [function(a, o, s) {
              "use strict";
              var i = a("compare-cell"), l = a("compare-oriented-cell"), u2 = a("cell-orientation");
              o.exports = function(c) {
                c.sort(l);
                for (var f = c.length, h = 0, p = 0; p < f; ++p) {
                  var d = c[p], v = u2(d);
                  if (v !== 0) {
                    if (h > 0) {
                      var m = c[h - 1];
                      if (i(d, m) === 0 && u2(m) !== v) {
                        h -= 1;
                        continue;
                      }
                    }
                    c[h++] = d;
                  }
                }
                return c.length = h, c;
              };
            }, { "cell-orientation": 47, "compare-cell": 56, "compare-oriented-cell": 57 }], 277: [function(a, o, s) {
              "use strict";
              var i, l = "";
              o.exports = function(u2, c) {
                if (typeof u2 != "string") throw new TypeError("expected a string");
                if (c === 1) return u2;
                if (c === 2) return u2 + u2;
                var f = u2.length * c;
                if (i !== u2 || i === void 0) i = u2, l = "";
                else if (l.length >= f) return l.substr(0, f);
                for (; f > l.length && c > 1; ) 1 & c && (l += u2), c >>= 1, u2 += u2;
                return l = (l += u2).substr(0, f);
              };
            }, {}], 278: [function(a, o, s) {
              (function(i) {
                (function() {
                  o.exports = i.performance && i.performance.now ? function() {
                    return performance.now();
                  } : Date.now || function() {
                    return +/* @__PURE__ */ new Date();
                  };
                }).call(this);
              }).call(this, n !== void 0 ? n : typeof self < "u" ? self : typeof window < "u" ? window : {});
            }, {}], 279: [function(a, o, s) {
              "use strict";
              o.exports = function(i) {
                for (var l = i.length, u2 = i[i.length - 1], c = l, f = l - 2; f >= 0; --f) {
                  var h = u2, p = i[f];
                  (v = p - ((u2 = h + p) - h)) && (i[--c] = u2, u2 = v);
                }
                var d = 0;
                for (f = c; f < l; ++f) {
                  var v;
                  h = i[f], (v = (p = u2) - ((u2 = h + p) - h)) && (i[d++] = v);
                }
                return i[d++] = u2, i.length = d, i;
              };
            }, {}], 280: [function(a, o, s) {
              "use strict";
              var i = a("two-product"), l = a("robust-sum"), u2 = a("robust-scale"), c = a("robust-compress");
              function f(m, g, x, b) {
                return function(y) {
                  return b(m(x(y[0][0], y[1][1]), x(-y[0][1], y[1][0])));
                };
              }
              function h(m, g, x, b) {
                return function(y) {
                  return b(m(g(m(x(y[1][1], y[2][2]), x(-y[1][2], y[2][1])), y[0][0]), m(g(m(x(y[1][0], y[2][2]), x(-y[1][2], y[2][0])), -y[0][1]), g(m(x(y[1][0], y[2][1]), x(-y[1][1], y[2][0])), y[0][2]))));
                };
              }
              function p(m) {
                return (m === 2 ? f : m === 3 ? h : void 0)(l, u2, i, c);
              }
              var d = [function() {
                return [0];
              }, function(m) {
                return [m[0][0]];
              }];
              function v(m, g, x, b, y, w) {
                return function(_4) {
                  switch (_4.length) {
                    case 0:
                      return m(_4);
                    case 1:
                      return g(_4);
                    case 2:
                      return x(_4);
                    case 3:
                      return b(_4);
                  }
                  var k = y[_4.length];
                  return k || (k = y[_4.length] = w(_4.length)), k(_4);
                };
              }
              (function() {
                for (; d.length < 4; ) d.push(p(d.length));
                o.exports = v.apply(void 0, d.concat([d, p]));
                for (var m = 0; m < d.length; ++m) o.exports[m] = d[m];
              })();
            }, { "robust-compress": 279, "robust-scale": 286, "robust-sum": 289, "two-product": 306 }], 281: [function(a, o, s) {
              "use strict";
              var i = a("two-product"), l = a("robust-sum");
              o.exports = function(u2, c) {
                for (var f = i(u2[0], c[0]), h = 1; h < u2.length; ++h) f = l(f, i(u2[h], c[h]));
                return f;
              };
            }, { "robust-sum": 289, "two-product": 306 }], 282: [function(a, o, s) {
              "use strict";
              var i = a("two-product"), l = a("robust-sum"), u2 = a("robust-subtract"), c = a("robust-scale");
              function f(b) {
                return (b === 3 ? h : b === 4 ? p : b === 5 ? d : v)(l, u2, i, c);
              }
              function h(b, y, w, _4) {
                return function(k, T2, A2) {
                  var S2 = w(k[0], k[0]), C2 = _4(S2, T2[0]), E2 = _4(S2, A2[0]), F13 = w(T2[0], T2[0]), N2 = _4(F13, k[0]), D2 = _4(F13, A2[0]), I2 = w(A2[0], A2[0]), O2 = _4(I2, k[0]), L2 = _4(I2, T2[0]), V2 = b(y(L2, D2), y(N2, C2)), W2 = y(O2, E2), X2 = y(V2, W2);
                  return X2[X2.length - 1];
                };
              }
              function p(b, y, w, _4) {
                return function(k, T2, A2, S2) {
                  var C2 = b(w(k[0], k[0]), w(k[1], k[1])), E2 = _4(C2, T2[0]), F13 = _4(C2, A2[0]), N2 = _4(C2, S2[0]), D2 = b(w(T2[0], T2[0]), w(T2[1], T2[1])), I2 = _4(D2, k[0]), O2 = _4(D2, A2[0]), L2 = _4(D2, S2[0]), V2 = b(w(A2[0], A2[0]), w(A2[1], A2[1])), W2 = _4(V2, k[0]), X2 = _4(V2, T2[0]), Y2 = _4(V2, S2[0]), K2 = b(w(S2[0], S2[0]), w(S2[1], S2[1])), q = _4(K2, k[0]), re = _4(K2, T2[0]), R2 = _4(K2, A2[0]), z = b(b(_4(y(R2, Y2), T2[1]), b(_4(y(re, L2), -A2[1]), _4(y(X2, O2), S2[1]))), b(_4(y(re, L2), k[1]), b(_4(y(q, N2), -T2[1]), _4(y(I2, E2), S2[1])))), H2 = b(b(_4(y(R2, Y2), k[1]), b(_4(y(q, N2), -A2[1]), _4(y(W2, F13), S2[1]))), b(_4(y(X2, O2), k[1]), b(_4(y(W2, F13), -T2[1]), _4(y(I2, E2), A2[1])))), te = y(z, H2);
                  return te[te.length - 1];
                };
              }
              function d(b, y, w, _4) {
                return function(k, T2, A2, S2, C2) {
                  var E2 = b(w(k[0], k[0]), b(w(k[1], k[1]), w(k[2], k[2]))), F13 = _4(E2, T2[0]), N2 = _4(E2, A2[0]), D2 = _4(E2, S2[0]), I2 = _4(E2, C2[0]), O2 = b(w(T2[0], T2[0]), b(w(T2[1], T2[1]), w(T2[2], T2[2]))), L2 = _4(O2, k[0]), V2 = _4(O2, A2[0]), W2 = _4(O2, S2[0]), X2 = _4(O2, C2[0]), Y2 = b(w(A2[0], A2[0]), b(w(A2[1], A2[1]), w(A2[2], A2[2]))), K2 = _4(Y2, k[0]), q = _4(Y2, T2[0]), re = _4(Y2, S2[0]), R2 = _4(Y2, C2[0]), z = b(w(S2[0], S2[0]), b(w(S2[1], S2[1]), w(S2[2], S2[2]))), H2 = _4(z, k[0]), te = _4(z, T2[0]), j = _4(z, A2[0]), Q2 = _4(z, C2[0]), Z2 = b(w(C2[0], C2[0]), b(w(C2[1], C2[1]), w(C2[2], C2[2]))), ne = _4(Z2, k[0]), ae = _4(Z2, T2[0]), ue = _4(Z2, A2[0]), le = _4(Z2, S2[0]), ce = b(b(b(_4(b(_4(y(le, Q2), A2[1]), b(_4(y(ue, R2), -S2[1]), _4(y(j, re), C2[1]))), T2[2]), b(_4(b(_4(y(le, Q2), T2[1]), b(_4(y(ae, X2), -S2[1]), _4(y(te, W2), C2[1]))), -A2[2]), _4(b(_4(y(ue, R2), T2[1]), b(_4(y(ae, X2), -A2[1]), _4(y(q, V2), C2[1]))), S2[2]))), b(_4(b(_4(y(j, re), T2[1]), b(_4(y(te, W2), -A2[1]), _4(y(q, V2), S2[1]))), -C2[2]), b(_4(b(_4(y(le, Q2), T2[1]), b(_4(y(ae, X2), -S2[1]), _4(y(te, W2), C2[1]))), k[2]), _4(b(_4(y(le, Q2), k[1]), b(_4(y(ne, I2), -S2[1]), _4(y(H2, D2), C2[1]))), -T2[2])))), b(b(_4(b(_4(y(ae, X2), k[1]), b(_4(y(ne, I2), -T2[1]), _4(y(L2, F13), C2[1]))), S2[2]), b(_4(b(_4(y(te, W2), k[1]), b(_4(y(H2, D2), -T2[1]), _4(y(L2, F13), S2[1]))), -C2[2]), _4(b(_4(y(j, re), T2[1]), b(_4(y(te, W2), -A2[1]), _4(y(q, V2), S2[1]))), k[2]))), b(_4(b(_4(y(j, re), k[1]), b(_4(y(H2, D2), -A2[1]), _4(y(K2, N2), S2[1]))), -T2[2]), b(_4(b(_4(y(te, W2), k[1]), b(_4(y(H2, D2), -T2[1]), _4(y(L2, F13), S2[1]))), A2[2]), _4(b(_4(y(q, V2), k[1]), b(_4(y(K2, N2), -T2[1]), _4(y(L2, F13), A2[1]))), -S2[2]))))), se = b(b(b(_4(b(_4(y(le, Q2), A2[1]), b(_4(y(ue, R2), -S2[1]), _4(y(j, re), C2[1]))), k[2]), _4(b(_4(y(le, Q2), k[1]), b(_4(y(ne, I2), -S2[1]), _4(y(H2, D2), C2[1]))), -A2[2])), b(_4(b(_4(y(ue, R2), k[1]), b(_4(y(ne, I2), -A2[1]), _4(y(K2, N2), C2[1]))), S2[2]), _4(b(_4(y(j, re), k[1]), b(_4(y(H2, D2), -A2[1]), _4(y(K2, N2), S2[1]))), -C2[2]))), b(b(_4(b(_4(y(ue, R2), T2[1]), b(_4(y(ae, X2), -A2[1]), _4(y(q, V2), C2[1]))), k[2]), _4(b(_4(y(ue, R2), k[1]), b(_4(y(ne, I2), -A2[1]), _4(y(K2, N2), C2[1]))), -T2[2])), b(_4(b(_4(y(ae, X2), k[1]), b(_4(y(ne, I2), -T2[1]), _4(y(L2, F13), C2[1]))), A2[2]), _4(b(_4(y(q, V2), k[1]), b(_4(y(K2, N2), -T2[1]), _4(y(L2, F13), A2[1]))), -C2[2])))), he = y(ce, se);
                  return he[he.length - 1];
                };
              }
              function v(b, y, w, _4) {
                return function(k, T2, A2, S2, C2, E2) {
                  var F13 = b(b(w(k[0], k[0]), w(k[1], k[1])), b(w(k[2], k[2]), w(k[3], k[3]))), N2 = _4(F13, T2[0]), D2 = _4(F13, A2[0]), I2 = _4(F13, S2[0]), O2 = _4(F13, C2[0]), L2 = _4(F13, E2[0]), V2 = b(b(w(T2[0], T2[0]), w(T2[1], T2[1])), b(w(T2[2], T2[2]), w(T2[3], T2[3]))), W2 = _4(V2, k[0]), X2 = _4(V2, A2[0]), Y2 = _4(V2, S2[0]), K2 = _4(V2, C2[0]), q = _4(V2, E2[0]), re = b(b(w(A2[0], A2[0]), w(A2[1], A2[1])), b(w(A2[2], A2[2]), w(A2[3], A2[3]))), R2 = _4(re, k[0]), z = _4(re, T2[0]), H2 = _4(re, S2[0]), te = _4(re, C2[0]), j = _4(re, E2[0]), Q2 = b(b(w(S2[0], S2[0]), w(S2[1], S2[1])), b(w(S2[2], S2[2]), w(S2[3], S2[3]))), Z2 = _4(Q2, k[0]), ne = _4(Q2, T2[0]), ae = _4(Q2, A2[0]), ue = _4(Q2, C2[0]), le = _4(Q2, E2[0]), ce = b(b(w(C2[0], C2[0]), w(C2[1], C2[1])), b(w(C2[2], C2[2]), w(C2[3], C2[3]))), se = _4(ce, k[0]), he = _4(ce, T2[0]), me = _4(ce, A2[0]), we = _4(ce, S2[0]), be = _4(ce, E2[0]), Ae = b(b(w(E2[0], E2[0]), w(E2[1], E2[1])), b(w(E2[2], E2[2]), w(E2[3], E2[3]))), pe = _4(Ae, k[0]), ve = _4(Ae, T2[0]), Ee = _4(Ae, A2[0]), Se = _4(Ae, S2[0]), Ce = _4(Ae, C2[0]), Be = b(b(b(_4(b(b(_4(b(_4(y(Ce, be), S2[1]), b(_4(y(Se, le), -C2[1]), _4(y(we, ue), E2[1]))), A2[2]), _4(b(_4(y(Ce, be), A2[1]), b(_4(y(Ee, j), -C2[1]), _4(y(me, te), E2[1]))), -S2[2])), b(_4(b(_4(y(Se, le), A2[1]), b(_4(y(Ee, j), -S2[1]), _4(y(ae, H2), E2[1]))), C2[2]), _4(b(_4(y(we, ue), A2[1]), b(_4(y(me, te), -S2[1]), _4(y(ae, H2), C2[1]))), -E2[2]))), T2[3]), b(_4(b(b(_4(b(_4(y(Ce, be), S2[1]), b(_4(y(Se, le), -C2[1]), _4(y(we, ue), E2[1]))), T2[2]), _4(b(_4(y(Ce, be), T2[1]), b(_4(y(ve, q), -C2[1]), _4(y(he, K2), E2[1]))), -S2[2])), b(_4(b(_4(y(Se, le), T2[1]), b(_4(y(ve, q), -S2[1]), _4(y(ne, Y2), E2[1]))), C2[2]), _4(b(_4(y(we, ue), T2[1]), b(_4(y(he, K2), -S2[1]), _4(y(ne, Y2), C2[1]))), -E2[2]))), -A2[3]), _4(b(b(_4(b(_4(y(Ce, be), A2[1]), b(_4(y(Ee, j), -C2[1]), _4(y(me, te), E2[1]))), T2[2]), _4(b(_4(y(Ce, be), T2[1]), b(_4(y(ve, q), -C2[1]), _4(y(he, K2), E2[1]))), -A2[2])), b(_4(b(_4(y(Ee, j), T2[1]), b(_4(y(ve, q), -A2[1]), _4(y(z, X2), E2[1]))), C2[2]), _4(b(_4(y(me, te), T2[1]), b(_4(y(he, K2), -A2[1]), _4(y(z, X2), C2[1]))), -E2[2]))), S2[3]))), b(b(_4(b(b(_4(b(_4(y(Se, le), A2[1]), b(_4(y(Ee, j), -S2[1]), _4(y(ae, H2), E2[1]))), T2[2]), _4(b(_4(y(Se, le), T2[1]), b(_4(y(ve, q), -S2[1]), _4(y(ne, Y2), E2[1]))), -A2[2])), b(_4(b(_4(y(Ee, j), T2[1]), b(_4(y(ve, q), -A2[1]), _4(y(z, X2), E2[1]))), S2[2]), _4(b(_4(y(ae, H2), T2[1]), b(_4(y(ne, Y2), -A2[1]), _4(y(z, X2), S2[1]))), -E2[2]))), -C2[3]), _4(b(b(_4(b(_4(y(we, ue), A2[1]), b(_4(y(me, te), -S2[1]), _4(y(ae, H2), C2[1]))), T2[2]), _4(b(_4(y(we, ue), T2[1]), b(_4(y(he, K2), -S2[1]), _4(y(ne, Y2), C2[1]))), -A2[2])), b(_4(b(_4(y(me, te), T2[1]), b(_4(y(he, K2), -A2[1]), _4(y(z, X2), C2[1]))), S2[2]), _4(b(_4(y(ae, H2), T2[1]), b(_4(y(ne, Y2), -A2[1]), _4(y(z, X2), S2[1]))), -C2[2]))), E2[3])), b(_4(b(b(_4(b(_4(y(Ce, be), S2[1]), b(_4(y(Se, le), -C2[1]), _4(y(we, ue), E2[1]))), T2[2]), _4(b(_4(y(Ce, be), T2[1]), b(_4(y(ve, q), -C2[1]), _4(y(he, K2), E2[1]))), -S2[2])), b(_4(b(_4(y(Se, le), T2[1]), b(_4(y(ve, q), -S2[1]), _4(y(ne, Y2), E2[1]))), C2[2]), _4(b(_4(y(we, ue), T2[1]), b(_4(y(he, K2), -S2[1]), _4(y(ne, Y2), C2[1]))), -E2[2]))), k[3]), _4(b(b(_4(b(_4(y(Ce, be), S2[1]), b(_4(y(Se, le), -C2[1]), _4(y(we, ue), E2[1]))), k[2]), _4(b(_4(y(Ce, be), k[1]), b(_4(y(pe, L2), -C2[1]), _4(y(se, O2), E2[1]))), -S2[2])), b(_4(b(_4(y(Se, le), k[1]), b(_4(y(pe, L2), -S2[1]), _4(y(Z2, I2), E2[1]))), C2[2]), _4(b(_4(y(we, ue), k[1]), b(_4(y(se, O2), -S2[1]), _4(y(Z2, I2), C2[1]))), -E2[2]))), -T2[3])))), b(b(b(_4(b(b(_4(b(_4(y(Ce, be), T2[1]), b(_4(y(ve, q), -C2[1]), _4(y(he, K2), E2[1]))), k[2]), _4(b(_4(y(Ce, be), k[1]), b(_4(y(pe, L2), -C2[1]), _4(y(se, O2), E2[1]))), -T2[2])), b(_4(b(_4(y(ve, q), k[1]), b(_4(y(pe, L2), -T2[1]), _4(y(W2, N2), E2[1]))), C2[2]), _4(b(_4(y(he, K2), k[1]), b(_4(y(se, O2), -T2[1]), _4(y(W2, N2), C2[1]))), -E2[2]))), S2[3]), _4(b(b(_4(b(_4(y(Se, le), T2[1]), b(_4(y(ve, q), -S2[1]), _4(y(ne, Y2), E2[1]))), k[2]), _4(b(_4(y(Se, le), k[1]), b(_4(y(pe, L2), -S2[1]), _4(y(Z2, I2), E2[1]))), -T2[2])), b(_4(b(_4(y(ve, q), k[1]), b(_4(y(pe, L2), -T2[1]), _4(y(W2, N2), E2[1]))), S2[2]), _4(b(_4(y(ne, Y2), k[1]), b(_4(y(Z2, I2), -T2[1]), _4(y(W2, N2), S2[1]))), -E2[2]))), -C2[3])), b(_4(b(b(_4(b(_4(y(we, ue), T2[1]), b(_4(y(he, K2), -S2[1]), _4(y(ne, Y2), C2[1]))), k[2]), _4(b(_4(y(we, ue), k[1]), b(_4(y(se, O2), -S2[1]), _4(y(Z2, I2), C2[1]))), -T2[2])), b(_4(b(_4(y(he, K2), k[1]), b(_4(y(se, O2), -T2[1]), _4(y(W2, N2), C2[1]))), S2[2]), _4(b(_4(y(ne, Y2), k[1]), b(_4(y(Z2, I2), -T2[1]), _4(y(W2, N2), S2[1]))), -C2[2]))), E2[3]), _4(b(b(_4(b(_4(y(Se, le), A2[1]), b(_4(y(Ee, j), -S2[1]), _4(y(ae, H2), E2[1]))), T2[2]), _4(b(_4(y(Se, le), T2[1]), b(_4(y(ve, q), -S2[1]), _4(y(ne, Y2), E2[1]))), -A2[2])), b(_4(b(_4(y(Ee, j), T2[1]), b(_4(y(ve, q), -A2[1]), _4(y(z, X2), E2[1]))), S2[2]), _4(b(_4(y(ae, H2), T2[1]), b(_4(y(ne, Y2), -A2[1]), _4(y(z, X2), S2[1]))), -E2[2]))), k[3]))), b(b(_4(b(b(_4(b(_4(y(Se, le), A2[1]), b(_4(y(Ee, j), -S2[1]), _4(y(ae, H2), E2[1]))), k[2]), _4(b(_4(y(Se, le), k[1]), b(_4(y(pe, L2), -S2[1]), _4(y(Z2, I2), E2[1]))), -A2[2])), b(_4(b(_4(y(Ee, j), k[1]), b(_4(y(pe, L2), -A2[1]), _4(y(R2, D2), E2[1]))), S2[2]), _4(b(_4(y(ae, H2), k[1]), b(_4(y(Z2, I2), -A2[1]), _4(y(R2, D2), S2[1]))), -E2[2]))), -T2[3]), _4(b(b(_4(b(_4(y(Se, le), T2[1]), b(_4(y(ve, q), -S2[1]), _4(y(ne, Y2), E2[1]))), k[2]), _4(b(_4(y(Se, le), k[1]), b(_4(y(pe, L2), -S2[1]), _4(y(Z2, I2), E2[1]))), -T2[2])), b(_4(b(_4(y(ve, q), k[1]), b(_4(y(pe, L2), -T2[1]), _4(y(W2, N2), E2[1]))), S2[2]), _4(b(_4(y(ne, Y2), k[1]), b(_4(y(Z2, I2), -T2[1]), _4(y(W2, N2), S2[1]))), -E2[2]))), A2[3])), b(_4(b(b(_4(b(_4(y(Ee, j), T2[1]), b(_4(y(ve, q), -A2[1]), _4(y(z, X2), E2[1]))), k[2]), _4(b(_4(y(Ee, j), k[1]), b(_4(y(pe, L2), -A2[1]), _4(y(R2, D2), E2[1]))), -T2[2])), b(_4(b(_4(y(ve, q), k[1]), b(_4(y(pe, L2), -T2[1]), _4(y(W2, N2), E2[1]))), A2[2]), _4(b(_4(y(z, X2), k[1]), b(_4(y(R2, D2), -T2[1]), _4(y(W2, N2), A2[1]))), -E2[2]))), -S2[3]), _4(b(b(_4(b(_4(y(ae, H2), T2[1]), b(_4(y(ne, Y2), -A2[1]), _4(y(z, X2), S2[1]))), k[2]), _4(b(_4(y(ae, H2), k[1]), b(_4(y(Z2, I2), -A2[1]), _4(y(R2, D2), S2[1]))), -T2[2])), b(_4(b(_4(y(ne, Y2), k[1]), b(_4(y(Z2, I2), -T2[1]), _4(y(W2, N2), S2[1]))), A2[2]), _4(b(_4(y(z, X2), k[1]), b(_4(y(R2, D2), -T2[1]), _4(y(W2, N2), A2[1]))), -S2[2]))), E2[3]))))), Ue = b(b(b(_4(b(b(_4(b(_4(y(Ce, be), S2[1]), b(_4(y(Se, le), -C2[1]), _4(y(we, ue), E2[1]))), A2[2]), _4(b(_4(y(Ce, be), A2[1]), b(_4(y(Ee, j), -C2[1]), _4(y(me, te), E2[1]))), -S2[2])), b(_4(b(_4(y(Se, le), A2[1]), b(_4(y(Ee, j), -S2[1]), _4(y(ae, H2), E2[1]))), C2[2]), _4(b(_4(y(we, ue), A2[1]), b(_4(y(me, te), -S2[1]), _4(y(ae, H2), C2[1]))), -E2[2]))), k[3]), b(_4(b(b(_4(b(_4(y(Ce, be), S2[1]), b(_4(y(Se, le), -C2[1]), _4(y(we, ue), E2[1]))), k[2]), _4(b(_4(y(Ce, be), k[1]), b(_4(y(pe, L2), -C2[1]), _4(y(se, O2), E2[1]))), -S2[2])), b(_4(b(_4(y(Se, le), k[1]), b(_4(y(pe, L2), -S2[1]), _4(y(Z2, I2), E2[1]))), C2[2]), _4(b(_4(y(we, ue), k[1]), b(_4(y(se, O2), -S2[1]), _4(y(Z2, I2), C2[1]))), -E2[2]))), -A2[3]), _4(b(b(_4(b(_4(y(Ce, be), A2[1]), b(_4(y(Ee, j), -C2[1]), _4(y(me, te), E2[1]))), k[2]), _4(b(_4(y(Ce, be), k[1]), b(_4(y(pe, L2), -C2[1]), _4(y(se, O2), E2[1]))), -A2[2])), b(_4(b(_4(y(Ee, j), k[1]), b(_4(y(pe, L2), -A2[1]), _4(y(R2, D2), E2[1]))), C2[2]), _4(b(_4(y(me, te), k[1]), b(_4(y(se, O2), -A2[1]), _4(y(R2, D2), C2[1]))), -E2[2]))), S2[3]))), b(b(_4(b(b(_4(b(_4(y(Se, le), A2[1]), b(_4(y(Ee, j), -S2[1]), _4(y(ae, H2), E2[1]))), k[2]), _4(b(_4(y(Se, le), k[1]), b(_4(y(pe, L2), -S2[1]), _4(y(Z2, I2), E2[1]))), -A2[2])), b(_4(b(_4(y(Ee, j), k[1]), b(_4(y(pe, L2), -A2[1]), _4(y(R2, D2), E2[1]))), S2[2]), _4(b(_4(y(ae, H2), k[1]), b(_4(y(Z2, I2), -A2[1]), _4(y(R2, D2), S2[1]))), -E2[2]))), -C2[3]), _4(b(b(_4(b(_4(y(we, ue), A2[1]), b(_4(y(me, te), -S2[1]), _4(y(ae, H2), C2[1]))), k[2]), _4(b(_4(y(we, ue), k[1]), b(_4(y(se, O2), -S2[1]), _4(y(Z2, I2), C2[1]))), -A2[2])), b(_4(b(_4(y(me, te), k[1]), b(_4(y(se, O2), -A2[1]), _4(y(R2, D2), C2[1]))), S2[2]), _4(b(_4(y(ae, H2), k[1]), b(_4(y(Z2, I2), -A2[1]), _4(y(R2, D2), S2[1]))), -C2[2]))), E2[3])), b(_4(b(b(_4(b(_4(y(Ce, be), A2[1]), b(_4(y(Ee, j), -C2[1]), _4(y(me, te), E2[1]))), T2[2]), _4(b(_4(y(Ce, be), T2[1]), b(_4(y(ve, q), -C2[1]), _4(y(he, K2), E2[1]))), -A2[2])), b(_4(b(_4(y(Ee, j), T2[1]), b(_4(y(ve, q), -A2[1]), _4(y(z, X2), E2[1]))), C2[2]), _4(b(_4(y(me, te), T2[1]), b(_4(y(he, K2), -A2[1]), _4(y(z, X2), C2[1]))), -E2[2]))), k[3]), _4(b(b(_4(b(_4(y(Ce, be), A2[1]), b(_4(y(Ee, j), -C2[1]), _4(y(me, te), E2[1]))), k[2]), _4(b(_4(y(Ce, be), k[1]), b(_4(y(pe, L2), -C2[1]), _4(y(se, O2), E2[1]))), -A2[2])), b(_4(b(_4(y(Ee, j), k[1]), b(_4(y(pe, L2), -A2[1]), _4(y(R2, D2), E2[1]))), C2[2]), _4(b(_4(y(me, te), k[1]), b(_4(y(se, O2), -A2[1]), _4(y(R2, D2), C2[1]))), -E2[2]))), -T2[3])))), b(b(b(_4(b(b(_4(b(_4(y(Ce, be), T2[1]), b(_4(y(ve, q), -C2[1]), _4(y(he, K2), E2[1]))), k[2]), _4(b(_4(y(Ce, be), k[1]), b(_4(y(pe, L2), -C2[1]), _4(y(se, O2), E2[1]))), -T2[2])), b(_4(b(_4(y(ve, q), k[1]), b(_4(y(pe, L2), -T2[1]), _4(y(W2, N2), E2[1]))), C2[2]), _4(b(_4(y(he, K2), k[1]), b(_4(y(se, O2), -T2[1]), _4(y(W2, N2), C2[1]))), -E2[2]))), A2[3]), _4(b(b(_4(b(_4(y(Ee, j), T2[1]), b(_4(y(ve, q), -A2[1]), _4(y(z, X2), E2[1]))), k[2]), _4(b(_4(y(Ee, j), k[1]), b(_4(y(pe, L2), -A2[1]), _4(y(R2, D2), E2[1]))), -T2[2])), b(_4(b(_4(y(ve, q), k[1]), b(_4(y(pe, L2), -T2[1]), _4(y(W2, N2), E2[1]))), A2[2]), _4(b(_4(y(z, X2), k[1]), b(_4(y(R2, D2), -T2[1]), _4(y(W2, N2), A2[1]))), -E2[2]))), -C2[3])), b(_4(b(b(_4(b(_4(y(me, te), T2[1]), b(_4(y(he, K2), -A2[1]), _4(y(z, X2), C2[1]))), k[2]), _4(b(_4(y(me, te), k[1]), b(_4(y(se, O2), -A2[1]), _4(y(R2, D2), C2[1]))), -T2[2])), b(_4(b(_4(y(he, K2), k[1]), b(_4(y(se, O2), -T2[1]), _4(y(W2, N2), C2[1]))), A2[2]), _4(b(_4(y(z, X2), k[1]), b(_4(y(R2, D2), -T2[1]), _4(y(W2, N2), A2[1]))), -C2[2]))), E2[3]), _4(b(b(_4(b(_4(y(we, ue), A2[1]), b(_4(y(me, te), -S2[1]), _4(y(ae, H2), C2[1]))), T2[2]), _4(b(_4(y(we, ue), T2[1]), b(_4(y(he, K2), -S2[1]), _4(y(ne, Y2), C2[1]))), -A2[2])), b(_4(b(_4(y(me, te), T2[1]), b(_4(y(he, K2), -A2[1]), _4(y(z, X2), C2[1]))), S2[2]), _4(b(_4(y(ae, H2), T2[1]), b(_4(y(ne, Y2), -A2[1]), _4(y(z, X2), S2[1]))), -C2[2]))), k[3]))), b(b(_4(b(b(_4(b(_4(y(we, ue), A2[1]), b(_4(y(me, te), -S2[1]), _4(y(ae, H2), C2[1]))), k[2]), _4(b(_4(y(we, ue), k[1]), b(_4(y(se, O2), -S2[1]), _4(y(Z2, I2), C2[1]))), -A2[2])), b(_4(b(_4(y(me, te), k[1]), b(_4(y(se, O2), -A2[1]), _4(y(R2, D2), C2[1]))), S2[2]), _4(b(_4(y(ae, H2), k[1]), b(_4(y(Z2, I2), -A2[1]), _4(y(R2, D2), S2[1]))), -C2[2]))), -T2[3]), _4(b(b(_4(b(_4(y(we, ue), T2[1]), b(_4(y(he, K2), -S2[1]), _4(y(ne, Y2), C2[1]))), k[2]), _4(b(_4(y(we, ue), k[1]), b(_4(y(se, O2), -S2[1]), _4(y(Z2, I2), C2[1]))), -T2[2])), b(_4(b(_4(y(he, K2), k[1]), b(_4(y(se, O2), -T2[1]), _4(y(W2, N2), C2[1]))), S2[2]), _4(b(_4(y(ne, Y2), k[1]), b(_4(y(Z2, I2), -T2[1]), _4(y(W2, N2), S2[1]))), -C2[2]))), A2[3])), b(_4(b(b(_4(b(_4(y(me, te), T2[1]), b(_4(y(he, K2), -A2[1]), _4(y(z, X2), C2[1]))), k[2]), _4(b(_4(y(me, te), k[1]), b(_4(y(se, O2), -A2[1]), _4(y(R2, D2), C2[1]))), -T2[2])), b(_4(b(_4(y(he, K2), k[1]), b(_4(y(se, O2), -T2[1]), _4(y(W2, N2), C2[1]))), A2[2]), _4(b(_4(y(z, X2), k[1]), b(_4(y(R2, D2), -T2[1]), _4(y(W2, N2), A2[1]))), -C2[2]))), -S2[3]), _4(b(b(_4(b(_4(y(ae, H2), T2[1]), b(_4(y(ne, Y2), -A2[1]), _4(y(z, X2), S2[1]))), k[2]), _4(b(_4(y(ae, H2), k[1]), b(_4(y(Z2, I2), -A2[1]), _4(y(R2, D2), S2[1]))), -T2[2])), b(_4(b(_4(y(ne, Y2), k[1]), b(_4(y(Z2, I2), -T2[1]), _4(y(W2, N2), S2[1]))), A2[2]), _4(b(_4(y(z, X2), k[1]), b(_4(y(R2, D2), -T2[1]), _4(y(W2, N2), A2[1]))), -S2[2]))), C2[3]))))), Ke = y(Be, Ue);
                  return Ke[Ke.length - 1];
                };
              }
              var m = [function() {
                return 0;
              }, function() {
                return 0;
              }, function() {
                return 0;
              }];
              function g(b) {
                var y = m[b.length];
                return y || (y = m[b.length] = f(b.length)), y.apply(void 0, b);
              }
              function x(b, y, w, _4, k, T2, A2, S2) {
                return function(C2, E2, F13, N2, D2, I2) {
                  switch (arguments.length) {
                    case 0:
                    case 1:
                      return 0;
                    case 2:
                      return _4(C2, E2);
                    case 3:
                      return k(C2, E2, F13);
                    case 4:
                      return T2(C2, E2, F13, N2);
                    case 5:
                      return A2(C2, E2, F13, N2, D2);
                    case 6:
                      return S2(C2, E2, F13, N2, D2, I2);
                  }
                  for (var O2 = new Array(arguments.length), L2 = 0; L2 < arguments.length; ++L2) O2[L2] = arguments[L2];
                  return b(O2);
                };
              }
              (function() {
                for (; m.length <= 6; ) m.push(f(m.length));
                o.exports = x.apply(void 0, [g].concat(m));
                for (var b = 0; b <= 6; ++b) o.exports[b] = m[b];
              })();
            }, { "robust-scale": 286, "robust-subtract": 288, "robust-sum": 289, "two-product": 306 }], 283: [function(a, o, s) {
              "use strict";
              var i = a("robust-determinant");
              function l(p) {
                var d = p === 2 ? u2 : c;
                return d(p < 3 ? i[p] : i);
              }
              function u2(p) {
                return function(d, v) {
                  return [p([[+v[0], +d[0][1]], [+v[1], +d[1][1]]]), p([[+d[0][0], +v[0]], [+d[1][0], +v[1]]]), p(d)];
                };
              }
              function c(p) {
                return function(d, v) {
                  return [p([[+v[0], +d[0][1], +d[0][2]], [+v[1], +d[1][1], +d[1][2]], [+v[2], +d[2][1], +d[2][2]]]), p([[+d[0][0], +v[0], +d[0][2]], [+d[1][0], +v[1], +d[1][2]], [+d[2][0], +v[2], +d[2][2]]]), p([[+d[0][0], +d[0][1], +v[0]], [+d[1][0], +d[1][1], +v[1]], [+d[2][0], +d[2][1], +v[2]]]), p(d)];
                };
              }
              var f = [function() {
                return [[0]];
              }, function(p, d) {
                return [[d[0]], [p[0][0]]];
              }];
              function h(p, d, v, m, g, x) {
                return function(b, y) {
                  switch (b.length) {
                    case 0:
                      return p(b, y);
                    case 1:
                      return d(b, y);
                    case 2:
                      return v(b, y);
                    case 3:
                      return m(b, y);
                  }
                  var w = g[b.length];
                  return w || (w = g[b.length] = x(b.length)), w(b, y);
                };
              }
              (function() {
                for (; f.length <= 3; ) f.push(l(f.length));
                o.exports = h.apply(void 0, f.concat([f, l]));
                for (var p = 0; p < 3; ++p) o.exports[p] = f[p];
              })();
            }, { "robust-determinant": 280 }], 284: [function(a, o, s) {
              "use strict";
              var i = a("two-product"), l = a("robust-sum"), u2 = a("robust-scale"), c = a("robust-subtract");
              function f(y, w, _4, k) {
                return function(T2, A2, S2) {
                  var C2 = y(y(w(A2[1], S2[0]), w(-S2[1], A2[0])), y(w(T2[1], A2[0]), w(-A2[1], T2[0]))), E2 = y(w(T2[1], S2[0]), w(-S2[1], T2[0])), F13 = k(C2, E2);
                  return F13[F13.length - 1];
                };
              }
              function h(y, w, _4, k) {
                return function(T2, A2, S2, C2) {
                  var E2 = y(y(_4(y(w(S2[1], C2[0]), w(-C2[1], S2[0])), A2[2]), y(_4(y(w(A2[1], C2[0]), w(-C2[1], A2[0])), -S2[2]), _4(y(w(A2[1], S2[0]), w(-S2[1], A2[0])), C2[2]))), y(_4(y(w(A2[1], C2[0]), w(-C2[1], A2[0])), T2[2]), y(_4(y(w(T2[1], C2[0]), w(-C2[1], T2[0])), -A2[2]), _4(y(w(T2[1], A2[0]), w(-A2[1], T2[0])), C2[2])))), F13 = y(y(_4(y(w(S2[1], C2[0]), w(-C2[1], S2[0])), T2[2]), y(_4(y(w(T2[1], C2[0]), w(-C2[1], T2[0])), -S2[2]), _4(y(w(T2[1], S2[0]), w(-S2[1], T2[0])), C2[2]))), y(_4(y(w(A2[1], S2[0]), w(-S2[1], A2[0])), T2[2]), y(_4(y(w(T2[1], S2[0]), w(-S2[1], T2[0])), -A2[2]), _4(y(w(T2[1], A2[0]), w(-A2[1], T2[0])), S2[2])))), N2 = k(E2, F13);
                  return N2[N2.length - 1];
                };
              }
              function p(y, w, _4, k) {
                return function(T2, A2, S2, C2, E2) {
                  var F13 = y(y(y(_4(y(_4(y(w(C2[1], E2[0]), w(-E2[1], C2[0])), S2[2]), y(_4(y(w(S2[1], E2[0]), w(-E2[1], S2[0])), -C2[2]), _4(y(w(S2[1], C2[0]), w(-C2[1], S2[0])), E2[2]))), A2[3]), y(_4(y(_4(y(w(C2[1], E2[0]), w(-E2[1], C2[0])), A2[2]), y(_4(y(w(A2[1], E2[0]), w(-E2[1], A2[0])), -C2[2]), _4(y(w(A2[1], C2[0]), w(-C2[1], A2[0])), E2[2]))), -S2[3]), _4(y(_4(y(w(S2[1], E2[0]), w(-E2[1], S2[0])), A2[2]), y(_4(y(w(A2[1], E2[0]), w(-E2[1], A2[0])), -S2[2]), _4(y(w(A2[1], S2[0]), w(-S2[1], A2[0])), E2[2]))), C2[3]))), y(_4(y(_4(y(w(S2[1], C2[0]), w(-C2[1], S2[0])), A2[2]), y(_4(y(w(A2[1], C2[0]), w(-C2[1], A2[0])), -S2[2]), _4(y(w(A2[1], S2[0]), w(-S2[1], A2[0])), C2[2]))), -E2[3]), y(_4(y(_4(y(w(C2[1], E2[0]), w(-E2[1], C2[0])), A2[2]), y(_4(y(w(A2[1], E2[0]), w(-E2[1], A2[0])), -C2[2]), _4(y(w(A2[1], C2[0]), w(-C2[1], A2[0])), E2[2]))), T2[3]), _4(y(_4(y(w(C2[1], E2[0]), w(-E2[1], C2[0])), T2[2]), y(_4(y(w(T2[1], E2[0]), w(-E2[1], T2[0])), -C2[2]), _4(y(w(T2[1], C2[0]), w(-C2[1], T2[0])), E2[2]))), -A2[3])))), y(y(_4(y(_4(y(w(A2[1], E2[0]), w(-E2[1], A2[0])), T2[2]), y(_4(y(w(T2[1], E2[0]), w(-E2[1], T2[0])), -A2[2]), _4(y(w(T2[1], A2[0]), w(-A2[1], T2[0])), E2[2]))), C2[3]), y(_4(y(_4(y(w(A2[1], C2[0]), w(-C2[1], A2[0])), T2[2]), y(_4(y(w(T2[1], C2[0]), w(-C2[1], T2[0])), -A2[2]), _4(y(w(T2[1], A2[0]), w(-A2[1], T2[0])), C2[2]))), -E2[3]), _4(y(_4(y(w(S2[1], C2[0]), w(-C2[1], S2[0])), A2[2]), y(_4(y(w(A2[1], C2[0]), w(-C2[1], A2[0])), -S2[2]), _4(y(w(A2[1], S2[0]), w(-S2[1], A2[0])), C2[2]))), T2[3]))), y(_4(y(_4(y(w(S2[1], C2[0]), w(-C2[1], S2[0])), T2[2]), y(_4(y(w(T2[1], C2[0]), w(-C2[1], T2[0])), -S2[2]), _4(y(w(T2[1], S2[0]), w(-S2[1], T2[0])), C2[2]))), -A2[3]), y(_4(y(_4(y(w(A2[1], C2[0]), w(-C2[1], A2[0])), T2[2]), y(_4(y(w(T2[1], C2[0]), w(-C2[1], T2[0])), -A2[2]), _4(y(w(T2[1], A2[0]), w(-A2[1], T2[0])), C2[2]))), S2[3]), _4(y(_4(y(w(A2[1], S2[0]), w(-S2[1], A2[0])), T2[2]), y(_4(y(w(T2[1], S2[0]), w(-S2[1], T2[0])), -A2[2]), _4(y(w(T2[1], A2[0]), w(-A2[1], T2[0])), S2[2]))), -C2[3]))))), N2 = y(y(y(_4(y(_4(y(w(C2[1], E2[0]), w(-E2[1], C2[0])), S2[2]), y(_4(y(w(S2[1], E2[0]), w(-E2[1], S2[0])), -C2[2]), _4(y(w(S2[1], C2[0]), w(-C2[1], S2[0])), E2[2]))), T2[3]), _4(y(_4(y(w(C2[1], E2[0]), w(-E2[1], C2[0])), T2[2]), y(_4(y(w(T2[1], E2[0]), w(-E2[1], T2[0])), -C2[2]), _4(y(w(T2[1], C2[0]), w(-C2[1], T2[0])), E2[2]))), -S2[3])), y(_4(y(_4(y(w(S2[1], E2[0]), w(-E2[1], S2[0])), T2[2]), y(_4(y(w(T2[1], E2[0]), w(-E2[1], T2[0])), -S2[2]), _4(y(w(T2[1], S2[0]), w(-S2[1], T2[0])), E2[2]))), C2[3]), _4(y(_4(y(w(S2[1], C2[0]), w(-C2[1], S2[0])), T2[2]), y(_4(y(w(T2[1], C2[0]), w(-C2[1], T2[0])), -S2[2]), _4(y(w(T2[1], S2[0]), w(-S2[1], T2[0])), C2[2]))), -E2[3]))), y(y(_4(y(_4(y(w(S2[1], E2[0]), w(-E2[1], S2[0])), A2[2]), y(_4(y(w(A2[1], E2[0]), w(-E2[1], A2[0])), -S2[2]), _4(y(w(A2[1], S2[0]), w(-S2[1], A2[0])), E2[2]))), T2[3]), _4(y(_4(y(w(S2[1], E2[0]), w(-E2[1], S2[0])), T2[2]), y(_4(y(w(T2[1], E2[0]), w(-E2[1], T2[0])), -S2[2]), _4(y(w(T2[1], S2[0]), w(-S2[1], T2[0])), E2[2]))), -A2[3])), y(_4(y(_4(y(w(A2[1], E2[0]), w(-E2[1], A2[0])), T2[2]), y(_4(y(w(T2[1], E2[0]), w(-E2[1], T2[0])), -A2[2]), _4(y(w(T2[1], A2[0]), w(-A2[1], T2[0])), E2[2]))), S2[3]), _4(y(_4(y(w(A2[1], S2[0]), w(-S2[1], A2[0])), T2[2]), y(_4(y(w(T2[1], S2[0]), w(-S2[1], T2[0])), -A2[2]), _4(y(w(T2[1], A2[0]), w(-A2[1], T2[0])), S2[2]))), -E2[3])))), D2 = k(F13, N2);
                  return D2[D2.length - 1];
                };
              }
              function d(y) {
                return (y === 3 ? f : y === 4 ? h : p)(l, i, u2, c);
              }
              var v = d(3), m = d(4), g = [function() {
                return 0;
              }, function() {
                return 0;
              }, function(y, w) {
                return w[0] - y[0];
              }, function(y, w, _4) {
                var k, T2 = (y[1] - _4[1]) * (w[0] - _4[0]), A2 = (y[0] - _4[0]) * (w[1] - _4[1]), S2 = T2 - A2;
                if (T2 > 0) {
                  if (A2 <= 0) return S2;
                  k = T2 + A2;
                } else {
                  if (!(T2 < 0) || A2 >= 0) return S2;
                  k = -(T2 + A2);
                }
                var C2 = 33306690738754716e-32 * k;
                return S2 >= C2 || S2 <= -C2 ? S2 : v(y, w, _4);
              }, function(y, w, _4, k) {
                var T2 = y[0] - k[0], A2 = w[0] - k[0], S2 = _4[0] - k[0], C2 = y[1] - k[1], E2 = w[1] - k[1], F13 = _4[1] - k[1], N2 = y[2] - k[2], D2 = w[2] - k[2], I2 = _4[2] - k[2], O2 = A2 * F13, L2 = S2 * E2, V2 = S2 * C2, W2 = T2 * F13, X2 = T2 * E2, Y2 = A2 * C2, K2 = N2 * (O2 - L2) + D2 * (V2 - W2) + I2 * (X2 - Y2), q = 7771561172376103e-31 * ((Math.abs(O2) + Math.abs(L2)) * Math.abs(N2) + (Math.abs(V2) + Math.abs(W2)) * Math.abs(D2) + (Math.abs(X2) + Math.abs(Y2)) * Math.abs(I2));
                return K2 > q || -K2 > q ? K2 : m(y, w, _4, k);
              }];
              function x(y) {
                var w = g[y.length];
                return w || (w = g[y.length] = d(y.length)), w.apply(void 0, y);
              }
              function b(y, w, _4, k, T2, A2, S2) {
                return function(C2, E2, F13, N2, D2) {
                  switch (arguments.length) {
                    case 0:
                    case 1:
                      return 0;
                    case 2:
                      return k(C2, E2);
                    case 3:
                      return T2(C2, E2, F13);
                    case 4:
                      return A2(C2, E2, F13, N2);
                    case 5:
                      return S2(C2, E2, F13, N2, D2);
                  }
                  for (var I2 = new Array(arguments.length), O2 = 0; O2 < arguments.length; ++O2) I2[O2] = arguments[O2];
                  return y(I2);
                };
              }
              (function() {
                for (; g.length <= 5; ) g.push(d(g.length));
                o.exports = b.apply(void 0, [x].concat(g));
                for (var y = 0; y <= 5; ++y) o.exports[y] = g[y];
              })();
            }, { "robust-scale": 286, "robust-subtract": 288, "robust-sum": 289, "two-product": 306 }], 285: [function(a, o, s) {
              "use strict";
              var i = a("robust-sum"), l = a("robust-scale");
              o.exports = function(u2, c) {
                if (u2.length === 1) return l(c, u2[0]);
                if (c.length === 1) return l(u2, c[0]);
                if (u2.length === 0 || c.length === 0) return [0];
                var f = [0];
                if (u2.length < c.length) for (var h = 0; h < u2.length; ++h) f = i(f, l(c, u2[h]));
                else for (h = 0; h < c.length; ++h) f = i(f, l(u2, c[h]));
                return f;
              };
            }, { "robust-scale": 286, "robust-sum": 289 }], 286: [function(a, o, s) {
              "use strict";
              var i = a("two-product"), l = a("two-sum");
              o.exports = function(u2, c) {
                var f = u2.length;
                if (f === 1) {
                  var h = i(u2[0], c);
                  return h[0] ? h : [h[1]];
                }
                var p = new Array(2 * f), d = [0.1, 0.1], v = [0.1, 0.1], m = 0;
                i(u2[0], c, d), d[0] && (p[m++] = d[0]);
                for (var g = 1; g < f; ++g) {
                  i(u2[g], c, v);
                  var x = d[1];
                  l(x, v[0], d), d[0] && (p[m++] = d[0]);
                  var b = v[1], y = d[1], w = b + y, _4 = y - (w - b);
                  d[1] = w, _4 && (p[m++] = _4);
                }
                return d[1] && (p[m++] = d[1]), m === 0 && (p[m++] = 0), p.length = m, p;
              };
            }, { "two-product": 306, "two-sum": 307 }], 287: [function(a, o, s) {
              "use strict";
              o.exports = function(l, u2, c, f) {
                var h = i(l, c, f), p = i(u2, c, f);
                if (h > 0 && p > 0 || h < 0 && p < 0) return false;
                var d = i(c, l, u2), v = i(f, l, u2);
                return d > 0 && v > 0 || d < 0 && v < 0 ? false : h === 0 && p === 0 && d === 0 && v === 0 ? function(m, g, x, b) {
                  for (var y = 0; y < 2; ++y) {
                    var w = m[y], _4 = g[y], k = Math.min(w, _4), T2 = Math.max(w, _4), A2 = x[y], S2 = b[y], C2 = Math.min(A2, S2);
                    if (Math.max(A2, S2) < k || T2 < C2) return false;
                  }
                  return true;
                }(l, u2, c, f) : true;
              };
              var i = a("robust-orientation")[3];
            }, { "robust-orientation": 284 }], 288: [function(a, o, s) {
              "use strict";
              o.exports = function(i, l) {
                var u2 = 0 | i.length, c = 0 | l.length;
                if (u2 === 1 && c === 1) return function(F13, N2) {
                  var D2 = F13 + N2, I2 = D2 - F13, O2 = F13 - (D2 - I2) + (N2 - I2);
                  return O2 ? [O2, D2] : [D2];
                }(i[0], -l[0]);
                var f, h, p = new Array(u2 + c), d = 0, v = 0, m = 0, g = Math.abs, x = i[v], b = g(x), y = -l[m], w = g(y);
                b < w ? (h = x, (v += 1) < u2 && (x = i[v], b = g(x))) : (h = y, (m += 1) < c && (y = -l[m], w = g(y))), v < u2 && b < w || m >= c ? (f = x, (v += 1) < u2 && (x = i[v], b = g(x))) : (f = y, (m += 1) < c && (y = -l[m], w = g(y)));
                for (var _4, k, T2 = f + h, A2 = T2 - f, S2 = h - A2, C2 = S2, E2 = T2; v < u2 && m < c; ) b < w ? (f = x, (v += 1) < u2 && (x = i[v], b = g(x))) : (f = y, (m += 1) < c && (y = -l[m], w = g(y))), (S2 = (h = C2) - (A2 = (T2 = f + h) - f)) && (p[d++] = S2), C2 = E2 - ((_4 = E2 + T2) - (k = _4 - E2)) + (T2 - k), E2 = _4;
                for (; v < u2; ) (S2 = (h = C2) - (A2 = (T2 = (f = x) + h) - f)) && (p[d++] = S2), C2 = E2 - ((_4 = E2 + T2) - (k = _4 - E2)) + (T2 - k), E2 = _4, (v += 1) < u2 && (x = i[v]);
                for (; m < c; ) (S2 = (h = C2) - (A2 = (T2 = (f = y) + h) - f)) && (p[d++] = S2), C2 = E2 - ((_4 = E2 + T2) - (k = _4 - E2)) + (T2 - k), E2 = _4, (m += 1) < c && (y = -l[m]);
                return C2 && (p[d++] = C2), E2 && (p[d++] = E2), d || (p[d++] = 0), p.length = d, p;
              };
            }, {}], 289: [function(a, o, s) {
              "use strict";
              o.exports = function(i, l) {
                var u2 = 0 | i.length, c = 0 | l.length;
                if (u2 === 1 && c === 1) return function(F13, N2) {
                  var D2 = F13 + N2, I2 = D2 - F13, O2 = F13 - (D2 - I2) + (N2 - I2);
                  return O2 ? [O2, D2] : [D2];
                }(i[0], l[0]);
                var f, h, p = new Array(u2 + c), d = 0, v = 0, m = 0, g = Math.abs, x = i[v], b = g(x), y = l[m], w = g(y);
                b < w ? (h = x, (v += 1) < u2 && (x = i[v], b = g(x))) : (h = y, (m += 1) < c && (y = l[m], w = g(y))), v < u2 && b < w || m >= c ? (f = x, (v += 1) < u2 && (x = i[v], b = g(x))) : (f = y, (m += 1) < c && (y = l[m], w = g(y)));
                for (var _4, k, T2 = f + h, A2 = T2 - f, S2 = h - A2, C2 = S2, E2 = T2; v < u2 && m < c; ) b < w ? (f = x, (v += 1) < u2 && (x = i[v], b = g(x))) : (f = y, (m += 1) < c && (y = l[m], w = g(y))), (S2 = (h = C2) - (A2 = (T2 = f + h) - f)) && (p[d++] = S2), C2 = E2 - ((_4 = E2 + T2) - (k = _4 - E2)) + (T2 - k), E2 = _4;
                for (; v < u2; ) (S2 = (h = C2) - (A2 = (T2 = (f = x) + h) - f)) && (p[d++] = S2), C2 = E2 - ((_4 = E2 + T2) - (k = _4 - E2)) + (T2 - k), E2 = _4, (v += 1) < u2 && (x = i[v]);
                for (; m < c; ) (S2 = (h = C2) - (A2 = (T2 = (f = y) + h) - f)) && (p[d++] = S2), C2 = E2 - ((_4 = E2 + T2) - (k = _4 - E2)) + (T2 - k), E2 = _4, (m += 1) < c && (y = l[m]);
                return C2 && (p[d++] = C2), E2 && (p[d++] = E2), d || (p[d++] = 0), p.length = d, p;
              };
            }, {}], 290: [function(a, o, s) {
              "use strict";
              o.exports = function(u2) {
                return l(i(u2));
              };
              var i = a("boundary-cells"), l = a("reduce-simplicial-complex");
            }, { "boundary-cells": 34, "reduce-simplicial-complex": 276 }], 291: [function(a, o, s) {
              "use strict";
              o.exports = function(f, h, p, d) {
                if (p = p || 0, d === void 0 && (d = function(_4) {
                  for (var k = _4.length, T2 = 0, A2 = 0; A2 < k; ++A2) T2 = 0 | Math.max(T2, _4[A2].length);
                  return T2 - 1;
                }(f)), f.length === 0 || d < 1) return { cells: [], vertexIds: [], vertexWeights: [] };
                var v = function(_4, k) {
                  for (var T2 = _4.length, A2 = l.mallocUint8(T2), S2 = 0; S2 < T2; ++S2) A2[S2] = _4[S2] < k | 0;
                  return A2;
                }(h, +p), m = function(_4, k) {
                  for (var T2 = _4.length, A2 = k * (k + 1) / 2 * T2 | 0, S2 = l.mallocUint32(2 * A2), C2 = 0, E2 = 0; E2 < T2; ++E2) for (var F13 = _4[E2], N2 = (k = F13.length, 0); N2 < k; ++N2) for (var D2 = 0; D2 < N2; ++D2) {
                    var I2 = F13[D2], O2 = F13[N2];
                    S2[C2++] = 0 | Math.min(I2, O2), S2[C2++] = 0 | Math.max(I2, O2);
                  }
                  u2(i(S2, [C2 / 2 | 0, 2]));
                  var L2 = 2;
                  for (E2 = 2; E2 < C2; E2 += 2) S2[E2 - 2] === S2[E2] && S2[E2 - 1] === S2[E2 + 1] || (S2[L2++] = S2[E2], S2[L2++] = S2[E2 + 1]);
                  return i(S2, [L2 / 2 | 0, 2]);
                }(f, d), g = function(_4, k, T2, A2) {
                  for (var S2 = _4.data, C2 = _4.shape[0], E2 = l.mallocDouble(C2), F13 = 0, N2 = 0; N2 < C2; ++N2) {
                    var D2 = S2[2 * N2], I2 = S2[2 * N2 + 1];
                    if (T2[D2] !== T2[I2]) {
                      var O2 = k[D2], L2 = k[I2];
                      S2[2 * F13] = D2, S2[2 * F13 + 1] = I2, E2[F13++] = (L2 - A2) / (L2 - O2);
                    }
                  }
                  return _4.shape[0] = F13, i(E2, [F13]);
                }(m, h, v, +p), x = function(_4, k) {
                  var T2 = l.mallocInt32(2 * k), A2 = _4.shape[0], S2 = _4.data;
                  T2[0] = 0;
                  for (var C2 = 0, E2 = 0; E2 < A2; ++E2) {
                    var F13 = S2[2 * E2];
                    if (F13 !== C2) {
                      for (T2[2 * C2 + 1] = E2; ++C2 < F13; ) T2[2 * C2] = E2, T2[2 * C2 + 1] = E2;
                      T2[2 * C2] = E2;
                    }
                  }
                  for (T2[2 * C2 + 1] = A2; ++C2 < k; ) T2[2 * C2] = T2[2 * C2 + 1] = A2;
                  return T2;
                }(m, 0 | h.length), b = c(d)(f, m.data, x, v), y = function(_4) {
                  for (var k = 0 | _4.shape[0], T2 = _4.data, A2 = new Array(k), S2 = 0; S2 < k; ++S2) A2[S2] = [T2[2 * S2], T2[2 * S2 + 1]];
                  return A2;
                }(m), w = [].slice.call(g.data, 0, g.shape[0]);
                return l.free(v), l.free(m.data), l.free(g.data), l.free(x), { cells: b, vertexIds: y, vertexWeights: w };
              };
              var i = a("ndarray"), l = a("typedarray-pool"), u2 = a("ndarray-sort"), c = a("./lib/codegen");
            }, { "./lib/codegen": 292, ndarray: 259, "ndarray-sort": 258, "typedarray-pool": 308 }], 292: [function(a, o, s) {
              "use strict";
              o.exports = function(l) {
                return i[l]();
              };
              var i = [function() {
                return function(l, u2, c, f) {
                  for (var h = l.length, p = 0; p < h; ++p) l[p].length;
                  return [];
                };
              }, function() {
                function l(u2, c, f, h) {
                  for (var p = 0 | Math.min(f, h), d = 0 | Math.max(f, h), v = u2[2 * p], m = u2[2 * p + 1]; v < m; ) {
                    var g = v + m >> 1, x = c[2 * g + 1];
                    if (x === d) return g;
                    d < x ? m = g : v = g + 1;
                  }
                  return v;
                }
                return function(u2, c, f, h) {
                  for (var p = u2.length, d = [], v = 0; v < p; ++v) {
                    var m = u2[v];
                    if (m.length === 2) {
                      var g = (h[m[0]] << 0) + (h[m[1]] << 1);
                      if (g === 0 || g === 3) continue;
                      switch (g) {
                        case 0:
                          break;
                        case 1:
                          d.push([l(f, c, m[0], m[1])]);
                          break;
                        case 2:
                          d.push([l(f, c, m[1], m[0])]);
                      }
                    }
                  }
                  return d;
                };
              }, function() {
                function l(u2, c, f, h) {
                  for (var p = 0 | Math.min(f, h), d = 0 | Math.max(f, h), v = u2[2 * p], m = u2[2 * p + 1]; v < m; ) {
                    var g = v + m >> 1, x = c[2 * g + 1];
                    if (x === d) return g;
                    d < x ? m = g : v = g + 1;
                  }
                  return v;
                }
                return function(u2, c, f, h) {
                  for (var p = u2.length, d = [], v = 0; v < p; ++v) {
                    var m = u2[v], g = m.length;
                    if (g === 3) {
                      if ((x = (h[m[0]] << 0) + (h[m[1]] << 1) + (h[m[2]] << 2)) === 0 || x === 7) continue;
                      switch (x) {
                        case 0:
                          break;
                        case 1:
                          d.push([l(f, c, m[0], m[2]), l(f, c, m[0], m[1])]);
                          break;
                        case 2:
                          d.push([l(f, c, m[1], m[0]), l(f, c, m[1], m[2])]);
                          break;
                        case 3:
                          d.push([l(f, c, m[0], m[2]), l(f, c, m[1], m[2])]);
                          break;
                        case 4:
                          d.push([l(f, c, m[2], m[1]), l(f, c, m[2], m[0])]);
                          break;
                        case 5:
                          d.push([l(f, c, m[2], m[1]), l(f, c, m[0], m[1])]);
                          break;
                        case 6:
                          d.push([l(f, c, m[1], m[0]), l(f, c, m[2], m[0])]);
                      }
                    } else if (g === 2) {
                      var x;
                      if ((x = (h[m[0]] << 0) + (h[m[1]] << 1)) === 0 || x === 3) continue;
                      switch (x) {
                        case 0:
                          break;
                        case 1:
                          d.push([l(f, c, m[0], m[1])]);
                          break;
                        case 2:
                          d.push([l(f, c, m[1], m[0])]);
                      }
                    }
                  }
                  return d;
                };
              }, function() {
                function l(u2, c, f, h) {
                  for (var p = 0 | Math.min(f, h), d = 0 | Math.max(f, h), v = u2[2 * p], m = u2[2 * p + 1]; v < m; ) {
                    var g = v + m >> 1, x = c[2 * g + 1];
                    if (x === d) return g;
                    d < x ? m = g : v = g + 1;
                  }
                  return v;
                }
                return function(u2, c, f, h) {
                  for (var p = u2.length, d = [], v = 0; v < p; ++v) {
                    var m = u2[v], g = m.length;
                    if (g === 4) {
                      if ((x = (h[m[0]] << 0) + (h[m[1]] << 1) + (h[m[2]] << 2) + (h[m[3]] << 3)) === 0 || x === 15) continue;
                      switch (x) {
                        case 0:
                          break;
                        case 1:
                          d.push([l(f, c, m[0], m[1]), l(f, c, m[0], m[2]), l(f, c, m[0], m[3])]);
                          break;
                        case 2:
                          d.push([l(f, c, m[1], m[2]), l(f, c, m[1], m[0]), l(f, c, m[1], m[3])]);
                          break;
                        case 3:
                          d.push([l(f, c, m[1], m[2]), l(f, c, m[0], m[2]), l(f, c, m[0], m[3])], [l(f, c, m[1], m[3]), l(f, c, m[1], m[2]), l(f, c, m[0], m[3])]);
                          break;
                        case 4:
                          d.push([l(f, c, m[2], m[0]), l(f, c, m[2], m[1]), l(f, c, m[2], m[3])]);
                          break;
                        case 5:
                          d.push([l(f, c, m[0], m[1]), l(f, c, m[2], m[1]), l(f, c, m[0], m[3])], [l(f, c, m[2], m[1]), l(f, c, m[2], m[3]), l(f, c, m[0], m[3])]);
                          break;
                        case 6:
                          d.push([l(f, c, m[2], m[0]), l(f, c, m[1], m[0]), l(f, c, m[1], m[3])], [l(f, c, m[2], m[3]), l(f, c, m[2], m[0]), l(f, c, m[1], m[3])]);
                          break;
                        case 7:
                          d.push([l(f, c, m[0], m[3]), l(f, c, m[1], m[3]), l(f, c, m[2], m[3])]);
                          break;
                        case 8:
                          d.push([l(f, c, m[3], m[1]), l(f, c, m[3], m[0]), l(f, c, m[3], m[2])]);
                          break;
                        case 9:
                          d.push([l(f, c, m[3], m[1]), l(f, c, m[0], m[1]), l(f, c, m[0], m[2])], [l(f, c, m[3], m[2]), l(f, c, m[3], m[1]), l(f, c, m[0], m[2])]);
                          break;
                        case 10:
                          d.push([l(f, c, m[1], m[0]), l(f, c, m[3], m[0]), l(f, c, m[1], m[2])], [l(f, c, m[3], m[0]), l(f, c, m[3], m[2]), l(f, c, m[1], m[2])]);
                          break;
                        case 11:
                          d.push([l(f, c, m[1], m[2]), l(f, c, m[0], m[2]), l(f, c, m[3], m[2])]);
                          break;
                        case 12:
                          d.push([l(f, c, m[3], m[0]), l(f, c, m[2], m[0]), l(f, c, m[2], m[1])], [l(f, c, m[3], m[1]), l(f, c, m[3], m[0]), l(f, c, m[2], m[1])]);
                          break;
                        case 13:
                          d.push([l(f, c, m[0], m[1]), l(f, c, m[2], m[1]), l(f, c, m[3], m[1])]);
                          break;
                        case 14:
                          d.push([l(f, c, m[2], m[0]), l(f, c, m[1], m[0]), l(f, c, m[3], m[0])]);
                      }
                    } else if (g === 3) {
                      if ((x = (h[m[0]] << 0) + (h[m[1]] << 1) + (h[m[2]] << 2)) === 0 || x === 7) continue;
                      switch (x) {
                        case 0:
                          break;
                        case 1:
                          d.push([l(f, c, m[0], m[2]), l(f, c, m[0], m[1])]);
                          break;
                        case 2:
                          d.push([l(f, c, m[1], m[0]), l(f, c, m[1], m[2])]);
                          break;
                        case 3:
                          d.push([l(f, c, m[0], m[2]), l(f, c, m[1], m[2])]);
                          break;
                        case 4:
                          d.push([l(f, c, m[2], m[1]), l(f, c, m[2], m[0])]);
                          break;
                        case 5:
                          d.push([l(f, c, m[2], m[1]), l(f, c, m[0], m[1])]);
                          break;
                        case 6:
                          d.push([l(f, c, m[1], m[0]), l(f, c, m[2], m[0])]);
                      }
                    } else if (g === 2) {
                      var x;
                      if ((x = (h[m[0]] << 0) + (h[m[1]] << 1)) === 0 || x === 3) continue;
                      switch (x) {
                        case 0:
                          break;
                        case 1:
                          d.push([l(f, c, m[0], m[1])]);
                          break;
                        case 2:
                          d.push([l(f, c, m[1], m[0])]);
                      }
                    }
                  }
                  return d;
                };
              }];
            }, {}], 293: [function(a, o, s) {
              "use strict";
              var i = a("bit-twiddle"), l = a("union-find");
              function u2(m, g) {
                var x = m.length, b = m.length - g.length, y = Math.min;
                if (b) return b;
                switch (x) {
                  case 0:
                    return 0;
                  case 1:
                    return m[0] - g[0];
                  case 2:
                    return (k = m[0] + m[1] - g[0] - g[1]) || y(m[0], m[1]) - y(g[0], g[1]);
                  case 3:
                    var w = m[0] + m[1], _4 = g[0] + g[1];
                    if (k = w + m[2] - (_4 + g[2])) return k;
                    var k, T2 = y(m[0], m[1]), A2 = y(g[0], g[1]);
                    return (k = y(T2, m[2]) - y(A2, g[2])) || y(T2 + m[2], w) - y(A2 + g[2], _4);
                  default:
                    var S2 = m.slice(0);
                    S2.sort();
                    var C2 = g.slice(0);
                    C2.sort();
                    for (var E2 = 0; E2 < x; ++E2) if (b = S2[E2] - C2[E2]) return b;
                    return 0;
                }
              }
              function c(m, g) {
                return u2(m[0], g[0]);
              }
              function f(m, g) {
                if (g) {
                  for (var x = m.length, b = new Array(x), y = 0; y < x; ++y) b[y] = [m[y], g[y]];
                  for (b.sort(c), y = 0; y < x; ++y) m[y] = b[y][0], g[y] = b[y][1];
                  return m;
                }
                return m.sort(u2), m;
              }
              function h(m) {
                if (m.length === 0) return [];
                for (var g = 1, x = m.length, b = 1; b < x; ++b) {
                  var y = m[b];
                  if (u2(y, m[b - 1])) {
                    if (b === g) {
                      g++;
                      continue;
                    }
                    m[g++] = y;
                  }
                }
                return m.length = g, m;
              }
              function p(m, g) {
                for (var x = 0, b = m.length - 1, y = -1; x <= b; ) {
                  var w = x + b >> 1, _4 = u2(m[w], g);
                  _4 <= 0 ? (_4 === 0 && (y = w), x = w + 1) : _4 > 0 && (b = w - 1);
                }
                return y;
              }
              function d(m, g) {
                for (var x = new Array(m.length), b = 0, y = x.length; b < y; ++b) x[b] = [];
                for (var w = [], _4 = (b = 0, g.length); b < _4; ++b) for (var k = g[b], T2 = k.length, A2 = 1, S2 = 1 << T2; A2 < S2; ++A2) {
                  w.length = i.popCount(A2);
                  for (var C2 = 0, E2 = 0; E2 < T2; ++E2) A2 & 1 << E2 && (w[C2++] = k[E2]);
                  var F13 = p(m, w);
                  if (!(F13 < 0)) for (; x[F13++].push(b), !(F13 >= m.length || u2(m[F13], w) !== 0); ) ;
                }
                return x;
              }
              function v(m, g) {
                if (g < 0) return [];
                for (var x = [], b = (1 << g + 1) - 1, y = 0; y < m.length; ++y) for (var w = m[y], _4 = b; _4 < 1 << w.length; _4 = i.nextCombination(_4)) {
                  for (var k = new Array(g + 1), T2 = 0, A2 = 0; A2 < w.length; ++A2) _4 & 1 << A2 && (k[T2++] = w[A2]);
                  x.push(k);
                }
                return f(x);
              }
              s.dimension = function(m) {
                for (var g = 0, x = Math.max, b = 0, y = m.length; b < y; ++b) g = x(g, m[b].length);
                return g - 1;
              }, s.countVertices = function(m) {
                for (var g = -1, x = Math.max, b = 0, y = m.length; b < y; ++b) for (var w = m[b], _4 = 0, k = w.length; _4 < k; ++_4) g = x(g, w[_4]);
                return g + 1;
              }, s.cloneCells = function(m) {
                for (var g = new Array(m.length), x = 0, b = m.length; x < b; ++x) g[x] = m[x].slice(0);
                return g;
              }, s.compareCells = u2, s.normalize = f, s.unique = h, s.findCell = p, s.incidence = d, s.dual = function(m, g) {
                if (!g) return d(h(v(m, 0)), m);
                for (var x = new Array(g), b = 0; b < g; ++b) x[b] = [];
                b = 0;
                for (var y = m.length; b < y; ++b) for (var w = m[b], _4 = 0, k = w.length; _4 < k; ++_4) x[w[_4]].push(b);
                return x;
              }, s.explode = function(m) {
                for (var g = [], x = 0, b = m.length; x < b; ++x) for (var y = m[x], w = 0 | y.length, _4 = 1, k = 1 << w; _4 < k; ++_4) {
                  for (var T2 = [], A2 = 0; A2 < w; ++A2) _4 >>> A2 & 1 && T2.push(y[A2]);
                  g.push(T2);
                }
                return f(g);
              }, s.skeleton = v, s.boundary = function(m) {
                for (var g = [], x = 0, b = m.length; x < b; ++x) for (var y = m[x], w = 0, _4 = y.length; w < _4; ++w) {
                  for (var k = new Array(y.length - 1), T2 = 0, A2 = 0; T2 < _4; ++T2) T2 !== w && (k[A2++] = y[T2]);
                  g.push(k);
                }
                return f(g);
              }, s.connectedComponents = function(m, g) {
                return g ? function(x, b) {
                  for (var y = new l(b), w = 0; w < x.length; ++w) for (var _4 = x[w], k = 0; k < _4.length; ++k) for (var T2 = k + 1; T2 < _4.length; ++T2) y.link(_4[k], _4[T2]);
                  var A2 = [], S2 = y.ranks;
                  for (w = 0; w < S2.length; ++w) S2[w] = -1;
                  for (w = 0; w < x.length; ++w) {
                    var C2 = y.find(x[w][0]);
                    S2[C2] < 0 ? (S2[C2] = A2.length, A2.push([x[w].slice(0)])) : A2[S2[C2]].push(x[w].slice(0));
                  }
                  return A2;
                }(m, g) : function(x) {
                  for (var b = h(f(v(x, 0))), y = new l(b.length), w = 0; w < x.length; ++w) for (var _4 = x[w], k = 0; k < _4.length; ++k) for (var T2 = p(b, [_4[k]]), A2 = k + 1; A2 < _4.length; ++A2) y.link(T2, p(b, [_4[A2]]));
                  var S2 = [], C2 = y.ranks;
                  for (w = 0; w < C2.length; ++w) C2[w] = -1;
                  for (w = 0; w < x.length; ++w) {
                    var E2 = y.find(p(b, [x[w][0]]));
                    C2[E2] < 0 ? (C2[E2] = S2.length, S2.push([x[w].slice(0)])) : S2[C2[E2]].push(x[w].slice(0));
                  }
                  return S2;
                }(m);
              };
            }, { "bit-twiddle": 32, "union-find": 309 }], 294: [function(a, o, s) {
              arguments[4][32][0].apply(s, arguments);
            }, { dup: 32 }], 295: [function(a, o, s) {
              arguments[4][293][0].apply(s, arguments);
            }, { "bit-twiddle": 294, dup: 293, "union-find": 296 }], 296: [function(a, o, s) {
              "use strict";
              function i(l) {
                this.roots = new Array(l), this.ranks = new Array(l);
                for (var u2 = 0; u2 < l; ++u2) this.roots[u2] = u2, this.ranks[u2] = 0;
              }
              o.exports = i, i.prototype.length = function() {
                return this.roots.length;
              }, i.prototype.makeSet = function() {
                var l = this.roots.length;
                return this.roots.push(l), this.ranks.push(0), l;
              }, i.prototype.find = function(l) {
                for (var u2 = this.roots; u2[l] !== l; ) {
                  var c = u2[l];
                  u2[l] = u2[c], l = c;
                }
                return l;
              }, i.prototype.link = function(l, u2) {
                var c = this.find(l), f = this.find(u2);
                if (c !== f) {
                  var h = this.ranks, p = this.roots, d = h[c], v = h[f];
                  d < v ? p[c] = f : v < d ? p[f] = c : (p[f] = c, ++h[c]);
                }
              };
            }, {}], 297: [function(a, o, s) {
              "use strict";
              o.exports = function(u2, c, f) {
                for (var h = c.length, p = u2.length, d = new Array(h), v = new Array(h), m = new Array(h), g = new Array(h), x = 0; x < h; ++x) d[x] = v[x] = -1, m[x] = 1 / 0, g[x] = false;
                for (x = 0; x < p; ++x) {
                  var b = u2[x];
                  if (b.length !== 2) throw new Error("Input must be a graph");
                  var y = b[1], w = b[0];
                  v[w] !== -1 ? v[w] = -2 : v[w] = y, d[y] !== -1 ? d[y] = -2 : d[y] = w;
                }
                function _4(Y2) {
                  if (g[Y2]) return 1 / 0;
                  var K2, q, re, R2, z, H2 = d[Y2], te = v[Y2];
                  return H2 < 0 || te < 0 ? 1 / 0 : (K2 = c[Y2], q = c[H2], re = c[te], R2 = Math.abs(i(K2, q, re)), z = Math.sqrt(Math.pow(q[0] - re[0], 2) + Math.pow(q[1] - re[1], 2)), R2 / z);
                }
                function k(Y2, K2) {
                  var q = D2[Y2], re = D2[K2];
                  D2[Y2] = re, D2[K2] = q, I2[q] = K2, I2[re] = Y2;
                }
                function T2(Y2) {
                  return m[D2[Y2]];
                }
                function A2(Y2) {
                  return 1 & Y2 ? Y2 - 1 >> 1 : (Y2 >> 1) - 1;
                }
                function S2(Y2) {
                  for (var K2 = T2(Y2); ; ) {
                    var q = K2, re = 2 * Y2 + 1, R2 = 2 * (Y2 + 1), z = Y2;
                    if (re < O2) {
                      var H2 = T2(re);
                      H2 < q && (z = re, q = H2);
                    }
                    if (R2 < O2 && T2(R2) < q && (z = R2), z === Y2) return Y2;
                    k(Y2, z), Y2 = z;
                  }
                }
                function C2(Y2) {
                  for (var K2 = T2(Y2); Y2 > 0; ) {
                    var q = A2(Y2);
                    if (q >= 0 && K2 < T2(q)) {
                      k(Y2, q), Y2 = q;
                      continue;
                    }
                    return Y2;
                  }
                }
                function E2() {
                  if (O2 > 0) {
                    var Y2 = D2[0];
                    return k(0, O2 - 1), O2 -= 1, S2(0), Y2;
                  }
                  return -1;
                }
                function F13(Y2, K2) {
                  var q = D2[Y2];
                  return m[q] === K2 ? Y2 : (m[q] = -1 / 0, C2(Y2), E2(), m[q] = K2, C2((O2 += 1) - 1));
                }
                function N2(Y2) {
                  if (!g[Y2]) {
                    g[Y2] = true;
                    var K2 = d[Y2], q = v[Y2];
                    d[q] >= 0 && (d[q] = K2), v[K2] >= 0 && (v[K2] = q), I2[K2] >= 0 && F13(I2[K2], _4(K2)), I2[q] >= 0 && F13(I2[q], _4(q));
                  }
                }
                var D2 = [], I2 = new Array(h);
                for (x = 0; x < h; ++x) (m[x] = _4(x)) < 1 / 0 ? (I2[x] = D2.length, D2.push(x)) : I2[x] = -1;
                var O2 = D2.length;
                for (x = O2 >> 1; x >= 0; --x) S2(x);
                for (; ; ) {
                  var L2 = E2();
                  if (L2 < 0 || m[L2] > f) break;
                  N2(L2);
                }
                var V2 = [];
                for (x = 0; x < h; ++x) g[x] || (I2[x] = V2.length, V2.push(c[x].slice()));
                V2.length;
                function W2(Y2, K2) {
                  if (Y2[K2] < 0) return K2;
                  var q = K2, re = K2;
                  do {
                    var R2 = Y2[re];
                    if (!g[re] || R2 < 0 || R2 === re || (R2 = Y2[re = R2], !g[re] || R2 < 0 || R2 === re)) break;
                    re = R2, q = Y2[q];
                  } while (q !== re);
                  for (var z = K2; z !== re; z = Y2[z]) Y2[z] = re;
                  return re;
                }
                var X2 = [];
                return u2.forEach(function(Y2) {
                  var K2 = W2(d, Y2[0]), q = W2(v, Y2[1]);
                  if (K2 >= 0 && q >= 0 && K2 !== q) {
                    var re = I2[K2], R2 = I2[q];
                    re !== R2 && X2.push([re, R2]);
                  }
                }), l.unique(l.normalize(X2)), { positions: V2, edges: X2 };
              };
              var i = a("robust-orientation"), l = a("simplicial-complex");
            }, { "robust-orientation": 284, "simplicial-complex": 295 }], 298: [function(a, o, s) {
              "use strict";
              o.exports = function(u2, c) {
                var f, h, p, d;
                if (c[0][0] < c[1][0]) f = c[0], h = c[1];
                else {
                  if (!(c[0][0] > c[1][0])) return l(c, u2);
                  f = c[1], h = c[0];
                }
                if (u2[0][0] < u2[1][0]) p = u2[0], d = u2[1];
                else {
                  if (!(u2[0][0] > u2[1][0])) return -l(u2, c);
                  p = u2[1], d = u2[0];
                }
                var v = i(f, h, d), m = i(f, h, p);
                if (v < 0) {
                  if (m <= 0) return v;
                } else if (v > 0) {
                  if (m >= 0) return v;
                } else if (m) return m;
                if (v = i(d, p, h), m = i(d, p, f), v < 0) {
                  if (m <= 0) return v;
                } else if (v > 0) {
                  if (m >= 0) return v;
                } else if (m) return m;
                return h[0] - d[0];
              };
              var i = a("robust-orientation");
              function l(u2, c) {
                var f, h, p, d;
                if (c[0][0] < c[1][0]) f = c[0], h = c[1];
                else {
                  if (!(c[0][0] > c[1][0])) {
                    var v = Math.min(u2[0][1], u2[1][1]), m = Math.max(u2[0][1], u2[1][1]), g = Math.min(c[0][1], c[1][1]), x = Math.max(c[0][1], c[1][1]);
                    return m < g ? m - g : v > x ? v - x : m - x;
                  }
                  f = c[1], h = c[0];
                }
                u2[0][1] < u2[1][1] ? (p = u2[0], d = u2[1]) : (p = u2[1], d = u2[0]);
                var b = i(h, f, p);
                return b || (b = i(h, f, d)) || d - h;
              }
            }, { "robust-orientation": 284 }], 299: [function(a, o, s) {
              "use strict";
              o.exports = function(m) {
                for (var g = m.length, x = 2 * g, b = new Array(x), y = 0; y < g; ++y) {
                  var w = m[y], _4 = w[0][0] < w[1][0];
                  b[2 * y] = new v(w[0][0], w, _4, y), b[2 * y + 1] = new v(w[1][0], w, !_4, y);
                }
                b.sort(function(N2, D2) {
                  var I2 = N2.x - D2.x;
                  return I2 || (I2 = N2.create - D2.create) || Math.min(N2.segment[0][1], N2.segment[1][1]) - Math.min(D2.segment[0][1], D2.segment[1][1]);
                });
                var k = l(c), T2 = [], A2 = [], S2 = [];
                for (y = 0; y < x; ) {
                  for (var C2 = b[y].x, E2 = []; y < x; ) {
                    var F13 = b[y];
                    if (F13.x !== C2) break;
                    y += 1, F13.segment[0][0] === F13.x && F13.segment[1][0] === F13.x ? F13.create && (F13.segment[0][1] < F13.segment[1][1] ? (E2.push(new d(F13.segment[0][1], F13.index, true, true)), E2.push(new d(F13.segment[1][1], F13.index, false, false))) : (E2.push(new d(F13.segment[1][1], F13.index, true, false)), E2.push(new d(F13.segment[0][1], F13.index, false, true)))) : k = F13.create ? k.insert(F13.segment, F13.index) : k.remove(F13.segment);
                  }
                  T2.push(k.root), A2.push(C2), S2.push(E2);
                }
                return new f(T2, A2, S2);
              };
              var i = a("binary-search-bounds"), l = a("functional-red-black-tree"), u2 = a("robust-orientation"), c = a("./lib/order-segments");
              function f(m, g, x) {
                this.slabs = m, this.coordinates = g, this.horizontal = x;
              }
              function h(m, g) {
                return m.y - g;
              }
              function p(m, g) {
                for (var x = null; m; ) {
                  var b, y, w = m.key;
                  w[0][0] < w[1][0] ? (b = w[0], y = w[1]) : (b = w[1], y = w[0]);
                  var _4 = u2(b, y, g);
                  if (_4 < 0) m = m.left;
                  else if (_4 > 0) if (g[0] !== w[1][0]) x = m, m = m.right;
                  else {
                    if (k = p(m.right, g)) return k;
                    m = m.left;
                  }
                  else {
                    if (g[0] !== w[1][0]) return m;
                    var k;
                    if (k = p(m.right, g)) return k;
                    m = m.left;
                  }
                }
                return x;
              }
              function d(m, g, x, b) {
                this.y = m, this.index = g, this.start = x, this.closed = b;
              }
              function v(m, g, x, b) {
                this.x = m, this.segment = g, this.create = x, this.index = b;
              }
              f.prototype.castUp = function(m) {
                var g = i.le(this.coordinates, m[0]);
                if (g < 0) return -1;
                this.slabs[g];
                var x = p(this.slabs[g], m), b = -1;
                if (x && (b = x.value), this.coordinates[g] === m[0]) {
                  var y = null;
                  if (x && (y = x.key), g > 0) {
                    var w = p(this.slabs[g - 1], m);
                    w && (y ? c(w.key, y) > 0 && (y = w.key, b = w.value) : (b = w.value, y = w.key));
                  }
                  var _4 = this.horizontal[g];
                  if (_4.length > 0) {
                    var k = i.ge(_4, m[1], h);
                    if (k < _4.length) {
                      var T2 = _4[k];
                      if (m[1] === T2.y) {
                        if (T2.closed) return T2.index;
                        for (; k < _4.length - 1 && _4[k + 1].y === m[1]; ) if ((T2 = _4[k += 1]).closed) return T2.index;
                        if (T2.y === m[1] && !T2.start) {
                          if ((k += 1) >= _4.length) return b;
                          T2 = _4[k];
                        }
                      }
                      if (T2.start) if (y) {
                        var A2 = u2(y[0], y[1], [m[0], T2.y]);
                        y[0][0] > y[1][0] && (A2 = -A2), A2 > 0 && (b = T2.index);
                      } else b = T2.index;
                      else T2.y !== m[1] && (b = T2.index);
                    }
                  }
                }
                return b;
              };
            }, { "./lib/order-segments": 298, "binary-search-bounds": 31, "functional-red-black-tree": 69, "robust-orientation": 284 }], 300: [function(a, o, s) {
              "use strict";
              var i = a("robust-dot-product"), l = a("robust-sum");
              function u2(f, h) {
                var p = l(i(f, h), [h[h.length - 1]]);
                return p[p.length - 1];
              }
              function c(f, h, p, d) {
                var v = -h / (d - h);
                v < 0 ? v = 0 : v > 1 && (v = 1);
                for (var m = 1 - v, g = f.length, x = new Array(g), b = 0; b < g; ++b) x[b] = v * f[b] + m * p[b];
                return x;
              }
              o.exports = function(f, h) {
                for (var p = [], d = [], v = u2(f[f.length - 1], h), m = f[f.length - 1], g = f[0], x = 0; x < f.length; ++x, m = g) {
                  var b = u2(g = f[x], h);
                  if (v < 0 && b > 0 || v > 0 && b < 0) {
                    var y = c(m, b, g, v);
                    p.push(y), d.push(y.slice());
                  }
                  b < 0 ? d.push(g.slice()) : b > 0 ? p.push(g.slice()) : (p.push(g.slice()), d.push(g.slice())), v = b;
                }
                return { positive: p, negative: d };
              }, o.exports.positive = function(f, h) {
                for (var p = [], d = u2(f[f.length - 1], h), v = f[f.length - 1], m = f[0], g = 0; g < f.length; ++g, v = m) {
                  var x = u2(m = f[g], h);
                  (d < 0 && x > 0 || d > 0 && x < 0) && p.push(c(v, x, m, d)), x >= 0 && p.push(m.slice()), d = x;
                }
                return p;
              }, o.exports.negative = function(f, h) {
                for (var p = [], d = u2(f[f.length - 1], h), v = f[f.length - 1], m = f[0], g = 0; g < f.length; ++g, v = m) {
                  var x = u2(m = f[g], h);
                  (d < 0 && x > 0 || d > 0 && x < 0) && p.push(c(v, x, m, d)), x <= 0 && p.push(m.slice()), d = x;
                }
                return p;
              };
            }, { "robust-dot-product": 281, "robust-sum": 289 }], 301: [function(a, o, s) {
              (function() {
                "use strict";
                var i = { not_string: /[^s]/, not_bool: /[^t]/, not_type: /[^T]/, not_primitive: /[^v]/, number: /[diefg]/, numeric_arg: /[bcdiefguxX]/, json: /[j]/, not_json: /[^j]/, text: /^[^\x25]+/, modulo: /^\x25{2}/, placeholder: /^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/, key: /^([a-z_][a-z_\d]*)/i, key_access: /^\.([a-z_][a-z_\d]*)/i, index_access: /^\[(\d+)\]/, sign: /^[+-]/ };
                function l(p) {
                  return c(h(p), arguments);
                }
                function u2(p, d) {
                  return l.apply(null, [p].concat(d || []));
                }
                function c(p, d) {
                  var v, m, g, x, b, y, w, _4, k, T2 = 1, A2 = p.length, S2 = "";
                  for (m = 0; m < A2; m++) if (typeof p[m] == "string") S2 += p[m];
                  else if (typeof p[m] == "object") {
                    if ((x = p[m]).keys) for (v = d[T2], g = 0; g < x.keys.length; g++) {
                      if (v == null) throw new Error(l('[sprintf] Cannot access property "%s" of undefined value "%s"', x.keys[g], x.keys[g - 1]));
                      v = v[x.keys[g]];
                    }
                    else v = x.param_no ? d[x.param_no] : d[T2++];
                    if (i.not_type.test(x.type) && i.not_primitive.test(x.type) && v instanceof Function && (v = v()), i.numeric_arg.test(x.type) && typeof v != "number" && isNaN(v)) throw new TypeError(l("[sprintf] expecting number but found %T", v));
                    switch (i.number.test(x.type) && (_4 = v >= 0), x.type) {
                      case "b":
                        v = parseInt(v, 10).toString(2);
                        break;
                      case "c":
                        v = String.fromCharCode(parseInt(v, 10));
                        break;
                      case "d":
                      case "i":
                        v = parseInt(v, 10);
                        break;
                      case "j":
                        v = JSON.stringify(v, null, x.width ? parseInt(x.width) : 0);
                        break;
                      case "e":
                        v = x.precision ? parseFloat(v).toExponential(x.precision) : parseFloat(v).toExponential();
                        break;
                      case "f":
                        v = x.precision ? parseFloat(v).toFixed(x.precision) : parseFloat(v);
                        break;
                      case "g":
                        v = x.precision ? String(Number(v.toPrecision(x.precision))) : parseFloat(v);
                        break;
                      case "o":
                        v = (parseInt(v, 10) >>> 0).toString(8);
                        break;
                      case "s":
                        v = String(v), v = x.precision ? v.substring(0, x.precision) : v;
                        break;
                      case "t":
                        v = String(!!v), v = x.precision ? v.substring(0, x.precision) : v;
                        break;
                      case "T":
                        v = Object.prototype.toString.call(v).slice(8, -1).toLowerCase(), v = x.precision ? v.substring(0, x.precision) : v;
                        break;
                      case "u":
                        v = parseInt(v, 10) >>> 0;
                        break;
                      case "v":
                        v = v.valueOf(), v = x.precision ? v.substring(0, x.precision) : v;
                        break;
                      case "x":
                        v = (parseInt(v, 10) >>> 0).toString(16);
                        break;
                      case "X":
                        v = (parseInt(v, 10) >>> 0).toString(16).toUpperCase();
                    }
                    i.json.test(x.type) ? S2 += v : (!i.number.test(x.type) || _4 && !x.sign ? k = "" : (k = _4 ? "+" : "-", v = v.toString().replace(i.sign, "")), y = x.pad_char ? x.pad_char === "0" ? "0" : x.pad_char.charAt(1) : " ", w = x.width - (k + v).length, b = x.width && w > 0 ? y.repeat(w) : "", S2 += x.align ? k + v + b : y === "0" ? k + b + v : b + k + v);
                  }
                  return S2;
                }
                var f = /* @__PURE__ */ Object.create(null);
                function h(p) {
                  if (f[p]) return f[p];
                  for (var d, v = p, m = [], g = 0; v; ) {
                    if ((d = i.text.exec(v)) !== null) m.push(d[0]);
                    else if ((d = i.modulo.exec(v)) !== null) m.push("%");
                    else {
                      if ((d = i.placeholder.exec(v)) === null) throw new SyntaxError("[sprintf] unexpected placeholder");
                      if (d[2]) {
                        g |= 1;
                        var x = [], b = d[2], y = [];
                        if ((y = i.key.exec(b)) === null) throw new SyntaxError("[sprintf] failed to parse named argument key");
                        for (x.push(y[1]); (b = b.substring(y[0].length)) !== ""; ) if ((y = i.key_access.exec(b)) !== null) x.push(y[1]);
                        else {
                          if ((y = i.index_access.exec(b)) === null) throw new SyntaxError("[sprintf] failed to parse named argument key");
                          x.push(y[1]);
                        }
                        d[2] = x;
                      } else g |= 2;
                      if (g === 3) throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");
                      m.push({ placeholder: d[0], param_no: d[1], keys: d[2], sign: d[3], pad_char: d[4], align: d[5], width: d[6], precision: d[7], type: d[8] });
                    }
                    v = v.substring(d[0].length);
                  }
                  return f[p] = m;
                }
                s !== void 0 && (s.sprintf = l, s.vsprintf = u2), typeof window < "u" && (window.sprintf = l, window.vsprintf = u2);
              })();
            }, {}], 302: [function(a, o, s) {
              "use strict";
              o.exports = function(f, h) {
                if (f.dimension <= 0) return { positions: [], cells: [] };
                if (f.dimension === 1) return function(v, m) {
                  for (var g = l(v, m), x = g.length, b = new Array(x), y = new Array(x), w = 0; w < x; ++w) b[w] = [g[w]], y[w] = [w];
                  return { positions: b, cells: y };
                }(f, h);
                var p = f.order.join() + "-" + f.dtype, d = c[p];
                return h = +h || 0, d || (d = c[p] = function(v, m) {
                  var g = v.length + "d", x = u2[g];
                  if (x) return x(i, v, m);
                }(f.order, f.dtype)), d(f, h);
              };
              var i = a("ndarray-extract-contour"), l = a("zero-crossings"), u2 = { "2d": function(f, h, p) {
                var d = f({ order: h, scalarArguments: 3, getters: p === "generic" ? [0] : void 0, phase: function(v, m, g, x) {
                  return v > x | 0;
                }, vertex: function(v, m, g, x, b, y, w, _4, k, T2, A2, S2, C2) {
                  var E2 = (w << 0) + (_4 << 1) + (k << 2) + (T2 << 3) | 0;
                  if (E2 !== 0 && E2 !== 15) switch (E2) {
                    case 0:
                      A2.push([v - 0.5, m - 0.5]);
                      break;
                    case 1:
                      A2.push([v - 0.25 - 0.25 * (x + g - 2 * C2) / (g - x), m - 0.25 - 0.25 * (b + g - 2 * C2) / (g - b)]);
                      break;
                    case 2:
                      A2.push([v - 0.75 - 0.25 * (-x - g + 2 * C2) / (x - g), m - 0.25 - 0.25 * (y + x - 2 * C2) / (x - y)]);
                      break;
                    case 3:
                      A2.push([v - 0.5, m - 0.5 - 0.5 * (b + g + y + x - 4 * C2) / (g - b + x - y)]);
                      break;
                    case 4:
                      A2.push([v - 0.25 - 0.25 * (y + b - 2 * C2) / (b - y), m - 0.75 - 0.25 * (-b - g + 2 * C2) / (b - g)]);
                      break;
                    case 5:
                      A2.push([v - 0.5 - 0.5 * (x + g + y + b - 4 * C2) / (g - x + b - y), m - 0.5]);
                      break;
                    case 6:
                      A2.push([v - 0.5 - 0.25 * (-x - g + y + b) / (x - g + b - y), m - 0.5 - 0.25 * (-b - g + y + x) / (b - g + x - y)]);
                      break;
                    case 7:
                      A2.push([v - 0.75 - 0.25 * (y + b - 2 * C2) / (b - y), m - 0.75 - 0.25 * (y + x - 2 * C2) / (x - y)]);
                      break;
                    case 8:
                      A2.push([v - 0.75 - 0.25 * (-y - b + 2 * C2) / (y - b), m - 0.75 - 0.25 * (-y - x + 2 * C2) / (y - x)]);
                      break;
                    case 9:
                      A2.push([v - 0.5 - 0.25 * (x + g + -y - b) / (g - x + y - b), m - 0.5 - 0.25 * (b + g + -y - x) / (g - b + y - x)]);
                      break;
                    case 10:
                      A2.push([v - 0.5 - 0.5 * (-x - g - y - b + 4 * C2) / (x - g + y - b), m - 0.5]);
                      break;
                    case 11:
                      A2.push([v - 0.25 - 0.25 * (-y - b + 2 * C2) / (y - b), m - 0.75 - 0.25 * (b + g - 2 * C2) / (g - b)]);
                      break;
                    case 12:
                      A2.push([v - 0.5, m - 0.5 - 0.5 * (-b - g - y - x + 4 * C2) / (b - g + y - x)]);
                      break;
                    case 13:
                      A2.push([v - 0.75 - 0.25 * (x + g - 2 * C2) / (g - x), m - 0.25 - 0.25 * (-y - x + 2 * C2) / (y - x)]);
                      break;
                    case 14:
                      A2.push([v - 0.25 - 0.25 * (-x - g + 2 * C2) / (x - g), m - 0.25 - 0.25 * (-b - g + 2 * C2) / (b - g)]);
                      break;
                    case 15:
                      A2.push([v - 0.5, m - 0.5]);
                  }
                }, cell: function(v, m, g, x, b, y, w, _4, k) {
                  b ? _4.push([v, m]) : _4.push([m, v]);
                } });
                return function(v, m) {
                  var g = [], x = [];
                  return d(v, g, x, m), { positions: g, cells: x };
                };
              } }, c = {};
            }, { "ndarray-extract-contour": 251, "zero-crossings": 318 }], 303: [function(a, o, s) {
              (function(i) {
                (function() {
                  "use strict";
                  o.exports = function f(h, p, d) {
                    d = d || {};
                    var v = c[h];
                    v || (v = c[h] = { " ": { data: new Float32Array(0), shape: 0.2 } });
                    var m = v[p];
                    if (!m) if (p.length <= 1 || !/\d/.test(p)) m = v[p] = function(C2) {
                      for (var E2 = C2.cells, F13 = C2.positions, N2 = new Float32Array(6 * E2.length), D2 = 0, I2 = 0, O2 = 0; O2 < E2.length; ++O2) for (var L2 = E2[O2], V2 = 0; V2 < 3; ++V2) {
                        var W2 = F13[L2[V2]];
                        N2[D2++] = W2[0], N2[D2++] = W2[1] + 1.4, I2 = Math.max(W2[0], I2);
                      }
                      return { data: N2, shape: I2 };
                    }(l(p, { triangles: true, font: h, textAlign: d.textAlign || "left", textBaseline: "alphabetic", styletags: { breaklines: true, bolds: true, italics: true, subscripts: true, superscripts: true } }));
                    else {
                      for (var g = p.split(/(\d|\s)/), x = new Array(g.length), b = 0, y = 0, w = 0; w < g.length; ++w) x[w] = f(h, g[w]), b += x[w].data.length, y += x[w].shape, w > 0 && (y += 0.02);
                      var _4 = new Float32Array(b), k = 0, T2 = -0.5 * y;
                      for (w = 0; w < x.length; ++w) {
                        for (var A2 = x[w].data, S2 = 0; S2 < A2.length; S2 += 2) _4[k++] = A2[S2] + T2, _4[k++] = A2[S2 + 1];
                        T2 += x[w].shape + 0.02;
                      }
                      m = v[p] = { data: _4, shape: y };
                    }
                    return m;
                  };
                  var l = a("vectorize-text"), u2 = window || i.global || {}, c = u2.__TEXT_CACHE || {};
                  u2.__TEXT_CACHE = {};
                }).call(this);
              }).call(this, a("_process"));
            }, { _process: 5, "vectorize-text": 311 }], 304: [function(a, o, s) {
              "use strict";
              var i = a("parse-unit");
              o.exports = u2;
              function l(c, f) {
                var h = i(getComputedStyle(c).getPropertyValue(f));
                return h[0] * u2(h[1], c);
              }
              function u2(c, f) {
                switch (f = f || document.body, c = (c || "px").trim().toLowerCase(), f !== window && f !== document || (f = document.body), c) {
                  case "%":
                    return f.clientHeight / 100;
                  case "ch":
                  case "ex":
                    return function(h, p) {
                      var d = document.createElement("div");
                      d.style["font-size"] = "128" + h, p.appendChild(d);
                      var v = l(d, "font-size") / 128;
                      return p.removeChild(d), v;
                    }(c, f);
                  case "em":
                    return l(f, "font-size");
                  case "rem":
                    return l(document.body, "font-size");
                  case "vw":
                    return window.innerWidth / 100;
                  case "vh":
                    return window.innerHeight / 100;
                  case "vmin":
                    return Math.min(window.innerWidth, window.innerHeight) / 100;
                  case "vmax":
                    return Math.max(window.innerWidth, window.innerHeight) / 100;
                  case "in":
                    return 96;
                  case "cm":
                    return 96 / 2.54;
                  case "mm":
                    return 96 / 25.4;
                  case "pt":
                    return 96 / 72;
                  case "pc":
                    return 16;
                }
                return 1;
              }
            }, { "parse-unit": 265 }], 305: [function(a, o, s) {
              "use strict";
              o.exports = function(b) {
                var y = (b = b || {}).center || [0, 0, 0], w = b.up || [0, 1, 0], _4 = b.right || v(w), k = b.radius || 1, T2 = b.theta || 0, A2 = b.phi || 0;
                if (y = [].slice.call(y, 0, 3), w = [].slice.call(w, 0, 3), f(w, w), _4 = [].slice.call(_4, 0, 3), f(_4, _4), "eye" in b) {
                  var S2 = b.eye, C2 = [S2[0] - y[0], S2[1] - y[1], S2[2] - y[2]];
                  c(_4, C2, w), p(_4[0], _4[1], _4[2]) < 1e-6 ? _4 = v(w) : f(_4, _4), k = p(C2[0], C2[1], C2[2]);
                  var E2 = h(w, C2) / k, F13 = h(_4, C2) / k;
                  A2 = Math.acos(E2), T2 = Math.acos(F13);
                }
                return k = Math.log(k), new m(b.zoomMin, b.zoomMax, y, w, _4, k, T2, A2);
              };
              var i = a("filtered-vector"), l = a("gl-mat4/invert"), u2 = a("gl-mat4/rotate"), c = a("gl-vec3/cross"), f = a("gl-vec3/normalize"), h = a("gl-vec3/dot");
              function p(b, y, w) {
                return Math.sqrt(Math.pow(b, 2) + Math.pow(y, 2) + Math.pow(w, 2));
              }
              function d(b) {
                return Math.min(1, Math.max(-1, b));
              }
              function v(b) {
                var y = Math.abs(b[0]), w = Math.abs(b[1]), _4 = Math.abs(b[2]), k = [0, 0, 0];
                y > Math.max(w, _4) ? k[2] = 1 : w > Math.max(y, _4) ? k[0] = 1 : k[1] = 1;
                for (var T2 = 0, A2 = 0, S2 = 0; S2 < 3; ++S2) T2 += b[S2] * b[S2], A2 += k[S2] * b[S2];
                for (S2 = 0; S2 < 3; ++S2) k[S2] -= A2 / T2 * b[S2];
                return f(k, k), k;
              }
              function m(b, y, w, _4, k, T2, A2, S2) {
                this.center = i(w), this.up = i(_4), this.right = i(k), this.radius = i([T2]), this.angle = i([A2, S2]), this.angle.bounds = [[-1 / 0, -Math.PI / 2], [1 / 0, Math.PI / 2]], this.setDistanceLimits(b, y), this.computedCenter = this.center.curve(0), this.computedUp = this.up.curve(0), this.computedRight = this.right.curve(0), this.computedRadius = this.radius.curve(0), this.computedAngle = this.angle.curve(0), this.computedToward = [0, 0, 0], this.computedEye = [0, 0, 0], this.computedMatrix = new Array(16);
                for (var C2 = 0; C2 < 16; ++C2) this.computedMatrix[C2] = 0.5;
                this.recalcMatrix(0);
              }
              var g = m.prototype;
              g.setDistanceLimits = function(b, y) {
                b = b > 0 ? Math.log(b) : -1 / 0, y = y > 0 ? Math.log(y) : 1 / 0, y = Math.max(y, b), this.radius.bounds[0][0] = b, this.radius.bounds[1][0] = y;
              }, g.getDistanceLimits = function(b) {
                var y = this.radius.bounds[0];
                return b ? (b[0] = Math.exp(y[0][0]), b[1] = Math.exp(y[1][0]), b) : [Math.exp(y[0][0]), Math.exp(y[1][0])];
              }, g.recalcMatrix = function(b) {
                this.center.curve(b), this.up.curve(b), this.right.curve(b), this.radius.curve(b), this.angle.curve(b);
                for (var y = this.computedUp, w = this.computedRight, _4 = 0, k = 0, T2 = 0; T2 < 3; ++T2) k += y[T2] * w[T2], _4 += y[T2] * y[T2];
                var A2 = Math.sqrt(_4), S2 = 0;
                for (T2 = 0; T2 < 3; ++T2) w[T2] -= y[T2] * k / _4, S2 += w[T2] * w[T2], y[T2] /= A2;
                var C2 = Math.sqrt(S2);
                for (T2 = 0; T2 < 3; ++T2) w[T2] /= C2;
                var E2 = this.computedToward;
                c(E2, y, w), f(E2, E2);
                var F13 = Math.exp(this.computedRadius[0]), N2 = this.computedAngle[0], D2 = this.computedAngle[1], I2 = Math.cos(N2), O2 = Math.sin(N2), L2 = Math.cos(D2), V2 = Math.sin(D2), W2 = this.computedCenter, X2 = I2 * L2, Y2 = O2 * L2, K2 = V2, q = -I2 * V2, re = -O2 * V2, R2 = L2, z = this.computedEye, H2 = this.computedMatrix;
                for (T2 = 0; T2 < 3; ++T2) {
                  var te = X2 * w[T2] + Y2 * E2[T2] + K2 * y[T2];
                  H2[4 * T2 + 1] = q * w[T2] + re * E2[T2] + R2 * y[T2], H2[4 * T2 + 2] = te, H2[4 * T2 + 3] = 0;
                }
                var j = H2[1], Q2 = H2[5], Z2 = H2[9], ne = H2[2], ae = H2[6], ue = H2[10], le = Q2 * ue - Z2 * ae, ce = Z2 * ne - j * ue, se = j * ae - Q2 * ne, he = p(le, ce, se);
                for (le /= he, ce /= he, se /= he, H2[0] = le, H2[4] = ce, H2[8] = se, T2 = 0; T2 < 3; ++T2) z[T2] = W2[T2] + H2[2 + 4 * T2] * F13;
                for (T2 = 0; T2 < 3; ++T2) {
                  S2 = 0;
                  for (var me = 0; me < 3; ++me) S2 += H2[T2 + 4 * me] * z[me];
                  H2[12 + T2] = -S2;
                }
                H2[15] = 1;
              }, g.getMatrix = function(b, y) {
                this.recalcMatrix(b);
                var w = this.computedMatrix;
                if (y) {
                  for (var _4 = 0; _4 < 16; ++_4) y[_4] = w[_4];
                  return y;
                }
                return w;
              };
              var x = [0, 0, 0];
              g.rotate = function(b, y, w, _4) {
                if (this.angle.move(b, y, w), _4) {
                  this.recalcMatrix(b);
                  var k = this.computedMatrix;
                  x[0] = k[2], x[1] = k[6], x[2] = k[10];
                  for (var T2 = this.computedUp, A2 = this.computedRight, S2 = this.computedToward, C2 = 0; C2 < 3; ++C2) k[4 * C2] = T2[C2], k[4 * C2 + 1] = A2[C2], k[4 * C2 + 2] = S2[C2];
                  for (u2(k, k, _4, x), C2 = 0; C2 < 3; ++C2) T2[C2] = k[4 * C2], A2[C2] = k[4 * C2 + 1];
                  this.up.set(b, T2[0], T2[1], T2[2]), this.right.set(b, A2[0], A2[1], A2[2]);
                }
              }, g.pan = function(b, y, w, _4) {
                y = y || 0, w = w || 0, _4 = _4 || 0, this.recalcMatrix(b);
                var k = this.computedMatrix, T2 = (Math.exp(this.computedRadius[0]), k[1]), A2 = k[5], S2 = k[9], C2 = p(T2, A2, S2);
                T2 /= C2, A2 /= C2, S2 /= C2;
                var E2 = k[0], F13 = k[4], N2 = k[8], D2 = E2 * T2 + F13 * A2 + N2 * S2, I2 = p(E2 -= T2 * D2, F13 -= A2 * D2, N2 -= S2 * D2), O2 = (E2 /= I2) * y + T2 * w, L2 = (F13 /= I2) * y + A2 * w, V2 = (N2 /= I2) * y + S2 * w;
                this.center.move(b, O2, L2, V2);
                var W2 = Math.exp(this.computedRadius[0]);
                W2 = Math.max(1e-4, W2 + _4), this.radius.set(b, Math.log(W2));
              }, g.translate = function(b, y, w, _4) {
                this.center.move(b, y || 0, w || 0, _4 || 0);
              }, g.setMatrix = function(b, y, w, _4) {
                var k = 1;
                typeof w == "number" && (k = 0 | w), (k < 0 || k > 3) && (k = 1);
                var T2 = (k + 2) % 3;
                y || (this.recalcMatrix(b), y = this.computedMatrix);
                var A2 = y[k], S2 = y[k + 4], C2 = y[k + 8];
                if (_4) {
                  var E2 = Math.abs(A2), F13 = Math.abs(S2), N2 = Math.abs(C2), D2 = Math.max(E2, F13, N2);
                  E2 === D2 ? (A2 = A2 < 0 ? -1 : 1, S2 = C2 = 0) : N2 === D2 ? (C2 = C2 < 0 ? -1 : 1, A2 = S2 = 0) : (S2 = S2 < 0 ? -1 : 1, A2 = C2 = 0);
                } else {
                  var I2 = p(A2, S2, C2);
                  A2 /= I2, S2 /= I2, C2 /= I2;
                }
                var O2, L2, V2 = y[T2], W2 = y[T2 + 4], X2 = y[T2 + 8], Y2 = V2 * A2 + W2 * S2 + X2 * C2, K2 = p(V2 -= A2 * Y2, W2 -= S2 * Y2, X2 -= C2 * Y2), q = S2 * (X2 /= K2) - C2 * (W2 /= K2), re = C2 * (V2 /= K2) - A2 * X2, R2 = A2 * W2 - S2 * V2, z = p(q, re, R2);
                if (q /= z, re /= z, R2 /= z, this.center.jump(b, pe, ve, Ee), this.radius.idle(b), this.up.jump(b, A2, S2, C2), this.right.jump(b, V2, W2, X2), k === 2) {
                  var H2 = y[1], te = y[5], j = y[9], Q2 = H2 * V2 + te * W2 + j * X2, Z2 = H2 * q + te * re + j * R2;
                  O2 = le < 0 ? -Math.PI / 2 : Math.PI / 2, L2 = Math.atan2(Z2, Q2);
                } else {
                  var ne = y[2], ae = y[6], ue = y[10], le = ne * A2 + ae * S2 + ue * C2, ce = ne * V2 + ae * W2 + ue * X2, se = ne * q + ae * re + ue * R2;
                  O2 = Math.asin(d(le)), L2 = Math.atan2(se, ce);
                }
                this.angle.jump(b, L2, O2), this.recalcMatrix(b);
                var he = y[2], me = y[6], we = y[10], be = this.computedMatrix;
                l(be, y);
                var Ae = be[15], pe = be[12] / Ae, ve = be[13] / Ae, Ee = be[14] / Ae, Se = Math.exp(this.computedRadius[0]);
                this.center.jump(b, pe - he * Se, ve - me * Se, Ee - we * Se);
              }, g.lastT = function() {
                return Math.max(this.center.lastT(), this.up.lastT(), this.right.lastT(), this.radius.lastT(), this.angle.lastT());
              }, g.idle = function(b) {
                this.center.idle(b), this.up.idle(b), this.right.idle(b), this.radius.idle(b), this.angle.idle(b);
              }, g.flush = function(b) {
                this.center.flush(b), this.up.flush(b), this.right.flush(b), this.radius.flush(b), this.angle.flush(b);
              }, g.setDistance = function(b, y) {
                y > 0 && this.radius.set(b, Math.log(y));
              }, g.lookAt = function(b, y, w, _4) {
                this.recalcMatrix(b), y = y || this.computedEye, w = w || this.computedCenter;
                var k = (_4 = _4 || this.computedUp)[0], T2 = _4[1], A2 = _4[2], S2 = p(k, T2, A2);
                if (!(S2 < 1e-6)) {
                  k /= S2, T2 /= S2, A2 /= S2;
                  var C2 = y[0] - w[0], E2 = y[1] - w[1], F13 = y[2] - w[2], N2 = p(C2, E2, F13);
                  if (!(N2 < 1e-6)) {
                    C2 /= N2, E2 /= N2, F13 /= N2;
                    var D2 = this.computedRight, I2 = D2[0], O2 = D2[1], L2 = D2[2], V2 = k * I2 + T2 * O2 + A2 * L2, W2 = p(I2 -= V2 * k, O2 -= V2 * T2, L2 -= V2 * A2);
                    if (!(W2 < 0.01 && (W2 = p(I2 = T2 * F13 - A2 * E2, O2 = A2 * C2 - k * F13, L2 = k * E2 - T2 * C2)) < 1e-6)) {
                      I2 /= W2, O2 /= W2, L2 /= W2, this.up.set(b, k, T2, A2), this.right.set(b, I2, O2, L2), this.center.set(b, w[0], w[1], w[2]), this.radius.set(b, Math.log(N2));
                      var X2 = T2 * L2 - A2 * O2, Y2 = A2 * I2 - k * L2, K2 = k * O2 - T2 * I2, q = p(X2, Y2, K2), re = k * C2 + T2 * E2 + A2 * F13, R2 = I2 * C2 + O2 * E2 + L2 * F13, z = (X2 /= q) * C2 + (Y2 /= q) * E2 + (K2 /= q) * F13, H2 = Math.asin(d(re)), te = Math.atan2(z, R2), j = this.angle._state, Q2 = j[j.length - 1], Z2 = j[j.length - 2];
                      Q2 %= 2 * Math.PI;
                      var ne = Math.abs(Q2 + 2 * Math.PI - te), ae = Math.abs(Q2 - te), ue = Math.abs(Q2 - 2 * Math.PI - te);
                      ne < ae && (Q2 += 2 * Math.PI), ue < ae && (Q2 -= 2 * Math.PI), this.angle.jump(this.angle.lastT(), Q2, Z2), this.angle.set(b, te, H2);
                    }
                  }
                }
              };
            }, { "filtered-vector": 68, "gl-mat4/invert": 98, "gl-mat4/rotate": 103, "gl-vec3/cross": 157, "gl-vec3/dot": 162, "gl-vec3/normalize": 179 }], 306: [function(a, o, s) {
              "use strict";
              o.exports = function(l, u2, c) {
                var f = l * u2, h = i * l, p = h - (h - l), d = l - p, v = i * u2, m = v - (v - u2), g = u2 - m, x = d * g - (f - p * m - d * m - p * g);
                return c ? (c[0] = x, c[1] = f, c) : [x, f];
              };
              var i = +(Math.pow(2, 27) + 1);
            }, {}], 307: [function(a, o, s) {
              "use strict";
              o.exports = function(i, l, u2) {
                var c = i + l, f = c - i, h = l - f, p = i - (c - f);
                return u2 ? (u2[0] = p + h, u2[1] = c, u2) : [p + h, c];
              };
            }, {}], 308: [function(a, o, s) {
              (function(i) {
                (function() {
                  "use strict";
                  var l = a("bit-twiddle"), u2 = a("dup"), c = a("buffer").Buffer;
                  i.__TYPEDARRAY_POOL || (i.__TYPEDARRAY_POOL = { UINT8: u2([32, 0]), UINT16: u2([32, 0]), UINT32: u2([32, 0]), BIGUINT64: u2([32, 0]), INT8: u2([32, 0]), INT16: u2([32, 0]), INT32: u2([32, 0]), BIGINT64: u2([32, 0]), FLOAT: u2([32, 0]), DOUBLE: u2([32, 0]), DATA: u2([32, 0]), UINT8C: u2([32, 0]), BUFFER: u2([32, 0]) });
                  var f = typeof Uint8ClampedArray < "u", h = typeof BigUint64Array < "u", p = typeof BigInt64Array < "u", d = i.__TYPEDARRAY_POOL;
                  d.UINT8C || (d.UINT8C = u2([32, 0])), d.BIGUINT64 || (d.BIGUINT64 = u2([32, 0])), d.BIGINT64 || (d.BIGINT64 = u2([32, 0])), d.BUFFER || (d.BUFFER = u2([32, 0]));
                  var v = d.DATA, m = d.BUFFER;
                  function g(I2) {
                    if (I2) {
                      var O2 = I2.length || I2.byteLength, L2 = l.log2(O2);
                      v[L2].push(I2);
                    }
                  }
                  function x(I2) {
                    I2 = l.nextPow2(I2);
                    var O2 = l.log2(I2), L2 = v[O2];
                    return L2.length > 0 ? L2.pop() : new ArrayBuffer(I2);
                  }
                  function b(I2) {
                    return new Uint8Array(x(I2), 0, I2);
                  }
                  function y(I2) {
                    return new Uint16Array(x(2 * I2), 0, I2);
                  }
                  function w(I2) {
                    return new Uint32Array(x(4 * I2), 0, I2);
                  }
                  function _4(I2) {
                    return new Int8Array(x(I2), 0, I2);
                  }
                  function k(I2) {
                    return new Int16Array(x(2 * I2), 0, I2);
                  }
                  function T2(I2) {
                    return new Int32Array(x(4 * I2), 0, I2);
                  }
                  function A2(I2) {
                    return new Float32Array(x(4 * I2), 0, I2);
                  }
                  function S2(I2) {
                    return new Float64Array(x(8 * I2), 0, I2);
                  }
                  function C2(I2) {
                    return f ? new Uint8ClampedArray(x(I2), 0, I2) : b(I2);
                  }
                  function E2(I2) {
                    return h ? new BigUint64Array(x(8 * I2), 0, I2) : null;
                  }
                  function F13(I2) {
                    return p ? new BigInt64Array(x(8 * I2), 0, I2) : null;
                  }
                  function N2(I2) {
                    return new DataView(x(I2), 0, I2);
                  }
                  function D2(I2) {
                    I2 = l.nextPow2(I2);
                    var O2 = l.log2(I2), L2 = m[O2];
                    return L2.length > 0 ? L2.pop() : new c(I2);
                  }
                  s.free = function(I2) {
                    if (c.isBuffer(I2)) m[l.log2(I2.length)].push(I2);
                    else {
                      if (Object.prototype.toString.call(I2) !== "[object ArrayBuffer]" && (I2 = I2.buffer), !I2) return;
                      var O2 = I2.length || I2.byteLength, L2 = 0 | l.log2(O2);
                      v[L2].push(I2);
                    }
                  }, s.freeUint8 = s.freeUint16 = s.freeUint32 = s.freeBigUint64 = s.freeInt8 = s.freeInt16 = s.freeInt32 = s.freeBigInt64 = s.freeFloat32 = s.freeFloat = s.freeFloat64 = s.freeDouble = s.freeUint8Clamped = s.freeDataView = function(I2) {
                    g(I2.buffer);
                  }, s.freeArrayBuffer = g, s.freeBuffer = function(I2) {
                    m[l.log2(I2.length)].push(I2);
                  }, s.malloc = function(I2, O2) {
                    if (O2 === void 0 || O2 === "arraybuffer") return x(I2);
                    switch (O2) {
                      case "uint8":
                        return b(I2);
                      case "uint16":
                        return y(I2);
                      case "uint32":
                        return w(I2);
                      case "int8":
                        return _4(I2);
                      case "int16":
                        return k(I2);
                      case "int32":
                        return T2(I2);
                      case "float":
                      case "float32":
                        return A2(I2);
                      case "double":
                      case "float64":
                        return S2(I2);
                      case "uint8_clamped":
                        return C2(I2);
                      case "bigint64":
                        return F13(I2);
                      case "biguint64":
                        return E2(I2);
                      case "buffer":
                        return D2(I2);
                      case "data":
                      case "dataview":
                        return N2(I2);
                      default:
                        return null;
                    }
                    return null;
                  }, s.mallocArrayBuffer = x, s.mallocUint8 = b, s.mallocUint16 = y, s.mallocUint32 = w, s.mallocInt8 = _4, s.mallocInt16 = k, s.mallocInt32 = T2, s.mallocFloat32 = s.mallocFloat = A2, s.mallocFloat64 = s.mallocDouble = S2, s.mallocUint8Clamped = C2, s.mallocBigUint64 = E2, s.mallocBigInt64 = F13, s.mallocDataView = N2, s.mallocBuffer = D2, s.clearCache = function() {
                    for (var I2 = 0; I2 < 32; ++I2) d.UINT8[I2].length = 0, d.UINT16[I2].length = 0, d.UINT32[I2].length = 0, d.INT8[I2].length = 0, d.INT16[I2].length = 0, d.INT32[I2].length = 0, d.FLOAT[I2].length = 0, d.DOUBLE[I2].length = 0, d.BIGUINT64[I2].length = 0, d.BIGINT64[I2].length = 0, d.UINT8C[I2].length = 0, v[I2].length = 0, m[I2].length = 0;
                  };
                }).call(this);
              }).call(this, n !== void 0 ? n : typeof self < "u" ? self : typeof window < "u" ? window : {});
            }, { "bit-twiddle": 32, buffer: 3, dup: 65 }], 309: [function(a, o, s) {
              "use strict";
              function i(u2) {
                this.roots = new Array(u2), this.ranks = new Array(u2);
                for (var c = 0; c < u2; ++c) this.roots[c] = c, this.ranks[c] = 0;
              }
              o.exports = i;
              var l = i.prototype;
              Object.defineProperty(l, "length", { get: function() {
                return this.roots.length;
              } }), l.makeSet = function() {
                var u2 = this.roots.length;
                return this.roots.push(u2), this.ranks.push(0), u2;
              }, l.find = function(u2) {
                for (var c = u2, f = this.roots; f[u2] !== u2; ) u2 = f[u2];
                for (; f[c] !== u2; ) {
                  var h = f[c];
                  f[c] = u2, c = h;
                }
                return u2;
              }, l.link = function(u2, c) {
                var f = this.find(u2), h = this.find(c);
                if (f !== h) {
                  var p = this.ranks, d = this.roots, v = p[f], m = p[h];
                  v < m ? d[f] = h : m < v ? d[h] = f : (d[h] = f, ++p[f]);
                }
              };
            }, {}], 310: [function(a, o, s) {
              "use strict";
              o.exports = function(i, l, u2) {
                return i.length === 0 ? i : l ? (u2 || i.sort(l), function(c, f) {
                  for (var h = 1, p = c.length, d = c[0], v = c[0], m = 1; m < p; ++m) if (v = d, f(d = c[m], v)) {
                    if (m === h) {
                      h++;
                      continue;
                    }
                    c[h++] = d;
                  }
                  return c.length = h, c;
                }(i, l)) : (u2 || i.sort(), function(c) {
                  for (var f = 1, h = c.length, p = c[0], d = c[0], v = 1; v < h; ++v, d = p) if (d = p, (p = c[v]) !== d) {
                    if (v === f) {
                      f++;
                      continue;
                    }
                    c[f++] = p;
                  }
                  return c.length = f, c;
                }(i));
              };
            }, {}], 311: [function(a, o, s) {
              "use strict";
              o.exports = function(c, f) {
                return typeof f == "object" && f !== null || (f = {}), i(c, f.canvas || l, f.context || u2, f);
              };
              var i = a("./lib/vtext"), l = null, u2 = null;
              typeof document < "u" && ((l = document.createElement("canvas")).width = 8192, l.height = 1024, u2 = l.getContext("2d"));
            }, { "./lib/vtext": 312 }], 312: [function(a, o, s) {
              o.exports = function(g, x, b, y) {
                var w = 64, _4 = 1.25, k = { breaklines: false, bolds: false, italics: false, subscripts: false, superscripts: false };
                return y && (y.size && y.size > 0 && (w = y.size), y.lineSpacing && y.lineSpacing > 0 && (_4 = y.lineSpacing), y.styletags && y.styletags.breaklines && (k.breaklines = !!y.styletags.breaklines), y.styletags && y.styletags.bolds && (k.bolds = !!y.styletags.bolds), y.styletags && y.styletags.italics && (k.italics = !!y.styletags.italics), y.styletags && y.styletags.subscripts && (k.subscripts = !!y.styletags.subscripts), y.styletags && y.styletags.superscripts && (k.superscripts = !!y.styletags.superscripts)), b.font = [y.fontStyle, y.fontVariant, y.fontWeight, w + "px", y.font].filter(function(T2) {
                  return T2;
                }).join(" "), b.textAlign = "start", b.textBaseline = "alphabetic", b.direction = "ltr", m(function(T2, A2, S2, C2, E2, F13) {
                  S2 = S2.replace(/\n/g, ""), S2 = F13.breaklines === true ? S2.replace(/\<br\>/g, `
`) : S2.replace(/\<br\>/g, " ");
                  var N2 = "", D2 = [];
                  for (V2 = 0; V2 < S2.length; ++V2) D2[V2] = N2;
                  F13.bolds === true && (D2 = p("b", "b|", S2, D2)), F13.italics === true && (D2 = p("i", "i|", S2, D2)), F13.superscripts === true && (D2 = p("sup", "+1", S2, D2)), F13.subscripts === true && (D2 = p("sub", "-1", S2, D2));
                  var I2 = [], O2 = "";
                  for (V2 = 0; V2 < S2.length; ++V2) D2[V2] !== null && (O2 += S2[V2], I2.push(D2[V2]));
                  var L2, V2, W2, X2, Y2, K2 = O2.split(`
`), q = K2.length, re = Math.round(E2 * C2), R2 = C2, z = 2 * C2, H2 = 0, te = q * re + z;
                  T2.height < te && (T2.height = te), A2.fillStyle = "#000", A2.fillRect(0, 0, T2.width, T2.height), A2.fillStyle = "#fff";
                  var j = 0, Q2 = "";
                  function Z2() {
                    if (Q2 !== "") {
                      var me = A2.measureText(Q2).width;
                      A2.fillText(Q2, R2 + W2, z + X2), W2 += me;
                    }
                  }
                  function ne() {
                    return Math.round(Y2) + "px ";
                  }
                  function ae(me, we) {
                    var be = "" + A2.font;
                    if (F13.subscripts === true) {
                      var Ae = me.indexOf("-"), pe = we.indexOf("-"), ve = Ae > -1 ? parseInt(me[1 + Ae]) : 0, Ee = pe > -1 ? parseInt(we[1 + pe]) : 0;
                      ve !== Ee && (be = be.replace(ne(), "?px "), Y2 *= Math.pow(0.75, Ee - ve), be = be.replace("?px ", ne())), X2 += 0.25 * re * (Ee - ve);
                    }
                    if (F13.superscripts === true) {
                      var Se = me.indexOf("+"), Ce = we.indexOf("+"), Be = Se > -1 ? parseInt(me[1 + Se]) : 0, Ue = Ce > -1 ? parseInt(we[1 + Ce]) : 0;
                      Be !== Ue && (be = be.replace(ne(), "?px "), Y2 *= Math.pow(0.75, Ue - Be), be = be.replace("?px ", ne())), X2 -= 0.25 * re * (Ue - Be);
                    }
                    if (F13.bolds === true) {
                      var Ke = me.indexOf("b|") > -1, ct = we.indexOf("b|") > -1;
                      !Ke && ct && (be = We ? be.replace("italic ", "italic bold ") : "bold " + be), Ke && !ct && (be = be.replace("bold ", ""));
                    }
                    if (F13.italics === true) {
                      var We = me.indexOf("i|") > -1, Ze = we.indexOf("i|") > -1;
                      !We && Ze && (be = "italic " + be), We && !Ze && (be = be.replace("italic ", ""));
                    }
                    A2.font = be;
                  }
                  for (L2 = 0; L2 < q; ++L2) {
                    var ue = K2[L2] + `
`;
                    for (W2 = 0, X2 = L2 * re, Y2 = C2, Q2 = "", V2 = 0; V2 < ue.length; ++V2) {
                      var le = V2 + j < I2.length ? I2[V2 + j] : I2[I2.length - 1];
                      N2 === le ? Q2 += ue[V2] : (Z2(), Q2 = ue[V2], le !== void 0 && (ae(N2, le), N2 = le));
                    }
                    Z2(), j += ue.length;
                    var ce = 0 | Math.round(W2 + 2 * R2);
                    H2 < ce && (H2 = ce);
                  }
                  var se = H2, he = z + re * q;
                  return l(A2.getImageData(0, 0, se, he).data, [he, se, 4]).pick(-1, -1, 0).transpose(1, 0);
                }(x, b, g, w, _4, k), y, w);
              }, o.exports.processPixels = m;
              var i = a("surface-nets"), l = a("ndarray"), u2 = a("simplify-planar-graph"), c = a("clean-pslg"), f = a("cdt2d"), h = a("planar-graph-to-polyline");
              function p(g, x, b, y) {
                for (var w = "<" + g + ">", _4 = "</" + g + ">", k = w.length, T2 = _4.length, A2 = x[0] === "+" || x[0] === "-", S2 = 0, C2 = -T2; S2 > -1 && (S2 = b.indexOf(w, S2)) !== -1 && (C2 = b.indexOf(_4, S2 + k)) !== -1 && !(C2 <= S2); ) {
                  for (var E2 = S2; E2 < C2 + T2; ++E2) if (E2 < S2 + k || E2 >= C2) y[E2] = null, b = b.substr(0, E2) + " " + b.substr(E2 + 1);
                  else if (y[E2] !== null) {
                    var F13 = y[E2].indexOf(x[0]);
                    F13 === -1 ? y[E2] += x : A2 && (y[E2] = y[E2].substr(0, F13 + 1) + (1 + parseInt(y[E2][F13 + 1])) + y[E2].substr(F13 + 2));
                  }
                  var N2 = S2 + k, D2 = b.substr(N2, C2 - N2).indexOf(w);
                  S2 = D2 !== -1 ? D2 : C2 + T2;
                }
                return y;
              }
              function d(g, x) {
                var b = i(g, 128);
                return x ? u2(b.cells, b.positions, 0.25) : { edges: b.cells, positions: b.positions };
              }
              function v(g, x, b, y) {
                var w = d(g, y), _4 = function(L2, V2, W2) {
                  for (var X2 = V2.textAlign || "start", Y2 = V2.textBaseline || "alphabetic", K2 = [1 << 30, 1 << 30], q = [0, 0], re = L2.length, R2 = 0; R2 < re; ++R2) for (var z = L2[R2], H2 = 0; H2 < 2; ++H2) K2[H2] = 0 | Math.min(K2[H2], z[H2]), q[H2] = 0 | Math.max(q[H2], z[H2]);
                  var te = 0;
                  switch (X2) {
                    case "center":
                      te = -0.5 * (K2[0] + q[0]);
                      break;
                    case "right":
                    case "end":
                      te = -q[0];
                      break;
                    case "left":
                    case "start":
                      te = -K2[0];
                      break;
                    default:
                      throw new Error("vectorize-text: Unrecognized textAlign: '" + X2 + "'");
                  }
                  var j = 0;
                  switch (Y2) {
                    case "hanging":
                    case "top":
                      j = -K2[1];
                      break;
                    case "middle":
                      j = -0.5 * (K2[1] + q[1]);
                      break;
                    case "alphabetic":
                    case "ideographic":
                      j = -3 * W2;
                      break;
                    case "bottom":
                      j = -q[1];
                      break;
                    default:
                      throw new Error("vectorize-text: Unrecoginized textBaseline: '" + Y2 + "'");
                  }
                  var Q2 = 1 / W2;
                  return "lineHeight" in V2 ? Q2 *= +V2.lineHeight : "width" in V2 ? Q2 = V2.width / (q[0] - K2[0]) : "height" in V2 && (Q2 = V2.height / (q[1] - K2[1])), L2.map(function(Z2) {
                    return [Q2 * (Z2[0] + te), Q2 * (Z2[1] + j)];
                  });
                }(w.positions, x, b), k = w.edges, T2 = x.orientation === "ccw";
                if (c(_4, k), x.polygons || x.polygon || x.polyline) {
                  for (var A2 = h(k, _4), S2 = new Array(A2.length), C2 = 0; C2 < A2.length; ++C2) {
                    for (var E2 = A2[C2], F13 = new Array(E2.length), N2 = 0; N2 < E2.length; ++N2) {
                      for (var D2 = E2[N2], I2 = new Array(D2.length), O2 = 0; O2 < D2.length; ++O2) I2[O2] = _4[D2[O2]].slice();
                      T2 && I2.reverse(), F13[N2] = I2;
                    }
                    S2[C2] = F13;
                  }
                  return S2;
                }
                return x.triangles || x.triangulate || x.triangle ? { cells: f(_4, k, { delaunay: false, exterior: false, interior: true }), positions: _4 } : { edges: k, positions: _4 };
              }
              function m(g, x, b) {
                try {
                  return v(g, x, b, true);
                } catch {
                }
                try {
                  return v(g, x, b, false);
                } catch {
                }
                return x.polygons || x.polyline || x.polygon ? [] : x.triangles || x.triangulate || x.triangle ? { cells: [], positions: [] } : { edges: [], positions: [] };
              }
            }, { cdt2d: 42, "clean-pslg": 50, ndarray: 259, "planar-graph-to-polyline": 268, "simplify-planar-graph": 297, "surface-nets": 302 }], 313: [function(a, o, s) {
              (function() {
                "use strict";
                if (typeof ses > "u" || !ses.ok || ses.ok()) {
                  typeof ses < "u" && (ses.weakMapPermitHostObjects = w);
                  var i = false;
                  if (typeof WeakMap == "function") {
                    var l = WeakMap;
                    if (!(typeof navigator < "u" && /Firefox/.test(navigator.userAgent))) {
                      var u2 = new l(), c = Object.freeze({});
                      if (u2.set(c, 1), u2.get(c) === 1) return void (o.exports = WeakMap);
                      i = true;
                    }
                  }
                  var f = Object.getOwnPropertyNames, h = Object.defineProperty, p = Object.isExtensible, d = "weakmap:ident:" + Math.random() + "___";
                  if (typeof crypto < "u" && typeof crypto.getRandomValues == "function" && typeof ArrayBuffer == "function" && typeof Uint8Array == "function") {
                    var v = new ArrayBuffer(25), m = new Uint8Array(v);
                    crypto.getRandomValues(m), d = "weakmap:rand:" + Array.prototype.map.call(m, function(S2) {
                      return (S2 % 36).toString(36);
                    }).join("") + "___";
                  }
                  if (h(Object, "getOwnPropertyNames", { value: function(S2) {
                    return f(S2).filter(_4);
                  } }), "getPropertyNames" in Object) {
                    var g = Object.getPropertyNames;
                    h(Object, "getPropertyNames", { value: function(S2) {
                      return g(S2).filter(_4);
                    } });
                  }
                  (function() {
                    var S2 = Object.freeze;
                    h(Object, "freeze", { value: function(F13) {
                      return k(F13), S2(F13);
                    } });
                    var C2 = Object.seal;
                    h(Object, "seal", { value: function(F13) {
                      return k(F13), C2(F13);
                    } });
                    var E2 = Object.preventExtensions;
                    h(Object, "preventExtensions", { value: function(F13) {
                      return k(F13), E2(F13);
                    } });
                  })();
                  var x = false, b = 0, y = function() {
                    this instanceof y || A2();
                    var S2 = [], C2 = [], E2 = b++;
                    return Object.create(y.prototype, { get___: { value: T2(function(F13, N2) {
                      var D2, I2 = k(F13);
                      return I2 ? E2 in I2 ? I2[E2] : N2 : (D2 = S2.indexOf(F13)) >= 0 ? C2[D2] : N2;
                    }) }, has___: { value: T2(function(F13) {
                      var N2 = k(F13);
                      return N2 ? E2 in N2 : S2.indexOf(F13) >= 0;
                    }) }, set___: { value: T2(function(F13, N2) {
                      var D2, I2 = k(F13);
                      return I2 ? I2[E2] = N2 : (D2 = S2.indexOf(F13)) >= 0 ? C2[D2] = N2 : (D2 = S2.length, C2[D2] = N2, S2[D2] = F13), this;
                    }) }, delete___: { value: T2(function(F13) {
                      var N2, D2, I2 = k(F13);
                      return I2 ? E2 in I2 && delete I2[E2] : !((N2 = S2.indexOf(F13)) < 0) && (D2 = S2.length - 1, S2[N2] = void 0, C2[N2] = C2[D2], S2[N2] = S2[D2], S2.length = D2, C2.length = D2, true);
                    }) } });
                  };
                  y.prototype = Object.create(Object.prototype, { get: { value: function(S2, C2) {
                    return this.get___(S2, C2);
                  }, writable: true, configurable: true }, has: { value: function(S2) {
                    return this.has___(S2);
                  }, writable: true, configurable: true }, set: { value: function(S2, C2) {
                    return this.set___(S2, C2);
                  }, writable: true, configurable: true }, delete: { value: function(S2) {
                    return this.delete___(S2);
                  }, writable: true, configurable: true } }), typeof l == "function" ? function() {
                    function S2() {
                      this instanceof y || A2();
                      var C2, E2 = new l(), F13 = void 0, N2 = false;
                      return C2 = i ? function(D2, I2) {
                        return E2.set(D2, I2), E2.has(D2) || (F13 || (F13 = new y()), F13.set(D2, I2)), this;
                      } : function(D2, I2) {
                        if (N2) try {
                          E2.set(D2, I2);
                        } catch {
                          F13 || (F13 = new y()), F13.set___(D2, I2);
                        }
                        else E2.set(D2, I2);
                        return this;
                      }, Object.create(y.prototype, { get___: { value: T2(function(D2, I2) {
                        return F13 ? E2.has(D2) ? E2.get(D2) : F13.get___(D2, I2) : E2.get(D2, I2);
                      }) }, has___: { value: T2(function(D2) {
                        return E2.has(D2) || !!F13 && F13.has___(D2);
                      }) }, set___: { value: T2(C2) }, delete___: { value: T2(function(D2) {
                        var I2 = !!E2.delete(D2);
                        return F13 && F13.delete___(D2) || I2;
                      }) }, permitHostObjects___: { value: T2(function(D2) {
                        if (D2 !== w) throw new Error("bogus call to permitHostObjects___");
                        N2 = true;
                      }) } });
                    }
                    i && typeof Proxy < "u" && (Proxy = void 0), S2.prototype = y.prototype, o.exports = S2, Object.defineProperty(WeakMap.prototype, "constructor", { value: WeakMap, enumerable: false, configurable: true, writable: true });
                  }() : (typeof Proxy < "u" && (Proxy = void 0), o.exports = y);
                }
                function w(S2) {
                  S2.permitHostObjects___ && S2.permitHostObjects___(w);
                }
                function _4(S2) {
                  return !(S2.substr(0, 8) == "weakmap:" && S2.substr(S2.length - 3) === "___");
                }
                function k(S2) {
                  if (S2 !== Object(S2)) throw new TypeError("Not an object: " + S2);
                  var C2 = S2[d];
                  if (C2 && C2.key === S2) return C2;
                  if (p(S2)) {
                    C2 = { key: S2 };
                    try {
                      return h(S2, d, { value: C2, writable: false, enumerable: false, configurable: false }), C2;
                    } catch {
                      return;
                    }
                  }
                }
                function T2(S2) {
                  return S2.prototype = null, Object.freeze(S2);
                }
                function A2() {
                  x || typeof console > "u" || (x = true, console.warn("WeakMap should be invoked as new WeakMap(), not WeakMap(). This will be an error in the future."));
                }
              })();
            }, {}], 314: [function(a, o, s) {
              var i = a("./hidden-store.js");
              o.exports = function() {
                var l = {};
                return function(u2) {
                  if ((typeof u2 != "object" || u2 === null) && typeof u2 != "function") throw new Error("Weakmap-shim: Key must be object");
                  var c = u2.valueOf(l);
                  return c && c.identity === l ? c : i(u2, l);
                };
              };
            }, { "./hidden-store.js": 315 }], 315: [function(a, o, s) {
              o.exports = function(i, l) {
                var u2 = { identity: l }, c = i.valueOf;
                return Object.defineProperty(i, "valueOf", { value: function(f) {
                  return f !== l ? c.apply(this, arguments) : u2;
                }, writable: true }), u2;
              };
            }, {}], 316: [function(a, o, s) {
              var i = a("./create-store.js");
              o.exports = function() {
                var l = i();
                return { get: function(u2, c) {
                  var f = l(u2);
                  return f.hasOwnProperty("value") ? f.value : c;
                }, set: function(u2, c) {
                  return l(u2).value = c, this;
                }, has: function(u2) {
                  return "value" in l(u2);
                }, delete: function(u2) {
                  return delete l(u2).value;
                } };
              };
            }, { "./create-store.js": 314 }], 317: [function(a, o, s) {
              "use strict";
              var i, l = function() {
                return function(u2, c, f, h, p, d) {
                  var v = u2[0], m = f[0], g = [0], x = m;
                  h |= 0;
                  var b = 0, y = m;
                  for (b = 0; b < v; ++b) {
                    var w = c[h] - d, _4 = c[h + x] - d;
                    w >= 0 != _4 >= 0 && p.push(g[0] + 0.5 + 0.5 * (w + _4) / (w - _4)), h += y, ++g[0];
                  }
                };
              };
              o.exports = (i = { funcName: "zeroCrossings" }, /* @__PURE__ */ function(u2) {
                var c = {};
                return function(f, h, p) {
                  var d = f.dtype, v = f.order, m = [d, v.join()].join(), g = c[m];
                  return g || (c[m] = g = u2([d, v])), g(f.shape.slice(0), f.data, f.stride, 0 | f.offset, h, p);
                };
              }(l.bind(void 0, i)));
            }, {}], 318: [function(a, o, s) {
              "use strict";
              o.exports = function(l, u2) {
                var c = [];
                return u2 = +u2 || 0, i(l.hi(l.shape[0] - 1), c, u2), c;
              };
              var i = a("./lib/zc-core");
            }, { "./lib/zc-core": 317 }] }, {}, [6])(6);
          });
        }).call(this);
      }).call(this, typeof global < "u" ? global : typeof self < "u" ? self : typeof window < "u" ? window : {});
    }, {}] }, {}, [27])(27);
  });
});
var Jte = ri((d8, v8) => {
  (function(e, t) {
    typeof define == "function" && define.amd ? define([], t) : typeof v8 == "object" && typeof d8 < "u" ? v8.exports = t() : e.Papa = t();
  })(d8, function e() {
    "use strict";
    var t = typeof self < "u" ? self : typeof window < "u" ? window : t !== void 0 ? t : {}, r = !t.document && !!t.postMessage, n = r && /blob:/i.test((t.location || {}).protocol), a = {}, o = 0, s = { parse: function(_4, k) {
      var T2 = (k = k || {}).dynamicTyping || false;
      if (w(T2) && (k.dynamicTypingFunction = T2, T2 = {}), k.dynamicTyping = T2, k.transform = !!w(k.transform) && k.transform, k.worker && s.WORKERS_SUPPORTED) {
        var A2 = function() {
          if (!s.WORKERS_SUPPORTED) return false;
          var C2 = (F13 = t.URL || t.webkitURL || null, N2 = e.toString(), s.BLOB_URL || (s.BLOB_URL = F13.createObjectURL(new Blob(["(", N2, ")();"], { type: "text/javascript" })))), E2 = new t.Worker(C2), F13, N2;
          return E2.onmessage = m, E2.id = o++, a[E2.id] = E2;
        }();
        return A2.userStep = k.step, A2.userChunk = k.chunk, A2.userComplete = k.complete, A2.userError = k.error, k.step = w(k.step), k.chunk = w(k.chunk), k.complete = w(k.complete), k.error = w(k.error), delete k.worker, void A2.postMessage({ input: _4, config: k, workerId: A2.id });
      }
      var S2 = null;
      return s.NODE_STREAM_INPUT, typeof _4 == "string" ? S2 = k.download ? new u2(k) : new f(k) : _4.readable === true && w(_4.read) && w(_4.on) ? S2 = new h(k) : (t.File && _4 instanceof File || _4 instanceof Object) && (S2 = new c(k)), S2.stream(_4);
    }, unparse: function(_4, k) {
      var T2 = false, A2 = true, S2 = ",", C2 = `\r
`, E2 = '"', F13 = E2 + E2, N2 = false, D2 = null, I2 = false;
      (function() {
        if (typeof k == "object") {
          if (typeof k.delimiter != "string" || s.BAD_DELIMITERS.filter(function(W2) {
            return k.delimiter.indexOf(W2) !== -1;
          }).length || (S2 = k.delimiter), (typeof k.quotes == "boolean" || typeof k.quotes == "function" || Array.isArray(k.quotes)) && (T2 = k.quotes), typeof k.skipEmptyLines != "boolean" && typeof k.skipEmptyLines != "string" || (N2 = k.skipEmptyLines), typeof k.newline == "string" && (C2 = k.newline), typeof k.quoteChar == "string" && (E2 = k.quoteChar), typeof k.header == "boolean" && (A2 = k.header), Array.isArray(k.columns)) {
            if (k.columns.length === 0) throw new Error("Option columns is empty");
            D2 = k.columns;
          }
          k.escapeChar !== void 0 && (F13 = k.escapeChar + E2), typeof k.escapeFormulae == "boolean" && (I2 = k.escapeFormulae);
        }
      })();
      var O2 = new RegExp(d(E2), "g");
      if (typeof _4 == "string" && (_4 = JSON.parse(_4)), Array.isArray(_4)) {
        if (!_4.length || Array.isArray(_4[0])) return L2(null, _4, N2);
        if (typeof _4[0] == "object") return L2(D2 || Object.keys(_4[0]), _4, N2);
      } else if (typeof _4 == "object") return typeof _4.data == "string" && (_4.data = JSON.parse(_4.data)), Array.isArray(_4.data) && (_4.fields || (_4.fields = _4.meta && _4.meta.fields), _4.fields || (_4.fields = Array.isArray(_4.data[0]) ? _4.fields : typeof _4.data[0] == "object" ? Object.keys(_4.data[0]) : []), Array.isArray(_4.data[0]) || typeof _4.data[0] == "object" || (_4.data = [_4.data])), L2(_4.fields || [], _4.data || [], N2);
      throw new Error("Unable to serialize unrecognized input");
      function L2(W2, X2, Y2) {
        var K2 = "";
        typeof W2 == "string" && (W2 = JSON.parse(W2)), typeof X2 == "string" && (X2 = JSON.parse(X2));
        var q = Array.isArray(W2) && 0 < W2.length, re = !Array.isArray(X2[0]);
        if (q && A2) {
          for (var R2 = 0; R2 < W2.length; R2++) 0 < R2 && (K2 += S2), K2 += V2(W2[R2], R2);
          0 < X2.length && (K2 += C2);
        }
        for (var z = 0; z < X2.length; z++) {
          var H2 = q ? W2.length : X2[z].length, te = false, j = q ? Object.keys(X2[z]).length === 0 : X2[z].length === 0;
          if (Y2 && !q && (te = Y2 === "greedy" ? X2[z].join("").trim() === "" : X2[z].length === 1 && X2[z][0].length === 0), Y2 === "greedy" && q) {
            for (var Q2 = [], Z2 = 0; Z2 < H2; Z2++) {
              var ne = re ? W2[Z2] : Z2;
              Q2.push(X2[z][ne]);
            }
            te = Q2.join("").trim() === "";
          }
          if (!te) {
            for (var ae = 0; ae < H2; ae++) {
              0 < ae && !j && (K2 += S2);
              var ue = q && re ? W2[ae] : ae;
              K2 += V2(X2[z][ue], ae);
            }
            z < X2.length - 1 && (!Y2 || 0 < H2 && !j) && (K2 += C2);
          }
        }
        return K2;
      }
      function V2(W2, X2) {
        if (W2 == null) return "";
        if (W2.constructor === Date) return JSON.stringify(W2).slice(1, 25);
        I2 === true && typeof W2 == "string" && W2.match(/^[=+\-@].*$/) !== null && (W2 = "'" + W2);
        var Y2 = W2.toString().replace(O2, F13), K2 = typeof T2 == "boolean" && T2 || typeof T2 == "function" && T2(W2, X2) || Array.isArray(T2) && T2[X2] || function(q, re) {
          for (var R2 = 0; R2 < re.length; R2++) if (-1 < q.indexOf(re[R2])) return true;
          return false;
        }(Y2, s.BAD_DELIMITERS) || -1 < Y2.indexOf(S2) || Y2.charAt(0) === " " || Y2.charAt(Y2.length - 1) === " ";
        return K2 ? E2 + Y2 + E2 : Y2;
      }
    } };
    if (s.RECORD_SEP = String.fromCharCode(30), s.UNIT_SEP = String.fromCharCode(31), s.BYTE_ORDER_MARK = "\uFEFF", s.BAD_DELIMITERS = ["\r", `
`, '"', s.BYTE_ORDER_MARK], s.WORKERS_SUPPORTED = !r && !!t.Worker, s.NODE_STREAM_INPUT = 1, s.LocalChunkSize = 10485760, s.RemoteChunkSize = 5242880, s.DefaultDelimiter = ",", s.Parser = v, s.ParserHandle = p, s.NetworkStreamer = u2, s.FileStreamer = c, s.StringStreamer = f, s.ReadableStreamStreamer = h, t.jQuery) {
      var i = t.jQuery;
      i.fn.parse = function(_4) {
        var k = _4.config || {}, T2 = [];
        return this.each(function(C2) {
          if (!(i(this).prop("tagName").toUpperCase() === "INPUT" && i(this).attr("type").toLowerCase() === "file" && t.FileReader) || !this.files || this.files.length === 0) return true;
          for (var E2 = 0; E2 < this.files.length; E2++) T2.push({ file: this.files[E2], inputElem: this, instanceConfig: i.extend({}, k) });
        }), A2(), this;
        function A2() {
          if (T2.length !== 0) {
            var C2, E2, F13, N2, D2 = T2[0];
            if (w(_4.before)) {
              var I2 = _4.before(D2.file, D2.inputElem);
              if (typeof I2 == "object") {
                if (I2.action === "abort") return C2 = "AbortError", E2 = D2.file, F13 = D2.inputElem, N2 = I2.reason, void (w(_4.error) && _4.error({ name: C2 }, E2, F13, N2));
                if (I2.action === "skip") return void S2();
                typeof I2.config == "object" && (D2.instanceConfig = i.extend(D2.instanceConfig, I2.config));
              } else if (I2 === "skip") return void S2();
            }
            var O2 = D2.instanceConfig.complete;
            D2.instanceConfig.complete = function(L2) {
              w(O2) && O2(L2, D2.file, D2.inputElem), S2();
            }, s.parse(D2.file, D2.instanceConfig);
          } else w(_4.complete) && _4.complete();
        }
        function S2() {
          T2.splice(0, 1), A2();
        }
      };
    }
    function l(_4) {
      this._handle = null, this._finished = false, this._completed = false, this._halted = false, this._input = null, this._baseIndex = 0, this._partialLine = "", this._rowCount = 0, this._start = 0, this._nextChunk = null, this.isFirstChunk = true, this._completeResults = { data: [], errors: [], meta: {} }, (function(k) {
        var T2 = b(k);
        T2.chunkSize = parseInt(T2.chunkSize), k.step || k.chunk || (T2.chunkSize = null), this._handle = new p(T2), (this._handle.streamer = this)._config = T2;
      }).call(this, _4), this.parseChunk = function(k, T2) {
        if (this.isFirstChunk && w(this._config.beforeFirstChunk)) {
          var A2 = this._config.beforeFirstChunk(k);
          A2 !== void 0 && (k = A2);
        }
        this.isFirstChunk = false, this._halted = false;
        var S2 = this._partialLine + k;
        this._partialLine = "";
        var C2 = this._handle.parse(S2, this._baseIndex, !this._finished);
        if (!this._handle.paused() && !this._handle.aborted()) {
          var E2 = C2.meta.cursor;
          this._finished || (this._partialLine = S2.substring(E2 - this._baseIndex), this._baseIndex = E2), C2 && C2.data && (this._rowCount += C2.data.length);
          var F13 = this._finished || this._config.preview && this._rowCount >= this._config.preview;
          if (n) t.postMessage({ results: C2, workerId: s.WORKER_ID, finished: F13 });
          else if (w(this._config.chunk) && !T2) {
            if (this._config.chunk(C2, this._handle), this._handle.paused() || this._handle.aborted()) return void (this._halted = true);
            C2 = void 0, this._completeResults = void 0;
          }
          return this._config.step || this._config.chunk || (this._completeResults.data = this._completeResults.data.concat(C2.data), this._completeResults.errors = this._completeResults.errors.concat(C2.errors), this._completeResults.meta = C2.meta), this._completed || !F13 || !w(this._config.complete) || C2 && C2.meta.aborted || (this._config.complete(this._completeResults, this._input), this._completed = true), F13 || C2 && C2.meta.paused || this._nextChunk(), C2;
        }
        this._halted = true;
      }, this._sendError = function(k) {
        w(this._config.error) ? this._config.error(k) : n && this._config.error && t.postMessage({ workerId: s.WORKER_ID, error: k, finished: false });
      };
    }
    function u2(_4) {
      var k;
      (_4 = _4 || {}).chunkSize || (_4.chunkSize = s.RemoteChunkSize), l.call(this, _4), this._nextChunk = r ? function() {
        this._readChunk(), this._chunkLoaded();
      } : function() {
        this._readChunk();
      }, this.stream = function(T2) {
        this._input = T2, this._nextChunk();
      }, this._readChunk = function() {
        if (this._finished) this._chunkLoaded();
        else {
          if (k = new XMLHttpRequest(), this._config.withCredentials && (k.withCredentials = this._config.withCredentials), r || (k.onload = y(this._chunkLoaded, this), k.onerror = y(this._chunkError, this)), k.open(this._config.downloadRequestBody ? "POST" : "GET", this._input, !r), this._config.downloadRequestHeaders) {
            var T2 = this._config.downloadRequestHeaders;
            for (var A2 in T2) k.setRequestHeader(A2, T2[A2]);
          }
          if (this._config.chunkSize) {
            var S2 = this._start + this._config.chunkSize - 1;
            k.setRequestHeader("Range", "bytes=" + this._start + "-" + S2);
          }
          try {
            k.send(this._config.downloadRequestBody);
          } catch (C2) {
            this._chunkError(C2.message);
          }
          r && k.status === 0 && this._chunkError();
        }
      }, this._chunkLoaded = function() {
        k.readyState === 4 && (k.status < 200 || 400 <= k.status ? this._chunkError() : (this._start += this._config.chunkSize ? this._config.chunkSize : k.responseText.length, this._finished = !this._config.chunkSize || this._start >= function(T2) {
          var A2 = T2.getResponseHeader("Content-Range");
          return A2 === null ? -1 : parseInt(A2.substring(A2.lastIndexOf("/") + 1));
        }(k), this.parseChunk(k.responseText)));
      }, this._chunkError = function(T2) {
        var A2 = k.statusText || T2;
        this._sendError(new Error(A2));
      };
    }
    function c(_4) {
      var k, T2;
      (_4 = _4 || {}).chunkSize || (_4.chunkSize = s.LocalChunkSize), l.call(this, _4);
      var A2 = typeof FileReader < "u";
      this.stream = function(S2) {
        this._input = S2, T2 = S2.slice || S2.webkitSlice || S2.mozSlice, A2 ? ((k = new FileReader()).onload = y(this._chunkLoaded, this), k.onerror = y(this._chunkError, this)) : k = new FileReaderSync(), this._nextChunk();
      }, this._nextChunk = function() {
        this._finished || this._config.preview && !(this._rowCount < this._config.preview) || this._readChunk();
      }, this._readChunk = function() {
        var S2 = this._input;
        if (this._config.chunkSize) {
          var C2 = Math.min(this._start + this._config.chunkSize, this._input.size);
          S2 = T2.call(S2, this._start, C2);
        }
        var E2 = k.readAsText(S2, this._config.encoding);
        A2 || this._chunkLoaded({ target: { result: E2 } });
      }, this._chunkLoaded = function(S2) {
        this._start += this._config.chunkSize, this._finished = !this._config.chunkSize || this._start >= this._input.size, this.parseChunk(S2.target.result);
      }, this._chunkError = function() {
        this._sendError(k.error);
      };
    }
    function f(_4) {
      var k;
      l.call(this, _4 = _4 || {}), this.stream = function(T2) {
        return k = T2, this._nextChunk();
      }, this._nextChunk = function() {
        if (!this._finished) {
          var T2, A2 = this._config.chunkSize;
          return A2 ? (T2 = k.substring(0, A2), k = k.substring(A2)) : (T2 = k, k = ""), this._finished = !k, this.parseChunk(T2);
        }
      };
    }
    function h(_4) {
      l.call(this, _4 = _4 || {});
      var k = [], T2 = true, A2 = false;
      this.pause = function() {
        l.prototype.pause.apply(this, arguments), this._input.pause();
      }, this.resume = function() {
        l.prototype.resume.apply(this, arguments), this._input.resume();
      }, this.stream = function(S2) {
        this._input = S2, this._input.on("data", this._streamData), this._input.on("end", this._streamEnd), this._input.on("error", this._streamError);
      }, this._checkIsFinished = function() {
        A2 && k.length === 1 && (this._finished = true);
      }, this._nextChunk = function() {
        this._checkIsFinished(), k.length ? this.parseChunk(k.shift()) : T2 = true;
      }, this._streamData = y(function(S2) {
        try {
          k.push(typeof S2 == "string" ? S2 : S2.toString(this._config.encoding)), T2 && (T2 = false, this._checkIsFinished(), this.parseChunk(k.shift()));
        } catch (C2) {
          this._streamError(C2);
        }
      }, this), this._streamError = y(function(S2) {
        this._streamCleanUp(), this._sendError(S2);
      }, this), this._streamEnd = y(function() {
        this._streamCleanUp(), A2 = true, this._streamData("");
      }, this), this._streamCleanUp = y(function() {
        this._input.removeListener("data", this._streamData), this._input.removeListener("end", this._streamEnd), this._input.removeListener("error", this._streamError);
      }, this);
    }
    function p(_4) {
      var k, T2, A2, S2 = Math.pow(2, 53), C2 = -S2, E2 = /^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/, F13 = /^(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))$/, N2 = this, D2 = 0, I2 = 0, O2 = false, L2 = false, V2 = [], W2 = { data: [], errors: [], meta: {} };
      if (w(_4.step)) {
        var X2 = _4.step;
        _4.step = function(z) {
          if (W2 = z, q()) K2();
          else {
            if (K2(), W2.data.length === 0) return;
            D2 += z.data.length, _4.preview && D2 > _4.preview ? T2.abort() : (W2.data = W2.data[0], X2(W2, N2));
          }
        };
      }
      function Y2(z) {
        return _4.skipEmptyLines === "greedy" ? z.join("").trim() === "" : z.length === 1 && z[0].length === 0;
      }
      function K2() {
        if (W2 && A2 && (R2("Delimiter", "UndetectableDelimiter", "Unable to auto-detect delimiting character; defaulted to '" + s.DefaultDelimiter + "'"), A2 = false), _4.skipEmptyLines) for (var z = 0; z < W2.data.length; z++) Y2(W2.data[z]) && W2.data.splice(z--, 1);
        return q() && function() {
          if (!W2) return;
          function H2(j, Q2) {
            w(_4.transformHeader) && (j = _4.transformHeader(j, Q2)), V2.push(j);
          }
          if (Array.isArray(W2.data[0])) {
            for (var te = 0; q() && te < W2.data.length; te++) W2.data[te].forEach(H2);
            W2.data.splice(0, 1);
          } else W2.data.forEach(H2);
        }(), function() {
          if (!W2 || !_4.header && !_4.dynamicTyping && !_4.transform) return W2;
          function H2(j, Q2) {
            var Z2, ne = _4.header ? {} : [];
            for (Z2 = 0; Z2 < j.length; Z2++) {
              var ae = Z2, ue = j[Z2];
              _4.header && (ae = Z2 >= V2.length ? "__parsed_extra" : V2[Z2]), _4.transform && (ue = _4.transform(ue, ae)), ue = re(ae, ue), ae === "__parsed_extra" ? (ne[ae] = ne[ae] || [], ne[ae].push(ue)) : ne[ae] = ue;
            }
            return _4.header && (Z2 > V2.length ? R2("FieldMismatch", "TooManyFields", "Too many fields: expected " + V2.length + " fields but parsed " + Z2, I2 + Q2) : Z2 < V2.length && R2("FieldMismatch", "TooFewFields", "Too few fields: expected " + V2.length + " fields but parsed " + Z2, I2 + Q2)), ne;
          }
          var te = 1;
          return !W2.data.length || Array.isArray(W2.data[0]) ? (W2.data = W2.data.map(H2), te = W2.data.length) : W2.data = H2(W2.data, 0), _4.header && W2.meta && (W2.meta.fields = V2), I2 += te, W2;
        }();
      }
      function q() {
        return _4.header && V2.length === 0;
      }
      function re(z, H2) {
        return te = z, _4.dynamicTypingFunction && _4.dynamicTyping[te] === void 0 && (_4.dynamicTyping[te] = _4.dynamicTypingFunction(te)), (_4.dynamicTyping[te] || _4.dynamicTyping) === true ? H2 === "true" || H2 === "TRUE" || H2 !== "false" && H2 !== "FALSE" && (function(j) {
          if (E2.test(j)) {
            var Q2 = parseFloat(j);
            if (C2 < Q2 && Q2 < S2) return true;
          }
          return false;
        }(H2) ? parseFloat(H2) : F13.test(H2) ? new Date(H2) : H2 === "" ? null : H2) : H2;
        var te;
      }
      function R2(z, H2, te, j) {
        var Q2 = { type: z, code: H2, message: te };
        j !== void 0 && (Q2.row = j), W2.errors.push(Q2);
      }
      this.parse = function(z, H2, te) {
        var j = _4.quoteChar || '"';
        if (_4.newline || (_4.newline = function(ne, ae) {
          ne = ne.substring(0, 1048576);
          var ue = new RegExp(d(ae) + "([^]*?)" + d(ae), "gm"), le = (ne = ne.replace(ue, "")).split("\r"), ce = ne.split(`
`), se = 1 < ce.length && ce[0].length < le[0].length;
          if (le.length === 1 || se) return `
`;
          for (var he = 0, me = 0; me < le.length; me++) le[me][0] === `
` && he++;
          return he >= le.length / 2 ? `\r
` : "\r";
        }(z, j)), A2 = false, _4.delimiter) w(_4.delimiter) && (_4.delimiter = _4.delimiter(z), W2.meta.delimiter = _4.delimiter);
        else {
          var Q2 = function(ne, ae, ue, le, ce) {
            var se, he, me, we;
            ce = ce || [",", "	", "|", ";", s.RECORD_SEP, s.UNIT_SEP];
            for (var be = 0; be < ce.length; be++) {
              var Ae = ce[be], pe = 0, ve = 0, Ee = 0;
              me = void 0;
              for (var Se = new v({ comments: le, delimiter: Ae, newline: ae, preview: 10 }).parse(ne), Ce = 0; Ce < Se.data.length; Ce++) if (ue && Y2(Se.data[Ce])) Ee++;
              else {
                var Be = Se.data[Ce].length;
                ve += Be, me !== void 0 ? 0 < Be && (pe += Math.abs(Be - me), me = Be) : me = Be;
              }
              0 < Se.data.length && (ve /= Se.data.length - Ee), (he === void 0 || pe <= he) && (we === void 0 || we < ve) && 1.99 < ve && (he = pe, se = Ae, we = ve);
            }
            return { successful: !!(_4.delimiter = se), bestDelimiter: se };
          }(z, _4.newline, _4.skipEmptyLines, _4.comments, _4.delimitersToGuess);
          Q2.successful ? _4.delimiter = Q2.bestDelimiter : (A2 = true, _4.delimiter = s.DefaultDelimiter), W2.meta.delimiter = _4.delimiter;
        }
        var Z2 = b(_4);
        return _4.preview && _4.header && Z2.preview++, k = z, T2 = new v(Z2), W2 = T2.parse(k, H2, te), K2(), O2 ? { meta: { paused: true } } : W2 || { meta: { paused: false } };
      }, this.paused = function() {
        return O2;
      }, this.pause = function() {
        O2 = true, T2.abort(), k = w(_4.chunk) ? "" : k.substring(T2.getCharIndex());
      }, this.resume = function() {
        N2.streamer._halted ? (O2 = false, N2.streamer.parseChunk(k, true)) : setTimeout(N2.resume, 3);
      }, this.aborted = function() {
        return L2;
      }, this.abort = function() {
        L2 = true, T2.abort(), W2.meta.aborted = true, w(_4.complete) && _4.complete(W2), k = "";
      };
    }
    function d(_4) {
      return _4.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
    }
    function v(_4) {
      var k, T2 = (_4 = _4 || {}).delimiter, A2 = _4.newline, S2 = _4.comments, C2 = _4.step, E2 = _4.preview, F13 = _4.fastMode, N2 = k = _4.quoteChar === void 0 ? '"' : _4.quoteChar;
      if (_4.escapeChar !== void 0 && (N2 = _4.escapeChar), (typeof T2 != "string" || -1 < s.BAD_DELIMITERS.indexOf(T2)) && (T2 = ","), S2 === T2) throw new Error("Comment character same as delimiter");
      S2 === true ? S2 = "#" : (typeof S2 != "string" || -1 < s.BAD_DELIMITERS.indexOf(S2)) && (S2 = false), A2 !== `
` && A2 !== "\r" && A2 !== `\r
` && (A2 = `
`);
      var D2 = 0, I2 = false;
      this.parse = function(O2, L2, V2) {
        if (typeof O2 != "string") throw new Error("Input must be a string");
        var W2 = O2.length, X2 = T2.length, Y2 = A2.length, K2 = S2.length, q = w(C2), re = [], R2 = [], z = [], H2 = D2 = 0;
        if (!O2) return we();
        if (F13 || F13 !== false && O2.indexOf(k) === -1) {
          for (var te = O2.split(A2), j = 0; j < te.length; j++) {
            if (z = te[j], D2 += z.length, j !== te.length - 1) D2 += A2.length;
            else if (V2) return we();
            if (!S2 || z.substring(0, K2) !== S2) {
              if (q) {
                if (re = [], ce(z.split(T2)), be(), I2) return we();
              } else ce(z.split(T2));
              if (E2 && E2 <= j) return re = re.slice(0, E2), we(true);
            }
          }
          return we();
        }
        for (var Q2 = O2.indexOf(T2, D2), Z2 = O2.indexOf(A2, D2), ne = new RegExp(d(N2) + d(k), "g"), ae = O2.indexOf(k, D2); ; ) if (O2[D2] !== k) if (S2 && z.length === 0 && O2.substring(D2, D2 + K2) === S2) {
          if (Z2 === -1) return we();
          D2 = Z2 + Y2, Z2 = O2.indexOf(A2, D2), Q2 = O2.indexOf(T2, D2);
        } else if (Q2 !== -1 && (Q2 < Z2 || Z2 === -1)) z.push(O2.substring(D2, Q2)), D2 = Q2 + X2, Q2 = O2.indexOf(T2, D2);
        else {
          if (Z2 === -1) break;
          if (z.push(O2.substring(D2, Z2)), me(Z2 + Y2), q && (be(), I2)) return we();
          if (E2 && re.length >= E2) return we(true);
        }
        else for (ae = D2, D2++; ; ) {
          if ((ae = O2.indexOf(k, ae + 1)) === -1) return V2 || R2.push({ type: "Quotes", code: "MissingQuotes", message: "Quoted field unterminated", row: re.length, index: D2 }), he();
          if (ae === W2 - 1) return he(O2.substring(D2, ae).replace(ne, k));
          if (k !== N2 || O2[ae + 1] !== N2) {
            if (k === N2 || ae === 0 || O2[ae - 1] !== N2) {
              Q2 !== -1 && Q2 < ae + 1 && (Q2 = O2.indexOf(T2, ae + 1)), Z2 !== -1 && Z2 < ae + 1 && (Z2 = O2.indexOf(A2, ae + 1));
              var ue = se(Z2 === -1 ? Q2 : Math.min(Q2, Z2));
              if (O2[ae + 1 + ue] === T2) {
                z.push(O2.substring(D2, ae).replace(ne, k)), O2[D2 = ae + 1 + ue + X2] !== k && (ae = O2.indexOf(k, D2)), Q2 = O2.indexOf(T2, D2), Z2 = O2.indexOf(A2, D2);
                break;
              }
              var le = se(Z2);
              if (O2.substring(ae + 1 + le, ae + 1 + le + Y2) === A2) {
                if (z.push(O2.substring(D2, ae).replace(ne, k)), me(ae + 1 + le + Y2), Q2 = O2.indexOf(T2, D2), ae = O2.indexOf(k, D2), q && (be(), I2)) return we();
                if (E2 && re.length >= E2) return we(true);
                break;
              }
              R2.push({ type: "Quotes", code: "InvalidQuotes", message: "Trailing quote on quoted field is malformed", row: re.length, index: D2 }), ae++;
            }
          } else ae++;
        }
        return he();
        function ce(Ae) {
          re.push(Ae), H2 = D2;
        }
        function se(Ae) {
          var pe = 0;
          if (Ae !== -1) {
            var ve = O2.substring(ae + 1, Ae);
            ve && ve.trim() === "" && (pe = ve.length);
          }
          return pe;
        }
        function he(Ae) {
          return V2 || (Ae === void 0 && (Ae = O2.substring(D2)), z.push(Ae), D2 = W2, ce(z), q && be()), we();
        }
        function me(Ae) {
          D2 = Ae, ce(z), z = [], Z2 = O2.indexOf(A2, D2);
        }
        function we(Ae) {
          return { data: re, errors: R2, meta: { delimiter: T2, linebreak: A2, aborted: I2, truncated: !!Ae, cursor: H2 + (L2 || 0) } };
        }
        function be() {
          C2(we()), re = [], R2 = [];
        }
      }, this.abort = function() {
        I2 = true;
      }, this.getCharIndex = function() {
        return D2;
      };
    }
    function m(_4) {
      var k = _4.data, T2 = a[k.workerId], A2 = false;
      if (k.error) T2.userError(k.error, k.file);
      else if (k.results && k.results.data) {
        var S2 = { abort: function() {
          A2 = true, g(k.workerId, { data: [], errors: [], meta: { aborted: true } });
        }, pause: x, resume: x };
        if (w(T2.userStep)) {
          for (var C2 = 0; C2 < k.results.data.length && (T2.userStep({ data: k.results.data[C2], errors: k.results.errors, meta: k.results.meta }, S2), !A2); C2++) ;
          delete k.results;
        } else w(T2.userChunk) && (T2.userChunk(k.results, S2, k.file), delete k.results);
      }
      k.finished && !A2 && g(k.workerId, k.results);
    }
    function g(_4, k) {
      var T2 = a[_4];
      w(T2.userComplete) && T2.userComplete(k), T2.terminate(), delete a[_4];
    }
    function x() {
      throw new Error("Not implemented.");
    }
    function b(_4) {
      if (typeof _4 != "object" || _4 === null) return _4;
      var k = Array.isArray(_4) ? [] : {};
      for (var T2 in _4) k[T2] = b(_4[T2]);
      return k;
    }
    function y(_4, k) {
      return function() {
        _4.apply(k, arguments);
      };
    }
    function w(_4) {
      return typeof _4 == "function";
    }
    return n && (t.onmessage = function(_4) {
      var k = _4.data;
      if (s.WORKER_ID === void 0 && k && (s.WORKER_ID = k.workerId), typeof k.input == "string") t.postMessage({ workerId: s.WORKER_ID, results: s.parse(k.input, k.config), finished: true });
      else if (t.File && k.input instanceof File || k.input instanceof Object) {
        var T2 = s.parse(k.input, k.config);
        T2 && t.postMessage({ workerId: s.WORKER_ID, results: T2, finished: true });
      }
    }), (u2.prototype = Object.create(l.prototype)).constructor = u2, (c.prototype = Object.create(l.prototype)).constructor = c, (f.prototype = Object.create(f.prototype)).constructor = f, (h.prototype = Object.create(l.prototype)).constructor = h, s;
  });
});
var Ab = { tableMaxRow: 10, tableMaxColInConsole: 10, dtypeTestLim: 20, lowMemoryMode: false };
var qp = ["float32", "int32", "string", "boolean", "datetime", "undefined"];
var Ld = class {
  tableDisplayConfig;
  tableMaxRow;
  tableMaxColInConsole;
  dtypeTestLim;
  lowMemoryMode;
  constructor(t) {
    let { tableDisplayConfig: r, tableMaxRow: n, tableMaxColInConsole: a, dtypeTestLim: o, lowMemoryMode: s } = __spreadValues({ tableDisplayConfig: {}, tableMaxRow: 10, tableMaxColInConsole: 10, dtypeTestLim: 500, lowMemoryMode: false }, t);
    this.tableDisplayConfig = r, this.tableMaxRow = n, this.tableMaxColInConsole = a, this.dtypeTestLim = o, this.lowMemoryMode = s;
  }
  setTableDisplayConfig(t) {
    this.tableDisplayConfig = t;
  }
  get getTableDisplayConfig() {
    return this.tableDisplayConfig;
  }
  setTableMaxColInConsole(t) {
    this.tableMaxColInConsole = t;
  }
  get getTableMaxColInConsole() {
    return this.tableMaxColInConsole;
  }
  setMaxRow(t) {
    this.tableMaxRow = t;
  }
  get getMaxRow() {
    return this.tableMaxRow;
  }
  get getDtypeTestLim() {
    return this.dtypeTestLim;
  }
  setDtypeTestLim(t) {
    this.dtypeTestLim = t;
  }
  get isLowMemoryMode() {
    return this.lowMemoryMode;
  }
  setIsLowMemoryMode(t) {
    this.lowMemoryMode = t;
  }
};
var qE = class {
  throwColumnNamesLengthError = (t, r) => {
    let n = `ParamError: Column names length mismatch. You provided a column of length ${r.length} but Ndframe columns has length of ${t.shape[1]}`;
    throw new Error(n);
  };
  throwIndexLengthError = (t, r) => {
    let n = `IndexError: You provided an index of length ${r.length} but Ndframe rows has length of ${t.shape[0]}`;
    throw new Error(n);
  };
  throwIndexDuplicateError = () => {
    let t = "IndexError: Row index must contain unique values";
    throw new Error(t);
  };
  throwColumnDuplicateError = () => {
    let t = "ColumnIndexError: Column index must contain unique values";
    throw new Error(t);
  };
  throwDtypesLengthError = (t, r) => {
    let n = `DtypeError: You provided a dtype array of length ${r.length} but Ndframe columns has length of ${t.shape[1]}`;
    throw new Error(n);
  };
  throwDtypeNotSupportedError = (t) => {
    let r = `DtypeError: Dtype "${t}" not supported. dtype must be one of "${qp}"`;
    throw new Error(r);
  };
  throwDtypeWithoutColumnError = () => {
    let t = "DtypeError: columns parameter must be provided when dtypes parameter is provided";
    throw new Error(t);
  };
  throwColumnLengthError = (t, r) => {
    let n = `ParamError: Column data length mismatch. You provided data with length ${r} but Ndframe has column of length ${t.shape[0]}`;
    throw new Error(n);
  };
  throwRowLengthError = (t, r) => {
    let n = `ParamError: Row data length mismatch. You provided data with length ${r} but Ndframe has row of length ${t.shape[0]}`;
    throw new Error(n);
  };
  throwColumnNotFoundError = (t) => {
    let r = `ParamError: Column not found!. Column name must be one of ${t.columns}`;
    throw new Error(r);
  };
  throwNotImplementedError = () => {
    let t = "Method not implemented";
    throw new Error(t);
  };
  throwIlocRowIndexError = () => {
    let t = 'ParamError: rows parameter must be a Array. For example: rows: [1,2] or rows: ["0:10"]';
    throw new Error(t);
  };
  throwIlocColumnsIndexError = () => {
    let t = 'ParamError: columns parameter must be a Array. For example: columns: [1,2] or columns: ["0:10"]';
    throw new Error(t);
  };
  throwStringDtypeOperationError = (t) => {
    let r = `DtypeError: String data type does not support ${t} operation`;
    throw new Error(r);
  };
  throwSeriesMathOpLengthError = (t, r) => {
    let n = `ParamError: Row length mismatch. Length of other (${r.shape[0]}), must be the same as Ndframe (${t.shape[0]})`;
    throw new Error(n);
  };
};
var Zo = new qE();
var XE = new Ld(Ab);
var hs = class {
  removeElementFromArray(t, r) {
    return t.filter((a, o) => o != r);
  }
  isString(t) {
    return typeof t == "string";
  }
  isNumber(t) {
    return typeof t == "number" && isFinite(t);
  }
  isObject(t) {
    return t && typeof t == "object" && t.constructor && t.constructor.name === "Object";
  }
  isNull(t) {
    return t === null;
  }
  isUndefined(t) {
    return typeof t > "u";
  }
  isEmpty(t) {
    return t == null ? true : typeof t == "bigint" ? false : typeof t == "number" ? isNaN(t) : false;
  }
  isDate(t) {
    return t instanceof Date;
  }
  range(t, r) {
    if (r < t) throw new Error("ParamError: end must be greater than start");
    if (t === r) return [t];
    let n = [];
    for (let a = t; a <= r; a++) n.push(a);
    return n;
  }
  keyInObject(t, r) {
    return Object.prototype.hasOwnProperty.call(t, r);
  }
  transposeArray(t) {
    if (t.length === 0) return t;
    let r = t.length;
    if (Array.isArray(t[0])) {
      let n = t[0].length, a = [];
      for (let o = 0; o <= n - 1; o++) {
        let s = [];
        for (let i = 0; i < r; i++) {
          let l = t[i][o];
          s.push(l);
        }
        a.push(s);
      }
      return a;
    } else return t;
  }
  getRowAndColValues(t) {
    let r = Object.keys(t), n = Object.values(t), a = n[0].length;
    return n.forEach((s) => {
      if (s.length != a) throw Error("Length Error: Length of columns must be the same!");
    }), [this.transposeArray(n), r];
  }
  convert2DArrayToSeriesArray(t) {
    return t.map((n) => this.isObject(n) ? JSON.stringify(n) : `${n}`);
  }
  replaceUndefinedWithNaN(t, r) {
    if (t.length === 0) return t;
    if (r && Array.isArray(t)) return t.map((a) => typeof a > "u" ? NaN : typeof a == "number" && (isNaN(a) || a == 1 / 0) ? NaN : a ?? NaN);
    {
      let n = [];
      if (Array.isArray(t)) for (let a = 0; a < t.length; a++) {
        let s = t[a].map((i) => typeof i > "u" ? NaN : typeof i == "number" && (isNaN(i) || i == 1 / 0) ? NaN : i ?? NaN);
        n.push(s);
      }
      return n;
    }
  }
  inferDtype(t) {
    let r = this;
    return this.is1DArray(t) ? [this.$typeChecker(t)] : this.transposeArray(t.slice(0, XE.getDtypeTestLim)).map((o) => r.$typeChecker(o));
  }
  $typeChecker(t) {
    let r, n, a = [], o = [], s = [], i = [], l = [];
    t.length < XE.getDtypeTestLim ? n = t.length : n = XE.getDtypeTestLim;
    let u2 = t.slice(0, n);
    for (let f = 0; f < n; f++) {
      let h = u2[f];
      typeof h == "boolean" ? (o.push(false), a.push(false), s.push(false), i.push(true), l.push(false)) : this.isEmpty(h) ? (o.push(true), a.push(false), s.push(false), i.push(false), l.push(false)) : this.isDate(h) ? (o.push(false), a.push(false), s.push(false), i.push(false), l.push(true)) : isNaN(Number(h)) ? (o.push(false), a.push(false), s.push(true), i.push(false), l.push(false)) : h.toString().includes(".") ? (o.push(true), a.push(false), s.push(false), i.push(false), l.push(false)) : (o.push(false), a.push(true), s.push(false), i.push(false), l.push(false));
    }
    let c = (f) => f == true;
    return s.some(c) ? r = "string" : o.some(c) ? r = "float32" : a.some(c) ? r = "int32" : i.some(c) ? r = "boolean" : l.some(c) ? r = "datetime" : r = "undefined", r;
  }
  unique(t) {
    let r = new Set(t);
    return Array.from(r);
  }
  is1DArray(t) {
    return typeof t[0] == "number" || typeof t[0] == "string" || typeof t[0] == "boolean" || t[0] === null;
  }
  convertArrayToObject(t) {
    let r = {};
    for (let n = 0; n < t.length; n++) r[n] = t[n];
    return r;
  }
  countNaNs(t, r = true, n) {
    if (n) {
      let a = 0, o = 0;
      for (let s = 0; s < t.length; s++) {
        let i = t[s];
        Number.isNaN(i) ? a = a + 1 : o = o + 1;
      }
      return r ? o : a;
    } else {
      let a = [];
      for (let o = 0; o < t.length; o++) {
        let s = t[o], i = 0, l = 0;
        for (let u2 = 0; u2 < s.length; u2++) {
          let c = s[u2];
          Number.isNaN(c) ? i = i + 1 : l = l + 1;
        }
        r ? a.push(l) : a.push(i);
      }
      return a;
    }
  }
  round(t, r = 1, n) {
    if (r < 0 && (r = 1), n) {
      let a = [];
      for (let o = 0; o < t.length; o++) {
        let s = t[o];
        typeof s == "number" && !isNaN(s) && s !== void 0 && s !== null ? a.push(Number(s.toFixed(r))) : a.push(s);
      }
      return a;
    } else {
      let a = [];
      for (let o = 0; o < t.length; o++) {
        let s = t[o], i = [];
        if (Array.isArray(s)) {
          for (let l = 0; l < s.length; l++) {
            let u2 = s[l];
            typeof u2 == "number" && !isNaN(u2) && u2 !== void 0 && u2 !== null ? i.push(Number(u2.toFixed(r))) : i.push(u2);
          }
          a.push(i);
        } else typeof s == "number" && !isNaN(s) && s !== void 0 && s !== null ? i.push(Number(s.toFixed(r))) : i.push(s);
      }
      return a;
    }
  }
  isFunction(t) {
    return typeof t == "function";
  }
  randNumberGenerator(t, r, n) {
    let a = [];
    function o(i, l) {
      return Math.floor(Math.random() * (l - i) + i);
    }
    function s(i, l) {
      if (!l.includes(i)) return i;
      i = o(t, r), s(i, l);
    }
    for (let i = 0; i < n; i++) {
      let l = o(t, r), u2 = s(l, a);
      a.push(u2);
    }
    return a;
  }
  throwErrorOnWrongParams(t, r) {
    let n = Object.keys(t), a = [];
    for (let s = 0; s < n.length; s++) r.includes(n[s]) ? a.push(true) : a.push(false);
    let o = (s) => s == false;
    if (a.some(o)) throw Error(`Params Error: Required parameter not found. Your params must include the following [${r}]`);
  }
  mapIntegersToBooleans(t, r) {
    if (r == 2) {
      let n = [];
      return t.map((a) => {
        let o = [];
        a.map((s) => o.push(s == 1)), n.push(o);
      }), n;
    } else {
      let n = [];
      return t.map((a) => n.push(a == 1)), n;
    }
  }
  mapBooleansToIntegers(t, r) {
    if (r == 2) {
      let n = [];
      return t.map((a) => {
        let o = [];
        a.map((s) => o.push(s ? 1 : 0)), n.push(o);
      }), n;
    } else {
      let n = [];
      return t.map((a) => n.push(a ? 1 : 0)), n;
    }
  }
  zeros(t, r) {
    let n = [];
    for (let a = 0; a < t; a++) {
      let o = Array(r);
      for (let s = 0; s < r; s++) o[s] = 0;
      n.push(o);
    }
    return n;
  }
  shuffle(t, r) {
    let n = t.length, a = 0, o;
    for (; n--; ) a = Math.floor(Math.random() * (n + 1)), o = t[n], t[n] = t[a], t[a] = o;
    return t.slice(0, r);
  }
  sort(t, r = true) {
    return [...t].sort((a, o) => r ? typeof a == "string" && typeof o == "string" ? a.charCodeAt(0) - o.charCodeAt(0) : a - o : typeof a == "string" && typeof o == "string" ? o.charCodeAt(0) - a.charCodeAt(0) : o - a);
  }
  isBrowserEnv() {
    return new Function("try {return this===window;}catch(e){ return false;}")();
  }
  isNodeEnv() {
    return new Function("try {return this===global;}catch(e){return false;}")();
  }
  removeMissingValuesFromArray(t) {
    return t.filter((n) => !this.isEmpty(n));
  }
  replaceNanWithNull(t) {
    return t.map((n) => isNaN(n) ? null : n);
  }
  getDuplicate(t) {
    let r = {}, n = {};
    for (let a = 0; a < t.length; a++) {
      let o = t[a];
      this.keyInObject(r, o) ? (r[o].count += 1, r[o].index.push(a)) : (r[o] = {}, r[o].count = 1, r[o].index = [a]);
    }
    for (let a in r) r[a].count >= 2 && (n[a] = {}, n[a].count = r[a].count, n[a].index = r[a].index);
    return n;
  }
  sortArrayByIndex(t, r, n) {
    let a = t.map((o, s) => [r[s], o]);
    return n == "string" ? a.sort() : a.sort(([o], [s]) => s - o), a.map(([, o]) => o);
  }
  createNdframeFromNewDataWithOldProps({ ndFrame: t, newData: r, isSeries: n }) {
    return n ? new ea(r, { index: [...t.index], columns: [...t.columns], dtypes: [...t.dtypes], config: __spreadValues({}, t.config) }) : new Na(r, { index: [...t.index], columns: [...t.columns], dtypes: [...t.dtypes], config: __spreadValues({}, t.config) });
  }
  checkSeriesOpCompactibility({ firstSeries: t, secondSeries: r, operation: n }) {
    t.shape[0] != r.shape[0] && Zo.throwSeriesMathOpLengthError(t, r), (t.dtypes[0] == "string" || r.dtypes[0] == "string") && Zo.throwStringDtypeOperationError(n);
  }
  sortObj(t, r) {
    return t.sort((a, o) => {
      let s = o.value, i = a.value;
      return r ? typeof s == "string" && typeof i == "string" ? (s = s.toUpperCase(), i = i.toUpperCase(), s > i ? -1 : s < i ? 1 : 0) : Number(i) - Number(s) : typeof s == "string" && typeof i == "string" ? (s = s.toUpperCase(), i = i.toUpperCase(), s < i ? -1 : s > i ? 1 : 0) : Number(s) - Number(i);
    });
  }
};
var Nat = VZ();
var zo = Nat;
var Kc = new hs();
var O0 = class {
  $isSeries;
  $data;
  $dataIncolumnFormat = [];
  $index = [];
  $columns = [];
  $dtypes = [];
  $config;
  constructor({ data: t, index: r, columns: n, dtypes: a, config: o, isSeries: s }) {
    if (this.$isSeries = s, o ? this.$config = new Ld(__spreadValues(__spreadValues({}, Ab), o)) : this.$config = new Ld(Ab), t instanceof zo.Tensor && (t = t.arraySync()), t === void 0 || Array.isArray(t) && t.length === 0) n === void 0 && (n = []), a === void 0 && (a = []), n.length === 0 && a.length !== 0 && Zo.throwDtypeWithoutColumnError(), this.loadArrayIntoNdframe({ data: [], index: [], columns: n, dtypes: a });
    else if (Kc.is1DArray(t)) this.loadArrayIntoNdframe({ data: t, index: r, columns: n, dtypes: a });
    else if (Array.isArray(t) && Kc.isObject(t[0])) this.loadObjectIntoNdframe({ data: t, type: 1, index: r, columns: n, dtypes: a });
    else if (Kc.isObject(t)) this.loadObjectIntoNdframe({ data: t, type: 2, index: r, columns: n, dtypes: a });
    else if (Array.isArray(t[0]) || Kc.isNumber(t[0]) || Kc.isString(t[0])) this.loadArrayIntoNdframe({ data: t, index: r, columns: n, dtypes: a });
    else if (Array.isArray(t) && t.length > 0 && Kc.isDate(t[0])) this.loadArrayIntoNdframe({ data: t, index: r, columns: n, dtypes: a });
    else throw new Error("File format not supported!");
  }
  loadArrayIntoNdframe({ data: t, index: r, columns: n, dtypes: a }) {
    this.$data = t, this.$config.isLowMemoryMode || (this.$dataIncolumnFormat = Kc.transposeArray(t)), this.$setIndex(r), this.$setDtypes(a), this.$setColumnNames(n);
  }
  loadObjectIntoNdframe({ data: t, type: r, index: n, columns: a, dtypes: o }) {
    if (r === 1 && Array.isArray(t)) {
      let s = t.map((l) => Object.values(l)), i;
      a ? i = a : i = Object.keys(t[0]), this.loadArrayIntoNdframe({ data: s, index: n, columns: i, dtypes: o });
    } else {
      let [s, i] = Kc.getRowAndColValues(t), l;
      a ? l = a : l = i, this.loadArrayIntoNdframe({ data: s, index: n, columns: l, dtypes: o });
    }
  }
  get tensor() {
    return this.$isSeries ? zo.tensor1d(this.$data, this.$dtypes[0]) : zo.tensor2d(this.$data, this.shape, "float32");
  }
  get dtypes() {
    return this.$dtypes;
  }
  $setDtypes(t) {
    this.$isSeries ? t ? (this.$data.length != 0 && t.length != 1 && Zo.throwDtypesLengthError(this, t), qp.includes(`${t[0]}`) || Zo.throwDtypeNotSupportedError(t[0]), this.$dtypes = t) : this.$dtypes = Kc.inferDtype(this.$data) : t ? (this.$data.length != 0 && t.length != this.shape[1] && Zo.throwDtypesLengthError(this, t), this.$data.length == 0 && t.length == 0 ? this.$dtypes = t : (t.forEach((r) => {
      qp.includes(r) || Zo.throwDtypeNotSupportedError(r);
    }), this.$dtypes = t)) : this.$dtypes = Kc.inferDtype(this.$data);
  }
  get ndim() {
    return this.$isSeries ? 1 : 2;
  }
  get axis() {
    return { index: this.$index, columns: this.$columns };
  }
  get config() {
    return this.$config;
  }
  $setConfig(t) {
    this.$config = t;
  }
  get index() {
    return this.$index;
  }
  $setIndex(t) {
    t ? (this.$data.length != 0 && t.length != this.shape[0] && Zo.throwIndexLengthError(this, t), Array.from(new Set(t)).length !== this.shape[0] && Zo.throwIndexDuplicateError(), this.$index = t) : this.$index = Kc.range(0, this.shape[0] - 1);
  }
  $resetIndex() {
    this.$index = Kc.range(0, this.shape[0] - 1);
  }
  get columns() {
    return this.$columns;
  }
  $setColumnNames(t) {
    this.$isSeries ? t ? (this.$data.length != 0 && t.length != 1 && typeof t != "string" && Zo.throwColumnNamesLengthError(this, t), this.$columns = t) : this.$columns = ["0"] : t ? (this.$data.length != 0 && t.length != this.shape[1] && Zo.throwColumnNamesLengthError(this, t), Array.from(new Set(t)).length !== t.length && Zo.throwColumnDuplicateError(), this.$columns = t) : this.$columns = Kc.range(0, this.shape[1] - 1).map((r) => `${r}`);
  }
  get shape() {
    if (this.$data.length === 0) return this.$columns.length === 0 ? [0, 0] : [0, this.$columns.length];
    if (this.$isSeries) return [this.$data.length, 1];
    {
      let t = this.$data.length, r = this.$data[0].length;
      return [t, r];
    }
  }
  get values() {
    return this.$data;
  }
  $setValues(t, r = true, n = true) {
    this.$isSeries ? (r && t.length != this.shape[0] && Zo.throwRowLengthError(this, t.length), this.$data = t, this.$dtypes = Kc.inferDtype(t), this.$config.isLowMemoryMode || (this.$dataIncolumnFormat = t)) : (r && t.length != this.shape[0] && Zo.throwRowLengthError(this, t.length), n && t.forEach((a) => {
      a.length != this.shape[1] && Zo.throwColumnLengthError(this, t.length);
    }), this.$data = t, this.$dtypes = Kc.inferDtype(t), this.$config.isLowMemoryMode || (this.$dataIncolumnFormat = Kc.transposeArray(t)));
  }
  get getColumnData() {
    return this.config.isLowMemoryMode ? Kc.transposeArray(this.values) : this.$dataIncolumnFormat;
  }
  get size() {
    return this.shape[0] * this.shape[1];
  }
  toCSV(t) {
    throw new Error("`toCSV` function is deprecated. Use `toCSV` function directly instead. e.g. `dfd.toCSV(df)`");
  }
  toJSON(t) {
    throw new Error("`toJSON` function is deprecated. Use `toJSON` function directly instead. e.g. `dfd.toJSON(df, { format: 'row' })`");
  }
  toExcel(t) {
    throw new Error("Deprecated. Use `toExcel` function directly instead. e.g. `dfd.toExcel(df, {filePath: 'path/to/file.xlsx'})`");
  }
  print() {
    console.log(this + "");
  }
};
function g_() {
  return g_ = Object.assign || function(e) {
    for (var t = 1; t < arguments.length; t++) {
      var r = arguments[t];
      for (var n in r) Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n]);
    }
    return e;
  }, g_.apply(this, arguments);
}
var BI = { epsilon: 1e-12, matrix: "Matrix", number: "number", precision: 64, predictable: false, randomSeed: null };
function Hs(e) {
  return typeof e == "number";
}
function uu(e) {
  return !e || typeof e != "object" || typeof e.constructor != "function" ? false : e.isBigNumber === true && typeof e.constructor.prototype == "object" && e.constructor.prototype.isBigNumber === true || typeof e.constructor.isDecimal == "function" && e.constructor.isDecimal(e) === true;
}
function nA(e) {
  return e && typeof e == "object" && Object.getPrototypeOf(e).isComplex === true || false;
}
function aA(e) {
  return e && typeof e == "object" && Object.getPrototypeOf(e).isFraction === true || false;
}
function y_(e) {
  return e && e.constructor.prototype.isUnit === true || false;
}
function jh(e) {
  return typeof e == "string";
}
var Tl = Array.isArray;
function ts(e) {
  return e && e.constructor.prototype.isMatrix === true || false;
}
function dx(e) {
  return Array.isArray(e) || ts(e);
}
function jZ(e) {
  return e && e.isDenseMatrix && e.constructor.prototype.isMatrix === true || false;
}
function WZ(e) {
  return e && e.isSparseMatrix && e.constructor.prototype.isMatrix === true || false;
}
function UI(e) {
  return e && e.constructor.prototype.isRange === true || false;
}
function Bg(e) {
  return e && e.constructor.prototype.isIndex === true || false;
}
function GZ(e) {
  return typeof e == "boolean";
}
function VI(e) {
  return e && e.constructor.prototype.isResultSet === true || false;
}
function jI(e) {
  return e && e.constructor.prototype.isHelp === true || false;
}
function $Z(e) {
  return typeof e == "function";
}
function HZ(e) {
  return e instanceof Date;
}
function qZ(e) {
  return e instanceof RegExp;
}
function XZ(e) {
  return !!(e && typeof e == "object" && e.constructor === Object && !nA(e) && !aA(e));
}
function KZ(e) {
  return e === null;
}
function YZ(e) {
  return e === void 0;
}
function ZZ(e) {
  return e && e.isAccessorNode === true && e.constructor.prototype.isNode === true || false;
}
function JZ(e) {
  return e && e.isArrayNode === true && e.constructor.prototype.isNode === true || false;
}
function QZ(e) {
  return e && e.isAssignmentNode === true && e.constructor.prototype.isNode === true || false;
}
function eJ(e) {
  return e && e.isBlockNode === true && e.constructor.prototype.isNode === true || false;
}
function tJ(e) {
  return e && e.isConditionalNode === true && e.constructor.prototype.isNode === true || false;
}
function rJ(e) {
  return e && e.isConstantNode === true && e.constructor.prototype.isNode === true || false;
}
function nJ(e) {
  return e && e.isFunctionAssignmentNode === true && e.constructor.prototype.isNode === true || false;
}
function aJ(e) {
  return e && e.isFunctionNode === true && e.constructor.prototype.isNode === true || false;
}
function iJ(e) {
  return e && e.isIndexNode === true && e.constructor.prototype.isNode === true || false;
}
function WI(e) {
  return e && e.isNode === true && e.constructor.prototype.isNode === true || false;
}
function oJ(e) {
  return e && e.isObjectNode === true && e.constructor.prototype.isNode === true || false;
}
function sJ(e) {
  return e && e.isOperatorNode === true && e.constructor.prototype.isNode === true || false;
}
function lJ(e) {
  return e && e.isParenthesisNode === true && e.constructor.prototype.isNode === true || false;
}
function uJ(e) {
  return e && e.isRangeNode === true && e.constructor.prototype.isNode === true || false;
}
function cJ(e) {
  return e && e.isSymbolNode === true && e.constructor.prototype.isNode === true || false;
}
function GI(e) {
  return e && e.constructor.prototype.isChain === true || false;
}
function hf(e) {
  var t = typeof e;
  return t === "object" ? e === null ? "null" : Array.isArray(e) ? "Array" : e instanceof Date ? "Date" : e instanceof RegExp ? "RegExp" : uu(e) ? "BigNumber" : nA(e) ? "Complex" : aA(e) ? "Fraction" : ts(e) ? "Matrix" : y_(e) ? "Unit" : Bg(e) ? "Index" : UI(e) ? "Range" : VI(e) ? "ResultSet" : WI(e) ? e.type : GI(e) ? "Chain" : jI(e) ? "Help" : "Object" : t === "function" ? "Function" : t;
}
function tl(e) {
  var t = typeof e;
  if (t === "number" || t === "string" || t === "boolean" || e === null || e === void 0) return e;
  if (typeof e.clone == "function") return e.clone();
  if (Array.isArray(e)) return e.map(function(r) {
    return tl(r);
  });
  if (e instanceof Date) return new Date(e.valueOf());
  if (uu(e)) return e;
  if (e instanceof RegExp) throw new TypeError("Cannot clone " + e);
  return Fat(e, tl);
}
function Fat(e, t) {
  var r = {};
  for (var n in e) gx(e, n) && (r[n] = t(e[n]));
  return r;
}
function mx(e, t) {
  for (var r in t) gx(t, r) && (e[r] = t[r]);
  return e;
}
function vx(e, t) {
  var r, n, a;
  if (Array.isArray(e)) {
    if (!Array.isArray(t) || e.length !== t.length) return false;
    for (n = 0, a = e.length; n < a; n++) if (!vx(e[n], t[n])) return false;
    return true;
  } else {
    if (typeof e == "function") return e === t;
    if (e instanceof Object) {
      if (Array.isArray(t) || !(t instanceof Object)) return false;
      for (r in e) if (!(r in t) || !vx(e[r], t[r])) return false;
      for (r in t) if (!(r in e)) return false;
      return true;
    } else return e === t;
  }
}
function gx(e, t) {
  return e && Object.hasOwnProperty.call(e, t);
}
function fJ(e, t) {
  for (var r = {}, n = 0; n < t.length; n++) {
    var a = t[n], o = e[a];
    o !== void 0 && (r[a] = o);
  }
  return r;
}
var hJ = ["Matrix", "Array"];
var pJ = ["number", "BigNumber", "Fraction"];
var Jd = function(t) {
  if (t) throw new Error(`The global config is readonly. 
Please create a mathjs instance if you want to change the default configuration. 
Example:

  import { create, all } from 'mathjs';
  const mathjs = create(all);
  mathjs.config({ number: 'BigNumber' });
`);
  return Object.freeze(BI);
};
g_(Jd, BI, { MATRIX_OPTIONS: hJ, NUMBER_OPTIONS: pJ });
var eN = km(vJ(), 1);
function Bo(e) {
  return typeof e == "boolean" ? true : isFinite(e) ? e === Math.round(e) : false;
}
var mJ = Math.sign || function(e) {
  return e > 0 ? 1 : e < 0 ? -1 : 0;
};
var gJ = Math.log2 || function(t) {
  return Math.log(t) / Math.LN2;
};
var yJ = Math.log10 || function(t) {
  return Math.log(t) / Math.LN10;
};
var xJ = Math.log1p || function(e) {
  return Math.log(e + 1);
};
var bJ = Math.cbrt || function(t) {
  if (t === 0) return t;
  var r = t < 0, n;
  return r && (t = -t), isFinite(t) ? (n = Math.exp(Math.log(t) / 3), n = (t / (n * n) + 2 * n) / 3) : n = t, r ? -n : n;
};
var _J = Math.expm1 || function(t) {
  return t >= 2e-4 || t <= -2e-4 ? Math.exp(t) - 1 : t + t * t / 2 + t * t * t / 6;
};
function HI(e, t, r) {
  var n = { 2: "0b", 8: "0o", 16: "0x" }, a = n[t], o = "";
  if (r) {
    if (r < 1) throw new Error("size must be in greater than 0");
    if (!Bo(r)) throw new Error("size must be an integer");
    if (e > 2 ** (r - 1) - 1 || e < -(2 ** (r - 1))) throw new Error("Value must be in range [-2^".concat(r - 1, ", 2^").concat(r - 1, "-1]"));
    if (!Bo(e)) throw new Error("Value must be an integer");
    e < 0 && (e = e + 2 ** r), o = "i".concat(r);
  }
  var s = "";
  return e < 0 && (e = -e, s = "-"), "".concat(s).concat(a).concat(e.toString(t)).concat(o);
}
function x_(e, t) {
  if (typeof t == "function") return t(e);
  if (e === 1 / 0) return "Infinity";
  if (e === -1 / 0) return "-Infinity";
  if (isNaN(e)) return "NaN";
  var r = "auto", n, a;
  if (t && (t.notation && (r = t.notation), Hs(t) ? n = t : Hs(t.precision) && (n = t.precision), t.wordSize && (a = t.wordSize, typeof a != "number"))) throw new Error('Option "wordSize" must be a number');
  switch (r) {
    case "fixed":
      return qI(e, n);
    case "exponential":
      return wJ(e, n);
    case "engineering":
      return Oat(e, n);
    case "bin":
      return HI(e, 2, a);
    case "oct":
      return HI(e, 8, a);
    case "hex":
      return HI(e, 16, a);
    case "auto":
      return Pat(e, n, t && t).replace(/((\.\d*?)(0+))($|e)/, function() {
        var o = arguments[2], s = arguments[4];
        return o !== "." ? o + s : s;
      });
    default:
      throw new Error('Unknown notation "' + r + '". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.');
  }
}
function iA(e) {
  var t = String(e).toLowerCase().match(/^0*?(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);
  if (!t) throw new SyntaxError("Invalid number " + e);
  var r = t[1], n = t[2], a = parseFloat(t[4] || "0"), o = n.indexOf(".");
  a += o !== -1 ? o - 1 : n.length - 1;
  var s = n.replace(".", "").replace(/^0*/, function(i) {
    return a -= i.length, "";
  }).replace(/0*$/, "").split("").map(function(i) {
    return parseInt(i);
  });
  return s.length === 0 && (s.push(0), a++), { sign: r, coefficients: s, exponent: a };
}
function Oat(e, t) {
  if (isNaN(e) || !isFinite(e)) return String(e);
  var r = iA(e), n = oA(r, t), a = n.exponent, o = n.coefficients, s = a % 3 === 0 ? a : a < 0 ? a - 3 - a % 3 : a - a % 3;
  if (Hs(t)) for (; t > o.length || a - s + 1 > o.length; ) o.push(0);
  else for (var i = Math.abs(a - s) - (o.length - 1), l = 0; l < i; l++) o.push(0);
  for (var u2 = Math.abs(a - s), c = 1; u2 > 0; ) c++, u2--;
  var f = o.slice(c).join(""), h = Hs(t) && f.length || f.match(/[1-9]/) ? "." + f : "", p = o.slice(0, c).join("") + h + "e" + (a >= 0 ? "+" : "") + s.toString();
  return n.sign + p;
}
function qI(e, t) {
  if (isNaN(e) || !isFinite(e)) return String(e);
  var r = iA(e), n = typeof t == "number" ? oA(r, r.exponent + 1 + t) : r, a = n.coefficients, o = n.exponent + 1, s = o + (t || 0);
  return a.length < s && (a = a.concat(yx(s - a.length))), o < 0 && (a = yx(-o + 1).concat(a), o = 1), o < a.length && a.splice(o, 0, o === 0 ? "0." : "."), n.sign + a.join("");
}
function wJ(e, t) {
  if (isNaN(e) || !isFinite(e)) return String(e);
  var r = iA(e), n = t ? oA(r, t) : r, a = n.coefficients, o = n.exponent;
  a.length < t && (a = a.concat(yx(t - a.length)));
  var s = a.shift();
  return n.sign + s + (a.length > 0 ? "." + a.join("") : "") + "e" + (o >= 0 ? "+" : "") + o;
}
function Pat(e, t, r) {
  if (isNaN(e) || !isFinite(e)) return String(e);
  var n = r && r.lowerExp !== void 0 ? r.lowerExp : -3, a = r && r.upperExp !== void 0 ? r.upperExp : 5, o = iA(e), s = t ? oA(o, t) : o;
  if (s.exponent < n || s.exponent >= a) return wJ(e, t);
  var i = s.coefficients, l = s.exponent;
  i.length < t && (i = i.concat(yx(t - i.length))), i = i.concat(yx(l - i.length + 1 + (i.length < t ? t - i.length : 0))), i = yx(-l).concat(i);
  var u2 = l > 0 ? l : 0;
  return u2 < i.length - 1 && i.splice(u2 + 1, 0, "."), s.sign + i.join("");
}
function oA(e, t) {
  for (var r = { sign: e.sign, coefficients: e.coefficients, exponent: e.exponent }, n = r.coefficients; t <= 0; ) n.unshift(0), r.exponent++, t++;
  if (n.length > t) {
    var a = n.splice(t, n.length - t);
    if (a[0] >= 5) {
      var o = t - 1;
      for (n[o]++; n[o] === 10; ) n.pop(), o === 0 && (n.unshift(0), r.exponent++, o++), o--, n[o]++;
    }
  }
  return r;
}
function yx(e) {
  for (var t = [], r = 0; r < e; r++) t.push(0);
  return t;
}
function kJ(e) {
  return e.toExponential().replace(/e.*$/, "").replace(/^0\.?0*|\./, "").length;
}
var Lat = Number.EPSILON || 2220446049250313e-31;
function wp(e, t, r) {
  if (r == null) return e === t;
  if (e === t) return true;
  if (isNaN(e) || isNaN(t)) return false;
  if (isFinite(e) && isFinite(t)) {
    var n = Math.abs(e - t);
    return n < Lat ? true : n <= Math.max(Math.abs(e), Math.abs(t)) * r;
  }
  return false;
}
function XI(e, t, r) {
  var n = e.constructor, a = new n(2), o = "";
  if (r) {
    if (r < 1) throw new Error("size must be in greater than 0");
    if (!Bo(r)) throw new Error("size must be an integer");
    if (e.greaterThan(a.pow(r - 1).sub(1)) || e.lessThan(a.pow(r - 1).mul(-1))) throw new Error("Value must be in range [-2^".concat(r - 1, ", 2^").concat(r - 1, "-1]"));
    if (!e.isInteger()) throw new Error("Value must be an integer");
    e.lessThan(0) && (e = e.add(a.pow(r))), o = "i".concat(r);
  }
  switch (t) {
    case 2:
      return "".concat(e.toBinary()).concat(o);
    case 8:
      return "".concat(e.toOctal()).concat(o);
    case 16:
      return "".concat(e.toHexadecimal()).concat(o);
    default:
      throw new Error("Base ".concat(t, " not supported "));
  }
}
function AJ(e, t) {
  if (typeof t == "function") return t(e);
  if (!e.isFinite()) return e.isNaN() ? "NaN" : e.gt(0) ? "Infinity" : "-Infinity";
  var r = "auto", n, a;
  if (t !== void 0 && (t.notation && (r = t.notation), typeof t == "number" ? n = t : t.precision && (n = t.precision), t.wordSize && (a = t.wordSize, typeof a != "number"))) throw new Error('Option "wordSize" must be a number');
  switch (r) {
    case "fixed":
      return zat(e, n);
    case "exponential":
      return TJ(e, n);
    case "engineering":
      return Rat(e, n);
    case "bin":
      return XI(e, 2, a);
    case "oct":
      return XI(e, 8, a);
    case "hex":
      return XI(e, 16, a);
    case "auto": {
      var o = t && t.lowerExp !== void 0 ? t.lowerExp : -3, s = t && t.upperExp !== void 0 ? t.upperExp : 5;
      if (e.isZero()) return "0";
      var i, l = e.toSignificantDigits(n), u2 = l.e;
      return u2 >= o && u2 < s ? i = l.toFixed() : i = TJ(e, n), i.replace(/((\.\d*?)(0+))($|e)/, function() {
        var c = arguments[2], f = arguments[4];
        return c !== "." ? c + f : f;
      });
    }
    default:
      throw new Error('Unknown notation "' + r + '". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.');
  }
}
function Rat(e, t) {
  var r = e.e, n = r % 3 === 0 ? r : r < 0 ? r - 3 - r % 3 : r - r % 3, a = e.mul(Math.pow(10, -n)), o = a.toPrecision(t);
  return o.indexOf("e") !== -1 && (o = a.toString()), o + "e" + (r >= 0 ? "+" : "") + n.toString();
}
function TJ(e, t) {
  return t !== void 0 ? e.toExponential(t - 1) : e.toExponential();
}
function zat(e, t) {
  return e.toFixed(t);
}
function Pl(e, t) {
  if (typeof e == "number") return x_(e, t);
  if (uu(e)) return AJ(e, t);
  if (Bat(e)) return !t || t.fraction !== "decimal" ? e.s * e.n + "/" + e.d : e.toString();
  if (Array.isArray(e)) return SJ(e, t);
  if (jh(e)) return '"' + e + '"';
  if (typeof e == "function") return e.syntax ? String(e.syntax) : "function";
  if (e && typeof e == "object") {
    if (typeof e.format == "function") return e.format(t);
    if (e && e.toString(t) !== {}.toString()) return e.toString(t);
    var r = Object.keys(e).map((n) => '"' + n + '": ' + Pl(e[n], t));
    return "{" + r.join(", ") + "}";
  }
  return String(e);
}
function SJ(e, t) {
  if (Array.isArray(e)) {
    for (var r = "[", n = e.length, a = 0; a < n; a++) a !== 0 && (r += ", "), r += SJ(e[a], t);
    return r += "]", r;
  } else return Pl(e, t);
}
function Bat(e) {
  return e && typeof e == "object" && typeof e.s == "number" && typeof e.n == "number" && typeof e.d == "number" || false;
}
function _o(e, t, r) {
  if (!(this instanceof _o)) throw new SyntaxError("Constructor must be called with the new operator");
  this.actual = e, this.expected = t, this.relation = r, this.message = "Dimension mismatch (" + (Array.isArray(e) ? "[" + e.join(", ") + "]" : e) + " " + (this.relation || "!=") + " " + (Array.isArray(t) ? "[" + t.join(", ") + "]" : t) + ")", this.stack = new Error().stack;
}
_o.prototype = new RangeError();
_o.prototype.constructor = RangeError;
_o.prototype.name = "DimensionError";
_o.prototype.isDimensionError = true;
function xd(e, t, r) {
  if (!(this instanceof xd)) throw new SyntaxError("Constructor must be called with the new operator");
  this.index = e, arguments.length < 3 ? (this.min = 0, this.max = t) : (this.min = t, this.max = r), this.min !== void 0 && this.index < this.min ? this.message = "Index out of range (" + this.index + " < " + this.min + ")" : this.max !== void 0 && this.index >= this.max ? this.message = "Index out of range (" + this.index + " > " + (this.max - 1) + ")" : this.message = "Index out of range (" + this.index + ")", this.stack = new Error().stack;
}
xd.prototype = new RangeError();
xd.prototype.constructor = RangeError;
xd.prototype.name = "IndexError";
xd.prototype.isIndexError = true;
function vc(e) {
  for (var t = []; Array.isArray(e); ) t.push(e.length), e = e[0];
  return t;
}
function EJ(e, t, r) {
  var n, a = e.length;
  if (a !== t[r]) throw new _o(a, t[r]);
  if (r < t.length - 1) {
    var o = r + 1;
    for (n = 0; n < a; n++) {
      var s = e[n];
      if (!Array.isArray(s)) throw new _o(t.length - 1, t.length, "<");
      EJ(e[n], t, o);
    }
  } else for (n = 0; n < a; n++) if (Array.isArray(e[n])) throw new _o(t.length + 1, t.length, ">");
}
function YI(e, t) {
  var r = t.length === 0;
  if (r) {
    if (Array.isArray(e)) throw new _o(e.length, 0);
  } else EJ(e, t, 0);
}
function du(e, t) {
  if (!Hs(e) || !Bo(e)) throw new TypeError("Index must be an integer (value: " + e + ")");
  if (e < 0 || typeof t == "number" && e >= t) throw new xd(e, t);
}
function b_(e, t, r) {
  if (!Array.isArray(e) || !Array.isArray(t)) throw new TypeError("Array expected");
  if (t.length === 0) throw new Error("Resizing to scalar is not supported");
  t.forEach(function(a) {
    if (!Hs(a) || !Bo(a) || a < 0) throw new TypeError("Invalid size, must contain positive integers (size: " + Pl(t) + ")");
  });
  var n = r !== void 0 ? r : 0;
  return KI(e, t, 0, n), e;
}
function KI(e, t, r, n) {
  var a, o, s = e.length, i = t[r], l = Math.min(s, i);
  if (e.length = i, r < t.length - 1) {
    var u2 = r + 1;
    for (a = 0; a < l; a++) o = e[a], Array.isArray(o) || (o = [o], e[a] = o), KI(o, t, u2, n);
    for (a = l; a < i; a++) o = [], e[a] = o, KI(o, t, u2, n);
  } else {
    for (a = 0; a < l; a++) for (; Array.isArray(e[a]); ) e[a] = e[a][0];
    for (a = l; a < i; a++) e[a] = n;
  }
}
function DJ(e, t) {
  var r = w_(e), n = r.length;
  if (!Array.isArray(e) || !Array.isArray(t)) throw new TypeError("Array expected");
  if (t.length === 0) throw new _o(0, n, "!=");
  t = __(t, n);
  var a = CJ(t);
  if (n !== a) throw new _o(a, n, "!=");
  try {
    return Uat(r, t);
  } catch (o) {
    throw o instanceof _o ? new _o(a, n, "!=") : o;
  }
}
function __(e, t) {
  var r = CJ(e), n = e.slice(), a = -1, o = e.indexOf(a), s = e.indexOf(a, o + 1) >= 0;
  if (s) throw new Error("More than one wildcard in sizes");
  var i = o >= 0, l = t % r === 0;
  if (i) if (l) n[o] = -t / r;
  else throw new Error("Could not replace wildcard, since " + t + " is no multiple of " + -r);
  return n;
}
function CJ(e) {
  return e.reduce((t, r) => t * r, 1);
}
function Uat(e, t) {
  for (var r = e, n, a = t.length - 1; a > 0; a--) {
    var o = t[a];
    n = [];
    for (var s = r.length / o, i = 0; i < s; i++) n.push(r.slice(i * o, (i + 1) * o));
    r = n;
  }
  return r;
}
function sA(e, t, r, n) {
  var a = n || vc(e);
  if (r) for (var o = 0; o < r; o++) e = [e], a.unshift(1);
  for (e = MJ(e, t, 0); a.length < t; ) a.push(1);
  return e;
}
function MJ(e, t, r) {
  var n, a;
  if (Array.isArray(e)) {
    var o = r + 1;
    for (n = 0, a = e.length; n < a; n++) e[n] = MJ(e[n], t, o);
  } else for (var s = r; s < t; s++) e = [e];
  return e;
}
function w_(e) {
  if (!Array.isArray(e)) return e;
  var t = [];
  return e.forEach(function r(n) {
    Array.isArray(n) ? n.forEach(r) : t.push(n);
  }), t;
}
function xx(e, t) {
  for (var r, n = 0, a = 0; a < e.length; a++) {
    var o = e[a], s = Array.isArray(o);
    if (a === 0 && s && (n = o.length), s && o.length !== n) return;
    var i = s ? xx(o, t) : t(o);
    if (r === void 0) r = i;
    else if (r !== i) return "mixed";
  }
  return r;
}
function ia(e, t, r, n) {
  function a(o) {
    var s = fJ(o, t.map(Wat));
    return Vat(e, t, o), r(s);
  }
  return a.isFactory = true, a.fn = e, a.dependencies = t.slice().sort(), n && (a.meta = n), a;
}
function Vat(e, t, r) {
  var n = t.filter((o) => !jat(o)).every((o) => r[o] !== void 0);
  if (!n) {
    var a = t.filter((o) => r[o] === void 0);
    throw new Error('Cannot create function "'.concat(e, '", ') + "some dependencies are missing: ".concat(a.map((o) => '"'.concat(o, '"')).join(", "), "."));
  }
}
function jat(e) {
  return e && e[0] === "?";
}
function Wat(e) {
  return e && e[0] === "?" ? e.slice(1) : e;
}
function IJ(e, t) {
  if (PJ(e) && OJ(e, t)) return e[t];
  throw typeof e[t] == "function" && Gat(e, t) ? new Error('Cannot access method "' + t + '" as a property') : new Error('No access to property "' + t + '"');
}
function NJ(e, t, r) {
  if (PJ(e) && OJ(e, t)) return e[t] = r, r;
  throw new Error('No access to property "' + t + '"');
}
function FJ(e, t) {
  return t in e;
}
function OJ(e, t) {
  return !e || typeof e != "object" ? false : gx($at, t) ? true : !(t in Object.prototype || t in Function.prototype);
}
function Gat(e, t) {
  return e == null || typeof e[t] != "function" || gx(e, t) && Object.getPrototypeOf && t in Object.getPrototypeOf(e) ? false : gx(Hat, t) ? true : !(t in Object.prototype || t in Function.prototype);
}
function PJ(e) {
  return typeof e == "object" && e && e.constructor === Object;
}
var $at = { length: true, name: true };
var Hat = { toString: true, valueOf: true, toLocaleString: true };
var ZI = class {
  constructor(t) {
    this.wrappedObject = t;
  }
  keys() {
    return Object.keys(this.wrappedObject);
  }
  get(t) {
    return IJ(this.wrappedObject, t);
  }
  set(t, r) {
    return NJ(this.wrappedObject, t, r), this;
  }
  has(t) {
    return FJ(this.wrappedObject, t);
  }
};
function LJ(e) {
  return e ? e instanceof Map || e instanceof ZI || typeof e.set == "function" && typeof e.get == "function" && typeof e.keys == "function" && typeof e.has == "function" : false;
}
var RJ = function() {
  return RJ = eN.default.create, eN.default;
};
var qat = ["?BigNumber", "?Complex", "?DenseMatrix", "?Fraction"];
var tN = ia("typed", qat, function(t) {
  var { BigNumber: r, Complex: n, DenseMatrix: a, Fraction: o } = t, s = RJ();
  return s.types = [{ name: "number", test: Hs }, { name: "Complex", test: nA }, { name: "BigNumber", test: uu }, { name: "Fraction", test: aA }, { name: "Unit", test: y_ }, { name: "string", test: jh }, { name: "Chain", test: GI }, { name: "Array", test: Tl }, { name: "Matrix", test: ts }, { name: "DenseMatrix", test: jZ }, { name: "SparseMatrix", test: WZ }, { name: "Range", test: UI }, { name: "Index", test: Bg }, { name: "boolean", test: GZ }, { name: "ResultSet", test: VI }, { name: "Help", test: jI }, { name: "function", test: $Z }, { name: "Date", test: HZ }, { name: "RegExp", test: qZ }, { name: "null", test: KZ }, { name: "undefined", test: YZ }, { name: "AccessorNode", test: ZZ }, { name: "ArrayNode", test: JZ }, { name: "AssignmentNode", test: QZ }, { name: "BlockNode", test: eJ }, { name: "ConditionalNode", test: tJ }, { name: "ConstantNode", test: rJ }, { name: "FunctionNode", test: aJ }, { name: "FunctionAssignmentNode", test: nJ }, { name: "IndexNode", test: iJ }, { name: "Node", test: WI }, { name: "ObjectNode", test: oJ }, { name: "OperatorNode", test: sJ }, { name: "ParenthesisNode", test: lJ }, { name: "RangeNode", test: uJ }, { name: "SymbolNode", test: cJ }, { name: "Map", test: LJ }, { name: "Object", test: XZ }], s.conversions = [{ from: "number", to: "BigNumber", convert: function(l) {
    if (r || JI(l), kJ(l) > 15) throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: " + l + "). Use function bignumber(x) to convert to BigNumber.");
    return new r(l);
  } }, { from: "number", to: "Complex", convert: function(l) {
    return n || lA(l), new n(l, 0);
  } }, { from: "number", to: "string", convert: function(l) {
    return l + "";
  } }, { from: "BigNumber", to: "Complex", convert: function(l) {
    return n || lA(l), new n(l.toNumber(), 0);
  } }, { from: "Fraction", to: "BigNumber", convert: function(l) {
    throw new TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.");
  } }, { from: "Fraction", to: "Complex", convert: function(l) {
    return n || lA(l), new n(l.valueOf(), 0);
  } }, { from: "number", to: "Fraction", convert: function(l) {
    o || QI(l);
    var u2 = new o(l);
    if (u2.valueOf() !== l) throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: " + l + "). Use function fraction(x) to convert to Fraction.");
    return u2;
  } }, { from: "string", to: "number", convert: function(l) {
    var u2 = Number(l);
    if (isNaN(u2)) throw new Error('Cannot convert "' + l + '" to a number');
    return u2;
  } }, { from: "string", to: "BigNumber", convert: function(l) {
    r || JI(l);
    try {
      return new r(l);
    } catch {
      throw new Error('Cannot convert "' + l + '" to BigNumber');
    }
  } }, { from: "string", to: "Fraction", convert: function(l) {
    o || QI(l);
    try {
      return new o(l);
    } catch {
      throw new Error('Cannot convert "' + l + '" to Fraction');
    }
  } }, { from: "string", to: "Complex", convert: function(l) {
    n || lA(l);
    try {
      return new n(l);
    } catch {
      throw new Error('Cannot convert "' + l + '" to Complex');
    }
  } }, { from: "boolean", to: "number", convert: function(l) {
    return +l;
  } }, { from: "boolean", to: "BigNumber", convert: function(l) {
    return r || JI(l), new r(+l);
  } }, { from: "boolean", to: "Fraction", convert: function(l) {
    return o || QI(l), new o(+l);
  } }, { from: "boolean", to: "string", convert: function(l) {
    return String(l);
  } }, { from: "Array", to: "Matrix", convert: function(l) {
    return a || Xat(), new a(l);
  } }, { from: "Matrix", to: "Array", convert: function(l) {
    return l.valueOf();
  } }], s;
});
function JI(e) {
  throw new Error("Cannot convert value ".concat(e, " into a BigNumber: no class 'BigNumber' provided"));
}
function lA(e) {
  throw new Error("Cannot convert value ".concat(e, " into a Complex number: no class 'Complex' provided"));
}
function Xat() {
  throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided");
}
function QI(e) {
  throw new Error("Cannot convert value ".concat(e, " into a Fraction, no class 'Fraction' provided."));
}
var rN = km(BJ(), 1);
var Kat = "BigNumber";
var Yat = ["?on", "config"];
var nN = ia(Kat, Yat, (e) => {
  var { on: t, config: r } = e, n = rN.default.clone({ precision: r.precision, modulo: rN.default.EUCLID });
  return n.prototype = Object.create(n.prototype), n.prototype.type = "BigNumber", n.prototype.isBigNumber = true, n.prototype.toJSON = function() {
    return { mathjs: "BigNumber", value: this.toString() };
  }, n.fromJSON = function(a) {
    return new n(a.value);
  }, t && t("config", function(a, o) {
    a.precision !== o.precision && n.config({ precision: a.precision });
  }), n;
}, { isClass: true });
var Wf = km(VJ(), 1);
var Zat = "Complex";
var Jat = [];
var iN = ia(Zat, Jat, () => (Wf.default.prototype.type = "Complex", Wf.default.prototype.isComplex = true, Wf.default.prototype.toJSON = function() {
  return { mathjs: "Complex", re: this.re, im: this.im };
}, Wf.default.prototype.toPolar = function() {
  return { r: this.abs(), phi: this.arg() };
}, Wf.default.prototype.format = function(e) {
  var t = "", r = this.im, n = this.re, a = x_(this.re, e), o = x_(this.im, e), s = Hs(e) ? e : e ? e.precision : null;
  if (s !== null) {
    var i = Math.pow(10, -s);
    Math.abs(n / r) < i && (n = 0), Math.abs(r / n) < i && (r = 0);
  }
  return r === 0 ? t = a : n === 0 ? r === 1 ? t = "i" : r === -1 ? t = "-i" : t = o + "i" : r < 0 ? r === -1 ? t = a + " - i" : t = a + " - " + o.substring(1) + "i" : r === 1 ? t = a + " + i" : t = a + " + " + o + "i", t;
}, Wf.default.fromPolar = function(e) {
  switch (arguments.length) {
    case 1: {
      var t = arguments[0];
      if (typeof t == "object") return (0, Wf.default)(t);
      throw new TypeError("Input has to be an object with r and phi keys.");
    }
    case 2: {
      var r = arguments[0], n = arguments[1];
      if (Hs(r)) {
        if (y_(n) && n.hasBase("ANGLE") && (n = n.toNumber("rad")), Hs(n)) return new Wf.default({ r, phi: n });
        throw new TypeError("Phi is not a number nor an angle unit.");
      } else throw new TypeError("Radius r is not a number.");
    }
    default:
      throw new SyntaxError("Wrong number of arguments in function fromPolar");
  }
}, Wf.default.prototype.valueOf = Wf.default.prototype.toString, Wf.default.fromJSON = function(e) {
  return new Wf.default(e);
}, Wf.default.compare = function(e, t) {
  return e.re > t.re ? 1 : e.re < t.re ? -1 : e.im > t.im ? 1 : e.im < t.im ? -1 : 0;
}, Wf.default), { isClass: true });
var Ug = km(WJ(), 1);
var Qat = "Fraction";
var eit = [];
var sN = ia(Qat, eit, () => (Ug.default.prototype.type = "Fraction", Ug.default.prototype.isFraction = true, Ug.default.prototype.toJSON = function() {
  return { mathjs: "Fraction", n: this.s * this.n, d: this.d };
}, Ug.default.fromJSON = function(e) {
  return new Ug.default(e);
}, Ug.default), { isClass: true });
var tit = "Matrix";
var rit = [];
var lN = ia(tit, rit, () => {
  function e() {
    if (!(this instanceof e)) throw new SyntaxError("Constructor must be called with the new operator");
  }
  return e.prototype.type = "Matrix", e.prototype.isMatrix = true, e.prototype.storage = function() {
    throw new Error("Cannot invoke storage on a Matrix interface");
  }, e.prototype.datatype = function() {
    throw new Error("Cannot invoke datatype on a Matrix interface");
  }, e.prototype.create = function(t, r) {
    throw new Error("Cannot invoke create on a Matrix interface");
  }, e.prototype.subset = function(t, r, n) {
    throw new Error("Cannot invoke subset on a Matrix interface");
  }, e.prototype.get = function(t) {
    throw new Error("Cannot invoke get on a Matrix interface");
  }, e.prototype.set = function(t, r, n) {
    throw new Error("Cannot invoke set on a Matrix interface");
  }, e.prototype.resize = function(t, r) {
    throw new Error("Cannot invoke resize on a Matrix interface");
  }, e.prototype.reshape = function(t, r) {
    throw new Error("Cannot invoke reshape on a Matrix interface");
  }, e.prototype.clone = function() {
    throw new Error("Cannot invoke clone on a Matrix interface");
  }, e.prototype.size = function() {
    throw new Error("Cannot invoke size on a Matrix interface");
  }, e.prototype.map = function(t, r) {
    throw new Error("Cannot invoke map on a Matrix interface");
  }, e.prototype.forEach = function(t) {
    throw new Error("Cannot invoke forEach on a Matrix interface");
  }, e.prototype[Symbol.iterator] = function() {
    throw new Error("Cannot iterate a Matrix interface");
  }, e.prototype.toArray = function() {
    throw new Error("Cannot invoke toArray on a Matrix interface");
  }, e.prototype.valueOf = function() {
    throw new Error("Cannot invoke valueOf on a Matrix interface");
  }, e.prototype.format = function(t) {
    throw new Error("Cannot invoke format on a Matrix interface");
  }, e.prototype.toString = function() {
    throw new Error("Cannot invoke toString on a Matrix interface");
  }, e;
}, { isClass: true });
var nit = "DenseMatrix";
var ait = ["Matrix"];
var uN = ia(nit, ait, (e) => {
  var { Matrix: t } = e;
  function r(c, f) {
    if (!(this instanceof r)) throw new SyntaxError("Constructor must be called with the new operator");
    if (f && !jh(f)) throw new Error("Invalid datatype: " + f);
    if (ts(c)) c.type === "DenseMatrix" ? (this._data = tl(c._data), this._size = tl(c._size), this._datatype = f || c._datatype) : (this._data = c.toArray(), this._size = c.size(), this._datatype = f || c._datatype);
    else if (c && Tl(c.data) && Tl(c.size)) this._data = c.data, this._size = c.size, YI(this._data, this._size), this._datatype = f || c.datatype;
    else if (Tl(c)) this._data = u2(c), this._size = vc(this._data), YI(this._data, this._size), this._datatype = f;
    else {
      if (c) throw new TypeError("Unsupported type of data (" + hf(c) + ")");
      this._data = [], this._size = [0], this._datatype = f;
    }
  }
  r.prototype = new t(), r.prototype.createDenseMatrix = function(c, f) {
    return new r(c, f);
  }, r.prototype.type = "DenseMatrix", r.prototype.isDenseMatrix = true, r.prototype.getDataType = function() {
    return xx(this._data, hf);
  }, r.prototype.storage = function() {
    return "dense";
  }, r.prototype.datatype = function() {
    return this._datatype;
  }, r.prototype.create = function(c, f) {
    return new r(c, f);
  }, r.prototype.subset = function(c, f, h) {
    switch (arguments.length) {
      case 1:
        return n(this, c);
      case 2:
      case 3:
        return o(this, c, f, h);
      default:
        throw new SyntaxError("Wrong number of arguments");
    }
  }, r.prototype.get = function(c) {
    if (!Tl(c)) throw new TypeError("Array expected");
    if (c.length !== this._size.length) throw new _o(c.length, this._size.length);
    for (var f = 0; f < c.length; f++) du(c[f], this._size[f]);
    for (var h = this._data, p = 0, d = c.length; p < d; p++) {
      var v = c[p];
      du(v, h.length), h = h[v];
    }
    return h;
  }, r.prototype.set = function(c, f, h) {
    if (!Tl(c)) throw new TypeError("Array expected");
    if (c.length < this._size.length) throw new _o(c.length, this._size.length, "<");
    var p, d, v, m = c.map(function(x) {
      return x + 1;
    });
    l(this, m, h);
    var g = this._data;
    for (p = 0, d = c.length - 1; p < d; p++) v = c[p], du(v, g.length), g = g[v];
    return v = c[c.length - 1], du(v, g.length), g[v] = f, this;
  };
  function n(c, f) {
    if (!Bg(f)) throw new TypeError("Invalid index");
    var h = f.isScalar();
    if (h) return c.get(f.min());
    var p = f.size();
    if (p.length !== c._size.length) throw new _o(p.length, c._size.length);
    for (var d = f.min(), v = f.max(), m = 0, g = c._size.length; m < g; m++) du(d[m], c._size[m]), du(v[m], c._size[m]);
    return new r(a(c._data, f, p.length, 0), c._datatype);
  }
  function a(c, f, h, p) {
    var d = p === h - 1, v = f.dimension(p);
    return d ? v.map(function(m) {
      return du(m, c.length), c[m];
    }).valueOf() : v.map(function(m) {
      du(m, c.length);
      var g = c[m];
      return a(g, f, h, p + 1);
    }).valueOf();
  }
  function o(c, f, h, p) {
    if (!f || f.isIndex !== true) throw new TypeError("Invalid index");
    var d = f.size(), v = f.isScalar(), m;
    if (ts(h) ? (m = h.size(), h = h.valueOf()) : m = vc(h), v) {
      if (m.length !== 0) throw new TypeError("Scalar expected");
      c.set(f.min(), h, p);
    } else {
      if (d.length < c._size.length) throw new _o(d.length, c._size.length, "<");
      if (m.length < d.length) {
        for (var g = 0, x = 0; d[g] === 1 && m[g] === 1; ) g++;
        for (; d[g] === 1; ) x++, g++;
        h = sA(h, d.length, x, m);
      }
      if (!vx(d, m)) throw new _o(d, m, ">");
      var b = f.max().map(function(_4) {
        return _4 + 1;
      });
      l(c, b, p);
      var y = d.length, w = 0;
      s(c._data, f, h, y, w);
    }
    return c;
  }
  function s(c, f, h, p, d) {
    var v = d === p - 1, m = f.dimension(d);
    v ? m.forEach(function(g, x) {
      du(g), c[g] = h[x[0]];
    }) : m.forEach(function(g, x) {
      du(g), s(c[g], f, h[x[0]], p, d + 1);
    });
  }
  r.prototype.resize = function(c, f, h) {
    if (!dx(c)) throw new TypeError("Array or Matrix expected");
    var p = c.valueOf().map((v) => Array.isArray(v) && v.length === 1 ? v[0] : v), d = h ? this.clone() : this;
    return i(d, p, f);
  };
  function i(c, f, h) {
    if (f.length === 0) {
      for (var p = c._data; Tl(p); ) p = p[0];
      return p;
    }
    return c._size = f.slice(0), c._data = b_(c._data, c._size, h), c;
  }
  r.prototype.reshape = function(c, f) {
    var h = f ? this.clone() : this;
    h._data = DJ(h._data, c);
    var p = h._size.reduce((d, v) => d * v);
    return h._size = __(c, p), h;
  };
  function l(c, f, h) {
    for (var p = c._size.slice(0), d = false; p.length < f.length; ) p.push(0), d = true;
    for (var v = 0, m = f.length; v < m; v++) f[v] > p[v] && (p[v] = f[v], d = true);
    d && i(c, p, h);
  }
  r.prototype.clone = function() {
    var c = new r({ data: tl(this._data), size: tl(this._size), datatype: this._datatype });
    return c;
  }, r.prototype.size = function() {
    return this._size.slice(0);
  }, r.prototype.map = function(c) {
    var f = this, h = function v(m, g) {
      return Tl(m) ? m.map(function(x, b) {
        return v(x, g.concat(b));
      }) : c(m, g, f);
    }, p = h(this._data, []), d = this._datatype !== void 0 ? xx(p, hf) : void 0;
    return new r(p, d);
  }, r.prototype.forEach = function(c) {
    var f = this, h = function p(d, v) {
      Tl(d) ? d.forEach(function(m, g) {
        p(m, v.concat(g));
      }) : c(d, v, f);
    };
    h(this._data, []);
  }, r.prototype[Symbol.iterator] = function* () {
    var c = function* f(h, p) {
      if (Tl(h)) for (var d = 0; d < h.length; d++) yield* f(h[d], p.concat(d));
      else yield { value: h, index: p };
    };
    yield* c(this._data, []);
  }, r.prototype.rows = function() {
    var c = [], f = this.size();
    if (f.length !== 2) throw new TypeError("Rows can only be returned for a 2D matrix.");
    var h = this._data;
    for (var p of h) c.push(new r([p], this._datatype));
    return c;
  }, r.prototype.columns = function() {
    var c = this, f = [], h = this.size();
    if (h.length !== 2) throw new TypeError("Rows can only be returned for a 2D matrix.");
    for (var p = this._data, d = function(g) {
      var x = p.map((b) => [b[g]]);
      f.push(new r(x, c._datatype));
    }, v = 0; v < h[1]; v++) d(v);
    return f;
  }, r.prototype.toArray = function() {
    return tl(this._data);
  }, r.prototype.valueOf = function() {
    return this._data;
  }, r.prototype.format = function(c) {
    return Pl(this._data, c);
  }, r.prototype.toString = function() {
    return Pl(this._data);
  }, r.prototype.toJSON = function() {
    return { mathjs: "DenseMatrix", data: this._data, size: this._size, datatype: this._datatype };
  }, r.prototype.diagonal = function(c) {
    if (c) {
      if (uu(c) && (c = c.toNumber()), !Hs(c) || !Bo(c)) throw new TypeError("The parameter k must be an integer number");
    } else c = 0;
    for (var f = c > 0 ? c : 0, h = c < 0 ? -c : 0, p = this._size[0], d = this._size[1], v = Math.min(p - h, d - f), m = [], g = 0; g < v; g++) m[g] = this._data[g + h][g + f];
    return new r({ data: m, size: [v], datatype: this._datatype });
  }, r.diagonal = function(c, f, h, p) {
    if (!Tl(c)) throw new TypeError("Array expected, size parameter");
    if (c.length !== 2) throw new Error("Only two dimensions matrix are supported");
    if (c = c.map(function(k) {
      if (uu(k) && (k = k.toNumber()), !Hs(k) || !Bo(k) || k < 1) throw new Error("Size values must be positive integers");
      return k;
    }), h) {
      if (uu(h) && (h = h.toNumber()), !Hs(h) || !Bo(h)) throw new TypeError("The parameter k must be an integer number");
    } else h = 0;
    var d = h > 0 ? h : 0, v = h < 0 ? -h : 0, m = c[0], g = c[1], x = Math.min(m - v, g - d), b;
    if (Tl(f)) {
      if (f.length !== x) throw new Error("Invalid value array length");
      b = function(T2) {
        return f[T2];
      };
    } else if (ts(f)) {
      var y = f.size();
      if (y.length !== 1 || y[0] !== x) throw new Error("Invalid matrix length");
      b = function(T2) {
        return f.get([T2]);
      };
    } else b = function() {
      return f;
    };
    p || (p = uu(b(0)) ? b(0).mul(0) : 0);
    var w = [];
    if (c.length > 0) {
      w = b_(w, c, p);
      for (var _4 = 0; _4 < x; _4++) w[_4 + v][_4 + d] = b(_4);
    }
    return new r({ data: w, size: [m, g] });
  }, r.fromJSON = function(c) {
    return new r(c);
  }, r.prototype.swapRows = function(c, f) {
    if (!Hs(c) || !Bo(c) || !Hs(f) || !Bo(f)) throw new Error("Row index must be positive integers");
    if (this._size.length !== 2) throw new Error("Only two dimensional matrix is supported");
    return du(c, this._size[0]), du(f, this._size[0]), r._swapRows(c, f, this._data), this;
  }, r._swapRows = function(c, f, h) {
    var p = h[c];
    h[c] = h[f], h[f] = p;
  };
  function u2(c) {
    for (var f = 0, h = c.length; f < h; f++) {
      var p = c[f];
      Tl(p) ? c[f] = u2(p) : p && p.isMatrix === true && (c[f] = u2(p.valueOf()));
    }
    return c;
  }
  return r;
}, { isClass: true });
function fA(e) {
  for (var t = 0; t < e.length; t++) if (dx(e[t])) return true;
  return false;
}
function bx(e, t) {
  ts(e) && (e = e.valueOf());
  for (var r = 0, n = e.length; r < n; r++) {
    var a = e[r];
    Array.isArray(a) ? bx(a, t) : t(a);
  }
}
function Nu(e, t, r) {
  return e && typeof e.map == "function" ? e.map(function(n) {
    return Nu(n, t, r);
  }) : t(e);
}
function GJ(e, t, r) {
  var n = Array.isArray(e) ? vc(e) : e.size();
  if (t < 0 || t >= n.length) throw new xd(t, n.length);
  return ts(e) ? e.create(cA(e.valueOf(), t, r)) : cA(e, t, r);
}
function cA(e, t, r) {
  var n, a, o, s;
  if (t <= 0) if (Array.isArray(e[0])) {
    for (s = iit(e), a = [], n = 0; n < s.length; n++) a[n] = cA(s[n], t - 1, r);
    return a;
  } else {
    for (o = e[0], n = 1; n < e.length; n++) o = r(o, e[n]);
    return o;
  }
  else {
    for (a = [], n = 0; n < e.length; n++) a[n] = cA(e[n], t - 1, r);
    return a;
  }
}
function iit(e) {
  var t = e.length, r = e[0].length, n, a, o = [];
  for (a = 0; a < r; a++) {
    var s = [];
    for (n = 0; n < t; n++) s.push(e[n][a]);
    o.push(s);
  }
  return o;
}
var $J = "isInteger";
var oit = ["typed"];
var cN = ia($J, oit, (e) => {
  var { typed: t } = e;
  return t($J, { number: Bo, BigNumber: function(n) {
    return n.isInt();
  }, Fraction: function(n) {
    return n.d === 1 && isFinite(n.n);
  }, "Array | Matrix": function(n) {
    return Nu(n, this);
  } });
});
var Mc = "number";
var bd = "number, number";
function fN(e) {
  return Math.abs(e);
}
fN.signature = Mc;
function hN(e, t) {
  return e + t;
}
hN.signature = bd;
function sit(e, t) {
  return e - t;
}
sit.signature = bd;
function pN(e, t) {
  return e * t;
}
pN.signature = bd;
function lit(e, t) {
  return e / t;
}
lit.signature = bd;
function dN(e) {
  return -e;
}
dN.signature = Mc;
function uit(e) {
  return e;
}
uit.signature = Mc;
function cit(e) {
  return bJ(e);
}
cit.signature = Mc;
function fit(e) {
  return Math.ceil(e);
}
fit.signature = Mc;
function hit(e) {
  return e * e * e;
}
hit.signature = Mc;
function pit(e) {
  return Math.exp(e);
}
pit.signature = Mc;
function dit(e) {
  return _J(e);
}
dit.signature = Mc;
function vit(e) {
  return e > 0 ? Math.floor(e) : Math.ceil(e);
}
vit.signature = Mc;
function mit(e) {
  return Math.floor(e);
}
mit.signature = Mc;
function git(e, t) {
  if (!Bo(e) || !Bo(t)) throw new Error("Parameters in function gcd must be integer numbers");
  for (var r; t !== 0; ) r = e % t, e = t, t = r;
  return e < 0 ? -e : e;
}
git.signature = bd;
function yit(e, t) {
  if (!Bo(e) || !Bo(t)) throw new Error("Parameters in function lcm must be integer numbers");
  if (e === 0 || t === 0) return 0;
  for (var r, n = e * t; t !== 0; ) r = t, t = e % r, e = r;
  return Math.abs(n / e);
}
yit.signature = bd;
function xit(e) {
  return Math.log(e);
}
xit.signature = Mc;
function bit(e) {
  return yJ(e);
}
bit.signature = Mc;
function _it(e) {
  return gJ(e);
}
_it.signature = Mc;
function wit(e) {
  return xJ(e);
}
wit.signature = Mc;
function kit(e, t) {
  if (t > 0) return e - t * Math.floor(e / t);
  if (t === 0) return e;
  throw new Error("Cannot calculate mod for a negative divisor");
}
kit.signature = bd;
function Tit(e, t) {
  var r = t < 0;
  if (r && (t = -t), t === 0) throw new Error("Root must be non-zero");
  if (e < 0 && Math.abs(t) % 2 !== 1) throw new Error("Root must be odd when a is negative.");
  if (e === 0) return r ? 1 / 0 : 0;
  if (!isFinite(e)) return r ? 0 : e;
  var n = Math.pow(Math.abs(e), 1 / t);
  return n = e < 0 ? -n : n, r ? 1 / n : n;
}
Tit.signature = bd;
function Ait(e) {
  return mJ(e);
}
Ait.signature = Mc;
function Sit(e) {
  return Math.sqrt(e);
}
Sit.signature = Mc;
function Eit(e) {
  return e * e;
}
Eit.signature = Mc;
function Dit(e, t) {
  var r, n, a, o = 0, s = 1, i = 1, l = 0;
  if (!Bo(e) || !Bo(t)) throw new Error("Parameters in function xgcd must be integer numbers");
  for (; t; ) n = Math.floor(e / t), a = e - n * t, r = o, o = s - n * o, s = r, r = i, i = l - n * i, l = r, e = t, t = a;
  var u2;
  return e < 0 ? u2 = [-e, -s, -l] : u2 = [e, e ? s : 0, l], u2;
}
Dit.signature = bd;
function Cit(e, t) {
  return e * e < 1 && t === 1 / 0 || e * e > 1 && t === -1 / 0 ? 0 : Math.pow(e, t);
}
Cit.signature = bd;
function Mit(e) {
  var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
  return parseFloat(qI(e, t));
}
Mit.signature = bd;
function Iit(e) {
  return Math.abs(e);
}
Iit.signature = Mc;
var k_ = "number";
function Nit(e) {
  return Bo(e);
}
Nit.signature = k_;
function Fit(e) {
  return e < 0;
}
Fit.signature = k_;
function Oit(e) {
  return e > 0;
}
Oit.signature = k_;
function Pit(e) {
  return e === 0;
}
Pit.signature = k_;
function vN(e) {
  return Number.isNaN(e);
}
vN.signature = k_;
var HJ = "isNumeric";
var Lit = ["typed"];
var mN = ia(HJ, Lit, (e) => {
  var { typed: t } = e;
  return t(HJ, { "number | BigNumber | Fraction | boolean": function() {
    return true;
  }, "Complex | Unit | string | null | undefined | Node": function() {
    return false;
  }, "Array | Matrix": function(n) {
    return Nu(n, this);
  } });
});
var qJ = "isNaN";
var Rit = ["typed"];
var gN = ia(qJ, Rit, (e) => {
  var { typed: t } = e;
  return t(qJ, { number: vN, BigNumber: function(n) {
    return n.isNaN();
  }, Fraction: function(n) {
    return false;
  }, Complex: function(n) {
    return n.isNaN();
  }, Unit: function(n) {
    return Number.isNaN(n.value);
  }, "Array | Matrix": function(n) {
    return Nu(n, Number.isNaN);
  } });
});
function Hv(e, t, r) {
  if (r == null) return e.eq(t);
  if (e.eq(t)) return true;
  if (e.isNaN() || t.isNaN()) return false;
  if (e.isFinite() && t.isFinite()) {
    var n = e.minus(t).abs();
    if (n.isZero()) return true;
    var a = e.constructor.max(e.abs(), t.abs());
    return n.lte(a.times(r));
  }
  return false;
}
function XJ(e, t, r) {
  return wp(e.re, t.re, r) && wp(e.im, t.im, r);
}
var hA = "equalScalar";
var zit = ["typed", "config"];
var yN = ia(hA, zit, (e) => {
  var { typed: t, config: r } = e;
  return t(hA, { "boolean, boolean": function(a, o) {
    return a === o;
  }, "number, number": function(a, o) {
    return wp(a, o, r.epsilon);
  }, "BigNumber, BigNumber": function(a, o) {
    return a.eq(o) || Hv(a, o, r.epsilon);
  }, "Fraction, Fraction": function(a, o) {
    return a.equals(o);
  }, "Complex, Complex": function(a, o) {
    return XJ(a, o, r.epsilon);
  }, "Unit, Unit": function(a, o) {
    if (!a.equalBase(o)) throw new Error("Cannot compare units with different base");
    return this(a.value, o.value);
  } });
});
var cTt = ia(hA, ["typed", "config"], (e) => {
  var { typed: t, config: r } = e;
  return t(hA, { "number, number": function(a, o) {
    return wp(a, o, r.epsilon);
  } });
});
var Bit = "SparseMatrix";
var Uit = ["typed", "equalScalar", "Matrix"];
var xN = ia(Bit, Uit, (e) => {
  var { typed: t, equalScalar: r, Matrix: n } = e;
  function a(v, m) {
    if (!(this instanceof a)) throw new SyntaxError("Constructor must be called with the new operator");
    if (m && !jh(m)) throw new Error("Invalid datatype: " + m);
    if (ts(v)) o(this, v, m);
    else if (v && Tl(v.index) && Tl(v.ptr) && Tl(v.size)) this._values = v.values, this._index = v.index, this._ptr = v.ptr, this._size = v.size, this._datatype = m || v.datatype;
    else if (Tl(v)) s(this, v, m);
    else {
      if (v) throw new TypeError("Unsupported type of data (" + hf(v) + ")");
      this._values = [], this._index = [], this._ptr = [0], this._size = [0, 0], this._datatype = m;
    }
  }
  function o(v, m, g) {
    m.type === "SparseMatrix" ? (v._values = m._values ? tl(m._values) : void 0, v._index = tl(m._index), v._ptr = tl(m._ptr), v._size = tl(m._size), v._datatype = g || m._datatype) : s(v, m.valueOf(), g || m._datatype);
  }
  function s(v, m, g) {
    v._values = [], v._index = [], v._ptr = [], v._datatype = g;
    var x = m.length, b = 0, y = r, w = 0;
    if (jh(g) && (y = t.find(r, [g, g]) || r, w = t.convert(0, g)), x > 0) {
      var _4 = 0;
      do {
        v._ptr.push(v._index.length);
        for (var k = 0; k < x; k++) {
          var T2 = m[k];
          if (Tl(T2)) {
            if (_4 === 0 && b < T2.length && (b = T2.length), _4 < T2.length) {
              var A2 = T2[_4];
              y(A2, w) || (v._values.push(A2), v._index.push(k));
            }
          } else _4 === 0 && b < 1 && (b = 1), y(T2, w) || (v._values.push(T2), v._index.push(k));
        }
        _4++;
      } while (_4 < b);
    }
    v._ptr.push(v._index.length), v._size = [x, b];
  }
  a.prototype = new n(), a.prototype.createSparseMatrix = function(v, m) {
    return new a(v, m);
  }, a.prototype.type = "SparseMatrix", a.prototype.isSparseMatrix = true, a.prototype.getDataType = function() {
    return xx(this._values, hf);
  }, a.prototype.storage = function() {
    return "sparse";
  }, a.prototype.datatype = function() {
    return this._datatype;
  }, a.prototype.create = function(v, m) {
    return new a(v, m);
  }, a.prototype.density = function() {
    var v = this._size[0], m = this._size[1];
    return v !== 0 && m !== 0 ? this._index.length / (v * m) : 0;
  }, a.prototype.subset = function(v, m, g) {
    if (!this._values) throw new Error("Cannot invoke subset on a Pattern only matrix");
    switch (arguments.length) {
      case 1:
        return i(this, v);
      case 2:
      case 3:
        return l(this, v, m, g);
      default:
        throw new SyntaxError("Wrong number of arguments");
    }
  };
  function i(v, m) {
    if (!Bg(m)) throw new TypeError("Invalid index");
    var g = m.isScalar();
    if (g) return v.get(m.min());
    var x = m.size();
    if (x.length !== v._size.length) throw new _o(x.length, v._size.length);
    var b, y, w, _4, k = m.min(), T2 = m.max();
    for (b = 0, y = v._size.length; b < y; b++) du(k[b], v._size[b]), du(T2[b], v._size[b]);
    var A2 = v._values, S2 = v._index, C2 = v._ptr, E2 = m.dimension(0), F13 = m.dimension(1), N2 = [], D2 = [];
    E2.forEach(function(V2, W2) {
      D2[V2] = W2[0], N2[V2] = true;
    });
    var I2 = A2 ? [] : void 0, O2 = [], L2 = [];
    return F13.forEach(function(V2) {
      for (L2.push(O2.length), w = C2[V2], _4 = C2[V2 + 1]; w < _4; w++) b = S2[w], N2[b] === true && (O2.push(D2[b]), I2 && I2.push(A2[w]));
    }), L2.push(O2.length), new a({ values: I2, index: O2, ptr: L2, size: x, datatype: v._datatype });
  }
  function l(v, m, g, x) {
    if (!m || m.isIndex !== true) throw new TypeError("Invalid index");
    var b = m.size(), y = m.isScalar(), w;
    if (ts(g) ? (w = g.size(), g = g.toArray()) : w = vc(g), y) {
      if (w.length !== 0) throw new TypeError("Scalar expected");
      v.set(m.min(), g, x);
    } else {
      if (b.length !== 1 && b.length !== 2) throw new _o(b.length, v._size.length, "<");
      if (w.length < b.length) {
        for (var _4 = 0, k = 0; b[_4] === 1 && w[_4] === 1; ) _4++;
        for (; b[_4] === 1; ) k++, _4++;
        g = sA(g, b.length, k, w);
      }
      if (!vx(b, w)) throw new _o(b, w, ">");
      for (var T2 = m.min()[0], A2 = m.min()[1], S2 = w[0], C2 = w[1], E2 = 0; E2 < S2; E2++) for (var F13 = 0; F13 < C2; F13++) {
        var N2 = g[E2][F13];
        v.set([E2 + T2, F13 + A2], N2, x);
      }
    }
    return v;
  }
  a.prototype.get = function(v) {
    if (!Tl(v)) throw new TypeError("Array expected");
    if (v.length !== this._size.length) throw new _o(v.length, this._size.length);
    if (!this._values) throw new Error("Cannot invoke get on a Pattern only matrix");
    var m = v[0], g = v[1];
    du(m, this._size[0]), du(g, this._size[1]);
    var x = u2(m, this._ptr[g], this._ptr[g + 1], this._index);
    return x < this._ptr[g + 1] && this._index[x] === m ? this._values[x] : 0;
  }, a.prototype.set = function(v, m, g) {
    if (!Tl(v)) throw new TypeError("Array expected");
    if (v.length !== this._size.length) throw new _o(v.length, this._size.length);
    if (!this._values) throw new Error("Cannot invoke set on a Pattern only matrix");
    var x = v[0], b = v[1], y = this._size[0], w = this._size[1], _4 = r, k = 0;
    jh(this._datatype) && (_4 = t.find(r, [this._datatype, this._datatype]) || r, k = t.convert(0, this._datatype)), (x > y - 1 || b > w - 1) && (h(this, Math.max(x + 1, y), Math.max(b + 1, w), g), y = this._size[0], w = this._size[1]), du(x, y), du(b, w);
    var T2 = u2(x, this._ptr[b], this._ptr[b + 1], this._index);
    return T2 < this._ptr[b + 1] && this._index[T2] === x ? _4(m, k) ? c(T2, b, this._values, this._index, this._ptr) : this._values[T2] = m : f(T2, x, b, m, this._values, this._index, this._ptr), this;
  };
  function u2(v, m, g, x) {
    if (g - m === 0) return g;
    for (var b = m; b < g; b++) if (x[b] === v) return b;
    return m;
  }
  function c(v, m, g, x, b) {
    g.splice(v, 1), x.splice(v, 1);
    for (var y = m + 1; y < b.length; y++) b[y]--;
  }
  function f(v, m, g, x, b, y, w) {
    b.splice(v, 0, x), y.splice(v, 0, m);
    for (var _4 = g + 1; _4 < w.length; _4++) w[_4]++;
  }
  a.prototype.resize = function(v, m, g) {
    if (!dx(v)) throw new TypeError("Array or Matrix expected");
    var x = v.valueOf().map((y) => Array.isArray(y) && y.length === 1 ? y[0] : y);
    if (x.length !== 2) throw new Error("Only two dimensions matrix are supported");
    x.forEach(function(y) {
      if (!Hs(y) || !Bo(y) || y < 0) throw new TypeError("Invalid size, must contain positive integers (size: " + Pl(x) + ")");
    });
    var b = g ? this.clone() : this;
    return h(b, x[0], x[1], m);
  };
  function h(v, m, g, x) {
    var b = x || 0, y = r, w = 0;
    jh(v._datatype) && (y = t.find(r, [v._datatype, v._datatype]) || r, w = t.convert(0, v._datatype), b = t.convert(b, v._datatype));
    var _4 = !y(b, w), k = v._size[0], T2 = v._size[1], A2, S2, C2;
    if (g > T2) {
      for (S2 = T2; S2 < g; S2++) if (v._ptr[S2] = v._values.length, _4) for (A2 = 0; A2 < k; A2++) v._values.push(b), v._index.push(A2);
      v._ptr[g] = v._values.length;
    } else g < T2 && (v._ptr.splice(g + 1, T2 - g), v._values.splice(v._ptr[g], v._values.length), v._index.splice(v._ptr[g], v._index.length));
    if (T2 = g, m > k) {
      if (_4) {
        var E2 = 0;
        for (S2 = 0; S2 < T2; S2++) {
          v._ptr[S2] = v._ptr[S2] + E2, C2 = v._ptr[S2 + 1] + E2;
          var F13 = 0;
          for (A2 = k; A2 < m; A2++, F13++) v._values.splice(C2 + F13, 0, b), v._index.splice(C2 + F13, 0, A2), E2++;
        }
        v._ptr[T2] = v._values.length;
      }
    } else if (m < k) {
      var N2 = 0;
      for (S2 = 0; S2 < T2; S2++) {
        v._ptr[S2] = v._ptr[S2] - N2;
        var D2 = v._ptr[S2], I2 = v._ptr[S2 + 1] - N2;
        for (C2 = D2; C2 < I2; C2++) A2 = v._index[C2], A2 > m - 1 && (v._values.splice(C2, 1), v._index.splice(C2, 1), N2++);
      }
      v._ptr[S2] = v._values.length;
    }
    return v._size[0] = m, v._size[1] = g, v;
  }
  a.prototype.reshape = function(v, m) {
    if (!Tl(v)) throw new TypeError("Array expected");
    if (v.length !== 2) throw new Error("Sparse matrices can only be reshaped in two dimensions");
    v.forEach(function(V2) {
      if (!Hs(V2) || !Bo(V2) || V2 <= -2 || V2 === 0) throw new TypeError("Invalid size, must contain positive integers or -1 (size: " + Pl(v) + ")");
    });
    var g = this._size[0] * this._size[1];
    v = __(v, g);
    var x = v[0] * v[1];
    if (g !== x) throw new Error("Reshaping sparse matrix will result in the wrong number of elements");
    var b = m ? this.clone() : this;
    if (this._size[0] === v[0] && this._size[1] === v[1]) return b;
    for (var y = [], w = 0; w < b._ptr.length; w++) for (var _4 = 0; _4 < b._ptr[w + 1] - b._ptr[w]; _4++) y.push(w);
    for (var k = b._values.slice(), T2 = b._index.slice(), A2 = 0; A2 < b._index.length; A2++) {
      var S2 = T2[A2], C2 = y[A2], E2 = S2 * b._size[1] + C2;
      y[A2] = E2 % v[1], T2[A2] = Math.floor(E2 / v[1]);
    }
    b._values.length = 0, b._index.length = 0, b._ptr.length = v[1] + 1, b._size = v.slice();
    for (var F13 = 0; F13 < b._ptr.length; F13++) b._ptr[F13] = 0;
    for (var N2 = 0; N2 < k.length; N2++) {
      var D2 = T2[N2], I2 = y[N2], O2 = k[N2], L2 = u2(D2, b._ptr[I2], b._ptr[I2 + 1], b._index);
      f(L2, D2, I2, O2, b._values, b._index, b._ptr);
    }
    return b;
  }, a.prototype.clone = function() {
    var v = new a({ values: this._values ? tl(this._values) : void 0, index: tl(this._index), ptr: tl(this._ptr), size: tl(this._size), datatype: this._datatype });
    return v;
  }, a.prototype.size = function() {
    return this._size.slice(0);
  }, a.prototype.map = function(v, m) {
    if (!this._values) throw new Error("Cannot invoke map on a Pattern only matrix");
    var g = this, x = this._size[0], b = this._size[1], y = function(_4, k, T2) {
      return v(_4, [k, T2], g);
    };
    return p(this, 0, x - 1, 0, b - 1, y, m);
  };
  function p(v, m, g, x, b, y, w) {
    var _4 = [], k = [], T2 = [], A2 = r, S2 = 0;
    jh(v._datatype) && (A2 = t.find(r, [v._datatype, v._datatype]) || r, S2 = t.convert(0, v._datatype));
    for (var C2 = function(K2, q, re) {
      K2 = y(K2, q, re), A2(K2, S2) || (_4.push(K2), k.push(q));
    }, E2 = x; E2 <= b; E2++) {
      T2.push(_4.length);
      var F13 = v._ptr[E2], N2 = v._ptr[E2 + 1];
      if (w) for (var D2 = F13; D2 < N2; D2++) {
        var I2 = v._index[D2];
        I2 >= m && I2 <= g && C2(v._values[D2], I2 - m, E2 - x);
      }
      else {
        for (var O2 = {}, L2 = F13; L2 < N2; L2++) {
          var V2 = v._index[L2];
          O2[V2] = v._values[L2];
        }
        for (var W2 = m; W2 <= g; W2++) {
          var X2 = W2 in O2 ? O2[W2] : 0;
          C2(X2, W2 - m, E2 - x);
        }
      }
    }
    return T2.push(_4.length), new a({ values: _4, index: k, ptr: T2, size: [g - m + 1, b - x + 1] });
  }
  a.prototype.forEach = function(v, m) {
    if (!this._values) throw new Error("Cannot invoke forEach on a Pattern only matrix");
    for (var g = this, x = this._size[0], b = this._size[1], y = 0; y < b; y++) {
      var w = this._ptr[y], _4 = this._ptr[y + 1];
      if (m) for (var k = w; k < _4; k++) {
        var T2 = this._index[k];
        v(this._values[k], [T2, y], g);
      }
      else {
        for (var A2 = {}, S2 = w; S2 < _4; S2++) {
          var C2 = this._index[S2];
          A2[C2] = this._values[S2];
        }
        for (var E2 = 0; E2 < x; E2++) {
          var F13 = E2 in A2 ? A2[E2] : 0;
          v(F13, [E2, y], g);
        }
      }
    }
  }, a.prototype[Symbol.iterator] = function* () {
    if (!this._values) throw new Error("Cannot iterate a Pattern only matrix");
    for (var v = this._size[1], m = 0; m < v; m++) for (var g = this._ptr[m], x = this._ptr[m + 1], b = g; b < x; b++) {
      var y = this._index[b];
      yield { value: this._values[b], index: [y, m] };
    }
  }, a.prototype.toArray = function() {
    return d(this._values, this._index, this._ptr, this._size, true);
  }, a.prototype.valueOf = function() {
    return d(this._values, this._index, this._ptr, this._size, false);
  };
  function d(v, m, g, x, b) {
    var y = x[0], w = x[1], _4 = [], k, T2;
    for (k = 0; k < y; k++) for (_4[k] = [], T2 = 0; T2 < w; T2++) _4[k][T2] = 0;
    for (T2 = 0; T2 < w; T2++) for (var A2 = g[T2], S2 = g[T2 + 1], C2 = A2; C2 < S2; C2++) k = m[C2], _4[k][T2] = v ? b ? tl(v[C2]) : v[C2] : 1;
    return _4;
  }
  return a.prototype.format = function(v) {
    for (var m = this._size[0], g = this._size[1], x = this.density(), b = "Sparse Matrix [" + Pl(m, v) + " x " + Pl(g, v) + "] density: " + Pl(x, v) + `
`, y = 0; y < g; y++) for (var w = this._ptr[y], _4 = this._ptr[y + 1], k = w; k < _4; k++) {
      var T2 = this._index[k];
      b += `
    (` + Pl(T2, v) + ", " + Pl(y, v) + ") ==> " + (this._values ? Pl(this._values[k], v) : "X");
    }
    return b;
  }, a.prototype.toString = function() {
    return Pl(this.toArray());
  }, a.prototype.toJSON = function() {
    return { mathjs: "SparseMatrix", values: this._values, index: this._index, ptr: this._ptr, size: this._size, datatype: this._datatype };
  }, a.prototype.diagonal = function(v) {
    if (v) {
      if (uu(v) && (v = v.toNumber()), !Hs(v) || !Bo(v)) throw new TypeError("The parameter k must be an integer number");
    } else v = 0;
    var m = v > 0 ? v : 0, g = v < 0 ? -v : 0, x = this._size[0], b = this._size[1], y = Math.min(x - g, b - m), w = [], _4 = [], k = [];
    k[0] = 0;
    for (var T2 = m; T2 < b && w.length < y; T2++) for (var A2 = this._ptr[T2], S2 = this._ptr[T2 + 1], C2 = A2; C2 < S2; C2++) {
      var E2 = this._index[C2];
      if (E2 === T2 - m + g) {
        w.push(this._values[C2]), _4[w.length - 1] = E2 - g;
        break;
      }
    }
    return k.push(w.length), new a({ values: w, index: _4, ptr: k, size: [y, 1] });
  }, a.fromJSON = function(v) {
    return new a(v);
  }, a.diagonal = function(v, m, g, x, b) {
    if (!Tl(v)) throw new TypeError("Array expected, size parameter");
    if (v.length !== 2) throw new Error("Only two dimensions matrix are supported");
    if (v = v.map(function(V2) {
      if (uu(V2) && (V2 = V2.toNumber()), !Hs(V2) || !Bo(V2) || V2 < 1) throw new Error("Size values must be positive integers");
      return V2;
    }), g) {
      if (uu(g) && (g = g.toNumber()), !Hs(g) || !Bo(g)) throw new TypeError("The parameter k must be an integer number");
    } else g = 0;
    var y = r, w = 0;
    jh(b) && (y = t.find(r, [b, b]) || r, w = t.convert(0, b));
    var _4 = g > 0 ? g : 0, k = g < 0 ? -g : 0, T2 = v[0], A2 = v[1], S2 = Math.min(T2 - k, A2 - _4), C2;
    if (Tl(m)) {
      if (m.length !== S2) throw new Error("Invalid value array length");
      C2 = function(W2) {
        return m[W2];
      };
    } else if (ts(m)) {
      var E2 = m.size();
      if (E2.length !== 1 || E2[0] !== S2) throw new Error("Invalid matrix length");
      C2 = function(W2) {
        return m.get([W2]);
      };
    } else C2 = function() {
      return m;
    };
    for (var F13 = [], N2 = [], D2 = [], I2 = 0; I2 < A2; I2++) {
      D2.push(F13.length);
      var O2 = I2 - _4;
      if (O2 >= 0 && O2 < S2) {
        var L2 = C2(O2);
        y(L2, w) || (N2.push(O2 + k), F13.push(L2));
      }
    }
    return D2.push(F13.length), new a({ values: F13, index: N2, ptr: D2, size: [T2, A2] });
  }, a.prototype.swapRows = function(v, m) {
    if (!Hs(v) || !Bo(v) || !Hs(m) || !Bo(m)) throw new Error("Row index must be positive integers");
    if (this._size.length !== 2) throw new Error("Only two dimensional matrix is supported");
    return du(v, this._size[0]), du(m, this._size[0]), a._swapRows(v, m, this._size[1], this._values, this._index, this._ptr), this;
  }, a._forEachRow = function(v, m, g, x, b) {
    for (var y = x[v], w = x[v + 1], _4 = y; _4 < w; _4++) b(g[_4], m[_4]);
  }, a._swapRows = function(v, m, g, x, b, y) {
    for (var w = 0; w < g; w++) {
      var _4 = y[w], k = y[w + 1], T2 = u2(v, _4, k, b), A2 = u2(m, _4, k, b);
      if (T2 < k && A2 < k && b[T2] === v && b[A2] === m) {
        if (x) {
          var S2 = x[T2];
          x[T2] = x[A2], x[A2] = S2;
        }
        continue;
      }
      if (T2 < k && b[T2] === v && (A2 >= k || b[A2] !== m)) {
        var C2 = x ? x[T2] : void 0;
        b.splice(A2, 0, m), x && x.splice(A2, 0, C2), b.splice(A2 <= T2 ? T2 + 1 : T2, 1), x && x.splice(A2 <= T2 ? T2 + 1 : T2, 1);
        continue;
      }
      if (A2 < k && b[A2] === m && (T2 >= k || b[T2] !== v)) {
        var E2 = x ? x[A2] : void 0;
        b.splice(T2, 0, v), x && x.splice(T2, 0, E2), b.splice(T2 <= A2 ? A2 + 1 : A2, 1), x && x.splice(T2 <= A2 ? A2 + 1 : A2, 1);
      }
    }
  }, a;
}, { isClass: true });
var Vit = "number";
var jit = ["typed"];
function Wit(e) {
  var t = e.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);
  if (t) {
    var r = { "0b": 2, "0o": 8, "0x": 16 }[t[1]], n = t[2], a = t[3];
    return { input: e, radix: r, integerPart: n, fractionalPart: a };
  } else return null;
}
function Git(e) {
  for (var t = parseInt(e.integerPart, e.radix), r = 0, n = 0; n < e.fractionalPart.length; n++) {
    var a = parseInt(e.fractionalPart[n], e.radix);
    r += a / Math.pow(e.radix, n + 1);
  }
  var o = t + r;
  if (isNaN(o)) throw new SyntaxError('String "' + e.input + '" is no valid number');
  return o;
}
var bN = ia(Vit, jit, (e) => {
  var { typed: t } = e, r = t("number", { "": function() {
    return 0;
  }, number: function(a) {
    return a;
  }, string: function(a) {
    if (a === "NaN") return NaN;
    var o = Wit(a);
    if (o) return Git(o);
    var s = 0, i = a.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);
    i && (s = Number(i[2]), a = i[1]);
    var l = Number(a);
    if (isNaN(l)) throw new SyntaxError('String "' + a + '" is no valid number');
    if (i) {
      if (l > 2 ** s - 1) throw new SyntaxError('String "'.concat(a, '" is out of range'));
      l >= 2 ** (s - 1) && (l = l - 2 ** s);
    }
    return l;
  }, BigNumber: function(a) {
    return a.toNumber();
  }, Fraction: function(a) {
    return a.valueOf();
  }, Unit: function(a) {
    throw new Error("Second argument with valueless unit expected");
  }, null: function(a) {
    return 0;
  }, "Unit, string | Unit": function(a, o) {
    return a.toNumber(o);
  }, "Array | Matrix": function(a) {
    return Nu(a, this);
  } });
  return r.fromJSON = function(n) {
    return parseFloat(n.value);
  }, r;
});
var $it = "bignumber";
var Hit = ["typed", "BigNumber"];
var _N = ia($it, Hit, (e) => {
  var { typed: t, BigNumber: r } = e;
  return t("bignumber", { "": function() {
    return new r(0);
  }, number: function(a) {
    return new r(a + "");
  }, string: function(a) {
    var o = a.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);
    if (o) {
      var s = o[2], i = r(o[1]), l = new r(2).pow(Number(s));
      if (i.gt(l.sub(1))) throw new SyntaxError('String "'.concat(a, '" is out of range'));
      var u2 = new r(2).pow(Number(s) - 1);
      return i.gte(u2) ? i.sub(l) : i;
    }
    return new r(a);
  }, BigNumber: function(a) {
    return a;
  }, Fraction: function(a) {
    return new r(a.n).div(a.d).times(a.s);
  }, null: function(a) {
    return new r(0);
  }, "Array | Matrix": function(a) {
    return Nu(a, this);
  } });
});
var qit = "fraction";
var Xit = ["typed", "Fraction"];
var wN = ia(qit, Xit, (e) => {
  var { typed: t, Fraction: r } = e;
  return t("fraction", { number: function(a) {
    if (!isFinite(a) || isNaN(a)) throw new Error(a + " cannot be represented as a fraction");
    return new r(a);
  }, string: function(a) {
    return new r(a);
  }, "number, number": function(a, o) {
    return new r(a, o);
  }, null: function(a) {
    return new r(0);
  }, BigNumber: function(a) {
    return new r(a.toString());
  }, Fraction: function(a) {
    return a;
  }, Object: function(a) {
    return new r(a);
  }, "Array | Matrix": function(a) {
    return Nu(a, this);
  } });
});
var KJ = "matrix";
var Kit = ["typed", "Matrix", "DenseMatrix", "SparseMatrix"];
var kN = ia(KJ, Kit, (e) => {
  var { typed: t, Matrix: r, DenseMatrix: n, SparseMatrix: a } = e;
  return t(KJ, { "": function() {
    return o([]);
  }, string: function(i) {
    return o([], i);
  }, "string, string": function(i, l) {
    return o([], i, l);
  }, Array: function(i) {
    return o(i);
  }, Matrix: function(i) {
    return o(i, i.storage());
  }, "Array | Matrix, string": o, "Array | Matrix, string, string": o });
  function o(s, i, l) {
    if (i === "dense" || i === "default" || i === void 0) return new n(s, l);
    if (i === "sparse") return new a(s, l);
    throw new TypeError("Unknown matrix type " + JSON.stringify(i) + ".");
  }
});
var YJ = "unaryMinus";
var Yit = ["typed"];
var TN = ia(YJ, Yit, (e) => {
  var { typed: t } = e;
  return t(YJ, { number: dN, Complex: function(n) {
    return n.neg();
  }, BigNumber: function(n) {
    return n.neg();
  }, Fraction: function(n) {
    return n.neg();
  }, Unit: function(n) {
    var a = n.clone();
    return a.value = this(n.value), a;
  }, "Array | Matrix": function(n) {
    return Nu(n, this, true);
  } });
});
var ZJ = "abs";
var Zit = ["typed"];
var AN = ia(ZJ, Zit, (e) => {
  var { typed: t } = e;
  return t(ZJ, { number: fN, Complex: function(n) {
    return n.abs();
  }, BigNumber: function(n) {
    return n.abs();
  }, Fraction: function(n) {
    return n.abs();
  }, "Array | Matrix": function(n) {
    return Nu(n, this, true);
  }, Unit: function(n) {
    return n.abs();
  } });
});
var JJ = "apply";
var Jit = ["typed", "isInteger"];
var SN = ia(JJ, Jit, (e) => {
  var { typed: t, isInteger: r } = e;
  return t(JJ, { "Array | Matrix, number | BigNumber, function": function(a, o, s) {
    if (!r(o)) throw new TypeError("Integer number expected for dimension");
    var i = Array.isArray(a) ? vc(a) : a.size();
    if (o < 0 || o >= i.length) throw new xd(o, i.length);
    return ts(a) ? a.create(pA(a.valueOf(), o, s)) : pA(a, o, s);
  } });
});
function pA(e, t, r) {
  var n, a, o;
  if (t <= 0) if (Array.isArray(e[0])) {
    for (o = Qit(e), a = [], n = 0; n < o.length; n++) a[n] = pA(o[n], t - 1, r);
    return a;
  } else return r(e);
  else {
    for (a = [], n = 0; n < e.length; n++) a[n] = pA(e[n], t - 1, r);
    return a;
  }
}
function Qit(e) {
  var t = e.length, r = e[0].length, n, a, o = [];
  for (a = 0; a < r; a++) {
    var s = [];
    for (n = 0; n < t; n++) s.push(e[n][a]);
    o.push(s);
  }
  return o;
}
var QJ = "addScalar";
var eot = ["typed"];
var EN = ia(QJ, eot, (e) => {
  var { typed: t } = e;
  return t(QJ, { "number, number": hN, "Complex, Complex": function(n, a) {
    return n.add(a);
  }, "BigNumber, BigNumber": function(n, a) {
    return n.plus(a);
  }, "Fraction, Fraction": function(n, a) {
    return n.add(a);
  }, "Unit, Unit": function(n, a) {
    if (n.value === null || n.value === void 0) throw new Error("Parameter x contains a unit with undefined value");
    if (a.value === null || a.value === void 0) throw new Error("Parameter y contains a unit with undefined value");
    if (!n.equalBase(a)) throw new Error("Units do not match");
    var o = n.clone();
    return o.value = this(o.value, a.value), o.fixPrefix = false, o;
  } });
});
var tot = "algorithm11";
var rot = ["typed", "equalScalar"];
var dA = ia(tot, rot, (e) => {
  var { typed: t, equalScalar: r } = e;
  return function(a, o, s, i) {
    var l = a._values, u2 = a._index, c = a._ptr, f = a._size, h = a._datatype;
    if (!l) throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");
    var p = f[0], d = f[1], v, m = r, g = 0, x = s;
    typeof h == "string" && (v = h, m = t.find(r, [v, v]), g = t.convert(0, v), o = t.convert(o, v), x = t.find(s, [v, v]));
    for (var b = [], y = [], w = [], _4 = 0; _4 < d; _4++) {
      w[_4] = y.length;
      for (var k = c[_4], T2 = c[_4 + 1], A2 = k; A2 < T2; A2++) {
        var S2 = u2[A2], C2 = i ? x(o, l[A2]) : x(l[A2], o);
        m(C2, g) || (y.push(S2), b.push(C2));
      }
    }
    return w[d] = y.length, a.createSparseMatrix({ values: b, index: y, ptr: w, size: [p, d], datatype: v });
  };
});
var not = "algorithm14";
var aot = ["typed"];
var dh = ia(not, aot, (e) => {
  var { typed: t } = e;
  return function(a, o, s, i) {
    var l = a._data, u2 = a._size, c = a._datatype, f, h = s;
    typeof c == "string" && (f = c, o = t.convert(o, f), h = t.find(s, [f, f]));
    var p = u2.length > 0 ? r(h, 0, u2, u2[0], l, o, i) : [];
    return a.createDenseMatrix({ data: p, size: tl(u2), datatype: f });
  };
  function r(n, a, o, s, i, l, u2) {
    var c = [];
    if (a === o.length - 1) for (var f = 0; f < s; f++) c[f] = u2 ? n(l, i[f]) : n(i[f], l);
    else for (var h = 0; h < s; h++) c[h] = r(n, a + 1, o, o[a + 1], i[h], l, u2);
    return c;
  }
});
var iot = "algorithm01";
var oot = ["typed"];
var vA = ia(iot, oot, (e) => {
  var { typed: t } = e;
  return function(n, a, o, s) {
    var i = n._data, l = n._size, u2 = n._datatype, c = a._values, f = a._index, h = a._ptr, p = a._size, d = a._datatype;
    if (l.length !== p.length) throw new _o(l.length, p.length);
    if (l[0] !== p[0] || l[1] !== p[1]) throw new RangeError("Dimension mismatch. Matrix A (" + l + ") must match Matrix B (" + p + ")");
    if (!c) throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");
    var v = l[0], m = l[1], g = typeof u2 == "string" && u2 === d ? u2 : void 0, x = g ? t.find(o, [g, g]) : o, b, y, w = [];
    for (b = 0; b < v; b++) w[b] = [];
    var _4 = [], k = [];
    for (y = 0; y < m; y++) {
      for (var T2 = y + 1, A2 = h[y], S2 = h[y + 1], C2 = A2; C2 < S2; C2++) b = f[C2], _4[b] = s ? x(c[C2], i[b][y]) : x(i[b][y], c[C2]), k[b] = T2;
      for (b = 0; b < v; b++) k[b] === T2 ? w[b][y] = _4[b] : w[b][y] = i[b][y];
    }
    return n.createDenseMatrix({ data: w, size: [v, m], datatype: g });
  };
});
var sot = "algorithm04";
var lot = ["typed", "equalScalar"];
var eQ = ia(sot, lot, (e) => {
  var { typed: t, equalScalar: r } = e;
  return function(a, o, s) {
    var i = a._values, l = a._index, u2 = a._ptr, c = a._size, f = a._datatype, h = o._values, p = o._index, d = o._ptr, v = o._size, m = o._datatype;
    if (c.length !== v.length) throw new _o(c.length, v.length);
    if (c[0] !== v[0] || c[1] !== v[1]) throw new RangeError("Dimension mismatch. Matrix A (" + c + ") must match Matrix B (" + v + ")");
    var g = c[0], x = c[1], b, y = r, w = 0, _4 = s;
    typeof f == "string" && f === m && (b = f, y = t.find(r, [b, b]), w = t.convert(0, b), _4 = t.find(s, [b, b]));
    var k = i && h ? [] : void 0, T2 = [], A2 = [], S2 = i && h ? [] : void 0, C2 = i && h ? [] : void 0, E2 = [], F13 = [], N2, D2, I2, O2, L2;
    for (D2 = 0; D2 < x; D2++) {
      A2[D2] = T2.length;
      var V2 = D2 + 1;
      for (O2 = u2[D2], L2 = u2[D2 + 1], I2 = O2; I2 < L2; I2++) N2 = l[I2], T2.push(N2), E2[N2] = V2, S2 && (S2[N2] = i[I2]);
      for (O2 = d[D2], L2 = d[D2 + 1], I2 = O2; I2 < L2; I2++) if (N2 = p[I2], E2[N2] === V2) {
        if (S2) {
          var W2 = _4(S2[N2], h[I2]);
          y(W2, w) ? E2[N2] = null : S2[N2] = W2;
        }
      } else T2.push(N2), F13[N2] = V2, C2 && (C2[N2] = h[I2]);
      if (S2 && C2) for (I2 = A2[D2]; I2 < T2.length; ) N2 = T2[I2], E2[N2] === V2 ? (k[I2] = S2[N2], I2++) : F13[N2] === V2 ? (k[I2] = C2[N2], I2++) : T2.splice(I2, 1);
    }
    return A2[x] = T2.length, a.createSparseMatrix({ values: k, index: T2, ptr: A2, size: [g, x], datatype: b });
  };
});
var uot = "algorithm10";
var cot = ["typed", "DenseMatrix"];
var mA = ia(uot, cot, (e) => {
  var { typed: t, DenseMatrix: r } = e;
  return function(a, o, s, i) {
    var l = a._values, u2 = a._index, c = a._ptr, f = a._size, h = a._datatype;
    if (!l) throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");
    var p = f[0], d = f[1], v, m = s;
    typeof h == "string" && (v = h, o = t.convert(o, v), m = t.find(s, [v, v]));
    for (var g = [], x = [], b = [], y = 0; y < d; y++) {
      for (var w = y + 1, _4 = c[y], k = c[y + 1], T2 = _4; T2 < k; T2++) {
        var A2 = u2[T2];
        x[A2] = l[T2], b[A2] = w;
      }
      for (var S2 = 0; S2 < p; S2++) y === 0 && (g[S2] = []), b[S2] === w ? g[S2][y] = i ? m(o, x[S2]) : m(x[S2], o) : g[S2][y] = o;
    }
    return new r({ data: g, size: [p, d], datatype: v });
  };
});
var fot = "algorithm13";
var hot = ["typed"];
var Qd = ia(fot, hot, (e) => {
  var { typed: t } = e;
  return function(a, o, s) {
    var i = a._data, l = a._size, u2 = a._datatype, c = o._data, f = o._size, h = o._datatype, p = [];
    if (l.length !== f.length) throw new _o(l.length, f.length);
    for (var d = 0; d < l.length; d++) {
      if (l[d] !== f[d]) throw new RangeError("Dimension mismatch. Matrix A (" + l + ") must match Matrix B (" + f + ")");
      p[d] = l[d];
    }
    var v, m = s;
    typeof u2 == "string" && u2 === h && (v = u2, m = t.find(s, [v, v]));
    var g = p.length > 0 ? r(m, 0, p, p[0], i, c) : [];
    return a.createDenseMatrix({ data: g, size: p, datatype: v });
  };
  function r(n, a, o, s, i, l) {
    var u2 = [];
    if (a === o.length - 1) for (var c = 0; c < s; c++) u2[c] = n(i[c], l[c]);
    else for (var f = 0; f < s; f++) u2[f] = r(n, a + 1, o, o[a + 1], i[f], l[f]);
    return u2;
  }
});
var pot = "algorithm03";
var dot = ["typed"];
var qv = ia(pot, dot, (e) => {
  var { typed: t } = e;
  return function(n, a, o, s) {
    var i = n._data, l = n._size, u2 = n._datatype, c = a._values, f = a._index, h = a._ptr, p = a._size, d = a._datatype;
    if (l.length !== p.length) throw new _o(l.length, p.length);
    if (l[0] !== p[0] || l[1] !== p[1]) throw new RangeError("Dimension mismatch. Matrix A (" + l + ") must match Matrix B (" + p + ")");
    if (!c) throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");
    var v = l[0], m = l[1], g, x = 0, b = o;
    typeof u2 == "string" && u2 === d && (g = u2, x = t.convert(0, g), b = t.find(o, [g, g]));
    for (var y = [], w = 0; w < v; w++) y[w] = [];
    for (var _4 = [], k = [], T2 = 0; T2 < m; T2++) {
      for (var A2 = T2 + 1, S2 = h[T2], C2 = h[T2 + 1], E2 = S2; E2 < C2; E2++) {
        var F13 = f[E2];
        _4[F13] = s ? b(c[E2], i[F13][T2]) : b(i[F13][T2], c[E2]), k[F13] = A2;
      }
      for (var N2 = 0; N2 < v; N2++) k[N2] === A2 ? y[N2][T2] = _4[N2] : y[N2][T2] = s ? b(x, i[N2][T2]) : b(i[N2][T2], x);
    }
    return n.createDenseMatrix({ data: y, size: [v, m], datatype: g });
  };
});
var vot = "algorithm05";
var mot = ["typed", "equalScalar"];
var gA = ia(vot, mot, (e) => {
  var { typed: t, equalScalar: r } = e;
  return function(a, o, s) {
    var i = a._values, l = a._index, u2 = a._ptr, c = a._size, f = a._datatype, h = o._values, p = o._index, d = o._ptr, v = o._size, m = o._datatype;
    if (c.length !== v.length) throw new _o(c.length, v.length);
    if (c[0] !== v[0] || c[1] !== v[1]) throw new RangeError("Dimension mismatch. Matrix A (" + c + ") must match Matrix B (" + v + ")");
    var g = c[0], x = c[1], b, y = r, w = 0, _4 = s;
    typeof f == "string" && f === m && (b = f, y = t.find(r, [b, b]), w = t.convert(0, b), _4 = t.find(s, [b, b]));
    var k = i && h ? [] : void 0, T2 = [], A2 = [], S2 = k ? [] : void 0, C2 = k ? [] : void 0, E2 = [], F13 = [], N2, D2, I2, O2;
    for (D2 = 0; D2 < x; D2++) {
      A2[D2] = T2.length;
      var L2 = D2 + 1;
      for (I2 = u2[D2], O2 = u2[D2 + 1]; I2 < O2; I2++) N2 = l[I2], T2.push(N2), E2[N2] = L2, S2 && (S2[N2] = i[I2]);
      for (I2 = d[D2], O2 = d[D2 + 1]; I2 < O2; I2++) N2 = p[I2], E2[N2] !== L2 && T2.push(N2), F13[N2] = L2, C2 && (C2[N2] = h[I2]);
      if (k) for (I2 = A2[D2]; I2 < T2.length; ) {
        N2 = T2[I2];
        var V2 = E2[N2], W2 = F13[N2];
        if (V2 === L2 || W2 === L2) {
          var X2 = V2 === L2 ? S2[N2] : w, Y2 = W2 === L2 ? C2[N2] : w, K2 = _4(X2, Y2);
          y(K2, w) ? T2.splice(I2, 1) : (k.push(K2), I2++);
        }
      }
    }
    return A2[x] = T2.length, a.createSparseMatrix({ values: k, index: T2, ptr: A2, size: [g, x], datatype: b });
  };
});
var got = "algorithm12";
var yot = ["typed", "DenseMatrix"];
var _x = ia(got, yot, (e) => {
  var { typed: t, DenseMatrix: r } = e;
  return function(a, o, s, i) {
    var l = a._values, u2 = a._index, c = a._ptr, f = a._size, h = a._datatype;
    if (!l) throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");
    var p = f[0], d = f[1], v, m = s;
    typeof h == "string" && (v = h, o = t.convert(o, v), m = t.find(s, [v, v]));
    for (var g = [], x = [], b = [], y = 0; y < d; y++) {
      for (var w = y + 1, _4 = c[y], k = c[y + 1], T2 = _4; T2 < k; T2++) {
        var A2 = u2[T2];
        x[A2] = l[T2], b[A2] = w;
      }
      for (var S2 = 0; S2 < p; S2++) y === 0 && (g[S2] = []), b[S2] === w ? g[S2][y] = i ? m(o, x[S2]) : m(x[S2], o) : g[S2][y] = i ? m(o, 0) : m(0, o);
    }
    return new r({ data: g, size: [p, d], datatype: v });
  };
});
var xot = "multiplyScalar";
var bot = ["typed"];
var DN = ia(xot, bot, (e) => {
  var { typed: t } = e;
  return t("multiplyScalar", { "number, number": pN, "Complex, Complex": function(n, a) {
    return n.mul(a);
  }, "BigNumber, BigNumber": function(n, a) {
    return n.times(a);
  }, "Fraction, Fraction": function(n, a) {
    return n.mul(a);
  }, "number | Fraction | BigNumber | Complex, Unit": function(n, a) {
    var o = a.clone();
    return o.value = o.value === null ? o._normalize(n) : this(o.value, n), o;
  }, "Unit, number | Fraction | BigNumber | Complex": function(n, a) {
    var o = n.clone();
    return o.value = o.value === null ? o._normalize(a) : this(o.value, a), o;
  }, "Unit, Unit": function(n, a) {
    return n.multiply(a);
  } });
});
var tQ = "multiply";
var _ot = ["typed", "matrix", "addScalar", "multiplyScalar", "equalScalar", "dot"];
var CN = ia(tQ, _ot, (e) => {
  var { typed: t, matrix: r, addScalar: n, multiplyScalar: a, equalScalar: o, dot: s } = e, i = dA({ typed: t, equalScalar: o }), l = dh({ typed: t });
  function u2(w, _4) {
    switch (w.length) {
      case 1:
        switch (_4.length) {
          case 1:
            if (w[0] !== _4[0]) throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");
            break;
          case 2:
            if (w[0] !== _4[0]) throw new RangeError("Dimension mismatch in multiplication. Vector length (" + w[0] + ") must match Matrix rows (" + _4[0] + ")");
            break;
          default:
            throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has " + _4.length + " dimensions)");
        }
        break;
      case 2:
        switch (_4.length) {
          case 1:
            if (w[1] !== _4[0]) throw new RangeError("Dimension mismatch in multiplication. Matrix columns (" + w[1] + ") must match Vector length (" + _4[0] + ")");
            break;
          case 2:
            if (w[1] !== _4[0]) throw new RangeError("Dimension mismatch in multiplication. Matrix A columns (" + w[1] + ") must match Matrix B rows (" + _4[0] + ")");
            break;
          default:
            throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has " + _4.length + " dimensions)");
        }
        break;
      default:
        throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has " + w.length + " dimensions)");
    }
  }
  function c(w, _4, k) {
    if (k === 0) throw new Error("Cannot multiply two empty vectors");
    return s(w, _4);
  }
  function f(w, _4) {
    if (_4.storage() !== "dense") throw new Error("Support for SparseMatrix not implemented");
    return h(w, _4);
  }
  function h(w, _4) {
    var k = w._data, T2 = w._size, A2 = w._datatype, S2 = _4._data, C2 = _4._size, E2 = _4._datatype, F13 = T2[0], N2 = C2[1], D2, I2 = n, O2 = a;
    A2 && E2 && A2 === E2 && typeof A2 == "string" && (D2 = A2, I2 = t.find(n, [D2, D2]), O2 = t.find(a, [D2, D2]));
    for (var L2 = [], V2 = 0; V2 < N2; V2++) {
      for (var W2 = O2(k[0], S2[0][V2]), X2 = 1; X2 < F13; X2++) W2 = I2(W2, O2(k[X2], S2[X2][V2]));
      L2[V2] = W2;
    }
    return w.createDenseMatrix({ data: L2, size: [N2], datatype: D2 });
  }
  var p = t("_multiplyMatrixVector", { "DenseMatrix, any": v, "SparseMatrix, any": x }), d = t("_multiplyMatrixMatrix", { "DenseMatrix, DenseMatrix": m, "DenseMatrix, SparseMatrix": g, "SparseMatrix, DenseMatrix": b, "SparseMatrix, SparseMatrix": y });
  function v(w, _4) {
    var k = w._data, T2 = w._size, A2 = w._datatype, S2 = _4._data, C2 = _4._datatype, E2 = T2[0], F13 = T2[1], N2, D2 = n, I2 = a;
    A2 && C2 && A2 === C2 && typeof A2 == "string" && (N2 = A2, D2 = t.find(n, [N2, N2]), I2 = t.find(a, [N2, N2]));
    for (var O2 = [], L2 = 0; L2 < E2; L2++) {
      for (var V2 = k[L2], W2 = I2(V2[0], S2[0]), X2 = 1; X2 < F13; X2++) W2 = D2(W2, I2(V2[X2], S2[X2]));
      O2[L2] = W2;
    }
    return w.createDenseMatrix({ data: O2, size: [E2], datatype: N2 });
  }
  function m(w, _4) {
    var k = w._data, T2 = w._size, A2 = w._datatype, S2 = _4._data, C2 = _4._size, E2 = _4._datatype, F13 = T2[0], N2 = T2[1], D2 = C2[1], I2, O2 = n, L2 = a;
    A2 && E2 && A2 === E2 && typeof A2 == "string" && (I2 = A2, O2 = t.find(n, [I2, I2]), L2 = t.find(a, [I2, I2]));
    for (var V2 = [], W2 = 0; W2 < F13; W2++) {
      var X2 = k[W2];
      V2[W2] = [];
      for (var Y2 = 0; Y2 < D2; Y2++) {
        for (var K2 = L2(X2[0], S2[0][Y2]), q = 1; q < N2; q++) K2 = O2(K2, L2(X2[q], S2[q][Y2]));
        V2[W2][Y2] = K2;
      }
    }
    return w.createDenseMatrix({ data: V2, size: [F13, D2], datatype: I2 });
  }
  function g(w, _4) {
    var k = w._data, T2 = w._size, A2 = w._datatype, S2 = _4._values, C2 = _4._index, E2 = _4._ptr, F13 = _4._size, N2 = _4._datatype;
    if (!S2) throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");
    var D2 = T2[0], I2 = F13[1], O2, L2 = n, V2 = a, W2 = o, X2 = 0;
    A2 && N2 && A2 === N2 && typeof A2 == "string" && (O2 = A2, L2 = t.find(n, [O2, O2]), V2 = t.find(a, [O2, O2]), W2 = t.find(o, [O2, O2]), X2 = t.convert(0, O2));
    for (var Y2 = [], K2 = [], q = [], re = _4.createSparseMatrix({ values: Y2, index: K2, ptr: q, size: [D2, I2], datatype: O2 }), R2 = 0; R2 < I2; R2++) {
      q[R2] = K2.length;
      var z = E2[R2], H2 = E2[R2 + 1];
      if (H2 > z) for (var te = 0, j = 0; j < D2; j++) {
        for (var Q2 = j + 1, Z2 = void 0, ne = z; ne < H2; ne++) {
          var ae = C2[ne];
          te !== Q2 ? (Z2 = V2(k[j][ae], S2[ne]), te = Q2) : Z2 = L2(Z2, V2(k[j][ae], S2[ne]));
        }
        te === Q2 && !W2(Z2, X2) && (K2.push(j), Y2.push(Z2));
      }
    }
    return q[I2] = K2.length, re;
  }
  function x(w, _4) {
    var k = w._values, T2 = w._index, A2 = w._ptr, S2 = w._datatype;
    if (!k) throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");
    var C2 = _4._data, E2 = _4._datatype, F13 = w._size[0], N2 = _4._size[0], D2 = [], I2 = [], O2 = [], L2, V2 = n, W2 = a, X2 = o, Y2 = 0;
    S2 && E2 && S2 === E2 && typeof S2 == "string" && (L2 = S2, V2 = t.find(n, [L2, L2]), W2 = t.find(a, [L2, L2]), X2 = t.find(o, [L2, L2]), Y2 = t.convert(0, L2));
    var K2 = [], q = [];
    O2[0] = 0;
    for (var re = 0; re < N2; re++) {
      var R2 = C2[re];
      if (!X2(R2, Y2)) for (var z = A2[re], H2 = A2[re + 1], te = z; te < H2; te++) {
        var j = T2[te];
        q[j] ? K2[j] = V2(K2[j], W2(R2, k[te])) : (q[j] = true, I2.push(j), K2[j] = W2(R2, k[te]));
      }
    }
    for (var Q2 = I2.length, Z2 = 0; Z2 < Q2; Z2++) {
      var ne = I2[Z2];
      D2[Z2] = K2[ne];
    }
    return O2[1] = I2.length, w.createSparseMatrix({ values: D2, index: I2, ptr: O2, size: [F13, 1], datatype: L2 });
  }
  function b(w, _4) {
    var k = w._values, T2 = w._index, A2 = w._ptr, S2 = w._datatype;
    if (!k) throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");
    var C2 = _4._data, E2 = _4._datatype, F13 = w._size[0], N2 = _4._size[0], D2 = _4._size[1], I2, O2 = n, L2 = a, V2 = o, W2 = 0;
    S2 && E2 && S2 === E2 && typeof S2 == "string" && (I2 = S2, O2 = t.find(n, [I2, I2]), L2 = t.find(a, [I2, I2]), V2 = t.find(o, [I2, I2]), W2 = t.convert(0, I2));
    for (var X2 = [], Y2 = [], K2 = [], q = w.createSparseMatrix({ values: X2, index: Y2, ptr: K2, size: [F13, D2], datatype: I2 }), re = [], R2 = [], z = 0; z < D2; z++) {
      K2[z] = Y2.length;
      for (var H2 = z + 1, te = 0; te < N2; te++) {
        var j = C2[te][z];
        if (!V2(j, W2)) for (var Q2 = A2[te], Z2 = A2[te + 1], ne = Q2; ne < Z2; ne++) {
          var ae = T2[ne];
          R2[ae] !== H2 ? (R2[ae] = H2, Y2.push(ae), re[ae] = L2(j, k[ne])) : re[ae] = O2(re[ae], L2(j, k[ne]));
        }
      }
      for (var ue = K2[z], le = Y2.length, ce = ue; ce < le; ce++) {
        var se = Y2[ce];
        X2[ce] = re[se];
      }
    }
    return K2[D2] = Y2.length, q;
  }
  function y(w, _4) {
    var k = w._values, T2 = w._index, A2 = w._ptr, S2 = w._datatype, C2 = _4._values, E2 = _4._index, F13 = _4._ptr, N2 = _4._datatype, D2 = w._size[0], I2 = _4._size[1], O2 = k && C2, L2, V2 = n, W2 = a;
    S2 && N2 && S2 === N2 && typeof S2 == "string" && (L2 = S2, V2 = t.find(n, [L2, L2]), W2 = t.find(a, [L2, L2]));
    for (var X2 = O2 ? [] : void 0, Y2 = [], K2 = [], q = w.createSparseMatrix({ values: X2, index: Y2, ptr: K2, size: [D2, I2], datatype: L2 }), re = O2 ? [] : void 0, R2 = [], z, H2, te, j, Q2, Z2, ne, ae, ue = 0; ue < I2; ue++) {
      K2[ue] = Y2.length;
      var le = ue + 1;
      for (Q2 = F13[ue], Z2 = F13[ue + 1], j = Q2; j < Z2; j++) if (ae = E2[j], O2) for (H2 = A2[ae], te = A2[ae + 1], z = H2; z < te; z++) ne = T2[z], R2[ne] !== le ? (R2[ne] = le, Y2.push(ne), re[ne] = W2(C2[j], k[z])) : re[ne] = V2(re[ne], W2(C2[j], k[z]));
      else for (H2 = A2[ae], te = A2[ae + 1], z = H2; z < te; z++) ne = T2[z], R2[ne] !== le && (R2[ne] = le, Y2.push(ne));
      if (O2) for (var ce = K2[ue], se = Y2.length, he = ce; he < se; he++) {
        var me = Y2[he];
        X2[he] = re[me];
      }
    }
    return K2[I2] = Y2.length, q;
  }
  return t(tQ, mx({ "Array, Array": function(_4, k) {
    u2(vc(_4), vc(k));
    var T2 = this(r(_4), r(k));
    return ts(T2) ? T2.valueOf() : T2;
  }, "Matrix, Matrix": function(_4, k) {
    var T2 = _4.size(), A2 = k.size();
    return u2(T2, A2), T2.length === 1 ? A2.length === 1 ? c(_4, k, T2[0]) : f(_4, k) : A2.length === 1 ? p(_4, k) : d(_4, k);
  }, "Matrix, Array": function(_4, k) {
    return this(_4, r(k));
  }, "Array, Matrix": function(_4, k) {
    return this(r(_4, k.storage()), k);
  }, "SparseMatrix, any": function(_4, k) {
    return i(_4, k, a, false);
  }, "DenseMatrix, any": function(_4, k) {
    return l(_4, k, a, false);
  }, "any, SparseMatrix": function(_4, k) {
    return i(k, _4, a, true);
  }, "any, DenseMatrix": function(_4, k) {
    return l(k, _4, a, true);
  }, "Array, any": function(_4, k) {
    return l(r(_4), k, a, false).valueOf();
  }, "any, Array": function(_4, k) {
    return l(r(k), _4, a, true).valueOf();
  }, "any, any": a, "any, any, ...any": function(_4, k, T2) {
    for (var A2 = this(_4, k), S2 = 0; S2 < T2.length; S2++) A2 = this(A2, T2[S2]);
    return A2;
  } }, a.signatures));
});
var wot = "sqrt";
var kot = ["config", "typed", "Complex"];
var MN = ia(wot, kot, (e) => {
  var { config: t, typed: r, Complex: n } = e;
  return r("sqrt", { number: a, Complex: function(s) {
    return s.sqrt();
  }, BigNumber: function(s) {
    return !s.isNegative() || t.predictable ? s.sqrt() : a(s.toNumber());
  }, "Array | Matrix": function(s) {
    return Nu(s, this, true);
  }, Unit: function(s) {
    return s.pow(0.5);
  } });
  function a(o) {
    return isNaN(o) ? NaN : o >= 0 || t.predictable ? Math.sqrt(o) : new n(o, 0).sqrt();
  }
});
var rQ = "subtract";
var Tot = ["typed", "matrix", "equalScalar", "addScalar", "unaryMinus", "DenseMatrix"];
var IN = ia(rQ, Tot, (e) => {
  var { typed: t, matrix: r, equalScalar: n, addScalar: a, unaryMinus: o, DenseMatrix: s } = e, i = vA({ typed: t }), l = qv({ typed: t }), u2 = gA({ typed: t, equalScalar: n }), c = mA({ typed: t, DenseMatrix: s }), f = Qd({ typed: t }), h = dh({ typed: t });
  return t(rQ, { "number, number": function(d, v) {
    return d - v;
  }, "Complex, Complex": function(d, v) {
    return d.sub(v);
  }, "BigNumber, BigNumber": function(d, v) {
    return d.minus(v);
  }, "Fraction, Fraction": function(d, v) {
    return d.sub(v);
  }, "Unit, Unit": function(d, v) {
    if (d.value === null) throw new Error("Parameter x contains a unit with undefined value");
    if (v.value === null) throw new Error("Parameter y contains a unit with undefined value");
    if (!d.equalBase(v)) throw new Error("Units do not match");
    var m = d.clone();
    return m.value = this(m.value, v.value), m.fixPrefix = false, m;
  }, "SparseMatrix, SparseMatrix": function(d, v) {
    return yA(d, v), u2(d, v, this);
  }, "SparseMatrix, DenseMatrix": function(d, v) {
    return yA(d, v), l(v, d, this, true);
  }, "DenseMatrix, SparseMatrix": function(d, v) {
    return yA(d, v), i(d, v, this, false);
  }, "DenseMatrix, DenseMatrix": function(d, v) {
    return yA(d, v), f(d, v, this);
  }, "Array, Array": function(d, v) {
    return this(r(d), r(v)).valueOf();
  }, "Array, Matrix": function(d, v) {
    return this(r(d), v);
  }, "Matrix, Array": function(d, v) {
    return this(d, r(v));
  }, "SparseMatrix, any": function(d, v) {
    return c(d, o(v), a);
  }, "DenseMatrix, any": function(d, v) {
    return h(d, v, this);
  }, "any, SparseMatrix": function(d, v) {
    return c(v, d, this, true);
  }, "any, DenseMatrix": function(d, v) {
    return h(v, d, this, true);
  }, "Array, any": function(d, v) {
    return h(r(d), v, this, false).valueOf();
  }, "any, Array": function(d, v) {
    return h(r(v), d, this, true).valueOf();
  } });
});
function yA(e, t) {
  var r = e.size(), n = t.size();
  if (r.length !== n.length) throw new _o(r.length, n.length);
}
var Aot = "algorithm07";
var Sot = ["typed", "DenseMatrix"];
var xA = ia(Aot, Sot, (e) => {
  var { typed: t, DenseMatrix: r } = e;
  return function(o, s, i) {
    var l = o._size, u2 = o._datatype, c = s._size, f = s._datatype;
    if (l.length !== c.length) throw new _o(l.length, c.length);
    if (l[0] !== c[0] || l[1] !== c[1]) throw new RangeError("Dimension mismatch. Matrix A (" + l + ") must match Matrix B (" + c + ")");
    var h = l[0], p = l[1], d, v = 0, m = i;
    typeof u2 == "string" && u2 === f && (d = u2, v = t.convert(0, d), m = t.find(i, [d, d]));
    var g, x, b = [];
    for (g = 0; g < h; g++) b[g] = [];
    var y = [], w = [], _4 = [], k = [];
    for (x = 0; x < p; x++) {
      var T2 = x + 1;
      for (n(o, x, _4, y, T2), n(s, x, k, w, T2), g = 0; g < h; g++) {
        var A2 = _4[g] === T2 ? y[g] : v, S2 = k[g] === T2 ? w[g] : v;
        b[g][x] = m(A2, S2);
      }
    }
    return new r({ data: b, size: [h, p], datatype: d });
  };
  function n(a, o, s, i, l) {
    for (var u2 = a._values, c = a._index, f = a._ptr, h = f[o], p = f[o + 1]; h < p; h++) {
      var d = c[h];
      s[d] = l, i[d] = u2[h];
    }
  }
});
var nQ = "conj";
var Eot = ["typed"];
var NN = ia(nQ, Eot, (e) => {
  var { typed: t } = e;
  return t(nQ, { number: function(n) {
    return n;
  }, BigNumber: function(n) {
    return n;
  }, Complex: function(n) {
    return n.conjugate();
  }, "Array | Matrix": function(n) {
    return Nu(n, this);
  } });
});
var aQ = "identity";
var Dot = ["typed", "config", "matrix", "BigNumber", "DenseMatrix", "SparseMatrix"];
var FN = ia(aQ, Dot, (e) => {
  var { typed: t, config: r, matrix: n, BigNumber: a, DenseMatrix: o, SparseMatrix: s } = e;
  return t(aQ, { "": function() {
    return r.matrix === "Matrix" ? n([]) : [];
  }, string: function(c) {
    return n(c);
  }, "number | BigNumber": function(c) {
    return l(c, c, r.matrix === "Matrix" ? "dense" : void 0);
  }, "number | BigNumber, string": function(c, f) {
    return l(c, c, f);
  }, "number | BigNumber, number | BigNumber": function(c, f) {
    return l(c, f, r.matrix === "Matrix" ? "dense" : void 0);
  }, "number | BigNumber, number | BigNumber, string": function(c, f, h) {
    return l(c, f, h);
  }, Array: function(c) {
    return i(c);
  }, "Array, string": function(c, f) {
    return i(c, f);
  }, Matrix: function(c) {
    return i(c.valueOf(), c.storage());
  }, "Matrix, string": function(c, f) {
    return i(c.valueOf(), f);
  } });
  function i(u2, c) {
    switch (u2.length) {
      case 0:
        return c ? n(c) : [];
      case 1:
        return l(u2[0], u2[0], c);
      case 2:
        return l(u2[0], u2[1], c);
      default:
        throw new Error("Vector containing two values expected");
    }
  }
  function l(u2, c, f) {
    var h = uu(u2) || uu(c) ? a : null;
    if (uu(u2) && (u2 = u2.toNumber()), uu(c) && (c = c.toNumber()), !Bo(u2) || u2 < 1) throw new Error("Parameters in function identity must be positive integers");
    if (!Bo(c) || c < 1) throw new Error("Parameters in function identity must be positive integers");
    var p = h ? new a(1) : 1, d = h ? new h(0) : 0, v = [u2, c];
    if (f) {
      if (f === "sparse") return s.diagonal(v, p, 0, d);
      if (f === "dense") return o.diagonal(v, p, 0, d);
      throw new TypeError('Unknown matrix type "'.concat(f, '"'));
    }
    for (var m = b_([], v, d), g = u2 < c ? u2 : c, x = 0; x < g; x++) m[x][x] = p;
    return m;
  }
});
function iQ() {
  throw new Error('No "bignumber" implementation available');
}
function oQ() {
  throw new Error('No "fraction" implementation available');
}
function sQ() {
  throw new Error('No "matrix" implementation available');
}
var lQ = "size";
var Cot = ["typed", "config", "?matrix"];
var ON = ia(lQ, Cot, (e) => {
  var { typed: t, config: r, matrix: n } = e;
  return t(lQ, { Matrix: function(o) {
    return o.create(o.size());
  }, Array: vc, string: function(o) {
    return r.matrix === "Array" ? [o.length] : n([o.length]);
  }, "number | Complex | BigNumber | Unit | boolean | null": function(o) {
    return r.matrix === "Array" ? [] : n ? n([]) : sQ();
  } });
});
var uQ = "mode";
var Mot = ["typed", "isNaN", "isNumeric"];
var PN = ia(uQ, Mot, (e) => {
  var { typed: t, isNaN: r, isNumeric: n } = e;
  return t(uQ, { "Array | Matrix": a, "...": function(s) {
    return a(s);
  } });
  function a(o) {
    o = w_(o.valueOf());
    var s = o.length;
    if (s === 0) throw new Error("Cannot calculate mode of an empty array");
    for (var i = {}, l = [], u2 = 0, c = 0; c < o.length; c++) {
      var f = o[c];
      if (n(f) && r(f)) throw new Error("Cannot calculate mode of an array containing NaN values");
      f in i || (i[f] = 0), i[f]++, i[f] === u2 ? l.push(f) : i[f] > u2 && (u2 = i[f], l = [f]);
    }
    return l;
  }
});
function Xv(e, t, r) {
  var n;
  return String(e).indexOf("Unexpected type") !== -1 ? (n = arguments.length > 2 ? " (type: " + hf(r) + ", value: " + JSON.stringify(r) + ")" : " (type: " + e.data.actual + ")", new TypeError("Cannot calculate " + t + ", unexpected type of argument" + n)) : String(e).indexOf("complex numbers") !== -1 ? (n = arguments.length > 2 ? " (type: " + hf(r) + ", value: " + JSON.stringify(r) + ")" : "", new TypeError("Cannot calculate " + t + ", no ordering relation is defined for complex numbers" + n)) : e;
}
var Iot = "numeric";
var Not = ["number", "?bignumber", "?fraction"];
var LN = ia(Iot, Not, (e) => {
  var { number: t, bignumber: r, fraction: n } = e, a = { string: true, number: true, BigNumber: true, Fraction: true }, o = { number: (s) => t(s), BigNumber: r ? (s) => r(s) : iQ, Fraction: n ? (s) => n(s) : oQ };
  return function(i, l) {
    var u2 = hf(i);
    if (!(u2 in a)) throw new TypeError("Cannot convert " + i + ' of type "' + u2 + '"; valid input types are ' + Object.keys(a).join(", "));
    if (!(l in o)) throw new TypeError("Cannot convert " + i + ' to type "' + l + '"; valid output types are ' + Object.keys(o).join(", "));
    return l === u2 ? i : o[l](i);
  };
});
var cQ = "divideScalar";
var Fot = ["typed", "numeric"];
var RN = ia(cQ, Fot, (e) => {
  var { typed: t, numeric: r } = e;
  return t(cQ, { "number, number": function(a, o) {
    return a / o;
  }, "Complex, Complex": function(a, o) {
    return a.div(o);
  }, "BigNumber, BigNumber": function(a, o) {
    return a.div(o);
  }, "Fraction, Fraction": function(a, o) {
    return a.div(o);
  }, "Unit, number | Fraction | BigNumber": function(a, o) {
    var s = a.clone(), i = r(1, hf(o));
    return s.value = this(s.value === null ? s._normalize(i) : s.value, o), s;
  }, "number | Fraction | BigNumber, Unit": function(a, o) {
    var s = o.clone();
    s = s.pow(-1);
    var i = r(1, hf(a));
    return s.value = this(a, o.value === null ? o._normalize(i) : o.value), s;
  }, "Unit, Unit": function(a, o) {
    return a.divide(o);
  } });
});
var fQ = "compare";
var Oot = ["typed", "config", "matrix", "equalScalar", "BigNumber", "Fraction", "DenseMatrix"];
var zN = ia(fQ, Oot, (e) => {
  var { typed: t, config: r, equalScalar: n, matrix: a, BigNumber: o, Fraction: s, DenseMatrix: i } = e, l = qv({ typed: t }), u2 = gA({ typed: t, equalScalar: n }), c = _x({ typed: t, DenseMatrix: i }), f = Qd({ typed: t }), h = dh({ typed: t });
  return t(fQ, { "boolean, boolean": function(d, v) {
    return d === v ? 0 : d > v ? 1 : -1;
  }, "number, number": function(d, v) {
    return wp(d, v, r.epsilon) ? 0 : d > v ? 1 : -1;
  }, "BigNumber, BigNumber": function(d, v) {
    return Hv(d, v, r.epsilon) ? new o(0) : new o(d.cmp(v));
  }, "Fraction, Fraction": function(d, v) {
    return new s(d.compare(v));
  }, "Complex, Complex": function() {
    throw new TypeError("No ordering relation is defined for complex numbers");
  }, "Unit, Unit": function(d, v) {
    if (!d.equalBase(v)) throw new Error("Cannot compare units with different base");
    return this(d.value, v.value);
  }, "SparseMatrix, SparseMatrix": function(d, v) {
    return u2(d, v, this);
  }, "SparseMatrix, DenseMatrix": function(d, v) {
    return l(v, d, this, true);
  }, "DenseMatrix, SparseMatrix": function(d, v) {
    return l(d, v, this, false);
  }, "DenseMatrix, DenseMatrix": function(d, v) {
    return f(d, v, this);
  }, "Array, Array": function(d, v) {
    return this(a(d), a(v)).valueOf();
  }, "Array, Matrix": function(d, v) {
    return this(a(d), v);
  }, "Matrix, Array": function(d, v) {
    return this(d, a(v));
  }, "SparseMatrix, any": function(d, v) {
    return c(d, v, this, false);
  }, "DenseMatrix, any": function(d, v) {
    return h(d, v, this, false);
  }, "any, SparseMatrix": function(d, v) {
    return c(v, d, this, true);
  }, "any, DenseMatrix": function(d, v) {
    return h(v, d, this, true);
  }, "Array, any": function(d, v) {
    return h(a(d), v, this, false).valueOf();
  }, "any, Array": function(d, v) {
    return h(a(v), d, this, true).valueOf();
  } });
});
var hQ = "smaller";
var Pot = ["typed", "config", "matrix", "DenseMatrix"];
var BN = ia(hQ, Pot, (e) => {
  var { typed: t, config: r, matrix: n, DenseMatrix: a } = e, o = qv({ typed: t }), s = xA({ typed: t, DenseMatrix: a }), i = _x({ typed: t, DenseMatrix: a }), l = Qd({ typed: t }), u2 = dh({ typed: t });
  return t(hQ, { "boolean, boolean": function(f, h) {
    return f < h;
  }, "number, number": function(f, h) {
    return f < h && !wp(f, h, r.epsilon);
  }, "BigNumber, BigNumber": function(f, h) {
    return f.lt(h) && !Hv(f, h, r.epsilon);
  }, "Fraction, Fraction": function(f, h) {
    return f.compare(h) === -1;
  }, "Complex, Complex": function(f, h) {
    throw new TypeError("No ordering relation is defined for complex numbers");
  }, "Unit, Unit": function(f, h) {
    if (!f.equalBase(h)) throw new Error("Cannot compare units with different base");
    return this(f.value, h.value);
  }, "SparseMatrix, SparseMatrix": function(f, h) {
    return s(f, h, this);
  }, "SparseMatrix, DenseMatrix": function(f, h) {
    return o(h, f, this, true);
  }, "DenseMatrix, SparseMatrix": function(f, h) {
    return o(f, h, this, false);
  }, "DenseMatrix, DenseMatrix": function(f, h) {
    return l(f, h, this);
  }, "Array, Array": function(f, h) {
    return this(n(f), n(h)).valueOf();
  }, "Array, Matrix": function(f, h) {
    return this(n(f), h);
  }, "Matrix, Array": function(f, h) {
    return this(f, n(h));
  }, "SparseMatrix, any": function(f, h) {
    return i(f, h, this, false);
  }, "DenseMatrix, any": function(f, h) {
    return u2(f, h, this, false);
  }, "any, SparseMatrix": function(f, h) {
    return i(h, f, this, true);
  }, "any, DenseMatrix": function(f, h) {
    return u2(h, f, this, true);
  }, "Array, any": function(f, h) {
    return u2(n(f), h, this, false).valueOf();
  }, "any, Array": function(f, h) {
    return u2(n(h), f, this, true).valueOf();
  } });
});
var pQ = "larger";
var Lot = ["typed", "config", "matrix", "DenseMatrix"];
var UN = ia(pQ, Lot, (e) => {
  var { typed: t, config: r, matrix: n, DenseMatrix: a } = e, o = qv({ typed: t }), s = xA({ typed: t, DenseMatrix: a }), i = _x({ typed: t, DenseMatrix: a }), l = Qd({ typed: t }), u2 = dh({ typed: t });
  return t(pQ, { "boolean, boolean": function(f, h) {
    return f > h;
  }, "number, number": function(f, h) {
    return f > h && !wp(f, h, r.epsilon);
  }, "BigNumber, BigNumber": function(f, h) {
    return f.gt(h) && !Hv(f, h, r.epsilon);
  }, "Fraction, Fraction": function(f, h) {
    return f.compare(h) === 1;
  }, "Complex, Complex": function() {
    throw new TypeError("No ordering relation is defined for complex numbers");
  }, "Unit, Unit": function(f, h) {
    if (!f.equalBase(h)) throw new Error("Cannot compare units with different base");
    return this(f.value, h.value);
  }, "SparseMatrix, SparseMatrix": function(f, h) {
    return s(f, h, this);
  }, "SparseMatrix, DenseMatrix": function(f, h) {
    return o(h, f, this, true);
  }, "DenseMatrix, SparseMatrix": function(f, h) {
    return o(f, h, this, false);
  }, "DenseMatrix, DenseMatrix": function(f, h) {
    return l(f, h, this);
  }, "Array, Array": function(f, h) {
    return this(n(f), n(h)).valueOf();
  }, "Array, Matrix": function(f, h) {
    return this(n(f), h);
  }, "Matrix, Array": function(f, h) {
    return this(f, n(h));
  }, "SparseMatrix, any": function(f, h) {
    return i(f, h, this, false);
  }, "DenseMatrix, any": function(f, h) {
    return u2(f, h, this, false);
  }, "any, SparseMatrix": function(f, h) {
    return i(h, f, this, true);
  }, "any, DenseMatrix": function(f, h) {
    return u2(h, f, this, true);
  }, "Array, any": function(f, h) {
    return u2(n(f), h, this, false).valueOf();
  }, "any, Array": function(f, h) {
    return u2(n(h), f, this, true).valueOf();
  } });
});
var dQ = "partitionSelect";
var Rot = ["typed", "isNumeric", "isNaN", "compare"];
var VN = ia(dQ, Rot, (e) => {
  var { typed: t, isNumeric: r, isNaN: n, compare: a } = e, o = a, s = (u2, c) => -a(u2, c);
  return t(dQ, { "Array | Matrix, number": function(c, f) {
    return i(c, f, o);
  }, "Array | Matrix, number, string": function(c, f, h) {
    if (h === "asc") return i(c, f, o);
    if (h === "desc") return i(c, f, s);
    throw new Error('Compare string must be "asc" or "desc"');
  }, "Array | Matrix, number, function": i });
  function i(u2, c, f) {
    if (!Bo(c) || c < 0) throw new Error("k must be a non-negative integer");
    if (ts(u2)) {
      var h = u2.size();
      if (h.length > 1) throw new Error("Only one dimensional matrices supported");
      return l(u2.valueOf(), c, f);
    }
    if (Array.isArray(u2)) return l(u2, c, f);
  }
  function l(u2, c, f) {
    if (c >= u2.length) throw new Error("k out of bounds");
    for (var h = 0; h < u2.length; h++) if (r(u2[h]) && n(u2[h])) return u2[h];
    for (var p = 0, d = u2.length - 1; p < d; ) {
      for (var v = p, m = d, g = u2[Math.floor(Math.random() * (d - p + 1)) + p]; v < m; ) if (f(u2[v], g) >= 0) {
        var x = u2[m];
        u2[m] = u2[v], u2[v] = x, --m;
      } else ++v;
      f(u2[v], g) > 0 && --v, c <= v ? d = v : p = v + 1;
    }
    return u2[c];
  }
});
var zot = "FibonacciHeap";
var Bot = ["smaller", "larger"];
var jN = ia(zot, Bot, (e) => {
  var { smaller: t, larger: r } = e, n = 1 / Math.log((1 + Math.sqrt(5)) / 2);
  function a() {
    if (!(this instanceof a)) throw new SyntaxError("Constructor must be called with the new operator");
    this._minimum = null, this._size = 0;
  }
  a.prototype.type = "FibonacciHeap", a.prototype.isFibonacciHeap = true, a.prototype.insert = function(c, f) {
    var h = { key: c, value: f, degree: 0 };
    if (this._minimum) {
      var p = this._minimum;
      h.left = p, h.right = p.right, p.right = h, h.right.left = h, t(c, p.key) && (this._minimum = h);
    } else h.left = h, h.right = h, this._minimum = h;
    return this._size++, h;
  }, a.prototype.size = function() {
    return this._size;
  }, a.prototype.clear = function() {
    this._minimum = null, this._size = 0;
  }, a.prototype.isEmpty = function() {
    return this._size === 0;
  }, a.prototype.extractMinimum = function() {
    var c = this._minimum;
    if (c === null) return c;
    for (var f = this._minimum, h = c.degree, p = c.child; h > 0; ) {
      var d = p.right;
      p.left.right = p.right, p.right.left = p.left, p.left = f, p.right = f.right, f.right = p, p.right.left = p, p.parent = null, p = d, h--;
    }
    return c.left.right = c.right, c.right.left = c.left, c === c.right ? f = null : (f = c.right, f = u2(f, this._size)), this._size--, this._minimum = f, c;
  }, a.prototype.remove = function(c) {
    this._minimum = o(this._minimum, c, -1), this.extractMinimum();
  };
  function o(c, f, h) {
    f.key = h;
    var p = f.parent;
    return p && t(f.key, p.key) && (s(c, f, p), i(c, p)), t(f.key, c.key) && (c = f), c;
  }
  function s(c, f, h) {
    f.left.right = f.right, f.right.left = f.left, h.degree--, h.child === f && (h.child = f.right), h.degree === 0 && (h.child = null), f.left = c, f.right = c.right, c.right = f, f.right.left = f, f.parent = null, f.mark = false;
  }
  function i(c, f) {
    var h = f.parent;
    !h || (f.mark ? (s(c, f, h), i(h)) : f.mark = true);
  }
  var l = function(f, h) {
    f.left.right = f.right, f.right.left = f.left, f.parent = h, h.child ? (f.left = h.child, f.right = h.child.right, h.child.right = f, f.right.left = f) : (h.child = f, f.right = f, f.left = f), h.degree++, f.mark = false;
  };
  function u2(c, f) {
    var h = Math.floor(Math.log(f) * n) + 1, p = new Array(h), d = 0, v = c;
    if (v) for (d++, v = v.right; v !== c; ) d++, v = v.right;
    for (var m; d > 0; ) {
      for (var g = v.degree, x = v.right; m = p[g], !!m; ) {
        if (r(v.key, m.key)) {
          var b = m;
          m = v, v = b;
        }
        l(m, v), p[g] = null, g++;
      }
      p[g] = v, v = x, d--;
    }
    c = null;
    for (var y = 0; y < h; y++) m = p[y], m && (c ? (m.left.right = m.right, m.right.left = m.left, m.left = c, m.right = c.right, c.right = m, m.right.left = m, t(m.key, c.key) && (c = m)) : c = m);
    return c;
  }
  return a;
}, { isClass: true });
var Uot = "Spa";
var Vot = ["addScalar", "equalScalar", "FibonacciHeap"];
var WN = ia(Uot, Vot, (e) => {
  var { addScalar: t, equalScalar: r, FibonacciHeap: n } = e;
  function a() {
    if (!(this instanceof a)) throw new SyntaxError("Constructor must be called with the new operator");
    this._values = [], this._heap = new n();
  }
  return a.prototype.type = "Spa", a.prototype.isSpa = true, a.prototype.set = function(o, s) {
    if (this._values[o]) this._values[o].value = s;
    else {
      var i = this._heap.insert(o, s);
      this._values[o] = i;
    }
  }, a.prototype.get = function(o) {
    var s = this._values[o];
    return s ? s.value : 0;
  }, a.prototype.accumulate = function(o, s) {
    var i = this._values[o];
    i ? i.value = t(i.value, s) : (i = this._heap.insert(o, s), this._values[o] = i);
  }, a.prototype.forEach = function(o, s, i) {
    var l = this._heap, u2 = this._values, c = [], f = l.extractMinimum();
    for (f && c.push(f); f && f.key <= s; ) f.key >= o && (r(f.value, 0) || i(f.key, f.value, this)), f = l.extractMinimum(), f && c.push(f);
    for (var h = 0; h < c.length; h++) {
      var p = c[h];
      f = l.insert(p.key, p.value), u2[f.key] = f;
    }
  }, a.prototype.swap = function(o, s) {
    var i = this._values[o], l = this._values[s];
    if (!i && l) i = this._heap.insert(o, l.value), this._heap.remove(l), this._values[o] = i, this._values[s] = void 0;
    else if (i && !l) l = this._heap.insert(s, i.value), this._heap.remove(i), this._values[s] = l, this._values[o] = void 0;
    else if (i && l) {
      var u2 = i.value;
      i.value = l.value, l.value = u2;
    }
  }, a;
}, { isClass: true });
var vQ = "add";
var jot = ["typed", "matrix", "addScalar", "equalScalar", "DenseMatrix", "SparseMatrix"];
var GN = ia(vQ, jot, (e) => {
  var { typed: t, matrix: r, addScalar: n, equalScalar: a, DenseMatrix: o, SparseMatrix: s } = e, i = vA({ typed: t }), l = eQ({ typed: t, equalScalar: a }), u2 = mA({ typed: t, DenseMatrix: o }), c = Qd({ typed: t }), f = dh({ typed: t });
  return t(vQ, mx({ "DenseMatrix, DenseMatrix": function(p, d) {
    return c(p, d, n);
  }, "DenseMatrix, SparseMatrix": function(p, d) {
    return i(p, d, n, false);
  }, "SparseMatrix, DenseMatrix": function(p, d) {
    return i(d, p, n, true);
  }, "SparseMatrix, SparseMatrix": function(p, d) {
    return l(p, d, n);
  }, "Array, Array": function(p, d) {
    return this(r(p), r(d)).valueOf();
  }, "Array, Matrix": function(p, d) {
    return this(r(p), d);
  }, "Matrix, Array": function(p, d) {
    return this(p, r(d));
  }, "DenseMatrix, any": function(p, d) {
    return f(p, d, n, false);
  }, "SparseMatrix, any": function(p, d) {
    return u2(p, d, n, false);
  }, "any, DenseMatrix": function(p, d) {
    return f(d, p, n, true);
  }, "any, SparseMatrix": function(p, d) {
    return u2(d, p, n, true);
  }, "Array, any": function(p, d) {
    return f(r(p), d, n, false).valueOf();
  }, "any, Array": function(p, d) {
    return f(r(d), p, n, true).valueOf();
  }, "any, any": n, "any, any, ...any": function(p, d, v) {
    for (var m = this(p, d), g = 0; g < v.length; g++) m = this(m, v[g]);
    return m;
  } }, n.signatures));
});
var mQ = "dot";
var Wot = ["typed", "addScalar", "multiplyScalar", "conj", "size"];
var $N = ia(mQ, Wot, (e) => {
  var { typed: t, addScalar: r, multiplyScalar: n, conj: a, size: o } = e;
  return t(mQ, { "Array | DenseMatrix, Array | DenseMatrix": i, "SparseMatrix, SparseMatrix": l });
  function s(c, f) {
    var h = u2(c), p = u2(f), d, v;
    if (h.length === 1) d = h[0];
    else if (h.length === 2 && h[1] === 1) d = h[0];
    else throw new RangeError("Expected a column vector, instead got a matrix of size (" + h.join(", ") + ")");
    if (p.length === 1) v = p[0];
    else if (p.length === 2 && p[1] === 1) v = p[0];
    else throw new RangeError("Expected a column vector, instead got a matrix of size (" + p.join(", ") + ")");
    if (d !== v) throw new RangeError("Vectors must have equal length (" + d + " != " + v + ")");
    if (d === 0) throw new RangeError("Cannot calculate the dot product of empty vectors");
    return d;
  }
  function i(c, f) {
    var h = s(c, f), p = ts(c) ? c._data : c, d = ts(c) ? c._datatype : void 0, v = ts(f) ? f._data : f, m = ts(f) ? f._datatype : void 0, g = u2(c).length === 2, x = u2(f).length === 2, b = r, y = n;
    if (d && m && d === m && typeof d == "string") {
      var w = d;
      b = t.find(r, [w, w]), y = t.find(n, [w, w]);
    }
    if (!g && !x) {
      for (var _4 = y(a(p[0]), v[0]), k = 1; k < h; k++) _4 = b(_4, y(a(p[k]), v[k]));
      return _4;
    }
    if (!g && x) {
      for (var T2 = y(a(p[0]), v[0][0]), A2 = 1; A2 < h; A2++) T2 = b(T2, y(a(p[A2]), v[A2][0]));
      return T2;
    }
    if (g && !x) {
      for (var S2 = y(a(p[0][0]), v[0]), C2 = 1; C2 < h; C2++) S2 = b(S2, y(a(p[C2][0]), v[C2]));
      return S2;
    }
    if (g && x) {
      for (var E2 = y(a(p[0][0]), v[0][0]), F13 = 1; F13 < h; F13++) E2 = b(E2, y(a(p[F13][0]), v[F13][0]));
      return E2;
    }
  }
  function l(c, f) {
    s(c, f);
    for (var h = c._index, p = c._values, d = f._index, v = f._values, m = 0, g = r, x = n, b = 0, y = 0; b < h.length && y < d.length; ) {
      var w = h[b], _4 = d[y];
      if (w < _4) {
        b++;
        continue;
      }
      if (w > _4) {
        y++;
        continue;
      }
      w === _4 && (m = g(m, x(p[b], v[y])), b++, y++);
    }
    return m;
  }
  function u2(c) {
    return ts(c) ? c.size() : o(c);
  }
});
var gQ = "lup";
var Got = ["typed", "matrix", "abs", "addScalar", "divideScalar", "multiplyScalar", "subtract", "larger", "equalScalar", "unaryMinus", "DenseMatrix", "SparseMatrix", "Spa"];
var HN = ia(gQ, Got, (e) => {
  var { typed: t, matrix: r, abs: n, addScalar: a, divideScalar: o, multiplyScalar: s, subtract: i, larger: l, equalScalar: u2, unaryMinus: c, DenseMatrix: f, SparseMatrix: h, Spa: p } = e;
  return t(gQ, { DenseMatrix: function(g) {
    return d(g);
  }, SparseMatrix: function(g) {
    return v(g);
  }, Array: function(g) {
    var x = r(g), b = d(x);
    return { L: b.L.valueOf(), U: b.U.valueOf(), p: b.p };
  } });
  function d(m) {
    var g = m._size[0], x = m._size[1], b = Math.min(g, x), y = tl(m._data), w = [], _4 = [g, b], k = [], T2 = [b, x], A2, S2, C2, E2 = [];
    for (A2 = 0; A2 < g; A2++) E2[A2] = A2;
    for (S2 = 0; S2 < x; S2++) {
      if (S2 > 0) for (A2 = 0; A2 < g; A2++) {
        var F13 = Math.min(A2, S2), N2 = 0;
        for (C2 = 0; C2 < F13; C2++) N2 = a(N2, s(y[A2][C2], y[C2][S2]));
        y[A2][S2] = i(y[A2][S2], N2);
      }
      var D2 = S2, I2 = 0, O2 = 0;
      for (A2 = S2; A2 < g; A2++) {
        var L2 = y[A2][S2], V2 = n(L2);
        l(V2, I2) && (D2 = A2, I2 = V2, O2 = L2);
      }
      if (S2 !== D2 && (E2[S2] = [E2[D2], E2[D2] = E2[S2]][0], f._swapRows(S2, D2, y)), S2 < g) for (A2 = S2 + 1; A2 < g; A2++) {
        var W2 = y[A2][S2];
        u2(W2, 0) || (y[A2][S2] = o(y[A2][S2], O2));
      }
    }
    for (S2 = 0; S2 < x; S2++) for (A2 = 0; A2 < g; A2++) {
      if (S2 === 0 && (A2 < x && (k[A2] = []), w[A2] = []), A2 < S2) {
        A2 < x && (k[A2][S2] = y[A2][S2]), S2 < g && (w[A2][S2] = 0);
        continue;
      }
      if (A2 === S2) {
        A2 < x && (k[A2][S2] = y[A2][S2]), S2 < g && (w[A2][S2] = 1);
        continue;
      }
      A2 < x && (k[A2][S2] = 0), S2 < g && (w[A2][S2] = y[A2][S2]);
    }
    var X2 = new f({ data: w, size: _4 }), Y2 = new f({ data: k, size: T2 }), K2 = [];
    for (A2 = 0, b = E2.length; A2 < b; A2++) K2[E2[A2]] = A2;
    return { L: X2, U: Y2, p: K2, toString: function() {
      return "L: " + this.L.toString() + `
U: ` + this.U.toString() + `
P: ` + this.p;
    } };
  }
  function v(m) {
    var g = m._size[0], x = m._size[1], b = Math.min(g, x), y = m._values, w = m._index, _4 = m._ptr, k = [], T2 = [], A2 = [], S2 = [g, b], C2 = [], E2 = [], F13 = [], N2 = [b, x], D2, I2, O2, L2 = [], V2 = [];
    for (D2 = 0; D2 < g; D2++) L2[D2] = D2, V2[D2] = D2;
    var W2 = function(K2, q) {
      var re = V2[K2], R2 = V2[q];
      L2[re] = q, L2[R2] = K2, V2[K2] = R2, V2[q] = re;
    }, X2 = function() {
      var K2 = new p();
      I2 < g && (A2.push(k.length), k.push(1), T2.push(I2)), F13.push(C2.length);
      var q = _4[I2], re = _4[I2 + 1];
      for (O2 = q; O2 < re; O2++) D2 = w[O2], K2.set(L2[D2], y[O2]);
      I2 > 0 && K2.forEach(0, I2 - 1, function(te, j) {
        h._forEachRow(te, k, T2, A2, function(Q2, Z2) {
          Q2 > te && K2.accumulate(Q2, c(s(Z2, j)));
        });
      });
      var R2 = I2, z = K2.get(I2), H2 = n(z);
      K2.forEach(I2 + 1, g - 1, function(te, j) {
        var Q2 = n(j);
        l(Q2, H2) && (R2 = te, H2 = Q2, z = j);
      }), I2 !== R2 && (h._swapRows(I2, R2, S2[1], k, T2, A2), h._swapRows(I2, R2, N2[1], C2, E2, F13), K2.swap(I2, R2), W2(I2, R2)), K2.forEach(0, g - 1, function(te, j) {
        te <= I2 ? (C2.push(j), E2.push(te)) : (j = o(j, z), u2(j, 0) || (k.push(j), T2.push(te)));
      });
    };
    for (I2 = 0; I2 < x; I2++) X2();
    return F13.push(C2.length), A2.push(k.length), { L: new h({ values: k, index: T2, ptr: A2, size: S2 }), U: new h({ values: C2, index: E2, ptr: F13, size: N2 }), p: L2, toString: function() {
      return "L: " + this.L.toString() + `
U: ` + this.U.toString() + `
P: ` + this.p;
    } };
  }
});
var yQ = "det";
var $ot = ["typed", "matrix", "subtract", "multiply", "unaryMinus", "lup"];
var qN = ia(yQ, $ot, (e) => {
  var { typed: t, matrix: r, subtract: n, multiply: a, unaryMinus: o, lup: s } = e;
  return t(yQ, { any: function(u2) {
    return tl(u2);
  }, "Array | Matrix": function(u2) {
    var c;
    switch (ts(u2) ? c = u2.size() : Array.isArray(u2) ? (u2 = r(u2), c = u2.size()) : c = [], c.length) {
      case 0:
        return tl(u2);
      case 1:
        if (c[0] === 1) return tl(u2.valueOf()[0]);
        throw new RangeError("Matrix must be square (size: " + Pl(c) + ")");
      case 2: {
        var f = c[0], h = c[1];
        if (f === h) return i(u2.clone().valueOf(), f, h);
        throw new RangeError("Matrix must be square (size: " + Pl(c) + ")");
      }
      default:
        throw new RangeError("Matrix must be two dimensional (size: " + Pl(c) + ")");
    }
  } });
  function i(l, u2, c) {
    if (u2 === 1) return tl(l[0][0]);
    if (u2 === 2) return n(a(l[0][0], l[1][1]), a(l[1][0], l[0][1]));
    for (var f = s(l), h = f.U[0][0], p = 1; p < u2; p++) h = a(h, f.U[p][p]);
    for (var d = 0, v = 0, m = []; ; ) {
      for (; m[v]; ) v++;
      if (v >= u2) break;
      for (var g = v, x = 0; !m[f.p[g]]; ) m[f.p[g]] = true, g = f.p[g], x++;
      x % 2 === 0 && d++;
    }
    return d % 2 === 0 ? h : o(h);
  }
});
var xQ = "inv";
var Hot = ["typed", "matrix", "divideScalar", "addScalar", "multiply", "unaryMinus", "det", "identity", "abs"];
var XN = ia(xQ, Hot, (e) => {
  var { typed: t, matrix: r, divideScalar: n, addScalar: a, multiply: o, unaryMinus: s, det: i, identity: l, abs: u2 } = e;
  return t(xQ, { "Array | Matrix": function(h) {
    var p = ts(h) ? h.size() : vc(h);
    switch (p.length) {
      case 1:
        if (p[0] === 1) return ts(h) ? r([n(1, h.valueOf()[0])]) : [n(1, h[0])];
        throw new RangeError("Matrix must be square (size: " + Pl(p) + ")");
      case 2: {
        var d = p[0], v = p[1];
        if (d === v) return ts(h) ? r(c(h.valueOf(), d, v), h.storage()) : c(h, d, v);
        throw new RangeError("Matrix must be square (size: " + Pl(p) + ")");
      }
      default:
        throw new RangeError("Matrix must be two dimensional (size: " + Pl(p) + ")");
    }
  }, any: function(h) {
    return n(1, h);
  } });
  function c(f, h, p) {
    var d, v, m, g, x;
    if (h === 1) {
      if (g = f[0][0], g === 0) throw Error("Cannot calculate inverse, determinant is zero");
      return [[n(1, g)]];
    } else if (h === 2) {
      var b = i(f);
      if (b === 0) throw Error("Cannot calculate inverse, determinant is zero");
      return [[n(f[1][1], b), n(s(f[0][1]), b)], [n(s(f[1][0]), b), n(f[0][0], b)]];
    } else {
      var y = f.concat();
      for (d = 0; d < h; d++) y[d] = y[d].concat();
      for (var w = l(h).valueOf(), _4 = 0; _4 < p; _4++) {
        var k = u2(y[_4][_4]), T2 = _4;
        for (d = _4 + 1; d < h; ) u2(y[d][_4]) > k && (k = u2(y[d][_4]), T2 = d), d++;
        if (k === 0) throw Error("Cannot calculate inverse, determinant is zero");
        d = T2, d !== _4 && (x = y[_4], y[_4] = y[d], y[d] = x, x = w[_4], w[_4] = w[d], w[d] = x);
        var A2 = y[_4], S2 = w[_4];
        for (d = 0; d < h; d++) {
          var C2 = y[d], E2 = w[d];
          if (d !== _4) {
            if (C2[_4] !== 0) {
              for (m = n(s(C2[_4]), A2[_4]), v = _4; v < p; v++) C2[v] = a(C2[v], o(m, A2[v]));
              for (v = 0; v < p; v++) E2[v] = a(E2[v], o(m, S2[v]));
            }
          } else {
            for (m = A2[_4], v = _4; v < p; v++) C2[v] = n(C2[v], m);
            for (v = 0; v < p; v++) E2[v] = n(E2[v], m);
          }
        }
      }
      return w;
    }
  }
});
var qot = "divide";
var Xot = ["typed", "matrix", "multiply", "equalScalar", "divideScalar", "inv"];
var KN = ia(qot, Xot, (e) => {
  var { typed: t, matrix: r, multiply: n, equalScalar: a, divideScalar: o, inv: s } = e, i = dA({ typed: t, equalScalar: a }), l = dh({ typed: t });
  return t("divide", mx({ "Array | Matrix, Array | Matrix": function(c, f) {
    return n(c, s(f));
  }, "DenseMatrix, any": function(c, f) {
    return l(c, f, o, false);
  }, "SparseMatrix, any": function(c, f) {
    return i(c, f, o, false);
  }, "Array, any": function(c, f) {
    return l(r(c), f, o, false).valueOf();
  }, "any, Array | Matrix": function(c, f) {
    return n(c, s(f));
  } }, o.signatures));
});
var bQ = "mean";
var Kot = ["typed", "add", "divide"];
var YN = ia(bQ, Kot, (e) => {
  var { typed: t, add: r, divide: n } = e;
  return t(bQ, { "Array | Matrix": o, "Array | Matrix, number | BigNumber": a, "...": function(i) {
    if (fA(i)) throw new TypeError("Scalar values expected in function mean");
    return o(i);
  } });
  function a(s, i) {
    try {
      var l = GJ(s, i, r), u2 = Array.isArray(s) ? vc(s) : s.size();
      return n(l, u2[i]);
    } catch (c) {
      throw Xv(c, "mean");
    }
  }
  function o(s) {
    var i, l = 0;
    if (bx(s, function(u2) {
      try {
        i = i === void 0 ? u2 : r(i, u2), l++;
      } catch (c) {
        throw Xv(c, "mean", u2);
      }
    }), l === 0) throw new Error("Cannot calculate the mean of an empty array");
    return n(i, l);
  }
});
var _Q = "median";
var Yot = ["typed", "add", "divide", "compare", "partitionSelect"];
var ZN = ia(_Q, Yot, (e) => {
  var { typed: t, add: r, divide: n, compare: a, partitionSelect: o } = e;
  function s(u2) {
    try {
      u2 = w_(u2.valueOf());
      var c = u2.length;
      if (c === 0) throw new Error("Cannot calculate median of an empty array");
      if (c % 2 === 0) {
        for (var f = c / 2 - 1, h = o(u2, f + 1), p = u2[f], d = 0; d < f; ++d) a(u2[d], p) > 0 && (p = u2[d]);
        return l(p, h);
      } else {
        var v = o(u2, (c - 1) / 2);
        return i(v);
      }
    } catch (m) {
      throw Xv(m, "median");
    }
  }
  var i = t({ "number | BigNumber | Complex | Unit": function(c) {
    return c;
  } }), l = t({ "number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit": function(c, f) {
    return n(r(c, f), 2);
  } });
  return t(_Q, { "Array | Matrix": s, "Array | Matrix, number | BigNumber": function(c, f) {
    throw new Error("median(A, dim) is not yet supported");
  }, "...": function(c) {
    if (fA(c)) throw new TypeError("Scalar values expected in function median");
    return s(c);
  } });
});
var JN = "unbiased";
var wQ = "variance";
var Zot = ["typed", "add", "subtract", "multiply", "divide", "apply", "isNaN"];
var QN = ia(wQ, Zot, (e) => {
  var { typed: t, add: r, subtract: n, multiply: a, divide: o, apply: s, isNaN: i } = e;
  return t(wQ, { "Array | Matrix": function(f) {
    return l(f, JN);
  }, "Array | Matrix, string": l, "Array | Matrix, number | BigNumber": function(f, h) {
    return u2(f, h, JN);
  }, "Array | Matrix, number | BigNumber, string": u2, "...": function(f) {
    return l(f, JN);
  } });
  function l(c, f) {
    var h, p = 0;
    if (c.length === 0) throw new SyntaxError("Function variance requires one or more parameters (0 provided)");
    if (bx(c, function(m) {
      try {
        h = h === void 0 ? m : r(h, m), p++;
      } catch (g) {
        throw Xv(g, "variance", m);
      }
    }), p === 0) throw new Error("Cannot calculate variance of an empty array");
    var d = o(h, p);
    if (h = void 0, bx(c, function(m) {
      var g = n(m, d);
      h = h === void 0 ? a(g, g) : r(h, a(g, g));
    }), i(h)) return h;
    switch (f) {
      case "uncorrected":
        return o(h, p);
      case "biased":
        return o(h, p + 1);
      case "unbiased": {
        var v = uu(h) ? h.mul(0) : 0;
        return p === 1 ? v : o(h, p - 1);
      }
      default:
        throw new Error('Unknown normalization "' + f + '". Choose "unbiased" (default), "uncorrected", or "biased".');
    }
  }
  function u2(c, f, h) {
    try {
      if (c.length === 0) throw new SyntaxError("Function variance requires one or more parameters (0 provided)");
      return s(c, f, (p) => l(p, h));
    } catch (p) {
      throw Xv(p, "variance");
    }
  }
});
var kQ = "std";
var Jot = ["typed", "sqrt", "variance"];
var eF = ia(kQ, Jot, (e) => {
  var { typed: t, sqrt: r, variance: n } = e;
  return t(kQ, { "Array | Matrix": a, "Array | Matrix, string": a, "Array | Matrix, number | BigNumber": a, "Array | Matrix, number | BigNumber, string": a, "...": function(s) {
    return a(s);
  } });
  function a(o, s) {
    if (o.length === 0) throw new SyntaxError("Function std requires one or more parameters (0 provided)");
    try {
      return r(n.apply(null, arguments));
    } catch (i) {
      throw i instanceof TypeError && i.message.indexOf(" variance") !== -1 ? new TypeError(i.message.replace(" variance", " std")) : i;
    }
  }
});
var bA = nN({ config: Jd });
var TQ = iN({});
var tF = sN({});
var rF = lN({});
var P0 = uN({ Matrix: rF });
var $o = tN({ BigNumber: bA, Complex: TQ, DenseMatrix: P0, Fraction: tF });
var AQ = AN({ typed: $o });
var Vg = EN({ typed: $o });
var Qot = _N({ BigNumber: bA, typed: $o });
var est = NN({ typed: $o });
var Kv = yN({ config: Jd, typed: $o });
var tst = cN({ typed: $o });
var nF = DN({ typed: $o });
var rst = bN({ typed: $o });
var _A = xN({ Matrix: rF, equalScalar: Kv, typed: $o });
var nst = SN({ isInteger: tst, typed: $o });
var aF = gN({ typed: $o });
var ast = MN({ Complex: TQ, config: Jd, typed: $o });
var wA = TN({ typed: $o });
var ist = wN({ Fraction: tF, typed: $o });
var SQ = mN({ typed: $o });
var kp = kN({ DenseMatrix: P0, Matrix: rF, SparseMatrix: _A, typed: $o });
var ost = LN({ bignumber: Qot, fraction: ist, number: rst });
var sst = ON({ matrix: kp, config: Jd, typed: $o });
var lst = BN({ DenseMatrix: P0, config: Jd, matrix: kp, typed: $o });
var iF = IN({ DenseMatrix: P0, addScalar: Vg, equalScalar: Kv, matrix: kp, typed: $o, unaryMinus: wA });
var EQ = zN({ BigNumber: bA, DenseMatrix: P0, Fraction: tF, config: Jd, equalScalar: Kv, matrix: kp, typed: $o });
var oF = RN({ numeric: ost, typed: $o });
var wx = PN({ isNaN: aF, isNumeric: SQ, typed: $o });
var ust = VN({ compare: EQ, isNaN: aF, isNumeric: SQ, typed: $o });
var sF = GN({ DenseMatrix: P0, SparseMatrix: _A, addScalar: Vg, equalScalar: Kv, matrix: kp, typed: $o });
var cst = $N({ addScalar: Vg, conj: est, multiplyScalar: nF, size: sst, typed: $o });
var fst = FN({ BigNumber: bA, DenseMatrix: P0, SparseMatrix: _A, config: Jd, matrix: kp, typed: $o });
var DQ = UN({ DenseMatrix: P0, config: Jd, matrix: kp, typed: $o });
var kA = CN({ addScalar: Vg, dot: cst, equalScalar: Kv, matrix: kp, multiplyScalar: nF, typed: $o });
var hst = jN({ larger: DQ, smaller: lst });
var pst = WN({ FibonacciHeap: hst, addScalar: Vg, equalScalar: Kv });
var dst = HN({ DenseMatrix: P0, Spa: pst, SparseMatrix: _A, abs: AQ, addScalar: Vg, divideScalar: oF, equalScalar: Kv, larger: DQ, matrix: kp, multiplyScalar: nF, subtract: iF, typed: $o, unaryMinus: wA });
var vst = qN({ lup: dst, matrix: kp, multiply: kA, subtract: iF, typed: $o, unaryMinus: wA });
var mst = XN({ abs: AQ, addScalar: Vg, det: vst, divideScalar: oF, identity: fst, matrix: kp, multiply: kA, typed: $o, unaryMinus: wA });
var lF = KN({ divideScalar: oF, equalScalar: Kv, inv: mst, matrix: kp, multiply: kA, typed: $o });
var CQ = YN({ add: sF, divide: lF, typed: $o });
var jg = ZN({ add: sF, compare: EQ, divide: lF, partitionSelect: ust, typed: $o });
var Yv = QN({ add: sF, apply: nst, divide: lF, isNaN: aF, multiply: kA, subtract: iF, typed: $o });
var Wg = eF({ sqrt: ast, typed: $o, variance: Yv });
function gst(e, t) {
  let r = {}, n = {}, a = 0;
  for (let o = 0; o < e.length; o++) {
    let s = e[o], i;
    s instanceof Na ? i = s.getColumnData : i = [s.values];
    let l = s.columns;
    for (let u2 = 0; u2 < l.length; u2++) {
      let c = l[u2], f = i[u2];
      f.length > a && (a = f.length), c in r ? (n[c] += 1, c += n[c], r[c] = f) : (r[c] = f, n[c] = 0);
    }
  }
  return Object.keys(r).forEach((o) => {
    let s = r[o].length;
    if (s < a) {
      let i = a - s, l = new Array(i).fill(NaN);
      r[o].push(...l);
    }
  }), new Na(r);
}
function yst(e, t) {
  let r = {}, n = 0;
  for (let a = 0; a < e.length; a++) {
    let o = e[a], s = o.columns, i;
    if (o instanceof Na ? i = o.getColumnData : i = [o.values], a === 0) for (let l = 0; l < s.length; l++) {
      let u2 = s[l], c = i[l];
      r[u2] = c;
    }
    else {
      let l = Object.keys(r).filter((u2) => !s.includes(u2));
      for (let u2 = 0; u2 < s.length; u2++) {
        let c = s[u2], f = i[u2];
        if (Object.keys(r).includes(c)) r[c].push(...f);
        else {
          let h = new Array(n).fill(NaN);
          h.push(...f), r[c] = h;
        }
      }
      if (l.length > 0) {
        let u2 = i[0].length;
        for (let c = 0; c < l.length; c++) {
          let f = l[c], h = new Array(u2).fill(NaN);
          r[f].push(...h);
        }
      }
    }
    n += i[0].length;
  }
  return Object.keys(r).length === 1 ? new ea(Object.values(r)[0]) : new Na(r);
}
function xst({ dfList: e, axis: t }) {
  return t === 1 ? gst(e, t) : yst(e, 0);
}
var TA = xst;
var Gg = class {
  colDict = {};
  keyCol;
  data;
  columnName;
  colDtype;
  colIndex;
  groupDict;
  groupColNames;
  keyToValue = {};
  constructor(t, r, n, a, o) {
    this.keyCol = t, this.data = r, this.columnName = n, this.colDtype = a, this.colIndex = o;
  }
  group() {
    let t = this, r = {}, n = this.data?.reduce((a, o) => {
      let s = [];
      for (let l in t.colIndex) {
        let u2 = t.colIndex[l];
        s.push(o[u2]);
      }
      let i = s.join("-");
      if (r[i] || (r[i] = s), a[i]) {
        let l = a[i];
        for (let u2 in t.columnName) {
          let c = t.columnName[u2];
          l[c].push(o[u2]);
        }
      } else {
        a[i] = {};
        for (let l in t.columnName) {
          let u2 = t.columnName[l];
          a[i][u2] = [o[l]];
        }
      }
      return a;
    }, {});
    return this.colDict = n, this.keyToValue = r, this;
  }
  col(t) {
    typeof t > "u" && (t = this.columnName.filter((o, s) => !this.colIndex.includes(s)));
    let r = this;
    t.forEach((o) => {
      if (!r.columnName.includes(o)) throw new Error(`Column ${o} does not exist in groups`);
    });
    let n = __spreadValues({}, this.colDict);
    for (let [o, s] of Object.entries(n)) {
      let i = {}, l = __spreadValues({}, s);
      for (let u2 in t) {
        let c = t[u2];
        i[c] = l[c];
      }
      n[o] = i;
    }
    let a = new Gg(this.keyCol, null, this.columnName, this.colDtype, this.colIndex);
    return a.colDict = n, a.groupColNames = t, a.keyToValue = this.keyToValue, a;
  }
  arithemetic(t) {
    let r = ["mean", "sum", "count", "mode", "std", "var", "cumsum", "cumprod", "cummax", "cummin", "median", "min", "max"];
    if (typeof t == "string") {
      if (!r.includes(t)) throw new Error(`group operation: ${t} is not valid`);
    } else Object.keys(t).forEach((a) => {
      let o = t[a];
      if (Array.isArray(o)) {
        for (let s of o) if (!r.includes(s)) throw new Error(`group operation: ${s} for column ${a} is not valid`);
      } else if (!r.includes(o)) throw new Error(`group operation: ${o} for column ${a} is not valid`);
    });
    let n = __spreadValues({}, this.colDict);
    for (let [a, o] of Object.entries(n)) {
      let s = {}, i = __spreadValues({}, o), l = this.groupColNames;
      for (let u2 = 0; u2 < l.length; u2++) {
        let c = l[u2], f = this.columnName.indexOf(c), h = this.colDtype[f], p = typeof t == "string" ? t : t[c];
        if (h === "string" && p !== "count") throw new Error(`Can't perform math operation on column ${c}`);
        if (typeof t == "string") {
          let d = `${c}_${t}`;
          s[d] = this.groupMathLog(i[c], t);
        } else if (Array.isArray(t[c])) for (let d of t[c]) {
          let v = `${c}_${d}`;
          s[v] = this.groupMathLog(i[c], d);
        }
        else {
          let d = t[c], v = `${c}_${d}`;
          s[v] = this.groupMathLog(i[c], d);
        }
      }
      n[a] = s;
    }
    return n;
  }
  groupMathLog(t, r) {
    let n = [];
    switch (r) {
      case "max":
        let a = t.reduce((l, u2) => l > u2 ? l : u2);
        n.push(a);
        break;
      case "min":
        let o = t.reduce((l, u2) => l < u2 ? l : u2);
        n.push(o);
        break;
      case "sum":
        let s = t.reduce((l, u2) => l + u2);
        n.push(s);
        break;
      case "count":
        n.push(t.length);
        break;
      case "mean":
        let i = t.reduce((l, u2) => l + u2);
        n.push(i / t.length);
        break;
      case "std":
        n.push(Wg(t));
        break;
      case "var":
        n.push(Yv(t));
        break;
      case "median":
        n.push(jg(t));
        break;
      case "mode":
        n.push(wx(t));
        break;
      case "cumsum":
        t.reduce((l, u2) => {
          let c = l + u2;
          return n.push(c), c;
        }, 0);
        break;
      case "cummin":
        n = [t[0]], t.slice(1).reduce((l, u2) => l < u2 ? (n.push(l), l) : (n.push(u2), u2), n[0]);
        break;
      case "cummax":
        n = [t[0]], t.slice(1).reduce((l, u2) => l > u2 ? (n.push(l), l) : (n.push(u2), u2), n[0]);
        break;
      case "cumprod":
        t.reduce((l, u2) => {
          let c = l * u2;
          return n.push(c), c;
        }, 1);
        break;
    }
    return n;
  }
  toDataFrame(t) {
    let r = {};
    for (let n of this.colKeyDict(t)) {
      let a = t[n], o = {}, i = Object.values(a)[0].length;
      for (let u2 in this.keyCol) {
        let c = this.keyCol[u2], f = this.keyToValue[n][u2];
        o[c] = Array(i).fill(f);
      }
      let l = __spreadValues(__spreadValues({}, o), a);
      if (Object.keys(r).length < 1) r = l;
      else for (let u2 of Object.keys(r)) {
        let c = l[u2];
        r[u2] = [...r[u2], ...c];
      }
    }
    return new Na(r);
  }
  operations(t) {
    if (!this.groupColNames) {
      let a = this.col(void 0), o = a.arithemetic(t);
      return a.toDataFrame(o);
    }
    let r = this.arithemetic(t);
    return this.toDataFrame(r);
  }
  count() {
    return this.operations("count");
  }
  sum() {
    return this.operations("sum");
  }
  std() {
    return this.operations("std");
  }
  var() {
    return this.operations("var");
  }
  mean() {
    return this.operations("mean");
  }
  cumSum() {
    return this.operations("cumsum");
  }
  cumMax() {
    return this.operations("cummax");
  }
  cumProd() {
    return this.operations("cumprod");
  }
  cumMin() {
    return this.operations("cummin");
  }
  max() {
    return this.operations("max");
  }
  min() {
    return this.operations("min");
  }
  getGroup(t) {
    let r = t.join("-"), n = {};
    return n[r] = __spreadValues({}, this.colDict[r]), this.toDataFrame(n);
  }
  agg(t) {
    let r = Object.keys(t), n = this.col(r), a = n.arithemetic(t);
    return n.toDataFrame(a);
  }
  apply(t) {
    let r = {};
    for (let n of this.colKeyDict(this.colDict)) {
      let a = new Na(this.colDict[n]);
      r[n] = t(a);
    }
    return this.concatGroups(r);
  }
  concatGroups(t) {
    let r = [];
    for (let [n, a] of Object.entries(t)) {
      let o;
      if (a instanceof Na) o = a.copy();
      else {
        let l = a.index;
        l = l.length > 1 ? l : ["applyOps"], o = new Na([a.values], { columns: l });
      }
      let s = o.shape[0], i;
      for (i in this.keyCol) {
        let l = this.keyCol[i], u2 = this.keyToValue[n][i], c = Array(s).fill(u2), f = parseInt(i);
        this.groupColNames ? o.addColumn(l, c, { inplace: true, atIndex: f }) : o.addColumn(`${l}_Group`, c, { inplace: true, atIndex: f });
      }
      r.push(o);
    }
    return TA({ dfList: r, axis: 0 });
  }
  get ngroups() {
    return Object.keys(this.colDict).length;
  }
  get groups() {
    return this.colDict;
  }
  first() {
    return this.apply((t) => t.head(1));
  }
  last() {
    return this.apply((t) => t.tail(1));
  }
  size() {
    return this.apply((t) => new ea([t.shape[0]]));
  }
  colKeyDict(t) {
    let r = {};
    for (let a of Object.keys(t)) {
      let o = a.split("-")[0];
      o in r ? r[o].push(a) : r[o] = [a];
    }
    let n = [];
    for (let a of Object.keys(r)) n.push(...r[a]);
    return n;
  }
};
var AA = new hs();
function T_({ ndFrame: e, rows: t, columns: r }) {
  let n, a, o = e.values, s = e.index;
  if (t instanceof ea && (t = t.values), t !== void 0 && !Array.isArray(t)) throw new Error('rows parameter must be an Array. For example: rows: [1,2] or rows: ["0:10"]');
  if (r !== void 0 && !Array.isArray(r)) throw new Error('columns parameter must be an Array. For example: columns: [1,2] or columns: ["0:10"]');
  if (!t) n = AA.range(0, e.shape[0] - 1);
  else if (t.length == 1 && typeof t[0] == "string") {
    let i = t[0].split(":");
    if (i.length != 2) throw new Error('Invalid row split parameter: If using row split string, it must be of the form; rows: ["start:end"]');
    if (isNaN(parseInt(i[0])) && i[0] != "") throw new Error("Invalid row split parameter. Split parameter must be a number");
    if (isNaN(parseInt(i[1])) && i[1] != "") throw new Error("Invalid row split parameter. Split parameter must be a number");
    let l = i[0] == "" ? 0 : parseInt(i[0]), u2 = i[1] == "" ? e.shape[0] : parseInt(i[1]);
    if (l < 0) throw new Error("row slice [start] index cannot be less than 0");
    if (u2 > e.shape[0]) throw new Error(`row slice [end] index cannot be bigger than ${e.shape[0]}`);
    n = AA.range(l, u2 - 1);
  } else {
    let i = [];
    for (let l = 0; l < t.length; l++) {
      let u2 = t[l];
      if (u2 > e.shape[0]) throw new Error(`Invalid row parameter: Specified index ${u2} cannot be bigger than index length ${e.shape[0]}`);
      if (typeof u2 != "number" && typeof u2 != "boolean") throw new Error(`Invalid row parameter: row index ${u2} must be a number or boolean`);
      typeof u2 == "boolean" && u2 === true && i.push(s[l]), typeof u2 == "number" && i.push(u2);
    }
    n = i;
  }
  if (!r) a = AA.range(0, e.shape[1] - 1);
  else if (r.length == 1 && typeof r[0] == "string") {
    let i = r[0].split(":");
    if (i.length != 2) throw new Error('Invalid column split parameter: If using column split string, it must be of the form; columns: ["start:end"]');
    if (isNaN(parseInt(i[0])) && i[0] != "") throw new Error("Invalid column split parameter. Split parameter must be a number");
    if (isNaN(parseInt(i[1])) && i[1] != "") throw new Error("Invalid column split parameter. Split parameter must be a number");
    let l = i[0] == "" ? 0 : parseInt(i[0]), u2 = i[1] == "" ? e.shape[1] : parseInt(i[1]);
    if (l < 0) throw new Error("column slice [start] index cannot be less than 0");
    if (u2 > e.shape[1]) throw new Error(`column slice [end] index cannot be bigger than ${e.shape[1]}`);
    a = AA.range(l, u2 - 1);
  } else {
    for (let i = 0; i < r.length; i++) {
      let l = r[i];
      if (l > e.shape[1]) throw new Error(`Invalid column parameter: Specified index ${l} cannot be bigger than index length ${e.shape[1]}`);
      if (typeof l != "number") throw new Error(`Invalid column parameter: column index ${l} must be a number`);
    }
    a = r;
  }
  if (e instanceof ea) {
    let i = [], l = [];
    for (let c = 0; c < n.length; c++) {
      let f = n[c];
      i.push(o[f]), l.push(s[f]);
    }
    return new ea(i, { index: l, columns: e.columns, dtypes: e.dtypes, config: e.config });
  } else {
    let i = [], l = [], u2 = [], c = [];
    for (let h = 0; h < n.length; h++) {
      let p = n[h], d = o[p], v = [];
      for (let m = 0; m < a.length; m++) {
        let g = a[m];
        v.push(d[g]);
      }
      i.push(v), l.push(s[p]);
    }
    for (let h = 0; h < a.length; h++) {
      let p = a[h];
      u2.push(e.columns[p]), c.push(e.dtypes[p]);
    }
    return new Na(i, { index: l, columns: u2, dtypes: c, config: e.config });
  }
}
function A_({ ndFrame: e, rows: t, columns: r }) {
  let n, a, o = e.values, s = e.index;
  if (t instanceof ea && (t = t.values), t !== void 0 && !Array.isArray(t)) throw new Error('rows parameter must be an Array. For example: rows: [1,2] or rows: ["0:10"]');
  if (r !== void 0 && !Array.isArray(r)) throw new Error('columns parameter must be an Array. For example: columns: ["a","b"] or columns: ["a:c"]');
  if (!t) n = s.map((l) => s.indexOf(l));
  else if (t.length == 1 && typeof t[0] == "string") if (t[0].indexOf(":") === -1) {
    let l;
    if (t[0].startsWith('"') || t[0].startsWith("'") || t[0].startsWith("`") ? l = s.indexOf(t[0].replace(/['"`]/g, "")) : l = s.indexOf(Number(t[0])), l === -1) throw new Error(`IndexError: Specified index (${t[0]}) not found`);
    n = [l];
  } else {
    let l = t[0].split(":");
    if (l.length != 2) throw new Error('Invalid row split parameter: If using row split string, it must be of the form; rows: ["start:end"]');
    let u2, c;
    if (l[0] === "" ? u2 = s.indexOf(s[0]) : l[0].startsWith('"') || l[0].startsWith("'") || l[0].startsWith("`") ? u2 = s.indexOf(l[0].replace(/['"`]/g, "")) : u2 = s.indexOf(Number(l[0])), l[1] === "" ? c = s.indexOf(s[s.length - 1]) + 1 : l[0].startsWith('"') || l[0].startsWith("'") || l[0].startsWith("`") ? c = s.indexOf(l[1].replace(/['"`]/g, "")) : c = s.indexOf(Number(l[1])), u2 === -1) throw new Error("IndexError: Specified start index not found");
    if (c === -1) throw new Error("IndexError: Specified end index not found");
    n = s.slice(u2, c).map((f) => s.indexOf(f));
  }
  else {
    let l = [];
    for (let u2 = 0; u2 < t.length; u2++) {
      let c = typeof t[u2] == "boolean";
      if (c && t[u2] && l.push(s.indexOf(s[u2])), !c) {
        let f = s.indexOf(t[u2]);
        if (f === -1) throw new Error(`IndexError: Specified index (${t[u2]}) not found`);
        l.push(f);
      }
    }
    n = l;
  }
  let i = e.columns;
  if (!r) a = i.map((l) => i.indexOf(l));
  else if (r.length == 1) {
    if (typeof r[0] != "string") throw new Error('ColumnIndexError: columns parameter must be an array of a string name. For example: columns: ["b"]');
    if (r[0].indexOf(":") == -1) a = [i.indexOf(r[0])];
    else {
      let l = r[0].split(":");
      if (l.length != 2) throw new Error('ColumnIndexError: Invalid row split parameter. If using row split string, it must be of the form; rows: ["start:end"]');
      let u2 = l[0] == "" ? i.indexOf(i[0]) : i.indexOf(l[0]), c = l[1] == "" ? i.indexOf(i[i.length - 1]) : i.indexOf(l[1]);
      if (u2 === -1) throw new Error("ColumnIndexError: Specified start index not found");
      if (c === -1) throw new Error("ColumnIndexError: Specified end index not found");
      a = i.slice(u2, c + 1).map((f) => i.indexOf(f)), a.pop();
    }
  } else {
    for (let l = 0; l < r.length; l++) if (i.indexOf(r[l]) === -1) throw new Error(`ColumnIndexError: Specified column (${r[l]}) not found`);
    a = r.map((l) => i.indexOf(l));
  }
  if (e instanceof ea) {
    let l = [], u2 = [];
    for (let f = 0; f < n.length; f++) {
      let h = n[f];
      l.push(o[h]), u2.push(s[h]);
    }
    return new ea(l, { index: u2, columns: e.columns, dtypes: e.dtypes, config: e.config });
  } else {
    let l = [], u2 = [], c = [], f = [];
    for (let p = 0; p < n.length; p++) {
      let d = n[p], v = o[d], m = [];
      for (let g = 0; g < a.length; g++) {
        let x = a[g];
        m.push(v[x]);
      }
      l.push(m), u2.push(s[d]);
    }
    for (let p = 0; p < a.length; p++) {
      let d = a[p];
      c.push(e.columns[d]), f.push(e.dtypes[d]);
    }
    return new Na(l, { index: u2, columns: c, dtypes: f, config: e.config });
  }
}
var qte = km(e8());
var vh = (e, t) => (t.forEach((r) => {
  if (!e.columns.includes(r)) throw Error(`Column Error: ${r} not found in columns. Columns should be one of [ ${e.columns} ]`);
}), t);
var qs = (e, t) => {
  if (!e.columns.includes(t)) throw Error(`ParamError: specified column ${t} not found in columns`);
};
var t8 = (e, t, r, n) => {
  let a = r.config, o = r.layout;
  if (e instanceof ea) {
    let s = e.values, i = { x: e.index, y: s, type: "scatter", mode: "lines" };
    n.newPlot(t, [i], o, a);
  } else if (a.x && a.y) {
    qs(e, a.x), qs(e, a.y);
    let s = e[a.x].values, i = e[a.y].values, l = { x: s, y: i }, u2 = __spreadValues({ xaxis: { title: a.x }, yaxis: { title: a.y } }, o);
    n.newPlot(t, [l], u2, a);
  } else if (a.x || a.y) {
    if (a.x) {
      qs(e, a.x);
      let s = e[a.x].values, i = e.index, l = { x: s, y: i }, u2 = __spreadValues({ xaxis: { title: a.x }, yaxis: { title: "Index" } }, o);
      n.newPlot(t, [l], u2, a);
    }
    if (a.y) {
      qs(e, a.y);
      let s = e.index, i = e[a.y].values, l = { x: s, y: i }, u2 = __spreadValues({ xaxis: { title: "Index" }, yaxis: { title: a.y } }, o);
      n.newPlot(t, [l], u2, a);
    }
  } else {
    let s = a.columns ? vh(e, a.columns) : e.columns, i = [];
    s.forEach((l) => {
      let u2 = e.index, c = e[l].values, f = { x: u2, y: c, name: l };
      i.push(f);
    }), n.newPlot(t, i, o, a);
  }
};
var r8 = (e, t, r, n) => {
  let a = r.config, o = r.layout;
  if (e instanceof ea) {
    let s = { x: e.index, y: e.values, type: "bar" };
    n.newPlot(t, [s], o, a);
  } else if (a.x && a.y) {
    qs(e, a.x), qs(e, a.y);
    let s = e[a.x].values, i = e[a.y].values, l = { x: s, y: i, type: "bar" }, u2 = __spreadValues({ xaxis: { title: a.x }, yaxis: { title: a.y } }, o);
    n.newPlot(t, [l], u2, a);
  } else if (a.x || a.y) {
    if (a.x) {
      qs(e, a.x);
      let s = e[a.x].values, i = e.index, l = { x: s, y: i, type: "bar" }, u2 = __spreadValues({ xaxis: { title: a.x }, yaxis: { title: "Index" } }, o);
      n.newPlot(t, [l], u2, a);
    }
    if (a.y) {
      qs(e, a.y);
      let s = e.index, i = e[a.y].values, l = { x: s, y: i, type: "bar" }, u2 = __spreadValues({ xaxis: { title: "Index" }, yaxis: { title: a.y } }, o);
      n.newPlot(t, [l], u2, a);
    }
  } else {
    let s = a.columns ? vh(e, a.columns) : e.columns, i = [];
    s.forEach((l) => {
      let u2 = e.index, c = e[l].values, f = { x: u2, y: c, name: l, type: "bar" };
      i.push(f);
    }), n.newPlot(t, i, o, a);
  }
};
var n8 = (e, t, r, n) => {
  let a = r.config, o = r.layout;
  if (e instanceof ea) {
    let s = e.values, i = { x: e.index, y: s, type: "scatter", mode: "markers" };
    n.newPlot(t, [i], o, a);
  } else if (a.x && a.y) {
    qs(e, a.x), qs(e, a.y);
    let s = e[a.x].values, i = e[a.y].values, l = { x: s, y: i, type: "scatter", mode: "markers" }, u2 = __spreadValues({ xaxis: { title: a.x }, yaxis: { title: a.y } }, o);
    n.newPlot(t, [l], u2, a);
  } else if (a.x || a.y) {
    if (a.x) {
      qs(e, a.x);
      let s = e[a.x].values, i = e.index, l = { x: s, y: i, type: "scatter", mode: "markers" }, u2 = __spreadValues({ xaxis: { title: a.x }, yaxis: { title: "Index" } }, o);
      n.newPlot(t, [l], u2, a);
    }
    if (a.y) {
      qs(e, a.y);
      let s = e.index, i = e[a.y].values, l = { x: s, y: i, type: "scatter", mode: "markers" }, u2 = __spreadValues({ xaxis: { title: "Index" }, yaxis: { title: a.y } }, o);
      n.newPlot(t, [l], u2, a);
    }
  } else {
    let s = a.columns ? vh(e, a.columns) : e.columns, i = [];
    s.forEach((l) => {
      let u2 = e.index, f = { x: e[l].values, y: u2, name: l, type: "scatter", mode: "markers" };
      i.push(f);
    }), n.newPlot(t, i, o, a);
  }
};
var a8 = (e, t, r, n) => {
  let a = r.config, o = r.layout;
  if (e instanceof ea) {
    let s = { x: e.values, type: "histogram" };
    n.newPlot(t, [s], o, a);
  } else if (a.x || a.y) {
    if (a.x) {
      qs(e, a.x);
      let i = { x: e[a.x].values, type: "histogram" }, l = __spreadValues({ xaxis: { title: a.x } }, o);
      n.newPlot(t, [i], l, a);
    }
    if (a.y) {
      qs(e, a.y);
      let i = { y: e[a.y].values, type: "histogram" }, l = __spreadValues({ yaxis: { title: a.y } }, o);
      n.newPlot(t, [i], l, a);
    }
  } else {
    let s = a.columns ? vh(e, a.columns) : e.columns, i = [];
    s.forEach((l) => {
      let u2 = e.index, f = { x: e[l].values, y: u2, name: l, type: "histogram" };
      i.push(f);
    }), n.newPlot(t, i, o, a);
  }
};
var i8 = (e, t, r, n) => {
  let a = r.config, o = r.layout;
  if (e instanceof ea) {
    let s = { values: e.values, labels: a.labels || e.index, type: "pie", name: a.labels, hoverinfo: "label+percent+name", automargin: true };
    n.newPlot(t, [s], o, a);
  } else if (a.labels) {
    if (!e.columns.includes(a.labels)) throw Error(`Column Error: ${a.labels} not found in columns. Param "labels" name must be one of [ ${e.columns}]`);
    if (a.values) {
      if (!e.columns.includes(a.values)) throw Error(`Column Error: ${a.values} not found in columns. Param "values" name must be one of [ ${e.columns}]`);
      let s = { values: e[a.values].values, labels: e[a.labels].values, type: "pie", name: a.labels, hoverinfo: "label+percent+name", automargin: true };
      n.newPlot(t, [s], o, a);
    } else {
      let s = a.columns ? vh(e, a.columns) : e.columns;
      if (a.rowPositions) {
        if (a.rowPositions.length != s.length) throw Error(`length of rowPositions array must be equal to number of columns. Got ${a.rowPositions.length}, expected ${s.length - 1}`);
      } else {
        let u2 = [];
        for (let c = 0; c < s.length - 1; c++) u2.push(0);
        a.rowPositions = u2;
      }
      if (a.columnPositions) {
        if (a.columnPositions.length != s.length) throw Error(`length of columnPositions array must be equal to number of columns. Got ${a.columnPositions.length}, expected ${s.length - 1}`);
      } else {
        let u2 = [];
        for (let c = 0; c < s.length - 1; c++) u2.push(c);
        a.columnPositions = u2;
      }
      let i = [];
      s.forEach((u2, c) => {
        let f = e[a.labels].values, h = e[u2].values, p = { labels: f, values: h, name: u2, type: "pie", domain: { row: a.rowPositions[c], column: a.columnPositions[c] }, hoverinfo: "label+percent+name", automargin: true, textposition: "outside" };
        i.push(p);
      });
      let l = __spreadValues({}, o);
      if (a.grid) l.grid = a.grid;
      else {
        let u2 = Number((e.shape[1] / 2).toFixed()) + 1;
        l.grid = { rows: u2, columns: u2 };
      }
      n.newPlot(t, i, l, a);
    }
  } else throw new Error('Param Error: Please provide a column name for "labels" param');
};
var o8 = (e, t, r, n) => {
  let a = r.config, o = r.layout;
  if (e instanceof ea) {
    let s = { y: e.values, type: "box" };
    n.newPlot(t, [s], o, a);
  } else if (a.x && a.y) {
    qs(e, a.x), qs(e, a.y);
    let s = e[a.x].values, i = e[a.y].values, l = { x: s, y: i, type: "box" }, u2 = __spreadValues({ xaxis: { title: a.x }, yaxis: { title: a.y } }, o);
    n.newPlot(t, [l], u2, a);
  } else if (a.x || a.y) {
    if (a.x) {
      qs(e, a.x);
      let s = e[a.x].values, i = e.index, l = { x: s, y: i, type: "box" }, u2 = __spreadValues({ xaxis: { title: a.x }, yaxis: { title: "Index" } }, o);
      n.newPlot(t, [l], u2, a);
    }
    if (a.y) {
      qs(e, a.y);
      let s = e.index, i = e[a.y].values, l = { x: s, y: i, type: "box" }, u2 = __spreadValues({ xaxis: { title: "Index" }, yaxis: { title: a.y } }, o);
      n.newPlot(t, [l], u2, a);
    }
  } else {
    let s = a.columns ? vh(e, a.columns) : e.columns, i = [];
    s.forEach((l) => {
      let c = { y: e[l].values, name: l, type: "box" };
      i.push(c);
    }), n.newPlot(t, i, o, a);
  }
};
var s8 = (e, t, r, n) => {
  let a = r.config, o = r.layout;
  if (e instanceof ea) {
    let s = { y: e.values, type: "violin" };
    n.newPlot(t, [s], o, a);
  } else if (a.x && a.y) {
    qs(e, a.x), qs(e, a.y);
    let s = e[a.x].values, i = e[a.y].values, l = { x: s, y: i, type: "violin" }, u2 = __spreadValues({ xaxis: { title: a.x }, yaxis: { title: a.y } }, o);
    n.newPlot(t, [l], u2, a);
  } else if (a.x || a.y) {
    if (a.x) {
      qs(e, a.x);
      let s = e[a.x].values, i = e.index, l = { x: s, y: i, type: "violin" }, u2 = __spreadValues({ xaxis: { title: a.x }, yaxis: { title: "Index" } }, o);
      n.newPlot(t, [l], u2, a);
    }
    if (a.y) {
      qs(e, a.y);
      let s = e.index, i = e[a.y].values, l = { x: s, y: i, type: "violin" }, u2 = __spreadValues({ xaxis: { title: "Index" }, yaxis: { title: a.y } }, o);
      n.newPlot(t, [l], u2, a);
    }
  } else {
    let s = a.columns ? vh(e, a.columns) : e.columns, i = [];
    s.forEach((l) => {
      let c = { y: e[l].values, name: l, type: "violin" };
      i.push(c);
    }), n.newPlot(t, i, o, a);
  }
};
var l8 = (e, t, r, n) => {
  let a = r.config, o = r.layout, s = {}, i = {}, l = [], u2 = [];
  a.columns ? (a.columns.forEach((f) => {
    if (!e.columns.includes(f)) throw Error(`Column Error: ${f} not found in columns. Columns should be one of [ ${e.columns} ]`);
    let h = e.columns.indexOf(f);
    l.push(e.getColumnData[h]);
  }), u2 = a.columns) : (u2 = e.columns, l = e.getColumnData), s.values = u2.map((f) => [f]), i.values = l, a.tableHeaderStyle && Object.keys(a.tableHeaderStyle).forEach((f) => {
    s[f] = a.tableHeaderStyle[f];
  }), a.tableCellStyle && Object.keys(a.tableCellStyle).forEach((f) => {
    i[f] = a.tableCellStyle[f];
  });
  let c = { type: "table", header: s, cells: i };
  n.newPlot(t, [c], o, a);
};
var B0;
typeof window < "u" && (B0 = Hte());
var Ux = class {
  divId;
  ndframe;
  constructor(t, r) {
    this.ndframe = t, this.divId = r;
  }
  getPlotConfig(t) {
    return { config: t && t.config ? t.config : {}, layout: t && t.layout ? t.layout : {} };
  }
  line(t) {
    let r = this.getPlotConfig(t);
    t8(this.ndframe, this.divId, r, B0);
  }
  bar(t) {
    let r = this.getPlotConfig(t);
    r8(this.ndframe, this.divId, r, B0);
  }
  scatter(t) {
    let r = this.getPlotConfig(t);
    n8(this.ndframe, this.divId, r, B0);
  }
  hist(t) {
    let r = this.getPlotConfig(t);
    a8(this.ndframe, this.divId, r, B0);
  }
  pie(t) {
    let r = this.getPlotConfig(t);
    i8(this.ndframe, this.divId, r, B0);
  }
  box(t) {
    let r = this.getPlotConfig(t);
    o8(this.ndframe, this.divId, r, B0);
  }
  violin(t) {
    let r = this.getPlotConfig(t);
    s8(this.ndframe, this.divId, r, B0);
  }
  table(t) {
    let r = this.getPlotConfig(t);
    l8(this.ndframe, this.divId, r, B0);
  }
};
var vu = new hs();
var Na = class extends O0 {
  constructor(t, r = {}) {
    let { index: n, columns: a, dtypes: o, config: s } = r;
    super({ data: t, index: n, columns: a, dtypes: o, config: s, isSeries: false }), this.$setInternalColumnDataProperty();
  }
  $setInternalColumnDataProperty(t) {
    let r = this;
    if (t && typeof t == "string") Object.defineProperty(r, t, { get() {
      return r.$getColumnData(t);
    }, set(n) {
      r.$setColumnData(t, n);
    } });
    else {
      let n = this.columns;
      for (let a = 0; a < n.length; a++) {
        let o = n[a];
        Object.defineProperty(this, o, { get() {
          return r.$getColumnData(o);
        }, set(s) {
          r.$setColumnData(o, s);
        } });
      }
    }
  }
  $getColumnData(t, r = true) {
    let n = this.columns.indexOf(t);
    n == -1 && Zo.throwColumnNotFoundError(this);
    let a = [this.$dtypes[n]], o = [...this.$index], s = [t], i = __spreadValues({}, this.$config);
    if (this.$config.isLowMemoryMode) {
      let l = [];
      for (let u2 = 0; u2 < this.values.length; u2++) {
        let c = this.values[u2];
        l.push(c[n]);
      }
      return r ? new ea(l, { dtypes: a, index: o, columns: s, config: i }) : l;
    } else {
      let l = this.$dataIncolumnFormat[n];
      return r ? new ea(l, { dtypes: a, index: o, columns: s, config: i }) : l;
    }
  }
  $setColumnData(t, r) {
    let n = this.$columns.indexOf(t);
    if (n == -1) throw new Error(`ParamError: column ${t} not found in ${this.$columns}. If you need to add a new column, use the df.addColumn method. `);
    let a;
    if (r instanceof ea) a = r.values;
    else if (Array.isArray(r)) a = r;
    else throw new Error("ParamError: specified value not supported. It must either be an Array or a Series of the same length");
    if (a.length !== this.shape[0] && Zo.throwColumnLengthError(this, a.length), this.$config.isLowMemoryMode) {
      for (let o = 0; o < this.$data.length; o++) this.$data[o][n] = a[o];
      this.$dtypes[n] = vu.inferDtype(a)[0];
    } else {
      for (let o = 0; o < this.values.length; o++) this.$data[o][n] = a[o];
      this.$dataIncolumnFormat[n] = r, this.$dtypes[n] = vu.inferDtype(a)[0];
    }
  }
  $getDataByAxisWithMissingValuesRemoved(t) {
    let r = this.$getDataArraysByAxis(t), n = [];
    for (let a = 0; a < r.length; a++) {
      let o = r[a];
      n.push(vu.removeMissingValuesFromArray(o));
    }
    return n;
  }
  $getDataArraysByAxis(t) {
    if (t === 1) return this.values;
    {
      let r;
      return this.config.isLowMemoryMode ? r = vu.transposeArray(this.values) : r = this.$dataIncolumnFormat, r;
    }
  }
  $frameIsNotCompactibleForArithmeticOperation() {
    let t = this.dtypes, r = (n) => n == "string";
    return t.some(r);
  }
  $getTensorsForArithmeticOperationByAxis(t, r) {
    if (typeof t == "number") return [this.tensor, zo.scalar(t)];
    if (t instanceof Na) return [this.tensor, t.tensor];
    if (t instanceof ea) return r === 0 ? [this.tensor, zo.tensor2d(t.values, [t.shape[0], 1])] : [this.tensor, zo.tensor2d(t.values, [t.shape[0], 1]).transpose()];
    if (Array.isArray(t)) return r === 0 ? [this.tensor, zo.tensor2d(t, [t.length, 1])] : [this.tensor, zo.tensor2d(t, [t.length, 1]).transpose()];
    throw new Error("ParamError: Invalid type for other parameter. other must be one of Series, DataFrame or number.");
  }
  $getColumnDtype(t) {
    let r = this.columns.indexOf(t);
    if (r === -1) throw Error(`ColumnNameError: Column "${t}" does not exist`);
    return this.dtypes[r];
  }
  $logicalOps(t, r) {
    let n = [];
    switch (r) {
      case "gt":
        n = t[0].greater(t[1]).arraySync();
        break;
      case "lt":
        n = t[0].less(t[1]).arraySync();
        break;
      case "ge":
        n = t[0].greaterEqual(t[1]).arraySync();
        break;
      case "le":
        n = t[0].lessEqual(t[1]).arraySync();
        break;
      case "eq":
        n = t[0].equal(t[1]).arraySync();
        break;
      case "ne":
        n = t[0].notEqual(t[1]).arraySync();
        break;
    }
    let a = vu.mapIntegersToBooleans(n, 2);
    return new Na(a, { index: [...this.index], columns: [...this.columns], dtypes: [...this.dtypes], config: __spreadValues({}, this.config) });
  }
  $MathOps(t, r, n) {
    let a;
    switch (r) {
      case "add":
        a = t[0].add(t[1]);
        break;
      case "sub":
        a = t[0].sub(t[1]);
        break;
      case "pow":
        a = t[0].pow(t[1]);
        break;
      case "div":
        a = t[0].div(t[1]);
        break;
      case "divNoNan":
        a = t[0].divNoNan(t[1]);
        break;
      case "mul":
        a = t[0].mul(t[1]);
        break;
      case "mod":
        a = t[0].mod(t[1]);
        break;
    }
    if (n) {
      let o = a?.arraySync();
      this.$setValues(o);
    } else return new Na(a, { index: [...this.index], columns: [...this.columns], dtypes: [...this.dtypes], config: __spreadValues({}, this.config) });
  }
  iloc({ rows: t, columns: r }) {
    return T_({ ndFrame: this, rows: t, columns: r });
  }
  loc({ rows: t, columns: r }) {
    return A_({ ndFrame: this, rows: t, columns: r });
  }
  toString() {
    let t = this.config.getMaxRow, r = this.config.getTableMaxColInConsole, n = [], a = this.columns.length, o = [];
    if (a > r) {
      let l = this.columns.slice(0, 4), u2 = this.columns.slice(a - 3);
      o = ["", ...l, "...", ...u2];
      let c, f, h;
      if (this.values.length > t) {
        let p = this.iloc({ rows: [`0:${t}`], columns: ["0:4"] }), d = this.iloc({ rows: [`0:${t}`], columns: [`${a - 3}:`] });
        c = this.index.slice(0, t), f = p.values, h = d.values;
      } else {
        let p = this.iloc({ columns: ["0:4"] }), d = this.iloc({ columns: [`${a - 3}:`] });
        c = this.index.slice(0, t), f = p.values, h = d.values;
      }
      for (let p = 0; p < c.length; p++) {
        let v = [c[p], ...f[p], "...", ...h[p]];
        n.push(v);
      }
    } else {
      o = ["", ...this.columns];
      let l, u2;
      if (this.values.length > t) {
        let c = this.iloc({ rows: [`0:${t}`] });
        l = c.index, u2 = c.values;
      } else u2 = this.values, l = this.index;
      for (let c = 0; c < l.length; c++) {
        let h = [l[c], ...u2[c]];
        n.push(h);
      }
    }
    let s = {};
    s[0] = { width: 10 };
    for (let l = 1; l < o.length; l++) s[l] = { width: 17, truncate: 16 };
    let i = [o, ...n];
    return (0, qte.table)(i, __spreadValues({ columns: s }, this.config.getTableDisplayConfig));
  }
  head(t = 5) {
    if (t <= 0) throw new Error("ParamError: Number of rows cannot be less than 1");
    if (this.shape[0] <= t) return this.copy();
    if (this.shape[0] - t < 0) throw new Error("ParamError: Number of rows cannot be greater than available rows in data");
    return this.iloc({ rows: [`0:${t}`] });
  }
  tail(t = 5) {
    if (t <= 0) throw new Error("ParamError: Number of rows cannot be less than 1");
    if (this.shape[0] <= t) return this.copy();
    if (this.shape[0] - t < 0) throw new Error("ParamError: Number of rows cannot be greater than available rows in data");
    return t = this.shape[0] - t, this.iloc({ rows: [`${t}:`] });
  }
  async sample(t = 5, r) {
    let { seed: n } = __spreadValues({ seed: 1 }, r);
    if (t > this.shape[0]) throw new Error("ParamError: Sample size cannot be bigger than number of rows");
    if (t <= 0) throw new Error("ParamError: Sample size cannot be less than 1");
    let a = await zo.data.array(this.index).shuffle(t, `${n}`).take(t).toArray();
    return this.iloc({ rows: a });
  }
  add(t, r) {
    let { inplace: n, axis: a } = __spreadValues({ inplace: false, axis: 1 }, r);
    if (this.$frameIsNotCompactibleForArithmeticOperation()) throw Error("TypeError: add operation is not supported for string dtypes");
    if ([0, 1].indexOf(a) === -1) throw Error("ParamError: Axis must be 0 or 1");
    let o = this.$getTensorsForArithmeticOperationByAxis(t, a);
    return this.$MathOps(o, "add", n);
  }
  sub(t, r) {
    let { inplace: n, axis: a } = __spreadValues({ inplace: false, axis: 1 }, r);
    if (this.$frameIsNotCompactibleForArithmeticOperation()) throw Error("TypeError: sub operation is not supported for string dtypes");
    if ([0, 1].indexOf(a) === -1) throw Error("ParamError: Axis must be 0 or 1");
    let o = this.$getTensorsForArithmeticOperationByAxis(t, a);
    return this.$MathOps(o, "sub", n);
  }
  mul(t, r) {
    let { inplace: n, axis: a } = __spreadValues({ inplace: false, axis: 1 }, r);
    if (this.$frameIsNotCompactibleForArithmeticOperation()) throw Error("TypeError: mul operation is not supported for string dtypes");
    if ([0, 1].indexOf(a) === -1) throw Error("ParamError: Axis must be 0 or 1");
    let o = this.$getTensorsForArithmeticOperationByAxis(t, a);
    return this.$MathOps(o, "mul", n);
  }
  div(t, r) {
    let { inplace: n, axis: a } = __spreadValues({ inplace: false, axis: 1 }, r);
    if (this.$frameIsNotCompactibleForArithmeticOperation()) throw Error("TypeError: div operation is not supported for string dtypes");
    if ([0, 1].indexOf(a) === -1) throw Error("ParamError: Axis must be 0 or 1");
    let o = this.$getTensorsForArithmeticOperationByAxis(t, a);
    return this.$MathOps(o, "div", n);
  }
  divNoNan(t, r) {
    let { inplace: n, axis: a } = __spreadValues({ inplace: false, axis: 1 }, r);
    if (this.$frameIsNotCompactibleForArithmeticOperation()) throw Error("TypeError: div operation is not supported for string dtypes");
    if ([0, 1].indexOf(a) === -1) throw Error("ParamError: Axis must be 0 or 1");
    let o = this.$getTensorsForArithmeticOperationByAxis(t, a);
    return this.$MathOps(o, "divNoNan", n);
  }
  pow(t, r) {
    let { inplace: n, axis: a } = __spreadValues({ inplace: false, axis: 1 }, r);
    if (this.$frameIsNotCompactibleForArithmeticOperation()) throw Error("TypeError: pow operation is not supported for string dtypes");
    if ([0, 1].indexOf(a) === -1) throw Error("ParamError: Axis must be 0 or 1");
    let o = this.$getTensorsForArithmeticOperationByAxis(t, a);
    return this.$MathOps(o, "pow", n);
  }
  mod(t, r) {
    let { inplace: n, axis: a } = __spreadValues({ inplace: false, axis: 1 }, r);
    if (this.$frameIsNotCompactibleForArithmeticOperation()) throw Error("TypeError: mod operation is not supported for string dtypes");
    if ([0, 1].indexOf(a) === -1) throw Error("ParamError: Axis must be 0 or 1");
    let o = this.$getTensorsForArithmeticOperationByAxis(t, a);
    return this.$MathOps(o, "mod", n);
  }
  mean(t) {
    let { axis: r } = __spreadValues({ axis: 1 }, t);
    if (this.$frameIsNotCompactibleForArithmeticOperation()) throw Error("TypeError: mean operation is not supported for string dtypes");
    if ([0, 1].indexOf(r) === -1) throw Error("ParamError: Axis must be 0 or 1");
    let a = this.$getDataByAxisWithMissingValuesRemoved(r).map((o) => o.reduce((s, i) => s + i, 0) / o.length);
    return r === 0 ? new ea(a, { index: this.columns }) : new ea(a, { index: this.index });
  }
  median(t) {
    let { axis: r } = __spreadValues({ axis: 1 }, t);
    if (this.$frameIsNotCompactibleForArithmeticOperation()) throw Error("TypeError: median operation is not supported for string dtypes");
    if ([0, 1].indexOf(r) === -1) throw Error("ParamError: Axis must be 0 or 1");
    let a = this.$getDataByAxisWithMissingValuesRemoved(r).map((o) => jg(o));
    return r === 0 ? new ea(a, { index: this.columns }) : new ea(a, { index: this.index });
  }
  mode(t) {
    let { axis: r, keep: n } = __spreadValues({ axis: 1, keep: 0 }, t);
    if (this.$frameIsNotCompactibleForArithmeticOperation()) throw Error("TypeError: mode operation is not supported for string dtypes");
    if ([0, 1].indexOf(r) === -1) throw Error("ParamError: Axis must be 0 or 1");
    let o = this.$getDataByAxisWithMissingValuesRemoved(r).map((s) => {
      let i = wx(s);
      return i.length === 1 ? i[0] : i[n];
    });
    return r === 0 ? new ea(o, { index: this.columns }) : new ea(o, { index: this.index });
  }
  min(t) {
    let { axis: r } = __spreadValues({ axis: 1 }, t);
    if (this.$frameIsNotCompactibleForArithmeticOperation()) throw Error("TypeError: min operation is not supported for string dtypes");
    if ([0, 1].indexOf(r) === -1) throw Error("ParamError: Axis must be 0 or 1");
    let a = this.$getDataByAxisWithMissingValuesRemoved(r).map((o) => {
      let s = o[0];
      for (let i = 0; i < o.length; i++) s = s < o[i] ? s : o[i];
      return s;
    });
    return r === 0 ? new ea(a, { index: this.columns }) : new ea(a, { index: this.index });
  }
  max(t) {
    let { axis: r } = __spreadValues({ axis: 1 }, t);
    if (this.$frameIsNotCompactibleForArithmeticOperation()) throw Error("TypeError: max operation is not supported for string dtypes");
    if ([0, 1].indexOf(r) === -1) throw Error("ParamError: Axis must be 0 or 1");
    let a = this.$getDataByAxisWithMissingValuesRemoved(r).map((o) => {
      let s = o[0];
      for (let i = 0; i < o.length; i++) s = s > o[i] ? s : o[i];
      return s;
    });
    return r === 0 ? new ea(a, { index: this.columns }) : new ea(a, { index: this.index });
  }
  std(t) {
    let { axis: r } = __spreadValues({ axis: 1 }, t);
    if (this.$frameIsNotCompactibleForArithmeticOperation()) throw Error("TypeError: std operation is not supported for string dtypes");
    if ([0, 1].indexOf(r) === -1) throw Error("ParamError: Axis must be 0 or 1");
    let a = this.$getDataByAxisWithMissingValuesRemoved(r).map((o) => Wg(o));
    return r === 0 ? new ea(a, { index: this.columns }) : new ea(a, { index: this.index });
  }
  var(t) {
    let { axis: r } = __spreadValues({ axis: 1 }, t);
    if (this.$frameIsNotCompactibleForArithmeticOperation()) throw Error("TypeError: var operation is not supported for string dtypes");
    if ([0, 1].indexOf(r) === -1) throw Error("ParamError: Axis must be 0 or 1");
    let a = this.$getDataByAxisWithMissingValuesRemoved(r).map((o) => Yv(o));
    return r === 0 ? new ea(a, { index: this.columns }) : new ea(a, { index: this.index });
  }
  lt(t, r) {
    let { axis: n } = __spreadValues({ axis: 1 }, r);
    if (this.$frameIsNotCompactibleForArithmeticOperation()) throw Error("TypeError: lt operation is not supported for string dtypes");
    if ([0, 1].indexOf(n) === -1) throw Error("ParamError: Axis must be 0 or 1");
    let a = this.$getTensorsForArithmeticOperationByAxis(t, n);
    return this.$logicalOps(a, "lt");
  }
  gt(t, r) {
    let { axis: n } = __spreadValues({ axis: 1 }, r);
    if (this.$frameIsNotCompactibleForArithmeticOperation()) throw Error("TypeError: gt operation is not supported for string dtypes");
    if ([0, 1].indexOf(n) === -1) throw Error("ParamError: Axis must be 0 or 1");
    let a = this.$getTensorsForArithmeticOperationByAxis(t, n);
    return this.$logicalOps(a, "gt");
  }
  eq(t, r) {
    let { axis: n } = __spreadValues({ axis: 1 }, r);
    if (this.$frameIsNotCompactibleForArithmeticOperation()) throw Error("TypeError: eq operation is not supported for string dtypes");
    if ([0, 1].indexOf(n) === -1) throw Error("ParamError: Axis must be 0 or 1");
    let a = this.$getTensorsForArithmeticOperationByAxis(t, n);
    return this.$logicalOps(a, "eq");
  }
  ne(t, r) {
    let { axis: n } = __spreadValues({ axis: 1 }, r);
    if (this.$frameIsNotCompactibleForArithmeticOperation()) throw Error("TypeError: ne operation is not supported for string dtypes");
    if ([0, 1].indexOf(n) === -1) throw Error("ParamError: Axis must be 0 or 1");
    let a = this.$getTensorsForArithmeticOperationByAxis(t, n);
    return this.$logicalOps(a, "ne");
  }
  le(t, r) {
    let { axis: n } = __spreadValues({ axis: 1 }, r);
    if (this.$frameIsNotCompactibleForArithmeticOperation()) throw Error("TypeError: le operation is not supported for string dtypes");
    if ([0, 1].indexOf(n) === -1) throw Error("ParamError: Axis must be 0 or 1");
    let a = this.$getTensorsForArithmeticOperationByAxis(t, n);
    return this.$logicalOps(a, "le");
  }
  ge(t, r) {
    let { axis: n } = __spreadValues({ axis: 1 }, r);
    if (this.$frameIsNotCompactibleForArithmeticOperation()) throw Error("TypeError: ge operation is not supported for string dtypes");
    if ([0, 1].indexOf(n) === -1) throw Error("ParamError: Axis must be 0 or 1");
    let a = this.$getTensorsForArithmeticOperationByAxis(t, n);
    return this.$logicalOps(a, "ge");
  }
  count(t) {
    let { axis: r } = __spreadValues({ axis: 1 }, t);
    if ([0, 1].indexOf(r) === -1) throw Error("ParamError: Axis must be 0 or 1");
    let a = this.$getDataByAxisWithMissingValuesRemoved(r).map((o) => o.length);
    return r === 0 ? new ea(a, { index: this.columns }) : new ea(a, { index: this.index });
  }
  sum(t) {
    let { axis: r } = __spreadValues({ axis: 1 }, t);
    if ([0, 1].indexOf(r) === -1) throw Error("ParamError: Axis must be 0 or 1");
    let a = this.$getDataByAxisWithMissingValuesRemoved(r).map((o) => o.reduce((s, i) => Number(s) + Number(i), 0));
    return r === 0 ? new ea(a, { index: [...this.columns] }) : new ea(a, { index: [...this.index] });
  }
  pctChange(t, r) {
    let { inplace: n, axis: a } = __spreadValues({ inplace: false, axis: 1 }, r);
    if (this.$frameIsNotCompactibleForArithmeticOperation()) throw Error("TypeError: pctChange operation is not supported for string dtypes");
    if ([0, 1].indexOf(a) === -1) throw Error("ParamError: Axis must be 0 or 1");
    if (t === 0) return this;
    if (typeof t == "number") {
      let o = this.copy();
      a === 0 && (o = o.T);
      let s = o.tensor.clone(), i = new Array(s.shape[s.rank - 1]).fill(NaN), l = s.arraySync();
      if (t > 0) for (let f = 0; f < t; f++) l.unshift(i), l.pop();
      else if (t < 0) for (let f = 0; f > t; f--) l.push(i), l.shift();
      let u2 = zo.tensor2d(l, s.shape), c = this.$MathOps([s, u2], "divNoNan", n).sub(1);
      return a === 0 ? c.T : c;
    }
    if (t instanceof Na || t instanceof ea) {
      let o = this.$getTensorsForArithmeticOperationByAxis(t, a);
      return this.$MathOps(o, "divNoNan", n).sub(1);
    }
  }
  diff(t, r) {
    let { inplace: n, axis: a } = __spreadValues({ inplace: false, axis: 1 }, r);
    if (this.$frameIsNotCompactibleForArithmeticOperation()) throw Error("TypeError: diff operation is not supported for string dtypes");
    if ([0, 1].indexOf(a) === -1) throw Error("ParamError: Axis must be 0 or 1");
    if (t === 0) return this;
    if (typeof t == "number") {
      let o = this.copy();
      a === 0 && (o = o.T);
      let s = o.tensor.clone(), i = new Array(s.shape[s.rank - 1]).fill(NaN), l = s.arraySync();
      if (t > 0) for (let f = 0; f < t; f++) l.unshift(i), l.pop();
      else if (t < 0) for (let f = 0; f > t; f--) l.push(i), l.shift();
      let u2 = zo.tensor2d(l, s.shape), c = this.$MathOps([s, u2], "sub", n);
      return a === 0 ? c.T : c;
    }
    if (t instanceof Na || t instanceof ea) {
      let o = this.$getTensorsForArithmeticOperationByAxis(t, a);
      return this.$MathOps(o, "sub", n);
    }
  }
  abs(t) {
    let { inplace: r } = __spreadValues({ inplace: false }, t), n = this.values.map((a) => a.map((o) => Math.abs(o)));
    if (r) this.$setValues(n);
    else return new Na(n, { index: [...this.index], columns: [...this.columns], dtypes: [...this.dtypes], config: __spreadValues({}, this.config) });
  }
  round(t = 1, r) {
    let { inplace: n } = __spreadValues({ inplace: false }, r);
    if (this.$frameIsNotCompactibleForArithmeticOperation()) throw Error("TypeError: round operation is not supported for string dtypes");
    if (typeof t != "number") throw Error("ParamError: dp must be a number");
    let a = vu.round(this.values, t, false);
    if (n) this.$setValues(a);
    else return new Na(a, { index: [...this.index], columns: [...this.columns], config: __spreadValues({}, this.config) });
  }
  cumProd(t) {
    let { axis: r, inplace: n } = __spreadValues({ axis: 1, inplace: false }, t);
    return this.cumOps("prod", r, n);
  }
  cumSum(t) {
    let { axis: r, inplace: n } = __spreadValues({ axis: 1, inplace: false }, t);
    return this.cumOps("sum", r, n);
  }
  cumMin(t) {
    let { axis: r, inplace: n } = __spreadValues({ axis: 1, inplace: false }, t);
    return this.cumOps("min", r, n);
  }
  cumMax(t) {
    let { axis: r, inplace: n } = __spreadValues({ axis: 1, inplace: false }, t);
    return this.cumOps("max", r, n);
  }
  cumOps(t, r, n) {
    this.dtypes.includes("string") && Zo.throwStringDtypeOperationError(t);
    let o = this.$getDataByAxisWithMissingValuesRemoved(r).map((s) => {
      let i = s[0], l = [i];
      for (let u2 = 1; u2 < s.length; u2++) {
        let c = s[u2];
        switch (t) {
          case "max":
            c > i ? (l.push(c), i = c) : l.push(i);
            break;
          case "min":
            c < i ? (l.push(c), i = c) : l.push(i);
            break;
          case "sum":
            i = i + c, l.push(i);
            break;
          case "prod":
            i = i * c, l.push(i);
            break;
        }
      }
      return l;
    });
    if (r === 0 && (o = vu.transposeArray(o)), n) this.$setValues(o);
    else return new Na(o, { index: [...this.index], columns: [...this.columns], dtypes: [...this.dtypes], config: __spreadValues({}, this.config) });
  }
  describe() {
    let t = this.columns.filter((o) => this.$getColumnDtype(o) !== "string"), r = ["count", "mean", "std", "min", "median", "max", "variance"], n = {};
    for (let o = 0; o < t.length; o++) {
      let s = t[o], i = this.$getColumnData(s).count(), l = CQ(this.$getColumnData(s, false)), u2 = Wg(this.$getColumnData(s, false)), c = this.$getColumnData(s).min(), f = jg(this.$getColumnData(s, false)), h = this.$getColumnData(s).max(), p = Yv(this.$getColumnData(s, false)), d = [i, l, u2, c, f, h, p];
      n[s] = d;
    }
    return new Na(n, { index: r });
  }
  dropNa(t) {
    let { axis: r, inplace: n } = __spreadValues({ axis: 1, inplace: false }, t);
    if ([0, 1].indexOf(r) === -1) throw Error("ParamError: Axis must be 0 or 1");
    let a = [];
    if (r == 1) {
      let o = [], s = this.values;
      for (let i = 0; i < s.length; i++) {
        let l = s[i];
        !l.includes(NaN) && !l.includes(void 0) && !l.includes(null) && (o.push(l), a.push(this.index[i]));
      }
      if (n) this.$setValues(o, false), this.$setIndex(a);
      else return new Na(o, { index: a, columns: [...this.columns], dtypes: [...this.dtypes], config: __spreadValues({}, this.config) });
    } else {
      let o = [], s = [], i = [];
      this.config.isLowMemoryMode ? i = vu.transposeArray(this.values) : i = this.$dataIncolumnFormat;
      let l = [];
      for (let c = 0; c < i.length; c++) {
        let f = i[c];
        f.includes(NaN) || (l.push(f), o.push(this.columns[c]), s.push(this.dtypes[c]));
      }
      let u2 = vu.transposeArray(l);
      if (n) this.$setValues(u2, false, false), this.$setColumnNames(o), this.$setDtypes(s);
      else return new Na(u2, { index: [...this.index], columns: o, dtypes: s, config: __spreadValues({}, this.config) });
    }
  }
  addColumn(t, r, n) {
    let { inplace: a, atIndex: o } = __spreadValues({ inplace: false, atIndex: this.columns.length }, n);
    if (typeof o == "string") {
      if (!this.columns.includes(o)) throw new Error(`${o} not a column`);
      o = this.columns.indexOf(o);
    }
    if (!t) throw new Error("ParamError: column must be specified");
    if (!r) throw new Error("ParamError: values must be specified");
    if (this.$columns.indexOf(t) === -1) {
      let i;
      if (r instanceof ea) i = r.values;
      else if (Array.isArray(r)) i = r;
      else throw new Error("ParamError: specified value not supported. It must either be an Array or a Series of the same length");
      i.length !== this.shape[0] && Zo.throwColumnLengthError(this, i.length);
      let l = [], u2 = this.$data;
      for (let c = 0; c < u2.length; c++) {
        let f = [...u2[c]];
        f.splice(o, 0, i[c]), l.push(f);
      }
      if (a) {
        this.$setValues(l, true, false);
        let c = [...this.columns];
        c.splice(o, 0, t), this.$setColumnNames(c), this.$setInternalColumnDataProperty(t);
      } else {
        let c = [...this.columns];
        return c.splice(o, 0, t), new Na(l, { index: [...this.index], columns: c, dtypes: [...this.dtypes, vu.inferDtype(i)[0]], config: __spreadValues({}, this.$config) });
      }
    } else this.$setColumnData(t, r);
  }
  copy() {
    return new Na([...this.$data], { columns: [...this.columns], index: [...this.index], dtypes: [...this.dtypes], config: __spreadValues({}, this.$config) });
  }
  isNa() {
    let t = [];
    for (let n = 0; n < this.values.length; n++) {
      let o = this.values[n].map((s) => !!vu.isEmpty(s));
      t.push(o);
    }
    return new Na(t, { index: [...this.index], columns: [...this.columns], config: __spreadValues({}, this.config) });
  }
  fillNa(t, r) {
    let { columns: n, inplace: a } = __spreadValues({ inplace: false }, r);
    if (!t && typeof t != "boolean" && typeof t != "number" && typeof t != "string") throw Error("ParamError: value must be specified");
    if (Array.isArray(t)) {
      if (!Array.isArray(n)) throw Error("ParamError: value is an array, hence columns must also be an array of same length");
      if (t.length !== n.length) throw Error("ParamError: specified column and values must have the same length");
      n.forEach((i) => {
        if (!this.columns.includes(i)) throw Error(`ValueError: Specified column "${i}" must be one of ${this.columns}`);
      });
    }
    let o = [], s = [...this.values];
    if (n) {
      let i = [...this.values];
      for (let l = 0; l < i.length; l++) {
        let u2 = i[l];
        for (let c = 0; c < n.length; c++) {
          let f = this.columns.indexOf(n[c]), h = Array.isArray(t) ? t[c] : t;
          u2[f] = vu.isEmpty(u2[f]) ? h : u2[f];
        }
        o.push(u2);
      }
    } else for (let i = 0; i < s.length; i++) {
      let u2 = [...s[i]].map((c) => vu.isEmpty(c) ? Array.isArray(t) ? t[i] : t : c);
      o.push(u2);
    }
    if (a) this.$setValues(o);
    else return new Na(o, { index: [...this.index], columns: [...this.columns], dtypes: [...this.dtypes], config: __spreadValues({}, this.config) });
  }
  drop(t) {
    let { columns: r, index: n, inplace: a } = __spreadValues({ inplace: false }, t);
    if (!r && !n) throw Error("ParamError: Must specify one of columns or index");
    if (r && n) throw Error("ParamError: Can only specify one of columns or index");
    if (r) {
      let o = [];
      if (typeof r == "string") o.push(this.columns.indexOf(r));
      else if (Array.isArray(r)) for (let u2 of r) {
        if (this.columns.indexOf(u2) === -1) throw Error(`ParamError: specified column "${u2}" not found in columns`);
        o.push(this.columns.indexOf(u2));
      }
      else throw Error("ParamError: columns must be an array of column names or a string of column name");
      let s = [], i = [], l = [];
      for (let u2 = 0; u2 < this.values.length; u2++) {
        let c = [], f = this.values[u2];
        for (let h = 0; h < f.length; h++) o.includes(h) || c.push(f[h]);
        s.push(c);
      }
      for (let u2 = 0; u2 < this.columns.length; u2++) {
        let c = this.columns[u2];
        r.includes(c) || (i.push(c), l.push(this.dtypes[u2]));
      }
      if (a) this.$setValues(s, true, false), this.$setColumnNames(i);
      else return new Na(s, { index: [...this.index], columns: i, dtypes: l, config: __spreadValues({}, this.config) });
    }
    if (n) {
      let o = [];
      if (typeof n == "string" || typeof n == "number" || typeof n == "boolean") o.push(this.index.indexOf(n));
      else if (Array.isArray(n)) for (let l of n) {
        if (this.index.indexOf(l) === -1) throw Error(`ParamError: specified index "${l}" not found in indices`);
        o.push(this.index.indexOf(l));
      }
      else throw Error("ParamError: index must be an array of indices or a scalar index");
      let s = [], i = [];
      for (let l = 0; l < this.values.length; l++) {
        let u2 = this.values[l];
        o.includes(l) || s.push(u2);
      }
      for (let l = 0; l < this.index.length; l++) {
        let u2 = this.index[l];
        n.includes(u2) || i.push(u2);
      }
      if (a) this.$setValues(s, false), this.$setIndex(i);
      else return new Na(s, { index: i, columns: [...this.columns], dtypes: [...this.dtypes], config: __spreadValues({}, this.config) });
    }
  }
  sortValues(t, r) {
    let { ascending: n, inplace: a } = __spreadValues({ ascending: true, inplace: false }, r);
    if (!t) throw Error("ParamError: must specify a column to sort by");
    if (this.columns.indexOf(t) === -1) throw Error(`ParamError: specified column "${t}" not found in columns`);
    let o = this.$getColumnData(t, false), s = [...this.index], i = o.map((f, h) => ({ index: s[h], value: f })), u2 = vu.sortObj(i, n).map((f) => f.index), c = A_({ ndFrame: this, rows: u2 });
    if (a) this.$setValues(c.values), this.$setIndex(c.index);
    else return c;
  }
  setIndex(t) {
    let { index: r, column: n, drop: a, inplace: o } = __spreadValues({ drop: false, inplace: false }, t);
    if (!r && !n) throw new Error("ParamError: must specify either index or column");
    let s = [];
    if (r) {
      if (!Array.isArray(r)) throw Error("ParamError: index must be an array");
      if (r.length !== this.values.length) throw Error("ParamError: index must be the same length as the number of rows");
      s = r;
    }
    if (n) {
      if (this.columns.indexOf(n) === -1) throw Error("ParamError: column not found in column names");
      s = this.$getColumnData(n, false);
    }
    if (a) {
      let i = this.drop({ columns: [n] }), l = i?.values, u2 = i?.columns, c = i?.dtypes;
      if (o) this.$setValues(l, true, false), this.$setIndex(s), this.$setColumnNames(u2);
      else return new Na(l, { index: s, columns: u2, dtypes: c, config: __spreadValues({}, this.config) });
    } else if (o) this.$setIndex(s);
    else return new Na(this.values, { index: s, columns: [...this.columns], dtypes: [...this.dtypes], config: __spreadValues({}, this.config) });
  }
  resetIndex(t) {
    let { inplace: r } = __spreadValues({ inplace: false }, t);
    if (r) this.$resetIndex();
    else return new Na(this.values, { index: this.index.map((a, o) => o), columns: [...this.columns], dtypes: [...this.dtypes], config: __spreadValues({}, this.config) });
  }
  apply(t, r) {
    let { axis: n } = __spreadValues({ axis: 1 }, r);
    if ([0, 1].indexOf(n) === -1) throw Error("ParamError: axis must be 0 or 1");
    let o = this.$getDataByAxisWithMissingValuesRemoved(n).map((s) => t(s));
    return n === 0 ? vu.is1DArray(o) ? new ea(o, { index: [...this.columns] }) : new Na(o, { index: [...this.columns], columns: [...this.columns], dtypes: [...this.dtypes], config: __spreadValues({}, this.config) }) : vu.is1DArray(o) ? new ea(o, { index: [...this.index] }) : new Na(o, { index: [...this.index], columns: [...this.columns], dtypes: [...this.dtypes], config: __spreadValues({}, this.config) });
  }
  applyMap(t, r) {
    let { inplace: n } = __spreadValues({ inplace: false }, r), a = this.values.map((o) => o.map((i) => t(i)));
    if (n) this.$setValues(a);
    else return new Na(a, { index: [...this.index], columns: [...this.columns], dtypes: [...this.dtypes], config: __spreadValues({}, this.config) });
  }
  column(t) {
    return this.$getColumnData(t);
  }
  selectDtypes(t) {
    let r = ["float32", "int32", "string", "boolean", "undefined"];
    if (Array.isArray(t) === false) throw Error("ParamError: include must be an array");
    t.forEach((a) => {
      if (r.indexOf(a) === -1) throw Error("ParamError: include must be an array of valid dtypes");
    });
    let n = [];
    for (let a = 0; a < this.dtypes.length; a++) t.includes(this.dtypes[a]) && n.push(this.columns[a]);
    return this.loc({ columns: n });
  }
  transpose(t) {
    let { inplace: r } = __spreadValues({ inplace: false }, t), n = vu.transposeArray(this.values), a = [...this.index.map((o) => o.toString())];
    if (r) this.$setValues(n, false, false), this.$setIndex([...this.columns]), this.$setColumnNames(a);
    else return new Na(n, { index: [...this.columns], columns: a, config: __spreadValues({}, this.config) });
  }
  get T() {
    let t = vu.transposeArray(this.values);
    return new Na(t, { index: [...this.columns], columns: [...this.index.map((r) => r.toString())], config: __spreadValues({}, this.config) });
  }
  replace(t, r, n) {
    let { columns: a, inplace: o } = __spreadValues({ inplace: false }, n);
    if (typeof t == "number" && isNaN(t)) throw Error("Params Error: Param 'oldValue' does not support NaN. Use DataFrame.fillNa() instead.");
    if (!t && typeof t != "boolean" && typeof t != "number" && typeof t != "string") throw Error("Params Error: Must specify param 'oldValue' to replace");
    if (!r && typeof r != "boolean" && typeof r != "number" && typeof r != "string") throw Error("Params Error: Must specify param 'newValue' to replace with");
    let s = [];
    if (a) {
      if (!Array.isArray(a)) throw Error("Params Error: column must be an array of column(s)");
      let i = [];
      a.forEach((l) => {
        let u2 = this.columns.indexOf(l);
        if (u2 === -1) throw Error("Params Error: column not found in columns");
        i.push(u2);
      }), s = this.values.map(([...l]) => {
        for (let u2 of i) l[u2] === t && (l[u2] = r);
        return l;
      });
    } else s = this.values.map(([...i]) => i.map((l) => l === t ? r : l));
    if (o) this.$setValues(s);
    else return new Na(s, { index: [...this.index], columns: [...this.columns], dtypes: [...this.dtypes], config: __spreadValues({}, this.config) });
  }
  asType(t, r, n) {
    let { inplace: a } = __spreadValues({ inplace: false }, n), o = this.columns.indexOf(t);
    if (o === -1) throw Error("Params Error: column not found in columns");
    if (!qp.includes(r)) throw Error(`dtype ${r} not supported. dtype must be one of ${qp}`);
    let i = this.values.map((l) => {
      if (r === "float32") return l[o] = Number(l[o]), l;
      if (r === "int32") return l[o] = parseInt(l[o]), l;
      if (r === "string") return l[o] = l[o].toString(), l;
      if (r === "boolean") return l[o] = Boolean(l[o]), l;
    });
    if (a) this.$setValues(i);
    else {
      let l = [...this.dtypes];
      return l[o] = r, new Na(i, { index: [...this.index], columns: [...this.columns], dtypes: l, config: __spreadValues({}, this.config) });
    }
  }
  nUnique(t = 1) {
    if ([0, 1].indexOf(t) === -1) throw Error("ParamError: axis must be 0 or 1");
    let n = this.$getDataArraysByAxis(t).map((a) => new Set(a).size);
    return t === 0 ? new ea(n, { index: [...this.columns], dtypes: ["int32"] }) : new ea(n, { index: [...this.index], dtypes: ["int32"] });
  }
  rename(t, r) {
    let { axis: n, inplace: a } = __spreadValues({ axis: 1, inplace: false }, r);
    if ([0, 1].indexOf(n) === -1) throw Error("ParamError: axis must be 0 or 1");
    if (n === 1) {
      let o = [], s = this.columns.map((i) => {
        if (t[i] !== void 0) {
          let l = `${t[i]}`;
          return o.push(l), l;
        } else return i;
      });
      if (a) {
        this.$setColumnNames(s);
        for (let i of o) this.$setInternalColumnDataProperty(i);
      } else return new Na([...this.values], { index: [...this.index], columns: s, dtypes: [...this.dtypes], config: __spreadValues({}, this.config) });
    } else {
      let o = this.index.map((s) => t[s] !== void 0 ? t[s] : s);
      if (a) this.$setIndex(o);
      else return new Na([...this.values], { index: o, columns: [...this.columns], dtypes: [...this.dtypes], config: __spreadValues({}, this.config) });
    }
  }
  sortIndex(t) {
    let { ascending: r, inplace: n } = __spreadValues({ ascending: true, inplace: false }, t), a = vu.range(0, this.index.length - 1), o = [...this.index], s = o.map((c, f) => ({ index: a[f], value: c })), l = vu.sortObj(s, r).map((c) => c.index), u2 = l.map((c) => this.values[c]);
    if (l = l.map((c) => o[c]), n) this.$setValues(u2), this.$setIndex(l);
    else return new Na(u2, { index: l, columns: [...this.columns], dtypes: [...this.dtypes], config: __spreadValues({}, this.config) });
  }
  append(t, r, n) {
    let { inplace: a } = __spreadValues({ inplace: false }, n);
    if (!t) throw Error("ParamError: newValues must be a Series, DataFrame or Array");
    if (!r) throw Error("ParamError: index must be specified");
    let o = [];
    if (t instanceof ea) {
      if (t.values.length !== this.shape[1]) throw Error("ValueError: length of newValues must be the same as the number of columns.");
      o = [t.values];
    } else if (t instanceof Na) {
      if (t.shape[1] !== this.shape[1]) throw Error("ValueError: length of newValues must be the same as the number of columns.");
      o = t.values;
    } else if (Array.isArray(t)) {
      if (vu.is1DArray(t) ? o = [t] : o = t, o[0].length !== this.shape[1]) throw Error("ValueError: length of newValues must be the same as the number of columns.");
    } else throw Error("ValueError: newValues must be a Series, DataFrame or Array");
    let s = [];
    if (Array.isArray(r) ? s = r : s = [r], o.length !== s.length) throw Error("ParamError: index must contain the same number of values as newValues");
    let i = [...this.values], l = [...this.index];
    if (o.forEach((u2, c) => {
      i.push(u2), l.push(s[c]);
    }), a) this.$setValues(i), this.$setIndex(l);
    else return new Na(i, { index: l, columns: [...this.columns], dtypes: [...this.dtypes], config: __spreadValues({}, this.config) });
  }
  query(t, r) {
    let { inplace: n } = __spreadValues({ inplace: false }, r);
    if (!t) throw new Error("ParamError: condition must be specified");
    let a = T_({ ndFrame: this, rows: t });
    if (n) this.$setValues(a.values, false, false), this.$setIndex(a.index);
    else return a;
  }
  get ctypes() {
    return new ea(this.dtypes, { index: this.columns });
  }
  getDummies(t) {
    let { inplace: r } = __spreadValues({ inplace: false }, t), n = Vx(this, t);
    if (r) this.$setValues(n.values, false, false), this.$setColumnNames(n.columns);
    else return n;
  }
  groupby(t) {
    let r = this.columns, n = t.map((o) => r.indexOf(o)), a = this.dtypes;
    return new Gg(t, this.values, r, a, n).group();
  }
  iat(t, r) {
    if (typeof t == "string" || typeof r == "string") throw new Error("ParamError: row and column index must be an integer. Use .at to get a row or column by label.");
    return this.values[t][r];
  }
  at(t, r) {
    if (typeof r != "string") throw new Error("ParamError: column index must be a string. Use .iat to get a row or column by index.");
    return this.values[this.index.indexOf(t)][this.columns.indexOf(r)];
  }
  plot(t) {
    if (vu.isBrowserEnv()) return new Ux(this, t);
    throw new Error("Not supported in NodeJS");
  }
};
var Xte = new hs();
function Zft(e, t) {
  let { columns: r, prefix: n, prefixSeparator: a } = __spreadValues({ columns: null, prefix: null, prefixSeparator: "_" }, t);
  if (!e) throw new Error("ParamError: data must be one of Array, Series or DataFrame");
  if (e instanceof ea || e instanceof Na) {
    if (!r) {
      let o = [];
      e.dtypes.forEach((s, i) => {
        s === "string" && o.push(e.columns[i]);
      }), r = o;
    }
  } else throw new Error("ParamError: data must be one of Array, Series or DataFrame");
  if (typeof r == "string") {
    if (r = [r], Array.isArray(n) && n.length === 1) n = n;
    else if (typeof n == "string") n = [n];
    else throw new Error("ParamError: prefix must be a string, or an array of same length as columns");
    if (Array.isArray(a) && a.length === 1) a = a;
    else if (typeof a == "string") a = [a];
    else throw new Error("ParamError: prefix must be a string, or an array of same length as columns");
  } else if (Array.isArray(r)) {
    if (n) {
      if (Array.isArray(n) && n.length !== r.length) throw new Error(`ParamError: prefix and data array must be of the same length. If you need to use the same prefix, then pass a string param instead. e.g {prefix: "${n}"}`);
      typeof n == "string" && (n = r.map((o) => n));
    }
    if (a) {
      if (Array.isArray(a) && a.length !== r.length) throw new Error(`ParamError: prefixSeparator and data array must be of the same length. If you need to use the same prefix separator, then pass a string param instead. e.g {prefixSeparator: "${a}"}`);
      typeof a == "string" && (a = r.map((o) => a));
    }
  } else throw new Error("ParamError: columns must be a string or an array of strings");
  if (e instanceof ea) {
    let o = e.values, s = [], i = Array.from(new Set(o)), l = Xte.zeros(o.length, i.length);
    for (let u2 = 0; u2 < o.length; u2++) {
      let c = i.indexOf(o[u2]);
      l[u2][c] = 1;
    }
    for (let u2 = 0; u2 < i.length; u2++) {
      let c = n ? n[0] : u2;
      s.push(`${c}${a[0]}${i[u2]}`);
    }
    return new Na(l, { columns: s });
  } else {
    let o = e.drop({ columns: r }), s = o?.values, i = o?.columns;
    for (let l = 0; l < r.length; l++) {
      let u2 = r[l], c = e.column(u2).values, f = Array.from(new Set(c)), h = Xte.zeros(c.length, f.length);
      for (let p = 0; p < c.length; p++) {
        let d = f.indexOf(c[p]);
        h[p][d] = 1;
        let m = `${n ? n[l] : u2}${a[l]}${c[p]}`;
        i.includes(m) || i.push(m);
      }
      for (let p = 0; p < s.length; p++) s[p] = [...s[p], ...h[p]];
    }
    return new Na(s, { columns: i });
  }
}
var Vx = Zft;
var Jft = new hs();
function U0({ ndFrame: e, other: t, operation: r }) {
  if (typeof t == "number") {
    let n;
    switch (r) {
      case "add":
        return n = e.values.map((a) => a + t), n;
      case "sub":
        return n = e.values.map((a) => a - t), n;
      case "mul":
        return n = e.values.map((a) => a * t), n;
      case "div":
        return n = e.values.map((a) => a / t), n;
      case "mod":
        return n = e.values.map((a) => a % t), n;
      case "pow":
        return n = e.values.map((a) => a ** t), n;
      case "minimum":
        return n = e.values.map((a) => Math.min(a, t)), n;
      case "maximum":
        return n = e.values.map((a) => Math.max(a, t)), n;
      default:
        throw new Error(`${r} is not implemented`);
    }
  } else if (t instanceof ea) {
    Jft.checkSeriesOpCompactibility({ firstSeries: e, secondSeries: t, operation: r });
    let n;
    switch (r) {
      case "add":
        return n = e.values.map((a, o) => a + t.values[o]), n;
      case "sub":
        return n = e.values.map((a, o) => a - t.values[o]), n;
      case "mul":
        return n = e.values.map((a, o) => a * t.values[o]), n;
      case "div":
        return n = e.values.map((a, o) => a / t.values[o]), n;
      case "mod":
        return n = e.values.map((a, o) => a % t.values[o]), n;
      case "pow":
        return n = e.values.map((a, o) => a ** t.values[o]), n;
      case "minimum":
        return n = e.values.map((a, o) => Math.min(a, t.values[o])), n;
      case "maximum":
        return n = e.values.map((a, o) => Math.max(a, t.values[o])), n;
      default:
        throw new Error(`${r} is not implemented`);
    }
  } else if (Array.isArray(t)) {
    if (t.length !== e.values.length) throw new Error("ParamError: Length of array must be equal to length of Series");
    let n;
    switch (r) {
      case "add":
        return n = e.values.map((a, o) => a + t[o]), n;
      case "sub":
        return n = e.values.map((a, o) => a - t[o]), n;
      case "mul":
        return n = e.values.map((a, o) => a * t[o]), n;
      case "div":
        return n = e.values.map((a, o) => a / t[o]), n;
      case "mod":
        return n = e.values.map((a, o) => a % t[o]), n;
      case "pow":
        return n = e.values.map((a, o) => a ** t[o]), n;
      case "minimum":
        return n = e.values.map((a, o) => Math.min(a, t[o])), n;
      case "maximum":
        return n = e.values.map((a, o) => Math.max(a, t[o])), n;
    }
  } else throw new Error("ParamError: value for other not supported. It must be either a scalar, Array or Series");
}
var Yte = km(e8());
var Fu = new hs();
var Kg = class {
  series;
  values;
  constructor(t) {
    this.series = t, this.values = t.values;
  }
  toLowerCase(t) {
    let { inplace: r } = __spreadValues({ inplace: false }, t), n = [];
    if (this.values.map((a) => {
      Fu.isEmpty(a) ? n.push(NaN) : n.push(`${a}`.toLowerCase());
    }), r) this.series.$setValues(n), this.series.print();
    else {
      let a = this.series.copy();
      return a.$setValues(n), a;
    }
  }
  toUpperCase(t) {
    let { inplace: r } = __spreadValues({ inplace: false }, t), n = [];
    if (this.values.map((a) => {
      Fu.isEmpty(a) ? n.push(NaN) : n.push(`${a}`.toUpperCase());
    }), r) this.series.$setValues(n), this.series.print();
    else {
      let a = this.series.copy();
      return a.$setValues(n), a;
    }
  }
  capitalize(t) {
    let { inplace: r } = __spreadValues({ inplace: false }, t), n = [];
    if (this.values.map((a) => {
      if (Fu.isEmpty(a)) n.push(NaN);
      else {
        let o = `${a}`.slice(0, 1), s = `${a}`.slice(1), i = `${o.toUpperCase()}${s.toLowerCase()}`;
        n.push(i);
      }
    }), r) this.series.$setValues(n), this.series.print();
    else {
      let a = this.series.copy();
      return a.$setValues(n), a;
    }
  }
  charAt(t = 0, r) {
    let { inplace: n } = __spreadValues({ inplace: false }, r), a = [];
    if (this.values.map((o) => {
      Fu.isEmpty(o) ? a.push(NaN) : a.push(`${o}`.charAt(t));
    }), n) this.series.$setValues(a), this.series.print();
    else {
      let o = this.series.copy();
      return o.$setValues(a), o;
    }
  }
  concat(t, r = 1, n) {
    let { inplace: a } = __spreadValues({ inplace: false }, n), o = [];
    if (Array.isArray(t)) for (let s = 0; s < t.length; s++) {
      let i = `${this.values[s]}`, l = `${t[s]}`;
      r == 1 ? o.push(i.concat(l)) : o.push(l.concat(i));
    }
    else this.values.map((s) => {
      r == 1 ? Fu.isEmpty(s) ? o.push(NaN) : o.push(`${s}`.concat(`${t}`)) : Fu.isEmpty(s) ? o.push(NaN) : o.push(t.concat(`${s}`));
    });
    if (a) this.series.$setValues(o), this.series.print();
    else {
      let s = this.series.copy();
      return s.$setValues(o), s;
    }
  }
  startsWith(t = "", r) {
    let { inplace: n } = __spreadValues({ inplace: false }, r), a = [];
    if (this.values.forEach((o) => {
      Fu.isEmpty(o) ? a.push(NaN) : a.push(`${o}`.startsWith(t));
    }), n) this.series.$setValues(a), this.series.print();
    else {
      let o = this.series.copy();
      return o.$setValues(a), o;
    }
  }
  endsWith(t = "", r) {
    let { inplace: n } = __spreadValues({ inplace: false }, r), a = [];
    if (this.values.map((o) => {
      Fu.isEmpty(o) ? a.push(NaN) : a.push(`${o}`.endsWith(t));
    }), n) this.series.$setValues(a), this.series.print();
    else {
      let o = this.series.copy();
      return o.$setValues(a), o;
    }
  }
  includes(t = "", r) {
    let { inplace: n } = __spreadValues({ inplace: false }, r), a = [];
    if (this.values.map((o) => {
      Fu.isEmpty(o) ? a.push(NaN) : a.push(`${o}`.includes(t));
    }), n) this.series.$setValues(a), this.series.print();
    else {
      let o = this.series.copy();
      return o.$setValues(a), o;
    }
  }
  indexOf(t = "", r) {
    let { inplace: n } = __spreadValues({ inplace: false }, r), a = [];
    if (this.values.map((o) => {
      Fu.isEmpty(o) ? a.push(NaN) : a.push(`${o}`.indexOf(t));
    }), n) this.series.$setValues(a), this.series.print();
    else {
      let o = this.series.copy();
      return o.$setValues(a), o;
    }
  }
  lastIndexOf(t = "", r) {
    let { inplace: n } = __spreadValues({ inplace: false }, r), a = [];
    if (this.values.map((o) => {
      Fu.isEmpty(o) ? a.push(NaN) : a.push(`${o}`.lastIndexOf(t));
    }), n) this.series.$setValues(a), this.series.print();
    else {
      let o = this.series.copy();
      return o.$setValues(a), o;
    }
  }
  replace(t = "", r = "", n) {
    let { inplace: a } = __spreadValues({ inplace: false }, n), o = [];
    if (this.values.map((s) => {
      Fu.isEmpty(s) ? o.push(NaN) : o.push(`${s}`.replace(t, r));
    }), a) this.series.$setValues(o), this.series.print();
    else {
      let s = this.series.copy();
      return s.$setValues(o), s;
    }
  }
  repeat(t = 1, r) {
    let { inplace: n } = __spreadValues({ inplace: false }, r), a = [];
    if (this.values.map((o) => {
      Fu.isEmpty(o) ? a.push(NaN) : a.push(`${o}`.repeat(t));
    }), n) this.series.$setValues(a), this.series.print();
    else {
      let o = this.series.copy();
      return o.$setValues(a), o;
    }
  }
  search(t = "", r) {
    let { inplace: n } = __spreadValues({ inplace: false }, r), a = [];
    if (this.values.map((o) => {
      Fu.isEmpty(o) ? a.push(NaN) : a.push(`${o}`.search(t));
    }), n) this.series.$setValues(a), this.series.print();
    else {
      let o = this.series.copy();
      return o.$setValues(a), o;
    }
  }
  slice(t = 0, r = 1, n) {
    let { inplace: a } = __spreadValues({ inplace: false }, n), o = [];
    if (this.values.map((s) => {
      Fu.isEmpty(s) ? o.push(NaN) : o.push(`${s}`.slice(t, r));
    }), a) this.series.$setValues(o), this.series.print();
    else {
      let s = this.series.copy();
      return s.$setValues(o), s;
    }
  }
  split(t = " ", r) {
    let { inplace: n } = __spreadValues({ inplace: false }, r), a = [];
    if (this.values.map((o) => {
      Fu.isEmpty(o) ? a.push(NaN) : a.push(`${String(o).split(t)}`);
    }), n) this.series.$setValues(a), this.series.print();
    else {
      let o = this.series.copy();
      return o.$setValues(a), o;
    }
  }
  substr(t = 0, r = 1, n) {
    let { inplace: a } = __spreadValues({ inplace: false }, n), o = [];
    if (this.values.map((s) => {
      Fu.isEmpty(s) ? o.push(NaN) : o.push(`${String(s).substr(t, r)}`);
    }), a) this.series.$setValues(o), this.series.print();
    else {
      let s = this.series.copy();
      return s.$setValues(o), s;
    }
  }
  substring(t = 0, r = 1, n) {
    let { inplace: a } = __spreadValues({ inplace: false }, n), o = [];
    if (this.values.map((s) => {
      Fu.isEmpty(s) ? o.push(NaN) : o.push(`${String(s).substring(t, r)}`);
    }), a) this.series.$setValues(o), this.series.print();
    else {
      let s = this.series.copy();
      return s.$setValues(o), s;
    }
  }
  trim(t) {
    let { inplace: r } = __spreadValues({ inplace: false }, t), n = [];
    if (this.values.map((a) => {
      Fu.isEmpty(a) ? n.push(NaN) : n.push(`${a}`.trim());
    }), r) this.series.$setValues(n), this.series.print();
    else {
      let a = this.series.copy();
      return a.$setValues(n), a;
    }
  }
  join(t = "", r = " ", n) {
    let { inplace: a } = __spreadValues({ inplace: false }, n), o = [];
    if (this.values.map((s) => {
      if (Fu.isEmpty(s)) o.push(NaN);
      else {
        let u2 = `${s}${r}${t}`;
        o.push(u2);
      }
    }), a) this.series.$setValues(o), this.series.print();
    else {
      let s = this.series.copy();
      return s.$setValues(o), s;
    }
  }
  len(t) {
    let { inplace: r } = __spreadValues({ inplace: false }, t), n = [];
    if (this.values.map((a) => {
      Fu.isEmpty(a) ? n.push(NaN) : n.push(`${a}`.length);
    }), r) this.series.$setValues(n), this.series.print();
    else {
      let a = this.series.copy();
      return a.$setValues(n), a;
    }
  }
};
var Qft = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
var eht = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
var Qv = class {
  $dateObjectArray;
  constructor(t) {
    t instanceof ea ? this.$dateObjectArray = this.processData(t.values) : this.$dateObjectArray = this.processData(t);
  }
  processData(t) {
    return t.map((n) => /* @__PURE__ */ new Date(`${n}`));
  }
  month() {
    let t = this.$dateObjectArray.map((r) => r.getMonth());
    return new ea(t);
  }
  dayOfWeek() {
    let t = this.$dateObjectArray.map((r) => r.getDay());
    return new ea(t);
  }
  year() {
    let t = this.$dateObjectArray.map((r) => r.getFullYear());
    return new ea(t);
  }
  monthName() {
    let t = this.$dateObjectArray.map((r) => eht[r.getMonth()]);
    return new ea(t);
  }
  dayOfWeekName() {
    let t = this.$dateObjectArray.map((r) => Qft[r.getDay()]);
    return new ea(t);
  }
  dayOfMonth() {
    let t = this.$dateObjectArray.map((r) => r.getDate());
    return new ea(t);
  }
  hours() {
    let t = this.$dateObjectArray.map((r) => r.getHours());
    return new ea(t);
  }
  seconds() {
    let t = this.$dateObjectArray.map((r) => r.getSeconds());
    return new ea(t);
  }
  minutes() {
    let t = this.$dateObjectArray.map((r) => r.getMinutes());
    return new ea(t);
  }
  date() {
    let t = this.$dateObjectArray.map((r) => r.toLocaleString());
    return new ea(t);
  }
};
var mu = new hs();
var ea = class extends O0 {
  constructor(t = [], r = {}) {
    let { index: n, columns: a, dtypes: o, config: s } = r;
    Array.isArray(t[0]) || mu.isObject(t[0]) ? (t = mu.convert2DArrayToSeriesArray(t), super({ data: t, index: n, columns: a, dtypes: o, config: s, isSeries: true })) : super({ data: t, index: n, columns: a, dtypes: o, config: s, isSeries: true });
  }
  iloc(t) {
    return T_({ ndFrame: this, rows: t });
  }
  loc(t) {
    return A_({ ndFrame: this, rows: t });
  }
  head(t = 5) {
    if (t <= 0) throw new Error("ParamError: Number of rows cannot be less than 1");
    if (this.shape[0] <= t) return this.copy();
    if (this.shape[0] - t < 0) throw new Error("ParamError: Number of rows cannot be greater than available rows in data");
    return this.iloc([`0:${t}`]);
  }
  tail(t = 5) {
    if (t <= 0) throw new Error("ParamError: Number of rows cannot be less than 1");
    if (this.shape[0] <= t) return this.copy();
    if (this.shape[0] - t < 0) throw new Error("ParamError: Number of rows cannot be greater than available rows in data");
    let r = this.shape[0] - t;
    return this.iloc([`${r}:`]);
  }
  async sample(t = 5, r) {
    let { seed: n } = __spreadValues({ seed: 1 }, r);
    if (t > this.shape[0]) throw new Error("Sample size n cannot be bigger than size of dataset");
    if (t < -1 || t == 0) throw new Error("Sample size cannot be less than -1 or be equal to 0");
    t = t === -1 ? this.shape[0] : t;
    let a = await zo.data.array(this.index).shuffle(t, `${n}`).take(t).toArray();
    return this.iloc(a);
  }
  add(t, r) {
    let { inplace: n } = __spreadValues({ inplace: false }, r);
    this.dtypes[0] == "string" && Zo.throwStringDtypeOperationError("add");
    let a = U0({ ndFrame: this, other: t, operation: "add" });
    if (n) this.$setValues(a);
    else return mu.createNdframeFromNewDataWithOldProps({ ndFrame: this, newData: a, isSeries: true });
  }
  sub(t, r) {
    let { inplace: n } = __spreadValues({ inplace: false }, r);
    this.dtypes[0] == "string" && Zo.throwStringDtypeOperationError("sub");
    let a = U0({ ndFrame: this, other: t, operation: "sub" });
    if (n) this.$setValues(a);
    else return mu.createNdframeFromNewDataWithOldProps({ ndFrame: this, newData: a, isSeries: true });
  }
  mul(t, r) {
    let { inplace: n } = __spreadValues({ inplace: false }, r);
    this.dtypes[0] == "string" && Zo.throwStringDtypeOperationError("mul");
    let a = U0({ ndFrame: this, other: t, operation: "mul" });
    if (n) this.$setValues(a);
    else return mu.createNdframeFromNewDataWithOldProps({ ndFrame: this, newData: a, isSeries: true });
  }
  div(t, r) {
    let { inplace: n } = __spreadValues({ inplace: false }, r);
    this.dtypes[0] == "string" && Zo.throwStringDtypeOperationError("div");
    let a = U0({ ndFrame: this, other: t, operation: "div" });
    if (n) this.$setValues(a);
    else return mu.createNdframeFromNewDataWithOldProps({ ndFrame: this, newData: a, isSeries: true });
  }
  pow(t, r) {
    let { inplace: n } = __spreadValues({ inplace: false }, r);
    this.dtypes[0] == "string" && Zo.throwStringDtypeOperationError("pow");
    let a = U0({ ndFrame: this, other: t, operation: "pow" });
    if (n) this.$setValues(a);
    else return mu.createNdframeFromNewDataWithOldProps({ ndFrame: this, newData: a, isSeries: true });
  }
  mod(t, r) {
    let { inplace: n } = __spreadValues({ inplace: false }, r);
    this.dtypes[0] == "string" && Zo.throwStringDtypeOperationError("mod");
    let a = U0({ ndFrame: this, other: t, operation: "mod" });
    if (n) this.$setValues(a);
    else return mu.createNdframeFromNewDataWithOldProps({ ndFrame: this, newData: a, isSeries: true });
  }
  $checkAndCleanValues(t, r) {
    return this.dtypes[0] == "string" && Zo.throwStringDtypeOperationError(r), t = mu.removeMissingValuesFromArray(t), this.dtypes[0] == "boolean" && (t = mu.mapBooleansToIntegers(t, 1)), t;
  }
  mean() {
    let t = this.$checkAndCleanValues(this.values, "mean");
    return t.reduce((r, n) => r + n) / t.length;
  }
  median() {
    let t = this.$checkAndCleanValues(this.values, "median");
    return jg(t);
  }
  mode() {
    let t = this.$checkAndCleanValues(this.values, "mode");
    return wx(t);
  }
  min() {
    let t = this.$checkAndCleanValues(this.values, "min"), r = t[0];
    for (let n = 0; n < t.length; n++) r = r < t[n] ? r : t[n];
    return r;
  }
  max() {
    let t = this.$checkAndCleanValues(this.values, "max"), r = t[0];
    for (let n = 0; n < t.length; n++) r = r > t[n] ? r : t[n];
    return r;
  }
  sum() {
    return this.$checkAndCleanValues(this.values, "sum").reduce((r, n) => r + n, 0);
  }
  count() {
    return mu.removeMissingValuesFromArray(this.values).length;
  }
  maximum(t) {
    this.dtypes[0] == "string" && Zo.throwStringDtypeOperationError("maximum");
    let r = U0({ ndFrame: this, other: t, operation: "maximum" });
    return new ea(r, { columns: this.columns, index: this.index });
  }
  minimum(t) {
    this.dtypes[0] == "string" && Zo.throwStringDtypeOperationError("maximum");
    let r = U0({ ndFrame: this, other: t, operation: "minimum" });
    return new ea(r, { columns: this.columns, index: this.index });
  }
  round(t = 1, r) {
    let { inplace: n } = __spreadValues({ inplace: false }, r);
    t === void 0 && (t = 1);
    let a = mu.round(this.values, t, true);
    if (n) this.$setValues(a);
    else return mu.createNdframeFromNewDataWithOldProps({ ndFrame: this, newData: a, isSeries: true });
  }
  std() {
    let t = this.$checkAndCleanValues(this.values, "max");
    return Wg(t);
  }
  var() {
    let t = this.$checkAndCleanValues(this.values, "max");
    return Yv(t);
  }
  isNa() {
    let t = this.values.map((n) => !!mu.isEmpty(n));
    return new ea(t, { index: this.index, dtypes: ["boolean"], config: this.config });
  }
  fillNa(t, r) {
    let { inplace: n } = __spreadValues({ inplace: false }, r);
    if (!t && typeof t != "boolean" && typeof t != "number") throw Error("ParamError: value must be specified");
    let a = [];
    if (this.values.forEach((o) => {
      mu.isEmpty(o) ? a.push(t) : a.push(o);
    }), n) this.$setValues(a);
    else return mu.createNdframeFromNewDataWithOldProps({ ndFrame: this, newData: a, isSeries: true });
  }
  sortValues(t) {
    let { ascending: r, inplace: n } = __spreadValues({ ascending: true, inplace: false }, t), a = [], o = [], s = mu.range(0, this.index.length - 1), i = mu.sortArrayByIndex(s, this.values, this.dtypes[0]);
    for (let l of i) a.push(this.values[l]), o.push(this.index[l]);
    if (r && (a = a.reverse(), o = o.reverse()), n) this.$setValues(a), this.$setIndex(o);
    else return new ea(a, { index: o, dtypes: this.dtypes, config: this.config });
  }
  copy() {
    return new ea([...this.values], { columns: [...this.columns], index: [...this.index], dtypes: [...this.dtypes], config: __spreadValues({}, this.config) });
  }
  describe() {
    if (this.dtypes[0] == "string") throw new Error("DType Error: Cannot generate descriptive statistics for Series with string dtype");
    {
      let t = ["count", "mean", "std", "min", "median", "max", "variance"], r = this.count(), n = this.mean(), a = this.std(), o = this.min(), s = this.median(), i = this.max(), l = this.var(), u2 = [r, n, a, o, s, i, l];
      return new ea(u2, { index: t });
    }
  }
  resetIndex(t) {
    let { inplace: r } = __spreadValues({ inplace: false }, t);
    if (r) this.$resetIndex();
    else {
      let n = this.copy();
      return n.$resetIndex(), n;
    }
  }
  setIndex(t, r) {
    let { inplace: n } = __spreadValues({ inplace: false }, r);
    if (!t) throw Error("Param Error: Must specify index array");
    if (n) this.$setIndex(t);
    else {
      let a = this.copy();
      return a.$setIndex(t), a;
    }
  }
  map(t, r) {
    let { inplace: n } = __spreadValues({ inplace: false }, r), a = mu.isFunction(t), o = this.values.map((s, i) => {
      if (a) return t(s, i);
      if (mu.isObject(t)) return s in t ? t[s] : s;
      throw new Error("Param Error: callable must either be a function or an object");
    });
    if (n) this.$setValues(o);
    else {
      let s = this.copy();
      return s.$setValues(o), s;
    }
  }
  apply(t, r) {
    let { inplace: n } = __spreadValues({ inplace: false }, r);
    if (!mu.isFunction(t)) throw new Error("Param Error: callable must be a function");
    let o = this.values.map((s) => t(s));
    if (n) this.$setValues(o);
    else {
      let s = this.copy();
      return s.$setValues(o), s;
    }
  }
  unique() {
    let t = new Set(this.values);
    return new ea(Array.from(t));
  }
  nUnique() {
    return new Set(this.values).size;
  }
  valueCounts() {
    let t = this.values, r = {};
    for (let s = 0; s < t.length; s++) {
      let i = t[s];
      `${i}` in r ? r[`${i}`] = r[`${i}`] + 1 : r[`${i}`] = 1;
    }
    let n = Object.keys(r).map((s) => parseInt(s) ? parseInt(s) : s), a = Object.values(r);
    return new ea(a, { index: n });
  }
  abs(t) {
    let { inplace: r } = __spreadValues({ inplace: false }, t);
    this.dtypes[0] == "string" && Zo.throwStringDtypeOperationError("abs");
    let n;
    if (n = this.values.map((a) => Math.abs(a)), r) this.$setValues(n);
    else {
      let a = this.copy();
      return a.$setValues(n), a;
    }
  }
  cumSum(t) {
    let r = __spreadValues({ inplace: false }, t);
    return this.cumOps("sum", r);
  }
  cumMin(t) {
    let r = __spreadValues({ inplace: false }, t);
    return this.cumOps("min", r);
  }
  cumMax(t) {
    let r = __spreadValues({ inplace: false }, t);
    return this.cumOps("max", r);
  }
  cumProd(t) {
    let r = __spreadValues({ inplace: false }, t);
    return this.cumOps("prod", r);
  }
  cumOps(t, r) {
    this.dtypes[0] == "string" && Zo.throwStringDtypeOperationError(t);
    let { inplace: n } = r, a = this.values, o = a[0], s = [o];
    for (let i = 1; i < a.length; i++) {
      let l = a[i];
      switch (t) {
        case "max":
          l > o ? (s.push(l), o = l) : s.push(o);
          break;
        case "min":
          l < o ? (s.push(l), o = l) : s.push(o);
          break;
        case "sum":
          o = o + l, s.push(o);
          break;
        case "prod":
          o = o * l, s.push(o);
          break;
      }
    }
    if (n) this.$setValues(s);
    else return new ea(s, { index: this.index, config: __spreadValues({}, this.config) });
  }
  lt(t) {
    return this.boolOps(t, "lt");
  }
  gt(t) {
    return this.boolOps(t, "gt");
  }
  le(t) {
    return this.boolOps(t, "le");
  }
  ge(t) {
    return this.boolOps(t, "ge");
  }
  ne(t) {
    return this.boolOps(t, "ne");
  }
  eq(t) {
    return this.boolOps(t, "eq");
  }
  boolOps(t, r) {
    let n = [], a = this.values, o;
    if (typeof t == "number") o = Array(this.values.length).fill(t);
    else if (typeof t == "string" && ["eq", "ne"].includes(r)) o = Array(this.values.length).fill(t);
    else if (t instanceof ea) o = t.values;
    else if (Array.isArray(t)) o = t;
    else throw new Error("ParamError: value for other not supported. It must be either a scalar, Array or Series");
    if (a.length !== o.length) throw new Error("LengthError: length of other must be equal to length of Series");
    for (let s = 0; s < a.length; s++) {
      let i = a[s], l = o[s], u2 = null;
      switch (r) {
        case "lt":
          u2 = i < l, n.push(u2);
          break;
        case "gt":
          u2 = i > l, n.push(u2);
          break;
        case "le":
          u2 = i <= l, n.push(u2);
          break;
        case "ge":
          u2 = i >= l, n.push(u2);
          break;
        case "ne":
          u2 = i !== l, n.push(u2);
          break;
        case "eq":
          u2 = i === l, n.push(u2);
          break;
      }
    }
    return new ea(n, { index: this.index, config: __spreadValues({}, this.config) });
  }
  replace(t, r, n) {
    let { inplace: a } = __spreadValues({ inplace: false }, n);
    if (typeof t == "number" && isNaN(t)) throw Error("Params Error: Param 'oldValue' does not support NaN. Use Series.fillNa() instead.");
    if (!t && typeof t != "boolean" && typeof t != "number" && typeof t != "string") throw Error("Params Error: Must specify param 'oldValue' to replace");
    if (!r && typeof r != "boolean" && typeof r != "number" && typeof r != "string") throw Error("Params Error: Must specify param 'newValue' to replace with");
    let o = [...this.values].map((s) => s === t ? r : s);
    if (a) this.$setValues(o);
    else {
      let s = this.copy();
      return s.$setValues(o), s;
    }
  }
  dropNa(t) {
    let { inplace: r } = __spreadValues({ inplace: false }, t), n = this.values, a = this.index, o = [], s = [];
    if (this.isNa().values.forEach((l, u2) => {
      l || (o.push(n[u2]), s.push(a[u2]));
    }), r) this.$setValues(o, false), this.$setIndex(s);
    else {
      let l = this.copy();
      return l.$setValues(o, false), l.$setIndex(s), l;
    }
  }
  argSort(t) {
    let { ascending: r } = __spreadValues({ ascending: true }, t), n = this.sortValues({ ascending: r });
    return new ea(n.index);
  }
  argMax() {
    return this.tensor.argMax().arraySync();
  }
  argMin() {
    return this.tensor.argMin().arraySync();
  }
  dropDuplicates(t) {
    let { keep: r, inplace: n } = __spreadValues({ keep: "first", inplace: false }, t);
    if (!["first", "last"].includes(r)) throw Error("Params Error: Keep must be one of 'first' or 'last'");
    let a, o = [], s, i = [];
    if (r === "last" ? (a = this.values.reverse(), s = this.index.reverse()) : (a = this.values, s = this.index), a.forEach((l, u2) => {
      o.includes(l) || (i.push(s[u2]), o.push(l));
    }), r === "last" && (o = o.reverse(), i = i.reverse()), n) this.$setValues(o, false), this.$setIndex(i);
    else {
      let l = this.copy();
      return l.$setValues(o, false), l.$setIndex(i), l;
    }
  }
  asType(t, r) {
    let { inplace: n } = __spreadValues({ inplace: false }, r);
    if (!t) throw Error("Param Error: Please specify dtype to cast to");
    if (!qp.includes(t)) throw Error(`dtype ${t} not supported. dtype must be one of ${qp}`);
    let a = [...this.values], o = [];
    switch (t) {
      case "float32":
        a.forEach((s) => {
          o.push(Number(s));
        });
        break;
      case "int32":
        a.forEach((s) => {
          o.push(parseInt(s));
        });
        break;
      case "string":
        a.forEach((s) => {
          o.push(String(s));
        });
        break;
      case "boolean":
        a.forEach((s) => {
          o.push(Boolean(s));
        });
        break;
      case "undefined":
        a.forEach((s) => {
          o.push(NaN);
        });
        break;
      default:
        break;
    }
    if (n) this.$setValues(o, false), this.$setDtypes([t]);
    else {
      let s = this.copy();
      return s.$setValues(o, false), s.$setDtypes([t]), s;
    }
  }
  append(t, r, n) {
    let { inplace: a } = __spreadValues({ inplace: false }, n);
    if (!t && typeof t != "boolean" && typeof t != "number") throw Error("Param Error: newValue cannot be null or undefined");
    if (!r) throw Error("Param Error: index cannot be null or undefined");
    let o = [...this.values], s = [...this.index];
    if (Array.isArray(t) && Array.isArray(r)) {
      if (t.length !== r.length) throw Error("Param Error: Length of new values and index must be the same");
      t.forEach((i, l) => {
        o.push(i), s.push(r[l]);
      });
    } else if (t instanceof ea) {
      let i = t.values;
      if (!Array.isArray(r)) throw Error("Param Error: index must be an array");
      if (r.length !== i.length) throw Error("Param Error: Length of new values and index must be the same");
      i.forEach((l, u2) => {
        o.push(l), s.push(r[u2]);
      });
    } else o.push(t), s.push(r);
    if (a) this.$setValues(o, false), this.$setIndex(s);
    else return new ea(o, { index: s, columns: this.columns, dtypes: this.dtypes, config: this.config });
  }
  get dtype() {
    return this.dtypes[0];
  }
  get str() {
    if (this.dtypes[0] == "string") return new Kg(this);
    throw new Error("Cannot call accessor str on non-string type");
  }
  get dt() {
    if (["string", "datetime"].includes(this.dtypes[0])) return new Qv(this);
    throw new Error("Cannot call accessor dt on non-string type");
  }
  toString() {
    let t = this.$config.getMaxRow, r, n = [];
    if (this.shape[0] > t) {
      let o = this.iloc([`0:${t}`]);
      r = o.index, n = o.values;
    } else r = this.index, n = this.values;
    let a = n.map((o, s) => [r[s], o]);
    return (0, Yte.table)(a);
  }
  and(t) {
    if (t === void 0) throw new Error("Param Error: other cannot be undefined");
    let r = [];
    if (t instanceof ea) {
      if (this.dtypes[0] !== t.dtypes[0]) throw new Error("Param Error: Series must be of same dtype");
      if (this.shape[0] !== t.shape[0]) throw new Error("Param Error: Series must be of same shape");
      this.values.forEach((n, a) => {
        r.push(Boolean(n) && Boolean(t.values[a]));
      });
    } else if (typeof t == "boolean") this.values.forEach((n) => {
      r.push(Boolean(n) && Boolean(t));
    });
    else if (Array.isArray(t)) this.values.forEach((n, a) => {
      r.push(Boolean(n) && Boolean(t[a]));
    });
    else throw new Error("Param Error: other must be a Series, Scalar, or Array of Scalars");
    return new ea(r, { index: this.index, config: __spreadValues({}, this.config) });
  }
  or(t) {
    if (t === void 0) throw new Error("Param Error: other cannot be undefined");
    let r = [];
    if (t instanceof ea) {
      if (this.dtypes[0] !== t.dtypes[0]) throw new Error("Param Error: Series must be of same dtype");
      if (this.shape[0] !== t.shape[0]) throw new Error("Param Error: Series must be of same shape");
      this.values.forEach((n, a) => {
        r.push(Boolean(n) || Boolean(t.values[a]));
      });
    } else if (typeof t == "boolean") this.values.forEach((n) => {
      r.push(Boolean(n) || Boolean(t));
    });
    else if (Array.isArray(t)) this.values.forEach((n, a) => {
      r.push(Boolean(n) || Boolean(t[a]));
    });
    else throw new Error("Param Error: other must be a Series, Scalar, or Array of Scalars");
    return new ea(r, { index: this.index, config: __spreadValues({}, this.config) });
  }
  getDummies(t) {
    return Vx(this, t);
  }
  iat(t) {
    if (typeof t == "string") throw new Error("ParamError: row index must be an integer. Use .at to get a row by label.");
    return this.values[t];
  }
  at(t) {
    if (typeof t != "string") throw new Error("ParamError: row index must be a string. Use .iat to get a row by index.");
    return this.values[this.index.indexOf(t)];
  }
  plot(t) {
    if (mu.isBrowserEnv()) return new Ux(this, t);
    throw new Error("Not supported in NodeJS");
  }
};
var tht = new hs();
var rht = new hs();
var nht = new hs();
var Zte = new hs();
var mS = new hs();
var gS = new hs();
var m8 = km(Jte());
var K_ = {};
K_.version = "0.19.3";
var gf = 1200;
var qx = 1252;
var Io;
var iht = [874, 932, 936, 949, 950, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1e4];
var j8 = { 0: 1252, 1: 65001, 2: 65001, 77: 1e4, 128: 932, 129: 949, 130: 1361, 134: 936, 136: 950, 161: 1253, 162: 1254, 163: 1258, 177: 1255, 178: 1256, 186: 1257, 204: 1251, 222: 874, 238: 1250, 255: 1252, 69: 6969 };
var W8 = function(e) {
  iht.indexOf(e) != -1 && (qx = j8[0] = e);
};
var kd = function(e) {
  gf = e, W8(e);
};
function yne(e) {
  for (var t = [], r = 0; r < e.length >> 1; ++r) t[r] = String.fromCharCode(e.charCodeAt(2 * r + 1) + (e.charCodeAt(2 * r) << 8));
  return t.join("");
}
var yS = function(t) {
  return String.fromCharCode(t);
};
var ire = function(t) {
  return String.fromCharCode(t);
};
var Lu = null;
var Cp = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
function FS(e) {
  for (var t = "", r = 0, n = 0, a = 0, o = 0, s = 0, i = 0, l = 0, u2 = 0; u2 < e.length; ) r = e.charCodeAt(u2++), o = r >> 2, n = e.charCodeAt(u2++), s = (r & 3) << 4 | n >> 4, a = e.charCodeAt(u2++), i = (n & 15) << 2 | a >> 6, l = a & 63, isNaN(n) ? i = l = 64 : isNaN(a) && (l = 64), t += Cp.charAt(o) + Cp.charAt(s) + Cp.charAt(i) + Cp.charAt(l);
  return t;
}
function qh(e) {
  var t = "", r = 0, n = 0, a = 0, o = 0, s = 0, i = 0, l = 0;
  e = e.replace(/^data:([^\/]+\/[^\/]+)?;base64\,/, "").replace(/[^\w\+\/\=]/g, "");
  for (var u2 = 0; u2 < e.length; ) o = Cp.indexOf(e.charAt(u2++)), s = Cp.indexOf(e.charAt(u2++)), r = o << 2 | s >> 4, t += String.fromCharCode(r), i = Cp.indexOf(e.charAt(u2++)), n = (s & 15) << 4 | i >> 2, i !== 64 && (t += String.fromCharCode(n)), l = Cp.indexOf(e.charAt(u2++)), a = (i & 3) << 6 | l, l !== 64 && (t += String.fromCharCode(a));
  return t;
}
var wo = function() {
  return typeof Buffer < "u" && typeof process < "u" && typeof process.versions < "u" && !!process.versions.node;
}();
var s0 = function() {
  if (typeof Buffer < "u") {
    var e = !Buffer.from;
    if (!e) try {
      Buffer.from("foo", "utf8");
    } catch {
      e = true;
    }
    return e ? function(t, r) {
      return r ? new Buffer(t, r) : new Buffer(t);
    } : Buffer.from.bind(Buffer);
  }
  return function() {
  };
}();
var Y_ = function() {
  if (typeof Buffer > "u") return false;
  var e = s0([65, 0]);
  if (!e) return false;
  var t = e.toString("utf16le");
  return t.length == 1;
}();
function am(e) {
  return wo ? Buffer.alloc ? Buffer.alloc(e) : new Buffer(e) : typeof Uint8Array < "u" ? new Uint8Array(e) : new Array(e);
}
function sre(e) {
  return wo ? Buffer.allocUnsafe ? Buffer.allocUnsafe(e) : new Buffer(e) : typeof Uint8Array < "u" ? new Uint8Array(e) : new Array(e);
}
var Hf = function(t) {
  return wo ? s0(t, "binary") : t.split("").map(function(r) {
    return r.charCodeAt(0) & 255;
  });
};
function o0(e) {
  if (Array.isArray(e)) return e.map(function(n) {
    return String.fromCharCode(n);
  }).join("");
  for (var t = [], r = 0; r < e.length; ++r) t[r] = String.fromCharCode(e[r]);
  return t.join("");
}
var Ju = wo ? function(e) {
  return Buffer.concat(e.map(function(t) {
    return Buffer.isBuffer(t) ? t : s0(t);
  }));
} : function(e) {
  if (typeof Uint8Array < "u") {
    var t = 0, r = 0;
    for (t = 0; t < e.length; ++t) r += e[t].length;
    var n = new Uint8Array(r), a = 0;
    for (t = 0, r = 0; t < e.length; r += a, ++t) a = e[t].length, e[t] instanceof Uint8Array ? n.set(e[t], r) : typeof e[t] == "string" ? n.set(new Uint8Array(Hf(e[t])), r) : n.set(new Uint8Array(e[t]), r);
    return n;
  }
  return [].concat.apply([], e.map(function(o) {
    return Array.isArray(o) ? o : [].slice.call(o);
  }));
};
var xf = /\u0000/g;
var R_ = /[\u0001-\u0006]/g;
function Gx(e) {
  for (var t = "", r = e.length - 1; r >= 0; ) t += e.charAt(r--);
  return t;
}
function Td(e, t) {
  var r = "" + e;
  return r.length >= t ? r : rs("0", t - r.length) + r;
}
function H8(e, t) {
  var r = "" + e;
  return r.length >= t ? r : rs(" ", t - r.length) + r;
}
function OS(e, t) {
  var r = "" + e;
  return r.length >= t ? r : r + rs(" ", t - r.length);
}
function fht(e, t) {
  var r = "" + Math.round(e);
  return r.length >= t ? r : rs("0", t - r.length) + r;
}
function hht(e, t) {
  var r = "" + e;
  return r.length >= t ? r : rs("0", t - r.length) + r;
}
var lre = Math.pow(2, 32);
function jx(e, t) {
  if (e > lre || e < -lre) return fht(e, t);
  var r = Math.round(e);
  return hht(r, t);
}
function PS(e, t) {
  return t = t || 0, e.length >= 7 + t && (e.charCodeAt(t) | 32) === 103 && (e.charCodeAt(t + 1) | 32) === 101 && (e.charCodeAt(t + 2) | 32) === 110 && (e.charCodeAt(t + 3) | 32) === 101 && (e.charCodeAt(t + 4) | 32) === 114 && (e.charCodeAt(t + 5) | 32) === 97 && (e.charCodeAt(t + 6) | 32) === 108;
}
var ure = [["Sun", "Sunday"], ["Mon", "Monday"], ["Tue", "Tuesday"], ["Wed", "Wednesday"], ["Thu", "Thursday"], ["Fri", "Friday"], ["Sat", "Saturday"]];
var y8 = [["J", "Jan", "January"], ["F", "Feb", "February"], ["M", "Mar", "March"], ["A", "Apr", "April"], ["M", "May", "May"], ["J", "Jun", "June"], ["J", "Jul", "July"], ["A", "Aug", "August"], ["S", "Sep", "September"], ["O", "Oct", "October"], ["N", "Nov", "November"], ["D", "Dec", "December"]];
var $i = { 0: "General", 1: "0", 2: "0.00", 3: "#,##0", 4: "#,##0.00", 9: "0%", 10: "0.00%", 11: "0.00E+00", 12: "# ?/?", 13: "# ??/??", 14: "m/d/yy", 15: "d-mmm-yy", 16: "d-mmm", 17: "mmm-yy", 18: "h:mm AM/PM", 19: "h:mm:ss AM/PM", 20: "h:mm", 21: "h:mm:ss", 22: "m/d/yy h:mm", 37: "#,##0 ;(#,##0)", 38: "#,##0 ;[Red](#,##0)", 39: "#,##0.00;(#,##0.00)", 40: "#,##0.00;[Red](#,##0.00)", 45: "mm:ss", 46: "[h]:mm:ss", 47: "mmss.0", 48: "##0.0E+0", 49: "@", 56: '"\u4E0A\u5348/\u4E0B\u5348 "hh"\u6642"mm"\u5206"ss"\u79D2 "' };
var cre = { 5: 37, 6: 38, 7: 39, 8: 40, 23: 0, 24: 0, 25: 0, 26: 0, 27: 14, 28: 14, 29: 14, 30: 14, 31: 14, 50: 14, 51: 14, 52: 14, 53: 14, 54: 14, 55: 14, 56: 14, 57: 14, 58: 14, 59: 1, 60: 2, 61: 3, 62: 4, 67: 9, 68: 10, 69: 12, 70: 13, 71: 14, 72: 14, 73: 15, 74: 16, 75: 17, 76: 20, 77: 21, 78: 22, 79: 45, 80: 46, 81: 47, 82: 0 };
var dht = { 5: '"$"#,##0_);\\("$"#,##0\\)', 63: '"$"#,##0_);\\("$"#,##0\\)', 6: '"$"#,##0_);[Red]\\("$"#,##0\\)', 64: '"$"#,##0_);[Red]\\("$"#,##0\\)', 7: '"$"#,##0.00_);\\("$"#,##0.00\\)', 65: '"$"#,##0.00_);\\("$"#,##0.00\\)', 8: '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)', 66: '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)', 41: '_(* #,##0_);_(* \\(#,##0\\);_(* "-"_);_(@_)', 42: '_("$"* #,##0_);_("$"* \\(#,##0\\);_("$"* "-"_);_(@_)', 43: '_(* #,##0.00_);_(* \\(#,##0.00\\);_(* "-"??_);_(@_)', 44: '_("$"* #,##0.00_);_("$"* \\(#,##0.00\\);_("$"* "-"??_);_(@_)' };
function LS(e, t, r) {
  for (var n = e < 0 ? -1 : 1, a = e * n, o = 0, s = 1, i = 0, l = 1, u2 = 0, c = 0, f = Math.floor(a); u2 < t && (f = Math.floor(a), i = f * s + o, c = f * u2 + l, !(a - f < 5e-8)); ) a = 1 / (a - f), o = s, s = i, l = u2, u2 = c;
  if (c > t && (u2 > t ? (c = l, i = o) : (c = u2, i = s)), !r) return [0, n * i, c];
  var h = Math.floor(n * i / c);
  return [h, n * i - h * c, c];
}
function Zg(e, t, r) {
  if (e > 2958465 || e < 0) return null;
  var n = e | 0, a = Math.floor(86400 * (e - n)), o = 0, s = [], i = { D: n, T: a, u: 86400 * (e - n) - a, y: 0, m: 0, d: 0, H: 0, M: 0, S: 0, q: 0 };
  if (Math.abs(i.u) < 1e-6 && (i.u = 0), t && t.date1904 && (n += 1462), i.u > 0.9999 && (i.u = 0, ++a == 86400 && (i.T = a = 0, ++n, ++i.D)), n === 60) s = r ? [1317, 10, 29] : [1900, 2, 29], o = 3;
  else if (n === 0) s = r ? [1317, 8, 29] : [1900, 1, 0], o = 6;
  else {
    n > 60 && --n;
    var l = new Date(1900, 0, 1);
    l.setDate(l.getDate() + n - 1), s = [l.getFullYear(), l.getMonth() + 1, l.getDate()], o = l.getDay(), n < 60 && (o = (o + 6) % 7), r && (o = bht(l, s));
  }
  return i.y = s[0], i.m = s[1], i.d = s[2], i.S = a % 60, a = Math.floor(a / 60), i.M = a % 60, a = Math.floor(a / 60), i.H = a, i.q = o, i;
}
var xne = new Date(1899, 11, 31, 0, 0, 0);
var vht = xne.getTime();
var mht = new Date(1900, 2, 1, 0, 0, 0);
function bne(e, t) {
  var r = e.getTime();
  return t ? r -= 1461 * 24 * 60 * 60 * 1e3 : e >= mht && (r += 24 * 60 * 60 * 1e3), (r - (vht + (e.getTimezoneOffset() - xne.getTimezoneOffset()) * 6e4)) / (24 * 60 * 60 * 1e3);
}
function q8(e) {
  return e.indexOf(".") == -1 ? e : e.replace(/(?:\.0*|(\.\d*[1-9])0+)$/, "$1");
}
function ght(e) {
  return e.indexOf("E") == -1 ? e : e.replace(/(?:\.0*|(\.\d*[1-9])0+)[Ee]/, "$1E").replace(/(E[+-])(\d)$/, "$10$2");
}
function yht(e) {
  var t = e < 0 ? 12 : 11, r = q8(e.toFixed(12));
  return r.length <= t || (r = e.toPrecision(10), r.length <= t) ? r : e.toExponential(5);
}
function xht(e) {
  var t = q8(e.toFixed(11));
  return t.length > (e < 0 ? 12 : 11) || t === "0" || t === "-0" ? e.toPrecision(6) : t;
}
function Z_(e) {
  var t = Math.floor(Math.log(Math.abs(e)) * Math.LOG10E), r;
  return t >= -4 && t <= -1 ? r = e.toPrecision(10 + t) : Math.abs(t) <= 9 ? r = yht(e) : t === 10 ? r = e.toFixed(10).substr(0, 12) : r = xht(e), q8(ght(r.toUpperCase()));
}
function a1(e, t) {
  switch (typeof e) {
    case "string":
      return e;
    case "boolean":
      return e ? "TRUE" : "FALSE";
    case "number":
      return (e | 0) === e ? e.toString(10) : Z_(e);
    case "undefined":
      return "";
    case "object":
      if (e == null) return "";
      if (e instanceof Date) return Xh(14, bne(e, t && t.date1904), t);
  }
  throw new Error("unsupported value in General format: " + e);
}
function bht(e, t) {
  t[0] -= 581;
  var r = e.getDay();
  return e < 60 && (r = (r + 6) % 7), r;
}
function _ht(e, t, r, n) {
  var a = "", o = 0, s = 0, i = r.y, l, u2 = 0;
  switch (e) {
    case 98:
      i = r.y + 543;
    case 121:
      switch (t.length) {
        case 1:
        case 2:
          l = i % 100, u2 = 2;
          break;
        default:
          l = i % 1e4, u2 = 4;
          break;
      }
      break;
    case 109:
      switch (t.length) {
        case 1:
        case 2:
          l = r.m, u2 = t.length;
          break;
        case 3:
          return y8[r.m - 1][1];
        case 5:
          return y8[r.m - 1][0];
        default:
          return y8[r.m - 1][2];
      }
      break;
    case 100:
      switch (t.length) {
        case 1:
        case 2:
          l = r.d, u2 = t.length;
          break;
        case 3:
          return ure[r.q][0];
        default:
          return ure[r.q][1];
      }
      break;
    case 104:
      switch (t.length) {
        case 1:
        case 2:
          l = 1 + (r.H + 11) % 12, u2 = t.length;
          break;
        default:
          throw "bad hour format: " + t;
      }
      break;
    case 72:
      switch (t.length) {
        case 1:
        case 2:
          l = r.H, u2 = t.length;
          break;
        default:
          throw "bad hour format: " + t;
      }
      break;
    case 77:
      switch (t.length) {
        case 1:
        case 2:
          l = r.M, u2 = t.length;
          break;
        default:
          throw "bad minute format: " + t;
      }
      break;
    case 115:
      if (t != "s" && t != "ss" && t != ".0" && t != ".00" && t != ".000") throw "bad second format: " + t;
      return r.u === 0 && (t == "s" || t == "ss") ? Td(r.S, t.length) : (n >= 2 ? s = n === 3 ? 1e3 : 100 : s = n === 1 ? 10 : 1, o = Math.round(s * (r.S + r.u)), o >= 60 * s && (o = 0), t === "s" ? o === 0 ? "0" : "" + o / s : (a = Td(o, 2 + n), t === "ss" ? a.substr(0, 2) : "." + a.substr(2, t.length - 1)));
    case 90:
      switch (t) {
        case "[h]":
        case "[hh]":
          l = r.D * 24 + r.H;
          break;
        case "[m]":
        case "[mm]":
          l = (r.D * 24 + r.H) * 60 + r.M;
          break;
        case "[s]":
        case "[ss]":
          l = ((r.D * 24 + r.H) * 60 + r.M) * 60 + Math.round(r.S + r.u);
          break;
        default:
          throw "bad abstime format: " + t;
      }
      u2 = t.length === 3 ? 1 : 2;
      break;
    case 101:
      l = i, u2 = 1;
      break;
  }
  var c = u2 > 0 ? Td(l, u2) : "";
  return c;
}
function W0(e) {
  var t = 3;
  if (e.length <= t) return e;
  for (var r = e.length % t, n = e.substr(0, r); r != e.length; r += t) n += (n.length > 0 ? "," : "") + e.substr(r, t);
  return n;
}
var _ne = /%/g;
function wht(e, t, r) {
  var n = t.replace(_ne, ""), a = t.length - n.length;
  return $0(e, n, r * Math.pow(10, 2 * a)) + rs("%", a);
}
function kht(e, t, r) {
  for (var n = t.length - 1; t.charCodeAt(n - 1) === 44; ) --n;
  return $0(e, t.substr(0, n), r / Math.pow(10, 3 * (t.length - n)));
}
function wne(e, t) {
  var r, n = e.indexOf("E") - e.indexOf(".") - 1;
  if (e.match(/^#+0.0E\+0$/)) {
    if (t == 0) return "0.0E+0";
    if (t < 0) return "-" + wne(e, -t);
    var a = e.indexOf(".");
    a === -1 && (a = e.indexOf("E"));
    var o = Math.floor(Math.log(t) * Math.LOG10E) % a;
    if (o < 0 && (o += a), r = (t / Math.pow(10, o)).toPrecision(n + 1 + (a + o) % a), r.indexOf("e") === -1) {
      var s = Math.floor(Math.log(t) * Math.LOG10E);
      for (r.indexOf(".") === -1 ? r = r.charAt(0) + "." + r.substr(1) + "E+" + (s - r.length + o) : r += "E+" + (s - o); r.substr(0, 2) === "0."; ) r = r.charAt(0) + r.substr(2, a) + "." + r.substr(2 + a), r = r.replace(/^0+([1-9])/, "$1").replace(/^0+\./, "0.");
      r = r.replace(/\+-/, "-");
    }
    r = r.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/, function(i, l, u2, c) {
      return l + u2 + c.substr(0, (a + o) % a) + "." + c.substr(o) + "E";
    });
  } else r = t.toExponential(n);
  return e.match(/E\+00$/) && r.match(/e[+-]\d$/) && (r = r.substr(0, r.length - 1) + "0" + r.charAt(r.length - 1)), e.match(/E\-/) && r.match(/e\+/) && (r = r.replace(/e\+/, "e")), r.replace("e", "E");
}
var kne = /# (\?+)( ?)\/( ?)(\d+)/;
function Tht(e, t, r) {
  var n = parseInt(e[4], 10), a = Math.round(t * n), o = Math.floor(a / n), s = a - o * n, i = n;
  return r + (o === 0 ? "" : "" + o) + " " + (s === 0 ? rs(" ", e[1].length + 1 + e[4].length) : H8(s, e[1].length) + e[2] + "/" + e[3] + Td(i, e[4].length));
}
function Aht(e, t, r) {
  return r + (t === 0 ? "" : "" + t) + rs(" ", e[1].length + 2 + e[4].length);
}
var Tne = /^#*0*\.([0#]+)/;
var Ane = /\).*[0#]/;
var Sne = /\(###\) ###\\?-####/;
function Gf(e) {
  for (var t = "", r, n = 0; n != e.length; ++n) switch (r = e.charCodeAt(n)) {
    case 35:
      break;
    case 63:
      t += " ";
      break;
    case 48:
      t += "0";
      break;
    default:
      t += String.fromCharCode(r);
  }
  return t;
}
function fre(e, t) {
  var r = Math.pow(10, t);
  return "" + Math.round(e * r) / r;
}
function hre(e, t) {
  var r = e - Math.floor(e), n = Math.pow(10, t);
  return t < ("" + Math.round(r * n)).length ? 0 : Math.round(r * n);
}
function Sht(e, t) {
  return t < ("" + Math.round((e - Math.floor(e)) * Math.pow(10, t))).length ? 1 : 0;
}
function Eht(e) {
  return e < 2147483647 && e > -2147483648 ? "" + (e >= 0 ? e | 0 : e - 1 | 0) : "" + Math.floor(e);
}
function Sp(e, t, r) {
  if (e.charCodeAt(0) === 40 && !t.match(Ane)) {
    var n = t.replace(/\( */, "").replace(/ \)/, "").replace(/\)/, "");
    return r >= 0 ? Sp("n", n, r) : "(" + Sp("n", n, -r) + ")";
  }
  if (t.charCodeAt(t.length - 1) === 44) return kht(e, t, r);
  if (t.indexOf("%") !== -1) return wht(e, t, r);
  if (t.indexOf("E") !== -1) return wne(t, r);
  if (t.charCodeAt(0) === 36) return "$" + Sp(e, t.substr(t.charAt(1) == " " ? 2 : 1), r);
  var a, o, s, i, l = Math.abs(r), u2 = r < 0 ? "-" : "";
  if (t.match(/^00+$/)) return u2 + jx(l, t.length);
  if (t.match(/^[#?]+$/)) return a = jx(r, 0), a === "0" && (a = ""), a.length > t.length ? a : Gf(t.substr(0, t.length - a.length)) + a;
  if (o = t.match(kne)) return Tht(o, l, u2);
  if (t.match(/^#+0+$/)) return u2 + jx(l, t.length - t.indexOf("0"));
  if (o = t.match(Tne)) return a = fre(r, o[1].length).replace(/^([^\.]+)$/, "$1." + Gf(o[1])).replace(/\.$/, "." + Gf(o[1])).replace(/\.(\d*)$/, function(d, v) {
    return "." + v + rs("0", Gf(o[1]).length - v.length);
  }), t.indexOf("0.") !== -1 ? a : a.replace(/^0\./, ".");
  if (t = t.replace(/^#+([0.])/, "$1"), o = t.match(/^(0*)\.(#*)$/)) return u2 + fre(l, o[2].length).replace(/\.(\d*[1-9])0*$/, ".$1").replace(/^(-?\d*)$/, "$1.").replace(/^0\./, o[1].length ? "0." : ".");
  if (o = t.match(/^#{1,3},##0(\.?)$/)) return u2 + W0(jx(l, 0));
  if (o = t.match(/^#,##0\.([#0]*0)$/)) return r < 0 ? "-" + Sp(e, t, -r) : W0("" + (Math.floor(r) + Sht(r, o[1].length))) + "." + Td(hre(r, o[1].length), o[1].length);
  if (o = t.match(/^#,#*,#0/)) return Sp(e, t.replace(/^#,#*,/, ""), r);
  if (o = t.match(/^([0#]+)(\\?-([0#]+))+$/)) return a = Gx(Sp(e, t.replace(/[\\-]/g, ""), r)), s = 0, Gx(Gx(t.replace(/\\/g, "")).replace(/[0#]/g, function(d) {
    return s < a.length ? a.charAt(s++) : d === "0" ? "0" : "";
  }));
  if (t.match(Sne)) return a = Sp(e, "##########", r), "(" + a.substr(0, 3) + ") " + a.substr(3, 3) + "-" + a.substr(6);
  var c = "";
  if (o = t.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/)) return s = Math.min(o[4].length, 7), i = LS(l, Math.pow(10, s) - 1, false), a = "" + u2, c = $0("n", o[1], i[1]), c.charAt(c.length - 1) == " " && (c = c.substr(0, c.length - 1) + "0"), a += c + o[2] + "/" + o[3], c = OS(i[2], s), c.length < o[4].length && (c = Gf(o[4].substr(o[4].length - c.length)) + c), a += c, a;
  if (o = t.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/)) return s = Math.min(Math.max(o[1].length, o[4].length), 7), i = LS(l, Math.pow(10, s) - 1, true), u2 + (i[0] || (i[1] ? "" : "0")) + " " + (i[1] ? H8(i[1], s) + o[2] + "/" + o[3] + OS(i[2], s) : rs(" ", 2 * s + 1 + o[2].length + o[3].length));
  if (o = t.match(/^[#0?]+$/)) return a = jx(r, 0), t.length <= a.length ? a : Gf(t.substr(0, t.length - a.length)) + a;
  if (o = t.match(/^([#0?]+)\.([#0]+)$/)) {
    a = "" + r.toFixed(Math.min(o[2].length, 10)).replace(/([^0])0+$/, "$1"), s = a.indexOf(".");
    var f = t.indexOf(".") - s, h = t.length - a.length - f;
    return Gf(t.substr(0, f) + a + t.substr(t.length - h));
  }
  if (o = t.match(/^00,000\.([#0]*0)$/)) return s = hre(r, o[1].length), r < 0 ? "-" + Sp(e, t, -r) : W0(Eht(r)).replace(/^\d,\d{3}$/, "0$&").replace(/^\d*$/, function(d) {
    return "00," + (d.length < 3 ? Td(0, 3 - d.length) : "") + d;
  }) + "." + Td(s, o[1].length);
  switch (t) {
    case "###,##0.00":
      return Sp(e, "#,##0.00", r);
    case "###,###":
    case "##,###":
    case "#,###":
      var p = W0(jx(l, 0));
      return p !== "0" ? u2 + p : "";
    case "###,###.00":
      return Sp(e, "###,##0.00", r).replace(/^0\./, ".");
    case "#,###.00":
      return Sp(e, "#,##0.00", r).replace(/^0\./, ".");
    default:
  }
  throw new Error("unsupported format |" + t + "|");
}
function Dht(e, t, r) {
  for (var n = t.length - 1; t.charCodeAt(n - 1) === 44; ) --n;
  return $0(e, t.substr(0, n), r / Math.pow(10, 3 * (t.length - n)));
}
function Cht(e, t, r) {
  var n = t.replace(_ne, ""), a = t.length - n.length;
  return $0(e, n, r * Math.pow(10, 2 * a)) + rs("%", a);
}
function Ene(e, t) {
  var r, n = e.indexOf("E") - e.indexOf(".") - 1;
  if (e.match(/^#+0.0E\+0$/)) {
    if (t == 0) return "0.0E+0";
    if (t < 0) return "-" + Ene(e, -t);
    var a = e.indexOf(".");
    a === -1 && (a = e.indexOf("E"));
    var o = Math.floor(Math.log(t) * Math.LOG10E) % a;
    if (o < 0 && (o += a), r = (t / Math.pow(10, o)).toPrecision(n + 1 + (a + o) % a), !r.match(/[Ee]/)) {
      var s = Math.floor(Math.log(t) * Math.LOG10E);
      r.indexOf(".") === -1 ? r = r.charAt(0) + "." + r.substr(1) + "E+" + (s - r.length + o) : r += "E+" + (s - o), r = r.replace(/\+-/, "-");
    }
    r = r.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/, function(i, l, u2, c) {
      return l + u2 + c.substr(0, (a + o) % a) + "." + c.substr(o) + "E";
    });
  } else r = t.toExponential(n);
  return e.match(/E\+00$/) && r.match(/e[+-]\d$/) && (r = r.substr(0, r.length - 1) + "0" + r.charAt(r.length - 1)), e.match(/E\-/) && r.match(/e\+/) && (r = r.replace(/e\+/, "e")), r.replace("e", "E");
}
function r0(e, t, r) {
  if (e.charCodeAt(0) === 40 && !t.match(Ane)) {
    var n = t.replace(/\( */, "").replace(/ \)/, "").replace(/\)/, "");
    return r >= 0 ? r0("n", n, r) : "(" + r0("n", n, -r) + ")";
  }
  if (t.charCodeAt(t.length - 1) === 44) return Dht(e, t, r);
  if (t.indexOf("%") !== -1) return Cht(e, t, r);
  if (t.indexOf("E") !== -1) return Ene(t, r);
  if (t.charCodeAt(0) === 36) return "$" + r0(e, t.substr(t.charAt(1) == " " ? 2 : 1), r);
  var a, o, s, i, l = Math.abs(r), u2 = r < 0 ? "-" : "";
  if (t.match(/^00+$/)) return u2 + Td(l, t.length);
  if (t.match(/^[#?]+$/)) return a = "" + r, r === 0 && (a = ""), a.length > t.length ? a : Gf(t.substr(0, t.length - a.length)) + a;
  if (o = t.match(kne)) return Aht(o, l, u2);
  if (t.match(/^#+0+$/)) return u2 + Td(l, t.length - t.indexOf("0"));
  if (o = t.match(Tne)) return a = ("" + r).replace(/^([^\.]+)$/, "$1." + Gf(o[1])).replace(/\.$/, "." + Gf(o[1])), a = a.replace(/\.(\d*)$/, function(d, v) {
    return "." + v + rs("0", Gf(o[1]).length - v.length);
  }), t.indexOf("0.") !== -1 ? a : a.replace(/^0\./, ".");
  if (t = t.replace(/^#+([0.])/, "$1"), o = t.match(/^(0*)\.(#*)$/)) return u2 + ("" + l).replace(/\.(\d*[1-9])0*$/, ".$1").replace(/^(-?\d*)$/, "$1.").replace(/^0\./, o[1].length ? "0." : ".");
  if (o = t.match(/^#{1,3},##0(\.?)$/)) return u2 + W0("" + l);
  if (o = t.match(/^#,##0\.([#0]*0)$/)) return r < 0 ? "-" + r0(e, t, -r) : W0("" + r) + "." + rs("0", o[1].length);
  if (o = t.match(/^#,#*,#0/)) return r0(e, t.replace(/^#,#*,/, ""), r);
  if (o = t.match(/^([0#]+)(\\?-([0#]+))+$/)) return a = Gx(r0(e, t.replace(/[\\-]/g, ""), r)), s = 0, Gx(Gx(t.replace(/\\/g, "")).replace(/[0#]/g, function(d) {
    return s < a.length ? a.charAt(s++) : d === "0" ? "0" : "";
  }));
  if (t.match(Sne)) return a = r0(e, "##########", r), "(" + a.substr(0, 3) + ") " + a.substr(3, 3) + "-" + a.substr(6);
  var c = "";
  if (o = t.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/)) return s = Math.min(o[4].length, 7), i = LS(l, Math.pow(10, s) - 1, false), a = "" + u2, c = $0("n", o[1], i[1]), c.charAt(c.length - 1) == " " && (c = c.substr(0, c.length - 1) + "0"), a += c + o[2] + "/" + o[3], c = OS(i[2], s), c.length < o[4].length && (c = Gf(o[4].substr(o[4].length - c.length)) + c), a += c, a;
  if (o = t.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/)) return s = Math.min(Math.max(o[1].length, o[4].length), 7), i = LS(l, Math.pow(10, s) - 1, true), u2 + (i[0] || (i[1] ? "" : "0")) + " " + (i[1] ? H8(i[1], s) + o[2] + "/" + o[3] + OS(i[2], s) : rs(" ", 2 * s + 1 + o[2].length + o[3].length));
  if (o = t.match(/^[#0?]+$/)) return a = "" + r, t.length <= a.length ? a : Gf(t.substr(0, t.length - a.length)) + a;
  if (o = t.match(/^([#0]+)\.([#0]+)$/)) {
    a = "" + r.toFixed(Math.min(o[2].length, 10)).replace(/([^0])0+$/, "$1"), s = a.indexOf(".");
    var f = t.indexOf(".") - s, h = t.length - a.length - f;
    return Gf(t.substr(0, f) + a + t.substr(t.length - h));
  }
  if (o = t.match(/^00,000\.([#0]*0)$/)) return r < 0 ? "-" + r0(e, t, -r) : W0("" + r).replace(/^\d,\d{3}$/, "0$&").replace(/^\d*$/, function(d) {
    return "00," + (d.length < 3 ? Td(0, 3 - d.length) : "") + d;
  }) + "." + Td(0, o[1].length);
  switch (t) {
    case "###,###":
    case "##,###":
    case "#,###":
      var p = W0("" + l);
      return p !== "0" ? u2 + p : "";
    default:
      if (t.match(/\.[0#?]*$/)) return r0(e, t.slice(0, t.lastIndexOf(".")), r) + Gf(t.slice(t.lastIndexOf(".")));
  }
  throw new Error("unsupported format |" + t + "|");
}
function $0(e, t, r) {
  return (r | 0) === r ? r0(e, t, r) : Sp(e, t, r);
}
function Mht(e) {
  for (var t = [], r = false, n = 0, a = 0; n < e.length; ++n) switch (e.charCodeAt(n)) {
    case 34:
      r = !r;
      break;
    case 95:
    case 42:
    case 92:
      ++n;
      break;
    case 59:
      t[t.length] = e.substr(a, n - a), a = n + 1;
  }
  if (t[t.length] = e.substr(a), r === true) throw new Error("Format |" + e + "| unterminated string ");
  return t;
}
var Dne = /\[[HhMmSs\u0E0A\u0E19\u0E17]*\]/;
function f1(e) {
  for (var t = 0, r = "", n = ""; t < e.length; ) switch (r = e.charAt(t)) {
    case "G":
      PS(e, t) && (t += 6), t++;
      break;
    case '"':
      for (; e.charCodeAt(++t) !== 34 && t < e.length; ) ;
      ++t;
      break;
    case "\\":
      t += 2;
      break;
    case "_":
      t += 2;
      break;
    case "@":
      ++t;
      break;
    case "B":
    case "b":
      if (e.charAt(t + 1) === "1" || e.charAt(t + 1) === "2") return true;
    case "M":
    case "D":
    case "Y":
    case "H":
    case "S":
    case "E":
    case "m":
    case "d":
    case "y":
    case "h":
    case "s":
    case "e":
    case "g":
      return true;
    case "A":
    case "a":
    case "\u4E0A":
      if (e.substr(t, 3).toUpperCase() === "A/P" || e.substr(t, 5).toUpperCase() === "AM/PM" || e.substr(t, 5).toUpperCase() === "\u4E0A\u5348/\u4E0B\u5348") return true;
      ++t;
      break;
    case "[":
      for (n = r; e.charAt(t++) !== "]" && t < e.length; ) n += e.charAt(t);
      if (n.match(Dne)) return true;
      break;
    case ".":
    case "0":
    case "#":
      for (; t < e.length && ("0#?.,E+-%".indexOf(r = e.charAt(++t)) > -1 || r == "\\" && e.charAt(t + 1) == "-" && "0#".indexOf(e.charAt(t + 2)) > -1); ) ;
      break;
    case "?":
      for (; e.charAt(++t) === r; ) ;
      break;
    case "*":
      ++t, (e.charAt(t) == " " || e.charAt(t) == "*") && ++t;
      break;
    case "(":
    case ")":
      ++t;
      break;
    case "1":
    case "2":
    case "3":
    case "4":
    case "5":
    case "6":
    case "7":
    case "8":
    case "9":
      for (; t < e.length && "0123456789".indexOf(e.charAt(++t)) > -1; ) ;
      break;
    case " ":
      ++t;
      break;
    default:
      ++t;
      break;
  }
  return false;
}
function Iht(e, t, r, n) {
  for (var a = [], o = "", s = 0, i = "", l = "t", u2, c, f, h = "H"; s < e.length; ) switch (i = e.charAt(s)) {
    case "G":
      if (!PS(e, s)) throw new Error("unrecognized character " + i + " in " + e);
      a[a.length] = { t: "G", v: "General" }, s += 7;
      break;
    case '"':
      for (o = ""; (f = e.charCodeAt(++s)) !== 34 && s < e.length; ) o += String.fromCharCode(f);
      a[a.length] = { t: "t", v: o }, ++s;
      break;
    case "\\":
      var p = e.charAt(++s), d = p === "(" || p === ")" ? p : "t";
      a[a.length] = { t: d, v: p }, ++s;
      break;
    case "_":
      a[a.length] = { t: "t", v: " " }, s += 2;
      break;
    case "@":
      a[a.length] = { t: "T", v: t }, ++s;
      break;
    case "B":
    case "b":
      if (e.charAt(s + 1) === "1" || e.charAt(s + 1) === "2") {
        if (u2 == null && (u2 = Zg(t, r, e.charAt(s + 1) === "2"), u2 == null)) return "";
        a[a.length] = { t: "X", v: e.substr(s, 2) }, l = i, s += 2;
        break;
      }
    case "M":
    case "D":
    case "Y":
    case "H":
    case "S":
    case "E":
      i = i.toLowerCase();
    case "m":
    case "d":
    case "y":
    case "h":
    case "s":
    case "e":
    case "g":
      if (t < 0 || u2 == null && (u2 = Zg(t, r), u2 == null)) return "";
      for (o = i; ++s < e.length && e.charAt(s).toLowerCase() === i; ) o += i;
      i === "m" && l.toLowerCase() === "h" && (i = "M"), i === "h" && (i = h), a[a.length] = { t: i, v: o }, l = i;
      break;
    case "A":
    case "a":
    case "\u4E0A":
      var v = { t: i, v: i };
      if (u2 == null && (u2 = Zg(t, r)), e.substr(s, 3).toUpperCase() === "A/P" ? (u2 != null && (v.v = u2.H >= 12 ? e.charAt(s + 2) : i), v.t = "T", h = "h", s += 3) : e.substr(s, 5).toUpperCase() === "AM/PM" ? (u2 != null && (v.v = u2.H >= 12 ? "PM" : "AM"), v.t = "T", s += 5, h = "h") : e.substr(s, 5).toUpperCase() === "\u4E0A\u5348/\u4E0B\u5348" ? (u2 != null && (v.v = u2.H >= 12 ? "\u4E0B\u5348" : "\u4E0A\u5348"), v.t = "T", s += 5, h = "h") : (v.t = "t", ++s), u2 == null && v.t === "T") return "";
      a[a.length] = v, l = i;
      break;
    case "[":
      for (o = i; e.charAt(s++) !== "]" && s < e.length; ) o += e.charAt(s);
      if (o.slice(-1) !== "]") throw 'unterminated "[" block: |' + o + "|";
      if (o.match(Dne)) {
        if (u2 == null && (u2 = Zg(t, r), u2 == null)) return "";
        a[a.length] = { t: "Z", v: o.toLowerCase() }, l = o.charAt(1);
      } else o.indexOf("$") > -1 && (o = (o.match(/\$([^-\[\]]*)/) || [])[1] || "$", f1(e) || (a[a.length] = { t: "t", v: o }));
      break;
    case ".":
      if (u2 != null) {
        for (o = i; ++s < e.length && (i = e.charAt(s)) === "0"; ) o += i;
        a[a.length] = { t: "s", v: o };
        break;
      }
    case "0":
    case "#":
      for (o = i; ++s < e.length && "0#?.,E+-%".indexOf(i = e.charAt(s)) > -1; ) o += i;
      a[a.length] = { t: "n", v: o };
      break;
    case "?":
      for (o = i; e.charAt(++s) === i; ) o += i;
      a[a.length] = { t: i, v: o }, l = i;
      break;
    case "*":
      ++s, (e.charAt(s) == " " || e.charAt(s) == "*") && ++s;
      break;
    case "(":
    case ")":
      a[a.length] = { t: n === 1 ? "t" : i, v: i }, ++s;
      break;
    case "1":
    case "2":
    case "3":
    case "4":
    case "5":
    case "6":
    case "7":
    case "8":
    case "9":
      for (o = i; s < e.length && "0123456789".indexOf(e.charAt(++s)) > -1; ) o += e.charAt(s);
      a[a.length] = { t: "D", v: o };
      break;
    case " ":
      a[a.length] = { t: i, v: i }, ++s;
      break;
    case "$":
      a[a.length] = { t: "t", v: "$" }, ++s;
      break;
    default:
      if (",$-+/():!^&'~{}<>=\u20ACacfijklopqrtuvwxzP".indexOf(i) === -1) throw new Error("unrecognized character " + i + " in " + e);
      a[a.length] = { t: "t", v: i }, ++s;
      break;
  }
  var m = 0, g = 0, x;
  for (s = a.length - 1, l = "t"; s >= 0; --s) switch (a[s].t) {
    case "h":
    case "H":
      a[s].t = h, l = "h", m < 1 && (m = 1);
      break;
    case "s":
      (x = a[s].v.match(/\.0+$/)) && (g = Math.max(g, x[0].length - 1)), m < 3 && (m = 3);
    case "d":
    case "y":
    case "M":
    case "e":
      l = a[s].t;
      break;
    case "m":
      l === "s" && (a[s].t = "M", m < 2 && (m = 2));
      break;
    case "X":
      break;
    case "Z":
      m < 1 && a[s].v.match(/[Hh]/) && (m = 1), m < 2 && a[s].v.match(/[Mm]/) && (m = 2), m < 3 && a[s].v.match(/[Ss]/) && (m = 3);
  }
  switch (m) {
    case 0:
      break;
    case 1:
      u2.u >= 0.5 && (u2.u = 0, ++u2.S), u2.S >= 60 && (u2.S = 0, ++u2.M), u2.M >= 60 && (u2.M = 0, ++u2.H);
      break;
    case 2:
      u2.u >= 0.5 && (u2.u = 0, ++u2.S), u2.S >= 60 && (u2.S = 0, ++u2.M);
      break;
  }
  var b = "", y;
  for (s = 0; s < a.length; ++s) switch (a[s].t) {
    case "t":
    case "T":
    case " ":
    case "D":
      break;
    case "X":
      a[s].v = "", a[s].t = ";";
      break;
    case "d":
    case "m":
    case "y":
    case "h":
    case "H":
    case "M":
    case "s":
    case "e":
    case "b":
    case "Z":
      a[s].v = _ht(a[s].t.charCodeAt(0), a[s].v, u2, g), a[s].t = "t";
      break;
    case "n":
    case "?":
      for (y = s + 1; a[y] != null && ((i = a[y].t) === "?" || i === "D" || (i === " " || i === "t") && a[y + 1] != null && (a[y + 1].t === "?" || a[y + 1].t === "t" && a[y + 1].v === "/") || a[s].t === "(" && (i === " " || i === "n" || i === ")") || i === "t" && (a[y].v === "/" || a[y].v === " " && a[y + 1] != null && a[y + 1].t == "?")); ) a[s].v += a[y].v, a[y] = { v: "", t: ";" }, ++y;
      b += a[s].v, s = y - 1;
      break;
    case "G":
      a[s].t = "t", a[s].v = a1(t, r);
      break;
  }
  var w = "", _4, k;
  if (b.length > 0) {
    b.charCodeAt(0) == 40 ? (_4 = t < 0 && b.charCodeAt(0) === 45 ? -t : t, k = $0("n", b, _4)) : (_4 = t < 0 && n > 1 ? -t : t, k = $0("n", b, _4), _4 < 0 && a[0] && a[0].t == "t" && (k = k.substr(1), a[0].v = "-" + a[0].v)), y = k.length - 1;
    var T2 = a.length;
    for (s = 0; s < a.length; ++s) if (a[s] != null && a[s].t != "t" && a[s].v.indexOf(".") > -1) {
      T2 = s;
      break;
    }
    var A2 = a.length;
    if (T2 === a.length && k.indexOf("E") === -1) {
      for (s = a.length - 1; s >= 0; --s) a[s] == null || "n?".indexOf(a[s].t) === -1 || (y >= a[s].v.length - 1 ? (y -= a[s].v.length, a[s].v = k.substr(y + 1, a[s].v.length)) : y < 0 ? a[s].v = "" : (a[s].v = k.substr(0, y + 1), y = -1), a[s].t = "t", A2 = s);
      y >= 0 && A2 < a.length && (a[A2].v = k.substr(0, y + 1) + a[A2].v);
    } else if (T2 !== a.length && k.indexOf("E") === -1) {
      for (y = k.indexOf(".") - 1, s = T2; s >= 0; --s) if (!(a[s] == null || "n?".indexOf(a[s].t) === -1)) {
        for (c = a[s].v.indexOf(".") > -1 && s === T2 ? a[s].v.indexOf(".") - 1 : a[s].v.length - 1, w = a[s].v.substr(c + 1); c >= 0; --c) y >= 0 && (a[s].v.charAt(c) === "0" || a[s].v.charAt(c) === "#") && (w = k.charAt(y--) + w);
        a[s].v = w, a[s].t = "t", A2 = s;
      }
      for (y >= 0 && A2 < a.length && (a[A2].v = k.substr(0, y + 1) + a[A2].v), y = k.indexOf(".") + 1, s = T2; s < a.length; ++s) if (!(a[s] == null || "n?(".indexOf(a[s].t) === -1 && s !== T2)) {
        for (c = a[s].v.indexOf(".") > -1 && s === T2 ? a[s].v.indexOf(".") + 1 : 0, w = a[s].v.substr(0, c); c < a[s].v.length; ++c) y < k.length && (w += k.charAt(y++));
        a[s].v = w, a[s].t = "t", A2 = s;
      }
    }
  }
  for (s = 0; s < a.length; ++s) a[s] != null && "n?".indexOf(a[s].t) > -1 && (_4 = n > 1 && t < 0 && s > 0 && a[s - 1].v === "-" ? -t : t, a[s].v = $0(a[s].t, a[s].v, _4), a[s].t = "t");
  var S2 = "";
  for (s = 0; s !== a.length; ++s) a[s] != null && (S2 += a[s].v);
  return S2;
}
var pre = /\[(=|>[=]?|<[>=]?)(-?\d+(?:\.\d*)?)\]/;
function dre(e, t) {
  if (t == null) return false;
  var r = parseFloat(t[2]);
  switch (t[1]) {
    case "=":
      if (e == r) return true;
      break;
    case ">":
      if (e > r) return true;
      break;
    case "<":
      if (e < r) return true;
      break;
    case "<>":
      if (e != r) return true;
      break;
    case ">=":
      if (e >= r) return true;
      break;
    case "<=":
      if (e <= r) return true;
      break;
  }
  return false;
}
function Nht(e, t) {
  var r = Mht(e), n = r.length, a = r[n - 1].indexOf("@");
  if (n < 4 && a > -1 && --n, r.length > 4) throw new Error("cannot find right format for |" + r.join("|") + "|");
  if (typeof t != "number") return [4, r.length === 4 || a > -1 ? r[r.length - 1] : "@"];
  switch (r.length) {
    case 1:
      r = a > -1 ? ["General", "General", "General", r[0]] : [r[0], r[0], r[0], "@"];
      break;
    case 2:
      r = a > -1 ? [r[0], r[0], r[0], r[1]] : [r[0], r[1], r[0], "@"];
      break;
    case 3:
      r = a > -1 ? [r[0], r[1], r[0], r[2]] : [r[0], r[1], r[2], "@"];
      break;
    case 4:
      break;
  }
  var o = t > 0 ? r[0] : t < 0 ? r[1] : r[2];
  if (r[0].indexOf("[") === -1 && r[1].indexOf("[") === -1) return [n, o];
  if (r[0].match(/\[[=<>]/) != null || r[1].match(/\[[=<>]/) != null) {
    var s = r[0].match(pre), i = r[1].match(pre);
    return dre(t, s) ? [n, r[0]] : dre(t, i) ? [n, r[1]] : [n, r[s != null && i != null ? 2 : 1]];
  }
  return [n, o];
}
function Xh(e, t, r) {
  r == null && (r = {});
  var n = "";
  switch (typeof e) {
    case "string":
      e == "m/d/yy" && r.dateNF ? n = r.dateNF : n = e;
      break;
    case "number":
      e == 14 && r.dateNF ? n = r.dateNF : n = (r.table != null ? r.table : $i)[e], n == null && (n = r.table && r.table[cre[e]] || $i[cre[e]]), n == null && (n = dht[e] || "General");
      break;
  }
  if (PS(n, 0)) return a1(t, r);
  t instanceof Date && (t = bne(t, r.date1904));
  var a = Nht(n, t);
  if (PS(a[1])) return a1(t, r);
  if (t === true) t = "TRUE";
  else if (t === false) t = "FALSE";
  else if (t === "" || t == null) return "";
  return Iht(a[1], t, r, a[0]);
}
function Cne(e, t) {
  if (typeof t != "number") {
    t = +t || -1;
    for (var r = 0; r < 392; ++r) {
      if ($i[r] == null) {
        t < 0 && (t = r);
        continue;
      }
      if ($i[r] == e) {
        t = r;
        break;
      }
    }
    t < 0 && (t = 391);
  }
  return $i[t] = e, t;
}
var Fht = { "5": '"$"#,##0_);\\("$"#,##0\\)', "6": '"$"#,##0_);[Red]\\("$"#,##0\\)', "7": '"$"#,##0.00_);\\("$"#,##0.00\\)', "8": '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)', "23": "General", "24": "General", "25": "General", "26": "General", "27": "m/d/yy", "28": "m/d/yy", "29": "m/d/yy", "30": "m/d/yy", "31": "m/d/yy", "32": "h:mm:ss", "33": "h:mm:ss", "34": "h:mm:ss", "35": "h:mm:ss", "36": "m/d/yy", "41": '_(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)', "42": '_("$"* #,##0_);_("$"* (#,##0);_("$"* "-"_);_(@_)', "43": '_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)', "44": '_("$"* #,##0.00_);_("$"* (#,##0.00);_("$"* "-"??_);_(@_)', "50": "m/d/yy", "51": "m/d/yy", "52": "m/d/yy", "53": "m/d/yy", "54": "m/d/yy", "55": "m/d/yy", "56": "m/d/yy", "57": "m/d/yy", "58": "m/d/yy", "59": "0", "60": "0.00", "61": "#,##0", "62": "#,##0.00", "63": '"$"#,##0_);\\("$"#,##0\\)', "64": '"$"#,##0_);[Red]\\("$"#,##0\\)', "65": '"$"#,##0.00_);\\("$"#,##0.00\\)', "66": '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)', "67": "0%", "68": "0.00%", "69": "# ?/?", "70": "# ??/??", "71": "m/d/yy", "72": "m/d/yy", "73": "d-mmm-yy", "74": "d-mmm", "75": "mmm-yy", "76": "h:mm", "77": "h:mm:ss", "78": "m/d/yy h:mm", "79": "mm:ss", "80": "[h]:mm:ss", "81": "mmss.0" };
var Lht = { "d.m": "d\\.m" };
function nm(e, t) {
  return Cne(Lht[e] || e, t);
}
var vre = function() {
  var e = {};
  e.version = "1.2.0";
  function t() {
    for (var k = 0, T2 = new Array(256), A2 = 0; A2 != 256; ++A2) k = A2, k = k & 1 ? -306674912 ^ k >>> 1 : k >>> 1, k = k & 1 ? -306674912 ^ k >>> 1 : k >>> 1, k = k & 1 ? -306674912 ^ k >>> 1 : k >>> 1, k = k & 1 ? -306674912 ^ k >>> 1 : k >>> 1, k = k & 1 ? -306674912 ^ k >>> 1 : k >>> 1, k = k & 1 ? -306674912 ^ k >>> 1 : k >>> 1, k = k & 1 ? -306674912 ^ k >>> 1 : k >>> 1, k = k & 1 ? -306674912 ^ k >>> 1 : k >>> 1, T2[A2] = k;
    return typeof Int32Array < "u" ? new Int32Array(T2) : T2;
  }
  var r = t();
  function n(k) {
    var T2 = 0, A2 = 0, S2 = 0, C2 = typeof Int32Array < "u" ? new Int32Array(4096) : new Array(4096);
    for (S2 = 0; S2 != 256; ++S2) C2[S2] = k[S2];
    for (S2 = 0; S2 != 256; ++S2) for (A2 = k[S2], T2 = 256 + S2; T2 < 4096; T2 += 256) A2 = C2[T2] = A2 >>> 8 ^ k[A2 & 255];
    var E2 = [];
    for (S2 = 1; S2 != 16; ++S2) E2[S2 - 1] = typeof Int32Array < "u" && typeof C2.subarray == "function" ? C2.subarray(S2 * 256, S2 * 256 + 256) : C2.slice(S2 * 256, S2 * 256 + 256);
    return E2;
  }
  var a = n(r), o = a[0], s = a[1], i = a[2], l = a[3], u2 = a[4], c = a[5], f = a[6], h = a[7], p = a[8], d = a[9], v = a[10], m = a[11], g = a[12], x = a[13], b = a[14];
  function y(k, T2) {
    for (var A2 = T2 ^ -1, S2 = 0, C2 = k.length; S2 < C2; ) A2 = A2 >>> 8 ^ r[(A2 ^ k.charCodeAt(S2++)) & 255];
    return ~A2;
  }
  function w(k, T2) {
    for (var A2 = T2 ^ -1, S2 = k.length - 15, C2 = 0; C2 < S2; ) A2 = b[k[C2++] ^ A2 & 255] ^ x[k[C2++] ^ A2 >> 8 & 255] ^ g[k[C2++] ^ A2 >> 16 & 255] ^ m[k[C2++] ^ A2 >>> 24] ^ v[k[C2++]] ^ d[k[C2++]] ^ p[k[C2++]] ^ h[k[C2++]] ^ f[k[C2++]] ^ c[k[C2++]] ^ u2[k[C2++]] ^ l[k[C2++]] ^ i[k[C2++]] ^ s[k[C2++]] ^ o[k[C2++]] ^ r[k[C2++]];
    for (S2 += 15; C2 < S2; ) A2 = A2 >>> 8 ^ r[(A2 ^ k[C2++]) & 255];
    return ~A2;
  }
  function _4(k, T2) {
    for (var A2 = T2 ^ -1, S2 = 0, C2 = k.length, E2 = 0, F13 = 0; S2 < C2; ) E2 = k.charCodeAt(S2++), E2 < 128 ? A2 = A2 >>> 8 ^ r[(A2 ^ E2) & 255] : E2 < 2048 ? (A2 = A2 >>> 8 ^ r[(A2 ^ (192 | E2 >> 6 & 31)) & 255], A2 = A2 >>> 8 ^ r[(A2 ^ (128 | E2 & 63)) & 255]) : E2 >= 55296 && E2 < 57344 ? (E2 = (E2 & 1023) + 64, F13 = k.charCodeAt(S2++) & 1023, A2 = A2 >>> 8 ^ r[(A2 ^ (240 | E2 >> 8 & 7)) & 255], A2 = A2 >>> 8 ^ r[(A2 ^ (128 | E2 >> 2 & 63)) & 255], A2 = A2 >>> 8 ^ r[(A2 ^ (128 | F13 >> 6 & 15 | (E2 & 3) << 4)) & 255], A2 = A2 >>> 8 ^ r[(A2 ^ (128 | F13 & 63)) & 255]) : (A2 = A2 >>> 8 ^ r[(A2 ^ (224 | E2 >> 12 & 15)) & 255], A2 = A2 >>> 8 ^ r[(A2 ^ (128 | E2 >> 6 & 63)) & 255], A2 = A2 >>> 8 ^ r[(A2 ^ (128 | E2 & 63)) & 255]);
    return ~A2;
  }
  return e.table = r, e.bstr = y, e.buf = w, e.str = _4, e;
}();
var Ri = function() {
  var t = {};
  t.version = "1.2.2";
  function r(Re, qe) {
    for (var je = Re.split("/"), rt = qe.split("/"), He = 0, xe = 0, Ne = Math.min(je.length, rt.length); He < Ne; ++He) {
      if (xe = je[He].length - rt[He].length) return xe;
      if (je[He] != rt[He]) return je[He] < rt[He] ? -1 : 1;
    }
    return je.length - rt.length;
  }
  function n(Re) {
    if (Re.charAt(Re.length - 1) == "/") return Re.slice(0, -1).indexOf("/") === -1 ? Re : n(Re.slice(0, -1));
    var qe = Re.lastIndexOf("/");
    return qe === -1 ? Re : Re.slice(0, qe + 1);
  }
  function a(Re) {
    if (Re.charAt(Re.length - 1) == "/") return a(Re.slice(0, -1));
    var qe = Re.lastIndexOf("/");
    return qe === -1 ? Re : Re.slice(qe + 1);
  }
  function o(Re, qe) {
    typeof qe == "string" && (qe = new Date(qe));
    var je = qe.getHours();
    je = je << 6 | qe.getMinutes(), je = je << 5 | qe.getSeconds() >>> 1, Re.write_shift(2, je);
    var rt = qe.getFullYear() - 1980;
    rt = rt << 4 | qe.getMonth() + 1, rt = rt << 5 | qe.getDate(), Re.write_shift(2, rt);
  }
  function s(Re) {
    var qe = Re.read_shift(2) & 65535, je = Re.read_shift(2) & 65535, rt = /* @__PURE__ */ new Date(), He = je & 31;
    je >>>= 5;
    var xe = je & 15;
    je >>>= 4, rt.setMilliseconds(0), rt.setFullYear(je + 1980), rt.setMonth(xe - 1), rt.setDate(He);
    var Ne = qe & 31;
    qe >>>= 5;
    var ke = qe & 63;
    return qe >>>= 6, rt.setHours(qe), rt.setMinutes(ke), rt.setSeconds(Ne << 1), rt;
  }
  function i(Re) {
    gc(Re, 0);
    for (var qe = {}, je = 0; Re.l <= Re.length - 4; ) {
      var rt = Re.read_shift(2), He = Re.read_shift(2), xe = Re.l + He, Ne = {};
      switch (rt) {
        case 21589:
          je = Re.read_shift(1), je & 1 && (Ne.mtime = Re.read_shift(4)), He > 5 && (je & 2 && (Ne.atime = Re.read_shift(4)), je & 4 && (Ne.ctime = Re.read_shift(4))), Ne.mtime && (Ne.mt = new Date(Ne.mtime * 1e3));
          break;
        case 1:
          {
            var ke = Re.read_shift(4), Me = Re.read_shift(4);
            Ne.usz = Me * Math.pow(2, 32) + ke, ke = Re.read_shift(4), Me = Re.read_shift(4), Ne.csz = Me * Math.pow(2, 32) + ke;
          }
          break;
      }
      Re.l = xe, qe[rt] = Ne;
    }
    return qe;
  }
  var l;
  function u2() {
    return l || (l = Jg);
  }
  function c(Re, qe) {
    if (Re[0] == 80 && Re[1] == 75) return zt(Re, qe);
    if ((Re[0] | 32) == 109 && (Re[1] | 32) == 105) return Ge(Re, qe);
    if (Re.length < 512) throw new Error("CFB file size " + Re.length + " < 512");
    var je = 3, rt = 512, He = 0, xe = 0, Ne = 0, ke = 0, Me = 0, Le = [], ze = Re.slice(0, 512);
    gc(ze, 0);
    var ft = f(ze);
    switch (je = ft[0], je) {
      case 3:
        rt = 512;
        break;
      case 4:
        rt = 4096;
        break;
      case 0:
        if (ft[1] == 0) return zt(Re, qe);
      default:
        throw new Error("Major Version: Expected 3 or 4 saw " + je);
    }
    rt !== 512 && (ze = Re.slice(0, rt), gc(ze, 28));
    var De = Re.slice(0, rt);
    h(ze, je);
    var Je = ze.read_shift(4, "i");
    if (je === 3 && Je !== 0) throw new Error("# Directory Sectors: Expected 0 saw " + Je);
    ze.l += 4, Ne = ze.read_shift(4, "i"), ze.l += 4, ze.chk("00100000", "Mini Stream Cutoff Size: "), ke = ze.read_shift(4, "i"), He = ze.read_shift(4, "i"), Me = ze.read_shift(4, "i"), xe = ze.read_shift(4, "i");
    for (var tt = -1, vt = 0; vt < 109 && (tt = ze.read_shift(4, "i"), !(tt < 0)); ++vt) Le[vt] = tt;
    var kt = p(Re, rt);
    m(Me, xe, kt, rt, Le);
    var jt = x(kt, Ne, Le, rt);
    Ne < jt.length && (jt[Ne].name = "!Directory"), He > 0 && ke !== F13 && (jt[ke].name = "!MiniFAT"), jt[Le[0]].name = "!FAT", jt.fat_addrs = Le, jt.ssz = rt;
    var Vt = {}, Kt = [], rr = [], Tr = [];
    b(Ne, jt, kt, Kt, He, Vt, rr, ke), d(rr, Tr, Kt), Kt.shift();
    var yr = { FileIndex: rr, FullPaths: Tr };
    return qe && qe.raw && (yr.raw = { header: De, sectors: kt }), yr;
  }
  function f(Re) {
    if (Re[Re.l] == 80 && Re[Re.l + 1] == 75) return [0, 0];
    Re.chk(N2, "Header Signature: "), Re.l += 16;
    var qe = Re.read_shift(2, "u");
    return [Re.read_shift(2, "u"), qe];
  }
  function h(Re, qe) {
    var je = 9;
    switch (Re.l += 2, je = Re.read_shift(2)) {
      case 9:
        if (qe != 3) throw new Error("Sector Shift: Expected 9 saw " + je);
        break;
      case 12:
        if (qe != 4) throw new Error("Sector Shift: Expected 12 saw " + je);
        break;
      default:
        throw new Error("Sector Shift: Expected 9 or 12 saw " + je);
    }
    Re.chk("0600", "Mini Sector Shift: "), Re.chk("000000000000", "Reserved: ");
  }
  function p(Re, qe) {
    for (var je = Math.ceil(Re.length / qe) - 1, rt = [], He = 1; He < je; ++He) rt[He - 1] = Re.slice(He * qe, (He + 1) * qe);
    return rt[je - 1] = Re.slice(je * qe), rt;
  }
  function d(Re, qe, je) {
    for (var rt = 0, He = 0, xe = 0, Ne = 0, ke = 0, Me = je.length, Le = [], ze = []; rt < Me; ++rt) Le[rt] = ze[rt] = rt, qe[rt] = je[rt];
    for (; ke < ze.length; ++ke) rt = ze[ke], He = Re[rt].L, xe = Re[rt].R, Ne = Re[rt].C, Le[rt] === rt && (He !== -1 && Le[He] !== He && (Le[rt] = Le[He]), xe !== -1 && Le[xe] !== xe && (Le[rt] = Le[xe])), Ne !== -1 && (Le[Ne] = rt), He !== -1 && rt != Le[rt] && (Le[He] = Le[rt], ze.lastIndexOf(He) < ke && ze.push(He)), xe !== -1 && rt != Le[rt] && (Le[xe] = Le[rt], ze.lastIndexOf(xe) < ke && ze.push(xe));
    for (rt = 1; rt < Me; ++rt) Le[rt] === rt && (xe !== -1 && Le[xe] !== xe ? Le[rt] = Le[xe] : He !== -1 && Le[He] !== He && (Le[rt] = Le[He]));
    for (rt = 1; rt < Me; ++rt) if (Re[rt].type !== 0) {
      if (ke = rt, ke != Le[ke]) do
        ke = Le[ke], qe[rt] = qe[ke] + "/" + qe[rt];
      while (ke !== 0 && Le[ke] !== -1 && ke != Le[ke]);
      Le[rt] = -1;
    }
    for (qe[0] += "/", rt = 1; rt < Me; ++rt) Re[rt].type !== 2 && (qe[rt] += "/");
  }
  function v(Re, qe, je) {
    for (var rt = Re.start, He = Re.size, xe = [], Ne = rt; je && He > 0 && Ne >= 0; ) xe.push(qe.slice(Ne * E2, Ne * E2 + E2)), He -= E2, Ne = Yg(je, Ne * 4);
    return xe.length === 0 ? Fn(0) : Ju(xe).slice(0, Re.size);
  }
  function m(Re, qe, je, rt, He) {
    var xe = F13;
    if (Re === F13) {
      if (qe !== 0) throw new Error("DIFAT chain shorter than expected");
    } else if (Re !== -1) {
      var Ne = je[Re], ke = (rt >>> 2) - 1;
      if (!Ne) return;
      for (var Me = 0; Me < ke && (xe = Yg(Ne, Me * 4)) !== F13; ++Me) He.push(xe);
      qe >= 1 && m(Yg(Ne, rt - 4), qe - 1, je, rt, He);
    }
  }
  function g(Re, qe, je, rt, He) {
    var xe = [], Ne = [];
    He || (He = []);
    var ke = rt - 1, Me = 0, Le = 0;
    for (Me = qe; Me >= 0; ) {
      He[Me] = true, xe[xe.length] = Me, Ne.push(Re[Me]);
      var ze = je[Math.floor(Me * 4 / rt)];
      if (Le = Me * 4 & ke, rt < 4 + Le) throw new Error("FAT boundary crossed: " + Me + " 4 " + rt);
      if (!Re[ze]) break;
      Me = Yg(Re[ze], Le);
    }
    return { nodes: xe, data: Ere([Ne]) };
  }
  function x(Re, qe, je, rt) {
    var He = Re.length, xe = [], Ne = [], ke = [], Me = [], Le = rt - 1, ze = 0, ft = 0, De = 0, Je = 0;
    for (ze = 0; ze < He; ++ze) if (ke = [], De = ze + qe, De >= He && (De -= He), !Ne[De]) {
      Me = [];
      var tt = [];
      for (ft = De; ft >= 0; ) {
        tt[ft] = true, Ne[ft] = true, ke[ke.length] = ft, Me.push(Re[ft]);
        var vt = je[Math.floor(ft * 4 / rt)];
        if (Je = ft * 4 & Le, rt < 4 + Je) throw new Error("FAT boundary crossed: " + ft + " 4 " + rt);
        if (!Re[vt] || (ft = Yg(Re[vt], Je), tt[ft])) break;
      }
      xe[De] = { nodes: ke, data: Ere([Me]) };
    }
    return xe;
  }
  function b(Re, qe, je, rt, He, xe, Ne, ke) {
    for (var Me = 0, Le = rt.length ? 2 : 0, ze = qe[Re].data, ft = 0, De = 0, Je; ft < ze.length; ft += 128) {
      var tt = ze.slice(ft, ft + 128);
      gc(tt, 64), De = tt.read_shift(2), Je = QS(tt, 0, De - Le), rt.push(Je);
      var vt = { name: Je, type: tt.read_shift(1), color: tt.read_shift(1), L: tt.read_shift(4, "i"), R: tt.read_shift(4, "i"), C: tt.read_shift(4, "i"), clsid: tt.read_shift(16), state: tt.read_shift(4, "i"), start: 0, size: 0 }, kt = tt.read_shift(2) + tt.read_shift(2) + tt.read_shift(2) + tt.read_shift(2);
      kt !== 0 && (vt.ct = y(tt, tt.l - 8));
      var jt = tt.read_shift(2) + tt.read_shift(2) + tt.read_shift(2) + tt.read_shift(2);
      jt !== 0 && (vt.mt = y(tt, tt.l - 8)), vt.start = tt.read_shift(4, "i"), vt.size = tt.read_shift(4, "i"), vt.size < 0 && vt.start < 0 && (vt.size = vt.type = 0, vt.start = F13, vt.name = ""), vt.type === 5 ? (Me = vt.start, He > 0 && Me !== F13 && (qe[Me].name = "!StreamData")) : vt.size >= 4096 ? (vt.storage = "fat", qe[vt.start] === void 0 && (qe[vt.start] = g(je, vt.start, qe.fat_addrs, qe.ssz)), qe[vt.start].name = vt.name, vt.content = qe[vt.start].data.slice(0, vt.size)) : (vt.storage = "minifat", vt.size < 0 ? vt.size = 0 : Me !== F13 && vt.start !== F13 && qe[Me] && (vt.content = v(vt, qe[Me].data, (qe[ke] || {}).data))), vt.content && gc(vt.content, 0), xe[Je] = vt, Ne.push(vt);
    }
  }
  function y(Re, qe) {
    return new Date((Fc(Re, qe + 4) / 1e7 * Math.pow(2, 32) + Fc(Re, qe) / 1e7 - 11644473600) * 1e3);
  }
  function w(Re, qe) {
    return u2(), c(l.readFileSync(Re), qe);
  }
  function _4(Re, qe) {
    var je = qe && qe.type;
    switch (je || wo && Buffer.isBuffer(Re) && (je = "buffer"), je || "base64") {
      case "file":
        return w(Re, qe);
      case "base64":
        return c(Hf(qh(Re)), qe);
      case "binary":
        return c(Hf(Re), qe);
    }
    return c(Re, qe);
  }
  function k(Re, qe) {
    var je = qe || {}, rt = je.root || "Root Entry";
    if (Re.FullPaths || (Re.FullPaths = []), Re.FileIndex || (Re.FileIndex = []), Re.FullPaths.length !== Re.FileIndex.length) throw new Error("inconsistent CFB structure");
    Re.FullPaths.length === 0 && (Re.FullPaths[0] = rt + "/", Re.FileIndex[0] = { name: rt, type: 5 }), je.CLSID && (Re.FileIndex[0].clsid = je.CLSID), T2(Re);
  }
  function T2(Re) {
    var qe = "Sh33tJ5";
    if (!Ri.find(Re, "/" + qe)) {
      var je = Fn(4);
      je[0] = 55, je[1] = je[3] = 50, je[2] = 54, Re.FileIndex.push({ name: qe, type: 2, content: je, size: 4, L: 69, R: 69, C: 69 }), Re.FullPaths.push(Re.FullPaths[0] + qe), A2(Re);
    }
  }
  function A2(Re, qe) {
    k(Re);
    for (var je = false, rt = false, He = Re.FullPaths.length - 1; He >= 0; --He) {
      var xe = Re.FileIndex[He];
      switch (xe.type) {
        case 0:
          rt ? je = true : (Re.FileIndex.pop(), Re.FullPaths.pop());
          break;
        case 1:
        case 2:
        case 5:
          rt = true, isNaN(xe.R * xe.L * xe.C) && (je = true), xe.R > -1 && xe.L > -1 && xe.R == xe.L && (je = true);
          break;
        default:
          je = true;
          break;
      }
    }
    if (!(!je && !qe)) {
      var Ne = new Date(1987, 1, 19), ke = 0, Me = Object.create ? /* @__PURE__ */ Object.create(null) : {}, Le = [];
      for (He = 0; He < Re.FullPaths.length; ++He) Me[Re.FullPaths[He]] = true, Re.FileIndex[He].type !== 0 && Le.push([Re.FullPaths[He], Re.FileIndex[He]]);
      for (He = 0; He < Le.length; ++He) {
        var ze = n(Le[He][0]);
        for (rt = Me[ze]; !rt; ) {
          for (; n(ze) && !Me[n(ze)]; ) ze = n(ze);
          Le.push([ze, { name: a(ze).replace("/", ""), type: 1, clsid: I2, ct: Ne, mt: Ne, content: null }]), Me[ze] = true, ze = n(Le[He][0]), rt = Me[ze];
        }
      }
      for (Le.sort(function(Je, tt) {
        return r(Je[0], tt[0]);
      }), Re.FullPaths = [], Re.FileIndex = [], He = 0; He < Le.length; ++He) Re.FullPaths[He] = Le[He][0], Re.FileIndex[He] = Le[He][1];
      for (He = 0; He < Le.length; ++He) {
        var ft = Re.FileIndex[He], De = Re.FullPaths[He];
        if (ft.name = a(De).replace("/", ""), ft.L = ft.R = ft.C = -(ft.color = 1), ft.size = ft.content ? ft.content.length : 0, ft.start = 0, ft.clsid = ft.clsid || I2, He === 0) ft.C = Le.length > 1 ? 1 : -1, ft.size = 0, ft.type = 5;
        else if (De.slice(-1) == "/") {
          for (ke = He + 1; ke < Le.length && n(Re.FullPaths[ke]) != De; ++ke) ;
          for (ft.C = ke >= Le.length ? -1 : ke, ke = He + 1; ke < Le.length && n(Re.FullPaths[ke]) != n(De); ++ke) ;
          ft.R = ke >= Le.length ? -1 : ke, ft.type = 1;
        } else n(Re.FullPaths[He + 1] || "") == n(De) && (ft.R = He + 1), ft.type = 2;
      }
    }
  }
  function S2(Re, qe) {
    var je = qe || {};
    if (je.fileType == "mad") return st(Re, je);
    switch (A2(Re), je.fileType) {
      case "zip":
        return yt(Re, je);
    }
    var rt = function(Je) {
      for (var tt = 0, vt = 0, kt = 0; kt < Je.FileIndex.length; ++kt) {
        var jt = Je.FileIndex[kt];
        if (!!jt.content) {
          var Vt = jt.content.length;
          Vt > 0 && (Vt < 4096 ? tt += Vt + 63 >> 6 : vt += Vt + 511 >> 9);
        }
      }
      for (var Kt = Je.FullPaths.length + 3 >> 2, rr = tt + 7 >> 3, Tr = tt + 127 >> 7, yr = rr + vt + Kt + Tr, pr = yr + 127 >> 7, lr = pr <= 109 ? 0 : Math.ceil((pr - 109) / 127); yr + pr + lr + 127 >> 7 > pr; ) lr = ++pr <= 109 ? 0 : Math.ceil((pr - 109) / 127);
      var _r = [1, lr, pr, Tr, Kt, vt, tt, 0];
      return Je.FileIndex[0].size = tt << 6, _r[7] = (Je.FileIndex[0].start = _r[0] + _r[1] + _r[2] + _r[3] + _r[4] + _r[5]) + (_r[6] + 7 >> 3), _r;
    }(Re), He = Fn(rt[7] << 9), xe = 0, Ne = 0;
    {
      for (xe = 0; xe < 8; ++xe) He.write_shift(1, D2[xe]);
      for (xe = 0; xe < 8; ++xe) He.write_shift(2, 0);
      for (He.write_shift(2, 62), He.write_shift(2, 3), He.write_shift(2, 65534), He.write_shift(2, 9), He.write_shift(2, 6), xe = 0; xe < 3; ++xe) He.write_shift(2, 0);
      for (He.write_shift(4, 0), He.write_shift(4, rt[2]), He.write_shift(4, rt[0] + rt[1] + rt[2] + rt[3] - 1), He.write_shift(4, 0), He.write_shift(4, 1 << 12), He.write_shift(4, rt[3] ? rt[0] + rt[1] + rt[2] - 1 : F13), He.write_shift(4, rt[3]), He.write_shift(-4, rt[1] ? rt[0] - 1 : F13), He.write_shift(4, rt[1]), xe = 0; xe < 109; ++xe) He.write_shift(-4, xe < rt[2] ? rt[1] + xe : -1);
    }
    if (rt[1]) for (Ne = 0; Ne < rt[1]; ++Ne) {
      for (; xe < 236 + Ne * 127; ++xe) He.write_shift(-4, xe < rt[2] ? rt[1] + xe : -1);
      He.write_shift(-4, Ne === rt[1] - 1 ? F13 : Ne + 1);
    }
    var ke = function(Je) {
      for (Ne += Je; xe < Ne - 1; ++xe) He.write_shift(-4, xe + 1);
      Je && (++xe, He.write_shift(-4, F13));
    };
    for (Ne = xe = 0, Ne += rt[1]; xe < Ne; ++xe) He.write_shift(-4, O2.DIFSECT);
    for (Ne += rt[2]; xe < Ne; ++xe) He.write_shift(-4, O2.FATSECT);
    ke(rt[3]), ke(rt[4]);
    for (var Me = 0, Le = 0, ze = Re.FileIndex[0]; Me < Re.FileIndex.length; ++Me) ze = Re.FileIndex[Me], ze.content && (Le = ze.content.length, !(Le < 4096) && (ze.start = Ne, ke(Le + 511 >> 9)));
    for (ke(rt[6] + 7 >> 3); He.l & 511; ) He.write_shift(-4, O2.ENDOFCHAIN);
    for (Ne = xe = 0, Me = 0; Me < Re.FileIndex.length; ++Me) ze = Re.FileIndex[Me], ze.content && (Le = ze.content.length, !(!Le || Le >= 4096) && (ze.start = Ne, ke(Le + 63 >> 6)));
    for (; He.l & 511; ) He.write_shift(-4, O2.ENDOFCHAIN);
    for (xe = 0; xe < rt[4] << 2; ++xe) {
      var ft = Re.FullPaths[xe];
      if (!ft || ft.length === 0) {
        for (Me = 0; Me < 17; ++Me) He.write_shift(4, 0);
        for (Me = 0; Me < 3; ++Me) He.write_shift(4, -1);
        for (Me = 0; Me < 12; ++Me) He.write_shift(4, 0);
        continue;
      }
      ze = Re.FileIndex[xe], xe === 0 && (ze.start = ze.size ? ze.start - 1 : F13);
      var De = xe === 0 && je.root || ze.name;
      if (De.length > 32 && (console.error("Name " + De + " will be truncated to " + De.slice(0, 32)), De = De.slice(0, 32)), Le = 2 * (De.length + 1), He.write_shift(64, De, "utf16le"), He.write_shift(2, Le), He.write_shift(1, ze.type), He.write_shift(1, ze.color), He.write_shift(-4, ze.L), He.write_shift(-4, ze.R), He.write_shift(-4, ze.C), ze.clsid) He.write_shift(16, ze.clsid, "hex");
      else for (Me = 0; Me < 4; ++Me) He.write_shift(4, 0);
      He.write_shift(4, ze.state || 0), He.write_shift(4, 0), He.write_shift(4, 0), He.write_shift(4, 0), He.write_shift(4, 0), He.write_shift(4, ze.start), He.write_shift(4, ze.size), He.write_shift(4, 0);
    }
    for (xe = 1; xe < Re.FileIndex.length; ++xe) if (ze = Re.FileIndex[xe], ze.size >= 4096) if (He.l = ze.start + 1 << 9, wo && Buffer.isBuffer(ze.content)) ze.content.copy(He, He.l, 0, ze.size), He.l += ze.size + 511 & -512;
    else {
      for (Me = 0; Me < ze.size; ++Me) He.write_shift(1, ze.content[Me]);
      for (; Me & 511; ++Me) He.write_shift(1, 0);
    }
    for (xe = 1; xe < Re.FileIndex.length; ++xe) if (ze = Re.FileIndex[xe], ze.size > 0 && ze.size < 4096) if (wo && Buffer.isBuffer(ze.content)) ze.content.copy(He, He.l, 0, ze.size), He.l += ze.size + 63 & -64;
    else {
      for (Me = 0; Me < ze.size; ++Me) He.write_shift(1, ze.content[Me]);
      for (; Me & 63; ++Me) He.write_shift(1, 0);
    }
    if (wo) He.l = He.length;
    else for (; He.l < He.length; ) He.write_shift(1, 0);
    return He;
  }
  function C2(Re, qe) {
    var je = Re.FullPaths.map(function(Me) {
      return Me.toUpperCase();
    }), rt = je.map(function(Me) {
      var Le = Me.split("/");
      return Le[Le.length - (Me.slice(-1) == "/" ? 2 : 1)];
    }), He = false;
    qe.charCodeAt(0) === 47 ? (He = true, qe = je[0].slice(0, -1) + qe) : He = qe.indexOf("/") !== -1;
    var xe = qe.toUpperCase(), Ne = He === true ? je.indexOf(xe) : rt.indexOf(xe);
    if (Ne !== -1) return Re.FileIndex[Ne];
    var ke = !xe.match(R_);
    for (xe = xe.replace(xf, ""), ke && (xe = xe.replace(R_, "!")), Ne = 0; Ne < je.length; ++Ne) if ((ke ? je[Ne].replace(R_, "!") : je[Ne]).replace(xf, "") == xe || (ke ? rt[Ne].replace(R_, "!") : rt[Ne]).replace(xf, "") == xe) return Re.FileIndex[Ne];
    return null;
  }
  var E2 = 64, F13 = -2, N2 = "d0cf11e0a1b11ae1", D2 = [208, 207, 17, 224, 161, 177, 26, 225], I2 = "00000000000000000000000000000000", O2 = { MAXREGSECT: -6, DIFSECT: -4, FATSECT: -3, ENDOFCHAIN: F13, FREESECT: -1, HEADER_SIGNATURE: N2, HEADER_MINOR_VERSION: "3e00", MAXREGSID: -6, NOSTREAM: -1, HEADER_CLSID: I2, EntryTypes: ["unknown", "storage", "stream", "lockbytes", "property", "root"] };
  function L2(Re, qe, je) {
    u2();
    var rt = S2(Re, je);
    l.writeFileSync(qe, rt);
  }
  function V2(Re) {
    for (var qe = new Array(Re.length), je = 0; je < Re.length; ++je) qe[je] = String.fromCharCode(Re[je]);
    return qe.join("");
  }
  function W2(Re, qe) {
    var je = S2(Re, qe);
    switch (qe && qe.type || "buffer") {
      case "file":
        return u2(), l.writeFileSync(qe.filename, je), je;
      case "binary":
        return typeof je == "string" ? je : V2(je);
      case "base64":
        return FS(typeof je == "string" ? je : V2(je));
      case "buffer":
        if (wo) return Buffer.isBuffer(je) ? je : s0(je);
      case "array":
        return typeof je == "string" ? Hf(je) : je;
    }
    return je;
  }
  var X2;
  function Y2(Re) {
    try {
      var qe = Re.InflateRaw, je = new qe();
      if (je._processChunk(new Uint8Array([3, 0]), je._finishFlushFlag), je.bytesRead) X2 = Re;
      else throw new Error("zlib does not expose bytesRead");
    } catch (rt) {
      console.error("cannot use native zlib: " + (rt.message || rt));
    }
  }
  function K2(Re, qe) {
    if (!X2) return wt(Re, qe);
    var je = X2.InflateRaw, rt = new je(), He = rt._processChunk(Re.slice(Re.l), rt._finishFlushFlag);
    return Re.l += rt.bytesRead, He;
  }
  function q(Re) {
    return X2 ? X2.deflateRawSync(Re) : Ue(Re);
  }
  var re = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], R2 = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258], z = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577];
  function H2(Re) {
    var qe = (Re << 1 | Re << 11) & 139536 | (Re << 5 | Re << 15) & 558144;
    return (qe >> 16 | qe >> 8 | qe) & 255;
  }
  for (var te = typeof Uint8Array < "u", j = te ? new Uint8Array(1 << 8) : [], Q2 = 0; Q2 < 1 << 8; ++Q2) j[Q2] = H2(Q2);
  function Z2(Re, qe) {
    var je = j[Re & 255];
    return qe <= 8 ? je >>> 8 - qe : (je = je << 8 | j[Re >> 8 & 255], qe <= 16 ? je >>> 16 - qe : (je = je << 8 | j[Re >> 16 & 255], je >>> 24 - qe));
  }
  function ne(Re, qe) {
    var je = qe & 7, rt = qe >>> 3;
    return (Re[rt] | (je <= 6 ? 0 : Re[rt + 1] << 8)) >>> je & 3;
  }
  function ae(Re, qe) {
    var je = qe & 7, rt = qe >>> 3;
    return (Re[rt] | (je <= 5 ? 0 : Re[rt + 1] << 8)) >>> je & 7;
  }
  function ue(Re, qe) {
    var je = qe & 7, rt = qe >>> 3;
    return (Re[rt] | (je <= 4 ? 0 : Re[rt + 1] << 8)) >>> je & 15;
  }
  function le(Re, qe) {
    var je = qe & 7, rt = qe >>> 3;
    return (Re[rt] | (je <= 3 ? 0 : Re[rt + 1] << 8)) >>> je & 31;
  }
  function ce(Re, qe) {
    var je = qe & 7, rt = qe >>> 3;
    return (Re[rt] | (je <= 1 ? 0 : Re[rt + 1] << 8)) >>> je & 127;
  }
  function se(Re, qe, je) {
    var rt = qe & 7, He = qe >>> 3, xe = (1 << je) - 1, Ne = Re[He] >>> rt;
    return je < 8 - rt || (Ne |= Re[He + 1] << 8 - rt, je < 16 - rt) || (Ne |= Re[He + 2] << 16 - rt, je < 24 - rt) || (Ne |= Re[He + 3] << 24 - rt), Ne & xe;
  }
  function he(Re, qe, je) {
    var rt = qe & 7, He = qe >>> 3;
    return rt <= 5 ? Re[He] |= (je & 7) << rt : (Re[He] |= je << rt & 255, Re[He + 1] = (je & 7) >> 8 - rt), qe + 3;
  }
  function me(Re, qe, je) {
    var rt = qe & 7, He = qe >>> 3;
    return je = (je & 1) << rt, Re[He] |= je, qe + 1;
  }
  function we(Re, qe, je) {
    var rt = qe & 7, He = qe >>> 3;
    return je <<= rt, Re[He] |= je & 255, je >>>= 8, Re[He + 1] = je, qe + 8;
  }
  function be(Re, qe, je) {
    var rt = qe & 7, He = qe >>> 3;
    return je <<= rt, Re[He] |= je & 255, je >>>= 8, Re[He + 1] = je & 255, Re[He + 2] = je >>> 8, qe + 16;
  }
  function Ae(Re, qe) {
    var je = Re.length, rt = 2 * je > qe ? 2 * je : qe + 5, He = 0;
    if (je >= qe) return Re;
    if (wo) {
      var xe = sre(rt);
      if (Re.copy) Re.copy(xe);
      else for (; He < Re.length; ++He) xe[He] = Re[He];
      return xe;
    } else if (te) {
      var Ne = new Uint8Array(rt);
      if (Ne.set) Ne.set(Re);
      else for (; He < je; ++He) Ne[He] = Re[He];
      return Ne;
    }
    return Re.length = rt, Re;
  }
  function pe(Re) {
    for (var qe = new Array(Re), je = 0; je < Re; ++je) qe[je] = 0;
    return qe;
  }
  function ve(Re, qe, je) {
    var rt = 1, He = 0, xe = 0, Ne = 0, ke = 0, Me = Re.length, Le = te ? new Uint16Array(32) : pe(32);
    for (xe = 0; xe < 32; ++xe) Le[xe] = 0;
    for (xe = Me; xe < je; ++xe) Re[xe] = 0;
    Me = Re.length;
    var ze = te ? new Uint16Array(Me) : pe(Me);
    for (xe = 0; xe < Me; ++xe) Le[He = Re[xe]]++, rt < He && (rt = He), ze[xe] = 0;
    for (Le[0] = 0, xe = 1; xe <= rt; ++xe) Le[xe + 16] = ke = ke + Le[xe - 1] << 1;
    for (xe = 0; xe < Me; ++xe) ke = Re[xe], ke != 0 && (ze[xe] = Le[ke + 16]++);
    var ft = 0;
    for (xe = 0; xe < Me; ++xe) if (ft = Re[xe], ft != 0) for (ke = Z2(ze[xe], rt) >> rt - ft, Ne = (1 << rt + 4 - ft) - 1; Ne >= 0; --Ne) qe[ke | Ne << ft] = ft & 15 | xe << 4;
    return rt;
  }
  var Ee = te ? new Uint16Array(512) : pe(512), Se = te ? new Uint16Array(32) : pe(32);
  if (!te) {
    for (var Ce = 0; Ce < 512; ++Ce) Ee[Ce] = 0;
    for (Ce = 0; Ce < 32; ++Ce) Se[Ce] = 0;
  }
  (function() {
    for (var Re = [], qe = 0; qe < 32; qe++) Re.push(5);
    ve(Re, Se, 32);
    var je = [];
    for (qe = 0; qe <= 143; qe++) je.push(8);
    for (; qe <= 255; qe++) je.push(9);
    for (; qe <= 279; qe++) je.push(7);
    for (; qe <= 287; qe++) je.push(8);
    ve(je, Ee, 288);
  })();
  var Be = function() {
    for (var qe = te ? new Uint8Array(32768) : [], je = 0, rt = 0; je < z.length - 1; ++je) for (; rt < z[je + 1]; ++rt) qe[rt] = je;
    for (; rt < 32768; ++rt) qe[rt] = 29;
    var He = te ? new Uint8Array(259) : [];
    for (je = 0, rt = 0; je < R2.length - 1; ++je) for (; rt < R2[je + 1]; ++rt) He[rt] = je;
    function xe(ke, Me) {
      for (var Le = 0; Le < ke.length; ) {
        var ze = Math.min(65535, ke.length - Le), ft = Le + ze == ke.length;
        for (Me.write_shift(1, +ft), Me.write_shift(2, ze), Me.write_shift(2, ~ze & 65535); ze-- > 0; ) Me[Me.l++] = ke[Le++];
      }
      return Me.l;
    }
    function Ne(ke, Me) {
      for (var Le = 0, ze = 0, ft = te ? new Uint16Array(32768) : []; ze < ke.length; ) {
        var De = Math.min(65535, ke.length - ze);
        if (De < 10) {
          for (Le = he(Me, Le, +(ze + De == ke.length)), Le & 7 && (Le += 8 - (Le & 7)), Me.l = Le / 8 | 0, Me.write_shift(2, De), Me.write_shift(2, ~De & 65535); De-- > 0; ) Me[Me.l++] = ke[ze++];
          Le = Me.l * 8;
          continue;
        }
        Le = he(Me, Le, +(ze + De == ke.length) + 2);
        for (var Je = 0; De-- > 0; ) {
          var tt = ke[ze];
          Je = (Je << 5 ^ tt) & 32767;
          var vt = -1, kt = 0;
          if ((vt = ft[Je]) && (vt |= ze & -32768, vt > ze && (vt -= 32768), vt < ze)) for (; ke[vt + kt] == ke[ze + kt] && kt < 250; ) ++kt;
          if (kt > 2) {
            tt = He[kt], tt <= 22 ? Le = we(Me, Le, j[tt + 1] >> 1) - 1 : (we(Me, Le, 3), Le += 5, we(Me, Le, j[tt - 23] >> 5), Le += 3);
            var jt = tt < 8 ? 0 : tt - 4 >> 2;
            jt > 0 && (be(Me, Le, kt - R2[tt]), Le += jt), tt = qe[ze - vt], Le = we(Me, Le, j[tt] >> 3), Le -= 3;
            var Vt = tt < 4 ? 0 : tt - 2 >> 1;
            Vt > 0 && (be(Me, Le, ze - vt - z[tt]), Le += Vt);
            for (var Kt = 0; Kt < kt; ++Kt) ft[Je] = ze & 32767, Je = (Je << 5 ^ ke[ze]) & 32767, ++ze;
            De -= kt - 1;
          } else tt <= 143 ? tt = tt + 48 : Le = me(Me, Le, 1), Le = we(Me, Le, j[tt]), ft[Je] = ze & 32767, ++ze;
        }
        Le = we(Me, Le, 0) - 1;
      }
      return Me.l = (Le + 7) / 8 | 0, Me.l;
    }
    return function(Me, Le) {
      return Me.length < 8 ? xe(Me, Le) : Ne(Me, Le);
    };
  }();
  function Ue(Re) {
    var qe = Fn(50 + Math.floor(Re.length * 1.1)), je = Be(Re, qe);
    return qe.slice(0, je);
  }
  var Ke = te ? new Uint16Array(32768) : pe(32768), ct = te ? new Uint16Array(32768) : pe(32768), We = te ? new Uint16Array(128) : pe(128), Ze = 1, it = 1;
  function ot(Re, qe) {
    var je = le(Re, qe) + 257;
    qe += 5;
    var rt = le(Re, qe) + 1;
    qe += 5;
    var He = ue(Re, qe) + 4;
    qe += 4;
    for (var xe = 0, Ne = te ? new Uint8Array(19) : pe(19), ke = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], Me = 1, Le = te ? new Uint8Array(8) : pe(8), ze = te ? new Uint8Array(8) : pe(8), ft = Ne.length, De = 0; De < He; ++De) Ne[re[De]] = xe = ae(Re, qe), Me < xe && (Me = xe), Le[xe]++, qe += 3;
    var Je = 0;
    for (Le[0] = 0, De = 1; De <= Me; ++De) ze[De] = Je = Je + Le[De - 1] << 1;
    for (De = 0; De < ft; ++De) (Je = Ne[De]) != 0 && (ke[De] = ze[Je]++);
    var tt = 0;
    for (De = 0; De < ft; ++De) if (tt = Ne[De], tt != 0) {
      Je = j[ke[De]] >> 8 - tt;
      for (var vt = (1 << 7 - tt) - 1; vt >= 0; --vt) We[Je | vt << tt] = tt & 7 | De << 3;
    }
    var kt = [];
    for (Me = 1; kt.length < je + rt; ) switch (Je = We[ce(Re, qe)], qe += Je & 7, Je >>>= 3) {
      case 16:
        for (xe = 3 + ne(Re, qe), qe += 2, Je = kt[kt.length - 1]; xe-- > 0; ) kt.push(Je);
        break;
      case 17:
        for (xe = 3 + ae(Re, qe), qe += 3; xe-- > 0; ) kt.push(0);
        break;
      case 18:
        for (xe = 11 + ce(Re, qe), qe += 7; xe-- > 0; ) kt.push(0);
        break;
      default:
        kt.push(Je), Me < Je && (Me = Je);
        break;
    }
    var jt = kt.slice(0, je), Vt = kt.slice(je);
    for (De = je; De < 286; ++De) jt[De] = 0;
    for (De = rt; De < 30; ++De) Vt[De] = 0;
    return Ze = ve(jt, Ke, 286), it = ve(Vt, ct, 30), qe;
  }
  function mt(Re, qe) {
    if (Re[0] == 3 && !(Re[1] & 3)) return [am(qe), 2];
    for (var je = 0, rt = 0, He = sre(qe || 1 << 18), xe = 0, Ne = He.length >>> 0, ke = 0, Me = 0; (rt & 1) == 0; ) {
      if (rt = ae(Re, je), je += 3, rt >>> 1 == 0) {
        je & 7 && (je += 8 - (je & 7));
        var Le = Re[je >>> 3] | Re[(je >>> 3) + 1] << 8;
        if (je += 32, Le > 0) for (!qe && Ne < xe + Le && (He = Ae(He, xe + Le), Ne = He.length); Le-- > 0; ) He[xe++] = Re[je >>> 3], je += 8;
        continue;
      } else rt >> 1 == 1 ? (ke = 9, Me = 5) : (je = ot(Re, je), ke = Ze, Me = it);
      for (; ; ) {
        !qe && Ne < xe + 32767 && (He = Ae(He, xe + 32767), Ne = He.length);
        var ze = se(Re, je, ke), ft = rt >>> 1 == 1 ? Ee[ze] : Ke[ze];
        if (je += ft & 15, ft >>>= 4, (ft >>> 8 & 255) === 0) He[xe++] = ft;
        else {
          if (ft == 256) break;
          ft -= 257;
          var De = ft < 8 ? 0 : ft - 4 >> 2;
          De > 5 && (De = 0);
          var Je = xe + R2[ft];
          De > 0 && (Je += se(Re, je, De), je += De), ze = se(Re, je, Me), ft = rt >>> 1 == 1 ? Se[ze] : ct[ze], je += ft & 15, ft >>>= 4;
          var tt = ft < 4 ? 0 : ft - 2 >> 1, vt = z[ft];
          for (tt > 0 && (vt += se(Re, je, tt), je += tt), !qe && Ne < Je && (He = Ae(He, Je + 100), Ne = He.length); xe < Je; ) He[xe] = He[xe - vt], ++xe;
        }
      }
    }
    return qe ? [He, je + 7 >>> 3] : [He.slice(0, xe), je + 7 >>> 3];
  }
  function wt(Re, qe) {
    var je = Re.slice(Re.l || 0), rt = mt(je, qe);
    return Re.l += rt[1], rt[0];
  }
  function Et(Re, qe) {
    if (Re) typeof console < "u" && console.error(qe);
    else throw new Error(qe);
  }
  function zt(Re, qe) {
    var je = Re;
    gc(je, 0);
    var rt = [], He = [], xe = { FileIndex: rt, FullPaths: He };
    k(xe, { root: qe.root });
    for (var Ne = je.length - 4; (je[Ne] != 80 || je[Ne + 1] != 75 || je[Ne + 2] != 5 || je[Ne + 3] != 6) && Ne >= 0; ) --Ne;
    je.l = Ne + 4, je.l += 4;
    var ke = je.read_shift(2);
    je.l += 6;
    var Me = je.read_shift(4);
    for (je.l = Me, Ne = 0; Ne < ke; ++Ne) {
      je.l += 20;
      var Le = je.read_shift(4), ze = je.read_shift(4), ft = je.read_shift(2), De = je.read_shift(2), Je = je.read_shift(2);
      je.l += 8;
      var tt = je.read_shift(4), vt = i(je.slice(je.l + ft, je.l + ft + De));
      je.l += ft + De + Je;
      var kt = je.l;
      je.l = tt + 4, vt && vt[1] && ((vt[1] || {}).usz && (ze = vt[1].usz), (vt[1] || {}).csz && (Le = vt[1].csz)), Nt(je, Le, ze, xe, vt), je.l = kt;
    }
    return xe;
  }
  function Nt(Re, qe, je, rt, He) {
    Re.l += 2;
    var xe = Re.read_shift(2), Ne = Re.read_shift(2), ke = s(Re);
    if (xe & 8257) throw new Error("Unsupported ZIP encryption");
    for (var Me = Re.read_shift(4), Le = Re.read_shift(4), ze = Re.read_shift(4), ft = Re.read_shift(2), De = Re.read_shift(2), Je = "", tt = 0; tt < ft; ++tt) Je += String.fromCharCode(Re[Re.l++]);
    if (De) {
      var vt = i(Re.slice(Re.l, Re.l + De));
      (vt[21589] || {}).mt && (ke = vt[21589].mt), (vt[1] || {}).usz && (ze = vt[1].usz), (vt[1] || {}).csz && (Le = vt[1].csz), He && ((He[21589] || {}).mt && (ke = He[21589].mt), (He[1] || {}).usz && (ze = vt[1].usz), (He[1] || {}).csz && (Le = vt[1].csz));
    }
    Re.l += De;
    var kt = Re.slice(Re.l, Re.l + Le);
    switch (Ne) {
      case 8:
        kt = K2(Re, ze);
        break;
      case 0:
        break;
      default:
        throw new Error("Unsupported ZIP Compression method " + Ne);
    }
    var jt = false;
    xe & 8 && (Me = Re.read_shift(4), Me == 134695760 && (Me = Re.read_shift(4), jt = true), Le = Re.read_shift(4), ze = Re.read_shift(4)), Le != qe && Et(jt, "Bad compressed size: " + qe + " != " + Le), ze != je && Et(jt, "Bad uncompressed size: " + je + " != " + ze), Pe(rt, Je, kt, { unsafe: true, mt: ke });
  }
  function yt(Re, qe) {
    var je = qe || {}, rt = [], He = [], xe = Fn(1), Ne = je.compression ? 8 : 0, ke = 0, Me = false;
    Me && (ke |= 8);
    var Le = 0, ze = 0, ft = 0, De = 0, Je = Re.FullPaths[0], tt = Je, vt = Re.FileIndex[0], kt = [], jt = 0;
    for (Le = 1; Le < Re.FullPaths.length; ++Le) if (tt = Re.FullPaths[Le].slice(Je.length), vt = Re.FileIndex[Le], !(!vt.size || !vt.content || tt == "Sh33tJ5")) {
      var Vt = ft, Kt = Fn(tt.length);
      for (ze = 0; ze < tt.length; ++ze) Kt.write_shift(1, tt.charCodeAt(ze) & 127);
      Kt = Kt.slice(0, Kt.l), kt[De] = typeof vt.content == "string" ? vre.bstr(vt.content, 0) : vre.buf(vt.content, 0);
      var rr = typeof vt.content == "string" ? Hf(vt.content) : vt.content;
      Ne == 8 && (rr = q(rr)), xe = Fn(30), xe.write_shift(4, 67324752), xe.write_shift(2, 20), xe.write_shift(2, ke), xe.write_shift(2, Ne), vt.mt ? o(xe, vt.mt) : xe.write_shift(4, 0), xe.write_shift(-4, ke & 8 ? 0 : kt[De]), xe.write_shift(4, ke & 8 ? 0 : rr.length), xe.write_shift(4, ke & 8 ? 0 : vt.content.length), xe.write_shift(2, Kt.length), xe.write_shift(2, 0), ft += xe.length, rt.push(xe), ft += Kt.length, rt.push(Kt), ft += rr.length, rt.push(rr), ke & 8 && (xe = Fn(12), xe.write_shift(-4, kt[De]), xe.write_shift(4, rr.length), xe.write_shift(4, vt.content.length), ft += xe.l, rt.push(xe)), xe = Fn(46), xe.write_shift(4, 33639248), xe.write_shift(2, 0), xe.write_shift(2, 20), xe.write_shift(2, ke), xe.write_shift(2, Ne), xe.write_shift(4, 0), xe.write_shift(-4, kt[De]), xe.write_shift(4, rr.length), xe.write_shift(4, vt.content.length), xe.write_shift(2, Kt.length), xe.write_shift(2, 0), xe.write_shift(2, 0), xe.write_shift(2, 0), xe.write_shift(2, 0), xe.write_shift(4, 0), xe.write_shift(4, Vt), jt += xe.l, He.push(xe), jt += Kt.length, He.push(Kt), ++De;
    }
    return xe = Fn(22), xe.write_shift(4, 101010256), xe.write_shift(2, 0), xe.write_shift(2, 0), xe.write_shift(2, De), xe.write_shift(2, De), xe.write_shift(4, jt), xe.write_shift(4, ft), xe.write_shift(2, 0), Ju([Ju(rt), Ju(He), xe]);
  }
  var pt = { htm: "text/html", xml: "text/xml", gif: "image/gif", jpg: "image/jpeg", png: "image/png", mso: "application/x-mso", thmx: "application/vnd.ms-officetheme", sh33tj5: "application/octet-stream" };
  function Ot(Re, qe) {
    if (Re.ctype) return Re.ctype;
    var je = Re.name || "", rt = je.match(/\.([^\.]+)$/);
    return rt && pt[rt[1]] || qe && (rt = (je = qe).match(/[\.\\]([^\.\\])+$/), rt && pt[rt[1]]) ? pt[rt[1]] : "application/octet-stream";
  }
  function Jt(Re) {
    for (var qe = FS(Re), je = [], rt = 0; rt < qe.length; rt += 76) je.push(qe.slice(rt, rt + 76));
    return je.join(`\r
`) + `\r
`;
  }
  function tr(Re) {
    var qe = Re.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7E-\xFF=]/g, function(Le) {
      var ze = Le.charCodeAt(0).toString(16).toUpperCase();
      return "=" + (ze.length == 1 ? "0" + ze : ze);
    });
    qe = qe.replace(/ $/mg, "=20").replace(/\t$/mg, "=09"), qe.charAt(0) == `
` && (qe = "=0D" + qe.slice(1)), qe = qe.replace(/\r(?!\n)/mg, "=0D").replace(/\n\n/mg, `
=0A`).replace(/([^\r\n])\n/mg, "$1=0A");
    for (var je = [], rt = qe.split(`\r
`), He = 0; He < rt.length; ++He) {
      var xe = rt[He];
      if (xe.length == 0) {
        je.push("");
        continue;
      }
      for (var Ne = 0; Ne < xe.length; ) {
        var ke = 76, Me = xe.slice(Ne, Ne + ke);
        Me.charAt(ke - 1) == "=" ? ke-- : Me.charAt(ke - 2) == "=" ? ke -= 2 : Me.charAt(ke - 3) == "=" && (ke -= 3), Me = xe.slice(Ne, Ne + ke), Ne += ke, Ne < xe.length && (Me += "="), je.push(Me);
      }
    }
    return je.join(`\r
`);
  }
  function Ye(Re) {
    for (var qe = [], je = 0; je < Re.length; ++je) {
      for (var rt = Re[je]; je <= Re.length && rt.charAt(rt.length - 1) == "="; ) rt = rt.slice(0, rt.length - 1) + Re[++je];
      qe.push(rt);
    }
    for (var He = 0; He < qe.length; ++He) qe[He] = qe[He].replace(/[=][0-9A-Fa-f]{2}/g, function(xe) {
      return String.fromCharCode(parseInt(xe.slice(1), 16));
    });
    return Hf(qe.join(`\r
`));
  }
  function at(Re, qe, je) {
    for (var rt = "", He = "", xe = "", Ne, ke = 0; ke < 10; ++ke) {
      var Me = qe[ke];
      if (!Me || Me.match(/^\s*$/)) break;
      var Le = Me.match(/^(.*?):\s*([^\s].*)$/);
      if (Le) switch (Le[1].toLowerCase()) {
        case "content-location":
          rt = Le[2].trim();
          break;
        case "content-type":
          xe = Le[2].trim();
          break;
        case "content-transfer-encoding":
          He = Le[2].trim();
          break;
      }
    }
    switch (++ke, He.toLowerCase()) {
      case "base64":
        Ne = Hf(qh(qe.slice(ke).join("")));
        break;
      case "quoted-printable":
        Ne = Ye(qe.slice(ke));
        break;
      default:
        throw new Error("Unsupported Content-Transfer-Encoding " + He);
    }
    var ze = Pe(Re, rt.slice(je.length), Ne, { unsafe: true });
    xe && (ze.ctype = xe);
  }
  function Ge(Re, qe) {
    if (V2(Re.slice(0, 13)).toLowerCase() != "mime-version:") throw new Error("Unsupported MAD header");
    var je = qe && qe.root || "", rt = (wo && Buffer.isBuffer(Re) ? Re.toString("binary") : V2(Re)).split(`\r
`), He = 0, xe = "";
    for (He = 0; He < rt.length; ++He) if (xe = rt[He], !!/^Content-Location:/i.test(xe) && (xe = xe.slice(xe.indexOf("file")), je || (je = xe.slice(0, xe.lastIndexOf("/") + 1)), xe.slice(0, je.length) != je)) for (; je.length > 0 && (je = je.slice(0, je.length - 1), je = je.slice(0, je.lastIndexOf("/") + 1), xe.slice(0, je.length) != je); ) ;
    var Ne = (rt[1] || "").match(/boundary="(.*?)"/);
    if (!Ne) throw new Error("MAD cannot find boundary");
    var ke = "--" + (Ne[1] || ""), Me = [], Le = [], ze = { FileIndex: Me, FullPaths: Le };
    k(ze);
    var ft, De = 0;
    for (He = 0; He < rt.length; ++He) {
      var Je = rt[He];
      Je !== ke && Je !== ke + "--" || (De++ && at(ze, rt.slice(ft, He), je), ft = He);
    }
    return ze;
  }
  function st(Re, qe) {
    var je = qe || {}, rt = je.boundary || "SheetJS";
    rt = "------=" + rt;
    for (var He = ["MIME-Version: 1.0", 'Content-Type: multipart/related; boundary="' + rt.slice(2) + '"', "", "", ""], xe = Re.FullPaths[0], Ne = xe, ke = Re.FileIndex[0], Me = 1; Me < Re.FullPaths.length; ++Me) if (Ne = Re.FullPaths[Me].slice(xe.length), ke = Re.FileIndex[Me], !(!ke.size || !ke.content || Ne == "Sh33tJ5")) {
      Ne = Ne.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7E-\xFF]/g, function(kt) {
        return "_x" + kt.charCodeAt(0).toString(16) + "_";
      }).replace(/[\u0080-\uFFFF]/g, function(kt) {
        return "_u" + kt.charCodeAt(0).toString(16) + "_";
      });
      for (var Le = ke.content, ze = wo && Buffer.isBuffer(Le) ? Le.toString("binary") : V2(Le), ft = 0, De = Math.min(1024, ze.length), Je = 0, tt = 0; tt <= De; ++tt) (Je = ze.charCodeAt(tt)) >= 32 && Je < 128 && ++ft;
      var vt = ft >= De * 4 / 5;
      He.push(rt), He.push("Content-Location: " + (je.root || "file:///C:/SheetJS/") + Ne), He.push("Content-Transfer-Encoding: " + (vt ? "quoted-printable" : "base64")), He.push("Content-Type: " + Ot(ke, Ne)), He.push(""), He.push(vt ? tr(ze) : Jt(ze));
    }
    return He.push(rt + `--\r
`), He.join(`\r
`);
  }
  function Ie(Re) {
    var qe = {};
    return k(qe, Re), qe;
  }
  function Pe(Re, qe, je, rt) {
    var He = rt && rt.unsafe;
    He || k(Re);
    var xe = !He && Ri.find(Re, qe);
    if (!xe) {
      var Ne = Re.FullPaths[0];
      qe.slice(0, Ne.length) == Ne ? Ne = qe : (Ne.slice(-1) != "/" && (Ne += "/"), Ne = (Ne + qe).replace("//", "/")), xe = { name: a(qe), type: 2 }, Re.FileIndex.push(xe), Re.FullPaths.push(Ne), He || Ri.utils.cfb_gc(Re);
    }
    return xe.content = je, xe.size = je ? je.length : 0, rt && (rt.CLSID && (xe.clsid = rt.CLSID), rt.mt && (xe.mt = rt.mt), rt.ct && (xe.ct = rt.ct)), xe;
  }
  function $e(Re, qe) {
    k(Re);
    var je = Ri.find(Re, qe);
    if (je) {
      for (var rt = 0; rt < Re.FileIndex.length; ++rt) if (Re.FileIndex[rt] == je) return Re.FileIndex.splice(rt, 1), Re.FullPaths.splice(rt, 1), true;
    }
    return false;
  }
  function Ve(Re, qe, je) {
    k(Re);
    var rt = Ri.find(Re, qe);
    if (rt) {
      for (var He = 0; He < Re.FileIndex.length; ++He) if (Re.FileIndex[He] == rt) return Re.FileIndex[He].name = a(je), Re.FullPaths[He] = je, true;
    }
    return false;
  }
  function ut(Re) {
    A2(Re, true);
  }
  return t.find = C2, t.read = _4, t.parse = c, t.write = W2, t.writeFile = L2, t.utils = { cfb_new: Ie, cfb_add: Pe, cfb_del: $e, cfb_mov: Ve, cfb_gc: ut, ReadShift: B_, CheckField: Xne, prep_blob: gc, bconcat: Ju, use_zlib: Y2, _deflateRaw: Ue, _inflateRaw: wt, consts: O2 }, t;
}();
var Jg;
function Gl(e) {
  for (var t = Object.keys(e), r = [], n = 0; n < t.length; ++n) Object.prototype.hasOwnProperty.call(e, t[n]) && r.push(t[n]);
  return r;
}
function KS(e) {
  for (var t = [], r = Gl(e), n = 0; n !== r.length; ++n) t[e[r[n]]] = r[n];
  return t;
}
var RS = new Date(1899, 11, 30, 0, 0, 0);
function ec(e, t) {
  var r = e.getTime();
  t && (r -= 1462 * 24 * 60 * 60 * 1e3);
  var n = RS.getTime() + (e.getTimezoneOffset() - RS.getTimezoneOffset()) * 6e4;
  return (r - n) / (24 * 60 * 60 * 1e3);
}
var Ine = /* @__PURE__ */ new Date();
var Uht = RS.getTime() + (Ine.getTimezoneOffset() - RS.getTimezoneOffset()) * 6e4;
var gre = Ine.getTimezoneOffset();
function ZS(e) {
  var t = /* @__PURE__ */ new Date();
  return t.setTime(e * 24 * 60 * 60 * 1e3 + Uht), t.getTimezoneOffset() !== gre && t.setTime(t.getTime() + (t.getTimezoneOffset() - gre) * 6e4), t;
}
var yre = /* @__PURE__ */ new Date("2017-02-19T19:06:09.000Z");
var Nne = isNaN(yre.getFullYear()) ? /* @__PURE__ */ new Date("2/19/17") : yre;
var jht = Nne.getFullYear() == 2017;
function $l(e, t) {
  var r = new Date(e);
  if (jht) return t > 0 ? r.setTime(r.getTime() + r.getTimezoneOffset() * 60 * 1e3) : t < 0 && r.setTime(r.getTime() - r.getTimezoneOffset() * 60 * 1e3), r;
  if (e instanceof Date) return e;
  if (Nne.getFullYear() == 1917 && !isNaN(r.getFullYear())) {
    var n = r.getFullYear();
    return e.indexOf("" + n) > -1 || r.setFullYear(r.getFullYear() + 100), r;
  }
  var a = e.match(/\d+/g) || ["2017", "2", "19", "0", "0", "0"], o = new Date(+a[0], +a[1] - 1, +a[2], +a[3] || 0, +a[4] || 0, +a[5] || 0);
  return e.indexOf("Z") > -1 && (o = new Date(o.getTime() - o.getTimezoneOffset() * 60 * 1e3)), o;
}
function i1(e, t) {
  if (wo && Buffer.isBuffer(e)) {
    if (t && Y_) {
      if (e[0] == 255 && e[1] == 254) return i0(e.slice(2).toString("utf16le"));
      if (e[1] == 254 && e[2] == 255) return i0(yne(e.slice(2).toString("binary")));
    }
    return e.toString("binary");
  }
  if (typeof TextDecoder < "u") try {
    if (t) {
      if (e[0] == 255 && e[1] == 254) return i0(new TextDecoder("utf-16le").decode(e.slice(2)));
      if (e[0] == 254 && e[1] == 255) return i0(new TextDecoder("utf-16be").decode(e.slice(2)));
    }
    var r = { "\u20AC": "\x80", "\u201A": "\x82", \u0192: "\x83", "\u201E": "\x84", "\u2026": "\x85", "\u2020": "\x86", "\u2021": "\x87", "\u02C6": "\x88", "\u2030": "\x89", \u0160: "\x8A", "\u2039": "\x8B", \u0152: "\x8C", \u017D: "\x8E", "\u2018": "\x91", "\u2019": "\x92", "\u201C": "\x93", "\u201D": "\x94", "\u2022": "\x95", "\u2013": "\x96", "\u2014": "\x97", "\u02DC": "\x98", "\u2122": "\x99", \u0161: "\x9A", "\u203A": "\x9B", \u0153: "\x9C", \u017E: "\x9E", \u0178: "\x9F" };
    return Array.isArray(e) && (e = new Uint8Array(e)), new TextDecoder("latin1").decode(e).replace(/[€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ]/g, function(o) {
      return r[o] || o;
    });
  } catch {
  }
  for (var n = [], a = 0; a != e.length; ++a) n.push(String.fromCharCode(e[a]));
  return n.join("");
}
function rl(e) {
  if (typeof JSON < "u" && !Array.isArray(e)) return JSON.parse(JSON.stringify(e));
  if (typeof e != "object" || e == null) return e;
  if (e instanceof Date) return new Date(e.getTime());
  var t = {};
  for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = rl(e[r]));
  return t;
}
function rs(e, t) {
  for (var r = ""; r.length < t; ) r += e;
  return r;
}
function Hh(e) {
  var t = Number(e);
  if (!isNaN(t)) return isFinite(t) ? t : NaN;
  if (!/\d/.test(e)) return t;
  var r = 1, n = e.replace(/([\d]),([\d])/g, "$1$2").replace(/[$]/g, "").replace(/[%]/g, function() {
    return r *= 100, "";
  });
  return !isNaN(t = Number(n)) || (n = n.replace(/[(](.*)[)]/, function(a, o) {
    return r = -r, o;
  }), !isNaN(t = Number(n))) ? t / r : t;
}
var Wht = /^(0?\d|1[0-2])(?:|:([0-5]?\d)(?:|(\.\d+)(?:|:([0-5]?\d))|:([0-5]?\d)(|\.\d+)))\s+([ap])m?$/;
function Ght(e) {
  return e[2] ? e[3] ? e[4] ? new Date(1899, 11, 30, +e[1] % 12 + (e[7] == "p" ? 12 : 0), +e[2], +e[4], parseFloat(e[3]) * 1e3) : new Date(1899, 11, 30, e[7] == "p" ? 12 : 0, +e[1], +e[2], parseFloat(e[3]) * 1e3) : e[5] ? new Date(1899, 11, 30, +e[1] % 12 + (e[7] == "p" ? 12 : 0), +e[2], +e[5], e[6] ? parseFloat(e[6]) * 1e3 : 0) : new Date(1899, 11, 30, +e[1] % 12 + (e[7] == "p" ? 12 : 0), +e[2], 0, 0) : new Date(1899, 11, 30, +e[1] % 12 + (e[7] == "p" ? 12 : 0), 0, 0, 0);
}
var $ht = ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"];
function Xx(e) {
  var t = e.toLowerCase(), r = t.replace(/\s+/g, " ").trim(), n = r.match(Wht);
  if (n) return Ght(n);
  var a = new Date(e), o = /* @__PURE__ */ new Date(NaN), s = a.getYear(), i = a.getMonth(), l = a.getDate();
  if (isNaN(l)) return o;
  if (t.match(/jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec/)) {
    if (t = t.replace(/[^a-z]/g, "").replace(/([^a-z]|^)[ap]m?([^a-z]|$)/, ""), t.length > 3 && $ht.indexOf(t) == -1) return o;
  } else if (t.replace(/[ap]m?/, "").match(/[a-z]/)) return o;
  return s < 0 || s > 8099 || e.match(/[^-0-9:,\/\\]/) ? o : a;
}
var Hht = function() {
  var e = "abacaba".split(/(:?b)/i).length == 5;
  return function(r, n, a) {
    if (e || typeof n == "string") return r.split(n);
    for (var o = r.split(n), s = [o[0]], i = 1; i < o.length; ++i) s.push(a), s.push(o[i]);
    return s;
  };
}();
var Ru = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
`;
var Xht = /([^"\s?>\/]+)\s*=\s*((?:")([^"]*)(?:")|(?:')([^']*)(?:')|([^'">\s]+))/g;
var bre = /<[\/\?]?[a-zA-Z0-9:_-]+(?:\s+[^"\s?>\/]+\s*=\s*(?:"[^"]*"|'[^']*'|[^'">\s=]+))*\s*[\/\?]?>/mg;
var Kht = /<[^>]*>/g;
var wf = Ru.match(bre) ? bre : Kht;
function mi(e, t, r) {
  for (var n = {}, a = 0, o = 0; a !== e.length && !((o = e.charCodeAt(a)) === 32 || o === 10 || o === 13); ++a) ;
  if (t || (n[0] = e.slice(0, a)), a === e.length) return n;
  var s = e.match(Xht), i = 0, l = "", u2 = 0, c = "", f = "", h = 1;
  if (s) for (u2 = 0; u2 != s.length; ++u2) {
    for (f = s[u2], o = 0; o != f.length && f.charCodeAt(o) !== 61; ++o) ;
    for (c = f.slice(0, o).trim(); f.charCodeAt(o + 1) == 32; ) ++o;
    for (h = (a = f.charCodeAt(o + 1)) == 34 || a == 39 ? 1 : 0, l = f.slice(o + 1 + h, f.length - h), i = 0; i != c.length && c.charCodeAt(i) !== 58; ++i) ;
    if (i === c.length) c.indexOf("_") > 0 && (c = c.slice(0, c.indexOf("_"))), n[c] = l, r || (n[c.toLowerCase()] = l);
    else {
      var p = (i === 5 && c.slice(0, 5) === "xmlns" ? "xmlns" : "") + c.slice(i + 1);
      if (n[p] && c.slice(i - 3, i) == "ext") continue;
      n[p] = l, r || (n[p.toLowerCase()] = l);
    }
  }
  return n;
}
var Rne = { "&quot;": '"', "&apos;": "'", "&gt;": ">", "&lt;": "<", "&amp;": "&" };
var Y8 = KS(Rne);
var Ho = /* @__PURE__ */ function() {
  var e = /&(?:quot|apos|gt|lt|amp|#x?([\da-fA-F]+));/ig, t = /_x([\da-fA-F]{4})_/ig;
  function r(n) {
    var a = n + "", o = a.indexOf("<![CDATA[");
    if (o == -1) return a.replace(e, function(i, l) {
      return Rne[i] || String.fromCharCode(parseInt(l, i.indexOf("x") > -1 ? 16 : 10)) || i;
    }).replace(t, function(i, l) {
      return String.fromCharCode(parseInt(l, 16));
    });
    var s = a.indexOf("]]>");
    return r(a.slice(0, o)) + a.slice(o + 9, s) + r(a.slice(s + 3));
  }
  return function(a, o) {
    var s = r(a);
    return o ? s.replace(/\r\n/g, `
`) : s;
  };
}();
var Z8 = /[&<>'"]/g;
var zne = /[\u0000-\u001f]/g;
function zS(e) {
  var t = e + "";
  return t.replace(Z8, function(r) {
    return Y8[r];
  }).replace(/\n/g, "<br/>").replace(zne, function(r) {
    return "&#x" + ("000" + r.charCodeAt(0).toString(16)).slice(-4) + ";";
  });
}
function Bs(e) {
  switch (e) {
    case 1:
    case true:
    case "1":
    case "true":
      return true;
    case 0:
    case false:
    case "0":
    case "false":
      return false;
  }
  return false;
}
function x8(e) {
  for (var t = "", r = 0, n = 0, a = 0, o = 0, s = 0, i = 0; r < e.length; ) {
    if (n = e.charCodeAt(r++), n < 128) {
      t += String.fromCharCode(n);
      continue;
    }
    if (a = e.charCodeAt(r++), n > 191 && n < 224) {
      s = (n & 31) << 6, s |= a & 63, t += String.fromCharCode(s);
      continue;
    }
    if (o = e.charCodeAt(r++), n < 240) {
      t += String.fromCharCode((n & 15) << 12 | (a & 63) << 6 | o & 63);
      continue;
    }
    s = e.charCodeAt(r++), i = ((n & 7) << 18 | (a & 63) << 12 | (o & 63) << 6 | s & 63) - 65536, t += String.fromCharCode(55296 + (i >>> 10 & 1023)), t += String.fromCharCode(56320 + (i & 1023));
  }
  return t;
}
function kre(e) {
  var t = am(2 * e.length), r, n, a = 1, o = 0, s = 0, i;
  for (n = 0; n < e.length; n += a) a = 1, (i = e.charCodeAt(n)) < 128 ? r = i : i < 224 ? (r = (i & 31) * 64 + (e.charCodeAt(n + 1) & 63), a = 2) : i < 240 ? (r = (i & 15) * 4096 + (e.charCodeAt(n + 1) & 63) * 64 + (e.charCodeAt(n + 2) & 63), a = 3) : (a = 4, r = (i & 7) * 262144 + (e.charCodeAt(n + 1) & 63) * 4096 + (e.charCodeAt(n + 2) & 63) * 64 + (e.charCodeAt(n + 3) & 63), r -= 65536, s = 55296 + (r >>> 10 & 1023), r = 56320 + (r & 1023)), s !== 0 && (t[o++] = s & 255, t[o++] = s >>> 8, s = 0), t[o++] = r % 256, t[o++] = r >>> 8;
  return t.slice(0, o).toString("ucs2");
}
function Tre(e) {
  return s0(e, "binary").toString("utf8");
}
var xS = "foo bar baz\xE2\x98\x83\xF0\x9F\x8D\xA3";
var Us = wo && (Tre(xS) == x8(xS) && Tre || kre(xS) == x8(xS) && kre) || x8;
var i0 = wo ? function(e) {
  return s0(e, "utf8").toString("binary");
} : function(e) {
  for (var t = [], r = 0, n = 0, a = 0; r < e.length; ) switch (n = e.charCodeAt(r++), true) {
    case n < 128:
      t.push(String.fromCharCode(n));
      break;
    case n < 2048:
      t.push(String.fromCharCode(192 + (n >> 6))), t.push(String.fromCharCode(128 + (n & 63)));
      break;
    case (n >= 55296 && n < 57344):
      n -= 55296, a = e.charCodeAt(r++) - 56320 + (n << 10), t.push(String.fromCharCode(240 + (a >> 18 & 7))), t.push(String.fromCharCode(144 + (a >> 12 & 63))), t.push(String.fromCharCode(128 + (a >> 6 & 63))), t.push(String.fromCharCode(128 + (a & 63)));
      break;
    default:
      t.push(String.fromCharCode(224 + (n >> 12))), t.push(String.fromCharCode(128 + (n >> 6 & 63))), t.push(String.fromCharCode(128 + (n & 63)));
  }
  return t.join("");
};
var J_ = /* @__PURE__ */ function() {
  var e = {};
  return function(r, n) {
    var a = r + "|" + (n || "");
    return e[a] ? e[a] : e[a] = new RegExp("<(?:\\w+:)?" + r + '(?: xml:space="preserve")?(?:[^>]*)>([\\s\\S]*?)</(?:\\w+:)?' + r + ">", n || "");
  };
}();
var Bne = function() {
  var e = [["nbsp", " "], ["middot", "\xB7"], ["quot", '"'], ["apos", "'"], ["gt", ">"], ["lt", "<"], ["amp", "&"]].map(function(t) {
    return [new RegExp("&" + t[0] + ";", "ig"), t[1]];
  });
  return function(r) {
    for (var n = r.replace(/^[\t\n\r ]+/, "").replace(/[\t\n\r ]+$/, "").replace(/>\s+/g, ">").replace(/\s+</g, "<").replace(/[\t\n\r ]+/g, " ").replace(/<\s*[bB][rR]\s*\/?>/g, `
`).replace(/<[^>]*>/g, ""), a = 0; a < e.length; ++a) n = n.replace(e[a][0], e[a][1]);
    return n;
  };
}();
function Q_(e) {
  return Gl(e).map(function(t) {
    return " " + t + '="' + e[t] + '"';
  }).join("");
}
function ipt(e, t) {
  for (var r = 1 - 2 * (e[t + 7] >>> 7), n = ((e[t + 7] & 127) << 4) + (e[t + 6] >>> 4 & 15), a = e[t + 6] & 15, o = 5; o >= 0; --o) a = a * 256 + e[t + o];
  return n == 2047 ? a == 0 ? r * (1 / 0) : NaN : (n == 0 ? n = -1022 : (n -= 1023, a += Math.pow(2, 52)), r * Math.pow(2, n - 52) * a);
}
function opt(e, t, r) {
  var n = (t < 0 || 1 / t == -1 / 0 ? 1 : 0) << 7, a = 0, o = 0, s = n ? -t : t;
  isFinite(s) ? s == 0 ? a = o = 0 : (a = Math.floor(Math.log(s) / Math.LN2), o = s * Math.pow(2, 52 - a), a <= -1023 && (!isFinite(o) || o < Math.pow(2, 52)) ? a = -1022 : (o -= Math.pow(2, 52), a += 1023)) : (a = 2047, o = isNaN(t) ? 26985 : 0);
  for (var i = 0; i <= 5; ++i, o /= 256) e[r + i] = o & 255;
  e[r + 6] = (a & 15) << 4 | o & 15, e[r + 7] = a >> 4 | n;
}
var Sre = function(e) {
  for (var t = [], r = 10240, n = 0; n < e[0].length; ++n) if (e[0][n]) for (var a = 0, o = e[0][n].length; a < o; a += r) t.push.apply(t, e[0][n].slice(a, a + r));
  return t;
};
var Ere = wo ? function(e) {
  return e[0].length > 0 && Buffer.isBuffer(e[0][0]) ? Buffer.concat(e[0].map(function(t) {
    return Buffer.isBuffer(t) ? t : s0(t);
  })) : Sre(e);
} : Sre;
var Dre = function(e, t, r) {
  for (var n = [], a = t; a < r; a += 2) n.push(String.fromCharCode(G0(e, a)));
  return n.join("").replace(xf, "");
};
var QS = wo ? function(e, t, r) {
  return !Buffer.isBuffer(e) || !Y_ ? Dre(e, t, r) : e.toString("utf16le", t, r).replace(xf, "");
} : Dre;
var Cre = function(e, t, r) {
  for (var n = [], a = t; a < t + r; ++a) n.push(("0" + e[a].toString(16)).slice(-2));
  return n.join("");
};
var Vne = wo ? function(e, t, r) {
  return Buffer.isBuffer(e) ? e.toString("hex", t, t + r) : Cre(e, t, r);
} : Cre;
var Mre = function(e, t, r) {
  for (var n = [], a = t; a < r; a++) n.push(String.fromCharCode(Wx(e, a)));
  return n.join("");
};
var Jx = wo ? function(t, r, n) {
  return Buffer.isBuffer(t) ? t.toString("utf8", r, n) : Mre(t, r, n);
} : Mre;
var jne = function(e, t) {
  var r = Fc(e, t);
  return r > 0 ? Jx(e, t + 4, t + 4 + r - 1) : "";
};
var J8 = jne;
var Wne = function(e, t) {
  var r = Fc(e, t);
  return r > 0 ? Jx(e, t + 4, t + 4 + r - 1) : "";
};
var Q8 = Wne;
var Gne = function(e, t) {
  var r = 2 * Fc(e, t);
  return r > 0 ? Jx(e, t + 4, t + 4 + r - 1) : "";
};
var eO = Gne;
var $ne = function(t, r) {
  var n = Fc(t, r);
  return n > 0 ? QS(t, r + 4, r + 4 + n) : "";
};
var tO = $ne;
var Hne = function(e, t) {
  var r = Fc(e, t);
  return r > 0 ? Jx(e, t + 4, t + 4 + r) : "";
};
var rO = Hne;
var qne = function(e, t) {
  return ipt(e, t);
};
var BS = qne;
var nO = function(t) {
  return Array.isArray(t) || typeof Uint8Array < "u" && t instanceof Uint8Array;
};
wo && (J8 = function(t, r) {
  if (!Buffer.isBuffer(t)) return jne(t, r);
  var n = t.readUInt32LE(r);
  return n > 0 ? t.toString("utf8", r + 4, r + 4 + n - 1) : "";
}, Q8 = function(t, r) {
  if (!Buffer.isBuffer(t)) return Wne(t, r);
  var n = t.readUInt32LE(r);
  return n > 0 ? t.toString("utf8", r + 4, r + 4 + n - 1) : "";
}, eO = function(t, r) {
  if (!Buffer.isBuffer(t) || !Y_) return Gne(t, r);
  var n = 2 * t.readUInt32LE(r);
  return t.toString("utf16le", r + 4, r + 4 + n - 1);
}, tO = function(t, r) {
  if (!Buffer.isBuffer(t) || !Y_) return $ne(t, r);
  var n = t.readUInt32LE(r);
  return t.toString("utf16le", r + 4, r + 4 + n);
}, rO = function(t, r) {
  if (!Buffer.isBuffer(t)) return Hne(t, r);
  var n = t.readUInt32LE(r);
  return t.toString("utf8", r + 4, r + 4 + n);
}, BS = function(t, r) {
  return Buffer.isBuffer(t) ? t.readDoubleLE(r) : qne(t, r);
}, nO = function(t) {
  return Buffer.isBuffer(t) || Array.isArray(t) || typeof Uint8Array < "u" && t instanceof Uint8Array;
});
function spt() {
  QS = function(e, t, r) {
    return Io.utils.decode(1200, e.slice(t, r)).replace(xf, "");
  }, Jx = function(e, t, r) {
    return Io.utils.decode(65001, e.slice(t, r));
  }, J8 = function(e, t) {
    var r = Fc(e, t);
    return r > 0 ? Io.utils.decode(qx, e.slice(t + 4, t + 4 + r - 1)) : "";
  }, Q8 = function(e, t) {
    var r = Fc(e, t);
    return r > 0 ? Io.utils.decode(gf, e.slice(t + 4, t + 4 + r - 1)) : "";
  }, eO = function(e, t) {
    var r = 2 * Fc(e, t);
    return r > 0 ? Io.utils.decode(1200, e.slice(t + 4, t + 4 + r - 1)) : "";
  }, tO = function(e, t) {
    var r = Fc(e, t);
    return r > 0 ? Io.utils.decode(1200, e.slice(t + 4, t + 4 + r)) : "";
  }, rO = function(e, t) {
    var r = Fc(e, t);
    return r > 0 ? Io.utils.decode(65001, e.slice(t + 4, t + 4 + r)) : "";
  };
}
typeof Io < "u" && spt();
var Wx = function(e, t) {
  return e[t];
};
var G0 = function(e, t) {
  return e[t + 1] * (1 << 8) + e[t];
};
var lpt = function(e, t) {
  var r = e[t + 1] * 256 + e[t];
  return r < 32768 ? r : (65535 - r + 1) * -1;
};
var Fc = function(e, t) {
  return e[t + 3] * (1 << 24) + (e[t + 2] << 16) + (e[t + 1] << 8) + e[t];
};
var Yg = function(e, t) {
  return e[t + 3] << 24 | e[t + 2] << 16 | e[t + 1] << 8 | e[t];
};
var upt = function(e, t) {
  return e[t] << 24 | e[t + 1] << 16 | e[t + 2] << 8 | e[t + 3];
};
function B_(e, t) {
  var r = "", n, a, o = [], s, i, l, u2;
  switch (t) {
    case "dbcs":
      if (u2 = this.l, wo && Buffer.isBuffer(this) && Y_) r = this.slice(this.l, this.l + 2 * e).toString("utf16le");
      else for (l = 0; l < e; ++l) r += String.fromCharCode(G0(this, u2)), u2 += 2;
      e *= 2;
      break;
    case "utf8":
      r = Jx(this, this.l, this.l + e);
      break;
    case "utf16le":
      e *= 2, r = QS(this, this.l, this.l + e);
      break;
    case "wstr":
      if (typeof Io < "u") r = Io.utils.decode(gf, this.slice(this.l, this.l + 2 * e));
      else return B_.call(this, e, "dbcs");
      e = 2 * e;
      break;
    case "lpstr-ansi":
      r = J8(this, this.l), e = 4 + Fc(this, this.l);
      break;
    case "lpstr-cp":
      r = Q8(this, this.l), e = 4 + Fc(this, this.l);
      break;
    case "lpwstr":
      r = eO(this, this.l), e = 4 + 2 * Fc(this, this.l);
      break;
    case "lpp4":
      e = 4 + Fc(this, this.l), r = tO(this, this.l), e & 2 && (e += 2);
      break;
    case "8lpp4":
      e = 4 + Fc(this, this.l), r = rO(this, this.l), e & 3 && (e += 4 - (e & 3));
      break;
    case "cstr":
      for (e = 0, r = ""; (s = Wx(this, this.l + e++)) !== 0; ) o.push(yS(s));
      r = o.join("");
      break;
    case "_wstr":
      for (e = 0, r = ""; (s = G0(this, this.l + e)) !== 0; ) o.push(yS(s)), e += 2;
      e += 2, r = o.join("");
      break;
    case "dbcs-cont":
      for (r = "", u2 = this.l, l = 0; l < e; ++l) {
        if (this.lens && this.lens.indexOf(u2) !== -1) return s = Wx(this, u2), this.l = u2 + 1, i = B_.call(this, e - l, s ? "dbcs-cont" : "sbcs-cont"), o.join("") + i;
        o.push(yS(G0(this, u2))), u2 += 2;
      }
      r = o.join(""), e *= 2;
      break;
    case "cpstr":
      if (typeof Io < "u") {
        r = Io.utils.decode(gf, this.slice(this.l, this.l + e));
        break;
      }
    case "sbcs-cont":
      for (r = "", u2 = this.l, l = 0; l != e; ++l) {
        if (this.lens && this.lens.indexOf(u2) !== -1) return s = Wx(this, u2), this.l = u2 + 1, i = B_.call(this, e - l, s ? "dbcs-cont" : "sbcs-cont"), o.join("") + i;
        o.push(yS(Wx(this, u2))), u2 += 1;
      }
      r = o.join("");
      break;
    default:
      switch (e) {
        case 1:
          return n = Wx(this, this.l), this.l++, n;
        case 2:
          return n = (t === "i" ? lpt : G0)(this, this.l), this.l += 2, n;
        case 4:
        case -4:
          return t === "i" || (this[this.l + 3] & 128) === 0 ? (n = (e > 0 ? Yg : upt)(this, this.l), this.l += 4, n) : (a = Fc(this, this.l), this.l += 4, a);
        case 8:
        case -8:
          if (t === "f") return e == 8 ? a = BS(this, this.l) : a = BS([this[this.l + 7], this[this.l + 6], this[this.l + 5], this[this.l + 4], this[this.l + 3], this[this.l + 2], this[this.l + 1], this[this.l + 0]], 0), this.l += 8, a;
          e = 8;
        case 16:
          r = Vne(this, this.l, e);
          break;
      }
  }
  return this.l += e, r;
}
var cpt = function(e, t, r) {
  e[r] = t & 255, e[r + 1] = t >>> 8 & 255, e[r + 2] = t >>> 16 & 255, e[r + 3] = t >>> 24 & 255;
};
var fpt = function(e, t, r) {
  e[r] = t & 255, e[r + 1] = t >> 8 & 255, e[r + 2] = t >> 16 & 255, e[r + 3] = t >> 24 & 255;
};
var hpt = function(e, t, r) {
  e[r] = t & 255, e[r + 1] = t >>> 8 & 255;
};
function ppt(e, t, r) {
  var n = 0, a = 0;
  if (r === "dbcs") {
    for (a = 0; a != t.length; ++a) hpt(this, t.charCodeAt(a), this.l + 2 * a);
    n = 2 * t.length;
  } else if (r === "sbcs" || r == "cpstr") if (typeof Io < "u" && qx == 874) {
    for (a = 0; a != t.length; ++a) {
      var o = Io.utils.encode(qx, t.charAt(a));
      this[this.l + a] = o[0];
    }
    n = t.length;
  } else if (typeof Io < "u" && r == "cpstr") {
    if (o = Io.utils.encode(gf, t), o.length == t.length) for (a = 0; a < t.length; ++a) o[a] == 0 && t.charCodeAt(a) != 0 && (o[a] = 95);
    if (o.length == 2 * t.length) for (a = 0; a < t.length; ++a) o[2 * a] == 0 && o[2 * a + 1] == 0 && t.charCodeAt(a) != 0 && (o[2 * a] = 95);
    for (a = 0; a < o.length; ++a) this[this.l + a] = o[a];
    n = o.length;
  } else {
    for (t = t.replace(/[^\x00-\x7F]/g, "_"), a = 0; a != t.length; ++a) this[this.l + a] = t.charCodeAt(a) & 255;
    n = t.length;
  }
  else if (r === "hex") {
    for (; a < e; ++a) this[this.l++] = parseInt(t.slice(2 * a, 2 * a + 2), 16) || 0;
    return this;
  } else if (r === "utf16le") {
    var s = Math.min(this.l + e, this.length);
    for (a = 0; a < Math.min(t.length, e); ++a) {
      var i = t.charCodeAt(a);
      this[this.l++] = i & 255, this[this.l++] = i >> 8;
    }
    for (; this.l < s; ) this[this.l++] = 0;
    return this;
  } else switch (e) {
    case 1:
      n = 1, this[this.l] = t & 255;
      break;
    case 2:
      n = 2, this[this.l] = t & 255, t >>>= 8, this[this.l + 1] = t & 255;
      break;
    case 3:
      n = 3, this[this.l] = t & 255, t >>>= 8, this[this.l + 1] = t & 255, t >>>= 8, this[this.l + 2] = t & 255;
      break;
    case 4:
      n = 4, cpt(this, t, this.l);
      break;
    case 8:
      if (n = 8, r === "f") {
        opt(this, t, this.l);
        break;
      }
    case 16:
      break;
    case -4:
      n = 4, fpt(this, t, this.l);
      break;
  }
  return this.l += n, this;
}
function Xne(e, t) {
  var r = Vne(this, this.l, e.length >> 1);
  if (r !== e) throw new Error(t + "Expected " + e + " saw " + r);
  this.l += e.length >> 1;
}
function gc(e, t) {
  e.l = t, e.read_shift = B_, e.chk = Xne, e.write_shift = ppt;
}
function Fn(e) {
  var t = am(e);
  return gc(t, 0), t;
}
function yh() {
  var e = [], t = wo ? 256 : 2048, r = function(u2) {
    var c = Fn(u2);
    return gc(c, 0), c;
  }, n = r(t), a = function() {
    !n || (n.l && (n.length > n.l && (n = n.slice(0, n.l), n.l = n.length), n.length > 0 && e.push(n)), n = null);
  }, o = function(u2) {
    return n && u2 < n.length - n.l ? n : (a(), n = r(Math.max(u2 + 1, t)));
  }, s = function() {
    return a(), Ju(e);
  }, i = function(u2) {
    a(), n = u2, n.l == null && (n.l = n.length), o(t);
  };
  return { next: o, push: i, end: s, _bufs: e };
}
function aO(e) {
  return parseInt(vpt(e), 10) - 1;
}
function Ko(e) {
  return "" + (e + 1);
}
function vpt(e) {
  return e.replace(/\$(\d+)$/, "$1");
}
function iO(e) {
  for (var t = gpt(e), r = 0, n = 0; n !== t.length; ++n) r = 26 * r + t.charCodeAt(n) - 64;
  return r - 1;
}
function No(e) {
  if (e < 0) throw new Error("invalid column " + e);
  var t = "";
  for (++e; e; e = Math.floor((e - 1) / 26)) t = String.fromCharCode((e - 1) % 26 + 65) + t;
  return t;
}
function gpt(e) {
  return e.replace(/^\$([A-Z])/, "$1");
}
function Ts(e) {
  for (var t = 0, r = 0, n = 0; n < e.length; ++n) {
    var a = e.charCodeAt(n);
    a >= 48 && a <= 57 ? t = 10 * t + (a - 48) : a >= 65 && a <= 90 && (r = 26 * r + (a - 64));
  }
  return { c: r - 1, r: t - 1 };
}
function Eo(e) {
  for (var t = e.c + 1, r = ""; t; t = (t - 1) / 26 | 0) r = String.fromCharCode((t - 1) % 26 + 65) + r;
  return r + (e.r + 1);
}
function Oc(e) {
  var t = e.indexOf(":");
  return t == -1 ? { s: Ts(e), e: Ts(e) } : { s: Ts(e.slice(0, t)), e: Ts(e.slice(t + 1)) };
}
function ao(e, t) {
  return typeof t > "u" || typeof t == "number" ? ao(e.s, e.e) : (typeof e != "string" && (e = Eo(e)), typeof t != "string" && (t = Eo(t)), e == t ? e : e + ":" + t);
}
function ns(e) {
  var t = { s: { c: 0, r: 0 }, e: { c: 0, r: 0 } }, r = 0, n = 0, a = 0, o = e.length;
  for (r = 0; n < o && !((a = e.charCodeAt(n) - 64) < 1 || a > 26); ++n) r = 26 * r + a;
  for (t.s.c = --r, r = 0; n < o && !((a = e.charCodeAt(n) - 48) < 0 || a > 9); ++n) r = 10 * r + a;
  if (t.s.r = --r, n === o || a != 10) return t.e.c = t.s.c, t.e.r = t.s.r, t;
  for (++n, r = 0; n != o && !((a = e.charCodeAt(n) - 64) < 1 || a > 26); ++n) r = 26 * r + a;
  for (t.e.c = --r, r = 0; n != o && !((a = e.charCodeAt(n) - 48) < 0 || a > 9); ++n) r = 10 * r + a;
  return t.e.r = --r, t;
}
function Nre(e, t) {
  var r = e.t == "d" && t instanceof Date;
  if (e.z != null) try {
    return e.w = Xh(e.z, r ? ec(t) : t);
  } catch {
  }
  try {
    return e.w = Xh((e.XF || {}).numFmtId || (r ? 14 : 0), r ? ec(t) : t);
  } catch {
    return "" + t;
  }
}
function q0(e, t, r) {
  return e == null || e.t == null || e.t == "z" ? "" : e.w !== void 0 ? e.w : (e.t == "d" && !e.z && r && r.dateNF && (e.z = r.dateNF), e.t == "e" ? Y0[e.v] || e.v : t == null ? Nre(e, e.v) : Nre(e, t));
}
function lm(e, t) {
  var r = t && t.sheet ? t.sheet : "Sheet1", n = {};
  return n[r] = e, { SheetNames: [r], Sheets: n };
}
function Kne(e, t, r) {
  var n = r || {}, a = e ? e["!data"] != null : n.dense;
  Lu != null && a == null && (a = Lu);
  var o = e || {};
  a && !o["!data"] && (o["!data"] = []);
  var s = 0, i = 0;
  if (o && n.origin != null) {
    if (typeof n.origin == "number") s = n.origin;
    else {
      var l = typeof n.origin == "string" ? Ts(n.origin) : n.origin;
      s = l.r, i = l.c;
    }
    o["!ref"] || (o["!ref"] = "A1:A1");
  }
  var u2 = { s: { c: 1e7, r: 1e7 }, e: { c: 0, r: 0 } };
  if (o["!ref"]) {
    var c = ns(o["!ref"]);
    u2.s.c = c.s.c, u2.s.r = c.s.r, u2.e.c = Math.max(u2.e.c, c.e.c), u2.e.r = Math.max(u2.e.r, c.e.r), s == -1 && (u2.e.r = s = c.e.r + 1);
  }
  for (var f = [], h = 0; h != t.length; ++h) if (!!t[h]) {
    if (!Array.isArray(t[h])) throw new Error("aoa_to_sheet expects an array of arrays");
    var p = s + h, d = "" + (p + 1);
    a && (o["!data"][p] || (o["!data"][p] = []), f = o["!data"][p]);
    for (var v = 0; v != t[h].length; ++v) if (!(typeof t[h][v] > "u")) {
      var m = { v: t[h][v] }, g = i + v;
      if (u2.s.r > p && (u2.s.r = p), u2.s.c > g && (u2.s.c = g), u2.e.r < p && (u2.e.r = p), u2.e.c < g && (u2.e.c = g), t[h][v] && typeof t[h][v] == "object" && !Array.isArray(t[h][v]) && !(t[h][v] instanceof Date)) m = t[h][v];
      else if (Array.isArray(m.v) && (m.f = t[h][v][1], m.v = m.v[0]), m.v === null) if (m.f) m.t = "n";
      else if (n.nullError) m.t = "e", m.v = 0;
      else if (n.sheetStubs) m.t = "z";
      else continue;
      else typeof m.v == "number" ? m.t = "n" : typeof m.v == "boolean" ? m.t = "b" : m.v instanceof Date ? (m.z = n.dateNF || $i[14], n.cellDates ? (m.t = "d", m.w = Xh(m.z, ec(m.v, n.date1904))) : (m.t = "n", m.v = ec(m.v, n.date1904), m.w = Xh(m.z, m.v))) : m.t = "s";
      if (a) f[g] && f[g].z && (m.z = f[g].z), f[g] = m;
      else {
        var x = No(g) + d;
        o[x] && o[x].z && (m.z = o[x].z), o[x] = m;
      }
    }
  }
  return u2.s.c < 1e7 && (o["!ref"] = ao(u2)), o;
}
function Qx(e, t) {
  return Kne(null, e, t);
}
function Bpt(e) {
  return e.map(function(t) {
    return [t >> 16 & 255, t >> 8 & 255, t & 255];
  });
}
var Upt = Bpt([0, 16777215, 16711680, 65280, 255, 16776960, 16711935, 65535, 0, 16777215, 16711680, 65280, 255, 16776960, 16711935, 65535, 8388608, 32768, 128, 8421376, 8388736, 32896, 12632256, 8421504, 10066431, 10040166, 16777164, 13434879, 6684774, 16744576, 26316, 13421823, 128, 16711935, 16776960, 65535, 8388736, 8388608, 32896, 255, 52479, 13434879, 13434828, 16777113, 10079487, 16751052, 13408767, 16764057, 3368703, 3394764, 10079232, 16763904, 16750848, 16737792, 6710937, 9868950, 13158, 3381606, 13056, 3355392, 10040064, 10040166, 3355545, 3355443, 0, 16777215, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
var Qg = rl(Upt);
var Y0 = { 0: "#NULL!", 7: "#DIV/0!", 15: "#VALUE!", 23: "#REF!", 29: "#NAME?", 36: "#NUM!", 42: "#N/A", 43: "#GETTING_DATA", 255: "#WTF?" };
var fO = { "#NULL!": 0, "#DIV/0!": 7, "#VALUE!": 15, "#REF!": 23, "#NAME?": 29, "#NUM!": 36, "#N/A": 42, "#GETTING_DATA": 43, "#WTF?": 255 };
var Mp = [["cp:category", "Category"], ["cp:contentStatus", "ContentStatus"], ["cp:keywords", "Keywords"], ["cp:lastModifiedBy", "LastAuthor"], ["cp:lastPrinted", "LastPrinted"], ["cp:revision", "RevNumber"], ["cp:version", "Version"], ["dc:creator", "Author"], ["dc:description", "Comments"], ["dc:identifier", "Identifier"], ["dc:language", "Language"], ["dc:subject", "Subject"], ["dc:title", "Title"], ["dcterms:created", "CreatedDate", "date"], ["dcterms:modified", "ModifiedDate", "date"]];
var qpt = function() {
  for (var e = new Array(Mp.length), t = 0; t < Mp.length; ++t) {
    var r = Mp[t], n = "(?:" + r[0].slice(0, r[0].indexOf(":")) + ":)" + r[0].slice(r[0].indexOf(":") + 1);
    e[t] = new RegExp("<" + n + "[^>]*>([\\s\\S]*?)</" + n + ">");
  }
  return e;
}();
var z8 = function() {
  var e = { 1: 437, 2: 850, 3: 1252, 4: 1e4, 100: 852, 101: 866, 102: 865, 103: 861, 104: 895, 105: 620, 106: 737, 107: 857, 120: 950, 121: 949, 122: 936, 123: 932, 124: 874, 125: 1255, 126: 1256, 150: 10007, 151: 10029, 152: 10006, 200: 1250, 201: 1251, 202: 1254, 203: 1253, 0: 20127, 8: 865, 9: 437, 10: 850, 11: 437, 13: 437, 14: 850, 15: 437, 16: 850, 17: 437, 18: 850, 19: 932, 20: 850, 21: 437, 22: 850, 23: 865, 24: 437, 25: 437, 26: 850, 27: 437, 28: 863, 29: 850, 31: 852, 34: 852, 35: 852, 36: 860, 37: 850, 38: 866, 55: 850, 64: 852, 77: 936, 78: 949, 79: 950, 80: 874, 87: 1252, 88: 1252, 89: 1252, 108: 863, 134: 737, 135: 852, 136: 857, 204: 1257, 255: 16969 }, t = KS({ 1: 437, 2: 850, 3: 1252, 4: 1e4, 100: 852, 101: 866, 102: 865, 103: 861, 104: 895, 105: 620, 106: 737, 107: 857, 120: 950, 121: 949, 122: 936, 123: 932, 124: 874, 125: 1255, 126: 1256, 150: 10007, 151: 10029, 152: 10006, 200: 1250, 201: 1251, 202: 1254, 203: 1253, 0: 20127 });
  function r(i, l) {
    var u2 = [], c = am(1);
    switch (l.type) {
      case "base64":
        c = Hf(qh(i));
        break;
      case "binary":
        c = Hf(i);
        break;
      case "buffer":
      case "array":
        c = i;
        break;
    }
    gc(c, 0);
    var f = c.read_shift(1), h = !!(f & 136), p = false, d = false;
    switch (f) {
      case 2:
        break;
      case 3:
        break;
      case 48:
        p = true, h = true;
        break;
      case 49:
        p = true, h = true;
        break;
      case 131:
        break;
      case 139:
        break;
      case 140:
        d = true;
        break;
      case 245:
        break;
      default:
        throw new Error("DBF Unsupported Version: " + f.toString(16));
    }
    var v = 0, m = 521;
    f == 2 && (v = c.read_shift(2)), c.l += 3, f != 2 && (v = c.read_shift(4)), v > 1048576 && (v = 1e6), f != 2 && (m = c.read_shift(2));
    var g = c.read_shift(2), x = l.codepage || 1252;
    f != 2 && (c.l += 16, c.read_shift(1), c[c.l] !== 0 && (x = e[c[c.l]]), c.l += 1, c.l += 2), d && (c.l += 36);
    for (var b = [], y = {}, w = Math.min(c.length, f == 2 ? 521 : m - 10 - (p ? 264 : 0)), _4 = d ? 32 : 11; c.l < w && c[c.l] != 13; ) switch (y = {}, y.name = (typeof Io < "u" ? Io.utils.decode(x, c.slice(c.l, c.l + _4)) : o0(c.slice(c.l, c.l + _4))).replace(/[\u0000\r\n].*$/g, ""), c.l += _4, y.type = String.fromCharCode(c.read_shift(1)), f != 2 && !d && (y.offset = c.read_shift(4)), y.len = c.read_shift(1), f == 2 && (y.offset = c.read_shift(2)), y.dec = c.read_shift(1), y.name.length && b.push(y), f != 2 && (c.l += d ? 13 : 14), y.type) {
      case "B":
        (!p || y.len != 8) && l.WTF && console.log("Skipping " + y.name + ":" + y.type);
        break;
      case "G":
      case "P":
        l.WTF && console.log("Skipping " + y.name + ":" + y.type);
        break;
      case "+":
      case "0":
      case "@":
      case "C":
      case "D":
      case "F":
      case "I":
      case "L":
      case "M":
      case "N":
      case "O":
      case "T":
      case "Y":
        break;
      default:
        throw new Error("Unknown Field Type: " + y.type);
    }
    if (c[c.l] !== 13 && (c.l = m - 1), c.read_shift(1) !== 13) throw new Error("DBF Terminator not found " + c.l + " " + c[c.l]);
    c.l = m;
    var k = 0, T2 = 0;
    for (u2[0] = [], T2 = 0; T2 != b.length; ++T2) u2[0][T2] = b[T2].name;
    for (; v-- > 0; ) {
      if (c[c.l] === 42) {
        c.l += g;
        continue;
      }
      for (++c.l, u2[++k] = [], T2 = 0, T2 = 0; T2 != b.length; ++T2) {
        var A2 = c.slice(c.l, c.l + b[T2].len);
        c.l += b[T2].len, gc(A2, 0);
        var S2 = typeof Io < "u" ? Io.utils.decode(x, A2) : o0(A2);
        switch (b[T2].type) {
          case "C":
            S2.trim().length && (u2[k][T2] = S2.replace(/\s+$/, ""));
            break;
          case "D":
            S2.length === 8 ? u2[k][T2] = new Date(+S2.slice(0, 4), +S2.slice(4, 6) - 1, +S2.slice(6, 8)) : u2[k][T2] = S2;
            break;
          case "F":
            u2[k][T2] = parseFloat(S2.trim());
            break;
          case "+":
          case "I":
            u2[k][T2] = d ? A2.read_shift(-4, "i") ^ 2147483648 : A2.read_shift(4, "i");
            break;
          case "L":
            switch (S2.trim().toUpperCase()) {
              case "Y":
              case "T":
                u2[k][T2] = true;
                break;
              case "N":
              case "F":
                u2[k][T2] = false;
                break;
              case "":
              case "?":
                break;
              default:
                throw new Error("DBF Unrecognized L:|" + S2 + "|");
            }
            break;
          case "M":
            if (!h) throw new Error("DBF Unexpected MEMO for type " + f.toString(16));
            u2[k][T2] = "##MEMO##" + (d ? parseInt(S2.trim(), 10) : A2.read_shift(4));
            break;
          case "N":
            S2 = S2.replace(/\u0000/g, "").trim(), S2 && S2 != "." && (u2[k][T2] = +S2 || 0);
            break;
          case "@":
            u2[k][T2] = new Date(A2.read_shift(-8, "f") - 621356832e5);
            break;
          case "T":
            u2[k][T2] = new Date((A2.read_shift(4) - 2440588) * 864e5 + A2.read_shift(4));
            break;
          case "Y":
            u2[k][T2] = A2.read_shift(4, "i") / 1e4 + A2.read_shift(4, "i") / 1e4 * Math.pow(2, 32);
            break;
          case "O":
            u2[k][T2] = -A2.read_shift(-8, "f");
            break;
          case "B":
            if (p && b[T2].len == 8) {
              u2[k][T2] = A2.read_shift(8, "f");
              break;
            }
          case "G":
          case "P":
            A2.l += b[T2].len;
            break;
          case "0":
            if (b[T2].name === "_NullFlags") break;
          default:
            throw new Error("DBF Unsupported data type " + b[T2].type);
        }
      }
    }
    if (f != 2 && c.l < c.length && c[c.l++] != 26) throw new Error("DBF EOF Marker missing " + (c.l - 1) + " of " + c.length + " " + c[c.l - 1].toString(16));
    return l && l.sheetRows && (u2 = u2.slice(0, l.sheetRows)), l.DBF = b, u2;
  }
  function n(i, l) {
    var u2 = l || {};
    u2.dateNF || (u2.dateNF = "yyyymmdd");
    var c = Qx(r(i, u2), u2);
    return c["!cols"] = u2.DBF.map(function(f) {
      return { wch: f.len, DBF: f };
    }), delete u2.DBF, c;
  }
  function a(i, l) {
    try {
      var u2 = lm(n(i, l), l);
      return u2.bookType = "dbf", u2;
    } catch (c) {
      if (l && l.WTF) throw c;
    }
    return { SheetNames: [], Sheets: {} };
  }
  var o = { B: 8, C: 250, L: 1, D: 8, "?": 0, "": 0 };
  function s(i, l) {
    var u2 = l || {}, c = gf;
    if (+u2.codepage >= 0 && kd(+u2.codepage), u2.type == "string") throw new Error("Cannot write DBF to JS string");
    var f = yh(), h = $S(i, { header: 1, raw: true, cellDates: true }), p = h[0], d = h.slice(1), v = i["!cols"] || [], m = 0, g = 0, x = 0, b = 1;
    for (m = 0; m < p.length; ++m) {
      if (((v[m] || {}).DBF || {}).name) {
        p[m] = v[m].DBF.name, ++x;
        continue;
      }
      if (p[m] != null) {
        if (++x, typeof p[m] == "number" && (p[m] = p[m].toString(10)), typeof p[m] != "string") throw new Error("DBF Invalid column name " + p[m] + " |" + typeof p[m] + "|");
        if (p.indexOf(p[m]) !== m) {
          for (g = 0; g < 1024; ++g) if (p.indexOf(p[m] + "_" + g) == -1) {
            p[m] += "_" + g;
            break;
          }
        }
      }
    }
    var y = ns(i["!ref"]), w = [], _4 = [], k = [];
    for (m = 0; m <= y.e.c - y.s.c; ++m) {
      var T2 = "", A2 = "", S2 = 0, C2 = [];
      for (g = 0; g < d.length; ++g) d[g][m] != null && C2.push(d[g][m]);
      if (C2.length == 0 || p[m] == null) {
        w[m] = "?";
        continue;
      }
      for (g = 0; g < C2.length; ++g) {
        switch (typeof C2[g]) {
          case "number":
            A2 = "B";
            break;
          case "string":
            A2 = "C";
            break;
          case "boolean":
            A2 = "L";
            break;
          case "object":
            A2 = C2[g] instanceof Date ? "D" : "C";
            break;
          default:
            A2 = "C";
        }
        S2 = Math.max(S2, (typeof Io < "u" && typeof C2[g] == "string" ? Io.utils.encode(qx, C2[g]) : String(C2[g])).length), T2 = T2 && T2 != A2 ? "C" : A2;
      }
      S2 > 250 && (S2 = 250), A2 = ((v[m] || {}).DBF || {}).type, A2 == "C" && v[m].DBF.len > S2 && (S2 = v[m].DBF.len), T2 == "B" && A2 == "N" && (T2 = "N", k[m] = v[m].DBF.dec, S2 = v[m].DBF.len), _4[m] = T2 == "C" || A2 == "N" ? S2 : o[T2] || 0, b += _4[m], w[m] = T2;
    }
    var E2 = f.next(32);
    for (E2.write_shift(4, 318902576), E2.write_shift(4, d.length), E2.write_shift(2, 296 + 32 * x), E2.write_shift(2, b), m = 0; m < 4; ++m) E2.write_shift(4, 0);
    var F13 = +t[gf] || 3;
    for (E2.write_shift(4, 0 | F13 << 8), e[F13] != +u2.codepage && (u2.codepage && console.error("DBF Unsupported codepage " + gf + ", using 1252"), gf = 1252), m = 0, g = 0; m < p.length; ++m) if (p[m] != null) {
      var N2 = f.next(32), D2 = (p[m].slice(-10) + "\0\0\0\0\0\0\0\0\0\0\0").slice(0, 11);
      N2.write_shift(1, D2, "sbcs"), N2.write_shift(1, w[m] == "?" ? "C" : w[m], "sbcs"), N2.write_shift(4, g), N2.write_shift(1, _4[m] || o[w[m]] || 0), N2.write_shift(1, k[m] || 0), N2.write_shift(1, 2), N2.write_shift(4, 0), N2.write_shift(1, 0), N2.write_shift(4, 0), N2.write_shift(4, 0), g += _4[m] || o[w[m]] || 0;
    }
    var I2 = f.next(264);
    for (I2.write_shift(4, 13), m = 0; m < 65; ++m) I2.write_shift(4, 0);
    for (m = 0; m < d.length; ++m) {
      var O2 = f.next(b);
      for (O2.write_shift(1, 0), g = 0; g < p.length; ++g) if (p[g] != null) switch (w[g]) {
        case "L":
          O2.write_shift(1, d[m][g] == null ? 63 : d[m][g] ? 84 : 70);
          break;
        case "B":
          O2.write_shift(8, d[m][g] || 0, "f");
          break;
        case "N":
          var L2 = "0";
          for (typeof d[m][g] == "number" && (L2 = d[m][g].toFixed(k[g] || 0)), L2.length > _4[g] && (L2 = L2.slice(0, _4[g])), x = 0; x < _4[g] - L2.length; ++x) O2.write_shift(1, 32);
          O2.write_shift(1, L2, "sbcs");
          break;
        case "D":
          d[m][g] ? (O2.write_shift(4, ("0000" + d[m][g].getFullYear()).slice(-4), "sbcs"), O2.write_shift(2, ("00" + (d[m][g].getMonth() + 1)).slice(-2), "sbcs"), O2.write_shift(2, ("00" + d[m][g].getDate()).slice(-2), "sbcs")) : O2.write_shift(8, "00000000", "sbcs");
          break;
        case "C":
          var V2 = O2.l, W2 = String(d[m][g] != null ? d[m][g] : "").slice(0, _4[g]);
          for (O2.write_shift(1, W2, "cpstr"), V2 += _4[g] - O2.l, x = 0; x < V2; ++x) O2.write_shift(1, 32);
          break;
      }
    }
    return gf = c, f.next(1).write_shift(1, 26), f.end();
  }
  return { to_workbook: a, to_sheet: n, from_sheet: s };
}();
var Aae = function() {
  var e = { AA: "\xC0", BA: "\xC1", CA: "\xC2", DA: 195, HA: "\xC4", JA: 197, AE: "\xC8", BE: "\xC9", CE: "\xCA", HE: "\xCB", AI: "\xCC", BI: "\xCD", CI: "\xCE", HI: "\xCF", AO: "\xD2", BO: "\xD3", CO: "\xD4", DO: 213, HO: "\xD6", AU: "\xD9", BU: "\xDA", CU: "\xDB", HU: "\xDC", Aa: "\xE0", Ba: "\xE1", Ca: "\xE2", Da: 227, Ha: "\xE4", Ja: 229, Ae: "\xE8", Be: "\xE9", Ce: "\xEA", He: "\xEB", Ai: "\xEC", Bi: "\xED", Ci: "\xEE", Hi: "\xEF", Ao: "\xF2", Bo: "\xF3", Co: "\xF4", Do: 245, Ho: "\xF6", Au: "\xF9", Bu: "\xFA", Cu: "\xFB", Hu: "\xFC", KC: "\xC7", Kc: "\xE7", q: "\xE6", z: "\u0153", a: "\xC6", j: "\u0152", DN: 209, Dn: 241, Hy: 255, S: 169, c: 170, R: 174, "B ": 180, 0: 176, 1: 177, 2: 178, 3: 179, 5: 181, 6: 182, 7: 183, Q: 185, k: 186, b: 208, i: 216, l: 222, s: 240, y: 248, "!": 161, '"': 162, "#": 163, "(": 164, "%": 165, "'": 167, "H ": 168, "+": 171, ";": 187, "<": 188, "=": 189, ">": 190, "?": 191, "{": 223 }, t = new RegExp("\x1BN(" + Gl(e).join("|").replace(/\|\|\|/, "|\\||").replace(/([?()+])/g, "\\$1") + "|\\|)", "gm"), r = function(f, h) {
    var p = e[h];
    return typeof p == "number" ? ire(p) : p;
  }, n = function(f, h, p) {
    var d = h.charCodeAt(0) - 32 << 4 | p.charCodeAt(0) - 48;
    return d == 59 ? f : ire(d);
  };
  e["|"] = 254;
  function a(f, h) {
    switch (h.type) {
      case "base64":
        return o(qh(f), h);
      case "binary":
        return o(f, h);
      case "buffer":
        return o(wo && Buffer.isBuffer(f) ? f.toString("binary") : o0(f), h);
      case "array":
        return o(i1(f), h);
    }
    throw new Error("Unrecognized type " + h.type);
  }
  function o(f, h) {
    var p = f.split(/[\n\r]+/), d = -1, v = -1, m = 0, g = 0, x = [], b = [], y = null, w = {}, _4 = [], k = [], T2 = [], A2 = 0, S2, C2 = { Workbook: { WBProps: {}, Names: [] } };
    for (+h.codepage >= 0 && kd(+h.codepage); m !== p.length; ++m) {
      A2 = 0;
      var E2 = p[m].trim().replace(/\x1B([\x20-\x2F])([\x30-\x3F])/g, n).replace(t, r), F13 = E2.replace(/;;/g, "\0").split(";").map(function(H2) {
        return H2.replace(/\u0000/g, ";");
      }), N2 = F13[0], D2;
      if (E2.length > 0) switch (N2) {
        case "ID":
          break;
        case "E":
          break;
        case "B":
          break;
        case "O":
          for (g = 1; g < F13.length; ++g) switch (F13[g].charAt(0)) {
            case "V":
              {
                var I2 = parseInt(F13[g].slice(1), 10);
                I2 >= 1 && I2 <= 4 && (C2.Workbook.WBProps.date1904 = true);
              }
              break;
          }
          break;
        case "W":
          break;
        case "P":
          switch (F13[1].charAt(0)) {
            case "P":
              b.push(E2.slice(3).replace(/;;/g, ";"));
              break;
          }
          break;
        case "NN":
          {
            var O2 = { Sheet: 0 };
            for (g = 1; g < F13.length; ++g) switch (F13[g].charAt(0)) {
              case "N":
                O2.Name = F13[g].slice(1);
                break;
              case "E":
                O2.Ref = (h && h.sheet || "Sheet1") + "!" + r1(F13[g].slice(1));
                break;
            }
            C2.Workbook.Names.push(O2);
          }
          break;
        case "C":
          var L2 = false, V2 = false, W2 = false, X2 = false, Y2 = -1, K2 = -1, q = "", re = "z";
          for (g = 1; g < F13.length; ++g) switch (F13[g].charAt(0)) {
            case "A":
              break;
            case "X":
              v = parseInt(F13[g].slice(1), 10) - 1, V2 = true;
              break;
            case "Y":
              for (d = parseInt(F13[g].slice(1), 10) - 1, V2 || (v = 0), S2 = x.length; S2 <= d; ++S2) x[S2] = [];
              break;
            case "K":
              D2 = F13[g].slice(1), D2.charAt(0) === '"' ? (D2 = D2.slice(1, D2.length - 1), re = "s") : D2 === "TRUE" || D2 === "FALSE" ? (D2 = D2 === "TRUE", re = "b") : isNaN(Hh(D2)) ? isNaN(Xx(D2).getDate()) || (D2 = $l(D2), re = "d", h.cellDates || (re = "n", D2 = ec(D2, C2.Workbook.WBProps.date1904))) : (D2 = Hh(D2), re = "n", y !== null && f1(y) && h.cellDates && (D2 = ZS(C2.Workbook.WBProps.date1904 ? D2 + 1462 : D2), re = "d")), typeof Io < "u" && typeof D2 == "string" && (h || {}).type != "string" && (h || {}).codepage && (D2 = Io.utils.decode(h.codepage, D2)), L2 = true;
              break;
            case "E":
              X2 = true, q = r1(F13[g].slice(1), { r: d, c: v });
              break;
            case "S":
              W2 = true;
              break;
            case "G":
              break;
            case "R":
              Y2 = parseInt(F13[g].slice(1), 10) - 1;
              break;
            case "C":
              K2 = parseInt(F13[g].slice(1), 10) - 1;
              break;
            default:
              if (h && h.WTF) throw new Error("SYLK bad record " + E2);
          }
          if (L2 && (x[d][v] ? (x[d][v].t = re, x[d][v].v = D2) : x[d][v] = { t: re, v: D2 }, y && (x[d][v].z = y), h.cellText !== false && y && (x[d][v].w = Xh(x[d][v].z, x[d][v].v, { date1904: C2.Workbook.WBProps.date1904 })), y = null), W2) {
            if (X2) throw new Error("SYLK shared formula cannot have own formula");
            var R2 = Y2 > -1 && x[Y2][K2];
            if (!R2 || !R2[1]) throw new Error("SYLK shared formula cannot find base");
            q = Rae(R2[1], { r: d - Y2, c: v - K2 });
          }
          q && (x[d][v] ? x[d][v].f = q : x[d][v] = { t: "n", f: q });
          break;
        case "F":
          var z = 0;
          for (g = 1; g < F13.length; ++g) switch (F13[g].charAt(0)) {
            case "X":
              v = parseInt(F13[g].slice(1), 10) - 1, ++z;
              break;
            case "Y":
              for (d = parseInt(F13[g].slice(1), 10) - 1, S2 = x.length; S2 <= d; ++S2) x[S2] = [];
              break;
            case "M":
              A2 = parseInt(F13[g].slice(1), 10) / 20;
              break;
            case "F":
              break;
            case "G":
              break;
            case "P":
              y = b[parseInt(F13[g].slice(1), 10)];
              break;
            case "S":
              break;
            case "D":
              break;
            case "N":
              break;
            case "W":
              for (T2 = F13[g].slice(1).split(" "), S2 = parseInt(T2[0], 10); S2 <= parseInt(T2[1], 10); ++S2) A2 = parseInt(T2[2], 10), k[S2 - 1] = A2 === 0 ? { hidden: true } : { wch: A2 };
              break;
            case "C":
              v = parseInt(F13[g].slice(1), 10) - 1, k[v] || (k[v] = {});
              break;
            case "R":
              d = parseInt(F13[g].slice(1), 10) - 1, _4[d] || (_4[d] = {}), A2 > 0 ? (_4[d].hpt = A2, _4[d].hpx = Yx(A2)) : A2 === 0 && (_4[d].hidden = true);
              break;
            default:
              if (h && h.WTF) throw new Error("SYLK bad record " + E2);
          }
          z < 1 && (y = null);
          break;
        default:
          if (h && h.WTF) throw new Error("SYLK bad record " + E2);
      }
    }
    return _4.length > 0 && (w["!rows"] = _4), k.length > 0 && (w["!cols"] = k), k.forEach(function(H2) {
      im(H2);
    }), h && h.sheetRows && (x = x.slice(0, h.sheetRows)), [x, w, C2];
  }
  function s(f, h) {
    var p = a(f, h), d = p[0], v = p[1], m = p[2], g = rl(h);
    g.date1904 = (((m || {}).Workbook || {}).WBProps || {}).date1904;
    var x = Qx(d, g);
    Gl(v).forEach(function(y) {
      x[y] = v[y];
    });
    var b = lm(x, h);
    return Gl(m).forEach(function(y) {
      b[y] = m[y];
    }), b.bookType = "sylk", b;
  }
  function i(f, h, p, d) {
    var v = "C;Y" + (p + 1) + ";X" + (d + 1) + ";K";
    switch (f.t) {
      case "n":
        v += f.v || 0, f.f && !f.F && (v += ";E" + tE(f.f, { r: p, c: d }));
        break;
      case "b":
        v += f.v ? "TRUE" : "FALSE";
        break;
      case "e":
        v += f.w || f.v;
        break;
      case "d":
        v += '"' + (f.w || f.v) + '"';
        break;
      case "s":
        v += '"' + (f.v == null ? "" : String(f.v)).replace(/"/g, "").replace(/;/g, ";;") + '"';
        break;
    }
    return v;
  }
  function l(f, h) {
    h.forEach(function(p, d) {
      var v = "F;W" + (d + 1) + " " + (d + 1) + " ";
      p.hidden ? v += "0" : (typeof p.width == "number" && !p.wpx && (p.wpx = iw(p.width)), typeof p.wpx == "number" && !p.wch && (p.wch = ow(p.wpx)), typeof p.wch == "number" && (v += Math.round(p.wch))), v.charAt(v.length - 1) != " " && f.push(v);
    });
  }
  function u2(f, h) {
    h.forEach(function(p, d) {
      var v = "F;";
      p.hidden ? v += "M0;" : p.hpt ? v += "M" + 20 * p.hpt + ";" : p.hpx && (v += "M" + 20 * sw(p.hpx) + ";"), v.length > 2 && f.push(v + "R" + (d + 1));
    });
  }
  function c(f, h, p) {
    var d = ["ID;PSheetJS;N;E"], v = [], m = ns(f["!ref"]), g, x = f["!data"] != null, b = `\r
`, y = (((p || {}).Workbook || {}).WBProps || {}).date1904;
    d.push("P;PGeneral"), d.push("F;P0;DG0G8;M255"), f["!cols"] && l(d, f["!cols"]), f["!rows"] && u2(d, f["!rows"]), d.push("B;Y" + (m.e.r - m.s.r + 1) + ";X" + (m.e.c - m.s.c + 1) + ";D" + [m.s.c, m.s.r, m.e.c, m.e.r].join(" ")), d.push("O;L;D;B" + (y ? ";V4" : "") + ";K47;G100 0.001");
    for (var w = m.s.r; w <= m.e.r; ++w) if (!(x && !f["!data"][w])) {
      for (var _4 = [], k = m.s.c; k <= m.e.c; ++k) g = x ? f["!data"][w][k] : f[No(k) + Ko(w)], !(!g || g.v == null && (!g.f || g.F)) && _4.push(i(g, f, w, k, h));
      v.push(_4.join(b));
    }
    return d.join(b) + b + v.join(b) + b + "E" + b;
  }
  return { to_workbook: s, from_sheet: c };
}();
var Eae = function() {
  function e(f) {
    return f.replace(/\\b/g, "\\").replace(/\\c/g, ":").replace(/\\n/g, `
`);
  }
  function t(f) {
    return f.replace(/\\/g, "\\b").replace(/:/g, "\\c").replace(/\n/g, "\\n");
  }
  function r(f, h) {
    for (var p = f.split(`
`), d = -1, v = -1, m = 0, g = []; m !== p.length; ++m) {
      var x = p[m].trim().split(":");
      if (x[0] === "cell") {
        var b = Ts(x[1]);
        if (g.length <= b.r) for (d = g.length; d <= b.r; ++d) g[d] || (g[d] = []);
        switch (d = b.r, v = b.c, x[2]) {
          case "t":
            g[d][v] = e(x[3]);
            break;
          case "v":
            g[d][v] = +x[3];
            break;
          case "vtf":
            var y = x[x.length - 1];
          case "vtc":
            switch (x[3]) {
              case "nl":
                g[d][v] = !!+x[4];
                break;
              default:
                g[d][v] = +x[4];
                break;
            }
            x[2] == "vtf" && (g[d][v] = [g[d][v], y]);
        }
      }
    }
    return h && h.sheetRows && (g = g.slice(0, h.sheetRows)), g;
  }
  function n(f, h) {
    return Qx(r(f, h), h);
  }
  function a(f, h) {
    return lm(n(f, h), h);
  }
  var o = ["socialcalc:version:1.5", "MIME-Version: 1.0", "Content-Type: multipart/mixed; boundary=SocialCalcSpreadsheetControlSave"].join(`
`), s = ["--SocialCalcSpreadsheetControlSave", "Content-type: text/plain; charset=UTF-8"].join(`
`) + `
`, i = ["# SocialCalc Spreadsheet Control Save", "part:sheet"].join(`
`), l = "--SocialCalcSpreadsheetControlSave--";
  function u2(f) {
    if (!f || !f["!ref"]) return "";
    for (var h = [], p = [], d, v = "", m = Oc(f["!ref"]), g = f["!data"] != null, x = m.s.r; x <= m.e.r; ++x) for (var b = m.s.c; b <= m.e.c; ++b) if (v = Eo({ r: x, c: b }), d = g ? (f["!data"][x] || [])[b] : f[v], !(!d || d.v == null || d.t === "z")) {
      switch (p = ["cell", v, "t"], d.t) {
        case "s":
        case "str":
          p.push(t(d.v));
          break;
        case "n":
          d.f ? (p[2] = "vtf", p[3] = "n", p[4] = d.v, p[5] = t(d.f)) : (p[2] = "v", p[3] = d.v);
          break;
        case "b":
          p[2] = "vt" + (d.f ? "f" : "c"), p[3] = "nl", p[4] = d.v ? "1" : "0", p[5] = t(d.f || (d.v ? "TRUE" : "FALSE"));
          break;
        case "d":
          var y = ec($l(d.v));
          p[2] = "vtc", p[3] = "nd", p[4] = "" + y, p[5] = d.w || Xh(d.z || $i[14], y);
          break;
        case "e":
          continue;
      }
      h.push(p.join(":"));
    }
    return h.push("sheet:c:" + (m.e.c - m.s.c + 1) + ":r:" + (m.e.r - m.s.r + 1) + ":tvf:1"), h.push("valueformat:1:text-wiki"), h.join(`
`);
  }
  function c(f) {
    return [o, s, i, s, u2(f), l].join(`
`);
  }
  return { to_workbook: a, to_sheet: n, from_sheet: c };
}();
function Y0t(e) {
  var t = {}, r = e.match(wf), n = 0, a = false;
  if (r) for (; n != r.length; ++n) {
    var o = mi(r[n]);
    switch (o[0].replace(/\w*:/g, "")) {
      case "<condense":
        break;
      case "<extend":
        break;
      case "<shadow":
        if (!o.val) break;
      case "<shadow>":
      case "<shadow/>":
        t.shadow = 1;
        break;
      case "</shadow>":
        break;
      case "<charset":
        if (o.val == "1") break;
        t.cp = j8[parseInt(o.val, 10)];
        break;
      case "<outline":
        if (!o.val) break;
      case "<outline>":
      case "<outline/>":
        t.outline = 1;
        break;
      case "</outline>":
        break;
      case "<rFont":
        t.name = o.val;
        break;
      case "<sz":
        t.sz = o.val;
        break;
      case "<strike":
        if (!o.val) break;
      case "<strike>":
      case "<strike/>":
        t.strike = 1;
        break;
      case "</strike>":
        break;
      case "<u":
        if (!o.val) break;
        switch (o.val) {
          case "double":
            t.uval = "double";
            break;
          case "singleAccounting":
            t.uval = "single-accounting";
            break;
          case "doubleAccounting":
            t.uval = "double-accounting";
            break;
        }
      case "<u>":
      case "<u/>":
        t.u = 1;
        break;
      case "</u>":
        break;
      case "<b":
        if (o.val == "0") break;
      case "<b>":
      case "<b/>":
        t.b = 1;
        break;
      case "</b>":
        break;
      case "<i":
        if (o.val == "0") break;
      case "<i>":
      case "<i/>":
        t.i = 1;
        break;
      case "</i>":
        break;
      case "<color":
        o.rgb && (t.color = o.rgb.slice(2, 8));
        break;
      case "<color>":
      case "<color/>":
      case "</color>":
        break;
      case "<family":
        t.family = o.val;
        break;
      case "<family>":
      case "<family/>":
      case "</family>":
        break;
      case "<vertAlign":
        t.valign = o.val;
        break;
      case "<vertAlign>":
      case "<vertAlign/>":
      case "</vertAlign>":
        break;
      case "<scheme":
        break;
      case "<scheme>":
      case "<scheme/>":
      case "</scheme>":
        break;
      case "<extLst":
      case "<extLst>":
      case "</extLst>":
        break;
      case "<ext":
        a = true;
        break;
      case "</ext>":
        a = false;
        break;
      default:
        if (o[0].charCodeAt(1) !== 47 && !a) throw new Error("Unrecognized rich format " + o[0]);
    }
  }
  return t;
}
var Z0t = function() {
  var e = J_("t"), t = J_("rPr");
  function r(o) {
    var s = o.match(e);
    if (!s) return { t: "s", v: "" };
    var i = { t: "s", v: Ho(s[1]) }, l = o.match(t);
    return l && (i.s = Y0t(l[1])), i;
  }
  var n = /<(?:\w+:)?r>/g, a = /<\/(?:\w+:)?r>/;
  return function(s) {
    return s.replace(n, "").split(a).map(r).filter(function(i) {
      return i.v;
    });
  };
}();
var J0t = /* @__PURE__ */ function() {
  var t = /(\r\n|\n)/g;
  function r(a, o, s) {
    var i = [];
    a.u && i.push("text-decoration: underline;"), a.uval && i.push("text-underline-style:" + a.uval + ";"), a.sz && i.push("font-size:" + a.sz + "pt;"), a.outline && i.push("text-effect: outline;"), a.shadow && i.push("text-shadow: auto;"), o.push('<span style="' + i.join("") + '">'), a.b && (o.push("<b>"), s.push("</b>")), a.i && (o.push("<i>"), s.push("</i>")), a.strike && (o.push("<s>"), s.push("</s>"));
    var l = a.valign || "";
    return l == "superscript" || l == "super" ? l = "sup" : l == "subscript" && (l = "sub"), l != "" && (o.push("<" + l + ">"), s.push("</" + l + ">")), s.push("</span>"), a;
  }
  function n(a) {
    var o = [[], a.v, []];
    return a.v ? (a.s && r(a.s, o[0], o[2]), o[0].join("") + o[1].replace(t, "<br/>") + o[2].join("")) : "";
  }
  return function(o) {
    return o.map(n).join("");
  };
}();
var Q0t = /<(?:\w+:)?t[^>]*>([^<]*)<\/(?:\w+:)?t>/g;
var evt = /<(?:\w+:)?r\b[^>]*>/;
var tvt = /<(?:\w+:)?rPh.*?>([\s\S]*?)<\/(?:\w+:)?rPh>/g;
function mO(e, t) {
  var r = t ? t.cellHTML : true, n = {};
  return e ? (e.match(/^\s*<(?:\w+:)?t[^>]*>/) ? (n.t = Ho(Us(e.slice(e.indexOf(">") + 1).split(/<\/(?:\w+:)?t>/)[0] || ""), true), n.r = Us(e), r && (n.h = zS(n.t))) : e.match(evt) && (n.r = Us(e), n.t = Ho(Us((e.replace(tvt, "").match(Q0t) || []).join("").replace(wf, "")), true), r && (n.h = J0t(Z0t(n.r)))), n) : { t: "" };
}
function Fvt(e) {
  var t = e.slice(e[0] === "#" ? 1 : 0).slice(0, 6);
  return [parseInt(t.slice(0, 2), 16), parseInt(t.slice(2, 4), 16), parseInt(t.slice(4, 6), 16)];
}
function aw(e) {
  for (var t = 0, r = 1; t != 3; ++t) r = r * 256 + (e[t] > 255 ? 255 : e[t] < 0 ? 0 : e[t]);
  return r.toString(16).toUpperCase().slice(1);
}
function Ovt(e) {
  var t = e[0] / 255, r = e[1] / 255, n = e[2] / 255, a = Math.max(t, r, n), o = Math.min(t, r, n), s = a - o;
  if (s === 0) return [0, 0, t];
  var i = 0, l = 0, u2 = a + o;
  switch (l = s / (u2 > 1 ? 2 - u2 : u2), a) {
    case t:
      i = ((r - n) / s + 6) % 6;
      break;
    case r:
      i = (n - t) / s + 2;
      break;
    case n:
      i = (t - r) / s + 4;
      break;
  }
  return [i / 6, l, u2 / 2];
}
function Pvt(e) {
  var t = e[0], r = e[1], n = e[2], a = r * 2 * (n < 0.5 ? n : 1 - n), o = n - a / 2, s = [o, o, o], i = 6 * t, l;
  if (r !== 0) switch (i | 0) {
    case 0:
    case 6:
      l = a * i, s[0] += a, s[1] += l;
      break;
    case 1:
      l = a * (2 - i), s[0] += l, s[1] += a;
      break;
    case 2:
      l = a * (i - 2), s[1] += a, s[2] += l;
      break;
    case 3:
      l = a * (4 - i), s[1] += l, s[2] += a;
      break;
    case 4:
      l = a * (i - 4), s[2] += a, s[0] += l;
      break;
    case 5:
      l = a * (6 - i), s[2] += l, s[0] += a;
      break;
  }
  for (var u2 = 0; u2 != 3; ++u2) s[u2] = Math.round(s[u2] * 255);
  return s;
}
function WS(e, t) {
  if (t === 0) return e;
  var r = Ovt(Fvt(e));
  return t < 0 ? r[2] = r[2] * (1 + t) : r[2] = 1 - (1 - r[2]) * (1 - t), aw(Pvt(r));
}
var Nae = 6;
var mf = Nae;
function iw(e) {
  return Math.floor((e + Math.round(128 / mf) / 256) * mf);
}
function ow(e) {
  return Math.floor((e - 5) / mf * 100 + 0.5) / 100;
}
function GS(e) {
  return Math.round((e * mf + 5) / mf * 256) / 256;
}
function im(e) {
  e.width ? (e.wpx = iw(e.width), e.wch = ow(e.wpx), e.MDW = mf) : e.wpx ? (e.wch = ow(e.wpx), e.width = GS(e.wch), e.MDW = mf) : typeof e.wch == "number" && (e.width = GS(e.wch), e.wpx = iw(e.width), e.MDW = mf), e.customWidth && delete e.customWidth;
}
var zvt = 96;
var Fae = zvt;
function sw(e) {
  return e * 96 / Fae;
}
function Yx(e) {
  return e * Fae / 96;
}
var r1 = /* @__PURE__ */ function() {
  var e = /(^|[^A-Za-z_])R(\[?-?\d+\]|[1-9]\d*|)C(\[?-?\d+\]|[1-9]\d*|)(?![A-Za-z0-9_])/g, t = { r: 0, c: 0 };
  function r(n, a, o, s) {
    var i = false, l = false;
    o.length == 0 ? l = true : o.charAt(0) == "[" && (l = true, o = o.slice(1, -1)), s.length == 0 ? i = true : s.charAt(0) == "[" && (i = true, s = s.slice(1, -1));
    var u2 = o.length > 0 ? parseInt(o, 10) | 0 : 0, c = s.length > 0 ? parseInt(s, 10) | 0 : 0;
    return i ? c += t.c : --c, l ? u2 += t.r : --u2, a + (i ? "" : "$") + No(c) + (l ? "" : "$") + Ko(u2);
  }
  return function(a, o) {
    return t = o, a.replace(e, r);
  };
}();
var bO = /(^|[^._A-Z0-9])([$]?)([A-Z]{1,2}|[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D])([$]?)(10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5})(?![_.\(A-Za-z0-9])/g;
var tE = /* @__PURE__ */ function() {
  return function(t, r) {
    return t.replace(bO, function(n, a, o, s, i, l) {
      var u2 = iO(s) - (o ? 0 : r.c), c = aO(l) - (i ? 0 : r.r), f = i == "$" ? c + 1 : c == 0 ? "" : "[" + c + "]", h = o == "$" ? u2 + 1 : u2 == 0 ? "" : "[" + u2 + "]";
      return a + "R" + f + "C" + h;
    });
  };
}();
function Rae(e, t) {
  return e.replace(bO, function(r, n, a, o, s, i) {
    return n + (a == "$" ? a + o : No(iO(o) + t.c)) + (s == "$" ? s + i : Ko(aO(i) + t.r));
  });
}
function ggt(e, t, r) {
  var n = Oc(t), a = n.s, o = Ts(r), s = { r: o.r - a.r, c: o.c - a.c };
  return Rae(e, s);
}
function ene(e) {
  return e.replace(/_xlfn\./g, "");
}
var W_ = {};
var Hx = {};
function Hae(e, t, r, n, a, o) {
  try {
    n.cellNF && (e.z = $i[t]);
  } catch (i) {
    if (n.WTF) throw i;
  }
  if (!(e.t === "z" && !n.cellStyles)) {
    if (e.t === "d" && typeof e.v == "string" && (e.v = $l(e.v)), (!n || n.cellText !== false) && e.t !== "z") try {
      if ($i[t] == null && nm(Fht[t] || "General", t), e.t === "e") e.w = e.w || Y0[e.v];
      else if (t === 0) if (e.t === "n") (e.v | 0) === e.v ? e.w = e.v.toString(10) : e.w = Z_(e.v);
      else if (e.t === "d") {
        var s = ec(e.v);
        (s | 0) === s ? e.w = s.toString(10) : e.w = Z_(s);
      } else {
        if (e.v === void 0) return "";
        e.w = a1(e.v, Hx);
      }
      else e.t === "d" ? e.w = Xh(t, ec(e.v), Hx) : e.w = Xh(t, e.v, Hx);
    } catch (i) {
      if (n.WTF) throw i;
    }
    if (!!n.cellStyles && r != null) try {
      e.s = o.Fills[r], e.s.fgColor && e.s.fgColor.theme && !e.s.fgColor.rgb && (e.s.fgColor.rgb = WS(a.themeElements.clrScheme[e.s.fgColor.theme].rgb, e.s.fgColor.tint || 0), n.WTF && (e.s.fgColor.raw_rgb = a.themeElements.clrScheme[e.s.fgColor.theme].rgb)), e.s.bgColor && e.s.bgColor.theme && (e.s.bgColor.rgb = WS(a.themeElements.clrScheme[e.s.bgColor.theme].rgb, e.s.bgColor.tint || 0), n.WTF && (e.s.bgColor.raw_rgb = a.themeElements.clrScheme[e.s.bgColor.theme].rgb));
    } catch (i) {
      if (n.WTF && o.Fills) throw i;
    }
  }
}
var Iyt = function() {
  var e = /<(?:\w+:)?c[ \/>]/, t = /<\/(?:\w+:)?row>/, r = /r=["']([^"']*)["']/, n = /<(?:\w+:)?is>([\S\s]*?)<\/(?:\w+:)?is>/, a = /ref=["']([^"']*)["']/, o = J_("v"), s = J_("f");
  return function(l, u2, c, f, h, p) {
    for (var d = 0, v = "", m = [], g = [], x = 0, b = 0, y = 0, w = "", _4, k, T2 = 0, A2 = 0, S2, C2, E2 = 0, F13 = 0, N2 = Array.isArray(p.CellXf), D2, I2 = [], O2 = [], L2 = u2["!data"] != null, V2 = [], W2 = {}, X2 = false, Y2 = !!c.sheetStubs, K2 = l.split(t), q = 0, re = K2.length; q != re; ++q) {
      v = K2[q].trim();
      var R2 = v.length;
      if (R2 === 0) continue;
      var z = 0;
      e: for (d = 0; d < R2; ++d) switch (v[d]) {
        case ">":
          if (v[d - 1] != "/") {
            ++d;
            break e;
          }
          if (c && c.cellStyles) {
            if (k = mi(v.slice(z, d), true), T2 = k.r != null ? parseInt(k.r, 10) : T2 + 1, A2 = -1, c.sheetRows && c.sheetRows < T2) continue;
            W2 = {}, X2 = false, k.ht && (X2 = true, W2.hpt = parseFloat(k.ht), W2.hpx = Yx(W2.hpt)), k.hidden && Bs(k.hidden) && (X2 = true, W2.hidden = true), k.outlineLevel != null && (X2 = true, W2.level = +k.outlineLevel), X2 && (V2[T2 - 1] = W2);
          }
          break;
        case "<":
          z = d;
          break;
      }
      if (z >= d) break;
      if (k = mi(v.slice(z, d), true), T2 = k.r != null ? parseInt(k.r, 10) : T2 + 1, A2 = -1, !(c.sheetRows && c.sheetRows < T2)) {
        c.nodim || (f.s.r > T2 - 1 && (f.s.r = T2 - 1), f.e.r < T2 - 1 && (f.e.r = T2 - 1)), c && c.cellStyles && (W2 = {}, X2 = false, k.ht && (X2 = true, W2.hpt = parseFloat(k.ht), W2.hpx = Yx(W2.hpt)), k.hidden && Bs(k.hidden) && (X2 = true, W2.hidden = true), k.outlineLevel != null && (X2 = true, W2.level = +k.outlineLevel), X2 && (V2[T2 - 1] = W2)), m = v.slice(d).split(e);
        for (var H2 = 0; H2 != m.length && m[H2].trim().charAt(0) == "<"; ++H2) ;
        for (m = m.slice(H2), d = 0; d != m.length; ++d) if (v = m[d].trim(), v.length !== 0) {
          if (g = v.match(r), x = d, b = 0, y = 0, v = "<c " + (v.slice(0, 1) == "<" ? ">" : "") + v, g != null && g.length === 2) {
            for (x = 0, w = g[1], b = 0; b != w.length && !((y = w.charCodeAt(b) - 64) < 1 || y > 26); ++b) x = 26 * x + y;
            --x, A2 = x;
          } else ++A2;
          for (b = 0; b != v.length && v.charCodeAt(b) !== 62; ++b) ;
          if (++b, k = mi(v.slice(0, b), true), k.r || (k.r = Eo({ r: T2 - 1, c: A2 })), w = v.slice(b), _4 = { t: "" }, (g = w.match(o)) != null && g[1] !== "" && (_4.v = Ho(g[1])), c.cellFormula) {
            if ((g = w.match(s)) != null && g[1] !== "") {
              if (_4.f = Ho(Us(g[1]), true), c.xlfn || (_4.f = ene(_4.f)), g[0].indexOf('t="array"') > -1) _4.F = (w.match(a) || [])[1], _4.F.indexOf(":") > -1 && I2.push([ns(_4.F), _4.F]);
              else if (g[0].indexOf('t="shared"') > -1) {
                C2 = mi(g[0]);
                var te = Ho(Us(g[1]));
                c.xlfn || (te = ene(te)), O2[parseInt(C2.si, 10)] = [C2, te, k.r];
              }
            } else (g = w.match(/<f[^>]*\/>/)) && (C2 = mi(g[0]), O2[C2.si] && (_4.f = ggt(O2[C2.si][1], O2[C2.si][2], k.r)));
            var j = Ts(k.r);
            for (b = 0; b < I2.length; ++b) j.r >= I2[b][0].s.r && j.r <= I2[b][0].e.r && j.c >= I2[b][0].s.c && j.c <= I2[b][0].e.c && (_4.F = I2[b][1]);
          }
          if (k.t == null && _4.v === void 0) if (_4.f || _4.F) _4.v = 0, _4.t = "n";
          else if (Y2) _4.t = "z";
          else continue;
          else _4.t = k.t || "n";
          switch (f.s.c > A2 && (f.s.c = A2), f.e.c < A2 && (f.e.c = A2), _4.t) {
            case "n":
              if (_4.v == "" || _4.v == null) {
                if (!Y2) continue;
                _4.t = "z";
              } else _4.v = parseFloat(_4.v);
              break;
            case "s":
              if (typeof _4.v > "u") {
                if (!Y2) continue;
                _4.t = "z";
              } else S2 = W_[parseInt(_4.v, 10)], _4.v = S2.t, _4.r = S2.r, c.cellHTML && (_4.h = S2.h);
              break;
            case "str":
              _4.t = "s", _4.v = _4.v != null ? Ho(Us(_4.v), true) : "", c.cellHTML && (_4.h = zS(_4.v));
              break;
            case "inlineStr":
              g = w.match(n), _4.t = "s", g != null && (S2 = mO(g[1])) ? (_4.v = S2.t, c.cellHTML && (_4.h = S2.h)) : _4.v = "";
              break;
            case "b":
              _4.v = Bs(_4.v);
              break;
            case "d":
              c.cellDates ? _4.v = $l(_4.v, 1) : (_4.v = ec($l(_4.v, 1)), _4.t = "n");
              break;
            case "e":
              (!c || c.cellText !== false) && (_4.w = _4.v), _4.v = fO[_4.v];
              break;
          }
          if (E2 = F13 = 0, D2 = null, N2 && k.s !== void 0 && (D2 = p.CellXf[k.s], D2 != null && (D2.numFmtId != null && (E2 = D2.numFmtId), c.cellStyles && D2.fillId != null && (F13 = D2.fillId))), Hae(_4, E2, F13, c, h, p), c.cellDates && N2 && _4.t == "n" && f1($i[E2]) && (_4.t = "d", _4.v = ZS(_4.v)), k.cm && c.xlmeta) {
            var Q2 = (c.xlmeta.Cell || [])[+k.cm - 1];
            Q2 && Q2.type == "XLDAPR" && (_4.D = true);
          }
          var Z2;
          c.nodim && (Z2 = Ts(k.r), f.s.r > Z2.r && (f.s.r = Z2.r), f.e.r < Z2.r && (f.e.r = Z2.r)), L2 ? (Z2 = Ts(k.r), u2["!data"][Z2.r] || (u2["!data"][Z2.r] = []), u2["!data"][Z2.r][Z2.c] = _4) : u2[k.r] = _4;
        }
      }
    }
    V2.length > 0 && (u2["!rows"] = V2);
  };
}();
var abt = ":][*?/\\".split("");
var O2t = function() {
  var e = ["<office:master-styles>", '<style:master-page style:name="mp1" style:page-layout-name="mp1">', "<style:header/>", '<style:header-left style:display="false"/>', "<style:footer/>", '<style:footer-left style:display="false"/>', "</style:master-page>", "</office:master-styles>"].join(""), t = "<office:document-styles " + Q_({ "xmlns:office": "urn:oasis:names:tc:opendocument:xmlns:office:1.0", "xmlns:table": "urn:oasis:names:tc:opendocument:xmlns:table:1.0", "xmlns:style": "urn:oasis:names:tc:opendocument:xmlns:style:1.0", "xmlns:text": "urn:oasis:names:tc:opendocument:xmlns:text:1.0", "xmlns:draw": "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0", "xmlns:fo": "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0", "xmlns:xlink": "http://www.w3.org/1999/xlink", "xmlns:dc": "http://purl.org/dc/elements/1.1/", "xmlns:number": "urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0", "xmlns:svg": "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0", "xmlns:of": "urn:oasis:names:tc:opendocument:xmlns:of:1.2", "office:version": "1.2" }) + ">" + e + "</office:document-styles>";
  return function() {
    return Ru + t;
  };
}();
var Qu = function() {
  try {
    return typeof Uint8Array > "u" || typeof Uint8Array.prototype.subarray > "u" ? "slice" : typeof Buffer < "u" ? typeof Buffer.prototype.subarray > "u" ? "slice" : (typeof Buffer.from == "function" ? Buffer.from([72, 62]) : new Buffer([72, 62])) instanceof Uint8Array ? "subarray" : "slice" : "subarray";
  } catch {
    return "slice";
  }
}();
function x_t(e, t, r, n, a, o, s) {
  var i = Ko(r), l = s.defval, u2 = s.raw || !Object.prototype.hasOwnProperty.call(s, "raw"), c = true, f = e["!data"] != null, h = a === 1 ? [] : {};
  if (a !== 1) if (Object.defineProperty) try {
    Object.defineProperty(h, "__rowNum__", { value: r, enumerable: false });
  } catch {
    h.__rowNum__ = r;
  }
  else h.__rowNum__ = r;
  if (!f || e["!data"][r]) for (var p = t.s.c; p <= t.e.c; ++p) {
    var d = f ? (e["!data"][r] || [])[p] : e[n[p] + i];
    if (d === void 0 || d.t === void 0) {
      if (l === void 0) continue;
      o[p] != null && (h[o[p]] = l);
      continue;
    }
    var v = d.v;
    switch (d.t) {
      case "z":
        if (v == null) break;
        continue;
      case "e":
        v = v == 0 ? null : void 0;
        break;
      case "s":
      case "d":
      case "b":
      case "n":
        break;
      default:
        throw new Error("unrecognized type " + d.t);
    }
    if (o[p] != null) {
      if (v == null) if (d.t == "e" && v === null) h[o[p]] = null;
      else if (l !== void 0) h[o[p]] = l;
      else if (u2 && v === null) h[o[p]] = null;
      else continue;
      else h[o[p]] = u2 && (d.t !== "n" || d.t === "n" && s.rawNumbers !== false) ? v : q0(d, v, s);
      v != null && (c = false);
    }
  }
  return { row: h, isempty: c };
}
function $S(e, t) {
  if (e == null || e["!ref"] == null) return [];
  var r = { t: "n", v: 0 }, n = 0, a = 1, o = [], s = 0, i = "", l = { s: { r: 0, c: 0 }, e: { r: 0, c: 0 } }, u2 = t || {}, c = u2.range != null ? u2.range : e["!ref"];
  switch (u2.header === 1 ? n = 1 : u2.header === "A" ? n = 2 : Array.isArray(u2.header) ? n = 3 : u2.header == null && (n = 0), typeof c) {
    case "string":
      l = ns(c);
      break;
    case "number":
      l = ns(e["!ref"]), l.s.r = c;
      break;
    default:
      l = c;
  }
  n > 0 && (a = 0);
  var f = Ko(l.s.r), h = [], p = [], d = 0, v = 0, m = e["!data"] != null, g = l.s.r, x = 0, b = {};
  m && !e["!data"][g] && (e["!data"][g] = []);
  var y = u2.skipHidden && e["!cols"] || [], w = u2.skipHidden && e["!rows"] || [];
  for (x = l.s.c; x <= l.e.c; ++x) if (!(y[x] || {}).hidden) switch (h[x] = No(x), r = m ? e["!data"][g][x] : e[h[x] + f], n) {
    case 1:
      o[x] = x - l.s.c;
      break;
    case 2:
      o[x] = h[x];
      break;
    case 3:
      o[x] = u2.header[x - l.s.c];
      break;
    default:
      if (r == null && (r = { w: "__EMPTY", t: "s" }), i = s = q0(r, null, u2), v = b[s] || 0, !v) b[s] = 1;
      else {
        do
          i = s + "_" + v++;
        while (b[i]);
        b[s] = v, b[i] = 1;
      }
      o[x] = i;
  }
  for (g = l.s.r + a; g <= l.e.r; ++g) if (!(w[g] || {}).hidden) {
    var _4 = x_t(e, l, g, h, n, o, u2);
    (_4.isempty === false || (n === 1 ? u2.blankrows !== false : !!u2.blankrows)) && (p[d++] = _4.row);
  }
  return p.length = d, p;
}
var yFt = K_.version;
var oE = class extends Na {
  constructor(t, r = {}) {
    super(t, r);
  }
};

// src/app/csv-parser.service.ts
var CsvParserService = class _CsvParserService {
  /**
   * Parses a CSV string from pose estimation into a 3D array (ndarray-like structure)
   * using the PapaParse library.
   * The output shape is (number of frames, number of bodyparts, 2 for x/y coordinates).
   *
   * @param csvString The CSV data as a string.
   * @returns A 3D array of numbers: number[][][].
   * Returns an empty array if the CSV is malformed, has no data, or PapaParse fails.
   */
  getBodyParts(csvString) {
    const parseOutput = import_papaparse.default.parse(
      // parse the header only, for speed.
      csvString.trim().split("\n").slice(0, 4).join("\n"),
      {
        dynamicTyping: false,
        skipEmptyLines: true
      }
    );
    if (parseOutput.errors.length > 0) {
      console.error("PapaParse errors:", parseOutput.errors);
      return [];
    }
    const allRows = parseOutput.data;
    if (allRows.length < 3) {
      console.error("CSV must have at least 3 header lines.");
      return [];
    }
    return [...new Set(allRows[1].slice(1))];
  }
  parsePredictionFile(csvString) {
    const parseOutput = import_papaparse.default.parse(csvString.trim(), {
      dynamicTyping: false,
      skipEmptyLines: true
    });
    if (parseOutput.errors.length > 0) {
      console.error("PapaParse errors:", parseOutput.errors);
      new oE();
    }
    const allRows = parseOutput.data;
    if (allRows.length < 4) {
      console.error("CSV must have at least 3 header lines and 1 data line.");
      new oE();
    }
    const dataRowsOnly = allRows.slice(3);
    const data = {};
    const index = Array(dataRowsOnly.length);
    for (let i = 1; i < allRows[0].length; i++) {
      const flatColumn = new Pair(allRows[1][i], allRows[2][i]);
      data[flatColumn.toMapKey()] = new Array(dataRowsOnly.length).fill(NaN);
    }
    dataRowsOnly.forEach((row, rowIndex) => {
      index[rowIndex] = row[0];
      for (let i = 1; i < allRows[0].length; i++) {
        const flatColumn = new Pair(allRows[1][i], allRows[2][i]);
        const cellValue = row[i];
        const value = cellValue !== void 0 ? parseFloat(cellValue) : NaN;
        data[flatColumn.toMapKey()][rowIndex] = value;
      }
    });
    return new oE(data, { index });
  }
  static \u0275fac = function CsvParserService_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _CsvParserService)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _CsvParserService, factory: _CsvParserService.\u0275fac, providedIn: "root" });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CsvParserService, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], null, null);
})();

// src/app/utils/comparators.ts
var compareStringArraysOrdered = (prev, curr) => {
  if (prev.length !== curr.length) {
    return false;
  }
  for (let i = 0; i < prev.length; i++) {
    if (prev[i] !== curr[i]) {
      return false;
    }
  }
  return true;
};
var createSessionViewComparator = (allViewsOrder) => {
  return (a, b) => {
    const indexA = allViewsOrder.indexOf(a.viewName);
    const indexB = allViewsOrder.indexOf(b.viewName);
    if (indexA === -1 && indexB === -1)
      return 0;
    if (indexA === -1)
      return 1;
    if (indexB === -1)
      return -1;
    return indexA - indexB;
  };
};
var orderStringsByUserSpecifiedOrder = (userOrder) => {
  return (a, b) => {
    const indexA = userOrder.indexOf(a);
    const indexB = userOrder.indexOf(b);
    const aRank = indexA === -1 ? Infinity : indexA;
    const bRank = indexB === -1 ? Infinity : indexB;
    return aRank - bRank;
  };
};

// src/app/labeler/frame.model.ts
var import_lodash = __toESM(require_lodash());
var FVUtils = class {
  frameView;
  constructor(frameView) {
    this.frameView = frameView;
  }
  get isFromUnlabeledSet() {
    return this.frameView.originalKeypoints === null;
  }
  get hasChanges() {
    return !import_lodash.default.isEqual(this.frameView.keypoints, this.frameView.originalKeypoints);
  }
  get changedKeypoints() {
    return this.frameView.keypoints.filter((kp2) => {
      const okp = this.frameView.originalKeypoints?.find((okp2) => okp2.keypointName === kp2.keypointName) ?? null;
      return okp === null || !import_lodash.default.isEqual(okp, kp2);
    });
  }
};
function fv(frameView) {
  return new FVUtils(frameView);
}
var MVFUtils = class {
  mvFrame;
  constructor(mvFrame) {
    this.mvFrame = mvFrame;
  }
  get isFromUnlabeledSet() {
    if (!this.mvFrame.views.length) {
      throw new Error("No views available in MVFrame");
    }
    return fv(this.mvFrame.views[0]).isFromUnlabeledSet;
  }
  get hasChanges() {
    if (!this.mvFrame.views.length) {
      throw new Error("No views available in MVFrame");
    }
    return this.mvFrame.views.some((view) => fv(view).hasChanges);
  }
  /** Returns the version that would result on save:
   * original keypoints and keypoints match (hasChanges => false).
   */
  toSavedMvf() {
    return __spreadProps(__spreadValues({}, this.mvFrame), {
      views: this.mvFrame.views.map((frameView) => {
        return __spreadProps(__spreadValues({}, frameView), { originalKeypoints: frameView.keypoints });
      })
    });
  }
  /** Autolabel session key is modified from the normal session key.
   * Regular session key has * in place of view. Autolabel session key
   * has * part removed because it's not valid in filesystem.
   */
  get autolabelSessionKey() {
    const pathParts = this.mvFrame.key.split("/");
    if (pathParts.length < 3)
      return null;
    const sessionKeyWithStar = pathParts.at(-2);
    if (sessionKeyWithStar.indexOf("*") === -1)
      return null;
    const processPart = (part) => {
      if (part.indexOf("*") === -1)
        return part;
      const partsHyphenSplit = part.split("-");
      const partsUnderscoreSplit = part.split("_");
      if (partsHyphenSplit.indexOf("*") !== -1) {
        return partsHyphenSplit.filter((p) => p !== "*").join("-");
      } else if (partsUnderscoreSplit.indexOf("*") !== -1) {
        return partsUnderscoreSplit.filter((p) => p !== "*").join("_");
      } else {
        return null;
      }
    };
    const processedParts = sessionKeyWithStar.split(".").map(processPart);
    if (processedParts.indexOf(null) !== -1)
      return null;
    return processedParts.filter(Boolean).join(".");
  }
};
function mvf(mvFrame) {
  return new MVFUtils(mvFrame);
}

// src/app/session.service.ts
var import_lodash2 = __toESM(require_lodash());
var SessionService = class _SessionService {
  rpc = inject2(RpcService);
  httpClient = inject2(HttpClient);
  predictionFiles = [];
  projectInfoService = inject2(ProjectInfoService);
  csvParser = inject2(CsvParserService);
  sessionsLoading = signal(true, ...ngDevMode ? [{ debugName: "sessionsLoading" }] : []);
  _allSessions = new BehaviorSubject([]);
  allSessions$ = this._allSessions.asObservable();
  allSessions = toSignal(this.allSessions$, { requireSync: true });
  sessionModelMap = {};
  async loadSessions() {
    if (this.allSessions().length > 1)
      return;
    try {
      this.sessionsLoading.set(true);
      const sessions = await this._loadSessions();
      this.sessionsLoading.set(false);
      this._allSessions.next(sessions);
    } catch {
      this.sessionsLoading.set(false);
    }
  }
  async _loadSessions() {
    const projectInfo = this.projectInfoService.projectInfo;
    const response = await this.rpc.call("rglob", {
      baseDir: projectInfo.data_dir,
      pattern: "**/*.mp4",
      noDirs: true
    });
    const mp4Files = response.entries.map((entry) => entry.path);
    const sessions = this.groupFilesBySession(mp4Files, this.projectInfoService.projectInfo.views);
    return sessions;
  }
  labelFilesLoading = signal(false, ...ngDevMode ? [{ debugName: "labelFilesLoading" }] : []);
  _allLabelFiles = new BehaviorSubject([]);
  allLabelFiles$ = this._allLabelFiles.asObservable();
  allLabelFiles = toSignal(this.allLabelFiles$, { requireSync: true });
  async loadLabelFiles() {
    try {
      this.labelFilesLoading.set(true);
      await this._loadLabelFiles();
    } finally {
      this.labelFilesLoading.set(false);
    }
  }
  async _loadLabelFiles() {
    const response = await this.rpc.call("findLabelFiles");
    const csvFiles = response.labelFiles;
    const cmp = createSessionViewComparator(this.projectInfoService.allViews());
    const files = Array.from(this.groupFilesByView(csvFiles, this.projectInfoService.projectInfo.views).entries()).map(([key, groupedFiles]) => {
      const labelFileViews = groupedFiles.map(({ view, filename }) => ({
        viewName: view,
        csvPath: this.projectInfoService.projectInfo.data_dir + "/" + filename
      }));
      return {
        key,
        views: [...labelFileViews].sort(cmp)
      };
    });
    return this._allLabelFiles.next(files);
  }
  async loadPredictionIndex() {
    const projectInfo = this.projectInfoService.projectInfo;
    const response = await this.rpc.call("rglob", {
      baseDir: projectInfo.model_dir,
      pattern: "**/video_preds/**/*.csv",
      noDirs: true
    });
    this.predictionFiles = response.entries.filter((entry) => {
      if (entry.path.endsWith("bbox.csv"))
        return false;
      if (entry.path.endsWith("predictions.csv"))
        return false;
      if (entry.path.endsWith("_error.csv"))
        return false;
      if (entry.path.endsWith("_loss.csv"))
        return false;
      if (entry.path.endsWith("_norm.csv"))
        return false;
      return true;
    }).map((entry) => {
      let match2 = entry.path.match(/(.+)\/video_preds\/([^/]+)\.mp4\/predictions\.csv/);
      if (!match2) {
        match2 = entry.path.match(/(.+)\/video_preds\/([^/]+)\.csv/);
      }
      if (!match2)
        return null;
      const modelKey = match2[1];
      const sessionView = match2[2];
      const viewName = this.projectInfoService.allViews().find((v) => sessionView.includes(v));
      if (!viewName)
        return null;
      const sessionKey = sessionView.replace(viewName, "*");
      return {
        path: entry.path,
        modelKey,
        sessionKey,
        viewName
      };
    }).filter((entry) => entry != null);
    this.initModels();
    await this.initKeypoints();
  }
  initModels() {
    this.sessionModelMap = this.predictionFiles.reduce((sessionModelMap, entry) => {
      const { sessionKey, modelKey } = entry;
      if (!sessionModelMap[sessionKey]) {
        sessionModelMap[sessionKey] = [];
      }
      sessionModelMap[sessionKey].push(modelKey);
      return sessionModelMap;
    }, {});
    const uniqueModels = new Set(this.predictionFiles.map((pfile) => pfile.modelKey).filter((x) => x));
    this.projectInfoService.setAllModels(Array.from(uniqueModels).sort());
  }
  async initKeypoints() {
    if (this.predictionFiles.length === 0)
      return;
    const csvFile = await this.getPredictionFile(this.predictionFiles[0]);
    if (!csvFile)
      return;
    const allKeypoints = this.csvParser.getBodyParts(csvFile);
    this.projectInfoService.setAllKeypoints(allKeypoints);
  }
  getPredictionFilesForSession(sessionKey) {
    const predictionFiles = this.predictionFiles.filter((p) => p.sessionKey === sessionKey);
    return predictionFiles;
  }
  async getPredictionFile(pfile) {
    const modelDir = this.projectInfoService.projectInfo?.model_dir;
    const src = "/app/v0/files/" + modelDir + "/" + pfile.path;
    return await firstValueFrom(this.httpClient.get(src, { responseType: "text" }).pipe(catchError((error) => {
      if (error.status === 404) {
        return [null];
      }
      throw error;
    })));
  }
  async ffprobe(file) {
    const response = await this.rpc.call("ffprobe", {
      path: file
    });
    return response;
  }
  async getYamlFile(filePath) {
    const url = `/app/v0/getYamlFile`;
    return await firstValueFrom(this.httpClient.get(url, { params: { file_path: filePath } }).pipe(catchError((error) => {
      if (error.status === 404) {
        return [null];
      }
      throw error;
    })));
  }
  async createTrainTask(yamlText) {
    void yamlText;
    return;
  }
  getAvailableModelsForSession(sessionKey) {
    return this.sessionModelMap[sessionKey] || [];
  }
  groupFilesBySession(filenames, views) {
    const pathKeyToItsViewFiles = this.groupFilesByView(filenames, views);
    const cmp = createSessionViewComparator(this.projectInfoService.allViews());
    return Array.from(pathKeyToItsViewFiles.entries()).map(([relativePath2, groupedFiles]) => {
      const sessionViews = groupedFiles.map(({ view, filename }) => ({
        viewName: view,
        videoPath: this.projectInfoService.projectInfo.data_dir + "/" + filename
      }));
      const key = relativePath2.split("/").at(-1).replace(/\.mp4$/, "");
      return {
        key,
        relativePath: relativePath2,
        views: [...sessionViews].sort(cmp)
      };
    });
  }
  groupFilesByView(paths, views) {
    const pathKeyToItsFiles = /* @__PURE__ */ new Map();
    for (const path of paths) {
      const parts = path.split("/");
      const filename = parts.at(-1);
      let viewName = views.find((v) => filename.includes(v));
      if (!viewName) {
        viewName = "unknown";
      }
      const pathKey = viewName == "unknown" ? path : [...parts.slice(0, -1), filename.replace(viewName, "*")].join("/");
      if (!pathKeyToItsFiles.has(pathKey)) {
        pathKeyToItsFiles.set(pathKey, []);
      }
      pathKeyToItsFiles.get(pathKey).push({
        view: viewName,
        filename: path
      });
    }
    return pathKeyToItsFiles;
  }
  async saveMVFrame(labelFile, frame) {
    const views = frame.views.map((frameView) => {
      const lbl = labelFile.views.find((v) => v.viewName === frameView.viewName);
      return {
        csvPath: lbl.csvPath,
        indexToChange: frameView.imgPath,
        changedKeypoints: fv(frameView).changedKeypoints.map(({ keypointName, x, y }) => {
          return { name: keypointName, x, y };
        })
      };
    });
    const request = { views };
    return this.rpc.call("save_mvframe", request);
  }
  async mvAutoLabel(frame, sessionKey) {
    const allKeypoints = frame.views.flatMap((fv2) => {
      return fv2.keypoints.map((kp2) => {
        return {
          keypointName: kp2.keypointName,
          view: fv2.viewName,
          point: { x: kp2.x, y: kp2.y }
        };
      });
    }).filter(({ point }) => !isNaN(point.x));
    const keypointsByName = import_lodash2.default.groupBy(allKeypoints, "keypointName");
    const keypoints = Object.entries(keypointsByName).map(([keypointName, labels]) => ({
      keypointName,
      labels
    }));
    const request = {
      sessionKey,
      keypoints
    };
    return this.rpc.call("getMVAutoLabels", request);
  }
  async hasCameraCalibrationFiles(sessionKey) {
    const projectInfo = this.projectInfoService.projectInfo;
    let response = await this.rpc.call("rglob", {
      baseDir: projectInfo.data_dir,
      pattern: `calibrations/${sessionKey}.toml`,
      noDirs: true
    });
    if (response.entries.length > 0) {
      return true;
    }
    response = await this.rpc.call("rglob", {
      baseDir: projectInfo.data_dir,
      pattern: `calibration.toml`,
      noDirs: true
    });
    if (response.entries.length > 0) {
      return true;
    }
    return false;
  }
  async createTrainingTask(modelName, configYaml) {
    await this.rpc.call("createTrainTask", { modelName, configYaml });
  }
  async listModels() {
    const resp = await this.rpc.call("listModels");
    return resp;
  }
  static \u0275fac = function SessionService_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _SessionService)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _SessionService, factory: _SessionService.\u0275fac, providedIn: "root" });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(SessionService, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], null, null);
})();

// node_modules/@angular/cdk/fesm2022/element-x4z00URv.mjs
function coerceNumberProperty(value, fallbackValue = 0) {
  if (_isNumberValue(value)) {
    return Number(value);
  }
  return arguments.length === 2 ? fallbackValue : 0;
}
function _isNumberValue(value) {
  return !isNaN(parseFloat(value)) && !isNaN(Number(value));
}
function coerceElement(elementOrRef) {
  return elementOrRef instanceof ElementRef ? elementOrRef.nativeElement : elementOrRef;
}

// node_modules/@angular/cdk/fesm2022/array-I1yfCXUO.mjs
function coerceArray(value) {
  return Array.isArray(value) ? value : [value];
}

// node_modules/@angular/cdk/fesm2022/css-pixel-value-C_HEqLhI.mjs
function coerceCssPixelValue(value) {
  if (value == null) {
    return "";
  }
  return typeof value === "string" ? value : `${value}px`;
}

// node_modules/@angular/cdk/fesm2022/coercion.mjs
function coerceBooleanProperty(value) {
  return value != null && `${value}` !== "false";
}

// node_modules/@angular/cdk/fesm2022/platform-DNDzkVcI.mjs
var hasV8BreakIterator;
try {
  hasV8BreakIterator = typeof Intl !== "undefined" && Intl.v8BreakIterator;
} catch {
  hasV8BreakIterator = false;
}
var Platform = class _Platform {
  _platformId = inject2(PLATFORM_ID);
  // We want to use the Angular platform check because if the Document is shimmed
  // without the navigator, the following checks will fail. This is preferred because
  // sometimes the Document may be shimmed without the user's knowledge or intention
  /** Whether the Angular application is being rendered in the browser. */
  isBrowser = this._platformId ? isPlatformBrowser(this._platformId) : typeof document === "object" && !!document;
  /** Whether the current browser is Microsoft Edge. */
  EDGE = this.isBrowser && /(edge)/i.test(navigator.userAgent);
  /** Whether the current rendering engine is Microsoft Trident. */
  TRIDENT = this.isBrowser && /(msie|trident)/i.test(navigator.userAgent);
  // EdgeHTML and Trident mock Blink specific things and need to be excluded from this check.
  /** Whether the current rendering engine is Blink. */
  BLINK = this.isBrowser && !!(window.chrome || hasV8BreakIterator) && typeof CSS !== "undefined" && !this.EDGE && !this.TRIDENT;
  // Webkit is part of the userAgent in EdgeHTML, Blink and Trident. Therefore we need to
  // ensure that Webkit runs standalone and is not used as another engine's base.
  /** Whether the current rendering engine is WebKit. */
  WEBKIT = this.isBrowser && /AppleWebKit/i.test(navigator.userAgent) && !this.BLINK && !this.EDGE && !this.TRIDENT;
  /** Whether the current platform is Apple iOS. */
  IOS = this.isBrowser && /iPad|iPhone|iPod/.test(navigator.userAgent) && !("MSStream" in window);
  // It's difficult to detect the plain Gecko engine, because most of the browsers identify
  // them self as Gecko-like browsers and modify the userAgent's according to that.
  // Since we only cover one explicit Firefox case, we can simply check for Firefox
  // instead of having an unstable check for Gecko.
  /** Whether the current browser is Firefox. */
  FIREFOX = this.isBrowser && /(firefox|minefield)/i.test(navigator.userAgent);
  /** Whether the current platform is Android. */
  // Trident on mobile adds the android platform to the userAgent to trick detections.
  ANDROID = this.isBrowser && /android/i.test(navigator.userAgent) && !this.TRIDENT;
  // Safari browsers will include the Safari keyword in their userAgent. Some browsers may fake
  // this and just place the Safari keyword in the userAgent. To be more safe about Safari every
  // Safari browser should also use Webkit as its layout engine.
  /** Whether the current browser is Safari. */
  SAFARI = this.isBrowser && /safari/i.test(navigator.userAgent) && this.WEBKIT;
  constructor() {
  }
  static \u0275fac = function Platform_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _Platform)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _Platform,
    factory: _Platform.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(Platform, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], () => [], null);
})();

// node_modules/@angular/cdk/fesm2022/passive-listeners-esHZRgIN.mjs
var supportsPassiveEvents;
function supportsPassiveEventListeners() {
  if (supportsPassiveEvents == null && typeof window !== "undefined") {
    try {
      window.addEventListener("test", null, Object.defineProperty({}, "passive", {
        get: () => supportsPassiveEvents = true
      }));
    } finally {
      supportsPassiveEvents = supportsPassiveEvents || false;
    }
  }
  return supportsPassiveEvents;
}
function normalizePassiveListenerOptions(options) {
  return supportsPassiveEventListeners() ? options : !!options.capture;
}

// node_modules/@angular/cdk/fesm2022/scrolling-BkvA05C8.mjs
var RtlScrollAxisType;
(function(RtlScrollAxisType2) {
  RtlScrollAxisType2[RtlScrollAxisType2["NORMAL"] = 0] = "NORMAL";
  RtlScrollAxisType2[RtlScrollAxisType2["NEGATED"] = 1] = "NEGATED";
  RtlScrollAxisType2[RtlScrollAxisType2["INVERTED"] = 2] = "INVERTED";
})(RtlScrollAxisType || (RtlScrollAxisType = {}));
var rtlScrollAxisType;
var scrollBehaviorSupported;
function supportsScrollBehavior() {
  if (scrollBehaviorSupported == null) {
    if (typeof document !== "object" || !document || typeof Element !== "function" || !Element) {
      scrollBehaviorSupported = false;
      return scrollBehaviorSupported;
    }
    if ("scrollBehavior" in document.documentElement.style) {
      scrollBehaviorSupported = true;
    } else {
      const scrollToFunction = Element.prototype.scrollTo;
      if (scrollToFunction) {
        scrollBehaviorSupported = !/\{\s*\[native code\]\s*\}/.test(scrollToFunction.toString());
      } else {
        scrollBehaviorSupported = false;
      }
    }
  }
  return scrollBehaviorSupported;
}
function getRtlScrollAxisType() {
  if (typeof document !== "object" || !document) {
    return RtlScrollAxisType.NORMAL;
  }
  if (rtlScrollAxisType == null) {
    const scrollContainer = document.createElement("div");
    const containerStyle = scrollContainer.style;
    scrollContainer.dir = "rtl";
    containerStyle.width = "1px";
    containerStyle.overflow = "auto";
    containerStyle.visibility = "hidden";
    containerStyle.pointerEvents = "none";
    containerStyle.position = "absolute";
    const content = document.createElement("div");
    const contentStyle = content.style;
    contentStyle.width = "2px";
    contentStyle.height = "1px";
    scrollContainer.appendChild(content);
    document.body.appendChild(scrollContainer);
    rtlScrollAxisType = RtlScrollAxisType.NORMAL;
    if (scrollContainer.scrollLeft === 0) {
      scrollContainer.scrollLeft = 1;
      rtlScrollAxisType = scrollContainer.scrollLeft === 0 ? RtlScrollAxisType.NEGATED : RtlScrollAxisType.INVERTED;
    }
    scrollContainer.remove();
  }
  return rtlScrollAxisType;
}

// node_modules/@angular/cdk/fesm2022/shadow-dom-B0oHn41l.mjs
var shadowDomIsSupported;
function _supportsShadowDom() {
  if (shadowDomIsSupported == null) {
    const head = typeof document !== "undefined" ? document.head : null;
    shadowDomIsSupported = !!(head && (head.createShadowRoot || head.attachShadow));
  }
  return shadowDomIsSupported;
}
function _getShadowRoot(element) {
  if (_supportsShadowDom()) {
    const rootNode = element.getRootNode ? element.getRootNode() : null;
    if (typeof ShadowRoot !== "undefined" && ShadowRoot && rootNode instanceof ShadowRoot) {
      return rootNode;
    }
  }
  return null;
}
function _getFocusedElementPierceShadowDom() {
  let activeElement = typeof document !== "undefined" && document ? document.activeElement : null;
  while (activeElement && activeElement.shadowRoot) {
    const newActiveElement = activeElement.shadowRoot.activeElement;
    if (newActiveElement === activeElement) {
      break;
    } else {
      activeElement = newActiveElement;
    }
  }
  return activeElement;
}
function _getEventTarget(event) {
  return event.composedPath ? event.composedPath()[0] : event.target;
}

// node_modules/@angular/cdk/fesm2022/test-environment-CT0XxPyp.mjs
function _isTestEnvironment() {
  return (
    // @ts-ignore
    typeof __karma__ !== "undefined" && !!__karma__ || // @ts-ignore
    typeof jasmine !== "undefined" && !!jasmine || // @ts-ignore
    typeof jest !== "undefined" && !!jest || // @ts-ignore
    typeof Mocha !== "undefined" && !!Mocha
  );
}

// node_modules/@angular/cdk/fesm2022/platform.mjs
var PlatformModule = class _PlatformModule {
  static \u0275fac = function PlatformModule_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _PlatformModule)();
  };
  static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
    type: _PlatformModule
  });
  static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({});
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PlatformModule, [{
    type: NgModule,
    args: [{}]
  }], null, null);
})();

// node_modules/@angular/cdk/fesm2022/style-loader-B2sGQXxD.mjs
var appsWithLoaders = /* @__PURE__ */ new WeakMap();
var _CdkPrivateStyleLoader = class __CdkPrivateStyleLoader {
  _appRef;
  _injector = inject2(Injector);
  _environmentInjector = inject2(EnvironmentInjector);
  /**
   * Loads a set of styles.
   * @param loader Component which will be instantiated to load the styles.
   */
  load(loader) {
    const appRef = this._appRef = this._appRef || this._injector.get(ApplicationRef);
    let data = appsWithLoaders.get(appRef);
    if (!data) {
      data = {
        loaders: /* @__PURE__ */ new Set(),
        refs: []
      };
      appsWithLoaders.set(appRef, data);
      appRef.onDestroy(() => {
        appsWithLoaders.get(appRef)?.refs.forEach((ref) => ref.destroy());
        appsWithLoaders.delete(appRef);
      });
    }
    if (!data.loaders.has(loader)) {
      data.loaders.add(loader);
      data.refs.push(createComponent(loader, {
        environmentInjector: this._environmentInjector
      }));
    }
  }
  static \u0275fac = function _CdkPrivateStyleLoader_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || __CdkPrivateStyleLoader)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: __CdkPrivateStyleLoader,
    factory: __CdkPrivateStyleLoader.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(_CdkPrivateStyleLoader, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], null, null);
})();

// node_modules/@angular/cdk/fesm2022/private.mjs
var _VisuallyHiddenLoader = class __VisuallyHiddenLoader {
  static \u0275fac = function _VisuallyHiddenLoader_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || __VisuallyHiddenLoader)();
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({
    type: __VisuallyHiddenLoader,
    selectors: [["ng-component"]],
    exportAs: ["cdkVisuallyHidden"],
    decls: 0,
    vars: 0,
    template: function _VisuallyHiddenLoader_Template(rf, ctx) {
    },
    styles: [".cdk-visually-hidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap;outline:0;-webkit-appearance:none;-moz-appearance:none;left:0}[dir=rtl] .cdk-visually-hidden{left:auto;right:0}\n"],
    encapsulation: 2,
    changeDetection: 0
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(_VisuallyHiddenLoader, [{
    type: Component,
    args: [{
      exportAs: "cdkVisuallyHidden",
      encapsulation: ViewEncapsulation.None,
      template: "",
      changeDetection: ChangeDetectionStrategy.OnPush,
      styles: [".cdk-visually-hidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap;outline:0;-webkit-appearance:none;-moz-appearance:none;left:0}[dir=rtl] .cdk-visually-hidden{left:auto;right:0}\n"]
    }]
  }], null, null);
})();

// node_modules/@angular/cdk/fesm2022/fake-event-detection-DWOdFTFz.mjs
function isFakeMousedownFromScreenReader(event) {
  return event.buttons === 0 || event.detail === 0;
}
function isFakeTouchstartFromScreenReader(event) {
  const touch = event.touches && event.touches[0] || event.changedTouches && event.changedTouches[0];
  return !!touch && touch.identifier === -1 && (touch.radiusX == null || touch.radiusX === 1) && (touch.radiusY == null || touch.radiusY === 1);
}

// node_modules/@angular/cdk/fesm2022/keycodes-CpHkExLC.mjs
var TAB = 9;
var ENTER = 13;
var SHIFT = 16;
var CONTROL = 17;
var ALT = 18;
var ESCAPE = 27;
var SPACE = 32;
var PAGE_UP = 33;
var PAGE_DOWN = 34;
var END = 35;
var HOME = 36;
var LEFT_ARROW = 37;
var UP_ARROW = 38;
var RIGHT_ARROW = 39;
var DOWN_ARROW = 40;
var ZERO = 48;
var NINE = 57;
var A = 65;
var Z = 90;
var META = 91;
var MAC_META = 224;

// node_modules/@angular/cdk/fesm2022/focus-monitor-DUe99AIS.mjs
var INPUT_MODALITY_DETECTOR_OPTIONS = new InjectionToken("cdk-input-modality-detector-options");
var INPUT_MODALITY_DETECTOR_DEFAULT_OPTIONS = {
  ignoreKeys: [ALT, CONTROL, MAC_META, META, SHIFT]
};
var TOUCH_BUFFER_MS = 650;
var modalityEventListenerOptions = {
  passive: true,
  capture: true
};
var InputModalityDetector = class _InputModalityDetector {
  _platform = inject2(Platform);
  _listenerCleanups;
  /** Emits whenever an input modality is detected. */
  modalityDetected;
  /** Emits when the input modality changes. */
  modalityChanged;
  /** The most recently detected input modality. */
  get mostRecentModality() {
    return this._modality.value;
  }
  /**
   * The most recently detected input modality event target. Is null if no input modality has been
   * detected or if the associated event target is null for some unknown reason.
   */
  _mostRecentTarget = null;
  /** The underlying BehaviorSubject that emits whenever an input modality is detected. */
  _modality = new BehaviorSubject(null);
  /** Options for this InputModalityDetector. */
  _options;
  /**
   * The timestamp of the last touch input modality. Used to determine whether mousedown events
   * should be attributed to mouse or touch.
   */
  _lastTouchMs = 0;
  /**
   * Handles keydown events. Must be an arrow function in order to preserve the context when it gets
   * bound.
   */
  _onKeydown = (event) => {
    if (this._options?.ignoreKeys?.some((keyCode) => keyCode === event.keyCode)) {
      return;
    }
    this._modality.next("keyboard");
    this._mostRecentTarget = _getEventTarget(event);
  };
  /**
   * Handles mousedown events. Must be an arrow function in order to preserve the context when it
   * gets bound.
   */
  _onMousedown = (event) => {
    if (Date.now() - this._lastTouchMs < TOUCH_BUFFER_MS) {
      return;
    }
    this._modality.next(isFakeMousedownFromScreenReader(event) ? "keyboard" : "mouse");
    this._mostRecentTarget = _getEventTarget(event);
  };
  /**
   * Handles touchstart events. Must be an arrow function in order to preserve the context when it
   * gets bound.
   */
  _onTouchstart = (event) => {
    if (isFakeTouchstartFromScreenReader(event)) {
      this._modality.next("keyboard");
      return;
    }
    this._lastTouchMs = Date.now();
    this._modality.next("touch");
    this._mostRecentTarget = _getEventTarget(event);
  };
  constructor() {
    const ngZone = inject2(NgZone);
    const document2 = inject2(DOCUMENT);
    const options = inject2(INPUT_MODALITY_DETECTOR_OPTIONS, {
      optional: true
    });
    this._options = __spreadValues(__spreadValues({}, INPUT_MODALITY_DETECTOR_DEFAULT_OPTIONS), options);
    this.modalityDetected = this._modality.pipe(skip(1));
    this.modalityChanged = this.modalityDetected.pipe(distinctUntilChanged());
    if (this._platform.isBrowser) {
      const renderer = inject2(RendererFactory2).createRenderer(null, null);
      this._listenerCleanups = ngZone.runOutsideAngular(() => {
        return [renderer.listen(document2, "keydown", this._onKeydown, modalityEventListenerOptions), renderer.listen(document2, "mousedown", this._onMousedown, modalityEventListenerOptions), renderer.listen(document2, "touchstart", this._onTouchstart, modalityEventListenerOptions)];
      });
    }
  }
  ngOnDestroy() {
    this._modality.complete();
    this._listenerCleanups?.forEach((cleanup) => cleanup());
  }
  static \u0275fac = function InputModalityDetector_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _InputModalityDetector)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _InputModalityDetector,
    factory: _InputModalityDetector.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(InputModalityDetector, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], () => [], null);
})();
var FocusMonitorDetectionMode;
(function(FocusMonitorDetectionMode2) {
  FocusMonitorDetectionMode2[FocusMonitorDetectionMode2["IMMEDIATE"] = 0] = "IMMEDIATE";
  FocusMonitorDetectionMode2[FocusMonitorDetectionMode2["EVENTUAL"] = 1] = "EVENTUAL";
})(FocusMonitorDetectionMode || (FocusMonitorDetectionMode = {}));
var FOCUS_MONITOR_DEFAULT_OPTIONS = new InjectionToken("cdk-focus-monitor-default-options");
var captureEventListenerOptions = normalizePassiveListenerOptions({
  passive: true,
  capture: true
});
var FocusMonitor = class _FocusMonitor {
  _ngZone = inject2(NgZone);
  _platform = inject2(Platform);
  _inputModalityDetector = inject2(InputModalityDetector);
  /** The focus origin that the next focus event is a result of. */
  _origin = null;
  /** The FocusOrigin of the last focus event tracked by the FocusMonitor. */
  _lastFocusOrigin;
  /** Whether the window has just been focused. */
  _windowFocused = false;
  /** The timeout id of the window focus timeout. */
  _windowFocusTimeoutId;
  /** The timeout id of the origin clearing timeout. */
  _originTimeoutId;
  /**
   * Whether the origin was determined via a touch interaction. Necessary as properly attributing
   * focus events to touch interactions requires special logic.
   */
  _originFromTouchInteraction = false;
  /** Map of elements being monitored to their info. */
  _elementInfo = /* @__PURE__ */ new Map();
  /** The number of elements currently being monitored. */
  _monitoredElementCount = 0;
  /**
   * Keeps track of the root nodes to which we've currently bound a focus/blur handler,
   * as well as the number of monitored elements that they contain. We have to treat focus/blur
   * handlers differently from the rest of the events, because the browser won't emit events
   * to the document when focus moves inside of a shadow root.
   */
  _rootNodeFocusListenerCount = /* @__PURE__ */ new Map();
  /**
   * The specified detection mode, used for attributing the origin of a focus
   * event.
   */
  _detectionMode;
  /**
   * Event listener for `focus` events on the window.
   * Needs to be an arrow function in order to preserve the context when it gets bound.
   */
  _windowFocusListener = () => {
    this._windowFocused = true;
    this._windowFocusTimeoutId = setTimeout(() => this._windowFocused = false);
  };
  /** Used to reference correct document/window */
  _document = inject2(DOCUMENT);
  /** Subject for stopping our InputModalityDetector subscription. */
  _stopInputModalityDetector = new Subject();
  constructor() {
    const options = inject2(FOCUS_MONITOR_DEFAULT_OPTIONS, {
      optional: true
    });
    this._detectionMode = options?.detectionMode || FocusMonitorDetectionMode.IMMEDIATE;
  }
  /**
   * Event listener for `focus` and 'blur' events on the document.
   * Needs to be an arrow function in order to preserve the context when it gets bound.
   */
  _rootNodeFocusAndBlurListener = (event) => {
    const target = _getEventTarget(event);
    for (let element = target; element; element = element.parentElement) {
      if (event.type === "focus") {
        this._onFocus(event, element);
      } else {
        this._onBlur(event, element);
      }
    }
  };
  monitor(element, checkChildren = false) {
    const nativeElement = coerceElement(element);
    if (!this._platform.isBrowser || nativeElement.nodeType !== 1) {
      return of();
    }
    const rootNode = _getShadowRoot(nativeElement) || this._document;
    const cachedInfo = this._elementInfo.get(nativeElement);
    if (cachedInfo) {
      if (checkChildren) {
        cachedInfo.checkChildren = true;
      }
      return cachedInfo.subject;
    }
    const info = {
      checkChildren,
      subject: new Subject(),
      rootNode
    };
    this._elementInfo.set(nativeElement, info);
    this._registerGlobalListeners(info);
    return info.subject;
  }
  stopMonitoring(element) {
    const nativeElement = coerceElement(element);
    const elementInfo = this._elementInfo.get(nativeElement);
    if (elementInfo) {
      elementInfo.subject.complete();
      this._setClasses(nativeElement);
      this._elementInfo.delete(nativeElement);
      this._removeGlobalListeners(elementInfo);
    }
  }
  focusVia(element, origin, options) {
    const nativeElement = coerceElement(element);
    const focusedElement = this._document.activeElement;
    if (nativeElement === focusedElement) {
      this._getClosestElementsInfo(nativeElement).forEach(([currentElement, info]) => this._originChanged(currentElement, origin, info));
    } else {
      this._setOrigin(origin);
      if (typeof nativeElement.focus === "function") {
        nativeElement.focus(options);
      }
    }
  }
  ngOnDestroy() {
    this._elementInfo.forEach((_info, element) => this.stopMonitoring(element));
  }
  /** Use defaultView of injected document if available or fallback to global window reference */
  _getWindow() {
    return this._document.defaultView || window;
  }
  _getFocusOrigin(focusEventTarget) {
    if (this._origin) {
      if (this._originFromTouchInteraction) {
        return this._shouldBeAttributedToTouch(focusEventTarget) ? "touch" : "program";
      } else {
        return this._origin;
      }
    }
    if (this._windowFocused && this._lastFocusOrigin) {
      return this._lastFocusOrigin;
    }
    if (focusEventTarget && this._isLastInteractionFromInputLabel(focusEventTarget)) {
      return "mouse";
    }
    return "program";
  }
  /**
   * Returns whether the focus event should be attributed to touch. Recall that in IMMEDIATE mode, a
   * touch origin isn't immediately reset at the next tick (see _setOrigin). This means that when we
   * handle a focus event following a touch interaction, we need to determine whether (1) the focus
   * event was directly caused by the touch interaction or (2) the focus event was caused by a
   * subsequent programmatic focus call triggered by the touch interaction.
   * @param focusEventTarget The target of the focus event under examination.
   */
  _shouldBeAttributedToTouch(focusEventTarget) {
    return this._detectionMode === FocusMonitorDetectionMode.EVENTUAL || !!focusEventTarget?.contains(this._inputModalityDetector._mostRecentTarget);
  }
  /**
   * Sets the focus classes on the element based on the given focus origin.
   * @param element The element to update the classes on.
   * @param origin The focus origin.
   */
  _setClasses(element, origin) {
    element.classList.toggle("cdk-focused", !!origin);
    element.classList.toggle("cdk-touch-focused", origin === "touch");
    element.classList.toggle("cdk-keyboard-focused", origin === "keyboard");
    element.classList.toggle("cdk-mouse-focused", origin === "mouse");
    element.classList.toggle("cdk-program-focused", origin === "program");
  }
  /**
   * Updates the focus origin. If we're using immediate detection mode, we schedule an async
   * function to clear the origin at the end of a timeout. The duration of the timeout depends on
   * the origin being set.
   * @param origin The origin to set.
   * @param isFromInteraction Whether we are setting the origin from an interaction event.
   */
  _setOrigin(origin, isFromInteraction = false) {
    this._ngZone.runOutsideAngular(() => {
      this._origin = origin;
      this._originFromTouchInteraction = origin === "touch" && isFromInteraction;
      if (this._detectionMode === FocusMonitorDetectionMode.IMMEDIATE) {
        clearTimeout(this._originTimeoutId);
        const ms = this._originFromTouchInteraction ? TOUCH_BUFFER_MS : 1;
        this._originTimeoutId = setTimeout(() => this._origin = null, ms);
      }
    });
  }
  /**
   * Handles focus events on a registered element.
   * @param event The focus event.
   * @param element The monitored element.
   */
  _onFocus(event, element) {
    const elementInfo = this._elementInfo.get(element);
    const focusEventTarget = _getEventTarget(event);
    if (!elementInfo || !elementInfo.checkChildren && element !== focusEventTarget) {
      return;
    }
    this._originChanged(element, this._getFocusOrigin(focusEventTarget), elementInfo);
  }
  /**
   * Handles blur events on a registered element.
   * @param event The blur event.
   * @param element The monitored element.
   */
  _onBlur(event, element) {
    const elementInfo = this._elementInfo.get(element);
    if (!elementInfo || elementInfo.checkChildren && event.relatedTarget instanceof Node && element.contains(event.relatedTarget)) {
      return;
    }
    this._setClasses(element);
    this._emitOrigin(elementInfo, null);
  }
  _emitOrigin(info, origin) {
    if (info.subject.observers.length) {
      this._ngZone.run(() => info.subject.next(origin));
    }
  }
  _registerGlobalListeners(elementInfo) {
    if (!this._platform.isBrowser) {
      return;
    }
    const rootNode = elementInfo.rootNode;
    const rootNodeFocusListeners = this._rootNodeFocusListenerCount.get(rootNode) || 0;
    if (!rootNodeFocusListeners) {
      this._ngZone.runOutsideAngular(() => {
        rootNode.addEventListener("focus", this._rootNodeFocusAndBlurListener, captureEventListenerOptions);
        rootNode.addEventListener("blur", this._rootNodeFocusAndBlurListener, captureEventListenerOptions);
      });
    }
    this._rootNodeFocusListenerCount.set(rootNode, rootNodeFocusListeners + 1);
    if (++this._monitoredElementCount === 1) {
      this._ngZone.runOutsideAngular(() => {
        const window2 = this._getWindow();
        window2.addEventListener("focus", this._windowFocusListener);
      });
      this._inputModalityDetector.modalityDetected.pipe(takeUntil(this._stopInputModalityDetector)).subscribe((modality) => {
        this._setOrigin(
          modality,
          true
          /* isFromInteraction */
        );
      });
    }
  }
  _removeGlobalListeners(elementInfo) {
    const rootNode = elementInfo.rootNode;
    if (this._rootNodeFocusListenerCount.has(rootNode)) {
      const rootNodeFocusListeners = this._rootNodeFocusListenerCount.get(rootNode);
      if (rootNodeFocusListeners > 1) {
        this._rootNodeFocusListenerCount.set(rootNode, rootNodeFocusListeners - 1);
      } else {
        rootNode.removeEventListener("focus", this._rootNodeFocusAndBlurListener, captureEventListenerOptions);
        rootNode.removeEventListener("blur", this._rootNodeFocusAndBlurListener, captureEventListenerOptions);
        this._rootNodeFocusListenerCount.delete(rootNode);
      }
    }
    if (!--this._monitoredElementCount) {
      const window2 = this._getWindow();
      window2.removeEventListener("focus", this._windowFocusListener);
      this._stopInputModalityDetector.next();
      clearTimeout(this._windowFocusTimeoutId);
      clearTimeout(this._originTimeoutId);
    }
  }
  /** Updates all the state on an element once its focus origin has changed. */
  _originChanged(element, origin, elementInfo) {
    this._setClasses(element, origin);
    this._emitOrigin(elementInfo, origin);
    this._lastFocusOrigin = origin;
  }
  /**
   * Collects the `MonitoredElementInfo` of a particular element and
   * all of its ancestors that have enabled `checkChildren`.
   * @param element Element from which to start the search.
   */
  _getClosestElementsInfo(element) {
    const results = [];
    this._elementInfo.forEach((info, currentElement) => {
      if (currentElement === element || info.checkChildren && currentElement.contains(element)) {
        results.push([currentElement, info]);
      }
    });
    return results;
  }
  /**
   * Returns whether an interaction is likely to have come from the user clicking the `label` of
   * an `input` or `textarea` in order to focus it.
   * @param focusEventTarget Target currently receiving focus.
   */
  _isLastInteractionFromInputLabel(focusEventTarget) {
    const {
      _mostRecentTarget: mostRecentTarget,
      mostRecentModality
    } = this._inputModalityDetector;
    if (mostRecentModality !== "mouse" || !mostRecentTarget || mostRecentTarget === focusEventTarget || focusEventTarget.nodeName !== "INPUT" && focusEventTarget.nodeName !== "TEXTAREA" || focusEventTarget.disabled) {
      return false;
    }
    const labels = focusEventTarget.labels;
    if (labels) {
      for (let i = 0; i < labels.length; i++) {
        if (labels[i].contains(mostRecentTarget)) {
          return true;
        }
      }
    }
    return false;
  }
  static \u0275fac = function FocusMonitor_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _FocusMonitor)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _FocusMonitor,
    factory: _FocusMonitor.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(FocusMonitor, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], () => [], null);
})();
var CdkMonitorFocus = class _CdkMonitorFocus {
  _elementRef = inject2(ElementRef);
  _focusMonitor = inject2(FocusMonitor);
  _monitorSubscription;
  _focusOrigin = null;
  cdkFocusChange = new EventEmitter();
  constructor() {
  }
  get focusOrigin() {
    return this._focusOrigin;
  }
  ngAfterViewInit() {
    const element = this._elementRef.nativeElement;
    this._monitorSubscription = this._focusMonitor.monitor(element, element.nodeType === 1 && element.hasAttribute("cdkMonitorSubtreeFocus")).subscribe((origin) => {
      this._focusOrigin = origin;
      this.cdkFocusChange.emit(origin);
    });
  }
  ngOnDestroy() {
    this._focusMonitor.stopMonitoring(this._elementRef);
    if (this._monitorSubscription) {
      this._monitorSubscription.unsubscribe();
    }
  }
  static \u0275fac = function CdkMonitorFocus_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _CdkMonitorFocus)();
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _CdkMonitorFocus,
    selectors: [["", "cdkMonitorElementFocus", ""], ["", "cdkMonitorSubtreeFocus", ""]],
    outputs: {
      cdkFocusChange: "cdkFocusChange"
    },
    exportAs: ["cdkMonitorFocus"]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CdkMonitorFocus, [{
    type: Directive,
    args: [{
      selector: "[cdkMonitorElementFocus], [cdkMonitorSubtreeFocus]",
      exportAs: "cdkMonitorFocus"
    }]
  }], () => [], {
    cdkFocusChange: [{
      type: Output
    }]
  });
})();

// node_modules/@angular/cdk/fesm2022/breakpoints-observer-QutrMj4x.mjs
var mediaQueriesForWebkitCompatibility = /* @__PURE__ */ new Set();
var mediaQueryStyleNode;
var MediaMatcher = class _MediaMatcher {
  _platform = inject2(Platform);
  _nonce = inject2(CSP_NONCE, {
    optional: true
  });
  /** The internal matchMedia method to return back a MediaQueryList like object. */
  _matchMedia;
  constructor() {
    this._matchMedia = this._platform.isBrowser && window.matchMedia ? (
      // matchMedia is bound to the window scope intentionally as it is an illegal invocation to
      // call it from a different scope.
      window.matchMedia.bind(window)
    ) : noopMatchMedia;
  }
  /**
   * Evaluates the given media query and returns the native MediaQueryList from which results
   * can be retrieved.
   * Confirms the layout engine will trigger for the selector query provided and returns the
   * MediaQueryList for the query provided.
   */
  matchMedia(query) {
    if (this._platform.WEBKIT || this._platform.BLINK) {
      createEmptyStyleRule(query, this._nonce);
    }
    return this._matchMedia(query);
  }
  static \u0275fac = function MediaMatcher_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _MediaMatcher)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _MediaMatcher,
    factory: _MediaMatcher.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MediaMatcher, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], () => [], null);
})();
function createEmptyStyleRule(query, nonce) {
  if (mediaQueriesForWebkitCompatibility.has(query)) {
    return;
  }
  try {
    if (!mediaQueryStyleNode) {
      mediaQueryStyleNode = document.createElement("style");
      if (nonce) {
        mediaQueryStyleNode.setAttribute("nonce", nonce);
      }
      mediaQueryStyleNode.setAttribute("type", "text/css");
      document.head.appendChild(mediaQueryStyleNode);
    }
    if (mediaQueryStyleNode.sheet) {
      mediaQueryStyleNode.sheet.insertRule(`@media ${query} {body{ }}`, 0);
      mediaQueriesForWebkitCompatibility.add(query);
    }
  } catch (e) {
    console.error(e);
  }
}
function noopMatchMedia(query) {
  return {
    matches: query === "all" || query === "",
    media: query,
    addListener: () => {
    },
    removeListener: () => {
    }
  };
}
var BreakpointObserver = class _BreakpointObserver {
  _mediaMatcher = inject2(MediaMatcher);
  _zone = inject2(NgZone);
  /**  A map of all media queries currently being listened for. */
  _queries = /* @__PURE__ */ new Map();
  /** A subject for all other observables to takeUntil based on. */
  _destroySubject = new Subject();
  constructor() {
  }
  /** Completes the active subject, signalling to all other observables to complete. */
  ngOnDestroy() {
    this._destroySubject.next();
    this._destroySubject.complete();
  }
  /**
   * Whether one or more media queries match the current viewport size.
   * @param value One or more media queries to check.
   * @returns Whether any of the media queries match.
   */
  isMatched(value) {
    const queries = splitQueries(coerceArray(value));
    return queries.some((mediaQuery) => this._registerQuery(mediaQuery).mql.matches);
  }
  /**
   * Gets an observable of results for the given queries that will emit new results for any changes
   * in matching of the given queries.
   * @param value One or more media queries to check.
   * @returns A stream of matches for the given queries.
   */
  observe(value) {
    const queries = splitQueries(coerceArray(value));
    const observables = queries.map((query) => this._registerQuery(query).observable);
    let stateObservable = combineLatest(observables);
    stateObservable = concat(stateObservable.pipe(take(1)), stateObservable.pipe(skip(1), debounceTime(0)));
    return stateObservable.pipe(map((breakpointStates) => {
      const response = {
        matches: false,
        breakpoints: {}
      };
      breakpointStates.forEach(({
        matches,
        query
      }) => {
        response.matches = response.matches || matches;
        response.breakpoints[query] = matches;
      });
      return response;
    }));
  }
  /** Registers a specific query to be listened for. */
  _registerQuery(query) {
    if (this._queries.has(query)) {
      return this._queries.get(query);
    }
    const mql = this._mediaMatcher.matchMedia(query);
    const queryObservable = new Observable((observer) => {
      const handler = (e) => this._zone.run(() => observer.next(e));
      mql.addListener(handler);
      return () => {
        mql.removeListener(handler);
      };
    }).pipe(startWith(mql), map(({
      matches
    }) => ({
      query,
      matches
    })), takeUntil(this._destroySubject));
    const output2 = {
      observable: queryObservable,
      mql
    };
    this._queries.set(query, output2);
    return output2;
  }
  static \u0275fac = function BreakpointObserver_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _BreakpointObserver)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _BreakpointObserver,
    factory: _BreakpointObserver.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(BreakpointObserver, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], () => [], null);
})();
function splitQueries(queries) {
  return queries.map((query) => query.split(",")).reduce((a12, a2) => a12.concat(a2)).map((query) => query.trim());
}

// node_modules/@angular/cdk/fesm2022/observers.mjs
function shouldIgnoreRecord(record) {
  if (record.type === "characterData" && record.target instanceof Comment) {
    return true;
  }
  if (record.type === "childList") {
    for (let i = 0; i < record.addedNodes.length; i++) {
      if (!(record.addedNodes[i] instanceof Comment)) {
        return false;
      }
    }
    for (let i = 0; i < record.removedNodes.length; i++) {
      if (!(record.removedNodes[i] instanceof Comment)) {
        return false;
      }
    }
    return true;
  }
  return false;
}
var MutationObserverFactory = class _MutationObserverFactory {
  create(callback) {
    return typeof MutationObserver === "undefined" ? null : new MutationObserver(callback);
  }
  static \u0275fac = function MutationObserverFactory_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _MutationObserverFactory)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _MutationObserverFactory,
    factory: _MutationObserverFactory.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MutationObserverFactory, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], null, null);
})();
var ContentObserver = class _ContentObserver {
  _mutationObserverFactory = inject2(MutationObserverFactory);
  /** Keeps track of the existing MutationObservers so they can be reused. */
  _observedElements = /* @__PURE__ */ new Map();
  _ngZone = inject2(NgZone);
  constructor() {
  }
  ngOnDestroy() {
    this._observedElements.forEach((_4, element) => this._cleanupObserver(element));
  }
  observe(elementOrRef) {
    const element = coerceElement(elementOrRef);
    return new Observable((observer) => {
      const stream = this._observeElement(element);
      const subscription = stream.pipe(map((records) => records.filter((record) => !shouldIgnoreRecord(record))), filter((records) => !!records.length)).subscribe((records) => {
        this._ngZone.run(() => {
          observer.next(records);
        });
      });
      return () => {
        subscription.unsubscribe();
        this._unobserveElement(element);
      };
    });
  }
  /**
   * Observes the given element by using the existing MutationObserver if available, or creating a
   * new one if not.
   */
  _observeElement(element) {
    return this._ngZone.runOutsideAngular(() => {
      if (!this._observedElements.has(element)) {
        const stream = new Subject();
        const observer = this._mutationObserverFactory.create((mutations) => stream.next(mutations));
        if (observer) {
          observer.observe(element, {
            characterData: true,
            childList: true,
            subtree: true
          });
        }
        this._observedElements.set(element, {
          observer,
          stream,
          count: 1
        });
      } else {
        this._observedElements.get(element).count++;
      }
      return this._observedElements.get(element).stream;
    });
  }
  /**
   * Un-observes the given element and cleans up the underlying MutationObserver if nobody else is
   * observing this element.
   */
  _unobserveElement(element) {
    if (this._observedElements.has(element)) {
      this._observedElements.get(element).count--;
      if (!this._observedElements.get(element).count) {
        this._cleanupObserver(element);
      }
    }
  }
  /** Clean up the underlying MutationObserver for the specified element. */
  _cleanupObserver(element) {
    if (this._observedElements.has(element)) {
      const {
        observer,
        stream
      } = this._observedElements.get(element);
      if (observer) {
        observer.disconnect();
      }
      stream.complete();
      this._observedElements.delete(element);
    }
  }
  static \u0275fac = function ContentObserver_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _ContentObserver)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _ContentObserver,
    factory: _ContentObserver.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ContentObserver, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], () => [], null);
})();
var CdkObserveContent = class _CdkObserveContent {
  _contentObserver = inject2(ContentObserver);
  _elementRef = inject2(ElementRef);
  /** Event emitted for each change in the element's content. */
  event = new EventEmitter();
  /**
   * Whether observing content is disabled. This option can be used
   * to disconnect the underlying MutationObserver until it is needed.
   */
  get disabled() {
    return this._disabled;
  }
  set disabled(value) {
    this._disabled = value;
    this._disabled ? this._unsubscribe() : this._subscribe();
  }
  _disabled = false;
  /** Debounce interval for emitting the changes. */
  get debounce() {
    return this._debounce;
  }
  set debounce(value) {
    this._debounce = coerceNumberProperty(value);
    this._subscribe();
  }
  _debounce;
  _currentSubscription = null;
  constructor() {
  }
  ngAfterContentInit() {
    if (!this._currentSubscription && !this.disabled) {
      this._subscribe();
    }
  }
  ngOnDestroy() {
    this._unsubscribe();
  }
  _subscribe() {
    this._unsubscribe();
    const stream = this._contentObserver.observe(this._elementRef);
    this._currentSubscription = (this.debounce ? stream.pipe(debounceTime(this.debounce)) : stream).subscribe(this.event);
  }
  _unsubscribe() {
    this._currentSubscription?.unsubscribe();
  }
  static \u0275fac = function CdkObserveContent_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _CdkObserveContent)();
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _CdkObserveContent,
    selectors: [["", "cdkObserveContent", ""]],
    inputs: {
      disabled: [2, "cdkObserveContentDisabled", "disabled", booleanAttribute],
      debounce: "debounce"
    },
    outputs: {
      event: "cdkObserveContent"
    },
    exportAs: ["cdkObserveContent"]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CdkObserveContent, [{
    type: Directive,
    args: [{
      selector: "[cdkObserveContent]",
      exportAs: "cdkObserveContent"
    }]
  }], () => [], {
    event: [{
      type: Output,
      args: ["cdkObserveContent"]
    }],
    disabled: [{
      type: Input,
      args: [{
        alias: "cdkObserveContentDisabled",
        transform: booleanAttribute
      }]
    }],
    debounce: [{
      type: Input
    }]
  });
})();
var ObserversModule = class _ObserversModule {
  static \u0275fac = function ObserversModule_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _ObserversModule)();
  };
  static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
    type: _ObserversModule,
    imports: [CdkObserveContent],
    exports: [CdkObserveContent]
  });
  static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({
    providers: [MutationObserverFactory]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ObserversModule, [{
    type: NgModule,
    args: [{
      imports: [CdkObserveContent],
      exports: [CdkObserveContent],
      providers: [MutationObserverFactory]
    }]
  }], null, null);
})();

// node_modules/@angular/cdk/fesm2022/a11y-module-BPzgKr79.mjs
var InteractivityChecker = class _InteractivityChecker {
  _platform = inject2(Platform);
  constructor() {
  }
  /**
   * Gets whether an element is disabled.
   *
   * @param element Element to be checked.
   * @returns Whether the element is disabled.
   */
  isDisabled(element) {
    return element.hasAttribute("disabled");
  }
  /**
   * Gets whether an element is visible for the purposes of interactivity.
   *
   * This will capture states like `display: none` and `visibility: hidden`, but not things like
   * being clipped by an `overflow: hidden` parent or being outside the viewport.
   *
   * @returns Whether the element is visible.
   */
  isVisible(element) {
    return hasGeometry(element) && getComputedStyle(element).visibility === "visible";
  }
  /**
   * Gets whether an element can be reached via Tab key.
   * Assumes that the element has already been checked with isFocusable.
   *
   * @param element Element to be checked.
   * @returns Whether the element is tabbable.
   */
  isTabbable(element) {
    if (!this._platform.isBrowser) {
      return false;
    }
    const frameElement = getFrameElement(getWindow(element));
    if (frameElement) {
      if (getTabIndexValue(frameElement) === -1) {
        return false;
      }
      if (!this.isVisible(frameElement)) {
        return false;
      }
    }
    let nodeName = element.nodeName.toLowerCase();
    let tabIndexValue = getTabIndexValue(element);
    if (element.hasAttribute("contenteditable")) {
      return tabIndexValue !== -1;
    }
    if (nodeName === "iframe" || nodeName === "object") {
      return false;
    }
    if (this._platform.WEBKIT && this._platform.IOS && !isPotentiallyTabbableIOS(element)) {
      return false;
    }
    if (nodeName === "audio") {
      if (!element.hasAttribute("controls")) {
        return false;
      }
      return tabIndexValue !== -1;
    }
    if (nodeName === "video") {
      if (tabIndexValue === -1) {
        return false;
      }
      if (tabIndexValue !== null) {
        return true;
      }
      return this._platform.FIREFOX || element.hasAttribute("controls");
    }
    return element.tabIndex >= 0;
  }
  /**
   * Gets whether an element can be focused by the user.
   *
   * @param element Element to be checked.
   * @param config The config object with options to customize this method's behavior
   * @returns Whether the element is focusable.
   */
  isFocusable(element, config2) {
    return isPotentiallyFocusable(element) && !this.isDisabled(element) && (config2?.ignoreVisibility || this.isVisible(element));
  }
  static \u0275fac = function InteractivityChecker_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _InteractivityChecker)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _InteractivityChecker,
    factory: _InteractivityChecker.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(InteractivityChecker, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], () => [], null);
})();
function getFrameElement(window2) {
  try {
    return window2.frameElement;
  } catch {
    return null;
  }
}
function hasGeometry(element) {
  return !!(element.offsetWidth || element.offsetHeight || typeof element.getClientRects === "function" && element.getClientRects().length);
}
function isNativeFormElement(element) {
  let nodeName = element.nodeName.toLowerCase();
  return nodeName === "input" || nodeName === "select" || nodeName === "button" || nodeName === "textarea";
}
function isHiddenInput(element) {
  return isInputElement(element) && element.type == "hidden";
}
function isAnchorWithHref(element) {
  return isAnchorElement(element) && element.hasAttribute("href");
}
function isInputElement(element) {
  return element.nodeName.toLowerCase() == "input";
}
function isAnchorElement(element) {
  return element.nodeName.toLowerCase() == "a";
}
function hasValidTabIndex(element) {
  if (!element.hasAttribute("tabindex") || element.tabIndex === void 0) {
    return false;
  }
  let tabIndex = element.getAttribute("tabindex");
  return !!(tabIndex && !isNaN(parseInt(tabIndex, 10)));
}
function getTabIndexValue(element) {
  if (!hasValidTabIndex(element)) {
    return null;
  }
  const tabIndex = parseInt(element.getAttribute("tabindex") || "", 10);
  return isNaN(tabIndex) ? -1 : tabIndex;
}
function isPotentiallyTabbableIOS(element) {
  let nodeName = element.nodeName.toLowerCase();
  let inputType = nodeName === "input" && element.type;
  return inputType === "text" || inputType === "password" || nodeName === "select" || nodeName === "textarea";
}
function isPotentiallyFocusable(element) {
  if (isHiddenInput(element)) {
    return false;
  }
  return isNativeFormElement(element) || isAnchorWithHref(element) || element.hasAttribute("contenteditable") || hasValidTabIndex(element);
}
function getWindow(node) {
  return node.ownerDocument && node.ownerDocument.defaultView || window;
}
var FocusTrap = class {
  _element;
  _checker;
  _ngZone;
  _document;
  _injector;
  _startAnchor;
  _endAnchor;
  _hasAttached = false;
  // Event listeners for the anchors. Need to be regular functions so that we can unbind them later.
  startAnchorListener = () => this.focusLastTabbableElement();
  endAnchorListener = () => this.focusFirstTabbableElement();
  /** Whether the focus trap is active. */
  get enabled() {
    return this._enabled;
  }
  set enabled(value) {
    this._enabled = value;
    if (this._startAnchor && this._endAnchor) {
      this._toggleAnchorTabIndex(value, this._startAnchor);
      this._toggleAnchorTabIndex(value, this._endAnchor);
    }
  }
  _enabled = true;
  constructor(_element, _checker, _ngZone, _document2, deferAnchors = false, _injector) {
    this._element = _element;
    this._checker = _checker;
    this._ngZone = _ngZone;
    this._document = _document2;
    this._injector = _injector;
    if (!deferAnchors) {
      this.attachAnchors();
    }
  }
  /** Destroys the focus trap by cleaning up the anchors. */
  destroy() {
    const startAnchor = this._startAnchor;
    const endAnchor = this._endAnchor;
    if (startAnchor) {
      startAnchor.removeEventListener("focus", this.startAnchorListener);
      startAnchor.remove();
    }
    if (endAnchor) {
      endAnchor.removeEventListener("focus", this.endAnchorListener);
      endAnchor.remove();
    }
    this._startAnchor = this._endAnchor = null;
    this._hasAttached = false;
  }
  /**
   * Inserts the anchors into the DOM. This is usually done automatically
   * in the constructor, but can be deferred for cases like directives with `*ngIf`.
   * @returns Whether the focus trap managed to attach successfully. This may not be the case
   * if the target element isn't currently in the DOM.
   */
  attachAnchors() {
    if (this._hasAttached) {
      return true;
    }
    this._ngZone.runOutsideAngular(() => {
      if (!this._startAnchor) {
        this._startAnchor = this._createAnchor();
        this._startAnchor.addEventListener("focus", this.startAnchorListener);
      }
      if (!this._endAnchor) {
        this._endAnchor = this._createAnchor();
        this._endAnchor.addEventListener("focus", this.endAnchorListener);
      }
    });
    if (this._element.parentNode) {
      this._element.parentNode.insertBefore(this._startAnchor, this._element);
      this._element.parentNode.insertBefore(this._endAnchor, this._element.nextSibling);
      this._hasAttached = true;
    }
    return this._hasAttached;
  }
  /**
   * Waits for the zone to stabilize, then focuses the first tabbable element.
   * @returns Returns a promise that resolves with a boolean, depending
   * on whether focus was moved successfully.
   */
  focusInitialElementWhenReady(options) {
    return new Promise((resolve) => {
      this._executeOnStable(() => resolve(this.focusInitialElement(options)));
    });
  }
  /**
   * Waits for the zone to stabilize, then focuses
   * the first tabbable element within the focus trap region.
   * @returns Returns a promise that resolves with a boolean, depending
   * on whether focus was moved successfully.
   */
  focusFirstTabbableElementWhenReady(options) {
    return new Promise((resolve) => {
      this._executeOnStable(() => resolve(this.focusFirstTabbableElement(options)));
    });
  }
  /**
   * Waits for the zone to stabilize, then focuses
   * the last tabbable element within the focus trap region.
   * @returns Returns a promise that resolves with a boolean, depending
   * on whether focus was moved successfully.
   */
  focusLastTabbableElementWhenReady(options) {
    return new Promise((resolve) => {
      this._executeOnStable(() => resolve(this.focusLastTabbableElement(options)));
    });
  }
  /**
   * Get the specified boundary element of the trapped region.
   * @param bound The boundary to get (start or end of trapped region).
   * @returns The boundary element.
   */
  _getRegionBoundary(bound) {
    const markers = this._element.querySelectorAll(`[cdk-focus-region-${bound}], [cdkFocusRegion${bound}], [cdk-focus-${bound}]`);
    if (typeof ngDevMode === "undefined" || ngDevMode) {
      for (let i = 0; i < markers.length; i++) {
        if (markers[i].hasAttribute(`cdk-focus-${bound}`)) {
          console.warn(`Found use of deprecated attribute 'cdk-focus-${bound}', use 'cdkFocusRegion${bound}' instead. The deprecated attribute will be removed in 8.0.0.`, markers[i]);
        } else if (markers[i].hasAttribute(`cdk-focus-region-${bound}`)) {
          console.warn(`Found use of deprecated attribute 'cdk-focus-region-${bound}', use 'cdkFocusRegion${bound}' instead. The deprecated attribute will be removed in 8.0.0.`, markers[i]);
        }
      }
    }
    if (bound == "start") {
      return markers.length ? markers[0] : this._getFirstTabbableElement(this._element);
    }
    return markers.length ? markers[markers.length - 1] : this._getLastTabbableElement(this._element);
  }
  /**
   * Focuses the element that should be focused when the focus trap is initialized.
   * @returns Whether focus was moved successfully.
   */
  focusInitialElement(options) {
    const redirectToElement = this._element.querySelector(`[cdk-focus-initial], [cdkFocusInitial]`);
    if (redirectToElement) {
      if ((typeof ngDevMode === "undefined" || ngDevMode) && redirectToElement.hasAttribute(`cdk-focus-initial`)) {
        console.warn(`Found use of deprecated attribute 'cdk-focus-initial', use 'cdkFocusInitial' instead. The deprecated attribute will be removed in 8.0.0`, redirectToElement);
      }
      if ((typeof ngDevMode === "undefined" || ngDevMode) && !this._checker.isFocusable(redirectToElement)) {
        console.warn(`Element matching '[cdkFocusInitial]' is not focusable.`, redirectToElement);
      }
      if (!this._checker.isFocusable(redirectToElement)) {
        const focusableChild = this._getFirstTabbableElement(redirectToElement);
        focusableChild?.focus(options);
        return !!focusableChild;
      }
      redirectToElement.focus(options);
      return true;
    }
    return this.focusFirstTabbableElement(options);
  }
  /**
   * Focuses the first tabbable element within the focus trap region.
   * @returns Whether focus was moved successfully.
   */
  focusFirstTabbableElement(options) {
    const redirectToElement = this._getRegionBoundary("start");
    if (redirectToElement) {
      redirectToElement.focus(options);
    }
    return !!redirectToElement;
  }
  /**
   * Focuses the last tabbable element within the focus trap region.
   * @returns Whether focus was moved successfully.
   */
  focusLastTabbableElement(options) {
    const redirectToElement = this._getRegionBoundary("end");
    if (redirectToElement) {
      redirectToElement.focus(options);
    }
    return !!redirectToElement;
  }
  /**
   * Checks whether the focus trap has successfully been attached.
   */
  hasAttached() {
    return this._hasAttached;
  }
  /** Get the first tabbable element from a DOM subtree (inclusive). */
  _getFirstTabbableElement(root) {
    if (this._checker.isFocusable(root) && this._checker.isTabbable(root)) {
      return root;
    }
    const children = root.children;
    for (let i = 0; i < children.length; i++) {
      const tabbableChild = children[i].nodeType === this._document.ELEMENT_NODE ? this._getFirstTabbableElement(children[i]) : null;
      if (tabbableChild) {
        return tabbableChild;
      }
    }
    return null;
  }
  /** Get the last tabbable element from a DOM subtree (inclusive). */
  _getLastTabbableElement(root) {
    if (this._checker.isFocusable(root) && this._checker.isTabbable(root)) {
      return root;
    }
    const children = root.children;
    for (let i = children.length - 1; i >= 0; i--) {
      const tabbableChild = children[i].nodeType === this._document.ELEMENT_NODE ? this._getLastTabbableElement(children[i]) : null;
      if (tabbableChild) {
        return tabbableChild;
      }
    }
    return null;
  }
  /** Creates an anchor element. */
  _createAnchor() {
    const anchor = this._document.createElement("div");
    this._toggleAnchorTabIndex(this._enabled, anchor);
    anchor.classList.add("cdk-visually-hidden");
    anchor.classList.add("cdk-focus-trap-anchor");
    anchor.setAttribute("aria-hidden", "true");
    return anchor;
  }
  /**
   * Toggles the `tabindex` of an anchor, based on the enabled state of the focus trap.
   * @param isEnabled Whether the focus trap is enabled.
   * @param anchor Anchor on which to toggle the tabindex.
   */
  _toggleAnchorTabIndex(isEnabled, anchor) {
    isEnabled ? anchor.setAttribute("tabindex", "0") : anchor.removeAttribute("tabindex");
  }
  /**
   * Toggles the`tabindex` of both anchors to either trap Tab focus or allow it to escape.
   * @param enabled: Whether the anchors should trap Tab.
   */
  toggleAnchors(enabled) {
    if (this._startAnchor && this._endAnchor) {
      this._toggleAnchorTabIndex(enabled, this._startAnchor);
      this._toggleAnchorTabIndex(enabled, this._endAnchor);
    }
  }
  /** Executes a function when the zone is stable. */
  _executeOnStable(fn) {
    if (this._injector) {
      afterNextRender(fn, {
        injector: this._injector
      });
    } else {
      setTimeout(fn);
    }
  }
};
var FocusTrapFactory = class _FocusTrapFactory {
  _checker = inject2(InteractivityChecker);
  _ngZone = inject2(NgZone);
  _document = inject2(DOCUMENT);
  _injector = inject2(Injector);
  constructor() {
    inject2(_CdkPrivateStyleLoader).load(_VisuallyHiddenLoader);
  }
  /**
   * Creates a focus-trapped region around the given element.
   * @param element The element around which focus will be trapped.
   * @param deferCaptureElements Defers the creation of focus-capturing elements to be done
   *     manually by the user.
   * @returns The created focus trap instance.
   */
  create(element, deferCaptureElements = false) {
    return new FocusTrap(element, this._checker, this._ngZone, this._document, deferCaptureElements, this._injector);
  }
  static \u0275fac = function FocusTrapFactory_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _FocusTrapFactory)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _FocusTrapFactory,
    factory: _FocusTrapFactory.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(FocusTrapFactory, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], () => [], null);
})();
var CdkTrapFocus = class _CdkTrapFocus {
  _elementRef = inject2(ElementRef);
  _focusTrapFactory = inject2(FocusTrapFactory);
  /** Underlying FocusTrap instance. */
  focusTrap;
  /** Previously focused element to restore focus to upon destroy when using autoCapture. */
  _previouslyFocusedElement = null;
  /** Whether the focus trap is active. */
  get enabled() {
    return this.focusTrap?.enabled || false;
  }
  set enabled(value) {
    if (this.focusTrap) {
      this.focusTrap.enabled = value;
    }
  }
  /**
   * Whether the directive should automatically move focus into the trapped region upon
   * initialization and return focus to the previous activeElement upon destruction.
   */
  autoCapture;
  constructor() {
    const platform = inject2(Platform);
    if (platform.isBrowser) {
      this.focusTrap = this._focusTrapFactory.create(this._elementRef.nativeElement, true);
    }
  }
  ngOnDestroy() {
    this.focusTrap?.destroy();
    if (this._previouslyFocusedElement) {
      this._previouslyFocusedElement.focus();
      this._previouslyFocusedElement = null;
    }
  }
  ngAfterContentInit() {
    this.focusTrap?.attachAnchors();
    if (this.autoCapture) {
      this._captureFocus();
    }
  }
  ngDoCheck() {
    if (this.focusTrap && !this.focusTrap.hasAttached()) {
      this.focusTrap.attachAnchors();
    }
  }
  ngOnChanges(changes) {
    const autoCaptureChange = changes["autoCapture"];
    if (autoCaptureChange && !autoCaptureChange.firstChange && this.autoCapture && this.focusTrap?.hasAttached()) {
      this._captureFocus();
    }
  }
  _captureFocus() {
    this._previouslyFocusedElement = _getFocusedElementPierceShadowDom();
    this.focusTrap?.focusInitialElementWhenReady();
  }
  static \u0275fac = function CdkTrapFocus_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _CdkTrapFocus)();
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _CdkTrapFocus,
    selectors: [["", "cdkTrapFocus", ""]],
    inputs: {
      enabled: [2, "cdkTrapFocus", "enabled", booleanAttribute],
      autoCapture: [2, "cdkTrapFocusAutoCapture", "autoCapture", booleanAttribute]
    },
    exportAs: ["cdkTrapFocus"],
    features: [\u0275\u0275NgOnChangesFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CdkTrapFocus, [{
    type: Directive,
    args: [{
      selector: "[cdkTrapFocus]",
      exportAs: "cdkTrapFocus"
    }]
  }], () => [], {
    enabled: [{
      type: Input,
      args: [{
        alias: "cdkTrapFocus",
        transform: booleanAttribute
      }]
    }],
    autoCapture: [{
      type: Input,
      args: [{
        alias: "cdkTrapFocusAutoCapture",
        transform: booleanAttribute
      }]
    }]
  });
})();
var LIVE_ANNOUNCER_ELEMENT_TOKEN = new InjectionToken("liveAnnouncerElement", {
  providedIn: "root",
  factory: LIVE_ANNOUNCER_ELEMENT_TOKEN_FACTORY
});
function LIVE_ANNOUNCER_ELEMENT_TOKEN_FACTORY() {
  return null;
}
var LIVE_ANNOUNCER_DEFAULT_OPTIONS = new InjectionToken("LIVE_ANNOUNCER_DEFAULT_OPTIONS");
var uniqueIds = 0;
var LiveAnnouncer = class _LiveAnnouncer {
  _ngZone = inject2(NgZone);
  _defaultOptions = inject2(LIVE_ANNOUNCER_DEFAULT_OPTIONS, {
    optional: true
  });
  _liveElement;
  _document = inject2(DOCUMENT);
  _previousTimeout;
  _currentPromise;
  _currentResolve;
  constructor() {
    const elementToken = inject2(LIVE_ANNOUNCER_ELEMENT_TOKEN, {
      optional: true
    });
    this._liveElement = elementToken || this._createLiveElement();
  }
  announce(message, ...args) {
    const defaultOptions = this._defaultOptions;
    let politeness;
    let duration;
    if (args.length === 1 && typeof args[0] === "number") {
      duration = args[0];
    } else {
      [politeness, duration] = args;
    }
    this.clear();
    clearTimeout(this._previousTimeout);
    if (!politeness) {
      politeness = defaultOptions && defaultOptions.politeness ? defaultOptions.politeness : "polite";
    }
    if (duration == null && defaultOptions) {
      duration = defaultOptions.duration;
    }
    this._liveElement.setAttribute("aria-live", politeness);
    if (this._liveElement.id) {
      this._exposeAnnouncerToModals(this._liveElement.id);
    }
    return this._ngZone.runOutsideAngular(() => {
      if (!this._currentPromise) {
        this._currentPromise = new Promise((resolve) => this._currentResolve = resolve);
      }
      clearTimeout(this._previousTimeout);
      this._previousTimeout = setTimeout(() => {
        this._liveElement.textContent = message;
        if (typeof duration === "number") {
          this._previousTimeout = setTimeout(() => this.clear(), duration);
        }
        this._currentResolve?.();
        this._currentPromise = this._currentResolve = void 0;
      }, 100);
      return this._currentPromise;
    });
  }
  /**
   * Clears the current text from the announcer element. Can be used to prevent
   * screen readers from reading the text out again while the user is going
   * through the page landmarks.
   */
  clear() {
    if (this._liveElement) {
      this._liveElement.textContent = "";
    }
  }
  ngOnDestroy() {
    clearTimeout(this._previousTimeout);
    this._liveElement?.remove();
    this._liveElement = null;
    this._currentResolve?.();
    this._currentPromise = this._currentResolve = void 0;
  }
  _createLiveElement() {
    const elementClass = "cdk-live-announcer-element";
    const previousElements = this._document.getElementsByClassName(elementClass);
    const liveEl = this._document.createElement("div");
    for (let i = 0; i < previousElements.length; i++) {
      previousElements[i].remove();
    }
    liveEl.classList.add(elementClass);
    liveEl.classList.add("cdk-visually-hidden");
    liveEl.setAttribute("aria-atomic", "true");
    liveEl.setAttribute("aria-live", "polite");
    liveEl.id = `cdk-live-announcer-${uniqueIds++}`;
    this._document.body.appendChild(liveEl);
    return liveEl;
  }
  /**
   * Some browsers won't expose the accessibility node of the live announcer element if there is an
   * `aria-modal` and the live announcer is outside of it. This method works around the issue by
   * pointing the `aria-owns` of all modals to the live announcer element.
   */
  _exposeAnnouncerToModals(id) {
    const modals = this._document.querySelectorAll('body > .cdk-overlay-container [aria-modal="true"]');
    for (let i = 0; i < modals.length; i++) {
      const modal = modals[i];
      const ariaOwns = modal.getAttribute("aria-owns");
      if (!ariaOwns) {
        modal.setAttribute("aria-owns", id);
      } else if (ariaOwns.indexOf(id) === -1) {
        modal.setAttribute("aria-owns", ariaOwns + " " + id);
      }
    }
  }
  static \u0275fac = function LiveAnnouncer_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _LiveAnnouncer)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _LiveAnnouncer,
    factory: _LiveAnnouncer.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(LiveAnnouncer, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], () => [], null);
})();
var CdkAriaLive = class _CdkAriaLive {
  _elementRef = inject2(ElementRef);
  _liveAnnouncer = inject2(LiveAnnouncer);
  _contentObserver = inject2(ContentObserver);
  _ngZone = inject2(NgZone);
  /** The aria-live politeness level to use when announcing messages. */
  get politeness() {
    return this._politeness;
  }
  set politeness(value) {
    this._politeness = value === "off" || value === "assertive" ? value : "polite";
    if (this._politeness === "off") {
      if (this._subscription) {
        this._subscription.unsubscribe();
        this._subscription = null;
      }
    } else if (!this._subscription) {
      this._subscription = this._ngZone.runOutsideAngular(() => {
        return this._contentObserver.observe(this._elementRef).subscribe(() => {
          const elementText = this._elementRef.nativeElement.textContent;
          if (elementText !== this._previousAnnouncedText) {
            this._liveAnnouncer.announce(elementText, this._politeness, this.duration);
            this._previousAnnouncedText = elementText;
          }
        });
      });
    }
  }
  _politeness = "polite";
  /** Time in milliseconds after which to clear out the announcer element. */
  duration;
  _previousAnnouncedText;
  _subscription;
  constructor() {
    inject2(_CdkPrivateStyleLoader).load(_VisuallyHiddenLoader);
  }
  ngOnDestroy() {
    if (this._subscription) {
      this._subscription.unsubscribe();
    }
  }
  static \u0275fac = function CdkAriaLive_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _CdkAriaLive)();
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _CdkAriaLive,
    selectors: [["", "cdkAriaLive", ""]],
    inputs: {
      politeness: [0, "cdkAriaLive", "politeness"],
      duration: [0, "cdkAriaLiveDuration", "duration"]
    },
    exportAs: ["cdkAriaLive"]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CdkAriaLive, [{
    type: Directive,
    args: [{
      selector: "[cdkAriaLive]",
      exportAs: "cdkAriaLive"
    }]
  }], () => [], {
    politeness: [{
      type: Input,
      args: ["cdkAriaLive"]
    }],
    duration: [{
      type: Input,
      args: ["cdkAriaLiveDuration"]
    }]
  });
})();
var HighContrastMode;
(function(HighContrastMode2) {
  HighContrastMode2[HighContrastMode2["NONE"] = 0] = "NONE";
  HighContrastMode2[HighContrastMode2["BLACK_ON_WHITE"] = 1] = "BLACK_ON_WHITE";
  HighContrastMode2[HighContrastMode2["WHITE_ON_BLACK"] = 2] = "WHITE_ON_BLACK";
})(HighContrastMode || (HighContrastMode = {}));
var BLACK_ON_WHITE_CSS_CLASS = "cdk-high-contrast-black-on-white";
var WHITE_ON_BLACK_CSS_CLASS = "cdk-high-contrast-white-on-black";
var HIGH_CONTRAST_MODE_ACTIVE_CSS_CLASS = "cdk-high-contrast-active";
var HighContrastModeDetector = class _HighContrastModeDetector {
  _platform = inject2(Platform);
  /**
   * Figuring out the high contrast mode and adding the body classes can cause
   * some expensive layouts. This flag is used to ensure that we only do it once.
   */
  _hasCheckedHighContrastMode;
  _document = inject2(DOCUMENT);
  _breakpointSubscription;
  constructor() {
    this._breakpointSubscription = inject2(BreakpointObserver).observe("(forced-colors: active)").subscribe(() => {
      if (this._hasCheckedHighContrastMode) {
        this._hasCheckedHighContrastMode = false;
        this._applyBodyHighContrastModeCssClasses();
      }
    });
  }
  /** Gets the current high-contrast-mode for the page. */
  getHighContrastMode() {
    if (!this._platform.isBrowser) {
      return HighContrastMode.NONE;
    }
    const testElement = this._document.createElement("div");
    testElement.style.backgroundColor = "rgb(1,2,3)";
    testElement.style.position = "absolute";
    this._document.body.appendChild(testElement);
    const documentWindow = this._document.defaultView || window;
    const computedStyle = documentWindow && documentWindow.getComputedStyle ? documentWindow.getComputedStyle(testElement) : null;
    const computedColor = (computedStyle && computedStyle.backgroundColor || "").replace(/ /g, "");
    testElement.remove();
    switch (computedColor) {
      // Pre Windows 11 dark theme.
      case "rgb(0,0,0)":
      // Windows 11 dark themes.
      case "rgb(45,50,54)":
      case "rgb(32,32,32)":
        return HighContrastMode.WHITE_ON_BLACK;
      // Pre Windows 11 light theme.
      case "rgb(255,255,255)":
      // Windows 11 light theme.
      case "rgb(255,250,239)":
        return HighContrastMode.BLACK_ON_WHITE;
    }
    return HighContrastMode.NONE;
  }
  ngOnDestroy() {
    this._breakpointSubscription.unsubscribe();
  }
  /** Applies CSS classes indicating high-contrast mode to document body (browser-only). */
  _applyBodyHighContrastModeCssClasses() {
    if (!this._hasCheckedHighContrastMode && this._platform.isBrowser && this._document.body) {
      const bodyClasses = this._document.body.classList;
      bodyClasses.remove(HIGH_CONTRAST_MODE_ACTIVE_CSS_CLASS, BLACK_ON_WHITE_CSS_CLASS, WHITE_ON_BLACK_CSS_CLASS);
      this._hasCheckedHighContrastMode = true;
      const mode = this.getHighContrastMode();
      if (mode === HighContrastMode.BLACK_ON_WHITE) {
        bodyClasses.add(HIGH_CONTRAST_MODE_ACTIVE_CSS_CLASS, BLACK_ON_WHITE_CSS_CLASS);
      } else if (mode === HighContrastMode.WHITE_ON_BLACK) {
        bodyClasses.add(HIGH_CONTRAST_MODE_ACTIVE_CSS_CLASS, WHITE_ON_BLACK_CSS_CLASS);
      }
    }
  }
  static \u0275fac = function HighContrastModeDetector_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _HighContrastModeDetector)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _HighContrastModeDetector,
    factory: _HighContrastModeDetector.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HighContrastModeDetector, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], () => [], null);
})();
var A11yModule = class _A11yModule {
  constructor() {
    inject2(HighContrastModeDetector)._applyBodyHighContrastModeCssClasses();
  }
  static \u0275fac = function A11yModule_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _A11yModule)();
  };
  static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
    type: _A11yModule,
    imports: [ObserversModule, CdkAriaLive, CdkTrapFocus, CdkMonitorFocus],
    exports: [CdkAriaLive, CdkTrapFocus, CdkMonitorFocus]
  });
  static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({
    imports: [ObserversModule]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(A11yModule, [{
    type: NgModule,
    args: [{
      imports: [ObserversModule, CdkAriaLive, CdkTrapFocus, CdkMonitorFocus],
      exports: [CdkAriaLive, CdkTrapFocus, CdkMonitorFocus]
    }]
  }], () => [], null);
})();

// node_modules/@angular/cdk/fesm2022/id-generator-LuoRZSid.mjs
var counters = {};
var _IdGenerator = class __IdGenerator {
  _appId = inject2(APP_ID);
  /**
   * Generates a unique ID with a specific prefix.
   * @param prefix Prefix to add to the ID.
   */
  getId(prefix) {
    if (this._appId !== "ng") {
      prefix += this._appId;
    }
    if (!counters.hasOwnProperty(prefix)) {
      counters[prefix] = 0;
    }
    return `${prefix}${counters[prefix]++}`;
  }
  static \u0275fac = function _IdGenerator_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || __IdGenerator)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: __IdGenerator,
    factory: __IdGenerator.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(_IdGenerator, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], null, null);
})();

// node_modules/@angular/cdk/fesm2022/typeahead-9ZW4Dtsf.mjs
var DEFAULT_TYPEAHEAD_DEBOUNCE_INTERVAL_MS = 200;
var Typeahead = class {
  _letterKeyStream = new Subject();
  _items = [];
  _selectedItemIndex = -1;
  /** Buffer for the letters that the user has pressed */
  _pressedLetters = [];
  _skipPredicateFn;
  _selectedItem = new Subject();
  selectedItem = this._selectedItem;
  constructor(initialItems, config2) {
    const typeAheadInterval = typeof config2?.debounceInterval === "number" ? config2.debounceInterval : DEFAULT_TYPEAHEAD_DEBOUNCE_INTERVAL_MS;
    if (config2?.skipPredicate) {
      this._skipPredicateFn = config2.skipPredicate;
    }
    if ((typeof ngDevMode === "undefined" || ngDevMode) && initialItems.length && initialItems.some((item) => typeof item.getLabel !== "function")) {
      throw new Error("KeyManager items in typeahead mode must implement the `getLabel` method.");
    }
    this.setItems(initialItems);
    this._setupKeyHandler(typeAheadInterval);
  }
  destroy() {
    this._pressedLetters = [];
    this._letterKeyStream.complete();
    this._selectedItem.complete();
  }
  setCurrentSelectedItemIndex(index) {
    this._selectedItemIndex = index;
  }
  setItems(items) {
    this._items = items;
  }
  handleKey(event) {
    const keyCode = event.keyCode;
    if (event.key && event.key.length === 1) {
      this._letterKeyStream.next(event.key.toLocaleUpperCase());
    } else if (keyCode >= A && keyCode <= Z || keyCode >= ZERO && keyCode <= NINE) {
      this._letterKeyStream.next(String.fromCharCode(keyCode));
    }
  }
  /** Gets whether the user is currently typing into the manager using the typeahead feature. */
  isTyping() {
    return this._pressedLetters.length > 0;
  }
  /** Resets the currently stored sequence of typed letters. */
  reset() {
    this._pressedLetters = [];
  }
  _setupKeyHandler(typeAheadInterval) {
    this._letterKeyStream.pipe(tap((letter) => this._pressedLetters.push(letter)), debounceTime(typeAheadInterval), filter(() => this._pressedLetters.length > 0), map(() => this._pressedLetters.join("").toLocaleUpperCase())).subscribe((inputString) => {
      for (let i = 1; i < this._items.length + 1; i++) {
        const index = (this._selectedItemIndex + i) % this._items.length;
        const item = this._items[index];
        if (!this._skipPredicateFn?.(item) && item.getLabel?.().toLocaleUpperCase().trim().indexOf(inputString) === 0) {
          this._selectedItem.next(item);
          break;
        }
      }
      this._pressedLetters = [];
    });
  }
};

// node_modules/@angular/cdk/fesm2022/keycodes.mjs
function hasModifierKey(event, ...modifiers) {
  if (modifiers.length) {
    return modifiers.some((modifier) => event[modifier]);
  }
  return event.altKey || event.shiftKey || event.ctrlKey || event.metaKey;
}

// node_modules/@angular/cdk/fesm2022/list-key-manager-C7tp3RbG.mjs
var ListKeyManager = class {
  _items;
  _activeItemIndex = signal(-1);
  _activeItem = signal(null);
  _wrap = false;
  _typeaheadSubscription = Subscription.EMPTY;
  _itemChangesSubscription;
  _vertical = true;
  _horizontal;
  _allowedModifierKeys = [];
  _homeAndEnd = false;
  _pageUpAndDown = { enabled: false, delta: 10 };
  _effectRef;
  _typeahead;
  /**
   * Predicate function that can be used to check whether an item should be skipped
   * by the key manager. By default, disabled items are skipped.
   */
  _skipPredicateFn = (item) => item.disabled;
  constructor(_items, injector) {
    this._items = _items;
    if (_items instanceof QueryList) {
      this._itemChangesSubscription = _items.changes.subscribe((newItems) => this._itemsChanged(newItems.toArray()));
    } else if (isSignal(_items)) {
      if (!injector && (typeof ngDevMode === "undefined" || ngDevMode)) {
        throw new Error("ListKeyManager constructed with a signal must receive an injector");
      }
      this._effectRef = effect(() => this._itemsChanged(_items()), { injector });
    }
  }
  /**
   * Stream that emits any time the TAB key is pressed, so components can react
   * when focus is shifted off of the list.
   */
  tabOut = new Subject();
  /** Stream that emits whenever the active item of the list manager changes. */
  change = new Subject();
  /**
   * Sets the predicate function that determines which items should be skipped by the
   * list key manager.
   * @param predicate Function that determines whether the given item should be skipped.
   */
  skipPredicate(predicate) {
    this._skipPredicateFn = predicate;
    return this;
  }
  /**
   * Configures wrapping mode, which determines whether the active item will wrap to
   * the other end of list when there are no more items in the given direction.
   * @param shouldWrap Whether the list should wrap when reaching the end.
   */
  withWrap(shouldWrap = true) {
    this._wrap = shouldWrap;
    return this;
  }
  /**
   * Configures whether the key manager should be able to move the selection vertically.
   * @param enabled Whether vertical selection should be enabled.
   */
  withVerticalOrientation(enabled = true) {
    this._vertical = enabled;
    return this;
  }
  /**
   * Configures the key manager to move the selection horizontally.
   * Passing in `null` will disable horizontal movement.
   * @param direction Direction in which the selection can be moved.
   */
  withHorizontalOrientation(direction) {
    this._horizontal = direction;
    return this;
  }
  /**
   * Modifier keys which are allowed to be held down and whose default actions will be prevented
   * as the user is pressing the arrow keys. Defaults to not allowing any modifier keys.
   */
  withAllowedModifierKeys(keys) {
    this._allowedModifierKeys = keys;
    return this;
  }
  /**
   * Turns on typeahead mode which allows users to set the active item by typing.
   * @param debounceInterval Time to wait after the last keystroke before setting the active item.
   */
  withTypeAhead(debounceInterval = 200) {
    if (typeof ngDevMode === "undefined" || ngDevMode) {
      const items2 = this._getItemsArray();
      if (items2.length > 0 && items2.some((item) => typeof item.getLabel !== "function")) {
        throw Error("ListKeyManager items in typeahead mode must implement the `getLabel` method.");
      }
    }
    this._typeaheadSubscription.unsubscribe();
    const items = this._getItemsArray();
    this._typeahead = new Typeahead(items, {
      debounceInterval: typeof debounceInterval === "number" ? debounceInterval : void 0,
      skipPredicate: (item) => this._skipPredicateFn(item)
    });
    this._typeaheadSubscription = this._typeahead.selectedItem.subscribe((item) => {
      this.setActiveItem(item);
    });
    return this;
  }
  /** Cancels the current typeahead sequence. */
  cancelTypeahead() {
    this._typeahead?.reset();
    return this;
  }
  /**
   * Configures the key manager to activate the first and last items
   * respectively when the Home or End key is pressed.
   * @param enabled Whether pressing the Home or End key activates the first/last item.
   */
  withHomeAndEnd(enabled = true) {
    this._homeAndEnd = enabled;
    return this;
  }
  /**
   * Configures the key manager to activate every 10th, configured or first/last element in up/down direction
   * respectively when the Page-Up or Page-Down key is pressed.
   * @param enabled Whether pressing the Page-Up or Page-Down key activates the first/last item.
   * @param delta Whether pressing the Home or End key activates the first/last item.
   */
  withPageUpDown(enabled = true, delta = 10) {
    this._pageUpAndDown = { enabled, delta };
    return this;
  }
  setActiveItem(item) {
    const previousActiveItem = this._activeItem();
    this.updateActiveItem(item);
    if (this._activeItem() !== previousActiveItem) {
      this.change.next(this._activeItemIndex());
    }
  }
  /**
   * Sets the active item depending on the key event passed in.
   * @param event Keyboard event to be used for determining which element should be active.
   */
  onKeydown(event) {
    const keyCode = event.keyCode;
    const modifiers = ["altKey", "ctrlKey", "metaKey", "shiftKey"];
    const isModifierAllowed = modifiers.every((modifier) => {
      return !event[modifier] || this._allowedModifierKeys.indexOf(modifier) > -1;
    });
    switch (keyCode) {
      case TAB:
        this.tabOut.next();
        return;
      case DOWN_ARROW:
        if (this._vertical && isModifierAllowed) {
          this.setNextItemActive();
          break;
        } else {
          return;
        }
      case UP_ARROW:
        if (this._vertical && isModifierAllowed) {
          this.setPreviousItemActive();
          break;
        } else {
          return;
        }
      case RIGHT_ARROW:
        if (this._horizontal && isModifierAllowed) {
          this._horizontal === "rtl" ? this.setPreviousItemActive() : this.setNextItemActive();
          break;
        } else {
          return;
        }
      case LEFT_ARROW:
        if (this._horizontal && isModifierAllowed) {
          this._horizontal === "rtl" ? this.setNextItemActive() : this.setPreviousItemActive();
          break;
        } else {
          return;
        }
      case HOME:
        if (this._homeAndEnd && isModifierAllowed) {
          this.setFirstItemActive();
          break;
        } else {
          return;
        }
      case END:
        if (this._homeAndEnd && isModifierAllowed) {
          this.setLastItemActive();
          break;
        } else {
          return;
        }
      case PAGE_UP:
        if (this._pageUpAndDown.enabled && isModifierAllowed) {
          const targetIndex = this._activeItemIndex() - this._pageUpAndDown.delta;
          this._setActiveItemByIndex(targetIndex > 0 ? targetIndex : 0, 1);
          break;
        } else {
          return;
        }
      case PAGE_DOWN:
        if (this._pageUpAndDown.enabled && isModifierAllowed) {
          const targetIndex = this._activeItemIndex() + this._pageUpAndDown.delta;
          const itemsLength = this._getItemsArray().length;
          this._setActiveItemByIndex(targetIndex < itemsLength ? targetIndex : itemsLength - 1, -1);
          break;
        } else {
          return;
        }
      default:
        if (isModifierAllowed || hasModifierKey(event, "shiftKey")) {
          this._typeahead?.handleKey(event);
        }
        return;
    }
    this._typeahead?.reset();
    event.preventDefault();
  }
  /** Index of the currently active item. */
  get activeItemIndex() {
    return this._activeItemIndex();
  }
  /** The active item. */
  get activeItem() {
    return this._activeItem();
  }
  /** Gets whether the user is currently typing into the manager using the typeahead feature. */
  isTyping() {
    return !!this._typeahead && this._typeahead.isTyping();
  }
  /** Sets the active item to the first enabled item in the list. */
  setFirstItemActive() {
    this._setActiveItemByIndex(0, 1);
  }
  /** Sets the active item to the last enabled item in the list. */
  setLastItemActive() {
    this._setActiveItemByIndex(this._getItemsArray().length - 1, -1);
  }
  /** Sets the active item to the next enabled item in the list. */
  setNextItemActive() {
    this._activeItemIndex() < 0 ? this.setFirstItemActive() : this._setActiveItemByDelta(1);
  }
  /** Sets the active item to a previous enabled item in the list. */
  setPreviousItemActive() {
    this._activeItemIndex() < 0 && this._wrap ? this.setLastItemActive() : this._setActiveItemByDelta(-1);
  }
  updateActiveItem(item) {
    const itemArray = this._getItemsArray();
    const index = typeof item === "number" ? item : itemArray.indexOf(item);
    const activeItem = itemArray[index];
    this._activeItem.set(activeItem == null ? null : activeItem);
    this._activeItemIndex.set(index);
    this._typeahead?.setCurrentSelectedItemIndex(index);
  }
  /** Cleans up the key manager. */
  destroy() {
    this._typeaheadSubscription.unsubscribe();
    this._itemChangesSubscription?.unsubscribe();
    this._effectRef?.destroy();
    this._typeahead?.destroy();
    this.tabOut.complete();
    this.change.complete();
  }
  /**
   * This method sets the active item, given a list of items and the delta between the
   * currently active item and the new active item. It will calculate differently
   * depending on whether wrap mode is turned on.
   */
  _setActiveItemByDelta(delta) {
    this._wrap ? this._setActiveInWrapMode(delta) : this._setActiveInDefaultMode(delta);
  }
  /**
   * Sets the active item properly given "wrap" mode. In other words, it will continue to move
   * down the list until it finds an item that is not disabled, and it will wrap if it
   * encounters either end of the list.
   */
  _setActiveInWrapMode(delta) {
    const items = this._getItemsArray();
    for (let i = 1; i <= items.length; i++) {
      const index = (this._activeItemIndex() + delta * i + items.length) % items.length;
      const item = items[index];
      if (!this._skipPredicateFn(item)) {
        this.setActiveItem(index);
        return;
      }
    }
  }
  /**
   * Sets the active item properly given the default mode. In other words, it will
   * continue to move down the list until it finds an item that is not disabled. If
   * it encounters either end of the list, it will stop and not wrap.
   */
  _setActiveInDefaultMode(delta) {
    this._setActiveItemByIndex(this._activeItemIndex() + delta, delta);
  }
  /**
   * Sets the active item to the first enabled item starting at the index specified. If the
   * item is disabled, it will move in the fallbackDelta direction until it either
   * finds an enabled item or encounters the end of the list.
   */
  _setActiveItemByIndex(index, fallbackDelta) {
    const items = this._getItemsArray();
    if (!items[index]) {
      return;
    }
    while (this._skipPredicateFn(items[index])) {
      index += fallbackDelta;
      if (!items[index]) {
        return;
      }
    }
    this.setActiveItem(index);
  }
  /** Returns the items as an array. */
  _getItemsArray() {
    if (isSignal(this._items)) {
      return this._items();
    }
    return this._items instanceof QueryList ? this._items.toArray() : this._items;
  }
  /** Callback for when the items have changed. */
  _itemsChanged(newItems) {
    this._typeahead?.setItems(newItems);
    const activeItem = this._activeItem();
    if (activeItem) {
      const newIndex = newItems.indexOf(activeItem);
      if (newIndex > -1 && newIndex !== this._activeItemIndex()) {
        this._activeItemIndex.set(newIndex);
        this._typeahead?.setCurrentSelectedItemIndex(newIndex);
      }
    }
  }
};

// node_modules/@angular/cdk/fesm2022/activedescendant-key-manager-CZAE5aFC.mjs
var ActiveDescendantKeyManager = class extends ListKeyManager {
  setActiveItem(index) {
    if (this.activeItem) {
      this.activeItem.setInactiveStyles();
    }
    super.setActiveItem(index);
    if (this.activeItem) {
      this.activeItem.setActiveStyles();
    }
  }
};

// node_modules/@angular/cdk/fesm2022/focus-key-manager-CPmlyB_c.mjs
var FocusKeyManager = class extends ListKeyManager {
  _origin = "program";
  /**
   * Sets the focus origin that will be passed in to the items for any subsequent `focus` calls.
   * @param origin Focus origin to be used when focusing items.
   */
  setFocusOrigin(origin) {
    this._origin = origin;
    return this;
  }
  setActiveItem(item) {
    super.setActiveItem(item);
    if (this.activeItem) {
      this.activeItem.focus(this._origin);
    }
  }
};

// node_modules/@angular/cdk/fesm2022/a11y.mjs
var ID_DELIMITER = " ";
function addAriaReferencedId(el, attr, id) {
  const ids = getAriaReferenceIds(el, attr);
  id = id.trim();
  if (ids.some((existingId) => existingId.trim() === id)) {
    return;
  }
  ids.push(id);
  el.setAttribute(attr, ids.join(ID_DELIMITER));
}
function removeAriaReferencedId(el, attr, id) {
  const ids = getAriaReferenceIds(el, attr);
  id = id.trim();
  const filteredIds = ids.filter((val) => val !== id);
  if (filteredIds.length) {
    el.setAttribute(attr, filteredIds.join(ID_DELIMITER));
  } else {
    el.removeAttribute(attr);
  }
}
function getAriaReferenceIds(el, attr) {
  const attrValue = el.getAttribute(attr);
  return attrValue?.match(/\S+/g) ?? [];
}
var CDK_DESCRIBEDBY_ID_PREFIX = "cdk-describedby-message";
var CDK_DESCRIBEDBY_HOST_ATTRIBUTE = "cdk-describedby-host";
var nextId = 0;
var AriaDescriber = class _AriaDescriber {
  _platform = inject2(Platform);
  _document = inject2(DOCUMENT);
  /** Map of all registered message elements that have been placed into the document. */
  _messageRegistry = /* @__PURE__ */ new Map();
  /** Container for all registered messages. */
  _messagesContainer = null;
  /** Unique ID for the service. */
  _id = `${nextId++}`;
  constructor() {
    inject2(_CdkPrivateStyleLoader).load(_VisuallyHiddenLoader);
    this._id = inject2(APP_ID) + "-" + nextId++;
  }
  describe(hostElement, message, role) {
    if (!this._canBeDescribed(hostElement, message)) {
      return;
    }
    const key = getKey(message, role);
    if (typeof message !== "string") {
      setMessageId(message, this._id);
      this._messageRegistry.set(key, {
        messageElement: message,
        referenceCount: 0
      });
    } else if (!this._messageRegistry.has(key)) {
      this._createMessageElement(message, role);
    }
    if (!this._isElementDescribedByMessage(hostElement, key)) {
      this._addMessageReference(hostElement, key);
    }
  }
  removeDescription(hostElement, message, role) {
    if (!message || !this._isElementNode(hostElement)) {
      return;
    }
    const key = getKey(message, role);
    if (this._isElementDescribedByMessage(hostElement, key)) {
      this._removeMessageReference(hostElement, key);
    }
    if (typeof message === "string") {
      const registeredMessage = this._messageRegistry.get(key);
      if (registeredMessage && registeredMessage.referenceCount === 0) {
        this._deleteMessageElement(key);
      }
    }
    if (this._messagesContainer?.childNodes.length === 0) {
      this._messagesContainer.remove();
      this._messagesContainer = null;
    }
  }
  /** Unregisters all created message elements and removes the message container. */
  ngOnDestroy() {
    const describedElements = this._document.querySelectorAll(`[${CDK_DESCRIBEDBY_HOST_ATTRIBUTE}="${this._id}"]`);
    for (let i = 0; i < describedElements.length; i++) {
      this._removeCdkDescribedByReferenceIds(describedElements[i]);
      describedElements[i].removeAttribute(CDK_DESCRIBEDBY_HOST_ATTRIBUTE);
    }
    this._messagesContainer?.remove();
    this._messagesContainer = null;
    this._messageRegistry.clear();
  }
  /**
   * Creates a new element in the visually hidden message container element with the message
   * as its content and adds it to the message registry.
   */
  _createMessageElement(message, role) {
    const messageElement = this._document.createElement("div");
    setMessageId(messageElement, this._id);
    messageElement.textContent = message;
    if (role) {
      messageElement.setAttribute("role", role);
    }
    this._createMessagesContainer();
    this._messagesContainer.appendChild(messageElement);
    this._messageRegistry.set(getKey(message, role), {
      messageElement,
      referenceCount: 0
    });
  }
  /** Deletes the message element from the global messages container. */
  _deleteMessageElement(key) {
    this._messageRegistry.get(key)?.messageElement?.remove();
    this._messageRegistry.delete(key);
  }
  /** Creates the global container for all aria-describedby messages. */
  _createMessagesContainer() {
    if (this._messagesContainer) {
      return;
    }
    const containerClassName = "cdk-describedby-message-container";
    const serverContainers = this._document.querySelectorAll(`.${containerClassName}[platform="server"]`);
    for (let i = 0; i < serverContainers.length; i++) {
      serverContainers[i].remove();
    }
    const messagesContainer = this._document.createElement("div");
    messagesContainer.style.visibility = "hidden";
    messagesContainer.classList.add(containerClassName);
    messagesContainer.classList.add("cdk-visually-hidden");
    if (!this._platform.isBrowser) {
      messagesContainer.setAttribute("platform", "server");
    }
    this._document.body.appendChild(messagesContainer);
    this._messagesContainer = messagesContainer;
  }
  /** Removes all cdk-describedby messages that are hosted through the element. */
  _removeCdkDescribedByReferenceIds(element) {
    const originalReferenceIds = getAriaReferenceIds(element, "aria-describedby").filter((id) => id.indexOf(CDK_DESCRIBEDBY_ID_PREFIX) != 0);
    element.setAttribute("aria-describedby", originalReferenceIds.join(" "));
  }
  /**
   * Adds a message reference to the element using aria-describedby and increments the registered
   * message's reference count.
   */
  _addMessageReference(element, key) {
    const registeredMessage = this._messageRegistry.get(key);
    addAriaReferencedId(element, "aria-describedby", registeredMessage.messageElement.id);
    element.setAttribute(CDK_DESCRIBEDBY_HOST_ATTRIBUTE, this._id);
    registeredMessage.referenceCount++;
  }
  /**
   * Removes a message reference from the element using aria-describedby
   * and decrements the registered message's reference count.
   */
  _removeMessageReference(element, key) {
    const registeredMessage = this._messageRegistry.get(key);
    registeredMessage.referenceCount--;
    removeAriaReferencedId(element, "aria-describedby", registeredMessage.messageElement.id);
    element.removeAttribute(CDK_DESCRIBEDBY_HOST_ATTRIBUTE);
  }
  /** Returns true if the element has been described by the provided message ID. */
  _isElementDescribedByMessage(element, key) {
    const referenceIds = getAriaReferenceIds(element, "aria-describedby");
    const registeredMessage = this._messageRegistry.get(key);
    const messageId = registeredMessage && registeredMessage.messageElement.id;
    return !!messageId && referenceIds.indexOf(messageId) != -1;
  }
  /** Determines whether a message can be described on a particular element. */
  _canBeDescribed(element, message) {
    if (!this._isElementNode(element)) {
      return false;
    }
    if (message && typeof message === "object") {
      return true;
    }
    const trimmedMessage = message == null ? "" : `${message}`.trim();
    const ariaLabel = element.getAttribute("aria-label");
    return trimmedMessage ? !ariaLabel || ariaLabel.trim() !== trimmedMessage : false;
  }
  /** Checks whether a node is an Element node. */
  _isElementNode(element) {
    return element.nodeType === this._document.ELEMENT_NODE;
  }
  static \u0275fac = function AriaDescriber_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _AriaDescriber)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _AriaDescriber,
    factory: _AriaDescriber.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(AriaDescriber, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], () => [], null);
})();
function getKey(message, role) {
  return typeof message === "string" ? `${role || ""}/${message}` : message;
}
function setMessageId(element, serviceId) {
  if (!element.id) {
    element.id = `${CDK_DESCRIBEDBY_ID_PREFIX}-${serviceId}-${nextId++}`;
  }
}
var ConfigurableFocusTrap = class extends FocusTrap {
  _focusTrapManager;
  _inertStrategy;
  /** Whether the FocusTrap is enabled. */
  get enabled() {
    return this._enabled;
  }
  set enabled(value) {
    this._enabled = value;
    if (this._enabled) {
      this._focusTrapManager.register(this);
    } else {
      this._focusTrapManager.deregister(this);
    }
  }
  constructor(_element, _checker, _ngZone, _document2, _focusTrapManager, _inertStrategy, config2, injector) {
    super(_element, _checker, _ngZone, _document2, config2.defer, injector);
    this._focusTrapManager = _focusTrapManager;
    this._inertStrategy = _inertStrategy;
    this._focusTrapManager.register(this);
  }
  /** Notifies the FocusTrapManager that this FocusTrap will be destroyed. */
  destroy() {
    this._focusTrapManager.deregister(this);
    super.destroy();
  }
  /** @docs-private Implemented as part of ManagedFocusTrap. */
  _enable() {
    this._inertStrategy.preventFocus(this);
    this.toggleAnchors(true);
  }
  /** @docs-private Implemented as part of ManagedFocusTrap. */
  _disable() {
    this._inertStrategy.allowFocus(this);
    this.toggleAnchors(false);
  }
};
var EventListenerFocusTrapInertStrategy = class {
  /** Focus event handler. */
  _listener = null;
  /** Adds a document event listener that keeps focus inside the FocusTrap. */
  preventFocus(focusTrap) {
    if (this._listener) {
      focusTrap._document.removeEventListener("focus", this._listener, true);
    }
    this._listener = (e) => this._trapFocus(focusTrap, e);
    focusTrap._ngZone.runOutsideAngular(() => {
      focusTrap._document.addEventListener("focus", this._listener, true);
    });
  }
  /** Removes the event listener added in preventFocus. */
  allowFocus(focusTrap) {
    if (!this._listener) {
      return;
    }
    focusTrap._document.removeEventListener("focus", this._listener, true);
    this._listener = null;
  }
  /**
   * Refocuses the first element in the FocusTrap if the focus event target was outside
   * the FocusTrap.
   *
   * This is an event listener callback. The event listener is added in runOutsideAngular,
   * so all this code runs outside Angular as well.
   */
  _trapFocus(focusTrap, event) {
    const target = event.target;
    const focusTrapRoot = focusTrap._element;
    if (target && !focusTrapRoot.contains(target) && !target.closest?.("div.cdk-overlay-pane")) {
      setTimeout(() => {
        if (focusTrap.enabled && !focusTrapRoot.contains(focusTrap._document.activeElement)) {
          focusTrap.focusFirstTabbableElement();
        }
      });
    }
  }
};
var FOCUS_TRAP_INERT_STRATEGY = new InjectionToken("FOCUS_TRAP_INERT_STRATEGY");
var FocusTrapManager = class _FocusTrapManager {
  // A stack of the FocusTraps on the page. Only the FocusTrap at the
  // top of the stack is active.
  _focusTrapStack = [];
  /**
   * Disables the FocusTrap at the top of the stack, and then pushes
   * the new FocusTrap onto the stack.
   */
  register(focusTrap) {
    this._focusTrapStack = this._focusTrapStack.filter((ft) => ft !== focusTrap);
    let stack = this._focusTrapStack;
    if (stack.length) {
      stack[stack.length - 1]._disable();
    }
    stack.push(focusTrap);
    focusTrap._enable();
  }
  /**
   * Removes the FocusTrap from the stack, and activates the
   * FocusTrap that is the new top of the stack.
   */
  deregister(focusTrap) {
    focusTrap._disable();
    const stack = this._focusTrapStack;
    const i = stack.indexOf(focusTrap);
    if (i !== -1) {
      stack.splice(i, 1);
      if (stack.length) {
        stack[stack.length - 1]._enable();
      }
    }
  }
  static \u0275fac = function FocusTrapManager_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _FocusTrapManager)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _FocusTrapManager,
    factory: _FocusTrapManager.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(FocusTrapManager, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], null, null);
})();
var ConfigurableFocusTrapFactory = class _ConfigurableFocusTrapFactory {
  _checker = inject2(InteractivityChecker);
  _ngZone = inject2(NgZone);
  _focusTrapManager = inject2(FocusTrapManager);
  _document = inject2(DOCUMENT);
  _inertStrategy;
  _injector = inject2(Injector);
  constructor() {
    const inertStrategy = inject2(FOCUS_TRAP_INERT_STRATEGY, {
      optional: true
    });
    this._inertStrategy = inertStrategy || new EventListenerFocusTrapInertStrategy();
  }
  create(element, config2 = {
    defer: false
  }) {
    let configObject;
    if (typeof config2 === "boolean") {
      configObject = {
        defer: config2
      };
    } else {
      configObject = config2;
    }
    return new ConfigurableFocusTrap(element, this._checker, this._ngZone, this._document, this._focusTrapManager, this._inertStrategy, configObject, this._injector);
  }
  static \u0275fac = function ConfigurableFocusTrapFactory_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _ConfigurableFocusTrapFactory)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _ConfigurableFocusTrapFactory,
    factory: _ConfigurableFocusTrapFactory.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ConfigurableFocusTrapFactory, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], () => [], null);
})();

// node_modules/@angular/cdk/fesm2022/layout.mjs
var LayoutModule = class _LayoutModule {
  static \u0275fac = function LayoutModule_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _LayoutModule)();
  };
  static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
    type: _LayoutModule
  });
  static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({});
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(LayoutModule, [{
    type: NgModule,
    args: [{}]
  }], null, null);
})();

// node_modules/@angular/material/fesm2022/animation-ChQ1vjiF.mjs
var MATERIAL_ANIMATIONS = new InjectionToken("MATERIAL_ANIMATIONS");
var reducedMotion = null;
function _getAnimationsState() {
  if (inject2(MATERIAL_ANIMATIONS, { optional: true })?.animationsDisabled || inject2(ANIMATION_MODULE_TYPE, { optional: true }) === "NoopAnimations") {
    return "di-disabled";
  }
  reducedMotion ??= inject2(MediaMatcher).matchMedia("(prefers-reduced-motion)").matches;
  return reducedMotion ? "reduced-motion" : "enabled";
}
function _animationsDisabled() {
  return _getAnimationsState() !== "enabled";
}

// node_modules/@angular/material/fesm2022/ripple-BMyyyLz2.mjs
var RippleState;
(function(RippleState2) {
  RippleState2[RippleState2["FADING_IN"] = 0] = "FADING_IN";
  RippleState2[RippleState2["VISIBLE"] = 1] = "VISIBLE";
  RippleState2[RippleState2["FADING_OUT"] = 2] = "FADING_OUT";
  RippleState2[RippleState2["HIDDEN"] = 3] = "HIDDEN";
})(RippleState || (RippleState = {}));
var RippleRef = class {
  _renderer;
  element;
  config;
  _animationForciblyDisabledThroughCss;
  /** Current state of the ripple. */
  state = RippleState.HIDDEN;
  constructor(_renderer, element, config2, _animationForciblyDisabledThroughCss = false) {
    this._renderer = _renderer;
    this.element = element;
    this.config = config2;
    this._animationForciblyDisabledThroughCss = _animationForciblyDisabledThroughCss;
  }
  /** Fades out the ripple element. */
  fadeOut() {
    this._renderer.fadeOutRipple(this);
  }
};
var passiveCapturingEventOptions$1 = normalizePassiveListenerOptions({
  passive: true,
  capture: true
});
var RippleEventManager = class {
  _events = /* @__PURE__ */ new Map();
  /** Adds an event handler. */
  addHandler(ngZone, name2, element, handler) {
    const handlersForEvent = this._events.get(name2);
    if (handlersForEvent) {
      const handlersForElement = handlersForEvent.get(element);
      if (handlersForElement) {
        handlersForElement.add(handler);
      } else {
        handlersForEvent.set(element, /* @__PURE__ */ new Set([handler]));
      }
    } else {
      this._events.set(name2, /* @__PURE__ */ new Map([[element, /* @__PURE__ */ new Set([handler])]]));
      ngZone.runOutsideAngular(() => {
        document.addEventListener(name2, this._delegateEventHandler, passiveCapturingEventOptions$1);
      });
    }
  }
  /** Removes an event handler. */
  removeHandler(name2, element, handler) {
    const handlersForEvent = this._events.get(name2);
    if (!handlersForEvent) {
      return;
    }
    const handlersForElement = handlersForEvent.get(element);
    if (!handlersForElement) {
      return;
    }
    handlersForElement.delete(handler);
    if (handlersForElement.size === 0) {
      handlersForEvent.delete(element);
    }
    if (handlersForEvent.size === 0) {
      this._events.delete(name2);
      document.removeEventListener(name2, this._delegateEventHandler, passiveCapturingEventOptions$1);
    }
  }
  /** Event handler that is bound and which dispatches the events to the different targets. */
  _delegateEventHandler = (event) => {
    const target = _getEventTarget(event);
    if (target) {
      this._events.get(event.type)?.forEach((handlers, element) => {
        if (element === target || element.contains(target)) {
          handlers.forEach((handler) => handler.handleEvent(event));
        }
      });
    }
  };
};
var defaultRippleAnimationConfig = {
  enterDuration: 225,
  exitDuration: 150
};
var ignoreMouseEventsTimeout = 800;
var passiveCapturingEventOptions = normalizePassiveListenerOptions({
  passive: true,
  capture: true
});
var pointerDownEvents = ["mousedown", "touchstart"];
var pointerUpEvents = ["mouseup", "mouseleave", "touchend", "touchcancel"];
var _MatRippleStylesLoader = class __MatRippleStylesLoader {
  static \u0275fac = function _MatRippleStylesLoader_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || __MatRippleStylesLoader)();
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({
    type: __MatRippleStylesLoader,
    selectors: [["ng-component"]],
    hostAttrs: ["mat-ripple-style-loader", ""],
    decls: 0,
    vars: 0,
    template: function _MatRippleStylesLoader_Template(rf, ctx) {
    },
    styles: [".mat-ripple{overflow:hidden;position:relative}.mat-ripple:not(:empty){transform:translateZ(0)}.mat-ripple.mat-ripple-unbounded{overflow:visible}.mat-ripple-element{position:absolute;border-radius:50%;pointer-events:none;transition:opacity,transform 0ms cubic-bezier(0, 0, 0.2, 1);transform:scale3d(0, 0, 0);background-color:var(--mat-ripple-color, color-mix(in srgb, var(--mat-sys-on-surface) 10%, transparent))}@media(forced-colors: active){.mat-ripple-element{display:none}}.cdk-drag-preview .mat-ripple-element,.cdk-drag-placeholder .mat-ripple-element{display:none}\n"],
    encapsulation: 2,
    changeDetection: 0
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(_MatRippleStylesLoader, [{
    type: Component,
    args: [{
      template: "",
      changeDetection: ChangeDetectionStrategy.OnPush,
      encapsulation: ViewEncapsulation.None,
      host: {
        "mat-ripple-style-loader": ""
      },
      styles: [".mat-ripple{overflow:hidden;position:relative}.mat-ripple:not(:empty){transform:translateZ(0)}.mat-ripple.mat-ripple-unbounded{overflow:visible}.mat-ripple-element{position:absolute;border-radius:50%;pointer-events:none;transition:opacity,transform 0ms cubic-bezier(0, 0, 0.2, 1);transform:scale3d(0, 0, 0);background-color:var(--mat-ripple-color, color-mix(in srgb, var(--mat-sys-on-surface) 10%, transparent))}@media(forced-colors: active){.mat-ripple-element{display:none}}.cdk-drag-preview .mat-ripple-element,.cdk-drag-placeholder .mat-ripple-element{display:none}\n"]
    }]
  }], null, null);
})();
var RippleRenderer = class _RippleRenderer {
  _target;
  _ngZone;
  _platform;
  /** Element where the ripples are being added to. */
  _containerElement;
  /** Element which triggers the ripple elements on mouse events. */
  _triggerElement;
  /** Whether the pointer is currently down or not. */
  _isPointerDown = false;
  /**
   * Map of currently active ripple references.
   * The ripple reference is mapped to its element event listeners.
   * The reason why `| null` is used is that event listeners are added only
   * when the condition is truthy (see the `_startFadeOutTransition` method).
   */
  _activeRipples = /* @__PURE__ */ new Map();
  /** Latest non-persistent ripple that was triggered. */
  _mostRecentTransientRipple;
  /** Time in milliseconds when the last touchstart event happened. */
  _lastTouchStartEvent;
  /** Whether pointer-up event listeners have been registered. */
  _pointerUpEventsRegistered = false;
  /**
   * Cached dimensions of the ripple container. Set when the first
   * ripple is shown and cleared once no more ripples are visible.
   */
  _containerRect;
  static _eventManager = new RippleEventManager();
  constructor(_target, _ngZone, elementOrElementRef, _platform, injector) {
    this._target = _target;
    this._ngZone = _ngZone;
    this._platform = _platform;
    if (_platform.isBrowser) {
      this._containerElement = coerceElement(elementOrElementRef);
    }
    if (injector) {
      injector.get(_CdkPrivateStyleLoader).load(_MatRippleStylesLoader);
    }
  }
  /**
   * Fades in a ripple at the given coordinates.
   * @param x Coordinate within the element, along the X axis at which to start the ripple.
   * @param y Coordinate within the element, along the Y axis at which to start the ripple.
   * @param config Extra ripple options.
   */
  fadeInRipple(x, y, config2 = {}) {
    const containerRect = this._containerRect = this._containerRect || this._containerElement.getBoundingClientRect();
    const animationConfig = __spreadValues(__spreadValues({}, defaultRippleAnimationConfig), config2.animation);
    if (config2.centered) {
      x = containerRect.left + containerRect.width / 2;
      y = containerRect.top + containerRect.height / 2;
    }
    const radius = config2.radius || distanceToFurthestCorner(x, y, containerRect);
    const offsetX = x - containerRect.left;
    const offsetY = y - containerRect.top;
    const enterDuration = animationConfig.enterDuration;
    const ripple = document.createElement("div");
    ripple.classList.add("mat-ripple-element");
    ripple.style.left = `${offsetX - radius}px`;
    ripple.style.top = `${offsetY - radius}px`;
    ripple.style.height = `${radius * 2}px`;
    ripple.style.width = `${radius * 2}px`;
    if (config2.color != null) {
      ripple.style.backgroundColor = config2.color;
    }
    ripple.style.transitionDuration = `${enterDuration}ms`;
    this._containerElement.appendChild(ripple);
    const computedStyles = window.getComputedStyle(ripple);
    const userTransitionProperty = computedStyles.transitionProperty;
    const userTransitionDuration = computedStyles.transitionDuration;
    const animationForciblyDisabledThroughCss = userTransitionProperty === "none" || // Note: The canonical unit for serialized CSS `<time>` properties is seconds. Additionally
    // some browsers expand the duration for every property (in our case `opacity` and `transform`).
    userTransitionDuration === "0s" || userTransitionDuration === "0s, 0s" || // If the container is 0x0, it's likely `display: none`.
    containerRect.width === 0 && containerRect.height === 0;
    const rippleRef = new RippleRef(this, ripple, config2, animationForciblyDisabledThroughCss);
    ripple.style.transform = "scale3d(1, 1, 1)";
    rippleRef.state = RippleState.FADING_IN;
    if (!config2.persistent) {
      this._mostRecentTransientRipple = rippleRef;
    }
    let eventListeners = null;
    if (!animationForciblyDisabledThroughCss && (enterDuration || animationConfig.exitDuration)) {
      this._ngZone.runOutsideAngular(() => {
        const onTransitionEnd = () => {
          if (eventListeners) {
            eventListeners.fallbackTimer = null;
          }
          clearTimeout(fallbackTimer);
          this._finishRippleTransition(rippleRef);
        };
        const onTransitionCancel = () => this._destroyRipple(rippleRef);
        const fallbackTimer = setTimeout(onTransitionCancel, enterDuration + 100);
        ripple.addEventListener("transitionend", onTransitionEnd);
        ripple.addEventListener("transitioncancel", onTransitionCancel);
        eventListeners = {
          onTransitionEnd,
          onTransitionCancel,
          fallbackTimer
        };
      });
    }
    this._activeRipples.set(rippleRef, eventListeners);
    if (animationForciblyDisabledThroughCss || !enterDuration) {
      this._finishRippleTransition(rippleRef);
    }
    return rippleRef;
  }
  /** Fades out a ripple reference. */
  fadeOutRipple(rippleRef) {
    if (rippleRef.state === RippleState.FADING_OUT || rippleRef.state === RippleState.HIDDEN) {
      return;
    }
    const rippleEl = rippleRef.element;
    const animationConfig = __spreadValues(__spreadValues({}, defaultRippleAnimationConfig), rippleRef.config.animation);
    rippleEl.style.transitionDuration = `${animationConfig.exitDuration}ms`;
    rippleEl.style.opacity = "0";
    rippleRef.state = RippleState.FADING_OUT;
    if (rippleRef._animationForciblyDisabledThroughCss || !animationConfig.exitDuration) {
      this._finishRippleTransition(rippleRef);
    }
  }
  /** Fades out all currently active ripples. */
  fadeOutAll() {
    this._getActiveRipples().forEach((ripple) => ripple.fadeOut());
  }
  /** Fades out all currently active non-persistent ripples. */
  fadeOutAllNonPersistent() {
    this._getActiveRipples().forEach((ripple) => {
      if (!ripple.config.persistent) {
        ripple.fadeOut();
      }
    });
  }
  /** Sets up the trigger event listeners */
  setupTriggerEvents(elementOrElementRef) {
    const element = coerceElement(elementOrElementRef);
    if (!this._platform.isBrowser || !element || element === this._triggerElement) {
      return;
    }
    this._removeTriggerEvents();
    this._triggerElement = element;
    pointerDownEvents.forEach((type) => {
      _RippleRenderer._eventManager.addHandler(this._ngZone, type, element, this);
    });
  }
  /**
   * Handles all registered events.
   * @docs-private
   */
  handleEvent(event) {
    if (event.type === "mousedown") {
      this._onMousedown(event);
    } else if (event.type === "touchstart") {
      this._onTouchStart(event);
    } else {
      this._onPointerUp();
    }
    if (!this._pointerUpEventsRegistered) {
      this._ngZone.runOutsideAngular(() => {
        pointerUpEvents.forEach((type) => {
          this._triggerElement.addEventListener(type, this, passiveCapturingEventOptions);
        });
      });
      this._pointerUpEventsRegistered = true;
    }
  }
  /** Method that will be called if the fade-in or fade-in transition completed. */
  _finishRippleTransition(rippleRef) {
    if (rippleRef.state === RippleState.FADING_IN) {
      this._startFadeOutTransition(rippleRef);
    } else if (rippleRef.state === RippleState.FADING_OUT) {
      this._destroyRipple(rippleRef);
    }
  }
  /**
   * Starts the fade-out transition of the given ripple if it's not persistent and the pointer
   * is not held down anymore.
   */
  _startFadeOutTransition(rippleRef) {
    const isMostRecentTransientRipple = rippleRef === this._mostRecentTransientRipple;
    const {
      persistent
    } = rippleRef.config;
    rippleRef.state = RippleState.VISIBLE;
    if (!persistent && (!isMostRecentTransientRipple || !this._isPointerDown)) {
      rippleRef.fadeOut();
    }
  }
  /** Destroys the given ripple by removing it from the DOM and updating its state. */
  _destroyRipple(rippleRef) {
    const eventListeners = this._activeRipples.get(rippleRef) ?? null;
    this._activeRipples.delete(rippleRef);
    if (!this._activeRipples.size) {
      this._containerRect = null;
    }
    if (rippleRef === this._mostRecentTransientRipple) {
      this._mostRecentTransientRipple = null;
    }
    rippleRef.state = RippleState.HIDDEN;
    if (eventListeners !== null) {
      rippleRef.element.removeEventListener("transitionend", eventListeners.onTransitionEnd);
      rippleRef.element.removeEventListener("transitioncancel", eventListeners.onTransitionCancel);
      if (eventListeners.fallbackTimer !== null) {
        clearTimeout(eventListeners.fallbackTimer);
      }
    }
    rippleRef.element.remove();
  }
  /** Function being called whenever the trigger is being pressed using mouse. */
  _onMousedown(event) {
    const isFakeMousedown = isFakeMousedownFromScreenReader(event);
    const isSyntheticEvent = this._lastTouchStartEvent && Date.now() < this._lastTouchStartEvent + ignoreMouseEventsTimeout;
    if (!this._target.rippleDisabled && !isFakeMousedown && !isSyntheticEvent) {
      this._isPointerDown = true;
      this.fadeInRipple(event.clientX, event.clientY, this._target.rippleConfig);
    }
  }
  /** Function being called whenever the trigger is being pressed using touch. */
  _onTouchStart(event) {
    if (!this._target.rippleDisabled && !isFakeTouchstartFromScreenReader(event)) {
      this._lastTouchStartEvent = Date.now();
      this._isPointerDown = true;
      const touches = event.changedTouches;
      if (touches) {
        for (let i = 0; i < touches.length; i++) {
          this.fadeInRipple(touches[i].clientX, touches[i].clientY, this._target.rippleConfig);
        }
      }
    }
  }
  /** Function being called whenever the trigger is being released. */
  _onPointerUp() {
    if (!this._isPointerDown) {
      return;
    }
    this._isPointerDown = false;
    this._getActiveRipples().forEach((ripple) => {
      const isVisible = ripple.state === RippleState.VISIBLE || ripple.config.terminateOnPointerUp && ripple.state === RippleState.FADING_IN;
      if (!ripple.config.persistent && isVisible) {
        ripple.fadeOut();
      }
    });
  }
  _getActiveRipples() {
    return Array.from(this._activeRipples.keys());
  }
  /** Removes previously registered event listeners from the trigger element. */
  _removeTriggerEvents() {
    const trigger = this._triggerElement;
    if (trigger) {
      pointerDownEvents.forEach((type) => _RippleRenderer._eventManager.removeHandler(type, trigger, this));
      if (this._pointerUpEventsRegistered) {
        pointerUpEvents.forEach((type) => trigger.removeEventListener(type, this, passiveCapturingEventOptions));
        this._pointerUpEventsRegistered = false;
      }
    }
  }
};
function distanceToFurthestCorner(x, y, rect) {
  const distX = Math.max(Math.abs(x - rect.left), Math.abs(x - rect.right));
  const distY = Math.max(Math.abs(y - rect.top), Math.abs(y - rect.bottom));
  return Math.sqrt(distX * distX + distY * distY);
}
var MAT_RIPPLE_GLOBAL_OPTIONS = new InjectionToken("mat-ripple-global-options");
var MatRipple = class _MatRipple {
  _elementRef = inject2(ElementRef);
  _animationsDisabled = _animationsDisabled();
  /** Custom color for all ripples. */
  color;
  /** Whether the ripples should be visible outside the component's bounds. */
  unbounded;
  /**
   * Whether the ripple always originates from the center of the host element's bounds, rather
   * than originating from the location of the click event.
   */
  centered;
  /**
   * If set, the radius in pixels of foreground ripples when fully expanded. If unset, the radius
   * will be the distance from the center of the ripple to the furthest corner of the host element's
   * bounding rectangle.
   */
  radius = 0;
  /**
   * Configuration for the ripple animation. Allows modifying the enter and exit animation
   * duration of the ripples. The animation durations will be overwritten if the
   * `NoopAnimationsModule` is being used.
   */
  animation;
  /**
   * Whether click events will not trigger the ripple. Ripples can be still launched manually
   * by using the `launch()` method.
   */
  get disabled() {
    return this._disabled;
  }
  set disabled(value) {
    if (value) {
      this.fadeOutAllNonPersistent();
    }
    this._disabled = value;
    this._setupTriggerEventsIfEnabled();
  }
  _disabled = false;
  /**
   * The element that triggers the ripple when click events are received.
   * Defaults to the directive's host element.
   */
  get trigger() {
    return this._trigger || this._elementRef.nativeElement;
  }
  set trigger(trigger) {
    this._trigger = trigger;
    this._setupTriggerEventsIfEnabled();
  }
  _trigger;
  /** Renderer for the ripple DOM manipulations. */
  _rippleRenderer;
  /** Options that are set globally for all ripples. */
  _globalOptions;
  /** @docs-private Whether ripple directive is initialized and the input bindings are set. */
  _isInitialized = false;
  constructor() {
    const ngZone = inject2(NgZone);
    const platform = inject2(Platform);
    const globalOptions = inject2(MAT_RIPPLE_GLOBAL_OPTIONS, {
      optional: true
    });
    const injector = inject2(Injector);
    this._globalOptions = globalOptions || {};
    this._rippleRenderer = new RippleRenderer(this, ngZone, this._elementRef, platform, injector);
  }
  ngOnInit() {
    this._isInitialized = true;
    this._setupTriggerEventsIfEnabled();
  }
  ngOnDestroy() {
    this._rippleRenderer._removeTriggerEvents();
  }
  /** Fades out all currently showing ripple elements. */
  fadeOutAll() {
    this._rippleRenderer.fadeOutAll();
  }
  /** Fades out all currently showing non-persistent ripple elements. */
  fadeOutAllNonPersistent() {
    this._rippleRenderer.fadeOutAllNonPersistent();
  }
  /**
   * Ripple configuration from the directive's input values.
   * @docs-private Implemented as part of RippleTarget
   */
  get rippleConfig() {
    return {
      centered: this.centered,
      radius: this.radius,
      color: this.color,
      animation: __spreadValues(__spreadValues(__spreadValues({}, this._globalOptions.animation), this._animationsDisabled ? {
        enterDuration: 0,
        exitDuration: 0
      } : {}), this.animation),
      terminateOnPointerUp: this._globalOptions.terminateOnPointerUp
    };
  }
  /**
   * Whether ripples on pointer-down are disabled or not.
   * @docs-private Implemented as part of RippleTarget
   */
  get rippleDisabled() {
    return this.disabled || !!this._globalOptions.disabled;
  }
  /** Sets up the trigger event listeners if ripples are enabled. */
  _setupTriggerEventsIfEnabled() {
    if (!this.disabled && this._isInitialized) {
      this._rippleRenderer.setupTriggerEvents(this.trigger);
    }
  }
  /** Launches a manual ripple at the specified coordinated or just by the ripple config. */
  launch(configOrX, y = 0, config2) {
    if (typeof configOrX === "number") {
      return this._rippleRenderer.fadeInRipple(configOrX, y, __spreadValues(__spreadValues({}, this.rippleConfig), config2));
    } else {
      return this._rippleRenderer.fadeInRipple(0, 0, __spreadValues(__spreadValues({}, this.rippleConfig), configOrX));
    }
  }
  static \u0275fac = function MatRipple_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _MatRipple)();
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _MatRipple,
    selectors: [["", "mat-ripple", ""], ["", "matRipple", ""]],
    hostAttrs: [1, "mat-ripple"],
    hostVars: 2,
    hostBindings: function MatRipple_HostBindings(rf, ctx) {
      if (rf & 2) {
        \u0275\u0275classProp("mat-ripple-unbounded", ctx.unbounded);
      }
    },
    inputs: {
      color: [0, "matRippleColor", "color"],
      unbounded: [0, "matRippleUnbounded", "unbounded"],
      centered: [0, "matRippleCentered", "centered"],
      radius: [0, "matRippleRadius", "radius"],
      animation: [0, "matRippleAnimation", "animation"],
      disabled: [0, "matRippleDisabled", "disabled"],
      trigger: [0, "matRippleTrigger", "trigger"]
    },
    exportAs: ["matRipple"]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatRipple, [{
    type: Directive,
    args: [{
      selector: "[mat-ripple], [matRipple]",
      exportAs: "matRipple",
      host: {
        "class": "mat-ripple",
        "[class.mat-ripple-unbounded]": "unbounded"
      }
    }]
  }], () => [], {
    color: [{
      type: Input,
      args: ["matRippleColor"]
    }],
    unbounded: [{
      type: Input,
      args: ["matRippleUnbounded"]
    }],
    centered: [{
      type: Input,
      args: ["matRippleCentered"]
    }],
    radius: [{
      type: Input,
      args: ["matRippleRadius"]
    }],
    animation: [{
      type: Input,
      args: ["matRippleAnimation"]
    }],
    disabled: [{
      type: Input,
      args: ["matRippleDisabled"]
    }],
    trigger: [{
      type: Input,
      args: ["matRippleTrigger"]
    }]
  });
})();

// node_modules/@angular/material/fesm2022/structural-styles-CObeNzjn.mjs
var _StructuralStylesLoader = class __StructuralStylesLoader {
  static \u0275fac = function _StructuralStylesLoader_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || __StructuralStylesLoader)();
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({
    type: __StructuralStylesLoader,
    selectors: [["structural-styles"]],
    decls: 0,
    vars: 0,
    template: function _StructuralStylesLoader_Template(rf, ctx) {
    },
    styles: ['.mat-focus-indicator{position:relative}.mat-focus-indicator::before{top:0;left:0;right:0;bottom:0;position:absolute;box-sizing:border-box;pointer-events:none;display:var(--mat-focus-indicator-display, none);border-width:var(--mat-focus-indicator-border-width, 3px);border-style:var(--mat-focus-indicator-border-style, solid);border-color:var(--mat-focus-indicator-border-color, transparent);border-radius:var(--mat-focus-indicator-border-radius, 4px)}.mat-focus-indicator:focus::before{content:""}@media(forced-colors: active){html{--mat-focus-indicator-display: block}}\n'],
    encapsulation: 2,
    changeDetection: 0
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(_StructuralStylesLoader, [{
    type: Component,
    args: [{
      selector: "structural-styles",
      encapsulation: ViewEncapsulation.None,
      template: "",
      changeDetection: ChangeDetectionStrategy.OnPush,
      styles: ['.mat-focus-indicator{position:relative}.mat-focus-indicator::before{top:0;left:0;right:0;bottom:0;position:absolute;box-sizing:border-box;pointer-events:none;display:var(--mat-focus-indicator-display, none);border-width:var(--mat-focus-indicator-border-width, 3px);border-style:var(--mat-focus-indicator-border-style, solid);border-color:var(--mat-focus-indicator-border-color, transparent);border-radius:var(--mat-focus-indicator-border-radius, 4px)}.mat-focus-indicator:focus::before{content:""}@media(forced-colors: active){html{--mat-focus-indicator-display: block}}\n']
    }]
  }], null, null);
})();

// node_modules/@angular/cdk/fesm2022/directionality-CChdj3az.mjs
var DIR_DOCUMENT = new InjectionToken("cdk-dir-doc", {
  providedIn: "root",
  factory: DIR_DOCUMENT_FACTORY
});
function DIR_DOCUMENT_FACTORY() {
  return inject2(DOCUMENT);
}
var RTL_LOCALE_PATTERN = /^(ar|ckb|dv|he|iw|fa|nqo|ps|sd|ug|ur|yi|.*[-_](Adlm|Arab|Hebr|Nkoo|Rohg|Thaa))(?!.*[-_](Latn|Cyrl)($|-|_))($|-|_)/i;
function _resolveDirectionality(rawValue) {
  const value = rawValue?.toLowerCase() || "";
  if (value === "auto" && typeof navigator !== "undefined" && navigator?.language) {
    return RTL_LOCALE_PATTERN.test(navigator.language) ? "rtl" : "ltr";
  }
  return value === "rtl" ? "rtl" : "ltr";
}
var Directionality = class _Directionality {
  /** The current 'ltr' or 'rtl' value. */
  get value() {
    return this.valueSignal();
  }
  /**
   * The current 'ltr' or 'rtl' value.
   */
  valueSignal = signal("ltr");
  /** Stream that emits whenever the 'ltr' / 'rtl' state changes. */
  change = new EventEmitter();
  constructor() {
    const _document2 = inject2(DIR_DOCUMENT, {
      optional: true
    });
    if (_document2) {
      const bodyDir = _document2.body ? _document2.body.dir : null;
      const htmlDir = _document2.documentElement ? _document2.documentElement.dir : null;
      this.valueSignal.set(_resolveDirectionality(bodyDir || htmlDir || "ltr"));
    }
  }
  ngOnDestroy() {
    this.change.complete();
  }
  static \u0275fac = function Directionality_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _Directionality)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _Directionality,
    factory: _Directionality.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(Directionality, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], () => [], null);
})();

// node_modules/@angular/cdk/fesm2022/bidi.mjs
var Dir = class _Dir {
  /** Whether the `value` has been set to its initial value. */
  _isInitialized = false;
  /** Direction as passed in by the consumer. */
  _rawDir;
  /** Event emitted when the direction changes. */
  change = new EventEmitter();
  /** @docs-private */
  get dir() {
    return this.valueSignal();
  }
  set dir(value) {
    const previousValue = this.valueSignal();
    this.valueSignal.set(_resolveDirectionality(value));
    this._rawDir = value;
    if (previousValue !== this.valueSignal() && this._isInitialized) {
      this.change.emit(this.valueSignal());
    }
  }
  /** Current layout direction of the element. */
  get value() {
    return this.dir;
  }
  valueSignal = signal("ltr");
  /** Initialize once default value has been set. */
  ngAfterContentInit() {
    this._isInitialized = true;
  }
  ngOnDestroy() {
    this.change.complete();
  }
  static \u0275fac = function Dir_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _Dir)();
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _Dir,
    selectors: [["", "dir", ""]],
    hostVars: 1,
    hostBindings: function Dir_HostBindings(rf, ctx) {
      if (rf & 2) {
        \u0275\u0275attribute("dir", ctx._rawDir);
      }
    },
    inputs: {
      dir: "dir"
    },
    outputs: {
      change: "dirChange"
    },
    exportAs: ["dir"],
    features: [\u0275\u0275ProvidersFeature([{
      provide: Directionality,
      useExisting: _Dir
    }])]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(Dir, [{
    type: Directive,
    args: [{
      selector: "[dir]",
      providers: [{
        provide: Directionality,
        useExisting: Dir
      }],
      host: {
        "[attr.dir]": "_rawDir"
      },
      exportAs: "dir"
    }]
  }], null, {
    change: [{
      type: Output,
      args: ["dirChange"]
    }],
    dir: [{
      type: Input
    }]
  });
})();
var BidiModule = class _BidiModule {
  static \u0275fac = function BidiModule_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _BidiModule)();
  };
  static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
    type: _BidiModule,
    imports: [Dir],
    exports: [Dir]
  });
  static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({});
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(BidiModule, [{
    type: NgModule,
    args: [{
      imports: [Dir],
      exports: [Dir]
    }]
  }], null, null);
})();

// node_modules/@angular/material/fesm2022/common-module-cKSwHniA.mjs
var MATERIAL_SANITY_CHECKS = new InjectionToken("mat-sanity-checks", {
  providedIn: "root",
  factory: () => true
});
var MatCommonModule = class _MatCommonModule {
  constructor() {
    inject2(HighContrastModeDetector)._applyBodyHighContrastModeCssClasses();
  }
  static \u0275fac = function MatCommonModule_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _MatCommonModule)();
  };
  static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
    type: _MatCommonModule,
    imports: [BidiModule],
    exports: [BidiModule]
  });
  static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({
    imports: [BidiModule, BidiModule]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatCommonModule, [{
    type: NgModule,
    args: [{
      imports: [BidiModule],
      exports: [BidiModule]
    }]
  }], () => [], null);
})();

// node_modules/@angular/material/fesm2022/divider.mjs
var MatDivider = class _MatDivider {
  /** Whether the divider is vertically aligned. */
  get vertical() {
    return this._vertical;
  }
  set vertical(value) {
    this._vertical = coerceBooleanProperty(value);
  }
  _vertical = false;
  /** Whether the divider is an inset divider. */
  get inset() {
    return this._inset;
  }
  set inset(value) {
    this._inset = coerceBooleanProperty(value);
  }
  _inset = false;
  static \u0275fac = function MatDivider_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _MatDivider)();
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({
    type: _MatDivider,
    selectors: [["mat-divider"]],
    hostAttrs: ["role", "separator", 1, "mat-divider"],
    hostVars: 7,
    hostBindings: function MatDivider_HostBindings(rf, ctx) {
      if (rf & 2) {
        \u0275\u0275attribute("aria-orientation", ctx.vertical ? "vertical" : "horizontal");
        \u0275\u0275classProp("mat-divider-vertical", ctx.vertical)("mat-divider-horizontal", !ctx.vertical)("mat-divider-inset", ctx.inset);
      }
    },
    inputs: {
      vertical: "vertical",
      inset: "inset"
    },
    decls: 0,
    vars: 0,
    template: function MatDivider_Template(rf, ctx) {
    },
    styles: [".mat-divider{display:block;margin:0;border-top-style:solid;border-top-color:var(--mat-divider-color, var(--mat-sys-outline));border-top-width:var(--mat-divider-width, 1px)}.mat-divider.mat-divider-vertical{border-top:0;border-right-style:solid;border-right-color:var(--mat-divider-color, var(--mat-sys-outline));border-right-width:var(--mat-divider-width, 1px)}.mat-divider.mat-divider-inset{margin-left:80px}[dir=rtl] .mat-divider.mat-divider-inset{margin-left:auto;margin-right:80px}\n"],
    encapsulation: 2,
    changeDetection: 0
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatDivider, [{
    type: Component,
    args: [{
      selector: "mat-divider",
      host: {
        "role": "separator",
        "[attr.aria-orientation]": 'vertical ? "vertical" : "horizontal"',
        "[class.mat-divider-vertical]": "vertical",
        "[class.mat-divider-horizontal]": "!vertical",
        "[class.mat-divider-inset]": "inset",
        "class": "mat-divider"
      },
      template: "",
      encapsulation: ViewEncapsulation.None,
      changeDetection: ChangeDetectionStrategy.OnPush,
      styles: [".mat-divider{display:block;margin:0;border-top-style:solid;border-top-color:var(--mat-divider-color, var(--mat-sys-outline));border-top-width:var(--mat-divider-width, 1px)}.mat-divider.mat-divider-vertical{border-top:0;border-right-style:solid;border-right-color:var(--mat-divider-color, var(--mat-sys-outline));border-right-width:var(--mat-divider-width, 1px)}.mat-divider.mat-divider-inset{margin-left:80px}[dir=rtl] .mat-divider.mat-divider-inset{margin-left:auto;margin-right:80px}\n"]
    }]
  }], null, {
    vertical: [{
      type: Input
    }],
    inset: [{
      type: Input
    }]
  });
})();
var MatDividerModule = class _MatDividerModule {
  static \u0275fac = function MatDividerModule_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _MatDividerModule)();
  };
  static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
    type: _MatDividerModule,
    imports: [MatCommonModule, MatDivider],
    exports: [MatDivider, MatCommonModule]
  });
  static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({
    imports: [MatCommonModule, MatCommonModule]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatDividerModule, [{
    type: NgModule,
    args: [{
      imports: [MatCommonModule, MatDivider],
      exports: [MatDivider, MatCommonModule]
    }]
  }], null, null);
})();

// node_modules/@angular/cdk/fesm2022/data-source-D34wiQZj.mjs
var DataSource = class {
};
function isDataSource(value) {
  return value && typeof value.connect === "function" && !(value instanceof ConnectableObservable);
}

// node_modules/@angular/cdk/fesm2022/recycle-view-repeater-strategy-SfuyU210.mjs
var ArrayDataSource = class extends DataSource {
  _data;
  constructor(_data) {
    super();
    this._data = _data;
  }
  connect() {
    return isObservable(this._data) ? this._data : of(this._data);
  }
  disconnect() {
  }
};
var _ViewRepeaterOperation;
(function(_ViewRepeaterOperation2) {
  _ViewRepeaterOperation2[_ViewRepeaterOperation2["REPLACED"] = 0] = "REPLACED";
  _ViewRepeaterOperation2[_ViewRepeaterOperation2["INSERTED"] = 1] = "INSERTED";
  _ViewRepeaterOperation2[_ViewRepeaterOperation2["MOVED"] = 2] = "MOVED";
  _ViewRepeaterOperation2[_ViewRepeaterOperation2["REMOVED"] = 3] = "REMOVED";
})(_ViewRepeaterOperation || (_ViewRepeaterOperation = {}));
var _VIEW_REPEATER_STRATEGY = new InjectionToken("_ViewRepeater");
var _RecycleViewRepeaterStrategy = class {
  /**
   * The size of the cache used to store unused views.
   * Setting the cache size to `0` will disable caching. Defaults to 20 views.
   */
  viewCacheSize = 20;
  /**
   * View cache that stores embedded view instances that have been previously stamped out,
   * but don't are not currently rendered. The view repeater will reuse these views rather than
   * creating brand new ones.
   *
   * TODO(michaeljamesparsons) Investigate whether using a linked list would improve performance.
   */
  _viewCache = [];
  /** Apply changes to the DOM. */
  applyChanges(changes, viewContainerRef, itemContextFactory, itemValueResolver, itemViewChanged) {
    changes.forEachOperation((record, adjustedPreviousIndex, currentIndex) => {
      let view;
      let operation;
      if (record.previousIndex == null) {
        const viewArgsFactory = () => itemContextFactory(record, adjustedPreviousIndex, currentIndex);
        view = this._insertView(viewArgsFactory, currentIndex, viewContainerRef, itemValueResolver(record));
        operation = view ? _ViewRepeaterOperation.INSERTED : _ViewRepeaterOperation.REPLACED;
      } else if (currentIndex == null) {
        this._detachAndCacheView(adjustedPreviousIndex, viewContainerRef);
        operation = _ViewRepeaterOperation.REMOVED;
      } else {
        view = this._moveView(adjustedPreviousIndex, currentIndex, viewContainerRef, itemValueResolver(record));
        operation = _ViewRepeaterOperation.MOVED;
      }
      if (itemViewChanged) {
        itemViewChanged({
          context: view?.context,
          operation,
          record
        });
      }
    });
  }
  detach() {
    for (const view of this._viewCache) {
      view.destroy();
    }
    this._viewCache = [];
  }
  /**
   * Inserts a view for a new item, either from the cache or by creating a new
   * one. Returns `undefined` if the item was inserted into a cached view.
   */
  _insertView(viewArgsFactory, currentIndex, viewContainerRef, value) {
    const cachedView = this._insertViewFromCache(currentIndex, viewContainerRef);
    if (cachedView) {
      cachedView.context.$implicit = value;
      return void 0;
    }
    const viewArgs = viewArgsFactory();
    return viewContainerRef.createEmbeddedView(viewArgs.templateRef, viewArgs.context, viewArgs.index);
  }
  /** Detaches the view at the given index and inserts into the view cache. */
  _detachAndCacheView(index, viewContainerRef) {
    const detachedView = viewContainerRef.detach(index);
    this._maybeCacheView(detachedView, viewContainerRef);
  }
  /** Moves view at the previous index to the current index. */
  _moveView(adjustedPreviousIndex, currentIndex, viewContainerRef, value) {
    const view = viewContainerRef.get(adjustedPreviousIndex);
    viewContainerRef.move(view, currentIndex);
    view.context.$implicit = value;
    return view;
  }
  /**
   * Cache the given detached view. If the cache is full, the view will be
   * destroyed.
   */
  _maybeCacheView(view, viewContainerRef) {
    if (this._viewCache.length < this.viewCacheSize) {
      this._viewCache.push(view);
    } else {
      const index = viewContainerRef.indexOf(view);
      if (index === -1) {
        view.destroy();
      } else {
        viewContainerRef.remove(index);
      }
    }
  }
  /** Inserts a recycled view from the cache at the given index. */
  _insertViewFromCache(index, viewContainerRef) {
    const cachedView = this._viewCache.pop();
    if (cachedView) {
      viewContainerRef.insert(cachedView, index);
    }
    return cachedView || null;
  }
};

// node_modules/@angular/cdk/fesm2022/selection-model-BCgC8uEN.mjs
var SelectionModel = class {
  _multiple;
  _emitChanges;
  compareWith;
  /** Currently-selected values. */
  _selection = /* @__PURE__ */ new Set();
  /** Keeps track of the deselected options that haven't been emitted by the change event. */
  _deselectedToEmit = [];
  /** Keeps track of the selected options that haven't been emitted by the change event. */
  _selectedToEmit = [];
  /** Cache for the array value of the selected items. */
  _selected;
  /** Selected values. */
  get selected() {
    if (!this._selected) {
      this._selected = Array.from(this._selection.values());
    }
    return this._selected;
  }
  /** Event emitted when the value has changed. */
  changed = new Subject();
  constructor(_multiple = false, initiallySelectedValues, _emitChanges = true, compareWith) {
    this._multiple = _multiple;
    this._emitChanges = _emitChanges;
    this.compareWith = compareWith;
    if (initiallySelectedValues && initiallySelectedValues.length) {
      if (_multiple) {
        initiallySelectedValues.forEach((value) => this._markSelected(value));
      } else {
        this._markSelected(initiallySelectedValues[0]);
      }
      this._selectedToEmit.length = 0;
    }
  }
  /**
   * Selects a value or an array of values.
   * @param values The values to select
   * @return Whether the selection changed as a result of this call
   */
  select(...values) {
    this._verifyValueAssignment(values);
    values.forEach((value) => this._markSelected(value));
    const changed = this._hasQueuedChanges();
    this._emitChangeEvent();
    return changed;
  }
  /**
   * Deselects a value or an array of values.
   * @param values The values to deselect
   * @return Whether the selection changed as a result of this call
   */
  deselect(...values) {
    this._verifyValueAssignment(values);
    values.forEach((value) => this._unmarkSelected(value));
    const changed = this._hasQueuedChanges();
    this._emitChangeEvent();
    return changed;
  }
  /**
   * Sets the selected values
   * @param values The new selected values
   * @return Whether the selection changed as a result of this call
   */
  setSelection(...values) {
    this._verifyValueAssignment(values);
    const oldValues = this.selected;
    const newSelectedSet = new Set(values.map((value) => this._getConcreteValue(value)));
    values.forEach((value) => this._markSelected(value));
    oldValues.filter((value) => !newSelectedSet.has(this._getConcreteValue(value, newSelectedSet))).forEach((value) => this._unmarkSelected(value));
    const changed = this._hasQueuedChanges();
    this._emitChangeEvent();
    return changed;
  }
  /**
   * Toggles a value between selected and deselected.
   * @param value The value to toggle
   * @return Whether the selection changed as a result of this call
   */
  toggle(value) {
    return this.isSelected(value) ? this.deselect(value) : this.select(value);
  }
  /**
   * Clears all of the selected values.
   * @param flushEvent Whether to flush the changes in an event.
   *   If false, the changes to the selection will be flushed along with the next event.
   * @return Whether the selection changed as a result of this call
   */
  clear(flushEvent = true) {
    this._unmarkAll();
    const changed = this._hasQueuedChanges();
    if (flushEvent) {
      this._emitChangeEvent();
    }
    return changed;
  }
  /**
   * Determines whether a value is selected.
   */
  isSelected(value) {
    return this._selection.has(this._getConcreteValue(value));
  }
  /**
   * Determines whether the model does not have a value.
   */
  isEmpty() {
    return this._selection.size === 0;
  }
  /**
   * Determines whether the model has a value.
   */
  hasValue() {
    return !this.isEmpty();
  }
  /**
   * Sorts the selected values based on a predicate function.
   */
  sort(predicate) {
    if (this._multiple && this.selected) {
      this._selected.sort(predicate);
    }
  }
  /**
   * Gets whether multiple values can be selected.
   */
  isMultipleSelection() {
    return this._multiple;
  }
  /** Emits a change event and clears the records of selected and deselected values. */
  _emitChangeEvent() {
    this._selected = null;
    if (this._selectedToEmit.length || this._deselectedToEmit.length) {
      this.changed.next({
        source: this,
        added: this._selectedToEmit,
        removed: this._deselectedToEmit
      });
      this._deselectedToEmit = [];
      this._selectedToEmit = [];
    }
  }
  /** Selects a value. */
  _markSelected(value) {
    value = this._getConcreteValue(value);
    if (!this.isSelected(value)) {
      if (!this._multiple) {
        this._unmarkAll();
      }
      if (!this.isSelected(value)) {
        this._selection.add(value);
      }
      if (this._emitChanges) {
        this._selectedToEmit.push(value);
      }
    }
  }
  /** Deselects a value. */
  _unmarkSelected(value) {
    value = this._getConcreteValue(value);
    if (this.isSelected(value)) {
      this._selection.delete(value);
      if (this._emitChanges) {
        this._deselectedToEmit.push(value);
      }
    }
  }
  /** Clears out the selected values. */
  _unmarkAll() {
    if (!this.isEmpty()) {
      this._selection.forEach((value) => this._unmarkSelected(value));
    }
  }
  /**
   * Verifies the value assignment and throws an error if the specified value array is
   * including multiple values while the selection model is not supporting multiple values.
   */
  _verifyValueAssignment(values) {
    if (values.length > 1 && !this._multiple && (typeof ngDevMode === "undefined" || ngDevMode)) {
      throw getMultipleValuesInSingleSelectionError();
    }
  }
  /** Whether there are queued up change to be emitted. */
  _hasQueuedChanges() {
    return !!(this._deselectedToEmit.length || this._selectedToEmit.length);
  }
  /** Returns a value that is comparable to inputValue by applying compareWith function, returns the same inputValue otherwise. */
  _getConcreteValue(inputValue, selection) {
    if (!this.compareWith) {
      return inputValue;
    } else {
      selection = selection ?? this._selection;
      for (let selectedValue of selection) {
        if (this.compareWith(inputValue, selectedValue)) {
          return selectedValue;
        }
      }
      return inputValue;
    }
  }
};
function getMultipleValuesInSingleSelectionError() {
  return Error("Cannot pass multiple values into SelectionModel with single-value mode.");
}

// node_modules/@angular/forms/fesm2022/forms.mjs
var BaseControlValueAccessor = class _BaseControlValueAccessor {
  _renderer;
  _elementRef;
  /**
   * The registered callback function called when a change or input event occurs on the input
   * element.
   * @docs-private
   */
  onChange = (_4) => {
  };
  /**
   * The registered callback function called when a blur event occurs on the input element.
   * @docs-private
   */
  onTouched = () => {
  };
  constructor(_renderer, _elementRef) {
    this._renderer = _renderer;
    this._elementRef = _elementRef;
  }
  /**
   * Helper method that sets a property on a target element using the current Renderer
   * implementation.
   * @docs-private
   */
  setProperty(key, value) {
    this._renderer.setProperty(this._elementRef.nativeElement, key, value);
  }
  /**
   * Registers a function called when the control is touched.
   * @docs-private
   */
  registerOnTouched(fn) {
    this.onTouched = fn;
  }
  /**
   * Registers a function called when the control value changes.
   * @docs-private
   */
  registerOnChange(fn) {
    this.onChange = fn;
  }
  /**
   * Sets the "disabled" property on the range input element.
   * @docs-private
   */
  setDisabledState(isDisabled) {
    this.setProperty("disabled", isDisabled);
  }
  static \u0275fac = function BaseControlValueAccessor_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _BaseControlValueAccessor)(\u0275\u0275directiveInject(Renderer2), \u0275\u0275directiveInject(ElementRef));
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _BaseControlValueAccessor
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(BaseControlValueAccessor, [{
    type: Directive
  }], () => [{
    type: Renderer2
  }, {
    type: ElementRef
  }], null);
})();
var BuiltInControlValueAccessor = class _BuiltInControlValueAccessor extends BaseControlValueAccessor {
  static \u0275fac = /* @__PURE__ */ (() => {
    let \u0275BuiltInControlValueAccessor_BaseFactory;
    return function BuiltInControlValueAccessor_Factory(__ngFactoryType__) {
      return (\u0275BuiltInControlValueAccessor_BaseFactory || (\u0275BuiltInControlValueAccessor_BaseFactory = \u0275\u0275getInheritedFactory(_BuiltInControlValueAccessor)))(__ngFactoryType__ || _BuiltInControlValueAccessor);
    };
  })();
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _BuiltInControlValueAccessor,
    features: [\u0275\u0275InheritDefinitionFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(BuiltInControlValueAccessor, [{
    type: Directive
  }], null, null);
})();
var NG_VALUE_ACCESSOR = new InjectionToken(ngDevMode ? "NgValueAccessor" : "");
var CHECKBOX_VALUE_ACCESSOR = {
  provide: NG_VALUE_ACCESSOR,
  useExisting: forwardRef(() => CheckboxControlValueAccessor),
  multi: true
};
var CheckboxControlValueAccessor = class _CheckboxControlValueAccessor extends BuiltInControlValueAccessor {
  /**
   * Sets the "checked" property on the input element.
   * @docs-private
   */
  writeValue(value) {
    this.setProperty("checked", value);
  }
  static \u0275fac = /* @__PURE__ */ (() => {
    let \u0275CheckboxControlValueAccessor_BaseFactory;
    return function CheckboxControlValueAccessor_Factory(__ngFactoryType__) {
      return (\u0275CheckboxControlValueAccessor_BaseFactory || (\u0275CheckboxControlValueAccessor_BaseFactory = \u0275\u0275getInheritedFactory(_CheckboxControlValueAccessor)))(__ngFactoryType__ || _CheckboxControlValueAccessor);
    };
  })();
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _CheckboxControlValueAccessor,
    selectors: [["input", "type", "checkbox", "formControlName", ""], ["input", "type", "checkbox", "formControl", ""], ["input", "type", "checkbox", "ngModel", ""]],
    hostBindings: function CheckboxControlValueAccessor_HostBindings(rf, ctx) {
      if (rf & 1) {
        \u0275\u0275listener("change", function CheckboxControlValueAccessor_change_HostBindingHandler($event) {
          return ctx.onChange($event.target.checked);
        })("blur", function CheckboxControlValueAccessor_blur_HostBindingHandler() {
          return ctx.onTouched();
        });
      }
    },
    standalone: false,
    features: [\u0275\u0275ProvidersFeature([CHECKBOX_VALUE_ACCESSOR]), \u0275\u0275InheritDefinitionFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CheckboxControlValueAccessor, [{
    type: Directive,
    args: [{
      selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]",
      host: {
        "(change)": "onChange($any($event.target).checked)",
        "(blur)": "onTouched()"
      },
      providers: [CHECKBOX_VALUE_ACCESSOR],
      standalone: false
    }]
  }], null, null);
})();
var DEFAULT_VALUE_ACCESSOR = {
  provide: NG_VALUE_ACCESSOR,
  useExisting: forwardRef(() => DefaultValueAccessor),
  multi: true
};
function _isAndroid() {
  const userAgent = getDOM() ? getDOM().getUserAgent() : "";
  return /android (\d+)/.test(userAgent.toLowerCase());
}
var COMPOSITION_BUFFER_MODE = new InjectionToken(ngDevMode ? "CompositionEventMode" : "");
var DefaultValueAccessor = class _DefaultValueAccessor extends BaseControlValueAccessor {
  _compositionMode;
  /** Whether the user is creating a composition string (IME events). */
  _composing = false;
  constructor(renderer, elementRef, _compositionMode) {
    super(renderer, elementRef);
    this._compositionMode = _compositionMode;
    if (this._compositionMode == null) {
      this._compositionMode = !_isAndroid();
    }
  }
  /**
   * Sets the "value" property on the input element.
   * @docs-private
   */
  writeValue(value) {
    const normalizedValue = value == null ? "" : value;
    this.setProperty("value", normalizedValue);
  }
  /** @internal */
  _handleInput(value) {
    if (!this._compositionMode || this._compositionMode && !this._composing) {
      this.onChange(value);
    }
  }
  /** @internal */
  _compositionStart() {
    this._composing = true;
  }
  /** @internal */
  _compositionEnd(value) {
    this._composing = false;
    this._compositionMode && this.onChange(value);
  }
  static \u0275fac = function DefaultValueAccessor_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _DefaultValueAccessor)(\u0275\u0275directiveInject(Renderer2), \u0275\u0275directiveInject(ElementRef), \u0275\u0275directiveInject(COMPOSITION_BUFFER_MODE, 8));
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _DefaultValueAccessor,
    selectors: [["input", "formControlName", "", 3, "type", "checkbox"], ["textarea", "formControlName", ""], ["input", "formControl", "", 3, "type", "checkbox"], ["textarea", "formControl", ""], ["input", "ngModel", "", 3, "type", "checkbox"], ["textarea", "ngModel", ""], ["", "ngDefaultControl", ""]],
    hostBindings: function DefaultValueAccessor_HostBindings(rf, ctx) {
      if (rf & 1) {
        \u0275\u0275listener("input", function DefaultValueAccessor_input_HostBindingHandler($event) {
          return ctx._handleInput($event.target.value);
        })("blur", function DefaultValueAccessor_blur_HostBindingHandler() {
          return ctx.onTouched();
        })("compositionstart", function DefaultValueAccessor_compositionstart_HostBindingHandler() {
          return ctx._compositionStart();
        })("compositionend", function DefaultValueAccessor_compositionend_HostBindingHandler($event) {
          return ctx._compositionEnd($event.target.value);
        });
      }
    },
    standalone: false,
    features: [\u0275\u0275ProvidersFeature([DEFAULT_VALUE_ACCESSOR]), \u0275\u0275InheritDefinitionFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(DefaultValueAccessor, [{
    type: Directive,
    args: [{
      selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]",
      // TODO: vsavkin replace the above selector with the one below it once
      // https://github.com/angular/angular/issues/3011 is implemented
      // selector: '[ngModel],[formControl],[formControlName]',
      host: {
        "(input)": "_handleInput($any($event.target).value)",
        "(blur)": "onTouched()",
        "(compositionstart)": "_compositionStart()",
        "(compositionend)": "_compositionEnd($any($event.target).value)"
      },
      providers: [DEFAULT_VALUE_ACCESSOR],
      standalone: false
    }]
  }], () => [{
    type: Renderer2
  }, {
    type: ElementRef
  }, {
    type: void 0,
    decorators: [{
      type: Optional
    }, {
      type: Inject,
      args: [COMPOSITION_BUFFER_MODE]
    }]
  }], null);
})();
function isEmptyInputValue(value) {
  return value == null || lengthOrSize(value) === 0;
}
function lengthOrSize(value) {
  if (value == null) {
    return null;
  } else if (Array.isArray(value) || typeof value === "string") {
    return value.length;
  } else if (value instanceof Set) {
    return value.size;
  }
  return null;
}
var NG_VALIDATORS = new InjectionToken(ngDevMode ? "NgValidators" : "");
var NG_ASYNC_VALIDATORS = new InjectionToken(ngDevMode ? "NgAsyncValidators" : "");
var EMAIL_REGEXP = /^(?=.{1,254}$)(?=.{1,64}@)[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
var Validators = class {
  /**
   * @description
   * Validator that requires the control's value to be greater than or equal to the provided number.
   *
   * @usageNotes
   *
   * ### Validate against a minimum of 3
   *
   * ```ts
   * const control = new FormControl(2, Validators.min(3));
   *
   * console.log(control.errors); // {min: {min: 3, actual: 2}}
   * ```
   *
   * @returns A validator function that returns an error map with the
   * `min` property if the validation check fails, otherwise `null`.
   *
   * @see {@link /api/forms/AbstractControl#updateValueAndValidity updateValueAndValidity}
   *
   */
  static min(min) {
    return minValidator(min);
  }
  /**
   * @description
   * Validator that requires the control's value to be less than or equal to the provided number.
   *
   * @usageNotes
   *
   * ### Validate against a maximum of 15
   *
   * ```ts
   * const control = new FormControl(16, Validators.max(15));
   *
   * console.log(control.errors); // {max: {max: 15, actual: 16}}
   * ```
   *
   * @returns A validator function that returns an error map with the
   * `max` property if the validation check fails, otherwise `null`.
   *
   * @see {@link /api/forms/AbstractControl#updateValueAndValidity updateValueAndValidity}
   *
   */
  static max(max) {
    return maxValidator(max);
  }
  /**
   * @description
   * Validator that requires the control have a non-empty value.
   *
   * @usageNotes
   *
   * ### Validate that the field is non-empty
   *
   * ```ts
   * const control = new FormControl('', Validators.required);
   *
   * console.log(control.errors); // {required: true}
   * ```
   *
   * @returns An error map with the `required` property
   * if the validation check fails, otherwise `null`.
   *
   * @see {@link /api/forms/AbstractControl#updateValueAndValidity updateValueAndValidity}
   *
   */
  static required(control) {
    return requiredValidator(control);
  }
  /**
   * @description
   * Validator that requires the control's value be true. This validator is commonly
   * used for required checkboxes.
   *
   * @usageNotes
   *
   * ### Validate that the field value is true
   *
   * ```ts
   * const control = new FormControl('some value', Validators.requiredTrue);
   *
   * console.log(control.errors); // {required: true}
   * ```
   *
   * @returns An error map that contains the `required` property
   * set to `true` if the validation check fails, otherwise `null`.
   *
   * @see {@link /api/forms/AbstractControl#updateValueAndValidity updateValueAndValidity}
   *
   */
  static requiredTrue(control) {
    return requiredTrueValidator(control);
  }
  /**
   * @description
   * Validator that requires the control's value pass an email validation test.
   *
   * Tests the value using a [regular
   * expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions)
   * pattern suitable for common use cases. The pattern is based on the definition of a valid email
   * address in the [WHATWG HTML
   * specification](https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address) with
   * some enhancements to incorporate more RFC rules (such as rules related to domain names and the
   * lengths of different parts of the address).
   *
   * The differences from the WHATWG version include:
   * - Disallow `local-part` (the part before the `@` symbol) to begin or end with a period (`.`).
   * - Disallow `local-part` to be longer than 64 characters.
   * - Disallow the whole address to be longer than 254 characters.
   *
   * If this pattern does not satisfy your business needs, you can use `Validators.pattern()` to
   * validate the value against a different pattern.
   *
   * @usageNotes
   *
   * ### Validate that the field matches a valid email pattern
   *
   * ```ts
   * const control = new FormControl('bad@', Validators.email);
   *
   * console.log(control.errors); // {email: true}
   * ```
   *
   * @returns An error map with the `email` property
   * if the validation check fails, otherwise `null`.
   *
   * @see {@link /api/forms/AbstractControl#updateValueAndValidity updateValueAndValidity}
   *
   */
  static email(control) {
    return emailValidator(control);
  }
  /**
   * @description
   * Validator that requires the number of items in the control's value to be greater than or equal
   * to the provided minimum length. This validator is also provided by default if you use
   * the HTML5 `minlength` attribute. Note that the `minLength` validator is intended to be used
   * only for types that have a numeric `length` or `size` property, such as strings, arrays or
   * sets. The `minLength` validator logic is also not invoked for values when their `length` or
   * `size` property is 0 (for example in case of an empty string or an empty array), to support
   * optional controls. You can use the standard `required` validator if empty values should not be
   * considered valid.
   *
   * @usageNotes
   *
   * ### Validate that the field has a minimum of 3 characters
   *
   * ```ts
   * const control = new FormControl('ng', Validators.minLength(3));
   *
   * console.log(control.errors); // {minlength: {requiredLength: 3, actualLength: 2}}
   * ```
   *
   * ```html
   * <input minlength="5">
   * ```
   *
   * @returns A validator function that returns an error map with the
   * `minlength` property if the validation check fails, otherwise `null`.
   *
   * @see {@link /api/forms/AbstractControl#updateValueAndValidity updateValueAndValidity}
   *
   */
  static minLength(minLength) {
    return minLengthValidator(minLength);
  }
  /**
   * @description
   * Validator that requires the number of items in the control's value to be less than or equal
   * to the provided maximum length. This validator is also provided by default if you use
   * the HTML5 `maxlength` attribute. Note that the `maxLength` validator is intended to be used
   * only for types that have a numeric `length` or `size` property, such as strings, arrays or
   * sets.
   *
   * @usageNotes
   *
   * ### Validate that the field has maximum of 5 characters
   *
   * ```ts
   * const control = new FormControl('Angular', Validators.maxLength(5));
   *
   * console.log(control.errors); // {maxlength: {requiredLength: 5, actualLength: 7}}
   * ```
   *
   * ```html
   * <input maxlength="5">
   * ```
   *
   * @returns A validator function that returns an error map with the
   * `maxlength` property if the validation check fails, otherwise `null`.
   *
   * @see {@link /api/forms/AbstractControl#updateValueAndValidity updateValueAndValidity}
   *
   */
  static maxLength(maxLength) {
    return maxLengthValidator(maxLength);
  }
  /**
   * @description
   * Validator that requires the control's value to match a regex pattern. This validator is also
   * provided by default if you use the HTML5 `pattern` attribute.
   *
   * @usageNotes
   *
   * ### Validate that the field only contains letters or spaces
   *
   * ```ts
   * const control = new FormControl('1', Validators.pattern('[a-zA-Z ]*'));
   *
   * console.log(control.errors); // {pattern: {requiredPattern: '^[a-zA-Z ]*$', actualValue: '1'}}
   * ```
   *
   * ```html
   * <input pattern="[a-zA-Z ]*">
   * ```
   *
   * ### Pattern matching with the global or sticky flag
   *
   * `RegExp` objects created with the `g` or `y` flags that are passed into `Validators.pattern`
   * can produce different results on the same input when validations are run consecutively. This is
   * due to how the behavior of `RegExp.prototype.test` is
   * specified in [ECMA-262](https://tc39.es/ecma262/#sec-regexpbuiltinexec)
   * (`RegExp` preserves the index of the last match when the global or sticky flag is used).
   * Due to this behavior, it is recommended that when using
   * `Validators.pattern` you **do not** pass in a `RegExp` object with either the global or sticky
   * flag enabled.
   *
   * ```ts
   * // Not recommended (since the `g` flag is used)
   * const controlOne = new FormControl('1', Validators.pattern(/foo/g));
   *
   * // Good
   * const controlTwo = new FormControl('1', Validators.pattern(/foo/));
   * ```
   *
   * @param pattern A regular expression to be used as is to test the values, or a string.
   * If a string is passed, the `^` character is prepended and the `$` character is
   * appended to the provided string (if not already present), and the resulting regular
   * expression is used to test the values.
   *
   * @returns A validator function that returns an error map with the
   * `pattern` property if the validation check fails, otherwise `null`.
   *
   * @see {@link /api/forms/AbstractControl#updateValueAndValidity updateValueAndValidity}
   *
   */
  static pattern(pattern) {
    return patternValidator(pattern);
  }
  /**
   * @description
   * Validator that performs no operation.
   *
   * @see {@link /api/forms/AbstractControl#updateValueAndValidity updateValueAndValidity}
   *
   */
  static nullValidator(control) {
    return nullValidator();
  }
  static compose(validators) {
    return compose(validators);
  }
  /**
   * @description
   * Compose multiple async validators into a single function that returns the union
   * of the individual error objects for the provided control.
   *
   * @returns A validator function that returns an error map with the
   * merged error objects of the async validators if the validation check fails, otherwise `null`.
   *
   * @see {@link /api/forms/AbstractControl#updateValueAndValidity updateValueAndValidity}
   *
   */
  static composeAsync(validators) {
    return composeAsync(validators);
  }
};
function minValidator(min) {
  return (control) => {
    if (control.value == null || min == null) {
      return null;
    }
    const value = parseFloat(control.value);
    return !isNaN(value) && value < min ? {
      "min": {
        "min": min,
        "actual": control.value
      }
    } : null;
  };
}
function maxValidator(max) {
  return (control) => {
    if (control.value == null || max == null) {
      return null;
    }
    const value = parseFloat(control.value);
    return !isNaN(value) && value > max ? {
      "max": {
        "max": max,
        "actual": control.value
      }
    } : null;
  };
}
function requiredValidator(control) {
  return isEmptyInputValue(control.value) ? {
    "required": true
  } : null;
}
function requiredTrueValidator(control) {
  return control.value === true ? null : {
    "required": true
  };
}
function emailValidator(control) {
  if (isEmptyInputValue(control.value)) {
    return null;
  }
  return EMAIL_REGEXP.test(control.value) ? null : {
    "email": true
  };
}
function minLengthValidator(minLength) {
  return (control) => {
    const length = control.value?.length ?? lengthOrSize(control.value);
    if (length === null || length === 0) {
      return null;
    }
    return length < minLength ? {
      "minlength": {
        "requiredLength": minLength,
        "actualLength": length
      }
    } : null;
  };
}
function maxLengthValidator(maxLength) {
  return (control) => {
    const length = control.value?.length ?? lengthOrSize(control.value);
    if (length !== null && length > maxLength) {
      return {
        "maxlength": {
          "requiredLength": maxLength,
          "actualLength": length
        }
      };
    }
    return null;
  };
}
function patternValidator(pattern) {
  if (!pattern) return nullValidator;
  let regex;
  let regexStr;
  if (typeof pattern === "string") {
    regexStr = "";
    if (pattern.charAt(0) !== "^") regexStr += "^";
    regexStr += pattern;
    if (pattern.charAt(pattern.length - 1) !== "$") regexStr += "$";
    regex = new RegExp(regexStr);
  } else {
    regexStr = pattern.toString();
    regex = pattern;
  }
  return (control) => {
    if (isEmptyInputValue(control.value)) {
      return null;
    }
    const value = control.value;
    return regex.test(value) ? null : {
      "pattern": {
        "requiredPattern": regexStr,
        "actualValue": value
      }
    };
  };
}
function nullValidator(control) {
  return null;
}
function isPresent(o) {
  return o != null;
}
function toObservable(value) {
  const obs = isPromise2(value) ? from(value) : value;
  if ((typeof ngDevMode === "undefined" || ngDevMode) && !isSubscribable(obs)) {
    let errorMessage = `Expected async validator to return Promise or Observable.`;
    if (typeof value === "object") {
      errorMessage += " Are you using a synchronous validator where an async validator is expected?";
    }
    throw new RuntimeError(-1101, errorMessage);
  }
  return obs;
}
function mergeErrors(arrayOfErrors) {
  let res = {};
  arrayOfErrors.forEach((errors) => {
    res = errors != null ? __spreadValues(__spreadValues({}, res), errors) : res;
  });
  return Object.keys(res).length === 0 ? null : res;
}
function executeValidators(control, validators) {
  return validators.map((validator) => validator(control));
}
function isValidatorFn(validator) {
  return !validator.validate;
}
function normalizeValidators(validators) {
  return validators.map((validator) => {
    return isValidatorFn(validator) ? validator : (c) => validator.validate(c);
  });
}
function compose(validators) {
  if (!validators) return null;
  const presentValidators = validators.filter(isPresent);
  if (presentValidators.length == 0) return null;
  return function(control) {
    return mergeErrors(executeValidators(control, presentValidators));
  };
}
function composeValidators(validators) {
  return validators != null ? compose(normalizeValidators(validators)) : null;
}
function composeAsync(validators) {
  if (!validators) return null;
  const presentValidators = validators.filter(isPresent);
  if (presentValidators.length == 0) return null;
  return function(control) {
    const observables = executeValidators(control, presentValidators).map(toObservable);
    return forkJoin(observables).pipe(map(mergeErrors));
  };
}
function composeAsyncValidators(validators) {
  return validators != null ? composeAsync(normalizeValidators(validators)) : null;
}
function mergeValidators(controlValidators, dirValidator) {
  if (controlValidators === null) return [dirValidator];
  return Array.isArray(controlValidators) ? [...controlValidators, dirValidator] : [controlValidators, dirValidator];
}
function getControlValidators(control) {
  return control._rawValidators;
}
function getControlAsyncValidators(control) {
  return control._rawAsyncValidators;
}
function makeValidatorsArray(validators) {
  if (!validators) return [];
  return Array.isArray(validators) ? validators : [validators];
}
function hasValidator(validators, validator) {
  return Array.isArray(validators) ? validators.includes(validator) : validators === validator;
}
function addValidators(validators, currentValidators) {
  const current = makeValidatorsArray(currentValidators);
  const validatorsToAdd = makeValidatorsArray(validators);
  validatorsToAdd.forEach((v) => {
    if (!hasValidator(current, v)) {
      current.push(v);
    }
  });
  return current;
}
function removeValidators(validators, currentValidators) {
  return makeValidatorsArray(currentValidators).filter((v) => !hasValidator(validators, v));
}
var AbstractControlDirective = class {
  /**
   * @description
   * Reports the value of the control if it is present, otherwise null.
   */
  get value() {
    return this.control ? this.control.value : null;
  }
  /**
   * @description
   * Reports whether the control is valid. A control is considered valid if no
   * validation errors exist with the current value.
   * If the control is not present, null is returned.
   */
  get valid() {
    return this.control ? this.control.valid : null;
  }
  /**
   * @description
   * Reports whether the control is invalid, meaning that an error exists in the input value.
   * If the control is not present, null is returned.
   */
  get invalid() {
    return this.control ? this.control.invalid : null;
  }
  /**
   * @description
   * Reports whether a control is pending, meaning that async validation is occurring and
   * errors are not yet available for the input value. If the control is not present, null is
   * returned.
   */
  get pending() {
    return this.control ? this.control.pending : null;
  }
  /**
   * @description
   * Reports whether the control is disabled, meaning that the control is disabled
   * in the UI and is exempt from validation checks and excluded from aggregate
   * values of ancestor controls. If the control is not present, null is returned.
   */
  get disabled() {
    return this.control ? this.control.disabled : null;
  }
  /**
   * @description
   * Reports whether the control is enabled, meaning that the control is included in ancestor
   * calculations of validity or value. If the control is not present, null is returned.
   */
  get enabled() {
    return this.control ? this.control.enabled : null;
  }
  /**
   * @description
   * Reports the control's validation errors. If the control is not present, null is returned.
   */
  get errors() {
    return this.control ? this.control.errors : null;
  }
  /**
   * @description
   * Reports whether the control is pristine, meaning that the user has not yet changed
   * the value in the UI. If the control is not present, null is returned.
   */
  get pristine() {
    return this.control ? this.control.pristine : null;
  }
  /**
   * @description
   * Reports whether the control is dirty, meaning that the user has changed
   * the value in the UI. If the control is not present, null is returned.
   */
  get dirty() {
    return this.control ? this.control.dirty : null;
  }
  /**
   * @description
   * Reports whether the control is touched, meaning that the user has triggered
   * a `blur` event on it. If the control is not present, null is returned.
   */
  get touched() {
    return this.control ? this.control.touched : null;
  }
  /**
   * @description
   * Reports the validation status of the control. Possible values include:
   * 'VALID', 'INVALID', 'DISABLED', and 'PENDING'.
   * If the control is not present, null is returned.
   */
  get status() {
    return this.control ? this.control.status : null;
  }
  /**
   * @description
   * Reports whether the control is untouched, meaning that the user has not yet triggered
   * a `blur` event on it. If the control is not present, null is returned.
   */
  get untouched() {
    return this.control ? this.control.untouched : null;
  }
  /**
   * @description
   * Returns a multicasting observable that emits a validation status whenever it is
   * calculated for the control. If the control is not present, null is returned.
   */
  get statusChanges() {
    return this.control ? this.control.statusChanges : null;
  }
  /**
   * @description
   * Returns a multicasting observable of value changes for the control that emits every time the
   * value of the control changes in the UI or programmatically.
   * If the control is not present, null is returned.
   */
  get valueChanges() {
    return this.control ? this.control.valueChanges : null;
  }
  /**
   * @description
   * Returns an array that represents the path from the top-level form to this control.
   * Each index is the string name of the control on that level.
   */
  get path() {
    return null;
  }
  /**
   * Contains the result of merging synchronous validators into a single validator function
   * (combined using `Validators.compose`).
   */
  _composedValidatorFn;
  /**
   * Contains the result of merging asynchronous validators into a single validator function
   * (combined using `Validators.composeAsync`).
   */
  _composedAsyncValidatorFn;
  /**
   * Set of synchronous validators as they were provided while calling `setValidators` function.
   * @internal
   */
  _rawValidators = [];
  /**
   * Set of asynchronous validators as they were provided while calling `setAsyncValidators`
   * function.
   * @internal
   */
  _rawAsyncValidators = [];
  /**
   * Sets synchronous validators for this directive.
   * @internal
   */
  _setValidators(validators) {
    this._rawValidators = validators || [];
    this._composedValidatorFn = composeValidators(this._rawValidators);
  }
  /**
   * Sets asynchronous validators for this directive.
   * @internal
   */
  _setAsyncValidators(validators) {
    this._rawAsyncValidators = validators || [];
    this._composedAsyncValidatorFn = composeAsyncValidators(this._rawAsyncValidators);
  }
  /**
   * @description
   * Synchronous validator function composed of all the synchronous validators registered with this
   * directive.
   */
  get validator() {
    return this._composedValidatorFn || null;
  }
  /**
   * @description
   * Asynchronous validator function composed of all the asynchronous validators registered with
   * this directive.
   */
  get asyncValidator() {
    return this._composedAsyncValidatorFn || null;
  }
  /*
   * The set of callbacks to be invoked when directive instance is being destroyed.
   */
  _onDestroyCallbacks = [];
  /**
   * Internal function to register callbacks that should be invoked
   * when directive instance is being destroyed.
   * @internal
   */
  _registerOnDestroy(fn) {
    this._onDestroyCallbacks.push(fn);
  }
  /**
   * Internal function to invoke all registered "on destroy" callbacks.
   * Note: calling this function also clears the list of callbacks.
   * @internal
   */
  _invokeOnDestroyCallbacks() {
    this._onDestroyCallbacks.forEach((fn) => fn());
    this._onDestroyCallbacks = [];
  }
  /**
   * @description
   * Resets the control with the provided value if the control is present.
   */
  reset(value = void 0) {
    if (this.control) this.control.reset(value);
  }
  /**
   * @description
   * Reports whether the control with the given path has the error specified.
   *
   * @param errorCode The code of the error to check
   * @param path A list of control names that designates how to move from the current control
   * to the control that should be queried for errors.
   *
   * @usageNotes
   * For example, for the following `FormGroup`:
   *
   * ```ts
   * form = new FormGroup({
   *   address: new FormGroup({ street: new FormControl() })
   * });
   * ```
   *
   * The path to the 'street' control from the root form would be 'address' -> 'street'.
   *
   * It can be provided to this method in one of two formats:
   *
   * 1. An array of string control names, e.g. `['address', 'street']`
   * 1. A period-delimited list of control names in one string, e.g. `'address.street'`
   *
   * If no path is given, this method checks for the error on the current control.
   *
   * @returns whether the given error is present in the control at the given path.
   *
   * If the control is not present, false is returned.
   */
  hasError(errorCode, path) {
    return this.control ? this.control.hasError(errorCode, path) : false;
  }
  /**
   * @description
   * Reports error data for the control with the given path.
   *
   * @param errorCode The code of the error to check
   * @param path A list of control names that designates how to move from the current control
   * to the control that should be queried for errors.
   *
   * @usageNotes
   * For example, for the following `FormGroup`:
   *
   * ```ts
   * form = new FormGroup({
   *   address: new FormGroup({ street: new FormControl() })
   * });
   * ```
   *
   * The path to the 'street' control from the root form would be 'address' -> 'street'.
   *
   * It can be provided to this method in one of two formats:
   *
   * 1. An array of string control names, e.g. `['address', 'street']`
   * 1. A period-delimited list of control names in one string, e.g. `'address.street'`
   *
   * @returns error data for that particular error. If the control or error is not present,
   * null is returned.
   */
  getError(errorCode, path) {
    return this.control ? this.control.getError(errorCode, path) : null;
  }
};
var ControlContainer = class extends AbstractControlDirective {
  /**
   * @description
   * The name for the control
   */
  name;
  /**
   * @description
   * The top-level form directive for the control.
   */
  get formDirective() {
    return null;
  }
  /**
   * @description
   * The path to this group.
   */
  get path() {
    return null;
  }
};
var NgControl = class extends AbstractControlDirective {
  /**
   * @description
   * The parent form for the control.
   *
   * @internal
   */
  _parent = null;
  /**
   * @description
   * The name for the control
   */
  name = null;
  /**
   * @description
   * The value accessor for the control
   */
  valueAccessor = null;
};
var AbstractControlStatus = class {
  _cd;
  constructor(cd) {
    this._cd = cd;
  }
  get isTouched() {
    this._cd?.control?._touched?.();
    return !!this._cd?.control?.touched;
  }
  get isUntouched() {
    return !!this._cd?.control?.untouched;
  }
  get isPristine() {
    this._cd?.control?._pristine?.();
    return !!this._cd?.control?.pristine;
  }
  get isDirty() {
    return !!this._cd?.control?.dirty;
  }
  get isValid() {
    this._cd?.control?._status?.();
    return !!this._cd?.control?.valid;
  }
  get isInvalid() {
    return !!this._cd?.control?.invalid;
  }
  get isPending() {
    return !!this._cd?.control?.pending;
  }
  get isSubmitted() {
    this._cd?._submitted?.();
    return !!this._cd?.submitted;
  }
};
var ngControlStatusHost = {
  "[class.ng-untouched]": "isUntouched",
  "[class.ng-touched]": "isTouched",
  "[class.ng-pristine]": "isPristine",
  "[class.ng-dirty]": "isDirty",
  "[class.ng-valid]": "isValid",
  "[class.ng-invalid]": "isInvalid",
  "[class.ng-pending]": "isPending"
};
var ngGroupStatusHost = __spreadProps(__spreadValues({}, ngControlStatusHost), {
  "[class.ng-submitted]": "isSubmitted"
});
var NgControlStatus = class _NgControlStatus extends AbstractControlStatus {
  constructor(cd) {
    super(cd);
  }
  static \u0275fac = function NgControlStatus_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _NgControlStatus)(\u0275\u0275directiveInject(NgControl, 2));
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _NgControlStatus,
    selectors: [["", "formControlName", ""], ["", "ngModel", ""], ["", "formControl", ""]],
    hostVars: 14,
    hostBindings: function NgControlStatus_HostBindings(rf, ctx) {
      if (rf & 2) {
        \u0275\u0275classProp("ng-untouched", ctx.isUntouched)("ng-touched", ctx.isTouched)("ng-pristine", ctx.isPristine)("ng-dirty", ctx.isDirty)("ng-valid", ctx.isValid)("ng-invalid", ctx.isInvalid)("ng-pending", ctx.isPending);
      }
    },
    standalone: false,
    features: [\u0275\u0275InheritDefinitionFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgControlStatus, [{
    type: Directive,
    args: [{
      selector: "[formControlName],[ngModel],[formControl]",
      host: ngControlStatusHost,
      standalone: false
    }]
  }], () => [{
    type: NgControl,
    decorators: [{
      type: Self
    }]
  }], null);
})();
var NgControlStatusGroup = class _NgControlStatusGroup extends AbstractControlStatus {
  constructor(cd) {
    super(cd);
  }
  static \u0275fac = function NgControlStatusGroup_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _NgControlStatusGroup)(\u0275\u0275directiveInject(ControlContainer, 10));
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _NgControlStatusGroup,
    selectors: [["", "formGroupName", ""], ["", "formArrayName", ""], ["", "ngModelGroup", ""], ["", "formGroup", ""], ["form", 3, "ngNoForm", ""], ["", "ngForm", ""]],
    hostVars: 16,
    hostBindings: function NgControlStatusGroup_HostBindings(rf, ctx) {
      if (rf & 2) {
        \u0275\u0275classProp("ng-untouched", ctx.isUntouched)("ng-touched", ctx.isTouched)("ng-pristine", ctx.isPristine)("ng-dirty", ctx.isDirty)("ng-valid", ctx.isValid)("ng-invalid", ctx.isInvalid)("ng-pending", ctx.isPending)("ng-submitted", ctx.isSubmitted);
      }
    },
    standalone: false,
    features: [\u0275\u0275InheritDefinitionFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgControlStatusGroup, [{
    type: Directive,
    args: [{
      selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]",
      host: ngGroupStatusHost,
      standalone: false
    }]
  }], () => [{
    type: ControlContainer,
    decorators: [{
      type: Optional
    }, {
      type: Self
    }]
  }], null);
})();
var formControlNameExample = `
  <div [formGroup]="myGroup">
    <input formControlName="firstName">
  </div>

  In your class:

  this.myGroup = new FormGroup({
      firstName: new FormControl()
  });`;
var formGroupNameExample = `
  <div [formGroup]="myGroup">
      <div formGroupName="person">
        <input formControlName="firstName">
      </div>
  </div>

  In your class:

  this.myGroup = new FormGroup({
      person: new FormGroup({ firstName: new FormControl() })
  });`;
var formArrayNameExample = `
  <div [formGroup]="myGroup">
    <div formArrayName="cities">
      <div *ngFor="let city of cityArray.controls; index as i">
        <input [formControlName]="i">
      </div>
    </div>
  </div>

  In your class:

  this.cityArray = new FormArray([new FormControl('SF')]);
  this.myGroup = new FormGroup({
    cities: this.cityArray
  });`;
var ngModelGroupExample = `
  <form>
      <div ngModelGroup="person">
        <input [(ngModel)]="person.name" name="firstName">
      </div>
  </form>`;
var ngModelWithFormGroupExample = `
  <div [formGroup]="myGroup">
      <input formControlName="firstName">
      <input [(ngModel)]="showMoreControls" [ngModelOptions]="{standalone: true}">
  </div>
`;
function controlParentException(nameOrIndex) {
  return new RuntimeError(1050, `formControlName must be used with a parent formGroup directive. You'll want to add a formGroup
      directive and pass it an existing FormGroup instance (you can create one in your class).

      ${describeFormControl(nameOrIndex)}

    Example:

    ${formControlNameExample}`);
}
function describeFormControl(nameOrIndex) {
  if (nameOrIndex == null || nameOrIndex === "") {
    return "";
  }
  const valueType = typeof nameOrIndex === "string" ? "name" : "index";
  return `Affected Form Control ${valueType}: "${nameOrIndex}"`;
}
function ngModelGroupException() {
  return new RuntimeError(1051, `formControlName cannot be used with an ngModelGroup parent. It is only compatible with parents
      that also have a "form" prefix: formGroupName, formArrayName, or formGroup.

      Option 1:  Update the parent to be formGroupName (reactive form strategy)

      ${formGroupNameExample}

      Option 2: Use ngModel instead of formControlName (template-driven strategy)

      ${ngModelGroupExample}`);
}
function missingFormException() {
  return new RuntimeError(1052, `formGroup expects a FormGroup instance. Please pass one in.

      Example:

      ${formControlNameExample}`);
}
function groupParentException() {
  return new RuntimeError(1053, `formGroupName must be used with a parent formGroup directive.  You'll want to add a formGroup
    directive and pass it an existing FormGroup instance (you can create one in your class).

    Example:

    ${formGroupNameExample}`);
}
function arrayParentException() {
  return new RuntimeError(1054, `formArrayName must be used with a parent formGroup directive.  You'll want to add a formGroup
      directive and pass it an existing FormGroup instance (you can create one in your class).

      Example:

      ${formArrayNameExample}`);
}
var disabledAttrWarning = `
  It looks like you're using the disabled attribute with a reactive form directive. If you set disabled to true
  when you set up this control in your component class, the disabled attribute will actually be set in the DOM for
  you. We recommend using this approach to avoid 'changed after checked' errors.

  Example:
  // Specify the \`disabled\` property at control creation time:
  form = new FormGroup({
    first: new FormControl({value: 'Nancy', disabled: true}, Validators.required),
    last: new FormControl('Drew', Validators.required)
  });

  // Controls can also be enabled/disabled after creation:
  form.get('first')?.enable();
  form.get('last')?.disable();
`;
var asyncValidatorsDroppedWithOptsWarning = `
  It looks like you're constructing using a FormControl with both an options argument and an
  async validators argument. Mixing these arguments will cause your async validators to be dropped.
  You should either put all your validators in the options object, or in separate validators
  arguments. For example:

  // Using validators arguments
  fc = new FormControl(42, Validators.required, myAsyncValidator);

  // Using AbstractControlOptions
  fc = new FormControl(42, {validators: Validators.required, asyncValidators: myAV});

  // Do NOT mix them: async validators will be dropped!
  fc = new FormControl(42, {validators: Validators.required}, /* Oops! */ myAsyncValidator);
`;
function ngModelWarning(directiveName) {
  return `
  It looks like you're using ngModel on the same form field as ${directiveName}.
  Support for using the ngModel input property and ngModelChange event with
  reactive form directives has been deprecated in Angular v6 and will be removed
  in a future version of Angular.

  For more information on this, see our API docs here:
  https://angular.io/api/forms/${directiveName === "formControl" ? "FormControlDirective" : "FormControlName"}#use-with-ngmodel
  `;
}
function describeKey(isFormGroup, key) {
  return isFormGroup ? `with name: '${key}'` : `at index: ${key}`;
}
function noControlsError(isFormGroup) {
  return `
    There are no form controls registered with this ${isFormGroup ? "group" : "array"} yet. If you're using ngModel,
    you may want to check next tick (e.g. use setTimeout).
  `;
}
function missingControlError(isFormGroup, key) {
  return `Cannot find form control ${describeKey(isFormGroup, key)}`;
}
function missingControlValueError(isFormGroup, key) {
  return `Must supply a value for form control ${describeKey(isFormGroup, key)}`;
}
var VALID = "VALID";
var INVALID = "INVALID";
var PENDING = "PENDING";
var DISABLED = "DISABLED";
var ControlEvent = class {
};
var ValueChangeEvent = class extends ControlEvent {
  value;
  source;
  constructor(value, source) {
    super();
    this.value = value;
    this.source = source;
  }
};
var PristineChangeEvent = class extends ControlEvent {
  pristine;
  source;
  constructor(pristine, source) {
    super();
    this.pristine = pristine;
    this.source = source;
  }
};
var TouchedChangeEvent = class extends ControlEvent {
  touched;
  source;
  constructor(touched, source) {
    super();
    this.touched = touched;
    this.source = source;
  }
};
var StatusChangeEvent = class extends ControlEvent {
  status;
  source;
  constructor(status, source) {
    super();
    this.status = status;
    this.source = source;
  }
};
var FormSubmittedEvent = class extends ControlEvent {
  source;
  constructor(source) {
    super();
    this.source = source;
  }
};
var FormResetEvent = class extends ControlEvent {
  source;
  constructor(source) {
    super();
    this.source = source;
  }
};
function pickValidators(validatorOrOpts) {
  return (isOptionsObj(validatorOrOpts) ? validatorOrOpts.validators : validatorOrOpts) || null;
}
function coerceToValidator(validator) {
  return Array.isArray(validator) ? composeValidators(validator) : validator || null;
}
function pickAsyncValidators(asyncValidator, validatorOrOpts) {
  if (typeof ngDevMode === "undefined" || ngDevMode) {
    if (isOptionsObj(validatorOrOpts) && asyncValidator) {
      console.warn(asyncValidatorsDroppedWithOptsWarning);
    }
  }
  return (isOptionsObj(validatorOrOpts) ? validatorOrOpts.asyncValidators : asyncValidator) || null;
}
function coerceToAsyncValidator(asyncValidator) {
  return Array.isArray(asyncValidator) ? composeAsyncValidators(asyncValidator) : asyncValidator || null;
}
function isOptionsObj(validatorOrOpts) {
  return validatorOrOpts != null && !Array.isArray(validatorOrOpts) && typeof validatorOrOpts === "object";
}
function assertControlPresent(parent, isGroup, key) {
  const controls = parent.controls;
  const collection = isGroup ? Object.keys(controls) : controls;
  if (!collection.length) {
    throw new RuntimeError(1e3, typeof ngDevMode === "undefined" || ngDevMode ? noControlsError(isGroup) : "");
  }
  if (!controls[key]) {
    throw new RuntimeError(1001, typeof ngDevMode === "undefined" || ngDevMode ? missingControlError(isGroup, key) : "");
  }
}
function assertAllValuesPresent(control, isGroup, value) {
  control._forEachChild((_4, key) => {
    if (value[key] === void 0) {
      throw new RuntimeError(1002, typeof ngDevMode === "undefined" || ngDevMode ? missingControlValueError(isGroup, key) : "");
    }
  });
}
var AbstractControl = class {
  /** @internal */
  _pendingDirty = false;
  /**
   * Indicates that a control has its own pending asynchronous validation in progress.
   * It also stores if the control should emit events when the validation status changes.
   *
   * @internal
   */
  _hasOwnPendingAsyncValidator = null;
  /** @internal */
  _pendingTouched = false;
  /** @internal */
  _onCollectionChange = () => {
  };
  /** @internal */
  _updateOn;
  _parent = null;
  _asyncValidationSubscription;
  /**
   * Contains the result of merging synchronous validators into a single validator function
   * (combined using `Validators.compose`).
   *
   * @internal
   */
  _composedValidatorFn;
  /**
   * Contains the result of merging asynchronous validators into a single validator function
   * (combined using `Validators.composeAsync`).
   *
   * @internal
   */
  _composedAsyncValidatorFn;
  /**
   * Synchronous validators as they were provided:
   *  - in `AbstractControl` constructor
   *  - as an argument while calling `setValidators` function
   *  - while calling the setter on the `validator` field (e.g. `control.validator = validatorFn`)
   *
   * @internal
   */
  _rawValidators;
  /**
   * Asynchronous validators as they were provided:
   *  - in `AbstractControl` constructor
   *  - as an argument while calling `setAsyncValidators` function
   *  - while calling the setter on the `asyncValidator` field (e.g. `control.asyncValidator =
   * asyncValidatorFn`)
   *
   * @internal
   */
  _rawAsyncValidators;
  /**
   * The current value of the control.
   *
   * * For a `FormControl`, the current value.
   * * For an enabled `FormGroup`, the values of enabled controls as an object
   * with a key-value pair for each member of the group.
   * * For a disabled `FormGroup`, the values of all controls as an object
   * with a key-value pair for each member of the group.
   * * For a `FormArray`, the values of enabled controls as an array.
   *
   */
  value;
  /**
   * Initialize the AbstractControl instance.
   *
   * @param validators The function or array of functions that is used to determine the validity of
   *     this control synchronously.
   * @param asyncValidators The function or array of functions that is used to determine validity of
   *     this control asynchronously.
   */
  constructor(validators, asyncValidators) {
    this._assignValidators(validators);
    this._assignAsyncValidators(asyncValidators);
  }
  /**
   * Returns the function that is used to determine the validity of this control synchronously.
   * If multiple validators have been added, this will be a single composed function.
   * See `Validators.compose()` for additional information.
   */
  get validator() {
    return this._composedValidatorFn;
  }
  set validator(validatorFn) {
    this._rawValidators = this._composedValidatorFn = validatorFn;
  }
  /**
   * Returns the function that is used to determine the validity of this control asynchronously.
   * If multiple validators have been added, this will be a single composed function.
   * See `Validators.compose()` for additional information.
   */
  get asyncValidator() {
    return this._composedAsyncValidatorFn;
  }
  set asyncValidator(asyncValidatorFn) {
    this._rawAsyncValidators = this._composedAsyncValidatorFn = asyncValidatorFn;
  }
  /**
   * The parent control.
   */
  get parent() {
    return this._parent;
  }
  /**
   * The validation status of the control.
   *
   * @see {@link FormControlStatus}
   *
   * These status values are mutually exclusive, so a control cannot be
   * both valid AND invalid or invalid AND disabled.
   */
  get status() {
    return untracked2(this.statusReactive);
  }
  set status(v) {
    untracked2(() => this.statusReactive.set(v));
  }
  /** @internal */
  _status = computed(() => this.statusReactive(), ...ngDevMode ? [{
    debugName: "_status"
  }] : []);
  statusReactive = signal(void 0, ...ngDevMode ? [{
    debugName: "statusReactive"
  }] : []);
  /**
   * A control is `valid` when its `status` is `VALID`.
   *
   * @see {@link AbstractControl.status}
   *
   * @returns True if the control has passed all of its validation tests,
   * false otherwise.
   */
  get valid() {
    return this.status === VALID;
  }
  /**
   * A control is `invalid` when its `status` is `INVALID`.
   *
   * @see {@link AbstractControl.status}
   *
   * @returns True if this control has failed one or more of its validation checks,
   * false otherwise.
   */
  get invalid() {
    return this.status === INVALID;
  }
  /**
   * A control is `pending` when its `status` is `PENDING`.
   *
   * @see {@link AbstractControl.status}
   *
   * @returns True if this control is in the process of conducting a validation check,
   * false otherwise.
   */
  get pending() {
    return this.status == PENDING;
  }
  /**
   * A control is `disabled` when its `status` is `DISABLED`.
   *
   * Disabled controls are exempt from validation checks and
   * are not included in the aggregate value of their ancestor
   * controls.
   *
   * @see {@link AbstractControl.status}
   *
   * @returns True if the control is disabled, false otherwise.
   */
  get disabled() {
    return this.status === DISABLED;
  }
  /**
   * A control is `enabled` as long as its `status` is not `DISABLED`.
   *
   * @returns True if the control has any status other than 'DISABLED',
   * false if the status is 'DISABLED'.
   *
   * @see {@link AbstractControl.status}
   *
   */
  get enabled() {
    return this.status !== DISABLED;
  }
  /**
   * An object containing any errors generated by failing validation,
   * or null if there are no errors.
   */
  errors;
  /**
   * A control is `pristine` if the user has not yet changed
   * the value in the UI.
   *
   * @returns True if the user has not yet changed the value in the UI; compare `dirty`.
   * Programmatic changes to a control's value do not mark it dirty.
   */
  get pristine() {
    return untracked2(this.pristineReactive);
  }
  set pristine(v) {
    untracked2(() => this.pristineReactive.set(v));
  }
  /** @internal */
  _pristine = computed(() => this.pristineReactive(), ...ngDevMode ? [{
    debugName: "_pristine"
  }] : []);
  pristineReactive = signal(true, ...ngDevMode ? [{
    debugName: "pristineReactive"
  }] : []);
  /**
   * A control is `dirty` if the user has changed the value
   * in the UI.
   *
   * @returns True if the user has changed the value of this control in the UI; compare `pristine`.
   * Programmatic changes to a control's value do not mark it dirty.
   */
  get dirty() {
    return !this.pristine;
  }
  /**
   * True if the control is marked as `touched`.
   *
   * A control is marked `touched` once the user has triggered
   * a `blur` event on it.
   */
  get touched() {
    return untracked2(this.touchedReactive);
  }
  set touched(v) {
    untracked2(() => this.touchedReactive.set(v));
  }
  /** @internal */
  _touched = computed(() => this.touchedReactive(), ...ngDevMode ? [{
    debugName: "_touched"
  }] : []);
  touchedReactive = signal(false, ...ngDevMode ? [{
    debugName: "touchedReactive"
  }] : []);
  /**
   * True if the control has not been marked as touched
   *
   * A control is `untouched` if the user has not yet triggered
   * a `blur` event on it.
   */
  get untouched() {
    return !this.touched;
  }
  /**
   * Exposed as observable, see below.
   *
   * @internal
   */
  _events = new Subject();
  /**
   * A multicasting observable that emits an event every time the state of the control changes.
   * It emits for value, status, pristine or touched changes.
   *
   * **Note**: On value change, the emit happens right after a value of this control is updated. The
   * value of a parent control (for example if this FormControl is a part of a FormGroup) is updated
   * later, so accessing a value of a parent control (using the `value` property) from the callback
   * of this event might result in getting a value that has not been updated yet. Subscribe to the
   * `events` of the parent control instead.
   * For other event types, the events are emitted after the parent control has been updated.
   *
   */
  events = this._events.asObservable();
  /**
   * A multicasting observable that emits an event every time the value of the control changes, in
   * the UI or programmatically. It also emits an event each time you call enable() or disable()
   * without passing along {emitEvent: false} as a function argument.
   *
   * **Note**: the emit happens right after a value of this control is updated. The value of a
   * parent control (for example if this FormControl is a part of a FormGroup) is updated later, so
   * accessing a value of a parent control (using the `value` property) from the callback of this
   * event might result in getting a value that has not been updated yet. Subscribe to the
   * `valueChanges` event of the parent control instead.
   */
  valueChanges;
  /**
   * A multicasting observable that emits an event every time the validation `status` of the control
   * recalculates.
   *
   * @see {@link FormControlStatus}
   * @see {@link AbstractControl.status}
   */
  statusChanges;
  /**
   * Reports the update strategy of the `AbstractControl` (meaning
   * the event on which the control updates itself).
   * Possible values: `'change'` | `'blur'` | `'submit'`
   * Default value: `'change'`
   */
  get updateOn() {
    return this._updateOn ? this._updateOn : this.parent ? this.parent.updateOn : "change";
  }
  /**
   * Sets the synchronous validators that are active on this control.  Calling
   * this overwrites any existing synchronous validators.
   *
   * When you add or remove a validator at run time, you must call
   * `updateValueAndValidity()` for the new validation to take effect.
   *
   * If you want to add a new validator without affecting existing ones, consider
   * using `addValidators()` method instead.
   */
  setValidators(validators) {
    this._assignValidators(validators);
  }
  /**
   * Sets the asynchronous validators that are active on this control. Calling this
   * overwrites any existing asynchronous validators.
   *
   * When you add or remove a validator at run time, you must call
   * `updateValueAndValidity()` for the new validation to take effect.
   *
   * If you want to add a new validator without affecting existing ones, consider
   * using `addAsyncValidators()` method instead.
   */
  setAsyncValidators(validators) {
    this._assignAsyncValidators(validators);
  }
  /**
   * Add a synchronous validator or validators to this control, without affecting other validators.
   *
   * When you add or remove a validator at run time, you must call
   * `updateValueAndValidity()` for the new validation to take effect.
   *
   * Adding a validator that already exists will have no effect. If duplicate validator functions
   * are present in the `validators` array, only the first instance would be added to a form
   * control.
   *
   * @param validators The new validator function or functions to add to this control.
   */
  addValidators(validators) {
    this.setValidators(addValidators(validators, this._rawValidators));
  }
  /**
   * Add an asynchronous validator or validators to this control, without affecting other
   * validators.
   *
   * When you add or remove a validator at run time, you must call
   * `updateValueAndValidity()` for the new validation to take effect.
   *
   * Adding a validator that already exists will have no effect.
   *
   * @param validators The new asynchronous validator function or functions to add to this control.
   */
  addAsyncValidators(validators) {
    this.setAsyncValidators(addValidators(validators, this._rawAsyncValidators));
  }
  /**
   * Remove a synchronous validator from this control, without affecting other validators.
   * Validators are compared by function reference; you must pass a reference to the exact same
   * validator function as the one that was originally set. If a provided validator is not found,
   * it is ignored.
   *
   * @usageNotes
   *
   * ### Reference to a ValidatorFn
   *
   * ```
   * // Reference to the RequiredValidator
   * const ctrl = new FormControl<string | null>('', Validators.required);
   * ctrl.removeValidators(Validators.required);
   *
   * // Reference to anonymous function inside MinValidator
   * const minValidator = Validators.min(3);
   * const ctrl = new FormControl<string | null>('', minValidator);
   * expect(ctrl.hasValidator(minValidator)).toEqual(true)
   * expect(ctrl.hasValidator(Validators.min(3))).toEqual(false)
   *
   * ctrl.removeValidators(minValidator);
   * ```
   *
   * When you add or remove a validator at run time, you must call
   * `updateValueAndValidity()` for the new validation to take effect.
   *
   * @param validators The validator or validators to remove.
   */
  removeValidators(validators) {
    this.setValidators(removeValidators(validators, this._rawValidators));
  }
  /**
   * Remove an asynchronous validator from this control, without affecting other validators.
   * Validators are compared by function reference; you must pass a reference to the exact same
   * validator function as the one that was originally set. If a provided validator is not found, it
   * is ignored.
   *
   * When you add or remove a validator at run time, you must call
   * `updateValueAndValidity()` for the new validation to take effect.
   *
   * @param validators The asynchronous validator or validators to remove.
   */
  removeAsyncValidators(validators) {
    this.setAsyncValidators(removeValidators(validators, this._rawAsyncValidators));
  }
  /**
   * Check whether a synchronous validator function is present on this control. The provided
   * validator must be a reference to the exact same function that was provided.
   *
   * @usageNotes
   *
   * ### Reference to a ValidatorFn
   *
   * ```
   * // Reference to the RequiredValidator
   * const ctrl = new FormControl<number | null>(0, Validators.required);
   * expect(ctrl.hasValidator(Validators.required)).toEqual(true)
   *
   * // Reference to anonymous function inside MinValidator
   * const minValidator = Validators.min(3);
   * const ctrl = new FormControl<number | null>(0, minValidator);
   * expect(ctrl.hasValidator(minValidator)).toEqual(true)
   * expect(ctrl.hasValidator(Validators.min(3))).toEqual(false)
   * ```
   *
   * @param validator The validator to check for presence. Compared by function reference.
   * @returns Whether the provided validator was found on this control.
   */
  hasValidator(validator) {
    return hasValidator(this._rawValidators, validator);
  }
  /**
   * Check whether an asynchronous validator function is present on this control. The provided
   * validator must be a reference to the exact same function that was provided.
   *
   * @param validator The asynchronous validator to check for presence. Compared by function
   *     reference.
   * @returns Whether the provided asynchronous validator was found on this control.
   */
  hasAsyncValidator(validator) {
    return hasValidator(this._rawAsyncValidators, validator);
  }
  /**
   * Empties out the synchronous validator list.
   *
   * When you add or remove a validator at run time, you must call
   * `updateValueAndValidity()` for the new validation to take effect.
   *
   */
  clearValidators() {
    this.validator = null;
  }
  /**
   * Empties out the async validator list.
   *
   * When you add or remove a validator at run time, you must call
   * `updateValueAndValidity()` for the new validation to take effect.
   *
   */
  clearAsyncValidators() {
    this.asyncValidator = null;
  }
  markAsTouched(opts = {}) {
    const changed = this.touched === false;
    this.touched = true;
    const sourceControl = opts.sourceControl ?? this;
    if (this._parent && !opts.onlySelf) {
      this._parent.markAsTouched(__spreadProps(__spreadValues({}, opts), {
        sourceControl
      }));
    }
    if (changed && opts.emitEvent !== false) {
      this._events.next(new TouchedChangeEvent(true, sourceControl));
    }
  }
  /**
   * Marks the control and all its descendant controls as `dirty`.
   * @see {@link markAsDirty()}
   *
   * @param opts Configuration options that determine how the control propagates changes
   * and emits events after marking is applied.
   * * `emitEvent`: When true or not supplied (the default), the `events`
   * observable emits a `PristineChangeEvent` with the `pristine` property being `false`.
   * When false, no events are emitted.
   */
  markAllAsDirty(opts = {}) {
    this.markAsDirty({
      onlySelf: true,
      emitEvent: opts.emitEvent,
      sourceControl: this
    });
    this._forEachChild((control) => control.markAllAsDirty(opts));
  }
  /**
   * Marks the control and all its descendant controls as `touched`.
   * @see {@link markAsTouched()}
   *
   * @param opts Configuration options that determine how the control propagates changes
   * and emits events after marking is applied.
   * * `emitEvent`: When true or not supplied (the default), the `events`
   * observable emits a `TouchedChangeEvent` with the `touched` property being `true`.
   * When false, no events are emitted.
   */
  markAllAsTouched(opts = {}) {
    this.markAsTouched({
      onlySelf: true,
      emitEvent: opts.emitEvent,
      sourceControl: this
    });
    this._forEachChild((control) => control.markAllAsTouched(opts));
  }
  markAsUntouched(opts = {}) {
    const changed = this.touched === true;
    this.touched = false;
    this._pendingTouched = false;
    const sourceControl = opts.sourceControl ?? this;
    this._forEachChild((control) => {
      control.markAsUntouched({
        onlySelf: true,
        emitEvent: opts.emitEvent,
        sourceControl
      });
    });
    if (this._parent && !opts.onlySelf) {
      this._parent._updateTouched(opts, sourceControl);
    }
    if (changed && opts.emitEvent !== false) {
      this._events.next(new TouchedChangeEvent(false, sourceControl));
    }
  }
  markAsDirty(opts = {}) {
    const changed = this.pristine === true;
    this.pristine = false;
    const sourceControl = opts.sourceControl ?? this;
    if (this._parent && !opts.onlySelf) {
      this._parent.markAsDirty(__spreadProps(__spreadValues({}, opts), {
        sourceControl
      }));
    }
    if (changed && opts.emitEvent !== false) {
      this._events.next(new PristineChangeEvent(false, sourceControl));
    }
  }
  markAsPristine(opts = {}) {
    const changed = this.pristine === false;
    this.pristine = true;
    this._pendingDirty = false;
    const sourceControl = opts.sourceControl ?? this;
    this._forEachChild((control) => {
      control.markAsPristine({
        onlySelf: true,
        emitEvent: opts.emitEvent
      });
    });
    if (this._parent && !opts.onlySelf) {
      this._parent._updatePristine(opts, sourceControl);
    }
    if (changed && opts.emitEvent !== false) {
      this._events.next(new PristineChangeEvent(true, sourceControl));
    }
  }
  markAsPending(opts = {}) {
    this.status = PENDING;
    const sourceControl = opts.sourceControl ?? this;
    if (opts.emitEvent !== false) {
      this._events.next(new StatusChangeEvent(this.status, sourceControl));
      this.statusChanges.emit(this.status);
    }
    if (this._parent && !opts.onlySelf) {
      this._parent.markAsPending(__spreadProps(__spreadValues({}, opts), {
        sourceControl
      }));
    }
  }
  disable(opts = {}) {
    const skipPristineCheck = this._parentMarkedDirty(opts.onlySelf);
    this.status = DISABLED;
    this.errors = null;
    this._forEachChild((control) => {
      control.disable(__spreadProps(__spreadValues({}, opts), {
        onlySelf: true
      }));
    });
    this._updateValue();
    const sourceControl = opts.sourceControl ?? this;
    if (opts.emitEvent !== false) {
      this._events.next(new ValueChangeEvent(this.value, sourceControl));
      this._events.next(new StatusChangeEvent(this.status, sourceControl));
      this.valueChanges.emit(this.value);
      this.statusChanges.emit(this.status);
    }
    this._updateAncestors(__spreadProps(__spreadValues({}, opts), {
      skipPristineCheck
    }), this);
    this._onDisabledChange.forEach((changeFn) => changeFn(true));
  }
  /**
   * Enables the control. This means the control is included in validation checks and
   * the aggregate value of its parent. Its status recalculates based on its value and
   * its validators.
   *
   * By default, if the control has children, all children are enabled.
   *
   * @see {@link AbstractControl.status}
   *
   * @param opts Configure options that control how the control propagates changes and
   * emits events when marked as untouched
   * * `onlySelf`: When true, mark only this control. When false or not supplied,
   * marks all direct ancestors. Default is false.
   * * `emitEvent`: When true or not supplied (the default), the `statusChanges`,
   * `valueChanges` and `events`
   * observables emit events with the latest status and value when the control is enabled.
   * When false, no events are emitted.
   */
  enable(opts = {}) {
    const skipPristineCheck = this._parentMarkedDirty(opts.onlySelf);
    this.status = VALID;
    this._forEachChild((control) => {
      control.enable(__spreadProps(__spreadValues({}, opts), {
        onlySelf: true
      }));
    });
    this.updateValueAndValidity({
      onlySelf: true,
      emitEvent: opts.emitEvent
    });
    this._updateAncestors(__spreadProps(__spreadValues({}, opts), {
      skipPristineCheck
    }), this);
    this._onDisabledChange.forEach((changeFn) => changeFn(false));
  }
  _updateAncestors(opts, sourceControl) {
    if (this._parent && !opts.onlySelf) {
      this._parent.updateValueAndValidity(opts);
      if (!opts.skipPristineCheck) {
        this._parent._updatePristine({}, sourceControl);
      }
      this._parent._updateTouched({}, sourceControl);
    }
  }
  /**
   * Sets the parent of the control
   *
   * @param parent The new parent.
   */
  setParent(parent) {
    this._parent = parent;
  }
  /**
   * The raw value of this control. For most control implementations, the raw value will include
   * disabled children.
   */
  getRawValue() {
    return this.value;
  }
  updateValueAndValidity(opts = {}) {
    this._setInitialStatus();
    this._updateValue();
    if (this.enabled) {
      const shouldHaveEmitted = this._cancelExistingSubscription();
      this.errors = this._runValidator();
      this.status = this._calculateStatus();
      if (this.status === VALID || this.status === PENDING) {
        this._runAsyncValidator(shouldHaveEmitted, opts.emitEvent);
      }
    }
    const sourceControl = opts.sourceControl ?? this;
    if (opts.emitEvent !== false) {
      this._events.next(new ValueChangeEvent(this.value, sourceControl));
      this._events.next(new StatusChangeEvent(this.status, sourceControl));
      this.valueChanges.emit(this.value);
      this.statusChanges.emit(this.status);
    }
    if (this._parent && !opts.onlySelf) {
      this._parent.updateValueAndValidity(__spreadProps(__spreadValues({}, opts), {
        sourceControl
      }));
    }
  }
  /** @internal */
  _updateTreeValidity(opts = {
    emitEvent: true
  }) {
    this._forEachChild((ctrl) => ctrl._updateTreeValidity(opts));
    this.updateValueAndValidity({
      onlySelf: true,
      emitEvent: opts.emitEvent
    });
  }
  _setInitialStatus() {
    this.status = this._allControlsDisabled() ? DISABLED : VALID;
  }
  _runValidator() {
    return this.validator ? this.validator(this) : null;
  }
  _runAsyncValidator(shouldHaveEmitted, emitEvent) {
    if (this.asyncValidator) {
      this.status = PENDING;
      this._hasOwnPendingAsyncValidator = {
        emitEvent: emitEvent !== false,
        shouldHaveEmitted: shouldHaveEmitted !== false
      };
      const obs = toObservable(this.asyncValidator(this));
      this._asyncValidationSubscription = obs.subscribe((errors) => {
        this._hasOwnPendingAsyncValidator = null;
        this.setErrors(errors, {
          emitEvent,
          shouldHaveEmitted
        });
      });
    }
  }
  _cancelExistingSubscription() {
    if (this._asyncValidationSubscription) {
      this._asyncValidationSubscription.unsubscribe();
      const shouldHaveEmitted = (this._hasOwnPendingAsyncValidator?.emitEvent || this._hasOwnPendingAsyncValidator?.shouldHaveEmitted) ?? false;
      this._hasOwnPendingAsyncValidator = null;
      return shouldHaveEmitted;
    }
    return false;
  }
  setErrors(errors, opts = {}) {
    this.errors = errors;
    this._updateControlsErrors(opts.emitEvent !== false, this, opts.shouldHaveEmitted);
  }
  /**
   * Retrieves a child control given the control's name or path.
   *
   * @param path A dot-delimited string or array of string/number values that define the path to the
   * control. If a string is provided, passing it as a string literal will result in improved type
   * information. Likewise, if an array is provided, passing it `as const` will cause improved type
   * information to be available.
   *
   * @usageNotes
   * ### Retrieve a nested control
   *
   * For example, to get a `name` control nested within a `person` sub-group:
   *
   * * `this.form.get('person.name');`
   *
   * -OR-
   *
   * * `this.form.get(['person', 'name'] as const);` // `as const` gives improved typings
   *
   * ### Retrieve a control in a FormArray
   *
   * When accessing an element inside a FormArray, you can use an element index.
   * For example, to get a `price` control from the first element in an `items` array you can use:
   *
   * * `this.form.get('items.0.price');`
   *
   * -OR-
   *
   * * `this.form.get(['items', 0, 'price']);`
   */
  get(path) {
    let currPath = path;
    if (currPath == null) return null;
    if (!Array.isArray(currPath)) currPath = currPath.split(".");
    if (currPath.length === 0) return null;
    return currPath.reduce((control, name2) => control && control._find(name2), this);
  }
  /**
   * @description
   * Reports error data for the control with the given path.
   *
   * @param errorCode The code of the error to check
   * @param path A list of control names that designates how to move from the current control
   * to the control that should be queried for errors.
   *
   * @usageNotes
   * For example, for the following `FormGroup`:
   *
   * ```ts
   * form = new FormGroup({
   *   address: new FormGroup({ street: new FormControl() })
   * });
   * ```
   *
   * The path to the 'street' control from the root form would be 'address' -> 'street'.
   *
   * It can be provided to this method in one of two formats:
   *
   * 1. An array of string control names, e.g. `['address', 'street']`
   * 1. A period-delimited list of control names in one string, e.g. `'address.street'`
   *
   * @returns error data for that particular error. If the control or error is not present,
   * null is returned.
   */
  getError(errorCode, path) {
    const control = path ? this.get(path) : this;
    return control && control.errors ? control.errors[errorCode] : null;
  }
  /**
   * @description
   * Reports whether the control with the given path has the error specified.
   *
   * @param errorCode The code of the error to check
   * @param path A list of control names that designates how to move from the current control
   * to the control that should be queried for errors.
   *
   * @usageNotes
   * For example, for the following `FormGroup`:
   *
   * ```ts
   * form = new FormGroup({
   *   address: new FormGroup({ street: new FormControl() })
   * });
   * ```
   *
   * The path to the 'street' control from the root form would be 'address' -> 'street'.
   *
   * It can be provided to this method in one of two formats:
   *
   * 1. An array of string control names, e.g. `['address', 'street']`
   * 1. A period-delimited list of control names in one string, e.g. `'address.street'`
   *
   * If no path is given, this method checks for the error on the current control.
   *
   * @returns whether the given error is present in the control at the given path.
   *
   * If the control is not present, false is returned.
   */
  hasError(errorCode, path) {
    return !!this.getError(errorCode, path);
  }
  /**
   * Retrieves the top-level ancestor of this control.
   */
  get root() {
    let x = this;
    while (x._parent) {
      x = x._parent;
    }
    return x;
  }
  /** @internal */
  _updateControlsErrors(emitEvent, changedControl, shouldHaveEmitted) {
    this.status = this._calculateStatus();
    if (emitEvent) {
      this.statusChanges.emit(this.status);
    }
    if (emitEvent || shouldHaveEmitted) {
      this._events.next(new StatusChangeEvent(this.status, changedControl));
    }
    if (this._parent) {
      this._parent._updateControlsErrors(emitEvent, changedControl, shouldHaveEmitted);
    }
  }
  /** @internal */
  _initObservables() {
    this.valueChanges = new EventEmitter();
    this.statusChanges = new EventEmitter();
  }
  _calculateStatus() {
    if (this._allControlsDisabled()) return DISABLED;
    if (this.errors) return INVALID;
    if (this._hasOwnPendingAsyncValidator || this._anyControlsHaveStatus(PENDING)) return PENDING;
    if (this._anyControlsHaveStatus(INVALID)) return INVALID;
    return VALID;
  }
  /** @internal */
  _anyControlsHaveStatus(status) {
    return this._anyControls((control) => control.status === status);
  }
  /** @internal */
  _anyControlsDirty() {
    return this._anyControls((control) => control.dirty);
  }
  /** @internal */
  _anyControlsTouched() {
    return this._anyControls((control) => control.touched);
  }
  /** @internal */
  _updatePristine(opts, changedControl) {
    const newPristine = !this._anyControlsDirty();
    const changed = this.pristine !== newPristine;
    this.pristine = newPristine;
    if (this._parent && !opts.onlySelf) {
      this._parent._updatePristine(opts, changedControl);
    }
    if (changed) {
      this._events.next(new PristineChangeEvent(this.pristine, changedControl));
    }
  }
  /** @internal */
  _updateTouched(opts = {}, changedControl) {
    this.touched = this._anyControlsTouched();
    this._events.next(new TouchedChangeEvent(this.touched, changedControl));
    if (this._parent && !opts.onlySelf) {
      this._parent._updateTouched(opts, changedControl);
    }
  }
  /** @internal */
  _onDisabledChange = [];
  /** @internal */
  _registerOnCollectionChange(fn) {
    this._onCollectionChange = fn;
  }
  /** @internal */
  _setUpdateStrategy(opts) {
    if (isOptionsObj(opts) && opts.updateOn != null) {
      this._updateOn = opts.updateOn;
    }
  }
  /**
   * Check to see if parent has been marked artificially dirty.
   *
   * @internal
   */
  _parentMarkedDirty(onlySelf) {
    const parentDirty = this._parent && this._parent.dirty;
    return !onlySelf && !!parentDirty && !this._parent._anyControlsDirty();
  }
  /** @internal */
  _find(name2) {
    return null;
  }
  /**
   * Internal implementation of the `setValidators` method. Needs to be separated out into a
   * different method, because it is called in the constructor and it can break cases where
   * a control is extended.
   */
  _assignValidators(validators) {
    this._rawValidators = Array.isArray(validators) ? validators.slice() : validators;
    this._composedValidatorFn = coerceToValidator(this._rawValidators);
  }
  /**
   * Internal implementation of the `setAsyncValidators` method. Needs to be separated out into a
   * different method, because it is called in the constructor and it can break cases where
   * a control is extended.
   */
  _assignAsyncValidators(validators) {
    this._rawAsyncValidators = Array.isArray(validators) ? validators.slice() : validators;
    this._composedAsyncValidatorFn = coerceToAsyncValidator(this._rawAsyncValidators);
  }
};
var FormGroup = class extends AbstractControl {
  /**
   * Creates a new `FormGroup` instance.
   *
   * @param controls A collection of child controls. The key for each child is the name
   * under which it is registered.
   *
   * @param validatorOrOpts A synchronous validator function, or an array of
   * such functions, or an `AbstractControlOptions` object that contains validation functions
   * and a validation trigger.
   *
   * @param asyncValidator A single async validator or array of async validator functions
   *
   */
  constructor(controls, validatorOrOpts, asyncValidator) {
    super(pickValidators(validatorOrOpts), pickAsyncValidators(asyncValidator, validatorOrOpts));
    (typeof ngDevMode === "undefined" || ngDevMode) && validateFormGroupControls(controls);
    this.controls = controls;
    this._initObservables();
    this._setUpdateStrategy(validatorOrOpts);
    this._setUpControls();
    this.updateValueAndValidity({
      onlySelf: true,
      // If `asyncValidator` is present, it will trigger control status change from `PENDING` to
      // `VALID` or `INVALID`. The status should be broadcasted via the `statusChanges` observable,
      // so we set `emitEvent` to `true` to allow that during the control creation process.
      emitEvent: !!this.asyncValidator
    });
  }
  controls;
  registerControl(name2, control) {
    if (this.controls[name2]) return this.controls[name2];
    this.controls[name2] = control;
    control.setParent(this);
    control._registerOnCollectionChange(this._onCollectionChange);
    return control;
  }
  addControl(name2, control, options = {}) {
    this.registerControl(name2, control);
    this.updateValueAndValidity({
      emitEvent: options.emitEvent
    });
    this._onCollectionChange();
  }
  /**
   * Remove a control from this group. In a strongly-typed group, required controls cannot be
   * removed.
   *
   * This method also updates the value and validity of the control.
   *
   * @param name The control name to remove from the collection
   * @param options Specifies whether this FormGroup instance should emit events after a
   *     control is removed.
   * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
   * `valueChanges` observables emit events with the latest status and value when the control is
   * removed. When false, no events are emitted.
   */
  removeControl(name2, options = {}) {
    if (this.controls[name2]) this.controls[name2]._registerOnCollectionChange(() => {
    });
    delete this.controls[name2];
    this.updateValueAndValidity({
      emitEvent: options.emitEvent
    });
    this._onCollectionChange();
  }
  setControl(name2, control, options = {}) {
    if (this.controls[name2]) this.controls[name2]._registerOnCollectionChange(() => {
    });
    delete this.controls[name2];
    if (control) this.registerControl(name2, control);
    this.updateValueAndValidity({
      emitEvent: options.emitEvent
    });
    this._onCollectionChange();
  }
  contains(controlName) {
    return this.controls.hasOwnProperty(controlName) && this.controls[controlName].enabled;
  }
  /**
   * Sets the value of the `FormGroup`. It accepts an object that matches
   * the structure of the group, with control names as keys.
   *
   * @usageNotes
   * ### Set the complete value for the form group
   *
   * ```ts
   * const form = new FormGroup({
   *   first: new FormControl(),
   *   last: new FormControl()
   * });
   *
   * console.log(form.value);   // {first: null, last: null}
   *
   * form.setValue({first: 'Nancy', last: 'Drew'});
   * console.log(form.value);   // {first: 'Nancy', last: 'Drew'}
   * ```
   *
   * @throws When strict checks fail, such as setting the value of a control
   * that doesn't exist or if you exclude a value of a control that does exist.
   *
   * @param value The new value for the control that matches the structure of the group.
   * @param options Configuration options that determine how the control propagates changes
   * and emits events after the value changes.
   * The configuration options are passed to the {@link AbstractControl#updateValueAndValidity
   * updateValueAndValidity} method.
   *
   * * `onlySelf`: When true, each change only affects this control, and not its parent. Default is
   * false.
   * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
   * `valueChanges`
   * observables emit events with the latest status and value when the control value is updated.
   * When false, no events are emitted.
   */
  setValue(value, options = {}) {
    assertAllValuesPresent(this, true, value);
    Object.keys(value).forEach((name2) => {
      assertControlPresent(this, true, name2);
      this.controls[name2].setValue(value[name2], {
        onlySelf: true,
        emitEvent: options.emitEvent
      });
    });
    this.updateValueAndValidity(options);
  }
  /**
   * Patches the value of the `FormGroup`. It accepts an object with control
   * names as keys, and does its best to match the values to the correct controls
   * in the group.
   *
   * It accepts both super-sets and sub-sets of the group without throwing an error.
   *
   * @usageNotes
   * ### Patch the value for a form group
   *
   * ```ts
   * const form = new FormGroup({
   *    first: new FormControl(),
   *    last: new FormControl()
   * });
   * console.log(form.value);   // {first: null, last: null}
   *
   * form.patchValue({first: 'Nancy'});
   * console.log(form.value);   // {first: 'Nancy', last: null}
   * ```
   *
   * @param value The object that matches the structure of the group.
   * @param options Configuration options that determine how the control propagates changes and
   * emits events after the value is patched.
   * * `onlySelf`: When true, each change only affects this control and not its parent. Default is
   * true.
   * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
   * `valueChanges` observables emit events with the latest status and value when the control value
   * is updated. When false, no events are emitted. The configuration options are passed to
   * the {@link AbstractControl#updateValueAndValidity updateValueAndValidity} method.
   */
  patchValue(value, options = {}) {
    if (value == null) return;
    Object.keys(value).forEach((name2) => {
      const control = this.controls[name2];
      if (control) {
        control.patchValue(
          /* Guaranteed to be present, due to the outer forEach. */
          value[name2],
          {
            onlySelf: true,
            emitEvent: options.emitEvent
          }
        );
      }
    });
    this.updateValueAndValidity(options);
  }
  /**
   * Resets the `FormGroup`, marks all descendants `pristine` and `untouched` and sets
   * the value of all descendants to their default values, or null if no defaults were provided.
   *
   * You reset to a specific form state by passing in a map of states
   * that matches the structure of your form, with control names as keys. The state
   * is a standalone value or a form state object with both a value and a disabled
   * status.
   *
   * @param value Resets the control with an initial value,
   * or an object that defines the initial value and disabled state.
   *
   * @param options Configuration options that determine how the control propagates changes
   * and emits events when the group is reset.
   * * `onlySelf`: When true, each change only affects this control, and not its parent. Default is
   * false.
   * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
   * `valueChanges`
   * observables emit events with the latest status and value when the control is reset.
   * When false, no events are emitted.
   * The configuration options are passed to the {@link AbstractControl#updateValueAndValidity
   * updateValueAndValidity} method.
   *
   * @usageNotes
   *
   * ### Reset the form group values
   *
   * ```ts
   * const form = new FormGroup({
   *   first: new FormControl('first name'),
   *   last: new FormControl('last name')
   * });
   *
   * console.log(form.value);  // {first: 'first name', last: 'last name'}
   *
   * form.reset({ first: 'name', last: 'last name' });
   *
   * console.log(form.value);  // {first: 'name', last: 'last name'}
   * ```
   *
   * ### Reset the form group values and disabled status
   *
   * ```ts
   * const form = new FormGroup({
   *   first: new FormControl('first name'),
   *   last: new FormControl('last name')
   * });
   *
   * form.reset({
   *   first: {value: 'name', disabled: true},
   *   last: 'last'
   * });
   *
   * console.log(form.value);  // {last: 'last'}
   * console.log(form.get('first').status);  // 'DISABLED'
   * ```
   */
  reset(value = {}, options = {}) {
    this._forEachChild((control, name2) => {
      control.reset(value ? value[name2] : null, {
        onlySelf: true,
        emitEvent: options.emitEvent
      });
    });
    this._updatePristine(options, this);
    this._updateTouched(options, this);
    this.updateValueAndValidity(options);
  }
  /**
   * The aggregate value of the `FormGroup`, including any disabled controls.
   *
   * Retrieves all values regardless of disabled status.
   */
  getRawValue() {
    return this._reduceChildren({}, (acc, control, name2) => {
      acc[name2] = control.getRawValue();
      return acc;
    });
  }
  /** @internal */
  _syncPendingControls() {
    let subtreeUpdated = this._reduceChildren(false, (updated, child) => {
      return child._syncPendingControls() ? true : updated;
    });
    if (subtreeUpdated) this.updateValueAndValidity({
      onlySelf: true
    });
    return subtreeUpdated;
  }
  /** @internal */
  _forEachChild(cb) {
    Object.keys(this.controls).forEach((key) => {
      const control = this.controls[key];
      control && cb(control, key);
    });
  }
  /** @internal */
  _setUpControls() {
    this._forEachChild((control) => {
      control.setParent(this);
      control._registerOnCollectionChange(this._onCollectionChange);
    });
  }
  /** @internal */
  _updateValue() {
    this.value = this._reduceValue();
  }
  /** @internal */
  _anyControls(condition) {
    for (const [controlName, control] of Object.entries(this.controls)) {
      if (this.contains(controlName) && condition(control)) {
        return true;
      }
    }
    return false;
  }
  /** @internal */
  _reduceValue() {
    let acc = {};
    return this._reduceChildren(acc, (acc2, control, name2) => {
      if (control.enabled || this.disabled) {
        acc2[name2] = control.value;
      }
      return acc2;
    });
  }
  /** @internal */
  _reduceChildren(initValue, fn) {
    let res = initValue;
    this._forEachChild((control, name2) => {
      res = fn(res, control, name2);
    });
    return res;
  }
  /** @internal */
  _allControlsDisabled() {
    for (const controlName of Object.keys(this.controls)) {
      if (this.controls[controlName].enabled) {
        return false;
      }
    }
    return Object.keys(this.controls).length > 0 || this.disabled;
  }
  /** @internal */
  _find(name2) {
    return this.controls.hasOwnProperty(name2) ? this.controls[name2] : null;
  }
};
function validateFormGroupControls(controls) {
  const invalidKeys = Object.keys(controls).filter((key) => key.includes("."));
  if (invalidKeys.length > 0) {
    console.warn(`FormGroup keys cannot include \`.\`, please replace the keys for: ${invalidKeys.join(",")}.`);
  }
}
var FormRecord = class extends FormGroup {
};
var CALL_SET_DISABLED_STATE = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "CallSetDisabledState" : "", {
  providedIn: "root",
  factory: () => setDisabledStateDefault
});
var setDisabledStateDefault = "always";
function controlPath(name2, parent) {
  return [...parent.path, name2];
}
function setUpControl(control, dir, callSetDisabledState = setDisabledStateDefault) {
  if (typeof ngDevMode === "undefined" || ngDevMode) {
    if (!control) _throwError(dir, "Cannot find control with");
    if (!dir.valueAccessor) _throwMissingValueAccessorError(dir);
  }
  setUpValidators(control, dir);
  dir.valueAccessor.writeValue(control.value);
  if (control.disabled || callSetDisabledState === "always") {
    dir.valueAccessor.setDisabledState?.(control.disabled);
  }
  setUpViewChangePipeline(control, dir);
  setUpModelChangePipeline(control, dir);
  setUpBlurPipeline(control, dir);
  setUpDisabledChangeHandler(control, dir);
}
function cleanUpControl(control, dir, validateControlPresenceOnChange = true) {
  const noop4 = () => {
    if (validateControlPresenceOnChange && (typeof ngDevMode === "undefined" || ngDevMode)) {
      _noControlError(dir);
    }
  };
  if (dir.valueAccessor) {
    dir.valueAccessor.registerOnChange(noop4);
    dir.valueAccessor.registerOnTouched(noop4);
  }
  cleanUpValidators(control, dir);
  if (control) {
    dir._invokeOnDestroyCallbacks();
    control._registerOnCollectionChange(() => {
    });
  }
}
function registerOnValidatorChange(validators, onChange) {
  validators.forEach((validator) => {
    if (validator.registerOnValidatorChange) validator.registerOnValidatorChange(onChange);
  });
}
function setUpDisabledChangeHandler(control, dir) {
  if (dir.valueAccessor.setDisabledState) {
    const onDisabledChange = (isDisabled) => {
      dir.valueAccessor.setDisabledState(isDisabled);
    };
    control.registerOnDisabledChange(onDisabledChange);
    dir._registerOnDestroy(() => {
      control._unregisterOnDisabledChange(onDisabledChange);
    });
  }
}
function setUpValidators(control, dir) {
  const validators = getControlValidators(control);
  if (dir.validator !== null) {
    control.setValidators(mergeValidators(validators, dir.validator));
  } else if (typeof validators === "function") {
    control.setValidators([validators]);
  }
  const asyncValidators = getControlAsyncValidators(control);
  if (dir.asyncValidator !== null) {
    control.setAsyncValidators(mergeValidators(asyncValidators, dir.asyncValidator));
  } else if (typeof asyncValidators === "function") {
    control.setAsyncValidators([asyncValidators]);
  }
  const onValidatorChange = () => control.updateValueAndValidity();
  registerOnValidatorChange(dir._rawValidators, onValidatorChange);
  registerOnValidatorChange(dir._rawAsyncValidators, onValidatorChange);
}
function cleanUpValidators(control, dir) {
  let isControlUpdated = false;
  if (control !== null) {
    if (dir.validator !== null) {
      const validators = getControlValidators(control);
      if (Array.isArray(validators) && validators.length > 0) {
        const updatedValidators = validators.filter((validator) => validator !== dir.validator);
        if (updatedValidators.length !== validators.length) {
          isControlUpdated = true;
          control.setValidators(updatedValidators);
        }
      }
    }
    if (dir.asyncValidator !== null) {
      const asyncValidators = getControlAsyncValidators(control);
      if (Array.isArray(asyncValidators) && asyncValidators.length > 0) {
        const updatedAsyncValidators = asyncValidators.filter((asyncValidator) => asyncValidator !== dir.asyncValidator);
        if (updatedAsyncValidators.length !== asyncValidators.length) {
          isControlUpdated = true;
          control.setAsyncValidators(updatedAsyncValidators);
        }
      }
    }
  }
  const noop4 = () => {
  };
  registerOnValidatorChange(dir._rawValidators, noop4);
  registerOnValidatorChange(dir._rawAsyncValidators, noop4);
  return isControlUpdated;
}
function setUpViewChangePipeline(control, dir) {
  dir.valueAccessor.registerOnChange((newValue) => {
    control._pendingValue = newValue;
    control._pendingChange = true;
    control._pendingDirty = true;
    if (control.updateOn === "change") updateControl(control, dir);
  });
}
function setUpBlurPipeline(control, dir) {
  dir.valueAccessor.registerOnTouched(() => {
    control._pendingTouched = true;
    if (control.updateOn === "blur" && control._pendingChange) updateControl(control, dir);
    if (control.updateOn !== "submit") control.markAsTouched();
  });
}
function updateControl(control, dir) {
  if (control._pendingDirty) control.markAsDirty();
  control.setValue(control._pendingValue, {
    emitModelToViewChange: false
  });
  dir.viewToModelUpdate(control._pendingValue);
  control._pendingChange = false;
}
function setUpModelChangePipeline(control, dir) {
  const onChange = (newValue, emitModelEvent) => {
    dir.valueAccessor.writeValue(newValue);
    if (emitModelEvent) dir.viewToModelUpdate(newValue);
  };
  control.registerOnChange(onChange);
  dir._registerOnDestroy(() => {
    control._unregisterOnChange(onChange);
  });
}
function setUpFormContainer(control, dir) {
  if (control == null && (typeof ngDevMode === "undefined" || ngDevMode)) _throwError(dir, "Cannot find control with");
  setUpValidators(control, dir);
}
function cleanUpFormContainer(control, dir) {
  return cleanUpValidators(control, dir);
}
function _noControlError(dir) {
  return _throwError(dir, "There is no FormControl instance attached to form control element with");
}
function _throwError(dir, message) {
  const messageEnd = _describeControlLocation(dir);
  throw new Error(`${message} ${messageEnd}`);
}
function _describeControlLocation(dir) {
  const path = dir.path;
  if (path && path.length > 1) return `path: '${path.join(" -> ")}'`;
  if (path?.[0]) return `name: '${path}'`;
  return "unspecified name attribute";
}
function _throwMissingValueAccessorError(dir) {
  const loc = _describeControlLocation(dir);
  throw new RuntimeError(-1203, `No value accessor for form control ${loc}.`);
}
function _throwInvalidValueAccessorError(dir) {
  const loc = _describeControlLocation(dir);
  throw new RuntimeError(1200, `Value accessor was not provided as an array for form control with ${loc}. Check that the \`NG_VALUE_ACCESSOR\` token is configured as a \`multi: true\` provider.`);
}
function isPropertyUpdated(changes, viewModel) {
  if (!changes.hasOwnProperty("model")) return false;
  const change = changes["model"];
  if (change.isFirstChange()) return true;
  return !Object.is(viewModel, change.currentValue);
}
function isBuiltInAccessor(valueAccessor) {
  return Object.getPrototypeOf(valueAccessor.constructor) === BuiltInControlValueAccessor;
}
function syncPendingControls(form, directives) {
  form._syncPendingControls();
  directives.forEach((dir) => {
    const control = dir.control;
    if (control.updateOn === "submit" && control._pendingChange) {
      dir.viewToModelUpdate(control._pendingValue);
      control._pendingChange = false;
    }
  });
}
function selectValueAccessor(dir, valueAccessors) {
  if (!valueAccessors) return null;
  if (!Array.isArray(valueAccessors) && (typeof ngDevMode === "undefined" || ngDevMode)) _throwInvalidValueAccessorError(dir);
  let defaultAccessor = void 0;
  let builtinAccessor = void 0;
  let customAccessor = void 0;
  valueAccessors.forEach((v) => {
    if (v.constructor === DefaultValueAccessor) {
      defaultAccessor = v;
    } else if (isBuiltInAccessor(v)) {
      if (builtinAccessor && (typeof ngDevMode === "undefined" || ngDevMode)) _throwError(dir, "More than one built-in value accessor matches form control with");
      builtinAccessor = v;
    } else {
      if (customAccessor && (typeof ngDevMode === "undefined" || ngDevMode)) _throwError(dir, "More than one custom value accessor matches form control with");
      customAccessor = v;
    }
  });
  if (customAccessor) return customAccessor;
  if (builtinAccessor) return builtinAccessor;
  if (defaultAccessor) return defaultAccessor;
  if (typeof ngDevMode === "undefined" || ngDevMode) {
    _throwError(dir, "No valid value accessor for form control with");
  }
  return null;
}
function removeListItem$1(list, el) {
  const index = list.indexOf(el);
  if (index > -1) list.splice(index, 1);
}
function _ngModelWarning(name2, type, instance, warningConfig) {
  if (warningConfig === "never") return;
  if ((warningConfig === null || warningConfig === "once") && !type._ngModelWarningSentOnce || warningConfig === "always" && !instance._ngModelWarningSent) {
    console.warn(ngModelWarning(name2));
    type._ngModelWarningSentOnce = true;
    instance._ngModelWarningSent = true;
  }
}
var formDirectiveProvider$1 = {
  provide: ControlContainer,
  useExisting: forwardRef(() => NgForm)
};
var resolvedPromise$1 = (() => Promise.resolve())();
var NgForm = class _NgForm extends ControlContainer {
  callSetDisabledState;
  /**
   * @description
   * Returns whether the form submission has been triggered.
   */
  get submitted() {
    return untracked2(this.submittedReactive);
  }
  /** @internal */
  _submitted = computed(() => this.submittedReactive(), ...ngDevMode ? [{
    debugName: "_submitted"
  }] : []);
  submittedReactive = signal(false, ...ngDevMode ? [{
    debugName: "submittedReactive"
  }] : []);
  _directives = /* @__PURE__ */ new Set();
  /**
   * @description
   * The `FormGroup` instance created for this form.
   */
  form;
  /**
   * @description
   * Event emitter for the "ngSubmit" event
   */
  ngSubmit = new EventEmitter();
  /**
   * @description
   * Tracks options for the `NgForm` instance.
   *
   * **updateOn**: Sets the default `updateOn` value for all child `NgModels` below it
   * unless explicitly set by a child `NgModel` using `ngModelOptions`). Defaults to 'change'.
   * Possible values: `'change'` | `'blur'` | `'submit'`.
   *
   */
  options;
  constructor(validators, asyncValidators, callSetDisabledState) {
    super();
    this.callSetDisabledState = callSetDisabledState;
    this.form = new FormGroup({}, composeValidators(validators), composeAsyncValidators(asyncValidators));
  }
  /** @docs-private */
  ngAfterViewInit() {
    this._setUpdateStrategy();
  }
  /**
   * @description
   * The directive instance.
   */
  get formDirective() {
    return this;
  }
  /**
   * @description
   * The internal `FormGroup` instance.
   */
  get control() {
    return this.form;
  }
  /**
   * @description
   * Returns an array representing the path to this group. Because this directive
   * always lives at the top level of a form, it is always an empty array.
   */
  get path() {
    return [];
  }
  /**
   * @description
   * Returns a map of the controls in this group.
   */
  get controls() {
    return this.form.controls;
  }
  /**
   * @description
   * Method that sets up the control directive in this group, re-calculates its value
   * and validity, and adds the instance to the internal list of directives.
   *
   * @param dir The `NgModel` directive instance.
   */
  addControl(dir) {
    resolvedPromise$1.then(() => {
      const container = this._findContainer(dir.path);
      dir.control = container.registerControl(dir.name, dir.control);
      setUpControl(dir.control, dir, this.callSetDisabledState);
      dir.control.updateValueAndValidity({
        emitEvent: false
      });
      this._directives.add(dir);
    });
  }
  /**
   * @description
   * Retrieves the `FormControl` instance from the provided `NgModel` directive.
   *
   * @param dir The `NgModel` directive instance.
   */
  getControl(dir) {
    return this.form.get(dir.path);
  }
  /**
   * @description
   * Removes the `NgModel` instance from the internal list of directives
   *
   * @param dir The `NgModel` directive instance.
   */
  removeControl(dir) {
    resolvedPromise$1.then(() => {
      const container = this._findContainer(dir.path);
      if (container) {
        container.removeControl(dir.name);
      }
      this._directives.delete(dir);
    });
  }
  /**
   * @description
   * Adds a new `NgModelGroup` directive instance to the form.
   *
   * @param dir The `NgModelGroup` directive instance.
   */
  addFormGroup(dir) {
    resolvedPromise$1.then(() => {
      const container = this._findContainer(dir.path);
      const group = new FormGroup({});
      setUpFormContainer(group, dir);
      container.registerControl(dir.name, group);
      group.updateValueAndValidity({
        emitEvent: false
      });
    });
  }
  /**
   * @description
   * Removes the `NgModelGroup` directive instance from the form.
   *
   * @param dir The `NgModelGroup` directive instance.
   */
  removeFormGroup(dir) {
    resolvedPromise$1.then(() => {
      const container = this._findContainer(dir.path);
      if (container) {
        container.removeControl(dir.name);
      }
    });
  }
  /**
   * @description
   * Retrieves the `FormGroup` for a provided `NgModelGroup` directive instance
   *
   * @param dir The `NgModelGroup` directive instance.
   */
  getFormGroup(dir) {
    return this.form.get(dir.path);
  }
  /**
   * Sets the new value for the provided `NgControl` directive.
   *
   * @param dir The `NgControl` directive instance.
   * @param value The new value for the directive's control.
   */
  updateModel(dir, value) {
    resolvedPromise$1.then(() => {
      const ctrl = this.form.get(dir.path);
      ctrl.setValue(value);
    });
  }
  /**
   * @description
   * Sets the value for this `FormGroup`.
   *
   * @param value The new value
   */
  setValue(value) {
    this.control.setValue(value);
  }
  /**
   * @description
   * Method called when the "submit" event is triggered on the form.
   * Triggers the `ngSubmit` emitter to emit the "submit" event as its payload.
   *
   * @param $event The "submit" event object
   */
  onSubmit($event) {
    this.submittedReactive.set(true);
    syncPendingControls(this.form, this._directives);
    this.ngSubmit.emit($event);
    this.form._events.next(new FormSubmittedEvent(this.control));
    return $event?.target?.method === "dialog";
  }
  /**
   * @description
   * Method called when the "reset" event is triggered on the form.
   */
  onReset() {
    this.resetForm();
  }
  /**
   * @description
   * Resets the form to an initial value and resets its submitted status.
   *
   * @param value The new value for the form.
   */
  resetForm(value = void 0) {
    this.form.reset(value);
    this.submittedReactive.set(false);
    this.form._events.next(new FormResetEvent(this.form));
  }
  _setUpdateStrategy() {
    if (this.options && this.options.updateOn != null) {
      this.form._updateOn = this.options.updateOn;
    }
  }
  _findContainer(path) {
    path.pop();
    return path.length ? this.form.get(path) : this.form;
  }
  static \u0275fac = function NgForm_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _NgForm)(\u0275\u0275directiveInject(NG_VALIDATORS, 10), \u0275\u0275directiveInject(NG_ASYNC_VALIDATORS, 10), \u0275\u0275directiveInject(CALL_SET_DISABLED_STATE, 8));
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _NgForm,
    selectors: [["form", 3, "ngNoForm", "", 3, "formGroup", ""], ["ng-form"], ["", "ngForm", ""]],
    hostBindings: function NgForm_HostBindings(rf, ctx) {
      if (rf & 1) {
        \u0275\u0275listener("submit", function NgForm_submit_HostBindingHandler($event) {
          return ctx.onSubmit($event);
        })("reset", function NgForm_reset_HostBindingHandler() {
          return ctx.onReset();
        });
      }
    },
    inputs: {
      options: [0, "ngFormOptions", "options"]
    },
    outputs: {
      ngSubmit: "ngSubmit"
    },
    exportAs: ["ngForm"],
    standalone: false,
    features: [\u0275\u0275ProvidersFeature([formDirectiveProvider$1]), \u0275\u0275InheritDefinitionFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgForm, [{
    type: Directive,
    args: [{
      selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]",
      providers: [formDirectiveProvider$1],
      host: {
        "(submit)": "onSubmit($event)",
        "(reset)": "onReset()"
      },
      outputs: ["ngSubmit"],
      exportAs: "ngForm",
      standalone: false
    }]
  }], () => [{
    type: void 0,
    decorators: [{
      type: Optional
    }, {
      type: Self
    }, {
      type: Inject,
      args: [NG_VALIDATORS]
    }]
  }, {
    type: void 0,
    decorators: [{
      type: Optional
    }, {
      type: Self
    }, {
      type: Inject,
      args: [NG_ASYNC_VALIDATORS]
    }]
  }, {
    type: void 0,
    decorators: [{
      type: Optional
    }, {
      type: Inject,
      args: [CALL_SET_DISABLED_STATE]
    }]
  }], {
    options: [{
      type: Input,
      args: ["ngFormOptions"]
    }]
  });
})();
function removeListItem(list, el) {
  const index = list.indexOf(el);
  if (index > -1) list.splice(index, 1);
}
function isFormControlState(formState) {
  return typeof formState === "object" && formState !== null && Object.keys(formState).length === 2 && "value" in formState && "disabled" in formState;
}
var FormControl = class FormControl2 extends AbstractControl {
  /** @publicApi */
  defaultValue = null;
  /** @internal */
  _onChange = [];
  /** @internal */
  _pendingValue;
  /** @internal */
  _pendingChange = false;
  constructor(formState = null, validatorOrOpts, asyncValidator) {
    super(pickValidators(validatorOrOpts), pickAsyncValidators(asyncValidator, validatorOrOpts));
    this._applyFormState(formState);
    this._setUpdateStrategy(validatorOrOpts);
    this._initObservables();
    this.updateValueAndValidity({
      onlySelf: true,
      // If `asyncValidator` is present, it will trigger control status change from `PENDING` to
      // `VALID` or `INVALID`.
      // The status should be broadcasted via the `statusChanges` observable, so we set
      // `emitEvent` to `true` to allow that during the control creation process.
      emitEvent: !!this.asyncValidator
    });
    if (isOptionsObj(validatorOrOpts) && (validatorOrOpts.nonNullable || validatorOrOpts.initialValueIsDefault)) {
      if (isFormControlState(formState)) {
        this.defaultValue = formState.value;
      } else {
        this.defaultValue = formState;
      }
    }
  }
  setValue(value, options = {}) {
    this.value = this._pendingValue = value;
    if (this._onChange.length && options.emitModelToViewChange !== false) {
      this._onChange.forEach((changeFn) => changeFn(this.value, options.emitViewToModelChange !== false));
    }
    this.updateValueAndValidity(options);
  }
  patchValue(value, options = {}) {
    this.setValue(value, options);
  }
  reset(formState = this.defaultValue, options = {}) {
    this._applyFormState(formState);
    this.markAsPristine(options);
    this.markAsUntouched(options);
    this.setValue(this.value, options);
    this._pendingChange = false;
  }
  /**  @internal */
  _updateValue() {
  }
  /**  @internal */
  _anyControls(condition) {
    return false;
  }
  /**  @internal */
  _allControlsDisabled() {
    return this.disabled;
  }
  registerOnChange(fn) {
    this._onChange.push(fn);
  }
  /** @internal */
  _unregisterOnChange(fn) {
    removeListItem(this._onChange, fn);
  }
  registerOnDisabledChange(fn) {
    this._onDisabledChange.push(fn);
  }
  /** @internal */
  _unregisterOnDisabledChange(fn) {
    removeListItem(this._onDisabledChange, fn);
  }
  /** @internal */
  _forEachChild(cb) {
  }
  /** @internal */
  _syncPendingControls() {
    if (this.updateOn === "submit") {
      if (this._pendingDirty) this.markAsDirty();
      if (this._pendingTouched) this.markAsTouched();
      if (this._pendingChange) {
        this.setValue(this._pendingValue, {
          onlySelf: true,
          emitModelToViewChange: false
        });
        return true;
      }
    }
    return false;
  }
  _applyFormState(formState) {
    if (isFormControlState(formState)) {
      this.value = this._pendingValue = formState.value;
      formState.disabled ? this.disable({
        onlySelf: true,
        emitEvent: false
      }) : this.enable({
        onlySelf: true,
        emitEvent: false
      });
    } else {
      this.value = this._pendingValue = formState;
    }
  }
};
var isFormControl = (control) => control instanceof FormControl;
var AbstractFormGroupDirective = class _AbstractFormGroupDirective extends ControlContainer {
  /**
   * @description
   * The parent control for the group
   *
   * @internal
   */
  _parent;
  /** @docs-private */
  ngOnInit() {
    this._checkParentType();
    this.formDirective.addFormGroup(this);
  }
  /** @docs-private */
  ngOnDestroy() {
    if (this.formDirective) {
      this.formDirective.removeFormGroup(this);
    }
  }
  /**
   * @description
   * The `FormGroup` bound to this directive.
   */
  get control() {
    return this.formDirective.getFormGroup(this);
  }
  /**
   * @description
   * The path to this group from the top-level directive.
   */
  get path() {
    return controlPath(this.name == null ? this.name : this.name.toString(), this._parent);
  }
  /**
   * @description
   * The top-level directive for this group if present, otherwise null.
   */
  get formDirective() {
    return this._parent ? this._parent.formDirective : null;
  }
  /** @internal */
  _checkParentType() {
  }
  static \u0275fac = /* @__PURE__ */ (() => {
    let \u0275AbstractFormGroupDirective_BaseFactory;
    return function AbstractFormGroupDirective_Factory(__ngFactoryType__) {
      return (\u0275AbstractFormGroupDirective_BaseFactory || (\u0275AbstractFormGroupDirective_BaseFactory = \u0275\u0275getInheritedFactory(_AbstractFormGroupDirective)))(__ngFactoryType__ || _AbstractFormGroupDirective);
    };
  })();
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _AbstractFormGroupDirective,
    standalone: false,
    features: [\u0275\u0275InheritDefinitionFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(AbstractFormGroupDirective, [{
    type: Directive,
    args: [{
      standalone: false
    }]
  }], null, null);
})();
function modelParentException() {
  return new RuntimeError(1350, `
    ngModel cannot be used to register form controls with a parent formGroup directive.  Try using
    formGroup's partner directive "formControlName" instead.  Example:

    ${formControlNameExample}

    Or, if you'd like to avoid registering this form control, indicate that it's standalone in ngModelOptions:

    Example:

    ${ngModelWithFormGroupExample}`);
}
function formGroupNameException() {
  return new RuntimeError(1351, `
    ngModel cannot be used to register form controls with a parent formGroupName or formArrayName directive.

    Option 1: Use formControlName instead of ngModel (reactive strategy):

    ${formGroupNameExample}

    Option 2:  Update ngModel's parent be ngModelGroup (template-driven strategy):

    ${ngModelGroupExample}`);
}
function missingNameException() {
  return new RuntimeError(1352, `If ngModel is used within a form tag, either the name attribute must be set or the form
    control must be defined as 'standalone' in ngModelOptions.

    Example 1: <input [(ngModel)]="person.firstName" name="first">
    Example 2: <input [(ngModel)]="person.firstName" [ngModelOptions]="{standalone: true}">`);
}
function modelGroupParentException() {
  return new RuntimeError(1353, `
    ngModelGroup cannot be used with a parent formGroup directive.

    Option 1: Use formGroupName instead of ngModelGroup (reactive strategy):

    ${formGroupNameExample}

    Option 2:  Use a regular form tag instead of the formGroup directive (template-driven strategy):

    ${ngModelGroupExample}`);
}
var modelGroupProvider = {
  provide: ControlContainer,
  useExisting: forwardRef(() => NgModelGroup)
};
var NgModelGroup = class _NgModelGroup extends AbstractFormGroupDirective {
  /**
   * @description
   * Tracks the name of the `NgModelGroup` bound to the directive. The name corresponds
   * to a key in the parent `NgForm`.
   */
  name = "";
  constructor(parent, validators, asyncValidators) {
    super();
    this._parent = parent;
    this._setValidators(validators);
    this._setAsyncValidators(asyncValidators);
  }
  /** @internal */
  _checkParentType() {
    if (!(this._parent instanceof _NgModelGroup) && !(this._parent instanceof NgForm) && (typeof ngDevMode === "undefined" || ngDevMode)) {
      throw modelGroupParentException();
    }
  }
  static \u0275fac = function NgModelGroup_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _NgModelGroup)(\u0275\u0275directiveInject(ControlContainer, 5), \u0275\u0275directiveInject(NG_VALIDATORS, 10), \u0275\u0275directiveInject(NG_ASYNC_VALIDATORS, 10));
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _NgModelGroup,
    selectors: [["", "ngModelGroup", ""]],
    inputs: {
      name: [0, "ngModelGroup", "name"]
    },
    exportAs: ["ngModelGroup"],
    standalone: false,
    features: [\u0275\u0275ProvidersFeature([modelGroupProvider]), \u0275\u0275InheritDefinitionFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgModelGroup, [{
    type: Directive,
    args: [{
      selector: "[ngModelGroup]",
      providers: [modelGroupProvider],
      exportAs: "ngModelGroup",
      standalone: false
    }]
  }], () => [{
    type: ControlContainer,
    decorators: [{
      type: Host
    }, {
      type: SkipSelf
    }]
  }, {
    type: void 0,
    decorators: [{
      type: Optional
    }, {
      type: Self
    }, {
      type: Inject,
      args: [NG_VALIDATORS]
    }]
  }, {
    type: void 0,
    decorators: [{
      type: Optional
    }, {
      type: Self
    }, {
      type: Inject,
      args: [NG_ASYNC_VALIDATORS]
    }]
  }], {
    name: [{
      type: Input,
      args: ["ngModelGroup"]
    }]
  });
})();
var formControlBinding$1 = {
  provide: NgControl,
  useExisting: forwardRef(() => NgModel)
};
var resolvedPromise = (() => Promise.resolve())();
var NgModel = class _NgModel extends NgControl {
  _changeDetectorRef;
  callSetDisabledState;
  control = new FormControl();
  // At runtime we coerce arbitrary values assigned to the "disabled" input to a "boolean".
  // This is not reflected in the type of the property because outside of templates, consumers
  // should only deal with booleans. In templates, a string is allowed for convenience and to
  // match the native "disabled attribute" semantics which can be observed on input elements.
  // This static member tells the compiler that values of type "string" can also be assigned
  // to the input in a template.
  /** @docs-private */
  static ngAcceptInputType_isDisabled;
  /** @internal */
  _registered = false;
  /**
   * Internal reference to the view model value.
   * @docs-private
   */
  viewModel;
  /**
   * @description
   * Tracks the name bound to the directive. If a parent form exists, it
   * uses this name as a key to retrieve this control's value.
   */
  name = "";
  /**
   * @description
   * Tracks whether the control is disabled.
   */
  isDisabled;
  /**
   * @description
   * Tracks the value bound to this directive.
   */
  model;
  /**
   * @description
   * Tracks the configuration options for this `ngModel` instance.
   *
   * **name**: An alternative to setting the name attribute on the form control element. See
   * the [example](api/forms/NgModel#using-ngmodel-on-a-standalone-control) for using `NgModel`
   * as a standalone control.
   *
   * **standalone**: When set to true, the `ngModel` will not register itself with its parent form,
   * and acts as if it's not in the form. Defaults to false. If no parent form exists, this option
   * has no effect.
   *
   * **updateOn**: Defines the event upon which the form control value and validity update.
   * Defaults to 'change'. Possible values: `'change'` | `'blur'` | `'submit'`.
   *
   */
  options;
  /**
   * @description
   * Event emitter for producing the `ngModelChange` event after
   * the view model updates.
   */
  update = new EventEmitter();
  constructor(parent, validators, asyncValidators, valueAccessors, _changeDetectorRef, callSetDisabledState) {
    super();
    this._changeDetectorRef = _changeDetectorRef;
    this.callSetDisabledState = callSetDisabledState;
    this._parent = parent;
    this._setValidators(validators);
    this._setAsyncValidators(asyncValidators);
    this.valueAccessor = selectValueAccessor(this, valueAccessors);
  }
  /** @docs-private */
  ngOnChanges(changes) {
    this._checkForErrors();
    if (!this._registered || "name" in changes) {
      if (this._registered) {
        this._checkName();
        if (this.formDirective) {
          const oldName = changes["name"].previousValue;
          this.formDirective.removeControl({
            name: oldName,
            path: this._getPath(oldName)
          });
        }
      }
      this._setUpControl();
    }
    if ("isDisabled" in changes) {
      this._updateDisabled(changes);
    }
    if (isPropertyUpdated(changes, this.viewModel)) {
      this._updateValue(this.model);
      this.viewModel = this.model;
    }
  }
  /** @docs-private */
  ngOnDestroy() {
    this.formDirective && this.formDirective.removeControl(this);
  }
  /**
   * @description
   * Returns an array that represents the path from the top-level form to this control.
   * Each index is the string name of the control on that level.
   */
  get path() {
    return this._getPath(this.name);
  }
  /**
   * @description
   * The top-level directive for this control if present, otherwise null.
   */
  get formDirective() {
    return this._parent ? this._parent.formDirective : null;
  }
  /**
   * @description
   * Sets the new value for the view model and emits an `ngModelChange` event.
   *
   * @param newValue The new value emitted by `ngModelChange`.
   */
  viewToModelUpdate(newValue) {
    this.viewModel = newValue;
    this.update.emit(newValue);
  }
  _setUpControl() {
    this._setUpdateStrategy();
    this._isStandalone() ? this._setUpStandalone() : this.formDirective.addControl(this);
    this._registered = true;
  }
  _setUpdateStrategy() {
    if (this.options && this.options.updateOn != null) {
      this.control._updateOn = this.options.updateOn;
    }
  }
  _isStandalone() {
    return !this._parent || !!(this.options && this.options.standalone);
  }
  _setUpStandalone() {
    setUpControl(this.control, this, this.callSetDisabledState);
    this.control.updateValueAndValidity({
      emitEvent: false
    });
  }
  _checkForErrors() {
    if ((typeof ngDevMode === "undefined" || ngDevMode) && !this._isStandalone()) {
      checkParentType$1(this._parent);
    }
    this._checkName();
  }
  _checkName() {
    if (this.options && this.options.name) this.name = this.options.name;
    if (!this._isStandalone() && !this.name && (typeof ngDevMode === "undefined" || ngDevMode)) {
      throw missingNameException();
    }
  }
  _updateValue(value) {
    resolvedPromise.then(() => {
      this.control.setValue(value, {
        emitViewToModelChange: false
      });
      this._changeDetectorRef?.markForCheck();
    });
  }
  _updateDisabled(changes) {
    const disabledValue = changes["isDisabled"].currentValue;
    const isDisabled = disabledValue !== 0 && booleanAttribute(disabledValue);
    resolvedPromise.then(() => {
      if (isDisabled && !this.control.disabled) {
        this.control.disable();
      } else if (!isDisabled && this.control.disabled) {
        this.control.enable();
      }
      this._changeDetectorRef?.markForCheck();
    });
  }
  _getPath(controlName) {
    return this._parent ? controlPath(controlName, this._parent) : [controlName];
  }
  static \u0275fac = function NgModel_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _NgModel)(\u0275\u0275directiveInject(ControlContainer, 9), \u0275\u0275directiveInject(NG_VALIDATORS, 10), \u0275\u0275directiveInject(NG_ASYNC_VALIDATORS, 10), \u0275\u0275directiveInject(NG_VALUE_ACCESSOR, 10), \u0275\u0275directiveInject(ChangeDetectorRef, 8), \u0275\u0275directiveInject(CALL_SET_DISABLED_STATE, 8));
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _NgModel,
    selectors: [["", "ngModel", "", 3, "formControlName", "", 3, "formControl", ""]],
    inputs: {
      name: "name",
      isDisabled: [0, "disabled", "isDisabled"],
      model: [0, "ngModel", "model"],
      options: [0, "ngModelOptions", "options"]
    },
    outputs: {
      update: "ngModelChange"
    },
    exportAs: ["ngModel"],
    standalone: false,
    features: [\u0275\u0275ProvidersFeature([formControlBinding$1]), \u0275\u0275InheritDefinitionFeature, \u0275\u0275NgOnChangesFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgModel, [{
    type: Directive,
    args: [{
      selector: "[ngModel]:not([formControlName]):not([formControl])",
      providers: [formControlBinding$1],
      exportAs: "ngModel",
      standalone: false
    }]
  }], () => [{
    type: ControlContainer,
    decorators: [{
      type: Optional
    }, {
      type: Host
    }]
  }, {
    type: void 0,
    decorators: [{
      type: Optional
    }, {
      type: Self
    }, {
      type: Inject,
      args: [NG_VALIDATORS]
    }]
  }, {
    type: void 0,
    decorators: [{
      type: Optional
    }, {
      type: Self
    }, {
      type: Inject,
      args: [NG_ASYNC_VALIDATORS]
    }]
  }, {
    type: void 0,
    decorators: [{
      type: Optional
    }, {
      type: Self
    }, {
      type: Inject,
      args: [NG_VALUE_ACCESSOR]
    }]
  }, {
    type: ChangeDetectorRef,
    decorators: [{
      type: Optional
    }, {
      type: Inject,
      args: [ChangeDetectorRef]
    }]
  }, {
    type: void 0,
    decorators: [{
      type: Optional
    }, {
      type: Inject,
      args: [CALL_SET_DISABLED_STATE]
    }]
  }], {
    name: [{
      type: Input
    }],
    isDisabled: [{
      type: Input,
      args: ["disabled"]
    }],
    model: [{
      type: Input,
      args: ["ngModel"]
    }],
    options: [{
      type: Input,
      args: ["ngModelOptions"]
    }],
    update: [{
      type: Output,
      args: ["ngModelChange"]
    }]
  });
})();
function checkParentType$1(parent) {
  if (!(parent instanceof NgModelGroup) && parent instanceof AbstractFormGroupDirective) {
    throw formGroupNameException();
  } else if (!(parent instanceof NgModelGroup) && !(parent instanceof NgForm)) {
    throw modelParentException();
  }
}
var \u0275NgNoValidate = class _\u0275NgNoValidate {
  static \u0275fac = function \u0275NgNoValidate_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _\u0275NgNoValidate)();
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _\u0275NgNoValidate,
    selectors: [["form", 3, "ngNoForm", "", 3, "ngNativeValidate", ""]],
    hostAttrs: ["novalidate", ""],
    standalone: false
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(\u0275NgNoValidate, [{
    type: Directive,
    args: [{
      selector: "form:not([ngNoForm]):not([ngNativeValidate])",
      host: {
        "novalidate": ""
      },
      standalone: false
    }]
  }], null, null);
})();
var NUMBER_VALUE_ACCESSOR = {
  provide: NG_VALUE_ACCESSOR,
  useExisting: forwardRef(() => NumberValueAccessor),
  multi: true
};
var NumberValueAccessor = class _NumberValueAccessor extends BuiltInControlValueAccessor {
  /**
   * Sets the "value" property on the input element.
   * @docs-private
   */
  writeValue(value) {
    const normalizedValue = value == null ? "" : value;
    this.setProperty("value", normalizedValue);
  }
  /**
   * Registers a function called when the control value changes.
   * @docs-private
   */
  registerOnChange(fn) {
    this.onChange = (value) => {
      fn(value == "" ? null : parseFloat(value));
    };
  }
  static \u0275fac = /* @__PURE__ */ (() => {
    let \u0275NumberValueAccessor_BaseFactory;
    return function NumberValueAccessor_Factory(__ngFactoryType__) {
      return (\u0275NumberValueAccessor_BaseFactory || (\u0275NumberValueAccessor_BaseFactory = \u0275\u0275getInheritedFactory(_NumberValueAccessor)))(__ngFactoryType__ || _NumberValueAccessor);
    };
  })();
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _NumberValueAccessor,
    selectors: [["input", "type", "number", "formControlName", ""], ["input", "type", "number", "formControl", ""], ["input", "type", "number", "ngModel", ""]],
    hostBindings: function NumberValueAccessor_HostBindings(rf, ctx) {
      if (rf & 1) {
        \u0275\u0275listener("input", function NumberValueAccessor_input_HostBindingHandler($event) {
          return ctx.onChange($event.target.value);
        })("blur", function NumberValueAccessor_blur_HostBindingHandler() {
          return ctx.onTouched();
        });
      }
    },
    standalone: false,
    features: [\u0275\u0275ProvidersFeature([NUMBER_VALUE_ACCESSOR]), \u0275\u0275InheritDefinitionFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NumberValueAccessor, [{
    type: Directive,
    args: [{
      selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]",
      host: {
        "(input)": "onChange($any($event.target).value)",
        "(blur)": "onTouched()"
      },
      providers: [NUMBER_VALUE_ACCESSOR],
      standalone: false
    }]
  }], null, null);
})();
var RADIO_VALUE_ACCESSOR = {
  provide: NG_VALUE_ACCESSOR,
  useExisting: forwardRef(() => RadioControlValueAccessor),
  multi: true
};
function throwNameError() {
  throw new RuntimeError(1202, `
      If you define both a name and a formControlName attribute on your radio button, their values
      must match. Ex: <input type="radio" formControlName="food" name="food">
    `);
}
var RadioControlRegistry = class _RadioControlRegistry {
  _accessors = [];
  /**
   * @description
   * Adds a control to the internal registry. For internal use only.
   */
  add(control, accessor) {
    this._accessors.push([control, accessor]);
  }
  /**
   * @description
   * Removes a control from the internal registry. For internal use only.
   */
  remove(accessor) {
    for (let i = this._accessors.length - 1; i >= 0; --i) {
      if (this._accessors[i][1] === accessor) {
        this._accessors.splice(i, 1);
        return;
      }
    }
  }
  /**
   * @description
   * Selects a radio button. For internal use only.
   */
  select(accessor) {
    this._accessors.forEach((c) => {
      if (this._isSameGroup(c, accessor) && c[1] !== accessor) {
        c[1].fireUncheck(accessor.value);
      }
    });
  }
  _isSameGroup(controlPair, accessor) {
    if (!controlPair[0].control) return false;
    return controlPair[0]._parent === accessor._control._parent && controlPair[1].name === accessor.name;
  }
  static \u0275fac = function RadioControlRegistry_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _RadioControlRegistry)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _RadioControlRegistry,
    factory: _RadioControlRegistry.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(RadioControlRegistry, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], null, null);
})();
var RadioControlValueAccessor = class _RadioControlValueAccessor extends BuiltInControlValueAccessor {
  _registry;
  _injector;
  /** @internal */
  _state;
  /** @internal */
  _control;
  /** @internal */
  _fn;
  setDisabledStateFired = false;
  /**
   * The registered callback function called when a change event occurs on the input element.
   * Note: we declare `onChange` here (also used as host listener) as a function with no arguments
   * to override the `onChange` function (which expects 1 argument) in the parent
   * `BaseControlValueAccessor` class.
   * @docs-private
   */
  onChange = () => {
  };
  /**
   * @description
   * Tracks the name of the radio input element.
   */
  name;
  /**
   * @description
   * Tracks the name of the `FormControl` bound to the directive. The name corresponds
   * to a key in the parent `FormGroup` or `FormArray`.
   */
  formControlName;
  /**
   * @description
   * Tracks the value of the radio input element
   */
  value;
  callSetDisabledState = inject2(CALL_SET_DISABLED_STATE, {
    optional: true
  }) ?? setDisabledStateDefault;
  constructor(renderer, elementRef, _registry, _injector) {
    super(renderer, elementRef);
    this._registry = _registry;
    this._injector = _injector;
  }
  /** @docs-private */
  ngOnInit() {
    this._control = this._injector.get(NgControl);
    this._checkName();
    this._registry.add(this._control, this);
  }
  /** @docs-private */
  ngOnDestroy() {
    this._registry.remove(this);
  }
  /**
   * Sets the "checked" property value on the radio input element.
   * @docs-private
   */
  writeValue(value) {
    this._state = value === this.value;
    this.setProperty("checked", this._state);
  }
  /**
   * Registers a function called when the control value changes.
   * @docs-private
   */
  registerOnChange(fn) {
    this._fn = fn;
    this.onChange = () => {
      fn(this.value);
      this._registry.select(this);
    };
  }
  /** @docs-private */
  setDisabledState(isDisabled) {
    if (this.setDisabledStateFired || isDisabled || this.callSetDisabledState === "whenDisabledForLegacyCode") {
      this.setProperty("disabled", isDisabled);
    }
    this.setDisabledStateFired = true;
  }
  /**
   * Sets the "value" on the radio input element and unchecks it.
   *
   * @param value
   */
  fireUncheck(value) {
    this.writeValue(value);
  }
  _checkName() {
    if (this.name && this.formControlName && this.name !== this.formControlName && (typeof ngDevMode === "undefined" || ngDevMode)) {
      throwNameError();
    }
    if (!this.name && this.formControlName) this.name = this.formControlName;
  }
  static \u0275fac = function RadioControlValueAccessor_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _RadioControlValueAccessor)(\u0275\u0275directiveInject(Renderer2), \u0275\u0275directiveInject(ElementRef), \u0275\u0275directiveInject(RadioControlRegistry), \u0275\u0275directiveInject(Injector));
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _RadioControlValueAccessor,
    selectors: [["input", "type", "radio", "formControlName", ""], ["input", "type", "radio", "formControl", ""], ["input", "type", "radio", "ngModel", ""]],
    hostBindings: function RadioControlValueAccessor_HostBindings(rf, ctx) {
      if (rf & 1) {
        \u0275\u0275listener("change", function RadioControlValueAccessor_change_HostBindingHandler() {
          return ctx.onChange();
        })("blur", function RadioControlValueAccessor_blur_HostBindingHandler() {
          return ctx.onTouched();
        });
      }
    },
    inputs: {
      name: "name",
      formControlName: "formControlName",
      value: "value"
    },
    standalone: false,
    features: [\u0275\u0275ProvidersFeature([RADIO_VALUE_ACCESSOR]), \u0275\u0275InheritDefinitionFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(RadioControlValueAccessor, [{
    type: Directive,
    args: [{
      selector: "input[type=radio][formControlName],input[type=radio][formControl],input[type=radio][ngModel]",
      host: {
        "(change)": "onChange()",
        "(blur)": "onTouched()"
      },
      providers: [RADIO_VALUE_ACCESSOR],
      standalone: false
    }]
  }], () => [{
    type: Renderer2
  }, {
    type: ElementRef
  }, {
    type: RadioControlRegistry
  }, {
    type: Injector
  }], {
    name: [{
      type: Input
    }],
    formControlName: [{
      type: Input
    }],
    value: [{
      type: Input
    }]
  });
})();
var RANGE_VALUE_ACCESSOR = {
  provide: NG_VALUE_ACCESSOR,
  useExisting: forwardRef(() => RangeValueAccessor),
  multi: true
};
var RangeValueAccessor = class _RangeValueAccessor extends BuiltInControlValueAccessor {
  /**
   * Sets the "value" property on the input element.
   * @docs-private
   */
  writeValue(value) {
    this.setProperty("value", parseFloat(value));
  }
  /**
   * Registers a function called when the control value changes.
   * @docs-private
   */
  registerOnChange(fn) {
    this.onChange = (value) => {
      fn(value == "" ? null : parseFloat(value));
    };
  }
  static \u0275fac = /* @__PURE__ */ (() => {
    let \u0275RangeValueAccessor_BaseFactory;
    return function RangeValueAccessor_Factory(__ngFactoryType__) {
      return (\u0275RangeValueAccessor_BaseFactory || (\u0275RangeValueAccessor_BaseFactory = \u0275\u0275getInheritedFactory(_RangeValueAccessor)))(__ngFactoryType__ || _RangeValueAccessor);
    };
  })();
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _RangeValueAccessor,
    selectors: [["input", "type", "range", "formControlName", ""], ["input", "type", "range", "formControl", ""], ["input", "type", "range", "ngModel", ""]],
    hostBindings: function RangeValueAccessor_HostBindings(rf, ctx) {
      if (rf & 1) {
        \u0275\u0275listener("change", function RangeValueAccessor_change_HostBindingHandler($event) {
          return ctx.onChange($event.target.value);
        })("input", function RangeValueAccessor_input_HostBindingHandler($event) {
          return ctx.onChange($event.target.value);
        })("blur", function RangeValueAccessor_blur_HostBindingHandler() {
          return ctx.onTouched();
        });
      }
    },
    standalone: false,
    features: [\u0275\u0275ProvidersFeature([RANGE_VALUE_ACCESSOR]), \u0275\u0275InheritDefinitionFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(RangeValueAccessor, [{
    type: Directive,
    args: [{
      selector: "input[type=range][formControlName],input[type=range][formControl],input[type=range][ngModel]",
      host: {
        "(change)": "onChange($any($event.target).value)",
        "(input)": "onChange($any($event.target).value)",
        "(blur)": "onTouched()"
      },
      providers: [RANGE_VALUE_ACCESSOR],
      standalone: false
    }]
  }], null, null);
})();
var NG_MODEL_WITH_FORM_CONTROL_WARNING = new InjectionToken(ngDevMode ? "NgModelWithFormControlWarning" : "");
var formControlBinding = {
  provide: NgControl,
  useExisting: forwardRef(() => FormControlDirective)
};
var FormControlDirective = class _FormControlDirective extends NgControl {
  _ngModelWarningConfig;
  callSetDisabledState;
  /**
   * Internal reference to the view model value.
   * @docs-private
   */
  viewModel;
  /**
   * @description
   * Tracks the `FormControl` instance bound to the directive.
   */
  form;
  /**
   * @description
   * Triggers a warning in dev mode that this input should not be used with reactive forms.
   */
  set isDisabled(isDisabled) {
    if (typeof ngDevMode === "undefined" || ngDevMode) {
      console.warn(disabledAttrWarning);
    }
  }
  // TODO(kara): remove next 4 properties once deprecation period is over
  /** @deprecated as of v6 */
  model;
  /** @deprecated as of v6 */
  update = new EventEmitter();
  /**
   * @description
   * Static property used to track whether any ngModel warnings have been sent across
   * all instances of FormControlDirective. Used to support warning config of "once".
   *
   * @internal
   */
  static _ngModelWarningSentOnce = false;
  /**
   * @description
   * Instance property used to track whether an ngModel warning has been sent out for this
   * particular `FormControlDirective` instance. Used to support warning config of "always".
   *
   * @internal
   */
  _ngModelWarningSent = false;
  constructor(validators, asyncValidators, valueAccessors, _ngModelWarningConfig, callSetDisabledState) {
    super();
    this._ngModelWarningConfig = _ngModelWarningConfig;
    this.callSetDisabledState = callSetDisabledState;
    this._setValidators(validators);
    this._setAsyncValidators(asyncValidators);
    this.valueAccessor = selectValueAccessor(this, valueAccessors);
  }
  /** @docs-private */
  ngOnChanges(changes) {
    if (this._isControlChanged(changes)) {
      const previousForm = changes["form"].previousValue;
      if (previousForm) {
        cleanUpControl(
          previousForm,
          this,
          /* validateControlPresenceOnChange */
          false
        );
      }
      setUpControl(this.form, this, this.callSetDisabledState);
      this.form.updateValueAndValidity({
        emitEvent: false
      });
    }
    if (isPropertyUpdated(changes, this.viewModel)) {
      if (typeof ngDevMode === "undefined" || ngDevMode) {
        _ngModelWarning("formControl", _FormControlDirective, this, this._ngModelWarningConfig);
      }
      this.form.setValue(this.model);
      this.viewModel = this.model;
    }
  }
  /** @docs-private */
  ngOnDestroy() {
    if (this.form) {
      cleanUpControl(
        this.form,
        this,
        /* validateControlPresenceOnChange */
        false
      );
    }
  }
  /**
   * @description
   * Returns an array that represents the path from the top-level form to this control.
   * Each index is the string name of the control on that level.
   */
  get path() {
    return [];
  }
  /**
   * @description
   * The `FormControl` bound to this directive.
   */
  get control() {
    return this.form;
  }
  /**
   * @description
   * Sets the new value for the view model and emits an `ngModelChange` event.
   *
   * @param newValue The new value for the view model.
   */
  viewToModelUpdate(newValue) {
    this.viewModel = newValue;
    this.update.emit(newValue);
  }
  _isControlChanged(changes) {
    return changes.hasOwnProperty("form");
  }
  static \u0275fac = function FormControlDirective_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _FormControlDirective)(\u0275\u0275directiveInject(NG_VALIDATORS, 10), \u0275\u0275directiveInject(NG_ASYNC_VALIDATORS, 10), \u0275\u0275directiveInject(NG_VALUE_ACCESSOR, 10), \u0275\u0275directiveInject(NG_MODEL_WITH_FORM_CONTROL_WARNING, 8), \u0275\u0275directiveInject(CALL_SET_DISABLED_STATE, 8));
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _FormControlDirective,
    selectors: [["", "formControl", ""]],
    inputs: {
      form: [0, "formControl", "form"],
      isDisabled: [0, "disabled", "isDisabled"],
      model: [0, "ngModel", "model"]
    },
    outputs: {
      update: "ngModelChange"
    },
    exportAs: ["ngForm"],
    standalone: false,
    features: [\u0275\u0275ProvidersFeature([formControlBinding]), \u0275\u0275InheritDefinitionFeature, \u0275\u0275NgOnChangesFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(FormControlDirective, [{
    type: Directive,
    args: [{
      selector: "[formControl]",
      providers: [formControlBinding],
      exportAs: "ngForm",
      standalone: false
    }]
  }], () => [{
    type: void 0,
    decorators: [{
      type: Optional
    }, {
      type: Self
    }, {
      type: Inject,
      args: [NG_VALIDATORS]
    }]
  }, {
    type: void 0,
    decorators: [{
      type: Optional
    }, {
      type: Self
    }, {
      type: Inject,
      args: [NG_ASYNC_VALIDATORS]
    }]
  }, {
    type: void 0,
    decorators: [{
      type: Optional
    }, {
      type: Self
    }, {
      type: Inject,
      args: [NG_VALUE_ACCESSOR]
    }]
  }, {
    type: void 0,
    decorators: [{
      type: Optional
    }, {
      type: Inject,
      args: [NG_MODEL_WITH_FORM_CONTROL_WARNING]
    }]
  }, {
    type: void 0,
    decorators: [{
      type: Optional
    }, {
      type: Inject,
      args: [CALL_SET_DISABLED_STATE]
    }]
  }], {
    form: [{
      type: Input,
      args: ["formControl"]
    }],
    isDisabled: [{
      type: Input,
      args: ["disabled"]
    }],
    model: [{
      type: Input,
      args: ["ngModel"]
    }],
    update: [{
      type: Output,
      args: ["ngModelChange"]
    }]
  });
})();
var formDirectiveProvider = {
  provide: ControlContainer,
  useExisting: forwardRef(() => FormGroupDirective)
};
var FormGroupDirective = class _FormGroupDirective extends ControlContainer {
  callSetDisabledState;
  /**
   * @description
   * Reports whether the form submission has been triggered.
   */
  get submitted() {
    return untracked2(this._submittedReactive);
  }
  // TODO(atscott): Remove once invalid API usage is cleaned up internally
  set submitted(value) {
    this._submittedReactive.set(value);
  }
  /** @internal */
  _submitted = computed(() => this._submittedReactive(), ...ngDevMode ? [{
    debugName: "_submitted"
  }] : []);
  _submittedReactive = signal(false, ...ngDevMode ? [{
    debugName: "_submittedReactive"
  }] : []);
  /**
   * Reference to an old form group input value, which is needed to cleanup
   * old instance in case it was replaced with a new one.
   */
  _oldForm;
  /**
   * Callback that should be invoked when controls in FormGroup or FormArray collection change
   * (added or removed). This callback triggers corresponding DOM updates.
   */
  _onCollectionChange = () => this._updateDomValue();
  /**
   * @description
   * Tracks the list of added `FormControlName` instances
   */
  directives = [];
  /**
   * @description
   * Tracks the `FormGroup` bound to this directive.
   */
  form = null;
  /**
   * @description
   * Emits an event when the form submission has been triggered.
   */
  ngSubmit = new EventEmitter();
  constructor(validators, asyncValidators, callSetDisabledState) {
    super();
    this.callSetDisabledState = callSetDisabledState;
    this._setValidators(validators);
    this._setAsyncValidators(asyncValidators);
  }
  /** @docs-private */
  ngOnChanges(changes) {
    if ((typeof ngDevMode === "undefined" || ngDevMode) && !this.form) {
      throw missingFormException();
    }
    if (changes.hasOwnProperty("form")) {
      this._updateValidators();
      this._updateDomValue();
      this._updateRegistrations();
      this._oldForm = this.form;
    }
  }
  /** @docs-private */
  ngOnDestroy() {
    if (this.form) {
      cleanUpValidators(this.form, this);
      if (this.form._onCollectionChange === this._onCollectionChange) {
        this.form._registerOnCollectionChange(() => {
        });
      }
    }
  }
  /**
   * @description
   * Returns this directive's instance.
   */
  get formDirective() {
    return this;
  }
  /**
   * @description
   * Returns the `FormGroup` bound to this directive.
   */
  get control() {
    return this.form;
  }
  /**
   * @description
   * Returns an array representing the path to this group. Because this directive
   * always lives at the top level of a form, it always an empty array.
   */
  get path() {
    return [];
  }
  /**
   * @description
   * Method that sets up the control directive in this group, re-calculates its value
   * and validity, and adds the instance to the internal list of directives.
   *
   * @param dir The `FormControlName` directive instance.
   */
  addControl(dir) {
    const ctrl = this.form.get(dir.path);
    setUpControl(ctrl, dir, this.callSetDisabledState);
    ctrl.updateValueAndValidity({
      emitEvent: false
    });
    this.directives.push(dir);
    return ctrl;
  }
  /**
   * @description
   * Retrieves the `FormControl` instance from the provided `FormControlName` directive
   *
   * @param dir The `FormControlName` directive instance.
   */
  getControl(dir) {
    return this.form.get(dir.path);
  }
  /**
   * @description
   * Removes the `FormControlName` instance from the internal list of directives
   *
   * @param dir The `FormControlName` directive instance.
   */
  removeControl(dir) {
    cleanUpControl(
      dir.control || null,
      dir,
      /* validateControlPresenceOnChange */
      false
    );
    removeListItem$1(this.directives, dir);
  }
  /**
   * Adds a new `FormGroupName` directive instance to the form.
   *
   * @param dir The `FormGroupName` directive instance.
   */
  addFormGroup(dir) {
    this._setUpFormContainer(dir);
  }
  /**
   * Performs the necessary cleanup when a `FormGroupName` directive instance is removed from the
   * view.
   *
   * @param dir The `FormGroupName` directive instance.
   */
  removeFormGroup(dir) {
    this._cleanUpFormContainer(dir);
  }
  /**
   * @description
   * Retrieves the `FormGroup` for a provided `FormGroupName` directive instance
   *
   * @param dir The `FormGroupName` directive instance.
   */
  getFormGroup(dir) {
    return this.form.get(dir.path);
  }
  /**
   * Performs the necessary setup when a `FormArrayName` directive instance is added to the view.
   *
   * @param dir The `FormArrayName` directive instance.
   */
  addFormArray(dir) {
    this._setUpFormContainer(dir);
  }
  /**
   * Performs the necessary cleanup when a `FormArrayName` directive instance is removed from the
   * view.
   *
   * @param dir The `FormArrayName` directive instance.
   */
  removeFormArray(dir) {
    this._cleanUpFormContainer(dir);
  }
  /**
   * @description
   * Retrieves the `FormArray` for a provided `FormArrayName` directive instance.
   *
   * @param dir The `FormArrayName` directive instance.
   */
  getFormArray(dir) {
    return this.form.get(dir.path);
  }
  /**
   * Sets the new value for the provided `FormControlName` directive.
   *
   * @param dir The `FormControlName` directive instance.
   * @param value The new value for the directive's control.
   */
  updateModel(dir, value) {
    const ctrl = this.form.get(dir.path);
    ctrl.setValue(value);
  }
  /**
   * @description
   * Method called with the "submit" event is triggered on the form.
   * Triggers the `ngSubmit` emitter to emit the "submit" event as its payload.
   *
   * @param $event The "submit" event object
   */
  onSubmit($event) {
    this._submittedReactive.set(true);
    syncPendingControls(this.form, this.directives);
    this.ngSubmit.emit($event);
    this.form._events.next(new FormSubmittedEvent(this.control));
    return $event?.target?.method === "dialog";
  }
  /**
   * @description
   * Method called when the "reset" event is triggered on the form.
   */
  onReset() {
    this.resetForm();
  }
  /**
   * @description
   * Resets the form to an initial value and resets its submitted status.
   *
   * @param value The new value for the form, `undefined` by default
   */
  resetForm(value = void 0, options = {}) {
    this.form.reset(value, options);
    this._submittedReactive.set(false);
    if (options?.emitEvent !== false) {
      this.form._events.next(new FormResetEvent(this.form));
    }
  }
  /** @internal */
  _updateDomValue() {
    this.directives.forEach((dir) => {
      const oldCtrl = dir.control;
      const newCtrl = this.form.get(dir.path);
      if (oldCtrl !== newCtrl) {
        cleanUpControl(oldCtrl || null, dir);
        if (isFormControl(newCtrl)) {
          setUpControl(newCtrl, dir, this.callSetDisabledState);
          dir.control = newCtrl;
        }
      }
    });
    this.form._updateTreeValidity({
      emitEvent: false
    });
  }
  _setUpFormContainer(dir) {
    const ctrl = this.form.get(dir.path);
    setUpFormContainer(ctrl, dir);
    ctrl.updateValueAndValidity({
      emitEvent: false
    });
  }
  _cleanUpFormContainer(dir) {
    if (this.form) {
      const ctrl = this.form.get(dir.path);
      if (ctrl) {
        const isControlUpdated = cleanUpFormContainer(ctrl, dir);
        if (isControlUpdated) {
          ctrl.updateValueAndValidity({
            emitEvent: false
          });
        }
      }
    }
  }
  _updateRegistrations() {
    this.form._registerOnCollectionChange(this._onCollectionChange);
    if (this._oldForm) {
      this._oldForm._registerOnCollectionChange(() => {
      });
    }
  }
  _updateValidators() {
    setUpValidators(this.form, this);
    if (this._oldForm) {
      cleanUpValidators(this._oldForm, this);
    }
  }
  static \u0275fac = function FormGroupDirective_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _FormGroupDirective)(\u0275\u0275directiveInject(NG_VALIDATORS, 10), \u0275\u0275directiveInject(NG_ASYNC_VALIDATORS, 10), \u0275\u0275directiveInject(CALL_SET_DISABLED_STATE, 8));
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _FormGroupDirective,
    selectors: [["", "formGroup", ""]],
    hostBindings: function FormGroupDirective_HostBindings(rf, ctx) {
      if (rf & 1) {
        \u0275\u0275listener("submit", function FormGroupDirective_submit_HostBindingHandler($event) {
          return ctx.onSubmit($event);
        })("reset", function FormGroupDirective_reset_HostBindingHandler() {
          return ctx.onReset();
        });
      }
    },
    inputs: {
      form: [0, "formGroup", "form"]
    },
    outputs: {
      ngSubmit: "ngSubmit"
    },
    exportAs: ["ngForm"],
    standalone: false,
    features: [\u0275\u0275ProvidersFeature([formDirectiveProvider]), \u0275\u0275InheritDefinitionFeature, \u0275\u0275NgOnChangesFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(FormGroupDirective, [{
    type: Directive,
    args: [{
      selector: "[formGroup]",
      providers: [formDirectiveProvider],
      host: {
        "(submit)": "onSubmit($event)",
        "(reset)": "onReset()"
      },
      exportAs: "ngForm",
      standalone: false
    }]
  }], () => [{
    type: void 0,
    decorators: [{
      type: Optional
    }, {
      type: Self
    }, {
      type: Inject,
      args: [NG_VALIDATORS]
    }]
  }, {
    type: void 0,
    decorators: [{
      type: Optional
    }, {
      type: Self
    }, {
      type: Inject,
      args: [NG_ASYNC_VALIDATORS]
    }]
  }, {
    type: void 0,
    decorators: [{
      type: Optional
    }, {
      type: Inject,
      args: [CALL_SET_DISABLED_STATE]
    }]
  }], {
    form: [{
      type: Input,
      args: ["formGroup"]
    }],
    ngSubmit: [{
      type: Output
    }]
  });
})();
var formGroupNameProvider = {
  provide: ControlContainer,
  useExisting: forwardRef(() => FormGroupName)
};
var FormGroupName = class _FormGroupName extends AbstractFormGroupDirective {
  /**
   * @description
   * Tracks the name of the `FormGroup` bound to the directive. The name corresponds
   * to a key in the parent `FormGroup` or `FormArray`.
   * Accepts a name as a string or a number.
   * The name in the form of a string is useful for individual forms,
   * while the numerical form allows for form groups to be bound
   * to indices when iterating over groups in a `FormArray`.
   */
  name = null;
  constructor(parent, validators, asyncValidators) {
    super();
    this._parent = parent;
    this._setValidators(validators);
    this._setAsyncValidators(asyncValidators);
  }
  /** @internal */
  _checkParentType() {
    if (hasInvalidParent(this._parent) && (typeof ngDevMode === "undefined" || ngDevMode)) {
      throw groupParentException();
    }
  }
  static \u0275fac = function FormGroupName_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _FormGroupName)(\u0275\u0275directiveInject(ControlContainer, 13), \u0275\u0275directiveInject(NG_VALIDATORS, 10), \u0275\u0275directiveInject(NG_ASYNC_VALIDATORS, 10));
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _FormGroupName,
    selectors: [["", "formGroupName", ""]],
    inputs: {
      name: [0, "formGroupName", "name"]
    },
    standalone: false,
    features: [\u0275\u0275ProvidersFeature([formGroupNameProvider]), \u0275\u0275InheritDefinitionFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(FormGroupName, [{
    type: Directive,
    args: [{
      selector: "[formGroupName]",
      providers: [formGroupNameProvider],
      standalone: false
    }]
  }], () => [{
    type: ControlContainer,
    decorators: [{
      type: Optional
    }, {
      type: Host
    }, {
      type: SkipSelf
    }]
  }, {
    type: void 0,
    decorators: [{
      type: Optional
    }, {
      type: Self
    }, {
      type: Inject,
      args: [NG_VALIDATORS]
    }]
  }, {
    type: void 0,
    decorators: [{
      type: Optional
    }, {
      type: Self
    }, {
      type: Inject,
      args: [NG_ASYNC_VALIDATORS]
    }]
  }], {
    name: [{
      type: Input,
      args: ["formGroupName"]
    }]
  });
})();
var formArrayNameProvider = {
  provide: ControlContainer,
  useExisting: forwardRef(() => FormArrayName)
};
var FormArrayName = class _FormArrayName extends ControlContainer {
  /** @internal */
  _parent;
  /**
   * @description
   * Tracks the name of the `FormArray` bound to the directive. The name corresponds
   * to a key in the parent `FormGroup` or `FormArray`.
   * Accepts a name as a string or a number.
   * The name in the form of a string is useful for individual forms,
   * while the numerical form allows for form arrays to be bound
   * to indices when iterating over arrays in a `FormArray`.
   */
  name = null;
  constructor(parent, validators, asyncValidators) {
    super();
    this._parent = parent;
    this._setValidators(validators);
    this._setAsyncValidators(asyncValidators);
  }
  /**
   * A lifecycle method called when the directive's inputs are initialized. For internal use only.
   * @throws If the directive does not have a valid parent.
   * @docs-private
   */
  ngOnInit() {
    if (hasInvalidParent(this._parent) && (typeof ngDevMode === "undefined" || ngDevMode)) {
      throw arrayParentException();
    }
    this.formDirective.addFormArray(this);
  }
  /**
   * A lifecycle method called before the directive's instance is destroyed. For internal use only.
   * @docs-private
   */
  ngOnDestroy() {
    this.formDirective?.removeFormArray(this);
  }
  /**
   * @description
   * The `FormArray` bound to this directive.
   */
  get control() {
    return this.formDirective.getFormArray(this);
  }
  /**
   * @description
   * The top-level directive for this group if present, otherwise null.
   */
  get formDirective() {
    return this._parent ? this._parent.formDirective : null;
  }
  /**
   * @description
   * Returns an array that represents the path from the top-level form to this control.
   * Each index is the string name of the control on that level.
   */
  get path() {
    return controlPath(this.name == null ? this.name : this.name.toString(), this._parent);
  }
  static \u0275fac = function FormArrayName_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _FormArrayName)(\u0275\u0275directiveInject(ControlContainer, 13), \u0275\u0275directiveInject(NG_VALIDATORS, 10), \u0275\u0275directiveInject(NG_ASYNC_VALIDATORS, 10));
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _FormArrayName,
    selectors: [["", "formArrayName", ""]],
    inputs: {
      name: [0, "formArrayName", "name"]
    },
    standalone: false,
    features: [\u0275\u0275ProvidersFeature([formArrayNameProvider]), \u0275\u0275InheritDefinitionFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(FormArrayName, [{
    type: Directive,
    args: [{
      selector: "[formArrayName]",
      providers: [formArrayNameProvider],
      standalone: false
    }]
  }], () => [{
    type: ControlContainer,
    decorators: [{
      type: Optional
    }, {
      type: Host
    }, {
      type: SkipSelf
    }]
  }, {
    type: void 0,
    decorators: [{
      type: Optional
    }, {
      type: Self
    }, {
      type: Inject,
      args: [NG_VALIDATORS]
    }]
  }, {
    type: void 0,
    decorators: [{
      type: Optional
    }, {
      type: Self
    }, {
      type: Inject,
      args: [NG_ASYNC_VALIDATORS]
    }]
  }], {
    name: [{
      type: Input,
      args: ["formArrayName"]
    }]
  });
})();
function hasInvalidParent(parent) {
  return !(parent instanceof FormGroupName) && !(parent instanceof FormGroupDirective) && !(parent instanceof FormArrayName);
}
var controlNameBinding = {
  provide: NgControl,
  useExisting: forwardRef(() => FormControlName)
};
var FormControlName = class _FormControlName extends NgControl {
  _ngModelWarningConfig;
  _added = false;
  /**
   * Internal reference to the view model value.
   * @internal
   */
  viewModel;
  /**
   * @description
   * Tracks the `FormControl` instance bound to the directive.
   */
  control;
  /**
   * @description
   * Tracks the name of the `FormControl` bound to the directive. The name corresponds
   * to a key in the parent `FormGroup` or `FormArray`.
   * Accepts a name as a string or a number.
   * The name in the form of a string is useful for individual forms,
   * while the numerical form allows for form controls to be bound
   * to indices when iterating over controls in a `FormArray`.
   */
  name = null;
  /**
   * @description
   * Triggers a warning in dev mode that this input should not be used with reactive forms.
   */
  set isDisabled(isDisabled) {
    if (typeof ngDevMode === "undefined" || ngDevMode) {
      console.warn(disabledAttrWarning);
    }
  }
  // TODO(kara): remove next 4 properties once deprecation period is over
  /** @deprecated as of v6 */
  model;
  /** @deprecated as of v6 */
  update = new EventEmitter();
  /**
   * @description
   * Static property used to track whether any ngModel warnings have been sent across
   * all instances of FormControlName. Used to support warning config of "once".
   *
   * @internal
   */
  static _ngModelWarningSentOnce = false;
  /**
   * @description
   * Instance property used to track whether an ngModel warning has been sent out for this
   * particular FormControlName instance. Used to support warning config of "always".
   *
   * @internal
   */
  _ngModelWarningSent = false;
  constructor(parent, validators, asyncValidators, valueAccessors, _ngModelWarningConfig) {
    super();
    this._ngModelWarningConfig = _ngModelWarningConfig;
    this._parent = parent;
    this._setValidators(validators);
    this._setAsyncValidators(asyncValidators);
    this.valueAccessor = selectValueAccessor(this, valueAccessors);
  }
  /** @docs-private */
  ngOnChanges(changes) {
    if (!this._added) this._setUpControl();
    if (isPropertyUpdated(changes, this.viewModel)) {
      if (typeof ngDevMode === "undefined" || ngDevMode) {
        _ngModelWarning("formControlName", _FormControlName, this, this._ngModelWarningConfig);
      }
      this.viewModel = this.model;
      this.formDirective.updateModel(this, this.model);
    }
  }
  /** @docs-private */
  ngOnDestroy() {
    if (this.formDirective) {
      this.formDirective.removeControl(this);
    }
  }
  /**
   * @description
   * Sets the new value for the view model and emits an `ngModelChange` event.
   *
   * @param newValue The new value for the view model.
   */
  viewToModelUpdate(newValue) {
    this.viewModel = newValue;
    this.update.emit(newValue);
  }
  /**
   * @description
   * Returns an array that represents the path from the top-level form to this control.
   * Each index is the string name of the control on that level.
   */
  get path() {
    return controlPath(this.name == null ? this.name : this.name.toString(), this._parent);
  }
  /**
   * @description
   * The top-level directive for this group if present, otherwise null.
   */
  get formDirective() {
    return this._parent ? this._parent.formDirective : null;
  }
  _setUpControl() {
    if (typeof ngDevMode === "undefined" || ngDevMode) {
      checkParentType(this._parent, this.name);
    }
    this.control = this.formDirective.addControl(this);
    this._added = true;
  }
  static \u0275fac = function FormControlName_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _FormControlName)(\u0275\u0275directiveInject(ControlContainer, 13), \u0275\u0275directiveInject(NG_VALIDATORS, 10), \u0275\u0275directiveInject(NG_ASYNC_VALIDATORS, 10), \u0275\u0275directiveInject(NG_VALUE_ACCESSOR, 10), \u0275\u0275directiveInject(NG_MODEL_WITH_FORM_CONTROL_WARNING, 8));
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _FormControlName,
    selectors: [["", "formControlName", ""]],
    inputs: {
      name: [0, "formControlName", "name"],
      isDisabled: [0, "disabled", "isDisabled"],
      model: [0, "ngModel", "model"]
    },
    outputs: {
      update: "ngModelChange"
    },
    standalone: false,
    features: [\u0275\u0275ProvidersFeature([controlNameBinding]), \u0275\u0275InheritDefinitionFeature, \u0275\u0275NgOnChangesFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(FormControlName, [{
    type: Directive,
    args: [{
      selector: "[formControlName]",
      providers: [controlNameBinding],
      standalone: false
    }]
  }], () => [{
    type: ControlContainer,
    decorators: [{
      type: Optional
    }, {
      type: Host
    }, {
      type: SkipSelf
    }]
  }, {
    type: void 0,
    decorators: [{
      type: Optional
    }, {
      type: Self
    }, {
      type: Inject,
      args: [NG_VALIDATORS]
    }]
  }, {
    type: void 0,
    decorators: [{
      type: Optional
    }, {
      type: Self
    }, {
      type: Inject,
      args: [NG_ASYNC_VALIDATORS]
    }]
  }, {
    type: void 0,
    decorators: [{
      type: Optional
    }, {
      type: Self
    }, {
      type: Inject,
      args: [NG_VALUE_ACCESSOR]
    }]
  }, {
    type: void 0,
    decorators: [{
      type: Optional
    }, {
      type: Inject,
      args: [NG_MODEL_WITH_FORM_CONTROL_WARNING]
    }]
  }], {
    name: [{
      type: Input,
      args: ["formControlName"]
    }],
    isDisabled: [{
      type: Input,
      args: ["disabled"]
    }],
    model: [{
      type: Input,
      args: ["ngModel"]
    }],
    update: [{
      type: Output,
      args: ["ngModelChange"]
    }]
  });
})();
function checkParentType(parent, name2) {
  if (!(parent instanceof FormGroupName) && parent instanceof AbstractFormGroupDirective) {
    throw ngModelGroupException();
  } else if (!(parent instanceof FormGroupName) && !(parent instanceof FormGroupDirective) && !(parent instanceof FormArrayName)) {
    throw controlParentException(name2);
  }
}
var SELECT_VALUE_ACCESSOR = {
  provide: NG_VALUE_ACCESSOR,
  useExisting: forwardRef(() => SelectControlValueAccessor),
  multi: true
};
function _buildValueString$1(id, value) {
  if (id == null) return `${value}`;
  if (value && typeof value === "object") value = "Object";
  return `${id}: ${value}`.slice(0, 50);
}
function _extractId$1(valueString) {
  return valueString.split(":")[0];
}
var SelectControlValueAccessor = class _SelectControlValueAccessor extends BuiltInControlValueAccessor {
  /** @docs-private */
  value;
  /** @internal */
  _optionMap = /* @__PURE__ */ new Map();
  /** @internal */
  _idCounter = 0;
  /**
   * @description
   * Tracks the option comparison algorithm for tracking identities when
   * checking for changes.
   */
  set compareWith(fn) {
    if (typeof fn !== "function" && (typeof ngDevMode === "undefined" || ngDevMode)) {
      throw new RuntimeError(1201, `compareWith must be a function, but received ${JSON.stringify(fn)}`);
    }
    this._compareWith = fn;
  }
  _compareWith = Object.is;
  // We need this because we might be in the process of destroying the root
  // injector, which is marked as destroyed before running destroy hooks.
  // Attempting to use afterNextRender with the node injector would evntually
  // run into that already destroyed injector.
  appRefInjector = inject2(ApplicationRef).injector;
  // TODO(atscott): Remove once destroyed is exposed on EnvironmentInjector
  appRefDestroyRef = this.appRefInjector.get(DestroyRef);
  destroyRef = inject2(DestroyRef);
  cdr = inject2(ChangeDetectorRef);
  _queuedWrite = false;
  /**
   * This is needed to efficiently set the select value when adding/removing options. If
   * writeValue is instead called for every added/removed option, this results in exponentially
   * more _compareValue calls than the number of option elements (issue #41330).
   *
   * Secondly, calling writeValue when rendering individual option elements instead of after they
   * are all rendered caused an issue in Safari and IE 11 where the first option element failed
   * to be deselected when no option matched the select ngModel. This was because Angular would
   * set the select element's value property before appending the option's child text node to the
   * DOM (issue #14505).
   *
   * Finally, this approach is necessary to avoid an issue with delayed element removal when
   * using the animations module (in all browsers). Otherwise when a selected option is removed
   * (so no option matches the ngModel anymore), Angular would change the select element value
   * before actually removing the option from the DOM. Then when the option is finally removed
   * from the DOM, the browser would change the select value to that of the first option, even
   * though it doesn't match the ngModel (issue #18430).
   *
   * @internal
   */
  _writeValueAfterRender() {
    if (this._queuedWrite || this.appRefDestroyRef.destroyed) {
      return;
    }
    this._queuedWrite = true;
    afterNextRender({
      write: () => {
        if (this.destroyRef.destroyed) {
          return;
        }
        this._queuedWrite = false;
        this.writeValue(this.value);
      }
    }, {
      injector: this.appRefInjector
    });
  }
  /**
   * Sets the "value" property on the select element.
   * @docs-private
   */
  writeValue(value) {
    this.cdr.markForCheck();
    this.value = value;
    const id = this._getOptionId(value);
    const valueString = _buildValueString$1(id, value);
    this.setProperty("value", valueString);
  }
  /**
   * Registers a function called when the control value changes.
   * @docs-private
   */
  registerOnChange(fn) {
    this.onChange = (valueString) => {
      this.value = this._getOptionValue(valueString);
      fn(this.value);
    };
  }
  /** @internal */
  _registerOption() {
    return (this._idCounter++).toString();
  }
  /** @internal */
  _getOptionId(value) {
    for (const id of this._optionMap.keys()) {
      if (this._compareWith(this._optionMap.get(id), value)) return id;
    }
    return null;
  }
  /** @internal */
  _getOptionValue(valueString) {
    const id = _extractId$1(valueString);
    return this._optionMap.has(id) ? this._optionMap.get(id) : valueString;
  }
  static \u0275fac = /* @__PURE__ */ (() => {
    let \u0275SelectControlValueAccessor_BaseFactory;
    return function SelectControlValueAccessor_Factory(__ngFactoryType__) {
      return (\u0275SelectControlValueAccessor_BaseFactory || (\u0275SelectControlValueAccessor_BaseFactory = \u0275\u0275getInheritedFactory(_SelectControlValueAccessor)))(__ngFactoryType__ || _SelectControlValueAccessor);
    };
  })();
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _SelectControlValueAccessor,
    selectors: [["select", "formControlName", "", 3, "multiple", ""], ["select", "formControl", "", 3, "multiple", ""], ["select", "ngModel", "", 3, "multiple", ""]],
    hostBindings: function SelectControlValueAccessor_HostBindings(rf, ctx) {
      if (rf & 1) {
        \u0275\u0275listener("change", function SelectControlValueAccessor_change_HostBindingHandler($event) {
          return ctx.onChange($event.target.value);
        })("blur", function SelectControlValueAccessor_blur_HostBindingHandler() {
          return ctx.onTouched();
        });
      }
    },
    inputs: {
      compareWith: "compareWith"
    },
    standalone: false,
    features: [\u0275\u0275ProvidersFeature([SELECT_VALUE_ACCESSOR]), \u0275\u0275InheritDefinitionFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(SelectControlValueAccessor, [{
    type: Directive,
    args: [{
      selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]",
      host: {
        "(change)": "onChange($any($event.target).value)",
        "(blur)": "onTouched()"
      },
      providers: [SELECT_VALUE_ACCESSOR],
      standalone: false
    }]
  }], null, {
    compareWith: [{
      type: Input
    }]
  });
})();
var NgSelectOption = class _NgSelectOption {
  _element;
  _renderer;
  _select;
  /**
   * @description
   * ID of the option element
   */
  id;
  constructor(_element, _renderer, _select) {
    this._element = _element;
    this._renderer = _renderer;
    this._select = _select;
    if (this._select) this.id = this._select._registerOption();
  }
  /**
   * @description
   * Tracks the value bound to the option element. Unlike the value binding,
   * ngValue supports binding to objects.
   */
  set ngValue(value) {
    if (this._select == null) return;
    this._select._optionMap.set(this.id, value);
    this._setElementValue(_buildValueString$1(this.id, value));
    this._select._writeValueAfterRender();
  }
  /**
   * @description
   * Tracks simple string values bound to the option element.
   * For objects, use the `ngValue` input binding.
   */
  set value(value) {
    this._setElementValue(value);
    if (this._select) this._select._writeValueAfterRender();
  }
  /** @internal */
  _setElementValue(value) {
    this._renderer.setProperty(this._element.nativeElement, "value", value);
  }
  /** @docs-private */
  ngOnDestroy() {
    if (this._select) {
      this._select._optionMap.delete(this.id);
      this._select._writeValueAfterRender();
    }
  }
  static \u0275fac = function NgSelectOption_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _NgSelectOption)(\u0275\u0275directiveInject(ElementRef), \u0275\u0275directiveInject(Renderer2), \u0275\u0275directiveInject(SelectControlValueAccessor, 9));
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _NgSelectOption,
    selectors: [["option"]],
    inputs: {
      ngValue: "ngValue",
      value: "value"
    },
    standalone: false
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgSelectOption, [{
    type: Directive,
    args: [{
      selector: "option",
      standalone: false
    }]
  }], () => [{
    type: ElementRef
  }, {
    type: Renderer2
  }, {
    type: SelectControlValueAccessor,
    decorators: [{
      type: Optional
    }, {
      type: Host
    }]
  }], {
    ngValue: [{
      type: Input,
      args: ["ngValue"]
    }],
    value: [{
      type: Input,
      args: ["value"]
    }]
  });
})();
var SELECT_MULTIPLE_VALUE_ACCESSOR = {
  provide: NG_VALUE_ACCESSOR,
  useExisting: forwardRef(() => SelectMultipleControlValueAccessor),
  multi: true
};
function _buildValueString(id, value) {
  if (id == null) return `${value}`;
  if (typeof value === "string") value = `'${value}'`;
  if (value && typeof value === "object") value = "Object";
  return `${id}: ${value}`.slice(0, 50);
}
function _extractId(valueString) {
  return valueString.split(":")[0];
}
var SelectMultipleControlValueAccessor = class _SelectMultipleControlValueAccessor extends BuiltInControlValueAccessor {
  /**
   * The current value.
   * @docs-private
   */
  value;
  /** @internal */
  _optionMap = /* @__PURE__ */ new Map();
  /** @internal */
  _idCounter = 0;
  /**
   * @description
   * Tracks the option comparison algorithm for tracking identities when
   * checking for changes.
   */
  set compareWith(fn) {
    if (typeof fn !== "function" && (typeof ngDevMode === "undefined" || ngDevMode)) {
      throw new RuntimeError(1201, `compareWith must be a function, but received ${JSON.stringify(fn)}`);
    }
    this._compareWith = fn;
  }
  _compareWith = Object.is;
  /**
   * Sets the "value" property on one or of more of the select's options.
   * @docs-private
   */
  writeValue(value) {
    this.value = value;
    let optionSelectedStateSetter;
    if (Array.isArray(value)) {
      const ids = value.map((v) => this._getOptionId(v));
      optionSelectedStateSetter = (opt2, o) => {
        opt2._setSelected(ids.indexOf(o.toString()) > -1);
      };
    } else {
      optionSelectedStateSetter = (opt2, o) => {
        opt2._setSelected(false);
      };
    }
    this._optionMap.forEach(optionSelectedStateSetter);
  }
  /**
   * Registers a function called when the control value changes
   * and writes an array of the selected options.
   * @docs-private
   */
  registerOnChange(fn) {
    this.onChange = (element) => {
      const selected = [];
      const selectedOptions = element.selectedOptions;
      if (selectedOptions !== void 0) {
        const options = selectedOptions;
        for (let i = 0; i < options.length; i++) {
          const opt2 = options[i];
          const val = this._getOptionValue(opt2.value);
          selected.push(val);
        }
      } else {
        const options = element.options;
        for (let i = 0; i < options.length; i++) {
          const opt2 = options[i];
          if (opt2.selected) {
            const val = this._getOptionValue(opt2.value);
            selected.push(val);
          }
        }
      }
      this.value = selected;
      fn(selected);
    };
  }
  /** @internal */
  _registerOption(value) {
    const id = (this._idCounter++).toString();
    this._optionMap.set(id, value);
    return id;
  }
  /** @internal */
  _getOptionId(value) {
    for (const id of this._optionMap.keys()) {
      if (this._compareWith(this._optionMap.get(id)._value, value)) return id;
    }
    return null;
  }
  /** @internal */
  _getOptionValue(valueString) {
    const id = _extractId(valueString);
    return this._optionMap.has(id) ? this._optionMap.get(id)._value : valueString;
  }
  static \u0275fac = /* @__PURE__ */ (() => {
    let \u0275SelectMultipleControlValueAccessor_BaseFactory;
    return function SelectMultipleControlValueAccessor_Factory(__ngFactoryType__) {
      return (\u0275SelectMultipleControlValueAccessor_BaseFactory || (\u0275SelectMultipleControlValueAccessor_BaseFactory = \u0275\u0275getInheritedFactory(_SelectMultipleControlValueAccessor)))(__ngFactoryType__ || _SelectMultipleControlValueAccessor);
    };
  })();
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _SelectMultipleControlValueAccessor,
    selectors: [["select", "multiple", "", "formControlName", ""], ["select", "multiple", "", "formControl", ""], ["select", "multiple", "", "ngModel", ""]],
    hostBindings: function SelectMultipleControlValueAccessor_HostBindings(rf, ctx) {
      if (rf & 1) {
        \u0275\u0275listener("change", function SelectMultipleControlValueAccessor_change_HostBindingHandler($event) {
          return ctx.onChange($event.target);
        })("blur", function SelectMultipleControlValueAccessor_blur_HostBindingHandler() {
          return ctx.onTouched();
        });
      }
    },
    inputs: {
      compareWith: "compareWith"
    },
    standalone: false,
    features: [\u0275\u0275ProvidersFeature([SELECT_MULTIPLE_VALUE_ACCESSOR]), \u0275\u0275InheritDefinitionFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(SelectMultipleControlValueAccessor, [{
    type: Directive,
    args: [{
      selector: "select[multiple][formControlName],select[multiple][formControl],select[multiple][ngModel]",
      host: {
        "(change)": "onChange($event.target)",
        "(blur)": "onTouched()"
      },
      providers: [SELECT_MULTIPLE_VALUE_ACCESSOR],
      standalone: false
    }]
  }], null, {
    compareWith: [{
      type: Input
    }]
  });
})();
var \u0275NgSelectMultipleOption = class _\u0275NgSelectMultipleOption {
  _element;
  _renderer;
  _select;
  id;
  /** @internal */
  _value;
  constructor(_element, _renderer, _select) {
    this._element = _element;
    this._renderer = _renderer;
    this._select = _select;
    if (this._select) {
      this.id = this._select._registerOption(this);
    }
  }
  /**
   * @description
   * Tracks the value bound to the option element. Unlike the value binding,
   * ngValue supports binding to objects.
   */
  set ngValue(value) {
    if (this._select == null) return;
    this._value = value;
    this._setElementValue(_buildValueString(this.id, value));
    this._select.writeValue(this._select.value);
  }
  /**
   * @description
   * Tracks simple string values bound to the option element.
   * For objects, use the `ngValue` input binding.
   */
  set value(value) {
    if (this._select) {
      this._value = value;
      this._setElementValue(_buildValueString(this.id, value));
      this._select.writeValue(this._select.value);
    } else {
      this._setElementValue(value);
    }
  }
  /** @internal */
  _setElementValue(value) {
    this._renderer.setProperty(this._element.nativeElement, "value", value);
  }
  /** @internal */
  _setSelected(selected) {
    this._renderer.setProperty(this._element.nativeElement, "selected", selected);
  }
  /** @docs-private */
  ngOnDestroy() {
    if (this._select) {
      this._select._optionMap.delete(this.id);
      this._select.writeValue(this._select.value);
    }
  }
  static \u0275fac = function \u0275NgSelectMultipleOption_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _\u0275NgSelectMultipleOption)(\u0275\u0275directiveInject(ElementRef), \u0275\u0275directiveInject(Renderer2), \u0275\u0275directiveInject(SelectMultipleControlValueAccessor, 9));
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _\u0275NgSelectMultipleOption,
    selectors: [["option"]],
    inputs: {
      ngValue: "ngValue",
      value: "value"
    },
    standalone: false
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(\u0275NgSelectMultipleOption, [{
    type: Directive,
    args: [{
      selector: "option",
      standalone: false
    }]
  }], () => [{
    type: ElementRef
  }, {
    type: Renderer2
  }, {
    type: SelectMultipleControlValueAccessor,
    decorators: [{
      type: Optional
    }, {
      type: Host
    }]
  }], {
    ngValue: [{
      type: Input,
      args: ["ngValue"]
    }],
    value: [{
      type: Input,
      args: ["value"]
    }]
  });
})();
function toInteger(value) {
  return typeof value === "number" ? value : parseInt(value, 10);
}
function toFloat(value) {
  return typeof value === "number" ? value : parseFloat(value);
}
var AbstractValidatorDirective = class _AbstractValidatorDirective {
  _validator = nullValidator;
  _onChange;
  /**
   * A flag that tracks whether this validator is enabled.
   *
   * Marking it `internal` (vs `protected`), so that this flag can be used in host bindings of
   * directive classes that extend this base class.
   * @internal
   */
  _enabled;
  /** @docs-private */
  ngOnChanges(changes) {
    if (this.inputName in changes) {
      const input2 = this.normalizeInput(changes[this.inputName].currentValue);
      this._enabled = this.enabled(input2);
      this._validator = this._enabled ? this.createValidator(input2) : nullValidator;
      if (this._onChange) {
        this._onChange();
      }
    }
  }
  /** @docs-private */
  validate(control) {
    return this._validator(control);
  }
  /** @docs-private */
  registerOnValidatorChange(fn) {
    this._onChange = fn;
  }
  /**
   * @description
   * Determines whether this validator should be active or not based on an input.
   * Base class implementation checks whether an input is defined (if the value is different from
   * `null` and `undefined`). Validator classes that extend this base class can override this
   * function with the logic specific to a particular validator directive.
   */
  enabled(input2) {
    return input2 != null;
  }
  static \u0275fac = function AbstractValidatorDirective_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _AbstractValidatorDirective)();
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _AbstractValidatorDirective,
    features: [\u0275\u0275NgOnChangesFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(AbstractValidatorDirective, [{
    type: Directive
  }], null, null);
})();
var MAX_VALIDATOR = {
  provide: NG_VALIDATORS,
  useExisting: forwardRef(() => MaxValidator),
  multi: true
};
var MaxValidator = class _MaxValidator extends AbstractValidatorDirective {
  /**
   * @description
   * Tracks changes to the max bound to this directive.
   */
  max;
  /** @internal */
  inputName = "max";
  /** @internal */
  normalizeInput = (input2) => toFloat(input2);
  /** @internal */
  createValidator = (max) => maxValidator(max);
  static \u0275fac = /* @__PURE__ */ (() => {
    let \u0275MaxValidator_BaseFactory;
    return function MaxValidator_Factory(__ngFactoryType__) {
      return (\u0275MaxValidator_BaseFactory || (\u0275MaxValidator_BaseFactory = \u0275\u0275getInheritedFactory(_MaxValidator)))(__ngFactoryType__ || _MaxValidator);
    };
  })();
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _MaxValidator,
    selectors: [["input", "type", "number", "max", "", "formControlName", ""], ["input", "type", "number", "max", "", "formControl", ""], ["input", "type", "number", "max", "", "ngModel", ""]],
    hostVars: 1,
    hostBindings: function MaxValidator_HostBindings(rf, ctx) {
      if (rf & 2) {
        \u0275\u0275attribute("max", ctx._enabled ? ctx.max : null);
      }
    },
    inputs: {
      max: "max"
    },
    standalone: false,
    features: [\u0275\u0275ProvidersFeature([MAX_VALIDATOR]), \u0275\u0275InheritDefinitionFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MaxValidator, [{
    type: Directive,
    args: [{
      selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]",
      providers: [MAX_VALIDATOR],
      host: {
        "[attr.max]": "_enabled ? max : null"
      },
      standalone: false
    }]
  }], null, {
    max: [{
      type: Input
    }]
  });
})();
var MIN_VALIDATOR = {
  provide: NG_VALIDATORS,
  useExisting: forwardRef(() => MinValidator),
  multi: true
};
var MinValidator = class _MinValidator extends AbstractValidatorDirective {
  /**
   * @description
   * Tracks changes to the min bound to this directive.
   */
  min;
  /** @internal */
  inputName = "min";
  /** @internal */
  normalizeInput = (input2) => toFloat(input2);
  /** @internal */
  createValidator = (min) => minValidator(min);
  static \u0275fac = /* @__PURE__ */ (() => {
    let \u0275MinValidator_BaseFactory;
    return function MinValidator_Factory(__ngFactoryType__) {
      return (\u0275MinValidator_BaseFactory || (\u0275MinValidator_BaseFactory = \u0275\u0275getInheritedFactory(_MinValidator)))(__ngFactoryType__ || _MinValidator);
    };
  })();
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _MinValidator,
    selectors: [["input", "type", "number", "min", "", "formControlName", ""], ["input", "type", "number", "min", "", "formControl", ""], ["input", "type", "number", "min", "", "ngModel", ""]],
    hostVars: 1,
    hostBindings: function MinValidator_HostBindings(rf, ctx) {
      if (rf & 2) {
        \u0275\u0275attribute("min", ctx._enabled ? ctx.min : null);
      }
    },
    inputs: {
      min: "min"
    },
    standalone: false,
    features: [\u0275\u0275ProvidersFeature([MIN_VALIDATOR]), \u0275\u0275InheritDefinitionFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MinValidator, [{
    type: Directive,
    args: [{
      selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]",
      providers: [MIN_VALIDATOR],
      host: {
        "[attr.min]": "_enabled ? min : null"
      },
      standalone: false
    }]
  }], null, {
    min: [{
      type: Input
    }]
  });
})();
var REQUIRED_VALIDATOR = {
  provide: NG_VALIDATORS,
  useExisting: forwardRef(() => RequiredValidator),
  multi: true
};
var CHECKBOX_REQUIRED_VALIDATOR = {
  provide: NG_VALIDATORS,
  useExisting: forwardRef(() => CheckboxRequiredValidator),
  multi: true
};
var RequiredValidator = class _RequiredValidator extends AbstractValidatorDirective {
  /**
   * @description
   * Tracks changes to the required attribute bound to this directive.
   */
  required;
  /** @internal */
  inputName = "required";
  /** @internal */
  normalizeInput = booleanAttribute;
  /** @internal */
  createValidator = (input2) => requiredValidator;
  /** @docs-private */
  enabled(input2) {
    return input2;
  }
  static \u0275fac = /* @__PURE__ */ (() => {
    let \u0275RequiredValidator_BaseFactory;
    return function RequiredValidator_Factory(__ngFactoryType__) {
      return (\u0275RequiredValidator_BaseFactory || (\u0275RequiredValidator_BaseFactory = \u0275\u0275getInheritedFactory(_RequiredValidator)))(__ngFactoryType__ || _RequiredValidator);
    };
  })();
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _RequiredValidator,
    selectors: [["", "required", "", "formControlName", "", 3, "type", "checkbox"], ["", "required", "", "formControl", "", 3, "type", "checkbox"], ["", "required", "", "ngModel", "", 3, "type", "checkbox"]],
    hostVars: 1,
    hostBindings: function RequiredValidator_HostBindings(rf, ctx) {
      if (rf & 2) {
        \u0275\u0275attribute("required", ctx._enabled ? "" : null);
      }
    },
    inputs: {
      required: "required"
    },
    standalone: false,
    features: [\u0275\u0275ProvidersFeature([REQUIRED_VALIDATOR]), \u0275\u0275InheritDefinitionFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(RequiredValidator, [{
    type: Directive,
    args: [{
      selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]",
      providers: [REQUIRED_VALIDATOR],
      host: {
        "[attr.required]": '_enabled ? "" : null'
      },
      standalone: false
    }]
  }], null, {
    required: [{
      type: Input
    }]
  });
})();
var CheckboxRequiredValidator = class _CheckboxRequiredValidator extends RequiredValidator {
  /** @internal */
  createValidator = (input2) => requiredTrueValidator;
  static \u0275fac = /* @__PURE__ */ (() => {
    let \u0275CheckboxRequiredValidator_BaseFactory;
    return function CheckboxRequiredValidator_Factory(__ngFactoryType__) {
      return (\u0275CheckboxRequiredValidator_BaseFactory || (\u0275CheckboxRequiredValidator_BaseFactory = \u0275\u0275getInheritedFactory(_CheckboxRequiredValidator)))(__ngFactoryType__ || _CheckboxRequiredValidator);
    };
  })();
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _CheckboxRequiredValidator,
    selectors: [["input", "type", "checkbox", "required", "", "formControlName", ""], ["input", "type", "checkbox", "required", "", "formControl", ""], ["input", "type", "checkbox", "required", "", "ngModel", ""]],
    hostVars: 1,
    hostBindings: function CheckboxRequiredValidator_HostBindings(rf, ctx) {
      if (rf & 2) {
        \u0275\u0275attribute("required", ctx._enabled ? "" : null);
      }
    },
    standalone: false,
    features: [\u0275\u0275ProvidersFeature([CHECKBOX_REQUIRED_VALIDATOR]), \u0275\u0275InheritDefinitionFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CheckboxRequiredValidator, [{
    type: Directive,
    args: [{
      selector: "input[type=checkbox][required][formControlName],input[type=checkbox][required][formControl],input[type=checkbox][required][ngModel]",
      providers: [CHECKBOX_REQUIRED_VALIDATOR],
      host: {
        "[attr.required]": '_enabled ? "" : null'
      },
      standalone: false
    }]
  }], null, null);
})();
var EMAIL_VALIDATOR = {
  provide: NG_VALIDATORS,
  useExisting: forwardRef(() => EmailValidator),
  multi: true
};
var EmailValidator = class _EmailValidator extends AbstractValidatorDirective {
  /**
   * @description
   * Tracks changes to the email attribute bound to this directive.
   */
  email;
  /** @internal */
  inputName = "email";
  /** @internal */
  normalizeInput = booleanAttribute;
  /** @internal */
  createValidator = (input2) => emailValidator;
  /** @docs-private */
  enabled(input2) {
    return input2;
  }
  static \u0275fac = /* @__PURE__ */ (() => {
    let \u0275EmailValidator_BaseFactory;
    return function EmailValidator_Factory(__ngFactoryType__) {
      return (\u0275EmailValidator_BaseFactory || (\u0275EmailValidator_BaseFactory = \u0275\u0275getInheritedFactory(_EmailValidator)))(__ngFactoryType__ || _EmailValidator);
    };
  })();
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _EmailValidator,
    selectors: [["", "email", "", "formControlName", ""], ["", "email", "", "formControl", ""], ["", "email", "", "ngModel", ""]],
    inputs: {
      email: "email"
    },
    standalone: false,
    features: [\u0275\u0275ProvidersFeature([EMAIL_VALIDATOR]), \u0275\u0275InheritDefinitionFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(EmailValidator, [{
    type: Directive,
    args: [{
      selector: "[email][formControlName],[email][formControl],[email][ngModel]",
      providers: [EMAIL_VALIDATOR],
      standalone: false
    }]
  }], null, {
    email: [{
      type: Input
    }]
  });
})();
var MIN_LENGTH_VALIDATOR = {
  provide: NG_VALIDATORS,
  useExisting: forwardRef(() => MinLengthValidator),
  multi: true
};
var MinLengthValidator = class _MinLengthValidator extends AbstractValidatorDirective {
  /**
   * @description
   * Tracks changes to the minimum length bound to this directive.
   */
  minlength;
  /** @internal */
  inputName = "minlength";
  /** @internal */
  normalizeInput = (input2) => toInteger(input2);
  /** @internal */
  createValidator = (minlength) => minLengthValidator(minlength);
  static \u0275fac = /* @__PURE__ */ (() => {
    let \u0275MinLengthValidator_BaseFactory;
    return function MinLengthValidator_Factory(__ngFactoryType__) {
      return (\u0275MinLengthValidator_BaseFactory || (\u0275MinLengthValidator_BaseFactory = \u0275\u0275getInheritedFactory(_MinLengthValidator)))(__ngFactoryType__ || _MinLengthValidator);
    };
  })();
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _MinLengthValidator,
    selectors: [["", "minlength", "", "formControlName", ""], ["", "minlength", "", "formControl", ""], ["", "minlength", "", "ngModel", ""]],
    hostVars: 1,
    hostBindings: function MinLengthValidator_HostBindings(rf, ctx) {
      if (rf & 2) {
        \u0275\u0275attribute("minlength", ctx._enabled ? ctx.minlength : null);
      }
    },
    inputs: {
      minlength: "minlength"
    },
    standalone: false,
    features: [\u0275\u0275ProvidersFeature([MIN_LENGTH_VALIDATOR]), \u0275\u0275InheritDefinitionFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MinLengthValidator, [{
    type: Directive,
    args: [{
      selector: "[minlength][formControlName],[minlength][formControl],[minlength][ngModel]",
      providers: [MIN_LENGTH_VALIDATOR],
      host: {
        "[attr.minlength]": "_enabled ? minlength : null"
      },
      standalone: false
    }]
  }], null, {
    minlength: [{
      type: Input
    }]
  });
})();
var MAX_LENGTH_VALIDATOR = {
  provide: NG_VALIDATORS,
  useExisting: forwardRef(() => MaxLengthValidator),
  multi: true
};
var MaxLengthValidator = class _MaxLengthValidator extends AbstractValidatorDirective {
  /**
   * @description
   * Tracks changes to the maximum length bound to this directive.
   */
  maxlength;
  /** @internal */
  inputName = "maxlength";
  /** @internal */
  normalizeInput = (input2) => toInteger(input2);
  /** @internal */
  createValidator = (maxlength) => maxLengthValidator(maxlength);
  static \u0275fac = /* @__PURE__ */ (() => {
    let \u0275MaxLengthValidator_BaseFactory;
    return function MaxLengthValidator_Factory(__ngFactoryType__) {
      return (\u0275MaxLengthValidator_BaseFactory || (\u0275MaxLengthValidator_BaseFactory = \u0275\u0275getInheritedFactory(_MaxLengthValidator)))(__ngFactoryType__ || _MaxLengthValidator);
    };
  })();
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _MaxLengthValidator,
    selectors: [["", "maxlength", "", "formControlName", ""], ["", "maxlength", "", "formControl", ""], ["", "maxlength", "", "ngModel", ""]],
    hostVars: 1,
    hostBindings: function MaxLengthValidator_HostBindings(rf, ctx) {
      if (rf & 2) {
        \u0275\u0275attribute("maxlength", ctx._enabled ? ctx.maxlength : null);
      }
    },
    inputs: {
      maxlength: "maxlength"
    },
    standalone: false,
    features: [\u0275\u0275ProvidersFeature([MAX_LENGTH_VALIDATOR]), \u0275\u0275InheritDefinitionFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MaxLengthValidator, [{
    type: Directive,
    args: [{
      selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]",
      providers: [MAX_LENGTH_VALIDATOR],
      host: {
        "[attr.maxlength]": "_enabled ? maxlength : null"
      },
      standalone: false
    }]
  }], null, {
    maxlength: [{
      type: Input
    }]
  });
})();
var PATTERN_VALIDATOR = {
  provide: NG_VALIDATORS,
  useExisting: forwardRef(() => PatternValidator),
  multi: true
};
var PatternValidator = class _PatternValidator extends AbstractValidatorDirective {
  /**
   * @description
   * Tracks changes to the pattern bound to this directive.
   */
  pattern;
  // This input is always defined, since the name matches selector.
  /** @internal */
  inputName = "pattern";
  /** @internal */
  normalizeInput = (input2) => input2;
  /** @internal */
  createValidator = (input2) => patternValidator(input2);
  static \u0275fac = /* @__PURE__ */ (() => {
    let \u0275PatternValidator_BaseFactory;
    return function PatternValidator_Factory(__ngFactoryType__) {
      return (\u0275PatternValidator_BaseFactory || (\u0275PatternValidator_BaseFactory = \u0275\u0275getInheritedFactory(_PatternValidator)))(__ngFactoryType__ || _PatternValidator);
    };
  })();
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _PatternValidator,
    selectors: [["", "pattern", "", "formControlName", ""], ["", "pattern", "", "formControl", ""], ["", "pattern", "", "ngModel", ""]],
    hostVars: 1,
    hostBindings: function PatternValidator_HostBindings(rf, ctx) {
      if (rf & 2) {
        \u0275\u0275attribute("pattern", ctx._enabled ? ctx.pattern : null);
      }
    },
    inputs: {
      pattern: "pattern"
    },
    standalone: false,
    features: [\u0275\u0275ProvidersFeature([PATTERN_VALIDATOR]), \u0275\u0275InheritDefinitionFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PatternValidator, [{
    type: Directive,
    args: [{
      selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]",
      providers: [PATTERN_VALIDATOR],
      host: {
        "[attr.pattern]": "_enabled ? pattern : null"
      },
      standalone: false
    }]
  }], null, {
    pattern: [{
      type: Input
    }]
  });
})();
var SHARED_FORM_DIRECTIVES = [\u0275NgNoValidate, NgSelectOption, \u0275NgSelectMultipleOption, DefaultValueAccessor, NumberValueAccessor, RangeValueAccessor, CheckboxControlValueAccessor, SelectControlValueAccessor, SelectMultipleControlValueAccessor, RadioControlValueAccessor, NgControlStatus, NgControlStatusGroup, RequiredValidator, MinLengthValidator, MaxLengthValidator, PatternValidator, CheckboxRequiredValidator, EmailValidator, MinValidator, MaxValidator];
var TEMPLATE_DRIVEN_DIRECTIVES = [NgModel, NgModelGroup, NgForm];
var REACTIVE_DRIVEN_DIRECTIVES = [FormControlDirective, FormGroupDirective, FormControlName, FormGroupName, FormArrayName];
var \u0275InternalFormsSharedModule = class _\u0275InternalFormsSharedModule {
  static \u0275fac = function \u0275InternalFormsSharedModule_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _\u0275InternalFormsSharedModule)();
  };
  static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
    type: _\u0275InternalFormsSharedModule,
    declarations: [\u0275NgNoValidate, NgSelectOption, \u0275NgSelectMultipleOption, DefaultValueAccessor, NumberValueAccessor, RangeValueAccessor, CheckboxControlValueAccessor, SelectControlValueAccessor, SelectMultipleControlValueAccessor, RadioControlValueAccessor, NgControlStatus, NgControlStatusGroup, RequiredValidator, MinLengthValidator, MaxLengthValidator, PatternValidator, CheckboxRequiredValidator, EmailValidator, MinValidator, MaxValidator],
    exports: [\u0275NgNoValidate, NgSelectOption, \u0275NgSelectMultipleOption, DefaultValueAccessor, NumberValueAccessor, RangeValueAccessor, CheckboxControlValueAccessor, SelectControlValueAccessor, SelectMultipleControlValueAccessor, RadioControlValueAccessor, NgControlStatus, NgControlStatusGroup, RequiredValidator, MinLengthValidator, MaxLengthValidator, PatternValidator, CheckboxRequiredValidator, EmailValidator, MinValidator, MaxValidator]
  });
  static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({});
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(\u0275InternalFormsSharedModule, [{
    type: NgModule,
    args: [{
      declarations: SHARED_FORM_DIRECTIVES,
      exports: SHARED_FORM_DIRECTIVES
    }]
  }], null, null);
})();
var FormArray = class extends AbstractControl {
  /**
   * Creates a new `FormArray` instance.
   *
   * @param controls An array of child controls. Each child control is given an index
   * where it is registered.
   *
   * @param validatorOrOpts A synchronous validator function, or an array of
   * such functions, or an `AbstractControlOptions` object that contains validation functions
   * and a validation trigger.
   *
   * @param asyncValidator A single async validator or array of async validator functions
   *
   */
  constructor(controls, validatorOrOpts, asyncValidator) {
    super(pickValidators(validatorOrOpts), pickAsyncValidators(asyncValidator, validatorOrOpts));
    this.controls = controls;
    this._initObservables();
    this._setUpdateStrategy(validatorOrOpts);
    this._setUpControls();
    this.updateValueAndValidity({
      onlySelf: true,
      // If `asyncValidator` is present, it will trigger control status change from `PENDING` to
      // `VALID` or `INVALID`.
      // The status should be broadcasted via the `statusChanges` observable, so we set `emitEvent`
      // to `true` to allow that during the control creation process.
      emitEvent: !!this.asyncValidator
    });
  }
  controls;
  /**
   * Get the `AbstractControl` at the given `index` in the array.
   *
   * @param index Index in the array to retrieve the control. If `index` is negative, it will wrap
   *     around from the back, and if index is greatly negative (less than `-length`), the result is
   * undefined. This behavior is the same as `Array.at(index)`.
   */
  at(index) {
    return this.controls[this._adjustIndex(index)];
  }
  /**
   * Insert a new `AbstractControl` at the end of the array.
   *
   * @param control Form control to be inserted
   * @param options Specifies whether this FormArray instance should emit events after a new
   *     control is added.
   * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
   * `valueChanges` observables emit events with the latest status and value when the control is
   * inserted. When false, no events are emitted.
   */
  push(control, options = {}) {
    this.controls.push(control);
    this._registerControl(control);
    this.updateValueAndValidity({
      emitEvent: options.emitEvent
    });
    this._onCollectionChange();
  }
  /**
   * Insert a new `AbstractControl` at the given `index` in the array.
   *
   * @param index Index in the array to insert the control. If `index` is negative, wraps around
   *     from the back. If `index` is greatly negative (less than `-length`), prepends to the array.
   * This behavior is the same as `Array.splice(index, 0, control)`.
   * @param control Form control to be inserted
   * @param options Specifies whether this FormArray instance should emit events after a new
   *     control is inserted.
   * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
   * `valueChanges` observables emit events with the latest status and value when the control is
   * inserted. When false, no events are emitted.
   */
  insert(index, control, options = {}) {
    this.controls.splice(index, 0, control);
    this._registerControl(control);
    this.updateValueAndValidity({
      emitEvent: options.emitEvent
    });
  }
  /**
   * Remove the control at the given `index` in the array.
   *
   * @param index Index in the array to remove the control.  If `index` is negative, wraps around
   *     from the back. If `index` is greatly negative (less than `-length`), removes the first
   *     element. This behavior is the same as `Array.splice(index, 1)`.
   * @param options Specifies whether this FormArray instance should emit events after a
   *     control is removed.
   * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
   * `valueChanges` observables emit events with the latest status and value when the control is
   * removed. When false, no events are emitted.
   */
  removeAt(index, options = {}) {
    let adjustedIndex = this._adjustIndex(index);
    if (adjustedIndex < 0) adjustedIndex = 0;
    if (this.controls[adjustedIndex]) this.controls[adjustedIndex]._registerOnCollectionChange(() => {
    });
    this.controls.splice(adjustedIndex, 1);
    this.updateValueAndValidity({
      emitEvent: options.emitEvent
    });
  }
  /**
   * Replace an existing control.
   *
   * @param index Index in the array to replace the control. If `index` is negative, wraps around
   *     from the back. If `index` is greatly negative (less than `-length`), replaces the first
   *     element. This behavior is the same as `Array.splice(index, 1, control)`.
   * @param control The `AbstractControl` control to replace the existing control
   * @param options Specifies whether this FormArray instance should emit events after an
   *     existing control is replaced with a new one.
   * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
   * `valueChanges` observables emit events with the latest status and value when the control is
   * replaced with a new one. When false, no events are emitted.
   */
  setControl(index, control, options = {}) {
    let adjustedIndex = this._adjustIndex(index);
    if (adjustedIndex < 0) adjustedIndex = 0;
    if (this.controls[adjustedIndex]) this.controls[adjustedIndex]._registerOnCollectionChange(() => {
    });
    this.controls.splice(adjustedIndex, 1);
    if (control) {
      this.controls.splice(adjustedIndex, 0, control);
      this._registerControl(control);
    }
    this.updateValueAndValidity({
      emitEvent: options.emitEvent
    });
    this._onCollectionChange();
  }
  /**
   * Length of the control array.
   */
  get length() {
    return this.controls.length;
  }
  /**
   * Sets the value of the `FormArray`. It accepts an array that matches
   * the structure of the control.
   *
   * This method performs strict checks, and throws an error if you try
   * to set the value of a control that doesn't exist or if you exclude the
   * value of a control.
   *
   * @usageNotes
   * ### Set the values for the controls in the form array
   *
   * ```ts
   * const arr = new FormArray([
   *   new FormControl(),
   *   new FormControl()
   * ]);
   * console.log(arr.value);   // [null, null]
   *
   * arr.setValue(['Nancy', 'Drew']);
   * console.log(arr.value);   // ['Nancy', 'Drew']
   * ```
   *
   * @param value Array of values for the controls
   * @param options Configure options that determine how the control propagates changes and
   * emits events after the value changes
   *
   * * `onlySelf`: When true, each change only affects this control, and not its parent. Default
   * is false.
   * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
   * `valueChanges`
   * observables emit events with the latest status and value when the control value is updated.
   * When false, no events are emitted.
   * The configuration options are passed to the {@link AbstractControl#updateValueAndValidity
   * updateValueAndValidity} method.
   */
  setValue(value, options = {}) {
    assertAllValuesPresent(this, false, value);
    value.forEach((newValue, index) => {
      assertControlPresent(this, false, index);
      this.at(index).setValue(newValue, {
        onlySelf: true,
        emitEvent: options.emitEvent
      });
    });
    this.updateValueAndValidity(options);
  }
  /**
   * Patches the value of the `FormArray`. It accepts an array that matches the
   * structure of the control, and does its best to match the values to the correct
   * controls in the group.
   *
   * It accepts both super-sets and sub-sets of the array without throwing an error.
   *
   * @usageNotes
   * ### Patch the values for controls in a form array
   *
   * ```ts
   * const arr = new FormArray([
   *    new FormControl(),
   *    new FormControl()
   * ]);
   * console.log(arr.value);   // [null, null]
   *
   * arr.patchValue(['Nancy']);
   * console.log(arr.value);   // ['Nancy', null]
   * ```
   *
   * @param value Array of latest values for the controls
   * @param options Configure options that determine how the control propagates changes and
   * emits events after the value changes
   *
   * * `onlySelf`: When true, each change only affects this control, and not its parent. Default
   * is false.
   * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
   * `valueChanges` observables emit events with the latest status and value when the control
   * value is updated. When false, no events are emitted. The configuration options are passed to
   * the {@link AbstractControl#updateValueAndValidity updateValueAndValidity} method.
   */
  patchValue(value, options = {}) {
    if (value == null) return;
    value.forEach((newValue, index) => {
      if (this.at(index)) {
        this.at(index).patchValue(newValue, {
          onlySelf: true,
          emitEvent: options.emitEvent
        });
      }
    });
    this.updateValueAndValidity(options);
  }
  /**
   * Resets the `FormArray` and all descendants are marked `pristine` and `untouched`, and the
   * value of all descendants to null or null maps.
   *
   * You reset to a specific form state by passing in an array of states
   * that matches the structure of the control. The state is a standalone value
   * or a form state object with both a value and a disabled status.
   *
   * @usageNotes
   * ### Reset the values in a form array
   *
   * ```ts
   * const arr = new FormArray([
   *    new FormControl(),
   *    new FormControl()
   * ]);
   * arr.reset(['name', 'last name']);
   *
   * console.log(arr.value);  // ['name', 'last name']
   * ```
   *
   * ### Reset the values in a form array and the disabled status for the first control
   *
   * ```ts
   * arr.reset([
   *   {value: 'name', disabled: true},
   *   'last'
   * ]);
   *
   * console.log(arr.value);  // ['last']
   * console.log(arr.at(0).status);  // 'DISABLED'
   * ```
   *
   * @param value Array of values for the controls
   * @param options Configure options that determine how the control propagates changes and
   * emits events after the value changes
   *
   * * `onlySelf`: When true, each change only affects this control, and not its parent. Default
   * is false.
   * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
   * `valueChanges`
   * observables emit events with the latest status and value when the control is reset.
   * When false, no events are emitted.
   * The configuration options are passed to the {@link AbstractControl#updateValueAndValidity
   * updateValueAndValidity} method.
   */
  reset(value = [], options = {}) {
    this._forEachChild((control, index) => {
      control.reset(value[index], {
        onlySelf: true,
        emitEvent: options.emitEvent
      });
    });
    this._updatePristine(options, this);
    this._updateTouched(options, this);
    this.updateValueAndValidity(options);
  }
  /**
   * The aggregate value of the array, including any disabled controls.
   *
   * Reports all values regardless of disabled status.
   */
  getRawValue() {
    return this.controls.map((control) => control.getRawValue());
  }
  /**
   * Remove all controls in the `FormArray`.
   *
   * @param options Specifies whether this FormArray instance should emit events after all
   *     controls are removed.
   * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
   * `valueChanges` observables emit events with the latest status and value when all controls
   * in this FormArray instance are removed. When false, no events are emitted.
   *
   * @usageNotes
   * ### Remove all elements from a FormArray
   *
   * ```ts
   * const arr = new FormArray([
   *    new FormControl(),
   *    new FormControl()
   * ]);
   * console.log(arr.length);  // 2
   *
   * arr.clear();
   * console.log(arr.length);  // 0
   * ```
   *
   * It's a simpler and more efficient alternative to removing all elements one by one:
   *
   * ```ts
   * const arr = new FormArray([
   *    new FormControl(),
   *    new FormControl()
   * ]);
   *
   * while (arr.length) {
   *    arr.removeAt(0);
   * }
   * ```
   */
  clear(options = {}) {
    if (this.controls.length < 1) return;
    this._forEachChild((control) => control._registerOnCollectionChange(() => {
    }));
    this.controls.splice(0);
    this.updateValueAndValidity({
      emitEvent: options.emitEvent
    });
  }
  /**
   * Adjusts a negative index by summing it with the length of the array. For very negative
   * indices, the result may remain negative.
   * @internal
   */
  _adjustIndex(index) {
    return index < 0 ? index + this.length : index;
  }
  /** @internal */
  _syncPendingControls() {
    let subtreeUpdated = this.controls.reduce((updated, child) => {
      return child._syncPendingControls() ? true : updated;
    }, false);
    if (subtreeUpdated) this.updateValueAndValidity({
      onlySelf: true
    });
    return subtreeUpdated;
  }
  /** @internal */
  _forEachChild(cb) {
    this.controls.forEach((control, index) => {
      cb(control, index);
    });
  }
  /** @internal */
  _updateValue() {
    this.value = this.controls.filter((control) => control.enabled || this.disabled).map((control) => control.value);
  }
  /** @internal */
  _anyControls(condition) {
    return this.controls.some((control) => control.enabled && condition(control));
  }
  /** @internal */
  _setUpControls() {
    this._forEachChild((control) => this._registerControl(control));
  }
  /** @internal */
  _allControlsDisabled() {
    for (const control of this.controls) {
      if (control.enabled) return false;
    }
    return this.controls.length > 0 || this.disabled;
  }
  _registerControl(control) {
    control.setParent(this);
    control._registerOnCollectionChange(this._onCollectionChange);
  }
  /** @internal */
  _find(name2) {
    return this.at(name2) ?? null;
  }
};
function isAbstractControlOptions(options) {
  return !!options && (options.asyncValidators !== void 0 || options.validators !== void 0 || options.updateOn !== void 0);
}
var FormBuilder = class _FormBuilder {
  useNonNullable = false;
  /**
   * @description
   * Returns a FormBuilder in which automatically constructed `FormControl` elements
   * have `{nonNullable: true}` and are non-nullable.
   *
   * **Constructing non-nullable controls**
   *
   * When constructing a control, it will be non-nullable, and will reset to its initial value.
   *
   * ```ts
   * let nnfb = new FormBuilder().nonNullable;
   * let name = nnfb.control('Alex'); // FormControl<string>
   * name.reset();
   * console.log(name); // 'Alex'
   * ```
   *
   * **Constructing non-nullable groups or arrays**
   *
   * When constructing a group or array, all automatically created inner controls will be
   * non-nullable, and will reset to their initial values.
   *
   * ```ts
   * let nnfb = new FormBuilder().nonNullable;
   * let name = nnfb.group({who: 'Alex'}); // FormGroup<{who: FormControl<string>}>
   * name.reset();
   * console.log(name); // {who: 'Alex'}
   * ```
   * **Constructing *nullable* fields on groups or arrays**
   *
   * It is still possible to have a nullable field. In particular, any `FormControl` which is
   * *already* constructed will not be altered. For example:
   *
   * ```ts
   * let nnfb = new FormBuilder().nonNullable;
   * // FormGroup<{who: FormControl<string|null>}>
   * let name = nnfb.group({who: new FormControl('Alex')});
   * name.reset(); console.log(name); // {who: null}
   * ```
   *
   * Because the inner control is constructed explicitly by the caller, the builder has
   * no control over how it is created, and cannot exclude the `null`.
   */
  get nonNullable() {
    const nnfb = new _FormBuilder();
    nnfb.useNonNullable = true;
    return nnfb;
  }
  group(controls, options = null) {
    const reducedControls = this._reduceControls(controls);
    let newOptions = {};
    if (isAbstractControlOptions(options)) {
      newOptions = options;
    } else if (options !== null) {
      newOptions.validators = options.validator;
      newOptions.asyncValidators = options.asyncValidator;
    }
    return new FormGroup(reducedControls, newOptions);
  }
  /**
   * @description
   * Constructs a new `FormRecord` instance. Accepts a single generic argument, which is an object
   * containing all the keys and corresponding inner control types.
   *
   * @param controls A collection of child controls. The key for each child is the name
   * under which it is registered.
   *
   * @param options Configuration options object for the `FormRecord`. The object should have the
   * `AbstractControlOptions` type and might contain the following fields:
   * * `validators`: A synchronous validator function, or an array of validator functions.
   * * `asyncValidators`: A single async validator or array of async validator functions.
   * * `updateOn`: The event upon which the control should be updated (options: 'change' | 'blur'
   * | submit').
   */
  record(controls, options = null) {
    const reducedControls = this._reduceControls(controls);
    return new FormRecord(reducedControls, options);
  }
  /**
   * @description
   * Constructs a new `FormControl` with the given state, validators and options. Sets
   * `{nonNullable: true}` in the options to get a non-nullable control. Otherwise, the
   * control will be nullable. Accepts a single generic argument, which is the type  of the
   * control's value.
   *
   * @param formState Initializes the control with an initial state value, or
   * with an object that contains both a value and a disabled status.
   *
   * @param validatorOrOpts A synchronous validator function, or an array of
   * such functions, or a `FormControlOptions` object that contains
   * validation functions and a validation trigger.
   *
   * @param asyncValidator A single async validator or array of async validator
   * functions.
   *
   * @usageNotes
   *
   * ### Initialize a control as disabled
   *
   * The following example returns a control with an initial value in a disabled state.
   *
   * {@example forms/ts/formBuilder/form_builder_example.ts region='disabled-control'}
   */
  control(formState, validatorOrOpts, asyncValidator) {
    let newOptions = {};
    if (!this.useNonNullable) {
      return new FormControl(formState, validatorOrOpts, asyncValidator);
    }
    if (isAbstractControlOptions(validatorOrOpts)) {
      newOptions = validatorOrOpts;
    } else {
      newOptions.validators = validatorOrOpts;
      newOptions.asyncValidators = asyncValidator;
    }
    return new FormControl(formState, __spreadProps(__spreadValues({}, newOptions), {
      nonNullable: true
    }));
  }
  /**
   * Constructs a new `FormArray` from the given array of configurations,
   * validators and options. Accepts a single generic argument, which is the type of each control
   * inside the array.
   *
   * @param controls An array of child controls or control configs. Each child control is given an
   *     index when it is registered.
   *
   * @param validatorOrOpts A synchronous validator function, or an array of such functions, or an
   *     `AbstractControlOptions` object that contains
   * validation functions and a validation trigger.
   *
   * @param asyncValidator A single async validator or array of async validator functions.
   */
  array(controls, validatorOrOpts, asyncValidator) {
    const createdControls = controls.map((c) => this._createControl(c));
    return new FormArray(createdControls, validatorOrOpts, asyncValidator);
  }
  /** @internal */
  _reduceControls(controls) {
    const createdControls = {};
    Object.keys(controls).forEach((controlName) => {
      createdControls[controlName] = this._createControl(controls[controlName]);
    });
    return createdControls;
  }
  /** @internal */
  _createControl(controls) {
    if (controls instanceof FormControl) {
      return controls;
    } else if (controls instanceof AbstractControl) {
      return controls;
    } else if (Array.isArray(controls)) {
      const value = controls[0];
      const validator = controls.length > 1 ? controls[1] : null;
      const asyncValidator = controls.length > 2 ? controls[2] : null;
      return this.control(value, validator, asyncValidator);
    } else {
      return this.control(controls);
    }
  }
  static \u0275fac = function FormBuilder_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _FormBuilder)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _FormBuilder,
    factory: _FormBuilder.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(FormBuilder, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], null, null);
})();
var NonNullableFormBuilder = class _NonNullableFormBuilder {
  static \u0275fac = function NonNullableFormBuilder_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _NonNullableFormBuilder)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _NonNullableFormBuilder,
    factory: () => (() => inject2(FormBuilder).nonNullable)(),
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NonNullableFormBuilder, [{
    type: Injectable,
    args: [{
      providedIn: "root",
      useFactory: () => inject2(FormBuilder).nonNullable
    }]
  }], null, null);
})();
var UntypedFormBuilder = class _UntypedFormBuilder extends FormBuilder {
  group(controlsConfig, options = null) {
    return super.group(controlsConfig, options);
  }
  /**
   * Like `FormBuilder#control`, except the resulting control is untyped.
   */
  control(formState, validatorOrOpts, asyncValidator) {
    return super.control(formState, validatorOrOpts, asyncValidator);
  }
  /**
   * Like `FormBuilder#array`, except the resulting array is untyped.
   */
  array(controlsConfig, validatorOrOpts, asyncValidator) {
    return super.array(controlsConfig, validatorOrOpts, asyncValidator);
  }
  static \u0275fac = /* @__PURE__ */ (() => {
    let \u0275UntypedFormBuilder_BaseFactory;
    return function UntypedFormBuilder_Factory(__ngFactoryType__) {
      return (\u0275UntypedFormBuilder_BaseFactory || (\u0275UntypedFormBuilder_BaseFactory = \u0275\u0275getInheritedFactory(_UntypedFormBuilder)))(__ngFactoryType__ || _UntypedFormBuilder);
    };
  })();
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _UntypedFormBuilder,
    factory: _UntypedFormBuilder.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(UntypedFormBuilder, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], null, null);
})();
var VERSION5 = new Version("20.1.3");
var FormsModule = class _FormsModule {
  /**
   * @description
   * Provides options for configuring the forms module.
   *
   * @param opts An object of configuration options
   * * `callSetDisabledState` Configures whether to `always` call `setDisabledState`, which is more
   * correct, or to only call it `whenDisabled`, which is the legacy behavior.
   */
  static withConfig(opts) {
    return {
      ngModule: _FormsModule,
      providers: [{
        provide: CALL_SET_DISABLED_STATE,
        useValue: opts.callSetDisabledState ?? setDisabledStateDefault
      }]
    };
  }
  static \u0275fac = function FormsModule_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _FormsModule)();
  };
  static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
    type: _FormsModule,
    declarations: [NgModel, NgModelGroup, NgForm],
    exports: [\u0275InternalFormsSharedModule, NgModel, NgModelGroup, NgForm]
  });
  static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({
    imports: [\u0275InternalFormsSharedModule]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(FormsModule, [{
    type: NgModule,
    args: [{
      declarations: TEMPLATE_DRIVEN_DIRECTIVES,
      exports: [\u0275InternalFormsSharedModule, TEMPLATE_DRIVEN_DIRECTIVES]
    }]
  }], null, null);
})();
var ReactiveFormsModule = class _ReactiveFormsModule {
  /**
   * @description
   * Provides options for configuring the reactive forms module.
   *
   * @param opts An object of configuration options
   * * `warnOnNgModelWithFormControl` Configures when to emit a warning when an `ngModel`
   * binding is used with reactive form directives.
   * * `callSetDisabledState` Configures whether to `always` call `setDisabledState`, which is more
   * correct, or to only call it `whenDisabled`, which is the legacy behavior.
   */
  static withConfig(opts) {
    return {
      ngModule: _ReactiveFormsModule,
      providers: [{
        provide: NG_MODEL_WITH_FORM_CONTROL_WARNING,
        useValue: opts.warnOnNgModelWithFormControl ?? "always"
      }, {
        provide: CALL_SET_DISABLED_STATE,
        useValue: opts.callSetDisabledState ?? setDisabledStateDefault
      }]
    };
  }
  static \u0275fac = function ReactiveFormsModule_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _ReactiveFormsModule)();
  };
  static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
    type: _ReactiveFormsModule,
    declarations: [FormControlDirective, FormGroupDirective, FormControlName, FormGroupName, FormArrayName],
    exports: [\u0275InternalFormsSharedModule, FormControlDirective, FormGroupDirective, FormControlName, FormGroupName, FormArrayName]
  });
  static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({
    imports: [\u0275InternalFormsSharedModule]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ReactiveFormsModule, [{
    type: NgModule,
    args: [{
      declarations: [REACTIVE_DRIVEN_DIRECTIVES],
      exports: [\u0275InternalFormsSharedModule, REACTIVE_DRIVEN_DIRECTIVES]
    }]
  }], null, null);
})();

// node_modules/@angular/material/fesm2022/index-BRImSAOu.mjs
var MatRippleModule = class _MatRippleModule {
  static \u0275fac = function MatRippleModule_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _MatRippleModule)();
  };
  static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
    type: _MatRippleModule,
    imports: [MatCommonModule, MatRipple],
    exports: [MatRipple, MatCommonModule]
  });
  static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({
    imports: [MatCommonModule, MatCommonModule]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatRippleModule, [{
    type: NgModule,
    args: [{
      imports: [MatCommonModule, MatRipple],
      exports: [MatRipple, MatCommonModule]
    }]
  }], null, null);
})();

// node_modules/@angular/material/fesm2022/pseudo-checkbox-AUVlNJs_.mjs
var MatPseudoCheckbox = class _MatPseudoCheckbox {
  _animationsDisabled = _animationsDisabled();
  /** Display state of the checkbox. */
  state = "unchecked";
  /** Whether the checkbox is disabled. */
  disabled = false;
  /**
   * Appearance of the pseudo checkbox. Default appearance of 'full' renders a checkmark/mixedmark
   * indicator inside a square box. 'minimal' appearance only renders the checkmark/mixedmark.
   */
  appearance = "full";
  constructor() {
  }
  static \u0275fac = function MatPseudoCheckbox_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _MatPseudoCheckbox)();
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({
    type: _MatPseudoCheckbox,
    selectors: [["mat-pseudo-checkbox"]],
    hostAttrs: [1, "mat-pseudo-checkbox"],
    hostVars: 12,
    hostBindings: function MatPseudoCheckbox_HostBindings(rf, ctx) {
      if (rf & 2) {
        \u0275\u0275classProp("mat-pseudo-checkbox-indeterminate", ctx.state === "indeterminate")("mat-pseudo-checkbox-checked", ctx.state === "checked")("mat-pseudo-checkbox-disabled", ctx.disabled)("mat-pseudo-checkbox-minimal", ctx.appearance === "minimal")("mat-pseudo-checkbox-full", ctx.appearance === "full")("_mat-animation-noopable", ctx._animationsDisabled);
      }
    },
    inputs: {
      state: "state",
      disabled: "disabled",
      appearance: "appearance"
    },
    decls: 0,
    vars: 0,
    template: function MatPseudoCheckbox_Template(rf, ctx) {
    },
    styles: ['.mat-pseudo-checkbox{border-radius:2px;cursor:pointer;display:inline-block;vertical-align:middle;box-sizing:border-box;position:relative;flex-shrink:0;transition:border-color 90ms cubic-bezier(0, 0, 0.2, 0.1),background-color 90ms cubic-bezier(0, 0, 0.2, 0.1)}.mat-pseudo-checkbox::after{position:absolute;opacity:0;content:"";border-bottom:2px solid currentColor;transition:opacity 90ms cubic-bezier(0, 0, 0.2, 0.1)}.mat-pseudo-checkbox._mat-animation-noopable{transition:none !important;animation:none !important}.mat-pseudo-checkbox._mat-animation-noopable::after{transition:none}.mat-pseudo-checkbox-disabled{cursor:default}.mat-pseudo-checkbox-indeterminate::after{left:1px;opacity:1;border-radius:2px}.mat-pseudo-checkbox-checked::after{left:1px;border-left:2px solid currentColor;transform:rotate(-45deg);opacity:1;box-sizing:content-box}.mat-pseudo-checkbox-minimal.mat-pseudo-checkbox-checked::after,.mat-pseudo-checkbox-minimal.mat-pseudo-checkbox-indeterminate::after{color:var(--mat-pseudo-checkbox-minimal-selected-checkmark-color, var(--mat-sys-primary))}.mat-pseudo-checkbox-minimal.mat-pseudo-checkbox-checked.mat-pseudo-checkbox-disabled::after,.mat-pseudo-checkbox-minimal.mat-pseudo-checkbox-indeterminate.mat-pseudo-checkbox-disabled::after{color:var(--mat-pseudo-checkbox-minimal-disabled-selected-checkmark-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-pseudo-checkbox-full{border-color:var(--mat-pseudo-checkbox-full-unselected-icon-color, var(--mat-sys-on-surface-variant));border-width:2px;border-style:solid}.mat-pseudo-checkbox-full.mat-pseudo-checkbox-disabled{border-color:var(--mat-pseudo-checkbox-full-disabled-unselected-icon-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-pseudo-checkbox-full.mat-pseudo-checkbox-checked,.mat-pseudo-checkbox-full.mat-pseudo-checkbox-indeterminate{background-color:var(--mat-pseudo-checkbox-full-selected-icon-color, var(--mat-sys-primary));border-color:rgba(0,0,0,0)}.mat-pseudo-checkbox-full.mat-pseudo-checkbox-checked::after,.mat-pseudo-checkbox-full.mat-pseudo-checkbox-indeterminate::after{color:var(--mat-pseudo-checkbox-full-selected-checkmark-color, var(--mat-sys-on-primary))}.mat-pseudo-checkbox-full.mat-pseudo-checkbox-checked.mat-pseudo-checkbox-disabled,.mat-pseudo-checkbox-full.mat-pseudo-checkbox-indeterminate.mat-pseudo-checkbox-disabled{background-color:var(--mat-pseudo-checkbox-full-disabled-selected-icon-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-pseudo-checkbox-full.mat-pseudo-checkbox-checked.mat-pseudo-checkbox-disabled::after,.mat-pseudo-checkbox-full.mat-pseudo-checkbox-indeterminate.mat-pseudo-checkbox-disabled::after{color:var(--mat-pseudo-checkbox-full-disabled-selected-checkmark-color, var(--mat-sys-surface))}.mat-pseudo-checkbox{width:18px;height:18px}.mat-pseudo-checkbox-minimal.mat-pseudo-checkbox-checked::after{width:14px;height:6px;transform-origin:center;top:-4.2426406871px;left:0;bottom:0;right:0;margin:auto}.mat-pseudo-checkbox-minimal.mat-pseudo-checkbox-indeterminate::after{top:8px;width:16px}.mat-pseudo-checkbox-full.mat-pseudo-checkbox-checked::after{width:10px;height:4px;transform-origin:center;top:-2.8284271247px;left:0;bottom:0;right:0;margin:auto}.mat-pseudo-checkbox-full.mat-pseudo-checkbox-indeterminate::after{top:6px;width:12px}\n'],
    encapsulation: 2,
    changeDetection: 0
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatPseudoCheckbox, [{
    type: Component,
    args: [{
      encapsulation: ViewEncapsulation.None,
      changeDetection: ChangeDetectionStrategy.OnPush,
      selector: "mat-pseudo-checkbox",
      template: "",
      host: {
        "class": "mat-pseudo-checkbox",
        "[class.mat-pseudo-checkbox-indeterminate]": 'state === "indeterminate"',
        "[class.mat-pseudo-checkbox-checked]": 'state === "checked"',
        "[class.mat-pseudo-checkbox-disabled]": "disabled",
        "[class.mat-pseudo-checkbox-minimal]": 'appearance === "minimal"',
        "[class.mat-pseudo-checkbox-full]": 'appearance === "full"',
        "[class._mat-animation-noopable]": "_animationsDisabled"
      },
      styles: ['.mat-pseudo-checkbox{border-radius:2px;cursor:pointer;display:inline-block;vertical-align:middle;box-sizing:border-box;position:relative;flex-shrink:0;transition:border-color 90ms cubic-bezier(0, 0, 0.2, 0.1),background-color 90ms cubic-bezier(0, 0, 0.2, 0.1)}.mat-pseudo-checkbox::after{position:absolute;opacity:0;content:"";border-bottom:2px solid currentColor;transition:opacity 90ms cubic-bezier(0, 0, 0.2, 0.1)}.mat-pseudo-checkbox._mat-animation-noopable{transition:none !important;animation:none !important}.mat-pseudo-checkbox._mat-animation-noopable::after{transition:none}.mat-pseudo-checkbox-disabled{cursor:default}.mat-pseudo-checkbox-indeterminate::after{left:1px;opacity:1;border-radius:2px}.mat-pseudo-checkbox-checked::after{left:1px;border-left:2px solid currentColor;transform:rotate(-45deg);opacity:1;box-sizing:content-box}.mat-pseudo-checkbox-minimal.mat-pseudo-checkbox-checked::after,.mat-pseudo-checkbox-minimal.mat-pseudo-checkbox-indeterminate::after{color:var(--mat-pseudo-checkbox-minimal-selected-checkmark-color, var(--mat-sys-primary))}.mat-pseudo-checkbox-minimal.mat-pseudo-checkbox-checked.mat-pseudo-checkbox-disabled::after,.mat-pseudo-checkbox-minimal.mat-pseudo-checkbox-indeterminate.mat-pseudo-checkbox-disabled::after{color:var(--mat-pseudo-checkbox-minimal-disabled-selected-checkmark-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-pseudo-checkbox-full{border-color:var(--mat-pseudo-checkbox-full-unselected-icon-color, var(--mat-sys-on-surface-variant));border-width:2px;border-style:solid}.mat-pseudo-checkbox-full.mat-pseudo-checkbox-disabled{border-color:var(--mat-pseudo-checkbox-full-disabled-unselected-icon-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-pseudo-checkbox-full.mat-pseudo-checkbox-checked,.mat-pseudo-checkbox-full.mat-pseudo-checkbox-indeterminate{background-color:var(--mat-pseudo-checkbox-full-selected-icon-color, var(--mat-sys-primary));border-color:rgba(0,0,0,0)}.mat-pseudo-checkbox-full.mat-pseudo-checkbox-checked::after,.mat-pseudo-checkbox-full.mat-pseudo-checkbox-indeterminate::after{color:var(--mat-pseudo-checkbox-full-selected-checkmark-color, var(--mat-sys-on-primary))}.mat-pseudo-checkbox-full.mat-pseudo-checkbox-checked.mat-pseudo-checkbox-disabled,.mat-pseudo-checkbox-full.mat-pseudo-checkbox-indeterminate.mat-pseudo-checkbox-disabled{background-color:var(--mat-pseudo-checkbox-full-disabled-selected-icon-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-pseudo-checkbox-full.mat-pseudo-checkbox-checked.mat-pseudo-checkbox-disabled::after,.mat-pseudo-checkbox-full.mat-pseudo-checkbox-indeterminate.mat-pseudo-checkbox-disabled::after{color:var(--mat-pseudo-checkbox-full-disabled-selected-checkmark-color, var(--mat-sys-surface))}.mat-pseudo-checkbox{width:18px;height:18px}.mat-pseudo-checkbox-minimal.mat-pseudo-checkbox-checked::after{width:14px;height:6px;transform-origin:center;top:-4.2426406871px;left:0;bottom:0;right:0;margin:auto}.mat-pseudo-checkbox-minimal.mat-pseudo-checkbox-indeterminate::after{top:8px;width:16px}.mat-pseudo-checkbox-full.mat-pseudo-checkbox-checked::after{width:10px;height:4px;transform-origin:center;top:-2.8284271247px;left:0;bottom:0;right:0;margin:auto}.mat-pseudo-checkbox-full.mat-pseudo-checkbox-indeterminate::after{top:6px;width:12px}\n']
    }]
  }], () => [], {
    state: [{
      type: Input
    }],
    disabled: [{
      type: Input
    }],
    appearance: [{
      type: Input
    }]
  });
})();

// node_modules/@angular/material/fesm2022/pseudo-checkbox-module-BymSaWBn.mjs
var MatPseudoCheckboxModule = class _MatPseudoCheckboxModule {
  static \u0275fac = function MatPseudoCheckboxModule_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _MatPseudoCheckboxModule)();
  };
  static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
    type: _MatPseudoCheckboxModule,
    imports: [MatCommonModule, MatPseudoCheckbox],
    exports: [MatPseudoCheckbox]
  });
  static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({
    imports: [MatCommonModule]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatPseudoCheckboxModule, [{
    type: NgModule,
    args: [{
      imports: [MatCommonModule, MatPseudoCheckbox],
      exports: [MatPseudoCheckbox]
    }]
  }], null, null);
})();

// node_modules/@angular/material/fesm2022/list.mjs
var _c0 = ["*"];
var _c1 = '.mdc-list{margin:0;padding:8px 0;list-style-type:none}.mdc-list:focus{outline:none}.mdc-list-item{display:flex;position:relative;justify-content:flex-start;overflow:hidden;padding:0;align-items:stretch;cursor:pointer;padding-left:16px;padding-right:16px;background-color:var(--mat-list-list-item-container-color, transparent);border-radius:var(--mat-list-list-item-container-shape, var(--mat-sys-corner-none))}.mdc-list-item.mdc-list-item--selected{background-color:var(--mat-list-list-item-selected-container-color)}.mdc-list-item:focus{outline:0}.mdc-list-item.mdc-list-item--disabled{cursor:auto}.mdc-list-item.mdc-list-item--with-one-line{height:var(--mat-list-list-item-one-line-container-height, 48px)}.mdc-list-item.mdc-list-item--with-one-line .mdc-list-item__start{align-self:center;margin-top:0}.mdc-list-item.mdc-list-item--with-one-line .mdc-list-item__end{align-self:center;margin-top:0}.mdc-list-item.mdc-list-item--with-two-lines{height:var(--mat-list-list-item-two-line-container-height, 64px)}.mdc-list-item.mdc-list-item--with-two-lines .mdc-list-item__start{align-self:flex-start;margin-top:16px}.mdc-list-item.mdc-list-item--with-two-lines .mdc-list-item__end{align-self:center;margin-top:0}.mdc-list-item.mdc-list-item--with-three-lines{height:var(--mat-list-list-item-three-line-container-height, 88px)}.mdc-list-item.mdc-list-item--with-three-lines .mdc-list-item__start{align-self:flex-start;margin-top:16px}.mdc-list-item.mdc-list-item--with-three-lines .mdc-list-item__end{align-self:flex-start;margin-top:16px}.mdc-list-item.mdc-list-item--selected::before,.mdc-list-item.mdc-list-item--selected:focus::before,.mdc-list-item:not(.mdc-list-item--selected):focus::before{position:absolute;box-sizing:border-box;width:100%;height:100%;top:0;left:0;content:"";pointer-events:none}a.mdc-list-item{color:inherit;text-decoration:none}.mdc-list-item__start{fill:currentColor;flex-shrink:0;pointer-events:none}.mdc-list-item--with-leading-icon .mdc-list-item__start{color:var(--mat-list-list-item-leading-icon-color, var(--mat-sys-on-surface-variant));width:var(--mat-list-list-item-leading-icon-size, 24px);height:var(--mat-list-list-item-leading-icon-size, 24px);margin-left:16px;margin-right:32px}[dir=rtl] .mdc-list-item--with-leading-icon .mdc-list-item__start{margin-left:32px;margin-right:16px}.mdc-list-item--with-leading-icon:hover .mdc-list-item__start{color:var(--mat-list-list-item-hover-leading-icon-color)}.mdc-list-item--with-leading-avatar .mdc-list-item__start{width:var(--mat-list-list-item-leading-avatar-size, 40px);height:var(--mat-list-list-item-leading-avatar-size, 40px);margin-left:16px;margin-right:16px;border-radius:50%}.mdc-list-item--with-leading-avatar .mdc-list-item__start,[dir=rtl] .mdc-list-item--with-leading-avatar .mdc-list-item__start{margin-left:16px;margin-right:16px;border-radius:50%}.mdc-list-item__end{flex-shrink:0;pointer-events:none}.mdc-list-item--with-trailing-meta .mdc-list-item__end{font-family:var(--mat-list-list-item-trailing-supporting-text-font, var(--mat-sys-label-small-font));line-height:var(--mat-list-list-item-trailing-supporting-text-line-height, var(--mat-sys-label-small-line-height));font-size:var(--mat-list-list-item-trailing-supporting-text-size, var(--mat-sys-label-small-size));font-weight:var(--mat-list-list-item-trailing-supporting-text-weight, var(--mat-sys-label-small-weight));letter-spacing:var(--mat-list-list-item-trailing-supporting-text-tracking, var(--mat-sys-label-small-tracking))}.mdc-list-item--with-trailing-icon .mdc-list-item__end{color:var(--mat-list-list-item-trailing-icon-color, var(--mat-sys-on-surface-variant));width:var(--mat-list-list-item-trailing-icon-size, 24px);height:var(--mat-list-list-item-trailing-icon-size, 24px)}.mdc-list-item--with-trailing-icon:hover .mdc-list-item__end{color:var(--mat-list-list-item-hover-trailing-icon-color)}.mdc-list-item.mdc-list-item--with-trailing-meta .mdc-list-item__end{color:var(--mat-list-list-item-trailing-supporting-text-color, var(--mat-sys-on-surface-variant))}.mdc-list-item--selected.mdc-list-item--with-trailing-icon .mdc-list-item__end{color:var(--mat-list-list-item-selected-trailing-icon-color, var(--mat-sys-primary))}.mdc-list-item__content{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;align-self:center;flex:1;pointer-events:none}.mdc-list-item--with-two-lines .mdc-list-item__content,.mdc-list-item--with-three-lines .mdc-list-item__content{align-self:stretch}.mdc-list-item__primary-text{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;color:var(--mat-list-list-item-label-text-color, var(--mat-sys-on-surface));font-family:var(--mat-list-list-item-label-text-font, var(--mat-sys-body-large-font));line-height:var(--mat-list-list-item-label-text-line-height, var(--mat-sys-body-large-line-height));font-size:var(--mat-list-list-item-label-text-size, var(--mat-sys-body-large-size));font-weight:var(--mat-list-list-item-label-text-weight, var(--mat-sys-body-large-weight));letter-spacing:var(--mat-list-list-item-label-text-tracking, var(--mat-sys-body-large-tracking))}.mdc-list-item:hover .mdc-list-item__primary-text{color:var(--mat-list-list-item-hover-label-text-color, var(--mat-sys-on-surface))}.mdc-list-item:focus .mdc-list-item__primary-text{color:var(--mat-list-list-item-focus-label-text-color, var(--mat-sys-on-surface))}.mdc-list-item--with-two-lines .mdc-list-item__primary-text,.mdc-list-item--with-three-lines .mdc-list-item__primary-text{display:block;margin-top:0;line-height:normal;margin-bottom:-20px}.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before,.mdc-list-item--with-three-lines .mdc-list-item__primary-text::before{display:inline-block;width:0;height:28px;content:"";vertical-align:0}.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after,.mdc-list-item--with-three-lines .mdc-list-item__primary-text::after{display:inline-block;width:0;height:20px;content:"";vertical-align:-20px}.mdc-list-item__secondary-text{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:block;margin-top:0;color:var(--mat-list-list-item-supporting-text-color, var(--mat-sys-on-surface-variant));font-family:var(--mat-list-list-item-supporting-text-font, var(--mat-sys-body-medium-font));line-height:var(--mat-list-list-item-supporting-text-line-height, var(--mat-sys-body-medium-line-height));font-size:var(--mat-list-list-item-supporting-text-size, var(--mat-sys-body-medium-size));font-weight:var(--mat-list-list-item-supporting-text-weight, var(--mat-sys-body-medium-weight));letter-spacing:var(--mat-list-list-item-supporting-text-tracking, var(--mat-sys-body-medium-tracking))}.mdc-list-item__secondary-text::before{display:inline-block;width:0;height:20px;content:"";vertical-align:0}.mdc-list-item--with-three-lines .mdc-list-item__secondary-text{white-space:normal;line-height:20px}.mdc-list-item--with-overline .mdc-list-item__secondary-text{white-space:nowrap;line-height:auto}.mdc-list-item--with-leading-radio.mdc-list-item,.mdc-list-item--with-leading-checkbox.mdc-list-item,.mdc-list-item--with-leading-icon.mdc-list-item,.mdc-list-item--with-leading-avatar.mdc-list-item{padding-left:0;padding-right:16px}[dir=rtl] .mdc-list-item--with-leading-radio.mdc-list-item,[dir=rtl] .mdc-list-item--with-leading-checkbox.mdc-list-item,[dir=rtl] .mdc-list-item--with-leading-icon.mdc-list-item,[dir=rtl] .mdc-list-item--with-leading-avatar.mdc-list-item{padding-left:16px;padding-right:0}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines .mdc-list-item__primary-text,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines .mdc-list-item__primary-text,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines .mdc-list-item__primary-text,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines .mdc-list-item__primary-text{display:block;margin-top:0;line-height:normal;margin-bottom:-20px}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before{display:inline-block;width:0;height:32px;content:"";vertical-align:0}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after{display:inline-block;width:0;height:20px;content:"";vertical-align:-20px}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end{display:block;margin-top:0;line-height:normal}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end::before,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end::before,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end::before,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end::before{display:inline-block;width:0;height:32px;content:"";vertical-align:0}.mdc-list-item--with-trailing-icon.mdc-list-item,[dir=rtl] .mdc-list-item--with-trailing-icon.mdc-list-item{padding-left:0;padding-right:0}.mdc-list-item--with-trailing-icon .mdc-list-item__end{margin-left:16px;margin-right:16px}.mdc-list-item--with-trailing-meta.mdc-list-item{padding-left:16px;padding-right:0}[dir=rtl] .mdc-list-item--with-trailing-meta.mdc-list-item{padding-left:0;padding-right:16px}.mdc-list-item--with-trailing-meta .mdc-list-item__end{-webkit-user-select:none;user-select:none;margin-left:28px;margin-right:16px}[dir=rtl] .mdc-list-item--with-trailing-meta .mdc-list-item__end{margin-left:16px;margin-right:28px}.mdc-list-item--with-trailing-meta.mdc-list-item--with-three-lines .mdc-list-item__end,.mdc-list-item--with-trailing-meta.mdc-list-item--with-two-lines .mdc-list-item__end{display:block;line-height:normal;align-self:flex-start;margin-top:0}.mdc-list-item--with-trailing-meta.mdc-list-item--with-three-lines .mdc-list-item__end::before,.mdc-list-item--with-trailing-meta.mdc-list-item--with-two-lines .mdc-list-item__end::before{display:inline-block;width:0;height:28px;content:"";vertical-align:0}.mdc-list-item--with-leading-radio .mdc-list-item__start,.mdc-list-item--with-leading-checkbox .mdc-list-item__start{margin-left:8px;margin-right:24px}[dir=rtl] .mdc-list-item--with-leading-radio .mdc-list-item__start,[dir=rtl] .mdc-list-item--with-leading-checkbox .mdc-list-item__start{margin-left:24px;margin-right:8px}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines .mdc-list-item__start,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines .mdc-list-item__start{align-self:flex-start;margin-top:8px}.mdc-list-item--with-trailing-radio.mdc-list-item,.mdc-list-item--with-trailing-checkbox.mdc-list-item{padding-left:16px;padding-right:0}[dir=rtl] .mdc-list-item--with-trailing-radio.mdc-list-item,[dir=rtl] .mdc-list-item--with-trailing-checkbox.mdc-list-item{padding-left:0;padding-right:16px}.mdc-list-item--with-trailing-radio.mdc-list-item--with-leading-icon,.mdc-list-item--with-trailing-radio.mdc-list-item--with-leading-avatar,.mdc-list-item--with-trailing-checkbox.mdc-list-item--with-leading-icon,.mdc-list-item--with-trailing-checkbox.mdc-list-item--with-leading-avatar{padding-left:0}[dir=rtl] .mdc-list-item--with-trailing-radio.mdc-list-item--with-leading-icon,[dir=rtl] .mdc-list-item--with-trailing-radio.mdc-list-item--with-leading-avatar,[dir=rtl] .mdc-list-item--with-trailing-checkbox.mdc-list-item--with-leading-icon,[dir=rtl] .mdc-list-item--with-trailing-checkbox.mdc-list-item--with-leading-avatar{padding-right:0}.mdc-list-item--with-trailing-radio .mdc-list-item__end,.mdc-list-item--with-trailing-checkbox .mdc-list-item__end{margin-left:24px;margin-right:8px}[dir=rtl] .mdc-list-item--with-trailing-radio .mdc-list-item__end,[dir=rtl] .mdc-list-item--with-trailing-checkbox .mdc-list-item__end{margin-left:8px;margin-right:24px}.mdc-list-item--with-trailing-radio.mdc-list-item--with-three-lines .mdc-list-item__end,.mdc-list-item--with-trailing-checkbox.mdc-list-item--with-three-lines .mdc-list-item__end{align-self:flex-start;margin-top:8px}.mdc-list-group__subheader{margin:.75rem 16px}.mdc-list-item--disabled .mdc-list-item__start,.mdc-list-item--disabled .mdc-list-item__content,.mdc-list-item--disabled .mdc-list-item__end{opacity:1}.mdc-list-item--disabled .mdc-list-item__primary-text,.mdc-list-item--disabled .mdc-list-item__secondary-text{opacity:var(--mat-list-list-item-disabled-label-text-opacity, 0.3)}.mdc-list-item--disabled.mdc-list-item--with-leading-icon .mdc-list-item__start{color:var(--mat-list-list-item-disabled-leading-icon-color, var(--mat-sys-on-surface));opacity:var(--mat-list-list-item-disabled-leading-icon-opacity, 0.38)}.mdc-list-item--disabled.mdc-list-item--with-trailing-icon .mdc-list-item__end{color:var(--mat-list-list-item-disabled-trailing-icon-color, var(--mat-sys-on-surface));opacity:var(--mat-list-list-item-disabled-trailing-icon-opacity, 0.38)}.mat-mdc-list-item.mat-mdc-list-item-both-leading-and-trailing,[dir=rtl] .mat-mdc-list-item.mat-mdc-list-item-both-leading-and-trailing{padding-left:0;padding-right:0}.mdc-list-item.mdc-list-item--disabled .mdc-list-item__primary-text{color:var(--mat-list-list-item-disabled-label-text-color, var(--mat-sys-on-surface))}.mdc-list-item:hover::before{background-color:var(--mat-list-list-item-hover-state-layer-color, var(--mat-sys-on-surface));opacity:var(--mat-list-list-item-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity))}.mdc-list-item.mdc-list-item--disabled::before{background-color:var(--mat-list-list-item-disabled-state-layer-color, var(--mat-sys-on-surface));opacity:var(--mat-list-list-item-disabled-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}.mdc-list-item:focus::before{background-color:var(--mat-list-list-item-focus-state-layer-color, var(--mat-sys-on-surface));opacity:var(--mat-list-list-item-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}.mdc-list-item--disabled .mdc-radio,.mdc-list-item--disabled .mdc-checkbox{opacity:var(--mat-list-list-item-disabled-label-text-opacity, 0.3)}.mdc-list-item--with-leading-avatar .mat-mdc-list-item-avatar{border-radius:var(--mat-list-list-item-leading-avatar-shape, var(--mat-sys-corner-full));background-color:var(--mat-list-list-item-leading-avatar-color, var(--mat-sys-primary-container))}.mat-mdc-list-item-icon{font-size:var(--mat-list-list-item-leading-icon-size, 24px)}@media(forced-colors: active){a.mdc-list-item--activated::after{content:"";position:absolute;top:50%;right:16px;transform:translateY(-50%);width:10px;height:0;border-bottom:solid 10px;border-radius:10px}a.mdc-list-item--activated [dir=rtl]::after{right:auto;left:16px}}.mat-mdc-list-base{display:block}.mat-mdc-list-base .mdc-list-item__start,.mat-mdc-list-base .mdc-list-item__end,.mat-mdc-list-base .mdc-list-item__content{pointer-events:auto}.mat-mdc-list-item,.mat-mdc-list-option{width:100%;box-sizing:border-box;-webkit-tap-highlight-color:rgba(0,0,0,0)}.mat-mdc-list-item:not(.mat-mdc-list-item-interactive),.mat-mdc-list-option:not(.mat-mdc-list-item-interactive){cursor:default}.mat-mdc-list-item .mat-divider-inset,.mat-mdc-list-option .mat-divider-inset{position:absolute;left:0;right:0;bottom:0}.mat-mdc-list-item .mat-mdc-list-item-avatar~.mat-divider-inset,.mat-mdc-list-option .mat-mdc-list-item-avatar~.mat-divider-inset{margin-left:72px}[dir=rtl] .mat-mdc-list-item .mat-mdc-list-item-avatar~.mat-divider-inset,[dir=rtl] .mat-mdc-list-option .mat-mdc-list-item-avatar~.mat-divider-inset{margin-right:72px}.mat-mdc-list-item-interactive::before{top:0;left:0;right:0;bottom:0;position:absolute;content:"";opacity:0;pointer-events:none;border-radius:inherit}.mat-mdc-list-item>.mat-focus-indicator{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}.mat-mdc-list-item:focus>.mat-focus-indicator::before{content:""}.mat-mdc-list-item.mdc-list-item--with-three-lines .mat-mdc-list-item-line.mdc-list-item__secondary-text{white-space:nowrap;line-height:normal}.mat-mdc-list-item.mdc-list-item--with-three-lines .mat-mdc-list-item-unscoped-content.mdc-list-item__secondary-text{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}mat-action-list button{background:none;color:inherit;border:none;font:inherit;outline:inherit;-webkit-tap-highlight-color:rgba(0,0,0,0);text-align:start}mat-action-list button::-moz-focus-inner{border:0}.mdc-list-item--with-leading-icon .mdc-list-item__start{margin-inline-start:var(--mat-list-list-item-leading-icon-start-space, 16px);margin-inline-end:var(--mat-list-list-item-leading-icon-end-space, 16px)}.mat-mdc-nav-list .mat-mdc-list-item{border-radius:var(--mat-list-active-indicator-shape, var(--mat-sys-corner-full));--mat-focus-indicator-border-radius: var(--mat-list-active-indicator-shape, var(--mat-sys-corner-full))}.mat-mdc-nav-list .mat-mdc-list-item.mdc-list-item--activated{background-color:var(--mat-list-active-indicator-color, var(--mat-sys-secondary-container))}\n';
var _c2 = ["unscopedContent"];
var _c3 = ["text"];
var _c4 = [[["", "matListItemAvatar", ""], ["", "matListItemIcon", ""]], [["", "matListItemTitle", ""]], [["", "matListItemLine", ""]], "*", [["", "matListItemMeta", ""]], [["mat-divider"]]];
var _c5 = ["[matListItemAvatar],[matListItemIcon]", "[matListItemTitle]", "[matListItemLine]", "*", "[matListItemMeta]", "mat-divider"];
var _c6 = [[["", "matListItemTitle", ""]], [["", "matListItemLine", ""]], "*", [["mat-divider"]], [["", "matListItemAvatar", ""], ["", "matListItemIcon", ""]]];
var _c7 = ["[matListItemTitle]", "[matListItemLine]", "*", "mat-divider", "[matListItemAvatar],[matListItemIcon]"];
function MatListOption_ng_template_0_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275projection(0, 4);
  }
}
function MatListOption_ng_template_2_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "div", 11);
    \u0275\u0275element(1, "input", 12);
    \u0275\u0275elementStart(2, "div", 13);
    \u0275\u0275namespaceSVG();
    \u0275\u0275elementStart(3, "svg", 14);
    \u0275\u0275element(4, "path", 15);
    \u0275\u0275elementEnd();
    \u0275\u0275namespaceHTML();
    \u0275\u0275element(5, "div", 16);
    \u0275\u0275elementEnd()();
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext();
    \u0275\u0275classProp("mdc-checkbox--disabled", ctx_r1.disabled);
    \u0275\u0275advance();
    \u0275\u0275property("checked", ctx_r1.selected)("disabled", ctx_r1.disabled);
  }
}
function MatListOption_ng_template_4_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "div", 17);
    \u0275\u0275element(1, "input", 18);
    \u0275\u0275elementStart(2, "div", 19);
    \u0275\u0275element(3, "div", 20)(4, "div", 21);
    \u0275\u0275elementEnd()();
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext();
    \u0275\u0275classProp("mdc-radio--disabled", ctx_r1.disabled);
    \u0275\u0275advance();
    \u0275\u0275property("checked", ctx_r1.selected)("disabled", ctx_r1.disabled);
  }
}
function MatListOption_Conditional_6_ng_template_1_Template(rf, ctx) {
}
function MatListOption_Conditional_6_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "span", 4);
    \u0275\u0275template(1, MatListOption_Conditional_6_ng_template_1_Template, 0, 0, "ng-template", 6);
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    \u0275\u0275nextContext();
    const checkbox_r3 = \u0275\u0275reference(3);
    \u0275\u0275advance();
    \u0275\u0275property("ngTemplateOutlet", checkbox_r3);
  }
}
function MatListOption_Conditional_7_ng_template_1_Template(rf, ctx) {
}
function MatListOption_Conditional_7_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "span", 5);
    \u0275\u0275template(1, MatListOption_Conditional_7_ng_template_1_Template, 0, 0, "ng-template", 6);
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    \u0275\u0275nextContext();
    const radio_r4 = \u0275\u0275reference(5);
    \u0275\u0275advance();
    \u0275\u0275property("ngTemplateOutlet", radio_r4);
  }
}
function MatListOption_Conditional_8_ng_template_0_Template(rf, ctx) {
}
function MatListOption_Conditional_8_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275template(0, MatListOption_Conditional_8_ng_template_0_Template, 0, 0, "ng-template", 6);
  }
  if (rf & 2) {
    \u0275\u0275nextContext();
    const icons_r5 = \u0275\u0275reference(1);
    \u0275\u0275property("ngTemplateOutlet", icons_r5);
  }
}
function MatListOption_Conditional_15_ng_template_1_Template(rf, ctx) {
}
function MatListOption_Conditional_15_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "span", 9);
    \u0275\u0275template(1, MatListOption_Conditional_15_ng_template_1_Template, 0, 0, "ng-template", 6);
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    \u0275\u0275nextContext();
    const checkbox_r3 = \u0275\u0275reference(3);
    \u0275\u0275advance();
    \u0275\u0275property("ngTemplateOutlet", checkbox_r3);
  }
}
function MatListOption_Conditional_16_ng_template_1_Template(rf, ctx) {
}
function MatListOption_Conditional_16_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "span", 9);
    \u0275\u0275template(1, MatListOption_Conditional_16_ng_template_1_Template, 0, 0, "ng-template", 6);
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    \u0275\u0275nextContext();
    const radio_r4 = \u0275\u0275reference(5);
    \u0275\u0275advance();
    \u0275\u0275property("ngTemplateOutlet", radio_r4);
  }
}
function MatListOption_Conditional_17_ng_template_0_Template(rf, ctx) {
}
function MatListOption_Conditional_17_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275template(0, MatListOption_Conditional_17_ng_template_0_Template, 0, 0, "ng-template", 6);
  }
  if (rf & 2) {
    \u0275\u0275nextContext();
    const icons_r5 = \u0275\u0275reference(1);
    \u0275\u0275property("ngTemplateOutlet", icons_r5);
  }
}
var LIST_OPTION = new InjectionToken("ListOption");
var MatListItemTitle = class _MatListItemTitle {
  _elementRef = inject2(ElementRef);
  constructor() {
  }
  static \u0275fac = function MatListItemTitle_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _MatListItemTitle)();
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _MatListItemTitle,
    selectors: [["", "matListItemTitle", ""]],
    hostAttrs: [1, "mat-mdc-list-item-title", "mdc-list-item__primary-text"]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatListItemTitle, [{
    type: Directive,
    args: [{
      selector: "[matListItemTitle]",
      host: {
        "class": "mat-mdc-list-item-title mdc-list-item__primary-text"
      }
    }]
  }], () => [], null);
})();
var MatListItemLine = class _MatListItemLine {
  _elementRef = inject2(ElementRef);
  constructor() {
  }
  static \u0275fac = function MatListItemLine_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _MatListItemLine)();
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _MatListItemLine,
    selectors: [["", "matListItemLine", ""]],
    hostAttrs: [1, "mat-mdc-list-item-line", "mdc-list-item__secondary-text"]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatListItemLine, [{
    type: Directive,
    args: [{
      selector: "[matListItemLine]",
      host: {
        "class": "mat-mdc-list-item-line mdc-list-item__secondary-text"
      }
    }]
  }], () => [], null);
})();
var MatListItemMeta = class _MatListItemMeta {
  static \u0275fac = function MatListItemMeta_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _MatListItemMeta)();
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _MatListItemMeta,
    selectors: [["", "matListItemMeta", ""]],
    hostAttrs: [1, "mat-mdc-list-item-meta", "mdc-list-item__end"]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatListItemMeta, [{
    type: Directive,
    args: [{
      selector: "[matListItemMeta]",
      host: {
        "class": "mat-mdc-list-item-meta mdc-list-item__end"
      }
    }]
  }], null, null);
})();
var _MatListItemGraphicBase = class __MatListItemGraphicBase {
  _listOption = inject2(LIST_OPTION, {
    optional: true
  });
  constructor() {
  }
  _isAlignedAtStart() {
    return !this._listOption || this._listOption?._getTogglePosition() === "after";
  }
  static \u0275fac = function _MatListItemGraphicBase_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || __MatListItemGraphicBase)();
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: __MatListItemGraphicBase,
    hostVars: 4,
    hostBindings: function _MatListItemGraphicBase_HostBindings(rf, ctx) {
      if (rf & 2) {
        \u0275\u0275classProp("mdc-list-item__start", ctx._isAlignedAtStart())("mdc-list-item__end", !ctx._isAlignedAtStart());
      }
    }
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(_MatListItemGraphicBase, [{
    type: Directive,
    args: [{
      host: {
        // MDC uses intuitively named classes `.mdc-list-item__start` and `.mat-list-item__end` to
        // position content such as icons or checkboxes/radios that comes either before or after the
        // text content respectively. This directive detects the placement of the checkbox/radio and
        // applies the correct MDC class to position the icon/avatar on the opposite side.
        "[class.mdc-list-item__start]": "_isAlignedAtStart()",
        "[class.mdc-list-item__end]": "!_isAlignedAtStart()"
      }
    }]
  }], () => [], null);
})();
var MatListItemAvatar = class _MatListItemAvatar extends _MatListItemGraphicBase {
  static \u0275fac = /* @__PURE__ */ (() => {
    let \u0275MatListItemAvatar_BaseFactory;
    return function MatListItemAvatar_Factory(__ngFactoryType__) {
      return (\u0275MatListItemAvatar_BaseFactory || (\u0275MatListItemAvatar_BaseFactory = \u0275\u0275getInheritedFactory(_MatListItemAvatar)))(__ngFactoryType__ || _MatListItemAvatar);
    };
  })();
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _MatListItemAvatar,
    selectors: [["", "matListItemAvatar", ""]],
    hostAttrs: [1, "mat-mdc-list-item-avatar"],
    features: [\u0275\u0275InheritDefinitionFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatListItemAvatar, [{
    type: Directive,
    args: [{
      selector: "[matListItemAvatar]",
      host: {
        "class": "mat-mdc-list-item-avatar"
      }
    }]
  }], null, null);
})();
var MatListItemIcon = class _MatListItemIcon extends _MatListItemGraphicBase {
  static \u0275fac = /* @__PURE__ */ (() => {
    let \u0275MatListItemIcon_BaseFactory;
    return function MatListItemIcon_Factory(__ngFactoryType__) {
      return (\u0275MatListItemIcon_BaseFactory || (\u0275MatListItemIcon_BaseFactory = \u0275\u0275getInheritedFactory(_MatListItemIcon)))(__ngFactoryType__ || _MatListItemIcon);
    };
  })();
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _MatListItemIcon,
    selectors: [["", "matListItemIcon", ""]],
    hostAttrs: [1, "mat-mdc-list-item-icon"],
    features: [\u0275\u0275InheritDefinitionFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatListItemIcon, [{
    type: Directive,
    args: [{
      selector: "[matListItemIcon]",
      host: {
        "class": "mat-mdc-list-item-icon"
      }
    }]
  }], null, null);
})();
var MAT_LIST_CONFIG = new InjectionToken("MAT_LIST_CONFIG");
var MatListBase = class _MatListBase {
  _isNonInteractive = true;
  /** Whether ripples for all list items is disabled. */
  get disableRipple() {
    return this._disableRipple;
  }
  set disableRipple(value) {
    this._disableRipple = coerceBooleanProperty(value);
  }
  _disableRipple = false;
  /**
   * Whether the entire list is disabled. When disabled, the list itself and each of its list items
   * are disabled.
   */
  get disabled() {
    return this._disabled();
  }
  set disabled(value) {
    this._disabled.set(coerceBooleanProperty(value));
  }
  _disabled = signal(false);
  _defaultOptions = inject2(MAT_LIST_CONFIG, {
    optional: true
  });
  static \u0275fac = function MatListBase_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _MatListBase)();
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _MatListBase,
    hostVars: 1,
    hostBindings: function MatListBase_HostBindings(rf, ctx) {
      if (rf & 2) {
        \u0275\u0275attribute("aria-disabled", ctx.disabled);
      }
    },
    inputs: {
      disableRipple: "disableRipple",
      disabled: "disabled"
    }
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatListBase, [{
    type: Directive,
    args: [{
      host: {
        "[attr.aria-disabled]": "disabled"
      }
    }]
  }], null, {
    disableRipple: [{
      type: Input
    }],
    disabled: [{
      type: Input
    }]
  });
})();
var MatListItemBase = class _MatListItemBase {
  _elementRef = inject2(ElementRef);
  _ngZone = inject2(NgZone);
  _listBase = inject2(MatListBase, {
    optional: true
  });
  _platform = inject2(Platform);
  /** Host element for the list item. */
  _hostElement;
  /** indicate whether the host element is a button or not */
  _isButtonElement;
  /** Whether animations are disabled. */
  _noopAnimations = _animationsDisabled();
  _avatars;
  _icons;
  /**
   * The number of lines this list item should reserve space for. If not specified,
   * lines are inferred based on the projected content.
   *
   * Explicitly specifying the number of lines is useful if you want to acquire additional
   * space and enable the wrapping of text. The unscoped text content of a list item will
   * always be able to take up the remaining space of the item, unless it represents the title.
   *
   * A maximum of three lines is supported as per the Material Design specification.
   */
  set lines(lines) {
    this._explicitLines = coerceNumberProperty(lines, null);
    this._updateItemLines(false);
  }
  _explicitLines = null;
  /** Whether ripples for list items are disabled. */
  get disableRipple() {
    return this.disabled || this._disableRipple || this._noopAnimations || !!this._listBase?.disableRipple;
  }
  set disableRipple(value) {
    this._disableRipple = coerceBooleanProperty(value);
  }
  _disableRipple = false;
  /** Whether the list-item is disabled. */
  get disabled() {
    return this._disabled() || !!this._listBase?.disabled;
  }
  set disabled(value) {
    this._disabled.set(coerceBooleanProperty(value));
  }
  _disabled = signal(false);
  _subscriptions = new Subscription();
  _rippleRenderer = null;
  /** Whether the list item has unscoped text content. */
  _hasUnscopedTextContent = false;
  /**
   * Implemented as part of `RippleTarget`.
   * @docs-private
   */
  rippleConfig;
  /**
   * Implemented as part of `RippleTarget`.
   * @docs-private
   */
  get rippleDisabled() {
    return this.disableRipple || !!this.rippleConfig.disabled;
  }
  constructor() {
    inject2(_CdkPrivateStyleLoader).load(_StructuralStylesLoader);
    const globalRippleOptions = inject2(MAT_RIPPLE_GLOBAL_OPTIONS, {
      optional: true
    });
    this.rippleConfig = globalRippleOptions || {};
    this._hostElement = this._elementRef.nativeElement;
    this._isButtonElement = this._hostElement.nodeName.toLowerCase() === "button";
    if (this._listBase && !this._listBase._isNonInteractive) {
      this._initInteractiveListItem();
    }
    if (this._isButtonElement && !this._hostElement.hasAttribute("type")) {
      this._hostElement.setAttribute("type", "button");
    }
  }
  ngAfterViewInit() {
    this._monitorProjectedLinesAndTitle();
    this._updateItemLines(true);
  }
  ngOnDestroy() {
    this._subscriptions.unsubscribe();
    if (this._rippleRenderer !== null) {
      this._rippleRenderer._removeTriggerEvents();
    }
  }
  /** Whether the list item has icons or avatars. */
  _hasIconOrAvatar() {
    return !!(this._avatars.length || this._icons.length);
  }
  _initInteractiveListItem() {
    this._hostElement.classList.add("mat-mdc-list-item-interactive");
    this._rippleRenderer = new RippleRenderer(this, this._ngZone, this._hostElement, this._platform, inject2(Injector));
    this._rippleRenderer.setupTriggerEvents(this._hostElement);
  }
  /**
   * Subscribes to changes in the projected title and lines. Triggers a
   * item lines update whenever a change occurs.
   */
  _monitorProjectedLinesAndTitle() {
    this._ngZone.runOutsideAngular(() => {
      this._subscriptions.add(merge(this._lines.changes, this._titles.changes).subscribe(() => this._updateItemLines(false)));
    });
  }
  /**
   * Updates the lines of the list item. Based on the projected user content and optional
   * explicit lines setting, the visual appearance of the list item is determined.
   *
   * This method should be invoked whenever the projected user content changes, or
   * when the explicit lines have been updated.
   *
   * @param recheckUnscopedContent Whether the projected unscoped content should be re-checked.
   *   The unscoped content is not re-checked for every update as it is a rather expensive check
   *   for content that is expected to not change very often.
   */
  _updateItemLines(recheckUnscopedContent) {
    if (!this._lines || !this._titles || !this._unscopedContent) {
      return;
    }
    if (recheckUnscopedContent) {
      this._checkDomForUnscopedTextContent();
    }
    if (typeof ngDevMode === "undefined" || ngDevMode) {
      sanityCheckListItemContent(this);
    }
    const numberOfLines = this._explicitLines ?? this._inferLinesFromContent();
    const unscopedContentEl = this._unscopedContent.nativeElement;
    this._hostElement.classList.toggle("mat-mdc-list-item-single-line", numberOfLines <= 1);
    this._hostElement.classList.toggle("mdc-list-item--with-one-line", numberOfLines <= 1);
    this._hostElement.classList.toggle("mdc-list-item--with-two-lines", numberOfLines === 2);
    this._hostElement.classList.toggle("mdc-list-item--with-three-lines", numberOfLines === 3);
    if (this._hasUnscopedTextContent) {
      const treatAsTitle = this._titles.length === 0 && numberOfLines === 1;
      unscopedContentEl.classList.toggle("mdc-list-item__primary-text", treatAsTitle);
      unscopedContentEl.classList.toggle("mdc-list-item__secondary-text", !treatAsTitle);
    } else {
      unscopedContentEl.classList.remove("mdc-list-item__primary-text");
      unscopedContentEl.classList.remove("mdc-list-item__secondary-text");
    }
  }
  /**
   * Infers the number of lines based on the projected user content. This is useful
   * if no explicit number of lines has been specified on the list item.
   *
   * The number of lines is inferred based on whether there is a title, the number of
   * additional lines (secondary/tertiary). An additional line is acquired if there is
   * unscoped text content.
   */
  _inferLinesFromContent() {
    let numOfLines = this._titles.length + this._lines.length;
    if (this._hasUnscopedTextContent) {
      numOfLines += 1;
    }
    return numOfLines;
  }
  /** Checks whether the list item has unscoped text content. */
  _checkDomForUnscopedTextContent() {
    this._hasUnscopedTextContent = Array.from(this._unscopedContent.nativeElement.childNodes).filter((node) => node.nodeType !== node.COMMENT_NODE).some((node) => !!(node.textContent && node.textContent.trim()));
  }
  static \u0275fac = function MatListItemBase_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _MatListItemBase)();
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _MatListItemBase,
    contentQueries: function MatListItemBase_ContentQueries(rf, ctx, dirIndex) {
      if (rf & 1) {
        \u0275\u0275contentQuery(dirIndex, MatListItemAvatar, 4);
        \u0275\u0275contentQuery(dirIndex, MatListItemIcon, 4);
      }
      if (rf & 2) {
        let _t;
        \u0275\u0275queryRefresh(_t = \u0275\u0275loadQuery()) && (ctx._avatars = _t);
        \u0275\u0275queryRefresh(_t = \u0275\u0275loadQuery()) && (ctx._icons = _t);
      }
    },
    hostVars: 4,
    hostBindings: function MatListItemBase_HostBindings(rf, ctx) {
      if (rf & 2) {
        \u0275\u0275attribute("aria-disabled", ctx.disabled)("disabled", ctx._isButtonElement && ctx.disabled || null);
        \u0275\u0275classProp("mdc-list-item--disabled", ctx.disabled);
      }
    },
    inputs: {
      lines: "lines",
      disableRipple: "disableRipple",
      disabled: "disabled"
    }
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatListItemBase, [{
    type: Directive,
    args: [{
      host: {
        "[class.mdc-list-item--disabled]": "disabled",
        "[attr.aria-disabled]": "disabled",
        "[attr.disabled]": "(_isButtonElement && disabled) || null"
      }
    }]
  }], () => [], {
    _avatars: [{
      type: ContentChildren,
      args: [MatListItemAvatar, {
        descendants: false
      }]
    }],
    _icons: [{
      type: ContentChildren,
      args: [MatListItemIcon, {
        descendants: false
      }]
    }],
    lines: [{
      type: Input
    }],
    disableRipple: [{
      type: Input
    }],
    disabled: [{
      type: Input
    }]
  });
})();
function sanityCheckListItemContent(item) {
  const numTitles = item._titles.length;
  const numLines = item._lines.length;
  if (numTitles > 1) {
    console.warn("A list item cannot have multiple titles.");
  }
  if (numTitles === 0 && numLines > 0) {
    console.warn("A list item line can only be used if there is a list item title.");
  }
  if (numTitles === 0 && item._hasUnscopedTextContent && item._explicitLines !== null && item._explicitLines > 1) {
    console.warn("A list item cannot have wrapping content without a title.");
  }
  if (numLines > 2 || numLines === 2 && item._hasUnscopedTextContent) {
    console.warn("A list item can have at maximum three lines.");
  }
}
var MatActionList = class _MatActionList extends MatListBase {
  // An navigation list is considered interactive, but does not extend the interactive list
  // base class. We do this because as per MDC, items of interactive lists are only reachable
  // through keyboard shortcuts. We want all items for the navigation list to be reachable
  // through tab key as we do not intend to provide any special accessibility treatment. The
  // accessibility treatment depends on how the end-user will interact with it.
  _isNonInteractive = false;
  static \u0275fac = /* @__PURE__ */ (() => {
    let \u0275MatActionList_BaseFactory;
    return function MatActionList_Factory(__ngFactoryType__) {
      return (\u0275MatActionList_BaseFactory || (\u0275MatActionList_BaseFactory = \u0275\u0275getInheritedFactory(_MatActionList)))(__ngFactoryType__ || _MatActionList);
    };
  })();
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({
    type: _MatActionList,
    selectors: [["mat-action-list"]],
    hostAttrs: ["role", "group", 1, "mat-mdc-action-list", "mat-mdc-list-base", "mdc-list"],
    exportAs: ["matActionList"],
    features: [\u0275\u0275ProvidersFeature([{
      provide: MatListBase,
      useExisting: _MatActionList
    }]), \u0275\u0275InheritDefinitionFeature],
    ngContentSelectors: _c0,
    decls: 1,
    vars: 0,
    template: function MatActionList_Template(rf, ctx) {
      if (rf & 1) {
        \u0275\u0275projectionDef();
        \u0275\u0275projection(0);
      }
    },
    styles: ['.mdc-list{margin:0;padding:8px 0;list-style-type:none}.mdc-list:focus{outline:none}.mdc-list-item{display:flex;position:relative;justify-content:flex-start;overflow:hidden;padding:0;align-items:stretch;cursor:pointer;padding-left:16px;padding-right:16px;background-color:var(--mat-list-list-item-container-color, transparent);border-radius:var(--mat-list-list-item-container-shape, var(--mat-sys-corner-none))}.mdc-list-item.mdc-list-item--selected{background-color:var(--mat-list-list-item-selected-container-color)}.mdc-list-item:focus{outline:0}.mdc-list-item.mdc-list-item--disabled{cursor:auto}.mdc-list-item.mdc-list-item--with-one-line{height:var(--mat-list-list-item-one-line-container-height, 48px)}.mdc-list-item.mdc-list-item--with-one-line .mdc-list-item__start{align-self:center;margin-top:0}.mdc-list-item.mdc-list-item--with-one-line .mdc-list-item__end{align-self:center;margin-top:0}.mdc-list-item.mdc-list-item--with-two-lines{height:var(--mat-list-list-item-two-line-container-height, 64px)}.mdc-list-item.mdc-list-item--with-two-lines .mdc-list-item__start{align-self:flex-start;margin-top:16px}.mdc-list-item.mdc-list-item--with-two-lines .mdc-list-item__end{align-self:center;margin-top:0}.mdc-list-item.mdc-list-item--with-three-lines{height:var(--mat-list-list-item-three-line-container-height, 88px)}.mdc-list-item.mdc-list-item--with-three-lines .mdc-list-item__start{align-self:flex-start;margin-top:16px}.mdc-list-item.mdc-list-item--with-three-lines .mdc-list-item__end{align-self:flex-start;margin-top:16px}.mdc-list-item.mdc-list-item--selected::before,.mdc-list-item.mdc-list-item--selected:focus::before,.mdc-list-item:not(.mdc-list-item--selected):focus::before{position:absolute;box-sizing:border-box;width:100%;height:100%;top:0;left:0;content:"";pointer-events:none}a.mdc-list-item{color:inherit;text-decoration:none}.mdc-list-item__start{fill:currentColor;flex-shrink:0;pointer-events:none}.mdc-list-item--with-leading-icon .mdc-list-item__start{color:var(--mat-list-list-item-leading-icon-color, var(--mat-sys-on-surface-variant));width:var(--mat-list-list-item-leading-icon-size, 24px);height:var(--mat-list-list-item-leading-icon-size, 24px);margin-left:16px;margin-right:32px}[dir=rtl] .mdc-list-item--with-leading-icon .mdc-list-item__start{margin-left:32px;margin-right:16px}.mdc-list-item--with-leading-icon:hover .mdc-list-item__start{color:var(--mat-list-list-item-hover-leading-icon-color)}.mdc-list-item--with-leading-avatar .mdc-list-item__start{width:var(--mat-list-list-item-leading-avatar-size, 40px);height:var(--mat-list-list-item-leading-avatar-size, 40px);margin-left:16px;margin-right:16px;border-radius:50%}.mdc-list-item--with-leading-avatar .mdc-list-item__start,[dir=rtl] .mdc-list-item--with-leading-avatar .mdc-list-item__start{margin-left:16px;margin-right:16px;border-radius:50%}.mdc-list-item__end{flex-shrink:0;pointer-events:none}.mdc-list-item--with-trailing-meta .mdc-list-item__end{font-family:var(--mat-list-list-item-trailing-supporting-text-font, var(--mat-sys-label-small-font));line-height:var(--mat-list-list-item-trailing-supporting-text-line-height, var(--mat-sys-label-small-line-height));font-size:var(--mat-list-list-item-trailing-supporting-text-size, var(--mat-sys-label-small-size));font-weight:var(--mat-list-list-item-trailing-supporting-text-weight, var(--mat-sys-label-small-weight));letter-spacing:var(--mat-list-list-item-trailing-supporting-text-tracking, var(--mat-sys-label-small-tracking))}.mdc-list-item--with-trailing-icon .mdc-list-item__end{color:var(--mat-list-list-item-trailing-icon-color, var(--mat-sys-on-surface-variant));width:var(--mat-list-list-item-trailing-icon-size, 24px);height:var(--mat-list-list-item-trailing-icon-size, 24px)}.mdc-list-item--with-trailing-icon:hover .mdc-list-item__end{color:var(--mat-list-list-item-hover-trailing-icon-color)}.mdc-list-item.mdc-list-item--with-trailing-meta .mdc-list-item__end{color:var(--mat-list-list-item-trailing-supporting-text-color, var(--mat-sys-on-surface-variant))}.mdc-list-item--selected.mdc-list-item--with-trailing-icon .mdc-list-item__end{color:var(--mat-list-list-item-selected-trailing-icon-color, var(--mat-sys-primary))}.mdc-list-item__content{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;align-self:center;flex:1;pointer-events:none}.mdc-list-item--with-two-lines .mdc-list-item__content,.mdc-list-item--with-three-lines .mdc-list-item__content{align-self:stretch}.mdc-list-item__primary-text{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;color:var(--mat-list-list-item-label-text-color, var(--mat-sys-on-surface));font-family:var(--mat-list-list-item-label-text-font, var(--mat-sys-body-large-font));line-height:var(--mat-list-list-item-label-text-line-height, var(--mat-sys-body-large-line-height));font-size:var(--mat-list-list-item-label-text-size, var(--mat-sys-body-large-size));font-weight:var(--mat-list-list-item-label-text-weight, var(--mat-sys-body-large-weight));letter-spacing:var(--mat-list-list-item-label-text-tracking, var(--mat-sys-body-large-tracking))}.mdc-list-item:hover .mdc-list-item__primary-text{color:var(--mat-list-list-item-hover-label-text-color, var(--mat-sys-on-surface))}.mdc-list-item:focus .mdc-list-item__primary-text{color:var(--mat-list-list-item-focus-label-text-color, var(--mat-sys-on-surface))}.mdc-list-item--with-two-lines .mdc-list-item__primary-text,.mdc-list-item--with-three-lines .mdc-list-item__primary-text{display:block;margin-top:0;line-height:normal;margin-bottom:-20px}.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before,.mdc-list-item--with-three-lines .mdc-list-item__primary-text::before{display:inline-block;width:0;height:28px;content:"";vertical-align:0}.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after,.mdc-list-item--with-three-lines .mdc-list-item__primary-text::after{display:inline-block;width:0;height:20px;content:"";vertical-align:-20px}.mdc-list-item__secondary-text{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:block;margin-top:0;color:var(--mat-list-list-item-supporting-text-color, var(--mat-sys-on-surface-variant));font-family:var(--mat-list-list-item-supporting-text-font, var(--mat-sys-body-medium-font));line-height:var(--mat-list-list-item-supporting-text-line-height, var(--mat-sys-body-medium-line-height));font-size:var(--mat-list-list-item-supporting-text-size, var(--mat-sys-body-medium-size));font-weight:var(--mat-list-list-item-supporting-text-weight, var(--mat-sys-body-medium-weight));letter-spacing:var(--mat-list-list-item-supporting-text-tracking, var(--mat-sys-body-medium-tracking))}.mdc-list-item__secondary-text::before{display:inline-block;width:0;height:20px;content:"";vertical-align:0}.mdc-list-item--with-three-lines .mdc-list-item__secondary-text{white-space:normal;line-height:20px}.mdc-list-item--with-overline .mdc-list-item__secondary-text{white-space:nowrap;line-height:auto}.mdc-list-item--with-leading-radio.mdc-list-item,.mdc-list-item--with-leading-checkbox.mdc-list-item,.mdc-list-item--with-leading-icon.mdc-list-item,.mdc-list-item--with-leading-avatar.mdc-list-item{padding-left:0;padding-right:16px}[dir=rtl] .mdc-list-item--with-leading-radio.mdc-list-item,[dir=rtl] .mdc-list-item--with-leading-checkbox.mdc-list-item,[dir=rtl] .mdc-list-item--with-leading-icon.mdc-list-item,[dir=rtl] .mdc-list-item--with-leading-avatar.mdc-list-item{padding-left:16px;padding-right:0}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines .mdc-list-item__primary-text,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines .mdc-list-item__primary-text,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines .mdc-list-item__primary-text,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines .mdc-list-item__primary-text{display:block;margin-top:0;line-height:normal;margin-bottom:-20px}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before{display:inline-block;width:0;height:32px;content:"";vertical-align:0}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after{display:inline-block;width:0;height:20px;content:"";vertical-align:-20px}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end{display:block;margin-top:0;line-height:normal}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end::before,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end::before,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end::before,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end::before{display:inline-block;width:0;height:32px;content:"";vertical-align:0}.mdc-list-item--with-trailing-icon.mdc-list-item,[dir=rtl] .mdc-list-item--with-trailing-icon.mdc-list-item{padding-left:0;padding-right:0}.mdc-list-item--with-trailing-icon .mdc-list-item__end{margin-left:16px;margin-right:16px}.mdc-list-item--with-trailing-meta.mdc-list-item{padding-left:16px;padding-right:0}[dir=rtl] .mdc-list-item--with-trailing-meta.mdc-list-item{padding-left:0;padding-right:16px}.mdc-list-item--with-trailing-meta .mdc-list-item__end{-webkit-user-select:none;user-select:none;margin-left:28px;margin-right:16px}[dir=rtl] .mdc-list-item--with-trailing-meta .mdc-list-item__end{margin-left:16px;margin-right:28px}.mdc-list-item--with-trailing-meta.mdc-list-item--with-three-lines .mdc-list-item__end,.mdc-list-item--with-trailing-meta.mdc-list-item--with-two-lines .mdc-list-item__end{display:block;line-height:normal;align-self:flex-start;margin-top:0}.mdc-list-item--with-trailing-meta.mdc-list-item--with-three-lines .mdc-list-item__end::before,.mdc-list-item--with-trailing-meta.mdc-list-item--with-two-lines .mdc-list-item__end::before{display:inline-block;width:0;height:28px;content:"";vertical-align:0}.mdc-list-item--with-leading-radio .mdc-list-item__start,.mdc-list-item--with-leading-checkbox .mdc-list-item__start{margin-left:8px;margin-right:24px}[dir=rtl] .mdc-list-item--with-leading-radio .mdc-list-item__start,[dir=rtl] .mdc-list-item--with-leading-checkbox .mdc-list-item__start{margin-left:24px;margin-right:8px}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines .mdc-list-item__start,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines .mdc-list-item__start{align-self:flex-start;margin-top:8px}.mdc-list-item--with-trailing-radio.mdc-list-item,.mdc-list-item--with-trailing-checkbox.mdc-list-item{padding-left:16px;padding-right:0}[dir=rtl] .mdc-list-item--with-trailing-radio.mdc-list-item,[dir=rtl] .mdc-list-item--with-trailing-checkbox.mdc-list-item{padding-left:0;padding-right:16px}.mdc-list-item--with-trailing-radio.mdc-list-item--with-leading-icon,.mdc-list-item--with-trailing-radio.mdc-list-item--with-leading-avatar,.mdc-list-item--with-trailing-checkbox.mdc-list-item--with-leading-icon,.mdc-list-item--with-trailing-checkbox.mdc-list-item--with-leading-avatar{padding-left:0}[dir=rtl] .mdc-list-item--with-trailing-radio.mdc-list-item--with-leading-icon,[dir=rtl] .mdc-list-item--with-trailing-radio.mdc-list-item--with-leading-avatar,[dir=rtl] .mdc-list-item--with-trailing-checkbox.mdc-list-item--with-leading-icon,[dir=rtl] .mdc-list-item--with-trailing-checkbox.mdc-list-item--with-leading-avatar{padding-right:0}.mdc-list-item--with-trailing-radio .mdc-list-item__end,.mdc-list-item--with-trailing-checkbox .mdc-list-item__end{margin-left:24px;margin-right:8px}[dir=rtl] .mdc-list-item--with-trailing-radio .mdc-list-item__end,[dir=rtl] .mdc-list-item--with-trailing-checkbox .mdc-list-item__end{margin-left:8px;margin-right:24px}.mdc-list-item--with-trailing-radio.mdc-list-item--with-three-lines .mdc-list-item__end,.mdc-list-item--with-trailing-checkbox.mdc-list-item--with-three-lines .mdc-list-item__end{align-self:flex-start;margin-top:8px}.mdc-list-group__subheader{margin:.75rem 16px}.mdc-list-item--disabled .mdc-list-item__start,.mdc-list-item--disabled .mdc-list-item__content,.mdc-list-item--disabled .mdc-list-item__end{opacity:1}.mdc-list-item--disabled .mdc-list-item__primary-text,.mdc-list-item--disabled .mdc-list-item__secondary-text{opacity:var(--mat-list-list-item-disabled-label-text-opacity, 0.3)}.mdc-list-item--disabled.mdc-list-item--with-leading-icon .mdc-list-item__start{color:var(--mat-list-list-item-disabled-leading-icon-color, var(--mat-sys-on-surface));opacity:var(--mat-list-list-item-disabled-leading-icon-opacity, 0.38)}.mdc-list-item--disabled.mdc-list-item--with-trailing-icon .mdc-list-item__end{color:var(--mat-list-list-item-disabled-trailing-icon-color, var(--mat-sys-on-surface));opacity:var(--mat-list-list-item-disabled-trailing-icon-opacity, 0.38)}.mat-mdc-list-item.mat-mdc-list-item-both-leading-and-trailing,[dir=rtl] .mat-mdc-list-item.mat-mdc-list-item-both-leading-and-trailing{padding-left:0;padding-right:0}.mdc-list-item.mdc-list-item--disabled .mdc-list-item__primary-text{color:var(--mat-list-list-item-disabled-label-text-color, var(--mat-sys-on-surface))}.mdc-list-item:hover::before{background-color:var(--mat-list-list-item-hover-state-layer-color, var(--mat-sys-on-surface));opacity:var(--mat-list-list-item-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity))}.mdc-list-item.mdc-list-item--disabled::before{background-color:var(--mat-list-list-item-disabled-state-layer-color, var(--mat-sys-on-surface));opacity:var(--mat-list-list-item-disabled-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}.mdc-list-item:focus::before{background-color:var(--mat-list-list-item-focus-state-layer-color, var(--mat-sys-on-surface));opacity:var(--mat-list-list-item-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}.mdc-list-item--disabled .mdc-radio,.mdc-list-item--disabled .mdc-checkbox{opacity:var(--mat-list-list-item-disabled-label-text-opacity, 0.3)}.mdc-list-item--with-leading-avatar .mat-mdc-list-item-avatar{border-radius:var(--mat-list-list-item-leading-avatar-shape, var(--mat-sys-corner-full));background-color:var(--mat-list-list-item-leading-avatar-color, var(--mat-sys-primary-container))}.mat-mdc-list-item-icon{font-size:var(--mat-list-list-item-leading-icon-size, 24px)}@media(forced-colors: active){a.mdc-list-item--activated::after{content:"";position:absolute;top:50%;right:16px;transform:translateY(-50%);width:10px;height:0;border-bottom:solid 10px;border-radius:10px}a.mdc-list-item--activated [dir=rtl]::after{right:auto;left:16px}}.mat-mdc-list-base{display:block}.mat-mdc-list-base .mdc-list-item__start,.mat-mdc-list-base .mdc-list-item__end,.mat-mdc-list-base .mdc-list-item__content{pointer-events:auto}.mat-mdc-list-item,.mat-mdc-list-option{width:100%;box-sizing:border-box;-webkit-tap-highlight-color:rgba(0,0,0,0)}.mat-mdc-list-item:not(.mat-mdc-list-item-interactive),.mat-mdc-list-option:not(.mat-mdc-list-item-interactive){cursor:default}.mat-mdc-list-item .mat-divider-inset,.mat-mdc-list-option .mat-divider-inset{position:absolute;left:0;right:0;bottom:0}.mat-mdc-list-item .mat-mdc-list-item-avatar~.mat-divider-inset,.mat-mdc-list-option .mat-mdc-list-item-avatar~.mat-divider-inset{margin-left:72px}[dir=rtl] .mat-mdc-list-item .mat-mdc-list-item-avatar~.mat-divider-inset,[dir=rtl] .mat-mdc-list-option .mat-mdc-list-item-avatar~.mat-divider-inset{margin-right:72px}.mat-mdc-list-item-interactive::before{top:0;left:0;right:0;bottom:0;position:absolute;content:"";opacity:0;pointer-events:none;border-radius:inherit}.mat-mdc-list-item>.mat-focus-indicator{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}.mat-mdc-list-item:focus>.mat-focus-indicator::before{content:""}.mat-mdc-list-item.mdc-list-item--with-three-lines .mat-mdc-list-item-line.mdc-list-item__secondary-text{white-space:nowrap;line-height:normal}.mat-mdc-list-item.mdc-list-item--with-three-lines .mat-mdc-list-item-unscoped-content.mdc-list-item__secondary-text{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}mat-action-list button{background:none;color:inherit;border:none;font:inherit;outline:inherit;-webkit-tap-highlight-color:rgba(0,0,0,0);text-align:start}mat-action-list button::-moz-focus-inner{border:0}.mdc-list-item--with-leading-icon .mdc-list-item__start{margin-inline-start:var(--mat-list-list-item-leading-icon-start-space, 16px);margin-inline-end:var(--mat-list-list-item-leading-icon-end-space, 16px)}.mat-mdc-nav-list .mat-mdc-list-item{border-radius:var(--mat-list-active-indicator-shape, var(--mat-sys-corner-full));--mat-focus-indicator-border-radius: var(--mat-list-active-indicator-shape, var(--mat-sys-corner-full))}.mat-mdc-nav-list .mat-mdc-list-item.mdc-list-item--activated{background-color:var(--mat-list-active-indicator-color, var(--mat-sys-secondary-container))}\n'],
    encapsulation: 2,
    changeDetection: 0
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatActionList, [{
    type: Component,
    args: [{
      selector: "mat-action-list",
      exportAs: "matActionList",
      template: "<ng-content></ng-content>",
      host: {
        "class": "mat-mdc-action-list mat-mdc-list-base mdc-list",
        "role": "group"
      },
      encapsulation: ViewEncapsulation.None,
      changeDetection: ChangeDetectionStrategy.OnPush,
      providers: [{
        provide: MatListBase,
        useExisting: MatActionList
      }],
      styles: ['.mdc-list{margin:0;padding:8px 0;list-style-type:none}.mdc-list:focus{outline:none}.mdc-list-item{display:flex;position:relative;justify-content:flex-start;overflow:hidden;padding:0;align-items:stretch;cursor:pointer;padding-left:16px;padding-right:16px;background-color:var(--mat-list-list-item-container-color, transparent);border-radius:var(--mat-list-list-item-container-shape, var(--mat-sys-corner-none))}.mdc-list-item.mdc-list-item--selected{background-color:var(--mat-list-list-item-selected-container-color)}.mdc-list-item:focus{outline:0}.mdc-list-item.mdc-list-item--disabled{cursor:auto}.mdc-list-item.mdc-list-item--with-one-line{height:var(--mat-list-list-item-one-line-container-height, 48px)}.mdc-list-item.mdc-list-item--with-one-line .mdc-list-item__start{align-self:center;margin-top:0}.mdc-list-item.mdc-list-item--with-one-line .mdc-list-item__end{align-self:center;margin-top:0}.mdc-list-item.mdc-list-item--with-two-lines{height:var(--mat-list-list-item-two-line-container-height, 64px)}.mdc-list-item.mdc-list-item--with-two-lines .mdc-list-item__start{align-self:flex-start;margin-top:16px}.mdc-list-item.mdc-list-item--with-two-lines .mdc-list-item__end{align-self:center;margin-top:0}.mdc-list-item.mdc-list-item--with-three-lines{height:var(--mat-list-list-item-three-line-container-height, 88px)}.mdc-list-item.mdc-list-item--with-three-lines .mdc-list-item__start{align-self:flex-start;margin-top:16px}.mdc-list-item.mdc-list-item--with-three-lines .mdc-list-item__end{align-self:flex-start;margin-top:16px}.mdc-list-item.mdc-list-item--selected::before,.mdc-list-item.mdc-list-item--selected:focus::before,.mdc-list-item:not(.mdc-list-item--selected):focus::before{position:absolute;box-sizing:border-box;width:100%;height:100%;top:0;left:0;content:"";pointer-events:none}a.mdc-list-item{color:inherit;text-decoration:none}.mdc-list-item__start{fill:currentColor;flex-shrink:0;pointer-events:none}.mdc-list-item--with-leading-icon .mdc-list-item__start{color:var(--mat-list-list-item-leading-icon-color, var(--mat-sys-on-surface-variant));width:var(--mat-list-list-item-leading-icon-size, 24px);height:var(--mat-list-list-item-leading-icon-size, 24px);margin-left:16px;margin-right:32px}[dir=rtl] .mdc-list-item--with-leading-icon .mdc-list-item__start{margin-left:32px;margin-right:16px}.mdc-list-item--with-leading-icon:hover .mdc-list-item__start{color:var(--mat-list-list-item-hover-leading-icon-color)}.mdc-list-item--with-leading-avatar .mdc-list-item__start{width:var(--mat-list-list-item-leading-avatar-size, 40px);height:var(--mat-list-list-item-leading-avatar-size, 40px);margin-left:16px;margin-right:16px;border-radius:50%}.mdc-list-item--with-leading-avatar .mdc-list-item__start,[dir=rtl] .mdc-list-item--with-leading-avatar .mdc-list-item__start{margin-left:16px;margin-right:16px;border-radius:50%}.mdc-list-item__end{flex-shrink:0;pointer-events:none}.mdc-list-item--with-trailing-meta .mdc-list-item__end{font-family:var(--mat-list-list-item-trailing-supporting-text-font, var(--mat-sys-label-small-font));line-height:var(--mat-list-list-item-trailing-supporting-text-line-height, var(--mat-sys-label-small-line-height));font-size:var(--mat-list-list-item-trailing-supporting-text-size, var(--mat-sys-label-small-size));font-weight:var(--mat-list-list-item-trailing-supporting-text-weight, var(--mat-sys-label-small-weight));letter-spacing:var(--mat-list-list-item-trailing-supporting-text-tracking, var(--mat-sys-label-small-tracking))}.mdc-list-item--with-trailing-icon .mdc-list-item__end{color:var(--mat-list-list-item-trailing-icon-color, var(--mat-sys-on-surface-variant));width:var(--mat-list-list-item-trailing-icon-size, 24px);height:var(--mat-list-list-item-trailing-icon-size, 24px)}.mdc-list-item--with-trailing-icon:hover .mdc-list-item__end{color:var(--mat-list-list-item-hover-trailing-icon-color)}.mdc-list-item.mdc-list-item--with-trailing-meta .mdc-list-item__end{color:var(--mat-list-list-item-trailing-supporting-text-color, var(--mat-sys-on-surface-variant))}.mdc-list-item--selected.mdc-list-item--with-trailing-icon .mdc-list-item__end{color:var(--mat-list-list-item-selected-trailing-icon-color, var(--mat-sys-primary))}.mdc-list-item__content{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;align-self:center;flex:1;pointer-events:none}.mdc-list-item--with-two-lines .mdc-list-item__content,.mdc-list-item--with-three-lines .mdc-list-item__content{align-self:stretch}.mdc-list-item__primary-text{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;color:var(--mat-list-list-item-label-text-color, var(--mat-sys-on-surface));font-family:var(--mat-list-list-item-label-text-font, var(--mat-sys-body-large-font));line-height:var(--mat-list-list-item-label-text-line-height, var(--mat-sys-body-large-line-height));font-size:var(--mat-list-list-item-label-text-size, var(--mat-sys-body-large-size));font-weight:var(--mat-list-list-item-label-text-weight, var(--mat-sys-body-large-weight));letter-spacing:var(--mat-list-list-item-label-text-tracking, var(--mat-sys-body-large-tracking))}.mdc-list-item:hover .mdc-list-item__primary-text{color:var(--mat-list-list-item-hover-label-text-color, var(--mat-sys-on-surface))}.mdc-list-item:focus .mdc-list-item__primary-text{color:var(--mat-list-list-item-focus-label-text-color, var(--mat-sys-on-surface))}.mdc-list-item--with-two-lines .mdc-list-item__primary-text,.mdc-list-item--with-three-lines .mdc-list-item__primary-text{display:block;margin-top:0;line-height:normal;margin-bottom:-20px}.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before,.mdc-list-item--with-three-lines .mdc-list-item__primary-text::before{display:inline-block;width:0;height:28px;content:"";vertical-align:0}.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after,.mdc-list-item--with-three-lines .mdc-list-item__primary-text::after{display:inline-block;width:0;height:20px;content:"";vertical-align:-20px}.mdc-list-item__secondary-text{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:block;margin-top:0;color:var(--mat-list-list-item-supporting-text-color, var(--mat-sys-on-surface-variant));font-family:var(--mat-list-list-item-supporting-text-font, var(--mat-sys-body-medium-font));line-height:var(--mat-list-list-item-supporting-text-line-height, var(--mat-sys-body-medium-line-height));font-size:var(--mat-list-list-item-supporting-text-size, var(--mat-sys-body-medium-size));font-weight:var(--mat-list-list-item-supporting-text-weight, var(--mat-sys-body-medium-weight));letter-spacing:var(--mat-list-list-item-supporting-text-tracking, var(--mat-sys-body-medium-tracking))}.mdc-list-item__secondary-text::before{display:inline-block;width:0;height:20px;content:"";vertical-align:0}.mdc-list-item--with-three-lines .mdc-list-item__secondary-text{white-space:normal;line-height:20px}.mdc-list-item--with-overline .mdc-list-item__secondary-text{white-space:nowrap;line-height:auto}.mdc-list-item--with-leading-radio.mdc-list-item,.mdc-list-item--with-leading-checkbox.mdc-list-item,.mdc-list-item--with-leading-icon.mdc-list-item,.mdc-list-item--with-leading-avatar.mdc-list-item{padding-left:0;padding-right:16px}[dir=rtl] .mdc-list-item--with-leading-radio.mdc-list-item,[dir=rtl] .mdc-list-item--with-leading-checkbox.mdc-list-item,[dir=rtl] .mdc-list-item--with-leading-icon.mdc-list-item,[dir=rtl] .mdc-list-item--with-leading-avatar.mdc-list-item{padding-left:16px;padding-right:0}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines .mdc-list-item__primary-text,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines .mdc-list-item__primary-text,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines .mdc-list-item__primary-text,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines .mdc-list-item__primary-text{display:block;margin-top:0;line-height:normal;margin-bottom:-20px}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before{display:inline-block;width:0;height:32px;content:"";vertical-align:0}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after{display:inline-block;width:0;height:20px;content:"";vertical-align:-20px}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end{display:block;margin-top:0;line-height:normal}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end::before,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end::before,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end::before,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end::before{display:inline-block;width:0;height:32px;content:"";vertical-align:0}.mdc-list-item--with-trailing-icon.mdc-list-item,[dir=rtl] .mdc-list-item--with-trailing-icon.mdc-list-item{padding-left:0;padding-right:0}.mdc-list-item--with-trailing-icon .mdc-list-item__end{margin-left:16px;margin-right:16px}.mdc-list-item--with-trailing-meta.mdc-list-item{padding-left:16px;padding-right:0}[dir=rtl] .mdc-list-item--with-trailing-meta.mdc-list-item{padding-left:0;padding-right:16px}.mdc-list-item--with-trailing-meta .mdc-list-item__end{-webkit-user-select:none;user-select:none;margin-left:28px;margin-right:16px}[dir=rtl] .mdc-list-item--with-trailing-meta .mdc-list-item__end{margin-left:16px;margin-right:28px}.mdc-list-item--with-trailing-meta.mdc-list-item--with-three-lines .mdc-list-item__end,.mdc-list-item--with-trailing-meta.mdc-list-item--with-two-lines .mdc-list-item__end{display:block;line-height:normal;align-self:flex-start;margin-top:0}.mdc-list-item--with-trailing-meta.mdc-list-item--with-three-lines .mdc-list-item__end::before,.mdc-list-item--with-trailing-meta.mdc-list-item--with-two-lines .mdc-list-item__end::before{display:inline-block;width:0;height:28px;content:"";vertical-align:0}.mdc-list-item--with-leading-radio .mdc-list-item__start,.mdc-list-item--with-leading-checkbox .mdc-list-item__start{margin-left:8px;margin-right:24px}[dir=rtl] .mdc-list-item--with-leading-radio .mdc-list-item__start,[dir=rtl] .mdc-list-item--with-leading-checkbox .mdc-list-item__start{margin-left:24px;margin-right:8px}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines .mdc-list-item__start,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines .mdc-list-item__start{align-self:flex-start;margin-top:8px}.mdc-list-item--with-trailing-radio.mdc-list-item,.mdc-list-item--with-trailing-checkbox.mdc-list-item{padding-left:16px;padding-right:0}[dir=rtl] .mdc-list-item--with-trailing-radio.mdc-list-item,[dir=rtl] .mdc-list-item--with-trailing-checkbox.mdc-list-item{padding-left:0;padding-right:16px}.mdc-list-item--with-trailing-radio.mdc-list-item--with-leading-icon,.mdc-list-item--with-trailing-radio.mdc-list-item--with-leading-avatar,.mdc-list-item--with-trailing-checkbox.mdc-list-item--with-leading-icon,.mdc-list-item--with-trailing-checkbox.mdc-list-item--with-leading-avatar{padding-left:0}[dir=rtl] .mdc-list-item--with-trailing-radio.mdc-list-item--with-leading-icon,[dir=rtl] .mdc-list-item--with-trailing-radio.mdc-list-item--with-leading-avatar,[dir=rtl] .mdc-list-item--with-trailing-checkbox.mdc-list-item--with-leading-icon,[dir=rtl] .mdc-list-item--with-trailing-checkbox.mdc-list-item--with-leading-avatar{padding-right:0}.mdc-list-item--with-trailing-radio .mdc-list-item__end,.mdc-list-item--with-trailing-checkbox .mdc-list-item__end{margin-left:24px;margin-right:8px}[dir=rtl] .mdc-list-item--with-trailing-radio .mdc-list-item__end,[dir=rtl] .mdc-list-item--with-trailing-checkbox .mdc-list-item__end{margin-left:8px;margin-right:24px}.mdc-list-item--with-trailing-radio.mdc-list-item--with-three-lines .mdc-list-item__end,.mdc-list-item--with-trailing-checkbox.mdc-list-item--with-three-lines .mdc-list-item__end{align-self:flex-start;margin-top:8px}.mdc-list-group__subheader{margin:.75rem 16px}.mdc-list-item--disabled .mdc-list-item__start,.mdc-list-item--disabled .mdc-list-item__content,.mdc-list-item--disabled .mdc-list-item__end{opacity:1}.mdc-list-item--disabled .mdc-list-item__primary-text,.mdc-list-item--disabled .mdc-list-item__secondary-text{opacity:var(--mat-list-list-item-disabled-label-text-opacity, 0.3)}.mdc-list-item--disabled.mdc-list-item--with-leading-icon .mdc-list-item__start{color:var(--mat-list-list-item-disabled-leading-icon-color, var(--mat-sys-on-surface));opacity:var(--mat-list-list-item-disabled-leading-icon-opacity, 0.38)}.mdc-list-item--disabled.mdc-list-item--with-trailing-icon .mdc-list-item__end{color:var(--mat-list-list-item-disabled-trailing-icon-color, var(--mat-sys-on-surface));opacity:var(--mat-list-list-item-disabled-trailing-icon-opacity, 0.38)}.mat-mdc-list-item.mat-mdc-list-item-both-leading-and-trailing,[dir=rtl] .mat-mdc-list-item.mat-mdc-list-item-both-leading-and-trailing{padding-left:0;padding-right:0}.mdc-list-item.mdc-list-item--disabled .mdc-list-item__primary-text{color:var(--mat-list-list-item-disabled-label-text-color, var(--mat-sys-on-surface))}.mdc-list-item:hover::before{background-color:var(--mat-list-list-item-hover-state-layer-color, var(--mat-sys-on-surface));opacity:var(--mat-list-list-item-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity))}.mdc-list-item.mdc-list-item--disabled::before{background-color:var(--mat-list-list-item-disabled-state-layer-color, var(--mat-sys-on-surface));opacity:var(--mat-list-list-item-disabled-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}.mdc-list-item:focus::before{background-color:var(--mat-list-list-item-focus-state-layer-color, var(--mat-sys-on-surface));opacity:var(--mat-list-list-item-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}.mdc-list-item--disabled .mdc-radio,.mdc-list-item--disabled .mdc-checkbox{opacity:var(--mat-list-list-item-disabled-label-text-opacity, 0.3)}.mdc-list-item--with-leading-avatar .mat-mdc-list-item-avatar{border-radius:var(--mat-list-list-item-leading-avatar-shape, var(--mat-sys-corner-full));background-color:var(--mat-list-list-item-leading-avatar-color, var(--mat-sys-primary-container))}.mat-mdc-list-item-icon{font-size:var(--mat-list-list-item-leading-icon-size, 24px)}@media(forced-colors: active){a.mdc-list-item--activated::after{content:"";position:absolute;top:50%;right:16px;transform:translateY(-50%);width:10px;height:0;border-bottom:solid 10px;border-radius:10px}a.mdc-list-item--activated [dir=rtl]::after{right:auto;left:16px}}.mat-mdc-list-base{display:block}.mat-mdc-list-base .mdc-list-item__start,.mat-mdc-list-base .mdc-list-item__end,.mat-mdc-list-base .mdc-list-item__content{pointer-events:auto}.mat-mdc-list-item,.mat-mdc-list-option{width:100%;box-sizing:border-box;-webkit-tap-highlight-color:rgba(0,0,0,0)}.mat-mdc-list-item:not(.mat-mdc-list-item-interactive),.mat-mdc-list-option:not(.mat-mdc-list-item-interactive){cursor:default}.mat-mdc-list-item .mat-divider-inset,.mat-mdc-list-option .mat-divider-inset{position:absolute;left:0;right:0;bottom:0}.mat-mdc-list-item .mat-mdc-list-item-avatar~.mat-divider-inset,.mat-mdc-list-option .mat-mdc-list-item-avatar~.mat-divider-inset{margin-left:72px}[dir=rtl] .mat-mdc-list-item .mat-mdc-list-item-avatar~.mat-divider-inset,[dir=rtl] .mat-mdc-list-option .mat-mdc-list-item-avatar~.mat-divider-inset{margin-right:72px}.mat-mdc-list-item-interactive::before{top:0;left:0;right:0;bottom:0;position:absolute;content:"";opacity:0;pointer-events:none;border-radius:inherit}.mat-mdc-list-item>.mat-focus-indicator{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}.mat-mdc-list-item:focus>.mat-focus-indicator::before{content:""}.mat-mdc-list-item.mdc-list-item--with-three-lines .mat-mdc-list-item-line.mdc-list-item__secondary-text{white-space:nowrap;line-height:normal}.mat-mdc-list-item.mdc-list-item--with-three-lines .mat-mdc-list-item-unscoped-content.mdc-list-item__secondary-text{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}mat-action-list button{background:none;color:inherit;border:none;font:inherit;outline:inherit;-webkit-tap-highlight-color:rgba(0,0,0,0);text-align:start}mat-action-list button::-moz-focus-inner{border:0}.mdc-list-item--with-leading-icon .mdc-list-item__start{margin-inline-start:var(--mat-list-list-item-leading-icon-start-space, 16px);margin-inline-end:var(--mat-list-list-item-leading-icon-end-space, 16px)}.mat-mdc-nav-list .mat-mdc-list-item{border-radius:var(--mat-list-active-indicator-shape, var(--mat-sys-corner-full));--mat-focus-indicator-border-radius: var(--mat-list-active-indicator-shape, var(--mat-sys-corner-full))}.mat-mdc-nav-list .mat-mdc-list-item.mdc-list-item--activated{background-color:var(--mat-list-active-indicator-color, var(--mat-sys-secondary-container))}\n']
    }]
  }], null, null);
})();
var MAT_LIST = new InjectionToken("MatList");
var MatList = class _MatList extends MatListBase {
  static \u0275fac = /* @__PURE__ */ (() => {
    let \u0275MatList_BaseFactory;
    return function MatList_Factory(__ngFactoryType__) {
      return (\u0275MatList_BaseFactory || (\u0275MatList_BaseFactory = \u0275\u0275getInheritedFactory(_MatList)))(__ngFactoryType__ || _MatList);
    };
  })();
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({
    type: _MatList,
    selectors: [["mat-list"]],
    hostAttrs: [1, "mat-mdc-list", "mat-mdc-list-base", "mdc-list"],
    exportAs: ["matList"],
    features: [\u0275\u0275ProvidersFeature([{
      provide: MatListBase,
      useExisting: _MatList
    }]), \u0275\u0275InheritDefinitionFeature],
    ngContentSelectors: _c0,
    decls: 1,
    vars: 0,
    template: function MatList_Template(rf, ctx) {
      if (rf & 1) {
        \u0275\u0275projectionDef();
        \u0275\u0275projection(0);
      }
    },
    styles: [_c1],
    encapsulation: 2,
    changeDetection: 0
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatList, [{
    type: Component,
    args: [{
      selector: "mat-list",
      exportAs: "matList",
      template: "<ng-content></ng-content>",
      host: {
        "class": "mat-mdc-list mat-mdc-list-base mdc-list"
      },
      encapsulation: ViewEncapsulation.None,
      changeDetection: ChangeDetectionStrategy.OnPush,
      providers: [{
        provide: MatListBase,
        useExisting: MatList
      }],
      styles: ['.mdc-list{margin:0;padding:8px 0;list-style-type:none}.mdc-list:focus{outline:none}.mdc-list-item{display:flex;position:relative;justify-content:flex-start;overflow:hidden;padding:0;align-items:stretch;cursor:pointer;padding-left:16px;padding-right:16px;background-color:var(--mat-list-list-item-container-color, transparent);border-radius:var(--mat-list-list-item-container-shape, var(--mat-sys-corner-none))}.mdc-list-item.mdc-list-item--selected{background-color:var(--mat-list-list-item-selected-container-color)}.mdc-list-item:focus{outline:0}.mdc-list-item.mdc-list-item--disabled{cursor:auto}.mdc-list-item.mdc-list-item--with-one-line{height:var(--mat-list-list-item-one-line-container-height, 48px)}.mdc-list-item.mdc-list-item--with-one-line .mdc-list-item__start{align-self:center;margin-top:0}.mdc-list-item.mdc-list-item--with-one-line .mdc-list-item__end{align-self:center;margin-top:0}.mdc-list-item.mdc-list-item--with-two-lines{height:var(--mat-list-list-item-two-line-container-height, 64px)}.mdc-list-item.mdc-list-item--with-two-lines .mdc-list-item__start{align-self:flex-start;margin-top:16px}.mdc-list-item.mdc-list-item--with-two-lines .mdc-list-item__end{align-self:center;margin-top:0}.mdc-list-item.mdc-list-item--with-three-lines{height:var(--mat-list-list-item-three-line-container-height, 88px)}.mdc-list-item.mdc-list-item--with-three-lines .mdc-list-item__start{align-self:flex-start;margin-top:16px}.mdc-list-item.mdc-list-item--with-three-lines .mdc-list-item__end{align-self:flex-start;margin-top:16px}.mdc-list-item.mdc-list-item--selected::before,.mdc-list-item.mdc-list-item--selected:focus::before,.mdc-list-item:not(.mdc-list-item--selected):focus::before{position:absolute;box-sizing:border-box;width:100%;height:100%;top:0;left:0;content:"";pointer-events:none}a.mdc-list-item{color:inherit;text-decoration:none}.mdc-list-item__start{fill:currentColor;flex-shrink:0;pointer-events:none}.mdc-list-item--with-leading-icon .mdc-list-item__start{color:var(--mat-list-list-item-leading-icon-color, var(--mat-sys-on-surface-variant));width:var(--mat-list-list-item-leading-icon-size, 24px);height:var(--mat-list-list-item-leading-icon-size, 24px);margin-left:16px;margin-right:32px}[dir=rtl] .mdc-list-item--with-leading-icon .mdc-list-item__start{margin-left:32px;margin-right:16px}.mdc-list-item--with-leading-icon:hover .mdc-list-item__start{color:var(--mat-list-list-item-hover-leading-icon-color)}.mdc-list-item--with-leading-avatar .mdc-list-item__start{width:var(--mat-list-list-item-leading-avatar-size, 40px);height:var(--mat-list-list-item-leading-avatar-size, 40px);margin-left:16px;margin-right:16px;border-radius:50%}.mdc-list-item--with-leading-avatar .mdc-list-item__start,[dir=rtl] .mdc-list-item--with-leading-avatar .mdc-list-item__start{margin-left:16px;margin-right:16px;border-radius:50%}.mdc-list-item__end{flex-shrink:0;pointer-events:none}.mdc-list-item--with-trailing-meta .mdc-list-item__end{font-family:var(--mat-list-list-item-trailing-supporting-text-font, var(--mat-sys-label-small-font));line-height:var(--mat-list-list-item-trailing-supporting-text-line-height, var(--mat-sys-label-small-line-height));font-size:var(--mat-list-list-item-trailing-supporting-text-size, var(--mat-sys-label-small-size));font-weight:var(--mat-list-list-item-trailing-supporting-text-weight, var(--mat-sys-label-small-weight));letter-spacing:var(--mat-list-list-item-trailing-supporting-text-tracking, var(--mat-sys-label-small-tracking))}.mdc-list-item--with-trailing-icon .mdc-list-item__end{color:var(--mat-list-list-item-trailing-icon-color, var(--mat-sys-on-surface-variant));width:var(--mat-list-list-item-trailing-icon-size, 24px);height:var(--mat-list-list-item-trailing-icon-size, 24px)}.mdc-list-item--with-trailing-icon:hover .mdc-list-item__end{color:var(--mat-list-list-item-hover-trailing-icon-color)}.mdc-list-item.mdc-list-item--with-trailing-meta .mdc-list-item__end{color:var(--mat-list-list-item-trailing-supporting-text-color, var(--mat-sys-on-surface-variant))}.mdc-list-item--selected.mdc-list-item--with-trailing-icon .mdc-list-item__end{color:var(--mat-list-list-item-selected-trailing-icon-color, var(--mat-sys-primary))}.mdc-list-item__content{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;align-self:center;flex:1;pointer-events:none}.mdc-list-item--with-two-lines .mdc-list-item__content,.mdc-list-item--with-three-lines .mdc-list-item__content{align-self:stretch}.mdc-list-item__primary-text{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;color:var(--mat-list-list-item-label-text-color, var(--mat-sys-on-surface));font-family:var(--mat-list-list-item-label-text-font, var(--mat-sys-body-large-font));line-height:var(--mat-list-list-item-label-text-line-height, var(--mat-sys-body-large-line-height));font-size:var(--mat-list-list-item-label-text-size, var(--mat-sys-body-large-size));font-weight:var(--mat-list-list-item-label-text-weight, var(--mat-sys-body-large-weight));letter-spacing:var(--mat-list-list-item-label-text-tracking, var(--mat-sys-body-large-tracking))}.mdc-list-item:hover .mdc-list-item__primary-text{color:var(--mat-list-list-item-hover-label-text-color, var(--mat-sys-on-surface))}.mdc-list-item:focus .mdc-list-item__primary-text{color:var(--mat-list-list-item-focus-label-text-color, var(--mat-sys-on-surface))}.mdc-list-item--with-two-lines .mdc-list-item__primary-text,.mdc-list-item--with-three-lines .mdc-list-item__primary-text{display:block;margin-top:0;line-height:normal;margin-bottom:-20px}.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before,.mdc-list-item--with-three-lines .mdc-list-item__primary-text::before{display:inline-block;width:0;height:28px;content:"";vertical-align:0}.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after,.mdc-list-item--with-three-lines .mdc-list-item__primary-text::after{display:inline-block;width:0;height:20px;content:"";vertical-align:-20px}.mdc-list-item__secondary-text{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:block;margin-top:0;color:var(--mat-list-list-item-supporting-text-color, var(--mat-sys-on-surface-variant));font-family:var(--mat-list-list-item-supporting-text-font, var(--mat-sys-body-medium-font));line-height:var(--mat-list-list-item-supporting-text-line-height, var(--mat-sys-body-medium-line-height));font-size:var(--mat-list-list-item-supporting-text-size, var(--mat-sys-body-medium-size));font-weight:var(--mat-list-list-item-supporting-text-weight, var(--mat-sys-body-medium-weight));letter-spacing:var(--mat-list-list-item-supporting-text-tracking, var(--mat-sys-body-medium-tracking))}.mdc-list-item__secondary-text::before{display:inline-block;width:0;height:20px;content:"";vertical-align:0}.mdc-list-item--with-three-lines .mdc-list-item__secondary-text{white-space:normal;line-height:20px}.mdc-list-item--with-overline .mdc-list-item__secondary-text{white-space:nowrap;line-height:auto}.mdc-list-item--with-leading-radio.mdc-list-item,.mdc-list-item--with-leading-checkbox.mdc-list-item,.mdc-list-item--with-leading-icon.mdc-list-item,.mdc-list-item--with-leading-avatar.mdc-list-item{padding-left:0;padding-right:16px}[dir=rtl] .mdc-list-item--with-leading-radio.mdc-list-item,[dir=rtl] .mdc-list-item--with-leading-checkbox.mdc-list-item,[dir=rtl] .mdc-list-item--with-leading-icon.mdc-list-item,[dir=rtl] .mdc-list-item--with-leading-avatar.mdc-list-item{padding-left:16px;padding-right:0}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines .mdc-list-item__primary-text,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines .mdc-list-item__primary-text,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines .mdc-list-item__primary-text,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines .mdc-list-item__primary-text{display:block;margin-top:0;line-height:normal;margin-bottom:-20px}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before{display:inline-block;width:0;height:32px;content:"";vertical-align:0}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after{display:inline-block;width:0;height:20px;content:"";vertical-align:-20px}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end{display:block;margin-top:0;line-height:normal}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end::before,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end::before,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end::before,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end::before{display:inline-block;width:0;height:32px;content:"";vertical-align:0}.mdc-list-item--with-trailing-icon.mdc-list-item,[dir=rtl] .mdc-list-item--with-trailing-icon.mdc-list-item{padding-left:0;padding-right:0}.mdc-list-item--with-trailing-icon .mdc-list-item__end{margin-left:16px;margin-right:16px}.mdc-list-item--with-trailing-meta.mdc-list-item{padding-left:16px;padding-right:0}[dir=rtl] .mdc-list-item--with-trailing-meta.mdc-list-item{padding-left:0;padding-right:16px}.mdc-list-item--with-trailing-meta .mdc-list-item__end{-webkit-user-select:none;user-select:none;margin-left:28px;margin-right:16px}[dir=rtl] .mdc-list-item--with-trailing-meta .mdc-list-item__end{margin-left:16px;margin-right:28px}.mdc-list-item--with-trailing-meta.mdc-list-item--with-three-lines .mdc-list-item__end,.mdc-list-item--with-trailing-meta.mdc-list-item--with-two-lines .mdc-list-item__end{display:block;line-height:normal;align-self:flex-start;margin-top:0}.mdc-list-item--with-trailing-meta.mdc-list-item--with-three-lines .mdc-list-item__end::before,.mdc-list-item--with-trailing-meta.mdc-list-item--with-two-lines .mdc-list-item__end::before{display:inline-block;width:0;height:28px;content:"";vertical-align:0}.mdc-list-item--with-leading-radio .mdc-list-item__start,.mdc-list-item--with-leading-checkbox .mdc-list-item__start{margin-left:8px;margin-right:24px}[dir=rtl] .mdc-list-item--with-leading-radio .mdc-list-item__start,[dir=rtl] .mdc-list-item--with-leading-checkbox .mdc-list-item__start{margin-left:24px;margin-right:8px}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines .mdc-list-item__start,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines .mdc-list-item__start{align-self:flex-start;margin-top:8px}.mdc-list-item--with-trailing-radio.mdc-list-item,.mdc-list-item--with-trailing-checkbox.mdc-list-item{padding-left:16px;padding-right:0}[dir=rtl] .mdc-list-item--with-trailing-radio.mdc-list-item,[dir=rtl] .mdc-list-item--with-trailing-checkbox.mdc-list-item{padding-left:0;padding-right:16px}.mdc-list-item--with-trailing-radio.mdc-list-item--with-leading-icon,.mdc-list-item--with-trailing-radio.mdc-list-item--with-leading-avatar,.mdc-list-item--with-trailing-checkbox.mdc-list-item--with-leading-icon,.mdc-list-item--with-trailing-checkbox.mdc-list-item--with-leading-avatar{padding-left:0}[dir=rtl] .mdc-list-item--with-trailing-radio.mdc-list-item--with-leading-icon,[dir=rtl] .mdc-list-item--with-trailing-radio.mdc-list-item--with-leading-avatar,[dir=rtl] .mdc-list-item--with-trailing-checkbox.mdc-list-item--with-leading-icon,[dir=rtl] .mdc-list-item--with-trailing-checkbox.mdc-list-item--with-leading-avatar{padding-right:0}.mdc-list-item--with-trailing-radio .mdc-list-item__end,.mdc-list-item--with-trailing-checkbox .mdc-list-item__end{margin-left:24px;margin-right:8px}[dir=rtl] .mdc-list-item--with-trailing-radio .mdc-list-item__end,[dir=rtl] .mdc-list-item--with-trailing-checkbox .mdc-list-item__end{margin-left:8px;margin-right:24px}.mdc-list-item--with-trailing-radio.mdc-list-item--with-three-lines .mdc-list-item__end,.mdc-list-item--with-trailing-checkbox.mdc-list-item--with-three-lines .mdc-list-item__end{align-self:flex-start;margin-top:8px}.mdc-list-group__subheader{margin:.75rem 16px}.mdc-list-item--disabled .mdc-list-item__start,.mdc-list-item--disabled .mdc-list-item__content,.mdc-list-item--disabled .mdc-list-item__end{opacity:1}.mdc-list-item--disabled .mdc-list-item__primary-text,.mdc-list-item--disabled .mdc-list-item__secondary-text{opacity:var(--mat-list-list-item-disabled-label-text-opacity, 0.3)}.mdc-list-item--disabled.mdc-list-item--with-leading-icon .mdc-list-item__start{color:var(--mat-list-list-item-disabled-leading-icon-color, var(--mat-sys-on-surface));opacity:var(--mat-list-list-item-disabled-leading-icon-opacity, 0.38)}.mdc-list-item--disabled.mdc-list-item--with-trailing-icon .mdc-list-item__end{color:var(--mat-list-list-item-disabled-trailing-icon-color, var(--mat-sys-on-surface));opacity:var(--mat-list-list-item-disabled-trailing-icon-opacity, 0.38)}.mat-mdc-list-item.mat-mdc-list-item-both-leading-and-trailing,[dir=rtl] .mat-mdc-list-item.mat-mdc-list-item-both-leading-and-trailing{padding-left:0;padding-right:0}.mdc-list-item.mdc-list-item--disabled .mdc-list-item__primary-text{color:var(--mat-list-list-item-disabled-label-text-color, var(--mat-sys-on-surface))}.mdc-list-item:hover::before{background-color:var(--mat-list-list-item-hover-state-layer-color, var(--mat-sys-on-surface));opacity:var(--mat-list-list-item-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity))}.mdc-list-item.mdc-list-item--disabled::before{background-color:var(--mat-list-list-item-disabled-state-layer-color, var(--mat-sys-on-surface));opacity:var(--mat-list-list-item-disabled-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}.mdc-list-item:focus::before{background-color:var(--mat-list-list-item-focus-state-layer-color, var(--mat-sys-on-surface));opacity:var(--mat-list-list-item-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}.mdc-list-item--disabled .mdc-radio,.mdc-list-item--disabled .mdc-checkbox{opacity:var(--mat-list-list-item-disabled-label-text-opacity, 0.3)}.mdc-list-item--with-leading-avatar .mat-mdc-list-item-avatar{border-radius:var(--mat-list-list-item-leading-avatar-shape, var(--mat-sys-corner-full));background-color:var(--mat-list-list-item-leading-avatar-color, var(--mat-sys-primary-container))}.mat-mdc-list-item-icon{font-size:var(--mat-list-list-item-leading-icon-size, 24px)}@media(forced-colors: active){a.mdc-list-item--activated::after{content:"";position:absolute;top:50%;right:16px;transform:translateY(-50%);width:10px;height:0;border-bottom:solid 10px;border-radius:10px}a.mdc-list-item--activated [dir=rtl]::after{right:auto;left:16px}}.mat-mdc-list-base{display:block}.mat-mdc-list-base .mdc-list-item__start,.mat-mdc-list-base .mdc-list-item__end,.mat-mdc-list-base .mdc-list-item__content{pointer-events:auto}.mat-mdc-list-item,.mat-mdc-list-option{width:100%;box-sizing:border-box;-webkit-tap-highlight-color:rgba(0,0,0,0)}.mat-mdc-list-item:not(.mat-mdc-list-item-interactive),.mat-mdc-list-option:not(.mat-mdc-list-item-interactive){cursor:default}.mat-mdc-list-item .mat-divider-inset,.mat-mdc-list-option .mat-divider-inset{position:absolute;left:0;right:0;bottom:0}.mat-mdc-list-item .mat-mdc-list-item-avatar~.mat-divider-inset,.mat-mdc-list-option .mat-mdc-list-item-avatar~.mat-divider-inset{margin-left:72px}[dir=rtl] .mat-mdc-list-item .mat-mdc-list-item-avatar~.mat-divider-inset,[dir=rtl] .mat-mdc-list-option .mat-mdc-list-item-avatar~.mat-divider-inset{margin-right:72px}.mat-mdc-list-item-interactive::before{top:0;left:0;right:0;bottom:0;position:absolute;content:"";opacity:0;pointer-events:none;border-radius:inherit}.mat-mdc-list-item>.mat-focus-indicator{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}.mat-mdc-list-item:focus>.mat-focus-indicator::before{content:""}.mat-mdc-list-item.mdc-list-item--with-three-lines .mat-mdc-list-item-line.mdc-list-item__secondary-text{white-space:nowrap;line-height:normal}.mat-mdc-list-item.mdc-list-item--with-three-lines .mat-mdc-list-item-unscoped-content.mdc-list-item__secondary-text{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}mat-action-list button{background:none;color:inherit;border:none;font:inherit;outline:inherit;-webkit-tap-highlight-color:rgba(0,0,0,0);text-align:start}mat-action-list button::-moz-focus-inner{border:0}.mdc-list-item--with-leading-icon .mdc-list-item__start{margin-inline-start:var(--mat-list-list-item-leading-icon-start-space, 16px);margin-inline-end:var(--mat-list-list-item-leading-icon-end-space, 16px)}.mat-mdc-nav-list .mat-mdc-list-item{border-radius:var(--mat-list-active-indicator-shape, var(--mat-sys-corner-full));--mat-focus-indicator-border-radius: var(--mat-list-active-indicator-shape, var(--mat-sys-corner-full))}.mat-mdc-nav-list .mat-mdc-list-item.mdc-list-item--activated{background-color:var(--mat-list-active-indicator-color, var(--mat-sys-secondary-container))}\n']
    }]
  }], null, null);
})();
var MatListItem = class _MatListItem extends MatListItemBase {
  _lines;
  _titles;
  _meta;
  _unscopedContent;
  _itemText;
  /** Indicates whether an item in a `<mat-nav-list>` is the currently active page. */
  get activated() {
    return this._activated;
  }
  set activated(activated) {
    this._activated = coerceBooleanProperty(activated);
  }
  _activated = false;
  /**
   * Determine the value of `aria-current`. Return 'page' if this item is an activated anchor tag.
   * Otherwise, return `null`. This method is safe to use with server-side rendering.
   */
  _getAriaCurrent() {
    return this._hostElement.nodeName === "A" && this._activated ? "page" : null;
  }
  _hasBothLeadingAndTrailing() {
    return this._meta.length !== 0 && (this._avatars.length !== 0 || this._icons.length !== 0);
  }
  static \u0275fac = /* @__PURE__ */ (() => {
    let \u0275MatListItem_BaseFactory;
    return function MatListItem_Factory(__ngFactoryType__) {
      return (\u0275MatListItem_BaseFactory || (\u0275MatListItem_BaseFactory = \u0275\u0275getInheritedFactory(_MatListItem)))(__ngFactoryType__ || _MatListItem);
    };
  })();
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({
    type: _MatListItem,
    selectors: [["mat-list-item"], ["a", "mat-list-item", ""], ["button", "mat-list-item", ""]],
    contentQueries: function MatListItem_ContentQueries(rf, ctx, dirIndex) {
      if (rf & 1) {
        \u0275\u0275contentQuery(dirIndex, MatListItemLine, 5);
        \u0275\u0275contentQuery(dirIndex, MatListItemTitle, 5);
        \u0275\u0275contentQuery(dirIndex, MatListItemMeta, 5);
      }
      if (rf & 2) {
        let _t;
        \u0275\u0275queryRefresh(_t = \u0275\u0275loadQuery()) && (ctx._lines = _t);
        \u0275\u0275queryRefresh(_t = \u0275\u0275loadQuery()) && (ctx._titles = _t);
        \u0275\u0275queryRefresh(_t = \u0275\u0275loadQuery()) && (ctx._meta = _t);
      }
    },
    viewQuery: function MatListItem_Query(rf, ctx) {
      if (rf & 1) {
        \u0275\u0275viewQuery(_c2, 5);
        \u0275\u0275viewQuery(_c3, 5);
      }
      if (rf & 2) {
        let _t;
        \u0275\u0275queryRefresh(_t = \u0275\u0275loadQuery()) && (ctx._unscopedContent = _t.first);
        \u0275\u0275queryRefresh(_t = \u0275\u0275loadQuery()) && (ctx._itemText = _t.first);
      }
    },
    hostAttrs: [1, "mat-mdc-list-item", "mdc-list-item"],
    hostVars: 13,
    hostBindings: function MatListItem_HostBindings(rf, ctx) {
      if (rf & 2) {
        \u0275\u0275attribute("aria-current", ctx._getAriaCurrent());
        \u0275\u0275classProp("mdc-list-item--activated", ctx.activated)("mdc-list-item--with-leading-avatar", ctx._avatars.length !== 0)("mdc-list-item--with-leading-icon", ctx._icons.length !== 0)("mdc-list-item--with-trailing-meta", ctx._meta.length !== 0)("mat-mdc-list-item-both-leading-and-trailing", ctx._hasBothLeadingAndTrailing())("_mat-animation-noopable", ctx._noopAnimations);
      }
    },
    inputs: {
      activated: "activated"
    },
    exportAs: ["matListItem"],
    features: [\u0275\u0275InheritDefinitionFeature],
    ngContentSelectors: _c5,
    decls: 10,
    vars: 0,
    consts: [["unscopedContent", ""], [1, "mdc-list-item__content"], [1, "mat-mdc-list-item-unscoped-content", 3, "cdkObserveContent"], [1, "mat-focus-indicator"]],
    template: function MatListItem_Template(rf, ctx) {
      if (rf & 1) {
        const _r1 = \u0275\u0275getCurrentView();
        \u0275\u0275projectionDef(_c4);
        \u0275\u0275projection(0);
        \u0275\u0275elementStart(1, "span", 1);
        \u0275\u0275projection(2, 1);
        \u0275\u0275projection(3, 2);
        \u0275\u0275elementStart(4, "span", 2, 0);
        \u0275\u0275listener("cdkObserveContent", function MatListItem_Template_span_cdkObserveContent_4_listener() {
          \u0275\u0275restoreView(_r1);
          return \u0275\u0275resetView(ctx._updateItemLines(true));
        });
        \u0275\u0275projection(6, 3);
        \u0275\u0275elementEnd()();
        \u0275\u0275projection(7, 4);
        \u0275\u0275projection(8, 5);
        \u0275\u0275element(9, "div", 3);
      }
    },
    dependencies: [CdkObserveContent],
    encapsulation: 2,
    changeDetection: 0
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatListItem, [{
    type: Component,
    args: [{
      selector: "mat-list-item, a[mat-list-item], button[mat-list-item]",
      exportAs: "matListItem",
      host: {
        "class": "mat-mdc-list-item mdc-list-item",
        "[class.mdc-list-item--activated]": "activated",
        "[class.mdc-list-item--with-leading-avatar]": "_avatars.length !== 0",
        "[class.mdc-list-item--with-leading-icon]": "_icons.length !== 0",
        "[class.mdc-list-item--with-trailing-meta]": "_meta.length !== 0",
        // Utility class that makes it easier to target the case where there's both a leading
        // and a trailing icon. Avoids having to write out all the combinations.
        "[class.mat-mdc-list-item-both-leading-and-trailing]": "_hasBothLeadingAndTrailing()",
        "[class._mat-animation-noopable]": "_noopAnimations",
        "[attr.aria-current]": "_getAriaCurrent()"
      },
      encapsulation: ViewEncapsulation.None,
      changeDetection: ChangeDetectionStrategy.OnPush,
      imports: [CdkObserveContent],
      template: '<ng-content select="[matListItemAvatar],[matListItemIcon]"></ng-content>\n\n<span class="mdc-list-item__content">\n  <ng-content select="[matListItemTitle]"></ng-content>\n  <ng-content select="[matListItemLine]"></ng-content>\n  <span #unscopedContent class="mat-mdc-list-item-unscoped-content"\n        (cdkObserveContent)="_updateItemLines(true)">\n    <ng-content></ng-content>\n  </span>\n</span>\n\n<ng-content select="[matListItemMeta]"></ng-content>\n\n<ng-content select="mat-divider"></ng-content>\n\n<!--\n  Strong focus indicator element. MDC uses the `::before` pseudo element for the default\n  focus/hover/selected state, so we need a separate element.\n-->\n<div class="mat-focus-indicator"></div>\n'
    }]
  }], null, {
    _lines: [{
      type: ContentChildren,
      args: [MatListItemLine, {
        descendants: true
      }]
    }],
    _titles: [{
      type: ContentChildren,
      args: [MatListItemTitle, {
        descendants: true
      }]
    }],
    _meta: [{
      type: ContentChildren,
      args: [MatListItemMeta, {
        descendants: true
      }]
    }],
    _unscopedContent: [{
      type: ViewChild,
      args: ["unscopedContent"]
    }],
    _itemText: [{
      type: ViewChild,
      args: ["text"]
    }],
    activated: [{
      type: Input
    }]
  });
})();
var SELECTION_LIST = new InjectionToken("SelectionList");
var MatListOption = class _MatListOption extends MatListItemBase {
  _selectionList = inject2(SELECTION_LIST);
  _changeDetectorRef = inject2(ChangeDetectorRef);
  _lines;
  _titles;
  _unscopedContent;
  /**
   * Emits when the selected state of the option has changed.
   * Use to facilitate two-data binding to the `selected` property.
   * @docs-private
   */
  selectedChange = new EventEmitter();
  /** Whether the label should appear before or after the checkbox/radio. Defaults to 'after' */
  togglePosition = "after";
  /**
   * Whether the label should appear before or after the checkbox/radio. Defaults to 'after'
   *
   * @deprecated Use `togglePosition` instead.
   * @breaking-change 17.0.0
   */
  get checkboxPosition() {
    return this.togglePosition;
  }
  set checkboxPosition(value) {
    this.togglePosition = value;
  }
  /**
   * Theme color of the list option. This sets the color of the checkbox/radio.
   * This API is supported in M2 themes only, it has no effect in M3 themes. For color customization
   * in M3, see https://material.angular.dev/components/list/styling.
   *
   * For information on applying color variants in M3, see
   * https://material.angular.dev/guide/material-2-theming#optional-add-backwards-compatibility-styles-for-color-variants
   */
  get color() {
    return this._color || this._selectionList.color;
  }
  set color(newValue) {
    this._color = newValue;
  }
  _color;
  /** Value of the option */
  get value() {
    return this._value;
  }
  set value(newValue) {
    if (this.selected && newValue !== this.value && this._inputsInitialized) {
      this.selected = false;
    }
    this._value = newValue;
  }
  _value;
  /** Whether the option is selected. */
  get selected() {
    return this._selectionList.selectedOptions.isSelected(this);
  }
  set selected(value) {
    const isSelected = coerceBooleanProperty(value);
    if (isSelected !== this._selected) {
      this._setSelected(isSelected);
      if (isSelected || this._selectionList.multiple) {
        this._selectionList._reportValueChange();
      }
    }
  }
  _selected = false;
  /**
   * This is set to true after the first OnChanges cycle so we don't
   * clear the value of `selected` in the first cycle.
   */
  _inputsInitialized = false;
  ngOnInit() {
    const list = this._selectionList;
    if (list._value && list._value.some((value) => list.compareWith(this._value, value))) {
      this._setSelected(true);
    }
    const wasSelected = this._selected;
    Promise.resolve().then(() => {
      if (this._selected || wasSelected) {
        this.selected = true;
        this._changeDetectorRef.markForCheck();
      }
    });
    this._inputsInitialized = true;
  }
  ngOnDestroy() {
    super.ngOnDestroy();
    if (this.selected) {
      Promise.resolve().then(() => {
        this.selected = false;
      });
    }
  }
  /** Toggles the selection state of the option. */
  toggle() {
    this.selected = !this.selected;
  }
  /** Allows for programmatic focusing of the option. */
  focus() {
    this._hostElement.focus();
  }
  /** Gets the text label of the list option. Used for the typeahead functionality in the list. */
  getLabel() {
    const titleElement = this._titles?.get(0)?._elementRef.nativeElement;
    const labelEl = titleElement || this._unscopedContent?.nativeElement;
    return labelEl?.textContent || "";
  }
  /** Whether a checkbox is shown at the given position. */
  _hasCheckboxAt(position) {
    return this._selectionList.multiple && this._getTogglePosition() === position;
  }
  /** Where a radio indicator is shown at the given position. */
  _hasRadioAt(position) {
    return !this._selectionList.multiple && this._getTogglePosition() === position && !this._selectionList.hideSingleSelectionIndicator;
  }
  /** Whether icons or avatars are shown at the given position. */
  _hasIconsOrAvatarsAt(position) {
    return this._hasProjected("icons", position) || this._hasProjected("avatars", position);
  }
  /** Gets whether the given type of element is projected at the specified position. */
  _hasProjected(type, position) {
    return this._getTogglePosition() !== position && (type === "avatars" ? this._avatars.length !== 0 : this._icons.length !== 0);
  }
  _handleBlur() {
    this._selectionList._onTouched();
  }
  /** Gets the current position of the checkbox/radio. */
  _getTogglePosition() {
    return this.togglePosition || "after";
  }
  /**
   * Sets the selected state of the option.
   * @returns Whether the value has changed.
   */
  _setSelected(selected) {
    if (selected === this._selected) {
      return false;
    }
    this._selected = selected;
    if (selected) {
      this._selectionList.selectedOptions.select(this);
    } else {
      this._selectionList.selectedOptions.deselect(this);
    }
    this.selectedChange.emit(selected);
    this._changeDetectorRef.markForCheck();
    return true;
  }
  /**
   * Notifies Angular that the option needs to be checked in the next change detection run.
   * Mainly used to trigger an update of the list option if the disabled state of the selection
   * list changed.
   */
  _markForCheck() {
    this._changeDetectorRef.markForCheck();
  }
  /** Toggles the option's value based on a user interaction. */
  _toggleOnInteraction() {
    if (!this.disabled) {
      if (this._selectionList.multiple) {
        this.selected = !this.selected;
        this._selectionList._emitChangeEvent([this]);
      } else if (!this.selected) {
        this.selected = true;
        this._selectionList._emitChangeEvent([this]);
      }
    }
  }
  /** Sets the tabindex of the list option. */
  _setTabindex(value) {
    this._hostElement.setAttribute("tabindex", value + "");
  }
  _hasBothLeadingAndTrailing() {
    const hasLeading = this._hasProjected("avatars", "before") || this._hasProjected("icons", "before") || this._hasCheckboxAt("before") || this._hasRadioAt("before");
    const hasTrailing = this._hasProjected("icons", "after") || this._hasProjected("avatars", "after") || this._hasCheckboxAt("after") || this._hasRadioAt("after");
    return hasLeading && hasTrailing;
  }
  static \u0275fac = /* @__PURE__ */ (() => {
    let \u0275MatListOption_BaseFactory;
    return function MatListOption_Factory(__ngFactoryType__) {
      return (\u0275MatListOption_BaseFactory || (\u0275MatListOption_BaseFactory = \u0275\u0275getInheritedFactory(_MatListOption)))(__ngFactoryType__ || _MatListOption);
    };
  })();
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({
    type: _MatListOption,
    selectors: [["mat-list-option"]],
    contentQueries: function MatListOption_ContentQueries(rf, ctx, dirIndex) {
      if (rf & 1) {
        \u0275\u0275contentQuery(dirIndex, MatListItemLine, 5);
        \u0275\u0275contentQuery(dirIndex, MatListItemTitle, 5);
      }
      if (rf & 2) {
        let _t;
        \u0275\u0275queryRefresh(_t = \u0275\u0275loadQuery()) && (ctx._lines = _t);
        \u0275\u0275queryRefresh(_t = \u0275\u0275loadQuery()) && (ctx._titles = _t);
      }
    },
    viewQuery: function MatListOption_Query(rf, ctx) {
      if (rf & 1) {
        \u0275\u0275viewQuery(_c2, 5);
      }
      if (rf & 2) {
        let _t;
        \u0275\u0275queryRefresh(_t = \u0275\u0275loadQuery()) && (ctx._unscopedContent = _t.first);
      }
    },
    hostAttrs: ["role", "option", 1, "mat-mdc-list-item", "mat-mdc-list-option", "mdc-list-item"],
    hostVars: 27,
    hostBindings: function MatListOption_HostBindings(rf, ctx) {
      if (rf & 1) {
        \u0275\u0275listener("blur", function MatListOption_blur_HostBindingHandler() {
          return ctx._handleBlur();
        })("click", function MatListOption_click_HostBindingHandler() {
          return ctx._toggleOnInteraction();
        });
      }
      if (rf & 2) {
        \u0275\u0275attribute("aria-selected", ctx.selected);
        \u0275\u0275classProp("mdc-list-item--selected", ctx.selected && !ctx._selectionList.multiple && ctx._selectionList.hideSingleSelectionIndicator)("mdc-list-item--with-leading-avatar", ctx._hasProjected("avatars", "before"))("mdc-list-item--with-leading-icon", ctx._hasProjected("icons", "before"))("mdc-list-item--with-trailing-icon", ctx._hasProjected("icons", "after"))("mat-mdc-list-option-with-trailing-avatar", ctx._hasProjected("avatars", "after"))("mdc-list-item--with-leading-checkbox", ctx._hasCheckboxAt("before"))("mdc-list-item--with-trailing-checkbox", ctx._hasCheckboxAt("after"))("mdc-list-item--with-leading-radio", ctx._hasRadioAt("before"))("mdc-list-item--with-trailing-radio", ctx._hasRadioAt("after"))("mat-mdc-list-item-both-leading-and-trailing", ctx._hasBothLeadingAndTrailing())("mat-accent", ctx.color !== "primary" && ctx.color !== "warn")("mat-warn", ctx.color === "warn")("_mat-animation-noopable", ctx._noopAnimations);
      }
    },
    inputs: {
      togglePosition: "togglePosition",
      checkboxPosition: "checkboxPosition",
      color: "color",
      value: "value",
      selected: "selected"
    },
    outputs: {
      selectedChange: "selectedChange"
    },
    exportAs: ["matListOption"],
    features: [\u0275\u0275ProvidersFeature([{
      provide: MatListItemBase,
      useExisting: _MatListOption
    }, {
      provide: LIST_OPTION,
      useExisting: _MatListOption
    }]), \u0275\u0275InheritDefinitionFeature],
    ngContentSelectors: _c7,
    decls: 20,
    vars: 4,
    consts: [["icons", ""], ["checkbox", ""], ["radio", ""], ["unscopedContent", ""], [1, "mdc-list-item__start", "mat-mdc-list-option-checkbox-before"], [1, "mdc-list-item__start", "mat-mdc-list-option-radio-before"], [3, "ngTemplateOutlet"], [1, "mdc-list-item__content"], [1, "mat-mdc-list-item-unscoped-content", 3, "cdkObserveContent"], [1, "mdc-list-item__end"], [1, "mat-focus-indicator"], [1, "mdc-checkbox"], ["type", "checkbox", 1, "mdc-checkbox__native-control", 3, "checked", "disabled"], [1, "mdc-checkbox__background"], ["viewBox", "0 0 24 24", "aria-hidden", "true", 1, "mdc-checkbox__checkmark"], ["fill", "none", "d", "M1.73,12.91 8.1,19.28 22.79,4.59", 1, "mdc-checkbox__checkmark-path"], [1, "mdc-checkbox__mixedmark"], [1, "mdc-radio"], ["type", "radio", 1, "mdc-radio__native-control", 3, "checked", "disabled"], [1, "mdc-radio__background"], [1, "mdc-radio__outer-circle"], [1, "mdc-radio__inner-circle"]],
    template: function MatListOption_Template(rf, ctx) {
      if (rf & 1) {
        const _r1 = \u0275\u0275getCurrentView();
        \u0275\u0275projectionDef(_c6);
        \u0275\u0275template(0, MatListOption_ng_template_0_Template, 1, 0, "ng-template", null, 0, \u0275\u0275templateRefExtractor)(2, MatListOption_ng_template_2_Template, 6, 4, "ng-template", null, 1, \u0275\u0275templateRefExtractor)(4, MatListOption_ng_template_4_Template, 5, 4, "ng-template", null, 2, \u0275\u0275templateRefExtractor);
        \u0275\u0275conditionalCreate(6, MatListOption_Conditional_6_Template, 2, 1, "span", 4)(7, MatListOption_Conditional_7_Template, 2, 1, "span", 5);
        \u0275\u0275conditionalCreate(8, MatListOption_Conditional_8_Template, 1, 1, null, 6);
        \u0275\u0275elementStart(9, "span", 7);
        \u0275\u0275projection(10);
        \u0275\u0275projection(11, 1);
        \u0275\u0275elementStart(12, "span", 8, 3);
        \u0275\u0275listener("cdkObserveContent", function MatListOption_Template_span_cdkObserveContent_12_listener() {
          \u0275\u0275restoreView(_r1);
          return \u0275\u0275resetView(ctx._updateItemLines(true));
        });
        \u0275\u0275projection(14, 2);
        \u0275\u0275elementEnd()();
        \u0275\u0275conditionalCreate(15, MatListOption_Conditional_15_Template, 2, 1, "span", 9)(16, MatListOption_Conditional_16_Template, 2, 1, "span", 9);
        \u0275\u0275conditionalCreate(17, MatListOption_Conditional_17_Template, 1, 1, null, 6);
        \u0275\u0275projection(18, 3);
        \u0275\u0275element(19, "div", 10);
      }
      if (rf & 2) {
        \u0275\u0275advance(6);
        \u0275\u0275conditional(ctx._hasCheckboxAt("before") ? 6 : ctx._hasRadioAt("before") ? 7 : -1);
        \u0275\u0275advance(2);
        \u0275\u0275conditional(ctx._hasIconsOrAvatarsAt("before") ? 8 : -1);
        \u0275\u0275advance(7);
        \u0275\u0275conditional(ctx._hasCheckboxAt("after") ? 15 : ctx._hasRadioAt("after") ? 16 : -1);
        \u0275\u0275advance(2);
        \u0275\u0275conditional(ctx._hasIconsOrAvatarsAt("after") ? 17 : -1);
      }
    },
    dependencies: [NgTemplateOutlet, CdkObserveContent],
    styles: ['.mat-mdc-list-option-with-trailing-avatar.mdc-list-item,[dir=rtl] .mat-mdc-list-option-with-trailing-avatar.mdc-list-item{padding-left:0;padding-right:0}.mat-mdc-list-option-with-trailing-avatar .mdc-list-item__end{margin-left:16px;margin-right:16px;width:40px;height:40px}.mat-mdc-list-option-with-trailing-avatar.mdc-list-item--with-two-lines .mdc-list-item__primary-text{display:block;margin-top:0;line-height:normal;margin-bottom:-20px}.mat-mdc-list-option-with-trailing-avatar.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before{display:inline-block;width:0;height:32px;content:"";vertical-align:0}.mat-mdc-list-option-with-trailing-avatar.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after{display:inline-block;width:0;height:20px;content:"";vertical-align:-20px}.mat-mdc-list-option-with-trailing-avatar .mdc-list-item__end{border-radius:50%}.mat-mdc-list-option .mdc-checkbox{display:inline-block;position:relative;flex:0 0 18px;box-sizing:content-box;width:18px;height:18px;line-height:0;white-space:nowrap;cursor:pointer;vertical-align:bottom;padding:calc((var(--mat-checkbox-state-layer-size, 40px) - 18px)/2);margin:calc((var(--mat-checkbox-state-layer-size, 40px) - var(--mat-checkbox-state-layer-size, 40px))/2)}.mat-mdc-list-option .mdc-checkbox .mdc-checkbox__native-control{position:absolute;margin:0;padding:0;opacity:0;cursor:inherit;z-index:1;width:var(--mat-checkbox-state-layer-size, 40px);height:var(--mat-checkbox-state-layer-size, 40px);top:calc((var(--mat-checkbox-state-layer-size, 40px) - var(--mat-checkbox-state-layer-size, 40px))/2);right:calc((var(--mat-checkbox-state-layer-size, 40px) - var(--mat-checkbox-state-layer-size, 40px))/2);left:calc((var(--mat-checkbox-state-layer-size, 40px) - var(--mat-checkbox-state-layer-size, 40px))/2)}.mat-mdc-list-option .mdc-checkbox--disabled{cursor:default;pointer-events:none}@media(forced-colors: active){.mat-mdc-list-option .mdc-checkbox--disabled{opacity:.5}}.mat-mdc-list-option .mdc-checkbox__background{display:inline-flex;position:absolute;align-items:center;justify-content:center;box-sizing:border-box;width:18px;height:18px;border:2px solid currentColor;border-radius:2px;background-color:rgba(0,0,0,0);pointer-events:none;will-change:background-color,border-color;transition:background-color 90ms cubic-bezier(0.4, 0, 0.6, 1),border-color 90ms cubic-bezier(0.4, 0, 0.6, 1);-webkit-print-color-adjust:exact;color-adjust:exact;border-color:var(--mat-checkbox-unselected-icon-color, var(--mat-sys-on-surface-variant));top:calc((var(--mat-checkbox-state-layer-size, 40px) - 18px)/2);left:calc((var(--mat-checkbox-state-layer-size, 40px) - 18px)/2)}.mat-mdc-list-option .mdc-checkbox__native-control:enabled:checked~.mdc-checkbox__background,.mat-mdc-list-option .mdc-checkbox__native-control:enabled:indeterminate~.mdc-checkbox__background{border-color:var(--mat-checkbox-selected-icon-color, var(--mat-sys-primary));background-color:var(--mat-checkbox-selected-icon-color, var(--mat-sys-primary))}.mat-mdc-list-option .mdc-checkbox--disabled .mdc-checkbox__background{border-color:var(--mat-checkbox-disabled-unselected-icon-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-mdc-list-option .mdc-checkbox__native-control:disabled:checked~.mdc-checkbox__background,.mat-mdc-list-option .mdc-checkbox__native-control:disabled:indeterminate~.mdc-checkbox__background{background-color:var(--mat-checkbox-disabled-selected-icon-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));border-color:rgba(0,0,0,0)}.mat-mdc-list-option .mdc-checkbox:hover>.mdc-checkbox__native-control:not(:checked)~.mdc-checkbox__background,.mat-mdc-list-option .mdc-checkbox:hover>.mdc-checkbox__native-control:not(:indeterminate)~.mdc-checkbox__background{border-color:var(--mat-checkbox-unselected-hover-icon-color, var(--mat-sys-on-surface));background-color:rgba(0,0,0,0)}.mat-mdc-list-option .mdc-checkbox:hover>.mdc-checkbox__native-control:checked~.mdc-checkbox__background,.mat-mdc-list-option .mdc-checkbox:hover>.mdc-checkbox__native-control:indeterminate~.mdc-checkbox__background{border-color:var(--mat-checkbox-selected-hover-icon-color, var(--mat-sys-primary));background-color:var(--mat-checkbox-selected-hover-icon-color, var(--mat-sys-primary))}.mat-mdc-list-option .mdc-checkbox__native-control:focus:focus:not(:checked)~.mdc-checkbox__background,.mat-mdc-list-option .mdc-checkbox__native-control:focus:focus:not(:indeterminate)~.mdc-checkbox__background{border-color:var(--mat-checkbox-unselected-focus-icon-color, var(--mat-sys-on-surface))}.mat-mdc-list-option .mdc-checkbox__native-control:focus:focus:checked~.mdc-checkbox__background,.mat-mdc-list-option .mdc-checkbox__native-control:focus:focus:indeterminate~.mdc-checkbox__background{border-color:var(--mat-checkbox-selected-focus-icon-color, var(--mat-sys-primary));background-color:var(--mat-checkbox-selected-focus-icon-color, var(--mat-sys-primary))}.mat-mdc-list-option .mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox:hover>.mdc-checkbox__native-control~.mdc-checkbox__background,.mat-mdc-list-option .mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox .mdc-checkbox__native-control:focus~.mdc-checkbox__background,.mat-mdc-list-option .mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox__background{border-color:var(--mat-checkbox-disabled-unselected-icon-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-mdc-list-option .mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox__native-control:checked~.mdc-checkbox__background,.mat-mdc-list-option .mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox__native-control:indeterminate~.mdc-checkbox__background{background-color:var(--mat-checkbox-disabled-selected-icon-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));border-color:rgba(0,0,0,0)}.mat-mdc-list-option .mdc-checkbox__checkmark{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;opacity:0;transition:opacity 180ms cubic-bezier(0.4, 0, 0.6, 1);color:var(--mat-checkbox-selected-checkmark-color, var(--mat-sys-on-primary))}@media(forced-colors: active){.mat-mdc-list-option .mdc-checkbox__checkmark{color:CanvasText}}.mat-mdc-list-option .mdc-checkbox--disabled .mdc-checkbox__checkmark,.mat-mdc-list-option .mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox__checkmark{color:var(--mat-checkbox-disabled-selected-checkmark-color, var(--mat-sys-surface))}@media(forced-colors: active){.mat-mdc-list-option .mdc-checkbox--disabled .mdc-checkbox__checkmark,.mat-mdc-list-option .mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox__checkmark{color:CanvasText}}.mat-mdc-list-option .mdc-checkbox__checkmark-path{transition:stroke-dashoffset 180ms cubic-bezier(0.4, 0, 0.6, 1);stroke:currentColor;stroke-width:3.12px;stroke-dashoffset:29.7833385;stroke-dasharray:29.7833385}.mat-mdc-list-option .mdc-checkbox__mixedmark{width:100%;height:0;transform:scaleX(0) rotate(0deg);border-width:1px;border-style:solid;opacity:0;transition:opacity 90ms cubic-bezier(0.4, 0, 0.6, 1),transform 90ms cubic-bezier(0.4, 0, 0.6, 1);border-color:var(--mat-checkbox-selected-checkmark-color, var(--mat-sys-on-primary))}@media(forced-colors: active){.mat-mdc-list-option .mdc-checkbox__mixedmark{margin:0 1px}}.mat-mdc-list-option .mdc-checkbox--disabled .mdc-checkbox__mixedmark,.mat-mdc-list-option .mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox__mixedmark{border-color:var(--mat-checkbox-disabled-selected-checkmark-color, var(--mat-sys-surface))}.mat-mdc-list-option .mdc-checkbox--anim-unchecked-checked .mdc-checkbox__background,.mat-mdc-list-option .mdc-checkbox--anim-unchecked-indeterminate .mdc-checkbox__background,.mat-mdc-list-option .mdc-checkbox--anim-checked-unchecked .mdc-checkbox__background,.mat-mdc-list-option .mdc-checkbox--anim-indeterminate-unchecked .mdc-checkbox__background{animation-duration:180ms;animation-timing-function:linear}.mat-mdc-list-option .mdc-checkbox--anim-unchecked-checked .mdc-checkbox__checkmark-path{animation:mdc-checkbox-unchecked-checked-checkmark-path 180ms linear;transition:none}.mat-mdc-list-option .mdc-checkbox--anim-unchecked-indeterminate .mdc-checkbox__mixedmark{animation:mdc-checkbox-unchecked-indeterminate-mixedmark 90ms linear;transition:none}.mat-mdc-list-option .mdc-checkbox--anim-checked-unchecked .mdc-checkbox__checkmark-path{animation:mdc-checkbox-checked-unchecked-checkmark-path 90ms linear;transition:none}.mat-mdc-list-option .mdc-checkbox--anim-checked-indeterminate .mdc-checkbox__checkmark{animation:mdc-checkbox-checked-indeterminate-checkmark 90ms linear;transition:none}.mat-mdc-list-option .mdc-checkbox--anim-checked-indeterminate .mdc-checkbox__mixedmark{animation:mdc-checkbox-checked-indeterminate-mixedmark 90ms linear;transition:none}.mat-mdc-list-option .mdc-checkbox--anim-indeterminate-checked .mdc-checkbox__checkmark{animation:mdc-checkbox-indeterminate-checked-checkmark 500ms linear;transition:none}.mat-mdc-list-option .mdc-checkbox--anim-indeterminate-checked .mdc-checkbox__mixedmark{animation:mdc-checkbox-indeterminate-checked-mixedmark 500ms linear;transition:none}.mat-mdc-list-option .mdc-checkbox--anim-indeterminate-unchecked .mdc-checkbox__mixedmark{animation:mdc-checkbox-indeterminate-unchecked-mixedmark 300ms linear;transition:none}.mat-mdc-list-option .mdc-checkbox__native-control:checked~.mdc-checkbox__background,.mat-mdc-list-option .mdc-checkbox__native-control:indeterminate~.mdc-checkbox__background{transition:border-color 90ms cubic-bezier(0, 0, 0.2, 1),background-color 90ms cubic-bezier(0, 0, 0.2, 1)}.mat-mdc-list-option .mdc-checkbox__native-control:checked~.mdc-checkbox__background>.mdc-checkbox__checkmark>.mdc-checkbox__checkmark-path,.mat-mdc-list-option .mdc-checkbox__native-control:indeterminate~.mdc-checkbox__background>.mdc-checkbox__checkmark>.mdc-checkbox__checkmark-path{stroke-dashoffset:0}.mat-mdc-list-option .mdc-checkbox__native-control:checked~.mdc-checkbox__background>.mdc-checkbox__checkmark{transition:opacity 180ms cubic-bezier(0, 0, 0.2, 1),transform 180ms cubic-bezier(0, 0, 0.2, 1);opacity:1}.mat-mdc-list-option .mdc-checkbox__native-control:checked~.mdc-checkbox__background>.mdc-checkbox__mixedmark{transform:scaleX(1) rotate(-45deg)}.mat-mdc-list-option .mdc-checkbox__native-control:indeterminate~.mdc-checkbox__background>.mdc-checkbox__checkmark{transform:rotate(45deg);opacity:0;transition:opacity 90ms cubic-bezier(0.4, 0, 0.6, 1),transform 90ms cubic-bezier(0.4, 0, 0.6, 1)}.mat-mdc-list-option .mdc-checkbox__native-control:indeterminate~.mdc-checkbox__background>.mdc-checkbox__mixedmark{transform:scaleX(1) rotate(0deg);opacity:1}@keyframes mdc-checkbox-unchecked-checked-checkmark-path{0%,50%{stroke-dashoffset:29.7833385}50%{animation-timing-function:cubic-bezier(0, 0, 0.2, 1)}100%{stroke-dashoffset:0}}@keyframes mdc-checkbox-unchecked-indeterminate-mixedmark{0%,68.2%{transform:scaleX(0)}68.2%{animation-timing-function:cubic-bezier(0, 0, 0, 1)}100%{transform:scaleX(1)}}@keyframes mdc-checkbox-checked-unchecked-checkmark-path{from{animation-timing-function:cubic-bezier(0.4, 0, 1, 1);opacity:1;stroke-dashoffset:0}to{opacity:0;stroke-dashoffset:-29.7833385}}@keyframes mdc-checkbox-checked-indeterminate-checkmark{from{animation-timing-function:cubic-bezier(0, 0, 0.2, 1);transform:rotate(0deg);opacity:1}to{transform:rotate(45deg);opacity:0}}@keyframes mdc-checkbox-indeterminate-checked-checkmark{from{animation-timing-function:cubic-bezier(0.14, 0, 0, 1);transform:rotate(45deg);opacity:0}to{transform:rotate(360deg);opacity:1}}@keyframes mdc-checkbox-checked-indeterminate-mixedmark{from{animation-timing-function:cubic-bezier(0, 0, 0.2, 1);transform:rotate(-45deg);opacity:0}to{transform:rotate(0deg);opacity:1}}@keyframes mdc-checkbox-indeterminate-checked-mixedmark{from{animation-timing-function:cubic-bezier(0.14, 0, 0, 1);transform:rotate(0deg);opacity:1}to{transform:rotate(315deg);opacity:0}}@keyframes mdc-checkbox-indeterminate-unchecked-mixedmark{0%{animation-timing-function:linear;transform:scaleX(1);opacity:1}32.8%,100%{transform:scaleX(0);opacity:0}}.mat-mdc-list-option .mdc-radio{display:inline-block;position:relative;flex:0 0 auto;box-sizing:content-box;width:20px;height:20px;cursor:pointer;will-change:opacity,transform,border-color,color;padding:calc((var(--mat-radio-state-layer-size, 40px) - 20px)/2)}.mat-mdc-list-option .mdc-radio__background{display:inline-block;position:relative;box-sizing:border-box;width:20px;height:20px}.mat-mdc-list-option .mdc-radio__background::before{position:absolute;transform:scale(0, 0);border-radius:50%;opacity:0;pointer-events:none;content:"";transition:opacity 90ms cubic-bezier(0.4, 0, 0.6, 1),transform 90ms cubic-bezier(0.4, 0, 0.6, 1);width:var(--mat-radio-state-layer-size, 40px);height:var(--mat-radio-state-layer-size, 40px);top:calc(-1*(var(--mat-radio-state-layer-size, 40px) - 20px)/2);left:calc(-1*(var(--mat-radio-state-layer-size, 40px) - 20px)/2)}.mat-mdc-list-option .mdc-radio__outer-circle{position:absolute;top:0;left:0;box-sizing:border-box;width:100%;height:100%;border-width:2px;border-style:solid;border-radius:50%;transition:border-color 90ms cubic-bezier(0.4, 0, 0.6, 1)}.mat-mdc-list-option .mdc-radio__inner-circle{position:absolute;top:0;left:0;box-sizing:border-box;width:100%;height:100%;transform:scale(0, 0);border-width:10px;border-style:solid;border-radius:50%;transition:transform 90ms cubic-bezier(0.4, 0, 0.6, 1),border-color 90ms cubic-bezier(0.4, 0, 0.6, 1)}.mat-mdc-list-option .mdc-radio__native-control{position:absolute;margin:0;padding:0;opacity:0;top:0;right:0;left:0;cursor:inherit;z-index:1;width:var(--mat-radio-state-layer-size, 40px);height:var(--mat-radio-state-layer-size, 40px)}.mat-mdc-list-option .mdc-radio__native-control:checked+.mdc-radio__background,.mat-mdc-list-option .mdc-radio__native-control:disabled+.mdc-radio__background{transition:opacity 90ms cubic-bezier(0, 0, 0.2, 1),transform 90ms cubic-bezier(0, 0, 0.2, 1)}.mat-mdc-list-option .mdc-radio__native-control:checked+.mdc-radio__background>.mdc-radio__outer-circle,.mat-mdc-list-option .mdc-radio__native-control:disabled+.mdc-radio__background>.mdc-radio__outer-circle{transition:border-color 90ms cubic-bezier(0, 0, 0.2, 1)}.mat-mdc-list-option .mdc-radio__native-control:checked+.mdc-radio__background>.mdc-radio__inner-circle,.mat-mdc-list-option .mdc-radio__native-control:disabled+.mdc-radio__background>.mdc-radio__inner-circle{transition:transform 90ms cubic-bezier(0, 0, 0.2, 1),border-color 90ms cubic-bezier(0, 0, 0.2, 1)}.mat-mdc-list-option .mdc-radio__native-control:disabled:not(:checked)+.mdc-radio__background>.mdc-radio__outer-circle{border-color:var(--mat-radio-disabled-unselected-icon-color, var(--mat-sys-on-surface));opacity:var(--mat-radio-disabled-unselected-icon-opacity, 0.38)}.mat-mdc-list-option .mdc-radio__native-control:disabled+.mdc-radio__background{cursor:default}.mat-mdc-list-option .mdc-radio__native-control:disabled+.mdc-radio__background>.mdc-radio__inner-circle,.mat-mdc-list-option .mdc-radio__native-control:disabled+.mdc-radio__background>.mdc-radio__outer-circle{border-color:var(--mat-radio-disabled-selected-icon-color, var(--mat-sys-on-surface));opacity:var(--mat-radio-disabled-selected-icon-opacity, 0.38)}.mat-mdc-list-option .mdc-radio__native-control:enabled:not(:checked)+.mdc-radio__background>.mdc-radio__outer-circle{border-color:var(--mat-radio-unselected-icon-color, var(--mat-sys-on-surface-variant))}.mat-mdc-list-option .mdc-radio__native-control:enabled:checked+.mdc-radio__background>.mdc-radio__outer-circle,.mat-mdc-list-option .mdc-radio__native-control:enabled:checked+.mdc-radio__background>.mdc-radio__inner-circle{border-color:var(--mat-radio-selected-icon-color, var(--mat-sys-primary))}.mat-mdc-list-option .mdc-radio__native-control:checked+.mdc-radio__background>.mdc-radio__inner-circle{transform:scale(0.5);transition:transform 90ms cubic-bezier(0, 0, 0.2, 1),border-color 90ms cubic-bezier(0, 0, 0.2, 1)}.mat-mdc-list-option._mat-animation-noopable .mdc-radio__background::before,.mat-mdc-list-option._mat-animation-noopable .mdc-radio__outer-circle,.mat-mdc-list-option._mat-animation-noopable .mdc-radio__inner-circle{transition:none !important}.mat-mdc-list-option._mat-animation-noopable>.mdc-list-item__start>.mdc-checkbox>.mat-mdc-checkbox-touch-target,.mat-mdc-list-option._mat-animation-noopable>.mdc-list-item__start>.mdc-checkbox>.mdc-checkbox__native-control,.mat-mdc-list-option._mat-animation-noopable>.mdc-list-item__start>.mdc-checkbox>.mdc-checkbox__ripple,.mat-mdc-list-option._mat-animation-noopable>.mdc-list-item__start>.mdc-checkbox>.mat-mdc-checkbox-ripple::before,.mat-mdc-list-option._mat-animation-noopable>.mdc-list-item__start>.mdc-checkbox>.mdc-checkbox__background,.mat-mdc-list-option._mat-animation-noopable>.mdc-list-item__start>.mdc-checkbox>.mdc-checkbox__background>.mdc-checkbox__checkmark,.mat-mdc-list-option._mat-animation-noopable>.mdc-list-item__start>.mdc-checkbox>.mdc-checkbox__background>.mdc-checkbox__checkmark>.mdc-checkbox__checkmark-path,.mat-mdc-list-option._mat-animation-noopable>.mdc-list-item__start>.mdc-checkbox>.mdc-checkbox__background>.mdc-checkbox__mixedmark,.mat-mdc-list-option._mat-animation-noopable>.mdc-list-item__end>.mdc-checkbox>.mat-mdc-checkbox-touch-target,.mat-mdc-list-option._mat-animation-noopable>.mdc-list-item__end>.mdc-checkbox>.mdc-checkbox__native-control,.mat-mdc-list-option._mat-animation-noopable>.mdc-list-item__end>.mdc-checkbox>.mdc-checkbox__ripple,.mat-mdc-list-option._mat-animation-noopable>.mdc-list-item__end>.mdc-checkbox>.mat-mdc-checkbox-ripple::before,.mat-mdc-list-option._mat-animation-noopable>.mdc-list-item__end>.mdc-checkbox>.mdc-checkbox__background,.mat-mdc-list-option._mat-animation-noopable>.mdc-list-item__end>.mdc-checkbox>.mdc-checkbox__background>.mdc-checkbox__checkmark,.mat-mdc-list-option._mat-animation-noopable>.mdc-list-item__end>.mdc-checkbox>.mdc-checkbox__background>.mdc-checkbox__checkmark>.mdc-checkbox__checkmark-path,.mat-mdc-list-option._mat-animation-noopable>.mdc-list-item__end>.mdc-checkbox>.mdc-checkbox__background>.mdc-checkbox__mixedmark{transition:none !important;animation:none !important}.mat-mdc-list-option .mdc-checkbox__native-control,.mat-mdc-list-option .mdc-radio__native-control{display:none}@media(forced-colors: active){.mat-mdc-list-option.mdc-list-item--selected::after{content:"";position:absolute;top:50%;right:16px;transform:translateY(-50%);width:10px;height:0;border-bottom:solid 10px;border-radius:10px}.mat-mdc-list-option.mdc-list-item--selected [dir=rtl]::after{right:auto;left:16px}}\n'],
    encapsulation: 2,
    changeDetection: 0
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatListOption, [{
    type: Component,
    args: [{
      selector: "mat-list-option",
      exportAs: "matListOption",
      host: {
        "class": "mat-mdc-list-item mat-mdc-list-option mdc-list-item",
        "role": "option",
        // As per MDC, only list items without checkbox or radio indicator should receive the
        // `--selected` class.
        "[class.mdc-list-item--selected]": "selected && !_selectionList.multiple && _selectionList.hideSingleSelectionIndicator",
        // Based on the checkbox/radio position and whether there are icons or avatars, we apply MDC's
        // list-item `--leading` and `--trailing` classes.
        "[class.mdc-list-item--with-leading-avatar]": '_hasProjected("avatars", "before")',
        "[class.mdc-list-item--with-leading-icon]": '_hasProjected("icons", "before")',
        "[class.mdc-list-item--with-trailing-icon]": '_hasProjected("icons", "after")',
        "[class.mat-mdc-list-option-with-trailing-avatar]": '_hasProjected("avatars", "after")',
        // Based on the checkbox/radio position, we apply the `--leading` or `--trailing` MDC classes
        // which ensure that the checkbox/radio is positioned correctly within the list item.
        "[class.mdc-list-item--with-leading-checkbox]": '_hasCheckboxAt("before")',
        "[class.mdc-list-item--with-trailing-checkbox]": '_hasCheckboxAt("after")',
        "[class.mdc-list-item--with-leading-radio]": '_hasRadioAt("before")',
        "[class.mdc-list-item--with-trailing-radio]": '_hasRadioAt("after")',
        // Utility class that makes it easier to target the case where there's both a leading
        // and a trailing icon. Avoids having to write out all the combinations.
        "[class.mat-mdc-list-item-both-leading-and-trailing]": "_hasBothLeadingAndTrailing()",
        "[class.mat-accent]": 'color !== "primary" && color !== "warn"',
        "[class.mat-warn]": 'color === "warn"',
        "[class._mat-animation-noopable]": "_noopAnimations",
        "[attr.aria-selected]": "selected",
        "(blur)": "_handleBlur()",
        "(click)": "_toggleOnInteraction()"
      },
      encapsulation: ViewEncapsulation.None,
      changeDetection: ChangeDetectionStrategy.OnPush,
      providers: [{
        provide: MatListItemBase,
        useExisting: MatListOption
      }, {
        provide: LIST_OPTION,
        useExisting: MatListOption
      }],
      imports: [NgTemplateOutlet, CdkObserveContent],
      template: `<!--
  Save icons and the pseudo checkbox/radio so that they can be re-used in the template without
  duplication. Also content can only be injected once so we need to extract icons/avatars
  into a template since we use it in multiple places.
-->
<ng-template #icons>
  <ng-content select="[matListItemAvatar],[matListItemIcon]">
  </ng-content>
</ng-template>

<ng-template #checkbox>
  <div class="mdc-checkbox" [class.mdc-checkbox--disabled]="disabled">
    <input type="checkbox" class="mdc-checkbox__native-control"
           [checked]="selected" [disabled]="disabled"/>
    <div class="mdc-checkbox__background">
      <svg class="mdc-checkbox__checkmark"
           viewBox="0 0 24 24"
           aria-hidden="true">
        <path class="mdc-checkbox__checkmark-path"
              fill="none"
              d="M1.73,12.91 8.1,19.28 22.79,4.59"/>
      </svg>
      <div class="mdc-checkbox__mixedmark"></div>
    </div>
  </div>
</ng-template>

<ng-template #radio>
  <div class="mdc-radio" [class.mdc-radio--disabled]="disabled">
    <input type="radio" class="mdc-radio__native-control"
           [checked]="selected" [disabled]="disabled"/>
    <div class="mdc-radio__background">
      <div class="mdc-radio__outer-circle"></div>
      <div class="mdc-radio__inner-circle"></div>
    </div>
  </div>
</ng-template>

@if (_hasCheckboxAt('before')) {
  <!-- Container for the checkbox at start. -->
  <span class="mdc-list-item__start mat-mdc-list-option-checkbox-before">
    <ng-template [ngTemplateOutlet]="checkbox"></ng-template>
  </span>
} @else if (_hasRadioAt('before')) {
  <!-- Container for the radio at the start. -->
  <span class="mdc-list-item__start mat-mdc-list-option-radio-before">
    <ng-template [ngTemplateOutlet]="radio"></ng-template>
  </span>
}
<!-- Conditionally renders icons/avatars before the list item text. -->
@if (_hasIconsOrAvatarsAt('before')) {
  <ng-template [ngTemplateOutlet]="icons"></ng-template>
}

<!-- Text -->
<span class="mdc-list-item__content">
  <ng-content select="[matListItemTitle]"></ng-content>
  <ng-content select="[matListItemLine]"></ng-content>
  <span #unscopedContent class="mat-mdc-list-item-unscoped-content"
        (cdkObserveContent)="_updateItemLines(true)">
    <ng-content></ng-content>
  </span>
</span>

@if (_hasCheckboxAt('after')) {
  <!-- Container for the checkbox at the end. -->
  <span class="mdc-list-item__end">
    <ng-template [ngTemplateOutlet]="checkbox"></ng-template>
  </span>
} @else if (_hasRadioAt('after')) {
  <!-- Container for the radio at the end. -->
  <span class="mdc-list-item__end">
    <ng-template [ngTemplateOutlet]="radio"></ng-template>
  </span>
}

<!-- Conditionally renders icons/avatars after the list item text. -->
@if (_hasIconsOrAvatarsAt('after')) {
  <ng-template [ngTemplateOutlet]="icons"></ng-template>
}

<!-- Divider -->
<ng-content select="mat-divider"></ng-content>

<!--
  Strong focus indicator element. MDC uses the \`::before\` pseudo element for the default
  focus/hover/selected state, so we need a separate element.
-->
<div class="mat-focus-indicator"></div>
`,
      styles: ['.mat-mdc-list-option-with-trailing-avatar.mdc-list-item,[dir=rtl] .mat-mdc-list-option-with-trailing-avatar.mdc-list-item{padding-left:0;padding-right:0}.mat-mdc-list-option-with-trailing-avatar .mdc-list-item__end{margin-left:16px;margin-right:16px;width:40px;height:40px}.mat-mdc-list-option-with-trailing-avatar.mdc-list-item--with-two-lines .mdc-list-item__primary-text{display:block;margin-top:0;line-height:normal;margin-bottom:-20px}.mat-mdc-list-option-with-trailing-avatar.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before{display:inline-block;width:0;height:32px;content:"";vertical-align:0}.mat-mdc-list-option-with-trailing-avatar.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after{display:inline-block;width:0;height:20px;content:"";vertical-align:-20px}.mat-mdc-list-option-with-trailing-avatar .mdc-list-item__end{border-radius:50%}.mat-mdc-list-option .mdc-checkbox{display:inline-block;position:relative;flex:0 0 18px;box-sizing:content-box;width:18px;height:18px;line-height:0;white-space:nowrap;cursor:pointer;vertical-align:bottom;padding:calc((var(--mat-checkbox-state-layer-size, 40px) - 18px)/2);margin:calc((var(--mat-checkbox-state-layer-size, 40px) - var(--mat-checkbox-state-layer-size, 40px))/2)}.mat-mdc-list-option .mdc-checkbox .mdc-checkbox__native-control{position:absolute;margin:0;padding:0;opacity:0;cursor:inherit;z-index:1;width:var(--mat-checkbox-state-layer-size, 40px);height:var(--mat-checkbox-state-layer-size, 40px);top:calc((var(--mat-checkbox-state-layer-size, 40px) - var(--mat-checkbox-state-layer-size, 40px))/2);right:calc((var(--mat-checkbox-state-layer-size, 40px) - var(--mat-checkbox-state-layer-size, 40px))/2);left:calc((var(--mat-checkbox-state-layer-size, 40px) - var(--mat-checkbox-state-layer-size, 40px))/2)}.mat-mdc-list-option .mdc-checkbox--disabled{cursor:default;pointer-events:none}@media(forced-colors: active){.mat-mdc-list-option .mdc-checkbox--disabled{opacity:.5}}.mat-mdc-list-option .mdc-checkbox__background{display:inline-flex;position:absolute;align-items:center;justify-content:center;box-sizing:border-box;width:18px;height:18px;border:2px solid currentColor;border-radius:2px;background-color:rgba(0,0,0,0);pointer-events:none;will-change:background-color,border-color;transition:background-color 90ms cubic-bezier(0.4, 0, 0.6, 1),border-color 90ms cubic-bezier(0.4, 0, 0.6, 1);-webkit-print-color-adjust:exact;color-adjust:exact;border-color:var(--mat-checkbox-unselected-icon-color, var(--mat-sys-on-surface-variant));top:calc((var(--mat-checkbox-state-layer-size, 40px) - 18px)/2);left:calc((var(--mat-checkbox-state-layer-size, 40px) - 18px)/2)}.mat-mdc-list-option .mdc-checkbox__native-control:enabled:checked~.mdc-checkbox__background,.mat-mdc-list-option .mdc-checkbox__native-control:enabled:indeterminate~.mdc-checkbox__background{border-color:var(--mat-checkbox-selected-icon-color, var(--mat-sys-primary));background-color:var(--mat-checkbox-selected-icon-color, var(--mat-sys-primary))}.mat-mdc-list-option .mdc-checkbox--disabled .mdc-checkbox__background{border-color:var(--mat-checkbox-disabled-unselected-icon-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-mdc-list-option .mdc-checkbox__native-control:disabled:checked~.mdc-checkbox__background,.mat-mdc-list-option .mdc-checkbox__native-control:disabled:indeterminate~.mdc-checkbox__background{background-color:var(--mat-checkbox-disabled-selected-icon-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));border-color:rgba(0,0,0,0)}.mat-mdc-list-option .mdc-checkbox:hover>.mdc-checkbox__native-control:not(:checked)~.mdc-checkbox__background,.mat-mdc-list-option .mdc-checkbox:hover>.mdc-checkbox__native-control:not(:indeterminate)~.mdc-checkbox__background{border-color:var(--mat-checkbox-unselected-hover-icon-color, var(--mat-sys-on-surface));background-color:rgba(0,0,0,0)}.mat-mdc-list-option .mdc-checkbox:hover>.mdc-checkbox__native-control:checked~.mdc-checkbox__background,.mat-mdc-list-option .mdc-checkbox:hover>.mdc-checkbox__native-control:indeterminate~.mdc-checkbox__background{border-color:var(--mat-checkbox-selected-hover-icon-color, var(--mat-sys-primary));background-color:var(--mat-checkbox-selected-hover-icon-color, var(--mat-sys-primary))}.mat-mdc-list-option .mdc-checkbox__native-control:focus:focus:not(:checked)~.mdc-checkbox__background,.mat-mdc-list-option .mdc-checkbox__native-control:focus:focus:not(:indeterminate)~.mdc-checkbox__background{border-color:var(--mat-checkbox-unselected-focus-icon-color, var(--mat-sys-on-surface))}.mat-mdc-list-option .mdc-checkbox__native-control:focus:focus:checked~.mdc-checkbox__background,.mat-mdc-list-option .mdc-checkbox__native-control:focus:focus:indeterminate~.mdc-checkbox__background{border-color:var(--mat-checkbox-selected-focus-icon-color, var(--mat-sys-primary));background-color:var(--mat-checkbox-selected-focus-icon-color, var(--mat-sys-primary))}.mat-mdc-list-option .mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox:hover>.mdc-checkbox__native-control~.mdc-checkbox__background,.mat-mdc-list-option .mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox .mdc-checkbox__native-control:focus~.mdc-checkbox__background,.mat-mdc-list-option .mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox__background{border-color:var(--mat-checkbox-disabled-unselected-icon-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-mdc-list-option .mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox__native-control:checked~.mdc-checkbox__background,.mat-mdc-list-option .mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox__native-control:indeterminate~.mdc-checkbox__background{background-color:var(--mat-checkbox-disabled-selected-icon-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));border-color:rgba(0,0,0,0)}.mat-mdc-list-option .mdc-checkbox__checkmark{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;opacity:0;transition:opacity 180ms cubic-bezier(0.4, 0, 0.6, 1);color:var(--mat-checkbox-selected-checkmark-color, var(--mat-sys-on-primary))}@media(forced-colors: active){.mat-mdc-list-option .mdc-checkbox__checkmark{color:CanvasText}}.mat-mdc-list-option .mdc-checkbox--disabled .mdc-checkbox__checkmark,.mat-mdc-list-option .mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox__checkmark{color:var(--mat-checkbox-disabled-selected-checkmark-color, var(--mat-sys-surface))}@media(forced-colors: active){.mat-mdc-list-option .mdc-checkbox--disabled .mdc-checkbox__checkmark,.mat-mdc-list-option .mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox__checkmark{color:CanvasText}}.mat-mdc-list-option .mdc-checkbox__checkmark-path{transition:stroke-dashoffset 180ms cubic-bezier(0.4, 0, 0.6, 1);stroke:currentColor;stroke-width:3.12px;stroke-dashoffset:29.7833385;stroke-dasharray:29.7833385}.mat-mdc-list-option .mdc-checkbox__mixedmark{width:100%;height:0;transform:scaleX(0) rotate(0deg);border-width:1px;border-style:solid;opacity:0;transition:opacity 90ms cubic-bezier(0.4, 0, 0.6, 1),transform 90ms cubic-bezier(0.4, 0, 0.6, 1);border-color:var(--mat-checkbox-selected-checkmark-color, var(--mat-sys-on-primary))}@media(forced-colors: active){.mat-mdc-list-option .mdc-checkbox__mixedmark{margin:0 1px}}.mat-mdc-list-option .mdc-checkbox--disabled .mdc-checkbox__mixedmark,.mat-mdc-list-option .mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox__mixedmark{border-color:var(--mat-checkbox-disabled-selected-checkmark-color, var(--mat-sys-surface))}.mat-mdc-list-option .mdc-checkbox--anim-unchecked-checked .mdc-checkbox__background,.mat-mdc-list-option .mdc-checkbox--anim-unchecked-indeterminate .mdc-checkbox__background,.mat-mdc-list-option .mdc-checkbox--anim-checked-unchecked .mdc-checkbox__background,.mat-mdc-list-option .mdc-checkbox--anim-indeterminate-unchecked .mdc-checkbox__background{animation-duration:180ms;animation-timing-function:linear}.mat-mdc-list-option .mdc-checkbox--anim-unchecked-checked .mdc-checkbox__checkmark-path{animation:mdc-checkbox-unchecked-checked-checkmark-path 180ms linear;transition:none}.mat-mdc-list-option .mdc-checkbox--anim-unchecked-indeterminate .mdc-checkbox__mixedmark{animation:mdc-checkbox-unchecked-indeterminate-mixedmark 90ms linear;transition:none}.mat-mdc-list-option .mdc-checkbox--anim-checked-unchecked .mdc-checkbox__checkmark-path{animation:mdc-checkbox-checked-unchecked-checkmark-path 90ms linear;transition:none}.mat-mdc-list-option .mdc-checkbox--anim-checked-indeterminate .mdc-checkbox__checkmark{animation:mdc-checkbox-checked-indeterminate-checkmark 90ms linear;transition:none}.mat-mdc-list-option .mdc-checkbox--anim-checked-indeterminate .mdc-checkbox__mixedmark{animation:mdc-checkbox-checked-indeterminate-mixedmark 90ms linear;transition:none}.mat-mdc-list-option .mdc-checkbox--anim-indeterminate-checked .mdc-checkbox__checkmark{animation:mdc-checkbox-indeterminate-checked-checkmark 500ms linear;transition:none}.mat-mdc-list-option .mdc-checkbox--anim-indeterminate-checked .mdc-checkbox__mixedmark{animation:mdc-checkbox-indeterminate-checked-mixedmark 500ms linear;transition:none}.mat-mdc-list-option .mdc-checkbox--anim-indeterminate-unchecked .mdc-checkbox__mixedmark{animation:mdc-checkbox-indeterminate-unchecked-mixedmark 300ms linear;transition:none}.mat-mdc-list-option .mdc-checkbox__native-control:checked~.mdc-checkbox__background,.mat-mdc-list-option .mdc-checkbox__native-control:indeterminate~.mdc-checkbox__background{transition:border-color 90ms cubic-bezier(0, 0, 0.2, 1),background-color 90ms cubic-bezier(0, 0, 0.2, 1)}.mat-mdc-list-option .mdc-checkbox__native-control:checked~.mdc-checkbox__background>.mdc-checkbox__checkmark>.mdc-checkbox__checkmark-path,.mat-mdc-list-option .mdc-checkbox__native-control:indeterminate~.mdc-checkbox__background>.mdc-checkbox__checkmark>.mdc-checkbox__checkmark-path{stroke-dashoffset:0}.mat-mdc-list-option .mdc-checkbox__native-control:checked~.mdc-checkbox__background>.mdc-checkbox__checkmark{transition:opacity 180ms cubic-bezier(0, 0, 0.2, 1),transform 180ms cubic-bezier(0, 0, 0.2, 1);opacity:1}.mat-mdc-list-option .mdc-checkbox__native-control:checked~.mdc-checkbox__background>.mdc-checkbox__mixedmark{transform:scaleX(1) rotate(-45deg)}.mat-mdc-list-option .mdc-checkbox__native-control:indeterminate~.mdc-checkbox__background>.mdc-checkbox__checkmark{transform:rotate(45deg);opacity:0;transition:opacity 90ms cubic-bezier(0.4, 0, 0.6, 1),transform 90ms cubic-bezier(0.4, 0, 0.6, 1)}.mat-mdc-list-option .mdc-checkbox__native-control:indeterminate~.mdc-checkbox__background>.mdc-checkbox__mixedmark{transform:scaleX(1) rotate(0deg);opacity:1}@keyframes mdc-checkbox-unchecked-checked-checkmark-path{0%,50%{stroke-dashoffset:29.7833385}50%{animation-timing-function:cubic-bezier(0, 0, 0.2, 1)}100%{stroke-dashoffset:0}}@keyframes mdc-checkbox-unchecked-indeterminate-mixedmark{0%,68.2%{transform:scaleX(0)}68.2%{animation-timing-function:cubic-bezier(0, 0, 0, 1)}100%{transform:scaleX(1)}}@keyframes mdc-checkbox-checked-unchecked-checkmark-path{from{animation-timing-function:cubic-bezier(0.4, 0, 1, 1);opacity:1;stroke-dashoffset:0}to{opacity:0;stroke-dashoffset:-29.7833385}}@keyframes mdc-checkbox-checked-indeterminate-checkmark{from{animation-timing-function:cubic-bezier(0, 0, 0.2, 1);transform:rotate(0deg);opacity:1}to{transform:rotate(45deg);opacity:0}}@keyframes mdc-checkbox-indeterminate-checked-checkmark{from{animation-timing-function:cubic-bezier(0.14, 0, 0, 1);transform:rotate(45deg);opacity:0}to{transform:rotate(360deg);opacity:1}}@keyframes mdc-checkbox-checked-indeterminate-mixedmark{from{animation-timing-function:cubic-bezier(0, 0, 0.2, 1);transform:rotate(-45deg);opacity:0}to{transform:rotate(0deg);opacity:1}}@keyframes mdc-checkbox-indeterminate-checked-mixedmark{from{animation-timing-function:cubic-bezier(0.14, 0, 0, 1);transform:rotate(0deg);opacity:1}to{transform:rotate(315deg);opacity:0}}@keyframes mdc-checkbox-indeterminate-unchecked-mixedmark{0%{animation-timing-function:linear;transform:scaleX(1);opacity:1}32.8%,100%{transform:scaleX(0);opacity:0}}.mat-mdc-list-option .mdc-radio{display:inline-block;position:relative;flex:0 0 auto;box-sizing:content-box;width:20px;height:20px;cursor:pointer;will-change:opacity,transform,border-color,color;padding:calc((var(--mat-radio-state-layer-size, 40px) - 20px)/2)}.mat-mdc-list-option .mdc-radio__background{display:inline-block;position:relative;box-sizing:border-box;width:20px;height:20px}.mat-mdc-list-option .mdc-radio__background::before{position:absolute;transform:scale(0, 0);border-radius:50%;opacity:0;pointer-events:none;content:"";transition:opacity 90ms cubic-bezier(0.4, 0, 0.6, 1),transform 90ms cubic-bezier(0.4, 0, 0.6, 1);width:var(--mat-radio-state-layer-size, 40px);height:var(--mat-radio-state-layer-size, 40px);top:calc(-1*(var(--mat-radio-state-layer-size, 40px) - 20px)/2);left:calc(-1*(var(--mat-radio-state-layer-size, 40px) - 20px)/2)}.mat-mdc-list-option .mdc-radio__outer-circle{position:absolute;top:0;left:0;box-sizing:border-box;width:100%;height:100%;border-width:2px;border-style:solid;border-radius:50%;transition:border-color 90ms cubic-bezier(0.4, 0, 0.6, 1)}.mat-mdc-list-option .mdc-radio__inner-circle{position:absolute;top:0;left:0;box-sizing:border-box;width:100%;height:100%;transform:scale(0, 0);border-width:10px;border-style:solid;border-radius:50%;transition:transform 90ms cubic-bezier(0.4, 0, 0.6, 1),border-color 90ms cubic-bezier(0.4, 0, 0.6, 1)}.mat-mdc-list-option .mdc-radio__native-control{position:absolute;margin:0;padding:0;opacity:0;top:0;right:0;left:0;cursor:inherit;z-index:1;width:var(--mat-radio-state-layer-size, 40px);height:var(--mat-radio-state-layer-size, 40px)}.mat-mdc-list-option .mdc-radio__native-control:checked+.mdc-radio__background,.mat-mdc-list-option .mdc-radio__native-control:disabled+.mdc-radio__background{transition:opacity 90ms cubic-bezier(0, 0, 0.2, 1),transform 90ms cubic-bezier(0, 0, 0.2, 1)}.mat-mdc-list-option .mdc-radio__native-control:checked+.mdc-radio__background>.mdc-radio__outer-circle,.mat-mdc-list-option .mdc-radio__native-control:disabled+.mdc-radio__background>.mdc-radio__outer-circle{transition:border-color 90ms cubic-bezier(0, 0, 0.2, 1)}.mat-mdc-list-option .mdc-radio__native-control:checked+.mdc-radio__background>.mdc-radio__inner-circle,.mat-mdc-list-option .mdc-radio__native-control:disabled+.mdc-radio__background>.mdc-radio__inner-circle{transition:transform 90ms cubic-bezier(0, 0, 0.2, 1),border-color 90ms cubic-bezier(0, 0, 0.2, 1)}.mat-mdc-list-option .mdc-radio__native-control:disabled:not(:checked)+.mdc-radio__background>.mdc-radio__outer-circle{border-color:var(--mat-radio-disabled-unselected-icon-color, var(--mat-sys-on-surface));opacity:var(--mat-radio-disabled-unselected-icon-opacity, 0.38)}.mat-mdc-list-option .mdc-radio__native-control:disabled+.mdc-radio__background{cursor:default}.mat-mdc-list-option .mdc-radio__native-control:disabled+.mdc-radio__background>.mdc-radio__inner-circle,.mat-mdc-list-option .mdc-radio__native-control:disabled+.mdc-radio__background>.mdc-radio__outer-circle{border-color:var(--mat-radio-disabled-selected-icon-color, var(--mat-sys-on-surface));opacity:var(--mat-radio-disabled-selected-icon-opacity, 0.38)}.mat-mdc-list-option .mdc-radio__native-control:enabled:not(:checked)+.mdc-radio__background>.mdc-radio__outer-circle{border-color:var(--mat-radio-unselected-icon-color, var(--mat-sys-on-surface-variant))}.mat-mdc-list-option .mdc-radio__native-control:enabled:checked+.mdc-radio__background>.mdc-radio__outer-circle,.mat-mdc-list-option .mdc-radio__native-control:enabled:checked+.mdc-radio__background>.mdc-radio__inner-circle{border-color:var(--mat-radio-selected-icon-color, var(--mat-sys-primary))}.mat-mdc-list-option .mdc-radio__native-control:checked+.mdc-radio__background>.mdc-radio__inner-circle{transform:scale(0.5);transition:transform 90ms cubic-bezier(0, 0, 0.2, 1),border-color 90ms cubic-bezier(0, 0, 0.2, 1)}.mat-mdc-list-option._mat-animation-noopable .mdc-radio__background::before,.mat-mdc-list-option._mat-animation-noopable .mdc-radio__outer-circle,.mat-mdc-list-option._mat-animation-noopable .mdc-radio__inner-circle{transition:none !important}.mat-mdc-list-option._mat-animation-noopable>.mdc-list-item__start>.mdc-checkbox>.mat-mdc-checkbox-touch-target,.mat-mdc-list-option._mat-animation-noopable>.mdc-list-item__start>.mdc-checkbox>.mdc-checkbox__native-control,.mat-mdc-list-option._mat-animation-noopable>.mdc-list-item__start>.mdc-checkbox>.mdc-checkbox__ripple,.mat-mdc-list-option._mat-animation-noopable>.mdc-list-item__start>.mdc-checkbox>.mat-mdc-checkbox-ripple::before,.mat-mdc-list-option._mat-animation-noopable>.mdc-list-item__start>.mdc-checkbox>.mdc-checkbox__background,.mat-mdc-list-option._mat-animation-noopable>.mdc-list-item__start>.mdc-checkbox>.mdc-checkbox__background>.mdc-checkbox__checkmark,.mat-mdc-list-option._mat-animation-noopable>.mdc-list-item__start>.mdc-checkbox>.mdc-checkbox__background>.mdc-checkbox__checkmark>.mdc-checkbox__checkmark-path,.mat-mdc-list-option._mat-animation-noopable>.mdc-list-item__start>.mdc-checkbox>.mdc-checkbox__background>.mdc-checkbox__mixedmark,.mat-mdc-list-option._mat-animation-noopable>.mdc-list-item__end>.mdc-checkbox>.mat-mdc-checkbox-touch-target,.mat-mdc-list-option._mat-animation-noopable>.mdc-list-item__end>.mdc-checkbox>.mdc-checkbox__native-control,.mat-mdc-list-option._mat-animation-noopable>.mdc-list-item__end>.mdc-checkbox>.mdc-checkbox__ripple,.mat-mdc-list-option._mat-animation-noopable>.mdc-list-item__end>.mdc-checkbox>.mat-mdc-checkbox-ripple::before,.mat-mdc-list-option._mat-animation-noopable>.mdc-list-item__end>.mdc-checkbox>.mdc-checkbox__background,.mat-mdc-list-option._mat-animation-noopable>.mdc-list-item__end>.mdc-checkbox>.mdc-checkbox__background>.mdc-checkbox__checkmark,.mat-mdc-list-option._mat-animation-noopable>.mdc-list-item__end>.mdc-checkbox>.mdc-checkbox__background>.mdc-checkbox__checkmark>.mdc-checkbox__checkmark-path,.mat-mdc-list-option._mat-animation-noopable>.mdc-list-item__end>.mdc-checkbox>.mdc-checkbox__background>.mdc-checkbox__mixedmark{transition:none !important;animation:none !important}.mat-mdc-list-option .mdc-checkbox__native-control,.mat-mdc-list-option .mdc-radio__native-control{display:none}@media(forced-colors: active){.mat-mdc-list-option.mdc-list-item--selected::after{content:"";position:absolute;top:50%;right:16px;transform:translateY(-50%);width:10px;height:0;border-bottom:solid 10px;border-radius:10px}.mat-mdc-list-option.mdc-list-item--selected [dir=rtl]::after{right:auto;left:16px}}\n']
    }]
  }], null, {
    _lines: [{
      type: ContentChildren,
      args: [MatListItemLine, {
        descendants: true
      }]
    }],
    _titles: [{
      type: ContentChildren,
      args: [MatListItemTitle, {
        descendants: true
      }]
    }],
    _unscopedContent: [{
      type: ViewChild,
      args: ["unscopedContent"]
    }],
    selectedChange: [{
      type: Output
    }],
    togglePosition: [{
      type: Input
    }],
    checkboxPosition: [{
      type: Input
    }],
    color: [{
      type: Input
    }],
    value: [{
      type: Input
    }],
    selected: [{
      type: Input
    }]
  });
})();
var MatListSubheaderCssMatStyler = class _MatListSubheaderCssMatStyler {
  static \u0275fac = function MatListSubheaderCssMatStyler_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _MatListSubheaderCssMatStyler)();
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _MatListSubheaderCssMatStyler,
    selectors: [["", "mat-subheader", ""], ["", "matSubheader", ""]],
    hostAttrs: [1, "mat-mdc-subheader", "mdc-list-group__subheader"]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatListSubheaderCssMatStyler, [{
    type: Directive,
    args: [{
      selector: "[mat-subheader], [matSubheader]",
      // TODO(mmalerba): MDC's subheader font looks identical to the list item font, figure out why and
      //  make a change in one of the repos to visually distinguish.
      host: {
        "class": "mat-mdc-subheader mdc-list-group__subheader"
      }
    }]
  }], null, null);
})();
var MAT_NAV_LIST = new InjectionToken("MatNavList");
var MatNavList = class _MatNavList extends MatListBase {
  // An navigation list is considered interactive, but does not extend the interactive list
  // base class. We do this because as per MDC, items of interactive lists are only reachable
  // through keyboard shortcuts. We want all items for the navigation list to be reachable
  // through tab key as we do not intend to provide any special accessibility treatment. The
  // accessibility treatment depends on how the end-user will interact with it.
  _isNonInteractive = false;
  static \u0275fac = /* @__PURE__ */ (() => {
    let \u0275MatNavList_BaseFactory;
    return function MatNavList_Factory(__ngFactoryType__) {
      return (\u0275MatNavList_BaseFactory || (\u0275MatNavList_BaseFactory = \u0275\u0275getInheritedFactory(_MatNavList)))(__ngFactoryType__ || _MatNavList);
    };
  })();
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({
    type: _MatNavList,
    selectors: [["mat-nav-list"]],
    hostAttrs: ["role", "navigation", 1, "mat-mdc-nav-list", "mat-mdc-list-base", "mdc-list"],
    exportAs: ["matNavList"],
    features: [\u0275\u0275ProvidersFeature([{
      provide: MatListBase,
      useExisting: _MatNavList
    }]), \u0275\u0275InheritDefinitionFeature],
    ngContentSelectors: _c0,
    decls: 1,
    vars: 0,
    template: function MatNavList_Template(rf, ctx) {
      if (rf & 1) {
        \u0275\u0275projectionDef();
        \u0275\u0275projection(0);
      }
    },
    styles: [_c1],
    encapsulation: 2,
    changeDetection: 0
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatNavList, [{
    type: Component,
    args: [{
      selector: "mat-nav-list",
      exportAs: "matNavList",
      template: "<ng-content></ng-content>",
      host: {
        "class": "mat-mdc-nav-list mat-mdc-list-base mdc-list",
        "role": "navigation"
      },
      encapsulation: ViewEncapsulation.None,
      changeDetection: ChangeDetectionStrategy.OnPush,
      providers: [{
        provide: MatListBase,
        useExisting: MatNavList
      }],
      styles: ['.mdc-list{margin:0;padding:8px 0;list-style-type:none}.mdc-list:focus{outline:none}.mdc-list-item{display:flex;position:relative;justify-content:flex-start;overflow:hidden;padding:0;align-items:stretch;cursor:pointer;padding-left:16px;padding-right:16px;background-color:var(--mat-list-list-item-container-color, transparent);border-radius:var(--mat-list-list-item-container-shape, var(--mat-sys-corner-none))}.mdc-list-item.mdc-list-item--selected{background-color:var(--mat-list-list-item-selected-container-color)}.mdc-list-item:focus{outline:0}.mdc-list-item.mdc-list-item--disabled{cursor:auto}.mdc-list-item.mdc-list-item--with-one-line{height:var(--mat-list-list-item-one-line-container-height, 48px)}.mdc-list-item.mdc-list-item--with-one-line .mdc-list-item__start{align-self:center;margin-top:0}.mdc-list-item.mdc-list-item--with-one-line .mdc-list-item__end{align-self:center;margin-top:0}.mdc-list-item.mdc-list-item--with-two-lines{height:var(--mat-list-list-item-two-line-container-height, 64px)}.mdc-list-item.mdc-list-item--with-two-lines .mdc-list-item__start{align-self:flex-start;margin-top:16px}.mdc-list-item.mdc-list-item--with-two-lines .mdc-list-item__end{align-self:center;margin-top:0}.mdc-list-item.mdc-list-item--with-three-lines{height:var(--mat-list-list-item-three-line-container-height, 88px)}.mdc-list-item.mdc-list-item--with-three-lines .mdc-list-item__start{align-self:flex-start;margin-top:16px}.mdc-list-item.mdc-list-item--with-three-lines .mdc-list-item__end{align-self:flex-start;margin-top:16px}.mdc-list-item.mdc-list-item--selected::before,.mdc-list-item.mdc-list-item--selected:focus::before,.mdc-list-item:not(.mdc-list-item--selected):focus::before{position:absolute;box-sizing:border-box;width:100%;height:100%;top:0;left:0;content:"";pointer-events:none}a.mdc-list-item{color:inherit;text-decoration:none}.mdc-list-item__start{fill:currentColor;flex-shrink:0;pointer-events:none}.mdc-list-item--with-leading-icon .mdc-list-item__start{color:var(--mat-list-list-item-leading-icon-color, var(--mat-sys-on-surface-variant));width:var(--mat-list-list-item-leading-icon-size, 24px);height:var(--mat-list-list-item-leading-icon-size, 24px);margin-left:16px;margin-right:32px}[dir=rtl] .mdc-list-item--with-leading-icon .mdc-list-item__start{margin-left:32px;margin-right:16px}.mdc-list-item--with-leading-icon:hover .mdc-list-item__start{color:var(--mat-list-list-item-hover-leading-icon-color)}.mdc-list-item--with-leading-avatar .mdc-list-item__start{width:var(--mat-list-list-item-leading-avatar-size, 40px);height:var(--mat-list-list-item-leading-avatar-size, 40px);margin-left:16px;margin-right:16px;border-radius:50%}.mdc-list-item--with-leading-avatar .mdc-list-item__start,[dir=rtl] .mdc-list-item--with-leading-avatar .mdc-list-item__start{margin-left:16px;margin-right:16px;border-radius:50%}.mdc-list-item__end{flex-shrink:0;pointer-events:none}.mdc-list-item--with-trailing-meta .mdc-list-item__end{font-family:var(--mat-list-list-item-trailing-supporting-text-font, var(--mat-sys-label-small-font));line-height:var(--mat-list-list-item-trailing-supporting-text-line-height, var(--mat-sys-label-small-line-height));font-size:var(--mat-list-list-item-trailing-supporting-text-size, var(--mat-sys-label-small-size));font-weight:var(--mat-list-list-item-trailing-supporting-text-weight, var(--mat-sys-label-small-weight));letter-spacing:var(--mat-list-list-item-trailing-supporting-text-tracking, var(--mat-sys-label-small-tracking))}.mdc-list-item--with-trailing-icon .mdc-list-item__end{color:var(--mat-list-list-item-trailing-icon-color, var(--mat-sys-on-surface-variant));width:var(--mat-list-list-item-trailing-icon-size, 24px);height:var(--mat-list-list-item-trailing-icon-size, 24px)}.mdc-list-item--with-trailing-icon:hover .mdc-list-item__end{color:var(--mat-list-list-item-hover-trailing-icon-color)}.mdc-list-item.mdc-list-item--with-trailing-meta .mdc-list-item__end{color:var(--mat-list-list-item-trailing-supporting-text-color, var(--mat-sys-on-surface-variant))}.mdc-list-item--selected.mdc-list-item--with-trailing-icon .mdc-list-item__end{color:var(--mat-list-list-item-selected-trailing-icon-color, var(--mat-sys-primary))}.mdc-list-item__content{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;align-self:center;flex:1;pointer-events:none}.mdc-list-item--with-two-lines .mdc-list-item__content,.mdc-list-item--with-three-lines .mdc-list-item__content{align-self:stretch}.mdc-list-item__primary-text{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;color:var(--mat-list-list-item-label-text-color, var(--mat-sys-on-surface));font-family:var(--mat-list-list-item-label-text-font, var(--mat-sys-body-large-font));line-height:var(--mat-list-list-item-label-text-line-height, var(--mat-sys-body-large-line-height));font-size:var(--mat-list-list-item-label-text-size, var(--mat-sys-body-large-size));font-weight:var(--mat-list-list-item-label-text-weight, var(--mat-sys-body-large-weight));letter-spacing:var(--mat-list-list-item-label-text-tracking, var(--mat-sys-body-large-tracking))}.mdc-list-item:hover .mdc-list-item__primary-text{color:var(--mat-list-list-item-hover-label-text-color, var(--mat-sys-on-surface))}.mdc-list-item:focus .mdc-list-item__primary-text{color:var(--mat-list-list-item-focus-label-text-color, var(--mat-sys-on-surface))}.mdc-list-item--with-two-lines .mdc-list-item__primary-text,.mdc-list-item--with-three-lines .mdc-list-item__primary-text{display:block;margin-top:0;line-height:normal;margin-bottom:-20px}.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before,.mdc-list-item--with-three-lines .mdc-list-item__primary-text::before{display:inline-block;width:0;height:28px;content:"";vertical-align:0}.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after,.mdc-list-item--with-three-lines .mdc-list-item__primary-text::after{display:inline-block;width:0;height:20px;content:"";vertical-align:-20px}.mdc-list-item__secondary-text{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:block;margin-top:0;color:var(--mat-list-list-item-supporting-text-color, var(--mat-sys-on-surface-variant));font-family:var(--mat-list-list-item-supporting-text-font, var(--mat-sys-body-medium-font));line-height:var(--mat-list-list-item-supporting-text-line-height, var(--mat-sys-body-medium-line-height));font-size:var(--mat-list-list-item-supporting-text-size, var(--mat-sys-body-medium-size));font-weight:var(--mat-list-list-item-supporting-text-weight, var(--mat-sys-body-medium-weight));letter-spacing:var(--mat-list-list-item-supporting-text-tracking, var(--mat-sys-body-medium-tracking))}.mdc-list-item__secondary-text::before{display:inline-block;width:0;height:20px;content:"";vertical-align:0}.mdc-list-item--with-three-lines .mdc-list-item__secondary-text{white-space:normal;line-height:20px}.mdc-list-item--with-overline .mdc-list-item__secondary-text{white-space:nowrap;line-height:auto}.mdc-list-item--with-leading-radio.mdc-list-item,.mdc-list-item--with-leading-checkbox.mdc-list-item,.mdc-list-item--with-leading-icon.mdc-list-item,.mdc-list-item--with-leading-avatar.mdc-list-item{padding-left:0;padding-right:16px}[dir=rtl] .mdc-list-item--with-leading-radio.mdc-list-item,[dir=rtl] .mdc-list-item--with-leading-checkbox.mdc-list-item,[dir=rtl] .mdc-list-item--with-leading-icon.mdc-list-item,[dir=rtl] .mdc-list-item--with-leading-avatar.mdc-list-item{padding-left:16px;padding-right:0}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines .mdc-list-item__primary-text,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines .mdc-list-item__primary-text,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines .mdc-list-item__primary-text,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines .mdc-list-item__primary-text{display:block;margin-top:0;line-height:normal;margin-bottom:-20px}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before{display:inline-block;width:0;height:32px;content:"";vertical-align:0}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after{display:inline-block;width:0;height:20px;content:"";vertical-align:-20px}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end{display:block;margin-top:0;line-height:normal}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end::before,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end::before,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end::before,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end::before{display:inline-block;width:0;height:32px;content:"";vertical-align:0}.mdc-list-item--with-trailing-icon.mdc-list-item,[dir=rtl] .mdc-list-item--with-trailing-icon.mdc-list-item{padding-left:0;padding-right:0}.mdc-list-item--with-trailing-icon .mdc-list-item__end{margin-left:16px;margin-right:16px}.mdc-list-item--with-trailing-meta.mdc-list-item{padding-left:16px;padding-right:0}[dir=rtl] .mdc-list-item--with-trailing-meta.mdc-list-item{padding-left:0;padding-right:16px}.mdc-list-item--with-trailing-meta .mdc-list-item__end{-webkit-user-select:none;user-select:none;margin-left:28px;margin-right:16px}[dir=rtl] .mdc-list-item--with-trailing-meta .mdc-list-item__end{margin-left:16px;margin-right:28px}.mdc-list-item--with-trailing-meta.mdc-list-item--with-three-lines .mdc-list-item__end,.mdc-list-item--with-trailing-meta.mdc-list-item--with-two-lines .mdc-list-item__end{display:block;line-height:normal;align-self:flex-start;margin-top:0}.mdc-list-item--with-trailing-meta.mdc-list-item--with-three-lines .mdc-list-item__end::before,.mdc-list-item--with-trailing-meta.mdc-list-item--with-two-lines .mdc-list-item__end::before{display:inline-block;width:0;height:28px;content:"";vertical-align:0}.mdc-list-item--with-leading-radio .mdc-list-item__start,.mdc-list-item--with-leading-checkbox .mdc-list-item__start{margin-left:8px;margin-right:24px}[dir=rtl] .mdc-list-item--with-leading-radio .mdc-list-item__start,[dir=rtl] .mdc-list-item--with-leading-checkbox .mdc-list-item__start{margin-left:24px;margin-right:8px}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines .mdc-list-item__start,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines .mdc-list-item__start{align-self:flex-start;margin-top:8px}.mdc-list-item--with-trailing-radio.mdc-list-item,.mdc-list-item--with-trailing-checkbox.mdc-list-item{padding-left:16px;padding-right:0}[dir=rtl] .mdc-list-item--with-trailing-radio.mdc-list-item,[dir=rtl] .mdc-list-item--with-trailing-checkbox.mdc-list-item{padding-left:0;padding-right:16px}.mdc-list-item--with-trailing-radio.mdc-list-item--with-leading-icon,.mdc-list-item--with-trailing-radio.mdc-list-item--with-leading-avatar,.mdc-list-item--with-trailing-checkbox.mdc-list-item--with-leading-icon,.mdc-list-item--with-trailing-checkbox.mdc-list-item--with-leading-avatar{padding-left:0}[dir=rtl] .mdc-list-item--with-trailing-radio.mdc-list-item--with-leading-icon,[dir=rtl] .mdc-list-item--with-trailing-radio.mdc-list-item--with-leading-avatar,[dir=rtl] .mdc-list-item--with-trailing-checkbox.mdc-list-item--with-leading-icon,[dir=rtl] .mdc-list-item--with-trailing-checkbox.mdc-list-item--with-leading-avatar{padding-right:0}.mdc-list-item--with-trailing-radio .mdc-list-item__end,.mdc-list-item--with-trailing-checkbox .mdc-list-item__end{margin-left:24px;margin-right:8px}[dir=rtl] .mdc-list-item--with-trailing-radio .mdc-list-item__end,[dir=rtl] .mdc-list-item--with-trailing-checkbox .mdc-list-item__end{margin-left:8px;margin-right:24px}.mdc-list-item--with-trailing-radio.mdc-list-item--with-three-lines .mdc-list-item__end,.mdc-list-item--with-trailing-checkbox.mdc-list-item--with-three-lines .mdc-list-item__end{align-self:flex-start;margin-top:8px}.mdc-list-group__subheader{margin:.75rem 16px}.mdc-list-item--disabled .mdc-list-item__start,.mdc-list-item--disabled .mdc-list-item__content,.mdc-list-item--disabled .mdc-list-item__end{opacity:1}.mdc-list-item--disabled .mdc-list-item__primary-text,.mdc-list-item--disabled .mdc-list-item__secondary-text{opacity:var(--mat-list-list-item-disabled-label-text-opacity, 0.3)}.mdc-list-item--disabled.mdc-list-item--with-leading-icon .mdc-list-item__start{color:var(--mat-list-list-item-disabled-leading-icon-color, var(--mat-sys-on-surface));opacity:var(--mat-list-list-item-disabled-leading-icon-opacity, 0.38)}.mdc-list-item--disabled.mdc-list-item--with-trailing-icon .mdc-list-item__end{color:var(--mat-list-list-item-disabled-trailing-icon-color, var(--mat-sys-on-surface));opacity:var(--mat-list-list-item-disabled-trailing-icon-opacity, 0.38)}.mat-mdc-list-item.mat-mdc-list-item-both-leading-and-trailing,[dir=rtl] .mat-mdc-list-item.mat-mdc-list-item-both-leading-and-trailing{padding-left:0;padding-right:0}.mdc-list-item.mdc-list-item--disabled .mdc-list-item__primary-text{color:var(--mat-list-list-item-disabled-label-text-color, var(--mat-sys-on-surface))}.mdc-list-item:hover::before{background-color:var(--mat-list-list-item-hover-state-layer-color, var(--mat-sys-on-surface));opacity:var(--mat-list-list-item-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity))}.mdc-list-item.mdc-list-item--disabled::before{background-color:var(--mat-list-list-item-disabled-state-layer-color, var(--mat-sys-on-surface));opacity:var(--mat-list-list-item-disabled-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}.mdc-list-item:focus::before{background-color:var(--mat-list-list-item-focus-state-layer-color, var(--mat-sys-on-surface));opacity:var(--mat-list-list-item-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}.mdc-list-item--disabled .mdc-radio,.mdc-list-item--disabled .mdc-checkbox{opacity:var(--mat-list-list-item-disabled-label-text-opacity, 0.3)}.mdc-list-item--with-leading-avatar .mat-mdc-list-item-avatar{border-radius:var(--mat-list-list-item-leading-avatar-shape, var(--mat-sys-corner-full));background-color:var(--mat-list-list-item-leading-avatar-color, var(--mat-sys-primary-container))}.mat-mdc-list-item-icon{font-size:var(--mat-list-list-item-leading-icon-size, 24px)}@media(forced-colors: active){a.mdc-list-item--activated::after{content:"";position:absolute;top:50%;right:16px;transform:translateY(-50%);width:10px;height:0;border-bottom:solid 10px;border-radius:10px}a.mdc-list-item--activated [dir=rtl]::after{right:auto;left:16px}}.mat-mdc-list-base{display:block}.mat-mdc-list-base .mdc-list-item__start,.mat-mdc-list-base .mdc-list-item__end,.mat-mdc-list-base .mdc-list-item__content{pointer-events:auto}.mat-mdc-list-item,.mat-mdc-list-option{width:100%;box-sizing:border-box;-webkit-tap-highlight-color:rgba(0,0,0,0)}.mat-mdc-list-item:not(.mat-mdc-list-item-interactive),.mat-mdc-list-option:not(.mat-mdc-list-item-interactive){cursor:default}.mat-mdc-list-item .mat-divider-inset,.mat-mdc-list-option .mat-divider-inset{position:absolute;left:0;right:0;bottom:0}.mat-mdc-list-item .mat-mdc-list-item-avatar~.mat-divider-inset,.mat-mdc-list-option .mat-mdc-list-item-avatar~.mat-divider-inset{margin-left:72px}[dir=rtl] .mat-mdc-list-item .mat-mdc-list-item-avatar~.mat-divider-inset,[dir=rtl] .mat-mdc-list-option .mat-mdc-list-item-avatar~.mat-divider-inset{margin-right:72px}.mat-mdc-list-item-interactive::before{top:0;left:0;right:0;bottom:0;position:absolute;content:"";opacity:0;pointer-events:none;border-radius:inherit}.mat-mdc-list-item>.mat-focus-indicator{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}.mat-mdc-list-item:focus>.mat-focus-indicator::before{content:""}.mat-mdc-list-item.mdc-list-item--with-three-lines .mat-mdc-list-item-line.mdc-list-item__secondary-text{white-space:nowrap;line-height:normal}.mat-mdc-list-item.mdc-list-item--with-three-lines .mat-mdc-list-item-unscoped-content.mdc-list-item__secondary-text{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}mat-action-list button{background:none;color:inherit;border:none;font:inherit;outline:inherit;-webkit-tap-highlight-color:rgba(0,0,0,0);text-align:start}mat-action-list button::-moz-focus-inner{border:0}.mdc-list-item--with-leading-icon .mdc-list-item__start{margin-inline-start:var(--mat-list-list-item-leading-icon-start-space, 16px);margin-inline-end:var(--mat-list-list-item-leading-icon-end-space, 16px)}.mat-mdc-nav-list .mat-mdc-list-item{border-radius:var(--mat-list-active-indicator-shape, var(--mat-sys-corner-full));--mat-focus-indicator-border-radius: var(--mat-list-active-indicator-shape, var(--mat-sys-corner-full))}.mat-mdc-nav-list .mat-mdc-list-item.mdc-list-item--activated{background-color:var(--mat-list-active-indicator-color, var(--mat-sys-secondary-container))}\n']
    }]
  }], null, null);
})();
var MAT_SELECTION_LIST_VALUE_ACCESSOR = {
  provide: NG_VALUE_ACCESSOR,
  useExisting: forwardRef(() => MatSelectionList),
  multi: true
};
var MatSelectionListChange = class {
  source;
  options;
  constructor(source, options) {
    this.source = source;
    this.options = options;
  }
};
var MatSelectionList = class _MatSelectionList extends MatListBase {
  _element = inject2(ElementRef);
  _ngZone = inject2(NgZone);
  _renderer = inject2(Renderer2);
  _initialized = false;
  _keyManager;
  _listenerCleanups;
  /** Emits when the list has been destroyed. */
  _destroyed = new Subject();
  /** Whether the list has been destroyed. */
  _isDestroyed;
  /** View to model callback that should be called whenever the selected options change. */
  _onChange = (_4) => {
  };
  _items;
  /** Emits a change event whenever the selected state of an option changes. */
  selectionChange = new EventEmitter();
  /**
   * Theme color of the selection list. This sets the checkbox color for all
   * list options. This API is supported in M2 themes only, it has no effect in
   * M3 themes. For color customization in M3, see https://material.angular.dev/components/list/styling.
   *
   * For information on applying color variants in M3, see
   * https://material.angular.dev/guide/material-2-theming#optional-add-backwards-compatibility-styles-for-color-variants
   */
  color = "accent";
  /**
   * Function used for comparing an option against the selected value when determining which
   * options should appear as selected. The first argument is the value of an options. The second
   * one is a value from the selected value. A boolean must be returned.
   */
  compareWith = (a12, a2) => a12 === a2;
  /** Whether selection is limited to one or multiple items (default multiple). */
  get multiple() {
    return this._multiple;
  }
  set multiple(value) {
    const newValue = coerceBooleanProperty(value);
    if (newValue !== this._multiple) {
      if ((typeof ngDevMode === "undefined" || ngDevMode) && this._initialized) {
        throw new Error("Cannot change `multiple` mode of mat-selection-list after initialization.");
      }
      this._multiple = newValue;
      this.selectedOptions = new SelectionModel(this._multiple, this.selectedOptions.selected);
    }
  }
  _multiple = true;
  /** Whether radio indicator for all list items is hidden. */
  get hideSingleSelectionIndicator() {
    return this._hideSingleSelectionIndicator;
  }
  set hideSingleSelectionIndicator(value) {
    this._hideSingleSelectionIndicator = coerceBooleanProperty(value);
  }
  _hideSingleSelectionIndicator = this._defaultOptions?.hideSingleSelectionIndicator ?? false;
  /** The currently selected options. */
  selectedOptions = new SelectionModel(this._multiple);
  /** Keeps track of the currently-selected value. */
  _value;
  /** View to model callback that should be called if the list or its options lost focus. */
  _onTouched = () => {
  };
  _changeDetectorRef = inject2(ChangeDetectorRef);
  constructor() {
    super();
    this._isNonInteractive = false;
  }
  ngAfterViewInit() {
    this._initialized = true;
    this._setupRovingTabindex();
    this._ngZone.runOutsideAngular(() => {
      this._listenerCleanups = [this._renderer.listen(this._element.nativeElement, "focusin", this._handleFocusin), this._renderer.listen(this._element.nativeElement, "focusout", this._handleFocusout)];
    });
    if (this._value) {
      this._setOptionsFromValues(this._value);
    }
    this._watchForSelectionChange();
  }
  ngOnChanges(changes) {
    const disabledChanges = changes["disabled"];
    const disableRippleChanges = changes["disableRipple"];
    const hideSingleSelectionIndicatorChanges = changes["hideSingleSelectionIndicator"];
    if (disableRippleChanges && !disableRippleChanges.firstChange || disabledChanges && !disabledChanges.firstChange || hideSingleSelectionIndicatorChanges && !hideSingleSelectionIndicatorChanges.firstChange) {
      this._markOptionsForCheck();
    }
  }
  ngOnDestroy() {
    this._keyManager?.destroy();
    this._listenerCleanups?.forEach((current) => current());
    this._destroyed.next();
    this._destroyed.complete();
    this._isDestroyed = true;
  }
  /** Focuses the selection list. */
  focus(options) {
    this._element.nativeElement.focus(options);
  }
  /** Selects all of the options. Returns the options that changed as a result. */
  selectAll() {
    return this._setAllOptionsSelected(true);
  }
  /** Deselects all of the options. Returns the options that changed as a result. */
  deselectAll() {
    return this._setAllOptionsSelected(false);
  }
  /** Reports a value change to the ControlValueAccessor */
  _reportValueChange() {
    if (this.options && !this._isDestroyed) {
      const value = this._getSelectedOptionValues();
      this._onChange(value);
      this._value = value;
    }
  }
  /** Emits a change event if the selected state of an option changed. */
  _emitChangeEvent(options) {
    this.selectionChange.emit(new MatSelectionListChange(this, options));
  }
  /** Implemented as part of ControlValueAccessor. */
  writeValue(values) {
    this._value = values;
    if (this.options) {
      this._setOptionsFromValues(values || []);
    }
  }
  /** Implemented as a part of ControlValueAccessor. */
  setDisabledState(isDisabled) {
    this.disabled = isDisabled;
    this._changeDetectorRef.markForCheck();
    this._markOptionsForCheck();
  }
  /**
   * Whether the *entire* selection list is disabled. When true, each list item is also disabled
   * and each list item is removed from the tab order (has tabindex="-1").
   */
  get disabled() {
    return this._selectionListDisabled();
  }
  set disabled(value) {
    this._selectionListDisabled.set(coerceBooleanProperty(value));
    if (this._selectionListDisabled()) {
      this._keyManager?.setActiveItem(-1);
    }
  }
  _selectionListDisabled = signal(false);
  /** Implemented as part of ControlValueAccessor. */
  registerOnChange(fn) {
    this._onChange = fn;
  }
  /** Implemented as part of ControlValueAccessor. */
  registerOnTouched(fn) {
    this._onTouched = fn;
  }
  /** Watches for changes in the selected state of the options and updates the list accordingly. */
  _watchForSelectionChange() {
    this.selectedOptions.changed.pipe(takeUntil(this._destroyed)).subscribe((event) => {
      for (let item of event.added) {
        item.selected = true;
      }
      for (let item of event.removed) {
        item.selected = false;
      }
      if (!this._containsFocus()) {
        this._resetActiveOption();
      }
    });
  }
  /** Sets the selected options based on the specified values. */
  _setOptionsFromValues(values) {
    this.options.forEach((option) => option._setSelected(false));
    values.forEach((value) => {
      const correspondingOption = this.options.find((option) => {
        return option.selected ? false : this.compareWith(option.value, value);
      });
      if (correspondingOption) {
        correspondingOption._setSelected(true);
      }
    });
  }
  /** Returns the values of the selected options. */
  _getSelectedOptionValues() {
    return this.options.filter((option) => option.selected).map((option) => option.value);
  }
  /** Marks all the options to be checked in the next change detection run. */
  _markOptionsForCheck() {
    if (this.options) {
      this.options.forEach((option) => option._markForCheck());
    }
  }
  /**
   * Sets the selected state on all of the options
   * and emits an event if anything changed.
   */
  _setAllOptionsSelected(isSelected, skipDisabled) {
    const changedOptions = [];
    this.options.forEach((option) => {
      if ((!skipDisabled || !option.disabled) && option._setSelected(isSelected)) {
        changedOptions.push(option);
      }
    });
    if (changedOptions.length) {
      this._reportValueChange();
    }
    return changedOptions;
  }
  // Note: This getter exists for backwards compatibility. The `_items` query list
  // cannot be named `options` as it will be picked up by the interactive list base.
  /** The option components contained within this selection-list. */
  get options() {
    return this._items;
  }
  /** Handles keydown events within the list. */
  _handleKeydown(event) {
    const activeItem = this._keyManager.activeItem;
    if ((event.keyCode === ENTER || event.keyCode === SPACE) && !this._keyManager.isTyping() && activeItem && !activeItem.disabled) {
      event.preventDefault();
      activeItem._toggleOnInteraction();
    } else if (event.keyCode === A && this.multiple && !this._keyManager.isTyping() && hasModifierKey(event, "ctrlKey", "metaKey")) {
      const shouldSelect = this.options.some((option) => !option.disabled && !option.selected);
      event.preventDefault();
      this._emitChangeEvent(this._setAllOptionsSelected(shouldSelect, true));
    } else {
      this._keyManager.onKeydown(event);
    }
  }
  /** Handles focusout events within the list. */
  _handleFocusout = () => {
    setTimeout(() => {
      if (!this._containsFocus()) {
        this._resetActiveOption();
      }
    });
  };
  /** Handles focusin events within the list. */
  _handleFocusin = (event) => {
    if (this.disabled) {
      return;
    }
    const activeIndex = this._items.toArray().findIndex((item) => item._elementRef.nativeElement.contains(event.target));
    if (activeIndex > -1) {
      this._setActiveOption(activeIndex);
    } else {
      this._resetActiveOption();
    }
  };
  /**
   * Sets up the logic for maintaining the roving tabindex.
   *
   * `skipPredicate` determines if key manager should avoid putting a given list item in the tab
   * index. Allow disabled list items to receive focus to align with WAI ARIA recommendation.
   * Normally WAI ARIA's instructions are to exclude disabled items from the tab order, but it
   * makes a few exceptions for compound widgets.
   *
   * From [Developing a Keyboard Interface](
   * https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/):
   *   "For the following composite widget elements, keep them focusable when disabled: Options in a
   *   Listbox..."
   */
  _setupRovingTabindex() {
    this._keyManager = new FocusKeyManager(this._items).withHomeAndEnd().withTypeAhead().withWrap().skipPredicate(() => this.disabled);
    this._resetActiveOption();
    this._keyManager.change.subscribe((activeItemIndex) => this._setActiveOption(activeItemIndex));
    this._items.changes.pipe(takeUntil(this._destroyed)).subscribe(() => {
      const activeItem = this._keyManager.activeItem;
      if (!activeItem || this._items.toArray().indexOf(activeItem) === -1) {
        this._resetActiveOption();
      }
    });
  }
  /**
   * Sets an option as active.
   * @param index Index of the active option. If set to -1, no option will be active.
   */
  _setActiveOption(index) {
    this._items.forEach((item, itemIndex) => item._setTabindex(itemIndex === index ? 0 : -1));
    this._keyManager.updateActiveItem(index);
  }
  /**
   * Resets the active option. When the list is disabled, remove all options from to the tab order.
   * Otherwise, focus the first selected option.
   */
  _resetActiveOption() {
    if (this.disabled) {
      this._setActiveOption(-1);
      return;
    }
    const activeItem = this._items.find((item) => item.selected && !item.disabled) || this._items.first;
    this._setActiveOption(activeItem ? this._items.toArray().indexOf(activeItem) : -1);
  }
  /** Returns whether the focus is currently within the list. */
  _containsFocus() {
    const activeElement = _getFocusedElementPierceShadowDom();
    return activeElement && this._element.nativeElement.contains(activeElement);
  }
  static \u0275fac = function MatSelectionList_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _MatSelectionList)();
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({
    type: _MatSelectionList,
    selectors: [["mat-selection-list"]],
    contentQueries: function MatSelectionList_ContentQueries(rf, ctx, dirIndex) {
      if (rf & 1) {
        \u0275\u0275contentQuery(dirIndex, MatListOption, 5);
      }
      if (rf & 2) {
        let _t;
        \u0275\u0275queryRefresh(_t = \u0275\u0275loadQuery()) && (ctx._items = _t);
      }
    },
    hostAttrs: ["role", "listbox", 1, "mat-mdc-selection-list", "mat-mdc-list-base", "mdc-list"],
    hostVars: 1,
    hostBindings: function MatSelectionList_HostBindings(rf, ctx) {
      if (rf & 1) {
        \u0275\u0275listener("keydown", function MatSelectionList_keydown_HostBindingHandler($event) {
          return ctx._handleKeydown($event);
        });
      }
      if (rf & 2) {
        \u0275\u0275attribute("aria-multiselectable", ctx.multiple);
      }
    },
    inputs: {
      color: "color",
      compareWith: "compareWith",
      multiple: "multiple",
      hideSingleSelectionIndicator: "hideSingleSelectionIndicator",
      disabled: "disabled"
    },
    outputs: {
      selectionChange: "selectionChange"
    },
    exportAs: ["matSelectionList"],
    features: [\u0275\u0275ProvidersFeature([MAT_SELECTION_LIST_VALUE_ACCESSOR, {
      provide: MatListBase,
      useExisting: _MatSelectionList
    }, {
      provide: SELECTION_LIST,
      useExisting: _MatSelectionList
    }]), \u0275\u0275InheritDefinitionFeature, \u0275\u0275NgOnChangesFeature],
    ngContentSelectors: _c0,
    decls: 1,
    vars: 0,
    template: function MatSelectionList_Template(rf, ctx) {
      if (rf & 1) {
        \u0275\u0275projectionDef();
        \u0275\u0275projection(0);
      }
    },
    styles: [_c1],
    encapsulation: 2,
    changeDetection: 0
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatSelectionList, [{
    type: Component,
    args: [{
      selector: "mat-selection-list",
      exportAs: "matSelectionList",
      host: {
        "class": "mat-mdc-selection-list mat-mdc-list-base mdc-list",
        "role": "listbox",
        "[attr.aria-multiselectable]": "multiple",
        "(keydown)": "_handleKeydown($event)"
      },
      template: "<ng-content></ng-content>",
      encapsulation: ViewEncapsulation.None,
      providers: [MAT_SELECTION_LIST_VALUE_ACCESSOR, {
        provide: MatListBase,
        useExisting: MatSelectionList
      }, {
        provide: SELECTION_LIST,
        useExisting: MatSelectionList
      }],
      changeDetection: ChangeDetectionStrategy.OnPush,
      styles: ['.mdc-list{margin:0;padding:8px 0;list-style-type:none}.mdc-list:focus{outline:none}.mdc-list-item{display:flex;position:relative;justify-content:flex-start;overflow:hidden;padding:0;align-items:stretch;cursor:pointer;padding-left:16px;padding-right:16px;background-color:var(--mat-list-list-item-container-color, transparent);border-radius:var(--mat-list-list-item-container-shape, var(--mat-sys-corner-none))}.mdc-list-item.mdc-list-item--selected{background-color:var(--mat-list-list-item-selected-container-color)}.mdc-list-item:focus{outline:0}.mdc-list-item.mdc-list-item--disabled{cursor:auto}.mdc-list-item.mdc-list-item--with-one-line{height:var(--mat-list-list-item-one-line-container-height, 48px)}.mdc-list-item.mdc-list-item--with-one-line .mdc-list-item__start{align-self:center;margin-top:0}.mdc-list-item.mdc-list-item--with-one-line .mdc-list-item__end{align-self:center;margin-top:0}.mdc-list-item.mdc-list-item--with-two-lines{height:var(--mat-list-list-item-two-line-container-height, 64px)}.mdc-list-item.mdc-list-item--with-two-lines .mdc-list-item__start{align-self:flex-start;margin-top:16px}.mdc-list-item.mdc-list-item--with-two-lines .mdc-list-item__end{align-self:center;margin-top:0}.mdc-list-item.mdc-list-item--with-three-lines{height:var(--mat-list-list-item-three-line-container-height, 88px)}.mdc-list-item.mdc-list-item--with-three-lines .mdc-list-item__start{align-self:flex-start;margin-top:16px}.mdc-list-item.mdc-list-item--with-three-lines .mdc-list-item__end{align-self:flex-start;margin-top:16px}.mdc-list-item.mdc-list-item--selected::before,.mdc-list-item.mdc-list-item--selected:focus::before,.mdc-list-item:not(.mdc-list-item--selected):focus::before{position:absolute;box-sizing:border-box;width:100%;height:100%;top:0;left:0;content:"";pointer-events:none}a.mdc-list-item{color:inherit;text-decoration:none}.mdc-list-item__start{fill:currentColor;flex-shrink:0;pointer-events:none}.mdc-list-item--with-leading-icon .mdc-list-item__start{color:var(--mat-list-list-item-leading-icon-color, var(--mat-sys-on-surface-variant));width:var(--mat-list-list-item-leading-icon-size, 24px);height:var(--mat-list-list-item-leading-icon-size, 24px);margin-left:16px;margin-right:32px}[dir=rtl] .mdc-list-item--with-leading-icon .mdc-list-item__start{margin-left:32px;margin-right:16px}.mdc-list-item--with-leading-icon:hover .mdc-list-item__start{color:var(--mat-list-list-item-hover-leading-icon-color)}.mdc-list-item--with-leading-avatar .mdc-list-item__start{width:var(--mat-list-list-item-leading-avatar-size, 40px);height:var(--mat-list-list-item-leading-avatar-size, 40px);margin-left:16px;margin-right:16px;border-radius:50%}.mdc-list-item--with-leading-avatar .mdc-list-item__start,[dir=rtl] .mdc-list-item--with-leading-avatar .mdc-list-item__start{margin-left:16px;margin-right:16px;border-radius:50%}.mdc-list-item__end{flex-shrink:0;pointer-events:none}.mdc-list-item--with-trailing-meta .mdc-list-item__end{font-family:var(--mat-list-list-item-trailing-supporting-text-font, var(--mat-sys-label-small-font));line-height:var(--mat-list-list-item-trailing-supporting-text-line-height, var(--mat-sys-label-small-line-height));font-size:var(--mat-list-list-item-trailing-supporting-text-size, var(--mat-sys-label-small-size));font-weight:var(--mat-list-list-item-trailing-supporting-text-weight, var(--mat-sys-label-small-weight));letter-spacing:var(--mat-list-list-item-trailing-supporting-text-tracking, var(--mat-sys-label-small-tracking))}.mdc-list-item--with-trailing-icon .mdc-list-item__end{color:var(--mat-list-list-item-trailing-icon-color, var(--mat-sys-on-surface-variant));width:var(--mat-list-list-item-trailing-icon-size, 24px);height:var(--mat-list-list-item-trailing-icon-size, 24px)}.mdc-list-item--with-trailing-icon:hover .mdc-list-item__end{color:var(--mat-list-list-item-hover-trailing-icon-color)}.mdc-list-item.mdc-list-item--with-trailing-meta .mdc-list-item__end{color:var(--mat-list-list-item-trailing-supporting-text-color, var(--mat-sys-on-surface-variant))}.mdc-list-item--selected.mdc-list-item--with-trailing-icon .mdc-list-item__end{color:var(--mat-list-list-item-selected-trailing-icon-color, var(--mat-sys-primary))}.mdc-list-item__content{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;align-self:center;flex:1;pointer-events:none}.mdc-list-item--with-two-lines .mdc-list-item__content,.mdc-list-item--with-three-lines .mdc-list-item__content{align-self:stretch}.mdc-list-item__primary-text{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;color:var(--mat-list-list-item-label-text-color, var(--mat-sys-on-surface));font-family:var(--mat-list-list-item-label-text-font, var(--mat-sys-body-large-font));line-height:var(--mat-list-list-item-label-text-line-height, var(--mat-sys-body-large-line-height));font-size:var(--mat-list-list-item-label-text-size, var(--mat-sys-body-large-size));font-weight:var(--mat-list-list-item-label-text-weight, var(--mat-sys-body-large-weight));letter-spacing:var(--mat-list-list-item-label-text-tracking, var(--mat-sys-body-large-tracking))}.mdc-list-item:hover .mdc-list-item__primary-text{color:var(--mat-list-list-item-hover-label-text-color, var(--mat-sys-on-surface))}.mdc-list-item:focus .mdc-list-item__primary-text{color:var(--mat-list-list-item-focus-label-text-color, var(--mat-sys-on-surface))}.mdc-list-item--with-two-lines .mdc-list-item__primary-text,.mdc-list-item--with-three-lines .mdc-list-item__primary-text{display:block;margin-top:0;line-height:normal;margin-bottom:-20px}.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before,.mdc-list-item--with-three-lines .mdc-list-item__primary-text::before{display:inline-block;width:0;height:28px;content:"";vertical-align:0}.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after,.mdc-list-item--with-three-lines .mdc-list-item__primary-text::after{display:inline-block;width:0;height:20px;content:"";vertical-align:-20px}.mdc-list-item__secondary-text{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:block;margin-top:0;color:var(--mat-list-list-item-supporting-text-color, var(--mat-sys-on-surface-variant));font-family:var(--mat-list-list-item-supporting-text-font, var(--mat-sys-body-medium-font));line-height:var(--mat-list-list-item-supporting-text-line-height, var(--mat-sys-body-medium-line-height));font-size:var(--mat-list-list-item-supporting-text-size, var(--mat-sys-body-medium-size));font-weight:var(--mat-list-list-item-supporting-text-weight, var(--mat-sys-body-medium-weight));letter-spacing:var(--mat-list-list-item-supporting-text-tracking, var(--mat-sys-body-medium-tracking))}.mdc-list-item__secondary-text::before{display:inline-block;width:0;height:20px;content:"";vertical-align:0}.mdc-list-item--with-three-lines .mdc-list-item__secondary-text{white-space:normal;line-height:20px}.mdc-list-item--with-overline .mdc-list-item__secondary-text{white-space:nowrap;line-height:auto}.mdc-list-item--with-leading-radio.mdc-list-item,.mdc-list-item--with-leading-checkbox.mdc-list-item,.mdc-list-item--with-leading-icon.mdc-list-item,.mdc-list-item--with-leading-avatar.mdc-list-item{padding-left:0;padding-right:16px}[dir=rtl] .mdc-list-item--with-leading-radio.mdc-list-item,[dir=rtl] .mdc-list-item--with-leading-checkbox.mdc-list-item,[dir=rtl] .mdc-list-item--with-leading-icon.mdc-list-item,[dir=rtl] .mdc-list-item--with-leading-avatar.mdc-list-item{padding-left:16px;padding-right:0}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines .mdc-list-item__primary-text,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines .mdc-list-item__primary-text,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines .mdc-list-item__primary-text,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines .mdc-list-item__primary-text{display:block;margin-top:0;line-height:normal;margin-bottom:-20px}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before{display:inline-block;width:0;height:32px;content:"";vertical-align:0}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after{display:inline-block;width:0;height:20px;content:"";vertical-align:-20px}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end{display:block;margin-top:0;line-height:normal}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end::before,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end::before,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end::before,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end::before{display:inline-block;width:0;height:32px;content:"";vertical-align:0}.mdc-list-item--with-trailing-icon.mdc-list-item,[dir=rtl] .mdc-list-item--with-trailing-icon.mdc-list-item{padding-left:0;padding-right:0}.mdc-list-item--with-trailing-icon .mdc-list-item__end{margin-left:16px;margin-right:16px}.mdc-list-item--with-trailing-meta.mdc-list-item{padding-left:16px;padding-right:0}[dir=rtl] .mdc-list-item--with-trailing-meta.mdc-list-item{padding-left:0;padding-right:16px}.mdc-list-item--with-trailing-meta .mdc-list-item__end{-webkit-user-select:none;user-select:none;margin-left:28px;margin-right:16px}[dir=rtl] .mdc-list-item--with-trailing-meta .mdc-list-item__end{margin-left:16px;margin-right:28px}.mdc-list-item--with-trailing-meta.mdc-list-item--with-three-lines .mdc-list-item__end,.mdc-list-item--with-trailing-meta.mdc-list-item--with-two-lines .mdc-list-item__end{display:block;line-height:normal;align-self:flex-start;margin-top:0}.mdc-list-item--with-trailing-meta.mdc-list-item--with-three-lines .mdc-list-item__end::before,.mdc-list-item--with-trailing-meta.mdc-list-item--with-two-lines .mdc-list-item__end::before{display:inline-block;width:0;height:28px;content:"";vertical-align:0}.mdc-list-item--with-leading-radio .mdc-list-item__start,.mdc-list-item--with-leading-checkbox .mdc-list-item__start{margin-left:8px;margin-right:24px}[dir=rtl] .mdc-list-item--with-leading-radio .mdc-list-item__start,[dir=rtl] .mdc-list-item--with-leading-checkbox .mdc-list-item__start{margin-left:24px;margin-right:8px}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines .mdc-list-item__start,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines .mdc-list-item__start{align-self:flex-start;margin-top:8px}.mdc-list-item--with-trailing-radio.mdc-list-item,.mdc-list-item--with-trailing-checkbox.mdc-list-item{padding-left:16px;padding-right:0}[dir=rtl] .mdc-list-item--with-trailing-radio.mdc-list-item,[dir=rtl] .mdc-list-item--with-trailing-checkbox.mdc-list-item{padding-left:0;padding-right:16px}.mdc-list-item--with-trailing-radio.mdc-list-item--with-leading-icon,.mdc-list-item--with-trailing-radio.mdc-list-item--with-leading-avatar,.mdc-list-item--with-trailing-checkbox.mdc-list-item--with-leading-icon,.mdc-list-item--with-trailing-checkbox.mdc-list-item--with-leading-avatar{padding-left:0}[dir=rtl] .mdc-list-item--with-trailing-radio.mdc-list-item--with-leading-icon,[dir=rtl] .mdc-list-item--with-trailing-radio.mdc-list-item--with-leading-avatar,[dir=rtl] .mdc-list-item--with-trailing-checkbox.mdc-list-item--with-leading-icon,[dir=rtl] .mdc-list-item--with-trailing-checkbox.mdc-list-item--with-leading-avatar{padding-right:0}.mdc-list-item--with-trailing-radio .mdc-list-item__end,.mdc-list-item--with-trailing-checkbox .mdc-list-item__end{margin-left:24px;margin-right:8px}[dir=rtl] .mdc-list-item--with-trailing-radio .mdc-list-item__end,[dir=rtl] .mdc-list-item--with-trailing-checkbox .mdc-list-item__end{margin-left:8px;margin-right:24px}.mdc-list-item--with-trailing-radio.mdc-list-item--with-three-lines .mdc-list-item__end,.mdc-list-item--with-trailing-checkbox.mdc-list-item--with-three-lines .mdc-list-item__end{align-self:flex-start;margin-top:8px}.mdc-list-group__subheader{margin:.75rem 16px}.mdc-list-item--disabled .mdc-list-item__start,.mdc-list-item--disabled .mdc-list-item__content,.mdc-list-item--disabled .mdc-list-item__end{opacity:1}.mdc-list-item--disabled .mdc-list-item__primary-text,.mdc-list-item--disabled .mdc-list-item__secondary-text{opacity:var(--mat-list-list-item-disabled-label-text-opacity, 0.3)}.mdc-list-item--disabled.mdc-list-item--with-leading-icon .mdc-list-item__start{color:var(--mat-list-list-item-disabled-leading-icon-color, var(--mat-sys-on-surface));opacity:var(--mat-list-list-item-disabled-leading-icon-opacity, 0.38)}.mdc-list-item--disabled.mdc-list-item--with-trailing-icon .mdc-list-item__end{color:var(--mat-list-list-item-disabled-trailing-icon-color, var(--mat-sys-on-surface));opacity:var(--mat-list-list-item-disabled-trailing-icon-opacity, 0.38)}.mat-mdc-list-item.mat-mdc-list-item-both-leading-and-trailing,[dir=rtl] .mat-mdc-list-item.mat-mdc-list-item-both-leading-and-trailing{padding-left:0;padding-right:0}.mdc-list-item.mdc-list-item--disabled .mdc-list-item__primary-text{color:var(--mat-list-list-item-disabled-label-text-color, var(--mat-sys-on-surface))}.mdc-list-item:hover::before{background-color:var(--mat-list-list-item-hover-state-layer-color, var(--mat-sys-on-surface));opacity:var(--mat-list-list-item-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity))}.mdc-list-item.mdc-list-item--disabled::before{background-color:var(--mat-list-list-item-disabled-state-layer-color, var(--mat-sys-on-surface));opacity:var(--mat-list-list-item-disabled-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}.mdc-list-item:focus::before{background-color:var(--mat-list-list-item-focus-state-layer-color, var(--mat-sys-on-surface));opacity:var(--mat-list-list-item-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}.mdc-list-item--disabled .mdc-radio,.mdc-list-item--disabled .mdc-checkbox{opacity:var(--mat-list-list-item-disabled-label-text-opacity, 0.3)}.mdc-list-item--with-leading-avatar .mat-mdc-list-item-avatar{border-radius:var(--mat-list-list-item-leading-avatar-shape, var(--mat-sys-corner-full));background-color:var(--mat-list-list-item-leading-avatar-color, var(--mat-sys-primary-container))}.mat-mdc-list-item-icon{font-size:var(--mat-list-list-item-leading-icon-size, 24px)}@media(forced-colors: active){a.mdc-list-item--activated::after{content:"";position:absolute;top:50%;right:16px;transform:translateY(-50%);width:10px;height:0;border-bottom:solid 10px;border-radius:10px}a.mdc-list-item--activated [dir=rtl]::after{right:auto;left:16px}}.mat-mdc-list-base{display:block}.mat-mdc-list-base .mdc-list-item__start,.mat-mdc-list-base .mdc-list-item__end,.mat-mdc-list-base .mdc-list-item__content{pointer-events:auto}.mat-mdc-list-item,.mat-mdc-list-option{width:100%;box-sizing:border-box;-webkit-tap-highlight-color:rgba(0,0,0,0)}.mat-mdc-list-item:not(.mat-mdc-list-item-interactive),.mat-mdc-list-option:not(.mat-mdc-list-item-interactive){cursor:default}.mat-mdc-list-item .mat-divider-inset,.mat-mdc-list-option .mat-divider-inset{position:absolute;left:0;right:0;bottom:0}.mat-mdc-list-item .mat-mdc-list-item-avatar~.mat-divider-inset,.mat-mdc-list-option .mat-mdc-list-item-avatar~.mat-divider-inset{margin-left:72px}[dir=rtl] .mat-mdc-list-item .mat-mdc-list-item-avatar~.mat-divider-inset,[dir=rtl] .mat-mdc-list-option .mat-mdc-list-item-avatar~.mat-divider-inset{margin-right:72px}.mat-mdc-list-item-interactive::before{top:0;left:0;right:0;bottom:0;position:absolute;content:"";opacity:0;pointer-events:none;border-radius:inherit}.mat-mdc-list-item>.mat-focus-indicator{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}.mat-mdc-list-item:focus>.mat-focus-indicator::before{content:""}.mat-mdc-list-item.mdc-list-item--with-three-lines .mat-mdc-list-item-line.mdc-list-item__secondary-text{white-space:nowrap;line-height:normal}.mat-mdc-list-item.mdc-list-item--with-three-lines .mat-mdc-list-item-unscoped-content.mdc-list-item__secondary-text{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}mat-action-list button{background:none;color:inherit;border:none;font:inherit;outline:inherit;-webkit-tap-highlight-color:rgba(0,0,0,0);text-align:start}mat-action-list button::-moz-focus-inner{border:0}.mdc-list-item--with-leading-icon .mdc-list-item__start{margin-inline-start:var(--mat-list-list-item-leading-icon-start-space, 16px);margin-inline-end:var(--mat-list-list-item-leading-icon-end-space, 16px)}.mat-mdc-nav-list .mat-mdc-list-item{border-radius:var(--mat-list-active-indicator-shape, var(--mat-sys-corner-full));--mat-focus-indicator-border-radius: var(--mat-list-active-indicator-shape, var(--mat-sys-corner-full))}.mat-mdc-nav-list .mat-mdc-list-item.mdc-list-item--activated{background-color:var(--mat-list-active-indicator-color, var(--mat-sys-secondary-container))}\n']
    }]
  }], () => [], {
    _items: [{
      type: ContentChildren,
      args: [MatListOption, {
        descendants: true
      }]
    }],
    selectionChange: [{
      type: Output
    }],
    color: [{
      type: Input
    }],
    compareWith: [{
      type: Input
    }],
    multiple: [{
      type: Input
    }],
    hideSingleSelectionIndicator: [{
      type: Input
    }],
    disabled: [{
      type: Input
    }]
  });
})();
var MatListModule = class _MatListModule {
  static \u0275fac = function MatListModule_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _MatListModule)();
  };
  static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
    type: _MatListModule,
    imports: [ObserversModule, MatCommonModule, MatRippleModule, MatPseudoCheckboxModule, MatList, MatActionList, MatNavList, MatSelectionList, MatListItem, MatListOption, MatListSubheaderCssMatStyler, MatListItemAvatar, MatListItemIcon, MatListItemLine, MatListItemTitle, MatListItemMeta],
    exports: [MatList, MatActionList, MatNavList, MatSelectionList, MatListItem, MatListOption, MatListItemAvatar, MatListItemIcon, MatListSubheaderCssMatStyler, MatDividerModule, MatListItemLine, MatListItemTitle, MatListItemMeta]
  });
  static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({
    imports: [ObserversModule, MatCommonModule, MatRippleModule, MatPseudoCheckboxModule, MatDividerModule]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatListModule, [{
    type: NgModule,
    args: [{
      imports: [ObserversModule, MatCommonModule, MatRippleModule, MatPseudoCheckboxModule, MatList, MatActionList, MatNavList, MatSelectionList, MatListItem, MatListOption, MatListSubheaderCssMatStyler, MatListItemAvatar, MatListItemIcon, MatListItemLine, MatListItemTitle, MatListItemMeta],
      exports: [MatList, MatActionList, MatNavList, MatSelectionList, MatListItem, MatListOption, MatListItemAvatar, MatListItemIcon, MatListSubheaderCssMatStyler, MatDividerModule, MatListItemLine, MatListItemTitle, MatListItemMeta]
    }]
  }], null, null);
})();

// node_modules/@angular/cdk/fesm2022/scrolling.mjs
var _c02 = ["contentWrapper"];
var _c12 = ["*"];
var VIRTUAL_SCROLL_STRATEGY = new InjectionToken("VIRTUAL_SCROLL_STRATEGY");
var FixedSizeVirtualScrollStrategy = class {
  _scrolledIndexChange = new Subject();
  /** @docs-private Implemented as part of VirtualScrollStrategy. */
  scrolledIndexChange = this._scrolledIndexChange.pipe(distinctUntilChanged());
  /** The attached viewport. */
  _viewport = null;
  /** The size of the items in the virtually scrolling list. */
  _itemSize;
  /** The minimum amount of buffer rendered beyond the viewport (in pixels). */
  _minBufferPx;
  /** The number of buffer items to render beyond the edge of the viewport (in pixels). */
  _maxBufferPx;
  /**
   * @param itemSize The size of the items in the virtually scrolling list.
   * @param minBufferPx The minimum amount of buffer (in pixels) before needing to render more
   * @param maxBufferPx The amount of buffer (in pixels) to render when rendering more.
   */
  constructor(itemSize, minBufferPx, maxBufferPx) {
    this._itemSize = itemSize;
    this._minBufferPx = minBufferPx;
    this._maxBufferPx = maxBufferPx;
  }
  /**
   * Attaches this scroll strategy to a viewport.
   * @param viewport The viewport to attach this strategy to.
   */
  attach(viewport) {
    this._viewport = viewport;
    this._updateTotalContentSize();
    this._updateRenderedRange();
  }
  /** Detaches this scroll strategy from the currently attached viewport. */
  detach() {
    this._scrolledIndexChange.complete();
    this._viewport = null;
  }
  /**
   * Update the item size and buffer size.
   * @param itemSize The size of the items in the virtually scrolling list.
   * @param minBufferPx The minimum amount of buffer (in pixels) before needing to render more
   * @param maxBufferPx The amount of buffer (in pixels) to render when rendering more.
   */
  updateItemAndBufferSize(itemSize, minBufferPx, maxBufferPx) {
    if (maxBufferPx < minBufferPx && (typeof ngDevMode === "undefined" || ngDevMode)) {
      throw Error("CDK virtual scroll: maxBufferPx must be greater than or equal to minBufferPx");
    }
    this._itemSize = itemSize;
    this._minBufferPx = minBufferPx;
    this._maxBufferPx = maxBufferPx;
    this._updateTotalContentSize();
    this._updateRenderedRange();
  }
  /** @docs-private Implemented as part of VirtualScrollStrategy. */
  onContentScrolled() {
    this._updateRenderedRange();
  }
  /** @docs-private Implemented as part of VirtualScrollStrategy. */
  onDataLengthChanged() {
    this._updateTotalContentSize();
    this._updateRenderedRange();
  }
  /** @docs-private Implemented as part of VirtualScrollStrategy. */
  onContentRendered() {
  }
  /** @docs-private Implemented as part of VirtualScrollStrategy. */
  onRenderedOffsetChanged() {
  }
  /**
   * Scroll to the offset for the given index.
   * @param index The index of the element to scroll to.
   * @param behavior The ScrollBehavior to use when scrolling.
   */
  scrollToIndex(index, behavior) {
    if (this._viewport) {
      this._viewport.scrollToOffset(index * this._itemSize, behavior);
    }
  }
  /** Update the viewport's total content size. */
  _updateTotalContentSize() {
    if (!this._viewport) {
      return;
    }
    this._viewport.setTotalContentSize(this._viewport.getDataLength() * this._itemSize);
  }
  /** Update the viewport's rendered range. */
  _updateRenderedRange() {
    if (!this._viewport) {
      return;
    }
    const renderedRange = this._viewport.getRenderedRange();
    const newRange = {
      start: renderedRange.start,
      end: renderedRange.end
    };
    const viewportSize = this._viewport.getViewportSize();
    const dataLength = this._viewport.getDataLength();
    let scrollOffset = this._viewport.measureScrollOffset();
    let firstVisibleIndex = this._itemSize > 0 ? scrollOffset / this._itemSize : 0;
    if (newRange.end > dataLength) {
      const maxVisibleItems = Math.ceil(viewportSize / this._itemSize);
      const newVisibleIndex = Math.max(0, Math.min(firstVisibleIndex, dataLength - maxVisibleItems));
      if (firstVisibleIndex != newVisibleIndex) {
        firstVisibleIndex = newVisibleIndex;
        scrollOffset = newVisibleIndex * this._itemSize;
        newRange.start = Math.floor(firstVisibleIndex);
      }
      newRange.end = Math.max(0, Math.min(dataLength, newRange.start + maxVisibleItems));
    }
    const startBuffer = scrollOffset - newRange.start * this._itemSize;
    if (startBuffer < this._minBufferPx && newRange.start != 0) {
      const expandStart = Math.ceil((this._maxBufferPx - startBuffer) / this._itemSize);
      newRange.start = Math.max(0, newRange.start - expandStart);
      newRange.end = Math.min(dataLength, Math.ceil(firstVisibleIndex + (viewportSize + this._minBufferPx) / this._itemSize));
    } else {
      const endBuffer = newRange.end * this._itemSize - (scrollOffset + viewportSize);
      if (endBuffer < this._minBufferPx && newRange.end != dataLength) {
        const expandEnd = Math.ceil((this._maxBufferPx - endBuffer) / this._itemSize);
        if (expandEnd > 0) {
          newRange.end = Math.min(dataLength, newRange.end + expandEnd);
          newRange.start = Math.max(0, Math.floor(firstVisibleIndex - this._minBufferPx / this._itemSize));
        }
      }
    }
    this._viewport.setRenderedRange(newRange);
    this._viewport.setRenderedContentOffset(this._itemSize * newRange.start);
    this._scrolledIndexChange.next(Math.floor(firstVisibleIndex));
  }
};
function _fixedSizeVirtualScrollStrategyFactory(fixedSizeDir) {
  return fixedSizeDir._scrollStrategy;
}
var CdkFixedSizeVirtualScroll = class _CdkFixedSizeVirtualScroll {
  /** The size of the items in the list (in pixels). */
  get itemSize() {
    return this._itemSize;
  }
  set itemSize(value) {
    this._itemSize = coerceNumberProperty(value);
  }
  _itemSize = 20;
  /**
   * The minimum amount of buffer rendered beyond the viewport (in pixels).
   * If the amount of buffer dips below this number, more items will be rendered. Defaults to 100px.
   */
  get minBufferPx() {
    return this._minBufferPx;
  }
  set minBufferPx(value) {
    this._minBufferPx = coerceNumberProperty(value);
  }
  _minBufferPx = 100;
  /**
   * The number of pixels worth of buffer to render for when rendering new items. Defaults to 200px.
   */
  get maxBufferPx() {
    return this._maxBufferPx;
  }
  set maxBufferPx(value) {
    this._maxBufferPx = coerceNumberProperty(value);
  }
  _maxBufferPx = 200;
  /** The scroll strategy used by this directive. */
  _scrollStrategy = new FixedSizeVirtualScrollStrategy(this.itemSize, this.minBufferPx, this.maxBufferPx);
  ngOnChanges() {
    this._scrollStrategy.updateItemAndBufferSize(this.itemSize, this.minBufferPx, this.maxBufferPx);
  }
  static \u0275fac = function CdkFixedSizeVirtualScroll_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _CdkFixedSizeVirtualScroll)();
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _CdkFixedSizeVirtualScroll,
    selectors: [["cdk-virtual-scroll-viewport", "itemSize", ""]],
    inputs: {
      itemSize: "itemSize",
      minBufferPx: "minBufferPx",
      maxBufferPx: "maxBufferPx"
    },
    features: [\u0275\u0275ProvidersFeature([{
      provide: VIRTUAL_SCROLL_STRATEGY,
      useFactory: _fixedSizeVirtualScrollStrategyFactory,
      deps: [forwardRef(() => _CdkFixedSizeVirtualScroll)]
    }]), \u0275\u0275NgOnChangesFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CdkFixedSizeVirtualScroll, [{
    type: Directive,
    args: [{
      selector: "cdk-virtual-scroll-viewport[itemSize]",
      providers: [{
        provide: VIRTUAL_SCROLL_STRATEGY,
        useFactory: _fixedSizeVirtualScrollStrategyFactory,
        deps: [forwardRef(() => CdkFixedSizeVirtualScroll)]
      }]
    }]
  }], null, {
    itemSize: [{
      type: Input
    }],
    minBufferPx: [{
      type: Input
    }],
    maxBufferPx: [{
      type: Input
    }]
  });
})();
var DEFAULT_SCROLL_TIME = 20;
var ScrollDispatcher = class _ScrollDispatcher {
  _ngZone = inject2(NgZone);
  _platform = inject2(Platform);
  _renderer = inject2(RendererFactory2).createRenderer(null, null);
  _cleanupGlobalListener;
  constructor() {
  }
  /** Subject for notifying that a registered scrollable reference element has been scrolled. */
  _scrolled = new Subject();
  /** Keeps track of the amount of subscriptions to `scrolled`. Used for cleaning up afterwards. */
  _scrolledCount = 0;
  /**
   * Map of all the scrollable references that are registered with the service and their
   * scroll event subscriptions.
   */
  scrollContainers = /* @__PURE__ */ new Map();
  /**
   * Registers a scrollable instance with the service and listens for its scrolled events. When the
   * scrollable is scrolled, the service emits the event to its scrolled observable.
   * @param scrollable Scrollable instance to be registered.
   */
  register(scrollable) {
    if (!this.scrollContainers.has(scrollable)) {
      this.scrollContainers.set(scrollable, scrollable.elementScrolled().subscribe(() => this._scrolled.next(scrollable)));
    }
  }
  /**
   * De-registers a Scrollable reference and unsubscribes from its scroll event observable.
   * @param scrollable Scrollable instance to be deregistered.
   */
  deregister(scrollable) {
    const scrollableReference = this.scrollContainers.get(scrollable);
    if (scrollableReference) {
      scrollableReference.unsubscribe();
      this.scrollContainers.delete(scrollable);
    }
  }
  /**
   * Returns an observable that emits an event whenever any of the registered Scrollable
   * references (or window, document, or body) fire a scrolled event. Can provide a time in ms
   * to override the default "throttle" time.
   *
   * **Note:** in order to avoid hitting change detection for every scroll event,
   * all of the events emitted from this stream will be run outside the Angular zone.
   * If you need to update any data bindings as a result of a scroll event, you have
   * to run the callback using `NgZone.run`.
   */
  scrolled(auditTimeInMs = DEFAULT_SCROLL_TIME) {
    if (!this._platform.isBrowser) {
      return of();
    }
    return new Observable((observer) => {
      if (!this._cleanupGlobalListener) {
        this._cleanupGlobalListener = this._ngZone.runOutsideAngular(() => this._renderer.listen("document", "scroll", () => this._scrolled.next()));
      }
      const subscription = auditTimeInMs > 0 ? this._scrolled.pipe(auditTime(auditTimeInMs)).subscribe(observer) : this._scrolled.subscribe(observer);
      this._scrolledCount++;
      return () => {
        subscription.unsubscribe();
        this._scrolledCount--;
        if (!this._scrolledCount) {
          this._cleanupGlobalListener?.();
          this._cleanupGlobalListener = void 0;
        }
      };
    });
  }
  ngOnDestroy() {
    this._cleanupGlobalListener?.();
    this._cleanupGlobalListener = void 0;
    this.scrollContainers.forEach((_4, container) => this.deregister(container));
    this._scrolled.complete();
  }
  /**
   * Returns an observable that emits whenever any of the
   * scrollable ancestors of an element are scrolled.
   * @param elementOrElementRef Element whose ancestors to listen for.
   * @param auditTimeInMs Time to throttle the scroll events.
   */
  ancestorScrolled(elementOrElementRef, auditTimeInMs) {
    const ancestors = this.getAncestorScrollContainers(elementOrElementRef);
    return this.scrolled(auditTimeInMs).pipe(filter((target) => !target || ancestors.indexOf(target) > -1));
  }
  /** Returns all registered Scrollables that contain the provided element. */
  getAncestorScrollContainers(elementOrElementRef) {
    const scrollingContainers = [];
    this.scrollContainers.forEach((_subscription, scrollable) => {
      if (this._scrollableContainsElement(scrollable, elementOrElementRef)) {
        scrollingContainers.push(scrollable);
      }
    });
    return scrollingContainers;
  }
  /** Returns true if the element is contained within the provided Scrollable. */
  _scrollableContainsElement(scrollable, elementOrElementRef) {
    let element = coerceElement(elementOrElementRef);
    let scrollableElement = scrollable.getElementRef().nativeElement;
    do {
      if (element == scrollableElement) {
        return true;
      }
    } while (element = element.parentElement);
    return false;
  }
  static \u0275fac = function ScrollDispatcher_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _ScrollDispatcher)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _ScrollDispatcher,
    factory: _ScrollDispatcher.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ScrollDispatcher, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], () => [], null);
})();
var CdkScrollable = class _CdkScrollable {
  elementRef = inject2(ElementRef);
  scrollDispatcher = inject2(ScrollDispatcher);
  ngZone = inject2(NgZone);
  dir = inject2(Directionality, {
    optional: true
  });
  _scrollElement = this.elementRef.nativeElement;
  _destroyed = new Subject();
  _renderer = inject2(Renderer2);
  _cleanupScroll;
  _elementScrolled = new Subject();
  constructor() {
  }
  ngOnInit() {
    this._cleanupScroll = this.ngZone.runOutsideAngular(() => this._renderer.listen(this._scrollElement, "scroll", (event) => this._elementScrolled.next(event)));
    this.scrollDispatcher.register(this);
  }
  ngOnDestroy() {
    this._cleanupScroll?.();
    this._elementScrolled.complete();
    this.scrollDispatcher.deregister(this);
    this._destroyed.next();
    this._destroyed.complete();
  }
  /** Returns observable that emits when a scroll event is fired on the host element. */
  elementScrolled() {
    return this._elementScrolled;
  }
  /** Gets the ElementRef for the viewport. */
  getElementRef() {
    return this.elementRef;
  }
  /**
   * Scrolls to the specified offsets. This is a normalized version of the browser's native scrollTo
   * method, since browsers are not consistent about what scrollLeft means in RTL. For this method
   * left and right always refer to the left and right side of the scrolling container irrespective
   * of the layout direction. start and end refer to left and right in an LTR context and vice-versa
   * in an RTL context.
   * @param options specified the offsets to scroll to.
   */
  scrollTo(options) {
    const el = this.elementRef.nativeElement;
    const isRtl = this.dir && this.dir.value == "rtl";
    if (options.left == null) {
      options.left = isRtl ? options.end : options.start;
    }
    if (options.right == null) {
      options.right = isRtl ? options.start : options.end;
    }
    if (options.bottom != null) {
      options.top = el.scrollHeight - el.clientHeight - options.bottom;
    }
    if (isRtl && getRtlScrollAxisType() != RtlScrollAxisType.NORMAL) {
      if (options.left != null) {
        options.right = el.scrollWidth - el.clientWidth - options.left;
      }
      if (getRtlScrollAxisType() == RtlScrollAxisType.INVERTED) {
        options.left = options.right;
      } else if (getRtlScrollAxisType() == RtlScrollAxisType.NEGATED) {
        options.left = options.right ? -options.right : options.right;
      }
    } else {
      if (options.right != null) {
        options.left = el.scrollWidth - el.clientWidth - options.right;
      }
    }
    this._applyScrollToOptions(options);
  }
  _applyScrollToOptions(options) {
    const el = this.elementRef.nativeElement;
    if (supportsScrollBehavior()) {
      el.scrollTo(options);
    } else {
      if (options.top != null) {
        el.scrollTop = options.top;
      }
      if (options.left != null) {
        el.scrollLeft = options.left;
      }
    }
  }
  /**
   * Measures the scroll offset relative to the specified edge of the viewport. This method can be
   * used instead of directly checking scrollLeft or scrollTop, since browsers are not consistent
   * about what scrollLeft means in RTL. The values returned by this method are normalized such that
   * left and right always refer to the left and right side of the scrolling container irrespective
   * of the layout direction. start and end refer to left and right in an LTR context and vice-versa
   * in an RTL context.
   * @param from The edge to measure from.
   */
  measureScrollOffset(from2) {
    const LEFT = "left";
    const RIGHT = "right";
    const el = this.elementRef.nativeElement;
    if (from2 == "top") {
      return el.scrollTop;
    }
    if (from2 == "bottom") {
      return el.scrollHeight - el.clientHeight - el.scrollTop;
    }
    const isRtl = this.dir && this.dir.value == "rtl";
    if (from2 == "start") {
      from2 = isRtl ? RIGHT : LEFT;
    } else if (from2 == "end") {
      from2 = isRtl ? LEFT : RIGHT;
    }
    if (isRtl && getRtlScrollAxisType() == RtlScrollAxisType.INVERTED) {
      if (from2 == LEFT) {
        return el.scrollWidth - el.clientWidth - el.scrollLeft;
      } else {
        return el.scrollLeft;
      }
    } else if (isRtl && getRtlScrollAxisType() == RtlScrollAxisType.NEGATED) {
      if (from2 == LEFT) {
        return el.scrollLeft + el.scrollWidth - el.clientWidth;
      } else {
        return -el.scrollLeft;
      }
    } else {
      if (from2 == LEFT) {
        return el.scrollLeft;
      } else {
        return el.scrollWidth - el.clientWidth - el.scrollLeft;
      }
    }
  }
  static \u0275fac = function CdkScrollable_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _CdkScrollable)();
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _CdkScrollable,
    selectors: [["", "cdk-scrollable", ""], ["", "cdkScrollable", ""]]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CdkScrollable, [{
    type: Directive,
    args: [{
      selector: "[cdk-scrollable], [cdkScrollable]"
    }]
  }], () => [], null);
})();
var DEFAULT_RESIZE_TIME = 20;
var ViewportRuler = class _ViewportRuler {
  _platform = inject2(Platform);
  _listeners;
  /** Cached viewport dimensions. */
  _viewportSize;
  /** Stream of viewport change events. */
  _change = new Subject();
  /** Used to reference correct document/window */
  _document = inject2(DOCUMENT);
  constructor() {
    const ngZone = inject2(NgZone);
    const renderer = inject2(RendererFactory2).createRenderer(null, null);
    ngZone.runOutsideAngular(() => {
      if (this._platform.isBrowser) {
        const changeListener = (event) => this._change.next(event);
        this._listeners = [renderer.listen("window", "resize", changeListener), renderer.listen("window", "orientationchange", changeListener)];
      }
      this.change().subscribe(() => this._viewportSize = null);
    });
  }
  ngOnDestroy() {
    this._listeners?.forEach((cleanup) => cleanup());
    this._change.complete();
  }
  /** Returns the viewport's width and height. */
  getViewportSize() {
    if (!this._viewportSize) {
      this._updateViewportSize();
    }
    const output2 = {
      width: this._viewportSize.width,
      height: this._viewportSize.height
    };
    if (!this._platform.isBrowser) {
      this._viewportSize = null;
    }
    return output2;
  }
  /** Gets a DOMRect for the viewport's bounds. */
  getViewportRect() {
    const scrollPosition = this.getViewportScrollPosition();
    const {
      width,
      height
    } = this.getViewportSize();
    return {
      top: scrollPosition.top,
      left: scrollPosition.left,
      bottom: scrollPosition.top + height,
      right: scrollPosition.left + width,
      height,
      width
    };
  }
  /** Gets the (top, left) scroll position of the viewport. */
  getViewportScrollPosition() {
    if (!this._platform.isBrowser) {
      return {
        top: 0,
        left: 0
      };
    }
    const document2 = this._document;
    const window2 = this._getWindow();
    const documentElement = document2.documentElement;
    const documentRect = documentElement.getBoundingClientRect();
    const top = -documentRect.top || document2.body.scrollTop || window2.scrollY || documentElement.scrollTop || 0;
    const left = -documentRect.left || document2.body.scrollLeft || window2.scrollX || documentElement.scrollLeft || 0;
    return {
      top,
      left
    };
  }
  /**
   * Returns a stream that emits whenever the size of the viewport changes.
   * This stream emits outside of the Angular zone.
   * @param throttleTime Time in milliseconds to throttle the stream.
   */
  change(throttleTime2 = DEFAULT_RESIZE_TIME) {
    return throttleTime2 > 0 ? this._change.pipe(auditTime(throttleTime2)) : this._change;
  }
  /** Use defaultView of injected document if available or fallback to global window reference */
  _getWindow() {
    return this._document.defaultView || window;
  }
  /** Updates the cached viewport size. */
  _updateViewportSize() {
    const window2 = this._getWindow();
    this._viewportSize = this._platform.isBrowser ? {
      width: window2.innerWidth,
      height: window2.innerHeight
    } : {
      width: 0,
      height: 0
    };
  }
  static \u0275fac = function ViewportRuler_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _ViewportRuler)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _ViewportRuler,
    factory: _ViewportRuler.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ViewportRuler, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], () => [], null);
})();
var VIRTUAL_SCROLLABLE = new InjectionToken("VIRTUAL_SCROLLABLE");
var CdkVirtualScrollable = class _CdkVirtualScrollable extends CdkScrollable {
  constructor() {
    super();
  }
  /**
   * Measure the viewport size for the provided orientation.
   *
   * @param orientation The orientation to measure the size from.
   */
  measureViewportSize(orientation) {
    const viewportEl = this.elementRef.nativeElement;
    return orientation === "horizontal" ? viewportEl.clientWidth : viewportEl.clientHeight;
  }
  static \u0275fac = function CdkVirtualScrollable_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _CdkVirtualScrollable)();
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _CdkVirtualScrollable,
    features: [\u0275\u0275InheritDefinitionFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CdkVirtualScrollable, [{
    type: Directive
  }], () => [], null);
})();
function rangesEqual(r12, r2) {
  return r12.start == r2.start && r12.end == r2.end;
}
var SCROLL_SCHEDULER = typeof requestAnimationFrame !== "undefined" ? animationFrameScheduler : asapScheduler;
var CdkVirtualScrollViewport = class _CdkVirtualScrollViewport extends CdkVirtualScrollable {
  elementRef = inject2(ElementRef);
  _changeDetectorRef = inject2(ChangeDetectorRef);
  _scrollStrategy = inject2(VIRTUAL_SCROLL_STRATEGY, {
    optional: true
  });
  scrollable = inject2(VIRTUAL_SCROLLABLE, {
    optional: true
  });
  _platform = inject2(Platform);
  /** Emits when the viewport is detached from a CdkVirtualForOf. */
  _detachedSubject = new Subject();
  /** Emits when the rendered range changes. */
  _renderedRangeSubject = new Subject();
  /** The direction the viewport scrolls. */
  get orientation() {
    return this._orientation;
  }
  set orientation(orientation) {
    if (this._orientation !== orientation) {
      this._orientation = orientation;
      this._calculateSpacerSize();
    }
  }
  _orientation = "vertical";
  /**
   * Whether rendered items should persist in the DOM after scrolling out of view. By default, items
   * will be removed.
   */
  appendOnly = false;
  // Note: we don't use the typical EventEmitter here because we need to subscribe to the scroll
  // strategy lazily (i.e. only if the user is actually listening to the events). We do this because
  // depending on how the strategy calculates the scrolled index, it may come at a cost to
  // performance.
  /** Emits when the index of the first element visible in the viewport changes. */
  scrolledIndexChange = new Observable((observer) => this._scrollStrategy.scrolledIndexChange.subscribe((index) => Promise.resolve().then(() => this.ngZone.run(() => observer.next(index)))));
  /** The element that wraps the rendered content. */
  _contentWrapper;
  /** A stream that emits whenever the rendered range changes. */
  renderedRangeStream = this._renderedRangeSubject;
  /**
   * The total size of all content (in pixels), including content that is not currently rendered.
   */
  _totalContentSize = 0;
  /** A string representing the `style.width` property value to be used for the spacer element. */
  _totalContentWidth = signal("");
  /** A string representing the `style.height` property value to be used for the spacer element. */
  _totalContentHeight = signal("");
  /**
   * The CSS transform applied to the rendered subset of items so that they appear within the bounds
   * of the visible viewport.
   */
  _renderedContentTransform;
  /** The currently rendered range of indices. */
  _renderedRange = {
    start: 0,
    end: 0
  };
  /** The length of the data bound to this viewport (in number of items). */
  _dataLength = 0;
  /** The size of the viewport (in pixels). */
  _viewportSize = 0;
  /** the currently attached CdkVirtualScrollRepeater. */
  _forOf;
  /** The last rendered content offset that was set. */
  _renderedContentOffset = 0;
  /**
   * Whether the last rendered content offset was to the end of the content (and therefore needs to
   * be rewritten as an offset to the start of the content).
   */
  _renderedContentOffsetNeedsRewrite = false;
  _changeDetectionNeeded = signal(false);
  /** A list of functions to run after the next change detection cycle. */
  _runAfterChangeDetection = [];
  /** Subscription to changes in the viewport size. */
  _viewportChanges = Subscription.EMPTY;
  _injector = inject2(Injector);
  _isDestroyed = false;
  constructor() {
    super();
    const viewportRuler = inject2(ViewportRuler);
    if (!this._scrollStrategy && (typeof ngDevMode === "undefined" || ngDevMode)) {
      throw Error('Error: cdk-virtual-scroll-viewport requires the "itemSize" property to be set.');
    }
    this._viewportChanges = viewportRuler.change().subscribe(() => {
      this.checkViewportSize();
    });
    if (!this.scrollable) {
      this.elementRef.nativeElement.classList.add("cdk-virtual-scrollable");
      this.scrollable = this;
    }
    const ref = effect(
      () => {
        if (this._changeDetectionNeeded()) {
          this._doChangeDetection();
        }
      },
      // Using ApplicationRef injector is important here because we want this to be a root
      // effect that runs before change detection of any application views (since we're depending on markForCheck marking parents dirty)
      {
        injector: inject2(ApplicationRef).injector
      }
    );
    inject2(DestroyRef).onDestroy(() => void ref.destroy());
  }
  ngOnInit() {
    if (!this._platform.isBrowser) {
      return;
    }
    if (this.scrollable === this) {
      super.ngOnInit();
    }
    this.ngZone.runOutsideAngular(() => Promise.resolve().then(() => {
      this._measureViewportSize();
      this._scrollStrategy.attach(this);
      this.scrollable.elementScrolled().pipe(
        // Start off with a fake scroll event so we properly detect our initial position.
        startWith(null),
        // Collect multiple events into one until the next animation frame. This way if
        // there are multiple scroll events in the same frame we only need to recheck
        // our layout once.
        auditTime(0, SCROLL_SCHEDULER),
        // Usually `elementScrolled` is completed when the scrollable is destroyed, but
        // that may not be the case if a `CdkVirtualScrollableElement` is used so we have
        // to unsubscribe here just in case.
        takeUntil(this._destroyed)
      ).subscribe(() => this._scrollStrategy.onContentScrolled());
      this._markChangeDetectionNeeded();
    }));
  }
  ngOnDestroy() {
    this.detach();
    this._scrollStrategy.detach();
    this._renderedRangeSubject.complete();
    this._detachedSubject.complete();
    this._viewportChanges.unsubscribe();
    this._isDestroyed = true;
    super.ngOnDestroy();
  }
  /** Attaches a `CdkVirtualScrollRepeater` to this viewport. */
  attach(forOf) {
    if (this._forOf && (typeof ngDevMode === "undefined" || ngDevMode)) {
      throw Error("CdkVirtualScrollViewport is already attached.");
    }
    this.ngZone.runOutsideAngular(() => {
      this._forOf = forOf;
      this._forOf.dataStream.pipe(takeUntil(this._detachedSubject)).subscribe((data) => {
        const newLength = data.length;
        if (newLength !== this._dataLength) {
          this._dataLength = newLength;
          this._scrollStrategy.onDataLengthChanged();
        }
        this._doChangeDetection();
      });
    });
  }
  /** Detaches the current `CdkVirtualForOf`. */
  detach() {
    this._forOf = null;
    this._detachedSubject.next();
  }
  /** Gets the length of the data bound to this viewport (in number of items). */
  getDataLength() {
    return this._dataLength;
  }
  /** Gets the size of the viewport (in pixels). */
  getViewportSize() {
    return this._viewportSize;
  }
  // TODO(mmalerba): This is technically out of sync with what's really rendered until a render
  // cycle happens. I'm being careful to only call it after the render cycle is complete and before
  // setting it to something else, but its error prone and should probably be split into
  // `pendingRange` and `renderedRange`, the latter reflecting whats actually in the DOM.
  /** Get the current rendered range of items. */
  getRenderedRange() {
    return this._renderedRange;
  }
  measureBoundingClientRectWithScrollOffset(from2) {
    return this.getElementRef().nativeElement.getBoundingClientRect()[from2];
  }
  /**
   * Sets the total size of all content (in pixels), including content that is not currently
   * rendered.
   */
  setTotalContentSize(size) {
    if (this._totalContentSize !== size) {
      this._totalContentSize = size;
      this._calculateSpacerSize();
      this._markChangeDetectionNeeded();
    }
  }
  /** Sets the currently rendered range of indices. */
  setRenderedRange(range) {
    if (!rangesEqual(this._renderedRange, range)) {
      if (this.appendOnly) {
        range = {
          start: 0,
          end: Math.max(this._renderedRange.end, range.end)
        };
      }
      this._renderedRangeSubject.next(this._renderedRange = range);
      this._markChangeDetectionNeeded(() => this._scrollStrategy.onContentRendered());
    }
  }
  /**
   * Gets the offset from the start of the viewport to the start of the rendered data (in pixels).
   */
  getOffsetToRenderedContentStart() {
    return this._renderedContentOffsetNeedsRewrite ? null : this._renderedContentOffset;
  }
  /**
   * Sets the offset from the start of the viewport to either the start or end of the rendered data
   * (in pixels).
   */
  setRenderedContentOffset(offset, to = "to-start") {
    offset = this.appendOnly && to === "to-start" ? 0 : offset;
    const isRtl = this.dir && this.dir.value == "rtl";
    const isHorizontal = this.orientation == "horizontal";
    const axis = isHorizontal ? "X" : "Y";
    const axisDirection = isHorizontal && isRtl ? -1 : 1;
    let transform = `translate${axis}(${Number(axisDirection * offset)}px)`;
    this._renderedContentOffset = offset;
    if (to === "to-end") {
      transform += ` translate${axis}(-100%)`;
      this._renderedContentOffsetNeedsRewrite = true;
    }
    if (this._renderedContentTransform != transform) {
      this._renderedContentTransform = transform;
      this._markChangeDetectionNeeded(() => {
        if (this._renderedContentOffsetNeedsRewrite) {
          this._renderedContentOffset -= this.measureRenderedContentSize();
          this._renderedContentOffsetNeedsRewrite = false;
          this.setRenderedContentOffset(this._renderedContentOffset);
        } else {
          this._scrollStrategy.onRenderedOffsetChanged();
        }
      });
    }
  }
  /**
   * Scrolls to the given offset from the start of the viewport. Please note that this is not always
   * the same as setting `scrollTop` or `scrollLeft`. In a horizontal viewport with right-to-left
   * direction, this would be the equivalent of setting a fictional `scrollRight` property.
   * @param offset The offset to scroll to.
   * @param behavior The ScrollBehavior to use when scrolling. Default is behavior is `auto`.
   */
  scrollToOffset(offset, behavior = "auto") {
    const options = {
      behavior
    };
    if (this.orientation === "horizontal") {
      options.start = offset;
    } else {
      options.top = offset;
    }
    this.scrollable.scrollTo(options);
  }
  /**
   * Scrolls to the offset for the given index.
   * @param index The index of the element to scroll to.
   * @param behavior The ScrollBehavior to use when scrolling. Default is behavior is `auto`.
   */
  scrollToIndex(index, behavior = "auto") {
    this._scrollStrategy.scrollToIndex(index, behavior);
  }
  /**
   * Gets the current scroll offset from the start of the scrollable (in pixels).
   * @param from The edge to measure the offset from. Defaults to 'top' in vertical mode and 'start'
   *     in horizontal mode.
   */
  measureScrollOffset(from2) {
    let measureScrollOffset;
    if (this.scrollable == this) {
      measureScrollOffset = (_from) => super.measureScrollOffset(_from);
    } else {
      measureScrollOffset = (_from) => this.scrollable.measureScrollOffset(_from);
    }
    return Math.max(0, measureScrollOffset(from2 ?? (this.orientation === "horizontal" ? "start" : "top")) - this.measureViewportOffset());
  }
  /**
   * Measures the offset of the viewport from the scrolling container
   * @param from The edge to measure from.
   */
  measureViewportOffset(from2) {
    let fromRect;
    const LEFT = "left";
    const RIGHT = "right";
    const isRtl = this.dir?.value == "rtl";
    if (from2 == "start") {
      fromRect = isRtl ? RIGHT : LEFT;
    } else if (from2 == "end") {
      fromRect = isRtl ? LEFT : RIGHT;
    } else if (from2) {
      fromRect = from2;
    } else {
      fromRect = this.orientation === "horizontal" ? "left" : "top";
    }
    const scrollerClientRect = this.scrollable.measureBoundingClientRectWithScrollOffset(fromRect);
    const viewportClientRect = this.elementRef.nativeElement.getBoundingClientRect()[fromRect];
    return viewportClientRect - scrollerClientRect;
  }
  /** Measure the combined size of all of the rendered items. */
  measureRenderedContentSize() {
    const contentEl = this._contentWrapper.nativeElement;
    return this.orientation === "horizontal" ? contentEl.offsetWidth : contentEl.offsetHeight;
  }
  /**
   * Measure the total combined size of the given range. Throws if the range includes items that are
   * not rendered.
   */
  measureRangeSize(range) {
    if (!this._forOf) {
      return 0;
    }
    return this._forOf.measureRangeSize(range, this.orientation);
  }
  /** Update the viewport dimensions and re-render. */
  checkViewportSize() {
    this._measureViewportSize();
    this._scrollStrategy.onDataLengthChanged();
  }
  /** Measure the viewport size. */
  _measureViewportSize() {
    this._viewportSize = this.scrollable.measureViewportSize(this.orientation);
  }
  /** Queue up change detection to run. */
  _markChangeDetectionNeeded(runAfter) {
    if (runAfter) {
      this._runAfterChangeDetection.push(runAfter);
    }
    if (untracked2(this._changeDetectionNeeded)) {
      return;
    }
    this.ngZone.runOutsideAngular(() => {
      Promise.resolve().then(() => {
        this.ngZone.run(() => {
          this._changeDetectionNeeded.set(true);
        });
      });
    });
  }
  /** Run change detection. */
  _doChangeDetection() {
    if (this._isDestroyed) {
      return;
    }
    this.ngZone.run(() => {
      this._changeDetectorRef.markForCheck();
      this._contentWrapper.nativeElement.style.transform = this._renderedContentTransform;
      afterNextRender(() => {
        this._changeDetectionNeeded.set(false);
        const runAfterChangeDetection = this._runAfterChangeDetection;
        this._runAfterChangeDetection = [];
        for (const fn of runAfterChangeDetection) {
          fn();
        }
      }, {
        injector: this._injector
      });
    });
  }
  /** Calculates the `style.width` and `style.height` for the spacer element. */
  _calculateSpacerSize() {
    this._totalContentHeight.set(this.orientation === "horizontal" ? "" : `${this._totalContentSize}px`);
    this._totalContentWidth.set(this.orientation === "horizontal" ? `${this._totalContentSize}px` : "");
  }
  static \u0275fac = function CdkVirtualScrollViewport_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _CdkVirtualScrollViewport)();
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({
    type: _CdkVirtualScrollViewport,
    selectors: [["cdk-virtual-scroll-viewport"]],
    viewQuery: function CdkVirtualScrollViewport_Query(rf, ctx) {
      if (rf & 1) {
        \u0275\u0275viewQuery(_c02, 7);
      }
      if (rf & 2) {
        let _t;
        \u0275\u0275queryRefresh(_t = \u0275\u0275loadQuery()) && (ctx._contentWrapper = _t.first);
      }
    },
    hostAttrs: [1, "cdk-virtual-scroll-viewport"],
    hostVars: 4,
    hostBindings: function CdkVirtualScrollViewport_HostBindings(rf, ctx) {
      if (rf & 2) {
        \u0275\u0275classProp("cdk-virtual-scroll-orientation-horizontal", ctx.orientation === "horizontal")("cdk-virtual-scroll-orientation-vertical", ctx.orientation !== "horizontal");
      }
    },
    inputs: {
      orientation: "orientation",
      appendOnly: [2, "appendOnly", "appendOnly", booleanAttribute]
    },
    outputs: {
      scrolledIndexChange: "scrolledIndexChange"
    },
    features: [\u0275\u0275ProvidersFeature([{
      provide: CdkScrollable,
      useFactory: (virtualScrollable, viewport) => virtualScrollable || viewport,
      deps: [[new Optional(), new Inject(VIRTUAL_SCROLLABLE)], _CdkVirtualScrollViewport]
    }]), \u0275\u0275InheritDefinitionFeature],
    ngContentSelectors: _c12,
    decls: 4,
    vars: 4,
    consts: [["contentWrapper", ""], [1, "cdk-virtual-scroll-content-wrapper"], [1, "cdk-virtual-scroll-spacer"]],
    template: function CdkVirtualScrollViewport_Template(rf, ctx) {
      if (rf & 1) {
        \u0275\u0275projectionDef();
        \u0275\u0275domElementStart(0, "div", 1, 0);
        \u0275\u0275projection(2);
        \u0275\u0275domElementEnd();
        \u0275\u0275domElement(3, "div", 2);
      }
      if (rf & 2) {
        \u0275\u0275advance(3);
        \u0275\u0275styleProp("width", ctx._totalContentWidth())("height", ctx._totalContentHeight());
      }
    },
    styles: ["cdk-virtual-scroll-viewport{display:block;position:relative;transform:translateZ(0)}.cdk-virtual-scrollable{overflow:auto;will-change:scroll-position;contain:strict}.cdk-virtual-scroll-content-wrapper{position:absolute;top:0;left:0;contain:content}[dir=rtl] .cdk-virtual-scroll-content-wrapper{right:0;left:auto}.cdk-virtual-scroll-orientation-horizontal .cdk-virtual-scroll-content-wrapper{min-height:100%}.cdk-virtual-scroll-orientation-horizontal .cdk-virtual-scroll-content-wrapper>dl:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-horizontal .cdk-virtual-scroll-content-wrapper>ol:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-horizontal .cdk-virtual-scroll-content-wrapper>table:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-horizontal .cdk-virtual-scroll-content-wrapper>ul:not([cdkVirtualFor]){padding-left:0;padding-right:0;margin-left:0;margin-right:0;border-left-width:0;border-right-width:0;outline:none}.cdk-virtual-scroll-orientation-vertical .cdk-virtual-scroll-content-wrapper{min-width:100%}.cdk-virtual-scroll-orientation-vertical .cdk-virtual-scroll-content-wrapper>dl:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-vertical .cdk-virtual-scroll-content-wrapper>ol:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-vertical .cdk-virtual-scroll-content-wrapper>table:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-vertical .cdk-virtual-scroll-content-wrapper>ul:not([cdkVirtualFor]){padding-top:0;padding-bottom:0;margin-top:0;margin-bottom:0;border-top-width:0;border-bottom-width:0;outline:none}.cdk-virtual-scroll-spacer{height:1px;transform-origin:0 0;flex:0 0 auto}[dir=rtl] .cdk-virtual-scroll-spacer{transform-origin:100% 0}\n"],
    encapsulation: 2,
    changeDetection: 0
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CdkVirtualScrollViewport, [{
    type: Component,
    args: [{
      selector: "cdk-virtual-scroll-viewport",
      host: {
        "class": "cdk-virtual-scroll-viewport",
        "[class.cdk-virtual-scroll-orientation-horizontal]": 'orientation === "horizontal"',
        "[class.cdk-virtual-scroll-orientation-vertical]": 'orientation !== "horizontal"'
      },
      encapsulation: ViewEncapsulation.None,
      changeDetection: ChangeDetectionStrategy.OnPush,
      providers: [{
        provide: CdkScrollable,
        useFactory: (virtualScrollable, viewport) => virtualScrollable || viewport,
        deps: [[new Optional(), new Inject(VIRTUAL_SCROLLABLE)], CdkVirtualScrollViewport]
      }],
      template: '<!--\n  Wrap the rendered content in an element that will be used to offset it based on the scroll\n  position.\n-->\n<div #contentWrapper class="cdk-virtual-scroll-content-wrapper">\n  <ng-content></ng-content>\n</div>\n<!--\n  Spacer used to force the scrolling container to the correct size for the *total* number of items\n  so that the scrollbar captures the size of the entire data set.\n-->\n<div class="cdk-virtual-scroll-spacer"\n     [style.width]="_totalContentWidth()" [style.height]="_totalContentHeight()"></div>\n',
      styles: ["cdk-virtual-scroll-viewport{display:block;position:relative;transform:translateZ(0)}.cdk-virtual-scrollable{overflow:auto;will-change:scroll-position;contain:strict}.cdk-virtual-scroll-content-wrapper{position:absolute;top:0;left:0;contain:content}[dir=rtl] .cdk-virtual-scroll-content-wrapper{right:0;left:auto}.cdk-virtual-scroll-orientation-horizontal .cdk-virtual-scroll-content-wrapper{min-height:100%}.cdk-virtual-scroll-orientation-horizontal .cdk-virtual-scroll-content-wrapper>dl:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-horizontal .cdk-virtual-scroll-content-wrapper>ol:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-horizontal .cdk-virtual-scroll-content-wrapper>table:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-horizontal .cdk-virtual-scroll-content-wrapper>ul:not([cdkVirtualFor]){padding-left:0;padding-right:0;margin-left:0;margin-right:0;border-left-width:0;border-right-width:0;outline:none}.cdk-virtual-scroll-orientation-vertical .cdk-virtual-scroll-content-wrapper{min-width:100%}.cdk-virtual-scroll-orientation-vertical .cdk-virtual-scroll-content-wrapper>dl:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-vertical .cdk-virtual-scroll-content-wrapper>ol:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-vertical .cdk-virtual-scroll-content-wrapper>table:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-vertical .cdk-virtual-scroll-content-wrapper>ul:not([cdkVirtualFor]){padding-top:0;padding-bottom:0;margin-top:0;margin-bottom:0;border-top-width:0;border-bottom-width:0;outline:none}.cdk-virtual-scroll-spacer{height:1px;transform-origin:0 0;flex:0 0 auto}[dir=rtl] .cdk-virtual-scroll-spacer{transform-origin:100% 0}\n"]
    }]
  }], () => [], {
    orientation: [{
      type: Input
    }],
    appendOnly: [{
      type: Input,
      args: [{
        transform: booleanAttribute
      }]
    }],
    scrolledIndexChange: [{
      type: Output
    }],
    _contentWrapper: [{
      type: ViewChild,
      args: ["contentWrapper", {
        static: true
      }]
    }]
  });
})();
function getOffset(orientation, direction, node) {
  const el = node;
  if (!el.getBoundingClientRect) {
    return 0;
  }
  const rect = el.getBoundingClientRect();
  if (orientation === "horizontal") {
    return direction === "start" ? rect.left : rect.right;
  }
  return direction === "start" ? rect.top : rect.bottom;
}
var CdkVirtualForOf = class _CdkVirtualForOf {
  _viewContainerRef = inject2(ViewContainerRef);
  _template = inject2(TemplateRef);
  _differs = inject2(IterableDiffers);
  _viewRepeater = inject2(_VIEW_REPEATER_STRATEGY);
  _viewport = inject2(CdkVirtualScrollViewport, {
    skipSelf: true
  });
  /** Emits when the rendered view of the data changes. */
  viewChange = new Subject();
  /** Subject that emits when a new DataSource instance is given. */
  _dataSourceChanges = new Subject();
  /** The DataSource to display. */
  get cdkVirtualForOf() {
    return this._cdkVirtualForOf;
  }
  set cdkVirtualForOf(value) {
    this._cdkVirtualForOf = value;
    if (isDataSource(value)) {
      this._dataSourceChanges.next(value);
    } else {
      this._dataSourceChanges.next(new ArrayDataSource(isObservable(value) ? value : Array.from(value || [])));
    }
  }
  _cdkVirtualForOf;
  /**
   * The `TrackByFunction` to use for tracking changes. The `TrackByFunction` takes the index and
   * the item and produces a value to be used as the item's identity when tracking changes.
   */
  get cdkVirtualForTrackBy() {
    return this._cdkVirtualForTrackBy;
  }
  set cdkVirtualForTrackBy(fn) {
    this._needsUpdate = true;
    this._cdkVirtualForTrackBy = fn ? (index, item) => fn(index + (this._renderedRange ? this._renderedRange.start : 0), item) : void 0;
  }
  _cdkVirtualForTrackBy;
  /** The template used to stamp out new elements. */
  set cdkVirtualForTemplate(value) {
    if (value) {
      this._needsUpdate = true;
      this._template = value;
    }
  }
  /**
   * The size of the cache used to store templates that are not being used for re-use later.
   * Setting the cache size to `0` will disable caching. Defaults to 20 templates.
   */
  get cdkVirtualForTemplateCacheSize() {
    return this._viewRepeater.viewCacheSize;
  }
  set cdkVirtualForTemplateCacheSize(size) {
    this._viewRepeater.viewCacheSize = coerceNumberProperty(size);
  }
  /** Emits whenever the data in the current DataSource changes. */
  dataStream = this._dataSourceChanges.pipe(
    // Start off with null `DataSource`.
    startWith(null),
    // Bundle up the previous and current data sources so we can work with both.
    pairwise(),
    // Use `_changeDataSource` to disconnect from the previous data source and connect to the
    // new one, passing back a stream of data changes which we run through `switchMap` to give
    // us a data stream that emits the latest data from whatever the current `DataSource` is.
    switchMap(([prev, cur]) => this._changeDataSource(prev, cur)),
    // Replay the last emitted data when someone subscribes.
    shareReplay(1)
  );
  /** The differ used to calculate changes to the data. */
  _differ = null;
  /** The most recent data emitted from the DataSource. */
  _data;
  /** The currently rendered items. */
  _renderedItems;
  /** The currently rendered range of indices. */
  _renderedRange;
  /** Whether the rendered data should be updated during the next ngDoCheck cycle. */
  _needsUpdate = false;
  _destroyed = new Subject();
  constructor() {
    const ngZone = inject2(NgZone);
    this.dataStream.subscribe((data) => {
      this._data = data;
      this._onRenderedDataChange();
    });
    this._viewport.renderedRangeStream.pipe(takeUntil(this._destroyed)).subscribe((range) => {
      this._renderedRange = range;
      if (this.viewChange.observers.length) {
        ngZone.run(() => this.viewChange.next(this._renderedRange));
      }
      this._onRenderedDataChange();
    });
    this._viewport.attach(this);
  }
  /**
   * Measures the combined size (width for horizontal orientation, height for vertical) of all items
   * in the specified range. Throws an error if the range includes items that are not currently
   * rendered.
   */
  measureRangeSize(range, orientation) {
    if (range.start >= range.end) {
      return 0;
    }
    if ((range.start < this._renderedRange.start || range.end > this._renderedRange.end) && (typeof ngDevMode === "undefined" || ngDevMode)) {
      throw Error(`Error: attempted to measure an item that isn't rendered.`);
    }
    const renderedStartIndex = range.start - this._renderedRange.start;
    const rangeLen = range.end - range.start;
    let firstNode;
    let lastNode;
    for (let i = 0; i < rangeLen; i++) {
      const view = this._viewContainerRef.get(i + renderedStartIndex);
      if (view && view.rootNodes.length) {
        firstNode = lastNode = view.rootNodes[0];
        break;
      }
    }
    for (let i = rangeLen - 1; i > -1; i--) {
      const view = this._viewContainerRef.get(i + renderedStartIndex);
      if (view && view.rootNodes.length) {
        lastNode = view.rootNodes[view.rootNodes.length - 1];
        break;
      }
    }
    return firstNode && lastNode ? getOffset(orientation, "end", lastNode) - getOffset(orientation, "start", firstNode) : 0;
  }
  ngDoCheck() {
    if (this._differ && this._needsUpdate) {
      const changes = this._differ.diff(this._renderedItems);
      if (!changes) {
        this._updateContext();
      } else {
        this._applyChanges(changes);
      }
      this._needsUpdate = false;
    }
  }
  ngOnDestroy() {
    this._viewport.detach();
    this._dataSourceChanges.next(void 0);
    this._dataSourceChanges.complete();
    this.viewChange.complete();
    this._destroyed.next();
    this._destroyed.complete();
    this._viewRepeater.detach();
  }
  /** React to scroll state changes in the viewport. */
  _onRenderedDataChange() {
    if (!this._renderedRange) {
      return;
    }
    this._renderedItems = this._data.slice(this._renderedRange.start, this._renderedRange.end);
    if (!this._differ) {
      this._differ = this._differs.find(this._renderedItems).create((index, item) => {
        return this.cdkVirtualForTrackBy ? this.cdkVirtualForTrackBy(index, item) : item;
      });
    }
    this._needsUpdate = true;
  }
  /** Swap out one `DataSource` for another. */
  _changeDataSource(oldDs, newDs) {
    if (oldDs) {
      oldDs.disconnect(this);
    }
    this._needsUpdate = true;
    return newDs ? newDs.connect(this) : of();
  }
  /** Update the `CdkVirtualForOfContext` for all views. */
  _updateContext() {
    const count = this._data.length;
    let i = this._viewContainerRef.length;
    while (i--) {
      const view = this._viewContainerRef.get(i);
      view.context.index = this._renderedRange.start + i;
      view.context.count = count;
      this._updateComputedContextProperties(view.context);
      view.detectChanges();
    }
  }
  /** Apply changes to the DOM. */
  _applyChanges(changes) {
    this._viewRepeater.applyChanges(changes, this._viewContainerRef, (record, _adjustedPreviousIndex, currentIndex) => this._getEmbeddedViewArgs(record, currentIndex), (record) => record.item);
    changes.forEachIdentityChange((record) => {
      const view = this._viewContainerRef.get(record.currentIndex);
      view.context.$implicit = record.item;
    });
    const count = this._data.length;
    let i = this._viewContainerRef.length;
    while (i--) {
      const view = this._viewContainerRef.get(i);
      view.context.index = this._renderedRange.start + i;
      view.context.count = count;
      this._updateComputedContextProperties(view.context);
    }
  }
  /** Update the computed properties on the `CdkVirtualForOfContext`. */
  _updateComputedContextProperties(context2) {
    context2.first = context2.index === 0;
    context2.last = context2.index === context2.count - 1;
    context2.even = context2.index % 2 === 0;
    context2.odd = !context2.even;
  }
  _getEmbeddedViewArgs(record, index) {
    return {
      templateRef: this._template,
      context: {
        $implicit: record.item,
        // It's guaranteed that the iterable is not "undefined" or "null" because we only
        // generate views for elements if the "cdkVirtualForOf" iterable has elements.
        cdkVirtualForOf: this._cdkVirtualForOf,
        index: -1,
        count: -1,
        first: false,
        last: false,
        odd: false,
        even: false
      },
      index
    };
  }
  static ngTemplateContextGuard(directive, context2) {
    return true;
  }
  static \u0275fac = function CdkVirtualForOf_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _CdkVirtualForOf)();
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _CdkVirtualForOf,
    selectors: [["", "cdkVirtualFor", "", "cdkVirtualForOf", ""]],
    inputs: {
      cdkVirtualForOf: "cdkVirtualForOf",
      cdkVirtualForTrackBy: "cdkVirtualForTrackBy",
      cdkVirtualForTemplate: "cdkVirtualForTemplate",
      cdkVirtualForTemplateCacheSize: "cdkVirtualForTemplateCacheSize"
    },
    features: [\u0275\u0275ProvidersFeature([{
      provide: _VIEW_REPEATER_STRATEGY,
      useClass: _RecycleViewRepeaterStrategy
    }])]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CdkVirtualForOf, [{
    type: Directive,
    args: [{
      selector: "[cdkVirtualFor][cdkVirtualForOf]",
      providers: [{
        provide: _VIEW_REPEATER_STRATEGY,
        useClass: _RecycleViewRepeaterStrategy
      }]
    }]
  }], () => [], {
    cdkVirtualForOf: [{
      type: Input
    }],
    cdkVirtualForTrackBy: [{
      type: Input
    }],
    cdkVirtualForTemplate: [{
      type: Input
    }],
    cdkVirtualForTemplateCacheSize: [{
      type: Input
    }]
  });
})();
var CdkVirtualScrollableElement = class _CdkVirtualScrollableElement extends CdkVirtualScrollable {
  constructor() {
    super();
  }
  measureBoundingClientRectWithScrollOffset(from2) {
    return this.getElementRef().nativeElement.getBoundingClientRect()[from2] - this.measureScrollOffset(from2);
  }
  static \u0275fac = function CdkVirtualScrollableElement_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _CdkVirtualScrollableElement)();
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _CdkVirtualScrollableElement,
    selectors: [["", "cdkVirtualScrollingElement", ""]],
    hostAttrs: [1, "cdk-virtual-scrollable"],
    features: [\u0275\u0275ProvidersFeature([{
      provide: VIRTUAL_SCROLLABLE,
      useExisting: _CdkVirtualScrollableElement
    }]), \u0275\u0275InheritDefinitionFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CdkVirtualScrollableElement, [{
    type: Directive,
    args: [{
      selector: "[cdkVirtualScrollingElement]",
      providers: [{
        provide: VIRTUAL_SCROLLABLE,
        useExisting: CdkVirtualScrollableElement
      }],
      host: {
        "class": "cdk-virtual-scrollable"
      }
    }]
  }], () => [], null);
})();
var CdkVirtualScrollableWindow = class _CdkVirtualScrollableWindow extends CdkVirtualScrollable {
  constructor() {
    super();
    const document2 = inject2(DOCUMENT);
    this.elementRef = new ElementRef(document2.documentElement);
    this._scrollElement = document2;
  }
  measureBoundingClientRectWithScrollOffset(from2) {
    return this.getElementRef().nativeElement.getBoundingClientRect()[from2];
  }
  static \u0275fac = function CdkVirtualScrollableWindow_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _CdkVirtualScrollableWindow)();
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _CdkVirtualScrollableWindow,
    selectors: [["cdk-virtual-scroll-viewport", "scrollWindow", ""]],
    features: [\u0275\u0275ProvidersFeature([{
      provide: VIRTUAL_SCROLLABLE,
      useExisting: _CdkVirtualScrollableWindow
    }]), \u0275\u0275InheritDefinitionFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CdkVirtualScrollableWindow, [{
    type: Directive,
    args: [{
      selector: "cdk-virtual-scroll-viewport[scrollWindow]",
      providers: [{
        provide: VIRTUAL_SCROLLABLE,
        useExisting: CdkVirtualScrollableWindow
      }]
    }]
  }], () => [], null);
})();
var CdkScrollableModule = class _CdkScrollableModule {
  static \u0275fac = function CdkScrollableModule_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _CdkScrollableModule)();
  };
  static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
    type: _CdkScrollableModule,
    imports: [CdkScrollable],
    exports: [CdkScrollable]
  });
  static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({});
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CdkScrollableModule, [{
    type: NgModule,
    args: [{
      exports: [CdkScrollable],
      imports: [CdkScrollable]
    }]
  }], null, null);
})();
var ScrollingModule = class _ScrollingModule {
  static \u0275fac = function ScrollingModule_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _ScrollingModule)();
  };
  static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
    type: _ScrollingModule,
    imports: [BidiModule, CdkScrollableModule, CdkVirtualScrollViewport, CdkFixedSizeVirtualScroll, CdkVirtualForOf, CdkVirtualScrollableWindow, CdkVirtualScrollableElement],
    exports: [BidiModule, CdkScrollableModule, CdkFixedSizeVirtualScroll, CdkVirtualForOf, CdkVirtualScrollViewport, CdkVirtualScrollableWindow, CdkVirtualScrollableElement]
  });
  static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({
    imports: [BidiModule, CdkScrollableModule, BidiModule, CdkScrollableModule]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ScrollingModule, [{
    type: NgModule,
    args: [{
      imports: [BidiModule, CdkScrollableModule, CdkVirtualScrollViewport, CdkFixedSizeVirtualScroll, CdkVirtualForOf, CdkVirtualScrollableWindow, CdkVirtualScrollableElement],
      exports: [BidiModule, CdkScrollableModule, CdkFixedSizeVirtualScroll, CdkVirtualForOf, CdkVirtualScrollViewport, CdkVirtualScrollableWindow, CdkVirtualScrollableElement]
    }]
  }], null, null);
})();

// src/app/view-settings.model.ts
var ViewSettings = class _ViewSettings {
  _viewsShown = new BehaviorSubject([]);
  viewsShown$ = this._viewsShown.asObservable().pipe(distinctUntilChanged(compareStringArraysOrdered));
  viewsShown = toSignal(this.viewsShown$, { requireSync: true });
  setViewsShown(selected) {
    this._viewsShown.next(selected);
  }
  _keypointsShown = new BehaviorSubject([]);
  keypointsShown$ = this._keypointsShown.asObservable().pipe(distinctUntilChanged(compareStringArraysOrdered));
  keypointsShown = toSignal(this.keypointsShown$, { requireSync: true });
  setKeypointsShown(selected) {
    this._keypointsShown.next(selected);
  }
  _modelsShown = new BehaviorSubject([]);
  modelsShown$ = this._modelsShown.asObservable().pipe(distinctUntilChanged(compareStringArraysOrdered));
  modelsShown = toSignal(this.modelsShown$, { requireSync: true });
  setModelsShown(selected) {
    this._modelsShown.next(selected);
  }
  _modelOptions = new BehaviorSubject([]);
  modelOptions$ = this._modelOptions.asObservable().pipe(distinctUntilChanged(compareStringArraysOrdered));
  modelOptions = toSignal(this.modelOptions$, { requireSync: true });
  setModelOptions(selected) {
    this._modelOptions.next(selected);
  }
  constructor() {
    this.modelOptions$.pipe(takeUntilDestroyed()).subscribe((newOptions) => {
      this._modelsShown.next(this._modelsShown.value.filter((model2) => newOptions.includes(model2)));
    });
  }
  static \u0275fac = function ViewSettings_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _ViewSettings)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _ViewSettings, factory: _ViewSettings.\u0275fac });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ViewSettings, [{
    type: Injectable
  }], () => [], null);
})();

// src/app/modelconf.ts
var backbones = [
  "resnet18",
  "resnet34",
  "resnet50",
  "resnet101",
  "resnet152",
  "resnet50_contrastive",
  "resnet50_animal_apose",
  "resnet50_animal_ap10k",
  "resnet50_human_jhmdb",
  "resnet50_human_res_rle",
  "resnet50_human_top_res",
  "resnet50_human_hand",
  "efficientnet_b0",
  "efficientnet_b1",
  "efficientnet_b2",
  "vits_dino",
  "vitb_dino",
  "vitb_imagenet",
  "vitb_sam"
];
var validMvBackbones = backbones.filter((b) => b.startsWith("vit"));
var ModelType;
(function(ModelType2) {
  ModelType2["SUP"] = "SUP";
  ModelType2["S_SUP"] = "S_SUP";
  ModelType2["SUP_CTX"] = "SUP_CTX";
  ModelType2["S_SUP_CTX"] = "S_SUP_CTX";
})(ModelType || (ModelType = {}));
var modelTypeLabels = {
  [ModelType.SUP]: "Supervised",
  [ModelType.S_SUP]: "Semi-supervised",
  [ModelType.SUP_CTX]: "Supervised Context",
  [ModelType.S_SUP_CTX]: "Semi-supervised Context"
};
function isUnsupervised(value) {
  return value === ModelType.S_SUP || value === ModelType.S_SUP_CTX;
}
var validMvModelTypes = [ModelType.SUP];
var mc_util = class {
  m;
  constructor(m) {
    this.m = m;
  }
  get c() {
    return this.m.config;
  }
  get name() {
    return this.m.model_name;
  }
  get type() {
    if ((this.c.model.losses_to_use?.length ?? 0) > 0) {
      return this.c.model.model_type.endsWith("mhcrnn") ? ModelType.S_SUP_CTX : ModelType.S_SUP;
    } else {
      return this.c.model.model_type.endsWith("mhcrnn") ? ModelType.SUP_CTX : ModelType.SUP;
    }
  }
  get createdAt() {
    return this.m.created_at;
  }
  get status() {
    return this.m.status?.status ?? "";
  }
};

// src/app/utils/pipes.ts
var PathPipe = class _PathPipe {
  transform(value) {
    if (value === null || value === void 0) {
      return "";
    }
    return value.replace(/\//g, " / ");
  }
  static \u0275fac = function PathPipe_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _PathPipe)();
  };
  static \u0275pipe = /* @__PURE__ */ \u0275\u0275definePipe({ name: "path", type: _PathPipe, pure: true });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PathPipe, [{
    type: Pipe,
    args: [{
      name: "path",
      standalone: true
    }]
  }], null, null);
})();
var ModelTypeLabelPipe = class _ModelTypeLabelPipe {
  transform(modelType) {
    return modelTypeLabels[modelType] || modelType.toString();
  }
  static \u0275fac = function ModelTypeLabelPipe_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _ModelTypeLabelPipe)();
  };
  static \u0275pipe = /* @__PURE__ */ \u0275\u0275definePipe({ name: "modelType", type: _ModelTypeLabelPipe, pure: true });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ModelTypeLabelPipe, [{
    type: Pipe,
    args: [{
      name: "modelType",
      standalone: true
    }]
  }], null, null);
})();

// src/app/viewer/viewer-left-panel/viewer-sessions-panel.component.ts
var _forTrack0 = ($index, $item) => $item.key;
function ViewerSessionsPanelComponent_Conditional_1_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275domElement(0, "progress", 1);
  }
}
function ViewerSessionsPanelComponent_Conditional_2_For_2_Template(rf, ctx) {
  if (rf & 1) {
    const _r1 = \u0275\u0275getCurrentView();
    \u0275\u0275domElementStart(0, "li", 4);
    \u0275\u0275domListener("click", function ViewerSessionsPanelComponent_Conditional_2_For_2_Template_li_click_0_listener() {
      const session_r2 = \u0275\u0275restoreView(_r1).$implicit;
      const ctx_r2 = \u0275\u0275nextContext(2);
      return \u0275\u0275resetView(ctx_r2.handleSessionSelect(session_r2));
    })("keydown.enter", function ViewerSessionsPanelComponent_Conditional_2_For_2_Template_li_keydown_enter_0_listener() {
      const session_r2 = \u0275\u0275restoreView(_r1).$implicit;
      const ctx_r2 = \u0275\u0275nextContext(2);
      return \u0275\u0275resetView(ctx_r2.handleSessionSelect(session_r2));
    });
    \u0275\u0275domElementStart(1, "span");
    \u0275\u0275text(2);
    \u0275\u0275pipe(3, "path");
    \u0275\u0275domElementEnd();
    \u0275\u0275domElementStart(4, "span")(5, "span", 5);
    \u0275\u0275text(6, " M");
    \u0275\u0275domElementEnd();
    \u0275\u0275domElementStart(7, "span", 6);
    \u0275\u0275text(8, " M");
    \u0275\u0275domElementEnd()()();
  }
  if (rf & 2) {
    const session_r2 = ctx.$implicit;
    const ctx_r2 = \u0275\u0275nextContext(2);
    \u0275\u0275classProp("bg-sky-700", session_r2.key === ctx_r2.selectedSessionKey());
    \u0275\u0275advance(2);
    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(3, 5, session_r2.relativePath));
    \u0275\u0275advance(3);
    \u0275\u0275domProperty("hidden", !ctx_r2.sessionHasModel1(session_r2.key));
    \u0275\u0275advance(2);
    \u0275\u0275domProperty("hidden", !ctx_r2.sessionHasModel2(session_r2.key));
  }
}
function ViewerSessionsPanelComponent_Conditional_2_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275domElementStart(0, "ul", 2);
    \u0275\u0275repeaterCreate(1, ViewerSessionsPanelComponent_Conditional_2_For_2_Template, 9, 7, "li", 3, _forTrack0);
    \u0275\u0275domElementEnd();
  }
  if (rf & 2) {
    const ctx_r2 = \u0275\u0275nextContext();
    \u0275\u0275advance();
    \u0275\u0275repeater(ctx_r2.sessionService.allSessions());
  }
}
var ViewerSessionsPanelComponent = class _ViewerSessionsPanelComponent {
  sessionService = inject2(SessionService);
  projectInfoService = inject2(ProjectInfoService);
  viewSettings = inject2(ViewSettings, { optional: true });
  showModelAvailableMarkers = input.required(...ngDevMode ? [{ debugName: "showModelAvailableMarkers" }] : []);
  selectedSessionKey = input(...ngDevMode ? [void 0, { debugName: "selectedSessionKey" }] : []);
  selectedSessionChange = output();
  ngOnInit() {
    this.sessionService.loadSessions();
  }
  sessionHasModel1(sessionKey) {
    if (!this.showModelAvailableMarkers())
      return false;
    this.projectInfoService.allModels();
    const model2 = this.viewSettings?.modelsShown()[0];
    const availableModels = this.sessionService.getAvailableModelsForSession(sessionKey);
    if (!model2)
      return availableModels.length > 0;
    return availableModels.includes(model2);
  }
  sessionHasModel2(sessionKey) {
    if (!this.showModelAvailableMarkers())
      return false;
    const model2 = this.viewSettings?.modelsShown()[1];
    if (!model2)
      return false;
    const availableModels = this.sessionService.getAvailableModelsForSession(sessionKey);
    return availableModels.includes(model2);
  }
  handleSessionSelect(session) {
    this.selectedSessionChange.emit(session);
  }
  static \u0275fac = function ViewerSessionsPanelComponent_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _ViewerSessionsPanelComponent)();
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _ViewerSessionsPanelComponent, selectors: [["app-sessions-panel"]], inputs: { showModelAvailableMarkers: [1, "showModelAvailableMarkers"], selectedSessionKey: [1, "selectedSessionKey"] }, outputs: { selectedSessionChange: "selectedSessionChange" }, decls: 3, vars: 1, consts: [[1, "panel-content", "inset-shadow-xs", "inset-shadow-black/30", "overflow-auto", "h-full", "w-full"], [1, "progress", "w-full"], ["tabindex", "0", "role", "listbox", 1, "w-fit", "relative"], ["tabindex", "0", 1, "text-nowrap", "p-1", "block", "hover:bg-base-content/10", "rounded-sm", "flex", "items-center", "justify-between", "cursor-pointer", 3, "bg-sky-700"], ["tabindex", "0", 1, "text-nowrap", "p-1", "block", "hover:bg-base-content/10", "rounded-sm", "flex", "items-center", "justify-between", "cursor-pointer", 3, "click", "keydown.enter"], [1, "text-xs", "text-red-400", "font-bold", "ml-2", 3, "hidden"], [1, "text-xs", "text-green-400", "font-bold", "ml-1", 3, "hidden"]], template: function ViewerSessionsPanelComponent_Template(rf, ctx) {
    if (rf & 1) {
      \u0275\u0275domElementStart(0, "div", 0);
      \u0275\u0275conditionalCreate(1, ViewerSessionsPanelComponent_Conditional_1_Template, 1, 0, "progress", 1)(2, ViewerSessionsPanelComponent_Conditional_2_Template, 3, 0, "ul", 2);
      \u0275\u0275domElementEnd();
    }
    if (rf & 2) {
      \u0275\u0275advance();
      \u0275\u0275conditional(ctx.sessionService.sessionsLoading() ? 1 : 2);
    }
  }, dependencies: [MatListModule, ScrollingModule, PathPipe], styles: ["\n\n[_nghost-%COMP%] {\n  display: flex;\n  flex-direction: column;\n}\n/*# sourceMappingURL=/static/viewer-sessions-panel.component-RA7FRRQH.css.map */"], changeDetection: 0 });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ViewerSessionsPanelComponent, [{
    type: Component,
    args: [{ selector: "app-sessions-panel", imports: [MatListModule, ScrollingModule, PathPipe], changeDetection: ChangeDetectionStrategy.OnPush, template: '<style>\n  :host {\n    display: flex;\n    flex-direction: column;\n  }\n</style>\n<div\n  class="panel-content inset-shadow-xs inset-shadow-black/30 overflow-auto h-full w-full"\n>\n  @if (sessionService.sessionsLoading()) {\n    <progress class="progress w-full"></progress>\n  } @else {\n    <!--panel content-->\n    <ul class="w-fit relative" tabindex="0" role="listbox">\n      @for (session of sessionService.allSessions(); track session.key) {\n        <li\n          tabindex="0"\n          class="text-nowrap p-1 block hover:bg-base-content/10 rounded-sm flex items-center justify-between cursor-pointer"\n          (click)="handleSessionSelect(session)"\n          (keydown.enter)="handleSessionSelect(session)"\n          [class.bg-sky-700]="session.key === selectedSessionKey()"\n        >\n          <span>{{ session.relativePath | path }}</span\n          ><!-- left hand side -->\n          <span>\n            <span\n              class="text-xs text-red-400 font-bold ml-2"\n              [hidden]="!sessionHasModel1(session.key)"\n            >\n              M</span\n            ><!-- right hand side -->\n            <span\n              class="text-xs text-green-400 font-bold ml-1"\n              [hidden]="!sessionHasModel2(session.key)"\n            >\n              M</span\n            ><!-- right hand side -->\n          </span>\n        </li>\n      }\n    </ul>\n  }\n</div>\n', styles: ["/* angular:styles/component:css;57610a478a5bfd76e6329080973a45762bc4d1cb9fcd99a2f3d13f676a65c230;/home/ksikka/lightning-pose-app/web_ui/src/app/viewer/viewer-left-panel/viewer-sessions-panel.component.html */\n:host {\n  display: flex;\n  flex-direction: column;\n}\n/*# sourceMappingURL=/static/viewer-sessions-panel.component-RA7FRRQH.css.map */\n"] }]
  }], null, null);
})();
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(ViewerSessionsPanelComponent, { className: "ViewerSessionsPanelComponent", filePath: "src/app/viewer/viewer-left-panel/viewer-sessions-panel.component.ts", lineNumber: 24 });
})();

// src/app/components/video-player/video-player-state.ts
var VideoPlayerState = class _VideoPlayerState {
  currentTime = new BehaviorSubject(0);
  isPlaying = new BehaviorSubject(false);
  currentTimeSignal;
  currentFrameSignal;
  isPlayingSignal;
  duration = signal(0, ...ngDevMode ? [{ debugName: "duration" }] : []);
  fps = signal(30, ...ngDevMode ? [{ debugName: "fps" }] : []);
  videoPlayers = [];
  // during playback, the animation frame subscription that syncs currentTime.
  syncSubscription = null;
  constructor() {
    this.isPlayingSignal = toSignal(this.isPlaying, { requireSync: true });
    this.currentTimeSignal = toSignal(this.currentTime, { requireSync: true });
    this.currentFrameSignal = computed(() => Math.round(this.currentTimeSignal() * this.fps()), ...ngDevMode ? [{ debugName: "currentFrameSignal" }] : []);
    effect(() => {
      const isPlaying = this.isPlayingSignal();
      untracked2(() => {
        if (isPlaying) {
          this.onPlay();
        } else {
          this.onPause();
        }
      });
    });
    effect(() => {
      this.currentTimeSignal();
      untracked2(() => {
        if (!this.isPlayingSignal()) {
          this.onSeek();
        }
      });
    });
  }
  reset() {
    this.isPlaying.next(false);
    this.currentTime.next(0);
    this.duration.set(0);
  }
  registerVideoPlayer(videoPlayer) {
    this.videoPlayers.push(videoPlayer);
  }
  unregisterVideoPlayer(videoPlayer) {
    const i = this.videoPlayers.indexOf(videoPlayer);
    this.videoPlayers.splice(i, 1);
  }
  onPlay() {
    this.videoPlayers.forEach((videoPlayer) => {
      const el = videoPlayer.videoElement?.nativeElement;
      if (el) {
        el.currentTime = this.currentTime.value;
      }
    });
    this.videoPlayers.forEach((videoPlayer) => {
      videoPlayer.videoElement?.nativeElement.play();
    });
    this.startSyncObservable();
  }
  onPause() {
    this.stopSyncObservable();
    this.videoPlayers.forEach((videoPlayer) => {
      videoPlayer.videoElement?.nativeElement.pause();
    });
    this.videoPlayers.forEach((videoPlayer) => {
      const el = videoPlayer.videoElement?.nativeElement;
      if (el) {
        el.currentTime = this.currentTime.value;
      }
    });
  }
  onSeek() {
    this.videoPlayers.forEach((videoPlayer) => {
      const el = videoPlayer.videoElement?.nativeElement;
      if (!el)
        return;
      el.currentTime = this.currentTimeSignal();
    });
  }
  startSyncObservable() {
    if (this.videoPlayers.length === 0)
      return;
    const primaryPlayer = this.videoPlayers[0];
    this.syncSubscription = timer(0, 0, animationFrameScheduler).pipe(map(() => {
      const el = primaryPlayer.videoElement?.nativeElement;
      return el ? el.currentTime : null;
    })).subscribe((time) => {
      if (time !== null) {
        this.currentTime.next(time);
      }
    });
  }
  stopSyncObservable() {
    if (this.syncSubscription) {
      this.syncSubscription.unsubscribe();
      this.syncSubscription = null;
    }
  }
  static \u0275fac = function VideoPlayerState_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _VideoPlayerState)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _VideoPlayerState, factory: _VideoPlayerState.\u0275fac });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(VideoPlayerState, [{
    type: Injectable
  }], () => [], null);
})();

// src/app/components/video-player/video-player-controls/video-player-controls.component.ts
function VideoPlayerControlsComponent_Conditional_2_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275domElementStart(0, "span", 3);
    \u0275\u0275text(1, "pause");
    \u0275\u0275domElementEnd();
  }
}
function VideoPlayerControlsComponent_Conditional_3_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275domElementStart(0, "span", 3);
    \u0275\u0275text(1, "play_arrow");
    \u0275\u0275domElementEnd();
  }
}
var VideoPlayerControlsComponent = class _VideoPlayerControlsComponent {
  // the main state, injected from parent so it can be easily shared across video players
  videoPlayerState = inject2(VideoPlayerState);
  sliderEventSubject = new BehaviorSubject(0);
  constructor() {
    this.sliderEventSubject.pipe(takeUntilDestroyed()).pipe(throttleTime(0, animationFrameScheduler)).pipe(throttleTime(1e3 / 30, void 0)).subscribe((newValue) => {
      this.videoPlayerState.currentTime.next(Number(newValue));
    });
  }
  // convenience getters
  get isPlaying() {
    return this.videoPlayerState.isPlayingSignal;
  }
  get currentTime() {
    return this.videoPlayerState.currentTimeSignal;
  }
  get currentFrame() {
    return this.videoPlayerState.currentFrameSignal;
  }
  get duration() {
    return this.videoPlayerState.duration;
  }
  get fps() {
    return this.videoPlayerState.fps;
  }
  step = computed(() => 1 / this.fps(), ...ngDevMode ? [{ debugName: "step" }] : []);
  toggleIsPlaying() {
    this.videoPlayerState.isPlaying.next(!this.isPlaying());
  }
  onSliderInput(newValue) {
    this.videoPlayerState.isPlaying.next(false);
    this.sliderEventSubject.next(newValue);
  }
  static \u0275fac = function VideoPlayerControlsComponent_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _VideoPlayerControlsComponent)();
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _VideoPlayerControlsComponent, selectors: [["app-video-player-controls"]], decls: 12, vars: 9, consts: [["rangeInput", ""], [1, "video-controls-container", "p-4"], [1, "btn", 3, "click"], [1, "material-icons"], [1, "time-display", "w-10", "overflow-hidden"], [1, "time-display", "w-10"], ["type", "range", "min", "0", 1, "timestamp-slider", 3, "input", "max", "value", "step"], [1, "time-display"]], template: function VideoPlayerControlsComponent_Template(rf, ctx) {
    if (rf & 1) {
      const _r1 = \u0275\u0275getCurrentView();
      \u0275\u0275domElementStart(0, "div", 1)(1, "button", 2);
      \u0275\u0275domListener("click", function VideoPlayerControlsComponent_Template_button_click_1_listener() {
        \u0275\u0275restoreView(_r1);
        return \u0275\u0275resetView(ctx.toggleIsPlaying());
      });
      \u0275\u0275conditionalCreate(2, VideoPlayerControlsComponent_Conditional_2_Template, 2, 0, "span", 3)(3, VideoPlayerControlsComponent_Conditional_3_Template, 2, 0, "span", 3);
      \u0275\u0275domElementEnd();
      \u0275\u0275domElementStart(4, "span", 4);
      \u0275\u0275text(5);
      \u0275\u0275domElementEnd();
      \u0275\u0275domElementStart(6, "span", 5);
      \u0275\u0275text(7);
      \u0275\u0275domElementEnd();
      \u0275\u0275domElementStart(8, "input", 6, 0);
      \u0275\u0275domListener("input", function VideoPlayerControlsComponent_Template_input_input_8_listener() {
        \u0275\u0275restoreView(_r1);
        const rangeInput_r2 = \u0275\u0275reference(9);
        return \u0275\u0275resetView(ctx.onSliderInput(rangeInput_r2.value));
      });
      \u0275\u0275domElementEnd();
      \u0275\u0275domElementStart(10, "span", 7);
      \u0275\u0275text(11);
      \u0275\u0275domElementEnd()();
    }
    if (rf & 2) {
      \u0275\u0275advance(2);
      \u0275\u0275conditional(ctx.isPlaying() ? 2 : 3);
      \u0275\u0275advance(3);
      \u0275\u0275textInterpolate(ctx.currentTime());
      \u0275\u0275advance(2);
      \u0275\u0275textInterpolate(ctx.currentFrame());
      \u0275\u0275advance();
      \u0275\u0275domProperty("max", \u0275\u0275interpolate(ctx.duration()))("step", \u0275\u0275interpolate(ctx.step()))("value", ctx.currentTime());
      \u0275\u0275advance(3);
      \u0275\u0275textInterpolate1("", ctx.duration(), "s");
    }
  }, styles: ["\n\n.video-controls-container[_ngcontent-%COMP%] {\n  display: flex;\n  align-items: center;\n  background-color: var(--color-base-100);\n  gap: 10px;\n}\n.timestamp-slider[_ngcontent-%COMP%] {\n  flex-grow: 1;\n  cursor: pointer;\n}\n.time-display[_ngcontent-%COMP%] {\n  font-family: monospace;\n  font-size: 0.9em;\n  min-width: 50px;\n  text-align: center;\n}\n.video-controls-container[_ngcontent-%COMP%]   button[_ngcontent-%COMP%] {\n  padding: 5px 10px;\n  cursor: pointer;\n}\n/*# sourceMappingURL=/static/video-player-controls.component-C4JZHYJ2.css.map */"], changeDetection: 0 });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(VideoPlayerControlsComponent, [{
    type: Component,
    args: [{ selector: "app-video-player-controls", imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: '<div class="video-controls-container p-4">\n  <button class="btn" (click)="toggleIsPlaying()">\n    @if (isPlaying()) {\n      <span class="material-icons">pause</span>\n    } @else {\n      <span class="material-icons">play_arrow</span>\n    }\n  </button>\n  <span class="time-display w-10 overflow-hidden">{{ currentTime() }}</span>\n  <span class="time-display w-10">{{ currentFrame() }}</span>\n  <input\n    #rangeInput\n    type="range"\n    class="timestamp-slider"\n    min="0"\n    max="{{ duration() }}"\n    [value]="currentTime()"\n    (input)="onSliderInput(rangeInput.value)"\n    step="{{ step() }}"\n  />\n  <span class="time-display">{{ duration() }}s</span>\n</div>\n', styles: ["/* src/app/components/video-player/video-player-controls/video-player-controls.component.css */\n.video-controls-container {\n  display: flex;\n  align-items: center;\n  background-color: var(--color-base-100);\n  gap: 10px;\n}\n.timestamp-slider {\n  flex-grow: 1;\n  cursor: pointer;\n}\n.time-display {\n  font-family: monospace;\n  font-size: 0.9em;\n  min-width: 50px;\n  text-align: center;\n}\n.video-controls-container button {\n  padding: 5px 10px;\n  cursor: pointer;\n}\n/*# sourceMappingURL=/static/video-player-controls.component-C4JZHYJ2.css.map */\n"] }]
  }], () => [], null);
})();
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(VideoPlayerControlsComponent, { className: "VideoPlayerControlsComponent", filePath: "src/app/components/video-player/video-player-controls/video-player-controls.component.ts", lineNumber: 18 });
})();

// src/app/components/video-player/video-tile/video-tile.component.ts
var _c03 = ["videoEl"];
var _c13 = ["*"];
var videoErrorMessages = {
  [MediaError.MEDIA_ERR_ABORTED]: "Error: aborted.",
  [MediaError.MEDIA_ERR_NETWORK]: "Error: network error.",
  [MediaError.MEDIA_ERR_DECODE]: "Error: decoding error.",
  [MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED]: "Error: 404 or unsupported video format."
};
var VideoTileComponent = class _VideoTileComponent {
  host;
  videoElement = null;
  src = input("", ...ngDevMode ? [{ debugName: "src" }] : []);
  // Current time of the video element, for displaying for debug info.
  localCurrentTime = signal(0, ...ngDevMode ? [{ debugName: "localCurrentTime" }] : []);
  videoErrorMessage = linkedSignal(() => {
    this.src();
    return "";
  });
  // the main state, injected from parent so it can be easily shared across video players
  videoPlayerState = inject2(VideoPlayerState);
  contentEnd = new EventEmitter();
  constructor(host) {
    this.host = host;
    this.videoPlayerState.registerVideoPlayer(this);
    combineLatest([
      this.videoPlayerState.currentTime,
      this.videoPlayerState.isPlaying
    ]).pipe(takeUntilDestroyed()).subscribe(() => {
      this.updateLocalCurrentTime();
    });
  }
  ngOnInit() {
    const observer = new ResizeObserver(() => {
      this.updateScaleFactorSignal();
    });
    observer.observe(this.host.nativeElement);
  }
  ngOnDestroy() {
    this.videoPlayerState.unregisterVideoPlayer(this);
  }
  videoMetadata = new BehaviorSubject({
    duration: 0,
    width: 0,
    height: 0
  });
  scaleFactor = signal(1, ...ngDevMode ? [{ debugName: "scaleFactor" }] : []);
  // signal to hide content until video inited
  showProjectedContent = signal(false, ...ngDevMode ? [{ debugName: "showProjectedContent" }] : []);
  onVideoTagError() {
    const code = this.videoElement?.nativeElement.error?.code;
    const videoErrorMessage = code ? videoErrorMessages[code] : "Unknown error, check dev logs.";
    this.videoErrorMessage.set(videoErrorMessage);
  }
  onLoadedMetadata() {
    this.videoMetadata.next({
      height: this.videoElement?.nativeElement.videoHeight ?? 1,
      width: this.videoElement?.nativeElement.videoWidth ?? 1,
      duration: this.videoElement?.nativeElement.duration ?? 0
    });
    this.updateScaleFactorSignal();
    this.showProjectedContent.set(true);
  }
  updateScaleFactorSignal() {
    this.scaleFactor.set(this.host.nativeElement.clientWidth / this.videoMetadata.value.width);
  }
  updateLocalCurrentTime() {
    this.localCurrentTime.set(this.videoElement?.nativeElement.currentTime ?? 0);
  }
  onEnd() {
    this.updateLocalCurrentTime();
    this.contentEnd.emit();
  }
  static \u0275fac = function VideoTileComponent_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _VideoTileComponent)(\u0275\u0275directiveInject(ElementRef));
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _VideoTileComponent, selectors: [["app-video-tile"]], viewQuery: function VideoTileComponent_Query(rf, ctx) {
    if (rf & 1) {
      \u0275\u0275viewQuery(_c03, 7);
    }
    if (rf & 2) {
      let _t;
      \u0275\u0275queryRefresh(_t = \u0275\u0275loadQuery()) && (ctx.videoElement = _t.first);
    }
  }, inputs: { src: [1, "src"] }, outputs: { contentEnd: "contentEnd" }, ngContentSelectors: _c13, decls: 10, vars: 7, consts: [["videoEl", ""], [1, "relative", "shadow-lg", "shadow-black/20", "bg-base-200"], ["preload", "auto", "muted", "", 1, "max-w-none", 3, "loadedmetadata", "timeupdate", "ended", "error", "src"], [1, "absolute", "inset-0", "overflow-auto", "p-2"], [1, "text-sm", "text-gray-400", "mt-2"]], template: function VideoTileComponent_Template(rf, ctx) {
    if (rf & 1) {
      const _r1 = \u0275\u0275getCurrentView();
      \u0275\u0275projectionDef();
      \u0275\u0275domElementStart(0, "div", 1)(1, "video", 2, 0);
      \u0275\u0275domListener("loadedmetadata", function VideoTileComponent_Template_video_loadedmetadata_1_listener() {
        \u0275\u0275restoreView(_r1);
        return \u0275\u0275resetView(ctx.onLoadedMetadata());
      })("timeupdate", function VideoTileComponent_Template_video_timeupdate_1_listener() {
        \u0275\u0275restoreView(_r1);
        return \u0275\u0275resetView(ctx.updateLocalCurrentTime());
      })("ended", function VideoTileComponent_Template_video_ended_1_listener() {
        \u0275\u0275restoreView(_r1);
        return \u0275\u0275resetView(ctx.onEnd());
      })("error", function VideoTileComponent_Template_video_error_1_listener() {
        \u0275\u0275restoreView(_r1);
        return \u0275\u0275resetView(ctx.onVideoTagError());
      });
      \u0275\u0275text(3, " Your browser does not support the video tag. ");
      \u0275\u0275domElementEnd();
      \u0275\u0275domElementStart(4, "div");
      \u0275\u0275projection(5);
      \u0275\u0275domElementEnd();
      \u0275\u0275domElementStart(6, "div", 3);
      \u0275\u0275text(7);
      \u0275\u0275domElementStart(8, "p", 4);
      \u0275\u0275text(9);
      \u0275\u0275domElementEnd()()();
    }
    if (rf & 2) {
      \u0275\u0275advance();
      \u0275\u0275domProperty("src", ctx.src(), \u0275\u0275sanitizeUrl);
      \u0275\u0275advance(3);
      \u0275\u0275classProp("invisible", !ctx.showProjectedContent());
      \u0275\u0275advance(2);
      \u0275\u0275classProp("invisible", !ctx.videoErrorMessage());
      \u0275\u0275advance();
      \u0275\u0275textInterpolate1(" ", ctx.videoErrorMessage(), " ");
      \u0275\u0275advance(2);
      \u0275\u0275textInterpolate1("Source: ", ctx.src());
    }
  }, styles: ["\n\n[_nghost-%COMP%] {\n  display: block;\n}\n/*# sourceMappingURL=/static/video-tile.component-XSYKMARQ.css.map */"], changeDetection: 0 });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(VideoTileComponent, [{
    type: Component,
    args: [{ selector: "app-video-tile", imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: '<style>\n  :host {\n    /* Display for angular elements is inline by default.\n  This is a problem when querying the host height, because it ends up being just 0.\n  */\n    display: block;\n  }\n</style>\n\n<div class="relative shadow-lg shadow-black/20 bg-base-200">\n  <!-- bg is visible during loading state -->\n  <!-- wrapper to contain video + keypoints -->\n  <video\n    #videoEl\n    preload="auto"\n    (loadedmetadata)="onLoadedMetadata()"\n    muted\n    (timeupdate)="updateLocalCurrentTime()"\n    (ended)="onEnd()"\n    (error)="onVideoTagError()"\n    [src]="src()"\n    class="max-w-none"\n  >\n    Your browser does not support the video tag.\n  </video>\n  <div [class.invisible]="!showProjectedContent()">\n    <!-- wrapper to hide content until video inited -->\n    <ng-content></ng-content>\n  </div>\n\n  <div\n    class="absolute inset-0 overflow-auto p-2"\n    [class.invisible]="!videoErrorMessage()"\n  >\n    {{ videoErrorMessage() }}\n    <p class="text-sm text-gray-400 mt-2">Source: {{ src() }}</p>\n  </div>\n</div>\n<!--<p>T: {{ localCurrentTime() }}</p>-->\n', styles: ["/* angular:styles/component:css;cca0ce7e24de60b661844ed36e56ee3734a21f5d38966246b6b69d25889a81d9;/home/ksikka/lightning-pose-app/web_ui/src/app/components/video-player/video-tile/video-tile.component.html */\n:host {\n  display: block;\n}\n/*# sourceMappingURL=/static/video-tile.component-XSYKMARQ.css.map */\n"] }]
  }], () => [{ type: ElementRef }], { videoElement: [{
    type: ViewChild,
    args: ["videoEl", { static: true }]
  }], contentEnd: [{
    type: Output
  }] });
})();
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(VideoTileComponent, { className: "VideoTileComponent", filePath: "src/app/components/video-player/video-tile/video-tile.component.ts", lineNumber: 49 });
})();

// src/app/components/keypoint-container/keypoint-container.component.ts
var _c04 = ["containerDiv"];
var _forTrack02 = ($index, $item) => $item.id;
function KeypointContainerComponent_Conditional_2_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275domElementStart(0, "div", 3);
    \u0275\u0275domElement(1, "div", 4)(2, "div", 5);
    \u0275\u0275domElementEnd();
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext();
    \u0275\u0275styleProp("--crosshair-x", ctx_r1.crosshairPosition().x + "px")("--crosshair-y", ctx_r1.crosshairPosition().y + "px");
  }
}
function KeypointContainerComponent_For_4_Conditional_2_Conditional_1_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275domElement(0, "div", 8);
  }
}
function KeypointContainerComponent_For_4_Conditional_2_Template(rf, ctx) {
  if (rf & 1) {
    const _r3 = \u0275\u0275getCurrentView();
    \u0275\u0275domElementStart(0, "div", 7);
    \u0275\u0275domListener("click", function KeypointContainerComponent_For_4_Conditional_2_Template_div_click_0_listener($event) {
      \u0275\u0275restoreView(_r3);
      const keypoint_r4 = \u0275\u0275nextContext().$implicit;
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.handleKeypointClick($event, keypoint_r4));
    })("keydown.enter", function KeypointContainerComponent_For_4_Conditional_2_Template_div_keydown_enter_0_listener($event) {
      \u0275\u0275restoreView(_r3);
      const keypoint_r4 = \u0275\u0275nextContext().$implicit;
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.handleKeypointClick($event, keypoint_r4));
    })("pointerdown", function KeypointContainerComponent_For_4_Conditional_2_Template_div_pointerdown_0_listener($event) {
      \u0275\u0275restoreView(_r3);
      const keypoint_r4 = \u0275\u0275nextContext().$implicit;
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.handleKeypointPointerDown($event, keypoint_r4));
    });
    \u0275\u0275conditionalCreate(1, KeypointContainerComponent_For_4_Conditional_2_Conditional_1_Template, 1, 0, "div", 8);
    \u0275\u0275domElementEnd();
  }
  if (rf & 2) {
    const keypoint_r4 = \u0275\u0275nextContext().$implicit;
    const keypointIsSelected_r5 = \u0275\u0275readContextLet(0);
    const hideKeypointBecauseMoving_r6 = \u0275\u0275readContextLet(1);
    const ctx_r1 = \u0275\u0275nextContext();
    \u0275\u0275classMap(\u0275\u0275interpolate1("\n      h-2 w-2\n      rounded-full\n      shadow-sm/30\n      ", keypoint_r4.colorClass(), "\n      absolute -top-1 -left-1\n      tooltip"));
    \u0275\u0275styleProp("transform", ctx_r1.getTransform(keypoint_r4))("display", hideKeypointBecauseMoving_r6 ? "none" : "block");
    \u0275\u0275classProp("selected", keypointIsSelected_r5);
    \u0275\u0275attribute("data-tip", keypoint_r4.hoverText);
    \u0275\u0275advance();
    \u0275\u0275conditional(ctx_r1.useCrossHairs() ? 1 : -1);
  }
}
function KeypointContainerComponent_For_4_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275declareLet(0)(1);
    \u0275\u0275conditionalCreate(2, KeypointContainerComponent_For_4_Conditional_2_Template, 2, 11, "div", 6);
  }
  if (rf & 2) {
    const keypoint_r4 = ctx.$implicit;
    const ctx_r1 = \u0275\u0275nextContext();
    const keypointIsSelected_r7 = \u0275\u0275storeLet(keypoint_r4.id === ctx_r1.selectedKeypoint());
    \u0275\u0275advance();
    \u0275\u0275storeLet(keypointIsSelected_r7 && ctx_r1.selectedKeypointIsMoving());
    \u0275\u0275advance();
    \u0275\u0275conditional(keypoint_r4.position() !== null ? 2 : -1);
  }
}
var KeypointContainerComponent = class _KeypointContainerComponent {
  /** fixme: Right now this enables handlePointerMove handler only. */
  enableEditing = input(false, ...ngDevMode ? [{ debugName: "enableEditing" }] : []);
  keypointModels = input.required(...ngDevMode ? [{ debugName: "keypointModels" }] : []);
  /** false renders keypoints as dots, true renders them as crosshairs */
  useCrossHairs = input(false, ...ngDevMode ? [{ debugName: "useCrossHairs" }] : []);
  /** the selected keypoint */
  selectedKeypoint = model(null, ...ngDevMode ? [{ debugName: "selectedKeypoint" }] : []);
  newKpTemplate = input(null, ...ngDevMode ? [{ debugName: "newKpTemplate" }] : []);
  editMode = input(false, ...ngDevMode ? [{ debugName: "editMode" }] : []);
  // Notifies parent of the user's intent to change keypoint position.
  keypointUpdated = output();
  containerDiv = viewChild.required("containerDiv", {
    read: ElementRef
  });
  isSelectionAllowed = computed(() => {
    if (!this.enableEditing())
      return false;
    if (this.editMode())
      return false;
    return true;
  }, ...ngDevMode ? [{ debugName: "isSelectionAllowed" }] : []);
  mouseIsOverContainer = signal(false, ...ngDevMode ? [{ debugName: "mouseIsOverContainer" }] : []);
  isMouseDownOnKeypoint = signal(false, ...ngDevMode ? [{ debugName: "isMouseDownOnKeypoint" }] : []);
  getTransform(keypoint) {
    return `translate3d(${keypoint.position().x}px, ${keypoint.position().y}px, 0px)`;
  }
  /** Called when user clicks on a keypoint div */
  handleKeypointClick(event, keypoint) {
    if (this.isSelectionAllowed()) {
      this.selectedKeypoint.set(keypoint.id);
    }
  }
  // --- Mouse event handlers for the entire container ---
  handleMouseOver(event) {
    this.mouseIsOverContainer.set(true);
  }
  handleMouseOut(event) {
    this.mouseIsOverContainer.set(false);
  }
  handlePointerMove(event) {
    this.mouseClientPosition.set({ x: event.clientX, y: event.clientY });
    if (this.isMouseDownOnKeypoint()) {
      this.keypointIsDragging.set(true);
      event.stopPropagation();
    }
  }
  mouseClientPosition = signal(null, ...ngDevMode ? [{ debugName: "mouseClientPosition" }] : []);
  crosshairPosition = computed(() => {
    if (!this.mouseClientPosition())
      return null;
    if (!this.mouseIsOverContainer())
      return null;
    const containerElement = this.containerDiv().nativeElement;
    const containerRect = containerElement.getBoundingClientRect();
    const clientXRelativeToContainer = this.mouseClientPosition().x - containerRect.left;
    const clientYRelativeToContainer = this.mouseClientPosition().y - containerRect.top;
    const unscaledWidth = containerElement.offsetWidth;
    const unscaledHeight = containerElement.offsetHeight;
    const scaleX = unscaledWidth === 0 ? 1 : containerRect.width / unscaledWidth;
    const scaleY = unscaledHeight === 0 ? 1 : containerRect.height / unscaledHeight;
    const unscaledX = clientXRelativeToContainer / scaleX;
    const unscaledY = clientYRelativeToContainer / scaleY;
    return { x: unscaledX, y: unscaledY };
  }, ...ngDevMode ? [{ debugName: "crosshairPosition" }] : []);
  showCrosshair = computed(() => {
    return this.selectedKeypointIsMoving();
  }, ...ngDevMode ? [{ debugName: "showCrosshair" }] : []);
  selectedKeypointIsMoving = computed(() => {
    return this.keypointIsDragging() || this.editMode();
  }, ...ngDevMode ? [{ debugName: "selectedKeypointIsMoving" }] : []);
  keypointIsDragging = signal(false, ...ngDevMode ? [{ debugName: "keypointIsDragging" }] : []);
  handleKeypointPointerDown(event, keypoint) {
    if (keypoint && !this.selectedKeypointIsMoving()) {
      this.selectedKeypoint.set(keypoint.id);
      this.isMouseDownOnKeypoint.set(true);
      event.stopPropagation();
    }
    if (!keypoint && this.selectedKeypointIsMoving()) {
      event.stopPropagation();
    }
    this.containerDiv().nativeElement.setPointerCapture(event.pointerId);
  }
  handlePointerUp(event) {
    const position = this.selectedKeypointIsMoving() ? this.crosshairPosition() : null;
    this.isMouseDownOnKeypoint.set(false);
    if (this.keypointIsDragging()) {
      this.keypointIsDragging.set(false);
      this.containerDiv().nativeElement.releasePointerCapture(event.pointerId);
    }
    if (position) {
      this.keypointUpdated.emit({ kp: this.selectedKeypoint(), position });
    }
  }
  static \u0275fac = function KeypointContainerComponent_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _KeypointContainerComponent)();
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _KeypointContainerComponent, selectors: [["app-keypoint-container"]], viewQuery: function KeypointContainerComponent_Query(rf, ctx) {
    if (rf & 1) {
      \u0275\u0275viewQuerySignal(ctx.containerDiv, _c04, 5, ElementRef);
    }
    if (rf & 2) {
      \u0275\u0275queryAdvance();
    }
  }, inputs: { enableEditing: [1, "enableEditing"], keypointModels: [1, "keypointModels"], useCrossHairs: [1, "useCrossHairs"], selectedKeypoint: [1, "selectedKeypoint"], newKpTemplate: [1, "newKpTemplate"], editMode: [1, "editMode"] }, outputs: { selectedKeypoint: "selectedKeypointChange", keypointUpdated: "keypointUpdated" }, decls: 5, vars: 3, consts: [["containerDiv", ""], [1, "w-full", "h-full", "relative", "overflow-hidden", 3, "mouseover", "mouseout", "pointermove", "pointerup", "pointerdown"], [1, "crosshair2-wrapper", 3, "--crosshair-x", "--crosshair-y"], [1, "crosshair2-wrapper"], [1, "crosshair-horizontal-line"], [1, "crosshair-vertical-line"], ["tabindex", "0", 3, "selected", "transform", "display", "class"], ["tabindex", "0", 3, "click", "keydown.enter", "pointerdown"], [1, "crosshair-element"]], template: function KeypointContainerComponent_Template(rf, ctx) {
    if (rf & 1) {
      const _r1 = \u0275\u0275getCurrentView();
      \u0275\u0275domElementStart(0, "div", 1, 0);
      \u0275\u0275domListener("mouseover", function KeypointContainerComponent_Template_div_mouseover_0_listener($event) {
        \u0275\u0275restoreView(_r1);
        return \u0275\u0275resetView(ctx.handleMouseOver($event));
      })("mouseout", function KeypointContainerComponent_Template_div_mouseout_0_listener($event) {
        \u0275\u0275restoreView(_r1);
        return \u0275\u0275resetView(ctx.handleMouseOut($event));
      })("pointermove", function KeypointContainerComponent_Template_div_pointermove_0_listener($event) {
        \u0275\u0275restoreView(_r1);
        return \u0275\u0275resetView(ctx.handlePointerMove($event));
      })("pointerup", function KeypointContainerComponent_Template_div_pointerup_0_listener($event) {
        \u0275\u0275restoreView(_r1);
        return \u0275\u0275resetView(ctx.handlePointerUp($event));
      })("pointerdown", function KeypointContainerComponent_Template_div_pointerdown_0_listener($event) {
        \u0275\u0275restoreView(_r1);
        return \u0275\u0275resetView(ctx.handleKeypointPointerDown($event, null));
      });
      \u0275\u0275conditionalCreate(2, KeypointContainerComponent_Conditional_2_Template, 3, 4, "div", 2);
      \u0275\u0275repeaterCreate(3, KeypointContainerComponent_For_4_Template, 3, 3, null, null, _forTrack02);
      \u0275\u0275domElementEnd();
    }
    if (rf & 2) {
      \u0275\u0275classProp("cursor-none", ctx.showCrosshair());
      \u0275\u0275advance(2);
      \u0275\u0275conditional(ctx.showCrosshair() && ctx.crosshairPosition() ? 2 : -1);
      \u0275\u0275advance();
      \u0275\u0275repeater(ctx.keypointModels());
    }
  }, styles: ['\n\n.crosshair-element[_ngcontent-%COMP%]::before, \n.crosshair-element[_ngcontent-%COMP%]::after {\n  content: "";\n  position: absolute;\n  background-color: white;\n  opacity: 0.4;\n}\n.crosshair-element.newKp[_ngcontent-%COMP%]::before, \n.crosshair-element.newKp[_ngcontent-%COMP%]::after {\n  background-color: rgba(255, 255, 0, 0);\n  cursor: none;\n}\n.crosshair-element[_ngcontent-%COMP%]::before {\n  width: 0.5px;\n  height: 100%;\n  top: 0;\n  left: 50%;\n  transform: translateX(-50%);\n}\n.crosshair-element[_ngcontent-%COMP%]::after {\n  width: 100%;\n  height: 0.5px;\n  top: 50%;\n  left: 0;\n  transform: translateY(-50%);\n}\n.selected[_ngcontent-%COMP%] {\n  border: 0.5px solid yellow;\n}\n/*# sourceMappingURL=/static/keypoint-container.component-XEIQLTQH.css.map */', "\n\n.crosshair2-wrapper[_ngcontent-%COMP%] {\n  --line-thickness: 0.5px;\n  --line-color: grey;\n  --center-circle-radius: 1px;\n  position: absolute;\n  top: 0;\n  left: 0;\n  width: 100%;\n  height: 100%;\n  -webkit-mask-image:\n    radial-gradient(\n      circle at var(--crosshair-x) var(--crosshair-y),\n      transparent var(--center-circle-radius),\n      black var(--center-circle-radius));\n  mask-image:\n    radial-gradient(\n      circle at var(--crosshair-x) var(--crosshair-y),\n      transparent var(--center-circle-radius),\n      black var(--center-circle-radius));\n  -webkit-mask-size: 100% 100%;\n  mask-size: 100% 100%;\n  -webkit-mask-repeat: no-repeat;\n  mask-repeat: no-repeat;\n  will-change: mask-position, transform;\n}\n.crosshair-horizontal-line[_ngcontent-%COMP%], \n.crosshair-vertical-line[_ngcontent-%COMP%] {\n  position: absolute;\n  background-color: var(--line-color);\n  will-change: transform;\n}\n.crosshair-horizontal-line[_ngcontent-%COMP%] {\n  width: 100%;\n  height: var(--line-thickness);\n  left: 0;\n  transform: translateY(calc(var(--crosshair-y) - (var(--line-thickness) / 2)));\n}\n.crosshair-vertical-line[_ngcontent-%COMP%] {\n  height: 100%;\n  width: var(--line-thickness);\n  top: 0;\n  transform: translateX(calc(var(--crosshair-x) - (var(--line-thickness) / 2)));\n}\n/*# sourceMappingURL=/static/keypoint-container.component-VEIHFX5W.css.map */"], changeDetection: 0 });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(KeypointContainerComponent, [{
    type: Component,
    args: [{ selector: "app-keypoint-container", changeDetection: ChangeDetectionStrategy.OnPush, template: `<!-- this sets the boundary for dragging to be slightly larger than parent component (video or image)
   to allow dragging the keypoint slightly past the edge to allow moving its center to (0,0) or other corners/edges
<div #dragBoundary class="absolute -inset-1"></div>-->
<style>
  .crosshair-element::before,
  .crosshair-element::after {
    content: "";
    position: absolute; /* These will be positioned relative to the .crosshair-element */
    background-color: white; /* Or your desired crosshair color */
    opacity: 0.4;
  }
  .crosshair-element.newKp::before,
  .crosshair-element.newKp::after {
    background-color: rgba(255, 255, 0, 0);
    cursor: none;
  }

  /* Vertical line */
  .crosshair-element::before {
    width: 0.5px;
    height: 100%;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
  }

  /* Horizontal line */
  .crosshair-element::after {
    width: 100%;
    height: 0.5px;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
  }
  .selected {
    border: 0.5px solid yellow;
  }
</style>
<style>
  /* A single element to hold both lines, so we can apply a single mask */
  .crosshair2-wrapper {
    --line-thickness: 0.5px; /* Thickness of the crosshair lines */
    --line-color: grey; /* Color of the crosshair lines */
    --center-circle-radius: 1px; /* Radius of the optional center circle */

    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Apply the mask to this wrapper */
    mask-image: radial-gradient(
      circle at var(--crosshair-x) var(--crosshair-y),
      transparent var(--center-circle-radius),
      /* Transparent up to radius */ black var(--center-circle-radius)
        /* Opaque from radius onwards */
    );
    /* Ensure the mask covers the entire wrapper */
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    will-change: mask-position, transform; /* Hint for animation */
  }

  .crosshair-horizontal-line,
  .crosshair-vertical-line {
    position: absolute;
    background-color: var(--line-color);
    will-change: transform;
  }

  .crosshair-horizontal-line {
    width: 100%;
    height: var(--line-thickness);
    left: 0;
    transform: translateY(
      calc(var(--crosshair-y) - (var(--line-thickness) / 2))
    );
  }

  .crosshair-vertical-line {
    height: 100%;
    width: var(--line-thickness);
    top: 0;
    transform: translateX(
      calc(var(--crosshair-x) - (var(--line-thickness) / 2))
    );
  }
</style>
<div
  #containerDiv
  class="w-full h-full relative overflow-hidden"
  [class.cursor-none]="showCrosshair()"
  (mouseover)="handleMouseOver($event)"
  (mouseout)="handleMouseOut($event)"
  (pointermove)="handlePointerMove($event)"
  (pointerup)="handlePointerUp($event)"
  (pointerdown)="handleKeypointPointerDown($event, null)"
>
  <!-- Horizontal line -->
  @if (showCrosshair() && crosshairPosition()) {
    <div
      class="crosshair2-wrapper"
      [style.--crosshair-x]="crosshairPosition()!.x + 'px'"
      [style.--crosshair-y]="crosshairPosition()!.y + 'px'"
    >
      <div class="crosshair-horizontal-line"></div>
      <!-- Vertical line -->
      <div class="crosshair-vertical-line"></div>
    </div>
  }

  @for (keypoint of keypointModels(); track keypoint.id) {
    @let keypointIsSelected = keypoint.id === selectedKeypoint();
    @let hideKeypointBecauseMoving =
      keypointIsSelected && selectedKeypointIsMoving();
    @if (keypoint.position() !== null) {
      <div
        [attr.data-tip]="keypoint.hoverText"
        [class.selected]="keypointIsSelected"
        [style.transform]="getTransform(keypoint)"
        [style.display]="hideKeypointBecauseMoving ? 'none' : 'block'"
        (click)="handleKeypointClick($event, keypoint)"
        (keydown.enter)="handleKeypointClick($event, keypoint)"
        (pointerdown)="handleKeypointPointerDown($event, keypoint)"
        tabindex="0"
        class="
      h-2 w-2
      rounded-full
      shadow-sm/30
      {{ keypoint.colorClass() }}
      absolute -top-1 -left-1
      tooltip"
      >
        <!-- top, left position should be negative by 1/2 the height and width -->
        @if (useCrossHairs()) {
          <div class="crosshair-element"></div>
        }
      </div>
    }
  }
</div>
`, styles: ['/* angular:styles/component:css;c5febe189ffe3cb9c6a7c84e1d7ce2b03b0695ab021d477a792254510ecb46ef;/home/ksikka/lightning-pose-app/web_ui/src/app/components/keypoint-container/keypoint-container.component.html */\n.crosshair-element::before,\n.crosshair-element::after {\n  content: "";\n  position: absolute;\n  background-color: white;\n  opacity: 0.4;\n}\n.crosshair-element.newKp::before,\n.crosshair-element.newKp::after {\n  background-color: rgba(255, 255, 0, 0);\n  cursor: none;\n}\n.crosshair-element::before {\n  width: 0.5px;\n  height: 100%;\n  top: 0;\n  left: 50%;\n  transform: translateX(-50%);\n}\n.crosshair-element::after {\n  width: 100%;\n  height: 0.5px;\n  top: 50%;\n  left: 0;\n  transform: translateY(-50%);\n}\n.selected {\n  border: 0.5px solid yellow;\n}\n/*# sourceMappingURL=/static/keypoint-container.component-XEIQLTQH.css.map */\n', "/* angular:styles/component:css;15064eb0758f31edb805b60b3f39bd3ebc12288473b4c9152f39cad8f0c9ed46;/home/ksikka/lightning-pose-app/web_ui/src/app/components/keypoint-container/keypoint-container.component.html */\n.crosshair2-wrapper {\n  --line-thickness: 0.5px;\n  --line-color: grey;\n  --center-circle-radius: 1px;\n  position: absolute;\n  top: 0;\n  left: 0;\n  width: 100%;\n  height: 100%;\n  -webkit-mask-image:\n    radial-gradient(\n      circle at var(--crosshair-x) var(--crosshair-y),\n      transparent var(--center-circle-radius),\n      black var(--center-circle-radius));\n  mask-image:\n    radial-gradient(\n      circle at var(--crosshair-x) var(--crosshair-y),\n      transparent var(--center-circle-radius),\n      black var(--center-circle-radius));\n  -webkit-mask-size: 100% 100%;\n  mask-size: 100% 100%;\n  -webkit-mask-repeat: no-repeat;\n  mask-repeat: no-repeat;\n  will-change: mask-position, transform;\n}\n.crosshair-horizontal-line,\n.crosshair-vertical-line {\n  position: absolute;\n  background-color: var(--line-color);\n  will-change: transform;\n}\n.crosshair-horizontal-line {\n  width: 100%;\n  height: var(--line-thickness);\n  left: 0;\n  transform: translateY(calc(var(--crosshair-y) - (var(--line-thickness) / 2)));\n}\n.crosshair-vertical-line {\n  height: 100%;\n  width: var(--line-thickness);\n  top: 0;\n  transform: translateX(calc(var(--crosshair-x) - (var(--line-thickness) / 2)));\n}\n/*# sourceMappingURL=/static/keypoint-container.component-VEIHFX5W.css.map */\n"] }]
  }], null, null);
})();
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(KeypointContainerComponent, { className: "KeypointContainerComponent", filePath: "src/app/components/keypoint-container/keypoint-container.component.ts", lineNumber: 49 });
})();

// src/app/loading.service.ts
var LoadingService = class _LoadingService {
  isLoading = signal(false, ...ngDevMode ? [{ debugName: "isLoading" }] : []);
  loadingText = signal("Loading", ...ngDevMode ? [{ debugName: "loadingText" }] : []);
  maxProgress = signal(100, ...ngDevMode ? [{ debugName: "maxProgress" }] : []);
  progress = signal(0, ...ngDevMode ? [{ debugName: "progress" }] : []);
  static \u0275fac = function LoadingService_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _LoadingService)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _LoadingService, factory: _LoadingService.\u0275fac, providedIn: "root" });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(LoadingService, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], null, null);
})();

// src/app/utils/sserx.ts
function getEventStream(endpoint) {
  return new Observable((observer) => {
    if (typeof EventSource === "undefined") {
      observer.error("EventSource is not supported by this browser.");
      return;
    }
    const eventSource = new EventSource(`${endpoint}`);
    eventSource.onmessage = (event) => {
      console.log("Received SSE message:", event.data);
      observer.next(JSON.parse(event.data));
    };
    eventSource.onerror = (error) => {
      console.error("SSE Error:", error);
      if (eventSource.readyState === EventSource.CLOSED) {
        observer.error(new Error("SSE connection closed by server."));
      } else {
        observer.error(new Error("Connection to Lightning Pose App server lost. Refresh once the server is back online."));
      }
    };
    return () => {
      console.log("Closing SSE connection.");
      eventSource.close();
    };
  });
}

// src/app/utils/fine-video.service.ts
var FineVideoService = class _FineVideoService {
  projectInfoService = inject2(ProjectInfoService);
  fineVideoStatus$ = getEventStream("/app/v0/rpc/getFineVideoStatus");
  numPendingTranscodeTasks = toSignal(this.fineVideoStatus$, {
    initialValue: { pending: 0 }
  });
  fineVideoPath(videoPath) {
    if (!this.projectInfoService.fineVideoDir) {
      throw new Error("ProjectInfoService.fineVideoDir called but not yet initialized");
    }
    const filename = videoPath.split("/").pop();
    return "/app/v0/files/" + this.projectInfoService.fineVideoDir + "/" + filename;
  }
  static \u0275fac = function FineVideoService_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _FineVideoService)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _FineVideoService, factory: _FineVideoService.\u0275fac, providedIn: "root" });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(FineVideoService, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], null, null);
})();

// src/app/components/zoomable-content.component.ts
var _c05 = ["content"];
var _c14 = ["viewport"];
var _c22 = ["*"];
var ZoomableContentComponent = class _ZoomableContentComponent {
  renderer;
  maxScale = 6;
  // Maximum zoom level
  zoomSpeed = 15e-4;
  // How fast to zoom per scroll tick
  viewportRef;
  /** Labeling the content with #content is required to reliably fetch it.
   * We use that to compute the contentSize which is used in translation calculation. */
  projectedContentRef = contentChild.required("content", { read: ElementRef });
  // Internal state for content dimensions
  contentWidth = 0;
  contentHeight = 0;
  scale = 1;
  translateX = 0;
  translateY = 0;
  isDragging = false;
  startX = 0;
  startY = 0;
  viewportWidth = 0;
  viewportHeight = 0;
  resizeUnlisten;
  contentResizeObserver;
  // Declare ResizeObserver
  interactivityDisabled = input(false, ...ngDevMode ? [{ debugName: "interactivityDisabled" }] : []);
  constructor(renderer) {
    this.renderer = renderer;
  }
  ngAfterViewInit() {
    this.updateViewportDimensions();
    this.resizeUnlisten = this.renderer.listen("window", "resize", () => this.updateViewportDimensions());
  }
  ngAfterContentInit() {
    if (this.projectedContentRef()) {
      const contentElement = this.projectedContentRef().nativeElement;
      this.setContentDimensions(contentElement.offsetWidth, contentElement.offsetHeight);
      this.contentResizeObserver = new ResizeObserver((entries) => {
        for (const entry of entries) {
          if (entry.target === contentElement) {
            this.setContentDimensions(entry.contentRect.width, entry.contentRect.height);
          }
        }
      });
      this.contentResizeObserver.observe(contentElement);
    }
  }
  ngOnDestroy() {
    if (this.resizeUnlisten) {
      this.resizeUnlisten();
    }
    if (this.contentResizeObserver) {
      this.contentResizeObserver.disconnect();
    }
  }
  getTransform() {
    return `translate(${this.translateX}px, ${this.translateY}px) scale(${this.scale})`;
  }
  /**
   * Updates the stored dimensions of the viewport.
   */
  updateViewportDimensions() {
    this.viewportWidth = this.viewportRef.nativeElement.offsetWidth;
    this.viewportHeight = this.viewportRef.nativeElement.offsetHeight;
    if (this.contentWidth > 0 && this.contentHeight > 0) {
      this.fitContentToViewport();
    }
  }
  /**
   * Sets the content dimensions and fits it to the viewport
   */
  setContentDimensions(width, height) {
    if (this.contentWidth !== width || this.contentHeight !== height) {
      this.contentWidth = width;
      this.contentHeight = height;
      this.fitContentToViewport();
    }
  }
  calculateMinScale() {
    if (!this.contentWidth || !this.contentHeight || !this.viewportWidth || !this.viewportHeight) {
      return 1;
    }
    const scaleX = this.viewportWidth / this.contentWidth;
    const scaleY = this.viewportHeight / this.contentHeight;
    return Math.min(scaleX, scaleY);
  }
  /**
   * Calculates the initial scale and position to fit the content within the viewport.
   */
  fitContentToViewport() {
    if (this.contentWidth === 0 || this.contentHeight === 0 || this.viewportWidth === 0 || this.viewportHeight === 0) {
      return;
    }
    this.scale = this.calculateMinScale();
    this.translateX = (this.viewportWidth - this.contentWidth * this.scale) / 2;
    this.translateY = 0;
    this.scale = Math.min(this.maxScale, this.scale);
  }
  /**
   * Handles pointer down event for initiating dragging.
   */
  onPointerDown(event) {
    if (this.interactivityDisabled()) {
      return;
    }
    if (event.target instanceof Element && !event.target.getAttribute("draggable")) {
      event.preventDefault();
    }
    this.isDragging = true;
    this.startX = event.clientX - this.translateX;
    this.startY = event.clientY - this.translateY;
    this.renderer.addClass(this.viewportRef.nativeElement, "cursor-grabbing");
    this.viewportRef.nativeElement.setPointerCapture(event.pointerId);
  }
  /**
   * Handles pointer up or pointer cancel event for ending dragging.
   */
  onPointerUp(event) {
    if (this.interactivityDisabled()) {
      return;
    }
    if (this.isDragging) {
      this.isDragging = false;
      this.renderer.removeClass(this.viewportRef.nativeElement, "cursor-grabbing");
      if (this.viewportRef.nativeElement.hasPointerCapture(event.pointerId)) {
        this.viewportRef.nativeElement.releasePointerCapture(event.pointerId);
      }
    }
  }
  /**
   * Handles pointer move event for panning.
   * This is now triggered by (pointermove) on the viewport,
   * with events continuing to fire due to setPointerCapture.
   */
  onPointerMove(event) {
    if (this.interactivityDisabled()) {
      return;
    }
    if (!this.isDragging) {
      return;
    }
    this.translateX = event.clientX - this.startX;
    this.translateY = event.clientY - this.startY;
    this.applyPanningBounds();
  }
  /**
   * Handles the 'lostpointercapture' event, ensuring drag state is reset if capture is lost for any reason.
   */
  onLostPointerCapture(event) {
    if (event.target === this.viewportRef.nativeElement && this.isDragging) {
      this.isDragging = false;
      this.renderer.removeClass(this.viewportRef.nativeElement, "cursor-grabbing");
    }
  }
  /**
   * Handles mouse wheel event for zooming.
   */
  onWheel(event) {
    if (this.interactivityDisabled()) {
      return;
    }
    event.preventDefault();
    const viewportRect = this.viewportRef.nativeElement.getBoundingClientRect();
    const mouseX = event.clientX - viewportRect.left;
    const mouseY = event.clientY - viewportRect.top;
    const delta = event.deltaY * -this.zoomSpeed;
    const newScale = this.scale * (1 + delta);
    const minScale = this.calculateMinScale();
    const clampedNewScale = Math.max(minScale, Math.min(this.maxScale, newScale));
    if (clampedNewScale === this.scale) {
      return;
    }
    const contentPointX = (mouseX - this.translateX) / this.scale;
    const contentPointY = (mouseY - this.translateY) / this.scale;
    this.scale = clampedNewScale;
    this.translateX = mouseX - contentPointX * this.scale;
    this.translateY = mouseY - contentPointY * this.scale;
    this.applyPanningBounds();
  }
  /**
   * Applies boundary checks to prevent panning the content too far outside the viewport.
   */
  applyPanningBounds() {
    const scaledContentWidth = this.contentWidth * this.scale;
    const scaledContentHeight = this.contentHeight * this.scale;
    const minBoundX = this.viewportWidth - scaledContentWidth;
    const maxBoundX = 0;
    const minBoundY = this.viewportHeight - scaledContentHeight;
    const maxBoundY = 0;
    if (scaledContentWidth <= this.viewportWidth) {
      this.translateX = (this.viewportWidth - scaledContentWidth) / 2;
    } else {
      this.translateX = Math.max(minBoundX, Math.min(maxBoundX, this.translateX));
    }
    if (scaledContentHeight <= this.viewportHeight) {
      this.translateY = 0;
    } else {
      this.translateY = Math.max(minBoundY, Math.min(maxBoundY, this.translateY));
    }
  }
  static \u0275fac = function ZoomableContentComponent_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _ZoomableContentComponent)(\u0275\u0275directiveInject(Renderer2));
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _ZoomableContentComponent, selectors: [["app-zoomable-content"]], contentQueries: function ZoomableContentComponent_ContentQueries(rf, ctx, dirIndex) {
    if (rf & 1) {
      \u0275\u0275contentQuerySignal(dirIndex, ctx.projectedContentRef, _c05, 5, ElementRef);
    }
    if (rf & 2) {
      \u0275\u0275queryAdvance();
    }
  }, viewQuery: function ZoomableContentComponent_Query(rf, ctx) {
    if (rf & 1) {
      \u0275\u0275viewQuery(_c14, 5);
    }
    if (rf & 2) {
      let _t;
      \u0275\u0275queryRefresh(_t = \u0275\u0275loadQuery()) && (ctx.viewportRef = _t.first);
    }
  }, hostBindings: function ZoomableContentComponent_HostBindings(rf, ctx) {
    if (rf & 1) {
      \u0275\u0275listener("lostpointercapture", function ZoomableContentComponent_lostpointercapture_HostBindingHandler($event) {
        return ctx.onLostPointerCapture($event);
      }, \u0275\u0275resolveWindow)("wheel", function ZoomableContentComponent_wheel_HostBindingHandler($event) {
        return ctx.onWheel($event);
      });
    }
  }, inputs: { maxScale: "maxScale", zoomSpeed: "zoomSpeed", interactivityDisabled: [1, "interactivityDisabled"] }, ngContentSelectors: _c22, decls: 4, vars: 2, consts: [["viewport", ""], [1, "relative", "w-full", "h-full", "overflow-hidden", 3, "pointerdown", "pointermove", "pointerup", "pointercancel"], [1, "absolute", "transform-gpu", "transition-transform", "duration-0", "origin-top-left"]], template: function ZoomableContentComponent_Template(rf, ctx) {
    if (rf & 1) {
      const _r1 = \u0275\u0275getCurrentView();
      \u0275\u0275projectionDef();
      \u0275\u0275domElementStart(0, "div", 1, 0);
      \u0275\u0275domListener("pointerdown", function ZoomableContentComponent_Template_div_pointerdown_0_listener($event) {
        \u0275\u0275restoreView(_r1);
        return \u0275\u0275resetView(ctx.onPointerDown($event));
      })("pointermove", function ZoomableContentComponent_Template_div_pointermove_0_listener($event) {
        \u0275\u0275restoreView(_r1);
        return \u0275\u0275resetView(ctx.onPointerMove($event));
      })("pointerup", function ZoomableContentComponent_Template_div_pointerup_0_listener($event) {
        \u0275\u0275restoreView(_r1);
        return \u0275\u0275resetView(ctx.onPointerUp($event));
      })("pointercancel", function ZoomableContentComponent_Template_div_pointercancel_0_listener($event) {
        \u0275\u0275restoreView(_r1);
        return \u0275\u0275resetView(ctx.onPointerUp($event));
      });
      \u0275\u0275domElementStart(2, "div", 2);
      \u0275\u0275projection(3);
      \u0275\u0275domElementEnd()();
    }
    if (rf & 2) {
      \u0275\u0275advance(2);
      \u0275\u0275styleProp("transform", ctx.getTransform());
    }
  }, styles: ["\n\n[_nghost-%COMP%] {\n  display: block;\n  width: 100%;\n  height: 100%;\n}\n/*# sourceMappingURL=/static/zoomable-content.component-WOVVSJCQ.css.map */"] });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ZoomableContentComponent, [{
    type: Component,
    args: [{ selector: "app-zoomable-content", imports: [], template: `
    <div
      #viewport
      class="relative w-full h-full overflow-hidden"
      (pointerdown)="onPointerDown($event)"
      (pointermove)="onPointerMove($event)"
      (pointerup)="onPointerUp($event)"
      (pointercancel)="onPointerUp($event)"
    >
      <div
        class="absolute transform-gpu transition-transform duration-0 origin-top-left"
        [style.transform]="getTransform()"
      >
        <ng-content></ng-content>
      </div>
    </div>
    <!--
    <div class="flex justify-between">
      @if (scale > calculateMinScale()) {
        <span>Zoom: {{ scale / calculateMinScale() | number: '1.0-2' }}</span>
        <span>(Click and drag to pan)</span>
      }
    </div>
    -->
  `, styles: ["/* angular:styles/component:css;cd1ed4ff5117d02fa95d96170e149573f483fe0dd0cc54a4c9859db91ce75706;/home/ksikka/lightning-pose-app/web_ui/src/app/components/zoomable-content.component.ts */\n:host {\n  display: block;\n  width: 100%;\n  height: 100%;\n}\n/*# sourceMappingURL=/static/zoomable-content.component-WOVVSJCQ.css.map */\n"] }]
  }], () => [{ type: Renderer2 }], { maxScale: [{
    type: Input
  }], zoomSpeed: [{
    type: Input
  }], viewportRef: [{
    type: ViewChild,
    args: ["viewport"]
  }], onLostPointerCapture: [{
    type: HostListener,
    args: ["window:lostpointercapture", ["$event"]]
  }], onWheel: [{
    type: HostListener,
    args: ["wheel", ["$event"]]
  }] });
})();
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(ZoomableContentComponent, { className: "ZoomableContentComponent", filePath: "src/app/components/zoomable-content.component.ts", lineNumber: 53 });
})();

// src/app/viewer/viewer-center-panel/viewer-center-panel.component.ts
var _forTrack03 = ($index, $item) => $item.videoSrc;
function ViewerCenterPanelComponent_Conditional_2_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "div", 3)(1, "p", 5);
    \u0275\u0275text(2, "Select a session on the left to view.");
    \u0275\u0275elementEnd()();
  }
}
function ViewerCenterPanelComponent_Conditional_3_For_2_Template(rf, ctx) {
  if (rf & 1) {
    const _r1 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "div", 6)(1, "div", 7)(2, "h3");
    \u0275\u0275text(3);
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(4, "span", 8);
    \u0275\u0275listener("click", function ViewerCenterPanelComponent_Conditional_3_For_2_Template_span_click_4_listener() {
      const w_r2 = \u0275\u0275restoreView(_r1).$implicit;
      const ctx_r2 = \u0275\u0275nextContext(2);
      return \u0275\u0275resetView(ctx_r2.onWidgetCloseClick(w_r2));
    });
    \u0275\u0275text(5, "close");
    \u0275\u0275elementEnd()();
    \u0275\u0275elementStart(6, "app-zoomable-content", 9)(7, "app-video-tile", 10, 0);
    \u0275\u0275element(9, "app-keypoint-container", 11);
    \u0275\u0275elementEnd()()();
  }
  if (rf & 2) {
    const w_r2 = ctx.$implicit;
    \u0275\u0275advance(3);
    \u0275\u0275textInterpolate(w_r2.id);
    \u0275\u0275advance(4);
    \u0275\u0275property("src", w_r2.videoSrc);
    \u0275\u0275advance(2);
    \u0275\u0275property("enableEditing", false)("keypointModels", w_r2.keypoints());
  }
}
function ViewerCenterPanelComponent_Conditional_3_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "div", 4);
    \u0275\u0275repeaterCreate(1, ViewerCenterPanelComponent_Conditional_3_For_2_Template, 10, 4, "div", 6, _forTrack03);
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const ctx_r2 = \u0275\u0275nextContext();
    \u0275\u0275advance();
    \u0275\u0275repeater(ctx_r2.widgetModels());
  }
}
var ViewerCenterPanelComponent = class _ViewerCenterPanelComponent {
  sessionKey = input(null, ...ngDevMode ? [{ debugName: "sessionKey" }] : []);
  _loadedSessionKey = signal(null, ...ngDevMode ? [{ debugName: "_loadedSessionKey" }] : []);
  csvParser = inject2(CsvParserService);
  projectInfoService = inject2(ProjectInfoService);
  loadingService = inject2(LoadingService);
  fineVideoService = inject2(FineVideoService);
  loadSessionAbortController = void 0;
  get currentFrame() {
    return this.videoPlayerState.currentFrameSignal;
  }
  viewSettings = inject2(ViewSettings);
  videoPlayerState = inject2(VideoPlayerState);
  widgetModels = signal([], ...ngDevMode ? [{ debugName: "widgetModels" }] : []);
  // cached prediction files for this session.
  predictionFiles = /* @__PURE__ */ new Map();
  buildKeypoint(keypointName, predictions, modelKey) {
    return {
      id: keypointName + modelKey,
      name: keypointName,
      hoverText: keypointName,
      colorClass: computed(() => {
        const mi2 = this.viewSettings.modelsShown().indexOf(modelKey);
        if (mi2 == 0)
          return "bg-red-400";
        if (mi2 == 1)
          return "bg-green-400";
        return "bg-sky-100";
      }),
      modelKey,
      position: computed(() => {
        const i = Math.min(Math.max(this.currentFrame(), 0), predictions.index.length - 1);
        const x = predictions.at(i.toString(), new Pair(keypointName, "x").toMapKey());
        const y = predictions.at(i.toString(), new Pair(keypointName, "y").toMapKey());
        return { x, y };
      })
    };
  }
  sessionService = inject2(SessionService);
  getVideoPathForFFProbe(sessionKey, view) {
    const dataDir = this.projectInfoService.projectInfo?.data_dir;
    return dataDir + "/" + sessionKey.replace(/\*/g, view);
  }
  ngOnChanges(changes) {
    if (changes["sessionKey"]) {
      this.loadSessionAbort(this.sessionKey());
    }
  }
  async loadSessionAbort(sessionKey) {
    if (this.loadSessionAbortController) {
      this.loadSessionAbortController.abort();
    }
    this.loadSessionAbortController = new AbortController();
    await this.loadSession(sessionKey, this.loadSessionAbortController.signal);
  }
  async loadSession(sessionKey, abortSignal) {
    if (sessionKey == null) {
      this.viewSettings.setModelOptions([]);
      this.predictionFiles = /* @__PURE__ */ new Map();
      this.videoPlayerState.reset();
      this.videoPlayerState.duration.set(0);
      this.videoPlayerState.fps.set(30);
      this._loadedSessionKey.set(sessionKey);
      this.widgetModels.set([]);
      return;
    }
    this.loadingService.isLoading.set(true);
    this.loadingService.progress.set(0);
    const sessionChanged = sessionKey != this._loadedSessionKey();
    await firstValueFrom(this.sessionService.allSessions$.pipe(skipWhile(() => this.sessionService.sessionsLoading())));
    try {
      const session = this.sessionService.allSessions().find((session2) => session2.key === sessionKey);
      if (!session) {
        throw new Error(`Session not found: {sessionKey} in ${this.sessionService.allSessions()}`);
      }
      const promises = [];
      const predictionFileCache = sessionChanged ? /* @__PURE__ */ new Map() : this.predictionFiles;
      let ffprobeData = null;
      if (sessionChanged) {
        promises.push(this.loadFFProbeMetadata(session).then((data) => {
          ffprobeData = data;
        }));
      }
      promises.push(this.fetchDataFiles(session, predictionFileCache));
      await Promise.all(promises);
      const newWidgetModels = this.pureComputeWidgetModels(session, predictionFileCache);
      const availableModels = Array.from(/* @__PURE__ */ new Set([
        ...this.sessionService.getPredictionFilesForSession(sessionKey).map((pf) => pf.modelKey)
      ]));
      if (abortSignal.aborted) {
        return;
      }
      this.viewSettings.setModelOptions(availableModels);
      this.predictionFiles = predictionFileCache;
      if (sessionChanged) {
        this.videoPlayerState.reset();
        this.videoPlayerState.duration.set(ffprobeData.duration);
        this.videoPlayerState.fps.set(ffprobeData.fps);
        this._loadedSessionKey.set(sessionKey);
      }
      this.widgetModels.set(newWidgetModels);
    } finally {
      this.loadingService.isLoading.set(false);
    }
  }
  pureComputeNecessaryPredictionFiles(sessionKey) {
    const viewSettings = this.viewSettings;
    if (!sessionKey)
      return [];
    const predictionFiles = this.sessionService.getPredictionFilesForSession(sessionKey);
    const necessaryPredictionFiles = predictionFiles.filter((pf) => {
      return viewSettings.modelsShown().includes(pf.modelKey) && viewSettings.viewsShown().includes(pf.viewName);
    });
    return necessaryPredictionFiles;
  }
  pureComputeWidgetModels(session, predictionFileCache) {
    const viewSettings = this.viewSettings;
    return viewSettings.viewsShown().map((view) => {
      const sessionView = session.views.find((sv) => sv.viewName == view);
      if (!sessionView)
        return null;
      const pfiles = Array.from(predictionFileCache.keys()).filter((pfile) => pfile.viewName == view && viewSettings.modelsShown().includes(pfile.modelKey));
      return {
        id: view,
        videoSrc: this.fineVideoService.fineVideoPath(sessionView.videoPath),
        keypoints: signal(pfiles.flatMap((pf) => {
          return this.viewSettings.keypointsShown().map((keypoint) => {
            return this.buildKeypoint(keypoint, predictionFileCache.get(pf), pf.modelKey);
          });
        }))
      };
    }).filter((item) => item != null);
  }
  async loadFFProbeMetadata(session) {
    return await this.sessionService.ffprobe(this.getVideoPathForFFProbe(session.relativePath, session.views[0].viewName));
  }
  async fetchDataFiles(session, predictionFileCache) {
    const necessaryPredictionFiles = this.pureComputeNecessaryPredictionFiles(session.key);
    const promises = necessaryPredictionFiles.map(async (pf) => {
      if (this.predictionFiles.has(pf)) {
        return Promise.resolve(predictionFileCache.get(pf));
      }
      const rawText = await this.sessionService.getPredictionFile(pf);
      if (rawText == null) {
        throw new Error("Prediction file not found");
      }
      const df = this.csvParser.parsePredictionFile(rawText);
      predictionFileCache.set(pf, df);
      return df;
    });
    return Promise.all(promises);
  }
  onWidgetCloseClick(w) {
    const nextViewsShown = this.viewSettings.viewsShown().filter((v) => v != w.id);
    this.viewSettings.setViewsShown(nextViewsShown);
  }
  constructor() {
    this.viewSettings.viewsShown$.pipe(takeUntilDestroyed()).subscribe(() => {
      if (this._loadedSessionKey() == null)
        return;
      this.loadSessionAbort(this._loadedSessionKey());
    });
    this.viewSettings.keypointsShown$.pipe(takeUntilDestroyed()).subscribe(() => {
      if (this._loadedSessionKey() == null)
        return;
      this.loadSessionAbort(this._loadedSessionKey());
    });
    this.viewSettings.modelsShown$.pipe(takeUntilDestroyed()).subscribe(() => {
      if (this._loadedSessionKey() == null)
        return;
      this.loadSessionAbort(this._loadedSessionKey());
    });
  }
  static \u0275fac = function ViewerCenterPanelComponent_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _ViewerCenterPanelComponent)();
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _ViewerCenterPanelComponent, selectors: [["app-viewer-center-panel"]], inputs: { sessionKey: [1, "sessionKey"] }, features: [\u0275\u0275NgOnChangesFeature], decls: 5, vars: 1, consts: [["content", ""], [1, "flex", "flex-col", "h-full"], [1, "w-full", "grow", "overflow-y-auto"], [1, "flex", "items-center", "justify-center", "h-full"], [1, "flex", "flex-wrap", "gap-4", "justify-start", "items-start", "content-start", "p-4"], [1, "text-lg", "opacity-60"], [1, "panel", "!border-none"], [1, "px-2", "py-1", "text-sm", "flex", "justify-between"], [1, "btn", "btn-circle", "btn-xs", "material-icons", "!text-sm", 3, "click"], [1, "!h-[250px]", "!w-[250px]"], [1, "relative", 3, "src"], [1, "absolute", "top-0", "left-0", "h-full", "w-full", 3, "enableEditing", "keypointModels"]], template: function ViewerCenterPanelComponent_Template(rf, ctx) {
    if (rf & 1) {
      \u0275\u0275elementStart(0, "div", 1)(1, "div", 2);
      \u0275\u0275conditionalCreate(2, ViewerCenterPanelComponent_Conditional_2_Template, 3, 0, "div", 3)(3, ViewerCenterPanelComponent_Conditional_3_Template, 3, 0, "div", 4);
      \u0275\u0275elementEnd();
      \u0275\u0275element(4, "app-video-player-controls");
      \u0275\u0275elementEnd();
    }
    if (rf & 2) {
      \u0275\u0275advance(2);
      \u0275\u0275conditional(!ctx.sessionKey() ? 2 : 3);
    }
  }, dependencies: [
    VideoPlayerControlsComponent,
    VideoTileComponent,
    KeypointContainerComponent,
    ZoomableContentComponent
  ], encapsulation: 2, changeDetection: 0 });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ViewerCenterPanelComponent, [{
    type: Component,
    args: [{ selector: "app-viewer-center-panel", imports: [
      VideoPlayerControlsComponent,
      VideoTileComponent,
      KeypointContainerComponent,
      ZoomableContentComponent
    ], changeDetection: ChangeDetectionStrategy.OnPush, template: '<div class="flex flex-col h-full">\n  <!-- Video content area -->\n  <div class="w-full grow overflow-y-auto">\n    @if (!sessionKey()) {\n      <div class="flex items-center justify-center h-full">\n        <p class="text-lg opacity-60">Select a session on the left to view.</p>\n      </div>\n    } @else {\n      <div\n        class="flex flex-wrap gap-4 justify-start items-start content-start p-4"\n      >\n        <!-- `track videosrc` makes the widget component get\n     destroyed and recreated if videoSrc changes. Reactively\n     changing videoSrc of an existing video does not work unfortunately. -->\n        @for (w of widgetModels(); track w.videoSrc) {\n          <div class="panel !border-none">\n            <div class="px-2 py-1 text-sm flex justify-between">\n              <h3>{{ w.id }}</h3>\n              <span\n                class="btn btn-circle btn-xs material-icons !text-sm"\n                (click)="onWidgetCloseClick(w)"\n                >close</span\n              >\n            </div>\n            <app-zoomable-content class="!h-[250px] !w-[250px]">\n              <app-video-tile #content [src]="w.videoSrc" class="relative">\n                <app-keypoint-container\n                  class="absolute top-0 left-0 h-full w-full"\n                  [enableEditing]="false"\n                  [keypointModels]="w.keypoints()"\n                ></app-keypoint-container>\n              </app-video-tile>\n            </app-zoomable-content>\n          </div>\n        }\n      </div>\n    }\n  </div>\n\n  <app-video-player-controls></app-video-player-controls>\n</div>\n' }]
  }], () => [], null);
})();
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(ViewerCenterPanelComponent, { className: "ViewerCenterPanelComponent", filePath: "src/app/viewer/viewer-center-panel/viewer-center-panel.component.ts", lineNumber: 44 });
})();

// src/app/loading-bar/loading-bar.component.ts
function LoadingBarComponent_Conditional_0_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275domElementStart(0, "p");
    \u0275\u0275text(1, "Loading");
    \u0275\u0275domElementEnd();
    \u0275\u0275domElement(2, "progress", 0);
  }
  if (rf & 2) {
    const ctx_r0 = \u0275\u0275nextContext();
    \u0275\u0275advance(2);
    \u0275\u0275domProperty("value", ctx_r0.x.progress())("max", ctx_r0.x.maxProgress());
  }
}
var LoadingBarComponent = class _LoadingBarComponent {
  x = inject2(LoadingService);
  static \u0275fac = function LoadingBarComponent_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _LoadingBarComponent)();
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _LoadingBarComponent, selectors: [["app-loading-bar"]], decls: 1, vars: 1, consts: [[1, "progress", "progress-info", "w-full", 3, "value", "max"]], template: function LoadingBarComponent_Template(rf, ctx) {
    if (rf & 1) {
      \u0275\u0275conditionalCreate(0, LoadingBarComponent_Conditional_0_Template, 3, 2);
    }
    if (rf & 2) {
      \u0275\u0275conditional(ctx.x.isLoading() ? 0 : -1);
    }
  }, encapsulation: 2, changeDetection: 0 });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(LoadingBarComponent, [{
    type: Component,
    args: [{ selector: "app-loading-bar", imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: '@if (x.isLoading()) {\n  <p>Loading</p>\n\n  <progress\n    class="progress progress-info w-full"\n    [value]="x.progress()"\n    [max]="x.maxProgress()"\n  ></progress>\n}\n' }]
  }], null, null);
})();
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(LoadingBarComponent, { className: "LoadingBarComponent", filePath: "src/app/loading-bar/loading-bar.component.ts", lineNumber: 11 });
})();

// src/app/viewer/viewer-page/viewer-page.component.ts
var _c06 = (a0) => [a0];
function ViewerPageComponent_Conditional_0_Conditional_8_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "div", 6)(1, "span", 16);
    \u0275\u0275text(2, "info_i");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(3, "span");
    \u0275\u0275text(4, "Videos will populate once they are transcoded.");
    \u0275\u0275elementEnd()();
  }
}
function ViewerPageComponent_Conditional_0_For_19_Template(rf, ctx) {
  if (rf & 1) {
    const _r3 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "li", 13)(1, "span");
    \u0275\u0275text(2);
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(3, "input", 17);
    \u0275\u0275listener("change", function ViewerPageComponent_Conditional_0_For_19_Template_input_change_3_listener($event) {
      const cam_r4 = \u0275\u0275restoreView(_r3).$implicit;
      const ctx_r1 = \u0275\u0275nextContext(2);
      return \u0275\u0275resetView(ctx_r1.onViewCheckboxChange($event, cam_r4));
    });
    \u0275\u0275elementEnd()();
  }
  if (rf & 2) {
    const cam_r4 = ctx.$implicit;
    const ctx_r1 = \u0275\u0275nextContext(2);
    \u0275\u0275advance(2);
    \u0275\u0275textInterpolate(cam_r4);
    \u0275\u0275advance();
    \u0275\u0275property("checked", ctx_r1.viewSelectionModel.isSelected(cam_r4));
  }
}
function ViewerPageComponent_Conditional_0_For_27_Template(rf, ctx) {
  if (rf & 1) {
    const _r5 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "li", 13)(1, "span");
    \u0275\u0275text(2);
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(3, "input", 17);
    \u0275\u0275listener("change", function ViewerPageComponent_Conditional_0_For_27_Template_input_change_3_listener($event) {
      const kp_r6 = \u0275\u0275restoreView(_r5).$implicit;
      const ctx_r1 = \u0275\u0275nextContext(2);
      return \u0275\u0275resetView(ctx_r1.onKeypointCheckboxChange($event, kp_r6));
    });
    \u0275\u0275elementEnd()();
  }
  if (rf & 2) {
    const kp_r6 = ctx.$implicit;
    const ctx_r1 = \u0275\u0275nextContext(2);
    \u0275\u0275advance(2);
    \u0275\u0275textInterpolate(kp_r6);
    \u0275\u0275advance();
    \u0275\u0275property("checked", ctx_r1.keypointSelectionModel.isSelected(kp_r6));
  }
}
function ViewerPageComponent_Conditional_0_For_35_For_4_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "option", 19);
    \u0275\u0275text(1);
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const dropdownItem_r9 = ctx.$implicit;
    const model_r10 = \u0275\u0275nextContext().$implicit;
    \u0275\u0275property("selected", dropdownItem_r9 === model_r10);
    \u0275\u0275advance();
    \u0275\u0275textInterpolate1(" ", dropdownItem_r9, " ");
  }
}
function ViewerPageComponent_Conditional_0_For_35_Template(rf, ctx) {
  if (rf & 1) {
    const _r7 = \u0275\u0275getCurrentView();
    \u0275\u0275declareLet(0);
    \u0275\u0275elementStart(1, "li", 15)(2, "select", 18);
    \u0275\u0275listener("change", function ViewerPageComponent_Conditional_0_For_35_Template_select_change_2_listener($event) {
      \u0275\u0275restoreView(_r7);
      const modelIndex_r8 = \u0275\u0275readContextLet(0);
      const ctx_r1 = \u0275\u0275nextContext(2);
      return \u0275\u0275resetView(ctx_r1.onModelDropdownItemClick(modelIndex_r8, $event));
    });
    \u0275\u0275repeaterCreate(3, ViewerPageComponent_Conditional_0_For_35_For_4_Template, 2, 2, "option", 19, \u0275\u0275repeaterTrackByIdentity);
    \u0275\u0275elementEnd()();
  }
  if (rf & 2) {
    const $index_r11 = ctx.$index;
    const ctx_r1 = \u0275\u0275nextContext(2);
    const modelIndex_r12 = \u0275\u0275storeLet($index_r11);
    \u0275\u0275advance(2);
    \u0275\u0275classProp("border-red-300", modelIndex_r12 === 0)("border-green-300", modelIndex_r12 === 1);
    \u0275\u0275property("disabled", ctx_r1.viewSettings.modelOptions().length === 0);
    const options_r13 = \u0275\u0275pureFunction1(6, _c06, ctx_r1.noneOption).concat(ctx_r1.viewSettings.modelOptions());
    \u0275\u0275advance();
    \u0275\u0275repeater(options_r13);
  }
}
function ViewerPageComponent_Conditional_0_Template(rf, ctx) {
  if (rf & 1) {
    const _r1 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "div", 0)(1, "div", 1)(2, "div", 2)(3, "div", 3)(4, "h1", 4);
    \u0275\u0275text(5, "Sessions");
    \u0275\u0275elementEnd();
    \u0275\u0275element(6, "div");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(7, "app-sessions-panel", 5);
    \u0275\u0275listener("selectedSessionChange", function ViewerPageComponent_Conditional_0_Template_app_sessions_panel_selectedSessionChange_7_listener($event) {
      \u0275\u0275restoreView(_r1);
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.handleSelectedSessionChange($event));
    });
    \u0275\u0275elementEnd();
    \u0275\u0275conditionalCreate(8, ViewerPageComponent_Conditional_0_Conditional_8_Template, 5, 0, "div", 6);
    \u0275\u0275elementEnd();
    \u0275\u0275element(9, "app-loading-bar", 7);
    \u0275\u0275elementEnd();
    \u0275\u0275element(10, "app-viewer-center-panel", 8);
    \u0275\u0275elementStart(11, "div", 9)(12, "div", 10)(13, "div")(14, "h1", 11);
    \u0275\u0275text(15, "Views");
    \u0275\u0275elementEnd()();
    \u0275\u0275elementStart(16, "div", 12)(17, "ul");
    \u0275\u0275repeaterCreate(18, ViewerPageComponent_Conditional_0_For_19_Template, 4, 2, "li", 13, \u0275\u0275repeaterTrackByIdentity);
    \u0275\u0275elementEnd()()();
    \u0275\u0275elementStart(20, "div", 10)(21, "div")(22, "h1", 11);
    \u0275\u0275text(23, "Keypoints");
    \u0275\u0275elementEnd()();
    \u0275\u0275elementStart(24, "div", 12)(25, "ul");
    \u0275\u0275repeaterCreate(26, ViewerPageComponent_Conditional_0_For_27_Template, 4, 2, "li", 13, \u0275\u0275repeaterTrackByIdentity);
    \u0275\u0275elementEnd()()();
    \u0275\u0275elementStart(28, "div", 10)(29, "div")(30, "h1", 11);
    \u0275\u0275text(31, "Models");
    \u0275\u0275elementEnd()();
    \u0275\u0275elementStart(32, "div", 14)(33, "ul");
    \u0275\u0275repeaterCreate(34, ViewerPageComponent_Conditional_0_For_35_Template, 5, 8, "li", 15, \u0275\u0275repeaterTrackByIndex);
    \u0275\u0275elementEnd()()()()();
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext();
    \u0275\u0275advance(7);
    \u0275\u0275property("showModelAvailableMarkers", true)("selectedSessionKey", ctx_r1._sessionKey());
    \u0275\u0275advance();
    \u0275\u0275conditional(ctx_r1.fineVideoService.numPendingTranscodeTasks().pending > 0 ? 8 : -1);
    \u0275\u0275advance(2);
    \u0275\u0275property("sessionKey", ctx_r1._sessionKey());
    \u0275\u0275advance(8);
    \u0275\u0275repeater(ctx_r1.allViews);
    \u0275\u0275advance(8);
    \u0275\u0275repeater(ctx_r1.projectInfoService.allKeypoints());
    const modelSelectors_r14 = ctx_r1.viewSettings.modelsShown().length < 2 ? ctx_r1.viewSettings.modelsShown().concat(\u0275\u0275pureFunction1(4, _c06, ctx_r1.noneOption)) : ctx_r1.viewSettings.modelsShown();
    \u0275\u0275advance(8);
    \u0275\u0275repeater(modelSelectors_r14);
  }
}
var ViewerPageComponent = class _ViewerPageComponent {
  viewSettings = inject2(ViewSettings);
  projectInfoService = inject2(ProjectInfoService);
  sessionService = inject2(SessionService);
  loadingService = inject2(LoadingService);
  keypointSelectionModel;
  viewSelectionModel;
  allViews = [];
  router = inject2(Router);
  /**
   * Set by the router when there is a session key in the path.
   *
   * Flow: user clicks link -> Router -> ViewerPageComponent.
   *
   * @param sessionKey
   */
  set sessionKey(sessionKey) {
    this._sessionKey.set(sessionKey);
    if (sessionKey == null) {
      return;
    }
  }
  _sessionKey = signal(null, ...ngDevMode ? [{ debugName: "_sessionKey" }] : []);
  isIniting = signal(true, ...ngDevMode ? [{ debugName: "isIniting" }] : []);
  async ngOnInit() {
    this.loadingService.isLoading.set(true);
    this.loadingService.maxProgress.set(1);
    this.loadingService.progress.set(0);
    const p = this.sessionService.loadPredictionIndex();
    this.allViews = this.projectInfoService.allViews();
    p.then(() => {
      this.keypointSelectionModel.select(...this.projectInfoService.allKeypoints());
      this.loadingService.progress.update((x) => x + 1);
    }).then(() => {
      this.loadingService.isLoading.set(false);
    });
    this.viewSelectionModel.select(...this.allViews);
    if (this.projectInfoService.projectInfo == null) {
      throw new Error("No file at ~/.lightning_pose/project.toml");
    }
    this.isIniting.set(false);
  }
  constructor() {
    this.keypointSelectionModel = new SelectionModel(true, []);
    this.viewSelectionModel = new SelectionModel(true, []);
    this.viewSelectionModel.changed.asObservable().pipe(takeUntilDestroyed()).subscribe(() => {
      this.viewSettings.setViewsShown(this.viewSelectionModel.selected);
    });
    this.viewSettings.viewsShown$.pipe(takeUntilDestroyed()).subscribe((viewsShown) => {
      this.viewSelectionModel.setSelection(...viewsShown);
    });
    this.keypointSelectionModel.changed.asObservable().pipe(takeUntilDestroyed()).subscribe(() => {
      this.viewSettings.setKeypointsShown(this.keypointSelectionModel.selected);
    });
    this.viewSettings.keypointsShown$.pipe(takeUntilDestroyed()).subscribe((keypointsShown) => {
      this.keypointSelectionModel.setSelection(...keypointsShown);
    });
  }
  onKeypointCheckboxChange(event, keypointName) {
    const target = event.target;
    if (target.checked) {
      this.keypointSelectionModel.select(keypointName);
    } else {
      this.keypointSelectionModel.deselect(keypointName);
    }
  }
  onViewCheckboxChange(event, cam) {
    const target = event.target;
    if (target.checked) {
      this.viewSelectionModel.select(cam);
    } else {
      this.viewSelectionModel.deselect(cam);
    }
  }
  noneOption = "- None -";
  fineVideoService = inject2(FineVideoService);
  onModelDropdownItemClick(index, event) {
    const selectEl = event.target;
    const modelKey = selectEl.value;
    const modelsShown = [...this.viewSettings.modelsShown()];
    if (modelKey === this.noneOption) {
      modelsShown.splice(index, 1);
    } else {
      modelsShown[index] = modelKey;
    }
    this.viewSettings.setModelsShown(modelsShown);
  }
  handleSelectedSessionChange(session) {
    if (session === null) {
      this.router.navigate(["/viewer"]);
    } else {
      this.router.navigate(["/viewer", session.key]);
    }
  }
  static \u0275fac = function ViewerPageComponent_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _ViewerPageComponent)();
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _ViewerPageComponent, selectors: [["app-viewer"]], inputs: { sessionKey: "sessionKey" }, features: [\u0275\u0275ProvidersFeature([VideoPlayerState, ViewSettings])], decls: 1, vars: 1, consts: [[1, "grow", "flex", "flex-row", "items-stretch"], [1, "bg-base-200", "w-60", "xl:w-80", "flex", "flex-col", "justify-between", "shadow-lg"], [1, "p-4"], [1, "flex", "justify-between"], [1, "px-2"], [1, "h-120", 3, "selectedSessionChange", "showModelAvailableMarkers", "selectedSessionKey"], [1, "text-sm", "flex"], [1, "h-20", "p-4"], [1, "grow", "z-30", 3, "sessionKey"], [1, "shrink-0", "w-40", "xl:w-60", "h-full"], [1, "panel", "m-4"], [1, "px-2", "mb-1"], [1, "panel-content", "max-h-60", "overflow-y-auto"], [1, "p-1", "flex", "justify-between", "items-center"], [1, "panel-content", "max-h-60", "overflow-y-visible"], [1, "p-1", "w-full"], [1, "material-icons", "!text-sm", "max-w-4"], ["type", "checkbox", 1, "checkbox", "checkbox-xs", 3, "change", "checked"], [1, "select", "select-sm", "w-full", "flex-grow", 3, "change", "disabled"], [3, "selected"]], template: function ViewerPageComponent_Template(rf, ctx) {
    if (rf & 1) {
      \u0275\u0275conditionalCreate(0, ViewerPageComponent_Conditional_0_Template, 36, 6, "div", 0);
    }
    if (rf & 2) {
      \u0275\u0275conditional(!ctx.isIniting() ? 0 : -1);
    }
  }, dependencies: [
    ViewerSessionsPanelComponent,
    ViewerCenterPanelComponent,
    LoadingBarComponent
  ], styles: ["\n\n[_nghost-%COMP%] {\n  flex-grow: 1;\n  display: flex;\n}\n/*# sourceMappingURL=/static/viewer-page.component-MRTIUFL2.css.map */"], changeDetection: 0 });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ViewerPageComponent, [{
    type: Component,
    args: [{ selector: "app-viewer", imports: [
      ViewerSessionsPanelComponent,
      ViewerCenterPanelComponent,
      LoadingBarComponent
    ], changeDetection: ChangeDetectionStrategy.OnPush, providers: [VideoPlayerState, ViewSettings], template: `<style>
  :host {
    flex-grow: 1;
    display: flex;
  }
</style>

@if (!isIniting()) {
  <div class="grow flex flex-row items-stretch">
    <!-- Left pane -->
    <div
      class="bg-base-200 w-60 xl:w-80 flex flex-col justify-between shadow-lg"
    >
      <div class="p-4">
        <div class="flex justify-between">
          <!--header row-->
          <h1 class="px-2">Sessions</h1>
          <div></div>
        </div>
        <app-sessions-panel
          class="h-120"
          [showModelAvailableMarkers]="true"
          [selectedSessionKey]="_sessionKey()"
          (selectedSessionChange)="handleSelectedSessionChange($event)"
        ></app-sessions-panel>
        @if (fineVideoService.numPendingTranscodeTasks().pending > 0) {
          <div class="text-sm flex">
            <span class="material-icons !text-sm max-w-4">info_i</span>
            <span>Videos will populate once they are transcoded.</span>
          </div>
        }
      </div>
      <app-loading-bar class="h-20 p-4"></app-loading-bar>
    </div>

    <!-- Center content -->
    <app-viewer-center-panel
      class="grow z-30"
      [sessionKey]="_sessionKey()"
    ></app-viewer-center-panel>

    <!-- Right pane -->
    <div class="shrink-0 w-40 xl:w-60 h-full">
      <div class="panel m-4">
        <div>
          <!-- panel header -->
          <h1 class="px-2 mb-1">Views</h1>
        </div>
        <div class="panel-content max-h-60 overflow-y-auto">
          <ul>
            @for (cam of allViews; track cam) {
              <li class="p-1 flex justify-between items-center">
                <span>{{ cam }}</span>
                <input
                  type="checkbox"
                  [checked]="viewSelectionModel.isSelected(cam)"
                  class="checkbox checkbox-xs"
                  (change)="onViewCheckboxChange($event, cam)"
                />
              </li>
            }
          </ul>
        </div>
      </div>

      <div class="panel m-4">
        <div>
          <!-- panel header -->
          <h1 class="px-2 mb-1">Keypoints</h1>
        </div>
        <div class="panel-content max-h-60 overflow-y-auto">
          <ul>
            @for (kp of projectInfoService.allKeypoints(); track kp) {
              <li class="p-1 flex justify-between items-center">
                <span>{{ kp }}</span>
                <input
                  type="checkbox"
                  [checked]="keypointSelectionModel.isSelected(kp)"
                  class="checkbox checkbox-xs"
                  (change)="onKeypointCheckboxChange($event, kp)"
                />
              </li>
            }
          </ul>
        </div>
      </div>

      <div class="panel m-4">
        <div>
          <!-- panel header -->
          <h1 class="px-2 mb-1">Models</h1>
        </div>
        <div class="panel-content max-h-60 overflow-y-visible">
          <ul>
            @let modelSelectors =
              viewSettings.modelsShown().length < 2
                ? viewSettings.modelsShown().concat([noneOption])
                : viewSettings.modelsShown();
            <!-- it's important to track index, not model.
             if we put model here, something weird happens when you clear all models and then set a model. -->
            @for (model of modelSelectors; track $index) {
              @let modelIndex = $index;
              <li class="p-1 w-full">
                <select
                  class="select select-sm w-full flex-grow"
                  [disabled]="viewSettings.modelOptions().length === 0"
                  [class.border-red-300]="modelIndex === 0"
                  [class.border-green-300]="modelIndex === 1"
                  (change)="onModelDropdownItemClick(modelIndex, $event)"
                >
                  @let options =
                    [noneOption].concat(viewSettings.modelOptions());
                  @for (dropdownItem of options; track dropdownItem) {
                    <option [selected]="dropdownItem === model">
                      {{ dropdownItem }}
                    </option>
                  }
                </select>
              </li>
            }
          </ul>
        </div>
      </div>
    </div>
  </div>
}
`, styles: ["/* angular:styles/component:css;1fa15f7a0ae1b0259233282b2d49fb361834bf7fd726c58584c186240f9d8f04;/home/ksikka/lightning-pose-app/web_ui/src/app/viewer/viewer-page/viewer-page.component.html */\n:host {\n  flex-grow: 1;\n  display: flex;\n}\n/*# sourceMappingURL=/static/viewer-page.component-MRTIUFL2.css.map */\n"] }]
  }], () => [], { sessionKey: [{
    type: Input
  }] });
})();
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(ViewerPageComponent, { className: "ViewerPageComponent", filePath: "src/app/viewer/viewer-page/viewer-page.component.ts", lineNumber: 35 });
})();

// src/app/labeler/types.ts
var LKPUtils = class {
  kp;
  constructor(kp2) {
    this.kp = kp2;
  }
  isNaN() {
    return isNaN(this.kp.x) || isNaN(this.kp.y);
  }
};
function lkp(kp2) {
  return new LKPUtils(kp2);
}

// src/app/components/horizontal-scroll.directive.ts
var HorizontalScrollDirective = class _HorizontalScrollDirective {
  el;
  constructor(el) {
    this.el = el;
  }
  // Listen for the 'wheel' event on the host element
  onWheelScroll(event) {
    event.preventDefault();
    this.el.nativeElement.scrollLeft += event.deltaY;
  }
  static \u0275fac = function HorizontalScrollDirective_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _HorizontalScrollDirective)(\u0275\u0275directiveInject(ElementRef));
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({ type: _HorizontalScrollDirective, selectors: [["", "appHorizontalScroll", ""]], hostBindings: function HorizontalScrollDirective_HostBindings(rf, ctx) {
    if (rf & 1) {
      \u0275\u0275listener("wheel", function HorizontalScrollDirective_wheel_HostBindingHandler($event) {
        return ctx.onWheelScroll($event);
      });
    }
  } });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HorizontalScrollDirective, [{
    type: Directive,
    args: [{
      selector: "[appHorizontalScroll]"
      // This is how you'd apply it: <div appHorizontalScroll>...</div>
    }]
  }], () => [{ type: ElementRef }], { onWheelScroll: [{
    type: HostListener,
    args: ["wheel", ["$event"]]
  }] });
})();

// src/app/bundle-adjust-dialog/bundle-adjust-dialog.component.ts
function BundleAdjustDialogComponent_Conditional_22_For_10_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275domElementStart(0, "td");
    \u0275\u0275text(1);
    \u0275\u0275domElementEnd();
  }
  if (rf & 2) {
    const v_r1 = ctx.$implicit;
    \u0275\u0275advance();
    \u0275\u0275textInterpolate(v_r1);
  }
}
function BundleAdjustDialogComponent_Conditional_22_For_16_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275domElementStart(0, "td");
    \u0275\u0275text(1);
    \u0275\u0275domElementEnd();
  }
  if (rf & 2) {
    const err_r2 = ctx.$implicit;
    \u0275\u0275advance();
    \u0275\u0275textInterpolate(err_r2);
  }
}
function BundleAdjustDialogComponent_Conditional_22_For_21_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275domElementStart(0, "td");
    \u0275\u0275text(1);
    \u0275\u0275domElementEnd();
  }
  if (rf & 2) {
    const err_r3 = ctx.$implicit;
    \u0275\u0275advance();
    \u0275\u0275textInterpolate(err_r3);
  }
}
function BundleAdjustDialogComponent_Conditional_22_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275domElement(0, "div", 10);
    \u0275\u0275domElementStart(1, "div")(2, "p");
    \u0275\u0275text(3, " Operation successful. You may close this dialog, or re-run Bundle Adjustment. ");
    \u0275\u0275domElementEnd();
    \u0275\u0275domElementStart(4, "table", 4)(5, "thead")(6, "tr")(7, "th");
    \u0275\u0275text(8, "Views");
    \u0275\u0275domElementEnd();
    \u0275\u0275repeaterCreate(9, BundleAdjustDialogComponent_Conditional_22_For_10_Template, 2, 1, "td", null, \u0275\u0275repeaterTrackByIndex);
    \u0275\u0275domElementEnd()();
    \u0275\u0275domElementStart(11, "tbody")(12, "tr")(13, "th");
    \u0275\u0275text(14, "Old reprojection error");
    \u0275\u0275domElementEnd();
    \u0275\u0275repeaterCreate(15, BundleAdjustDialogComponent_Conditional_22_For_16_Template, 2, 1, "td", null, \u0275\u0275repeaterTrackByIndex);
    \u0275\u0275domElementEnd();
    \u0275\u0275domElementStart(17, "tr")(18, "th");
    \u0275\u0275text(19, "New reprojection error");
    \u0275\u0275domElementEnd();
    \u0275\u0275repeaterCreate(20, BundleAdjustDialogComponent_Conditional_22_For_21_Template, 2, 1, "td", null, \u0275\u0275repeaterTrackByIndex);
    \u0275\u0275domElementEnd()()()();
  }
  if (rf & 2) {
    const ctx_r3 = \u0275\u0275nextContext();
    \u0275\u0275advance(9);
    \u0275\u0275repeater(ctx_r3.baResponse().camList);
    \u0275\u0275advance(6);
    \u0275\u0275repeater(ctx_r3.baResponse().oldReprojectionError);
    \u0275\u0275advance(5);
    \u0275\u0275repeater(ctx_r3.baResponse().newReprojectionError);
  }
}
function BundleAdjustDialogComponent_Conditional_24_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275domElementStart(0, "p", 6);
    \u0275\u0275text(1, "Not enough labeled frames");
    \u0275\u0275domElementEnd();
  }
}
function BundleAdjustDialogComponent_Conditional_26_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275domElement(0, "span", 8);
  }
}
function BundleAdjustDialogComponent_Conditional_27_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275domElementStart(0, "span", 9);
    \u0275\u0275text(1, " directions_run ");
    \u0275\u0275domElementEnd();
  }
}
var BundleAdjustDialogComponent = class _BundleAdjustDialogComponent {
  rpc = inject2(RpcService);
  destroyRef = inject2(DestroyRef);
  mvf = mvf;
  labelFile = input.required(...ngDevMode ? [{ debugName: "labelFile" }] : []);
  frame = input.required(...ngDevMode ? [{ debugName: "frame" }] : []);
  numLabeledFrames = input.required(...ngDevMode ? [{ debugName: "numLabeledFrames" }] : []);
  runSubscription;
  baLoading = signal(false, ...ngDevMode ? [{ debugName: "baLoading" }] : []);
  baResponse = signal(null, ...ngDevMode ? [{ debugName: "baResponse" }] : []);
  resetState() {
    this.baResponse.set(null);
    this.baLoading.set(false);
    if (this.runSubscription) {
      this.runSubscription.unsubscribe();
    }
  }
  ngAfterViewInit() {
    document.getElementById("bundle_adjustment").addEventListener("close", () => {
      this.resetState();
    });
  }
  handleBundleAdjustClick() {
    const baRequest = {
      sessionKey: mvf(this.frame()).autolabelSessionKey,
      mvlabelfile: this.labelFile()
    };
    if (this.runSubscription) {
      this.runSubscription.unsubscribe();
    }
    this.baLoading.set(true);
    this.runSubscription = this.rpc.callObservable("bundleAdjust", baRequest).pipe(takeUntilDestroyed(this.destroyRef)).pipe(finalize(() => {
      this.baLoading.set(false);
    })).subscribe((response) => {
      this.baResponse.set(response);
    });
  }
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  open() {
    document.getElementById("bundle_adjustment").showModal();
  }
  static \u0275fac = function BundleAdjustDialogComponent_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _BundleAdjustDialogComponent)();
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _BundleAdjustDialogComponent, selectors: [["app-bundle-adjust-dialog"]], inputs: { labelFile: [1, "labelFile"], frame: [1, "frame"], numLabeledFrames: [1, "numLabeledFrames"] }, decls: 29, vars: 6, consts: [["id", "bundle_adjustment", 1, "modal"], [1, "modal-box", "w-5/6", "max-w-3xl", "prose"], ["onclick", "bundle_adjustment.close()", 1, "btn", "btn-md", "btn-circle", "btn-ghost", "absolute", "right-4", "top-4"], [1, "mt-0"], [1, "table", "table-sm", "w-fit"], [1, "modal-action", "items-center"], [1, "text-error"], [1, "btn", "btn-primary", 3, "click", "disabled"], [1, "loading", "loading-spinner", "loading-sm"], [1, "material-icons"], [1, "divider"]], template: function BundleAdjustDialogComponent_Template(rf, ctx) {
    if (rf & 1) {
      \u0275\u0275domElementStart(0, "dialog", 0)(1, "div", 1)(2, "button", 2);
      \u0275\u0275text(3, " \u2715 ");
      \u0275\u0275domElementEnd();
      \u0275\u0275domElementStart(4, "h2", 3);
      \u0275\u0275text(5, "Bundle Adjustment");
      \u0275\u0275domElementEnd();
      \u0275\u0275domElementStart(6, "p");
      \u0275\u0275text(7, " Optimizes the camera parameters for this session by minimizing the reprojection error of the labeled frames for this session. Overwrites the session-level camera calibration file. Backs up the original calibration file to ");
      \u0275\u0275domElementStart(8, "code");
      \u0275\u0275text(9, "calibration_backups");
      \u0275\u0275domElementEnd();
      \u0275\u0275text(10, ". ");
      \u0275\u0275domElementEnd();
      \u0275\u0275domElementStart(11, "table", 4)(12, "tr")(13, "td");
      \u0275\u0275text(14, "Label file");
      \u0275\u0275domElementEnd();
      \u0275\u0275domElementStart(15, "td");
      \u0275\u0275text(16);
      \u0275\u0275domElementEnd()();
      \u0275\u0275domElementStart(17, "tr")(18, "td");
      \u0275\u0275text(19, "Session");
      \u0275\u0275domElementEnd();
      \u0275\u0275domElementStart(20, "td");
      \u0275\u0275text(21);
      \u0275\u0275domElementEnd()()();
      \u0275\u0275conditionalCreate(22, BundleAdjustDialogComponent_Conditional_22_Template, 22, 0);
      \u0275\u0275domElementStart(23, "div", 5);
      \u0275\u0275conditionalCreate(24, BundleAdjustDialogComponent_Conditional_24_Template, 2, 0, "p", 6);
      \u0275\u0275domElementStart(25, "button", 7);
      \u0275\u0275domListener("click", function BundleAdjustDialogComponent_Template_button_click_25_listener() {
        return ctx.handleBundleAdjustClick();
      });
      \u0275\u0275conditionalCreate(26, BundleAdjustDialogComponent_Conditional_26_Template, 1, 0, "span", 8)(27, BundleAdjustDialogComponent_Conditional_27_Template, 2, 0, "span", 9);
      \u0275\u0275text(28, " Run ");
      \u0275\u0275domElementEnd()()()();
    }
    if (rf & 2) {
      let tmp_0_0;
      \u0275\u0275advance(16);
      \u0275\u0275textInterpolate((tmp_0_0 = ctx.labelFile()) == null ? null : tmp_0_0.key);
      \u0275\u0275advance(5);
      \u0275\u0275textInterpolate(ctx.mvf(ctx.frame()).autolabelSessionKey);
      \u0275\u0275advance();
      \u0275\u0275conditional(!ctx.baLoading() && ctx.baResponse() ? 22 : -1);
      \u0275\u0275advance(2);
      \u0275\u0275conditional(ctx.numLabeledFrames() < 3 ? 24 : -1);
      \u0275\u0275advance();
      \u0275\u0275domProperty("disabled", ctx.baLoading() || ctx.numLabeledFrames() < 3);
      \u0275\u0275advance();
      \u0275\u0275conditional(ctx.baLoading() ? 26 : 27);
    }
  }, encapsulation: 2, changeDetection: 0 });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(BundleAdjustDialogComponent, [{
    type: Component,
    args: [{ selector: "app-bundle-adjust-dialog", imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: '<dialog class="modal" id="bundle_adjustment">\n  <div class="modal-box w-5/6 max-w-3xl prose">\n    <button\n      class="btn btn-md btn-circle btn-ghost absolute right-4 top-4"\n      onclick="bundle_adjustment.close()"\n    >\n      \u2715\n    </button>\n    <h2 class="mt-0">Bundle Adjustment</h2>\n    <p>\n      Optimizes the camera parameters for this session by minimizing the\n      reprojection error of the labeled frames for this session. Overwrites the\n      session-level camera calibration file. Backs up the original calibration\n      file to\n      <code>calibration_backups</code>.\n    </p>\n    <table class="table table-sm w-fit">\n      <tr>\n        <td>Label file</td>\n        <td>{{ labelFile()?.key }}</td>\n      </tr>\n\n      <tr>\n        <td>Session</td>\n        <td>{{ mvf(this.frame()!).autolabelSessionKey }}</td>\n      </tr>\n    </table>\n    @if (!baLoading() && baResponse()) {\n      <div class="divider"></div>\n\n      <div>\n        <p>\n          Operation successful. You may close this dialog, or re-run Bundle\n          Adjustment.\n        </p>\n        <table class="table table-sm w-fit">\n          <thead>\n            <tr>\n              <th>Views</th>\n              @for (v of baResponse()!.camList; track $index) {\n                <td>{{ v }}</td>\n              }\n            </tr>\n          </thead>\n          <tbody>\n            <tr>\n              <th>Old reprojection error</th>\n              @for (err of baResponse()!.oldReprojectionError; track $index) {\n                <td>{{ err }}</td>\n              }\n            </tr>\n            <tr>\n              <th>New reprojection error</th>\n              @for (err of baResponse()!.newReprojectionError; track $index) {\n                <td>{{ err }}</td>\n              }\n            </tr>\n          </tbody>\n        </table>\n      </div>\n    }\n    <div class="modal-action items-center">\n      @if (numLabeledFrames() < 3) {\n        <p class="text-error">Not enough labeled frames</p>\n      }\n      <button\n        class="btn btn-primary"\n        (click)="handleBundleAdjustClick()"\n        [disabled]="baLoading() || numLabeledFrames() < 3"\n      >\n        @if (baLoading()) {\n          <span class="loading loading-spinner loading-sm"></span>\n        } @else {\n          <span class="material-icons"> directions_run </span>\n        }\n        Run\n      </button>\n    </div>\n  </div>\n</dialog>\n' }]
  }], null, null);
})();
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(BundleAdjustDialogComponent, { className: "BundleAdjustDialogComponent", filePath: "src/app/bundle-adjust-dialog/bundle-adjust-dialog.component.ts", lineNumber: 29 });
})();

// src/app/toast.service.ts
var ToastService = class _ToastService {
  document;
  containerEl = null;
  constructor(document2) {
    this.document = document2;
  }
  /**
   * Preferred API: showAlert stacks multiple alerts inside one DaisyUI toast container.
   * Container: <div class="toast toast-top toast-start"></div>
   * Each call appends a sibling <div class="alert ..."><span>content</span></div>
   * Clicking an alert or its duration timer removes only that alert.
   */
  showAlert(options) {
    const { content, variant = "success", durationMs = 3e3, dismissOnClick = true } = options;
    const container = this.ensureContainer();
    for (const child of Array.from(container.children)) {
      if (!(child instanceof HTMLElement))
        continue;
      const span2 = child.querySelector("span");
      if (span2 && span2.textContent === content) {
        container.removeChild(child);
        break;
      }
    }
    const alertEl = this.document.createElement("div");
    alertEl.classList.add("alert");
    const variantClass = this.variantToClass(variant);
    if (variantClass) {
      alertEl.classList.add(variantClass);
    }
    alertEl.setAttribute("role", "status");
    alertEl.setAttribute("aria-live", "polite");
    const span = this.document.createElement("span");
    span.textContent = content;
    alertEl.appendChild(span);
    let dismissed = false;
    const dismiss = () => {
      if (dismissed)
        return;
      dismissed = true;
      if (alertEl.parentElement) {
        alertEl.parentElement.removeChild(alertEl);
      }
      this.cleanupContainerIfEmpty();
    };
    if (dismissOnClick) {
      alertEl.style.cursor = "pointer";
      alertEl.addEventListener("click", dismiss);
    }
    container.appendChild(alertEl);
    if (durationMs > 0) {
      window.setTimeout(dismiss, durationMs);
    }
  }
  /**
   * Backward-compatible alias for existing calls.
   */
  showToast(options) {
    this.showAlert(options);
  }
  ensureContainer() {
    if (this.containerEl && this.document.body.contains(this.containerEl)) {
      return this.containerEl;
    }
    const container = this.document.createElement("div");
    container.classList.add("toast", "toast-bottom", "toast-center", "z-[99999]");
    this.document.body.appendChild(container);
    this.containerEl = container;
    return container;
  }
  cleanupContainerIfEmpty() {
    if (this.containerEl && this.containerEl.childElementCount === 0) {
      if (this.document.body.contains(this.containerEl)) {
        this.document.body.removeChild(this.containerEl);
      }
      this.containerEl = null;
    }
  }
  variantToClass(variant) {
    switch (variant) {
      case "info":
        return "alert-info";
      case "success":
        return "alert-success";
      case "warning":
        return "alert-warning";
      case "error":
        return "alert-error";
      case "neutral":
        return "";
      default:
        return "";
    }
  }
  static \u0275fac = function ToastService_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _ToastService)(\u0275\u0275inject(DOCUMENT));
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _ToastService, factory: _ToastService.\u0275fac, providedIn: "root" });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ToastService, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], () => [{ type: Document, decorators: [{
    type: Inject,
    args: [DOCUMENT]
  }] }], null);
})();

// src/app/labeler/labeler-center-panel/labeler-center-panel.component.ts
var _forTrack04 = ($index, $item) => $item.viewName;
function LabelerCenterPanelComponent_Conditional_2_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "div", 4)(1, "div", 12);
    \u0275\u0275text(2, " Select a label file on the left ");
    \u0275\u0275elementEnd()();
  }
}
function LabelerCenterPanelComponent_Conditional_3_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "div", 4)(1, "div", 12);
    \u0275\u0275text(2, " Select a frame on the left to view ");
    \u0275\u0275elementEnd()();
  }
}
function LabelerCenterPanelComponent_Conditional_4_Template(rf, ctx) {
  if (rf & 1) {
    const _r1 = \u0275\u0275getCurrentView();
    \u0275\u0275declareLet(0);
    \u0275\u0275elementStart(1, "div")(2, "h3", 13);
    \u0275\u0275text(3);
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(4, "app-zoomable-content", 14)(5, "div", 15, 0);
    \u0275\u0275element(7, "img", 16);
    \u0275\u0275elementStart(8, "app-keypoint-container", 17);
    \u0275\u0275twoWayListener("selectedKeypointChange", function LabelerCenterPanelComponent_Conditional_4_Template_app_keypoint_container_selectedKeypointChange_8_listener($event) {
      \u0275\u0275restoreView(_r1);
      const ctx_r1 = \u0275\u0275nextContext();
      \u0275\u0275twoWayBindingSet(ctx_r1.selectedKeypoint, $event) || (ctx_r1.selectedKeypoint = $event);
      return \u0275\u0275resetView($event);
    });
    \u0275\u0275listener("keypointUpdated", function LabelerCenterPanelComponent_Conditional_4_Template_app_keypoint_container_keypointUpdated_8_listener($event) {
      \u0275\u0275restoreView(_r1);
      const fv_r3 = \u0275\u0275readContextLet(0);
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.handleKeypointUpdated($event.kp, $event.position, fv_r3));
    });
    \u0275\u0275elementEnd()()()();
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext();
    const fv_r4 = \u0275\u0275storeLet(ctx_r1.selectedFrameView());
    \u0275\u0275advance(3);
    \u0275\u0275textInterpolate1(" ", fv_r4.viewName, " ");
    \u0275\u0275advance();
    \u0275\u0275property("maxScale", 100);
    \u0275\u0275advance(3);
    \u0275\u0275property("src", ctx_r1.imgPath(fv_r4.imgPath), \u0275\u0275sanitizeUrl);
    \u0275\u0275advance();
    \u0275\u0275property("enableEditing", !ctx_r1.disableInteractions())("keypointModels", ctx_r1.getCachedKeypointViewModels(fv_r4.keypoints));
    \u0275\u0275twoWayProperty("selectedKeypoint", ctx_r1.selectedKeypoint);
    \u0275\u0275property("useCrossHairs", true)("editMode", ctx_r1.labelerDefaultsToEditMode);
  }
}
function LabelerCenterPanelComponent_Conditional_6_For_1_Template(rf, ctx) {
  if (rf & 1) {
    const _r5 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "div", 19);
    \u0275\u0275listener("click", function LabelerCenterPanelComponent_Conditional_6_For_1_Template_div_click_0_listener() {
      const fv_r6 = \u0275\u0275restoreView(_r5).$implicit;
      const ctx_r1 = \u0275\u0275nextContext(2);
      return \u0275\u0275resetView(ctx_r1.handleViewClickFromFilmstrip(fv_r6.viewName));
    });
    \u0275\u0275elementStart(1, "h3", 20);
    \u0275\u0275text(2);
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(3, "app-zoomable-content", 21);
    \u0275\u0275element(4, "img", 22, 0)(6, "app-keypoint-container", 23);
    \u0275\u0275elementEnd()();
  }
  if (rf & 2) {
    const fv_r6 = ctx.$implicit;
    const ctx_r1 = \u0275\u0275nextContext(2);
    \u0275\u0275classProp("border", ctx_r1.selectedView() === fv_r6.viewName)("cursor-pointer", ctx_r1.selectedView() !== fv_r6.viewName);
    \u0275\u0275advance(2);
    \u0275\u0275textInterpolate1(" ", fv_r6.viewName, " ");
    \u0275\u0275advance();
    \u0275\u0275property("interactivityDisabled", true);
    \u0275\u0275advance();
    \u0275\u0275property("src", ctx_r1.imgPath(fv_r6.imgPath), \u0275\u0275sanitizeUrl);
    \u0275\u0275advance(2);
    \u0275\u0275property("keypointModels", ctx_r1.getCachedKeypointViewModels(fv_r6.keypoints));
  }
}
function LabelerCenterPanelComponent_Conditional_6_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275repeaterCreate(0, LabelerCenterPanelComponent_Conditional_6_For_1_Template, 7, 8, "div", 18, _forTrack04);
  }
  if (rf & 2) {
    const views2_r7 = ctx.views;
    \u0275\u0275repeater(views2_r7);
  }
}
function LabelerCenterPanelComponent_Conditional_13_For_2_Template(rf, ctx) {
  if (rf & 1) {
    const _r8 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "li", 25);
    \u0275\u0275listener("click", function LabelerCenterPanelComponent_Conditional_13_For_2_Template_li_click_0_listener() {
      const kp_r9 = \u0275\u0275restoreView(_r8).$implicit;
      const ctx_r1 = \u0275\u0275nextContext(2);
      return \u0275\u0275resetView(ctx_r1.selectedKeypoint.set(kp_r9.keypointName));
    });
    \u0275\u0275elementStart(1, "span");
    \u0275\u0275text(2);
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(3, "span", 26);
    \u0275\u0275text(4, " ( ");
    \u0275\u0275elementStart(5, "span");
    \u0275\u0275text(6);
    \u0275\u0275pipe(7, "number");
    \u0275\u0275elementEnd();
    \u0275\u0275text(8, " , ");
    \u0275\u0275elementStart(9, "span");
    \u0275\u0275text(10);
    \u0275\u0275pipe(11, "number");
    \u0275\u0275elementEnd();
    \u0275\u0275text(12, " ) ");
    \u0275\u0275elementStart(13, "button", 27);
    \u0275\u0275listener("click", function LabelerCenterPanelComponent_Conditional_13_For_2_Template_button_click_13_listener() {
      const kp_r9 = \u0275\u0275restoreView(_r8).$implicit;
      const ctx_r1 = \u0275\u0275nextContext(2);
      return \u0275\u0275resetView(ctx_r1.handleKeypointClearClick(kp_r9));
    });
    \u0275\u0275text(14, " close ");
    \u0275\u0275elementEnd()()();
  }
  if (rf & 2) {
    const kp_r9 = ctx.$implicit;
    const ctx_r1 = \u0275\u0275nextContext(2);
    \u0275\u0275classMap(\u0275\u0275interpolate1("p-1 flex justify-between items-center group ", kp_r9.keypointName === ctx_r1.selectedKeypoint() ? "bg-sky-700" : "hover:bg-base-content/10 cursor-pointer"));
    \u0275\u0275advance(2);
    \u0275\u0275textInterpolate(kp_r9.keypointName);
    \u0275\u0275advance(4);
    \u0275\u0275textInterpolate(\u0275\u0275pipeBind2(7, 6, kp_r9.x, "1.0-1"));
    \u0275\u0275advance(4);
    \u0275\u0275textInterpolate(\u0275\u0275pipeBind2(11, 9, kp_r9.y, "1.0-1"));
  }
}
function LabelerCenterPanelComponent_Conditional_13_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "ul");
    \u0275\u0275repeaterCreate(1, LabelerCenterPanelComponent_Conditional_13_For_2_Template, 15, 12, "li", 24, \u0275\u0275repeaterTrackByIndex);
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    \u0275\u0275advance();
    \u0275\u0275repeater(ctx.keypoints);
  }
}
function LabelerCenterPanelComponent_Conditional_14_Template(rf, ctx) {
  if (rf & 1) {
    const _r10 = \u0275\u0275getCurrentView();
    \u0275\u0275declareLet(0);
    \u0275\u0275elementStart(1, "div", 10)(2, "div")(3, "h1", 28);
    \u0275\u0275text(4, " Multiview tools ");
    \u0275\u0275elementStart(5, "button", 29)(6, "span", 30);
    \u0275\u0275text(7, "question_mark");
    \u0275\u0275elementEnd()()()();
    \u0275\u0275elementStart(8, "dialog", 31)(9, "div", 32)(10, "button", 33);
    \u0275\u0275text(11, " \u2715 ");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(12, "h2", 34);
    \u0275\u0275text(13, "Multiview tools");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(14, "p");
    \u0275\u0275text(15, "Use camera parameters to assist labeling.");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(16, "p");
    \u0275\u0275text(17, " With accurate parameters, you need only label two views per keypoint: the other views can be auto-labeled by triangulating and reprojecting. The tool also supports bundle adjustment to refine the camera parameters after labeling several frames. ");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(18, "h3");
    \u0275\u0275text(19, "How to provide camera parameters to Lightning Pose");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(20, "p");
    \u0275\u0275text(21, " Camera calibration is typically performed using Anipose before every session. Camera parameters are recommended to be session-specific to allow for changes in camera position from session to session, however a single project-wide calibration file is also supported. ");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(22, "p");
    \u0275\u0275text(23, " Session specific calibration files should be at ");
    \u0275\u0275elementStart(24, "code");
    \u0275\u0275text(25);
    \u0275\u0275pipe(26, "path");
    \u0275\u0275elementEnd();
    \u0275\u0275text(27, ". where ");
    \u0275\u0275elementStart(28, "code");
    \u0275\u0275text(29, "sessionKey");
    \u0275\u0275elementEnd();
    \u0275\u0275text(30, " is the video filename without the viewname.");
    \u0275\u0275element(31, "br");
    \u0275\u0275text(32, " For example, the calibration file for session with files like ");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(33, "ul")(34, "li")(35, "code");
    \u0275\u0275text(36);
    \u0275\u0275pipe(37, "path");
    \u0275\u0275elementEnd();
    \u0275\u0275text(38, " would be ");
    \u0275\u0275elementStart(39, "code");
    \u0275\u0275text(40);
    \u0275\u0275pipe(41, "path");
    \u0275\u0275elementEnd()();
    \u0275\u0275elementStart(42, "li")(43, "code");
    \u0275\u0275text(44);
    \u0275\u0275pipe(45, "path");
    \u0275\u0275elementEnd();
    \u0275\u0275text(46, " would be ");
    \u0275\u0275elementStart(47, "code");
    \u0275\u0275text(48);
    \u0275\u0275pipe(49, "path");
    \u0275\u0275elementEnd()()();
    \u0275\u0275elementStart(50, "p");
    \u0275\u0275text(51, " The optional project calibration file should be at ");
    \u0275\u0275elementStart(52, "code");
    \u0275\u0275text(53, "calibration.toml");
    \u0275\u0275elementEnd();
    \u0275\u0275text(54, ". It will be used if session-specific calibration is not found. When bundle adjustment is performed, it will not modify the project calibration.toml; it will instead output a session-specific calibration file. ");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(55, "div", 35)(56, "form", 36)(57, "button", 37);
    \u0275\u0275text(58, "Close");
    \u0275\u0275elementEnd()()()()();
    \u0275\u0275elementStart(59, "div", 38)(60, "button", 39);
    \u0275\u0275listener("click", function LabelerCenterPanelComponent_Conditional_14_Template_button_click_60_listener() {
      const frame2_r11 = \u0275\u0275restoreView(_r10);
      const lbfl_r12 = \u0275\u0275readContextLet(0);
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.handleMVAutoLabelClick(lbfl_r12, frame2_r11));
    });
    \u0275\u0275text(61, " \u2728 Project keypoints to all views ");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(62, "button", 40);
    \u0275\u0275listener("click", function LabelerCenterPanelComponent_Conditional_14_Template_button_click_62_listener() {
      \u0275\u0275restoreView(_r10);
      const baDialog_r13 = \u0275\u0275reference(67);
      return \u0275\u0275resetView(baDialog_r13.open());
    });
    \u0275\u0275elementStart(63, "span", 41);
    \u0275\u0275text(64, "model_training");
    \u0275\u0275elementEnd();
    \u0275\u0275text(65, " Refine calibration (bundle adjustment) ");
    \u0275\u0275elementEnd();
    \u0275\u0275element(66, "app-bundle-adjust-dialog", 42, 1);
    \u0275\u0275elementEnd()();
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext();
    \u0275\u0275storeLet(ctx_r1.labelFile());
    \u0275\u0275advance(25);
    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(26, 13, "calibrations/{sessionKey}.toml"));
    \u0275\u0275advance(11);
    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(37, 15, "videos/session1_view1.mp4"));
    \u0275\u0275advance(4);
    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(41, 17, "calibrations/session1.toml"));
    \u0275\u0275advance(4);
    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(45, 19, "videos/session1_view1_123.mp4"));
    \u0275\u0275advance(4);
    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(49, 21, "calibrations/session1_123.toml"));
    \u0275\u0275advance(12);
    \u0275\u0275classProp("btn-disabled", !ctx_r1.hasCameraCalibrationFiles() || ctx_r1.disableInteractions());
    \u0275\u0275advance(2);
    \u0275\u0275classProp("btn-disabled", !ctx_r1.hasCameraCalibrationFiles() || ctx_r1.disableInteractions());
    \u0275\u0275advance(4);
    \u0275\u0275property("labelFile", ctx_r1.labelFile())("frame", ctx_r1.frame())("numLabeledFrames", ctx_r1.numLabeledFrames());
  }
}
function LabelerCenterPanelComponent_Conditional_16_Conditional_6_Template(rf, ctx) {
  if (rf & 1) {
    const _r17 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "div", 45)(1, "button", 46);
    \u0275\u0275listener("click", function LabelerCenterPanelComponent_Conditional_16_Conditional_6_Template_button_click_1_listener() {
      \u0275\u0275restoreView(_r17);
      const frame2_r15 = \u0275\u0275nextContext();
      const lbfl_r16 = \u0275\u0275readContextLet(0);
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.handleSaveClick(lbfl_r16, frame2_r15, true));
    })("keydown.enter", function LabelerCenterPanelComponent_Conditional_16_Conditional_6_Template_button_keydown_enter_1_listener() {
      \u0275\u0275restoreView(_r17);
      const frame2_r15 = \u0275\u0275nextContext();
      const lbfl_r16 = \u0275\u0275readContextLet(0);
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.handleSaveClick(lbfl_r16, frame2_r15, true));
    });
    \u0275\u0275elementStart(2, "span", 41);
    \u0275\u0275text(3, "save");
    \u0275\u0275elementEnd();
    \u0275\u0275text(4, " Save and view next frame ");
    \u0275\u0275elementStart(5, "span", 41);
    \u0275\u0275text(6, "arrow_forward");
    \u0275\u0275elementEnd()()();
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext(2);
    \u0275\u0275attribute("data-tip", ctx_r1.saveAndContinueTooltip);
    \u0275\u0275advance();
    \u0275\u0275classProp("btn-disabled", ctx_r1.isSaveDisabled());
  }
}
function LabelerCenterPanelComponent_Conditional_16_Template(rf, ctx) {
  if (rf & 1) {
    const _r14 = \u0275\u0275getCurrentView();
    \u0275\u0275declareLet(0);
    \u0275\u0275elementStart(1, "div", 43)(2, "button", 44);
    \u0275\u0275listener("click", function LabelerCenterPanelComponent_Conditional_16_Template_button_click_2_listener() {
      const frame2_r15 = \u0275\u0275restoreView(_r14);
      const lbfl_r16 = \u0275\u0275readContextLet(0);
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.handleSaveClick(lbfl_r16, frame2_r15, false));
    })("keydown.enter", function LabelerCenterPanelComponent_Conditional_16_Template_button_keydown_enter_2_listener() {
      const frame2_r15 = \u0275\u0275restoreView(_r14);
      const lbfl_r16 = \u0275\u0275readContextLet(0);
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.handleSaveClick(lbfl_r16, frame2_r15, false));
    });
    \u0275\u0275elementStart(3, "span", 41);
    \u0275\u0275text(4, "save");
    \u0275\u0275elementEnd();
    \u0275\u0275text(5, " Save ");
    \u0275\u0275elementEnd()();
    \u0275\u0275conditionalCreate(6, LabelerCenterPanelComponent_Conditional_16_Conditional_6_Template, 7, 3, "div", 45);
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext();
    \u0275\u0275storeLet(ctx_r1.labelFile());
    \u0275\u0275advance();
    \u0275\u0275attribute("data-tip", ctx_r1.saveTooltip);
    \u0275\u0275advance();
    \u0275\u0275classProp("btn-disabled", ctx_r1.isSaveDisabled());
    \u0275\u0275advance(4);
    \u0275\u0275conditional(ctx_r1.mvf(ctx).isFromUnlabeledSet ? 6 : -1);
  }
}
var LabelerCenterPanelComponent = class _LabelerCenterPanelComponent {
  projectInfoService = inject2(ProjectInfoService);
  toastService = inject2(ToastService);
  labelFile = input(null, ...ngDevMode ? [{ debugName: "labelFile" }] : []);
  frame = input(null, ...ngDevMode ? [{ debugName: "frame" }] : []);
  numLabeledFrames = input.required(...ngDevMode ? [{ debugName: "numLabeledFrames" }] : []);
  saved = output();
  ngOnChanges(changes) {
    if (changes["frame"]) {
      this.abortController.abort();
      this.abortController = new AbortController();
      this.hasCameraCalibrationFiles.set(false);
      this.checkIfHasCameraCalibrationFiles();
    }
    if (changes["frame"] && this.frame() && mvf(this.frame()).isFromUnlabeledSet) {
      this._selectedView.set(null);
      this.selectedKeypoint.set(this.selectedFrameView()?.keypoints[0]?.keypointName ?? null);
    }
  }
  checkIfHasCameraCalibrationFiles() {
    const abortSignal = this.abortController.signal;
    if (!this.frame())
      return;
    const sessionKey = mvf(this.frame()).autolabelSessionKey;
    if (!sessionKey)
      return;
    this.sessionService.hasCameraCalibrationFiles(sessionKey).then((hasFiles) => {
      if (abortSignal.aborted)
        return;
      this.hasCameraCalibrationFiles.set(hasFiles);
    });
  }
  // selectedView is always nonnull. Defaults to first view in frame.
  // Underlying selection state can be null if user hasn't selected any view explicitly yet.
  _selectedView = signal(null, ...ngDevMode ? [{ debugName: "_selectedView" }] : []);
  selectedView = computed(() => {
    if (this._selectedView()) {
      return this._selectedView();
    } else {
      return this.frame()?.views[0]?.viewName ?? "unknown";
    }
  }, ...ngDevMode ? [{ debugName: "selectedView" }] : []);
  selectedFrameView = computed(() => this.getFrameView(this.selectedView()), ...ngDevMode ? [{ debugName: "selectedFrameView" }] : []);
  getFrameView(view) {
    const frame = this.frame();
    if (!frame) {
      return null;
    }
    return frame.views.find((x) => x.viewName === view) ?? null;
  }
  selectedKeypoint = signal(null, ...ngDevMode ? [{ debugName: "selectedKeypoint" }] : []);
  keypointViewModelCache = /* @__PURE__ */ new WeakMap();
  getCachedKeypointViewModels(keypoints) {
    if (!this.keypointViewModelCache.has(keypoints)) {
      const target = keypoints.map((k) => this.buildViewModel(k)).filter((keypoint) => !isNaN(keypoint.position().x) && !isNaN(keypoint.position().y));
      this.keypointViewModelCache.set(keypoints, target);
    }
    return this.keypointViewModelCache.get(keypoints);
  }
  buildViewModel(lkeypoint) {
    const val = {
      id: lkeypoint.keypointName,
      hoverText: lkeypoint.keypointName,
      position: signal({ x: lkeypoint.x, y: lkeypoint.y }),
      colorClass: computed(() => {
        if (this.selectedKeypoint() == null) {
          return "bg-green-500/10";
        }
        if (lkeypoint.keypointName === this.selectedKeypoint()) {
          return "bg-green-500/20";
        } else {
          return "bg-green-500/5";
        }
      })
    };
    return val;
  }
  imgPath(kpImgPath) {
    return "/app/v0/files/" + this.projectInfoService.projectInfo.data_dir + "/" + kpImgPath;
  }
  handleViewClickFromFilmstrip(viewName) {
    this._selectedView.set(viewName);
  }
  // Set to a random value if you need to bust cache of computed signals.
  cacheBuster = signal(0, ...ngDevMode ? [{ debugName: "cacheBuster" }] : []);
  /** an overload of `handleKeypointUpdated` that uses viewName: string
   * instead of a reference to frameview. Used for autolabeling */
  handleKeypointUpdated2(keypointName, viewName, position) {
    const frameView = this.getFrameView(viewName);
    this.handleKeypointUpdated(keypointName, position, frameView);
  }
  handleKeypointUpdated(keypointName, position, frameView) {
    const keypoint = frameView.keypoints.find((kp2) => kp2.keypointName === keypointName);
    const newKp = {
      x: position.x,
      y: position.y,
      keypointName
    };
    frameView.keypoints = frameView.keypoints.map((item) => item === keypoint ? __spreadValues(__spreadValues({}, keypoint), newKp) : item);
    this.keypointViewModelCache.delete(frameView.keypoints);
    if (lkp(keypoint).isNaN()) {
      this.selectNextUnlabeledKeypoint(keypointName);
    }
    this.cacheBuster.set(Math.random());
  }
  /** Default NaN Keypoints to edit mode. */
  get labelerDefaultsToEditMode() {
    const frameView = this.selectedFrameView();
    if (!frameView)
      return false;
    const selectedKeypoint = this.selectedKeypoint();
    if (!selectedKeypoint)
      return false;
    const selectedKeypointInFrame = frameView.keypoints.find((kp2) => kp2.keypointName === selectedKeypoint);
    if (!selectedKeypointInFrame)
      return false;
    return lkp(selectedKeypointInFrame).isNaN();
  }
  /**
   * Selects the next keypoint that does not have a label in the currently selected frame view.
   */
  selectNextUnlabeledKeypoint(originKp) {
    const frameView = this.selectedFrameView();
    if (frameView) {
      const startIdx = originKp === null ? 0 : frameView.keypoints.findIndex((kp2) => kp2.keypointName === originKp);
      for (let i = startIdx + 1; i < frameView.keypoints.length; i++) {
        const kp2 = frameView.keypoints[i];
        if (lkp(kp2).isNaN()) {
          this.selectedKeypoint.set(kp2.keypointName);
          return;
        }
      }
    }
  }
  handleKeypointClearClick(kp2) {
    if (this.selectedFrameView()) {
      this.handleKeypointUpdated(kp2.keypointName, { x: NaN, y: NaN }, this.selectedFrameView());
    }
  }
  get saveTooltip() {
    if (!this.isSaveDisabled())
      return "";
    return "No changes to save.";
  }
  get saveAndContinueTooltip() {
    if (!this.isSaveDisabled())
      return "Save and advance to next unlabeled frame.";
    return "No changes to save.";
  }
  // export to template
  mvf = mvf;
  sessionService = inject2(SessionService);
  abortController = new AbortController();
  isSaving = signal(false, ...ngDevMode ? [{ debugName: "isSaving" }] : []);
  isMVAutoLabeling = signal(false, ...ngDevMode ? [{ debugName: "isMVAutoLabeling" }] : []);
  hasCameraCalibrationFiles = signal(false, ...ngDevMode ? [{ debugName: "hasCameraCalibrationFiles" }] : []);
  disableInteractions = computed(() => {
    this.cacheBuster();
    return !this.frame() || this.isSaving() || this.isMVAutoLabeling();
  }, ...ngDevMode ? [{ debugName: "disableInteractions" }] : []);
  isSaveDisabled = computed(() => {
    this.cacheBuster();
    return !this.frame() || this.disableInteractions() || !mvf(this.frame()).hasChanges;
  }, ...ngDevMode ? [{ debugName: "isSaveDisabled" }] : []);
  newLabelFile = output();
  handleSaveClick(labelFile, frame, shouldContinue) {
    this.isSaving.set(true);
    this.sessionService.saveMVFrame(labelFile, frame).then(() => {
      this.isSaving.set(false);
      this.saved.emit({ labelFile, frame, shouldContinue });
      this.toastService.showToast({ content: "Saved successfully" });
    }).catch((error) => {
      this.isSaving.set(false);
      throw new Error(error);
    });
  }
  handleMVAutoLabelClick(labelFile, frame) {
    this.isMVAutoLabeling.set(true);
    const abortSignal = this.abortController.signal;
    const sessionKey = mvf(frame).autolabelSessionKey;
    if (!sessionKey) {
      return;
    }
    this.sessionService.mvAutoLabel(frame, sessionKey).then((response) => {
      this.isMVAutoLabeling.set(false);
      if (abortSignal.aborted)
        return;
      response.keypoints.forEach((kp2) => {
        if (!kp2.projections)
          return;
        kp2.projections.forEach((proj) => {
          const projectedPoint = proj.projectedPoint;
          if (!projectedPoint)
            return;
          if (proj.originalPoint)
            return;
          this.handleKeypointUpdated2(kp2.keypointName, proj.view, {
            x: projectedPoint.x,
            y: projectedPoint.y
          });
        });
      });
      this.toastService.showToast({
        content: "Success: keypoints have been labeled wherever possible."
      });
    }).catch((error) => {
      this.isMVAutoLabeling.set(false);
      throw error;
    });
  }
  static \u0275fac = function LabelerCenterPanelComponent_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _LabelerCenterPanelComponent)();
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _LabelerCenterPanelComponent, selectors: [["app-labeler-center-panel"]], inputs: { labelFile: [1, "labelFile"], frame: [1, "frame"], numLabeledFrames: [1, "numLabeledFrames"] }, outputs: { saved: "saved", newLabelFile: "newLabelFile" }, features: [\u0275\u0275NgOnChangesFeature], decls: 17, vars: 5, consts: [["content", ""], ["baDialog", ""], [1, "grid", "grid-cols-1", "md:grid-cols-[2fr_1fr]", "h-[90vh]", "w-full", "gap-4"], [1, "grid", "grid-rows-[1fr_auto]", "gap-4", "p-4"], [1, "flex", "items-center", "justify-center", "h-full"], ["appHorizontalScroll", "", 1, "p-4", "rounded-lg", "overflow-x-auto", "whitespace-nowrap"], [1, "flex", "flex-col", "gap-4"], [1, "panel", "m-4"], [1, "px-2", "mb-1"], [1, "panel-content", "overflow-y-auto", "max-h-100"], [1, "panel", "m-4", "mt-0"], [1, "m-4"], [1, "text-lg", "opacity-60", "text-center"], [1, "bg-base-200", "px-2", "text-md"], [1, "h-full", "w-full", 3, "maxScale"], [1, "relative"], ["alt", "fv.imgPath", 1, "max-w-none", 3, "src"], [1, "absolute", "top-0", "left-0", "h-full", "w-full", 3, "selectedKeypointChange", "keypointUpdated", "enableEditing", "keypointModels", "selectedKeypoint", "useCrossHairs", "editMode"], [1, "!inline-block", "m-1", "rounded-sm", "overflow-hidden", "border-primary", "hover:border", 3, "border", "cursor-pointer"], [1, "!inline-block", "m-1", "rounded-sm", "overflow-hidden", "border-primary", "hover:border", 3, "click"], [1, "bg-base-200", "px-1", "text-sm"], [1, "!h-[112px]", "!w-[112px]", 3, "interactivityDisabled"], ["height", "320", "width", "320", "alt", "fv.imgPath", 1, "max-w-none", 3, "src"], [3, "keypointModels"], [3, "class"], [3, "click"], [1, "flex", "items-center"], [1, "btn", "btn-circle", "btn-xs", "!text-xs", "material-icons", "ml-2", "invisible", "group-hover:visible", 3, "click"], [1, "px-2", "mb-1", "flex", "justify-between", "items-center"], ["data-tip", "Learn more", "onclick", "multiview_info.showModal()", 1, "btn", "btn-circle", "btn-info", "btn-soft", "btn-xs", "text-sm!", "tooltip", "tooltip-bottom"], [1, "material-icons", "text-xs!"], ["id", "multiview_info", 1, "modal"], [1, "modal-box", "w-5/6", "max-w-3xl", "prose"], ["onclick", "multiview_info.close()", 1, "btn", "btn-md", "btn-circle", "btn-ghost", "absolute", "right-4", "top-4"], [1, "mt-0"], [1, "modal-action"], ["method", "dialog"], [1, "btn"], [1, "panel-content", "overflow-y-auto", "p-2!"], [1, "btn", "btn-sm", "bg-sky-700", "w-full", "mb-2", 3, "click"], [1, "btn", "btn-sm", "w-full", "btn-soft", 3, "click"], [1, "material-icons"], [3, "labelFile", "frame", "numLabeledFrames"], [1, "tooltip", "w-full"], [1, "btn", "bg-sky-700", "w-full", 3, "click", "keydown.enter"], [1, "tooltip", "tooltip-bottom", "w-full"], [1, "btn", "bg-sky-700", "w-full", "mt-2", 3, "click", "keydown.enter"]], template: function LabelerCenterPanelComponent_Template(rf, ctx) {
    if (rf & 1) {
      \u0275\u0275elementStart(0, "div", 2)(1, "div", 3);
      \u0275\u0275conditionalCreate(2, LabelerCenterPanelComponent_Conditional_2_Template, 3, 0, "div", 4)(3, LabelerCenterPanelComponent_Conditional_3_Template, 3, 0, "div", 4)(4, LabelerCenterPanelComponent_Conditional_4_Template, 9, 9, "div");
      \u0275\u0275elementStart(5, "div", 5);
      \u0275\u0275conditionalCreate(6, LabelerCenterPanelComponent_Conditional_6_Template, 2, 0);
      \u0275\u0275elementEnd()();
      \u0275\u0275elementStart(7, "div", 6)(8, "div", 7)(9, "div")(10, "h1", 8);
      \u0275\u0275text(11, "Keypoints");
      \u0275\u0275elementEnd()();
      \u0275\u0275elementStart(12, "div", 9);
      \u0275\u0275conditionalCreate(13, LabelerCenterPanelComponent_Conditional_13_Template, 3, 0, "ul");
      \u0275\u0275elementEnd()();
      \u0275\u0275conditionalCreate(14, LabelerCenterPanelComponent_Conditional_14_Template, 68, 23, "div", 10);
      \u0275\u0275elementStart(15, "div", 11);
      \u0275\u0275conditionalCreate(16, LabelerCenterPanelComponent_Conditional_16_Template, 7, 5);
      \u0275\u0275elementEnd()()();
    }
    if (rf & 2) {
      let tmp_1_0;
      let tmp_2_0;
      let tmp_3_0;
      let tmp_4_0;
      \u0275\u0275advance(2);
      \u0275\u0275conditional(!ctx.labelFile() ? 2 : !ctx.frame() ? 3 : 4);
      \u0275\u0275advance(4);
      \u0275\u0275conditional((tmp_1_0 = ctx.frame()) ? 6 : -1, tmp_1_0);
      \u0275\u0275advance(7);
      \u0275\u0275conditional((tmp_2_0 = ctx.selectedFrameView()) ? 13 : -1, tmp_2_0);
      \u0275\u0275advance();
      \u0275\u0275conditional((tmp_3_0 = ctx.frame()) ? 14 : -1, tmp_3_0);
      \u0275\u0275advance(2);
      \u0275\u0275conditional((tmp_4_0 = ctx.frame()) ? 16 : -1, tmp_4_0);
    }
  }, dependencies: [
    ZoomableContentComponent,
    KeypointContainerComponent,
    HorizontalScrollDirective,
    BundleAdjustDialogComponent,
    DecimalPipe,
    PathPipe
  ], encapsulation: 2, changeDetection: 0 });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(LabelerCenterPanelComponent, [{
    type: Component,
    args: [{ selector: "app-labeler-center-panel", imports: [
      DecimalPipe,
      ZoomableContentComponent,
      KeypointContainerComponent,
      HorizontalScrollDirective,
      PathPipe,
      BundleAdjustDialogComponent
    ], changeDetection: ChangeDetectionStrategy.OnPush, template: `<div class="grid grid-cols-1 md:grid-cols-[2fr_1fr] h-[90vh] w-full gap-4">
  <!-- First Column: Nested Grid with Two Rows -->
  <!-- grid-rows-[1fr_auto] makes the first row take available space (big), and the second row size to its content (small) -->
  <!-- Alternatively, you could use fixed heights like grid-rows-[1fr_h-32] for the second row -->
  <div class="grid grid-rows-[1fr_auto] gap-4 p-4">
    <!-- Main view -->

    @if (!labelFile()) {
      <div class="flex items-center justify-center h-full">
        <div class="text-lg opacity-60 text-center">
          Select a label file on the left
        </div>
      </div>
    } @else if (!frame()) {
      <div class="flex items-center justify-center h-full">
        <div class="text-lg opacity-60 text-center">
          Select a frame on the left to view
        </div>
      </div>
    } @else {
      @let fv = selectedFrameView()!;
      <div>
        <h3 class="bg-base-200 px-2 text-md">
          {{ fv.viewName }}
        </h3>
        <app-zoomable-content class="h-full w-full" [maxScale]="100">
          <div #content class="relative">
            <!-- img has max-w-none to override a bad default value of 100% -->
            <img
              [src]="imgPath(fv.imgPath)"
              class="max-w-none"
              alt="fv.imgPath"
            />
            <app-keypoint-container
              [enableEditing]="!disableInteractions()"
              [keypointModels]="getCachedKeypointViewModels(fv.keypoints)"
              [(selectedKeypoint)]="selectedKeypoint"
              [useCrossHairs]="true"
              [editMode]="labelerDefaultsToEditMode"
              (keypointUpdated)="
                handleKeypointUpdated($event.kp, $event.position, fv)
              "
              class="absolute top-0 left-0 h-full w-full"
            ></app-keypoint-container>
          </div>
        </app-zoomable-content>
      </div>
    }

    <!-- Filmstrip of all views (Small Height, Horizontal Overflow) -->
    <!-- overflow-x-auto enables horizontal scrolling -->
    <!-- whitespace-nowrap ensures content stays on a single line to trigger overflow -->
    <div
      class="p-4 rounded-lg overflow-x-auto whitespace-nowrap"
      appHorizontalScroll
    >
      @if (frame(); as frame2) {
        @let views2 = frame2.views;
        @for (fv of views2; track fv.viewName) {
          <div
            class="!inline-block m-1 rounded-sm overflow-hidden border-primary hover:border"
            [class.border]="selectedView() === fv.viewName"
            [class.cursor-pointer]="selectedView() !== fv.viewName"
            (click)="handleViewClickFromFilmstrip(fv.viewName)"
          >
            <h3 class="bg-base-200 px-1 text-sm">
              {{ fv.viewName }}
            </h3>

            <app-zoomable-content
              class="!h-[112px] !w-[112px]"
              [interactivityDisabled]="true"
            >
              <img
                #content
                [src]="imgPath(fv.imgPath)"
                class="max-w-none"
                height="320"
                width="320"
                alt="fv.imgPath"
              />
              <app-keypoint-container
                [keypointModels]="getCachedKeypointViewModels(fv.keypoints)"
              ></app-keypoint-container>
            </app-zoomable-content>
          </div>
        }
      }
    </div>
  </div>

  <!-- Second Column: Single Row -->
  <div class="flex flex-col gap-4">
    <div class="panel m-4">
      <div>
        <!-- panel header -->
        <h1 class="px-2 mb-1">Keypoints</h1>
      </div>
      <div class="panel-content overflow-y-auto max-h-100">
        @if (selectedFrameView(); as fv) {
          <ul>
            @for (kp of fv.keypoints; track $index) {
              <li
                class="p-1 flex justify-between items-center group {{
                  kp.keypointName === selectedKeypoint()
                    ? 'bg-sky-700'
                    : 'hover:bg-base-content/10 cursor-pointer'
                }}"
                (click)="selectedKeypoint.set(kp.keypointName)"
              >
                <span>{{ kp.keypointName }}</span>
                <span class="flex items-center">
                  (
                  <span>{{ kp.x | number: "1.0-1" }}</span>
                  ,
                  <span>{{ kp.y | number: "1.0-1" }}</span>
                  )
                  <button
                    class="btn btn-circle btn-xs !text-xs material-icons ml-2 invisible group-hover:visible"
                    (click)="handleKeypointClearClick(kp)"
                  >
                    close
                  </button>
                </span>
              </li>
            }
          </ul>
        }
      </div>
    </div>
    @if (frame(); as frame2) {
      @let lbfl = labelFile()!;
      <div class="panel m-4 mt-0">
        <div>
          <!-- panel header -->
          <h1 class="px-2 mb-1 flex justify-between items-center">
            Multiview tools
            <button
              class="btn btn-circle btn-info btn-soft btn-xs text-sm! tooltip tooltip-bottom"
              data-tip="Learn more"
              onclick="multiview_info.showModal()"
            >
              <span class="material-icons text-xs!">question_mark</span>
            </button>
          </h1>
        </div>
        <dialog class="modal" id="multiview_info">
          <div class="modal-box w-5/6 max-w-3xl prose">
            <button
              class="btn btn-md btn-circle btn-ghost absolute right-4 top-4"
              onclick="multiview_info.close()"
            >
              \u2715
            </button>
            <h2 class="mt-0">Multiview tools</h2>
            <p>Use camera parameters to assist labeling.</p>
            <p>
              With accurate parameters, you need only label two views per
              keypoint: the other views can be auto-labeled by triangulating and
              reprojecting. The tool also supports bundle adjustment to refine
              the camera parameters after labeling several frames.
            </p>
            <h3>How to provide camera parameters to Lightning Pose</h3>
            <p>
              Camera calibration is typically performed using Anipose before
              every session. Camera parameters are recommended to be
              session-specific to allow for changes in camera position from
              session to session, however a single project-wide calibration file
              is also supported.
            </p>
            <p>
              Session specific calibration files should be at
              <code>{{ "calibrations/{sessionKey}.toml" | path }}</code
              >. where <code>sessionKey</code> is the video filename without the
              viewname.<br />
              For example, the calibration file for session with files like
            </p>

            <ul>
              <li>
                <code>{{ "videos/session1_view1.mp4" | path }}</code> would be
                <code>{{ "calibrations/session1.toml" | path }}</code>
              </li>
              <li>
                <code>{{ "videos/session1_view1_123.mp4" | path }}</code> would
                be
                <code>{{ "calibrations/session1_123.toml" | path }}</code>
              </li>
            </ul>
            <p>
              The optional project calibration file should be at
              <code>calibration.toml</code>. It will be used if session-specific
              calibration is not found. When bundle adjustment is performed, it
              will not modify the project calibration.toml; it will instead
              output a session-specific calibration file.
            </p>

            <div class="modal-action">
              <form method="dialog">
                <!-- if there is a button in form, it will close the modal -->
                <button class="btn">Close</button>
              </form>
            </div>
          </div>
        </dialog>
        <div class="panel-content overflow-y-auto p-2!">
          <button
            class="btn btn-sm bg-sky-700 w-full mb-2"
            [class.btn-disabled]="
              !hasCameraCalibrationFiles() || disableInteractions()
            "
            (click)="handleMVAutoLabelClick(lbfl, frame2)"
          >
            \u2728 Project keypoints to all views
          </button>
          <button
            class="btn btn-sm w-full btn-soft"
            [class.btn-disabled]="
              !hasCameraCalibrationFiles() || disableInteractions()
            "
            (click)="baDialog.open()"
          >
            <span class="material-icons">model_training</span>
            Refine calibration (bundle adjustment)
          </button>
          <app-bundle-adjust-dialog
            #baDialog
            [labelFile]="labelFile()"
            [frame]="this.frame()"
            [numLabeledFrames]="numLabeledFrames()"
          ></app-bundle-adjust-dialog>
        </div>
      </div>
    }
    <div class="m-4">
      @if (frame(); as frame2) {
        @let lbfl = labelFile()!;
        <div class="tooltip w-full" [attr.data-tip]="saveTooltip">
          <button
            class="btn bg-sky-700 w-full"
            [class.btn-disabled]="isSaveDisabled()"
            (click)="handleSaveClick(lbfl, frame2, false)"
            (keydown.enter)="handleSaveClick(lbfl, frame2, false)"
          >
            <span class="material-icons">save</span> Save
          </button>
        </div>
        @if (mvf(frame2).isFromUnlabeledSet) {
          <div
            class="tooltip tooltip-bottom w-full"
            [attr.data-tip]="saveAndContinueTooltip"
          >
            <button
              class="btn bg-sky-700 w-full mt-2"
              [class.btn-disabled]="isSaveDisabled()"
              (click)="handleSaveClick(lbfl, frame2, true)"
              (keydown.enter)="handleSaveClick(lbfl, frame2, true)"
            >
              <span class="material-icons">save</span>
              Save and view next frame
              <span class="material-icons">arrow_forward</span>
            </button>
          </div>
        }
      }
    </div>
  </div>
</div>
` }]
  }], null, null);
})();
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(LabelerCenterPanelComponent, { className: "LabelerCenterPanelComponent", filePath: "src/app/labeler/labeler-center-panel/labeler-center-panel.component.ts", lineNumber: 42 });
})();

// src/app/labeler/label-file-fetcher.service.ts
var LabelFileFetcherService = class _LabelFileFetcherService {
  projectInfoService = inject2(ProjectInfoService);
  httpClient = inject2(HttpClient);
  csvParser = inject2(CsvParserService);
  async loadLabelFileData(labelFile) {
    const csvRequests = labelFile.views.map((labelFileView) => {
      const { csvPath } = labelFileView;
      return this.fetchCsvFile(csvPath).then((csvString) => {
        if (!csvString) {
          throw new Error("Failed to load CSV file: " + csvPath);
        }
        const df = this.csvParser.parsePredictionFile(csvString);
        return { lfv: labelFileView, df };
      });
    });
    const mvFramePromise = Promise.all(csvRequests).then((results) => {
      const mvFrames = this.zipDataframesIntoMVFrame(results);
      return mvFrames;
    });
    const unlabeledPromise = Promise.all(labelFile.views.map((labelFileView) => {
      const sidecarPath = this.getUnlabeledSidecarPath(labelFileView.csvPath);
      return firstValueFrom(this.httpClient.get("/app/v0/files/" + sidecarPath, {
        responseType: "text"
      })).catch((e) => {
        if (e.status === 404) {
          return null;
        } else {
          throw new Error("Error fetching CSV file: " + sidecarPath);
        }
      }).then((filecontents) => {
        if (!filecontents) {
          return null;
        }
        const lines = filecontents.split("\n").map((line) => line.trim()).filter((x) => x);
        return { lfv: labelFileView, lines };
      });
    })).then((results) => {
      if (results.some((r) => r == null)) {
        return [];
      }
      const maxLines = Math.max(...results.map((r) => r.lines.length));
      return Array.from({ length: maxLines }).map((_4, i) => {
        const views = results.map((r) => {
          const imgPath = r.lines[i];
          return {
            viewName: r.lfv.viewName,
            imgPath,
            keypoints: [],
            // we'll patch this later once labeledframes are loaded.
            originalKeypoints: null
          };
        }).filter((x) => x !== null);
        const key = views[0].imgPath.replace(views[0].viewName, "*");
        return { key, views };
      });
    });
    const mvf2 = await mvFramePromise;
    const unl = await unlabeledPromise;
    const keypointsFromFirstFrame = mvf2[0]?.views[0]?.keypoints?.map((kp2) => kp2.keypointName);
    const keypointsFromProjectConfig = this.projectInfoService.projectInfo.keypoint_names;
    const allKeypoints = keypointsFromFirstFrame ? keypointsFromFirstFrame.sort(orderStringsByUserSpecifiedOrder(keypointsFromProjectConfig)) : keypointsFromProjectConfig;
    if (allKeypoints !== null) {
      unl.forEach((unlFrame) => {
        unlFrame.views.forEach((unlView) => {
          unlView.keypoints = allKeypoints.map((keypointName) => {
            return {
              x: NaN,
              y: NaN,
              keypointName
            };
          });
        });
      });
    }
    return mvf2.concat(unl);
  }
  getUnlabeledSidecarPath(csvPath) {
    return csvPath.replace(/\.csv$/, ".unlabeled");
  }
  // Fetch the CSV file using HttpClient
  async fetchCsvFile(csvPath) {
    try {
      const url = "/app/v0/files/" + csvPath;
      return await firstValueFrom(this.httpClient.get(url, { responseType: "text" }));
    } catch (error) {
      console.error("Error fetching CSV file:", error);
      return null;
    }
  }
  parseKPsOfDfRow(labelFileData, currIndex) {
    const columns = labelFileData.columns.map(Pair.fromMapKey);
    const groupedColumns = columns.reduce((acc, column) => {
      const bodyPart = column.first;
      if (!acc[bodyPart]) {
        acc[bodyPart] = [];
      }
      acc[bodyPart].push(column);
      return acc;
    }, {});
    const kps = Object.entries(groupedColumns).map(([keypointName, cols]) => {
      const xColumn = cols.find((col) => col.second === "x");
      const yColumn = cols.find((col) => col.second === "y");
      const x = xColumn ? labelFileData.at(currIndex, xColumn.toMapKey()) : null;
      const y = yColumn ? labelFileData.at(currIndex, yColumn.toMapKey()) : null;
      if (x == null || y == null)
        return null;
      return { keypointName, x, y };
    }).filter((x) => x != null);
    return kps;
  }
  zipDataframesIntoMVFrame(results) {
    const framesPerView = {};
    results.forEach(({ lfv, df }) => {
      framesPerView[lfv.viewName] = this.dfToFrameView(lfv.viewName, df);
    });
    const maxRowCount = Math.max(...Object.values(framesPerView).map((frames) => frames.length));
    const mvFrames = Array.from({ length: maxRowCount }).map((_4, i) => {
      const views = Object.values(framesPerView).map((frameViews) => frameViews[i]).filter((x) => x != null);
      const key = views[0].imgPath.replace(views[0].viewName, "*");
      return {
        key,
        views
      };
    });
    return mvFrames;
  }
  dfToFrameView(viewName, labelFileData) {
    return labelFileData.index.map((imgPath) => {
      imgPath = imgPath;
      const kpArray = this.parseKPsOfDfRow(labelFileData, imgPath);
      return {
        viewName,
        imgPath,
        keypoints: kpArray,
        originalKeypoints: structuredClone(kpArray)
      };
    });
  }
  static \u0275fac = function LabelFileFetcherService_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _LabelFileFetcherService)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _LabelFileFetcherService, factory: _LabelFileFetcherService.\u0275fac, providedIn: "root" });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(LabelFileFetcherService, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], null, null);
})();

// src/app/label-file-picker/label-file-picker.component.ts
var _c07 = () => [];
var _c15 = (a0) => ({ key: "None", views: a0 });
var _c23 = (a0) => [a0];
var _forTrack05 = ($index, $item) => $item.key;
function LabelFilePickerComponent_For_2_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275domElementStart(0, "option", 1);
    \u0275\u0275text(1);
    \u0275\u0275domElementEnd();
  }
  if (rf & 2) {
    const labelFile_r2 = ctx.$implicit;
    const ctx_r2 = \u0275\u0275nextContext();
    \u0275\u0275domProperty("value", labelFile_r2.key)("selected", labelFile_r2.key === ctx_r2.labelFileKey());
    \u0275\u0275advance();
    \u0275\u0275textInterpolate1(" ", labelFile_r2.key, " ");
  }
}
var LabelFilePickerComponent = class _LabelFilePickerComponent {
  labelFileKey = model(null, ...ngDevMode ? [{ debugName: "labelFileKey" }] : []);
  sessionService = inject2(SessionService);
  selectSizeClass = input("select-sm", ...ngDevMode ? [{ debugName: "selectSizeClass" }] : []);
  handleSelectLabelFile(value) {
    if (value === "None") {
      this.labelFileKey.set(null);
    } else {
      this.labelFileKey.set(value);
    }
  }
  static \u0275fac = function LabelFilePickerComponent_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _LabelFilePickerComponent)();
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _LabelFilePickerComponent, selectors: [["app-label-file-picker"]], inputs: { labelFileKey: [1, "labelFileKey"], selectSizeClass: [1, "selectSizeClass"] }, outputs: { labelFileKey: "labelFileKeyChange" }, decls: 3, vars: 8, consts: [[3, "change"], [3, "value", "selected"]], template: function LabelFilePickerComponent_Template(rf, ctx) {
    if (rf & 1) {
      const _r1 = \u0275\u0275getCurrentView();
      \u0275\u0275domElementStart(0, "select", 0);
      \u0275\u0275domListener("change", function LabelFilePickerComponent_Template_select_change_0_listener($event) {
        \u0275\u0275restoreView(_r1);
        return \u0275\u0275resetView(ctx.handleSelectLabelFile($event.target.value));
      });
      \u0275\u0275repeaterCreate(1, LabelFilePickerComponent_For_2_Template, 2, 3, "option", 1, _forTrack05);
      \u0275\u0275domElementEnd();
    }
    if (rf & 2) {
      \u0275\u0275classMap(\u0275\u0275interpolate1("select ", ctx.selectSizeClass()));
      const nullOption_r4 = \u0275\u0275pureFunction1(4, _c15, \u0275\u0275pureFunction0(3, _c07));
      \u0275\u0275advance();
      \u0275\u0275repeater(\u0275\u0275pureFunction1(6, _c23, nullOption_r4).concat(ctx.sessionService.allLabelFiles()));
    }
  }, encapsulation: 2, changeDetection: 0 });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(LabelFilePickerComponent, [{
    type: Component,
    args: [{ selector: "app-label-file-picker", imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: '<select\n  class="select {{ selectSizeClass() }}"\n  (change)="handleSelectLabelFile($any($event.target).value)"\n>\n  @let nullOption = { key: "None", views: [] };\n  @for (\n    labelFile of $any([nullOption]).concat(sessionService.allLabelFiles());\n    track labelFile.key\n  ) {\n    <option\n      [value]="labelFile.key"\n      [selected]="labelFile.key === labelFileKey()"\n    >\n      {{ labelFile.key }}\n    </option>\n  }\n</select>\n' }]
  }], null, null);
})();
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(LabelFilePickerComponent, { className: "LabelFilePickerComponent", filePath: "src/app/label-file-picker/label-file-picker.component.ts", lineNumber: 17 });
})();

// src/app/labeler/extract-frames-dialog/extract-frames-dialog.component.ts
var _c08 = ["labelFileTemplateNgModel"];
function ExtractFramesDialogComponent_Conditional_14_Conditional_42_Conditional_5_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275text(0, " Single camera project detected. If instead you have multiple camera views for each session, set the Views field in the project settings and return to this workflow. ");
  }
}
function ExtractFramesDialogComponent_Conditional_14_Conditional_42_Conditional_6_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275text(0, " Multiview project detected. One file will be created per camera view. Use the ");
    \u0275\u0275elementStart(1, "code", 37);
    \u0275\u0275text(2, "*");
    \u0275\u0275elementEnd();
    \u0275\u0275text(3, " character to represent the view name. For example, ");
    \u0275\u0275elementStart(4, "code", 37);
    \u0275\u0275text(5, "CollectedData_*.csv");
    \u0275\u0275elementEnd();
    \u0275\u0275text(6, ". ");
  }
}
function ExtractFramesDialogComponent_Conditional_14_Conditional_42_Conditional_18_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "li");
    \u0275\u0275text(1, "Filename required");
    \u0275\u0275elementEnd();
  }
}
function ExtractFramesDialogComponent_Conditional_14_Conditional_42_Conditional_19_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "li");
    \u0275\u0275text(1, "Filename invalid");
    \u0275\u0275elementEnd();
  }
}
function ExtractFramesDialogComponent_Conditional_14_Conditional_42_Conditional_20_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "li");
    \u0275\u0275text(1, "Filename missing required star character");
    \u0275\u0275elementEnd();
  }
}
function ExtractFramesDialogComponent_Conditional_14_Conditional_42_Conditional_21_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "li");
    \u0275\u0275text(1, " Star character must be next to valid delimiters: - or _ ");
    \u0275\u0275elementEnd();
  }
}
function ExtractFramesDialogComponent_Conditional_14_Conditional_42_Conditional_22_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "li");
    \u0275\u0275text(1, " Invalid name: remove ");
    \u0275\u0275elementStart(2, "code");
    \u0275\u0275text(3, ".csv");
    \u0275\u0275elementEnd();
    \u0275\u0275text(4, " extension ");
    \u0275\u0275elementEnd();
  }
}
function ExtractFramesDialogComponent_Conditional_14_Conditional_42_Template(rf, ctx) {
  if (rf & 1) {
    const _r3 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "div", 29)(1, "label", 30);
    \u0275\u0275text(2, "2. Enter the filename for the new label file");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(3, "div", 24)(4, "p", 31);
    \u0275\u0275conditionalCreate(5, ExtractFramesDialogComponent_Conditional_14_Conditional_42_Conditional_5_Template, 1, 0)(6, ExtractFramesDialogComponent_Conditional_14_Conditional_42_Conditional_6_Template, 7, 0);
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(7, "label", 32)(8, "input", 33, 0);
    \u0275\u0275twoWayListener("ngModelChange", function ExtractFramesDialogComponent_Conditional_14_Conditional_42_Template_input_ngModelChange_8_listener($event) {
      \u0275\u0275restoreView(_r3);
      const ctx_r1 = \u0275\u0275nextContext(2);
      \u0275\u0275twoWayBindingSet(ctx_r1.newLabelFileTemplate, $event) || (ctx_r1.newLabelFileTemplate = $event);
      return \u0275\u0275resetView($event);
    });
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(10, "span", 34);
    \u0275\u0275text(11, ".csv");
    \u0275\u0275elementEnd()();
    \u0275\u0275elementStart(12, "div", 35)(13, "code");
    \u0275\u0275text(14);
    \u0275\u0275elementEnd();
    \u0275\u0275text(15, " is the recommended default. ");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(16, "div", 36)(17, "ul");
    \u0275\u0275conditionalCreate(18, ExtractFramesDialogComponent_Conditional_14_Conditional_42_Conditional_18_Template, 2, 0, "li");
    \u0275\u0275conditionalCreate(19, ExtractFramesDialogComponent_Conditional_14_Conditional_42_Conditional_19_Template, 2, 0, "li");
    \u0275\u0275conditionalCreate(20, ExtractFramesDialogComponent_Conditional_14_Conditional_42_Conditional_20_Template, 2, 0, "li");
    \u0275\u0275conditionalCreate(21, ExtractFramesDialogComponent_Conditional_14_Conditional_42_Conditional_21_Template, 2, 0, "li");
    \u0275\u0275conditionalCreate(22, ExtractFramesDialogComponent_Conditional_14_Conditional_42_Conditional_22_Template, 5, 0, "li");
    \u0275\u0275elementEnd()()()();
  }
  if (rf & 2) {
    const labelFileTemplateNgModel_r4 = \u0275\u0275reference(9);
    const ctx_r1 = \u0275\u0275nextContext(2);
    \u0275\u0275advance(5);
    \u0275\u0275conditional(!ctx_r1.isMultiviewProject() ? 5 : 6);
    \u0275\u0275advance(2);
    \u0275\u0275classProp("input-success", labelFileTemplateNgModel_r4.valid && labelFileTemplateNgModel_r4.touched)("input-error", labelFileTemplateNgModel_r4.invalid && labelFileTemplateNgModel_r4.touched);
    \u0275\u0275advance();
    \u0275\u0275twoWayProperty("ngModel", ctx_r1.newLabelFileTemplate);
    \u0275\u0275advance(6);
    \u0275\u0275textInterpolate(ctx_r1.defaultLabelFileTemplate());
    \u0275\u0275advance(4);
    \u0275\u0275conditional((labelFileTemplateNgModel_r4.errors == null ? null : labelFileTemplateNgModel_r4.errors["required"]) ? 18 : -1);
    \u0275\u0275advance();
    \u0275\u0275conditional((labelFileTemplateNgModel_r4.errors == null ? null : labelFileTemplateNgModel_r4.errors["invalidFilename"]) ? 19 : -1);
    \u0275\u0275advance();
    \u0275\u0275conditional((labelFileTemplateNgModel_r4.errors == null ? null : labelFileTemplateNgModel_r4.errors["viewStarMissing"]) ? 20 : -1);
    \u0275\u0275advance();
    \u0275\u0275conditional((labelFileTemplateNgModel_r4.errors == null ? null : labelFileTemplateNgModel_r4.errors["starNotNextToDelimiter"]) ? 21 : -1);
    \u0275\u0275advance();
    \u0275\u0275conditional((labelFileTemplateNgModel_r4.errors == null ? null : labelFileTemplateNgModel_r4.errors["hasCSV"]) ? 22 : -1);
  }
}
function ExtractFramesDialogComponent_Conditional_14_Conditional_43_Template(rf, ctx) {
  if (rf & 1) {
    const _r5 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "div", 29)(1, "label", 30);
    \u0275\u0275text(2, "2. Select the destination label file");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(3, "app-label-file-picker", 38);
    \u0275\u0275twoWayListener("labelFileKeyChange", function ExtractFramesDialogComponent_Conditional_14_Conditional_43_Template_app_label_file_picker_labelFileKeyChange_3_listener($event) {
      \u0275\u0275restoreView(_r5);
      const ctx_r1 = \u0275\u0275nextContext(2);
      \u0275\u0275twoWayBindingSet(ctx_r1.existingLabelFileKey, $event) || (ctx_r1.existingLabelFileKey = $event);
      return \u0275\u0275resetView($event);
    });
    \u0275\u0275elementEnd()();
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext(2);
    \u0275\u0275advance(3);
    \u0275\u0275twoWayProperty("labelFileKey", ctx_r1.existingLabelFileKey);
    \u0275\u0275property("selectSizeClass", "select-md");
  }
}
function ExtractFramesDialogComponent_Conditional_14_Template(rf, ctx) {
  if (rf & 1) {
    const _r1 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "div", 9)(1, "p", 15);
    \u0275\u0275text(2, " This workflow identifies new frames to label and adds them to the labeling queue. It is often used when starting a project or to add frames from new sessions. ");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(3, "div", 16);
    \u0275\u0275element(4, "input", 17);
    \u0275\u0275elementStart(5, "div", 18);
    \u0275\u0275text(6, " Where are extracted frames stored? ");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(7, "div", 19);
    \u0275\u0275text(8, " Extracted frames are stored as ");
    \u0275\u0275elementStart(9, "code", 20);
    \u0275\u0275text(10, "PNG");
    \u0275\u0275elementEnd();
    \u0275\u0275text(11, " files in the ");
    \u0275\u0275elementStart(12, "code", 20);
    \u0275\u0275text(13, "labeled-data");
    \u0275\u0275elementEnd();
    \u0275\u0275text(14, " subdirectory of the project data directory as follows ");
    \u0275\u0275elementStart(15, "code", 21);
    \u0275\u0275text(16, "<data_dir>\xA0/\xA0labeled-data\xA0/\xA0<session_name>\xA0/\xA0img<frame_index>.png");
    \u0275\u0275elementEnd();
    \u0275\u0275text(17, " Additionally, for each frame ");
    \u0275\u0275elementStart(18, "code", 20);
    \u0275\u0275text(19, "i");
    \u0275\u0275elementEnd();
    \u0275\u0275text(20, ", adjacent frames ");
    \u0275\u0275elementStart(21, "code", 20);
    \u0275\u0275text(22, "i-2 ... i+2");
    \u0275\u0275elementEnd();
    \u0275\u0275text(23, " are extracted but not added to the labeling queue. These ");
    \u0275\u0275elementStart(24, "b");
    \u0275\u0275text(25, "context frames");
    \u0275\u0275elementEnd();
    \u0275\u0275text(26, " are used to power some lightning pose features that help resolve occlusions. ");
    \u0275\u0275elementEnd()();
    \u0275\u0275element(27, "div", 22);
    \u0275\u0275elementStart(28, "div")(29, "h3", 23);
    \u0275\u0275text(30, "Label file");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(31, "fieldset")(32, "legend");
    \u0275\u0275text(33, "1. Select the destination for frame extraction");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(34, "div", 24)(35, "input", 25);
    \u0275\u0275twoWayListener("ngModelChange", function ExtractFramesDialogComponent_Conditional_14_Template_input_ngModelChange_35_listener($event) {
      \u0275\u0275restoreView(_r1);
      const ctx_r1 = \u0275\u0275nextContext();
      \u0275\u0275twoWayBindingSet(ctx_r1.labelFileSelectionType, $event) || (ctx_r1.labelFileSelectionType = $event);
      return \u0275\u0275resetView($event);
    });
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(36, "label", 26);
    \u0275\u0275text(37, "New label file");
    \u0275\u0275elementEnd();
    \u0275\u0275element(38, "br");
    \u0275\u0275elementStart(39, "input", 27);
    \u0275\u0275twoWayListener("ngModelChange", function ExtractFramesDialogComponent_Conditional_14_Template_input_ngModelChange_39_listener($event) {
      \u0275\u0275restoreView(_r1);
      const ctx_r1 = \u0275\u0275nextContext();
      \u0275\u0275twoWayBindingSet(ctx_r1.labelFileSelectionType, $event) || (ctx_r1.labelFileSelectionType = $event);
      return \u0275\u0275resetView($event);
    });
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(40, "label", 28);
    \u0275\u0275text(41, "Existing label file");
    \u0275\u0275elementEnd()();
    \u0275\u0275conditionalCreate(42, ExtractFramesDialogComponent_Conditional_14_Conditional_42_Template, 23, 12, "div", 29)(43, ExtractFramesDialogComponent_Conditional_14_Conditional_43_Template, 4, 2, "div", 29);
    \u0275\u0275elementEnd()()();
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext();
    \u0275\u0275advance(35);
    \u0275\u0275twoWayProperty("ngModel", ctx_r1.labelFileSelectionType);
    \u0275\u0275advance(4);
    \u0275\u0275twoWayProperty("ngModel", ctx_r1.labelFileSelectionType);
    \u0275\u0275advance(3);
    \u0275\u0275conditional(ctx_r1.labelFileSelectionType() === "createNew" ? 42 : ctx_r1.labelFileSelectionType() === "useExisting" ? 43 : -1);
  }
}
function ExtractFramesDialogComponent_Conditional_15_Template(rf, ctx) {
  if (rf & 1) {
    const _r6 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "div")(1, "sub", 39);
    \u0275\u0275text(2, "Select a session to extract frames from");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(3, "div", 40)(4, "app-sessions-panel", 41);
    \u0275\u0275listener("selectedSessionChange", function ExtractFramesDialogComponent_Conditional_15_Template_app_sessions_panel_selectedSessionChange_4_listener($event) {
      \u0275\u0275restoreView(_r6);
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.handleSelectedSessionChange($event));
    });
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(5, "div", 42);
    \u0275\u0275text(6, "OR");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(7, "div", 43)(8, "button", 44);
    \u0275\u0275text(9, " Upload a new session ");
    \u0275\u0275elementEnd()()()();
  }
  if (rf & 2) {
    let tmp_2_0;
    const ctx_r1 = \u0275\u0275nextContext();
    \u0275\u0275advance(4);
    \u0275\u0275property("showModelAvailableMarkers", false)("selectedSessionKey", (tmp_2_0 = ctx_r1.session()) == null ? null : tmp_2_0.key);
  }
}
function ExtractFramesDialogComponent_Conditional_16_Template(rf, ctx) {
  if (rf & 1) {
    const _r7 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "div")(1, "sub", 31);
    \u0275\u0275text(2, "Choose which frames to extract.");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(3, "div", 45)(4, "div", 46);
    \u0275\u0275element(5, "input", 47);
    \u0275\u0275elementStart(6, "label", 48);
    \u0275\u0275text(7, "Auto");
    \u0275\u0275elementEnd()()();
    \u0275\u0275elementStart(8, "div", 49);
    \u0275\u0275namespaceSVG();
    \u0275\u0275elementStart(9, "svg", 50);
    \u0275\u0275element(10, "path", 51);
    \u0275\u0275elementEnd();
    \u0275\u0275namespaceHTML();
    \u0275\u0275elementStart(11, "span");
    \u0275\u0275text(12, " Frames will be selected automatically across a diversity of frames, using motion energy and PCA.");
    \u0275\u0275elementEnd()()();
    \u0275\u0275elementStart(13, "div", 29)(14, "p", 31);
    \u0275\u0275text(15, " Choose how many frames to extract. 20 is a good start, but extract as many or as little as you'd like. ");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(16, "div", 45)(17, "input", 52);
    \u0275\u0275twoWayListener("ngModelChange", function ExtractFramesDialogComponent_Conditional_16_Template_input_ngModelChange_17_listener($event) {
      \u0275\u0275restoreView(_r7);
      const ctx_r1 = \u0275\u0275nextContext();
      \u0275\u0275twoWayBindingSet(ctx_r1.nFrames, $event) || (ctx_r1.nFrames = $event);
      return \u0275\u0275resetView($event);
    });
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(18, "p", 53);
    \u0275\u0275text(19, "Must be between be 1 to 10");
    \u0275\u0275elementEnd()()();
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext();
    \u0275\u0275advance(5);
    \u0275\u0275property("disabled", ctx_r1.isProcessing());
    \u0275\u0275advance(12);
    \u0275\u0275property("disabled", ctx_r1.isProcessing());
    \u0275\u0275twoWayProperty("ngModel", ctx_r1.nFrames);
  }
}
function ExtractFramesDialogComponent_Conditional_18_Template(rf, ctx) {
  if (rf & 1) {
    const _r8 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "button", 54);
    \u0275\u0275listener("click", function ExtractFramesDialogComponent_Conditional_18_Template_button_click_0_listener() {
      \u0275\u0275restoreView(_r8);
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.handleCloseClick());
    });
    \u0275\u0275text(1, " Cancel ");
    \u0275\u0275elementEnd();
  }
}
function ExtractFramesDialogComponent_Conditional_19_Template(rf, ctx) {
  if (rf & 1) {
    const _r9 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "button", 55);
    \u0275\u0275listener("click", function ExtractFramesDialogComponent_Conditional_19_Template_button_click_0_listener() {
      \u0275\u0275restoreView(_r9);
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.step.set(ctx_r1.stepOrder[ctx_r1.stepOrder.indexOf(ctx_r1.step()) - 1]));
    });
    \u0275\u0275elementStart(1, "span", 56);
    \u0275\u0275text(2, "arrow_back");
    \u0275\u0275elementEnd();
    \u0275\u0275text(3, "Go back ");
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext();
    \u0275\u0275property("disabled", ctx_r1.isProcessing());
  }
}
function ExtractFramesDialogComponent_Conditional_21_Template(rf, ctx) {
  if (rf & 1) {
    const _r10 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "button", 57);
    \u0275\u0275listener("click", function ExtractFramesDialogComponent_Conditional_21_Template_button_click_0_listener() {
      \u0275\u0275restoreView(_r10);
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.step.set(ctx_r1.stepOrder[ctx_r1.stepOrder.indexOf(ctx_r1.step()) + 1]));
    });
    \u0275\u0275text(1, " Continue ");
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext();
    \u0275\u0275property("disabled", !ctx_r1.isNextEnabled() || ctx_r1.isProcessing());
  }
}
function ExtractFramesDialogComponent_Conditional_22_Conditional_0_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275element(0, "span", 58);
  }
}
function ExtractFramesDialogComponent_Conditional_22_Template(rf, ctx) {
  if (rf & 1) {
    const _r11 = \u0275\u0275getCurrentView();
    \u0275\u0275conditionalCreate(0, ExtractFramesDialogComponent_Conditional_22_Conditional_0_Template, 1, 0, "span", 58);
    \u0275\u0275elementStart(1, "button", 59);
    \u0275\u0275listener("click", function ExtractFramesDialogComponent_Conditional_22_Template_button_click_1_listener() {
      \u0275\u0275restoreView(_r11);
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.handleExtractFramesClick());
    });
    \u0275\u0275text(2, " Extract frames ");
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext();
    \u0275\u0275conditional(ctx_r1.isProcessing() ? 0 : -1);
    \u0275\u0275advance();
    \u0275\u0275property("disabled", !ctx_r1.settingsStepIsValid() || ctx_r1.isProcessing());
  }
}
var LabelFileTemplateValidatorDirective = class _LabelFileTemplateValidatorDirective {
  projectInfoService = inject2(ProjectInfoService);
  validate(control) {
    let value = control.value;
    if (!value) {
      return null;
    }
    const errors = {};
    if (this.projectInfoService.allViews().length > 0) {
      const starCount = (value.match(/\*/g) || []).length;
      if (starCount === 0) {
        errors["viewStarMissing"] = true;
      }
      if (starCount > 1) {
        errors["invalidFilename"] = true;
        return errors;
      }
      const parts = value.split("*");
      if (!/[-_]$/.test(parts[0])) {
        errors["starNotNextToDelimiter"] = true;
      }
      if (parts[1] && !/^[-_]/.test(parts[1])) {
        errors["starNotNextToDelimiter"] = true;
      }
      value = value.replace("*", this.projectInfoService.allViews()[0]);
    }
    const allowedChars = /^[a-zA-Z0-9][a-zA-Z0-9-._]+$/;
    if (!allowedChars.test(value)) {
      errors["invalidFilename"] = true;
    }
    if (value.toLowerCase().endsWith(".csv")) {
      errors["hasCSV"] = true;
    }
    return Object.keys(errors).length === 0 ? null : errors;
  }
  static \u0275fac = function LabelFileTemplateValidatorDirective_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _LabelFileTemplateValidatorDirective)();
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({ type: _LabelFileTemplateValidatorDirective, selectors: [["", "appLabelFileTemplateValidator", ""]], features: [\u0275\u0275ProvidersFeature([
    {
      provide: NG_VALIDATORS,
      useExisting: _LabelFileTemplateValidatorDirective,
      multi: true
    }
  ])] });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(LabelFileTemplateValidatorDirective, [{
    type: Directive,
    args: [{
      selector: "[appLabelFileTemplateValidator]",
      providers: [
        {
          provide: NG_VALIDATORS,
          useExisting: LabelFileTemplateValidatorDirective,
          multi: true
        }
      ]
    }]
  }], null, null);
})();
var ExtractFramesDialogComponent = class _ExtractFramesDialogComponent {
  step = signal("labelFile", ...ngDevMode ? [{ debugName: "step" }] : []);
  stepOrder = ["labelFile", "session", "settings"];
  initialStep = input("labelFile", ...ngDevMode ? [{ debugName: "initialStep" }] : []);
  initialLabelFileSelectionType = input("createNew", ...ngDevMode ? [{ debugName: "initialLabelFileSelectionType" }] : []);
  initialSelectedLabelFileKey = input(null, ...ngDevMode ? [{ debugName: "initialSelectedLabelFileKey" }] : []);
  exit = output();
  // Outputs the target label file key.
  done = output();
  sessionService = inject2(SessionService);
  ngOnInit() {
    this.step.set(this.initialStep());
    this.labelFileSelectionType.set(this.initialLabelFileSelectionType());
    this.existingLabelFileKey.set(this.initialSelectedLabelFileKey());
    this.newLabelFileTemplate.set(this.defaultLabelFileTemplate());
  }
  // Form data
  labelFileSelectionType = signal("createNew", ...ngDevMode ? [{ debugName: "labelFileSelectionType" }] : []);
  // Only applicable when labelFileSelectionType == useExisting
  existingLabelFileKey = signal(null, ...ngDevMode ? [{ debugName: "existingLabelFileKey" }] : []);
  // Only applicable when labelFileSelectionType == createNew
  newLabelFileTemplate = signal("CollectedData", ...ngDevMode ? [{ debugName: "newLabelFileTemplate" }] : []);
  labelFileTemplateNgModel = viewChild("labelFileTemplateNgModel", ...ngDevMode ? [{ debugName: "labelFileTemplateNgModel" }] : []);
  session = signal(null, ...ngDevMode ? [{ debugName: "session" }] : []);
  nFrames = signal(null, ...ngDevMode ? [{ debugName: "nFrames" }] : []);
  isProcessing = signal(false, ...ngDevMode ? [{ debugName: "isProcessing" }] : []);
  rpc = inject2(RpcService);
  projectInfoService = inject2(ProjectInfoService);
  handleCloseClick() {
    this.exit.emit();
  }
  handleSelectedSessionChange(session) {
    this.session.set(session);
  }
  labelFileStepIsValid() {
    if (this.labelFileSelectionType() === "createNew") {
      return this.newLabelFileTemplate() !== null && this.newLabelFileTemplate() !== "" && (this.labelFileTemplateNgModel().valid ?? false);
    }
    if (this.labelFileSelectionType() === "useExisting" && this.existingLabelFileKey() === null) {
      return false;
    }
    return true;
  }
  sessionStepIsValid = computed(() => {
    return this.session() !== null;
  }, ...ngDevMode ? [{ debugName: "sessionStepIsValid" }] : []);
  settingsStepIsValid = computed(() => {
    if (this.nFrames() === null || this.nFrames() < 1) {
      return false;
    }
    return true;
  }, ...ngDevMode ? [{ debugName: "settingsStepIsValid" }] : []);
  /** Makes a request object that the extract frames service can execute. */
  toExtractFramesRequest() {
    const labelFile = this.sessionService.allLabelFiles().find((mvf2) => mvf2.key === this.existingLabelFileKey());
    const labelFileCreationRequest = this.labelFileSelectionType() === "createNew" ? {
      labelFileTemplate: this.newLabelFileTemplate()
    } : null;
    return {
      labelFileCreationRequest,
      session: {
        views: this.session().views
      },
      labelFile: labelFile ? {
        views: labelFile.views
      } : null,
      method: "random",
      options: {
        nFrames: this.nFrames()
      }
    };
  }
  handleExtractFramesClick() {
    this.isProcessing.set(true);
    const targetKey = this.labelFileSelectionType() === "createNew" ? this.newLabelFileTemplate() + ".csv" : this.existingLabelFileKey();
    this.rpc.call("extractFrames", this.toExtractFramesRequest()).then(() => {
      this.done.emit(targetKey);
    }).finally(() => {
      this.isProcessing.set(false);
    });
  }
  isNextEnabled() {
    if (this.step() === "labelFile") {
      return this.labelFileStepIsValid();
    }
    if (this.step() === "session") {
      return this.sessionStepIsValid();
    }
    return false;
  }
  defaultLabelFileTemplate() {
    return this.isMultiviewProject() ? "CollectedData_*" : "CollectedData.csv";
  }
  isMultiviewProject() {
    return this.projectInfoService.projectInfo.views.length > 1;
  }
  static \u0275fac = function ExtractFramesDialogComponent_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _ExtractFramesDialogComponent)();
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _ExtractFramesDialogComponent, selectors: [["app-extract-frames-dialog"]], viewQuery: function ExtractFramesDialogComponent_Query(rf, ctx) {
    if (rf & 1) {
      \u0275\u0275viewQuerySignal(ctx.labelFileTemplateNgModel, _c08, 5);
    }
    if (rf & 2) {
      \u0275\u0275queryAdvance();
    }
  }, inputs: { initialStep: [1, "initialStep"], initialLabelFileSelectionType: [1, "initialLabelFileSelectionType"], initialSelectedLabelFileKey: [1, "initialSelectedLabelFileKey"] }, outputs: { exit: "exit", done: "done" }, decls: 23, vars: 7, consts: [["labelFileTemplateNgModel", "ngModel"], ["open", "", 1, "modal"], [1, "modal-box", "w-5/6", "max-w-3xl"], [1, "btn", "btn-md", "btn-circle", "btn-ghost", "absolute", "right-4", "top-4", 3, "click"], [1, "flex", "mb-6"], [1, "text-xl", "font-bold", "text-nowrap"], [1, "steps", "text-sm"], [1, "step", "step-primary"], [1, "step"], [1, "prose", "max-w-none!"], [1, "flex", "justify-between", "mt-6", "gap-2"], [1, "btn", "btn-outline", "btn-secondary"], [1, "btn", "btn-outline", 3, "disabled"], [1, "flex", "gap-2"], [1, "btn", "btn-primary", 3, "disabled"], [1, "mb-4", "text-sm"], [1, "collapse", "collapse-plus", "text-sm", "bg-base-200", "border-base-300", "border", "mb-4"], ["type", "checkbox"], [1, "collapse-title", "font-semibold"], [1, "collapse-content", "text-sm"], [1, "code"], [1, "code", "block", "p-2", "m-2", "bg-base-300"], [1, "divider"], [1, "text-md"], [1, "m-4"], ["type", "radio", "name", "labelFile", "id", "radio_createNew", "value", "createNew", 1, "radio", "mr-2", 3, "ngModelChange", "ngModel"], ["for", "radio_createNew"], ["type", "radio", "name", "labelFile", "id", "radio_useExisting", "value", "useExisting", 1, "radio", "mr-2", 3, "ngModelChange", "ngModel"], ["for", "radio_useExisting"], [1, "mt-4"], ["for", "input_labelFileTemplate", 1, "mb-2"], [1, "text-sm"], [1, "input"], ["type", "text", "spellcheck", "false", "id", "input_labelFileTemplate", "required", "", "appLabelFileTemplateValidator", "", 3, "ngModelChange", "ngModel"], [1, "label"], [1, "validator-hint", "visible!"], [1, "validator-hint", "visible!", "text-error", "min-h-[10rem]"], [1, "p-1"], [1, "block", "m-4", 3, "labelFileKeyChange", "labelFileKey", "selectSizeClass"], [1, "text-sm", "block"], [1, "p-4", "flex", "items-center"], [1, "flex-1", "min-w-0", "max-h-70", "overflow-clip", 3, "selectedSessionChange", "showModelAvailableMarkers", "selectedSessionKey"], [1, "divider", "divider-horizontal"], [1, "flex-1", "min-w-0", "flex", "justify-center"], ["data-tip", "Not yet implemented", 1, "btn", "tooltip"], [1, "p-4"], [1, "flex", "gap-1"], ["type", "radio", "name", "extraction-strategy", "id", "radio-auto", "value", "auto", "checked", "checked", 1, "radio", "radio-sm", 3, "disabled"], ["for", "radio-auto", 1, "text-sm"], ["role", "alert", 1, "alert", "text-sm"], ["xmlns", "http://www.w3.org/2000/svg", "fill", "none", "viewBox", "0 0 24 24", 1, "stroke-info", "h-6", "w-6", "shrink-0"], ["stroke-linecap", "round", "stroke-linejoin", "round", "stroke-width", "2", "d", "M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"], ["type", "number", "required", "", "placeholder", "Enter a number", "min", "1", "step", "1", 1, "input", "validator", 3, "ngModelChange", "disabled", "ngModel"], [1, "validator-hint"], [1, "btn", "btn-outline", "btn-secondary", 3, "click"], [1, "btn", "btn-outline", 3, "click", "disabled"], [1, "material-icons"], [1, "btn", "btn-primary", 3, "click", "disabled"], [1, "loading", "loading-spinner", "loading-sm"], [1, "btn", "btn-soft", "btn-primary", 3, "click", "disabled"]], template: function ExtractFramesDialogComponent_Template(rf, ctx) {
    if (rf & 1) {
      \u0275\u0275elementStart(0, "dialog", 1)(1, "div", 2)(2, "button", 3);
      \u0275\u0275listener("click", function ExtractFramesDialogComponent_Template_button_click_2_listener() {
        return ctx.handleCloseClick();
      });
      \u0275\u0275text(3, " \u2715 ");
      \u0275\u0275elementEnd();
      \u0275\u0275elementStart(4, "div", 4)(5, "h3", 5);
      \u0275\u0275text(6, "Extract frames");
      \u0275\u0275elementEnd();
      \u0275\u0275elementStart(7, "ul", 6)(8, "li", 7);
      \u0275\u0275text(9, "Select a label file");
      \u0275\u0275elementEnd();
      \u0275\u0275elementStart(10, "li", 8);
      \u0275\u0275text(11, " Select a session ");
      \u0275\u0275elementEnd();
      \u0275\u0275elementStart(12, "li", 8);
      \u0275\u0275text(13, " Select extraction strategy ");
      \u0275\u0275elementEnd()()();
      \u0275\u0275conditionalCreate(14, ExtractFramesDialogComponent_Conditional_14_Template, 44, 3, "div", 9)(15, ExtractFramesDialogComponent_Conditional_15_Template, 10, 2, "div")(16, ExtractFramesDialogComponent_Conditional_16_Template, 20, 3);
      \u0275\u0275elementStart(17, "div", 10);
      \u0275\u0275conditionalCreate(18, ExtractFramesDialogComponent_Conditional_18_Template, 2, 0, "button", 11)(19, ExtractFramesDialogComponent_Conditional_19_Template, 4, 1, "button", 12);
      \u0275\u0275elementStart(20, "div", 13);
      \u0275\u0275conditionalCreate(21, ExtractFramesDialogComponent_Conditional_21_Template, 2, 1, "button", 14)(22, ExtractFramesDialogComponent_Conditional_22_Template, 3, 2);
      \u0275\u0275elementEnd()()()();
    }
    if (rf & 2) {
      \u0275\u0275advance(10);
      \u0275\u0275classProp("step-primary", ctx.step() !== "labelFile");
      \u0275\u0275advance(2);
      \u0275\u0275classProp("step-primary", ctx.step() === "settings");
      \u0275\u0275advance(2);
      \u0275\u0275conditional(ctx.step() === "labelFile" ? 14 : ctx.step() === "session" ? 15 : 16);
      \u0275\u0275advance(4);
      \u0275\u0275conditional(ctx.step() === "labelFile" ? 18 : 19);
      \u0275\u0275advance(3);
      \u0275\u0275conditional(ctx.step() !== "settings" ? 21 : 22);
    }
  }, dependencies: [
    ViewerSessionsPanelComponent,
    FormsModule,
    DefaultValueAccessor,
    NumberValueAccessor,
    RadioControlValueAccessor,
    NgControlStatus,
    RequiredValidator,
    MinValidator,
    NgModel,
    LabelFilePickerComponent,
    LabelFileTemplateValidatorDirective
  ], styles: ["\n\ninput[_ngcontent-%COMP%]::placeholder {\n  color: color-mix(in oklab, var(--color-base-content) 50%, #0000) !important;\n}\n/*# sourceMappingURL=/static/extract-frames-dialog.component-DKKIPRKS.css.map */"], changeDetection: 0 });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ExtractFramesDialogComponent, [{
    type: Component,
    args: [{ selector: "app-extract-frames-dialog", imports: [
      ViewerSessionsPanelComponent,
      FormsModule,
      LabelFilePickerComponent,
      LabelFileTemplateValidatorDirective
    ], changeDetection: ChangeDetectionStrategy.OnPush, template: `<dialog class="modal" open>
  <div class="modal-box w-5/6 max-w-3xl">
    <button
      class="btn btn-md btn-circle btn-ghost absolute right-4 top-4"
      (click)="handleCloseClick()"
    >
      \u2715
    </button>
    <!-- Header -->
    <div class="flex mb-6">
      <h3 class="text-xl font-bold text-nowrap">Extract frames</h3>
      <ul class="steps text-sm">
        <li class="step step-primary">Select a label file</li>
        <li class="step" [class.step-primary]="step() !== 'labelFile'">
          Select a session
        </li>
        <li class="step" [class.step-primary]="step() === 'settings'">
          Select extraction strategy
        </li>
      </ul>
    </div>

    <!-- Body -->
    @if (step() === "labelFile") {
      <div class="prose max-w-none!">
        <p class="mb-4 text-sm">
          This workflow identifies new frames to label and adds them to the
          labeling queue. It is often used when starting a project or to add
          frames from new sessions.
        </p>
        <div
          class="collapse collapse-plus text-sm bg-base-200 border-base-300 border mb-4"
        >
          <input type="checkbox" />
          <div class="collapse-title font-semibold">
            Where are extracted frames stored?
          </div>
          <div class="collapse-content text-sm">
            Extracted frames are stored as <code class="code">PNG</code> files
            in the <code class="code">labeled-data</code> subdirectory of the
            project data directory as follows
            <code class="code block p-2 m-2 bg-base-300"
              >&lt;data_dir&gt;&nbsp;/&nbsp;labeled-data&nbsp;/&nbsp;&lt;session_name&gt;&nbsp;/&nbsp;img&lt;frame_index&gt;.png</code
            >
            Additionally, for each frame <code class="code">i</code>, adjacent
            frames <code class="code">i-2 ... i+2</code> are extracted but not
            added to the labeling queue. These <b>context frames</b> are used to
            power some lightning pose features that help resolve occlusions.
          </div>
        </div>
        <div class="divider"></div>
        <div>
          <h3 class="text-md">Label file</h3>
          <fieldset>
            <legend>1. Select the destination for frame extraction</legend>
            <div class="m-4">
              <input
                class="radio mr-2"
                type="radio"
                name="labelFile"
                id="radio_createNew"
                value="createNew"
                [(ngModel)]="labelFileSelectionType"
              />
              <label for="radio_createNew">New label file</label><br />
              <input
                class="radio mr-2"
                type="radio"
                name="labelFile"
                id="radio_useExisting"
                value="useExisting"
                [(ngModel)]="labelFileSelectionType"
              />
              <label for="radio_useExisting">Existing label file</label>
            </div>
            @if (labelFileSelectionType() === "createNew") {
              <div class="mt-4">
                <label for="input_labelFileTemplate" class="mb-2"
                  >2. Enter the filename for the new label file</label
                >
                <div class="m-4">
                  <p class="text-sm">
                    @if (!isMultiviewProject()) {
                      Single camera project detected. If instead you have
                      multiple camera views for each session, set the Views
                      field in the project settings and return to this workflow.
                    } @else {
                      Multiview project detected. One file will be created per
                      camera view. Use the
                      <code class="p-1">*</code> character to represent the view
                      name. For example,
                      <code class="p-1">CollectedData_*.csv</code>.
                    }
                  </p>
                  <label
                    class="input"
                    [class.input-success]="
                      labelFileTemplateNgModel.valid &&
                      labelFileTemplateNgModel.touched
                    "
                    [class.input-error]="
                      labelFileTemplateNgModel.invalid &&
                      labelFileTemplateNgModel.touched
                    "
                  >
                    <input
                      type="text"
                      spellcheck="false"
                      id="input_labelFileTemplate"
                      [(ngModel)]="newLabelFileTemplate"
                      required
                      appLabelFileTemplateValidator
                      #labelFileTemplateNgModel="ngModel"
                    />
                    <span class="label">.csv</span>
                  </label>
                  <div class="validator-hint visible!">
                    <code>{{ defaultLabelFileTemplate() }}</code>
                    is the recommended default.
                  </div>
                  <div class="validator-hint visible! text-error min-h-[10rem]">
                    <ul>
                      @if (labelFileTemplateNgModel.errors?.["required"]) {
                        <li>Filename required</li>
                      }
                      @if (
                        labelFileTemplateNgModel.errors?.["invalidFilename"]
                      ) {
                        <li>Filename invalid</li>
                      }
                      @if (
                        labelFileTemplateNgModel.errors?.["viewStarMissing"]
                      ) {
                        <li>Filename missing required star character</li>
                      }
                      @if (
                        labelFileTemplateNgModel.errors?.[
                          "starNotNextToDelimiter"
                        ]
                      ) {
                        <li>
                          Star character must be next to valid delimiters: - or
                          _
                        </li>
                      }
                      @if (labelFileTemplateNgModel.errors?.["hasCSV"]) {
                        <li>
                          Invalid name: remove <code>.csv</code> extension
                        </li>
                      }
                    </ul>
                  </div>
                </div>
              </div>
            } @else if (labelFileSelectionType() === "useExisting") {
              <div class="mt-4">
                <label for="input_labelFileTemplate" class="mb-2"
                  >2. Select the destination label file</label
                >
                <app-label-file-picker
                  class="block m-4"
                  [(labelFileKey)]="existingLabelFileKey"
                  [selectSizeClass]="'select-md'"
                ></app-label-file-picker>
              </div>
            }
          </fieldset>
        </div>
      </div>
    } @else if (step() === "session") {
      <div>
        <sub class="text-sm block">Select a session to extract frames from</sub>

        <div class="p-4 flex items-center">
          <app-sessions-panel
            class="flex-1 min-w-0 max-h-70 overflow-clip"
            [showModelAvailableMarkers]="false"
            [selectedSessionKey]="session()?.key"
            (selectedSessionChange)="handleSelectedSessionChange($event)"
          ></app-sessions-panel>
          <div class="divider divider-horizontal">OR</div>
          <div class="flex-1 min-w-0 flex justify-center">
            <button class="btn tooltip" data-tip="Not yet implemented">
              Upload a new session
            </button>
          </div>
        </div>
      </div>
    } @else {
      <div>
        <sub class="text-sm">Choose which frames to extract.</sub>
        <div class="p-4">
          <div class="flex gap-1">
            <input
              [disabled]="isProcessing()"
              type="radio"
              name="extraction-strategy"
              id="radio-auto"
              value="auto"
              class="radio radio-sm"
              checked="checked"
            />
            <label for="radio-auto" class="text-sm">Auto</label>
          </div>
        </div>
        <div role="alert" class="alert text-sm">
          <svg
            xmlns="http://www.w3.org/2000/svg"
            fill="none"
            viewBox="0 0 24 24"
            class="stroke-info h-6 w-6 shrink-0"
          >
            <path
              stroke-linecap="round"
              stroke-linejoin="round"
              stroke-width="2"
              d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
            ></path>
          </svg>
          <span>
            Frames will be selected automatically across a diversity of frames,
            using motion energy and PCA.</span
          >
        </div>
      </div>

      <div class="mt-4">
        <p class="text-sm">
          Choose how many frames to extract. 20 is a good start, but extract as
          many or as little as you'd like.
        </p>
        <div class="p-4">
          <input
            [disabled]="isProcessing()"
            type="number"
            [(ngModel)]="nFrames"
            class="input validator"
            required
            placeholder="Enter a number"
            min="1"
            step="1"
          />
          <p class="validator-hint">Must be between be 1 to 10</p>
        </div>
      </div>
    }
    <!-- Footer -->
    <div class="flex justify-between mt-6 gap-2">
      @if (step() === "labelFile") {
        <button
          class="btn btn-outline btn-secondary"
          (click)="handleCloseClick()"
        >
          Cancel
        </button>
      } @else {
        <button
          class="btn btn-outline"
          [disabled]="isProcessing()"
          (click)="step.set(stepOrder[stepOrder.indexOf(step()) - 1])"
        >
          <span class="material-icons">arrow_back</span>Go back
        </button>
      }
      <div class="flex gap-2">
        @if (step() !== "settings") {
          <button
            class="btn btn-primary"
            [disabled]="!isNextEnabled() || isProcessing()"
            (click)="step.set(stepOrder[stepOrder.indexOf(step()) + 1])"
          >
            Continue
          </button>
        } @else {
          @if (isProcessing()) {
            <span class="loading loading-spinner loading-sm"></span>
          }
          <button
            [disabled]="!settingsStepIsValid() || isProcessing()"
            class="btn btn-soft btn-primary"
            (click)="handleExtractFramesClick()"
          >
            Extract frames
          </button>
        }
      </div>
    </div>
  </div>
</dialog>
`, styles: ["/* src/app/labeler/extract-frames-dialog/extract-frames-dialog.component.css */\ninput::placeholder {\n  color: color-mix(in oklab, var(--color-base-content) 50%, #0000) !important;\n}\n/*# sourceMappingURL=/static/extract-frames-dialog.component-DKKIPRKS.css.map */\n"] }]
  }], null, null);
})();
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(ExtractFramesDialogComponent, { className: "ExtractFramesDialogComponent", filePath: "src/app/labeler/extract-frames-dialog/extract-frames-dialog.component.ts", lineNumber: 104 });
})();

// src/app/labeler/labeler-page.component.ts
var _c09 = () => ["/labeler"];
var _c16 = (a0, a12) => ({ labelFileKey: a0, frameKey: a12 });
var _forTrack06 = ($index, $item) => $item.key;
function LabelerPageComponent_Conditional_0_Conditional_8_Template(rf, ctx) {
  if (rf & 1) {
    const _r3 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "button", 19);
    \u0275\u0275listener("click", function LabelerPageComponent_Conditional_0_Conditional_8_Template_button_click_0_listener() {
      \u0275\u0275restoreView(_r3);
      const ctx_r1 = \u0275\u0275nextContext(2);
      return \u0275\u0275resetView(ctx_r1.extractFramesDialogOpen.set(true));
    });
    \u0275\u0275text(1, " + ");
    \u0275\u0275elementEnd();
  }
}
function LabelerPageComponent_Conditional_0_Conditional_9_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "div", 2);
    \u0275\u0275text(1, "Loading CSV file...");
    \u0275\u0275elementEnd();
  }
}
function LabelerPageComponent_Conditional_0_Conditional_18_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "li", 12);
    \u0275\u0275text(1, "No labeled frames");
    \u0275\u0275elementEnd();
  }
}
function LabelerPageComponent_Conditional_0_Conditional_19_For_1_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "li", 20)(1, "a", 21)(2, "span");
    \u0275\u0275text(3);
    \u0275\u0275pipe(4, "path");
    \u0275\u0275elementEnd()()();
  }
  if (rf & 2) {
    let tmp_13_0;
    const frame_r4 = ctx.$implicit;
    const ctx_r1 = \u0275\u0275nextContext(3);
    \u0275\u0275advance();
    \u0275\u0275property("routerLink", \u0275\u0275pureFunction0(5, _c09))("queryParams", \u0275\u0275pureFunction2(6, _c16, (tmp_13_0 = ctx_r1.selectedLabelFile()) == null ? null : tmp_13_0.key, frame_r4.key));
    \u0275\u0275advance(2);
    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(4, 3, frame_r4.key));
  }
}
function LabelerPageComponent_Conditional_0_Conditional_19_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275repeaterCreate(0, LabelerPageComponent_Conditional_0_Conditional_19_For_1_Template, 5, 9, "li", 20, _forTrack06);
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext(2);
    \u0275\u0275repeater(ctx_r1.labelFileDataLabeledSlice());
  }
}
function LabelerPageComponent_Conditional_0_Conditional_31_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "li", 12);
    \u0275\u0275text(1, "No labeled frames");
    \u0275\u0275elementEnd();
  }
}
function LabelerPageComponent_Conditional_0_Conditional_32_For_1_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "li", 20)(1, "a", 21)(2, "span");
    \u0275\u0275text(3);
    \u0275\u0275pipe(4, "path");
    \u0275\u0275elementEnd()()();
  }
  if (rf & 2) {
    let tmp_13_0;
    const frame_r5 = ctx.$implicit;
    const ctx_r1 = \u0275\u0275nextContext(3);
    \u0275\u0275advance();
    \u0275\u0275property("routerLink", \u0275\u0275pureFunction0(5, _c09))("queryParams", \u0275\u0275pureFunction2(6, _c16, (tmp_13_0 = ctx_r1.selectedLabelFile()) == null ? null : tmp_13_0.key, frame_r5.key));
    \u0275\u0275advance(2);
    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(4, 3, frame_r5.key));
  }
}
function LabelerPageComponent_Conditional_0_Conditional_32_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275repeaterCreate(0, LabelerPageComponent_Conditional_0_Conditional_32_For_1_Template, 5, 9, "li", 20, _forTrack06);
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext(2);
    \u0275\u0275repeater(ctx_r1.labelFileDataUnLabeledSlice());
  }
}
function LabelerPageComponent_Conditional_0_Conditional_33_Template(rf, ctx) {
  if (rf & 1) {
    const _r6 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "button", 22);
    \u0275\u0275listener("click", function LabelerPageComponent_Conditional_0_Conditional_33_Template_button_click_0_listener() {
      \u0275\u0275restoreView(_r6);
      const ctx_r1 = \u0275\u0275nextContext(2);
      return \u0275\u0275resetView(ctx_r1.extractFramesDialogOpen.set(true));
    });
    \u0275\u0275text(1, " Add more frames from a session ");
    \u0275\u0275elementEnd();
  }
}
function LabelerPageComponent_Conditional_0_Conditional_35_Template(rf, ctx) {
  if (rf & 1) {
    const _r7 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "app-extract-frames-dialog", 23);
    \u0275\u0275listener("exit", function LabelerPageComponent_Conditional_0_Conditional_35_Template_app_extract_frames_dialog_exit_0_listener() {
      \u0275\u0275restoreView(_r7);
      const ctx_r1 = \u0275\u0275nextContext(2);
      return \u0275\u0275resetView(ctx_r1.extractFramesDialogOpen.set(false));
    })("done", function LabelerPageComponent_Conditional_0_Conditional_35_Template_app_extract_frames_dialog_done_0_listener($event) {
      \u0275\u0275restoreView(_r7);
      const ctx_r1 = \u0275\u0275nextContext(2);
      return \u0275\u0275resetView(ctx_r1.handleExtractFramesDone($event));
    });
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext(2);
    \u0275\u0275property("initialStep", ctx_r1.labelFileKey() == null ? "labelFile" : "session")("initialLabelFileSelectionType", ctx_r1.labelFileKey() == null ? "createNew" : "useExisting")("initialSelectedLabelFileKey", ctx_r1.labelFileKey() ?? null);
  }
}
function LabelerPageComponent_Conditional_0_Template(rf, ctx) {
  if (rf & 1) {
    const _r1 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "div", 0)(1, "div", 1)(2, "div")(3, "div", 2)(4, "h1", 3);
    \u0275\u0275text(5, "Label file");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(6, "div", 4)(7, "app-label-file-picker", 5);
    \u0275\u0275listener("labelFileKeyChange", function LabelerPageComponent_Conditional_0_Template_app_label_file_picker_labelFileKeyChange_7_listener($event) {
      \u0275\u0275restoreView(_r1);
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.handleSelectLabelFile($event));
    });
    \u0275\u0275elementEnd();
    \u0275\u0275conditionalCreate(8, LabelerPageComponent_Conditional_0_Conditional_8_Template, 2, 0, "button", 6);
    \u0275\u0275elementEnd()();
    \u0275\u0275conditionalCreate(9, LabelerPageComponent_Conditional_0_Conditional_9_Template, 2, 0, "div", 2);
    \u0275\u0275elementStart(10, "div", 2)(11, "div", 7)(12, "h1", 8);
    \u0275\u0275text(13, "Labeled frames");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(14, "div", 9);
    \u0275\u0275text(15);
    \u0275\u0275elementEnd()();
    \u0275\u0275elementStart(16, "div", 10)(17, "ul", 11);
    \u0275\u0275conditionalCreate(18, LabelerPageComponent_Conditional_0_Conditional_18_Template, 2, 0, "li", 12)(19, LabelerPageComponent_Conditional_0_Conditional_19_Template, 2, 0);
    \u0275\u0275elementEnd()()();
    \u0275\u0275elementStart(20, "div", 2)(21, "div", 13)(22, "div", 7)(23, "h1", 8);
    \u0275\u0275text(24, "Remaining frames to label");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(25, "div", 9);
    \u0275\u0275text(26);
    \u0275\u0275elementEnd()();
    \u0275\u0275elementStart(27, "div", 14);
    \u0275\u0275text(28, "Please label one at a time");
    \u0275\u0275elementEnd()();
    \u0275\u0275elementStart(29, "div")(30, "ul", 11);
    \u0275\u0275conditionalCreate(31, LabelerPageComponent_Conditional_0_Conditional_31_Template, 2, 0, "li", 12)(32, LabelerPageComponent_Conditional_0_Conditional_32_Template, 2, 0);
    \u0275\u0275elementEnd()();
    \u0275\u0275conditionalCreate(33, LabelerPageComponent_Conditional_0_Conditional_33_Template, 2, 0, "button", 15);
    \u0275\u0275elementEnd()();
    \u0275\u0275element(34, "app-loading-bar", 16);
    \u0275\u0275elementEnd();
    \u0275\u0275conditionalCreate(35, LabelerPageComponent_Conditional_0_Conditional_35_Template, 1, 3, "app-extract-frames-dialog", 17);
    \u0275\u0275elementStart(36, "app-labeler-center-panel", 18);
    \u0275\u0275listener("saved", function LabelerPageComponent_Conditional_0_Template_app_labeler_center_panel_saved_36_listener($event) {
      \u0275\u0275restoreView(_r1);
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.handleSaved($event));
    })("newLabelFile", function LabelerPageComponent_Conditional_0_Template_app_labeler_center_panel_newLabelFile_36_listener() {
      \u0275\u0275restoreView(_r1);
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.extractFramesDialogOpen.set(true));
    });
    \u0275\u0275elementEnd()();
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext();
    \u0275\u0275advance(7);
    \u0275\u0275property("labelFileKey", ctx_r1.labelFileKey() ?? null)("selectSizeClass", "select-sm join-item");
    \u0275\u0275advance();
    \u0275\u0275conditional(!ctx_r1.labelFileKey() ? 8 : -1);
    \u0275\u0275advance();
    \u0275\u0275conditional(ctx_r1.isLoading() ? 9 : -1);
    \u0275\u0275advance(6);
    \u0275\u0275textInterpolate1(" ", ctx_r1.labelFileDataLabeledSlice().length, " ");
    \u0275\u0275advance(3);
    \u0275\u0275conditional(ctx_r1.labelFileDataLabeledSlice() === null ? 18 : 19);
    \u0275\u0275advance(8);
    \u0275\u0275textInterpolate1(" ", ctx_r1.labelFileDataUnLabeledSlice().length, " ");
    \u0275\u0275advance(3);
    \u0275\u0275classMap(\u0275\u0275interpolate1("panel-content\n              inset-shadow-xs inset-shadow-black/30\n              overflow-auto\n              h-60 flex flex-col justify-between\n              transition-color duration-500 ease-in-out ", ctx_r1.xfSuccessNotifyClasses()));
    \u0275\u0275advance(2);
    \u0275\u0275conditional(ctx_r1.labelFileDataUnLabeledSlice() === null ? 31 : 32);
    \u0275\u0275advance(2);
    \u0275\u0275conditional(ctx_r1.loadedLabelFile() ? 33 : -1);
    \u0275\u0275advance(2);
    \u0275\u0275conditional(ctx_r1.extractFramesDialogOpen() ? 35 : -1);
    \u0275\u0275advance();
    \u0275\u0275property("labelFile", ctx_r1.loadedLabelFile())("frame", ctx_r1.selectedFrame())("numLabeledFrames", ctx_r1.labelFileDataLabeledSlice().length);
  }
}
var LabelerPageComponent = class _LabelerPageComponent {
  isIniting = signal(true, ...ngDevMode ? [{ debugName: "isIniting" }] : []);
  projectInfoService = inject2(ProjectInfoService);
  sessionService = inject2(SessionService);
  labelFileFetcher = inject2(LabelFileFetcherService);
  router = inject2(Router);
  toastService = inject2(ToastService);
  notificationDisplayTimeMs = 1500;
  // Config variable for notification display time
  // Store loaded data for the selected label file
  loadedLabelFile = signal(null, ...ngDevMode ? [{ debugName: "loadedLabelFile" }] : []);
  labelFileData = signal(null, ...ngDevMode ? [{ debugName: "labelFileData" }] : []);
  labelFileDataLabeledSlice = computed(() => {
    const labelFileData = this.labelFileData();
    if (!labelFileData)
      return [];
    return labelFileData.filter((x) => {
      return !mvf(x).isFromUnlabeledSet;
    });
  }, ...ngDevMode ? [{ debugName: "labelFileDataLabeledSlice" }] : []);
  labelFileDataUnLabeledSlice = computed(() => {
    const labelFileData = this.labelFileData();
    if (!labelFileData)
      return [];
    return labelFileData.filter((x) => {
      return mvf(x).isFromUnlabeledSet;
    });
  }, ...ngDevMode ? [{ debugName: "labelFileDataUnLabeledSlice" }] : []);
  // Store the loading state
  isLoading = signal(false, ...ngDevMode ? [{ debugName: "isLoading" }] : []);
  loadError = signal(null, ...ngDevMode ? [{ debugName: "loadError" }] : []);
  // Set from the router on URL change.
  labelFileKey = input(null, ...ngDevMode ? [{ debugName: "labelFileKey" }] : []);
  // Set from the router on URL change.
  frameKey = input(null, ...ngDevMode ? [{ debugName: "frameKey" }] : []);
  selectedLabelFile = computed(() => {
    if (this.isIniting())
      return null;
    const labelFile = this.labelFileKey() == null ? null : this.sessionService.allLabelFiles().find((x) => x.key === this.labelFileKey());
    if (labelFile === void 0) {
      throw new Error(`Label file not found in data_dir: ${this.labelFileKey()}`);
    }
    return labelFile;
  }, ...ngDevMode ? [{ debugName: "selectedLabelFile" }] : []);
  selectedFrame = computed(() => {
    if (this.isIniting() || this.isLoading())
      return null;
    const selectedFrame = this.frameKey() == null ? null : this.labelFileData()?.find((x) => x.key === this.frameKey());
    if (selectedFrame === void 0) {
      throw new Error(`Frame ${this.frameKey()} not found in ${this.labelFileKey()}`);
    }
    return selectedFrame;
  }, ...ngDevMode ? [{ debugName: "selectedFrame" }] : []);
  ngOnChanges(changes) {
    if (changes["labelFileKey"]) {
      this.loadLabelFileData(this.selectedLabelFile()).catch((error) => {
        throw error;
      });
    }
  }
  // Load the CSV file for the selected label file
  async loadLabelFileData(labelFile) {
    if (!labelFile || labelFile.views.length === 0) {
      this.loadedLabelFile.set(null);
      this.labelFileData.set(null);
      return;
    }
    try {
      this.isLoading.set(true);
      const mvFrames = await this.labelFileFetcher.loadLabelFileData(labelFile);
      this.loadedLabelFile.set(labelFile);
      this.labelFileData.set(mvFrames);
    } catch (error) {
      console.error("Error loading label file data:", error);
      this.loadedLabelFile.set(null);
      this.labelFileData.set(null);
      throw error;
    } finally {
      this.isLoading.set(false);
    }
  }
  handleSaved(data) {
    if (data.labelFile !== this.loadedLabelFile()) {
      return;
    }
    this.labelFileData.update((mvFrames) => {
      if (mvFrames === null) {
        return null;
      }
      return mvFrames.map((mvFrame) => {
        if (mvFrame.key === data.frame.key) {
          return mvf(mvFrame).toSavedMvf();
        } else {
          return mvFrame;
        }
      });
    });
    if (data.shouldContinue) {
      const currentFrameIndex = this.labelFileDataUnLabeledSlice().findIndex((mvf2) => mvf2.key === data.frame.key);
      const nextFrameKey = this.labelFileDataUnLabeledSlice()[currentFrameIndex + 1]?.key ?? null;
      if (nextFrameKey !== null) {
        this.router.navigate(["/labeler"], {
          queryParams: {
            labelFileKey: this.labelFileKey(),
            frameKey: nextFrameKey
          }
        });
      }
    }
  }
  handleSelectLabelFile(labelFileKey) {
    if (labelFileKey !== null) {
      this.router.navigate(["/labeler"], {
        queryParams: { labelFileKey }
      });
    } else {
      this.router.navigate(["/labeler"], { queryParams: {} });
    }
  }
  async ngOnInit() {
    await this.projectInfoService.loadProjectInfo();
    await this.sessionService.loadLabelFiles();
    this.isIniting.set(false);
    this.loadLabelFileData(this.selectedLabelFile());
  }
  extractFramesDialogOpen = signal(false, ...ngDevMode ? [{ debugName: "extractFramesDialogOpen" }] : []);
  xfSuccessNotifyClasses = signal("", ...ngDevMode ? [{ debugName: "xfSuccessNotifyClasses" }] : []);
  async handleExtractFramesDone(labelFileKey) {
    this.extractFramesDialogOpen.set(false);
    if (labelFileKey === this.labelFileKey()) {
      await this.loadLabelFileData(this.selectedLabelFile());
    } else {
      await this.sessionService.loadLabelFiles();
      await this.router.navigate(["/labeler"], {
        queryParams: { labelFileKey }
      });
    }
    await new Promise((resolve) => setTimeout(resolve, 300));
    this.xfSuccessNotifyClasses.set("border border-primary");
    setTimeout(() => {
      this.xfSuccessNotifyClasses.set("");
    }, this.notificationDisplayTimeMs);
  }
  static \u0275fac = function LabelerPageComponent_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _LabelerPageComponent)();
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _LabelerPageComponent, selectors: [["app-labeler"]], inputs: { labelFileKey: [1, "labelFileKey"], frameKey: [1, "frameKey"] }, features: [\u0275\u0275NgOnChangesFeature], decls: 1, vars: 1, consts: [[1, "grow", "flex", "flex-row", "items-stretch"], [1, "bg-base-200", "w-60", "xl:w-80", "flex", "flex-col", "justify-between", "shadow-lg"], [1, "p-4"], [1, "mb-2"], [1, "flex", "join"], [1, "grow", 3, "labelFileKeyChange", "labelFileKey", "selectSizeClass"], [1, "btn", "btn-sm", "btn-primary", "join-item"], [1, "flex", "justify-between", "bg-base-300", "items-center"], [1, ""], [1, "text-xs"], [1, "panel-content", "inset-shadow-xs", "inset-shadow-black/30", "overflow-auto", "h-60"], ["tabindex", "0", "role", "listbox", 1, "w-fit", "relative"], [1, "p-1"], [1, "bg-base-300"], [1, "text-sm"], [1, "btn", "btn-soft", "btn-primary", "btn-circle", "btn-sm", "my-2", "w-full"], [1, "h-20", "p-4"], [3, "initialStep", "initialLabelFileSelectionType", "initialSelectedLabelFileKey"], [1, "grow", "z-30", 3, "saved", "newLabelFile", "labelFile", "frame", "numLabeledFrames"], [1, "btn", "btn-sm", "btn-primary", "join-item", 3, "click"], ["routerLinkActive", "bg-sky-700", 1, "text-nowrap"], [1, "p-1", "block", "hover:bg-base-content/10", "rounded-sm", "flex", "items-center", "justify-between", "text-xs", 3, "routerLink", "queryParams"], [1, "btn", "btn-soft", "btn-primary", "btn-circle", "btn-sm", "my-2", "w-full", 3, "click"], [3, "exit", "done", "initialStep", "initialLabelFileSelectionType", "initialSelectedLabelFileKey"]], template: function LabelerPageComponent_Template(rf, ctx) {
    if (rf & 1) {
      \u0275\u0275conditionalCreate(0, LabelerPageComponent_Conditional_0_Template, 37, 16, "div", 0);
    }
    if (rf & 2) {
      \u0275\u0275conditional(!ctx.isIniting() ? 0 : -1);
    }
  }, dependencies: [
    LoadingBarComponent,
    LabelerCenterPanelComponent,
    RouterLinkActive,
    RouterLink,
    LabelFilePickerComponent,
    ExtractFramesDialogComponent,
    PathPipe
  ], styles: ["\n\n[_nghost-%COMP%] {\n  flex-grow: 1;\n  display: flex;\n}\n/*# sourceMappingURL=/static/labeler-page.component-2C3HHMLS.css.map */"], changeDetection: 0 });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(LabelerPageComponent, [{
    type: Component,
    args: [{ selector: "app-labeler", imports: [
      LoadingBarComponent,
      LabelerCenterPanelComponent,
      RouterLinkActive,
      RouterLink,
      PathPipe,
      LabelFilePickerComponent,
      ExtractFramesDialogComponent
    ], changeDetection: ChangeDetectionStrategy.OnPush, template: `<style>
  :host {
    flex-grow: 1;
    display: flex;
  }
</style>

@if (!isIniting()) {
  <div class="grow flex flex-row items-stretch">
    <!-- Left pane -->
    <div
      class="bg-base-200 w-60 xl:w-80 flex flex-col justify-between shadow-lg"
    >
      <div>
        <div class="p-4">
          <h1 class="mb-2">Label file</h1>
          <div class="flex join">
            <app-label-file-picker
              class="grow"
              [labelFileKey]="labelFileKey() ?? null"
              (labelFileKeyChange)="handleSelectLabelFile($event)"
              [selectSizeClass]="'select-sm join-item'"
            ></app-label-file-picker>
            @if (!this.labelFileKey()) {
              <button
                class="btn btn-sm btn-primary join-item"
                (click)="extractFramesDialogOpen.set(true)"
              >
                +
              </button>
            }
          </div>
        </div>
        @if (isLoading()) {
          <div class="p-4">Loading CSV file...</div>
        }
        <div class="p-4">
          <!-- labeled frames panel -->

          <div class="flex justify-between bg-base-300 items-center">
            <!--header row-->
            <h1 class="">Labeled frames</h1>
            <div class="text-xs">
              {{ labelFileDataLabeledSlice().length }}
            </div>
          </div>
          <div
            class="panel-content inset-shadow-xs inset-shadow-black/30 overflow-auto h-60"
          >
            <!--panel content-->
            <ul class="w-fit relative" tabindex="0" role="listbox">
              @if (labelFileDataLabeledSlice() === null) {
                <li class="p-1">No labeled frames</li>
              } @else {
                @for (frame of labelFileDataLabeledSlice(); track frame.key) {
                  <li class="text-nowrap" routerLinkActive="bg-sky-700">
                    <a
                      class="p-1 block hover:bg-base-content/10 rounded-sm flex items-center justify-between text-xs"
                      [routerLink]="['/labeler']"
                      [queryParams]="{
                        labelFileKey: selectedLabelFile()?.key,
                        frameKey: frame.key,
                      }"
                    >
                      <span>{{ frame.key | path }}</span>
                      <!-- left hand side -->
                    </a>
                  </li>
                }
              }
            </ul>
          </div>
        </div>
        <div class="p-4">
          <!-- unlabeled frames panel -->
          <div class="bg-base-300">
            <!--header row-->
            <div class="flex justify-between bg-base-300 items-center">
              <!--header row-->
              <h1 class="">Remaining frames to label</h1>
              <div class="text-xs">
                {{ labelFileDataUnLabeledSlice().length }}
              </div>
            </div>
            <div class="text-sm">Please label one at a time</div>
          </div>
          <div
            class="panel-content
              inset-shadow-xs inset-shadow-black/30
              overflow-auto
              h-60 flex flex-col justify-between
              transition-color duration-500 ease-in-out {{
              xfSuccessNotifyClasses()
            }}"
          >
            <!--panel content-->
            <ul class="w-fit relative" tabindex="0" role="listbox">
              @if (labelFileDataUnLabeledSlice() === null) {
                <li class="p-1">No labeled frames</li>
              } @else {
                @for (frame of labelFileDataUnLabeledSlice(); track frame.key) {
                  <li class="text-nowrap" routerLinkActive="bg-sky-700">
                    <a
                      class="p-1 block hover:bg-base-content/10 rounded-sm flex items-center justify-between text-xs"
                      [routerLink]="['/labeler']"
                      [queryParams]="{
                        labelFileKey: selectedLabelFile()?.key,
                        frameKey: frame.key,
                      }"
                    >
                      <span>{{ frame.key | path }}</span>
                      <!-- left hand side -->
                    </a>
                  </li>
                }
              }
            </ul>
          </div>
          @if (this.loadedLabelFile()) {
            <button
              class="btn btn-soft btn-primary btn-circle btn-sm my-2 w-full"
              (click)="extractFramesDialogOpen.set(true)"
            >
              Add more frames from a session
            </button>
          }
        </div>
      </div>
      <app-loading-bar class="h-20 p-4"></app-loading-bar>
    </div>

    @if (extractFramesDialogOpen()) {
      <app-extract-frames-dialog
        [initialStep]="labelFileKey() == null ? 'labelFile' : 'session'"
        [initialLabelFileSelectionType]="
          labelFileKey() == null ? 'createNew' : 'useExisting'
        "
        [initialSelectedLabelFileKey]="labelFileKey() ?? null"
        (exit)="extractFramesDialogOpen.set(false)"
        (done)="handleExtractFramesDone($event)"
      ></app-extract-frames-dialog>
    }

    <!-- Center content -->
    <app-labeler-center-panel
      class="grow z-30"
      [labelFile]="loadedLabelFile()"
      [frame]="selectedFrame()"
      [numLabeledFrames]="labelFileDataLabeledSlice().length"
      (saved)="handleSaved($event)"
      (newLabelFile)="extractFramesDialogOpen.set(true)"
    ></app-labeler-center-panel>
  </div>
}
`, styles: ["/* angular:styles/component:css;1fa15f7a0ae1b0259233282b2d49fb361834bf7fd726c58584c186240f9d8f04;/home/ksikka/lightning-pose-app/web_ui/src/app/labeler/labeler-page.component.html */\n:host {\n  flex-grow: 1;\n  display: flex;\n}\n/*# sourceMappingURL=/static/labeler-page.component-2C3HHMLS.css.map */\n"] }]
  }], null, null);
})();
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(LabelerPageComponent, { className: "LabelerPageComponent", filePath: "src/app/labeler/labeler-page.component.ts", lineNumber: 44 });
})();

// src/app/components/tree-listbox/tree-listbox.component.ts
var _c010 = ["*"];
var TreeListBoxComponent = class _TreeListBoxComponent {
  // If false, Enter on expandable nodes expands instead of selecting
  allowFolderSelect = input(true, ...ngDevMode ? [{ debugName: "allowFolderSelect" }] : []);
  el = inject2(ElementRef);
  // Registered options in DOM order
  _options = signal([], ...ngDevMode ? [{ debugName: "_options" }] : []);
  // Expanded state per option instance (WeakMap for GC on destroy)
  _expanded = /* @__PURE__ */ new WeakMap();
  // Active and selected state managed here
  activeId = signal(null, ...ngDevMode ? [{ debugName: "activeId" }] : []);
  selectedValue = signal(null, ...ngDevMode ? [{ debugName: "selectedValue" }] : []);
  // Outputs
  selectionChange = output();
  // Focus visual
  focused = signal(false, ...ngDevMode ? [{ debugName: "focused" }] : []);
  // Public API for options to register
  registerOption(option) {
    const current = this._options();
    this._options.set([...current, option]);
    this.expandedFor(option);
    if (this.activeId() == null) {
      this.activeId.set(option.id);
    }
  }
  unregisterOption(option) {
    const list = this._options().filter((o) => o !== option);
    this._options.set(list);
    if (this.activeId() === option.id) {
      this.activeId.set(list.length ? list[0].id : null);
    }
    if (this.selectedValue() === option.value()) {
      this.setSelected(null);
    }
  }
  // Helpers for expanded state
  expandedFor(option) {
    let s = this._expanded.get(option);
    if (!s) {
      s = signal(false);
      this._expanded.set(option, s);
    }
    return s;
  }
  isExpanded(option) {
    return this.expandedFor(option)();
  }
  toggleExpand(option) {
    const s = this.expandedFor(option);
    s.set(!s());
  }
  // Visibility and enabled options
  isVisible(option) {
    let pid = option.parentId ? option.parentId() : null;
    const getById = (id) => this._options().find((o) => (o.nodeId ? o.nodeId() : null) === id);
    while (pid) {
      const parent = getById(pid);
      if (parent && !this.isExpanded(parent))
        return false;
      if (!parent)
        break;
      pid = parent.parentId ? parent.parentId() : null;
    }
    return true;
  }
  // Derived list of enabled options (visible and not disabled)
  enabledOptions = computed(() => this._options().filter((o) => !o.disabled() && this.isVisible(o)), ...ngDevMode ? [{ debugName: "enabledOptions" }] : []);
  // Keep option visual states in sync
  _sync = effect(() => {
    const active = this.activeId();
    const selected = this.selectedValue();
    const all = this._options();
    const activeOpt = all.find((o) => o.id === active) ?? null;
    if (activeOpt && !this.isVisible(activeOpt)) {
      const firstVisible = this.enabledOptions()[0] ?? null;
      this.activeId.set(firstVisible ? firstVisible.id : null);
    }
    const newActive = this.activeId();
    for (const opt2 of all) {
      opt2.active.set(opt2.id === newActive);
      const isSelected = selected !== null && opt2.value() === selected;
      opt2.selected.set(isSelected);
    }
  }, ...ngDevMode ? [{ debugName: "_sync" }] : []);
  onFocus() {
    this.focused.set(true);
    if (!this.activeId() && this._options().length) {
      this.activeId.set(this._options()[0].id);
    }
  }
  onBlur() {
    this.focused.set(false);
  }
  onKeydown(event) {
    const key = event.key;
    if (key === "ArrowDown" || key === "ArrowUp" || key === "Home" || key === "End" || key === "Enter" || key === " " || key === "ArrowLeft" || key === "ArrowRight") {
      event.preventDefault();
    }
    const enabled = this.enabledOptions();
    if (enabled.length === 0)
      return;
    const currentIndex = enabled.findIndex((o) => o.id === this.activeId());
    const first2 = enabled[0];
    const last4 = enabled[enabled.length - 1];
    const current = currentIndex >= 0 ? enabled[currentIndex] : null;
    switch (key) {
      case "ArrowDown": {
        const next = currentIndex >= 0 && currentIndex < enabled.length - 1 ? enabled[currentIndex + 1] : first2;
        this.activeId.set(next.id);
        break;
      }
      case "ArrowUp": {
        const prev = currentIndex > 0 ? enabled[currentIndex - 1] : last4;
        this.activeId.set(prev.id);
        break;
      }
      case "Home": {
        this.activeId.set(first2.id);
        break;
      }
      case "End": {
        this.activeId.set(last4.id);
        break;
      }
      case "ArrowRight": {
        if (current && current.hasChildren && current.hasChildren()) {
          if (!this.isExpanded(current)) {
            this.toggleExpand(current);
          } else {
            const next = currentIndex < enabled.length - 1 ? enabled[currentIndex + 1] : first2;
            this.activeId.set(next.id);
          }
        }
        break;
      }
      case "ArrowLeft": {
        if (current && current.hasChildren && current.hasChildren()) {
          if (this.isExpanded(current)) {
            this.toggleExpand(current);
            break;
          }
        }
        if (current && current.parentId && current.parentId()) {
          const pid = current.parentId();
          const parent = this._options().find((o) => (o.nodeId ? o.nodeId() : null) === pid);
          if (parent)
            this.activeId.set(parent.id);
        }
        break;
      }
      case "Enter": {
        const active = current;
        if (active && !active.disabled()) {
          if (active.hasChildren && active.hasChildren() && !this.allowFolderSelect()) {
            this.toggleExpand(active);
          } else {
            this.setSelected(active.value());
          }
        }
        break;
      }
      case " ": {
        const active = this._options().find((o) => o.id === this.activeId());
        if (active && !active.disabled()) {
          this.setSelected(active.value());
        }
        break;
      }
    }
  }
  // Called by option clicks too
  setSelected(value) {
    this.selectedValue.set(value);
    this.selectionChange.emit(value);
  }
  static \u0275fac = function TreeListBoxComponent_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _TreeListBoxComponent)();
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _TreeListBoxComponent, selectors: [["app-tree-listbox"]], hostAttrs: ["role", "listbox", "tabindex", "0"], hostVars: 4, hostBindings: function TreeListBoxComponent_HostBindings(rf, ctx) {
    if (rf & 1) {
      \u0275\u0275listener("keydown", function TreeListBoxComponent_keydown_HostBindingHandler($event) {
        return ctx.onKeydown($event);
      })("focus", function TreeListBoxComponent_focus_HostBindingHandler() {
        return ctx.onFocus();
      })("blur", function TreeListBoxComponent_blur_HostBindingHandler() {
        return ctx.onBlur();
      });
    }
    if (rf & 2) {
      \u0275\u0275attribute("aria-activedescendant", ctx.activeId())("aria-multiselectable", "false");
      \u0275\u0275classProp("tlb-focused", ctx.focused());
    }
  }, inputs: { allowFolderSelect: [1, "allowFolderSelect"] }, outputs: { selectionChange: "selectionChange" }, ngContentSelectors: _c010, decls: 1, vars: 0, template: function TreeListBoxComponent_Template(rf, ctx) {
    if (rf & 1) {
      \u0275\u0275projectionDef();
      \u0275\u0275projection(0);
    }
  }, styles: ["\n\n[_nghost-%COMP%] {\n  display: block;\n  outline: none;\n}\n.tlb-focused[_nghost-%COMP%] {\n  outline: 2px solid var(--focus-color, #3b82f6);\n  outline-offset: 2px;\n}\n/*# sourceMappingURL=/static/tree-listbox.component-SA2WHIMD.css.map */"], changeDetection: 0 });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(TreeListBoxComponent, [{
    type: Component,
    args: [{ selector: "app-tree-listbox", imports: [], template: ` <ng-content></ng-content> `, changeDetection: ChangeDetectionStrategy.OnPush, host: {
      role: "listbox",
      tabindex: "0",
      "[attr.aria-activedescendant]": "activeId()",
      "[attr.aria-multiselectable]": '"false"',
      "(keydown)": "onKeydown($event)",
      "(focus)": "onFocus()",
      "(blur)": "onBlur()",
      "[class.tlb-focused]": "focused()"
    }, styles: ["/* angular:styles/component:css;1ab8c837e279e185e840eee8ef43de0069f00534a8f067e87fe76012634d1daa;/home/ksikka/lightning-pose-app/web_ui/src/app/components/tree-listbox/tree-listbox.component.ts */\n:host {\n  display: block;\n  outline: none;\n}\n:host(.tlb-focused) {\n  outline: 2px solid var(--focus-color, #3b82f6);\n  outline-offset: 2px;\n}\n/*# sourceMappingURL=/static/tree-listbox.component-SA2WHIMD.css.map */\n"] }]
  }], null, null);
})();
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(TreeListBoxComponent, { className: "TreeListBoxComponent", filePath: "src/app/components/tree-listbox/tree-listbox.component.ts", lineNumber: 46 });
})();

// src/app/components/tree-listbox/tree-option.component.ts
var _c011 = ["*"];
var uid = 0;
var TreeOptionComponent = class _TreeOptionComponent {
  listbox = inject2(TreeListBoxComponent);
  // Inputs for flat tree metadata
  nodeId = input.required(...ngDevMode ? [{ debugName: "nodeId" }] : []);
  parentId = input(null, ...ngDevMode ? [{ debugName: "parentId" }] : []);
  level = input(0, ...ngDevMode ? [{ debugName: "level" }] : []);
  hasChildren = input(false, ...ngDevMode ? [{ debugName: "hasChildren" }] : []);
  value = input.required(...ngDevMode ? [{ debugName: "value" }] : []);
  disabled = input(false, ...ngDevMode ? [{ debugName: "disabled" }] : []);
  // Local states controlled by listbox
  active = signal(false, ...ngDevMode ? [{ debugName: "active" }] : []);
  selected = signal(false, ...ngDevMode ? [{ debugName: "selected" }] : []);
  // Expand/collapse and visibility resolved via listbox
  expanded = computed(() => this.listbox.isExpanded(this), ...ngDevMode ? [{ debugName: "expanded" }] : []);
  visible = computed(() => this.listbox.isVisible(this), ...ngDevMode ? [{ debugName: "visible" }] : []);
  // Each option needs a stable id for aria-activedescendant
  id = `tlb-opt-${++uid}`;
  indentPx() {
    return (this.level ? this.level() : 0) * 12;
  }
  ngOnInit() {
    this.listbox.registerOption(this);
  }
  onToggleClick(event) {
    event.stopPropagation();
    if (this.hasChildren()) {
      this.listbox.toggleExpand(this);
    }
  }
  onClick() {
    if (this.disabled())
      return;
    this.listbox.activeId.set(this.id);
    this.listbox.setSelected(this.value());
  }
  ngOnDestroy() {
    this.listbox.unregisterOption(this);
  }
  static \u0275fac = function TreeOptionComponent_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _TreeOptionComponent)();
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _TreeOptionComponent, selectors: [["app-tree-option"]], hostAttrs: ["role", "option"], hostVars: 14, hostBindings: function TreeOptionComponent_HostBindings(rf, ctx) {
    if (rf & 1) {
      \u0275\u0275listener("click", function TreeOptionComponent_click_HostBindingHandler() {
        return ctx.onClick();
      });
    }
    if (rf & 2) {
      \u0275\u0275domProperty("id", ctx.id);
      \u0275\u0275attribute("aria-selected", ctx.selected())("aria-disabled", ctx.disabled() ? "true" : null)("aria-expanded", ctx.hasChildren() ? ctx.expanded() ? "true" : "false" : null);
      \u0275\u0275styleProp("padding-left", ctx.indentPx(), "px")("display", ctx.visible() ? "block" : "none");
      \u0275\u0275classProp("active", ctx.active())("selected", ctx.selected())("disabled", ctx.disabled());
    }
  }, inputs: { nodeId: [1, "nodeId"], parentId: [1, "parentId"], level: [1, "level"], hasChildren: [1, "hasChildren"], value: [1, "value"], disabled: [1, "disabled"] }, ngContentSelectors: _c011, decls: 3, vars: 7, consts: [["aria-hidden", "true", 1, "caret", 3, "click"]], template: function TreeOptionComponent_Template(rf, ctx) {
    if (rf & 1) {
      \u0275\u0275projectionDef();
      \u0275\u0275domElementStart(0, "span", 0);
      \u0275\u0275domListener("click", function TreeOptionComponent_Template_span_click_0_listener($event) {
        return ctx.onToggleClick($event);
      });
      \u0275\u0275text(1);
      \u0275\u0275domElementEnd();
      \u0275\u0275projection(2);
    }
    if (rf & 2) {
      \u0275\u0275styleProp("visibility", ctx.hasChildren() ? "visible" : "hidden")("display", "inline-block")("width", 12, "px");
      \u0275\u0275advance();
      \u0275\u0275textInterpolate(ctx.expanded() ? "\u25BE" : "\u25B8");
    }
  }, styles: ["\n\n[_nghost-%COMP%] {\n  display: block;\n  padding: 0.25rem 0.5rem;\n  cursor: pointer;\n}\n.disabled[_nghost-%COMP%] {\n  cursor: not-allowed;\n  opacity: 0.6;\n}\n.active[_nghost-%COMP%] {\n  background: var(--active-bg, #eef2ff);\n}\n.selected[_nghost-%COMP%] {\n  background: var(--selected-bg, #dbeafe);\n}\n/*# sourceMappingURL=/static/tree-option.component-ZP2K7I3T.css.map */"], changeDetection: 0 });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(TreeOptionComponent, [{
    type: Component,
    args: [{ selector: "app-tree-option", imports: [], template: `
    <span
      class="caret"
      (click)="onToggleClick($event)"
      [style.visibility]="hasChildren() ? 'visible' : 'hidden'"
      [style.display]="'inline-block'"
      [style.width.px]="12"
      aria-hidden="true"
      >{{ expanded() ? '\u25BE' : '\u25B8' }}</span
    >
    <ng-content></ng-content>
  `, changeDetection: ChangeDetectionStrategy.OnPush, host: {
      role: "option",
      "[id]": "id",
      "[attr.aria-selected]": "selected()",
      "[attr.aria-disabled]": 'disabled() ? "true" : null',
      "[attr.aria-expanded]": 'hasChildren() ? (expanded() ? "true" : "false") : null',
      "[style.padding-left.px]": "indentPx()",
      "[style.display]": 'visible() ? "block" : "none"',
      "[class.active]": "active()",
      "[class.selected]": "selected()",
      "[class.disabled]": "disabled()",
      "(click)": "onClick()"
    }, styles: ["/* angular:styles/component:css;3a62440a90ec4b7483840b2870b594c8ebeee583de1ee5e41d1a81dbade5b893;/home/ksikka/lightning-pose-app/web_ui/src/app/components/tree-listbox/tree-option.component.ts */\n:host {\n  display: block;\n  padding: 0.25rem 0.5rem;\n  cursor: pointer;\n}\n:host(.disabled) {\n  cursor: not-allowed;\n  opacity: 0.6;\n}\n:host(.active) {\n  background: var(--active-bg, #eef2ff);\n}\n:host(.selected) {\n  background: var(--selected-bg, #dbeafe);\n}\n/*# sourceMappingURL=/static/tree-option.component-ZP2K7I3T.css.map */\n"] }]
  }], null, null);
})();
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(TreeOptionComponent, { className: "TreeOptionComponent", filePath: "src/app/components/tree-listbox/tree-option.component.ts", lineNumber: 66 });
})();

// src/app/sandbox/sandbox.component.ts
var _forTrack07 = ($index, $item) => $item.nodeId;
function SandboxComponent_For_5_Conditional_3_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "span");
    \u0275\u0275text(1);
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const n_r1 = \u0275\u0275nextContext().$implicit;
    \u0275\u0275advance();
    \u0275\u0275textInterpolate1(" (meta: ", n_r1.meta.info, ")");
  }
}
function SandboxComponent_For_5_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "app-tree-option", 2);
    \u0275\u0275elementContainerStart(1);
    \u0275\u0275text(2);
    \u0275\u0275elementContainerEnd();
    \u0275\u0275conditionalCreate(3, SandboxComponent_For_5_Conditional_3_Template, 2, 1, "span");
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const n_r1 = ctx.$implicit;
    \u0275\u0275property("value", n_r1.value)("nodeId", n_r1.nodeId)("parentId", n_r1.parentId)("level", n_r1.level)("hasChildren", n_r1.hasChildren);
    \u0275\u0275advance(2);
    \u0275\u0275textInterpolate(n_r1.label);
    \u0275\u0275advance();
    \u0275\u0275conditional(n_r1.meta ? 3 : -1);
  }
}
var SandboxComponent = class _SandboxComponent {
  tree = signal([
    {
      id: "fruits",
      label: "Fruits",
      children: [
        { id: 1, label: "Apple", meta: { info: "red" } },
        { id: 2, label: "Banana", meta: { info: "yellow" } },
        { id: 3, label: "Cherry", meta: { info: "dark red" } }
      ]
    },
    {
      id: "vegetables",
      label: "Vegetables",
      children: [
        { id: 4, label: "Carrot", meta: { info: "orange" } },
        { id: 5, label: "Broccoli", meta: { info: "green" } }
      ]
    }
  ], ...ngDevMode ? [{ debugName: "tree" }] : []);
  flatNodes = computed(() => {
    const out = [];
    for (const group of this.tree()) {
      out.push({
        nodeId: String(group.id),
        parentId: null,
        level: 0,
        hasChildren: (group.children?.length ?? 0) > 0,
        value: group,
        label: group.label
      });
      for (const child of group.children ?? []) {
        out.push({
          nodeId: String(child.id),
          parentId: String(group.id),
          level: 1,
          hasChildren: false,
          value: child,
          label: child.label,
          meta: child.meta
        });
      }
    }
    return out;
  }, ...ngDevMode ? [{ debugName: "flatNodes" }] : []);
  selected = signal(null, ...ngDevMode ? [{ debugName: "selected" }] : []);
  selectedLabel = computed(() => {
    const v = this.selected();
    if (v == null)
      return "none";
    if (typeof v === "object") {
      const rec = v;
      const lbl = rec["label"];
      if (typeof lbl === "string")
        return lbl;
      try {
        return JSON.stringify(v);
      } catch {
        return "[object]";
      }
    }
    return String(v);
  }, ...ngDevMode ? [{ debugName: "selectedLabel" }] : []);
  onSelect = (value) => {
    this.selected.set(value);
    console.log("Selected value:", value);
  };
  static \u0275fac = function SandboxComponent_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _SandboxComponent)();
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _SandboxComponent, selectors: [["app-sandbox"]], decls: 8, vars: 2, consts: [[2, "max-width", "360px"], [3, "selectionChange", "allowFolderSelect"], [3, "value", "nodeId", "parentId", "level", "hasChildren"]], template: function SandboxComponent_Template(rf, ctx) {
    if (rf & 1) {
      \u0275\u0275elementStart(0, "section", 0)(1, "h3");
      \u0275\u0275text(2, "TreeListBox demo (flat content)");
      \u0275\u0275elementEnd();
      \u0275\u0275elementStart(3, "app-tree-listbox", 1);
      \u0275\u0275listener("selectionChange", function SandboxComponent_Template_app_tree_listbox_selectionChange_3_listener($event) {
        return ctx.onSelect($event);
      });
      \u0275\u0275repeaterCreate(4, SandboxComponent_For_5_Template, 4, 7, "app-tree-option", 2, _forTrack07);
      \u0275\u0275elementEnd();
      \u0275\u0275elementStart(6, "p");
      \u0275\u0275text(7);
      \u0275\u0275elementEnd()();
    }
    if (rf & 2) {
      \u0275\u0275advance(3);
      \u0275\u0275property("allowFolderSelect", false);
      \u0275\u0275advance();
      \u0275\u0275repeater(ctx.flatNodes());
      \u0275\u0275advance(3);
      \u0275\u0275textInterpolate1("Selected: ", ctx.selectedLabel());
    }
  }, dependencies: [TreeListBoxComponent, TreeOptionComponent], encapsulation: 2, changeDetection: 0 });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(SandboxComponent, [{
    type: Component,
    args: [{ selector: "app-sandbox", imports: [TreeListBoxComponent, TreeOptionComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: '<section style="max-width: 360px;">\n  <h3>TreeListBox demo (flat content)</h3>\n  <app-tree-listbox (selectionChange)="onSelect($event)" [allowFolderSelect]="false">\n    @for (n of flatNodes(); track n.nodeId) {\n      <app-tree-option\n        [value]="n.value"\n        [nodeId]="n.nodeId"\n        [parentId]="n.parentId"\n        [level]="n.level"\n        [hasChildren]="n.hasChildren"\n      >\n        <ng-container>{{ n.label }}</ng-container>\n        @if (n.meta) { <span> (meta: {{ n.meta.info }})</span> }\n      </app-tree-option>\n    }\n  </app-tree-listbox>\n\n  <p>Selected: {{ selectedLabel() }}</p>\n</section>\n' }]
  }], null, null);
})();
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(SandboxComponent, { className: "SandboxComponent", filePath: "src/app/sandbox/sandbox.component.ts", lineNumber: 17 });
})();

// src/app/home-page/home-page.component.ts
var _forTrack08 = ($index, $item) => $item.href;
function HomePageComponent_For_2_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275domElementStart(0, "a", 1)(1, "figure", 2);
    \u0275\u0275domElement(2, "img", 3);
    \u0275\u0275domElementEnd();
    \u0275\u0275domElementStart(3, "div", 4)(4, "h2", 5);
    \u0275\u0275text(5);
    \u0275\u0275domElementEnd();
    \u0275\u0275domElementStart(6, "p", 6);
    \u0275\u0275text(7);
    \u0275\u0275domElementEnd()()();
  }
  if (rf & 2) {
    const card_r1 = ctx.$implicit;
    \u0275\u0275domProperty("href", card_r1.href, \u0275\u0275sanitizeUrl);
    \u0275\u0275advance(2);
    \u0275\u0275domProperty("src", card_r1.imgSrc, \u0275\u0275sanitizeUrl)("alt", card_r1.imgAlt);
    \u0275\u0275advance(3);
    \u0275\u0275textInterpolate(card_r1.title);
    \u0275\u0275advance(2);
    \u0275\u0275textInterpolate(card_r1.description);
  }
}
var HomePageComponent = class _HomePageComponent {
  cards = [
    {
      href: "/",
      title: "Project settings",
      description: "View and edit configuration for the current Project",
      imgSrc: "https://img.daisyui.com/images/components/accordion.webp",
      imgAlt: "Accordion"
    },
    {
      href: "/labeler",
      title: "Labeler",
      description: "View labeled data and label new frames",
      imgSrc: "https://img.daisyui.com/images/components/accordion.webp",
      imgAlt: "Accordion"
    },
    {
      href: "/models",
      title: "Models",
      description: "Train, evaluate, and run models",
      imgSrc: "https://img.daisyui.com/images/components/accordion.webp",
      imgAlt: "Accordion"
    },
    {
      href: "/viewer/",
      title: "Viewer",
      description: "View sessions and model predictions",
      imgSrc: "https://img.daisyui.com/images/components/accordion.webp",
      imgAlt: "Accordion"
    }
  ];
  static \u0275fac = function HomePageComponent_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _HomePageComponent)();
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _HomePageComponent, selectors: [["app-home-page"]], decls: 3, vars: 0, consts: [[1, "not-prose", "grid", "grid-cols-1", "gap-x-12", "gap-y-12", "sm:grid-cols-2", "md:grid-cols-4", "lg:grid-cols-4", "xl:grid-cols-5"], [1, "card", "card-compact", "hover:bg-base-200", "transition-all", "duration-200", "hover:-translate-y-1", 3, "href"], [1, "px-4", "pt-4"], ["loading", "lazy", 1, "border-base-content/5", "bg-base-300", "rounded-lg", "border", 3, "src", "alt"], [1, "card-body"], [1, "card-title"], [1, "text-xs", "opacity-60"]], template: function HomePageComponent_Template(rf, ctx) {
    if (rf & 1) {
      \u0275\u0275domElementStart(0, "div", 0);
      \u0275\u0275repeaterCreate(1, HomePageComponent_For_2_Template, 8, 5, "a", 1, _forTrack08);
      \u0275\u0275domElementEnd();
    }
    if (rf & 2) {
      \u0275\u0275advance();
      \u0275\u0275repeater(ctx.cards);
    }
  }, encapsulation: 2, changeDetection: 0 });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HomePageComponent, [{
    type: Component,
    args: [{ selector: "app-home-page", imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: '<div\n  class="not-prose grid grid-cols-1 gap-x-12 gap-y-12 sm:grid-cols-2 md:grid-cols-4 lg:grid-cols-4 xl:grid-cols-5"\n>\n  @for (card of cards; track card.href) {\n    <a\n      class="card card-compact hover:bg-base-200 transition-all duration-200 hover:-translate-y-1"\n      [href]="card.href"\n      ><figure class="px-4 pt-4">\n        <img\n          loading="lazy"\n          class="border-base-content/5 bg-base-300 rounded-lg border"\n          [src]="card.imgSrc"\n          [alt]="card.imgAlt"\n        />\n      </figure>\n\n      <div class="card-body">\n        <h2 class="card-title">{{ card.title }}</h2>\n        <p class="text-xs opacity-60">{{ card.description }}</p>\n      </div></a\n    >\n  }\n</div>\n' }]
  }], null, null);
})();
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(HomePageComponent, { className: "HomePageComponent", filePath: "src/app/home-page/home-page.component.ts", lineNumber: 10 });
})();

// src/app/create-model-dialog/create-model-dialog.component.ts
var import_lodash3 = __toESM(require_lodash());

// node_modules/yaml/browser/dist/nodes/identity.js
var ALIAS = Symbol.for("yaml.alias");
var DOC = Symbol.for("yaml.document");
var MAP = Symbol.for("yaml.map");
var PAIR = Symbol.for("yaml.pair");
var SCALAR = Symbol.for("yaml.scalar");
var SEQ = Symbol.for("yaml.seq");
var NODE_TYPE = Symbol.for("yaml.node.type");
var isAlias = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === ALIAS;
var isDocument = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === DOC;
var isMap = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === MAP;
var isPair = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === PAIR;
var isScalar = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === SCALAR;
var isSeq = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === SEQ;
function isCollection(node) {
  if (node && typeof node === "object")
    switch (node[NODE_TYPE]) {
      case MAP:
      case SEQ:
        return true;
    }
  return false;
}
function isNode(node) {
  if (node && typeof node === "object")
    switch (node[NODE_TYPE]) {
      case ALIAS:
      case MAP:
      case SCALAR:
      case SEQ:
        return true;
    }
  return false;
}
var hasAnchor = (node) => (isScalar(node) || isCollection(node)) && !!node.anchor;

// node_modules/yaml/browser/dist/visit.js
var BREAK = Symbol("break visit");
var SKIP = Symbol("skip children");
var REMOVE = Symbol("remove node");
function visit(node, visitor) {
  const visitor_ = initVisitor(visitor);
  if (isDocument(node)) {
    const cd = visit_(null, node.contents, visitor_, Object.freeze([node]));
    if (cd === REMOVE)
      node.contents = null;
  } else
    visit_(null, node, visitor_, Object.freeze([]));
}
visit.BREAK = BREAK;
visit.SKIP = SKIP;
visit.REMOVE = REMOVE;
function visit_(key, node, visitor, path) {
  const ctrl = callVisitor(key, node, visitor, path);
  if (isNode(ctrl) || isPair(ctrl)) {
    replaceNode(key, path, ctrl);
    return visit_(key, ctrl, visitor, path);
  }
  if (typeof ctrl !== "symbol") {
    if (isCollection(node)) {
      path = Object.freeze(path.concat(node));
      for (let i = 0; i < node.items.length; ++i) {
        const ci = visit_(i, node.items[i], visitor, path);
        if (typeof ci === "number")
          i = ci - 1;
        else if (ci === BREAK)
          return BREAK;
        else if (ci === REMOVE) {
          node.items.splice(i, 1);
          i -= 1;
        }
      }
    } else if (isPair(node)) {
      path = Object.freeze(path.concat(node));
      const ck = visit_("key", node.key, visitor, path);
      if (ck === BREAK)
        return BREAK;
      else if (ck === REMOVE)
        node.key = null;
      const cv = visit_("value", node.value, visitor, path);
      if (cv === BREAK)
        return BREAK;
      else if (cv === REMOVE)
        node.value = null;
    }
  }
  return ctrl;
}
async function visitAsync(node, visitor) {
  const visitor_ = initVisitor(visitor);
  if (isDocument(node)) {
    const cd = await visitAsync_(null, node.contents, visitor_, Object.freeze([node]));
    if (cd === REMOVE)
      node.contents = null;
  } else
    await visitAsync_(null, node, visitor_, Object.freeze([]));
}
visitAsync.BREAK = BREAK;
visitAsync.SKIP = SKIP;
visitAsync.REMOVE = REMOVE;
async function visitAsync_(key, node, visitor, path) {
  const ctrl = await callVisitor(key, node, visitor, path);
  if (isNode(ctrl) || isPair(ctrl)) {
    replaceNode(key, path, ctrl);
    return visitAsync_(key, ctrl, visitor, path);
  }
  if (typeof ctrl !== "symbol") {
    if (isCollection(node)) {
      path = Object.freeze(path.concat(node));
      for (let i = 0; i < node.items.length; ++i) {
        const ci = await visitAsync_(i, node.items[i], visitor, path);
        if (typeof ci === "number")
          i = ci - 1;
        else if (ci === BREAK)
          return BREAK;
        else if (ci === REMOVE) {
          node.items.splice(i, 1);
          i -= 1;
        }
      }
    } else if (isPair(node)) {
      path = Object.freeze(path.concat(node));
      const ck = await visitAsync_("key", node.key, visitor, path);
      if (ck === BREAK)
        return BREAK;
      else if (ck === REMOVE)
        node.key = null;
      const cv = await visitAsync_("value", node.value, visitor, path);
      if (cv === BREAK)
        return BREAK;
      else if (cv === REMOVE)
        node.value = null;
    }
  }
  return ctrl;
}
function initVisitor(visitor) {
  if (typeof visitor === "object" && (visitor.Collection || visitor.Node || visitor.Value)) {
    return Object.assign({
      Alias: visitor.Node,
      Map: visitor.Node,
      Scalar: visitor.Node,
      Seq: visitor.Node
    }, visitor.Value && {
      Map: visitor.Value,
      Scalar: visitor.Value,
      Seq: visitor.Value
    }, visitor.Collection && {
      Map: visitor.Collection,
      Seq: visitor.Collection
    }, visitor);
  }
  return visitor;
}
function callVisitor(key, node, visitor, path) {
  if (typeof visitor === "function")
    return visitor(key, node, path);
  if (isMap(node))
    return visitor.Map?.(key, node, path);
  if (isSeq(node))
    return visitor.Seq?.(key, node, path);
  if (isPair(node))
    return visitor.Pair?.(key, node, path);
  if (isScalar(node))
    return visitor.Scalar?.(key, node, path);
  if (isAlias(node))
    return visitor.Alias?.(key, node, path);
  return void 0;
}
function replaceNode(key, path, node) {
  const parent = path[path.length - 1];
  if (isCollection(parent)) {
    parent.items[key] = node;
  } else if (isPair(parent)) {
    if (key === "key")
      parent.key = node;
    else
      parent.value = node;
  } else if (isDocument(parent)) {
    parent.contents = node;
  } else {
    const pt = isAlias(parent) ? "alias" : "scalar";
    throw new Error(`Cannot replace node with ${pt} parent`);
  }
}

// node_modules/yaml/browser/dist/doc/directives.js
var escapeChars = {
  "!": "%21",
  ",": "%2C",
  "[": "%5B",
  "]": "%5D",
  "{": "%7B",
  "}": "%7D"
};
var escapeTagName = (tn) => tn.replace(/[!,[\]{}]/g, (ch) => escapeChars[ch]);
var Directives = class _Directives {
  constructor(yaml2, tags) {
    this.docStart = null;
    this.docEnd = false;
    this.yaml = Object.assign({}, _Directives.defaultYaml, yaml2);
    this.tags = Object.assign({}, _Directives.defaultTags, tags);
  }
  clone() {
    const copy = new _Directives(this.yaml, this.tags);
    copy.docStart = this.docStart;
    return copy;
  }
  /**
   * During parsing, get a Directives instance for the current document and
   * update the stream state according to the current version's spec.
   */
  atDocument() {
    const res = new _Directives(this.yaml, this.tags);
    switch (this.yaml.version) {
      case "1.1":
        this.atNextDocument = true;
        break;
      case "1.2":
        this.atNextDocument = false;
        this.yaml = {
          explicit: _Directives.defaultYaml.explicit,
          version: "1.2"
        };
        this.tags = Object.assign({}, _Directives.defaultTags);
        break;
    }
    return res;
  }
  /**
   * @param onError - May be called even if the action was successful
   * @returns `true` on success
   */
  add(line, onError) {
    if (this.atNextDocument) {
      this.yaml = { explicit: _Directives.defaultYaml.explicit, version: "1.1" };
      this.tags = Object.assign({}, _Directives.defaultTags);
      this.atNextDocument = false;
    }
    const parts = line.trim().split(/[ \t]+/);
    const name2 = parts.shift();
    switch (name2) {
      case "%TAG": {
        if (parts.length !== 2) {
          onError(0, "%TAG directive should contain exactly two parts");
          if (parts.length < 2)
            return false;
        }
        const [handle, prefix] = parts;
        this.tags[handle] = prefix;
        return true;
      }
      case "%YAML": {
        this.yaml.explicit = true;
        if (parts.length !== 1) {
          onError(0, "%YAML directive should contain exactly one part");
          return false;
        }
        const [version] = parts;
        if (version === "1.1" || version === "1.2") {
          this.yaml.version = version;
          return true;
        } else {
          const isValid = /^\d+\.\d+$/.test(version);
          onError(6, `Unsupported YAML version ${version}`, isValid);
          return false;
        }
      }
      default:
        onError(0, `Unknown directive ${name2}`, true);
        return false;
    }
  }
  /**
   * Resolves a tag, matching handles to those defined in %TAG directives.
   *
   * @returns Resolved tag, which may also be the non-specific tag `'!'` or a
   *   `'!local'` tag, or `null` if unresolvable.
   */
  tagName(source, onError) {
    if (source === "!")
      return "!";
    if (source[0] !== "!") {
      onError(`Not a valid tag: ${source}`);
      return null;
    }
    if (source[1] === "<") {
      const verbatim = source.slice(2, -1);
      if (verbatim === "!" || verbatim === "!!") {
        onError(`Verbatim tags aren't resolved, so ${source} is invalid.`);
        return null;
      }
      if (source[source.length - 1] !== ">")
        onError("Verbatim tags must end with a >");
      return verbatim;
    }
    const [, handle, suffix] = source.match(/^(.*!)([^!]*)$/s);
    if (!suffix)
      onError(`The ${source} tag has no suffix`);
    const prefix = this.tags[handle];
    if (prefix) {
      try {
        return prefix + decodeURIComponent(suffix);
      } catch (error) {
        onError(String(error));
        return null;
      }
    }
    if (handle === "!")
      return source;
    onError(`Could not resolve tag: ${source}`);
    return null;
  }
  /**
   * Given a fully resolved tag, returns its printable string form,
   * taking into account current tag prefixes and defaults.
   */
  tagString(tag) {
    for (const [handle, prefix] of Object.entries(this.tags)) {
      if (tag.startsWith(prefix))
        return handle + escapeTagName(tag.substring(prefix.length));
    }
    return tag[0] === "!" ? tag : `!<${tag}>`;
  }
  toString(doc) {
    const lines = this.yaml.explicit ? [`%YAML ${this.yaml.version || "1.2"}`] : [];
    const tagEntries = Object.entries(this.tags);
    let tagNames;
    if (doc && tagEntries.length > 0 && isNode(doc.contents)) {
      const tags = {};
      visit(doc.contents, (_key, node) => {
        if (isNode(node) && node.tag)
          tags[node.tag] = true;
      });
      tagNames = Object.keys(tags);
    } else
      tagNames = [];
    for (const [handle, prefix] of tagEntries) {
      if (handle === "!!" && prefix === "tag:yaml.org,2002:")
        continue;
      if (!doc || tagNames.some((tn) => tn.startsWith(prefix)))
        lines.push(`%TAG ${handle} ${prefix}`);
    }
    return lines.join("\n");
  }
};
Directives.defaultYaml = { explicit: false, version: "1.2" };
Directives.defaultTags = { "!!": "tag:yaml.org,2002:" };

// node_modules/yaml/browser/dist/doc/anchors.js
function anchorIsValid(anchor) {
  if (/[\x00-\x19\s,[\]{}]/.test(anchor)) {
    const sa = JSON.stringify(anchor);
    const msg = `Anchor must not contain whitespace or control characters: ${sa}`;
    throw new Error(msg);
  }
  return true;
}
function anchorNames(root) {
  const anchors = /* @__PURE__ */ new Set();
  visit(root, {
    Value(_key, node) {
      if (node.anchor)
        anchors.add(node.anchor);
    }
  });
  return anchors;
}
function findNewAnchor(prefix, exclude) {
  for (let i = 1; true; ++i) {
    const name2 = `${prefix}${i}`;
    if (!exclude.has(name2))
      return name2;
  }
}
function createNodeAnchors(doc, prefix) {
  const aliasObjects = [];
  const sourceObjects = /* @__PURE__ */ new Map();
  let prevAnchors = null;
  return {
    onAnchor: (source) => {
      aliasObjects.push(source);
      prevAnchors ?? (prevAnchors = anchorNames(doc));
      const anchor = findNewAnchor(prefix, prevAnchors);
      prevAnchors.add(anchor);
      return anchor;
    },
    /**
     * With circular references, the source node is only resolved after all
     * of its child nodes are. This is why anchors are set only after all of
     * the nodes have been created.
     */
    setAnchors: () => {
      for (const source of aliasObjects) {
        const ref = sourceObjects.get(source);
        if (typeof ref === "object" && ref.anchor && (isScalar(ref.node) || isCollection(ref.node))) {
          ref.node.anchor = ref.anchor;
        } else {
          const error = new Error("Failed to resolve repeated object (this should not happen)");
          error.source = source;
          throw error;
        }
      }
    },
    sourceObjects
  };
}

// node_modules/yaml/browser/dist/doc/applyReviver.js
function applyReviver(reviver, obj, key, val) {
  if (val && typeof val === "object") {
    if (Array.isArray(val)) {
      for (let i = 0, len = val.length; i < len; ++i) {
        const v0 = val[i];
        const v1 = applyReviver(reviver, val, String(i), v0);
        if (v1 === void 0)
          delete val[i];
        else if (v1 !== v0)
          val[i] = v1;
      }
    } else if (val instanceof Map) {
      for (const k of Array.from(val.keys())) {
        const v0 = val.get(k);
        const v1 = applyReviver(reviver, val, k, v0);
        if (v1 === void 0)
          val.delete(k);
        else if (v1 !== v0)
          val.set(k, v1);
      }
    } else if (val instanceof Set) {
      for (const v0 of Array.from(val)) {
        const v1 = applyReviver(reviver, val, v0, v0);
        if (v1 === void 0)
          val.delete(v0);
        else if (v1 !== v0) {
          val.delete(v0);
          val.add(v1);
        }
      }
    } else {
      for (const [k, v0] of Object.entries(val)) {
        const v1 = applyReviver(reviver, val, k, v0);
        if (v1 === void 0)
          delete val[k];
        else if (v1 !== v0)
          val[k] = v1;
      }
    }
  }
  return reviver.call(obj, key, val);
}

// node_modules/yaml/browser/dist/nodes/toJS.js
function toJS(value, arg, ctx) {
  if (Array.isArray(value))
    return value.map((v, i) => toJS(v, String(i), ctx));
  if (value && typeof value.toJSON === "function") {
    if (!ctx || !hasAnchor(value))
      return value.toJSON(arg, ctx);
    const data = { aliasCount: 0, count: 1, res: void 0 };
    ctx.anchors.set(value, data);
    ctx.onCreate = (res2) => {
      data.res = res2;
      delete ctx.onCreate;
    };
    const res = value.toJSON(arg, ctx);
    if (ctx.onCreate)
      ctx.onCreate(res);
    return res;
  }
  if (typeof value === "bigint" && !ctx?.keep)
    return Number(value);
  return value;
}

// node_modules/yaml/browser/dist/nodes/Node.js
var NodeBase = class {
  constructor(type) {
    Object.defineProperty(this, NODE_TYPE, { value: type });
  }
  /** Create a copy of this node.  */
  clone() {
    const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
    if (this.range)
      copy.range = this.range.slice();
    return copy;
  }
  /** A plain JavaScript representation of this node. */
  toJS(doc, { mapAsMap, maxAliasCount, onAnchor, reviver } = {}) {
    if (!isDocument(doc))
      throw new TypeError("A document argument is required");
    const ctx = {
      anchors: /* @__PURE__ */ new Map(),
      doc,
      keep: true,
      mapAsMap: mapAsMap === true,
      mapKeyWarned: false,
      maxAliasCount: typeof maxAliasCount === "number" ? maxAliasCount : 100
    };
    const res = toJS(this, "", ctx);
    if (typeof onAnchor === "function")
      for (const { count, res: res2 } of ctx.anchors.values())
        onAnchor(res2, count);
    return typeof reviver === "function" ? applyReviver(reviver, { "": res }, "", res) : res;
  }
};

// node_modules/yaml/browser/dist/nodes/Alias.js
var Alias = class extends NodeBase {
  constructor(source) {
    super(ALIAS);
    this.source = source;
    Object.defineProperty(this, "tag", {
      set() {
        throw new Error("Alias nodes cannot have tags");
      }
    });
  }
  /**
   * Resolve the value of this alias within `doc`, finding the last
   * instance of the `source` anchor before this node.
   */
  resolve(doc, ctx) {
    let nodes;
    if (ctx?.aliasResolveCache) {
      nodes = ctx.aliasResolveCache;
    } else {
      nodes = [];
      visit(doc, {
        Node: (_key, node) => {
          if (isAlias(node) || hasAnchor(node))
            nodes.push(node);
        }
      });
      if (ctx)
        ctx.aliasResolveCache = nodes;
    }
    let found = void 0;
    for (const node of nodes) {
      if (node === this)
        break;
      if (node.anchor === this.source)
        found = node;
    }
    return found;
  }
  toJSON(_arg, ctx) {
    if (!ctx)
      return { source: this.source };
    const { anchors, doc, maxAliasCount } = ctx;
    const source = this.resolve(doc, ctx);
    if (!source) {
      const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
      throw new ReferenceError(msg);
    }
    let data = anchors.get(source);
    if (!data) {
      toJS(source, null, ctx);
      data = anchors.get(source);
    }
    if (!data || data.res === void 0) {
      const msg = "This should not happen: Alias anchor was not resolved?";
      throw new ReferenceError(msg);
    }
    if (maxAliasCount >= 0) {
      data.count += 1;
      if (data.aliasCount === 0)
        data.aliasCount = getAliasCount(doc, source, anchors);
      if (data.count * data.aliasCount > maxAliasCount) {
        const msg = "Excessive alias count indicates a resource exhaustion attack";
        throw new ReferenceError(msg);
      }
    }
    return data.res;
  }
  toString(ctx, _onComment, _onChompKeep) {
    const src = `*${this.source}`;
    if (ctx) {
      anchorIsValid(this.source);
      if (ctx.options.verifyAliasOrder && !ctx.anchors.has(this.source)) {
        const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
        throw new Error(msg);
      }
      if (ctx.implicitKey)
        return `${src} `;
    }
    return src;
  }
};
function getAliasCount(doc, node, anchors) {
  if (isAlias(node)) {
    const source = node.resolve(doc);
    const anchor = anchors && source && anchors.get(source);
    return anchor ? anchor.count * anchor.aliasCount : 0;
  } else if (isCollection(node)) {
    let count = 0;
    for (const item of node.items) {
      const c = getAliasCount(doc, item, anchors);
      if (c > count)
        count = c;
    }
    return count;
  } else if (isPair(node)) {
    const kc = getAliasCount(doc, node.key, anchors);
    const vc2 = getAliasCount(doc, node.value, anchors);
    return Math.max(kc, vc2);
  }
  return 1;
}

// node_modules/yaml/browser/dist/nodes/Scalar.js
var isScalarValue = (value) => !value || typeof value !== "function" && typeof value !== "object";
var Scalar = class extends NodeBase {
  constructor(value) {
    super(SCALAR);
    this.value = value;
  }
  toJSON(arg, ctx) {
    return ctx?.keep ? this.value : toJS(this.value, arg, ctx);
  }
  toString() {
    return String(this.value);
  }
};
Scalar.BLOCK_FOLDED = "BLOCK_FOLDED";
Scalar.BLOCK_LITERAL = "BLOCK_LITERAL";
Scalar.PLAIN = "PLAIN";
Scalar.QUOTE_DOUBLE = "QUOTE_DOUBLE";
Scalar.QUOTE_SINGLE = "QUOTE_SINGLE";

// node_modules/yaml/browser/dist/doc/createNode.js
var defaultTagPrefix = "tag:yaml.org,2002:";
function findTagObject(value, tagName, tags) {
  if (tagName) {
    const match2 = tags.filter((t) => t.tag === tagName);
    const tagObj = match2.find((t) => !t.format) ?? match2[0];
    if (!tagObj)
      throw new Error(`Tag ${tagName} not found`);
    return tagObj;
  }
  return tags.find((t) => t.identify?.(value) && !t.format);
}
function createNode2(value, tagName, ctx) {
  if (isDocument(value))
    value = value.contents;
  if (isNode(value))
    return value;
  if (isPair(value)) {
    const map3 = ctx.schema[MAP].createNode?.(ctx.schema, null, ctx);
    map3.items.push(value);
    return map3;
  }
  if (value instanceof String || value instanceof Number || value instanceof Boolean || typeof BigInt !== "undefined" && value instanceof BigInt) {
    value = value.valueOf();
  }
  const { aliasDuplicateObjects, onAnchor, onTagObj, schema: schema4, sourceObjects } = ctx;
  let ref = void 0;
  if (aliasDuplicateObjects && value && typeof value === "object") {
    ref = sourceObjects.get(value);
    if (ref) {
      ref.anchor ?? (ref.anchor = onAnchor(value));
      return new Alias(ref.anchor);
    } else {
      ref = { anchor: null, node: null };
      sourceObjects.set(value, ref);
    }
  }
  if (tagName?.startsWith("!!"))
    tagName = defaultTagPrefix + tagName.slice(2);
  let tagObj = findTagObject(value, tagName, schema4.tags);
  if (!tagObj) {
    if (value && typeof value.toJSON === "function") {
      value = value.toJSON();
    }
    if (!value || typeof value !== "object") {
      const node2 = new Scalar(value);
      if (ref)
        ref.node = node2;
      return node2;
    }
    tagObj = value instanceof Map ? schema4[MAP] : Symbol.iterator in Object(value) ? schema4[SEQ] : schema4[MAP];
  }
  if (onTagObj) {
    onTagObj(tagObj);
    delete ctx.onTagObj;
  }
  const node = tagObj?.createNode ? tagObj.createNode(ctx.schema, value, ctx) : typeof tagObj?.nodeClass?.from === "function" ? tagObj.nodeClass.from(ctx.schema, value, ctx) : new Scalar(value);
  if (tagName)
    node.tag = tagName;
  else if (!tagObj.default)
    node.tag = tagObj.tag;
  if (ref)
    ref.node = node;
  return node;
}

// node_modules/yaml/browser/dist/nodes/Collection.js
function collectionFromPath(schema4, path, value) {
  let v = value;
  for (let i = path.length - 1; i >= 0; --i) {
    const k = path[i];
    if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
      const a = [];
      a[k] = v;
      v = a;
    } else {
      v = /* @__PURE__ */ new Map([[k, v]]);
    }
  }
  return createNode2(v, void 0, {
    aliasDuplicateObjects: false,
    keepUndefined: false,
    onAnchor: () => {
      throw new Error("This should not happen, please report a bug.");
    },
    schema: schema4,
    sourceObjects: /* @__PURE__ */ new Map()
  });
}
var isEmptyPath = (path) => path == null || typeof path === "object" && !!path[Symbol.iterator]().next().done;
var Collection = class extends NodeBase {
  constructor(type, schema4) {
    super(type);
    Object.defineProperty(this, "schema", {
      value: schema4,
      configurable: true,
      enumerable: false,
      writable: true
    });
  }
  /**
   * Create a copy of this collection.
   *
   * @param schema - If defined, overwrites the original's schema
   */
  clone(schema4) {
    const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
    if (schema4)
      copy.schema = schema4;
    copy.items = copy.items.map((it) => isNode(it) || isPair(it) ? it.clone(schema4) : it);
    if (this.range)
      copy.range = this.range.slice();
    return copy;
  }
  /**
   * Adds a value to the collection. For `!!map` and `!!omap` the value must
   * be a Pair instance or a `{ key, value }` object, which may not have a key
   * that already exists in the map.
   */
  addIn(path, value) {
    if (isEmptyPath(path))
      this.add(value);
    else {
      const [key, ...rest] = path;
      const node = this.get(key, true);
      if (isCollection(node))
        node.addIn(rest, value);
      else if (node === void 0 && this.schema)
        this.set(key, collectionFromPath(this.schema, rest, value));
      else
        throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
    }
  }
  /**
   * Removes a value from the collection.
   * @returns `true` if the item was found and removed.
   */
  deleteIn(path) {
    const [key, ...rest] = path;
    if (rest.length === 0)
      return this.delete(key);
    const node = this.get(key, true);
    if (isCollection(node))
      return node.deleteIn(rest);
    else
      throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
  }
  /**
   * Returns item at `key`, or `undefined` if not found. By default unwraps
   * scalar values from their surrounding node; to disable set `keepScalar` to
   * `true` (collections are always returned intact).
   */
  getIn(path, keepScalar) {
    const [key, ...rest] = path;
    const node = this.get(key, true);
    if (rest.length === 0)
      return !keepScalar && isScalar(node) ? node.value : node;
    else
      return isCollection(node) ? node.getIn(rest, keepScalar) : void 0;
  }
  hasAllNullValues(allowScalar) {
    return this.items.every((node) => {
      if (!isPair(node))
        return false;
      const n = node.value;
      return n == null || allowScalar && isScalar(n) && n.value == null && !n.commentBefore && !n.comment && !n.tag;
    });
  }
  /**
   * Checks if the collection includes a value with the key `key`.
   */
  hasIn(path) {
    const [key, ...rest] = path;
    if (rest.length === 0)
      return this.has(key);
    const node = this.get(key, true);
    return isCollection(node) ? node.hasIn(rest) : false;
  }
  /**
   * Sets a value in this collection. For `!!set`, `value` needs to be a
   * boolean to add/remove the item from the set.
   */
  setIn(path, value) {
    const [key, ...rest] = path;
    if (rest.length === 0) {
      this.set(key, value);
    } else {
      const node = this.get(key, true);
      if (isCollection(node))
        node.setIn(rest, value);
      else if (node === void 0 && this.schema)
        this.set(key, collectionFromPath(this.schema, rest, value));
      else
        throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
    }
  }
};

// node_modules/yaml/browser/dist/stringify/stringifyComment.js
var stringifyComment = (str) => str.replace(/^(?!$)(?: $)?/gm, "#");
function indentComment(comment, indent) {
  if (/^\n+$/.test(comment))
    return comment.substring(1);
  return indent ? comment.replace(/^(?! *$)/gm, indent) : comment;
}
var lineComment = (str, indent, comment) => str.endsWith("\n") ? indentComment(comment, indent) : comment.includes("\n") ? "\n" + indentComment(comment, indent) : (str.endsWith(" ") ? "" : " ") + comment;

// node_modules/yaml/browser/dist/stringify/foldFlowLines.js
var FOLD_FLOW = "flow";
var FOLD_BLOCK = "block";
var FOLD_QUOTED = "quoted";
function foldFlowLines(text, indent, mode = "flow", { indentAtStart, lineWidth = 80, minContentWidth = 20, onFold, onOverflow } = {}) {
  if (!lineWidth || lineWidth < 0)
    return text;
  if (lineWidth < minContentWidth)
    minContentWidth = 0;
  const endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length);
  if (text.length <= endStep)
    return text;
  const folds = [];
  const escapedFolds = {};
  let end = lineWidth - indent.length;
  if (typeof indentAtStart === "number") {
    if (indentAtStart > lineWidth - Math.max(2, minContentWidth))
      folds.push(0);
    else
      end = lineWidth - indentAtStart;
  }
  let split2 = void 0;
  let prev = void 0;
  let overflow = false;
  let i = -1;
  let escStart = -1;
  let escEnd = -1;
  if (mode === FOLD_BLOCK) {
    i = consumeMoreIndentedLines(text, i, indent.length);
    if (i !== -1)
      end = i + endStep;
  }
  for (let ch; ch = text[i += 1]; ) {
    if (mode === FOLD_QUOTED && ch === "\\") {
      escStart = i;
      switch (text[i + 1]) {
        case "x":
          i += 3;
          break;
        case "u":
          i += 5;
          break;
        case "U":
          i += 9;
          break;
        default:
          i += 1;
      }
      escEnd = i;
    }
    if (ch === "\n") {
      if (mode === FOLD_BLOCK)
        i = consumeMoreIndentedLines(text, i, indent.length);
      end = i + indent.length + endStep;
      split2 = void 0;
    } else {
      if (ch === " " && prev && prev !== " " && prev !== "\n" && prev !== "	") {
        const next = text[i + 1];
        if (next && next !== " " && next !== "\n" && next !== "	")
          split2 = i;
      }
      if (i >= end) {
        if (split2) {
          folds.push(split2);
          end = split2 + endStep;
          split2 = void 0;
        } else if (mode === FOLD_QUOTED) {
          while (prev === " " || prev === "	") {
            prev = ch;
            ch = text[i += 1];
            overflow = true;
          }
          const j = i > escEnd + 1 ? i - 2 : escStart - 1;
          if (escapedFolds[j])
            return text;
          folds.push(j);
          escapedFolds[j] = true;
          end = j + endStep;
          split2 = void 0;
        } else {
          overflow = true;
        }
      }
    }
    prev = ch;
  }
  if (overflow && onOverflow)
    onOverflow();
  if (folds.length === 0)
    return text;
  if (onFold)
    onFold();
  let res = text.slice(0, folds[0]);
  for (let i2 = 0; i2 < folds.length; ++i2) {
    const fold = folds[i2];
    const end2 = folds[i2 + 1] || text.length;
    if (fold === 0)
      res = `
${indent}${text.slice(0, end2)}`;
    else {
      if (mode === FOLD_QUOTED && escapedFolds[fold])
        res += `${text[fold]}\\`;
      res += `
${indent}${text.slice(fold + 1, end2)}`;
    }
  }
  return res;
}
function consumeMoreIndentedLines(text, i, indent) {
  let end = i;
  let start = i + 1;
  let ch = text[start];
  while (ch === " " || ch === "	") {
    if (i < start + indent) {
      ch = text[++i];
    } else {
      do {
        ch = text[++i];
      } while (ch && ch !== "\n");
      end = i;
      start = i + 1;
      ch = text[start];
    }
  }
  return end;
}

// node_modules/yaml/browser/dist/stringify/stringifyString.js
var getFoldOptions = (ctx, isBlock) => ({
  indentAtStart: isBlock ? ctx.indent.length : ctx.indentAtStart,
  lineWidth: ctx.options.lineWidth,
  minContentWidth: ctx.options.minContentWidth
});
var containsDocumentMarker = (str) => /^(%|---|\.\.\.)/m.test(str);
function lineLengthOverLimit(str, lineWidth, indentLength) {
  if (!lineWidth || lineWidth < 0)
    return false;
  const limit = lineWidth - indentLength;
  const strLen = str.length;
  if (strLen <= limit)
    return false;
  for (let i = 0, start = 0; i < strLen; ++i) {
    if (str[i] === "\n") {
      if (i - start > limit)
        return true;
      start = i + 1;
      if (strLen - start <= limit)
        return false;
    }
  }
  return true;
}
function doubleQuotedString(value, ctx) {
  const json = JSON.stringify(value);
  if (ctx.options.doubleQuotedAsJSON)
    return json;
  const { implicitKey } = ctx;
  const minMultiLineLength = ctx.options.doubleQuotedMinMultiLineLength;
  const indent = ctx.indent || (containsDocumentMarker(value) ? "  " : "");
  let str = "";
  let start = 0;
  for (let i = 0, ch = json[i]; ch; ch = json[++i]) {
    if (ch === " " && json[i + 1] === "\\" && json[i + 2] === "n") {
      str += json.slice(start, i) + "\\ ";
      i += 1;
      start = i;
      ch = "\\";
    }
    if (ch === "\\")
      switch (json[i + 1]) {
        case "u":
          {
            str += json.slice(start, i);
            const code = json.substr(i + 2, 4);
            switch (code) {
              case "0000":
                str += "\\0";
                break;
              case "0007":
                str += "\\a";
                break;
              case "000b":
                str += "\\v";
                break;
              case "001b":
                str += "\\e";
                break;
              case "0085":
                str += "\\N";
                break;
              case "00a0":
                str += "\\_";
                break;
              case "2028":
                str += "\\L";
                break;
              case "2029":
                str += "\\P";
                break;
              default:
                if (code.substr(0, 2) === "00")
                  str += "\\x" + code.substr(2);
                else
                  str += json.substr(i, 6);
            }
            i += 5;
            start = i + 1;
          }
          break;
        case "n":
          if (implicitKey || json[i + 2] === '"' || json.length < minMultiLineLength) {
            i += 1;
          } else {
            str += json.slice(start, i) + "\n\n";
            while (json[i + 2] === "\\" && json[i + 3] === "n" && json[i + 4] !== '"') {
              str += "\n";
              i += 2;
            }
            str += indent;
            if (json[i + 2] === " ")
              str += "\\";
            i += 1;
            start = i + 1;
          }
          break;
        default:
          i += 1;
      }
  }
  str = start ? str + json.slice(start) : json;
  return implicitKey ? str : foldFlowLines(str, indent, FOLD_QUOTED, getFoldOptions(ctx, false));
}
function singleQuotedString(value, ctx) {
  if (ctx.options.singleQuote === false || ctx.implicitKey && value.includes("\n") || /[ \t]\n|\n[ \t]/.test(value))
    return doubleQuotedString(value, ctx);
  const indent = ctx.indent || (containsDocumentMarker(value) ? "  " : "");
  const res = "'" + value.replace(/'/g, "''").replace(/\n+/g, `$&
${indent}`) + "'";
  return ctx.implicitKey ? res : foldFlowLines(res, indent, FOLD_FLOW, getFoldOptions(ctx, false));
}
function quotedString(value, ctx) {
  const { singleQuote } = ctx.options;
  let qs2;
  if (singleQuote === false)
    qs2 = doubleQuotedString;
  else {
    const hasDouble = value.includes('"');
    const hasSingle = value.includes("'");
    if (hasDouble && !hasSingle)
      qs2 = singleQuotedString;
    else if (hasSingle && !hasDouble)
      qs2 = doubleQuotedString;
    else
      qs2 = singleQuote ? singleQuotedString : doubleQuotedString;
  }
  return qs2(value, ctx);
}
var blockEndNewlines;
try {
  blockEndNewlines = new RegExp("(^|(?<!\n))\n+(?!\n|$)", "g");
} catch {
  blockEndNewlines = /\n+(?!\n|$)/g;
}
function blockString({ comment, type, value }, ctx, onComment, onChompKeep) {
  const { blockQuote, commentString, lineWidth } = ctx.options;
  if (!blockQuote || /\n[\t ]+$/.test(value)) {
    return quotedString(value, ctx);
  }
  const indent = ctx.indent || (ctx.forceBlockIndent || containsDocumentMarker(value) ? "  " : "");
  const literal = blockQuote === "literal" ? true : blockQuote === "folded" || type === Scalar.BLOCK_FOLDED ? false : type === Scalar.BLOCK_LITERAL ? true : !lineLengthOverLimit(value, lineWidth, indent.length);
  if (!value)
    return literal ? "|\n" : ">\n";
  let chomp;
  let endStart;
  for (endStart = value.length; endStart > 0; --endStart) {
    const ch = value[endStart - 1];
    if (ch !== "\n" && ch !== "	" && ch !== " ")
      break;
  }
  let end = value.substring(endStart);
  const endNlPos = end.indexOf("\n");
  if (endNlPos === -1) {
    chomp = "-";
  } else if (value === end || endNlPos !== end.length - 1) {
    chomp = "+";
    if (onChompKeep)
      onChompKeep();
  } else {
    chomp = "";
  }
  if (end) {
    value = value.slice(0, -end.length);
    if (end[end.length - 1] === "\n")
      end = end.slice(0, -1);
    end = end.replace(blockEndNewlines, `$&${indent}`);
  }
  let startWithSpace = false;
  let startEnd;
  let startNlPos = -1;
  for (startEnd = 0; startEnd < value.length; ++startEnd) {
    const ch = value[startEnd];
    if (ch === " ")
      startWithSpace = true;
    else if (ch === "\n")
      startNlPos = startEnd;
    else
      break;
  }
  let start = value.substring(0, startNlPos < startEnd ? startNlPos + 1 : startEnd);
  if (start) {
    value = value.substring(start.length);
    start = start.replace(/\n+/g, `$&${indent}`);
  }
  const indentSize = indent ? "2" : "1";
  let header = (startWithSpace ? indentSize : "") + chomp;
  if (comment) {
    header += " " + commentString(comment.replace(/ ?[\r\n]+/g, " "));
    if (onComment)
      onComment();
  }
  if (!literal) {
    const foldedValue = value.replace(/\n+/g, "\n$&").replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/\n+/g, `$&${indent}`);
    let literalFallback = false;
    const foldOptions = getFoldOptions(ctx, true);
    if (blockQuote !== "folded" && type !== Scalar.BLOCK_FOLDED) {
      foldOptions.onOverflow = () => {
        literalFallback = true;
      };
    }
    const body = foldFlowLines(`${start}${foldedValue}${end}`, indent, FOLD_BLOCK, foldOptions);
    if (!literalFallback)
      return `>${header}
${indent}${body}`;
  }
  value = value.replace(/\n+/g, `$&${indent}`);
  return `|${header}
${indent}${start}${value}${end}`;
}
function plainString(item, ctx, onComment, onChompKeep) {
  const { type, value } = item;
  const { actualString, implicitKey, indent, indentStep, inFlow } = ctx;
  if (implicitKey && value.includes("\n") || inFlow && /[[\]{},]/.test(value)) {
    return quotedString(value, ctx);
  }
  if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
    return implicitKey || inFlow || !value.includes("\n") ? quotedString(value, ctx) : blockString(item, ctx, onComment, onChompKeep);
  }
  if (!implicitKey && !inFlow && type !== Scalar.PLAIN && value.includes("\n")) {
    return blockString(item, ctx, onComment, onChompKeep);
  }
  if (containsDocumentMarker(value)) {
    if (indent === "") {
      ctx.forceBlockIndent = true;
      return blockString(item, ctx, onComment, onChompKeep);
    } else if (implicitKey && indent === indentStep) {
      return quotedString(value, ctx);
    }
  }
  const str = value.replace(/\n+/g, `$&
${indent}`);
  if (actualString) {
    const test = (tag) => tag.default && tag.tag !== "tag:yaml.org,2002:str" && tag.test?.test(str);
    const { compat, tags } = ctx.doc.schema;
    if (tags.some(test) || compat?.some(test))
      return quotedString(value, ctx);
  }
  return implicitKey ? str : foldFlowLines(str, indent, FOLD_FLOW, getFoldOptions(ctx, false));
}
function stringifyString(item, ctx, onComment, onChompKeep) {
  const { implicitKey, inFlow } = ctx;
  const ss = typeof item.value === "string" ? item : Object.assign({}, item, { value: String(item.value) });
  let { type } = item;
  if (type !== Scalar.QUOTE_DOUBLE) {
    if (/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(ss.value))
      type = Scalar.QUOTE_DOUBLE;
  }
  const _stringify = (_type) => {
    switch (_type) {
      case Scalar.BLOCK_FOLDED:
      case Scalar.BLOCK_LITERAL:
        return implicitKey || inFlow ? quotedString(ss.value, ctx) : blockString(ss, ctx, onComment, onChompKeep);
      case Scalar.QUOTE_DOUBLE:
        return doubleQuotedString(ss.value, ctx);
      case Scalar.QUOTE_SINGLE:
        return singleQuotedString(ss.value, ctx);
      case Scalar.PLAIN:
        return plainString(ss, ctx, onComment, onChompKeep);
      default:
        return null;
    }
  };
  let res = _stringify(type);
  if (res === null) {
    const { defaultKeyType, defaultStringType } = ctx.options;
    const t = implicitKey && defaultKeyType || defaultStringType;
    res = _stringify(t);
    if (res === null)
      throw new Error(`Unsupported default string type ${t}`);
  }
  return res;
}

// node_modules/yaml/browser/dist/stringify/stringify.js
function createStringifyContext(doc, options) {
  const opt2 = Object.assign({
    blockQuote: true,
    commentString: stringifyComment,
    defaultKeyType: null,
    defaultStringType: "PLAIN",
    directives: null,
    doubleQuotedAsJSON: false,
    doubleQuotedMinMultiLineLength: 40,
    falseStr: "false",
    flowCollectionPadding: true,
    indentSeq: true,
    lineWidth: 80,
    minContentWidth: 20,
    nullStr: "null",
    simpleKeys: false,
    singleQuote: null,
    trueStr: "true",
    verifyAliasOrder: true
  }, doc.schema.toStringOptions, options);
  let inFlow;
  switch (opt2.collectionStyle) {
    case "block":
      inFlow = false;
      break;
    case "flow":
      inFlow = true;
      break;
    default:
      inFlow = null;
  }
  return {
    anchors: /* @__PURE__ */ new Set(),
    doc,
    flowCollectionPadding: opt2.flowCollectionPadding ? " " : "",
    indent: "",
    indentStep: typeof opt2.indent === "number" ? " ".repeat(opt2.indent) : "  ",
    inFlow,
    options: opt2
  };
}
function getTagObject(tags, item) {
  if (item.tag) {
    const match2 = tags.filter((t) => t.tag === item.tag);
    if (match2.length > 0)
      return match2.find((t) => t.format === item.format) ?? match2[0];
  }
  let tagObj = void 0;
  let obj;
  if (isScalar(item)) {
    obj = item.value;
    let match2 = tags.filter((t) => t.identify?.(obj));
    if (match2.length > 1) {
      const testMatch = match2.filter((t) => t.test);
      if (testMatch.length > 0)
        match2 = testMatch;
    }
    tagObj = match2.find((t) => t.format === item.format) ?? match2.find((t) => !t.format);
  } else {
    obj = item;
    tagObj = tags.find((t) => t.nodeClass && obj instanceof t.nodeClass);
  }
  if (!tagObj) {
    const name2 = obj?.constructor?.name ?? (obj === null ? "null" : typeof obj);
    throw new Error(`Tag not resolved for ${name2} value`);
  }
  return tagObj;
}
function stringifyProps(node, tagObj, { anchors, doc }) {
  if (!doc.directives)
    return "";
  const props = [];
  const anchor = (isScalar(node) || isCollection(node)) && node.anchor;
  if (anchor && anchorIsValid(anchor)) {
    anchors.add(anchor);
    props.push(`&${anchor}`);
  }
  const tag = node.tag ?? (tagObj.default ? null : tagObj.tag);
  if (tag)
    props.push(doc.directives.tagString(tag));
  return props.join(" ");
}
function stringify3(item, ctx, onComment, onChompKeep) {
  if (isPair(item))
    return item.toString(ctx, onComment, onChompKeep);
  if (isAlias(item)) {
    if (ctx.doc.directives)
      return item.toString(ctx);
    if (ctx.resolvedAliases?.has(item)) {
      throw new TypeError(`Cannot stringify circular structure without alias nodes`);
    } else {
      if (ctx.resolvedAliases)
        ctx.resolvedAliases.add(item);
      else
        ctx.resolvedAliases = /* @__PURE__ */ new Set([item]);
      item = item.resolve(ctx.doc);
    }
  }
  let tagObj = void 0;
  const node = isNode(item) ? item : ctx.doc.createNode(item, { onTagObj: (o) => tagObj = o });
  tagObj ?? (tagObj = getTagObject(ctx.doc.schema.tags, node));
  const props = stringifyProps(node, tagObj, ctx);
  if (props.length > 0)
    ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;
  const str = typeof tagObj.stringify === "function" ? tagObj.stringify(node, ctx, onComment, onChompKeep) : isScalar(node) ? stringifyString(node, ctx, onComment, onChompKeep) : node.toString(ctx, onComment, onChompKeep);
  if (!props)
    return str;
  return isScalar(node) || str[0] === "{" || str[0] === "[" ? `${props} ${str}` : `${props}
${ctx.indent}${str}`;
}

// node_modules/yaml/browser/dist/stringify/stringifyPair.js
function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
  const { allNullValues, doc, indent, indentStep, options: { commentString, indentSeq, simpleKeys } } = ctx;
  let keyComment = isNode(key) && key.comment || null;
  if (simpleKeys) {
    if (keyComment) {
      throw new Error("With simple keys, key nodes cannot have comments");
    }
    if (isCollection(key) || !isNode(key) && typeof key === "object") {
      const msg = "With simple keys, collection cannot be used as a key value";
      throw new Error(msg);
    }
  }
  let explicitKey = !simpleKeys && (!key || keyComment && value == null && !ctx.inFlow || isCollection(key) || (isScalar(key) ? key.type === Scalar.BLOCK_FOLDED || key.type === Scalar.BLOCK_LITERAL : typeof key === "object"));
  ctx = Object.assign({}, ctx, {
    allNullValues: false,
    implicitKey: !explicitKey && (simpleKeys || !allNullValues),
    indent: indent + indentStep
  });
  let keyCommentDone = false;
  let chompKeep = false;
  let str = stringify3(key, ctx, () => keyCommentDone = true, () => chompKeep = true);
  if (!explicitKey && !ctx.inFlow && str.length > 1024) {
    if (simpleKeys)
      throw new Error("With simple keys, single line scalar must not span more than 1024 characters");
    explicitKey = true;
  }
  if (ctx.inFlow) {
    if (allNullValues || value == null) {
      if (keyCommentDone && onComment)
        onComment();
      return str === "" ? "?" : explicitKey ? `? ${str}` : str;
    }
  } else if (allNullValues && !simpleKeys || value == null && explicitKey) {
    str = `? ${str}`;
    if (keyComment && !keyCommentDone) {
      str += lineComment(str, ctx.indent, commentString(keyComment));
    } else if (chompKeep && onChompKeep)
      onChompKeep();
    return str;
  }
  if (keyCommentDone)
    keyComment = null;
  if (explicitKey) {
    if (keyComment)
      str += lineComment(str, ctx.indent, commentString(keyComment));
    str = `? ${str}
${indent}:`;
  } else {
    str = `${str}:`;
    if (keyComment)
      str += lineComment(str, ctx.indent, commentString(keyComment));
  }
  let vsb, vcb, valueComment;
  if (isNode(value)) {
    vsb = !!value.spaceBefore;
    vcb = value.commentBefore;
    valueComment = value.comment;
  } else {
    vsb = false;
    vcb = null;
    valueComment = null;
    if (value && typeof value === "object")
      value = doc.createNode(value);
  }
  ctx.implicitKey = false;
  if (!explicitKey && !keyComment && isScalar(value))
    ctx.indentAtStart = str.length + 1;
  chompKeep = false;
  if (!indentSeq && indentStep.length >= 2 && !ctx.inFlow && !explicitKey && isSeq(value) && !value.flow && !value.tag && !value.anchor) {
    ctx.indent = ctx.indent.substring(2);
  }
  let valueCommentDone = false;
  const valueStr = stringify3(value, ctx, () => valueCommentDone = true, () => chompKeep = true);
  let ws = " ";
  if (keyComment || vsb || vcb) {
    ws = vsb ? "\n" : "";
    if (vcb) {
      const cs = commentString(vcb);
      ws += `
${indentComment(cs, ctx.indent)}`;
    }
    if (valueStr === "" && !ctx.inFlow) {
      if (ws === "\n")
        ws = "\n\n";
    } else {
      ws += `
${ctx.indent}`;
    }
  } else if (!explicitKey && isCollection(value)) {
    const vs0 = valueStr[0];
    const nl0 = valueStr.indexOf("\n");
    const hasNewline = nl0 !== -1;
    const flow = ctx.inFlow ?? value.flow ?? value.items.length === 0;
    if (hasNewline || !flow) {
      let hasPropsLine = false;
      if (hasNewline && (vs0 === "&" || vs0 === "!")) {
        let sp0 = valueStr.indexOf(" ");
        if (vs0 === "&" && sp0 !== -1 && sp0 < nl0 && valueStr[sp0 + 1] === "!") {
          sp0 = valueStr.indexOf(" ", sp0 + 1);
        }
        if (sp0 === -1 || nl0 < sp0)
          hasPropsLine = true;
      }
      if (!hasPropsLine)
        ws = `
${ctx.indent}`;
    }
  } else if (valueStr === "" || valueStr[0] === "\n") {
    ws = "";
  }
  str += ws + valueStr;
  if (ctx.inFlow) {
    if (valueCommentDone && onComment)
      onComment();
  } else if (valueComment && !valueCommentDone) {
    str += lineComment(str, ctx.indent, commentString(valueComment));
  } else if (chompKeep && onChompKeep) {
    onChompKeep();
  }
  return str;
}

// node_modules/yaml/browser/dist/log.js
function warn(logLevel, warning) {
  if (logLevel === "debug" || logLevel === "warn") {
    console.warn(warning);
  }
}

// node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js
var MERGE_KEY = "<<";
var merge3 = {
  identify: (value) => value === MERGE_KEY || typeof value === "symbol" && value.description === MERGE_KEY,
  default: "key",
  tag: "tag:yaml.org,2002:merge",
  test: /^<<$/,
  resolve: () => Object.assign(new Scalar(Symbol(MERGE_KEY)), {
    addToJSMap: addMergeToJSMap
  }),
  stringify: () => MERGE_KEY
};
var isMergeKey = (ctx, key) => (merge3.identify(key) || isScalar(key) && (!key.type || key.type === Scalar.PLAIN) && merge3.identify(key.value)) && ctx?.doc.schema.tags.some((tag) => tag.tag === merge3.tag && tag.default);
function addMergeToJSMap(ctx, map3, value) {
  value = ctx && isAlias(value) ? value.resolve(ctx.doc) : value;
  if (isSeq(value))
    for (const it of value.items)
      mergeValue(ctx, map3, it);
  else if (Array.isArray(value))
    for (const it of value)
      mergeValue(ctx, map3, it);
  else
    mergeValue(ctx, map3, value);
}
function mergeValue(ctx, map3, value) {
  const source = ctx && isAlias(value) ? value.resolve(ctx.doc) : value;
  if (!isMap(source))
    throw new Error("Merge sources must be maps or map aliases");
  const srcMap = source.toJSON(null, ctx, Map);
  for (const [key, value2] of srcMap) {
    if (map3 instanceof Map) {
      if (!map3.has(key))
        map3.set(key, value2);
    } else if (map3 instanceof Set) {
      map3.add(key);
    } else if (!Object.prototype.hasOwnProperty.call(map3, key)) {
      Object.defineProperty(map3, key, {
        value: value2,
        writable: true,
        enumerable: true,
        configurable: true
      });
    }
  }
  return map3;
}

// node_modules/yaml/browser/dist/nodes/addPairToJSMap.js
function addPairToJSMap(ctx, map3, { key, value }) {
  if (isNode(key) && key.addToJSMap)
    key.addToJSMap(ctx, map3, value);
  else if (isMergeKey(ctx, key))
    addMergeToJSMap(ctx, map3, value);
  else {
    const jsKey = toJS(key, "", ctx);
    if (map3 instanceof Map) {
      map3.set(jsKey, toJS(value, jsKey, ctx));
    } else if (map3 instanceof Set) {
      map3.add(jsKey);
    } else {
      const stringKey = stringifyKey(key, jsKey, ctx);
      const jsValue = toJS(value, stringKey, ctx);
      if (stringKey in map3)
        Object.defineProperty(map3, stringKey, {
          value: jsValue,
          writable: true,
          enumerable: true,
          configurable: true
        });
      else
        map3[stringKey] = jsValue;
    }
  }
  return map3;
}
function stringifyKey(key, jsKey, ctx) {
  if (jsKey === null)
    return "";
  if (typeof jsKey !== "object")
    return String(jsKey);
  if (isNode(key) && ctx?.doc) {
    const strCtx = createStringifyContext(ctx.doc, {});
    strCtx.anchors = /* @__PURE__ */ new Set();
    for (const node of ctx.anchors.keys())
      strCtx.anchors.add(node.anchor);
    strCtx.inFlow = true;
    strCtx.inStringifyKey = true;
    const strKey = key.toString(strCtx);
    if (!ctx.mapKeyWarned) {
      let jsonStr = JSON.stringify(strKey);
      if (jsonStr.length > 40)
        jsonStr = jsonStr.substring(0, 36) + '..."';
      warn(ctx.doc.options.logLevel, `Keys with collection values will be stringified due to JS Object restrictions: ${jsonStr}. Set mapAsMap: true to use object keys.`);
      ctx.mapKeyWarned = true;
    }
    return strKey;
  }
  return JSON.stringify(jsKey);
}

// node_modules/yaml/browser/dist/nodes/Pair.js
function createPair(key, value, ctx) {
  const k = createNode2(key, void 0, ctx);
  const v = createNode2(value, void 0, ctx);
  return new Pair2(k, v);
}
var Pair2 = class _Pair {
  constructor(key, value = null) {
    Object.defineProperty(this, NODE_TYPE, { value: PAIR });
    this.key = key;
    this.value = value;
  }
  clone(schema4) {
    let { key, value } = this;
    if (isNode(key))
      key = key.clone(schema4);
    if (isNode(value))
      value = value.clone(schema4);
    return new _Pair(key, value);
  }
  toJSON(_4, ctx) {
    const pair = ctx?.mapAsMap ? /* @__PURE__ */ new Map() : {};
    return addPairToJSMap(ctx, pair, this);
  }
  toString(ctx, onComment, onChompKeep) {
    return ctx?.doc ? stringifyPair(this, ctx, onComment, onChompKeep) : JSON.stringify(this);
  }
};

// node_modules/yaml/browser/dist/stringify/stringifyCollection.js
function stringifyCollection(collection, ctx, options) {
  const flow = ctx.inFlow ?? collection.flow;
  const stringify6 = flow ? stringifyFlowCollection : stringifyBlockCollection;
  return stringify6(collection, ctx, options);
}
function stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, flowChars, itemIndent, onChompKeep, onComment }) {
  const { indent, options: { commentString } } = ctx;
  const itemCtx = Object.assign({}, ctx, { indent: itemIndent, type: null });
  let chompKeep = false;
  const lines = [];
  for (let i = 0; i < items.length; ++i) {
    const item = items[i];
    let comment2 = null;
    if (isNode(item)) {
      if (!chompKeep && item.spaceBefore)
        lines.push("");
      addCommentBefore(ctx, lines, item.commentBefore, chompKeep);
      if (item.comment)
        comment2 = item.comment;
    } else if (isPair(item)) {
      const ik = isNode(item.key) ? item.key : null;
      if (ik) {
        if (!chompKeep && ik.spaceBefore)
          lines.push("");
        addCommentBefore(ctx, lines, ik.commentBefore, chompKeep);
      }
    }
    chompKeep = false;
    let str2 = stringify3(item, itemCtx, () => comment2 = null, () => chompKeep = true);
    if (comment2)
      str2 += lineComment(str2, itemIndent, commentString(comment2));
    if (chompKeep && comment2)
      chompKeep = false;
    lines.push(blockItemPrefix + str2);
  }
  let str;
  if (lines.length === 0) {
    str = flowChars.start + flowChars.end;
  } else {
    str = lines[0];
    for (let i = 1; i < lines.length; ++i) {
      const line = lines[i];
      str += line ? `
${indent}${line}` : "\n";
    }
  }
  if (comment) {
    str += "\n" + indentComment(commentString(comment), indent);
    if (onComment)
      onComment();
  } else if (chompKeep && onChompKeep)
    onChompKeep();
  return str;
}
function stringifyFlowCollection({ items }, ctx, { flowChars, itemIndent }) {
  const { indent, indentStep, flowCollectionPadding: fcPadding, options: { commentString } } = ctx;
  itemIndent += indentStep;
  const itemCtx = Object.assign({}, ctx, {
    indent: itemIndent,
    inFlow: true,
    type: null
  });
  let reqNewline = false;
  let linesAtValue = 0;
  const lines = [];
  for (let i = 0; i < items.length; ++i) {
    const item = items[i];
    let comment = null;
    if (isNode(item)) {
      if (item.spaceBefore)
        lines.push("");
      addCommentBefore(ctx, lines, item.commentBefore, false);
      if (item.comment)
        comment = item.comment;
    } else if (isPair(item)) {
      const ik = isNode(item.key) ? item.key : null;
      if (ik) {
        if (ik.spaceBefore)
          lines.push("");
        addCommentBefore(ctx, lines, ik.commentBefore, false);
        if (ik.comment)
          reqNewline = true;
      }
      const iv = isNode(item.value) ? item.value : null;
      if (iv) {
        if (iv.comment)
          comment = iv.comment;
        if (iv.commentBefore)
          reqNewline = true;
      } else if (item.value == null && ik?.comment) {
        comment = ik.comment;
      }
    }
    if (comment)
      reqNewline = true;
    let str = stringify3(item, itemCtx, () => comment = null);
    if (i < items.length - 1)
      str += ",";
    if (comment)
      str += lineComment(str, itemIndent, commentString(comment));
    if (!reqNewline && (lines.length > linesAtValue || str.includes("\n")))
      reqNewline = true;
    lines.push(str);
    linesAtValue = lines.length;
  }
  const { start, end } = flowChars;
  if (lines.length === 0) {
    return start + end;
  } else {
    if (!reqNewline) {
      const len = lines.reduce((sum, line) => sum + line.length + 2, 2);
      reqNewline = ctx.options.lineWidth > 0 && len > ctx.options.lineWidth;
    }
    if (reqNewline) {
      let str = start;
      for (const line of lines)
        str += line ? `
${indentStep}${indent}${line}` : "\n";
      return `${str}
${indent}${end}`;
    } else {
      return `${start}${fcPadding}${lines.join(" ")}${fcPadding}${end}`;
    }
  }
}
function addCommentBefore({ indent, options: { commentString } }, lines, comment, chompKeep) {
  if (comment && chompKeep)
    comment = comment.replace(/^\n+/, "");
  if (comment) {
    const ic = indentComment(commentString(comment), indent);
    lines.push(ic.trimStart());
  }
}

// node_modules/yaml/browser/dist/nodes/YAMLMap.js
function findPair(items, key) {
  const k = isScalar(key) ? key.value : key;
  for (const it of items) {
    if (isPair(it)) {
      if (it.key === key || it.key === k)
        return it;
      if (isScalar(it.key) && it.key.value === k)
        return it;
    }
  }
  return void 0;
}
var YAMLMap = class extends Collection {
  static get tagName() {
    return "tag:yaml.org,2002:map";
  }
  constructor(schema4) {
    super(MAP, schema4);
    this.items = [];
  }
  /**
   * A generic collection parsing method that can be extended
   * to other node classes that inherit from YAMLMap
   */
  static from(schema4, obj, ctx) {
    const { keepUndefined, replacer } = ctx;
    const map3 = new this(schema4);
    const add = (key, value) => {
      if (typeof replacer === "function")
        value = replacer.call(obj, key, value);
      else if (Array.isArray(replacer) && !replacer.includes(key))
        return;
      if (value !== void 0 || keepUndefined)
        map3.items.push(createPair(key, value, ctx));
    };
    if (obj instanceof Map) {
      for (const [key, value] of obj)
        add(key, value);
    } else if (obj && typeof obj === "object") {
      for (const key of Object.keys(obj))
        add(key, obj[key]);
    }
    if (typeof schema4.sortMapEntries === "function") {
      map3.items.sort(schema4.sortMapEntries);
    }
    return map3;
  }
  /**
   * Adds a value to the collection.
   *
   * @param overwrite - If not set `true`, using a key that is already in the
   *   collection will throw. Otherwise, overwrites the previous value.
   */
  add(pair, overwrite) {
    let _pair;
    if (isPair(pair))
      _pair = pair;
    else if (!pair || typeof pair !== "object" || !("key" in pair)) {
      _pair = new Pair2(pair, pair?.value);
    } else
      _pair = new Pair2(pair.key, pair.value);
    const prev = findPair(this.items, _pair.key);
    const sortEntries = this.schema?.sortMapEntries;
    if (prev) {
      if (!overwrite)
        throw new Error(`Key ${_pair.key} already set`);
      if (isScalar(prev.value) && isScalarValue(_pair.value))
        prev.value.value = _pair.value;
      else
        prev.value = _pair.value;
    } else if (sortEntries) {
      const i = this.items.findIndex((item) => sortEntries(_pair, item) < 0);
      if (i === -1)
        this.items.push(_pair);
      else
        this.items.splice(i, 0, _pair);
    } else {
      this.items.push(_pair);
    }
  }
  delete(key) {
    const it = findPair(this.items, key);
    if (!it)
      return false;
    const del = this.items.splice(this.items.indexOf(it), 1);
    return del.length > 0;
  }
  get(key, keepScalar) {
    const it = findPair(this.items, key);
    const node = it?.value;
    return (!keepScalar && isScalar(node) ? node.value : node) ?? void 0;
  }
  has(key) {
    return !!findPair(this.items, key);
  }
  set(key, value) {
    this.add(new Pair2(key, value), true);
  }
  /**
   * @param ctx - Conversion context, originally set in Document#toJS()
   * @param {Class} Type - If set, forces the returned collection type
   * @returns Instance of Type, Map, or Object
   */
  toJSON(_4, ctx, Type2) {
    const map3 = Type2 ? new Type2() : ctx?.mapAsMap ? /* @__PURE__ */ new Map() : {};
    if (ctx?.onCreate)
      ctx.onCreate(map3);
    for (const item of this.items)
      addPairToJSMap(ctx, map3, item);
    return map3;
  }
  toString(ctx, onComment, onChompKeep) {
    if (!ctx)
      return JSON.stringify(this);
    for (const item of this.items) {
      if (!isPair(item))
        throw new Error(`Map items must all be pairs; found ${JSON.stringify(item)} instead`);
    }
    if (!ctx.allNullValues && this.hasAllNullValues(false))
      ctx = Object.assign({}, ctx, { allNullValues: true });
    return stringifyCollection(this, ctx, {
      blockItemPrefix: "",
      flowChars: { start: "{", end: "}" },
      itemIndent: ctx.indent || "",
      onChompKeep,
      onComment
    });
  }
};

// node_modules/yaml/browser/dist/schema/common/map.js
var map2 = {
  collection: "map",
  default: true,
  nodeClass: YAMLMap,
  tag: "tag:yaml.org,2002:map",
  resolve(map3, onError) {
    if (!isMap(map3))
      onError("Expected a mapping for this tag");
    return map3;
  },
  createNode: (schema4, obj, ctx) => YAMLMap.from(schema4, obj, ctx)
};

// node_modules/yaml/browser/dist/nodes/YAMLSeq.js
var YAMLSeq = class extends Collection {
  static get tagName() {
    return "tag:yaml.org,2002:seq";
  }
  constructor(schema4) {
    super(SEQ, schema4);
    this.items = [];
  }
  add(value) {
    this.items.push(value);
  }
  /**
   * Removes a value from the collection.
   *
   * `key` must contain a representation of an integer for this to succeed.
   * It may be wrapped in a `Scalar`.
   *
   * @returns `true` if the item was found and removed.
   */
  delete(key) {
    const idx = asItemIndex(key);
    if (typeof idx !== "number")
      return false;
    const del = this.items.splice(idx, 1);
    return del.length > 0;
  }
  get(key, keepScalar) {
    const idx = asItemIndex(key);
    if (typeof idx !== "number")
      return void 0;
    const it = this.items[idx];
    return !keepScalar && isScalar(it) ? it.value : it;
  }
  /**
   * Checks if the collection includes a value with the key `key`.
   *
   * `key` must contain a representation of an integer for this to succeed.
   * It may be wrapped in a `Scalar`.
   */
  has(key) {
    const idx = asItemIndex(key);
    return typeof idx === "number" && idx < this.items.length;
  }
  /**
   * Sets a value in this collection. For `!!set`, `value` needs to be a
   * boolean to add/remove the item from the set.
   *
   * If `key` does not contain a representation of an integer, this will throw.
   * It may be wrapped in a `Scalar`.
   */
  set(key, value) {
    const idx = asItemIndex(key);
    if (typeof idx !== "number")
      throw new Error(`Expected a valid index, not ${key}.`);
    const prev = this.items[idx];
    if (isScalar(prev) && isScalarValue(value))
      prev.value = value;
    else
      this.items[idx] = value;
  }
  toJSON(_4, ctx) {
    const seq2 = [];
    if (ctx?.onCreate)
      ctx.onCreate(seq2);
    let i = 0;
    for (const item of this.items)
      seq2.push(toJS(item, String(i++), ctx));
    return seq2;
  }
  toString(ctx, onComment, onChompKeep) {
    if (!ctx)
      return JSON.stringify(this);
    return stringifyCollection(this, ctx, {
      blockItemPrefix: "- ",
      flowChars: { start: "[", end: "]" },
      itemIndent: (ctx.indent || "") + "  ",
      onChompKeep,
      onComment
    });
  }
  static from(schema4, obj, ctx) {
    const { replacer } = ctx;
    const seq2 = new this(schema4);
    if (obj && Symbol.iterator in Object(obj)) {
      let i = 0;
      for (let it of obj) {
        if (typeof replacer === "function") {
          const key = obj instanceof Set ? it : String(i++);
          it = replacer.call(obj, key, it);
        }
        seq2.items.push(createNode2(it, void 0, ctx));
      }
    }
    return seq2;
  }
};
function asItemIndex(key) {
  let idx = isScalar(key) ? key.value : key;
  if (idx && typeof idx === "string")
    idx = Number(idx);
  return typeof idx === "number" && Number.isInteger(idx) && idx >= 0 ? idx : null;
}

// node_modules/yaml/browser/dist/schema/common/seq.js
var seq = {
  collection: "seq",
  default: true,
  nodeClass: YAMLSeq,
  tag: "tag:yaml.org,2002:seq",
  resolve(seq2, onError) {
    if (!isSeq(seq2))
      onError("Expected a sequence for this tag");
    return seq2;
  },
  createNode: (schema4, obj, ctx) => YAMLSeq.from(schema4, obj, ctx)
};

// node_modules/yaml/browser/dist/schema/common/string.js
var string = {
  identify: (value) => typeof value === "string",
  default: true,
  tag: "tag:yaml.org,2002:str",
  resolve: (str) => str,
  stringify(item, ctx, onComment, onChompKeep) {
    ctx = Object.assign({ actualString: true }, ctx);
    return stringifyString(item, ctx, onComment, onChompKeep);
  }
};

// node_modules/yaml/browser/dist/schema/common/null.js
var nullTag = {
  identify: (value) => value == null,
  createNode: () => new Scalar(null),
  default: true,
  tag: "tag:yaml.org,2002:null",
  test: /^(?:~|[Nn]ull|NULL)?$/,
  resolve: () => new Scalar(null),
  stringify: ({ source }, ctx) => typeof source === "string" && nullTag.test.test(source) ? source : ctx.options.nullStr
};

// node_modules/yaml/browser/dist/schema/core/bool.js
var boolTag = {
  identify: (value) => typeof value === "boolean",
  default: true,
  tag: "tag:yaml.org,2002:bool",
  test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
  resolve: (str) => new Scalar(str[0] === "t" || str[0] === "T"),
  stringify({ source, value }, ctx) {
    if (source && boolTag.test.test(source)) {
      const sv = source[0] === "t" || source[0] === "T";
      if (value === sv)
        return source;
    }
    return value ? ctx.options.trueStr : ctx.options.falseStr;
  }
};

// node_modules/yaml/browser/dist/stringify/stringifyNumber.js
function stringifyNumber({ format, minFractionDigits, tag, value }) {
  if (typeof value === "bigint")
    return String(value);
  const num = typeof value === "number" ? value : Number(value);
  if (!isFinite(num))
    return isNaN(num) ? ".nan" : num < 0 ? "-.inf" : ".inf";
  let n = JSON.stringify(value);
  if (!format && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") && /^\d/.test(n)) {
    let i = n.indexOf(".");
    if (i < 0) {
      i = n.length;
      n += ".";
    }
    let d = minFractionDigits - (n.length - i - 1);
    while (d-- > 0)
      n += "0";
  }
  return n;
}

// node_modules/yaml/browser/dist/schema/core/float.js
var floatNaN = {
  identify: (value) => typeof value === "number",
  default: true,
  tag: "tag:yaml.org,2002:float",
  test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
  resolve: (str) => str.slice(-3).toLowerCase() === "nan" ? NaN : str[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
  stringify: stringifyNumber
};
var floatExp = {
  identify: (value) => typeof value === "number",
  default: true,
  tag: "tag:yaml.org,2002:float",
  format: "EXP",
  test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,
  resolve: (str) => parseFloat(str),
  stringify(node) {
    const num = Number(node.value);
    return isFinite(num) ? num.toExponential() : stringifyNumber(node);
  }
};
var float = {
  identify: (value) => typeof value === "number",
  default: true,
  tag: "tag:yaml.org,2002:float",
  test: /^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,
  resolve(str) {
    const node = new Scalar(parseFloat(str));
    const dot2 = str.indexOf(".");
    if (dot2 !== -1 && str[str.length - 1] === "0")
      node.minFractionDigits = str.length - dot2 - 1;
    return node;
  },
  stringify: stringifyNumber
};

// node_modules/yaml/browser/dist/schema/core/int.js
var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
var intResolve = (str, offset, radix, { intAsBigInt }) => intAsBigInt ? BigInt(str) : parseInt(str.substring(offset), radix);
function intStringify(node, radix, prefix) {
  const { value } = node;
  if (intIdentify(value) && value >= 0)
    return prefix + value.toString(radix);
  return stringifyNumber(node);
}
var intOct = {
  identify: (value) => intIdentify(value) && value >= 0,
  default: true,
  tag: "tag:yaml.org,2002:int",
  format: "OCT",
  test: /^0o[0-7]+$/,
  resolve: (str, _onError, opt2) => intResolve(str, 2, 8, opt2),
  stringify: (node) => intStringify(node, 8, "0o")
};
var int = {
  identify: intIdentify,
  default: true,
  tag: "tag:yaml.org,2002:int",
  test: /^[-+]?[0-9]+$/,
  resolve: (str, _onError, opt2) => intResolve(str, 0, 10, opt2),
  stringify: stringifyNumber
};
var intHex = {
  identify: (value) => intIdentify(value) && value >= 0,
  default: true,
  tag: "tag:yaml.org,2002:int",
  format: "HEX",
  test: /^0x[0-9a-fA-F]+$/,
  resolve: (str, _onError, opt2) => intResolve(str, 2, 16, opt2),
  stringify: (node) => intStringify(node, 16, "0x")
};

// node_modules/yaml/browser/dist/schema/core/schema.js
var schema = [
  map2,
  seq,
  string,
  nullTag,
  boolTag,
  intOct,
  int,
  intHex,
  floatNaN,
  floatExp,
  float
];

// node_modules/yaml/browser/dist/schema/json/schema.js
function intIdentify2(value) {
  return typeof value === "bigint" || Number.isInteger(value);
}
var stringifyJSON = ({ value }) => JSON.stringify(value);
var jsonScalars = [
  {
    identify: (value) => typeof value === "string",
    default: true,
    tag: "tag:yaml.org,2002:str",
    resolve: (str) => str,
    stringify: stringifyJSON
  },
  {
    identify: (value) => value == null,
    createNode: () => new Scalar(null),
    default: true,
    tag: "tag:yaml.org,2002:null",
    test: /^null$/,
    resolve: () => null,
    stringify: stringifyJSON
  },
  {
    identify: (value) => typeof value === "boolean",
    default: true,
    tag: "tag:yaml.org,2002:bool",
    test: /^true$|^false$/,
    resolve: (str) => str === "true",
    stringify: stringifyJSON
  },
  {
    identify: intIdentify2,
    default: true,
    tag: "tag:yaml.org,2002:int",
    test: /^-?(?:0|[1-9][0-9]*)$/,
    resolve: (str, _onError, { intAsBigInt }) => intAsBigInt ? BigInt(str) : parseInt(str, 10),
    stringify: ({ value }) => intIdentify2(value) ? value.toString() : JSON.stringify(value)
  },
  {
    identify: (value) => typeof value === "number",
    default: true,
    tag: "tag:yaml.org,2002:float",
    test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,
    resolve: (str) => parseFloat(str),
    stringify: stringifyJSON
  }
];
var jsonError = {
  default: true,
  tag: "",
  test: /^/,
  resolve(str, onError) {
    onError(`Unresolved plain scalar ${JSON.stringify(str)}`);
    return str;
  }
};
var schema2 = [map2, seq].concat(jsonScalars, jsonError);

// node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js
var binary = {
  identify: (value) => value instanceof Uint8Array,
  // Buffer inherits from Uint8Array
  default: false,
  tag: "tag:yaml.org,2002:binary",
  /**
   * Returns a Buffer in node and an Uint8Array in browsers
   *
   * To use the resulting buffer as an image, you'll want to do something like:
   *
   *   const blob = new Blob([buffer], { type: 'image/jpeg' })
   *   document.querySelector('#photo').src = URL.createObjectURL(blob)
   */
  resolve(src, onError) {
    if (typeof atob === "function") {
      const str = atob(src.replace(/[\n\r]/g, ""));
      const buffer = new Uint8Array(str.length);
      for (let i = 0; i < str.length; ++i)
        buffer[i] = str.charCodeAt(i);
      return buffer;
    } else {
      onError("This environment does not support reading binary tags; either Buffer or atob is required");
      return src;
    }
  },
  stringify({ comment, type, value }, ctx, onComment, onChompKeep) {
    if (!value)
      return "";
    const buf = value;
    let str;
    if (typeof btoa === "function") {
      let s = "";
      for (let i = 0; i < buf.length; ++i)
        s += String.fromCharCode(buf[i]);
      str = btoa(s);
    } else {
      throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");
    }
    type ?? (type = Scalar.BLOCK_LITERAL);
    if (type !== Scalar.QUOTE_DOUBLE) {
      const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);
      const n = Math.ceil(str.length / lineWidth);
      const lines = new Array(n);
      for (let i = 0, o = 0; i < n; ++i, o += lineWidth) {
        lines[i] = str.substr(o, lineWidth);
      }
      str = lines.join(type === Scalar.BLOCK_LITERAL ? "\n" : " ");
    }
    return stringifyString({ comment, type, value: str }, ctx, onComment, onChompKeep);
  }
};

// node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js
function resolvePairs(seq2, onError) {
  if (isSeq(seq2)) {
    for (let i = 0; i < seq2.items.length; ++i) {
      let item = seq2.items[i];
      if (isPair(item))
        continue;
      else if (isMap(item)) {
        if (item.items.length > 1)
          onError("Each pair must have its own sequence indicator");
        const pair = item.items[0] || new Pair2(new Scalar(null));
        if (item.commentBefore)
          pair.key.commentBefore = pair.key.commentBefore ? `${item.commentBefore}
${pair.key.commentBefore}` : item.commentBefore;
        if (item.comment) {
          const cn = pair.value ?? pair.key;
          cn.comment = cn.comment ? `${item.comment}
${cn.comment}` : item.comment;
        }
        item = pair;
      }
      seq2.items[i] = isPair(item) ? item : new Pair2(item);
    }
  } else
    onError("Expected a sequence for this tag");
  return seq2;
}
function createPairs(schema4, iterable, ctx) {
  const { replacer } = ctx;
  const pairs2 = new YAMLSeq(schema4);
  pairs2.tag = "tag:yaml.org,2002:pairs";
  let i = 0;
  if (iterable && Symbol.iterator in Object(iterable))
    for (let it of iterable) {
      if (typeof replacer === "function")
        it = replacer.call(iterable, String(i++), it);
      let key, value;
      if (Array.isArray(it)) {
        if (it.length === 2) {
          key = it[0];
          value = it[1];
        } else
          throw new TypeError(`Expected [key, value] tuple: ${it}`);
      } else if (it && it instanceof Object) {
        const keys = Object.keys(it);
        if (keys.length === 1) {
          key = keys[0];
          value = it[key];
        } else {
          throw new TypeError(`Expected tuple with one key, not ${keys.length} keys`);
        }
      } else {
        key = it;
      }
      pairs2.items.push(createPair(key, value, ctx));
    }
  return pairs2;
}
var pairs = {
  collection: "seq",
  default: false,
  tag: "tag:yaml.org,2002:pairs",
  resolve: resolvePairs,
  createNode: createPairs
};

// node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js
var YAMLOMap = class _YAMLOMap extends YAMLSeq {
  constructor() {
    super();
    this.add = YAMLMap.prototype.add.bind(this);
    this.delete = YAMLMap.prototype.delete.bind(this);
    this.get = YAMLMap.prototype.get.bind(this);
    this.has = YAMLMap.prototype.has.bind(this);
    this.set = YAMLMap.prototype.set.bind(this);
    this.tag = _YAMLOMap.tag;
  }
  /**
   * If `ctx` is given, the return type is actually `Map<unknown, unknown>`,
   * but TypeScript won't allow widening the signature of a child method.
   */
  toJSON(_4, ctx) {
    if (!ctx)
      return super.toJSON(_4);
    const map3 = /* @__PURE__ */ new Map();
    if (ctx?.onCreate)
      ctx.onCreate(map3);
    for (const pair of this.items) {
      let key, value;
      if (isPair(pair)) {
        key = toJS(pair.key, "", ctx);
        value = toJS(pair.value, key, ctx);
      } else {
        key = toJS(pair, "", ctx);
      }
      if (map3.has(key))
        throw new Error("Ordered maps must not include duplicate keys");
      map3.set(key, value);
    }
    return map3;
  }
  static from(schema4, iterable, ctx) {
    const pairs2 = createPairs(schema4, iterable, ctx);
    const omap2 = new this();
    omap2.items = pairs2.items;
    return omap2;
  }
};
YAMLOMap.tag = "tag:yaml.org,2002:omap";
var omap = {
  collection: "seq",
  identify: (value) => value instanceof Map,
  nodeClass: YAMLOMap,
  default: false,
  tag: "tag:yaml.org,2002:omap",
  resolve(seq2, onError) {
    const pairs2 = resolvePairs(seq2, onError);
    const seenKeys = [];
    for (const { key } of pairs2.items) {
      if (isScalar(key)) {
        if (seenKeys.includes(key.value)) {
          onError(`Ordered maps must not include duplicate keys: ${key.value}`);
        } else {
          seenKeys.push(key.value);
        }
      }
    }
    return Object.assign(new YAMLOMap(), pairs2);
  },
  createNode: (schema4, iterable, ctx) => YAMLOMap.from(schema4, iterable, ctx)
};

// node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js
function boolStringify({ value, source }, ctx) {
  const boolObj = value ? trueTag : falseTag;
  if (source && boolObj.test.test(source))
    return source;
  return value ? ctx.options.trueStr : ctx.options.falseStr;
}
var trueTag = {
  identify: (value) => value === true,
  default: true,
  tag: "tag:yaml.org,2002:bool",
  test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
  resolve: () => new Scalar(true),
  stringify: boolStringify
};
var falseTag = {
  identify: (value) => value === false,
  default: true,
  tag: "tag:yaml.org,2002:bool",
  test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,
  resolve: () => new Scalar(false),
  stringify: boolStringify
};

// node_modules/yaml/browser/dist/schema/yaml-1.1/float.js
var floatNaN2 = {
  identify: (value) => typeof value === "number",
  default: true,
  tag: "tag:yaml.org,2002:float",
  test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
  resolve: (str) => str.slice(-3).toLowerCase() === "nan" ? NaN : str[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
  stringify: stringifyNumber
};
var floatExp2 = {
  identify: (value) => typeof value === "number",
  default: true,
  tag: "tag:yaml.org,2002:float",
  format: "EXP",
  test: /^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,
  resolve: (str) => parseFloat(str.replace(/_/g, "")),
  stringify(node) {
    const num = Number(node.value);
    return isFinite(num) ? num.toExponential() : stringifyNumber(node);
  }
};
var float2 = {
  identify: (value) => typeof value === "number",
  default: true,
  tag: "tag:yaml.org,2002:float",
  test: /^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,
  resolve(str) {
    const node = new Scalar(parseFloat(str.replace(/_/g, "")));
    const dot2 = str.indexOf(".");
    if (dot2 !== -1) {
      const f = str.substring(dot2 + 1).replace(/_/g, "");
      if (f[f.length - 1] === "0")
        node.minFractionDigits = f.length;
    }
    return node;
  },
  stringify: stringifyNumber
};

// node_modules/yaml/browser/dist/schema/yaml-1.1/int.js
var intIdentify3 = (value) => typeof value === "bigint" || Number.isInteger(value);
function intResolve2(str, offset, radix, { intAsBigInt }) {
  const sign = str[0];
  if (sign === "-" || sign === "+")
    offset += 1;
  str = str.substring(offset).replace(/_/g, "");
  if (intAsBigInt) {
    switch (radix) {
      case 2:
        str = `0b${str}`;
        break;
      case 8:
        str = `0o${str}`;
        break;
      case 16:
        str = `0x${str}`;
        break;
    }
    const n2 = BigInt(str);
    return sign === "-" ? BigInt(-1) * n2 : n2;
  }
  const n = parseInt(str, radix);
  return sign === "-" ? -1 * n : n;
}
function intStringify2(node, radix, prefix) {
  const { value } = node;
  if (intIdentify3(value)) {
    const str = value.toString(radix);
    return value < 0 ? "-" + prefix + str.substr(1) : prefix + str;
  }
  return stringifyNumber(node);
}
var intBin = {
  identify: intIdentify3,
  default: true,
  tag: "tag:yaml.org,2002:int",
  format: "BIN",
  test: /^[-+]?0b[0-1_]+$/,
  resolve: (str, _onError, opt2) => intResolve2(str, 2, 2, opt2),
  stringify: (node) => intStringify2(node, 2, "0b")
};
var intOct2 = {
  identify: intIdentify3,
  default: true,
  tag: "tag:yaml.org,2002:int",
  format: "OCT",
  test: /^[-+]?0[0-7_]+$/,
  resolve: (str, _onError, opt2) => intResolve2(str, 1, 8, opt2),
  stringify: (node) => intStringify2(node, 8, "0")
};
var int2 = {
  identify: intIdentify3,
  default: true,
  tag: "tag:yaml.org,2002:int",
  test: /^[-+]?[0-9][0-9_]*$/,
  resolve: (str, _onError, opt2) => intResolve2(str, 0, 10, opt2),
  stringify: stringifyNumber
};
var intHex2 = {
  identify: intIdentify3,
  default: true,
  tag: "tag:yaml.org,2002:int",
  format: "HEX",
  test: /^[-+]?0x[0-9a-fA-F_]+$/,
  resolve: (str, _onError, opt2) => intResolve2(str, 2, 16, opt2),
  stringify: (node) => intStringify2(node, 16, "0x")
};

// node_modules/yaml/browser/dist/schema/yaml-1.1/set.js
var YAMLSet = class _YAMLSet extends YAMLMap {
  constructor(schema4) {
    super(schema4);
    this.tag = _YAMLSet.tag;
  }
  add(key) {
    let pair;
    if (isPair(key))
      pair = key;
    else if (key && typeof key === "object" && "key" in key && "value" in key && key.value === null)
      pair = new Pair2(key.key, null);
    else
      pair = new Pair2(key, null);
    const prev = findPair(this.items, pair.key);
    if (!prev)
      this.items.push(pair);
  }
  /**
   * If `keepPair` is `true`, returns the Pair matching `key`.
   * Otherwise, returns the value of that Pair's key.
   */
  get(key, keepPair) {
    const pair = findPair(this.items, key);
    return !keepPair && isPair(pair) ? isScalar(pair.key) ? pair.key.value : pair.key : pair;
  }
  set(key, value) {
    if (typeof value !== "boolean")
      throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof value}`);
    const prev = findPair(this.items, key);
    if (prev && !value) {
      this.items.splice(this.items.indexOf(prev), 1);
    } else if (!prev && value) {
      this.items.push(new Pair2(key));
    }
  }
  toJSON(_4, ctx) {
    return super.toJSON(_4, ctx, Set);
  }
  toString(ctx, onComment, onChompKeep) {
    if (!ctx)
      return JSON.stringify(this);
    if (this.hasAllNullValues(true))
      return super.toString(Object.assign({}, ctx, { allNullValues: true }), onComment, onChompKeep);
    else
      throw new Error("Set items must all have null values");
  }
  static from(schema4, iterable, ctx) {
    const { replacer } = ctx;
    const set2 = new this(schema4);
    if (iterable && Symbol.iterator in Object(iterable))
      for (let value of iterable) {
        if (typeof replacer === "function")
          value = replacer.call(iterable, value, value);
        set2.items.push(createPair(value, null, ctx));
      }
    return set2;
  }
};
YAMLSet.tag = "tag:yaml.org,2002:set";
var set = {
  collection: "map",
  identify: (value) => value instanceof Set,
  nodeClass: YAMLSet,
  default: false,
  tag: "tag:yaml.org,2002:set",
  createNode: (schema4, iterable, ctx) => YAMLSet.from(schema4, iterable, ctx),
  resolve(map3, onError) {
    if (isMap(map3)) {
      if (map3.hasAllNullValues(true))
        return Object.assign(new YAMLSet(), map3);
      else
        onError("Set items must all have null values");
    } else
      onError("Expected a mapping for this tag");
    return map3;
  }
};

// node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js
function parseSexagesimal(str, asBigInt) {
  const sign = str[0];
  const parts = sign === "-" || sign === "+" ? str.substring(1) : str;
  const num = (n) => asBigInt ? BigInt(n) : Number(n);
  const res = parts.replace(/_/g, "").split(":").reduce((res2, p) => res2 * num(60) + num(p), num(0));
  return sign === "-" ? num(-1) * res : res;
}
function stringifySexagesimal(node) {
  let { value } = node;
  let num = (n) => n;
  if (typeof value === "bigint")
    num = (n) => BigInt(n);
  else if (isNaN(value) || !isFinite(value))
    return stringifyNumber(node);
  let sign = "";
  if (value < 0) {
    sign = "-";
    value *= num(-1);
  }
  const _60 = num(60);
  const parts = [value % _60];
  if (value < 60) {
    parts.unshift(0);
  } else {
    value = (value - parts[0]) / _60;
    parts.unshift(value % _60);
    if (value >= 60) {
      value = (value - parts[0]) / _60;
      parts.unshift(value);
    }
  }
  return sign + parts.map((n) => String(n).padStart(2, "0")).join(":").replace(/000000\d*$/, "");
}
var intTime = {
  identify: (value) => typeof value === "bigint" || Number.isInteger(value),
  default: true,
  tag: "tag:yaml.org,2002:int",
  format: "TIME",
  test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,
  resolve: (str, _onError, { intAsBigInt }) => parseSexagesimal(str, intAsBigInt),
  stringify: stringifySexagesimal
};
var floatTime = {
  identify: (value) => typeof value === "number",
  default: true,
  tag: "tag:yaml.org,2002:float",
  format: "TIME",
  test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,
  resolve: (str) => parseSexagesimal(str, false),
  stringify: stringifySexagesimal
};
var timestamp = {
  identify: (value) => value instanceof Date,
  default: true,
  tag: "tag:yaml.org,2002:timestamp",
  // If the time zone is omitted, the timestamp is assumed to be specified in UTC. The time part
  // may be omitted altogether, resulting in a date format. In such a case, the time part is
  // assumed to be 00:00:00Z (start of day, UTC).
  test: RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),
  resolve(str) {
    const match2 = str.match(timestamp.test);
    if (!match2)
      throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
    const [, year, month, day, hour, minute, second] = match2.map(Number);
    const millisec = match2[7] ? Number((match2[7] + "00").substr(1, 3)) : 0;
    let date = Date.UTC(year, month - 1, day, hour || 0, minute || 0, second || 0, millisec);
    const tz = match2[8];
    if (tz && tz !== "Z") {
      let d = parseSexagesimal(tz, false);
      if (Math.abs(d) < 30)
        d *= 60;
      date -= 6e4 * d;
    }
    return new Date(date);
  },
  stringify: ({ value }) => value?.toISOString().replace(/(T00:00:00)?\.000Z$/, "") ?? ""
};

// node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js
var schema3 = [
  map2,
  seq,
  string,
  nullTag,
  trueTag,
  falseTag,
  intBin,
  intOct2,
  int2,
  intHex2,
  floatNaN2,
  floatExp2,
  float2,
  binary,
  merge3,
  omap,
  pairs,
  set,
  intTime,
  floatTime,
  timestamp
];

// node_modules/yaml/browser/dist/schema/tags.js
var schemas = /* @__PURE__ */ new Map([
  ["core", schema],
  ["failsafe", [map2, seq, string]],
  ["json", schema2],
  ["yaml11", schema3],
  ["yaml-1.1", schema3]
]);
var tagsByName = {
  binary,
  bool: boolTag,
  float,
  floatExp,
  floatNaN,
  floatTime,
  int,
  intHex,
  intOct,
  intTime,
  map: map2,
  merge: merge3,
  null: nullTag,
  omap,
  pairs,
  seq,
  set,
  timestamp
};
var coreKnownTags = {
  "tag:yaml.org,2002:binary": binary,
  "tag:yaml.org,2002:merge": merge3,
  "tag:yaml.org,2002:omap": omap,
  "tag:yaml.org,2002:pairs": pairs,
  "tag:yaml.org,2002:set": set,
  "tag:yaml.org,2002:timestamp": timestamp
};
function getTags(customTags, schemaName, addMergeTag) {
  const schemaTags = schemas.get(schemaName);
  if (schemaTags && !customTags) {
    return addMergeTag && !schemaTags.includes(merge3) ? schemaTags.concat(merge3) : schemaTags.slice();
  }
  let tags = schemaTags;
  if (!tags) {
    if (Array.isArray(customTags))
      tags = [];
    else {
      const keys = Array.from(schemas.keys()).filter((key) => key !== "yaml11").map((key) => JSON.stringify(key)).join(", ");
      throw new Error(`Unknown schema "${schemaName}"; use one of ${keys} or define customTags array`);
    }
  }
  if (Array.isArray(customTags)) {
    for (const tag of customTags)
      tags = tags.concat(tag);
  } else if (typeof customTags === "function") {
    tags = customTags(tags.slice());
  }
  if (addMergeTag)
    tags = tags.concat(merge3);
  return tags.reduce((tags2, tag) => {
    const tagObj = typeof tag === "string" ? tagsByName[tag] : tag;
    if (!tagObj) {
      const tagName = JSON.stringify(tag);
      const keys = Object.keys(tagsByName).map((key) => JSON.stringify(key)).join(", ");
      throw new Error(`Unknown custom tag ${tagName}; use one of ${keys}`);
    }
    if (!tags2.includes(tagObj))
      tags2.push(tagObj);
    return tags2;
  }, []);
}

// node_modules/yaml/browser/dist/schema/Schema.js
var sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
var Schema = class _Schema {
  constructor({ compat, customTags, merge: merge4, resolveKnownTags, schema: schema4, sortMapEntries, toStringDefaults }) {
    this.compat = Array.isArray(compat) ? getTags(compat, "compat") : compat ? getTags(null, compat) : null;
    this.name = typeof schema4 === "string" && schema4 || "core";
    this.knownTags = resolveKnownTags ? coreKnownTags : {};
    this.tags = getTags(customTags, this.name, merge4);
    this.toStringOptions = toStringDefaults ?? null;
    Object.defineProperty(this, MAP, { value: map2 });
    Object.defineProperty(this, SCALAR, { value: string });
    Object.defineProperty(this, SEQ, { value: seq });
    this.sortMapEntries = typeof sortMapEntries === "function" ? sortMapEntries : sortMapEntries === true ? sortMapEntriesByKey : null;
  }
  clone() {
    const copy = Object.create(_Schema.prototype, Object.getOwnPropertyDescriptors(this));
    copy.tags = this.tags.slice();
    return copy;
  }
};

// node_modules/yaml/browser/dist/stringify/stringifyDocument.js
function stringifyDocument(doc, options) {
  const lines = [];
  let hasDirectives = options.directives === true;
  if (options.directives !== false && doc.directives) {
    const dir = doc.directives.toString(doc);
    if (dir) {
      lines.push(dir);
      hasDirectives = true;
    } else if (doc.directives.docStart)
      hasDirectives = true;
  }
  if (hasDirectives)
    lines.push("---");
  const ctx = createStringifyContext(doc, options);
  const { commentString } = ctx.options;
  if (doc.commentBefore) {
    if (lines.length !== 1)
      lines.unshift("");
    const cs = commentString(doc.commentBefore);
    lines.unshift(indentComment(cs, ""));
  }
  let chompKeep = false;
  let contentComment = null;
  if (doc.contents) {
    if (isNode(doc.contents)) {
      if (doc.contents.spaceBefore && hasDirectives)
        lines.push("");
      if (doc.contents.commentBefore) {
        const cs = commentString(doc.contents.commentBefore);
        lines.push(indentComment(cs, ""));
      }
      ctx.forceBlockIndent = !!doc.comment;
      contentComment = doc.contents.comment;
    }
    const onChompKeep = contentComment ? void 0 : () => chompKeep = true;
    let body = stringify3(doc.contents, ctx, () => contentComment = null, onChompKeep);
    if (contentComment)
      body += lineComment(body, "", commentString(contentComment));
    if ((body[0] === "|" || body[0] === ">") && lines[lines.length - 1] === "---") {
      lines[lines.length - 1] = `--- ${body}`;
    } else
      lines.push(body);
  } else {
    lines.push(stringify3(doc.contents, ctx));
  }
  if (doc.directives?.docEnd) {
    if (doc.comment) {
      const cs = commentString(doc.comment);
      if (cs.includes("\n")) {
        lines.push("...");
        lines.push(indentComment(cs, ""));
      } else {
        lines.push(`... ${cs}`);
      }
    } else {
      lines.push("...");
    }
  } else {
    let dc = doc.comment;
    if (dc && chompKeep)
      dc = dc.replace(/^\n+/, "");
    if (dc) {
      if ((!chompKeep || contentComment) && lines[lines.length - 1] !== "")
        lines.push("");
      lines.push(indentComment(commentString(dc), ""));
    }
  }
  return lines.join("\n") + "\n";
}

// node_modules/yaml/browser/dist/doc/Document.js
var Document2 = class _Document {
  constructor(value, replacer, options) {
    this.commentBefore = null;
    this.comment = null;
    this.errors = [];
    this.warnings = [];
    Object.defineProperty(this, NODE_TYPE, { value: DOC });
    let _replacer = null;
    if (typeof replacer === "function" || Array.isArray(replacer)) {
      _replacer = replacer;
    } else if (options === void 0 && replacer) {
      options = replacer;
      replacer = void 0;
    }
    const opt2 = Object.assign({
      intAsBigInt: false,
      keepSourceTokens: false,
      logLevel: "warn",
      prettyErrors: true,
      strict: true,
      stringKeys: false,
      uniqueKeys: true,
      version: "1.2"
    }, options);
    this.options = opt2;
    let { version } = opt2;
    if (options?._directives) {
      this.directives = options._directives.atDocument();
      if (this.directives.yaml.explicit)
        version = this.directives.yaml.version;
    } else
      this.directives = new Directives({ version });
    this.setSchema(version, options);
    this.contents = value === void 0 ? null : this.createNode(value, _replacer, options);
  }
  /**
   * Create a deep copy of this Document and its contents.
   *
   * Custom Node values that inherit from `Object` still refer to their original instances.
   */
  clone() {
    const copy = Object.create(_Document.prototype, {
      [NODE_TYPE]: { value: DOC }
    });
    copy.commentBefore = this.commentBefore;
    copy.comment = this.comment;
    copy.errors = this.errors.slice();
    copy.warnings = this.warnings.slice();
    copy.options = Object.assign({}, this.options);
    if (this.directives)
      copy.directives = this.directives.clone();
    copy.schema = this.schema.clone();
    copy.contents = isNode(this.contents) ? this.contents.clone(copy.schema) : this.contents;
    if (this.range)
      copy.range = this.range.slice();
    return copy;
  }
  /** Adds a value to the document. */
  add(value) {
    if (assertCollection(this.contents))
      this.contents.add(value);
  }
  /** Adds a value to the document. */
  addIn(path, value) {
    if (assertCollection(this.contents))
      this.contents.addIn(path, value);
  }
  /**
   * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
   *
   * If `node` already has an anchor, `name` is ignored.
   * Otherwise, the `node.anchor` value will be set to `name`,
   * or if an anchor with that name is already present in the document,
   * `name` will be used as a prefix for a new unique anchor.
   * If `name` is undefined, the generated anchor will use 'a' as a prefix.
   */
  createAlias(node, name2) {
    if (!node.anchor) {
      const prev = anchorNames(this);
      node.anchor = // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
      !name2 || prev.has(name2) ? findNewAnchor(name2 || "a", prev) : name2;
    }
    return new Alias(node.anchor);
  }
  createNode(value, replacer, options) {
    let _replacer = void 0;
    if (typeof replacer === "function") {
      value = replacer.call({ "": value }, "", value);
      _replacer = replacer;
    } else if (Array.isArray(replacer)) {
      const keyToStr = (v) => typeof v === "number" || v instanceof String || v instanceof Number;
      const asStr = replacer.filter(keyToStr).map(String);
      if (asStr.length > 0)
        replacer = replacer.concat(asStr);
      _replacer = replacer;
    } else if (options === void 0 && replacer) {
      options = replacer;
      replacer = void 0;
    }
    const { aliasDuplicateObjects, anchorPrefix, flow, keepUndefined, onTagObj, tag } = options ?? {};
    const { onAnchor, setAnchors, sourceObjects } = createNodeAnchors(
      this,
      // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
      anchorPrefix || "a"
    );
    const ctx = {
      aliasDuplicateObjects: aliasDuplicateObjects ?? true,
      keepUndefined: keepUndefined ?? false,
      onAnchor,
      onTagObj,
      replacer: _replacer,
      schema: this.schema,
      sourceObjects
    };
    const node = createNode2(value, tag, ctx);
    if (flow && isCollection(node))
      node.flow = true;
    setAnchors();
    return node;
  }
  /**
   * Convert a key and a value into a `Pair` using the current schema,
   * recursively wrapping all values as `Scalar` or `Collection` nodes.
   */
  createPair(key, value, options = {}) {
    const k = this.createNode(key, null, options);
    const v = this.createNode(value, null, options);
    return new Pair2(k, v);
  }
  /**
   * Removes a value from the document.
   * @returns `true` if the item was found and removed.
   */
  delete(key) {
    return assertCollection(this.contents) ? this.contents.delete(key) : false;
  }
  /**
   * Removes a value from the document.
   * @returns `true` if the item was found and removed.
   */
  deleteIn(path) {
    if (isEmptyPath(path)) {
      if (this.contents == null)
        return false;
      this.contents = null;
      return true;
    }
    return assertCollection(this.contents) ? this.contents.deleteIn(path) : false;
  }
  /**
   * Returns item at `key`, or `undefined` if not found. By default unwraps
   * scalar values from their surrounding node; to disable set `keepScalar` to
   * `true` (collections are always returned intact).
   */
  get(key, keepScalar) {
    return isCollection(this.contents) ? this.contents.get(key, keepScalar) : void 0;
  }
  /**
   * Returns item at `path`, or `undefined` if not found. By default unwraps
   * scalar values from their surrounding node; to disable set `keepScalar` to
   * `true` (collections are always returned intact).
   */
  getIn(path, keepScalar) {
    if (isEmptyPath(path))
      return !keepScalar && isScalar(this.contents) ? this.contents.value : this.contents;
    return isCollection(this.contents) ? this.contents.getIn(path, keepScalar) : void 0;
  }
  /**
   * Checks if the document includes a value with the key `key`.
   */
  has(key) {
    return isCollection(this.contents) ? this.contents.has(key) : false;
  }
  /**
   * Checks if the document includes a value at `path`.
   */
  hasIn(path) {
    if (isEmptyPath(path))
      return this.contents !== void 0;
    return isCollection(this.contents) ? this.contents.hasIn(path) : false;
  }
  /**
   * Sets a value in this document. For `!!set`, `value` needs to be a
   * boolean to add/remove the item from the set.
   */
  set(key, value) {
    if (this.contents == null) {
      this.contents = collectionFromPath(this.schema, [key], value);
    } else if (assertCollection(this.contents)) {
      this.contents.set(key, value);
    }
  }
  /**
   * Sets a value in this document. For `!!set`, `value` needs to be a
   * boolean to add/remove the item from the set.
   */
  setIn(path, value) {
    if (isEmptyPath(path)) {
      this.contents = value;
    } else if (this.contents == null) {
      this.contents = collectionFromPath(this.schema, Array.from(path), value);
    } else if (assertCollection(this.contents)) {
      this.contents.setIn(path, value);
    }
  }
  /**
   * Change the YAML version and schema used by the document.
   * A `null` version disables support for directives, explicit tags, anchors, and aliases.
   * It also requires the `schema` option to be given as a `Schema` instance value.
   *
   * Overrides all previously set schema options.
   */
  setSchema(version, options = {}) {
    if (typeof version === "number")
      version = String(version);
    let opt2;
    switch (version) {
      case "1.1":
        if (this.directives)
          this.directives.yaml.version = "1.1";
        else
          this.directives = new Directives({ version: "1.1" });
        opt2 = { resolveKnownTags: false, schema: "yaml-1.1" };
        break;
      case "1.2":
      case "next":
        if (this.directives)
          this.directives.yaml.version = version;
        else
          this.directives = new Directives({ version });
        opt2 = { resolveKnownTags: true, schema: "core" };
        break;
      case null:
        if (this.directives)
          delete this.directives;
        opt2 = null;
        break;
      default: {
        const sv = JSON.stringify(version);
        throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${sv}`);
      }
    }
    if (options.schema instanceof Object)
      this.schema = options.schema;
    else if (opt2)
      this.schema = new Schema(Object.assign(opt2, options));
    else
      throw new Error(`With a null YAML version, the { schema: Schema } option is required`);
  }
  // json & jsonArg are only used from toJSON()
  toJS({ json, jsonArg, mapAsMap, maxAliasCount, onAnchor, reviver } = {}) {
    const ctx = {
      anchors: /* @__PURE__ */ new Map(),
      doc: this,
      keep: !json,
      mapAsMap: mapAsMap === true,
      mapKeyWarned: false,
      maxAliasCount: typeof maxAliasCount === "number" ? maxAliasCount : 100
    };
    const res = toJS(this.contents, jsonArg ?? "", ctx);
    if (typeof onAnchor === "function")
      for (const { count, res: res2 } of ctx.anchors.values())
        onAnchor(res2, count);
    return typeof reviver === "function" ? applyReviver(reviver, { "": res }, "", res) : res;
  }
  /**
   * A JSON representation of the document `contents`.
   *
   * @param jsonArg Used by `JSON.stringify` to indicate the array index or
   *   property name.
   */
  toJSON(jsonArg, onAnchor) {
    return this.toJS({ json: true, jsonArg, mapAsMap: false, onAnchor });
  }
  /** A YAML representation of the document. */
  toString(options = {}) {
    if (this.errors.length > 0)
      throw new Error("Document with errors cannot be stringified");
    if ("indent" in options && (!Number.isInteger(options.indent) || Number(options.indent) <= 0)) {
      const s = JSON.stringify(options.indent);
      throw new Error(`"indent" option must be a positive integer, not ${s}`);
    }
    return stringifyDocument(this, options);
  }
};
function assertCollection(contents) {
  if (isCollection(contents))
    return true;
  throw new Error("Expected a YAML collection as document contents");
}

// node_modules/yaml/browser/dist/parse/cst-visit.js
var BREAK2 = Symbol("break visit");
var SKIP2 = Symbol("skip children");
var REMOVE2 = Symbol("remove item");
function visit2(cst2, visitor) {
  if ("type" in cst2 && cst2.type === "document")
    cst2 = { start: cst2.start, value: cst2.value };
  _visit(Object.freeze([]), cst2, visitor);
}
visit2.BREAK = BREAK2;
visit2.SKIP = SKIP2;
visit2.REMOVE = REMOVE2;
visit2.itemAtPath = (cst2, path) => {
  let item = cst2;
  for (const [field, index] of path) {
    const tok = item?.[field];
    if (tok && "items" in tok) {
      item = tok.items[index];
    } else
      return void 0;
  }
  return item;
};
visit2.parentCollection = (cst2, path) => {
  const parent = visit2.itemAtPath(cst2, path.slice(0, -1));
  const field = path[path.length - 1][0];
  const coll = parent?.[field];
  if (coll && "items" in coll)
    return coll;
  throw new Error("Parent collection not found");
};
function _visit(path, item, visitor) {
  let ctrl = visitor(item, path);
  if (typeof ctrl === "symbol")
    return ctrl;
  for (const field of ["key", "value"]) {
    const token = item[field];
    if (token && "items" in token) {
      for (let i = 0; i < token.items.length; ++i) {
        const ci = _visit(Object.freeze(path.concat([[field, i]])), token.items[i], visitor);
        if (typeof ci === "number")
          i = ci - 1;
        else if (ci === BREAK2)
          return BREAK2;
        else if (ci === REMOVE2) {
          token.items.splice(i, 1);
          i -= 1;
        }
      }
      if (typeof ctrl === "function" && field === "key")
        ctrl = ctrl(item, path);
    }
  }
  return typeof ctrl === "function" ? ctrl(item, path) : ctrl;
}

// node_modules/yaml/browser/dist/parse/lexer.js
var hexDigits = new Set("0123456789ABCDEFabcdef");
var tagChars = new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()");
var flowIndicatorChars = new Set(",[]{}");
var invalidAnchorChars = new Set(" ,[]{}\n\r	");

// node_modules/yaml/browser/dist/public-api.js
function stringify5(value, replacer, options) {
  let _replacer = null;
  if (typeof replacer === "function" || Array.isArray(replacer)) {
    _replacer = replacer;
  } else if (options === void 0 && replacer) {
    options = replacer;
  }
  if (typeof options === "string")
    options = options.length;
  if (typeof options === "number") {
    const indent = Math.round(options);
    options = indent < 1 ? void 0 : indent > 8 ? { indent: 8 } : { indent };
  }
  if (value === void 0) {
    const { keepUndefined } = options ?? replacer ?? {};
    if (!keepUndefined)
      return void 0;
  }
  if (isDocument(value) && !_replacer)
    return value.toString(options);
  return new Document2(value, _replacer, options).toString(options);
}

// node_modules/highlight.js/es/core.js
var import_core69 = __toESM(require_core(), 1);
var core_default = import_core69.default;

// src/app/highlight.directive.ts
var HighlightDirective = class _HighlightDirective {
  el;
  // Input for the content you want to highlight
  code = input.required(...ngDevMode ? [{ debugName: "code", alias: "appHighlight" }] : [{ alias: "appHighlight" }]);
  // Input to specify the language (optional, defaults to 'yaml')
  // (You'll need to initialize more languages in app.component.ts)
  language = input("yaml", ...ngDevMode ? [{ debugName: "language" }] : []);
  constructor(el) {
    this.el = el;
  }
  ngOnChanges() {
    const element = this.el.nativeElement;
    if (this.code && element) {
      const highlightedCode = core_default.highlight(this.code(), {
        language: this.language()
      }).value;
      element.innerHTML = highlightedCode;
    }
  }
  static \u0275fac = function HighlightDirective_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _HighlightDirective)(\u0275\u0275directiveInject(ElementRef));
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({ type: _HighlightDirective, selectors: [["", "appHighlight", ""]], inputs: { code: [1, "appHighlight", "code"], language: [1, "language"] }, features: [\u0275\u0275NgOnChangesFeature] });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HighlightDirective, [{
    type: Directive,
    args: [{
      selector: "[appHighlight]",
      standalone: true
      // Mark as standalone
    }]
  }], () => [{ type: ElementRef }], null);
})();

// src/app/utils/validators.ts
function mustBeInOptionsList(optionsGetterGetter) {
  return (control) => {
    if (optionsGetterGetter() === void 0) {
      return null;
    }
    const optionsGetter = optionsGetterGetter();
    const selectedItem = control.value;
    const currentOptions = optionsGetter();
    if (!selectedItem) {
      return null;
    }
    const found = currentOptions.some((item) => item === selectedItem);
    return found ? null : { notInOptions: true };
  };
}
function atLeastOneTrueValidator() {
  return (control) => {
    if (control instanceof FormArray) {
      const formArray = control;
      const isAtLeastOneTrue = formArray.controls.some((c) => c.value === true);
      return isAtLeastOneTrue ? null : { atLeastOneTrue: true };
    }
    return null;
  };
}
function sumToOneValidator(control) {
  const controls = Object.values(control.controls || {});
  if (controls.length === 0) {
    return null;
  }
  const values = controls.map((c) => c.value);
  if (values.some((v) => v === null || typeof v !== "number")) {
    return null;
  }
  const sum = values.reduce((acc, curr) => acc + curr, 0);
  const epsilon = 1e-4;
  if (Math.abs(sum - 1) > epsilon) {
    return { sumMustBeOne: true };
  }
  return null;
}
function fileNameValidator(control) {
  const allowedChars = /^[a-zA-Z0-9][a-zA-Z0-9-._]+$/;
  if (!allowedChars.test(control.value)) {
    return { invalidFilename: true };
  }
  return null;
}

// src/app/utils/daisy-form-control.directive.ts
var DaisyFormControlDirective = class _DaisyFormControlDirective {
  ngControl = inject2(NgControl);
  el = inject2(ElementRef);
  renderer = inject2(Renderer2);
  // Caches the specific error class name to use ('input-error' or 'select-error')
  errorClass = null;
  // Tracks the current applied state to avoid redundant DOM operations
  isErrorClassApplied = false;
  ngDoCheck() {
    const control = this.ngControl.control;
    if (!control)
      return;
    if (this.errorClass === null) {
      const classList = this.el.nativeElement.className.split(/\s+/);
      if (classList.includes("input")) {
        this.errorClass = "input-error";
      } else if (classList.includes("select")) {
        this.errorClass = "select-error";
      }
      if (this.errorClass === null)
        return;
    }
    const shouldHaveError = control.invalid && (control.touched || control.dirty);
    if (this.errorClass) {
      if (shouldHaveError && !this.isErrorClassApplied) {
        this.renderer.addClass(this.el.nativeElement, this.errorClass);
        this.isErrorClassApplied = true;
      } else if (!shouldHaveError && this.isErrorClassApplied) {
        this.renderer.removeClass(this.el.nativeElement, this.errorClass);
        this.isErrorClassApplied = false;
      }
    }
  }
  static \u0275fac = function DaisyFormControlDirective_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _DaisyFormControlDirective)();
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({ type: _DaisyFormControlDirective, selectors: [["", "formControl", "", 3, "ngNoValidate", ""], ["", "formControlName", "", 3, "ngNoValidate", ""]] });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(DaisyFormControlDirective, [{
    type: Directive,
    args: [{
      selector: (
        // eslint-disable-next-line @angular-eslint/directive-selector
        "[formControl]:not([ngNoValidate]), [formControlName]:not([ngNoValidate])"
      ),
      standalone: true
    }]
  }], null, null);
})();

// src/app/create-model-dialog/create-model-dialog.component.ts
var _c012 = () => ({ id: "general", text: "General" });
var _c17 = () => ({ id: "data", text: "Data" });
var _c24 = () => ({ id: "training", text: "Training" });
var _c32 = (a0, a12, a2) => [a0, a12, a2];
var _forTrack09 = ($index, $item) => $item.id;
function CreateModelDialogComponent_For_11_Template(rf, ctx) {
  if (rf & 1) {
    const _r2 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "li", 8)(1, "a", 18);
    \u0275\u0275listener("click", function CreateModelDialogComponent_For_11_Template_a_click_1_listener() {
      const tab_r3 = \u0275\u0275restoreView(_r2).$implicit;
      const ctx_r3 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r3.handleTabClick(tab_r3.id));
    })("keydown.enter", function CreateModelDialogComponent_For_11_Template_a_keydown_enter_1_listener() {
      const tab_r3 = \u0275\u0275restoreView(_r2).$implicit;
      const ctx_r3 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r3.handleTabClick(tab_r3.id));
    });
    \u0275\u0275text(2);
    \u0275\u0275elementEnd()();
  }
  if (rf & 2) {
    const tab_r3 = ctx.$implicit;
    const ctx_r3 = \u0275\u0275nextContext();
    \u0275\u0275advance();
    \u0275\u0275classProp("menu-active", ctx_r3.selectedTab() === tab_r3.id);
    \u0275\u0275advance();
    \u0275\u0275textInterpolate(tab_r3.text);
  }
}
function CreateModelDialogComponent_Conditional_14_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "div", 11)(1, "h3", 19);
    \u0275\u0275text(2, "YAML Preview");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(3, "pre", 20);
    \u0275\u0275element(4, "code", 21);
    \u0275\u0275elementEnd()();
  }
  if (rf & 2) {
    const ctx_r3 = \u0275\u0275nextContext();
    \u0275\u0275advance(4);
    \u0275\u0275property("appHighlight", ctx_r3.yamlPreviewText())("language", "yaml");
  }
}
function CreateModelDialogComponent_Conditional_15_Conditional_12_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "label", 28);
    \u0275\u0275element(1, "input", 35);
    \u0275\u0275text(2, " Use true multi-view models (recommended)");
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const ctx_r3 = \u0275\u0275nextContext(2);
    \u0275\u0275advance();
    \u0275\u0275property("formControl", ctx_r3.form.controls.useTrueMultiviewModel);
  }
}
function CreateModelDialogComponent_Conditional_15_Conditional_18_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "option", 32);
    \u0275\u0275text(1, " --- Select a model type --- ");
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const ctx_r3 = \u0275\u0275nextContext(2);
    \u0275\u0275property("ngValue", ctx_r3.form.controls.modelType.value);
  }
}
function CreateModelDialogComponent_Conditional_15_For_20_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "option", 33);
    \u0275\u0275text(1);
    \u0275\u0275pipe(2, "modelType");
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const type_r5 = ctx.$implicit;
    \u0275\u0275property("value", type_r5);
    \u0275\u0275advance();
    \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(2, 2, type_r5), " ");
  }
}
function CreateModelDialogComponent_Conditional_15_Conditional_25_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "option", 32);
    \u0275\u0275text(1, " --- Select a backbone --- ");
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const ctx_r3 = \u0275\u0275nextContext(2);
    \u0275\u0275property("ngValue", ctx_r3.form.controls.backbone.value);
  }
}
function CreateModelDialogComponent_Conditional_15_For_27_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "option", 33);
    \u0275\u0275text(1);
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const backbone_r6 = ctx.$implicit;
    \u0275\u0275property("value", backbone_r6);
    \u0275\u0275advance();
    \u0275\u0275textInterpolate(backbone_r6);
  }
}
function CreateModelDialogComponent_Conditional_15_Conditional_32_For_4_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "label", 28);
    \u0275\u0275element(1, "input", 35);
    \u0275\u0275text(2);
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const \u0275$index_112_r7 = ctx.$index;
    const ctx_r3 = \u0275\u0275nextContext(3);
    \u0275\u0275advance();
    \u0275\u0275property("formControl", ctx_r3.form.controls.losses.at(\u0275$index_112_r7));
    \u0275\u0275advance();
    \u0275\u0275textInterpolate1(" ", ctx_r3.checkboxOptionLabels[\u0275$index_112_r7]);
  }
}
function CreateModelDialogComponent_Conditional_15_Conditional_32_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "fieldset", 26)(1, "h3", 27);
    \u0275\u0275text(2, "Semi-supervised losses");
    \u0275\u0275elementEnd();
    \u0275\u0275repeaterCreate(3, CreateModelDialogComponent_Conditional_15_Conditional_32_For_4_Template, 3, 2, "label", 28, \u0275\u0275repeaterTrackByIdentity);
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const ctx_r3 = \u0275\u0275nextContext(2);
    \u0275\u0275advance(3);
    \u0275\u0275repeater(ctx_r3.checkboxOptions);
  }
}
function CreateModelDialogComponent_Conditional_15_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "form", 12)(1, "fieldset", 22)(2, "h3", 19);
    \u0275\u0275text(3, "Model name");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(4, "p", 23);
    \u0275\u0275text(5, " The name of the model and the directory that will be created for it. ");
    \u0275\u0275elementEnd();
    \u0275\u0275element(6, "input", 24);
    \u0275\u0275elementStart(7, "p", 25);
    \u0275\u0275text(8, " Invalid name ");
    \u0275\u0275elementEnd()();
    \u0275\u0275elementStart(9, "fieldset", 26)(10, "h3", 27);
    \u0275\u0275text(11, "Model type");
    \u0275\u0275elementEnd();
    \u0275\u0275conditionalCreate(12, CreateModelDialogComponent_Conditional_15_Conditional_12_Template, 3, 1, "label", 28);
    \u0275\u0275elementStart(13, "div", 29)(14, "div", 30)(15, "p", 23);
    \u0275\u0275text(16, "Select the model type");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(17, "select", 31);
    \u0275\u0275conditionalCreate(18, CreateModelDialogComponent_Conditional_15_Conditional_18_Template, 2, 1, "option", 32);
    \u0275\u0275repeaterCreate(19, CreateModelDialogComponent_Conditional_15_For_20_Template, 3, 4, "option", 33, \u0275\u0275repeaterTrackByIdentity);
    \u0275\u0275elementEnd()();
    \u0275\u0275elementStart(21, "div", 30)(22, "p", 23);
    \u0275\u0275text(23, "Select the backbone architecture.");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(24, "select", 31);
    \u0275\u0275conditionalCreate(25, CreateModelDialogComponent_Conditional_15_Conditional_25_Template, 2, 1, "option", 32);
    \u0275\u0275repeaterCreate(26, CreateModelDialogComponent_Conditional_15_For_27_Template, 2, 2, "option", 33, \u0275\u0275repeaterTrackByIdentity);
    \u0275\u0275elementEnd()()();
    \u0275\u0275elementStart(28, "p")(29, "span", 34);
    \u0275\u0275text(30, "info_outline");
    \u0275\u0275elementEnd();
    \u0275\u0275text(31, " The model types and backbone options depend on whether you're using true multi-view models. True multi-view models leverage information from multiple camera views to perform better than models applied independently to all views, but they require more memory. ");
    \u0275\u0275elementEnd()();
    \u0275\u0275conditionalCreate(32, CreateModelDialogComponent_Conditional_15_Conditional_32_Template, 5, 0, "fieldset", 26);
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const ctx_r3 = \u0275\u0275nextContext();
    \u0275\u0275advance(6);
    \u0275\u0275property("formControl", ctx_r3.form.controls.modelName);
    \u0275\u0275advance();
    \u0275\u0275classProp("visible!", ctx_r3.form.controls.modelName.touched && ctx_r3.form.controls.modelName.invalid);
    \u0275\u0275advance(5);
    \u0275\u0275conditional(ctx_r3.isMultiviewProject() ? 12 : -1);
    \u0275\u0275advance(5);
    \u0275\u0275property("formControl", ctx_r3.form.controls.modelType);
    \u0275\u0275advance();
    \u0275\u0275conditional(ctx_r3.modelTypeOptions().indexOf(ctx_r3.form.controls.modelType.value) === -1 ? 18 : -1);
    \u0275\u0275advance();
    \u0275\u0275repeater(ctx_r3.modelTypeOptions());
    \u0275\u0275advance(5);
    \u0275\u0275property("formControl", ctx_r3.form.controls.backbone);
    \u0275\u0275advance();
    \u0275\u0275conditional(ctx_r3.backboneOptions().indexOf(ctx_r3.form.controls.backbone.value) === -1 ? 25 : -1);
    \u0275\u0275advance();
    \u0275\u0275repeater(ctx_r3.backboneOptions());
    \u0275\u0275advance(6);
    \u0275\u0275conditional(ctx_r3.isUnsupervised(ctx_r3.form.controls.modelType.value) ? 32 : -1);
  }
}
function CreateModelDialogComponent_Conditional_16_Conditional_26_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "fieldset", 26)(1, "h3", 27);
    \u0275\u0275text(2, "Semisupervised training");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(3, "p", 23);
    \u0275\u0275text(4, " Select the directory containing videos to train on. ");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(5, "select", 31)(6, "option", 39);
    \u0275\u0275text(7, "videos");
    \u0275\u0275elementEnd()()();
  }
  if (rf & 2) {
    const ctx_r3 = \u0275\u0275nextContext(2);
    \u0275\u0275advance(5);
    \u0275\u0275property("formControl", ctx_r3.form.controls.videosDir);
  }
}
function CreateModelDialogComponent_Conditional_16_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "form", 12)(1, "fieldset", 22)(2, "h3", 19);
    \u0275\u0275text(3, "Labeled frames");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(4, "p", 23);
    \u0275\u0275text(5, " Select the label file for supervised training ");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(6, "select", 31)(7, "option", 36);
    \u0275\u0275text(8, " CollectedData_*.csv ");
    \u0275\u0275elementEnd()()();
    \u0275\u0275elementStart(9, "fieldset", 26)(10, "h3", 27);
    \u0275\u0275text(11, "Train / val split");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(12, "p", 23);
    \u0275\u0275text(13, " Data is split accordingly. The values below must sum to 1. ");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(14, "div", 29)(15, "div", 30)(16, "p", 23);
    \u0275\u0275text(17, "Train prob");
    \u0275\u0275elementEnd();
    \u0275\u0275element(18, "input", 37);
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(19, "div", 30)(20, "p", 23);
    \u0275\u0275text(21, "Val prob");
    \u0275\u0275elementEnd();
    \u0275\u0275element(22, "input", 37);
    \u0275\u0275elementEnd()();
    \u0275\u0275elementStart(23, "p", 23);
    \u0275\u0275text(24, "Random seed");
    \u0275\u0275elementEnd();
    \u0275\u0275element(25, "input", 38);
    \u0275\u0275elementEnd();
    \u0275\u0275conditionalCreate(26, CreateModelDialogComponent_Conditional_16_Conditional_26_Template, 8, 1, "fieldset", 26);
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const ctx_r3 = \u0275\u0275nextContext();
    \u0275\u0275advance(6);
    \u0275\u0275property("formControl", ctx_r3.form.controls.labelFile);
    \u0275\u0275advance(12);
    \u0275\u0275property("formControl", ctx_r3.form.controls.trainValSplit.controls.trainProb);
    \u0275\u0275advance(4);
    \u0275\u0275property("formControl", ctx_r3.form.controls.trainValSplit.controls.valProb);
    \u0275\u0275advance(3);
    \u0275\u0275property("formControl", ctx_r3.form.controls.randomSeed);
    \u0275\u0275advance();
    \u0275\u0275conditional(ctx_r3.isUnsupervised(ctx_r3.form.controls.modelType.value) ? 26 : -1);
  }
}
function CreateModelDialogComponent_Conditional_17_Conditional_18_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "div", 30)(1, "p", 23);
    \u0275\u0275text(2, "Set the unlabeled batch size");
    \u0275\u0275elementEnd();
    \u0275\u0275element(3, "input", 37);
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const ctx_r3 = \u0275\u0275nextContext(2);
    \u0275\u0275advance(3);
    \u0275\u0275property("formControl", ctx_r3.form.controls.unlabeledBatchSize);
  }
}
function CreateModelDialogComponent_Conditional_17_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "form", 12)(1, "fieldset", 22)(2, "h3", 19);
    \u0275\u0275text(3, "Duration");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(4, "p", 23);
    \u0275\u0275text(5, "How many epochs to train for.");
    \u0275\u0275elementEnd();
    \u0275\u0275element(6, "input", 40);
    \u0275\u0275elementStart(7, "p", 25);
    \u0275\u0275text(8);
    \u0275\u0275pipe(9, "json");
    \u0275\u0275elementEnd()();
    \u0275\u0275elementStart(10, "fieldset", 26)(11, "h3", 27);
    \u0275\u0275text(12, "Batch size");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(13, "div", 29)(14, "div", 30)(15, "p", 23);
    \u0275\u0275text(16, "Set the labeled batch size");
    \u0275\u0275elementEnd();
    \u0275\u0275element(17, "input", 37);
    \u0275\u0275elementEnd();
    \u0275\u0275conditionalCreate(18, CreateModelDialogComponent_Conditional_17_Conditional_18_Template, 4, 1, "div", 30);
    \u0275\u0275elementEnd()()();
  }
  if (rf & 2) {
    const ctx_r3 = \u0275\u0275nextContext();
    \u0275\u0275advance(6);
    \u0275\u0275property("formControl", ctx_r3.form.controls.epochs);
    \u0275\u0275advance();
    \u0275\u0275classProp("visible!", ctx_r3.form.controls.epochs.touched && ctx_r3.form.controls.epochs.invalid);
    \u0275\u0275advance();
    \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(9, 6, ctx_r3.form.controls.epochs.errors), " ");
    \u0275\u0275advance(9);
    \u0275\u0275property("formControl", ctx_r3.form.controls.labeledBatchSize);
    \u0275\u0275advance();
    \u0275\u0275conditional(ctx_r3.isUnsupervised(ctx_r3.form.controls.modelType.value) ? 18 : -1);
  }
}
var CreateModelDialogComponent = class _CreateModelDialogComponent {
  done = output();
  selectedTab = signal("general", ...ngDevMode ? [{ debugName: "selectedTab" }] : []);
  yamlPreviewText = signal("", ...ngDevMode ? [{ debugName: "yamlPreviewText" }] : []);
  projectInfoService = inject2(ProjectInfoService);
  sessionService = inject2(SessionService);
  fb = inject2(NonNullableFormBuilder);
  previewAbortController = new AbortController();
  checkboxOptions = ["temporal", "pca_singleview"];
  checkboxOptionLabels = ["Temporal", "Pose PCA"];
  form = this.fb.group({
    modelName: ["", [Validators.required, fileNameValidator]],
    // Initialize to true only for multiview projects.
    useTrueMultiviewModel: [this.isMultiviewProject()],
    modelType: [
      ModelType.SUP,
      [Validators.required, mustBeInOptionsList(() => this.modelTypeOptions)]
    ],
    backbone: [
      this.projectInfoService.projectInfo.views.length > 1 ? "vits_dino" : "resnet50",
      [Validators.required, mustBeInOptionsList(() => this.backboneOptions)]
    ],
    losses: this.fb.array(this.checkboxOptions.map(() => true), atLeastOneTrueValidator()),
    labelFile: "CollectedData_*.csv",
    trainValSplit: this.fb.group({
      trainProb: [
        0.95,
        // Initial value (must be non-zero and <= 1)
        [
          Validators.required,
          Validators.min(1e-6),
          // Ensures value > 0
          Validators.max(1)
        ]
      ],
      valProb: [
        0.05,
        // Initial value (must be non-zero and <= 1)
        [
          Validators.required,
          Validators.min(1e-6),
          // Ensures value > 0
          Validators.max(1)
        ]
      ]
    }, {
      // Apply the custom validator to the entire form group
      validators: sumToOneValidator
    }),
    randomSeed: [0, [Validators.required, Validators.min(0)]],
    videosDir: "videos",
    epochs: [
      300,
      [
        Validators.required,
        Validators.min(5),
        Validators.max(1e6),
        Validators.pattern("^[0-9]+$")
      ]
    ],
    labeledBatchSize: [
      16,
      [
        Validators.required,
        Validators.min(1),
        Validators.max(1e3),
        Validators.pattern("^[0-9]+$")
      ]
    ],
    unlabeledBatchSize: [
      32,
      [
        Validators.required,
        Validators.min(1),
        Validators.max(1e3),
        Validators.pattern("^[0-9]+$")
      ]
    ]
  });
  useTrueMultiviewModelAsSignal = toSignal(this.form.controls.useTrueMultiviewModel.valueChanges.pipe(takeUntilDestroyed()), { initialValue: this.form.controls.useTrueMultiviewModel.value });
  // expose to the template
  modelTypeOptions = computed(() => {
    return this.useTrueMultiviewModelAsSignal() ? validMvModelTypes : Object.values(ModelType);
  }, ...ngDevMode ? [{ debugName: "modelTypeOptions" }] : []);
  backboneOptions = computed(() => {
    return this.useTrueMultiviewModelAsSignal() ? validMvBackbones : backbones;
  }, ...ngDevMode ? [{ debugName: "backboneOptions" }] : []);
  constructor() {
    effect(() => {
      this.useTrueMultiviewModelAsSignal();
      this.form.controls.backbone.updateValueAndValidity();
      this.form.controls.modelType.updateValueAndValidity();
    });
  }
  handleCloseClick() {
    this.done.emit();
  }
  async onCreateClick() {
    const yamlText = await this.generateYamlText();
    if (!yamlText) {
      return;
    }
    await this.sessionService.createTrainingTask(this.form.controls.modelName.value, yamlText);
    this.done.emit();
  }
  async generateYamlText(abortSignal) {
    const defaultPath = "configs/default.yaml";
    try {
      const baseConfig = await this.sessionService.getYamlFile(defaultPath);
      if (abortSignal?.aborted)
        return null;
      if (!baseConfig) {
        window.alert("configs/default.yaml was not found.");
        return null;
      }
      const formObject = this.form.value;
      const patch = this.computeConfigPatch(formObject);
      if (abortSignal?.aborted)
        return null;
      const merged = import_lodash3.default.merge({}, baseConfig, patch);
      const yamlText = stringify5(merged);
      if (abortSignal?.aborted)
        return null;
      return yamlText;
    } catch (error) {
      if (abortSignal?.aborted)
        return null;
      throw error;
    }
  }
  computeConfigPatch(formObject) {
    const configPatchObject = {};
    const patches = [];
    patches.push({
      data: {
        data_dir: this.projectInfoService.projectInfo.data_dir,
        keypoint_names: this.projectInfoService.projectInfo.keypoint_names,
        num_keypoints: this.projectInfoService.projectInfo.keypoint_names.length
      }
    });
    if (this.projectInfoService.projectInfo.views.length > 1) {
      patches.push({
        data: {
          view_names: this.projectInfoService.projectInfo.views
        }
      });
    }
    if (formObject.modelName) {
      patches.push({ model: { model_name: formObject.modelName } });
    }
    if (formObject.modelType) {
      patches.push({
        model: {
          model_type: formObject.useTrueMultiviewModel ? "heatmap_multiview_transformer" : formObject.modelType === ModelType.SUP_CTX || formObject.modelType === ModelType.S_SUP_CTX ? "heatmap_mhcrnn" : "heatmap"
        }
      });
      if (isUnsupervised(formObject.modelType)) {
        patches.push({
          model: {
            losses_to_use: this.checkboxOptions.filter((x, i) => {
              return formObject.losses?.[i] ?? false;
            })
          }
        });
      } else {
        patches.push({
          model: {
            losses_to_use: []
          }
        });
      }
    }
    if (formObject.backbone) {
      patches.push({ model: { backbone: formObject.backbone } });
    }
    if (formObject.labelFile) {
      if (this.projectInfoService.projectInfo.views.length > 1) {
        const csvFiles = [];
        for (const view of this.projectInfoService.projectInfo.views) {
          csvFiles.push(formObject.labelFile.replace("*", view));
        }
        patches.push({ data: { csv_file: csvFiles } });
      } else {
        patches.push({ data: { csv_file: formObject.labelFile } });
      }
    }
    if (formObject.trainValSplit) {
      patches.push({
        training: {
          train_prob: formObject.trainValSplit.trainProb,
          val_prob: formObject.trainValSplit.valProb
        }
      });
    }
    if (formObject.randomSeed) {
      patches.push({
        training: {
          rng_seed_data_pt: formObject.randomSeed
        }
      });
    }
    if (formObject.videosDir) {
      patches.push({
        data: {
          video_dir: this.projectInfoService.projectInfo.data_dir + "/" + formObject.videosDir
        }
      });
    }
    if (formObject.epochs) {
      patches.push({
        training: {
          min_epochs: formObject.epochs,
          max_epochs: formObject.epochs
        }
      });
    }
    if (formObject.labeledBatchSize) {
      patches.push({
        training: {
          train_batch_size: formObject.labeledBatchSize
        }
      });
    }
    if (formObject.unlabeledBatchSize) {
      patches.push({
        dali: {
          base: {
            train: { sequence_length: formObject.unlabeledBatchSize }
          },
          context: {
            train: { batch_size: formObject.unlabeledBatchSize }
          }
        }
      });
    }
    import_lodash3.default.merge(configPatchObject, ...patches);
    return configPatchObject;
  }
  async onPreviewYamlClick() {
    this.previewAbortController.abort();
    this.previewAbortController = new AbortController();
    const abortSignal = this.previewAbortController.signal;
    const yamlText = await this.generateYamlText(abortSignal);
    if (abortSignal.aborted || !yamlText) {
      return;
    }
    this.yamlPreviewText.set(yamlText);
    this.handleTabClick("yaml");
  }
  handleTabClick(tabId) {
    this.selectedTab.set(tabId);
  }
  formInvalidReason() {
    for (const [name2, control] of Object.entries(this.form.controls)) {
      if (control.invalid) {
        return `${name2} invalid`;
      }
    }
    return "";
  }
  isMultiviewProject() {
    return this.projectInfoService.projectInfo.views.length > 1;
  }
  isUnsupervised = isUnsupervised;
  static \u0275fac = function CreateModelDialogComponent_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _CreateModelDialogComponent)();
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _CreateModelDialogComponent, selectors: [["app-create-model-dialog"]], outputs: { done: "done" }, decls: 28, vars: 16, consts: [["open", "", 1, "modal"], [1, "modal-box", "overflow-x-hidden", "w-5/6", "max-w-3xl", "h-2/3", "max-h-150"], [1, "flex", "flex-col", "h-full"], [1, "btn", "btn-md", "btn-circle", "btn-ghost", "absolute", "right-4", "top-4", 3, "click"], [1, "text-xl", "font-bold", "text-nowrap", "mb-4"], [1, "flex", "gap-2", "w-full", "grow", "shrink", "min-h-0"], [1, "flex", "flex-col", "justify-between"], [1, "menu", "min-w-50", "steps", "steps-vertical"], [1, "step"], [1, "divider", "divider-vertical"], [1, "overflow-y-auto", "prose"], [1, "px-4", "flex", "flex-col", "max-h-full"], [1, "prose", "px-4"], [1, "shrink-0", "modal-action", "justify-between!"], [1, "menu", "min-w-50"], ["tabindex", "0", 1, "opacity-40", "hover:opacity-100", 3, "click", "keydown.enter"], [1, "tooltip", "tooltip-left"], [1, "btn", "btn-soft", "btn-primary", 3, "click"], ["tabindex", "0", 3, "click", "keydown.enter"], [1, "text-md", "mt-0"], [1, "rounded-box", "bg-base-200", "overflow-auto", "p-0"], [1, "hljs", "w-max", 3, "appHighlight", "language"], [1, "fieldset", "my-6"], [1, "m-0!"], ["name", "modelName", "type", "text", "placeholder", "my_model", "spellcheck", "false", 1, "input", "w-full", 3, "formControl"], [1, "my-0!", "text-error", "invisible"], [1, "fieldset", "my-2"], [1, "text-md", "mt-0!"], [1, "flex", "gap-2", "cursor-pointer", "mb-2"], [1, "flex", "gap-4", "items-start"], [1, "grow"], ["spellcheck", "false", 1, "select", 3, "formControl"], [3, "ngValue"], [3, "value"], [1, "material-icons", "text-sm!", "align-middle"], ["type", "checkbox", 1, "checkbox", 3, "formControl"], ["value", "CollectedData_*.csv"], ["type", "number", 1, "input", "w-full", 3, "formControl"], ["type", "number", "step", "1", "min", "0", 1, "input", 3, "formControl"], ["value", "videos"], ["type", "number", 1, "input", 3, "formControl"]], template: function CreateModelDialogComponent_Template(rf, ctx) {
    if (rf & 1) {
      const _r1 = \u0275\u0275getCurrentView();
      \u0275\u0275elementStart(0, "dialog", 0)(1, "div", 1)(2, "div", 2)(3, "button", 3);
      \u0275\u0275listener("click", function CreateModelDialogComponent_Template_button_click_3_listener() {
        \u0275\u0275restoreView(_r1);
        return \u0275\u0275resetView(ctx.handleCloseClick());
      });
      \u0275\u0275text(4, " \u2715 ");
      \u0275\u0275elementEnd();
      \u0275\u0275elementStart(5, "h3", 4);
      \u0275\u0275text(6, "Model creation");
      \u0275\u0275elementEnd();
      \u0275\u0275elementStart(7, "div", 5)(8, "div", 6)(9, "ul", 7);
      \u0275\u0275repeaterCreate(10, CreateModelDialogComponent_For_11_Template, 3, 3, "li", 8, _forTrack09);
      \u0275\u0275elementEnd()();
      \u0275\u0275element(12, "div", 9);
      \u0275\u0275elementStart(13, "div", 10);
      \u0275\u0275conditionalCreate(14, CreateModelDialogComponent_Conditional_14_Template, 5, 2, "div", 11);
      \u0275\u0275conditionalCreate(15, CreateModelDialogComponent_Conditional_15_Template, 33, 9, "form", 12);
      \u0275\u0275conditionalCreate(16, CreateModelDialogComponent_Conditional_16_Template, 27, 5, "form", 12);
      \u0275\u0275conditionalCreate(17, CreateModelDialogComponent_Conditional_17_Template, 19, 8, "form", 12);
      \u0275\u0275elementEnd()();
      \u0275\u0275elementStart(18, "footer", 13)(19, "div")(20, "ul", 14)(21, "li")(22, "a", 15);
      \u0275\u0275listener("click", function CreateModelDialogComponent_Template_a_click_22_listener() {
        \u0275\u0275restoreView(_r1);
        return \u0275\u0275resetView(ctx.onPreviewYamlClick());
      })("keydown.enter", function CreateModelDialogComponent_Template_a_keydown_enter_22_listener() {
        \u0275\u0275restoreView(_r1);
        return \u0275\u0275resetView(ctx.onPreviewYamlClick());
      });
      \u0275\u0275text(23, "Preview YAML");
      \u0275\u0275elementEnd()()()();
      \u0275\u0275elementStart(24, "div")(25, "span", 16)(26, "button", 17);
      \u0275\u0275listener("click", function CreateModelDialogComponent_Template_button_click_26_listener() {
        \u0275\u0275restoreView(_r1);
        return \u0275\u0275resetView(ctx.onCreateClick());
      });
      \u0275\u0275text(27, " Create ");
      \u0275\u0275elementEnd()()()()()()();
    }
    if (rf & 2) {
      const tabs_r8 = \u0275\u0275pureFunction3(12, _c32, \u0275\u0275pureFunction0(9, _c012), \u0275\u0275pureFunction0(10, _c17), \u0275\u0275pureFunction0(11, _c24));
      \u0275\u0275advance(10);
      \u0275\u0275repeater(tabs_r8);
      \u0275\u0275advance(4);
      \u0275\u0275conditional(ctx.selectedTab() === "yaml" ? 14 : -1);
      \u0275\u0275advance();
      \u0275\u0275conditional(ctx.selectedTab() === "general" ? 15 : -1);
      \u0275\u0275advance();
      \u0275\u0275conditional(ctx.selectedTab() === "data" ? 16 : -1);
      \u0275\u0275advance();
      \u0275\u0275conditional(ctx.selectedTab() === "training" ? 17 : -1);
      \u0275\u0275advance(5);
      \u0275\u0275classProp("menu-active", ctx.selectedTab() === "yaml");
      \u0275\u0275advance(3);
      \u0275\u0275attribute("data-tip", ctx.formInvalidReason());
      \u0275\u0275advance();
      \u0275\u0275classProp("btn-disabled", !ctx.form.valid);
    }
  }, dependencies: [
    FormsModule,
    \u0275NgNoValidate,
    NgSelectOption,
    \u0275NgSelectMultipleOption,
    DefaultValueAccessor,
    NumberValueAccessor,
    CheckboxControlValueAccessor,
    SelectControlValueAccessor,
    NgControlStatus,
    NgControlStatusGroup,
    MinValidator,
    NgForm,
    ReactiveFormsModule,
    FormControlDirective,
    HighlightDirective,
    DaisyFormControlDirective,
    ModelTypeLabelPipe,
    JsonPipe
  ], styles: ["\n\ninput[_ngcontent-%COMP%]::placeholder {\n  color: color-mix(in oklab, var(--color-base-content) 50%, #0000) !important;\n}\n/*# sourceMappingURL=/static/create-model-dialog.component-XM4MKM6L.css.map */"], changeDetection: 0 });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CreateModelDialogComponent, [{
    type: Component,
    args: [{ selector: "app-create-model-dialog", imports: [
      FormsModule,
      ReactiveFormsModule,
      ModelTypeLabelPipe,
      JsonPipe,
      HighlightDirective,
      DaisyFormControlDirective
    ], changeDetection: ChangeDetectionStrategy.OnPush, template: `<dialog class="modal" open>
  <div class="modal-box overflow-x-hidden w-5/6 max-w-3xl h-2/3 max-h-150">
    <div class="flex flex-col h-full">
      <button
        class="btn btn-md btn-circle btn-ghost absolute right-4 top-4"
        (click)="handleCloseClick()"
      >
        \u2715
      </button>
      <!-- Header -->
      <h3 class="text-xl font-bold text-nowrap mb-4">Model creation</h3>

      <div class="flex gap-2 w-full grow shrink min-h-0">
        <div class="flex flex-col justify-between">
          <ul class="menu min-w-50 steps steps-vertical">
            @let tabs =
              [
                { id: "general", text: "General" },
                { id: "data", text: "Data" },
                { id: "training", text: "Training" },
              ];
            @for (tab of tabs; track tab.id) {
              <li class="step">
                <a
                  [class.menu-active]="selectedTab() === tab.id"
                  tabindex="0"
                  (click)="handleTabClick(tab.id)"
                  (keydown.enter)="handleTabClick(tab.id)"
                  >{{ tab.text }}</a
                >
              </li>
            }
          </ul>
        </div>
        <div class="divider divider-vertical"></div>
        <div class="overflow-y-auto prose">
          @if (selectedTab() === "yaml") {
            <div class="px-4 flex flex-col max-h-full">
              <h3 class="text-md mt-0">YAML Preview</h3>
              <pre
                class="rounded-box bg-base-200 overflow-auto p-0"
              ><code class="hljs w-max" [appHighlight]="yamlPreviewText()" [language]="'yaml'"></code></pre>
            </div>
          }
          @if (selectedTab() === "general") {
            <form class="prose px-4">
              <fieldset class="fieldset my-6">
                <h3 class="text-md mt-0">Model name</h3>
                <p class="m-0!">
                  The name of the model and the directory that will be created
                  for it.
                </p>

                <input
                  name="modelName"
                  type="text"
                  class="input w-full"
                  placeholder="my_model"
                  spellcheck="false"
                  [formControl]="form.controls.modelName"
                />
                <p
                  class="my-0! text-error invisible"
                  [class.visible!]="
                    form.controls.modelName.touched &&
                    form.controls.modelName.invalid
                  "
                >
                  Invalid name
                </p>
              </fieldset>
              <fieldset class="fieldset my-2">
                <h3 class="text-md mt-0!">Model type</h3>

                @if (isMultiviewProject()) {
                  <label class="flex gap-2 cursor-pointer mb-2">
                    <input
                      type="checkbox"
                      class="checkbox"
                      [formControl]="form.controls.useTrueMultiviewModel"
                    />
                    Use true multi-view models (recommended)</label
                  >
                }

                <div class="flex gap-4 items-start">
                  <div class="grow">
                    <p class="m-0!">Select the model type</p>
                    <select
                      class="select"
                      spellcheck="false"
                      [formControl]="form.controls.modelType"
                    >
                      @if (
                        modelTypeOptions().indexOf(
                          form.controls.modelType.value
                        ) === -1
                      ) {
                        <option [ngValue]="form.controls.modelType.value">
                          --- Select a model type ---
                        </option>
                      }
                      @for (type of modelTypeOptions(); track type) {
                        <option [value]="type">
                          {{ type | modelType }}
                        </option>
                      }
                    </select>
                  </div>
                  <div class="grow">
                    <p class="m-0!">Select the backbone architecture.</p>
                    <select
                      class="select"
                      spellcheck="false"
                      [formControl]="form.controls.backbone"
                    >
                      @if (
                        backboneOptions().indexOf(
                          form.controls.backbone.value
                        ) === -1
                      ) {
                        <option [ngValue]="form.controls.backbone.value">
                          --- Select a backbone ---
                        </option>
                      }
                      @for (backbone of backboneOptions(); track backbone) {
                        <option [value]="backbone">{{ backbone }}</option>
                      }
                    </select>
                  </div>
                </div>
                <p>
                  <span class="material-icons text-sm! align-middle"
                    >info_outline</span
                  >
                  The model types and backbone options depend on whether you're
                  using true multi-view models. True multi-view models leverage
                  information from multiple camera views to perform better than
                  models applied independently to all views, but they require
                  more memory.
                </p>
              </fieldset>

              @if (isUnsupervised(form.controls.modelType.value)) {
                <fieldset class="fieldset my-2">
                  <h3 class="text-md mt-0!">Semi-supervised losses</h3>
                  @for (
                    option of checkboxOptions;
                    track option;
                    let i = $index
                  ) {
                    <label class="flex gap-2 cursor-pointer mb-2">
                      <input
                        type="checkbox"
                        class="checkbox"
                        [formControl]="form.controls.losses.at(i)"
                      />
                      {{ checkboxOptionLabels[i] }}</label
                    >
                  }
                </fieldset>
              }
            </form>
          }
          @if (selectedTab() === "data") {
            <form class="prose px-4">
              <fieldset class="fieldset my-6">
                <h3 class="text-md mt-0">Labeled frames</h3>
                <p class="m-0!">
                  Select the label file for supervised training
                </p>

                <select
                  class="select"
                  spellcheck="false"
                  [formControl]="form.controls.labelFile"
                >
                  <option value="CollectedData_*.csv">
                    CollectedData_*.csv
                  </option>
                </select>
              </fieldset>
              <fieldset class="fieldset my-2">
                <h3 class="text-md mt-0!">Train / val split</h3>
                <p class="m-0!">
                  Data is split accordingly. The values below must sum to 1.
                </p>
                <div class="flex gap-4 items-start">
                  <div class="grow">
                    <p class="m-0!">Train prob</p>
                    <input
                      type="number"
                      class="input w-full"
                      [formControl]="
                        form.controls.trainValSplit.controls.trainProb
                      "
                    />
                  </div>
                  <div class="grow">
                    <p class="m-0!">Val prob</p>
                    <input
                      type="number"
                      class="input w-full"
                      [formControl]="
                        form.controls.trainValSplit.controls.valProb
                      "
                    />
                  </div>
                </div>
                <p class="m-0!">Random seed</p>
                <input
                  type="number"
                  step="1"
                  class="input"
                  min="0"
                  [formControl]="form.controls.randomSeed"
                />
              </fieldset>
              @if (isUnsupervised(form.controls.modelType.value)) {
                <fieldset class="fieldset my-2">
                  <h3 class="text-md mt-0!">Semisupervised training</h3>
                  <p class="m-0!">
                    Select the directory containing videos to train on.
                  </p>
                  <select
                    class="select"
                    spellcheck="false"
                    [formControl]="form.controls.videosDir"
                  >
                    <option value="videos">videos</option>
                  </select>
                </fieldset>
              }
            </form>
          }
          @if (selectedTab() === "training") {
            <form class="prose px-4">
              <fieldset class="fieldset my-6">
                <h3 class="text-md mt-0">Duration</h3>
                <p class="m-0!">How many epochs to train for.</p>
                <input
                  type="number"
                  class="input"
                  [formControl]="form.controls.epochs"
                />
                <p
                  class="my-0! text-error invisible"
                  [class.visible!]="
                    form.controls.epochs.touched && form.controls.epochs.invalid
                  "
                >
                  {{ form.controls.epochs.errors | json }}
                </p>
              </fieldset>
              <fieldset class="fieldset my-2">
                <h3 class="text-md mt-0!">Batch size</h3>
                <div class="flex gap-4 items-start">
                  <div class="grow">
                    <p class="m-0!">Set the labeled batch size</p>
                    <input
                      type="number"
                      class="input w-full"
                      [formControl]="form.controls.labeledBatchSize"
                    />
                  </div>
                  @if (isUnsupervised(form.controls.modelType.value)) {
                    <div class="grow">
                      <p class="m-0!">Set the unlabeled batch size</p>
                      <input
                        type="number"
                        class="input w-full"
                        [formControl]="form.controls.unlabeledBatchSize"
                      />
                    </div>
                  }
                </div>
              </fieldset>
            </form>
          }
        </div>
      </div>

      <footer class="shrink-0 modal-action justify-between!">
        <div>
          <ul class="menu min-w-50">
            <li>
              <a
                class="opacity-40 hover:opacity-100"
                [class.menu-active]="selectedTab() === 'yaml'"
                tabindex="0"
                (click)="onPreviewYamlClick()"
                (keydown.enter)="onPreviewYamlClick()"
                >Preview YAML</a
              >
            </li>
          </ul>
        </div>
        <div>
          <!-- adding the tooltip causes horizontal scrollbar for some reason.
          Fixed with overflow-x-hidden on the modal-box. -->
          <span
            class="tooltip tooltip-left"
            [attr.data-tip]="formInvalidReason()"
            ><button
              class="btn btn-soft btn-primary"
              (click)="onCreateClick()"
              [class.btn-disabled]="!form.valid"
            >
              Create
            </button></span
          >
        </div>
      </footer>
    </div>
  </div>
</dialog>
`, styles: ["/* src/app/create-model-dialog/create-model-dialog.component.css */\ninput::placeholder {\n  color: color-mix(in oklab, var(--color-base-content) 50%, #0000) !important;\n}\n/*# sourceMappingURL=/static/create-model-dialog.component-XM4MKM6L.css.map */\n"] }]
  }], () => [], null);
})();
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(CreateModelDialogComponent, { className: "CreateModelDialogComponent", filePath: "src/app/create-model-dialog/create-model-dialog.component.ts", lineNumber: 55 });
})();

// node_modules/@angular/cdk/fesm2022/listbox.mjs
var ListboxSelectionModel = class extends SelectionModel {
  multiple;
  constructor(multiple = false, initiallySelectedValues, emitChanges = true, compareWith) {
    super(true, initiallySelectedValues, emitChanges, compareWith);
    this.multiple = multiple;
  }
  isMultipleSelection() {
    return this.multiple;
  }
  select(...values) {
    if (this.multiple) {
      return super.select(...values);
    } else {
      return super.setSelection(...values);
    }
  }
};
var CdkOption = class _CdkOption {
  /** The id of the option's host element. */
  get id() {
    return this._id || this._generatedId;
  }
  set id(value) {
    this._id = value;
  }
  _id;
  _generatedId = inject2(_IdGenerator).getId("cdk-option-");
  /** The value of this option. */
  value;
  /**
   * The text used to locate this item during listbox typeahead. If not specified,
   * the `textContent` of the item will be used.
   */
  typeaheadLabel;
  /** Whether this option is disabled. */
  get disabled() {
    return this.listbox.disabled || this._disabled();
  }
  set disabled(value) {
    this._disabled.set(value);
  }
  _disabled = signal(false);
  /** The tabindex of the option when it is enabled. */
  get enabledTabIndex() {
    return this._enabledTabIndex() === void 0 ? this.listbox.enabledTabIndex : this._enabledTabIndex();
  }
  set enabledTabIndex(value) {
    this._enabledTabIndex.set(value);
  }
  _enabledTabIndex = signal(void 0);
  /** The option's host element */
  element = inject2(ElementRef).nativeElement;
  /** The parent listbox this option belongs to. */
  listbox = inject2(CdkListbox);
  /** Emits when the option is destroyed. */
  destroyed = new Subject();
  /** Emits when the option is clicked. */
  _clicked = new Subject();
  ngOnDestroy() {
    this.destroyed.next();
    this.destroyed.complete();
  }
  /** Whether this option is selected. */
  isSelected() {
    return this.listbox.isSelected(this);
  }
  /** Whether this option is active. */
  isActive() {
    return this.listbox.isActive(this);
  }
  /** Toggle the selected state of this option. */
  toggle() {
    this.listbox.toggle(this);
  }
  /** Select this option if it is not selected. */
  select() {
    this.listbox.select(this);
  }
  /** Deselect this option if it is selected. */
  deselect() {
    this.listbox.deselect(this);
  }
  /** Focus this option. */
  focus() {
    this.element.focus();
  }
  /** Get the label for this element which is required by the FocusableOption interface. */
  getLabel() {
    return (this.typeaheadLabel ?? this.element.textContent?.trim()) || "";
  }
  /**
   * No-op implemented as a part of `Highlightable`.
   * @docs-private
   */
  setActiveStyles() {
    if (this.listbox.useActiveDescendant) {
      this.element.scrollIntoView({
        block: "nearest",
        inline: "nearest"
      });
    }
  }
  /**
   * No-op implemented as a part of `Highlightable`.
   * @docs-private
   */
  setInactiveStyles() {
  }
  /** Handle focus events on the option. */
  _handleFocus() {
    if (this.listbox.useActiveDescendant) {
      this.listbox._setActiveOption(this);
      this.listbox.focus();
    }
  }
  /** Get the tabindex for this option. */
  _getTabIndex() {
    if (this.listbox.useActiveDescendant || this.disabled) {
      return -1;
    }
    return this.isActive() ? this.enabledTabIndex : -1;
  }
  static \u0275fac = function CdkOption_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _CdkOption)();
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _CdkOption,
    selectors: [["", "cdkOption", ""]],
    hostAttrs: ["role", "option", 1, "cdk-option"],
    hostVars: 6,
    hostBindings: function CdkOption_HostBindings(rf, ctx) {
      if (rf & 1) {
        \u0275\u0275listener("click", function CdkOption_click_HostBindingHandler($event) {
          return ctx._clicked.next($event);
        })("focus", function CdkOption_focus_HostBindingHandler() {
          return ctx._handleFocus();
        });
      }
      if (rf & 2) {
        \u0275\u0275domProperty("id", ctx.id);
        \u0275\u0275attribute("aria-selected", ctx.isSelected())("tabindex", ctx._getTabIndex())("aria-disabled", ctx.disabled);
        \u0275\u0275classProp("cdk-option-active", ctx.isActive());
      }
    },
    inputs: {
      id: "id",
      value: [0, "cdkOption", "value"],
      typeaheadLabel: [0, "cdkOptionTypeaheadLabel", "typeaheadLabel"],
      disabled: [2, "cdkOptionDisabled", "disabled", booleanAttribute],
      enabledTabIndex: [0, "tabindex", "enabledTabIndex"]
    },
    exportAs: ["cdkOption"]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CdkOption, [{
    type: Directive,
    args: [{
      selector: "[cdkOption]",
      exportAs: "cdkOption",
      host: {
        "role": "option",
        "class": "cdk-option",
        "[id]": "id",
        "[attr.aria-selected]": "isSelected()",
        "[attr.tabindex]": "_getTabIndex()",
        "[attr.aria-disabled]": "disabled",
        "[class.cdk-option-active]": "isActive()",
        "(click)": "_clicked.next($event)",
        "(focus)": "_handleFocus()"
      }
    }]
  }], null, {
    id: [{
      type: Input
    }],
    value: [{
      type: Input,
      args: ["cdkOption"]
    }],
    typeaheadLabel: [{
      type: Input,
      args: ["cdkOptionTypeaheadLabel"]
    }],
    disabled: [{
      type: Input,
      args: [{
        alias: "cdkOptionDisabled",
        transform: booleanAttribute
      }]
    }],
    enabledTabIndex: [{
      type: Input,
      args: ["tabindex"]
    }]
  });
})();
var CdkListbox = class _CdkListbox {
  _cleanupWindowBlur;
  /** The id of the option's host element. */
  get id() {
    return this._id || this._generatedId;
  }
  set id(value) {
    this._id = value;
  }
  _id;
  _generatedId = inject2(_IdGenerator).getId("cdk-listbox-");
  /** The tabindex to use when the listbox is enabled. */
  get enabledTabIndex() {
    return this._enabledTabIndex() === void 0 ? 0 : this._enabledTabIndex();
  }
  set enabledTabIndex(value) {
    this._enabledTabIndex.set(value);
  }
  _enabledTabIndex = signal(void 0);
  /** The value selected in the listbox, represented as an array of option values. */
  get value() {
    return this._invalid ? [] : this.selectionModel.selected;
  }
  set value(value) {
    this._setSelection(value);
  }
  /**
   * Whether the listbox allows multiple options to be selected. If the value switches from `true`
   * to `false`, and more than one option is selected, all options are deselected.
   */
  get multiple() {
    return this.selectionModel.multiple;
  }
  set multiple(value) {
    this.selectionModel.multiple = value;
    if (this.options) {
      this._updateInternalValue();
    }
  }
  /** Whether the listbox is disabled. */
  get disabled() {
    return this._disabled();
  }
  set disabled(value) {
    this._disabled.set(value);
  }
  _disabled = signal(false);
  /** Whether the listbox will use active descendant or will move focus onto the options. */
  get useActiveDescendant() {
    return this._useActiveDescendant();
  }
  set useActiveDescendant(value) {
    this._useActiveDescendant.set(value);
  }
  _useActiveDescendant = signal(false);
  /** The orientation of the listbox. Only affects keyboard interaction, not visual layout. */
  get orientation() {
    return this._orientation;
  }
  set orientation(value) {
    this._orientation = value === "horizontal" ? "horizontal" : "vertical";
    if (value === "horizontal") {
      this.listKeyManager?.withHorizontalOrientation(this._dir?.value || "ltr");
    } else {
      this.listKeyManager?.withVerticalOrientation();
    }
  }
  _orientation = "vertical";
  /** The function used to compare option values. */
  get compareWith() {
    return this.selectionModel.compareWith;
  }
  set compareWith(fn) {
    this.selectionModel.compareWith = fn;
  }
  /**
   * Whether the keyboard navigation should wrap when the user presses arrow down on the last item
   * or arrow up on the first item.
   */
  get navigationWrapDisabled() {
    return this._navigationWrapDisabled;
  }
  set navigationWrapDisabled(wrap) {
    this._navigationWrapDisabled = wrap;
    this.listKeyManager?.withWrap(!this._navigationWrapDisabled);
  }
  _navigationWrapDisabled = false;
  /** Whether keyboard navigation should skip over disabled items. */
  get navigateDisabledOptions() {
    return this._navigateDisabledOptions;
  }
  set navigateDisabledOptions(skip2) {
    this._navigateDisabledOptions = skip2;
    this.listKeyManager?.skipPredicate(this._navigateDisabledOptions ? this._skipNonePredicate : this._skipDisabledPredicate);
  }
  _navigateDisabledOptions = false;
  /** Emits when the selected value(s) in the listbox change. */
  valueChange = new Subject();
  /** The child options in this listbox. */
  options;
  /** The selection model used by the listbox. */
  selectionModel = new ListboxSelectionModel();
  /** The key manager that manages keyboard navigation for this listbox. */
  listKeyManager;
  /** Emits when the listbox is destroyed. */
  destroyed = new Subject();
  /** The host element of the listbox. */
  element = inject2(ElementRef).nativeElement;
  /** The Angular zone. */
  ngZone = inject2(NgZone);
  /** The change detector for this listbox. */
  changeDetectorRef = inject2(ChangeDetectorRef);
  /** Whether the currently selected value in the selection model is invalid. */
  _invalid = false;
  /** The last user-triggered option. */
  _lastTriggered = null;
  /** Callback called when the listbox has been touched */
  _onTouched = () => {
  };
  /** Callback called when the listbox value changes */
  _onChange = () => {
  };
  /** Emits when an option has been clicked. */
  _optionClicked = defer(() => this.options.changes.pipe(startWith(this.options), switchMap((options) => merge(...options.map((option) => option._clicked.pipe(map((event) => ({
    option,
    event
  }))))))));
  /** The directionality of the page. */
  _dir = inject2(Directionality, {
    optional: true
  });
  /** Whether the component is being rendered in the browser. */
  _isBrowser = inject2(Platform).isBrowser;
  /** A predicate that skips disabled options. */
  _skipDisabledPredicate = (option) => option.disabled;
  /** A predicate that does not skip any options. */
  _skipNonePredicate = () => false;
  /** Whether the listbox currently has focus. */
  _hasFocus = false;
  /** A reference to the option that was active before the listbox lost focus. */
  _previousActiveOption = null;
  constructor() {
    if (this._isBrowser) {
      const renderer = inject2(Renderer2);
      this._cleanupWindowBlur = this.ngZone.runOutsideAngular(() => {
        return renderer.listen("window", "blur", () => {
          if (this.element.contains(document.activeElement) && this._previousActiveOption) {
            this._setActiveOption(this._previousActiveOption);
            this._previousActiveOption = null;
          }
        });
      });
    }
  }
  ngAfterContentInit() {
    if (typeof ngDevMode === "undefined" || ngDevMode) {
      this._verifyNoOptionValueCollisions();
      this._verifyOptionValues();
    }
    this._initKeyManager();
    merge(this.selectionModel.changed, this.options.changes).pipe(startWith(null), takeUntil(this.destroyed)).subscribe(() => this._updateInternalValue());
    this._optionClicked.pipe(filter(({
      option
    }) => !option.disabled), takeUntil(this.destroyed)).subscribe(({
      option,
      event
    }) => this._handleOptionClicked(option, event));
  }
  ngOnDestroy() {
    this._cleanupWindowBlur?.();
    this.listKeyManager?.destroy();
    this.destroyed.next();
    this.destroyed.complete();
  }
  /**
   * Toggle the selected state of the given option.
   * @param option The option to toggle
   */
  toggle(option) {
    this.toggleValue(option.value);
  }
  /**
   * Toggle the selected state of the given value.
   * @param value The value to toggle
   */
  toggleValue(value) {
    if (this._invalid) {
      this.selectionModel.clear(false);
    }
    this.selectionModel.toggle(value);
  }
  /**
   * Select the given option.
   * @param option The option to select
   */
  select(option) {
    this.selectValue(option.value);
  }
  /**
   * Select the given value.
   * @param value The value to select
   */
  selectValue(value) {
    if (this._invalid) {
      this.selectionModel.clear(false);
    }
    this.selectionModel.select(value);
  }
  /**
   * Deselect the given option.
   * @param option The option to deselect
   */
  deselect(option) {
    this.deselectValue(option.value);
  }
  /**
   * Deselect the given value.
   * @param value The value to deselect
   */
  deselectValue(value) {
    if (this._invalid) {
      this.selectionModel.clear(false);
    }
    this.selectionModel.deselect(value);
  }
  /**
   * Set the selected state of all options.
   * @param isSelected The new selected state to set
   */
  setAllSelected(isSelected) {
    if (!isSelected) {
      this.selectionModel.clear();
    } else {
      if (this._invalid) {
        this.selectionModel.clear(false);
      }
      this.selectionModel.select(...this.options.map((option) => option.value));
    }
  }
  /**
   * Get whether the given option is selected.
   * @param option The option to get the selected state of
   */
  isSelected(option) {
    return this.isValueSelected(option.value);
  }
  /**
   * Get whether the given option is active.
   * @param option The option to get the active state of
   */
  isActive(option) {
    return !!(this.listKeyManager?.activeItem === option);
  }
  /**
   * Get whether the given value is selected.
   * @param value The value to get the selected state of
   */
  isValueSelected(value) {
    if (this._invalid) {
      return false;
    }
    return this.selectionModel.isSelected(value);
  }
  /**
   * Registers a callback to be invoked when the listbox's value changes from user input.
   * @param fn The callback to register
   * @docs-private
   */
  registerOnChange(fn) {
    this._onChange = fn;
  }
  /**
   * Registers a callback to be invoked when the listbox is blurred by the user.
   * @param fn The callback to register
   * @docs-private
   */
  registerOnTouched(fn) {
    this._onTouched = fn;
  }
  /**
   * Sets the listbox's value.
   * @param value The new value of the listbox
   * @docs-private
   */
  writeValue(value) {
    this._setSelection(value);
    this._verifyOptionValues();
  }
  /**
   * Sets the disabled state of the listbox.
   * @param isDisabled The new disabled state
   * @docs-private
   */
  setDisabledState(isDisabled) {
    this.disabled = isDisabled;
    this.changeDetectorRef.markForCheck();
  }
  /** Focus the listbox's host element. */
  focus() {
    this.element.focus();
  }
  /**
   * Triggers the given option in response to user interaction.
   * - In single selection mode: selects the option and deselects any other selected option.
   * - In multi selection mode: toggles the selected state of the option.
   * @param option The option to trigger
   */
  triggerOption(option) {
    if (option && !option.disabled) {
      this._lastTriggered = option;
      const changed = this.multiple ? this.selectionModel.toggle(option.value) : this.selectionModel.select(option.value);
      if (changed) {
        this._onChange(this.value);
        this.valueChange.next({
          value: this.value,
          listbox: this,
          option
        });
      }
    }
  }
  /**
   * Trigger the given range of options in response to user interaction.
   * Should only be called in multi-selection mode.
   * @param trigger The option that was triggered
   * @param from The start index of the options to toggle
   * @param to The end index of the options to toggle
   * @param on Whether to toggle the option range on
   */
  triggerRange(trigger, from2, to, on) {
    if (this.disabled || trigger && trigger.disabled) {
      return;
    }
    this._lastTriggered = trigger;
    const isEqual = this.compareWith ?? Object.is;
    const updateValues = [...this.options].slice(Math.max(0, Math.min(from2, to)), Math.min(this.options.length, Math.max(from2, to) + 1)).filter((option) => !option.disabled).map((option) => option.value);
    const selected = [...this.value];
    for (const updateValue of updateValues) {
      const selectedIndex = selected.findIndex((selectedValue) => isEqual(selectedValue, updateValue));
      if (on && selectedIndex === -1) {
        selected.push(updateValue);
      } else if (!on && selectedIndex !== -1) {
        selected.splice(selectedIndex, 1);
      }
    }
    let changed = this.selectionModel.setSelection(...selected);
    if (changed) {
      this._onChange(this.value);
      this.valueChange.next({
        value: this.value,
        listbox: this,
        option: trigger
      });
    }
  }
  /**
   * Sets the given option as active.
   * @param option The option to make active
   */
  _setActiveOption(option) {
    this.listKeyManager.setActiveItem(option);
  }
  /** Called when the listbox receives focus. */
  _handleFocus() {
    if (!this.useActiveDescendant) {
      if (this.selectionModel.selected.length > 0) {
        this._setNextFocusToSelectedOption();
      } else {
        this.listKeyManager.setNextItemActive();
      }
      this._focusActiveOption();
    }
  }
  /** Called when the user presses keydown on the listbox. */
  _handleKeydown(event) {
    if (this.disabled) {
      return;
    }
    const {
      keyCode
    } = event;
    const previousActiveIndex = this.listKeyManager.activeItemIndex;
    const ctrlKeys = ["ctrlKey", "metaKey"];
    if (this.multiple && keyCode === A && hasModifierKey(event, ...ctrlKeys)) {
      this.triggerRange(null, 0, this.options.length - 1, this.options.length !== this.value.length);
      event.preventDefault();
      return;
    }
    if (this.multiple && (keyCode === SPACE || keyCode === ENTER) && hasModifierKey(event, "shiftKey")) {
      if (this.listKeyManager.activeItem && this.listKeyManager.activeItemIndex != null) {
        this.triggerRange(this.listKeyManager.activeItem, this._getLastTriggeredIndex() ?? this.listKeyManager.activeItemIndex, this.listKeyManager.activeItemIndex, !this.listKeyManager.activeItem.isSelected());
      }
      event.preventDefault();
      return;
    }
    if (this.multiple && keyCode === HOME && hasModifierKey(event, ...ctrlKeys) && hasModifierKey(event, "shiftKey")) {
      const trigger = this.listKeyManager.activeItem;
      if (trigger) {
        const from2 = this.listKeyManager.activeItemIndex;
        this.listKeyManager.setFirstItemActive();
        this.triggerRange(trigger, from2, this.listKeyManager.activeItemIndex, !trigger.isSelected());
      }
      event.preventDefault();
      return;
    }
    if (this.multiple && keyCode === END && hasModifierKey(event, ...ctrlKeys) && hasModifierKey(event, "shiftKey")) {
      const trigger = this.listKeyManager.activeItem;
      if (trigger) {
        const from2 = this.listKeyManager.activeItemIndex;
        this.listKeyManager.setLastItemActive();
        this.triggerRange(trigger, from2, this.listKeyManager.activeItemIndex, !trigger.isSelected());
      }
      event.preventDefault();
      return;
    }
    if (keyCode === SPACE || keyCode === ENTER) {
      this.triggerOption(this.listKeyManager.activeItem);
      event.preventDefault();
      return;
    }
    const isNavKey = keyCode === UP_ARROW || keyCode === DOWN_ARROW || keyCode === LEFT_ARROW || keyCode === RIGHT_ARROW || keyCode === HOME || keyCode === END;
    this.listKeyManager.onKeydown(event);
    if (isNavKey && event.shiftKey && previousActiveIndex !== this.listKeyManager.activeItemIndex) {
      this.triggerOption(this.listKeyManager.activeItem);
    }
  }
  /** Called when a focus moves into the listbox. */
  _handleFocusIn() {
    this._hasFocus = true;
  }
  /**
   * Called when the focus leaves an element in the listbox.
   * @param event The focusout event
   */
  _handleFocusOut(event) {
    this._previousActiveOption = this.listKeyManager.activeItem;
    const otherElement = event.relatedTarget;
    if (this.element !== otherElement && !this.element.contains(otherElement)) {
      this._onTouched();
      this._hasFocus = false;
      this._setNextFocusToSelectedOption();
    }
  }
  /** Get the id of the active option if active descendant is being used. */
  _getAriaActiveDescendant() {
    return this.useActiveDescendant ? this.listKeyManager?.activeItem?.id : null;
  }
  /** Get the tabindex for the listbox. */
  _getTabIndex() {
    if (this.disabled) {
      return -1;
    }
    return this.useActiveDescendant || !this.listKeyManager.activeItem ? this.enabledTabIndex : -1;
  }
  /** Initialize the key manager. */
  _initKeyManager() {
    this.listKeyManager = new ActiveDescendantKeyManager(this.options).withWrap(!this._navigationWrapDisabled).withTypeAhead().withHomeAndEnd().withAllowedModifierKeys(["shiftKey"]).skipPredicate(this._navigateDisabledOptions ? this._skipNonePredicate : this._skipDisabledPredicate);
    if (this.orientation === "vertical") {
      this.listKeyManager.withVerticalOrientation();
    } else {
      this.listKeyManager.withHorizontalOrientation(this._dir?.value || "ltr");
    }
    if (this.selectionModel.selected.length) {
      Promise.resolve().then(() => this._setNextFocusToSelectedOption());
    }
    this.listKeyManager.change.subscribe(() => this._focusActiveOption());
    this.options.changes.pipe(takeUntil(this.destroyed)).subscribe(() => {
      const activeOption = this.listKeyManager.activeItem;
      if (activeOption && !this.options.find((option) => option === activeOption)) {
        this.listKeyManager.setActiveItem(-1);
        this.changeDetectorRef.markForCheck();
      }
    });
  }
  /** Focus the active option. */
  _focusActiveOption() {
    if (!this.useActiveDescendant) {
      this.listKeyManager.activeItem?.focus();
    }
    this.changeDetectorRef.markForCheck();
  }
  /**
   * Set the selected values.
   * @param value The list of new selected values.
   */
  _setSelection(value) {
    if (this._invalid) {
      this.selectionModel.clear(false);
    }
    this.selectionModel.setSelection(...this._coerceValue(value));
    if (!this._hasFocus) {
      this._setNextFocusToSelectedOption();
    }
  }
  /** Sets the first selected option as first in the keyboard focus order. */
  _setNextFocusToSelectedOption() {
    const selected = this.options?.find((option) => option.isSelected());
    if (selected) {
      this.listKeyManager.updateActiveItem(selected);
    }
  }
  /** Update the internal value of the listbox based on the selection model. */
  _updateInternalValue() {
    const indexCache = /* @__PURE__ */ new Map();
    this.selectionModel.sort((a, b) => {
      const aIndex = this._getIndexForValue(indexCache, a);
      const bIndex = this._getIndexForValue(indexCache, b);
      return aIndex - bIndex;
    });
    const selected = this.selectionModel.selected;
    this._invalid = !this.multiple && selected.length > 1 || !!this._getInvalidOptionValues(selected).length;
    this.changeDetectorRef.markForCheck();
  }
  /**
   * Gets the index of the given value in the given list of options.
   * @param cache The cache of indices found so far
   * @param value The value to find
   * @return The index of the value in the options list
   */
  _getIndexForValue(cache, value) {
    const isEqual = this.compareWith || Object.is;
    if (!cache.has(value)) {
      let index = -1;
      for (let i = 0; i < this.options.length; i++) {
        if (isEqual(value, this.options.get(i).value)) {
          index = i;
          break;
        }
      }
      cache.set(value, index);
    }
    return cache.get(value);
  }
  /**
   * Handle the user clicking an option.
   * @param option The option that was clicked.
   */
  _handleOptionClicked(option, event) {
    event.preventDefault();
    this.listKeyManager.setActiveItem(option);
    if (event.shiftKey && this.multiple) {
      this.triggerRange(option, this._getLastTriggeredIndex() ?? this.listKeyManager.activeItemIndex, this.listKeyManager.activeItemIndex, !option.isSelected());
    } else {
      this.triggerOption(option);
    }
  }
  /** Verifies that no two options represent the same value under the compareWith function. */
  _verifyNoOptionValueCollisions() {
    this.options.changes.pipe(startWith(this.options), takeUntil(this.destroyed)).subscribe(() => {
      const isEqual = this.compareWith ?? Object.is;
      for (let i = 0; i < this.options.length; i++) {
        const option = this.options.get(i);
        let duplicate = null;
        for (let j = i + 1; j < this.options.length; j++) {
          const other = this.options.get(j);
          if (isEqual(option.value, other.value)) {
            duplicate = other;
            break;
          }
        }
        if (duplicate) {
          if (this.compareWith) {
            console.warn(`Found multiple CdkOption representing the same value under the given compareWith function`, {
              option1: option.element,
              option2: duplicate.element,
              compareWith: this.compareWith
            });
          } else {
            console.warn(`Found multiple CdkOption with the same value`, {
              option1: option.element,
              option2: duplicate.element
            });
          }
          return;
        }
      }
    });
  }
  /** Verifies that the option values are valid. */
  _verifyOptionValues() {
    if (this.options && (typeof ngDevMode === "undefined" || ngDevMode)) {
      const selected = this.selectionModel.selected;
      const invalidValues = this._getInvalidOptionValues(selected);
      if (!this.multiple && selected.length > 1) {
        throw Error("Listbox cannot have more than one selected value in multi-selection mode.");
      }
      if (invalidValues.length) {
        throw Error("Listbox has selected values that do not match any of its options.");
      }
    }
  }
  /**
   * Coerces a value into an array representing a listbox selection.
   * @param value The value to coerce
   * @return An array
   */
  _coerceValue(value) {
    return value == null ? [] : coerceArray(value);
  }
  /**
   * Get the sublist of values that do not represent valid option values in this listbox.
   * @param values The list of values
   * @return The sublist of values that are not valid option values
   */
  _getInvalidOptionValues(values) {
    const isEqual = this.compareWith || Object.is;
    const validValues = (this.options || []).map((option) => option.value);
    return values.filter((value) => !validValues.some((validValue) => isEqual(value, validValue)));
  }
  /** Get the index of the last triggered option. */
  _getLastTriggeredIndex() {
    const index = this.options.toArray().indexOf(this._lastTriggered);
    return index === -1 ? null : index;
  }
  static \u0275fac = function CdkListbox_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _CdkListbox)();
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _CdkListbox,
    selectors: [["", "cdkListbox", ""]],
    contentQueries: function CdkListbox_ContentQueries(rf, ctx, dirIndex) {
      if (rf & 1) {
        \u0275\u0275contentQuery(dirIndex, CdkOption, 5);
      }
      if (rf & 2) {
        let _t;
        \u0275\u0275queryRefresh(_t = \u0275\u0275loadQuery()) && (ctx.options = _t);
      }
    },
    hostAttrs: ["role", "listbox", 1, "cdk-listbox"],
    hostVars: 6,
    hostBindings: function CdkListbox_HostBindings(rf, ctx) {
      if (rf & 1) {
        \u0275\u0275listener("focus", function CdkListbox_focus_HostBindingHandler() {
          return ctx._handleFocus();
        })("keydown", function CdkListbox_keydown_HostBindingHandler($event) {
          return ctx._handleKeydown($event);
        })("focusout", function CdkListbox_focusout_HostBindingHandler($event) {
          return ctx._handleFocusOut($event);
        })("focusin", function CdkListbox_focusin_HostBindingHandler() {
          return ctx._handleFocusIn();
        });
      }
      if (rf & 2) {
        \u0275\u0275domProperty("id", ctx.id);
        \u0275\u0275attribute("tabindex", ctx._getTabIndex())("aria-disabled", ctx.disabled)("aria-multiselectable", ctx.multiple)("aria-activedescendant", ctx._getAriaActiveDescendant())("aria-orientation", ctx.orientation);
      }
    },
    inputs: {
      id: "id",
      enabledTabIndex: [0, "tabindex", "enabledTabIndex"],
      value: [0, "cdkListboxValue", "value"],
      multiple: [2, "cdkListboxMultiple", "multiple", booleanAttribute],
      disabled: [2, "cdkListboxDisabled", "disabled", booleanAttribute],
      useActiveDescendant: [2, "cdkListboxUseActiveDescendant", "useActiveDescendant", booleanAttribute],
      orientation: [0, "cdkListboxOrientation", "orientation"],
      compareWith: [0, "cdkListboxCompareWith", "compareWith"],
      navigationWrapDisabled: [2, "cdkListboxNavigationWrapDisabled", "navigationWrapDisabled", booleanAttribute],
      navigateDisabledOptions: [2, "cdkListboxNavigatesDisabledOptions", "navigateDisabledOptions", booleanAttribute]
    },
    outputs: {
      valueChange: "cdkListboxValueChange"
    },
    exportAs: ["cdkListbox"],
    features: [\u0275\u0275ProvidersFeature([{
      provide: NG_VALUE_ACCESSOR,
      useExisting: forwardRef(() => _CdkListbox),
      multi: true
    }])]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CdkListbox, [{
    type: Directive,
    args: [{
      selector: "[cdkListbox]",
      exportAs: "cdkListbox",
      host: {
        "role": "listbox",
        "class": "cdk-listbox",
        "[id]": "id",
        "[attr.tabindex]": "_getTabIndex()",
        "[attr.aria-disabled]": "disabled",
        "[attr.aria-multiselectable]": "multiple",
        "[attr.aria-activedescendant]": "_getAriaActiveDescendant()",
        "[attr.aria-orientation]": "orientation",
        "(focus)": "_handleFocus()",
        "(keydown)": "_handleKeydown($event)",
        "(focusout)": "_handleFocusOut($event)",
        "(focusin)": "_handleFocusIn()"
      },
      providers: [{
        provide: NG_VALUE_ACCESSOR,
        useExisting: forwardRef(() => CdkListbox),
        multi: true
      }]
    }]
  }], () => [], {
    id: [{
      type: Input
    }],
    enabledTabIndex: [{
      type: Input,
      args: ["tabindex"]
    }],
    value: [{
      type: Input,
      args: ["cdkListboxValue"]
    }],
    multiple: [{
      type: Input,
      args: [{
        alias: "cdkListboxMultiple",
        transform: booleanAttribute
      }]
    }],
    disabled: [{
      type: Input,
      args: [{
        alias: "cdkListboxDisabled",
        transform: booleanAttribute
      }]
    }],
    useActiveDescendant: [{
      type: Input,
      args: [{
        alias: "cdkListboxUseActiveDescendant",
        transform: booleanAttribute
      }]
    }],
    orientation: [{
      type: Input,
      args: ["cdkListboxOrientation"]
    }],
    compareWith: [{
      type: Input,
      args: ["cdkListboxCompareWith"]
    }],
    navigationWrapDisabled: [{
      type: Input,
      args: [{
        alias: "cdkListboxNavigationWrapDisabled",
        transform: booleanAttribute
      }]
    }],
    navigateDisabledOptions: [{
      type: Input,
      args: [{
        alias: "cdkListboxNavigatesDisabledOptions",
        transform: booleanAttribute
      }]
    }],
    valueChange: [{
      type: Output,
      args: ["cdkListboxValueChange"]
    }],
    options: [{
      type: ContentChildren,
      args: [CdkOption, {
        descendants: true
      }]
    }]
  });
})();
var EXPORTED_DECLARATIONS = [CdkListbox, CdkOption];
var CdkListboxModule = class _CdkListboxModule {
  static \u0275fac = function CdkListboxModule_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _CdkListboxModule)();
  };
  static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
    type: _CdkListboxModule,
    imports: [CdkListbox, CdkOption],
    exports: [CdkListbox, CdkOption]
  });
  static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({});
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CdkListboxModule, [{
    type: NgModule,
    args: [{
      imports: [...EXPORTED_DECLARATIONS],
      exports: [...EXPORTED_DECLARATIONS]
    }]
  }], null, null);
})();

// src/app/models-list/models-list.component.ts
var _forTrack010 = ($index, $item) => $item.model_relative_path;
function ModelsListComponent_For_14_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "tr", 2)(1, "td")(2, "label");
    \u0275\u0275element(3, "input", 3);
    \u0275\u0275elementEnd()();
    \u0275\u0275elementStart(4, "td");
    \u0275\u0275text(5);
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(6, "td");
    \u0275\u0275text(7);
    \u0275\u0275pipe(8, "modelType");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(9, "td");
    \u0275\u0275text(10);
    \u0275\u0275pipe(11, "date");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(12, "td");
    \u0275\u0275text(13);
    \u0275\u0275elementEnd()();
  }
  if (rf & 2) {
    const m_r1 = ctx.$implicit;
    const ctx_r1 = \u0275\u0275nextContext();
    const u_r3 = ctx_r1.mc_util(m_r1);
    \u0275\u0275property("cdkOption", m_r1);
    \u0275\u0275advance(3);
    \u0275\u0275property("checked", ctx_r1.selectedModel() === m_r1);
    \u0275\u0275advance(2);
    \u0275\u0275textInterpolate(u_r3.name);
    \u0275\u0275advance(2);
    \u0275\u0275textInterpolate(u_r3.c ? \u0275\u0275pipeBind1(8, 6, u_r3.type) : "");
    \u0275\u0275advance(3);
    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(11, 8, u_r3.createdAt));
    \u0275\u0275advance(3);
    \u0275\u0275textInterpolate(u_r3.c ? u_r3.status : "");
  }
}
function ModelsListComponent_ForEmpty_15_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "tr")(1, "td", 4);
    \u0275\u0275text(2, " No models found in model directory. ");
    \u0275\u0275elementEnd()();
  }
}
var ModelsListComponent = class _ModelsListComponent {
  models = signal({ models: [] }, ...ngDevMode ? [{ debugName: "models" }] : []);
  sessionService = inject2(SessionService);
  selectedModel = model(...ngDevMode ? [void 0, { debugName: "selectedModel" }] : []);
  ngOnInit() {
    this.reloadModels();
  }
  async reloadModels() {
    const resp = await this.sessionService.listModels();
    this.models.set(resp);
  }
  mc_util(m) {
    return new mc_util(m);
  }
  handleCdkListboxChange(cdkListboxValue) {
    if (cdkListboxValue.length === 0) {
      this.selectedModel.set(null);
    } else {
      this.selectedModel.set(cdkListboxValue[0]);
    }
  }
  getCdkListboxValue() {
    return this.selectedModel() ? [this.selectedModel()] : [];
  }
  static \u0275fac = function ModelsListComponent_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _ModelsListComponent)();
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _ModelsListComponent, selectors: [["app-models-list"]], inputs: { selectedModel: [1, "selectedModel"] }, outputs: { selectedModel: "selectedModelChange" }, decls: 16, vars: 2, consts: [[1, "table", "table-pin-rows"], ["cdkListbox", "", 3, "cdkListboxValueChange", "cdkListboxValue"], [1, "hover:bg-base-200", "cursor-pointer", 3, "cdkOption"], ["type", "checkbox", 1, "checkbox", 3, "checked"], ["colspan", "100", 1, "text-center", "opacity-60"]], template: function ModelsListComponent_Template(rf, ctx) {
    if (rf & 1) {
      \u0275\u0275elementStart(0, "table", 0)(1, "thead")(2, "tr");
      \u0275\u0275element(3, "th");
      \u0275\u0275elementStart(4, "th");
      \u0275\u0275text(5, "Model Name");
      \u0275\u0275elementEnd();
      \u0275\u0275elementStart(6, "th");
      \u0275\u0275text(7, "Model Type");
      \u0275\u0275elementEnd();
      \u0275\u0275elementStart(8, "th");
      \u0275\u0275text(9, "Date Created");
      \u0275\u0275elementEnd();
      \u0275\u0275elementStart(10, "th");
      \u0275\u0275text(11, "Status");
      \u0275\u0275elementEnd()()();
      \u0275\u0275elementStart(12, "tbody", 1);
      \u0275\u0275listener("cdkListboxValueChange", function ModelsListComponent_Template_tbody_cdkListboxValueChange_12_listener($event) {
        return ctx.handleCdkListboxChange($event.value);
      });
      \u0275\u0275repeaterCreate(13, ModelsListComponent_For_14_Template, 14, 10, "tr", 2, _forTrack010, false, ModelsListComponent_ForEmpty_15_Template, 3, 0, "tr");
      \u0275\u0275elementEnd()();
    }
    if (rf & 2) {
      \u0275\u0275advance(12);
      \u0275\u0275property("cdkListboxValue", ctx.getCdkListboxValue());
      \u0275\u0275advance();
      \u0275\u0275repeater(ctx.models().models);
    }
  }, dependencies: [CdkListboxModule, CdkListbox, CdkOption, DatePipe, ModelTypeLabelPipe], styles: ["\n\n.cdk-option-active[_ngcontent-%COMP%] {\n  background-color: var(--color-base-300);\n}\n/*# sourceMappingURL=/static/models-list.component-2QANIGQC.css.map */"], changeDetection: 0 });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ModelsListComponent, [{
    type: Component,
    args: [{ selector: "app-models-list", imports: [DatePipe, ModelTypeLabelPipe, CdkListboxModule], changeDetection: ChangeDetectionStrategy.OnPush, template: '<style>\n  .cdk-option-active {\n    background-color: var(--color-base-300);\n  }\n</style>\n\n<table class="table table-pin-rows">\n  <thead>\n    <tr>\n      <th>\n        <!--\n        <label>\n          <input type="checkbox" class="checkbox" />\n        </label>-->\n      </th>\n      <th>Model Name</th>\n      <th>Model Type</th>\n      <th>Date Created</th>\n      <th>Status</th>\n    </tr>\n  </thead>\n  <tbody\n    cdkListbox\n    [cdkListboxValue]="getCdkListboxValue()"\n    (cdkListboxValueChange)="handleCdkListboxChange($event.value)"\n  >\n    @for (m of models().models; track m.model_relative_path) {\n      @let u = mc_util(m);\n      <tr class="hover:bg-base-200 cursor-pointer" [cdkOption]="m">\n        <td>\n          <label>\n            <input\n              type="checkbox"\n              class="checkbox"\n              [checked]="selectedModel() === m"\n            />\n          </label>\n        </td>\n        <td>{{ u.name }}</td>\n        <td>{{ u.c ? (u.type | modelType) : "" }}</td>\n        <td>{{ u.createdAt | date }}</td>\n        <td>{{ u.c ? u.status : "" }}</td>\n      </tr>\n    } @empty {\n      <tr>\n        <td colspan="100" class="text-center opacity-60">\n          No models found in model directory.\n        </td>\n      </tr>\n    }\n  </tbody>\n</table>\n', styles: ["/* angular:styles/component:css;681c13ce4d837f6cfb9c5baa3685e8816cbee412d952a771834f9a64b6e387a4;/home/ksikka/lightning-pose-app/web_ui/src/app/models-list/models-list.component.html */\n.cdk-option-active {\n  background-color: var(--color-base-300);\n}\n/*# sourceMappingURL=/static/models-list.component-2QANIGQC.css.map */\n"] }]
  }], null, null);
})();
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(ModelsListComponent, { className: "ModelsListComponent", filePath: "src/app/models-list/models-list.component.ts", lineNumber: 27 });
})();

// src/app/models-page/model-detail/model-detail.component.ts
var _c013 = () => ({ id: "general", label: "General" });
var _c18 = () => ({ id: "logs", label: "Logs" });
var _c25 = (a0, a12) => [a0, a12];
var _forTrack011 = ($index, $item) => $item.filename;
function ModelDetailComponent_For_2_Template(rf, ctx) {
  if (rf & 1) {
    const _r1 = \u0275\u0275getCurrentView();
    \u0275\u0275domElementStart(0, "a", 4);
    \u0275\u0275domListener("click", function ModelDetailComponent_For_2_Template_a_click_0_listener() {
      const tab_r2 = \u0275\u0275restoreView(_r1).$implicit;
      const ctx_r2 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r2.activeTab.set(tab_r2.id));
    })("keydown.enter", function ModelDetailComponent_For_2_Template_a_keydown_enter_0_listener() {
      const tab_r2 = \u0275\u0275restoreView(_r1).$implicit;
      const ctx_r2 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r2.activeTab.set(tab_r2.id));
    });
    \u0275\u0275text(1);
    \u0275\u0275domElementEnd();
  }
  if (rf & 2) {
    const tab_r2 = ctx.$implicit;
    const ctx_r2 = \u0275\u0275nextContext();
    \u0275\u0275classProp("tab-active", ctx_r2.activeTab() === tab_r2.id);
    \u0275\u0275advance();
    \u0275\u0275textInterpolate(tab_r2.label);
  }
}
function ModelDetailComponent_Conditional_4_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275domElementStart(0, "pre");
    \u0275\u0275text(1);
    \u0275\u0275pipe(2, "json");
    \u0275\u0275domElementEnd();
  }
  if (rf & 2) {
    const ctx_r2 = \u0275\u0275nextContext();
    \u0275\u0275advance();
    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(2, 1, ctx_r2.selectedModel()));
  }
}
function ModelDetailComponent_Conditional_5_For_1_Conditional_6_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275domElement(0, "span", 9);
  }
}
function ModelDetailComponent_Conditional_5_For_1_Conditional_7_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275domElementStart(0, "span", 10);
    \u0275\u0275text(1, "cached");
    \u0275\u0275domElementEnd();
  }
}
function ModelDetailComponent_Conditional_5_For_1_Template(rf, ctx) {
  if (rf & 1) {
    const _r4 = \u0275\u0275getCurrentView();
    \u0275\u0275domElementStart(0, "div", 5)(1, "input", 6);
    \u0275\u0275domListener("change", function ModelDetailComponent_Conditional_5_For_1_Template_input_change_1_listener() {
      \u0275\u0275restoreView(_r4);
      const scrollHandle_r5 = \u0275\u0275reference(10);
      return \u0275\u0275resetView(scrollHandle_r5.scrollTop = scrollHandle_r5.scrollHeight);
    });
    \u0275\u0275domElementEnd();
    \u0275\u0275domElementStart(2, "div", 7)(3, "span");
    \u0275\u0275text(4);
    \u0275\u0275domElementEnd();
    \u0275\u0275domElementStart(5, "button", 8);
    \u0275\u0275domListener("click", function ModelDetailComponent_Conditional_5_For_1_Template_button_click_5_listener() {
      const logEntry_r6 = \u0275\u0275restoreView(_r4).$implicit;
      const ctx_r2 = \u0275\u0275nextContext(2);
      return \u0275\u0275resetView(ctx_r2.reloadLog(logEntry_r6));
    });
    \u0275\u0275conditionalCreate(6, ModelDetailComponent_Conditional_5_For_1_Conditional_6_Template, 1, 0, "span", 9)(7, ModelDetailComponent_Conditional_5_For_1_Conditional_7_Template, 2, 0, "span", 10);
    \u0275\u0275domElementEnd()();
    \u0275\u0275domElementStart(8, "div", 11)(9, "pre", 12, 0);
    \u0275\u0275text(11);
    \u0275\u0275domElementEnd()()();
  }
  if (rf & 2) {
    const logEntry_r6 = ctx.$implicit;
    const ctx_r2 = \u0275\u0275nextContext(2);
    \u0275\u0275advance(4);
    \u0275\u0275textInterpolate(logEntry_r6.filename);
    \u0275\u0275advance();
    \u0275\u0275domProperty("disabled", ctx_r2.isReloading.get(logEntry_r6));
    \u0275\u0275advance();
    \u0275\u0275conditional(ctx_r2.isReloading.get(logEntry_r6) ? 6 : 7);
    \u0275\u0275advance(5);
    \u0275\u0275textInterpolate(logEntry_r6.content);
  }
}
function ModelDetailComponent_Conditional_5_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275repeaterCreate(0, ModelDetailComponent_Conditional_5_For_1_Template, 12, 4, "div", 5, _forTrack011);
  }
  if (rf & 2) {
    const ctx_r2 = \u0275\u0275nextContext();
    \u0275\u0275repeater(ctx_r2.logs());
  }
}
var ModelDetailComponent = class _ModelDetailComponent {
  selectedModel = input.required(...ngDevMode ? [{ debugName: "selectedModel" }] : []);
  activeTab = signal("general", ...ngDevMode ? [{ debugName: "activeTab" }] : []);
  logs = signal([], ...ngDevMode ? [{ debugName: "logs" }] : []);
  projectInfoService = inject2(ProjectInfoService);
  currentController = null;
  ngOnChanges() {
    if (this.currentController) {
      this.currentController.abort();
    }
    this.logs.set([]);
    if (!this.selectedModel()) {
      return;
    }
    this.currentController = new AbortController();
    const basePath = this.getLogBasePath();
    Promise.all([
      fetch(`${basePath}/train_stdout.log`, {
        signal: this.currentController.signal
      }),
      fetch(`${basePath}/train_stderr.log`, {
        signal: this.currentController.signal
      })
    ]).then(async ([stdoutResponse, stderrResponse]) => {
      const logs = [];
      if (stdoutResponse.ok) {
        const content = await stdoutResponse.text();
        logs.push({
          filename: "train_stdout.log",
          logUrl: `${basePath}/train_stdout.log`,
          // replace \r with \n for tqdm output: https://github.com/tqdm/tqdm/issues/506#issuecomment-373762049
          content: content.replaceAll("\r", "\n")
        });
      }
      if (stderrResponse.ok) {
        const content = await stderrResponse.text();
        logs.push({
          filename: "train_stderr.log",
          logUrl: `${basePath}/train_stderr.log`,
          // replace \r with \n for tqdm output: https://github.com/tqdm/tqdm/issues/506#issuecomment-373762049
          content: content.replaceAll("\r", "\n")
        });
      }
      this.logs.set(logs);
    }).catch(this.logFetchErrorHandler.bind(this));
  }
  logFetchErrorHandler(error) {
    if (error.name !== "AbortError") {
      alert("Failed to fetch log, see console for error details");
      console.error("Error fetching logs:", error);
    }
  }
  getLogBasePath() {
    const basePath = "/app/v0/files/" + this.projectInfoService.projectInfo.model_dir + "/" + this.selectedModel()?.model_relative_path;
    return basePath;
  }
  cdr = inject2(ChangeDetectorRef);
  isReloading = /* @__PURE__ */ new WeakMap();
  reloadLog(logEntry) {
    this.isReloading.set(logEntry, true);
    fetch(logEntry.logUrl, {
      signal: this.currentController.signal
    }).then((response) => {
      if (response.ok) {
        return response.text();
      } else {
        throw new Error("Failed to fetch log");
      }
    }).then((newContent) => {
      this.isReloading.set(logEntry, false);
      this.logs.update((logs) => {
        return logs.map((l) => {
          if (l.filename === logEntry.filename) {
            return __spreadProps(__spreadValues({}, l), { content: newContent.replaceAll("\r", "\n") });
          } else {
            return l;
          }
        });
      });
    }).catch((error) => {
      this.isReloading.set(logEntry, false);
      this.cdr.markForCheck();
      this.logFetchErrorHandler(error);
    });
  }
  static \u0275fac = function ModelDetailComponent_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _ModelDetailComponent)();
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _ModelDetailComponent, selectors: [["app-model-detail"]], inputs: { selectedModel: [1, "selectedModel"] }, features: [\u0275\u0275NgOnChangesFeature], decls: 6, vars: 6, consts: [["scrollHandle", ""], ["role", "tablist", 1, "tabs", "tabs-lift"], ["role", "tab", 1, "tab", 3, "tab-active"], [1, "p-4"], ["role", "tab", 1, "tab", 3, "click", "keydown.enter"], [1, "collapse", "collapse-arrow", "bg-base-100", "border", "border-base-300"], ["type", "checkbox", "name", "log-accordion", 3, "change"], [1, "collapse-title", "font-semibold", "bg-base-200", "z-10", "pointer-events-none"], [1, "btn", "btn-ghost", "btn-md", "btn-circle", "pointer-events-auto", 3, "click", "disabled"], [1, "loading", "loading-spinner", "loading-sm"], [1, "material-icons"], [1, "collapse-content", "text-sm", "w-full", "min-w-0"], [1, "max-h-140", "overflow-auto", "w-full", "p-4"]], template: function ModelDetailComponent_Template(rf, ctx) {
    if (rf & 1) {
      \u0275\u0275domElementStart(0, "div", 1);
      \u0275\u0275repeaterCreate(1, ModelDetailComponent_For_2_Template, 2, 3, "a", 2, \u0275\u0275repeaterTrackByIdentity);
      \u0275\u0275domElementEnd();
      \u0275\u0275domElementStart(3, "div", 3);
      \u0275\u0275conditionalCreate(4, ModelDetailComponent_Conditional_4_Template, 3, 3, "pre")(5, ModelDetailComponent_Conditional_5_Template, 2, 0);
      \u0275\u0275domElementEnd();
    }
    if (rf & 2) {
      const tabs_r7 = \u0275\u0275pureFunction2(3, _c25, \u0275\u0275pureFunction0(1, _c013), \u0275\u0275pureFunction0(2, _c18));
      \u0275\u0275advance();
      \u0275\u0275repeater(tabs_r7);
      \u0275\u0275advance(3);
      \u0275\u0275conditional(ctx.activeTab() === "general" ? 4 : ctx.activeTab() === "logs" ? 5 : -1);
    }
  }, dependencies: [JsonPipe], encapsulation: 2, changeDetection: 0 });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ModelDetailComponent, [{
    type: Component,
    args: [{ selector: "app-model-detail", imports: [JsonPipe], changeDetection: ChangeDetectionStrategy.OnPush, template: '<div role="tablist" class="tabs tabs-lift">\n  @let tabs =\n    [\n      { id: "general", label: "General" },\n      { id: "logs", label: "Logs" },\n    ];\n  @for (tab of tabs; track tab) {\n    <a\n      role="tab"\n      class="tab"\n      [class.tab-active]="activeTab() === tab.id"\n      (click)="activeTab.set(tab.id)"\n      (keydown.enter)="activeTab.set(tab.id)"\n      >{{ tab.label }}</a\n    >\n  }\n</div>\n<div class="p-4">\n  @if (activeTab() === "general") {\n    <pre>{{ selectedModel() | json }}</pre>\n  } @else if (activeTab() === "logs") {\n    @for (logEntry of logs(); track logEntry.filename) {\n      <div class="collapse collapse-arrow bg-base-100 border border-base-300">\n        <input\n          type="checkbox"\n          name="log-accordion"\n          (change)="scrollHandle.scrollTop = scrollHandle.scrollHeight"\n        />\n        <div\n          class="collapse-title font-semibold bg-base-200 z-10 pointer-events-none"\n        >\n          <span>{{ logEntry.filename }}</span>\n\n          <button\n            class="btn btn-ghost btn-md btn-circle pointer-events-auto"\n            [disabled]="isReloading.get(logEntry)"\n            (click)="reloadLog(logEntry)"\n          >\n            @if (isReloading.get(logEntry)) {\n              <span class="loading loading-spinner loading-sm"></span>\n            } @else {\n              <span class="material-icons">cached</span>\n            }\n          </button>\n        </div>\n        <div class="collapse-content text-sm w-full min-w-0">\n          <pre class="max-h-140 overflow-auto w-full p-4" #scrollHandle>{{\n            logEntry.content\n          }}</pre>\n        </div>\n      </div>\n    }\n  }\n</div>\n' }]
  }], null, null);
})();
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(ModelDetailComponent, { className: "ModelDetailComponent", filePath: "src/app/models-page/model-detail/model-detail.component.ts", lineNumber: 21 });
})();

// src/app/models-page/models-page.component.ts
function ModelsPageComponent_Conditional_11_Template(rf, ctx) {
  if (rf & 1) {
    const _r1 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "app-create-model-dialog", 9);
    \u0275\u0275listener("done", function ModelsPageComponent_Conditional_11_Template_app_create_model_dialog_done_0_listener() {
      \u0275\u0275restoreView(_r1);
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.handleCreateModelDialogDone());
    });
    \u0275\u0275elementEnd();
  }
}
var ModelsPageComponent = class _ModelsPageComponent {
  isCreateModelDialogOpen = signal(false, ...ngDevMode ? [{ debugName: "isCreateModelDialogOpen" }] : []);
  modelsListComponent = viewChild(ModelsListComponent, ...ngDevMode ? [{ debugName: "modelsListComponent" }] : []);
  selectedModel = signal(null, ...ngDevMode ? [{ debugName: "selectedModel" }] : []);
  handleCreateModelDialogDone() {
    this.isCreateModelDialogOpen.set(false);
    this.modelsListComponent()?.reloadModels();
  }
  static \u0275fac = function ModelsPageComponent_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _ModelsPageComponent)();
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _ModelsPageComponent, selectors: [["app-models-page"]], viewQuery: function ModelsPageComponent_Query(rf, ctx) {
    if (rf & 1) {
      \u0275\u0275viewQuerySignal(ctx.modelsListComponent, ModelsListComponent, 5);
    }
    if (rf & 2) {
      \u0275\u0275queryAdvance();
    }
  }, decls: 12, vars: 3, consts: [[1, "flex", "mt-4", "w-full"], [1, "min-w-sm", "shrink-0"], [1, "flex", "gap-2", "items-center", "mb-4"], ["data-tip", "Create and train a model", 1, "btn", "btn-primary", "tooltip", "tooltip-bottom", 3, "click"], [1, "btn", "btn-accent"], [1, "overflow-auto", "max-h-5/6"], [3, "selectedModelChange", "selectedModel"], [1, "min-w-0", "min-h-0", "grow"], [3, "selectedModel"], [3, "done"]], template: function ModelsPageComponent_Template(rf, ctx) {
    if (rf & 1) {
      \u0275\u0275elementStart(0, "div", 0)(1, "div", 1)(2, "div", 2)(3, "button", 3);
      \u0275\u0275listener("click", function ModelsPageComponent_Template_button_click_3_listener() {
        return ctx.isCreateModelDialogOpen.set(true);
      });
      \u0275\u0275text(4, " New model ");
      \u0275\u0275elementEnd();
      \u0275\u0275elementStart(5, "button", 4);
      \u0275\u0275text(6, "Actions");
      \u0275\u0275elementEnd()();
      \u0275\u0275elementStart(7, "div", 5)(8, "app-models-list", 6);
      \u0275\u0275twoWayListener("selectedModelChange", function ModelsPageComponent_Template_app_models_list_selectedModelChange_8_listener($event) {
        \u0275\u0275twoWayBindingSet(ctx.selectedModel, $event) || (ctx.selectedModel = $event);
        return $event;
      });
      \u0275\u0275elementEnd()()();
      \u0275\u0275elementStart(9, "div", 7);
      \u0275\u0275element(10, "app-model-detail", 8);
      \u0275\u0275elementEnd()();
      \u0275\u0275conditionalCreate(11, ModelsPageComponent_Conditional_11_Template, 1, 0, "app-create-model-dialog");
    }
    if (rf & 2) {
      \u0275\u0275advance(8);
      \u0275\u0275twoWayProperty("selectedModel", ctx.selectedModel);
      \u0275\u0275advance(2);
      \u0275\u0275property("selectedModel", ctx.selectedModel());
      \u0275\u0275advance();
      \u0275\u0275conditional(ctx.isCreateModelDialogOpen() ? 11 : -1);
    }
  }, dependencies: [
    CreateModelDialogComponent,
    ModelsListComponent,
    ModelDetailComponent
  ], styles: ["\n\n[_nghost-%COMP%] {\n  display: flex;\n  flex-grow: 1;\n  justify-content: center;\n  width: 100%;\n}\n/*# sourceMappingURL=/static/models-page.component-IUFTF74U.css.map */"], changeDetection: 0 });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ModelsPageComponent, [{
    type: Component,
    args: [{ selector: "app-models-page", imports: [
      CreateModelDialogComponent,
      ModelsListComponent,
      ModelDetailComponent
    ], changeDetection: ChangeDetectionStrategy.OnPush, template: '<style>\n  :host {\n    display: flex;\n    flex-grow: 1;\n    justify-content: center;\n    width: 100%;\n  }\n</style>\n<div class="flex mt-4 w-full">\n  <div class="min-w-sm shrink-0">\n    <div class="flex gap-2 items-center mb-4">\n      <button\n        class="btn btn-primary tooltip tooltip-bottom"\n        data-tip="Create and train a model"\n        (click)="isCreateModelDialogOpen.set(true)"\n      >\n        New model\n      </button>\n      <button class="btn btn-accent">Actions</button>\n    </div>\n\n    <div class="overflow-auto max-h-5/6">\n      <app-models-list [(selectedModel)]="selectedModel"></app-models-list>\n    </div>\n  </div>\n  <div class="min-w-0 min-h-0 grow">\n    <app-model-detail [selectedModel]="selectedModel()"></app-model-detail>\n  </div>\n</div>\n@if (isCreateModelDialogOpen()) {\n  <app-create-model-dialog\n    (done)="handleCreateModelDialogDone()"\n  ></app-create-model-dialog>\n}\n', styles: ["/* angular:styles/component:css;eaa433882c504ada7867066660e654c0bf1aa344e4e9f024bdf2c7c72fe0bfd8;/home/ksikka/lightning-pose-app/web_ui/src/app/models-page/models-page.component.html */\n:host {\n  display: flex;\n  flex-grow: 1;\n  justify-content: center;\n  width: 100%;\n}\n/*# sourceMappingURL=/static/models-page.component-IUFTF74U.css.map */\n"] }]
  }], null, null);
})();
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(ModelsPageComponent, { className: "ModelsPageComponent", filePath: "src/app/models-page/models-page.component.ts", lineNumber: 24 });
})();

// src/app/app.routes.ts
var routes = [
  {
    path: "",
    component: HomePageComponent,
    title: "Lightning Pose App"
  },
  {
    path: "viewer",
    component: ViewerPageComponent,
    title: "Lightning Pose Viewer"
  },
  {
    path: "viewer/:sessionKey",
    component: ViewerPageComponent,
    title: "Lightning Pose Viewer"
  },
  {
    path: "labeler",
    component: LabelerPageComponent,
    title: "Lightning Pose Labeler"
  },
  {
    path: "labeler/:labelFileKey",
    component: LabelerPageComponent,
    title: "Lightning Pose Labeler"
  },
  {
    path: "labeler/:labelFileKey/:frameKey",
    component: LabelerPageComponent,
    title: "Lightning Pose Labeler"
  },
  {
    path: "models",
    component: ModelsPageComponent,
    title: "Lightning Pose Models"
  },
  {
    path: "sandbox",
    component: SandboxComponent,
    title: "Sandbox"
  }
];

// node_modules/@angular/cdk/fesm2022/portal.mjs
function throwNullPortalError() {
  throw Error("Must provide a portal to attach");
}
function throwPortalAlreadyAttachedError() {
  throw Error("Host already has a portal attached");
}
function throwPortalOutletAlreadyDisposedError() {
  throw Error("This PortalOutlet has already been disposed");
}
function throwUnknownPortalTypeError() {
  throw Error("Attempting to attach an unknown Portal type. BasePortalOutlet accepts either a ComponentPortal or a TemplatePortal.");
}
function throwNullPortalOutletError() {
  throw Error("Attempting to attach a portal to a null PortalOutlet");
}
function throwNoPortalAttachedError() {
  throw Error("Attempting to detach a portal that is not attached to a host");
}
var Portal = class {
  _attachedHost;
  /** Attach this portal to a host. */
  attach(host) {
    if (typeof ngDevMode === "undefined" || ngDevMode) {
      if (host == null) {
        throwNullPortalOutletError();
      }
      if (host.hasAttached()) {
        throwPortalAlreadyAttachedError();
      }
    }
    this._attachedHost = host;
    return host.attach(this);
  }
  /** Detach this portal from its host */
  detach() {
    let host = this._attachedHost;
    if (host != null) {
      this._attachedHost = null;
      host.detach();
    } else if (typeof ngDevMode === "undefined" || ngDevMode) {
      throwNoPortalAttachedError();
    }
  }
  /** Whether this portal is attached to a host. */
  get isAttached() {
    return this._attachedHost != null;
  }
  /**
   * Sets the PortalOutlet reference without performing `attach()`. This is used directly by
   * the PortalOutlet when it is performing an `attach()` or `detach()`.
   */
  setAttachedHost(host) {
    this._attachedHost = host;
  }
};
var ComponentPortal = class extends Portal {
  /** The type of the component that will be instantiated for attachment. */
  component;
  /**
   * Where the attached component should live in Angular's *logical* component tree.
   * This is different from where the component *renders*, which is determined by the PortalOutlet.
   * The origin is necessary when the host is outside of the Angular application context.
   */
  viewContainerRef;
  /** Injector used for the instantiation of the component. */
  injector;
  /**
   * List of DOM nodes that should be projected through `<ng-content>` of the attached component.
   */
  projectableNodes;
  constructor(component, viewContainerRef, injector, projectableNodes) {
    super();
    this.component = component;
    this.viewContainerRef = viewContainerRef;
    this.injector = injector;
    this.projectableNodes = projectableNodes;
  }
};
var TemplatePortal = class extends Portal {
  templateRef;
  viewContainerRef;
  context;
  injector;
  constructor(templateRef, viewContainerRef, context2, injector) {
    super();
    this.templateRef = templateRef;
    this.viewContainerRef = viewContainerRef;
    this.context = context2;
    this.injector = injector;
  }
  get origin() {
    return this.templateRef.elementRef;
  }
  /**
   * Attach the portal to the provided `PortalOutlet`.
   * When a context is provided it will override the `context` property of the `TemplatePortal`
   * instance.
   */
  attach(host, context2 = this.context) {
    this.context = context2;
    return super.attach(host);
  }
  detach() {
    this.context = void 0;
    return super.detach();
  }
};
var DomPortal = class extends Portal {
  /** DOM node hosting the portal's content. */
  element;
  constructor(element) {
    super();
    this.element = element instanceof ElementRef ? element.nativeElement : element;
  }
};
var BasePortalOutlet = class {
  /** The portal currently attached to the host. */
  _attachedPortal;
  /** A function that will permanently dispose this host. */
  _disposeFn;
  /** Whether this host has already been permanently disposed. */
  _isDisposed = false;
  /** Whether this host has an attached portal. */
  hasAttached() {
    return !!this._attachedPortal;
  }
  /** Attaches a portal. */
  attach(portal) {
    if (typeof ngDevMode === "undefined" || ngDevMode) {
      if (!portal) {
        throwNullPortalError();
      }
      if (this.hasAttached()) {
        throwPortalAlreadyAttachedError();
      }
      if (this._isDisposed) {
        throwPortalOutletAlreadyDisposedError();
      }
    }
    if (portal instanceof ComponentPortal) {
      this._attachedPortal = portal;
      return this.attachComponentPortal(portal);
    } else if (portal instanceof TemplatePortal) {
      this._attachedPortal = portal;
      return this.attachTemplatePortal(portal);
    } else if (this.attachDomPortal && portal instanceof DomPortal) {
      this._attachedPortal = portal;
      return this.attachDomPortal(portal);
    }
    if (typeof ngDevMode === "undefined" || ngDevMode) {
      throwUnknownPortalTypeError();
    }
  }
  // @breaking-change 10.0.0 `attachDomPortal` to become a required abstract method.
  attachDomPortal = null;
  /** Detaches a previously attached portal. */
  detach() {
    if (this._attachedPortal) {
      this._attachedPortal.setAttachedHost(null);
      this._attachedPortal = null;
    }
    this._invokeDisposeFn();
  }
  /** Permanently dispose of this portal host. */
  dispose() {
    if (this.hasAttached()) {
      this.detach();
    }
    this._invokeDisposeFn();
    this._isDisposed = true;
  }
  /** @docs-private */
  setDisposeFn(fn) {
    this._disposeFn = fn;
  }
  _invokeDisposeFn() {
    if (this._disposeFn) {
      this._disposeFn();
      this._disposeFn = null;
    }
  }
};
var DomPortalOutlet = class extends BasePortalOutlet {
  outletElement;
  _appRef;
  _defaultInjector;
  /**
   * @param outletElement Element into which the content is projected.
   * @param _appRef Reference to the application. Only used in component portals when there
   *   is no `ViewContainerRef` available.
   * @param _defaultInjector Injector to use as a fallback when the portal being attached doesn't
   *   have one. Only used for component portals.
   */
  constructor(outletElement, _appRef, _defaultInjector) {
    super();
    this.outletElement = outletElement;
    this._appRef = _appRef;
    this._defaultInjector = _defaultInjector;
  }
  /**
   * Attach the given ComponentPortal to DOM element.
   * @param portal Portal to be attached
   * @returns Reference to the created component.
   */
  attachComponentPortal(portal) {
    let componentRef;
    if (portal.viewContainerRef) {
      const injector = portal.injector || portal.viewContainerRef.injector;
      const ngModuleRef = injector.get(NgModuleRef$1, null, {
        optional: true
      }) || void 0;
      componentRef = portal.viewContainerRef.createComponent(portal.component, {
        index: portal.viewContainerRef.length,
        injector,
        ngModuleRef,
        projectableNodes: portal.projectableNodes || void 0
      });
      this.setDisposeFn(() => componentRef.destroy());
    } else {
      if ((typeof ngDevMode === "undefined" || ngDevMode) && !this._appRef) {
        throw Error("Cannot attach component portal to outlet without an ApplicationRef.");
      }
      const appRef = this._appRef;
      const elementInjector = portal.injector || this._defaultInjector || Injector.NULL;
      const environmentInjector = elementInjector.get(EnvironmentInjector, appRef.injector);
      componentRef = createComponent(portal.component, {
        elementInjector,
        environmentInjector,
        projectableNodes: portal.projectableNodes || void 0
      });
      appRef.attachView(componentRef.hostView);
      this.setDisposeFn(() => {
        if (appRef.viewCount > 0) {
          appRef.detachView(componentRef.hostView);
        }
        componentRef.destroy();
      });
    }
    this.outletElement.appendChild(this._getComponentRootNode(componentRef));
    this._attachedPortal = portal;
    return componentRef;
  }
  /**
   * Attaches a template portal to the DOM as an embedded view.
   * @param portal Portal to be attached.
   * @returns Reference to the created embedded view.
   */
  attachTemplatePortal(portal) {
    let viewContainer = portal.viewContainerRef;
    let viewRef = viewContainer.createEmbeddedView(portal.templateRef, portal.context, {
      injector: portal.injector
    });
    viewRef.rootNodes.forEach((rootNode) => this.outletElement.appendChild(rootNode));
    viewRef.detectChanges();
    this.setDisposeFn(() => {
      let index = viewContainer.indexOf(viewRef);
      if (index !== -1) {
        viewContainer.remove(index);
      }
    });
    this._attachedPortal = portal;
    return viewRef;
  }
  /**
   * Attaches a DOM portal by transferring its content into the outlet.
   * @param portal Portal to be attached.
   * @deprecated To be turned into a method.
   * @breaking-change 10.0.0
   */
  attachDomPortal = (portal) => {
    const element = portal.element;
    if (!element.parentNode && (typeof ngDevMode === "undefined" || ngDevMode)) {
      throw Error("DOM portal content must be attached to a parent node.");
    }
    const anchorNode = this.outletElement.ownerDocument.createComment("dom-portal");
    element.parentNode.insertBefore(anchorNode, element);
    this.outletElement.appendChild(element);
    this._attachedPortal = portal;
    super.setDisposeFn(() => {
      if (anchorNode.parentNode) {
        anchorNode.parentNode.replaceChild(element, anchorNode);
      }
    });
  };
  /**
   * Clears out a portal from the DOM.
   */
  dispose() {
    super.dispose();
    this.outletElement.remove();
  }
  /** Gets the root HTMLElement for an instantiated component. */
  _getComponentRootNode(componentRef) {
    return componentRef.hostView.rootNodes[0];
  }
};
var CdkPortal = class _CdkPortal extends TemplatePortal {
  constructor() {
    const templateRef = inject2(TemplateRef);
    const viewContainerRef = inject2(ViewContainerRef);
    super(templateRef, viewContainerRef);
  }
  static \u0275fac = function CdkPortal_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _CdkPortal)();
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _CdkPortal,
    selectors: [["", "cdkPortal", ""]],
    exportAs: ["cdkPortal"],
    features: [\u0275\u0275InheritDefinitionFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CdkPortal, [{
    type: Directive,
    args: [{
      selector: "[cdkPortal]",
      exportAs: "cdkPortal"
    }]
  }], () => [], null);
})();
var TemplatePortalDirective = class _TemplatePortalDirective extends CdkPortal {
  static \u0275fac = /* @__PURE__ */ (() => {
    let \u0275TemplatePortalDirective_BaseFactory;
    return function TemplatePortalDirective_Factory(__ngFactoryType__) {
      return (\u0275TemplatePortalDirective_BaseFactory || (\u0275TemplatePortalDirective_BaseFactory = \u0275\u0275getInheritedFactory(_TemplatePortalDirective)))(__ngFactoryType__ || _TemplatePortalDirective);
    };
  })();
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _TemplatePortalDirective,
    selectors: [["", "cdk-portal", ""], ["", "portal", ""]],
    exportAs: ["cdkPortal"],
    features: [\u0275\u0275ProvidersFeature([{
      provide: CdkPortal,
      useExisting: _TemplatePortalDirective
    }]), \u0275\u0275InheritDefinitionFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(TemplatePortalDirective, [{
    type: Directive,
    args: [{
      selector: "[cdk-portal], [portal]",
      exportAs: "cdkPortal",
      providers: [{
        provide: CdkPortal,
        useExisting: TemplatePortalDirective
      }]
    }]
  }], null, null);
})();
var CdkPortalOutlet = class _CdkPortalOutlet extends BasePortalOutlet {
  _moduleRef = inject2(NgModuleRef$1, {
    optional: true
  });
  _document = inject2(DOCUMENT);
  _viewContainerRef = inject2(ViewContainerRef);
  /** Whether the portal component is initialized. */
  _isInitialized = false;
  /** Reference to the currently-attached component/view ref. */
  _attachedRef;
  constructor() {
    super();
  }
  /** Portal associated with the Portal outlet. */
  get portal() {
    return this._attachedPortal;
  }
  set portal(portal) {
    if (this.hasAttached() && !portal && !this._isInitialized) {
      return;
    }
    if (this.hasAttached()) {
      super.detach();
    }
    if (portal) {
      super.attach(portal);
    }
    this._attachedPortal = portal || null;
  }
  /** Emits when a portal is attached to the outlet. */
  attached = new EventEmitter();
  /** Component or view reference that is attached to the portal. */
  get attachedRef() {
    return this._attachedRef;
  }
  ngOnInit() {
    this._isInitialized = true;
  }
  ngOnDestroy() {
    super.dispose();
    this._attachedRef = this._attachedPortal = null;
  }
  /**
   * Attach the given ComponentPortal to this PortalOutlet.
   *
   * @param portal Portal to be attached to the portal outlet.
   * @returns Reference to the created component.
   */
  attachComponentPortal(portal) {
    portal.setAttachedHost(this);
    const viewContainerRef = portal.viewContainerRef != null ? portal.viewContainerRef : this._viewContainerRef;
    const ref = viewContainerRef.createComponent(portal.component, {
      index: viewContainerRef.length,
      injector: portal.injector || viewContainerRef.injector,
      projectableNodes: portal.projectableNodes || void 0,
      ngModuleRef: this._moduleRef || void 0
    });
    if (viewContainerRef !== this._viewContainerRef) {
      this._getRootNode().appendChild(ref.hostView.rootNodes[0]);
    }
    super.setDisposeFn(() => ref.destroy());
    this._attachedPortal = portal;
    this._attachedRef = ref;
    this.attached.emit(ref);
    return ref;
  }
  /**
   * Attach the given TemplatePortal to this PortalHost as an embedded View.
   * @param portal Portal to be attached.
   * @returns Reference to the created embedded view.
   */
  attachTemplatePortal(portal) {
    portal.setAttachedHost(this);
    const viewRef = this._viewContainerRef.createEmbeddedView(portal.templateRef, portal.context, {
      injector: portal.injector
    });
    super.setDisposeFn(() => this._viewContainerRef.clear());
    this._attachedPortal = portal;
    this._attachedRef = viewRef;
    this.attached.emit(viewRef);
    return viewRef;
  }
  /**
   * Attaches the given DomPortal to this PortalHost by moving all of the portal content into it.
   * @param portal Portal to be attached.
   * @deprecated To be turned into a method.
   * @breaking-change 10.0.0
   */
  attachDomPortal = (portal) => {
    const element = portal.element;
    if (!element.parentNode && (typeof ngDevMode === "undefined" || ngDevMode)) {
      throw Error("DOM portal content must be attached to a parent node.");
    }
    const anchorNode = this._document.createComment("dom-portal");
    portal.setAttachedHost(this);
    element.parentNode.insertBefore(anchorNode, element);
    this._getRootNode().appendChild(element);
    this._attachedPortal = portal;
    super.setDisposeFn(() => {
      if (anchorNode.parentNode) {
        anchorNode.parentNode.replaceChild(element, anchorNode);
      }
    });
  };
  /** Gets the root node of the portal outlet. */
  _getRootNode() {
    const nativeElement = this._viewContainerRef.element.nativeElement;
    return nativeElement.nodeType === nativeElement.ELEMENT_NODE ? nativeElement : nativeElement.parentNode;
  }
  static \u0275fac = function CdkPortalOutlet_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _CdkPortalOutlet)();
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _CdkPortalOutlet,
    selectors: [["", "cdkPortalOutlet", ""]],
    inputs: {
      portal: [0, "cdkPortalOutlet", "portal"]
    },
    outputs: {
      attached: "attached"
    },
    exportAs: ["cdkPortalOutlet"],
    features: [\u0275\u0275InheritDefinitionFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CdkPortalOutlet, [{
    type: Directive,
    args: [{
      selector: "[cdkPortalOutlet]",
      exportAs: "cdkPortalOutlet"
    }]
  }], () => [], {
    portal: [{
      type: Input,
      args: ["cdkPortalOutlet"]
    }],
    attached: [{
      type: Output
    }]
  });
})();
var PortalHostDirective = class _PortalHostDirective extends CdkPortalOutlet {
  static \u0275fac = /* @__PURE__ */ (() => {
    let \u0275PortalHostDirective_BaseFactory;
    return function PortalHostDirective_Factory(__ngFactoryType__) {
      return (\u0275PortalHostDirective_BaseFactory || (\u0275PortalHostDirective_BaseFactory = \u0275\u0275getInheritedFactory(_PortalHostDirective)))(__ngFactoryType__ || _PortalHostDirective);
    };
  })();
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _PortalHostDirective,
    selectors: [["", "cdkPortalHost", ""], ["", "portalHost", ""]],
    inputs: {
      portal: [0, "cdkPortalHost", "portal"]
    },
    exportAs: ["cdkPortalHost"],
    features: [\u0275\u0275ProvidersFeature([{
      provide: CdkPortalOutlet,
      useExisting: _PortalHostDirective
    }]), \u0275\u0275InheritDefinitionFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PortalHostDirective, [{
    type: Directive,
    args: [{
      selector: "[cdkPortalHost], [portalHost]",
      exportAs: "cdkPortalHost",
      inputs: [{
        name: "portal",
        alias: "cdkPortalHost"
      }],
      providers: [{
        provide: CdkPortalOutlet,
        useExisting: PortalHostDirective
      }]
    }]
  }], null, null);
})();
var PortalModule = class _PortalModule {
  static \u0275fac = function PortalModule_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _PortalModule)();
  };
  static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
    type: _PortalModule,
    imports: [CdkPortal, CdkPortalOutlet, TemplatePortalDirective, PortalHostDirective],
    exports: [CdkPortal, CdkPortalOutlet, TemplatePortalDirective, PortalHostDirective]
  });
  static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({});
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PortalModule, [{
    type: NgModule,
    args: [{
      imports: [CdkPortal, CdkPortalOutlet, TemplatePortalDirective, PortalHostDirective],
      exports: [CdkPortal, CdkPortalOutlet, TemplatePortalDirective, PortalHostDirective]
    }]
  }], null, null);
})();

// node_modules/@angular/cdk/fesm2022/overlay-module-Bd2UplUU.mjs
var scrollBehaviorSupported2 = supportsScrollBehavior();
function createBlockScrollStrategy(injector) {
  return new BlockScrollStrategy(injector.get(ViewportRuler), injector.get(DOCUMENT));
}
var BlockScrollStrategy = class {
  _viewportRuler;
  _previousHTMLStyles = {
    top: "",
    left: ""
  };
  _previousScrollPosition;
  _isEnabled = false;
  _document;
  constructor(_viewportRuler, document2) {
    this._viewportRuler = _viewportRuler;
    this._document = document2;
  }
  /** Attaches this scroll strategy to an overlay. */
  attach() {
  }
  /** Blocks page-level scroll while the attached overlay is open. */
  enable() {
    if (this._canBeEnabled()) {
      const root = this._document.documentElement;
      this._previousScrollPosition = this._viewportRuler.getViewportScrollPosition();
      this._previousHTMLStyles.left = root.style.left || "";
      this._previousHTMLStyles.top = root.style.top || "";
      root.style.left = coerceCssPixelValue(-this._previousScrollPosition.left);
      root.style.top = coerceCssPixelValue(-this._previousScrollPosition.top);
      root.classList.add("cdk-global-scrollblock");
      this._isEnabled = true;
    }
  }
  /** Unblocks page-level scroll while the attached overlay is open. */
  disable() {
    if (this._isEnabled) {
      const html = this._document.documentElement;
      const body = this._document.body;
      const htmlStyle = html.style;
      const bodyStyle = body.style;
      const previousHtmlScrollBehavior = htmlStyle.scrollBehavior || "";
      const previousBodyScrollBehavior = bodyStyle.scrollBehavior || "";
      this._isEnabled = false;
      htmlStyle.left = this._previousHTMLStyles.left;
      htmlStyle.top = this._previousHTMLStyles.top;
      html.classList.remove("cdk-global-scrollblock");
      if (scrollBehaviorSupported2) {
        htmlStyle.scrollBehavior = bodyStyle.scrollBehavior = "auto";
      }
      window.scroll(this._previousScrollPosition.left, this._previousScrollPosition.top);
      if (scrollBehaviorSupported2) {
        htmlStyle.scrollBehavior = previousHtmlScrollBehavior;
        bodyStyle.scrollBehavior = previousBodyScrollBehavior;
      }
    }
  }
  _canBeEnabled() {
    const html = this._document.documentElement;
    if (html.classList.contains("cdk-global-scrollblock") || this._isEnabled) {
      return false;
    }
    const rootElement = this._document.documentElement;
    const viewport = this._viewportRuler.getViewportSize();
    return rootElement.scrollHeight > viewport.height || rootElement.scrollWidth > viewport.width;
  }
};
function getMatScrollStrategyAlreadyAttachedError() {
  return Error(`Scroll strategy has already been attached.`);
}
function createCloseScrollStrategy(injector, config2) {
  return new CloseScrollStrategy(injector.get(ScrollDispatcher), injector.get(NgZone), injector.get(ViewportRuler), config2);
}
var CloseScrollStrategy = class {
  _scrollDispatcher;
  _ngZone;
  _viewportRuler;
  _config;
  _scrollSubscription = null;
  _overlayRef;
  _initialScrollPosition;
  constructor(_scrollDispatcher, _ngZone, _viewportRuler, _config) {
    this._scrollDispatcher = _scrollDispatcher;
    this._ngZone = _ngZone;
    this._viewportRuler = _viewportRuler;
    this._config = _config;
  }
  /** Attaches this scroll strategy to an overlay. */
  attach(overlayRef) {
    if (this._overlayRef && (typeof ngDevMode === "undefined" || ngDevMode)) {
      throw getMatScrollStrategyAlreadyAttachedError();
    }
    this._overlayRef = overlayRef;
  }
  /** Enables the closing of the attached overlay on scroll. */
  enable() {
    if (this._scrollSubscription) {
      return;
    }
    const stream = this._scrollDispatcher.scrolled(0).pipe(filter((scrollable) => {
      return !scrollable || !this._overlayRef.overlayElement.contains(scrollable.getElementRef().nativeElement);
    }));
    if (this._config && this._config.threshold && this._config.threshold > 1) {
      this._initialScrollPosition = this._viewportRuler.getViewportScrollPosition().top;
      this._scrollSubscription = stream.subscribe(() => {
        const scrollPosition = this._viewportRuler.getViewportScrollPosition().top;
        if (Math.abs(scrollPosition - this._initialScrollPosition) > this._config.threshold) {
          this._detach();
        } else {
          this._overlayRef.updatePosition();
        }
      });
    } else {
      this._scrollSubscription = stream.subscribe(this._detach);
    }
  }
  /** Disables the closing the attached overlay on scroll. */
  disable() {
    if (this._scrollSubscription) {
      this._scrollSubscription.unsubscribe();
      this._scrollSubscription = null;
    }
  }
  detach() {
    this.disable();
    this._overlayRef = null;
  }
  /** Detaches the overlay ref and disables the scroll strategy. */
  _detach = () => {
    this.disable();
    if (this._overlayRef.hasAttached()) {
      this._ngZone.run(() => this._overlayRef.detach());
    }
  };
};
var NoopScrollStrategy = class {
  /** Does nothing, as this scroll strategy is a no-op. */
  enable() {
  }
  /** Does nothing, as this scroll strategy is a no-op. */
  disable() {
  }
  /** Does nothing, as this scroll strategy is a no-op. */
  attach() {
  }
};
function isElementScrolledOutsideView(element, scrollContainers) {
  return scrollContainers.some((containerBounds) => {
    const outsideAbove = element.bottom < containerBounds.top;
    const outsideBelow = element.top > containerBounds.bottom;
    const outsideLeft = element.right < containerBounds.left;
    const outsideRight = element.left > containerBounds.right;
    return outsideAbove || outsideBelow || outsideLeft || outsideRight;
  });
}
function isElementClippedByScrolling(element, scrollContainers) {
  return scrollContainers.some((scrollContainerRect) => {
    const clippedAbove = element.top < scrollContainerRect.top;
    const clippedBelow = element.bottom > scrollContainerRect.bottom;
    const clippedLeft = element.left < scrollContainerRect.left;
    const clippedRight = element.right > scrollContainerRect.right;
    return clippedAbove || clippedBelow || clippedLeft || clippedRight;
  });
}
function createRepositionScrollStrategy(injector, config2) {
  return new RepositionScrollStrategy(injector.get(ScrollDispatcher), injector.get(ViewportRuler), injector.get(NgZone), config2);
}
var RepositionScrollStrategy = class {
  _scrollDispatcher;
  _viewportRuler;
  _ngZone;
  _config;
  _scrollSubscription = null;
  _overlayRef;
  constructor(_scrollDispatcher, _viewportRuler, _ngZone, _config) {
    this._scrollDispatcher = _scrollDispatcher;
    this._viewportRuler = _viewportRuler;
    this._ngZone = _ngZone;
    this._config = _config;
  }
  /** Attaches this scroll strategy to an overlay. */
  attach(overlayRef) {
    if (this._overlayRef && (typeof ngDevMode === "undefined" || ngDevMode)) {
      throw getMatScrollStrategyAlreadyAttachedError();
    }
    this._overlayRef = overlayRef;
  }
  /** Enables repositioning of the attached overlay on scroll. */
  enable() {
    if (!this._scrollSubscription) {
      const throttle2 = this._config ? this._config.scrollThrottle : 0;
      this._scrollSubscription = this._scrollDispatcher.scrolled(throttle2).subscribe(() => {
        this._overlayRef.updatePosition();
        if (this._config && this._config.autoClose) {
          const overlayRect = this._overlayRef.overlayElement.getBoundingClientRect();
          const {
            width,
            height
          } = this._viewportRuler.getViewportSize();
          const parentRects = [{
            width,
            height,
            bottom: height,
            right: width,
            top: 0,
            left: 0
          }];
          if (isElementScrolledOutsideView(overlayRect, parentRects)) {
            this.disable();
            this._ngZone.run(() => this._overlayRef.detach());
          }
        }
      });
    }
  }
  /** Disables repositioning of the attached overlay on scroll. */
  disable() {
    if (this._scrollSubscription) {
      this._scrollSubscription.unsubscribe();
      this._scrollSubscription = null;
    }
  }
  detach() {
    this.disable();
    this._overlayRef = null;
  }
};
var ScrollStrategyOptions = class _ScrollStrategyOptions {
  _injector = inject2(Injector);
  constructor() {
  }
  /** Do nothing on scroll. */
  noop = () => new NoopScrollStrategy();
  /**
   * Close the overlay as soon as the user scrolls.
   * @param config Configuration to be used inside the scroll strategy.
   */
  close = (config2) => createCloseScrollStrategy(this._injector, config2);
  /** Block scrolling. */
  block = () => createBlockScrollStrategy(this._injector);
  /**
   * Update the overlay's position on scroll.
   * @param config Configuration to be used inside the scroll strategy.
   * Allows debouncing the reposition calls.
   */
  reposition = (config2) => createRepositionScrollStrategy(this._injector, config2);
  static \u0275fac = function ScrollStrategyOptions_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _ScrollStrategyOptions)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _ScrollStrategyOptions,
    factory: _ScrollStrategyOptions.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ScrollStrategyOptions, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], () => [], null);
})();
var OverlayConfig = class {
  /** Strategy with which to position the overlay. */
  positionStrategy;
  /** Strategy to be used when handling scroll events while the overlay is open. */
  scrollStrategy = new NoopScrollStrategy();
  /** Custom class to add to the overlay pane. */
  panelClass = "";
  /** Whether the overlay has a backdrop. */
  hasBackdrop = false;
  /** Custom class to add to the backdrop */
  backdropClass = "cdk-overlay-dark-backdrop";
  /** Whether to disable any built-in animations. */
  disableAnimations;
  /** The width of the overlay panel. If a number is provided, pixel units are assumed. */
  width;
  /** The height of the overlay panel. If a number is provided, pixel units are assumed. */
  height;
  /** The min-width of the overlay panel. If a number is provided, pixel units are assumed. */
  minWidth;
  /** The min-height of the overlay panel. If a number is provided, pixel units are assumed. */
  minHeight;
  /** The max-width of the overlay panel. If a number is provided, pixel units are assumed. */
  maxWidth;
  /** The max-height of the overlay panel. If a number is provided, pixel units are assumed. */
  maxHeight;
  /**
   * Direction of the text in the overlay panel. If a `Directionality` instance
   * is passed in, the overlay will handle changes to its value automatically.
   */
  direction;
  /**
   * Whether the overlay should be disposed of when the user goes backwards/forwards in history.
   * Note that this usually doesn't include clicking on links (unless the user is using
   * the `HashLocationStrategy`).
   */
  disposeOnNavigation = false;
  constructor(config2) {
    if (config2) {
      const configKeys = Object.keys(config2);
      for (const key of configKeys) {
        if (config2[key] !== void 0) {
          this[key] = config2[key];
        }
      }
    }
  }
};
var ConnectedOverlayPositionChange = class {
  connectionPair;
  scrollableViewProperties;
  constructor(connectionPair, scrollableViewProperties) {
    this.connectionPair = connectionPair;
    this.scrollableViewProperties = scrollableViewProperties;
  }
};
function validateVerticalPosition(property, value) {
  if (value !== "top" && value !== "bottom" && value !== "center") {
    throw Error(`ConnectedPosition: Invalid ${property} "${value}". Expected "top", "bottom" or "center".`);
  }
}
function validateHorizontalPosition(property, value) {
  if (value !== "start" && value !== "end" && value !== "center") {
    throw Error(`ConnectedPosition: Invalid ${property} "${value}". Expected "start", "end" or "center".`);
  }
}
var BaseOverlayDispatcher = class _BaseOverlayDispatcher {
  /** Currently attached overlays in the order they were attached. */
  _attachedOverlays = [];
  _document = inject2(DOCUMENT);
  _isAttached;
  constructor() {
  }
  ngOnDestroy() {
    this.detach();
  }
  /** Add a new overlay to the list of attached overlay refs. */
  add(overlayRef) {
    this.remove(overlayRef);
    this._attachedOverlays.push(overlayRef);
  }
  /** Remove an overlay from the list of attached overlay refs. */
  remove(overlayRef) {
    const index = this._attachedOverlays.indexOf(overlayRef);
    if (index > -1) {
      this._attachedOverlays.splice(index, 1);
    }
    if (this._attachedOverlays.length === 0) {
      this.detach();
    }
  }
  static \u0275fac = function BaseOverlayDispatcher_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _BaseOverlayDispatcher)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _BaseOverlayDispatcher,
    factory: _BaseOverlayDispatcher.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(BaseOverlayDispatcher, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], () => [], null);
})();
var OverlayKeyboardDispatcher = class _OverlayKeyboardDispatcher extends BaseOverlayDispatcher {
  _ngZone = inject2(NgZone);
  _renderer = inject2(RendererFactory2).createRenderer(null, null);
  _cleanupKeydown;
  /** Add a new overlay to the list of attached overlay refs. */
  add(overlayRef) {
    super.add(overlayRef);
    if (!this._isAttached) {
      this._ngZone.runOutsideAngular(() => {
        this._cleanupKeydown = this._renderer.listen("body", "keydown", this._keydownListener);
      });
      this._isAttached = true;
    }
  }
  /** Detaches the global keyboard event listener. */
  detach() {
    if (this._isAttached) {
      this._cleanupKeydown?.();
      this._isAttached = false;
    }
  }
  /** Keyboard event listener that will be attached to the body. */
  _keydownListener = (event) => {
    const overlays = this._attachedOverlays;
    for (let i = overlays.length - 1; i > -1; i--) {
      if (overlays[i]._keydownEvents.observers.length > 0) {
        this._ngZone.run(() => overlays[i]._keydownEvents.next(event));
        break;
      }
    }
  };
  static \u0275fac = /* @__PURE__ */ (() => {
    let \u0275OverlayKeyboardDispatcher_BaseFactory;
    return function OverlayKeyboardDispatcher_Factory(__ngFactoryType__) {
      return (\u0275OverlayKeyboardDispatcher_BaseFactory || (\u0275OverlayKeyboardDispatcher_BaseFactory = \u0275\u0275getInheritedFactory(_OverlayKeyboardDispatcher)))(__ngFactoryType__ || _OverlayKeyboardDispatcher);
    };
  })();
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _OverlayKeyboardDispatcher,
    factory: _OverlayKeyboardDispatcher.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(OverlayKeyboardDispatcher, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], null, null);
})();
var OverlayOutsideClickDispatcher = class _OverlayOutsideClickDispatcher extends BaseOverlayDispatcher {
  _platform = inject2(Platform);
  _ngZone = inject2(NgZone);
  _renderer = inject2(RendererFactory2).createRenderer(null, null);
  _cursorOriginalValue;
  _cursorStyleIsSet = false;
  _pointerDownEventTarget;
  _cleanups;
  /** Add a new overlay to the list of attached overlay refs. */
  add(overlayRef) {
    super.add(overlayRef);
    if (!this._isAttached) {
      const body = this._document.body;
      const eventOptions = {
        capture: true
      };
      const renderer = this._renderer;
      this._cleanups = this._ngZone.runOutsideAngular(() => [renderer.listen(body, "pointerdown", this._pointerDownListener, eventOptions), renderer.listen(body, "click", this._clickListener, eventOptions), renderer.listen(body, "auxclick", this._clickListener, eventOptions), renderer.listen(body, "contextmenu", this._clickListener, eventOptions)]);
      if (this._platform.IOS && !this._cursorStyleIsSet) {
        this._cursorOriginalValue = body.style.cursor;
        body.style.cursor = "pointer";
        this._cursorStyleIsSet = true;
      }
      this._isAttached = true;
    }
  }
  /** Detaches the global keyboard event listener. */
  detach() {
    if (this._isAttached) {
      this._cleanups?.forEach((cleanup) => cleanup());
      this._cleanups = void 0;
      if (this._platform.IOS && this._cursorStyleIsSet) {
        this._document.body.style.cursor = this._cursorOriginalValue;
        this._cursorStyleIsSet = false;
      }
      this._isAttached = false;
    }
  }
  /** Store pointerdown event target to track origin of click. */
  _pointerDownListener = (event) => {
    this._pointerDownEventTarget = _getEventTarget(event);
  };
  /** Click event listener that will be attached to the body propagate phase. */
  _clickListener = (event) => {
    const target = _getEventTarget(event);
    const origin = event.type === "click" && this._pointerDownEventTarget ? this._pointerDownEventTarget : target;
    this._pointerDownEventTarget = null;
    const overlays = this._attachedOverlays.slice();
    for (let i = overlays.length - 1; i > -1; i--) {
      const overlayRef = overlays[i];
      if (overlayRef._outsidePointerEvents.observers.length < 1 || !overlayRef.hasAttached()) {
        continue;
      }
      if (containsPierceShadowDom(overlayRef.overlayElement, target) || containsPierceShadowDom(overlayRef.overlayElement, origin)) {
        break;
      }
      const outsidePointerEvents = overlayRef._outsidePointerEvents;
      if (this._ngZone) {
        this._ngZone.run(() => outsidePointerEvents.next(event));
      } else {
        outsidePointerEvents.next(event);
      }
    }
  };
  static \u0275fac = /* @__PURE__ */ (() => {
    let \u0275OverlayOutsideClickDispatcher_BaseFactory;
    return function OverlayOutsideClickDispatcher_Factory(__ngFactoryType__) {
      return (\u0275OverlayOutsideClickDispatcher_BaseFactory || (\u0275OverlayOutsideClickDispatcher_BaseFactory = \u0275\u0275getInheritedFactory(_OverlayOutsideClickDispatcher)))(__ngFactoryType__ || _OverlayOutsideClickDispatcher);
    };
  })();
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _OverlayOutsideClickDispatcher,
    factory: _OverlayOutsideClickDispatcher.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(OverlayOutsideClickDispatcher, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], null, null);
})();
function containsPierceShadowDom(parent, child) {
  const supportsShadowRoot = typeof ShadowRoot !== "undefined" && ShadowRoot;
  let current = child;
  while (current) {
    if (current === parent) {
      return true;
    }
    current = supportsShadowRoot && current instanceof ShadowRoot ? current.host : current.parentNode;
  }
  return false;
}
var _CdkOverlayStyleLoader = class __CdkOverlayStyleLoader {
  static \u0275fac = function _CdkOverlayStyleLoader_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || __CdkOverlayStyleLoader)();
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({
    type: __CdkOverlayStyleLoader,
    selectors: [["ng-component"]],
    hostAttrs: ["cdk-overlay-style-loader", ""],
    decls: 0,
    vars: 0,
    template: function _CdkOverlayStyleLoader_Template(rf, ctx) {
    },
    styles: [".cdk-overlay-container,.cdk-global-overlay-wrapper{pointer-events:none;top:0;left:0;height:100%;width:100%}.cdk-overlay-container{position:fixed}@layer cdk-overlay{.cdk-overlay-container{z-index:1000}}.cdk-overlay-container:empty{display:none}.cdk-global-overlay-wrapper{display:flex;position:absolute}@layer cdk-overlay{.cdk-global-overlay-wrapper{z-index:1000}}.cdk-overlay-pane{position:absolute;pointer-events:auto;box-sizing:border-box;display:flex;max-width:100%;max-height:100%}@layer cdk-overlay{.cdk-overlay-pane{z-index:1000}}.cdk-overlay-backdrop{position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:auto;-webkit-tap-highlight-color:rgba(0,0,0,0);opacity:0;touch-action:manipulation}@layer cdk-overlay{.cdk-overlay-backdrop{z-index:1000;transition:opacity 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}}@media(prefers-reduced-motion){.cdk-overlay-backdrop{transition-duration:1ms}}.cdk-overlay-backdrop-showing{opacity:1}@media(forced-colors: active){.cdk-overlay-backdrop-showing{opacity:.6}}@layer cdk-overlay{.cdk-overlay-dark-backdrop{background:rgba(0,0,0,.32)}}.cdk-overlay-transparent-backdrop{transition:visibility 1ms linear,opacity 1ms linear;visibility:hidden;opacity:1}.cdk-overlay-transparent-backdrop.cdk-overlay-backdrop-showing,.cdk-high-contrast-active .cdk-overlay-transparent-backdrop{opacity:0;visibility:visible}.cdk-overlay-backdrop-noop-animation{transition:none}.cdk-overlay-connected-position-bounding-box{position:absolute;display:flex;flex-direction:column;min-width:1px;min-height:1px}@layer cdk-overlay{.cdk-overlay-connected-position-bounding-box{z-index:1000}}.cdk-global-scrollblock{position:fixed;width:100%;overflow-y:scroll}\n"],
    encapsulation: 2,
    changeDetection: 0
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(_CdkOverlayStyleLoader, [{
    type: Component,
    args: [{
      template: "",
      changeDetection: ChangeDetectionStrategy.OnPush,
      encapsulation: ViewEncapsulation.None,
      host: {
        "cdk-overlay-style-loader": ""
      },
      styles: [".cdk-overlay-container,.cdk-global-overlay-wrapper{pointer-events:none;top:0;left:0;height:100%;width:100%}.cdk-overlay-container{position:fixed}@layer cdk-overlay{.cdk-overlay-container{z-index:1000}}.cdk-overlay-container:empty{display:none}.cdk-global-overlay-wrapper{display:flex;position:absolute}@layer cdk-overlay{.cdk-global-overlay-wrapper{z-index:1000}}.cdk-overlay-pane{position:absolute;pointer-events:auto;box-sizing:border-box;display:flex;max-width:100%;max-height:100%}@layer cdk-overlay{.cdk-overlay-pane{z-index:1000}}.cdk-overlay-backdrop{position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:auto;-webkit-tap-highlight-color:rgba(0,0,0,0);opacity:0;touch-action:manipulation}@layer cdk-overlay{.cdk-overlay-backdrop{z-index:1000;transition:opacity 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}}@media(prefers-reduced-motion){.cdk-overlay-backdrop{transition-duration:1ms}}.cdk-overlay-backdrop-showing{opacity:1}@media(forced-colors: active){.cdk-overlay-backdrop-showing{opacity:.6}}@layer cdk-overlay{.cdk-overlay-dark-backdrop{background:rgba(0,0,0,.32)}}.cdk-overlay-transparent-backdrop{transition:visibility 1ms linear,opacity 1ms linear;visibility:hidden;opacity:1}.cdk-overlay-transparent-backdrop.cdk-overlay-backdrop-showing,.cdk-high-contrast-active .cdk-overlay-transparent-backdrop{opacity:0;visibility:visible}.cdk-overlay-backdrop-noop-animation{transition:none}.cdk-overlay-connected-position-bounding-box{position:absolute;display:flex;flex-direction:column;min-width:1px;min-height:1px}@layer cdk-overlay{.cdk-overlay-connected-position-bounding-box{z-index:1000}}.cdk-global-scrollblock{position:fixed;width:100%;overflow-y:scroll}\n"]
    }]
  }], null, null);
})();
var OverlayContainer = class _OverlayContainer {
  _platform = inject2(Platform);
  _containerElement;
  _document = inject2(DOCUMENT);
  _styleLoader = inject2(_CdkPrivateStyleLoader);
  constructor() {
  }
  ngOnDestroy() {
    this._containerElement?.remove();
  }
  /**
   * This method returns the overlay container element. It will lazily
   * create the element the first time it is called to facilitate using
   * the container in non-browser environments.
   * @returns the container element
   */
  getContainerElement() {
    this._loadStyles();
    if (!this._containerElement) {
      this._createContainer();
    }
    return this._containerElement;
  }
  /**
   * Create the overlay container element, which is simply a div
   * with the 'cdk-overlay-container' class on the document body.
   */
  _createContainer() {
    const containerClass = "cdk-overlay-container";
    if (this._platform.isBrowser || _isTestEnvironment()) {
      const oppositePlatformContainers = this._document.querySelectorAll(`.${containerClass}[platform="server"], .${containerClass}[platform="test"]`);
      for (let i = 0; i < oppositePlatformContainers.length; i++) {
        oppositePlatformContainers[i].remove();
      }
    }
    const container = this._document.createElement("div");
    container.classList.add(containerClass);
    if (_isTestEnvironment()) {
      container.setAttribute("platform", "test");
    } else if (!this._platform.isBrowser) {
      container.setAttribute("platform", "server");
    }
    this._document.body.appendChild(container);
    this._containerElement = container;
  }
  /** Loads the structural styles necessary for the overlay to work. */
  _loadStyles() {
    this._styleLoader.load(_CdkOverlayStyleLoader);
  }
  static \u0275fac = function OverlayContainer_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _OverlayContainer)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _OverlayContainer,
    factory: _OverlayContainer.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(OverlayContainer, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], () => [], null);
})();
var BackdropRef = class {
  _renderer;
  _ngZone;
  element;
  _cleanupClick;
  _cleanupTransitionEnd;
  _fallbackTimeout;
  constructor(document2, _renderer, _ngZone, onClick) {
    this._renderer = _renderer;
    this._ngZone = _ngZone;
    this.element = document2.createElement("div");
    this.element.classList.add("cdk-overlay-backdrop");
    this._cleanupClick = _renderer.listen(this.element, "click", onClick);
  }
  detach() {
    this._ngZone.runOutsideAngular(() => {
      const element = this.element;
      clearTimeout(this._fallbackTimeout);
      this._cleanupTransitionEnd?.();
      this._cleanupTransitionEnd = this._renderer.listen(element, "transitionend", this.dispose);
      this._fallbackTimeout = setTimeout(this.dispose, 500);
      element.style.pointerEvents = "none";
      element.classList.remove("cdk-overlay-backdrop-showing");
    });
  }
  dispose = () => {
    clearTimeout(this._fallbackTimeout);
    this._cleanupClick?.();
    this._cleanupTransitionEnd?.();
    this._cleanupClick = this._cleanupTransitionEnd = this._fallbackTimeout = void 0;
    this.element.remove();
  };
};
var OverlayRef = class {
  _portalOutlet;
  _host;
  _pane;
  _config;
  _ngZone;
  _keyboardDispatcher;
  _document;
  _location;
  _outsideClickDispatcher;
  _animationsDisabled;
  _injector;
  _renderer;
  _backdropClick = new Subject();
  _attachments = new Subject();
  _detachments = new Subject();
  _positionStrategy;
  _scrollStrategy;
  _locationChanges = Subscription.EMPTY;
  _backdropRef = null;
  _detachContentMutationObserver;
  _detachContentAfterRenderRef;
  /**
   * Reference to the parent of the `_host` at the time it was detached. Used to restore
   * the `_host` to its original position in the DOM when it gets re-attached.
   */
  _previousHostParent;
  /** Stream of keydown events dispatched to this overlay. */
  _keydownEvents = new Subject();
  /** Stream of mouse outside events dispatched to this overlay. */
  _outsidePointerEvents = new Subject();
  /** Reference to the currently-running `afterNextRender` call. */
  _afterNextRenderRef;
  constructor(_portalOutlet, _host, _pane, _config, _ngZone, _keyboardDispatcher, _document2, _location, _outsideClickDispatcher, _animationsDisabled2 = false, _injector, _renderer) {
    this._portalOutlet = _portalOutlet;
    this._host = _host;
    this._pane = _pane;
    this._config = _config;
    this._ngZone = _ngZone;
    this._keyboardDispatcher = _keyboardDispatcher;
    this._document = _document2;
    this._location = _location;
    this._outsideClickDispatcher = _outsideClickDispatcher;
    this._animationsDisabled = _animationsDisabled2;
    this._injector = _injector;
    this._renderer = _renderer;
    if (_config.scrollStrategy) {
      this._scrollStrategy = _config.scrollStrategy;
      this._scrollStrategy.attach(this);
    }
    this._positionStrategy = _config.positionStrategy;
  }
  /** The overlay's HTML element */
  get overlayElement() {
    return this._pane;
  }
  /** The overlay's backdrop HTML element. */
  get backdropElement() {
    return this._backdropRef?.element || null;
  }
  /**
   * Wrapper around the panel element. Can be used for advanced
   * positioning where a wrapper with specific styling is
   * required around the overlay pane.
   */
  get hostElement() {
    return this._host;
  }
  /**
   * Attaches content, given via a Portal, to the overlay.
   * If the overlay is configured to have a backdrop, it will be created.
   *
   * @param portal Portal instance to which to attach the overlay.
   * @returns The portal attachment result.
   */
  attach(portal) {
    if (!this._host.parentElement && this._previousHostParent) {
      this._previousHostParent.appendChild(this._host);
    }
    const attachResult = this._portalOutlet.attach(portal);
    if (this._positionStrategy) {
      this._positionStrategy.attach(this);
    }
    this._updateStackingOrder();
    this._updateElementSize();
    this._updateElementDirection();
    if (this._scrollStrategy) {
      this._scrollStrategy.enable();
    }
    this._afterNextRenderRef?.destroy();
    this._afterNextRenderRef = afterNextRender(() => {
      if (this.hasAttached()) {
        this.updatePosition();
      }
    }, {
      injector: this._injector
    });
    this._togglePointerEvents(true);
    if (this._config.hasBackdrop) {
      this._attachBackdrop();
    }
    if (this._config.panelClass) {
      this._toggleClasses(this._pane, this._config.panelClass, true);
    }
    this._attachments.next();
    this._completeDetachContent();
    this._keyboardDispatcher.add(this);
    if (this._config.disposeOnNavigation) {
      this._locationChanges = this._location.subscribe(() => this.dispose());
    }
    this._outsideClickDispatcher.add(this);
    if (typeof attachResult?.onDestroy === "function") {
      attachResult.onDestroy(() => {
        if (this.hasAttached()) {
          this._ngZone.runOutsideAngular(() => Promise.resolve().then(() => this.detach()));
        }
      });
    }
    return attachResult;
  }
  /**
   * Detaches an overlay from a portal.
   * @returns The portal detachment result.
   */
  detach() {
    if (!this.hasAttached()) {
      return;
    }
    this.detachBackdrop();
    this._togglePointerEvents(false);
    if (this._positionStrategy && this._positionStrategy.detach) {
      this._positionStrategy.detach();
    }
    if (this._scrollStrategy) {
      this._scrollStrategy.disable();
    }
    const detachmentResult = this._portalOutlet.detach();
    this._detachments.next();
    this._completeDetachContent();
    this._keyboardDispatcher.remove(this);
    this._detachContentWhenEmpty();
    this._locationChanges.unsubscribe();
    this._outsideClickDispatcher.remove(this);
    return detachmentResult;
  }
  /** Cleans up the overlay from the DOM. */
  dispose() {
    const isAttached = this.hasAttached();
    if (this._positionStrategy) {
      this._positionStrategy.dispose();
    }
    this._disposeScrollStrategy();
    this._backdropRef?.dispose();
    this._locationChanges.unsubscribe();
    this._keyboardDispatcher.remove(this);
    this._portalOutlet.dispose();
    this._attachments.complete();
    this._backdropClick.complete();
    this._keydownEvents.complete();
    this._outsidePointerEvents.complete();
    this._outsideClickDispatcher.remove(this);
    this._host?.remove();
    this._afterNextRenderRef?.destroy();
    this._previousHostParent = this._pane = this._host = this._backdropRef = null;
    if (isAttached) {
      this._detachments.next();
    }
    this._detachments.complete();
    this._completeDetachContent();
  }
  /** Whether the overlay has attached content. */
  hasAttached() {
    return this._portalOutlet.hasAttached();
  }
  /** Gets an observable that emits when the backdrop has been clicked. */
  backdropClick() {
    return this._backdropClick;
  }
  /** Gets an observable that emits when the overlay has been attached. */
  attachments() {
    return this._attachments;
  }
  /** Gets an observable that emits when the overlay has been detached. */
  detachments() {
    return this._detachments;
  }
  /** Gets an observable of keydown events targeted to this overlay. */
  keydownEvents() {
    return this._keydownEvents;
  }
  /** Gets an observable of pointer events targeted outside this overlay. */
  outsidePointerEvents() {
    return this._outsidePointerEvents;
  }
  /** Gets the current overlay configuration, which is immutable. */
  getConfig() {
    return this._config;
  }
  /** Updates the position of the overlay based on the position strategy. */
  updatePosition() {
    if (this._positionStrategy) {
      this._positionStrategy.apply();
    }
  }
  /** Switches to a new position strategy and updates the overlay position. */
  updatePositionStrategy(strategy) {
    if (strategy === this._positionStrategy) {
      return;
    }
    if (this._positionStrategy) {
      this._positionStrategy.dispose();
    }
    this._positionStrategy = strategy;
    if (this.hasAttached()) {
      strategy.attach(this);
      this.updatePosition();
    }
  }
  /** Update the size properties of the overlay. */
  updateSize(sizeConfig) {
    this._config = __spreadValues(__spreadValues({}, this._config), sizeConfig);
    this._updateElementSize();
  }
  /** Sets the LTR/RTL direction for the overlay. */
  setDirection(dir) {
    this._config = __spreadProps(__spreadValues({}, this._config), {
      direction: dir
    });
    this._updateElementDirection();
  }
  /** Add a CSS class or an array of classes to the overlay pane. */
  addPanelClass(classes) {
    if (this._pane) {
      this._toggleClasses(this._pane, classes, true);
    }
  }
  /** Remove a CSS class or an array of classes from the overlay pane. */
  removePanelClass(classes) {
    if (this._pane) {
      this._toggleClasses(this._pane, classes, false);
    }
  }
  /**
   * Returns the layout direction of the overlay panel.
   */
  getDirection() {
    const direction = this._config.direction;
    if (!direction) {
      return "ltr";
    }
    return typeof direction === "string" ? direction : direction.value;
  }
  /** Switches to a new scroll strategy. */
  updateScrollStrategy(strategy) {
    if (strategy === this._scrollStrategy) {
      return;
    }
    this._disposeScrollStrategy();
    this._scrollStrategy = strategy;
    if (this.hasAttached()) {
      strategy.attach(this);
      strategy.enable();
    }
  }
  /** Updates the text direction of the overlay panel. */
  _updateElementDirection() {
    this._host.setAttribute("dir", this.getDirection());
  }
  /** Updates the size of the overlay element based on the overlay config. */
  _updateElementSize() {
    if (!this._pane) {
      return;
    }
    const style = this._pane.style;
    style.width = coerceCssPixelValue(this._config.width);
    style.height = coerceCssPixelValue(this._config.height);
    style.minWidth = coerceCssPixelValue(this._config.minWidth);
    style.minHeight = coerceCssPixelValue(this._config.minHeight);
    style.maxWidth = coerceCssPixelValue(this._config.maxWidth);
    style.maxHeight = coerceCssPixelValue(this._config.maxHeight);
  }
  /** Toggles the pointer events for the overlay pane element. */
  _togglePointerEvents(enablePointer) {
    this._pane.style.pointerEvents = enablePointer ? "" : "none";
  }
  /** Attaches a backdrop for this overlay. */
  _attachBackdrop() {
    const showingClass = "cdk-overlay-backdrop-showing";
    this._backdropRef?.dispose();
    this._backdropRef = new BackdropRef(this._document, this._renderer, this._ngZone, (event) => {
      this._backdropClick.next(event);
    });
    if (this._animationsDisabled) {
      this._backdropRef.element.classList.add("cdk-overlay-backdrop-noop-animation");
    }
    if (this._config.backdropClass) {
      this._toggleClasses(this._backdropRef.element, this._config.backdropClass, true);
    }
    this._host.parentElement.insertBefore(this._backdropRef.element, this._host);
    if (!this._animationsDisabled && typeof requestAnimationFrame !== "undefined") {
      this._ngZone.runOutsideAngular(() => {
        requestAnimationFrame(() => this._backdropRef?.element.classList.add(showingClass));
      });
    } else {
      this._backdropRef.element.classList.add(showingClass);
    }
  }
  /**
   * Updates the stacking order of the element, moving it to the top if necessary.
   * This is required in cases where one overlay was detached, while another one,
   * that should be behind it, was destroyed. The next time both of them are opened,
   * the stacking will be wrong, because the detached element's pane will still be
   * in its original DOM position.
   */
  _updateStackingOrder() {
    if (this._host.nextSibling) {
      this._host.parentNode.appendChild(this._host);
    }
  }
  /** Detaches the backdrop (if any) associated with the overlay. */
  detachBackdrop() {
    if (this._animationsDisabled) {
      this._backdropRef?.dispose();
      this._backdropRef = null;
    } else {
      this._backdropRef?.detach();
    }
  }
  /** Toggles a single CSS class or an array of classes on an element. */
  _toggleClasses(element, cssClasses, isAdd) {
    const classes = coerceArray(cssClasses || []).filter((c) => !!c);
    if (classes.length) {
      isAdd ? element.classList.add(...classes) : element.classList.remove(...classes);
    }
  }
  /** Detaches the overlay once the content finishes animating and is removed from the DOM. */
  _detachContentWhenEmpty() {
    let rethrow = false;
    try {
      this._detachContentAfterRenderRef = afterNextRender(() => {
        rethrow = true;
        this._detachContent();
      }, {
        injector: this._injector
      });
    } catch (e) {
      if (rethrow) {
        throw e;
      }
      this._detachContent();
    }
    if (globalThis.MutationObserver && this._pane) {
      this._detachContentMutationObserver ||= new globalThis.MutationObserver(() => {
        this._detachContent();
      });
      this._detachContentMutationObserver.observe(this._pane, {
        childList: true
      });
    }
  }
  _detachContent() {
    if (!this._pane || !this._host || this._pane.children.length === 0) {
      if (this._pane && this._config.panelClass) {
        this._toggleClasses(this._pane, this._config.panelClass, false);
      }
      if (this._host && this._host.parentElement) {
        this._previousHostParent = this._host.parentElement;
        this._host.remove();
      }
      this._completeDetachContent();
    }
  }
  _completeDetachContent() {
    this._detachContentAfterRenderRef?.destroy();
    this._detachContentAfterRenderRef = void 0;
    this._detachContentMutationObserver?.disconnect();
  }
  /** Disposes of a scroll strategy. */
  _disposeScrollStrategy() {
    const scrollStrategy = this._scrollStrategy;
    scrollStrategy?.disable();
    scrollStrategy?.detach?.();
  }
};
var boundingBoxClass = "cdk-overlay-connected-position-bounding-box";
var cssUnitPattern = /([A-Za-z%]+)$/;
function createFlexibleConnectedPositionStrategy(injector, origin) {
  return new FlexibleConnectedPositionStrategy(origin, injector.get(ViewportRuler), injector.get(DOCUMENT), injector.get(Platform), injector.get(OverlayContainer));
}
var FlexibleConnectedPositionStrategy = class {
  _viewportRuler;
  _document;
  _platform;
  _overlayContainer;
  /** The overlay to which this strategy is attached. */
  _overlayRef;
  /** Whether we're performing the very first positioning of the overlay. */
  _isInitialRender;
  /** Last size used for the bounding box. Used to avoid resizing the overlay after open. */
  _lastBoundingBoxSize = {
    width: 0,
    height: 0
  };
  /** Whether the overlay was pushed in a previous positioning. */
  _isPushed = false;
  /** Whether the overlay can be pushed on-screen on the initial open. */
  _canPush = true;
  /** Whether the overlay can grow via flexible width/height after the initial open. */
  _growAfterOpen = false;
  /** Whether the overlay's width and height can be constrained to fit within the viewport. */
  _hasFlexibleDimensions = true;
  /** Whether the overlay position is locked. */
  _positionLocked = false;
  /** Cached origin dimensions */
  _originRect;
  /** Cached overlay dimensions */
  _overlayRect;
  /** Cached viewport dimensions */
  _viewportRect;
  /** Cached container dimensions */
  _containerRect;
  /** Amount of space that must be maintained between the overlay and the edge of the viewport. */
  _viewportMargin = 0;
  /** The Scrollable containers used to check scrollable view properties on position change. */
  _scrollables = [];
  /** Ordered list of preferred positions, from most to least desirable. */
  _preferredPositions = [];
  /** The origin element against which the overlay will be positioned. */
  _origin;
  /** The overlay pane element. */
  _pane;
  /** Whether the strategy has been disposed of already. */
  _isDisposed;
  /**
   * Parent element for the overlay panel used to constrain the overlay panel's size to fit
   * within the viewport.
   */
  _boundingBox;
  /** The last position to have been calculated as the best fit position. */
  _lastPosition;
  /** The last calculated scroll visibility. Only tracked  */
  _lastScrollVisibility;
  /** Subject that emits whenever the position changes. */
  _positionChanges = new Subject();
  /** Subscription to viewport size changes. */
  _resizeSubscription = Subscription.EMPTY;
  /** Default offset for the overlay along the x axis. */
  _offsetX = 0;
  /** Default offset for the overlay along the y axis. */
  _offsetY = 0;
  /** Selector to be used when finding the elements on which to set the transform origin. */
  _transformOriginSelector;
  /** Keeps track of the CSS classes that the position strategy has applied on the overlay panel. */
  _appliedPanelClasses = [];
  /** Amount by which the overlay was pushed in each axis during the last time it was positioned. */
  _previousPushAmount;
  /** Observable sequence of position changes. */
  positionChanges = this._positionChanges;
  /** Ordered list of preferred positions, from most to least desirable. */
  get positions() {
    return this._preferredPositions;
  }
  constructor(connectedTo, _viewportRuler, _document2, _platform, _overlayContainer) {
    this._viewportRuler = _viewportRuler;
    this._document = _document2;
    this._platform = _platform;
    this._overlayContainer = _overlayContainer;
    this.setOrigin(connectedTo);
  }
  /** Attaches this position strategy to an overlay. */
  attach(overlayRef) {
    if (this._overlayRef && overlayRef !== this._overlayRef && (typeof ngDevMode === "undefined" || ngDevMode)) {
      throw Error("This position strategy is already attached to an overlay");
    }
    this._validatePositions();
    overlayRef.hostElement.classList.add(boundingBoxClass);
    this._overlayRef = overlayRef;
    this._boundingBox = overlayRef.hostElement;
    this._pane = overlayRef.overlayElement;
    this._isDisposed = false;
    this._isInitialRender = true;
    this._lastPosition = null;
    this._resizeSubscription.unsubscribe();
    this._resizeSubscription = this._viewportRuler.change().subscribe(() => {
      this._isInitialRender = true;
      this.apply();
    });
  }
  /**
   * Updates the position of the overlay element, using whichever preferred position relative
   * to the origin best fits on-screen.
   *
   * The selection of a position goes as follows:
   *  - If any positions fit completely within the viewport as-is,
   *      choose the first position that does so.
   *  - If flexible dimensions are enabled and at least one satisfies the given minimum width/height,
   *      choose the position with the greatest available size modified by the positions' weight.
   *  - If pushing is enabled, take the position that went off-screen the least and push it
   *      on-screen.
   *  - If none of the previous criteria were met, use the position that goes off-screen the least.
   * @docs-private
   */
  apply() {
    if (this._isDisposed || !this._platform.isBrowser) {
      return;
    }
    if (!this._isInitialRender && this._positionLocked && this._lastPosition) {
      this.reapplyLastPosition();
      return;
    }
    this._clearPanelClasses();
    this._resetOverlayElementStyles();
    this._resetBoundingBoxStyles();
    this._viewportRect = this._getNarrowedViewportRect();
    this._originRect = this._getOriginRect();
    this._overlayRect = this._pane.getBoundingClientRect();
    this._containerRect = this._overlayContainer.getContainerElement().getBoundingClientRect();
    const originRect = this._originRect;
    const overlayRect = this._overlayRect;
    const viewportRect = this._viewportRect;
    const containerRect = this._containerRect;
    const flexibleFits = [];
    let fallback;
    for (let pos of this._preferredPositions) {
      let originPoint = this._getOriginPoint(originRect, containerRect, pos);
      let overlayPoint = this._getOverlayPoint(originPoint, overlayRect, pos);
      let overlayFit = this._getOverlayFit(overlayPoint, overlayRect, viewportRect, pos);
      if (overlayFit.isCompletelyWithinViewport) {
        this._isPushed = false;
        this._applyPosition(pos, originPoint);
        return;
      }
      if (this._canFitWithFlexibleDimensions(overlayFit, overlayPoint, viewportRect)) {
        flexibleFits.push({
          position: pos,
          origin: originPoint,
          overlayRect,
          boundingBoxRect: this._calculateBoundingBoxRect(originPoint, pos)
        });
        continue;
      }
      if (!fallback || fallback.overlayFit.visibleArea < overlayFit.visibleArea) {
        fallback = {
          overlayFit,
          overlayPoint,
          originPoint,
          position: pos,
          overlayRect
        };
      }
    }
    if (flexibleFits.length) {
      let bestFit = null;
      let bestScore = -1;
      for (const fit2 of flexibleFits) {
        const score = fit2.boundingBoxRect.width * fit2.boundingBoxRect.height * (fit2.position.weight || 1);
        if (score > bestScore) {
          bestScore = score;
          bestFit = fit2;
        }
      }
      this._isPushed = false;
      this._applyPosition(bestFit.position, bestFit.origin);
      return;
    }
    if (this._canPush) {
      this._isPushed = true;
      this._applyPosition(fallback.position, fallback.originPoint);
      return;
    }
    this._applyPosition(fallback.position, fallback.originPoint);
  }
  detach() {
    this._clearPanelClasses();
    this._lastPosition = null;
    this._previousPushAmount = null;
    this._resizeSubscription.unsubscribe();
  }
  /** Cleanup after the element gets destroyed. */
  dispose() {
    if (this._isDisposed) {
      return;
    }
    if (this._boundingBox) {
      extendStyles(this._boundingBox.style, {
        top: "",
        left: "",
        right: "",
        bottom: "",
        height: "",
        width: "",
        alignItems: "",
        justifyContent: ""
      });
    }
    if (this._pane) {
      this._resetOverlayElementStyles();
    }
    if (this._overlayRef) {
      this._overlayRef.hostElement.classList.remove(boundingBoxClass);
    }
    this.detach();
    this._positionChanges.complete();
    this._overlayRef = this._boundingBox = null;
    this._isDisposed = true;
  }
  /**
   * This re-aligns the overlay element with the trigger in its last calculated position,
   * even if a position higher in the "preferred positions" list would now fit. This
   * allows one to re-align the panel without changing the orientation of the panel.
   */
  reapplyLastPosition() {
    if (this._isDisposed || !this._platform.isBrowser) {
      return;
    }
    const lastPosition = this._lastPosition;
    if (lastPosition) {
      this._originRect = this._getOriginRect();
      this._overlayRect = this._pane.getBoundingClientRect();
      this._viewportRect = this._getNarrowedViewportRect();
      this._containerRect = this._overlayContainer.getContainerElement().getBoundingClientRect();
      const originPoint = this._getOriginPoint(this._originRect, this._containerRect, lastPosition);
      this._applyPosition(lastPosition, originPoint);
    } else {
      this.apply();
    }
  }
  /**
   * Sets the list of Scrollable containers that host the origin element so that
   * on reposition we can evaluate if it or the overlay has been clipped or outside view. Every
   * Scrollable must be an ancestor element of the strategy's origin element.
   */
  withScrollableContainers(scrollables) {
    this._scrollables = scrollables;
    return this;
  }
  /**
   * Adds new preferred positions.
   * @param positions List of positions options for this overlay.
   */
  withPositions(positions) {
    this._preferredPositions = positions;
    if (positions.indexOf(this._lastPosition) === -1) {
      this._lastPosition = null;
    }
    this._validatePositions();
    return this;
  }
  /**
   * Sets a minimum distance the overlay may be positioned to the edge of the viewport.
   * @param margin Required margin between the overlay and the viewport edge in pixels.
   */
  withViewportMargin(margin) {
    this._viewportMargin = margin;
    return this;
  }
  /** Sets whether the overlay's width and height can be constrained to fit within the viewport. */
  withFlexibleDimensions(flexibleDimensions = true) {
    this._hasFlexibleDimensions = flexibleDimensions;
    return this;
  }
  /** Sets whether the overlay can grow after the initial open via flexible width/height. */
  withGrowAfterOpen(growAfterOpen = true) {
    this._growAfterOpen = growAfterOpen;
    return this;
  }
  /** Sets whether the overlay can be pushed on-screen if none of the provided positions fit. */
  withPush(canPush = true) {
    this._canPush = canPush;
    return this;
  }
  /**
   * Sets whether the overlay's position should be locked in after it is positioned
   * initially. When an overlay is locked in, it won't attempt to reposition itself
   * when the position is re-applied (e.g. when the user scrolls away).
   * @param isLocked Whether the overlay should locked in.
   */
  withLockedPosition(isLocked = true) {
    this._positionLocked = isLocked;
    return this;
  }
  /**
   * Sets the origin, relative to which to position the overlay.
   * Using an element origin is useful for building components that need to be positioned
   * relatively to a trigger (e.g. dropdown menus or tooltips), whereas using a point can be
   * used for cases like contextual menus which open relative to the user's pointer.
   * @param origin Reference to the new origin.
   */
  setOrigin(origin) {
    this._origin = origin;
    return this;
  }
  /**
   * Sets the default offset for the overlay's connection point on the x-axis.
   * @param offset New offset in the X axis.
   */
  withDefaultOffsetX(offset) {
    this._offsetX = offset;
    return this;
  }
  /**
   * Sets the default offset for the overlay's connection point on the y-axis.
   * @param offset New offset in the Y axis.
   */
  withDefaultOffsetY(offset) {
    this._offsetY = offset;
    return this;
  }
  /**
   * Configures that the position strategy should set a `transform-origin` on some elements
   * inside the overlay, depending on the current position that is being applied. This is
   * useful for the cases where the origin of an animation can change depending on the
   * alignment of the overlay.
   * @param selector CSS selector that will be used to find the target
   *    elements onto which to set the transform origin.
   */
  withTransformOriginOn(selector) {
    this._transformOriginSelector = selector;
    return this;
  }
  /**
   * Gets the (x, y) coordinate of a connection point on the origin based on a relative position.
   */
  _getOriginPoint(originRect, containerRect, pos) {
    let x;
    if (pos.originX == "center") {
      x = originRect.left + originRect.width / 2;
    } else {
      const startX = this._isRtl() ? originRect.right : originRect.left;
      const endX = this._isRtl() ? originRect.left : originRect.right;
      x = pos.originX == "start" ? startX : endX;
    }
    if (containerRect.left < 0) {
      x -= containerRect.left;
    }
    let y;
    if (pos.originY == "center") {
      y = originRect.top + originRect.height / 2;
    } else {
      y = pos.originY == "top" ? originRect.top : originRect.bottom;
    }
    if (containerRect.top < 0) {
      y -= containerRect.top;
    }
    return {
      x,
      y
    };
  }
  /**
   * Gets the (x, y) coordinate of the top-left corner of the overlay given a given position and
   * origin point to which the overlay should be connected.
   */
  _getOverlayPoint(originPoint, overlayRect, pos) {
    let overlayStartX;
    if (pos.overlayX == "center") {
      overlayStartX = -overlayRect.width / 2;
    } else if (pos.overlayX === "start") {
      overlayStartX = this._isRtl() ? -overlayRect.width : 0;
    } else {
      overlayStartX = this._isRtl() ? 0 : -overlayRect.width;
    }
    let overlayStartY;
    if (pos.overlayY == "center") {
      overlayStartY = -overlayRect.height / 2;
    } else {
      overlayStartY = pos.overlayY == "top" ? 0 : -overlayRect.height;
    }
    return {
      x: originPoint.x + overlayStartX,
      y: originPoint.y + overlayStartY
    };
  }
  /** Gets how well an overlay at the given point will fit within the viewport. */
  _getOverlayFit(point, rawOverlayRect, viewport, position) {
    const overlay = getRoundedBoundingClientRect(rawOverlayRect);
    let {
      x,
      y
    } = point;
    let offsetX = this._getOffset(position, "x");
    let offsetY = this._getOffset(position, "y");
    if (offsetX) {
      x += offsetX;
    }
    if (offsetY) {
      y += offsetY;
    }
    let leftOverflow = 0 - x;
    let rightOverflow = x + overlay.width - viewport.width;
    let topOverflow = 0 - y;
    let bottomOverflow = y + overlay.height - viewport.height;
    let visibleWidth = this._subtractOverflows(overlay.width, leftOverflow, rightOverflow);
    let visibleHeight = this._subtractOverflows(overlay.height, topOverflow, bottomOverflow);
    let visibleArea = visibleWidth * visibleHeight;
    return {
      visibleArea,
      isCompletelyWithinViewport: overlay.width * overlay.height === visibleArea,
      fitsInViewportVertically: visibleHeight === overlay.height,
      fitsInViewportHorizontally: visibleWidth == overlay.width
    };
  }
  /**
   * Whether the overlay can fit within the viewport when it may resize either its width or height.
   * @param fit How well the overlay fits in the viewport at some position.
   * @param point The (x, y) coordinates of the overlay at some position.
   * @param viewport The geometry of the viewport.
   */
  _canFitWithFlexibleDimensions(fit2, point, viewport) {
    if (this._hasFlexibleDimensions) {
      const availableHeight = viewport.bottom - point.y;
      const availableWidth = viewport.right - point.x;
      const minHeight = getPixelValue(this._overlayRef.getConfig().minHeight);
      const minWidth = getPixelValue(this._overlayRef.getConfig().minWidth);
      const verticalFit = fit2.fitsInViewportVertically || minHeight != null && minHeight <= availableHeight;
      const horizontalFit = fit2.fitsInViewportHorizontally || minWidth != null && minWidth <= availableWidth;
      return verticalFit && horizontalFit;
    }
    return false;
  }
  /**
   * Gets the point at which the overlay can be "pushed" on-screen. If the overlay is larger than
   * the viewport, the top-left corner will be pushed on-screen (with overflow occurring on the
   * right and bottom).
   *
   * @param start Starting point from which the overlay is pushed.
   * @param rawOverlayRect Dimensions of the overlay.
   * @param scrollPosition Current viewport scroll position.
   * @returns The point at which to position the overlay after pushing. This is effectively a new
   *     originPoint.
   */
  _pushOverlayOnScreen(start, rawOverlayRect, scrollPosition) {
    if (this._previousPushAmount && this._positionLocked) {
      return {
        x: start.x + this._previousPushAmount.x,
        y: start.y + this._previousPushAmount.y
      };
    }
    const overlay = getRoundedBoundingClientRect(rawOverlayRect);
    const viewport = this._viewportRect;
    const overflowRight = Math.max(start.x + overlay.width - viewport.width, 0);
    const overflowBottom = Math.max(start.y + overlay.height - viewport.height, 0);
    const overflowTop = Math.max(viewport.top - scrollPosition.top - start.y, 0);
    const overflowLeft = Math.max(viewport.left - scrollPosition.left - start.x, 0);
    let pushX = 0;
    let pushY = 0;
    if (overlay.width <= viewport.width) {
      pushX = overflowLeft || -overflowRight;
    } else {
      pushX = start.x < this._viewportMargin ? viewport.left - scrollPosition.left - start.x : 0;
    }
    if (overlay.height <= viewport.height) {
      pushY = overflowTop || -overflowBottom;
    } else {
      pushY = start.y < this._viewportMargin ? viewport.top - scrollPosition.top - start.y : 0;
    }
    this._previousPushAmount = {
      x: pushX,
      y: pushY
    };
    return {
      x: start.x + pushX,
      y: start.y + pushY
    };
  }
  /**
   * Applies a computed position to the overlay and emits a position change.
   * @param position The position preference
   * @param originPoint The point on the origin element where the overlay is connected.
   */
  _applyPosition(position, originPoint) {
    this._setTransformOrigin(position);
    this._setOverlayElementStyles(originPoint, position);
    this._setBoundingBoxStyles(originPoint, position);
    if (position.panelClass) {
      this._addPanelClasses(position.panelClass);
    }
    if (this._positionChanges.observers.length) {
      const scrollVisibility = this._getScrollVisibility();
      if (position !== this._lastPosition || !this._lastScrollVisibility || !compareScrollVisibility(this._lastScrollVisibility, scrollVisibility)) {
        const changeEvent = new ConnectedOverlayPositionChange(position, scrollVisibility);
        this._positionChanges.next(changeEvent);
      }
      this._lastScrollVisibility = scrollVisibility;
    }
    this._lastPosition = position;
    this._isInitialRender = false;
  }
  /** Sets the transform origin based on the configured selector and the passed-in position.  */
  _setTransformOrigin(position) {
    if (!this._transformOriginSelector) {
      return;
    }
    const elements = this._boundingBox.querySelectorAll(this._transformOriginSelector);
    let xOrigin;
    let yOrigin = position.overlayY;
    if (position.overlayX === "center") {
      xOrigin = "center";
    } else if (this._isRtl()) {
      xOrigin = position.overlayX === "start" ? "right" : "left";
    } else {
      xOrigin = position.overlayX === "start" ? "left" : "right";
    }
    for (let i = 0; i < elements.length; i++) {
      elements[i].style.transformOrigin = `${xOrigin} ${yOrigin}`;
    }
  }
  /**
   * Gets the position and size of the overlay's sizing container.
   *
   * This method does no measuring and applies no styles so that we can cheaply compute the
   * bounds for all positions and choose the best fit based on these results.
   */
  _calculateBoundingBoxRect(origin, position) {
    const viewport = this._viewportRect;
    const isRtl = this._isRtl();
    let height, top, bottom;
    if (position.overlayY === "top") {
      top = origin.y;
      height = viewport.height - top + this._viewportMargin;
    } else if (position.overlayY === "bottom") {
      bottom = viewport.height - origin.y + this._viewportMargin * 2;
      height = viewport.height - bottom + this._viewportMargin;
    } else {
      const smallestDistanceToViewportEdge = Math.min(viewport.bottom - origin.y + viewport.top, origin.y);
      const previousHeight = this._lastBoundingBoxSize.height;
      height = smallestDistanceToViewportEdge * 2;
      top = origin.y - smallestDistanceToViewportEdge;
      if (height > previousHeight && !this._isInitialRender && !this._growAfterOpen) {
        top = origin.y - previousHeight / 2;
      }
    }
    const isBoundedByRightViewportEdge = position.overlayX === "start" && !isRtl || position.overlayX === "end" && isRtl;
    const isBoundedByLeftViewportEdge = position.overlayX === "end" && !isRtl || position.overlayX === "start" && isRtl;
    let width, left, right;
    if (isBoundedByLeftViewportEdge) {
      right = viewport.width - origin.x + this._viewportMargin * 2;
      width = origin.x - this._viewportMargin;
    } else if (isBoundedByRightViewportEdge) {
      left = origin.x;
      width = viewport.right - origin.x;
    } else {
      const smallestDistanceToViewportEdge = Math.min(viewport.right - origin.x + viewport.left, origin.x);
      const previousWidth = this._lastBoundingBoxSize.width;
      width = smallestDistanceToViewportEdge * 2;
      left = origin.x - smallestDistanceToViewportEdge;
      if (width > previousWidth && !this._isInitialRender && !this._growAfterOpen) {
        left = origin.x - previousWidth / 2;
      }
    }
    return {
      top,
      left,
      bottom,
      right,
      width,
      height
    };
  }
  /**
   * Sets the position and size of the overlay's sizing wrapper. The wrapper is positioned on the
   * origin's connection point and stretches to the bounds of the viewport.
   *
   * @param origin The point on the origin element where the overlay is connected.
   * @param position The position preference
   */
  _setBoundingBoxStyles(origin, position) {
    const boundingBoxRect = this._calculateBoundingBoxRect(origin, position);
    if (!this._isInitialRender && !this._growAfterOpen) {
      boundingBoxRect.height = Math.min(boundingBoxRect.height, this._lastBoundingBoxSize.height);
      boundingBoxRect.width = Math.min(boundingBoxRect.width, this._lastBoundingBoxSize.width);
    }
    const styles = {};
    if (this._hasExactPosition()) {
      styles.top = styles.left = "0";
      styles.bottom = styles.right = styles.maxHeight = styles.maxWidth = "";
      styles.width = styles.height = "100%";
    } else {
      const maxHeight = this._overlayRef.getConfig().maxHeight;
      const maxWidth = this._overlayRef.getConfig().maxWidth;
      styles.height = coerceCssPixelValue(boundingBoxRect.height);
      styles.top = coerceCssPixelValue(boundingBoxRect.top);
      styles.bottom = coerceCssPixelValue(boundingBoxRect.bottom);
      styles.width = coerceCssPixelValue(boundingBoxRect.width);
      styles.left = coerceCssPixelValue(boundingBoxRect.left);
      styles.right = coerceCssPixelValue(boundingBoxRect.right);
      if (position.overlayX === "center") {
        styles.alignItems = "center";
      } else {
        styles.alignItems = position.overlayX === "end" ? "flex-end" : "flex-start";
      }
      if (position.overlayY === "center") {
        styles.justifyContent = "center";
      } else {
        styles.justifyContent = position.overlayY === "bottom" ? "flex-end" : "flex-start";
      }
      if (maxHeight) {
        styles.maxHeight = coerceCssPixelValue(maxHeight);
      }
      if (maxWidth) {
        styles.maxWidth = coerceCssPixelValue(maxWidth);
      }
    }
    this._lastBoundingBoxSize = boundingBoxRect;
    extendStyles(this._boundingBox.style, styles);
  }
  /** Resets the styles for the bounding box so that a new positioning can be computed. */
  _resetBoundingBoxStyles() {
    extendStyles(this._boundingBox.style, {
      top: "0",
      left: "0",
      right: "0",
      bottom: "0",
      height: "",
      width: "",
      alignItems: "",
      justifyContent: ""
    });
  }
  /** Resets the styles for the overlay pane so that a new positioning can be computed. */
  _resetOverlayElementStyles() {
    extendStyles(this._pane.style, {
      top: "",
      left: "",
      bottom: "",
      right: "",
      position: "",
      transform: ""
    });
  }
  /** Sets positioning styles to the overlay element. */
  _setOverlayElementStyles(originPoint, position) {
    const styles = {};
    const hasExactPosition = this._hasExactPosition();
    const hasFlexibleDimensions = this._hasFlexibleDimensions;
    const config2 = this._overlayRef.getConfig();
    if (hasExactPosition) {
      const scrollPosition = this._viewportRuler.getViewportScrollPosition();
      extendStyles(styles, this._getExactOverlayY(position, originPoint, scrollPosition));
      extendStyles(styles, this._getExactOverlayX(position, originPoint, scrollPosition));
    } else {
      styles.position = "static";
    }
    let transformString = "";
    let offsetX = this._getOffset(position, "x");
    let offsetY = this._getOffset(position, "y");
    if (offsetX) {
      transformString += `translateX(${offsetX}px) `;
    }
    if (offsetY) {
      transformString += `translateY(${offsetY}px)`;
    }
    styles.transform = transformString.trim();
    if (config2.maxHeight) {
      if (hasExactPosition) {
        styles.maxHeight = coerceCssPixelValue(config2.maxHeight);
      } else if (hasFlexibleDimensions) {
        styles.maxHeight = "";
      }
    }
    if (config2.maxWidth) {
      if (hasExactPosition) {
        styles.maxWidth = coerceCssPixelValue(config2.maxWidth);
      } else if (hasFlexibleDimensions) {
        styles.maxWidth = "";
      }
    }
    extendStyles(this._pane.style, styles);
  }
  /** Gets the exact top/bottom for the overlay when not using flexible sizing or when pushing. */
  _getExactOverlayY(position, originPoint, scrollPosition) {
    let styles = {
      top: "",
      bottom: ""
    };
    let overlayPoint = this._getOverlayPoint(originPoint, this._overlayRect, position);
    if (this._isPushed) {
      overlayPoint = this._pushOverlayOnScreen(overlayPoint, this._overlayRect, scrollPosition);
    }
    if (position.overlayY === "bottom") {
      const documentHeight = this._document.documentElement.clientHeight;
      styles.bottom = `${documentHeight - (overlayPoint.y + this._overlayRect.height)}px`;
    } else {
      styles.top = coerceCssPixelValue(overlayPoint.y);
    }
    return styles;
  }
  /** Gets the exact left/right for the overlay when not using flexible sizing or when pushing. */
  _getExactOverlayX(position, originPoint, scrollPosition) {
    let styles = {
      left: "",
      right: ""
    };
    let overlayPoint = this._getOverlayPoint(originPoint, this._overlayRect, position);
    if (this._isPushed) {
      overlayPoint = this._pushOverlayOnScreen(overlayPoint, this._overlayRect, scrollPosition);
    }
    let horizontalStyleProperty;
    if (this._isRtl()) {
      horizontalStyleProperty = position.overlayX === "end" ? "left" : "right";
    } else {
      horizontalStyleProperty = position.overlayX === "end" ? "right" : "left";
    }
    if (horizontalStyleProperty === "right") {
      const documentWidth = this._document.documentElement.clientWidth;
      styles.right = `${documentWidth - (overlayPoint.x + this._overlayRect.width)}px`;
    } else {
      styles.left = coerceCssPixelValue(overlayPoint.x);
    }
    return styles;
  }
  /**
   * Gets the view properties of the trigger and overlay, including whether they are clipped
   * or completely outside the view of any of the strategy's scrollables.
   */
  _getScrollVisibility() {
    const originBounds = this._getOriginRect();
    const overlayBounds = this._pane.getBoundingClientRect();
    const scrollContainerBounds = this._scrollables.map((scrollable) => {
      return scrollable.getElementRef().nativeElement.getBoundingClientRect();
    });
    return {
      isOriginClipped: isElementClippedByScrolling(originBounds, scrollContainerBounds),
      isOriginOutsideView: isElementScrolledOutsideView(originBounds, scrollContainerBounds),
      isOverlayClipped: isElementClippedByScrolling(overlayBounds, scrollContainerBounds),
      isOverlayOutsideView: isElementScrolledOutsideView(overlayBounds, scrollContainerBounds)
    };
  }
  /** Subtracts the amount that an element is overflowing on an axis from its length. */
  _subtractOverflows(length, ...overflows) {
    return overflows.reduce((currentValue, currentOverflow) => {
      return currentValue - Math.max(currentOverflow, 0);
    }, length);
  }
  /** Narrows the given viewport rect by the current _viewportMargin. */
  _getNarrowedViewportRect() {
    const width = this._document.documentElement.clientWidth;
    const height = this._document.documentElement.clientHeight;
    const scrollPosition = this._viewportRuler.getViewportScrollPosition();
    return {
      top: scrollPosition.top + this._viewportMargin,
      left: scrollPosition.left + this._viewportMargin,
      right: scrollPosition.left + width - this._viewportMargin,
      bottom: scrollPosition.top + height - this._viewportMargin,
      width: width - 2 * this._viewportMargin,
      height: height - 2 * this._viewportMargin
    };
  }
  /** Whether the we're dealing with an RTL context */
  _isRtl() {
    return this._overlayRef.getDirection() === "rtl";
  }
  /** Determines whether the overlay uses exact or flexible positioning. */
  _hasExactPosition() {
    return !this._hasFlexibleDimensions || this._isPushed;
  }
  /** Retrieves the offset of a position along the x or y axis. */
  _getOffset(position, axis) {
    if (axis === "x") {
      return position.offsetX == null ? this._offsetX : position.offsetX;
    }
    return position.offsetY == null ? this._offsetY : position.offsetY;
  }
  /** Validates that the current position match the expected values. */
  _validatePositions() {
    if (typeof ngDevMode === "undefined" || ngDevMode) {
      if (!this._preferredPositions.length) {
        throw Error("FlexibleConnectedPositionStrategy: At least one position is required.");
      }
      this._preferredPositions.forEach((pair) => {
        validateHorizontalPosition("originX", pair.originX);
        validateVerticalPosition("originY", pair.originY);
        validateHorizontalPosition("overlayX", pair.overlayX);
        validateVerticalPosition("overlayY", pair.overlayY);
      });
    }
  }
  /** Adds a single CSS class or an array of classes on the overlay panel. */
  _addPanelClasses(cssClasses) {
    if (this._pane) {
      coerceArray(cssClasses).forEach((cssClass) => {
        if (cssClass !== "" && this._appliedPanelClasses.indexOf(cssClass) === -1) {
          this._appliedPanelClasses.push(cssClass);
          this._pane.classList.add(cssClass);
        }
      });
    }
  }
  /** Clears the classes that the position strategy has applied from the overlay panel. */
  _clearPanelClasses() {
    if (this._pane) {
      this._appliedPanelClasses.forEach((cssClass) => {
        this._pane.classList.remove(cssClass);
      });
      this._appliedPanelClasses = [];
    }
  }
  /** Returns the DOMRect of the current origin. */
  _getOriginRect() {
    const origin = this._origin;
    if (origin instanceof ElementRef) {
      return origin.nativeElement.getBoundingClientRect();
    }
    if (origin instanceof Element) {
      return origin.getBoundingClientRect();
    }
    const width = origin.width || 0;
    const height = origin.height || 0;
    return {
      top: origin.y,
      bottom: origin.y + height,
      left: origin.x,
      right: origin.x + width,
      height,
      width
    };
  }
};
function extendStyles(destination, source) {
  for (let key in source) {
    if (source.hasOwnProperty(key)) {
      destination[key] = source[key];
    }
  }
  return destination;
}
function getPixelValue(input2) {
  if (typeof input2 !== "number" && input2 != null) {
    const [value, units] = input2.split(cssUnitPattern);
    return !units || units === "px" ? parseFloat(value) : null;
  }
  return input2 || null;
}
function getRoundedBoundingClientRect(clientRect) {
  return {
    top: Math.floor(clientRect.top),
    right: Math.floor(clientRect.right),
    bottom: Math.floor(clientRect.bottom),
    left: Math.floor(clientRect.left),
    width: Math.floor(clientRect.width),
    height: Math.floor(clientRect.height)
  };
}
function compareScrollVisibility(a, b) {
  if (a === b) {
    return true;
  }
  return a.isOriginClipped === b.isOriginClipped && a.isOriginOutsideView === b.isOriginOutsideView && a.isOverlayClipped === b.isOverlayClipped && a.isOverlayOutsideView === b.isOverlayOutsideView;
}
var wrapperClass = "cdk-global-overlay-wrapper";
function createGlobalPositionStrategy(_injector) {
  return new GlobalPositionStrategy();
}
var GlobalPositionStrategy = class {
  /** The overlay to which this strategy is attached. */
  _overlayRef;
  _cssPosition = "static";
  _topOffset = "";
  _bottomOffset = "";
  _alignItems = "";
  _xPosition = "";
  _xOffset = "";
  _width = "";
  _height = "";
  _isDisposed = false;
  attach(overlayRef) {
    const config2 = overlayRef.getConfig();
    this._overlayRef = overlayRef;
    if (this._width && !config2.width) {
      overlayRef.updateSize({
        width: this._width
      });
    }
    if (this._height && !config2.height) {
      overlayRef.updateSize({
        height: this._height
      });
    }
    overlayRef.hostElement.classList.add(wrapperClass);
    this._isDisposed = false;
  }
  /**
   * Sets the top position of the overlay. Clears any previously set vertical position.
   * @param value New top offset.
   */
  top(value = "") {
    this._bottomOffset = "";
    this._topOffset = value;
    this._alignItems = "flex-start";
    return this;
  }
  /**
   * Sets the left position of the overlay. Clears any previously set horizontal position.
   * @param value New left offset.
   */
  left(value = "") {
    this._xOffset = value;
    this._xPosition = "left";
    return this;
  }
  /**
   * Sets the bottom position of the overlay. Clears any previously set vertical position.
   * @param value New bottom offset.
   */
  bottom(value = "") {
    this._topOffset = "";
    this._bottomOffset = value;
    this._alignItems = "flex-end";
    return this;
  }
  /**
   * Sets the right position of the overlay. Clears any previously set horizontal position.
   * @param value New right offset.
   */
  right(value = "") {
    this._xOffset = value;
    this._xPosition = "right";
    return this;
  }
  /**
   * Sets the overlay to the start of the viewport, depending on the overlay direction.
   * This will be to the left in LTR layouts and to the right in RTL.
   * @param offset Offset from the edge of the screen.
   */
  start(value = "") {
    this._xOffset = value;
    this._xPosition = "start";
    return this;
  }
  /**
   * Sets the overlay to the end of the viewport, depending on the overlay direction.
   * This will be to the right in LTR layouts and to the left in RTL.
   * @param offset Offset from the edge of the screen.
   */
  end(value = "") {
    this._xOffset = value;
    this._xPosition = "end";
    return this;
  }
  /**
   * Sets the overlay width and clears any previously set width.
   * @param value New width for the overlay
   * @deprecated Pass the `width` through the `OverlayConfig`.
   * @breaking-change 8.0.0
   */
  width(value = "") {
    if (this._overlayRef) {
      this._overlayRef.updateSize({
        width: value
      });
    } else {
      this._width = value;
    }
    return this;
  }
  /**
   * Sets the overlay height and clears any previously set height.
   * @param value New height for the overlay
   * @deprecated Pass the `height` through the `OverlayConfig`.
   * @breaking-change 8.0.0
   */
  height(value = "") {
    if (this._overlayRef) {
      this._overlayRef.updateSize({
        height: value
      });
    } else {
      this._height = value;
    }
    return this;
  }
  /**
   * Centers the overlay horizontally with an optional offset.
   * Clears any previously set horizontal position.
   *
   * @param offset Overlay offset from the horizontal center.
   */
  centerHorizontally(offset = "") {
    this.left(offset);
    this._xPosition = "center";
    return this;
  }
  /**
   * Centers the overlay vertically with an optional offset.
   * Clears any previously set vertical position.
   *
   * @param offset Overlay offset from the vertical center.
   */
  centerVertically(offset = "") {
    this.top(offset);
    this._alignItems = "center";
    return this;
  }
  /**
   * Apply the position to the element.
   * @docs-private
   */
  apply() {
    if (!this._overlayRef || !this._overlayRef.hasAttached()) {
      return;
    }
    const styles = this._overlayRef.overlayElement.style;
    const parentStyles = this._overlayRef.hostElement.style;
    const config2 = this._overlayRef.getConfig();
    const {
      width,
      height,
      maxWidth,
      maxHeight
    } = config2;
    const shouldBeFlushHorizontally = (width === "100%" || width === "100vw") && (!maxWidth || maxWidth === "100%" || maxWidth === "100vw");
    const shouldBeFlushVertically = (height === "100%" || height === "100vh") && (!maxHeight || maxHeight === "100%" || maxHeight === "100vh");
    const xPosition = this._xPosition;
    const xOffset = this._xOffset;
    const isRtl = this._overlayRef.getConfig().direction === "rtl";
    let marginLeft = "";
    let marginRight = "";
    let justifyContent = "";
    if (shouldBeFlushHorizontally) {
      justifyContent = "flex-start";
    } else if (xPosition === "center") {
      justifyContent = "center";
      if (isRtl) {
        marginRight = xOffset;
      } else {
        marginLeft = xOffset;
      }
    } else if (isRtl) {
      if (xPosition === "left" || xPosition === "end") {
        justifyContent = "flex-end";
        marginLeft = xOffset;
      } else if (xPosition === "right" || xPosition === "start") {
        justifyContent = "flex-start";
        marginRight = xOffset;
      }
    } else if (xPosition === "left" || xPosition === "start") {
      justifyContent = "flex-start";
      marginLeft = xOffset;
    } else if (xPosition === "right" || xPosition === "end") {
      justifyContent = "flex-end";
      marginRight = xOffset;
    }
    styles.position = this._cssPosition;
    styles.marginLeft = shouldBeFlushHorizontally ? "0" : marginLeft;
    styles.marginTop = shouldBeFlushVertically ? "0" : this._topOffset;
    styles.marginBottom = this._bottomOffset;
    styles.marginRight = shouldBeFlushHorizontally ? "0" : marginRight;
    parentStyles.justifyContent = justifyContent;
    parentStyles.alignItems = shouldBeFlushVertically ? "flex-start" : this._alignItems;
  }
  /**
   * Cleans up the DOM changes from the position strategy.
   * @docs-private
   */
  dispose() {
    if (this._isDisposed || !this._overlayRef) {
      return;
    }
    const styles = this._overlayRef.overlayElement.style;
    const parent = this._overlayRef.hostElement;
    const parentStyles = parent.style;
    parent.classList.remove(wrapperClass);
    parentStyles.justifyContent = parentStyles.alignItems = styles.marginTop = styles.marginBottom = styles.marginLeft = styles.marginRight = styles.position = "";
    this._overlayRef = null;
    this._isDisposed = true;
  }
};
var OverlayPositionBuilder = class _OverlayPositionBuilder {
  _injector = inject2(Injector);
  constructor() {
  }
  /**
   * Creates a global position strategy.
   */
  global() {
    return createGlobalPositionStrategy();
  }
  /**
   * Creates a flexible position strategy.
   * @param origin Origin relative to which to position the overlay.
   */
  flexibleConnectedTo(origin) {
    return createFlexibleConnectedPositionStrategy(this._injector, origin);
  }
  static \u0275fac = function OverlayPositionBuilder_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _OverlayPositionBuilder)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _OverlayPositionBuilder,
    factory: _OverlayPositionBuilder.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(OverlayPositionBuilder, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], () => [], null);
})();
function createOverlayRef(injector, config2) {
  injector.get(_CdkPrivateStyleLoader).load(_CdkOverlayStyleLoader);
  const overlayContainer = injector.get(OverlayContainer);
  const doc = injector.get(DOCUMENT);
  const idGenerator = injector.get(_IdGenerator);
  const appRef = injector.get(ApplicationRef);
  const directionality = injector.get(Directionality);
  const host = doc.createElement("div");
  const pane = doc.createElement("div");
  pane.id = idGenerator.getId("cdk-overlay-");
  pane.classList.add("cdk-overlay-pane");
  host.appendChild(pane);
  overlayContainer.getContainerElement().appendChild(host);
  const portalOutlet = new DomPortalOutlet(pane, appRef, injector);
  const overlayConfig = new OverlayConfig(config2);
  const renderer = injector.get(Renderer2, null, {
    optional: true
  }) || injector.get(RendererFactory2).createRenderer(null, null);
  overlayConfig.direction = overlayConfig.direction || directionality.value;
  return new OverlayRef(portalOutlet, host, pane, overlayConfig, injector.get(NgZone), injector.get(OverlayKeyboardDispatcher), doc, injector.get(Location), injector.get(OverlayOutsideClickDispatcher), config2?.disableAnimations ?? injector.get(ANIMATION_MODULE_TYPE, null, {
    optional: true
  }) === "NoopAnimations", injector.get(EnvironmentInjector), renderer);
}
var Overlay = class _Overlay {
  scrollStrategies = inject2(ScrollStrategyOptions);
  _positionBuilder = inject2(OverlayPositionBuilder);
  _injector = inject2(Injector);
  constructor() {
  }
  /**
   * Creates an overlay.
   * @param config Configuration applied to the overlay.
   * @returns Reference to the created overlay.
   */
  create(config2) {
    return createOverlayRef(this._injector, config2);
  }
  /**
   * Gets a position builder that can be used, via fluent API,
   * to construct and configure a position strategy.
   * @returns An overlay position builder.
   */
  position() {
    return this._positionBuilder;
  }
  static \u0275fac = function Overlay_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _Overlay)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _Overlay,
    factory: _Overlay.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(Overlay, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], () => [], null);
})();
var defaultPositionList = [{
  originX: "start",
  originY: "bottom",
  overlayX: "start",
  overlayY: "top"
}, {
  originX: "start",
  originY: "top",
  overlayX: "start",
  overlayY: "bottom"
}, {
  originX: "end",
  originY: "top",
  overlayX: "end",
  overlayY: "bottom"
}, {
  originX: "end",
  originY: "bottom",
  overlayX: "end",
  overlayY: "top"
}];
var CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY = new InjectionToken("cdk-connected-overlay-scroll-strategy", {
  providedIn: "root",
  factory: () => {
    const injector = inject2(Injector);
    return () => createRepositionScrollStrategy(injector);
  }
});
var CdkOverlayOrigin = class _CdkOverlayOrigin {
  elementRef = inject2(ElementRef);
  constructor() {
  }
  static \u0275fac = function CdkOverlayOrigin_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _CdkOverlayOrigin)();
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _CdkOverlayOrigin,
    selectors: [["", "cdk-overlay-origin", ""], ["", "overlay-origin", ""], ["", "cdkOverlayOrigin", ""]],
    exportAs: ["cdkOverlayOrigin"]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CdkOverlayOrigin, [{
    type: Directive,
    args: [{
      selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]",
      exportAs: "cdkOverlayOrigin"
    }]
  }], () => [], null);
})();
var CdkConnectedOverlay = class _CdkConnectedOverlay {
  _dir = inject2(Directionality, {
    optional: true
  });
  _injector = inject2(Injector);
  _overlayRef;
  _templatePortal;
  _backdropSubscription = Subscription.EMPTY;
  _attachSubscription = Subscription.EMPTY;
  _detachSubscription = Subscription.EMPTY;
  _positionSubscription = Subscription.EMPTY;
  _offsetX;
  _offsetY;
  _position;
  _scrollStrategyFactory = inject2(CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY);
  _disposeOnNavigation = false;
  _ngZone = inject2(NgZone);
  /** Origin for the connected overlay. */
  origin;
  /** Registered connected position pairs. */
  positions;
  /**
   * This input overrides the positions input if specified. It lets users pass
   * in arbitrary positioning strategies.
   */
  positionStrategy;
  /** The offset in pixels for the overlay connection point on the x-axis */
  get offsetX() {
    return this._offsetX;
  }
  set offsetX(offsetX) {
    this._offsetX = offsetX;
    if (this._position) {
      this._updatePositionStrategy(this._position);
    }
  }
  /** The offset in pixels for the overlay connection point on the y-axis */
  get offsetY() {
    return this._offsetY;
  }
  set offsetY(offsetY) {
    this._offsetY = offsetY;
    if (this._position) {
      this._updatePositionStrategy(this._position);
    }
  }
  /** The width of the overlay panel. */
  width;
  /** The height of the overlay panel. */
  height;
  /** The min width of the overlay panel. */
  minWidth;
  /** The min height of the overlay panel. */
  minHeight;
  /** The custom class to be set on the backdrop element. */
  backdropClass;
  /** The custom class to add to the overlay pane element. */
  panelClass;
  /** Margin between the overlay and the viewport edges. */
  viewportMargin = 0;
  /** Strategy to be used when handling scroll events while the overlay is open. */
  scrollStrategy;
  /** Whether the overlay is open. */
  open = false;
  /** Whether the overlay can be closed by user interaction. */
  disableClose = false;
  /** CSS selector which to set the transform origin. */
  transformOriginSelector;
  /** Whether or not the overlay should attach a backdrop. */
  hasBackdrop = false;
  /** Whether or not the overlay should be locked when scrolling. */
  lockPosition = false;
  /** Whether the overlay's width and height can be constrained to fit within the viewport. */
  flexibleDimensions = false;
  /** Whether the overlay can grow after the initial open when flexible positioning is turned on. */
  growAfterOpen = false;
  /** Whether the overlay can be pushed on-screen if none of the provided positions fit. */
  push = false;
  /** Whether the overlay should be disposed of when the user goes backwards/forwards in history. */
  get disposeOnNavigation() {
    return this._disposeOnNavigation;
  }
  set disposeOnNavigation(value) {
    this._disposeOnNavigation = value;
  }
  /** Event emitted when the backdrop is clicked. */
  backdropClick = new EventEmitter();
  /** Event emitted when the position has changed. */
  positionChange = new EventEmitter();
  /** Event emitted when the overlay has been attached. */
  attach = new EventEmitter();
  /** Event emitted when the overlay has been detached. */
  detach = new EventEmitter();
  /** Emits when there are keyboard events that are targeted at the overlay. */
  overlayKeydown = new EventEmitter();
  /** Emits when there are mouse outside click events that are targeted at the overlay. */
  overlayOutsideClick = new EventEmitter();
  // TODO(jelbourn): inputs for size, scroll behavior, animation, etc.
  constructor() {
    const templateRef = inject2(TemplateRef);
    const viewContainerRef = inject2(ViewContainerRef);
    this._templatePortal = new TemplatePortal(templateRef, viewContainerRef);
    this.scrollStrategy = this._scrollStrategyFactory();
  }
  /** The associated overlay reference. */
  get overlayRef() {
    return this._overlayRef;
  }
  /** The element's layout direction. */
  get dir() {
    return this._dir ? this._dir.value : "ltr";
  }
  ngOnDestroy() {
    this._attachSubscription.unsubscribe();
    this._detachSubscription.unsubscribe();
    this._backdropSubscription.unsubscribe();
    this._positionSubscription.unsubscribe();
    this._overlayRef?.dispose();
  }
  ngOnChanges(changes) {
    if (this._position) {
      this._updatePositionStrategy(this._position);
      this._overlayRef?.updateSize({
        width: this.width,
        minWidth: this.minWidth,
        height: this.height,
        minHeight: this.minHeight
      });
      if (changes["origin"] && this.open) {
        this._position.apply();
      }
    }
    if (changes["open"]) {
      this.open ? this.attachOverlay() : this.detachOverlay();
    }
  }
  /** Creates an overlay */
  _createOverlay() {
    if (!this.positions || !this.positions.length) {
      this.positions = defaultPositionList;
    }
    const overlayRef = this._overlayRef = createOverlayRef(this._injector, this._buildConfig());
    this._attachSubscription = overlayRef.attachments().subscribe(() => this.attach.emit());
    this._detachSubscription = overlayRef.detachments().subscribe(() => this.detach.emit());
    overlayRef.keydownEvents().subscribe((event) => {
      this.overlayKeydown.next(event);
      if (event.keyCode === ESCAPE && !this.disableClose && !hasModifierKey(event)) {
        event.preventDefault();
        this.detachOverlay();
      }
    });
    this._overlayRef.outsidePointerEvents().subscribe((event) => {
      const origin = this._getOriginElement();
      const target = _getEventTarget(event);
      if (!origin || origin !== target && !origin.contains(target)) {
        this.overlayOutsideClick.next(event);
      }
    });
  }
  /** Builds the overlay config based on the directive's inputs */
  _buildConfig() {
    const positionStrategy = this._position = this.positionStrategy || this._createPositionStrategy();
    const overlayConfig = new OverlayConfig({
      direction: this._dir || "ltr",
      positionStrategy,
      scrollStrategy: this.scrollStrategy,
      hasBackdrop: this.hasBackdrop,
      disposeOnNavigation: this.disposeOnNavigation
    });
    if (this.width || this.width === 0) {
      overlayConfig.width = this.width;
    }
    if (this.height || this.height === 0) {
      overlayConfig.height = this.height;
    }
    if (this.minWidth || this.minWidth === 0) {
      overlayConfig.minWidth = this.minWidth;
    }
    if (this.minHeight || this.minHeight === 0) {
      overlayConfig.minHeight = this.minHeight;
    }
    if (this.backdropClass) {
      overlayConfig.backdropClass = this.backdropClass;
    }
    if (this.panelClass) {
      overlayConfig.panelClass = this.panelClass;
    }
    return overlayConfig;
  }
  /** Updates the state of a position strategy, based on the values of the directive inputs. */
  _updatePositionStrategy(positionStrategy) {
    const positions = this.positions.map((currentPosition) => ({
      originX: currentPosition.originX,
      originY: currentPosition.originY,
      overlayX: currentPosition.overlayX,
      overlayY: currentPosition.overlayY,
      offsetX: currentPosition.offsetX || this.offsetX,
      offsetY: currentPosition.offsetY || this.offsetY,
      panelClass: currentPosition.panelClass || void 0
    }));
    return positionStrategy.setOrigin(this._getOrigin()).withPositions(positions).withFlexibleDimensions(this.flexibleDimensions).withPush(this.push).withGrowAfterOpen(this.growAfterOpen).withViewportMargin(this.viewportMargin).withLockedPosition(this.lockPosition).withTransformOriginOn(this.transformOriginSelector);
  }
  /** Returns the position strategy of the overlay to be set on the overlay config */
  _createPositionStrategy() {
    const strategy = createFlexibleConnectedPositionStrategy(this._injector, this._getOrigin());
    this._updatePositionStrategy(strategy);
    return strategy;
  }
  _getOrigin() {
    if (this.origin instanceof CdkOverlayOrigin) {
      return this.origin.elementRef;
    } else {
      return this.origin;
    }
  }
  _getOriginElement() {
    if (this.origin instanceof CdkOverlayOrigin) {
      return this.origin.elementRef.nativeElement;
    }
    if (this.origin instanceof ElementRef) {
      return this.origin.nativeElement;
    }
    if (typeof Element !== "undefined" && this.origin instanceof Element) {
      return this.origin;
    }
    return null;
  }
  /** Attaches the overlay. */
  attachOverlay() {
    if (!this._overlayRef) {
      this._createOverlay();
    } else {
      this._overlayRef.getConfig().hasBackdrop = this.hasBackdrop;
    }
    if (!this._overlayRef.hasAttached()) {
      this._overlayRef.attach(this._templatePortal);
    }
    if (this.hasBackdrop) {
      this._backdropSubscription = this._overlayRef.backdropClick().subscribe((event) => {
        this.backdropClick.emit(event);
      });
    } else {
      this._backdropSubscription.unsubscribe();
    }
    this._positionSubscription.unsubscribe();
    if (this.positionChange.observers.length > 0) {
      this._positionSubscription = this._position.positionChanges.pipe(takeWhile(() => this.positionChange.observers.length > 0)).subscribe((position) => {
        this._ngZone.run(() => this.positionChange.emit(position));
        if (this.positionChange.observers.length === 0) {
          this._positionSubscription.unsubscribe();
        }
      });
    }
    this.open = true;
  }
  /** Detaches the overlay. */
  detachOverlay() {
    this._overlayRef?.detach();
    this._backdropSubscription.unsubscribe();
    this._positionSubscription.unsubscribe();
    this.open = false;
  }
  static \u0275fac = function CdkConnectedOverlay_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _CdkConnectedOverlay)();
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _CdkConnectedOverlay,
    selectors: [["", "cdk-connected-overlay", ""], ["", "connected-overlay", ""], ["", "cdkConnectedOverlay", ""]],
    inputs: {
      origin: [0, "cdkConnectedOverlayOrigin", "origin"],
      positions: [0, "cdkConnectedOverlayPositions", "positions"],
      positionStrategy: [0, "cdkConnectedOverlayPositionStrategy", "positionStrategy"],
      offsetX: [0, "cdkConnectedOverlayOffsetX", "offsetX"],
      offsetY: [0, "cdkConnectedOverlayOffsetY", "offsetY"],
      width: [0, "cdkConnectedOverlayWidth", "width"],
      height: [0, "cdkConnectedOverlayHeight", "height"],
      minWidth: [0, "cdkConnectedOverlayMinWidth", "minWidth"],
      minHeight: [0, "cdkConnectedOverlayMinHeight", "minHeight"],
      backdropClass: [0, "cdkConnectedOverlayBackdropClass", "backdropClass"],
      panelClass: [0, "cdkConnectedOverlayPanelClass", "panelClass"],
      viewportMargin: [0, "cdkConnectedOverlayViewportMargin", "viewportMargin"],
      scrollStrategy: [0, "cdkConnectedOverlayScrollStrategy", "scrollStrategy"],
      open: [0, "cdkConnectedOverlayOpen", "open"],
      disableClose: [0, "cdkConnectedOverlayDisableClose", "disableClose"],
      transformOriginSelector: [0, "cdkConnectedOverlayTransformOriginOn", "transformOriginSelector"],
      hasBackdrop: [2, "cdkConnectedOverlayHasBackdrop", "hasBackdrop", booleanAttribute],
      lockPosition: [2, "cdkConnectedOverlayLockPosition", "lockPosition", booleanAttribute],
      flexibleDimensions: [2, "cdkConnectedOverlayFlexibleDimensions", "flexibleDimensions", booleanAttribute],
      growAfterOpen: [2, "cdkConnectedOverlayGrowAfterOpen", "growAfterOpen", booleanAttribute],
      push: [2, "cdkConnectedOverlayPush", "push", booleanAttribute],
      disposeOnNavigation: [2, "cdkConnectedOverlayDisposeOnNavigation", "disposeOnNavigation", booleanAttribute]
    },
    outputs: {
      backdropClick: "backdropClick",
      positionChange: "positionChange",
      attach: "attach",
      detach: "detach",
      overlayKeydown: "overlayKeydown",
      overlayOutsideClick: "overlayOutsideClick"
    },
    exportAs: ["cdkConnectedOverlay"],
    features: [\u0275\u0275NgOnChangesFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CdkConnectedOverlay, [{
    type: Directive,
    args: [{
      selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]",
      exportAs: "cdkConnectedOverlay"
    }]
  }], () => [], {
    origin: [{
      type: Input,
      args: ["cdkConnectedOverlayOrigin"]
    }],
    positions: [{
      type: Input,
      args: ["cdkConnectedOverlayPositions"]
    }],
    positionStrategy: [{
      type: Input,
      args: ["cdkConnectedOverlayPositionStrategy"]
    }],
    offsetX: [{
      type: Input,
      args: ["cdkConnectedOverlayOffsetX"]
    }],
    offsetY: [{
      type: Input,
      args: ["cdkConnectedOverlayOffsetY"]
    }],
    width: [{
      type: Input,
      args: ["cdkConnectedOverlayWidth"]
    }],
    height: [{
      type: Input,
      args: ["cdkConnectedOverlayHeight"]
    }],
    minWidth: [{
      type: Input,
      args: ["cdkConnectedOverlayMinWidth"]
    }],
    minHeight: [{
      type: Input,
      args: ["cdkConnectedOverlayMinHeight"]
    }],
    backdropClass: [{
      type: Input,
      args: ["cdkConnectedOverlayBackdropClass"]
    }],
    panelClass: [{
      type: Input,
      args: ["cdkConnectedOverlayPanelClass"]
    }],
    viewportMargin: [{
      type: Input,
      args: ["cdkConnectedOverlayViewportMargin"]
    }],
    scrollStrategy: [{
      type: Input,
      args: ["cdkConnectedOverlayScrollStrategy"]
    }],
    open: [{
      type: Input,
      args: ["cdkConnectedOverlayOpen"]
    }],
    disableClose: [{
      type: Input,
      args: ["cdkConnectedOverlayDisableClose"]
    }],
    transformOriginSelector: [{
      type: Input,
      args: ["cdkConnectedOverlayTransformOriginOn"]
    }],
    hasBackdrop: [{
      type: Input,
      args: [{
        alias: "cdkConnectedOverlayHasBackdrop",
        transform: booleanAttribute
      }]
    }],
    lockPosition: [{
      type: Input,
      args: [{
        alias: "cdkConnectedOverlayLockPosition",
        transform: booleanAttribute
      }]
    }],
    flexibleDimensions: [{
      type: Input,
      args: [{
        alias: "cdkConnectedOverlayFlexibleDimensions",
        transform: booleanAttribute
      }]
    }],
    growAfterOpen: [{
      type: Input,
      args: [{
        alias: "cdkConnectedOverlayGrowAfterOpen",
        transform: booleanAttribute
      }]
    }],
    push: [{
      type: Input,
      args: [{
        alias: "cdkConnectedOverlayPush",
        transform: booleanAttribute
      }]
    }],
    disposeOnNavigation: [{
      type: Input,
      args: [{
        alias: "cdkConnectedOverlayDisposeOnNavigation",
        transform: booleanAttribute
      }]
    }],
    backdropClick: [{
      type: Output
    }],
    positionChange: [{
      type: Output
    }],
    attach: [{
      type: Output
    }],
    detach: [{
      type: Output
    }],
    overlayKeydown: [{
      type: Output
    }],
    overlayOutsideClick: [{
      type: Output
    }]
  });
})();
function CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay) {
  const injector = inject2(Injector);
  return () => createRepositionScrollStrategy(injector);
}
var CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY_PROVIDER = {
  provide: CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY,
  useFactory: CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY_PROVIDER_FACTORY
};
var OverlayModule = class _OverlayModule {
  static \u0275fac = function OverlayModule_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _OverlayModule)();
  };
  static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
    type: _OverlayModule,
    imports: [BidiModule, PortalModule, ScrollingModule, CdkConnectedOverlay, CdkOverlayOrigin],
    exports: [CdkConnectedOverlay, CdkOverlayOrigin, ScrollingModule]
  });
  static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({
    providers: [Overlay, CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY_PROVIDER],
    imports: [BidiModule, PortalModule, ScrollingModule, ScrollingModule]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(OverlayModule, [{
    type: NgModule,
    args: [{
      imports: [BidiModule, PortalModule, ScrollingModule, CdkConnectedOverlay, CdkOverlayOrigin],
      exports: [CdkConnectedOverlay, CdkOverlayOrigin, ScrollingModule],
      providers: [Overlay, CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY_PROVIDER]
    }]
  }], null, null);
})();

// node_modules/@angular/cdk/fesm2022/dialog.mjs
function CdkDialogContainer_ng_template_0_Template(rf, ctx) {
}
var DialogConfig = class {
  /**
   * Where the attached component should live in Angular's *logical* component tree.
   * This affects what is available for injection and the change detection order for the
   * component instantiated inside of the dialog. This does not affect where the dialog
   * content will be rendered.
   */
  viewContainerRef;
  /**
   * Injector used for the instantiation of the component to be attached. If provided,
   * takes precedence over the injector indirectly provided by `ViewContainerRef`.
   */
  injector;
  /** ID for the dialog. If omitted, a unique one will be generated. */
  id;
  /** The ARIA role of the dialog element. */
  role = "dialog";
  /** Optional CSS class or classes applied to the overlay panel. */
  panelClass = "";
  /** Whether the dialog has a backdrop. */
  hasBackdrop = true;
  /** Optional CSS class or classes applied to the overlay backdrop. */
  backdropClass = "";
  /** Whether the dialog closes with the escape key or pointer events outside the panel element. */
  disableClose = false;
  /** Function used to determine whether the dialog is allowed to close. */
  closePredicate;
  /** Width of the dialog. */
  width = "";
  /** Height of the dialog. */
  height = "";
  /** Min-width of the dialog. If a number is provided, assumes pixel units. */
  minWidth;
  /** Min-height of the dialog. If a number is provided, assumes pixel units. */
  minHeight;
  /** Max-width of the dialog. If a number is provided, assumes pixel units. */
  maxWidth;
  /** Max-height of the dialog. If a number is provided, assumes pixel units. */
  maxHeight;
  /** Strategy to use when positioning the dialog. Defaults to centering it on the page. */
  positionStrategy;
  /** Data being injected into the child component. */
  data = null;
  /** Layout direction for the dialog's content. */
  direction;
  /** ID of the element that describes the dialog. */
  ariaDescribedBy = null;
  /** ID of the element that labels the dialog. */
  ariaLabelledBy = null;
  /** Dialog label applied via `aria-label` */
  ariaLabel = null;
  /**
   * Whether this is a modal dialog. Used to set the `aria-modal` attribute. Off by default,
   * because it can interfere with other overlay-based components (e.g. `mat-select`) and because
   * it is redundant since the dialog marks all outside content as `aria-hidden` anyway.
   */
  ariaModal = false;
  /**
   * Where the dialog should focus on open.
   * @breaking-change 14.0.0 Remove boolean option from autoFocus. Use string or
   * AutoFocusTarget instead.
   */
  autoFocus = "first-tabbable";
  /**
   * Whether the dialog should restore focus to the previously-focused element upon closing.
   * Has the following behavior based on the type that is passed in:
   * - `boolean` - when true, will return focus to the element that was focused before the dialog
   *    was opened, otherwise won't restore focus at all.
   * - `string` - focus will be restored to the first element that matches the CSS selector.
   * - `HTMLElement` - focus will be restored to the specific element.
   */
  restoreFocus = true;
  /**
   * Scroll strategy to be used for the dialog. This determines how
   * the dialog responds to scrolling underneath the panel element.
   */
  scrollStrategy;
  /**
   * Whether the dialog should close when the user navigates backwards or forwards through browser
   * history. This does not apply to navigation via anchor element unless using URL-hash based
   * routing (`HashLocationStrategy` in the Angular router).
   */
  closeOnNavigation = true;
  /**
   * Whether the dialog should close when the dialog service is destroyed. This is useful if
   * another service is wrapping the dialog and is managing the destruction instead.
   */
  closeOnDestroy = true;
  /**
   * Whether the dialog should close when the underlying overlay is detached. This is useful if
   * another service is wrapping the dialog and is managing the destruction instead. E.g. an
   * external detachment can happen as a result of a scroll strategy triggering it or when the
   * browser location changes.
   */
  closeOnOverlayDetachments = true;
  /**
   * Whether the built-in overlay animations should be disabled.
   */
  disableAnimations = false;
  /**
   * Providers that will be exposed to the contents of the dialog. Can also
   * be provided as a function in order to generate the providers lazily.
   */
  providers;
  /**
   * Component into which the dialog content will be rendered. Defaults to `CdkDialogContainer`.
   * A configuration object can be passed in to customize the providers that will be exposed
   * to the dialog container.
   */
  container;
  /**
   * Context that will be passed to template-based dialogs.
   * A function can be passed in to resolve the context lazily.
   */
  templateContext;
};
function throwDialogContentAlreadyAttachedError() {
  throw Error("Attempting to attach dialog content after content is already attached");
}
var CdkDialogContainer = class _CdkDialogContainer extends BasePortalOutlet {
  _elementRef = inject2(ElementRef);
  _focusTrapFactory = inject2(FocusTrapFactory);
  _config;
  _interactivityChecker = inject2(InteractivityChecker);
  _ngZone = inject2(NgZone);
  _focusMonitor = inject2(FocusMonitor);
  _renderer = inject2(Renderer2);
  _changeDetectorRef = inject2(ChangeDetectorRef);
  _injector = inject2(Injector);
  _platform = inject2(Platform);
  _document = inject2(DOCUMENT);
  /** The portal outlet inside of this container into which the dialog content will be loaded. */
  _portalOutlet;
  _focusTrapped = new Subject();
  /** The class that traps and manages focus within the dialog. */
  _focusTrap = null;
  /** Element that was focused before the dialog was opened. Save this to restore upon close. */
  _elementFocusedBeforeDialogWasOpened = null;
  /**
   * Type of interaction that led to the dialog being closed. This is used to determine
   * whether the focus style will be applied when returning focus to its original location
   * after the dialog is closed.
   */
  _closeInteractionType = null;
  /**
   * Queue of the IDs of the dialog's label element, based on their definition order. The first
   * ID will be used as the `aria-labelledby` value. We use a queue here to handle the case
   * where there are two or more titles in the DOM at a time and the first one is destroyed while
   * the rest are present.
   */
  _ariaLabelledByQueue = [];
  _isDestroyed = false;
  constructor() {
    super();
    this._config = inject2(DialogConfig, {
      optional: true
    }) || new DialogConfig();
    if (this._config.ariaLabelledBy) {
      this._ariaLabelledByQueue.push(this._config.ariaLabelledBy);
    }
  }
  _addAriaLabelledBy(id) {
    this._ariaLabelledByQueue.push(id);
    this._changeDetectorRef.markForCheck();
  }
  _removeAriaLabelledBy(id) {
    const index = this._ariaLabelledByQueue.indexOf(id);
    if (index > -1) {
      this._ariaLabelledByQueue.splice(index, 1);
      this._changeDetectorRef.markForCheck();
    }
  }
  _contentAttached() {
    this._initializeFocusTrap();
    this._captureInitialFocus();
  }
  /**
   * Can be used by child classes to customize the initial focus
   * capturing behavior (e.g. if it's tied to an animation).
   */
  _captureInitialFocus() {
    this._trapFocus();
  }
  ngOnDestroy() {
    this._focusTrapped.complete();
    this._isDestroyed = true;
    this._restoreFocus();
  }
  /**
   * Attach a ComponentPortal as content to this dialog container.
   * @param portal Portal to be attached as the dialog content.
   */
  attachComponentPortal(portal) {
    if (this._portalOutlet.hasAttached() && (typeof ngDevMode === "undefined" || ngDevMode)) {
      throwDialogContentAlreadyAttachedError();
    }
    const result = this._portalOutlet.attachComponentPortal(portal);
    this._contentAttached();
    return result;
  }
  /**
   * Attach a TemplatePortal as content to this dialog container.
   * @param portal Portal to be attached as the dialog content.
   */
  attachTemplatePortal(portal) {
    if (this._portalOutlet.hasAttached() && (typeof ngDevMode === "undefined" || ngDevMode)) {
      throwDialogContentAlreadyAttachedError();
    }
    const result = this._portalOutlet.attachTemplatePortal(portal);
    this._contentAttached();
    return result;
  }
  /**
   * Attaches a DOM portal to the dialog container.
   * @param portal Portal to be attached.
   * @deprecated To be turned into a method.
   * @breaking-change 10.0.0
   */
  attachDomPortal = (portal) => {
    if (this._portalOutlet.hasAttached() && (typeof ngDevMode === "undefined" || ngDevMode)) {
      throwDialogContentAlreadyAttachedError();
    }
    const result = this._portalOutlet.attachDomPortal(portal);
    this._contentAttached();
    return result;
  };
  // TODO(crisbeto): this shouldn't be exposed, but there are internal references to it.
  /** Captures focus if it isn't already inside the dialog. */
  _recaptureFocus() {
    if (!this._containsFocus()) {
      this._trapFocus();
    }
  }
  /**
   * Focuses the provided element. If the element is not focusable, it will add a tabIndex
   * attribute to forcefully focus it. The attribute is removed after focus is moved.
   * @param element The element to focus.
   */
  _forceFocus(element, options) {
    if (!this._interactivityChecker.isFocusable(element)) {
      element.tabIndex = -1;
      this._ngZone.runOutsideAngular(() => {
        const callback = () => {
          deregisterBlur();
          deregisterMousedown();
          element.removeAttribute("tabindex");
        };
        const deregisterBlur = this._renderer.listen(element, "blur", callback);
        const deregisterMousedown = this._renderer.listen(element, "mousedown", callback);
      });
    }
    element.focus(options);
  }
  /**
   * Focuses the first element that matches the given selector within the focus trap.
   * @param selector The CSS selector for the element to set focus to.
   */
  _focusByCssSelector(selector, options) {
    let elementToFocus = this._elementRef.nativeElement.querySelector(selector);
    if (elementToFocus) {
      this._forceFocus(elementToFocus, options);
    }
  }
  /**
   * Moves the focus inside the focus trap. When autoFocus is not set to 'dialog', if focus
   * cannot be moved then focus will go to the dialog container.
   */
  _trapFocus(options) {
    if (this._isDestroyed) {
      return;
    }
    afterNextRender(() => {
      const element = this._elementRef.nativeElement;
      switch (this._config.autoFocus) {
        case false:
        case "dialog":
          if (!this._containsFocus()) {
            element.focus(options);
          }
          break;
        case true:
        case "first-tabbable":
          const focusedSuccessfully = this._focusTrap?.focusInitialElement(options);
          if (!focusedSuccessfully) {
            this._focusDialogContainer(options);
          }
          break;
        case "first-heading":
          this._focusByCssSelector('h1, h2, h3, h4, h5, h6, [role="heading"]', options);
          break;
        default:
          this._focusByCssSelector(this._config.autoFocus, options);
          break;
      }
      this._focusTrapped.next();
    }, {
      injector: this._injector
    });
  }
  /** Restores focus to the element that was focused before the dialog opened. */
  _restoreFocus() {
    const focusConfig = this._config.restoreFocus;
    let focusTargetElement = null;
    if (typeof focusConfig === "string") {
      focusTargetElement = this._document.querySelector(focusConfig);
    } else if (typeof focusConfig === "boolean") {
      focusTargetElement = focusConfig ? this._elementFocusedBeforeDialogWasOpened : null;
    } else if (focusConfig) {
      focusTargetElement = focusConfig;
    }
    if (this._config.restoreFocus && focusTargetElement && typeof focusTargetElement.focus === "function") {
      const activeElement = _getFocusedElementPierceShadowDom();
      const element = this._elementRef.nativeElement;
      if (!activeElement || activeElement === this._document.body || activeElement === element || element.contains(activeElement)) {
        if (this._focusMonitor) {
          this._focusMonitor.focusVia(focusTargetElement, this._closeInteractionType);
          this._closeInteractionType = null;
        } else {
          focusTargetElement.focus();
        }
      }
    }
    if (this._focusTrap) {
      this._focusTrap.destroy();
    }
  }
  /** Focuses the dialog container. */
  _focusDialogContainer(options) {
    this._elementRef.nativeElement.focus?.(options);
  }
  /** Returns whether focus is inside the dialog. */
  _containsFocus() {
    const element = this._elementRef.nativeElement;
    const activeElement = _getFocusedElementPierceShadowDom();
    return element === activeElement || element.contains(activeElement);
  }
  /** Sets up the focus trap. */
  _initializeFocusTrap() {
    if (this._platform.isBrowser) {
      this._focusTrap = this._focusTrapFactory.create(this._elementRef.nativeElement);
      if (this._document) {
        this._elementFocusedBeforeDialogWasOpened = _getFocusedElementPierceShadowDom();
      }
    }
  }
  static \u0275fac = function CdkDialogContainer_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _CdkDialogContainer)();
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({
    type: _CdkDialogContainer,
    selectors: [["cdk-dialog-container"]],
    viewQuery: function CdkDialogContainer_Query(rf, ctx) {
      if (rf & 1) {
        \u0275\u0275viewQuery(CdkPortalOutlet, 7);
      }
      if (rf & 2) {
        let _t;
        \u0275\u0275queryRefresh(_t = \u0275\u0275loadQuery()) && (ctx._portalOutlet = _t.first);
      }
    },
    hostAttrs: ["tabindex", "-1", 1, "cdk-dialog-container"],
    hostVars: 6,
    hostBindings: function CdkDialogContainer_HostBindings(rf, ctx) {
      if (rf & 2) {
        \u0275\u0275attribute("id", ctx._config.id || null)("role", ctx._config.role)("aria-modal", ctx._config.ariaModal)("aria-labelledby", ctx._config.ariaLabel ? null : ctx._ariaLabelledByQueue[0])("aria-label", ctx._config.ariaLabel)("aria-describedby", ctx._config.ariaDescribedBy || null);
      }
    },
    features: [\u0275\u0275InheritDefinitionFeature],
    decls: 1,
    vars: 0,
    consts: [["cdkPortalOutlet", ""]],
    template: function CdkDialogContainer_Template(rf, ctx) {
      if (rf & 1) {
        \u0275\u0275template(0, CdkDialogContainer_ng_template_0_Template, 0, 0, "ng-template", 0);
      }
    },
    dependencies: [CdkPortalOutlet],
    styles: [".cdk-dialog-container{display:block;width:100%;height:100%;min-height:inherit;max-height:inherit}\n"],
    encapsulation: 2
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CdkDialogContainer, [{
    type: Component,
    args: [{
      selector: "cdk-dialog-container",
      encapsulation: ViewEncapsulation.None,
      changeDetection: ChangeDetectionStrategy.Default,
      imports: [CdkPortalOutlet],
      host: {
        "class": "cdk-dialog-container",
        "tabindex": "-1",
        "[attr.id]": "_config.id || null",
        "[attr.role]": "_config.role",
        "[attr.aria-modal]": "_config.ariaModal",
        "[attr.aria-labelledby]": "_config.ariaLabel ? null : _ariaLabelledByQueue[0]",
        "[attr.aria-label]": "_config.ariaLabel",
        "[attr.aria-describedby]": "_config.ariaDescribedBy || null"
      },
      template: "<ng-template cdkPortalOutlet />\n",
      styles: [".cdk-dialog-container{display:block;width:100%;height:100%;min-height:inherit;max-height:inherit}\n"]
    }]
  }], () => [], {
    _portalOutlet: [{
      type: ViewChild,
      args: [CdkPortalOutlet, {
        static: true
      }]
    }]
  });
})();
var DialogRef = class {
  overlayRef;
  config;
  /**
   * Instance of component opened into the dialog. Will be
   * null when the dialog is opened using a `TemplateRef`.
   */
  componentInstance;
  /**
   * `ComponentRef` of the component opened into the dialog. Will be
   * null when the dialog is opened using a `TemplateRef`.
   */
  componentRef;
  /** Instance of the container that is rendering out the dialog content. */
  containerInstance;
  /** Whether the user is allowed to close the dialog. */
  disableClose;
  /** Emits when the dialog has been closed. */
  closed = new Subject();
  /** Emits when the backdrop of the dialog is clicked. */
  backdropClick;
  /** Emits when on keyboard events within the dialog. */
  keydownEvents;
  /** Emits on pointer events that happen outside of the dialog. */
  outsidePointerEvents;
  /** Unique ID for the dialog. */
  id;
  /** Subscription to external detachments of the dialog. */
  _detachSubscription;
  constructor(overlayRef, config2) {
    this.overlayRef = overlayRef;
    this.config = config2;
    this.disableClose = config2.disableClose;
    this.backdropClick = overlayRef.backdropClick();
    this.keydownEvents = overlayRef.keydownEvents();
    this.outsidePointerEvents = overlayRef.outsidePointerEvents();
    this.id = config2.id;
    this.keydownEvents.subscribe((event) => {
      if (event.keyCode === ESCAPE && !this.disableClose && !hasModifierKey(event)) {
        event.preventDefault();
        this.close(void 0, {
          focusOrigin: "keyboard"
        });
      }
    });
    this.backdropClick.subscribe(() => {
      if (!this.disableClose && this._canClose()) {
        this.close(void 0, {
          focusOrigin: "mouse"
        });
      } else {
        this.containerInstance._recaptureFocus?.();
      }
    });
    this._detachSubscription = overlayRef.detachments().subscribe(() => {
      if (config2.closeOnOverlayDetachments !== false) {
        this.close();
      }
    });
  }
  /**
   * Close the dialog.
   * @param result Optional result to return to the dialog opener.
   * @param options Additional options to customize the closing behavior.
   */
  close(result, options) {
    if (this._canClose(result)) {
      const closedSubject = this.closed;
      this.containerInstance._closeInteractionType = options?.focusOrigin || "program";
      this._detachSubscription.unsubscribe();
      this.overlayRef.dispose();
      closedSubject.next(result);
      closedSubject.complete();
      this.componentInstance = this.containerInstance = null;
    }
  }
  /** Updates the position of the dialog based on the current position strategy. */
  updatePosition() {
    this.overlayRef.updatePosition();
    return this;
  }
  /**
   * Updates the dialog's width and height.
   * @param width New width of the dialog.
   * @param height New height of the dialog.
   */
  updateSize(width = "", height = "") {
    this.overlayRef.updateSize({
      width,
      height
    });
    return this;
  }
  /** Add a CSS class or an array of classes to the overlay pane. */
  addPanelClass(classes) {
    this.overlayRef.addPanelClass(classes);
    return this;
  }
  /** Remove a CSS class or an array of classes from the overlay pane. */
  removePanelClass(classes) {
    this.overlayRef.removePanelClass(classes);
    return this;
  }
  /** Whether the dialog is allowed to close. */
  _canClose(result) {
    const config2 = this.config;
    return !!this.containerInstance && (!config2.closePredicate || config2.closePredicate(result, config2, this.componentInstance));
  }
};
var DIALOG_SCROLL_STRATEGY = new InjectionToken("DialogScrollStrategy", {
  providedIn: "root",
  factory: () => {
    const injector = inject2(Injector);
    return () => createBlockScrollStrategy(injector);
  }
});
var DIALOG_DATA = new InjectionToken("DialogData");
var DEFAULT_DIALOG_CONFIG = new InjectionToken("DefaultDialogConfig");
function getDirectionality(value) {
  const valueSignal = signal(value);
  const change = new EventEmitter();
  return {
    valueSignal,
    get value() {
      return valueSignal();
    },
    change,
    ngOnDestroy() {
      change.complete();
    }
  };
}
var Dialog = class _Dialog {
  _injector = inject2(Injector);
  _defaultOptions = inject2(DEFAULT_DIALOG_CONFIG, {
    optional: true
  });
  _parentDialog = inject2(_Dialog, {
    optional: true,
    skipSelf: true
  });
  _overlayContainer = inject2(OverlayContainer);
  _idGenerator = inject2(_IdGenerator);
  _openDialogsAtThisLevel = [];
  _afterAllClosedAtThisLevel = new Subject();
  _afterOpenedAtThisLevel = new Subject();
  _ariaHiddenElements = /* @__PURE__ */ new Map();
  _scrollStrategy = inject2(DIALOG_SCROLL_STRATEGY);
  /** Keeps track of the currently-open dialogs. */
  get openDialogs() {
    return this._parentDialog ? this._parentDialog.openDialogs : this._openDialogsAtThisLevel;
  }
  /** Stream that emits when a dialog has been opened. */
  get afterOpened() {
    return this._parentDialog ? this._parentDialog.afterOpened : this._afterOpenedAtThisLevel;
  }
  /**
   * Stream that emits when all open dialog have finished closing.
   * Will emit on subscribe if there are no open dialogs to begin with.
   */
  afterAllClosed = defer(() => this.openDialogs.length ? this._getAfterAllClosed() : this._getAfterAllClosed().pipe(startWith(void 0)));
  constructor() {
  }
  open(componentOrTemplateRef, config2) {
    const defaults2 = this._defaultOptions || new DialogConfig();
    config2 = __spreadValues(__spreadValues({}, defaults2), config2);
    config2.id = config2.id || this._idGenerator.getId("cdk-dialog-");
    if (config2.id && this.getDialogById(config2.id) && (typeof ngDevMode === "undefined" || ngDevMode)) {
      throw Error(`Dialog with id "${config2.id}" exists already. The dialog id must be unique.`);
    }
    const overlayConfig = this._getOverlayConfig(config2);
    const overlayRef = createOverlayRef(this._injector, overlayConfig);
    const dialogRef = new DialogRef(overlayRef, config2);
    const dialogContainer = this._attachContainer(overlayRef, dialogRef, config2);
    dialogRef.containerInstance = dialogContainer;
    if (!this.openDialogs.length) {
      const overlayContainer = this._overlayContainer.getContainerElement();
      if (dialogContainer._focusTrapped) {
        dialogContainer._focusTrapped.pipe(take(1)).subscribe(() => {
          this._hideNonDialogContentFromAssistiveTechnology(overlayContainer);
        });
      } else {
        this._hideNonDialogContentFromAssistiveTechnology(overlayContainer);
      }
    }
    this._attachDialogContent(componentOrTemplateRef, dialogRef, dialogContainer, config2);
    this.openDialogs.push(dialogRef);
    dialogRef.closed.subscribe(() => this._removeOpenDialog(dialogRef, true));
    this.afterOpened.next(dialogRef);
    return dialogRef;
  }
  /**
   * Closes all of the currently-open dialogs.
   */
  closeAll() {
    reverseForEach(this.openDialogs, (dialog) => dialog.close());
  }
  /**
   * Finds an open dialog by its id.
   * @param id ID to use when looking up the dialog.
   */
  getDialogById(id) {
    return this.openDialogs.find((dialog) => dialog.id === id);
  }
  ngOnDestroy() {
    reverseForEach(this._openDialogsAtThisLevel, (dialog) => {
      if (dialog.config.closeOnDestroy === false) {
        this._removeOpenDialog(dialog, false);
      }
    });
    reverseForEach(this._openDialogsAtThisLevel, (dialog) => dialog.close());
    this._afterAllClosedAtThisLevel.complete();
    this._afterOpenedAtThisLevel.complete();
    this._openDialogsAtThisLevel = [];
  }
  /**
   * Creates an overlay config from a dialog config.
   * @param config The dialog configuration.
   * @returns The overlay configuration.
   */
  _getOverlayConfig(config2) {
    const state = new OverlayConfig({
      positionStrategy: config2.positionStrategy || createGlobalPositionStrategy().centerHorizontally().centerVertically(),
      scrollStrategy: config2.scrollStrategy || this._scrollStrategy(),
      panelClass: config2.panelClass,
      hasBackdrop: config2.hasBackdrop,
      direction: config2.direction,
      minWidth: config2.minWidth,
      minHeight: config2.minHeight,
      maxWidth: config2.maxWidth,
      maxHeight: config2.maxHeight,
      width: config2.width,
      height: config2.height,
      disposeOnNavigation: config2.closeOnNavigation,
      disableAnimations: config2.disableAnimations
    });
    if (config2.backdropClass) {
      state.backdropClass = config2.backdropClass;
    }
    return state;
  }
  /**
   * Attaches a dialog container to a dialog's already-created overlay.
   * @param overlay Reference to the dialog's underlying overlay.
   * @param config The dialog configuration.
   * @returns A promise resolving to a ComponentRef for the attached container.
   */
  _attachContainer(overlay, dialogRef, config2) {
    const userInjector = config2.injector || config2.viewContainerRef?.injector;
    const providers = [{
      provide: DialogConfig,
      useValue: config2
    }, {
      provide: DialogRef,
      useValue: dialogRef
    }, {
      provide: OverlayRef,
      useValue: overlay
    }];
    let containerType;
    if (config2.container) {
      if (typeof config2.container === "function") {
        containerType = config2.container;
      } else {
        containerType = config2.container.type;
        providers.push(...config2.container.providers(config2));
      }
    } else {
      containerType = CdkDialogContainer;
    }
    const containerPortal = new ComponentPortal(containerType, config2.viewContainerRef, Injector.create({
      parent: userInjector || this._injector,
      providers
    }));
    const containerRef = overlay.attach(containerPortal);
    return containerRef.instance;
  }
  /**
   * Attaches the user-provided component to the already-created dialog container.
   * @param componentOrTemplateRef The type of component being loaded into the dialog,
   *     or a TemplateRef to instantiate as the content.
   * @param dialogRef Reference to the dialog being opened.
   * @param dialogContainer Component that is going to wrap the dialog content.
   * @param config Configuration used to open the dialog.
   */
  _attachDialogContent(componentOrTemplateRef, dialogRef, dialogContainer, config2) {
    if (componentOrTemplateRef instanceof TemplateRef) {
      const injector = this._createInjector(config2, dialogRef, dialogContainer, void 0);
      let context2 = {
        $implicit: config2.data,
        dialogRef
      };
      if (config2.templateContext) {
        context2 = __spreadValues(__spreadValues({}, context2), typeof config2.templateContext === "function" ? config2.templateContext() : config2.templateContext);
      }
      dialogContainer.attachTemplatePortal(new TemplatePortal(componentOrTemplateRef, null, context2, injector));
    } else {
      const injector = this._createInjector(config2, dialogRef, dialogContainer, this._injector);
      const contentRef = dialogContainer.attachComponentPortal(new ComponentPortal(componentOrTemplateRef, config2.viewContainerRef, injector));
      dialogRef.componentRef = contentRef;
      dialogRef.componentInstance = contentRef.instance;
    }
  }
  /**
   * Creates a custom injector to be used inside the dialog. This allows a component loaded inside
   * of a dialog to close itself and, optionally, to return a value.
   * @param config Config object that is used to construct the dialog.
   * @param dialogRef Reference to the dialog being opened.
   * @param dialogContainer Component that is going to wrap the dialog content.
   * @param fallbackInjector Injector to use as a fallback when a lookup fails in the custom
   * dialog injector, if the user didn't provide a custom one.
   * @returns The custom injector that can be used inside the dialog.
   */
  _createInjector(config2, dialogRef, dialogContainer, fallbackInjector) {
    const userInjector = config2.injector || config2.viewContainerRef?.injector;
    const providers = [{
      provide: DIALOG_DATA,
      useValue: config2.data
    }, {
      provide: DialogRef,
      useValue: dialogRef
    }];
    if (config2.providers) {
      if (typeof config2.providers === "function") {
        providers.push(...config2.providers(dialogRef, config2, dialogContainer));
      } else {
        providers.push(...config2.providers);
      }
    }
    if (config2.direction && (!userInjector || !userInjector.get(Directionality, null, {
      optional: true
    }))) {
      providers.push({
        provide: Directionality,
        useValue: getDirectionality(config2.direction)
      });
    }
    return Injector.create({
      parent: userInjector || fallbackInjector,
      providers
    });
  }
  /**
   * Removes a dialog from the array of open dialogs.
   * @param dialogRef Dialog to be removed.
   * @param emitEvent Whether to emit an event if this is the last dialog.
   */
  _removeOpenDialog(dialogRef, emitEvent) {
    const index = this.openDialogs.indexOf(dialogRef);
    if (index > -1) {
      this.openDialogs.splice(index, 1);
      if (!this.openDialogs.length) {
        this._ariaHiddenElements.forEach((previousValue, element) => {
          if (previousValue) {
            element.setAttribute("aria-hidden", previousValue);
          } else {
            element.removeAttribute("aria-hidden");
          }
        });
        this._ariaHiddenElements.clear();
        if (emitEvent) {
          this._getAfterAllClosed().next();
        }
      }
    }
  }
  /** Hides all of the content that isn't an overlay from assistive technology. */
  _hideNonDialogContentFromAssistiveTechnology(overlayContainer) {
    if (overlayContainer.parentElement) {
      const siblings = overlayContainer.parentElement.children;
      for (let i = siblings.length - 1; i > -1; i--) {
        const sibling = siblings[i];
        if (sibling !== overlayContainer && sibling.nodeName !== "SCRIPT" && sibling.nodeName !== "STYLE" && !sibling.hasAttribute("aria-live")) {
          this._ariaHiddenElements.set(sibling, sibling.getAttribute("aria-hidden"));
          sibling.setAttribute("aria-hidden", "true");
        }
      }
    }
  }
  _getAfterAllClosed() {
    const parent = this._parentDialog;
    return parent ? parent._getAfterAllClosed() : this._afterAllClosedAtThisLevel;
  }
  static \u0275fac = function Dialog_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _Dialog)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _Dialog,
    factory: _Dialog.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(Dialog, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], () => [], null);
})();
function reverseForEach(items, callback) {
  let i = items.length;
  while (i--) {
    callback(items[i]);
  }
}
var DialogModule = class _DialogModule {
  static \u0275fac = function DialogModule_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _DialogModule)();
  };
  static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
    type: _DialogModule,
    imports: [OverlayModule, PortalModule, A11yModule, CdkDialogContainer],
    exports: [
      // Re-export the PortalModule so that people extending the `CdkDialogContainer`
      // don't have to remember to import it or be faced with an unhelpful error.
      PortalModule,
      CdkDialogContainer
    ]
  });
  static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({
    providers: [Dialog],
    imports: [
      OverlayModule,
      PortalModule,
      A11yModule,
      // Re-export the PortalModule so that people extending the `CdkDialogContainer`
      // don't have to remember to import it or be faced with an unhelpful error.
      PortalModule
    ]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(DialogModule, [{
    type: NgModule,
    args: [{
      imports: [OverlayModule, PortalModule, A11yModule, CdkDialogContainer],
      exports: [
        // Re-export the PortalModule so that people extending the `CdkDialogContainer`
        // don't have to remember to import it or be faced with an unhelpful error.
        PortalModule,
        CdkDialogContainer
      ],
      providers: [Dialog]
    }]
  }], null, null);
})();

// node_modules/@angular/cdk/fesm2022/overlay.mjs
var FullscreenOverlayContainer = class _FullscreenOverlayContainer extends OverlayContainer {
  _renderer = inject2(RendererFactory2).createRenderer(null, null);
  _fullScreenEventName;
  _cleanupFullScreenListener;
  constructor() {
    super();
  }
  ngOnDestroy() {
    super.ngOnDestroy();
    this._cleanupFullScreenListener?.();
  }
  _createContainer() {
    const eventName = this._getEventName();
    super._createContainer();
    this._adjustParentForFullscreenChange();
    if (eventName) {
      this._cleanupFullScreenListener?.();
      this._cleanupFullScreenListener = this._renderer.listen("document", eventName, () => {
        this._adjustParentForFullscreenChange();
      });
    }
  }
  _adjustParentForFullscreenChange() {
    if (this._containerElement) {
      const fullscreenElement = this.getFullscreenElement();
      const parent = fullscreenElement || this._document.body;
      parent.appendChild(this._containerElement);
    }
  }
  _getEventName() {
    if (!this._fullScreenEventName) {
      const _document2 = this._document;
      if (_document2.fullscreenEnabled) {
        this._fullScreenEventName = "fullscreenchange";
      } else if (_document2.webkitFullscreenEnabled) {
        this._fullScreenEventName = "webkitfullscreenchange";
      } else if (_document2.mozFullScreenEnabled) {
        this._fullScreenEventName = "mozfullscreenchange";
      } else if (_document2.msFullscreenEnabled) {
        this._fullScreenEventName = "MSFullscreenChange";
      }
    }
    return this._fullScreenEventName;
  }
  /**
   * When the page is put into fullscreen mode, a specific element is specified.
   * Only that element and its children are visible when in fullscreen mode.
   */
  getFullscreenElement() {
    const _document2 = this._document;
    return _document2.fullscreenElement || _document2.webkitFullscreenElement || _document2.mozFullScreenElement || _document2.msFullscreenElement || null;
  }
  static \u0275fac = function FullscreenOverlayContainer_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _FullscreenOverlayContainer)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _FullscreenOverlayContainer,
    factory: _FullscreenOverlayContainer.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(FullscreenOverlayContainer, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], () => [], null);
})();

// node_modules/@angular/material/fesm2022/module-Cz4ZB2Wr.mjs
function MatDialogContainer_ng_template_2_Template(rf, ctx) {
}
var MatDialogConfig = class {
  /**
   * Where the attached component should live in Angular's *logical* component tree.
   * This affects what is available for injection and the change detection order for the
   * component instantiated inside of the dialog. This does not affect where the dialog
   * content will be rendered.
   */
  viewContainerRef;
  /**
   * Injector used for the instantiation of the component to be attached. If provided,
   * takes precedence over the injector indirectly provided by `ViewContainerRef`.
   */
  injector;
  /** ID for the dialog. If omitted, a unique one will be generated. */
  id;
  /** The ARIA role of the dialog element. */
  role = "dialog";
  /** Custom class for the overlay pane. */
  panelClass = "";
  /** Whether the dialog has a backdrop. */
  hasBackdrop = true;
  /** Custom class for the backdrop. */
  backdropClass = "";
  /** Whether the user can use escape or clicking on the backdrop to close the modal. */
  disableClose = false;
  /** Function used to determine whether the dialog is allowed to close. */
  closePredicate;
  /** Width of the dialog. */
  width = "";
  /** Height of the dialog. */
  height = "";
  /** Min-width of the dialog. If a number is provided, assumes pixel units. */
  minWidth;
  /** Min-height of the dialog. If a number is provided, assumes pixel units. */
  minHeight;
  /** Max-width of the dialog. If a number is provided, assumes pixel units. */
  maxWidth;
  /** Max-height of the dialog. If a number is provided, assumes pixel units. */
  maxHeight;
  /** Position overrides. */
  position;
  /** Data being injected into the child component. */
  data = null;
  /** Layout direction for the dialog's content. */
  direction;
  /** ID of the element that describes the dialog. */
  ariaDescribedBy = null;
  /** ID of the element that labels the dialog. */
  ariaLabelledBy = null;
  /** Aria label to assign to the dialog element. */
  ariaLabel = null;
  /**
   * Whether this is a modal dialog. Used to set the `aria-modal` attribute. Off by default,
   * because it can interfere with other overlay-based components (e.g. `mat-select`) and because
   * it is redundant since the dialog marks all outside content as `aria-hidden` anyway.
   */
  ariaModal = false;
  /**
   * Where the dialog should focus on open.
   * @breaking-change 14.0.0 Remove boolean option from autoFocus. Use string or
   * AutoFocusTarget instead.
   */
  autoFocus = "first-tabbable";
  /**
   * Whether the dialog should restore focus to the
   * previously-focused element, after it's closed.
   */
  restoreFocus = true;
  /** Whether to wait for the opening animation to finish before trapping focus. */
  delayFocusTrap = true;
  /** Scroll strategy to be used for the dialog. */
  scrollStrategy;
  /**
   * Whether the dialog should close when the user goes backwards/forwards in history.
   * Note that this usually doesn't include clicking on links (unless the user is using
   * the `HashLocationStrategy`).
   */
  closeOnNavigation = true;
  /**
   * Duration of the enter animation in ms.
   * Should be a number, string type is deprecated.
   * @breaking-change 17.0.0 Remove string signature.
   */
  enterAnimationDuration;
  /**
   * Duration of the exit animation in ms.
   * Should be a number, string type is deprecated.
   * @breaking-change 17.0.0 Remove string signature.
   */
  exitAnimationDuration;
};
var OPEN_CLASS = "mdc-dialog--open";
var OPENING_CLASS = "mdc-dialog--opening";
var CLOSING_CLASS = "mdc-dialog--closing";
var OPEN_ANIMATION_DURATION = 150;
var CLOSE_ANIMATION_DURATION = 75;
var MatDialogContainer = class _MatDialogContainer extends CdkDialogContainer {
  /** Emits when an animation state changes. */
  _animationStateChanged = new EventEmitter();
  /** Whether animations are enabled. */
  _animationsEnabled = !_animationsDisabled();
  /** Number of actions projected in the dialog. */
  _actionSectionCount = 0;
  /** Host element of the dialog container component. */
  _hostElement = this._elementRef.nativeElement;
  /** Duration of the dialog open animation. */
  _enterAnimationDuration = this._animationsEnabled ? parseCssTime(this._config.enterAnimationDuration) ?? OPEN_ANIMATION_DURATION : 0;
  /** Duration of the dialog close animation. */
  _exitAnimationDuration = this._animationsEnabled ? parseCssTime(this._config.exitAnimationDuration) ?? CLOSE_ANIMATION_DURATION : 0;
  /** Current timer for dialog animations. */
  _animationTimer = null;
  _contentAttached() {
    super._contentAttached();
    this._startOpenAnimation();
  }
  /** Starts the dialog open animation if enabled. */
  _startOpenAnimation() {
    this._animationStateChanged.emit({
      state: "opening",
      totalTime: this._enterAnimationDuration
    });
    if (this._animationsEnabled) {
      this._hostElement.style.setProperty(TRANSITION_DURATION_PROPERTY, `${this._enterAnimationDuration}ms`);
      this._requestAnimationFrame(() => this._hostElement.classList.add(OPENING_CLASS, OPEN_CLASS));
      this._waitForAnimationToComplete(this._enterAnimationDuration, this._finishDialogOpen);
    } else {
      this._hostElement.classList.add(OPEN_CLASS);
      Promise.resolve().then(() => this._finishDialogOpen());
    }
  }
  /**
   * Starts the exit animation of the dialog if enabled. This method is
   * called by the dialog ref.
   */
  _startExitAnimation() {
    this._animationStateChanged.emit({
      state: "closing",
      totalTime: this._exitAnimationDuration
    });
    this._hostElement.classList.remove(OPEN_CLASS);
    if (this._animationsEnabled) {
      this._hostElement.style.setProperty(TRANSITION_DURATION_PROPERTY, `${this._exitAnimationDuration}ms`);
      this._requestAnimationFrame(() => this._hostElement.classList.add(CLOSING_CLASS));
      this._waitForAnimationToComplete(this._exitAnimationDuration, this._finishDialogClose);
    } else {
      Promise.resolve().then(() => this._finishDialogClose());
    }
  }
  /**
   * Updates the number action sections.
   * @param delta Increase/decrease in the number of sections.
   */
  _updateActionSectionCount(delta) {
    this._actionSectionCount += delta;
    this._changeDetectorRef.markForCheck();
  }
  /**
   * Completes the dialog open by clearing potential animation classes, trapping
   * focus and emitting an opened event.
   */
  _finishDialogOpen = () => {
    this._clearAnimationClasses();
    this._openAnimationDone(this._enterAnimationDuration);
  };
  /**
   * Completes the dialog close by clearing potential animation classes, restoring
   * focus and emitting a closed event.
   */
  _finishDialogClose = () => {
    this._clearAnimationClasses();
    this._animationStateChanged.emit({
      state: "closed",
      totalTime: this._exitAnimationDuration
    });
  };
  /** Clears all dialog animation classes. */
  _clearAnimationClasses() {
    this._hostElement.classList.remove(OPENING_CLASS, CLOSING_CLASS);
  }
  _waitForAnimationToComplete(duration, callback) {
    if (this._animationTimer !== null) {
      clearTimeout(this._animationTimer);
    }
    this._animationTimer = setTimeout(callback, duration);
  }
  /** Runs a callback in `requestAnimationFrame`, if available. */
  _requestAnimationFrame(callback) {
    this._ngZone.runOutsideAngular(() => {
      if (typeof requestAnimationFrame === "function") {
        requestAnimationFrame(callback);
      } else {
        callback();
      }
    });
  }
  _captureInitialFocus() {
    if (!this._config.delayFocusTrap) {
      this._trapFocus();
    }
  }
  /**
   * Callback for when the open dialog animation has finished. Intended to
   * be called by sub-classes that use different animation implementations.
   */
  _openAnimationDone(totalTime) {
    if (this._config.delayFocusTrap) {
      this._trapFocus();
    }
    this._animationStateChanged.next({
      state: "opened",
      totalTime
    });
  }
  ngOnDestroy() {
    super.ngOnDestroy();
    if (this._animationTimer !== null) {
      clearTimeout(this._animationTimer);
    }
  }
  attachComponentPortal(portal) {
    const ref = super.attachComponentPortal(portal);
    ref.location.nativeElement.classList.add("mat-mdc-dialog-component-host");
    return ref;
  }
  static \u0275fac = /* @__PURE__ */ (() => {
    let \u0275MatDialogContainer_BaseFactory;
    return function MatDialogContainer_Factory(__ngFactoryType__) {
      return (\u0275MatDialogContainer_BaseFactory || (\u0275MatDialogContainer_BaseFactory = \u0275\u0275getInheritedFactory(_MatDialogContainer)))(__ngFactoryType__ || _MatDialogContainer);
    };
  })();
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({
    type: _MatDialogContainer,
    selectors: [["mat-dialog-container"]],
    hostAttrs: ["tabindex", "-1", 1, "mat-mdc-dialog-container", "mdc-dialog"],
    hostVars: 10,
    hostBindings: function MatDialogContainer_HostBindings(rf, ctx) {
      if (rf & 2) {
        \u0275\u0275domProperty("id", ctx._config.id);
        \u0275\u0275attribute("aria-modal", ctx._config.ariaModal)("role", ctx._config.role)("aria-labelledby", ctx._config.ariaLabel ? null : ctx._ariaLabelledByQueue[0])("aria-label", ctx._config.ariaLabel)("aria-describedby", ctx._config.ariaDescribedBy || null);
        \u0275\u0275classProp("_mat-animation-noopable", !ctx._animationsEnabled)("mat-mdc-dialog-container-with-actions", ctx._actionSectionCount > 0);
      }
    },
    features: [\u0275\u0275InheritDefinitionFeature],
    decls: 3,
    vars: 0,
    consts: [[1, "mat-mdc-dialog-inner-container", "mdc-dialog__container"], [1, "mat-mdc-dialog-surface", "mdc-dialog__surface"], ["cdkPortalOutlet", ""]],
    template: function MatDialogContainer_Template(rf, ctx) {
      if (rf & 1) {
        \u0275\u0275elementStart(0, "div", 0)(1, "div", 1);
        \u0275\u0275template(2, MatDialogContainer_ng_template_2_Template, 0, 0, "ng-template", 2);
        \u0275\u0275elementEnd()();
      }
    },
    dependencies: [CdkPortalOutlet],
    styles: ['.mat-mdc-dialog-container{width:100%;height:100%;display:block;box-sizing:border-box;max-height:inherit;min-height:inherit;min-width:inherit;max-width:inherit;outline:0}.cdk-overlay-pane.mat-mdc-dialog-panel{max-width:var(--mat-dialog-container-max-width, 560px);min-width:var(--mat-dialog-container-min-width, 280px)}@media(max-width: 599px){.cdk-overlay-pane.mat-mdc-dialog-panel{max-width:var(--mat-dialog-container-small-max-width, calc(100vw - 32px))}}.mat-mdc-dialog-inner-container{display:flex;flex-direction:row;align-items:center;justify-content:space-around;box-sizing:border-box;height:100%;opacity:0;transition:opacity linear var(--mat-dialog-transition-duration, 0ms);max-height:inherit;min-height:inherit;min-width:inherit;max-width:inherit}.mdc-dialog--closing .mat-mdc-dialog-inner-container{transition:opacity 75ms linear;transform:none}.mdc-dialog--open .mat-mdc-dialog-inner-container{opacity:1}._mat-animation-noopable .mat-mdc-dialog-inner-container{transition:none}.mat-mdc-dialog-surface{display:flex;flex-direction:column;flex-grow:0;flex-shrink:0;box-sizing:border-box;width:100%;height:100%;position:relative;overflow-y:auto;outline:0;transform:scale(0.8);transition:transform var(--mat-dialog-transition-duration, 0ms) cubic-bezier(0, 0, 0.2, 1);max-height:inherit;min-height:inherit;min-width:inherit;max-width:inherit;box-shadow:var(--mat-dialog-container-elevation-shadow, none);border-radius:var(--mat-dialog-container-shape, var(--mat-sys-corner-extra-large, 4px));background-color:var(--mat-dialog-container-color, var(--mat-sys-surface, white))}[dir=rtl] .mat-mdc-dialog-surface{text-align:right}.mdc-dialog--open .mat-mdc-dialog-surface,.mdc-dialog--closing .mat-mdc-dialog-surface{transform:none}._mat-animation-noopable .mat-mdc-dialog-surface{transition:none}.mat-mdc-dialog-surface::before{position:absolute;box-sizing:border-box;width:100%;height:100%;top:0;left:0;border:2px solid rgba(0,0,0,0);border-radius:inherit;content:"";pointer-events:none}.mat-mdc-dialog-title{display:block;position:relative;flex-shrink:0;box-sizing:border-box;margin:0 0 1px;padding:var(--mat-dialog-headline-padding, 6px 24px 13px)}.mat-mdc-dialog-title::before{display:inline-block;width:0;height:40px;content:"";vertical-align:0}[dir=rtl] .mat-mdc-dialog-title{text-align:right}.mat-mdc-dialog-container .mat-mdc-dialog-title{color:var(--mat-dialog-subhead-color, var(--mat-sys-on-surface, rgba(0, 0, 0, 0.87)));font-family:var(--mat-dialog-subhead-font, var(--mat-sys-headline-small-font, inherit));line-height:var(--mat-dialog-subhead-line-height, var(--mat-sys-headline-small-line-height, 1.5rem));font-size:var(--mat-dialog-subhead-size, var(--mat-sys-headline-small-size, 1rem));font-weight:var(--mat-dialog-subhead-weight, var(--mat-sys-headline-small-weight, 400));letter-spacing:var(--mat-dialog-subhead-tracking, var(--mat-sys-headline-small-tracking, 0.03125em))}.mat-mdc-dialog-content{display:block;flex-grow:1;box-sizing:border-box;margin:0;overflow:auto;max-height:65vh}.mat-mdc-dialog-content>:first-child{margin-top:0}.mat-mdc-dialog-content>:last-child{margin-bottom:0}.mat-mdc-dialog-container .mat-mdc-dialog-content{color:var(--mat-dialog-supporting-text-color, var(--mat-sys-on-surface-variant, rgba(0, 0, 0, 0.6)));font-family:var(--mat-dialog-supporting-text-font, var(--mat-sys-body-medium-font, inherit));line-height:var(--mat-dialog-supporting-text-line-height, var(--mat-sys-body-medium-line-height, 1.5rem));font-size:var(--mat-dialog-supporting-text-size, var(--mat-sys-body-medium-size, 1rem));font-weight:var(--mat-dialog-supporting-text-weight, var(--mat-sys-body-medium-weight, 400));letter-spacing:var(--mat-dialog-supporting-text-tracking, var(--mat-sys-body-medium-tracking, 0.03125em))}.mat-mdc-dialog-container .mat-mdc-dialog-content{padding:var(--mat-dialog-content-padding, 20px 24px)}.mat-mdc-dialog-container-with-actions .mat-mdc-dialog-content{padding:var(--mat-dialog-with-actions-content-padding, 20px 24px 0)}.mat-mdc-dialog-container .mat-mdc-dialog-title+.mat-mdc-dialog-content{padding-top:0}.mat-mdc-dialog-actions{display:flex;position:relative;flex-shrink:0;flex-wrap:wrap;align-items:center;box-sizing:border-box;min-height:52px;margin:0;border-top:1px solid rgba(0,0,0,0);padding:var(--mat-dialog-actions-padding, 16px 24px);justify-content:var(--mat-dialog-actions-alignment, flex-end)}@media(forced-colors: active){.mat-mdc-dialog-actions{border-top-color:CanvasText}}.mat-mdc-dialog-actions.mat-mdc-dialog-actions-align-start,.mat-mdc-dialog-actions[align=start]{justify-content:start}.mat-mdc-dialog-actions.mat-mdc-dialog-actions-align-center,.mat-mdc-dialog-actions[align=center]{justify-content:center}.mat-mdc-dialog-actions.mat-mdc-dialog-actions-align-end,.mat-mdc-dialog-actions[align=end]{justify-content:flex-end}.mat-mdc-dialog-actions .mat-button-base+.mat-button-base,.mat-mdc-dialog-actions .mat-mdc-button-base+.mat-mdc-button-base{margin-left:8px}[dir=rtl] .mat-mdc-dialog-actions .mat-button-base+.mat-button-base,[dir=rtl] .mat-mdc-dialog-actions .mat-mdc-button-base+.mat-mdc-button-base{margin-left:0;margin-right:8px}.mat-mdc-dialog-component-host{display:contents}\n'],
    encapsulation: 2
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatDialogContainer, [{
    type: Component,
    args: [{
      selector: "mat-dialog-container",
      encapsulation: ViewEncapsulation.None,
      changeDetection: ChangeDetectionStrategy.Default,
      imports: [CdkPortalOutlet],
      host: {
        "class": "mat-mdc-dialog-container mdc-dialog",
        "tabindex": "-1",
        "[attr.aria-modal]": "_config.ariaModal",
        "[id]": "_config.id",
        "[attr.role]": "_config.role",
        "[attr.aria-labelledby]": "_config.ariaLabel ? null : _ariaLabelledByQueue[0]",
        "[attr.aria-label]": "_config.ariaLabel",
        "[attr.aria-describedby]": "_config.ariaDescribedBy || null",
        "[class._mat-animation-noopable]": "!_animationsEnabled",
        "[class.mat-mdc-dialog-container-with-actions]": "_actionSectionCount > 0"
      },
      template: '<div class="mat-mdc-dialog-inner-container mdc-dialog__container">\n  <div class="mat-mdc-dialog-surface mdc-dialog__surface">\n    <ng-template cdkPortalOutlet />\n  </div>\n</div>\n',
      styles: ['.mat-mdc-dialog-container{width:100%;height:100%;display:block;box-sizing:border-box;max-height:inherit;min-height:inherit;min-width:inherit;max-width:inherit;outline:0}.cdk-overlay-pane.mat-mdc-dialog-panel{max-width:var(--mat-dialog-container-max-width, 560px);min-width:var(--mat-dialog-container-min-width, 280px)}@media(max-width: 599px){.cdk-overlay-pane.mat-mdc-dialog-panel{max-width:var(--mat-dialog-container-small-max-width, calc(100vw - 32px))}}.mat-mdc-dialog-inner-container{display:flex;flex-direction:row;align-items:center;justify-content:space-around;box-sizing:border-box;height:100%;opacity:0;transition:opacity linear var(--mat-dialog-transition-duration, 0ms);max-height:inherit;min-height:inherit;min-width:inherit;max-width:inherit}.mdc-dialog--closing .mat-mdc-dialog-inner-container{transition:opacity 75ms linear;transform:none}.mdc-dialog--open .mat-mdc-dialog-inner-container{opacity:1}._mat-animation-noopable .mat-mdc-dialog-inner-container{transition:none}.mat-mdc-dialog-surface{display:flex;flex-direction:column;flex-grow:0;flex-shrink:0;box-sizing:border-box;width:100%;height:100%;position:relative;overflow-y:auto;outline:0;transform:scale(0.8);transition:transform var(--mat-dialog-transition-duration, 0ms) cubic-bezier(0, 0, 0.2, 1);max-height:inherit;min-height:inherit;min-width:inherit;max-width:inherit;box-shadow:var(--mat-dialog-container-elevation-shadow, none);border-radius:var(--mat-dialog-container-shape, var(--mat-sys-corner-extra-large, 4px));background-color:var(--mat-dialog-container-color, var(--mat-sys-surface, white))}[dir=rtl] .mat-mdc-dialog-surface{text-align:right}.mdc-dialog--open .mat-mdc-dialog-surface,.mdc-dialog--closing .mat-mdc-dialog-surface{transform:none}._mat-animation-noopable .mat-mdc-dialog-surface{transition:none}.mat-mdc-dialog-surface::before{position:absolute;box-sizing:border-box;width:100%;height:100%;top:0;left:0;border:2px solid rgba(0,0,0,0);border-radius:inherit;content:"";pointer-events:none}.mat-mdc-dialog-title{display:block;position:relative;flex-shrink:0;box-sizing:border-box;margin:0 0 1px;padding:var(--mat-dialog-headline-padding, 6px 24px 13px)}.mat-mdc-dialog-title::before{display:inline-block;width:0;height:40px;content:"";vertical-align:0}[dir=rtl] .mat-mdc-dialog-title{text-align:right}.mat-mdc-dialog-container .mat-mdc-dialog-title{color:var(--mat-dialog-subhead-color, var(--mat-sys-on-surface, rgba(0, 0, 0, 0.87)));font-family:var(--mat-dialog-subhead-font, var(--mat-sys-headline-small-font, inherit));line-height:var(--mat-dialog-subhead-line-height, var(--mat-sys-headline-small-line-height, 1.5rem));font-size:var(--mat-dialog-subhead-size, var(--mat-sys-headline-small-size, 1rem));font-weight:var(--mat-dialog-subhead-weight, var(--mat-sys-headline-small-weight, 400));letter-spacing:var(--mat-dialog-subhead-tracking, var(--mat-sys-headline-small-tracking, 0.03125em))}.mat-mdc-dialog-content{display:block;flex-grow:1;box-sizing:border-box;margin:0;overflow:auto;max-height:65vh}.mat-mdc-dialog-content>:first-child{margin-top:0}.mat-mdc-dialog-content>:last-child{margin-bottom:0}.mat-mdc-dialog-container .mat-mdc-dialog-content{color:var(--mat-dialog-supporting-text-color, var(--mat-sys-on-surface-variant, rgba(0, 0, 0, 0.6)));font-family:var(--mat-dialog-supporting-text-font, var(--mat-sys-body-medium-font, inherit));line-height:var(--mat-dialog-supporting-text-line-height, var(--mat-sys-body-medium-line-height, 1.5rem));font-size:var(--mat-dialog-supporting-text-size, var(--mat-sys-body-medium-size, 1rem));font-weight:var(--mat-dialog-supporting-text-weight, var(--mat-sys-body-medium-weight, 400));letter-spacing:var(--mat-dialog-supporting-text-tracking, var(--mat-sys-body-medium-tracking, 0.03125em))}.mat-mdc-dialog-container .mat-mdc-dialog-content{padding:var(--mat-dialog-content-padding, 20px 24px)}.mat-mdc-dialog-container-with-actions .mat-mdc-dialog-content{padding:var(--mat-dialog-with-actions-content-padding, 20px 24px 0)}.mat-mdc-dialog-container .mat-mdc-dialog-title+.mat-mdc-dialog-content{padding-top:0}.mat-mdc-dialog-actions{display:flex;position:relative;flex-shrink:0;flex-wrap:wrap;align-items:center;box-sizing:border-box;min-height:52px;margin:0;border-top:1px solid rgba(0,0,0,0);padding:var(--mat-dialog-actions-padding, 16px 24px);justify-content:var(--mat-dialog-actions-alignment, flex-end)}@media(forced-colors: active){.mat-mdc-dialog-actions{border-top-color:CanvasText}}.mat-mdc-dialog-actions.mat-mdc-dialog-actions-align-start,.mat-mdc-dialog-actions[align=start]{justify-content:start}.mat-mdc-dialog-actions.mat-mdc-dialog-actions-align-center,.mat-mdc-dialog-actions[align=center]{justify-content:center}.mat-mdc-dialog-actions.mat-mdc-dialog-actions-align-end,.mat-mdc-dialog-actions[align=end]{justify-content:flex-end}.mat-mdc-dialog-actions .mat-button-base+.mat-button-base,.mat-mdc-dialog-actions .mat-mdc-button-base+.mat-mdc-button-base{margin-left:8px}[dir=rtl] .mat-mdc-dialog-actions .mat-button-base+.mat-button-base,[dir=rtl] .mat-mdc-dialog-actions .mat-mdc-button-base+.mat-mdc-button-base{margin-left:0;margin-right:8px}.mat-mdc-dialog-component-host{display:contents}\n']
    }]
  }], null, null);
})();
var TRANSITION_DURATION_PROPERTY = "--mat-dialog-transition-duration";
function parseCssTime(time) {
  if (time == null) {
    return null;
  }
  if (typeof time === "number") {
    return time;
  }
  if (time.endsWith("ms")) {
    return coerceNumberProperty(time.substring(0, time.length - 2));
  }
  if (time.endsWith("s")) {
    return coerceNumberProperty(time.substring(0, time.length - 1)) * 1e3;
  }
  if (time === "0") {
    return 0;
  }
  return null;
}
var MatDialogState;
(function(MatDialogState2) {
  MatDialogState2[MatDialogState2["OPEN"] = 0] = "OPEN";
  MatDialogState2[MatDialogState2["CLOSING"] = 1] = "CLOSING";
  MatDialogState2[MatDialogState2["CLOSED"] = 2] = "CLOSED";
})(MatDialogState || (MatDialogState = {}));
var MatDialogRef = class {
  _ref;
  _config;
  _containerInstance;
  /** The instance of component opened into the dialog. */
  componentInstance;
  /**
   * `ComponentRef` of the component opened into the dialog. Will be
   * null when the dialog is opened using a `TemplateRef`.
   */
  componentRef;
  /** Whether the user is allowed to close the dialog. */
  disableClose;
  /** Unique ID for the dialog. */
  id;
  /** Subject for notifying the user that the dialog has finished opening. */
  _afterOpened = new Subject();
  /** Subject for notifying the user that the dialog has started closing. */
  _beforeClosed = new Subject();
  /** Result to be passed to afterClosed. */
  _result;
  /** Handle to the timeout that's running as a fallback in case the exit animation doesn't fire. */
  _closeFallbackTimeout;
  /** Current state of the dialog. */
  _state = MatDialogState.OPEN;
  // TODO(crisbeto): we shouldn't have to declare this property, because `DialogRef.close`
  // already has a second `options` parameter that we can use. The problem is that internal tests
  // have assertions like `expect(MatDialogRef.close).toHaveBeenCalledWith(foo)` which will break,
  // because it'll be called with two arguments by things like `MatDialogClose`.
  /** Interaction that caused the dialog to close. */
  _closeInteractionType;
  constructor(_ref, _config, _containerInstance) {
    this._ref = _ref;
    this._config = _config;
    this._containerInstance = _containerInstance;
    this.disableClose = _config.disableClose;
    this.id = _ref.id;
    _ref.addPanelClass("mat-mdc-dialog-panel");
    _containerInstance._animationStateChanged.pipe(filter((event) => event.state === "opened"), take(1)).subscribe(() => {
      this._afterOpened.next();
      this._afterOpened.complete();
    });
    _containerInstance._animationStateChanged.pipe(filter((event) => event.state === "closed"), take(1)).subscribe(() => {
      clearTimeout(this._closeFallbackTimeout);
      this._finishDialogClose();
    });
    _ref.overlayRef.detachments().subscribe(() => {
      this._beforeClosed.next(this._result);
      this._beforeClosed.complete();
      this._finishDialogClose();
    });
    merge(this.backdropClick(), this.keydownEvents().pipe(filter((event) => event.keyCode === ESCAPE && !this.disableClose && !hasModifierKey(event)))).subscribe((event) => {
      if (!this.disableClose) {
        event.preventDefault();
        _closeDialogVia(this, event.type === "keydown" ? "keyboard" : "mouse");
      }
    });
  }
  /**
   * Close the dialog.
   * @param dialogResult Optional result to return to the dialog opener.
   */
  close(dialogResult) {
    const closePredicate = this._config.closePredicate;
    if (closePredicate && !closePredicate(dialogResult, this._config, this.componentInstance)) {
      return;
    }
    this._result = dialogResult;
    this._containerInstance._animationStateChanged.pipe(filter((event) => event.state === "closing"), take(1)).subscribe((event) => {
      this._beforeClosed.next(dialogResult);
      this._beforeClosed.complete();
      this._ref.overlayRef.detachBackdrop();
      this._closeFallbackTimeout = setTimeout(() => this._finishDialogClose(), event.totalTime + 100);
    });
    this._state = MatDialogState.CLOSING;
    this._containerInstance._startExitAnimation();
  }
  /**
   * Gets an observable that is notified when the dialog is finished opening.
   */
  afterOpened() {
    return this._afterOpened;
  }
  /**
   * Gets an observable that is notified when the dialog is finished closing.
   */
  afterClosed() {
    return this._ref.closed;
  }
  /**
   * Gets an observable that is notified when the dialog has started closing.
   */
  beforeClosed() {
    return this._beforeClosed;
  }
  /**
   * Gets an observable that emits when the overlay's backdrop has been clicked.
   */
  backdropClick() {
    return this._ref.backdropClick;
  }
  /**
   * Gets an observable that emits when keydown events are targeted on the overlay.
   */
  keydownEvents() {
    return this._ref.keydownEvents;
  }
  /**
   * Updates the dialog's position.
   * @param position New dialog position.
   */
  updatePosition(position) {
    let strategy = this._ref.config.positionStrategy;
    if (position && (position.left || position.right)) {
      position.left ? strategy.left(position.left) : strategy.right(position.right);
    } else {
      strategy.centerHorizontally();
    }
    if (position && (position.top || position.bottom)) {
      position.top ? strategy.top(position.top) : strategy.bottom(position.bottom);
    } else {
      strategy.centerVertically();
    }
    this._ref.updatePosition();
    return this;
  }
  /**
   * Updates the dialog's width and height.
   * @param width New width of the dialog.
   * @param height New height of the dialog.
   */
  updateSize(width = "", height = "") {
    this._ref.updateSize(width, height);
    return this;
  }
  /** Add a CSS class or an array of classes to the overlay pane. */
  addPanelClass(classes) {
    this._ref.addPanelClass(classes);
    return this;
  }
  /** Remove a CSS class or an array of classes from the overlay pane. */
  removePanelClass(classes) {
    this._ref.removePanelClass(classes);
    return this;
  }
  /** Gets the current state of the dialog's lifecycle. */
  getState() {
    return this._state;
  }
  /**
   * Finishes the dialog close by updating the state of the dialog
   * and disposing the overlay.
   */
  _finishDialogClose() {
    this._state = MatDialogState.CLOSED;
    this._ref.close(this._result, {
      focusOrigin: this._closeInteractionType
    });
    this.componentInstance = null;
  }
};
function _closeDialogVia(ref, interactionType, result) {
  ref._closeInteractionType = interactionType;
  return ref.close(result);
}
var MAT_DIALOG_DATA = new InjectionToken("MatMdcDialogData");
var MAT_DIALOG_DEFAULT_OPTIONS = new InjectionToken("mat-mdc-dialog-default-options");
var MAT_DIALOG_SCROLL_STRATEGY = new InjectionToken("mat-mdc-dialog-scroll-strategy", {
  providedIn: "root",
  factory: () => {
    const injector = inject2(Injector);
    return () => createBlockScrollStrategy(injector);
  }
});
var MatDialog = class _MatDialog {
  _defaultOptions = inject2(MAT_DIALOG_DEFAULT_OPTIONS, {
    optional: true
  });
  _scrollStrategy = inject2(MAT_DIALOG_SCROLL_STRATEGY);
  _parentDialog = inject2(_MatDialog, {
    optional: true,
    skipSelf: true
  });
  _idGenerator = inject2(_IdGenerator);
  _injector = inject2(Injector);
  _dialog = inject2(Dialog);
  _animationsDisabled = _animationsDisabled();
  _openDialogsAtThisLevel = [];
  _afterAllClosedAtThisLevel = new Subject();
  _afterOpenedAtThisLevel = new Subject();
  dialogConfigClass = MatDialogConfig;
  _dialogRefConstructor;
  _dialogContainerType;
  _dialogDataToken;
  /** Keeps track of the currently-open dialogs. */
  get openDialogs() {
    return this._parentDialog ? this._parentDialog.openDialogs : this._openDialogsAtThisLevel;
  }
  /** Stream that emits when a dialog has been opened. */
  get afterOpened() {
    return this._parentDialog ? this._parentDialog.afterOpened : this._afterOpenedAtThisLevel;
  }
  _getAfterAllClosed() {
    const parent = this._parentDialog;
    return parent ? parent._getAfterAllClosed() : this._afterAllClosedAtThisLevel;
  }
  /**
   * Stream that emits when all open dialog have finished closing.
   * Will emit on subscribe if there are no open dialogs to begin with.
   */
  afterAllClosed = defer(() => this.openDialogs.length ? this._getAfterAllClosed() : this._getAfterAllClosed().pipe(startWith(void 0)));
  constructor() {
    this._dialogRefConstructor = MatDialogRef;
    this._dialogContainerType = MatDialogContainer;
    this._dialogDataToken = MAT_DIALOG_DATA;
  }
  open(componentOrTemplateRef, config2) {
    let dialogRef;
    config2 = __spreadValues(__spreadValues({}, this._defaultOptions || new MatDialogConfig()), config2);
    config2.id = config2.id || this._idGenerator.getId("mat-mdc-dialog-");
    config2.scrollStrategy = config2.scrollStrategy || this._scrollStrategy();
    const cdkRef = this._dialog.open(componentOrTemplateRef, __spreadProps(__spreadValues({}, config2), {
      positionStrategy: createGlobalPositionStrategy(this._injector).centerHorizontally().centerVertically(),
      // Disable closing since we need to sync it up to the animation ourselves.
      disableClose: true,
      // Closing is tied to our animation so the close predicate has to be implemented separately.
      closePredicate: void 0,
      // Disable closing on destroy, because this service cleans up its open dialogs as well.
      // We want to do the cleanup here, rather than the CDK service, because the CDK destroys
      // the dialogs immediately whereas we want it to wait for the animations to finish.
      closeOnDestroy: false,
      // Disable closing on detachments so that we can sync up the animation.
      // The Material dialog ref handles this manually.
      closeOnOverlayDetachments: false,
      disableAnimations: this._animationsDisabled || config2.enterAnimationDuration?.toLocaleString() === "0" || config2.exitAnimationDuration?.toString() === "0",
      container: {
        type: this._dialogContainerType,
        providers: () => [
          // Provide our config as the CDK config as well since it has the same interface as the
          // CDK one, but it contains the actual values passed in by the user for things like
          // `disableClose` which we disable for the CDK dialog since we handle it ourselves.
          {
            provide: this.dialogConfigClass,
            useValue: config2
          },
          {
            provide: DialogConfig,
            useValue: config2
          }
        ]
      },
      templateContext: () => ({
        dialogRef
      }),
      providers: (ref, cdkConfig, dialogContainer) => {
        dialogRef = new this._dialogRefConstructor(ref, config2, dialogContainer);
        dialogRef.updatePosition(config2?.position);
        return [{
          provide: this._dialogContainerType,
          useValue: dialogContainer
        }, {
          provide: this._dialogDataToken,
          useValue: cdkConfig.data
        }, {
          provide: this._dialogRefConstructor,
          useValue: dialogRef
        }];
      }
    }));
    dialogRef.componentRef = cdkRef.componentRef;
    dialogRef.componentInstance = cdkRef.componentInstance;
    this.openDialogs.push(dialogRef);
    this.afterOpened.next(dialogRef);
    dialogRef.afterClosed().subscribe(() => {
      const index = this.openDialogs.indexOf(dialogRef);
      if (index > -1) {
        this.openDialogs.splice(index, 1);
        if (!this.openDialogs.length) {
          this._getAfterAllClosed().next();
        }
      }
    });
    return dialogRef;
  }
  /**
   * Closes all of the currently-open dialogs.
   */
  closeAll() {
    this._closeDialogs(this.openDialogs);
  }
  /**
   * Finds an open dialog by its id.
   * @param id ID to use when looking up the dialog.
   */
  getDialogById(id) {
    return this.openDialogs.find((dialog) => dialog.id === id);
  }
  ngOnDestroy() {
    this._closeDialogs(this._openDialogsAtThisLevel);
    this._afterAllClosedAtThisLevel.complete();
    this._afterOpenedAtThisLevel.complete();
  }
  _closeDialogs(dialogs) {
    let i = dialogs.length;
    while (i--) {
      dialogs[i].close();
    }
  }
  static \u0275fac = function MatDialog_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _MatDialog)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _MatDialog,
    factory: _MatDialog.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatDialog, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], () => [], null);
})();
var MatDialogClose = class _MatDialogClose {
  dialogRef = inject2(MatDialogRef, {
    optional: true
  });
  _elementRef = inject2(ElementRef);
  _dialog = inject2(MatDialog);
  /** Screen-reader label for the button. */
  ariaLabel;
  /** Default to "button" to prevents accidental form submits. */
  type = "button";
  /** Dialog close input. */
  dialogResult;
  _matDialogClose;
  constructor() {
  }
  ngOnInit() {
    if (!this.dialogRef) {
      this.dialogRef = getClosestDialog(this._elementRef, this._dialog.openDialogs);
    }
  }
  ngOnChanges(changes) {
    const proxiedChange = changes["_matDialogClose"] || changes["_matDialogCloseResult"];
    if (proxiedChange) {
      this.dialogResult = proxiedChange.currentValue;
    }
  }
  _onButtonClick(event) {
    _closeDialogVia(this.dialogRef, event.screenX === 0 && event.screenY === 0 ? "keyboard" : "mouse", this.dialogResult);
  }
  static \u0275fac = function MatDialogClose_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _MatDialogClose)();
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _MatDialogClose,
    selectors: [["", "mat-dialog-close", ""], ["", "matDialogClose", ""]],
    hostVars: 2,
    hostBindings: function MatDialogClose_HostBindings(rf, ctx) {
      if (rf & 1) {
        \u0275\u0275listener("click", function MatDialogClose_click_HostBindingHandler($event) {
          return ctx._onButtonClick($event);
        });
      }
      if (rf & 2) {
        \u0275\u0275attribute("aria-label", ctx.ariaLabel || null)("type", ctx.type);
      }
    },
    inputs: {
      ariaLabel: [0, "aria-label", "ariaLabel"],
      type: "type",
      dialogResult: [0, "mat-dialog-close", "dialogResult"],
      _matDialogClose: [0, "matDialogClose", "_matDialogClose"]
    },
    exportAs: ["matDialogClose"],
    features: [\u0275\u0275NgOnChangesFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatDialogClose, [{
    type: Directive,
    args: [{
      selector: "[mat-dialog-close], [matDialogClose]",
      exportAs: "matDialogClose",
      host: {
        "(click)": "_onButtonClick($event)",
        "[attr.aria-label]": "ariaLabel || null",
        "[attr.type]": "type"
      }
    }]
  }], () => [], {
    ariaLabel: [{
      type: Input,
      args: ["aria-label"]
    }],
    type: [{
      type: Input
    }],
    dialogResult: [{
      type: Input,
      args: ["mat-dialog-close"]
    }],
    _matDialogClose: [{
      type: Input,
      args: ["matDialogClose"]
    }]
  });
})();
var MatDialogLayoutSection = class _MatDialogLayoutSection {
  _dialogRef = inject2(MatDialogRef, {
    optional: true
  });
  _elementRef = inject2(ElementRef);
  _dialog = inject2(MatDialog);
  constructor() {
  }
  ngOnInit() {
    if (!this._dialogRef) {
      this._dialogRef = getClosestDialog(this._elementRef, this._dialog.openDialogs);
    }
    if (this._dialogRef) {
      Promise.resolve().then(() => {
        this._onAdd();
      });
    }
  }
  ngOnDestroy() {
    const instance = this._dialogRef?._containerInstance;
    if (instance) {
      Promise.resolve().then(() => {
        this._onRemove();
      });
    }
  }
  static \u0275fac = function MatDialogLayoutSection_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _MatDialogLayoutSection)();
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _MatDialogLayoutSection
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatDialogLayoutSection, [{
    type: Directive
  }], () => [], null);
})();
var MatDialogTitle = class _MatDialogTitle extends MatDialogLayoutSection {
  id = inject2(_IdGenerator).getId("mat-mdc-dialog-title-");
  _onAdd() {
    this._dialogRef._containerInstance?._addAriaLabelledBy?.(this.id);
  }
  _onRemove() {
    this._dialogRef?._containerInstance?._removeAriaLabelledBy?.(this.id);
  }
  static \u0275fac = /* @__PURE__ */ (() => {
    let \u0275MatDialogTitle_BaseFactory;
    return function MatDialogTitle_Factory(__ngFactoryType__) {
      return (\u0275MatDialogTitle_BaseFactory || (\u0275MatDialogTitle_BaseFactory = \u0275\u0275getInheritedFactory(_MatDialogTitle)))(__ngFactoryType__ || _MatDialogTitle);
    };
  })();
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _MatDialogTitle,
    selectors: [["", "mat-dialog-title", ""], ["", "matDialogTitle", ""]],
    hostAttrs: [1, "mat-mdc-dialog-title", "mdc-dialog__title"],
    hostVars: 1,
    hostBindings: function MatDialogTitle_HostBindings(rf, ctx) {
      if (rf & 2) {
        \u0275\u0275domProperty("id", ctx.id);
      }
    },
    inputs: {
      id: "id"
    },
    exportAs: ["matDialogTitle"],
    features: [\u0275\u0275InheritDefinitionFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatDialogTitle, [{
    type: Directive,
    args: [{
      selector: "[mat-dialog-title], [matDialogTitle]",
      exportAs: "matDialogTitle",
      host: {
        "class": "mat-mdc-dialog-title mdc-dialog__title",
        "[id]": "id"
      }
    }]
  }], null, {
    id: [{
      type: Input
    }]
  });
})();
var MatDialogContent = class _MatDialogContent {
  static \u0275fac = function MatDialogContent_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _MatDialogContent)();
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _MatDialogContent,
    selectors: [["", "mat-dialog-content", ""], ["mat-dialog-content"], ["", "matDialogContent", ""]],
    hostAttrs: [1, "mat-mdc-dialog-content", "mdc-dialog__content"],
    features: [\u0275\u0275HostDirectivesFeature([CdkScrollable])]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatDialogContent, [{
    type: Directive,
    args: [{
      selector: `[mat-dialog-content], mat-dialog-content, [matDialogContent]`,
      host: {
        "class": "mat-mdc-dialog-content mdc-dialog__content"
      },
      hostDirectives: [CdkScrollable]
    }]
  }], null, null);
})();
var MatDialogActions = class _MatDialogActions extends MatDialogLayoutSection {
  /**
   * Horizontal alignment of action buttons.
   */
  align;
  _onAdd() {
    this._dialogRef._containerInstance?._updateActionSectionCount?.(1);
  }
  _onRemove() {
    this._dialogRef._containerInstance?._updateActionSectionCount?.(-1);
  }
  static \u0275fac = /* @__PURE__ */ (() => {
    let \u0275MatDialogActions_BaseFactory;
    return function MatDialogActions_Factory(__ngFactoryType__) {
      return (\u0275MatDialogActions_BaseFactory || (\u0275MatDialogActions_BaseFactory = \u0275\u0275getInheritedFactory(_MatDialogActions)))(__ngFactoryType__ || _MatDialogActions);
    };
  })();
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _MatDialogActions,
    selectors: [["", "mat-dialog-actions", ""], ["mat-dialog-actions"], ["", "matDialogActions", ""]],
    hostAttrs: [1, "mat-mdc-dialog-actions", "mdc-dialog__actions"],
    hostVars: 6,
    hostBindings: function MatDialogActions_HostBindings(rf, ctx) {
      if (rf & 2) {
        \u0275\u0275classProp("mat-mdc-dialog-actions-align-start", ctx.align === "start")("mat-mdc-dialog-actions-align-center", ctx.align === "center")("mat-mdc-dialog-actions-align-end", ctx.align === "end");
      }
    },
    inputs: {
      align: "align"
    },
    features: [\u0275\u0275InheritDefinitionFeature]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatDialogActions, [{
    type: Directive,
    args: [{
      selector: `[mat-dialog-actions], mat-dialog-actions, [matDialogActions]`,
      host: {
        "class": "mat-mdc-dialog-actions mdc-dialog__actions",
        "[class.mat-mdc-dialog-actions-align-start]": 'align === "start"',
        "[class.mat-mdc-dialog-actions-align-center]": 'align === "center"',
        "[class.mat-mdc-dialog-actions-align-end]": 'align === "end"'
      }
    }]
  }], null, {
    align: [{
      type: Input
    }]
  });
})();
function getClosestDialog(element, openDialogs) {
  let parent = element.nativeElement.parentElement;
  while (parent && !parent.classList.contains("mat-mdc-dialog-container")) {
    parent = parent.parentElement;
  }
  return parent ? openDialogs.find((dialog) => dialog.id === parent.id) : null;
}
var DIRECTIVES = [MatDialogContainer, MatDialogClose, MatDialogTitle, MatDialogActions, MatDialogContent];
var MatDialogModule = class _MatDialogModule {
  static \u0275fac = function MatDialogModule_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _MatDialogModule)();
  };
  static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
    type: _MatDialogModule,
    imports: [DialogModule, OverlayModule, PortalModule, MatCommonModule, MatDialogContainer, MatDialogClose, MatDialogTitle, MatDialogActions, MatDialogContent],
    exports: [MatCommonModule, MatDialogContainer, MatDialogClose, MatDialogTitle, MatDialogActions, MatDialogContent]
  });
  static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({
    providers: [MatDialog],
    imports: [DialogModule, OverlayModule, PortalModule, MatCommonModule, MatCommonModule]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatDialogModule, [{
    type: NgModule,
    args: [{
      imports: [DialogModule, OverlayModule, PortalModule, MatCommonModule, ...DIRECTIVES],
      exports: [MatCommonModule, ...DIRECTIVES],
      providers: [MatDialog]
    }]
  }], null, null);
})();

// node_modules/@angular/material/fesm2022/ripple-loader-wNDzC_j6.mjs
var eventListenerOptions2 = {
  capture: true
};
var rippleInteractionEvents = ["focus", "mousedown", "mouseenter", "touchstart"];
var matRippleUninitialized = "mat-ripple-loader-uninitialized";
var matRippleClassName = "mat-ripple-loader-class-name";
var matRippleCentered = "mat-ripple-loader-centered";
var matRippleDisabled = "mat-ripple-loader-disabled";
var MatRippleLoader = class _MatRippleLoader {
  _document = inject2(DOCUMENT);
  _animationsDisabled = _animationsDisabled();
  _globalRippleOptions = inject2(MAT_RIPPLE_GLOBAL_OPTIONS, {
    optional: true
  });
  _platform = inject2(Platform);
  _ngZone = inject2(NgZone);
  _injector = inject2(Injector);
  _eventCleanups;
  _hosts = /* @__PURE__ */ new Map();
  constructor() {
    const renderer = inject2(RendererFactory2).createRenderer(null, null);
    this._eventCleanups = this._ngZone.runOutsideAngular(() => rippleInteractionEvents.map((name2) => renderer.listen(this._document, name2, this._onInteraction, eventListenerOptions2)));
  }
  ngOnDestroy() {
    const hosts = this._hosts.keys();
    for (const host of hosts) {
      this.destroyRipple(host);
    }
    this._eventCleanups.forEach((cleanup) => cleanup());
  }
  /**
   * Configures the ripple that will be rendered by the ripple loader.
   *
   * Stores the given information about how the ripple should be configured on the host
   * element so that it can later be retrived & used when the ripple is actually created.
   */
  configureRipple(host, config2) {
    host.setAttribute(matRippleUninitialized, this._globalRippleOptions?.namespace ?? "");
    if (config2.className || !host.hasAttribute(matRippleClassName)) {
      host.setAttribute(matRippleClassName, config2.className || "");
    }
    if (config2.centered) {
      host.setAttribute(matRippleCentered, "");
    }
    if (config2.disabled) {
      host.setAttribute(matRippleDisabled, "");
    }
  }
  /** Sets the disabled state on the ripple instance corresponding to the given host element. */
  setDisabled(host, disabled) {
    const ripple = this._hosts.get(host);
    if (ripple) {
      ripple.target.rippleDisabled = disabled;
      if (!disabled && !ripple.hasSetUpEvents) {
        ripple.hasSetUpEvents = true;
        ripple.renderer.setupTriggerEvents(host);
      }
    } else if (disabled) {
      host.setAttribute(matRippleDisabled, "");
    } else {
      host.removeAttribute(matRippleDisabled);
    }
  }
  /**
   * Handles creating and attaching component internals
   * when a component is initially interacted with.
   */
  _onInteraction = (event) => {
    const eventTarget = _getEventTarget(event);
    if (eventTarget instanceof HTMLElement) {
      const element = eventTarget.closest(`[${matRippleUninitialized}="${this._globalRippleOptions?.namespace ?? ""}"]`);
      if (element) {
        this._createRipple(element);
      }
    }
  };
  /** Creates a MatRipple and appends it to the given element. */
  _createRipple(host) {
    if (!this._document || this._hosts.has(host)) {
      return;
    }
    host.querySelector(".mat-ripple")?.remove();
    const rippleEl = this._document.createElement("span");
    rippleEl.classList.add("mat-ripple", host.getAttribute(matRippleClassName));
    host.append(rippleEl);
    const globalOptions = this._globalRippleOptions;
    const enterDuration = this._animationsDisabled ? 0 : globalOptions?.animation?.enterDuration ?? defaultRippleAnimationConfig.enterDuration;
    const exitDuration = this._animationsDisabled ? 0 : globalOptions?.animation?.exitDuration ?? defaultRippleAnimationConfig.exitDuration;
    const target = {
      rippleDisabled: this._animationsDisabled || globalOptions?.disabled || host.hasAttribute(matRippleDisabled),
      rippleConfig: {
        centered: host.hasAttribute(matRippleCentered),
        terminateOnPointerUp: globalOptions?.terminateOnPointerUp,
        animation: {
          enterDuration,
          exitDuration
        }
      }
    };
    const renderer = new RippleRenderer(target, this._ngZone, rippleEl, this._platform, this._injector);
    const hasSetUpEvents = !target.rippleDisabled;
    if (hasSetUpEvents) {
      renderer.setupTriggerEvents(host);
    }
    this._hosts.set(host, {
      target,
      renderer,
      hasSetUpEvents
    });
    host.removeAttribute(matRippleUninitialized);
  }
  destroyRipple(host) {
    const ripple = this._hosts.get(host);
    if (ripple) {
      ripple.renderer._removeTriggerEvents();
      this._hosts.delete(host);
    }
  }
  static \u0275fac = function MatRippleLoader_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _MatRippleLoader)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
    token: _MatRippleLoader,
    factory: _MatRippleLoader.\u0275fac,
    providedIn: "root"
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatRippleLoader, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], () => [], null);
})();

// node_modules/@angular/material/fesm2022/icon-button-Qqf7bl_c.mjs
var _c014 = ["mat-icon-button", ""];
var _c19 = ["*"];
var MAT_BUTTON_CONFIG = new InjectionToken("MAT_BUTTON_CONFIG");
function transformTabIndex(value) {
  return value == null ? void 0 : numberAttribute(value);
}
var MatButtonBase = class _MatButtonBase {
  _elementRef = inject2(ElementRef);
  _ngZone = inject2(NgZone);
  _animationsDisabled = _animationsDisabled();
  _config = inject2(MAT_BUTTON_CONFIG, {
    optional: true
  });
  _focusMonitor = inject2(FocusMonitor);
  _cleanupClick;
  _renderer = inject2(Renderer2);
  /**
   * Handles the lazy creation of the MatButton ripple.
   * Used to improve initial load time of large applications.
   */
  _rippleLoader = inject2(MatRippleLoader);
  /** Whether the button is set on an anchor node. */
  _isAnchor;
  /** Whether this button is a FAB. Used to apply the correct class on the ripple. */
  _isFab = false;
  /**
   * Theme color of the button. This API is supported in M2 themes only, it has
   * no effect in M3 themes. For color customization in M3, see https://material.angular.dev/components/button/styling.
   *
   * For information on applying color variants in M3, see
   * https://material.angular.dev/guide/material-2-theming#optional-add-backwards-compatibility-styles-for-color-variants
   */
  color;
  /** Whether the ripple effect is disabled or not. */
  get disableRipple() {
    return this._disableRipple;
  }
  set disableRipple(value) {
    this._disableRipple = value;
    this._updateRippleDisabled();
  }
  _disableRipple = false;
  /** Whether the button is disabled. */
  get disabled() {
    return this._disabled;
  }
  set disabled(value) {
    this._disabled = value;
    this._updateRippleDisabled();
  }
  _disabled = false;
  /** `aria-disabled` value of the button. */
  ariaDisabled;
  /**
   * Natively disabled buttons prevent focus and any pointer events from reaching the button.
   * In some scenarios this might not be desirable, because it can prevent users from finding out
   * why the button is disabled (e.g. via tooltip). This is also useful for buttons that may
   * become disabled when activated, which would cause focus to be transferred to the document
   * body instead of remaining on the button.
   *
   * Enabling this input will change the button so that it is styled to be disabled and will be
   * marked as `aria-disabled`, but it will allow the button to receive events and focus.
   *
   * Note that by enabling this, you need to set the `tabindex` yourself if the button isn't
   * meant to be tabbable and you have to prevent the button action (e.g. form submissions).
   */
  disabledInteractive;
  /** Tab index for the button. */
  tabIndex;
  /**
   * Backwards-compatibility input that handles pre-existing `[tabindex]` bindings.
   * @docs-private
   */
  set _tabindex(value) {
    this.tabIndex = value;
  }
  constructor() {
    inject2(_CdkPrivateStyleLoader).load(_StructuralStylesLoader);
    const element = this._elementRef.nativeElement;
    this._isAnchor = element.tagName === "A";
    this.disabledInteractive = this._config?.disabledInteractive ?? false;
    this.color = this._config?.color ?? null;
    this._rippleLoader?.configureRipple(element, {
      className: "mat-mdc-button-ripple"
    });
  }
  ngAfterViewInit() {
    this._focusMonitor.monitor(this._elementRef, true);
    if (this._isAnchor) {
      this._setupAsAnchor();
    }
  }
  ngOnDestroy() {
    this._cleanupClick?.();
    this._focusMonitor.stopMonitoring(this._elementRef);
    this._rippleLoader?.destroyRipple(this._elementRef.nativeElement);
  }
  /** Focuses the button. */
  focus(origin = "program", options) {
    if (origin) {
      this._focusMonitor.focusVia(this._elementRef.nativeElement, origin, options);
    } else {
      this._elementRef.nativeElement.focus(options);
    }
  }
  _getAriaDisabled() {
    if (this.ariaDisabled != null) {
      return this.ariaDisabled;
    }
    if (this._isAnchor) {
      return this.disabled || null;
    }
    return this.disabled && this.disabledInteractive ? true : null;
  }
  _getDisabledAttribute() {
    return this.disabledInteractive || !this.disabled ? null : true;
  }
  _updateRippleDisabled() {
    this._rippleLoader?.setDisabled(this._elementRef.nativeElement, this.disableRipple || this.disabled);
  }
  _getTabIndex() {
    if (this._isAnchor) {
      return this.disabled && !this.disabledInteractive ? -1 : this.tabIndex;
    }
    return this.tabIndex;
  }
  _setupAsAnchor() {
    this._cleanupClick = this._ngZone.runOutsideAngular(() => this._renderer.listen(this._elementRef.nativeElement, "click", (event) => {
      if (this.disabled) {
        event.preventDefault();
        event.stopImmediatePropagation();
      }
    }));
  }
  static \u0275fac = function MatButtonBase_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _MatButtonBase)();
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _MatButtonBase,
    hostAttrs: [1, "mat-mdc-button-base"],
    hostVars: 13,
    hostBindings: function MatButtonBase_HostBindings(rf, ctx) {
      if (rf & 2) {
        \u0275\u0275attribute("disabled", ctx._getDisabledAttribute())("aria-disabled", ctx._getAriaDisabled())("tabindex", ctx._getTabIndex());
        \u0275\u0275classMap(ctx.color ? "mat-" + ctx.color : "");
        \u0275\u0275classProp("mat-mdc-button-disabled", ctx.disabled)("mat-mdc-button-disabled-interactive", ctx.disabledInteractive)("mat-unthemed", !ctx.color)("_mat-animation-noopable", ctx._animationsDisabled);
      }
    },
    inputs: {
      color: "color",
      disableRipple: [2, "disableRipple", "disableRipple", booleanAttribute],
      disabled: [2, "disabled", "disabled", booleanAttribute],
      ariaDisabled: [2, "aria-disabled", "ariaDisabled", booleanAttribute],
      disabledInteractive: [2, "disabledInteractive", "disabledInteractive", booleanAttribute],
      tabIndex: [2, "tabIndex", "tabIndex", transformTabIndex],
      _tabindex: [2, "tabindex", "_tabindex", transformTabIndex]
    }
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatButtonBase, [{
    type: Directive,
    args: [{
      host: {
        // Add a class that applies to all buttons. This makes it easier to target if somebody
        // wants to target all Material buttons.
        "class": "mat-mdc-button-base",
        "[class]": 'color ? "mat-" + color : ""',
        "[attr.disabled]": "_getDisabledAttribute()",
        "[attr.aria-disabled]": "_getAriaDisabled()",
        "[attr.tabindex]": "_getTabIndex()",
        "[class.mat-mdc-button-disabled]": "disabled",
        "[class.mat-mdc-button-disabled-interactive]": "disabledInteractive",
        "[class.mat-unthemed]": "!color",
        "[class._mat-animation-noopable]": "_animationsDisabled"
      }
    }]
  }], () => [], {
    color: [{
      type: Input
    }],
    disableRipple: [{
      type: Input,
      args: [{
        transform: booleanAttribute
      }]
    }],
    disabled: [{
      type: Input,
      args: [{
        transform: booleanAttribute
      }]
    }],
    ariaDisabled: [{
      type: Input,
      args: [{
        transform: booleanAttribute,
        alias: "aria-disabled"
      }]
    }],
    disabledInteractive: [{
      type: Input,
      args: [{
        transform: booleanAttribute
      }]
    }],
    tabIndex: [{
      type: Input,
      args: [{
        transform: transformTabIndex
      }]
    }],
    _tabindex: [{
      type: Input,
      args: [{
        alias: "tabindex",
        transform: transformTabIndex
      }]
    }]
  });
})();
var MatIconButton = class _MatIconButton extends MatButtonBase {
  constructor() {
    super();
    this._rippleLoader.configureRipple(this._elementRef.nativeElement, {
      centered: true
    });
  }
  static \u0275fac = function MatIconButton_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _MatIconButton)();
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({
    type: _MatIconButton,
    selectors: [["button", "mat-icon-button", ""], ["a", "mat-icon-button", ""], ["button", "matIconButton", ""], ["a", "matIconButton", ""]],
    hostAttrs: [1, "mdc-icon-button", "mat-mdc-icon-button"],
    exportAs: ["matButton", "matAnchor"],
    features: [\u0275\u0275InheritDefinitionFeature],
    attrs: _c014,
    ngContentSelectors: _c19,
    decls: 4,
    vars: 0,
    consts: [[1, "mat-mdc-button-persistent-ripple", "mdc-icon-button__ripple"], [1, "mat-focus-indicator"], [1, "mat-mdc-button-touch-target"]],
    template: function MatIconButton_Template(rf, ctx) {
      if (rf & 1) {
        \u0275\u0275projectionDef();
        \u0275\u0275domElement(0, "span", 0);
        \u0275\u0275projection(1);
        \u0275\u0275domElement(2, "span", 1)(3, "span", 2);
      }
    },
    styles: ['.mat-mdc-icon-button{-webkit-user-select:none;user-select:none;display:inline-block;position:relative;box-sizing:border-box;border:none;outline:none;background-color:rgba(0,0,0,0);fill:currentColor;text-decoration:none;cursor:pointer;z-index:0;overflow:visible;border-radius:var(--mat-icon-button-container-shape, var(--mat-sys-corner-full, 50%));flex-shrink:0;text-align:center;width:var(--mat-icon-button-state-layer-size, 40px);height:var(--mat-icon-button-state-layer-size, 40px);padding:calc(calc(var(--mat-icon-button-state-layer-size, 40px) - var(--mat-icon-button-icon-size, 24px)) / 2);font-size:var(--mat-icon-button-icon-size, 24px);color:var(--mat-icon-button-icon-color, var(--mat-sys-on-surface-variant));-webkit-tap-highlight-color:rgba(0,0,0,0)}.mat-mdc-icon-button .mat-mdc-button-ripple,.mat-mdc-icon-button .mat-mdc-button-persistent-ripple,.mat-mdc-icon-button .mat-mdc-button-persistent-ripple::before{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none;border-radius:inherit}.mat-mdc-icon-button .mat-mdc-button-ripple{overflow:hidden}.mat-mdc-icon-button .mat-mdc-button-persistent-ripple::before{content:"";opacity:0}.mat-mdc-icon-button .mdc-button__label,.mat-mdc-icon-button .mat-icon{z-index:1;position:relative}.mat-mdc-icon-button .mat-focus-indicator{top:0;left:0;right:0;bottom:0;position:absolute;border-radius:inherit}.mat-mdc-icon-button:focus>.mat-focus-indicator::before{content:"";border-radius:inherit}.mat-mdc-icon-button .mat-ripple-element{background-color:var(--mat-icon-button-ripple-color, color-mix(in srgb, var(--mat-sys-on-surface-variant) calc(var(--mat-sys-pressed-state-layer-opacity) * 100%), transparent))}.mat-mdc-icon-button .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-icon-button-state-layer-color, var(--mat-sys-on-surface-variant))}.mat-mdc-icon-button.mat-mdc-button-disabled .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-icon-button-disabled-state-layer-color, var(--mat-sys-on-surface-variant))}.mat-mdc-icon-button:hover>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-icon-button-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity))}.mat-mdc-icon-button.cdk-program-focused>.mat-mdc-button-persistent-ripple::before,.mat-mdc-icon-button.cdk-keyboard-focused>.mat-mdc-button-persistent-ripple::before,.mat-mdc-icon-button.mat-mdc-button-disabled-interactive:focus>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-icon-button-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}.mat-mdc-icon-button:active>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-icon-button-pressed-state-layer-opacity, var(--mat-sys-pressed-state-layer-opacity))}.mat-mdc-icon-button .mat-mdc-button-touch-target{position:absolute;top:50%;height:48px;display:var(--mat-icon-button-touch-target-display, block);left:50%;width:48px;transform:translate(-50%, -50%)}.mat-mdc-icon-button._mat-animation-noopable{transition:none !important;animation:none !important}.mat-mdc-icon-button[disabled],.mat-mdc-icon-button.mat-mdc-button-disabled{cursor:default;pointer-events:none;color:var(--mat-icon-button-disabled-icon-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-mdc-icon-button.mat-mdc-button-disabled-interactive{pointer-events:auto}.mat-mdc-icon-button img,.mat-mdc-icon-button svg{width:var(--mat-icon-button-icon-size, 24px);height:var(--mat-icon-button-icon-size, 24px);vertical-align:baseline}.mat-mdc-icon-button .mat-mdc-button-persistent-ripple{border-radius:var(--mat-icon-button-container-shape, var(--mat-sys-corner-full, 50%))}.mat-mdc-icon-button[hidden]{display:none}.mat-mdc-icon-button.mat-unthemed:not(.mdc-ripple-upgraded):focus::before,.mat-mdc-icon-button.mat-primary:not(.mdc-ripple-upgraded):focus::before,.mat-mdc-icon-button.mat-accent:not(.mdc-ripple-upgraded):focus::before,.mat-mdc-icon-button.mat-warn:not(.mdc-ripple-upgraded):focus::before{background:rgba(0,0,0,0);opacity:1}\n', "@media(forced-colors: active){.mat-mdc-button:not(.mdc-button--outlined),.mat-mdc-unelevated-button:not(.mdc-button--outlined),.mat-mdc-raised-button:not(.mdc-button--outlined),.mat-mdc-outlined-button:not(.mdc-button--outlined),.mat-mdc-button-base.mat-tonal-button,.mat-mdc-icon-button.mat-mdc-icon-button,.mat-mdc-outlined-button .mdc-button__ripple{outline:solid 1px}}\n"],
    encapsulation: 2,
    changeDetection: 0
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatIconButton, [{
    type: Component,
    args: [{
      selector: `button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]`,
      host: {
        "class": "mdc-icon-button mat-mdc-icon-button"
      },
      exportAs: "matButton, matAnchor",
      encapsulation: ViewEncapsulation.None,
      changeDetection: ChangeDetectionStrategy.OnPush,
      template: `<span class="mat-mdc-button-persistent-ripple mdc-icon-button__ripple"></span>

<ng-content></ng-content>

<!--
  The indicator can't be directly on the button, because MDC uses ::before for high contrast
  indication and it can't be on the ripple, because it has a border radius and overflow: hidden.
-->
<span class="mat-focus-indicator"></span>

<span class="mat-mdc-button-touch-target"></span>
`,
      styles: ['.mat-mdc-icon-button{-webkit-user-select:none;user-select:none;display:inline-block;position:relative;box-sizing:border-box;border:none;outline:none;background-color:rgba(0,0,0,0);fill:currentColor;text-decoration:none;cursor:pointer;z-index:0;overflow:visible;border-radius:var(--mat-icon-button-container-shape, var(--mat-sys-corner-full, 50%));flex-shrink:0;text-align:center;width:var(--mat-icon-button-state-layer-size, 40px);height:var(--mat-icon-button-state-layer-size, 40px);padding:calc(calc(var(--mat-icon-button-state-layer-size, 40px) - var(--mat-icon-button-icon-size, 24px)) / 2);font-size:var(--mat-icon-button-icon-size, 24px);color:var(--mat-icon-button-icon-color, var(--mat-sys-on-surface-variant));-webkit-tap-highlight-color:rgba(0,0,0,0)}.mat-mdc-icon-button .mat-mdc-button-ripple,.mat-mdc-icon-button .mat-mdc-button-persistent-ripple,.mat-mdc-icon-button .mat-mdc-button-persistent-ripple::before{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none;border-radius:inherit}.mat-mdc-icon-button .mat-mdc-button-ripple{overflow:hidden}.mat-mdc-icon-button .mat-mdc-button-persistent-ripple::before{content:"";opacity:0}.mat-mdc-icon-button .mdc-button__label,.mat-mdc-icon-button .mat-icon{z-index:1;position:relative}.mat-mdc-icon-button .mat-focus-indicator{top:0;left:0;right:0;bottom:0;position:absolute;border-radius:inherit}.mat-mdc-icon-button:focus>.mat-focus-indicator::before{content:"";border-radius:inherit}.mat-mdc-icon-button .mat-ripple-element{background-color:var(--mat-icon-button-ripple-color, color-mix(in srgb, var(--mat-sys-on-surface-variant) calc(var(--mat-sys-pressed-state-layer-opacity) * 100%), transparent))}.mat-mdc-icon-button .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-icon-button-state-layer-color, var(--mat-sys-on-surface-variant))}.mat-mdc-icon-button.mat-mdc-button-disabled .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-icon-button-disabled-state-layer-color, var(--mat-sys-on-surface-variant))}.mat-mdc-icon-button:hover>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-icon-button-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity))}.mat-mdc-icon-button.cdk-program-focused>.mat-mdc-button-persistent-ripple::before,.mat-mdc-icon-button.cdk-keyboard-focused>.mat-mdc-button-persistent-ripple::before,.mat-mdc-icon-button.mat-mdc-button-disabled-interactive:focus>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-icon-button-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}.mat-mdc-icon-button:active>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-icon-button-pressed-state-layer-opacity, var(--mat-sys-pressed-state-layer-opacity))}.mat-mdc-icon-button .mat-mdc-button-touch-target{position:absolute;top:50%;height:48px;display:var(--mat-icon-button-touch-target-display, block);left:50%;width:48px;transform:translate(-50%, -50%)}.mat-mdc-icon-button._mat-animation-noopable{transition:none !important;animation:none !important}.mat-mdc-icon-button[disabled],.mat-mdc-icon-button.mat-mdc-button-disabled{cursor:default;pointer-events:none;color:var(--mat-icon-button-disabled-icon-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-mdc-icon-button.mat-mdc-button-disabled-interactive{pointer-events:auto}.mat-mdc-icon-button img,.mat-mdc-icon-button svg{width:var(--mat-icon-button-icon-size, 24px);height:var(--mat-icon-button-icon-size, 24px);vertical-align:baseline}.mat-mdc-icon-button .mat-mdc-button-persistent-ripple{border-radius:var(--mat-icon-button-container-shape, var(--mat-sys-corner-full, 50%))}.mat-mdc-icon-button[hidden]{display:none}.mat-mdc-icon-button.mat-unthemed:not(.mdc-ripple-upgraded):focus::before,.mat-mdc-icon-button.mat-primary:not(.mdc-ripple-upgraded):focus::before,.mat-mdc-icon-button.mat-accent:not(.mdc-ripple-upgraded):focus::before,.mat-mdc-icon-button.mat-warn:not(.mdc-ripple-upgraded):focus::before{background:rgba(0,0,0,0);opacity:1}\n', "@media(forced-colors: active){.mat-mdc-button:not(.mdc-button--outlined),.mat-mdc-unelevated-button:not(.mdc-button--outlined),.mat-mdc-raised-button:not(.mdc-button--outlined),.mat-mdc-outlined-button:not(.mdc-button--outlined),.mat-mdc-button-base.mat-tonal-button,.mat-mdc-icon-button.mat-mdc-icon-button,.mat-mdc-outlined-button .mdc-button__ripple{outline:solid 1px}}\n"]
    }]
  }], () => [], null);
})();

// node_modules/@angular/material/fesm2022/button.mjs
var _c015 = ["matButton", ""];
var _c110 = [[["", 8, "material-icons", 3, "iconPositionEnd", ""], ["mat-icon", 3, "iconPositionEnd", ""], ["", "matButtonIcon", "", 3, "iconPositionEnd", ""]], "*", [["", "iconPositionEnd", "", 8, "material-icons"], ["mat-icon", "iconPositionEnd", ""], ["", "matButtonIcon", "", "iconPositionEnd", ""]]];
var _c26 = [".material-icons:not([iconPositionEnd]), mat-icon:not([iconPositionEnd]), [matButtonIcon]:not([iconPositionEnd])", "*", ".material-icons[iconPositionEnd], mat-icon[iconPositionEnd], [matButtonIcon][iconPositionEnd]"];
var _c33 = ["mat-fab", ""];
var _c42 = ["mat-mini-fab", ""];
var _c52 = '.mat-mdc-fab-base{-webkit-user-select:none;user-select:none;position:relative;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:56px;height:56px;padding:0;border:none;fill:currentColor;text-decoration:none;cursor:pointer;-moz-appearance:none;-webkit-appearance:none;overflow:visible;transition:box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1),opacity 15ms linear 30ms,transform 270ms 0ms cubic-bezier(0, 0, 0.2, 1);flex-shrink:0;-webkit-tap-highlight-color:rgba(0,0,0,0)}.mat-mdc-fab-base .mat-mdc-button-ripple,.mat-mdc-fab-base .mat-mdc-button-persistent-ripple,.mat-mdc-fab-base .mat-mdc-button-persistent-ripple::before{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none;border-radius:inherit}.mat-mdc-fab-base .mat-mdc-button-ripple{overflow:hidden}.mat-mdc-fab-base .mat-mdc-button-persistent-ripple::before{content:"";opacity:0}.mat-mdc-fab-base .mdc-button__label,.mat-mdc-fab-base .mat-icon{z-index:1;position:relative}.mat-mdc-fab-base .mat-focus-indicator{top:0;left:0;right:0;bottom:0;position:absolute}.mat-mdc-fab-base:focus>.mat-focus-indicator::before{content:""}.mat-mdc-fab-base._mat-animation-noopable{transition:none !important;animation:none !important}.mat-mdc-fab-base::before{position:absolute;box-sizing:border-box;width:100%;height:100%;top:0;left:0;border:1px solid rgba(0,0,0,0);border-radius:inherit;content:"";pointer-events:none}.mat-mdc-fab-base[hidden]{display:none}.mat-mdc-fab-base::-moz-focus-inner{padding:0;border:0}.mat-mdc-fab-base:active,.mat-mdc-fab-base:focus{outline:none}.mat-mdc-fab-base:hover{cursor:pointer}.mat-mdc-fab-base>svg{width:100%}.mat-mdc-fab-base .mat-icon,.mat-mdc-fab-base .material-icons{transition:transform 180ms 90ms cubic-bezier(0, 0, 0.2, 1);fill:currentColor;will-change:transform}.mat-mdc-fab-base .mat-focus-indicator::before{margin:calc(calc(var(--mat-focus-indicator-border-width, 3px) + 2px)*-1)}.mat-mdc-fab-base[disabled],.mat-mdc-fab-base.mat-mdc-button-disabled{cursor:default;pointer-events:none}.mat-mdc-fab-base[disabled],.mat-mdc-fab-base[disabled]:focus,.mat-mdc-fab-base.mat-mdc-button-disabled,.mat-mdc-fab-base.mat-mdc-button-disabled:focus{box-shadow:none}.mat-mdc-fab-base.mat-mdc-button-disabled-interactive{pointer-events:auto}.mat-mdc-fab{background-color:var(--mat-fab-container-color, var(--mat-sys-primary-container));border-radius:var(--mat-fab-container-shape, var(--mat-sys-corner-large));color:var(--mat-fab-foreground-color, var(--mat-sys-on-primary-container, inherit));box-shadow:var(--mat-fab-container-elevation-shadow, var(--mat-sys-level3))}.mat-mdc-fab:hover{box-shadow:var(--mat-fab-hover-container-elevation-shadow, var(--mat-sys-level4))}.mat-mdc-fab:focus{box-shadow:var(--mat-fab-focus-container-elevation-shadow, var(--mat-sys-level3))}.mat-mdc-fab:active,.mat-mdc-fab:focus:active{box-shadow:var(--mat-fab-pressed-container-elevation-shadow, var(--mat-sys-level3))}.mat-mdc-fab[disabled],.mat-mdc-fab.mat-mdc-button-disabled{cursor:default;pointer-events:none;color:var(--mat-fab-disabled-state-foreground-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));background-color:var(--mat-fab-disabled-state-container-color, color-mix(in srgb, var(--mat-sys-on-surface) 12%, transparent))}.mat-mdc-fab.mat-mdc-button-disabled-interactive{pointer-events:auto}.mat-mdc-fab .mat-mdc-button-touch-target{position:absolute;top:50%;height:48px;display:var(--mat-fab-touch-target-display, block);left:50%;width:48px;transform:translate(-50%, -50%)}.mat-mdc-fab .mat-ripple-element{background-color:var(--mat-fab-ripple-color, color-mix(in srgb, var(--mat-sys-on-primary-container) calc(var(--mat-sys-pressed-state-layer-opacity) * 100%), transparent))}.mat-mdc-fab .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-fab-state-layer-color, var(--mat-sys-on-primary-container))}.mat-mdc-fab.mat-mdc-button-disabled .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-fab-disabled-state-layer-color)}.mat-mdc-fab:hover>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-fab-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity))}.mat-mdc-fab.cdk-program-focused>.mat-mdc-button-persistent-ripple::before,.mat-mdc-fab.cdk-keyboard-focused>.mat-mdc-button-persistent-ripple::before,.mat-mdc-fab.mat-mdc-button-disabled-interactive:focus>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-fab-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}.mat-mdc-fab:active>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-fab-pressed-state-layer-opacity, var(--mat-sys-pressed-state-layer-opacity))}.mat-mdc-mini-fab{width:40px;height:40px;background-color:var(--mat-fab-small-container-color, var(--mat-sys-primary-container));border-radius:var(--mat-fab-small-container-shape, var(--mat-sys-corner-medium));color:var(--mat-fab-small-foreground-color, var(--mat-sys-on-primary-container, inherit));box-shadow:var(--mat-fab-small-container-elevation-shadow, var(--mat-sys-level3))}.mat-mdc-mini-fab:hover{box-shadow:var(--mat-fab-small-hover-container-elevation-shadow, var(--mat-sys-level4))}.mat-mdc-mini-fab:focus{box-shadow:var(--mat-fab-small-focus-container-elevation-shadow, var(--mat-sys-level3))}.mat-mdc-mini-fab:active,.mat-mdc-mini-fab:focus:active{box-shadow:var(--mat-fab-small-pressed-container-elevation-shadow, var(--mat-sys-level3))}.mat-mdc-mini-fab[disabled],.mat-mdc-mini-fab.mat-mdc-button-disabled{cursor:default;pointer-events:none;color:var(--mat-fab-small-disabled-state-foreground-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));background-color:var(--mat-fab-small-disabled-state-container-color, color-mix(in srgb, var(--mat-sys-on-surface) 12%, transparent))}.mat-mdc-mini-fab.mat-mdc-button-disabled-interactive{pointer-events:auto}.mat-mdc-mini-fab .mat-mdc-button-touch-target{position:absolute;top:50%;height:48px;display:var(--mat-fab-small-touch-target-display);left:50%;width:48px;transform:translate(-50%, -50%)}.mat-mdc-mini-fab .mat-ripple-element{background-color:var(--mat-fab-small-ripple-color, color-mix(in srgb, var(--mat-sys-on-primary-container) calc(var(--mat-sys-pressed-state-layer-opacity) * 100%), transparent))}.mat-mdc-mini-fab .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-fab-small-state-layer-color, var(--mat-sys-on-primary-container))}.mat-mdc-mini-fab.mat-mdc-button-disabled .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-fab-small-disabled-state-layer-color)}.mat-mdc-mini-fab:hover>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-fab-small-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity))}.mat-mdc-mini-fab.cdk-program-focused>.mat-mdc-button-persistent-ripple::before,.mat-mdc-mini-fab.cdk-keyboard-focused>.mat-mdc-button-persistent-ripple::before,.mat-mdc-mini-fab.mat-mdc-button-disabled-interactive:focus>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-fab-small-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}.mat-mdc-mini-fab:active>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-fab-small-pressed-state-layer-opacity, var(--mat-sys-pressed-state-layer-opacity))}.mat-mdc-extended-fab{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;padding-left:20px;padding-right:20px;width:auto;max-width:100%;line-height:normal;box-shadow:var(--mat-fab-extended-container-elevation-shadow, var(--mat-sys-level3));height:var(--mat-fab-extended-container-height, 56px);border-radius:var(--mat-fab-extended-container-shape, var(--mat-sys-corner-large));font-family:var(--mat-fab-extended-label-text-font, var(--mat-sys-label-large-font));font-size:var(--mat-fab-extended-label-text-size, var(--mat-sys-label-large-size));font-weight:var(--mat-fab-extended-label-text-weight, var(--mat-sys-label-large-weight));letter-spacing:var(--mat-fab-extended-label-text-tracking, var(--mat-sys-label-large-tracking))}.mat-mdc-extended-fab:hover{box-shadow:var(--mat-fab-extended-hover-container-elevation-shadow, var(--mat-sys-level4))}.mat-mdc-extended-fab:focus{box-shadow:var(--mat-fab-extended-focus-container-elevation-shadow, var(--mat-sys-level3))}.mat-mdc-extended-fab:active,.mat-mdc-extended-fab:focus:active{box-shadow:var(--mat-fab-extended-pressed-container-elevation-shadow, var(--mat-sys-level3))}.mat-mdc-extended-fab[disabled],.mat-mdc-extended-fab.mat-mdc-button-disabled{cursor:default;pointer-events:none}.mat-mdc-extended-fab[disabled],.mat-mdc-extended-fab[disabled]:focus,.mat-mdc-extended-fab.mat-mdc-button-disabled,.mat-mdc-extended-fab.mat-mdc-button-disabled:focus{box-shadow:none}.mat-mdc-extended-fab.mat-mdc-button-disabled-interactive{pointer-events:auto}[dir=rtl] .mat-mdc-extended-fab .mdc-button__label+.mat-icon,[dir=rtl] .mat-mdc-extended-fab .mdc-button__label+.material-icons,.mat-mdc-extended-fab>.mat-icon,.mat-mdc-extended-fab>.material-icons{margin-left:-8px;margin-right:12px}.mat-mdc-extended-fab .mdc-button__label+.mat-icon,.mat-mdc-extended-fab .mdc-button__label+.material-icons,[dir=rtl] .mat-mdc-extended-fab>.mat-icon,[dir=rtl] .mat-mdc-extended-fab>.material-icons{margin-left:12px;margin-right:-8px}.mat-mdc-extended-fab .mat-mdc-button-touch-target{width:100%}\n';
var APPEARANCE_CLASSES = /* @__PURE__ */ new Map([["text", ["mat-mdc-button"]], ["filled", ["mdc-button--unelevated", "mat-mdc-unelevated-button"]], ["elevated", ["mdc-button--raised", "mat-mdc-raised-button"]], ["outlined", ["mdc-button--outlined", "mat-mdc-outlined-button"]], ["tonal", ["mat-tonal-button"]]]);
var MatButton = class _MatButton extends MatButtonBase {
  /** Appearance of the button. */
  get appearance() {
    return this._appearance;
  }
  set appearance(value) {
    this.setAppearance(value || this._config?.defaultAppearance || "text");
  }
  _appearance = null;
  constructor() {
    super();
    const inferredAppearance = _inferAppearance(this._elementRef.nativeElement);
    if (inferredAppearance) {
      this.setAppearance(inferredAppearance);
    }
  }
  /** Programmatically sets the appearance of the button. */
  setAppearance(appearance) {
    if (appearance === this._appearance) {
      return;
    }
    const classList = this._elementRef.nativeElement.classList;
    const previousClasses = this._appearance ? APPEARANCE_CLASSES.get(this._appearance) : null;
    const newClasses = APPEARANCE_CLASSES.get(appearance);
    if ((typeof ngDevMode === "undefined" || ngDevMode) && !newClasses) {
      throw new Error(`Unsupported MatButton appearance "${appearance}"`);
    }
    if (previousClasses) {
      classList.remove(...previousClasses);
    }
    classList.add(...newClasses);
    this._appearance = appearance;
  }
  static \u0275fac = function MatButton_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _MatButton)();
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({
    type: _MatButton,
    selectors: [["button", "matButton", ""], ["a", "matButton", ""], ["button", "mat-button", ""], ["button", "mat-raised-button", ""], ["button", "mat-flat-button", ""], ["button", "mat-stroked-button", ""], ["a", "mat-button", ""], ["a", "mat-raised-button", ""], ["a", "mat-flat-button", ""], ["a", "mat-stroked-button", ""]],
    hostAttrs: [1, "mdc-button"],
    inputs: {
      appearance: [0, "matButton", "appearance"]
    },
    exportAs: ["matButton", "matAnchor"],
    features: [\u0275\u0275InheritDefinitionFeature],
    attrs: _c015,
    ngContentSelectors: _c26,
    decls: 7,
    vars: 4,
    consts: [[1, "mat-mdc-button-persistent-ripple"], [1, "mdc-button__label"], [1, "mat-focus-indicator"], [1, "mat-mdc-button-touch-target"]],
    template: function MatButton_Template(rf, ctx) {
      if (rf & 1) {
        \u0275\u0275projectionDef(_c110);
        \u0275\u0275domElement(0, "span", 0);
        \u0275\u0275projection(1);
        \u0275\u0275domElementStart(2, "span", 1);
        \u0275\u0275projection(3, 1);
        \u0275\u0275domElementEnd();
        \u0275\u0275projection(4, 2);
        \u0275\u0275domElement(5, "span", 2)(6, "span", 3);
      }
      if (rf & 2) {
        \u0275\u0275classProp("mdc-button__ripple", !ctx._isFab)("mdc-fab__ripple", ctx._isFab);
      }
    },
    styles: ['.mat-mdc-button-base{text-decoration:none}.mat-mdc-button-base .mat-icon{min-height:fit-content;flex-shrink:0}.mdc-button{-webkit-user-select:none;user-select:none;position:relative;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;min-width:64px;border:none;outline:none;line-height:inherit;-webkit-appearance:none;overflow:visible;vertical-align:middle;background:rgba(0,0,0,0);padding:0 8px}.mdc-button::-moz-focus-inner{padding:0;border:0}.mdc-button:active{outline:none}.mdc-button:hover{cursor:pointer}.mdc-button:disabled{cursor:default;pointer-events:none}.mdc-button[hidden]{display:none}.mdc-button .mdc-button__label{position:relative}.mat-mdc-button{padding:0 var(--mat-button-text-horizontal-padding, 12px);height:var(--mat-button-text-container-height, 40px);font-family:var(--mat-button-text-label-text-font, var(--mat-sys-label-large-font));font-size:var(--mat-button-text-label-text-size, var(--mat-sys-label-large-size));letter-spacing:var(--mat-button-text-label-text-tracking, var(--mat-sys-label-large-tracking));text-transform:var(--mat-button-text-label-text-transform);font-weight:var(--mat-button-text-label-text-weight, var(--mat-sys-label-large-weight))}.mat-mdc-button,.mat-mdc-button .mdc-button__ripple{border-radius:var(--mat-button-text-container-shape, var(--mat-sys-corner-full))}.mat-mdc-button:not(:disabled){color:var(--mat-button-text-label-text-color, var(--mat-sys-primary))}.mat-mdc-button[disabled],.mat-mdc-button.mat-mdc-button-disabled{cursor:default;pointer-events:none;color:var(--mat-button-text-disabled-label-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-mdc-button.mat-mdc-button-disabled-interactive{pointer-events:auto}.mat-mdc-button:has(.material-icons,mat-icon,[matButtonIcon]){padding:0 var(--mat-button-text-with-icon-horizontal-padding, 16px)}.mat-mdc-button>.mat-icon{margin-right:var(--mat-button-text-icon-spacing, 8px);margin-left:var(--mat-button-text-icon-offset, -4px)}[dir=rtl] .mat-mdc-button>.mat-icon{margin-right:var(--mat-button-text-icon-offset, -4px);margin-left:var(--mat-button-text-icon-spacing, 8px)}.mat-mdc-button .mdc-button__label+.mat-icon{margin-right:var(--mat-button-text-icon-offset, -4px);margin-left:var(--mat-button-text-icon-spacing, 8px)}[dir=rtl] .mat-mdc-button .mdc-button__label+.mat-icon{margin-right:var(--mat-button-text-icon-spacing, 8px);margin-left:var(--mat-button-text-icon-offset, -4px)}.mat-mdc-button .mat-ripple-element{background-color:var(--mat-button-text-ripple-color, color-mix(in srgb, var(--mat-sys-primary) calc(var(--mat-sys-pressed-state-layer-opacity) * 100%), transparent))}.mat-mdc-button .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-button-text-state-layer-color, var(--mat-sys-primary))}.mat-mdc-button.mat-mdc-button-disabled .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-button-text-disabled-state-layer-color, var(--mat-sys-on-surface-variant))}.mat-mdc-button:hover>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-button-text-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity))}.mat-mdc-button.cdk-program-focused>.mat-mdc-button-persistent-ripple::before,.mat-mdc-button.cdk-keyboard-focused>.mat-mdc-button-persistent-ripple::before,.mat-mdc-button.mat-mdc-button-disabled-interactive:focus>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-button-text-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}.mat-mdc-button:active>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-button-text-pressed-state-layer-opacity, var(--mat-sys-pressed-state-layer-opacity))}.mat-mdc-button .mat-mdc-button-touch-target{position:absolute;top:50%;height:48px;display:var(--mat-button-text-touch-target-display, block);left:0;right:0;transform:translateY(-50%)}.mat-mdc-unelevated-button{transition:box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1);height:var(--mat-button-filled-container-height, 40px);font-family:var(--mat-button-filled-label-text-font, var(--mat-sys-label-large-font));font-size:var(--mat-button-filled-label-text-size, var(--mat-sys-label-large-size));letter-spacing:var(--mat-button-filled-label-text-tracking, var(--mat-sys-label-large-tracking));text-transform:var(--mat-button-filled-label-text-transform);font-weight:var(--mat-button-filled-label-text-weight, var(--mat-sys-label-large-weight));padding:0 var(--mat-button-filled-horizontal-padding, 24px)}.mat-mdc-unelevated-button>.mat-icon{margin-right:var(--mat-button-filled-icon-spacing, 8px);margin-left:var(--mat-button-filled-icon-offset, -8px)}[dir=rtl] .mat-mdc-unelevated-button>.mat-icon{margin-right:var(--mat-button-filled-icon-offset, -8px);margin-left:var(--mat-button-filled-icon-spacing, 8px)}.mat-mdc-unelevated-button .mdc-button__label+.mat-icon{margin-right:var(--mat-button-filled-icon-offset, -8px);margin-left:var(--mat-button-filled-icon-spacing, 8px)}[dir=rtl] .mat-mdc-unelevated-button .mdc-button__label+.mat-icon{margin-right:var(--mat-button-filled-icon-spacing, 8px);margin-left:var(--mat-button-filled-icon-offset, -8px)}.mat-mdc-unelevated-button .mat-ripple-element{background-color:var(--mat-button-filled-ripple-color, color-mix(in srgb, var(--mat-sys-on-primary) calc(var(--mat-sys-pressed-state-layer-opacity) * 100%), transparent))}.mat-mdc-unelevated-button .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-button-filled-state-layer-color, var(--mat-sys-on-primary))}.mat-mdc-unelevated-button.mat-mdc-button-disabled .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-button-filled-disabled-state-layer-color, var(--mat-sys-on-surface-variant))}.mat-mdc-unelevated-button:hover>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-button-filled-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity))}.mat-mdc-unelevated-button.cdk-program-focused>.mat-mdc-button-persistent-ripple::before,.mat-mdc-unelevated-button.cdk-keyboard-focused>.mat-mdc-button-persistent-ripple::before,.mat-mdc-unelevated-button.mat-mdc-button-disabled-interactive:focus>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-button-filled-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}.mat-mdc-unelevated-button:active>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-button-filled-pressed-state-layer-opacity, var(--mat-sys-pressed-state-layer-opacity))}.mat-mdc-unelevated-button .mat-mdc-button-touch-target{position:absolute;top:50%;height:48px;display:var(--mat-button-filled-touch-target-display, block);left:0;right:0;transform:translateY(-50%)}.mat-mdc-unelevated-button:not(:disabled){color:var(--mat-button-filled-label-text-color, var(--mat-sys-on-primary));background-color:var(--mat-button-filled-container-color, var(--mat-sys-primary))}.mat-mdc-unelevated-button,.mat-mdc-unelevated-button .mdc-button__ripple{border-radius:var(--mat-button-filled-container-shape, var(--mat-sys-corner-full))}.mat-mdc-unelevated-button[disabled],.mat-mdc-unelevated-button.mat-mdc-button-disabled{cursor:default;pointer-events:none;color:var(--mat-button-filled-disabled-label-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));background-color:var(--mat-button-filled-disabled-container-color, color-mix(in srgb, var(--mat-sys-on-surface) 12%, transparent))}.mat-mdc-unelevated-button.mat-mdc-button-disabled-interactive{pointer-events:auto}.mat-mdc-raised-button{transition:box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1);box-shadow:var(--mat-button-protected-container-elevation-shadow, var(--mat-sys-level1));height:var(--mat-button-protected-container-height, 40px);font-family:var(--mat-button-protected-label-text-font, var(--mat-sys-label-large-font));font-size:var(--mat-button-protected-label-text-size, var(--mat-sys-label-large-size));letter-spacing:var(--mat-button-protected-label-text-tracking, var(--mat-sys-label-large-tracking));text-transform:var(--mat-button-protected-label-text-transform);font-weight:var(--mat-button-protected-label-text-weight, var(--mat-sys-label-large-weight));padding:0 var(--mat-button-protected-horizontal-padding, 24px)}.mat-mdc-raised-button>.mat-icon{margin-right:var(--mat-button-protected-icon-spacing, 8px);margin-left:var(--mat-button-protected-icon-offset, -8px)}[dir=rtl] .mat-mdc-raised-button>.mat-icon{margin-right:var(--mat-button-protected-icon-offset, -8px);margin-left:var(--mat-button-protected-icon-spacing, 8px)}.mat-mdc-raised-button .mdc-button__label+.mat-icon{margin-right:var(--mat-button-protected-icon-offset, -8px);margin-left:var(--mat-button-protected-icon-spacing, 8px)}[dir=rtl] .mat-mdc-raised-button .mdc-button__label+.mat-icon{margin-right:var(--mat-button-protected-icon-spacing, 8px);margin-left:var(--mat-button-protected-icon-offset, -8px)}.mat-mdc-raised-button .mat-ripple-element{background-color:var(--mat-button-protected-ripple-color, color-mix(in srgb, var(--mat-sys-primary) calc(var(--mat-sys-pressed-state-layer-opacity) * 100%), transparent))}.mat-mdc-raised-button .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-button-protected-state-layer-color, var(--mat-sys-primary))}.mat-mdc-raised-button.mat-mdc-button-disabled .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-button-protected-disabled-state-layer-color, var(--mat-sys-on-surface-variant))}.mat-mdc-raised-button:hover>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-button-protected-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity))}.mat-mdc-raised-button.cdk-program-focused>.mat-mdc-button-persistent-ripple::before,.mat-mdc-raised-button.cdk-keyboard-focused>.mat-mdc-button-persistent-ripple::before,.mat-mdc-raised-button.mat-mdc-button-disabled-interactive:focus>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-button-protected-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}.mat-mdc-raised-button:active>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-button-protected-pressed-state-layer-opacity, var(--mat-sys-pressed-state-layer-opacity))}.mat-mdc-raised-button .mat-mdc-button-touch-target{position:absolute;top:50%;height:48px;display:var(--mat-button-protected-touch-target-display, block);left:0;right:0;transform:translateY(-50%)}.mat-mdc-raised-button:not(:disabled){color:var(--mat-button-protected-label-text-color, var(--mat-sys-primary));background-color:var(--mat-button-protected-container-color, var(--mat-sys-surface))}.mat-mdc-raised-button,.mat-mdc-raised-button .mdc-button__ripple{border-radius:var(--mat-button-protected-container-shape, var(--mat-sys-corner-full))}.mat-mdc-raised-button:hover{box-shadow:var(--mat-button-protected-hover-container-elevation-shadow, var(--mat-sys-level2))}.mat-mdc-raised-button:focus{box-shadow:var(--mat-button-protected-focus-container-elevation-shadow, var(--mat-sys-level1))}.mat-mdc-raised-button:active,.mat-mdc-raised-button:focus:active{box-shadow:var(--mat-button-protected-pressed-container-elevation-shadow, var(--mat-sys-level1))}.mat-mdc-raised-button[disabled],.mat-mdc-raised-button.mat-mdc-button-disabled{cursor:default;pointer-events:none;color:var(--mat-button-protected-disabled-label-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));background-color:var(--mat-button-protected-disabled-container-color, color-mix(in srgb, var(--mat-sys-on-surface) 12%, transparent))}.mat-mdc-raised-button[disabled].mat-mdc-button-disabled,.mat-mdc-raised-button.mat-mdc-button-disabled.mat-mdc-button-disabled{box-shadow:var(--mat-button-protected-disabled-container-elevation-shadow, var(--mat-sys-level0))}.mat-mdc-raised-button.mat-mdc-button-disabled-interactive{pointer-events:auto}.mat-mdc-outlined-button{border-style:solid;transition:border 280ms cubic-bezier(0.4, 0, 0.2, 1);height:var(--mat-button-outlined-container-height, 40px);font-family:var(--mat-button-outlined-label-text-font, var(--mat-sys-label-large-font));font-size:var(--mat-button-outlined-label-text-size, var(--mat-sys-label-large-size));letter-spacing:var(--mat-button-outlined-label-text-tracking, var(--mat-sys-label-large-tracking));text-transform:var(--mat-button-outlined-label-text-transform);font-weight:var(--mat-button-outlined-label-text-weight, var(--mat-sys-label-large-weight));border-radius:var(--mat-button-outlined-container-shape, var(--mat-sys-corner-full));border-width:var(--mat-button-outlined-outline-width, 1px);padding:0 var(--mat-button-outlined-horizontal-padding, 24px)}.mat-mdc-outlined-button>.mat-icon{margin-right:var(--mat-button-outlined-icon-spacing, 8px);margin-left:var(--mat-button-outlined-icon-offset, -8px)}[dir=rtl] .mat-mdc-outlined-button>.mat-icon{margin-right:var(--mat-button-outlined-icon-offset, -8px);margin-left:var(--mat-button-outlined-icon-spacing, 8px)}.mat-mdc-outlined-button .mdc-button__label+.mat-icon{margin-right:var(--mat-button-outlined-icon-offset, -8px);margin-left:var(--mat-button-outlined-icon-spacing, 8px)}[dir=rtl] .mat-mdc-outlined-button .mdc-button__label+.mat-icon{margin-right:var(--mat-button-outlined-icon-spacing, 8px);margin-left:var(--mat-button-outlined-icon-offset, -8px)}.mat-mdc-outlined-button .mat-ripple-element{background-color:var(--mat-button-outlined-ripple-color, color-mix(in srgb, var(--mat-sys-primary) calc(var(--mat-sys-pressed-state-layer-opacity) * 100%), transparent))}.mat-mdc-outlined-button .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-button-outlined-state-layer-color, var(--mat-sys-primary))}.mat-mdc-outlined-button.mat-mdc-button-disabled .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-button-outlined-disabled-state-layer-color, var(--mat-sys-on-surface-variant))}.mat-mdc-outlined-button:hover>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-button-outlined-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity))}.mat-mdc-outlined-button.cdk-program-focused>.mat-mdc-button-persistent-ripple::before,.mat-mdc-outlined-button.cdk-keyboard-focused>.mat-mdc-button-persistent-ripple::before,.mat-mdc-outlined-button.mat-mdc-button-disabled-interactive:focus>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-button-outlined-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}.mat-mdc-outlined-button:active>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-button-outlined-pressed-state-layer-opacity, var(--mat-sys-pressed-state-layer-opacity))}.mat-mdc-outlined-button .mat-mdc-button-touch-target{position:absolute;top:50%;height:48px;display:var(--mat-button-outlined-touch-target-display, block);left:0;right:0;transform:translateY(-50%)}.mat-mdc-outlined-button:not(:disabled){color:var(--mat-button-outlined-label-text-color, var(--mat-sys-primary));border-color:var(--mat-button-outlined-outline-color, var(--mat-sys-outline))}.mat-mdc-outlined-button[disabled],.mat-mdc-outlined-button.mat-mdc-button-disabled{cursor:default;pointer-events:none;color:var(--mat-button-outlined-disabled-label-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));border-color:var(--mat-button-outlined-disabled-outline-color, color-mix(in srgb, var(--mat-sys-on-surface) 12%, transparent))}.mat-mdc-outlined-button.mat-mdc-button-disabled-interactive{pointer-events:auto}.mat-tonal-button{transition:box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1);height:var(--mat-button-tonal-container-height, 40px);font-family:var(--mat-button-tonal-label-text-font, var(--mat-sys-label-large-font));font-size:var(--mat-button-tonal-label-text-size, var(--mat-sys-label-large-size));letter-spacing:var(--mat-button-tonal-label-text-tracking, var(--mat-sys-label-large-tracking));text-transform:var(--mat-button-tonal-label-text-transform);font-weight:var(--mat-button-tonal-label-text-weight, var(--mat-sys-label-large-weight));padding:0 var(--mat-button-tonal-horizontal-padding, 24px)}.mat-tonal-button:not(:disabled){color:var(--mat-button-tonal-label-text-color, var(--mat-sys-on-secondary-container));background-color:var(--mat-button-tonal-container-color, var(--mat-sys-secondary-container))}.mat-tonal-button,.mat-tonal-button .mdc-button__ripple{border-radius:var(--mat-button-tonal-container-shape, var(--mat-sys-corner-full))}.mat-tonal-button[disabled],.mat-tonal-button.mat-mdc-button-disabled{cursor:default;pointer-events:none;color:var(--mat-button-tonal-disabled-label-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));background-color:var(--mat-button-tonal-disabled-container-color, color-mix(in srgb, var(--mat-sys-on-surface) 12%, transparent))}.mat-tonal-button.mat-mdc-button-disabled-interactive{pointer-events:auto}.mat-tonal-button>.mat-icon{margin-right:var(--mat-button-tonal-icon-spacing, 8px);margin-left:var(--mat-button-tonal-icon-offset, -8px)}[dir=rtl] .mat-tonal-button>.mat-icon{margin-right:var(--mat-button-tonal-icon-offset, -8px);margin-left:var(--mat-button-tonal-icon-spacing, 8px)}.mat-tonal-button .mdc-button__label+.mat-icon{margin-right:var(--mat-button-tonal-icon-offset, -8px);margin-left:var(--mat-button-tonal-icon-spacing, 8px)}[dir=rtl] .mat-tonal-button .mdc-button__label+.mat-icon{margin-right:var(--mat-button-tonal-icon-spacing, 8px);margin-left:var(--mat-button-tonal-icon-offset, -8px)}.mat-tonal-button .mat-ripple-element{background-color:var(--mat-button-tonal-ripple-color, color-mix(in srgb, var(--mat-sys-on-secondary-container) calc(var(--mat-sys-pressed-state-layer-opacity) * 100%), transparent))}.mat-tonal-button .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-button-tonal-state-layer-color, var(--mat-sys-on-secondary-container))}.mat-tonal-button.mat-mdc-button-disabled .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-button-tonal-disabled-state-layer-color, var(--mat-sys-on-surface-variant))}.mat-tonal-button:hover>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-button-tonal-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity))}.mat-tonal-button.cdk-program-focused>.mat-mdc-button-persistent-ripple::before,.mat-tonal-button.cdk-keyboard-focused>.mat-mdc-button-persistent-ripple::before,.mat-tonal-button.mat-mdc-button-disabled-interactive:focus>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-button-tonal-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}.mat-tonal-button:active>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-button-tonal-pressed-state-layer-opacity, var(--mat-sys-pressed-state-layer-opacity))}.mat-tonal-button .mat-mdc-button-touch-target{position:absolute;top:50%;height:48px;display:var(--mat-button-tonal-touch-target-display, block);left:0;right:0;transform:translateY(-50%)}.mat-mdc-button,.mat-mdc-unelevated-button,.mat-mdc-raised-button,.mat-mdc-outlined-button,.mat-tonal-button{-webkit-tap-highlight-color:rgba(0,0,0,0)}.mat-mdc-button .mat-mdc-button-ripple,.mat-mdc-button .mat-mdc-button-persistent-ripple,.mat-mdc-button .mat-mdc-button-persistent-ripple::before,.mat-mdc-unelevated-button .mat-mdc-button-ripple,.mat-mdc-unelevated-button .mat-mdc-button-persistent-ripple,.mat-mdc-unelevated-button .mat-mdc-button-persistent-ripple::before,.mat-mdc-raised-button .mat-mdc-button-ripple,.mat-mdc-raised-button .mat-mdc-button-persistent-ripple,.mat-mdc-raised-button .mat-mdc-button-persistent-ripple::before,.mat-mdc-outlined-button .mat-mdc-button-ripple,.mat-mdc-outlined-button .mat-mdc-button-persistent-ripple,.mat-mdc-outlined-button .mat-mdc-button-persistent-ripple::before,.mat-tonal-button .mat-mdc-button-ripple,.mat-tonal-button .mat-mdc-button-persistent-ripple,.mat-tonal-button .mat-mdc-button-persistent-ripple::before{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none;border-radius:inherit}.mat-mdc-button .mat-mdc-button-ripple,.mat-mdc-unelevated-button .mat-mdc-button-ripple,.mat-mdc-raised-button .mat-mdc-button-ripple,.mat-mdc-outlined-button .mat-mdc-button-ripple,.mat-tonal-button .mat-mdc-button-ripple{overflow:hidden}.mat-mdc-button .mat-mdc-button-persistent-ripple::before,.mat-mdc-unelevated-button .mat-mdc-button-persistent-ripple::before,.mat-mdc-raised-button .mat-mdc-button-persistent-ripple::before,.mat-mdc-outlined-button .mat-mdc-button-persistent-ripple::before,.mat-tonal-button .mat-mdc-button-persistent-ripple::before{content:"";opacity:0}.mat-mdc-button .mdc-button__label,.mat-mdc-button .mat-icon,.mat-mdc-unelevated-button .mdc-button__label,.mat-mdc-unelevated-button .mat-icon,.mat-mdc-raised-button .mdc-button__label,.mat-mdc-raised-button .mat-icon,.mat-mdc-outlined-button .mdc-button__label,.mat-mdc-outlined-button .mat-icon,.mat-tonal-button .mdc-button__label,.mat-tonal-button .mat-icon{z-index:1;position:relative}.mat-mdc-button .mat-focus-indicator,.mat-mdc-unelevated-button .mat-focus-indicator,.mat-mdc-raised-button .mat-focus-indicator,.mat-mdc-outlined-button .mat-focus-indicator,.mat-tonal-button .mat-focus-indicator{top:0;left:0;right:0;bottom:0;position:absolute;border-radius:inherit}.mat-mdc-button:focus>.mat-focus-indicator::before,.mat-mdc-unelevated-button:focus>.mat-focus-indicator::before,.mat-mdc-raised-button:focus>.mat-focus-indicator::before,.mat-mdc-outlined-button:focus>.mat-focus-indicator::before,.mat-tonal-button:focus>.mat-focus-indicator::before{content:"";border-radius:inherit}.mat-mdc-button._mat-animation-noopable,.mat-mdc-unelevated-button._mat-animation-noopable,.mat-mdc-raised-button._mat-animation-noopable,.mat-mdc-outlined-button._mat-animation-noopable,.mat-tonal-button._mat-animation-noopable{transition:none !important;animation:none !important}.mat-mdc-button>.mat-icon,.mat-mdc-unelevated-button>.mat-icon,.mat-mdc-raised-button>.mat-icon,.mat-mdc-outlined-button>.mat-icon,.mat-tonal-button>.mat-icon{display:inline-block;position:relative;vertical-align:top;font-size:1.125rem;height:1.125rem;width:1.125rem}.mat-mdc-outlined-button .mat-mdc-button-ripple,.mat-mdc-outlined-button .mdc-button__ripple{top:-1px;left:-1px;bottom:-1px;right:-1px}.mat-mdc-unelevated-button .mat-focus-indicator::before,.mat-tonal-button .mat-focus-indicator::before,.mat-mdc-raised-button .mat-focus-indicator::before{margin:calc(calc(var(--mat-focus-indicator-border-width, 3px) + 2px)*-1)}.mat-mdc-outlined-button .mat-focus-indicator::before{margin:calc(calc(var(--mat-focus-indicator-border-width, 3px) + 3px)*-1)}\n', "@media(forced-colors: active){.mat-mdc-button:not(.mdc-button--outlined),.mat-mdc-unelevated-button:not(.mdc-button--outlined),.mat-mdc-raised-button:not(.mdc-button--outlined),.mat-mdc-outlined-button:not(.mdc-button--outlined),.mat-mdc-button-base.mat-tonal-button,.mat-mdc-icon-button.mat-mdc-icon-button,.mat-mdc-outlined-button .mdc-button__ripple{outline:solid 1px}}\n"],
    encapsulation: 2,
    changeDetection: 0
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatButton, [{
    type: Component,
    args: [{
      selector: `
    button[matButton], a[matButton], button[mat-button], button[mat-raised-button],
    button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button],
    a[mat-flat-button], a[mat-stroked-button]
  `,
      host: {
        "class": "mdc-button"
      },
      exportAs: "matButton, matAnchor",
      encapsulation: ViewEncapsulation.None,
      changeDetection: ChangeDetectionStrategy.OnPush,
      template: `<span
    class="mat-mdc-button-persistent-ripple"
    [class.mdc-button__ripple]="!_isFab"
    [class.mdc-fab__ripple]="_isFab"></span>

<ng-content select=".material-icons:not([iconPositionEnd]), mat-icon:not([iconPositionEnd]), [matButtonIcon]:not([iconPositionEnd])">
</ng-content>

<span class="mdc-button__label"><ng-content></ng-content></span>

<ng-content select=".material-icons[iconPositionEnd], mat-icon[iconPositionEnd], [matButtonIcon][iconPositionEnd]">
</ng-content>

<!--
  The indicator can't be directly on the button, because MDC uses ::before for high contrast
  indication and it can't be on the ripple, because it has a border radius and overflow: hidden.
-->
<span class="mat-focus-indicator"></span>

<span class="mat-mdc-button-touch-target"></span>
`,
      styles: ['.mat-mdc-button-base{text-decoration:none}.mat-mdc-button-base .mat-icon{min-height:fit-content;flex-shrink:0}.mdc-button{-webkit-user-select:none;user-select:none;position:relative;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;min-width:64px;border:none;outline:none;line-height:inherit;-webkit-appearance:none;overflow:visible;vertical-align:middle;background:rgba(0,0,0,0);padding:0 8px}.mdc-button::-moz-focus-inner{padding:0;border:0}.mdc-button:active{outline:none}.mdc-button:hover{cursor:pointer}.mdc-button:disabled{cursor:default;pointer-events:none}.mdc-button[hidden]{display:none}.mdc-button .mdc-button__label{position:relative}.mat-mdc-button{padding:0 var(--mat-button-text-horizontal-padding, 12px);height:var(--mat-button-text-container-height, 40px);font-family:var(--mat-button-text-label-text-font, var(--mat-sys-label-large-font));font-size:var(--mat-button-text-label-text-size, var(--mat-sys-label-large-size));letter-spacing:var(--mat-button-text-label-text-tracking, var(--mat-sys-label-large-tracking));text-transform:var(--mat-button-text-label-text-transform);font-weight:var(--mat-button-text-label-text-weight, var(--mat-sys-label-large-weight))}.mat-mdc-button,.mat-mdc-button .mdc-button__ripple{border-radius:var(--mat-button-text-container-shape, var(--mat-sys-corner-full))}.mat-mdc-button:not(:disabled){color:var(--mat-button-text-label-text-color, var(--mat-sys-primary))}.mat-mdc-button[disabled],.mat-mdc-button.mat-mdc-button-disabled{cursor:default;pointer-events:none;color:var(--mat-button-text-disabled-label-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-mdc-button.mat-mdc-button-disabled-interactive{pointer-events:auto}.mat-mdc-button:has(.material-icons,mat-icon,[matButtonIcon]){padding:0 var(--mat-button-text-with-icon-horizontal-padding, 16px)}.mat-mdc-button>.mat-icon{margin-right:var(--mat-button-text-icon-spacing, 8px);margin-left:var(--mat-button-text-icon-offset, -4px)}[dir=rtl] .mat-mdc-button>.mat-icon{margin-right:var(--mat-button-text-icon-offset, -4px);margin-left:var(--mat-button-text-icon-spacing, 8px)}.mat-mdc-button .mdc-button__label+.mat-icon{margin-right:var(--mat-button-text-icon-offset, -4px);margin-left:var(--mat-button-text-icon-spacing, 8px)}[dir=rtl] .mat-mdc-button .mdc-button__label+.mat-icon{margin-right:var(--mat-button-text-icon-spacing, 8px);margin-left:var(--mat-button-text-icon-offset, -4px)}.mat-mdc-button .mat-ripple-element{background-color:var(--mat-button-text-ripple-color, color-mix(in srgb, var(--mat-sys-primary) calc(var(--mat-sys-pressed-state-layer-opacity) * 100%), transparent))}.mat-mdc-button .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-button-text-state-layer-color, var(--mat-sys-primary))}.mat-mdc-button.mat-mdc-button-disabled .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-button-text-disabled-state-layer-color, var(--mat-sys-on-surface-variant))}.mat-mdc-button:hover>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-button-text-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity))}.mat-mdc-button.cdk-program-focused>.mat-mdc-button-persistent-ripple::before,.mat-mdc-button.cdk-keyboard-focused>.mat-mdc-button-persistent-ripple::before,.mat-mdc-button.mat-mdc-button-disabled-interactive:focus>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-button-text-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}.mat-mdc-button:active>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-button-text-pressed-state-layer-opacity, var(--mat-sys-pressed-state-layer-opacity))}.mat-mdc-button .mat-mdc-button-touch-target{position:absolute;top:50%;height:48px;display:var(--mat-button-text-touch-target-display, block);left:0;right:0;transform:translateY(-50%)}.mat-mdc-unelevated-button{transition:box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1);height:var(--mat-button-filled-container-height, 40px);font-family:var(--mat-button-filled-label-text-font, var(--mat-sys-label-large-font));font-size:var(--mat-button-filled-label-text-size, var(--mat-sys-label-large-size));letter-spacing:var(--mat-button-filled-label-text-tracking, var(--mat-sys-label-large-tracking));text-transform:var(--mat-button-filled-label-text-transform);font-weight:var(--mat-button-filled-label-text-weight, var(--mat-sys-label-large-weight));padding:0 var(--mat-button-filled-horizontal-padding, 24px)}.mat-mdc-unelevated-button>.mat-icon{margin-right:var(--mat-button-filled-icon-spacing, 8px);margin-left:var(--mat-button-filled-icon-offset, -8px)}[dir=rtl] .mat-mdc-unelevated-button>.mat-icon{margin-right:var(--mat-button-filled-icon-offset, -8px);margin-left:var(--mat-button-filled-icon-spacing, 8px)}.mat-mdc-unelevated-button .mdc-button__label+.mat-icon{margin-right:var(--mat-button-filled-icon-offset, -8px);margin-left:var(--mat-button-filled-icon-spacing, 8px)}[dir=rtl] .mat-mdc-unelevated-button .mdc-button__label+.mat-icon{margin-right:var(--mat-button-filled-icon-spacing, 8px);margin-left:var(--mat-button-filled-icon-offset, -8px)}.mat-mdc-unelevated-button .mat-ripple-element{background-color:var(--mat-button-filled-ripple-color, color-mix(in srgb, var(--mat-sys-on-primary) calc(var(--mat-sys-pressed-state-layer-opacity) * 100%), transparent))}.mat-mdc-unelevated-button .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-button-filled-state-layer-color, var(--mat-sys-on-primary))}.mat-mdc-unelevated-button.mat-mdc-button-disabled .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-button-filled-disabled-state-layer-color, var(--mat-sys-on-surface-variant))}.mat-mdc-unelevated-button:hover>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-button-filled-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity))}.mat-mdc-unelevated-button.cdk-program-focused>.mat-mdc-button-persistent-ripple::before,.mat-mdc-unelevated-button.cdk-keyboard-focused>.mat-mdc-button-persistent-ripple::before,.mat-mdc-unelevated-button.mat-mdc-button-disabled-interactive:focus>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-button-filled-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}.mat-mdc-unelevated-button:active>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-button-filled-pressed-state-layer-opacity, var(--mat-sys-pressed-state-layer-opacity))}.mat-mdc-unelevated-button .mat-mdc-button-touch-target{position:absolute;top:50%;height:48px;display:var(--mat-button-filled-touch-target-display, block);left:0;right:0;transform:translateY(-50%)}.mat-mdc-unelevated-button:not(:disabled){color:var(--mat-button-filled-label-text-color, var(--mat-sys-on-primary));background-color:var(--mat-button-filled-container-color, var(--mat-sys-primary))}.mat-mdc-unelevated-button,.mat-mdc-unelevated-button .mdc-button__ripple{border-radius:var(--mat-button-filled-container-shape, var(--mat-sys-corner-full))}.mat-mdc-unelevated-button[disabled],.mat-mdc-unelevated-button.mat-mdc-button-disabled{cursor:default;pointer-events:none;color:var(--mat-button-filled-disabled-label-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));background-color:var(--mat-button-filled-disabled-container-color, color-mix(in srgb, var(--mat-sys-on-surface) 12%, transparent))}.mat-mdc-unelevated-button.mat-mdc-button-disabled-interactive{pointer-events:auto}.mat-mdc-raised-button{transition:box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1);box-shadow:var(--mat-button-protected-container-elevation-shadow, var(--mat-sys-level1));height:var(--mat-button-protected-container-height, 40px);font-family:var(--mat-button-protected-label-text-font, var(--mat-sys-label-large-font));font-size:var(--mat-button-protected-label-text-size, var(--mat-sys-label-large-size));letter-spacing:var(--mat-button-protected-label-text-tracking, var(--mat-sys-label-large-tracking));text-transform:var(--mat-button-protected-label-text-transform);font-weight:var(--mat-button-protected-label-text-weight, var(--mat-sys-label-large-weight));padding:0 var(--mat-button-protected-horizontal-padding, 24px)}.mat-mdc-raised-button>.mat-icon{margin-right:var(--mat-button-protected-icon-spacing, 8px);margin-left:var(--mat-button-protected-icon-offset, -8px)}[dir=rtl] .mat-mdc-raised-button>.mat-icon{margin-right:var(--mat-button-protected-icon-offset, -8px);margin-left:var(--mat-button-protected-icon-spacing, 8px)}.mat-mdc-raised-button .mdc-button__label+.mat-icon{margin-right:var(--mat-button-protected-icon-offset, -8px);margin-left:var(--mat-button-protected-icon-spacing, 8px)}[dir=rtl] .mat-mdc-raised-button .mdc-button__label+.mat-icon{margin-right:var(--mat-button-protected-icon-spacing, 8px);margin-left:var(--mat-button-protected-icon-offset, -8px)}.mat-mdc-raised-button .mat-ripple-element{background-color:var(--mat-button-protected-ripple-color, color-mix(in srgb, var(--mat-sys-primary) calc(var(--mat-sys-pressed-state-layer-opacity) * 100%), transparent))}.mat-mdc-raised-button .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-button-protected-state-layer-color, var(--mat-sys-primary))}.mat-mdc-raised-button.mat-mdc-button-disabled .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-button-protected-disabled-state-layer-color, var(--mat-sys-on-surface-variant))}.mat-mdc-raised-button:hover>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-button-protected-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity))}.mat-mdc-raised-button.cdk-program-focused>.mat-mdc-button-persistent-ripple::before,.mat-mdc-raised-button.cdk-keyboard-focused>.mat-mdc-button-persistent-ripple::before,.mat-mdc-raised-button.mat-mdc-button-disabled-interactive:focus>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-button-protected-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}.mat-mdc-raised-button:active>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-button-protected-pressed-state-layer-opacity, var(--mat-sys-pressed-state-layer-opacity))}.mat-mdc-raised-button .mat-mdc-button-touch-target{position:absolute;top:50%;height:48px;display:var(--mat-button-protected-touch-target-display, block);left:0;right:0;transform:translateY(-50%)}.mat-mdc-raised-button:not(:disabled){color:var(--mat-button-protected-label-text-color, var(--mat-sys-primary));background-color:var(--mat-button-protected-container-color, var(--mat-sys-surface))}.mat-mdc-raised-button,.mat-mdc-raised-button .mdc-button__ripple{border-radius:var(--mat-button-protected-container-shape, var(--mat-sys-corner-full))}.mat-mdc-raised-button:hover{box-shadow:var(--mat-button-protected-hover-container-elevation-shadow, var(--mat-sys-level2))}.mat-mdc-raised-button:focus{box-shadow:var(--mat-button-protected-focus-container-elevation-shadow, var(--mat-sys-level1))}.mat-mdc-raised-button:active,.mat-mdc-raised-button:focus:active{box-shadow:var(--mat-button-protected-pressed-container-elevation-shadow, var(--mat-sys-level1))}.mat-mdc-raised-button[disabled],.mat-mdc-raised-button.mat-mdc-button-disabled{cursor:default;pointer-events:none;color:var(--mat-button-protected-disabled-label-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));background-color:var(--mat-button-protected-disabled-container-color, color-mix(in srgb, var(--mat-sys-on-surface) 12%, transparent))}.mat-mdc-raised-button[disabled].mat-mdc-button-disabled,.mat-mdc-raised-button.mat-mdc-button-disabled.mat-mdc-button-disabled{box-shadow:var(--mat-button-protected-disabled-container-elevation-shadow, var(--mat-sys-level0))}.mat-mdc-raised-button.mat-mdc-button-disabled-interactive{pointer-events:auto}.mat-mdc-outlined-button{border-style:solid;transition:border 280ms cubic-bezier(0.4, 0, 0.2, 1);height:var(--mat-button-outlined-container-height, 40px);font-family:var(--mat-button-outlined-label-text-font, var(--mat-sys-label-large-font));font-size:var(--mat-button-outlined-label-text-size, var(--mat-sys-label-large-size));letter-spacing:var(--mat-button-outlined-label-text-tracking, var(--mat-sys-label-large-tracking));text-transform:var(--mat-button-outlined-label-text-transform);font-weight:var(--mat-button-outlined-label-text-weight, var(--mat-sys-label-large-weight));border-radius:var(--mat-button-outlined-container-shape, var(--mat-sys-corner-full));border-width:var(--mat-button-outlined-outline-width, 1px);padding:0 var(--mat-button-outlined-horizontal-padding, 24px)}.mat-mdc-outlined-button>.mat-icon{margin-right:var(--mat-button-outlined-icon-spacing, 8px);margin-left:var(--mat-button-outlined-icon-offset, -8px)}[dir=rtl] .mat-mdc-outlined-button>.mat-icon{margin-right:var(--mat-button-outlined-icon-offset, -8px);margin-left:var(--mat-button-outlined-icon-spacing, 8px)}.mat-mdc-outlined-button .mdc-button__label+.mat-icon{margin-right:var(--mat-button-outlined-icon-offset, -8px);margin-left:var(--mat-button-outlined-icon-spacing, 8px)}[dir=rtl] .mat-mdc-outlined-button .mdc-button__label+.mat-icon{margin-right:var(--mat-button-outlined-icon-spacing, 8px);margin-left:var(--mat-button-outlined-icon-offset, -8px)}.mat-mdc-outlined-button .mat-ripple-element{background-color:var(--mat-button-outlined-ripple-color, color-mix(in srgb, var(--mat-sys-primary) calc(var(--mat-sys-pressed-state-layer-opacity) * 100%), transparent))}.mat-mdc-outlined-button .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-button-outlined-state-layer-color, var(--mat-sys-primary))}.mat-mdc-outlined-button.mat-mdc-button-disabled .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-button-outlined-disabled-state-layer-color, var(--mat-sys-on-surface-variant))}.mat-mdc-outlined-button:hover>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-button-outlined-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity))}.mat-mdc-outlined-button.cdk-program-focused>.mat-mdc-button-persistent-ripple::before,.mat-mdc-outlined-button.cdk-keyboard-focused>.mat-mdc-button-persistent-ripple::before,.mat-mdc-outlined-button.mat-mdc-button-disabled-interactive:focus>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-button-outlined-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}.mat-mdc-outlined-button:active>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-button-outlined-pressed-state-layer-opacity, var(--mat-sys-pressed-state-layer-opacity))}.mat-mdc-outlined-button .mat-mdc-button-touch-target{position:absolute;top:50%;height:48px;display:var(--mat-button-outlined-touch-target-display, block);left:0;right:0;transform:translateY(-50%)}.mat-mdc-outlined-button:not(:disabled){color:var(--mat-button-outlined-label-text-color, var(--mat-sys-primary));border-color:var(--mat-button-outlined-outline-color, var(--mat-sys-outline))}.mat-mdc-outlined-button[disabled],.mat-mdc-outlined-button.mat-mdc-button-disabled{cursor:default;pointer-events:none;color:var(--mat-button-outlined-disabled-label-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));border-color:var(--mat-button-outlined-disabled-outline-color, color-mix(in srgb, var(--mat-sys-on-surface) 12%, transparent))}.mat-mdc-outlined-button.mat-mdc-button-disabled-interactive{pointer-events:auto}.mat-tonal-button{transition:box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1);height:var(--mat-button-tonal-container-height, 40px);font-family:var(--mat-button-tonal-label-text-font, var(--mat-sys-label-large-font));font-size:var(--mat-button-tonal-label-text-size, var(--mat-sys-label-large-size));letter-spacing:var(--mat-button-tonal-label-text-tracking, var(--mat-sys-label-large-tracking));text-transform:var(--mat-button-tonal-label-text-transform);font-weight:var(--mat-button-tonal-label-text-weight, var(--mat-sys-label-large-weight));padding:0 var(--mat-button-tonal-horizontal-padding, 24px)}.mat-tonal-button:not(:disabled){color:var(--mat-button-tonal-label-text-color, var(--mat-sys-on-secondary-container));background-color:var(--mat-button-tonal-container-color, var(--mat-sys-secondary-container))}.mat-tonal-button,.mat-tonal-button .mdc-button__ripple{border-radius:var(--mat-button-tonal-container-shape, var(--mat-sys-corner-full))}.mat-tonal-button[disabled],.mat-tonal-button.mat-mdc-button-disabled{cursor:default;pointer-events:none;color:var(--mat-button-tonal-disabled-label-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));background-color:var(--mat-button-tonal-disabled-container-color, color-mix(in srgb, var(--mat-sys-on-surface) 12%, transparent))}.mat-tonal-button.mat-mdc-button-disabled-interactive{pointer-events:auto}.mat-tonal-button>.mat-icon{margin-right:var(--mat-button-tonal-icon-spacing, 8px);margin-left:var(--mat-button-tonal-icon-offset, -8px)}[dir=rtl] .mat-tonal-button>.mat-icon{margin-right:var(--mat-button-tonal-icon-offset, -8px);margin-left:var(--mat-button-tonal-icon-spacing, 8px)}.mat-tonal-button .mdc-button__label+.mat-icon{margin-right:var(--mat-button-tonal-icon-offset, -8px);margin-left:var(--mat-button-tonal-icon-spacing, 8px)}[dir=rtl] .mat-tonal-button .mdc-button__label+.mat-icon{margin-right:var(--mat-button-tonal-icon-spacing, 8px);margin-left:var(--mat-button-tonal-icon-offset, -8px)}.mat-tonal-button .mat-ripple-element{background-color:var(--mat-button-tonal-ripple-color, color-mix(in srgb, var(--mat-sys-on-secondary-container) calc(var(--mat-sys-pressed-state-layer-opacity) * 100%), transparent))}.mat-tonal-button .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-button-tonal-state-layer-color, var(--mat-sys-on-secondary-container))}.mat-tonal-button.mat-mdc-button-disabled .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-button-tonal-disabled-state-layer-color, var(--mat-sys-on-surface-variant))}.mat-tonal-button:hover>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-button-tonal-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity))}.mat-tonal-button.cdk-program-focused>.mat-mdc-button-persistent-ripple::before,.mat-tonal-button.cdk-keyboard-focused>.mat-mdc-button-persistent-ripple::before,.mat-tonal-button.mat-mdc-button-disabled-interactive:focus>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-button-tonal-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}.mat-tonal-button:active>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-button-tonal-pressed-state-layer-opacity, var(--mat-sys-pressed-state-layer-opacity))}.mat-tonal-button .mat-mdc-button-touch-target{position:absolute;top:50%;height:48px;display:var(--mat-button-tonal-touch-target-display, block);left:0;right:0;transform:translateY(-50%)}.mat-mdc-button,.mat-mdc-unelevated-button,.mat-mdc-raised-button,.mat-mdc-outlined-button,.mat-tonal-button{-webkit-tap-highlight-color:rgba(0,0,0,0)}.mat-mdc-button .mat-mdc-button-ripple,.mat-mdc-button .mat-mdc-button-persistent-ripple,.mat-mdc-button .mat-mdc-button-persistent-ripple::before,.mat-mdc-unelevated-button .mat-mdc-button-ripple,.mat-mdc-unelevated-button .mat-mdc-button-persistent-ripple,.mat-mdc-unelevated-button .mat-mdc-button-persistent-ripple::before,.mat-mdc-raised-button .mat-mdc-button-ripple,.mat-mdc-raised-button .mat-mdc-button-persistent-ripple,.mat-mdc-raised-button .mat-mdc-button-persistent-ripple::before,.mat-mdc-outlined-button .mat-mdc-button-ripple,.mat-mdc-outlined-button .mat-mdc-button-persistent-ripple,.mat-mdc-outlined-button .mat-mdc-button-persistent-ripple::before,.mat-tonal-button .mat-mdc-button-ripple,.mat-tonal-button .mat-mdc-button-persistent-ripple,.mat-tonal-button .mat-mdc-button-persistent-ripple::before{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none;border-radius:inherit}.mat-mdc-button .mat-mdc-button-ripple,.mat-mdc-unelevated-button .mat-mdc-button-ripple,.mat-mdc-raised-button .mat-mdc-button-ripple,.mat-mdc-outlined-button .mat-mdc-button-ripple,.mat-tonal-button .mat-mdc-button-ripple{overflow:hidden}.mat-mdc-button .mat-mdc-button-persistent-ripple::before,.mat-mdc-unelevated-button .mat-mdc-button-persistent-ripple::before,.mat-mdc-raised-button .mat-mdc-button-persistent-ripple::before,.mat-mdc-outlined-button .mat-mdc-button-persistent-ripple::before,.mat-tonal-button .mat-mdc-button-persistent-ripple::before{content:"";opacity:0}.mat-mdc-button .mdc-button__label,.mat-mdc-button .mat-icon,.mat-mdc-unelevated-button .mdc-button__label,.mat-mdc-unelevated-button .mat-icon,.mat-mdc-raised-button .mdc-button__label,.mat-mdc-raised-button .mat-icon,.mat-mdc-outlined-button .mdc-button__label,.mat-mdc-outlined-button .mat-icon,.mat-tonal-button .mdc-button__label,.mat-tonal-button .mat-icon{z-index:1;position:relative}.mat-mdc-button .mat-focus-indicator,.mat-mdc-unelevated-button .mat-focus-indicator,.mat-mdc-raised-button .mat-focus-indicator,.mat-mdc-outlined-button .mat-focus-indicator,.mat-tonal-button .mat-focus-indicator{top:0;left:0;right:0;bottom:0;position:absolute;border-radius:inherit}.mat-mdc-button:focus>.mat-focus-indicator::before,.mat-mdc-unelevated-button:focus>.mat-focus-indicator::before,.mat-mdc-raised-button:focus>.mat-focus-indicator::before,.mat-mdc-outlined-button:focus>.mat-focus-indicator::before,.mat-tonal-button:focus>.mat-focus-indicator::before{content:"";border-radius:inherit}.mat-mdc-button._mat-animation-noopable,.mat-mdc-unelevated-button._mat-animation-noopable,.mat-mdc-raised-button._mat-animation-noopable,.mat-mdc-outlined-button._mat-animation-noopable,.mat-tonal-button._mat-animation-noopable{transition:none !important;animation:none !important}.mat-mdc-button>.mat-icon,.mat-mdc-unelevated-button>.mat-icon,.mat-mdc-raised-button>.mat-icon,.mat-mdc-outlined-button>.mat-icon,.mat-tonal-button>.mat-icon{display:inline-block;position:relative;vertical-align:top;font-size:1.125rem;height:1.125rem;width:1.125rem}.mat-mdc-outlined-button .mat-mdc-button-ripple,.mat-mdc-outlined-button .mdc-button__ripple{top:-1px;left:-1px;bottom:-1px;right:-1px}.mat-mdc-unelevated-button .mat-focus-indicator::before,.mat-tonal-button .mat-focus-indicator::before,.mat-mdc-raised-button .mat-focus-indicator::before{margin:calc(calc(var(--mat-focus-indicator-border-width, 3px) + 2px)*-1)}.mat-mdc-outlined-button .mat-focus-indicator::before{margin:calc(calc(var(--mat-focus-indicator-border-width, 3px) + 3px)*-1)}\n', "@media(forced-colors: active){.mat-mdc-button:not(.mdc-button--outlined),.mat-mdc-unelevated-button:not(.mdc-button--outlined),.mat-mdc-raised-button:not(.mdc-button--outlined),.mat-mdc-outlined-button:not(.mdc-button--outlined),.mat-mdc-button-base.mat-tonal-button,.mat-mdc-icon-button.mat-mdc-icon-button,.mat-mdc-outlined-button .mdc-button__ripple{outline:solid 1px}}\n"]
    }]
  }], () => [], {
    appearance: [{
      type: Input,
      args: ["matButton"]
    }]
  });
})();
function _inferAppearance(button) {
  if (button.hasAttribute("mat-raised-button")) {
    return "elevated";
  }
  if (button.hasAttribute("mat-stroked-button")) {
    return "outlined";
  }
  if (button.hasAttribute("mat-flat-button")) {
    return "filled";
  }
  if (button.hasAttribute("mat-button")) {
    return "text";
  }
  return null;
}
var MAT_FAB_DEFAULT_OPTIONS = new InjectionToken("mat-mdc-fab-default-options", {
  providedIn: "root",
  factory: MAT_FAB_DEFAULT_OPTIONS_FACTORY
});
function MAT_FAB_DEFAULT_OPTIONS_FACTORY() {
  return {
    // The FAB by default has its color set to accent.
    color: "accent"
  };
}
var defaults = MAT_FAB_DEFAULT_OPTIONS_FACTORY();
var MatFabButton = class _MatFabButton extends MatButtonBase {
  _options = inject2(MAT_FAB_DEFAULT_OPTIONS, {
    optional: true
  });
  _isFab = true;
  extended;
  constructor() {
    super();
    this._options = this._options || defaults;
    this.color = this._options.color || defaults.color;
  }
  static \u0275fac = function MatFabButton_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _MatFabButton)();
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({
    type: _MatFabButton,
    selectors: [["button", "mat-fab", ""], ["a", "mat-fab", ""], ["button", "matFab", ""], ["a", "matFab", ""]],
    hostAttrs: [1, "mdc-fab", "mat-mdc-fab-base", "mat-mdc-fab"],
    hostVars: 4,
    hostBindings: function MatFabButton_HostBindings(rf, ctx) {
      if (rf & 2) {
        \u0275\u0275classProp("mdc-fab--extended", ctx.extended)("mat-mdc-extended-fab", ctx.extended);
      }
    },
    inputs: {
      extended: [2, "extended", "extended", booleanAttribute]
    },
    exportAs: ["matButton", "matAnchor"],
    features: [\u0275\u0275InheritDefinitionFeature],
    attrs: _c33,
    ngContentSelectors: _c26,
    decls: 7,
    vars: 4,
    consts: [[1, "mat-mdc-button-persistent-ripple"], [1, "mdc-button__label"], [1, "mat-focus-indicator"], [1, "mat-mdc-button-touch-target"]],
    template: function MatFabButton_Template(rf, ctx) {
      if (rf & 1) {
        \u0275\u0275projectionDef(_c110);
        \u0275\u0275domElement(0, "span", 0);
        \u0275\u0275projection(1);
        \u0275\u0275domElementStart(2, "span", 1);
        \u0275\u0275projection(3, 1);
        \u0275\u0275domElementEnd();
        \u0275\u0275projection(4, 2);
        \u0275\u0275domElement(5, "span", 2)(6, "span", 3);
      }
      if (rf & 2) {
        \u0275\u0275classProp("mdc-button__ripple", !ctx._isFab)("mdc-fab__ripple", ctx._isFab);
      }
    },
    styles: ['.mat-mdc-fab-base{-webkit-user-select:none;user-select:none;position:relative;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:56px;height:56px;padding:0;border:none;fill:currentColor;text-decoration:none;cursor:pointer;-moz-appearance:none;-webkit-appearance:none;overflow:visible;transition:box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1),opacity 15ms linear 30ms,transform 270ms 0ms cubic-bezier(0, 0, 0.2, 1);flex-shrink:0;-webkit-tap-highlight-color:rgba(0,0,0,0)}.mat-mdc-fab-base .mat-mdc-button-ripple,.mat-mdc-fab-base .mat-mdc-button-persistent-ripple,.mat-mdc-fab-base .mat-mdc-button-persistent-ripple::before{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none;border-radius:inherit}.mat-mdc-fab-base .mat-mdc-button-ripple{overflow:hidden}.mat-mdc-fab-base .mat-mdc-button-persistent-ripple::before{content:"";opacity:0}.mat-mdc-fab-base .mdc-button__label,.mat-mdc-fab-base .mat-icon{z-index:1;position:relative}.mat-mdc-fab-base .mat-focus-indicator{top:0;left:0;right:0;bottom:0;position:absolute}.mat-mdc-fab-base:focus>.mat-focus-indicator::before{content:""}.mat-mdc-fab-base._mat-animation-noopable{transition:none !important;animation:none !important}.mat-mdc-fab-base::before{position:absolute;box-sizing:border-box;width:100%;height:100%;top:0;left:0;border:1px solid rgba(0,0,0,0);border-radius:inherit;content:"";pointer-events:none}.mat-mdc-fab-base[hidden]{display:none}.mat-mdc-fab-base::-moz-focus-inner{padding:0;border:0}.mat-mdc-fab-base:active,.mat-mdc-fab-base:focus{outline:none}.mat-mdc-fab-base:hover{cursor:pointer}.mat-mdc-fab-base>svg{width:100%}.mat-mdc-fab-base .mat-icon,.mat-mdc-fab-base .material-icons{transition:transform 180ms 90ms cubic-bezier(0, 0, 0.2, 1);fill:currentColor;will-change:transform}.mat-mdc-fab-base .mat-focus-indicator::before{margin:calc(calc(var(--mat-focus-indicator-border-width, 3px) + 2px)*-1)}.mat-mdc-fab-base[disabled],.mat-mdc-fab-base.mat-mdc-button-disabled{cursor:default;pointer-events:none}.mat-mdc-fab-base[disabled],.mat-mdc-fab-base[disabled]:focus,.mat-mdc-fab-base.mat-mdc-button-disabled,.mat-mdc-fab-base.mat-mdc-button-disabled:focus{box-shadow:none}.mat-mdc-fab-base.mat-mdc-button-disabled-interactive{pointer-events:auto}.mat-mdc-fab{background-color:var(--mat-fab-container-color, var(--mat-sys-primary-container));border-radius:var(--mat-fab-container-shape, var(--mat-sys-corner-large));color:var(--mat-fab-foreground-color, var(--mat-sys-on-primary-container, inherit));box-shadow:var(--mat-fab-container-elevation-shadow, var(--mat-sys-level3))}.mat-mdc-fab:hover{box-shadow:var(--mat-fab-hover-container-elevation-shadow, var(--mat-sys-level4))}.mat-mdc-fab:focus{box-shadow:var(--mat-fab-focus-container-elevation-shadow, var(--mat-sys-level3))}.mat-mdc-fab:active,.mat-mdc-fab:focus:active{box-shadow:var(--mat-fab-pressed-container-elevation-shadow, var(--mat-sys-level3))}.mat-mdc-fab[disabled],.mat-mdc-fab.mat-mdc-button-disabled{cursor:default;pointer-events:none;color:var(--mat-fab-disabled-state-foreground-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));background-color:var(--mat-fab-disabled-state-container-color, color-mix(in srgb, var(--mat-sys-on-surface) 12%, transparent))}.mat-mdc-fab.mat-mdc-button-disabled-interactive{pointer-events:auto}.mat-mdc-fab .mat-mdc-button-touch-target{position:absolute;top:50%;height:48px;display:var(--mat-fab-touch-target-display, block);left:50%;width:48px;transform:translate(-50%, -50%)}.mat-mdc-fab .mat-ripple-element{background-color:var(--mat-fab-ripple-color, color-mix(in srgb, var(--mat-sys-on-primary-container) calc(var(--mat-sys-pressed-state-layer-opacity) * 100%), transparent))}.mat-mdc-fab .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-fab-state-layer-color, var(--mat-sys-on-primary-container))}.mat-mdc-fab.mat-mdc-button-disabled .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-fab-disabled-state-layer-color)}.mat-mdc-fab:hover>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-fab-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity))}.mat-mdc-fab.cdk-program-focused>.mat-mdc-button-persistent-ripple::before,.mat-mdc-fab.cdk-keyboard-focused>.mat-mdc-button-persistent-ripple::before,.mat-mdc-fab.mat-mdc-button-disabled-interactive:focus>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-fab-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}.mat-mdc-fab:active>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-fab-pressed-state-layer-opacity, var(--mat-sys-pressed-state-layer-opacity))}.mat-mdc-mini-fab{width:40px;height:40px;background-color:var(--mat-fab-small-container-color, var(--mat-sys-primary-container));border-radius:var(--mat-fab-small-container-shape, var(--mat-sys-corner-medium));color:var(--mat-fab-small-foreground-color, var(--mat-sys-on-primary-container, inherit));box-shadow:var(--mat-fab-small-container-elevation-shadow, var(--mat-sys-level3))}.mat-mdc-mini-fab:hover{box-shadow:var(--mat-fab-small-hover-container-elevation-shadow, var(--mat-sys-level4))}.mat-mdc-mini-fab:focus{box-shadow:var(--mat-fab-small-focus-container-elevation-shadow, var(--mat-sys-level3))}.mat-mdc-mini-fab:active,.mat-mdc-mini-fab:focus:active{box-shadow:var(--mat-fab-small-pressed-container-elevation-shadow, var(--mat-sys-level3))}.mat-mdc-mini-fab[disabled],.mat-mdc-mini-fab.mat-mdc-button-disabled{cursor:default;pointer-events:none;color:var(--mat-fab-small-disabled-state-foreground-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));background-color:var(--mat-fab-small-disabled-state-container-color, color-mix(in srgb, var(--mat-sys-on-surface) 12%, transparent))}.mat-mdc-mini-fab.mat-mdc-button-disabled-interactive{pointer-events:auto}.mat-mdc-mini-fab .mat-mdc-button-touch-target{position:absolute;top:50%;height:48px;display:var(--mat-fab-small-touch-target-display);left:50%;width:48px;transform:translate(-50%, -50%)}.mat-mdc-mini-fab .mat-ripple-element{background-color:var(--mat-fab-small-ripple-color, color-mix(in srgb, var(--mat-sys-on-primary-container) calc(var(--mat-sys-pressed-state-layer-opacity) * 100%), transparent))}.mat-mdc-mini-fab .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-fab-small-state-layer-color, var(--mat-sys-on-primary-container))}.mat-mdc-mini-fab.mat-mdc-button-disabled .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-fab-small-disabled-state-layer-color)}.mat-mdc-mini-fab:hover>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-fab-small-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity))}.mat-mdc-mini-fab.cdk-program-focused>.mat-mdc-button-persistent-ripple::before,.mat-mdc-mini-fab.cdk-keyboard-focused>.mat-mdc-button-persistent-ripple::before,.mat-mdc-mini-fab.mat-mdc-button-disabled-interactive:focus>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-fab-small-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}.mat-mdc-mini-fab:active>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-fab-small-pressed-state-layer-opacity, var(--mat-sys-pressed-state-layer-opacity))}.mat-mdc-extended-fab{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;padding-left:20px;padding-right:20px;width:auto;max-width:100%;line-height:normal;box-shadow:var(--mat-fab-extended-container-elevation-shadow, var(--mat-sys-level3));height:var(--mat-fab-extended-container-height, 56px);border-radius:var(--mat-fab-extended-container-shape, var(--mat-sys-corner-large));font-family:var(--mat-fab-extended-label-text-font, var(--mat-sys-label-large-font));font-size:var(--mat-fab-extended-label-text-size, var(--mat-sys-label-large-size));font-weight:var(--mat-fab-extended-label-text-weight, var(--mat-sys-label-large-weight));letter-spacing:var(--mat-fab-extended-label-text-tracking, var(--mat-sys-label-large-tracking))}.mat-mdc-extended-fab:hover{box-shadow:var(--mat-fab-extended-hover-container-elevation-shadow, var(--mat-sys-level4))}.mat-mdc-extended-fab:focus{box-shadow:var(--mat-fab-extended-focus-container-elevation-shadow, var(--mat-sys-level3))}.mat-mdc-extended-fab:active,.mat-mdc-extended-fab:focus:active{box-shadow:var(--mat-fab-extended-pressed-container-elevation-shadow, var(--mat-sys-level3))}.mat-mdc-extended-fab[disabled],.mat-mdc-extended-fab.mat-mdc-button-disabled{cursor:default;pointer-events:none}.mat-mdc-extended-fab[disabled],.mat-mdc-extended-fab[disabled]:focus,.mat-mdc-extended-fab.mat-mdc-button-disabled,.mat-mdc-extended-fab.mat-mdc-button-disabled:focus{box-shadow:none}.mat-mdc-extended-fab.mat-mdc-button-disabled-interactive{pointer-events:auto}[dir=rtl] .mat-mdc-extended-fab .mdc-button__label+.mat-icon,[dir=rtl] .mat-mdc-extended-fab .mdc-button__label+.material-icons,.mat-mdc-extended-fab>.mat-icon,.mat-mdc-extended-fab>.material-icons{margin-left:-8px;margin-right:12px}.mat-mdc-extended-fab .mdc-button__label+.mat-icon,.mat-mdc-extended-fab .mdc-button__label+.material-icons,[dir=rtl] .mat-mdc-extended-fab>.mat-icon,[dir=rtl] .mat-mdc-extended-fab>.material-icons{margin-left:12px;margin-right:-8px}.mat-mdc-extended-fab .mat-mdc-button-touch-target{width:100%}\n'],
    encapsulation: 2,
    changeDetection: 0
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatFabButton, [{
    type: Component,
    args: [{
      selector: `button[mat-fab], a[mat-fab], button[matFab], a[matFab]`,
      host: {
        "class": "mdc-fab mat-mdc-fab-base mat-mdc-fab",
        "[class.mdc-fab--extended]": "extended",
        "[class.mat-mdc-extended-fab]": "extended"
      },
      exportAs: "matButton, matAnchor",
      encapsulation: ViewEncapsulation.None,
      changeDetection: ChangeDetectionStrategy.OnPush,
      template: `<span
    class="mat-mdc-button-persistent-ripple"
    [class.mdc-button__ripple]="!_isFab"
    [class.mdc-fab__ripple]="_isFab"></span>

<ng-content select=".material-icons:not([iconPositionEnd]), mat-icon:not([iconPositionEnd]), [matButtonIcon]:not([iconPositionEnd])">
</ng-content>

<span class="mdc-button__label"><ng-content></ng-content></span>

<ng-content select=".material-icons[iconPositionEnd], mat-icon[iconPositionEnd], [matButtonIcon][iconPositionEnd]">
</ng-content>

<!--
  The indicator can't be directly on the button, because MDC uses ::before for high contrast
  indication and it can't be on the ripple, because it has a border radius and overflow: hidden.
-->
<span class="mat-focus-indicator"></span>

<span class="mat-mdc-button-touch-target"></span>
`,
      styles: ['.mat-mdc-fab-base{-webkit-user-select:none;user-select:none;position:relative;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:56px;height:56px;padding:0;border:none;fill:currentColor;text-decoration:none;cursor:pointer;-moz-appearance:none;-webkit-appearance:none;overflow:visible;transition:box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1),opacity 15ms linear 30ms,transform 270ms 0ms cubic-bezier(0, 0, 0.2, 1);flex-shrink:0;-webkit-tap-highlight-color:rgba(0,0,0,0)}.mat-mdc-fab-base .mat-mdc-button-ripple,.mat-mdc-fab-base .mat-mdc-button-persistent-ripple,.mat-mdc-fab-base .mat-mdc-button-persistent-ripple::before{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none;border-radius:inherit}.mat-mdc-fab-base .mat-mdc-button-ripple{overflow:hidden}.mat-mdc-fab-base .mat-mdc-button-persistent-ripple::before{content:"";opacity:0}.mat-mdc-fab-base .mdc-button__label,.mat-mdc-fab-base .mat-icon{z-index:1;position:relative}.mat-mdc-fab-base .mat-focus-indicator{top:0;left:0;right:0;bottom:0;position:absolute}.mat-mdc-fab-base:focus>.mat-focus-indicator::before{content:""}.mat-mdc-fab-base._mat-animation-noopable{transition:none !important;animation:none !important}.mat-mdc-fab-base::before{position:absolute;box-sizing:border-box;width:100%;height:100%;top:0;left:0;border:1px solid rgba(0,0,0,0);border-radius:inherit;content:"";pointer-events:none}.mat-mdc-fab-base[hidden]{display:none}.mat-mdc-fab-base::-moz-focus-inner{padding:0;border:0}.mat-mdc-fab-base:active,.mat-mdc-fab-base:focus{outline:none}.mat-mdc-fab-base:hover{cursor:pointer}.mat-mdc-fab-base>svg{width:100%}.mat-mdc-fab-base .mat-icon,.mat-mdc-fab-base .material-icons{transition:transform 180ms 90ms cubic-bezier(0, 0, 0.2, 1);fill:currentColor;will-change:transform}.mat-mdc-fab-base .mat-focus-indicator::before{margin:calc(calc(var(--mat-focus-indicator-border-width, 3px) + 2px)*-1)}.mat-mdc-fab-base[disabled],.mat-mdc-fab-base.mat-mdc-button-disabled{cursor:default;pointer-events:none}.mat-mdc-fab-base[disabled],.mat-mdc-fab-base[disabled]:focus,.mat-mdc-fab-base.mat-mdc-button-disabled,.mat-mdc-fab-base.mat-mdc-button-disabled:focus{box-shadow:none}.mat-mdc-fab-base.mat-mdc-button-disabled-interactive{pointer-events:auto}.mat-mdc-fab{background-color:var(--mat-fab-container-color, var(--mat-sys-primary-container));border-radius:var(--mat-fab-container-shape, var(--mat-sys-corner-large));color:var(--mat-fab-foreground-color, var(--mat-sys-on-primary-container, inherit));box-shadow:var(--mat-fab-container-elevation-shadow, var(--mat-sys-level3))}.mat-mdc-fab:hover{box-shadow:var(--mat-fab-hover-container-elevation-shadow, var(--mat-sys-level4))}.mat-mdc-fab:focus{box-shadow:var(--mat-fab-focus-container-elevation-shadow, var(--mat-sys-level3))}.mat-mdc-fab:active,.mat-mdc-fab:focus:active{box-shadow:var(--mat-fab-pressed-container-elevation-shadow, var(--mat-sys-level3))}.mat-mdc-fab[disabled],.mat-mdc-fab.mat-mdc-button-disabled{cursor:default;pointer-events:none;color:var(--mat-fab-disabled-state-foreground-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));background-color:var(--mat-fab-disabled-state-container-color, color-mix(in srgb, var(--mat-sys-on-surface) 12%, transparent))}.mat-mdc-fab.mat-mdc-button-disabled-interactive{pointer-events:auto}.mat-mdc-fab .mat-mdc-button-touch-target{position:absolute;top:50%;height:48px;display:var(--mat-fab-touch-target-display, block);left:50%;width:48px;transform:translate(-50%, -50%)}.mat-mdc-fab .mat-ripple-element{background-color:var(--mat-fab-ripple-color, color-mix(in srgb, var(--mat-sys-on-primary-container) calc(var(--mat-sys-pressed-state-layer-opacity) * 100%), transparent))}.mat-mdc-fab .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-fab-state-layer-color, var(--mat-sys-on-primary-container))}.mat-mdc-fab.mat-mdc-button-disabled .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-fab-disabled-state-layer-color)}.mat-mdc-fab:hover>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-fab-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity))}.mat-mdc-fab.cdk-program-focused>.mat-mdc-button-persistent-ripple::before,.mat-mdc-fab.cdk-keyboard-focused>.mat-mdc-button-persistent-ripple::before,.mat-mdc-fab.mat-mdc-button-disabled-interactive:focus>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-fab-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}.mat-mdc-fab:active>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-fab-pressed-state-layer-opacity, var(--mat-sys-pressed-state-layer-opacity))}.mat-mdc-mini-fab{width:40px;height:40px;background-color:var(--mat-fab-small-container-color, var(--mat-sys-primary-container));border-radius:var(--mat-fab-small-container-shape, var(--mat-sys-corner-medium));color:var(--mat-fab-small-foreground-color, var(--mat-sys-on-primary-container, inherit));box-shadow:var(--mat-fab-small-container-elevation-shadow, var(--mat-sys-level3))}.mat-mdc-mini-fab:hover{box-shadow:var(--mat-fab-small-hover-container-elevation-shadow, var(--mat-sys-level4))}.mat-mdc-mini-fab:focus{box-shadow:var(--mat-fab-small-focus-container-elevation-shadow, var(--mat-sys-level3))}.mat-mdc-mini-fab:active,.mat-mdc-mini-fab:focus:active{box-shadow:var(--mat-fab-small-pressed-container-elevation-shadow, var(--mat-sys-level3))}.mat-mdc-mini-fab[disabled],.mat-mdc-mini-fab.mat-mdc-button-disabled{cursor:default;pointer-events:none;color:var(--mat-fab-small-disabled-state-foreground-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));background-color:var(--mat-fab-small-disabled-state-container-color, color-mix(in srgb, var(--mat-sys-on-surface) 12%, transparent))}.mat-mdc-mini-fab.mat-mdc-button-disabled-interactive{pointer-events:auto}.mat-mdc-mini-fab .mat-mdc-button-touch-target{position:absolute;top:50%;height:48px;display:var(--mat-fab-small-touch-target-display);left:50%;width:48px;transform:translate(-50%, -50%)}.mat-mdc-mini-fab .mat-ripple-element{background-color:var(--mat-fab-small-ripple-color, color-mix(in srgb, var(--mat-sys-on-primary-container) calc(var(--mat-sys-pressed-state-layer-opacity) * 100%), transparent))}.mat-mdc-mini-fab .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-fab-small-state-layer-color, var(--mat-sys-on-primary-container))}.mat-mdc-mini-fab.mat-mdc-button-disabled .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-fab-small-disabled-state-layer-color)}.mat-mdc-mini-fab:hover>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-fab-small-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity))}.mat-mdc-mini-fab.cdk-program-focused>.mat-mdc-button-persistent-ripple::before,.mat-mdc-mini-fab.cdk-keyboard-focused>.mat-mdc-button-persistent-ripple::before,.mat-mdc-mini-fab.mat-mdc-button-disabled-interactive:focus>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-fab-small-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}.mat-mdc-mini-fab:active>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-fab-small-pressed-state-layer-opacity, var(--mat-sys-pressed-state-layer-opacity))}.mat-mdc-extended-fab{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;padding-left:20px;padding-right:20px;width:auto;max-width:100%;line-height:normal;box-shadow:var(--mat-fab-extended-container-elevation-shadow, var(--mat-sys-level3));height:var(--mat-fab-extended-container-height, 56px);border-radius:var(--mat-fab-extended-container-shape, var(--mat-sys-corner-large));font-family:var(--mat-fab-extended-label-text-font, var(--mat-sys-label-large-font));font-size:var(--mat-fab-extended-label-text-size, var(--mat-sys-label-large-size));font-weight:var(--mat-fab-extended-label-text-weight, var(--mat-sys-label-large-weight));letter-spacing:var(--mat-fab-extended-label-text-tracking, var(--mat-sys-label-large-tracking))}.mat-mdc-extended-fab:hover{box-shadow:var(--mat-fab-extended-hover-container-elevation-shadow, var(--mat-sys-level4))}.mat-mdc-extended-fab:focus{box-shadow:var(--mat-fab-extended-focus-container-elevation-shadow, var(--mat-sys-level3))}.mat-mdc-extended-fab:active,.mat-mdc-extended-fab:focus:active{box-shadow:var(--mat-fab-extended-pressed-container-elevation-shadow, var(--mat-sys-level3))}.mat-mdc-extended-fab[disabled],.mat-mdc-extended-fab.mat-mdc-button-disabled{cursor:default;pointer-events:none}.mat-mdc-extended-fab[disabled],.mat-mdc-extended-fab[disabled]:focus,.mat-mdc-extended-fab.mat-mdc-button-disabled,.mat-mdc-extended-fab.mat-mdc-button-disabled:focus{box-shadow:none}.mat-mdc-extended-fab.mat-mdc-button-disabled-interactive{pointer-events:auto}[dir=rtl] .mat-mdc-extended-fab .mdc-button__label+.mat-icon,[dir=rtl] .mat-mdc-extended-fab .mdc-button__label+.material-icons,.mat-mdc-extended-fab>.mat-icon,.mat-mdc-extended-fab>.material-icons{margin-left:-8px;margin-right:12px}.mat-mdc-extended-fab .mdc-button__label+.mat-icon,.mat-mdc-extended-fab .mdc-button__label+.material-icons,[dir=rtl] .mat-mdc-extended-fab>.mat-icon,[dir=rtl] .mat-mdc-extended-fab>.material-icons{margin-left:12px;margin-right:-8px}.mat-mdc-extended-fab .mat-mdc-button-touch-target{width:100%}\n']
    }]
  }], () => [], {
    extended: [{
      type: Input,
      args: [{
        transform: booleanAttribute
      }]
    }]
  });
})();
var MatMiniFabButton = class _MatMiniFabButton extends MatButtonBase {
  _options = inject2(MAT_FAB_DEFAULT_OPTIONS, {
    optional: true
  });
  _isFab = true;
  constructor() {
    super();
    this._options = this._options || defaults;
    this.color = this._options.color || defaults.color;
  }
  static \u0275fac = function MatMiniFabButton_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _MatMiniFabButton)();
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({
    type: _MatMiniFabButton,
    selectors: [["button", "mat-mini-fab", ""], ["a", "mat-mini-fab", ""], ["button", "matMiniFab", ""], ["a", "matMiniFab", ""]],
    hostAttrs: [1, "mdc-fab", "mat-mdc-fab-base", "mdc-fab--mini", "mat-mdc-mini-fab"],
    exportAs: ["matButton", "matAnchor"],
    features: [\u0275\u0275InheritDefinitionFeature],
    attrs: _c42,
    ngContentSelectors: _c26,
    decls: 7,
    vars: 4,
    consts: [[1, "mat-mdc-button-persistent-ripple"], [1, "mdc-button__label"], [1, "mat-focus-indicator"], [1, "mat-mdc-button-touch-target"]],
    template: function MatMiniFabButton_Template(rf, ctx) {
      if (rf & 1) {
        \u0275\u0275projectionDef(_c110);
        \u0275\u0275domElement(0, "span", 0);
        \u0275\u0275projection(1);
        \u0275\u0275domElementStart(2, "span", 1);
        \u0275\u0275projection(3, 1);
        \u0275\u0275domElementEnd();
        \u0275\u0275projection(4, 2);
        \u0275\u0275domElement(5, "span", 2)(6, "span", 3);
      }
      if (rf & 2) {
        \u0275\u0275classProp("mdc-button__ripple", !ctx._isFab)("mdc-fab__ripple", ctx._isFab);
      }
    },
    styles: [_c52],
    encapsulation: 2,
    changeDetection: 0
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatMiniFabButton, [{
    type: Component,
    args: [{
      selector: `button[mat-mini-fab], a[mat-mini-fab], button[matMiniFab], a[matMiniFab]`,
      host: {
        "class": "mdc-fab mat-mdc-fab-base mdc-fab--mini mat-mdc-mini-fab"
      },
      exportAs: "matButton, matAnchor",
      encapsulation: ViewEncapsulation.None,
      changeDetection: ChangeDetectionStrategy.OnPush,
      template: `<span
    class="mat-mdc-button-persistent-ripple"
    [class.mdc-button__ripple]="!_isFab"
    [class.mdc-fab__ripple]="_isFab"></span>

<ng-content select=".material-icons:not([iconPositionEnd]), mat-icon:not([iconPositionEnd]), [matButtonIcon]:not([iconPositionEnd])">
</ng-content>

<span class="mdc-button__label"><ng-content></ng-content></span>

<ng-content select=".material-icons[iconPositionEnd], mat-icon[iconPositionEnd], [matButtonIcon][iconPositionEnd]">
</ng-content>

<!--
  The indicator can't be directly on the button, because MDC uses ::before for high contrast
  indication and it can't be on the ripple, because it has a border radius and overflow: hidden.
-->
<span class="mat-focus-indicator"></span>

<span class="mat-mdc-button-touch-target"></span>
`,
      styles: ['.mat-mdc-fab-base{-webkit-user-select:none;user-select:none;position:relative;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:56px;height:56px;padding:0;border:none;fill:currentColor;text-decoration:none;cursor:pointer;-moz-appearance:none;-webkit-appearance:none;overflow:visible;transition:box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1),opacity 15ms linear 30ms,transform 270ms 0ms cubic-bezier(0, 0, 0.2, 1);flex-shrink:0;-webkit-tap-highlight-color:rgba(0,0,0,0)}.mat-mdc-fab-base .mat-mdc-button-ripple,.mat-mdc-fab-base .mat-mdc-button-persistent-ripple,.mat-mdc-fab-base .mat-mdc-button-persistent-ripple::before{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none;border-radius:inherit}.mat-mdc-fab-base .mat-mdc-button-ripple{overflow:hidden}.mat-mdc-fab-base .mat-mdc-button-persistent-ripple::before{content:"";opacity:0}.mat-mdc-fab-base .mdc-button__label,.mat-mdc-fab-base .mat-icon{z-index:1;position:relative}.mat-mdc-fab-base .mat-focus-indicator{top:0;left:0;right:0;bottom:0;position:absolute}.mat-mdc-fab-base:focus>.mat-focus-indicator::before{content:""}.mat-mdc-fab-base._mat-animation-noopable{transition:none !important;animation:none !important}.mat-mdc-fab-base::before{position:absolute;box-sizing:border-box;width:100%;height:100%;top:0;left:0;border:1px solid rgba(0,0,0,0);border-radius:inherit;content:"";pointer-events:none}.mat-mdc-fab-base[hidden]{display:none}.mat-mdc-fab-base::-moz-focus-inner{padding:0;border:0}.mat-mdc-fab-base:active,.mat-mdc-fab-base:focus{outline:none}.mat-mdc-fab-base:hover{cursor:pointer}.mat-mdc-fab-base>svg{width:100%}.mat-mdc-fab-base .mat-icon,.mat-mdc-fab-base .material-icons{transition:transform 180ms 90ms cubic-bezier(0, 0, 0.2, 1);fill:currentColor;will-change:transform}.mat-mdc-fab-base .mat-focus-indicator::before{margin:calc(calc(var(--mat-focus-indicator-border-width, 3px) + 2px)*-1)}.mat-mdc-fab-base[disabled],.mat-mdc-fab-base.mat-mdc-button-disabled{cursor:default;pointer-events:none}.mat-mdc-fab-base[disabled],.mat-mdc-fab-base[disabled]:focus,.mat-mdc-fab-base.mat-mdc-button-disabled,.mat-mdc-fab-base.mat-mdc-button-disabled:focus{box-shadow:none}.mat-mdc-fab-base.mat-mdc-button-disabled-interactive{pointer-events:auto}.mat-mdc-fab{background-color:var(--mat-fab-container-color, var(--mat-sys-primary-container));border-radius:var(--mat-fab-container-shape, var(--mat-sys-corner-large));color:var(--mat-fab-foreground-color, var(--mat-sys-on-primary-container, inherit));box-shadow:var(--mat-fab-container-elevation-shadow, var(--mat-sys-level3))}.mat-mdc-fab:hover{box-shadow:var(--mat-fab-hover-container-elevation-shadow, var(--mat-sys-level4))}.mat-mdc-fab:focus{box-shadow:var(--mat-fab-focus-container-elevation-shadow, var(--mat-sys-level3))}.mat-mdc-fab:active,.mat-mdc-fab:focus:active{box-shadow:var(--mat-fab-pressed-container-elevation-shadow, var(--mat-sys-level3))}.mat-mdc-fab[disabled],.mat-mdc-fab.mat-mdc-button-disabled{cursor:default;pointer-events:none;color:var(--mat-fab-disabled-state-foreground-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));background-color:var(--mat-fab-disabled-state-container-color, color-mix(in srgb, var(--mat-sys-on-surface) 12%, transparent))}.mat-mdc-fab.mat-mdc-button-disabled-interactive{pointer-events:auto}.mat-mdc-fab .mat-mdc-button-touch-target{position:absolute;top:50%;height:48px;display:var(--mat-fab-touch-target-display, block);left:50%;width:48px;transform:translate(-50%, -50%)}.mat-mdc-fab .mat-ripple-element{background-color:var(--mat-fab-ripple-color, color-mix(in srgb, var(--mat-sys-on-primary-container) calc(var(--mat-sys-pressed-state-layer-opacity) * 100%), transparent))}.mat-mdc-fab .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-fab-state-layer-color, var(--mat-sys-on-primary-container))}.mat-mdc-fab.mat-mdc-button-disabled .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-fab-disabled-state-layer-color)}.mat-mdc-fab:hover>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-fab-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity))}.mat-mdc-fab.cdk-program-focused>.mat-mdc-button-persistent-ripple::before,.mat-mdc-fab.cdk-keyboard-focused>.mat-mdc-button-persistent-ripple::before,.mat-mdc-fab.mat-mdc-button-disabled-interactive:focus>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-fab-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}.mat-mdc-fab:active>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-fab-pressed-state-layer-opacity, var(--mat-sys-pressed-state-layer-opacity))}.mat-mdc-mini-fab{width:40px;height:40px;background-color:var(--mat-fab-small-container-color, var(--mat-sys-primary-container));border-radius:var(--mat-fab-small-container-shape, var(--mat-sys-corner-medium));color:var(--mat-fab-small-foreground-color, var(--mat-sys-on-primary-container, inherit));box-shadow:var(--mat-fab-small-container-elevation-shadow, var(--mat-sys-level3))}.mat-mdc-mini-fab:hover{box-shadow:var(--mat-fab-small-hover-container-elevation-shadow, var(--mat-sys-level4))}.mat-mdc-mini-fab:focus{box-shadow:var(--mat-fab-small-focus-container-elevation-shadow, var(--mat-sys-level3))}.mat-mdc-mini-fab:active,.mat-mdc-mini-fab:focus:active{box-shadow:var(--mat-fab-small-pressed-container-elevation-shadow, var(--mat-sys-level3))}.mat-mdc-mini-fab[disabled],.mat-mdc-mini-fab.mat-mdc-button-disabled{cursor:default;pointer-events:none;color:var(--mat-fab-small-disabled-state-foreground-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));background-color:var(--mat-fab-small-disabled-state-container-color, color-mix(in srgb, var(--mat-sys-on-surface) 12%, transparent))}.mat-mdc-mini-fab.mat-mdc-button-disabled-interactive{pointer-events:auto}.mat-mdc-mini-fab .mat-mdc-button-touch-target{position:absolute;top:50%;height:48px;display:var(--mat-fab-small-touch-target-display);left:50%;width:48px;transform:translate(-50%, -50%)}.mat-mdc-mini-fab .mat-ripple-element{background-color:var(--mat-fab-small-ripple-color, color-mix(in srgb, var(--mat-sys-on-primary-container) calc(var(--mat-sys-pressed-state-layer-opacity) * 100%), transparent))}.mat-mdc-mini-fab .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-fab-small-state-layer-color, var(--mat-sys-on-primary-container))}.mat-mdc-mini-fab.mat-mdc-button-disabled .mat-mdc-button-persistent-ripple::before{background-color:var(--mat-fab-small-disabled-state-layer-color)}.mat-mdc-mini-fab:hover>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-fab-small-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity))}.mat-mdc-mini-fab.cdk-program-focused>.mat-mdc-button-persistent-ripple::before,.mat-mdc-mini-fab.cdk-keyboard-focused>.mat-mdc-button-persistent-ripple::before,.mat-mdc-mini-fab.mat-mdc-button-disabled-interactive:focus>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-fab-small-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}.mat-mdc-mini-fab:active>.mat-mdc-button-persistent-ripple::before{opacity:var(--mat-fab-small-pressed-state-layer-opacity, var(--mat-sys-pressed-state-layer-opacity))}.mat-mdc-extended-fab{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;padding-left:20px;padding-right:20px;width:auto;max-width:100%;line-height:normal;box-shadow:var(--mat-fab-extended-container-elevation-shadow, var(--mat-sys-level3));height:var(--mat-fab-extended-container-height, 56px);border-radius:var(--mat-fab-extended-container-shape, var(--mat-sys-corner-large));font-family:var(--mat-fab-extended-label-text-font, var(--mat-sys-label-large-font));font-size:var(--mat-fab-extended-label-text-size, var(--mat-sys-label-large-size));font-weight:var(--mat-fab-extended-label-text-weight, var(--mat-sys-label-large-weight));letter-spacing:var(--mat-fab-extended-label-text-tracking, var(--mat-sys-label-large-tracking))}.mat-mdc-extended-fab:hover{box-shadow:var(--mat-fab-extended-hover-container-elevation-shadow, var(--mat-sys-level4))}.mat-mdc-extended-fab:focus{box-shadow:var(--mat-fab-extended-focus-container-elevation-shadow, var(--mat-sys-level3))}.mat-mdc-extended-fab:active,.mat-mdc-extended-fab:focus:active{box-shadow:var(--mat-fab-extended-pressed-container-elevation-shadow, var(--mat-sys-level3))}.mat-mdc-extended-fab[disabled],.mat-mdc-extended-fab.mat-mdc-button-disabled{cursor:default;pointer-events:none}.mat-mdc-extended-fab[disabled],.mat-mdc-extended-fab[disabled]:focus,.mat-mdc-extended-fab.mat-mdc-button-disabled,.mat-mdc-extended-fab.mat-mdc-button-disabled:focus{box-shadow:none}.mat-mdc-extended-fab.mat-mdc-button-disabled-interactive{pointer-events:auto}[dir=rtl] .mat-mdc-extended-fab .mdc-button__label+.mat-icon,[dir=rtl] .mat-mdc-extended-fab .mdc-button__label+.material-icons,.mat-mdc-extended-fab>.mat-icon,.mat-mdc-extended-fab>.material-icons{margin-left:-8px;margin-right:12px}.mat-mdc-extended-fab .mdc-button__label+.mat-icon,.mat-mdc-extended-fab .mdc-button__label+.material-icons,[dir=rtl] .mat-mdc-extended-fab>.mat-icon,[dir=rtl] .mat-mdc-extended-fab>.material-icons{margin-left:12px;margin-right:-8px}.mat-mdc-extended-fab .mat-mdc-button-touch-target{width:100%}\n']
    }]
  }], () => [], null);
})();
var MatButtonModule = class _MatButtonModule {
  static \u0275fac = function MatButtonModule_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _MatButtonModule)();
  };
  static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
    type: _MatButtonModule,
    imports: [MatCommonModule, MatRippleModule, MatButton, MatMiniFabButton, MatIconButton, MatFabButton],
    exports: [MatCommonModule, MatButton, MatMiniFabButton, MatIconButton, MatFabButton]
  });
  static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({
    imports: [MatCommonModule, MatRippleModule, MatCommonModule]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatButtonModule, [{
    type: NgModule,
    args: [{
      imports: [MatCommonModule, MatRippleModule, MatButton, MatMiniFabButton, MatIconButton, MatFabButton],
      exports: [MatCommonModule, MatButton, MatMiniFabButton, MatIconButton, MatFabButton]
    }]
  }], null, null);
})();

// src/app/error-dialog/error-dialog.component.ts
function ErrorDialogComponent_Conditional_3_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "p")(1, "b");
    \u0275\u0275text(2);
    \u0275\u0275elementEnd()();
  }
  if (rf & 2) {
    const ctx_r0 = \u0275\u0275nextContext();
    \u0275\u0275advance(2);
    \u0275\u0275textInterpolate1("Status Code: ", ctx_r0.data.status);
  }
}
function ErrorDialogComponent_Conditional_9_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "p");
    \u0275\u0275text(1, "Error body");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(2, "p", 3);
    \u0275\u0275text(3);
    \u0275\u0275pipe(4, "json");
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const ctx_r0 = \u0275\u0275nextContext();
    \u0275\u0275advance(3);
    \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(4, 1, (ctx_r0.data == null ? null : ctx_r0.data.error == null ? null : ctx_r0.data.error.detail) ?? (ctx_r0.data == null ? null : ctx_r0.data.error)), " ");
  }
}
var ErrorDialogComponent = class _ErrorDialogComponent {
  data = inject2(MAT_DIALOG_DATA);
  static \u0275fac = function ErrorDialogComponent_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _ErrorDialogComponent)();
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _ErrorDialogComponent, selectors: [["app-error-dialog"]], decls: 13, vars: 3, consts: [["mat-dialog-title", ""], ["mat-dialog-content", ""], [1, "w-full", "h-full", "overflow-auto"], [1, "error-message", "w-fit", "h-fit"], ["mat-dialog-actions", ""], ["mat-raised-button", "", "mat-dialog-close", "", "color", "primary"]], template: function ErrorDialogComponent_Template(rf, ctx) {
    if (rf & 1) {
      \u0275\u0275elementStart(0, "h1", 0);
      \u0275\u0275text(1, "An error has occurred \u{1F61E}");
      \u0275\u0275elementEnd();
      \u0275\u0275elementStart(2, "div", 1);
      \u0275\u0275conditionalCreate(3, ErrorDialogComponent_Conditional_3_Template, 3, 1, "p");
      \u0275\u0275elementStart(4, "p");
      \u0275\u0275text(5, "Error message");
      \u0275\u0275elementEnd();
      \u0275\u0275elementStart(6, "div", 2)(7, "p", 3);
      \u0275\u0275text(8);
      \u0275\u0275elementEnd()();
      \u0275\u0275conditionalCreate(9, ErrorDialogComponent_Conditional_9_Template, 5, 3);
      \u0275\u0275elementEnd();
      \u0275\u0275elementStart(10, "div", 4)(11, "button", 5);
      \u0275\u0275text(12, "Close");
      \u0275\u0275elementEnd()();
    }
    if (rf & 2) {
      \u0275\u0275advance(3);
      \u0275\u0275conditional(ctx.data.status ? 3 : -1);
      \u0275\u0275advance(5);
      \u0275\u0275textInterpolate1(" ", (ctx.data == null ? null : ctx.data.stack) ?? (ctx.data == null ? null : ctx.data.message) ?? "Undefined client error", " ");
      \u0275\u0275advance();
      \u0275\u0275conditional(ctx.data.error ? 9 : -1);
    }
  }, dependencies: [
    MatDialogContent,
    MatDialogTitle,
    MatDialogActions,
    MatButton,
    MatDialogClose,
    JsonPipe
  ], styles: ["\n\n.error-message[_ngcontent-%COMP%] {\n  background: #eee;\n  padding: 1rem;\n  font-family: monospace;\n  white-space: preserve nowrap;\n}\n/*# sourceMappingURL=/static/error-dialog.component-HYLQSJEP.css.map */"], changeDetection: 0 });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ErrorDialogComponent, [{
    type: Component,
    args: [{ selector: "app-error-dialog", imports: [
      MatDialogContent,
      MatDialogTitle,
      MatDialogActions,
      MatButton,
      MatDialogClose,
      JsonPipe
    ], changeDetection: ChangeDetectionStrategy.OnPush, template: '<h1 mat-dialog-title>An error has occurred \u{1F61E}</h1>\n<div mat-dialog-content>\n  @if (data.status) {\n    <p>\n      <b>Status Code: {{ data.status }}</b>\n    </p>\n  }\n  <p>Error message</p>\n  <div class="w-full h-full overflow-auto">\n    <p class="error-message w-fit h-fit">\n      {{ data?.stack ?? data?.message ?? "Undefined client error" }}\n    </p>\n  </div>\n  @if (data.error) {\n    <p>Error body</p>\n    <p class="error-message w-fit h-fit">\n      {{ data?.error?.detail ?? data?.error | json }}\n    </p>\n  }\n</div>\n<div mat-dialog-actions>\n  <button mat-raised-button mat-dialog-close color="primary">Close</button>\n</div>\n', styles: ["/* src/app/error-dialog/error-dialog.component.css */\n.error-message {\n  background: #eee;\n  padding: 1rem;\n  font-family: monospace;\n  white-space: preserve nowrap;\n}\n/*# sourceMappingURL=/static/error-dialog.component-HYLQSJEP.css.map */\n"] }]
  }], null, null);
})();
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(ErrorDialogComponent, { className: "ErrorDialogComponent", filePath: "src/app/error-dialog/error-dialog.component.ts", lineNumber: 26 });
})();

// src/app/error-dialog.service.ts
var ErrorDialogService = class _ErrorDialogService {
  dialog;
  opened = false;
  constructor(dialog) {
    this.dialog = dialog;
  }
  openDialog(error) {
    if (!this.opened) {
      this.opened = true;
      const dialogRef = this.dialog.open(ErrorDialogComponent, {
        data: error,
        maxWidth: "100%",
        disableClose: true,
        hasBackdrop: true
      });
      dialogRef.afterClosed().subscribe(() => {
        this.opened = false;
      });
    }
  }
  static \u0275fac = function ErrorDialogService_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _ErrorDialogService)(\u0275\u0275inject(MatDialog));
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _ErrorDialogService, factory: _ErrorDialogService.\u0275fac, providedIn: "root" });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ErrorDialogService, [{
    type: Injectable,
    args: [{
      providedIn: "root"
    }]
  }], () => [{ type: MatDialog }], null);
})();

// src/app/global-error-handler.service.ts
var GlobalErrorHandler = class _GlobalErrorHandler {
  loadingService = inject2(LoadingService);
  errorDialogService = inject2(ErrorDialogService);
  handleError(error) {
    this.loadingService.isLoading.set(false);
    this.errorDialogService.openDialog(error);
    console.error(error);
  }
  static \u0275fac = function GlobalErrorHandler_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _GlobalErrorHandler)();
  };
  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _GlobalErrorHandler, factory: _GlobalErrorHandler.\u0275fac });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(GlobalErrorHandler, [{
    type: Injectable
  }], null, null);
})();

// node_modules/highlight.js/es/languages/yaml.js
function yaml(hljs) {
  const LITERALS = "true false yes no null";
  const URI_CHARACTERS = "[\\w#;/?:@&=+$,.~*'()[\\]]+";
  const KEY = {
    className: "attr",
    variants: [
      // added brackets support and special char support
      { begin: /[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/ },
      {
        // double quoted keys - with brackets and special char support
        begin: /"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/
      },
      {
        // single quoted keys - with brackets and special char support
        begin: /'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/
      }
    ]
  };
  const TEMPLATE_VARIABLES = {
    className: "template-variable",
    variants: [
      {
        // jinja templates Ansible
        begin: /\{\{/,
        end: /\}\}/
      },
      {
        // Ruby i18n
        begin: /%\{/,
        end: /\}/
      }
    ]
  };
  const SINGLE_QUOTE_STRING = {
    className: "string",
    relevance: 0,
    begin: /'/,
    end: /'/,
    contains: [
      {
        match: /''/,
        scope: "char.escape",
        relevance: 0
      }
    ]
  };
  const STRING = {
    className: "string",
    relevance: 0,
    variants: [
      {
        begin: /"/,
        end: /"/
      },
      { begin: /\S+/ }
    ],
    contains: [
      hljs.BACKSLASH_ESCAPE,
      TEMPLATE_VARIABLES
    ]
  };
  const CONTAINER_STRING = hljs.inherit(STRING, { variants: [
    {
      begin: /'/,
      end: /'/,
      contains: [
        {
          begin: /''/,
          relevance: 0
        }
      ]
    },
    {
      begin: /"/,
      end: /"/
    },
    { begin: /[^\s,{}[\]]+/ }
  ] });
  const DATE_RE = "[0-9]{4}(-[0-9][0-9]){0,2}";
  const TIME_RE = "([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?";
  const FRACTION_RE = "(\\.[0-9]*)?";
  const ZONE_RE = "([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?";
  const TIMESTAMP = {
    className: "number",
    begin: "\\b" + DATE_RE + TIME_RE + FRACTION_RE + ZONE_RE + "\\b"
  };
  const VALUE_CONTAINER = {
    end: ",",
    endsWithParent: true,
    excludeEnd: true,
    keywords: LITERALS,
    relevance: 0
  };
  const OBJECT = {
    begin: /\{/,
    end: /\}/,
    contains: [VALUE_CONTAINER],
    illegal: "\\n",
    relevance: 0
  };
  const ARRAY = {
    begin: "\\[",
    end: "\\]",
    contains: [VALUE_CONTAINER],
    illegal: "\\n",
    relevance: 0
  };
  const MODES = [
    KEY,
    {
      className: "meta",
      begin: "^---\\s*$",
      relevance: 10
    },
    {
      // multi line string
      // Blocks start with a | or > followed by a newline
      //
      // Indentation of subsequent lines must be the same to
      // be considered part of the block
      className: "string",
      begin: "[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"
    },
    {
      // Ruby/Rails erb
      begin: "<%[%=-]?",
      end: "[%-]?%>",
      subLanguage: "ruby",
      excludeBegin: true,
      excludeEnd: true,
      relevance: 0
    },
    {
      // named tags
      className: "type",
      begin: "!\\w+!" + URI_CHARACTERS
    },
    // https://yaml.org/spec/1.2/spec.html#id2784064
    {
      // verbatim tags
      className: "type",
      begin: "!<" + URI_CHARACTERS + ">"
    },
    {
      // primary tags
      className: "type",
      begin: "!" + URI_CHARACTERS
    },
    {
      // secondary tags
      className: "type",
      begin: "!!" + URI_CHARACTERS
    },
    {
      // fragment id &ref
      className: "meta",
      begin: "&" + hljs.UNDERSCORE_IDENT_RE + "$"
    },
    {
      // fragment reference *ref
      className: "meta",
      begin: "\\*" + hljs.UNDERSCORE_IDENT_RE + "$"
    },
    {
      // array listing
      className: "bullet",
      // TODO: remove |$ hack when we have proper look-ahead support
      begin: "-(?=[ ]|$)",
      relevance: 0
    },
    hljs.HASH_COMMENT_MODE,
    {
      beginKeywords: LITERALS,
      keywords: { literal: LITERALS }
    },
    TIMESTAMP,
    // numbers are any valid C-style number that
    // sit isolated from other words
    {
      className: "number",
      begin: hljs.C_NUMBER_RE + "\\b",
      relevance: 0
    },
    OBJECT,
    ARRAY,
    SINGLE_QUOTE_STRING,
    STRING
  ];
  const VALUE_MODES = [...MODES];
  VALUE_MODES.pop();
  VALUE_MODES.push(CONTAINER_STRING);
  VALUE_CONTAINER.contains = VALUE_MODES;
  return {
    name: "YAML",
    case_insensitive: true,
    aliases: ["yml"],
    contains: MODES
  };
}

// src/app/app.config.ts
core_default.registerLanguage("yaml", yaml);
var appConfig = {
  providers: [
    provideZonelessChangeDetection(),
    provideRouter(routes, withComponentInputBinding()),
    // Trying this out. It will popup any error into a dialog.
    { provide: ErrorHandler, useClass: GlobalErrorHandler },
    provideBrowserGlobalErrorListeners(),
    provideHttpClient()
  ]
};

// src/app/project-settings/project-settings.component.ts
function ProjectSettingsComponent_Conditional_1_Template(rf, ctx) {
  if (rf & 1) {
    const _r1 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "button", 13);
    \u0275\u0275listener("click", function ProjectSettingsComponent_Conditional_1_Template_button_click_0_listener() {
      \u0275\u0275restoreView(_r1);
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.done.emit(null));
    });
    \u0275\u0275text(1, " \u2715 ");
    \u0275\u0275elementEnd();
  }
}
function ProjectSettingsComponent_Conditional_3_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275text(0, " Setup ");
  }
}
function ProjectSettingsComponent_Conditional_4_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275text(0, " Settings ");
  }
}
function ProjectSettingsComponent_Conditional_24_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "form", 9)(1, "fieldset", 14)(2, "p", 15);
    \u0275\u0275text(3, " Configure the directories that the app uses for this project. ");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(4, "h3", 16);
    \u0275\u0275text(5, "Data directory");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(6, "p", 15);
    \u0275\u0275text(7, "Set the data directory for this project.");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(8, "p", 15);
    \u0275\u0275text(9, " For new projects, create a directory at a location of your choice and place your videos in the ");
    \u0275\u0275elementStart(10, "code");
    \u0275\u0275text(11, "videos");
    \u0275\u0275elementEnd();
    \u0275\u0275text(12, " subdirectory. ");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(13, "div", 17);
    \u0275\u0275element(14, "input", 18);
    \u0275\u0275elementStart(15, "div", 19)(16, "span", 6);
    \u0275\u0275text(17, "help_outline");
    \u0275\u0275elementEnd();
    \u0275\u0275text(18, " More info ");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(19, "div", 20);
    \u0275\u0275text(20, " It is not strictly necessary for videos to be in a subdirectory called ");
    \u0275\u0275elementStart(21, "code");
    \u0275\u0275text(22, "videos");
    \u0275\u0275elementEnd();
    \u0275\u0275text(23, ", but this is a sensible default for most setups. ");
    \u0275\u0275elementStart(24, "ul", 21)(25, "li");
    \u0275\u0275text(26, " In the Viewer module, this is the root search directory for video files, including its subdirectories. ");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(27, "li");
    \u0275\u0275text(28, " In the Labeler module, this is the root search directory for label CSV files, including its subdirectories. Paths referenced from label files are relative to this directory. The labeler always extracts frames to the ");
    \u0275\u0275elementStart(29, "code");
    \u0275\u0275text(30, "labeled_data");
    \u0275\u0275elementEnd();
    \u0275\u0275text(31, " subdirectory. ");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(32, "li");
    \u0275\u0275text(33, " In the Models module, this is the root search directory for label files and extracted frames for supervised training, and videos for semi-supervised training. ");
    \u0275\u0275elementEnd()()()();
    \u0275\u0275elementStart(34, "div", 22)(35, "span", 23);
    \u0275\u0275text(36, "folder");
    \u0275\u0275elementEnd();
    \u0275\u0275element(37, "input", 24);
    \u0275\u0275elementEnd()();
    \u0275\u0275elementStart(38, "fieldset", 25)(39, "h3", 16);
    \u0275\u0275text(40, "Model directory");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(41, "p", 15);
    \u0275\u0275text(42, "Set the model directory for the project.");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(43, "p", 15);
    \u0275\u0275text(44, " For new projects, our recommendation is to create a ");
    \u0275\u0275elementStart(45, "code");
    \u0275\u0275text(46, "models");
    \u0275\u0275elementEnd();
    \u0275\u0275text(47, " subdirectory of your data directory. ");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(48, "div", 17);
    \u0275\u0275element(49, "input", 18);
    \u0275\u0275elementStart(50, "div", 19)(51, "span", 6);
    \u0275\u0275text(52, "help_outline");
    \u0275\u0275elementEnd();
    \u0275\u0275text(53, " More info ");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(54, "div", 20)(55, "ul", 21)(56, "li");
    \u0275\u0275text(57, " In the Models module, this is the search directory for model directories. New models are placed in this directory. ");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(58, "li");
    \u0275\u0275text(59, " In the Viewer module, this is the root search directory for model predictions including subdirectories. ");
    \u0275\u0275elementEnd()()()();
    \u0275\u0275elementStart(60, "div", 22)(61, "span", 23);
    \u0275\u0275text(62, "folder");
    \u0275\u0275elementEnd();
    \u0275\u0275element(63, "input", 26);
    \u0275\u0275elementEnd()()();
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext();
    \u0275\u0275property("formGroup", ctx_r1.projectInfoForm);
  }
}
function ProjectSettingsComponent_Conditional_25_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "form", 9)(1, "fieldset", 14)(2, "h3", 27);
    \u0275\u0275text(3, "Camera view names");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(4, "p", 15);
    \u0275\u0275text(5, " Enter the names of the camera views, or leave blank if this is a single view project. ");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(6, "p", 15);
    \u0275\u0275text(7, " Used to group multiview files. Sessions are identified by removing the view name from the video filename. Label CSV files are similarly grouped. ");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(8, "p", 15);
    \u0275\u0275text(9, " Filenames should embed the view name delimited by underscore or hyphen. For example, ");
    \u0275\u0275elementStart(10, "code");
    \u0275\u0275text(11, "video_01_front.mp4");
    \u0275\u0275elementEnd();
    \u0275\u0275text(12, " or ");
    \u0275\u0275elementStart(13, "code");
    \u0275\u0275text(14, "video_01-front.mp4");
    \u0275\u0275elementEnd();
    \u0275\u0275text(15, " are valid, but not ");
    \u0275\u0275elementStart(16, "code");
    \u0275\u0275text(17, "video_01front.mp4");
    \u0275\u0275elementEnd();
    \u0275\u0275text(18, ". ");
    \u0275\u0275elementEnd();
    \u0275\u0275element(19, "textarea", 28);
    \u0275\u0275elementStart(20, "p");
    \u0275\u0275text(21);
    \u0275\u0275pipe(22, "json");
    \u0275\u0275elementEnd()()();
  }
  if (rf & 2) {
    let tmp_4_0;
    const ctx_r1 = \u0275\u0275nextContext();
    \u0275\u0275property("formGroup", ctx_r1.projectInfoForm);
    \u0275\u0275advance(19);
    \u0275\u0275property("rows", ctx_r1.viewsInitialRows())("placeholder", ctx_r1.cameraViewPlaceholder);
    \u0275\u0275advance(2);
    \u0275\u0275textInterpolate1(" Parsed: ", \u0275\u0275pipeBind1(22, 4, ctx_r1.parseTextAsList((tmp_4_0 = ctx_r1.projectInfoForm.get("views")) == null ? null : tmp_4_0.value)), " ");
  }
}
function ProjectSettingsComponent_Conditional_26_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "form", 9)(1, "fieldset", 14)(2, "h3", 27);
    \u0275\u0275text(3, "Keypoint names");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(4, "p", 15);
    \u0275\u0275text(5, " Enter the names of the keypoints to label. This is also the labeling order of the keypoints. ");
    \u0275\u0275elementEnd();
    \u0275\u0275element(6, "textarea", 29);
    \u0275\u0275elementStart(7, "p");
    \u0275\u0275text(8);
    \u0275\u0275pipe(9, "json");
    \u0275\u0275elementEnd()()();
  }
  if (rf & 2) {
    let tmp_3_0;
    const ctx_r1 = \u0275\u0275nextContext();
    \u0275\u0275property("formGroup", ctx_r1.projectInfoForm);
    \u0275\u0275advance(6);
    \u0275\u0275property("rows", ctx_r1.keypointInitialRows());
    \u0275\u0275advance(2);
    \u0275\u0275textInterpolate1(" Parsed: ", \u0275\u0275pipeBind1(9, 3, ctx_r1.parseTextAsList((tmp_3_0 = ctx_r1.projectInfoForm.get("keypointNames")) == null ? null : tmp_3_0.value)), " ");
  }
}
var ProjectSettingsComponent = class _ProjectSettingsComponent {
  done = output();
  setupMode = input(false, ...ngDevMode ? [{ debugName: "setupMode" }] : []);
  selectedTab = signal("directories", ...ngDevMode ? [{ debugName: "selectedTab" }] : []);
  projectInfoForm;
  viewsInitialRows = signal(4, ...ngDevMode ? [{ debugName: "viewsInitialRows" }] : []);
  keypointInitialRows = signal(4, ...ngDevMode ? [{ debugName: "keypointInitialRows" }] : []);
  projectInfoService = inject2(ProjectInfoService);
  fb = inject2(FormBuilder);
  constructor() {
    this.projectInfoForm = this.fb.group({
      dataDir: "",
      modelDir: "",
      views: [""],
      keypointNames: [""]
    });
  }
  ngOnInit() {
    const projectInfo = this.projectInfoService.projectInfo;
    if (projectInfo) {
      this.projectInfoForm.patchValue({
        dataDir: projectInfo.data_dir,
        modelDir: projectInfo.model_dir,
        views: projectInfo.views.join("\n"),
        keypointNames: projectInfo.keypoint_names.join("\n")
      });
      this.projectInfoForm.markAsPristine();
      this.viewsInitialRows.update((x) => Math.max(x, projectInfo.views.length));
      this.keypointInitialRows.update((x) => Math.max(x, projectInfo.keypoint_names.length));
    }
  }
  async onSaveClick() {
    this.saveSuccessMessage.set("");
    if (this.saveSuccessMessageClearTimerId) {
      clearInterval(this.saveSuccessMessageClearTimerId);
      this.saveSuccessMessageClearTimerId = 0;
    }
    const projectInfo = {};
    if (this.projectInfoForm.get("dataDir")?.dirty) {
      projectInfo.data_dir = this.projectInfoForm.get("dataDir")?.value ?? "";
    }
    if (this.projectInfoForm.get("modelDir")?.dirty) {
      projectInfo.model_dir = this.projectInfoForm.get("modelDir")?.value ?? "";
    }
    if (this.projectInfoForm.get("views")?.dirty) {
      projectInfo.views = this.parseTextAsList(this.projectInfoForm.get("views")?.value ?? "");
    }
    if (this.projectInfoForm.get("keypointNames")?.dirty) {
      projectInfo.keypoint_names = this.parseTextAsList(this.projectInfoForm.get("keypointNames")?.value ?? "");
    }
    await this.projectInfoService.setProjectInfo(projectInfo);
    this.saveSuccessMessage.set("Saved. Refresh the page for changes to take effect.");
    this.saveSuccessMessageClearTimerId = setTimeout(() => {
      this.saveSuccessMessage.set("");
      this.saveSuccessMessageClearTimerId = 0;
    }, 5e3);
  }
  parseTextAsList(text) {
    return text.replace(/[^\w\-]/g, " ").split(/\s+/).filter(Boolean);
  }
  cameraViewPlaceholder = `view1
view2
...`;
  saveSuccessMessage = signal("", ...ngDevMode ? [{ debugName: "saveSuccessMessage" }] : []);
  saveSuccessMessageClearTimerId = 0;
  handleTabClick(tabKey) {
    this.selectedTab.set(tabKey);
  }
  handleCloseClick() {
  }
  static \u0275fac = function ProjectSettingsComponent_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _ProjectSettingsComponent)();
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _ProjectSettingsComponent, selectors: [["app-project-settings"]], inputs: { setupMode: [1, "setupMode"] }, outputs: { done: "done" }, decls: 32, vars: 13, consts: [[1, "flex", "flex-col", "h-full"], [1, "btn", "btn-md", "btn-circle", "btn-ghost", "absolute", "right-4", "top-4"], [1, "text-xl", "font-bold", "mb-4", "shrink-0"], [1, "flex", "gap-2", "w-full", "grow", "shrink", "min-h-0"], [1, "menu", "min-w-40"], ["tabindex", "0", 3, "click", "keydown.enter"], [1, "material-icons", "text-sm!"], [1, "divider", "divider-vertical"], [1, "overflow-y-auto"], [1, "prose", "px-4", 3, "formGroup"], [1, "shrink-0", "modal-action"], [1, "text-sm", "text-info"], [1, "btn", "btn-soft", "btn-primary", 3, "click", "disabled"], [1, "btn", "btn-md", "btn-circle", "btn-ghost", "absolute", "right-4", "top-4", 3, "click"], [1, "fieldset", "my-6"], [1, "m-0!"], [1, "text-md"], [1, "collapse", "collapse-plus"], ["type", "checkbox"], [1, "collapse-title", "font-semibold", "flex", "items-center", "gap-1"], [1, "collapse-content"], [1, "mt-0!"], [1, "input", "w-full"], [1, "material-icons", "!text-sm", "opacity-50"], ["formControlName", "dataDir", "type", "text", "placeholder", "/", "spellcheck", "false", 1, "grow"], [1, "my-4", "fieldset"], ["formControlName", "modelDir", "type", "text", "placeholder", "/", "spellcheck", "false", 1, "grow"], [1, "text-md", "mt-0!"], ["formControlName", "views", "spellcheck", "false", 1, "textarea", "w-full", 3, "rows", "placeholder"], ["formControlName", "keypointNames", "spellcheck", "false", 1, "textarea", "w-full", 3, "rows"]], template: function ProjectSettingsComponent_Template(rf, ctx) {
    if (rf & 1) {
      \u0275\u0275elementStart(0, "div", 0);
      \u0275\u0275conditionalCreate(1, ProjectSettingsComponent_Conditional_1_Template, 2, 0, "button", 1);
      \u0275\u0275elementStart(2, "h3", 2);
      \u0275\u0275conditionalCreate(3, ProjectSettingsComponent_Conditional_3_Template, 1, 0)(4, ProjectSettingsComponent_Conditional_4_Template, 1, 0);
      \u0275\u0275elementEnd();
      \u0275\u0275elementStart(5, "div", 3)(6, "ul", 4)(7, "li")(8, "a", 5);
      \u0275\u0275listener("click", function ProjectSettingsComponent_Template_a_click_8_listener() {
        return ctx.handleTabClick("directories");
      })("keydown.enter", function ProjectSettingsComponent_Template_a_keydown_enter_8_listener() {
        return ctx.handleTabClick("directories");
      });
      \u0275\u0275elementStart(9, "span", 6);
      \u0275\u0275text(10, "folder");
      \u0275\u0275elementEnd();
      \u0275\u0275text(11, "Directories");
      \u0275\u0275elementEnd()();
      \u0275\u0275elementStart(12, "li")(13, "a", 5);
      \u0275\u0275listener("click", function ProjectSettingsComponent_Template_a_click_13_listener() {
        return ctx.handleTabClick("keypoints");
      })("keydown.enter", function ProjectSettingsComponent_Template_a_keydown_enter_13_listener() {
        return ctx.handleTabClick("keypoints");
      });
      \u0275\u0275elementStart(14, "span", 6);
      \u0275\u0275text(15, "adjust");
      \u0275\u0275elementEnd();
      \u0275\u0275text(16, "Keypoints");
      \u0275\u0275elementEnd()();
      \u0275\u0275elementStart(17, "li")(18, "a", 5);
      \u0275\u0275listener("click", function ProjectSettingsComponent_Template_a_click_18_listener() {
        return ctx.handleTabClick("multiview");
      })("keydown.enter", function ProjectSettingsComponent_Template_a_keydown_enter_18_listener() {
        return ctx.handleTabClick("multiview");
      });
      \u0275\u0275elementStart(19, "span", 6);
      \u0275\u0275text(20, "camera_alt");
      \u0275\u0275elementEnd();
      \u0275\u0275text(21, "Multiview");
      \u0275\u0275elementEnd()()();
      \u0275\u0275element(22, "div", 7);
      \u0275\u0275elementStart(23, "div", 8);
      \u0275\u0275conditionalCreate(24, ProjectSettingsComponent_Conditional_24_Template, 64, 1, "form", 9);
      \u0275\u0275conditionalCreate(25, ProjectSettingsComponent_Conditional_25_Template, 23, 6, "form", 9);
      \u0275\u0275conditionalCreate(26, ProjectSettingsComponent_Conditional_26_Template, 10, 5, "form", 9);
      \u0275\u0275elementEnd()();
      \u0275\u0275elementStart(27, "footer", 10)(28, "p", 11);
      \u0275\u0275text(29);
      \u0275\u0275elementEnd();
      \u0275\u0275elementStart(30, "button", 12);
      \u0275\u0275listener("click", function ProjectSettingsComponent_Template_button_click_30_listener() {
        return ctx.onSaveClick();
      });
      \u0275\u0275text(31, " Save ");
      \u0275\u0275elementEnd()()();
    }
    if (rf & 2) {
      \u0275\u0275advance();
      \u0275\u0275conditional(!ctx.setupMode() ? 1 : -1);
      \u0275\u0275advance(2);
      \u0275\u0275conditional(ctx.setupMode() ? 3 : 4);
      \u0275\u0275advance(5);
      \u0275\u0275classProp("menu-active", ctx.selectedTab() === "directories");
      \u0275\u0275advance(5);
      \u0275\u0275classProp("menu-active", ctx.selectedTab() === "keypoints");
      \u0275\u0275advance(5);
      \u0275\u0275classProp("menu-active", ctx.selectedTab() === "multiview");
      \u0275\u0275advance(6);
      \u0275\u0275conditional(ctx.selectedTab() === "directories" ? 24 : -1);
      \u0275\u0275advance();
      \u0275\u0275conditional(ctx.selectedTab() === "multiview" ? 25 : -1);
      \u0275\u0275advance();
      \u0275\u0275conditional(ctx.selectedTab() === "keypoints" ? 26 : -1);
      \u0275\u0275advance(3);
      \u0275\u0275textInterpolate(ctx.saveSuccessMessage());
      \u0275\u0275advance();
      \u0275\u0275property("disabled", !ctx.projectInfoForm.dirty);
    }
  }, dependencies: [ReactiveFormsModule, \u0275NgNoValidate, DefaultValueAccessor, NgControlStatus, NgControlStatusGroup, FormGroupDirective, FormControlName, JsonPipe], styles: ["\n\ninput[_ngcontent-%COMP%]::placeholder {\n  color: color-mix(in oklab, var(--color-base-content) 50%, #0000) !important;\n}\n/*# sourceMappingURL=/static/project-settings.component-M7JLU4LS.css.map */", "\n\n[_ngcontent-%COMP%]::placeholder {\n  color: color-mix(in oklch, currentColor 50%, #0000) !important;\n}\n/*# sourceMappingURL=/static/project-settings.component-5IRK7U7U.css.map */"], changeDetection: 0 });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ProjectSettingsComponent, [{
    type: Component,
    args: [{ selector: "app-project-settings", imports: [ReactiveFormsModule, JsonPipe], changeDetection: ChangeDetectionStrategy.OnPush, template: `<style>
  ::placeholder {
    /** bring back the default style from daisy. dont know why it's getting overridden. */
    color: color-mix(in oklch, currentColor 50%, #0000) !important;
  }
</style>

<div class="flex flex-col h-full">
  @if (!setupMode()) {
    <button
      class="btn btn-md btn-circle btn-ghost absolute right-4 top-4"
      (click)="done.emit(null)"
    >
      \u2715
    </button>
  }
  <h3 class="text-xl font-bold mb-4 shrink-0">
    @if (setupMode()) {
      Setup
    } @else {
      Settings
    }
  </h3>

  <div class="flex gap-2 w-full grow shrink min-h-0">
    <ul class="menu min-w-40">
      <li>
        <a
          [class.menu-active]="selectedTab() === 'directories'"
          tabindex="0"
          (click)="handleTabClick('directories')"
          (keydown.enter)="handleTabClick('directories')"
        >
          <span class="material-icons text-sm!">folder</span>Directories</a
        >
      </li>
      <li>
        <a
          [class.menu-active]="selectedTab() === 'keypoints'"
          tabindex="0"
          (click)="handleTabClick('keypoints')"
          (keydown.enter)="handleTabClick('keypoints')"
          ><span class="material-icons text-sm!">adjust</span>Keypoints</a
        >
      </li>
      <li>
        <a
          [class.menu-active]="selectedTab() === 'multiview'"
          tabindex="0"
          (click)="handleTabClick('multiview')"
          (keydown.enter)="handleTabClick('multiview')"
          ><span class="material-icons text-sm!">camera_alt</span>Multiview</a
        >
      </li>
    </ul>
    <div class="divider divider-vertical"></div>
    <div class="overflow-y-auto">
      @if (selectedTab() === "directories") {
        <form [formGroup]="projectInfoForm" class="prose px-4">
          <fieldset class="fieldset my-6">
            <p class="m-0!">
              Configure the directories that the app uses for this project.
            </p>
            <h3 class="text-md">Data directory</h3>
            <p class="m-0!">Set the data directory for this project.</p>
            <p class="m-0!">
              For new projects, create a directory at a location of your choice
              and place your videos in the <code>videos</code> subdirectory.
            </p>
            <div class="collapse collapse-plus">
              <input type="checkbox" />
              <div class="collapse-title font-semibold flex items-center gap-1">
                <span class="material-icons text-sm!">help_outline</span>
                More info
              </div>
              <div class="collapse-content">
                It is not strictly necessary for videos to be in a subdirectory
                called <code>videos</code>, but this is a sensible default for
                most setups.
                <ul class="mt-0!">
                  <li>
                    In the Viewer module, this is the root search directory for
                    video files, including its subdirectories.
                  </li>
                  <li>
                    In the Labeler module, this is the root search directory for
                    label CSV files, including its subdirectories. Paths
                    referenced from label files are relative to this directory.
                    The labeler always extracts frames to the
                    <code>labeled_data</code> subdirectory.
                  </li>
                  <li>
                    In the Models module, this is the root search directory for
                    label files and extracted frames for supervised training,
                    and videos for semi-supervised training.
                  </li>
                </ul>
              </div>
            </div>
            <div class="input w-full">
              <span class="material-icons !text-sm opacity-50">folder</span>
              <input
                formControlName="dataDir"
                type="text"
                class="grow"
                placeholder="/"
                spellcheck="false"
              />
            </div>
          </fieldset>

          <fieldset class="my-4 fieldset">
            <h3 class="text-md">Model directory</h3>
            <p class="m-0!">Set the model directory for the project.</p>
            <p class="m-0!">
              For new projects, our recommendation is to create a
              <code>models</code> subdirectory of your data directory.
            </p>
            <div class="collapse collapse-plus">
              <input type="checkbox" />
              <div class="collapse-title font-semibold flex items-center gap-1">
                <span class="material-icons text-sm!">help_outline</span>
                More info
              </div>
              <div class="collapse-content">
                <ul class="mt-0!">
                  <li>
                    In the Models module, this is the search directory for model
                    directories. New models are placed in this directory.
                  </li>
                  <li>
                    In the Viewer module, this is the root search directory for
                    model predictions including subdirectories.
                  </li>
                </ul>
              </div>
            </div>

            <div class="input w-full">
              <span class="material-icons !text-sm opacity-50">folder</span>
              <input
                formControlName="modelDir"
                type="text"
                class="grow"
                placeholder="/"
                spellcheck="false"
              />
            </div>
          </fieldset>
        </form>
      }
      @if (selectedTab() === "multiview") {
        <form [formGroup]="projectInfoForm" class="prose px-4">
          <fieldset class="fieldset my-6">
            <h3 class="text-md mt-0!">Camera view names</h3>
            <p class="m-0!">
              Enter the names of the camera views, or leave blank if this is a
              single view project.
            </p>
            <p class="m-0!">
              Used to group multiview files. Sessions are identified by removing
              the view name from the video filename. Label CSV files are
              similarly grouped.
            </p>
            <p class="m-0!">
              Filenames should embed the view name delimited by underscore or
              hyphen. For example,
              <code>video_01_front.mp4</code> or
              <code>video_01-front.mp4</code> are valid, but not
              <code>video_01front.mp4</code>.
            </p>
            <textarea
              class="textarea w-full"
              [rows]="viewsInitialRows()"
              [placeholder]="cameraViewPlaceholder"
              formControlName="views"
              spellcheck="false"
            ></textarea>
            <p>
              Parsed:
              {{ parseTextAsList(projectInfoForm.get("views")?.value) | json }}
            </p>
          </fieldset>
        </form>
      }
      @if (selectedTab() === "keypoints") {
        <form [formGroup]="projectInfoForm" class="prose px-4">
          <fieldset class="fieldset my-6">
            <h3 class="text-md mt-0!">Keypoint names</h3>
            <p class="m-0!">
              Enter the names of the keypoints to label. This is also the
              labeling order of the keypoints.
            </p>
            <textarea
              class="textarea w-full"
              [rows]="keypointInitialRows()"
              formControlName="keypointNames"
              spellcheck="false"
            ></textarea>
            <p>
              Parsed:
              {{
                parseTextAsList(projectInfoForm.get("keypointNames")?.value)
                  | json
              }}
            </p>
          </fieldset>
        </form>
      }
    </div>
  </div>
  <footer class="shrink-0 modal-action">
    <p class="text-sm text-info">{{ saveSuccessMessage() }}</p>
    <button
      class="btn btn-soft btn-primary"
      (click)="onSaveClick()"
      [disabled]="!projectInfoForm.dirty"
    >
      Save
    </button>
  </footer>
</div>
`, styles: ["/* src/app/project-settings/project-settings.component.css */\ninput::placeholder {\n  color: color-mix(in oklab, var(--color-base-content) 50%, #0000) !important;\n}\n/*# sourceMappingURL=/static/project-settings.component-M7JLU4LS.css.map */\n", "/* angular:styles/component:css;5c3484fa86afc1ad339d983c727d8801928706c064dd49a4001f42c8eac3d364;/home/ksikka/lightning-pose-app/web_ui/src/app/project-settings/project-settings.component.html */\n::placeholder {\n  color: color-mix(in oklch, currentColor 50%, #0000) !important;\n}\n/*# sourceMappingURL=/static/project-settings.component-5IRK7U7U.css.map */\n"] }]
  }], () => [], null);
})();
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(ProjectSettingsComponent, { className: "ProjectSettingsComponent", filePath: "src/app/project-settings/project-settings.component.ts", lineNumber: 22 });
})();

// src/app/app.component.ts
var _c016 = ["settingsDialog"];
var _c111 = () => ({ path: "/labeler", text: "Labeler" });
var _c27 = () => ({ path: "/models", text: "Models" });
var _c34 = () => ({ path: "/viewer", text: "Viewer" });
var _c43 = (a0, a12, a2) => [a0, a12, a2];
var _forTrack012 = ($index, $item) => $item.path;
function AppComponent_For_9_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "li")(1, "a", 14);
    \u0275\u0275text(2);
    \u0275\u0275elementEnd()();
  }
  if (rf & 2) {
    const entry_r2 = ctx.$implicit;
    \u0275\u0275advance();
    \u0275\u0275property("routerLink", entry_r2.path);
    \u0275\u0275advance();
    \u0275\u0275textInterpolate(entry_r2.text);
  }
}
function AppComponent_Conditional_11_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "div", 8);
    \u0275\u0275element(1, "span", 15);
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const ctx_r2 = \u0275\u0275nextContext();
    \u0275\u0275attribute("data-tip", "Transcoding videos: " + ctx_r2.fineVideoService.numPendingTranscodeTasks().pending.toString() + " remaining");
  }
}
function AppComponent_Conditional_16_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275element(0, "router-outlet");
  }
}
function AppComponent_Conditional_17_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275element(0, "app-project-settings", 12);
  }
  if (rf & 2) {
    \u0275\u0275property("setupMode", true);
  }
}
function AppComponent_Conditional_20_Template(rf, ctx) {
  if (rf & 1) {
    const _r4 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "app-project-settings", 16);
    \u0275\u0275listener("done", function AppComponent_Conditional_20_Template_app_project_settings_done_0_listener() {
      \u0275\u0275restoreView(_r4);
      const ctx_r2 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r2.settingsDialogOpen.set(false));
    });
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(1, "div", 17)(2, "button", 18);
    \u0275\u0275listener("click", function AppComponent_Conditional_20_Template_button_click_2_listener() {
      \u0275\u0275restoreView(_r4);
      const ctx_r2 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r2.settingsDialogOpen.set(false));
    });
    \u0275\u0275text(3, "close");
    \u0275\u0275elementEnd()();
  }
}
var AppComponent = class _AppComponent {
  projectInfoService = inject2(ProjectInfoService);
  fineVideoService = inject2(FineVideoService);
  // Whether the required initial setup has been done.
  // (Setting data directory, model directory, views).
  projectInfoRequestCompleted = signal(false, ...ngDevMode ? [{ debugName: "projectInfoRequestCompleted" }] : []);
  hasBeenSetup = signal(false, ...ngDevMode ? [{ debugName: "hasBeenSetup" }] : []);
  settingsDialog = viewChild.required("settingsDialog");
  settingsDialogOpen = signal(false, ...ngDevMode ? [{ debugName: "settingsDialogOpen" }] : []);
  async ngOnInit() {
    await this.projectInfoService.loadProjectInfo();
    this.hasBeenSetup.set(Boolean(this.projectInfoService.projectInfo));
    this.projectInfoRequestCompleted.set(true);
  }
  constructor() {
    effect(() => {
      if (this.settingsDialogOpen()) {
        this.openSettingsDialog();
      } else {
        this.closeSettingsDialog();
      }
    });
  }
  openSettingsDialog() {
    const elementRef = this.settingsDialog();
    elementRef.nativeElement.showModal();
  }
  closeSettingsDialog() {
    const elementRef = this.settingsDialog();
    elementRef.nativeElement.close();
  }
  static \u0275fac = function AppComponent_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _AppComponent)();
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _AppComponent, selectors: [["app-root"]], viewQuery: function AppComponent_Query(rf, ctx) {
    if (rf & 1) {
      \u0275\u0275viewQuerySignal(ctx.settingsDialog, _c016, 5);
    }
    if (rf & 2) {
      \u0275\u0275queryAdvance();
    }
  }, decls: 21, vars: 12, consts: [["settingsDialog", ""], [1, "navbar", "bg-base-200", "shadow-lg"], [1, "navbar-start"], ["href", "/"], [1, "text-lg", "font-semibold"], [1, "navbar-center"], [1, "menu", "menu-horizontal", "p-0"], [1, "navbar-end"], [1, "tooltip", "tooltip-left"], ["tabindex", "0", 1, "btn", "btn-ghost", 3, "click", "keydown.enter"], [1, "material-icons"], [1, "flex-grow", "flex", "min-h-0"], [1, "w-lg", "mt-8", 3, "setupMode"], [1, "modal"], ["routerLinkActive", "menu-active", "ariaCurrentWhenActive", "page", 3, "routerLink"], [1, "loading", "loading-bars", "loading-xs"], [1, "modal-box", "w-5/6", "max-w-3xl", "h-2/3", "max-h-150", 3, "done"], [1, "modal-backdrop"], [3, "click"]], template: function AppComponent_Template(rf, ctx) {
    if (rf & 1) {
      const _r1 = \u0275\u0275getCurrentView();
      \u0275\u0275elementStart(0, "header")(1, "nav", 1)(2, "div", 2)(3, "a", 3)(4, "span", 4);
      \u0275\u0275text(5, "Lightning Pose");
      \u0275\u0275elementEnd()()();
      \u0275\u0275elementStart(6, "div", 5)(7, "ul", 6);
      \u0275\u0275repeaterCreate(8, AppComponent_For_9_Template, 3, 2, "li", null, _forTrack012);
      \u0275\u0275elementEnd()();
      \u0275\u0275elementStart(10, "div", 7);
      \u0275\u0275conditionalCreate(11, AppComponent_Conditional_11_Template, 2, 1, "div", 8);
      \u0275\u0275elementStart(12, "button", 9);
      \u0275\u0275listener("click", function AppComponent_Template_button_click_12_listener() {
        \u0275\u0275restoreView(_r1);
        return \u0275\u0275resetView(ctx.settingsDialogOpen.set(true));
      })("keydown.enter", function AppComponent_Template_button_keydown_enter_12_listener() {
        \u0275\u0275restoreView(_r1);
        return \u0275\u0275resetView(ctx.settingsDialogOpen.set(true));
      });
      \u0275\u0275elementStart(13, "span", 10);
      \u0275\u0275text(14, "settings");
      \u0275\u0275elementEnd()()()()();
      \u0275\u0275elementStart(15, "main", 11);
      \u0275\u0275conditionalCreate(16, AppComponent_Conditional_16_Template, 1, 0, "router-outlet")(17, AppComponent_Conditional_17_Template, 1, 1, "app-project-settings", 12);
      \u0275\u0275elementEnd();
      \u0275\u0275elementStart(18, "dialog", 13, 0);
      \u0275\u0275conditionalCreate(20, AppComponent_Conditional_20_Template, 4, 0);
      \u0275\u0275elementEnd();
    }
    if (rf & 2) {
      \u0275\u0275advance(8);
      \u0275\u0275repeater(\u0275\u0275pureFunction3(8, _c43, \u0275\u0275pureFunction0(5, _c111), \u0275\u0275pureFunction0(6, _c27), \u0275\u0275pureFunction0(7, _c34)));
      \u0275\u0275advance(3);
      \u0275\u0275conditional(ctx.fineVideoService.numPendingTranscodeTasks().pending > 0 ? 11 : -1);
      \u0275\u0275advance(4);
      \u0275\u0275classProp("justify-center", !ctx.hasBeenSetup());
      \u0275\u0275advance();
      \u0275\u0275conditional(ctx.hasBeenSetup() ? 16 : 17);
      \u0275\u0275advance(4);
      \u0275\u0275conditional(ctx.settingsDialogOpen() ? 20 : -1);
    }
  }, dependencies: [
    RouterOutlet,
    RouterLink,
    RouterLinkActive,
    ProjectSettingsComponent
  ], styles: ["\n\n[_nghost-%COMP%] {\n  display: flex;\n  flex-direction: column;\n  height: 100vh;\n}\n.navbar[_ngcontent-%COMP%] {\n  min-height: 3rem;\n}\n/*# sourceMappingURL=/static/app.component-UHVEDPZR.css.map */"], changeDetection: 0 });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(AppComponent, [{
    type: Component,
    args: [{ selector: "app-root", imports: [
      RouterOutlet,
      RouterLink,
      RouterLinkActive,
      ProjectSettingsComponent
    ], changeDetection: ChangeDetectionStrategy.OnPush, template: `<style>
  :host {
    display: flex;
    flex-direction: column;
    height: 100vh;
  }
  .navbar {
    min-height: 3rem; /* reduce from default of 4rem */
  }
</style>
<header>
  <nav class="navbar bg-base-200 shadow-lg">
    <div class="navbar-start">
      <a href="/"><span class="text-lg font-semibold">Lightning Pose</span></a>
    </div>

    <div class="navbar-center">
      <ul class="menu menu-horizontal p-0">
        @for (
          entry of [
            { path: "/labeler", text: "Labeler" },
            { path: "/models", text: "Models" },
            { path: "/viewer", text: "Viewer" },
          ];
          track entry.path
        ) {
          <li>
            <a
              [routerLink]="entry.path"
              routerLinkActive="menu-active"
              ariaCurrentWhenActive="page"
              >{{ entry.text }}</a
            >
          </li>
        }
      </ul>
    </div>

    <div class="navbar-end">
      @if (fineVideoService.numPendingTranscodeTasks().pending > 0) {
        <div
          class="tooltip tooltip-left"
          [attr.data-tip]="
            'Transcoding videos: ' +
            fineVideoService.numPendingTranscodeTasks().pending.toString() +
            ' remaining'
          "
        >
          <span class="loading loading-bars loading-xs"></span>
        </div>
      }

      <button
        class="btn btn-ghost"
        tabindex="0"
        (click)="settingsDialogOpen.set(true)"
        (keydown.enter)="settingsDialogOpen.set(true)"
      >
        <span class="material-icons">settings</span>
      </button>
    </div>
  </nav>
</header>

<!-- Set min-height: 0 to allow it to shrink if its content is too large.
  Default min-height for flex items is auto. -->
<main class="flex-grow flex min-h-0" [class.justify-center]="!hasBeenSetup()">
  @if (hasBeenSetup()) {
    <router-outlet />
  } @else {
    <app-project-settings
      [setupMode]="true"
      class="w-lg mt-8"
    ></app-project-settings>
  }
</main>

<!-- Settings dialog -->
<dialog #settingsDialog class="modal">
  @if (settingsDialogOpen()) {
    <app-project-settings
      class="modal-box w-5/6 max-w-3xl h-2/3 max-h-150"
      (done)="settingsDialogOpen.set(false)"
    ></app-project-settings>

    <!-- Makes the dialog close when clicked from outside. -->
    <div class="modal-backdrop">
      <button (click)="settingsDialogOpen.set(false)">close</button>
    </div>
  }
</dialog>
`, styles: ["/* angular:styles/component:css;22d8514f1dd5b50f33b3fb93fdb69668f78eeb349bd672e238e3ac9acfbbda19;/home/ksikka/lightning-pose-app/web_ui/src/app/app.component.html */\n:host {\n  display: flex;\n  flex-direction: column;\n  height: 100vh;\n}\n.navbar {\n  min-height: 3rem;\n}\n/*# sourceMappingURL=/static/app.component-UHVEDPZR.css.map */\n"] }]
  }], () => [], null);
})();
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(AppComponent, { className: "AppComponent", filePath: "src/app/app.component.ts", lineNumber: 28 });
})();

// src/main.ts
bootstrapApplication(AppComponent, appConfig).catch((err) => console.error(err));
//# sourceMappingURL=main-KC4KA54O.js.map
